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
Gf="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split("");funct
ion Hf(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]=Gf[19==e?c&3|8:c]);this.uuid=b.join("");this.callback=a}
function If(a){var b=y.imalib_globalCallbacks||new
Map,d=b.get("AFMA_updateActiveView")||[];if(0===d.length&&y.AFMA_updateActiveView)
{var c=new Hf(y.AFMA_updateActiveView);d.push(c);y.AFMA_updateActiveView=void
0}y.AFMA_updateActiveView||(y.AFMA_updateActiveView=function(){var
e=b.get("AFMA_updateActiveView");e=fa(e);for(var g=e.next();!
g.done;g=e.next())g.value.callback.apply(null,arguments)});a=new
Hf(a);d.push(a);b.set("AFMA_updateActiveView",d);y.imalib_globalCallbacks=b;return
a.uuid}
function Jf(a){if(y.AFMA_updateActiveView){var b=y.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&&(y.AFMA_updateActiveView=void
0),b.set("AFMA_updateActiveView",d),y.imalib_globalCallbacks=b)}}}};function Kf()
{var a=this;this.l=[];this.j=window===window.top;this.m=!
1;this.h=0;this.i=null;"undefined"!==typeof
window.addEventListener&&window.addEventListener("message",function(b){return
Lf(a,b)})}
function Lf(a,b){var d=b.data;if((b=b.source)&&d){var
c=a.l;if("arwebview_iframe_loaded"===d&&a.j)Fa("JavascriptWebViewBridge.incoming.po
stMessage",a.o.bind(a)),-1===c.indexOf(b)&&c.push(b);else{var
e=d.messageName;d=d.parameters;if(a.j)switch(e){case "mraid_loaded":!
1===d.is_top_win&&(a.m=!0,a.i=If(function(g){a.j&&Mf(a,new
Z("update_activeview_action",g))}),-1===c.indexOf(b)&&(c.push(b),"undefined"!
==typeof b.postMessage&&b.postMessage(new
Z("mraid_env_obj",window.MRAID_ENV),"*")));break;case "start_tracking_action":0==
a.h&&window.AFMA_SendMessage("trackActiveViewUnit");a.h+=1;break;case
"stop_tracking_action":--
a.h,0==a.h&&(window.AFMA_SendMessage("untrackActiveViewUnit",
{hashCode:d.hashCode}),a.i&&(Jf(a.i),a.i=null))}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)}}}}
Kf.prototype.o=function(a){this.j&&Mf(this,
{name:"arwebview_message_forwarded",message:a})};function Mf(a,b)
{a.l.forEach(function(d){return d.postMessage(b,"*")})};function Nf()
{P.call(this);this.i=Bf();this.i=Bf();var a=Ea(Cd,this.i);this.C?a():(this.m||
(this.m=[]),this.m.push(a));this.h={};this.l=new
Kf}r(Nf,P);l=Nf.prototype;l.sendMessage=function(a,b){var
d=this,c;"string"===typeof a?c=new Z(a,b):a instanceof
Z&&(c=a);"loading"==document.readyState?Yd(y,"DOMContentLoaded",function(){return
d.i.sendMessage(c)},!1,this):this.i.sendMessage(c)};
l.receiveMessage=function(a,b)
{if(this.shouldForwardMessageToIframe())this.forwardMessage(new
Z("receive_message_action",new Z(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(y,"DOMContentLoaded",function(){return
Of(a,null!=b?b:void 0)}):ie(this,new qf(new Z(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.h[a]||(this.h[a]={});this.h[a]
[b]=c};l.removeObserver=function(a,b){this.h[a]&&this.h[a]
[b]&&(Sd(this.j,String(a),this.h[a][b]),delete this.h[a]
[b])};l.shouldForwardMessageToIframe=function(){return
this.l.m};l.forwardMessage=function(a){Mf(this.l,a)};function Pf(a,b)
{y.AFMA_Communicator?y.AFMA_Communicator.sendMessage(a,b):Qf(a,b)}
function Qf(a,b){"loading"==document.readyState?
(a=Da(Qf,null,a,b),Yd(y,"DOMContentLoaded",a,!1)):(a=new
Z(a,b),Bf().sendMessage(a))}function Of(a,b)
{y.AFMA_Communicator.receiveMessage(a,b)}function Rf(a,b,d,c)
{y.AFMA_Communicator.removeEventListener(a,b,d,c)}function Sf(a,b,d,c)
{y.AFMA_Communicator.addEventListener(a,b,d,c)}function Tf(a,b,d)
{y.AFMA_Communicator.addObserver(a,b,d)}function Uf(a,b)
{y.AFMA_Communicator.removeObserver(a,b)}
y.AFMA_Communicator||
(Fa("AFMA_AddEventListener",Sf),Fa("AFMA_RemoveEventListener",Rf),Fa("AFMA_AddObser
ver",Tf),Fa("AFMA_RemoveObserver",Uf),Fa("AFMA_ReceiveMessage",Of),Fa("AFMA_SendMes
sage",Pf),y.AFMA_Communicator=new Nf);Sf("onshow",function()
{});Sf("onhide",function(){});function Vf(a,b){P.call(this);var d=this;this.h=b;
$d(a,"wtaClicked",function(c){if(d.h.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:Wf(c);break;case 2:Xf(c);break;case
3:Wf(c),Xf(c)}})}r(Vf,P);
function Wf(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 Xf(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 Yf(){this.h=this.i=null}
Yf.prototype.createAttributionCard=function(a){var
b=this;this.h=a;Fd(480,function(){if(b.h.hasUserFeedbackData){var
d=JSON.stringify(b.h.serializedAttributionData);if(null==d||""==d)d=new
Yb;else{d=JSON.parse(d);if(!Array.isArray(d))throw Error(void 0);d=Eb(Yb,jb(d))}var
c=xb(d,Wb,1);c=G(c);if(!(c&&(D(c,1)&&D(c,2)||
D(c,11)&&D(c,12))&&D(c,3)&&D(c,5)&&D(c,6)&&D(c,7)))throw Error("invalid jspb
ufd");b.i=new gf(d,b.h);new Vf(b.i,b.h)}else throw Error("bad card ufd");})};
Yf.prototype.expandAttributionCard=function(){var a=this;Fd(481,function(){null!
=a.i&&(a.i.va(),a.i.pa())})};var Zf=new Yf;Jc(5,y).resolve(Zf);}).call(this);