js-cloudimage-360-view 4.0.0 → 4.1.1
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/README.md +972 -276
- package/dist/js-cloudimage-360-view.min.js +29 -2105
- package/dist/react/assets/canvas.worker-Cg0fkpD1.js.map +1 -0
- package/dist/react/ci360-COjOXkWS.js +35 -0
- package/dist/react/ci360-COjOXkWS.js.map +1 -0
- package/dist/react/ci360-CbNlMnNZ.mjs +2700 -0
- package/dist/react/ci360-CbNlMnNZ.mjs.map +1 -0
- package/dist/react/index.cjs +2 -0
- package/dist/react/index.cjs.map +1 -0
- package/dist/react/index.d.ts +228 -0
- package/dist/react/index.js +273 -0
- package/dist/react/index.js.map +1 -0
- package/dist/react/style.css +1 -0
- package/package.json +49 -10
- package/src/react/types.d.ts +228 -0
- package/src/types/ci360.d.ts +66 -0
- package/.prettierrc +0 -9
- package/dist/js-cloudimage-360-view.min.css +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"canvas.worker-Cg0fkpD1.js","sources":["../src/utils/zoom/calculate-zoomed-dimensions.js","../src/utils/zoom/calculate-zoomed-offset.js","../src/canvas.worker.js"],"sourcesContent":["export const calculateZoomedDimensions = (drawWidth, drawHeight, zoomScale) => {\n const zoomedWidth = drawWidth / zoomScale;\n const zoomedHeight = drawHeight / zoomScale;\n return { zoomedWidth, zoomedHeight };\n};\n","export const calculateZoomOffsets = ({\n pointerX,\n pointerY,\n imageData,\n zoomedWidth,\n zoomedHeight,\n drawWidth,\n drawHeight,\n}) => {\n const { naturalWidth, naturalHeight } = imageData;\n let zoomOffsetX = (pointerX / drawWidth) * naturalWidth - zoomedWidth / 2;\n let zoomOffsetY = (pointerY / drawHeight) * naturalHeight - zoomedHeight / 2;\n\n // Calculate max offset values\n const maxOffsetX = Math.max(0, naturalWidth - zoomedWidth);\n const maxOffsetY = Math.max(0, naturalHeight - zoomedHeight);\n\n // Clamp zoom offsets to the valid range\n zoomOffsetX = Math.max(0, Math.min(zoomOffsetX, maxOffsetX));\n zoomOffsetY = Math.max(0, Math.min(zoomOffsetY, maxOffsetY));\n\n return { zoomOffsetX, zoomOffsetY };\n};\n","import { calculateZoomedDimensions, calculateZoomOffsets } from './utils';\n\nlet canvas, ctx, dpr, drawWidth, drawHeight, wideImage;\n\nself.onmessage = async (event) => {\n const {\n action,\n offscreen,\n devicePixelRatio,\n imageData,\n zoomScale,\n pointerX,\n pointerY,\n imageAspectRatio,\n containerWidth,\n containerHeight,\n } = event.data;\n\n switch (action) {\n case 'initCanvas':\n initCanvas(offscreen, devicePixelRatio);\n break;\n case 'adaptCanvasSize':\n adaptCanvasSize(imageAspectRatio, containerWidth, containerHeight);\n break;\n case 'drawImageOnCanvas':\n drawImageOnCanvas(imageData, zoomScale, pointerX, pointerY);\n break;\n default:\n break;\n }\n};\n\nconst initCanvas = (offscreenCanvas, devicePixelRatio) => {\n canvas = offscreenCanvas;\n ctx = canvas.getContext('2d');\n dpr = devicePixelRatio;\n};\n\nconst adaptCanvasSize = (imageAspectRatio, containerWidth, containerHeight) => {\n const containerAspectRatio = containerWidth / containerHeight;\n wideImage = imageAspectRatio > containerAspectRatio;\n\n canvas.width = containerWidth * dpr;\n canvas.height = containerHeight * dpr;\n ctx.scale(dpr, dpr);\n\n if (wideImage) {\n drawWidth = containerWidth;\n drawHeight = containerWidth / imageAspectRatio;\n } else {\n drawHeight = containerHeight;\n drawWidth = containerHeight * imageAspectRatio;\n }\n\n ctx.imageSmoothingEnabled = true;\n ctx.imageSmoothingQuality = 'high';\n};\n\n// Draw the image on the OffscreenCanvas\nconst drawImageOnCanvas = (imageData = {}, zoomScale = 1, pointerX = 0, pointerY = 0) => {\n const { bitmapImage } = imageData;\n if (!canvas || !bitmapImage) return;\n\n let offsetX, offsetY;\n if (wideImage) {\n offsetX = 0;\n offsetY = (canvas.height / dpr - drawHeight) / 2;\n } else {\n offsetX = (canvas.width / dpr - drawWidth) / 2;\n offsetY = 0;\n }\n\n ctx.clearRect(0, 0, canvas.width, canvas.height);\n\n if (zoomScale !== 1) {\n const { naturalWidth, naturalHeight } = imageData;\n // Calculate zoomed dimensions using natural image dimensions, not display dimensions\n const { zoomedWidth, zoomedHeight } = calculateZoomedDimensions(naturalWidth, naturalHeight, zoomScale);\n\n const { zoomOffsetX, zoomOffsetY } = calculateZoomOffsets({\n pointerX,\n pointerY,\n imageData,\n zoomedWidth,\n zoomedHeight,\n drawWidth,\n drawHeight,\n });\n\n ctx.drawImage(\n bitmapImage,\n zoomOffsetX,\n zoomOffsetY,\n zoomedWidth,\n zoomedHeight,\n offsetX,\n offsetY,\n drawWidth,\n drawHeight\n );\n } else {\n ctx.drawImage(bitmapImage, offsetX, offsetY, drawWidth, drawHeight);\n }\n};\n"],"names":["calculateZoomedDimensions","drawWidth","drawHeight","zoomScale","zoomedWidth","zoomedHeight","calculateZoomOffsets","pointerX","pointerY","imageData","naturalWidth","naturalHeight","zoomOffsetX","zoomOffsetY","maxOffsetX","maxOffsetY","canvas","ctx","dpr","wideImage","event","action","offscreen","devicePixelRatio","imageAspectRatio","containerWidth","containerHeight","initCanvas","adaptCanvasSize","drawImageOnCanvas","offscreenCanvas","containerAspectRatio","bitmapImage","offsetX","offsetY"],"mappings":"yBAAO,MAAMA,EAA4B,CAACC,EAAWC,EAAYC,IAAc,CAC7E,MAAMC,EAAcH,EAAYE,EAC1BE,EAAeH,EAAaC,EAClC,MAAO,CAAE,YAAAC,EAAa,aAAAC,CAAY,CACpC,ECJaC,EAAuB,CAAC,CACnC,SAAAC,EACA,SAAAC,EACA,UAAAC,EACA,YAAAL,EACA,aAAAC,EACA,UAAAJ,EACA,WAAAC,CACF,IAAM,CACJ,KAAM,CAAE,aAAAQ,EAAc,cAAAC,CAAa,EAAKF,EACxC,IAAIG,EAAeL,EAAWN,EAAaS,EAAeN,EAAc,EACpES,EAAeL,EAAWN,EAAcS,EAAgBN,EAAe,EAG3E,MAAMS,EAAa,KAAK,IAAI,EAAGJ,EAAeN,CAAW,EACnDW,EAAa,KAAK,IAAI,EAAGJ,EAAgBN,CAAY,EAG3D,OAAAO,EAAc,KAAK,IAAI,EAAG,KAAK,IAAIA,EAAaE,CAAU,CAAC,EAC3DD,EAAc,KAAK,IAAI,EAAG,KAAK,IAAIA,EAAaE,CAAU,CAAC,EAEpD,CAAE,YAAAH,EAAa,YAAAC,CAAW,CACnC,ECpBA,IAAIG,EAAQC,EAAKC,EAAKjB,EAAWC,EAAYiB,EAE7C,KAAK,UAAY,MAAOC,GAAU,CAChC,KAAM,CACJ,OAAAC,EACA,UAAAC,EACA,iBAAAC,EACA,UAAAd,EACA,UAAAN,EACA,SAAAI,EACA,SAAAC,EACA,iBAAAgB,EACA,eAAAC,EACA,gBAAAC,CACJ,EAAMN,EAAM,KAEV,OAAQC,EAAM,CACZ,IAAK,aACHM,EAAWL,EAAWC,CAAgB,EACtC,MACF,IAAK,kBACHK,EAAgBJ,EAAkBC,EAAgBC,CAAe,EACjE,MACF,IAAK,oBACHG,EAAkBpB,EAAWN,EAAWI,EAAUC,CAAQ,EAC1D,KAGN,CACA,EAEA,MAAMmB,EAAa,CAACG,EAAiBP,IAAqB,CACxDP,EAASc,EACTb,EAAMD,EAAO,WAAW,IAAI,EAC5BE,EAAMK,CACR,EAEMK,EAAkB,CAACJ,EAAkBC,EAAgBC,IAAoB,CAC7E,MAAMK,EAAuBN,EAAiBC,EAC9CP,EAAYK,EAAmBO,EAE/Bf,EAAO,MAAQS,EAAiBP,EAChCF,EAAO,OAASU,EAAkBR,EAClCD,EAAI,MAAMC,EAAKA,CAAG,EAEdC,GACFlB,EAAYwB,EACZvB,EAAauB,EAAiBD,IAE9BtB,EAAawB,EACbzB,EAAYyB,EAAkBF,GAGhCP,EAAI,sBAAwB,GAC5BA,EAAI,sBAAwB,MAC9B,EAGMY,EAAoB,CAACpB,EAAY,CAAA,EAAIN,EAAY,EAAGI,EAAW,EAAGC,EAAW,IAAM,CACvF,KAAM,CAAE,YAAAwB,CAAW,EAAKvB,EACxB,GAAI,CAACO,GAAU,CAACgB,EAAa,OAE7B,IAAIC,EAASC,EAWb,GAVIf,GACFc,EAAU,EACVC,GAAWlB,EAAO,OAASE,EAAMhB,GAAc,IAE/C+B,GAAWjB,EAAO,MAAQE,EAAMjB,GAAa,EAC7CiC,EAAU,GAGZjB,EAAI,UAAU,EAAG,EAAGD,EAAO,MAAOA,EAAO,MAAM,EAE3Cb,IAAc,EAAG,CACnB,KAAM,CAAE,aAAAO,EAAc,cAAAC,CAAa,EAAKF,EAElC,CAAE,YAAAL,EAAa,aAAAC,CAAY,EAAKL,EAA0BU,EAAcC,EAAeR,CAAS,EAEhG,CAAE,YAAAS,EAAa,YAAAC,CAAW,EAAKP,EAAqB,CACxD,SAAAC,EACA,SAAAC,EACA,UAAAC,EACA,YAAAL,EACA,aAAAC,EACA,UAAAJ,EACA,WAAAC,CACN,CAAK,EAEDe,EAAI,UACFe,EACApB,EACAC,EACAT,EACAC,EACA4B,EACAC,EACAjC,EACAC,CACN,CACE,MACEe,EAAI,UAAUe,EAAaC,EAASC,EAASjC,EAAWC,CAAU,CAEtE"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";var Qe=Object.defineProperty;var ti=(e,t,i)=>t in e?Qe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i;var le=(e,t,i)=>ti(e,typeof t!="symbol"?t+"":t,i);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var Mt=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function ei(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Ze="Expected a function",ce=NaN,ii="[object Symbol]",ni=/^\s+|\s+$/g,oi=/^[-+]0x[0-9a-f]+$/i,si=/^0b[01]+$/i,ri=/^0o[0-7]+$/i,ai=parseInt,li=typeof Mt=="object"&&Mt&&Mt.Object===Object&&Mt,ci=typeof self=="object"&&self&&self.Object===Object&&self,hi=li||ci||Function("return this")(),di=Object.prototype,ui=di.toString,pi=Math.max,fi=Math.min,Kt=function(){return hi.Date.now()};function mi(e,t,i){var n,o,s,l,r,a,c=0,h=!1,p=!1,f=!0;if(typeof e!="function")throw new TypeError(Ze);t=he(t)||0,Bt(i)&&(h=!!i.leading,p="maxWait"in i,s=p?pi(he(i.maxWait)||0,t):s,f="trailing"in i?!!i.trailing:f);function u(y){var O=n,S=o;return n=o=void 0,c=y,l=e.apply(S,O),l}function I(y){return c=y,r=setTimeout(m,t),h?u(y):l}function g(y){var O=y-a,S=y-c,E=t-O;return p?fi(E,s-S):E}function v(y){var O=y-a,S=y-c;return a===void 0||O>=t||O<0||p&&S>=s}function m(){var y=Kt();if(v(y))return b(y);r=setTimeout(m,g(y))}function b(y){return r=void 0,f&&n?u(y):(n=o=void 0,l)}function x(){r!==void 0&&clearTimeout(r),c=0,n=a=o=r=void 0}function w(){return r===void 0?l:b(Kt())}function C(){var y=Kt(),O=v(y);if(n=arguments,o=this,a=y,O){if(r===void 0)return I(a);if(p)return r=setTimeout(m,t),u(a)}return r===void 0&&(r=setTimeout(m,t)),l}return C.cancel=x,C.flush=w,C}function vi(e,t,i){var n=!0,o=!0;if(typeof e!="function")throw new TypeError(Ze);return Bt(i)&&(n="leading"in i?!!i.leading:n,o="trailing"in i?!!i.trailing:o),mi(e,t,{leading:n,maxWait:t,trailing:o})}function Bt(e){var t=typeof e;return!!e&&(t=="object"||t=="function")}function gi(e){return!!e&&typeof e=="object"}function yi(e){return typeof e=="symbol"||gi(e)&&ui.call(e)==ii}function he(e){if(typeof e=="number")return e;if(yi(e))return ce;if(Bt(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=Bt(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=e.replace(ni,"");var i=si.test(e);return i||ri.test(e)?ai(e.slice(2),i?2:8):oi.test(e)?ce:+e}var bi=vi;const de=ei(bi),M={SPIN_X:"spin-x",SPIN_Y:"spin-y",SPIN_XY:"spin-xy",SPIN_YX:"spin-yx"},wi=[!1,0,null,void 0,"false","0","null","undefined"],P={X:"x-axis",Y:"y-axis"},Ii=[37,39],xi=[38,40],ue=10,Ci=150,pe=800,Oi=150,Ei=200,fe=50,Si=50,Ai=5,me=5,Li="https://scaleflex.cloudimg.io/v7/filerobot/js-cloudimage-360-view/360_view.svg",d={folder:"/",apiVersion:"v7",filenameX:"image-{index}.jpg",filenameY:null,imageListX:null,imageListY:null,indexZeroBase:0,amountX:0,amountY:0,speed:80,dragSpeed:150,draggable:!0,swipeable:!0,keys:!1,keysReverse:!1,autoplay:!1,autoplayBehavior:M.SPIN_X,playOnce:!1,autoplayReverse:!1,pointerZoom:0,fullscreen:!1,magnifier:null,bottomCircle:!0,bottomCircleOffset:5,ciToken:null,ciFilters:null,ciTransformation:null,lazyload:!0,dragReverse:!1,stopAtEdges:!1,imageInfo:!1,initialIconShown:!0,hotspots:null,hide360Logo:!1,logoSrc:Li,inertia:!1,pinchZoom:!0,hints:!0,theme:null,hotspotTimelineOnClick:!0,onReady:null,onLoad:null,onSpin:null,onAutoplayStart:null,onAutoplayStop:null,onFullscreenOpen:null,onFullscreenClose:null,onZoomIn:null,onZoomOut:null,onDragStart:null,onDragEnd:null},ki=e=>({folder:k(e,"folder",d.folder),apiVersion:k(e,"api-version",d.apiVersion),filenameX:k(e,"filename")||k(e,"filename-x")||d.filenameX,filenameY:k(e,"filename-y",d.filenameY),imageListX:k(e,"image-list-x",d.imageListX),imageListY:k(e,"image-list-y",d.imageListY),indexZeroBase:parseInt(k(e,"index-zero-base",d.indexZeroBase),10),amountX:parseInt(k(e,"amount-x",d.amountX),10),amountY:parseInt(k(e,"amount-y",d.amountY),10),speed:parseInt(k(e,"speed",d.speed),10),dragSpeed:parseInt(k(e,"drag-speed",d.dragSpeed),10),draggable:X(e,"draggable",d.draggable),swipeable:X(e,"swipeable",d.swipeable),keys:X(e,"keys",d.keys),keysReverse:X(e,"keys-reverse",d.keysReverse),autoplay:X(e,"autoplay",d.autoplay),autoplayBehavior:k(e,"autoplay-behavior",d.autoplayBehavior),playOnce:X(e,"play-once",d.playOnce),autoplayReverse:X(e,"autoplay-reverse",d.autoplayReverse),pointerZoom:parseFloat(k(e,"pointer-zoom",d.pointerZoom)),fullscreen:X(e,"fullscreen")||X(e,"full-screen",d.fullscreen),magnifier:parseFloat(k(e,"magnifier",d.magnifier)),bottomCircleOffset:parseInt(k(e,"bottom-circle-offset",d.bottomCircleOffset),10),ciToken:k(e,"responsive",d.ciToken),ciFilters:k(e,"filters",d.ciFilters),ciTransformation:k(e,"transformation",d.ciTransformation),lazyload:X(e,"lazyload",d.lazyload),dragReverse:X(e,"drag-reverse",d.dragReverse),stopAtEdges:X(e,"stop-at-edges",d.stopAtEdges),imageInfo:X(e,"info",d.imageInfo),initialIconShown:!Ht(e,"initial-icon"),bottomCircle:!Ht(e,"bottom-circle"),hide360Logo:X(e,"hide-360-logo",d.hide360Logo),logoSrc:k(e,"logo-src",d.logoSrc),inertia:X(e,"inertia",d.inertia),pinchZoom:X(e,"pinch-zoom",d.pinchZoom),hints:!Ht(e,"hints"),theme:k(e,"theme",d.theme),hotspotTimelineOnClick:!Ht(e,"hotspot-timeline-on-click")}),Ti=e=>{const t=[];e.amountX!==void 0&&e.amountX<0&&t.push("amountX should be a positive number"),e.amountY!==void 0&&e.amountY<0&&t.push("amountY should be a positive number"),e.speed!==void 0&&e.speed<=0&&t.push("speed should be a positive number"),e.dragSpeed!==void 0&&e.dragSpeed<=0&&t.push("dragSpeed should be a positive number"),e.pointerZoom!==void 0&&e.pointerZoom!==0&&(e.pointerZoom<1||e.pointerZoom>5)&&t.push("pointerZoom should be between 1 and 5 (or 0 to disable)"),e.magnifier!==void 0&&e.magnifier!==null&&e.magnifier!==0&&(e.magnifier<1||e.magnifier>5)&&t.push("magnifier should be between 1 and 5 (or 0/null to disable)"),!e.folder&&!e.imageListX&&!e.imageListY&&t.push("Either folder or imageListX/imageListY is required"),e.folder&&!e.amountX&&!e.imageListX&&t.push("amountX is required when using folder (unless imageListX is provided)");const i=["spin-x","spin-y","spin-xy","spin-yx"];return e.autoplayBehavior&&!i.includes(e.autoplayBehavior)&&t.push(`autoplayBehavior should be one of: ${i.join(", ")}`),t.forEach(n=>{console.warn(`CloudImage 360: ${n}`)}),t.length===0},Yi=e=>(Ti(e),{folder:e.folder||d.folder,apiVersion:e.apiVersion||d.apiVersion,filenameX:e.filenameX||e.filename||d.filenameX,filenameY:e.filenameY||d.filenameY,imageListX:e.imageListX||d.imageListX,imageListY:e.imageListY||d.imageListY,indexZeroBase:parseInt(e.indexZeroBase??d.indexZeroBase,10),amountX:parseInt(e.amountX??d.amountX,10),amountY:parseInt(e.amountY??d.amountY,10),speed:parseInt(e.speed??d.speed,10),draggable:e.draggable??d.draggable,swipeable:e.swipeable??d.swipeable,dragSpeed:parseInt(e.dragSpeed??d.dragSpeed,10),keys:e.keys??d.keys,keysReverse:e.keysReverse??d.keysReverse,autoplay:e.autoplay??d.autoplay,autoplayBehavior:e.autoplayBehavior||d.autoplayBehavior,playOnce:e.playOnce??d.playOnce,autoplayReverse:e.autoplayReverse??d.autoplayReverse,pointerZoom:parseFloat(e.pointerZoom??d.pointerZoom),fullscreen:e.fullscreen??d.fullscreen,magnifier:parseFloat(e.magnifier??d.magnifier),bottomCircleOffset:parseInt(e.bottomCircleOffset??d.bottomCircleOffset,10),ciToken:e.ciToken||d.ciToken,ciFilters:e.ciFilters||d.ciFilters,ciTransformation:e.ciTransformation||d.ciTransformation,lazyload:e.lazyload??d.lazyload,dragReverse:e.dragReverse??d.dragReverse,stopAtEdges:e.stopAtEdges??d.stopAtEdges,imageInfo:e.imageInfo??d.imageInfo,initialIconShown:e.initialIconShown??d.initialIconShown,bottomCircle:e.bottomCircle??d.bottomCircle,hotspots:e.hotspots??d.hotspots,hide360Logo:e.hide360Logo??d.hide360Logo,logoSrc:e.logoSrc||d.logoSrc,inertia:e.inertia??d.inertia,pinchZoom:e.pinchZoom??d.pinchZoom,hints:e.hints??d.hints,theme:e.theme||d.theme,hotspotTimelineOnClick:e.hotspotTimelineOnClick??d.hotspotTimelineOnClick,onReady:e.onReady??d.onReady,onLoad:e.onLoad??d.onLoad,onSpin:e.onSpin??d.onSpin,onAutoplayStart:e.onAutoplayStart??d.onAutoplayStart,onAutoplayStop:e.onAutoplayStop??d.onAutoplayStop,onFullscreenOpen:e.onFullscreenOpen??d.onFullscreenOpen,onFullscreenClose:e.onFullscreenClose??d.onFullscreenClose,onZoomIn:e.onZoomIn??d.onZoomIn,onZoomOut:e.onZoomOut??d.onZoomOut,onDragStart:e.onDragStart??d.onDragStart,onDragEnd:e.onDragEnd??d.onDragEnd}),k=(e,t,i)=>e.getAttribute(t)||e.getAttribute(`data-${t}`)||i,X=(e,t,i)=>{if(!(e.hasAttribute(t)||e.hasAttribute(`data-${t}`)))return i;const o=k(e,t,null);return o!=="false"&&o!=="0"},Ht=(e,t)=>k(e,t,null)==="false",Xi=(e=1)=>{const t=Math.round(window.devicePixelRatio||1);return parseInt(e)*t},Pi=(e,t,i)=>new URL(e).origin.includes("cloudimg")?e:`https://${t}.cloudimg.io/${i}${e}`,Ri=({ciTransformation:e,responsiveWidth:t,ciFilters:i})=>{const n=`width=${t}`,o=e||n,s=i?`&f=${i}`:"";return`${o}${s}`},Ot=(e,t)=>{const{folder:i,apiVersion:n,filename:o="",ciParams:s}=e,{ciToken:l,ciFilters:r,ciTransformation:a}=s||{},c=`${i}${o}`;if(!l)return c;const h=wi.includes(n)?null:n,p=h?`${h}/`:"",f=Xi(t),u=Pi(c,l,p),I=Ri({ciTransformation:a,responsiveWidth:f,ciFilters:r});return`${u}${I?"?":""}${I}`},Mi=(e,t,i)=>{const[n,o]=e.split("?"),s=`${t}=${encodeURIComponent(i)}`;if(!o)return`${n}?${s}`;const l=new URLSearchParams(o);return l.set(t,i),`${n}?${l.toString()}`},Hi=(e,t)=>Mi(e,"width",t),Be=(e,t=0)=>(e+="",e.length>=t?e:new Array(t-e.length+1).join("0")+e),Di=(e,{amount:t=0,indexZeroBase:i=0}={})=>Array.from({length:t},(n,o)=>e.replace("{index}",Be(o+1,i))),Zi=({imagesUrls:e,onFirstImageLoad:t,onImageLoad:i,onAllImagesLoad:n,onError:o,autoplayReverse:s})=>{let l=0,r=0;const a=e.length,c=[],h=[],p=(m,b,x=!1)=>{const w={message:`Failed to load image: ${m}`,url:m,index:b,isFirstImage:x};h.push(w),r++,o==null||o({error:w,errorCount:r,totalImages:a,errors:h})},f=()=>{l===a&&(n==null||n(c,{errorCount:r,errors:h}))},u=(m,b)=>{const x=new Image;x.crossOrigin="anonymous",x.src=m,x.onload=async()=>{try{const w=await createImageBitmap(x),C={src:m,bitmapImage:w,naturalWidth:x.naturalWidth,naturalHeight:x.naturalHeight};l++,c[b]=C,i==null||i(C,b),f()}catch{l++,p(m,b),f()}},x.onerror=()=>{l++,p(m,b),f()}},I=new Image,g=s?e.length-1:0,v=e[g];I.crossOrigin="anonymous",I.src=v,I.onload=async()=>{try{const m=await createImageBitmap(I),b={src:v,bitmapImage:m,naturalWidth:I.naturalWidth,naturalHeight:I.naturalHeight};c[g]=b,l++,t==null||t(b),i==null||i(b,g);for(let x=0;x<e.length;x++)x!==g&&u(e[x],x);f()}catch{l++,p(v,g,!0);for(let b=0;b<e.length;b++)b!==g&&u(e[b],b);f()}},I.onerror=()=>{l++,p(v,g,!0);for(let m=0;m<e.length;m++)m!==g&&u(e[m],m);f()}},ve=({cdnPathX:e,cdnPathY:t,configX:i,configY:n,onFirstImageLoad:o,onImageLoad:s,onAllImagesLoad:l,onError:r})=>{let a={x:!1,y:!1},c=[],h=[],p={errorCount:0,errors:[]},f={errorCount:0,errors:[]};const u=e||i.imageList.length,I=t||n.imageList.length,g=()=>{if(a.x&&a.y){const m={errorCount:p.errorCount+f.errorCount,errors:[...p.errors,...f.errors]};l==null||l(c,h,m)}},v=({cdnPath:m,config:b,orientation:x,loadedImages:w,loadStats:C,onFirstImageLoad:y})=>{const O=x===P.X,S=b.imageList.length?b.imageList:Di(m,b);Zi({imagesUrls:S,onFirstImageLoad:y,onImageLoad:(E,A)=>{s==null||s(E,A,x),w[A]=E},onError:E=>{r==null||r({...E,orientation:x})},onAllImagesLoad:(E,A)=>{w.length=0,E.forEach((L,R)=>{L&&(w[R]=L)}),C.errorCount=A.errorCount,C.errors=A.errors.map(L=>({...L,orientation:x})),a[O?"x":"y"]=!0,g()},autoplayReverse:b.autoplayReverse})};u?v({cdnPath:e,config:i,orientation:P.X,loadedImages:c,loadStats:p,onFirstImageLoad:o}):a.x=!0,I?v({cdnPath:t,config:n,orientation:P.Y,loadedImages:h,loadStats:f,onFirstImageLoad:u?void 0:o}):a.y=!0,!u&&!I&&g()},Bi=`
|
|
2
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1052 156" aria-hidden="true">
|
|
3
|
+
<path fill="currentColor" d="M409.9,145.6c-42.7-1.7-85.5-4.4-128.1-8.4c-21.3-2-42.6-4.3-63.8-7.1c-21.2-2.8-42.4-5.9-63.4-9.7c-21.1-3.8-42-8.2-62.7-13.7c-10.3-2.8-20.6-5.8-30.7-9.4c-10.1-3.5-20.1-7.6-29.5-12.7c-4.7-2.6-9.3-5.4-13.5-8.8c-2.1-1.7-4-3.6-5.8-5.6c-1.8-2-3.3-4.3-4.3-6.8c-1.1-2.5-1.6-5.3-1.4-8c0.2-2.7,1.1-5.4,2.4-7.7c2.7-4.8,6.7-8.5,11-11.7c8.6-6.4,18.4-10.9,28.3-15c9.9-4,20.1-7.3,30.4-10.3c-10.2,3.1-20.4,6.5-30.3,10.5c-9.8,4.1-19.6,8.7-28.1,15.1c-4.2,3.2-8.2,6.9-10.7,11.6c-1.2,2.3-2.1,4.8-2.3,7.5c-0.1,2.6,0.4,5.2,1.4,7.6c2.1,4.8,5.9,8.7,10,12.1c4.1,3.3,8.7,6.1,13.4,8.6c9.4,5,19.4,8.9,29.4,12.4c10.1,3.5,20.4,6.4,30.7,9.1c20.7,5.3,41.6,9.5,62.7,13.2c21,3.6,42.2,6.6,63.4,9.2c21.2,2.6,42.5,4.8,63.7,6.6c42.6,3.7,85.2,6,127.9,7.4L409.9,145.6z"/>
|
|
4
|
+
<path fill="currentColor" d="M977.1,11.6c13.8,4.1,27.4,8.8,40.4,15.2c6.4,3.2,12.7,6.9,18.3,11.5c2.7,2.4,5.3,5,7.3,8c2,3,3.3,6.6,3.3,10.3c0,3.7-1.4,7.2-3.3,10.3c-2,3.1-4.5,5.7-7.3,8.1c-2.7,2.4-5.7,4.4-8.8,6.3c-1.6,0.9-3.1,1.9-4.7,2.7l-2.4,1.3l-2.4,1.2C1004.5,93,990.8,97.8,977,102c-6.9,2.1-13.8,4-20.8,5.8c-7,1.8-14,3.5-21,5c-14.1,3.1-28.2,5.9-42.4,8.3c-28.4,4.9-57,8.8-85.6,12c-57.3,6.4-114.8,10.2-172.4,12.2c-57.6,2-115.2,2.3-172.9,0.8l0.1-4c57.5,1.8,115.1,1.9,172.6,0.2c57.5-1.7,115-5.2,172.3-11.2c28.6-3.1,57.2-6.7,85.6-11.5c14.2-2.4,28.3-5,42.4-8.1c7-1.5,14-3.1,21-4.9c7-1.7,13.9-3.6,20.8-5.7c13.8-4.1,27.4-8.8,40.3-15.2l2.4-1.2l2.4-1.3c1.6-0.8,3.1-1.8,4.7-2.7c3-1.9,6-3.9,8.7-6.2c2.7-2.3,5.2-4.9,7.2-7.9c1.9-3,3.2-6.4,3.3-10c0-3.6-1.2-7-3.1-10c-1.9-3-4.4-5.6-7.1-8c-5.5-4.7-11.7-8.3-18.1-11.6C1004.5,20.6,990.8,15.8,977.1,11.6z"/>
|
|
5
|
+
<g transform="translate(415, 136)">
|
|
6
|
+
<path fill="currentColor" d="M18.1,11.2c-1.8,0-2.8-1.2-2.8-3V8c0.8-0.4,1.7-0.6,2.8-0.6c1.5,0,2.5,0.6,2.5,1.7C20.6,10.2,19.8,11.2,18.1,11.2L18.1,11.2z M18.3,5.7c-1.1,0-2,0.3-2.8,0.7c0.3-1.6,1.5-2.6,3.7-2.6c1.1,0,2.3,0.3,3.1,0.5V2.6c-0.8-0.3-1.9-0.5-3.1-0.5c-4.2,0-6.2,2.1-6.2,5.8c0,3.2,1.8,4.9,5.1,4.9c3.3,0,5-1.7,5-3.6C23,7,21.3,5.7,18.3,5.7L18.3,5.7z"/>
|
|
7
|
+
<path fill="currentColor" d="M39.3,1.8c0.9,0,1.6,0.7,1.6,1.5c0,0.8-0.7,1.6-1.6,1.6c-0.8,0-1.6-0.7-1.6-1.6C37.8,2.5,38.5,1.8,39.3,1.8L39.3,1.8z M39.3,6.3c1.7,0,3.1-1.3,3.1-3c0-1.6-1.4-3-3.1-3c-1.7,0-3.1,1.3-3.1,3C36.2,5,37.6,6.3,39.3,6.3L39.3,6.3z"/>
|
|
8
|
+
<path fill="currentColor" d="M30.3,3.8c2.1,0,2.9,1.4,2.9,3.6c0,2.2-0.8,3.6-2.9,3.6c-2.1,0-2.9-1.5-2.9-3.6C27.4,5.3,28.1,3.8,30.3,3.8L30.3,3.8z M30.2,12.8c3.9,0,5.2-2.6,5.2-5.4c0-2.8-1.3-5.3-5.2-5.3c-3.9,0-5.3,2.6-5.3,5.4C25,10.3,26.3,12.8,30.2,12.8L30.2,12.8z"/>
|
|
9
|
+
<path fill="currentColor" d="M10.9,9.7c0-1.1-0.8-2-2.5-2.5c1.3-0.5,1.9-1.3,1.9-2.3c0-1.7-1.7-2.8-4.6-2.8c-1.5,0-2.7,0.3-3.6,0.8v1.7c0.9-0.4,2.3-0.7,3.4-0.7C7,3.9,8,4.4,8,5.1c0,0.8-0.7,1.3-2.4,1.3H4.3v1.6h1.3c2,0,2.9,0.8,2.9,1.6c0,0.8-1,1.5-2.8,1.5c-1.5,0-2.8-0.3-3.7-0.6v1.7c0.9,0.3,2.1,0.6,3.8,0.6C9.2,12.8,10.9,11.4,10.9,9.7"/>
|
|
10
|
+
</g>
|
|
11
|
+
</svg>
|
|
12
|
+
`,Wi=e=>{const t=document.createElement("div");return t.innerHTML=Bi,t.style.bottom=`${e}%`,t.className="cloudimage-360-view-360-circle",t},Fi=`
|
|
13
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100" fill="none" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
|
|
14
|
+
<!-- Circular arrows -->
|
|
15
|
+
<path d="M 75 50 A 25 25 0 1 1 50 25" stroke="currentColor" stroke-width="3"/>
|
|
16
|
+
<path d="M 25 50 A 25 25 0 1 1 50 75" stroke="currentColor" stroke-width="3"/>
|
|
17
|
+
<!-- Arrow heads -->
|
|
18
|
+
<path d="M 50 25 L 56 31 M 50 25 L 56 19" stroke="currentColor" stroke-width="3"/>
|
|
19
|
+
<path d="M 50 75 L 44 69 M 50 75 L 44 81" stroke="currentColor" stroke-width="3"/>
|
|
20
|
+
<!-- 360 text -->
|
|
21
|
+
<text x="50" y="54" text-anchor="middle" font-size="16" font-weight="600" fill="currentColor" stroke="none" font-family="system-ui, -apple-system, sans-serif">360°</text>
|
|
22
|
+
</svg>
|
|
23
|
+
`,Ni=e=>{const t=document.createElement("div");return t.className="cloudimage-initial-icon",t.setAttribute("aria-label","360 degree view - drag to rotate"),e?(t.style.backgroundImage=`url('${e}')`,t.style.backgroundPosition="50% 50%",t.style.backgroundSize="contain",t.style.backgroundRepeat="no-repeat"):t.innerHTML=Fi,t},Vi=(e,t)=>{const{width:i,height:n}=t,o=document.createElement("canvas");return o.width=i,o.height=n,o.style.width="100%",o.style.height="auto",e.appendChild(o),o},ji=()=>{const e=document.createElement("button");return e.className="cloudimage-360-button cloudimage-360-close-icon",e.setAttribute("aria-label","Close fullscreen"),e.setAttribute("type","button"),e.innerHTML='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M18 6 6 18"/><path d="m6 6 12 12"/></svg>',e},$i=()=>{const e=document.createElement("button");return e.className="cloudimage-360-button cloudimage-360-fullscreen-button",e.setAttribute("aria-label","View fullscreen"),e.setAttribute("type","button"),e.innerHTML='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><polyline points="15 3 21 3 21 9"/><polyline points="9 21 3 21 3 15"/><line x1="21" x2="14" y1="3" y2="10"/><line x1="3" x2="10" y1="21" y2="14"/></svg>',e},ge=e=>{const t=document.createElement("div");return t.className="cloudimage-360-icons-container",e.appendChild(t),t},zi=e=>{const t=document.createElement("div");return t.className="cloudimage-360-inner-box",t.setAttribute("role","img"),t.setAttribute("aria-label","360 degree product view. Use mouse drag or arrow keys to rotate."),e.appendChild(t),t},Gi=()=>{const e=document.createElement("button");return e.className="cloudimage-360-button cloudimage-360-magnifier-button",e.setAttribute("aria-label","Magnify image"),e.setAttribute("type","button"),e.innerHTML='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="11" cy="11" r="8"/><path d="m21 21-4.3-4.3"/><path d="M11 8v6"/><path d="M8 11h6"/></svg>',e},Ui=e=>{const t=document.createElement("div");t.className="cloudimage-initial-icon";const i=document.createElement("span");return i.className="percentage",i.innerText="0%",t.appendChild(i),e.appendChild(t),t},Ki=e=>{const t=document.createElement("div");t.className="cloudimage-360-fullscreen-modal";const i=e.cloneNode();return i.style.width="100%",i.style.maxWidth="100%",i.style.height="100vh",i.style.maxHeight="100%",t.appendChild(i),window.document.body.appendChild(t),i},Jt=(e,t)=>{const i=e.querySelector(t);i&&i.parentNode.removeChild(i)},_i=()=>{const e=document.createElement("div");return e.className="cloudimage-loading-spinner",e},Ji=()=>{const e=document.createElement("div");return e.className="cloudimage-360-transition-overlay",e},qi=e=>{const t=document.createElement("div");return t.className="cloudimage-360-hotspot-container",e.appendChild(t),t},Qi=e=>{const t=document.createElement("div");return t.className="cloudimage-360-sr-only",t.setAttribute("role","status"),t.setAttribute("aria-live","polite"),t.setAttribute("aria-atomic","true"),e.appendChild(t),t},tn=(e,t)=>{e&&(e.textContent="",setTimeout(()=>{e.textContent=t},50))},We={drag:'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M18 11V6a2 2 0 0 0-2-2a2 2 0 0 0-2 2"/><path d="M14 10V4a2 2 0 0 0-2-2a2 2 0 0 0-2 2v2"/><path d="M10 10.5V6a2 2 0 0 0-2-2a2 2 0 0 0-2 2v8"/><path d="M18 8a2 2 0 1 1 4 0v6a8 8 0 0 1-8 8h-2c-2.8 0-4.5-.86-5.99-2.34l-3.6-3.6a2 2 0 0 1 2.83-2.82L7 15"/></svg>',swipe:'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="m18 16 4-4-4-4"/><path d="m6 8-4 4 4 4"/><path d="M8 12h8"/></svg>',click:'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="m9 9 5 12 1.8-5.2L21 14Z"/><path d="M7.2 2.2 8 5.1"/><path d="m5.1 8-2.9-.8"/><path d="M14 4.1 12 6"/><path d="m6 12-1.9 2"/></svg>',pinch:'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M6 6l4 4"/><path d="M18 6l-4 4"/><path d="M6 18l4-4"/><path d="M18 18l-4-4"/><circle cx="12" cy="12" r="2"/></svg>',keys:'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect width="20" height="16" x="2" y="4" rx="2"/><path d="m9 10 3 3 3-3"/></svg>',fullscreen:'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><polyline points="15 3 21 3 21 9"/><polyline points="9 21 3 21 3 15"/><line x1="21" x2="14" y1="3" y2="10"/><line x1="3" x2="10" y1="21" y2="14"/></svg>'},en={drag:"Drag to rotate",swipe:"Swipe to rotate",click:"Click to zoom",pinch:"Pinch to zoom",keys:"Use arrow keys",fullscreen:"Click for fullscreen"},nn=e=>{const t=document.createElement("div");return t.className="cloudimage-360-hint-item",t.innerHTML=`
|
|
24
|
+
${We[e]}
|
|
25
|
+
<span>${en[e]}</span>
|
|
26
|
+
`,t},ye=(e,t=[])=>{if(!t||t.length===0)return null;const i=document.createElement("div");i.className="cloudimage-360-hints-overlay",i.setAttribute("role","tooltip"),i.setAttribute("aria-label","Interaction hints");const n=document.createElement("div");return n.className="cloudimage-360-hints-container",t.forEach(o=>{We[o]&&n.appendChild(nn(o))}),i.appendChild(n),e.appendChild(i),i},be=(e,t)=>t?["swipe"]:["drag","click"],we=e=>{e&&e.classList.add("visible")},on=e=>{e&&(e.classList.remove("visible"),e.classList.add("hiding"),setTimeout(()=>{e.classList.remove("hiding")},300))},sn=e=>{if(!e||typeof e!="object")return null;const t=Object.keys(e).map(n=>parseInt(n,10)).filter(n=>!isNaN(n)).sort((n,o)=>n-o);if(t.length===0)return null;const i=Math.floor(t.length/2);return t[i]},rn=e=>{const t=[];return!e||!Array.isArray(e)||e.forEach((i,n)=>{const o=sn(i.positions);o!==null&&t.push({id:i.id||`hotspot-${n}`,frame:o,label:i.label||null})}),t},an=400,ln=(e,t,i,n)=>{const o=document.createElement("button");o.className="cloudimage-360-hotspot-timeline-dot",o.setAttribute("type","button"),o.setAttribute("aria-label",n||`Go to hotspot at frame ${t+1}`),o.setAttribute("data-frame",t.toString()),o.setAttribute("data-hotspot-id",e);const s=i>1?t/(i-1)*100:0;if(o.style.left=`${s}%`,n){const l=document.createElement("span");l.className="cloudimage-360-hotspot-timeline-tooltip",l.textContent=n,o.appendChild(l);let r=null;o.addEventListener("mouseenter",()=>{r=setTimeout(()=>{l.classList.add("visible")},an)}),o.addEventListener("mouseleave",()=>{r&&(clearTimeout(r),r=null),l.classList.remove("visible")}),o.addEventListener("click",()=>{r&&(clearTimeout(r),r=null),l.classList.remove("visible")})}return o},cn=(e,t,i)=>{const n=rn(i);if(n.length===0)return null;const o=document.createElement("div");o.className="cloudimage-360-hotspot-timeline",o.setAttribute("role","navigation"),o.setAttribute("aria-label","Hotspot timeline navigation");const s=document.createElement("div");s.className="cloudimage-360-hotspot-timeline-track";const l=document.createElement("div");return l.className="cloudimage-360-hotspot-timeline-indicator",n.forEach(({id:r,frame:a,label:c})=>{const h=ln(r,a,t,c);s.appendChild(h)}),s.appendChild(l),o.appendChild(s),e.appendChild(o),{element:o,indicator:l,hotspotFrames:n}},hn=(e,t,i)=>{if(!e)return;const n=i>1?t/(i-1)*100:0;e.style.left=`${n}%`},dn=e=>{e&&e.classList.add("visible")},un=e=>{e&&e.classList.remove("visible")},qt=(e,t=[])=>{if(!e)return t;try{return JSON.parse(e)}catch(i){return console.warn("CloudImage 360: Failed to parse JSON:",i.message),t}},pn=(e,t)=>{const[i,n]=e.split("?");if(!n)return e;const o=new RegExp(`^${t}=|&${t}=`),s=n.split("&").filter(l=>!o.test(l)).join("&");return s?`${i}?${s}`:i},fn=e=>{const t=pn(e,"width"),i=t.includes("?")?"&":"?";return`${t}${i}width=${150*devicePixelRatio}`},mn=e=>{const t={root:null,rootMargin:"0px",threshold:.1},i=o=>{const s=o.getAttribute("data-src");s&&(o.src=s)};new IntersectionObserver((o,s)=>{o.forEach(l=>{l.isIntersecting&&(i(l.target),s.unobserve(l.target))})},t).observe(e)},vn=(e,t)=>{const i=Be(1,t);return e.replace("{index}",i)},gn=(e,t)=>{const[i]=e,n=/(https?):\/\//i.test(i);return Ot({...t,folder:n?"":t.folder,filename:i})},yn=(e,t)=>{const{imageList:i,indexZeroBase:n}=t;if(i.length){const o=qt(i,null);if(o)return gn(o,t)}return vn(e,n)},Ie=(e,t,i)=>{const n=new Image;return n.setAttribute(t?"data-src":"src",e),n.className=i,n.style.cssText=`
|
|
27
|
+
position: ${t?"absolute":"static"};
|
|
28
|
+
width: 100%;
|
|
29
|
+
inset: 0;
|
|
30
|
+
height: 100%;
|
|
31
|
+
object-fit: contain;
|
|
32
|
+
object-position: center;
|
|
33
|
+
filter: blur(10px);
|
|
34
|
+
`,n},xe=(e,t,i)=>{const{innerBox:n,imageList:o,lazyload:s}=t||{},[l]=o,r=l||yn(e,t),a=fn(r),c=Ie(a,s,"cloudimage-lazy"),h=Ie(a,!1,"cloudimage-360-placeholder"),p=f=>{Jt(n,".cloudimage-lazy"),i&&i({event:f,width:c.width,height:c.height,naturalWidth:c.naturalWidth,naturalHeight:c.naturalHeight,src:a})};c.onload=p,n.appendChild(c),n.appendChild(h),mn(c)},bn=(e,t,i)=>{const n=new Image;n.src=e,n.onload=o=>{t&&t({event:o,width:n.width,height:n.height,naturalWidth:n.naturalWidth,naturalHeight:n.naturalHeight,src:e})},n.onerror=o=>{const s=new Error(`Failed to load image: ${e}`);s.url=e,s.event=o,i?i(s):console.error(s.message)}},wn=(e,t)=>{const i=t.getBoundingClientRect(),n=e.touches?e.touches[0].clientX:e.clientX,o=e.touches?e.touches[0].clientY:e.clientY;return{x:n-i.left,y:o-i.top}},_t=(e,t,i)=>{const{container:n,w:o,h:s,zoom:l,bw:r,offsetX:a,offsetY:c}=t,h=wn(e,n);let p=h.x,f=h.y;p=Math.max(o/l,Math.min(p,n.offsetWidth-o/l)),f=Math.max(s/l,Math.min(f,n.offsetHeight-s/l)),i.style.left=`${p-o}px`,i.style.top=`${f-s}px`;const u=(p-a)*l-o+r,I=(f-c)*l-s+r;i.style.backgroundPosition=`-${u}px -${I}px`},In=(e,t,i,n,o,s)=>{const{x:l=0,y:r=0}=i||{},a=(t.offsetWidth-l*2)*s,c=(t.offsetHeight-r*2)*s;if(!o)return;o.setAttribute("class","cloudimage-360-img-magnifier-glass"),t.prepend(o),o.style.backgroundImage=`url('${n.src}')`,o.style.backgroundSize=`${a}px ${c}px`;const h=3,p=o.offsetWidth/2,f=o.offsetHeight/2,u={container:t,w:p,h:f,zoom:s,bw:h,offsetX:l,offsetY:r};_t(e,u,o);const I=v=>{_t(v,u,o)},g=v=>{v.preventDefault(),_t(v,u,o)};o.addEventListener("mousemove",I),t.addEventListener("mousemove",I),t.addEventListener("touchmove",g)},xn=(e,t,i)=>{const{clientX:n,clientY:o}=e,s=t.getBoundingClientRect(),l=t.width/(s.width*i),r=t.height/(s.height*i),a=(n-s.left)*l,c=(o-s.top)*r;return{offsetX:a,offsetY:c}},Ce=(e,{bottom:t,top:i})=>{e?t():i()},Oe=(e,{left:t,right:i})=>{e?t():i()},Cn=({autoplayBehavior:e,spinY:t,reversed:i,loopTriggers:n})=>{switch(e){case M.SPIN_XY:case M.SPIN_YX:t?Ce(i,n):Oe(i,n);break;case M.SPIN_Y:Ce(i,n);break;case M.SPIN_X:default:Oe(i,n)}},On=({autoplayBehavior:e,activeImageX:t,activeImageY:i,amountX:n,amountY:o,autoplayReverse:s})=>{const l=(r,a)=>{const c=a-1;return s?r===0:r===c};switch(e){case M.SPIN_XY:case M.SPIN_Y:return l(i,o);case M.SPIN_X:case M.SPIN_YX:default:return l(t,n)}},En=({autoplayBehavior:e,activeImageX:t,activeImageY:i,amountX:n,amountY:o,autoplayReverse:s,spinDirection:l})=>{const r=t===(s?0:n-1),a=i===(s?0:o-1);return e===M.SPIN_XY||e===M.SPIN_YX?l==="x"&&r||l==="y"&&a:!1},Sn=(e,t,i)=>{if(!i)return"x";if(!t)return"y";switch(e){case M.SPIN_XY:return"x";case M.SPIN_YX:return"y";case M.SPIN_Y:return"y";case M.SPIN_X:default:return"x"}},An=e=>e==="x"?"y":"x",Ee=(e,t)=>{const i=[...Ii];return t?[...i,...xi].includes(e):i.includes(e)},Se=({deltaX:e,deltaY:t,reversed:i,allowSpinX:n,allowSpinY:o,threshold:s=0})=>{const l=n&&!o||o&&!n?0:s,r=Math.abs(e),a=Math.abs(t);return n&&r-l>a?i?e>0?"left":"right":e>0?"right":"left":o&&a-l>r?i?t>0?"up":"down":t>0?"down":"up":null},Ln=()=>"ontouchstart"in window||navigator.maxTouchPoints>0||navigator.msMaxTouchPoints>0,kn=(e,t=150)=>{let i;return function(...n){clearTimeout(i),i=setTimeout(()=>{e.apply(this,n)},t)}},Fe="KGZ1bmN0aW9uKCl7InVzZSBzdHJpY3QiO2NvbnN0IHY9KHQsYSxlKT0+e2NvbnN0IHM9dC9lLG49YS9lO3JldHVybnt6b29tZWRXaWR0aDpzLHpvb21lZEhlaWdodDpufX0sej0oe3BvaW50ZXJYOnQscG9pbnRlclk6YSxpbWFnZURhdGE6ZSx6b29tZWRXaWR0aDpzLHpvb21lZEhlaWdodDpuLGRyYXdXaWR0aDppLGRyYXdIZWlnaHQ6Y30pPT57Y29uc3R7bmF0dXJhbFdpZHRoOmcsbmF0dXJhbEhlaWdodDp1fT1lO2xldCBmPXQvaSpnLXMvMixtPWEvYyp1LW4vMjtjb25zdCB4PU1hdGgubWF4KDAsZy1zKSxPPU1hdGgubWF4KDAsdS1uKTtyZXR1cm4gZj1NYXRoLm1heCgwLE1hdGgubWluKGYseCkpLG09TWF0aC5tYXgoMCxNYXRoLm1pbihtLE8pKSx7em9vbU9mZnNldFg6Zix6b29tT2Zmc2V0WTptfX07bGV0IG8saCxyLGQsbCx3O3NlbGYub25tZXNzYWdlPWFzeW5jIHQ9Pntjb25zdHthY3Rpb246YSxvZmZzY3JlZW46ZSxkZXZpY2VQaXhlbFJhdGlvOnMsaW1hZ2VEYXRhOm4sem9vbVNjYWxlOmkscG9pbnRlclg6Yyxwb2ludGVyWTpnLGltYWdlQXNwZWN0UmF0aW86dSxjb250YWluZXJXaWR0aDpmLGNvbnRhaW5lckhlaWdodDptfT10LmRhdGE7c3dpdGNoKGEpe2Nhc2UiaW5pdENhbnZhcyI6QyhlLHMpO2JyZWFrO2Nhc2UiYWRhcHRDYW52YXNTaXplIjpwKHUsZixtKTticmVhaztjYXNlImRyYXdJbWFnZU9uQ2FudmFzIjpJKG4saSxjLGcpO2JyZWFrfX07Y29uc3QgQz0odCxhKT0+e289dCxoPW8uZ2V0Q29udGV4dCgiMmQiKSxyPWF9LHA9KHQsYSxlKT0+e2NvbnN0IHM9YS9lO3c9dD5zLG8ud2lkdGg9YSpyLG8uaGVpZ2h0PWUqcixoLnNjYWxlKHIsciksdz8oZD1hLGw9YS90KToobD1lLGQ9ZSp0KSxoLmltYWdlU21vb3RoaW5nRW5hYmxlZD0hMCxoLmltYWdlU21vb3RoaW5nUXVhbGl0eT0iaGlnaCJ9LEk9KHQ9e30sYT0xLGU9MCxzPTApPT57Y29uc3R7Yml0bWFwSW1hZ2U6bn09dDtpZighb3x8IW4pcmV0dXJuO2xldCBpLGM7aWYodz8oaT0wLGM9KG8uaGVpZ2h0L3ItbCkvMik6KGk9KG8ud2lkdGgvci1kKS8yLGM9MCksaC5jbGVhclJlY3QoMCwwLG8ud2lkdGgsby5oZWlnaHQpLGEhPT0xKXtjb25zdHtuYXR1cmFsV2lkdGg6ZyxuYXR1cmFsSGVpZ2h0OnV9PXQse3pvb21lZFdpZHRoOmYsem9vbWVkSGVpZ2h0Om19PXYoZyx1LGEpLHt6b29tT2Zmc2V0WDp4LHpvb21PZmZzZXRZOk99PXooe3BvaW50ZXJYOmUscG9pbnRlclk6cyxpbWFnZURhdGE6dCx6b29tZWRXaWR0aDpmLHpvb21lZEhlaWdodDptLGRyYXdXaWR0aDpkLGRyYXdIZWlnaHQ6bH0pO2guZHJhd0ltYWdlKG4seCxPLGYsbSxpLGMsZCxsKX1lbHNlIGguZHJhd0ltYWdlKG4saSxjLGQsbCl9fSkoKTsKLy8jIHNvdXJjZU1hcHBpbmdVUkw9Y2FudmFzLndvcmtlci1DZzBma3BEMS5qcy5tYXAK",Tn=e=>Uint8Array.from(atob(e),t=>t.charCodeAt(0)),Ae=typeof self<"u"&&self.Blob&&new Blob([Tn(Fe)],{type:"text/javascript;charset=utf-8"});function Yn(e){let t;try{if(t=Ae&&(self.URL||self.webkitURL).createObjectURL(Ae),!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,"+Fe,{name:e==null?void 0:e.name})}finally{t&&(self.URL||self.webkitURL).revokeObjectURL(t)}}const Xn=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"]),Le={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"]},Pn=[/javascript:/gi,/vbscript:/gi,/data:/gi,/on\w+\s*=/gi],Rn=e=>{if(typeof e!="string")return"";const t=document.createElement("template");t.innerHTML=e;const i=n=>{if(Array.from(n.childNodes).forEach(i),n.nodeType===Node.ELEMENT_NODE){const s=n.tagName.toLowerCase();if(!Xn.has(s)){if(s==="script"||s==="style"){n.remove();return}const a=document.createTextNode(n.textContent);n.parentNode.replaceChild(a,n);return}const l=[...Le[s]||[],...Le["*"]||[]];if(Array.from(n.attributes).forEach(a=>{const c=a.name.toLowerCase();if(c.startsWith("on")){n.removeAttribute(a.name);return}if(!l.includes(c)){n.removeAttribute(a.name);return}let h=a.value;Pn.forEach(p=>{p.test(h)&&n.removeAttribute(a.name)})}),s==="a"){const a=n.getAttribute("href");a&&(/^(https?:|mailto:|tel:|#|\/)/i.test(a.trim())||n.removeAttribute("href")),n.getAttribute("target")==="_blank"&&n.setAttribute("rel","noopener noreferrer")}if(s==="img"){const a=n.getAttribute("src");a&&(/^(https?:|\/|data:image\/)/i.test(a.trim())||n.removeAttribute("src"))}}};return i(t.content),t.innerHTML},Mn=e=>e==="x"?P.X:P.Y,Hn=(e,t,i)=>e.filter(n=>Mn(n.orientation)===i&&t in n.positions),Dn=(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},Zn=e=>{const t=Object.entries(e).sort(([s],[l])=>Number(s)-Number(l));let i=null,n=null;const o={};for(const[s,l]of t)if(!l)o[s]={x:i,y:n};else{const{x:r,y:a}=l;r!=null&&(i=r),a!=null&&(n=a),o[s]={x:r||i,y:a||n}}return o},Bn=e=>[{name:"offset",options:{offset:[0,10]}},{name:"preventOverflow",options:{boundary:e}}],Wn=(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=Rn(e):i.textContent=e,document.body.appendChild(i),i},Fn=e=>{const t=[...e];return t.forEach((i,n)=>{const o={...Zn(i.positions)};t[n].initialPositions=o,t[n].positions=o}),t},Nn=({newWidth:e,newHeight:t,initialContainerSize:i,imageAspectRatio:n,hotspotsConfig:o})=>{const[s,l]=i;let r=e,a=t,c=0,h=0;const p=e/t;n>p?(a=e/n,h=(t-a)/2):(r=t*n,c=(e-r)/2);const u=r/s,I=a/l;return o.map(g=>{const v={};return Object.entries(g.initialPositions).forEach(([m,b])=>{v[m]={x:b.x*u+c,y:b.y*I+h}}),{...g,positions:v}})};var H="top",F="bottom",N="right",D="left",ee="auto",kt=[H,F,N,D],ut="start",At="end",Vn="clippingParents",Ne="viewport",Ct="popper",jn="reference",ke=kt.reduce(function(e,t){return e.concat([t+"-"+ut,t+"-"+At])},[]),Ve=[].concat(kt,[ee]).reduce(function(e,t){return e.concat([t,t+"-"+ut,t+"-"+At])},[]),$n="beforeRead",zn="read",Gn="afterRead",Un="beforeMain",Kn="main",_n="afterMain",Jn="beforeWrite",qn="write",Qn="afterWrite",to=[$n,zn,Gn,Un,Kn,_n,Jn,qn,Qn];function $(e){return e?(e.nodeName||"").toLowerCase():null}function B(e){if(e==null)return window;if(e.toString()!=="[object Window]"){var t=e.ownerDocument;return t&&t.defaultView||window}return e}function st(e){var t=B(e).Element;return e instanceof t||e instanceof Element}function W(e){var t=B(e).HTMLElement;return e instanceof t||e instanceof HTMLElement}function ie(e){if(typeof ShadowRoot>"u")return!1;var t=B(e).ShadowRoot;return e instanceof t||e instanceof ShadowRoot}function eo(e){var t=e.state;Object.keys(t.elements).forEach(function(i){var n=t.styles[i]||{},o=t.attributes[i]||{},s=t.elements[i];!W(s)||!$(s)||(Object.assign(s.style,n),Object.keys(o).forEach(function(l){var r=o[l];r===!1?s.removeAttribute(l):s.setAttribute(l,r===!0?"":r)}))})}function io(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(n){var o=t.elements[n],s=t.attributes[n]||{},l=Object.keys(t.styles.hasOwnProperty(n)?t.styles[n]:i[n]),r=l.reduce(function(a,c){return a[c]="",a},{});!W(o)||!$(o)||(Object.assign(o.style,r),Object.keys(s).forEach(function(a){o.removeAttribute(a)}))})}}const no={name:"applyStyles",enabled:!0,phase:"write",fn:eo,effect:io,requires:["computeStyles"]};function j(e){return e.split("-")[0]}var ot=Math.max,Wt=Math.min,pt=Math.round;function Qt(){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 je(){return!/^((?!chrome|android).)*safari/i.test(Qt())}function ft(e,t,i){t===void 0&&(t=!1),i===void 0&&(i=!1);var n=e.getBoundingClientRect(),o=1,s=1;t&&W(e)&&(o=e.offsetWidth>0&&pt(n.width)/e.offsetWidth||1,s=e.offsetHeight>0&&pt(n.height)/e.offsetHeight||1);var l=st(e)?B(e):window,r=l.visualViewport,a=!je()&&i,c=(n.left+(a&&r?r.offsetLeft:0))/o,h=(n.top+(a&&r?r.offsetTop:0))/s,p=n.width/o,f=n.height/s;return{width:p,height:f,top:h,right:c+p,bottom:h+f,left:c,x:c,y:h}}function ne(e){var t=ft(e),i=e.offsetWidth,n=e.offsetHeight;return Math.abs(t.width-i)<=1&&(i=t.width),Math.abs(t.height-n)<=1&&(n=t.height),{x:e.offsetLeft,y:e.offsetTop,width:i,height:n}}function $e(e,t){var i=t.getRootNode&&t.getRootNode();if(e.contains(t))return!0;if(i&&ie(i)){var n=t;do{if(n&&e.isSameNode(n))return!0;n=n.parentNode||n.host}while(n)}return!1}function J(e){return B(e).getComputedStyle(e)}function oo(e){return["table","td","th"].indexOf($(e))>=0}function Q(e){return((st(e)?e.ownerDocument:e.document)||window.document).documentElement}function Nt(e){return $(e)==="html"?e:e.assignedSlot||e.parentNode||(ie(e)?e.host:null)||Q(e)}function Te(e){return!W(e)||J(e).position==="fixed"?null:e.offsetParent}function so(e){var t=/firefox/i.test(Qt()),i=/Trident/i.test(Qt());if(i&&W(e)){var n=J(e);if(n.position==="fixed")return null}var o=Nt(e);for(ie(o)&&(o=o.host);W(o)&&["html","body"].indexOf($(o))<0;){var s=J(o);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 o;o=o.parentNode}return null}function Tt(e){for(var t=B(e),i=Te(e);i&&oo(i)&&J(i).position==="static";)i=Te(i);return i&&($(i)==="html"||$(i)==="body"&&J(i).position==="static")?t:i||so(e)||t}function oe(e){return["top","bottom"].indexOf(e)>=0?"x":"y"}function Et(e,t,i){return ot(e,Wt(t,i))}function ro(e,t,i){var n=Et(e,t,i);return n>i?i:n}function ze(){return{top:0,right:0,bottom:0,left:0}}function Ge(e){return Object.assign({},ze(),e)}function Ue(e,t){return t.reduce(function(i,n){return i[n]=e,i},{})}var ao=function(t,i){return t=typeof t=="function"?t(Object.assign({},i.rects,{placement:i.placement})):t,Ge(typeof t!="number"?t:Ue(t,kt))};function lo(e){var t,i=e.state,n=e.name,o=e.options,s=i.elements.arrow,l=i.modifiersData.popperOffsets,r=j(i.placement),a=oe(r),c=[D,N].indexOf(r)>=0,h=c?"height":"width";if(!(!s||!l)){var p=ao(o.padding,i),f=ne(s),u=a==="y"?H:D,I=a==="y"?F:N,g=i.rects.reference[h]+i.rects.reference[a]-l[a]-i.rects.popper[h],v=l[a]-i.rects.reference[a],m=Tt(s),b=m?a==="y"?m.clientHeight||0:m.clientWidth||0:0,x=g/2-v/2,w=p[u],C=b-f[h]-p[I],y=b/2-f[h]/2+x,O=Et(w,y,C),S=a;i.modifiersData[n]=(t={},t[S]=O,t.centerOffset=O-y,t)}}function co(e){var t=e.state,i=e.options,n=i.element,o=n===void 0?"[data-popper-arrow]":n;o!=null&&(typeof o=="string"&&(o=t.elements.popper.querySelector(o),!o)||$e(t.elements.popper,o)&&(t.elements.arrow=o))}const ho={name:"arrow",enabled:!0,phase:"main",fn:lo,effect:co,requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function mt(e){return e.split("-")[1]}var uo={top:"auto",right:"auto",bottom:"auto",left:"auto"};function po(e,t){var i=e.x,n=e.y,o=t.devicePixelRatio||1;return{x:pt(i*o)/o||0,y:pt(n*o)/o||0}}function Ye(e){var t,i=e.popper,n=e.popperRect,o=e.placement,s=e.variation,l=e.offsets,r=e.position,a=e.gpuAcceleration,c=e.adaptive,h=e.roundOffsets,p=e.isFixed,f=l.x,u=f===void 0?0:f,I=l.y,g=I===void 0?0:I,v=typeof h=="function"?h({x:u,y:g}):{x:u,y:g};u=v.x,g=v.y;var m=l.hasOwnProperty("x"),b=l.hasOwnProperty("y"),x=D,w=H,C=window;if(c){var y=Tt(i),O="clientHeight",S="clientWidth";if(y===B(i)&&(y=Q(i),J(y).position!=="static"&&r==="absolute"&&(O="scrollHeight",S="scrollWidth")),y=y,o===H||(o===D||o===N)&&s===At){w=F;var E=p&&y===C&&C.visualViewport?C.visualViewport.height:y[O];g-=E-n.height,g*=a?1:-1}if(o===D||(o===H||o===F)&&s===At){x=N;var A=p&&y===C&&C.visualViewport?C.visualViewport.width:y[S];u-=A-n.width,u*=a?1:-1}}var L=Object.assign({position:r},c&&uo),R=h===!0?po({x:u,y:g},B(i)):{x:u,y:g};if(u=R.x,g=R.y,a){var T;return Object.assign({},L,(T={},T[w]=b?"0":"",T[x]=m?"0":"",T.transform=(C.devicePixelRatio||1)<=1?"translate("+u+"px, "+g+"px)":"translate3d("+u+"px, "+g+"px, 0)",T))}return Object.assign({},L,(t={},t[w]=b?g+"px":"",t[x]=m?u+"px":"",t.transform="",t))}function fo(e){var t=e.state,i=e.options,n=i.gpuAcceleration,o=n===void 0?!0:n,s=i.adaptive,l=s===void 0?!0:s,r=i.roundOffsets,a=r===void 0?!0:r,c={placement:j(t.placement),variation:mt(t.placement),popper:t.elements.popper,popperRect:t.rects.popper,gpuAcceleration:o,isFixed:t.options.strategy==="fixed"};t.modifiersData.popperOffsets!=null&&(t.styles.popper=Object.assign({},t.styles.popper,Ye(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,Ye(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 mo={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:fo,data:{}};var Dt={passive:!0};function vo(e){var t=e.state,i=e.instance,n=e.options,o=n.scroll,s=o===void 0?!0:o,l=n.resize,r=l===void 0?!0:l,a=B(t.elements.popper),c=[].concat(t.scrollParents.reference,t.scrollParents.popper);return s&&c.forEach(function(h){h.addEventListener("scroll",i.update,Dt)}),r&&a.addEventListener("resize",i.update,Dt),function(){s&&c.forEach(function(h){h.removeEventListener("scroll",i.update,Dt)}),r&&a.removeEventListener("resize",i.update,Dt)}}const go={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:vo,data:{}};var yo={left:"right",right:"left",bottom:"top",top:"bottom"};function Zt(e){return e.replace(/left|right|bottom|top/g,function(t){return yo[t]})}var bo={start:"end",end:"start"};function Xe(e){return e.replace(/start|end/g,function(t){return bo[t]})}function se(e){var t=B(e),i=t.pageXOffset,n=t.pageYOffset;return{scrollLeft:i,scrollTop:n}}function re(e){return ft(Q(e)).left+se(e).scrollLeft}function wo(e,t){var i=B(e),n=Q(e),o=i.visualViewport,s=n.clientWidth,l=n.clientHeight,r=0,a=0;if(o){s=o.width,l=o.height;var c=je();(c||!c&&t==="fixed")&&(r=o.offsetLeft,a=o.offsetTop)}return{width:s,height:l,x:r+re(e),y:a}}function Io(e){var t,i=Q(e),n=se(e),o=(t=e.ownerDocument)==null?void 0:t.body,s=ot(i.scrollWidth,i.clientWidth,o?o.scrollWidth:0,o?o.clientWidth:0),l=ot(i.scrollHeight,i.clientHeight,o?o.scrollHeight:0,o?o.clientHeight:0),r=-n.scrollLeft+re(e),a=-n.scrollTop;return J(o||i).direction==="rtl"&&(r+=ot(i.clientWidth,o?o.clientWidth:0)-s),{width:s,height:l,x:r,y:a}}function ae(e){var t=J(e),i=t.overflow,n=t.overflowX,o=t.overflowY;return/auto|scroll|overlay|hidden/.test(i+o+n)}function Ke(e){return["html","body","#document"].indexOf($(e))>=0?e.ownerDocument.body:W(e)&&ae(e)?e:Ke(Nt(e))}function St(e,t){var i;t===void 0&&(t=[]);var n=Ke(e),o=n===((i=e.ownerDocument)==null?void 0:i.body),s=B(n),l=o?[s].concat(s.visualViewport||[],ae(n)?n:[]):n,r=t.concat(l);return o?r:r.concat(St(Nt(l)))}function te(e){return Object.assign({},e,{left:e.x,top:e.y,right:e.x+e.width,bottom:e.y+e.height})}function xo(e,t){var i=ft(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 Pe(e,t,i){return t===Ne?te(wo(e,i)):st(t)?xo(t,i):te(Io(Q(e)))}function Co(e){var t=St(Nt(e)),i=["absolute","fixed"].indexOf(J(e).position)>=0,n=i&&W(e)?Tt(e):e;return st(n)?t.filter(function(o){return st(o)&&$e(o,n)&&$(o)!=="body"}):[]}function Oo(e,t,i,n){var o=t==="clippingParents"?Co(e):[].concat(t),s=[].concat(o,[i]),l=s[0],r=s.reduce(function(a,c){var h=Pe(e,c,n);return a.top=ot(h.top,a.top),a.right=Wt(h.right,a.right),a.bottom=Wt(h.bottom,a.bottom),a.left=ot(h.left,a.left),a},Pe(e,l,n));return r.width=r.right-r.left,r.height=r.bottom-r.top,r.x=r.left,r.y=r.top,r}function _e(e){var t=e.reference,i=e.element,n=e.placement,o=n?j(n):null,s=n?mt(n):null,l=t.x+t.width/2-i.width/2,r=t.y+t.height/2-i.height/2,a;switch(o){case H:a={x:l,y:t.y-i.height};break;case F:a={x:l,y:t.y+t.height};break;case N: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=o?oe(o):null;if(c!=null){var h=c==="y"?"height":"width";switch(s){case ut:a[c]=a[c]-(t[h]/2-i[h]/2);break;case At:a[c]=a[c]+(t[h]/2-i[h]/2);break}}return a}function Lt(e,t){t===void 0&&(t={});var i=t,n=i.placement,o=n===void 0?e.placement:n,s=i.strategy,l=s===void 0?e.strategy:s,r=i.boundary,a=r===void 0?Vn:r,c=i.rootBoundary,h=c===void 0?Ne:c,p=i.elementContext,f=p===void 0?Ct:p,u=i.altBoundary,I=u===void 0?!1:u,g=i.padding,v=g===void 0?0:g,m=Ge(typeof v!="number"?v:Ue(v,kt)),b=f===Ct?jn:Ct,x=e.rects.popper,w=e.elements[I?b:f],C=Oo(st(w)?w:w.contextElement||Q(e.elements.popper),a,h,l),y=ft(e.elements.reference),O=_e({reference:y,element:x,placement:o}),S=te(Object.assign({},x,O)),E=f===Ct?S:y,A={top:C.top-E.top+m.top,bottom:E.bottom-C.bottom+m.bottom,left:C.left-E.left+m.left,right:E.right-C.right+m.right},L=e.modifiersData.offset;if(f===Ct&&L){var R=L[o];Object.keys(A).forEach(function(T){var z=[N,F].indexOf(T)>=0?1:-1,G=[H,F].indexOf(T)>=0?"y":"x";A[T]+=R[G]*z})}return A}function Eo(e,t){t===void 0&&(t={});var i=t,n=i.placement,o=i.boundary,s=i.rootBoundary,l=i.padding,r=i.flipVariations,a=i.allowedAutoPlacements,c=a===void 0?Ve:a,h=mt(n),p=h?r?ke:ke.filter(function(I){return mt(I)===h}):kt,f=p.filter(function(I){return c.indexOf(I)>=0});f.length===0&&(f=p);var u=f.reduce(function(I,g){return I[g]=Lt(e,{placement:g,boundary:o,rootBoundary:s,padding:l})[j(g)],I},{});return Object.keys(u).sort(function(I,g){return u[I]-u[g]})}function So(e){if(j(e)===ee)return[];var t=Zt(e);return[Xe(e),t,Xe(t)]}function Ao(e){var t=e.state,i=e.options,n=e.name;if(!t.modifiersData[n]._skip){for(var o=i.mainAxis,s=o===void 0?!0:o,l=i.altAxis,r=l===void 0?!0:l,a=i.fallbackPlacements,c=i.padding,h=i.boundary,p=i.rootBoundary,f=i.altBoundary,u=i.flipVariations,I=u===void 0?!0:u,g=i.allowedAutoPlacements,v=t.options.placement,m=j(v),b=m===v,x=a||(b||!I?[Zt(v)]:So(v)),w=[v].concat(x).reduce(function(q,V){return q.concat(j(V)===ee?Eo(t,{placement:V,boundary:h,rootBoundary:p,padding:c,flipVariations:I,allowedAutoPlacements:g}):V)},[]),C=t.rects.reference,y=t.rects.popper,O=new Map,S=!0,E=w[0],A=0;A<w.length;A++){var L=w[A],R=j(L),T=mt(L)===ut,z=[H,F].indexOf(R)>=0,G=z?"width":"height",Y=Lt(t,{placement:L,boundary:h,rootBoundary:p,altBoundary:f,padding:c}),Z=z?T?N:D:T?F:H;C[G]>y[G]&&(Z=Zt(Z));var rt=Zt(Z),U=[];if(s&&U.push(Y[R]<=0),r&&U.push(Y[Z]<=0,Y[rt]<=0),U.every(function(q){return q})){E=L,S=!1;break}O.set(L,U)}if(S)for(var at=I?3:1,vt=function(V){var et=w.find(function(it){var K=O.get(it);if(K)return K.slice(0,V).every(function(gt){return gt})});if(et)return E=et,"break"},tt=at;tt>0;tt--){var lt=vt(tt);if(lt==="break")break}t.placement!==E&&(t.modifiersData[n]._skip=!0,t.placement=E,t.reset=!0)}}const Lo={name:"flip",enabled:!0,phase:"main",fn:Ao,requiresIfExists:["offset"],data:{_skip:!1}};function Re(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 Me(e){return[H,N,F,D].some(function(t){return e[t]>=0})}function ko(e){var t=e.state,i=e.name,n=t.rects.reference,o=t.rects.popper,s=t.modifiersData.preventOverflow,l=Lt(t,{elementContext:"reference"}),r=Lt(t,{altBoundary:!0}),a=Re(l,n),c=Re(r,o,s),h=Me(a),p=Me(c);t.modifiersData[i]={referenceClippingOffsets:a,popperEscapeOffsets:c,isReferenceHidden:h,hasPopperEscaped:p},t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-reference-hidden":h,"data-popper-escaped":p})}const To={name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:ko};function Yo(e,t,i){var n=j(e),o=[D,H].indexOf(n)>=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)*o,[D,N].indexOf(n)>=0?{x:r,y:l}:{x:l,y:r}}function Xo(e){var t=e.state,i=e.options,n=e.name,o=i.offset,s=o===void 0?[0,0]:o,l=Ve.reduce(function(h,p){return h[p]=Yo(p,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[n]=l}const Po={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:Xo};function Ro(e){var t=e.state,i=e.name;t.modifiersData[i]=_e({reference:t.rects.reference,element:t.rects.popper,placement:t.placement})}const Mo={name:"popperOffsets",enabled:!0,phase:"read",fn:Ro,data:{}};function Ho(e){return e==="x"?"y":"x"}function Do(e){var t=e.state,i=e.options,n=e.name,o=i.mainAxis,s=o===void 0?!0:o,l=i.altAxis,r=l===void 0?!1:l,a=i.boundary,c=i.rootBoundary,h=i.altBoundary,p=i.padding,f=i.tether,u=f===void 0?!0:f,I=i.tetherOffset,g=I===void 0?0:I,v=Lt(t,{boundary:a,rootBoundary:c,padding:p,altBoundary:h}),m=j(t.placement),b=mt(t.placement),x=!b,w=oe(m),C=Ho(w),y=t.modifiersData.popperOffsets,O=t.rects.reference,S=t.rects.popper,E=typeof g=="function"?g(Object.assign({},t.rects,{placement:t.placement})):g,A=typeof E=="number"?{mainAxis:E,altAxis:E}:Object.assign({mainAxis:0,altAxis:0},E),L=t.modifiersData.offset?t.modifiersData.offset[t.placement]:null,R={x:0,y:0};if(y){if(s){var T,z=w==="y"?H:D,G=w==="y"?F:N,Y=w==="y"?"height":"width",Z=y[w],rt=Z+v[z],U=Z-v[G],at=u?-S[Y]/2:0,vt=b===ut?O[Y]:S[Y],tt=b===ut?-S[Y]:-O[Y],lt=t.elements.arrow,q=u&<?ne(lt):{width:0,height:0},V=t.modifiersData["arrow#persistent"]?t.modifiersData["arrow#persistent"].padding:ze(),et=V[z],it=V[G],K=Et(0,O[Y],q[Y]),gt=x?O[Y]/2-at-K-et-A.mainAxis:vt-K-et-A.mainAxis,Vt=x?-O[Y]/2+at+K+it+A.mainAxis:tt+K+it+A.mainAxis,yt=t.elements.arrow&&Tt(t.elements.arrow),jt=yt?w==="y"?yt.clientTop||0:yt.clientLeft||0:0,Yt=(T=L==null?void 0:L[w])!=null?T:0,$t=Z+gt-Yt-jt,zt=Z+Vt-Yt,Xt=Et(u?Wt(rt,$t):rt,Z,u?ot(U,zt):U);y[w]=Xt,R[w]=Xt-Z}if(r){var Pt,Gt=w==="x"?H:D,Ut=w==="x"?F:N,_=y[C],nt=C==="y"?"height":"width",ct=_+v[Gt],ht=_-v[Ut],dt=[H,D].indexOf(m)!==-1,bt=(Pt=L==null?void 0:L[C])!=null?Pt:0,wt=dt?ct:_-O[nt]-S[nt]-bt+A.altAxis,It=dt?_+O[nt]+S[nt]-bt-A.altAxis:ht,Rt=u&&dt?ro(wt,_,It):Et(u?wt:ct,_,u?It:ht);y[C]=Rt,R[C]=Rt-_}t.modifiersData[n]=R}}const Zo={name:"preventOverflow",enabled:!0,phase:"main",fn:Do,requiresIfExists:["offset"]};function Bo(e){return{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}}function Wo(e){return e===B(e)||!W(e)?se(e):Bo(e)}function Fo(e){var t=e.getBoundingClientRect(),i=pt(t.width)/e.offsetWidth||1,n=pt(t.height)/e.offsetHeight||1;return i!==1||n!==1}function No(e,t,i){i===void 0&&(i=!1);var n=W(t),o=W(t)&&Fo(t),s=Q(t),l=ft(e,o,i),r={scrollLeft:0,scrollTop:0},a={x:0,y:0};return(n||!n&&!i)&&(($(t)!=="body"||ae(s))&&(r=Wo(t)),W(t)?(a=ft(t,!0),a.x+=t.clientLeft,a.y+=t.clientTop):s&&(a.x=re(s))),{x:l.left+r.scrollLeft-a.x,y:l.top+r.scrollTop-a.y,width:l.width,height:l.height}}function Vo(e){var t=new Map,i=new Set,n=[];e.forEach(function(s){t.set(s.name,s)});function o(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&&o(a)}}),n.push(s)}return e.forEach(function(s){i.has(s.name)||o(s)}),n}function jo(e){var t=Vo(e);return to.reduce(function(i,n){return i.concat(t.filter(function(o){return o.phase===n}))},[])}function $o(e){var t;return function(){return t||(t=new Promise(function(i){Promise.resolve().then(function(){t=void 0,i(e())})})),t}}function zo(e){var t=e.reduce(function(i,n){var o=i[n.name];return i[n.name]=o?Object.assign({},o,n,{options:Object.assign({},o.options,n.options),data:Object.assign({},o.data,n.data)}):n,i},{});return Object.keys(t).map(function(i){return t[i]})}var He={placement:"bottom",modifiers:[],strategy:"absolute"};function De(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];return!t.some(function(n){return!(n&&typeof n.getBoundingClientRect=="function")})}function Go(e){e===void 0&&(e={});var t=e,i=t.defaultModifiers,n=i===void 0?[]:i,o=t.defaultOptions,s=o===void 0?He:o;return function(r,a,c){c===void 0&&(c=s);var h={placement:"bottom",orderedModifiers:[],options:Object.assign({},He,s),modifiersData:{},elements:{reference:r,popper:a},attributes:{},styles:{}},p=[],f=!1,u={state:h,setOptions:function(m){var b=typeof m=="function"?m(h.options):m;g(),h.options=Object.assign({},s,h.options,b),h.scrollParents={reference:st(r)?St(r):r.contextElement?St(r.contextElement):[],popper:St(a)};var x=jo(zo([].concat(n,h.options.modifiers)));return h.orderedModifiers=x.filter(function(w){return w.enabled}),I(),u.update()},forceUpdate:function(){if(!f){var m=h.elements,b=m.reference,x=m.popper;if(De(b,x)){h.rects={reference:No(b,Tt(x),h.options.strategy==="fixed"),popper:ne(x)},h.reset=!1,h.placement=h.options.placement,h.orderedModifiers.forEach(function(A){return h.modifiersData[A.name]=Object.assign({},A.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],y=C.fn,O=C.options,S=O===void 0?{}:O,E=C.name;typeof y=="function"&&(h=y({state:h,options:S,name:E,instance:u})||h)}}}},update:$o(function(){return new Promise(function(v){u.forceUpdate(),v(h)})}),destroy:function(){g(),f=!0}};if(!De(r,a))return u;u.setOptions(c).then(function(v){!f&&c.onFirstUpdate&&c.onFirstUpdate(v)});function I(){h.orderedModifiers.forEach(function(v){var m=v.name,b=v.options,x=b===void 0?{}:b,w=v.effect;if(typeof w=="function"){var C=w({state:h,name:m,instance:u,options:x}),y=function(){};p.push(C||y)}})}function g(){p.forEach(function(v){return v()}),p=[]}return u}}var Uo=[go,Mo,mo,no,Po,Lo,Zo,ho,To],Ko=Go({defaultModifiers:Uo});class _o{constructor(t,i,n){le(this,"updateHotspotPosition",(t,i)=>{this.currentActiveIndex=t,this.currentOrientation=i;const n=Hn(this.hotspotsConfig,t,i);this.hideHotspots(),n.forEach(o=>this.updateAndShowHotspot(o,t))});this.container=i,this.popper=null,this.popperInstance=null,this.hotspotsContainer=qi(this.container),this.hotspotsConfig=Fn(t),this.shouldHidePopper=!0,this.hidePopper=this.hidePopper.bind(this),this.imageAspectRatio=n,this.hotspotElements=new Map,this.popperListeners=[];const{containerSize:o}=t[0];this.initialContainerSize=o||[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=Nn({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:n})=>{t.removeEventListener(i,n)}),this.popperListeners=[]}showPopper({hotspotElement:t,content:i,id:n,keepOpen:o}){this.popperInstance&&this.popperInstance.instanceId!==n&&this.hidePopper();const s={placement:"top",modifiers:Bn(this.container)};this.popper=Wn(i,n),this.popper.setAttribute("data-show",""),this.currentHotspotElement=t,t.setAttribute("aria-expanded","true"),t.setAttribute("aria-describedby",`cloudimage-360-popper-${n}`);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={...Ko(t,this.popper,s),keepOpen:o,instanceId:n}}checkAndHidePopper(){var t;this.shouldHidePopper&&!((t=this.popperInstance)!=null&&t.keepOpen)&&(this.hidePopperTimeout=setTimeout(()=>{this.shouldHidePopper&&this.hidePopper()},Oi))}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()},Ei)}}createHotspot(t){const{id:i,content:n,keepOpen:o,onClick:s,label:l}=t,r=Dn(i,l);s&&(r.style.cursor="pointer"),r.onclick=a=>{a.stopPropagation(),s==null||s(a,this.popperInstance,i)},n&&(r.addEventListener("mouseenter",()=>this.showPopper({hotspotElement:r,content:n,id:i,keepOpen:o})),r.addEventListener("focus",()=>this.showPopper({hotspotElement:r,content:n,id:i,keepOpen:o})),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:n,id:o}=t,{x:s,y:l}=n[i]??{},r=this.hotspotsContainer.querySelector(`[data-hotspot-id="${o}"]`);r&&(r.style.translate=`${s}px ${l}px`,r.style.opacity=1,r.style.pointerEvents="all")}showHotspotById(t){const i=this.hotspotsConfig.find(o=>o.id===t);if(!i||!i.content)return;const n=this.hotspotsContainer.querySelector(`[data-hotspot-id="${t}"]`);n&&n.style.opacity==="1"&&this.showPopper({hotspotElement:n,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,n){this.container=t,this.isClicked=!1,this.fullscreenView=!!n,this.imagesX=[],this.imagesY=[],this.devicePixelRatio=Math.round(window.devicePixelRatio||1),this.id=t.id,this.movementStart={x:0,y:0},this.draggingDirection=null,this.isReady=!1,this.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=Ln(),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 Yn,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 n=this[t];typeof n=="function"&&n({...i,viewerId:this.id})}announce(t){tn(this.ariaLiveRegion,t)}mouseDown(t){if(!this.isReady||this.glass)return;const{pageX:i,pageY:n}=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:n},this.isClicked=!0,this.isDragging=!1,this.inertia&&(this.velocityX=0,this.velocityY=0,this.lastDragTime=performance.now(),this.lastDragX=i,this.lastDragY=n)}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 n=this.fullscreenView?document.body:this.container,o=this.dragSpeed/fe,s=o*(this.amountX/n.offsetWidth),l=o*(this.amountY/n.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=Se({deltaX:a,deltaY:c,reversed:this.dragReverse,allowSpinX:this.allowSpinX,allowSpinY:this.allowSpinY});if(h){const p=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;(p>0||f>0)&&this.onMoveHandler(h,p,f)}this.inertiaAnimationId=requestAnimationFrame(r)};this.inertiaAnimationId=requestAnimationFrame(r)}drag(t,i){if(!this.isReady||!this.isClicked)return;const n=t-this.movementStart.x,o=i-this.movementStart.y;if(this.inertia){const f=performance.now(),u=f-this.lastDragTime;u>0&&u<100&&(this.velocityX=(t-this.lastDragX)/u,this.velocityY=(i-this.lastDragY)/u),this.lastDragTime=f,this.lastDragX=t,this.lastDragY=i}this.draggingDirection=Se({deltaX:n,deltaY:o,reversed:this.dragReverse,allowSpinX:this.allowSpinX,allowSpinY:this.allowSpinY})||this.draggingDirection;const s=this.fullscreenView?document.body:this.container,l=this.dragSpeed/fe,r=l*(this.amountX/s.offsetWidth),a=l*(this.amountY/s.offsetHeight),c=this.allowSpinX?Math.abs(Math.round(n*r)):0,h=this.allowSpinY?Math.abs(Math.round(o*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"))},Ci))}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 n=Ot(this.srcXConfig,t),o=this.allowSpinY?Ot(this.srcYConfig,t):null;ve({cdnPathX:n,cdnPathY:o,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()},pe);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)},pe)})}}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:n}=xn(t,this.canvas,this.devicePixelRatio);this.isZoomed=!0,this.hideAllIcons(),this.hideLoadingSpinner(),this.hideTransitionOverlay(),this.updateView(this.pointerZoom,i,n),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:n,pageY:o}=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:n,y:o},this.isClicked=!0,this.isDragging=!1,this.inertia&&(this.velocityX=0,this.velocityY=0,this.lastDragTime=performance.now(),this.lastDragX=n,this.lastDragY=o)}getPinchDistance(t,i){const n=t.pageX-i.pageX,o=t.pageY-i.pageY;return Math.sqrt(n*n+o*o)}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 o=t.touches[0],s=t.touches[1],l=this.getPinchDistance(o,s);if(this.initialPinchDistance===0){this.initialPinchDistance=l;return}const r=l/this.initialPinchDistance,a=Math.max(1,Math.min(this.pinchZoomLevel*r,me));if(this.initialPinchDistance=l,this.pinchZoomLevel=a,!this.canvas)return;const c=this.canvas.getBoundingClientRect(),h=c.width/2*this.devicePixelRatio,p=c.height/2*this.devicePixelRatio;a>1?(this.isZoomed=!0,this.hideAllIcons(),this.updateView(a,h,p),(!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:n}=t.touches[0];if(t.preventDefault(),this.isZoomed&&this.pinchZoomLevel>1){const o=i-this.movementStart.x,s=n-this.movementStart.y;this.panOffsetX-=o*this.devicePixelRatio,this.panOffsetY-=s*this.devicePixelRatio,this.movementStart={x:i,y:n},this.updateView(this.pinchZoomLevel,this.panOffsetX,this.panOffsetY);return}this.drag(i,n)}keyDown(t){if(!this.isReady)return;const{keyCode:i}=t,n=this.keysReverse;switch(this.autoplay&&this.stopAutoplay(),Ee(i,this.allowSpinY)&&(this.hasInteracted=!0,this.hideAllIcons(),this.hideHints()),i){case 37:n?this.moveLeft():this.moveRight();break;case 39:n?this.moveRight():this.moveLeft();break;case 38:this.allowSpinY&&(t.preventDefault(),n?this.moveTop():this.moveBottom());break;case 40:this.allowSpinY&&(t.preventDefault(),n?this.moveBottom():this.moveTop());break}}keyUp(t){const{keyCode:i}=t;Ee(i,this.allowSpinY)&&this.showAllIcons()}moveActiveXIndexUp(t){this.orientation=P.X,this.activeImageX=(this.activeImageX+t)%this.amountX}moveActiveXIndexDown(t){this.orientation=P.X,this.activeImageX=(this.activeImageX-t+this.amountX)%this.amountX}moveActiveYIndexUp(t){this.orientation=P.Y,this.activeImageY=(this.activeImageY+t)%this.amountY}moveActiveYIndexDown(t){this.orientation=P.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,n=1){t==="right"?this.moveRight(this.stopAtEdges,i):t==="left"?this.moveLeft(this.stopAtEdges,i):t==="up"?this.moveTop(this.stopAtEdges,n):t==="down"&&this.moveBottom(this.stopAtEdges,n),this.emit("onSpin",{direction:t,activeImageX:this.activeImageX,activeImageY:this.activeImageY,amountX:this.amountX,amountY:this.amountY})}updateView(t,i,n){const o=this.orientation===P.X?this.activeImageX:this.activeImageY,s=this.orientation===P.X?this.imagesX[this.activeImageX]:this.imagesY[this.activeImageY];this.hotspotsInstance&&!this.isZoomed&&!this.autoplay&&this.hotspotsInstance.updateHotspotPosition(o,this.orientation),this.hotspotTimelineIndicator&&this.orientation===P.X&&this.updateHotspotTimelinePosition(),this.drawImageOnCanvas(s,t,i,n)}updatePercentageInLoader(t=0){this.loader&&(this.loader.innerText=t+"%")}adaptCanvasSize(t){const{naturalWidth:i,naturalHeight:n}=t;this.imageAspectRatio=i/n;const o=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:o,containerHeight:s})}drawImageOnCanvas(t,i=1,n=0,o=0){this.canvasWorker.postMessage({action:"drawImageOnCanvas",imageData:t,zoomScale:i,pointerX:n,pointerY:o})}pushImageToSet(t,i,n){n===P.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,n){this.pushImageToSet(t,i,n),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 _o(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?be(this.viewerConfig,this.touchDevice):this.hints;t&&t.length>0&&(this.hintsOverlay=ye(this.innerBox,t),we(this.hintsOverlay))}this.autoplay&&(this.hideAllIcons(),kn(this.play.bind(this))())}magnify(t){t.stopPropagation();const{src:i}=this.orientation===P.Y?this.imagesY[this.activeImageY]:this.imagesX[this.activeImageX],o=(this.fullscreenView?document.body:this.container).offsetWidth*this.magnifier,s=Hi(i,o);this.showLoadingSpinner(),this.createGlass(),bn(s,a=>{this.hideLoadingSpinner(),this.magnified=!0,In(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=Ki(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&&On({autoplayBehavior:this.autoplayBehavior,activeImageX:this.activeImageX,activeImageY:this.activeImageY,amountX:this.amountX,amountY:this.amountY,autoplayReverse:this.autoplayReverse})){this.stopAutoplay();return}En({autoplayBehavior:this.autoplayBehavior,activeImageX:this.activeImageX,activeImageY:this.activeImageY,amountX:this.amountX,amountY:this.amountY,autoplayReverse:this.autoplayReverse,spinDirection:this.spinDirection})&&(this.spinDirection=An(this.spinDirection));const s=this.spinDirection==="y";Cn({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?be(this.viewerConfig,this.touchDevice):this.hints;t&&t.length>0&&(this.hintsOverlay=ye(this.innerBox,t),we(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=Ni(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=Gi(),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=$i(),this.fullscreenIcon.onclick=this.openFullscreenModal.bind(this),this.iconsContainer.appendChild(this.fullscreenIcon))}addCloseFullscreenIcon(){this.fullscreenCloseIcon=ji(),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=Wi(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=_i(),this.innerBox.appendChild(this.loadingSpinner)}showLoadingSpinner(){this.loadingSpinner&&(this.hideAllIcons(),this.loadingSpinner.style.opacity=1)}createTransitionOverlay(){this.transitionOverlay=Ji(),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,on(this.hintsOverlay))}addHotspotTimeline(){if(!this.hotspots||this.hotspotTimeline)return;const t=cn(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(n=>{n.addEventListener("click",o=>{o.stopPropagation();const s=parseInt(n.getAttribute("data-frame"),10),l=n.getAttribute("data-hotspot-id");isNaN(s)||this.animateToFrame(s,l)})}),this.updateHotspotTimelinePosition()}showHotspotTimeline(){dn(this.hotspotTimeline)}hideHotspotTimeline(){un(this.hotspotTimeline)}updateHotspotTimelinePosition(){hn(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 n=this.activeImageX,o=(t-n+this.amountX)%this.amountX,s=(n-t+this.amountX)%this.amountX,l=o<=s,r=l?o: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,n){t&&this.addMouseEvents(),i&&this.addTouchEvents(),n&&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=de(this.mouseMove.bind(this),ue),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=de(this.touchMove.bind(this),ue),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=ge(this.innerBox),this.canvas=Vi(this.innerBox,t),this.loader=Ui(this.innerBox),this.ariaLiveRegion=Qi(this.innerBox);const i=this.canvas.transferControlToOffscreen();this.canvasWorker.postMessage({action:"initCanvas",offscreen:i,devicePixelRatio:this.devicePixelRatio},[i]),this.fullscreenView&&this.addCloseFullscreenIcon(),Jt(this.innerBox,".cloudimage-360-placeholder")}update(t){this.isReady&&(this.stopAutoplay(),Jt(this.innerBox,".cloudimage-360-icons-container"),this.init(this.container,t,!0),this.iconsContainer=ge(this.innerBox),this.onAllImagesLoaded())}init(t,i,n){const o=i?Yi(i):ki(t),{folder:s,apiVersion:l,filenameX:r,filenameY:a,imageListX:c,imageListY:h,indexZeroBase:p,amountX:f,amountY:u,draggable:I=!0,swipeable:g=!0,keys:v,keysReverse:m,bottomCircleOffset:b,autoplay:x,autoplayBehavior:w,playOnce:C,speed:y,autoplayReverse:O,fullscreen:S,magnifier:E,ciToken:A,ciFilters:L,ciTransformation:R,lazyload:T,dragSpeed:z,stopAtEdges:G,pointerZoom:Y,imageInfo:Z="black",initialIconShown:rt,bottomCircle:U,hotspots:at,dragReverse:vt,hide360Logo:tt,logoSrc:lt,inertia:q,pinchZoom:V,hints:et,theme:it,hotspotTimelineOnClick:K=!0,onReady:gt,onLoad:Vt,onSpin:yt,onAutoplayStart:jt,onAutoplayStop:Yt,onFullscreenOpen:$t,onFullscreenClose:zt,onZoomIn:Xt,onZoomOut:Pt,onDragStart:Gt,onDragEnd:Ut,onError:_}=o,nt={ciToken:A,ciFilters:L,ciTransformation:R},ct=qt(c,[]),ht=qt(h,[]);if(this.viewerConfig=o,this.amountX=ct.length||f,this.amountY=ht.length||u,this.allowSpinX=!!this.amountX,this.allowSpinY=!!this.amountY,this.activeImageX=O?this.amountX-1:0,this.activeImageY=O?this.amountY-1:0,this.bottomCircleOffset=b,this.autoplay=x,this.autoplayBehavior=w,this.playOnce=C,this.speed=y,this.autoplayReverse=O,this.fullscreen=S,this.magnifier=E>1?Math.min(E,Ai):0,this.dragSpeed=Math.max(z,Si),this.stopAtEdges=G,this.ciParams=nt,this.apiVersion=l,this.pointerZoom=Y>1?Math.min(Y,me):null,this.keysReverse=m,this.info=Z,this.keys=v,this.innerBox=this.innerBox??zi(this.container),this.initialIconShown=rt,this.bottomCircle=U,this.spinDirection=Sn(this.autoplayBehavior,this.allowSpinX,this.allowSpinY),this.dragReverse=vt,this.hotspots=at,this.hide360Logo=tt,this.logoSrc=lt,this.inertia=q,this.pinchZoom=V,this.hints=et,this.hotspotTimelineOnClick=K,it==="dark"?this.container.classList.add("ci360-theme-dark"):it==="light"&&this.container.classList.remove("ci360-theme-dark"),this.onReady=gt,this.onLoad=Vt,this.onSpin=yt,this.onAutoplayStart=jt,this.onAutoplayStop=Yt,this.onFullscreenOpen=$t,this.onFullscreenClose=zt,this.onZoomIn=Xt,this.onZoomOut=Pt,this.onDragStart=Gt,this.onDragEnd=Ut,this.onError=_,this.srcXConfig={folder:s,filename:r,imageList:ct,container:t,innerBox:this.innerBox,apiVersion:l,ciParams:nt,lazyload:T,amount:this.amountX,indexZeroBase:p,autoplayReverse:O,orientation:P.X},this.srcYConfig={...this.srcXConfig,filename:a,imageList:ht,orientation:P.Y,amount:this.amountY},n&&this.removeEvents(),this.attachEvents(I,g,v),n)return;const dt=(this.fullscreenView?document.body:this.container).offsetWidth,bt=this.allowSpinX&&!ct.length?Ot(this.srcXConfig,dt):null,wt=this.allowSpinY&&!ht.length?Ot(this.srcYConfig,dt):null,It=Rt=>{ve({cdnPathX:bt,cdnPathY:wt,configX:this.srcXConfig,configY:this.srcYConfig,onImageLoad:(xt,Je,qe)=>this.onImageLoad(xt,Je,qe),onFirstImageLoad:xt=>this.onFirstImageLoaded(Rt,xt),onAllImagesLoad:this.onAllImagesLoaded.bind(this),onError:xt=>this.emit("onError",xt)})};this.allowSpinX?xe(bt,this.srcXConfig,It):this.allowSpinY&&xe(wt,this.srcYConfig,It)}}class Jo{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,n){if(!t)return;const o=t.id||this.generateId();t.id||(t.id=o);const s=new Ft(t,i,n);return this.views.set(o,s),s}initAll(t="cloudimage-360"){[...document.querySelectorAll(`.${t}`)].filter(Boolean).forEach(n=>{const o=n.id||this.generateId();n.id||(n.id=o);const s=new Ft(n);this.views.set(o,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 n=this.getViewById(t);if(!n)return null;const o={...n.viewerConfig,...i};n.destroy();const s=document.getElementById(t);return this.init(s,o)}}exports.default=Jo;
|
|
35
|
+
//# sourceMappingURL=ci360-COjOXkWS.js.map
|