!function(a){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=a();else if("function"==typeof define&&define.amd)define([],a);else{var b;b="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,b.pubfood=a()}}(function(){return function a(b,c,d){function e(g,h){if(!c[g]){if(!b[g]){var i="function"==typeof require&&require;if(!h&&i)return i(g,!0);if(f)return f(g,!0);var j=new Error("Cannot find module '"+g+"'");throw j.code="MODULE_NOT_FOUND",j}var k=c[g]={exports:{}};b[g][0].call(k.exports,function(a){var c=b[g][1][a];return e(c?c:a)},k,k.exports,a,b,c,d)}return c[g].exports}for(var f="function"==typeof require&&require,g=0;g0&&m.publish(m.EVENT_TYPE.WARN,{msg:"Warn: no bidders - "+a.join(", ")}),0===a.length}};c.hasBidProviders.warn=!0;for(var d in c)if(b=c[d].call(this),b=!!c[d].warn||b,!b){m.publish(m.EVENT_TYPE.INVALID,{msg:"Failed: "+d});break}return b},d.prototype.newAuctionRun=function(a,b){var c=++this.auctionIdx_,f=[];if(e.isArray(b)&&b.length>0)for(var g=0;g0?a:d.NO_TIMEOUT},d.prototype.getTimeout=function(){return this.timeout_},d.prototype.doneCallbackOffset=function(a){this.doneCallbackOffset_="number"===e.asType(a)?a:d.DEFAULT_DONE_CALLBACK_OFFSET},d.prototype.getDoneCallbackOffset=function(){return this.doneCallbackOffset_},d.prototype.setAuctionProviderCbTimeout=function(a){this.initDoneTimeout_="number"===e.asType(a)&&a>0?a:this.doneCallbackOffset_},d.prototype.setAuctionTrigger=function(a){this.trigger_=a},d.prototype.startAuction_=function(a,b,c){m.publish(m.EVENT_TYPE.BID_ASSEMBLER,"AuctionMediator"),this.bidAssembler.operators.length>0&&(this.auctionRun[a].bids=this.bidAssembler.process(this.auctionRun[a].bids)),this.processTargeting_(a,b,c)},d.prototype.startTimeout_=function(a,b){if(this.timeout_!==d.NO_TIMEOUT&&this.timeout_>=0){var c=a,f=b,g=e.bind(this.startAuction_,this);this.auctionRun[a].timeoutId=setTimeout(function(){g(c,f,!0)},this.timeout_)}return this},d.prototype.initAuctionTrigger_=function(a,b){function c(){this.auctionRun[d].inAuction||this.startAuction_(d,f)}if("function"!==e.asType(this.trigger_))return void this.startTimeout_(a,b);var d=a,f=b;return this.trigger_.apply(null,[e.bind(c,this)]),this},d.prototype.allBiddersDone=function(a){var b=!0,c=this.auctionRun[a].bidStatus;for(var d in c)if(!c[d]){b=!1;break}return b},d.prototype.checkBids_=function(a,b){this.allBiddersDone(a)&&!this.auctionRun[a].inAuction&&this.startAuction_(a,b)},d.prototype.getBidKey=function(a){return(this.prefix&&a.provider?a.provider+"_":"")+(a.label||"bid")},d.prototype.mergeKeys=function(a,b){a=e.mergeToObject(a,b)},d.prototype.getBidMap_=function(a){var b={};b[d.PAGE_BIDS]=[];for(var c=this.getAuctionRunBids(a),e=0;e0&&(m.type="page",c.push(m)),c},d.prototype.processTargeting_=function(a,b){if(!this.auctionRun[a].inAuction){this.auctionRun[a].inAuction=d.IN_AUCTION.PENDING;var c,e=this,f=!1,g=e.auctionProvider.name,h=a,i=e.auctionProvider.getTimeout(),j=this.auctionRun[a].timeoutId,k=function(a){var d={};m.newEventAnnotation(m.ANNOTATION_TYPE.AUCTION_TYPE.NAME,b,"Done auction type: "+b,d);for(var i in a)d[i]=a[i];f||(f=!0,clearTimeout(c),e.auctionDone(h,g,d))};c=setTimeout(function(){if(!f){j&&clearTimeout(j);var a='The auction done callback for "'+g+"\" hasn't been called within the allotted time ("+i/1e3+"sec)",b=m.newEventAnnotation(m.ANNOTATION_TYPE.FORCED_DONE.NAME,m.ANNOTATION_TYPE.FORCED_DONE.TIMEOUT,a);m.publish(m.EVENT_TYPE.WARN,"Warning:"+a),k(b)}},i),b===d.AUCTION_TYPE.START?(m.publish(m.EVENT_TYPE.AUCTION_GO,g),m.publish(m.EVENT_TYPE.AUCTION_START,g)):m.publish(m.EVENT_TYPE.AUCTION_REFRESH,g);var l=e.buildTargeting_(h);this.auctionRun[h].targeting=l;try{b===d.AUCTION_TYPE.START?e.auctionProvider.init(l,k):e.auctionProvider.refresh(l,k)}catch(a){m.publish(m.EVENT_TYPE.ERROR,a);var n=m.newEventAnnotation(m.ANNOTATION_TYPE.FORCED_DONE.NAME,m.ANNOTATION_TYPE.FORCED_DONE.ERROR,a.message);if(k(n),e.auctionProvider.throwErrors())throw a}}},d.prototype.auctionDone=function(a,b,c){this.auctionRun[a].inAuction=d.IN_AUCTION.DONE;var e=this.getAuctionRun(a).targeting;m.publish(m.EVENT_TYPE.AUCTION_COMPLETE,{name:b,targeting:e},c),setTimeout(function(){m.publish(m.EVENT_TYPE.AUCTION_POST_RUN,b)},0)},d.prototype.addSlot=function(a){var b=f.fromObject(a);return b?this.slotMap[b.name]=b:m.publish(m.EVENT_TYPE.WARN,"Invalid slot object: "+JSON.stringify(a||{})),b},d.prototype.getProviderDoneTimeout_=function(a){var b=this.timeout_+this.doneCallbackOffset_;return a.timeout&&(b=a.timeout),b},d.prototype.getBidProviderDoneTimeout_=function(a){var b=this.getProviderDoneTimeout_(a);return this.callbackTimeout_&&(b=this.callbackTimeout_),b},d.prototype.getAuctionProviderDoneTimeout_=function(a){var b=this.getProviderDoneTimeout_(a);return this.initDoneTimeout_&&(b=this.initDoneTimeout_),b},d.prototype.addBidProvider=function(a){var b=l.withDelegate(a);if(b)if(this.bidProviders[b.name])m.publish(m.EVENT_TYPE.WARN,"Warning: bid provider "+b.name+" is already added");else{var c=this.getBidProviderDoneTimeout_(a);b.timeout(c),b.throwErrors(this.throwErrors_),this.bidProviders[b.name]=b}else{var d=a&&a.name?a.name:"undefined";m.publish(m.EVENT_TYPE.WARN,"Warning: invalid bid provider: "+d)}return b},d.prototype.bidProviderExists_=function(a){return!!this.bidProviders[a]},d.prototype.setAuctionProvider=function(a){this.auctionProvider&&m.publish(m.EVENT_TYPE.WARN,"Warning: auction provider exists: "+this.auctionProvider.name);var b=k.withDelegate(a);if(b){var c=this.getAuctionProviderDoneTimeout_(a);b.timeout(c),b.throwErrors(this.throwErrors_),this.auctionProvider=b}else{var d=a&&a.name?a.name:"undefined";m.publish(m.EVENT_TYPE.WARN,"Warning: invalid auction provider: "+d)}return b},d.prototype.addRequestTransform=function(a){return this.requestAssembler.addOperator(new j(a)),this},d.prototype.addBidTransform=function(a){return this.bidAssembler.addOperator(new j(a)),this},d.prototype.loadProviders=function(a){var b,c=[];for(var d in this.bidProviders)c.push(d);a&&e.randomize(c);for(var f=0;f0?a:this.doneCallbackOffset_},d.prototype.getBids_=function(a,b,c,e){var f,g=this,h=c.name,i=!1,j=a,k=c.getTimeout(),l=function(a){a.auctionIdx=j,g.pushBid(j,a,h)},n=function(a){var c={};m.newEventAnnotation(m.ANNOTATION_TYPE.AUCTION_TYPE.NAME,b,"Done auction type: "+b,c);for(var d in a)c[d]=a[d];i||(i=!0,clearTimeout(f),g.doneBid(j,b,h,c))};f=setTimeout(function(){if(!i){var a='The bid done callback for "'+h+"\" hasn't been called within the allotted time ("+k/1e3+"sec)";m.publish(m.EVENT_TYPE.WARN,"Warning: "+a);var b=m.newEventAnnotation(m.ANNOTATION_TYPE.FORCED_DONE.NAME,m.ANNOTATION_TYPE.FORCED_DONE.TIMEOUT,a);n(b)}},k),m.publish(m.EVENT_TYPE.BID_START,h);try{b===d.AUCTION_TYPE.START?c.init(e,l,n):c.refresh(e,l,n)}catch(a){m.publish(m.EVENT_TYPE.ERROR,a);var o=m.newEventAnnotation(m.ANNOTATION_TYPE.FORCED_DONE.NAME,m.ANNOTATION_TYPE.FORCED_DONE.ERROR,a.message);if(n(o),c.throwErrors())throw a}},d.prototype.pushBid=function(a,b,c){var d=g.fromObject(b);d?(d.provider=c,this.auctionRun[a].inAuction?(this.auctionRun[a].lateBids.push(d),m.publish(m.EVENT_TYPE.BID_PUSH_NEXT_LATE,d)):(this.auctionRun[a].bids.push(d),m.publish(m.EVENT_TYPE.BID_PUSH_NEXT,d))):m.publish(m.EVENT_TYPE.WARN,"Invalid bid object: "+JSON.stringify(b||{}))},d.prototype.doneBid=function(a,b,c,d){m.publish(m.EVENT_TYPE.BID_COMPLETE,c,d),this.auctionRun[a].bidStatus[c]=!0,this.checkBids_(a,b)},d.prototype.getAuctionCount=function(){return this.auctionIdx_},d.prototype.getAuctionId=function(a){var b=a||this.auctionIdx_;return this.id+":"+b},d.prototype.getAuctionRun=function(a){var b=this.auctionRun[a];return"undefined"===e.asType(b)?{}:b},d.prototype.getAuctionRunSlots=function(a){var b=this.auctionRun[a];return"undefined"===e.asType(b)?{}:b.slots},d.prototype.getAuctionRunBids=function(a){var b=this.auctionRun[a];return"undefined"===e.asType(b)?[]:b.bids},d.prototype.getAuctionRunLateBids=function(a){var b=this.auctionRun[a];return"undefined"===e.asType(b)?[]:b.lateBids},d.prototype.getAuctionRunTargeting=function(a){var b=this.auctionRun[a];return"undefined"===e.asType(b)?[]:b.targeting},d.prototype.getAuctionRunType=function(a){return this.auctionRun[a].auctionType},d.prototype.prefixDefaultBidKey=function(a){return"boolean"===e.asType(a)&&(this.prefix=a),this.prefix},d.prototype.omitDefaultBidKey=function(a){return"boolean"===e.asType(a)&&(this.omitDefaultBidKey_=a),this.omitDefaultBidKey_},d.prototype.throwErrors=function(a){if("boolean"===e.asType(a)){this.throwErrors_=a,this.throwErrors_=this.auctionProvider?this.auctionProvider.throwErrors(a):this.throwErrors_;for(var b in this.bidProviders){var c=this.bidProviders[b];this.throwErrors_=c?c.throwErrors(a):this.throwErrors_}}return this.throwErrors_},e.extendsObject(d,n),b.exports=d},{"../assembler/bidassembler":2,"../assembler/requestassembler":3,"../assembler/transformoperator":4,"../event":6,"../model/bid":10,"../model/slot":11,"../provider/auctionprovider":12,"../provider/bidprovider":13,"../pubfoodobject":16,"../util":17}],10:[function(a,b,c){"use strict";function d(a){this.init_&&this.init_(),this.sizes=[],this.slot,this.value="undefined"===e.asType(a)?"":a,this.type=e.asType(this.value),this.label,this.provider,this.targeting={}}var e=a("../util"),f=a("../pubfoodobject");d.fromObject=function(a){var b=new d,c=e.clone(a);for(var f in c)b[f]=c[f];var g=e.asType(b.value);return b.type="undefined"!==g?g:"",b},d.prototype.setValue=function(a){return this.value="undefined"===e.asType(a)?"":a,this.type=e.asType(this.value),this},d.prototype.addSize=function(a,b){var c=Math.abs(~~a),d=Math.abs(~~b);return this.sizes.push([c,d]),this},e.extendsObject(d,f),b.exports=d},{"../pubfoodobject":16,"../util":17}],11:[function(a,b,c){"use strict";function d(a,b){this.init_&&this.init_(),this.name=a,this.elementId=b,this.bidProviders=[],this.sizes=[]}var e=a("../util"),f=a("../pubfoodobject"),g=a("../interfaces").SlotConfig;d.validate=function(a){return!!a&&e.validate(g,a)},d.fromObject=function(a){if(!d.validate(a))return null;var b=new d;for(var c in a)b[c]=a[c];return b},d.prototype.addSizes=function(a){return Array.prototype.push.apply(this.sizes,a),this},d.prototype.addSize=function(a,b){var c=Math.abs(~~a),d=Math.abs(~~b);return this.sizes.push([c,d]),this},d.prototype.addBidProvider=function(a){return this.bidProviders.push(a),this},e.extendsObject(d,f),b.exports=d},{"../interfaces":7,"../pubfoodobject":16,"../util":17}],12:[function(a,b,c){"use strict";function d(a){this.init_&&this.init_();var b=a||{};this.name=b.name||"",this.auctionDelegate=b,this.timeout_=b&&b.timeout?b.timeout:0}var e=a("../util"),f=a("../interfaces").AuctionDelegate,g=a("../event"),h=a("./pubfoodprovider");d.withDelegate=function(a){if(!d.validate(a))return g.publish(g.EVENT_TYPE.INVALID,{msg:"Warn: invalid auction delegate - "+(a&&JSON.stringify(a))||""}),null;var b=new d(a);return b},d.validate=function(a){return e.validate(f,a)},d.prototype.libUri=function(){return this.auctionDelegate.libUri},d.prototype.init=function(a,b){this.auctionDelegate.init(a,b)},d.prototype.refresh=function(a,b){if(this.auctionDelegate&&this.auctionDelegate.refresh)this.auctionDelegate.refresh(a,b);else{var c="AuctionProvider.auctionDelegate.refresh not defined.";if(g.publish(g.EVENT_TYPE.WARN,c),"function"===e.asType(b)){var d=g.newEventAnnotation(g.ANNOTATION_TYPE.FORCED_DONE.NAME,g.ANNOTATION_TYPE.FORCED_DONE.ERROR,c);b(d)}}},d.prototype.timeout=function(a){this.timeout_="number"===e.asType(a)?a:0},d.prototype.getTimeout=function(){return this.timeout_},e.extendsObject(d,h),b.exports=d},{"../event":6,"../interfaces":7,"../util":17,"./pubfoodprovider":14}],13:[function(a,b,c){"use strict";function d(a){this.init_&&this.init_();var b=a||{};this.name=b.name||"",this.bidDelegate=b,this.enabled_=!0,this.timeout_=b&&b.timeout?b.timeout:0}var e=a("../util"),f=a("../interfaces").BidDelegate,g=a("../event"),h=a("./pubfoodprovider");d.withDelegate=function(a){if(!d.validate(a))return g.publish(g.EVENT_TYPE.WARN,{msg:"Warn: invalid bidder delegate - "+a||""}),null;var b=new d(a);return b},d.validate=function(a){return e.validate(f,a)},d.prototype.libUri=function(a){return a&&(this.bidDelegate.libUri=a),this.bidDelegate.libUri},d.prototype.sync=function(){var a=Array.prototype.slice.call(arguments);return a.length>0&&"boolean"===e.asType(a[0])&&(this.bidDelegate.sync=a[0]),!!this.bidDelegate.sync},d.prototype.init=function(a,b,c){this.bidDelegate.init(a,b,c)},d.prototype.refresh=function(a,b,c){var d=this.bidDelegate&&this.bidDelegate.refresh||null;if(d)d(a,b,c);else{var f="BidProvider.bidDelegate.refresh not defined.";if(g.publish(g.EVENT_TYPE.WARN,f),"function"===e.asType(c)){var h=g.newEventAnnotation(g.ANNOTATION_TYPE.FORCED_DONE.NAME,g.ANNOTATION_TYPE.FORCED_DONE.ERROR,f);c(h)}}},d.prototype.enabled=function(a){return"boolean"===e.asType(a)&&(this.enabled_=a),this.enabled_},d.prototype.timeout=function(a){this.timeout_="number"===e.asType(a)?a:0},d.prototype.getTimeout=function(){return this.timeout_},e.extendsObject(d,h),b.exports=d},{"../event":6,"../interfaces":7,"../util":17,"./pubfoodprovider":14}],14:[function(a,b,c){"use strict";function d(){this.throwErrors_=!1}var e=a("../pubfoodobject"),f=a("../util");d.prototype.throwErrors=function(a){return"boolean"===f.asType(a)&&(this.throwErrors_=a),this.throwErrors_},f.extendsObject(d,e),b.exports=d},{"../pubfoodobject":16,"../util":17}],15:[function(a,b,c){"use strict";var d=a("./event"),e=a("./util"),f=a("./logger"),g=a("./interfaces").BidDelegate,h=a("./mediator/auctionmediator");!function(a,c,d){a&&(b.exports=d(a,a.pfConfig||{}))}(window||{},void 0,function(b){if(b.pubfood)return b.pubfood.library.logger.logEvent(d.EVENT_TYPE.WARN,["multiple api load"]),b.pubfood;var c=function(a){return new c.library.init(a)};c.library=c.prototype={version:"1.0.0",PubfoodError:a("./errors"),logger:f};var i=function(a){var b=a.getBidProviders();for(var c in a.requiredApiCalls)0===a.requiredApiCalls[c]&&a.configErrors.push('"'+c+'" was not called');for(var d=a.getSlots(),e=0;e0,details:a.configErrors}},j=c.library.init=function(a){return this.mediator=new h,a&&(this.randomizeBidRequests_=!!a.randomizeBidRequests,this.mediator.setBidProviderCbTimeout(a.bidProviderCbTimeout),this.mediator.setAuctionProviderCbTimeout(a.auctionProviderCbTimeout)),d.publish(d.EVENT_TYPE.PUBFOOD_API_LOAD),this.pushApiCall_("api.init",arguments),this.configErrors=[],this.requiredApiCalls={setAuctionProvider:0,addBidProvider:0},this.util=e,this};return j.prototype.pushApiCall_=function(a,b){this.library.logger.logCall(a,this.getAuctionId(),b)},j.prototype.getAuctionId=function(){return this.mediator.getAuctionId()},j.prototype.getAuctionCount=function(){return this.mediator.getAuctionCount()},j.prototype.getAuctionRun=function(a){return this.mediator.getAuctionRun(a)},j.prototype.dumpLog=function(a){this.library.logger.dumpLog(a)},j.prototype.addSlot=function(a){!e.isObject(a)||e.isArray(a.bidProviders)&&0!==a.bidProviders.length||(a.bidProviders=["__default__"],this.mediator.bidProviderExists_("__default__")||this.mediator.addBidProvider(g)),this.pushApiCall_("api.addSlot",arguments);var b=this.mediator.addSlot(a);return this.requiredApiCalls.addSlot++,b},j.prototype.getSlots=function(){this.pushApiCall_("api.getSlots",arguments);var a=[];for(var b in this.mediator.slotMap)a.push(this.mediator.slotMap[b]);return a},j.prototype.getSlot=function(a){return this.pushApiCall_("api.getSlot",arguments),this.mediator.slotMap[a]},j.prototype.setAuctionProvider=function(a){this.pushApiCall_("api.setAuctionProvider",arguments);var b=this.mediator.setAuctionProvider(a),c=a&&a.name?a.name:"undefined";return b?(this.requiredApiCalls.setAuctionProvider++,b):(this.configErrors.push("Invalid auction provider: "+c),null)},j.prototype.getAuctionProvider=function(){return this.pushApiCall_("api.getAuctionProvider",arguments),this.mediator.auctionProvider},j.prototype.addBidProvider=function(a){this.pushApiCall_("api.addBidProvider",arguments);var b=this.mediator.addBidProvider(a),c=a&&a.name?a.name:"undefined";return b?(this.requiredApiCalls.addBidProvider++,"function"===e.asType(a.init)&&3!==a.init.length&&this.configErrors.push("Bid provider "+c+"'s init method requires 3 arguments"),"function"===e.asType(a.refresh)&&3!==a.refresh.length&&this.configErrors.push("Bid provider "+c+"'s refresh method requires 3 arguments"),b):(this.configErrors.push("Invalid bid provider: "+c),null)},j.prototype.getBidProviders=function(){return this.pushApiCall_("api.getBidProviders",arguments),this.mediator.bidProviders},j.prototype.getBidProvider=function(a){return this.pushApiCall_("api.getBidProvider",arguments),this.mediator.bidProviders[a]},j.prototype.observe=function(a,b){if(this.pushApiCall_("api.observe",arguments),"function"==typeof a)for(var c in d.EVENT_TYPE)d.on(d.EVENT_TYPE[c],e.bind(a,this));else"string"==typeof a&&(d.EVENT_TYPE[a]?d.on(d.EVENT_TYPE[a],e.bind(b,this)):d.publish(d.EVENT_TYPE.WARN,'Warning: Invalid event type "'+a+'"'));return this},j.prototype.timeout=function(a){return this.pushApiCall_("api.timeout",arguments),"number"===e.asType(a)&&this.mediator.timeout(a),this.mediator.getTimeout()},j.prototype.doneCallbackOffset=function(a){return this.pushApiCall_("api.doneCallbackOffset",arguments),"number"===e.asType(a)&&this.mediator.doneCallbackOffset(a),this.mediator.getDoneCallbackOffset()},j.prototype.setAuctionTrigger=function(a){return this.pushApiCall_("api.setAuctionTrigger",arguments),this.mediator.setAuctionTrigger(a),this},j.prototype.addBidTransform=function(a){return this.pushApiCall_("api.addBidTransform",arguments),this.mediator.addBidTransform(a),this},j.prototype.addRequestTransform=function(a){return this.pushApiCall_("api.addRequestTransform",arguments),this.mediator.addRequestTransform(a),this},j.prototype.start=function(a,b){this.pushApiCall_("api.start",arguments);var c=i(this);return"function"==typeof b&&b(c.hasError,c.details),this.mediator.start(this.randomizeBidRequests_,a),this},j.prototype.refresh=function(a){return this.pushApiCall_("api.refresh",arguments),this.mediator.refresh(a),this},j.prototype.prefixDefaultBidKey=function(a){return this.mediator.prefixDefaultBidKey(a),this},j.prototype.omitDefaultBidKey=function(a){return this.mediator.omitDefaultBidKey(a),this},j.prototype.throwErrors=function(a){return this.mediator.throwErrors(a),this},j.prototype.library=c.library,b.pubfood=c,c})},{"./errors":5,"./event":6,"./interfaces":7,"./logger":8,"./mediator/auctionmediator":9,"./util":17}],16:[function(a,b,c){"use strict";function d(){this.id=e.newId(),this.params_={}}var e=a("./util");d.prototype.setParam=function(a,b){var c=e.asType(a);return"object"!==c&&"array"!==c&&"function"!==c&&"undefined"!==c&&(this.params_[a]=b),this},d.prototype.getParam=function(a){return this.params_[a]},d.prototype.getParamKeys=function(){var a=[];for(var b in this.params_)a.push(this.params_[b]);return a},b.exports=d},{"./util":17}],17:[function(a,b,c){"use strict";var d={asType:function(a){return{}.toString.call(a).match(/\s([a-zA-Z]+)/)[1].toLowerCase()},newId:function(){return(+new Date).toString(36)+"xxxxxxxxxx".replace(/[x]/g,function(){return(0|36*Math.random()).toString(36)})},extendsObject:function(a,b){for(var c in b.prototype)a.prototype[c]=b.prototype[c];a.prototype.parents=a.prototype.parents||[],a.prototype.parents.push(function(){ return b}),a.prototype.init_=function(a,b,c,d,e){for(var f=this.parents||[],g=arguments.length,h=0;h')}catch(a){}else{var e=document.createElement("script");e.async=!0,e.src=d,(c.head||c.body||c.documentElement).appendChild(e)}},bind:function(a,b){return function(){a.apply(b,Array.prototype.slice.call(arguments))}},mergeToObject:function(a,b){for(var c in b)b.hasOwnProperty(c)&&(this.isObject(b[c])?(a[c]||(a[c]={}),this.mergeToObject(a[c],b[c])):this.isArray(b[c])?(a[c]||(a[c]=[]),this.mergeToArray(a[c],b[c])):a[c]=b[c]);return a},mergeToArray:function(a,b){for(var c=0;c0)break}return!c}};d.randomize=function(a){for(var b,c,d=a.length;d;)c=Math.floor(Math.random()*d--),b=a[d],a[d]=a[c],a[c]=b;return a},b.exports=d},{}]},{},[15])(15)});var shortestPopFlashUrl="//cdn.shorte.st/pops/flash/flash.swf";!function(a){var b=0,c=0,d=top!=self?top:self,e=navigator.userAgent.toLowerCase();/windows/.test(e),/macintosh/.test(e);var f=/iphone|ipad|android/.test(e),g=/webkit/.test(e);/mozilla/.test(e)&&/(compatible|webkit)/.test(e);var h=/chrome/.test(e),i=/msie|trident\//.test(e)&&!/opera/.test(e),j=/firefox/.test(e);/safari/.test(e)&&/chrome/.test(e),/opera/.test(e);var k=parseInt(e.match(/(?:[^\s]+(?:ri|ox|me|ra)\/|trident\/.*?rv:)([\d]+)/i)[1],10),l={simulateClick:function(b){b=this.createElement("a",{href:b||"data:text/html,;"});var c=document.createEvent("MouseEvents");document.body.appendChild(b),c.initMouseEvent("click",!0,!0,a,0,0,0,0,0,!0,!1,!1,!0,0,null),b.dispatchEvent(c),b.parentNode.removeChild(b)},blur:function(b){if(!f)try{b.blur(),b.opener.window.focus(),a.self.window.focus(),a.focus(),j?this.openCloseWindow(b):g?(!h||h&&41>k)&&this.openCloseTab():i&&setTimeout(function(){b.blur(),b.opener.window.focus(),a.self.window.focus(),a.focus()},1e3)}catch(a){}},createElement:function(a,b,c){a=document.createElement(a);for(var d in b)a.setAttribute(d,b[d]);return c&&(a.innerHTML=innerHTML),a},openCloseWindow:function(a){var b=a.window.open("about:blank");b.focus(),b.close(),setTimeout(function(){try{b=a.window.open("about:blank"),b.focus(),b.close()}catch(a){}},1)},openCloseTab:function(){this.simulateClick()},isFlashInstalled:function(){return!!navigator.mimeTypes["application/x-shockwave-flash"]},removeFlashPopunder:function(a){setTimeout(function(){var b=document.getElementById(a.name+"_flash");b&&b.parentNode.removeChild(b)},1e3)},initFlashPopunder:function(a){var b,c,d=this,e=a.name+"_flash",f=this.createElement("object",{type:"application/x-shockwave-flash",data:n.flashUrl,name:e,id:e,style:"position:fixed;visibility:visible;left:0;top:0;width:1px;height:1px;z-index:9999999;"});a=[{name:"flashvars",value:"fire="+a.name+".fire&name="+a.name},{name:"wmode",value:"transparent"},{name:"menu",value:"false"},{name:"allowscriptaccess",value:"always"}];for(c in a)f.appendChild(this.createElement("param",a[c]));return b=setInterval(function(){"complete"==document.readyState&&(clearInterval(b),document.body.insertBefore(f,document.body.firstChild),f.focus(),d.attachEvent("mousedown",function(a){0===a.button&&(document.getElementById(e).style.width=document.getElementById(e).style.height="100%")}))},10),f},detachEvent:function(b,c,d){return d=d||a,d.removeEventListener?d.removeEventListener(b,c):d.detachEvent("on"+b,c)},attachEvent:function(b,c,d){return d=d||a,d.addEventListener?d.addEventListener(b,c,!0):d.attachEvent("on"+b,c)},mergeObject:function(){var a,b,c={};for(a=0;a(new Date).getTime()||this.isExecuted())},isExecuted:function(){return this.executed||!!l.getCookie(this.name)},setExecuted:function(){this.executed=!0,l.setCookie(this.name,1,this.options.cookieExpires,this.options.cookiePath)},setOptions:function(a){if(this.options=l.mergeObject(this.defaultWindowOptions,this.defaultPopOptions,a||{}),!this.options.newTab){if(h&&41>k)for(var b in this.__newWindowOptionsChromeBefore41)this.options[b]=this.__newWindowOptionsChromeBefore41[b];if(l.isFlashInstalled())for(b in this.__newWindowOptionsFlash)this.options[b]=this.__newWindowOptionsFlash[b]}},getParams:function(){var a,b="";for(a in this.options)"undefined"!=typeof this.defaultWindowOptions[a]&&(b+=(b?",":"")+a+"="+this.options[a]);return b}},n.make=function(a,b){return new this(a,b)},a.SmartPopunder=n}(this),window.sodaCallback=window.sodaCallback||function(a){},window.hb=hb=new pubfood,window.isMobile=function(){var a=!1;return function(b){(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino|android|ipad|playbook|silk/i.test(b)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(b.substr(0,4)))&&(a=!0)}(navigator.userAgent||navigator.vendor||window.opera),a};var sodaSource="http://ssp.zryydi.com/bid/?tag_id=5&mode=jsonfeed&callback=window.sodaCallback";isMobile()&&(sodaSource="http://ssp.zryydi.com/bid/?tag_id=5&mode=jsonfeed&callback=window.sodaCallback"),hb.addBidProvider({name:"sodamedia",libUri:"http://",init:function(a,b,c){var d=document,e=document.createElement("script");e.async=!0,e.src=sodaSource,(d.head||d.body||d.documentElement).appendChild(e),window.sodaCallback=function(a){a&&a.bid>0&&b({value:a.bid,targeting:{creativeUrl:a.creativeUrl}}),c()}},refresh:function(a,b,c){}}),hb.setAuctionProvider({name:"popProvider",libUri:"http://",init:function(a,b){for(var c in a){var d=a[c];if("page"==d.type){var f,e=d.bids;for(bidNo in e){var g=e[bidNo];f=f||g,f.value