2 lines
52 KiB
JavaScript
2 lines
52 KiB
JavaScript
|
/*! For license information please see main.js.LICENSE.txt */
|
||
|
(()=>{"use strict";var t={d:(i,e)=>{for(var s in e)t.o(e,s)&&!t.o(i,s)&&Object.defineProperty(i,s,{enumerable:!0,get:e[s]})},o:(t,i)=>Object.prototype.hasOwnProperty.call(t,i),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},i={};function e(t,i,e){const s=document.createElement(i||"div");return t&&(s.className=t),e&&e.appendChild(s),s}function s(t,i){return t.x=i.x,t.y=i.y,void 0!==i.id&&(t.id=i.id),t}function o(t){t.x=Math.round(t.x),t.y=Math.round(t.y)}function n(t,i){const e=Math.abs(t.x-i.x),s=Math.abs(t.y-i.y);return Math.sqrt(e*e+s*s)}function a(t,i){return t.x===i.x&&t.y===i.y}function r(t,i,e){return Math.min(Math.max(t,i),e)}function h(t,i,e){let s="translate3d("+t+"px,"+(i||0)+"px,0)";return void 0!==e&&(s+=" scale3d("+e+","+e+",1)"),s}function l(t,i,e,s){t.style.transform=h(i,e,s)}function p(t,i,e,s){t.style.transition=i?i+" "+e+"ms "+(s||"cubic-bezier(.4,0,.22,1)"):"none"}function c(t,i,e){t.style.width="number"==typeof i?i+"px":i,t.style.height="number"==typeof e?e+"px":e}t.r(i),t.d(i,{HTMLSlide:()=>w,ImageSlide:()=>f,Slide:()=>v,default:()=>Y});let d=!1;try{window.addEventListener("test",null,Object.defineProperty({},"passive",{get:()=>{d=!0}}))}catch(t){}class m{constructor(){this._pool=[]}add(t,i,e,s){this._toggleListener(t,i,e,s)}remove(t,i,e,s){this._toggleListener(t,i,e,s,!0)}removeAll(){this._pool.forEach((t=>{this._toggleListener(t.target,t.type,t.listener,t.passive,!0,!0)})),this._pool=[]}_toggleListener(t,i,e,s,o,n){if(!t)return;const a=(o?"remove":"add")+"EventListener";(i=i.split(" ")).forEach((i=>{if(i){n||(o?this._pool=this._pool.filter((s=>s.type!==i||s.listener!==e||s.target!==t)):this._pool.push({target:t,type:i,listener:e,passive:s}));const r=!!d&&{passive:s||!1};t[a](i,e,r)}}))}}class u{constructor(t){this.slide=t,this.currZoomLevel=1,this.center={},this.max={},this.min={},this.reset()}update(t){this.currZoomLevel=t,this.slide.width?(this._updateAxis("x"),this._updateAxis("y"),this.slide.pswp.dispatch("calcBounds",{slide:this.slide})):this.reset()}_updateAxis(t){const i=this.slide["x"===t?"width":"height"]*this.currZoomLevel,e="x"===t?"Left":"Top",s=this.slide.pswp.options["padding"+e]||0,o=this.slide.panAreaSize[t];this.center[t]=Math.round((o-i)/2)+s,this.max[t]=i>o?Math.round(o-i)+s:this.center[t],this.min[t]=i>o?s:this.center[t]}reset(){this.center.x=0,this.center.y=0,this.max.x=0,this.max.y=0,this.min.x=0,this.min.y=0}correctPan(t,i){return r(i,this.max[t],this.min[t])}}class _{constructor(t,i,e){this.options=t,this.itemData=i,this.index=e}update(t,i,e){this.elementSize={x:t,y:i},this.panAreaSize=e;const s=this.panAreaSize.x/this.elementSize.x,o=this.panAreaSize.y/this.elementSize.y;this.fit=Math.min(1,s<o?s:o),this.fill=Math.min(1,s>o?s:o),this.vFill=Math.min(1,o),this.initial=this._getInitial(),this.secondary=this._getSecondary(),this.max=Math.max(this.initial,this.secondary,this._getMax()),this.min=Math.min(this.fit,this.initial,this.secondary)}_parseZoomLevelOption(t){const i=this.options[t+"ZoomLevel"];if(i)return"function"==typeof i?i(this):"fill"===i?this.fill:"fit"===i?this.fit:Number(i)}_getSecondary(){let t=this._parseZoomLevelOption("secondary");return t||(t=Math.min(1,2.5*this.fit),t*this.elementSize.x>3e3&&(t=3e3/this.elementSize.x),t)}_getInitial(){return this._parseZoomLevelOption("initial")||this.fit}_getMax(){return this._parseZoomLevelOption("max")||Math.max(1,4*this.fit)}}function g(t,i){if(t.getViewportSizeFn){const e=t.getViewportSizeFn(t,i);if(e)return e}return{x:document.documentElement.clientWidth,y:window.innerHeight}}function y(t,i){return{x:i.x-(t.paddingLeft||0)-(t.paddingRight||0),y:i.y-(t.paddingTop||0)-(t.paddingBottom||0)}}class v{constructor(t,i,e){this.data=t,this.index=i,this.pswp=e,this.isActive=i===e.currIndex,this.currentResolution=0,this.panAreaSize={},this.isFirstSlide=this.isActive&&!e.opener.isOpen,this.zoomLevels=new _(e.options,t,i),this.pswp.dispatch("gettingData",{slide:this,data:this.data,index:i}),this.pan={x:0,y:0},this.
|