text: "use strict";var _slicedToArray=function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var r=[],i=!0,a=!1,s=void 0;try{for(var n,o=e[Symbol.iterator]();!(i=(n=o.next()).done)&&(r.push(n.value),!t||r.length!==t);i=!0);}catch(e){a=!0,s=e}finally{try{!i&&o.return&&o.return()}finally{if(a)throw s}}return r}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")};!function(e){var t=function(){this.id=(new Date).getTime(),this.images=[],this.current=0,this.show=!1,this._dom,this.dom$imageName,this.dom$page,this.init()};function a(e,t){var r=window.getComputedStyle(e,null).getPropertyValue("transform"),i=r.split("(")[1].split(")")[0].split(","),a=_slicedToArray(i,2),s=a[0],n=a[1],o=Math.round(Math.atan2(n,s)*(180/Math.PI));e.style="-webkit-transform:rotate("+(o+t)+"deg);transform:rotate("+(o+t)+"deg)"}function n(e){var t=e.dom,r=e.offset;t.scrollLeft+=r}t.prototype={constructor:t,mount:function(e){return e.appendChild(this._dom),this},showOnClick:function(e){if(null!=e){for(var t=e.getElementsByTagName("a"),r=[],i=0,a=t[i];void 0!==a;a=t[++i]){var s=a.getAttribute("href"),n=a.innerText;a.setAttribute("href","javascript:void(0);"),a.dataset.url=s,a.dataset.index=i,r.push({url:s,text:n})}this.insertImages(r),this.images=r,e.addEventListener("click",function(e){var r=this,t=e||window.event,i=t.target||t.srcElement;if("a"===i.nodeName.toLocaleLowerCase()){this.toggleClose();var a=+i.dataset.index;if([(this.current=a)-1,a,a+1].forEach(function(e){var t=r.images[e];t&&t.dom.setAttribute("src",t.url)}),this._dom.getElementsByClassName("image-browser__image-swiper")[0].scrollLeft=600*a,this.dom$imageName.innerText=this.images[a].text,this.dom$page.innerText=a+1+"/"+this.images.length,0==a){var s=this._dom.getElementsByClassName("image-browser__btn_arrow_back")[0];s.classList.add("image-browser__btn_disable")}if(a==this.images.length-1){var n=this._dom.getElementsByClassName("image-browser__btn_arrow_forward")[0];n.classList.add("image-browser__btn_disable")}}}.bind(this),!1)}},toggleClose:function(){var e=this._dom;if(this.show){this.show=!1;var t=e.getElementsByClassName("image-browser__image-swiper")[0];t.scrollLeft=0;var r=e.getElementsByClassName("image-browser__btn_arrow_back")[0];r.classList.remove("image-browser__btn_disable");var i=e.getElementsByClassName("image-browser__btn_arrow_forward")[0];i.classList.remove("image-browser__btn_disable"),e.classList.remove("image-browser__show"),this.current=0}else this.show=!0,e.classList.add("image-browser__show")},lazyLoadImage:function(e){var t=this.images[e];if(null!=t){var r=t.url,i=t.dom;null===i.getAttribute("src")&&i.setAttribute("src",r)}},init:function(){var e=this.create("div","image-browser"),t=this.createToolbar(),r=this.createImageNav(),i=this.createFooter();e.appendChild(t),e.appendChild(r),e.appendChild(i),this._dom=e,this.mount(document.body);var a=document.getElementsByClassName("ext")[0];this.showOnClick(a)},create:function(e,t){var r=document.createElement(e);return r.className=t,r},createToolbar:function(){var e=this.create("div","image-browser__row image-browser__toolbar"),t=this.create("button","image-browser__btn image-browser__rotate-btn");t.appendChild(document.createTextNode("向左旋转"));var r=this.create("button","image-browser__btn image-browser__rotate-btn");r.appendChild(document.createTextNode("向右旋转"));var i=this.create("button","image-browser__btn image-browser__close-btn ion-ios-close-circle-outline");return e.appendChild(t),e.appendChild(r),e.appendChild(i),t.onclick=function(){a(this.images[this.current].dom,-90)}.bind(this),r.onclick=function(){a(this.images[this.current].dom,90)}.bind(this),i.onclick=this.toggleClose.bind(this),e},createFooter:function(){var e=this.create("div","image-browser__row image-browser__footer"),t=this.create("div","image-browser__image-name");t.innerText="附件名称",this.dom$imageName=t;var r=this.create("div","image-browser__page");return r.innerText="0/0",this.dom$page=r,e.appendChild(t),e.appendChild(r),e},createImageNav:function(){var r=this,e=this.create("div","image-browser__row image-browser__image-nav"),t=this.create("div","image-browser__image-swiper"),i=function(e){var t=r.create("button","image-browser__btn image-browser__btn_arrow_"+e+" ion-ios-arrow-"+e);return t},a=i("back"),s=i("forward");return e.appendChild(a),e.appendChild(t),e.appendChild(s),a.onclick=function(){0!=r.current&&(s.classList.remove("image-browser__btn_disable"),n({dom:t,offset:-600}),r.current=r.current-1,r.dom$imageName.innerText=r.images[r.current].text,r.dom$page.innerText=r.current+1+"/"+r.images.length,r.lazyLoadImage(r.current-1),0==r.current&&a.classList.add("image-browser__btn_disable"))},s.onclick=function(){var e=r.images.length;r.current!=e-1&&(a.classList.remove("image-browser__btn_disable"),n({dom:t,offset:600}),r.current=r.current+1,r.dom$imageName.innerText=r.images[r.current].text,r.dom$page.innerText=r.current+1+"/"+e,r.lazyLoadImage(r.current+1),r.current==e-1&&s.classList.add("image-browser__btn_disable"))},e},createImage:function(e){var t=e.src,r=e.index,i=this.create("img","image-browser__image");return i.setAttribute("alt",t),i.style="-webkit-transform:rotate(0);transform:rotate(0)",i.dataset.index=r,i},insertImages:function(e){var a=this,s=this._dom.getElementsByClassName("image-browser__image-swiper")[0];e.forEach(function(e,t){var r=a.createImage({src:e.url,index:t}),i=a.create("div","image-browser__image-wrapper");i.style.left=600*t+"px",i.appendChild(r),s.appendChild(i),e.dom=r})}};var r,i=(r=null,function(){return r||(r=new t)});e.init=i,e.showOnClick=function(e){i().showOnClick(e)}}(window.ImageBrowser={}),ImageBrowser.init();