/iphone|mac|ipad|ipod/i.test(window.navigator.userAgent.toLowerCase())&&(console={},console.log=function(e){var t=document.createElement("iframe");t.setAttribute("src","ios-log: "+e),document.documentElement.appendChild(t),t.parentNode.removeChild(t),t=null},console.debug=console.info=console.warn=console.error=console.log),function(){var e=window.mraid={},t=window.navigator.userAgent.toLowerCase(),n=/iphone|mac|ipad|ipod/i.test(t),r=/android/i.test(t),i=window.mraidbridge={nativeSDKFiredReady:!1,nativeCallQueue:[],nativeCallInFlight:!1,lastSizeChangeProperties:null};function o(e){var t,i;N(s.INFO,"调用方法:"+e),n?(t=e,(i=document.createElement("iframe")).setAttribute("frameborder","0"),i.style.cssText="width:0;height:0;border:0;display:none;",i.setAttribute("src",t),setTimeout(function(){document.body.appendChild(i)},5)):r&&window.prompt(e,"mraid:")}i.fireChangeEvent=function(e){for(var t in e){if(e.hasOwnProperty(t))(0,A[t])(e[t])}},i.nativeCallComplete=function(e){0!==this.nativeCallQueue.length?o(this.nativeCallQueue.pop()):this.nativeCallInFlight=!1},i.executeNativeCall=function(e){var t=e.shift();if(!this.nativeSDKFiredReady)return console.log("rejecting "+t+" because mraid is not ready"),void i.notifyErrorEvent("mraid is not ready",t);for(var n,r,a="mraid://"+t,s=!0,u=0;u=0});t.length>=3&&(C.major=parseInt(t[0],10),C.minor=parseInt(t[1],10),C.patch=parseInt(t[2],10),N(s.INFO,"Set hostSDKVersion to "+I(C)))}},P=function(e,t,n,r){if(!r){if(null===e)return N(s.ERROR,"Required object not provided.",n),!1;for(var i in t)if(t.hasOwnProperty(i)&&void 0===e[i])return N(s.ERROR,"Object is missing required property: "+i,n),!1}for(var o in e){var a=t[o],u=e[o];if(a&&!a(u))return N(s.ERROR,"Value of property "+o+" is invalid: "+u,n),!1}return!0},b={useCustomClose:function(e){return"boolean"==typeof e}};e.addEventListener=function(t,n){t&&n?S(t,s)?(v[t]||(v[t]=new function(t){this.event=t,this.count=0;var n={};this.add=function(e){var t=String(e);n[t]||(n[t]=e,this.count++)},this.remove=function(e){var t=String(e);return!!n[t]&&(n[t]=null,delete n[t],this.count--,!0)},this.removeAll=function(){for(var e in n)n.hasOwnProperty(e)&&this.remove(n[e])},this.broadcast=function(t){for(var r in n)n.hasOwnProperty(r)&&n[r].apply(e,t)},this.toString=function(){var e=[t,":"];for(var r in n)n.hasOwnProperty(r)&&e.push("|",r,"|");return e.join("")}}(t)),v[t].add(n)):N(s.ERROR,"Unknown MRAID event: "+t,"addEventListener"):N(s.ERROR,"Both event and listener are required.","addEventListener")},e.close=function(){R===a.HIDDEN?N(s.ERROR,"Ad cannot be closed when it is already hidden.","close"):i.executeNativeCall(["close"])},e.unload=function(){R===a.EXPANDED?N(s.ERROR,"Ad cannot be unload when it is already EXPANDED.","close"):i.executeNativeCall(["unload"])},e.expand=function(e){if(this.getState()!==a.DEFAULT&&this.getState()!==a.RESIZED)N(s.ERROR,"Ad can only be expanded from the default or resized state.","expand");else{var t=["expand","shouldUseCustomClose",!1];e&&(t=t.concat(["url",e])),i.executeNativeCall(t)}},e.getExpandProperties=function(){return{width:h.width,height:h.height,useCustomClose:h.useCustomClose,isModal:h.isModal}},e.getCurrentPosition=function(){return{x:d.x,y:d.y,width:d.width,height:d.height}},e.getDefaultPosition=function(){return{x:g.x,y:g.y,width:g.width,height:g.height}},e.getMaxSize=function(){return{width:p.width||window.innerWidth,height:p.height||window.innerHeight}},e.getPlacementType=function(){return O},e.getScreenSize=function(){return{width:m.width||window.screen.width,height:m.height||window.screen.height}},e.getState=function(){return R},e.isViewable=function(){return y},e.getVersion=function(){return e.VERSION},e.getCurrentAppOrientation=function(){return{orientation:E.orientation,locked:E.locked}},e.getAudioVolume=function(){return w},e.open=function(e){e?i.executeNativeCall(["open","url",e]):N(s.ERROR,"URL is required.","open")},e.removeEventListener=function(e,t){if(e){if(t){var n=!1;if(v[e]&&(n=v[e].remove(t)),!n)return void N(s.ERROR,"Listener not currently registered for event.","removeEventListener")}else!t&&v[e]&&v[e].removeAll();v[e]&&0===v[e].count&&(v[e]=null,delete v[e])}else N(s.ERROR,"Event is required.","removeEventListener")},e.setExpandProperties=function(e){P(e,b,"setExpandProperties",!0)&&e.hasOwnProperty("useCustomClose")&&(h.useCustomClose=!1)},e.useCustomClose=function(e){},e.createCalendarEvent=function(e){D.initialize(e),D.parse()?i.executeNativeCall(D.arguments):N(s.ERROR,D.errors[0],"createCalendarEvent")},e.supports=function(e){return f[e]},e.playVideo=function(t){e.isViewable()?t?i.executeNativeCall(["playVideo","uri",t]):N(s.ERROR,"playVideo must be called with a valid URI","playVideo"):N(s.ERROR,"playVideo cannot be called until the ad is viewable","playVideo")},e.storePicture=function(t){e.isViewable()?t?i.executeNativeCall(["storePicture","uri",t]):N(s.ERROR,"storePicture must be called with a valid URI","storePicture"):N(s.ERROR,"storePicture cannot be called until the ad is viewable","storePicture")};var V={width:function(e){return!isNaN(e)&&e>0},height:function(e){return!isNaN(e)&&e>0},offsetX:function(e){return!isNaN(e)},offsetY:function(e){return!isNaN(e)},customClosePosition:function(e){return"string"==typeof e&&["top-right","bottom-right","top-left","bottom-left","center","top-center","bottom-center"].indexOf(e)>-1},allowOffscreen:function(e){return"boolean"==typeof e}};e.setOrientationProperties=function(e){e.hasOwnProperty("allowOrientationChange")&&(c.allowOrientationChange=e.allowOrientationChange),e.hasOwnProperty("forceOrientation")&&(c.forceOrientation=e.forceOrientation);var t=["setOrientationProperties","allowOrientationChange",c.allowOrientationChange,"forceOrientation",c.forceOrientation];i.executeNativeCall(t)},e.getOrientationProperties=function(){return{allowOrientationChange:c.allowOrientationChange,forceOrientation:c.forceOrientation}},e.resize=function(){if(this.getState()!==a.DEFAULT&&this.getState()!==a.RESIZED)N(s.ERROR,"Ad can only be resized from the default or resized state.","resize");else if(l.width&&l.height){var e=["resize","width",l.width,"height",l.height,"offsetX",l.offsetX||0,"offsetY",l.offsetY||0,"customClosePosition",l.customClosePosition,"allowOffscreen",!!l.allowOffscreen];i.executeNativeCall(e)}else N(s.ERROR,"Must set resize properties before calling resize()","resize")},e.getResizeProperties=function(){return{width:l.width,height:l.height,offsetX:l.offsetX,offsetY:l.offsetY,customClosePosition:l.customClosePosition,allowOffscreen:l.allowOffscreen}},e.setResizeProperties=function(e){if(P(e,V,"setResizeProperties",!0))for(var t=["width","height","offsetX","offsetY","customClosePosition","allowOffscreen"],n=t.length,r=0;r