js-cloudimage-360-view 4.0.0-beta.9 → 4.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.
@@ -1 +1,2111 @@
1
- !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).Cloudimage360View=t()}(this,(function(){"use strict";var e=Object.defineProperty,t=(t,i,n)=>((t,i,n)=>i in t?e(t,i,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[i]=n)(t,"symbol"!=typeof i?i+"":i,n),i="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function n(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var o="Expected a function",s=/^\s+|\s+$/g,a=/^[-+]0x[0-9a-f]+$/i,r=/^0b[01]+$/i,l=/^0o[0-7]+$/i,c=parseInt,h="object"==typeof i&&i&&i.Object===Object&&i,d="object"==typeof self&&self&&self.Object===Object&&self,p=h||d||Function("return this")(),u=Object.prototype.toString,f=Math.max,m=Math.min,g=function(){return p.Date.now()};function v(e,t,i){var n,s,a,r,l,c,h=0,d=!1,p=!1,u=!0;if("function"!=typeof e)throw new TypeError(o);function v(t){var i=n,o=s;return n=s=void 0,h=t,r=e.apply(o,i)}function w(e){var i=e-c;return void 0===c||i>=t||i<0||p&&e-h>=a}function x(){var e=g();if(w(e))return I(e);l=setTimeout(x,function(e){var i=t-(e-c);return p?m(i,a-(e-h)):i}(e))}function I(e){return l=void 0,u&&n?v(e):(n=s=void 0,r)}function C(){var e=g(),i=w(e);if(n=arguments,s=this,c=e,i){if(void 0===l)return function(e){return h=e,l=setTimeout(x,t),d?v(e):r}(c);if(p)return l=setTimeout(x,t),v(c)}return void 0===l&&(l=setTimeout(x,t)),r}return t=b(t)||0,y(i)&&(d=!!i.leading,a=(p="maxWait"in i)?f(b(i.maxWait)||0,t):a,u="trailing"in i?!!i.trailing:u),C.cancel=function(){void 0!==l&&clearTimeout(l),h=0,n=c=s=l=void 0},C.flush=function(){return void 0===l?r:I(g())},C}function y(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function b(e){if("number"==typeof e)return e;if(function(e){return"symbol"==typeof e||function(e){return!!e&&"object"==typeof e}(e)&&"[object Symbol]"==u.call(e)}(e))return NaN;if(y(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=y(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(s,"");var i=r.test(e);return i||l.test(e)?c(e.slice(2),i?2:8):a.test(e)?NaN:+e}const w=n((function(e,t,i){var n=!0,s=!0;if("function"!=typeof e)throw new TypeError(o);return y(i)&&(n="leading"in i?!!i.leading:n,s="trailing"in i?!!i.trailing:s),v(e,t,{leading:n,maxWait:t,trailing:s})})),x="spin-x",I="spin-y",C="spin-xy",L="spin-yx",O=[!1,0,null,void 0,"false","0","null","undefined"],Y="x-axis",k="y-axis",S=["folder","folderX","folderY","filenameX","filenameY","imageListX","imageListY","indexZeroBase","amountX","amountY"],R=[37,39],X=[38,40],E={folder:"/",apiVersion:"v7",filenameX:"image-{index}.jpg",filenameY:null,imageListX:null,imageListY:null,indexZeroBase:0,amountX:0,amountY:0,speed:80,dragSpeed:150,draggable:!0,swipeable:!0,keys:!1,keysReverse:!1,autoplay:!1,autoplayBehavior:x,playOnce:!1,autoplayReverse:!1,pointerZoom:0,fullscreen:!1,magnifier:null,bottomCircle:!0,bottomCircleOffset:5,ciToken:null,ciFilters:null,ciTransformation:null,lazyload:!0,dragReverse:!1,stopAtEdges:!1,imageInfo:!1,initialIconShown:!0,hotspots:null},T=(e,t,i)=>e.getAttribute(t)||e.getAttribute(`data-${t}`)||i,A=(e,t,i)=>e.hasAttribute(t)||e.hasAttribute(`data-${t}`)||i,H=(e,t)=>"false"===T(e,t,null),W=(e,t)=>{const{folder:i,apiVersion:n,filename:o="",ciParams:s}=e,{ciToken:a,ciFilters:r,ciTransformation:l}=s||{},c=`${i}${o}`;if(!a)return c;const h=O.includes(n)?null:n,d=h?`${h}/`:"",p=((e=1)=>{const t=Math.round(window.devicePixelRatio||1);return parseInt(e)*t})(t),u=((e,t,i)=>new URL(e).origin.includes("cloudimg")?e:`https://${t}.cloudimg.io/${i}${e}`)(c,a,d),f=(({ciTransformation:e,responsiveWidth:t,ciFilters:i})=>`${e||`width=${t}`}${i?`&f=${i}`:""}`)({ciTransformation:l,responsiveWidth:p,ciFilters:r});return`${u}${f?"?":""}${f}`},Z=(e,t)=>((e,t,i)=>{const[n,o]=e.split("?"),s=`${t}=${encodeURIComponent(i)}`;if(!o)return`${n}?${s}`;const a=new URLSearchParams(o);return a.set(t,i),`${n}?${a.toString()}`})(e,"width",t),M=(e,t=0)=>(e+="").length>=t?e:new Array(t-e.length+1).join("0")+e,B=({cdnPathX:e,cdnPathY:t,configX:i,configY:n,onFirstImageLoad:o,onImageLoad:s,onAllImagesLoad:a})=>{let r={x:!1,y:!1},l=[],c=[];const h=e||i.imageList.length,d=t||n.imageList.length,p=({cdnPath:e,config:t,orientation:i,loadedImages:n,onFirstImageLoad:o})=>{const h=i===Y,d=t.imageList.length?t.imageList:((e,{amount:t=0,indexZeroBase:i=0}={})=>Array.from({length:t},((t,n)=>e.replace("{index}",M(n+1,i)))))(e,t);(({imagesUrls:e,onFirstImageLoad:t,onImageLoad:i,onAllImagesLoad:n,autoplayReverse:o})=>{let s=0;const a=e.length,r=[],l=(e,t)=>{const o=new Image;o.crossOrigin="anonymous",o.src=e,o.onload=async()=>{const l=await createImageBitmap(o),h={src:e,bitmapImage:l,naturalWidth:c.naturalWidth,naturalHeight:c.naturalHeight};s++,r[t]=h,null==i||i(h,t),s===a&&(null==n||n(r))},o.onerror=()=>{console.error(`Failed to load image: ${e}`),s++,s===a&&(null==n||n(r))}},c=new Image,h=e[o?e.length-1:0];c.crossOrigin="anonymous",c.src=h,c.onload=async()=>{const n=await createImageBitmap(c),o={src:h,bitmapImage:n,naturalWidth:c.naturalWidth,naturalHeight:c.naturalHeight};r[0]=o,s++,null==t||t(o),null==i||i(o,0);for(let t=1;t<e.length;t++)l(e[t],t)},c.onerror=()=>{console.error(`Failed to load first image: ${e[0]}`),s++;for(let t=1;t<e.length;t++)l(e[t],t)}})({imagesUrls:d,onFirstImageLoad:o,onImageLoad:(e,t)=>{null==s||s(e,t,i),n[t]=e},onAllImagesLoad:e=>{n=e,r[h?"x":"y"]=!0,r.x&&r.y&&a(l,c)},autoplayReverse:t.autoplayReverse})};h?p({cdnPath:e,config:i,orientation:Y,loadedImages:l,onFirstImageLoad:o}):r.x=!0,d?p({cdnPath:t,config:n,orientation:k,loadedImages:c,onFirstImageLoad:h?void 0:o}):r.y=!0},P=e=>{const t=document.createElement("div");return t.className="cloudimage-360-icons-container",e.appendChild(t),t},D=(e,t)=>{const i=e.querySelector(t);i&&i.parentNode.removeChild(i)},V=e=>{const t=((e,t)=>{const[i,n]=e.split("?");if(!n)return e;const o=new RegExp(`^${t}=|&${t}=`),s=n.split("&").filter((e=>!o.test(e))).join("&");return s?`${i}?${s}`:i})(e,"width"),i=t.includes("?")?"&":"?";return`${t}${i}width=${150*devicePixelRatio}`},j=(e,t)=>{const{imageList:i,indexZeroBase:n}=t;if(i.length)try{return((e,t)=>{const[i]=e,n=/(https?):\/\//i.test(i);return W({...t,folder:n?"":t.folder,filename:i})})(JSON.parse(i),t)}catch(o){console.error(`Wrong format in image-list attribute: ${o.message}`)}return((e,t)=>{const i=M(1,t);return e.replace("{index}",i)})(e,n)},F=(e,t,i)=>{const n=new Image;return n.setAttribute(t?"data-src":"src",e),n.className=i,n.style.cssText=`\n position: ${t?"absolute":"static"};\n width: 100%;\n inset: 0;\n height: 100%;\n object-fit: contain;\n object-position: center;\n filter: blur(10px);\n `,n},G=(e,t,i)=>{const{innerBox:n,imageList:o,lazyload:s}=t||{},[a]=o,r=a||j(e,t),l=V(r),c=F(l,s,"cloudimage-lazy"),h=F(l,!1,"cloudimage-360-placeholder");var d;c.onload=e=>{D(n,".cloudimage-lazy"),i&&i({event:e,width:c.width,height:c.height,naturalWidth:c.naturalWidth,naturalHeight:c.naturalHeight,src:l})},n.appendChild(c),n.appendChild(h),d=c,new IntersectionObserver(((e,t)=>{e.forEach((e=>{e.isIntersecting&&((e=>{const t=e.getAttribute("data-src");t&&(e.src=t)})(e.target),t.unobserve(e.target))}))}),{root:null,rootMargin:"0px",threshold:.1}).observe(d)},z=(e,t,i)=>{const{container:n,w:o,h:s,zoom:a,bw:r,offsetX:l,offsetY:c}=t,h=((e,t)=>{const i=t.getBoundingClientRect(),n=e.touches?e.touches[0].clientX:e.clientX,o=e.touches?e.touches[0].clientY:e.clientY;return{x:n-i.left,y:o-i.top}})(e,n);let d=h.x,p=h.y;d=Math.max(o/a,Math.min(d,n.offsetWidth-o/a)),p=Math.max(s/a,Math.min(p,n.offsetHeight-s/a)),i.style.left=d-o+"px",i.style.top=p-s+"px";const u=(d-l)*a-o+r,f=(p-c)*a-s+r;i.style.backgroundPosition=`-${u}px -${f}px`},N=(e,{bottom:t,top:i})=>{e?t():i()},U=(e,{left:t,right:i})=>{e?t():i()},$=(e,t)=>{const i=[...R];return t?[...i,...X].includes(e):i.includes(e)},K=(e,t=150)=>{let i;return function(...n){clearTimeout(i),i=setTimeout((()=>{e.apply(this,n)}),t)}},q="IWZ1bmN0aW9uKCl7InVzZSBzdHJpY3QiO2xldCB0LGUsYSxpLG8sbjtzZWxmLm9ubWVzc2FnZT1hc3luYyB0PT57Y29uc3R7YWN0aW9uOmUsb2Zmc2NyZWVuOmEsZGV2aWNlUGl4ZWxSYXRpbzppLGltYWdlRGF0YTpvLHpvb21TY2FsZTpuLHBvaW50ZXJYOnMscG9pbnRlclk6ZyxpbWFnZUFzcGVjdFJhdGlvOnIsY29udGFpbmVyV2lkdGg6Yyxjb250YWluZXJIZWlnaHQ6Zn09dC5kYXRhO3N3aXRjaChlKXtjYXNlImluaXRDYW52YXMiOmgoYSxpKTticmVhaztjYXNlImFkYXB0Q2FudmFzU2l6ZSI6bShyLGMsZik7YnJlYWs7Y2FzZSJkcmF3SW1hZ2VPbkNhbnZhcyI6ZChvLG4scyxnKX19O2NvbnN0IGg9KGksbyk9Pnt0PWksZT10LmdldENvbnRleHQoIjJkIiksYT1vfSxtPShoLG0sZCk9PntuPWg+bS9kLHQud2lkdGg9bSphLHQuaGVpZ2h0PWQqYSxlLnNjYWxlKGEsYSksbj8oaT1tLG89bS9oKToobz1kLGk9ZCpoKSxlLmltYWdlU21vb3RoaW5nRW5hYmxlZD0hMCxlLmltYWdlU21vb3RoaW5nUXVhbGl0eT0iaGlnaCJ9LGQ9KGg9e30sbT0xLGQ9MCxzPTApPT57Y29uc3R7Yml0bWFwSW1hZ2U6Z309aDtpZighdHx8IWcpcmV0dXJuO2xldCByLGM7aWYobj8ocj0wLGM9KHQuaGVpZ2h0L2EtbykvMik6KHI9KHQud2lkdGgvYS1pKS8yLGM9MCksZS5jbGVhclJlY3QoMCwwLHQud2lkdGgsdC5oZWlnaHQpLDEhPT1tKXtjb25zdHt6b29tZWRXaWR0aDp0LHpvb21lZEhlaWdodDphfT0oKHQsZSxhKT0+KHt6b29tZWRXaWR0aDp0L2Esem9vbWVkSGVpZ2h0OmUvYX0pKShpLG8sbSkse3pvb21PZmZzZXRYOm4sem9vbU9mZnNldFk6Zn09KCh7cG9pbnRlclg6dCxwb2ludGVyWTplLGltYWdlRGF0YTphLHpvb21lZFdpZHRoOmksem9vbWVkSGVpZ2h0Om8sZHJhd1dpZHRoOm4sZHJhd0hlaWdodDpofSk9Pntjb25zdHtuYXR1cmFsV2lkdGg6bSxuYXR1cmFsSGVpZ2h0OmR9PWE7bGV0IHM9dC9uKm0taS8yLGc9ZS9oKmQtby8yO2NvbnN0IHI9TWF0aC5tYXgoMCxtLWkpLGM9TWF0aC5tYXgoMCxkLW8pO3JldHVybiBzPU1hdGgubWF4KDAsTWF0aC5taW4ocyxyKSksZz1NYXRoLm1heCgwLE1hdGgubWluKGcsYykpLHt6b29tT2Zmc2V0WDpzLHpvb21PZmZzZXRZOmd9fSkoe3BvaW50ZXJYOmQscG9pbnRlclk6cyxpbWFnZURhdGE6aCx6b29tZWRXaWR0aDp0LHpvb21lZEhlaWdodDphLGRyYXdXaWR0aDppLGRyYXdIZWlnaHQ6b30pO2UuZHJhd0ltYWdlKGcsbixmLHQsYSxyLGMsaSxvKX1lbHNlIGUuZHJhd0ltYWdlKGcscixjLGksbyl9fSgpOwo=",Q="undefined"!=typeof self&&self.Blob&&new Blob([(J=q,Uint8Array.from(atob(J),(e=>e.charCodeAt(0))))],{type:"text/javascript;charset=utf-8"});var J;function _(e){let t;try{if(t=Q&&(self.URL||self.webkitURL).createObjectURL(Q),!t)throw"";const i=new Worker(t,{name:null==e?void 0:e.name});return i.addEventListener("error",(()=>{(self.URL||self.webkitURL).revokeObjectURL(t)})),i}catch(i){return new Worker("data:text/javascript;base64,"+q,{name:null==e?void 0:e.name})}finally{t&&(self.URL||self.webkitURL).revokeObjectURL(t)}}const ee=(e,t,i)=>e.filter((e=>(e=>"x"===e?Y:k)(e.orientation)===i&&t in e.positions)),te=e=>{const t=Object.entries(e).sort((([e],[t])=>Number(e)-Number(t)));let i=null,n=null;const o={};for(const[s,a]of t)if(a){const{x:e,y:t}=a;null!=e&&(i=e),null!=t&&(n=t),o[s]={x:e||i,y:t||n}}else o[s]={x:i,y:n};return o};var ie="top",ne="bottom",oe="right",se="left",ae="auto",re=[ie,ne,oe,se],le="start",ce="end",he="viewport",de="popper",pe=re.reduce((function(e,t){return e.concat([t+"-"+le,t+"-"+ce])}),[]),ue=[].concat(re,[ae]).reduce((function(e,t){return e.concat([t,t+"-"+le,t+"-"+ce])}),[]),fe=["beforeRead","read","afterRead","beforeMain","main","afterMain","beforeWrite","write","afterWrite"];function me(e){return e?(e.nodeName||"").toLowerCase():null}function ge(e){if(null==e)return window;if("[object Window]"!==e.toString()){var t=e.ownerDocument;return t&&t.defaultView||window}return e}function ve(e){return e instanceof ge(e).Element||e instanceof Element}function ye(e){return e instanceof ge(e).HTMLElement||e instanceof HTMLElement}function be(e){return"undefined"!=typeof ShadowRoot&&(e instanceof ge(e).ShadowRoot||e instanceof ShadowRoot)}const we={name:"applyStyles",enabled:!0,phase:"write",fn:function(e){var t=e.state;Object.keys(t.elements).forEach((function(e){var i=t.styles[e]||{},n=t.attributes[e]||{},o=t.elements[e];ye(o)&&me(o)&&(Object.assign(o.style,i),Object.keys(n).forEach((function(e){var t=n[e];!1===t?o.removeAttribute(e):o.setAttribute(e,!0===t?"":t)})))}))},effect:function(e){var t=e.state,i={popper:{position:t.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(t.elements.popper.style,i.popper),t.styles=i,t.elements.arrow&&Object.assign(t.elements.arrow.style,i.arrow),function(){Object.keys(t.elements).forEach((function(e){var n=t.elements[e],o=t.attributes[e]||{},s=Object.keys(t.styles.hasOwnProperty(e)?t.styles[e]:i[e]).reduce((function(e,t){return e[t]="",e}),{});ye(n)&&me(n)&&(Object.assign(n.style,s),Object.keys(o).forEach((function(e){n.removeAttribute(e)})))}))}},requires:["computeStyles"]};function xe(e){return e.split("-")[0]}var Ie=Math.max,Ce=Math.min,Le=Math.round;function Oe(){var e=navigator.userAgentData;return null!=e&&e.brands&&Array.isArray(e.brands)?e.brands.map((function(e){return e.brand+"/"+e.version})).join(" "):navigator.userAgent}function Ye(){return!/^((?!chrome|android).)*safari/i.test(Oe())}function ke(e,t,i){void 0===t&&(t=!1),void 0===i&&(i=!1);var n=e.getBoundingClientRect(),o=1,s=1;t&&ye(e)&&(o=e.offsetWidth>0&&Le(n.width)/e.offsetWidth||1,s=e.offsetHeight>0&&Le(n.height)/e.offsetHeight||1);var a=(ve(e)?ge(e):window).visualViewport,r=!Ye()&&i,l=(n.left+(r&&a?a.offsetLeft:0))/o,c=(n.top+(r&&a?a.offsetTop:0))/s,h=n.width/o,d=n.height/s;return{width:h,height:d,top:c,right:l+h,bottom:c+d,left:l,x:l,y:c}}function Se(e){var t=ke(e),i=e.offsetWidth,n=e.offsetHeight;return Math.abs(t.width-i)<=1&&(i=t.width),Math.abs(t.height-n)<=1&&(n=t.height),{x:e.offsetLeft,y:e.offsetTop,width:i,height:n}}function Re(e,t){var i=t.getRootNode&&t.getRootNode();if(e.contains(t))return!0;if(i&&be(i)){var n=t;do{if(n&&e.isSameNode(n))return!0;n=n.parentNode||n.host}while(n)}return!1}function Xe(e){return ge(e).getComputedStyle(e)}function Ee(e){return["table","td","th"].indexOf(me(e))>=0}function Te(e){return((ve(e)?e.ownerDocument:e.document)||window.document).documentElement}function Ae(e){return"html"===me(e)?e:e.assignedSlot||e.parentNode||(be(e)?e.host:null)||Te(e)}function He(e){return ye(e)&&"fixed"!==Xe(e).position?e.offsetParent:null}function We(e){for(var t=ge(e),i=He(e);i&&Ee(i)&&"static"===Xe(i).position;)i=He(i);return i&&("html"===me(i)||"body"===me(i)&&"static"===Xe(i).position)?t:i||function(e){var t=/firefox/i.test(Oe());if(/Trident/i.test(Oe())&&ye(e)&&"fixed"===Xe(e).position)return null;var i=Ae(e);for(be(i)&&(i=i.host);ye(i)&&["html","body"].indexOf(me(i))<0;){var n=Xe(i);if("none"!==n.transform||"none"!==n.perspective||"paint"===n.contain||-1!==["transform","perspective"].indexOf(n.willChange)||t&&"filter"===n.willChange||t&&n.filter&&"none"!==n.filter)return i;i=i.parentNode}return null}(e)||t}function Ze(e){return["top","bottom"].indexOf(e)>=0?"x":"y"}function Me(e,t,i){return Ie(e,Ce(t,i))}function Be(e){return Object.assign({},{top:0,right:0,bottom:0,left:0},e)}function Pe(e,t){return t.reduce((function(t,i){return t[i]=e,t}),{})}function De(e){return e.split("-")[1]}var Ve={top:"auto",right:"auto",bottom:"auto",left:"auto"};function je(e){var t,i=e.popper,n=e.popperRect,o=e.placement,s=e.variation,a=e.offsets,r=e.position,l=e.gpuAcceleration,c=e.adaptive,h=e.roundOffsets,d=e.isFixed,p=a.x,u=void 0===p?0:p,f=a.y,m=void 0===f?0:f,g="function"==typeof h?h({x:u,y:m}):{x:u,y:m};u=g.x,m=g.y;var v=a.hasOwnProperty("x"),y=a.hasOwnProperty("y"),b=se,w=ie,x=window;if(c){var I=We(i),C="clientHeight",L="clientWidth";if(I===ge(i)&&"static"!==Xe(I=Te(i)).position&&"absolute"===r&&(C="scrollHeight",L="scrollWidth"),o===ie||(o===se||o===oe)&&s===ce)w=ne,m-=(d&&I===x&&x.visualViewport?x.visualViewport.height:I[C])-n.height,m*=l?1:-1;if(o===se||(o===ie||o===ne)&&s===ce)b=oe,u-=(d&&I===x&&x.visualViewport?x.visualViewport.width:I[L])-n.width,u*=l?1:-1}var O,Y=Object.assign({position:r},c&&Ve),k=!0===h?function(e,t){var i=e.x,n=e.y,o=t.devicePixelRatio||1;return{x:Le(i*o)/o||0,y:Le(n*o)/o||0}}({x:u,y:m},ge(i)):{x:u,y:m};return u=k.x,m=k.y,l?Object.assign({},Y,((O={})[w]=y?"0":"",O[b]=v?"0":"",O.transform=(x.devicePixelRatio||1)<=1?"translate("+u+"px, "+m+"px)":"translate3d("+u+"px, "+m+"px, 0)",O)):Object.assign({},Y,((t={})[w]=y?m+"px":"",t[b]=v?u+"px":"",t.transform="",t))}var Fe={passive:!0};var Ge={left:"right",right:"left",bottom:"top",top:"bottom"};function ze(e){return e.replace(/left|right|bottom|top/g,(function(e){return Ge[e]}))}var Ne={start:"end",end:"start"};function Ue(e){return e.replace(/start|end/g,(function(e){return Ne[e]}))}function $e(e){var t=ge(e);return{scrollLeft:t.pageXOffset,scrollTop:t.pageYOffset}}function Ke(e){return ke(Te(e)).left+$e(e).scrollLeft}function qe(e){var t=Xe(e),i=t.overflow,n=t.overflowX,o=t.overflowY;return/auto|scroll|overlay|hidden/.test(i+o+n)}function Qe(e){return["html","body","#document"].indexOf(me(e))>=0?e.ownerDocument.body:ye(e)&&qe(e)?e:Qe(Ae(e))}function Je(e,t){var i;void 0===t&&(t=[]);var n=Qe(e),o=n===(null==(i=e.ownerDocument)?void 0:i.body),s=ge(n),a=o?[s].concat(s.visualViewport||[],qe(n)?n:[]):n,r=t.concat(a);return o?r:r.concat(Je(Ae(a)))}function _e(e){return Object.assign({},e,{left:e.x,top:e.y,right:e.x+e.width,bottom:e.y+e.height})}function et(e,t,i){return t===he?_e(function(e,t){var i=ge(e),n=Te(e),o=i.visualViewport,s=n.clientWidth,a=n.clientHeight,r=0,l=0;if(o){s=o.width,a=o.height;var c=Ye();(c||!c&&"fixed"===t)&&(r=o.offsetLeft,l=o.offsetTop)}return{width:s,height:a,x:r+Ke(e),y:l}}(e,i)):ve(t)?function(e,t){var i=ke(e,!1,"fixed"===t);return i.top=i.top+e.clientTop,i.left=i.left+e.clientLeft,i.bottom=i.top+e.clientHeight,i.right=i.left+e.clientWidth,i.width=e.clientWidth,i.height=e.clientHeight,i.x=i.left,i.y=i.top,i}(t,i):_e(function(e){var t,i=Te(e),n=$e(e),o=null==(t=e.ownerDocument)?void 0:t.body,s=Ie(i.scrollWidth,i.clientWidth,o?o.scrollWidth:0,o?o.clientWidth:0),a=Ie(i.scrollHeight,i.clientHeight,o?o.scrollHeight:0,o?o.clientHeight:0),r=-n.scrollLeft+Ke(e),l=-n.scrollTop;return"rtl"===Xe(o||i).direction&&(r+=Ie(i.clientWidth,o?o.clientWidth:0)-s),{width:s,height:a,x:r,y:l}}(Te(e)))}function tt(e,t,i,n){var o="clippingParents"===t?function(e){var t=Je(Ae(e)),i=["absolute","fixed"].indexOf(Xe(e).position)>=0&&ye(e)?We(e):e;return ve(i)?t.filter((function(e){return ve(e)&&Re(e,i)&&"body"!==me(e)})):[]}(e):[].concat(t),s=[].concat(o,[i]),a=s[0],r=s.reduce((function(t,i){var o=et(e,i,n);return t.top=Ie(o.top,t.top),t.right=Ce(o.right,t.right),t.bottom=Ce(o.bottom,t.bottom),t.left=Ie(o.left,t.left),t}),et(e,a,n));return r.width=r.right-r.left,r.height=r.bottom-r.top,r.x=r.left,r.y=r.top,r}function it(e){var t,i=e.reference,n=e.element,o=e.placement,s=o?xe(o):null,a=o?De(o):null,r=i.x+i.width/2-n.width/2,l=i.y+i.height/2-n.height/2;switch(s){case ie:t={x:r,y:i.y-n.height};break;case ne:t={x:r,y:i.y+i.height};break;case oe:t={x:i.x+i.width,y:l};break;case se:t={x:i.x-n.width,y:l};break;default:t={x:i.x,y:i.y}}var c=s?Ze(s):null;if(null!=c){var h="y"===c?"height":"width";switch(a){case le:t[c]=t[c]-(i[h]/2-n[h]/2);break;case ce:t[c]=t[c]+(i[h]/2-n[h]/2)}}return t}function nt(e,t){void 0===t&&(t={});var i=t,n=i.placement,o=void 0===n?e.placement:n,s=i.strategy,a=void 0===s?e.strategy:s,r=i.boundary,l=void 0===r?"clippingParents":r,c=i.rootBoundary,h=void 0===c?he:c,d=i.elementContext,p=void 0===d?de:d,u=i.altBoundary,f=void 0!==u&&u,m=i.padding,g=void 0===m?0:m,v=Be("number"!=typeof g?g:Pe(g,re)),y=p===de?"reference":de,b=e.rects.popper,w=e.elements[f?y:p],x=tt(ve(w)?w:w.contextElement||Te(e.elements.popper),l,h,a),I=ke(e.elements.reference),C=it({reference:I,element:b,strategy:"absolute",placement:o}),L=_e(Object.assign({},b,C)),O=p===de?L:I,Y={top:x.top-O.top+v.top,bottom:O.bottom-x.bottom+v.bottom,left:x.left-O.left+v.left,right:O.right-x.right+v.right},k=e.modifiersData.offset;if(p===de&&k){var S=k[o];Object.keys(Y).forEach((function(e){var t=[oe,ne].indexOf(e)>=0?1:-1,i=[ie,ne].indexOf(e)>=0?"y":"x";Y[e]+=S[i]*t}))}return Y}function ot(e,t,i){return void 0===i&&(i={x:0,y:0}),{top:e.top-t.height-i.y,right:e.right-t.width+i.x,bottom:e.bottom-t.height+i.y,left:e.left-t.width-i.x}}function st(e){return[ie,oe,ne,se].some((function(t){return e[t]>=0}))}function at(e,t,i){void 0===i&&(i=!1);var n,o,s=ye(t),a=ye(t)&&function(e){var t=e.getBoundingClientRect(),i=Le(t.width)/e.offsetWidth||1,n=Le(t.height)/e.offsetHeight||1;return 1!==i||1!==n}(t),r=Te(t),l=ke(e,a,i),c={scrollLeft:0,scrollTop:0},h={x:0,y:0};return(s||!s&&!i)&&(("body"!==me(t)||qe(r))&&(c=(n=t)!==ge(n)&&ye(n)?{scrollLeft:(o=n).scrollLeft,scrollTop:o.scrollTop}:$e(n)),ye(t)?((h=ke(t,!0)).x+=t.clientLeft,h.y+=t.clientTop):r&&(h.x=Ke(r))),{x:l.left+c.scrollLeft-h.x,y:l.top+c.scrollTop-h.y,width:l.width,height:l.height}}function rt(e){var t=new Map,i=new Set,n=[];function o(e){i.add(e.name),[].concat(e.requires||[],e.requiresIfExists||[]).forEach((function(e){if(!i.has(e)){var n=t.get(e);n&&o(n)}})),n.push(e)}return e.forEach((function(e){t.set(e.name,e)})),e.forEach((function(e){i.has(e.name)||o(e)})),n}var lt={placement:"bottom",modifiers:[],strategy:"absolute"};function ct(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];return!t.some((function(e){return!(e&&"function"==typeof e.getBoundingClientRect)}))}function ht(e){void 0===e&&(e={});var t=e,i=t.defaultModifiers,n=void 0===i?[]:i,o=t.defaultOptions,s=void 0===o?lt:o;return function(e,t,i){void 0===i&&(i=s);var o,a,r={placement:"bottom",orderedModifiers:[],options:Object.assign({},lt,s),modifiersData:{},elements:{reference:e,popper:t},attributes:{},styles:{}},l=[],c=!1,h={state:r,setOptions:function(i){var o="function"==typeof i?i(r.options):i;d(),r.options=Object.assign({},s,r.options,o),r.scrollParents={reference:ve(e)?Je(e):e.contextElement?Je(e.contextElement):[],popper:Je(t)};var a,c,p=function(e){var t=rt(e);return fe.reduce((function(e,i){return e.concat(t.filter((function(e){return e.phase===i})))}),[])}((a=[].concat(n,r.options.modifiers),c=a.reduce((function(e,t){var i=e[t.name];return e[t.name]=i?Object.assign({},i,t,{options:Object.assign({},i.options,t.options),data:Object.assign({},i.data,t.data)}):t,e}),{}),Object.keys(c).map((function(e){return c[e]}))));return r.orderedModifiers=p.filter((function(e){return e.enabled})),r.orderedModifiers.forEach((function(e){var t=e.name,i=e.options,n=void 0===i?{}:i,o=e.effect;if("function"==typeof o){var s=o({state:r,name:t,instance:h,options:n}),a=function(){};l.push(s||a)}})),h.update()},forceUpdate:function(){if(!c){var e=r.elements,t=e.reference,i=e.popper;if(ct(t,i)){r.rects={reference:at(t,We(i),"fixed"===r.options.strategy),popper:Se(i)},r.reset=!1,r.placement=r.options.placement,r.orderedModifiers.forEach((function(e){return r.modifiersData[e.name]=Object.assign({},e.data)}));for(var n=0;n<r.orderedModifiers.length;n++)if(!0!==r.reset){var o=r.orderedModifiers[n],s=o.fn,a=o.options,l=void 0===a?{}:a,d=o.name;"function"==typeof s&&(r=s({state:r,options:l,name:d,instance:h})||r)}else r.reset=!1,n=-1}}},update:(o=function(){return new Promise((function(e){h.forceUpdate(),e(r)}))},function(){return a||(a=new Promise((function(e){Promise.resolve().then((function(){a=void 0,e(o())}))}))),a}),destroy:function(){d(),c=!0}};if(!ct(e,t))return h;function d(){l.forEach((function(e){return e()})),l=[]}return h.setOptions(i).then((function(e){!c&&i.onFirstUpdate&&i.onFirstUpdate(e)})),h}}var dt=ht({defaultModifiers:[{name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:function(e){var t=e.state,i=e.instance,n=e.options,o=n.scroll,s=void 0===o||o,a=n.resize,r=void 0===a||a,l=ge(t.elements.popper),c=[].concat(t.scrollParents.reference,t.scrollParents.popper);return s&&c.forEach((function(e){e.addEventListener("scroll",i.update,Fe)})),r&&l.addEventListener("resize",i.update,Fe),function(){s&&c.forEach((function(e){e.removeEventListener("scroll",i.update,Fe)})),r&&l.removeEventListener("resize",i.update,Fe)}},data:{}},{name:"popperOffsets",enabled:!0,phase:"read",fn:function(e){var t=e.state,i=e.name;t.modifiersData[i]=it({reference:t.rects.reference,element:t.rects.popper,strategy:"absolute",placement:t.placement})},data:{}},{name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:function(e){var t=e.state,i=e.options,n=i.gpuAcceleration,o=void 0===n||n,s=i.adaptive,a=void 0===s||s,r=i.roundOffsets,l=void 0===r||r,c={placement:xe(t.placement),variation:De(t.placement),popper:t.elements.popper,popperRect:t.rects.popper,gpuAcceleration:o,isFixed:"fixed"===t.options.strategy};null!=t.modifiersData.popperOffsets&&(t.styles.popper=Object.assign({},t.styles.popper,je(Object.assign({},c,{offsets:t.modifiersData.popperOffsets,position:t.options.strategy,adaptive:a,roundOffsets:l})))),null!=t.modifiersData.arrow&&(t.styles.arrow=Object.assign({},t.styles.arrow,je(Object.assign({},c,{offsets:t.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:l})))),t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-placement":t.placement})},data:{}},we,{name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:function(e){var t=e.state,i=e.options,n=e.name,o=i.offset,s=void 0===o?[0,0]:o,a=ue.reduce((function(e,i){return e[i]=function(e,t,i){var n=xe(e),o=[se,ie].indexOf(n)>=0?-1:1,s="function"==typeof i?i(Object.assign({},t,{placement:e})):i,a=s[0],r=s[1];return a=a||0,r=(r||0)*o,[se,oe].indexOf(n)>=0?{x:r,y:a}:{x:a,y:r}}(i,t.rects,s),e}),{}),r=a[t.placement],l=r.x,c=r.y;null!=t.modifiersData.popperOffsets&&(t.modifiersData.popperOffsets.x+=l,t.modifiersData.popperOffsets.y+=c),t.modifiersData[n]=a}},{name:"flip",enabled:!0,phase:"main",fn:function(e){var t=e.state,i=e.options,n=e.name;if(!t.modifiersData[n]._skip){for(var o=i.mainAxis,s=void 0===o||o,a=i.altAxis,r=void 0===a||a,l=i.fallbackPlacements,c=i.padding,h=i.boundary,d=i.rootBoundary,p=i.altBoundary,u=i.flipVariations,f=void 0===u||u,m=i.allowedAutoPlacements,g=t.options.placement,v=xe(g),y=l||(v===g||!f?[ze(g)]:function(e){if(xe(e)===ae)return[];var t=ze(e);return[Ue(e),t,Ue(t)]}(g)),b=[g].concat(y).reduce((function(e,i){return e.concat(xe(i)===ae?function(e,t){void 0===t&&(t={});var i=t,n=i.placement,o=i.boundary,s=i.rootBoundary,a=i.padding,r=i.flipVariations,l=i.allowedAutoPlacements,c=void 0===l?ue:l,h=De(n),d=h?r?pe:pe.filter((function(e){return De(e)===h})):re,p=d.filter((function(e){return c.indexOf(e)>=0}));0===p.length&&(p=d);var u=p.reduce((function(t,i){return t[i]=nt(e,{placement:i,boundary:o,rootBoundary:s,padding:a})[xe(i)],t}),{});return Object.keys(u).sort((function(e,t){return u[e]-u[t]}))}(t,{placement:i,boundary:h,rootBoundary:d,padding:c,flipVariations:f,allowedAutoPlacements:m}):i)}),[]),w=t.rects.reference,x=t.rects.popper,I=new Map,C=!0,L=b[0],O=0;O<b.length;O++){var Y=b[O],k=xe(Y),S=De(Y)===le,R=[ie,ne].indexOf(k)>=0,X=R?"width":"height",E=nt(t,{placement:Y,boundary:h,rootBoundary:d,altBoundary:p,padding:c}),T=R?S?oe:se:S?ne:ie;w[X]>x[X]&&(T=ze(T));var A=ze(T),H=[];if(s&&H.push(E[k]<=0),r&&H.push(E[T]<=0,E[A]<=0),H.every((function(e){return e}))){L=Y,C=!1;break}I.set(Y,H)}if(C)for(var W=function(e){var t=b.find((function(t){var i=I.get(t);if(i)return i.slice(0,e).every((function(e){return e}))}));if(t)return L=t,"break"},Z=f?3:1;Z>0;Z--){if("break"===W(Z))break}t.placement!==L&&(t.modifiersData[n]._skip=!0,t.placement=L,t.reset=!0)}},requiresIfExists:["offset"],data:{_skip:!1}},{name:"preventOverflow",enabled:!0,phase:"main",fn:function(e){var t=e.state,i=e.options,n=e.name,o=i.mainAxis,s=void 0===o||o,a=i.altAxis,r=void 0!==a&&a,l=i.boundary,c=i.rootBoundary,h=i.altBoundary,d=i.padding,p=i.tether,u=void 0===p||p,f=i.tetherOffset,m=void 0===f?0:f,g=nt(t,{boundary:l,rootBoundary:c,padding:d,altBoundary:h}),v=xe(t.placement),y=De(t.placement),b=!y,w=Ze(v),x="x"===w?"y":"x",I=t.modifiersData.popperOffsets,C=t.rects.reference,L=t.rects.popper,O="function"==typeof m?m(Object.assign({},t.rects,{placement:t.placement})):m,Y="number"==typeof O?{mainAxis:O,altAxis:O}:Object.assign({mainAxis:0,altAxis:0},O),k=t.modifiersData.offset?t.modifiersData.offset[t.placement]:null,S={x:0,y:0};if(I){if(s){var R,X="y"===w?ie:se,E="y"===w?ne:oe,T="y"===w?"height":"width",A=I[w],H=A+g[X],W=A-g[E],Z=u?-L[T]/2:0,M=y===le?C[T]:L[T],B=y===le?-L[T]:-C[T],P=t.elements.arrow,D=u&&P?Se(P):{width:0,height:0},V=t.modifiersData["arrow#persistent"]?t.modifiersData["arrow#persistent"].padding:{top:0,right:0,bottom:0,left:0},j=V[X],F=V[E],G=Me(0,C[T],D[T]),z=b?C[T]/2-Z-G-j-Y.mainAxis:M-G-j-Y.mainAxis,N=b?-C[T]/2+Z+G+F+Y.mainAxis:B+G+F+Y.mainAxis,U=t.elements.arrow&&We(t.elements.arrow),$=U?"y"===w?U.clientTop||0:U.clientLeft||0:0,K=null!=(R=null==k?void 0:k[w])?R:0,q=A+N-K,Q=Me(u?Ce(H,A+z-K-$):H,A,u?Ie(W,q):W);I[w]=Q,S[w]=Q-A}if(r){var J,_="x"===w?ie:se,ee="x"===w?ne:oe,te=I[x],ae="y"===x?"height":"width",re=te+g[_],ce=te-g[ee],he=-1!==[ie,se].indexOf(v),de=null!=(J=null==k?void 0:k[x])?J:0,pe=he?re:te-C[ae]-L[ae]-de+Y.altAxis,ue=he?te+C[ae]+L[ae]-de-Y.altAxis:ce,fe=u&&he?(ge=Me(pe,te,me=ue))>me?me:ge:Me(u?pe:re,te,u?ue:ce);I[x]=fe,S[x]=fe-te}var me,ge;t.modifiersData[n]=S}},requiresIfExists:["offset"]},{name:"arrow",enabled:!0,phase:"main",fn:function(e){var t,i=e.state,n=e.name,o=e.options,s=i.elements.arrow,a=i.modifiersData.popperOffsets,r=xe(i.placement),l=Ze(r),c=[se,oe].indexOf(r)>=0?"height":"width";if(s&&a){var h=function(e,t){return Be("number"!=typeof(e="function"==typeof e?e(Object.assign({},t.rects,{placement:t.placement})):e)?e:Pe(e,re))}(o.padding,i),d=Se(s),p="y"===l?ie:se,u="y"===l?ne:oe,f=i.rects.reference[c]+i.rects.reference[l]-a[l]-i.rects.popper[c],m=a[l]-i.rects.reference[l],g=We(s),v=g?"y"===l?g.clientHeight||0:g.clientWidth||0:0,y=f/2-m/2,b=h[p],w=v-d[c]-h[u],x=v/2-d[c]/2+y,I=Me(b,x,w),C=l;i.modifiersData[n]=((t={})[C]=I,t.centerOffset=I-x,t)}},effect:function(e){var t=e.state,i=e.options.element,n=void 0===i?"[data-popper-arrow]":i;null!=n&&("string"!=typeof n||(n=t.elements.popper.querySelector(n)))&&Re(t.elements.popper,n)&&(t.elements.arrow=n)},requires:["popperOffsets"],requiresIfExists:["preventOverflow"]},{name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:function(e){var t=e.state,i=e.name,n=t.rects.reference,o=t.rects.popper,s=t.modifiersData.preventOverflow,a=nt(t,{elementContext:"reference"}),r=nt(t,{altBoundary:!0}),l=ot(a,n),c=ot(r,o,s),h=st(l),d=st(c);t.modifiersData[i]={referenceClippingOffsets:l,popperEscapeOffsets:c,isReferenceHidden:h,hasPopperEscaped:d},t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-reference-hidden":h,"data-popper-escaped":d})}}]});class pt{constructor(e,i,n){t(this,"updateHotspotPosition",((e,t)=>{this.currentActiveIndex=e,this.currentOrientation=t;const i=ee(this.hotspotsConfig,e,t);this.hideHotspots(),i.forEach((t=>this.updateAndShowHotspot(t,e)))})),this.container=i,this.popper=null,this.popperInstance=null,this.hotspotsContainer=(e=>{const t=document.createElement("div");return t.className="cloudimage-360-hotspot-container",e.appendChild(t),t})(this.container),this.hotspotsConfig=(e=>{const t=[...e];return t.forEach(((e,i)=>{const n={...te(e.positions)};t[i].initialPositions=n,t[i].positions=n})),t})(e),this.shouldHidePopper=!0,this.hidePopper=this.hidePopper.bind(this),this.imageAspectRatio=n;const{containerSize:o}=e[0];this.initialContainerSize=o||[i.offsetWidth,i.offsetHeight],this.initHotspots(),this.observeContainerResize()}observeContainerResize(){this.resizeObserver=new ResizeObserver((()=>{const e=this.container.offsetWidth,t=this.container.offsetHeight;this.updateHotspotsForResize(e,t)})),this.resizeObserver.observe(this.container)}updateHotspotsForResize(e,t){this.hotspotsConfig=(({newWidth:e,newHeight:t,initialContainerSize:i,imageAspectRatio:n,hotspotsConfig:o})=>{const[s,a]=i;let r=e,l=t,c=0,h=0;n>e/t?(l=e/n,h=(t-l)/2):(r=t*n,c=(e-r)/2);const d=r/s,p=l/a;return o.map((e=>{const t={};return Object.entries(e.initialPositions).forEach((([e,i])=>{t[e]={x:i.x*d+c,y:i.y*p+h}})),{...e,positions:t}}))})({newWidth:e,newHeight:t,initialContainerSize:this.initialContainerSize,imageAspectRatio:this.imageAspectRatio,hotspotsConfig:this.hotspotsConfig}),this.updateHotspotPosition(this.currentActiveIndex,this.currentOrientation)}showPopper({hotspotElement:e,content:t,id:i,keepOpen:n}){this.popperInstance&&this.popperInstance.instanceId!==i&&this.hidePopper();const o={placement:"top",modifiers:(s=this.container,[{name:"offset",options:{offset:[0,10]}},{name:"preventOverflow",options:{boundary:s}}])};var s;this.popper=((e,t)=>{const i=document.createElement("div");return i.className="cloudimage-360-popper",i.id=`cloudimage-360-popper-${t}`,i.dataset.popperId=t,"string"==typeof e&&/<\/?[a-z][\s\S]*>/i.test(e)?i.innerHTML=e:i.textContent=e,document.body.appendChild(i),i})(t,i),this.popper.setAttribute("data-show",""),this.popper.addEventListener("mouseenter",(()=>{this.shouldHidePopper=!1})),this.popper.addEventListener("mouseleave",(()=>{this.shouldHidePopper=!0,this.checkAndHidePopper()})),e.addEventListener("mouseleave",(()=>{this.shouldHidePopper=!0,this.checkAndHidePopper()})),e.addEventListener("mouseenter",(()=>{this.shouldHidePopper=!1,this.hidePopperTimeout&&clearTimeout(this.hidePopperTimeout)})),this.popperInstance={...dt(e,this.popper,o),keepOpen:n,instanceId:i}}checkAndHidePopper(){var e;this.shouldHidePopper&&!(null==(e=this.popperInstance)?void 0:e.keepOpen)&&(this.hidePopperTimeout=setTimeout((()=>{this.shouldHidePopper&&this.hidePopper()}),150))}hidePopper(){this.popperInstance&&(this.popperInstance.destroy(),this.popperInstance=null),this.popper&&(this.popper.removeAttribute("data-show"),setTimeout((()=>{this.popper&&this.popper.remove(),this.popper=null}),200))}createHotspot(e){const{id:t,content:i,keepOpen:n,onClick:o}=e,s=(e=>{const t=document.createElement("span");return t.id=e,t.className="cloudimage-360-hotspot",t.dataset.hotspotId=e,t})(t);o&&(s.style.cursor="pointer"),s.onclick=e=>{e.stopPropagation(),null==o||o(e,this.popperInstance,t)},i&&s.addEventListener("mouseenter",(()=>this.showPopper({hotspotElement:s,content:i,id:t,keepOpen:n}))),this.hotspotsContainer.appendChild(s)}hideHotspots(){this.hotspotsContainer.querySelectorAll(".cloudimage-360-hotspot").forEach((e=>{e.style.opacity=0,e.style.pointerEvents="none"}))}updateAndShowHotspot(e,t){const{positions:i,id:n}=e,{x:o,y:s}=i[t]??{},a=this.hotspotsContainer.querySelector(`[data-hotspot-id="${n}"]`);a&&(a.style.translate=`${o}px ${s}px`,a.style.opacity=1,a.style.pointerEvents="all")}createAllHotspots(){this.hotspotsConfig.forEach((e=>this.createHotspot(e)))}initHotspots(){this.createAllHotspots()}destroy(){this.resizeObserver.disconnect(),this.hidePopper(),this.hotspotsContainer.innerHTML=""}}class ut{constructor(e,t,i){this.container=e,this.isClicked=!1,this.fullscreenView=!!i,this.imagesX=[],this.imagesY=[],this.devicePixelRatio=Math.round(window.devicePixelRatio||1),this.id=e.id,this.movementStart={x:0,y:0},this.draggingDirection=null,this.isReady=!1,this.currentZoomScale=1,this.touchDevice="ontouchstart"in window||navigator.maxTouchPoints>0||navigator.msMaxTouchPoints>0,this.canvasWorker=new _,this.onMoveHandler=this.onMoveHandler.bind(this),this.destroy=this.destroy.bind(this),this.init(this.container,t)}mouseDown(e){if(!this.isReady||this.glass)return;const{pageX:t,pageY:i}=e;(this.autoplay||this.loopTimeoutId)&&(this.stopAutoplay(),this.autoplay=!1),this.movementStart={x:t,y:i},this.isClicked=!0,this.isDragging=!1}mouseUp(){this.isReady&&(this.isZoomed||this.showAllIcons(),this.movementStart={x:0,y:0},this.isClicked=!1,this.innerBox.style.cursor="grab")}drag(e,t){if(!this.isReady||!this.isClicked)return;const i=e-this.movementStart.x,n=t-this.movementStart.y;this.draggingDirection=(({deltaX:e,deltaY:t,reversed:i,allowSpinX:n,allowSpinY:o,threshold:s=0})=>{const a=n&&!o||o&&!n?0:s,r=Math.abs(e),l=Math.abs(t);return n&&r-a>l?i?e>0?"left":"right":e>0?"right":"left":o&&l-a>r?i?t>0?"up":"down":t>0?"down":"up":null})({deltaX:i,deltaY:n,reversed:this.dragReverse,allowSpinX:this.allowSpinX,allowSpinY:this.allowSpinY})||this.draggingDirection;const o=this.fullscreenView?document.body:this.container,s=this.dragSpeed/50,a=s*(this.amountX/o.offsetWidth),r=s*(this.amountY/o.offsetHeight),l=this.allowSpinX?Math.abs(Math.round(i*a)):0,c=this.allowSpinY?Math.abs(Math.round(n*r)):0;(this.allowSpinX&&0!==l||this.allowSpinY&&0!==c)&&(this.hideHotspotPopper(),this.onMoveHandler(this.draggingDirection,l,c),this.movementStart={x:e,y:t},setTimeout((()=>{this.isDragging=!0}),150))}mouseMove(e){this.isReady&&(this.isClicked||this.isZoomed)&&!this.glass&&(this.hideAllIcons(),this.drag(e.pageX,e.pageY),this.isZoomed&&this.applyZoom(e))}mouseClick(e){this.isReady&&!this.isDragging&&(this.glass&&this.magnified?this.removeGlass():!this.pointerZoom||this.glass||this.touchDevice||this.toggleZoom(e))}loadHigherQualityImages(e,t){const i=W(this.srcXConfig,e),n=this.allowSpinY?W(this.srcYConfig,e):null;B({cdnPathX:i,cdnPathY:n,configX:this.srcXConfig,configY:this.srcYConfig,onAllImagesLoad:(e,i)=>{this.imagesX=e,this.imagesY=i,t()}})}hideHotspots(){this.hotspotsInstance&&this.hotspotsInstance.hideHotspots()}hideHotspotPopper(){this.hotspotsInstance&&this.hotspotsInstance.hidePopper()}toggleZoom(e){if(this.isZoomed)this.showTransitionOverlay(),setTimeout((()=>{this.removeZoom()}),800);else{let t=(this.fullscreenView||this.pointerZoom?document.body:this.container).offsetWidth;this.hideHotspots(),this.showLoadingSpinner(),this.loadHigherQualityImages(t,(()=>{this.showTransitionOverlay(),setTimeout((()=>{this.applyZoom(e)}),800)}))}}removeZoom(){this.isZoomed=!1,this.updateView(),this.showAllIcons(),this.hideTransitionOverlay()}applyZoom(e){const{offsetX:t,offsetY:i}=((e,t,i)=>{const{clientX:n,clientY:o}=e,s=t.getBoundingClientRect(),a=t.width/(s.width*i),r=t.height/(s.height*i);return{offsetX:(n-s.left)*a,offsetY:(o-s.top)*r}})(e,this.canvas,this.devicePixelRatio);this.isZoomed=!0,this.hideAllIcons(),this.hideLoadingSpinner(),this.hideTransitionOverlay(),this.updateView(this.pointerZoom,t,i)}touchOutside(e){if(!this.glass)return;!this.canvas.contains(e.target)&&this.removeGlass()}touchStart(e){if(!this.isReady||e.touches.length>1||this.glass)return;const{pageX:t,pageY:i}=e.touches[0];(this.autoplay||this.loopTimeoutId)&&(this.stopAutoplay(),this.autoplay=!1),this.hideAllIcons(),this.movementStart={x:t,y:i},this.isClicked=!0}touchEnd(){this.isReady&&(this.showAllIcons(),this.movementStart={x:0,y:0},this.isClicked=!1)}touchMove(e){if(!this.isReady||!this.isClicked||this.glass)return;const{pageX:t,pageY:i}=e.touches[0];e.preventDefault(),this.drag(t,i)}keyDown(e){if(!this.isReady)return;const{keyCode:t}=e,i=this.keysReverse;switch(this.autoplay&&this.stopAutoplay(),$(t,this.allowSpinY)&&this.hideAllIcons(),t){case 37:i?this.moveLeft():this.moveRight();break;case 39:i?this.moveRight():this.moveLeft();break;case 38:this.allowSpinY&&(e.preventDefault(),i?this.moveTop():this.moveBottom());break;case 40:this.allowSpinY&&(e.preventDefault(),i?this.moveBottom():this.moveTop())}}keyUp(e){const{keyCode:t}=e;$(t,this.allowSpinY)&&this.showAllIcons()}moveActiveXIndexUp(e){this.orientation=Y,this.activeImageX=(this.activeImageX+e)%this.amountX}moveActiveXIndexDown(e){this.orientation=Y,this.activeImageX=(this.activeImageX-e+this.amountX)%this.amountX}moveActiveYIndexUp(e){this.orientation=k,this.activeImageY=(this.activeImageY+e)%this.amountY}moveActiveYIndexDown(e){this.orientation=k,this.activeImageY=(this.activeImageY-e+this.amountY)%this.amountY}moveRight(e,t=1){e&&this.activeImageX>=this.imagesX.length-1||(this.moveActiveXIndexUp(t),this.isZoomed||this.updateView())}moveLeft(e,t=1){e&&this.activeImageX<=0||(this.moveActiveXIndexDown(t),this.isZoomed||this.updateView())}moveTop(e,t=1){e&&this.activeImageY>=this.imagesY.length-1||(this.moveActiveYIndexUp(t),this.isZoomed||this.updateView())}moveBottom(e,t=1){e&&this.activeImageY<=0||(this.moveActiveYIndexDown(t),this.isZoomed||this.updateView())}onMoveHandler(e,t=1,i=1){"right"===e?this.moveRight(this.stopAtEdges,t):"left"===e?this.moveLeft(this.stopAtEdges,t):"up"===e?this.moveTop(this.stopAtEdges,i):"down"===e&&this.moveBottom(this.stopAtEdges,i)}updateView(e,t,i){const n=this.orientation===Y?this.activeImageX:this.activeImageY,o=this.orientation===Y?this.imagesX[this.activeImageX]:this.imagesY[this.activeImageY];!this.hotspotsInstance||this.isZoomed||this.autoplay||this.hotspotsInstance.updateHotspotPosition(n,this.orientation),this.drawImageOnCanvas(o,e,t,i)}updatePercentageInLoader(e=0){this.loader&&(this.loader.innerText=e+"%")}adaptCanvasSize(e){const{naturalWidth:t,naturalHeight:i}=e;this.imageAspectRatio=t/i;const n=this.fullscreenView?window.innerWidth:this.canvas.clientWidth,o=this.fullscreenView?window.innerHeight:this.canvas.clientHeight;this.canvasWorker.postMessage({action:"adaptCanvasSize",devicePixelRatio:this.devicePixelRatio,imageAspectRatio:this.imageAspectRatio,containerWidth:n,containerHeight:o})}drawImageOnCanvas(e,t=1,i=0,n=0){this.canvasWorker.postMessage({action:"drawImageOnCanvas",imageData:e,zoomScale:t,pointerX:i,pointerY:n})}pushImageToSet(e,t,i){i===Y?this.imagesX[t]=e:this.imagesY[t]=e}calculatePercentage(){const e=this.amountX+this.amountY,t=this.imagesX.length+this.imagesY.length;return Math.round(t/e*100)}onImageLoad(e,t,i){this.pushImageToSet(e,t,i),this.updatePercentageInLoader(this.calculatePercentage())}onFirstImageLoaded(e,t){this.createContainers(e),this.adaptCanvasSize(t),this.drawImageOnCanvas(t)}onAllImagesLoaded(){if(this.addAllIcons(),this.hotspots&&(this.hotspotsInstance=new pt(this.hotspots,this.innerBox,this.imageAspectRatio)),this.isReady=!0,this.amountX=this.imagesX.length,this.amountY=this.imagesY.length,this.activeImageX=this.autoplayReverse?this.amountX-1:0,this.activeImageY=this.autoplayReverse?this.amountY-1:0,this.autoplay){this.hideAllIcons();K(this.play.bind(this))()}}magnify(e){e.stopPropagation();const{src:t}=this.orientation===k?this.imagesY[this.activeImageY]:this.imagesX[this.activeImageX],i=(this.fullscreenView?document.body:this.container).offsetWidth*this.magnifier,n=Z(t,i);this.showLoadingSpinner(),this.createGlass();((e,t)=>{const i=new Image;i.src=e,i.onload=n=>{t&&t({event:n,width:i.width,height:i.height,naturalWidth:i.naturalWidth,naturalHeight:i.naturalHeight,src:e})},i.onerror=function(){}})(n,(t=>{this.hideLoadingSpinner(),this.magnified=!0,((e,t,i,n,o,s)=>{const{x:a=0,y:r=0}=i||{},l=(t.offsetWidth-2*a)*s,c=(t.offsetHeight-2*r)*s;if(!o)return;o.setAttribute("class","cloudimage-360-img-magnifier-glass"),t.prepend(o),o.style.backgroundImage=`url('${n.src}')`,o.style.backgroundSize=`${l}px ${c}px`;const h={container:t,w:o.offsetWidth/2,h:o.offsetHeight/2,zoom:s,bw:3,offsetX:a,offsetY:r};z(e,h,o);const d=e=>{z(e,h,o)};o.addEventListener("mousemove",d),t.addEventListener("mousemove",d),t.addEventListener("touchmove",(e=>{e.preventDefault(),z(e,h,o)}))})(e,this.innerBox,this.offset,t,this.glass,this.magnifier)}))}openFullscreenModal(e){e.stopPropagation();const t=(e=>{const t=document.createElement("div");t.className="cloudimage-360-fullscreen-modal";const i=e.cloneNode();return i.style.height="100vh",i.style.maxHeight="100%",t.appendChild(i),window.document.body.appendChild(t),i})(this.container);new ut(t,this.viewerConfig,!0)}closeFullscreenModal(e){e.stopPropagation(),document.body.removeChild(this.container.parentNode),window.document.body.style.overflow="visible"}play(){if(this.isClicked)return;this.hide360ViewCircleIcon();const e=36*this.speed/(this.amountX+this.amountY),t={left:this.moveLeft.bind(this),right:this.moveRight.bind(this),top:this.moveTop.bind(this),bottom:this.moveBottom.bind(this)};this.loopTimeoutId=window.setInterval((()=>{if(this.playOnce&&(({autoplayBehavior:e,activeImageX:t,activeImageY:i,amountX:n,amountY:o,autoplayReverse:s})=>{const a=(e,t)=>s?0===e:e===t-1;switch(e){case C:case I:return a(i,o);default:return a(t,n)}})({autoplayBehavior:this.autoplayBehavior,activeImageX:this.activeImageX,activeImageY:this.activeImageY,amountX:this.amountX,amountY:this.amountY,autoplayReverse:this.autoplayReverse}))return void this.stopAutoplay();(({autoplayBehavior:e,activeImageX:t,activeImageY:i,amountX:n,amountY:o,autoplayReverse:s,spinDirection:a})=>(e===C||e===L)&&("x"===a&&t===(s?0:n-1)||"y"===a&&i===(s?0:o-1)))({autoplayBehavior:this.autoplayBehavior,activeImageX:this.activeImageX,activeImageY:this.activeImageY,amountX:this.amountX,amountY:this.amountY,autoplayReverse:this.autoplayReverse,spinDirection:this.spinDirection})&&(this.spinDirection="x"===this.spinDirection?"y":"x");const e="y"===this.spinDirection;(({autoplayBehavior:e,spinY:t,reversed:i,loopTriggers:n})=>{switch(e){case C:case L:t?N(i,n):U(i,n);break;case I:N(i,n);break;default:U(i,n)}})({autoplayBehavior:this.autoplayBehavior,spinY:e,reversed:this.autoplayReverse,loopTriggers:t})}),e)}stopAutoplay(){this.showAllIcons(),this.autoplay=!1,window.clearTimeout(this.loopTimeoutId)}destroy(){this.stopAutoplay(),this.hotspotsInstance&&this.hotspotsInstance.destroy();const e=this.container,t=e.cloneNode(!0),i=t.querySelector(".cloudimage-360-inner-box");t.removeChild(i),e.parentNode.replaceChild(t,e)}addInitialIcon(){this.initialIcon||(this.initialIcon=(()=>{const e=document.createElement("div");return e.className="cloudimage-initial-icon",e.innerText="360°",e})(),this.innerBox.appendChild(this.initialIcon))}showInitialIcon(){this.initialIcon&&(this.initialIcon.style.opacity=1)}hideInitialIcon(){this.initialIcon&&(this.initialIcon.style.opacity=0)}createGlass(){this.hideAllIcons(),this.glass=document.createElement("div"),this.innerBox.appendChild(this.glass),this.innerBox.style.cursor="default"}removeGlass(){this.showAllIcons(),this.innerBox.removeChild(this.glass),this.glass=null,this.magnified=!1}addMagnifierIcon(){this.magnifier&&(this.magnifierIcon=(()=>{const e=document.createElement("div");return e.className="cloudimage-360-button cloudimage-360-magnifier-button",e.innerHTML="<img alt=\"magnifier icon\" src=data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20height='20px'%20viewBox='0%20-960%20960%20960'%20width='20px'%20fill='%235f6368'%3e%3cpath%20d='M765-144%20526-383q-30%2022-65.79%2034.5-35.79%2012.5-76.18%2012.5Q284-336%20214-406t-70-170q0-100%2070-170t170-70q100%200%20170%2070t70%20170.03q0%2040.39-12.5%2076.18Q599-464%20577-434l239%20239-51%2051ZM384-408q70%200%20119-49t49-119q0-70-49-119t-119-49q-70%200-119%2049t-49%20119q0%2070%2049%20119t119%2049Z'/%3e%3c/svg%3e>",e})(),this.magnifierIcon.onclick=this.magnify.bind(this),this.iconsContainer.appendChild(this.magnifierIcon))}showMagnifierIcon(){this.magnifierIcon&&(this.magnifierIcon.style.visibility="visible",this.magnifierIcon.style.opacity=1)}hideMagnifierIcon(){this.magnifierIcon&&(this.magnifierIcon.style.visibility="hidden",this.magnifierIcon.style.opacity=0)}addFullscreenIcon(){this.fullscreen&&(this.fullscreenIcon=(()=>{const e=document.createElement("div");return e.className="cloudimage-360-button cloudimage-360-fullscreen-button",e.innerHTML="<img alt=\"fullscreen icon\" src=data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20height='20px'%20viewBox='0%20-960%20960%20960'%20width='20px'%20fill='%235f6368'%3e%3cpath%20d='M144-144v-192h72v120h120v72H144Zm480%200v-72h120v-120h72v192H624ZM144-624v-192h192v72H216v120h-72Zm600%200v-120H624v-72h192v192h-72Z'/%3e%3c/svg%3e>",e})(),this.fullscreenIcon.onclick=this.openFullscreenModal.bind(this),this.iconsContainer.appendChild(this.fullscreenIcon))}addCloseFullscreenIcon(){this.fullscreenCloseIcon=(()=>{const e=document.createElement("div");return e.className="cloudimage-360-button cloudimage-360-close-icon",e.innerHTML="<img alt=\"close icon\" src=data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20height='20px'%20viewBox='0%20-960%20960%20960'%20width='20px'%20fill='%235f6368'%3e%3cpath%20d='m147-96-51-51%20261-261H192v-72h288v288h-72v-165L147-96Zm333-384v-288h72v165l261-261%2051%2051-261%20261h165v72H480Z'/%3e%3c/svg%3e>",e})(),this.fullscreenCloseIcon.onclick=this.closeFullscreenModal.bind(this),this.iconsContainer.appendChild(this.fullscreenCloseIcon)}showFullscreenIcon(){this.fullscreenIcon&&(this.fullscreenIcon.style.opacity=1)}hideFullscreenIcon(){this.fullscreenIcon&&(this.fullscreenIcon.style.opacity=0)}add360ViewCircleIcon(){this.view360CircleIcon||(this.view360CircleIcon=(e=>{const t=new Image;return t.src="https://scaleflex.cloudimg.io/v7/plugins/js-cloudimage-360-view/assets/img/360.svg",t.style.bottom=`${e}%`,t.className="cloudimage-360-view-360-circle",t})(this.bottomCircleOffset),this.innerBox.appendChild(this.view360CircleIcon))}show360ViewCircleIcon(){this.view360CircleIcon&&(this.view360CircleIcon.style.opacity=1)}hide360ViewCircleIcon(){this.view360CircleIcon&&(this.view360CircleIcon.style.opacity=0)}addLoadingSpinner(){this.loadingSpinner=(()=>{const e=document.createElement("div");return e.className="cloudimage-loading-spinner",e})(),this.innerBox.appendChild(this.loadingSpinner)}showLoadingSpinner(){this.loadingSpinner&&(this.hideAllIcons(),this.loadingSpinner.style.opacity=1)}createTransitionOverlay(){this.transitionOverlay=(()=>{const e=document.createElement("div");return e.className="cloudimage-360-transition-overlay",e})(),this.innerBox.appendChild(this.transitionOverlay)}showTransitionOverlay(){this.transitionOverlay&&(this.hideAllIcons(),this.transitionOverlay.style.opacity=1)}hideTransitionOverlay(){this.transitionOverlay&&(this.transitionOverlay.style.opacity=0)}hideLoadingSpinner(){this.loadingSpinner&&(this.loadingSpinner.style.opacity=0)}remove360ViewCircleIcon(){this.view360CircleIcon&&(this.innerBox.removeChild(this.view360CircleIcon),this.view360CircleIcon=null)}addAllIcons(){this.removeLoader(),this.innerBox.style.cursor="grab",this.pointerZoom&&(this.createTransitionOverlay(),this.addLoadingSpinner()),this.fullscreenView||this.touchDevice||this.addMagnifierIcon(),this.fullscreenView||this.addFullscreenIcon(),this.initialIconShown&&this.addInitialIcon(),this.bottomCircle||this.add360ViewCircleIcon()}showAllIcons(){this.showInitialIcon(),this.show360ViewCircleIcon(),this.showMagnifierIcon(),this.showFullscreenIcon()}hideAllIcons(){this.hideInitialIcon(),this.hide360ViewCircleIcon(),this.hideMagnifierIcon(),this.hideFullscreenIcon()}removeLoader(){this.loader&&(this.innerBox.removeChild(this.loader),this.loader=null)}attachEvents(e,t,i){e&&this.addMouseEvents(),t&&this.addTouchEvents(),i&&this.addKeyboardEvents()}removeEvents(){this.removeMouseEvents(),this.removeTouchEvents(),this.removeKeyboardEvents()}addMouseEvents(){this.boundMouseClick=this.mouseClick.bind(this),this.boundMouseDown=this.mouseDown.bind(this),this.boundMouseMove=w(this.mouseMove.bind(this),10),this.boundMouseUp=this.mouseUp.bind(this),this.innerBox.addEventListener("click",this.boundMouseClick),this.innerBox.addEventListener("mousedown",this.boundMouseDown),document.addEventListener("mousemove",this.boundMouseMove),document.addEventListener("mouseup",this.boundMouseUp)}addTouchEvents(){this.boundTouchOutside=this.touchOutside.bind(this),this.boundTouchStart=this.touchStart.bind(this),this.boundTouchEnd=this.touchEnd.bind(this),this.boundTouchMove=w(this.touchMove.bind(this),10),document.addEventListener("touchstart",this.boundTouchOutside),this.container.addEventListener("touchstart",this.boundTouchStart),this.container.addEventListener("touchend",this.boundTouchEnd),this.container.addEventListener("touchmove",this.boundTouchMove)}addKeyboardEvents(){this.boundKeyDown=this.keyDown.bind(this),this.boundKeyUp=this.keyUp.bind(this),document.addEventListener("keydown",this.boundKeyDown),document.addEventListener("keyup",this.boundKeyUp)}removeMouseEvents(){this.innerBox.removeEventListener("click",this.boundMouseClick),this.innerBox.removeEventListener("mousedown",this.boundMouseDown),document.removeEventListener("mousemove",this.boundMouseMove),document.removeEventListener("mouseup",this.boundMouseUp)}removeTouchEvents(){document.removeEventListener("touchstart",this.boundTouchOutside),this.container.removeEventListener("touchstart",this.boundTouchStart),this.container.removeEventListener("touchend",this.boundTouchEnd),this.container.removeEventListener("touchmove",this.boundTouchMove)}removeKeyboardEvents(){document.removeEventListener("keydown",this.boundKeyDown),document.removeEventListener("keyup",this.boundKeyUp)}createContainers(e){this.iconsContainer=P(this.innerBox),this.canvas=((e,t)=>{const{width:i,height:n}=t,o=document.createElement("canvas");return o.width=i,o.height=n,o.style.width="100%",o.style.height="auto",e.appendChild(o),o})(this.innerBox,e),this.loader=(e=>{const t=document.createElement("div");t.className="cloudimage-initial-icon";const i=document.createElement("span");return i.className="percentage",i.innerText="0%",t.appendChild(i),e.appendChild(t),t})(this.innerBox);const t=this.canvas.transferControlToOffscreen();this.canvasWorker.postMessage({action:"initCanvas",offscreen:t,devicePixelRatio:this.devicePixelRatio},[t]),this.fullscreenView&&this.addCloseFullscreenIcon(),D(this.innerBox,".cloudimage-360-placeholder")}update(e){this.isReady&&(this.stopAutoplay(),D(this.innerBox,".cloudimage-360-icons-container"),this.init(this.container,e,!0),this.iconsContainer=P(this.innerBox),this.onAllImagesLoaded())}init(e,t,i){const n=t?(e=>({folder:e.folder||E.folder,apiVersion:e.apiVersion||E.apiVersion,filenameX:e.filenameX||e.filename||E.filenameX,filenameY:e.filenameY||E.filenameY,imageListX:e.imageListX||E.imageListX,imageListY:e.imageListY||E.imageListY,indexZeroBase:parseInt(e.indexZeroBase??E.indexZeroBase,10),amountX:parseInt(e.amountX??E.amountX,10),amountY:parseInt(e.amountY??E.amountY,10),speed:parseInt(e.speed??E.speed,10),draggable:e.draggable??E.draggable,swipeable:e.swipeable??E.swipeable,dragSpeed:parseInt(e.dragSpeed??E.dragSpeed,10),keys:e.keys??E.keys,keysReverse:e.keysReverse??E.keysReverse,autoplay:e.autoplay??E.autoplay,autoplayBehavior:e.autoplayBehavior||E.autoplayBehavior,playOnce:e.playOnce??E.playOnce,autoplayReverse:e.autoplayReverse??E.autoplayReverse,pointerZoom:parseFloat(e.pointerZoom??E.pointerZoom,10),fullscreen:e.fullscreen??E.fullscreen,magnifier:parseFloat(e.magnifier??E.magnifier,10),bottomCircleOffset:parseInt(e.bottomCircleOffset??E.bottomCircleOffset,10),ciToken:e.ciToken||E.ciToken,ciFilters:e.ciFilters||E.ciFilters,ciTransformation:e.ciTransformation||E.ciTransformation,lazyload:e.lazyload??E.lazyload,dragReverse:e.dragReverse??E.dragReverse,stopAtEdges:e.stopAtEdges??E.stopAtEdges,imageInfo:e.imageInfo??E.imageInfo,initialIconShown:e.initialIconShown??E.initialIconShown,bottomCircle:e.bottomCircle??E.bottomCircle,hotspots:e.hotspots??E.hotspots}))(t):{folder:T(o=e,"folder",E.folder),apiVersion:T(o,"api-version",E.apiVersion),filenameX:T(o,"filename")||T(o,"filename-x")||E.filenameX,filenameY:T(o,"filename-y",E.filenameY),imageListX:T(o,"image-list-x",E.imageListX),imageListY:T(o,"image-list-y",E.imageListY),indexZeroBase:parseInt(T(o,"index-zero-base",E.indexZeroBase),10),amountX:parseInt(T(o,"amount-x",E.amountX),10),amountY:parseInt(T(o,"amount-y",E.amountY),10),speed:parseInt(T(o,"speed",E.speed),10),dragSpeed:parseInt(T(o,"drag-speed",E.dragSpeed),10),draggable:A(o,"draggable",E.draggable),swipeable:A(o,"swipeable",E.swipeable),keys:A(o,"keys",E.keys),keysReverse:A(o,"keys-reverse",E.keysReverse),autoplay:A(o,"autoplay",E.autoplay),autoplayBehavior:T(o,"autoplay-behavior",E.autoplayBehavior),playOnce:A(o,"play-once",E.playOnce),autoplayReverse:A(o,"autoplay-reverse",E.autoplayReverse),pointerZoom:parseFloat(T(o,"pointer-zoom",E.pointerZoom),10),fullscreen:A(o,"fullscreen")||A(o,"full-screen",E.fullscreen),magnifier:parseFloat(T(o,"magnifier",E.magnifier),10),bottomCircleOffset:parseInt(T(o,"bottom-circle-offset",E.bottomCircleOffset),10),ciToken:T(o,"responsive",E.ciToken),ciFilters:T(o,"filters",E.ciFilters),ciTransformation:T(o,"transformation",E.ciTransformation),lazyload:A(o,"lazyload",E.lazyload),dragReverse:A(o,"drag-reverse",E.dragReverse),stopAtEdges:A(o,"stop-at-edges",E.stopAtEdges),imageInfo:A(o,"info",E.imageInfo),initialIconShown:!H(o,"initial-icon"),bottomCircle:!H(o,"bottom-circle")};var o;const{folder:s,apiVersion:a,filenameX:r,filenameY:l,imageListX:c,imageListY:h,indexZeroBase:d,amountX:p,amountY:u,draggable:f=!0,swipeable:m=!0,keys:g,keysReverse:v,bottomCircleOffset:y,autoplay:b,autoplayBehavior:w,playOnce:x,speed:O,autoplayReverse:Y,fullscreen:S,magnifier:R,ciToken:X,ciFilters:Z,ciTransformation:M,lazyload:P,dragSpeed:D,stopAtEdges:V,pointerZoom:j,imageInfo:F="black",initialIconShown:z,bottomCircle:N,hotspots:U,dragReverse:$}=n,K={ciToken:X,ciFilters:Z,ciTransformation:M},q=c?JSON.parse(c):[],Q=h?JSON.parse(h):[];if(this.viewerConfig=n,this.amountX=q.length||p,this.amountY=Q.length||u,this.allowSpinX=!!this.amountX,this.allowSpinY=!!this.amountY,this.activeImageX=Y?this.amountX-1:0,this.activeImageY=Y?this.amountY-1:0,this.bottomCircleOffset=y,this.autoplay=b,this.autoplayBehavior=w,this.playOnce=x,this.speed=O,this.autoplayReverse=Y,this.fullscreen=S,this.magnifier=R>1?Math.min(R,5):0,this.dragSpeed=Math.max(D,50),this.stopAtEdges=V,this.ciParams=K,this.apiVersion=a,this.pointerZoom=j>1?Math.min(j,5):null,this.keysReverse=v,this.info=F,this.keys=g,this.innerBox=this.innerBox??(e=>{const t=document.createElement("div");return t.className="cloudimage-360-inner-box",e.appendChild(t),t})(this.container),this.initialIconShown=z,this.bottomCircle=N,this.spinDirection=((e,t,i)=>{if(!i)return"x";if(!t)return"y";switch(e){case C:return"x";case L:case I:return"y";default:return"x"}})(this.autoplayBehavior,this.allowSpinX,this.allowSpinY),this.dragReverse=$,this.hotspots=U,this.srcXConfig={folder:s,filename:r,imageList:q,container:e,innerBox:this.innerBox,apiVersion:a,ciParams:K,lazyload:P,amount:this.amountX,indexZeroBase:d,autoplayReverse:Y},this.srcYConfig={...this.srcXConfig,filename:l,imageList:Q,orientation:k,amount:this.amountY},i&&this.removeEvents(),this.attachEvents(f,m,g),i)return;const J=(this.fullscreenView?document.body:this.container).offsetWidth,_=this.allowSpinX&&!q.length?W(this.srcXConfig,J):null,ee=this.allowSpinY&&!Q.length?W(this.srcYConfig,J):null,te=e=>{B({cdnPathX:_,cdnPathY:ee,configX:this.srcXConfig,configY:this.srcYConfig,onImageLoad:(e,t,i)=>this.onImageLoad(e,t,i),onFirstImageLoad:t=>this.onFirstImageLoaded(e,t),onAllImagesLoad:this.onAllImagesLoaded.bind(this)})};this.allowSpinX?G(_,this.srcXConfig,te):this.allowSpinY&&G(ee,this.srcYConfig,te)}}class ft{constructor(){this.views=new Map,this.initAll=this.initAll.bind(this),this.getViews=this.getViews.bind(this)}generateId(){return`ci360-${Math.random().toString(36).slice(2,11)}`}init(e,t,i){if(!e)return;const n=e.id||this.generateId();e.id||(e.id=n);const o=new ut(e,t,i);return this.views.set(n,o),o}initAll(e="cloudimage-360"){[...document.querySelectorAll(`.${e}`)].filter(Boolean).forEach((e=>{const t=e.id||this.generateId();e.id||(e.id=t);const i=new ut(e);this.views.set(t,i)}))}destroy(e){const t=this.getViewById(e);t&&(t.destroy(),this.views.delete(e))}destroyAll(){this.views.forEach((e=>{e.destroy()})),this.views.clear()}getViewById(e){return this.views.get(e)}getViews(){return Array.from(this.views.values())}updateView(e,t){const i=this.getViewById(e),n={...i.viewerConfig,...t};if(((e,t,i=S)=>i.some((i=>i in t&&t[i]!==e[i])))(i.viewerConfig,t)){i.destroy();const t=document.getElementById(e);this.init(t,n)}else i.update(n);return i}}return window.CI360=ft,ft}));
1
+ import './js-cloudimage-360-view.min.css';var De = Object.defineProperty;
2
+ var Ne = (e, t, i) => t in e ? De(e, t, { enumerable: !0, configurable: !0, writable: !0, value: i }) : e[t] = i;
3
+ var ee = (e, t, i) => Ne(e, typeof t != "symbol" ? t + "" : t, i);
4
+ var Et = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
5
+ function $e(e) {
6
+ return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
7
+ }
8
+ var Oe = "Expected a function", ie = NaN, Ve = "[object Symbol]", je = /^\s+|\s+$/g, Fe = /^[-+]0x[0-9a-f]+$/i, Ge = /^0b[01]+$/i, ze = /^0o[0-7]+$/i, Ue = parseInt, Ke = typeof Et == "object" && Et && Et.Object === Object && Et, qe = typeof self == "object" && self && self.Object === Object && self, Je = Ke || qe || Function("return this")(), Qe = Object.prototype, _e = Qe.toString, ti = Math.max, ei = Math.min, kt = function() {
9
+ return Je.Date.now();
10
+ };
11
+ function ii(e, t, i) {
12
+ var n, o, s, a, r, c, l = 0, h = !1, u = !1, f = !0;
13
+ if (typeof e != "function")
14
+ throw new TypeError(Oe);
15
+ t = ne(t) || 0, Rt(i) && (h = !!i.leading, u = "maxWait" in i, s = u ? ti(ne(i.maxWait) || 0, t) : s, f = "trailing" in i ? !!i.trailing : f);
16
+ function d(m) {
17
+ var I = n, E = o;
18
+ return n = o = void 0, l = m, a = e.apply(E, I), a;
19
+ }
20
+ function y(m) {
21
+ return l = m, r = setTimeout(x, t), h ? d(m) : a;
22
+ }
23
+ function g(m) {
24
+ var I = m - c, E = m - l, S = t - I;
25
+ return u ? ei(S, s - E) : S;
26
+ }
27
+ function v(m) {
28
+ var I = m - c, E = m - l;
29
+ return c === void 0 || I >= t || I < 0 || u && E >= s;
30
+ }
31
+ function x() {
32
+ var m = kt();
33
+ if (v(m))
34
+ return C(m);
35
+ r = setTimeout(x, g(m));
36
+ }
37
+ function C(m) {
38
+ return r = void 0, f && n ? d(m) : (n = o = void 0, a);
39
+ }
40
+ function O() {
41
+ r !== void 0 && clearTimeout(r), l = 0, n = c = o = r = void 0;
42
+ }
43
+ function b() {
44
+ return r === void 0 ? a : C(kt());
45
+ }
46
+ function w() {
47
+ var m = kt(), I = v(m);
48
+ if (n = arguments, o = this, c = m, I) {
49
+ if (r === void 0)
50
+ return y(c);
51
+ if (u)
52
+ return r = setTimeout(x, t), d(c);
53
+ }
54
+ return r === void 0 && (r = setTimeout(x, t)), a;
55
+ }
56
+ return w.cancel = O, w.flush = b, w;
57
+ }
58
+ function ni(e, t, i) {
59
+ var n = !0, o = !0;
60
+ if (typeof e != "function")
61
+ throw new TypeError(Oe);
62
+ return Rt(i) && (n = "leading" in i ? !!i.leading : n, o = "trailing" in i ? !!i.trailing : o), ii(e, t, {
63
+ leading: n,
64
+ maxWait: t,
65
+ trailing: o
66
+ });
67
+ }
68
+ function Rt(e) {
69
+ var t = typeof e;
70
+ return !!e && (t == "object" || t == "function");
71
+ }
72
+ function oi(e) {
73
+ return !!e && typeof e == "object";
74
+ }
75
+ function si(e) {
76
+ return typeof e == "symbol" || oi(e) && _e.call(e) == Ve;
77
+ }
78
+ function ne(e) {
79
+ if (typeof e == "number")
80
+ return e;
81
+ if (si(e))
82
+ return ie;
83
+ if (Rt(e)) {
84
+ var t = typeof e.valueOf == "function" ? e.valueOf() : e;
85
+ e = Rt(t) ? t + "" : t;
86
+ }
87
+ if (typeof e != "string")
88
+ return e === 0 ? e : +e;
89
+ e = e.replace(je, "");
90
+ var i = Ge.test(e);
91
+ return i || ze.test(e) ? Ue(e.slice(2), i ? 2 : 8) : Fe.test(e) ? ie : +e;
92
+ }
93
+ var ri = ni;
94
+ const oe = /* @__PURE__ */ $e(ri), T = {
95
+ SPIN_X: "spin-x",
96
+ SPIN_Y: "spin-y",
97
+ SPIN_XY: "spin-xy",
98
+ SPIN_YX: "spin-yx"
99
+ }, ai = [!1, 0, null, void 0, "false", "0", "null", "undefined"], A = {
100
+ X: "x-axis",
101
+ Y: "y-axis",
102
+ CENTER: "center"
103
+ }, ci = [
104
+ "folder",
105
+ "folderX",
106
+ "folderY",
107
+ "filenameX",
108
+ "filenameY",
109
+ "imageListX",
110
+ "imageListY",
111
+ "indexZeroBase",
112
+ "amountX",
113
+ "amountY"
114
+ ], li = [37, 39], hi = [38, 40], se = 10, p = {
115
+ folder: "/",
116
+ apiVersion: "v7",
117
+ filenameX: "image-{index}.jpg",
118
+ filenameY: null,
119
+ imageListX: null,
120
+ imageListY: null,
121
+ indexZeroBase: 0,
122
+ amountX: 0,
123
+ amountY: 0,
124
+ speed: 80,
125
+ dragSpeed: 150,
126
+ draggable: !0,
127
+ swipeable: !0,
128
+ keys: !1,
129
+ keysReverse: !1,
130
+ autoplay: !1,
131
+ autoplayBehavior: T.SPIN_X,
132
+ playOnce: !1,
133
+ autoplayReverse: !1,
134
+ pointerZoom: 0,
135
+ fullscreen: !1,
136
+ magnifier: null,
137
+ bottomCircle: !0,
138
+ bottomCircleOffset: 5,
139
+ ciToken: null,
140
+ ciFilters: null,
141
+ ciTransformation: null,
142
+ lazyload: !0,
143
+ dragReverse: !1,
144
+ stopAtEdges: !1,
145
+ imageInfo: !1,
146
+ initialIconShown: !0,
147
+ hotspots: null
148
+ }, di = (e) => ({
149
+ folder: R(e, "folder", p.folder),
150
+ apiVersion: R(e, "api-version", p.apiVersion),
151
+ filenameX: R(e, "filename") || R(e, "filename-x") || p.filenameX,
152
+ filenameY: R(e, "filename-y", p.filenameY),
153
+ imageListX: R(e, "image-list-x", p.imageListX),
154
+ imageListY: R(e, "image-list-y", p.imageListY),
155
+ indexZeroBase: parseInt(R(e, "index-zero-base", p.indexZeroBase), 10),
156
+ amountX: parseInt(R(e, "amount-x", p.amountX), 10),
157
+ amountY: parseInt(R(e, "amount-y", p.amountY), 10),
158
+ speed: parseInt(R(e, "speed", p.speed), 10),
159
+ dragSpeed: parseInt(R(e, "drag-speed", p.dragSpeed), 10),
160
+ draggable: B(e, "draggable", p.draggable),
161
+ swipeable: B(e, "swipeable", p.swipeable),
162
+ keys: B(e, "keys", p.keys),
163
+ keysReverse: B(e, "keys-reverse", p.keysReverse),
164
+ autoplay: B(e, "autoplay", p.autoplay),
165
+ autoplayBehavior: R(e, "autoplay-behavior", p.autoplayBehavior),
166
+ playOnce: B(e, "play-once", p.playOnce),
167
+ autoplayReverse: B(e, "autoplay-reverse", p.autoplayReverse),
168
+ pointerZoom: parseFloat(R(e, "pointer-zoom", p.pointerZoom), 10),
169
+ fullscreen: B(e, "fullscreen") || B(e, "full-screen", p.fullscreen),
170
+ magnifier: parseFloat(R(e, "magnifier", p.magnifier), 10),
171
+ bottomCircleOffset: parseInt(
172
+ R(e, "bottom-circle-offset", p.bottomCircleOffset),
173
+ 10
174
+ ),
175
+ ciToken: R(e, "responsive", p.ciToken),
176
+ ciFilters: R(e, "filters", p.ciFilters),
177
+ ciTransformation: R(e, "transformation", p.ciTransformation),
178
+ lazyload: B(e, "lazyload", p.lazyload),
179
+ dragReverse: B(e, "drag-reverse", p.dragReverse),
180
+ stopAtEdges: B(e, "stop-at-edges", p.stopAtEdges),
181
+ imageInfo: B(e, "info", p.imageInfo),
182
+ initialIconShown: !re(e, "initial-icon"),
183
+ bottomCircle: !re(e, "bottom-circle")
184
+ }), ui = (e) => ({
185
+ folder: e.folder || p.folder,
186
+ apiVersion: e.apiVersion || p.apiVersion,
187
+ filenameX: e.filenameX || e.filename || p.filenameX,
188
+ filenameY: e.filenameY || p.filenameY,
189
+ imageListX: e.imageListX || p.imageListX,
190
+ imageListY: e.imageListY || p.imageListY,
191
+ indexZeroBase: parseInt(e.indexZeroBase ?? p.indexZeroBase, 10),
192
+ amountX: parseInt(e.amountX ?? p.amountX, 10),
193
+ amountY: parseInt(e.amountY ?? p.amountY, 10),
194
+ speed: parseInt(e.speed ?? p.speed, 10),
195
+ draggable: e.draggable ?? p.draggable,
196
+ swipeable: e.swipeable ?? p.swipeable,
197
+ dragSpeed: parseInt(e.dragSpeed ?? p.dragSpeed, 10),
198
+ keys: e.keys ?? p.keys,
199
+ keysReverse: e.keysReverse ?? p.keysReverse,
200
+ autoplay: e.autoplay ?? p.autoplay,
201
+ autoplayBehavior: e.autoplayBehavior || p.autoplayBehavior,
202
+ playOnce: e.playOnce ?? p.playOnce,
203
+ autoplayReverse: e.autoplayReverse ?? p.autoplayReverse,
204
+ pointerZoom: parseFloat(e.pointerZoom ?? p.pointerZoom, 10),
205
+ fullscreen: e.fullscreen ?? p.fullscreen,
206
+ magnifier: parseFloat(e.magnifier ?? p.magnifier, 10),
207
+ bottomCircleOffset: parseInt(e.bottomCircleOffset ?? p.bottomCircleOffset, 10),
208
+ ciToken: e.ciToken || p.ciToken,
209
+ ciFilters: e.ciFilters || p.ciFilters,
210
+ ciTransformation: e.ciTransformation || p.ciTransformation,
211
+ lazyload: e.lazyload ?? p.lazyload,
212
+ dragReverse: e.dragReverse ?? p.dragReverse,
213
+ stopAtEdges: e.stopAtEdges ?? p.stopAtEdges,
214
+ imageInfo: e.imageInfo ?? p.imageInfo,
215
+ initialIconShown: e.initialIconShown ?? p.initialIconShown,
216
+ bottomCircle: e.bottomCircle ?? p.bottomCircle,
217
+ hotspots: e.hotspots ?? p.hotspots
218
+ }), R = (e, t, i) => e.getAttribute(t) || e.getAttribute(`data-${t}`) || i, B = (e, t, i) => e.hasAttribute(t) || e.hasAttribute(`data-${t}`) || i, re = (e, t) => R(e, t, null) === "false", pi = (e, t, i = ci) => i.some((n) => n in t && t[n] !== e[n]), fi = (e = 1) => {
219
+ const t = Math.round(window.devicePixelRatio || 1);
220
+ return parseInt(e) * t;
221
+ }, mi = (e, t, i) => new URL(e).origin.includes("cloudimg") ? e : `https://${t}.cloudimg.io/${i}${e}`, vi = ({ ciTransformation: e, responsiveWidth: t, ciFilters: i }) => {
222
+ const n = `width=${t}`, o = e || n, s = i ? `&f=${i}` : "";
223
+ return `${o}${s}`;
224
+ }, gt = (e, t) => {
225
+ const { folder: i, apiVersion: n, filename: o = "", ciParams: s } = e, { ciToken: a, ciFilters: r, ciTransformation: c } = s || {}, l = `${i}${o}`;
226
+ if (!a) return l;
227
+ const h = ai.includes(n) ? null : n, u = h ? `${h}/` : "", f = fi(t), d = mi(l, a, u), y = vi({
228
+ ciTransformation: c,
229
+ responsiveWidth: f,
230
+ ciFilters: r
231
+ });
232
+ return `${d}${y ? "?" : ""}${y}`;
233
+ }, gi = (e, t, i) => {
234
+ const [n, o] = e.split("?"), s = `${t}=${encodeURIComponent(i)}`;
235
+ if (!o)
236
+ return `${n}?${s}`;
237
+ const a = new URLSearchParams(o);
238
+ return a.set(t, i), `${n}?${a.toString()}`;
239
+ }, yi = (e, t) => gi(e, "width", t), Ee = (e, t = 0) => (e += "", e.length >= t ? e : new Array(t - e.length + 1).join("0") + e), bi = (e, { amount: t = 0, indexZeroBase: i = 0 } = {}) => Array.from({ length: t }, (n, o) => e.replace("{index}", Ee(o + 1, i))), wi = ({
240
+ imagesUrls: e,
241
+ onFirstImageLoad: t,
242
+ onImageLoad: i,
243
+ onAllImagesLoad: n,
244
+ autoplayReverse: o
245
+ }) => {
246
+ let s = 0;
247
+ const a = e.length, r = [], c = (u, f) => {
248
+ const d = new Image();
249
+ d.crossOrigin = "anonymous", d.src = u, d.onload = async () => {
250
+ const y = await createImageBitmap(d), g = {
251
+ src: u,
252
+ bitmapImage: y,
253
+ naturalWidth: l.naturalWidth,
254
+ naturalHeight: l.naturalHeight
255
+ };
256
+ s++, r[f] = g, i == null || i(g, f), s === a && (n == null || n(r));
257
+ }, d.onerror = () => {
258
+ console.error(`Failed to load image: ${u}`), s++, s === a && (n == null || n(r));
259
+ };
260
+ }, l = new Image(), h = e[o ? e.length - 1 : 0];
261
+ l.crossOrigin = "anonymous", l.src = h, l.onload = async () => {
262
+ const u = await createImageBitmap(l), f = {
263
+ src: h,
264
+ bitmapImage: u,
265
+ naturalWidth: l.naturalWidth,
266
+ naturalHeight: l.naturalHeight
267
+ };
268
+ r[0] = f, s++, t == null || t(f), i == null || i(f, 0);
269
+ for (let d = 1; d < e.length; d++)
270
+ c(e[d], d);
271
+ }, l.onerror = () => {
272
+ console.error(`Failed to load first image: ${e[0]}`), s++;
273
+ for (let u = 1; u < e.length; u++)
274
+ c(e[u], u);
275
+ };
276
+ }, ae = ({
277
+ cdnPathX: e,
278
+ cdnPathY: t,
279
+ configX: i,
280
+ configY: n,
281
+ onFirstImageLoad: o,
282
+ onImageLoad: s,
283
+ onAllImagesLoad: a
284
+ }) => {
285
+ let r = { x: !1, y: !1 }, c = [], l = [];
286
+ const h = e || i.imageList.length, u = t || n.imageList.length, f = () => {
287
+ r.x && r.y && a(c, l);
288
+ }, d = ({ cdnPath: y, config: g, orientation: v, loadedImages: x, onFirstImageLoad: C }) => {
289
+ const O = v === A.X, b = g.imageList.length ? g.imageList : bi(y, g);
290
+ wi({
291
+ imagesUrls: b,
292
+ onFirstImageLoad: C,
293
+ onImageLoad: (w, m) => {
294
+ s == null || s(w, m, v), x[m] = w;
295
+ },
296
+ onAllImagesLoad: (w) => {
297
+ x = w, r[O ? "x" : "y"] = !0, f();
298
+ },
299
+ autoplayReverse: g.autoplayReverse
300
+ });
301
+ };
302
+ h ? d({
303
+ cdnPath: e,
304
+ config: i,
305
+ orientation: A.X,
306
+ loadedImages: c,
307
+ onFirstImageLoad: o
308
+ }) : r.x = !0, u ? d({
309
+ cdnPath: t,
310
+ config: n,
311
+ orientation: A.Y,
312
+ loadedImages: l,
313
+ onFirstImageLoad: h ? void 0 : o
314
+ }) : r.y = !0;
315
+ }, xi = (e) => {
316
+ const t = new Image();
317
+ return t.src = "https://scaleflex.cloudimg.io/v7/plugins/js-cloudimage-360-view/assets/img/360.svg", t.style.bottom = `${e}%`, t.className = "cloudimage-360-view-360-circle", t;
318
+ }, Ii = () => {
319
+ const e = document.createElement("div");
320
+ return e.className = "cloudimage-initial-icon", e.innerText = "360°", e;
321
+ }, Ci = (e, t) => {
322
+ const { width: i, height: n } = t, o = document.createElement("canvas");
323
+ return o.width = i, o.height = n, o.style.width = "100%", o.style.height = "auto", e.appendChild(o), o;
324
+ }, Oi = "data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20height='20px'%20viewBox='0%20-960%20960%20960'%20width='20px'%20fill='%235f6368'%3e%3cpath%20d='m147-96-51-51%20261-261H192v-72h288v288h-72v-165L147-96Zm333-384v-288h72v165l261-261%2051%2051-261%20261h165v72H480Z'/%3e%3c/svg%3e", Ei = () => {
325
+ const e = document.createElement("div");
326
+ return e.className = "cloudimage-360-button cloudimage-360-close-icon", e.innerHTML = `<img alt="close icon" src=${Oi}>`, e;
327
+ }, Si = "data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20height='20px'%20viewBox='0%20-960%20960%20960'%20width='20px'%20fill='%235f6368'%3e%3cpath%20d='M144-144v-192h72v120h120v72H144Zm480%200v-72h120v-120h72v192H624ZM144-624v-192h192v72H216v120h-72Zm600%200v-120H624v-72h192v192h-72Z'/%3e%3c/svg%3e", Yi = () => {
328
+ const e = document.createElement("div");
329
+ return e.className = "cloudimage-360-button cloudimage-360-fullscreen-button", e.innerHTML = `<img alt="fullscreen icon" src=${Si}>`, e;
330
+ }, ce = (e) => {
331
+ const t = document.createElement("div");
332
+ return t.className = "cloudimage-360-icons-container", e.appendChild(t), t;
333
+ }, Ri = (e) => {
334
+ const t = document.createElement("div");
335
+ return t.className = "cloudimage-360-inner-box", e.appendChild(t), t;
336
+ }, Xi = "data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20height='20px'%20viewBox='0%20-960%20960%20960'%20width='20px'%20fill='%235f6368'%3e%3cpath%20d='M765-144%20526-383q-30%2022-65.79%2034.5-35.79%2012.5-76.18%2012.5Q284-336%20214-406t-70-170q0-100%2070-170t170-70q100%200%20170%2070t70%20170.03q0%2040.39-12.5%2076.18Q599-464%20577-434l239%20239-51%2051ZM384-408q70%200%20119-49t49-119q0-70-49-119t-119-49q-70%200-119%2049t-49%20119q0%2070%2049%20119t119%2049Z'/%3e%3c/svg%3e", Li = () => {
337
+ const e = document.createElement("div");
338
+ return e.className = "cloudimage-360-button cloudimage-360-magnifier-button", e.innerHTML = `<img alt="magnifier icon" src=${Xi}>`, e;
339
+ }, Pi = (e) => {
340
+ const t = document.createElement("div");
341
+ t.className = "cloudimage-initial-icon";
342
+ const i = document.createElement("span");
343
+ return i.className = "percentage", i.innerText = "0%", t.appendChild(i), e.appendChild(t), t;
344
+ }, Ti = (e) => {
345
+ const t = document.createElement("div");
346
+ t.className = "cloudimage-360-fullscreen-modal";
347
+ const i = e.cloneNode();
348
+ return i.style.height = "100vh", i.style.maxHeight = "100%", t.appendChild(i), window.document.body.appendChild(t), i;
349
+ }, Wt = (e, t) => {
350
+ const i = e.querySelector(t);
351
+ i && i.parentNode.removeChild(i);
352
+ }, Ai = () => {
353
+ const e = document.createElement("div");
354
+ return e.className = "cloudimage-loading-spinner", e;
355
+ }, ki = () => {
356
+ const e = document.createElement("div");
357
+ return e.className = "cloudimage-360-transition-overlay", e;
358
+ }, Mi = (e) => {
359
+ const t = document.createElement("div");
360
+ return t.className = "cloudimage-360-hotspot-container", e.appendChild(t), t;
361
+ }, Wi = (e, t) => {
362
+ const [i, n] = e.split("?");
363
+ if (!n) return e;
364
+ const o = new RegExp(`^${t}=|&${t}=`), s = n.split("&").filter((a) => !o.test(a)).join("&");
365
+ return s ? `${i}?${s}` : i;
366
+ }, Hi = (e) => {
367
+ const t = Wi(e, "width"), i = t.includes("?") ? "&" : "?";
368
+ return `${t}${i}width=${150 * devicePixelRatio}`;
369
+ }, Bi = (e) => {
370
+ const t = {
371
+ root: null,
372
+ rootMargin: "0px",
373
+ threshold: 0.1
374
+ }, i = (o) => {
375
+ const s = o.getAttribute("data-src");
376
+ s && (o.src = s);
377
+ };
378
+ new IntersectionObserver((o, s) => {
379
+ o.forEach((a) => {
380
+ a.isIntersecting && (i(a.target), s.unobserve(a.target));
381
+ });
382
+ }, t).observe(e);
383
+ }, Zi = (e, t) => {
384
+ const i = Ee(1, t);
385
+ return e.replace("{index}", i);
386
+ }, Di = (e, t) => {
387
+ const [i] = e, n = /(https?):\/\//i.test(i);
388
+ return gt({
389
+ ...t,
390
+ folder: n ? "" : t.folder,
391
+ filename: i
392
+ });
393
+ }, Ni = (e, t) => {
394
+ const { imageList: i, indexZeroBase: n } = t;
395
+ if (i.length)
396
+ try {
397
+ const o = JSON.parse(i);
398
+ return Di(o, t);
399
+ } catch (o) {
400
+ console.error(`Wrong format in image-list attribute: ${o.message}`);
401
+ }
402
+ return Zi(e, n);
403
+ }, le = (e, t, i) => {
404
+ const n = new Image();
405
+ return n.setAttribute(t ? "data-src" : "src", e), n.className = i, n.style.cssText = `
406
+ position: ${t ? "absolute" : "static"};
407
+ width: 100%;
408
+ inset: 0;
409
+ height: 100%;
410
+ object-fit: contain;
411
+ object-position: center;
412
+ filter: blur(10px);
413
+ `, n;
414
+ }, he = (e, t, i) => {
415
+ const { innerBox: n, imageList: o, lazyload: s } = t || {}, [a] = o, r = a || Ni(e, t), c = Hi(r), l = le(c, s, "cloudimage-lazy"), h = le(c, !1, "cloudimage-360-placeholder"), u = (f) => {
416
+ Wt(n, ".cloudimage-lazy"), i && i({
417
+ event: f,
418
+ width: l.width,
419
+ height: l.height,
420
+ naturalWidth: l.naturalWidth,
421
+ naturalHeight: l.naturalHeight,
422
+ src: c
423
+ });
424
+ };
425
+ l.onload = u, n.appendChild(l), n.appendChild(h), Bi(l);
426
+ }, $i = (e, t) => {
427
+ const i = new Image();
428
+ i.src = e, i.onload = (n) => {
429
+ t && t({
430
+ event: n,
431
+ width: i.width,
432
+ height: i.height,
433
+ naturalWidth: i.naturalWidth,
434
+ naturalHeight: i.naturalHeight,
435
+ src: e
436
+ });
437
+ }, i.onerror = function() {
438
+ };
439
+ }, Vi = (e, t) => {
440
+ const i = t.getBoundingClientRect(), n = e.touches ? e.touches[0].clientX : e.clientX, o = e.touches ? e.touches[0].clientY : e.clientY;
441
+ return {
442
+ x: n - i.left,
443
+ y: o - i.top
444
+ };
445
+ }, Mt = (e, t, i) => {
446
+ const { container: n, w: o, h: s, zoom: a, bw: r, offsetX: c, offsetY: l } = t, h = Vi(e, n);
447
+ let u = h.x, f = h.y;
448
+ u = Math.max(o / a, Math.min(u, n.offsetWidth - o / a)), f = Math.max(s / a, Math.min(f, n.offsetHeight - s / a)), i.style.left = `${u - o}px`, i.style.top = `${f - s}px`;
449
+ const d = (u - c) * a - o + r, y = (f - l) * a - s + r;
450
+ i.style.backgroundPosition = `-${d}px -${y}px`;
451
+ }, ji = (e, t, i, n, o, s) => {
452
+ const { x: a = 0, y: r = 0 } = i || {}, c = (t.offsetWidth - a * 2) * s, l = (t.offsetHeight - r * 2) * s;
453
+ if (!o) return;
454
+ o.setAttribute("class", "cloudimage-360-img-magnifier-glass"), t.prepend(o), o.style.backgroundImage = `url('${n.src}')`, o.style.backgroundSize = `${c}px ${l}px`;
455
+ const h = 3, u = o.offsetWidth / 2, f = o.offsetHeight / 2, d = {
456
+ container: t,
457
+ w: u,
458
+ h: f,
459
+ zoom: s,
460
+ bw: h,
461
+ offsetX: a,
462
+ offsetY: r
463
+ };
464
+ Mt(e, d, o);
465
+ const y = (v) => {
466
+ Mt(v, d, o);
467
+ }, g = (v) => {
468
+ v.preventDefault(), Mt(v, d, o);
469
+ };
470
+ o.addEventListener("mousemove", y), t.addEventListener("mousemove", y), t.addEventListener("touchmove", g);
471
+ }, Fi = (e, t, i) => {
472
+ const { clientX: n, clientY: o } = e, s = t.getBoundingClientRect(), a = t.width / (s.width * i), r = t.height / (s.height * i), c = (n - s.left) * a, l = (o - s.top) * r;
473
+ return { offsetX: c, offsetY: l };
474
+ }, de = (e, { bottom: t, top: i }) => {
475
+ e ? t() : i();
476
+ }, ue = (e, { left: t, right: i }) => {
477
+ e ? t() : i();
478
+ }, Gi = ({ autoplayBehavior: e, spinY: t, reversed: i, loopTriggers: n }) => {
479
+ switch (e) {
480
+ case T.SPIN_XY:
481
+ case T.SPIN_YX:
482
+ t ? de(i, n) : ue(i, n);
483
+ break;
484
+ case T.SPIN_Y:
485
+ de(i, n);
486
+ break;
487
+ case T.SPIN_X:
488
+ default:
489
+ ue(i, n);
490
+ }
491
+ }, zi = ({
492
+ autoplayBehavior: e,
493
+ activeImageX: t,
494
+ activeImageY: i,
495
+ amountX: n,
496
+ amountY: o,
497
+ autoplayReverse: s
498
+ }) => {
499
+ const a = (r, c) => {
500
+ const l = c - 1;
501
+ return s ? r === 0 : r === l;
502
+ };
503
+ switch (e) {
504
+ case T.SPIN_XY:
505
+ case T.SPIN_Y:
506
+ return a(i, o);
507
+ case T.SPIN_X:
508
+ case T.SPIN_YX:
509
+ default:
510
+ return a(t, n);
511
+ }
512
+ }, Ui = ({
513
+ autoplayBehavior: e,
514
+ activeImageX: t,
515
+ activeImageY: i,
516
+ amountX: n,
517
+ amountY: o,
518
+ autoplayReverse: s,
519
+ spinDirection: a
520
+ }) => {
521
+ const r = t === (s ? 0 : n - 1), c = i === (s ? 0 : o - 1);
522
+ return e === T.SPIN_XY || e === T.SPIN_YX ? a === "x" && r || a === "y" && c : !1;
523
+ }, Ki = (e, t, i) => {
524
+ if (!i) return "x";
525
+ if (!t) return "y";
526
+ switch (e) {
527
+ case T.SPIN_XY:
528
+ return "x";
529
+ case T.SPIN_YX:
530
+ return "y";
531
+ case T.SPIN_Y:
532
+ return "y";
533
+ case T.SPIN_X:
534
+ default:
535
+ return "x";
536
+ }
537
+ }, qi = (e) => e === "x" ? "y" : "x", pe = (e, t) => {
538
+ const i = [...li];
539
+ return t ? [...i, ...hi].includes(e) : i.includes(e);
540
+ }, Ji = ({ deltaX: e, deltaY: t, reversed: i, allowSpinX: n, allowSpinY: o, threshold: s = 0 }) => {
541
+ const a = n && !o || o && !n ? 0 : s, r = Math.abs(e), c = Math.abs(t);
542
+ return n && r - a > c ? i ? e > 0 ? "left" : "right" : e > 0 ? "right" : "left" : o && c - a > r ? i ? t > 0 ? "up" : "down" : t > 0 ? "down" : "up" : null;
543
+ }, Qi = () => "ontouchstart" in window || navigator.maxTouchPoints > 0 || navigator.msMaxTouchPoints > 0, _i = (e, t = 150) => {
544
+ let i;
545
+ return function(...n) {
546
+ clearTimeout(i), i = setTimeout(() => {
547
+ e.apply(this, n);
548
+ }, t);
549
+ };
550
+ }, Se = "KGZ1bmN0aW9uKCl7InVzZSBzdHJpY3QiO2NvbnN0IHg9KGEsdCxlKT0+e2NvbnN0IHM9YS9lLG49dC9lO3JldHVybnt6b29tZWRXaWR0aDpzLHpvb21lZEhlaWdodDpufX0sTz0oe3BvaW50ZXJYOmEscG9pbnRlclk6dCxpbWFnZURhdGE6ZSx6b29tZWRXaWR0aDpzLHpvb21lZEhlaWdodDpuLGRyYXdXaWR0aDppLGRyYXdIZWlnaHQ6Y30pPT57Y29uc3R7bmF0dXJhbFdpZHRoOnIsbmF0dXJhbEhlaWdodDpsfT1lO2xldCBnPWEvaSpyLXMvMix1PXQvYypsLW4vMjtjb25zdCBwPU1hdGgubWF4KDAsci1zKSxJPU1hdGgubWF4KDAsbC1uKTtyZXR1cm4gZz1NYXRoLm1heCgwLE1hdGgubWluKGcscCkpLHU9TWF0aC5tYXgoMCxNYXRoLm1pbih1LEkpKSx7em9vbU9mZnNldFg6Zyx6b29tT2Zmc2V0WTp1fX07bGV0IG8sbSxmLGgsZCx3O3NlbGYub25tZXNzYWdlPWFzeW5jIGE9Pntjb25zdHthY3Rpb246dCxvZmZzY3JlZW46ZSxkZXZpY2VQaXhlbFJhdGlvOnMsaW1hZ2VEYXRhOm4sem9vbVNjYWxlOmkscG9pbnRlclg6Yyxwb2ludGVyWTpyLGltYWdlQXNwZWN0UmF0aW86bCxjb250YWluZXJXaWR0aDpnLGNvbnRhaW5lckhlaWdodDp1fT1hLmRhdGE7c3dpdGNoKHQpe2Nhc2UiaW5pdENhbnZhcyI6dihlLHMpO2JyZWFrO2Nhc2UiYWRhcHRDYW52YXNTaXplIjp6KGwsZyx1KTticmVhaztjYXNlImRyYXdJbWFnZU9uQ2FudmFzIjpDKG4saSxjLHIpO2JyZWFrfX07Y29uc3Qgdj0oYSx0KT0+e289YSxtPW8uZ2V0Q29udGV4dCgiMmQiKSxmPXR9LHo9KGEsdCxlKT0+e2NvbnN0IHM9dC9lO3c9YT5zLG8ud2lkdGg9dCpmLG8uaGVpZ2h0PWUqZixtLnNjYWxlKGYsZiksdz8oaD10LGQ9dC9hKTooZD1lLGg9ZSphKSxtLmltYWdlU21vb3RoaW5nRW5hYmxlZD0hMCxtLmltYWdlU21vb3RoaW5nUXVhbGl0eT0iaGlnaCJ9LEM9KGE9e30sdD0xLGU9MCxzPTApPT57Y29uc3R7Yml0bWFwSW1hZ2U6bn09YTtpZighb3x8IW4pcmV0dXJuO2xldCBpLGM7aWYodz8oaT0wLGM9KG8uaGVpZ2h0L2YtZCkvMik6KGk9KG8ud2lkdGgvZi1oKS8yLGM9MCksbS5jbGVhclJlY3QoMCwwLG8ud2lkdGgsby5oZWlnaHQpLHQhPT0xKXtjb25zdHt6b29tZWRXaWR0aDpyLHpvb21lZEhlaWdodDpsfT14KGgsZCx0KSx7em9vbU9mZnNldFg6Zyx6b29tT2Zmc2V0WTp1fT1PKHtwb2ludGVyWDplLHBvaW50ZXJZOnMsaW1hZ2VEYXRhOmEsem9vbWVkV2lkdGg6cix6b29tZWRIZWlnaHQ6bCxkcmF3V2lkdGg6aCxkcmF3SGVpZ2h0OmR9KTttLmRyYXdJbWFnZShuLGcsdSxyLGwsaSxjLGgsZCl9ZWxzZSBtLmRyYXdJbWFnZShuLGksYyxoLGQpfX0pKCk7Cg==", tn = (e) => Uint8Array.from(atob(e), (t) => t.charCodeAt(0)), fe = typeof self < "u" && self.Blob && new Blob([tn(Se)], { type: "text/javascript;charset=utf-8" });
551
+ function en(e) {
552
+ let t;
553
+ try {
554
+ if (t = fe && (self.URL || self.webkitURL).createObjectURL(fe), !t) throw "";
555
+ const i = new Worker(t, {
556
+ name: e == null ? void 0 : e.name
557
+ });
558
+ return i.addEventListener("error", () => {
559
+ (self.URL || self.webkitURL).revokeObjectURL(t);
560
+ }), i;
561
+ } catch {
562
+ return new Worker(
563
+ "data:text/javascript;base64," + Se,
564
+ {
565
+ name: e == null ? void 0 : e.name
566
+ }
567
+ );
568
+ } finally {
569
+ t && (self.URL || self.webkitURL).revokeObjectURL(t);
570
+ }
571
+ }
572
+ const nn = (e) => e === "x" ? A.X : A.Y, on = (e, t, i) => e.filter(
573
+ (n) => nn(n.orientation) === i && t in n.positions
574
+ ), sn = (e) => {
575
+ const t = document.createElement("span");
576
+ return t.id = e, t.className = "cloudimage-360-hotspot", t.dataset.hotspotId = e, t;
577
+ }, rn = (e) => {
578
+ const t = Object.entries(e).sort(([s], [a]) => Number(s) - Number(a));
579
+ let i = null, n = null;
580
+ const o = {};
581
+ for (const [s, a] of t)
582
+ if (!a)
583
+ o[s] = { x: i, y: n };
584
+ else {
585
+ const { x: r, y: c } = a;
586
+ r != null && (i = r), c != null && (n = c), o[s] = {
587
+ x: r || i,
588
+ y: c || n
589
+ };
590
+ }
591
+ return o;
592
+ }, an = (e) => [
593
+ {
594
+ name: "offset",
595
+ options: {
596
+ offset: [0, 10]
597
+ }
598
+ },
599
+ {
600
+ name: "preventOverflow",
601
+ options: {
602
+ boundary: e
603
+ }
604
+ }
605
+ ], cn = (e, t) => {
606
+ const i = document.createElement("div");
607
+ return i.className = "cloudimage-360-popper", i.id = `cloudimage-360-popper-${t}`, i.dataset.popperId = t, typeof e == "string" && /<\/?[a-z][\s\S]*>/i.test(e) ? i.innerHTML = e : i.textContent = e, document.body.appendChild(i), i;
608
+ }, ln = (e) => {
609
+ const t = [...e];
610
+ return t.forEach((i, n) => {
611
+ const o = { ...rn(i.positions) };
612
+ t[n].initialPositions = o, t[n].positions = o;
613
+ }), t;
614
+ }, hn = ({
615
+ newWidth: e,
616
+ newHeight: t,
617
+ initialContainerSize: i,
618
+ imageAspectRatio: n,
619
+ hotspotsConfig: o
620
+ }) => {
621
+ const [s, a] = i;
622
+ let r = e, c = t, l = 0, h = 0;
623
+ const u = e / t;
624
+ n > u ? (c = e / n, h = (t - c) / 2) : (r = t * n, l = (e - r) / 2);
625
+ const d = r / s, y = c / a;
626
+ return o.map((g) => {
627
+ const v = {};
628
+ return Object.entries(g.initialPositions).forEach(([x, C]) => {
629
+ v[x] = {
630
+ x: C.x * d + l,
631
+ y: C.y * y + h
632
+ };
633
+ }), { ...g, positions: v };
634
+ });
635
+ };
636
+ var k = "top", N = "bottom", $ = "right", M = "left", Zt = "auto", It = [k, N, $, M], ct = "start", wt = "end", dn = "clippingParents", Ye = "viewport", vt = "popper", un = "reference", me = /* @__PURE__ */ It.reduce(function(e, t) {
637
+ return e.concat([t + "-" + ct, t + "-" + wt]);
638
+ }, []), Re = /* @__PURE__ */ [].concat(It, [Zt]).reduce(function(e, t) {
639
+ return e.concat([t, t + "-" + ct, t + "-" + wt]);
640
+ }, []), pn = "beforeRead", fn = "read", mn = "afterRead", vn = "beforeMain", gn = "main", yn = "afterMain", bn = "beforeWrite", wn = "write", xn = "afterWrite", In = [pn, fn, mn, vn, gn, yn, bn, wn, xn];
641
+ function z(e) {
642
+ return e ? (e.nodeName || "").toLowerCase() : null;
643
+ }
644
+ function Z(e) {
645
+ if (e == null)
646
+ return window;
647
+ if (e.toString() !== "[object Window]") {
648
+ var t = e.ownerDocument;
649
+ return t && t.defaultView || window;
650
+ }
651
+ return e;
652
+ }
653
+ function st(e) {
654
+ var t = Z(e).Element;
655
+ return e instanceof t || e instanceof Element;
656
+ }
657
+ function D(e) {
658
+ var t = Z(e).HTMLElement;
659
+ return e instanceof t || e instanceof HTMLElement;
660
+ }
661
+ function Dt(e) {
662
+ if (typeof ShadowRoot > "u")
663
+ return !1;
664
+ var t = Z(e).ShadowRoot;
665
+ return e instanceof t || e instanceof ShadowRoot;
666
+ }
667
+ function Cn(e) {
668
+ var t = e.state;
669
+ Object.keys(t.elements).forEach(function(i) {
670
+ var n = t.styles[i] || {}, o = t.attributes[i] || {}, s = t.elements[i];
671
+ !D(s) || !z(s) || (Object.assign(s.style, n), Object.keys(o).forEach(function(a) {
672
+ var r = o[a];
673
+ r === !1 ? s.removeAttribute(a) : s.setAttribute(a, r === !0 ? "" : r);
674
+ }));
675
+ });
676
+ }
677
+ function On(e) {
678
+ var t = e.state, i = {
679
+ popper: {
680
+ position: t.options.strategy,
681
+ left: "0",
682
+ top: "0",
683
+ margin: "0"
684
+ },
685
+ arrow: {
686
+ position: "absolute"
687
+ },
688
+ reference: {}
689
+ };
690
+ return Object.assign(t.elements.popper.style, i.popper), t.styles = i, t.elements.arrow && Object.assign(t.elements.arrow.style, i.arrow), function() {
691
+ Object.keys(t.elements).forEach(function(n) {
692
+ var o = t.elements[n], s = t.attributes[n] || {}, a = Object.keys(t.styles.hasOwnProperty(n) ? t.styles[n] : i[n]), r = a.reduce(function(c, l) {
693
+ return c[l] = "", c;
694
+ }, {});
695
+ !D(o) || !z(o) || (Object.assign(o.style, r), Object.keys(s).forEach(function(c) {
696
+ o.removeAttribute(c);
697
+ }));
698
+ });
699
+ };
700
+ }
701
+ const En = {
702
+ name: "applyStyles",
703
+ enabled: !0,
704
+ phase: "write",
705
+ fn: Cn,
706
+ effect: On,
707
+ requires: ["computeStyles"]
708
+ };
709
+ function G(e) {
710
+ return e.split("-")[0];
711
+ }
712
+ var ot = Math.max, Xt = Math.min, lt = Math.round;
713
+ function Ht() {
714
+ var e = navigator.userAgentData;
715
+ return e != null && e.brands && Array.isArray(e.brands) ? e.brands.map(function(t) {
716
+ return t.brand + "/" + t.version;
717
+ }).join(" ") : navigator.userAgent;
718
+ }
719
+ function Xe() {
720
+ return !/^((?!chrome|android).)*safari/i.test(Ht());
721
+ }
722
+ function ht(e, t, i) {
723
+ t === void 0 && (t = !1), i === void 0 && (i = !1);
724
+ var n = e.getBoundingClientRect(), o = 1, s = 1;
725
+ t && D(e) && (o = e.offsetWidth > 0 && lt(n.width) / e.offsetWidth || 1, s = e.offsetHeight > 0 && lt(n.height) / e.offsetHeight || 1);
726
+ var a = st(e) ? Z(e) : window, r = a.visualViewport, c = !Xe() && i, l = (n.left + (c && r ? r.offsetLeft : 0)) / o, h = (n.top + (c && r ? r.offsetTop : 0)) / s, u = n.width / o, f = n.height / s;
727
+ return {
728
+ width: u,
729
+ height: f,
730
+ top: h,
731
+ right: l + u,
732
+ bottom: h + f,
733
+ left: l,
734
+ x: l,
735
+ y: h
736
+ };
737
+ }
738
+ function Nt(e) {
739
+ var t = ht(e), i = e.offsetWidth, n = e.offsetHeight;
740
+ return Math.abs(t.width - i) <= 1 && (i = t.width), Math.abs(t.height - n) <= 1 && (n = t.height), {
741
+ x: e.offsetLeft,
742
+ y: e.offsetTop,
743
+ width: i,
744
+ height: n
745
+ };
746
+ }
747
+ function Le(e, t) {
748
+ var i = t.getRootNode && t.getRootNode();
749
+ if (e.contains(t))
750
+ return !0;
751
+ if (i && Dt(i)) {
752
+ var n = t;
753
+ do {
754
+ if (n && e.isSameNode(n))
755
+ return !0;
756
+ n = n.parentNode || n.host;
757
+ } while (n);
758
+ }
759
+ return !1;
760
+ }
761
+ function J(e) {
762
+ return Z(e).getComputedStyle(e);
763
+ }
764
+ function Sn(e) {
765
+ return ["table", "td", "th"].indexOf(z(e)) >= 0;
766
+ }
767
+ function et(e) {
768
+ return ((st(e) ? e.ownerDocument : (
769
+ // $FlowFixMe[prop-missing]
770
+ e.document
771
+ )) || window.document).documentElement;
772
+ }
773
+ function Pt(e) {
774
+ return z(e) === "html" ? e : (
775
+ // this is a quicker (but less type safe) way to save quite some bytes from the bundle
776
+ // $FlowFixMe[incompatible-return]
777
+ // $FlowFixMe[prop-missing]
778
+ e.assignedSlot || // step into the shadow DOM of the parent of a slotted node
779
+ e.parentNode || // DOM Element detected
780
+ (Dt(e) ? e.host : null) || // ShadowRoot detected
781
+ // $FlowFixMe[incompatible-call]: HTMLElement is a Node
782
+ et(e)
783
+ );
784
+ }
785
+ function ve(e) {
786
+ return !D(e) || // https://github.com/popperjs/popper-core/issues/837
787
+ J(e).position === "fixed" ? null : e.offsetParent;
788
+ }
789
+ function Yn(e) {
790
+ var t = /firefox/i.test(Ht()), i = /Trident/i.test(Ht());
791
+ if (i && D(e)) {
792
+ var n = J(e);
793
+ if (n.position === "fixed")
794
+ return null;
795
+ }
796
+ var o = Pt(e);
797
+ for (Dt(o) && (o = o.host); D(o) && ["html", "body"].indexOf(z(o)) < 0; ) {
798
+ var s = J(o);
799
+ if (s.transform !== "none" || s.perspective !== "none" || s.contain === "paint" || ["transform", "perspective"].indexOf(s.willChange) !== -1 || t && s.willChange === "filter" || t && s.filter && s.filter !== "none")
800
+ return o;
801
+ o = o.parentNode;
802
+ }
803
+ return null;
804
+ }
805
+ function Ct(e) {
806
+ for (var t = Z(e), i = ve(e); i && Sn(i) && J(i).position === "static"; )
807
+ i = ve(i);
808
+ return i && (z(i) === "html" || z(i) === "body" && J(i).position === "static") ? t : i || Yn(e) || t;
809
+ }
810
+ function $t(e) {
811
+ return ["top", "bottom"].indexOf(e) >= 0 ? "x" : "y";
812
+ }
813
+ function yt(e, t, i) {
814
+ return ot(e, Xt(t, i));
815
+ }
816
+ function Rn(e, t, i) {
817
+ var n = yt(e, t, i);
818
+ return n > i ? i : n;
819
+ }
820
+ function Pe() {
821
+ return {
822
+ top: 0,
823
+ right: 0,
824
+ bottom: 0,
825
+ left: 0
826
+ };
827
+ }
828
+ function Te(e) {
829
+ return Object.assign({}, Pe(), e);
830
+ }
831
+ function Ae(e, t) {
832
+ return t.reduce(function(i, n) {
833
+ return i[n] = e, i;
834
+ }, {});
835
+ }
836
+ var Xn = function(t, i) {
837
+ return t = typeof t == "function" ? t(Object.assign({}, i.rects, {
838
+ placement: i.placement
839
+ })) : t, Te(typeof t != "number" ? t : Ae(t, It));
840
+ };
841
+ function Ln(e) {
842
+ var t, i = e.state, n = e.name, o = e.options, s = i.elements.arrow, a = i.modifiersData.popperOffsets, r = G(i.placement), c = $t(r), l = [M, $].indexOf(r) >= 0, h = l ? "height" : "width";
843
+ if (!(!s || !a)) {
844
+ var u = Xn(o.padding, i), f = Nt(s), d = c === "y" ? k : M, y = c === "y" ? N : $, g = i.rects.reference[h] + i.rects.reference[c] - a[c] - i.rects.popper[h], v = a[c] - i.rects.reference[c], x = Ct(s), C = x ? c === "y" ? x.clientHeight || 0 : x.clientWidth || 0 : 0, O = g / 2 - v / 2, b = u[d], w = C - f[h] - u[y], m = C / 2 - f[h] / 2 + O, I = yt(b, m, w), E = c;
845
+ i.modifiersData[n] = (t = {}, t[E] = I, t.centerOffset = I - m, t);
846
+ }
847
+ }
848
+ function Pn(e) {
849
+ var t = e.state, i = e.options, n = i.element, o = n === void 0 ? "[data-popper-arrow]" : n;
850
+ o != null && (typeof o == "string" && (o = t.elements.popper.querySelector(o), !o) || Le(t.elements.popper, o) && (t.elements.arrow = o));
851
+ }
852
+ const Tn = {
853
+ name: "arrow",
854
+ enabled: !0,
855
+ phase: "main",
856
+ fn: Ln,
857
+ effect: Pn,
858
+ requires: ["popperOffsets"],
859
+ requiresIfExists: ["preventOverflow"]
860
+ };
861
+ function dt(e) {
862
+ return e.split("-")[1];
863
+ }
864
+ var An = {
865
+ top: "auto",
866
+ right: "auto",
867
+ bottom: "auto",
868
+ left: "auto"
869
+ };
870
+ function kn(e, t) {
871
+ var i = e.x, n = e.y, o = t.devicePixelRatio || 1;
872
+ return {
873
+ x: lt(i * o) / o || 0,
874
+ y: lt(n * o) / o || 0
875
+ };
876
+ }
877
+ function ge(e) {
878
+ var t, i = e.popper, n = e.popperRect, o = e.placement, s = e.variation, a = e.offsets, r = e.position, c = e.gpuAcceleration, l = e.adaptive, h = e.roundOffsets, u = e.isFixed, f = a.x, d = f === void 0 ? 0 : f, y = a.y, g = y === void 0 ? 0 : y, v = typeof h == "function" ? h({
879
+ x: d,
880
+ y: g
881
+ }) : {
882
+ x: d,
883
+ y: g
884
+ };
885
+ d = v.x, g = v.y;
886
+ var x = a.hasOwnProperty("x"), C = a.hasOwnProperty("y"), O = M, b = k, w = window;
887
+ if (l) {
888
+ var m = Ct(i), I = "clientHeight", E = "clientWidth";
889
+ if (m === Z(i) && (m = et(i), J(m).position !== "static" && r === "absolute" && (I = "scrollHeight", E = "scrollWidth")), m = m, o === k || (o === M || o === $) && s === wt) {
890
+ b = N;
891
+ var S = u && m === w && w.visualViewport ? w.visualViewport.height : (
892
+ // $FlowFixMe[prop-missing]
893
+ m[I]
894
+ );
895
+ g -= S - n.height, g *= c ? 1 : -1;
896
+ }
897
+ if (o === M || (o === k || o === N) && s === wt) {
898
+ O = $;
899
+ var Y = u && m === w && w.visualViewport ? w.visualViewport.width : (
900
+ // $FlowFixMe[prop-missing]
901
+ m[E]
902
+ );
903
+ d -= Y - n.width, d *= c ? 1 : -1;
904
+ }
905
+ }
906
+ var X = Object.assign({
907
+ position: r
908
+ }, l && An), W = h === !0 ? kn({
909
+ x: d,
910
+ y: g
911
+ }, Z(i)) : {
912
+ x: d,
913
+ y: g
914
+ };
915
+ if (d = W.x, g = W.y, c) {
916
+ var L;
917
+ return Object.assign({}, X, (L = {}, L[b] = C ? "0" : "", L[O] = x ? "0" : "", L.transform = (w.devicePixelRatio || 1) <= 1 ? "translate(" + d + "px, " + g + "px)" : "translate3d(" + d + "px, " + g + "px, 0)", L));
918
+ }
919
+ return Object.assign({}, X, (t = {}, t[b] = C ? g + "px" : "", t[O] = x ? d + "px" : "", t.transform = "", t));
920
+ }
921
+ function Mn(e) {
922
+ var t = e.state, i = e.options, n = i.gpuAcceleration, o = n === void 0 ? !0 : n, s = i.adaptive, a = s === void 0 ? !0 : s, r = i.roundOffsets, c = r === void 0 ? !0 : r, l = {
923
+ placement: G(t.placement),
924
+ variation: dt(t.placement),
925
+ popper: t.elements.popper,
926
+ popperRect: t.rects.popper,
927
+ gpuAcceleration: o,
928
+ isFixed: t.options.strategy === "fixed"
929
+ };
930
+ t.modifiersData.popperOffsets != null && (t.styles.popper = Object.assign({}, t.styles.popper, ge(Object.assign({}, l, {
931
+ offsets: t.modifiersData.popperOffsets,
932
+ position: t.options.strategy,
933
+ adaptive: a,
934
+ roundOffsets: c
935
+ })))), t.modifiersData.arrow != null && (t.styles.arrow = Object.assign({}, t.styles.arrow, ge(Object.assign({}, l, {
936
+ offsets: t.modifiersData.arrow,
937
+ position: "absolute",
938
+ adaptive: !1,
939
+ roundOffsets: c
940
+ })))), t.attributes.popper = Object.assign({}, t.attributes.popper, {
941
+ "data-popper-placement": t.placement
942
+ });
943
+ }
944
+ const Wn = {
945
+ name: "computeStyles",
946
+ enabled: !0,
947
+ phase: "beforeWrite",
948
+ fn: Mn,
949
+ data: {}
950
+ };
951
+ var St = {
952
+ passive: !0
953
+ };
954
+ function Hn(e) {
955
+ var t = e.state, i = e.instance, n = e.options, o = n.scroll, s = o === void 0 ? !0 : o, a = n.resize, r = a === void 0 ? !0 : a, c = Z(t.elements.popper), l = [].concat(t.scrollParents.reference, t.scrollParents.popper);
956
+ return s && l.forEach(function(h) {
957
+ h.addEventListener("scroll", i.update, St);
958
+ }), r && c.addEventListener("resize", i.update, St), function() {
959
+ s && l.forEach(function(h) {
960
+ h.removeEventListener("scroll", i.update, St);
961
+ }), r && c.removeEventListener("resize", i.update, St);
962
+ };
963
+ }
964
+ const Bn = {
965
+ name: "eventListeners",
966
+ enabled: !0,
967
+ phase: "write",
968
+ fn: function() {
969
+ },
970
+ effect: Hn,
971
+ data: {}
972
+ };
973
+ var Zn = {
974
+ left: "right",
975
+ right: "left",
976
+ bottom: "top",
977
+ top: "bottom"
978
+ };
979
+ function Yt(e) {
980
+ return e.replace(/left|right|bottom|top/g, function(t) {
981
+ return Zn[t];
982
+ });
983
+ }
984
+ var Dn = {
985
+ start: "end",
986
+ end: "start"
987
+ };
988
+ function ye(e) {
989
+ return e.replace(/start|end/g, function(t) {
990
+ return Dn[t];
991
+ });
992
+ }
993
+ function Vt(e) {
994
+ var t = Z(e), i = t.pageXOffset, n = t.pageYOffset;
995
+ return {
996
+ scrollLeft: i,
997
+ scrollTop: n
998
+ };
999
+ }
1000
+ function jt(e) {
1001
+ return ht(et(e)).left + Vt(e).scrollLeft;
1002
+ }
1003
+ function Nn(e, t) {
1004
+ var i = Z(e), n = et(e), o = i.visualViewport, s = n.clientWidth, a = n.clientHeight, r = 0, c = 0;
1005
+ if (o) {
1006
+ s = o.width, a = o.height;
1007
+ var l = Xe();
1008
+ (l || !l && t === "fixed") && (r = o.offsetLeft, c = o.offsetTop);
1009
+ }
1010
+ return {
1011
+ width: s,
1012
+ height: a,
1013
+ x: r + jt(e),
1014
+ y: c
1015
+ };
1016
+ }
1017
+ function $n(e) {
1018
+ var t, i = et(e), n = Vt(e), o = (t = e.ownerDocument) == null ? void 0 : t.body, s = ot(i.scrollWidth, i.clientWidth, o ? o.scrollWidth : 0, o ? o.clientWidth : 0), a = ot(i.scrollHeight, i.clientHeight, o ? o.scrollHeight : 0, o ? o.clientHeight : 0), r = -n.scrollLeft + jt(e), c = -n.scrollTop;
1019
+ return J(o || i).direction === "rtl" && (r += ot(i.clientWidth, o ? o.clientWidth : 0) - s), {
1020
+ width: s,
1021
+ height: a,
1022
+ x: r,
1023
+ y: c
1024
+ };
1025
+ }
1026
+ function Ft(e) {
1027
+ var t = J(e), i = t.overflow, n = t.overflowX, o = t.overflowY;
1028
+ return /auto|scroll|overlay|hidden/.test(i + o + n);
1029
+ }
1030
+ function ke(e) {
1031
+ return ["html", "body", "#document"].indexOf(z(e)) >= 0 ? e.ownerDocument.body : D(e) && Ft(e) ? e : ke(Pt(e));
1032
+ }
1033
+ function bt(e, t) {
1034
+ var i;
1035
+ t === void 0 && (t = []);
1036
+ var n = ke(e), o = n === ((i = e.ownerDocument) == null ? void 0 : i.body), s = Z(n), a = o ? [s].concat(s.visualViewport || [], Ft(n) ? n : []) : n, r = t.concat(a);
1037
+ return o ? r : (
1038
+ // $FlowFixMe[incompatible-call]: isBody tells us target will be an HTMLElement here
1039
+ r.concat(bt(Pt(a)))
1040
+ );
1041
+ }
1042
+ function Bt(e) {
1043
+ return Object.assign({}, e, {
1044
+ left: e.x,
1045
+ top: e.y,
1046
+ right: e.x + e.width,
1047
+ bottom: e.y + e.height
1048
+ });
1049
+ }
1050
+ function Vn(e, t) {
1051
+ var i = ht(e, !1, t === "fixed");
1052
+ return i.top = i.top + e.clientTop, i.left = i.left + e.clientLeft, i.bottom = i.top + e.clientHeight, i.right = i.left + e.clientWidth, i.width = e.clientWidth, i.height = e.clientHeight, i.x = i.left, i.y = i.top, i;
1053
+ }
1054
+ function be(e, t, i) {
1055
+ return t === Ye ? Bt(Nn(e, i)) : st(t) ? Vn(t, i) : Bt($n(et(e)));
1056
+ }
1057
+ function jn(e) {
1058
+ var t = bt(Pt(e)), i = ["absolute", "fixed"].indexOf(J(e).position) >= 0, n = i && D(e) ? Ct(e) : e;
1059
+ return st(n) ? t.filter(function(o) {
1060
+ return st(o) && Le(o, n) && z(o) !== "body";
1061
+ }) : [];
1062
+ }
1063
+ function Fn(e, t, i, n) {
1064
+ var o = t === "clippingParents" ? jn(e) : [].concat(t), s = [].concat(o, [i]), a = s[0], r = s.reduce(function(c, l) {
1065
+ var h = be(e, l, n);
1066
+ return c.top = ot(h.top, c.top), c.right = Xt(h.right, c.right), c.bottom = Xt(h.bottom, c.bottom), c.left = ot(h.left, c.left), c;
1067
+ }, be(e, a, n));
1068
+ return r.width = r.right - r.left, r.height = r.bottom - r.top, r.x = r.left, r.y = r.top, r;
1069
+ }
1070
+ function Me(e) {
1071
+ var t = e.reference, i = e.element, n = e.placement, o = n ? G(n) : null, s = n ? dt(n) : null, a = t.x + t.width / 2 - i.width / 2, r = t.y + t.height / 2 - i.height / 2, c;
1072
+ switch (o) {
1073
+ case k:
1074
+ c = {
1075
+ x: a,
1076
+ y: t.y - i.height
1077
+ };
1078
+ break;
1079
+ case N:
1080
+ c = {
1081
+ x: a,
1082
+ y: t.y + t.height
1083
+ };
1084
+ break;
1085
+ case $:
1086
+ c = {
1087
+ x: t.x + t.width,
1088
+ y: r
1089
+ };
1090
+ break;
1091
+ case M:
1092
+ c = {
1093
+ x: t.x - i.width,
1094
+ y: r
1095
+ };
1096
+ break;
1097
+ default:
1098
+ c = {
1099
+ x: t.x,
1100
+ y: t.y
1101
+ };
1102
+ }
1103
+ var l = o ? $t(o) : null;
1104
+ if (l != null) {
1105
+ var h = l === "y" ? "height" : "width";
1106
+ switch (s) {
1107
+ case ct:
1108
+ c[l] = c[l] - (t[h] / 2 - i[h] / 2);
1109
+ break;
1110
+ case wt:
1111
+ c[l] = c[l] + (t[h] / 2 - i[h] / 2);
1112
+ break;
1113
+ }
1114
+ }
1115
+ return c;
1116
+ }
1117
+ function xt(e, t) {
1118
+ t === void 0 && (t = {});
1119
+ var i = t, n = i.placement, o = n === void 0 ? e.placement : n, s = i.strategy, a = s === void 0 ? e.strategy : s, r = i.boundary, c = r === void 0 ? dn : r, l = i.rootBoundary, h = l === void 0 ? Ye : l, u = i.elementContext, f = u === void 0 ? vt : u, d = i.altBoundary, y = d === void 0 ? !1 : d, g = i.padding, v = g === void 0 ? 0 : g, x = Te(typeof v != "number" ? v : Ae(v, It)), C = f === vt ? un : vt, O = e.rects.popper, b = e.elements[y ? C : f], w = Fn(st(b) ? b : b.contextElement || et(e.elements.popper), c, h, a), m = ht(e.elements.reference), I = Me({
1120
+ reference: m,
1121
+ element: O,
1122
+ strategy: "absolute",
1123
+ placement: o
1124
+ }), E = Bt(Object.assign({}, O, I)), S = f === vt ? E : m, Y = {
1125
+ top: w.top - S.top + x.top,
1126
+ bottom: S.bottom - w.bottom + x.bottom,
1127
+ left: w.left - S.left + x.left,
1128
+ right: S.right - w.right + x.right
1129
+ }, X = e.modifiersData.offset;
1130
+ if (f === vt && X) {
1131
+ var W = X[o];
1132
+ Object.keys(Y).forEach(function(L) {
1133
+ var U = [$, N].indexOf(L) >= 0 ? 1 : -1, K = [k, N].indexOf(L) >= 0 ? "y" : "x";
1134
+ Y[L] += W[K] * U;
1135
+ });
1136
+ }
1137
+ return Y;
1138
+ }
1139
+ function Gn(e, t) {
1140
+ t === void 0 && (t = {});
1141
+ var i = t, n = i.placement, o = i.boundary, s = i.rootBoundary, a = i.padding, r = i.flipVariations, c = i.allowedAutoPlacements, l = c === void 0 ? Re : c, h = dt(n), u = h ? r ? me : me.filter(function(y) {
1142
+ return dt(y) === h;
1143
+ }) : It, f = u.filter(function(y) {
1144
+ return l.indexOf(y) >= 0;
1145
+ });
1146
+ f.length === 0 && (f = u);
1147
+ var d = f.reduce(function(y, g) {
1148
+ return y[g] = xt(e, {
1149
+ placement: g,
1150
+ boundary: o,
1151
+ rootBoundary: s,
1152
+ padding: a
1153
+ })[G(g)], y;
1154
+ }, {});
1155
+ return Object.keys(d).sort(function(y, g) {
1156
+ return d[y] - d[g];
1157
+ });
1158
+ }
1159
+ function zn(e) {
1160
+ if (G(e) === Zt)
1161
+ return [];
1162
+ var t = Yt(e);
1163
+ return [ye(e), t, ye(t)];
1164
+ }
1165
+ function Un(e) {
1166
+ var t = e.state, i = e.options, n = e.name;
1167
+ if (!t.modifiersData[n]._skip) {
1168
+ for (var o = i.mainAxis, s = o === void 0 ? !0 : o, a = i.altAxis, r = a === void 0 ? !0 : a, c = i.fallbackPlacements, l = i.padding, h = i.boundary, u = i.rootBoundary, f = i.altBoundary, d = i.flipVariations, y = d === void 0 ? !0 : d, g = i.allowedAutoPlacements, v = t.options.placement, x = G(v), C = x === v, O = c || (C || !y ? [Yt(v)] : zn(v)), b = [v].concat(O).reduce(function(j, V) {
1169
+ return j.concat(G(V) === Zt ? Gn(t, {
1170
+ placement: V,
1171
+ boundary: h,
1172
+ rootBoundary: u,
1173
+ padding: l,
1174
+ flipVariations: y,
1175
+ allowedAutoPlacements: g
1176
+ }) : V);
1177
+ }, []), w = t.rects.reference, m = t.rects.popper, I = /* @__PURE__ */ new Map(), E = !0, S = b[0], Y = 0; Y < b.length; Y++) {
1178
+ var X = b[Y], W = G(X), L = dt(X) === ct, U = [k, N].indexOf(W) >= 0, K = U ? "width" : "height", P = xt(t, {
1179
+ placement: X,
1180
+ boundary: h,
1181
+ rootBoundary: u,
1182
+ altBoundary: f,
1183
+ padding: l
1184
+ }), H = U ? L ? $ : M : L ? N : k;
1185
+ w[K] > m[K] && (H = Yt(H));
1186
+ var rt = Yt(H), q = [];
1187
+ if (s && q.push(P[W] <= 0), r && q.push(P[H] <= 0, P[rt] <= 0), q.every(function(j) {
1188
+ return j;
1189
+ })) {
1190
+ S = X, E = !1;
1191
+ break;
1192
+ }
1193
+ I.set(X, q);
1194
+ }
1195
+ if (E)
1196
+ for (var at = y ? 3 : 1, ut = function(V) {
1197
+ var tt = b.find(function(it) {
1198
+ var F = I.get(it);
1199
+ if (F)
1200
+ return F.slice(0, V).every(function(pt) {
1201
+ return pt;
1202
+ });
1203
+ });
1204
+ if (tt)
1205
+ return S = tt, "break";
1206
+ }, Q = at; Q > 0; Q--) {
1207
+ var _ = ut(Q);
1208
+ if (_ === "break") break;
1209
+ }
1210
+ t.placement !== S && (t.modifiersData[n]._skip = !0, t.placement = S, t.reset = !0);
1211
+ }
1212
+ }
1213
+ const Kn = {
1214
+ name: "flip",
1215
+ enabled: !0,
1216
+ phase: "main",
1217
+ fn: Un,
1218
+ requiresIfExists: ["offset"],
1219
+ data: {
1220
+ _skip: !1
1221
+ }
1222
+ };
1223
+ function we(e, t, i) {
1224
+ return i === void 0 && (i = {
1225
+ x: 0,
1226
+ y: 0
1227
+ }), {
1228
+ top: e.top - t.height - i.y,
1229
+ right: e.right - t.width + i.x,
1230
+ bottom: e.bottom - t.height + i.y,
1231
+ left: e.left - t.width - i.x
1232
+ };
1233
+ }
1234
+ function xe(e) {
1235
+ return [k, $, N, M].some(function(t) {
1236
+ return e[t] >= 0;
1237
+ });
1238
+ }
1239
+ function qn(e) {
1240
+ var t = e.state, i = e.name, n = t.rects.reference, o = t.rects.popper, s = t.modifiersData.preventOverflow, a = xt(t, {
1241
+ elementContext: "reference"
1242
+ }), r = xt(t, {
1243
+ altBoundary: !0
1244
+ }), c = we(a, n), l = we(r, o, s), h = xe(c), u = xe(l);
1245
+ t.modifiersData[i] = {
1246
+ referenceClippingOffsets: c,
1247
+ popperEscapeOffsets: l,
1248
+ isReferenceHidden: h,
1249
+ hasPopperEscaped: u
1250
+ }, t.attributes.popper = Object.assign({}, t.attributes.popper, {
1251
+ "data-popper-reference-hidden": h,
1252
+ "data-popper-escaped": u
1253
+ });
1254
+ }
1255
+ const Jn = {
1256
+ name: "hide",
1257
+ enabled: !0,
1258
+ phase: "main",
1259
+ requiresIfExists: ["preventOverflow"],
1260
+ fn: qn
1261
+ };
1262
+ function Qn(e, t, i) {
1263
+ var n = G(e), o = [M, k].indexOf(n) >= 0 ? -1 : 1, s = typeof i == "function" ? i(Object.assign({}, t, {
1264
+ placement: e
1265
+ })) : i, a = s[0], r = s[1];
1266
+ return a = a || 0, r = (r || 0) * o, [M, $].indexOf(n) >= 0 ? {
1267
+ x: r,
1268
+ y: a
1269
+ } : {
1270
+ x: a,
1271
+ y: r
1272
+ };
1273
+ }
1274
+ function _n(e) {
1275
+ var t = e.state, i = e.options, n = e.name, o = i.offset, s = o === void 0 ? [0, 0] : o, a = Re.reduce(function(h, u) {
1276
+ return h[u] = Qn(u, t.rects, s), h;
1277
+ }, {}), r = a[t.placement], c = r.x, l = r.y;
1278
+ t.modifiersData.popperOffsets != null && (t.modifiersData.popperOffsets.x += c, t.modifiersData.popperOffsets.y += l), t.modifiersData[n] = a;
1279
+ }
1280
+ const to = {
1281
+ name: "offset",
1282
+ enabled: !0,
1283
+ phase: "main",
1284
+ requires: ["popperOffsets"],
1285
+ fn: _n
1286
+ };
1287
+ function eo(e) {
1288
+ var t = e.state, i = e.name;
1289
+ t.modifiersData[i] = Me({
1290
+ reference: t.rects.reference,
1291
+ element: t.rects.popper,
1292
+ strategy: "absolute",
1293
+ placement: t.placement
1294
+ });
1295
+ }
1296
+ const io = {
1297
+ name: "popperOffsets",
1298
+ enabled: !0,
1299
+ phase: "read",
1300
+ fn: eo,
1301
+ data: {}
1302
+ };
1303
+ function no(e) {
1304
+ return e === "x" ? "y" : "x";
1305
+ }
1306
+ function oo(e) {
1307
+ var t = e.state, i = e.options, n = e.name, o = i.mainAxis, s = o === void 0 ? !0 : o, a = i.altAxis, r = a === void 0 ? !1 : a, c = i.boundary, l = i.rootBoundary, h = i.altBoundary, u = i.padding, f = i.tether, d = f === void 0 ? !0 : f, y = i.tetherOffset, g = y === void 0 ? 0 : y, v = xt(t, {
1308
+ boundary: c,
1309
+ rootBoundary: l,
1310
+ padding: u,
1311
+ altBoundary: h
1312
+ }), x = G(t.placement), C = dt(t.placement), O = !C, b = $t(x), w = no(b), m = t.modifiersData.popperOffsets, I = t.rects.reference, E = t.rects.popper, S = typeof g == "function" ? g(Object.assign({}, t.rects, {
1313
+ placement: t.placement
1314
+ })) : g, Y = typeof S == "number" ? {
1315
+ mainAxis: S,
1316
+ altAxis: S
1317
+ } : Object.assign({
1318
+ mainAxis: 0,
1319
+ altAxis: 0
1320
+ }, S), X = t.modifiersData.offset ? t.modifiersData.offset[t.placement] : null, W = {
1321
+ x: 0,
1322
+ y: 0
1323
+ };
1324
+ if (m) {
1325
+ if (s) {
1326
+ var L, U = b === "y" ? k : M, K = b === "y" ? N : $, P = b === "y" ? "height" : "width", H = m[b], rt = H + v[U], q = H - v[K], at = d ? -E[P] / 2 : 0, ut = C === ct ? I[P] : E[P], Q = C === ct ? -E[P] : -I[P], _ = t.elements.arrow, j = d && _ ? Nt(_) : {
1327
+ width: 0,
1328
+ height: 0
1329
+ }, V = t.modifiersData["arrow#persistent"] ? t.modifiersData["arrow#persistent"].padding : Pe(), tt = V[U], it = V[K], F = yt(0, I[P], j[P]), pt = O ? I[P] / 2 - at - F - tt - Y.mainAxis : ut - F - tt - Y.mainAxis, ft = O ? -I[P] / 2 + at + F + it + Y.mainAxis : Q + F + it + Y.mainAxis, mt = t.elements.arrow && Ct(t.elements.arrow), Tt = mt ? b === "y" ? mt.clientTop || 0 : mt.clientLeft || 0 : 0, Gt = (L = X == null ? void 0 : X[b]) != null ? L : 0, We = H + pt - Gt - Tt, He = H + ft - Gt, zt = yt(d ? Xt(rt, We) : rt, H, d ? ot(q, He) : q);
1330
+ m[b] = zt, W[b] = zt - H;
1331
+ }
1332
+ if (r) {
1333
+ var Ut, Be = b === "x" ? k : M, Ze = b === "x" ? N : $, nt = m[w], Ot = w === "y" ? "height" : "width", Kt = nt + v[Be], qt = nt - v[Ze], At = [k, M].indexOf(x) !== -1, Jt = (Ut = X == null ? void 0 : X[w]) != null ? Ut : 0, Qt = At ? Kt : nt - I[Ot] - E[Ot] - Jt + Y.altAxis, _t = At ? nt + I[Ot] + E[Ot] - Jt - Y.altAxis : qt, te = d && At ? Rn(Qt, nt, _t) : yt(d ? Qt : Kt, nt, d ? _t : qt);
1334
+ m[w] = te, W[w] = te - nt;
1335
+ }
1336
+ t.modifiersData[n] = W;
1337
+ }
1338
+ }
1339
+ const so = {
1340
+ name: "preventOverflow",
1341
+ enabled: !0,
1342
+ phase: "main",
1343
+ fn: oo,
1344
+ requiresIfExists: ["offset"]
1345
+ };
1346
+ function ro(e) {
1347
+ return {
1348
+ scrollLeft: e.scrollLeft,
1349
+ scrollTop: e.scrollTop
1350
+ };
1351
+ }
1352
+ function ao(e) {
1353
+ return e === Z(e) || !D(e) ? Vt(e) : ro(e);
1354
+ }
1355
+ function co(e) {
1356
+ var t = e.getBoundingClientRect(), i = lt(t.width) / e.offsetWidth || 1, n = lt(t.height) / e.offsetHeight || 1;
1357
+ return i !== 1 || n !== 1;
1358
+ }
1359
+ function lo(e, t, i) {
1360
+ i === void 0 && (i = !1);
1361
+ var n = D(t), o = D(t) && co(t), s = et(t), a = ht(e, o, i), r = {
1362
+ scrollLeft: 0,
1363
+ scrollTop: 0
1364
+ }, c = {
1365
+ x: 0,
1366
+ y: 0
1367
+ };
1368
+ return (n || !n && !i) && ((z(t) !== "body" || // https://github.com/popperjs/popper-core/issues/1078
1369
+ Ft(s)) && (r = ao(t)), D(t) ? (c = ht(t, !0), c.x += t.clientLeft, c.y += t.clientTop) : s && (c.x = jt(s))), {
1370
+ x: a.left + r.scrollLeft - c.x,
1371
+ y: a.top + r.scrollTop - c.y,
1372
+ width: a.width,
1373
+ height: a.height
1374
+ };
1375
+ }
1376
+ function ho(e) {
1377
+ var t = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Set(), n = [];
1378
+ e.forEach(function(s) {
1379
+ t.set(s.name, s);
1380
+ });
1381
+ function o(s) {
1382
+ i.add(s.name);
1383
+ var a = [].concat(s.requires || [], s.requiresIfExists || []);
1384
+ a.forEach(function(r) {
1385
+ if (!i.has(r)) {
1386
+ var c = t.get(r);
1387
+ c && o(c);
1388
+ }
1389
+ }), n.push(s);
1390
+ }
1391
+ return e.forEach(function(s) {
1392
+ i.has(s.name) || o(s);
1393
+ }), n;
1394
+ }
1395
+ function uo(e) {
1396
+ var t = ho(e);
1397
+ return In.reduce(function(i, n) {
1398
+ return i.concat(t.filter(function(o) {
1399
+ return o.phase === n;
1400
+ }));
1401
+ }, []);
1402
+ }
1403
+ function po(e) {
1404
+ var t;
1405
+ return function() {
1406
+ return t || (t = new Promise(function(i) {
1407
+ Promise.resolve().then(function() {
1408
+ t = void 0, i(e());
1409
+ });
1410
+ })), t;
1411
+ };
1412
+ }
1413
+ function fo(e) {
1414
+ var t = e.reduce(function(i, n) {
1415
+ var o = i[n.name];
1416
+ return i[n.name] = o ? Object.assign({}, o, n, {
1417
+ options: Object.assign({}, o.options, n.options),
1418
+ data: Object.assign({}, o.data, n.data)
1419
+ }) : n, i;
1420
+ }, {});
1421
+ return Object.keys(t).map(function(i) {
1422
+ return t[i];
1423
+ });
1424
+ }
1425
+ var Ie = {
1426
+ placement: "bottom",
1427
+ modifiers: [],
1428
+ strategy: "absolute"
1429
+ };
1430
+ function Ce() {
1431
+ for (var e = arguments.length, t = new Array(e), i = 0; i < e; i++)
1432
+ t[i] = arguments[i];
1433
+ return !t.some(function(n) {
1434
+ return !(n && typeof n.getBoundingClientRect == "function");
1435
+ });
1436
+ }
1437
+ function mo(e) {
1438
+ e === void 0 && (e = {});
1439
+ var t = e, i = t.defaultModifiers, n = i === void 0 ? [] : i, o = t.defaultOptions, s = o === void 0 ? Ie : o;
1440
+ return function(r, c, l) {
1441
+ l === void 0 && (l = s);
1442
+ var h = {
1443
+ placement: "bottom",
1444
+ orderedModifiers: [],
1445
+ options: Object.assign({}, Ie, s),
1446
+ modifiersData: {},
1447
+ elements: {
1448
+ reference: r,
1449
+ popper: c
1450
+ },
1451
+ attributes: {},
1452
+ styles: {}
1453
+ }, u = [], f = !1, d = {
1454
+ state: h,
1455
+ setOptions: function(x) {
1456
+ var C = typeof x == "function" ? x(h.options) : x;
1457
+ g(), h.options = Object.assign({}, s, h.options, C), h.scrollParents = {
1458
+ reference: st(r) ? bt(r) : r.contextElement ? bt(r.contextElement) : [],
1459
+ popper: bt(c)
1460
+ };
1461
+ var O = uo(fo([].concat(n, h.options.modifiers)));
1462
+ return h.orderedModifiers = O.filter(function(b) {
1463
+ return b.enabled;
1464
+ }), y(), d.update();
1465
+ },
1466
+ // Sync update – it will always be executed, even if not necessary. This
1467
+ // is useful for low frequency updates where sync behavior simplifies the
1468
+ // logic.
1469
+ // For high frequency updates (e.g. `resize` and `scroll` events), always
1470
+ // prefer the async Popper#update method
1471
+ forceUpdate: function() {
1472
+ if (!f) {
1473
+ var x = h.elements, C = x.reference, O = x.popper;
1474
+ if (Ce(C, O)) {
1475
+ h.rects = {
1476
+ reference: lo(C, Ct(O), h.options.strategy === "fixed"),
1477
+ popper: Nt(O)
1478
+ }, h.reset = !1, h.placement = h.options.placement, h.orderedModifiers.forEach(function(Y) {
1479
+ return h.modifiersData[Y.name] = Object.assign({}, Y.data);
1480
+ });
1481
+ for (var b = 0; b < h.orderedModifiers.length; b++) {
1482
+ if (h.reset === !0) {
1483
+ h.reset = !1, b = -1;
1484
+ continue;
1485
+ }
1486
+ var w = h.orderedModifiers[b], m = w.fn, I = w.options, E = I === void 0 ? {} : I, S = w.name;
1487
+ typeof m == "function" && (h = m({
1488
+ state: h,
1489
+ options: E,
1490
+ name: S,
1491
+ instance: d
1492
+ }) || h);
1493
+ }
1494
+ }
1495
+ }
1496
+ },
1497
+ // Async and optimistically optimized update – it will not be executed if
1498
+ // not necessary (debounced to run at most once-per-tick)
1499
+ update: po(function() {
1500
+ return new Promise(function(v) {
1501
+ d.forceUpdate(), v(h);
1502
+ });
1503
+ }),
1504
+ destroy: function() {
1505
+ g(), f = !0;
1506
+ }
1507
+ };
1508
+ if (!Ce(r, c))
1509
+ return d;
1510
+ d.setOptions(l).then(function(v) {
1511
+ !f && l.onFirstUpdate && l.onFirstUpdate(v);
1512
+ });
1513
+ function y() {
1514
+ h.orderedModifiers.forEach(function(v) {
1515
+ var x = v.name, C = v.options, O = C === void 0 ? {} : C, b = v.effect;
1516
+ if (typeof b == "function") {
1517
+ var w = b({
1518
+ state: h,
1519
+ name: x,
1520
+ instance: d,
1521
+ options: O
1522
+ }), m = function() {
1523
+ };
1524
+ u.push(w || m);
1525
+ }
1526
+ });
1527
+ }
1528
+ function g() {
1529
+ u.forEach(function(v) {
1530
+ return v();
1531
+ }), u = [];
1532
+ }
1533
+ return d;
1534
+ };
1535
+ }
1536
+ var vo = [Bn, io, Wn, En, to, Kn, so, Tn, Jn], go = /* @__PURE__ */ mo({
1537
+ defaultModifiers: vo
1538
+ });
1539
+ class yo {
1540
+ constructor(t, i, n) {
1541
+ ee(this, "updateHotspotPosition", (t, i) => {
1542
+ this.currentActiveIndex = t, this.currentOrientation = i;
1543
+ const n = on(this.hotspotsConfig, t, i);
1544
+ this.hideHotspots(), n.forEach((o) => this.updateAndShowHotspot(o, t));
1545
+ });
1546
+ this.container = i, this.popper = null, this.popperInstance = null, this.hotspotsContainer = Mi(this.container), this.hotspotsConfig = ln(t), this.shouldHidePopper = !0, this.hidePopper = this.hidePopper.bind(this), this.imageAspectRatio = n;
1547
+ const { containerSize: o } = t[0];
1548
+ this.initialContainerSize = o || [i.offsetWidth, i.offsetHeight], this.initHotspots(), this.observeContainerResize();
1549
+ }
1550
+ observeContainerResize() {
1551
+ this.resizeObserver = new ResizeObserver(() => {
1552
+ const t = this.container.offsetWidth, i = this.container.offsetHeight;
1553
+ this.updateHotspotsForResize(t, i);
1554
+ }), this.resizeObserver.observe(this.container);
1555
+ }
1556
+ updateHotspotsForResize(t, i) {
1557
+ this.hotspotsConfig = hn({
1558
+ newWidth: t,
1559
+ newHeight: i,
1560
+ initialContainerSize: this.initialContainerSize,
1561
+ imageAspectRatio: this.imageAspectRatio,
1562
+ hotspotsConfig: this.hotspotsConfig
1563
+ }), this.updateHotspotPosition(this.currentActiveIndex, this.currentOrientation);
1564
+ }
1565
+ showPopper({ hotspotElement: t, content: i, id: n, keepOpen: o }) {
1566
+ this.popperInstance && this.popperInstance.instanceId !== n && this.hidePopper();
1567
+ const s = {
1568
+ placement: "top",
1569
+ modifiers: an(this.container)
1570
+ };
1571
+ this.popper = cn(i, n), this.popper.setAttribute("data-show", ""), this.popper.addEventListener("mouseenter", () => {
1572
+ this.shouldHidePopper = !1;
1573
+ }), this.popper.addEventListener("mouseleave", () => {
1574
+ this.shouldHidePopper = !0, this.checkAndHidePopper();
1575
+ }), t.addEventListener("mouseleave", () => {
1576
+ this.shouldHidePopper = !0, this.checkAndHidePopper();
1577
+ }), t.addEventListener("mouseenter", () => {
1578
+ this.shouldHidePopper = !1, this.hidePopperTimeout && clearTimeout(this.hidePopperTimeout);
1579
+ }), this.popperInstance = {
1580
+ ...go(t, this.popper, s),
1581
+ keepOpen: o,
1582
+ instanceId: n
1583
+ };
1584
+ }
1585
+ checkAndHidePopper() {
1586
+ var t;
1587
+ this.shouldHidePopper && !((t = this.popperInstance) != null && t.keepOpen) && (this.hidePopperTimeout = setTimeout(() => {
1588
+ this.shouldHidePopper && this.hidePopper();
1589
+ }, 150));
1590
+ }
1591
+ hidePopper() {
1592
+ this.popperInstance && (this.popperInstance.destroy(), this.popperInstance = null), this.popper && (this.popper.removeAttribute("data-show"), setTimeout(() => {
1593
+ this.popper && this.popper.remove(), this.popper = null;
1594
+ }, 200));
1595
+ }
1596
+ createHotspot(t) {
1597
+ const { id: i, content: n, keepOpen: o, onClick: s } = t, a = sn(i);
1598
+ s && (a.style.cursor = "pointer"), a.onclick = (r) => {
1599
+ r.stopPropagation(), s == null || s(r, this.popperInstance, i);
1600
+ }, n && a.addEventListener(
1601
+ "mouseenter",
1602
+ () => this.showPopper({ hotspotElement: a, content: n, id: i, keepOpen: o })
1603
+ ), this.hotspotsContainer.appendChild(a);
1604
+ }
1605
+ hideHotspots() {
1606
+ this.hotspotsContainer.querySelectorAll(".cloudimage-360-hotspot").forEach((t) => {
1607
+ t.style.opacity = 0, t.style.pointerEvents = "none";
1608
+ });
1609
+ }
1610
+ updateAndShowHotspot(t, i) {
1611
+ const { positions: n, id: o } = t, { x: s, y: a } = n[i] ?? {}, r = this.hotspotsContainer.querySelector(`[data-hotspot-id="${o}"]`);
1612
+ r && (r.style.translate = `${s}px ${a}px`, r.style.opacity = 1, r.style.pointerEvents = "all");
1613
+ }
1614
+ createAllHotspots() {
1615
+ this.hotspotsConfig.forEach((t) => this.createHotspot(t));
1616
+ }
1617
+ initHotspots() {
1618
+ this.createAllHotspots();
1619
+ }
1620
+ destroy() {
1621
+ this.resizeObserver.disconnect(), this.hidePopper(), this.hotspotsContainer.innerHTML = "";
1622
+ }
1623
+ }
1624
+ class Lt {
1625
+ constructor(t, i, n) {
1626
+ this.container = t, this.isClicked = !1, this.fullscreenView = !!n, this.imagesX = [], this.imagesY = [], this.devicePixelRatio = Math.round(window.devicePixelRatio || 1), this.id = t.id, this.movementStart = { x: 0, y: 0 }, this.draggingDirection = null, this.isReady = !1, this.currentZoomScale = 1, this.touchDevice = Qi(), this.canvasWorker = new en(), this.onMoveHandler = this.onMoveHandler.bind(this), this.destroy = this.destroy.bind(this), this.init(this.container, i);
1627
+ }
1628
+ mouseDown(t) {
1629
+ if (!this.isReady || this.glass) return;
1630
+ const { pageX: i, pageY: n } = t;
1631
+ (this.autoplay || this.loopTimeoutId) && (this.stopAutoplay(), this.autoplay = !1), this.movementStart = { x: i, y: n }, this.isClicked = !0, this.isDragging = !1;
1632
+ }
1633
+ mouseUp() {
1634
+ this.isReady && (this.isZoomed || this.showAllIcons(), this.movementStart = { x: 0, y: 0 }, this.isClicked = !1, this.innerBox.style.cursor = "grab");
1635
+ }
1636
+ drag(t, i) {
1637
+ if (!this.isReady || !this.isClicked) return;
1638
+ const n = t - this.movementStart.x, o = i - this.movementStart.y;
1639
+ this.draggingDirection = Ji({
1640
+ deltaX: n,
1641
+ deltaY: o,
1642
+ reversed: this.dragReverse,
1643
+ allowSpinX: this.allowSpinX,
1644
+ allowSpinY: this.allowSpinY
1645
+ }) || this.draggingDirection;
1646
+ const s = this.fullscreenView ? document.body : this.container, a = this.dragSpeed / 50, r = a * (this.amountX / s.offsetWidth), c = a * (this.amountY / s.offsetHeight), l = this.allowSpinX ? Math.abs(Math.round(n * r)) : 0, h = this.allowSpinY ? Math.abs(Math.round(o * c)) : 0;
1647
+ (this.allowSpinX && l !== 0 || this.allowSpinY && h !== 0) && (this.hideHotspotPopper(), this.onMoveHandler(this.draggingDirection, l, h), this.movementStart = { x: t, y: i }, setTimeout(() => {
1648
+ this.isDragging = !0;
1649
+ }, 150));
1650
+ }
1651
+ mouseMove(t) {
1652
+ !this.isReady || !this.isClicked && !this.isZoomed || this.glass || (this.hideAllIcons(), this.drag(t.pageX, t.pageY), this.isZoomed && this.applyZoom(t));
1653
+ }
1654
+ mouseClick(t) {
1655
+ if (!(!this.isReady || this.isDragging)) {
1656
+ if (this.glass && this.magnified) {
1657
+ this.removeGlass();
1658
+ return;
1659
+ }
1660
+ this.pointerZoom && !this.glass && !this.touchDevice && this.toggleZoom(t);
1661
+ }
1662
+ }
1663
+ loadHigherQualityImages(t, i) {
1664
+ const n = gt(this.srcXConfig, t), o = this.allowSpinY ? gt(this.srcYConfig, t) : null;
1665
+ ae({
1666
+ cdnPathX: n,
1667
+ cdnPathY: o,
1668
+ configX: this.srcXConfig,
1669
+ configY: this.srcYConfig,
1670
+ onAllImagesLoad: (s, a) => {
1671
+ this.imagesX = s, this.imagesY = a, i();
1672
+ }
1673
+ });
1674
+ }
1675
+ hideHotspots() {
1676
+ this.hotspotsInstance && this.hotspotsInstance.hideHotspots();
1677
+ }
1678
+ hideHotspotPopper() {
1679
+ this.hotspotsInstance && this.hotspotsInstance.hidePopper();
1680
+ }
1681
+ toggleZoom(t) {
1682
+ if (this.isZoomed)
1683
+ this.showTransitionOverlay(), setTimeout(() => {
1684
+ this.removeZoom();
1685
+ }, 800);
1686
+ else {
1687
+ let i = (this.fullscreenView || this.pointerZoom ? document.body : this.container).offsetWidth;
1688
+ this.hideHotspots(), this.showLoadingSpinner(), this.loadHigherQualityImages(i, () => {
1689
+ this.showTransitionOverlay(), setTimeout(() => {
1690
+ this.applyZoom(t);
1691
+ }, 800);
1692
+ });
1693
+ }
1694
+ }
1695
+ removeZoom() {
1696
+ this.isZoomed = !1, this.updateView(), this.showAllIcons(), this.hideTransitionOverlay();
1697
+ }
1698
+ applyZoom(t) {
1699
+ const { offsetX: i, offsetY: n } = Fi(t, this.canvas, this.devicePixelRatio);
1700
+ this.isZoomed = !0, this.hideAllIcons(), this.hideLoadingSpinner(), this.hideTransitionOverlay(), this.updateView(this.pointerZoom, i, n);
1701
+ }
1702
+ touchOutside(t) {
1703
+ if (!this.glass) return;
1704
+ !this.canvas.contains(t.target) && this.removeGlass();
1705
+ }
1706
+ touchStart(t) {
1707
+ if (!this.isReady || t.touches.length > 1 || this.glass) return;
1708
+ const { pageX: i, pageY: n } = t.touches[0];
1709
+ (this.autoplay || this.loopTimeoutId) && (this.stopAutoplay(), this.autoplay = !1), this.hideAllIcons(), this.movementStart = { x: i, y: n }, this.isClicked = !0;
1710
+ }
1711
+ touchEnd() {
1712
+ this.isReady && (this.showAllIcons(), this.movementStart = { x: 0, y: 0 }, this.isClicked = !1);
1713
+ }
1714
+ touchMove(t) {
1715
+ if (!this.isReady || !this.isClicked || this.glass) return;
1716
+ const { pageX: i, pageY: n } = t.touches[0];
1717
+ t.preventDefault(), this.drag(i, n);
1718
+ }
1719
+ keyDown(t) {
1720
+ if (!this.isReady) return;
1721
+ const { keyCode: i } = t, n = this.keysReverse;
1722
+ switch (this.autoplay && this.stopAutoplay(), pe(i, this.allowSpinY) && this.hideAllIcons(), i) {
1723
+ case 37:
1724
+ n ? this.moveLeft() : this.moveRight();
1725
+ break;
1726
+ case 39:
1727
+ n ? this.moveRight() : this.moveLeft();
1728
+ break;
1729
+ case 38:
1730
+ this.allowSpinY && (t.preventDefault(), n ? this.moveTop() : this.moveBottom());
1731
+ break;
1732
+ case 40:
1733
+ this.allowSpinY && (t.preventDefault(), n ? this.moveBottom() : this.moveTop());
1734
+ break;
1735
+ }
1736
+ }
1737
+ keyUp(t) {
1738
+ const { keyCode: i } = t;
1739
+ pe(i, this.allowSpinY) && this.showAllIcons();
1740
+ }
1741
+ moveActiveXIndexUp(t) {
1742
+ this.orientation = A.X, this.activeImageX = (this.activeImageX + t) % this.amountX;
1743
+ }
1744
+ moveActiveXIndexDown(t) {
1745
+ this.orientation = A.X, this.activeImageX = (this.activeImageX - t + this.amountX) % this.amountX;
1746
+ }
1747
+ moveActiveYIndexUp(t) {
1748
+ this.orientation = A.Y, this.activeImageY = (this.activeImageY + t) % this.amountY;
1749
+ }
1750
+ moveActiveYIndexDown(t) {
1751
+ this.orientation = A.Y, this.activeImageY = (this.activeImageY - t + this.amountY) % this.amountY;
1752
+ }
1753
+ moveRight(t, i = 1) {
1754
+ t && this.activeImageX >= this.imagesX.length - 1 || (this.moveActiveXIndexUp(i), this.isZoomed || this.updateView());
1755
+ }
1756
+ moveLeft(t, i = 1) {
1757
+ t && this.activeImageX <= 0 || (this.moveActiveXIndexDown(i), this.isZoomed || this.updateView());
1758
+ }
1759
+ moveTop(t, i = 1) {
1760
+ t && this.activeImageY >= this.imagesY.length - 1 || (this.moveActiveYIndexUp(i), this.isZoomed || this.updateView());
1761
+ }
1762
+ moveBottom(t, i = 1) {
1763
+ t && this.activeImageY <= 0 || (this.moveActiveYIndexDown(i), this.isZoomed || this.updateView());
1764
+ }
1765
+ onMoveHandler(t, i = 1, n = 1) {
1766
+ t === "right" ? this.moveRight(this.stopAtEdges, i) : t === "left" ? this.moveLeft(this.stopAtEdges, i) : t === "up" ? this.moveTop(this.stopAtEdges, n) : t === "down" && this.moveBottom(this.stopAtEdges, n);
1767
+ }
1768
+ updateView(t, i, n) {
1769
+ const o = this.orientation === A.X ? this.activeImageX : this.activeImageY, s = this.orientation === A.X ? this.imagesX[this.activeImageX] : this.imagesY[this.activeImageY];
1770
+ this.hotspotsInstance && !this.isZoomed && !this.autoplay && this.hotspotsInstance.updateHotspotPosition(o, this.orientation), this.drawImageOnCanvas(s, t, i, n);
1771
+ }
1772
+ updatePercentageInLoader(t = 0) {
1773
+ this.loader && (this.loader.innerText = t + "%");
1774
+ }
1775
+ adaptCanvasSize(t) {
1776
+ const { naturalWidth: i, naturalHeight: n } = t;
1777
+ this.imageAspectRatio = i / n;
1778
+ const o = this.fullscreenView ? window.innerWidth : this.canvas.clientWidth, s = this.fullscreenView ? window.innerHeight : this.canvas.clientHeight;
1779
+ this.canvasWorker.postMessage({
1780
+ action: "adaptCanvasSize",
1781
+ devicePixelRatio: this.devicePixelRatio,
1782
+ imageAspectRatio: this.imageAspectRatio,
1783
+ containerWidth: o,
1784
+ containerHeight: s
1785
+ });
1786
+ }
1787
+ drawImageOnCanvas(t, i = 1, n = 0, o = 0) {
1788
+ this.canvasWorker.postMessage({
1789
+ action: "drawImageOnCanvas",
1790
+ imageData: t,
1791
+ zoomScale: i,
1792
+ pointerX: n,
1793
+ pointerY: o
1794
+ });
1795
+ }
1796
+ pushImageToSet(t, i, n) {
1797
+ n === A.X ? this.imagesX[i] = t : this.imagesY[i] = t;
1798
+ }
1799
+ calculatePercentage() {
1800
+ const t = this.amountX + this.amountY, i = this.imagesX.length + this.imagesY.length;
1801
+ return Math.round(i / t * 100);
1802
+ }
1803
+ onImageLoad(t, i, n) {
1804
+ this.pushImageToSet(t, i, n), this.updatePercentageInLoader(this.calculatePercentage());
1805
+ }
1806
+ onFirstImageLoaded(t, i) {
1807
+ this.createContainers(t), this.adaptCanvasSize(i), this.drawImageOnCanvas(i);
1808
+ }
1809
+ onAllImagesLoaded() {
1810
+ this.addAllIcons(), this.hotspots && (this.hotspotsInstance = new yo(this.hotspots, this.innerBox, this.imageAspectRatio)), this.isReady = !0, this.amountX = this.imagesX.length, this.amountY = this.imagesY.length, this.activeImageX = this.autoplayReverse ? this.amountX - 1 : 0, this.activeImageY = this.autoplayReverse ? this.amountY - 1 : 0, this.autoplay && (this.hideAllIcons(), _i(this.play.bind(this))());
1811
+ }
1812
+ magnify(t) {
1813
+ t.stopPropagation();
1814
+ const { src: i } = this.orientation === A.Y ? this.imagesY[this.activeImageY] : this.imagesX[this.activeImageX], o = (this.fullscreenView ? document.body : this.container).offsetWidth * this.magnifier, s = yi(i, o);
1815
+ this.showLoadingSpinner(), this.createGlass(), $i(s, (r) => {
1816
+ this.hideLoadingSpinner(), this.magnified = !0, ji(t, this.innerBox, this.offset, r, this.glass, this.magnifier);
1817
+ });
1818
+ }
1819
+ openFullscreenModal(t) {
1820
+ t.stopPropagation();
1821
+ const i = Ti(this.container);
1822
+ new Lt(i, this.viewerConfig, !0);
1823
+ }
1824
+ closeFullscreenModal(t) {
1825
+ t.stopPropagation(), document.body.removeChild(this.container.parentNode), window.document.body.style.overflow = "visible";
1826
+ }
1827
+ play() {
1828
+ if (this.isClicked) return;
1829
+ this.hide360ViewCircleIcon();
1830
+ const t = this.speed * 36 / (this.amountX + this.amountY), i = {
1831
+ left: this.moveLeft.bind(this),
1832
+ right: this.moveRight.bind(this),
1833
+ top: this.moveTop.bind(this),
1834
+ bottom: this.moveBottom.bind(this)
1835
+ };
1836
+ this.loopTimeoutId = window.setInterval(() => {
1837
+ if (this.playOnce && zi({
1838
+ autoplayBehavior: this.autoplayBehavior,
1839
+ activeImageX: this.activeImageX,
1840
+ activeImageY: this.activeImageY,
1841
+ amountX: this.amountX,
1842
+ amountY: this.amountY,
1843
+ autoplayReverse: this.autoplayReverse
1844
+ })) {
1845
+ this.stopAutoplay();
1846
+ return;
1847
+ }
1848
+ Ui({
1849
+ autoplayBehavior: this.autoplayBehavior,
1850
+ activeImageX: this.activeImageX,
1851
+ activeImageY: this.activeImageY,
1852
+ amountX: this.amountX,
1853
+ amountY: this.amountY,
1854
+ autoplayReverse: this.autoplayReverse,
1855
+ spinDirection: this.spinDirection
1856
+ }) && (this.spinDirection = qi(this.spinDirection));
1857
+ const s = this.spinDirection === "y";
1858
+ Gi({
1859
+ autoplayBehavior: this.autoplayBehavior,
1860
+ spinY: s,
1861
+ reversed: this.autoplayReverse,
1862
+ loopTriggers: i
1863
+ });
1864
+ }, t);
1865
+ }
1866
+ stopAutoplay() {
1867
+ this.showAllIcons(), this.autoplay = !1, window.clearTimeout(this.loopTimeoutId);
1868
+ }
1869
+ destroy() {
1870
+ this.stopAutoplay(), this.hotspotsInstance && this.hotspotsInstance.destroy();
1871
+ const t = this.container, i = t.cloneNode(!0), n = i.querySelector(".cloudimage-360-inner-box");
1872
+ i.removeChild(n), t.parentNode.replaceChild(i, t);
1873
+ }
1874
+ addInitialIcon() {
1875
+ this.initialIcon || (this.initialIcon = Ii(), this.innerBox.appendChild(this.initialIcon));
1876
+ }
1877
+ showInitialIcon() {
1878
+ this.initialIcon && (this.initialIcon.style.opacity = 1);
1879
+ }
1880
+ hideInitialIcon() {
1881
+ this.initialIcon && (this.initialIcon.style.opacity = 0);
1882
+ }
1883
+ createGlass() {
1884
+ this.hideAllIcons(), this.glass = document.createElement("div"), this.innerBox.appendChild(this.glass), this.innerBox.style.cursor = "default";
1885
+ }
1886
+ removeGlass() {
1887
+ this.showAllIcons(), this.innerBox.removeChild(this.glass), this.glass = null, this.magnified = !1;
1888
+ }
1889
+ addMagnifierIcon() {
1890
+ this.magnifier && (this.magnifierIcon = Li(), this.magnifierIcon.onclick = this.magnify.bind(this), this.iconsContainer.appendChild(this.magnifierIcon));
1891
+ }
1892
+ showMagnifierIcon() {
1893
+ this.magnifierIcon && (this.magnifierIcon.style.visibility = "visible", this.magnifierIcon.style.opacity = 1);
1894
+ }
1895
+ hideMagnifierIcon() {
1896
+ this.magnifierIcon && (this.magnifierIcon.style.visibility = "hidden", this.magnifierIcon.style.opacity = 0);
1897
+ }
1898
+ addFullscreenIcon() {
1899
+ this.fullscreen && (this.fullscreenIcon = Yi(), this.fullscreenIcon.onclick = this.openFullscreenModal.bind(this), this.iconsContainer.appendChild(this.fullscreenIcon));
1900
+ }
1901
+ addCloseFullscreenIcon() {
1902
+ this.fullscreenCloseIcon = Ei(), this.fullscreenCloseIcon.onclick = this.closeFullscreenModal.bind(this), this.iconsContainer.appendChild(this.fullscreenCloseIcon);
1903
+ }
1904
+ showFullscreenIcon() {
1905
+ this.fullscreenIcon && (this.fullscreenIcon.style.opacity = 1);
1906
+ }
1907
+ hideFullscreenIcon() {
1908
+ this.fullscreenIcon && (this.fullscreenIcon.style.opacity = 0);
1909
+ }
1910
+ add360ViewCircleIcon() {
1911
+ this.view360CircleIcon || (this.view360CircleIcon = xi(this.bottomCircleOffset), this.innerBox.appendChild(this.view360CircleIcon));
1912
+ }
1913
+ show360ViewCircleIcon() {
1914
+ this.view360CircleIcon && (this.view360CircleIcon.style.opacity = 1);
1915
+ }
1916
+ hide360ViewCircleIcon() {
1917
+ this.view360CircleIcon && (this.view360CircleIcon.style.opacity = 0);
1918
+ }
1919
+ addLoadingSpinner() {
1920
+ this.loadingSpinner = Ai(), this.innerBox.appendChild(this.loadingSpinner);
1921
+ }
1922
+ showLoadingSpinner() {
1923
+ this.loadingSpinner && (this.hideAllIcons(), this.loadingSpinner.style.opacity = 1);
1924
+ }
1925
+ createTransitionOverlay() {
1926
+ this.transitionOverlay = ki(), this.innerBox.appendChild(this.transitionOverlay);
1927
+ }
1928
+ showTransitionOverlay() {
1929
+ this.transitionOverlay && (this.hideAllIcons(), this.transitionOverlay.style.opacity = 1);
1930
+ }
1931
+ hideTransitionOverlay() {
1932
+ this.transitionOverlay && (this.transitionOverlay.style.opacity = 0);
1933
+ }
1934
+ hideLoadingSpinner() {
1935
+ this.loadingSpinner && (this.loadingSpinner.style.opacity = 0);
1936
+ }
1937
+ remove360ViewCircleIcon() {
1938
+ this.view360CircleIcon && (this.innerBox.removeChild(this.view360CircleIcon), this.view360CircleIcon = null);
1939
+ }
1940
+ addAllIcons() {
1941
+ this.removeLoader(), this.innerBox.style.cursor = "grab", this.pointerZoom && (this.createTransitionOverlay(), this.addLoadingSpinner()), !this.fullscreenView && !this.touchDevice && this.addMagnifierIcon(), this.fullscreenView || this.addFullscreenIcon(), this.initialIconShown && this.addInitialIcon(), this.bottomCircle || this.add360ViewCircleIcon();
1942
+ }
1943
+ showAllIcons() {
1944
+ this.showInitialIcon(), this.show360ViewCircleIcon(), this.showMagnifierIcon(), this.showFullscreenIcon();
1945
+ }
1946
+ hideAllIcons() {
1947
+ this.hideInitialIcon(), this.hide360ViewCircleIcon(), this.hideMagnifierIcon(), this.hideFullscreenIcon();
1948
+ }
1949
+ removeLoader() {
1950
+ this.loader && (this.innerBox.removeChild(this.loader), this.loader = null);
1951
+ }
1952
+ attachEvents(t, i, n) {
1953
+ t && this.addMouseEvents(), i && this.addTouchEvents(), n && this.addKeyboardEvents();
1954
+ }
1955
+ removeEvents() {
1956
+ this.removeMouseEvents(), this.removeTouchEvents(), this.removeKeyboardEvents();
1957
+ }
1958
+ addMouseEvents() {
1959
+ this.boundMouseClick = this.mouseClick.bind(this), this.boundMouseDown = this.mouseDown.bind(this), this.boundMouseMove = oe(this.mouseMove.bind(this), se), this.boundMouseUp = this.mouseUp.bind(this), this.innerBox.addEventListener("click", this.boundMouseClick), this.innerBox.addEventListener("mousedown", this.boundMouseDown), document.addEventListener("mousemove", this.boundMouseMove), document.addEventListener("mouseup", this.boundMouseUp);
1960
+ }
1961
+ addTouchEvents() {
1962
+ this.boundTouchOutside = this.touchOutside.bind(this), this.boundTouchStart = this.touchStart.bind(this), this.boundTouchEnd = this.touchEnd.bind(this), this.boundTouchMove = oe(this.touchMove.bind(this), se), document.addEventListener("touchstart", this.boundTouchOutside), this.container.addEventListener("touchstart", this.boundTouchStart), this.container.addEventListener("touchend", this.boundTouchEnd), this.container.addEventListener("touchmove", this.boundTouchMove);
1963
+ }
1964
+ addKeyboardEvents() {
1965
+ this.boundKeyDown = this.keyDown.bind(this), this.boundKeyUp = this.keyUp.bind(this), document.addEventListener("keydown", this.boundKeyDown), document.addEventListener("keyup", this.boundKeyUp);
1966
+ }
1967
+ removeMouseEvents() {
1968
+ this.innerBox.removeEventListener("click", this.boundMouseClick), this.innerBox.removeEventListener("mousedown", this.boundMouseDown), document.removeEventListener("mousemove", this.boundMouseMove), document.removeEventListener("mouseup", this.boundMouseUp);
1969
+ }
1970
+ removeTouchEvents() {
1971
+ document.removeEventListener("touchstart", this.boundTouchOutside), this.container.removeEventListener("touchstart", this.boundTouchStart), this.container.removeEventListener("touchend", this.boundTouchEnd), this.container.removeEventListener("touchmove", this.boundTouchMove);
1972
+ }
1973
+ removeKeyboardEvents() {
1974
+ document.removeEventListener("keydown", this.boundKeyDown), document.removeEventListener("keyup", this.boundKeyUp);
1975
+ }
1976
+ createContainers(t) {
1977
+ this.iconsContainer = ce(this.innerBox), this.canvas = Ci(this.innerBox, t), this.loader = Pi(this.innerBox);
1978
+ const i = this.canvas.transferControlToOffscreen();
1979
+ this.canvasWorker.postMessage(
1980
+ {
1981
+ action: "initCanvas",
1982
+ offscreen: i,
1983
+ devicePixelRatio: this.devicePixelRatio
1984
+ },
1985
+ [i]
1986
+ ), this.fullscreenView && this.addCloseFullscreenIcon(), Wt(this.innerBox, ".cloudimage-360-placeholder");
1987
+ }
1988
+ update(t) {
1989
+ this.isReady && (this.stopAutoplay(), Wt(this.innerBox, ".cloudimage-360-icons-container"), this.init(this.container, t, !0), this.iconsContainer = ce(this.innerBox), this.onAllImagesLoaded());
1990
+ }
1991
+ init(t, i, n) {
1992
+ const o = i ? ui(i) : di(t), {
1993
+ folder: s,
1994
+ apiVersion: a,
1995
+ filenameX: r,
1996
+ filenameY: c,
1997
+ imageListX: l,
1998
+ imageListY: h,
1999
+ indexZeroBase: u,
2000
+ amountX: f,
2001
+ amountY: d,
2002
+ draggable: y = !0,
2003
+ swipeable: g = !0,
2004
+ keys: v,
2005
+ keysReverse: x,
2006
+ bottomCircleOffset: C,
2007
+ autoplay: O,
2008
+ autoplayBehavior: b,
2009
+ playOnce: w,
2010
+ speed: m,
2011
+ autoplayReverse: I,
2012
+ fullscreen: E,
2013
+ magnifier: S,
2014
+ ciToken: Y,
2015
+ ciFilters: X,
2016
+ ciTransformation: W,
2017
+ lazyload: L,
2018
+ dragSpeed: U,
2019
+ stopAtEdges: K,
2020
+ pointerZoom: P,
2021
+ imageInfo: H = "black",
2022
+ initialIconShown: rt,
2023
+ bottomCircle: q,
2024
+ hotspots: at,
2025
+ dragReverse: ut
2026
+ } = o, Q = { ciToken: Y, ciFilters: X, ciTransformation: W }, _ = l ? JSON.parse(l) : [], j = h ? JSON.parse(h) : [];
2027
+ if (this.viewerConfig = o, this.amountX = _.length || f, this.amountY = j.length || d, this.allowSpinX = !!this.amountX, this.allowSpinY = !!this.amountY, this.activeImageX = I ? this.amountX - 1 : 0, this.activeImageY = I ? this.amountY - 1 : 0, this.bottomCircleOffset = C, this.autoplay = O, this.autoplayBehavior = b, this.playOnce = w, this.speed = m, this.autoplayReverse = I, this.fullscreen = E, this.magnifier = S > 1 ? Math.min(S, 5) : 0, this.dragSpeed = Math.max(U, 50), this.stopAtEdges = K, this.ciParams = Q, this.apiVersion = a, this.pointerZoom = P > 1 ? Math.min(P, 5) : null, this.keysReverse = x, this.info = H, this.keys = v, this.innerBox = this.innerBox ?? Ri(this.container), this.initialIconShown = rt, this.bottomCircle = q, this.spinDirection = Ki(this.autoplayBehavior, this.allowSpinX, this.allowSpinY), this.dragReverse = ut, this.hotspots = at, this.srcXConfig = {
2028
+ folder: s,
2029
+ filename: r,
2030
+ imageList: _,
2031
+ container: t,
2032
+ innerBox: this.innerBox,
2033
+ apiVersion: a,
2034
+ ciParams: Q,
2035
+ lazyload: L,
2036
+ amount: this.amountX,
2037
+ indexZeroBase: u,
2038
+ autoplayReverse: I
2039
+ }, this.srcYConfig = {
2040
+ ...this.srcXConfig,
2041
+ filename: c,
2042
+ imageList: j,
2043
+ orientation: A.Y,
2044
+ amount: this.amountY
2045
+ }, n && this.removeEvents(), this.attachEvents(y, g, v), n) return;
2046
+ const V = (this.fullscreenView ? document.body : this.container).offsetWidth, tt = this.allowSpinX && !_.length ? gt(this.srcXConfig, V) : null, it = this.allowSpinY && !j.length ? gt(this.srcYConfig, V) : null, F = (pt) => {
2047
+ ae({
2048
+ cdnPathX: tt,
2049
+ cdnPathY: it,
2050
+ configX: this.srcXConfig,
2051
+ configY: this.srcYConfig,
2052
+ onImageLoad: (ft, mt, Tt) => this.onImageLoad(ft, mt, Tt),
2053
+ onFirstImageLoad: (ft) => this.onFirstImageLoaded(pt, ft),
2054
+ onAllImagesLoad: this.onAllImagesLoaded.bind(this)
2055
+ });
2056
+ };
2057
+ this.allowSpinX ? he(tt, this.srcXConfig, F) : this.allowSpinY && he(it, this.srcYConfig, F);
2058
+ }
2059
+ }
2060
+ class bo {
2061
+ constructor() {
2062
+ this.views = /* @__PURE__ */ new Map(), this.initAll = this.initAll.bind(this), this.getViews = this.getViews.bind(this);
2063
+ }
2064
+ generateId() {
2065
+ return `ci360-${Math.random().toString(36).slice(2, 11)}`;
2066
+ }
2067
+ init(t, i, n) {
2068
+ if (!t) return;
2069
+ const o = t.id || this.generateId();
2070
+ t.id || (t.id = o);
2071
+ const s = new Lt(t, i, n);
2072
+ return this.views.set(o, s), s;
2073
+ }
2074
+ initAll(t = "cloudimage-360") {
2075
+ [...document.querySelectorAll(`.${t}`)].filter(Boolean).forEach((n) => {
2076
+ const o = n.id || this.generateId();
2077
+ n.id || (n.id = o);
2078
+ const s = new Lt(n);
2079
+ this.views.set(o, s);
2080
+ });
2081
+ }
2082
+ destroy(t) {
2083
+ const i = this.getViewById(t);
2084
+ i && (i.destroy(), this.views.delete(t));
2085
+ }
2086
+ destroyAll() {
2087
+ this.views.forEach((t) => {
2088
+ t.destroy();
2089
+ }), this.views.clear();
2090
+ }
2091
+ getViewById(t) {
2092
+ return this.views.get(t);
2093
+ }
2094
+ getViews() {
2095
+ return Array.from(this.views.values());
2096
+ }
2097
+ updateView(t, i) {
2098
+ const n = this.getViewById(t), o = { ...n.viewerConfig, ...i };
2099
+ if (pi(n.viewerConfig, i)) {
2100
+ n.destroy();
2101
+ const a = document.getElementById(t);
2102
+ this.init(a, o);
2103
+ } else
2104
+ n.update(o);
2105
+ return n;
2106
+ }
2107
+ }
2108
+ window.CI360 = bo;
2109
+ export {
2110
+ bo as default
2111
+ };