"use strict";(self.webpackChunkapp=self.webpackChunkapp||[]).push([[3063],{93063:(_,c,o)=>{o.r(c),o.d(c,{ImageViewerPage:()=>m});var u=o(60177),g=o(89417),a=o(36375),n=o(54438);let m=(()=>{var r;class h{constructor(t){this.gestureCtrl=t,this.scale=1,this.startDistance=null,this.startX=0,this.startY=0,this.translateX=0,this.translateY=0,this.currentTranslateX=0,this.currentTranslateY=0,this.isPanning=!1}ngOnInit(){}ionViewWillEnter(){this.previewImage=sessionStorage.getItem("previewImage")}onTouchStart(t){if(2===t.touches.length){const e=t.touches.item(0),s=t.touches.item(1);e&&s&&(this.startDistance=this.getDistance(e,s))}else 1===t.touches.length&&(this.isPanning=!0,this.startX=t.touches[0].clientX-this.currentTranslateX,this.startY=t.touches[0].clientY-this.currentTranslateY)}onTouchMove(t){if(2===t.touches.length&&this.startDistance){const e=t.touches.item(0),s=t.touches.item(1);if(e&&s){const i=this.getDistance(e,s);this.scale=Math.min(Math.max(this.scale*(i/this.startDistance),1),3),this.applyTransform(),this.startDistance=i}}else if(1===t.touches.length&&this.isPanning){const e=t.touches[0];this.translateX=e.clientX-this.startX,this.translateY=e.clientY-this.startY,this.applyTransform()}}onTouchEnd(){this.startDistance=null,this.isPanning=!1,this.currentTranslateX=this.translateX,this.currentTranslateY=this.translateY}getDistance(t,e){const s=e.clientX-t.clientX,i=e.clientY-t.clientY;return Math.sqrt(s*s+i*i)}applyTransform(){const t=document.querySelector(".zoom-image");t&&(t.style.transform=`scale(${this.scale}) translate(${this.translateX}px, ${this.translateY}px)`)}goBack(){window.history.back()}}return(r=h).\u0275fac=function(t){return new(t||r)(n.rXU(a.wH))},r.\u0275cmp=n.VBU({type:r,selectors:[["app-image-viewer"]],standalone:!0,features:[n.aNF],decls:6,vars:1,consts:[[2,"--background","black"],["slot","start","name","arrow-back-outline",3,"click"],["fullscreen","",2,"--background","black"],[1,"image-container",3,"touchstart","touchmove","touchend"],[1,"zoom-image",3,"src"]],template:function(t,e){1&t&&(n.j41(0,"ion-header",0)(1,"ion-toolbar",0)(2,"ion-icon",1),n.bIt("click",function(){return e.goBack()}),n.k0s()()(),n.j41(3,"ion-content",2)(4,"div",3),n.bIt("touchstart",function(i){return e.onTouchStart(i)})("touchmove",function(i){return e.onTouchMove(i)})("touchend",function(){return e.onTouchEnd()}),n.nrm(5,"ion-img",4),n.k0s()()),2&t&&(n.R7$(5),n.Y8G("src",e.previewImage))},dependencies:[a.bv,a.W9,a.eU,a.iq,a.KW,a.ai,u.MD,g.YN],styles:["ion-icon[_ngcontent-%COMP%]{color:#fff;font-size:25px;margin-left:15px}ion-content[_ngcontent-%COMP%]{--overflow: hidden !important}.image-container[_ngcontent-%COMP%]{width:100%;height:100%;overflow:hidden;position:relative;touch-action:none}ion-img[_ngcontent-%COMP%]{transition:transform .3s ease;transform-origin:center center;position:relative;overflow:hidden;display:flex;justify-content:center;align-items:center;height:100%;touch-action:none}.zoom-image[_ngcontent-%COMP%]{transition:transform .3s ease;transform-origin:center}"]}),h})()}}]);