js-cloudimage-360-view 4.1.3 → 4.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/js-cloudimage-360-view.min.js +1 -1
- package/dist/react/{ci360-CJCqgguJ.mjs → ci360-CILBSFAa.mjs} +512 -512
- package/dist/react/{ci360-CJCqgguJ.mjs.map → ci360-CILBSFAa.mjs.map} +1 -1
- package/dist/react/{ci360-D8dcdUHo.js → ci360-TSs45Yhc.js} +6 -6
- package/dist/react/{ci360-D8dcdUHo.js.map → ci360-TSs45Yhc.js.map} +1 -1
- package/dist/react/index.cjs +1 -1
- package/dist/react/index.cjs.map +1 -1
- package/dist/react/index.js +185 -155
- package/dist/react/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -32,4 +32,4 @@ var CI360=function(){"use strict";var Jn=Object.defineProperty;var Qn=(q,W,lt)=>
|
|
|
32
32
|
object-fit: contain;
|
|
33
33
|
object-position: center;
|
|
34
34
|
filter: blur(10px);
|
|
35
|
-
`,o},Ee=(e,t,i)=>{const{innerBox:o,imageList:n,lazyload:s}=t||{},[l]=n,r=l||mo(e,t),a=ho(r),c=Oe(a,s,"cloudimage-lazy"),h=Oe(a,!1,"cloudimage-360-placeholder"),u=f=>{$t(o,".cloudimage-lazy"),i&&i({event:f,width:c.width,height:c.height,naturalWidth:c.naturalWidth,naturalHeight:c.naturalHeight,src:a})};c.onload=u,o.appendChild(c),o.appendChild(h),po(c)},vo=(e,t,i)=>{const o=new Image;o.src=e,o.onload=n=>{t&&t({event:n,width:o.width,height:o.height,naturalWidth:o.naturalWidth,naturalHeight:o.naturalHeight,src:e})},o.onerror=n=>{const s=new Error(`Failed to load image: ${e}`);s.url=e,s.event=n,i?i(s):console.error(s.message)}},go=(e,t)=>{const i=t.getBoundingClientRect(),o=e.touches?e.touches[0].clientX:e.clientX,n=e.touches?e.touches[0].clientY:e.clientY;return{x:o-i.left,y:n-i.top}},Ut=(e,t,i)=>{const{container:o,w:n,h:s,zoom:l,bw:r,offsetX:a,offsetY:c}=t,h=go(e,o);let u=h.x,f=h.y;u=Math.max(n/l,Math.min(u,o.offsetWidth-n/l)),f=Math.max(s/l,Math.min(f,o.offsetHeight-s/l)),i.style.left=`${u-n}px`,i.style.top=`${f-s}px`;const p=(u-a)*l-n+r,x=(f-c)*l-s+r;i.style.backgroundPosition=`-${p}px -${x}px`},bo=(e,t,i,o,n,s)=>{const{x:l=0,y:r=0}=i||{},a=(t.offsetWidth-l*2)*s,c=(t.offsetHeight-r*2)*s;if(!n)return;n.setAttribute("class","cloudimage-360-img-magnifier-glass"),t.prepend(n),n.style.backgroundImage=`url('${o.src}')`,n.style.backgroundSize=`${a}px ${c}px`;const h=3,u=n.offsetWidth/2,f=n.offsetHeight/2,p={container:t,w:u,h:f,zoom:s,bw:h,offsetX:l,offsetY:r};Ut(e,p,n);const x=v=>{Ut(v,p,n)},g=v=>{v.preventDefault(),Ut(v,p,n)};n.addEventListener("mousemove",x),t.addEventListener("mousemove",x),t.addEventListener("touchmove",g)},yo=(e,t,i)=>{const{clientX:o,clientY:n}=e,s=t.getBoundingClientRect(),l=t.width/(s.width*i),r=t.height/(s.height*i),a=(o-s.left)*l,c=(n-s.top)*r;return{offsetX:a,offsetY:c}},Se=(e,{bottom:t,top:i})=>{e?t():i()},Ae=(e,{left:t,right:i})=>{e?t():i()},wo=({autoplayBehavior:e,spinY:t,reversed:i,loopTriggers:o})=>{switch(e){case R.SPIN_XY:case R.SPIN_YX:t?Se(i,o):Ae(i,o);break;case R.SPIN_Y:Se(i,o);break;case R.SPIN_X:default:Ae(i,o)}},xo=({autoplayBehavior:e,activeImageX:t,activeImageY:i,amountX:o,amountY:n,autoplayReverse:s})=>{const l=(r,a)=>{const c=a-1;return s?r===0:r===c};switch(e){case R.SPIN_XY:case R.SPIN_Y:return l(i,n);case R.SPIN_X:case R.SPIN_YX:default:return l(t,o)}},Io=({autoplayBehavior:e,activeImageX:t,activeImageY:i,amountX:o,amountY:n,autoplayReverse:s,spinDirection:l})=>{const r=t===(s?0:o-1),a=i===(s?0:n-1);return e===R.SPIN_XY||e===R.SPIN_YX?l==="x"&&r||l==="y"&&a:!1},Co=(e,t,i)=>{if(!i)return"x";if(!t)return"y";switch(e){case R.SPIN_XY:return"x";case R.SPIN_YX:return"y";case R.SPIN_Y:return"y";case R.SPIN_X:default:return"x"}},ko=e=>e==="x"?"y":"x",Le=(e,t)=>{const i=[...yi];return t?[...i,...wi].includes(e):i.includes(e)},Te=({deltaX:e,deltaY:t,reversed:i,allowSpinX:o,allowSpinY:n,threshold:s=0})=>{const l=o&&!n||n&&!o?0:s,r=Math.abs(e),a=Math.abs(t);return o&&r-l>a?i?e>0?"left":"right":e>0?"right":"left":n&&a-l>r?i?t>0?"up":"down":t>0?"down":"up":null},Oo=()=>"ontouchstart"in window||navigator.maxTouchPoints>0||navigator.msMaxTouchPoints>0,Eo=(e,t=150)=>{let i;return function(...o){clearTimeout(i),i=setTimeout(()=>{e.apply(this,o)},t)}},Ye="KGZ1bmN0aW9uKCl7InVzZSBzdHJpY3QiO2NvbnN0IHY9KHQsYSxlKT0+e2NvbnN0IHM9dC9lLG49YS9lO3JldHVybnt6b29tZWRXaWR0aDpzLHpvb21lZEhlaWdodDpufX0sej0oe3BvaW50ZXJYOnQscG9pbnRlclk6YSxpbWFnZURhdGE6ZSx6b29tZWRXaWR0aDpzLHpvb21lZEhlaWdodDpuLGRyYXdXaWR0aDppLGRyYXdIZWlnaHQ6Y30pPT57Y29uc3R7bmF0dXJhbFdpZHRoOmcsbmF0dXJhbEhlaWdodDp1fT1lO2xldCBmPXQvaSpnLXMvMixtPWEvYyp1LW4vMjtjb25zdCB4PU1hdGgubWF4KDAsZy1zKSxPPU1hdGgubWF4KDAsdS1uKTtyZXR1cm4gZj1NYXRoLm1heCgwLE1hdGgubWluKGYseCkpLG09TWF0aC5tYXgoMCxNYXRoLm1pbihtLE8pKSx7em9vbU9mZnNldFg6Zix6b29tT2Zmc2V0WTptfX07bGV0IG8saCxyLGQsbCx3O3NlbGYub25tZXNzYWdlPWFzeW5jIHQ9Pntjb25zdHthY3Rpb246YSxvZmZzY3JlZW46ZSxkZXZpY2VQaXhlbFJhdGlvOnMsaW1hZ2VEYXRhOm4sem9vbVNjYWxlOmkscG9pbnRlclg6Yyxwb2ludGVyWTpnLGltYWdlQXNwZWN0UmF0aW86dSxjb250YWluZXJXaWR0aDpmLGNvbnRhaW5lckhlaWdodDptfT10LmRhdGE7c3dpdGNoKGEpe2Nhc2UiaW5pdENhbnZhcyI6QyhlLHMpO2JyZWFrO2Nhc2UiYWRhcHRDYW52YXNTaXplIjpwKHUsZixtKTticmVhaztjYXNlImRyYXdJbWFnZU9uQ2FudmFzIjpJKG4saSxjLGcpO2JyZWFrfX07Y29uc3QgQz0odCxhKT0+e289dCxoPW8uZ2V0Q29udGV4dCgiMmQiKSxyPWF9LHA9KHQsYSxlKT0+e2NvbnN0IHM9YS9lO3c9dD5zLG8ud2lkdGg9YSpyLG8uaGVpZ2h0PWUqcixoLnNjYWxlKHIsciksdz8oZD1hLGw9YS90KToobD1lLGQ9ZSp0KSxoLmltYWdlU21vb3RoaW5nRW5hYmxlZD0hMCxoLmltYWdlU21vb3RoaW5nUXVhbGl0eT0iaGlnaCJ9LEk9KHQ9e30sYT0xLGU9MCxzPTApPT57Y29uc3R7Yml0bWFwSW1hZ2U6bn09dDtpZighb3x8IW4pcmV0dXJuO2xldCBpLGM7aWYodz8oaT0wLGM9KG8uaGVpZ2h0L3ItbCkvMik6KGk9KG8ud2lkdGgvci1kKS8yLGM9MCksaC5jbGVhclJlY3QoMCwwLG8ud2lkdGgsby5oZWlnaHQpLGEhPT0xKXtjb25zdHtuYXR1cmFsV2lkdGg6ZyxuYXR1cmFsSGVpZ2h0OnV9PXQse3pvb21lZFdpZHRoOmYsem9vbWVkSGVpZ2h0Om19PXYoZyx1LGEpLHt6b29tT2Zmc2V0WDp4LHpvb21PZmZzZXRZOk99PXooe3BvaW50ZXJYOmUscG9pbnRlclk6cyxpbWFnZURhdGE6dCx6b29tZWRXaWR0aDpmLHpvb21lZEhlaWdodDptLGRyYXdXaWR0aDpkLGRyYXdIZWlnaHQ6bH0pO2guZHJhd0ltYWdlKG4seCxPLGYsbSxpLGMsZCxsKX1lbHNlIGguZHJhd0ltYWdlKG4saSxjLGQsbCl9fSkoKTsK",So=e=>Uint8Array.from(atob(e),t=>t.charCodeAt(0)),Xe=typeof self<"u"&&self.Blob&&new Blob([So(Ye)],{type:"text/javascript;charset=utf-8"});function Ao(e){let t;try{if(t=Xe&&(self.URL||self.webkitURL).createObjectURL(Xe),!t)throw"";const i=new Worker(t,{name:e==null?void 0:e.name});return i.addEventListener("error",()=>{(self.URL||self.webkitURL).revokeObjectURL(t)}),i}catch{return new Worker("data:text/javascript;base64,"+Ye,{name:e==null?void 0:e.name})}finally{t&&(self.URL||self.webkitURL).revokeObjectURL(t)}}const Lo=new Set(["p","span","div","br","hr","strong","em","b","i","u","s","h1","h2","h3","h4","h5","h6","ul","ol","li","a","img","button","table","thead","tbody","tr","th","td","blockquote","pre","code","label","input","select","option","textarea","svg","path","circle","rect","line","polyline","polygon","ellipse","g","text","tspan","defs","use","symbol","clippath","mask","lineargradient","radialgradient","stop"]),Pe={a:["href","title","target","rel"],img:["src","alt","title","width","height"],button:["type","disabled","name","value"],input:["type","name","value","placeholder","disabled","readonly","checked","min","max","step"],select:["name","disabled","multiple"],option:["value","disabled","selected"],textarea:["name","placeholder","disabled","readonly","rows","cols"],label:["for"],svg:["viewbox","width","height","fill","stroke","xmlns","preserveaspectratio"],path:["d","fill","stroke","stroke-width","stroke-linecap","stroke-linejoin","transform"],circle:["cx","cy","r","fill","stroke","stroke-width"],rect:["x","y","width","height","rx","ry","fill","stroke","stroke-width"],line:["x1","y1","x2","y2","stroke","stroke-width"],polyline:["points","fill","stroke","stroke-width"],polygon:["points","fill","stroke","stroke-width"],ellipse:["cx","cy","rx","ry","fill","stroke","stroke-width"],g:["transform","fill","stroke"],text:["x","y","dx","dy","text-anchor","fill","font-size","font-family","font-weight"],tspan:["x","y","dx","dy"],use:["href","xlink:href","x","y","width","height"],lineargradient:["id","x1","y1","x2","y2","gradientunits"],radialgradient:["id","cx","cy","r","fx","fy","gradientunits"],stop:["offset","stop-color","stop-opacity"],clippath:["id"],mask:["id"],"*":["class","id","style"]},To=[/javascript:/gi,/vbscript:/gi,/data:/gi,/on\w+\s*=/gi],Yo=e=>{if(typeof e!="string")return"";const t=document.createElement("template");t.innerHTML=e;const i=o=>{if(Array.from(o.childNodes).forEach(i),o.nodeType===Node.ELEMENT_NODE){const s=o.tagName.toLowerCase();if(!Lo.has(s)){if(s==="script"||s==="style"){o.remove();return}const a=document.createTextNode(o.textContent);o.parentNode.replaceChild(a,o);return}const l=[...Pe[s]||[],...Pe["*"]||[]];if(Array.from(o.attributes).forEach(a=>{const c=a.name.toLowerCase();if(c.startsWith("on")){o.removeAttribute(a.name);return}if(!l.includes(c)){o.removeAttribute(a.name);return}let h=a.value;To.forEach(u=>{u.test(h)&&o.removeAttribute(a.name)})}),s==="a"){const a=o.getAttribute("href");a&&(/^(https?:|mailto:|tel:|#|\/)/i.test(a.trim())||o.removeAttribute("href")),o.getAttribute("target")==="_blank"&&o.setAttribute("rel","noopener noreferrer")}if(s==="img"){const a=o.getAttribute("src");a&&(/^(https?:|\/|data:image\/)/i.test(a.trim())||o.removeAttribute("src"))}}};return i(t.content),t.innerHTML},Xo=e=>e==="x"?Y.X:Y.Y,Po=(e,t,i)=>e.filter(o=>Xo(o.orientation)===i&&t in o.positions),Ro=(e,t)=>{const i=document.createElement("button");return i.id=e,i.className="cloudimage-360-hotspot",i.dataset.hotspotId=e,i.setAttribute("type","button"),i.setAttribute("aria-label",t||`Hotspot ${e}`),i.setAttribute("aria-haspopup","true"),i.setAttribute("aria-expanded","false"),i},Mo=e=>{const t=Object.entries(e).sort(([s],[l])=>Number(s)-Number(l));let i=null,o=null;const n={};for(const[s,l]of t)if(!l)n[s]={x:i,y:o};else{const{x:r,y:a}=l;r!=null&&(i=r),a!=null&&(o=a),n[s]={x:r||i,y:a||o}}return n},Ho=e=>[{name:"offset",options:{offset:[0,10]}},{name:"preventOverflow",options:{boundary:e}}],Do=(e,t)=>{const i=document.createElement("div");return i.className="cloudimage-360-popper",i.id=`cloudimage-360-popper-${t}`,i.dataset.popperId=t,i.setAttribute("role","tooltip"),i.setAttribute("aria-hidden","false"),typeof e=="string"&&/<\/?[a-z][\s\S]*>/i.test(e)?i.innerHTML=Yo(e):i.textContent=e,document.body.appendChild(i),i},Zo=e=>{const t=[...e];return t.forEach((i,o)=>{const n={...Mo(i.positions)};t[o].initialPositions=n,t[o].positions=n}),t},Bo=({newWidth:e,newHeight:t,initialContainerSize:i,imageAspectRatio:o,hotspotsConfig:n})=>{const[s,l]=i;let r=e,a=t,c=0,h=0;const u=e/t;o>u?(a=e/o,h=(t-a)/2):(r=t*o,c=(e-r)/2);const p=r/s,x=a/l;return n.map(g=>{const v={};return Object.entries(g.initialPositions).forEach(([m,y])=>{v[m]={x:y.x*p+c,y:y.y*x+h}}),{...g,positions:v}})};var H="top",F="bottom",z="right",D="left",_t="auto",wt=[H,F,z,D],ct="start",xt="end",Wo="clippingParents",Re="viewport",It="popper",Fo="reference",Me=wt.reduce(function(e,t){return e.concat([t+"-"+ct,t+"-"+xt])},[]),He=[].concat(wt,[_t]).reduce(function(e,t){return e.concat([t,t+"-"+ct,t+"-"+xt])},[]),zo="beforeRead",No="read",Vo="afterRead",jo="beforeMain",$o="main",Go="afterMain",Uo="beforeWrite",_o="write",Ko="afterWrite",Jo=[zo,No,Vo,jo,$o,Go,Uo,_o,Ko];function V(e){return e?(e.nodeName||"").toLowerCase():null}function Z(e){if(e==null)return window;if(e.toString()!=="[object Window]"){var t=e.ownerDocument;return t&&t.defaultView||window}return e}function it(e){var t=Z(e).Element;return e instanceof t||e instanceof Element}function N(e){var t=Z(e).HTMLElement;return e instanceof t||e instanceof HTMLElement}function Kt(e){if(typeof ShadowRoot>"u")return!1;var t=Z(e).ShadowRoot;return e instanceof t||e instanceof ShadowRoot}function Qo(e){var t=e.state;Object.keys(t.elements).forEach(function(i){var o=t.styles[i]||{},n=t.attributes[i]||{},s=t.elements[i];!N(s)||!V(s)||(Object.assign(s.style,o),Object.keys(n).forEach(function(l){var r=n[l];r===!1?s.removeAttribute(l):s.setAttribute(l,r===!0?"":r)}))})}function qo(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(o){var n=t.elements[o],s=t.attributes[o]||{},l=Object.keys(t.styles.hasOwnProperty(o)?t.styles[o]:i[o]),r=l.reduce(function(a,c){return a[c]="",a},{});!N(n)||!V(n)||(Object.assign(n.style,r),Object.keys(s).forEach(function(a){n.removeAttribute(a)}))})}}const tn={name:"applyStyles",enabled:!0,phase:"write",fn:Qo,effect:qo,requires:["computeStyles"]};function j(e){return e.split("-")[0]}var ot=Math.max,Dt=Math.min,ht=Math.round;function Jt(){var e=navigator.userAgentData;return e!=null&&e.brands&&Array.isArray(e.brands)?e.brands.map(function(t){return t.brand+"/"+t.version}).join(" "):navigator.userAgent}function De(){return!/^((?!chrome|android).)*safari/i.test(Jt())}function dt(e,t,i){t===void 0&&(t=!1),i===void 0&&(i=!1);var o=e.getBoundingClientRect(),n=1,s=1;t&&N(e)&&(n=e.offsetWidth>0&&ht(o.width)/e.offsetWidth||1,s=e.offsetHeight>0&&ht(o.height)/e.offsetHeight||1);var l=it(e)?Z(e):window,r=l.visualViewport,a=!De()&&i,c=(o.left+(a&&r?r.offsetLeft:0))/n,h=(o.top+(a&&r?r.offsetTop:0))/s,u=o.width/n,f=o.height/s;return{width:u,height:f,top:h,right:c+u,bottom:h+f,left:c,x:c,y:h}}function Qt(e){var t=dt(e),i=e.offsetWidth,o=e.offsetHeight;return Math.abs(t.width-i)<=1&&(i=t.width),Math.abs(t.height-o)<=1&&(o=t.height),{x:e.offsetLeft,y:e.offsetTop,width:i,height:o}}function Ze(e,t){var i=t.getRootNode&&t.getRootNode();if(e.contains(t))return!0;if(i&&Kt(i)){var o=t;do{if(o&&e.isSameNode(o))return!0;o=o.parentNode||o.host}while(o)}return!1}function G(e){return Z(e).getComputedStyle(e)}function en(e){return["table","td","th"].indexOf(V(e))>=0}function tt(e){return((it(e)?e.ownerDocument:e.document)||window.document).documentElement}function Zt(e){return V(e)==="html"?e:e.assignedSlot||e.parentNode||(Kt(e)?e.host:null)||tt(e)}function Be(e){return!N(e)||G(e).position==="fixed"?null:e.offsetParent}function on(e){var t=/firefox/i.test(Jt()),i=/Trident/i.test(Jt());if(i&&N(e)){var o=G(e);if(o.position==="fixed")return null}var n=Zt(e);for(Kt(n)&&(n=n.host);N(n)&&["html","body"].indexOf(V(n))<0;){var s=G(n);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")return n;n=n.parentNode}return null}function Ct(e){for(var t=Z(e),i=Be(e);i&&en(i)&&G(i).position==="static";)i=Be(i);return i&&(V(i)==="html"||V(i)==="body"&&G(i).position==="static")?t:i||on(e)||t}function qt(e){return["top","bottom"].indexOf(e)>=0?"x":"y"}function kt(e,t,i){return ot(e,Dt(t,i))}function nn(e,t,i){var o=kt(e,t,i);return o>i?i:o}function We(){return{top:0,right:0,bottom:0,left:0}}function Fe(e){return Object.assign({},We(),e)}function ze(e,t){return t.reduce(function(i,o){return i[o]=e,i},{})}var sn=function(t,i){return t=typeof t=="function"?t(Object.assign({},i.rects,{placement:i.placement})):t,Fe(typeof t!="number"?t:ze(t,wt))};function rn(e){var t,i=e.state,o=e.name,n=e.options,s=i.elements.arrow,l=i.modifiersData.popperOffsets,r=j(i.placement),a=qt(r),c=[D,z].indexOf(r)>=0,h=c?"height":"width";if(!(!s||!l)){var u=sn(n.padding,i),f=Qt(s),p=a==="y"?H:D,x=a==="y"?F:z,g=i.rects.reference[h]+i.rects.reference[a]-l[a]-i.rects.popper[h],v=l[a]-i.rects.reference[a],m=Ct(s),y=m?a==="y"?m.clientHeight||0:m.clientWidth||0:0,I=g/2-v/2,w=u[p],C=y-f[h]-u[x],b=y/2-f[h]/2+I,k=kt(w,b,C),E=a;i.modifiersData[o]=(t={},t[E]=k,t.centerOffset=k-b,t)}}function an(e){var t=e.state,i=e.options,o=i.element,n=o===void 0?"[data-popper-arrow]":o;n!=null&&(typeof n=="string"&&(n=t.elements.popper.querySelector(n),!n)||Ze(t.elements.popper,n)&&(t.elements.arrow=n))}const ln={name:"arrow",enabled:!0,phase:"main",fn:rn,effect:an,requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function pt(e){return e.split("-")[1]}var cn={top:"auto",right:"auto",bottom:"auto",left:"auto"};function hn(e,t){var i=e.x,o=e.y,n=t.devicePixelRatio||1;return{x:ht(i*n)/n||0,y:ht(o*n)/n||0}}function Ne(e){var t,i=e.popper,o=e.popperRect,n=e.placement,s=e.variation,l=e.offsets,r=e.position,a=e.gpuAcceleration,c=e.adaptive,h=e.roundOffsets,u=e.isFixed,f=l.x,p=f===void 0?0:f,x=l.y,g=x===void 0?0:x,v=typeof h=="function"?h({x:p,y:g}):{x:p,y:g};p=v.x,g=v.y;var m=l.hasOwnProperty("x"),y=l.hasOwnProperty("y"),I=D,w=H,C=window;if(c){var b=Ct(i),k="clientHeight",E="clientWidth";if(b===Z(i)&&(b=tt(i),G(b).position!=="static"&&r==="absolute"&&(k="scrollHeight",E="scrollWidth")),b=b,n===H||(n===D||n===z)&&s===xt){w=F;var O=u&&b===C&&C.visualViewport?C.visualViewport.height:b[k];g-=O-o.height,g*=a?1:-1}if(n===D||(n===H||n===F)&&s===xt){I=z;var S=u&&b===C&&C.visualViewport?C.visualViewport.width:b[E];p-=S-o.width,p*=a?1:-1}}var L=Object.assign({position:r},c&&cn),M=h===!0?hn({x:p,y:g},Z(i)):{x:p,y:g};if(p=M.x,g=M.y,a){var T;return Object.assign({},L,(T={},T[w]=y?"0":"",T[I]=m?"0":"",T.transform=(C.devicePixelRatio||1)<=1?"translate("+p+"px, "+g+"px)":"translate3d("+p+"px, "+g+"px, 0)",T))}return Object.assign({},L,(t={},t[w]=y?g+"px":"",t[I]=m?p+"px":"",t.transform="",t))}function dn(e){var t=e.state,i=e.options,o=i.gpuAcceleration,n=o===void 0?!0:o,s=i.adaptive,l=s===void 0?!0:s,r=i.roundOffsets,a=r===void 0?!0:r,c={placement:j(t.placement),variation:pt(t.placement),popper:t.elements.popper,popperRect:t.rects.popper,gpuAcceleration:n,isFixed:t.options.strategy==="fixed"};t.modifiersData.popperOffsets!=null&&(t.styles.popper=Object.assign({},t.styles.popper,Ne(Object.assign({},c,{offsets:t.modifiersData.popperOffsets,position:t.options.strategy,adaptive:l,roundOffsets:a})))),t.modifiersData.arrow!=null&&(t.styles.arrow=Object.assign({},t.styles.arrow,Ne(Object.assign({},c,{offsets:t.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:a})))),t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-placement":t.placement})}const pn={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:dn,data:{}};var Bt={passive:!0};function un(e){var t=e.state,i=e.instance,o=e.options,n=o.scroll,s=n===void 0?!0:n,l=o.resize,r=l===void 0?!0:l,a=Z(t.elements.popper),c=[].concat(t.scrollParents.reference,t.scrollParents.popper);return s&&c.forEach(function(h){h.addEventListener("scroll",i.update,Bt)}),r&&a.addEventListener("resize",i.update,Bt),function(){s&&c.forEach(function(h){h.removeEventListener("scroll",i.update,Bt)}),r&&a.removeEventListener("resize",i.update,Bt)}}const fn={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:un,data:{}};var mn={left:"right",right:"left",bottom:"top",top:"bottom"};function Wt(e){return e.replace(/left|right|bottom|top/g,function(t){return mn[t]})}var vn={start:"end",end:"start"};function Ve(e){return e.replace(/start|end/g,function(t){return vn[t]})}function te(e){var t=Z(e),i=t.pageXOffset,o=t.pageYOffset;return{scrollLeft:i,scrollTop:o}}function ee(e){return dt(tt(e)).left+te(e).scrollLeft}function gn(e,t){var i=Z(e),o=tt(e),n=i.visualViewport,s=o.clientWidth,l=o.clientHeight,r=0,a=0;if(n){s=n.width,l=n.height;var c=De();(c||!c&&t==="fixed")&&(r=n.offsetLeft,a=n.offsetTop)}return{width:s,height:l,x:r+ee(e),y:a}}function bn(e){var t,i=tt(e),o=te(e),n=(t=e.ownerDocument)==null?void 0:t.body,s=ot(i.scrollWidth,i.clientWidth,n?n.scrollWidth:0,n?n.clientWidth:0),l=ot(i.scrollHeight,i.clientHeight,n?n.scrollHeight:0,n?n.clientHeight:0),r=-o.scrollLeft+ee(e),a=-o.scrollTop;return G(n||i).direction==="rtl"&&(r+=ot(i.clientWidth,n?n.clientWidth:0)-s),{width:s,height:l,x:r,y:a}}function ie(e){var t=G(e),i=t.overflow,o=t.overflowX,n=t.overflowY;return/auto|scroll|overlay|hidden/.test(i+n+o)}function je(e){return["html","body","#document"].indexOf(V(e))>=0?e.ownerDocument.body:N(e)&&ie(e)?e:je(Zt(e))}function Ot(e,t){var i;t===void 0&&(t=[]);var o=je(e),n=o===((i=e.ownerDocument)==null?void 0:i.body),s=Z(o),l=n?[s].concat(s.visualViewport||[],ie(o)?o:[]):o,r=t.concat(l);return n?r:r.concat(Ot(Zt(l)))}function oe(e){return Object.assign({},e,{left:e.x,top:e.y,right:e.x+e.width,bottom:e.y+e.height})}function yn(e,t){var i=dt(e,!1,t==="fixed");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}function $e(e,t,i){return t===Re?oe(gn(e,i)):it(t)?yn(t,i):oe(bn(tt(e)))}function wn(e){var t=Ot(Zt(e)),i=["absolute","fixed"].indexOf(G(e).position)>=0,o=i&&N(e)?Ct(e):e;return it(o)?t.filter(function(n){return it(n)&&Ze(n,o)&&V(n)!=="body"}):[]}function xn(e,t,i,o){var n=t==="clippingParents"?wn(e):[].concat(t),s=[].concat(n,[i]),l=s[0],r=s.reduce(function(a,c){var h=$e(e,c,o);return a.top=ot(h.top,a.top),a.right=Dt(h.right,a.right),a.bottom=Dt(h.bottom,a.bottom),a.left=ot(h.left,a.left),a},$e(e,l,o));return r.width=r.right-r.left,r.height=r.bottom-r.top,r.x=r.left,r.y=r.top,r}function Ge(e){var t=e.reference,i=e.element,o=e.placement,n=o?j(o):null,s=o?pt(o):null,l=t.x+t.width/2-i.width/2,r=t.y+t.height/2-i.height/2,a;switch(n){case H:a={x:l,y:t.y-i.height};break;case F:a={x:l,y:t.y+t.height};break;case z:a={x:t.x+t.width,y:r};break;case D:a={x:t.x-i.width,y:r};break;default:a={x:t.x,y:t.y}}var c=n?qt(n):null;if(c!=null){var h=c==="y"?"height":"width";switch(s){case ct:a[c]=a[c]-(t[h]/2-i[h]/2);break;case xt:a[c]=a[c]+(t[h]/2-i[h]/2);break}}return a}function Et(e,t){t===void 0&&(t={});var i=t,o=i.placement,n=o===void 0?e.placement:o,s=i.strategy,l=s===void 0?e.strategy:s,r=i.boundary,a=r===void 0?Wo:r,c=i.rootBoundary,h=c===void 0?Re:c,u=i.elementContext,f=u===void 0?It:u,p=i.altBoundary,x=p===void 0?!1:p,g=i.padding,v=g===void 0?0:g,m=Fe(typeof v!="number"?v:ze(v,wt)),y=f===It?Fo:It,I=e.rects.popper,w=e.elements[x?y:f],C=xn(it(w)?w:w.contextElement||tt(e.elements.popper),a,h,l),b=dt(e.elements.reference),k=Ge({reference:b,element:I,placement:n}),E=oe(Object.assign({},I,k)),O=f===It?E:b,S={top:C.top-O.top+m.top,bottom:O.bottom-C.bottom+m.bottom,left:C.left-O.left+m.left,right:O.right-C.right+m.right},L=e.modifiersData.offset;if(f===It&&L){var M=L[n];Object.keys(S).forEach(function(T){var U=[z,F].indexOf(T)>=0?1:-1,_=[H,F].indexOf(T)>=0?"y":"x";S[T]+=M[_]*U})}return S}function In(e,t){t===void 0&&(t={});var i=t,o=i.placement,n=i.boundary,s=i.rootBoundary,l=i.padding,r=i.flipVariations,a=i.allowedAutoPlacements,c=a===void 0?He:a,h=pt(o),u=h?r?Me:Me.filter(function(x){return pt(x)===h}):wt,f=u.filter(function(x){return c.indexOf(x)>=0});f.length===0&&(f=u);var p=f.reduce(function(x,g){return x[g]=Et(e,{placement:g,boundary:n,rootBoundary:s,padding:l})[j(g)],x},{});return Object.keys(p).sort(function(x,g){return p[x]-p[g]})}function Cn(e){if(j(e)===_t)return[];var t=Wt(e);return[Ve(e),t,Ve(t)]}function kn(e){var t=e.state,i=e.options,o=e.name;if(!t.modifiersData[o]._skip){for(var n=i.mainAxis,s=n===void 0?!0:n,l=i.altAxis,r=l===void 0?!0:l,a=i.fallbackPlacements,c=i.padding,h=i.boundary,u=i.rootBoundary,f=i.altBoundary,p=i.flipVariations,x=p===void 0?!0:p,g=i.allowedAutoPlacements,v=t.options.placement,m=j(v),y=m===v,I=a||(y||!x?[Wt(v)]:Cn(v)),w=[v].concat(I).reduce(function(et,$){return et.concat(j($)===_t?In(t,{placement:$,boundary:h,rootBoundary:u,padding:c,flipVariations:x,allowedAutoPlacements:g}):$)},[]),C=t.rects.reference,b=t.rects.popper,k=new Map,E=!0,O=w[0],S=0;S<w.length;S++){var L=w[S],M=j(L),T=pt(L)===ct,U=[H,F].indexOf(M)>=0,_=U?"width":"height",P=Et(t,{placement:L,boundary:h,rootBoundary:u,altBoundary:f,padding:c}),B=U?T?z:D:T?F:H;C[_]>b[_]&&(B=Wt(B));var ut=Wt(B),K=[];if(s&&K.push(P[M]<=0),r&&K.push(P[B]<=0,P[ut]<=0),K.every(function(et){return et})){O=L,E=!1;break}k.set(L,K)}if(E)for(var ft=x?3:1,St=function($){var st=w.find(function(rt){var J=k.get(rt);if(J)return J.slice(0,$).every(function(vt){return vt})});if(st)return O=st,"break"},nt=ft;nt>0;nt--){var mt=St(nt);if(mt==="break")break}t.placement!==O&&(t.modifiersData[o]._skip=!0,t.placement=O,t.reset=!0)}}const On={name:"flip",enabled:!0,phase:"main",fn:kn,requiresIfExists:["offset"],data:{_skip:!1}};function Ue(e,t,i){return i===void 0&&(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 _e(e){return[H,z,F,D].some(function(t){return e[t]>=0})}function En(e){var t=e.state,i=e.name,o=t.rects.reference,n=t.rects.popper,s=t.modifiersData.preventOverflow,l=Et(t,{elementContext:"reference"}),r=Et(t,{altBoundary:!0}),a=Ue(l,o),c=Ue(r,n,s),h=_e(a),u=_e(c);t.modifiersData[i]={referenceClippingOffsets:a,popperEscapeOffsets:c,isReferenceHidden:h,hasPopperEscaped:u},t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-reference-hidden":h,"data-popper-escaped":u})}const Sn={name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:En};function An(e,t,i){var o=j(e),n=[D,H].indexOf(o)>=0?-1:1,s=typeof i=="function"?i(Object.assign({},t,{placement:e})):i,l=s[0],r=s[1];return l=l||0,r=(r||0)*n,[D,z].indexOf(o)>=0?{x:r,y:l}:{x:l,y:r}}function Ln(e){var t=e.state,i=e.options,o=e.name,n=i.offset,s=n===void 0?[0,0]:n,l=He.reduce(function(h,u){return h[u]=An(u,t.rects,s),h},{}),r=l[t.placement],a=r.x,c=r.y;t.modifiersData.popperOffsets!=null&&(t.modifiersData.popperOffsets.x+=a,t.modifiersData.popperOffsets.y+=c),t.modifiersData[o]=l}const Tn={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:Ln};function Yn(e){var t=e.state,i=e.name;t.modifiersData[i]=Ge({reference:t.rects.reference,element:t.rects.popper,placement:t.placement})}const Xn={name:"popperOffsets",enabled:!0,phase:"read",fn:Yn,data:{}};function Pn(e){return e==="x"?"y":"x"}function Rn(e){var t=e.state,i=e.options,o=e.name,n=i.mainAxis,s=n===void 0?!0:n,l=i.altAxis,r=l===void 0?!1:l,a=i.boundary,c=i.rootBoundary,h=i.altBoundary,u=i.padding,f=i.tether,p=f===void 0?!0:f,x=i.tetherOffset,g=x===void 0?0:x,v=Et(t,{boundary:a,rootBoundary:c,padding:u,altBoundary:h}),m=j(t.placement),y=pt(t.placement),I=!y,w=qt(m),C=Pn(w),b=t.modifiersData.popperOffsets,k=t.rects.reference,E=t.rects.popper,O=typeof g=="function"?g(Object.assign({},t.rects,{placement:t.placement})):g,S=typeof O=="number"?{mainAxis:O,altAxis:O}:Object.assign({mainAxis:0,altAxis:0},O),L=t.modifiersData.offset?t.modifiersData.offset[t.placement]:null,M={x:0,y:0};if(b){if(s){var T,U=w==="y"?H:D,_=w==="y"?F:z,P=w==="y"?"height":"width",B=b[w],ut=B+v[U],K=B-v[_],ft=p?-E[P]/2:0,St=y===ct?k[P]:E[P],nt=y===ct?-E[P]:-k[P],mt=t.elements.arrow,et=p&&mt?Qt(mt):{width:0,height:0},$=t.modifiersData["arrow#persistent"]?t.modifiersData["arrow#persistent"].padding:We(),st=$[U],rt=$[_],J=kt(0,k[P],et[P]),vt=I?k[P]/2-ft-J-st-S.mainAxis:St-J-st-S.mainAxis,ne=I?-k[P]/2+ft+J+rt+S.mainAxis:nt+J+rt+S.mainAxis,At=t.elements.arrow&&Ct(t.elements.arrow),se=At?w==="y"?At.clientTop||0:At.clientLeft||0:0,zt=(T=L==null?void 0:L[w])!=null?T:0,re=B+vt-zt-se,ae=B+ne-zt,Nt=kt(p?Dt(ut,re):ut,B,p?ot(K,ae):K);b[w]=Nt,M[w]=Nt-B}if(r){var Vt,le=w==="x"?H:D,ce=w==="x"?F:z,Q=b[C],gt=C==="y"?"height":"width",Lt=Q+v[le],bt=Q-v[ce],at=[H,D].indexOf(m)!==-1,Tt=(Vt=L==null?void 0:L[C])!=null?Vt:0,Yt=at?Lt:Q-k[gt]-E[gt]-Tt+S.altAxis,Xt=at?Q+k[gt]+E[gt]-Tt-S.altAxis:bt,Pt=p&&at?nn(Yt,Q,Xt):kt(p?Yt:Lt,Q,p?Xt:bt);b[C]=Pt,M[C]=Pt-Q}t.modifiersData[o]=M}}const Mn={name:"preventOverflow",enabled:!0,phase:"main",fn:Rn,requiresIfExists:["offset"]};function Hn(e){return{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}}function Dn(e){return e===Z(e)||!N(e)?te(e):Hn(e)}function Zn(e){var t=e.getBoundingClientRect(),i=ht(t.width)/e.offsetWidth||1,o=ht(t.height)/e.offsetHeight||1;return i!==1||o!==1}function Bn(e,t,i){i===void 0&&(i=!1);var o=N(t),n=N(t)&&Zn(t),s=tt(t),l=dt(e,n,i),r={scrollLeft:0,scrollTop:0},a={x:0,y:0};return(o||!o&&!i)&&((V(t)!=="body"||ie(s))&&(r=Dn(t)),N(t)?(a=dt(t,!0),a.x+=t.clientLeft,a.y+=t.clientTop):s&&(a.x=ee(s))),{x:l.left+r.scrollLeft-a.x,y:l.top+r.scrollTop-a.y,width:l.width,height:l.height}}function Wn(e){var t=new Map,i=new Set,o=[];e.forEach(function(s){t.set(s.name,s)});function n(s){i.add(s.name);var l=[].concat(s.requires||[],s.requiresIfExists||[]);l.forEach(function(r){if(!i.has(r)){var a=t.get(r);a&&n(a)}}),o.push(s)}return e.forEach(function(s){i.has(s.name)||n(s)}),o}function Fn(e){var t=Wn(e);return Jo.reduce(function(i,o){return i.concat(t.filter(function(n){return n.phase===o}))},[])}function zn(e){var t;return function(){return t||(t=new Promise(function(i){Promise.resolve().then(function(){t=void 0,i(e())})})),t}}function Nn(e){var t=e.reduce(function(i,o){var n=i[o.name];return i[o.name]=n?Object.assign({},n,o,{options:Object.assign({},n.options,o.options),data:Object.assign({},n.data,o.data)}):o,i},{});return Object.keys(t).map(function(i){return t[i]})}var Ke={placement:"bottom",modifiers:[],strategy:"absolute"};function Je(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];return!t.some(function(o){return!(o&&typeof o.getBoundingClientRect=="function")})}function Vn(e){e===void 0&&(e={});var t=e,i=t.defaultModifiers,o=i===void 0?[]:i,n=t.defaultOptions,s=n===void 0?Ke:n;return function(r,a,c){c===void 0&&(c=s);var h={placement:"bottom",orderedModifiers:[],options:Object.assign({},Ke,s),modifiersData:{},elements:{reference:r,popper:a},attributes:{},styles:{}},u=[],f=!1,p={state:h,setOptions:function(m){var y=typeof m=="function"?m(h.options):m;g(),h.options=Object.assign({},s,h.options,y),h.scrollParents={reference:it(r)?Ot(r):r.contextElement?Ot(r.contextElement):[],popper:Ot(a)};var I=Fn(Nn([].concat(o,h.options.modifiers)));return h.orderedModifiers=I.filter(function(w){return w.enabled}),x(),p.update()},forceUpdate:function(){if(!f){var m=h.elements,y=m.reference,I=m.popper;if(Je(y,I)){h.rects={reference:Bn(y,Ct(I),h.options.strategy==="fixed"),popper:Qt(I)},h.reset=!1,h.placement=h.options.placement,h.orderedModifiers.forEach(function(S){return h.modifiersData[S.name]=Object.assign({},S.data)});for(var w=0;w<h.orderedModifiers.length;w++){if(h.reset===!0){h.reset=!1,w=-1;continue}var C=h.orderedModifiers[w],b=C.fn,k=C.options,E=k===void 0?{}:k,O=C.name;typeof b=="function"&&(h=b({state:h,options:E,name:O,instance:p})||h)}}}},update:zn(function(){return new Promise(function(v){p.forceUpdate(),v(h)})}),destroy:function(){g(),f=!0}};if(!Je(r,a))return p;p.setOptions(c).then(function(v){!f&&c.onFirstUpdate&&c.onFirstUpdate(v)});function x(){h.orderedModifiers.forEach(function(v){var m=v.name,y=v.options,I=y===void 0?{}:y,w=v.effect;if(typeof w=="function"){var C=w({state:h,name:m,instance:p,options:I}),b=function(){};u.push(C||b)}})}function g(){u.forEach(function(v){return v()}),u=[]}return p}}var jn=[fn,Xn,pn,tn,Tn,On,Mn,ln,Sn],$n=Vn({defaultModifiers:jn});class Gn{constructor(t,i,o){qe(this,"updateHotspotPosition",(t,i)=>{this.currentActiveIndex=t,this.currentOrientation=i;const o=Po(this.hotspotsConfig,t,i);this.hideHotspots(),o.forEach(n=>this.updateAndShowHotspot(n,t))});this.container=i,this.popper=null,this.popperInstance=null,this.hotspotsContainer=_i(this.container),this.hotspotsConfig=Zo(t),this.shouldHidePopper=!0,this.hidePopper=this.hidePopper.bind(this),this.imageAspectRatio=o,this.hotspotElements=new Map,this.popperListeners=[];const{containerSize:n}=t[0];this.initialContainerSize=n||[i.offsetWidth,i.offsetHeight],this.initHotspots(),this.observeContainerResize()}observeContainerResize(){this.resizeObserver=new ResizeObserver(()=>{const t=this.container.offsetWidth,i=this.container.offsetHeight;this.updateHotspotsForResize(t,i)}),this.resizeObserver.observe(this.container)}updateHotspotsForResize(t,i){this.hotspotsConfig=Bo({newWidth:t,newHeight:i,initialContainerSize:this.initialContainerSize,imageAspectRatio:this.imageAspectRatio,hotspotsConfig:this.hotspotsConfig}),this.updateHotspotPosition(this.currentActiveIndex,this.currentOrientation)}cleanupPopperListeners(){this.popperListeners.forEach(({element:t,event:i,handler:o})=>{t.removeEventListener(i,o)}),this.popperListeners=[]}showPopper({hotspotElement:t,content:i,id:o,keepOpen:n}){this.popperInstance&&this.popperInstance.instanceId!==o&&this.hidePopper();const s={placement:"top",modifiers:Ho(this.container)};this.popper=Do(i,o),this.popper.setAttribute("data-show",""),this.currentHotspotElement=t,t.setAttribute("aria-expanded","true"),t.setAttribute("aria-describedby",`cloudimage-360-popper-${o}`);const l=()=>{this.shouldHidePopper=!1},r=()=>{this.shouldHidePopper=!0,this.checkAndHidePopper()},a=()=>{this.shouldHidePopper=!0,this.checkAndHidePopper()},c=()=>{this.shouldHidePopper=!1,this.hidePopperTimeout&&clearTimeout(this.hidePopperTimeout)};this.popper.addEventListener("mouseenter",l),this.popper.addEventListener("mouseleave",r),t.addEventListener("mouseleave",a),t.addEventListener("mouseenter",c),this.popperListeners.push({element:this.popper,event:"mouseenter",handler:l},{element:this.popper,event:"mouseleave",handler:r},{element:t,event:"mouseleave",handler:a},{element:t,event:"mouseenter",handler:c}),this.popperInstance={...$n(t,this.popper,s),keepOpen:n,instanceId:o}}checkAndHidePopper(){var t;this.shouldHidePopper&&!((t=this.popperInstance)!=null&&t.keepOpen)&&(this.hidePopperTimeout=setTimeout(()=>{this.shouldHidePopper&&this.hidePopper()},Ii))}hidePopper(){if(this.cleanupPopperListeners(),this.currentHotspotElement&&(this.currentHotspotElement.setAttribute("aria-expanded","false"),this.currentHotspotElement.removeAttribute("aria-describedby"),this.currentHotspotElement=null),this.popperInstance&&(this.popperInstance.destroy(),this.popperInstance=null),this.popper){this.popper.removeAttribute("data-show"),this.popper.setAttribute("aria-hidden","true");const t=this.popper;this.popper=null,setTimeout(()=>{t.remove()},Ci)}}createHotspot(t){const{id:i,content:o,keepOpen:n,onClick:s,label:l}=t,r=Ro(i,l);s&&(r.style.cursor="pointer"),r.onclick=a=>{a.stopPropagation(),s==null||s(a,this.popperInstance,i)},o&&(r.addEventListener("mouseenter",()=>this.showPopper({hotspotElement:r,content:o,id:i,keepOpen:n})),r.addEventListener("focus",()=>this.showPopper({hotspotElement:r,content:o,id:i,keepOpen:n})),r.addEventListener("blur",()=>{this.shouldHidePopper=!0,this.checkAndHidePopper()})),this.hotspotsContainer.appendChild(r)}hideHotspots(){this.hotspotsContainer.querySelectorAll(".cloudimage-360-hotspot").forEach(t=>{t.style.opacity=0,t.style.pointerEvents="none"})}updateAndShowHotspot(t,i){const{positions:o,id:n}=t,{x:s,y:l}=o[i]??{},r=this.hotspotsContainer.querySelector(`[data-hotspot-id="${n}"]`);r&&(r.style.translate=`${s}px ${l}px`,r.style.opacity=1,r.style.pointerEvents="all")}showHotspotById(t){const i=this.hotspotsConfig.find(n=>n.id===t);if(!i||!i.content)return;const o=this.hotspotsContainer.querySelector(`[data-hotspot-id="${t}"]`);o&&o.style.opacity==="1"&&this.showPopper({hotspotElement:o,content:i.content,id:t,keepOpen:i.keepOpen})}createAllHotspots(){this.hotspotsConfig.forEach(t=>this.createHotspot(t))}initHotspots(){this.createAllHotspots()}destroy(){this.hidePopperTimeout&&clearTimeout(this.hidePopperTimeout),this.resizeObserver.disconnect(),this.hidePopper(),this.hotspotElements.clear(),this.hotspotsContainer.innerHTML=""}}class Ft{constructor(t,i,o){this.container=t,this.isClicked=!1,this.fullscreenView=!!o,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.velocityX=0,this.velocityY=0,this.lastDragTime=0,this.lastDragX=0,this.lastDragY=0,this.inertiaAnimationId=null,this.hasInteracted=!1,this.currentZoomScale=1,this.touchDevice=Oo(),this.dragJustEnded=!1,this.isPinching=!1,this.initialPinchDistance=0,this.pinchZoomLevel=1,this.pinchZoomEmitted=!1,this.lastEmittedZoom=1,this.panOffsetX=0,this.panOffsetY=0,this.canvasWorker=new Ao,this.hotspotTimeline=null,this.hotspotTimelineIndicator=null,this.isAnimatingToFrame=!1,this.onMoveHandler=this.onMoveHandler.bind(this),this.destroy=this.destroy.bind(this),this.init(this.container,i)}emit(t,i={}){const o=this[t];typeof o=="function"&&o({...i,viewerId:this.id})}announce(t){Ji(this.ariaLiveRegion,t)}mouseDown(t){if(!this.isReady||this.glass)return;const{pageX:i,pageY:o}=t;this.hideHints(),this.hideHotspotPopper(),this.inertiaAnimationId&&(cancelAnimationFrame(this.inertiaAnimationId),this.inertiaAnimationId=null),this.autoplayJustStopped=!1,(this.autoplay||this.loopTimeoutId)&&(this.stopAutoplay(),this.autoplay=!1,this.autoplayJustStopped=!0),this.movementStart={x:i,y:o},this.isClicked=!0,this.isDragging=!1,this.inertia&&(this.velocityX=0,this.velocityY=0,this.lastDragTime=performance.now(),this.lastDragX=i,this.lastDragY=o)}mouseUp(){this.isReady&&(!this.isZoomed&&!this.autoplayJustStopped&&this.showAllIcons(),this.inertia&&this.isDragging&&(Math.abs(this.velocityX)>.1||Math.abs(this.velocityY)>.1)&&this.startInertia(),this.isDragging&&(this.emit("onDragEnd"),this.dragJustEnded=!0),this.movementStart={x:0,y:0},this.isClicked=!1,this.isDragging=!1,this.innerBox.style.cursor="grab")}startInertia(){const o=this.fullscreenView?document.body:this.container,n=this.dragSpeed/ve,s=n*(this.amountX/o.offsetWidth),l=n*(this.amountY/o.offsetHeight),r=()=>{if(this.velocityX*=.95,this.velocityY*=.95,Math.abs(this.velocityX)<.01&&Math.abs(this.velocityY)<.01){this.inertiaAnimationId=null;return}const a=this.velocityX*16,c=this.velocityY*16,h=Te({deltaX:a,deltaY:c,reversed:this.dragReverse,allowSpinX:this.allowSpinX,allowSpinY:this.allowSpinY});if(h){const u=this.allowSpinX?Math.max(1,Math.abs(Math.round(a*s))):0,f=this.allowSpinY?Math.max(1,Math.abs(Math.round(c*l))):0;(u>0||f>0)&&this.onMoveHandler(h,u,f)}this.inertiaAnimationId=requestAnimationFrame(r)};this.inertiaAnimationId=requestAnimationFrame(r)}drag(t,i){if(!this.isReady||!this.isClicked)return;const o=t-this.movementStart.x,n=i-this.movementStart.y;if(this.inertia){const f=performance.now(),p=f-this.lastDragTime;p>0&&p<100&&(this.velocityX=(t-this.lastDragX)/p,this.velocityY=(i-this.lastDragY)/p),this.lastDragTime=f,this.lastDragX=t,this.lastDragY=i}this.draggingDirection=Te({deltaX:o,deltaY:n,reversed:this.dragReverse,allowSpinX:this.allowSpinX,allowSpinY:this.allowSpinY})||this.draggingDirection;const s=this.fullscreenView?document.body:this.container,l=this.dragSpeed/ve,r=l*(this.amountX/s.offsetWidth),a=l*(this.amountY/s.offsetHeight),c=this.allowSpinX?Math.abs(Math.round(o*r)):0,h=this.allowSpinY?Math.abs(Math.round(n*a)):0;(this.allowSpinX&&c!==0||this.allowSpinY&&h!==0)&&(this.hasInteracted=!0,this.hideHotspotPopper(),this.onMoveHandler(this.draggingDirection,c,h),this.movementStart={x:t,y:i},setTimeout(()=>{this.isDragging||(this.isDragging=!0,this.emit("onDragStart"))},xi))}mouseMove(t){!this.isReady||!this.isClicked&&!this.isZoomed||this.glass||(this.hideAllIcons(),this.drag(t.pageX,t.pageY),this.isZoomed&&this.applyZoom(t))}mouseClick(t){if(!(!this.isReady||this.isDragging)){if(this.dragJustEnded){this.dragJustEnded=!1;return}if(this.autoplayJustStopped){this.autoplayJustStopped=!1;return}if(this.glass&&this.magnified){this.removeGlass();return}this.pointerZoom&&!this.glass&&!this.touchDevice&&this.toggleZoom(t)}}loadHigherQualityImages(t,i){const o=yt(this.srcXConfig,t),n=this.allowSpinY?yt(this.srcYConfig,t):null;ye({cdnPathX:o,cdnPathY:n,configX:this.srcXConfig,configY:this.srcYConfig,onAllImagesLoad:(s,l)=>{this.imagesX=s,this.imagesY=l,i()},onError:s=>this.emit("onError",s)})}hideHotspots(){this.hotspotsInstance&&this.hotspotsInstance.hideHotspots()}hideHotspotPopper(){this.hotspotsInstance&&this.hotspotsInstance.hidePopper()}toggleZoom(t){if(this.isZoomed)this.showTransitionOverlay(),setTimeout(()=>{this.removeZoom()},me);else{let i=(this.fullscreenView||this.pointerZoom?document.body:this.container).offsetWidth;this.hideHotspots(),this.showLoadingSpinner(),this.loadHigherQualityImages(i,()=>{this.showTransitionOverlay(),setTimeout(()=>{this.applyZoom(t)},me)})}}removeZoom(){this.isZoomed=!1,this.updateView(),this.showAllIcons(),this.hideTransitionOverlay(),this.emit("onZoomOut"),this.announce("Zoomed out")}mouseLeave(){this.isZoomed&&this.removeZoom()}applyZoom(t){const{offsetX:i,offsetY:o}=yo(t,this.canvas,this.devicePixelRatio);this.isZoomed=!0,this.hideAllIcons(),this.hideLoadingSpinner(),this.hideTransitionOverlay(),this.updateView(this.pointerZoom,i,o),this.emit("onZoomIn",{zoomLevel:this.pointerZoom}),this.announce("Zoomed in. Move mouse to pan. Click to zoom out.")}touchOutside(t){if(!this.glass)return;!this.canvas.contains(t.target)&&this.removeGlass()}touchStart(t){if(!this.isReady||this.glass||!t.touches||!t.touches.length)return;const i=t.target;if(i&&i.closest&&i.closest(".cloudimage-360-button"))return;if(this.hideHints(),t.touches.length===2&&this.pinchZoom&&!this.isDragging){t.preventDefault(),this.isPinching=!0,this.isClicked=!1,this.inertiaAnimationId&&(cancelAnimationFrame(this.inertiaAnimationId),this.inertiaAnimationId=null);const s=t.touches[0],l=t.touches[1];if(this.initialPinchDistance=this.getPinchDistance(s,l),(this.autoplay||this.loopTimeoutId)&&(this.stopAutoplay(),this.autoplay=!1),!this.isZoomed&&this.pinchZoomLevel===1){const r=(this.fullscreenView?document.body:this.container).offsetWidth;this.hideHotspots(),this.loadHigherQualityImages(r,()=>{})}return}if(t.touches.length>1)return;const{pageX:o,pageY:n}=t.touches[0];this.inertiaAnimationId&&(cancelAnimationFrame(this.inertiaAnimationId),this.inertiaAnimationId=null),(this.autoplay||this.loopTimeoutId)&&(this.stopAutoplay(),this.autoplay=!1),this.hideAllIcons(),this.hideHotspotPopper(),this.movementStart={x:o,y:n},this.isClicked=!0,this.isDragging=!1,this.inertia&&(this.velocityX=0,this.velocityY=0,this.lastDragTime=performance.now(),this.lastDragX=o,this.lastDragY=n)}getPinchDistance(t,i){const o=t.pageX-i.pageX,n=t.pageY-i.pageY;return Math.sqrt(o*o+n*n)}getPinchCenter(t,i){return{x:(t.pageX+i.pageX)/2,y:(t.pageY+i.pageY)/2}}touchEnd(t){if(this.isReady){if(this.isPinching){if(!t.touches||t.touches.length<2){if(this.isPinching=!1,this.initialPinchDistance=0,this.pinchZoomLevel<=1){const i=this.pinchZoomEmitted;this.pinchZoomLevel=1,this.pinchZoomEmitted=!1,this.lastEmittedZoom=1,this.isZoomed=!1,this.panOffsetX=0,this.panOffsetY=0,this.showAllIcons(),this.updateView(),i&&this.emit("onZoomOut")}else if(this.canvas){const i=this.canvas.getBoundingClientRect();this.panOffsetX=i.width/2*this.devicePixelRatio,this.panOffsetY=i.height/2*this.devicePixelRatio}}return}this.showAllIcons(),this.inertia&&this.isDragging&&(Math.abs(this.velocityX)>.1||Math.abs(this.velocityY)>.1)&&this.startInertia(),this.movementStart={x:0,y:0},this.isClicked=!1,this.isDragging=!1}}touchMove(t){if(!this.isReady||this.glass)return;if(this.isPinching&&t.touches.length===2){t.preventDefault();const n=t.touches[0],s=t.touches[1],l=this.getPinchDistance(n,s);if(this.initialPinchDistance===0){this.initialPinchDistance=l;return}const r=l/this.initialPinchDistance,a=Math.max(1,Math.min(this.pinchZoomLevel*r,ge));if(this.initialPinchDistance=l,this.pinchZoomLevel=a,!this.canvas)return;const c=this.canvas.getBoundingClientRect(),h=c.width/2*this.devicePixelRatio,u=c.height/2*this.devicePixelRatio;a>1?(this.isZoomed=!0,this.hideAllIcons(),this.updateView(a,h,u),(!this.pinchZoomEmitted||a>this.lastEmittedZoom)&&(this.emit("onZoomIn",{zoomLevel:a}),this.pinchZoomEmitted=!0,this.lastEmittedZoom=a)):(this.isZoomed=!1,this.panOffsetX=0,this.panOffsetY=0,this.updateView());return}if(!this.isClicked||!t.touches||!t.touches[0])return;const{pageX:i,pageY:o}=t.touches[0];if(t.preventDefault(),this.isZoomed&&this.pinchZoomLevel>1){const n=i-this.movementStart.x,s=o-this.movementStart.y;this.panOffsetX-=n*this.devicePixelRatio,this.panOffsetY-=s*this.devicePixelRatio,this.movementStart={x:i,y:o},this.updateView(this.pinchZoomLevel,this.panOffsetX,this.panOffsetY);return}this.drag(i,o)}keyDown(t){if(!this.isReady)return;const{keyCode:i}=t,o=this.keysReverse;switch(this.autoplay&&this.stopAutoplay(),Le(i,this.allowSpinY)&&(this.hasInteracted=!0,this.hideAllIcons(),this.hideHints()),i){case 37:o?this.moveLeft():this.moveRight();break;case 39:o?this.moveRight():this.moveLeft();break;case 38:this.allowSpinY&&(t.preventDefault(),o?this.moveTop():this.moveBottom());break;case 40:this.allowSpinY&&(t.preventDefault(),o?this.moveBottom():this.moveTop());break}}keyUp(t){const{keyCode:i}=t;Le(i,this.allowSpinY)&&this.showAllIcons()}moveActiveXIndexUp(t){this.orientation=Y.X,this.activeImageX=(this.activeImageX+t)%this.amountX}moveActiveXIndexDown(t){this.orientation=Y.X,this.activeImageX=(this.activeImageX-t+this.amountX)%this.amountX}moveActiveYIndexUp(t){this.orientation=Y.Y,this.activeImageY=(this.activeImageY+t)%this.amountY}moveActiveYIndexDown(t){this.orientation=Y.Y,this.activeImageY=(this.activeImageY-t+this.amountY)%this.amountY}moveRight(t,i=1){t&&this.activeImageX>=this.imagesX.length-1||(this.moveActiveXIndexUp(i),this.isZoomed||this.updateView())}moveLeft(t,i=1){t&&this.activeImageX<=0||(this.moveActiveXIndexDown(i),this.isZoomed||this.updateView())}moveTop(t,i=1){t&&this.activeImageY>=this.imagesY.length-1||(this.moveActiveYIndexUp(i),this.isZoomed||this.updateView())}moveBottom(t,i=1){t&&this.activeImageY<=0||(this.moveActiveYIndexDown(i),this.isZoomed||this.updateView())}onMoveHandler(t,i=1,o=1){t==="right"?this.moveRight(this.stopAtEdges,i):t==="left"?this.moveLeft(this.stopAtEdges,i):t==="up"?this.moveTop(this.stopAtEdges,o):t==="down"&&this.moveBottom(this.stopAtEdges,o),this.emit("onSpin",{direction:t,activeImageX:this.activeImageX,activeImageY:this.activeImageY,amountX:this.amountX,amountY:this.amountY})}updateView(t,i,o){const n=this.orientation===Y.X?this.activeImageX:this.activeImageY,s=this.orientation===Y.X?this.imagesX[this.activeImageX]:this.imagesY[this.activeImageY];this.hotspotsInstance&&!this.isZoomed&&!this.autoplay&&this.hotspotsInstance.updateHotspotPosition(n,this.orientation),this.hotspotTimelineIndicator&&this.orientation===Y.X&&this.updateHotspotTimelinePosition(),this.drawImageOnCanvas(s,t,i,o)}updatePercentageInLoader(t=0){this.loader&&(this.loader.innerText=t+"%")}adaptCanvasSize(t){const{naturalWidth:i,naturalHeight:o}=t;this.imageAspectRatio=i/o;const n=this.fullscreenView?window.innerWidth:this.canvas.clientWidth,s=this.fullscreenView?window.innerHeight:this.canvas.clientHeight;this.canvasWorker.postMessage({action:"adaptCanvasSize",devicePixelRatio:this.devicePixelRatio,imageAspectRatio:this.imageAspectRatio,containerWidth:n,containerHeight:s})}drawImageOnCanvas(t,i=1,o=0,n=0){this.canvasWorker.postMessage({action:"drawImageOnCanvas",imageData:t,zoomScale:i,pointerX:o,pointerY:n})}pushImageToSet(t,i,o){o===Y.X?this.imagesX[i]=t:this.imagesY[i]=t}calculatePercentage(){const t=this.amountX+this.amountY,i=this.imagesX.length+this.imagesY.length;return Math.round(i/t*100)}onImageLoad(t,i,o){this.pushImageToSet(t,i,o),this.updatePercentageInLoader(this.calculatePercentage())}onFirstImageLoaded(t,i){this.createContainers(t),this.adaptCanvasSize(i),this.drawImageOnCanvas(i)}onAllImagesLoaded(){if(this.addAllIcons(),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.hotspots&&(this.hotspotsInstance=new Gn(this.hotspots,this.innerBox,this.imageAspectRatio),this.addHotspotTimeline(),this.showHotspotTimeline()),this.emit("onLoad",{imagesX:this.imagesX.length,imagesY:this.imagesY.length}),this.emit("onReady"),this.announce("360 degree view loaded. Use mouse drag or arrow keys to rotate."),this.hints!==!1&&!this.autoplay){const t=this.hints===!0||this.hints===void 0?Ce(this.viewerConfig,this.touchDevice):this.hints;t&&t.length>0&&(this.hintsOverlay=Ie(this.innerBox,t),ke(this.hintsOverlay))}this.autoplay&&(this.hideAllIcons(),Eo(this.play.bind(this))())}magnify(t){t.stopPropagation();const{src:i}=this.orientation===Y.Y?this.imagesY[this.activeImageY]:this.imagesX[this.activeImageX],n=(this.fullscreenView?document.body:this.container).offsetWidth*this.magnifier,s=Pi(i,n);this.showLoadingSpinner(),this.createGlass(),vo(s,a=>{this.hideLoadingSpinner(),this.magnified=!0,bo(t,this.innerBox,this.offset,a,this.glass,this.magnifier)},a=>{this.hideLoadingSpinner(),this.removeGlass(),this.emit("onError",{error:{message:a.message,url:a.url},errorCount:1,totalImages:1,errors:[{message:a.message,url:a.url}]})})}openFullscreenModal(t){t.stopPropagation(),window.document.body.style.overflow="hidden";const i=$i(this.container);new Ft(i,this.viewerConfig,!0),this.emit("onFullscreenOpen"),this.announce("Opened fullscreen mode. Press Escape to exit.")}closeFullscreenModal(t){t.stopPropagation(),document.body.removeChild(this.container.parentNode),window.document.body.style.overflow="visible",this.emit("onFullscreenClose"),this.announce("Exited fullscreen mode")}play(){if(this.isClicked)return;this.hide360ViewCircleIcon(),this.emit("onAutoplayStart");const t=this.speed*36/(this.amountX+this.amountY),i={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&&xo({autoplayBehavior:this.autoplayBehavior,activeImageX:this.activeImageX,activeImageY:this.activeImageY,amountX:this.amountX,amountY:this.amountY,autoplayReverse:this.autoplayReverse})){this.stopAutoplay();return}Io({autoplayBehavior:this.autoplayBehavior,activeImageX:this.activeImageX,activeImageY:this.activeImageY,amountX:this.amountX,amountY:this.amountY,autoplayReverse:this.autoplayReverse,spinDirection:this.spinDirection})&&(this.spinDirection=ko(this.spinDirection));const s=this.spinDirection==="y";wo({autoplayBehavior:this.autoplayBehavior,spinY:s,reversed:this.autoplayReverse,loopTriggers:i})},t)}stopAutoplay(){if(this.showAllIcons(),this.autoplay=!1,window.clearTimeout(this.loopTimeoutId),this.loopTimeoutId=null,this.emit("onAutoplayStop"),this.hints!==!1&&!this.hintsOverlay&&!this.hintsHidden){const t=this.hints===!0?Ce(this.viewerConfig,this.touchDevice):this.hints;t&&t.length>0&&(this.hintsOverlay=Ie(this.innerBox,t),ke(this.hintsOverlay))}}destroy(){this.stopAutoplay(),this.inertiaAnimationId&&(cancelAnimationFrame(this.inertiaAnimationId),this.inertiaAnimationId=null),this.removeEvents(),this.canvasWorker&&(this.canvasWorker.terminate(),this.canvasWorker=null),this.hotspotsInstance&&this.hotspotsInstance.destroy(),this.hintsOverlay&&this.hintsOverlay.parentNode&&(this.hintsOverlay.parentNode.removeChild(this.hintsOverlay),this.hintsOverlay=null),this.hotspotTimeline&&this.hotspotTimeline.parentNode&&(this.hotspotTimeline.parentNode.removeChild(this.hotspotTimeline),this.hotspotTimeline=null,this.hotspotTimelineIndicator=null),this.container&&(this.container.classList.remove("ci360-theme-dark"),this.container.innerHTML="")}addInitialIcon(){this.initialIcon||this.hide360Logo||(this.initialIcon=Bi(this.logoSrc),this.innerBox.appendChild(this.initialIcon))}showInitialIcon(){!this.initialIcon||this.hasInteracted||(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=Vi(),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=zi(),this.fullscreenIcon.onclick=this.openFullscreenModal.bind(this),this.iconsContainer.appendChild(this.fullscreenIcon))}addCloseFullscreenIcon(){this.fullscreenCloseIcon=Fi(),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=Di(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=Gi(),this.innerBox.appendChild(this.loadingSpinner)}showLoadingSpinner(){this.loadingSpinner&&(this.hideAllIcons(),this.loadingSpinner.style.opacity=1)}createTransitionOverlay(){this.transitionOverlay=Ui(),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)}hideHints(){!this.hintsOverlay||this.hintsHidden||(this.hintsHidden=!0,to(this.hintsOverlay))}addHotspotTimeline(){if(!this.hotspots||this.hotspotTimeline)return;const t=so(this.container,this.amountX,this.hotspots);if(!t)return;this.hotspotTimeline=t.element,this.hotspotTimelineIndicator=t.indicator,this.hotspotTimeline.querySelectorAll(".cloudimage-360-hotspot-timeline-dot").forEach(o=>{o.addEventListener("click",n=>{n.stopPropagation();const s=parseInt(o.getAttribute("data-frame"),10),l=o.getAttribute("data-hotspot-id");isNaN(s)||this.animateToFrame(s,l)})}),this.updateHotspotTimelinePosition()}showHotspotTimeline(){ao(this.hotspotTimeline)}hideHotspotTimeline(){lo(this.hotspotTimeline)}updateHotspotTimelinePosition(){ro(this.hotspotTimelineIndicator,this.activeImageX,this.amountX)}animateToFrame(t,i){if(this.isAnimatingToFrame||t===this.activeImageX){t===this.activeImageX&&i&&this.hotspotsInstance&&this.hotspotTimelineOnClick&&this.hotspotsInstance.showHotspotById(i);return}this.isAnimatingToFrame=!0,this.hasInteracted=!0,(this.autoplay||this.loopTimeoutId)&&(this.stopAutoplay(),this.autoplay=!1),this.inertiaAnimationId&&(cancelAnimationFrame(this.inertiaAnimationId),this.inertiaAnimationId=null);const o=this.activeImageX,n=(t-o+this.amountX)%this.amountX,s=(o-t+this.amountX)%this.amountX,l=n<=s,r=l?n:s;if(r===0){this.isAnimatingToFrame=!1;return}const a=30;let c=r;const h=()=>{if(c<=0){this.isAnimatingToFrame=!1,i&&this.hotspotsInstance&&this.hotspotTimelineOnClick&&setTimeout(()=>{this.hotspotsInstance.showHotspotById(i)},50);return}l?this.moveRight():this.moveLeft(),c--,c>0?setTimeout(h,a):(this.isAnimatingToFrame=!1,i&&this.hotspotsInstance&&this.hotspotTimelineOnClick&&setTimeout(()=>{this.hotspotsInstance.showHotspotById(i)},50))};h()}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(),this.showHotspotTimeline()}hideAllIcons(){this.hideInitialIcon(),this.hide360ViewCircleIcon(),this.hideMagnifierIcon(),this.hideFullscreenIcon(),this.hideHotspotTimeline()}removeLoader(){this.loader&&(this.innerBox.removeChild(this.loader),this.loader=null)}attachEvents(t,i,o){t&&this.addMouseEvents(),i&&this.addTouchEvents(),o&&this.addKeyboardEvents(),this.addEscKeyHandler()}removeEvents(){this.removeMouseEvents(),this.removeTouchEvents(),this.removeKeyboardEvents(),this.removeEscKeyHandler()}addMouseEvents(){this.boundMouseClick=this.mouseClick.bind(this),this.boundMouseDown=this.mouseDown.bind(this),this.boundMouseMove=ue(this.mouseMove.bind(this),fe),this.boundMouseUp=this.mouseUp.bind(this),this.boundMouseLeave=this.mouseLeave.bind(this),this.innerBox.addEventListener("click",this.boundMouseClick),this.innerBox.addEventListener("mousedown",this.boundMouseDown),this.innerBox.addEventListener("mouseleave",this.boundMouseLeave),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=ue(this.touchMove.bind(this),fe),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)}addEscKeyHandler(){this.boundEscHandler=t=>{t.keyCode===27&&(this.fullscreenView?this.closeFullscreenModal(t):this.isZoomed?this.removeZoom():this.glass&&this.removeGlass())},document.addEventListener("keydown",this.boundEscHandler)}removeEscKeyHandler(){document.removeEventListener("keydown",this.boundEscHandler)}removeMouseEvents(){this.innerBox.removeEventListener("click",this.boundMouseClick),this.innerBox.removeEventListener("mousedown",this.boundMouseDown),this.innerBox.removeEventListener("mouseleave",this.boundMouseLeave),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(t){this.iconsContainer=we(this.innerBox),this.canvas=Wi(this.innerBox,t),this.loader=ji(this.innerBox),this.ariaLiveRegion=Ki(this.innerBox);const i=this.canvas.transferControlToOffscreen();this.canvasWorker.postMessage({action:"initCanvas",offscreen:i,devicePixelRatio:this.devicePixelRatio},[i]),this.fullscreenView&&this.addCloseFullscreenIcon(),$t(this.innerBox,".cloudimage-360-placeholder")}update(t){this.isReady&&(this.stopAutoplay(),$t(this.innerBox,".cloudimage-360-icons-container"),this.init(this.container,t,!0),this.iconsContainer=we(this.innerBox),this.onAllImagesLoaded())}init(t,i,o){const n=i?Ai(i):Ei(t),{folder:s,apiVersion:l,filenameX:r,filenameY:a,imageListX:c,imageListY:h,indexZeroBase:u,amountX:f,amountY:p,draggable:x=!0,swipeable:g=!0,keys:v,keysReverse:m,bottomCircleOffset:y,autoplay:I,autoplayBehavior:w,playOnce:C,speed:b,autoplayReverse:k,fullscreen:E,magnifier:O,ciToken:S,ciFilters:L,ciTransformation:M,lazyload:T,dragSpeed:U,stopAtEdges:_,pointerZoom:P,imageInfo:B="black",initialIconShown:ut,bottomCircle:K,hotspots:ft,dragReverse:St,hide360Logo:nt,logoSrc:mt,inertia:et,pinchZoom:$,hints:st,theme:rt,hotspotTimelineOnClick:J=!0,aspectRatio:vt,onReady:ne,onLoad:At,onSpin:se,onAutoplayStart:zt,onAutoplayStop:re,onFullscreenOpen:ae,onFullscreenClose:Nt,onZoomIn:Vt,onZoomOut:le,onDragStart:ce,onDragEnd:Q,onError:gt}=n,Lt={ciToken:S,ciFilters:L,ciTransformation:M},bt=Gt(c,[]),at=Gt(h,[]);if(this.viewerConfig=n,this.amountX=bt.length||f,this.amountY=at.length||p,this.allowSpinX=!!this.amountX,this.allowSpinY=!!this.amountY,this.activeImageX=k?this.amountX-1:0,this.activeImageY=k?this.amountY-1:0,this.bottomCircleOffset=y,this.autoplay=I,this.autoplayBehavior=w,this.playOnce=C,this.speed=b,this.autoplayReverse=k,this.fullscreen=E,this.magnifier=O>1?Math.min(O,Oi):0,this.dragSpeed=Math.max(U,ki),this.stopAtEdges=_,this.ciParams=Lt,this.apiVersion=l,this.pointerZoom=P>1?Math.min(P,ge):null,this.keysReverse=m,this.info=B,this.keys=v,this.innerBox=this.innerBox??Ni(this.container),vt&&(this.container.style.aspectRatio=vt),this.initialIconShown=ut,this.bottomCircle=K,this.spinDirection=Co(this.autoplayBehavior,this.allowSpinX,this.allowSpinY),this.dragReverse=St,this.hotspots=ft,this.hide360Logo=nt,this.logoSrc=mt,this.inertia=et,this.pinchZoom=$,this.hints=st,this.hotspotTimelineOnClick=J,rt==="dark"?this.container.classList.add("ci360-theme-dark"):rt==="light"&&this.container.classList.remove("ci360-theme-dark"),this.onReady=ne,this.onLoad=At,this.onSpin=se,this.onAutoplayStart=zt,this.onAutoplayStop=re,this.onFullscreenOpen=ae,this.onFullscreenClose=Nt,this.onZoomIn=Vt,this.onZoomOut=le,this.onDragStart=ce,this.onDragEnd=Q,this.onError=gt,this.srcXConfig={folder:s,filename:r,imageList:bt,container:t,innerBox:this.innerBox,apiVersion:l,ciParams:Lt,lazyload:T,amount:this.amountX,indexZeroBase:u,autoplayReverse:k,orientation:Y.X},this.srcYConfig={...this.srcXConfig,filename:a,imageList:at,orientation:Y.Y,amount:this.amountY},o&&this.removeEvents(),this.attachEvents(x,g,v),o)return;const Tt=(this.fullscreenView?document.body:this.container).offsetWidth,Yt=this.allowSpinX&&!bt.length?yt(this.srcXConfig,Tt):null,Xt=this.allowSpinY&&!at.length?yt(this.srcYConfig,Tt):null,Pt=Un=>{ye({cdnPathX:Yt,cdnPathY:Xt,configX:this.srcXConfig,configY:this.srcYConfig,onImageLoad:(Rt,_n,Kn)=>this.onImageLoad(Rt,_n,Kn),onFirstImageLoad:Rt=>this.onFirstImageLoaded(Un,Rt),onAllImagesLoad:this.onAllImagesLoaded.bind(this),onError:Rt=>this.emit("onError",Rt)})};this.allowSpinX?Ee(Yt,this.srcXConfig,Pt):this.allowSpinY&&Ee(Xt,this.srcYConfig,Pt)}}class Qe{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(t,i,o){if(!t)return;const n=t.id||this.generateId();t.id||(t.id=n);const s=new Ft(t,i,o);return this.views.set(n,s),s}initAll(t="cloudimage-360"){[...document.querySelectorAll(`.${t}`)].filter(Boolean).forEach(o=>{const n=o.id||this.generateId();o.id||(o.id=n);const s=new Ft(o);this.views.set(n,s)})}destroy(t){const i=this.getViewById(t);i&&(i.destroy(),this.views.delete(t))}destroyAll(){this.views.forEach(t=>{t.destroy()}),this.views.clear()}getViewById(t){return this.views.get(t)}getViews(){return Array.from(this.views.values())}updateView(t,i){const o=this.getViewById(t);if(!o)return null;const n={...o.viewerConfig,...i};o.destroy();const s=document.getElementById(t);return this.init(s,n)}}return window.CI360=Qe,Qe}();
|
|
35
|
+
`,o},Ee=(e,t,i)=>{const{innerBox:o,imageList:n,lazyload:s}=t||{},[l]=n,r=l||mo(e,t),a=ho(r),c=Oe(a,s,"cloudimage-lazy"),h=Oe(a,!1,"cloudimage-360-placeholder"),u=f=>{$t(o,".cloudimage-lazy"),i&&i({event:f,width:c.width,height:c.height,naturalWidth:c.naturalWidth,naturalHeight:c.naturalHeight,src:a})};c.onload=u,o.appendChild(c),o.appendChild(h),po(c)},vo=(e,t,i)=>{const o=new Image;o.src=e,o.onload=n=>{t&&t({event:n,width:o.width,height:o.height,naturalWidth:o.naturalWidth,naturalHeight:o.naturalHeight,src:e})},o.onerror=n=>{const s=new Error(`Failed to load image: ${e}`);s.url=e,s.event=n,i?i(s):console.error(s.message)}},go=(e,t)=>{const i=t.getBoundingClientRect(),o=e.touches?e.touches[0].clientX:e.clientX,n=e.touches?e.touches[0].clientY:e.clientY;return{x:o-i.left,y:n-i.top}},Ut=(e,t,i)=>{const{container:o,w:n,h:s,zoom:l,bw:r,offsetX:a,offsetY:c}=t,h=go(e,o);let u=h.x,f=h.y;u=Math.max(n/l,Math.min(u,o.offsetWidth-n/l)),f=Math.max(s/l,Math.min(f,o.offsetHeight-s/l)),i.style.left=`${u-n}px`,i.style.top=`${f-s}px`;const p=(u-a)*l-n+r,x=(f-c)*l-s+r;i.style.backgroundPosition=`-${p}px -${x}px`},bo=(e,t,i,o,n,s)=>{const{x:l=0,y:r=0}=i||{},a=(t.offsetWidth-l*2)*s,c=(t.offsetHeight-r*2)*s;if(!n)return;n.setAttribute("class","cloudimage-360-img-magnifier-glass"),t.prepend(n),n.style.backgroundImage=`url('${o.src}')`,n.style.backgroundSize=`${a}px ${c}px`;const h=3,u=n.offsetWidth/2,f=n.offsetHeight/2,p={container:t,w:u,h:f,zoom:s,bw:h,offsetX:l,offsetY:r};Ut(e,p,n);const x=v=>{Ut(v,p,n)},g=v=>{v.preventDefault(),Ut(v,p,n)};n.addEventListener("mousemove",x),t.addEventListener("mousemove",x),t.addEventListener("touchmove",g)},yo=(e,t,i)=>{const{clientX:o,clientY:n}=e,s=t.getBoundingClientRect(),l=t.width/(s.width*i),r=t.height/(s.height*i),a=(o-s.left)*l,c=(n-s.top)*r;return{offsetX:a,offsetY:c}},Se=(e,{bottom:t,top:i})=>{e?t():i()},Ae=(e,{left:t,right:i})=>{e?t():i()},wo=({autoplayBehavior:e,spinY:t,reversed:i,loopTriggers:o})=>{switch(e){case R.SPIN_XY:case R.SPIN_YX:t?Se(i,o):Ae(i,o);break;case R.SPIN_Y:Se(i,o);break;case R.SPIN_X:default:Ae(i,o)}},xo=({autoplayBehavior:e,activeImageX:t,activeImageY:i,amountX:o,amountY:n,autoplayReverse:s})=>{const l=(r,a)=>{const c=a-1;return s?r===0:r===c};switch(e){case R.SPIN_XY:case R.SPIN_Y:return l(i,n);case R.SPIN_X:case R.SPIN_YX:default:return l(t,o)}},Io=({autoplayBehavior:e,activeImageX:t,activeImageY:i,amountX:o,amountY:n,autoplayReverse:s,spinDirection:l})=>{const r=t===(s?0:o-1),a=i===(s?0:n-1);return e===R.SPIN_XY||e===R.SPIN_YX?l==="x"&&r||l==="y"&&a:!1},Co=(e,t,i)=>{if(!i)return"x";if(!t)return"y";switch(e){case R.SPIN_XY:return"x";case R.SPIN_YX:return"y";case R.SPIN_Y:return"y";case R.SPIN_X:default:return"x"}},ko=e=>e==="x"?"y":"x",Le=(e,t)=>{const i=[...yi];return t?[...i,...wi].includes(e):i.includes(e)},Te=({deltaX:e,deltaY:t,reversed:i,allowSpinX:o,allowSpinY:n,threshold:s=0})=>{const l=o&&!n||n&&!o?0:s,r=Math.abs(e),a=Math.abs(t);return o&&r-l>a?i?e>0?"left":"right":e>0?"right":"left":n&&a-l>r?i?t>0?"up":"down":t>0?"down":"up":null},Oo=()=>"ontouchstart"in window||navigator.maxTouchPoints>0||navigator.msMaxTouchPoints>0,Eo=(e,t=150)=>{let i;return function(...o){clearTimeout(i),i=setTimeout(()=>{e.apply(this,o)},t)}},Ye="KGZ1bmN0aW9uKCl7InVzZSBzdHJpY3QiO2NvbnN0IHY9KHQsYSxlKT0+e2NvbnN0IHM9dC9lLG49YS9lO3JldHVybnt6b29tZWRXaWR0aDpzLHpvb21lZEhlaWdodDpufX0sej0oe3BvaW50ZXJYOnQscG9pbnRlclk6YSxpbWFnZURhdGE6ZSx6b29tZWRXaWR0aDpzLHpvb21lZEhlaWdodDpuLGRyYXdXaWR0aDppLGRyYXdIZWlnaHQ6Y30pPT57Y29uc3R7bmF0dXJhbFdpZHRoOmcsbmF0dXJhbEhlaWdodDp1fT1lO2xldCBmPXQvaSpnLXMvMixtPWEvYyp1LW4vMjtjb25zdCB4PU1hdGgubWF4KDAsZy1zKSxPPU1hdGgubWF4KDAsdS1uKTtyZXR1cm4gZj1NYXRoLm1heCgwLE1hdGgubWluKGYseCkpLG09TWF0aC5tYXgoMCxNYXRoLm1pbihtLE8pKSx7em9vbU9mZnNldFg6Zix6b29tT2Zmc2V0WTptfX07bGV0IG8saCxyLGQsbCx3O3NlbGYub25tZXNzYWdlPWFzeW5jIHQ9Pntjb25zdHthY3Rpb246YSxvZmZzY3JlZW46ZSxkZXZpY2VQaXhlbFJhdGlvOnMsaW1hZ2VEYXRhOm4sem9vbVNjYWxlOmkscG9pbnRlclg6Yyxwb2ludGVyWTpnLGltYWdlQXNwZWN0UmF0aW86dSxjb250YWluZXJXaWR0aDpmLGNvbnRhaW5lckhlaWdodDptfT10LmRhdGE7c3dpdGNoKGEpe2Nhc2UiaW5pdENhbnZhcyI6QyhlLHMpO2JyZWFrO2Nhc2UiYWRhcHRDYW52YXNTaXplIjpwKHUsZixtKTticmVhaztjYXNlImRyYXdJbWFnZU9uQ2FudmFzIjpJKG4saSxjLGcpO2JyZWFrfX07Y29uc3QgQz0odCxhKT0+e289dCxoPW8uZ2V0Q29udGV4dCgiMmQiKSxyPWF9LHA9KHQsYSxlKT0+e2NvbnN0IHM9YS9lO3c9dD5zLG8ud2lkdGg9YSpyLG8uaGVpZ2h0PWUqcixoLnNjYWxlKHIsciksdz8oZD1hLGw9YS90KToobD1lLGQ9ZSp0KSxoLmltYWdlU21vb3RoaW5nRW5hYmxlZD0hMCxoLmltYWdlU21vb3RoaW5nUXVhbGl0eT0iaGlnaCJ9LEk9KHQ9e30sYT0xLGU9MCxzPTApPT57Y29uc3R7Yml0bWFwSW1hZ2U6bn09dDtpZighb3x8IW4pcmV0dXJuO2xldCBpLGM7aWYodz8oaT0wLGM9KG8uaGVpZ2h0L3ItbCkvMik6KGk9KG8ud2lkdGgvci1kKS8yLGM9MCksaC5jbGVhclJlY3QoMCwwLG8ud2lkdGgsby5oZWlnaHQpLGEhPT0xKXtjb25zdHtuYXR1cmFsV2lkdGg6ZyxuYXR1cmFsSGVpZ2h0OnV9PXQse3pvb21lZFdpZHRoOmYsem9vbWVkSGVpZ2h0Om19PXYoZyx1LGEpLHt6b29tT2Zmc2V0WDp4LHpvb21PZmZzZXRZOk99PXooe3BvaW50ZXJYOmUscG9pbnRlclk6cyxpbWFnZURhdGE6dCx6b29tZWRXaWR0aDpmLHpvb21lZEhlaWdodDptLGRyYXdXaWR0aDpkLGRyYXdIZWlnaHQ6bH0pO2guZHJhd0ltYWdlKG4seCxPLGYsbSxpLGMsZCxsKX1lbHNlIGguZHJhd0ltYWdlKG4saSxjLGQsbCl9fSkoKTsK",So=e=>Uint8Array.from(atob(e),t=>t.charCodeAt(0)),Xe=typeof self<"u"&&self.Blob&&new Blob([So(Ye)],{type:"text/javascript;charset=utf-8"});function Ao(e){let t;try{if(t=Xe&&(self.URL||self.webkitURL).createObjectURL(Xe),!t)throw"";const i=new Worker(t,{name:e==null?void 0:e.name});return i.addEventListener("error",()=>{(self.URL||self.webkitURL).revokeObjectURL(t)}),i}catch{return new Worker("data:text/javascript;base64,"+Ye,{name:e==null?void 0:e.name})}finally{t&&(self.URL||self.webkitURL).revokeObjectURL(t)}}const Lo=new Set(["p","span","div","br","hr","strong","em","b","i","u","s","h1","h2","h3","h4","h5","h6","ul","ol","li","a","img","button","table","thead","tbody","tr","th","td","blockquote","pre","code","label","input","select","option","textarea","svg","path","circle","rect","line","polyline","polygon","ellipse","g","text","tspan","defs","use","symbol","clippath","mask","lineargradient","radialgradient","stop"]),Pe={a:["href","title","target","rel"],img:["src","alt","title","width","height"],button:["type","disabled","name","value"],input:["type","name","value","placeholder","disabled","readonly","checked","min","max","step"],select:["name","disabled","multiple"],option:["value","disabled","selected"],textarea:["name","placeholder","disabled","readonly","rows","cols"],label:["for"],svg:["viewbox","width","height","fill","stroke","xmlns","preserveaspectratio"],path:["d","fill","stroke","stroke-width","stroke-linecap","stroke-linejoin","transform"],circle:["cx","cy","r","fill","stroke","stroke-width"],rect:["x","y","width","height","rx","ry","fill","stroke","stroke-width"],line:["x1","y1","x2","y2","stroke","stroke-width"],polyline:["points","fill","stroke","stroke-width"],polygon:["points","fill","stroke","stroke-width"],ellipse:["cx","cy","rx","ry","fill","stroke","stroke-width"],g:["transform","fill","stroke"],text:["x","y","dx","dy","text-anchor","fill","font-size","font-family","font-weight"],tspan:["x","y","dx","dy"],use:["href","xlink:href","x","y","width","height"],lineargradient:["id","x1","y1","x2","y2","gradientunits"],radialgradient:["id","cx","cy","r","fx","fy","gradientunits"],stop:["offset","stop-color","stop-opacity"],clippath:["id"],mask:["id"],"*":["class","id","style"]},To=[/javascript:/gi,/vbscript:/gi,/data:/gi,/on\w+\s*=/gi],Yo=e=>{if(typeof e!="string")return"";const t=document.createElement("template");t.innerHTML=e;const i=o=>{if(Array.from(o.childNodes).forEach(i),o.nodeType===Node.ELEMENT_NODE){const s=o.tagName.toLowerCase();if(!Lo.has(s)){if(s==="script"||s==="style"){o.remove();return}const a=document.createTextNode(o.textContent);o.parentNode.replaceChild(a,o);return}const l=[...Pe[s]||[],...Pe["*"]||[]];if(Array.from(o.attributes).forEach(a=>{const c=a.name.toLowerCase();if(c.startsWith("on")){o.removeAttribute(a.name);return}if(!l.includes(c)){o.removeAttribute(a.name);return}let h=a.value;To.forEach(u=>{u.test(h)&&o.removeAttribute(a.name)})}),s==="a"){const a=o.getAttribute("href");a&&(/^(https?:|mailto:|tel:|#|\/)/i.test(a.trim())||o.removeAttribute("href")),o.getAttribute("target")==="_blank"&&o.setAttribute("rel","noopener noreferrer")}if(s==="img"){const a=o.getAttribute("src");a&&(/^(https?:|\/|data:image\/)/i.test(a.trim())||o.removeAttribute("src"))}}};return i(t.content),t.innerHTML},Xo=e=>e==="x"?Y.X:Y.Y,Po=(e,t,i)=>e.filter(o=>Xo(o.orientation)===i&&t in o.positions),Ro=(e,t)=>{const i=document.createElement("button");return i.id=e,i.className="cloudimage-360-hotspot",i.dataset.hotspotId=e,i.setAttribute("type","button"),i.setAttribute("aria-label",t||`Hotspot ${e}`),i.setAttribute("aria-haspopup","true"),i.setAttribute("aria-expanded","false"),i},Mo=e=>{const t=Object.entries(e).sort(([s],[l])=>Number(s)-Number(l));let i=null,o=null;const n={};for(const[s,l]of t)if(!l)n[s]={x:i,y:o};else{const{x:r,y:a}=l;r!=null&&(i=r),a!=null&&(o=a),n[s]={x:r||i,y:a||o}}return n},Ho=e=>[{name:"offset",options:{offset:[0,10]}},{name:"preventOverflow",options:{boundary:e}}],Do=(e,t)=>{const i=document.createElement("div");return i.className="cloudimage-360-popper",i.id=`cloudimage-360-popper-${t}`,i.dataset.popperId=t,i.setAttribute("role","tooltip"),i.setAttribute("aria-hidden","false"),typeof e=="string"&&/<\/?[a-z][\s\S]*>/i.test(e)?i.innerHTML=Yo(e):i.textContent=e,document.body.appendChild(i),i},Zo=e=>{const t=[...e];return t.forEach((i,o)=>{const n={...Mo(i.positions)};t[o].initialPositions=n,t[o].positions=n}),t},Bo=({newWidth:e,newHeight:t,initialContainerSize:i,imageAspectRatio:o,hotspotsConfig:n})=>{const[s,l]=i;let r=e,a=t,c=0,h=0;const u=e/t;o>u?(a=e/o,h=(t-a)/2):(r=t*o,c=(e-r)/2);const p=r/s,x=a/l;return n.map(g=>{const v={};return Object.entries(g.initialPositions).forEach(([m,y])=>{v[m]={x:y.x*p+c,y:y.y*x+h}}),{...g,positions:v}})};var H="top",F="bottom",z="right",D="left",_t="auto",wt=[H,F,z,D],ct="start",xt="end",Wo="clippingParents",Re="viewport",It="popper",Fo="reference",Me=wt.reduce(function(e,t){return e.concat([t+"-"+ct,t+"-"+xt])},[]),He=[].concat(wt,[_t]).reduce(function(e,t){return e.concat([t,t+"-"+ct,t+"-"+xt])},[]),zo="beforeRead",No="read",Vo="afterRead",jo="beforeMain",$o="main",Go="afterMain",Uo="beforeWrite",_o="write",Ko="afterWrite",Jo=[zo,No,Vo,jo,$o,Go,Uo,_o,Ko];function V(e){return e?(e.nodeName||"").toLowerCase():null}function Z(e){if(e==null)return window;if(e.toString()!=="[object Window]"){var t=e.ownerDocument;return t&&t.defaultView||window}return e}function it(e){var t=Z(e).Element;return e instanceof t||e instanceof Element}function N(e){var t=Z(e).HTMLElement;return e instanceof t||e instanceof HTMLElement}function Kt(e){if(typeof ShadowRoot>"u")return!1;var t=Z(e).ShadowRoot;return e instanceof t||e instanceof ShadowRoot}function Qo(e){var t=e.state;Object.keys(t.elements).forEach(function(i){var o=t.styles[i]||{},n=t.attributes[i]||{},s=t.elements[i];!N(s)||!V(s)||(Object.assign(s.style,o),Object.keys(n).forEach(function(l){var r=n[l];r===!1?s.removeAttribute(l):s.setAttribute(l,r===!0?"":r)}))})}function qo(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(o){var n=t.elements[o],s=t.attributes[o]||{},l=Object.keys(t.styles.hasOwnProperty(o)?t.styles[o]:i[o]),r=l.reduce(function(a,c){return a[c]="",a},{});!N(n)||!V(n)||(Object.assign(n.style,r),Object.keys(s).forEach(function(a){n.removeAttribute(a)}))})}}const tn={name:"applyStyles",enabled:!0,phase:"write",fn:Qo,effect:qo,requires:["computeStyles"]};function j(e){return e.split("-")[0]}var ot=Math.max,Dt=Math.min,ht=Math.round;function Jt(){var e=navigator.userAgentData;return e!=null&&e.brands&&Array.isArray(e.brands)?e.brands.map(function(t){return t.brand+"/"+t.version}).join(" "):navigator.userAgent}function De(){return!/^((?!chrome|android).)*safari/i.test(Jt())}function dt(e,t,i){t===void 0&&(t=!1),i===void 0&&(i=!1);var o=e.getBoundingClientRect(),n=1,s=1;t&&N(e)&&(n=e.offsetWidth>0&&ht(o.width)/e.offsetWidth||1,s=e.offsetHeight>0&&ht(o.height)/e.offsetHeight||1);var l=it(e)?Z(e):window,r=l.visualViewport,a=!De()&&i,c=(o.left+(a&&r?r.offsetLeft:0))/n,h=(o.top+(a&&r?r.offsetTop:0))/s,u=o.width/n,f=o.height/s;return{width:u,height:f,top:h,right:c+u,bottom:h+f,left:c,x:c,y:h}}function Qt(e){var t=dt(e),i=e.offsetWidth,o=e.offsetHeight;return Math.abs(t.width-i)<=1&&(i=t.width),Math.abs(t.height-o)<=1&&(o=t.height),{x:e.offsetLeft,y:e.offsetTop,width:i,height:o}}function Ze(e,t){var i=t.getRootNode&&t.getRootNode();if(e.contains(t))return!0;if(i&&Kt(i)){var o=t;do{if(o&&e.isSameNode(o))return!0;o=o.parentNode||o.host}while(o)}return!1}function G(e){return Z(e).getComputedStyle(e)}function en(e){return["table","td","th"].indexOf(V(e))>=0}function tt(e){return((it(e)?e.ownerDocument:e.document)||window.document).documentElement}function Zt(e){return V(e)==="html"?e:e.assignedSlot||e.parentNode||(Kt(e)?e.host:null)||tt(e)}function Be(e){return!N(e)||G(e).position==="fixed"?null:e.offsetParent}function on(e){var t=/firefox/i.test(Jt()),i=/Trident/i.test(Jt());if(i&&N(e)){var o=G(e);if(o.position==="fixed")return null}var n=Zt(e);for(Kt(n)&&(n=n.host);N(n)&&["html","body"].indexOf(V(n))<0;){var s=G(n);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")return n;n=n.parentNode}return null}function Ct(e){for(var t=Z(e),i=Be(e);i&&en(i)&&G(i).position==="static";)i=Be(i);return i&&(V(i)==="html"||V(i)==="body"&&G(i).position==="static")?t:i||on(e)||t}function qt(e){return["top","bottom"].indexOf(e)>=0?"x":"y"}function kt(e,t,i){return ot(e,Dt(t,i))}function nn(e,t,i){var o=kt(e,t,i);return o>i?i:o}function We(){return{top:0,right:0,bottom:0,left:0}}function Fe(e){return Object.assign({},We(),e)}function ze(e,t){return t.reduce(function(i,o){return i[o]=e,i},{})}var sn=function(t,i){return t=typeof t=="function"?t(Object.assign({},i.rects,{placement:i.placement})):t,Fe(typeof t!="number"?t:ze(t,wt))};function rn(e){var t,i=e.state,o=e.name,n=e.options,s=i.elements.arrow,l=i.modifiersData.popperOffsets,r=j(i.placement),a=qt(r),c=[D,z].indexOf(r)>=0,h=c?"height":"width";if(!(!s||!l)){var u=sn(n.padding,i),f=Qt(s),p=a==="y"?H:D,x=a==="y"?F:z,g=i.rects.reference[h]+i.rects.reference[a]-l[a]-i.rects.popper[h],v=l[a]-i.rects.reference[a],m=Ct(s),y=m?a==="y"?m.clientHeight||0:m.clientWidth||0:0,I=g/2-v/2,w=u[p],C=y-f[h]-u[x],b=y/2-f[h]/2+I,k=kt(w,b,C),E=a;i.modifiersData[o]=(t={},t[E]=k,t.centerOffset=k-b,t)}}function an(e){var t=e.state,i=e.options,o=i.element,n=o===void 0?"[data-popper-arrow]":o;n!=null&&(typeof n=="string"&&(n=t.elements.popper.querySelector(n),!n)||Ze(t.elements.popper,n)&&(t.elements.arrow=n))}const ln={name:"arrow",enabled:!0,phase:"main",fn:rn,effect:an,requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function pt(e){return e.split("-")[1]}var cn={top:"auto",right:"auto",bottom:"auto",left:"auto"};function hn(e,t){var i=e.x,o=e.y,n=t.devicePixelRatio||1;return{x:ht(i*n)/n||0,y:ht(o*n)/n||0}}function Ne(e){var t,i=e.popper,o=e.popperRect,n=e.placement,s=e.variation,l=e.offsets,r=e.position,a=e.gpuAcceleration,c=e.adaptive,h=e.roundOffsets,u=e.isFixed,f=l.x,p=f===void 0?0:f,x=l.y,g=x===void 0?0:x,v=typeof h=="function"?h({x:p,y:g}):{x:p,y:g};p=v.x,g=v.y;var m=l.hasOwnProperty("x"),y=l.hasOwnProperty("y"),I=D,w=H,C=window;if(c){var b=Ct(i),k="clientHeight",E="clientWidth";if(b===Z(i)&&(b=tt(i),G(b).position!=="static"&&r==="absolute"&&(k="scrollHeight",E="scrollWidth")),b=b,n===H||(n===D||n===z)&&s===xt){w=F;var O=u&&b===C&&C.visualViewport?C.visualViewport.height:b[k];g-=O-o.height,g*=a?1:-1}if(n===D||(n===H||n===F)&&s===xt){I=z;var S=u&&b===C&&C.visualViewport?C.visualViewport.width:b[E];p-=S-o.width,p*=a?1:-1}}var L=Object.assign({position:r},c&&cn),M=h===!0?hn({x:p,y:g},Z(i)):{x:p,y:g};if(p=M.x,g=M.y,a){var T;return Object.assign({},L,(T={},T[w]=y?"0":"",T[I]=m?"0":"",T.transform=(C.devicePixelRatio||1)<=1?"translate("+p+"px, "+g+"px)":"translate3d("+p+"px, "+g+"px, 0)",T))}return Object.assign({},L,(t={},t[w]=y?g+"px":"",t[I]=m?p+"px":"",t.transform="",t))}function dn(e){var t=e.state,i=e.options,o=i.gpuAcceleration,n=o===void 0?!0:o,s=i.adaptive,l=s===void 0?!0:s,r=i.roundOffsets,a=r===void 0?!0:r,c={placement:j(t.placement),variation:pt(t.placement),popper:t.elements.popper,popperRect:t.rects.popper,gpuAcceleration:n,isFixed:t.options.strategy==="fixed"};t.modifiersData.popperOffsets!=null&&(t.styles.popper=Object.assign({},t.styles.popper,Ne(Object.assign({},c,{offsets:t.modifiersData.popperOffsets,position:t.options.strategy,adaptive:l,roundOffsets:a})))),t.modifiersData.arrow!=null&&(t.styles.arrow=Object.assign({},t.styles.arrow,Ne(Object.assign({},c,{offsets:t.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:a})))),t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-placement":t.placement})}const pn={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:dn,data:{}};var Bt={passive:!0};function un(e){var t=e.state,i=e.instance,o=e.options,n=o.scroll,s=n===void 0?!0:n,l=o.resize,r=l===void 0?!0:l,a=Z(t.elements.popper),c=[].concat(t.scrollParents.reference,t.scrollParents.popper);return s&&c.forEach(function(h){h.addEventListener("scroll",i.update,Bt)}),r&&a.addEventListener("resize",i.update,Bt),function(){s&&c.forEach(function(h){h.removeEventListener("scroll",i.update,Bt)}),r&&a.removeEventListener("resize",i.update,Bt)}}const fn={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:un,data:{}};var mn={left:"right",right:"left",bottom:"top",top:"bottom"};function Wt(e){return e.replace(/left|right|bottom|top/g,function(t){return mn[t]})}var vn={start:"end",end:"start"};function Ve(e){return e.replace(/start|end/g,function(t){return vn[t]})}function te(e){var t=Z(e),i=t.pageXOffset,o=t.pageYOffset;return{scrollLeft:i,scrollTop:o}}function ee(e){return dt(tt(e)).left+te(e).scrollLeft}function gn(e,t){var i=Z(e),o=tt(e),n=i.visualViewport,s=o.clientWidth,l=o.clientHeight,r=0,a=0;if(n){s=n.width,l=n.height;var c=De();(c||!c&&t==="fixed")&&(r=n.offsetLeft,a=n.offsetTop)}return{width:s,height:l,x:r+ee(e),y:a}}function bn(e){var t,i=tt(e),o=te(e),n=(t=e.ownerDocument)==null?void 0:t.body,s=ot(i.scrollWidth,i.clientWidth,n?n.scrollWidth:0,n?n.clientWidth:0),l=ot(i.scrollHeight,i.clientHeight,n?n.scrollHeight:0,n?n.clientHeight:0),r=-o.scrollLeft+ee(e),a=-o.scrollTop;return G(n||i).direction==="rtl"&&(r+=ot(i.clientWidth,n?n.clientWidth:0)-s),{width:s,height:l,x:r,y:a}}function ie(e){var t=G(e),i=t.overflow,o=t.overflowX,n=t.overflowY;return/auto|scroll|overlay|hidden/.test(i+n+o)}function je(e){return["html","body","#document"].indexOf(V(e))>=0?e.ownerDocument.body:N(e)&&ie(e)?e:je(Zt(e))}function Ot(e,t){var i;t===void 0&&(t=[]);var o=je(e),n=o===((i=e.ownerDocument)==null?void 0:i.body),s=Z(o),l=n?[s].concat(s.visualViewport||[],ie(o)?o:[]):o,r=t.concat(l);return n?r:r.concat(Ot(Zt(l)))}function oe(e){return Object.assign({},e,{left:e.x,top:e.y,right:e.x+e.width,bottom:e.y+e.height})}function yn(e,t){var i=dt(e,!1,t==="fixed");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}function $e(e,t,i){return t===Re?oe(gn(e,i)):it(t)?yn(t,i):oe(bn(tt(e)))}function wn(e){var t=Ot(Zt(e)),i=["absolute","fixed"].indexOf(G(e).position)>=0,o=i&&N(e)?Ct(e):e;return it(o)?t.filter(function(n){return it(n)&&Ze(n,o)&&V(n)!=="body"}):[]}function xn(e,t,i,o){var n=t==="clippingParents"?wn(e):[].concat(t),s=[].concat(n,[i]),l=s[0],r=s.reduce(function(a,c){var h=$e(e,c,o);return a.top=ot(h.top,a.top),a.right=Dt(h.right,a.right),a.bottom=Dt(h.bottom,a.bottom),a.left=ot(h.left,a.left),a},$e(e,l,o));return r.width=r.right-r.left,r.height=r.bottom-r.top,r.x=r.left,r.y=r.top,r}function Ge(e){var t=e.reference,i=e.element,o=e.placement,n=o?j(o):null,s=o?pt(o):null,l=t.x+t.width/2-i.width/2,r=t.y+t.height/2-i.height/2,a;switch(n){case H:a={x:l,y:t.y-i.height};break;case F:a={x:l,y:t.y+t.height};break;case z:a={x:t.x+t.width,y:r};break;case D:a={x:t.x-i.width,y:r};break;default:a={x:t.x,y:t.y}}var c=n?qt(n):null;if(c!=null){var h=c==="y"?"height":"width";switch(s){case ct:a[c]=a[c]-(t[h]/2-i[h]/2);break;case xt:a[c]=a[c]+(t[h]/2-i[h]/2);break}}return a}function Et(e,t){t===void 0&&(t={});var i=t,o=i.placement,n=o===void 0?e.placement:o,s=i.strategy,l=s===void 0?e.strategy:s,r=i.boundary,a=r===void 0?Wo:r,c=i.rootBoundary,h=c===void 0?Re:c,u=i.elementContext,f=u===void 0?It:u,p=i.altBoundary,x=p===void 0?!1:p,g=i.padding,v=g===void 0?0:g,m=Fe(typeof v!="number"?v:ze(v,wt)),y=f===It?Fo:It,I=e.rects.popper,w=e.elements[x?y:f],C=xn(it(w)?w:w.contextElement||tt(e.elements.popper),a,h,l),b=dt(e.elements.reference),k=Ge({reference:b,element:I,placement:n}),E=oe(Object.assign({},I,k)),O=f===It?E:b,S={top:C.top-O.top+m.top,bottom:O.bottom-C.bottom+m.bottom,left:C.left-O.left+m.left,right:O.right-C.right+m.right},L=e.modifiersData.offset;if(f===It&&L){var M=L[n];Object.keys(S).forEach(function(T){var U=[z,F].indexOf(T)>=0?1:-1,_=[H,F].indexOf(T)>=0?"y":"x";S[T]+=M[_]*U})}return S}function In(e,t){t===void 0&&(t={});var i=t,o=i.placement,n=i.boundary,s=i.rootBoundary,l=i.padding,r=i.flipVariations,a=i.allowedAutoPlacements,c=a===void 0?He:a,h=pt(o),u=h?r?Me:Me.filter(function(x){return pt(x)===h}):wt,f=u.filter(function(x){return c.indexOf(x)>=0});f.length===0&&(f=u);var p=f.reduce(function(x,g){return x[g]=Et(e,{placement:g,boundary:n,rootBoundary:s,padding:l})[j(g)],x},{});return Object.keys(p).sort(function(x,g){return p[x]-p[g]})}function Cn(e){if(j(e)===_t)return[];var t=Wt(e);return[Ve(e),t,Ve(t)]}function kn(e){var t=e.state,i=e.options,o=e.name;if(!t.modifiersData[o]._skip){for(var n=i.mainAxis,s=n===void 0?!0:n,l=i.altAxis,r=l===void 0?!0:l,a=i.fallbackPlacements,c=i.padding,h=i.boundary,u=i.rootBoundary,f=i.altBoundary,p=i.flipVariations,x=p===void 0?!0:p,g=i.allowedAutoPlacements,v=t.options.placement,m=j(v),y=m===v,I=a||(y||!x?[Wt(v)]:Cn(v)),w=[v].concat(I).reduce(function(et,$){return et.concat(j($)===_t?In(t,{placement:$,boundary:h,rootBoundary:u,padding:c,flipVariations:x,allowedAutoPlacements:g}):$)},[]),C=t.rects.reference,b=t.rects.popper,k=new Map,E=!0,O=w[0],S=0;S<w.length;S++){var L=w[S],M=j(L),T=pt(L)===ct,U=[H,F].indexOf(M)>=0,_=U?"width":"height",P=Et(t,{placement:L,boundary:h,rootBoundary:u,altBoundary:f,padding:c}),B=U?T?z:D:T?F:H;C[_]>b[_]&&(B=Wt(B));var ut=Wt(B),K=[];if(s&&K.push(P[M]<=0),r&&K.push(P[B]<=0,P[ut]<=0),K.every(function(et){return et})){O=L,E=!1;break}k.set(L,K)}if(E)for(var ft=x?3:1,St=function($){var st=w.find(function(rt){var J=k.get(rt);if(J)return J.slice(0,$).every(function(vt){return vt})});if(st)return O=st,"break"},nt=ft;nt>0;nt--){var mt=St(nt);if(mt==="break")break}t.placement!==O&&(t.modifiersData[o]._skip=!0,t.placement=O,t.reset=!0)}}const On={name:"flip",enabled:!0,phase:"main",fn:kn,requiresIfExists:["offset"],data:{_skip:!1}};function Ue(e,t,i){return i===void 0&&(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 _e(e){return[H,z,F,D].some(function(t){return e[t]>=0})}function En(e){var t=e.state,i=e.name,o=t.rects.reference,n=t.rects.popper,s=t.modifiersData.preventOverflow,l=Et(t,{elementContext:"reference"}),r=Et(t,{altBoundary:!0}),a=Ue(l,o),c=Ue(r,n,s),h=_e(a),u=_e(c);t.modifiersData[i]={referenceClippingOffsets:a,popperEscapeOffsets:c,isReferenceHidden:h,hasPopperEscaped:u},t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-reference-hidden":h,"data-popper-escaped":u})}const Sn={name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:En};function An(e,t,i){var o=j(e),n=[D,H].indexOf(o)>=0?-1:1,s=typeof i=="function"?i(Object.assign({},t,{placement:e})):i,l=s[0],r=s[1];return l=l||0,r=(r||0)*n,[D,z].indexOf(o)>=0?{x:r,y:l}:{x:l,y:r}}function Ln(e){var t=e.state,i=e.options,o=e.name,n=i.offset,s=n===void 0?[0,0]:n,l=He.reduce(function(h,u){return h[u]=An(u,t.rects,s),h},{}),r=l[t.placement],a=r.x,c=r.y;t.modifiersData.popperOffsets!=null&&(t.modifiersData.popperOffsets.x+=a,t.modifiersData.popperOffsets.y+=c),t.modifiersData[o]=l}const Tn={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:Ln};function Yn(e){var t=e.state,i=e.name;t.modifiersData[i]=Ge({reference:t.rects.reference,element:t.rects.popper,placement:t.placement})}const Xn={name:"popperOffsets",enabled:!0,phase:"read",fn:Yn,data:{}};function Pn(e){return e==="x"?"y":"x"}function Rn(e){var t=e.state,i=e.options,o=e.name,n=i.mainAxis,s=n===void 0?!0:n,l=i.altAxis,r=l===void 0?!1:l,a=i.boundary,c=i.rootBoundary,h=i.altBoundary,u=i.padding,f=i.tether,p=f===void 0?!0:f,x=i.tetherOffset,g=x===void 0?0:x,v=Et(t,{boundary:a,rootBoundary:c,padding:u,altBoundary:h}),m=j(t.placement),y=pt(t.placement),I=!y,w=qt(m),C=Pn(w),b=t.modifiersData.popperOffsets,k=t.rects.reference,E=t.rects.popper,O=typeof g=="function"?g(Object.assign({},t.rects,{placement:t.placement})):g,S=typeof O=="number"?{mainAxis:O,altAxis:O}:Object.assign({mainAxis:0,altAxis:0},O),L=t.modifiersData.offset?t.modifiersData.offset[t.placement]:null,M={x:0,y:0};if(b){if(s){var T,U=w==="y"?H:D,_=w==="y"?F:z,P=w==="y"?"height":"width",B=b[w],ut=B+v[U],K=B-v[_],ft=p?-E[P]/2:0,St=y===ct?k[P]:E[P],nt=y===ct?-E[P]:-k[P],mt=t.elements.arrow,et=p&&mt?Qt(mt):{width:0,height:0},$=t.modifiersData["arrow#persistent"]?t.modifiersData["arrow#persistent"].padding:We(),st=$[U],rt=$[_],J=kt(0,k[P],et[P]),vt=I?k[P]/2-ft-J-st-S.mainAxis:St-J-st-S.mainAxis,ne=I?-k[P]/2+ft+J+rt+S.mainAxis:nt+J+rt+S.mainAxis,At=t.elements.arrow&&Ct(t.elements.arrow),se=At?w==="y"?At.clientTop||0:At.clientLeft||0:0,zt=(T=L==null?void 0:L[w])!=null?T:0,re=B+vt-zt-se,ae=B+ne-zt,Nt=kt(p?Dt(ut,re):ut,B,p?ot(K,ae):K);b[w]=Nt,M[w]=Nt-B}if(r){var Vt,le=w==="x"?H:D,ce=w==="x"?F:z,Q=b[C],gt=C==="y"?"height":"width",Lt=Q+v[le],bt=Q-v[ce],at=[H,D].indexOf(m)!==-1,Tt=(Vt=L==null?void 0:L[C])!=null?Vt:0,Yt=at?Lt:Q-k[gt]-E[gt]-Tt+S.altAxis,Xt=at?Q+k[gt]+E[gt]-Tt-S.altAxis:bt,Pt=p&&at?nn(Yt,Q,Xt):kt(p?Yt:Lt,Q,p?Xt:bt);b[C]=Pt,M[C]=Pt-Q}t.modifiersData[o]=M}}const Mn={name:"preventOverflow",enabled:!0,phase:"main",fn:Rn,requiresIfExists:["offset"]};function Hn(e){return{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}}function Dn(e){return e===Z(e)||!N(e)?te(e):Hn(e)}function Zn(e){var t=e.getBoundingClientRect(),i=ht(t.width)/e.offsetWidth||1,o=ht(t.height)/e.offsetHeight||1;return i!==1||o!==1}function Bn(e,t,i){i===void 0&&(i=!1);var o=N(t),n=N(t)&&Zn(t),s=tt(t),l=dt(e,n,i),r={scrollLeft:0,scrollTop:0},a={x:0,y:0};return(o||!o&&!i)&&((V(t)!=="body"||ie(s))&&(r=Dn(t)),N(t)?(a=dt(t,!0),a.x+=t.clientLeft,a.y+=t.clientTop):s&&(a.x=ee(s))),{x:l.left+r.scrollLeft-a.x,y:l.top+r.scrollTop-a.y,width:l.width,height:l.height}}function Wn(e){var t=new Map,i=new Set,o=[];e.forEach(function(s){t.set(s.name,s)});function n(s){i.add(s.name);var l=[].concat(s.requires||[],s.requiresIfExists||[]);l.forEach(function(r){if(!i.has(r)){var a=t.get(r);a&&n(a)}}),o.push(s)}return e.forEach(function(s){i.has(s.name)||n(s)}),o}function Fn(e){var t=Wn(e);return Jo.reduce(function(i,o){return i.concat(t.filter(function(n){return n.phase===o}))},[])}function zn(e){var t;return function(){return t||(t=new Promise(function(i){Promise.resolve().then(function(){t=void 0,i(e())})})),t}}function Nn(e){var t=e.reduce(function(i,o){var n=i[o.name];return i[o.name]=n?Object.assign({},n,o,{options:Object.assign({},n.options,o.options),data:Object.assign({},n.data,o.data)}):o,i},{});return Object.keys(t).map(function(i){return t[i]})}var Ke={placement:"bottom",modifiers:[],strategy:"absolute"};function Je(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];return!t.some(function(o){return!(o&&typeof o.getBoundingClientRect=="function")})}function Vn(e){e===void 0&&(e={});var t=e,i=t.defaultModifiers,o=i===void 0?[]:i,n=t.defaultOptions,s=n===void 0?Ke:n;return function(r,a,c){c===void 0&&(c=s);var h={placement:"bottom",orderedModifiers:[],options:Object.assign({},Ke,s),modifiersData:{},elements:{reference:r,popper:a},attributes:{},styles:{}},u=[],f=!1,p={state:h,setOptions:function(m){var y=typeof m=="function"?m(h.options):m;g(),h.options=Object.assign({},s,h.options,y),h.scrollParents={reference:it(r)?Ot(r):r.contextElement?Ot(r.contextElement):[],popper:Ot(a)};var I=Fn(Nn([].concat(o,h.options.modifiers)));return h.orderedModifiers=I.filter(function(w){return w.enabled}),x(),p.update()},forceUpdate:function(){if(!f){var m=h.elements,y=m.reference,I=m.popper;if(Je(y,I)){h.rects={reference:Bn(y,Ct(I),h.options.strategy==="fixed"),popper:Qt(I)},h.reset=!1,h.placement=h.options.placement,h.orderedModifiers.forEach(function(S){return h.modifiersData[S.name]=Object.assign({},S.data)});for(var w=0;w<h.orderedModifiers.length;w++){if(h.reset===!0){h.reset=!1,w=-1;continue}var C=h.orderedModifiers[w],b=C.fn,k=C.options,E=k===void 0?{}:k,O=C.name;typeof b=="function"&&(h=b({state:h,options:E,name:O,instance:p})||h)}}}},update:zn(function(){return new Promise(function(v){p.forceUpdate(),v(h)})}),destroy:function(){g(),f=!0}};if(!Je(r,a))return p;p.setOptions(c).then(function(v){!f&&c.onFirstUpdate&&c.onFirstUpdate(v)});function x(){h.orderedModifiers.forEach(function(v){var m=v.name,y=v.options,I=y===void 0?{}:y,w=v.effect;if(typeof w=="function"){var C=w({state:h,name:m,instance:p,options:I}),b=function(){};u.push(C||b)}})}function g(){u.forEach(function(v){return v()}),u=[]}return p}}var jn=[fn,Xn,pn,tn,Tn,On,Mn,ln,Sn],$n=Vn({defaultModifiers:jn});class Gn{constructor(t,i,o){qe(this,"updateHotspotPosition",(t,i)=>{this.currentActiveIndex=t,this.currentOrientation=i;const o=Po(this.hotspotsConfig,t,i);this.hideHotspots(),o.forEach(n=>this.updateAndShowHotspot(n,t))});this.container=i,this.popper=null,this.popperInstance=null,this.hotspotsContainer=_i(this.container),this.hotspotsConfig=Zo(t),this.shouldHidePopper=!0,this.hidePopper=this.hidePopper.bind(this),this.imageAspectRatio=o,this.hotspotElements=new Map,this.popperListeners=[];const{containerSize:n}=t[0];this.initialContainerSize=n||[i.offsetWidth,i.offsetHeight],this.initHotspots(),this.observeContainerResize()}observeContainerResize(){this.resizeObserver=new ResizeObserver(()=>{const t=this.container.offsetWidth,i=this.container.offsetHeight;this.updateHotspotsForResize(t,i)}),this.resizeObserver.observe(this.container)}updateHotspotsForResize(t,i){this.hotspotsConfig=Bo({newWidth:t,newHeight:i,initialContainerSize:this.initialContainerSize,imageAspectRatio:this.imageAspectRatio,hotspotsConfig:this.hotspotsConfig}),this.updateHotspotPosition(this.currentActiveIndex,this.currentOrientation)}cleanupPopperListeners(){this.popperListeners.forEach(({element:t,event:i,handler:o})=>{t.removeEventListener(i,o)}),this.popperListeners=[]}showPopper({hotspotElement:t,content:i,id:o,keepOpen:n}){this.popperInstance&&this.popperInstance.instanceId!==o&&this.hidePopper();const s={placement:"top",modifiers:Ho(this.container)};this.popper=Do(i,o),this.popper.setAttribute("data-show",""),this.currentHotspotElement=t,t.setAttribute("aria-expanded","true"),t.setAttribute("aria-describedby",`cloudimage-360-popper-${o}`);const l=()=>{this.shouldHidePopper=!1},r=()=>{this.shouldHidePopper=!0,this.checkAndHidePopper()},a=()=>{this.shouldHidePopper=!0,this.checkAndHidePopper()},c=()=>{this.shouldHidePopper=!1,this.hidePopperTimeout&&clearTimeout(this.hidePopperTimeout)};this.popper.addEventListener("mouseenter",l),this.popper.addEventListener("mouseleave",r),t.addEventListener("mouseleave",a),t.addEventListener("mouseenter",c),this.popperListeners.push({element:this.popper,event:"mouseenter",handler:l},{element:this.popper,event:"mouseleave",handler:r},{element:t,event:"mouseleave",handler:a},{element:t,event:"mouseenter",handler:c}),this.popperInstance={...$n(t,this.popper,s),keepOpen:n,instanceId:o}}checkAndHidePopper(){var t;this.shouldHidePopper&&!((t=this.popperInstance)!=null&&t.keepOpen)&&(this.hidePopperTimeout=setTimeout(()=>{this.shouldHidePopper&&this.hidePopper()},Ii))}hidePopper(){if(this.cleanupPopperListeners(),this.currentHotspotElement&&(this.currentHotspotElement.setAttribute("aria-expanded","false"),this.currentHotspotElement.removeAttribute("aria-describedby"),this.currentHotspotElement=null),this.popperInstance&&(this.popperInstance.destroy(),this.popperInstance=null),this.popper){this.popper.removeAttribute("data-show"),this.popper.setAttribute("aria-hidden","true");const t=this.popper;this.popper=null,setTimeout(()=>{t.remove()},Ci)}}createHotspot(t){const{id:i,content:o,keepOpen:n,onClick:s,label:l}=t,r=Ro(i,l);s&&(r.style.cursor="pointer"),r.onclick=a=>{a.stopPropagation(),s==null||s(a,this.popperInstance,i)},o&&(r.addEventListener("mouseenter",()=>this.showPopper({hotspotElement:r,content:o,id:i,keepOpen:n})),r.addEventListener("focus",()=>this.showPopper({hotspotElement:r,content:o,id:i,keepOpen:n})),r.addEventListener("blur",()=>{this.shouldHidePopper=!0,this.checkAndHidePopper()})),this.hotspotsContainer.appendChild(r)}hideHotspots(){this.hotspotsContainer.querySelectorAll(".cloudimage-360-hotspot").forEach(t=>{t.style.opacity=0,t.style.pointerEvents="none"})}updateAndShowHotspot(t,i){const{positions:o,id:n}=t,{x:s,y:l}=o[i]??{},r=this.hotspotsContainer.querySelector(`[data-hotspot-id="${n}"]`);r&&(r.style.translate=`${s}px ${l}px`,r.style.opacity=1,r.style.pointerEvents="all")}showHotspotById(t){const i=this.hotspotsConfig.find(n=>n.id===t);if(!i||!i.content)return;const o=this.hotspotsContainer.querySelector(`[data-hotspot-id="${t}"]`);o&&o.style.opacity==="1"&&this.showPopper({hotspotElement:o,content:i.content,id:t,keepOpen:i.keepOpen})}createAllHotspots(){this.hotspotsConfig.forEach(t=>this.createHotspot(t))}initHotspots(){this.createAllHotspots()}destroy(){this.hidePopperTimeout&&clearTimeout(this.hidePopperTimeout),this.resizeObserver.disconnect(),this.hidePopper(),this.hotspotElements.clear(),this.hotspotsContainer.innerHTML=""}}class Ft{constructor(t,i,o){this.container=t,this.isClicked=!1,this.fullscreenView=!!o,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.velocityX=0,this.velocityY=0,this.lastDragTime=0,this.lastDragX=0,this.lastDragY=0,this.inertiaAnimationId=null,this.hasInteracted=!1,this.currentZoomScale=1,this.touchDevice=Oo(),this.dragJustEnded=!1,this.isPinching=!1,this.initialPinchDistance=0,this.pinchZoomLevel=1,this.pinchZoomEmitted=!1,this.lastEmittedZoom=1,this.panOffsetX=0,this.panOffsetY=0,this.canvasWorker=new Ao,this.hotspotTimeline=null,this.hotspotTimelineIndicator=null,this.isAnimatingToFrame=!1,this.onMoveHandler=this.onMoveHandler.bind(this),this.destroy=this.destroy.bind(this),this.init(this.container,i)}emit(t,i={}){const o=this[t];typeof o=="function"&&o({...i,viewerId:this.id})}announce(t){Ji(this.ariaLiveRegion,t)}mouseDown(t){if(!this.isReady||this.glass)return;const{pageX:i,pageY:o}=t;this.hideHints(),this.hideHotspotPopper(),this.inertiaAnimationId&&(cancelAnimationFrame(this.inertiaAnimationId),this.inertiaAnimationId=null),this.autoplayJustStopped=!1,(this.autoplay||this.loopTimeoutId)&&(this.stopAutoplay(),this.autoplay=!1,this.autoplayJustStopped=!0),this.movementStart={x:i,y:o},this.isClicked=!0,this.isDragging=!1,this.inertia&&(this.velocityX=0,this.velocityY=0,this.lastDragTime=performance.now(),this.lastDragX=i,this.lastDragY=o)}mouseUp(){this.isReady&&(!this.isZoomed&&!this.autoplayJustStopped&&this.showAllIcons(),this.inertia&&this.isDragging&&(Math.abs(this.velocityX)>.1||Math.abs(this.velocityY)>.1)&&this.startInertia(),this.isDragging&&(this.emit("onDragEnd"),this.dragJustEnded=!0),this.movementStart={x:0,y:0},this.isClicked=!1,this.isDragging=!1,this.innerBox.style.cursor="grab")}startInertia(){const o=this.fullscreenView?document.body:this.container,n=this.dragSpeed/ve,s=n*(this.amountX/o.offsetWidth),l=n*(this.amountY/o.offsetHeight),r=()=>{if(this.velocityX*=.95,this.velocityY*=.95,Math.abs(this.velocityX)<.01&&Math.abs(this.velocityY)<.01){this.inertiaAnimationId=null;return}const a=this.velocityX*16,c=this.velocityY*16,h=Te({deltaX:a,deltaY:c,reversed:this.dragReverse,allowSpinX:this.allowSpinX,allowSpinY:this.allowSpinY});if(h){const u=this.allowSpinX?Math.max(1,Math.abs(Math.round(a*s))):0,f=this.allowSpinY?Math.max(1,Math.abs(Math.round(c*l))):0;(u>0||f>0)&&this.onMoveHandler(h,u,f)}this.inertiaAnimationId=requestAnimationFrame(r)};this.inertiaAnimationId=requestAnimationFrame(r)}drag(t,i){if(!this.isReady||!this.isClicked)return;const o=t-this.movementStart.x,n=i-this.movementStart.y;if(this.inertia){const f=performance.now(),p=f-this.lastDragTime;p>0&&p<100&&(this.velocityX=(t-this.lastDragX)/p,this.velocityY=(i-this.lastDragY)/p),this.lastDragTime=f,this.lastDragX=t,this.lastDragY=i}this.draggingDirection=Te({deltaX:o,deltaY:n,reversed:this.dragReverse,allowSpinX:this.allowSpinX,allowSpinY:this.allowSpinY})||this.draggingDirection;const s=this.fullscreenView?document.body:this.container,l=this.dragSpeed/ve,r=l*(this.amountX/s.offsetWidth),a=l*(this.amountY/s.offsetHeight),c=this.allowSpinX?Math.abs(Math.round(o*r)):0,h=this.allowSpinY?Math.abs(Math.round(n*a)):0;(this.allowSpinX&&c!==0||this.allowSpinY&&h!==0)&&(this.hasInteracted=!0,this.hideHotspotPopper(),this.onMoveHandler(this.draggingDirection,c,h),this.movementStart={x:t,y:i},setTimeout(()=>{this.isDragging||(this.isDragging=!0,this.emit("onDragStart"))},xi))}mouseMove(t){!this.isReady||!this.isClicked&&!this.isZoomed||this.glass||(this.hideAllIcons(),this.drag(t.pageX,t.pageY),this.isZoomed&&this.applyZoom(t))}mouseClick(t){if(!(!this.isReady||this.isDragging)){if(this.dragJustEnded){this.dragJustEnded=!1;return}if(this.autoplayJustStopped){this.autoplayJustStopped=!1;return}if(this.glass&&this.magnified){this.removeGlass();return}this.pointerZoom&&!this.glass&&!this.touchDevice&&this.toggleZoom(t)}}loadHigherQualityImages(t,i){const o=yt(this.srcXConfig,t),n=this.allowSpinY?yt(this.srcYConfig,t):null;ye({cdnPathX:o,cdnPathY:n,configX:this.srcXConfig,configY:this.srcYConfig,onAllImagesLoad:(s,l)=>{this.imagesX=s,this.imagesY=l,i()},onError:s=>this.emit("onError",s)})}hideHotspots(){this.hotspotsInstance&&this.hotspotsInstance.hideHotspots()}hideHotspotPopper(){this.hotspotsInstance&&this.hotspotsInstance.hidePopper()}toggleZoom(t){if(this.isZoomed)this.showTransitionOverlay(),setTimeout(()=>{this.removeZoom()},me);else{let i=(this.fullscreenView||this.pointerZoom?document.body:this.container).offsetWidth;this.hideHotspots(),this.showLoadingSpinner(),this.loadHigherQualityImages(i,()=>{this.showTransitionOverlay(),setTimeout(()=>{this.applyZoom(t)},me)})}}removeZoom(){this.isZoomed=!1,this.updateView(),this.showAllIcons(),this.hideTransitionOverlay(),this.emit("onZoomOut"),this.announce("Zoomed out")}mouseLeave(){this.isZoomed&&this.removeZoom()}applyZoom(t){const{offsetX:i,offsetY:o}=yo(t,this.canvas,this.devicePixelRatio);this.isZoomed=!0,this.hideAllIcons(),this.hideLoadingSpinner(),this.hideTransitionOverlay(),this.updateView(this.pointerZoom,i,o),this.emit("onZoomIn",{zoomLevel:this.pointerZoom}),this.announce("Zoomed in. Move mouse to pan. Click to zoom out.")}touchOutside(t){if(!this.glass)return;!this.canvas.contains(t.target)&&this.removeGlass()}touchStart(t){if(!this.isReady||this.glass||!t.touches||!t.touches.length)return;const i=t.target;if(i&&i.closest&&i.closest(".cloudimage-360-button"))return;if(this.hideHints(),t.touches.length===2&&this.pinchZoom&&!this.isDragging){t.preventDefault(),this.isPinching=!0,this.isClicked=!1,this.inertiaAnimationId&&(cancelAnimationFrame(this.inertiaAnimationId),this.inertiaAnimationId=null);const s=t.touches[0],l=t.touches[1];if(this.initialPinchDistance=this.getPinchDistance(s,l),(this.autoplay||this.loopTimeoutId)&&(this.stopAutoplay(),this.autoplay=!1),!this.isZoomed&&this.pinchZoomLevel===1){const r=(this.fullscreenView?document.body:this.container).offsetWidth;this.hideHotspots(),this.loadHigherQualityImages(r,()=>{})}return}if(t.touches.length>1)return;const{pageX:o,pageY:n}=t.touches[0];this.inertiaAnimationId&&(cancelAnimationFrame(this.inertiaAnimationId),this.inertiaAnimationId=null),(this.autoplay||this.loopTimeoutId)&&(this.stopAutoplay(),this.autoplay=!1),this.hideAllIcons(),this.hideHotspotPopper(),this.movementStart={x:o,y:n},this.isClicked=!0,this.isDragging=!1,this.inertia&&(this.velocityX=0,this.velocityY=0,this.lastDragTime=performance.now(),this.lastDragX=o,this.lastDragY=n)}getPinchDistance(t,i){const o=t.pageX-i.pageX,n=t.pageY-i.pageY;return Math.sqrt(o*o+n*n)}getPinchCenter(t,i){return{x:(t.pageX+i.pageX)/2,y:(t.pageY+i.pageY)/2}}touchEnd(t){if(this.isReady){if(this.isPinching){if(!t.touches||t.touches.length<2){if(this.isPinching=!1,this.initialPinchDistance=0,this.pinchZoomLevel<=1){const i=this.pinchZoomEmitted;this.pinchZoomLevel=1,this.pinchZoomEmitted=!1,this.lastEmittedZoom=1,this.isZoomed=!1,this.panOffsetX=0,this.panOffsetY=0,this.showAllIcons(),this.updateView(),i&&this.emit("onZoomOut")}else if(this.canvas){const i=this.canvas.getBoundingClientRect();this.panOffsetX=i.width/2*this.devicePixelRatio,this.panOffsetY=i.height/2*this.devicePixelRatio}}return}this.showAllIcons(),this.inertia&&this.isDragging&&(Math.abs(this.velocityX)>.1||Math.abs(this.velocityY)>.1)&&this.startInertia(),this.movementStart={x:0,y:0},this.isClicked=!1,this.isDragging=!1}}touchMove(t){if(!this.isReady||this.glass)return;if(this.isPinching&&t.touches.length===2){t.preventDefault();const n=t.touches[0],s=t.touches[1],l=this.getPinchDistance(n,s);if(this.initialPinchDistance===0){this.initialPinchDistance=l;return}const r=l/this.initialPinchDistance,a=Math.max(1,Math.min(this.pinchZoomLevel*r,ge));if(this.initialPinchDistance=l,this.pinchZoomLevel=a,!this.canvas)return;const c=this.canvas.getBoundingClientRect(),h=c.width/2*this.devicePixelRatio,u=c.height/2*this.devicePixelRatio;a>1?(this.isZoomed=!0,this.hideAllIcons(),this.updateView(a,h,u),(!this.pinchZoomEmitted||a>this.lastEmittedZoom)&&(this.emit("onZoomIn",{zoomLevel:a}),this.pinchZoomEmitted=!0,this.lastEmittedZoom=a)):(this.isZoomed=!1,this.panOffsetX=0,this.panOffsetY=0,this.updateView());return}if(!this.isClicked||!t.touches||!t.touches[0])return;const{pageX:i,pageY:o}=t.touches[0];if(t.preventDefault(),this.isZoomed&&this.pinchZoomLevel>1){const n=i-this.movementStart.x,s=o-this.movementStart.y;this.panOffsetX-=n*this.devicePixelRatio,this.panOffsetY-=s*this.devicePixelRatio,this.movementStart={x:i,y:o},this.updateView(this.pinchZoomLevel,this.panOffsetX,this.panOffsetY);return}this.drag(i,o)}keyDown(t){if(!this.isReady)return;const{keyCode:i}=t,o=this.keysReverse;switch(this.autoplay&&this.stopAutoplay(),Le(i,this.allowSpinY)&&(this.hasInteracted=!0,this.hideAllIcons(),this.hideHints()),i){case 37:o?this.moveLeft():this.moveRight();break;case 39:o?this.moveRight():this.moveLeft();break;case 38:this.allowSpinY&&(t.preventDefault(),o?this.moveTop():this.moveBottom());break;case 40:this.allowSpinY&&(t.preventDefault(),o?this.moveBottom():this.moveTop());break}}keyUp(t){const{keyCode:i}=t;Le(i,this.allowSpinY)&&this.showAllIcons()}moveActiveXIndexUp(t){this.orientation=Y.X,this.activeImageX=(this.activeImageX+t)%this.amountX}moveActiveXIndexDown(t){this.orientation=Y.X,this.activeImageX=(this.activeImageX-t+this.amountX)%this.amountX}moveActiveYIndexUp(t){this.orientation=Y.Y,this.activeImageY=(this.activeImageY+t)%this.amountY}moveActiveYIndexDown(t){this.orientation=Y.Y,this.activeImageY=(this.activeImageY-t+this.amountY)%this.amountY}moveRight(t,i=1){t&&this.activeImageX>=this.imagesX.length-1||(this.moveActiveXIndexUp(i),this.isZoomed||this.updateView())}moveLeft(t,i=1){t&&this.activeImageX<=0||(this.moveActiveXIndexDown(i),this.isZoomed||this.updateView())}moveTop(t,i=1){t&&this.activeImageY>=this.imagesY.length-1||(this.moveActiveYIndexUp(i),this.isZoomed||this.updateView())}moveBottom(t,i=1){t&&this.activeImageY<=0||(this.moveActiveYIndexDown(i),this.isZoomed||this.updateView())}onMoveHandler(t,i=1,o=1){t==="right"?this.moveRight(this.stopAtEdges,i):t==="left"?this.moveLeft(this.stopAtEdges,i):t==="up"?this.moveTop(this.stopAtEdges,o):t==="down"&&this.moveBottom(this.stopAtEdges,o),this.emit("onSpin",{direction:t,activeImageX:this.activeImageX,activeImageY:this.activeImageY,amountX:this.amountX,amountY:this.amountY})}updateView(t,i,o){const n=this.orientation===Y.X?this.activeImageX:this.activeImageY,s=this.orientation===Y.X?this.imagesX[this.activeImageX]:this.imagesY[this.activeImageY];this.hotspotsInstance&&!this.isZoomed&&!this.autoplay&&this.hotspotsInstance.updateHotspotPosition(n,this.orientation),this.hotspotTimelineIndicator&&this.orientation===Y.X&&this.updateHotspotTimelinePosition(),this.drawImageOnCanvas(s,t,i,o)}updatePercentageInLoader(t=0){this.loader&&(this.loader.innerText=t+"%")}adaptCanvasSize(t){const{naturalWidth:i,naturalHeight:o}=t;this.imageAspectRatio=i/o;const n=this.fullscreenView?window.innerWidth:this.canvas.clientWidth,s=this.fullscreenView?window.innerHeight:this.canvas.clientHeight;this.canvasWorker.postMessage({action:"adaptCanvasSize",devicePixelRatio:this.devicePixelRatio,imageAspectRatio:this.imageAspectRatio,containerWidth:n,containerHeight:s})}drawImageOnCanvas(t,i=1,o=0,n=0){this.canvasWorker.postMessage({action:"drawImageOnCanvas",imageData:t,zoomScale:i,pointerX:o,pointerY:n})}pushImageToSet(t,i,o){o===Y.X?this.imagesX[i]=t:this.imagesY[i]=t}calculatePercentage(){const t=this.amountX+this.amountY,i=this.imagesX.length+this.imagesY.length;return Math.round(i/t*100)}onImageLoad(t,i,o){this.pushImageToSet(t,i,o),this.updatePercentageInLoader(this.calculatePercentage())}onFirstImageLoaded(t,i){this.createContainers(t),this.adaptCanvasSize(i),this.drawImageOnCanvas(i)}onAllImagesLoaded(){if(this.addAllIcons(),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.hotspots&&(this.hotspotsInstance=new Gn(this.hotspots,this.innerBox,this.imageAspectRatio),this.addHotspotTimeline(),this.showHotspotTimeline()),this.emit("onLoad",{imagesX:this.imagesX.length,imagesY:this.imagesY.length}),this.emit("onReady"),this.announce("360 degree view loaded. Use mouse drag or arrow keys to rotate."),this.hints!==!1&&!this.autoplay){const t=this.hints===!0||this.hints===void 0?Ce(this.viewerConfig,this.touchDevice):this.hints;t&&t.length>0&&(this.hintsOverlay=Ie(this.innerBox,t),ke(this.hintsOverlay))}this.autoplay&&(this.hideAllIcons(),Eo(this.play.bind(this))())}magnify(t){t.stopPropagation();const{src:i}=this.orientation===Y.Y?this.imagesY[this.activeImageY]:this.imagesX[this.activeImageX],n=(this.fullscreenView?document.body:this.container).offsetWidth*this.magnifier,s=Pi(i,n);this.showLoadingSpinner(),this.createGlass(),vo(s,a=>{this.hideLoadingSpinner(),this.magnified=!0,bo(t,this.innerBox,this.offset,a,this.glass,this.magnifier)},a=>{this.hideLoadingSpinner(),this.removeGlass(),this.emit("onError",{error:{message:a.message,url:a.url},errorCount:1,totalImages:1,errors:[{message:a.message,url:a.url}]})})}openFullscreenModal(t){t.stopPropagation(),window.document.body.style.overflow="hidden";const i=$i(this.container);new Ft(i,this.viewerConfig,!0),this.emit("onFullscreenOpen"),this.announce("Opened fullscreen mode. Press Escape to exit.")}closeFullscreenModal(t){t.stopPropagation(),document.body.removeChild(this.container.parentNode),window.document.body.style.overflow="visible",this.emit("onFullscreenClose"),this.announce("Exited fullscreen mode")}play(){if(this.isClicked)return;this.hide360ViewCircleIcon(),this.emit("onAutoplayStart");const t=this.speed*36/(this.amountX+this.amountY),i={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&&xo({autoplayBehavior:this.autoplayBehavior,activeImageX:this.activeImageX,activeImageY:this.activeImageY,amountX:this.amountX,amountY:this.amountY,autoplayReverse:this.autoplayReverse})){this.stopAutoplay();return}Io({autoplayBehavior:this.autoplayBehavior,activeImageX:this.activeImageX,activeImageY:this.activeImageY,amountX:this.amountX,amountY:this.amountY,autoplayReverse:this.autoplayReverse,spinDirection:this.spinDirection})&&(this.spinDirection=ko(this.spinDirection));const s=this.spinDirection==="y";wo({autoplayBehavior:this.autoplayBehavior,spinY:s,reversed:this.autoplayReverse,loopTriggers:i})},t)}stopAutoplay(){if(this.showAllIcons(),this.autoplay=!1,window.clearTimeout(this.loopTimeoutId),this.loopTimeoutId=null,this.emit("onAutoplayStop"),this.hints!==!1&&!this.hintsOverlay&&!this.hintsHidden){const t=this.hints===!0?Ce(this.viewerConfig,this.touchDevice):this.hints;t&&t.length>0&&(this.hintsOverlay=Ie(this.innerBox,t),ke(this.hintsOverlay))}}destroy(){this.stopAutoplay(),this.inertiaAnimationId&&(cancelAnimationFrame(this.inertiaAnimationId),this.inertiaAnimationId=null),this.removeEvents(),this.canvasWorker&&(this.canvasWorker.terminate(),this.canvasWorker=null),this.hotspotsInstance&&this.hotspotsInstance.destroy(),this.hintsOverlay&&this.hintsOverlay.parentNode&&(this.hintsOverlay.parentNode.removeChild(this.hintsOverlay),this.hintsOverlay=null),this.hotspotTimeline&&this.hotspotTimeline.parentNode&&(this.hotspotTimeline.parentNode.removeChild(this.hotspotTimeline),this.hotspotTimeline=null,this.hotspotTimelineIndicator=null),this.container&&(this.container.classList.remove("ci360-theme-dark"),this.container.innerHTML="")}addInitialIcon(){this.initialIcon||this.hide360Logo||(this.initialIcon=Bi(this.logoSrc),this.innerBox.appendChild(this.initialIcon))}showInitialIcon(){!this.initialIcon||this.hasInteracted||(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=Vi(),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=zi(),this.fullscreenIcon.onclick=this.openFullscreenModal.bind(this),this.iconsContainer.appendChild(this.fullscreenIcon))}addCloseFullscreenIcon(){this.fullscreenCloseIcon=Fi(),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=Di(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=Gi(),this.innerBox.appendChild(this.loadingSpinner)}showLoadingSpinner(){this.loadingSpinner&&(this.hideAllIcons(),this.loadingSpinner.style.opacity=1)}createTransitionOverlay(){this.transitionOverlay=Ui(),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)}hideHints(){!this.hintsOverlay||this.hintsHidden||(this.hintsHidden=!0,to(this.hintsOverlay))}addHotspotTimeline(){if(!this.hotspots||this.hotspotTimeline)return;const t=so(this.container,this.amountX,this.hotspots);if(!t)return;this.hotspotTimeline=t.element,this.hotspotTimelineIndicator=t.indicator,this.hotspotTimeline.querySelectorAll(".cloudimage-360-hotspot-timeline-dot").forEach(o=>{o.addEventListener("click",n=>{n.stopPropagation();const s=parseInt(o.getAttribute("data-frame"),10),l=o.getAttribute("data-hotspot-id");isNaN(s)||this.animateToFrame(s,l)})}),this.updateHotspotTimelinePosition()}showHotspotTimeline(){ao(this.hotspotTimeline)}hideHotspotTimeline(){lo(this.hotspotTimeline)}updateHotspotTimelinePosition(){ro(this.hotspotTimelineIndicator,this.activeImageX,this.amountX)}animateToFrame(t,i){if(this.hotspotsInstance&&this.hotspotsInstance.hidePopper(),this.isAnimatingToFrame||t===this.activeImageX){t===this.activeImageX&&i&&this.hotspotsInstance&&this.hotspotTimelineOnClick&&this.hotspotsInstance.showHotspotById(i);return}this.isAnimatingToFrame=!0,this.hasInteracted=!0,(this.autoplay||this.loopTimeoutId)&&(this.stopAutoplay(),this.autoplay=!1),this.inertiaAnimationId&&(cancelAnimationFrame(this.inertiaAnimationId),this.inertiaAnimationId=null);const o=this.activeImageX,n=(t-o+this.amountX)%this.amountX,s=(o-t+this.amountX)%this.amountX,l=n<=s,r=l?n:s;if(r===0){this.isAnimatingToFrame=!1;return}const a=30;let c=r;const h=()=>{if(c<=0){this.isAnimatingToFrame=!1,i&&this.hotspotsInstance&&this.hotspotTimelineOnClick&&setTimeout(()=>{this.hotspotsInstance.showHotspotById(i)},50);return}l?this.moveRight():this.moveLeft(),c--,c>0?setTimeout(h,a):(this.isAnimatingToFrame=!1,i&&this.hotspotsInstance&&this.hotspotTimelineOnClick&&setTimeout(()=>{this.hotspotsInstance.showHotspotById(i)},50))};h()}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(),this.showHotspotTimeline()}hideAllIcons(){this.hideInitialIcon(),this.hide360ViewCircleIcon(),this.hideMagnifierIcon(),this.hideFullscreenIcon(),this.hideHotspotTimeline()}removeLoader(){this.loader&&(this.innerBox.removeChild(this.loader),this.loader=null)}attachEvents(t,i,o){t&&this.addMouseEvents(),i&&this.addTouchEvents(),o&&this.addKeyboardEvents(),this.addEscKeyHandler()}removeEvents(){this.removeMouseEvents(),this.removeTouchEvents(),this.removeKeyboardEvents(),this.removeEscKeyHandler()}addMouseEvents(){this.boundMouseClick=this.mouseClick.bind(this),this.boundMouseDown=this.mouseDown.bind(this),this.boundMouseMove=ue(this.mouseMove.bind(this),fe),this.boundMouseUp=this.mouseUp.bind(this),this.boundMouseLeave=this.mouseLeave.bind(this),this.innerBox.addEventListener("click",this.boundMouseClick),this.innerBox.addEventListener("mousedown",this.boundMouseDown),this.innerBox.addEventListener("mouseleave",this.boundMouseLeave),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=ue(this.touchMove.bind(this),fe),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)}addEscKeyHandler(){this.boundEscHandler=t=>{t.keyCode===27&&(this.fullscreenView?this.closeFullscreenModal(t):this.isZoomed?this.removeZoom():this.glass&&this.removeGlass())},document.addEventListener("keydown",this.boundEscHandler)}removeEscKeyHandler(){document.removeEventListener("keydown",this.boundEscHandler)}removeMouseEvents(){this.innerBox.removeEventListener("click",this.boundMouseClick),this.innerBox.removeEventListener("mousedown",this.boundMouseDown),this.innerBox.removeEventListener("mouseleave",this.boundMouseLeave),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(t){this.iconsContainer=we(this.innerBox),this.canvas=Wi(this.innerBox,t),this.loader=ji(this.innerBox),this.ariaLiveRegion=Ki(this.innerBox);const i=this.canvas.transferControlToOffscreen();this.canvasWorker.postMessage({action:"initCanvas",offscreen:i,devicePixelRatio:this.devicePixelRatio},[i]),this.fullscreenView&&this.addCloseFullscreenIcon(),$t(this.innerBox,".cloudimage-360-placeholder")}update(t){this.isReady&&(this.stopAutoplay(),$t(this.innerBox,".cloudimage-360-icons-container"),this.init(this.container,t,!0),this.iconsContainer=we(this.innerBox),this.onAllImagesLoaded())}init(t,i,o){const n=i?Ai(i):Ei(t),{folder:s,apiVersion:l,filenameX:r,filenameY:a,imageListX:c,imageListY:h,indexZeroBase:u,amountX:f,amountY:p,draggable:x=!0,swipeable:g=!0,keys:v,keysReverse:m,bottomCircleOffset:y,autoplay:I,autoplayBehavior:w,playOnce:C,speed:b,autoplayReverse:k,fullscreen:E,magnifier:O,ciToken:S,ciFilters:L,ciTransformation:M,lazyload:T,dragSpeed:U,stopAtEdges:_,pointerZoom:P,imageInfo:B="black",initialIconShown:ut,bottomCircle:K,hotspots:ft,dragReverse:St,hide360Logo:nt,logoSrc:mt,inertia:et,pinchZoom:$,hints:st,theme:rt,hotspotTimelineOnClick:J=!0,aspectRatio:vt,onReady:ne,onLoad:At,onSpin:se,onAutoplayStart:zt,onAutoplayStop:re,onFullscreenOpen:ae,onFullscreenClose:Nt,onZoomIn:Vt,onZoomOut:le,onDragStart:ce,onDragEnd:Q,onError:gt}=n,Lt={ciToken:S,ciFilters:L,ciTransformation:M},bt=Gt(c,[]),at=Gt(h,[]);if(this.viewerConfig=n,this.amountX=bt.length||f,this.amountY=at.length||p,this.allowSpinX=!!this.amountX,this.allowSpinY=!!this.amountY,this.activeImageX=k?this.amountX-1:0,this.activeImageY=k?this.amountY-1:0,this.bottomCircleOffset=y,this.autoplay=I,this.autoplayBehavior=w,this.playOnce=C,this.speed=b,this.autoplayReverse=k,this.fullscreen=E,this.magnifier=O>1?Math.min(O,Oi):0,this.dragSpeed=Math.max(U,ki),this.stopAtEdges=_,this.ciParams=Lt,this.apiVersion=l,this.pointerZoom=P>1?Math.min(P,ge):null,this.keysReverse=m,this.info=B,this.keys=v,this.innerBox=this.innerBox??Ni(this.container),vt&&(this.container.style.aspectRatio=vt),this.initialIconShown=ut,this.bottomCircle=K,this.spinDirection=Co(this.autoplayBehavior,this.allowSpinX,this.allowSpinY),this.dragReverse=St,this.hotspots=ft,this.hide360Logo=nt,this.logoSrc=mt,this.inertia=et,this.pinchZoom=$,this.hints=st,this.hotspotTimelineOnClick=J,rt==="dark"?this.container.classList.add("ci360-theme-dark"):rt==="light"&&this.container.classList.remove("ci360-theme-dark"),this.onReady=ne,this.onLoad=At,this.onSpin=se,this.onAutoplayStart=zt,this.onAutoplayStop=re,this.onFullscreenOpen=ae,this.onFullscreenClose=Nt,this.onZoomIn=Vt,this.onZoomOut=le,this.onDragStart=ce,this.onDragEnd=Q,this.onError=gt,this.srcXConfig={folder:s,filename:r,imageList:bt,container:t,innerBox:this.innerBox,apiVersion:l,ciParams:Lt,lazyload:T,amount:this.amountX,indexZeroBase:u,autoplayReverse:k,orientation:Y.X},this.srcYConfig={...this.srcXConfig,filename:a,imageList:at,orientation:Y.Y,amount:this.amountY},o&&this.removeEvents(),this.attachEvents(x,g,v),o)return;const Tt=(this.fullscreenView?document.body:this.container).offsetWidth,Yt=this.allowSpinX&&!bt.length?yt(this.srcXConfig,Tt):null,Xt=this.allowSpinY&&!at.length?yt(this.srcYConfig,Tt):null,Pt=Un=>{ye({cdnPathX:Yt,cdnPathY:Xt,configX:this.srcXConfig,configY:this.srcYConfig,onImageLoad:(Rt,_n,Kn)=>this.onImageLoad(Rt,_n,Kn),onFirstImageLoad:Rt=>this.onFirstImageLoaded(Un,Rt),onAllImagesLoad:this.onAllImagesLoaded.bind(this),onError:Rt=>this.emit("onError",Rt)})};this.allowSpinX?Ee(Yt,this.srcXConfig,Pt):this.allowSpinY&&Ee(Xt,this.srcYConfig,Pt)}}class Qe{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(t,i,o){if(!t)return;const n=t.id||this.generateId();t.id||(t.id=n);const s=new Ft(t,i,o);return this.views.set(n,s),s}initAll(t="cloudimage-360"){[...document.querySelectorAll(`.${t}`)].filter(Boolean).forEach(o=>{const n=o.id||this.generateId();o.id||(o.id=n);const s=new Ft(o);this.views.set(n,s)})}destroy(t){const i=this.getViewById(t);i&&(i.destroy(),this.views.delete(t))}destroyAll(){this.views.forEach(t=>{t.destroy()}),this.views.clear()}getViewById(t){return this.views.get(t)}getViews(){return Array.from(this.views.values())}updateView(t,i){const o=this.getViewById(t);if(!o)return null;const n={...o.viewerConfig,...i};o.destroy();const s=document.getElementById(t);return this.init(s,n)}}return window.CI360=Qe,Qe}();
|