toponad.js 26 KB

1
  1. !function i(a,o,l){function d(t,e){if(!o[t]){if(!a[t]){var n="function"==typeof require&&require;if(!e&&n)return n(t,!0);if(s)return s(t,!0);throw(n=new Error("Cannot find module '"+t+"'")).code="MODULE_NOT_FOUND",n}n=o[t]={exports:{}},a[t][0].call(n.exports,function(e){return d(a[t][1][e]||e)},n,n.exports,i,a,o,l)}return o[t].exports}for(var s="function"==typeof require&&require,e=0;e<l.length;e++)d(l[e]);return d}({1:[function(e,t,n){"use strict";var i,a,S=this&&this.__spreadArray||function(e,t){for(var n=0,i=t.length,a=e.length;n<i;n++,a++)e[a]=t[n];return e};!function(e){var d,a,t,n,i;function o(){return cc.sys.platform===cc.sys.ANDROID}function l(){return cc.sys.platform===cc.sys.IPAD||cc.sys.platform===cc.sys.IPHONE}function s(){return d.isAndroid()?"com/cocos/analytics/CACustomEvent":d.isIOS()?"CACustomEvent":void 0}function r(){var e=d.fullClassName("ServiceTopOnAd"),t="";return d.isAndroid()?t=d.callNativeMethod(e,"getUid","()Ljava/lang/String;"):d.isIOS()&&(t=d.callNativeMethod(e,"getUid")),t}function c(){var e=d.fullClassName("ServiceTopOnAd"),t="";return d.isAndroid()?t=d.callNativeMethod(e,"getAppId","()Ljava/lang/String;"):d.isIOS()&&(t=d.callNativeMethod(e,"getAppId")),t}function u(e){e=JSON.parse(e);return e.ad_source_id&&(e.adsource_id=e.ad_source_id),"string"==typeof e.custom_rule&&(e.custom_rule=JSON.parse(e.custom_rule)),e}(A=e.GDPRLevel||(e.GDPRLevel={}))[A.PERSONALIZED=0]="PERSONALIZED",A[A.NONPERSONALIZED=1]="NONPERSONALIZED",A[A.UNKNOWN=2]="UNKNOWN",e.NativeViewItem=function(e,t,n,i,a,o,l){this.x=e,this.y=t,this.width=n,this.height=i,this.backgroundColor=a,this.textColor=o,this.textSize=l},e.NativeViewProperty=function(){},(A=d=e.JSB||(e.JSB={})).fullClassName=function(e){if(o())return("3"===cc.ENGINE_VERSION.charAt(0)?"com.cocos.service."+e:"org.cocos2dx.javascript.service."+e).replace(/\./g,"/");if(l()){e=e.split(".");return e[e.length-1]}return"only support Android or iOS platform!"},A.callNativeMethod=function(e,t){for(var n,i=[],a=2;a<arguments.length;a++)i[a-2]=arguments[a];return(n=jsb.reflection).callStaticMethod.apply(n,S([e,t],i))},A.isAndroid=o,A.isIOS=l,(A=a=a||{}).onStarted=function(e,t,n){var i=s();if(i){if((n=n||{}).adType=e,n.adEvent=t,n.cocos_uid=r(),n.cocos_appid=c(),n.extInfo&&"string"==typeof n.extInfo){var a,o=JSON.parse(n.extInfo);for(a in o)n[a]=o[a];delete n.extInfo}d.isAndroid()?d.callNativeMethod(i,"onStarted","(Ljava/lang/String;Ljava/lang/String;)V","cocos_ad_topon",JSON.stringify(n)):d.isIOS()&&d.callNativeMethod(i,"onStarted:eventBody:","cocos_ad_topon",JSON.stringify(n))}},A.onSucceed=function(e,t,n){var i=s();if(i){if((n=n||{}).adType=e,n.adEvent=t,n.cocos_uid=r(),n.cocos_appid=c(),n.extInfo&&"string"==typeof n.extInfo){var a,o=JSON.parse(n.extInfo);for(a in o)n[a]=o[a];delete n.extInfo}d.isAndroid()?d.callNativeMethod(i,"onSuccess","(Ljava/lang/String;Ljava/lang/String;)V","cocos_ad_topon",JSON.stringify(n)):d.isIOS()&&d.callNativeMethod(i,"onSuccess:eventBody:","cocos_ad_topon",JSON.stringify(n))}},A.onCancelled=function(e,t,n){var i=s();if(i){if((n=n||{}).adType=e,n.adEvent=t,n.cocos_uid=r(),n.cocos_appid=c(),n.extInfo&&"string"==typeof n.extInfo){var a,o=JSON.parse(n.extInfo);for(a in o)n[a]=o[a];delete n.extInfo}d.isAndroid()?d.callNativeMethod(i,"onCancelled","(Ljava/lang/String;Ljava/lang/String;)V","cocos_ad_topon",JSON.stringify(n)):d.isIOS()&&d.callNativeMethod(i,"onCancelled:eventBody:","cocos_ad_topon",JSON.stringify(n))}},A.onFailed=function(e,t,n,i){var a=s();if(a){if((i=i||{}).adType=e,i.adEvent=t,i.cocos_uid=r(),i.cocos_appid=c(),i.extInfo&&"string"==typeof i.extInfo){var o,l=JSON.parse(i.extInfo);for(o in l)i[o]=l[o];delete i.extInfo}d.isAndroid()?d.callNativeMethod(a,"onFailed","(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V","cocos_ad_topon",JSON.stringify(i),n):d.isIOS()&&d.callNativeMethod(a,"onFailed:eventBody:reason:","cocos_ad_topon",JSON.stringify(i),n)}},function(e){var t=(n.prototype.getPlacementId=function(){return this.placementId},n.prototype.loadBanner=function(e){d.callNativeMethod(this.className,"load","(Ljava/lang/String;Ljava/lang/String;)V",this.placementId,e)},n.prototype.isAdReady=function(){return d.callNativeMethod(this.className,"isAdReady","(Ljava/lang/String;)Z",this.placementId)},n.prototype.showAdInPosition=function(e){d.callNativeMethod(this.className,"showWithPosition","(Ljava/lang/String;Ljava/lang/String;)V",this.placementId,e)},n.prototype.showAdInRectangle=function(e){d.callNativeMethod(this.className,"showWithRect","(Ljava/lang/String;Ljava/lang/String;)V",this.placementId,e)},n.prototype.removeAd=function(){d.callNativeMethod(this.className,"remove","(Ljava/lang/String;)V",this.placementId)},n.prototype.reshowAd=function(){d.callNativeMethod(this.className,"reshow","(Ljava/lang/String;)V",this.placementId)},n.prototype.hideAd=function(){d.callNativeMethod(this.className,"hide","(Ljava/lang/String;)V",this.placementId)},n);function n(e){this.placementId=e,this.className=d.fullClassName("ServiceTopOnAd$BannerBridge")}e.Banner=t;i.prototype.getPlacementId=function(){return this.placementId},i.prototype.loadInterstitial=function(e){d.callNativeMethod(this.className,"load","(Ljava/lang/String;Ljava/lang/String;)V",this.placementId,e)},i.prototype.showAd=function(e){e?d.callNativeMethod(this.className,"show","(Ljava/lang/String;Ljava/lang/String;)V",this.placementId,e):d.callNativeMethod(this.className,"show","(Ljava/lang/String;)V",this.placementId)},i.prototype.isAdReady=function(){return d.callNativeMethod(this.className,"isAdReady","(Ljava/lang/String;)Z",this.placementId)},i.prototype.checkAdStatus=function(){return d.callNativeMethod(this.className,"checkAdStatus","(Ljava/lang/String;)Ljava/lang/String;",this.placementId)},t=i;function i(e){this.placementId=e,this.className=d.fullClassName("ServiceTopOnAd$InterstitialBridge")}e.Interstitial=t;a.prototype.getPlacementId=function(){return this.placementId},a.prototype.loadNative=function(e){d.callNativeMethod(this.className,"load","(Ljava/lang/String;Ljava/lang/String;)V",this.placementId,e)},a.prototype.isAdReady=function(){return d.callNativeMethod(this.className,"isAdReady","(Ljava/lang/String;)Z",this.placementId)},a.prototype.showAd=function(e){d.callNativeMethod(this.className,"show","(Ljava/lang/String;Ljava/lang/String;)V",this.placementId,e)},a.prototype.removeAd=function(){d.callNativeMethod(this.className,"remove","(Ljava/lang/String;)V",this.placementId)},a.prototype.clean=function(){d.callNativeMethod(this.className,"clean","(Ljava/lang/String;)V",this.placementId)},t=a;function a(e){this.placementId=e,this.className=d.fullClassName("ServiceTopOnAd$NativeAdBridge")}e.Native=t;o.prototype.getPlacementId=function(){return this.placementId},o.prototype.loadRewardVideo=function(e){d.callNativeMethod(this.className,"load","(Ljava/lang/String;Ljava/lang/String;)V",this.placementId,e)},o.prototype.showAd=function(e){e?d.callNativeMethod(this.className,"show","(Ljava/lang/String;Ljava/lang/String;)V",this.placementId,e):d.callNativeMethod(this.className,"show","(Ljava/lang/String;)V",this.placementId)},o.prototype.isAdReady=function(){return d.callNativeMethod(this.className,"isAdReady","(Ljava/lang/String;)Z",this.placementId)},o.prototype.checkAdStatus=function(){return d.callNativeMethod(this.className,"checkAdStatus","(Ljava/lang/String;)Ljava/lang/String;",this.placementId)},t=o;function o(e){this.placementId=e,this.className=d.fullClassName("ServiceTopOnAd$RewardVideoBridge")}e.RewardVideo=t;l.prototype.initCustomMap=function(e){d.callNativeMethod(this.className,"initCustomMap","(Ljava/lang/String;)V",e)},l.prototype.setPlacementCustomMap=function(e,t){d.callNativeMethod(this.className,"setPlacementCustomMap","(Ljava/lang/String;Ljava/lang/String;)V",e,t)},l.prototype.setGDPRLevel=function(e){d.callNativeMethod(this.className,"setGDPRLevel","(I)V",e)},l.prototype.getGDPRLevel=function(){return d.callNativeMethod(this.className,"getGDPRLevel","()I")},l.prototype.getUserLocation=function(){d.callNativeMethod(this.className,"getUserLocation","()V")},l.prototype.showGDPRAuth=function(){d.callNativeMethod(this.className,"showGDPRAuth","()V")},l.prototype.setLogDebug=function(e){d.callNativeMethod(this.className,"setLogDebug","(Z)V",e)},l.prototype.deniedUploadDeviceInfo=function(e){d.callNativeMethod(this.className,"deniedUploadDeviceInfo","(Ljava/lang/String;)V",e)},l.prototype.integrationChecking=function(){d.callNativeMethod(this.className,"integrationChecking","()V")},t=l;function l(){this.className=d.fullClassName("ServiceTopOnAd")}e.TopOnAd=t}(t=e.Android||(e.Android={})),function(e){var t=(n.prototype.getPlacementId=function(){return this.placementId},n.prototype.loadBanner=function(e){d.callNativeMethod(this.className,"loadBannerWithPlacementID:extra:",this.placementId,e)},n.prototype.isAdReady=function(){return d.callNativeMethod(this.className,"bannerReadyForPlacementID:",this.placementId)},n.prototype.showAdInPosition=function(e){d.callNativeMethod(this.className,"showBannerWithPlacementID:position:",this.placementId,e)},n.prototype.showAdInRectangle=function(e){d.callNativeMethod(this.className,"showBannerWithPlacementID:rect:",this.placementId,e)},n.prototype.removeAd=function(){d.callNativeMethod(this.className,"removeAd:",this.placementId)},n.prototype.reshowAd=function(){d.callNativeMethod(this.className,"reshowAd:",this.placementId)},n.prototype.hideAd=function(){d.callNativeMethod(this.className,"hideAd:",this.placementId)},n);function n(e){this.placementId=e,this.className=d.fullClassName("BannerBridge")}e.Banner=t;i.prototype.getPlacementId=function(){return this.placementId},i.prototype.loadInterstitial=function(e){d.callNativeMethod(this.className,"loadInterstitialWithPlacementID:extra:",this.placementId,e)},i.prototype.showAd=function(e){d.callNativeMethod(this.className,"showInterstitialWithPlacementID:scene:",this.placementId,e||null)},i.prototype.isAdReady=function(){return d.callNativeMethod(this.className,"interstitialReadyForPlacementID:",this.placementId)},i.prototype.checkAdStatus=function(){return d.callNativeMethod(this.className,"checkAdStatus:",this.placementId)},t=i;function i(e){this.placementId=e,this.className=d.fullClassName("InterstitialBridge")}e.Interstitial=t;a.prototype.getPlacementId=function(){return this.placementId},a.prototype.loadNative=function(e){d.callNativeMethod(this.className,"loadNativeWithPlacementID:extra:",this.placementId,e)},a.prototype.isAdReady=function(){return d.callNativeMethod(this.className,"nativeReadyForPlacementID:",this.placementId)},a.prototype.showAd=function(e){d.callNativeMethod(this.className,"showNativeWithPlacementID:metrics:",this.placementId,e)},a.prototype.removeAd=function(){d.callNativeMethod(this.className,"removeNativeWithPlacementID:",this.placementId)},a.prototype.clean=function(){},t=a;function a(e){this.placementId=e,this.className=d.fullClassName("NativeBridge")}e.Native=t;o.prototype.getPlacementId=function(){return this.placementId},o.prototype.loadRewardVideo=function(e){d.callNativeMethod(this.className,"loadRewardedVideoWithPlacementID:extra:",this.placementId,e)},o.prototype.showAd=function(e){d.callNativeMethod(this.className,"showRewardedVideoWithPlacementID:scene:",this.placementId,e||null)},o.prototype.isAdReady=function(){return d.callNativeMethod(this.className,"rewardedVideoReadyForPlacementID:",this.placementId)},o.prototype.checkAdStatus=function(){return d.callNativeMethod(this.className,"checkAdStatus:",this.placementId)},t=o;function o(e){this.placementId=e,this.className=d.fullClassName("RewardVideoBridge")}e.RewardVideo=t;l.prototype.initCustomMap=function(e){d.callNativeMethod(this.className,"setCustomData:",e)},l.prototype.setPlacementCustomMap=function(e,t){d.callNativeMethod(this.className,"setCustomData:forPlacementID:",t,e)},l.prototype.setGDPRLevel=function(e){d.callNativeMethod(this.className,"setDataConsent:",e)},l.prototype.getGDPRLevel=function(){return d.callNativeMethod(this.className,"dataConsent")},l.prototype.getUserLocation=function(){d.callNativeMethod(this.className,"getUserLocation")},l.prototype.showGDPRAuth=function(){d.callNativeMethod(this.className,"presentDataConsentDialog")},l.prototype.setLogDebug=function(e){d.callNativeMethod(this.className,"setDebugLog:",e)},l.prototype.deniedUploadDeviceInfo=function(e){d.callNativeMethod(this.className,"deniedUploadDeviceInfo:",e)},l.prototype.integrationChecking=function(){d.callNativeMethod(this.className,"integrationChecking")},t=l;function l(){this.className=d.fullClassName("ServiceTopOnAd")}e.TopOnAd=t}(n=e.iOS||(e.iOS={})),(A=i=e.Listener||(e.Listener={})).parseCallbackInfo=u,A.TopOn={userLocationCallback:void 0,setCallback:function(e){this.userLocationCallback=e},onUserLocation:function(e){var t;null!==(t=this.userLocationCallback)&&void 0!==t&&t.call(this,e)}},A.Banner={listenerMap:new Map,setListener:function(e,t){this.listenerMap.set(e,t)},onBannerAdLoaded:function(e){var t;a.onSucceed("Banner","onBannerAdLoaded",{placementId:e}),null!==(e=null===(t=this.listenerMap.get(e))||void 0===t?void 0:t.onBannerAdLoaded)&&void 0!==e&&e.call(t)},onBannerAdFailed:function(e,t){var n;a.onFailed("Banner","onBannerAdFailed",t,{placementId:e}),null!==(e=null===(n=this.listenerMap.get(e))||void 0===n?void 0:n.onBannerAdFailed)&&void 0!==e&&e.call(n,t)},onBannerAdClicked:function(e,t){var n;a.onSucceed("Banner","onBannerAdClicked",{placementId:e,extInfo:t}),null!==(e=null===(n=this.listenerMap.get(e))||void 0===n?void 0:n.onBannerAdClicked)&&void 0!==e&&e.call(n,u(t))},onBannerAdShow:function(e,t){var n;a.onSucceed("Banner","onBannerAdShow",{placementId:e,extInfo:t}),null!==(e=null===(n=this.listenerMap.get(e))||void 0===n?void 0:n.onBannerAdShow)&&void 0!==e&&e.call(n,u(t))},onBannerAdClose:function(e,t){var n;a.onSucceed("Banner","onBannerAdClose",{placementId:e,extInfo:t}),null!==(e=null===(n=this.listenerMap.get(e))||void 0===n?void 0:n.onBannerAdClose)&&void 0!==e&&e.call(n,u(t))},onBannerAdAutoRefreshed:function(e,t){var n;a.onSucceed("Banner","onBannerAdAutoRefreshed",{placementId:e,extInfo:t}),null!==(e=null===(n=this.listenerMap.get(e))||void 0===n?void 0:n.onBannerAdAutoRefreshed)&&void 0!==e&&e.call(n,u(t))},onBannerAdAutoRefreshFail:function(e,t){var n;a.onFailed("Banner","onBannerAdAutoRefreshFail",t,{placementId:e}),null!==(e=null===(n=this.listenerMap.get(e))||void 0===n?void 0:n.onBannerAdAutoRefreshFail)&&void 0!==e&&e.call(n,t)},onBannerAdCloseButtonTapped:function(e,t){var n;a.onSucceed("Banner","onBannerAdCloseButtonTapped",{placementId:e,extInfo:t}),null!==(e=null===(n=this.listenerMap.get(e))||void 0===n?void 0:n.onBannerAdCloseButtonTapped)&&void 0!==e&&e.call(n,u(t))},onDeeplinkCallback:function(e,t,n){var i;a.onSucceed("Banner","onDeeplinkCallback",{placementId:e,extInfo:t,isSuccess:"true"===n}),null!==(e=null===(i=this.listenerMap.get(e))||void 0===i?void 0:i.onDeeplinkCallback)&&void 0!==e&&e.call(i,u(t),"true"===n)}},A.Interstitial={listenerMap:new Map,setListener:function(e,t){this.listenerMap.set(e,t)},onInterstitialAdLoaded:function(e){var t;a.onSucceed("Interstitial","onInterstitialAdLoaded",{placementId:e}),null!==(e=null===(t=this.listenerMap.get(e))||void 0===t?void 0:t.onInterstitialAdLoaded)&&void 0!==e&&e.call(t)},onInterstitialAdLoadFail:function(e,t){var n;a.onFailed("Interstitial","onInterstitialAdLoadFail",t,{placementId:e}),null!==(e=null===(n=this.listenerMap.get(e))||void 0===n?void 0:n.onInterstitialAdLoadFail)&&void 0!==e&&e.call(n,t)},onInterstitialAdClicked:function(e,t){var n;a.onSucceed("Interstitial","onInterstitialAdClicked",{placementId:e,extInfo:t}),null!==(e=null===(n=this.listenerMap.get(e))||void 0===n?void 0:n.onInterstitialAdClicked)&&void 0!==e&&e.call(n,u(t))},onInterstitialAdShow:function(e,t){var n;a.onSucceed("Interstitial","onInterstitialAdShow",{placementId:e,extInfo:t}),null!==(e=null===(n=this.listenerMap.get(e))||void 0===n?void 0:n.onInterstitialAdShow)&&void 0!==e&&e.call(n,u(t))},onInterstitialAdClose:function(e,t){var n;a.onSucceed("Interstitial","onInterstitialAdClose",{placementId:e,extInfo:t}),null!==(e=null===(n=this.listenerMap.get(e))||void 0===n?void 0:n.onInterstitialAdClose)&&void 0!==e&&e.call(n,u(t))},onInterstitialAdVideoStart:function(e,t){var n;a.onSucceed("Interstitial","onInterstitialAdVideoStart",{placementId:e,extInfo:t}),null!==(e=null===(n=this.listenerMap.get(e))||void 0===n?void 0:n.onInterstitialAdVideoStart)&&void 0!==e&&e.call(n,u(t))},onInterstitialAdVideoEnd:function(e,t){var n;a.onSucceed("Interstitial","onInterstitialAdVideoEnd",{placementId:e,extInfo:t}),null!==(e=null===(n=this.listenerMap.get(e))||void 0===n?void 0:n.onInterstitialAdVideoEnd)&&void 0!==e&&e.call(n,u(t))},onInterstitialAdVideoError:function(e,t){var n;a.onFailed("Interstitial","onInterstitialAdVideoError",t,{placementId:e}),null!==(e=null===(n=this.listenerMap.get(e))||void 0===n?void 0:n.onInterstitialAdVideoError)&&void 0!==e&&e.call(n,t)},onInterstitialAdFailedToShow:function(e,t,n){var i;a.onSucceed("Interstitial","onInterstitialAdFailedToShow",{placementId:e,extInfo:n}),null!==(e=null===(i=this.listenerMap.get(e))||void 0===i?void 0:i.onInterstitialAdFailedToShow)&&void 0!==e&&e.call(i,t,u(n))},onDeeplinkCallback:function(e,t,n){var i;a.onSucceed("Interstitial","onDeeplinkCallback",{placementId:e,extInfo:t,isSuccess:"true"===n}),null!==(e=null===(i=this.listenerMap.get(e))||void 0===i?void 0:i.onDeeplinkCallback)&&void 0!==e&&e.call(i,u(t),"true"===n)}},A.Native={listenerMap:new Map,setListener:function(e,t){this.listenerMap.set(e,t)},onNativeAdLoaded:function(e){var t;a.onSucceed("Native","onNativeAdLoaded",{placementId:e}),null!==(e=null===(t=this.listenerMap.get(e))||void 0===t?void 0:t.onNativeAdLoaded)&&void 0!==e&&e.call(t)},onNativeAdLoadFail:function(e,t){var n;a.onFailed("Native","onNativeAdLoadFail",t,{placementId:e}),null!==(e=null===(n=this.listenerMap.get(e))||void 0===n?void 0:n.onNativeAdLoadFail)&&void 0!==e&&e.call(n,t)},onNativeAdShow:function(e,t){var n;a.onSucceed("Native","onNativeAdShow",{placementId:e,extInfo:t}),null!==(e=null===(n=this.listenerMap.get(e))||void 0===n?void 0:n.onNativeAdShow)&&void 0!==e&&e.call(n,u(t))},onNativeAdClick:function(e,t){var n;a.onSucceed("Native","onNativeAdClick",{placementId:e,extInfo:t}),null!==(e=null===(n=this.listenerMap.get(e))||void 0===n?void 0:n.onNativeAdClick)&&void 0!==e&&e.call(n,u(t))},onNativeAdVideoStart:function(e){var t;a.onSucceed("Native","onNativeAdVideoStart",{placementId:e}),null!==(e=null===(t=this.listenerMap.get(e))||void 0===t?void 0:t.onNativeAdVideoStart)&&void 0!==e&&e.call(t)},onNativeAdVideoEnd:function(e){var t;a.onSucceed("Native","onNativeAdVideoEnd",{placementId:e}),null!==(e=null===(t=this.listenerMap.get(e))||void 0===t?void 0:t.onNativeAdVideoEnd)&&void 0!==e&&e.call(t)},onNativeAdVideoProgress:function(e,t){var n;null!==(e=null===(n=this.listenerMap.get(e))||void 0===n?void 0:n.onNativeAdVideoProgress)&&void 0!==e&&e.call(n,parseInt(t))},onNativeAdCloseButtonClick:function(e,t){var n;a.onSucceed("Native","onNativeAdCloseButtonClick",{placementId:e,extInfo:t}),null!==(e=null===(n=this.listenerMap.get(e))||void 0===n?void 0:n.onNativeAdCloseButtonClick)&&void 0!==e&&e.call(n,u(t))},onDeeplinkCallback:function(e,t,n){var i;a.onSucceed("Native","onDeeplinkCallback",{placementId:e,extInfo:t,isSuccess:"true"===n}),null!==(e=null===(i=this.listenerMap.get(e))||void 0===i?void 0:i.onDeeplinkCallback)&&void 0!==e&&e.call(i,u(t),"true"===n)}},A.RewardVideo={listenerMap:new Map,setListener:function(e,t){this.listenerMap.set(e,t)},onRewardedVideoAdLoaded:function(e){var t;a.onSucceed("RewardVideo","onNativeAdCloseButtonClick",{placementId:e}),null!==(e=null===(t=this.listenerMap.get(e))||void 0===t?void 0:t.onRewardedVideoAdLoaded)&&void 0!==e&&e.call(t)},onRewardedVideoAdFailed:function(e,t){var n;a.onFailed("RewardVideo","onRewardedVideoAdFailed",t,{placementId:e}),null!==(e=null===(n=this.listenerMap.get(e))||void 0===n?void 0:n.onRewardedVideoAdFailed)&&void 0!==e&&e.call(n,t)},onRewardedVideoAdPlayStart:function(e,t){var n;a.onSucceed("RewardVideo","onRewardedVideoAdPlayStart",{placementId:e,extInfo:t}),null!==(e=null===(n=this.listenerMap.get(e))||void 0===n?void 0:n.onRewardedVideoAdPlayStart)&&void 0!==e&&e.call(n,u(t))},onRewardedVideoAdPlayEnd:function(e,t){var n;a.onSucceed("RewardVideo","onRewardedVideoAdPlayEnd",{placementId:e,extInfo:t}),null!==(e=null===(n=this.listenerMap.get(e))||void 0===n?void 0:n.onRewardedVideoAdPlayEnd)&&void 0!==e&&e.call(n,u(t))},onRewardedVideoAdPlayFailed:function(e,t,n){var i;a.onSucceed("RewardVideo","onRewardedVideoAdPlayFailed",{placementId:e,extInfo:n}),null!==(e=null===(i=this.listenerMap.get(e))||void 0===i?void 0:i.onRewardedVideoAdPlayFailed)&&void 0!==e&&e.call(i,t,u(n))},onRewardedVideoAdClosed:function(e,t){var n;a.onSucceed("RewardVideo","onRewardedVideoAdClosed",{placementId:e,extInfo:t}),null!==(e=null===(n=this.listenerMap.get(e))||void 0===n?void 0:n.onRewardedVideoAdClosed)&&void 0!==e&&e.call(n,u(t))},onRewardedVideoAdPlayClicked:function(e,t){var n;a.onSucceed("RewardVideo","onRewardedVideoAdPlayClicked",{placementId:e,extInfo:t}),null!==(e=null===(n=this.listenerMap.get(e))||void 0===n?void 0:n.onRewardedVideoAdPlayClicked)&&void 0!==e&&e.call(n,u(t))},onReward:function(e,t){var n;a.onSucceed("RewardVideo","onReward",{placementId:e,extInfo:t}),null!==(e=null===(n=this.listenerMap.get(e))||void 0===n?void 0:n.onReward)&&void 0!==e&&e.call(n,u(t))},onDeeplinkCallback:function(e,t,n){var i;a.onSucceed("RewardVideo","onDeeplinkCallback",{placementId:e,extInfo:t,isSuccess:"true"===n}),null!==(e=null===(i=this.listenerMap.get(e))||void 0===i?void 0:i.onDeeplinkCallback)&&void 0!==e&&e.call(i,u(t),"true"===n)}};var p=(v.prototype.loadBanner=function(e){var t;e&&e.banner_ad_size_struct&&(e.width=e.banner_ad_size_struct.width,e.height=e.banner_ad_size_struct.height),null!==(t=this.banner)&&void 0!==t&&t.loadBanner(e?JSON.stringify(e):"")},v.prototype.isAdReady=function(){var e;return(null===(e=this.banner)||void 0===e?void 0:e.isAdReady())||!1},v.prototype.showAdInPosition=function(e){var t;null!==(t=this.banner)&&void 0!==t&&t.showAdInPosition(e)},v.prototype.showAdInRectangle=function(e){var t;null!==(t=this.banner)&&void 0!==t&&t.showAdInRectangle(JSON.stringify(e))},v.prototype.removeAd=function(){var e;null!==(e=this.banner)&&void 0!==e&&e.removeAd()},v.prototype.reshowAd=function(){var e;null!==(e=this.banner)&&void 0!==e&&e.reshowAd()},v.prototype.hideAd=function(){var e;null!==(e=this.banner)&&void 0!==e&&e.hideAd()},v.prototype.setAdListener=function(e){this.banner&&i.Banner.setListener(this.banner.getPlacementId(),e)},v);function v(e){d.isAndroid()?this.banner=new t.Banner(e):d.isIOS()&&(this.banner=new n.Banner(e))}e.Banner=p;var h=(f.prototype.loadInterstitial=function(e){var t;null!==(t=this.interstitial)&&void 0!==t&&t.loadInterstitial(e?JSON.stringify(e):"")},f.prototype.showAd=function(e){var t;null!==(t=this.interstitial)&&void 0!==t&&t.showAd(e)},f.prototype.isAdReady=function(){var e;return(null===(e=this.interstitial)||void 0===e?void 0:e.isAdReady())||!1},f.prototype.checkAdStatus=function(){if(this.interstitial){var e=JSON.parse(this.interstitial.checkAdStatus());return e.adInfo&&e.adInfo.custom_rule&&"string"==typeof e.custom_rule&&("string"==typeof e.adInfo&&(e.adInfo=JSON.parse(e.adInfo)),e.adInfo.custom_rule=JSON.parse(e.adInfo.custom_rule)),e}},f.prototype.setAdListener=function(e){this.interstitial&&i.Interstitial.setListener(this.interstitial.getPlacementId(),e)},f);function f(e){d.isAndroid()?this.interstitial=new t.Interstitial(e):d.isIOS()&&(this.interstitial=new n.Interstitial(e))}e.Interstitial=h;var I=(N.prototype.loadNative=function(e){var t;null!==(t=this.native)&&void 0!==t&&t.loadNative(e?JSON.stringify(e):"")},N.prototype.isAdReady=function(){var e;return(null===(e=this.native)||void 0===e?void 0:e.isAdReady())||!1},N.prototype.showAd=function(e){var t;null!==(t=this.native)&&void 0!==t&&t.showAd(JSON.stringify(e))},N.prototype.removeAd=function(){var e;null!==(e=this.native)&&void 0!==e&&e.removeAd()},N.prototype.clean=function(){var e;null!==(e=this.native)&&void 0!==e&&e.clean()},N.prototype.setAdListener=function(e){this.native&&i.Native.setListener(this.native.getPlacementId(),e)},N);function N(e){d.isAndroid()?this.native=new t.Native(e):d.isIOS()&&(this.native=new n.Native(e))}e.Native=I;var m=(g.prototype.loadRewardVideo=function(e){var t;null!==(t=this.rewardVideo)&&void 0!==t&&t.loadRewardVideo(e?JSON.stringify(e):"")},g.prototype.showAd=function(e){var t;null!==(t=this.rewardVideo)&&void 0!==t&&t.showAd(e)},g.prototype.isAdReady=function(){var e;return(null===(e=this.rewardVideo)||void 0===e?void 0:e.isAdReady())||!1},g.prototype.checkAdStatus=function(){if(this.rewardVideo){var e=JSON.parse(this.rewardVideo.checkAdStatus());return e.adInfo&&e.adInfo.custom_rule&&"string"==typeof e.custom_rule&&("string"==typeof e.adInfo&&(e.adInfo=JSON.parse(e.adInfo)),e.adInfo.custom_rule=JSON.parse(e.adInfo.custom_rule)),e}},g.prototype.setAdListener=function(e){this.rewardVideo&&i.RewardVideo.setListener(this.rewardVideo.getPlacementId(),e)},g);function g(e){d.isAndroid()?this.rewardVideo=new t.RewardVideo(e):d.isIOS()&&(this.rewardVideo=new n.RewardVideo(e))}e.RewardVideo=m;var A=(y.prototype.initCustomMap=function(e){var t;null!==(t=this.toponAd)&&void 0!==t&&t.initCustomMap(JSON.stringify(e))},y.prototype.setPlacementCustomMap=function(e,t){var n;null!==(n=this.toponAd)&&void 0!==n&&n.setPlacementCustomMap(e,JSON.stringify(t))},y.prototype.setGDPRLevel=function(e){var t;null!==(t=this.toponAd)&&void 0!==t&&t.setGDPRLevel(e)},y.prototype.getGDPRLevel=function(){var e;return(null===(e=this.toponAd)||void 0===e?void 0:e.getGDPRLevel())||0},y.prototype.getUserLocation=function(e){i.TopOn.setCallback(e),null!==(e=this.toponAd)&&void 0!==e&&e.getUserLocation()},y.prototype.showGDPRAuth=function(){var e;null!==(e=this.toponAd)&&void 0!==e&&e.showGDPRAuth()},y.prototype.setLogDebug=function(e){var t;null!==(t=this.toponAd)&&void 0!==t&&t.setLogDebug(e)},y.prototype.deniedUploadDeviceInfo=function(e){var t;null!==(t=this.toponAd)&&void 0!==t&&t.deniedUploadDeviceInfo(e)},y.prototype.integrationChecking=function(){var e;null!==(e=this.toponAd)&&void 0!==e&&e.integrationChecking()},y.prototype.getBanner=function(e,t){e=new p(e);return t&&e.setAdListener(t),e},y.prototype.getInterstitial=function(e,t){e=new h(e);return t&&e.setAdListener(t),e},y.prototype.getNative=function(e,t){e=new I(e);return t&&e.setAdListener(t),e},y.prototype.getRewardVideo=function(e,t){e=new m(e);return t&&e.setAdListener(t),e},y);function y(){d.isAndroid()?this.toponAd=new t.TopOnAd:d.isIOS()&&(this.toponAd=new n.TopOnAd)}e.TopOnAd=A,e.toponService=new A}(i=i||{}),(a=globalThis||window).topon=a.topon||i},{}]},{},[1]);