text: "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t,n=require("@rpearce/ts-dom-fns");!function(e){e.UNZOOMED="UNZOOMED",e.UNZOOMING="UNZOOMING",e.ZOOMED="ZOOMED",e.ZOOMING="ZOOMING"}(e||(e={})),function(e){e.UNZOOM="UNZOOM",e.ZOOM="ZOOM"}(t||(t={}));var i=e.UNZOOMED,o=e.UNZOOMING,r=e.ZOOMED,a=e.ZOOMING,l=t.UNZOOM,d=t.ZOOM,u=n.focus.bind(null,{preventScroll:!0}),s=function(e){return null!=e},c=n.setStyleProperty.bind(null,void 0),v="ACTION",p="alt",f="aria-label",m="aria-labelledby",g="aria-modal",h="background-color",b="blur",O="button",E="click",y="cursor",z="data-rmiz-container",L="data-rmiz-dialog",M="data-rmiz-dialog-img",A="data-rmiz-overlay",x="data-rmiz-zoom-button",w="dialog",T="div",Z="focus",C="id",I="rmiz-modal-label",N="img",H="keydown",D="opacity",S="resize",G="role",U="src",V="STATE",W="style",P="tabindex",k="transform",B="transition-duration",j="type",K="0",R='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 489.3 489.3"><path d="M476.95 0H12.35C5.55 0 .15 5.5.15 12.2V235c0 6.8 5.5 12.2 12.2 12.2s12.3-5.5 12.3-12.2V24.5h440.2v440.2h-211.9c-6.8 0-12.3 5.5-12.3 12.3s5.5 12.3 12.3 12.3h224c6.8 0 12.3-5.5 12.3-12.3V12.3c0-6.8-5.5-12.3-12.3-12.3z"/><path d="M.05 476.9c0 6.8 5.5 12.3 12.2 12.3h170.4c6.8 0 12.3-5.5 12.3-12.3V306.6c0-6.8-5.5-12.3-12.3-12.3H12.35c-6.8 0-12.2 5.5-12.2 12.3v170.3h-.1zm24.5-158.1h145.9v145.9H24.55V318.8zM222.95 266.3c2.4 2.4 5.5 3.6 8.7 3.6s6.3-1.2 8.7-3.6l138.6-138.7v79.9c0 6.8 5.5 12.3 12.3 12.3s12.3-5.5 12.3-12.3V98.1c0-6.8-5.5-12.3-12.3-12.3h-109.5c-6.8 0-12.3 5.5-12.3 12.3s5.5 12.3 12.3 12.3h79.9L222.95 249c-4.8 4.8-4.8 12.5 0 17.3z"/></svg>',X="-webkit-appearance:none;-moz-appearance:none;appearance:none;",_="cursor:pointer;cursor:zoom-in;",q="cursor:pointer;cursor:zoom-out;",Y="position:absolute;",F=Y+"clip:rect(0 0 0 0);clip-path:inset(50%);width:1px;height:1px;overflow:hidden;white-space:nowrap;",J=_+Y+F;exports.default=function(e){var t,Q,$,ee,te,ne,ie,oe,re=void 0===e?{}:e,ae=re.auto,le=void 0===ae||ae,de=re.margin,ue=void 0===de?0:de,se=re.onChange,ce=void 0===se?void 0:se,ve=re.overlayBgColor,pe=void 0===ve?"#fff":ve,fe=re.overlayOpacity,me=void 0===fe?1:fe,ge=re.transitionDuration,he=void 0===ge?300:ge,be=re.unzoomLabel,Oe=void 0===be?"Unzoom image":be,Ee=re.zIndex,ye=void 0===Ee?2147483647:Ee,ze=re.zoomLabel,Le=void 0===ze?"Zoom image":ze,Me=re.zoomTitle,Ae=void 0===Me?"Zoomed item":Me,xe=document.body,we=window,Te=i,Ze=[],Ce=function(e,t){if(void 0===t&&(t=!1),t||(Ze=Ze.filter((function(t){return t!==e}))),e&&c(y,"",e),le&&e){n.removeEventListener(E,Pe,e);var i=n.getNextSibling(e);i instanceof HTMLButtonElement&&(n.removeEventListener(Z,Ke,i),n.removeEventListener(b,je,i))}},Ie=function(e){var t=e.type,n=e.value;ce&&ce({type:t,value:n})},Ne=function(e){Ie({type:V,value:Te=e})},He=function(){$=n.createElement(T),n.setAttribute(z,"",$),c("zIndex",""+ye,$),oe=n.createElement(T),n.setAttribute(A,"",oe),n.setAttribute(W,"position:fixed;top:0;right:0;bottom:0;left:0;background-color:"+pe+";transition-duration:"+he+"ms;transition-property:opacity;opacity:0;will-change:opacity;"+q,oe),t=n.createElement(T),n.setAttribute(P,K,t),Q=n.createElement(T),n.setAttribute(P,K,Q),ee=n.createElement(T),n.setAttribute(m,I,ee),n.setAttribute(g,"true",ee),n.setAttribute(L,"",ee),n.setAttribute(G,w,ee),n.setAttribute(P,K,ee),te=n.createElement(O),ie=n.createElement(T),n.setAttribute(W,F,ie),n.setAttribute(C,I,ie),n.setInnerText(ie,Ae),n.appendChild(te,ee),n.appendChild(ie,ee),n.appendChild(oe,$),n.appendChild(t,$),n.appendChild(ee,$),n.appendChild(Q,$)},De=function(){for(var e=0,n=Ze;e<n.length;e++){var o=n[e];Ce(o,!0)}Se(),t=void 0,Q=void 0,$=void 0,te=void 0,ee=void 0,ie=void 0,oe=void 0,Ze=[],Ne(i)},Se=function(){n.removeEventListener(S,Be,we),$&&n.removeEventListener(E,ke,$),t&&n.removeEventListener(Z,We,t),Q&&n.removeEventListener(Z,We,Q),$&&n.removeChild($,xe)},Ge=function(){Ne(o),Se(),Ne(i)},Ue=function(e){if(e instanceof HTMLImageElement){Ne(a);var i=n.getBoundingClientRect(e),o=i.height,l=i.left,d=i.top,u=i.width,s=e.naturalHeight,v=e.naturalWidth,f=n.getStyleProperty(k,e),m=f?" "+f:"",g=n.getScaleToWindowMax(u,v,o,s,ue),h=n.getWindowPageYOffset(),b=n.getWindowPageXOffset();n.getWindowInnerWidth(),n.getWindowInnerHeight();var O="scale(1) translate3d("+-l+"px,0px,0)"+m;if(console.log({height:o,left:l,top:d,width:u,naturalWidth:v,naturalHeight:s,scale:g}),ne=n.createElement(N),n.setAttribute(p,e.alt,ne),n.setAttribute(U,e.currentSrc,ne),n.setAttribute(M,"",ne),!$||!ee||!ne)return;n.setAttribute(W,Y+"top:"+(h+d)+"px;left:"+(b+l)+"px;height:"+o*g+"px;width:"+u*g+"px;transform:scale("+1/g+") translate3d(0,0,0)"+m+";transition:transform "+he+"ms cubic-bezier(0.2,0,0.2,1);transform-origin:top left;"+q,ne),n.appendChild(ne,ee),n.appendChild($,xe),n.addEventListener(S,Be,we),n.addEventListener(H,Ve,document),$&&n.addEventListener(E,ke,$),t&&n.addEventListener(Z,We,t),Q&&n.addEventListener(Z,We,Q),n.raf((function(){n.setTimeout((function(){e&&ne&&(c(k,O,ne),Ne(r))}),0)}))}e instanceof SVGElement&&console.log("GOT AN SVG HERE!")},Ve=function(e){n.isEscapeKey(e)&&(n.stopPropagation(e),Ie({type:v,value:l}),le&&Ge())},We=function(){u(te)},Pe=function(e){Ie({type:v,value:d}),le&&Ue(e.currentTarget)},ke=function(){console.log("MODAL CLICKED!"),Ie({type:v,value:l}),le&&Ge()},Be=function(){Te===r&&(Ie({type:v,value:l}),le&&Ge())},je=function(e){n.setAttribute(W,J,e.currentTarget)},Ke=function(e){n.setAttribute(W,X+_+Y+"padding:3px;width:30px;height:30px;background:#fff;border:none;fill:#707070;transform:translateX(-100%);",e.currentTarget)},Re=function(e){var t=e.currentTarget,i=n.getPreviousSibling(t);i instanceof HTMLImageElement&&(Ie({type:v,value:d}),le&&Ue(i))};return He(),{attach:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];if(e.length)for(var i=function(e){if(e instanceof HTMLImageElement||e instanceof SVGElement){c(y,"pointer",e),c(y,"zoom-in",e);var t=n.createElement(O);n.setAttribute(f,Le,t),n.setAttribute(x,"",t),n.setAttribute(W,J,t),n.setAttribute(j,O,t),n.setInnerHTML(t,R),n.insertAdjacentElement(e,"afterend",t),le&&(n.addEventListener(E,Pe,e),n.addEventListener(E,Re,t),n.addEventListener(Z,Ke,t),n.addEventListener(b,je,t),Ze.push(e))}},o=0,r=e;o<r.length;o++){var a=r[o];if(a instanceof NodeList||a instanceof Array)for(var l=0,d=a;l<d.length;l++){var u=d[l];i(u)}else i(a)}},detach:Ce,reset:function(){De(),He()},teardown:De,unzoom:Ge,update:function(e){var t,n,i,o,r,a,l,d,u,v;void 0===e&&(e={}),le=null!==(t=e.auto)&&void 0!==t?t:le,ue=null!==(n=e.margin)&&void 0!==n?n:ue,ce=null!==(i=e.onChange)&&void 0!==i?i:ce,pe=null!==(o=e.overlayBgColor)&&void 0!==o?o:pe,me=null!==(r=e.overlayOpacity)&&void 0!==r?r:me,he=null!==(a=e.transitionDuration)&&void 0!==a?a:he,Oe=null!==(l=e.unzoomLabel)&&void 0!==l?l:Oe,ye=null!==(d=e.zIndex)&&void 0!==d?d:ye,Le=null!==(u=e.zoomLabel)&&void 0!==u?u:Le,Ae=null!==(v=e.zoomTitle)&&void 0!==v?v:Ae,$&&c("zIndex",""+ye,$),oe&&(s(e.overlayBgColor)&&c(h,pe,oe),s(e.overlayOpacity)&&c(D,""+me,oe),s(e.transitionDuration)&&c(B,""+he,oe)),ie&&(ie.innerText=Ae),te&&(te.innerText=Oe)},zoom:Ue}};
  