!function(e){function d(){return window.MutationObserver||window.WebKitMutationObserver||window.MozMutationObserver}function v(e,t,n){e.addEventListener(t,n,!1)}function m(e,t,n){e.removeEventListener(t,n,!1)}function g(e){return s+"["+(e="Host page: "+(t=e),e=window.top!==window.self?window.parentIFrame&&window.parentIFrame.getId?window.parentIFrame.getId()+": "+t:"Nested host page: "+t:e)+"]";var t}function y(e){return l[e]?l[e].log:n}function b(e,t){S("log",e,t,y(e))}function w(e,t){S("info",e,t,y(e))}function E(e,t){S("warn",e,t,!0)}function S(e,t,n,r){!0===r&&"object"==typeof window.console&&console[e](g(t),n)}function x(e){function t(){r("Height"),r("Width"),_(function(){M(q),L(R),x("onResized",q)},q,"init")}function n(){var e=I.substr(o).split(":"),t=e[1]?parseInt(e[1],10):0,n=l[e[0]]&&l[e[0]].iframe,r=getComputedStyle(n);return{iframe:n,id:e[0],height:t+function(e){if("border-box"!==e.boxSizing)return 0;var t=e.paddingTop?parseInt(e.paddingTop,10):0,e=e.paddingBottom?parseInt(e.paddingBottom,10):0;return t+e}(r)+function(e){if("border-box"!==e.boxSizing)return 0;var t=e.borderTopWidth?parseInt(e.borderTopWidth,10):0,e=e.borderBottomWidth?parseInt(e.borderBottomWidth,10):0;return t+e}(r),width:e[2],type:e[3]}}function r(e){var t=Number(l[R]["max"+e]),n=Number(l[R]["min"+e]),r=e.toLowerCase(),e=Number(q[r]);b(R,"Checking "+r+" is in range "+n+"-"+t),e<n&&(e=n,b(R,"Set "+r+" to min value")),t<e&&(e=t,b(R,"Set "+r+" to max value")),q[r]=""+e}function a(){function t(){return r.constructor===Array?function(){var e=0,t=!1;for(b(R,"Checking connection is from allowed list of origins: "+r);e<r.length;e++)if(r[e]===n){t=!0;break}return t}():(e=l[R]&&l[R].remoteHost,b(R,"Checking connection is from: "+e),n===e);var e}var n=e.origin,r=l[R]&&l[R].checkOrigin;if(r&&""+n!="null"&&!t())throw new Error("Unexpected message received from: "+n+" for "+q.iframe.id+". Message was: "+e.data+". This error can be disabled by setting the checkOrigin: false option or by providing of array of trusted domains.");return 1}function f(e){return I.substr(I.indexOf(":")+i+e)}function c(e,t){var n,r,i;n=function(){var n,r;D("Send Page Info","pageInfo:"+(n=document.body.getBoundingClientRect(),r=q.iframe.getBoundingClientRect(),JSON.stringify({iframeHeight:r.height,iframeWidth:r.width,clientHeight:Math.max(document.documentElement.clientHeight,window.innerHeight||0),clientWidth:Math.max(document.documentElement.clientWidth,window.innerWidth||0),offsetTop:parseInt(r.top-n.top,10),offsetLeft:parseInt(r.left-n.left,10),scrollTop:window.pageYOffset,scrollLeft:window.pageXOffset,documentHeight:document.documentElement.clientHeight,documentWidth:document.documentElement.clientWidth,windowHeight:window.innerHeight,windowWidth:window.innerWidth})),e,t)},r=32,p[i=t]||(p[i]=setTimeout(function(){p[i]=null,n()},r))}function h(e){return e=e.getBoundingClientRect(),k(R),{x:Math.floor(Number(e.left)+Number(u.x)),y:Math.floor(Number(e.top)+Number(u.y))}}function d(e){var t=e?h(q.iframe):{x:0,y:0},n={x:Number(q.width)+t.x,y:Number(q.height)+t.y};b(R,"Reposition requested from iFrame (offset x:"+t.x+" y:"+t.y+")"),window.top!==window.self?window.parentIFrame?window.parentIFrame["scrollTo"+(e?"Offset":"")](n.x,n.y):E(R,"Unable to scroll to requested position, window.parentIFrame not found"):(u=n,g(),b(R,"--"))}function g(){!1!==x("onScroll",u)?L(R):A()}function y(e){var t,n=e.split("#")[1]||"",e=decodeURIComponent(n),r=document.getElementById(e)||document.getElementsByName(e)[0];r?(t=h(r),b(R,"Moving to in page link (#"+n+") at x: "+t.x+" y: "+t.y),u={x:t.x,y:t.y},g(),b(R,"--")):window.top!==window.self?window.parentIFrame?window.parentIFrame.moveToAnchor(n):b(R,"In page link #"+n+" not found and window.parentIFrame not found"):b(R,"In page link #"+n+" not found")}function S(e){var t,n={};n=0===Number(q.width)&&0===Number(q.height)?{x:(t=f(9).split(":"))[1],y:t[0]}:{x:q.width,y:q.height},x(e,{iframe:q.iframe,screenX:Number(n.x),screenY:Number(n.y),type:q.type})}function x(e,t){return T(R,e,t)}function N(){function e(e,t){function i(){l[r]?c(l[r].iframe,r):n()}["scroll","resize"].forEach(function(n){b(r,e+n+" listener for sendPageInfo"),t(window,n,i)})}function n(){e("Remove ",m)}switch(l[R]&&l[R].firstRun&&l[R]&&(l[R].firstRun=!1),q.type){case"close":C(q.iframe);break;case"message":i=f(6),b(R,"onMessage passed: {iframe: "+q.iframe.id+", message: "+i+"}"),x("onMessage",{iframe:q.iframe,message:JSON.parse(i)}),b(R,"--");break;case"mouseenter":S("onMouseEnter");break;case"mouseleave":S("onMouseLeave");break;case"autoResize":l[R].autoResize=JSON.parse(f(9));break;case"scrollTo":d(!1);break;case"scrollToOffset":d(!0);break;case"pageInfo":c(l[R]&&l[R].iframe,R),r=R,e("Add ",v),l[r]&&(l[r].stopPageInfo=n);break;case"pageInfoStop":l[R]&&l[R].stopPageInfo&&(l[R].stopPageInfo(),delete l[R].stopPageInfo);break;case"inPageLink":y(f(9));break;case"reset":O(q);break;case"init":t(),x("onInit",q.iframe);break;default:0===Number(q.width)&&0===Number(q.height)?E("Unsupported message received ("+q.type+"), this is likely due to the iframe containing a later version of iframe-resizer than the parent page"):t()}var r,i}var H,B,j,F,I=e.data,q={},R=null;"[iFrameResizerChild]Ready"===I?function(){for(var e in l)D("iFrame requested init",P(e),l[e].iframe,e)}():s===(""+I).substr(0,o)&&I.substr(o).split(":")[0]in l?(q=n(),R=q.id,l[R]&&(l[R].loaded=!0),(F=q.type in{"true":1,"false":1,"undefined":1})&&b(R,"Ignoring init message from meta parent page"),!F&&(j=!0,l[B=R]||(j=!1,E(q.type+" No settings for "+B+". Message was: "+I)),j)&&(b(R,"Received: "+I),H=!0,null===q.iframe&&(E(R,"IFrame ("+q.id+") not found"),H=!1),H&&a()&&N())):w(R,"Ignored: "+I)}function T(e,t,n){var r=null,i=null;if(l[e]){if("function"!=typeof (r=l[e][t]))throw new TypeError(t+" on iFrame["+e+"] is not a function");i=r(n)}return i}function N(e){e=e.id,delete l[e]}function C(e){var t=e.id;if(!1!==T(t,"onClose",t)){b(t,"Removing iFrame: "+t);try{e.parentNode&&e.parentNode.removeChild(e)}catch(e){E(e)}T(t,"onClosed",t),b(t,"--"),N(e)}else b(t,"Close iframe cancelled by onClose event")}function k(t){null===u&&b(t,"Get page position: "+(u={x:window.pageXOffset!==e?window.pageXOffset:document.documentElement.scrollLeft,y:window.pageYOffset!==e?window.pageYOffset:document.documentElement.scrollTop}).x+","+u.y)}function L(e){null!==u&&(window.scrollTo(u.x,u.y),b(e,"Set page position: "+u.x+","+u.y),A())}function A(){u=null}function O(e){b(e.id,"Size reset requested by "+("init"===e.type?"host page":"iFrame")),k(e.id),_(function(){M(e),D("reset","reset",e.iframe,e.id)},e,"reset")}function M(e){function t(t){function n(){Object.keys(l).forEach(function(e){function t(e){return"0px"===(l[n]&&l[n].iframe.style[e])}var n;l[n=e]&&null!==l[n].iframe.offsetParent&&(t("height")||t("width"))&&D("Visibility change","resize",l[n].iframe,n)})}function s(e){b("window","Mutation observed: "+e[0].target+" "+e[0].type),B(n,16)}var o;r||"0"!==e[t]||(r=!0,b(i,"Hidden iFrame detected, creating visibility listener"),(o=d())&&function(){var e=document.querySelector("body");(new o(s)).observe(e,{attributes:!0,attributeOldValue:!1,characterData:!0,characterDataOldValue:!1,childList:!0,subtree:!0})}())}function n(n){var r;r=n,e.id?(e.iframe.style[r]=e[r]+"px",b(e.id,"IFrame ("+i+") "+r+" set to "+e[r]+"px")):b("undefined","messageData id not set"),t(n)}var i=e.iframe.id;l[i]&&(l[i].sizeHeight&&n("height"),l[i].sizeWidth&&n("width"))}function _(e,t,n){n!==t.type&&a&&!window.jasmine?(b(t.id,"Requesting animation frame"),a(e)):e()}function D(e,t,n,r,i){function o(){var i;n&&"contentWindow"in n&&null!==n.contentWindow?(i=l[r]&&l[r].targetOrigin,b(r,"["+e+"] Sending msg to iframe["+r+"] ("+t+") targetOrigin: "+i),n.contentWindow.postMessage(s+t,i)):E(r,"["+e+"] IFrame("+r+") not found")}function u(){i&&l[r]&&l[r].warningTimeout&&(l[r].msgTimeout=setTimeout(function(){!l[r]||l[r].loaded||a||(a=!0,E(r,"IFrame has not responded within "+l[r].warningTimeout/1e3+" seconds. Check iFrameResizer.contentWindow.js has been loaded in iFrame. This message can be ignored if everything is working, or you can set the warningTimeout option to a higher value or zero to suppress this warning."))},l[r].warningTimeout))}var a=!1;r=r||n.id,l[r]&&(o(),u())}function P(e){return e+":"+l[e].bodyMarginV1+":"+l[e].sizeWidth+":"+l[e].log+":"+l[e].interval+":"+l[e].enablePublicMethods+":"+l[e].autoResize+":"+l[e].bodyMargin+":"+l[e].heightCalculationMethod+":"+l[e].bodyBackground+":"+l[e].bodyPadding+":"+l[e].tolerance+":"+l[e].inPageLinks+":"+l[e].resizeFrom+":"+l[e].widthCalculationMethod+":"+l[e].mouseEvents}function H(r,i){function s(t){var n,i=d();i&&(n=i,r.parentNode&&(new n(function(e){e.forEach(function(e){Array.prototype.slice.call(e.removedNodes).forEach(function(e){e===r&&C(r)})})})).observe(r.parentNode,{childList:!0})),v(r,"load",function(){var n,i;D("iFrame.onload",t,r,e,!0),n=l[p]&&l[p].firstRun,i=l[p]&&l[p].heightCalculationMethod in f,!n&&i&&O({iframe:r,height:0,width:0,type:"init"})}),D("init",t,r,e,!0)}function o(e){var t=e.split("Callback");2===t.length&&(this[t="on"+t[0].charAt(0).toUpperCase()+t[0].slice(1)]=this[e],delete this[e],E(p,"Deprecated: '"+e+"' has been renamed '"+t+"'. The old method will be removed in the next major version."))}function u(e){e=e||{},l[p]={firstRun:!0,iframe:r,remoteHost:r.src&&r.src.split("/").slice(0,3).join("/")},function(e){if("object"!=typeof e)throw new TypeError("Options is not an object")}(e),Object.keys(e).forEach(o,e),function(e){for(var t in h)Object.prototype.hasOwnProperty.call(h,t)&&(l[p][t]=(Object.prototype.hasOwnProperty.call(e,t)?e:h)[t])}(e),l[p]&&(l[p].targetOrigin=!0===l[p].checkOrigin?""===(e=l[p].remoteHost)||null!==e.match(/^(about:blank|javascript:|file:\/\/)/)?"*":e:"*")}function m(e){var t=l[p][e];1/0!==t&&0!==t&&(r.style[e]="number"==typeof t?t+"px":t,b(p,"Set "+e+" = "+r.style[e]))}function g(e){if(l[p]["min"+e]>l[p]["max"+e])throw new Error("Value for min"+e+" can not be greater than max"+e)}var a,c,p=(""===(a=r.id)&&(r.id=(c=i&&i.id||h.id+t++,null!==document.getElementById(c)&&(c+=t++),a=c),n=(i||{}).log,b(a,"Added missing iframe ID: "+a+" ("+r.src+")")),a);p in l&&"iFrameResizer"in r?E(p,"Ignored iFrame, already setup."):(u(i),function(){switch(b(p,"IFrame scrolling "+(l[p]&&l[p].scrolling?"enabled":"disabled")+" for "+p),r.style.overflow=!1===(l[p]&&l[p].scrolling)?"hidden":"auto",l[p]&&l[p].scrolling){case"omit":break;case!0:r.scrolling="yes";break;case!1:r.scrolling="no";break;default:r.scrolling=l[p]?l[p].scrolling:"no"}}(),g("Height"),g("Width"),m("maxHeight"),m("minHeight"),m("maxWidth"),m("minWidth"),"number"!=typeof (l[p]&&l[p].bodyMargin)&&"0"!==(l[p]&&l[p].bodyMargin)||(l[p].bodyMarginV1=l[p].bodyMargin,l[p].bodyMargin=l[p].bodyMargin+"px"),s(P(p)),l[p]&&(l[p].iframe.iFrameResizer={close:C.bind(null,l[p].iframe),removeListeners:N.bind(null,l[p].iframe),resize:D.bind(null,"Window resize","resize",l[p].iframe),moveToAnchor:function(e){D("Move to anchor","moveToAnchor:"+e,l[p].iframe,p)},sendMessage:function(e){D("Send Message","message:"+(e=JSON.stringify(e)),l[p].iframe,p)}}))}function B(e,t){null===c&&(c=setTimeout(function(){c=null,e()},t))}function j(){"hidden"!==document.visibilityState&&(b("document","Trigger event: Visiblity change"),B(function(){F("Tab Visable","resize")},16))}function F(e,t){Object.keys(l).forEach(function(n){var r;l[r=n]&&"parent"===l[r].resizeFrom&&l[r].autoResize&&!l[r].firstRun&&D(e,t,l[n].iframe,n)})}function I(){v(window,"message",x),v(window,"resize",function(){var e;b("window","Trigger event: "+(e="resize")),B(function(){F("Window "+e,"resize")},16)}),v(document,"visibilitychange",j),v(document,"-webkit-visibilitychange",j)}function q(){function t(e,t){t&&(function(){if(!t.tagName)throw new TypeError("Object is not a valid DOM element");if("IFRAME"!==t.tagName.toUpperCase())throw new TypeError("Expected <IFRAME> tag, found <"+t.tagName+">")}(),H(t,e),n.push(t))}var n;return function(){for(var e=["moz","webkit","o","ms"],t=0;t<e.length&&!a;t+=1)a=window[e[t]+"RequestAnimationFrame"];a?a=a.bind(window):b("setup","RequestAnimationFrame not supported")}(),I(),function(r,i){var s;switch(n=[],(s=r)&&s.enablePublicMethods&&E("enablePublicMethods option has been removed, public methods are now always available in the iFrame"),typeof i){case"undefined":case"string":Array.prototype.forEach.call(document.querySelectorAll(i||"iframe"),t.bind(e,r));break;case"object":t(r,i);break;default:throw new TypeError("Unexpected data type ("+typeof i+")")}return n}}function R(e){e.fn?e.fn.iFrameResize||(e.fn.iFrameResize=function(e){return this.filter("iframe").each(function(t,n){H(n,e)}).end()}):w("","Unable to bind to jQuery, it is not fully loaded.")}var t,n,r,i,s,o,u,a,f,l,c,h,p;"undefined"!=typeof window&&(i="message".length,o=(s="[iFrameSizer]").length,a=window.requestAnimationFrame,h={autoResize:!(c=u=null),bodyBackground:null,bodyMargin:null,bodyMarginV1:8,bodyPadding:null,checkOrigin:!(r=n=!1),inPageLinks:!(l={}),enablePublicMethods:!(t=0),heightCalculationMethod:"bodyOffset",id:"iFrameResizer",interval:32,log:!(f={max:1,scroll:1,bodyScroll:1,documentElementScroll:1}),maxHeight:1/0,maxWidth:1/0,minHeight:0,minWidth:0,mouseEvents:!0,resizeFrom:"parent",scrolling:!1,sizeHeight:!0,sizeWidth:!1,warningTimeout:5e3,tolerance:0,widthCalculationMethod:"scroll",onClose:function(){return!0},onClosed:function(){},onInit:function(){},onMessage:function(){E("onMessage function not defined")},onMouseEnter:function(){},onMouseLeave:function(){},onResized:function(){},onScroll:function(){return!0}},p={},window.jQuery&&R(window.jQuery),"function"==typeof define&&define.amd?define([],q):"object"==typeof module&&"object"==typeof module.exports&&(module.exports=q()),window.iFrameResize=window.iFrameResize||q())}()