!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("iframe",[],t):"object"==typeof exports?exports.iframe=t():e.iframe=t()}(this,(()=>(()=>{"use strict";var e={d:(t,o)=>{for(var n in o)e.o(o,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:o[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};function o(e){return o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},o(e)}function n(e,t){for(var o=0;og,has:()=>y,hide:()=>l,init:()=>c,show:()=>w,start:()=>v,stop:()=>h,update:()=>p});var r=new Map,a={},s={getURL:function(e){var t=e.getAttribute("data-animation");return t.endsWith(".js")&&(t=t.replace(".js",".html")),t}},u=0;function d(e,t){var o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0,n=e.getAttribute(t);return null==n?o:n}function m(e){if(void 0!==e){var t=e.split(" ");return{x:+t[0],y:+t[1],width:+t[2],height:+t[3]}}}window.SetAnimationSize=function(e,t,o,n,i,a){var s=document.getElementById(e);r.get(s).reload(o,n,i,a)},window.ResetAnimationSize=function(e,t){var o=document.getElementById(e);r.get(o).reload()},window.addEventListener("message",(function(e){var t=e.data;t.operator&&t.arguments&&"function"==typeof window[t.operator]&&window[t.operator].apply(window,t.arguments)}));var f=function(){return e=function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.iframe=t,t.id||(t.id="iframe_".concat(++u)),this.id=this.iframe.id,this.url=s.getURL?s.getURL(t):d(t,"data-animation"),this.rate=d(t,"data-rate",1.01),this.args=t.onsubmit,this.viewBox=m(d(t,"data-viewBox")),this.viewBoxDelta=m(d(t,"data-viewBoxDelta")),this.maxFrame=d(t,"data-maxFrame",1/0),s.lazy||this.onVisible()},t=[{key:"onVisible",value:function(){var e=this;if(this.hasViewBox()){var t=this.getViewBox();this.iframe.onload=function(){window.addEventListener("message",(function o(n){n&&n.source!==e.iframe.contentWindow||(e.iframe.contentWindow.postMessage({operator:"SetViewBox",arguments:[t.x,t.y,t.width,t.height,e.rate]},"*"),e.iframe.contentWindow.postMessage({operator:"Message",arguments:["IFRAME_ID",e.id]},"*"),e.iframe.contentWindow.postMessage({operator:"Message",arguments:["IFRAME_URL",e.url]},"*"),e.args&&e.iframe.contentWindow.postMessage({operator:"Message",arguments:["IFRAME_ARGS",e.args()]},"*"),e.iframe.contentWindow.postMessage({operator:"Message",arguments:["IFRAME_INITED",!0]},"*"),window.removeEventListener("message",o))})),e.iframe.contentWindow.postMessage({operator:"OnInited",arguments:[]},"*")}}else this.iframe.onload=function(){window.addEventListener("message",(function t(o){o&&o.source!==e.iframe.contentWindow||(e.iframe.contentWindow.postMessage({operator:"Message",arguments:["IFRAME_ID",e.id]},"*"),e.iframe.contentWindow.postMessage({operator:"Message",arguments:["IFRAME_URL",e.url]},"*"),e.args&&iframe.contentWindow.postMessage({operator:"Message",arguments:["IFRAME_ARGS",e.args()]},"*"),e.iframe.contentWindow.postMessage({operator:"Message",arguments:["IFRAME_INITED",!0]},"*"),e.iframe.contentWindow.postMessage({operator:"Flush",arguments:[e.id,e.url,e.rate,!1,e.maxFrame]},"*"),window.removeEventListener("message",t))})),e.iframe.contentWindow.postMessage({operator:"OnInited",arguments:[]},"*")};this.iframe.setAttribute("src",this.url)}},{key:"onHidden",value:function(){this.iframe.setAttribute("src","")}},{key:"hasViewBox",value:function(){return void 0!==this.viewBox||void 0!==a[this.url]&&!this.args}},{key:"getViewBox",value:function(e,t,o,n){var i=void 0;if(this.viewBox?i=this.viewBox:a[this.url]?i=a[this.url]:4===arguments.length&&(i={x:e,y:t,width:o,height:n}),void 0===i)throw new Error("View Box Information Not Found!");return this.viewBoxDelta&&(i={x:i.x+this.viewBoxDelta.x,y:i.y+this.viewBoxDelta.y,width:i.width+this.viewBoxDelta.width,height:i.height+this.viewBoxDelta.height}),i}},{key:"reload",value:function(e,t,o,n){var i=this;if(!this.args&&!a[this.url]&&4===arguments.length){var r={x:e,y:t,width:o,height:n};a[this.url]=r}var s=this.getViewBox.apply(this,arguments);this.iframe.onload=function(){window.addEventListener("message",(function e(t){t&&t.source!==i.iframe.contentWindow||(i.iframe.contentWindow.postMessage({operator:"SetViewBox",arguments:[s.x,s.y,s.width,s.height,i.rate]},"*"),i.iframe.contentWindow.postMessage({operator:"Message",arguments:["IFRAME_ID",i.id]},"*"),i.iframe.contentWindow.postMessage({operator:"Message",arguments:["IFRAME_URL",i.url]},"*"),i.args&&iframe.contentWindow.postMessage({operator:"Message",arguments:["IFRAME_ARGS",i.args()]},"*"),i.iframe.contentWindow.postMessage({operator:"Message",arguments:["IFRAME_INITED",!0]},"*"),window.removeEventListener("message",e))})),i.iframe.contentWindow.postMessage({operator:"OnInited",arguments:[]},"*")},this.iframe.contentWindow.postMessage({operator:"Reload",arguments:[]},"*")}},{key:"startAnimateRequest",value:function(){this.iframe.contentWindow.postMessage({operator:"StartAnimate",arguments:[]},"*")}},{key:"stopAnimateRequest",value:function(){this.iframe.contentWindow.postMessage({operator:"StopAnimate",arguments:[]},"*")}}],t&&n(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t}();function g(e){s=e}function c(e){for(var t=e.querySelectorAll("iframe[data-animation]"),o=0;o