/** * Skipped minification because the original files appears to be already minified. * Original file: /npm/@3dweb/360javascriptviewer@1.8.55/lib/JavascriptViewer.js * * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files */ !function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var n=e();for(var i in n)("object"==typeof exports?exports:t)[i]=n[i]}}(this,(()=>(()=>{var t={2:t=>{function e(t){var e,n,i=t[0]/255,r=t[1]/255,o=t[2]/255,s=Math.min(i,r,o),a=Math.max(i,r,o),c=a-s;return a==s?e=0:i==a?e=(r-o)/c:r==a?e=2+(o-i)/c:o==a&&(e=4+(i-r)/c),(e=Math.min(60*e,360))<0&&(e+=360),n=(s+a)/2,[e,100*(a==s?0:n<=.5?c/(a+s):c/(2-a-s)),100*n]}function n(t){var e,n,i=t[0],r=t[1],o=t[2],s=Math.min(i,r,o),a=Math.max(i,r,o),c=a-s;return n=0==a?0:c/a*1e3/10,a==s?e=0:i==a?e=(r-o)/c:r==a?e=2+(o-i)/c:o==a&&(e=4+(i-r)/c),(e=Math.min(60*e,360))<0&&(e+=360),[e,n,a/255*1e3/10]}function i(t){var n=t[0],i=t[1],r=t[2];return[e(t)[0],1/255*Math.min(n,Math.min(i,r))*100,100*(r=1-1/255*Math.max(n,Math.max(i,r)))]}function o(t){var e,n=t[0]/255,i=t[1]/255,r=t[2]/255;return[100*((1-n-(e=Math.min(1-n,1-i,1-r)))/(1-e)||0),100*((1-i-e)/(1-e)||0),100*((1-r-e)/(1-e)||0),100*e]}function s(t){return E[JSON.stringify(t)]}function a(t){var e=t[0]/255,n=t[1]/255,i=t[2]/255;return[100*(.4124*(e=e>.04045?Math.pow((e+.055)/1.055,2.4):e/12.92)+.3576*(n=n>.04045?Math.pow((n+.055)/1.055,2.4):n/12.92)+.1805*(i=i>.04045?Math.pow((i+.055)/1.055,2.4):i/12.92)),100*(.2126*e+.7152*n+.0722*i),100*(.0193*e+.1192*n+.9505*i)]}function c(t){var e=a(t),n=e[0],i=e[1],r=e[2];return i/=100,r/=108.883,n=(n/=95.047)>.008856?Math.pow(n,1/3):7.787*n+16/116,[116*(i=i>.008856?Math.pow(i,1/3):7.787*i+16/116)-16,500*(n-i),200*(i-(r=r>.008856?Math.pow(r,1/3):7.787*r+16/116))]}function l(t){var e,n,i,r,o,s=t[0]/360,a=t[1]/100,c=t[2]/100;if(0==a)return[o=255*c,o,o];e=2*c-(n=c<.5?c*(1+a):c+a-c*a),r=[0,0,0];for(var l=0;l<3;l++)(i=s+1/3*-(l-1))<0&&i++,i>1&&i--,o=6*i<1?e+6*(n-e)*i:2*i<1?n:3*i<2?e+(n-e)*(2/3-i)*6:e,r[l]=255*o;return r}function h(t){var e=t[0]/60,n=t[1]/100,i=t[2]/100,r=Math.floor(e)%6,o=e-Math.floor(e),s=255*i*(1-n),a=255*i*(1-n*o),c=255*i*(1-n*(1-o));switch(i*=255,r){case 0:return[i,c,s];case 1:return[a,i,s];case 2:return[s,i,c];case 3:return[s,a,i];case 4:return[c,s,i];case 5:return[i,s,a]}}function d(t){var e,n,i,o,s=t[0]/360,a=t[1]/100,c=t[2]/100,l=a+c;switch(l>1&&(a/=l,c/=l),i=6*s-(e=Math.floor(6*s)),1&e&&(i=1-i),o=a+i*((n=1-c)-a),e){default:case 6:case 0:r=n,g=o,b=a;break;case 1:r=o,g=n,b=a;break;case 2:r=a,g=n,b=o;break;case 3:r=a,g=o,b=n;break;case 4:r=o,g=a,b=n;break;case 5:r=n,g=a,b=o}return[255*r,255*g,255*b]}function u(t){var e=t[0]/100,n=t[1]/100,i=t[2]/100,r=t[3]/100;return[255*(1-Math.min(1,e*(1-r)+r)),255*(1-Math.min(1,n*(1-r)+r)),255*(1-Math.min(1,i*(1-r)+r))]}function m(t){var e,n,i,r=t[0]/100,o=t[1]/100,s=t[2]/100;return n=-.9689*r+1.8758*o+.0415*s,i=.0557*r+-.204*o+1.057*s,e=(e=3.2406*r+-1.5372*o+-.4986*s)>.0031308?1.055*Math.pow(e,1/2.4)-.055:e*=12.92,n=n>.0031308?1.055*Math.pow(n,1/2.4)-.055:n*=12.92,i=i>.0031308?1.055*Math.pow(i,1/2.4)-.055:i*=12.92,[255*(e=Math.min(Math.max(0,e),1)),255*(n=Math.min(Math.max(0,n),1)),255*(i=Math.min(Math.max(0,i),1))]}function p(t){var e=t[0],n=t[1],i=t[2];return n/=100,i/=108.883,e=(e/=95.047)>.008856?Math.pow(e,1/3):7.787*e+16/116,[116*(n=n>.008856?Math.pow(n,1/3):7.787*n+16/116)-16,500*(e-n),200*(n-(i=i>.008856?Math.pow(i,1/3):7.787*i+16/116))]}function f(t){var e,n,i,r,o=t[0],s=t[1],a=t[2];return o<=8?r=(n=100*o/903.3)/100*7.787+16/116:(n=100*Math.pow((o+16)/116,3),r=Math.pow(n/100,1/3)),[e=e/95.047<=.008856?e=95.047*(s/500+r-16/116)/7.787:95.047*Math.pow(s/500+r,3),n,i=i/108.883<=.008859?i=108.883*(r-a/200-16/116)/7.787:108.883*Math.pow(r-a/200,3)]}function v(t){var e,n=t[0],i=t[1],r=t[2];return(e=360*Math.atan2(r,i)/2/Math.PI)<0&&(e+=360),[n,Math.sqrt(i*i+r*r),e]}function y(t){return m(f(t))}function w(t){var e,n=t[0],i=t[1];return e=t[2]/360*2*Math.PI,[n,i*Math.cos(e),i*Math.sin(e)]}function x(t){return R[t]}t.exports={rgb2hsl:e,rgb2hsv:n,rgb2hwb:i,rgb2cmyk:o,rgb2keyword:s,rgb2xyz:a,rgb2lab:c,rgb2lch:function(t){return v(c(t))},hsl2rgb:l,hsl2hsv:function(t){var e=t[0],n=t[1]/100,i=t[2]/100;return 0===i?[0,0,0]:[e,2*(n*=(i*=2)<=1?i:2-i)/(i+n)*100,(i+n)/2*100]},hsl2hwb:function(t){return i(l(t))},hsl2cmyk:function(t){return o(l(t))},hsl2keyword:function(t){return s(l(t))},hsv2rgb:h,hsv2hsl:function(t){var e,n,i=t[0],r=t[1]/100,o=t[2]/100;return e=r*o,[i,100*(e=(e/=(n=(2-r)*o)<=1?n:2-n)||0),100*(n/=2)]},hsv2hwb:function(t){return i(h(t))},hsv2cmyk:function(t){return o(h(t))},hsv2keyword:function(t){return s(h(t))},hwb2rgb:d,hwb2hsl:function(t){return e(d(t))},hwb2hsv:function(t){return n(d(t))},hwb2cmyk:function(t){return o(d(t))},hwb2keyword:function(t){return s(d(t))},cmyk2rgb:u,cmyk2hsl:function(t){return e(u(t))},cmyk2hsv:function(t){return n(u(t))},cmyk2hwb:function(t){return i(u(t))},cmyk2keyword:function(t){return s(u(t))},keyword2rgb:x,keyword2hsl:function(t){return e(x(t))},keyword2hsv:function(t){return n(x(t))},keyword2hwb:function(t){return i(x(t))},keyword2cmyk:function(t){return o(x(t))},keyword2lab:function(t){return c(x(t))},keyword2xyz:function(t){return a(x(t))},xyz2rgb:m,xyz2lab:p,xyz2lch:function(t){return v(p(t))},lab2xyz:f,lab2rgb:y,lab2lch:v,lch2lab:w,lch2xyz:function(t){return f(w(t))},lch2rgb:function(t){return y(w(t))}};var R={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]},E={};for(var I in R)E[JSON.stringify(R[I])]=I},24:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.DEFAULT_PARAM=void 0,e.DEFAULT_PARAM="$_DEFAULT_$"},43:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.ChunkedChannel=void 0;var i=n(520),r=n(266);const o=t=>{if(!t.chunkId)throw new Error(`ChunkedMessage did not have a chunkId: ${JSON.stringify(t)}`)};class s extends i.GenericChannel{constructor(t){super(t.timeout),this._chunkSize=void 0,this._maxStringAlloc=void 0,this._sender=void 0,this._buffer={},this._chunkSize=t.chunkSize,this._sender=t.sender,this._maxStringAlloc=t.maxStringAlloc||-1}send(t){const e=JSON.stringify(t);if(e.length<=this._chunkSize)return void this._sender(t);const n=(t=>{const e=new Uint16Array(t.length);for(let n=0,i=t.length;nMath.random().toString(36)[3])).join("");this._sender({type:"chunk_start",chunkId:i,size:e.length});const r=(t=0)=>{let e=n.slice(t,t+this._chunkSize);e.length&&(this._sender({type:"chunk_data",chunkId:i,data:Array.from(e)}),r(t+this._chunkSize))};r(),this._sender({type:"chunk_end",chunkId:i})}_messageReceived(t){switch(t.type){case"chunk_start":this._receiveNewChunk(t);break;case"chunk_data":this._receiveChunkData(t);break;case"chunk_end":const e=this._mergeChunks(t);super._messageReceived(e);break;default:super._messageReceived(t)}}_receiveNewChunk(t){if(o(t),this._buffer[t.chunkId])throw new Error(`There was already an entry in the buffer for chunkId ${t.chunkId}`);this._buffer[t.chunkId]={id:t.chunkId,chunks:[],size:t.size}}_receiveChunkData(t){if(o(t),!this._buffer[t.chunkId])throw new Error(`ChunkId ${t.chunkId} was not found in the buffer`);this._buffer[t.chunkId].chunks.push(t.data)}_mergeChunks(t){if(o(t),!this._buffer[t.chunkId])throw new Error(`ChunkId ${t.chunkId} was not found in the buffer`);let e;const n=((t,e)=>{if(-1===e)return String.fromCharCode.apply(null,t);{let n="";for(let i=0;it.length?n+=String.fromCharCode.apply(null,t.subarray(i)):n+=String.fromCharCode.apply(null,t.subarray(i,i+e));return n}})(this._buffer[t.chunkId].chunks.reduce(((t,e,n)=>(e.forEach(((e,n)=>t.uintArray[t.currentIx+n]=e)),t.currentIx+=e.length,t)),{uintArray:new Uint16Array(this._buffer[t.chunkId].size),currentIx:0}).uintArray,this._maxStringAlloc);try{e=JSON.parse(n)}catch(t){throw new Error(`Not a valid JSON string: ${n}`)}if(!(0,r.isTransportMessage)(e))throw new Error(`Not a transport message: ${JSON.stringify(e)}`);return e}}e.ChunkedChannel=s},119:(t,e,n)=>{"use strict";const i=n(865),r=n(201),o=new WeakMap,s=new WeakMap,a=(t,{cacheKey:e,cache:n=new Map,maxAge:o}={})=>{"number"==typeof o&&r(n);const a=function(...i){const r=e?e(i):i[0],s=n.get(r);if(s)return s.data;const a=t.apply(this,i);return n.set(r,{data:a,maxAge:o?Date.now()+o:Number.POSITIVE_INFINITY}),a};return i(a,t,{ignoreNonConfigurable:!0}),s.set(a,n),a};a.decorator=(t={})=>(e,n,i)=>{const r=e[n];if("function"!=typeof r)throw new TypeError("The decorated value must be a function");delete i.value,delete i.writable,i.get=function(){if(!o.has(this)){const e=a(r,t);return o.set(this,e),e}return o.get(this)}},a.clear=t=>{const e=s.get(t);if(!e)throw new TypeError("Can't clear a function that was not memoized!");if("function"!=typeof e.clear)throw new TypeError("The cache Map can't be cleared!");e.clear()},t.exports=a},196:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.combineEvents=function(...t){const e=t.reduce(((t,e)=>(t.push.apply(t,Object.keys(e)),t)),[]),n=[...new Set(e)];if(e.length>n.length)throw new Error("ts-event-bus: duplicate slots encountered in combineEvents.");return Object.assign({},...t)},e.createEventBus=function(t){const e=(t.channels||[]).map((e=>new r.Transport(e,t.ignoredEvents))),n={};for(const r in t.events)t.events.hasOwnProperty(r)&&(!t.ignoredEvents||t.ignoredEvents&&!t.ignoredEvents.includes(r))&&(n[r]=(0,i.connectSlot)(r,e,t.events[r].config));return n};var i=n(753),r=n(876)},201:function(t,e,n){"use strict";var i=this&&this.__awaiter||function(t,e,n,i){return new(n||(n=Promise))((function(r,o){function s(t){try{c(i.next(t))}catch(t){o(t)}}function a(t){try{c(i.throw(t))}catch(t){o(t)}}function c(t){t.done?r(t.value):new n((function(e){e(t.value)})).then(s,a)}c((i=i.apply(t,e||[])).next())}))},r=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});const o=r(n(714));function s(t,e="maxAge"){let n,r,s;const a=()=>i(this,void 0,void 0,(function*(){if(void 0!==n)return;const a=a=>i(this,void 0,void 0,(function*(){s=o.default();const i=a[1][e]-Date.now();return i<=0?(t.delete(a[0]),void s.resolve()):(n=a[0],r=setTimeout((()=>{t.delete(a[0]),s&&s.resolve()}),i),"function"==typeof r.unref&&r.unref(),s.promise)}));try{for(const e of t)yield a(e)}catch(t){}n=void 0})),c=t.set.bind(t);return t.set=(e,i)=>{t.has(e)&&t.delete(e);const o=c(e,i);return n&&n===e&&(n=void 0,void 0!==r&&(clearTimeout(r),r=void 0),void 0!==s&&(s.reject(void 0),s=void 0)),a(),o},a(),t}e.default=s,t.exports=s,t.exports.default=s},266:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.isTransportMessage=function(t){switch(t.type){case"request":case"response":case"error":case"handler_unregistered":case"handler_registered":case"event_list":return!0;default:return!1}}},520:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.GenericChannel=void 0,e.GenericChannel=class{constructor(t=5e3){this._timeout=t,this._onMessageCallbacks=[],this._onConnectCallbacks=[],this._onDisconnectCallbacks=[],this._onErrorCallbacks=[],this._ready=!1}get timeout(){return this._timeout}onData(t){-1===this._onMessageCallbacks.indexOf(t)&&this._onMessageCallbacks.push(t)}onConnect(t){this._ready&&t(),this._onConnectCallbacks.push(t)}onDisconnect(t){this._onDisconnectCallbacks.push(t)}onError(t){this._onErrorCallbacks.push(t)}_messageReceived(t){this._onMessageCallbacks.forEach((e=>e(t)))}_error(t){this._onErrorCallbacks.forEach((e=>e(t)))}_connected(){this._ready=!0,this._onConnectCallbacks.forEach((t=>t()))}_disconnected(){this._ready=!1,this._onDisconnectCallbacks.forEach((t=>t()))}}},526:()=>{},569:(t,e,n)=>{"use strict";Object.defineProperty(e,"NI",{enumerable:!0,get:function(){return i.slot}}),Object.defineProperty(e,"lV",{enumerable:!0,get:function(){return r.createEventBus}});var i=n(753),r=n(196);n(526),n(520),n(43),n(266),n(24)},699:(t,e,n)=>{var i=n(2),r=function(){return new l};for(var o in i){r[o+"Raw"]=function(t){return function(e){return"number"==typeof e&&(e=Array.prototype.slice.call(arguments)),i[t](e)}}(o);var s=/(\w+)2(\w+)/.exec(o),a=s[1],c=s[2];(r[a]=r[a]||{})[c]=r[o]=function(t){return function(e){"number"==typeof e&&(e=Array.prototype.slice.call(arguments));var n=i[t](e);if("string"==typeof n||void 0===n)return n;for(var r=0;r{"use strict";t.exports=()=>{const t={};return t.promise=new Promise(((e,n)=>{t.resolve=e,t.reject=n})),t}},753:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.slot=function(t=s){return a(t)},e.connectSlot=function(t,e,n={}){const o=e.reduce(((t,e,n)=>({...t,[n]:{}})),{[c]:{}}),s=e.reduce(((t,e,n)=>({...t,[n]:{}})),{}),a=(t,e)=>{let n=()=>{};const i=new Promise((t=>n=t));s[t][e]={registered:i,onRegister:n}},d=[],u=[],g=t=>d.forEach((e=>e(t))),m=t=>u.forEach((e=>e(t)));return e.forEach(((e,n)=>{e.addRemoteHandlerRegistrationCallback(t,((t=r.DEFAULT_PARAM,e)=>{if(!s[n])return;const i=o[n][t]||[];o[n][t]=i.concat(e),1===l(t,o).length&&g(t),s[n][t]||a(String(n),t),s[n][t].onRegister()})),e.addRemoteHandlerUnregistrationCallback(t,((t=r.DEFAULT_PARAM,e)=>{const i=(o[n][t]||[]).indexOf(e);i>-1&&o[n][t].splice(i,1),0===l(t,o).length&&m(t),s[n]&&a(String(n),t)})),e.addRemoteEventListChangedListener(t,(()=>{s[n]&&Object.keys(s[n]).forEach((t=>{s[n][t].onRegister()})),delete s[n]}))})),Object.assign((function(t,c){const h=2===arguments.length,d=h?c:t,u=h?t:r.DEFAULT_PARAM,g=()=>{const t=l(u,o);return(0,i.callHandlers)(d,t)};if(0===e.length)return g();const m=[];if(n.autoReconnect&&e.forEach((t=>{m.push(t.autoReconnect())})),n.noBuffer)return Promise.all(m).then((()=>g()));{e.forEach(((t,e)=>{s[e]&&!s[e][u]&&a(String(e),u)}));const t=e.reduce(((t,e,n)=>{var i;return[...t,...null!==(i=s[n]&&[s[n][u].registered])&&void 0!==i?i:[]]}),[]);return Promise.all(t).then((()=>g()))}}),{on:function(n,i){let s="",a=()=>new Promise((t=>t()));return"string"==typeof n?(s=n,a=i||a):(s=r.DEFAULT_PARAM,a=n),e.forEach((e=>e.registerHandler(t,s,a))),o[c][s]=(o[c][s]||[]).concat(a),1===l(s,o).length&&g(s),()=>{e.forEach((e=>e.unregisterHandler(t,s,a)));const n=(o[c][s]||[]).indexOf(a);-1!==n&&o[c][s].splice(n,1),0===l(s,o).length&&m(s)}},lazy:function(t,e){return d.push(t),u.push(e),h(o).forEach(t),()=>{h(o).forEach(e);const n=d.indexOf(t);n>-1&&d.splice(n,1);const i=u.indexOf(e);i>-1&&u.splice(i,1)}},config:n,slotName:t})},e.defaultSlotConfig=void 0;var i=n(933),r=n(24);const o=()=>{throw new Error("Slot not connected")},s={noBuffer:!1,autoReconnect:!0};e.defaultSlotConfig=s;const a=t=>Object.assign((()=>o()),{config:t,lazy:()=>o,on:()=>o,slotName:"Not connected"}),c="LOCAL_TRANSPORT",l=(t,e)=>Object.keys(e).reduce(((n,i)=>n.concat(e[i][t]||[])),[]),h=t=>Object.keys(t).reduce(((e,n)=>{const i=t[n],r=[...e,...Object.keys(i).filter((t=>(i[t]||[]).length>0))];return[...new Set(r)]}),[])},865:t=>{"use strict";const e=(t,e,i,r)=>{if("length"===i||"prototype"===i)return;if("arguments"===i||"caller"===i)return;const o=Object.getOwnPropertyDescriptor(t,i),s=Object.getOwnPropertyDescriptor(e,i);!n(o,s)&&r||Object.defineProperty(t,i,s)},n=function(t,e){return void 0===t||t.configurable||t.writable===e.writable&&t.enumerable===e.enumerable&&t.configurable===e.configurable&&(t.writable||t.value===e.value)},i=(t,e)=>`/* Wrapped ${t}*/\n${e}`,r=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),o=Object.getOwnPropertyDescriptor(Function.prototype.toString,"name");t.exports=(t,n,{ignoreNonConfigurable:s=!1}={})=>{const{name:a}=t;for(const i of Reflect.ownKeys(n))e(t,n,i,s);return((t,e)=>{const n=Object.getPrototypeOf(e);n!==Object.getPrototypeOf(t)&&Object.setPrototypeOf(t,n)})(t,n),((t,e,n)=>{const s=""===n?"":`with ${n.trim()}() `,a=i.bind(null,s,e.toString());Object.defineProperty(a,"name",o),Object.defineProperty(t,"toString",{...r,value:a})})(t,n,a),t}},876:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.Transport=void 0;var i=n(933);let r=0;e.Transport=class{constructor(t,e){this._channel=t,this._localHandlers={},this._localHandlerRegistrations={},this._remoteHandlers={},this._remoteHandlerRegistrationCallbacks={},this._remoteHandlerDeletionCallbacks={},this._remoteIgnoredEventsCallbacks={},this._pendingRequests={},this._channelReady=!1,this._channel.onData((t=>{switch(t.type){case"request":return this._requestReceived(t);case"response":return this._responseReceived(t);case"handler_registered":return this._registerRemoteHandler(t);case"handler_unregistered":return this._unregisterRemoteHandler(t);case"error":return this._errorReceived(t);case"event_list":return this._remoteIgnoredEventsReceived(t);default:(t=>{throw new Error(`Should not happen: ${t}`)})(t)}})),this._channel.onConnect((()=>{this._channelReady=!0,Object.keys(this._localHandlerRegistrations).forEach((t=>{this._localHandlerRegistrations[t].forEach((t=>{this._channel.send(t)}))})),e&&this._channel.send({type:"event_list",ignoredEvents:e})})),this._channel.onDisconnect((()=>{this._channelReady=!1,this._unregisterAllRemoteHandlers(),this._rejectAllPendingRequests(new Error("REMOTE_CONNECTION_CLOSED"))})),this._channel.onError((t=>this._rejectAllPendingRequests(t)))}_remoteIgnoredEventsReceived({ignoredEvents:t}){Object.keys(this._remoteIgnoredEventsCallbacks).forEach((e=>{t.includes(e)&&this._remoteIgnoredEventsCallbacks[e]()}))}_requestReceived({slotName:t,data:e,id:n,param:r}){const o=this._localHandlers[t];if(!o)return;const s=o[r];s&&(0,i.callHandlers)(e,s).then((async e=>{await this.autoReconnect(),this.isDisconnected()||this._channel.send({type:"response",slotName:t,id:n,data:e,param:r})})).catch((async e=>{await this.autoReconnect(),this.isDisconnected()||this._channel.send({id:n,message:`${e}`,param:r,slotName:t,stack:e.stack||"",type:"error"})}))}_responseReceived({slotName:t,data:e,id:n,param:i}){const r=this._pendingRequests[t];r&&r[i]&&r[i][n]&&(r[i][n].resolve(e),delete r[i][n])}_errorReceived({slotName:t,id:e,message:n,stack:i,param:r}){const o=this._pendingRequests[t];if(!o||!o[r]||!o[r][e])return;const s=new Error(`${n} on ${t} with param ${r}`);s.stack=i||s.stack,this._pendingRequests[t][r][e].reject(s),delete this._pendingRequests[t][r][e]}_registerRemoteHandler({slotName:t,param:e}){const n=this._remoteHandlerRegistrationCallbacks[t];if(!n)return;const i=this._remoteHandlers[t];if(i&&i[e])return;const o=n=>new Promise(((i,o)=>{if(!this._channelReady)return o(new Error(`CHANNEL_NOT_READY on ${t}`));const s=""+r++;this._pendingRequests[t]=this._pendingRequests[t]||{},this._pendingRequests[t][e]=this._pendingRequests[t][e]||{},this._pendingRequests[t][e][s]={resolve:i,reject:o},this._channel.send({type:"request",id:s,slotName:t,param:e,data:n}),setTimeout((()=>{const n=((this._pendingRequests[t]||{})[e]||{})[s];if(n){const i=new Error(`TIMED_OUT on ${t} with param ${e}`);n.reject(i),delete this._pendingRequests[t][e][s]}}),this._channel.timeout)}));this._remoteHandlers[t]=this._remoteHandlers[t]||{},this._remoteHandlers[t][e]=o,n(e,o)}_unregisterRemoteHandler({slotName:t,param:e}){const n=this._remoteHandlerDeletionCallbacks[t],i=this._remoteHandlers[t];if(!i)return;const r=i[e];r&&n&&(n(e,r),delete this._remoteHandlers[t][e])}_unregisterAllRemoteHandlers(){Object.keys(this._remoteHandlerDeletionCallbacks).forEach((t=>{const e=this._remoteHandlers[t];e&&Object.keys(e).filter((t=>e[t])).forEach((e=>this._unregisterRemoteHandler({slotName:t,param:e})))}))}_rejectAllPendingRequests(t){Object.keys(this._pendingRequests).forEach((e=>{Object.keys(this._pendingRequests[e]).forEach((n=>{Object.keys(this._pendingRequests[e][n]).forEach((i=>{this._pendingRequests[e][n][i].reject(t)}))})),this._pendingRequests[e]={}}))}addRemoteHandlerRegistrationCallback(t,e){this._remoteHandlerRegistrationCallbacks[t]||(this._remoteHandlerRegistrationCallbacks[t]=e)}addRemoteHandlerUnregistrationCallback(t,e){this._remoteHandlerDeletionCallbacks[t]||(this._remoteHandlerDeletionCallbacks[t]=e)}addRemoteEventListChangedListener(t,e){this._remoteIgnoredEventsCallbacks[t]||(this._remoteIgnoredEventsCallbacks[t]=e)}registerHandler(t,e,n){if(this._localHandlers[t]=this._localHandlers[t]||{},this._localHandlers[t][e]=this._localHandlers[t][e]||[],this._localHandlers[t][e].push(n),1===this._localHandlers[t][e].length){const n={type:"handler_registered",param:e,slotName:t};this._localHandlerRegistrations[e]=this._localHandlerRegistrations[e]||[],this._localHandlerRegistrations[e].push(n),this._channelReady&&this._channel.send(n)}}unregisterHandler(t,e,n){const i=this._localHandlers[t];if(i&&i[e]){const r=i[e].indexOf(n);if(r>-1&&(i[e].splice(r,1),0===i[e].length)){const n={type:"handler_unregistered",param:e,slotName:t};this._channelReady&&this._channel.send(n)}}}isDisconnected(){return!this._channelReady}autoReconnect(){if(this.isDisconnected()&&this._channel.autoReconnect){const t=new Promise((t=>{this._channel.onConnect((()=>t()))}));return this._channel.autoReconnect(),t}return Promise.resolve()}}},933:(t,e)=>{"use strict";function n(t,e){let n=null;try{n=t(e)}catch(t){return Promise.reject(t)}return n&&n.then?n:Promise.resolve(n)}Object.defineProperty(e,"__esModule",{value:!0}),e.callHandlers=function(t,e){return e&&0!==e.length?1===e.length?n(e[0],t):Promise.all(e.map((e=>n(e,t)))):new Promise((t=>{}))}},982:(t,e,n)=>{var i=n(699);t.exports=function(t){var e,n,r,o;if(e=/^((?:rgb|hs[lv]|cmyk|xyz|lab)a?)\s*\(([^\)]*)\)/.exec(t)){var s=e[1],a="cmyk"===(c=s.replace(/a$/,""))?4:3;n=i[c],r=e[2].replace(/^\s+|\s+$/g,"").split(/\s*,\s*/).map((function(t,e){return/%$/.test(t)&&e===a?parseFloat(t)/100:(/%$/.test(t),parseFloat(t))})),s===c&&r.push(1),o=void 0===r[a]?1:r[a],r=r.slice(0,a),n[c]=function(){return r}}else if(/^#[A-Fa-f0-9]+$/.test(t)){var c;a=(c=t.replace(/^#/,"")).length,n=i.rgb,r=(r=c.split(3===a?/(.)/:/(..)/)).filter(Boolean).map((function(t){return 3===a?parseInt(t+t,16):parseInt(t,16)})),o=1,n.rgb=function(){return r},r[0]||(r[0]=0),r[1]||(r[1]=0),r[2]||(r[2]=0)}else(n=i.keyword).keyword=function(){return t},r=t,o=1;var l={rgb:void 0,hsl:void 0,hsv:void 0,cmyk:void 0,keyword:void 0,hex:void 0};try{l.rgb=n.rgb(r)}catch(t){}try{l.hsl=n.hsl(r)}catch(t){}try{l.hsv=n.hsv(r)}catch(t){}try{l.cmyk=n.cmyk(r)}catch(t){}try{l.keyword=n.keyword(r)}catch(t){}return l.rgb&&(l.hex="#"+l.rgb.map((function(t){var e=t.toString(16);return 1===e.length?"0"+e:e})).join("")),l.rgb&&(l.rgba=l.rgb.concat(o)),l.hsl&&(l.hsla=l.hsl.concat(o)),l.hsv&&(l.hsva=l.hsv.concat(o)),l.cmyk&&(l.cmyka=l.cmyk.concat(o)),l}}},e={};function n(i){var r=e[i];if(void 0!==r)return r.exports;var o=e[i]={exports:{}};return t[i].call(o.exports,o,o.exports,n),o.exports}n.d=(t,e)=>{for(var i in e)n.o(e,i)&&!n.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:e[i]})},n.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),n.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var i={};return(()=>{"use strict";n.r(i),n.d(i,{JavascriptViewer:()=>ut,defaultsOptions:()=>dt});class t extends Error{constructor(t){super(t+=" check the documentation at https://www.360-javascriptviewer.com/installation"),this.name="360 Javascript Viewer InputError"}}const e=t;var r=function(t,e,n,i){return new(n||(n=Promise))((function(r,o){function s(t){try{c(i.next(t))}catch(t){o(t)}}function a(t){try{c(i.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}c((i=i.apply(t,e||[])).next())}))};var o=n(119);function s(t){return"string"==typeof t}function a(t,e,n){return n.indexOf(t)===e}function c(t){return-1===t.indexOf(",")?t:t.split(",")}function l(t){if(!t)return t;if("C"===t||"posix"===t||"POSIX"===t)return"en-US";if(-1!==t.indexOf(".")){var e=t.split(".")[0];return l(void 0===e?"":e)}if(-1!==t.indexOf("@")){var n=t.split("@")[0];return l(void 0===n?"":n)}if(-1===t.indexOf("-")||(i=t).toLowerCase()!==i)return t;var i,r=t.split("-"),o=r[0],s=r[1],a=void 0===s?"":s;return"".concat(o,"-").concat(a.toUpperCase())}var h=o((function(t){var e=void 0===t?{}:t,n=e.useFallbackLocale,i=void 0===n||n,r=e.fallbackLocale,o=void 0===r?"en-US":r,h=[];if("undefined"!=typeof navigator){for(var d=[],u=0,g=navigator.languages||[];u=0?r:r+2*Math.PI}([t[0].clientX,t[0].clientY],[t[1].clientX,t[1].clientY])/Math.PI*180}function f(t,e,n,i){const r=E(t),o=E(e),s=E(i);return b(I(i[0],C(r,s)),I(i[0],C(o,s)),n[0])}function v(t){return t.touches?x(t.touches):[R(t)]}function b(t,e,n){const{clientX:i,clientY:r}=t,{clientX:o,clientY:s}=e,{clientX:a,clientY:c}=n;return{clientX:i,clientY:r,deltaX:i-o,deltaY:r-s,distX:i-a,distY:r-c}}function y(t){return Math.sqrt(Math.pow(t[0].clientX-t[1].clientX,2)+Math.pow(t[0].clientY-t[1].clientY,2))}function w(t,e,n){return t.map(((t,i)=>b(t,e[i],n[i])))}function x(t){const e=Math.min(t.length,2),n=[];for(let i=0;it&&"object"==typeof t;return t.reduce(((t,n)=>(Object.keys(n).forEach((i=>{const r=t[i],o=n[i];Array.isArray(r)&&Array.isArray(o)?t[i]=r.concat(...o):e(r)&&e(o)?t[i]=P({objects:[r,o]}):t[i]=o})),t)),{})}class N{static getNotificationCustomImage(t){return``}static getReadyForRotate(t){return`
\n${this.getSvg(t)} ${this.getText(t)}
`}static getPoweredBy(t,e){const n=this.getLogoSvg();let i=atob("aHR0cHM6Ly93d3cuMzYwLWphdmFzY3JpcHR2aWV3ZXIuY29t");return e&&e.length>0&&(i+=`?host=${e}`),``}static getMainColor(t){let e=_(t.dragToRotate.mainColor);return null===e&&(e={r:0,g:0,b:0,a:1}),e}static getTextColor(t){let e=_(t.dragToRotate.textColor);return null===e&&(e={r:0,g:0,b:0,a:1}),e}static getText(t){const e=g.getDragToRotate(t),n=this.getMainColor(t),i=this.getTextColor(t);return`
\n${e}\n
`}static getLogoSvg(){return''}static getSvg(t){const e=this.getMainColor(t),n=this.getTextColor(t),i=`rgba(${e.r}, ${e.g}, ${e.b}, ${e.a})`,r=`rgba(${n.r}, ${n.g}, ${n.b}, ${n.a})`;return`
\n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n\n
`}}var M=function(t,e,n,i){return new(n||(n=Promise))((function(r,o){function s(t){try{c(i.next(t))}catch(t){o(t)}}function a(t){try{c(i.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}c((i=i.apply(t,e||[])).next())}))};class T{static hideImage(t,e){const n=e.document.getElementById(t.id);n&&(n.style.display="none")}static addHiddenStyle(t,e){return M(this,arguments,void 0,(function*(t,e,n=100){return new Promise(((n,i)=>M(this,void 0,void 0,(function*(){const r=e.document.getElementById(t);null===r?i():(r.classList.remove("jsv-show"),r.classList.add("jsv-hidden"),setTimeout((()=>{n()}),2e3))}))))}))}static hideImageSlow(t,e){return M(this,arguments,void 0,(function*(t,e,n=100){return new Promise(((i,r)=>M(this,void 0,void 0,(function*(){""===t&&i();const o=e.document.getElementById(t);if(null===o)r();else{let t=1,e=setInterval((function(){t-=50/n,t<=0&&(clearInterval(e),t=0,o.style.display="none",o.style.visibility="hidden",i()),o.style.opacity=`${t}`,o.style.filter="alpha(opacity="+100*t+")"}),50)}}))))}))}static addShowStyle(t,e){return M(this,arguments,void 0,(function*(t,e,n=100){return new Promise(((n,i)=>M(this,void 0,void 0,(function*(){const r=e.document.getElementById(t);null===r?i():(r.classList.remove("jsv-hidden"),r.classList.add("jsv-show"),setTimeout((()=>{n()}),2e3))}))))}))}static addStyles(t){const e=t.document.createElement("style");e.innerText="\n .jsv-hidden { \n opacity:0;\n display: none;\n transition: opacity .8s ease-in-out\n }\n .jsv-show {\n opacity:1;\n display:unset;\n transition: opacity .8s ease-in-out\n }\n .jsv-width-100 {\n width: 100%;\n } \n .jsv-height-100 {\n height: 100%;\n }\n ",document.head.appendChild(e)}static showImage(t,e){const n=e.document.getElementById(t.id);n&&(n.style.display="block",n.style.removeProperty("z-index"),n.style.removeProperty("width"),n.style.removeProperty("position"),n.style.removeProperty("opacity"),n.style.removeProperty("filter"),n.style.removeProperty("visibility"))}static getImageHolderElement(t,e,n,i,r){var o,s,a,c;const l=t.document.createElement("div"),h=null!==(o=i[0])&&void 0!==o?o:null;if(r.autoCDNResizer&&r.zoom&&null!==h&&(null===(s=r.autoCDNResizerConfig)||void 0===s?void 0:s.scaleWithZoomMax)){if(null===(a=r.autoCDNResizerConfig)||void 0===a?void 0:a.useWidth){let t=h.naturalWidth;t/=r.zoomMax,l.style.maxWidth=`${t}px`}if(null===(c=r.autoCDNResizerConfig)||void 0===c?void 0:c.useHeight){let t=h.naturalHeight;t/=r.zoomMax,l.style.height=`${t}px`}}return l.style.padding="0",l.style.margin="0",l.style.position="relative",l.id=n,l}static removeElement(t){if(null!==t&&t&&t.parentNode&&t.hasChildNodes())try{t.parentNode.removeChild(t)}catch(t){return}}static getMainHolderElement(t,n){const i=n.document.getElementById(t);if(i instanceof HTMLDivElement)return i.style.position="relative",i;throw new e(`Could not find main holder with id "${t}". Did you create an element like
`)}static createLink(t,e){const n=t.document.createElement("a");n.title=atob("MzYwIHByb2R1Y3Qgdmlld2VyLCAzNjAgc3Bpbg=="),n.style.position="absolute",n.style.bottom="10px",n.style.right="10px",n.style.zIndex="300",n.style.color="#ccc",n.href=atob("aHR0cHM6Ly93d3cuMzYwLWphdmFzY3JpcHR2aWV3ZXIuY29t"),n.innerText=atob("MzYwIHByb2R1Y3Qgdmlld2Vy"),e.appendChild(n)}static getImageElement(t,e){const n=e.document.createElement("img");return n.src=t.src,n.id=t.id,n.style.userSelect="none",n.style.display="none",n.style.touchAction="pan-x",n.style.touchAction="pan-y",t.extraClass.length>0&&t.extraClass.split(" ").forEach((t=>{t.length>0&&n.classList.add(t.trim())})),void 0!==t.alt&&(n.alt=t.alt),n}static setPointer(t,e){t.style.cursor=e}static setTouchAction(t,e){e&&(t.style.touchAction=e)}}class H{static getFilename(t,n,i){if(0===n.length){const n=i.split(".").pop();if(void 0===n)throw new e(`no extension found in url: ${i}, cannot generate other filenames`);const r=(t<10?"0":"")+t.toString();return i.replace(`.${n}`,`_${r}.${n}`)}const r=this.getImagesPath(i),o=this.getImagesPath(n)||r,s=n.lastIndexOf("/")+1;if(-1!==(n=n.substr(s)).toLowerCase().indexOf("xxxx")){if(t<10){const e="000"+t.toString();return`${o}${n.replace("xxxx",e)}`}if(t>9&&t<100){const e="00"+t.toString();return`${o}${n.replace("xxxx",e)}`}if(t>99){const e="0"+t.toString();return`${o}${n.replace("xxxx",e)}`}}if(-1!==n.toLowerCase().indexOf("xxx")){if(t<10){const e="00"+t.toString();return`${o}${n.replace("xxx",e)}`}if(t>9&&t<100){const e="0"+t.toString();return`${o}${n.replace("xxx",e)}`}if(t>99){const e=t.toString();return`${o}${n.replace("xxx",e)}`}}if(-1!==n.toLowerCase().indexOf("xx")){const e=(t<10?"0":"")+t.toString();return`${o}${n.replace("xx",e)}`}if(-1!==n.toLowerCase().indexOf("x")){const e=t.toString();return`${o}${n.replace("x",e)}`}throw new e(`no placeholder x or xx found in format: ${n}`)}static generateImagesUrlsFromFormat(t,e){const n=[],i=e.startFrameNo,r=e.totalFrames,o=e.imageUrlFormat;if(0===t.length)return n;for(let e=i;r>n.length;e++)n.push(this.getFilename(e,o,t));return n}static getPossibleImages(t,e,n,i,o,s){return a=this,c=void 0,h=function*(){return new Promise(((s,a)=>{var c,l;let h=[],d=0;if(o.imageUrls&&o.imageUrls.length>0)h=o.imageUrls,d=o.imageUrls.length;else{d=o.totalFrames;const t=o.imageUrls||[],n=o.mainImageUrl,i=n.length>0?n:e.src;h=t.length>0?t:this.generateImagesUrlsFromFormat(i,o)}const u=o.zoom?o.zoomMax:1;let g=t.clientWidth,m=t.clientHeight,p="";o.autoCDNResizer&&o.zoom&&(null===(c=o.autoCDNResizerConfig)||void 0===c?void 0:c.scaleWithZoomMax)&&(g*=u,m*=u,p=(null===(l=o.autoCDNResizerConfig)||void 0===l?void 0:l.useWidth)?"jsv-width-100":"jsv-height-100");const f=h.map(((t,e)=>{var i,r,s;if(o.autoCDNResizer){const e=new URL(t);if((null===(i=o.autoCDNResizerConfig)||void 0===i?void 0:i.useHeight)&&e.searchParams.set("height",m.toString()),(null===(r=o.autoCDNResizerConfig)||void 0===r?void 0:r.useWidth)&&e.searchParams.set("width",g.toString()),null===(s=o.autoCDNResizerConfig)||void 0===s?void 0:s.extraParams){const t=o.autoCDNResizerConfig.extraParams;for(const n in t)if(Object.prototype.hasOwnProperty.call(t,n)){const i=t[n];e.searchParams.set(n,i)}}t=e.toString()}return{src:t,id:n+e.toString(),sequence:e+1,encoded:"",extraClass:o.extraImageClass+" "+p,alt:o.imageAltText}}));let v=1;h=f.map((t=>t.src)),function(t,e,n){return r(this,void 0,void 0,(function*(){const e=t=>r(this,void 0,void 0,(function*(){return new Promise(((e,i)=>{const r=new Image;r.src=t,r.onload=()=>{r.naturalWidth<10?i(new Error(`image (${t} is smaller then 10 px, probably not exist`)):(n.onSingleImageComplete({result:"",url:t,status:200,naturalWidth:r.naturalWidth,naturalHeight:r.naturalHeight}),e())},r.onerror=()=>{n.onSingleImageFail("failed loading "+t)}}))})),i=t=>r(this,void 0,void 0,(function*(){return Promise.all(t.map(e))}));return new Promise(((e,n)=>{const r=(t=>{const e=[],n=[...t],i=Math.ceil(n.length/10);for(let t=0;t{const s=t.shift();void 0!==s&&i(s).then((()=>{0===r.length?e():o(t)})).catch((t=>{n(t)}))};o(r)}))}))}(h,0,{onSingleImageComplete:t=>{f[h.indexOf(t.url)].encoded="",f[h.indexOf(t.url)].naturalWidth=t.naturalWidth,f[h.indexOf(t.url)].naturalHeight=t.naturalHeight,i.loadImage({currentImage:v,totalImages:d,percentage:Math.round(v/d*100),image:f[v-1]}),v++},onSingleImageFail:t=>{a(new Error(t))}}).then((()=>{v-1===h.length?s(f):a(new Error(`Not all images are loaded ${v-1} from ${h.length}. \n Check the warning to see the image urls we are trying to fetch`))})).catch((t=>{a(t)}))}))},new((l=void 0)||(l=Promise))((function(t,e){function n(t){try{r(h.next(t))}catch(t){e(t)}}function i(t){try{r(h.throw(t))}catch(t){e(t)}}function r(e){var r;e.done?t(e.value):(r=e.value,r instanceof l?r:new l((function(t){t(r)}))).then(n,i)}r((h=h.apply(a,c||[])).next())}));var a,c,l,h}static getMainImage(t,n){const i=n.document.getElementById(t);if(i instanceof HTMLPictureElement){const e=i.querySelector("img");if(e){let n=e.src;return e.hasAttribute("data-src")&&(n=e.getAttribute("data-src")),{src:n,id:t,sequence:0,extraClass:""}}}if(i instanceof HTMLImageElement){let e=i.src;return i.hasAttribute("data-src")&&(e=i.getAttribute("data-src")),{src:e,id:t,sequence:0,extraClass:""}}throw new e(`Could not find main image with id "${t}"`)}static blurMainImage(t,e){const n=e.document.getElementById(t);n instanceof HTMLImageElement&&(n.style.filter="blur(5px)")}static hideReadyNotification(t,e,n){const i="notification_"+e;return T.addHiddenStyle(i,n,700)}static createOrGetPoweredBy(t,e,n,i,r){let o=Math.max(Math.floor(25*Math.random()),5);const s=btoa("powered_by_"+e),a=window.document.getElementById(s);if(a)return a;const c=n.document.createElement("div");c.style.top=`${o}%`,o=Math.max(Math.floor(15*Math.random()),5);const l=o%2==0;c.style[l?"left":"right"]=`${o}%`,c.style.position="absolute",c.style.display="flex",c.style.alignItems="right",c.style.justifyContent="top",c.id=s,c.style.zIndex="200",c.style.width="5%",c.style.minWidth="30px",c.className="jsv-hidden";const h=r?"":window.location.host;return c.innerHTML=N.getPoweredBy(t,h),i.appendChild(c),setTimeout((()=>{T.addShowStyle(s,window,3e3)}),300),c}static createReadyNotification(t,e,n,i){const r=n.document.createElement("div");r.style.position="absolute",r.style.display="flex",r.style.alignItems="center",r.style.justifyContent="center",r.id="notification_"+e,r.style.zIndex="200",r.style.top="50%",r.style.left="50%",r.style.height="20%",r.style.width="20%",r.style.pointerEvents="none",r.style.transform="translate(-50%, -50%)",t.dragToRotate.showStartToRotateDefaultNotification&&(r.innerHTML=N.getReadyForRotate(t)),!t.dragToRotate.showStartToRotateDefaultNotification&&t.dragToRotate.imageUrl.length>0&&(r.innerHTML=N.getNotificationCustomImage(t)),i.appendChild(r)}static createProgressBar(t,e,n,i){const r=e.document.createElement("div");r.style.display="flex",r.style.position="absolute",r.style.height=i.defaultProgressBarHeight,r.style.width="30%",r.style.overflow="hidden",r.style.backgroundColor=i.defaultProgressBarBackgroundColor,r.style.borderRadius="0.25rem",r.id="loader_"+t,r.style.zIndex="200",r.style.top="50%",r.style.left="50%",r.style.transform="translate(-50%, -50%)";const o=e.document.createElement("div");return o.style.backgroundColor=i.defaultProgressBarColor,r.appendChild(o),n.appendChild(r),r}static getImagesPath(t){const e=t.replace(/^.*[\\/]/,"");return t.substring(0,t.length-e.length)}}const z=["textarea","input"],Y=class{constructor(t,e){this.dragStarted=!1,this.pinchFlag=!1,this.datas={},this.isDrag=!1,this.isPinch=!1,this.isMouse=!1,this.isTouch=!1,this.prevClients=[],this.startClients=[],this.movement=0,this.startPinchClients=[],this.startDistance=0,this.customDist=[0,0],this.targets=[],this.prevTime=0,this.isDouble=!1,this.startRotate=0,this.onDragStart=(t,e=!0)=>{if(t.stopPropagation(),!this.dragStarted&&!t.cancelable)return;const{container:n,pinchOutside:i,dragstart:r,preventRightClick:o,preventDefault:s,checkInput:a}=this.options;t instanceof MouseEvent&&t.preventDefault();const c=this.isTouch;if(!this.dragStarted){const e=document.activeElement,n=t.target,i=n.tagName.toLowerCase(),r=z.indexOf(i)>-1,o=n.isContentEditable;if(r||o){if(a||e===n)return!1;if(e&&o&&e.isContentEditable&&e.contains(n))return!1}else if((s||"touchstart"===t.type)&&e){const t=e.tagName;(e.isContentEditable||z.indexOf(t)>-1)&&e.blur()}}let l=0;if(!this.dragStarted&&c&&i&&(l=setTimeout((()=>{k(n,"touchstart",this.onDragStart,{passive:!1})}))),this.dragStarted&&c&&i&&S(n,"touchstart",this.onDragStart),c&&function(t){return t.touches&&t.touches.length>=2}(t)){if(clearTimeout(l),!this.dragStarted&&t.touches.length!==t.changedTouches.length)return;this.pinchFlag||this.onPinchStart(t)}if(this.dragStarted)return;const h=this.startClients[0]?this.startClients:v(t);this.customDist=[0,0],this.dragStarted=!0,this.isDrag=!1,this.startClients=h,this.prevClients=h,this.datas={},this.movement=0;const d=b(h[0],this.prevClients[0],this.startClients[0]);if(t instanceof MouseEvent&&o&&(3===t.which||2===t.button))return clearTimeout(l),this.initDrag(),!1;!1===(r&&r(Object.assign({type:"dragstart",datas:this.datas,inputEvent:t,isTrusted:e},d)))&&(clearTimeout(l),this.initDrag()),this.isDouble=D()-this.prevTime<200,this.dragStarted&&s&&t.preventDefault()},this.onDrag=(t,e)=>{if(t.stopPropagation(),t instanceof MouseEvent&&0===t.buttons)return;if(!this.dragStarted&&1===t.buttons&&t instanceof MouseEvent&&this.onDragStart(t),!this.dragStarted)return;const n=v(t);this.pinchFlag&&this.onPinch(t,n);const i=this.move([0,0],t,n);if(!i||!i.deltaX&&!i.deltaY)return;const r=this.options.drag;r&&r(Object.assign(Object.assign({},i),{isScroll:!!e,inputEvent:t}))},this.onDragEnd=t=>{if(t.stopPropagation(),!this.dragStarted)return;this.dragStarted=!1;const{dragend:e,pinchOutside:n,container:i}=this.options;this.isTouch&&n&&S(i,"touchstart",this.onDragStart),this.pinchFlag&&this.onPinchEnd(t);const r=this.prevClients,o=this.startClients,s=this.pinchFlag?f(r,r,o,this.startPinchClients):b(r[0],r[0],o[0]),a=D(),c=!this.isDrag&&this.isDouble;this.prevTime=this.isDrag||c?0:a,this.startClients=[],this.prevClients=[],e&&e(Object.assign({type:"dragend",datas:this.datas,isDouble:c,isDrag:this.isDrag,inputEvent:t},s))},this.options=Object.assign({checkInput:!1,container:t.length>1?"undefined"!=typeof window?window:new HTMLDivElement:t[0],preventRightClick:!0,preventDefault:!0,pinchThreshold:0},e);const{container:n,events:i}=this.options;if(this.isTouch=i.indexOf("touch")>-1,this.isMouse=i.indexOf("mouse")>-1,this.customDist=[0,0],this.targets=t,this.isMouse&&(k(n,"mousedown",this.onDragStart,{capture:!0}),k(n,"mousemove",this.onDrag,{capture:!0}),k(n,"mouseleave",this.onDragEnd,{capture:!1}),k(n,"mouseup",this.onDragEnd,{capture:!1}),k(n,"contextmenu",this.onDragEnd,{capture:!1})),this.isTouch){const e={passive:!1};t.forEach((t=>{k(t,"touchstart",this.onDragStart,e)})),k(n,"touchmove",this.onDrag,{passive:!0}),k(n,"touchend",this.onDragEnd,e),k(n,"touchcancel",this.onDragEnd,e)}}move([t,e],n,i=this.prevClients){n.stopPropagation();const r=this.customDist,o=this.prevClients,s=this.startClients,a=this.pinchFlag?f(i,o,s,this.startPinchClients):b(i[0],o[0],s[0]);r[0]+=t,r[1]+=e,a.deltaX+=t,a.deltaY+=e;const{deltaX:c,deltaY:l}=a;return a.distX+=r[0],a.distY+=r[1],this.movement+=Math.sqrt(c*c+l*l),this.prevClients=i,this.isDrag=!0,Object.assign(Object.assign({type:"drag",datas:this.datas},a),{movement:this.movement,isDrag:this.isDrag,isPinch:this.isPinch,isScroll:!1,inputEvent:n})}onPinchStart(t){t.stopPropagation();const{pinchstart:e,pinchThreshold:n}=this.options;if(this.isDrag&&this.movement>n)return;const i=x(t.changedTouches);if(this.pinchFlag=!0,this.startClients.push(...i),this.prevClients.push(...i),this.startDistance=y(this.prevClients),this.startPinchClients=[...this.prevClients],!e)return;const r=this.prevClients,o=E(r),s=b(o,o,o);this.startRotate=p(r),e(Object.assign(Object.assign({type:"pinchstart",datas:this.datas,angle:this.startRotate,touches:w(r,r,r)},s),{inputEvent:t}))}onPinch(t,e){if(!this.dragStarted||!this.pinchFlag||e.length<2)return;this.isPinch=!0;const n=this.options.pinch;if(!n)return;const i=this.prevClients,r=this.startClients,o=b(E(e),E(i),E(r)),s=p(e),a=y(e);n(Object.assign(Object.assign({type:"pinch",datas:this.datas,movement:this.movement,angle:s,rotation:s-this.startRotate,touches:w(e,i,r),scale:a/this.startDistance,distance:a},o),{inputEvent:t}))}onPinchEnd(t){if(!this.dragStarted||!this.pinchFlag)return;const e=this.isPinch;this.isPinch=!1,this.pinchFlag=!1;const n=this.options.pinchend;if(!n)return;const i=this.prevClients,r=this.startClients,o=b(E(i),E(i),E(r));n(Object.assign(Object.assign({type:"pinchend",datas:this.datas,isPinch:e,touches:w(i,i,r)},o),{inputEvent:t})),this.isPinch=!1,this.pinchFlag=!1}triggerDragStart(t){this.onDragStart(t,!1)}unset(){const t=this.targets,e=this.options.container;this.isMouse&&(t.forEach((t=>{S(t,"mousedown",this.onDragStart)})),S(e,"mousemove",this.onDrag),S(e,"mouseup",this.onDragEnd),S(e,"contextmenu",this.onDragEnd)),this.isTouch&&(t.forEach((t=>{S(t,"touchstart",this.onDragStart)})),S(e,"touchstart",this.onDragStart),S(e,"touchmove",this.onDrag),S(e,"touchend",this.onDragEnd),S(e,"touchcancel",this.onDragEnd))}initDrag(){this.startClients=[],this.prevClients=[],this.dragStarted=!1}};var O=n(569);const Z={loadImage:(0,O.NI)(),started:(0,O.NI)(),startDragging:(0,O.NI)(),changeImage:(0,O.NI)(),endAutoRotate:(0,O.NI)(),click:(0,O.NI)(),pinch:(0,O.NI)(),scroll:(0,O.NI)(),doubleClick:(0,O.NI)()};class A{constructor(t,e){this.bar=e,this.p=t,this.refresh()}refresh(){this.bar.style.width=`${this.p}%`}update(t){this.p=t,this.refresh()}}var X=function(){return X=Object.assign||function(t){for(var e,n=1,i=arguments.length;n-1&&t.splice(n,1),t.push(e)}function nt(t){for(var e,n=(t=t.slice(0)).pop();e=t.pop();)n={clientX:(e.clientX-n.clientX)/2+n.clientX,clientY:(e.clientY-n.clientY)/2+n.clientY};return n}function it(t){if(t.length<2)return 0;var e=t[0],n=t[1];return Math.sqrt(Math.pow(Math.abs(n.clientX-e.clientX),2)+Math.pow(Math.abs(n.clientY-e.clientY),2))}function rt(t,e){return 1===t.nodeType&&" ".concat(function(t){return(t.getAttribute("class")||"").trim()}(t)," ").indexOf(" ".concat(e," "))>-1}"undefined"!=typeof window&&("function"==typeof window.PointerEvent?U={down:"pointerdown",move:"pointermove",up:"pointerup pointerleave pointercancel"}:"function"==typeof window.TouchEvent&&(U={down:"touchstart",move:"touchmove",up:"touchend touchcancel"}));var ot=/^http:[\w\.\/]+svg$/,st={animate:!1,canvas:!1,cursor:"move",disablePan:!1,disableZoom:!1,disableXAxis:!1,disableYAxis:!1,duration:200,easing:"ease-in-out",exclude:[],excludeClass:"panzoom-exclude",handleStartEvent:function(t){t.preventDefault(),t.stopPropagation()},maxScale:4,minScale:.125,overflow:"hidden",panOnlyWhenZoomed:!1,pinchAndPan:!1,relative:!1,setTransform:function(t,e,n){var i=e.x,r=e.y,o=e.scale,s=e.isSVG;if(L(t,"transform","scale(".concat(o,") translate(").concat(i,"px, ").concat(r,"px)")),s&&j){var a=window.getComputedStyle(t).getPropertyValue("transform");t.setAttribute("transform",a)}},startX:0,startY:0,startScale:1,step:.3,touchAction:"none"};function at(t,e){if(!t)throw new Error("Panzoom requires an element as an argument");if(1!==t.nodeType)throw new Error("Panzoom requires an element with a nodeType of 1");if(!function(t){for(var e=t;e&&e.parentNode;){if(e.parentNode===document)return!0;e=e.parentNode instanceof ShadowRoot?e.parentNode.host:e.parentNode}return!1}(t))throw new Error("Panzoom should be called on elements that have been attached to the DOM");e=X(X({},st),e);var n=function(t){return ot.test(t.namespaceURI)&&"svg"!==t.nodeName.toLowerCase()}(t),i=t.parentNode;i.style.overflow=e.overflow,i.style.userSelect="none",i.style.touchAction=e.touchAction,(e.canvas?i:t).style.cursor=e.cursor,t.style.userSelect="none",t.style.touchAction=e.touchAction,L(t,"transformOrigin","string"==typeof e.origin?e.origin:n?"0 0":"50% 50%");var r,o,s,a,c,l,h=0,d=0,u=1,g=!1;function m(e,n,i){if(!i.silent){var r=new CustomEvent(e,{detail:n});t.dispatchEvent(r)}}function p(e,i,r){var o={x:h,y:d,scale:u,isSVG:n,originalEvent:r};return requestAnimationFrame((function(){"boolean"==typeof i.animate&&(i.animate?function(t,e){var n=W("transform");L(t,"transition","".concat(n," ").concat(e.duration,"ms ").concat(e.easing))}(t,i):L(t,"transition","none")),i.setTransform(t,o,i),m(e,o,i),m("panzoomchange",o,i)})),o}function f(n,i,r,o){var s=X(X({},e),o),a={x:h,y:d,opts:s};if(!s.force&&(s.disablePan||s.panOnlyWhenZoomed&&u===s.startScale))return a;if(n=parseFloat(n),i=parseFloat(i),s.disableXAxis||(a.x=(s.relative?h:0)+n),s.disableYAxis||(a.y=(s.relative?d:0)+i),s.contain){var c=q(t),l=c.elem.width/u,g=c.elem.height/u,m=l*r,p=g*r,f=(m-l)/2,v=(p-g)/2;if("inside"===s.contain){var b=(-c.elem.margin.left-c.parent.padding.left+f)/r,y=(c.parent.width-m-c.parent.padding.left-c.elem.margin.left-c.parent.border.left-c.parent.border.right+f)/r;a.x=Math.max(Math.min(a.x,y),b);var w=(-c.elem.margin.top-c.parent.padding.top+v)/r,x=(c.parent.height-p-c.parent.padding.top-c.elem.margin.top-c.parent.border.top-c.parent.border.bottom+v)/r;a.y=Math.max(Math.min(a.y,x),w)}else"outside"===s.contain&&(b=(-(m-c.parent.width)-c.parent.padding.left-c.parent.border.left-c.parent.border.right+f)/r,y=(f-c.parent.padding.left)/r,a.x=Math.max(Math.min(a.x,y),b),w=(-(p-c.parent.height)-c.parent.padding.top-c.parent.border.top-c.parent.border.bottom+v)/r,x=(v-c.parent.padding.top)/r,a.y=Math.max(Math.min(a.y,x),w))}return s.roundPixels&&(a.x=Math.round(a.x),a.y=Math.round(a.y)),a}function v(n,i){var r=X(X({},e),i),o={scale:u,opts:r};if(!r.force&&r.disableZoom)return o;var s=e.minScale,a=e.maxScale;if(r.contain){var c=q(t),l=c.elem.width/u,h=c.elem.height/u;if(l>1&&h>1){var d=(c.parent.width-c.parent.border.left-c.parent.border.right)/l,g=(c.parent.height-c.parent.border.top-c.parent.border.bottom)/h;"inside"===e.contain?a=Math.min(a,d,g):"outside"===e.contain&&(s=Math.max(s,d,g))}}return o.scale=Math.min(Math.max(n,s),a),o}function b(t,e,i,r){var o=f(t,e,u,i);return h!==o.x||d!==o.y?(h=o.x,d=o.y,p("panzoompan",o.opts,r)):{x:h,y:d,scale:u,isSVG:n,originalEvent:r}}function y(t,e,n){var i=v(t,e),r=i.opts;if(r.force||!r.disableZoom){t=i.scale;var o=h,s=d;if(r.focal){var a=r.focal;o=(a.x/t-a.x/u+h*t)/t,s=(a.y/t-a.y/u+d*t)/t}var c=f(o,s,t,{relative:!1,force:!0});return h=c.x,d=c.y,u=t,p("panzoomzoom",r,n)}}function w(t,n){var i=X(X(X({},e),{animate:!0}),n);return y(u*Math.exp((t?1:-1)*i.step),i)}function x(e,i,r,o){var s=q(t),a=s.parent.width-s.parent.padding.left-s.parent.padding.right-s.parent.border.left-s.parent.border.right,c=s.parent.height-s.parent.padding.top-s.parent.padding.bottom-s.parent.border.top-s.parent.border.bottom,l=i.clientX-s.parent.left-s.parent.padding.left-s.parent.border.left-s.elem.margin.left,h=i.clientY-s.parent.top-s.parent.padding.top-s.parent.border.top-s.elem.margin.top;n||(l-=s.elem.width/u/2,h-=s.elem.height/u/2);var d={x:l/a*(a*e),y:h/c*(c*e)};return y(e,X(X({},r),{animate:!1,focal:d}),o)}y(e.startScale,{animate:!1,force:!0}),setTimeout((function(){b(e.startX,e.startY,{animate:!1,force:!0})}));var R=[];function E(t){if(!function(t,e){for(var n=t;null!=n;n=n.parentNode)if(rt(n,e.excludeClass)||e.exclude.indexOf(n)>-1)return!0;return!1}(t.target,e)){et(R,t),g=!0,e.handleStartEvent(t),r=h,o=d,m("panzoomstart",{x:h,y:d,scale:u,isSVG:n,originalEvent:t},e);var i=nt(R);s=i.clientX,a=i.clientY,c=u,l=it(R)}}function I(t){if(g&&void 0!==r&&void 0!==o&&void 0!==s&&void 0!==a){et(R,t);var n=nt(R),i=R.length>1,h=u;i&&(0===l&&(l=it(R)),x(h=v((it(R)-l)*e.step/80+c).scale,n,{animate:!1},t)),i&&!e.pinchAndPan||b(r+(n.clientX-s)/h,o+(n.clientY-a)/h,{animate:!1},t)}}function C(t){1===R.length&&m("panzoomend",{x:h,y:d,scale:u,isSVG:n,originalEvent:t},e),function(t,e){if(e.touches)for(;t.length;)t.pop();else{var n=tt(t,e);n>-1&&t.splice(n,1)}}(R,t),g&&(g=!1,r=o=s=a=void 0)}var k=!1;function S(){k||(k=!0,Q("down",e.canvas?i:t,E),Q("move",document,I,{passive:!0}),Q("up",document,C,{passive:!0}))}return e.noBind||S(),{bind:S,destroy:function(){k=!1,K("down",e.canvas?i:t,E),K("move",document,I),K("up",document,C)},eventNames:U,getPan:function(){return{x:h,y:d}},getScale:function(){return u},getOptions:function(){return function(t){var e={};for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);return e}(e)},handleDown:E,handleMove:I,handleUp:C,pan:b,reset:function(t){var n=X(X(X({},e),{animate:!0,force:!0}),t);u=v(n.startScale,n).scale;var i=f(n.startX,n.startY,u,n);return h=i.x,d=i.y,p("panzoomreset",n)},resetStyle:function(){i.style.overflow="",i.style.userSelect="",i.style.touchAction="",i.style.cursor="",t.style.cursor="",t.style.userSelect="",t.style.touchAction="",L(t,"transformOrigin","")},setOptions:function(n){for(var r in void 0===n&&(n={}),n)n.hasOwnProperty(r)&&(e[r]=n[r]);(n.hasOwnProperty("cursor")||n.hasOwnProperty("canvas"))&&(i.style.cursor=t.style.cursor="",(e.canvas?i:t).style.cursor=e.cursor),n.hasOwnProperty("overflow")&&(i.style.overflow=n.overflow),n.hasOwnProperty("touchAction")&&(i.style.touchAction=n.touchAction,t.style.touchAction=n.touchAction)},setStyle:function(e,n){return L(t,e,n)},zoom:y,zoomIn:function(t){return w(!0,t)},zoomOut:function(t){return w(!1,t)},zoomToPoint:x,zoomWithWheel:function(t,n){t.preventDefault();var i=X(X(X({},e),n),{animate:!1}),r=(0===t.deltaY&&t.deltaX?t.deltaX:t.deltaY)<0?1:-1;return x(v(u*Math.exp(r*i.step/3),i).scale,t,i,t)}}}at.defaultOptions=st;class ct{constructor(t,e,n,i){this.panzoomLoaded=!1,this.currentZoomScale=1,this.previousPinchDistance=0,this.screenX=0,this.screenY=0,this.window=t,this.images=e,this.mainHolderElement=n,this.zoomMax=i,this.initPanZoom()}initPanZoom(){this.images.forEach(((t,e)=>{var n;const i=null===(n=this.window)||void 0===n?void 0:n.document.getElementById(`${t.id}`);i&&(this.images[e].pz=this.getMobilePanzoom(i))})),this.panzoomLoaded=!0}handleZoom(t,e,n,i,r=!1){let o=!1;this.currentZoomScale<1&&t<0||this.currentZoomScale+t>this.zoomMax&&t>0||(this.currentZoomScale+=t,this.currentZoomScale<1.3&&t<0&&(e=0,n=0,o=!0,r=!0,this.previousPinchDistance=0,this.currentZoomScale=1),(r?this.images:[i]).forEach((t=>{var i,r;o?null===(r=t.pz)||void 0===r||r.reset({animate:!0}):null===(i=t.pz)||void 0===i||i.zoom(this.currentZoomScale,{animate:!0,focal:{x:e,y:n}})})))}handlePan(t,e){this.images.forEach((n=>{var i;null===(i=n.pz)||void 0===i||i.pan(t,e,{relative:!0,animate:!1})}))}getMobilePanzoom(t){return at(t,{cursor:"",maxScale:this.zoomMax,minScale:1,startX:0,startY:0,animate:!1,canvas:!1,noBind:!0,disablePan:!1,easing:"ease",panOnlyWhenZoomed:!0,touchAction:""})}getRelativePosition(t,e){var n;let i=0,r=0;const o=null===(n=this.mainHolderElement)||void 0===n?void 0:n.getBoundingClientRect();if(o){const n=this.window.scrollX+(null==o?void 0:o.left),s=this.window.scrollY+(null==o?void 0:o.top);return i=Math.round(t-n-o.width/2),r=Math.round(e-s-(o.height-o.height/2)),[i*this.currentZoomScale*2,r*this.currentZoomScale*2]}return[i,r]}pinch(t,e){var n;if(!this.panzoomLoaded)return;t.originalEvent.cancelBubble=!0;const i=null===(n=this.mainHolderElement)||void 0===n?void 0:n.getBoundingClientRect(),r=Math.sqrt(i.width*i.width+i.height*i.height),o=t.scale/r;if(t.first||0===this.previousPinchDistance)return void(this.previousPinchDistance=o);this.screenX=(t.originalEvent.targetTouches[0].pageX+t.originalEvent.targetTouches[1].pageX)/2,this.screenY=(t.originalEvent.targetTouches[0].pageY+t.originalEvent.targetTouches[1].pageY)/2;let s=o-this.previousPinchDistance;s*=4;const[a,c]=this.getRelativePosition(this.screenX,this.screenY);this.handleZoom(s,a,c,e),this.previousPinchDistance=o}scroll(t,e,n){let i=t.originalEvent.deltaY>0?-1:1;i*=e/100;const r=t.originalEvent,[o,s]=this.getRelativePosition(r.pageX,r.pageY);this.handleZoom(i,o,s,n)}isZoomed(){return this.currentZoomScale>1}pan(t,e){this.handlePan(t,e)}reset(t){this.handleZoom(-1*(this.currentZoomScale-1),0,0,t,!0)}zoomOnPage(t,e,n,i){if(t>this.zoomMax)return;const[r,o]=this.getRelativePosition(e,n);this.handleZoom(t-this.currentZoomScale,r,o,i)}zoom(t,e,n,i){var r,o;if(t>this.zoomMax)return;const s=this.window.document.getElementById(i.id);if(s){this.currentZoomScale=t;const a=0!==e?e*s.clientWidth/this.currentZoomScale:0,c=0!==n?n*s.clientHeight/this.currentZoomScale:0;null===(r=i.pz)||void 0===r||r.pan(a,c,{animate:!0}),null===(o=i.pz)||void 0===o||o.zoom(this.currentZoomScale,{animate:!0})}}}class lt{static _0x1a2(t,e){e=e.toLowerCase().split("").reverse().join("");const n=parseInt(t.charAt(0),10),i=t.split("=="),r=parseInt(i[0].charAt(i[0].length-1),10);return i[0].substr(1,i[0].length-2)===this._0x3a(e,2*r)&&n+r===10}static _0x3a(t,e){const n="abcdefghijklmnopqrstuvwxyz";let i="";e>26&&(e%=26);for(let r=0;r=26&&(t-=26),i+=n.charAt(t)}}return i}}var ht=function(t,e,n,i){return new(n||(n=Promise))((function(r,o){function s(t){try{c(i.next(t))}catch(t){o(t)}}function a(t){try{c(i.throw(t))}catch(t){o(t)}}function c(t){var e;t.done?r(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}c((i=i.apply(t,e||[])).next())}))};const dt={license:"",useReferrerAsHost:!1,mainImageId:"jsv-image",mainHolderId:"jsv-holder",mainImageUrl:"",totalFrames:72,imageUrls:[],speed:80,inertia:20,defaultProgressBar:!0,defaultProgressBarColor:"rgb(0, 0, 0)",defaultProgressBarBackgroundColor:"rgba(255, 255, 255, 0.5)",defaultProgressBarHeight:"5px",firstImageNumber:1,imageUrlFormat:"",startFrameNo:1,reverse:!1,autoRotate:0,autoRotateSpeed:0,autoRotateReverse:!1,enableImageEvents:!1,zoom:!1,zoomWheelSpeed:50,zoomMax:2,stopAtEdges:!1,enableChangeImageEvent:!1,cursorConfig:{default:"grab",drag:"grabbing",zoomIn:"zoom-in",zoomOut:"zoom-out",pan:"move"},touchConfig:{default:"pan-y",drag:"pan-y",zoomIn:"pan-x",zoomOut:"pan-x",pan:"pan-x"},autoCDNResizer:!1,autoCDNResizerConfig:{useWidth:!0,useHeight:!1,scaleWithZoomMax:!1,extraParams:{}},notificationConfig:{dragToRotate:{showStartToRotateDefaultNotification:!1,imageUrl:"",languages:[],mainColor:"rgba(0,0,0,0.20)",textColor:"rgba(243,237,237,0.80)"}},extraImageClass:"",id:"",imageAltText:void 0};class ut{constructor(t){this.isStarted=!1,this.isDragged=!1,this.images=[],this.currentImageNumber=1,this.previousImageNumber=1,this.desiredRotationInDegrees=0,this.mainImage=null,this.mainHolderElement=null,this.uniqueId="",this.currentDegree=0,this.currentSpeed=0,this.inAnimation=!1,this.desiredRotationInDegreesStartSlowingDown=null,this.useEasing=!0,this.updateInAction=!1,this.window=null,this.startDragInvocations=0,this.firstDrag=!1,this.standbyRefreshRate=40,this.previousTargetDegree=null,this.nAutoRotations=0,this.dragAllowed=!0,this.currentPointer="default",this.currentTouch="default",this.zoomPointerTimeout=null,this.unsubscribe=null,this.zoom=null,this.eventBus=this.initEventBus(),this.window="undefined"!=typeof window?window:null,this.options=t,this.runningInBrowser()}loadConfig(t,e,n){return new Promise(((i,r)=>{if(!t||t.length<10||!e&&n&&"file:"!==n)i({config:"",watermark:!0});else{const n=new XMLHttpRequest,o=`https://config.3dweb.io/${t=null==t?void 0:t.trim()}`;n.onreadystatechange=function(){if(4===this.readyState&&200===this.status){const e=JSON.parse(this.responseText);if(null!==e.config)return i(e);r(new Error(`could not find a presentation with id ${t}`))}else if(0!==this.status&&200!==this.status)switch(this.status){case 404:r(new Error(`could not find a presentation with id ${t}`));break;case 403:r(new Error(`you do not have access to presentation with id ${t}`));break;default:r(new Error(`could not load presentation with id ${t}`))}},n.open("GET",o,!0),n.setRequestHeader("3dweb-host",e),n.send()}}))}initEventBus(){return(0,O.lV)({events:Z,channels:[]})}runningInBrowser(){return"undefined"!=typeof window}events(){return this.eventBus}setSpeed(t){this.currentSpeed=t>999||t<-999?999:t}setId(t){return this.options.id=t,this.options.imageUrls=[],this.destroy().then((()=>this.start())).catch((t=>{console.error(t)}))}setInertia(t){this.options.inertia=t>99?99:t<1?1:t}initProgressBar(){if(this.options.defaultProgressBar){this.options.mainImageId&&H.blurMainImage(this.options.mainImageId,this.window);const t=H.createProgressBar(this.uniqueId,this.window,this.mainHolderElement,this.options),e=new A(0,t.firstChild);this.eventBus.loadImage.on((t=>{e.update(t.percentage)})),this.eventBus.started.on((()=>{t.style.display="none"}))}}documentIsReady(){return"complete"===this.window.document.readyState}isB(){const t=new RegExp(atob("KGdvb2dsZWJvdC98Ym90fEdvb2dsZWJvdC1Nb2JpbGV8R29vZ2xlYm90LUltYWdlfEdvb2dsZSBmYXZpY29ufE1lZGlhcGFydG5lcnMtR29vZ2xlfGJpbmdib3R8c2x1cnB8amF2YXx3Z2V0fGN1cmx8Q29tbW9ucy1IdHRwQ2xpZW50fFB5dGhvbi11cmxsaWJ8bGlid3d3fGh0dHB1bml0fG51dGNofHBocGNyYXdsfG1zbmJvdHxqeXhvYm90fEZBU1QtV2ViQ3Jhd2xlcnxGQVNUIEVudGVycHJpc2UgQ3Jhd2xlcnxiaWdsb3Ryb258dGVvbWF8Y29udmVyYXxzZWVrYm90fGdpZ2FibGFzdHxleGFib3R8bmdib3R8aWFfYXJjaGl2ZXJ8R2luZ2VyQ3Jhd2xlcnx3ZWJtb24gfGh0dHJhY2t8d2ViY3Jhd2xlcnxncnViLm9yZ3xVc2luZU5vdXZlbGxlQ3Jhd2xlcnxhbnRpYm90fG5ldHJlc2VhcmNoc2VydmVyfHNwZWVkeXxmbHVmZnl8YmlibnVtLmJuZnxmaW5kbGlua3xtc3Jib3R8cGFuc2NpZW50fHlhY3lib3R8QUlTZWFyY2hCb3R8SU9JfGlwcy1hZ2VudHx0YWdvb2JvdHxNSjEyYm90fGRvdGJvdHx3b3Jpb2JvdHx5YW5nYXxidXp6Ym90fG1sYm90fHlhbmRleGJvdHxwdXJlYm90fExpbmd1ZWUgQm90fFZveWFnZXJ8Q3liZXJQYXRyb2x8dm9pbGFib3R8YmFpZHVzcGlkZXJ8Y2l0ZXNlZXJ4Ym90fHNwYm90fHR3ZW5nYWJvdHxwb3N0cmFua3x0dXJuaXRpbmJvdHxzY3JpYmRib3R8cGFnZTJyc3N8c2l0ZWJvdHxsaW5rZGV4fEFkaWR4Ym90fGJsZWtrb2JvdHxlem9vbXN8ZG90Ym90fE1haWwuUlVfQm90fGRpc2NvYm90fGhlcml0cml4fGZpbmR0aGF0ZmlsZXxldXJvcGFyY2hpdmUub3JnfE5lcmRCeU5hdHVyZS5Cb3R8c2lzdHJpeCBjcmF3bGVyfGFocmVmc2JvdHxBYm91bmRleHxkb21haW5jcmF3bGVyfHdic2VhcmNoYm90fHN1bW1pZnl8Y2Nib3R8ZWRpc3RlcmJvdHxzZXpuYW1ib3R8ZWMybGlua2ZpbmRlcnxnc2xmYm90fGFpaGl0Ym90fGludGVsaXVtX2JvdHxmYWNlYm9va2V4dGVybmFsaGl0fHlldGl8UmV0cmV2b1BhZ2VBbmFseXplcnxsYi1zcGlkZXJ8c29nb3V8bHNzYm90fGNhcmVlcmJvdHx3b3Rib3h8d29jYm90fGljaGlyb3xEdWNrRHVja0JvdHxsc3Nyb2NrZXRjcmF3bGVyfGRydXBhY3R8d2ViY29tcGFueWNyYXdsZXJ8YWNvb25ib3R8b3BlbmluZGV4c3BpZGVyfGduYW0gZ25hbSBzcGlkZXJ8d2ViLWFyY2hpdmUtbmV0LmNvbS5ib3R8YmFja2xpbmtjcmF3bGVyfGNvY2NvY3xpbnRlZ3JvbWVkYnxjb250ZW50IGNyYXdsZXIgc3BpZGVyfHRvcGxpc3Rib3R8c2Vva2lja3Mtcm9ib3R8aXQybWVkaWEtZG9tYWluLWNyYXdsZXJ8aXAtd2ViLWNyYXdsZXIuY29tfHNpdGVleHBsb3Jlci5pbmZvfGVsaXNhYm90fHByb3hpbWljfGNoYW5nZWRldGVjdGlvbnxibGV4Ym90fGFyYWJvdHxXZVNFRTpTZWFyY2h8bmlraS1ib3R8Q3J5c3RhbFNlbWFudGljc0JvdHxyb2dlcmJvdHwzNjBTcGlkZXJ8cHNib3R8SW50ZXJmYXhTY2FuQm90fExpcHBlcmhleSBTRU8gU2VydmljZXxDQyBNZXRhZGF0YSBTY2FwZXJ8ZzAwZzFlLm5ldHxHcmFwZXNob3RDcmF3bGVyfHVybGFwcGVuZGJvdHxicmFpbm9ib3R8ZnItY3Jhd2xlcnxiaW5sYXJ8U2ltcGxlQ3Jhd2xlcnxMaXZlbGFwYm90fFR3aXR0ZXJib3R8Y1hlbnNlYm90fHNtdGJvdHxibmYuZnJfYm90fEE2LUluZGV4ZXJ8QURtYW50WHxGYWNlYm90fFR3aXR0ZXJib3R8T3JhbmdlQm90fG1lbW9yeWJvdHxBZHZCb3R8TWVnYUluZGV4fFNlbWFudGljU2Nob2xhckJvdHxsdHg3MXxuZXJkeWJvdHx4b3ZpYm90fEJVYmlOR3xRd2FudGlmeXxhcmNoaXZlLm9yZ19ib3R8QXBwbGVib3R8VHdlZXRtZW1lQm90fGNyYXdsZXI0anxmaW5keGJvdHxTZW1ydXNoQm90fHlvb3pCb3R8bGlwcGVyaGV5fHkhai1hc3J8RG9tYWluIFJlLUFuaW1hdG9yIEJvdHxBZGRUaGlzKQ=="),"i"),e=this.window.navigator.userAgent;return t.test(e)}isL(){const t=this.window.location.hostname,e=this.window.location.port;return Boolean(-1!==t.indexOf("dev.")||-1!==t.indexOf("beta.")||-1!==t.indexOf("file")||""!==e||"localhost"===t||"[::1]"===t||t.match(/^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/))}isV(){let t=this.window.location.host;if(this.options.useReferrerAsHost){const e=this.window.document.referrer;e.length>0&&(t=new URL(e).host)}return lt._0x1a2(this.options.license,t)}getFirstImageIndex(){return this.options.firstImageNumber&&this.options.firstImageNumber>0&&this.options.firstImageNumber-1{try{if(this.isStarted){const e=this.window.document.getElementById(this.uniqueId);if(e&&T.removeElement(e),this.options.defaultProgressBar){const t=this.window.document.getElementById("loader_"+this.uniqueId);T.removeElement(t);const e=this.window.document.getElementById("link_"+this.uniqueId);T.removeElement(e)}if(this.options.notificationConfig.dragToRotate.showStartToRotateDefaultNotification||this.options.notificationConfig.dragToRotate.imageUrl.length>0){const t=this.window.document.getElementById("notification_"+this.uniqueId);T.removeElement(t)}T.showImage(this.mainImage,this.window),this.mainHolderElement.outerHTML=this.mainHolderElement.outerHTML,this.isStarted=!1,this.images=[],this.mainImage=null,this.mainHolderElement=null,this.firstDrag=!1,this.eventBus=this.initEventBus(),t(!0)}else t(!1)}catch(t){let n="error with destroying viewer";t instanceof Error&&(n+=t.toString()),e(n)}}))}))}start(){return ht(this,void 0,void 0,(function*(){if(this.documentIsReady())return new Promise(((t,e)=>{const n=this.window.location.host,i=this.window.location.protocol,r=JSON.parse(JSON.stringify(this.options));this.options=P({objects:[dt,this.options]}),this.options.id?this.loadConfig(this.options.id,n,i).then((n=>{const i=JSON.parse(n.config);this.options=P({objects:[dt,i,r]}),this.currentSpeed=this.options.speed,this.options.totalFrames=this.getTotalFrames(),this.startPresentation().then(t).catch(e)})).catch((t=>{this.handleError(t,e)})):(this.currentSpeed=this.options.speed,this.options.totalFrames=this.getTotalFrames(),this.startPresentation().then(t).catch(e))}));yield new Promise((t=>{setTimeout((()=>{t()}),200)})).then((()=>this.start()))}))}startPresentation(){return ht(this,void 0,void 0,(function*(){return new Promise(((t,e)=>{try{if(this.isStarted&&e(`Viewer ${this.uniqueId} already started`),this.runningInBrowser()||e(`Viewer ${this.uniqueId} not started in browser`),T.addStyles(this.window),this.registerStartEvents(),this.registerInputEvents(),this.mainImage=H.getMainImage(this.options.mainImageId,this.window),this.mainHolderElement=T.getMainHolderElement(this.options.mainHolderId,this.window),!this.isB()||this.isL()||this.isV()||T.createLink(this.window,this.mainHolderElement),!this.isV()&&!this.isL()){const t=JSON.parse(JSON.stringify(this.options.notificationConfig));t.dragToRotate.mainColor="rgb(255 ,255,255)",t.dragToRotate.textColor="rgb(55, 25, 2)",this.eventBus.startDragging.on((({invocations:e})=>{if(e>=2){clearTimeout(this.pbto);const e=H.createOrGetPoweredBy(t,this.uniqueId,this.window,this.mainHolderElement,this.isL());null!==e&&(this.pbto=setTimeout((()=>{T.addHiddenStyle(e.id,this.window,3e3).then((()=>{T.removeElement(e)}))}),5e3))}}))}this.uniqueId=this.uniqueId||"_"+Math.random().toString(36).substr(2,9),this.initProgressBar(),this.getImages().then((n=>ht(this,void 0,void 0,(function*(){this.images=n;const i=T.getImageHolderElement(this.window,this.mainHolderElement,this.uniqueId,n,this.options);this.prepareImageHolder(i).then((()=>(this.mainHolderElement.appendChild(i),T.hideImageSlow(this.mainImage.id,this.window).then((()=>{this.inAnimation||(T.showImage(this.images[this.getFirstImageIndex()],this.window),this.currentImageNumber=this.options.firstImageNumber||1,this.previousImageNumber=this.options.firstImageNumber||1,this.setCurrentDegree(this.currentImageNumber)),this.isStarted=!0,this.eventBus.started(!0),t()})).catch((t=>{this.handleError(t,e)}))))).catch((t=>{this.handleError(t,e)}))})))).catch((t=>{this.handleError(t,e)}))}catch(t){this.handleError(t,e)}}))}))}handleError(t,e){let n="unknown error";t instanceof Error&&(n=t.toString(),this.reportError(n),this.destroy().then((()=>{e(t.toString())})).catch((t=>{this.reportError(t)}))),e(n)}registerInputEvents(){this.eventBus.pinch.on((t=>this.onPinchListener(t))),this.eventBus.doubleClick.on((t=>this.onDoubleClickListener(t))),this.eventBus.scroll.on((t=>this.onScrollListener(t)))}startDragToRotateNotification(){H.createReadyNotification(this.options.notificationConfig,this.uniqueId,this.window,this.mainHolderElement)}hideDragToRotateNotification(){this.unsubscribe(),this.options.zoom&&this.zoomUnsubscribe(),H.hideReadyNotification(this.options.notificationConfig,this.uniqueId,this.window).then((()=>{const t=this.window.document.getElementById("notification_"+this.uniqueId);T.removeElement(t)}))}registerStartEvents(){(this.options.notificationConfig.dragToRotate.showStartToRotateDefaultNotification||this.options.notificationConfig.dragToRotate.imageUrl.length>0)&&(this.eventBus.started.on((()=>this.startDragToRotateNotification())),this.unsubscribe=this.eventBus.startDragging.on((()=>this.hideDragToRotateNotification())),this.options.zoom&&(this.zoomUnsubscribe=this.eventBus.pinch.on((()=>this.hideDragToRotateNotification())),this.zoomUnsubscribe=this.eventBus.scroll.on((()=>this.hideDragToRotateNotification())))),this.options.zoom&&this.eventBus.started.on((t=>this.registerZoom(t))),this.options.autoRotate>0&&this.eventBus.started.on((t=>this.runAutoRotate(t)))}runAutoRotate(t){t?this.autoRotate(this.options.autoRotate).then((t=>{this.eventBus.endAutoRotate({currentDegree:this.currentDegree,currentImage:this.images[this.currentImageNumber-1],completed:t})})).catch((t=>{this.reportError(t)})):this.destroy().then((()=>{this.reportWarning("Failed starting autorotate")})).catch((t=>this.reportError(t)))}registerZoom(t){t&&(this.zoom=new ct(this.window,this.images,this.mainHolderElement,this.options.zoomMax))}onPinchListener(t){var e;this.options.zoom&&(this.dragAllowed=!1,null===(e=this.zoom)||void 0===e||e.pinch(t,this.images[this.currentImageNumber-1]),setTimeout((()=>{this.dragAllowed=!0}),1e3))}onDoubleClickListener(t){var e,n;this.options.zoom&&(null===(e=this.zoom)||void 0===e?void 0:e.isZoomed())&&(null===(n=this.zoom)||void 0===n||n.reset(this.images[this.currentImageNumber-1]),this.setPointer("default"))}onScrollListener(t){var e,n;if(this.options.zoom){this.cancelCurrentActions(),this.zoomPointerTimeout&&clearTimeout(this.zoomPointerTimeout),null===(e=this.zoom)||void 0===e||e.scroll(t,this.options.zoomWheelSpeed,this.images[this.currentImageNumber-1]);const i=t.originalEvent.deltaY;(null===(n=this.zoom)||void 0===n?void 0:n.isZoomed())?(i<0?this.setPointer("zoomIn"):this.setPointer("zoomOut"),this.zoomPointerTimeout=this.window.setTimeout((()=>{this.setPointer("pan")}),500)):this.setPointer("default")}}prepareImageHolder(t){return ht(this,void 0,void 0,(function*(){const e=[],n=(t,e)=>ht(this,void 0,void 0,(function*(){return new Promise(((n,i)=>{const r=[];for(let n=0;nn(t))).catch((t=>i(t)))}))})),i=(n,i)=>{(this.options.zoom||this.options.enableImageEvents)&&this.addZoomEvents(n),e.push(n),this.images[i].encoded="",t.appendChild(n)},r=(t,e)=>new Promise(((n,r)=>{const o=T.getImageElement(t,this.window);o instanceof HTMLImageElement?o.decode().then((()=>{i.call(this,o,e),n(!0)})).catch((()=>{i.call(this,o,e),n(!1)})):r("could not find element with id "+t.id)})),o=()=>{var t,n;(this.options.zoom||this.options.enableImageEvents)&&(null===(t=this.mainHolderElement)||void 0===t||t.addEventListener("wheel",this.onScroll.bind(this),{passive:!1}),null===(n=this.mainHolderElement)||void 0===n||n.addEventListener("dblclick",this.onDoubleClick.bind(this),{passive:!0})),new Y(e,{container:this.mainHolderElement,dragstart:this.dragStart.bind(this),dragend:this.dragEnd.bind(this),drag:this.drag.bind(this),preventDefault:!1,events:["mouse","touch"]})};return new Promise(((t,e)=>{n(this.images,r).then((()=>{o(),t()})).catch((t=>{e(t)}))}))}))}addZoomEvents(t){t.addEventListener("click",this.onClick.bind(this)),this.onScale(t,((t,e,n)=>{t>.5&&this.events().pinch({completed:!0,currentImage:this.images[this.currentImageNumber-1],currentDegree:this.currentDegree,originalEvent:n,scale:t,first:e})}))}setPointer(t){if(this.currentPointer!==t){const e=this.options.cursorConfig[t];this.currentPointer=t,T.setPointer(this.mainHolderElement,e)}const e=this.options.touchConfig[t];this.currentTouch!==e&&(this.currentTouch=e,T.setTouchAction(this.mainHolderElement,e))}onScale(t,e){let n,i=!0,r=0,o=!1;t.addEventListener("touchmove",(function(t){if(2===t.targetTouches.length){const r=Math.hypot(t.targetTouches[0].pageX-t.targetTouches[1].pageX,t.targetTouches[0].pageY-t.targetTouches[1].pageY);o=!0,e(r,i,t),void 0===n&&(n=r,i=!1)}}),{capture:!1,passive:!0}),t.addEventListener("touchend",(t=>{var e,s;if(n=void 0,i=!0,(null===(e=this.zoom)||void 0===e?void 0:e.isZoomed())&&!o){const t=(new Date).getTime(),e=t-r;clearTimeout(void 0),e<500&&e>0&&(null===(s=this.zoom)||void 0===s||s.reset(this.images[this.currentImageNumber-1])),r=t}o=!1}),{capture:!1,passive:!0})}onClick(t){this.events().click({currentDegree:this.currentDegree,currentImage:this.images[this.currentImageNumber-1],completed:!0,originalEvent:t})}onScroll(t){t.preventDefault(),this.events().scroll({currentDegree:this.currentDegree,currentImage:this.images[this.currentImageNumber-1],completed:!0,originalEvent:t})}onDoubleClick(t){this.events().doubleClick({currentDegree:this.currentDegree,currentImage:this.images[this.currentImageNumber-1],completed:!0,originalEvent:t})}reportError(t){console.error(`360 Javascript Viewer: ${t}`)}reportWarning(t){console.warn(`360 Javascript Viewer: ${t}`)}updateImage(){if(this.updateInAction=!0,0===this.desiredRotationInDegrees)return this.inAnimation=!1,this.updateInAction=!1,this.desiredRotationInDegreesStartSlowingDown=null,new Promise((t=>{t({currentDegree:this.currentDegree})}));const t=this.getNextImageNumber();if(this.options.stopAtEdges&&!this.inAnimation){const e=this.images.length,n=1;if(this.previousImageNumber===n&&t===e||this.previousImageNumber===e&&t===n)return this.updateInAction=!1,new Promise((t=>{t({currentDegree:this.currentDegree})}))}return this.setCurrentImage(t),(e=this.getCurrentRefreshRate(),new Promise((t=>setTimeout(t,e)))).then((()=>this.updateImage()));var e}zoomTo(t,e,n){return new Promise(((i,r)=>{var o,s;if(this.options.zoom){t>this.options.zoomMax&&r(`supplied zoom factor ${t} higher then max zoom of ${this.options.zoomMax}`);const a=this.images[this.currentImageNumber-1];null===(o=this.zoom)||void 0===o||o.reset(a),null===(s=this.zoom)||void 0===s||s.zoom(t,e,n,a),this.setPointer(t>1?"zoomIn":"zoomOut"),i()}else r("zoom not activated")}))}rotateDegrees(t){return this.inAnimation=!0,this.desiredRotationInDegrees=t,this.updateImage()}resetZoom(){return new Promise(((t,e)=>{var n;this.options.zoom||e("zoom is not activated"),null===(n=this.zoom)||void 0===n||n.reset(this.images[this.currentImageNumber-1]),this.setPointer("default"),setTimeout((()=>{t()}),500)}))}isZoomedIn(){var t;return!!this.options.zoom&&!!this.zoom&&(null===(t=this.zoom)||void 0===t?void 0:t.isZoomed())}rotateToFrame(t,e=!0,n=!0){const i=360/this.options.totalFrames*(t-1);return this.rotateToDegree(i,e,n)}rotateToDegree(t,e=!0,n=!0){if(this.inAnimation=!0,this.cancelCurrentActions(),this.useEasing=n,this.desiredRotationInDegrees=0,t=Math.round(t),this.previousTargetDegree===t||t===this.currentDegree)return this.useEasing=!0,new Promise((t=>{t({currentDegree:this.currentDegree})}));this.inAnimation=!0;const i=t>this.currentDegree?t-this.currentDegree:360-this.currentDegree+t,r=tMath.abs(t.deltaX))return;if(!this.dragAllowed)return!1;if(this.window.TouchEvent&&t instanceof TouchEvent&&2===t.touches.length)return!1;const r=this.getDegreesOneImage();let o=t.deltaX/(null===(i=this.mainHolderElement)||void 0===i?void 0:i.clientWidth)*this.getTotalFrames()*r;return o=this.options.speed/100*o,this.options.reverse||(o*=-1),this.desiredRotationInDegrees+=o,this.updateInAction||this.updateImage(),this.setPointer("drag"),this.firstDrag&&(this.startDragInvocations++,this.eventBus.startDragging({invocations:this.startDragInvocations}),this.firstDrag=!1),this.isDragged}dragStart(){var t;this.dragAllowed&&(this.options.zoom&&(null===(t=this.zoom)||void 0===t?void 0:t.isZoomed())||(this.isDragged=!0,this.firstDrag=!0,this.setPointer("drag"),this.cancelCurrentActions()))}getNextImageNumber(){const t=this.images.length,e=this.getDegreesOneImage();let n=this.currentImageNumber;return Math.abs(this.desiredRotationInDegrees)0?this.increaseImageNumber(n,t):this.decreaseImageNumber(n,t),this.decreaseDesiredRotation(e),n)}getDegreesOneImage(){const t=this.images.length;return Math.round(360/t)}setCurrentDegree(t){const e=this.getDegreesOneImage();this.currentDegree=1===t?0:(t-1)*e}decreaseImageNumber(t,e){return--t<1?e:t}increaseImageNumber(t,e){return++t>e?1:t}decreaseDesiredRotation(t){t=Math.abs(t),this.desiredRotationInDegrees<0?this.desiredRotationInDegrees+=t:this.desiredRotationInDegrees-=Math.abs(t)}setCurrentImage(t){t!==this.previousImageNumber&&this.isStarted&&(-1!==this.previousImageNumber&&T.hideImage(this.images[this.previousImageNumber-1],this.window),T.showImage(this.images[t-1],this.window),this.previousImageNumber=t,this.currentImageNumber=t,this.setCurrentDegree(t),this.options.enableChangeImageEvent&&this.events().changeImage({currentImage:this.images[t-1],currentDegree:this.currentDegree,completed:!0}))}viewerHasNoAction(){return!this.isDragged}getImages(){return ht(this,void 0,void 0,(function*(){return H.getPossibleImages(this.mainHolderElement,this.mainImage,this.uniqueId,this.eventBus,this.options,this.window)}))}getTotalFrames(){if(this.options.imageUrls&&this.options.imageUrls.length>0)return this.options.imageUrls.length;const t=this.options.totalFrames;if(t>0&&t<=360)return t;throw new e(`totalFrames must be between 1 and 360 now ${t}`)}speedToRefreshRate(t){return(100-t)/2}getCurrentRefreshRate(){if(0===this.desiredRotationInDegrees)return this.standbyRefreshRate;if(this.viewerHasNoAction()&&this.useEasing){this.desiredRotationInDegreesStartSlowingDown||(this.desiredRotationInDegreesStartSlowingDown=Math.abs(this.desiredRotationInDegrees));let t=(1-(1-Math.abs(this.desiredRotationInDegrees)/this.desiredRotationInDegreesStartSlowingDown))*this.currentSpeed;return t=(100-this.options.inertia)/100*t,this.speedToRefreshRate(t)}return this.speedToRefreshRate(this.currentSpeed)}autoRotate(t){return ht(this,void 0,void 0,(function*(){this.nAutoRotations=t;const e=e=>ht(this,void 0,void 0,(function*(){let n=0;for(n=0;n{e(n===t-1)}))}));return new Promise(((n,i)=>{this.useEasing=!1;const r=this.options.autoRotateSpeed!==this.options.speed;r&&this.setSpeed(this.options.autoRotateSpeed),e(r).then((()=>{r&&this.setSpeed(this.options.speed),this.useEasing=!0,this.nAutoRotations===t?n(!0):n(!1)})).catch((t=>{this.reportError(t),i()}))}))}))}}})(),i})()));