Professional Documents
Culture Documents
Math.uuid.js (v1.4)
http://www.broofa.com
mailto:robert@broofa.com
Copyright (c) 2010 Robert Kieffer
Dual licensed under the MIT and GPL licenses.
*/
var
If="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split("");funct
ion Jf(a){for(var b=Array(36),d=0,c,e=0;36>e;e++)8==e||13==e||18==e||23==e?
b[e]="-":14==e?b[e]="4":(2>=d&&(d=33554432+16777216*Math.random()|
0),c=d&15,d>>=4,b[e]=If[19==e?c&3|8:c]);this.uuid=b.join("");this.callback=a}
function Kf(a){var b=t.imalib_globalCallbacks||new
Map,d=b.get("AFMA_updateActiveView")||[];if(0===d.length&&t.AFMA_updateActiveView)
{var c=new Jf(t.AFMA_updateActiveView);d.push(c);t.AFMA_updateActiveView=void
0}t.AFMA_updateActiveView||(t.AFMA_updateActiveView=function(){var
e=b.get("AFMA_updateActiveView");e=ha(e);for(var k=e.next();!
k.done;k=e.next())k.value.callback.apply(null,arguments)});a=new
Jf(a);d.push(a);b.set("AFMA_updateActiveView",d);t.imalib_globalCallbacks=b;return
a.uuid}
function Lf(a){if(t.AFMA_updateActiveView){var b=t.imalib_globalCallbacks;if(b){var
d=b.get("AFMA_updateActiveView");if(d){var c=d.findIndex(function(e){return
e.uuid===a});-1!==c&&(d.splice(c,1),0===d.length&&(t.AFMA_updateActiveView=void
0),b.set("AFMA_updateActiveView",d),t.imalib_globalCallbacks=b)}}}};function Mf()
{var a=this;this.j=[];this.i=window===window.top;this.l=!
1;this.g=0;this.h=null;"undefined"!==typeof
window.addEventListener&&window.addEventListener("message",function(b){return
Nf(a,b)})}
function Nf(a,b){var d=b.data;if((b=b.source)&&d){var
c=a.j;if("arwebview_iframe_loaded"===d&&a.i)Ga("JavascriptWebViewBridge.incoming.po
stMessage",a.m.bind(a)),-1===c.indexOf(b)&&c.push(b);else{var
e=d.messageName;d=d.parameters;if(a.i)switch(e){case
"mraid_loaded":d=d.is_top_win;!1===d&&(a.l=!0,a.h=Kf(function(k){a.i&&Of(a,new
rf("update_activeview_action",k))}),-1===c.indexOf(b)&&(c.push(b),"undefined"!
==typeof b.postMessage&&b.postMessage(new
rf("mraid_env_obj",window.MRAID_ENV),"*")));break;
case
"start_tracking_action":0==a.g&&window.AFMA_SendMessage("trackActiveViewUnit");a.g+
=1;break;case "stop_tracking_action":--
a.g;0==a.g&&(window.AFMA_SendMessage("untrackActiveViewUnit",
{hashCode:d.hashCode}),a.h&&(Lf(a.h),a.h=null));break;case
"register_iframe_window_action":d=d.is_top_win,!1===d&&-
1===c.indexOf(b)&&c.push(b)}else switch(e){case
"mraid_env_obj":window.MRAID_ENV=d;break;case
"update_activeview_action":window.AFMA_updateActiveView&&window.AFMA_updateActiveVi
ew(d);break;case "receive_message_action":window.AFMA_ReceiveMessage(d.messageName,
d.parameters)}}}}Mf.prototype.m=function(a){this.i&&Of(this,
{name:"arwebview_message_forwarded",message:a})};function Of(a,b)
{a.j.forEach(function(d){return d.postMessage(b,"*")})};function Pf()
{R.call(this);this.h=Df();this.h=Df();var a=Fa(Cd,this.h);this.B?a():(this.l||
(this.l=[]),this.l.push(a));this.g={};this.j=new
Mf}p(Pf,R);l=Pf.prototype;l.sendMessage=function(a,b){var
d=this,c;"string"===typeof a?c=new rf(a,b):a instanceof
rf&&(c=a);"loading"==document.readyState?Yd(t,"DOMContentLoaded",function(){return
d.h.sendMessage(c)},!1,this):this.h.sendMessage(c)};
l.receiveMessage=function(a,b)
{if(this.shouldForwardMessageToIframe())this.forwardMessage(new
rf("receive_message_action",new rf(a,b)));else{var
d=document.getElementById("ad_iframe");void 0!=d&&void 0!=d.contentWindow&&void 0!
=d.contentWindow.AFMA_ReceiveMessage&&d.contentWindow.AFMA_ReceiveMessage(a,b)}"ons
how"==a&&"loading"==document.readyState?Yd(t,"DOMContentLoaded",function(){return
Qf(a,null!=b?b:void 0)}):ie(this,new sf(new rf(a,b),this))};
l.addObserver=function(a,b,d){function c(e){return void d.call(b,e.type,e.params)}
$d(this,a,c);this.g[a]||(this.g[a]={});this.g[a]
[b]=c};l.removeObserver=function(a,b){this.g[a]&&this.g[a]
[b]&&(Sd(this.i,String(a),this.g[a][b]),delete this.g[a]
[b])};l.shouldForwardMessageToIframe=function(){return
this.j.l};l.forwardMessage=function(a){Of(this.j,a)};function Rf(a,b)
{t.AFMA_Communicator?t.AFMA_Communicator.sendMessage(a,b):Sf(a,b)}
function Sf(a,b){"loading"==document.readyState?
(a=Ea(Sf,null,a,b),Yd(t,"DOMContentLoaded",a,!1)):(a=new
rf(a,b),Df().sendMessage(a))}function Qf(a,b)
{t.AFMA_Communicator.receiveMessage(a,b)}function Tf(a,b,d,c)
{t.AFMA_Communicator.removeEventListener(a,b,d,c)}function Uf(a,b,d,c)
{t.AFMA_Communicator.addEventListener(a,b,d,c)}function Vf(a,b,d)
{t.AFMA_Communicator.addObserver(a,b,d)}function Wf(a,b)
{t.AFMA_Communicator.removeObserver(a,b)}
t.AFMA_Communicator||
(Ga("AFMA_AddEventListener",Uf),Ga("AFMA_RemoveEventListener",Tf),Ga("AFMA_AddObser
ver",Vf),Ga("AFMA_RemoveObserver",Wf),Ga("AFMA_ReceiveMessage",Qf),Ga("AFMA_SendMes
sage",Rf),t.AFMA_Communicator=new Pf);Uf("onshow",function()
{});Uf("onhide",function(){});function Xf(a,b){R.call(this);var d=this;this.g=b;
$d(a,"wtaClicked",function(c){if(d.g.openAttributionInline){var
e=c.detail;c=e.underlyingEvent;e=e.wtaUrl;window.adSlot?
window.adSlot.openAttribution(e)&&c.preventDefault():window.openAttribution&&(windo
w.openAttribution(e),c.preventDefault())}});$d(a,"updateGpid",function(c)
{switch(c.detail.gpidType){case 1:Yf(c);break;case 2:Zf(c);break;case
3:Yf(c),Zf(c)}})}p(Xf,R);
function Yf(a){var
b=a.detail.gpidPersonalizationEnabled,d=window.AFMA_Communicator;d&&(a.detail.gpidS
houldResetAdsData&&d.sendMessage("resetPAID"),d.sendMessage("setPAIDPersonalization
Enabled",{enabled:b}))}function Zf(a){var b={userOptOut:!
a.detail.gpidPersonalizationEnabled};a.detail.gpidShouldResetAdsData&&(b.clearAdsDa
ta=!0);for(a=window;a!==a.parent&&Fc(a);)a=a.parent;b.googMsgType="gpi-
uoo";a.postMessage(JSON.stringify(b),"*")};function $f(){this.g=this.h=null}
$f.prototype.createAttributionCard=function(a){var
b=this;this.g=a;Fd(480,function(){if(b.g.hasUserFeedbackData){var
d=$b(JSON.stringify(b.g.serializedAttributionData)),c=Db(d,Yb,1);c=I(c);if(!
(c&&(G(c,1)&&G(c,2)||G(c,11)&&G(c,12))&&G(c,3)&&G(c,5)&&G(c,6)&&G(c,7)))throw
Error("invalid jspb ufd");b.h=new gf(d,b.g);new Xf(b.h,b.g)}else throw Error("bad
card ufd");})};$f.prototype.expandAttributionCard=function(){var
a=this;Fd(481,function(){null!=a.h&&(a.h.ta(),a.h.na())})};var ag=new
$f;Jc(5,t).resolve(ag);}).call(this);