function flashElement(a,b,c,d){b=b||100,d=d||"#1bb76e";var e=a.style||a[0].style;e.backgroundColor=d,setTimeout(function(){e.backgroundColor=c},b)}function checkEmailVerification(a,b){a||(a=""),$.post("/ajax/verify_email/"+a,function(c){c.data.verified?($.colorbox.close(),b&&b()):(c.data.invalid&&a&&humanMsg.displayMsg("Verification code is invalid","error-msg"),setTimeout(function(){checkEmailVerification()},1500))})}function _classCallCheck(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!b||"object"!=typeof b&&"function"!=typeof b?a:b}function _inherits(a,b){if("function"!=typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}}),b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}function _classCallCheck(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}function _classCallCheck(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!b||"object"!=typeof b&&"function"!=typeof b?a:b}function _inherits(a,b){if("function"!=typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}}),b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}function _classCallCheck(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!b||"object"!=typeof b&&"function"!=typeof b?a:b}function _inherits(a,b){if("function"!=typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}}),b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}function _classCallCheck(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!b||"object"!=typeof b&&"function"!=typeof b?a:b}function _inherits(a,b){if("function"!=typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}}),b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}function _classCallCheck(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!b||"object"!=typeof b&&"function"!=typeof b?a:b}function _inherits(a,b){if("function"!=typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}}),b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}function _classCallCheck(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(a,b){if(!a)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!b||"object"!=typeof b&&"function"!=typeof b?a:b}function _inherits(a,b){if("function"!=typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}}),b&&(Object.setPrototypeOf?Object.setPrototypeOf(a,b):a.__proto__=b)}function getColorByPostIndex(a){var b=a%GRID_COLORS_LOADING.length;return GRID_COLORS_LOADING[b]}function ArrowIcon(a){var b=a.color,c=void 0===b?"#fff":b;return React.createElement("svg",{width:"21",height:"15",viewBox:"0 0 21 15",fill:"none",xmlns:"http://www.w3.org/2000/svg"},React.createElement("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M3.37496 8.5L8.05562 13.2909C8.44161 13.6859 8.43428 14.3192 8.03926 14.7052C7.64424 15.0912 7.01113 15.0839 6.62514 14.6888L0.284746 8.19913C0.0932174 8.0031 -0.0014481 7.74844 1.67407e-05 7.49445C-0.0014481 7.24048 0.0932174 6.9859 0.284746 6.7899L6.62514 0.301116C7.01113 -0.0938954 7.64424 -0.10122 8.03926 0.284767C8.43428 0.670745 8.44161 1.30387 8.05562 1.69888L3.36427 6.5H20C20.5522 6.5 21 6.94772 21 7.5C21 8.05228 20.5522 8.5 20 8.5H3.37496Z",fill:c}))}function reinsert(a,b,c){var d=a.slice(0),e=d[b];return d.splice(b,1),d.splice(c,0,e),d}function clamp(a,b,c){return Math.max(Math.min(a,c),b)}function _toConsumableArray(a){if(Array.isArray(a)){for(var b=0,c=Array(a.length);b<a.length;b++)c[b]=a[b];return c}return Array.from(a)}function onYouTubeIframeAPIReady(){for(var a in youtube_iframes)youtube_iframes[a].dom&&!youtube_iframes[a].player&&(youtube_iframes[a].player=new YT.Player(youtube_iframes[a].dom,{events:{onReady:_.partial(onPlayerReady,a),onStateChange:_.partial(onPlayerStateChange,a)}}))}function onPlayerReady(a){youtube_iframes[a].manuallyPaused||(youtube_iframes[a].soundOn||youtube_iframes[a].player.mute(),youtube_iframes[a].player.seekTo(youtube_iframes[a].currentTime,!0),youtube_iframes[a].player.playVideo(),youtube_iframes[a].hash=youtube_iframes[a].player.getVideoData().video_id,youtube_iframes[a].videoLength=youtube_iframes[a].player.getDuration())}function onPlayerStateChange(a,b){switch(b.data){case YT.PlayerState.PAUSED:youtube_iframes[a].manuallyPaused=!0;break;case YT.PlayerState.PLAYING:youtube_iframes[a].manuallyPaused=!1}}function createImageToastHtml(a,b,c){return'<img width="32" height="32" src="'+a+'"> <span class="reason">'+b+'</span><button class="action undo" type="button" data-cancel="'+c+'">undo</button>'}function createToastHtml(a,b){return a+'</span><button class="action undo" type="button" data-cancel="'+b+'">undo</button>'}function createUndoToast(a,b,c,d,e,f,g){var h=setTimeout(function(){c(),f.decrement()},e);if(d){g||(g=$(a).find("img").first().attr("src"));var i=createImageToastHtml(g,b,h)}else var i=createToastHtml(b,h);a&&a.hide(),f.increment();var j=$.toast({text:i,hideAfter:e,position:"bottom-right",loader:!0,loaderBg:"#1bb76e",allowToastClose:!0});return $("button.action[data-cancel='"+h+"']").on("click",function(){clearTimeout(h),j.close(),a&&a.show(),f.decrement()}),f}function createCaptionUndoToast(a,b,c){var d=setTimeout(function(){c(),pendingActions--},undoDelay),e=createToastHtml(imageUrl,b,d);pendingActions++;var f=$.toast({text:e,hideAfter:undoDelay,position:"bottom-right",loader:!0,loaderBg:"#1bb76e",allowToastClose:!0});$("button.action[data-cancel='"+d+"']").on("click",function(){clearTimeout(d),f.close(),a.show(),pendingActions--})}function getRandomInRange(a){return Math.random()*(a[1]-a[0]+1)+a[0]}function isItemInView(a){return a.x<window.innerWidth&&a.y<window.innerHeight}function createParticle(a){var b=Math.random()<.15,c={};return b?(c.svg=BALLOONS[Math.floor(Math.random()*BALLOONS.length)],c.rotate=getRandomInRange(BALLOON_ROTATION_RANGE)):(c.svg=SPRINKLES[Math.floor(Math.random()*SPRINKLES.length)],c.rotate=getRandomInRange(SPRINKLE_ROTATION_RANGE)),c.speed=getRandomInRange(defaultOptions.speed),c.wind=getRandomInRange(defaultOptions.wind),c.x=getRandomInRange([0,window.innerWidth]),c.y=-10,c.key=a,c}function updateItems(a,b,c){var d=[];a.forEach(function(a){var b=getRandomInRange(defaultOptions.spin);d.push(Object.assign(a,{y:a.y+a.speed},{x:a.x+a.wind},{rotate:a.rotate+b}))});var e=d.filter(function(a){return isItemInView(a)});return b<c&&e.length<CONFETTI_ONSCREEN_LIMIT?(e.push(createParticle("particle "+(b+1))),{totalCreated:b+1,confetti:e}):{totalCreated:b,confetti:e.slice(0,c)}}function renderConfetti(a){return React.createElement("span",null,a.length>0&&a.map(function(a){return React.createElement("img",{className:"confetti-particle",src:a.svg,style:{transform:"rotateZ("+a.rotate+"deg)",top:a.y+"px",left:a.x+"px"},key:a.key})}))}!function(a,b){"object"==typeof exports&&"object"==typeof module?module.exports=b(require("react")):"function"==typeof define&&define.amd?define(["react"],b):"object"==typeof exports?exports.ReactMotion=b(require("react")):a.ReactMotion=b(a.React)}(this,function(a){return function(a){function b(d){if(c[d])return c[d].exports;var e=c[d]={exports:{},id:d,loaded:!1};return a[d].call(e.exports,e,e.exports,b),e.loaded=!0,e.exports}var c={};return b.m=a,b.c=c,b.p="build/",b(0)}([function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a["default"]:a}b.__esModule=!0;var e=c(1);b.Motion=d(e);var f=c(10);b.StaggeredMotion=d(f);var g=c(11);b.TransitionMotion=d(g);var h=c(13);b.spring=d(h);var i=c(14);b.presets=d(i);var j=c(15);b.reorderKeys=d(j)},function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{"default":a}}b.__esModule=!0;var e=Object.assign||function(a){for(var b=1;b<arguments.length;b++){var c=arguments[b];for(var d in c)Object.prototype.hasOwnProperty.call(c,d)&&(a[d]=c[d])}return a},f=c(2),g=d(f),h=c(3),i=d(h),j=c(4),k=d(j),l=c(5),m=d(l),n=c(7),o=d(n),p=c(8),q=d(p),r=c(9),s=d(r),t=1e3/60,u=s["default"].createClass({displayName:"Motion",propTypes:{defaultStyle:r.PropTypes.objectOf(r.PropTypes.number),style:r.PropTypes.objectOf(r.PropTypes.oneOfType([r.PropTypes.number,r.PropTypes.object])).isRequired,children:r.PropTypes.func.isRequired,onRest:r.PropTypes.func},getInitialState:function(){var a=this.props,b=a.defaultStyle,c=a.style,d=b||i["default"](c),e=g["default"](d);return{currentStyle:d,currentVelocity:e,lastIdealStyle:d,lastIdealVelocity:e}},wasAnimating:!1,animationID:null,prevTime:0,accumulatedTime:0,unreadPropStyle:null,clearUnreadPropStyle:function(a){var b=!1,c=this.state,d=c.currentStyle,f=c.currentVelocity,g=c.lastIdealStyle,h=c.lastIdealVelocity;for(var i in a)if(a.hasOwnProperty(i)){var j=a[i];"number"==typeof j&&(b||(b=!0,d=e({},d),f=e({},f),g=e({},g),h=e({},h)),d[i]=j,f[i]=0,g[i]=j,h[i]=0)}b&&this.setState({currentStyle:d,currentVelocity:f,lastIdealStyle:g,lastIdealVelocity:h})},startAnimationIfNecessary:function(){var a=this;this.animationID=o["default"](function(){var b=a.props.style;if(q["default"](a.state.currentStyle,b,a.state.currentVelocity))return a.wasAnimating&&a.props.onRest&&a.props.onRest(),a.animationID=null,a.wasAnimating=!1,void(a.accumulatedTime=0);a.wasAnimating=!0;var c=m["default"](),d=c-a.prevTime;if(a.prevTime=c,a.accumulatedTime=a.accumulatedTime+d,a.accumulatedTime>10*t&&(a.accumulatedTime=0),0===a.accumulatedTime)return a.animationID=null,void a.startAnimationIfNecessary();var e=(a.accumulatedTime-Math.floor(a.accumulatedTime/t)*t)/t,f=Math.floor(a.accumulatedTime/t),g={},h={},i={},j={};for(var l in b)if(b.hasOwnProperty(l)){var n=b[l];if("number"==typeof n)i[l]=n,j[l]=0,g[l]=n,h[l]=0;else{for(var o=a.state.lastIdealStyle[l],p=a.state.lastIdealVelocity[l],r=0;r<f;r++){var s=k["default"](t/1e3,o,p,n.val,n.stiffness,n.damping,n.precision);o=s[0],p=s[1]}var u=k["default"](t/1e3,o,p,n.val,n.stiffness,n.damping,n.precision),v=u[0],w=u[1];i[l]=o+(v-o)*e,j[l]=p+(w-p)*e,g[l]=o,h[l]=p}}a.animationID=null,a.accumulatedTime-=f*t,a.setState({currentStyle:i,currentVelocity:j,lastIdealStyle:g,lastIdealVelocity:h}),a.unreadPropStyle=null,a.startAnimationIfNecessary()})},componentDidMount:function(){this.prevTime=m["default"](),this.startAnimationIfNecessary()},componentWillReceiveProps:function(a){null!=this.unreadPropStyle&&this.clearUnreadPropStyle(this.unreadPropStyle),this.unreadPropStyle=a.style,null==this.animationID&&(this.prevTime=m["default"](),this.startAnimationIfNecessary())},componentWillUnmount:function(){null!=this.animationID&&(o["default"].cancel(this.animationID),this.animationID=null)},render:function(){var a=this.props.children(this.state.currentStyle);return a&&s["default"].Children.only(a)}});b["default"]=u,a.exports=b["default"]},function(a,b){"use strict";function c(a){var b={};for(var c in a)a.hasOwnProperty(c)&&(b[c]=0);return b}b.__esModule=!0,b["default"]=c,a.exports=b["default"]},function(a,b){"use strict";function c(a){var b={};for(var c in a)a.hasOwnProperty(c)&&(b[c]="number"==typeof a[c]?a[c]:a[c].val);return b}b.__esModule=!0,b["default"]=c,a.exports=b["default"]},function(a,b){"use strict";function c(a,b,c,e,f,g,h){var i=-f*(b-e),j=-g*c,k=i+j,l=c+k*a,m=b+l*a;return Math.abs(l)<h&&Math.abs(m-e)<h?(d[0]=e,d[1]=0,d):(d[0]=m,d[1]=l,d)}b.__esModule=!0,b["default"]=c;var d=[];a.exports=b["default"]},function(a,b,c){(function(b){"use strict";(function(){var c,d,e;"undefined"!=typeof performance&&null!==performance&&performance.now?a.exports=function(){return performance.now()}:"undefined"!=typeof b&&null!==b&&b.hrtime?(a.exports=function(){return(c()-e)/1e6},d=b.hrtime,c=function(){var a;return a=d(),1e9*a[0]+a[1]},e=c()):Date.now?(a.exports=function(){return Date.now()-e},e=Date.now()):(a.exports=function(){return(new Date).getTime()-e},e=(new Date).getTime())}).call(void 0)}).call(b,c(6))},function(a,b){"use strict";function c(){j=!1,g.length?i=g.concat(i):k=-1,i.length&&d()}function d(){if(!j){var a=setTimeout(c);j=!0;for(var b=i.length;b;){for(g=i,i=[];++k<b;)g&&g[k].run();k=-1,b=i.length}g=null,j=!1,clearTimeout(a)}}function e(a,b){this.fun=a,this.array=b}function f(){}var g,h=a.exports={},i=[],j=!1,k=-1;h.nextTick=function(a){var b=new Array(arguments.length-1);if(arguments.length>1)for(var c=1;c<arguments.length;c++)b[c-1]=arguments[c];i.push(new e(a,b)),1!==i.length||j||setTimeout(d,0)},e.prototype.run=function(){this.fun.apply(null,this.array)},h.title="browser",h.browser=!0,h.env={},h.argv=[],h.version="",h.versions={},h.on=f,h.addListener=f,h.once=f,h.off=f,h.removeListener=f,h.removeAllListeners=f,h.emit=f,h.binding=function(a){throw new Error("process.binding is not supported")},h.cwd=function(){return"/"},h.chdir=function(a){throw new Error("process.chdir is not supported")},h.umask=function(){return 0}},function(a,b,c){"use strict";for(var d=c(5),e="undefined"==typeof window?{}:window,f=["moz","webkit"],g="AnimationFrame",h=e["request"+g],i=e["cancel"+g]||e["cancelRequest"+g],j=0;j<f.length&&!h;j++)h=e[f[j]+"Request"+g],i=e[f[j]+"Cancel"+g]||e[f[j]+"CancelRequest"+g];if(!h||!i){var k=0,l=0,m=[],n=1e3/60;h=function(a){if(0===m.length){var b=d(),c=Math.max(0,n-(b-k));k=c+b,setTimeout(function(){var a=m.slice(0);m.length=0;for(var b=0;b<a.length;b++)if(!a[b].cancelled)try{a[b].callback(k)}catch(c){setTimeout(function(){throw c},0)}},Math.round(c))}return m.push({handle:++l,callback:a,cancelled:!1}),l},i=function(a){for(var b=0;b<m.length;b++)m[b].handle===a&&(m[b].cancelled=!0)}}a.exports=function(a){return h.call(e,a)},a.exports.cancel=function(){i.apply(e,arguments)}},function(a,b){"use strict";function c(a,b,c){for(var d in b)if(b.hasOwnProperty(d)){if(0!==c[d])return!1;var e="number"==typeof b[d]?b[d]:b[d].val;if(a[d]!==e)return!1}return!0}b.__esModule=!0,b["default"]=c,a.exports=b["default"]},function(b,c){b.exports=a},function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{"default":a}}function e(a,b,c){for(var d=0;d<a.length;d++)if(!r["default"](a[d],b[d],c[d]))return!1;return!0}b.__esModule=!0;var f=Object.assign||function(a){for(var b=1;b<arguments.length;b++){var c=arguments[b];for(var d in c)Object.prototype.hasOwnProperty.call(c,d)&&(a[d]=c[d])}return a},g=c(2),h=d(g),i=c(3),j=d(i),k=c(4),l=d(k),m=c(5),n=d(m),o=c(7),p=d(o),q=c(8),r=d(q),s=c(9),t=d(s),u=1e3/60,v=t["default"].createClass({displayName:"StaggeredMotion",propTypes:{defaultStyles:s.PropTypes.arrayOf(s.PropTypes.objectOf(s.PropTypes.number)),styles:s.PropTypes.func.isRequired,children:s.PropTypes.func.isRequired},getInitialState:function(){var a=this.props,b=a.defaultStyles,c=a.styles,d=b||c().map(j["default"]),e=d.map(function(a){return h["default"](a)});return{currentStyles:d,currentVelocities:e,lastIdealStyles:d,lastIdealVelocities:e}},animationID:null,prevTime:0,accumulatedTime:0,unreadPropStyles:null,clearUnreadPropStyle:function(a){for(var b=this.state,c=b.currentStyles,d=b.currentVelocities,e=b.lastIdealStyles,g=b.lastIdealVelocities,h=!1,i=0;i<a.length;i++){var j=a[i],k=!1;for(var l in j)if(j.hasOwnProperty(l)){var m=j[l];"number"==typeof m&&(k||(k=!0,h=!0,c[i]=f({},c[i]),d[i]=f({},d[i]),e[i]=f({},e[i]),g[i]=f({},g[i])),c[i][l]=m,d[i][l]=0,e[i][l]=m,g[i][l]=0)}}h&&this.setState({currentStyles:c,currentVelocities:d,lastIdealStyles:e,lastIdealVelocities:g})},startAnimationIfNecessary:function(){var a=this;this.animationID=p["default"](function(){var b=a.props.styles(a.state.lastIdealStyles);if(e(a.state.currentStyles,b,a.state.currentVelocities))return a.animationID=null,void(a.accumulatedTime=0);var c=n["default"](),d=c-a.prevTime;if(a.prevTime=c,a.accumulatedTime=a.accumulatedTime+d,a.accumulatedTime>10*u&&(a.accumulatedTime=0),0===a.accumulatedTime)return a.animationID=null,void a.startAnimationIfNecessary();for(var f=(a.accumulatedTime-Math.floor(a.accumulatedTime/u)*u)/u,g=Math.floor(a.accumulatedTime/u),h=[],i=[],j=[],k=[],m=0;m<b.length;m++){var o=b[m],p={},q={},r={},s={};for(var t in o)if(o.hasOwnProperty(t)){var v=o[t];if("number"==typeof v)p[t]=v,q[t]=0,r[t]=v,s[t]=0;else{for(var w=a.state.lastIdealStyles[m][t],x=a.state.lastIdealVelocities[m][t],y=0;y<g;y++){var z=l["default"](u/1e3,w,x,v.val,v.stiffness,v.damping,v.precision);w=z[0],x=z[1]}var A=l["default"](u/1e3,w,x,v.val,v.stiffness,v.damping,v.precision),B=A[0],C=A[1];p[t]=w+(B-w)*f,q[t]=x+(C-x)*f,r[t]=w,s[t]=x}}j[m]=p,k[m]=q,h[m]=r,i[m]=s}a.animationID=null,a.accumulatedTime-=g*u,a.setState({currentStyles:j,currentVelocities:k,lastIdealStyles:h,lastIdealVelocities:i}),a.unreadPropStyles=null,a.startAnimationIfNecessary()})},componentDidMount:function(){this.prevTime=n["default"](),this.startAnimationIfNecessary()},componentWillReceiveProps:function(a){null!=this.unreadPropStyles&&this.clearUnreadPropStyle(this.unreadPropStyles),this.unreadPropStyles=a.styles(this.state.lastIdealStyles),null==this.animationID&&(this.prevTime=n["default"](),this.startAnimationIfNecessary())},componentWillUnmount:function(){null!=this.animationID&&(p["default"].cancel(this.animationID),this.animationID=null)},render:function(){var a=this.props.children(this.state.currentStyles);return a&&t["default"].Children.only(a)}});b["default"]=v,a.exports=b["default"]},function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{"default":a}}function e(a,b,c){return null==b?a.map(function(a,b){return{key:a.key,data:a.data,style:c[b]}}):a.map(function(a,d){for(var e=0;e<b.length;e++)if(b[e].key===a.key)return{key:b[e].key,data:b[e].data,style:c[d]};return{key:a.key,data:a.data,style:c[d]}})}function f(a,b,c,d){if(d.length!==b.length)return!1;for(var e=0;e<d.length;e++)if(d[e].key!==b[e].key)return!1;for(var e=0;e<d.length;e++)if(!v["default"](a[e],b[e].style,c[e]))return!1;return!0}function g(a,b,c,d,e,f,g,h){for(var i=p["default"](c,d,function(a,c){var d=b(c);return null==d?null:v["default"](e[a],d,f[a])?null:{key:c.key,data:c.data,style:d}}),k=[],l=[],m=[],n=[],o=0;o<i.length;o++){for(var q=i[o],r=null,s=0;s<c.length;s++)if(c[s].key===q.key){r=s;break}if(null==r){var t=a(q);k[o]=t,m[o]=t;var u=j["default"](q.style);l[o]=u,n[o]=u}else k[o]=e[r],m[o]=g[r],l[o]=f[r],n[o]=h[r]}return[i,k,l,m,n]}b.__esModule=!0;var h=Object.assign||function(a){for(var b=1;b<arguments.length;b++){var c=arguments[b];for(var d in c)Object.prototype.hasOwnProperty.call(c,d)&&(a[d]=c[d])}return a},i=c(2),j=d(i),k=c(3),l=d(k),m=c(4),n=d(m),o=c(12),p=d(o),q=c(5),r=d(q),s=c(7),t=d(s),u=c(8),v=d(u),w=c(9),x=d(w),y=1e3/60,z=x["default"].createClass({displayName:"TransitionMotion",propTypes:{defaultStyles:w.PropTypes.arrayOf(w.PropTypes.shape({key:w.PropTypes.string.isRequired,data:w.PropTypes.any,style:w.PropTypes.objectOf(w.PropTypes.number).isRequired})),styles:w.PropTypes.oneOfType([w.PropTypes.func,w.PropTypes.arrayOf(w.PropTypes.shape({key:w.PropTypes.string.isRequired,data:w.PropTypes.any,style:w.PropTypes.objectOf(w.PropTypes.oneOfType([w.PropTypes.number,w.PropTypes.object])).isRequired}))]).isRequired,children:w.PropTypes.func.isRequired,willLeave:w.PropTypes.func,willEnter:w.PropTypes.func},getDefaultProps:function(){return{willEnter:function(a){return l["default"](a.style)},willLeave:function(){return null}}},getInitialState:function(){var a=this.props,b=a.defaultStyles,c=a.styles,d=a.willEnter,e=a.willLeave,f="function"==typeof c?c():c,h=void 0;h=null==b?f:b.map(function(a){for(var b=0;b<f.length;b++)if(f[b].key===a.key)return f[b];return a});var i=null==b?f.map(function(a){return l["default"](a.style)}):b.map(function(a){return l["default"](a.style)}),k=null==b?f.map(function(a){return j["default"](a.style)}):b.map(function(a){return j["default"](a.style)}),m=g(d,e,h,f,i,k,i,k),n=m[0],o=m[1],p=m[2],q=m[3],r=m[4];return{currentStyles:o,currentVelocities:p,lastIdealStyles:q,lastIdealVelocities:r,mergedPropsStyles:n}},animationID:null,prevTime:0,accumulatedTime:0,unreadPropStyles:null,clearUnreadPropStyle:function(a){for(var b=g(this.props.willEnter,this.props.willLeave,this.state.mergedPropsStyles,a,this.state.currentStyles,this.state.currentVelocities,this.state.lastIdealStyles,this.state.lastIdealVelocities),c=b[0],d=b[1],e=b[2],f=b[3],i=b[4],j=0;j<a.length;j++){var k=a[j].style,l=!1;for(var m in k)if(k.hasOwnProperty(m)){var n=k[m];"number"==typeof n&&(l||(l=!0,d[j]=h({},d[j]),e[j]=h({},e[j]),f[j]=h({},f[j]),i[j]=h({},i[j]),c[j]={key:c[j].key,data:c[j].data,style:h({},c[j].style)}),d[j][m]=n,e[j][m]=0,f[j][m]=n,i[j][m]=0,c[j].style[m]=n)}}this.setState({currentStyles:d,currentVelocities:e,mergedPropsStyles:c,lastIdealStyles:f,lastIdealVelocities:i})},startAnimationIfNecessary:function(){var a=this;this.animationID=t["default"](function(){var b=a.props.styles,c="function"==typeof b?b(e(a.state.mergedPropsStyles,a.unreadPropStyles,a.state.lastIdealStyles)):b;if(f(a.state.currentStyles,c,a.state.currentVelocities,a.state.mergedPropsStyles))return a.animationID=null,void(a.accumulatedTime=0);var d=r["default"](),h=d-a.prevTime;if(a.prevTime=d,a.accumulatedTime=a.accumulatedTime+h,a.accumulatedTime>10*y&&(a.accumulatedTime=0),0===a.accumulatedTime)return a.animationID=null,void a.startAnimationIfNecessary();for(var i=(a.accumulatedTime-Math.floor(a.accumulatedTime/y)*y)/y,j=Math.floor(a.accumulatedTime/y),k=g(a.props.willEnter,a.props.willLeave,a.state.mergedPropsStyles,c,a.state.currentStyles,a.state.currentVelocities,a.state.lastIdealStyles,a.state.lastIdealVelocities),l=k[0],m=k[1],o=k[2],p=k[3],q=k[4],s=0;s<l.length;s++){var t=l[s].style,u={},v={},w={},x={};for(var z in t)if(t.hasOwnProperty(z)){var A=t[z];if("number"==typeof A)u[z]=A,v[z]=0,w[z]=A,x[z]=0;else{for(var B=p[s][z],C=q[s][z],D=0;D<j;D++){var E=n["default"](y/1e3,B,C,A.val,A.stiffness,A.damping,A.precision);B=E[0],C=E[1]}var F=n["default"](y/1e3,B,C,A.val,A.stiffness,A.damping,A.precision),G=F[0],H=F[1];u[z]=B+(G-B)*i,v[z]=C+(H-C)*i,w[z]=B,x[z]=C}}p[s]=w,q[s]=x,m[s]=u,o[s]=v}a.animationID=null,a.accumulatedTime-=j*y,a.setState({currentStyles:m,currentVelocities:o,lastIdealStyles:p,lastIdealVelocities:q,mergedPropsStyles:l}),a.unreadPropStyles=null,a.startAnimationIfNecessary()})},componentDidMount:function(){this.prevTime=r["default"](),this.startAnimationIfNecessary()},componentWillReceiveProps:function(a){this.unreadPropStyles&&this.clearUnreadPropStyle(this.unreadPropStyles),"function"==typeof a.styles?this.unreadPropStyles=a.styles(e(this.state.mergedPropsStyles,this.unreadPropStyles,this.state.lastIdealStyles)):this.unreadPropStyles=a.styles,null==this.animationID&&(this.prevTime=r["default"](),this.startAnimationIfNecessary())},componentWillUnmount:function(){null!=this.animationID&&(t["default"].cancel(this.animationID),this.animationID=null)},render:function(){var a=e(this.state.mergedPropsStyles,this.unreadPropStyles,this.state.currentStyles),b=this.props.children(a);return b&&x["default"].Children.only(b)}});b["default"]=z,a.exports=b["default"]},function(a,b){"use strict";function c(a,b,c){for(var d={},e=0;e<a.length;e++)d[a[e].key]=e;for(var f={},e=0;e<b.length;e++)f[b[e].key]=e;for(var g=[],e=0;e<b.length;e++)g[e]=b[e];for(var e=0;e<a.length;e++)if(!f.hasOwnProperty(a[e].key)){var h=c(e,a[e]);null!=h&&g.push(h)}return g.sort(function(a,c){var e=f[a.key],g=f[c.key],h=d[a.key],i=d[c.key];if(null!=e&&null!=g)return f[a.key]-f[c.key];if(null!=h&&null!=i)return d[a.key]-d[c.key];if(null!=e){for(var j=0;j<b.length;j++){var k=b[j].key;if(d.hasOwnProperty(k)){if(e<f[k]&&i>d[k])return-1;if(e>f[k]&&i<d[k])return 1}}return 1}for(var j=0;j<b.length;j++){var k=b[j].key;if(d.hasOwnProperty(k)){if(g<f[k]&&h>d[k])return 1;if(g>f[k]&&h<d[k])return-1}}return-1})}b.__esModule=!0,b["default"]=c,a.exports=b["default"]},function(a,b,c){"use strict";function d(a){return a&&a.__esModule?a:{"default":a}}function e(a,b){return f({},i,b,{val:a})}b.__esModule=!0;var f=Object.assign||function(a){for(var b=1;b<arguments.length;b++){var c=arguments[b];for(var d in c)Object.prototype.hasOwnProperty.call(c,d)&&(a[d]=c[d])}return a};b["default"]=e;var g=c(14),h=d(g),i=f({},h["default"].noWobble,{precision:.01});a.exports=b["default"]},function(a,b){"use strict";b.__esModule=!0,b["default"]={noWobble:{stiffness:170,damping:26},gentle:{stiffness:120,damping:14},wobbly:{stiffness:180,damping:12},stiff:{stiffness:210,damping:20}},a.exports=b["default"]},function(a,b,c){(function(c){"use strict";function d(){"development"===c.env.NODE_ENV&&(e||(e=!0,console.error("`reorderKeys` has been removed, since it is no longer needed for TransitionMotion's new styles array API.")))}b.__esModule=!0,b["default"]=d;var e=!1;a.exports=b["default"]}).call(b,c(6))}])}),function(a){var b=function(b){var c=a('<div class="selection"></div>'),d=a('<input type="hidden" name="" value="" />'),e='<div class="triangle {{vector-icon-class}}"></div>',f=null,g={vectorIcons:!1,onChange:function(){return null}},h=function(){var a=!1;if(b.hasClass("opened"))b.removeClass("opened"),f.css({height:""});else{a=!0,i(),b.addClass("opened");var c=m(f),d=b.children(".nano"),e=parseInt(f.css("max-height"),10);f.css({height:c}),d.length&&e&&setTimeout(function(){d.css("position","relative"),d.nanoScroller({preventPageScrolling:!0,alwaysVisible:!0}),d.css("position",""),b.hide().show(0)},125),b.trigger("open")}if(a){var g;(g=f.find(".filter"))&&g.focus()}},i=function(){var b=a(".combobox, .opened");b.find(".options").css({height:""}),b.removeClass("opened")},j=function(a){return a||(a=window.event),a.stopPropagation&&a.stopPropagation(),a.cancelBubble=!0,a.preventDefault&&a.preventDefault(),a.returnValue=!1,!1},k=function(a,b){return b.filter(function(){return this.textContent.toLowerCase().indexOf(a)!==-1})},l=function(a,b){return b},m=function(b){var c=0;return b.children(":not(.pane)").each(function(){var b=a(this);"none"!=b.css("display")&&(c+=a(this).outerHeight(!0))}),c};this.run=function(){f=b.children(".options"),f.removeClass("opened"),e=a(e.replace("{{vector-icon-class}}",g.vectorIcons?"icon-arrow-down":"")),0==b.find(".selection").length?b.prepend(e).prepend(c).append(d):(c=b.find(".selection"),d=b.find('input[type="hidden"]')),b.find(".triangle").unbind("click"),b.find(".triangle").click(function(a){h(),this.lazyload(),j(a)}.bind(this)),c.unbind("click"),c.click(function(a){h(),this.lazyload(),j(a)}.bind(this)),a("body").click(function(a){b.hasClass("opened")&&(h(),b.trigger("close"))}),f.off("click",".item"),f.on("click",".item",function(){("function"!=typeof g.maybe||g.maybe(a(this),a(this).attr("data-value"),a(this)))&&(a('div[name="'+b.attr("name")+'"]').find(".selection").html(a(this).html()),d.attr("value",a(this).attr("data-value")),f.find(".item").removeClass("selected"),a(this).addClass("selected"),h(),g.onChange(b.attr("name"),a(this).attr("data-value"),a(this)))}),c.html(b.find(".selected").html()),d.attr("name",b.attr("name")).attr("value",b.find(".selected").attr("value"))},this.lazyload=function(){f.find("img.lazyload").each(function(){a(this).attr("src",a(this).attr("data-src")),a(this).removeClass("lazyload")})},this.init=function(b){b&&a.extend(g,b),this.run()},this.setupFilter=function(b){var c=f.children(".item[data-value]").filter(function(){return a(this).attr("data-value").length});this._original_options=c.clone(!0);var d=a(document.createElement("input")).attr({type:"text","class":"filter placeholder-onkeydown",title:b}).keyup(this.filterKeyUp.bind(this)).click(function(a){a.preventDefault(),a.stopPropagation()});Imgur.getInstance().runPlaceholder(d),f.prepend(d)},this.setFilter=function(a,b){a||(a=k),this.filter?this.filter=a:(this.filter=a,this.setupFilter(b))},this.filterKeyUp=function(b){var c=a(b.target).val();if(c.length)var d=this.applyFilter(c);else var d=this.applyFilter(c,l);f.find(".item").remove(),f.append(d),f.css("height",Math.max(m(d),a(b.target).outerHeight())),this.lazyload()},this.applyFilter=function(a,b){return(b=b||this.filter)(a,this._original_options)}};methods={init:function(c){return this.each(function(){var d=new b(a(this));d.init(c);var e=a(this);e.data("combobox",d)})},filter:function(b){return b||(b={}),this.each(function(){var c=a(this);if(c.data("combobox")){var d=c.data("combobox");d.setFilter(b.filter,b.placeholder)}})}},a.fn.combobox=function(b){return methods[b]?methods[b].apply(this,Array.prototype.slice.call(arguments,1)):"object"!=typeof b&&b?a.error("Method "+b+" does not exist"):methods.init.apply(this,arguments)}}(jQuery),function(){var a={supportsFullScreen:!1,isFullScreen:function(){return!1},requestFullScreen:function(){},cancelFullScreen:function(){},fullScreenEventName:"",prefix:""},b="webkit moz o ms khtml".split(" ");if("undefined"!=typeof document.cancelFullScreen)a.supportsFullScreen=!0;else for(var c=0,d=b.length;c<d;c++)if(a.prefix=b[c],"undefined"!=typeof document[a.prefix+"CancelFullScreen"]){a.supportsFullScreen=!0;break}a.supportsFullScreen&&(a.fullScreenEventName=a.prefix+"fullscreenchange",a.isFullScreen=function(){switch(this.prefix){case"":return document.fullScreen;case"webkit":return document.webkitIsFullScreen;default:return document[this.prefix+"FullScreen"]}},a.requestFullScreen=function(a){return""===this.prefix?a.requestFullScreen():a[this.prefix+"RequestFullScreen"]()},a.cancelFullScreen=function(a){return""===this.prefix?document.cancelFullScreen():document[this.prefix+"CancelFullScreen"]()}),"undefined"!=typeof jQuery&&(jQuery.fn.requestFullScreen=function(){return this.each(function(){a.supportsFullScreen&&a.requestFullScreen(this)})}),window.fullScreenApi=a}(),function(a){a.extend(a.fn,{validate:function(b){if(!this.length)return void(b&&b.debug&&window.console&&console.warn("nothing selected, can't validate, returning nothing"));var c=a.data(this[0],"validator");return c?c:(c=new a.validator(b,this[0]),a.data(this[0],"validator",c),c.settings.onsubmit&&(this.find("input, button").filter(".cancel").click(function(){c.cancelSubmit=!0}),c.settings.submitHandler&&this.find("input, button").filter(":submit").click(function(){c.submitButton=this}),this.submit(function(b){function d(){if(c.settings.submitHandler){if(c.submitButton)var b=a("<input type='hidden'/>").attr("name",c.submitButton.name).val(c.submitButton.value).appendTo(c.currentForm);return c.settings.submitHandler.call(c,c.currentForm),c.submitButton&&b.remove(),!1}return!0}return c.settings.debug&&b.preventDefault(),c.cancelSubmit?(c.cancelSubmit=!1,d()):c.form()?c.pendingRequest?(c.formSubmitted=!0,!1):d():(c.focusInvalid(),
!1)})),c)},valid:function(){if(a(this[0]).is("form"))return this.validate().form();var b=!0,c=a(this[0].form).validate();return this.each(function(){b&=c.element(this)}),b},removeAttrs:function(b){var c={},d=this;return a.each(b.split(/\s/),function(a,b){c[b]=d.attr(b),d.removeAttr(b)}),c},rules:function(b,c){var d=this[0];if(b){var e=a.data(d.form,"validator").settings,f=e.rules,g=a.validator.staticRules(d);switch(b){case"add":a.extend(g,a.validator.normalizeRule(c)),f[d.name]=g,c.messages&&(e.messages[d.name]=a.extend(e.messages[d.name],c.messages));break;case"remove":if(!c)return delete f[d.name],g;var h={};return a.each(c.split(/\s/),function(a,b){h[b]=g[b],delete g[b]}),h}}var i=a.validator.normalizeRules(a.extend({},a.validator.metadataRules(d),a.validator.classRules(d),a.validator.attributeRules(d),a.validator.staticRules(d)),d);if(i.required){var j=i.required;delete i.required,i=a.extend({required:j},i)}return i}}),a.extend(a.expr[":"],{blank:function(b){return!a.trim(""+b.value)},filled:function(b){return!!a.trim(""+b.value)},unchecked:function(a){return!a.checked}}),a.validator=function(b,c){this.settings=a.extend(!0,{},a.validator.defaults,b),this.currentForm=c,this.init()},a.validator.format=function(b,c){return 1==arguments.length?function(){var c=a.makeArray(arguments);return c.unshift(b),a.validator.format.apply(this,c)}:(arguments.length>2&&c.constructor!=Array&&(c=a.makeArray(arguments).slice(1)),c.constructor!=Array&&(c=[c]),a.each(c,function(a,c){b=b.replace(new RegExp("\\{"+a+"\\}","g"),c)}),b)},a.extend(a.validator,{defaults:{messages:{},groups:{},rules:{},errorClass:"error",validClass:"valid",errorElement:"label",focusInvalid:!0,errorContainer:a([]),errorLabelContainer:a([]),onsubmit:!0,ignore:[],ignoreTitle:!1,onfocusin:function(a){this.lastActive=a,this.settings.focusCleanup&&!this.blockFocusCleanup&&(this.settings.unhighlight&&this.settings.unhighlight.call(this,a,this.settings.errorClass,this.settings.validClass),this.addWrapper(this.errorsFor(a)).hide())},onfocusout:function(a){this.checkable(a)||!(a.name in this.submitted)&&this.optional(a)||this.element(a)},onkeyup:function(a){(a.name in this.submitted||a==this.lastElement)&&this.element(a)},onclick:function(a){a.name in this.submitted?this.element(a):a.parentNode.name in this.submitted&&this.element(a.parentNode)},highlight:function(b,c,d){"radio"===b.type?this.findByName(b.name).addClass(c).removeClass(d):a(b).addClass(c).removeClass(d)},unhighlight:function(b,c,d){"radio"===b.type?this.findByName(b.name).removeClass(c).addClass(d):a(b).removeClass(c).addClass(d)}},setDefaults:function(b){a.extend(a.validator.defaults,b)},messages:{required:"This field is required.",remote:"Please fix this field.",email:"Please enter a valid email address.",url:"Please enter a valid URL.",date:"Please enter a valid date.",dateISO:"Please enter a valid date (ISO).",number:"Please enter a valid number.",digits:"Please enter only digits.",creditcard:"Please enter a valid credit card number.",equalTo:"Please enter the same value again.",accept:"Please enter a value with a valid extension.",maxlength:a.validator.format("Please enter no more than {0} characters."),minlength:a.validator.format("Please enter at least {0} characters."),rangelength:a.validator.format("Please enter a value between {0} and {1} characters long."),range:a.validator.format("Please enter a value between {0} and {1}."),max:a.validator.format("Please enter a value less than or equal to {0}."),min:a.validator.format("Please enter a value greater than or equal to {0}.")},autoCreateRanges:!1,prototype:{init:function(){function b(b){var c=a.data(this[0].form,"validator"),d="on"+b.type.replace(/^validate/,"");c.settings[d]&&c.settings[d].call(c,this[0])}this.labelContainer=a(this.settings.errorLabelContainer),this.errorContext=this.labelContainer.length&&this.labelContainer||a(this.currentForm),this.containers=a(this.settings.errorContainer).add(this.settings.errorLabelContainer),this.submitted={},this.valueCache={},this.pendingRequest=0,this.pending={},this.invalid={},this.reset();var c=this.groups={};a.each(this.settings.groups,function(b,d){a.each(d.split(/\s/),function(a,d){c[d]=b})});var d=this.settings.rules;a.each(d,function(b,c){d[b]=a.validator.normalizeRule(c)}),a(this.currentForm).validateDelegate(":text, :password, :file, select, textarea","focusin focusout keyup",b).validateDelegate(":radio, :checkbox, select, option","click",b),this.settings.invalidHandler&&a(this.currentForm).bind("invalid-form.validate",this.settings.invalidHandler)},form:function(){return this.checkForm(),a.extend(this.submitted,this.errorMap),this.invalid=a.extend({},this.errorMap),this.valid()||a(this.currentForm).triggerHandler("invalid-form",[this]),this.showErrors(),this.valid()},checkForm:function(){this.prepareForm();for(var a=0,b=this.currentElements=this.elements();b[a];a++)this.check(b[a]);return this.valid()},element:function(b){b=this.clean(b),this.lastElement=b,this.prepareElement(b),this.currentElements=a(b);var c=this.check(b);return c?delete this.invalid[b.name]:this.invalid[b.name]=!0,this.numberOfInvalids()||(this.toHide=this.toHide.add(this.containers)),this.showErrors(),c},showErrors:function(b){if(b){a.extend(this.errorMap,b),this.errorList=[];for(var c in b)this.errorList.push({message:b[c],element:this.findByName(c)[0]});this.successList=a.grep(this.successList,function(a){return!(a.name in b)})}this.settings.showErrors?this.settings.showErrors.call(this,this.errorMap,this.errorList):this.defaultShowErrors()},resetForm:function(){a.fn.resetForm&&a(this.currentForm).resetForm(),this.submitted={},this.prepareForm(),this.hideErrors(),this.elements().removeClass(this.settings.errorClass)},numberOfInvalids:function(){return this.objectLength(this.invalid)},objectLength:function(a){var b=0;for(var c in a)b++;return b},hideErrors:function(){this.addWrapper(this.toHide).hide()},valid:function(){return 0==this.size()},size:function(){return this.errorList.length},focusInvalid:function(){if(this.settings.focusInvalid)try{a(this.findLastActive()||this.errorList.length&&this.errorList[0].element||[]).filter(":visible").focus().trigger("focusin")}catch(b){}},findLastActive:function(){var b=this.lastActive;return b&&1==a.grep(this.errorList,function(a){return a.element.name==b.name}).length&&b},elements:function(){var b=this,c={};return a(this.currentForm).find("input, select, textarea").not(":submit, :reset, :image, [disabled]").not(this.settings.ignore).filter(function(){return!this.name&&b.settings.debug&&window.console&&console.error("%o has no name assigned",this),!(this.name in c||!b.objectLength(a(this).rules()))&&(c[this.name]=!0,!0)})},clean:function(b){return a(b)[0]},errors:function(){return a(this.settings.errorElement+"."+this.settings.errorClass,this.errorContext)},reset:function(){this.successList=[],this.errorList=[],this.errorMap={},this.toShow=a([]),this.toHide=a([]),this.currentElements=a([])},prepareForm:function(){this.reset(),this.toHide=this.errors().add(this.containers)},prepareElement:function(a){this.reset(),this.toHide=this.errorsFor(a)},check:function(b){b=this.clean(b),this.checkable(b)&&(b=this.findByName(b.name).not(this.settings.ignore)[0]);var c=a(b).rules(),d=!1;for(var e in c){var f={method:e,parameters:c[e]};try{var g=a.validator.methods[e].call(this,b.value.replace(/\r/g,""),b,f.parameters);if("dependency-mismatch"==g){d=!0;continue}if(d=!1,"pending"==g)return void(this.toHide=this.toHide.not(this.errorsFor(b)));if(!g)return this.formatAndAdd(b,f),!1}catch(h){throw this.settings.debug&&window.console&&console.log("exception occured when checking element "+b.id+", check the '"+f.method+"' method",h),h}}if(!d)return this.objectLength(c)&&this.successList.push(b),!0},customMetaMessage:function(b,c){if(a.metadata){var d=this.settings.meta?a(b).metadata()[this.settings.meta]:a(b).metadata();return d&&d.messages&&d.messages[c]}},customMessage:function(a,b){var c=this.settings.messages[a];return c&&(c.constructor==String?c:c[b])},findDefined:function(){for(var a=0;a<arguments.length;a++)if(void 0!==arguments[a])return arguments[a]},defaultMessage:function(b,c){return this.findDefined(this.customMessage(b.name,c),this.customMetaMessage(b,c),!this.settings.ignoreTitle&&b.title||void 0,a.validator.messages[c],"<strong>Warning: No message defined for "+b.name+"</strong>")},formatAndAdd:function(a,b){var c=this.defaultMessage(a,b.method),d=/\$?\{(\d+)\}/g;"function"==typeof c?c=c.call(this,b.parameters,a):d.test(c)&&(c=jQuery.format(c.replace(d,"{$1}"),b.parameters)),this.errorList.push({message:c,element:a}),this.errorMap[a.name]=c,this.submitted[a.name]=c},addWrapper:function(a){return this.settings.wrapper&&(a=a.add(a.parent(this.settings.wrapper))),a},defaultShowErrors:function(){for(var a=0;this.errorList[a];a++){var b=this.errorList[a];this.settings.highlight&&this.settings.highlight.call(this,b.element,this.settings.errorClass,this.settings.validClass),this.showLabel(b.element,b.message)}if(this.errorList.length&&(this.toShow=this.toShow.add(this.containers)),this.settings.success)for(var a=0;this.successList[a];a++)this.showLabel(this.successList[a]);if(this.settings.unhighlight)for(var a=0,c=this.validElements();c[a];a++)this.settings.unhighlight.call(this,c[a],this.settings.errorClass,this.settings.validClass);this.toHide=this.toHide.not(this.toShow),this.hideErrors(),this.addWrapper(this.toShow).show()},validElements:function(){return this.currentElements.not(this.invalidElements())},invalidElements:function(){return a(this.errorList).map(function(){return this.element})},showLabel:function(b,c){var d=this.errorsFor(b);d.length?(d.removeClass().addClass(this.settings.errorClass),d.attr("generated")&&d.html(c)):(d=a("<"+this.settings.errorElement+"/>").attr({"for":this.idOrName(b),generated:!0}).addClass(this.settings.errorClass).html(c||""),this.settings.wrapper&&(d=d.hide().show().wrap("<"+this.settings.wrapper+"/>").parent()),this.labelContainer.append(d).length||(this.settings.errorPlacement?this.settings.errorPlacement(d,a(b)):d.insertAfter(b))),!c&&this.settings.success&&(d.text(""),"string"==typeof this.settings.success?d.addClass(this.settings.success):this.settings.success(d)),this.toShow=this.toShow.add(d)},errorsFor:function(b){var c=this.idOrName(b);return this.errors().filter(function(){return a(this).attr("for")==c})},idOrName:function(a){return this.groups[a.name]||(this.checkable(a)?a.name:a.id||a.name)},checkable:function(a){return/radio|checkbox/i.test(a.type)},findByName:function(b){var c=this.currentForm;return a(document.getElementsByName(b)).map(function(a,d){return d.form==c&&d.name==b&&d||null})},getLength:function(b,c){switch(c.nodeName.toLowerCase()){case"select":return a("option:selected",c).length;case"input":if(this.checkable(c))return this.findByName(c.name).filter(":checked").length}return b.length},depend:function(a,b){return!this.dependTypes[typeof a]||this.dependTypes[typeof a](a,b)},dependTypes:{"boolean":function(a,b){return a},string:function(b,c){return!!a(b,c.form).length},"function":function(a,b){return a(b)}},optional:function(b){return!a.validator.methods.required.call(this,a.trim(b.value),b)&&"dependency-mismatch"},startRequest:function(a){this.pending[a.name]||(this.pendingRequest++,this.pending[a.name]=!0)},stopRequest:function(b,c){this.pendingRequest--,this.pendingRequest<0&&(this.pendingRequest=0),delete this.pending[b.name],c&&0==this.pendingRequest&&this.formSubmitted&&this.form()?(a(this.currentForm).submit(),this.formSubmitted=!1):!c&&0==this.pendingRequest&&this.formSubmitted&&(a(this.currentForm).triggerHandler("invalid-form",[this]),this.formSubmitted=!1)},previousValue:function(b){return a.data(b,"previousValue")||a.data(b,"previousValue",{old:null,valid:!0,message:this.defaultMessage(b,"remote")})}},classRuleSettings:{required:{required:!0},email:{email:!0},url:{url:!0},date:{date:!0},dateISO:{dateISO:!0},dateDE:{dateDE:!0},number:{number:!0},numberDE:{numberDE:!0},digits:{digits:!0},creditcard:{creditcard:!0}},addClassRules:function(b,c){b.constructor==String?this.classRuleSettings[b]=c:a.extend(this.classRuleSettings,b)},classRules:function(b){var c={},d=a(b).attr("class");return d&&a.each(d.split(" "),function(){this in a.validator.classRuleSettings&&a.extend(c,a.validator.classRuleSettings[this])}),c},attributeRules:function(b){var c={},d=a(b);for(var e in a.validator.methods){var f=d.attr(e);f&&(c[e]=f)}return c.maxlength&&/-1|2147483647|524288/.test(c.maxlength)&&delete c.maxlength,c},metadataRules:function(b){if(!a.metadata)return{};var c=a.data(b.form,"validator").settings.meta;return c?a(b).metadata()[c]:a(b).metadata()},staticRules:function(b){var c={},d=a.data(b.form,"validator");return d.settings.rules&&(c=a.validator.normalizeRule(d.settings.rules[b.name])||{}),c},normalizeRules:function(b,c){return a.each(b,function(d,e){if(e===!1)return void delete b[d];if(e.param||e.depends){var f=!0;switch(typeof e.depends){case"string":f=!!a(e.depends,c.form).length;break;case"function":f=e.depends.call(c,c)}f?b[d]=void 0===e.param||e.param:delete b[d]}}),a.each(b,function(d,e){b[d]=a.isFunction(e)?e(c):e}),a.each(["minlength","maxlength","min","max"],function(){b[this]&&(b[this]=Number(b[this]))}),a.each(["rangelength","range"],function(){b[this]&&(b[this]=[Number(b[this][0]),Number(b[this][1])])}),a.validator.autoCreateRanges&&(b.min&&b.max&&(b.range=[b.min,b.max],delete b.min,delete b.max),b.minlength&&b.maxlength&&(b.rangelength=[b.minlength,b.maxlength],delete b.minlength,delete b.maxlength)),b.messages&&delete b.messages,b},normalizeRule:function(b){if("string"==typeof b){var c={};a.each(b.split(/\s/),function(){c[this]=!0}),b=c}return b},addMethod:function(b,c,d){a.validator.methods[b]=c,a.validator.messages[b]=void 0!=d?d:a.validator.messages[b],c.length<3&&a.validator.addClassRules(b,a.validator.normalizeRule(b))},methods:{required:function(b,c,d){if(!this.depend(d,c))return"dependency-mismatch";switch(c.nodeName.toLowerCase()){case"select":var e=a(c).val();return e&&e.length>0;case"input":if(this.checkable(c))return this.getLength(b,c)>0;default:return a.trim(b).length>0}},remote:function(b,c,d){if(this.optional(c))return"dependency-mismatch";var e=this.previousValue(c);if(this.settings.messages[c.name]||(this.settings.messages[c.name]={}),e.originalMessage=this.settings.messages[c.name].remote,this.settings.messages[c.name].remote=e.message,d="string"==typeof d&&{url:d}||d,this.pending[c.name])return"pending";if(e.old===b)return e.valid;e.old=b;var f=this;this.startRequest(c);var g={};return g[c.name]=b,a.ajax(a.extend(!0,{url:d,mode:"abort",port:"validate"+c.name,dataType:"json",data:g,success:function(d){f.settings.messages[c.name].remote=e.originalMessage;var g=d===!0;if(g){var h=f.formSubmitted;f.prepareElement(c),f.formSubmitted=h,f.successList.push(c),f.showErrors()}else{var i={},j=d||f.defaultMessage(c,"remote");i[c.name]=e.message=a.isFunction(j)?j(b):j,f.showErrors(i)}e.valid=g,f.stopRequest(c,g)}},d)),"pending"},minlength:function(b,c,d){return this.optional(c)||this.getLength(a.trim(b),c)>=d},maxlength:function(b,c,d){return this.optional(c)||this.getLength(a.trim(b),c)<=d},rangelength:function(b,c,d){var e=this.getLength(a.trim(b),c);return this.optional(c)||e>=d[0]&&e<=d[1]},min:function(a,b,c){return this.optional(b)||a>=c},max:function(a,b,c){return this.optional(b)||a<=c},range:function(a,b,c){return this.optional(b)||a>=c[0]&&a<=c[1]},email:function(a,b){return this.optional(b)||/^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$/i.test(a)},url:function(a,b){return this.optional(b)||/^(https?|ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i.test(a)},date:function(a,b){return this.optional(b)||!/Invalid|NaN/.test(new Date(a))},dateISO:function(a,b){return this.optional(b)||/^\d{4}[\/-]\d{1,2}[\/-]\d{1,2}$/.test(a)},number:function(a,b){return this.optional(b)||/^-?(?:\d+|\d{1,3}(?:,\d{3})+)(?:\.\d+)?$/.test(a)},digits:function(a,b){return this.optional(b)||/^\d+$/.test(a)},creditcard:function(a,b){if(this.optional(b))return"dependency-mismatch";if(/[^0-9-]+/.test(a))return!1;var c=0,d=0,e=!1;a=a.replace(/\D/g,"");for(var f=a.length-1;f>=0;f--){var g=a.charAt(f),d=parseInt(g,10);e&&(d*=2)>9&&(d-=9),c+=d,e=!e}return c%10==0},accept:function(a,b,c){return c="string"==typeof c?c.replace(/,/g,"|"):"png|jpe?g|gif",this.optional(b)||a.match(new RegExp(".("+c+")$","i"))},equalTo:function(b,c,d){var e=a(d).unbind(".validate-equalTo").bind("blur.validate-equalTo",function(){a(c).valid()});return b==e.val()}}}),a.format=a.validator.format}(jQuery),function(a){var b={};if(a.ajaxPrefilter)a.ajaxPrefilter(function(a,c,d){var e=a.port;"abort"==a.mode&&(b[e]&&b[e].abort(),b[e]=d)});else{var c=a.ajax;a.ajax=function(d){var e=("mode"in d?d:a.ajaxSettings).mode,f=("port"in d?d:a.ajaxSettings).port;return"abort"==e?(b[f]&&b[f].abort(),b[f]=c.apply(this,arguments)):c.apply(this,arguments)}}}(jQuery),function(a){jQuery.event.special.focusin||jQuery.event.special.focusout||!document.addEventListener||a.each({focus:"focusin",blur:"focusout"},function(b,c){function d(b){return b=a.event.fix(b),b.type=c,a.event.handle.call(this,b)}a.event.special[c]={setup:function(){this.addEventListener(b,d,!0)},teardown:function(){this.removeEventListener(b,d,!0)},handler:function(b){return arguments[0]=a.event.fix(b),arguments[0].type=c,a.event.handle.apply(this,arguments)}}}),a.extend(a.fn,{validateDelegate:function(b,c,d){return this.bind(c,function(c){var e=a(c.target);if(e.is(b))return d.apply(e,arguments)})}})}(jQuery),"function"!=typeof Object.create&&(Object.create=function(a){function b(){}return b.prototype=a,new b}),function(a,b,c,d){"use strict";var e={_positionClasses:["bottom-left","bottom-right","top-right","top-left","bottom-center","top-center","mid-center"],_defaultIcons:["success","error","info","warning"],init:function(b,c){this.prepareOptions(b,a.toast.options),this.process()},prepareOptions:function(b,c){var d={};"string"==typeof b||b instanceof Array?d.text=b:d=b,this.options=a.extend({},c,d)},process:function(){this.setup(),this.addToDom(),this.position(),this.bindToast(),this.animate()},setup:function(){var b="";if(this._toastEl=this._toastEl||a("<div></div>",{"class":"jq-toast-single"}),b+='<span class="jq-toast-loader"></span>',this.options.allowToastClose&&(b+='<span class="close-jq-toast-single">&times;</span>'),this.options.text instanceof Array){this.options.heading&&(b+='<h2 class="jq-toast-heading">'+this.options.heading+"</h2>"),b+='<ul class="jq-toast-ul">';for(var c=0;c<this.options.text.length;c++)b+='<li class="jq-toast-li" id="jq-toast-item-'+c+'">'+this.options.text[c]+"</li>";b+="</ul>"}else this.options.heading&&(b+='<h2 class="jq-toast-heading">'+this.options.heading+"</h2>"),b+=this.options.text;this._toastEl.html(b),this.options.bgColor!==!1&&this._toastEl.css("background-color",this.options.bgColor),this.options.textColor!==!1&&this._toastEl.css("color",this.options.textColor),this.options.textAlign&&this._toastEl.css("text-align",this.options.textAlign),this.options.icon!==!1&&(this._toastEl.addClass("jq-has-icon"),a.inArray(this.options.icon,this._defaultIcons)!==-1&&this._toastEl.addClass("jq-icon-"+this.options.icon))},position:function(){"string"==typeof this.options.position&&a.inArray(this.options.position,this._positionClasses)!==-1?"bottom-center"===this.options.position?this._container.css({left:a(b).outerWidth()/2-this._container.outerWidth()/2,bottom:20}):"top-center"===this.options.position?this._container.css({left:a(b).outerWidth()/2-this._container.outerWidth()/2,top:20}):"mid-center"===this.options.position?this._container.css({left:a(b).outerWidth()/2-this._container.outerWidth()/2,top:a(b).outerHeight()/2-this._container.outerHeight()/2}):this._container.addClass(this.options.position):"object"==typeof this.options.position?this._container.css({top:this.options.position.top?this.options.position.top:"auto",bottom:this.options.position.bottom?this.options.position.bottom:"auto",left:this.options.position.left?this.options.position.left:"auto",right:this.options.position.right?this.options.position.right:"auto"}):this._container.addClass("bottom-left")},bindToast:function(){var a=this;this._toastEl.on("afterShown",function(){a.processLoader()}),this._toastEl.find(".close-jq-toast-single").on("click",function(b){b.preventDefault(),"fade"===a.options.showHideTransition?(a._toastEl.trigger("beforeHide"),a._toastEl.fadeOut(function(){a._toastEl.trigger("afterHidden")})):"slide"===a.options.showHideTransition?(a._toastEl.trigger("beforeHide"),a._toastEl.slideUp(function(){a._toastEl.trigger("afterHidden")})):(a._toastEl.trigger("beforeHide"),a._toastEl.hide(function(){a._toastEl.trigger("afterHidden")}))}),"function"==typeof this.options.beforeShow&&this._toastEl.on("beforeShow",function(){a.options.beforeShow(a._toastEl)}),"function"==typeof this.options.afterShown&&this._toastEl.on("afterShown",function(){a.options.afterShown(a._toastEl)}),"function"==typeof this.options.beforeHide&&this._toastEl.on("beforeHide",function(){a.options.beforeHide(a._toastEl)}),"function"==typeof this.options.afterHidden&&this._toastEl.on("afterHidden",function(){a.options.afterHidden(a._toastEl)}),"function"==typeof this.options.onClick&&this._toastEl.on("click",function(){a.options.onClick(a._toastEl)})},addToDom:function(){var b=a(".jq-toast-wrap");if(0===b.length?(b=a("<div></div>",{"class":"jq-toast-wrap"}),a("body").append(b)):this.options.stack&&!isNaN(parseInt(this.options.stack,10))||b.empty(),b.find(".jq-toast-single:hidden").remove(),b.append(this._toastEl),this.options.stack&&!isNaN(parseInt(this.options.stack),10)){var c=b.find(".jq-toast-single").length,d=c-this.options.stack;d>0&&a(".jq-toast-wrap").find(".jq-toast-single").slice(0,d).remove()}this._container=b},canAutoHide:function(){return this.options.hideAfter!==!1&&!isNaN(parseInt(this.options.hideAfter,10))},processLoader:function(){if(!this.canAutoHide()||this.options.loader===!1)return!1;var a=this._toastEl.find(".jq-toast-loader"),b=(this.options.hideAfter-400)/1e3+"s",c=this.options.loaderBg,d=a.attr("style")||"";d=d.substring(0,d.indexOf("-webkit-transition")),d+="-webkit-transition: width "+b+" ease-in;                       -o-transition: width "+b+" ease-in;                       transition: width "+b+" ease-in;                       background-color: "+c+";",a.attr("style",d).addClass("jq-toast-loaded")},animate:function(){var a=this;if(this._toastEl.hide(),this._toastEl.trigger("beforeShow"),"fade"===this.options.showHideTransition.toLowerCase()?this._toastEl.fadeIn(function(){a._toastEl.trigger("afterShown")}):"slide"===this.options.showHideTransition.toLowerCase()?this._toastEl.slideDown(function(){a._toastEl.trigger("afterShown")}):this._toastEl.show(function(){a._toastEl.trigger("afterShown")}),this.canAutoHide()){var a=this;b.setTimeout(function(){"fade"===a.options.showHideTransition.toLowerCase()?(a._toastEl.trigger("beforeHide"),a._toastEl.fadeOut(function(){a._toastEl.trigger("afterHidden")})):"slide"===a.options.showHideTransition.toLowerCase()?(a._toastEl.trigger("beforeHide"),a._toastEl.slideUp(function(){a._toastEl.trigger("afterHidden")})):(a._toastEl.trigger("beforeHide"),a._toastEl.hide(function(){a._toastEl.trigger("afterHidden")}))},this.options.hideAfter)}},reset:function(b){"all"===b?a(".jq-toast-wrap").remove():this._toastEl.remove()},update:function(a){this.prepareOptions(a,this.options),this.setup(),this.bindToast()},close:function(){this._toastEl.find(".close-jq-toast-single").click()}};a.toast=function(a){var b=Object.create(e);return b.init(a,this),{reset:function(a){b.reset(a)},update:function(a){b.update(a)},close:function(){b.close()}}},a.toast.options={text:"",heading:"",showHideTransition:"fade",allowToastClose:!0,hideAfter:3e3,loader:!0,loaderBg:"#9EC600",stack:5,position:"bottom-left",bgColor:!1,textColor:!1,textAlign:"left",icon:!1,beforeShow:function(){},afterShown:function(){},beforeHide:function(){},afterHidden:function(){},onClick:function(){}}}(jQuery,window,document),function(a){for(var b=0,c=["webkit","moz"],d=a.requestAnimationFrame,e=a.cancelAnimationFrame,f=c.length;--f>=0&&!d;)d=a[c[f]+"RequestAnimationFrame"],e=a[c[f]+"CancelAnimationFrame"];d&&e||(d=function(a){var c=+new Date,d=Math.max(b+16,c);return setTimeout(function(){a(b=d)},d-c)},e=clearTimeout),a.requestAnimationFrame=d,a.cancelAnimationFrame=e}(window),function(a){function b(a){throw new RangeError(E[a])}function c(a,b){for(var c=a.length,d=[];c--;)d[c]=b(a[c]);return d}function d(a,b){var d=a.split("@"),e="";d.length>1&&(e=d[0]+"@",a=d[1]),a=a.replace(D,".");var f=a.split("."),g=c(f,b).join(".");return e+g}function e(a){for(var b,c,d=[],e=0,f=a.length;e<f;)b=a.charCodeAt(e++),b>=55296&&b<=56319&&e<f?(c=a.charCodeAt(e++),56320==(64512&c)?d.push(((1023&b)<<10)+(1023&c)+65536):(d.push(b),e--)):d.push(b);return d}function f(a){return c(a,function(a){var b="";return a>65535&&(a-=65536,b+=H(a>>>10&1023|55296),a=56320|1023&a),b+=H(a)}).join("")}function g(a){return a-48<10?a-22:a-65<26?a-65:a-97<26?a-97:t}function h(a,b){return a+22+75*(a<26)-((0!=b)<<5)}function i(a,b,c){var d=0;for(a=c?G(a/x):a>>1,a+=G(a/b);a>F*v>>1;d+=t)a=G(a/F);return G(d+(F+1)*a/(a+w))}function j(a){var c,d,e,h,j,k,l,m,n,o,p=[],q=a.length,r=0,w=z,x=y;for(d=a.lastIndexOf(A),d<0&&(d=0),e=0;e<d;++e)a.charCodeAt(e)>=128&&b("not-basic"),p.push(a.charCodeAt(e));for(h=d>0?d+1:0;h<q;){for(j=r,k=1,l=t;h>=q&&b("invalid-input"),m=g(a.charCodeAt(h++)),(m>=t||m>G((s-r)/k))&&b("overflow"),r+=m*k,n=l<=x?u:l>=x+v?v:l-x,!(m<n);l+=t)o=t-n,k>G(s/o)&&b("overflow"),k*=o;c=p.length+1,x=i(r-j,c,0==j),G(r/c)>s-w&&b("overflow"),w+=G(r/c),r%=c,p.splice(r++,0,w)}return f(p)}function k(a){var c,d,f,g,j,k,l,m,n,o,p,q,r,w,x,B=[];for(a=e(a),q=a.length,c=z,d=0,j=y,k=0;k<q;++k)p=a[k],p<128&&B.push(H(p));for(f=g=B.length,g&&B.push(A);f<q;){for(l=s,k=0;k<q;++k)p=a[k],p>=c&&p<l&&(l=p);for(r=f+1,l-c>G((s-d)/r)&&b("overflow"),d+=(l-c)*r,c=l,k=0;k<q;++k)if(p=a[k],p<c&&++d>s&&b("overflow"),p==c){for(m=d,n=t;o=n<=j?u:n>=j+v?v:n-j,!(m<o);n+=t)x=m-o,w=t-o,B.push(H(h(o+x%w,0))),m=G(x/w);B.push(H(h(m,0))),j=i(d,r,f==g),d=0,++f}++d,++c}return B.join("")}function l(a){return d(a,function(a){return B.test(a)?j(a.slice(4).toLowerCase()):a})}function m(a){return d(a,function(a){return C.test(a)?"xn--"+k(a):a})}var n="object"==typeof exports&&exports&&!exports.nodeType&&exports,o="object"==typeof module&&module&&!module.nodeType&&module,p="object"==typeof global&&global;p.global!==p&&p.window!==p&&p.self!==p||(a=p);var q,r,s=2147483647,t=36,u=1,v=26,w=38,x=700,y=72,z=128,A="-",B=/^xn--/,C=/[^\x20-\x7E]/,D=/[\x2E\u3002\uFF0E\uFF61]/g,E={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},F=t-u,G=Math.floor,H=String.fromCharCode;if(q={version:"1.4.1",ucs2:{decode:e,encode:f},decode:j,encode:k,toASCII:m,toUnicode:l},"function"==typeof define&&"object"==typeof define.amd&&define.amd)define("punycode",function(){return q});else if(n&&o)if(module.exports==n)o.exports=q;else for(r in q)q.hasOwnProperty(r)&&(n[r]=q[r]);else a.punycode=q}(this),!function(a){function b(c){if(d[c])return d[c].exports;var e=d[c]={i:c,l:!1,exports:{}};return a[c].call(e.exports,e,e.exports,b),e.l=!0,e.exports}var c=window.pbjsChunk;window.pbjsChunk=function(d,f,g){for(var h,i,j,k=0,l=[];k<d.length;k++)i=d[k],e[i]&&l.push(e[i][0]),e[i]=0;for(h in f)Object.prototype.hasOwnProperty.call(f,h)&&(a[h]=f[h]);for(c&&c(d,f,g);l.length;)l.shift()();if(g)for(k=0;k<g.length;k++)j=b(b.s=g[k]);return j};var d={},e={297:0};b.m=a,b.c=d,b.d=function(a,c,d){b.o(a,c)||Object.defineProperty(a,c,{configurable:!1,enumerable:!0,get:d})},b.n=function(a){var c=a&&a.__esModule?function(){return a["default"]}:function(){return a};return b.d(c,"a",c),c},b.o=function(a,b){return Object.prototype.hasOwnProperty.call(a,b)},b.p="",b.oe=function(a){throw console.error(a),a},b(b.s=796)}([function(a,b,c){"use strict";function d(a,b){return function(a){if(Array.isArray(a))return a}(a)||function(a,b){if(Symbol.iterator in Object(a)||"[object Arguments]"===Object.prototype.toString.call(a)){var c=[],d=!0,e=!1,f=void 0;try{for(var g,h=a[Symbol.iterator]();!(d=(g=h.next()).done)&&(c.push(g.value),!b||c.length!==b);d=!0);}catch(a){e=!0,f=a}finally{try{d||null==h["return"]||h["return"]()}finally{if(e)throw f}}return c}}(a,b)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function e(a){return function(a){if(Array.isArray(a)){for(var b=0,c=new Array(a.length);b<a.length;b++)c[b]=a[b];return c}}(a)||function(a){if(Symbol.iterator in Object(a)||"[object Arguments]"===Object.prototype.toString.call(a))return Array.from(a)}(a)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}function f(a,b,c){return b in a?Object.defineProperty(a,b,{value:c,enumerable:!0,configurable:!0,writable:!0}):a[b]=c,a}function g(){return(g=Object.assign||function(a){for(var b=1;b<arguments.length;b++){var c=arguments[b];for(var d in c)Object.prototype.hasOwnProperty.call(c,d)&&(a[d]=c[d])}return a}).apply(this,arguments)}function h(a){return(h="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(a){return typeof a}:function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a})(a)}function i(){return wa()+Math.random().toString(16).substr(2)}function j(){return window&&window.crypto&&window.crypto.getRandomValues?crypto.getRandomValues(new Uint8Array(1))[0]%16:16*Math.random()}function k(a){if(l(a))return a[0]+"x"+a[1]}function l(a){return y(a)&&2===a.length&&!isNaN(a[0])&&!isNaN(a[1])}function m(){return window.top}function n(){return window.self}function o(){return window.location}function p(){u()&&pa&&console.log.apply(console,t(arguments,"MESSAGE:"))}function q(){u()&&qa&&console.info.apply(console,t(arguments,"INFO:"))}function r(){u()&&ra&&console.warn.apply(console,t(arguments,"WARNING:"));
}function s(){u()&&sa&&console.error.apply(console,t(arguments,"ERROR:"))}function t(a,b){return a=[].slice.call(a),b&&a.unshift(b),a.unshift("display: inline-block; color: #fff; background: #3b88c3; padding: 1px 4px; border-radius: 3px;"),a.unshift("%cPrebid"),a}function u(){return!!W.b.getConfig("debug")}function v(a,b){return na.call(a)==="[object "+b+"]"}function w(a){return v(a,ja)}function x(a){return v(a,ia)}function y(a){return v(a,ha)}function z(a){return v(a,ka)}function A(a){return v(a,la)}function B(a){if(!a)return!0;if(y(a)||x(a))return!(0<a.length);for(var b in a)if(hasOwnProperty.call(a,b))return!1;return!0}function C(a,b){if(!B(a)){if(w(a.forEach))return a.forEach(b,this);var c=0,d=a.length;if(0<d)for(;c<d;c++)b(a[c],c,a);else for(c in a)hasOwnProperty.call(a,c)&&b.call(this,a[c],c)}}function D(a,b){return a.hasOwnProperty?a.hasOwnProperty(b):void 0!==a[b]&&a.constructor.prototype[b]!==a[b]}function E(a,b,c,d){var e;b=b||document,e=c?b.getElementsByTagName(c):b.getElementsByTagName("head");try{if((e=e.length?e:b.getElementsByTagName("body")).length){e=e[0];var f=d?null:e.firstChild;return e.insertBefore(a,f)}}catch(a){}}function F(a,b){var c=new Image;b&&ta.isFn(b)&&(c.addEventListener("load",b),c.addEventListener("error",b)),c.src=a}function G(a,b){var c=ta.createTrackPixelIframeHtml(a,!1,"allow-scripts allow-same-origin"),d=document.createElement("div");d.innerHTML=c;var e=d.firstChild;b&&ta.isFn(b)&&(e.addEventListener("load",b),e.addEventListener("error",b)),ta.insertElement(e,document,"html",!0)}function H(a){var b=2<arguments.length&&void 0!==arguments[2]?arguments[2]:"";return a?((!(1<arguments.length&&void 0!==arguments[1])||arguments[1])&&(a=encodeURI(a)),b=b&&'sandbox="'.concat(b,'"'),"<iframe ".concat(b,' id="').concat(i(),'"\n      frameborder="0"\n      allowtransparency="true"\n      marginheight="0" marginwidth="0"\n      width="0" hspace="0" vspace="0" height="0"\n      style="height:0px;width:0px;display:none;"\n      scrolling="no"\n      src="').concat(a,'">\n    </iframe>')):""}function I(a,b,c){return null==b?c:x(b)?b:z(b)?b.toString():void ta.logWarn("Unsuported type for param: "+a+" required type: String")}function J(a,b,c){return c.indexOf(a)===b}function K(a,b){return a.concat(b)}function L(a){return Object.keys(a)}function M(a,b){return a[b]}function N(){if(window.googletag&&w(window.googletag.pubads)&&w(window.googletag.pubads().getSlots))return!0}function O(a,b){return function(c,d){return c.cpm===d.cpm?b(c[a],d[a])?d:c:c.cpm<d.cpm?d:c}}function P(a){return Y()(a)}function Q(){if(window.navigator.cookieEnabled||document.cookie.length)return!0}function R(a){return function(b){return Ba(b,a)}}function S(a){return Number.isInteger?Number.isInteger(a):"number"==typeof a&&isFinite(a)&&Math.floor(a)===a}function T(a){return a?a.replace(/^\?/,"").split("&").reduce(function(a,b){var c=d(b.split("="),2),e=c[0],f=c[1];return/\[\]$/.test(e)?(a[e=e.replace("[]","")]=a[e]||[],a[e].push(f)):a[e]=f||"",a},{}):{}}function U(a){return Object.keys(a).map(function(b){return Array.isArray(a[b])?a[b].map(function(a){return"".concat(b,"[]=").concat(a)}).join("&"):"".concat(b,"=").concat(a[b])}).join("&")}function V(a,b){return $()(a,b)}Object.defineProperty(b,"__esModule",{value:!0}),c.d(b,"internal",function(){return ta}),c.d(b,"bind",function(){return va}),b.getUniqueIdentifierStr=i,b.generateUUID=function Ca(a){return a?(a^j()>>a/4).toString(16):([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g,Ca)},b.getBidIdParameter=function(a,b){return b&&b[a]?b[a]:""},b.tryAppendQueryString=function(a,b,c){return c?a+b+"="+encodeURIComponent(c)+"&":a},c.d(b,"parseQueryStringParameters",function(){return xa}),b.transformAdServerTargetingObj=function(a){return a&&0<Object.getOwnPropertyNames(a).length?L(a).map(function(b){return"".concat(b,"=").concat(encodeURIComponent(M(a,b)))}).join("&"):""},b.getAdUnitSizes=function(a){if(a){var b=[];if(a.mediaTypes&&a.mediaTypes.banner&&Array.isArray(a.mediaTypes.banner.sizes)){var c=a.mediaTypes.banner.sizes;Array.isArray(c[0])?b=c:b.push(c)}else Array.isArray(a.sizes)&&(Array.isArray(a.sizes[0])?b=a.sizes:b.push(a.sizes));return b}},b.parseSizesInput=function(a){var b=[];if("string"==typeof a){var c=a.split(","),d=/^(\d)+x(\d)+$/i;if(c)for(var e in c)D(c,e)&&c[e].match(d)&&b.push(c[e])}else if("object"===h(a)){var f=a.length;if(0<f)if(2===f&&"number"==typeof a[0]&&"number"==typeof a[1])b.push(k(a));else for(var g=0;g<f;g++)b.push(k(a[g]))}return b},b.parseGPTSingleSizeArray=k,b.parseGPTSingleSizeArrayToRtbSize=function(a){if(l(a))return{w:a[0],h:a[1]}},b.getWindowTop=m,b.getWindowSelf=n,b.getWindowLocation=o,b.logMessage=p,b.logInfo=q,b.logWarn=r,b.logError=s,b.hasConsoleLogger=function(){return pa},b.debugTurnedOn=u,b.createInvisibleIframe=function(){var a=document.createElement("iframe");return a.id=i(),a.height=0,a.width=0,a.border="0px",a.hspace="0",a.vspace="0",a.marginWidth="0",a.marginHeight="0",a.style.border="0",a.scrolling="no",a.frameBorder="0",a.src="about:blank",a.style.display="none",a},b.getParameterByName=function(a){return T(o().search)[a]||""},b.isA=v,b.isFn=w,b.isStr=x,b.isArray=y,b.isNumber=z,b.isPlainObject=A,b.isBoolean=function(a){return v(a,ma)},b.isEmpty=B,b.isEmptyStr=function(a){return x(a)&&(!a||0===a.length)},b._each=C,b.contains=function(a,b){if(B(a))return!1;if(w(a.indexOf))return-1!==a.indexOf(b);for(var c=a.length;c--;)if(a[c]===b)return!0;return!1},b._map=function(a,b){if(B(a))return[];if(w(a.map))return a.map(b);var c=[];return C(a,function(d,e){c.push(b(d,e,a))}),c},b.hasOwn=D,b.insertElement=E,b.triggerPixel=F,b.callBurl=function(a){var b=a.source,c=a.burl;b===ga.S2S.SRC&&c&&ta.triggerPixel(c)},b.insertHtmlIntoIframe=function(a){if(a){var b=document.createElement("iframe");b.id=i(),b.width=0,b.height=0,b.hspace="0",b.vspace="0",b.marginWidth="0",b.marginHeight="0",b.style.display="none",b.style.height="0px",b.style.width="0px",b.scrolling="no",b.frameBorder="0",b.allowtransparency="true",ta.insertElement(b,document,"body"),b.contentWindow.document.open(),b.contentWindow.document.write(a),b.contentWindow.document.close()}},b.insertUserSyncIframe=G,b.createTrackPixelHtml=function(a){if(!a)return"";var b=encodeURI(a),c='<div style="position:absolute;left:0px;top:0px;visibility:hidden;">';return c+='<img src="'+b+'"></div>'},b.createTrackPixelIframeHtml=H,b.getValueString=I,b.uniques=J,b.flatten=K,b.getBidRequest=function(a,b){return a?(b.some(function(b){var d=aa()(b.bids,function(b){return["bidId","adId","bid_id"].some(function(c){return b[c]===a})});return d&&(c=d),d}),c):void 0;var c},b.getKeys=L,b.getValue=M,b.getKeyByValue=function(a,b){for(var c in a)if(a.hasOwnProperty(c)&&a[c]===b)return c},b.getBidderCodes=function(){return(0<arguments.length&&void 0!==arguments[0]?arguments[0]:pbjs.adUnits).map(function(a){return a.bids.map(function(a){return a.bidder}).reduce(K,[])}).reduce(K).filter(J)},b.isGptPubadsDefined=N,c.d(b,"getHighestCpm",function(){return ya}),c.d(b,"getOldestHighestCpmBid",function(){return za}),c.d(b,"getLatestHighestCpmBid",function(){return Aa}),b.shuffle=function(a){for(var b=a.length;0<b;){var c=Math.floor(Math.random()*b),d=a[--b];a[b]=a[c],a[c]=d}return a},b.adUnitsFilter=function(a,b){return ca()(a,b&&b.adUnitCode)},b.deepClone=P,b.inIframe=function(){try{return ta.getWindowSelf()!==ta.getWindowTop()}catch(a){return!0}},b.isSafariBrowser=function(){return/^((?!chrome|android|crios|fxios).)*safari/i.test(navigator.userAgent)},b.replaceAuctionPrice=function(a,b){if(a)return a.replace(/\$\{AUCTION_PRICE\}/g,b)},b.timestamp=function(){return(new Date).getTime()},b.hasDeviceAccess=function(){return!1!==W.b.getConfig("deviceAccess")},b.checkCookieSupport=Q,b.delayExecution=function(a,b){if(b<1)throw new Error("numRequiredCalls must be a positive number. Got ".concat(b));var c=0;return function(){++c===b&&a.apply(this,arguments)}},b.groupBy=function(a,b){return a.reduce(function(a,c){return(a[c[b]]=a[c[b]]||[]).push(c),a},{})},b.getDefinedParams=function(a,b){return b.filter(function(b){return a[b]}).reduce(function(b,c){return g(b,f({},c,a[c]))},{})},b.isValidMediaTypes=function(a){var b=["banner","native","video"];return!!Object.keys(a).every(function(a){return ca()(b,a)})&&(!a.video||!a.video.context||ca()(["instream","outstream","adpod"],a.video.context))},b.getBidderRequest=function(a,b,c){return aa()(a,function(a){return 0<a.bids.filter(function(a){return a.bidder===b&&a.adUnitCode===c}).length})||{start:null,auctionId:null}},b.getUserConfiguredParams=function(a,b,c){return a.filter(function(a){return a.code===b}).map(function(a){return a.bids}).reduce(K,[]).filter(function(a){return a.bidder===c}).map(function(a){return a.params||{}})},b.getOrigin=function(){return window.location.origin?window.location.origin:window.location.protocol+"//"+window.location.hostname+(window.location.port?":"+window.location.port:"")},b.getDNT=function(){return"1"===navigator.doNotTrack||"1"===window.doNotTrack||"1"===navigator.msDoNotTrack||"yes"===navigator.doNotTrack},b.isAdUnitCodeMatchingSlot=function(a){return function(b){return Ba(a,b)}},b.isSlotMatchingAdUnitCode=R,b.getGptSlotInfoForAdUnitCode=function(a){var b;return N()&&(b=aa()(window.googletag.pubads().getSlots(),R(a))),b?{gptSlot:b.getAdUnitPath(),divId:b.getSlotElementId()}:{}},b.unsupportedBidderMessage=function(a,b){var c=Object.keys(a.mediaTypes||{banner:"banner"}).join(", ");return"\n    ".concat(a.code," is a ").concat(c," ad unit\n    containing bidders that don't support ").concat(c,": ").concat(b,".\n    This bidder won't fetch demand.\n  ")},b.isInteger=S,b.convertCamelToUnderscore=function(a){return a.replace(/(?:^|\.?)([A-Z])/g,function(a,b){return"_"+b.toLowerCase()}).replace(/^_/,"")},b.cleanObj=function(a){return Object.keys(a).reduce(function(b,c){return void 0!==a[c]&&(b[c]=a[c]),b},{})},b.pick=function(a,b){return"object"===h(a)?b.reduce(function(c,d,e){if("function"==typeof d)return c;var f=d,g=d.match(/^(.+?)\sas\s(.+?)$/i);g&&(d=g[1],f=g[2]);var h=a[d];return"function"==typeof b[e+1]&&(h=b[e+1](h,c)),void 0!==h&&(c[f]=h),c},{}):{}},b.transformBidderParamKeywords=function(a){var b=1<arguments.length&&void 0!==arguments[1]?arguments[1]:"keywords",c=[];return C(a,function(a,d){if(y(a)){var e=[];C(a,function(a){!(a=I(b+"."+d,a))&&""!==a||e.push(a)}),a=e}else{if(!x(a=I(b+"."+d,a)))return;a=[a]}c.push({key:d,value:a})}),c},b.convertTypes=function(a,b){return Object.keys(a).forEach(function(c){var d,e;b[c]&&(w(a[c])?b[c]=a[c](b[c]):b[c]=(d=a[c],e=b[c],"string"===d?e&&e.toString():"number"===d?Number(e):e),isNaN(b[c])&&delete b.key)}),b},b.isArrayOfNums=function(a,b){return y(a)&&(!b||a.length===b)&&a.every(function(a){return S(a)})},b.fill=function(a,b){for(var c=[],d=0;d<b;d++){var e=A(a)?P(a):a;c.push(e)}return c},b.chunk=function(a,b){for(var c=[],d=0;d<Math.ceil(a.length/b);d++){var e=d*b,f=e+b;c.push(a.slice(e,f))}return c},b.getMinValueFromArray=function(a){return Math.min.apply(Math,e(a))},b.getMaxValueFromArray=function(a){return Math.max.apply(Math,e(a))},b.compareOn=function(a){return function(b,c){return b[a]<c[a]?1:b[a]>c[a]?-1:0}},b.parseQS=T,b.formatQS=U,b.parseUrl=function(a,b){var c=document.createElement("a");b&&"noDecodeWholeURL"in b&&b.noDecodeWholeURL?c.href=a:c.href=decodeURIComponent(a);var d=b&&"decodeSearchAsString"in b&&b.decodeSearchAsString;return{href:c.href,protocol:(c.protocol||"").replace(/:$/,""),hostname:c.hostname,port:+c.port,pathname:c.pathname.replace(/^(?!\/)/,"/"),search:d?c.search:ta.parseQS(c.search||""),hash:(c.hash||"").replace(/^#/,""),host:c.host||window.location.host}},b.buildUrl=function(a){return(a.protocol||"http")+"://"+(a.host||a.hostname+(a.port?":".concat(a.port):""))+(a.pathname||"")+(a.search?"?".concat(ta.formatQS(a.search||"")):"")+(a.hash?"#".concat(a.hash):"")},b.deepEqual=V,b.mergeDeep=function Da(a){for(var b=arguments.length,c=new Array(1<b?b-1:0),d=1;d<b;d++)c[d-1]=arguments[d];if(!c.length)return a;var e=c.shift();if(A(a)&&A(e))for(var h in e)A(e[h])?(a[h]||g(a,f({},h,{})),Da(a[h],e[h])):y(e[h])&&a[h]?y(a[h])&&(a[h]=a[h].concat(e[h])):g(a,f({},h,e[h]));return Da.apply(void 0,[a].concat(c))};var W=c(3),X=c(164),Y=c.n(X),Z=c(165),$=c.n(Z),_=c(12),aa=c.n(_),ba=c(11),ca=c.n(ba),da=c(179);c.d(b,"deepAccess",function(){return da.a});var ea=c(180);c.d(b,"deepSetValue",function(){return ea.a});var fa,ga=c(5),ha="Array",ia="String",ja="Function",ka="Number",la="Object",ma="Boolean",na=Object.prototype.toString,oa=Boolean(window.console),pa=Boolean(oa&&window.console.log),qa=Boolean(oa&&window.console.info),ra=Boolean(oa&&window.console.warn),sa=Boolean(oa&&window.console.error),ta={checkCookieSupport:Q,createTrackPixelIframeHtml:H,getWindowSelf:n,getWindowTop:m,getWindowLocation:o,insertUserSyncIframe:G,insertElement:E,isFn:w,triggerPixel:F,logError:s,logWarn:r,logMessage:p,logInfo:q,parseQS:T,formatQS:U,deepEqual:V},ua={},va=function(a,b){return b}.bind(null,1,ua)()===ua?Function.prototype.bind:function(a){var b=this,c=Array.prototype.slice.call(arguments,1);return function(){return b.apply(a,c.concat(Array.prototype.slice.call(arguments)))}},wa=(fa=0,function(){return++fa}),xa=ta.formatQS,ya=O("timeToRespond",function(a,b){return b<a}),za=O("responseTimestamp",function(a,b){return b<a}),Aa=O("responseTimestamp",function(a,b){return a<b}),Ba=function(a,b){return a.getAdUnitPath()===b||a.getSlotElementId()===b}},function(a,b,c){"use strict";function d(a,b){return function(a){if(Array.isArray(a))return a}(a)||function(a,b){if(Symbol.iterator in Object(a)||"[object Arguments]"===Object.prototype.toString.call(a)){var c=[],d=!0,e=!1,f=void 0;try{for(var g,h=a[Symbol.iterator]();!(d=(g=h.next()).done)&&(c.push(g.value),!b||c.length!==b);d=!0);}catch(a){e=!0,f=a}finally{try{d||null==h["return"]||h["return"]()}finally{if(e)throw f}}return c}}(a,b)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function e(a){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(a){return typeof a}:function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a})(a)}function f(){return(f=Object.assign||function(a){for(var b=1;b<arguments.length;b++){var c=arguments[b];for(var d in c)Object.prototype.hasOwnProperty.call(c,d)&&(a[d]=c[d])}return a}).apply(this,arguments)}function g(a){function b(b,c,d){E(a,b,c,d)}function c(b){return!!a.isBidRequestValid(b)||(Object(x.logWarn)("Invalid bid sent to bidder ".concat(a.code,": ").concat(JSON.stringify(b))),!1)}return f(new j.a(a.code),{getSpec:function(){return Object.freeze(a)},registerSyncs:b,callBids:function(d,g,h,j,k,l){function n(){h(),t.a.emit(r.a.EVENTS.BIDDER_DONE,d),b(p,d.gdprConsent,d.uspConsent)}if(Array.isArray(d.bids)){var o={},p=[],q=d.bids.filter(c);if(0!==q.length){var s={};q.forEach(function(a){(s[a.bidId]=a).adUnitCode||(a.adUnitCode=a.placementCode)});var u=a.buildRequests(q,d);if(u&&0!==u.length){Array.isArray(u)||(u=[u]);var v=Object(x.delayExecution)(l(n),u.length);u.forEach(function(b){function c(c,e){function h(b){var c,e,h=s[b.requestId];if(h){b.originalCpm=b.cpm,b.originalCurrency=b.currency;var j=f(Object(m.a)(r.a.STATUS.GOOD,h),b);c=h.adUnitCode,e=j,o[c]=!0,i(c,e,[d])&&g(c,e)}else Object(x.logWarn)("Bidder ".concat(a.code," made bid for unknown request ID: ").concat(b.requestId,". Ignoring."))}k(a.code);try{c=JSON.parse(c)}catch(c){}var j;c={body:c,headers:{get:e.getResponseHeader.bind(e)}},p.push(c);try{j=a.interpretResponse(c,b)}catch(c){return Object(x.logError)("Bidder ".concat(a.code," failed to interpret the server's response. Continuing without bids"),null,c),void v()}j&&(Object(x.isArray)(j)?j.forEach(h):h(j)),v(j)}function h(b){k(a.code),Object(x.logError)("Server call for ".concat(a.code," failed: ").concat(b,". Continuing without bids.")),v()}switch(b.method){case"GET":j("".concat(b.url).concat(function(a){return a?"?".concat("object"===e(a)?Object(x.parseQueryStringParameters)(a):a):""}(b.data)),{success:l(c),error:h},void 0,f({method:"GET",withCredentials:!0},b.options));break;case"POST":j(b.url,{success:l(c),error:h},"string"==typeof b.data?b.data:JSON.stringify(b.data),f({method:"POST",contentType:"text/plain",withCredentials:!0},b.options));break;default:Object(x.logWarn)("Skipping invalid request from ".concat(a.code,". Request type ").concat(b.type," must be GET or POST")),v()}})}else n()}else n()}}})}function h(a,b){return l.b.getConfig("adpod.brandCategoryExclusion")?(b.filter(function(a){return Object(x.deepAccess)(a,"mediaTypes.video.context")===y.a}).map(function(a){return a.bids.map(function(a){return a.bidder})}).reduce(x.flatten,[]).filter(x.uniques).forEach(function(a){var b=k["default"].getBidAdapter(a);if(b.getSpec().getMappingFileInfo){var c=b.getSpec().getMappingFileInfo(),d=c.refreshInDays?c.refreshInDays:D,e=c.localStorageKey?c.localStorageKey:b.getSpec().code,f=B.getDataFromLocalStorage(e);(!f||Object(x.timestamp)()<f.lastUpdated+24*d*60*60*1e3)&&Object(w.a)(c.url,{success:function(b){try{b=JSON.parse(b);var c={lastUpdated:Object(x.timestamp)(),mapping:b.mapping};B.setDataInLocalStorage(e,JSON.stringify(c))}catch(b){Object(x.logError)("Failed to parse ".concat(a," bidder translation mapping file"))}},error:function(){Object(x.logError)("Failed to load ".concat(a," bidder translation file"))}})}}),void a.call(this,b)):a.call(this,b)}function i(a,b,c){function e(a){return"Invalid bid from ".concat(b.bidderCode,". Ignoring bid: ").concat(a)}return a?b?(f=Object.keys(b),C.every(function(a){return v()(f,a)&&!v()([void 0,null],b[a])})?"native"!==b.mediaType||Object(o.f)(b,c)?"video"!==b.mediaType||Object(p.d)(b,c)?!("banner"===b.mediaType&&!function(a,b,c){if((b.width||0===parseInt(b.width,10))&&(b.height||0===parseInt(b.height,10)))return b.width=parseInt(b.width,10),b.height=parseInt(b.height,10),1;var e=Object(x.getBidderRequest)(c,b.bidderCode,a),f=e&&e.bids&&e.bids[0]&&e.bids[0].sizes,g=Object(x.parseSizesInput)(f);if(1===g.length){var h=d(g[0].split("x"),2),i=h[0],j=h[1];return b.width=parseInt(i,10),b.height=parseInt(j,10),1}}(a,b,c)&&(Object(x.logError)(e("Banner bids require a width and height")),1)):(Object(x.logError)(e("Video bid does not have required vastUrl or renderer property")),!1):(Object(x.logError)(e("Native bid missing some required properties.")),!1):(Object(x.logError)(e("Bidder ".concat(b.bidderCode," is missing required params. Check http://prebid.org/dev-docs/bidder-adapter-1.html for list of params."))),!1)):(Object(x.logWarn)("Some adapter tried to add an undefined bid for ".concat(a,".")),!1):(Object(x.logWarn)("No adUnitCode was supplied to addBidResponse."),!1);var f}Object.defineProperty(b,"__esModule",{value:!0}),c.d(b,"storage",function(){return B}),b.registerBidder=function(a){function b(a){var b=g(a);k["default"].registerBidAdapter(b,a.code,c)}var c=Array.isArray(a.supportedMediaTypes)?{supportedMediaTypes:a.supportedMediaTypes}:void 0;b(a),Array.isArray(a.aliases)&&a.aliases.forEach(function(c){k["default"].aliasRegistry[c]=a.code,b(f({},a,{code:c}))})},b.newBidder=g,c.d(b,"registerSyncInner",function(){return E}),b.preloadBidderMappingFile=h,b.getIabSubCategory=function(a,b){var c=k["default"].getBidAdapter(a);if(c.getSpec().getMappingFileInfo){var d=c.getSpec().getMappingFileInfo(),e=d.localStorageKey?d.localStorageKey:c.getBidderCode(),f=B.getDataFromLocalStorage(e);if(f){try{f=JSON.parse(f)}catch(b){Object(x.logError)("Failed to parse ".concat(a," mapping data stored in local storage"))}return f.mapping[b]?f.mapping[b]:null}}},b.isValid=i;var j=c(97),k=c(7),l=c(3),m=c(31),n=c(42),o=c(35),p=c(43),q=c(5),r=c.n(q),s=c(8),t=c.n(s),u=c(11),v=c.n(u),w=c(4),x=c(0),y=c(2),z=c(13),A=c(9),B=Object(A.a)("bidderFactory"),C=["requestId","cpm","ttl","creativeId","netRevenue","currency"],D=1,E=Object(z.b)("async",function(a,b,c,d){var e=l.b.getConfig("userSync.aliasSyncEnabled");if(a.getUserSyncs&&(e||!k["default"].aliasRegistry[a.code])){var f=l.b.getConfig("userSync.filterSettings"),g=a.getUserSyncs({iframeEnabled:!(!f||!f.iframe&&!f.all),pixelEnabled:!(!f||!f.image&&!f.all)},b,c,d);g&&(Array.isArray(g)||(g=[g]),g.forEach(function(b){n.a.registerSync(b.type,a.code,b.url)}))}},"registerSyncs");Object(z.a)("checkAdUnitSetup").before(h)},function(a,b,c){"use strict";c.d(b,"c",function(){return d}),c.d(b,"d",function(){return e}),c.d(b,"b",function(){return f}),c.d(b,"a",function(){return g});var d="native",e="video",f="banner",g="adpod"},function(a,b,c){"use strict";function d(){return(d=Object.assign||function(a){for(var b=1;b<arguments.length;b++){var c=arguments[b];for(var d in c)Object.prototype.hasOwnProperty.call(c,d)&&(a[d]=c[d])}return a}).apply(this,arguments)}function e(){function a(a){return k()(Object.keys(D),function(b){return a===D[b]})}function b(b){if(b){if("string"==typeof b)a(b)||r.logWarn("Prebid Warning: setPriceGranularity was called with invalid setting, using `medium` as default.");else if(r.isPlainObject(b)&&!Object(i.b)(b))return void r.logError("Invalid custom price value passed to `setPriceGranularity()`");return 1}r.logError("Prebid Error: no value passed to `setPriceGranularity()`")}x={};var c={_debug:t,get debug(){return this._debug},set debug(a){this._debug=a},_bidderTimeout:3e3,get bidderTimeout(){return this._bidderTimeout},set bidderTimeout(a){this._bidderTimeout=a},_publisherDomain:u,get publisherDomain(){return this._publisherDomain},set publisherDomain(a){this._publisherDomain=a},_priceGranularity:D.MEDIUM,set priceGranularity(c){b(c)&&("string"==typeof c?this._priceGranularity=a(c)?c:D.MEDIUM:r.isPlainObject(c)&&(this._customPriceBucket=c,this._priceGranularity=D.CUSTOM,r.logMessage("Using custom price granularity")))},get priceGranularity(){return this._priceGranularity},_customPriceBucket:{},get customPriceBucket(){return this._customPriceBucket},_mediaTypePriceGranularity:{},get mediaTypePriceGranularity(){return this._mediaTypePriceGranularity},set mediaTypePriceGranularity(c){var d=this;this._mediaTypePriceGranularity=Object.keys(c).reduce(function(e,f){return b(c[f])?"string"==typeof c?e[f]=a(c[f])?c[f]:d._priceGranularity:r.isPlainObject(c)&&(e[f]=c[f],r.logMessage("Using custom price granularity for ".concat(f))):r.logWarn("Invalid price granularity for media type: ".concat(f)),e},{})},_sendAllBids:!0,get enableSendAllBids(){return this._sendAllBids},set enableSendAllBids(a){this._sendAllBids=a},_useBidCache:!1,get useBidCache(){return this._useBidCache},set useBidCache(a){this._useBidCache=a},_deviceAccess:!0,get deviceAccess(){return this._deviceAccess},set deviceAccess(a){this._deviceAccess=a},_bidderSequence:C,get bidderSequence(){return this._bidderSequence},set bidderSequence(a){w[a]?this._bidderSequence=a:r.logWarn("Invalid order: ".concat(a,". Bidder Sequence was not set."))},_timeoutBuffer:400,get timeoutBuffer(){return this._timeoutBuffer},set timeoutBuffer(a){this._timeoutBuffer=a},_disableAjaxTimeout:!1,get disableAjaxTimeout(){return this._disableAjaxTimeout},set disableAjaxTimeout(a){this._disableAjaxTimeout=a}};y&&g(Object.keys(y).reduce(function(a,b){return y[b]!==c[b]&&(a[b]=c[b]||{}),a},{})),y=c,z={}}function f(){if(B&&z&&r.isPlainObject(z[B])){var a=z[B],b=new o.a(Object.keys(y).concat(Object.keys(a)));return q(b).reduce(function(b,c){return void 0===a[c]?b[c]=y[c]:void 0!==y[c]&&r.isPlainObject(a[c])?b[c]=Object(p.mergeDeep)({},y[c],a[c]):b[c]=a[c],b},{})}return d({},y)}function g(a){var b=Object.keys(a);A.filter(function(a){return m()(b,a.topic)}).forEach(function(b){var c,d,e;b.callback((c={},d=b.topic,e=a[b.topic],d in c?Object.defineProperty(c,d,{value:e,enumerable:!0,configurable:!0,writable:!0}):c[d]=e,c))}),A.filter(function(a){return"*"===a.topic}).forEach(function(b){return b.callback(a)})}function h(a,b){B=a;try{return b()}finally{B=null}}c.d(b,"a",function(){return v}),c.d(b,"b",function(){return E});var i=c(44),j=c(12),k=c.n(j),l=c(11),m=c.n(l),n=c(80),o=c.n(n),p=c(0),q=c(92),r=c(0),s=c(5),t="TRUE"===r.getParameterByName(s.DEBUG_MODE).toUpperCase(),u=window.location.origin,v="random",w={};w[v]=!0,w.fixed=!0;var x,y,z,A,B,C=v,D={LOW:"low",MEDIUM:"medium",HIGH:"high",AUTO:"auto",DENSE:"dense",CUSTOM:"custom"},E=(A=[],B=null,e(),{getCurrentBidder:function(){return B},getConfig:function(){if(arguments.length<=1&&"function"!=typeof(arguments.length<=0?void 0:arguments[0])){var a=arguments.length<=0?void 0:arguments[0];return a?r.deepAccess(f(),a):f()}return function(a,b){var c=b;if("string"!=typeof a&&(c=a,a="*"),"function"==typeof c){var d={topic:a,callback:c};return A.push(d),function(){A.splice(A.indexOf(d),1)}}r.logError("listener must be a function")}.apply(void 0,arguments)},setConfig:function(a){if(r.isPlainObject(a)){var b=Object.keys(a),c={};b.forEach(function(b){var e=a[b];r.isPlainObject(x[b])&&r.isPlainObject(e)&&(e=d({},x[b],e)),c[b]=y[b]=e}),g(c)}else r.logError("setConfig options must be an object")},setDefaults:function(a){r.isPlainObject(x)?(d(x,a),d(y,a)):r.logError("defaults must be an object")},resetConfig:e,runWithBidder:h,callbackWithBidder:function(a){return function(b){return function(){if("function"==typeof b){for(var c,d=arguments.length,e=new Array(d),f=0;f<d;f++)e[f]=arguments[f];return h(a,(c=r.bind).call.apply(c,[b,this].concat(e)))}r.logWarn("config.callbackWithBidder callback is not a function")}}},setBidderConfig:function(a){try{!function(a){if(!r.isPlainObject(a))throw"setBidderConfig bidder options must be an object";if(!Array.isArray(a.bidders)||!a.bidders.length)throw"setBidderConfig bidder options must contain a bidders list with at least 1 bidder";if(!r.isPlainObject(a.config))throw"setBidderConfig bidder options must contain a config object"}(a),a.bidders.forEach(function(b){z[b]||(z[b]={}),Object.keys(a.config).forEach(function(c){var e=a.config[c];r.isPlainObject(e)?z[b][c]=d({},z[b][c]||{},e):z[b][c]=e})})}catch(b){r.logError(b)}},getBidderConfig:function(){return z}})},function(a,b,c){"use strict";function d(){return(d=Object.assign||function(a){for(var b=1;b<arguments.length;b++){var c=arguments[b];for(var d in c)Object.prototype.hasOwnProperty.call(c,d)&&(a[d]=c[d])}return a}).apply(this,arguments)}function e(a){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(a){return typeof a}:function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a})(a)}function f(){var a=0<arguments.length&&void 0!==arguments[0]?arguments[0]:3e3,b=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},c=b.request,f=b.done;return function(b,j,k){var l=3<arguments.length&&void 0!==arguments[3]?arguments[3]:{};try{var m,n=l.method||(k?"POST":"GET"),o=document.createElement("a");o.href=b;var p="object"===e(j)&&null!==j?j:{success:function(){h.logMessage("xhr success")},error:function(a){h.logError("xhr error",null,a)}};if("function"==typeof j&&(p.success=j),(m=new window.XMLHttpRequest).onreadystatechange=function(){if(m.readyState===i){"function"==typeof f&&f(o.origin);var a=m.status;200<=a&&a<300||304===a?p.success(m.responseText,m):p.error(m.statusText,m)}},g.b.getConfig("disableAjaxTimeout")||(m.ontimeout=function(){h.logError("  xhr timeout after ",m.timeout,"ms")}),"GET"===n&&k){var q=h.parseUrl(b,l);d(q.search,k),b=h.buildUrl(q)}m.open(n,b,!0),g.b.getConfig("disableAjaxTimeout")||(m.timeout=a),l.withCredentials&&(m.withCredentials=!0),h._each(l.customHeaders,function(a,b){m.setRequestHeader(b,a)}),l.preflight&&m.setRequestHeader("X-Requested-With","XMLHttpRequest"),m.setRequestHeader("Content-Type",l.contentType||"text/plain"),"function"==typeof c&&c(o.origin),"POST"===n&&k?m.send(k):m.send()}catch(b){h.logError("xhr construction",b)}}}c.d(b,"a",function(){return j}),b.b=f;var g=c(3),h=c(0),i=4,j=f()},function(a,b){a.exports={JSON_MAPPING:{PL_CODE:"code",PL_SIZE:"sizes",PL_BIDS:"bids",BD_BIDDER:"bidder",BD_ID:"paramsd",BD_PL_ID:"placementId",ADSERVER_TARGETING:"adserverTargeting",BD_SETTING_STANDARD:"standard"},DEBUG_MODE:"pbjs_debug",STATUS:{GOOD:1,NO_BID:2},CB:{TYPE:{ALL_BIDS_BACK:"allRequestedBidsBack",AD_UNIT_BIDS_BACK:"adUnitBidsBack",BID_WON:"bidWon",REQUEST_BIDS:"requestBids"}},EVENTS:{AUCTION_INIT:"auctionInit",AUCTION_END:"auctionEnd",BID_ADJUSTMENT:"bidAdjustment",BID_TIMEOUT:"bidTimeout",BID_REQUESTED:"bidRequested",BID_RESPONSE:"bidResponse",NO_BID:"noBid",BID_WON:"bidWon",BIDDER_DONE:"bidderDone",SET_TARGETING:"setTargeting",BEFORE_REQUEST_BIDS:"beforeRequestBids",REQUEST_BIDS:"requestBids",ADD_AD_UNITS:"addAdUnits",AD_RENDER_FAILED:"adRenderFailed"},AD_RENDER_FAILED_REASON:{PREVENT_WRITING_ON_MAIN_DOCUMENT:"preventWritingOnMainDocuemnt",NO_AD:"noAd",EXCEPTION:"exception",CANNOT_FIND_AD:"cannotFindAd",MISSING_DOC_OR_ADID:"missingDocOrAdid"},EVENT_ID_PATHS:{bidWon:"adUnitCode"},GRANULARITY_OPTIONS:{LOW:"low",MEDIUM:"medium",HIGH:"high",AUTO:"auto",DENSE:"dense",CUSTOM:"custom"},TARGETING_KEYS:{BIDDER:"hb_bidder",AD_ID:"hb_adid",PRICE_BUCKET:"hb_pb",SIZE:"hb_size",DEAL:"hb_deal",SOURCE:"hb_source",FORMAT:"hb_format",UUID:"hb_uuid",CACHE_ID:"hb_cache_id",CACHE_HOST:"hb_cache_host"},NATIVE_KEYS:{title:"hb_native_title",body:"hb_native_body",body2:"hb_native_body2",privacyLink:"hb_native_privacy",privacyIcon:"hb_native_privicon",sponsoredBy:"hb_native_brand",image:"hb_native_image",icon:"hb_native_icon",clickUrl:"hb_native_linkurl",displayUrl:"hb_native_displayurl",cta:"hb_native_cta",rating:"hb_native_rating",address:"hb_native_address",downloads:"hb_native_downloads",likes:"hb_native_likes",phone:"hb_native_phone",price:"hb_native_price",salePrice:"hb_native_saleprice"},S2S:{SRC:"s2s",DEFAULT_ENDPOINT:"https://prebid.adnxs.com/pbs/v1/openrtb2/auction",SYNCED_BIDDERS_KEY:"pbjsSyncs"},BID_STATUS:{BID_TARGETING_SET:"targetingSet",RENDERED:"rendered",BID_REJECTED:"bidRejected"},SUBMODULES_THAT_ALWAYS_REFRESH_ID:{parrableId:!0}}},,function(a,b,c){"use strict";function d(a,b){return function(a){if(Array.isArray(a))return a}(a)||function(a,b){if(Symbol.iterator in Object(a)||"[object Arguments]"===Object.prototype.toString.call(a)){var c=[],d=!0,e=!1,f=void 0;try{for(var g,h=a[Symbol.iterator]();!(d=(g=h.next()).done)&&(c.push(g.value),!b||c.length!==b);d=!0);}catch(a){e=!0,f=a}finally{try{d||null==h["return"]||h["return"]()}finally{if(e)throw f}}return c}}(a,b)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function e(){return(e=Object.assign||function(a){for(var b=1;b<arguments.length;b++){var c=arguments[b];for(var d in c)Object.prototype.hasOwnProperty.call(c,d)&&(a[d]=c[d])}return a}).apply(this,arguments)}function f(){return B&&B.enabled&&B.testing&&h}function g(a,b,c){try{var d=z[a].getSpec();d&&d[b]&&"function"==typeof d[b]&&(v.logInfo("Invoking ".concat(a,".").concat(b)),n.b.runWithBidder(a,i.bind.call(d[b],d,c)))}catch(c){v.logWarn("Error calling ".concat(b," of ").concat(a))}}Object.defineProperty(b,"__esModule",{value:!0}),c.d(b,"gdprDataHandler",function(){return E}),c.d(b,"uspDataHandler",function(){return F}),b.setS2STestingModule=function(a){h=a};var h,i=c(0),j=c(98),k=c(35),l=c(1),m=c(4),n=c(3),o=c(13),p=c(11),q=c.n(p),r=c(12),s=c.n(r),t=c(68),u=c(30),v=c(0),w=c(5),x=c(8),y={},z=y.bidderRegistry={},A=y.aliasRegistry={},B={};n.b.getConfig("s2sConfig",function(a){B=a.s2sConfig});var C={},D=Object(o.b)("sync",function(a){var b=a.bidderCode,c=a.auctionId,d=a.bidderRequestId,f=a.adUnits,g=a.labels,h=a.src;return f.reduce(function(a,f){var l=Object(j.b)(Object(j.a)(f,g),f.mediaTypes,f.sizes),m=l.active,n=l.mediaTypes,o=l.filterResults;return m?o&&v.logInfo('Size mapping filtered adUnit "'.concat(f.code,'" banner sizes from '),o.before,"to ",o.after):v.logInfo('Size mapping disabled adUnit "'.concat(f.code,'"')),m&&a.push(f.bids.filter(function(a){return a.bidder===b}).reduce(function(a,b){var l=f.nativeParams||v.deepAccess(f,"mediaTypes.native");l&&(b=e({},b,{nativeParams:Object(k.g)(l)})),b=e({},b,Object(i.getDefinedParams)(f,["fpd","mediaType","renderer","storedAuctionResponse"]));var m=Object(j.b)(Object(j.a)(b,g),n),o=m.active,p=m.mediaTypes,q=m.filterResults;
return o?q&&v.logInfo('Size mapping filtered adUnit "'.concat(f.code,'" bidder "').concat(b.bidder,'" banner sizes from '),q.before,"to ",q.after):v.logInfo('Size mapping deactivated adUnit "'.concat(f.code,'" bidder "').concat(b.bidder,'"')),v.isValidMediaTypes(p)?b=e({},b,{mediaTypes:p}):v.logError("mediaTypes is not correctly configured for adunit ".concat(f.code)),o&&a.push(e({},b,{adUnitCode:f.code,transactionId:f.transactionId,sizes:v.deepAccess(p,"banner.sizes")||v.deepAccess(p,"video.playerSize")||[],bidId:b.bid_id||v.getUniqueIdentifierStr(),bidderRequestId:d,auctionId:c,src:h,bidRequestsCount:t.a.getRequestsCounter(f.code),bidderRequestsCount:t.a.getBidderRequestsCounter(f.code,b.bidder),bidderWinsCount:t.a.getBidderWinsCounter(f.code,b.bidder)})),a},[])),a},[]).reduce(i.flatten,[]).filter(function(a){return""!==a})},"getBids"),E={consentData:null,setConsentData:function(a){E.consentData=a},getConsentData:function(){return E.consentData}},F={consentData:null,setConsentData:function(a){F.consentData=a},getConsentData:function(){return F.consentData}};y.makeBidRequests=Object(o.b)("sync",function(a,b,c,d,e){x.emit(w.EVENTS.BEFORE_REQUEST_BIDS,a);var g=[],j=Object(i.getBidderCodes)(a);n.b.getConfig("bidderSequence")===n.a&&(j=Object(i.shuffle)(j));var k,l,m,o,p=Object(u.b)(),r=j,t=[];if(B.enabled){if(f()){var y=h.getSourceBidderMap(a);t=y[h.CLIENT]}var A=B.bidders;r=j.filter(function(a){return!q()(A,a)||q()(t,a)}),Boolean(f()&&B.testServerOnly)&&(o=a,Boolean(s()(o,function(a){return s()(a.bids,function(a){return(a.bidSource||B.bidderControl&&B.bidderControl[a.bidder])&&a.finalSource===h.SERVER})})))&&(r.length=0);var C=(k=a,l=B.bidders,(m=v.deepClone(k)).forEach(function(a){a.bids=a.bids.filter(function(a){return q()(l,a.bidder)&&(!f()||a.finalSource!==h.CLIENT)}).map(function(a){return a.bid_id=v.getUniqueIdentifierStr(),a})}),m=m.filter(function(a){return 0!==a.bids.length})),G=v.generateUUID();A.forEach(function(a){var d=v.getUniqueIdentifierStr(),f={bidderCode:a,auctionId:c,bidderRequestId:d,tid:G,bids:D({bidderCode:a,auctionId:c,bidderRequestId:d,adUnits:v.deepClone(C),labels:e,src:w.S2S.SRC}),auctionStart:b,timeout:B.timeout,src:w.S2S.SRC,refererInfo:p};0!==f.bids.length&&g.push(f)}),C.forEach(function(a){var b=a.bids.filter(function(a){return s()(g,function(b){return s()(b.bids,function(b){return b.bidId===a.bid_id})})});a.bids=b}),g.forEach(function(a){a.adUnitsS2SCopy=C.filter(function(a){return 0<a.bids.length})})}var H,I,J=(H=a,(I=v.deepClone(H)).forEach(function(a){a.bids=a.bids.filter(function(a){return!f()||a.finalSource!==h.SERVER})}),I=I.filter(function(a){return 0!==a.bids.length}));return r.forEach(function(a){var f=v.getUniqueIdentifierStr(),h={bidderCode:a,auctionId:c,bidderRequestId:f,bids:D({bidderCode:a,auctionId:c,bidderRequestId:f,adUnits:v.deepClone(J),labels:e,src:"client"}),auctionStart:b,timeout:d,refererInfo:p},i=z[a];i||v.logError("Trying to make a request for bidder that does not exist: ".concat(a)),i&&h.bids&&0!==h.bids.length&&g.push(h)}),E.getConsentData()&&g.forEach(function(a){a.gdprConsent=E.getConsentData()}),F.getConsentData()&&g.forEach(function(a){a.uspConsent=F.getConsentData()}),g},"makeBidRequests"),y.callBids=function(a,b,c,e,f,g,h){if(b.length){var j=d(b.reduce(function(a,b){return a[Number(void 0!==b.src&&b.src===w.S2S.SRC)].push(b),a},[[],[]]),2),k=j[0],l=j[1];if(l.length){var o=Object(m.b)(g,f?{request:f.request.bind(null,"s2s"),done:f.done}:void 0),p=B.bidders,r=z[B.adapter],s=l[0].tid,t=l[0].adUnitsS2SCopy;if(r){var u={tid:s,ad_units:t};if(u.ad_units.length){var y=l.map(function(a){return a.start=Object(i.timestamp)(),e.bind(a)}),A=u.ad_units.reduce(function(a,b){return a.concat((b.bids||[]).reduce(function(a,b){return a.concat(b.bidder)},[]))},[]);v.logMessage("CALLING S2S HEADER BIDDERS ==== ".concat(p.filter(function(a){return q()(A,a)}).join(","))),l.forEach(function(a){x.emit(w.EVENTS.BID_REQUESTED,a)}),r.callBids(u,l,function(a,b){var d=Object(i.getBidderRequest)(l,b.bidderCode,a);d&&c.call(d,a,b)},function(){return y.forEach(function(a){return a()})},o)}}else v.logError("missing "+B.adapter)}k.forEach(function(a){a.start=Object(i.timestamp)();var b=z[a.bidderCode];v.logMessage("CALLING BIDDER ======= ".concat(a.bidderCode)),x.emit(w.EVENTS.BID_REQUESTED,a);var d=Object(m.b)(g,f?{request:f.request.bind(null,a.bidderCode),done:f.done}:void 0),j=e.bind(a);try{n.b.runWithBidder(a.bidderCode,i.bind.call(b.callBids,b,a,c.bind(a),j,d,h,n.b.callbackWithBidder(a.bidderCode)))}catch(b){v.logError("".concat(a.bidderCode," Bid Adapter emitted an uncaught error when parsing their bidRequest"),{e:b,bidRequest:a}),j()}})}else v.logWarn("callBids executed with no bidRequests.  Were they filtered by labels or sizing?")},y.videoAdapters=[],y.registerBidAdapter=function(a,b){var c=(2<arguments.length&&void 0!==arguments[2]?arguments[2]:{}).supportedMediaTypes,d=void 0===c?[]:c;a&&b?"function"==typeof a.callBids?(z[b]=a,q()(d,"video")&&y.videoAdapters.push(b),q()(d,"native")&&k.e.push(b)):v.logError("Bidder adaptor error for bidder code: "+b+"bidder must implement a callBids() function"):v.logError("bidAdaptor or bidderCode not specified")},y.aliasBidAdapter=function(a,b){var c,d;if(void 0===z[b]){var f=z[a];if(void 0===f){var g=n.b.getConfig("s2sConfig"),h=g&&g.bidders;h&&q()(h,b)?A[b]=a:v.logError('bidderCode "'+a+'" is not an existing bidder.',"adapterManager.aliasBidAdapter")}else try{var i,j=(c=a,d=[],q()(y.videoAdapters,c)&&d.push("video"),q()(k.e,c)&&d.push("native"),d);if(f.constructor.prototype!=Object.prototype)(i=new f.constructor).setBidderCode(b);else{var m=f.getSpec();i=Object(l.newBidder)(e({},m,{code:b})),A[b]=a}y.registerBidAdapter(i,b,{supportedMediaTypes:j})}catch(b){v.logError(a+" bidder does not currently support aliasing.","adapterManager.aliasBidAdapter")}}else v.logMessage('alias name "'+b+'" has been already specified.')},y.registerAnalyticsAdapter=function(a){var b=a.adapter,c=a.code;b&&c?"function"==typeof b.enableAnalytics?(b.code=c,C[c]=b):v.logError('Prebid Error: Analytics adaptor error for analytics "'.concat(c,'"\n        analytics adapter must implement an enableAnalytics() function')):v.logError("Prebid Error: analyticsAdapter or analyticsCode not specified")},y.enableAnalytics=function(a){v.isArray(a)||(a=[a]),v._each(a,function(a){var b=C[a.provider];b?b.enableAnalytics(a):v.logError("Prebid Error: no analytics adapter found in registry for\n        ".concat(a.provider,"."))})},y.getBidAdapter=function(a){return z[a]},y.callTimedOutBidders=function(a,b,c){b=b.map(function(b){return b.params=v.getUserConfiguredParams(a,b.adUnitCode,b.bidder),b.timeout=c,b}),b=v.groupBy(b,"bidder"),Object.keys(b).forEach(function(a){g(a,"onTimeout",b[a])})},y.callBidWonBidder=function(a,b,c){b.params=v.getUserConfiguredParams(c,b.adUnitCode,b.bidder),t.a.incrementBidderWinsCounter(b.adUnitCode,b.bidder),g(a,"onBidWon",b)},y.callSetTargetingBidder=function(a,b){g(a,"onSetTargeting",b)},b["default"]=y},function(a,b,c){function d(){return(d=Object.assign||function(a){for(var b=1;b<arguments.length;b++){var c=arguments[b];for(var d in c)Object.prototype.hasOwnProperty.call(c,d)&&(a[d]=c[d])}return a}).apply(this,arguments)}var e,f,g=c(0),h=c(5),i=Array.prototype.slice,j=Array.prototype.push,k=g._map(h.EVENTS,function(a){return a}),l=h.EVENT_ID_PATHS,m=[];a.exports=(e={},(f={}).on=function(a,b,c){if(f=a,g.contains(k,f)){var d=e[a]||{que:[]};c?(d[c]=d[c]||{que:[]},d[c].que.push(b)):d.que.push(b),e[a]=d}else g.logError("Wrong event name : "+a+" Valid event names :"+k);var f},f.emit=function(a){!function(a,b){g.logMessage("Emitting event for: "+a);var c=b[0]||{},d=c[l[a]],f=e[a]||{que:[]},h=g._map(f,function(a,b){return b}),i=[];m.push({eventType:a,args:c,id:d}),d&&g.contains(h,d)&&j.apply(i,f[d].que),j.apply(i,f.que),g._each(i,function(a){if(a)try{a.apply(null,b)}catch(a){g.logError("Error executing handler:","events.js",a)}})}(a,i.call(arguments,1))},f.off=function(a,b,c){var d=e[a];g.isEmpty(d)||g.isEmpty(d.que)&&g.isEmpty(d[c])||c&&(g.isEmpty(d[c])||g.isEmpty(d[c].que))||(c?g._each(d[c].que,function(a){var e=d[c].que;a===b&&e.splice(e.indexOf(a),1)}):g._each(d.que,function(a){var c=d.que;a===b&&c.splice(c.indexOf(a),1)}),e[a]=d)},f.get=function(){return e},f.getEvents=function(){var a=[];return g._each(m,function(b){var c=d({},b);a.push(c)}),a},f)},function(a,b,c){"use strict";function d(a){function b(a){if(h()(i,g))return a({valid:!0});var b;return k(d,e,{hasEnforcementHook:!1},function(c){if(c&&c.hasEnforcementHook)b=a(c);else{var d={hasEnforcementHook:!1,valid:f.hasDeviceAccess()};b=a(d)}}),b}var c=0<arguments.length&&void 0!==a?a:{},d=c.gvlid,e=c.moduleName,g=c.moduleType;return{setCookie:function(a,c,d,e,f,g){function h(b){if(b&&b.valid){var g=f&&""!==f?" ;domain=".concat(encodeURIComponent(f)):"",h=d&&""!==d?" ;expires=".concat(d):"",i=null!=e&&"none"==e.toLowerCase()?"; Secure":"";document.cookie="".concat(a,"=").concat(encodeURIComponent(c)).concat(h,"; path=/").concat(g).concat(e?"; SameSite=".concat(e):"").concat(i)}}return g&&"function"==typeof g?void j.push(function(){var a=b(h);g(a)}):b(h)},getCookie:function(a,c){function d(b){if(b&&b.valid){var c=window.document.cookie.match("(^|;)\\s*"+a+"\\s*=\\s*([^;]*)\\s*(;|$)");return c?decodeURIComponent(c[2]):null}return null}return c&&"function"==typeof c?void j.push(function(){var a=b(d);c(a)}):b(d)},localStorageIsEnabled:function(a){function c(a){if(a&&a.valid)try{return localStorage.setItem("prebid.cookieTest","1"),"1"===localStorage.getItem("prebid.cookieTest")}catch(a){}return!1}return a&&"function"==typeof a?void j.push(function(){var d=b(c);a(d)}):b(c)},cookiesAreEnabled:function(a){function c(a){return!(!a||!a.valid||!f.checkCookieSupport()&&(window.document.cookie="prebid.cookieTest",-1===window.document.cookie.indexOf("prebid.cookieTest")))}return a&&"function"==typeof a?void j.push(function(){var d=b(c);a(d)}):b(c)},setDataInLocalStorage:function(a,c,d){function e(b){b&&b.valid&&window.localStorage.setItem(a,c)}return d&&"function"==typeof d?void j.push(function(){var a=b(e);d(a)}):b(e)},getDataFromLocalStorage:function(a,c){function d(b){return b&&b.valid?window.localStorage.getItem(a):null}return c&&"function"==typeof c?void j.push(function(){var a=b(d);c(a)}):b(d)},removeDataFromLocalStorage:function(a,c){function d(b){b&&b.valid&&window.localStorage.removeItem(a)}return c&&"function"==typeof c?void j.push(function(){var a=b(d);c(a)}):b(d)},hasLocalStorage:function(a){function c(a){if(a&&a.valid)try{return!!window.localStorage}catch(a){f.logError("Local storage api disabled")}return!1}return a&&"function"==typeof a?void j.push(function(){var d=b(c);a(d)}):b(c)},findSimilarCookies:function(a,c){function d(b){if(b&&b.valid){var c=[];if(f.hasDeviceAccess())for(var d=document.cookie.split(";");d.length;){var e=d.pop(),g=e.indexOf("=");g=g<0?e.length:g,0<=decodeURIComponent(e.slice(0,g).replace(/^\s+/,"")).indexOf(a)&&c.push(decodeURIComponent(e.slice(g+1)))}return c}}return c&&"function"==typeof c?void j.push(function(){var a=b(d);c(a)}):b(d)}}}c.d(b,"c",function(){return j}),c.d(b,"d",function(){return k}),b.a=function(a){return d({moduleName:a,moduleType:"core"})},b.b=function(a,b){return d({gvlid:a,moduleName:b})};var e=c(13),f=c(0),g=c(11),h=c.n(g),i=["core","prebid-module"],j=[],k=Object(e.b)("async",function(a,b,c,d){d(c)},"validateStorageEnforcement")},function(a,b,c){"use strict";function d(a){var b,c,d,g=this,j=a.url,k=a.config,l=a.id,m=a.callback,n=a.loaded,o=a.adUnitCode;this.url=j,this.config=k,this.handlers={},this.id=l,this.loaded=n,this.cmd=[],this.push=function(a){"function"==typeof a?g.loaded?a.call():g.cmd.push(a):f.logError("Commands given to Renderer.push must be wrapped in a function")},this.callback=m||function(){g.loaded=!0,g.process()},b=o,c=pbjs.adUnits,(d=h()(c,function(a){return a.code===b}))&&d.renderer&&d.renderer.url&&d.renderer.render?f.logWarn("External Js not loaded by Renderer since renderer url and callback is already defined on adUnit ".concat(o)):Object(e.a)(j,i,this.callback)}b.a=d,b.c=function(a){return!(!a||!a.url)},b.b=function(a,b){a.render(b)};var e=c(38),f=c(0),g=c(12),h=c.n(g),i="outstream";d.install=function(a){return new d({url:a.url,config:a.config,id:a.id,callback:a.callback,loaded:a.loaded,adUnitCode:a.adUnitCode})},d.prototype.getConfig=function(){return this.config},d.prototype.setRender=function(a){this.render=a},d.prototype.setEventHandlers=function(a){this.handlers=a},d.prototype.handleVideoEvent=function(a){var b=a.id,c=a.eventName;"function"==typeof this.handlers[c]&&this.handlers[c](),f.logMessage("Prebid Renderer event for id ".concat(b," type ").concat(c))},d.prototype.process=function(){for(;0<this.cmd.length;)try{this.cmd.shift().call()}catch(a){f.logError("Error processing Renderer command: ",a)}}},function(a,b,c){var d=c(111);a.exports=d},function(a,b,c){var d=c(102);a.exports=d},function(a,b,c){"use strict";c.d(b,"b",function(){return f}),c.d(b,"a",function(){return g}),b.d=function(a,b){var c=2<arguments.length&&void 0!==arguments[2]?arguments[2]:15;0===a.getHooks({hook:b}).length&&a.before(b,c)},b.c=function(a,b){f("async",function(a){a.forEach(function(a){return b.apply(void 0,function(a){if(Array.isArray(a)){for(var b=0,c=new Array(a.length);b<a.length;b++)c[b]=a[b];return c}}(c=a)||function(a){if(Symbol.iterator in Object(a)||"[object Arguments]"===Object.prototype.toString.call(a))return Array.from(a)}(c)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}());var c})},a)([])},b.e=function(a){for(var b=arguments.length,c=new Array(1<b?b-1:0),d=1;d<b;d++)c[d-1]=arguments[d];g(a).before(function(a,b){b.push(c),a(b)})};var d=c(181),e=c.n(d),f=e()({ready:e.a.SYNC|e.a.ASYNC|e.a.QUEUE}),g=f.get},function(a,b,c){"use strict";function d(a){function b(b,c,d){if(this instanceof a){switch(arguments.length){case 0:return new a;case 1:return new a(b);case 2:return new a(b,c)}return new a(b,c,d)}return a.apply(this,arguments)}return b.prototype=a.prototype,b}var e=c(22),f=c(104).f,g=c(106),h=c(41),i=c(21),j=c(28),k=c(24);a.exports=function(a,b){var c,l,m,n,o,p,q,r,s=a.target,t=a.global,u=a.stat,v=a.proto,w=t?e:u?e[s]:(e[s]||{}).prototype,x=t?h:h[s]||(h[s]={}),y=x.prototype;for(m in b)c=!g(t?m:s+(u?".":"#")+m,a.forced)&&w&&k(w,m),o=x[m],c&&(p=a.noTargetGet?(r=f(w,m))&&r.value:w[m]),n=c&&p?p:b[m],c&&typeof o==typeof n||(q=a.bind&&c?i(n,e):a.wrap&&c?d(n):v&&"function"==typeof n?i(Function.call,n):n,(a.sham||n&&n.sham||o&&o.sham)&&j(q,"sham",!0),x[m]=q,v&&(k(h,l=s+"Prototype")||j(h,l,{}),h[l][m]=n,a.real&&y&&!y[m]&&j(y,m,n)))}},function(a,b,c){var d=c(23);a.exports=function(a){if(!d(a))throw TypeError(String(a)+" is not an object");return a}},function(a,b){a.exports=!0},function(a,b,c){function d(a,b){this.stopped=a,this.result=b}var e=c(15),f=c(82),g=c(49),h=c(21),i=c(60),j=c(83);(a.exports=function(a,b,c,k,l){var m,n,o,p,q,r,s,t=h(b,c,k?2:1);if(l)m=a;else{if("function"!=typeof(n=i(a)))throw TypeError("Target is not iterable");if(f(n)){for(o=0,p=g(a.length);o<p;o++)if((q=k?t(e(s=a[o])[0],s[1]):t(a[o]))&&q instanceof d)return q;return new d((!1))}m=n.call(a)}for(r=m.next;!(s=r.call(m)).done;)if("object"==typeof(q=j(m,t,s.value,k))&&q&&q instanceof d)return q;return new d((!1))}).stop=function(a){return new d((!0),a)}},function(a,b){a.exports=function(a){if("function"!=typeof a)throw TypeError(String(a)+" is not a function");return a}},function(a,b,c){var d=c(22),e=c(76),f=c(24),g=c(58),h=c(78),i=c(110),j=e("wks"),k=d.Symbol,l=i?k:k&&k.withoutSetter||g;a.exports=function(a){return f(j,a)||(h&&f(k,a)?j[a]=k[a]:j[a]=l("Symbol."+a)),j[a]}},function(a,b,c){"use strict";b.a=function(){return window.pbjs},window.pbjs=window.pbjs||{},window.pbjs.cmd=window.pbjs.cmd||[],window.pbjs.que=window.pbjs.que||[],window._pbjsGlobals=window._pbjsGlobals||[],window._pbjsGlobals.push("pbjs")},function(a,b,c){var d=c(18);a.exports=function(a,b,c){if(d(a),void 0===b)return a;switch(c){case 0:return function(){return a.call(b)};case 1:return function(c){return a.call(b,c)};case 2:return function(c,d){return a.call(b,c,d)};case 3:return function(c,d,e){return a.call(b,c,d,e)}}return function(){return a.apply(b,arguments)}}},function(a,b,c){(function(b){function c(a){return a&&a.Math==Math&&a}a.exports=c("object"==typeof globalThis&&globalThis)||c("object"==typeof window&&window)||c("object"==typeof self&&self)||c("object"==typeof b&&b)||Function("return this")()}).call(b,c(33))},function(a,b){a.exports=function(a){return"object"==typeof a?null!==a:"function"==typeof a}},function(a,b){var c={}.hasOwnProperty;a.exports=function(a,b){return c.call(a,b)}},function(a,b,c){function d(a){return"function"==typeof a?a:void 0}var e=c(41),f=c(22);a.exports=function(a,b){return arguments.length<2?d(e[a])||d(f[a]):e[a]&&e[a][b]||f[a]&&f[a][b]}},function(a,b,c){var d=c(27);a.exports=!d(function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]})},function(a,b){a.exports=function(a){try{return!!a()}catch(a){return!0}}},function(a,b,c){var d=c(26),e=c(29),f=c(45);a.exports=d?function(a,b,c){return e.f(a,b,f(1,c))}:function(a,b,c){return a[b]=c,a}},function(a,b,c){var d=c(26),e=c(74),f=c(15),g=c(54),h=Object.defineProperty;b.f=d?h:function(a,b,c){if(f(a),b=g(b,!0),f(c),e)try{return h(a,b,c)}catch(a){}if("get"in c||"set"in c)throw TypeError("Accessors not supported");return"value"in c&&(a[b]=c.value),a}},function(a,b,c){"use strict";function d(){return(d=Object.assign||function(a){for(var b=1;b<arguments.length;b++){var c=arguments[b];for(var d in c)Object.prototype.hasOwnProperty.call(c,d)&&(a[d]=c[d])}return a}).apply(this,arguments)}function e(a){function b(){var b=function(){var b,e=[];do try{b=b?b.parent:a;try{var g=b==a.top,h={referrer:b.document.referrer||null,location:b.location.href||null,isTop:g};g&&(h=d(h,{canonicalUrl:c(b.document)})),e.push(h)}catch(g){e.push({referrer:null,location:null,isTop:b==a.top}),Object(f.logWarn)("Trying to access cross domain iframe. Continuing without referrer and location")}}catch(g){return e.push({referrer:null,location:null,isTop:!1}),e}while(b!=a.top);return e}(),e=function(){try{if(!a.location.ancestorOrigins)return;return a.location.ancestorOrigins}catch(b){}}();if(e)for(var g=0,h=e.length;g<h;g++)b[g].ancestor=e[g];return b}function c(a){try{var b=a.querySelector("link[rel='canonical']");if(null!==b)return b.href}catch(a){}return null}return function(){try{var a,c=b(),d=c.length-1,e=null!==c[d].location||0<d&&null!==c[d-1].referrer,f=function(a){var b,c=[],d=null,e=null,f=null,g=null,h=null;for(b=a.length-1;0<=b;b--){try{d=a[b].location}catch(a){}if(d)c.push(d),h=h||d;else if(0!==b){e=a[b-1];try{f=e.referrer,g=e.ancestor}catch(a){}f?(c.push(f),h=h||f):g?(c.push(g),h=h||g):c.push(null)}else c.push(null)}return{stack:c,detectedRefererUrl:h}}(c);return c[c.length-1].canonicalUrl&&(a=c[c.length-1].canonicalUrl),{referer:f.detectedRefererUrl,reachedTop:e,numIframes:d,stack:f.stack,canonicalUrl:a}}catch(a){}}}b.a=e,c.d(b,"b",function(){return g});var f=c(0),g=e(window)},function(a,b,c){"use strict";function d(a,b){var c=b&&b.src||"client",d=a||0;this.bidderCode=b&&b.bidder||"",this.width=0,this.height=0,this.statusMessage=function(){switch(d){case 0:return"Pending";case 1:return"Bid available";case 2:return"Bid returned empty or error response";case 3:return"Bid timed out"}}(),this.adId=e.getUniqueIdentifierStr(),this.requestId=b&&b.bidId,this.mediaType="banner",this.source=c,this.getStatusCode=function(){return d},this.getSize=function(){return this.width+"x"+this.height}}b.a=function(a,b){return new d(a,b)};var e=c(0)},function(a,b,c){"use strict";c.d(b,"a",function(){return k});var d,e,f=c(0),g=c(39),h=c(12),i=c.n(h),j=c(5),k=(d=[],(e={}).addWinningBid=function(a){var b=i()(d,function(b){return b.getAuctionId()===a.auctionId});b?(a.status=j.BID_STATUS.RENDERED,b.addWinningBid(a)):Object(f.logWarn)("Auction not found when adding winning bid")},e.getAllWinningBids=function(){return d.map(function(a){return a.getWinningBids()}).reduce(f.flatten,[])},e.getBidsRequested=function(){return d.map(function(a){return a.getBidRequests()}).reduce(f.flatten,[])},e.getNoBids=function(){return d.map(function(a){return a.getNoBids()}).reduce(f.flatten,[])},e.getBidsReceived=function(){return d.map(function(a){if(a.getAuctionStatus()===g.a)return a.getBidsReceived()}).reduce(f.flatten,[]).filter(function(a){return a})},e.getAdUnits=function(){return d.map(function(a){return a.getAdUnits()}).reduce(f.flatten,[])},e.getAdUnitCodes=function(){return d.map(function(a){return a.getAdUnitCodes()}).reduce(f.flatten,[]).filter(f.uniques)},e.createAuction=function(a){var b,c=a.adUnits,e=a.adUnitCodes,f=a.callback,h=a.cbTimeout,i=a.labels,j=a.auctionId,k=Object(g.k)({adUnits:c,adUnitCodes:e,callback:f,cbTimeout:h,labels:i,auctionId:j});return b=k,d.push(b),k},e.findBidByAdId=function(a){return i()(d.map(function(a){return a.getBidsReceived()}).reduce(f.flatten,[]),function(b){return b.adId===a})},e.getStandardBidderAdServerTargeting=function(){return Object(g.j)()[j.JSON_MAPPING.ADSERVER_TARGETING]},e.setStatusForBids=function(a,b){var c=e.findBidByAdId(a);if(c&&(c.status=b),c&&b===j.BID_STATUS.BID_TARGETING_SET){var f=i()(d,function(a){return a.getAuctionId()===c.auctionId});f&&f.setBidTargeting(c)}},e.getLastAuctionId=function(){return d.length&&d[d.length-1].getAuctionId()},e)},function(tA,uA){var vA;vA=function(){return this}();try{vA=vA||Function("return this")()||eval("this")}catch(e){"object"==typeof window&&(vA=window)}tA.exports=vA},function(a,b,c){var d=c(16),e=c(91);a.exports=d?e:function(a){return Set.prototype.values.call(a)}},function(a,b,c){"use strict";function d(a){return(d="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(a){return typeof a}:function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a})(a)}function e(a){return"object"===d(a)&&a.url?a.url:a}c.d(b,"e",function(){return j}),c.d(b,"a",function(){return k}),b.g=function(a){return a&&a.type&&function(a){return a&&h()(Object.keys(l),a)||(Object(f.logError)("".concat(a," nativeParam is not supported")),!1)}(a.type)?l[a.type]:a},b.f=function(a,b){var c=Object(f.getBidRequest)(a.requestId,b);if(!c)return!1;if(!Object(f.deepAccess)(a,"native.clickUrl"))return!1;if(Object(f.deepAccess)(a,"native.image")&&(!Object(f.deepAccess)(a,"native.image.height")||!Object(f.deepAccess)(a,"native.image.width")))return!1;if(Object(f.deepAccess)(a,"native.icon")&&(!Object(f.deepAccess)(a,"native.icon.height")||!Object(f.deepAccess)(a,"native.icon.width")))return!1;var d=c.nativeParams;if(!d)return!0;var e=Object.keys(d).filter(function(a){return d[a].required}),g=Object.keys(a["native"]).filter(function(b){return a["native"][b]});return e.every(function(a){return h()(g,a)})},b.b=function(a,b){var c;return"click"===a.action?c=b["native"]&&b["native"].clickTrackers:(c=b["native"]&&b["native"].impressionTrackers,b["native"]&&b["native"].javascriptTrackers&&Object(f.insertHtmlIntoIframe)(b["native"].javascriptTrackers)),(c||[]).forEach(f.triggerPixel),a.action},b.d=function(a,b){var c={};return Object.keys(a["native"]).forEach(function(d){var g=i.NATIVE_KEYS[d],h=e(a["native"][d]);Object(f.deepAccess)(b,"mediaTypes.native.".concat(d,".sendId"))&&(h="".concat(g,":").concat(a.adId)),g&&h&&(c[g]=h)}),c},b.c=function(a,b){var c={message:"assetResponse",adId:a.adId,assets:[]};return a.assets.forEach(function(a){var d=Object(f.getKeyByValue)(i.NATIVE_KEYS,a),g=e(b["native"][d]);c.assets.push({key:d,value:g})}),c};var f=c(0),g=c(11),h=c.n(g),i=c(5),j=[],k=Object.keys(i.NATIVE_KEYS).map(function(a){return i.NATIVE_KEYS[a]}),l={image:{image:{required:!0},title:{required:!0},sponsoredBy:{required:!0},clickUrl:{required:!0},body:{required:!1},icon:{required:!1}}}},function(a,b){a.exports={}},function(a,b,c){var d=c(15),e=c(18),f=c(19)("species");a.exports=function(a,b){var c,g=d(a).constructor;return void 0===g||null==(c=d(g)[f])?b:e(c)}},function(a,b,c){"use strict";b.a=function(a,b,c){return b&&a?e()(h,b)?g[a]?(c&&"function"==typeof c&&(g[a].loaded?c():g[a].callbacks.push(c)),g[a].tag):(g[a]={loaded:!1,tag:null,callbacks:[]},c&&"function"==typeof c&&g[a].callbacks.push(c),f.logWarn("module ".concat(b," is loading external JavaScript")),function(b,c){var d=document.createElement("script");return d.type="text/javascript",d.async=!0,(g[a].tag=d).readyState?d.onreadystatechange=function(){"loaded"!==d.readyState&&"complete"!==d.readyState||(d.onreadystatechange=null,c())}:d.onload=function(){c()},d.src=b,f.insertElement(d),d}(a,function(){g[a].loaded=!0;try{for(var b=0;b<g[a].callbacks.length;b++)g[a].callbacks[b]()}catch(b){f.logError("Error executing callback","adloader.js:loadExternalScript",b)}})):void f.logError("".concat(b," not whitelisted for loading external JavaScript")):void f.logError("cannot load external script without url and moduleCode")};var d=c(11),e=c.n(d),f=c(0),g={},h=["criteo","outstream","adagio","browsi"]},function(a,b,c){"use strict";function d(a){return(d="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(a){return typeof a}:function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a})(a)}function e(){return(e=Object.assign||function(a){for(var b=1;b<arguments.length;b++){var c=arguments[b];for(var d in c)Object.prototype.hasOwnProperty.call(c,d)&&(a[d]=c[d])}return a}).apply(this,arguments)}function f(a,b){b.timeToRespond>a.getTimeout()+q.b.getConfig("timeoutBuffer")&&a.executeCallback(!0)}function g(a,b){var c=a.getBidRequests(),d=u()(c,function(a){return a.bidderCode===b.bidderCode});!function(a,b){var c;if(a.bidderCode&&(0<a.cpm||a.dealId)){var d=u()(b.bids,function(b){return b.adUnitCode===a.adUnitCode});c=function(a,b,c){if(!b)return{};var d={},f=pbjs.bidderSettings;if(f){var g=i(b.mediaType,a,c);j(d,g,b),a&&f[a]&&f[a][B.JSON_MAPPING.ADSERVER_TARGETING]&&(j(d,f[a],b),b.sendStandardTargeting=f[a].sendStandardTargeting)}return b["native"]&&(d=e({},d,Object(n.d)(b,c))),d}(a.bidderCode,a,d)}a.adserverTargeting=e(a.adserverTargeting||{},c)}(b,d),A.emit(B.EVENTS.BID_RESPONSE,b),a.addBidReceived(b),f(a,b)}function h(a,b,c){if(a&&c){if(a===w.d){var d=Object(l.deepAccess)(b,"mediaTypes.".concat(w.d,".context"),"instream");if(c["".concat(w.d,"-").concat(d)])return c["".concat(w.d,"-").concat(d)]}return c[a]}}function i(a,b,c){function d(a,b){return{key:a,val:"function"==typeof b?function(a){return b(a)}:function(a){return Object(l.getValue)(a,b)}}}var e=B.TARGETING_KEYS,f=N(a,c),g=pbjs.bidderSettings;if(g[B.JSON_MAPPING.BD_SETTING_STANDARD]||(g[B.JSON_MAPPING.BD_SETTING_STANDARD]={}),g[B.JSON_MAPPING.BD_SETTING_STANDARD][B.JSON_MAPPING.ADSERVER_TARGETING]||(g[B.JSON_MAPPING.BD_SETTING_STANDARD][B.JSON_MAPPING.ADSERVER_TARGETING]=[d(e.BIDDER,"bidderCode"),d(e.AD_ID,"adId"),d(e.PRICE_BUCKET,O(f)),d(e.SIZE,"size"),d(e.DEAL,"dealId"),d(e.SOURCE,"source"),d(e.FORMAT,"mediaType")]),"video"===a){var h=g[B.JSON_MAPPING.BD_SETTING_STANDARD][B.JSON_MAPPING.ADSERVER_TARGETING];if([e.UUID,e.CACHE_ID].forEach(function(a){void 0===u()(h,function(b){return b.key===a})&&h.push(d(a,"videoCacheKey"))}),q.b.getConfig("cache.url")&&(!b||!1!==y.deepAccess(g,"".concat(b,".sendStandardTargeting")))){var i=Object(l.parseUrl)(q.b.getConfig("cache.url"));void 0===u()(h,function(a){return a.key===e.CACHE_HOST})&&h.push(d(e.CACHE_HOST,function(a){return y.deepAccess(a,"adserverTargeting.".concat(e.CACHE_HOST))?a.adserverTargeting[e.CACHE_HOST]:i.hostname}))}}return g[B.JSON_MAPPING.BD_SETTING_STANDARD]}function j(a,b,c){var d=b[B.JSON_MAPPING.ADSERVER_TARGETING];return c.size=c.getSize(),y._each(d,function(d){var e=d.key,f=d.val;if(a[e]&&y.logWarn("The key: "+e+" is getting ovewritten"),y.isFn(f))try{f=f(c)}catch(d){y.logError("bidmanager","ERROR",d)}(void 0===b.suppressEmptyKeys||!0!==b.suppressEmptyKeys)&&e!==B.TARGETING_KEYS.DEAL||!y.isEmptyStr(f)&&null!=f?a[e]=f:y.logInfo("suppressing empty key '"+e+"' from adserver targeting")}),a}function k(a,b){return a[b.adUnitCode]||(a[b.adUnitCode]={bids:[]}),a[b.adUnitCode].bids.push(b),a}c.d(b,"b",function(){return D}),c.d(b,"a",function(){return E}),b.k=function(a){function b(){return{auctionId:X,timestamp:n,auctionEnd:o,auctionStatus:r,adUnits:R,adUnitCodes:T,labels:S,bidderRequests:U,noBids:W,bidsReceived:V,winningBids:$,timeout:Z}}function c(a,c){if(c&&clearTimeout(s),void 0===o){var d=[];a&&(y.logMessage("Auction ".concat(X," timedOut")),e=_,(d=U.map(function(a){return(a.bids||[]).filter(function(a){return!e.has(a.bidder)})}).reduce(l.flatten,[]).map(function(a){return{bidId:a.bidId,bidder:a.bidder,adUnitCode:a.adUnitCode,auctionId:a.auctionId}})).length&&A.emit(B.EVENTS.BID_TIMEOUT,d)),r=E,o=Date.now(),A.emit(B.EVENTS.AUCTION_END,b()),L(R,function(){try{if(null!=Y){var b=T,c=V.filter(y.bind.call(l.adUnitsFilter,this,b)).reduce(k,{});Y.apply(pbjs,[c,a,X]),Y=null}}catch(b){y.logError("Error executing bidsBackHandler",null,b)}finally{d.length&&z.callTimedOutBidders(t,d,Z);var e=q.b.getConfig("userSync")||{};e.enableOverride||x(e.syncDelay)}})}var e}function f(){y.logInfo("Bids Received for Auction with id: ".concat(X),V),r=E,c(!1,!0)}function i(a){_.add(a)}function j(a){function j(a){var b=!0,c=q.b.getConfig("maxRequestsPerOrigin")||F;return a.bidRequests.some(function(a){var d=1,e=void 0!==a.src&&a.src===B.S2S.SRC?"s2s":a.bidderCode;return H[e]&&(!1===H[e].SRA&&(d=Math.min(a.bids.length,c)),G[H[e].origin]+d>c&&(b=!1)),!b}),b&&a.run(),b}function k(a,b){void 0===a[b]?a[b]=1:a[b]++}var n=this;a.forEach(function(a){var b;b=a,U=U.concat(b)});var o={},t={bidRequests:a,run:function(){function t(){F--,K&&0===F&&C()}var w,x;w=c.bind(null,!0),x=setTimeout(w,Z),s=x,r=D,A.emit(B.EVENTS.AUCTION_INIT,b());var C,E,F,K,L,N,O=(C=f,E=n,F=0,K=!1,L=new Set,N={},{addBidResponse:function(a,b){N[b.requestId]=!0,F++;var c=function(a){var b=a.adUnitCode,c=a.bid,f=a.bidderRequest,g=a.auctionId,i=f.start,j=e({},c,{auctionId:g,responseTimestamp:Object(l.timestamp)(),requestTimestamp:i,cpm:parseFloat(c.cpm)||0,bidder:c.bidderCode,adUnitCode:b});j.timeToRespond=j.responseTimestamp-j.requestTimestamp,A.emit(B.EVENTS.BID_ADJUSTMENT,j);var k=f.bids&&u()(f.bids,function(a){return a.adUnitCode==b}),n=k&&k.renderer;n&&n.url&&(j.renderer=p.a.install({url:n.url}),j.renderer.setRender(n.render));var o=h(c.mediaType,k,q.b.getConfig("mediaTypePriceGranularity")),r=Object(m.a)(j.cpm,"object"===d(o)?o:q.b.getConfig("customPriceBucket"),q.b.getConfig("currency.granularityMultiplier"));return j.pbLg=r.low,j.pbMg=r.med,j.pbHg=r.high,j.pbAg=r.auto,j.pbDg=r.dense,j.pbCg=r.custom,j}({adUnitCode:a,bid:b,bidderRequest:this,auctionId:E.getAuctionId()});"video"===c.mediaType?function(a,b,c,d){var e=!0,f=Object(l.getBidRequest)(b.requestId,[c]),h=f&&Object(l.deepAccess)(f,"mediaTypes.video"),i=h&&Object(l.deepAccess)(h,"context");q.b.getConfig("cache.url")&&i!==v.b&&(b.videoCacheKey?b.vastUrl||(y.logError("videoCacheKey specified but not required vastUrl for video bid"),e=!1):(e=!1,M(a,b,d,f))),e&&(g(a,b),d())}(E,c,this,t):(g(E,c),t())},adapterDone:function(){L.add(this),K=E.getBidRequests().every(function(a){return L.has(a)}),this.bids.forEach(function(a){N[a.bidId]||(E.addNoBid(a),A.emit(B.EVENTS.NO_BID,a))}),K&&0===F&&C()}});z.callBids(R,a,function(){for(var a=arguments.length,b=new Array(a),c=0;c<a;c++)b[c]=arguments[c];J.apply({dispatch:O.addBidResponse,bidderRequest:this},b)},O.adapterDone,{request:function(a,b){k(G,b),k(o,a),H[a]||(H[a]={SRA:!0,origin:b}),1<o[a]&&(H[a].SRA=!1)},done:function(a){G[a]--,I[0]&&j(I[0])&&I.shift()}},Z,i)}};j(t)||(y.logWarn("queueing auction due to limited endpoint capacity"),I.push(t))}var n,o,r,s,t=a.adUnits,w=a.adUnitCodes,N=a.callback,O=a.cbTimeout,P=a.labels,Q=a.auctionId,R=t,S=P,T=w,U=[],V=[],W=[],X=Q||y.generateUUID(),Y=N,Z=O,$=[],_=new Set;return{addBidReceived:function(a){V=V.concat(a)},addNoBid:function(a){W=W.concat(a)},executeCallback:c,callBids:function(){r=C,
n=Date.now();var a=z.makeBidRequests(R,n,X,Z,S);y.logInfo("Bids Requested for Auction with id: ".concat(X),a),a.length<1?(y.logWarn("No valid bid requests returned for auction"),f()):K.call({dispatch:j,context:this},a)},addWinningBid:function(a){$=$.concat(a),z.callBidWonBidder(a.bidder,a,t)},setBidTargeting:function(a){z.callSetTargetingBidder(a.bidder,a)},getWinningBids:function(){return $},getTimeout:function(){return Z},getAuctionId:function(){return X},getAuctionStatus:function(){return r},getAdUnits:function(){return R},getAdUnitCodes:function(){return T},getBidRequests:function(){return U},getBidsReceived:function(){return V},getNoBids:function(){return W}}},c.d(b,"c",function(){return J}),c.d(b,"e",function(){return K}),b.g=f,b.d=g,c.d(b,"f",function(){return M}),c.d(b,"i",function(){return N}),c.d(b,"h",function(){return O}),b.j=i;var l=c(0),m=c(44),n=c(35),o=c(99),p=c(10),q=c(3),r=c(42),s=c(13),t=c(12),u=c.n(t),v=c(43),w=c(2),x=r.a.syncUsers,y=c(0),z=c(7)["default"],A=c(8),B=c(5),C="started",D="inProgress",E="completed";A.on(B.EVENTS.BID_ADJUSTMENT,function(a){!function(a){var b,c=a.bidderCode,d=a.cpm;if(pbjs.bidderSettings&&(c&&pbjs.bidderSettings[c]&&"function"==typeof pbjs.bidderSettings[c].bidCpmAdjustment?b=pbjs.bidderSettings[c].bidCpmAdjustment:pbjs.bidderSettings[B.JSON_MAPPING.BD_SETTING_STANDARD]&&"function"==typeof pbjs.bidderSettings[B.JSON_MAPPING.BD_SETTING_STANDARD].bidCpmAdjustment&&(b=pbjs.bidderSettings[B.JSON_MAPPING.BD_SETTING_STANDARD].bidCpmAdjustment),b))try{d=b(a.cpm,e({},a))}catch(a){y.logError("Error during bid adjustment","bidmanager.js",a)}0<=d&&(a.cpm=d)}(a)});var F=4,G={},H={},I=[],J=Object(s.b)("async",function(a,b){this.dispatch.call(this.bidderRequest,a,b)},"addBidResponse"),K=Object(s.b)("sync",function(a){this.dispatch.call(this.context,a)},"addBidderRequests"),L=Object(s.b)("async",function(a,b){b&&b()},"bidsBackCallback"),M=Object(s.b)("async",function(a,b,c,d){Object(o.b)([b],function(d,e){d?(y.logWarn("Failed to save to the video cache: ".concat(d,". Video bid must be discarded.")),f(a,b)):""===e[0].uuid?(y.logWarn("Supplied video cache key was already in use by Prebid Cache; caching attempt was rejected. Video bid must be discarded."),f(a,b)):(b.videoCacheKey=e[0].uuid,b.vastUrl||(b.vastUrl=Object(o.a)(b.videoCacheKey)),g(a,b),c())})},"callPrebidCache"),N=function(a,b){var c=h(a,b,q.b.getConfig("mediaTypePriceGranularity"));return"string"==typeof a&&c?"string"==typeof c?c:"custom":q.b.getConfig("priceGranularity")},O=function(a){return function(b){return a===B.GRANULARITY_OPTIONS.AUTO?b.pbAg:a===B.GRANULARITY_OPTIONS.DENSE?b.pbDg:a===B.GRANULARITY_OPTIONS.LOW?b.pbLg:a===B.GRANULARITY_OPTIONS.MEDIUM?b.pbMg:a===B.GRANULARITY_OPTIONS.HIGH?b.pbHg:a===B.GRANULARITY_OPTIONS.CUSTOM?b.pbCg:void 0}}},function(a,b,c){"use strict";function d(){return(d=Object.assign||function(a){for(var b=1;b<arguments.length;b++){var c=arguments[b];for(var d in c)Object.prototype.hasOwnProperty.call(c,d)&&(a[d]=c[d])}return a}).apply(this,arguments)}function e(a,b,c){return b in a?Object.defineProperty(a,b,{value:c,enumerable:!0,configurable:!0,writable:!0}):a[b]=c,a}function f(a){return function(a){if(Array.isArray(a)){for(var b=0,c=new Array(a.length);b<a.length;b++)c[b]=a[b];return c}}(a)||function(a){if(Symbol.iterator in Object(a)||"[object Arguments]"===Object.prototype.toString.call(a))return Array.from(a)}(a)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}function g(a,b,c){var d=2<arguments.length&&void 0!==c?c:0,e=[],g=u.b.getConfig("sendBidsControl.dealPrioritization"),i=Object(t.groupBy)(a,"adUnitCode");return Object.keys(i).forEach(function(a){var c=[],j=Object(t.groupBy)(i[a],"bidderCode");Object.keys(j).forEach(function(a){return c.push(j[a].reduce(b))}),0<d?(c=g?c(h(!0)):c.sort(function(a,b){return b.cpm-a.cpm}),e.push.apply(e,f(c.slice(0,d)))):e.push.apply(e,f(c))}),e}function h(a){var b=0<arguments.length&&void 0!==a&&a;return function(a,c){return void 0!==a.adUnitTargeting.hb_deal&&void 0===c.adUnitTargeting.hb_deal?-1:void 0===a.adUnitTargeting.hb_deal&&void 0!==c.adUnitTargeting.hb_deal?1:b?c.cpm-a.cpm:c.adUnitTargeting.hb_pb-a.adUnitTargeting.hb_pb}}function i(a,b){return a.adserverTargeting&&b&&(B.isArray(b)&&A()(b,a.adUnitCode)||"string"==typeof b&&a.adUnitCode===b)}function j(a){return"string"==typeof a?[a]:B.isArray(a)?a:q.getAdUnitCodes()||[]}function k(){var a=q.getBidsReceived();return u.b.getConfig("useBidCache")||(a=a.filter(function(a){return s[a.adUnitCode]===a.auctionId})),g(a=a.filter(function(a){return Object(t.deepAccess)(a,"video.context")!==y.a}).filter(function(a){return"banner"!==a.mediaType||Object(x.c)([a.width,a.height])}).filter(G).filter(F),t.getOldestHighestCpmBid)}function l(){return q.getStandardBidderAdServerTargeting().map(function(a){return a.key}).concat(E).filter(t.uniques)}function m(a,b,c,d){return Object.keys(b.adserverTargeting).filter(n()).forEach(function(c){var d,e;a.length&&a.filter((e=c,function(a){return a.adUnitCode===b.adUnitCode&&a.adserverTargeting[e]})).forEach((d=c,function(a){B.isArray(a.adserverTargeting[d])||(a.adserverTargeting[d]=[a.adserverTargeting[d]]),a.adserverTargeting[d]=a.adserverTargeting[d].concat(b.adserverTargeting[d]).filter(t.uniques),delete b.adserverTargeting[d]}))}),a.push(b),a}function n(){var a=l().concat(v.a);return function(b){return-1===a.indexOf(b)}}function o(a){return e({},a.adUnitCode,Object.keys(a.adserverTargeting).filter(n()).map(function(b){return e({},b.substring(0,20),[a.adserverTargeting[b]])}))}function p(a,b){return b.map(function(b){return e({},"".concat(b,"_").concat(a.bidderCode).substring(0,20),[a.adserverTargeting[b]])})}c.d(b,"a",function(){return H});var q,r,s,t=c(0),u=c(3),v=c(35),w=c(32),x=c(98),y=c(2),z=c(11),A=c.n(z),B=c(0),C=c(5),D=[],E=Object.keys(C.TARGETING_KEYS).map(function(a){return C.TARGETING_KEYS[a]}),F=function(a){return a.responseTimestamp+1e3*a.ttl+1e3>Object(t.timestamp)()},G=function(a){return a&&(a.status&&!A()([C.BID_STATUS.RENDERED],a.status)||!a.status)},H=(q=w.a,s={},(r={}).setLatestAuctionForAdUnit=function(a,b){s[a]=b},r.resetPresetTargeting=function(a,b){if(Object(t.isGptPubadsDefined)()){var c=j(a),d=q.getAdUnits().filter(function(a){return A()(c,a.code)});window.googletag.pubads().getSlots().forEach(function(a){var c=B.isFn(b)&&b(a);D.forEach(function(b){d.forEach(function(d){(d.code===a.getAdUnitPath()||d.code===a.getSlotElementId()||B.isFn(c)&&c(d.code))&&a.setTargeting(b,null)})})})}},r.resetPresetTargetingAST=function(a){j(a).forEach(function(a){var b=window.apntag.getTag(a);if(b&&b.keywords){var c=Object.keys(b.keywords),d={};c.forEach(function(a){A()(D,a.toLowerCase())||(d[a]=b.keywords[a])}),window.apntag.modifyTag(a,{keywords:d})}})},r.getAllTargeting=function(a){var b,c,n,q,s,w,x,y,z,B=1<arguments.length&&void 0!==arguments[1]?arguments[1]:k(),F=j(a),G=(w=F,x=B,y=r.getWinningBids(w,x),z=l(),(y=y.map(function(a){return e({},a.adUnitCode,Object.keys(a.adserverTargeting).filter(function(b){return void 0===a.sendStandardTargeting||a.sendStandardTargeting||-1===z.indexOf(b)}).reduce(function(b,c){var d=[a.adserverTargeting[c]],g=e({},c.substring(0,20),d);if(c!==C.TARGETING_KEYS.DEAL)return[].concat(f(b),[g]);var h=e({},"".concat(c,"_").concat(a.bidderCode).substring(0,20),d);return[].concat(f(b),[g,h])},[]))})).concat((s=F,B.filter(function(a){return A()(s,a.adUnitCode)}).map(function(a){return d({},a)}).reduce(m,[]).map(o).filter(function(a){return a}))).concat(u.b.getConfig("enableSendAllBids")?(b=F,c=B,n=E.concat(v.a),q=u.b.getConfig("sendBidsControl.bidLimit"),g(c,t.getHighestCpm,q).map(function(a){if(i(a,b))return e({},a.adUnitCode,p(a,n.filter(function(b){return void 0!==a.adserverTargeting[b]})))}).filter(function(a){return a})):function(a,b){if(!0!==u.b.getConfig("targetingControls.alwaysIncludeDeals"))return[];var c=E.concat(v.a);return g(b,t.getHighestCpm).map(function(b){if(b.dealId&&i(b,a))return e({},b.adUnitCode,p(b,c.filter(function(a){return void 0!==b.adserverTargeting[a]})))}).filter(function(a){return a})}(F,B)));G.map(function(a){Object.keys(a).map(function(b){a[b].map(function(a){-1===D.indexOf(Object.keys(a)[0])&&(D=Object.keys(a).concat(D))})})}),G=G.map(function(a){return e({},Object.keys(a)[0],a[Object.keys(a)[0]].map(function(a){return e({},Object.keys(a)[0],a[Object.keys(a)[0]].join(", "))}).reduce(function(a,b){return d(b,a)},{}))}).reduce(function(a,b){var c=Object.keys(b)[0];return a[c]=d({},a[c],b[c]),a},{});var H,I,J,K=u.b.getConfig("targetingControls.auctionKeyMaxChars");return K&&(Object(t.logInfo)("Detected 'targetingControls.auctionKeyMaxChars' was active for this auction; set with a limit of ".concat(K," characters.  Running checks on auction keys...")),H=G,I=K,J=Object(t.deepClone)(H),G=Object.keys(J).map(function(a){return{adUnitCode:a,adUnitTargeting:J[a]}}).sort(h()).reduce(function(a,b,c,d){var e,f=(e=b.adUnitTargeting,Object.keys(e).reduce(function(a,b){return a+"".concat(b,"%3d").concat(encodeURIComponent(e[b]),"%26")},""));c+1===d.length&&(f=f.slice(0,-3));var g=b.adUnitCode,h=f.length;return h<=I?(I-=h,Object(t.logInfo)("AdUnit '".concat(g,"' auction keys comprised of ").concat(h," characters.  Deducted from running threshold; new limit is ").concat(I),J[g]),a[g]=J[g]):Object(t.logWarn)("The following keys for adUnitCode '".concat(g,"' exceeded the current limit of the 'auctionKeyMaxChars' setting.\nThe key-set size was ").concat(h,", the current allotted amount was ").concat(I,".\n"),J[g]),c+1===d.length&&0===Object.keys(a).length&&Object(t.logError)("No auction targeting keys were permitted due to the setting in setConfig(targetingControls.auctionKeyMaxChars).  Please review setup and consider adjusting."),a},{})),F.forEach(function(a){G[a]||(G[a]={})}),G},r.setTargetingForGPT=function(a,b){window.googletag.pubads().getSlots().forEach(function(c){Object.keys(a).filter((b||Object(t.isAdUnitCodeMatchingSlot))(c)).forEach(function(b){return Object.keys(a[b]).forEach(function(d){var e=a[b][d].split(",");(e=1<e.length?[e]:e).map(function(a){return B.logMessage("Attempting to set key value for slot: ".concat(c.getSlotElementId()," key: ").concat(d," value: ").concat(a)),a}).forEach(function(a){c.setTargeting(d,a)})})})})},r.getWinningBids=function(a){var b=1<arguments.length&&void 0!==arguments[1]?arguments[1]:k(),c=j(a);return b.filter(function(a){return A()(c,a.adUnitCode)}).filter(function(a){return 0<a.cpm}).map(function(a){return a.adUnitCode}).filter(t.uniques).map(function(a){return b.filter(function(b){return b.adUnitCode===a?b:null}).reduce(t.getHighestCpm)})},r.setTargetingForAst=function(a){var b=r.getAllTargeting(a);try{r.resetPresetTargetingAST(a)}catch(a){B.logError("unable to reset targeting for AST"+a)}Object.keys(b).forEach(function(a){return Object.keys(b[a]).forEach(function(c){if(B.logMessage("Attempting to set targeting for targetId: ".concat(a," key: ").concat(c," value: ").concat(b[a][c])),B.isStr(b[a][c])||B.isArray(b[a][c])){var d={};c.search(/pt[0-9]/)<0?d[c.toUpperCase()]=b[a][c]:d[c]=b[a][c],window.apntag.setKeywords(a,d,{overrideKeyValue:!0})}})})},r.isApntagDefined=function(){if(window.apntag&&B.isFn(window.apntag.setKeywords))return!0},r)},function(a,b){a.exports={}},function(a,b,c){"use strict";function d(a,b){return function(a){if(Array.isArray(a))return a}(a)||function(a,b){if(Symbol.iterator in Object(a)||"[object Arguments]"===Object.prototype.toString.call(a)){var c=[],d=!0,e=!1,f=void 0;try{for(var g,h=a[Symbol.iterator]();!(d=(g=h.next()).done)&&(c.push(g.value),!b||c.length!==b);d=!0);}catch(a){e=!0,f=a}finally{try{d||null==h["return"]||h["return"]()}finally{if(e)throw f}}return c}}(a,b)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function e(){return(e=Object.assign||function(a){for(var b=1;b<arguments.length;b++){var c=arguments[b];for(var d in c)Object.prototype.hasOwnProperty.call(c,d)&&(a[d]=c[d])}return a}).apply(this,arguments)}function f(){return{image:[],iframe:[]}}function g(){if(u.syncEnabled&&o.browserSupportsCookies){try{!function(){t.image&&h(q.image,function(a){var b=d(a,2),c=b[0],e=b[1];j.logMessage("Invoking image pixel user sync for bidder: ".concat(c)),j.triggerPixel(e)})}(),function(){t.iframe&&h(q.iframe,function(a){var b=d(a,2),c=b[0],e=b[1];j.logMessage("Invoking iframe user sync for bidder: ".concat(c)),j.insertUserSyncIframe(e)})}()}catch(a){return j.logError("Error firing user syncs",a)}q=f()}}function h(a,b){j.shuffle(a).forEach(function(a){b(a),r.add(a[0])})}function i(a,b){var c=u.filterSettings;if(function(a,b){if(a.all&&a[b])return void j.logWarn('Detected presence of the "filterSettings.all" and "filterSettings.'.concat(b,'" in userSync config.  You cannot mix "all" with "iframe/image" configs; they are mutually exclusive.'));var c=a.all?a.all:a[b],d=a.all?"all":b;if(c){var e=c.filter,f=c.bidders;return e&&"include"!==e&&"exclude"!==e?void j.logWarn('UserSync "filterSettings.'.concat(d,".filter\" setting '").concat(e,"' is not a valid option; use either 'include' or 'exclude'.")):"*"===f||Array.isArray(f)&&0<f.length&&f.every(function(a){return j.isStr(a)&&"*"!==a})||(j.logWarn('Detected an invalid setup in userSync "filterSettings.'.concat(d,".bidders\"; use either '*' (to represent all bidders) or an array of bidders.")),!1)}}(c,a)){t[a]=!0;var d=c.all?c.all:c[a],e="*"===d.bidders?[b]:d.bidders;return{include:function(a,b){return!m()(a,b)},exclude:function(a,b){return m()(a,b)}}[d.filter||"include"](e,b)}}c.d(b,"a",function(){return x});var j=c(0),k=c(3),l=c(11),m=c.n(l),n=c(9);k.b.setDefaults({userSync:j.deepClone({syncEnabled:!0,filterSettings:{image:{bidders:"*",filter:"include"}},syncsPerBidder:5,syncDelay:3e3,auctionDelay:0})});var o,p,q,r,s,t,u,v=Object(n.a)("usersync"),w=!j.isSafariBrowser()&&v.cookiesAreEnabled(),x=(o={config:k.b.getConfig("userSync"),browserSupportsCookies:w},p={},q=f(),r=new Set,t={image:!0,iframe:!(s={})},u=o.config,k.b.getConfig("userSync",function(a){if(a.userSync){var b=a.userSync.filterSettings;j.isPlainObject(b)&&(b.image||b.all||(a.userSync.filterSettings.image={bidders:"*",filter:"include"}))}u=e(u,a.userSync)}),p.registerSync=function(a,b,c){return r.has(b)?j.logMessage('already fired syncs for "'.concat(b,'", ignoring registerSync call')):u.syncEnabled&&j.isArray(q[a])?b?0!==u.syncsPerBidder&&Number(s[b])>=u.syncsPerBidder?j.logWarn('Number of user syncs exceeded for "'.concat(b,'"')):p.canBidderRegisterSync(a,b)?(q[a].push([b,c]),(d=s)[e=b]?d[e]+=1:d[e]=1,void(s=d)):j.logWarn('Bidder "'.concat(b,'" not permitted to register their "').concat(a,'" userSync pixels.')):j.logWarn("Bidder is required for registering sync"):j.logWarn('User sync type "'.concat(a,'" not supported'));var d,e},p.syncUsers=function(){var a=0<arguments.length&&void 0!==arguments[0]?arguments[0]:0;return a?setTimeout(g,Number(a)):void g()},p.triggerUserSyncs=function(){u.enableOverride&&p.syncUsers()},p.canBidderRegisterSync=function(a,b){return!u.filterSettings||!i(a,b)},p)},function(a,b,c){"use strict";c.d(b,"b",function(){return h}),c.d(b,"a",function(){return i}),b.d=function(a,b){var c=Object(d.getBidRequest)(a.requestId,b),e=c&&Object(d.deepAccess)(c,"mediaTypes.video"),f=e&&Object(d.deepAccess)(e,"context");return j(a,c,e,f)},c.d(b,"c",function(){return j}),c(7);var d=c(0),e=c(3),f=c(11),g=(c.n(f),c(13)),h="outstream",i="instream",j=Object(g.b)("sync",function(a,b,c,f){return!b||c&&f!==h?e.b.getConfig("cache.url")||!a.vastXml||a.vastUrl?!(!a.vastUrl&&!a.vastXml):(Object(d.logError)('\n        This bid contains only vastXml and will not work when a prebid cache url is not specified.\n        Try enabling prebid cache with pbjs.setConfig({ cache: {url: "..."} });\n      '),!1):f!==h||!(!a.renderer&&!b.renderer)},"checkVideoBidSetup")},function(a,b,c){"use strict";function d(a,b){var c=2<arguments.length&&void 0!==arguments[2]?arguments[2]:1,d=parseFloat(a);return isNaN(d)&&(d=""),{low:""===d?"":e(a,k,c),med:""===d?"":e(a,l,c),high:""===d?"":e(a,m,c),auto:""===d?"":e(a,o,c),dense:""===d?"":e(a,n,c),custom:""===d?"":e(a,b,c)}}function e(a,b,c){var d="";if(!f(b))return d;var e,g,i,k,l,m,n,o,p,q=b.buckets.reduce(function(a,b){return a.max>b.max?a:b},{max:0}),r=0,s=h()(b.buckets,function(b){if(a>q.max*c){var e=b.precision;void 0===e&&(e=j),d=(b.max*c).toFixed(e)}else{if(a<=b.max*c&&r*c<=a)return b.min=r,b;r=b.max}});return s&&(e=a,i=c,k=void 0!==(g=s).precision?g.precision:j,l=g.increment*i,m=g.min*i,n=Math.pow(10,k+2),o=(e*n-m*n)/(l*n),p=Math.floor(o)*l+m,d=(p=Number(p.toFixed(10))).toFixed(k)),d}function f(a){if(i.isEmpty(a)||!a.buckets||!Array.isArray(a.buckets))return!1;var b=!0;return a.buckets.forEach(function(a){a.max&&a.increment||(b=!1)}),b}c.d(b,"a",function(){return d}),c.d(b,"b",function(){return f});var g=c(12),h=c.n(g),i=c(0),j=2,k={buckets:[{max:5,increment:.5}]},l={buckets:[{max:20,increment:.1}]},m={buckets:[{max:20,increment:.01}]},n={buckets:[{max:3,increment:.01},{max:8,increment:.05},{max:20,increment:.5}]},o={buckets:[{max:5,increment:.05},{max:10,increment:.1},{max:20,increment:.5}]}},function(a,b){a.exports=function(a,b){return{enumerable:!(1&a),configurable:!(2&a),writable:!(4&a),value:b}}},function(a,b,c){var d=c(73),e=c(48);a.exports=function(a){return d(e(a))}},function(a,b){var c={}.toString;a.exports=function(a){return c.call(a).slice(8,-1)}},function(a,b){a.exports=function(a){if(null==a)throw TypeError("Can't call method on "+a);return a}},function(a,b,c){var d=c(57),e=Math.min;a.exports=function(a){return 0<a?e(d(a),9007199254740991):0}},function(a,b){a.exports=function(){}},function(a,b,c){var d=c(25);a.exports=d},function(a,b){a.exports={}},function(a,b,c){var d,e,f,g=c(119),h=c(22),i=c(23),j=c(28),k=c(24),l=c(64),m=c(52),n=h.WeakMap;if(g){var o=new n,p=o.get,q=o.has,r=o.set;d=function(a,b){return r.call(o,a,b),b},e=function(a){return p.call(o,a)||{}},f=function(a){return q.call(o,a)}}else{var s=l("state");m[s]=!0,d=function(a,b){return j(a,s,b),b},e=function(a){return k(a,s)?a[s]:{}},f=function(a){return k(a,s)}}a.exports={set:d,get:e,has:f,enforce:function(a){return f(a)?e(a):d(a,{})},getterFor:function(a){return function(b){var c;if(!i(b)||(c=e(b)).type!==a)throw TypeError("Incompatible receiver, "+a+" required");return c}}}},function(a,b,c){var d=c(23);a.exports=function(a,b){if(!d(a))return a;var c,e;if(b&&"function"==typeof(c=a.toString)&&!d(e=c.call(a)))return e;if("function"==typeof(c=a.valueOf)&&!d(e=c.call(a)))return e;if(!b&&"function"==typeof(c=a.toString)&&!d(e=c.call(a)))return e;throw TypeError("Can't convert object to primitive value")}},function(a,b,c){function d(a){var b=1==a,c=2==a,d=3==a,k=4==a,l=6==a,m=5==a||l;return function(n,o,p,q){for(var r,s,t=g(n),u=f(t),v=e(o,p,3),w=h(u.length),x=0,y=q||i,z=b?y(n,w):c?y(n,0):void 0;x<w;x++)if((m||x in u)&&(s=v(r=u[x],x,t),a))if(b)z[x]=s;else if(s)switch(a){case 3:return!0;case 5:return r;case 6:return x;case 2:j.call(z,r)}else if(k)return!1;return l?-1:d||k?k:z}}var e=c(21),f=c(73),g=c(56),h=c(49),i=c(107),j=[].push;a.exports={forEach:d(0),map:d(1),filter:d(2),some:d(3),every:d(4),find:d(5),findIndex:d(6)}},function(a,b,c){var d=c(48);a.exports=function(a){return Object(d(a))}},function(a,b){var c=Math.ceil,d=Math.floor;a.exports=function(a){return isNaN(a=+a)?0:(0<a?d:c)(a)}},function(a,b){var c=0,d=Math.random();a.exports=function(a){return"Symbol("+String(void 0===a?"":a)+")_"+(++c+d).toString(36)}},function(a,b,c){function d(a){throw a}var e=c(26),f=c(27),g=c(24),h=Object.defineProperty,i={};a.exports=function(a,b){if(g(i,a))return i[a];var c=[][a],j=!!g(b=b||{},"ACCESSORS")&&b.ACCESSORS,k=g(b,0)?b[0]:d,l=g(b,1)?b[1]:void 0;return i[a]=!!c&&!f(function(){if(j&&!e)return!0;var a={length:-1};j?h(a,1,{enumerable:!0,get:d}):a[1]=1,c.call(a,k,l)})}},function(a,b,c){var d=c(61),e=c(36),f=c(19)("iterator");a.exports=function(a){if(null!=a)return a[f]||a["@@iterator"]||e[d(a)]}},function(a,b,c){var d=c(62),e=c(47),f=c(19)("toStringTag"),g="Arguments"==e(function(){return arguments}());a.exports=d?e:function(a){var b,c,d;return void 0===a?"Undefined":null===a?"Null":"string"==typeof(c=function(a,b){try{return a[b]}catch(a){}}(b=Object(a),f))?c:g?e(b):"Object"==(d=e(b))&&"function"==typeof b.callee?"Arguments":d}},function(a,b,c){var d={};d[c(19)("toStringTag")]="z",a.exports="[object z]"===String(d)},function(a,b,c){var d=c(62),e=c(29).f,f=c(28),g=c(24),h=c(118),i=c(19)("toStringTag");a.exports=function(a,b,c,j){if(a){var k=c?a:a.prototype;g(k,i)||e(k,i,{configurable:!0,value:b}),j&&!d&&f(k,"toString",h)}}},function(a,b,c){var d=c(76),e=c(58),f=d("keys");a.exports=function(a){return f[a]||(f[a]=e(a))}},function(a,b,c){"use strict";function d(){return this}var e=c(14),f=c(127),g=c(89),h=c(129),i=c(63),j=c(28),k=c(87),l=c(19),m=c(16),n=c(36),o=c(88),p=o.IteratorPrototype,q=o.BUGGY_SAFARI_ITERATORS,r=l("iterator"),s="values",t="entries";a.exports=function(a,b,c,l,o,u,v){function w(a){if(a===o&&E)return E;if(!q&&a in C)return C[a];switch(a){case"keys":case s:case t:return function(){return new c(this,a)}}return function(){return new c(this)}}f(c,b,l);var x,y,z,A=b+" Iterator",B=!1,C=a.prototype,D=C[r]||C["@@iterator"]||o&&C[o],E=!q&&D||w(o),F="Array"==b&&C.entries||D;if(F&&(x=g(F.call(new a)),p!==Object.prototype&&x.next&&(m||g(x)===p||(h?h(x,p):"function"!=typeof x[r]&&j(x,r,d)),i(x,A,!0,!0),m&&(n[A]=d))),o==s&&D&&D.name!==s&&(B=!0,E=function(){return D.call(this)}),m&&!v||C[r]===E||j(C,r,E),n[b]=E,o)if(y={values:w(s),keys:u?E:w("keys"),entries:w(t)},v)for(z in y)!q&&!B&&z in C||k(C,z,y[z]);else e({target:b,proto:!0,forced:q||B},y);return y}},function(a,b,c){"use strict";var d=c(171);a.exports=Function.prototype.bind||d},function(a,b,c){"use strict";function d(a,b,c,d){var e;b in a&&("function"!=typeof(e=d)||"[object Function]"!==h.call(e)||!d())||(k?j(a,b,{configurable:!0,enumerable:!1,value:c,writable:!0}):a[b]=c)}function e(a,b){var c=2<arguments.length?arguments[2]:{},e=f(b);g&&(e=i.call(e,Object.getOwnPropertySymbols(b)));for(var h=0;h<e.length;h+=1)d(a,e[h],b[e[h]],c[e[h]])}var f=c(93),g="function"==typeof Symbol&&"symbol"==typeof Symbol("foo"),h=Object.prototype.toString,i=Array.prototype.concat,j=Object.defineProperty,k=j&&function(){var a={};try{for(var b in j(a,"x",{enumerable:!1,value:a}),a)return!1;return a.x===a}catch(a){return!1}}();e.supportsDescriptors=!!k,a.exports=e},function(a,b,c){"use strict";function d(a,b,c){var d,e,g,h=(e=c,g=f[d=a]=f[d]||{bidders:{}},e?g.bidders[e]=g.bidders[e]||{}:g);return h[b]=(h[b]||0)+1,h[b]}c.d(b,"a",function(){return g});var e=c(0),f={},g={incrementRequestsCounter:function(a){return d(a,"requestsCounter")},incrementBidderRequestsCounter:function(a,b){return d(a,"requestsCounter",b)},incrementBidderWinsCounter:function(a,b){return d(a,"winsCounter",b)},getRequestsCounter:function(a){return Object(e.deepAccess)(f,"".concat(a,".requestsCounter"))||0},getBidderRequestsCounter:function(a,b){return Object(e.deepAccess)(f,"".concat(a,".bidders.").concat(b,".requestsCounter"))||0},getBidderWinsCounter:function(a,b){return Object(e.deepAccess)(f,"".concat(a,".bidders.").concat(b,".winsCounter"))||0}}},function(a,b,c){var d=c(233);a.exports=d},function(a,b,c){"use strict";function d(a){return(d="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(a){return typeof a}:function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a})(a)}function e(){return(e=Object.assign||function(a){for(var b=1;b<arguments.length;b++){var c=arguments[b];for(var d in c)Object.prototype.hasOwnProperty.call(c,d)&&(a[d]=c[d])}return a}).apply(this,arguments)}function f(a,b,c){a.defaultView&&a.defaultView.frameElement&&(a.defaultView.frameElement.width=b,a.defaultView.frameElement.height=c)}function g(a,b){var c=[];return F.isArray(a)&&(b?a.length===b:0<a.length)&&(a.every(function(a){return Object(p.isArrayOfNums)(a,2)})?c=a:Object(p.isArrayOfNums)(a,2)&&c.push(a)),c}function h(a){var b=a.mediaTypes.banner,c=g(b.sizes);0<c.length?(b.sizes=c,a.sizes=c):(F.logError("Detected a mediaTypes.banner object without a proper sizes field.  Please ensure the sizes are listed like: [[300, 250], ...].  Removing invalid mediaTypes.banner object from request."),delete a.mediaTypes.banner)}function i(a){var b=a.mediaTypes.video,c="number"==typeof b.playerSize[0]?2:1,d=g(b.playerSize,c);0<d.length?(2==c&&F.logInfo("Transforming video.playerSize from [640,480] to [[640,480]] so it's in the proper format."),b.playerSize=d,a.sizes=d):(F.logError("Detected incorrect configuration of mediaTypes.video.playerSize.  Please specify only one set of dimensions in a format like: [[640, 480]]. Removing invalid mediaTypes.video.playerSize property from request."),delete a.mediaTypes.video.playerSize)}function j(a){var b=a.mediaTypes["native"];b.image&&b.image.sizes&&!Array.isArray(b.image.sizes)&&(F.logError("Please use an array of sizes for native.image.sizes field.  Removing invalid mediaTypes.native.image.sizes property from request."),delete a.mediaTypes["native"].image.sizes),b.image&&b.image.aspect_ratios&&!Array.isArray(b.image.aspect_ratios)&&(F.logError("Please use an array of sizes for native.image.aspect_ratios field.  Removing invalid mediaTypes.native.image.aspect_ratios property from request."),delete a.mediaTypes["native"].image.aspect_ratios),b.icon&&b.icon.sizes&&!Array.isArray(b.icon.sizes)&&(F.logError("Please use an array of sizes for native.icon.sizes field.  Removing invalid mediaTypes.native.icon.sizes property from request."),delete a.mediaTypes["native"].icon.sizes)}function k(a){var b=t.a[a]().filter(F.bind.call(p.adUnitsFilter,this,t.a.getAdUnitCodes())),c=t.a.getLastAuctionId();return b.map(function(a){return a.adUnitCode}).filter(p.uniques).map(function(a){return b.filter(function(b){return b.auctionId===c&&b.adUnitCode===a})}).filter(function(a){return a&&a[0]&&a[0].adUnitCode}).map(function(a){return b={},c=a[0].adUnitCode,d={bids:a},c in b?Object.defineProperty(b,c,{value:d,enumerable:!0,configurable:!0,writable:!0}):b[c]=d,b;var b,c,d}).reduce(function(a,b){return e(a,b)},{})}function l(a){var b=a.reason,c=a.message,d=a.bid,e=a.id,f={reason:b,message:c};d&&(f.bid=d),e&&(f.adId=e),F.logError(c),H.emit(O,f)}function m(a,b){!function(a){for(var b;b=a.shift();)b()}(C.c),a.call(this,b)}function n(a){a.forEach(function(a){if(void 0===a.called)try{a.call(),a.called=!0}catch(a){F.logError("Error processing command :","prebid.js",a)}})}Object.defineProperty(b,"__esModule",{value:!0}),c.d(b,"adUnitSetupChecks",function(){return W}),c.d(b,"checkAdUnitSetup",function(){return X}),b.executeStorageCallbacks=m;var o=c(20),p=c(0),q=c(239),r=c(42),s=c(3),t=c(32),u=c(40),v=c(13),w=c(240),x=c(11),y=c.n(x),z=c(68),A=c(10),B=c(31),C=c(9),D=Object(o.a)(),E=c(5),F=c(0),G=c(7)["default"],H=c(8),I=r.a.triggerUserSyncs,J=E.EVENTS,K=J.ADD_AD_UNITS,L=J.BID_WON,M=J.REQUEST_BIDS,N=J.SET_TARGETING,O=J.AD_RENDER_FAILED,P=E.AD_RENDER_FAILED_REASON,Q=P.PREVENT_WRITING_ON_MAIN_DOCUMENT,R=P.NO_AD,S=P.EXCEPTION,T=P.CANNOT_FIND_AD,U=P.MISSING_DOC_OR_ADID,V={bidWon:function(a){var b=t.a.getBidsRequested().map(function(a){return a.bids.map(function(a){return a.adUnitCode})}).reduce(p.flatten).filter(p.uniques);return!!F.contains(b,a)||void F.logError('The "'+a+'" placement is not defined.')}};Object(w.a)(),D.bidderSettings=D.bidderSettings||{},D.libLoaded=!0,D.version="v3.19.0",F.logInfo("Prebid.js v3.19.0 loaded"),D.adUnits=D.adUnits||[],D.triggerUserSyncs=I;var W={validateBannerMediaType:h,validateVideoMediaType:i,validateNativeMediaType:j,validateSizes:g},X=Object(v.b)("sync",function(a){return a.filter(function(a){var b=a.mediaTypes;return b&&0!==Object.keys(b).length?(b.banner&&h(a),!b.video||b.video.playerSize&&i(a),b["native"]&&j(a),!0):(F.logError("Detected adUnit.code '".concat(a.code,"' did not have a 'mediaTypes' object defined.  This is a required field for the auction, so this adUnit has been removed.")),!1)})},"checkAdUnitSetup");D.getAdserverTargetingForAdUnitCodeStr=function(a){if(F.logInfo("Invoking pbjs.getAdserverTargetingForAdUnitCodeStr",arguments),a){var b=D.getAdserverTargetingForAdUnitCode(a);return F.transformAdServerTargetingObj(b)}F.logMessage("Need to call getAdserverTargetingForAdUnitCodeStr with adunitCode")},D.getAdserverTargetingForAdUnitCode=function(a){return D.getAdserverTargeting(a)[a]},D.getAdserverTargeting=function(a){return F.logInfo("Invoking pbjs.getAdserverTargeting",arguments),u.a.getAllTargeting(a)},D.getNoBids=function(){return F.logInfo("Invoking pbjs.getNoBids",arguments),k("getNoBids")},D.getBidResponses=function(){return F.logInfo("Invoking pbjs.getBidResponses",arguments),k("getBidsReceived")},D.getBidResponsesForAdUnitCode=function(a){return{bids:t.a.getBidsReceived().filter(function(b){return b.adUnitCode===a})}},D.setTargetingForGPTAsync=function(a,b){if(F.logInfo("Invoking pbjs.setTargetingForGPTAsync",arguments),Object(p.isGptPubadsDefined)()){var c=u.a.getAllTargeting(a);u.a.resetPresetTargeting(a,b),u.a.setTargetingForGPT(c,b),Object.keys(c).forEach(function(a){Object.keys(c[a]).forEach(function(b){"hb_adid"===b&&t.a.setStatusForBids(c[a][b],E.BID_STATUS.BID_TARGETING_SET)})}),H.emit(N,c)}else F.logError("window.googletag is not defined on the page")},D.setTargetingForAst=function(a){F.logInfo("Invoking pbjs.setTargetingForAn",arguments),u.a.isApntagDefined()?(u.a.setTargetingForAst(a),H.emit(N,u.a.getAllTargeting())):F.logError("window.apntag is not defined on the page")},D.renderAd=function(a,b){if(F.logInfo("Invoking pbjs.renderAd",arguments),F.logMessage("Calling renderAd with adId :"+b),a&&b)try{var c=t.a.findBidByAdId(b);if(c){c.ad=F.replaceAuctionPrice(c.ad,c.cpm),c.adUrl=F.replaceAuctionPrice(c.adUrl,c.cpm),t.a.addWinningBid(c),H.emit(L,c);var d=c.height,e=c.width,g=c.ad,h=c.mediaType,i=c.adUrl,j=c.renderer,k=document.createComment("Creative ".concat(c.creativeId," served by ").concat(c.bidder," Prebid.js Header Bidding"));if(F.insertElement(k,a,"body"),Object(A.c)(j))Object(A.b)(j,c);else if(a===document&&!F.inIframe()||"video"===h){var m="Error trying to write ad. Ad render call ad id ".concat(b," was prevented from writing to the main document.");l({reason:Q,message:m,bid:c,id:b})}else if(g){if(navigator.userAgent&&-1<navigator.userAgent.toLowerCase().indexOf("firefox/")){var n=navigator.userAgent.toLowerCase().match(/firefox\/([\d\.]+)/)[1];n&&parseInt(n,10)<67&&a.open("text/html","replace")}a.write(g),a.close(),f(a,e,d),F.callBurl(c)}else if(i){var o=F.createInvisibleIframe();o.height=d,o.width=e,o.style.display="inline",o.style.overflow="hidden",o.src=i,F.insertElement(o,a,"body"),f(a,e,d),F.callBurl(c)}else{var p="Error trying to write ad. No ad for bid response id: ".concat(b);l({reason:R,message:p,bid:c,id:b})}}else{var q="Error trying to write ad. Cannot find ad by given id : ".concat(b);l({reason:T,message:q,id:b})}}catch(a){var r="Error trying to write ad Id :".concat(b," to the page:").concat(a.message);l({reason:S,message:r,id:b})}else{var s="Error trying to write ad Id :".concat(b," to the page. Missing document or adId");l({reason:U,message:s,id:b})}},D.removeAdUnit=function(a){F.logInfo("Invoking pbjs.removeAdUnit",arguments),a?(F.isArray(a)?a:[a]).forEach(function(a){for(var b=D.adUnits.length-1;0<=b;b--)D.adUnits[b].code===a&&D.adUnits.splice(b,1)}):D.adUnits=[]},D.requestBids=Object(v.b)("async",function(){var a=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},b=a.bidsBackHandler,c=a.timeout,d=a.adUnits,e=a.adUnitCodes,f=a.labels,g=a.auctionId;H.emit(M);var h=c||s.b.getConfig("bidderTimeout");if(d=d||D.adUnits,F.logInfo("Invoking pbjs.requestBids",arguments),e&&e.length?d=d.filter(function(a){return y()(e,a.code)}):e=d&&d.map(function(a){return a.code}),(d=X(d)).forEach(function(a){var b=Object.keys(a.mediaTypes||{banner:"banner"}),c=a.bids.map(function(a){return a.bidder}),d=G.bidderRegistry,e=s.b.getConfig("s2sConfig"),f=e&&e.bidders,g=f?c.filter(function(a){return!y()(f,a)}):c;a.transactionId=F.generateUUID(),
g.forEach(function(c){var e=d[c],f=e&&e.getSpec&&e.getSpec(),g=f&&f.supportedMediaTypes||["banner"];b.some(function(a){return y()(g,a)})?z.a.incrementBidderRequestsCounter(a.code,c):(F.logWarn(F.unsupportedBidderMessage(a,c)),a.bids=a.bids.filter(function(a){return a.bidder!==c}))}),z.a.incrementRequestsCounter(a.code)}),d&&0!==d.length){var i=t.a.createAuction({adUnits:d,adUnitCodes:e,callback:b,cbTimeout:h,labels:f,auctionId:g}),j=d.length;15<j&&F.logInfo("Current auction ".concat(i.getAuctionId()," contains ").concat(j," adUnits."),d),e.forEach(function(a){return u.a.setLatestAuctionForAdUnit(a,i.getAuctionId())}),i.callBids()}else if(F.logMessage("No adUnits configured. No bids requested."),"function"==typeof b)try{b()}catch(a){F.logError("Error executing bidsBackHandler",null,a)}}),D.requestBids.before(m,49),D.addAdUnits=function(a){F.logInfo("Invoking pbjs.addAdUnits",arguments),F.isArray(a)?D.adUnits.push.apply(D.adUnits,a):"object"===d(a)&&D.adUnits.push(a),H.emit(K)},D.onEvent=function(a,b,c){F.logInfo("Invoking pbjs.onEvent",arguments),F.isFn(b)?!c||V[a].call(null,c)?H.on(a,b,c):F.logError('The id provided is not valid for event "'+a+'" and no handler was set.'):F.logError('The event handler provided is not a function and was not set on event "'+a+'".')},D.offEvent=function(a,b,c){F.logInfo("Invoking pbjs.offEvent",arguments),c&&!V[a].call(null,c)||H.off(a,b,c)},D.registerBidAdapter=function(a,b){F.logInfo("Invoking pbjs.registerBidAdapter",arguments);try{G.registerBidAdapter(a(),b)}catch(a){F.logError("Error registering bidder adapter : "+a.message)}},D.registerAnalyticsAdapter=function(a){F.logInfo("Invoking pbjs.registerAnalyticsAdapter",arguments);try{G.registerAnalyticsAdapter(a)}catch(a){F.logError("Error registering analytics adapter : "+a.message)}},D.createBid=function(a){return F.logInfo("Invoking pbjs.createBid",arguments),Object(B.a)(a)},D.enableAnalytics=function(a){a&&!F.isEmpty(a)?(F.logInfo("Invoking pbjs.enableAnalytics for: ",a),G.enableAnalytics(a)):F.logError("pbjs.enableAnalytics should be called with option {}")},D.aliasBidder=function(a,b){F.logInfo("Invoking pbjs.aliasBidder",arguments),a&&b?G.aliasBidAdapter(a,b):F.logError("bidderCode and alias must be passed as arguments","pbjs.aliasBidder")},D.getAllWinningBids=function(){return t.a.getAllWinningBids()},D.getAllPrebidWinningBids=function(){return t.a.getBidsReceived().filter(function(a){return a.status===E.BID_STATUS.BID_TARGETING_SET})},D.getHighestCpmBids=function(a){return u.a.getWinningBids(a)},D.markWinningBidAsUsed=function(a){var b=[];a.adUnitCode&&a.adId?b=t.a.getBidsReceived().filter(function(b){return b.adId===a.adId&&b.adUnitCode===a.adUnitCode}):a.adUnitCode?b=u.a.getWinningBids(a.adUnitCode):a.adId?b=t.a.getBidsReceived().filter(function(b){return b.adId===a.adId}):F.logWarn("Inproper usage of markWinningBidAsUsed. It'll need an adUnitCode and/or adId to function."),0<b.length&&(b[0].status=E.BID_STATUS.RENDERED)},D.getConfig=s.b.getConfig,D.setConfig=s.b.setConfig,D.setBidderConfig=s.b.setBidderConfig,D.que.push(function(){return Object(q.a)()}),D.cmd.push=function(a){if("function"==typeof a)try{a.call()}catch(a){F.logError("Error processing command :",a.message,a.stack)}else F.logError("Commands written into pbjs.cmd.push must be wrapped in a function")},D.que.push=D.cmd.push,D.processQueue=function(){v.b.ready(),n(D.que),n(D.cmd)},b["default"]=D},,function(a,b,c){"use strict";b.a=function(a,b){f.adServers=f.adServers||{},f.adServers[a]=f.adServers[a]||{},Object.keys(b).forEach(function(c){f.adServers[a][c]?Object(e.logWarn)("Attempting to add an already registered function property ".concat(c," for AdServer ").concat(a,".")):f.adServers[a][c]=b[c]})};var d=c(20),e=c(0),f=Object(d.a)()},function(a,b,c){var d=c(27),e=c(47),f="".split;a.exports=d(function(){return!Object("z").propertyIsEnumerable(0)})?function(a){return"String"==e(a)?f.call(a,""):Object(a)}:Object},function(a,b,c){var d=c(26),e=c(27),f=c(75);a.exports=!d&&!e(function(){return 7!=Object.defineProperty(f("div"),"a",{get:function(){return 7}}).a})},function(a,b,c){var d=c(22),e=c(23),f=d.document,g=e(f)&&e(f.createElement);a.exports=function(a){return g?f.createElement(a):{}}},function(a,b,c){var d=c(16),e=c(77);(a.exports=function(a,b){return e[a]||(e[a]=void 0!==b?b:{})})("versions",[]).push({version:"3.6.4",mode:d?"pure":"global",copyright:"© 2020 Denis Pushkarev (zloirock.ru)"})},function(a,b,c){var d=c(22),e=c(109),f="__core-js_shared__",g=d[f]||e(f,{});a.exports=g},function(a,b,c){var d=c(27);a.exports=!!Object.getOwnPropertySymbols&&!d(function(){return!String(Symbol())})},function(a,b,c){function d(a){return function(b,c,d){var h,i=e(b),j=f(i.length),k=g(d,j);if(a&&c!=c){for(;k<j;)if((h=i[k++])!=h)return!0}else for(;k<j;k++)if((a||k in i)&&i[k]===c)return a||k||0;return!a&&-1}}var e=c(46),f=c(49),g=c(113);a.exports={includes:d(!0),indexOf:d(!1)}},function(a,b,c){var d=c(114);c(137),c(139),c(141),c(143),c(145),c(146),c(147),c(148),c(149),c(150),c(151),c(152),c(153),c(154),c(155),c(156),c(157),c(158),a.exports=d},function(a,b,c){function d(a){h(a,k,{value:{objectID:"O"+ ++l,weakData:{}}})}var e=c(52),f=c(23),g=c(24),h=c(29).f,i=c(58),j=c(117),k=i("meta"),l=0,m=Object.isExtensible||function(){return!0},n=a.exports={REQUIRED:!1,fastKey:function(a,b){if(!f(a))return"symbol"==typeof a?a:("string"==typeof a?"S":"P")+a;if(!g(a,k)){if(!m(a))return"F";if(!b)return"E";d(a)}return a[k].objectID},getWeakData:function(a,b){if(!g(a,k)){if(!m(a))return!0;if(!b)return!1;d(a)}return a[k].weakData},onFreeze:function(a){return j&&n.REQUIRED&&m(a)&&!g(a,k)&&d(a),a}};e[k]=!0},function(a,b,c){var d=c(19),e=c(36),f=d("iterator"),g=Array.prototype;a.exports=function(a){return void 0!==a&&(e.Array===a||g[f]===a)}},function(a,b,c){var d=c(15);a.exports=function(a,b,c,e){try{return e?b(d(c)[0],c[1]):b(c)}catch(b){var f=a["return"];throw void 0!==f&&d(f.call(a)),b}}},function(a,b){a.exports=function(a,b,c){if(!(a instanceof b))throw TypeError("Incorrect "+(c?c+" ":"")+"invocation");return a}},function(a,b,c){function d(){}function e(a){return"<script>"+a+"</"+o+">"}var f,g=c(15),h=c(122),i=c(86),j=c(52),k=c(125),l=c(75),m=c(64),n="prototype",o="script",p=m("IE_PROTO"),q=function(){try{f=document.domain&&new ActiveXObject("htmlfile")}catch(a){}var a,b;q=f?function(a){a.write(e("")),a.close();var b=a.parentWindow.Object;return a=null,b}(f):((b=l("iframe")).style.display="none",k.appendChild(b),b.src=String("javascript:"),(a=b.contentWindow.document).open(),a.write(e("document.F=Object")),a.close(),a.F);for(var c=i.length;c--;)delete q[n][i[c]];return q()};j[p]=!0,a.exports=Object.create||function(a,b){var c;return null!==a?(d[n]=g(a),c=new d,d[n]=null,c[p]=a):c=q(),void 0===b?c:h(c,b)}},function(a,b){a.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]},function(a,b,c){var d=c(28);a.exports=function(a,b,c,e){e&&e.enumerable?a[b]=c:d(a,b,c)}},function(a,b,c){"use strict";var d,e,f,g=c(89),h=c(28),i=c(24),j=c(19),k=c(16),l=j("iterator"),m=!1;[].keys&&("next"in(f=[].keys())?(e=g(g(f)))!==Object.prototype&&(d=e):m=!0),null==d&&(d={}),k||i(d,l)||h(d,l,function(){return this}),a.exports={IteratorPrototype:d,BUGGY_SAFARI_ITERATORS:m}},function(a,b,c){var d=c(24),e=c(56),f=c(64),g=c(128),h=f("IE_PROTO"),i=Object.prototype;a.exports=g?Object.getPrototypeOf:function(a){return a=e(a),d(a,h)?a[h]:"function"==typeof a.constructor&&a instanceof a.constructor?a.constructor.prototype:a instanceof Object?i:null}},function(a,b,c){"use strict";var d=c(133).charAt,e=c(53),f=c(65),g="String Iterator",h=e.set,i=e.getterFor(g);f(String,"String",function(a){h(this,{type:g,string:String(a),index:0})},function(){var a,b=i(this),c=b.string,e=b.index;return e>=c.length?{value:void 0,done:!0}:(a=d(c,e),b.index+=a.length,{value:a,done:!1})})},function(a,b,c){var d=c(15),e=c(60);a.exports=function(a){var b=e(a);if("function"!=typeof b)throw TypeError(String(a)+" is not iterable");return d(b.call(a))}},function(a,b,c){var d=c(159);a.exports=d},function(a,b,c){"use strict";var d=Array.prototype.slice,e=c(94),f=Object.keys,g=f?function(a){return f(a)}:c(166),h=Object.keys;g.shim=function(){return Object.keys?function(){var a=Object.keys(arguments);return a&&a.length===arguments.length}(1,2)||(Object.keys=function(a){return h(e(a)?d.call(a):a)}):Object.keys=g,Object.keys||g},a.exports=g},function(a,b,c){"use strict";var d=Object.prototype.toString;a.exports=function(a){var b=d.call(a),c="[object Arguments]"===b;return c=c||"[object Array]"!==b&&null!==a&&"object"==typeof a&&"number"==typeof a.length&&0<=a.length&&"[object Function]"===d.call(a.callee)}},function(a,b,c){"use strict";var d=Object,e=TypeError;a.exports=function(){if(null!=this&&this!==d(this))throw new e("RegExp.prototype.flags getter called on non-object");var a="";return this.global&&(a+="g"),this.ignoreCase&&(a+="i"),this.multiline&&(a+="m"),this.dotAll&&(a+="s"),this.unicode&&(a+="u"),this.sticky&&(a+="y"),a}},function(a,b,c){"use strict";var d=c(95),e=c(67).supportsDescriptors,f=Object.getOwnPropertyDescriptor,g=TypeError;a.exports=function(){if(!e)throw new g("RegExp.prototype.flags requires a true ES5 environment that supports property descriptors");if("gim"===/a/gim.flags){var a=f(RegExp.prototype,"flags");if(a&&"function"==typeof a.get&&"boolean"==typeof/a/.dotAll)return a.get}return d}},function(a,b,c){"use strict";b.a=function(a){var b=a;return{callBids:function(){},setBidderCode:function(a){b=a},getBidderCode:function(){return b}}}},function(a,b,c){"use strict";function d(a){return(d="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(a){return typeof a}:function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a})(a)}function e(a){return a.reduce(function(a,b){if("object"===d(b)&&"string"==typeof b.mediaQuery){var c=!1;if(""===b.mediaQuery)c=!0;else try{c=Object(g.getWindowTop)().matchMedia(b.mediaQuery).matches}catch(e){Object(g.logWarn)("Unfriendly iFrame blocks sizeConfig from being correctly evaluated"),c=matchMedia(b.mediaQuery).matches}c&&(Array.isArray(b.sizesSupported)&&(a.shouldFilter=!0),["labels","sizesSupported"].forEach(function(c){return(b[c]||[]).forEach(function(b){return a[c][b]=!0})}))}else Object(g.logWarn)('sizeConfig rule missing required property "mediaQuery"');return a},{labels:{},sizesSupported:{},shouldFilter:!1})}b.a=function(a,b){return a.labelAll?{labelAll:!0,labels:a.labelAll,activeLabels:b}:{labelAll:!1,labels:a.labelAny,activeLabels:b}},b.c=function(a){var b=e(1<arguments.length&&void 0!==arguments[1]?arguments[1]:j);return!b.shouldFilter||!!b.sizesSupported[a]},b.b=function(){var a=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},b=a.labels,c=void 0===b?[]:b,d=a.labelAll,f=void 0!==d&&d,h=a.activeLabels,k=void 0===h?[]:h,l=1<arguments.length?arguments[1]:void 0,m=2<arguments.length?arguments[2]:void 0,n=e(3<arguments.length&&void 0!==arguments[3]?arguments[3]:j);l=Object(g.isPlainObject)(l)?Object(g.deepClone)(l):m?{banner:{sizes:m}}:{};var o=Object(g.deepAccess)(l,"banner.sizes");n.shouldFilter&&o&&(l.banner.sizes=o.filter(function(a){return n.sizesSupported[a]}));var p=Object.keys(l),q={active:p.every(function(a){return"banner"!==a})||p.some(function(a){return"banner"===a})&&0<Object(g.deepAccess)(l,"banner.sizes.length")&&(0===c.length||!f&&(c.some(function(a){return n.labels[a]})||c.some(function(a){return i()(k,a)}))||f&&c.reduce(function(a,b){return a?n.labels[b]||i()(k,b):a},!0)),mediaTypes:l};return o&&o.length!==l.banner.sizes.length&&(q.filterResults={before:o,after:l.banner.sizes}),q};var f=c(3),g=c(0),h=c(11),i=c.n(h),j=[];f.b.getConfig("sizeConfig",function(a){return b=a.sizeConfig,void(j=b);var b})},function(a,b,c){"use strict";function d(a){var b,c,d,e={type:"xml",value:a.vastXml?a.vastXml:(b=a.vastUrl,c=a.vastImpUrl,d=c?"<![CDATA[".concat(c,"]]>"):"",'<VAST version="3.0">\n    <Ad>\n      <Wrapper>\n        <AdSystem>prebid.org wrapper</AdSystem>\n        <VASTAdTagURI><![CDATA['.concat(b,"]]></VASTAdTagURI>\n        <Impression>").concat(d,"</Impression>\n        <Creatives></Creatives>\n      </Wrapper>\n    </Ad>\n  </VAST>")),ttlseconds:Number(a.ttl)};return f.b.getConfig("cache.vasttrack")&&(e.bidder=a.bidder,e.bidid=a.requestId),"string"==typeof a.customCacheKey&&""!==a.customCacheKey&&(e.key=a.customCacheKey),e}b.b=function(a,b){var c={puts:a.map(d)};Object(e.a)(f.b.getConfig("cache.url"),function(a){return{success:function(b){var c;try{c=JSON.parse(b).responses}catch(b){return void a(b,[])}c?a(null,c):a(new Error("The cache server didn't respond with a responses property."),[])},error:function(b,c){a(new Error("Error storing video ad in the cache: ".concat(b,": ").concat(JSON.stringify(c))),[])}}}(b),JSON.stringify(c),{contentType:"text/plain",withCredentials:!0})},b.a=function(a){return"".concat(f.b.getConfig("cache.url"),"?uuid=").concat(a)};var e=c(4),f=c(3)},,,function(a,b,c){c(103);var d=c(51);a.exports=d("Array","find")},function(a,b,c){"use strict";var d=c(14),e=c(55).find,f=c(50),g=c(59),h="find",i=!0,j=g(h);h in[]&&Array(1)[h](function(){i=!1}),d({target:"Array",proto:!0,forced:i||!j},{find:function(a,b){return e(this,a,1<arguments.length?b:void 0)}}),f(h)},function(a,b,c){var d=c(26),e=c(105),f=c(45),g=c(46),h=c(54),i=c(24),j=c(74),k=Object.getOwnPropertyDescriptor;b.f=d?k:function(a,b){if(a=g(a),b=h(b,!0),j)try{return k(a,b)}catch(a){}if(i(a,b))return f(!e.f.call(a,b),a[b])}},function(a,b,c){"use strict";var d={}.propertyIsEnumerable,e=Object.getOwnPropertyDescriptor,f=e&&!d.call({1:2},1);b.f=f?function(a){var b=e(this,a);return!!b&&b.enumerable}:d},function(a,b,c){function d(a,b){var c=h[g(a)];return c==j||c!=i&&("function"==typeof b?e(b):!!b)}var e=c(27),f=/#|\.prototype\./,g=d.normalize=function(a){return String(a).replace(f,".").toLowerCase()},h=d.data={},i=d.NATIVE="N",j=d.POLYFILL="P";a.exports=d},function(a,b,c){var d=c(23),e=c(108),f=c(19)("species");a.exports=function(a,b){var c;return e(a)&&("function"==typeof(c=a.constructor)&&(c===Array||e(c.prototype))||d(c)&&null===(c=c[f]))&&(c=void 0),new(void 0===c?Array:c)(0===b?0:b)}},function(a,b,c){var d=c(47);a.exports=Array.isArray||function(a){return"Array"==d(a)}},function(a,b,c){var d=c(22),e=c(28);a.exports=function(a,b){try{e(d,a,b)}catch(c){d[a]=b}return b}},function(a,b,c){var d=c(78);a.exports=d&&!Symbol.sham&&"symbol"==typeof Symbol.iterator},function(a,b,c){c(112);var d=c(51);a.exports=d("Array","includes")},function(a,b,c){"use strict";var d=c(14),e=c(79).includes,f=c(50);d({target:"Array",proto:!0,forced:!c(59)("indexOf",{ACCESSORS:!0,1:0})},{includes:function(a,b){return e(this,a,1<arguments.length?b:void 0)}}),f("includes")},function(a,b,c){var d=c(57),e=Math.max,f=Math.min;a.exports=function(a,b){var c=d(a);return c<0?e(c+b,0):f(c,b)}},function(a,b,c){c(115),c(132),c(90),c(134);var d=c(41);a.exports=d.Set},function(a,b,c){"use strict";var d=c(116),e=c(121);a.exports=d("Set",function(a){return function(b){return a(this,arguments.length?b:void 0)}},e)},function(a,b,c){"use strict";var d=c(14),e=c(22),f=c(81),g=c(27),h=c(28),i=c(17),j=c(84),k=c(23),l=c(63),m=c(29).f,n=c(55).forEach,o=c(26),p=c(53),q=p.set,r=p.getterFor;a.exports=function(a,b,c){var p,s=-1!==a.indexOf("Map"),t=-1!==a.indexOf("Weak"),u=s?"set":"add",v=e[a],w=v&&v.prototype,x={};if(o&&"function"==typeof v&&(t||w.forEach&&!g(function(){(new v).entries().next()}))){p=b(function(b,c){q(j(b,p,a),{type:a,collection:new v}),null!=c&&i(c,b[u],b,s)});var y=r(a);n(["add","clear","delete","forEach","get","has","set","keys","values","entries"],function(a){var b="add"==a||"set"==a;a in w&&(!t||"clear"!=a)&&h(p.prototype,a,function(c,d){var e=y(this).collection;if(!b&&t&&!k(c))return"get"==a&&void 0;var f=e[a](0===c?0:c,d);return b?this:f})}),t||m(p.prototype,"size",{configurable:!0,get:function(){return y(this).collection.size}})}else p=c.getConstructor(b,a,s,u),f.REQUIRED=!0;return l(p,a,!1,!0),x[a]=p,d({global:!0,forced:!0},x),t||c.setStrong(p,a,s),p}},function(a,b,c){var d=c(27);a.exports=!d(function(){return Object.isExtensible(Object.preventExtensions({}))})},function(a,b,c){"use strict";var d=c(62),e=c(61);a.exports=d?{}.toString:function(){return"[object "+e(this)+"]"}},function(a,b,c){var d=c(22),e=c(120),f=d.WeakMap;a.exports="function"==typeof f&&/native code/.test(e(f))},function(a,b,c){var d=c(77),e=Function.toString;"function"!=typeof d.inspectSource&&(d.inspectSource=function(a){return e.call(a)}),a.exports=d.inspectSource},function(a,b,c){"use strict";var d=c(29).f,e=c(85),f=c(126),g=c(21),h=c(84),i=c(17),j=c(65),k=c(131),l=c(26),m=c(81).fastKey,n=c(53),o=n.set,p=n.getterFor;a.exports={getConstructor:function(a,b,c,j){function k(a,b,c){var d,e,f=q(a),g=r(a,b);return g?g.value=c:(f.last=g={index:e=m(b,!0),key:b,value:c,previous:d=f.last,next:void 0,removed:!1},f.first||(f.first=g),d&&(d.next=g),l?f.size++:a.size++,"F"!==e&&(f.index[e]=g)),a}var n=a(function(a,d){h(a,n,b),o(a,{type:b,index:e(null),first:void 0,last:void 0,size:0}),l||(a.size=0),null!=d&&i(d,a[j],a,c)}),q=p(b),r=function(a,b){var c,d=q(a),e=m(b);if("F"!==e)return d.index[e];for(c=d.first;c;c=c.next)if(c.key==b)return c};return f(n.prototype,{clear:function(){for(var a=q(this),b=a.index,c=a.first;c;)c.removed=!0,c.previous&&(c.previous=c.previous.next=void 0),delete b[c.index],c=c.next;a.first=a.last=void 0,l?a.size=0:this.size=0},"delete":function(a){var b=q(this),c=r(this,a);if(c){var d=c.next,e=c.previous;delete b.index[c.index],c.removed=!0,e&&(e.next=d),d&&(d.previous=e),b.first==c&&(b.first=d),b.last==c&&(b.last=e),l?b.size--:this.size--}return!!c},forEach:function(a,b){for(var c,d=q(this),e=g(a,1<arguments.length?b:void 0,3);c=c?c.next:d.first;)for(e(c.value,c.key,this);c&&c.removed;)c=c.previous},has:function(a){return!!r(this,a)}}),f(n.prototype,c?{get:function(a){var b=r(this,a);return b&&b.value},set:function(a,b){return k(this,0===a?0:a,b)}}:{add:function(a){return k(this,a=0===a?0:a,a)}}),l&&d(n.prototype,"size",{get:function(){return q(this).size}}),n},setStrong:function(a,b,c){var d=b+" Iterator",e=p(b),f=p(d);j(a,b,function(a,b){o(this,{type:d,target:a,state:e(a),kind:b,last:void 0})},function(){for(var a=f(this),b=a.kind,c=a.last;c&&c.removed;)c=c.previous;return a.target&&(a.last=c=c?c.next:a.state.first)?"keys"==b?{value:c.key,done:!1}:"values"==b?{value:c.value,done:!1}:{value:[c.key,c.value],done:!1}:{value:a.target=void 0,done:!0}},c?"entries":"values",!c,!0),k(b)}}},function(a,b,c){var d=c(26),e=c(29),f=c(15),g=c(123);a.exports=d?Object.defineProperties:function(a,b){f(a);for(var c,d=g(b),h=d.length,i=0;i<h;)e.f(a,c=d[i++],b[c]);return a}},function(a,b,c){var d=c(124),e=c(86);a.exports=Object.keys||function(a){return d(a,e)}},function(a,b,c){var d=c(24),e=c(46),f=c(79).indexOf,g=c(52);a.exports=function(a,b){var c,h=e(a),i=0,j=[];for(c in h)!d(g,c)&&d(h,c)&&j.push(c);for(;b.length>i;)d(h,c=b[i++])&&(~f(j,c)||j.push(c));return j}},function(a,b,c){var d=c(25);a.exports=d("document","documentElement")},function(a,b,c){var d=c(87);a.exports=function(a,b,c){for(var e in b)c&&c.unsafe&&a[e]?a[e]=b[e]:d(a,e,b[e],c);return a}},function(a,b,c){"use strict";function d(){return this}var e=c(88).IteratorPrototype,f=c(85),g=c(45),h=c(63),i=c(36);a.exports=function(a,b,c){var j=b+" Iterator";return a.prototype=f(e,{next:g(1,c)}),h(a,j,!1,!0),i[j]=d,a}},function(a,b,c){var d=c(27);a.exports=!d(function(){function a(){}return a.prototype.constructor=null,Object.getPrototypeOf(new a)!==a.prototype})},function(a,b,c){var d=c(15),e=c(130);a.exports=Object.setPrototypeOf||("__proto__"in{}?function(){var a,b=!1,c={};try{(a=Object.getOwnPropertyDescriptor(Object.prototype,"__proto__").set).call(c,[]),b=c instanceof Array}catch(c){}return function(c,f){return d(c),e(f),b?a.call(c,f):c.__proto__=f,c}}():void 0)},function(a,b,c){var d=c(23);a.exports=function(a){if(!d(a)&&null!==a)throw TypeError("Can't set "+String(a)+" as a prototype");return a}},function(a,b,c){"use strict";var d=c(25),e=c(29),f=c(19),g=c(26),h=f("species");a.exports=function(a){var b=d(a),c=e.f;g&&b&&!b[h]&&c(b,h,{configurable:!0,get:function(){return this}})}},function(a,b){},function(a,b,c){function d(a){return function(b,c){var d,g,h=String(f(b)),i=e(c),j=h.length;return i<0||j<=i?a?"":void 0:(d=h.charCodeAt(i))<55296||56319<d||i+1===j||(g=h.charCodeAt(i+1))<56320||57343<g?a?h.charAt(i):d:a?h.slice(i,i+2):g-56320+(d-55296<<10)+65536}}var e=c(57),f=c(48);a.exports={codeAt:d(!1),charAt:d(!0)}},function(a,b,c){c(135);var d=c(136),e=c(22),f=c(61),g=c(28),h=c(36),i=c(19)("toStringTag");for(var j in d){var k=e[j],l=k&&k.prototype;l&&f(l)!==i&&g(l,i,j),h[j]=h.Array}},function(a,b,c){"use strict";var d=c(46),e=c(50),f=c(36),g=c(53),h=c(65),i="Array Iterator",j=g.set,k=g.getterFor(i);a.exports=h(Array,"Array",function(a,b){j(this,{type:i,target:d(a),index:0,kind:b})},function(){var a=k(this),b=a.target,c=a.kind,d=a.index++;return!b||d>=b.length?{value:a.target=void 0,done:!0}:"keys"==c?{value:d,done:!1}:"values"==c?{value:b[d],done:!1}:{value:[d,b[d]],done:!1}},"values"),f.Arguments=f.Array,e("keys"),e("values"),e("entries")},function(a,b){a.exports={CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0}},function(a,b,c){c(14)({target:"Set",stat:!0},{from:c(138)})},function(a,b,c){"use strict";var d=c(18),e=c(21),f=c(17);a.exports=function(a,b,c){var g,h,i,j,k=arguments.length,l=1<k?b:void 0;return d(this),(g=void 0!==l)&&d(l),null==a?new this:(h=[],g?(i=0,j=e(l,2<k?c:void 0,2),f(a,function(a){h.push(j(a,i++))})):f(a,h.push,h),new this(h))}},function(a,b,c){c(14)({target:"Set",stat:!0},{of:c(140)})},function(a,b,c){"use strict";a.exports=function(){for(var a=arguments.length,b=new Array(a);a--;)b[a]=arguments[a];return new this(b)}},function(a,b,c){"use strict";var d=c(14),e=c(16),f=c(142);d({target:"Set",proto:!0,real:!0,forced:e},{addAll:function(){return f.apply(this,arguments)}})},function(a,b,c){"use strict";var d=c(15),e=c(18);a.exports=function(){for(var a=d(this),b=e(a.add),c=0,f=arguments.length;c<f;c++)b.call(a,arguments[c]);return a}},function(a,b,c){"use strict";var d=c(14),e=c(16),f=c(144);d({target:"Set",proto:!0,real:!0,forced:e},{deleteAll:function(){return f.apply(this,arguments)}})},function(a,b,c){"use strict";var d=c(15),e=c(18);a.exports=function(){for(var a,b=d(this),c=e(b["delete"]),f=!0,g=0,h=arguments.length;g<h;g++)a=c.call(b,arguments[g]),f=f&&a;return!!f}},function(a,b,c){"use strict";var d=c(14),e=c(16),f=c(15),g=c(21),h=c(34),i=c(17);d({target:"Set",proto:!0,real:!0,forced:e},{every:function(a,b){var c=f(this),d=h(c),e=g(a,1<arguments.length?b:void 0,3);return!i(d,function(a){if(!e(a,a,c))return i.stop()},void 0,!1,!0).stopped}})},function(a,b,c){"use strict";var d=c(14),e=c(16),f=c(25),g=c(15),h=c(18),i=c(37),j=c(17);d({target:"Set",proto:!0,real:!0,forced:e},{difference:function(a){var b=g(this),c=new(i(b,f("Set")))(b),d=h(c["delete"]);return j(a,function(a){d.call(c,a)}),c}})},function(a,b,c){"use strict";var d=c(14),e=c(16),f=c(25),g=c(15),h=c(18),i=c(21),j=c(37),k=c(34),l=c(17);d({target:"Set",proto:!0,real:!0,forced:e},{filter:function(a,b){var c=g(this),d=k(c),e=i(a,1<arguments.length?b:void 0,3),m=new(j(c,f("Set"))),n=h(m.add);return l(d,function(a){e(a,a,c)&&n.call(m,a)},void 0,!1,!0),m}})},function(a,b,c){"use strict";var d=c(14),e=c(16),f=c(15),g=c(21),h=c(34),i=c(17);d({target:"Set",proto:!0,real:!0,forced:e},{find:function(a,b){var c=f(this),d=h(c),e=g(a,1<arguments.length?b:void 0,3);return i(d,function(a){if(e(a,a,c))return i.stop(a)},void 0,!1,!0).result}})},function(a,b,c){"use strict";var d=c(14),e=c(16),f=c(25),g=c(15),h=c(18),i=c(37),j=c(17);d({target:"Set",proto:!0,real:!0,forced:e},{intersection:function(a){var b=g(this),c=new(i(b,f("Set"))),d=h(b.has),e=h(c.add);return j(a,function(a){d.call(b,a)&&e.call(c,a)}),c}})},function(a,b,c){"use strict";var d=c(14),e=c(16),f=c(15),g=c(18),h=c(17);d({target:"Set",proto:!0,real:!0,forced:e},{isDisjointFrom:function(a){var b=f(this),c=g(b.has);return!h(a,function(a){if(!0===c.call(b,a))return h.stop()}).stopped}})},function(a,b,c){"use strict";var d=c(14),e=c(16),f=c(25),g=c(15),h=c(18),i=c(91),j=c(17);d({target:"Set",proto:!0,real:!0,forced:e},{isSubsetOf:function(a){var b=i(this),c=g(a),d=c.has;return"function"!=typeof d&&(c=new(f("Set"))(a),d=h(c.has)),!j(b,function(a){if(!1===d.call(c,a))return j.stop()},void 0,!1,!0).stopped}})},function(a,b,c){"use strict";var d=c(14),e=c(16),f=c(15),g=c(18),h=c(17);d({target:"Set",proto:!0,real:!0,forced:e},{isSupersetOf:function(a){var b=f(this),c=g(b.has);return!h(a,function(a){if(!1===c.call(b,a))return h.stop()}).stopped}})},function(a,b,c){"use strict";var d=c(14),e=c(16),f=c(15),g=c(34),h=c(17);d({target:"Set",proto:!0,real:!0,forced:e},{join:function(a){var b=f(this),c=g(b),d=void 0===a?",":String(a),e=[];return h(c,e.push,e,!1,!0),e.join(d)}})},function(a,b,c){"use strict";var d=c(14),e=c(16),f=c(25),g=c(15),h=c(18),i=c(21),j=c(37),k=c(34),l=c(17);d({target:"Set",proto:!0,real:!0,forced:e},{map:function(a,b){var c=g(this),d=k(c),e=i(a,1<arguments.length?b:void 0,3),m=new(j(c,f("Set"))),n=h(m.add);return l(d,function(a){n.call(m,e(a,a,c))},void 0,!1,!0),m}})},function(a,b,c){"use strict";var d=c(14),e=c(16),f=c(15),g=c(18),h=c(34),i=c(17);d({target:"Set",proto:!0,real:!0,forced:e},{reduce:function(a,b){var c=f(this),d=h(c),e=arguments.length<2,j=e?void 0:b;if(g(a),i(d,function(b){j=e?(e=!1,b):a(j,b,b,c)},void 0,!1,!0),e)throw TypeError("Reduce of empty set with no initial value");return j}})},function(a,b,c){"use strict";var d=c(14),e=c(16),f=c(15),g=c(21),h=c(34),i=c(17);d({target:"Set",proto:!0,real:!0,forced:e},{some:function(a,b){var c=f(this),d=h(c),e=g(a,1<arguments.length?b:void 0,3);return i(d,function(a){if(e(a,a,c))return i.stop()},void 0,!1,!0).stopped}})},function(a,b,c){"use strict";var d=c(14),e=c(16),f=c(25),g=c(15),h=c(18),i=c(37),j=c(17);d({target:"Set",proto:!0,real:!0,forced:e},{symmetricDifference:function(a){var b=g(this),c=new(i(b,f("Set")))(b),d=h(c["delete"]),e=h(c.add);return j(a,function(a){d.call(c,a)||e.call(c,a)}),c}})},function(a,b,c){"use strict";var d=c(14),e=c(16),f=c(25),g=c(15),h=c(18),i=c(37),j=c(17);d({target:"Set",proto:!0,real:!0,forced:e},{union:function(a){var b=g(this),c=new(i(b,f("Set")))(b);return j(a,h(c.add),c),c}})},function(a,b,c){c(90),c(160);var d=c(41);a.exports=d.Array.from},function(a,b,c){var d=c(14),e=c(161);d({target:"Array",stat:!0,forced:!c(163)(function(a){Array.from(a)})},{from:e})},function(a,b,c){"use strict";var d=c(21),e=c(56),f=c(83),g=c(82),h=c(49),i=c(162),j=c(60);a.exports=function(a,b,c){var k,l,m,n,o,p,q=e(a),r="function"==typeof this?this:Array,s=arguments.length,t=1<s?b:void 0,u=void 0!==t,v=j(q),w=0;if(u&&(t=d(t,2<s?c:void 0,2)),null==v||r==Array&&g(v))for(l=new r(k=h(q.length));w<k;w++)p=u?t(q[w],w):q[w],i(l,w,p);else for(o=(n=v.call(q)).next,l=new r;!(m=o.call(n)).done;w++)p=u?f(n,t,[m.value,w],!0):m.value,i(l,w,p);return l.length=w,l}},function(a,b,c){"use strict";var d=c(54),e=c(29),f=c(45);a.exports=function(a,b,c){var g=d(b);g in a?e.f(a,g,f(0,c)):a[g]=c}},function(a,b,c){var d=c(19)("iterator"),e=!1;try{var f=0,g={next:function(){return{done:!!f++}},"return":function(){e=!0}};g[d]=function(){return this},Array.from(g,function(){throw 2})}catch(a){}a.exports=function(a,b){if(!b&&!e)return!1;var c=!1;try{var f={};f[d]=function(){return{next:function(){return{done:c=!0}}}},a(f)}catch(a){}return c}},function(a,b){a.exports=function c(a){var b=Array.isArray(a)?[]:{};for(var d in a){var e=a[d];b[d]=e&&"object"==typeof e?c(e):e}return b}},function(a,b,c){function d(a,b,c){var n=c||{};return!(n.strict?!i(a,b):a!==b)||(!a||!b||"object"!=typeof a&&"object"!=typeof b?n.strict?i(a,b):a==b:function(a,b,c){var i,n;if(typeof a!=typeof b)return!1;if(e(a)||e(b))return!1;if(a.prototype!==b.prototype)return!1;if(h(a)!==h(b))return!1;var o=j(a),p=j(b);if(o!==p)return!1;if(o||p)return a.source===b.source&&k(a)===k(b);if(l(a)&&l(b))return m.call(a)===m.call(b);var q=f(a),r=f(b);if(q!==r)return!1;if(q||r){if(a.length!==b.length)return!1;for(i=0;i<a.length;i++)if(a[i]!==b[i])return!1;return!0}if(typeof a!=typeof b)return!1;try{var s=g(a),t=g(b)}catch(a){return!1}if(s.length!==t.length)return!1;for(s.sort(),t.sort(),i=s.length-1;0<=i;i--)if(s[i]!=t[i])return!1;for(i=s.length-1;0<=i;i--)if(n=s[i],!d(a[n],b[n],c))return!1;return!0}(a,b,n))}function e(a){return null==a}function f(a){return!(!a||"object"!=typeof a||"number"!=typeof a.length||"function"!=typeof a.copy||"function"!=typeof a.slice||0<a.length&&"number"!=typeof a[0])}var g=c(93),h=c(167),i=c(168),j=c(169),k=c(172),l=c(178),m=Date.prototype.getTime;a.exports=d},function(a,b,c){"use strict";var d;if(!Object.keys){var e=Object.prototype.hasOwnProperty,f=Object.prototype.toString,g=c(94),h=Object.prototype.propertyIsEnumerable,i=!h.call({toString:null},"toString"),j=h.call(function(){},"prototype"),k=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],l=function(a){var b=a.constructor;return b&&b.prototype===a},m={$applicationCache:!0,$console:!0,$external:!0,$frame:!0,$frameElement:!0,$frames:!0,$innerHeight:!0,$innerWidth:!0,$onmozfullscreenchange:!0,$onmozfullscreenerror:!0,$outerHeight:!0,$outerWidth:!0,$pageXOffset:!0,$pageYOffset:!0,$parent:!0,$scrollLeft:!0,$scrollTop:!0,$scrollX:!0,$scrollY:!0,$self:!0,$webkitIndexedDB:!0,$webkitStorageInfo:!0,$window:!0},n=function(){if("undefined"==typeof window)return!1;for(var a in window)try{if(!m["$"+a]&&e.call(window,a)&&null!==window[a]&&"object"==typeof window[a])try{l(window[a])}catch(a){return!0}}catch(a){return!0}return!1}();d=function(a){var b=null!==a&&"object"==typeof a,c="[object Function]"===f.call(a),d=g(a),h=b&&"[object String]"===f.call(a),m=[];if(!b&&!c&&!d)throw new TypeError("Object.keys called on a non-object");var o=j&&c;if(h&&0<a.length&&!e.call(a,0))for(var p=0;p<a.length;++p)m.push(String(p));if(d&&0<a.length)for(var q=0;q<a.length;++q)m.push(String(q));else for(var r in a)o&&"prototype"===r||!e.call(a,r)||m.push(String(r));if(i)for(var s=function(a){if("undefined"==typeof window||!n)return l(a);try{return l(a)}catch(a){return!1}}(a),t=0;t<k.length;++t)s&&"constructor"===k[t]||!e.call(a,k[t])||m.push(k[t]);return m}}a.exports=d},function(a,b,c){"use strict";function d(a){return!(f&&a&&"object"==typeof a&&Symbol.toStringTag in a)&&"[object Arguments]"===g.call(a)}function e(a){return!!d(a)||null!==a&&"object"==typeof a&&"number"==typeof a.length&&0<=a.length&&"[object Array]"!==g.call(a)&&"[object Function]"===g.call(a.callee)}var f="function"==typeof Symbol&&"symbol"==typeof Symbol.toStringTag,g=Object.prototype.toString,h=function(){return d(arguments)}();d.isLegacyArguments=e,a.exports=h?d:e},function(a,b,c){"use strict";function d(a){return a!=a}a.exports=function(a,b){return 0===a&&0===b?1/a==1/b:a===b||!(!d(a)||!d(b))}},function(a,b,c){"use strict";var d=c(170),e=RegExp.prototype.exec,f=Object.getOwnPropertyDescriptor,g=Object.prototype.toString,h="function"==typeof Symbol&&"symbol"==typeof Symbol.toStringTag;a.exports=function(a){if(!a||"object"!=typeof a)return!1;if(!h)return"[object RegExp]"===g.call(a);var b=f(a,"lastIndex");return!(!b||!d(b,"value"))&&function(a){try{var b=a.lastIndex;return a.lastIndex=0,e.call(a),!0}catch(a){return!1}finally{a.lastIndex=b}}(a)}},function(a,b,c){"use strict";var d=c(66);a.exports=d.call(Function.call,Object.prototype.hasOwnProperty)},function(a,b,c){"use strict";var d=Array.prototype.slice,e=Object.prototype.toString;
a.exports=function(a){var b=this;if("function"!=typeof b||"[object Function]"!==e.call(b))throw new TypeError("Function.prototype.bind called on incompatible "+b);for(var c,f=d.call(arguments,1),g=Math.max(0,b.length-f.length),h=[],i=0;i<g;i++)h.push("$"+i);if(c=Function("binder","return function ("+h.join(",")+"){ return binder.apply(this,arguments); }")(function(){if(this instanceof c){var e=b.apply(this,f.concat(d.call(arguments)));return Object(e)===e?e:this}return b.apply(a,f.concat(d.call(arguments)))}),b.prototype){var j=function(){};j.prototype=b.prototype,c.prototype=new j,j.prototype=null}return c}},function(a,b,c){"use strict";var d=c(67),e=c(173),f=c(95),g=c(96),h=c(177),i=e(f);d(i,{getPolyfill:g,implementation:f,shim:h}),a.exports=i},function(a,b,c){"use strict";var d=c(66),e=c(174)("%Function%"),f=e.apply,g=e.call;a.exports=function(){return d.apply(g,arguments)},a.exports.apply=function(){return d.apply(f,arguments)}},function(a,b,c){"use strict";function d(){throw new f}var e,f=TypeError,g=Object.getOwnPropertyDescriptor;if(g)try{g({},"")}catch(a){g=null}var h=g?function(){try{return d}catch(a){try{return g(arguments,"callee").get}catch(a){return d}}}():d,i=c(175)(),j=Object.getPrototypeOf||function(a){return a.__proto__},k=e,l="undefined"==typeof Uint8Array?e:j(Uint8Array),m={"%Array%":Array,"%ArrayBuffer%":"undefined"==typeof ArrayBuffer?e:ArrayBuffer,"%ArrayBufferPrototype%":"undefined"==typeof ArrayBuffer?e:ArrayBuffer.prototype,"%ArrayIteratorPrototype%":i?j([][Symbol.iterator]()):e,"%ArrayPrototype%":Array.prototype,"%ArrayProto_entries%":Array.prototype.entries,"%ArrayProto_forEach%":Array.prototype.forEach,"%ArrayProto_keys%":Array.prototype.keys,"%ArrayProto_values%":Array.prototype.values,"%AsyncFromSyncIteratorPrototype%":e,"%AsyncFunction%":void 0,"%AsyncFunctionPrototype%":e,"%AsyncGenerator%":e,"%AsyncGeneratorFunction%":void 0,"%AsyncGeneratorPrototype%":e,"%AsyncIteratorPrototype%":k&&i&&Symbol.asyncIterator?k[Symbol.asyncIterator]():e,"%Atomics%":"undefined"==typeof Atomics?e:Atomics,"%Boolean%":Boolean,"%BooleanPrototype%":Boolean.prototype,"%DataView%":"undefined"==typeof DataView?e:DataView,"%DataViewPrototype%":"undefined"==typeof DataView?e:DataView.prototype,"%Date%":Date,"%DatePrototype%":Date.prototype,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Error,"%ErrorPrototype%":Error.prototype,"%eval%":eval,"%EvalError%":EvalError,"%EvalErrorPrototype%":EvalError.prototype,"%Float32Array%":"undefined"==typeof Float32Array?e:Float32Array,"%Float32ArrayPrototype%":"undefined"==typeof Float32Array?e:Float32Array.prototype,"%Float64Array%":"undefined"==typeof Float64Array?e:Float64Array,"%Float64ArrayPrototype%":"undefined"==typeof Float64Array?e:Float64Array.prototype,"%Function%":Function,"%FunctionPrototype%":Function.prototype,"%Generator%":e,"%GeneratorFunction%":void 0,"%GeneratorPrototype%":e,"%Int8Array%":"undefined"==typeof Int8Array?e:Int8Array,"%Int8ArrayPrototype%":"undefined"==typeof Int8Array?e:Int8Array.prototype,"%Int16Array%":"undefined"==typeof Int16Array?e:Int16Array,"%Int16ArrayPrototype%":"undefined"==typeof Int16Array?e:Int8Array.prototype,"%Int32Array%":"undefined"==typeof Int32Array?e:Int32Array,"%Int32ArrayPrototype%":"undefined"==typeof Int32Array?e:Int32Array.prototype,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":i?j(j([][Symbol.iterator]())):e,"%JSON%":"object"==typeof JSON?JSON:e,"%JSONParse%":"object"==typeof JSON?JSON.parse:e,"%Map%":"undefined"==typeof Map?e:Map,"%MapIteratorPrototype%":"undefined"!=typeof Map&&i?j((new Map)[Symbol.iterator]()):e,"%MapPrototype%":"undefined"==typeof Map?e:Map.prototype,"%Math%":Math,"%Number%":Number,"%NumberPrototype%":Number.prototype,"%Object%":Object,"%ObjectPrototype%":Object.prototype,"%ObjProto_toString%":Object.prototype.toString,"%ObjProto_valueOf%":Object.prototype.valueOf,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":"undefined"==typeof Promise?e:Promise,"%PromisePrototype%":"undefined"==typeof Promise?e:Promise.prototype,"%PromiseProto_then%":"undefined"==typeof Promise?e:Promise.prototype.then,"%Promise_all%":"undefined"==typeof Promise?e:Promise.all,"%Promise_reject%":"undefined"==typeof Promise?e:Promise.reject,"%Promise_resolve%":"undefined"==typeof Promise?e:Promise.resolve,"%Proxy%":"undefined"==typeof Proxy?e:Proxy,"%RangeError%":RangeError,"%RangeErrorPrototype%":RangeError.prototype,"%ReferenceError%":ReferenceError,"%ReferenceErrorPrototype%":ReferenceError.prototype,"%Reflect%":"undefined"==typeof Reflect?e:Reflect,"%RegExp%":RegExp,"%RegExpPrototype%":RegExp.prototype,"%Set%":"undefined"==typeof Set?e:Set,"%SetIteratorPrototype%":"undefined"!=typeof Set&&i?j((new Set)[Symbol.iterator]()):e,"%SetPrototype%":"undefined"==typeof Set?e:Set.prototype,"%SharedArrayBuffer%":"undefined"==typeof SharedArrayBuffer?e:SharedArrayBuffer,"%SharedArrayBufferPrototype%":"undefined"==typeof SharedArrayBuffer?e:SharedArrayBuffer.prototype,"%String%":String,"%StringIteratorPrototype%":i?j(""[Symbol.iterator]()):e,"%StringPrototype%":String.prototype,"%Symbol%":i?Symbol:e,"%SymbolPrototype%":i?Symbol.prototype:e,"%SyntaxError%":SyntaxError,"%SyntaxErrorPrototype%":SyntaxError.prototype,"%ThrowTypeError%":h,"%TypedArray%":l,"%TypedArrayPrototype%":l?l.prototype:e,"%TypeError%":f,"%TypeErrorPrototype%":f.prototype,"%Uint8Array%":"undefined"==typeof Uint8Array?e:Uint8Array,"%Uint8ArrayPrototype%":"undefined"==typeof Uint8Array?e:Uint8Array.prototype,"%Uint8ClampedArray%":"undefined"==typeof Uint8ClampedArray?e:Uint8ClampedArray,"%Uint8ClampedArrayPrototype%":"undefined"==typeof Uint8ClampedArray?e:Uint8ClampedArray.prototype,"%Uint16Array%":"undefined"==typeof Uint16Array?e:Uint16Array,"%Uint16ArrayPrototype%":"undefined"==typeof Uint16Array?e:Uint16Array.prototype,"%Uint32Array%":"undefined"==typeof Uint32Array?e:Uint32Array,"%Uint32ArrayPrototype%":"undefined"==typeof Uint32Array?e:Uint32Array.prototype,"%URIError%":URIError,"%URIErrorPrototype%":URIError.prototype,"%WeakMap%":"undefined"==typeof WeakMap?e:WeakMap,"%WeakMapPrototype%":"undefined"==typeof WeakMap?e:WeakMap.prototype,"%WeakSet%":"undefined"==typeof WeakSet?e:WeakSet,"%WeakSetPrototype%":"undefined"==typeof WeakSet?e:WeakSet.prototype},n=c(66).call(Function.call,String.prototype.replace),o=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,p=/\\(\\)?/g;a.exports=function(a,b){if("string"!=typeof a||0===a.length)throw new TypeError("intrinsic name must be a non-empty string");if(1<arguments.length&&"boolean"!=typeof b)throw new TypeError('"allowMissing" argument must be a boolean');for(var c,d=(c=[],n(a,o,function(a,b,d,e){c[c.length]=d?n(e,p,"$1"):b||a}),c),e=(function(a,b){if(!(a in m))throw new SyntaxError("intrinsic "+a+" does not exist!");if(void 0===m[a]&&!b)throw new f("intrinsic "+a+" exists, but is not available. Please file an issue!");return m[a]}("%"+(0<d.length?d[0]:"")+"%",b)),h=1;h<d.length;h+=1)if(null!=e)if(g&&h+1>=d.length){var i=g(e,d[h]);if(!(b||d[h]in e))throw new f("base intrinsic for "+a+" exists, but the property is not available.");e=i?i.get||i.value:e[d[h]]}else e=e[d[h]];return e}},function(a,b,c){"use strict";(function(b){var d=b.Symbol,e=c(176);a.exports=function(){return"function"==typeof d&&"function"==typeof Symbol&&"symbol"==typeof d("foo")&&"symbol"==typeof Symbol("bar")&&e()}}).call(b,c(33))},function(a,b,c){"use strict";a.exports=function(){if("function"!=typeof Symbol||"function"!=typeof Object.getOwnPropertySymbols)return!1;if("symbol"==typeof Symbol.iterator)return!0;var a={},b=Symbol("test"),c=Object(b);if("string"==typeof b)return!1;if("[object Symbol]"!==Object.prototype.toString.call(b))return!1;if("[object Symbol]"!==Object.prototype.toString.call(c))return!1;for(b in a[b]=42,a)return!1;if("function"==typeof Object.keys&&0!==Object.keys(a).length)return!1;if("function"==typeof Object.getOwnPropertyNames&&0!==Object.getOwnPropertyNames(a).length)return!1;var d=Object.getOwnPropertySymbols(a);if(1!==d.length||d[0]!==b)return!1;if(!Object.prototype.propertyIsEnumerable.call(a,b))return!1;if("function"==typeof Object.getOwnPropertyDescriptor){var e=Object.getOwnPropertyDescriptor(a,b);if(42!==e.value||!0!==e.enumerable)return!1}return!0}},function(a,b,c){"use strict";var d=c(67).supportsDescriptors,e=c(96),f=Object.getOwnPropertyDescriptor,g=Object.defineProperty,h=TypeError,i=Object.getPrototypeOf,j=/a/;a.exports=function(){if(!d||!i)throw new h("RegExp.prototype.flags requires a true ES5 environment that supports property descriptors");var a=e(),b=i(j),c=f(b,"flags");return c&&c.get===a||g(b,"flags",{configurable:!0,enumerable:!1,get:a}),a}},function(a,b,c){"use strict";var d=Date.prototype.getDay,e=Object.prototype.toString,f="function"==typeof Symbol&&"symbol"==typeof Symbol.toStringTag;a.exports=function(a){return"object"==typeof a&&null!==a&&(f?function(a){try{return d.call(a),!0}catch(a){return!1}}(a):"[object Date]"===e.call(a))}},function(a,b,c){"use strict";b.a=function(a,b,c,d,e){for(b=b.split?b.split("."):b,d=0;d<b.length;d++)a=a?a[b[d]]:e;return a===e?c:a}},function(a,b,c){"use strict";b.a=function(a,b,c){b.split&&(b=b.split("."));for(var d,e=0,f=b.length,g=a;e<f;++e)d=g[b[e]],g=g[b[e]]=e===f-1?c:null!=d?d:!~b[e+1].indexOf(".")&&-1<+b[e+1]?[]:{}}},function(a,b){function c(a,b){return Array.prototype.slice.call(a,b)}function d(a){function b(a,b){return"function"==typeof a?l.call(null,"sync",a,b):"string"==typeof a&&"function"==typeof b?l.apply(null,arguments):"object"==typeof a?function(a,b,c){var d=!0;void 0===b&&(b=Object.getOwnPropertyNames(a),d=!1);for(var e={},f=["constructor"];(b=b.filter(function(b){return!("function"!=typeof a[b]||-1!==f.indexOf(b)||b.match(/^_/))})).forEach(function(b){var d=b.split(":"),f=d[0],g=d[1]||"sync";if(!e[f]){var h=a[f];e[f]=a[f]=l(g,h,c?[c,f]:void 0)}}),a=Object.getPrototypeOf(a),d&&a;);return e}.apply(null,arguments):void 0}function j(a){var b=Array.isArray(a)?a:a.split(".");return h.call(b,function(c,d,f){var g=c[d],h=!1;return g||(f===b.length-1?(m||o.push(function(){h||console.warn(e+": referenced '"+a+"' but it was never created")}),c[d]=k(function(a){c[d]=a,h=!0})):c[d]={})},n)}function k(a){function b(a,b,f,g){var h={hook:f,type:b,priority:g||10,remove:function(){var b=a.indexOf(h);-1!==b&&(a.splice(b,1),e(c,d))}};return a.push(h),a.sort(function(a,b){return b.priority-a.priority}),e(c,d),this}var c=[],d=[],e=function(){},f={before:function(a,d){return b.call(this,c,"before",a,d)},after:function(a,c){return b.call(this,d,"after",a,c)},getHooks:function(a){var b=c.concat(d);return"object"==typeof a&&(b=b.filter(function(b){return Object.keys(a).every(function(c){return b[c]===a[c]})})),i(b,{remove:function(){return b.forEach(function(a){a.remove()}),this}})},removeAll:function(){return this.getHooks().remove()}},h={install:function(b,f,g){this.type=b,(e=g)(c,d),a&&a(f)}};return g.set(f.after,h),f}function l(b,f,h){function l(){!m&&("sync"!==b||a.ready&d.SYNC)&&("async"!==b||a.ready&d.ASYNC)?"sync"!==b&&a.ready&d.QUEUE?s.apply=function(){var a=arguments;o.push(function(){q.apply(a[1],a[2])})}:s.apply=function(){throw e+": hooked function not ready"}:s.apply=p}var n=f.after&&g.get(f.after);if(n){if(n.type!==b)throw e+": recreated hookable with different type";return f}var p,q,r=h?j(h):k(),s={get:function(a,b){return r[b]||Reflect.get.apply(Reflect,arguments)}};return m||o.push(l),a.useProxy&&"function"==typeof Proxy&&Proxy.revocable?q=new Proxy(f,s):i(q=function(){return s.apply?s.apply(f,this,c(arguments)):f.apply(this,arguments)},r),g.get(q.after).install(b,q,function(a,d){function e(a){g.push(a.hook)}var f,g=[];p=a.length||d.length?(a.forEach(e),f=g.push(void 0)-1,d.forEach(e),function(a,d,e){function h(a){"sync"===b?j=a:l&&l.apply(null,arguments)}function i(a){if(g[k]){var e=c(arguments);return i.bail=h,e.unshift(i),g[k++].apply(d,e)}"sync"===b?j=a:l&&l.apply(null,arguments)}var j,k=0,l="async"===b&&"function"==typeof e[e.length-1]&&e.pop();return g[f]=function(){var e=c(arguments,1);"async"===b&&l&&(delete i.bail,e.push(i));var f=a.apply(d,e);"sync"===b&&i(f)},i.apply(null,e),j}):void 0,l()}),q}var m,n={},o=[];return(a=i({},f,a)).ready?b.ready=function(){m=!0,function(a){for(var b;b=a.shift();)b()}(o)}:m=!0,b.get=j,b}d.SYNC=1,d.ASYNC=2,d.QUEUE=4;var e="fun-hooks",f=Object.freeze({useProxy:!0,ready:0}),g=new WeakMap,h="2,1,0"===[1].reduce(function(a,b,c){return[a,b,c]},2).toString()?Array.prototype.reduce:function(a,b){var c,d=Object(this),e=d.length>>>0,f=0;if(b)c=b;else{for(;f<e&&!(f in d);)f++;c=d[f++]}for(;f<e;)f in d&&(c=a(c,d[f],f,d)),f++;return c},i=Object.assign||function(a){return h.call(c(arguments,1),function(a,b){return b&&Object.keys(b).forEach(function(c){a[c]=b[c]}),a},a)};a.exports=d},,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,function(a,b,c){c(234);var d=c(51);a.exports=d("Array","findIndex")},function(a,b,c){"use strict";var d=c(14),e=c(55).findIndex,f=c(50),g=c(59),h="findIndex",i=!0,j=g(h);h in[]&&Array(1)[h](function(){i=!1}),d({target:"Array",proto:!0,forced:i||!j},{findIndex:function(a,b){return e(this,a,1<arguments.length?b:void 0)}}),f(h)},,,,,function(a,b,c){"use strict";function d(a){var b,c,d,e,h,k,n,q,r,s,t=a.message?"message":"data",u={};try{u=JSON.parse(a[t])}catch(a){return}if(u&&u.adId){var v=l()(j.a.getBidsReceived(),function(a){return a.adId===u.adId});if(v&&"Prebid Request"===u.message&&(b=v,c=u.adServerDomain,d=a.source,e=b.adId,h=b.ad,k=b.adUrl,n=b.width,q=b.height,r=b.renderer,s=b.cpm,Object(m.c)(r)?Object(m.b)(r,b):e&&(function(a){function b(a){var b,e,f=(b=c,e=d,window.googletag?function(a){return l()(window.googletag.pubads().getSlots(),function(b){return l()(b.getTargetingKeys(),function(c){return o()(b.getTargeting(c),a)})}).getSlotElementId()}(b):window.apntag?function(a){var b=window.apntag.getTag(a);return b&&b.targetId}(e):e),g=document.getElementById(f);return g&&g.querySelector(a)}var c=a.adId,d=a.adUnitCode,e=a.width,f=a.height;["div","iframe"].forEach(function(a){var c=b(a+':not([style*="display: none"])');if(c){var g=c.style;g.width=e+"px",g.height=f+"px"}else Object(i.logWarn)("Unable to locate matching page element for adUnitCode ".concat(d,".  Can't resize it to ad's dimensions.  Please review setup."))})}(b),d.postMessage(JSON.stringify({message:"Prebid Response",ad:Object(i.replaceAuctionPrice)(h,s),adUrl:Object(i.replaceAuctionPrice)(k,s),adId:e,width:n,height:q}),c)),j.a.addWinningBid(v),f.a.emit(p,v)),v&&"Prebid Native"===u.message){if("assetRequest"===u.action){var w=Object(g.c)(u,v);return void a.source.postMessage(JSON.stringify(w),a.origin)}if("click"===Object(g.b)(u,v))return;j.a.addWinningBid(v),f.a.emit(p,v)}}}b.a=function(){window.addEventListener("message",d,!1)};var e=c(8),f=c.n(e),g=c(35),h=c(5),i=(c.n(h),c(0)),j=c(32),k=c(12),l=c.n(k),m=c(10),n=c(11),o=c.n(n),p=h.EVENTS.BID_WON},function(a,b,c){"use strict";function d(a){Object(p.logMessage)("DEBUG: "+a)}function e(a){Object(p.logWarn)("DEBUG: "+a)}function f(a){m=function(a,b,c){return j(this.bidders,c.bidderCode)?void e("bidder '".concat(c.bidderCode,"' excluded from auction by bidder overrides")):(Array.isArray(this.bids)&&this.bids.forEach(function(a){i(a,c.bidderCode,b)||k(a,c,"bidder")}),void a(b,c))}.bind(a),q.c.before(m,5),n=function(a,b){var c=this,d=b.filter(function(a){return!j(c.bidders,a.bidderCode)||(e("bidRequest '".concat(a.bidderCode,"' excluded from auction by bidder overrides")),!1)});Array.isArray(c.bidRequests)&&d.forEach(function(a){c.bidRequests.forEach(function(b){a.bids.forEach(function(c){i(b,a.bidderCode,c.adUnitCode)||k(b,c,"bidRequest")})})}),a(d)}.bind(a),q.e.before(n,5)}function g(){q.c.getHooks({hook:m}).remove(),q.e.getHooks({hook:n}).remove()}function h(a,b){var c=1<arguments.length&&void 0!==b&&b;o.b.setConfig({debug:!0}),g(),f(a),d("bidder overrides enabled".concat(c?" from session":""))}function i(a,b,c){return a.bidder&&a.bidder!==b||!(!a.adUnitCode||a.adUnitCode===c)}function j(a,b){return Array.isArray(a)&&-1===a.indexOf(b)}function k(a,b,c){return Object.keys(a).filter(function(a){return-1===["adUnitCode","bidder"].indexOf(a)}).reduce(function(b,e){return d("bidder overrides changed '".concat(b.adUnitCode,"/").concat(b.bidderCode,"' ").concat(c,".").concat(e," from '").concat(b[e],".js' to '").concat(a[e],"'")),b[e]=a[e],b},b)}function l(a){if(a.enabled){try{window.sessionStorage.setItem(r,JSON.stringify(a))}catch(a){}h(a)}else{g(),d("bidder overrides disabled");try{window.sessionStorage.removeItem(r)}catch(a){}}}b.a=function(a){var b;try{a=a||window.sessionStorage,b=JSON.parse(a.getItem(r))}catch(a){}b&&h(b,!0)};var m,n,o=c(3),p=c(0),q=c(39),r="pbjs:debugging";o.b.getConfig("debugging",function(a){return l(a.debugging)})},,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,function(a,b,c){var d=c(348);a.exports=d},function(a,b,c){c(349);var d=c(51);a.exports=d("String","includes")},function(a,b,c){"use strict";var d=c(14),e=c(350),f=c(48);d({target:"String",proto:!0,forced:!c(352)("includes")},{includes:function(a,b){return!!~String(f(this)).indexOf(e(a),1<arguments.length?b:void 0)}})},function(a,b,c){var d=c(351);a.exports=function(a){if(d(a))throw TypeError("The method doesn't accept regular expressions");return a}},function(a,b,c){var d=c(23),e=c(47),f=c(19)("match");a.exports=function(a){var b;return d(a)&&(void 0!==(b=a[f])?!!b:"RegExp"==e(a))}},function(a,b,c){var d=c(19)("match");a.exports=function(a){var b=/./;try{"/./"[a](b)}catch(c){try{return b[d]=!1,"/./"[a](b)}catch(c){}}return!1}},,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,function(a,b,c){var d=c(463);a.exports=d},function(a,b,c){c(464);var d=c(41);a.exports=d.Number.isInteger},function(a,b,c){c(14)({target:"Number",stat:!0},{isInteger:c(465)})},function(a,b,c){var d=c(23),e=Math.floor;a.exports=function(a){return!d(a)&&isFinite(a)&&e(a)===a}},,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,function(a,b,c){a.exports=c(70)}]),pbjsChunk([261],{269:function(a,b,c){a.exports=c(270)},270:function(a,b,c){"use strict";function d(){return(d=Object.assign||function(a){for(var b=1;b<arguments.length;b++){var c=arguments[b];for(var d in c)Object.prototype.hasOwnProperty.call(c,d)&&(a[d]=c[d])}return a}).apply(this,arguments)}function e(){var a=h(["dcn=","&pos=","&cmd=bid",""]);return e=function(){return a},a}function f(){var a=h(["","/bidRequest?"]);return f=function(){return a},a}function g(){var a=h(["","/pubapi/3.0/","/","/","/","/ADTECH;v=2;cmd=bid;cors=yes;alias=",";misc=",";",""]);return g=function(){return a},a}function h(a,b){return b=b||a.slice(0),Object.freeze(Object.defineProperties(a,{raw:{value:Object.freeze(b)}}))}function i(a){for(var b=arguments.length,c=new Array(1<b?b-1:0),d=1;d<b;d++)c[d-1]=arguments[d];return function(){for(var b=arguments.length,d=new Array(b),e=0;e<b;e++)d[e]=arguments[e];var f=d[d.length-1]||{},g=[a[0]];return c.forEach(function(b,c){var e=n.isInteger(b)?d[b]:f[b];g.push(e,a[c+1])}),g.join("")}}function j(a){return a===q.AOL||a===q.ONEMOBILE}function k(a){if(j(a.bidder)&&a.params.id&&a.params.imp&&a.params.imp[0]){var b=a.params.imp[0];return b.id&&b.tagid&&(b.banner&&b.banner.w&&b.banner.h||b.video&&b.video.mimes&&b.video.minduration&&b.video.maxduration)}}function l(a){return j(a.bidder)&&a.params.dcn&&a.params.pos}function m(a){return((b=a.bidder)===q.AOL||b===q.ONEDISPLAY)&&a.params.placement&&a.params.network;var b}Object.defineProperty(b,"__esModule",{value:!0}),c.d(b,"spec",function(){return B});var n=c(0),o=c(1),p=c(2),q={AOL:"aol",ONEMOBILE:"onemobile",ONEDISPLAY:"onedisplay"},r={GET:"display-get"},s={GET:"mobile-get",POST:"mobile-post"},t={TAG:"iframe",TYPE:"iframe"},u={TAG:"img",TYPE:"image"},v=i(g(),"host","network","placement","pageid","sizeid","alias","misc","dynamicParams"),w=i(f(),"host"),x=i(e(),"dcn","pos","dynamicParams"),y={us:"adserver-us.adtech.advertising.com",eu:"adserver-eu.adtech.advertising.com",as:"adserver-as.adtech.advertising.com"},z="https",A=1,B={code:q.AOL,gvlid:25,aliases:[q.ONEMOBILE,q.ONEDISPLAY],supportedMediaTypes:[p.b],isBidRequestValid:function(a){return m(a)||l(b=a)||k(b);var b},buildRequests:function(a,b){var c=this,d={};return b&&(d.gdpr=b.gdprConsent,d.uspConsent=b.uspConsent),a.map(function(a){var b,e=l(b=a)?s.GET:k(b)?s.POST:m(b)?r.GET:void 0;if(e)return c.formatBidRequest(e,a,d)})},interpretResponse:function(a,b){var c=a.body;if(c){var d=this._parseBidResponse(c,b);if(d)return d}else n.logError("Empty bid response",b.bidderCode,c)},getUserSyncs:function(a,b){var c=!n.isEmpty(b)&&b[0].body;return c&&c.ext&&c.ext.pixels?this.parsePixelItems(c.ext.pixels):[]},formatBidRequest:function(a,b,c){var d;switch(a){case r.GET:d={url:this.buildMarketplaceUrl(b,c),method:"GET",ttl:60};break;case s.GET:d={url:this.buildOneMobileGetUrl(b,c),method:"GET",ttl:3600};break;case s.POST:d={url:this.buildOneMobileBaseUrl(b),method:"POST",ttl:3600,data:this.buildOpenRtbRequestData(b,c),options:{contentType:"application/json",customHeaders:{"x-openrtb-version":"2.2"}}}}return d.bidderCode=b.bidder,d.bidId=b.bidId,d.userSyncOn=b.params.userSyncOn,d},buildMarketplaceUrl:function(a,b){var c,d=a.params,e=d.server,f=d.region||"us";return y.hasOwnProperty(f)||(n.logWarn("Unknown region '".concat(f,"' for AOL bidder.")),f="us"),c=e||y[f],d.region=f,this.applyProtocol(v({host:c,network:d.network,placement:parseInt(d.placement),pageid:d.pageId||0,sizeid:d.sizeId||0,alias:d.alias||n.getUniqueIdentifierStr(),misc:(new Date).getTime(),dynamicParams:this.formatMarketplaceDynamicParams(d,b)}))},buildOneMobileGetUrl:function(a,b){var c=a.params,d=c.dcn,e=c.pos,f=c.ext,g=this.buildOneMobileBaseUrl(a);if(d&&e){var h=this.formatOneMobileDynamicParams(f,b);g+=x({dcn:d,pos:e,dynamicParams:h})}return g},buildOneMobileBaseUrl:function(a){return this.applyProtocol(w({host:a.params.host||"c2shb.ssp.yahoo.com"}))},applyProtocol:function(a){return/^https?:\/\//i.test(a)?a:0===a.indexOf("//")?"".concat(z,":").concat(a):"".concat(z,"://").concat(a)},formatMarketplaceDynamicParams:function(a,b){var c=0<arguments.length&&void 0!==a?a:{},e=1<arguments.length&&void 0!==b?b:{},f={};c.bidFloor&&(f.bidfloor=c.bidFloor),d(f,this.formatKeyValues(c.keyValues)),d(f,this.formatConsentData(e));var g="";return n._each(f,function(a,b){g+="".concat(b,"=").concat(encodeURIComponent(a),";")}),g},formatOneMobileDynamicParams:function(a,b){var c=0<arguments.length&&void 0!==a?a:{},e=1<arguments.length&&void 0!==b?b:{};this.isSecureProtocol()&&(c.secure=A),d(c,this.formatConsentData(e));var f="";return n._each(c,function(a,b){f+="&".concat(b,"=").concat(encodeURIComponent(a))}),f},buildOpenRtbRequestData:function(a,b){var c=1<arguments.length&&void 0!==b?b:{},d={id:a.params.id,imp:a.params.imp};return this.isEUConsentRequired(c)&&(n.deepSetValue(d,"regs.ext.gdpr",A),c.gdpr.consentString&&n.deepSetValue(d,"user.ext.consent",c.gdpr.consentString)),c.uspConsent&&n.deepSetValue(d,"regs.ext.us_privacy",c.uspConsent),d},isEUConsentRequired:function(a){return!!(a&&a.gdpr&&a.gdpr.gdprApplies)},formatKeyValues:function(a){var b={};return n._each(a,function(a,c){b["kv".concat(c)]=a}),b},formatConsentData:function(a){var b={};return this.isEUConsentRequired(a)&&(b.gdpr=A,a.gdpr.consentString&&(b.euconsent=a.gdpr.consentString)),a.uspConsent&&(b.us_privacy=a.uspConsent),b},parsePixelItems:function(a){var b=/\w*(?=\s)/,c=/src=("|')(.*?)\1/,d=[];if(a){var e=a.match(/(img|iframe)[\s\S]*?src\s*=\s*("|')(.*?)\2/gi);e&&e.forEach(function(a){var e=a.match(b)[0],f=a.match(c)[2];e&&e&&d.push({type:e===u.TAG?u.TYPE:t.TYPE,url:f})})}return d},_parseBidResponse:function(a,b){var c,d;try{c=a.seatbid[0].bid[0]}catch(a){return}if(c.ext&&c.ext.encp)d=c.ext.encp;else if(null===(d=c.price)||isNaN(d))return void n.logError("Invalid price in bid response",q.AOL,c);return{bidderCode:b.bidderCode,requestId:b.bidId,ad:c.adm,cpm:d,width:c.w,height:c.h,creativeId:c.crid||0,pubapiId:a.id,currency:a.cur||"USD",dealId:c.dealid,netRevenue:!0,ttl:b.ttl}},isOneMobileBidder:j,isSecureProtocol:function(){return"https:"===document.location.protocol}};Object(o.registerBidder)(B)}},[269]),pbjsChunk([259],{277:function(a,b,c){a.exports=c(278)},278:function(a,b,c){"use strict";function d(a){return(d="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(a){return typeof a}:function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a})(a)}function e(){return(e=Object.assign||function(a){for(var b=1;b<arguments.length;b++){var c=arguments[b];for(var d in c)Object.prototype.hasOwnProperty.call(c,d)&&(a[d]=c[d])}return a}).apply(this,arguments)}function f(a){return function(a){if(Array.isArray(a)){for(var b=0,c=new Array(a.length);b<a.length;b++)c[b]=a[b];return c}}(a)||function(a){if(Symbol.iterator in Object(a)||"[object Arguments]"===Object.prototype.toString.call(a))return Array.from(a)}(a)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}function g(a){return u.isArray(a)&&0<a.length}function h(a){g(a.value)&&""===a.value[0]&&delete a.value}function i(a){var b=a.match(N),c=null!=b&&1<=b.length,d=a.match(O),e=null!=d&&1<=d.length;return a.startsWith(M)&&e&&c}function j(a){var b,c,d={};if(d.sizes=k(a.sizes),d.primary_size=d.sizes[0],d.ad_types=[],d.uuid=a.bidId,a.params.placementId?d.id=parseInt(a.params.placementId,10):d.code=a.params.invCode,d.allow_smaller_sizes=a.params.allowSmallerSizes||!1,d.use_pmt_rule=a.params.usePaymentRule||!1,d.prebid=!0,d.disable_psa=!0,a.params.reserve&&(d.reserve=a.params.reserve),a.params.position&&(d.position={above:1,below:2}[a.params.position]||0),a.params.trafficSourceCode&&(d.traffic_source_code=a.params.trafficSourceCode),a.params.privateSizes&&(d.private_sizes=k(a.params.privateSizes)),a.params.supplyType&&(d.supply_type=a.params.supplyType),a.params.pubClick&&(d.pubclick=a.params.pubClick),a.params.extInvCode&&(d.ext_inv_code=a.params.extInvCode),a.params.externalImpId&&(d.external_imp_id=a.params.externalImpId),!u.isEmpty(a.params.keywords)){var f=u.transformBidderParamKeywords(a.params.keywords);0<f.length&&f.forEach(h),d.keywords=f}if((a.mediaType===x.c||u.deepAccess(a,"mediaTypes.".concat(x.c)))&&(d.ad_types.push(x.c),0===d.sizes.length&&(d.sizes=k([1,1])),a.nativeParams)){var g=(b=a.nativeParams,c={},Object.keys(b).forEach(function(a){var d=L[a]&&L[a].serverName||L[a]||a,f=L[a]&&L[a].requiredParams;if(c[d]=e({},f,b[a]),(d===L.image.serverName||d===L.icon.serverName)&&c[d].sizes){var g=c[d].sizes;(u.isArrayOfNums(g)||u.isArray(g)&&0<g.length&&g.every(function(a){return u.isArrayOfNums(a)}))&&(c[d].sizes=k(c[d].sizes))}d===L.privacyLink&&(c.privacy_supported=!0)}),c);d[x.c]={layouts:[g]}}var i=u.deepAccess(a,"mediaTypes.".concat(x.d)),j=u.deepAccess(a,"mediaTypes.video.context");d.hb_source=i&&"adpod"===j?7:1,a.mediaType!==x.d&&!i||d.ad_types.push(x.d),(a.mediaType===x.d||i&&"outstream"!==j)&&(d.require_asset_url=!0),a.params.video&&(d.video={},Object.keys(a.params.video).filter(function(a){return C()(H,a)}).forEach(function(b){return d.video[b]=a.params.video[b]})),a.renderer&&(d.video=e({},d.video,{custom_renderer_present:!0}));var l=A()(y.a.getAdUnits(),function(b){return a.transactionId===b.transactionId});return l&&l.mediaTypes&&l.mediaTypes.banner&&d.ad_types.push(x.b),0===d.ad_types.length&&delete d.ad_types,d}function k(a){var b=[],c={};if(u.isArray(a)&&2===a.length&&!u.isArray(a[0]))c.width=parseInt(a[0],10),c.height=parseInt(a[1],10),b.push(c);else if("object"===d(a))for(var e=0;e<a.length;e++){var f=a[e];(c={}).width=parseInt(f[0],10),c.height=parseInt(f[1],10),b.push(c)}return b}function l(a){return!!a.params.user}function m(a){return!!parseInt(a.params.member,10)}function n(a){if(a.params)return!!a.params.app}function o(a){return a.params&&a.params.app?!!a.params.app.id:!!a.params.app}function p(a){return!!a.debug}function q(a){return a.mediaTypes&&a.mediaTypes.video&&a.mediaTypes.video.context===x.a}function r(a,b,c){u.isEmpty(a.video)&&(a.video={}),a.video[b]=c}function s(a){var b,c;b=a.adUnitCode,(c=document.getElementById(b).querySelectorAll("div[id^='google_ads']"))[0]&&c[0].style.setProperty("display","none"),a.renderer.push(function(){window.ANOutstreamVideo.renderAd({tagId:a.adResponse.tag_id,sizes:[a.getSize().split("x")],targetId:a.adUnitCode,uuid:a.adResponse.uuid,adResponse:a.adResponse,rendererOptions:a.renderer.getConfig()},function(a,b,c){a.renderer.handleVideoEvent({id:b,eventName:c})}.bind(null,a))})}Object.defineProperty(b,"__esModule",{value:!0}),c.d(b,"spec",function(){return Q});var t=c(10),u=c(0),v=c(3),w=c(1),x=c(2),y=c(32),z=c(12),A=c.n(z),B=c(11),C=c.n(B),D=c(43),E=c(9),F="appnexus",G="https://ib.adnxs.com/ut/v3/prebid",H=["id","mimes","minduration","maxduration","startdelay","skippable","playback_method","frameworks"],I=["age","externalUid","segments","gender","dnt","language"],J=["geo","device_id"],K=["enabled","dongle","member_id","debug_timeout"],L={body:"description",body2:"desc2",cta:"ctatext",image:{serverName:"main_image",requiredParams:{required:!0}},icon:{serverName:"icon",requiredParams:{required:!0}},sponsoredBy:"sponsored_by",privacyLink:"privacy_link",salePrice:"saleprice",displayUrl:"displayurl"},M="<script",N=/\/\/cdn\.adnxs\.com\/v/,O="trk.js",P=Object(E.b)(32,F),Q={code:F,gvlid:32,aliases:["appnexusAst","brealtime","emxdigital","pagescience","defymedia","gourmetads","matomy","featureforward","oftmedia","districtm","adasta","beintoo"],supportedMediaTypes:[x.b,x.d,x.c],isBidRequestValid:function(a){return!!(a.params.placementId||a.params.member&&a.params.invCode)},buildRequests:function(a,b){var c=a.map(j),d=A()(a,l),e={};!0===v.b.getConfig("coppa")&&(e={coppa:!0}),d&&Object.keys(d.params.user).filter(function(a){return C()(I,a)}).forEach(function(a){var b=u.convertCamelToUnderscore(a);e[b]=d.params.user[a]});var g,h=A()(a,n);h&&h.params&&h.params.app&&(g={},Object.keys(h.params.app).filter(function(a){return C()(J,a)}).forEach(function(a){return g[a]=h.params.app[a]}));var i,k=A()(a,o);k&&k.params&&h.params.app&&h.params.app.id&&(i={appid:k.params.app.id});var s={},t={},w=P.getCookie("apn_prebid_debug")||null;if(w)try{s=JSON.parse(w)}catch(a){u.logError("AppNexus Debug Auction Cookie Error:\n\n"+a)}else{var x=A()(a,p);x&&x.debug&&(s=x.debug)}s&&s.enabled&&Object.keys(s).filter(function(a){return C()(K,a)}).forEach(function(a){t[a]=s[a]});var y=A()(a,m),z=y?parseInt(y.params.member,10):0,B=a[0].schain,D={tags:f(c),user:e,sdk:{source:"pbjs",version:"3.19.0"},schain:B};if(0<z&&(D.member_id=z),h&&(D.device=g),k&&(D.app=i),v.b.getConfig("adpod.brandCategoryExclusion")&&(D.brand_category_uniqueness=!0),t.enabled&&(D.debug=t,u.logInfo("AppNexus Debug Auction Settings:\n\n"+JSON.stringify(t,null,4))),b&&b.gdprConsent&&(D.gdpr_consent={consent_string:b.gdprConsent.consentString,consent_required:b.gdprConsent.gdprApplies}),b&&b.uspConsent&&(D.us_privacy=b.uspConsent),b&&b.refererInfo){var E={rd_ref:encodeURIComponent(b.refererInfo.referer),rd_top:b.refererInfo.reachedTop,rd_ifs:b.refererInfo.numIframes,rd_stk:b.refererInfo.stack.map(function(a){return encodeURIComponent(a)}).join(",")};D.referrer_detection=E}A()(a,q)&&a.filter(q).forEach(function(a){var b=function(a,b){var c=b.mediaTypes.video,d=c.durationRangeSec,e=c.requireExactDuration,g=function(a){var b=a.adPodDurationSec,c=a.durationRangeSec,d=a.requireExactDuration,e=u.getMinValueFromArray(c),f=Math.floor(b/e);return d?Math.max(f,c.length):f}(b.mediaTypes.video),h=u.getMaxValueFromArray(d),i=a.filter(function(a){return a.uuid===b.bidId;
}),j=u.fill.apply(u,f(i).concat([g]));if(e){var k=Math.ceil(g/d.length),l=u.chunk(j,k);d.forEach(function(a,b){l[b].map(function(b){r(b,"minduration",a),r(b,"maxduration",a)})})}else j.map(function(a){return r(a,"maxduration",h)});return j}(c,a),d=D.tags.filter(function(b){return b.uuid!==a.bidId});D.tags=[].concat(f(d),f(b))});var F=u.deepAccess(a[0],"userId.criteoId");if(F){var H=[];H.push({provider:"criteo",user_id:F}),D.tpuids=H}return function(a,b){var c=[],d={};if(!function(a){var b=!0;return a&&a.gdprConsent&&a.gdprConsent.gdprApplies&&2===a.gdprConsent.apiVersion&&(b=!(!0!==u.deepAccess(a.gdprConsent,"vendorData.purpose.consents.1"))),b}(b)&&(d={withCredentials:!1}),15<a.tags.length){var e=u.deepClone(a);u.chunk(a.tags,15).forEach(function(a){e.tags=a;var f=JSON.stringify(e);c.push({method:"POST",url:G,data:f,bidderRequest:b,options:d})})}else{var f=JSON.stringify(a);c={method:"POST",url:G,data:f,bidderRequest:b,options:d}}return c}(D,b)},interpretResponse:function(a,b){var c=this,d=b.bidderRequest;a=a.body;var f=[];if(!a||a.error){var g="in response for ".concat(d.bidderCode," adapter");return a&&a.error&&(g+=": ".concat(a.error)),u.logError(g),f}if(a.tags&&a.tags.forEach(function(a){var b,g,h=(b=a)&&b.ads&&b.ads.length&&A()(b.ads,function(a){return a.rtb});if(h&&0!==h.cpm&&C()(c.supportedMediaTypes,h.ad_type)){var i=function(a,b,c){var d=u.getBidRequest(a.uuid,[c]),f={requestId:a.uuid,cpm:b.cpm,creativeId:b.creative_id,dealId:b.deal_id,currency:"USD",netRevenue:!0,ttl:300,adUnitCode:d.adUnitCode,appnexus:{buyerMemberId:b.buyer_member_id,dealPriority:b.deal_priority,dealCode:b.deal_code}};if(b.advertiser_id&&(f.meta=e({},f.meta,{advertiserId:b.advertiser_id})),b.rtb.video)switch(e(f,{width:b.rtb.video.player_width,height:b.rtb.video.player_height,vastImpUrl:b.notify_url,ttl:3600}),u.deepAccess(d,"mediaTypes.video.context")){case x.a:var g=Object(w.getIabSubCategory)(d.bidder,b.brand_category_id);f.meta=e({},f.meta,{iabSubCatId:g});var h=b.deal_priority;f.video={context:x.a,durationSeconds:Math.floor(b.rtb.video.duration_ms/1e3),dealTier:h},f.vastUrl=b.rtb.video.asset_url;break;case D.b:if(f.adResponse=a,f.adResponse.ad=f.adResponse.ads[0],f.adResponse.ad.video=f.adResponse.ad.rtb.video,f.vastXml=b.rtb.video.content,b.renderer_url){var i=A()(c.bids,function(b){return b.bidId===a.uuid}),j=u.deepAccess(i,"renderer.options");f.renderer=function(a,b){var c=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{},d=t.a.install({id:b.renderer_id,url:b.renderer_url,config:c,loaded:!1,adUnitCode:a});try{d.setRender(s)}catch(a){u.logWarn("Prebid Error calling setRender on renderer",a)}return d.setEventHandlers({impression:function(){return u.logMessage("AppNexus outstream video impression event")},loaded:function(){return u.logMessage("AppNexus outstream video loaded event")},ended:function(){u.logMessage("AppNexus outstream renderer video event"),document.querySelector("#".concat(a)).style.display="none"}}),d}(f.adUnitCode,b,j)}break;case D.a:f.vastUrl=b.notify_url+"&redir="+encodeURIComponent(b.rtb.video.asset_url)}else if(b.rtb[x.c]){var k=b.rtb[x.c],l=b.viewability.config.replace("src=","data-src="),m=k.javascript_trackers;null==m?m=l:u.isStr(m)?m=[m,l]:m.push(l),f[x.c]={title:k.title,body:k.desc,body2:k.desc2,cta:k.ctatext,rating:k.rating,sponsoredBy:k.sponsored,privacyLink:k.privacy_link,address:k.address,downloads:k.downloads,likes:k.likes,phone:k.phone,price:k.price,salePrice:k.saleprice,clickUrl:k.link.url,displayUrl:k.displayurl,clickTrackers:k.link.click_trackers,impressionTrackers:k.impression_trackers,javascriptTrackers:m},k.main_img&&(f["native"].image={url:k.main_img.url,height:k.main_img.height,width:k.main_img.width}),k.icon&&(f["native"].icon={url:k.icon.url,height:k.icon.height,width:k.icon.width})}else{e(f,{width:b.rtb.banner.width,height:b.rtb.banner.height,ad:b.rtb.banner.content});try{var n=b.rtb.trackers[0].impression_urls[0],o=u.createTrackPixelHtml(n);f.ad+=o}catch(b){u.logError("Error appending tracking pixel",b)}}return f}(a,h,d);i.mediaType=(g=h.ad_type)===x.d?x.d:g===x.c?x.c:x.b,f.push(i)}}),a.debug&&a.debug.debug_info){var h="AppNexus Debug Auction for Prebid\n\n"+a.debug.debug_info;h=h.replace(/(<td>|<th>)/gm,"\t").replace(/(<\/td>|<\/th>)/gm,"\n").replace(/^<br>/gm,"").replace(/(<br>\n|<br>)/gm,"\n").replace(/<h1>(.*)<\/h1>/gm,"\n\n===== $1 =====\n\n").replace(/<h[2-6]>(.*)<\/h[2-6]>/gm,"\n\n*** $1 ***\n\n").replace(/(<([^>]+)>)/gim,""),u.logMessage("https://console.appnexus.com/docs/understanding-the-debug-auction"),u.logMessage(h)}return f},getMappingFileInfo:function(){return{url:"https://acdn.adnxs.com/prebid/appnexus-mapping/mappings.json",refreshInDays:7}},getUserSyncs:function(a){if(a.iframeEnabled)return[{type:"iframe",url:"https://acdn.adnxs.com/ib/static/usersync/v3/async_usersync.html"}]},transformBidParams:function(a,b){return a=u.convertTypes({member:"string",invCode:"string",placementId:"number",keywords:u.transformBidderParamKeywords},a),b&&(a.use_pmt_rule="boolean"==typeof a.usePaymentRule&&a.usePaymentRule,a.usePaymentRule&&delete a.usePaymentRule,g(a.keywords)&&a.keywords.forEach(h),Object.keys(a).forEach(function(b){var c=u.convertCamelToUnderscore(b);c!==b&&(a[c]=a[b],delete a[b])})),a},onBidWon:function(a){a["native"]&&function(a){var b=function(a){var b;if(u.isStr(a)&&i(a))b=a;else if(u.isArray(a))for(var c=0;c<a.length;c++){var d=a[c];i(d)&&(b=d)}return b}(a["native"].javascriptTrackers);if(b)for(var c="pbjs_adid="+a.adId+";pbjs_auc="+a.adUnitCode,d=function(a){var b=a.indexOf('src="')+5,c=a.indexOf('"',b);return a.substring(b,c)}(b),e=d.replace("dom_id=%native_dom_id%",c),f=document.getElementsByTagName("iframe"),g=!1,h=0;h<f.length&&!g;h++){var j=f[h];try{var k=j.contentDocument||j.contentWindow.document;if(k)for(var l=k.getElementsByTagName("script"),m=0;m<l.length&&!g;m++){var n=l[m];n.getAttribute("data-src")==d&&(n.setAttribute("src",e),n.setAttribute("data-src",""),n.removeAttribute&&n.removeAttribute("data-src"),g=!0)}}catch(a){if(!(a instanceof DOMException&&"SecurityError"===a.name))throw a}}}(a)}};Object(w.registerBidder)(Q)}},[277]),pbjsChunk([227],{345:function(a,b,c){a.exports=c(346)},346:function(a,b,c){"use strict";function d(a){return(d="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(a){return typeof a}:function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a})(a)}function e(a,b){var c={context:this,args:[b],nextFn:a,adUnits:b.adUnits||pbjs.adUnits,bidsBackHandler:b.bidsBackHandler,haveExited:!1,timer:null};return p?(q.logInfo("User consent information already known.  Pulling internally stored information..."),i(null,c)):u()(Object.keys(C),k)?(C[k].call(this,f,g,c),void(c.haveExited||(0===l?f(void 0,c):c.timer=setTimeout(function(a){g("CMP workflow exceeded timeout threshold.",a)}.bind(null,c),l)))):(q.logWarn("CMP framework (".concat(k,") is not a supported framework.  Aborting consentManagement module and resuming auction.")),c.nextFn.apply(c.context,c.args))}function f(a,b){"static"===k&&2===(A=a.getConsentData?1:a.getTCData?2:0)&&(a=a.getTCData);var c=1===A?function(a){var b=a&&a.getConsentData&&a.getConsentData.gdprApplies;return!("boolean"==typeof b&&(!0!==b||q.isStr(a.getConsentData.consentData)&&q.isPlainObject(a.getVendorConsents)&&1<Object.keys(a.getVendorConsents).length))}:2===A?function(){var b=a&&a.gdprApplies,c=a&&a.tcString;return!("boolean"==typeof b&&(!0!==b||q.isStr(c)))}:null;q.isFn(c)?c(a)?g("CMP returned unexpected value during lookup process.",b,a):(clearTimeout(b.timer),h(a),i(null,b)):g("Unable to derive CMP version to process data.  Consent object does not conform to TCF v1 or v2 specs.",b,a)}function g(a,b,c){clearTimeout(b.timer),m&&h(void 0),i(a,b,c)}function h(a){(p=1===A?{consentString:a?a.getConsentData.consentData:void 0,vendorData:a?a.getVendorConsents:void 0,gdprApplies:a?a.getConsentData.gdprApplies:n}:{consentString:a?a.tcString:void 0,vendorData:a||void 0,gdprApplies:a?a.gdprApplies:n}).apiVersion=A,s.gdprDataHandler.setConsentData(p)}function i(a,b,c){if(!1===b.haveExited){b.haveExited=!0;var d=b.context,e=b.args,f=b.nextFn;a?m?(q.logWarn(a+" Resuming auction without consent data as per consentManagement config.",c),f.apply(d,e)):(q.logError(a+" Canceling auction as per consentManagement config.",c),"function"==typeof b.bidsBackHandler?b.bidsBackHandler():q.logError("Error executing bidsBackHandler")):f.apply(d,e)}}function j(a){(a=a.gdpr||a.usp?a.gdpr:a)&&"object"===d(a)?(q.isStr(a.cmpApi)?k=a.cmpApi:(k=x,q.logInfo("consentManagement config did not specify cmp.  Using system default setting (".concat(x,")."))),q.isNumber(a.timeout)?l=a.timeout:(l=y,q.logInfo("consentManagement config did not specify timeout.  Using system default setting (".concat(y,")."))),"boolean"==typeof a.allowAuctionWithoutConsent?m=a.allowAuctionWithoutConsent:(m=z,q.logInfo("consentManagement config did not specify allowAuctionWithoutConsent.  Using system default setting (".concat(z,")."))),n=!0===a.defaultGdprScope,q.logInfo("consentManagement module has been activated..."),"static"===k&&(q.isPlainObject(a.consentData)?(o=a.consentData,l=0):q.logError("consentManagement config with cmpApi: 'static' did not specify consentData. No consents will be available to adapters.")),B||pbjs.requestBids.before(e,50),B=!0):q.logWarn("consentManagement config not defined, exiting consent manager")}Object.defineProperty(b,"__esModule",{value:!0}),c.d(b,"userCMP",function(){return k}),c.d(b,"consentTimeout",function(){return l}),c.d(b,"allowAuction",function(){return m}),c.d(b,"gdprScope",function(){return n}),c.d(b,"staticConsentData",function(){return o}),b.requestBidsHook=e,b.resetConsentData=function(){p=void 0,k=void 0,A=0,s.gdprDataHandler.setConsentData(null)},b.setConsentConfig=j;var k,l,m,n,o,p,q=c(0),r=c(3),s=c(7),t=c(11),u=c.n(t),v=c(347),w=c.n(v),x="iab",y=1e4,z=!0,A=0,B=!1,C={iab:function(a,b,c){function d(d,e){q.logInfo("Received a response from CMP",d),e?("tcloaded"===d.eventStatus||"useractioncomplete"===d.eventStatus||"cmpuishown"===d.eventStatus&&d.tcString&&!0===d.purposeOneTreatment)&&a(d,c):b("CMP unable to register callback function.  Please check CMP setup.",c)}function e(a,b){var d=c.adUnits,e=1,f=1;if(Array.isArray(d)&&0<d.length){var g=q.getAdUnitSizes(d[0]);e=g[0][0],f=g[0][1]}window.$sf.ext.register(e,f,function(c,d){if("cmpReturn"===c){var e="getConsentData"===a?d.vendorConsentData:d.vendorConsents;b(e)}}),window.$sf.ext.cmp(a)}function f(a,b,c){var d=2===A?"__tcfapi":"__cmp";window[d]=function(a,c,e){var f,g,i,j=Math.random()+"",k="".concat(d,"Call"),l=(i={command:a,parameter:c,callId:j},(g=k)in(f={})?Object.defineProperty(f,g,{value:i,enumerable:!0,configurable:!0,writable:!0}):f[g]=i,f);1!==A&&(l[k].version=A),h[j]=e,b.postMessage(l,"*")},window.addEventListener("message",function(a){var b="".concat(d,"Return"),c="string"==typeof a.data&&w()(a.data,b)?JSON.parse(a.data):a.data;if(c[b]&&c[b].callId){var e=c[b];void 0!==h[e.callId]&&h[e.callId](e.returnValue,e.success)}},!1),window[d](a,null,c)}var g=function(){function b(){d.getConsentData&&d.getVendorConsents&&(q.logInfo("Received all requested responses from CMP",d),a(d,c))}var d={};return{consentDataCallback:function(a){d.getConsentData=a,b()},vendorConsentsCallback:function(a){d.getVendorConsents=a,b()}}}(),h={},i=function(){for(var a,b,c=window;!a;){try{if("function"==typeof c.__tcfapi||"function"==typeof c.__cmp){b="function"==typeof c.__tcfapi?(A=2,c.__tcfapi):(A=1,c.__cmp),a=c;break}}catch(a){}try{if(c.frames.__tcfapiLocator){A=2,a=c;break}}catch(a){}try{if(c.frames.__cmpLocator){A=1,a=c;break}}catch(a){}if(c===window.top)break;c=c.parent}return{cmpFrame:a,cmpFunction:b}}(),j=i.cmpFrame,k=i.cmpFunction;return j?void(q.isFn(k)?(q.logInfo("Detected CMP API is directly accessible, calling it now..."),1===A?(k("getConsentData",null,g.consentDataCallback),k("getVendorConsents",null,g.vendorConsentsCallback)):2===A&&k("addEventListener",A,d)):1===A&&window.$sf&&window.$sf.ext&&"function"==typeof window.$sf.ext.cmp?(q.logInfo("Detected Prebid.js is encased in a SafeFrame and CMP is registered, calling it now..."),e("getConsentData",g.consentDataCallback),e("getVendorConsents",g.vendorConsentsCallback)):(q.logInfo("Detected CMP is outside the current iframe where Prebid.js is located, calling it now..."),1===A?(f("getConsentData",j,g.consentDataCallback),f("getVendorConsents",j,g.vendorConsentsCallback)):2===A&&f("addEventListener",j,d))):b("CMP not found.",c)},"static":function(a,b,c){a(o,c)}};r.b.getConfig("consentManagement",function(a){return j(a.consentManagement)})}},[345]),pbjsChunk([0],{365:function(a,b,c){a.exports=c(366)},366:function(a,b,c){"use strict";function d(){return(d=Object.assign||function(a){for(var b=1;b<arguments.length;b++){var c=arguments[b];for(var d in c)Object.prototype.hasOwnProperty.call(c,d)&&(a[d]=c[d])}return a}).apply(this,arguments)}function e(){return"undefined"!=typeof Criteo&&Criteo.PubTag&&Criteo.PubTag.Adapters&&Criteo.PubTag.Adapters.Prebid}function f(a){return a[0]+"x"+a[1]}function g(a){return Array.isArray(a[0])?a.map(function(a){return f(a)}):[f(a)]}function h(a){return void 0!==n.deepAccess(a,"params.video")&&void 0!==n.deepAccess(a,"mediaTypes.video")}function i(){try{var a="criteo_fast_bid",b="// Hash: ",c=v.getDataFromLocalStorage(a);if(null!==c){var d=c.indexOf("\n"),e=c.substr(0,d).trim();if(e.substr(0,b.length)!==b)n.logWarn("No hash found in FastBid"),v.removeDataFromLocalStorage(a);else{var f=e.substr(b.length),g=c.substr(d+1);if(Object(q.verify)(g,f,x,w)){n.logInfo("Using Criteo FastBid");var h=document.createElement("script");h.type="text/javascript",h.text=g,n.insertElement(h)}else n.logWarn("Invalid Criteo FastBid found"),v.removeDataFromLocalStorage(a)}}}catch(a){}}Object.defineProperty(b,"__esModule",{value:!0}),c.d(b,"ADAPTER_VERSION",function(){return s}),c.d(b,"PROFILE_ID_PUBLISHERTAG",function(){return u}),c.d(b,"spec",function(){return y}),b.tryGetCriteoFastBid=i;var j=c(38),k=c(1),l=c(3),m=c(2),n=c(0),o=c(12),p=c.n(o),q=c(367),r=(c.n(q),c(9)),s=29,t="criteo",u=185,v=Object(r.b)(91),w=65537,x="ztQYwCE5BU7T9CDM5he6rKoabstXRmkzx54zFPZkWbK530dwtLBDeaWBMxHBUT55CYyboR/EZ4efghPi3CoNGfGWezpjko9P6p2EwGArtHEeS4slhu/SpSIFMjG6fdrpRoNuIAMhq1Z+Pr/+HOd1pThFKeGFr2/NhtAg+TXAzaU=",y={code:t,gvlid:91,supportedMediaTypes:[m.b,m.d,m.c],isBidRequestValid:function(a){return!(!a||!a.params||!a.params.zoneId&&!a.params.networkId||h(a)&&!function(a){var b=!0;if(["mimes","playerSize","maxduration","protocols","api"].forEach(function(c){void 0===n.deepAccess(a,"mediaTypes.video."+c)&&(b=!1,n.logError("Criteo Bid Adapter: mediaTypes.video."+c+" is required"))}),["skip","placement","playbackmethod"].forEach(function(c){void 0===n.deepAccess(a,"params.video."+c)&&(b=!1,n.logError("Criteo Bid Adapter: params.video."+c+" is required"))}),b){if("instream"==a.mediaTypes.video.context&&1===a.params.video.placement)return 1;if("outstream"==a.mediaTypes.video.context&&1!==a.params.video.placement)return 1}}(a))},buildRequests:function(a,b){var c,f;if(d(b,{publisherExt:l.b.getConfig("fpd.context"),userExt:l.b.getConfig("fpd.user"),ceh:l.b.getConfig("criteo.ceh")}),e()||(window.Criteo=window.Criteo||{},window.Criteo.usePrebidEvents=!1,i(),setTimeout(function(){Object(j.a)("https://static.criteo.net/js/ld/publishertag.prebid.js",t)},b.timeout)),e()){var k=new Criteo.PubTag.Adapters.Prebid(u,s,a,b,"3.19.0"),o=l.b.getConfig("enableSendAllBids");k.setEnableSendAllBids&&"function"==typeof k.setEnableSendAllBids&&"boolean"==typeof o&&k.setEnableSendAllBids(o),c=k.buildCdbUrl(),f=k.buildCdbRequest()}else{var p=function(a,b){var c="";b&&b.refererInfo&&(c=b.refererInfo.referer);var d=n.parseUrl(c).search,e={url:c,debug:"1"===d.pbt_debug,noLog:"1"===d.pbt_nolog,amp:!1};return a.forEach(function(a){"amp"===a.params.integrationMode&&(e.amp=!0)}),e}(a,b);c=function(a){var b="https://bidder.criteo.com/cdb";return b+="?profileId=207",b+="&av="+String(s),b+="&wv="+encodeURIComponent("3.19.0"),b+="&cb="+String(Math.floor(99999999999*Math.random())),a.amp&&(b+="&im=1"),a.debug&&(b+="&debug=1"),a.noLog&&(b+="&nolog=1"),b}(p),f=function(a,b,c){var e,f={publisher:{url:a.url,ext:c.publisherExt},slots:b.map(function(a){e=a.params.networkId||e;var b,c,f,i={impid:a.adUnitCode,transactionid:a.transactionId,auctionId:a.auctionId,sizes:(b=a,g(n.deepAccess(b,"mediaTypes.banner.sizes")||b.sizes))};if(a.params.zoneId&&(i.zoneid=a.params.zoneId),a.fpd&&a.fpd.context&&(i.ext=a.fpd.context),a.params.ext&&(i.ext=d({},i.ext,a.params.ext)),a.params.publisherSubId&&(i.publishersubid=a.params.publisherSubId),(a.params.nativeCallback||n.deepAccess(a,"mediaTypes.".concat(m.c)))&&(i["native"]=!0,(c=a).nativeParams&&(c.nativeParams.image&&!0!==c.nativeParams.image.sendId||c.nativeParams.icon&&!0!==c.nativeParams.icon.sendId||c.nativeParams.clickUrl&&!0!==c.nativeParams.clickUrl.sendId||c.nativeParams.displayUrl&&!0!==c.nativeParams.displayUrl.sendId||c.nativeParams.privacyLink&&!0!==c.nativeParams.privacyLink.sendId||c.nativeParams.privacyIcon&&!0!==c.nativeParams.privacyIcon.sendId)&&n.logWarn("Criteo: all native assets containing URL should be sent as placeholders with sendId(icon, image, clickUrl, displayUrl, privacyLink, privacyIcon)")),h(a)){var j={playersizes:(f=a,g(n.deepAccess(f,"mediaTypes.video.playerSize"))),mimes:a.mediaTypes.video.mimes,protocols:a.mediaTypes.video.protocols,maxduration:a.mediaTypes.video.maxduration,api:a.mediaTypes.video.api};j.skip=a.params.video.skip,j.placement=a.params.video.placement,j.minduration=a.params.video.minduration,j.playbackmethod=a.params.video.playbackmethod,j.startdelay=a.params.video.startdelay,i.video=j}return i})};return e&&(f.publisher.networkid=e),f.user={ext:c.userExt},c&&c.ceh&&(f.user.ceh=c.ceh),c&&c.gdprConsent&&(f.gdprConsent={},void 0!==c.gdprConsent.gdprApplies&&(f.gdprConsent.gdprApplies=!!c.gdprConsent.gdprApplies),f.gdprConsent.version=c.gdprConsent.apiVersion,void 0!==c.gdprConsent.consentString&&(f.gdprConsent.consentData=c.gdprConsent.consentString)),c&&c.uspConsent&&(f.user.uspIab=c.uspConsent),f}(p,a,b)}if(f)return{method:"POST",url:c,data:f,bidRequests:a}},interpretResponse:function(a,b){var c=a.body||a;if(e()){var d=Criteo.PubTag.Adapters.Prebid.GetAdapter(b);if(d)return d.interpretResponse(c,b)}var f=[];return c&&c.slots&&n.isArray(c.slots)&&c.slots.forEach(function(a){var c,d,e,g,h,i=p()(b.bidRequests,function(b){return b.adUnitCode===a.impid&&(!b.params.zoneId||parseInt(b.params.zoneId)===a.zoneid)}),j=i.bidId,k={requestId:j,adId:a.bidId||n.getUniqueIdentifierStr(),cpm:a.cpm,currency:a.currency,netRevenue:!0,ttl:a.ttl||60,creativeId:j,width:a.width,height:a.height,dealId:a.dealCode};if(a["native"])if(i.params.nativeCallback)k.ad=(d=j,e=a["native"],g=i.params.nativeCallback,h="criteo_prebid_native_slots",window[h]=window[h]||{},window[h][d]={callback:g,payload:e},'\n<script type="text/javascript">\nfor (var i = 0; i < 10; ++i) {\n var slots = window.parent.'.concat(h,';\n  if(!slots){continue;}\n  var responseSlot = slots["').concat(d,'"];\n  responseSlot.callback(responseSlot.payload);\n  break;\n}\n</script>'));else{if(!0===l.b.getConfig("enableSendAllBids"))return;k["native"]={title:(c=a["native"]).products[0].title,body:c.products[0].description,sponsoredBy:c.advertiser.description,icon:c.advertiser.logo,image:c.products[0].image,clickUrl:c.products[0].click_url,privacyLink:c.privacy.optout_click_url,privacyIcon:c.privacy.optout_image_url,cta:c.products[0].call_to_action,price:c.products[0].price,impressionTrackers:c.impression_pixels.map(function(a){return a.url})},k.mediaType=m.c}else a.video?(k.vastUrl=a.displayurl,k.mediaType=m.d):k.ad=a.creative;f.push(k)}),f},onTimeout:function(a){e()&&Criteo.PubTag.Adapters.Prebid.GetAdapter(a.auctionId).handleBidTimeout()},onBidWon:function(a){e()&&Criteo.PubTag.Adapters.Prebid.GetAdapter(a.auctionId).handleBidWon(a)},onSetTargeting:function(a){e()&&Criteo.PubTag.Adapters.Prebid.GetAdapter(a.auctionId).handleSetTargeting(a)}};Object(k.registerBidder)(y)},367:function(a,b,c){"use strict";Object.defineProperty(b,"__esModule",{value:!0});var d=c(368),e=c(369);b.verify=function(a,b,c,f){var g=new d.BigInteger(d.b64toHex(b)),h=new d.BigInteger(d.b64toHex(c)),i=g.modPowInt(f,h);return d.removeExtraSymbols(i.toHexString())===e.Sha256.hash(a)}},368:function(a,b,c){"use strict";function d(a){null!==a&&this.fromHexString(a)}function e(){return new m(null)}function f(a){var b,c=1;return 0!=(b=a>>>16)&&(a=b,c+=16),0!=(b=a>>8)&&(a=b,c+=8),0!=(b=a>>4)&&(a=b,c+=4),0!=(b=a>>2)&&(a=b,c+=2),0!=(b=a>>1)&&(a=b,c+=1),c}function g(a,b){var c=p[a.charCodeAt(b)];return null==c?-1:c}function h(a){return q.charAt(a)}function i(a){this.m=a}function j(a){this.m=a,this.mp=a.invDigit(),this.mpl=32767&this.mp,this.mph=this.mp>>15,this.um=(1<<a.DB-15)-1,this.mt2=2*a.t}function k(a){var b=e();return b.fromHexString(a.toString()),b}var l;Object.defineProperty(b,"__esModule",{value:!0});var m=(d.prototype.toHexString=function(){if(this.s<0)return"-"+this.negate().toHexString();var a,b=!1,c="",d=this.t,e=this.DB-d*this.DB%4;if(0<d--)for(e<this.DB&&0<(a=this[d]>>e)&&(b=!0,c=h(a));0<=d;)e<4?(a=(this[d]&(1<<e)-1)<<4-e,a|=this[--d]>>(e+=this.DB-4)):(a=this[d]>>(e-=4)&15,e<=0&&(e+=this.DB,--d)),0<a&&(b=!0),b&&(c+=h(a));return b?c:"0"},d.prototype.fromHexString=function(a){if(null!==a){this.t=0,this.s=0;for(var b=a.length,c=!1,e=0;0<=--b;){var f=g(a,b);f<0?"-"==a.charAt(b)&&(c=!0):(c=!1,0==e?this[this.t++]=f:e+4>this.DB?(this[this.t-1]|=(f&(1<<this.DB-e)-1)<<e,this[this.t++]=f>>this.DB-e):this[this.t-1]|=f<<e,(e+=4)>=this.DB&&(e-=this.DB))}this.clamp(),c&&d.ZERO.subTo(this,this)}},d.prototype.negate=function(){var a=e();return d.ZERO.subTo(this,a),a},d.prototype.abs=function(){return this.s<0?this.negate():this},d.prototype.mod=function(a){var b=e();return this.abs().divRemTo(a,null,b),this.s<0&&0<b.compareTo(d.ZERO)&&a.subTo(b,b),b},d.prototype.copyTo=function(a){for(var b=this.t-1;0<=b;--b)a[b]=this[b];a.t=this.t,a.s=this.s},d.prototype.lShiftTo=function(a,b){for(var c=a%this.DB,d=this.DB-c,e=(1<<d)-1,f=Math.floor(a/this.DB),g=this.s<<c&this.DM,h=this.t-1;0<=h;--h)b[h+f+1]=this[h]>>d|g,g=(this[h]&e)<<c;for(h=f-1;0<=h;--h)b[h]=0;b[f]=g,b.t=this.t+f+1,b.s=this.s,b.clamp()},d.prototype.invDigit=function(){if(this.t<1)return 0;var a=this[0];if(0==(1&a))return 0;var b=3&a;return 0<(b=(b=(b=(b=b*(2-(15&a)*b)&15)*(2-(255&a)*b)&255)*(2-((65535&a)*b&65535))&65535)*(2-a*b%this.DV)%this.DV)?this.DV-b:-b},d.prototype.dlShiftTo=function(a,b){var c;for(c=this.t-1;0<=c;--c)b[c+a]=this[c];for(c=a-1;0<=c;--c)b[c]=0;b.t=this.t+a,b.s=this.s},d.prototype.squareTo=function(a){for(var b=this.abs(),c=a.t=2*b.t;0<=--c;)a[c]=0;for(c=0;c<b.t-1;++c){var d=b.am(c,b[c],a,2*c,0,1);(a[c+b.t]+=b.am(c+1,2*b[c],a,2*c+1,d,b.t-c-1))>=b.DV&&(a[c+b.t]-=b.DV,a[c+b.t+1]=1)}0<a.t&&(a[a.t-1]+=b.am(c,b[c],a,2*c,0,1)),a.s=0,a.clamp()},d.prototype.multiplyTo=function(a,b){var c=this.abs(),e=a.abs(),f=c.t;for(b.t=f+e.t;0<=--f;)b[f]=0;for(f=0;f<e.t;++f)b[f+c.t]=c.am(0,e[f],b,f,0,c.t);b.s=0,b.clamp(),this.s!=a.s&&d.ZERO.subTo(b,b)},d.prototype.divRemTo=function(a,b,c){var g=a.abs();if(!(g.t<=0)){var h=this.abs();if(h.t<g.t)return null!=b&&b.fromHexString("0"),void(null!=c&&this.copyTo(c));null==c&&(c=e());var i=e(),j=this.s,k=a.s,l=this.DB-f(g[g.t-1]);0<l?(g.lShiftTo(l,i),h.lShiftTo(l,c)):(g.copyTo(i),h.copyTo(c));var m=i.t,n=i[m-1];if(0!=n){var o=n*(1<<this.F1)+(1<m?i[m-2]>>this.F2:0),p=this.FV/o,q=(1<<this.F1)/o,r=1<<this.F2,s=c.t,t=s-m,u=null==b?e():b;for(i.dlShiftTo(t,u),0<=c.compareTo(u)&&(c[c.t++]=1,c.subTo(u,c)),d.ONE.dlShiftTo(m,u),u.subTo(i,i);i.t<m;)i[i.t++]=0;for(;0<=--t;){var v=c[--s]==n?this.DM:Math.floor(c[s]*p+(c[s-1]+r)*q);if((c[s]+=i.am(0,v,c,t,0,m))<v)for(i.dlShiftTo(t,u),c.subTo(u,c);c[s]<--v;)c.subTo(u,c)}null!=b&&(c.drShiftTo(m,b),j!=k&&d.ZERO.subTo(b,b)),c.t=m,c.clamp(),0<l&&c.rShiftTo(l,c),j<0&&d.ZERO.subTo(c,c)}}},d.prototype.rShiftTo=function(a,b){b.s=this.s;var c=Math.floor(a/this.DB);if(c>=this.t)b.t=0;else{var d=a%this.DB,e=this.DB-d,f=(1<<d)-1;b[0]=this[c]>>d;for(var g=c+1;g<this.t;++g)b[g-c-1]|=(this[g]&f)<<e,b[g-c]=this[g]>>d;0<d&&(b[this.t-c-1]|=(this.s&f)<<e),b.t=this.t-c,b.clamp()}},d.prototype.drShiftTo=function(a,b){for(var c=a;c<this.t;++c)b[c-a]=this[c];b.t=Math.max(this.t-a,0),b.s=this.s},d.prototype.subTo=function(a,b){for(var c=0,d=0,e=Math.min(a.t,this.t);c<e;)d+=this[c]-a[c],b[c++]=d&this.DM,d>>=this.DB;if(a.t<this.t){for(d-=a.s;c<this.t;)d+=this[c],b[c++]=d&this.DM,d>>=this.DB;d+=this.s}else{for(d+=this.s;c<a.t;)d-=a[c],b[c++]=d&this.DM,d>>=this.DB;d-=a.s}b.s=d<0?-1:0,d<-1?b[c++]=this.DV+d:0<d&&(b[c++]=d),b.t=c,b.clamp()},d.prototype.clamp=function(){for(var a=this.s&this.DM;0<this.t&&this[this.t-1]==a;)--this.t},d.prototype.modPowInt=function(a,b){var c;return c=new(a<256||b.isEven()?r:s)(b),this.exp(a,c)},d.prototype.exp=function(a,b){if(4294967295<a||a<1)return d.ONE;var c=e(),g=e(),h=b.convert(this),i=f(a)-1;for(h.copyTo(c);0<=--i;)if(b.sqrTo(c,g),0<(a&1<<i))b.mulTo(g,h,c);else{var j=c;c=g,g=j}return b.revert(c)},d.prototype.isEven=function(){return 0==(0<this.t?1&this[0]:this.s)},d.prototype.compareTo=function(a){var b=this.s-a.s;if(0!=b)return b;var c=this.t;if(0!=(b=c-a.t))return this.s<0?-b:b;for(;0<=--c;)if(0!=(b=this[c]-a[c]))return b;return 0},d.prototype.am1=function(a,b,c,d,e,f){for(;0<=--f;){var g=b*this[a++]+c[d]+e;e=Math.floor(g/67108864),c[d++]=67108863&g}return e},d.prototype.am2=function(a,b,c,d,e,f){for(var g=32767&b,h=b>>15;0<=--f;){var i=32767&this[a],j=this[a++]>>15,k=h*i+j*g;e=((i=g*i+((32767&k)<<15)+c[d]+(1073741823&e))>>>30)+(k>>>15)+h*j+(e>>>30),c[d++]=1073741823&i}return e},d.prototype.am3=function(a,b,c,d,e,f){for(var g=16383&b,h=b>>14;0<=--f;){var i=16383&this[a],j=this[a++]>>14,k=h*i+j*g;e=((i=g*i+((16383&k)<<14)+c[d]+e)>>28)+(k>>14)+h*j,c[d++]=268435455&i}return e},d);b.BigInteger=m,b.nbi=e,b.nbits=f;var n,o,p=[];for(n="0".charCodeAt(0),o=0;o<=9;++o)p[n++]=o;for(n="a".charCodeAt(0),o=10;o<36;++o)p[n++]=o;for(n="A".charCodeAt(0),o=10;o<36;++o)p[n++]=o;b.intAt=g;var q="0123456789abcdefghijklmnopqrstuvwxyz";b.int2char=h,b.b64toHex=function(a){var b,c="",d=0,e=0;for(b=0;b<a.length&&"="!=a.charAt(b);++b){var f="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".indexOf(a.charAt(b));f<0||(d=0==d?(c+=h(f>>2),e=3&f,1):1==d?(c+=h(e<<2|f>>4),e=15&f,2):2==d?(c+=h(e),c+=h(f>>2),e=3&f,3):(c+=h(e<<2|f>>4),c+=h(15&f),0))}return 1==d&&(c+=h(e<<2)),c},b.removeExtraSymbols=function(a){return a.replace(/^1f+00/,"").replace("3031300d060960864801650304020105000420","")};var r=(i.prototype.convert=function(a){return a.s<0||0<=a.compareTo(this.m)?a.mod(this.m):a},i.prototype.revert=function(a){return a},i.prototype.reduce=function(a){a.divRemTo(this.m,null,a)},i.prototype.mulTo=function(a,b,c){a.multiplyTo(b,c),this.reduce(c)},i.prototype.sqrTo=function(a,b){a.squareTo(b),this.reduce(b)},i),s=(j.prototype.convert=function(a){var b=e();return a.abs().dlShiftTo(this.m.t,b),b.divRemTo(this.m,null,b),a.s<0&&0<b.compareTo(m.ZERO)&&this.m.subTo(b,b),b},j.prototype.revert=function(a){var b=e();return a.copyTo(b),this.reduce(b),b},j.prototype.reduce=function(a){for(;a.t<=this.mt2;)a[a.t++]=0;for(var b=0;b<this.m.t;++b){var c=32767&a[b],d=c*this.mpl+((c*this.mph+(a[b]>>15)*this.mpl&this.um)<<15)&a.DM;for(a[c=b+this.m.t]+=this.m.am(0,d,a,b,0,this.m.t);a[c]>=a.DV;)a[c]-=a.DV,a[++c]++}a.clamp(),a.drShiftTo(this.m.t,a),0<=a.compareTo(this.m)&&a.subTo(this.m,a)},j.prototype.mulTo=function(a,b,c){a.multiplyTo(b,c),this.reduce(c)},j.prototype.sqrTo=function(a,b){a.squareTo(b),this.reduce(b)},j);b.nbv=k,m.ZERO=k(0),m.ONE=k(1),l="Microsoft Internet Explorer"==navigator.appName?(m.prototype.am=m.prototype.am2,30):"Netscape"!=navigator.appName?(m.prototype.am=m.prototype.am1,26):(m.prototype.am=m.prototype.am3,28),m.prototype.DB=l,m.prototype.DM=(1<<l)-1,m.prototype.DV=1<<l,m.prototype.FV=Math.pow(2,52),m.prototype.F1=52-l,m.prototype.F2=2*l-52},369:function(a,b,c){"use strict";function d(){}Object.defineProperty(b,"__esModule",{value:!0});var e=(d.hash=function(a){a=d.utf8Encode(a||"");for(var b=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],c=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],e=(a+=String.fromCharCode(128)).length/4+2,f=Math.ceil(e/16),g=new Array(f),h=0;h<f;h++){g[h]=new Array(16);for(var i=0;i<16;i++)g[h][i]=a.charCodeAt(64*h+4*i)<<24|a.charCodeAt(64*h+4*i+1)<<16|a.charCodeAt(64*h+4*i+2)<<8|a.charCodeAt(64*h+4*i+3)<<0}var j=8*(a.length-1)/Math.pow(2,32),k=8*(a.length-1)>>>0;for(g[f-1][14]=Math.floor(j),g[f-1][15]=k,h=0;h<f;h++){for(var l=new Array(64),m=0;m<16;m++)l[m]=g[h][m];for(m=16;m<64;m++)l[m]=d.q1(l[m-2])+l[m-7]+d.q0(l[m-15])+l[m-16]>>>0;var n=c[0],o=c[1],p=c[2],q=c[3],r=c[4],s=c[5],t=c[6],u=c[7];for(m=0;m<64;m++){var v=u+d.z1(r)+d.Ch(r,s,t)+b[m]+l[m],w=d.z0(n)+d.Maj(n,o,p);u=t,t=s,s=r,r=q+v>>>0,q=p,p=o,o=n,n=v+w>>>0}c[0]=c[0]+n>>>0,c[1]=c[1]+o>>>0,c[2]=c[2]+p>>>0,c[3]=c[3]+q>>>0,c[4]=c[4]+r>>>0,c[5]=c[5]+s>>>0,c[6]=c[6]+t>>>0,c[7]=c[7]+u>>>0}var x=new Array(c.length);for(u=0;u<c.length;u++)x[u]=("00000000"+c[u].toString(16)).slice(-8);return x.join("")},d.utf8Encode=function(a){try{return(new TextEncoder).encode(a).reduce(function(a,b){return a+String.fromCharCode(b)},"")}catch(b){return unescape(encodeURIComponent(a))}},d.ROTR=function(a,b){return b>>>a|b<<32-a},d.z0=function(a){return d.ROTR(2,a)^d.ROTR(13,a)^d.ROTR(22,a)},d.z1=function(a){return d.ROTR(6,a)^d.ROTR(11,a)^d.ROTR(25,a)},d.q0=function(a){return d.ROTR(7,a)^d.ROTR(18,a)^a>>>3},d.q1=function(a){return d.ROTR(17,a)^d.ROTR(19,a)^a>>>10},d.Ch=function(a,b,c){return a&b^~a&c},d.Maj=function(a,b,c){return a&b^a&c^b&c},d);b.Sha256=e}},[365]),pbjsChunk([213],{386:function(a,b,c){a.exports=c(387)},387:function(a,b,c){"use strict";function d(a,b){return function(a){if(Array.isArray(a))return a}(a)||function(a,b){if(Symbol.iterator in Object(a)||"[object Arguments]"===Object.prototype.toString.call(a)){var c=[],d=!0,e=!1,f=void 0;try{for(var g,h=a[Symbol.iterator]();!(d=(g=h.next()).done)&&(c.push(g.value),!b||c.length!==b);d=!0);}catch(a){e=!0,f=a}finally{try{d||null==h["return"]||h["return"]()}finally{if(e)throw f}}return c}}(a,b)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function e(a){return function(a){if(Array.isArray(a)){for(var b=0,c=new Array(a.length);b<a.length;b++)c[b]=a[b];return c}}(a)||function(a){if(Symbol.iterator in Object(a)||"[object Arguments]"===Object.prototype.toString.call(a))return Array.from(a)}(a)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}function f(a,b){var c=Object.keys(a);if(Object.getOwnPropertySymbols){var d=Object.getOwnPropertySymbols(a);b&&(d=d.filter(function(b){return Object.getOwnPropertyDescriptor(a,b).enumerable})),c.push.apply(c,d)}return c}function g(a,b,c){return b in a?Object.defineProperty(a,b,{value:c,enumerable:!0,configurable:!0,writable:!0}):a[b]=c,a}function h(a,b){var c=i(a,[{size:[300,250],s:100},{size:[728,90],s:95},{size:[320,50],s:90},{size:[160,600],s:88},{size:[300,600],s:85},{size:[300,50],s:80},{size:[970,250],s:75},{size:[970,90],s:60}]);switch(b){case"w":return c[0][0]||0;case"h":return c[0][1]||0;case"size":default:return c}}function i(a,b){var c=a.filter(function(a){return-1===b.map(function(a){
return"".concat(a.size[0],"x").concat(a.size[1])}).indexOf("".concat(a[0],"x").concat(a[1]))}),d=a.reduce(function(a,c){return 0===a.length?(a.push(c),a):(a.push(c),(a=(a=b.filter(function(b){return-1!==a.map(function(a){return"".concat(a[0],"x").concat(a[1])}).indexOf("".concat(b.size[0],"x").concat(b.size[1]))})).sort(function(a,b){return b.s-a.s})).map(function(a){return a.size}))},[]);return j([].concat(e(d),e(c)))}function j(a){return a.filter(function(b,c){return a.map(function(a){return"".concat(a[0],"x").concat(a[1])}).indexOf("".concat(b[0],"x").concat(b[1]))===c})}function k(a,b,c,d){for(var e=[];0!==a.length;)5<=a.length?e.push(a.splice(0,5)):e.push(a.splice(0,a.length));return e.map(function(a){return b.imp=a,{method:"POST",url:d,data:JSON.stringify(b),bidderRequest:c}})}function l(a,b){return d(b.bidderRequest.bids.filter(function(b){return b.bidId===a}),1)[0]}function m(a){return Array.isArray(a)&&Array.isArray(a[0])?a[0]:a}function n(a){var b=a.sizes,c={};return c.width=m(b)[0],c.height=m(b)[1],c}function o(a,b,c,d){p.isStr(b)&&Array.isArray(a)&&a.push({source:c,uids:[{id:b,atype:d}]})}Object.defineProperty(b,"__esModule",{value:!0}),c.d(b,"spec",function(){return t}),b.cleanSizes=h,b.shuffle=i,b.removeDuplicate=j,b.upto5=k,b.matchRequest=l,b.checkDeepArray=m,b.defaultSize=n,b.bindUserId=o;var p=c(0),q=c(1),r=c(3),s="https://dmx.districtm.io/b/v1",t={code:"districtmDMX",supportedFormat:["banner"],isBidRequestValid:function(a){return!(!a.params.dmxid||!a.params.memberid)},interpretResponse:function(a,b){return(a=a.body||{}).seatbid&&p.isArray(a.seatbid)?a.seatbid.reduce(function(a,c){var d=c.bid.reduce(function(a,c){if(a.price<c.price){var d=n(l(c.impid,b)),e=d.width,f=d.height;return c.cpm=parseFloat(c.price).toFixed(2),c.bidId=c.impid,c.requestId=c.impid,c.width=c.w||e,c.height=c.h||f,c.dealid&&(c.dealId=c.dealid),c.ad=c.adm,c.netRevenue=!0,c.creativeId=c.crid,c.currency="USD",c.ttl=60,c}return a.cpm=a.price,a},{price:0});return d.adm&&a.push(d),a},[]).filter(function(a){return!!a.bidId}):[]},buildRequests:function(a,b){var c=r.b.getConfig("bidderTimeout"),d=null,e={id:p.generateUUID(),cur:["USD"],tmax:c-300,test:this.test()||0,site:{publisher:{id:String(a[0].params.memberid)||null}}};try{var i=r.b.getConfig("dmx");e.user=i.user||{};var j=i.site||{};e.site=function(a){for(var b=1;b<arguments.length;b++){var c=null!=arguments[b]?arguments[b]:{};b%2?f(Object(c),!0).forEach(function(b){g(a,b,c[b])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(c)):f(Object(c)).forEach(function(b){Object.defineProperty(a,b,Object.getOwnPropertyDescriptor(c,b))})}return a}({},e.site,{},j)}catch(a){}var l=[];a&&a.userId&&(o(l,p.deepAccess(a,"userId.idl_env"),"liveramp.com",1),o(l,p.deepAccess(a,"userId.digitrustid.data.id"),"digitru.st",1),o(l,p.deepAccess(a,"userId.id5id"),"id5-sync.com",1),o(l,p.deepAccess(a,"userId.pubcid"),"pubcid.org",1),o(l,p.deepAccess(a,"userId.tdid"),"adserver.org",1),e.user=e.user||{},e.user.ext=e.user.ext||{},e.user.ext.eids=l),e.test||delete e.test,b.gdprConsent&&(e.regs={},e.regs.ext={},e.regs.ext.gdpr=!0===b.gdprConsent.gdprApplies?1:0,e.user={},e.user.ext={},e.user.ext.consent=b.gdprConsent.consentString),e.regs=e.regs||{},e.regs.coppa=!0===r.b.getConfig("coppa")?1:0,b&&b.uspConsent&&(e.regs=e.regs||{},e.regs.ext=e.regs.ext||{},e.regs.ext.us_privacy=b.uspConsent);try{d=a[0].schain,e.source={},e.source.ext={},e.source.ext.schain=d||{}}catch(a){}var m=a.map(function(a){var b={};return b.id=a.bidId,b.tagid=String(a.params.dmxid),b.secure=1,b.banner={topframe:1,w:h(a.sizes,"w"),h:h(a.sizes,"h"),format:h(a.sizes).map(function(a){return{w:a[0],h:a[1]}}).filter(function(a){return"number"==typeof a.w&&"number"==typeof a.h})},b});return m.length<=5?(e.imp=m,{method:"POST",url:s,data:JSON.stringify(e),bidderRequest:b}):k(m,e,b,s)},test:function(){return-1!==window.location.href.indexOf("dmTest=true")?1:0},getUserSyncs:function(a,b,c,d){var e=[],f="https://cdn.districtm.io/ids/index.html";if(c&&c.gdprApplies&&"string"==typeof c.consentString&&e.push(["gdpr",c.consentString]),d&&e.push(["ccpa",d]),0<e.length&&(f+="?"+e.map(function(a){return a.join("=")}).join("&")),a.iframeEnabled)return[{type:"iframe",url:f}]}};Object(q.registerBidder)(t)}},[386]),pbjsChunk([190],{436:function(a,b,c){a.exports=c(437)},437:function(a,b,c){"use strict";Object.defineProperty(b,"__esModule",{value:!0}),function(a){function d(a,b){var c=Object.keys(a);if(Object.getOwnPropertySymbols){var d=Object.getOwnPropertySymbols(a);b&&(d=d.filter(function(b){return Object.getOwnPropertyDescriptor(a,b).enumerable})),c.push.apply(c,d)}return c}function e(a,b,c){return b in a?Object.defineProperty(a,b,{value:c,enumerable:!0,configurable:!0,writable:!0}):a[b]=c,a}function f(){return(f=Object.assign||function(a){for(var b=1;b<arguments.length;b++){var c=arguments[b];for(var d in c)Object.prototype.hasOwnProperty.call(c,d)&&(a[d]=c[d])}return a}).apply(this,arguments)}function g(a,b){return function(a){if(Array.isArray(a))return a}(a)||function(a,b){if(Symbol.iterator in Object(a)||"[object Arguments]"===Object.prototype.toString.call(a)){var c=[],d=!0,e=!1,f=void 0;try{for(var g,h=a[Symbol.iterator]();!(d=(g=h.next()).done)&&(c.push(g.value),!b||c.length!==b);d=!0);}catch(a){e=!0,f=a}finally{try{d||null==h["return"]||h["return"]()}finally{if(e)throw f}}return c}}(a,b)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}c.d(b,"spec",function(){return t});var h=c(0),i=c(3),j=c(2),k=c(11),l=c.n(k),m=c(1),n=c(9),o=Object(n.b)(),p={member:"YcXr87z2lpbB"},q=[j.b,j.d],r={},s=null,t={code:"gumgum",aliases:["gg"],isBidRequestValid:function(a){var b=a.params,c=a.adUnitCode;switch(!0){case!!b.inScreen:case!!b.inSlot:case!!b.ICV:case!!b.video:break;default:return h.logWarn("[GumGum] No product selected for the placement ".concat(c,", please check your implementation.")),!1}return!(b.bidfloor&&("number"!=typeof b.bidfloor||!isFinite(b.bidfloor))&&(h.logWarn("[GumGum] bidfloor must be a Number"),1))},buildRequests:function(b,c){var d=[],e=c&&c.gdprConsent,j=c&&c.uspConsent,k=i.b.getConfig("bidderTimeout"),l=c&&c.refererInfo&&c.refererInfo.referer;return h._each(b,function(b){var c,i,m,n,q,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H=b.bidId,I=b.mediaTypes,J=void 0===I?{}:I,K=b.params,L=void 0===K?{}:K,M=b.schain,N=b.transactionId,O=b.userId,P=void 0===O?{}:O,Q=J.banner&&J.banner.sizes,R={};s&&(R.pv=s),L.bidfloor&&(R.fp=L.bidfloor),L.inScreenPubID&&(R.pubId=L.inScreenPubID,R.pi=2),L.inScreen&&(R.t=L.inScreen,R.pi=2),L.inSlot&&(R.si=parseInt(L.inSlot,10),R.pi=3),L.ICV&&(R.ni=parseInt(L.ICV,10),R.pi=5),L.video&&((R=f(R,(c=J.video,i=c.minduration,m=c.maxduration,n=c.linearity,q=c.startdelay,t=c.placement,u=c.protocols,v=void 0===u?[]:u,w=c.playerSize,x=void 0===w?[]:w,y=h.parseSizesInput(x),z=g(y[0]&&y[0].split("x"),2),A=z[0],B=z[1],C="",v.length&&(C=v.join(",")),{mind:i,maxd:m,li:n,sd:q,pt:t,pr:C,viw:A,vih:B}))).t=L.video,R.pi=7),e&&(R.gdprApplies=e.gdprApplies?1:0),R.gdprApplies&&(R.gdprConsent=e.consentString),j&&(R.uspConsent=j),M&&M.nodes&&(R.schain=(E="".concat((D=M).ver,",").concat(D.complete),D.nodes.map(function(a){E+="!".concat(encodeURIComponent(a.asi||""),","),E+="".concat(encodeURIComponent(a.sid||""),","),E+="".concat(encodeURIComponent(a.hp||""),","),E+="".concat(encodeURIComponent(a.rid||""),","),E+="".concat(encodeURIComponent(a.name||""),","),E+="".concat(encodeURIComponent(a.domain||""))}),E)),d.push({id:H,tmax:k,tId:N,pi:R.pi,selector:L.selector,sizes:Q||b.sizes,url:"https://g2.gumgum.com/hbid/imp",method:"GET",data:f(R,function(b){var c,d,e,f,g,i,j,k;if(r.vw)return r;try{d=(c=a.top).screen,e=b||""}catch(b){return h.logError(b),r}return r={vw:c.innerWidth,vh:c.innerHeight,sw:d.width,sh:d.height,pu:e,ce:o.cookiesAreEnabled(),dpr:c.devicePixelRatio||1,jcsi:encodeURIComponent(JSON.stringify({t:0,rq:8})),ogu:(i=(document&&document.getElementsByTagName("head")[0]).querySelector("meta[property='og:url']"))?i.content:null},j=window.navigator&&(window.navigator.connection||window.navigator.mozConnection||window.navigator.webkitConnection),(g=(k=j&&(j.downlink||j.bandwidth))?Math.round(1024*k):null)&&(r.ns=g),(f=(e.match(/#ggad=(\w+)$/)||[0,0])[1])&&(r[isNaN(f)?"eAdBuyId":"adBuyId"]=f),r}(l),function(a){var b=a.digitrustid&&a.digitrustid.data;if(!b){var c=window.DigiTrust&&window.DigiTrust.getUser?window.DigiTrust.getUser(p):{};b=c&&c.success&&c.identity||""}return!b||b.privacy&&b.privacy.optout?{}:{dt:b.id}}(P),(G={},(F=P).tdid&&(G.tdid=F.tdid),G))})}),d},interpretResponse:function(a,b){var c,i,j=[],k=a.body,m=f({ad:{price:0,id:0,markup:""},pag:{pvid:0}},k),n=m.ad,o=n.price,p=n.id,q=n.markup,r=n.cur,t=m.cw,u=m.pag.pvid,v=b.data||{},w=v.pi,x=3===w&&9===v.si,y=h.parseSizesInput(b.sizes),z=g(y[0].split("x"),2),A=z[0],B=z[1];return 2!==w&&5!==w||!l()(y,"1x1")||(B=A="1"),s=u,p&&j.push(function(a){for(var b=1;b<arguments.length;b++){var c=null!=arguments[b]?arguments[b]:{};b%2?d(Object(c),!0).forEach(function(b){e(a,b,c[b])}):Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(c)):d(Object(c)).forEach(function(b){Object.defineProperty(a,b,Object.getOwnPropertyDescriptor(c,b))})}return a}({},7===w&&{vastXml:q},{ad:t?(c=t,i=f({},k,{bidRequest:b}),c.replace("AD_JSON",window.btoa(JSON.stringify(i)))):q,cpm:x?.1:o,creativeId:p,currency:r||"USD",height:B,netRevenue:!0,requestId:b.id,ttl:60,width:A})),j},getUserSyncs:function(a,b){return b.map(function(a){return a.body&&a.body.pxs&&a.body.pxs.scr||[]}).reduce(function(a,b){return a.concat(b)},[]).map(function(a){return{type:"f"===a.t?"iframe":"image",url:a.u}})},supportedMediaTypes:q};Object(m.registerBidder)(t)}.call(b,c(33))}},[436]),pbjsChunk([179],{460:function(a,b,c){a.exports=c(461)},461:function(a,b,c){"use strict";function d(a){return(d="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(a){return typeof a}:function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a})(a)}function e(a){var b=f(a);b.video=k.deepClone(a.params.video),b.video.w=a.params.size[0],b.video.h=a.params.size[1];var c=k.deepAccess(a,"mediaTypes.video.context");return c&&("instream"===c?b.video.placement=1:"outstream"===c?b.video.placement=4:k.logWarn("ix bidder params: video context '".concat(c,"' is not supported"))),b}function f(a){var b={};return b.id=a.bidId,b.ext={},b.ext.siteID=a.params.siteId,!a.params.hasOwnProperty("id")||"string"!=typeof a.params.id&&"number"!=typeof a.params.id?b.ext.sid="".concat(a.params.size[0],"x").concat(a.params.size[1]):b.ext.sid=String(a.params.id),a.params.hasOwnProperty("bidFloor")&&a.params.hasOwnProperty("bidFloorCur")&&(b.bidfloor=a.params.bidFloor,b.bidfloorcur=a.params.bidFloorCur),b}function g(a){return Array.isArray(a)&&2===a.length&&q()(a[0])&&q()(a[1])}function h(a,b){if(g(a))return a[0]===b[0]&&a[1]===b[1];for(var c=0;c<a.length;c++)if(a[c][0]===b[0]&&a[c][1]===b[1])return 1}function i(a,b){if(a)return o()(b,function(b){return b.id===a})}function j(a,b,c,e){var f=[];if(window.headertag&&"function"==typeof window.headertag.getIdentityInfo){var g=window.headertag.getIdentityInfo();if(g&&"object"===d(g))for(var h in g)if(g.hasOwnProperty(h)){var i=g[h];!i.responsePending&&i.data&&"object"===d(i.data)&&Object.keys(i.data).length&&f.push(i.data)}}var j={};if(j.id=a[0].bidderRequestId,j.imp=c,j.site={},j.ext={},j.ext.source="prebid",a[0].schain&&(j.source={ext:{schain:a[0].schain}}),0<f.length&&(j.user={},j.user.eids=f),document.referrer&&""!==document.referrer&&(j.site.ref=document.referrer),b){if(b.gdprConsent){var l=b.gdprConsent;l.hasOwnProperty("gdprApplies")&&(j.regs={ext:{gdpr:l.gdprApplies?1:0}}),l.hasOwnProperty("consentString")&&(j.user=j.user||{},j.user.ext={consent:l.consentString||""})}b.uspConsent&&k.deepSetValue(j,"regs.ext.us_privacy",b.uspConsent),b.refererInfo&&(j.site.page=b.refererInfo.referer)}var n={},o=m.b.getConfig("ix");if(o){if("object"===d(o.firstPartyData)){var p=o.firstPartyData,q="?";for(var r in p)p.hasOwnProperty(r)&&(q+="".concat(encodeURIComponent(r),"=").concat(encodeURIComponent(p[r]),"&"));q=q.slice(0,-1),j.site.page+=q}"number"==typeof o.timeout&&(n.t=o.timeout)}return n.s=a[0].params.siteId,n.v=e,n.r=JSON.stringify(j),n.ac="j",n.sd=1,8.1===e&&(n.nf=1),{method:"GET",url:"https://as-sec.casalemedia.com/cygnus",data:n}}Object.defineProperty(b,"__esModule",{value:!0}),c.d(b,"spec",function(){return y});var k=c(0),l=c(2),m=c(3),n=c(12),o=c.n(n),p=c(462),q=c.n(p),r=c(1),s=[l.b,l.d],t=100,u=300,v=3600,w=!0,x={JPY:1},y={code:"ix",gvlid:10,supportedMediaTypes:s,isBidRequestValid:function(a){if(!g(a.params.size))return k.logError("ix bidder params: bid size has invalid format."),!1;if(!h(a.sizes,a.params.size))return k.logError("ix bidder params: bid size is not included in ad unit sizes."),!1;if(a.hasOwnProperty("mediaType")&&!k.contains(s,a.mediaType))return!1;if(a.hasOwnProperty("mediaTypes")&&!k.deepAccess(a,"mediaTypes.banner.sizes")&&!k.deepAccess(a,"mediaTypes.video.playerSize"))return!1;if("string"!=typeof a.params.siteId&&"number"!=typeof a.params.siteId)return k.logError("ix bidder params: siteId must be string or number value."),!1;var b,c,d=a.params.hasOwnProperty("bidFloor"),e=a.params.hasOwnProperty("bidFloorCur");return!!(!d&&!e||d&&e&&(b=a.params.bidFloor,c=a.params.bidFloorCur,Boolean("number"==typeof b&&"string"==typeof c&&c.match(/^[A-Z]{3}$/))))||(k.logError("ix bidder params: bidFloor / bidFloorCur parameter has invalid format."),!1)},buildRequests:function(a,b){for(var c,d,g=[],i=[],m=[],n=null,o=0;o<a.length;o++)(n=a[o]).mediaType!==l.d&&!k.deepAccess(n,"mediaTypes.video")||(n.mediaType===l.d||h(n.mediaTypes.video.playerSize,n.params.size)?m.push(e(n)):k.logError("Bid size is not included in video playerSize")),n.mediaType!==l.b&&!k.deepAccess(n,"mediaTypes.banner")&&(n.mediaType||n.mediaTypes)||i.push((d=void 0,(d=f(c=n)).banner={},d.banner.w=c.params.size[0],d.banner.h=c.params.size[1],d.banner.topframe=k.inIframe()?0:1,d));return 0<i.length&&g.push(j(a,b,i,7.2)),0<m.length&&g.push(j(a,b,m,8.1)),g},interpretResponse:function(a,b){var c=[];if(!a.hasOwnProperty("body")||!a.body.hasOwnProperty("seatbid"))return c;for(var d,e,f,g,h=a.body,j=h.seatbid,m=0;m<j.length;m++)if(j[m].hasOwnProperty("bid"))for(var n=j[m].bid,o=JSON.parse(b.data.r),p=0;p<n.length;p++){var q=i(n[p].impid,o.imp);d=n[p],e=h.cur,f=q,g=void 0,g={},x.hasOwnProperty(e)?g.cpm=d.price/x[e]:g.cpm=d.price/t,g.requestId=d.impid,g.dealId=k.deepAccess(d,"ext.dealid"),g.netRevenue=w,g.currency=e,g.creativeId=d.hasOwnProperty("crid")?d.crid:"-",k.deepAccess(d,"ext.vasturl")?(g.vastUrl=d.ext.vasturl,g.width=f.video.w,g.height=f.video.h,g.mediaType=l.d,g.ttl=v):(g.ad=d.adm,g.width=d.w,g.height=d.h,g.mediaType=l.b,g.ttl=u),g.meta={},g.meta.networkId=k.deepAccess(d,"ext.dspid"),g.meta.brandId=k.deepAccess(d,"ext.advbrandid"),g.meta.brandName=k.deepAccess(d,"ext.advbrand"),c.push(g)}return c},transformBidParams:function(a){return k.convertTypes({siteID:"number"},a)},getUserSyncs:function(a){return a.iframeEnabled?[{type:"iframe",url:"https://js-sec.indexww.com/um/ixmatch.html"}]:[]}};Object(r.registerBidder)(y)}},[460]),pbjsChunk([141],{557:function(a,b,c){a.exports=c(558)},558:function(a,b,c){"use strict";function d(a,b){return function(a){if(Array.isArray(a))return a}(a)||function(a,b){if(Symbol.iterator in Object(a)||"[object Arguments]"===Object.prototype.toString.call(a)){var c=[],d=!0,e=!1,f=void 0;try{for(var g,h=a[Symbol.iterator]();!(d=(g=h.next()).done)&&(c.push(g.value),!b||c.length!==b);d=!0);}catch(a){e=!0,f=a}finally{try{d||null==h["return"]||h["return"]()}finally{if(e)throw f}}return c}}(a,b)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function e(a,b){var c,d,e,g,i=h.inIframe();if(c={ju:f.b.getConfig("pageUrl")||b.refererInfo.referer,ch:document.charSet||document.characterSet,res:"".concat(screen.width,"x").concat(screen.height,"x").concat(screen.colorDepth),ifr:i,tz:(new Date).getTimezoneOffset(),tws:function(a){var b,c,d,e=window,f=document,g=f.documentElement;if(a){try{e=window.top,f=window.top.document}catch(a){return}g=f.documentElement,d=f.body,b=e.innerWidth||g.clientWidth||d.clientWidth,c=e.innerHeight||g.clientHeight||d.clientHeight}else g=f.documentElement,b=e.innerWidth||g.clientWidth,c=e.innerHeight||g.clientHeight;return"".concat(b,"x").concat(c)}(i),be:1,bc:a[0].params.bc||"".concat(k,"_").concat(l),dddid:h._map(a,function(a){return a.transactionId}).join(","),nocache:(new Date).getTime()},a[0].params.platform&&(c.ph=a[0].params.platform),b.gdprConsent){var j=b.gdprConsent;void 0!==j.consentString&&(c.gdpr_consent=j.consentString),void 0!==j.gdprApplies&&(c.gdpr=j.gdprApplies?1:0),"iab"===f.b.getConfig("consentManagement.cmpApi")&&(c.x_gdpr_f=1)}return b&&b.uspConsent&&(c.us_privacy=b.uspConsent),h.deepAccess(a[0],"crumbs.pubcid")&&h.deepSetValue(a[0],"userId.pubcid",h.deepAccess(a[0],"crumbs.pubcid")),d=c,e=a[0].userId,h._each(e,function(a,b){var c=m[b];if(m.hasOwnProperty(b))switch(b){case"digitrustid":d[c]=h.deepAccess(a,"data.id");break;case"lipb":d[c]=a.lipbid;break;default:d[c]=a}}),c=d,a[0].schain&&(c.schain=(g=a[0].schain,"".concat(g.ver,",").concat(g.complete,"!").concat(function(a){var b=["asi","sid","hp","rid","name","domain"];return a.map(function(a){return b.map(function(b){return a[b]||""}).join(",")}).join("!")}(g.nodes)))),c}Object.defineProperty(b,"__esModule",{value:!0}),c.d(b,"USER_ID_CODE_TO_QUERY_ARG",function(){return m}),c.d(b,"spec",function(){return n});var f=c(3),g=c(1),h=c(0),i=c(2),j=[i.b,i.d],k="hb_pb",l="3.0.2",m={britepoolid:"britepoolid",criteoId:"criteoid",digitrustid:"digitrustid",id5id:"id5id",idl_env:"lre",lipb:"lipbid",netId:"netid",parrableid:"parrableid",pubcid:"pubcid",tdid:"ttduuid"},n={code:"openx",gvlid:69,supportedMediaTypes:j,isBidRequestValid:function(a){var b=a.params.delDomain||a.params.platform;return h.deepAccess(a,"mediaTypes.banner")&&b?!!a.params.unit||0<h.deepAccess(a,"mediaTypes.banner.sizes.length"):!(!a.params.unit||!b)},buildRequests:function(a,b){if(0===a.length)return[];var c=[],g=d(a.reduce(function(a,b){var c;return c=b,h.deepAccess(c,"mediaTypes.video")&&!h.deepAccess(c,"mediaTypes.banner")||c.mediaType===i.d?a[0].push(b):a[1].push(b),a},[[],[]]),2),j=g[0],k=g[1];return 0<k.length&&c.push(function(a,b){var c=[],d=!1,g=e(a,b),i=h._map(a,function(a){return a.params.unit});g.aus=h._map(a,function(a){return h.parseSizesInput(a.mediaTypes.banner.sizes).join(",")}).join("|"),g.divIds=h._map(a,function(a){return encodeURIComponent(a.adUnitCode)}).join(","),i.some(function(a){return a})&&(g.auid=i.join(",")),a.some(function(a){return a.params.doNotTrack})&&(g.ns=1),!0!==f.b.getConfig("coppa")&&!a.some(function(a){return a.params.coppa})||(g.tfcd=1),a.forEach(function(a){if(a.params.customParams){var b=h._map(Object.keys(a.params.customParams),function(b){return function(a,b){var c=b[a];return h.isArray(c)&&(c=c.join(",")),(a.toLowerCase()+"="+c.toLowerCase()).replace("+",".").replace("/","_")}(b,a.params.customParams)}),e=window.btoa(b.join("&"));d=!0,c.push(e)}else c.push("")}),d&&(g.tps=c.join(","));var j=[],k=!1;return a.forEach(function(a){a.params.customFloor?(j.push(Math.round(100*a.params.customFloor)/100*1e3),k=!0):j.push(0)}),k&&(g.aumfs=j.join(",")),{method:"GET",url:g.ph?"https://u.openx.net/w/1.0/arj":"https://".concat(a[0].params.delDomain,"/w/1.0/arj"),data:g,payload:{bids:a,startTime:new Date}}}(k,b)),0<j.length&&j.forEach(function(a){var d,f;c.push({method:"GET",url:(f=function(a,b){var c,d,f=e([a],b),g=h.deepAccess(a,"params.video")||{},i=h.deepAccess(a,"mediaTypes.video.context"),j=h.deepAccess(a,"mediaTypes.video.playerSize");return h.isArray(a.sizes)&&2===a.sizes.length&&!h.isArray(a.sizes[0])?(c=parseInt(a.sizes[0],10),d=parseInt(a.sizes[1],10)):h.isArray(a.sizes)&&h.isArray(a.sizes[0])&&2===a.sizes[0].length?(c=parseInt(a.sizes[0][0],10),d=parseInt(a.sizes[0][1],10)):h.isArray(j)&&2===j.length&&(c=parseInt(j[0],10),d=parseInt(j[1],10)),Object.keys(g).forEach(function(a){"openrtb"===a?(g[a].w=c||g[a].w,g[a].v=d||g[a].v,f[a]=JSON.stringify(g[a])):a in f||"url"===a||(f[a]=g[a])}),f.auid=a.params.unit,f.vwd=c||g.vwd,f.vht=d||g.vht,"outstream"===i&&(f.vos="101"),g.mimes&&(f.vmimes=g.mimes),f}(d=a,b)).ph?"https://u.openx.net/v/1.0/avjp":"https://".concat(d.params.delDomain,"/v/1.0/avjp"),data:f,payload:{bid:d,startTime:new Date}})}),c},interpretResponse:function(a,b){var c=a.body;return((/avjp$/.test(b.url)?i.d:i.b)===i.d?function(a,b){var c=b.bid,d=(b.startTime,[]);if(void 0!==a&&""!==a.vastUrl&&""!==a.pub_rev){var e=h.parseUrl(a.vastUrl).search||{},f={};f.requestId=c.bidId,f.ttl=300,f.netRevenue=!0,f.currency=a.currency,f.cpm=Number(a.pub_rev)/1e3,f.width=a.width,f.height=a.height,f.creativeId=a.adid,f.vastUrl=a.vastUrl,f.mediaType=i.d,a.ph=e.ph,a.colo=e.colo,a.ts=e.ts,d.push(f)}return d}:function(a,b){for(var c=b.bids,d=(b.startTime,a.ads.ad),e=[],f=0;f<d.length;f++){var g=d[f],h=parseInt(g.idx,10),i={};if(i.requestId=c[h].bidId,g.pub_rev){i.cpm=Number(g.pub_rev)/1e3;var j=g.creative[0];j&&(i.width=j.width,i.height=j.height),i.creativeId=j.id,i.ad=g.html,g.deal_id&&(i.dealId=g.deal_id),i.ttl=300,i.netRevenue=!0,i.currency=g.currency,g.tbd&&(i.tbd=g.tbd),i.ts=g.ts,i.meta={},g.brand_id&&(i.meta.brandId=g.brand_id),g.adv_id&&(i.meta.dspid=g.adv_id),e.push(i)}}return e})(c,b.payload)},getUserSyncs:function(a,b,c,d){if(a.iframeEnabled||a.pixelEnabled)return[{type:a.iframeEnabled?"iframe":"image",url:h.deepAccess(b,"0.body.ads.pixels")||h.deepAccess(b,"0.body.pixels")||function(a,b){var c=[];return a&&(c.push("gdpr="+(a.gdprApplies?1:0)),c.push("gdpr_consent="+encodeURIComponent(a.consentString||""))),b&&c.push("us_privacy="+encodeURIComponent(b)),"".concat("https://u.openx.net/w/1.0/pd").concat(0<c.length?"?"+c.join("&"):"")}(c,d)}]},transformBidParams:function(a){return h.convertTypes({unit:"string",customFloor:"number"},a)}};Object(g.registerBidder)(n)}},[557]),pbjsChunk([125],{596:function(a,b,c){a.exports=c(597)},597:function(a,b,c){"use strict";function d(){return(d=Object.assign||function(a){for(var b=1;b<arguments.length;b++){var c=arguments[b];for(var d in c)Object.prototype.hasOwnProperty.call(c,d)&&(a[d]=c[d])}return a}).apply(this,arguments)}function e(a){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(a){return typeof a}:function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a})(a)}function f(a,b){if(!p.isStr(b))return b&&p.logWarn(t+"Ignoring param key: "+a+", expects string-value, found "+e(b)),w;switch(a){case"pmzoneid":return b.split(",").slice(0,50).map(function(a){return a.trim()}).join();case"kadfloor":case"lat":case"lon":return parseFloat(b)||w;case"yob":return parseInt(b)||w;default:return b}}function g(a){var b;a.params.adUnit="",a.params.adUnitIndex="0",a.params.width=0,a.params.height=0,a.params.adSlot=(b=a.params.adSlot,p.isStr(b)?b.replace(/^\s+/g,"").replace(/\s+$/g,""):"");var c=a.params.adSlot,d=c.split(":");if(c=d[0],2==d.length&&(a.params.adUnitIndex=d[1]),d=c.split("@"),a.params.adUnit=d[0],1<d.length){if(2!=(d=d[1].split("x")).length)return void p.logWarn(t+"AdSlot Error: adSlot not in required format");a.params.width=parseInt(d[0],10),a.params.height=parseInt(d[1],10)}else if(a.hasOwnProperty("mediaTypes")&&a.mediaTypes.hasOwnProperty(r.b)&&a.mediaTypes.banner.hasOwnProperty("sizes")){for(var e=0,f=[];e<a.mediaTypes.banner.sizes.length;e++)2===a.mediaTypes.banner.sizes[e].length&&f.push(a.mediaTypes.banner.sizes[e]);a.mediaTypes.banner.sizes=f,1<=a.mediaTypes.banner.sizes.length&&(a.params.width=a.mediaTypes.banner.sizes[0][0],a.params.height=a.mediaTypes.banner.sizes[0][1],a.mediaTypes.banner.sizes=a.mediaTypes.banner.sizes.splice(1,a.mediaTypes.banner.sizes.length-1))}}function h(a,b,c){var d,f="Ignoring param key: "+a+", expects "+c+", found "+e(b);switch(c){case y.BOOLEAN:d=p.isBoolean;break;case y.NUMBER:d=p.isNumber;break;case y.STRING:d=p.isStr;break;case y.ARRAY:d=p.isArray}return d(b)?b:(p.logWarn(t+f),w)}function i(a){var b,c,d,e={assets:[]};for(var f in a){if(a.hasOwnProperty(f)){var g={};if(!(e.assets&&0<e.assets.length&&e.assets.hasOwnProperty(f)))switch(f){case A.TITLE.KEY:a[f].len||a[f].length?g={id:A.TITLE.ID,required:a[f].required?1:0,title:{len:a[f].len||a[f].length,ext:a[f].ext}}:p.logWarn(t+"Error: Title Length is required for native ad: "+JSON.stringify(a));break;case A.IMAGE.KEY:a[f].sizes&&0<a[f].sizes.length?g={id:A.IMAGE.ID,required:a[f].required?1:0,img:{type:B.IMAGE,w:a[f].w||a[f].width||(a[f].sizes?a[f].sizes[0]:w),h:a[f].h||a[f].height||(a[f].sizes?a[f].sizes[1]:w),wmin:a[f].wmin||a[f].minimumWidth||(a[f].minsizes?a[f].minsizes[0]:w),hmin:a[f].hmin||a[f].minimumHeight||(a[f].minsizes?a[f].minsizes[1]:w),mimes:a[f].mimes,ext:a[f].ext}}:p.logWarn(t+"Error: Image sizes is required for native ad: "+JSON.stringify(a));break;case A.ICON.KEY:a[f].sizes&&0<a[f].sizes.length?g={id:A.ICON.ID,required:a[f].required?1:0,img:{type:B.ICON,w:a[f].w||a[f].width||(a[f].sizes?a[f].sizes[0]:w),h:a[f].h||a[f].height||(a[f].sizes?a[f].sizes[1]:w)}}:p.logWarn(t+"Error: Icon sizes is required for native ad: "+JSON.stringify(a));break;case A.VIDEO.KEY:g={id:A.VIDEO.ID,required:a[f].required?1:0,video:{minduration:a[f].minduration,maxduration:a[f].maxduration,protocols:a[f].protocols,mimes:a[f].mimes,ext:a[f].ext}};break;case A.EXT.KEY:g={id:A.EXT.ID,required:a[f].required?1:0};break;case A.LOGO.KEY:g={id:A.LOGO.ID,required:a[f].required?1:0,img:{type:B.LOGO,w:a[f].w||a[f].width||(a[f].sizes?a[f].sizes[0]:w),h:a[f].h||a[f].height||(a[f].sizes?a[f].sizes[1]:w)}};break;case A.SPONSOREDBY.KEY:case A.BODY.KEY:case A.RATING.KEY:case A.LIKES.KEY:case A.DOWNLOADS.KEY:case A.PRICE.KEY:case A.SALEPRICE.KEY:case A.PHONE.KEY:case A.ADDRESS.KEY:case A.DESC2.KEY:case A.DISPLAYURL.KEY:case A.CTA.KEY:b=H[f],c=a,d=b.KEY,g={id:b.ID,required:c[d].required?1:0,data:{type:b.TYPE,len:c[d].len,ext:c[d].ext}}}}g&&g.id&&(e.assets[e.assets.length]=g)}var h=C.length,i=0;return C.forEach(function(a){for(var b=e.assets.length,c=0;c<b;c++)if(a.id==e.assets[c].id){i++;break}}),F=h!=i,e}function j(a){var b,c=a.mediaTypes.banner.sizes,d=[];if(c!==w&&p.isArray(c)){if(b={},a.params.width||a.params.height)b.w=a.params.width,b.h=a.params.height;else{if(0===c.length)return b=w,p.logWarn(t+"Error: mediaTypes.banner.size missing for adunit: "+a.params.adUnit+". Ignoring the banner impression in the adunit."),b;b.w=parseInt(c[0][0],10),b.h=parseInt(c[0][1],10),c=c.splice(1,c.length-1)}0<c.length&&(d=[],c.forEach(function(a){1<a.length&&d.push({w:a[0],h:a[1]})}),0<d.length&&(b.format=d)),b.pos=0,b.topframe=p.inIframe()?0:1}else p.logWarn(t+"Error: mediaTypes.banner.size missing for adunit: "+a.params.adUnit+". Ignoring the banner impression in the adunit."),b=w;return b}function k(a){var b,c=a.params.video;if(c!==w){for(var d in b={},z)c.hasOwnProperty(d)&&(b[d]=h(d,c[d],z[d]));p.isArray(a.mediaTypes.video.playerSize[0])?(b.w=parseInt(a.mediaTypes.video.playerSize[0][0],10),b.h=parseInt(a.mediaTypes.video.playerSize[0][1],10)):p.isNumber(a.mediaTypes.video.playerSize[0])&&(b.w=parseInt(a.mediaTypes.video.playerSize[0],10),b.h=parseInt(a.mediaTypes.video.playerSize[1],10)),a.params.video.hasOwnProperty("skippable")&&(b.ext={video_skippable:a.params.video.skippable?1:0})}else b=w,p.logWarn(t+"Error: Video config params missing for adunit: "+a.params.adUnit+" with mediaType set as video. Ignoring video impression in the adunit.");return b}function l(a){var b,c,d,e,g={},h={},l=a.hasOwnProperty("sizes")?a.sizes:[],m="",n=[];if(g={id:a.bidId,tagid:a.params.adUnit||void 0,bidfloor:f("kadfloor",a.params.kadfloor),secure:1,ext:{pmZoneId:f("pmzoneid",a.params.pmzoneid)},bidfloorcur:a.params.currency?f("currency",a.params.currency):u},d=g,(e=a).params.deals&&(p.isArray(e.params.deals)?e.params.deals.forEach(function(a){p.isStr(a)&&3<a.length?(d.pmp||(d.pmp={private_auction:0,deals:[]}),d.pmp.deals.push({id:a})):p.logWarn(t+"Error: deal-id present in array bid.params.deals should be a strings with more than 3 charaters length, deal-id ignored: "+a)}):p.logWarn(t+"Error: bid.params.deals should be an array of strings.")),a.hasOwnProperty("mediaTypes"))for(m in a.mediaTypes)switch(m){case r.b:(b=j(a))!==w&&(g.banner=b);break;case r.c:h.request=JSON.stringify(i(a.nativeParams)),F?p.logWarn(t+"Error: Error in Native adunit "+a.params.adUnit+". Ignoring the adunit. Refer to http://prebid.org/dev-docs/show-native-ads.html for more details."):g["native"]=h;break;case r.d:(c=k(a))!==w&&(g.video=c)}else b={pos:0,w:a.params.width,h:a.params.height,topframe:p.inIframe()?0:1},p.isArray(l)&&1<l.length&&((l=l.splice(1,l.length-1)).forEach(function(a){n.push({w:a[0],h:a[1]})}),b.format=n),g.banner=b;return g.hasOwnProperty(r.b)||g.hasOwnProperty(r.c)||g.hasOwnProperty(r.d)?g:w}function m(a){var b,c,d,e=(b=v,!(d=(c=window.DigiTrust&&(s.b.getConfig("digiTrustId")||window.DigiTrust.getUser({member:b})))&&c.success&&c.identity||null)||d.privacy&&d.privacy.optout?null:d);null!==e&&a.push({source:"digitru.st",uids:[{id:e.id||"",atype:1,ext:{keyv:parseInt(e.keyv)||0}}]})}function n(a,b,c,d){p.isStr(b)&&a.push({source:c,uids:[{id:b,atype:d}]})}function o(a,b){var c,d,e,f,g=[];m(g),c=g,d=b,e=null,f=s.b.getConfig("adsrvrOrgId"),p.isStr(p.deepAccess(d,"0.userId.tdid"))?e=d[0].userId.tdid:f&&p.isStr(f.TDID)&&(e=f.TDID),null!==e&&c.push({source:"adserver.org",uids:[{id:e,atype:1,ext:{rtiPartner:"TDID"}}]});var h=b[0];h&&h.userId&&(n(g,p.deepAccess(h,"userId.pubcid"),"pubcid.org",1),n(g,p.deepAccess(h,"userId.digitrustid.data.id"),"digitru.st",1),n(g,p.deepAccess(h,"userId.id5id"),"id5-sync.com",1),n(g,p.deepAccess(h,"userId.criteoId"),"criteo.com",1),n(g,p.deepAccess(h,"userId.idl_env"),"liveramp.com",1),n(g,p.deepAccess(h,"userId.lipb.lipbid"),"liveintent.com",1),n(g,p.deepAccess(h,"userId.parrableid"),"parrable.com",1),n(g,p.deepAccess(h,"userId.britepoolid"),"britepool.com",1),n(g,p.deepAccess(h,"userId.netId"),"netid.de",1)),0<g.length&&(a.user.eids=g)}Object.defineProperty(b,"__esModule",{value:!0}),c.d(b,"spec",function(){return I});var p=c(0),q=c(1),r=c(2),s=c(3),t="PubMatic: ",u="USD",v="nFIn8aLzbd",w=void 0,x={kadpageurl:"",gender:"",yob:"",lat:"",lon:"",wiid:"",profId:"",verId:""},y={NUMBER:"number",STRING:"string",BOOLEAN:"boolean",ARRAY:"array",OBJECT:"object"},z={mimes:y.ARRAY,minduration:y.NUMBER,maxduration:y.NUMBER,startdelay:y.NUMBER,playbackmethod:y.ARRAY,api:y.ARRAY,protocols:y.ARRAY,w:y.NUMBER,h:y.NUMBER,battr:y.ARRAY,linearity:y.NUMBER,placement:y.NUMBER,minbitrate:y.NUMBER,maxbitrate:y.NUMBER},A={TITLE:{ID:1,KEY:"title",TYPE:0},IMAGE:{ID:2,KEY:"image",TYPE:0},ICON:{ID:3,KEY:"icon",TYPE:0},SPONSOREDBY:{ID:4,KEY:"sponsoredBy",TYPE:1},BODY:{ID:5,KEY:"body",TYPE:2},CLICKURL:{ID:6,KEY:"clickUrl",TYPE:0},VIDEO:{ID:7,KEY:"video",TYPE:0},EXT:{ID:8,KEY:"ext",TYPE:0},DATA:{ID:9,KEY:"data",TYPE:0},LOGO:{ID:10,KEY:"logo",TYPE:0},SPONSORED:{ID:11,KEY:"sponsored",TYPE:1},DESC:{ID:12,KEY:"data",TYPE:2},RATING:{ID:13,KEY:"rating",TYPE:3},LIKES:{ID:14,KEY:"likes",TYPE:4},DOWNLOADS:{ID:15,KEY:"downloads",TYPE:5},PRICE:{ID:16,KEY:"price",TYPE:6},SALEPRICE:{ID:17,KEY:"saleprice",TYPE:7},PHONE:{ID:18,KEY:"phone",TYPE:8},ADDRESS:{ID:19,KEY:"address",TYPE:9},DESC2:{ID:20,KEY:"desc2",TYPE:10},DISPLAYURL:{ID:21,KEY:"displayurl",TYPE:11},CTA:{ID:22,KEY:"cta",TYPE:12}},B={ICON:1,LOGO:2,IMAGE:3},C=[{id:A.SPONSOREDBY.ID,required:!0,data:{type:1}},{id:A.TITLE.ID,required:!0},{id:A.IMAGE.ID,required:!0}],D={1:"PMP",5:"PREF",6:"PMPG"},E=0,F=!1,G={},H={};p._each(A,function(a){G[a.ID]=a.KEY}),p._each(A,function(a){H[a.KEY]=a});var I={code:"pubmatic",gvlid:76,supportedMediaTypes:[r.b,r.d,r.c],isBidRequestValid:function(a){return!(!a||!a.params||(p.isStr(a.params.publisherId)?!(!a.params.hasOwnProperty("video")||a.params.video.hasOwnProperty("mimes")&&p.isArray(a.params.video.mimes)&&0!==a.params.video.mimes.length)&&(p.logWarn(t+"Error: For video ads, mimes is mandatory and must specify atlease 1 mime value. Call to OpenBid will not be sent for ad unit:"+JSON.stringify(a)),
1):(p.logWarn(t+"Error: publisherId is mandatory and cannot be numeric. Call to OpenBid will not be sent for ad unit: "+JSON.stringify(a)),1)))},buildRequests:function(a,b){var c;b&&b.refererInfo&&(c=b.refererInfo);var h,i,j,k,m,n,q,v={pageURL:(h=c)&&h.referer?h.referer:window.location.href,refURL:window.document.referrer},y=(i=v,{id:""+(new Date).getTime(),at:1,cur:[u],imp:[],site:{page:i.pageURL,ref:i.refURL,publisher:{}},device:{ua:navigator.userAgent,js:1,dnt:"yes"==navigator.doNotTrack||"1"==navigator.doNotTrack||"1"==navigator.msDoNotTrack?1:0,h:screen.height,w:screen.width,language:navigator.language},user:{},ext:{}}),z="",A=[],B=[];if(a.forEach(function(a){if((j=p.deepClone(a)).params.adSlot=j.params.adSlot||"",g(j),j.params.hasOwnProperty("video")||j.hasOwnProperty("mediaTypes")&&j.mediaTypes.hasOwnProperty(r.c)||0!==j.params.width||0!==j.params.height){v.pubId=v.pubId||j.params.publisherId,(v=function(a,b){var c,d,f;for(c in b.kadpageurl||(b.kadpageurl=b.pageURL),x)x.hasOwnProperty(c)&&(d=a[c])&&("object"===e(f=x[c])&&(d=f.f(d,b)),p.isStr(d)?b[c]=d:p.logWarn(t+"Ignoring param : "+c+" with value : "+x[c]+", expects string-value, found "+e(d)));return b}(j.params,v)).transactionId=j.transactionId,""===z?z=j.params.currency||w:j.params.hasOwnProperty("currency")&&z!==j.params.currency&&p.logWarn(t+"Currency specifier ignored. Only one currency permitted."),j.params.currency=z,j.params.hasOwnProperty("dctr")&&p.isStr(j.params.dctr)&&A.push(j.params.dctr),j.params.hasOwnProperty("bcat")&&p.isArray(j.params.bcat)&&(B=B.concat(j.params.bcat));var b=l(j);b&&y.imp.push(b)}else p.logWarn(t+"Skipping the non-standard adslot: ",j.params.adSlot,JSON.stringify(j))}),0!=y.imp.length)return y.site.publisher.id=v.pubId.trim(),E=v.pubId.trim(),y.ext.wrapper={},y.ext.wrapper.profile=parseInt(v.profId)||w,y.ext.wrapper.version=parseInt(v.verId)||w,y.ext.wrapper.wiid=v.wiid||w,y.ext.wrapper.wv="prebid_prebid_3.19.0",y.ext.wrapper.transactionId=v.transactionId,y.ext.wrapper.wp="pbjs",y.user.gender=v.gender?v.gender.trim():w,y.user.geo={},y.user.geo.lat=f("lat",v.lat),y.user.geo.lon=f("lon",v.lon),y.user.yob=f("yob",v.yob),y.device.geo=y.user.geo,y.site.page=v.kadpageurl.trim()||y.site.page.trim(),y.site.domain=(k=y.site.page,(m=document.createElement("a")).href=k,m.hostname),"object"===e(s.b.getConfig("device"))&&(y.device=d(y.device,s.b.getConfig("device"))),p.deepSetValue(y,"source.tid",v.transactionId),-1!==window.location.href.indexOf("pubmaticTest=true")&&(y.test=1),a[0].schain&&p.deepSetValue(y,"source.ext.schain",a[0].schain),b&&b.gdprConsent&&(p.deepSetValue(y,"user.ext.consent",b.gdprConsent.consentString),p.deepSetValue(y,"regs.ext.gdpr",b.gdprConsent.gdprApplies?1:0)),b&&b.uspConsent&&p.deepSetValue(y,"regs.ext.us_privacy",b.uspConsent),!0===s.b.getConfig("coppa")&&p.deepSetValue(y,"regs.coppa",1),function(a,b,c){var d,e="";if(0<b.length)if(c[0].params.hasOwnProperty("dctr")){if(e=c[0].params.dctr,p.isStr(e)&&0<e.length){var f=e.split("|");e="",f.forEach(function(a){e+=0<a.length?a.trim()+"|":""}),d=e.length,"|"===e.substring(d,d-1)&&(e=e.substring(0,d-1)),a.site.ext={key_val:e.trim()}}else p.logWarn(t+"Ignoring param : dctr with value : "+e+", expects string-value, found empty or non-string value");1<b.length&&p.logWarn(t+"dctr value found in more than 1 adunits. Value from 1st adunit will be picked. Ignoring values from subsequent adunits")}else p.logWarn(t+"dctr value not found in 1st adunit, ignoring values from subsequent adunits")}(y,A,a),o(y,a),n=y,0<(q=(q=B).filter(function(a){return"string"==typeof a||(p.logWarn(t+"bcat: Each category should be a string, ignoring category: "+a),!1)}).map(function(a){return a.trim()}).filter(function(a,b,c){return 3<a.length?c.indexOf(a)===b:void p.logWarn(t+"bcat: Each category should have a value of a length of more than 3 characters, ignoring category: "+a)})).length&&(p.logWarn(t+"bcat: Selected: ",q),n.bcat=q),"object"===e(s.b.getConfig("app"))&&(y.app=s.b.getConfig("app"),y.app.publisher=y.site.publisher,y.app.ext=y.site.ext||w,delete y.site),{method:"POST",url:"https://hbopenbid.pubmatic.com/translator?source=prebid-client",data:JSON.stringify(y)}},interpretResponse:function(a,b){var c=[],d=u,e=JSON.parse(b.data),f=e.site&&e.site.ref?e.site.ref:"";try{a.body&&a.body.seatbid&&p.isArray(a.body.seatbid)&&(d=a.body.cur||d,a.body.seatbid.forEach(function(a){a.bid&&p.isArray(a.bid)&&a.bid.forEach(function(b){var g={requestId:b.impid,cpm:(parseFloat(b.price)||0).toFixed(2),width:b.w,height:b.h,creativeId:b.crid||b.id,dealId:b.dealid,currency:d,netRevenue:!1,ttl:300,referrer:f,ad:b.adm,pm_seat:a.seat||null,pm_dspid:b.ext&&b.ext.dspid?b.ext.dspid:null};e.imp&&0<e.imp.length&&e.imp.forEach(function(a){if(b.impid===a.id)switch(!function(a,b){var c="",d=new RegExp(/VAST\s+version/);if(0<=a.indexOf('span class="PubAPIAd"'))b.mediaType=r.b;else if(d.test(a))b.mediaType=r.d;else try{(c=JSON.parse(a.replace(/\\/g,"")))&&c["native"]&&(b.mediaType=r.c)}catch(b){p.logWarn(t+"Error: Cannot parse native reponse for ad response: "+a)}}(b.adm,g),g.mediaType){case r.b:break;case r.d:g.width=b.hasOwnProperty("w")?b.w:a.video.w,g.height=b.hasOwnProperty("h")?b.h:a.video.h,g.vastXml=b.adm;break;case r.c:!function(a,b){if(b["native"]={},a.hasOwnProperty("adm")){var c="";try{c=JSON.parse(a.adm.replace(/\\/g,""))}catch(a){return p.logWarn(t+"Error: Cannot parse native reponse for ad response: "+b.adm)}if(c&&c["native"]&&c["native"].assets&&0<c["native"].assets.length){b.mediaType=r.c;for(var d=0,e=c["native"].assets.length;d<e;d++)switch(c["native"].assets[d].id){case A.TITLE.ID:b["native"].title=c["native"].assets[d].title&&c["native"].assets[d].title.text;break;case A.IMAGE.ID:b["native"].image={url:c["native"].assets[d].img&&c["native"].assets[d].img.url,height:c["native"].assets[d].img&&c["native"].assets[d].img.h,width:c["native"].assets[d].img&&c["native"].assets[d].img.w};break;case A.ICON.ID:b["native"].icon={url:c["native"].assets[d].img&&c["native"].assets[d].img.url,height:c["native"].assets[d].img&&c["native"].assets[d].img.h,width:c["native"].assets[d].img&&c["native"].assets[d].img.w};break;case A.SPONSOREDBY.ID:case A.BODY.ID:case A.LIKES.ID:case A.DOWNLOADS.ID:case A.PRICE:case A.SALEPRICE.ID:case A.PHONE.ID:case A.ADDRESS.ID:case A.DESC2.ID:case A.CTA.ID:case A.RATING.ID:case A.DISPLAYURL.ID:b["native"][G[c["native"].assets[d].id]]=c["native"].assets[d].data&&c["native"].assets[d].data.value}b["native"].clickUrl=c["native"].link&&c["native"].link.url,b["native"].clickTrackers=c["native"].link&&c["native"].link.clicktrackers||[],b["native"].impressionTrackers=c["native"].imptrackers||[],b["native"].jstracker=c["native"].jstracker||[],b.width||(b.width=0),b.height||(b.height=0)}}}(b,g)}}),b.ext&&b.ext.deal_channel&&(g.dealChannel=D[b.ext.deal_channel]||null),g.meta={},b.ext&&b.ext.dspid&&(g.meta.networkId=b.ext.dspid),b.ext&&b.ext.advid&&(g.meta.buyerId=b.ext.advid),b.adomain&&0<b.adomain.length&&(g.meta.clickUrl=b.adomain[0]),a.ext&&a.ext.buyid&&(g.adserverTargeting={hb_buyid_pubmatic:a.ext.buyid}),c.push(g)})}))}catch(a){p.logError(a)}return c},getUserSyncs:function(a,b,c,d){var e=""+E;return c&&(e+="&gdpr="+(c.gdprApplies?1:0),e+="&gdpr_consent="+encodeURIComponent(c.consentString||"")),d&&(e+="&us_privacy="+encodeURIComponent(d)),!0===s.b.getConfig("coppa")&&(e+="&coppa=1"),a.iframeEnabled?[{type:"iframe",url:"https://ads.pubmatic.com/AdServer/js/showad.js#PIX&kdntuid=1&p="+e}]:[{type:"image",url:"https://image8.pubmatic.com/AdServer/ImgSync?p="+e}]},transformBidParams:function(a){return p.convertTypes({publisherId:"string",adSlot:"string"},a)}};Object(q.registerBidder)(I)}},[596]),pbjsChunk([111],{632:function(a,b,c){a.exports=c(633)},633:function(a,b,c){"use strict";function d(a,b,c,d){h.isStr(d)&&b.push({userId:d,source:c})}Object.defineProperty(b,"__esModule",{value:!0}),c.d(b,"spec",function(){return j});var e=c(1),f=c(3),g=c(2),h=c(0),i="",j={code:"richaudience",aliases:["ra"],supportedMediaTypes:[g.b,g.d],isBidRequestValid:function(a){return!!(a.params&&a.params.pid&&a.params.supplyType)},buildRequests:function(a,b){return a.map(function(a){var c={bidfloor:a.params.bidfloor,ifa:a.params.ifa,pid:a.params.pid,supplyType:a.params.supplyType,currencyCode:f.b.getConfig("currency.adServerCurrency"),auctionId:a.auctionId,bidId:a.bidId,BidRequestsCount:a.bidRequestsCount,bidder:a.bidder,bidderRequestId:a.bidderRequestId,tagId:a.adUnitCode,sizes:function(a){var b;if(b=a.mediaTypes&&a.mediaTypes.banner&&a.mediaTypes.banner.sizes?a.mediaTypes.banner.sizes:a.sizes,null!=b)return b.map(function(a){return{w:a[0],h:a[1]}})}(a),referer:void 0!==b.refererInfo.referer?encodeURIComponent(b.refererInfo.referer):null,numIframes:void 0!==b.refererInfo.numIframes?b.refererInfo.numIframes:null,transactionId:a.transactionId,timeout:f.b.getConfig("bidderTimeout"),user:function(a){var b=[];return a&&a.userId&&(d(0,b,"id5-sync.com",h.deepAccess(a,"userId.id5id")),d(0,b,"pubcommon",h.deepAccess(a,"userId.pubcid")),d(0,b,"criteo.com",h.deepAccess(a,"userId.criteoId")),d(0,b,"liveramp.com",h.deepAccess(a,"userId.idl_env")),d(0,b,"liveintent.com",h.deepAccess(a,"userId.lipb.lipbid")),d(0,b,"adserver.org",h.deepAccess(a,"userId.tdid"))),b}(a)};return i=void 0!==b.refererInfo.referer?encodeURIComponent(b.refererInfo.referer):null,c.gdpr_consent="",c.gdpr=null,b&&b.gdprConsent&&(c.gdpr_consent=b.gdprConsent.consentString,c.gdpr=b.gdprConsent.gdprApplies),{method:"POST",url:"https://shb.richaudience.com/hb/",data:JSON.stringify(c)}})},interpretResponse:function(a,b){var c=[],d=a.body;if(d){var e={requestId:JSON.parse(b.data).bidId,cpm:d.cpm,width:d.width,height:d.height,creativeId:d.creative_id,mediaType:d.media_type,netRevenue:d.netRevenue,currency:d.currency,ttl:d.ttl,dealId:d.dealId};"video"===d.media_type?e.vastXml=d.vastXML:e.ad=d.adm,c.push(e)}return c},getUserSyncs:function(a,b,c){var d=[],e=Math.floor(9999999999*Math.random()),f="";return f=c&&"string"==typeof c.consentString?"https://sync.richaudience.com/dcf3528a0b8aa83634892d50e91c306e/?ord="+e+"&pubconsent="+c.consentString+"&euconsent="+c.consentString:"https://sync.richaudience.com/dcf3528a0b8aa83634892d50e91c306e/?ord="+e,a.iframeEnabled?d.push({type:"iframe",url:f}):a.pixelEnabled&&null!=i&&(f=void 0!==c&&void 0!==c.consentString?"https://sync.richaudience.com/bf7c142f4339da0278e83698a02b0854/?euconsent=".concat(c.consentString,"&referrer=").concat(i):"https://sync.richaudience.com/bf7c142f4339da0278e83698a02b0854/?referrer=".concat(i),d.push({type:"image",url:f})),d}};Object(e.registerBidder)(j)}},[632]),pbjsChunk([106],{648:function(a,b,c){a.exports=c(649)},649:function(a,b,c){"use strict";function d(a,b){return function(a){if(Array.isArray(a))return a}(a)||function(a,b){if(Symbol.iterator in Object(a)||"[object Arguments]"===Object.prototype.toString.call(a)){var c=[],d=!0,e=!1,f=void 0;try{for(var g,h=a[Symbol.iterator]();!(d=(g=h.next()).done)&&(c.push(g.value),!b||c.length!==b);d=!0);}catch(a){e=!0,f=a}finally{try{d||null==h["return"]||h["return"]()}finally{if(e)throw f}}return c}}(a,b)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function e(){return(e=Object.assign||function(a){for(var b=1;b<arguments.length;b++){var c=arguments[b];for(var d in c)Object.prototype.hasOwnProperty.call(c,d)&&(a[d]=c[d])}return a}).apply(this,arguments)}function f(a,b,c){return b in a?Object.defineProperty(a,b,{value:c,enumerable:!0,configurable:!0,writable:!0}):a[b]=c,a}function g(a){return(g="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(a){return typeof a}:function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a})(a)}function h(a,b){var c,d=0<arguments.length&&void 0!==a?a:{},e=1<arguments.length?b:void 0;if(!e||!A[e])return null;var g=A[e],h=function(){var a=t.deepAccess(d,"userId.digitrustid.data");if(a)return a;var b=window.DigiTrust&&(v.b.getConfig("digiTrustId")||window.DigiTrust.getUser({member:"T9QSFKPDN9"}));return b&&b.success&&b.identity||null}();if(!h||h.privacy&&h.privacy.optout)return null;var i=(f(c={},g.id,h.id),f(c,g.keyv,h.keyv),c);return g.pref&&(i[g.pref]=0),i}function i(a,b){var c=v.b.getConfig("pageUrl");return c=a.params.referrer?a.params.referrer:c||b.refererInfo.referer,a.params.secure?c.replace(/^http:/i,"https:"):c}function j(a,b){var c=a.params;if("video"===b){var d=[];return c.video&&c.video.playerWidth&&c.video.playerHeight?d=[c.video.playerWidth,c.video.playerHeight]:Array.isArray(t.deepAccess(a,"mediaTypes.video.playerSize"))&&1===a.mediaTypes.video.playerSize.length?d=a.mediaTypes.video.playerSize[0]:Array.isArray(a.sizes)&&0<a.sizes.length&&Array.isArray(a.sizes[0])&&1<a.sizes[0].length&&(d=a.sizes[0]),d}var e=[];return Array.isArray(c.sizes)?e=c.sizes:void 0!==t.deepAccess(a,"mediaTypes.banner.sizes")?e=k(a.mediaTypes.banner.sizes):Array.isArray(a.sizes)&&0<a.sizes.length?e=k(a.sizes):t.logWarn("Rubicon: no sizes are setup or found"),n(e)}function k(a){return t.parseSizesInput(a).reduce(function(a,b){var c=parseInt(B[b],10);return c&&a.push(c),a},[])}function l(a){return"object"===g(t.deepAccess(a,"params.video"))&&void 0!==t.deepAccess(a,"mediaTypes.".concat(w.d))}function m(a,b){var c=1<arguments.length&&void 0!==b&&b;return l(a)?-1===["outstream","instream"].indexOf(t.deepAccess(a,"mediaTypes.".concat(w.d,".context")))?void(c&&t.logError("Rubicon: mediaTypes.video.context must be outstream or instream")):j(a,"video").length<2?void(c&&t.logError("Rubicon: could not determine the playerSize of the video")):(c&&t.logMessage("Rubicon: making video request for adUnit",a.adUnitCode),"video"):0===j(a,"banner").length?void(c&&t.logError("Rubicon: could not determine the sizes for banner request")):(c&&t.logMessage("Rubicon: making banner request for adUnit",a.adUnitCode),"banner")}function n(a){var b=[15,2,9];return a.sort(function(a,c){var d=b.indexOf(a),e=b.indexOf(c);return-1<d||-1<e?-1===d?1:-1===e?-1:d-e:a-c})}function o(a){var b=parseInt(t.deepAccess(a,"params.video.size_id"));return isNaN(b)?"outstream"===t.deepAccess(a,"mediaTypes.".concat(w.d,".context"))?203:201:b}function p(a){return{ranges:{low:[{max:5,increment:.5}],medium:[{max:20,increment:.1}],high:[{max:20,increment:.01}],auto:[{max:5,increment:.05},{min:5,max:10,increment:.1},{min:10,max:20,increment:.5}],dense:[{max:3,increment:.01},{min:3,max:8,increment:.05},{min:8,max:20,increment:.5}],custom:a.getConfig("customPriceBucket")&&a.getConfig("customPriceBucket").buckets}[a.getConfig("priceGranularity")]}}function q(a){var b=!0,c=Object.prototype.toString.call([]),d=Object.prototype.toString.call(0),e={mimes:c,protocols:c,maxduration:d,linearity:d,api:c};return Object.keys(e).forEach(function(c){Object.prototype.toString.call(t.deepAccess(a,"mediaTypes.video."+c))!==e[c]&&(b=!1,t.logError("Rubicon: mediaTypes.video."+c+" is required and must be of type: "+e[c]))}),b}function r(a){var b=!1,c=["asi","sid","hp"];return a.nodes&&((b=a.nodes.reduce(function(a,b){return a?c.every(function(a){return b[a]}):a},!0))||t.logError("Rubicon: required schain params missing")),b}function s(a,b){return"rp_schain"===a?"rp_schain=".concat(b):"".concat(a,"=").concat(encodeURIComponent(b))}Object.defineProperty(b,"__esModule",{value:!0}),c.d(b,"FASTLANE_ENDPOINT",function(){return x}),c.d(b,"VIDEO_ENDPOINT",function(){return y}),c.d(b,"SYNC_ENDPOINT",function(){return z}),c.d(b,"spec",function(){return C}),b.hasVideoMediaType=l,b.masSizeOrdering=n,b.determineRubiconVideoSizeId=o,b.getPriceGranularity=p,b.hasValidVideoParams=q,b.hasValidSupplyChainParams=r,b.encodeParam=s,b.resetUserSync=function(){D=!1};var t=c(0),u=c(1),v=c(3),w=c(2),x="https://fastlane.rubiconproject.com/a/api/fastlane.json",y="https://prebid-server.rubiconproject.com/openrtb2/auction",z="https://eus.rubiconproject.com/usync.html",A={FASTLANE:{id:"dt.id",keyv:"dt.keyv",pref:"dt.pref"},PREBID_SERVER:{id:"id",keyv:"keyv"}},B={1:"468x60",2:"728x90",5:"120x90",8:"120x600",9:"160x600",10:"300x600",13:"200x200",14:"250x250",15:"300x250",16:"336x280",17:"240x400",19:"300x100",31:"980x120",32:"250x360",33:"180x500",35:"980x150",37:"468x400",38:"930x180",39:"750x100",40:"750x200",41:"750x300",42:"2x4",43:"320x50",44:"300x50",48:"300x300",53:"1024x768",54:"300x1050",55:"970x90",57:"970x250",58:"1000x90",59:"320x80",60:"320x150",61:"1000x1000",64:"580x500",65:"640x480",66:"930x600",67:"320x480",68:"1800x1000",72:"320x320",73:"320x160",78:"980x240",79:"980x300",80:"980x400",83:"480x300",85:"300x120",90:"548x150",94:"970x310",95:"970x100",96:"970x210",101:"480x320",102:"768x1024",103:"480x280",105:"250x800",108:"320x240",113:"1000x300",117:"320x100",125:"800x250",126:"200x600",144:"980x600",145:"980x150",152:"1000x250",156:"640x320",159:"320x250",179:"250x600",195:"600x300",198:"640x360",199:"640x200",213:"1030x590",214:"980x360",221:"1x1",229:"320x180",230:"2000x1400",232:"580x400",234:"6x6",251:"2x2",256:"480x820",257:"400x600",258:"500x200",259:"998x200",264:"970x1000",265:"1920x1080",274:"1800x200",278:"320x500",282:"320x400",288:"640x380"};t._each(B,function(a,b){return B[a]=b});var C={code:"rubicon",gvlid:52,supportedMediaTypes:[w.b,w.d],isBidRequestValid:function(a){if("object"!==g(a.params))return!1;for(var b=0,c=["accountId","siteId","zoneId"];b<c.length;b++)if(a.params[c[b]]=parseInt(a.params[c[b]]),isNaN(a.params[c[b]]))return t.logError("Rubicon: wrong format of accountId or siteId or zoneId."),!1;var d=m(a,!0);return!!d&&("video"!==d||q(a))},buildRequests:function(a,b){var c=[],d=a.filter(function(a){return"video"===m(a)}).map(function(a){a.startTime=(new Date).getTime();var c,d={id:a.transactionId,test:v.b.getConfig("debug")?1:0,cur:["USD"],source:{tid:a.transactionId},tmax:v.b.getConfig("TTL")||1e3,imp:[{exp:300,id:a.adUnitCode,secure:1,ext:f({},a.bidder,a.params),video:t.deepAccess(a,"mediaTypes.video")||{}}],ext:{prebid:{cache:{vastxml:{returnCreative:!1}},targeting:{includewinners:!0,includebidderkeys:!1,pricegranularity:p(v.b)}}}};if("rubicon"!==a.bidder&&(d.ext.prebid.aliases=f({},a.bidder,"rubicon")),"function"!=typeof a.getFloor||v.b.getConfig("rubicon.disableFloors"))c=parseFloat(t.deepAccess(a,"params.floor"));else{var k=a.getFloor({currency:"USD",mediaType:"video",size:j(a,"video")});c="object"!==g(k)||"USD"!==k.currency||isNaN(parseInt(k.floor))?void 0:parseFloat(k.floor)}isNaN(c)||(d.imp[0].bidfloor=c),d.imp[0].ext[a.bidder].video.size_id=o(a),function(a,b,c){a&&("object"===g(v.b.getConfig("app"))?a.app=v.b.getConfig("app"):a.site={page:i(b,c)},"object"===g(v.b.getConfig("device"))&&(a.device=v.b.getConfig("device")),b.params.video.language&&["site","device"].forEach(function(c){a[c]&&(a[c].content=e({language:b.params.video.language},a[c].content))}))}(d,a,b),function(a,b){"object"===g(a.imp[0].video)&&void 0===a.imp[0].video.skip&&(a.imp[0].video.skip=b.params.video.skip),"object"===g(a.imp[0].video)&&void 0===a.imp[0].video.skipafter&&(a.imp[0].video.skipafter=b.params.video.skipdelay),"object"===g(a.imp[0].video)&&void 0===a.imp[0].video.pos&&("atf"===b.params.position?a.imp[0].video.pos=1:"btf"===b.params.position&&(a.imp[0].video.pos=3));var c=j(b,"video");a.imp[0].video.w=c[0],a.imp[0].video.h=c[1]}(d,a);var l,m=h(a,"PREBID_SERVER");m&&t.deepSetValue(d,"user.ext.digitrust",m),b.gdprConsent&&("boolean"==typeof b.gdprConsent.gdprApplies&&(l=b.gdprConsent.gdprApplies?1:0),t.deepSetValue(d,"regs.ext.gdpr",l),t.deepSetValue(d,"user.ext.consent",b.gdprConsent.consentString)),b.uspConsent&&t.deepSetValue(d,"regs.ext.us_privacy",b.uspConsent),a.userId&&"object"===g(a.userId)&&(a.userId.tdid||a.userId.pubcid||a.userId.lipb||a.userId.idl_env)&&(t.deepSetValue(d,"user.ext.eids",[]),a.userId.tdid&&d.user.ext.eids.push({source:"adserver.org",uids:[{id:a.userId.tdid,ext:{rtiPartner:"TDID"}}]}),a.userId.pubcid&&d.user.ext.eids.push({source:"pubcommon",uids:[{id:a.userId.pubcid}]}),a.userId.lipb&&a.userId.lipb.lipbid&&(d.user.ext.eids.push({source:"liveintent.com",uids:[{id:a.userId.lipb.lipbid}]}),d.user.ext.tpid={source:"liveintent.com",uid:a.userId.lipb.lipbid},Array.isArray(a.userId.lipb.segments)&&a.userId.lipb.segments.length&&t.deepSetValue(d,"rp.target.LIseg",a.userId.lipb.segments)),a.userId.idl_env&&d.user.ext.eids.push({source:"liveramp.com",uids:[{id:a.userId.idl_env}]})),!0===v.b.getConfig("coppa")&&t.deepSetValue(d,"regs.coppa",1),a.schain&&r(a.schain)&&t.deepSetValue(d,"source.ext.schain",a.schain);var n=e({},a.params.inventory,v.b.getConfig("fpd.context")),q=e({},a.params.visitor,v.b.getConfig("fpd.user"));if(!t.isEmpty(n)||!t.isEmpty(q)){var s={bidders:[b.bidderCode],config:{fpd:{}}};t.isEmpty(n)||(s.config.fpd.site=n),t.isEmpty(q)||(s.config.fpd.user=q),t.deepSetValue(d,"ext.prebid.bidderconfig.0",s)}var u=t.deepAccess(a,"fpd.context.pbAdSlot");return"string"==typeof u&&u&&t.deepSetValue(d.imp[0].ext,"context.data.adslot",u),a.storedAuctionResponse&&t.deepSetValue(d.imp[0],"ext.prebid.storedauctionresponse.id",a.storedAuctionResponse.toString()),{method:"POST",url:y,data:d,bidRequest:a}});if(!0!==v.b.getConfig("rubicon.singleRequest"))c=d.concat(a.filter(function(a){return"banner"===m(a)}).map(function(a){var c=C.createSlotParams(a,b);return{method:"GET",url:x,data:C.getOrderedParams(c).reduce(function(a,b){var d=c[b];return t.isStr(d)&&""!==d||t.isNumber(d)?"".concat(a).concat(s(b,d),"&"):a},"")+"slots=1&rand=".concat(Math.random()),bidRequest:a}}));else{var k=a.filter(function(a){return"banner"===m(a)}).reduce(function(a,b){return(a[b.params.siteId]=a[b.params.siteId]||[]).push(b),a},{});c=d.concat(Object.keys(k).reduce(function(a,c){var d,e;return d=k[c],e=10,d.map(function(a,b){return b%e==0?d.slice(b,b+e):null}).filter(function(a){return a}).forEach(function(c){var d=C.combineSlotUrlParams(c.map(function(a){return C.createSlotParams(a,b)}));a.push({method:"GET",url:x,data:C.getOrderedParams(d).reduce(function(a,b){var c=d[b];return t.isStr(c)&&""!==c||t.isNumber(c)?"".concat(a).concat(s(b,c),"&"):a},"")+"slots=".concat(c.length,"&rand=").concat(Math.random()),bidRequest:c})}),a},[]))}return c},getOrderedParams:function(a){var b=/^tg_v/,c=/^tg_i/,d=["account_id","site_id","zone_id","size_id","alt_size_ids","p_pos","gdpr","gdpr_consent","us_privacy","rp_schain","tpid_tdid","tpid_liveintent.com","tg_v.LIseg","dt.id","dt.keyv","dt.pref","rf","p_geo.latitude","p_geo.longitude","kw"].concat(Object.keys(a).filter(function(a){return b.test(a)})).concat(Object.keys(a).filter(function(a){return c.test(a)})).concat(["tk_flint","x_source.tid","x_source.pchain","p_screen_res","rp_floor","rp_secure","tk_user_key"]);return d.concat(Object.keys(a).filter(function(a){return-1===d.indexOf(a)}))},combineSlotUrlParams:function(a){if(1===a.length)return a[0];var b=a.reduce(function(b,c,d){return Object.keys(c).forEach(function(e){b.hasOwnProperty(e)||(b[e]=new Array(a.length)),b[e].splice(d,1,c[e])}),b},{}),c=new RegExp("^([^;]*)(;\\1)+$");return Object.keys(b).forEach(function(a){var d=b[a].join(";"),e=d.match(c);b[a]=e?e[1]:d}),b},createSlotParams:function(a,b){a.startTime=(new Date).getTime();var c=a.params,f=j(a,"banner"),k=d(c.latLong||[],2),l=k[0],m=k[1],n=v.b.getConfig("rubicon.int_type"),o={account_id:c.accountId,site_id:c.siteId,zone_id:c.zoneId,size_id:f[0],alt_size_ids:f.slice(1).join(",")||void 0,rp_floor:.01<(c.floor=parseFloat(c.floor))?c.floor:.01,rp_secure:"1",tk_flint:"".concat(n||"pbjs_lite","_v3.19.0"),"x_source.tid":a.transactionId,"x_source.pchain":c.pchain,p_screen_res:[window.screen.width,window.screen.height].join("x"),tk_user_key:c.userId,"p_geo.latitude":isNaN(parseFloat(l))?void 0:parseFloat(l).toFixed(4),"p_geo.longitude":isNaN(parseFloat(m))?void 0:parseFloat(m).toFixed(4),"tg_fl.eid":a.code,rf:i(a,b)};if("function"==typeof a.getFloor&&!v.b.getConfig("rubicon.disableFloors")){var p=a.getFloor({currency:"USD",mediaType:"banner",size:"*"});o.rp_hard_floor="object"!==g(p)||"USD"!==p.currency||isNaN(parseInt(p.floor))?void 0:p.floor}o.p_pos="atf"===c.position||"btf"===c.position?c.position:"",a.userId&&(a.userId.tdid&&(o.tpid_tdid=a.userId.tdid),a.userId.lipb&&a.userId.lipb.lipbid&&(o["tpid_liveintent.com"]=a.userId.lipb.lipbid,Array.isArray(a.userId.lipb.segments)&&a.userId.lipb.segments.length&&(o["tg_v.LIseg"]=a.userId.lipb.segments.join(","))),a.userId.idl_env&&(o["tpid_liveramp.com"]=a.userId.idl_env)),b.gdprConsent&&("boolean"==typeof b.gdprConsent.gdprApplies&&(o.gdpr=Number(b.gdprConsent.gdprApplies)),o.gdpr_consent=b.gdprConsent.consentString),b.uspConsent&&(o.us_privacy=encodeURIComponent(b.uspConsent));var q=e({},c.visitor,v.b.getConfig("fpd.user"));Object.keys(q).forEach(function(a){null!=q[a]&&"keywords"!==a&&(o["tg_v.".concat(a)]="object"!==g(q[a])||Array.isArray(q[a])?q[a].toString():JSON.stringify(q[a]))});var s=e({},c.inventory,v.b.getConfig("fpd.context"));Object.keys(s).forEach(function(a){null!=s[a]&&"keywords"!==a&&(o["tg_i.".concat(a)]="object"!==g(s[a])||Array.isArray(s[a])?s[a].toString():JSON.stringify(s[a]))});var u=(c.keywords||[]).concat(t.deepAccess(v.b.getConfig("fpd.user"),"keywords")||[],t.deepAccess(v.b.getConfig("fpd.context"),"keywords")||[]);o.kw=Array.isArray(u)&&u.length?u.join(","):"";var w=t.deepAccess(a,"fpd.context.pbAdSlot");"string"==typeof w&&w&&(o["tg_i.dfp_ad_unit_code"]=w.replace(/^\/+/,""));var x=h(a,"FASTLANE");return e(o,x),!0===v.b.getConfig("coppa")&&(o.coppa=1),a.schain&&r(a.schain)&&(o.rp_schain=C.serializeSupplyChain(a.schain)),o},serializeSupplyChain:function(a){if(!r(a))return"";var b=a.ver,c=a.complete,d=a.nodes;return"".concat(b,",").concat(c,"!").concat(C.serializeSupplyChainNodes(d))},serializeSupplyChainNodes:function(a){var b=["asi","sid","hp","rid","name","domain"];return a.map(function(a){return b.map(function(b){return encodeURIComponent(a[b]||"")}).join(",")}).join("!")},interpretResponse:function(a,b){var c=b.bidRequest;if(!(a=a.body)||"object"!==g(a))return[];if(a.seatbid){var e=t.deepAccess(a,"ext.errors.rubicon");Array.isArray(e)&&0<e.length&&t.logWarn("Rubicon: Error in video response");var f=[];return a.seatbid.forEach(function(b){(b.bid||[]).forEach(function(d){var e={requestId:c.bidId,currency:a.cur||"USD",creativeId:d.crid,cpm:d.price||0,bidderCode:b.seat,ttl:300,netRevenue:!1!==v.b.getConfig("rubicon.netRevenue"),width:d.w||t.deepAccess(c,"mediaTypes.video.w")||t.deepAccess(c,"params.video.playerWidth"),height:d.h||t.deepAccess(c,"mediaTypes.video.h")||t.deepAccess(c,"params.video.playerHeight")};d.id&&(e.seatBidId=d.id),d.dealid&&(e.dealId=d.dealid);var h=t.deepAccess(a,"ext.responsetimemillis.rubicon");if(c&&h&&(c.serverResponseTimeMs=h),t.deepAccess(d,"ext.prebid.type")===w.d){e.mediaType=w.d;var i=t.deepAccess(d,"ext.prebid.targeting");i&&"object"===g(i)&&(e.adserverTargeting=i),d.ext.prebid.cache&&"object"===g(d.ext.prebid.cache.vastXml)&&d.ext.prebid.cache.vastXml.cacheId&&d.ext.prebid.cache.vastXml.url?(e.videoCacheKey=d.ext.prebid.cache.vastXml.cacheId,e.vastUrl=d.ext.prebid.cache.vastXml.url):i&&i.hb_uuid&&i.hb_cache_host&&i.hb_cache_path&&(e.videoCacheKey=i.hb_uuid,e.vastUrl="https://".concat(i.hb_cache_host).concat(i.hb_cache_path,"?uuid=").concat(i.hb_uuid)),d.adm&&(e.vastXml=d.adm),d.nurl&&(e.vastUrl=d.nurl),!e.vastUrl&&d.nurl&&(e.vastUrl=d.nurl)}else t.logWarn("Rubicon: video response received non-video media type");f.push(e)})}),f}var h=a.ads;return"object"!==g(c)||Array.isArray(c)||"video"!==m(c)||"object"!==g(h)||(h=h[c.adUnitCode]),!Array.isArray(h)||h.length<1?[]:h.reduce(function(b,e,f){if("ok"!==e.status)return b;var h,i,j=Array.isArray(c)?c[f]:c;if(j&&"object"===g(j)){var k={requestId:j.bidId,currency:"USD",creativeId:e.creative_id||"".concat(e.network||"","-").concat(e.advertiser||""),cpm:e.cpm||0,dealId:e.deal,ttl:300,netRevenue:!1!==v.b.getConfig("rubicon.netRevenue"),rubicon:{advertiserId:e.advertiser,networkId:e.network},meta:{advertiserId:e.advertiser,networkId:e.network}};if(e.creative_type&&(k.mediaType=e.creative_type),e.creative_type===w.d)k.width=j.params.video.playerWidth,k.height=j.params.video.playerHeight,k.vastUrl=e.creative_depot_url,k.impression_id=e.impression_id,k.videoCacheKey=e.impression_id;else{k.ad=(h=e.script,i=e.impression_id,"<html>\n<head><script type='text/javascript'>inDapIF=true;</script></head>\n<body style='margin : 0; padding: 0;'>\n<!-- Rubicon Project Ad Tag -->\n<div data-rp-impression-id='".concat(i,"'>\n<script type='text/javascript'>").concat(h,"</script>\n</div>\n</body>\n</html>"));var l=d(B[e.size_id].split("x").map(function(a){return Number(a)}),2);k.width=l[0],k.height=l[1]}k.rubiconTargeting=(Array.isArray(e.targeting)?e.targeting:[]).reduce(function(a,b){return a[b.key]=b.values[0],a},{rpfl_elemid:j.adUnitCode}),b.push(k)}else t.logError("Rubicon: bidRequest undefined at index position:".concat(f),c,a);return b},[]).sort(function(a,b){return(b.cpm||0)-(a.cpm||0)})},getUserSyncs:function(a,b,c,d){if(!D&&a.iframeEnabled){var e="";return c&&"string"==typeof c.consentString&&(e+="boolean"==typeof c.gdprApplies?"?gdpr=".concat(Number(c.gdprApplies),"&gdpr_consent=").concat(c.consentString):"?gdpr_consent=".concat(c.consentString)),d&&(e+="".concat(e?"&":"?","us_privacy=").concat(encodeURIComponent(d))),D=!0,{type:"iframe",url:z+e}}},transformBidParams:function(a){return t.convertTypes({accountId:"number",siteId:"number",zoneId:"number"},a)}},D=!1;Object(u.registerBidder)(C)}},[648]),pbjsChunk([87],{698:function(a,b,c){a.exports=c(699)},699:function(a,b,c){"use strict";Object.defineProperty(b,"__esModule",{value:!0}),c.d(b,"spec",function(){return g});var d=c(0),e=c(1),f=c(2),g={code:"sovrn",supportedMediaTypes:[f.b],isBidRequestValid:function(a){return!(!a.params.tagid||isNaN(parseFloat(a.params.tagid))||!isFinite(a.params.tagid))},buildRequests:function(a,b){try{var c,e,f,g=[];d._each(a,function(a){if(!f){var b=d.deepAccess(a,"userId.digitrustid.data");!b||b.privacy&&b.privacy.optout||(f={id:b.id,keyv:b.keyv})}a.schain&&(e=e||a.schain),c=c||d.getBidIdParameter("iv",a.params);var h=a.mediaTypes&&a.mediaTypes.banner&&a.mediaTypes.banner.sizes||a.sizes,i=(h=(h=d.isArray(h)&&d.isArray(h[0])?h:[h]).filter(function(a){return d.isArray(a)})).map(function(a){return{w:parseInt(a[0],10),h:parseInt(a[1],10)}});g.push({id:a.bidId,banner:{format:i,w:1,h:1},tagid:String(d.getBidIdParameter("tagid",a.params)),bidfloor:d.getBidIdParameter("bidfloor",a.params)})});var h=b.refererInfo.referer,i=d.parseUrl(h).hostname,j={id:d.getUniqueIdentifierStr(),imp:g,site:{page:h,domain:i}};e&&(j.source={ext:{schain:e}}),b.gdprConsent&&(d.deepSetValue(j,"regs.ext.gdpr",+b.gdprConsent.gdprApplies),d.deepSetValue(j,"user.ext.consent",b.gdprConsent.consentString)),b.uspConsent&&d.deepSetValue(j,"regs.ext.us_privacy",b.uspConsent),f&&d.deepSetValue(j,"user.ext.digitrust",{id:f.id,keyv:f.keyv});var k="https://ap.lijit.com/rtb/bid?src=prebid_prebid_3.19.0";return c&&(k+="&iv=".concat(c)),{method:"POST",url:k,data:JSON.stringify(j),options:{contentType:"text/plain"}}}catch(a){d.logError("Could not build bidrequest, error deatils:",a)}},interpretResponse:function(a){var b=a.body,c=b.id,e=b.seatbid;try{var g=[];return c&&e&&0<e.length&&e[0].bid&&0<e[0].bid.length&&e[0].bid.map(function(a){g.push({requestId:a.impid,cpm:parseFloat(a.price),width:parseInt(a.w),height:parseInt(a.h),creativeId:a.crid||a.id,dealId:a.dealid||null,currency:"USD",netRevenue:!0,mediaType:f.b,ad:decodeURIComponent("".concat(a.adm,'<img src="').concat(a.nurl,'">')),ttl:60})}),g}catch(a){d.logError("Could not intrepret bidresponse, error deatils:",a)}},getUserSyncs:function(a,b,c,e){try{var f=[];if(b&&0!==b.length){if(a.iframeEnabled){var g=b.filter(function(a){return d.deepAccess(a,"body.ext.iid")}).map(function(a){return a.body.ext.iid}),h=[];c&&c.gdprApplies&&"string"==typeof c.consentString&&h.push(["gdpr_consent",c.consentString]),e&&h.push(["us_privacy",e]),g[0]&&(h.push(["informer",g[0]]),f.push({type:"iframe",url:"https://ap.lijit.com/beacon?"+h.map(function(a){return a.join("=")}).join("&")}))}a.pixelEnabled&&b.filter(function(a){return d.deepAccess(a,"body.ext.sync.pixels");
}).reduce(function(a,b){return a.concat(b.body.ext.sync.pixels)},[]).map(function(a){return a.url}).forEach(function(a){return f.push({type:"image",url:a})})}return f}catch(a){return[]}}};Object(e.registerBidder)(g)}},[698]),pbjs.processQueue(),Namespace("Imgur.History"),Imgur.History=Class.extend({init:function(a){this._=$.extend({popStates:{}},a),this.onPopState()},onPopState:function(){var a=this;window.onpopstate=function(b){try{a._.popStates[b.state].call(this,b)}catch(c){}}},addPopState:function(a,b){this._.popStates[a]=b},removePopState:function(a){delete this._.popStates[a]},addWindowState:function(a,b,c){if(window.history.replaceState){window.history.state||window.history.replaceState(a,"initial",window.location.href);var d={state:window.history.state,title:document.title,url:window.location.href},e={state:a,title:b,url:c};window.history.pushState(a,b,c);var f=$.Event("pushstate");f.previousState=d,f.currentState=e,$(window).trigger(f)}}}),Class.addSingleton(Imgur.History),Namespace("Imgur.InfiniteScroll"),Imgur.InfiniteScroll=Class.extend({init:function(a){this._=$.extend(!0,{speed:200,height:300,cont:!0,calcRight:!0},a)},levelReached:function(){var a=Math.max(document.body.scrollHeight||document.body.offsetHeight),b=window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight||0,c=window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop||0;return this._.calcRight||(a-=$("#content").children(".right").height()),!(a<=0)&&a-b-c<this._.height},stopInfiniteScroll:function(){this._.cont=!1},continueInfiniteScroll:function(){this._.cont=!0},infiniteScroll:function(a){this.levelReached()?this._.cont&&a.call():this._.cont&&this.pollLevel(a)},pollLevel:function(a){var b=this;setTimeout(function(){b.infiniteScroll(a)},this._.speed)}}),Class.addSingleton(Imgur.InfiniteScroll),Namespace("Imgur.Utilities.ColorboxConfirm"),Imgur.Utilities.ColorboxConfirm=Class.extend({init:function(a){this._=$.extend(!0,{el:{$confirmation:$(".colorbox-confirm"),$noConfirm:$(".colorbox-no-confirm"),confirmed:"colorbox-confirmed"}},a),this.setupHandlers()},setupHandlers:function(){this._.el.$confirmation.unbind("click"),this._.el.$noConfirm.unbind("click");var a=this;this._.el.$confirmation.click(function(){$("."+a._.el.confirmed).val(!0),$.colorbox.close()}),this._.el.$noConfirm.click(function(){$.colorbox.close()})},show:function(a,b){var c=this;$.colorbox({href:$(a),open:!0,inline:!0,top:"15%",transition:"none",scrolling:!1,onComplete:function(){c.onComplete(a)},onClosed:function(){c.onClose(a,b)}})},onComplete:function(a){window.getSelection?window.getSelection().removeAllRanges():document.selection&&document.selection.empty();var b=$(a).children("."+this._.el.confirmed);b.length||(b=$("<input/>",{type:"hidden","class":this._.el.confirmed}),$(a).append(b)),b.val(!1)},onClose:function(a,b){var c=$(a).children("."+this._.el.confirmed);"false"!==c.val()&&b.call()}}),Class.addSingleton(Imgur.Utilities.ColorboxConfirm),Namespace("Imgur.Util"),Imgur.Util.Base64={PADCHAR:"=",ALPHA:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",getbyte64:function(a,b){var c=Imgur.Util.Base64.ALPHA.indexOf(a.charAt(b));if(c==-1)throw"Cannot decode base64";return c},getbyte:function(a,b){var c=a.charCodeAt(b);if(c>255)throw"INVALID_CHARACTER_ERR: DOM Exception 5";return c},encode:function(a){if(1!=arguments.length)throw"SyntaxError: Not enough arguments";var b,c,d=Imgur.Util.Base64.PADCHAR,e=Imgur.Util.Base64.ALPHA,f=Imgur.Util.Base64.getbyte,g=[];a=""+a;var h=a.length-a.length%3;if(0==a.length)return a;for(b=0;b<h;b+=3)c=f(a,b)<<16|f(a,b+1)<<8|f(a,b+2),g.push(e.charAt(c>>18)),g.push(e.charAt(c>>12&63)),g.push(e.charAt(c>>6&63)),g.push(e.charAt(63&c));switch(a.length-h){case 1:c=f(a,b)<<16,g.push(e.charAt(c>>18)+e.charAt(c>>12&63)+d+d);break;case 2:c=f(a,b)<<16|f(a,b+1)<<8,g.push(e.charAt(c>>18)+e.charAt(c>>12&63)+e.charAt(c>>6&63)+d)}return g.join("")},decode:function(a){a=""+a;var b,c,d,e=Imgur.Util.Base64.getbyte64,f=a.length;if(0==f)return a;if(f%4!=0)throw"Cannot decode base64";b=0,a.charAt(f-1)==Imgur.Util.Base64.PADCHAR&&(b=1,a.charAt(f-2)==Imgur.Util.Base64.PADCHAR&&(b=2),f-=4);var g=[];for(c=0;c<f;c+=4)d=e(a,c)<<18|e(a,c+1)<<12|e(a,c+2)<<6|e(a,c+3),g.push(String.fromCharCode(d>>16,d>>8&255,255&d));switch(b){case 1:d=e(a,c)<<18|e(a,c+1)<<12|e(a,c+2)<<6,g.push(String.fromCharCode(d>>16,d>>8&255));break;case 2:d=e(a,c)<<18|e(a,c+1)<<12,g.push(String.fromCharCode(d>>16))}return g.join("")}},Namespace("Imgur.Utilities.Embed"),Imgur.Utilities.Embed={elColorboxEmbed:function(){return{id:"#embed-post",form:$("#new-embed-post"),checkbox:$("#data-context"),embedCodeInput:$("#new-embed-post #embedcode"),clipboardLink:$("#new-embed-post #embed-clipboard-link"),clipboardContainer:$("#new-embed-post .clipboard-container"),preview:$("#embed-preview"),oldEmbed:$("#old-embed-view")}},elEmbedAlbumForm:function(){return{id:"#embed-album-form",form:$("#embed-album-form"),embedCodeInput:$("#embed-album-form #embedcode"),embedCodePreview:$("#embed-album-form #embedcodePreview a"),clipboardContainer:$("#embed-album-form .clipboard-container"),newEmbed:$("#new-embed-view"),hashRegex:new RegExp("/a/(.*?)/")}},embedModal:function(){Imgur.Utilities.Embed.setupEmbedImage.call(this),this._.el.colorboxEmbed.form.removeClass("nodisplay"),this._.el.embedAlbumForm.form.addClass("nodisplay"),this._.el.colorboxEmbed.oldEmbed.addClass("nodisplay"),this._.el.colorboxEmbed.checkbox.change(_.partial(Imgur.Utilities.Embed.onEmbedCheckboxClick,this)),$.colorbox({href:this._.el.colorboxEmbed.id,open:!0,width:"580px",inline:!0,top:"15%",className:"embed-post-colorbox",transition:"none",scrolling:!1,onComplete:_.bind(Imgur.Utilities.Embed.bindEmbedImage,this)})},getPostMetadata:function(){var a={event:"openEmbedModal"};if(this.imgurInsideNav){var b=this.imgurInsideNav.getHash();if(b){var c=this.imgurInsideNav._.sideGallery.getImage(b);return c||(c=this._.image),this._.album=c.is_album?c:{},Imgur.Util.jafoLog(_.extend(a,{meta:{inGallery:!!_.isNumber(c.comment_count),hash:b,isAlbum:!!c.is_album,nsfw:!!c.nsfw,control:"postOptions"}})),{id:(c.is_album?"a/":"")+b,title:c.is_album?c.title:c.description}}}return Imgur.Util.jafoLog(_.extend(a,{meta:{inGallery:!1,hash:this._.album.id||this._.id,isAlbum:!0,nsfw:!1,control:"albumOptions"}})),{id:"a/"+(this._.album.id||this._.id),title:this._.album.title}},getSnippet:function(a,b,c,d){var e=Imgur.Environment.host,f=("imgur.com"===e?"s.imgur.com/min":e+"/include/minified")+"/embed.js",g=c===!1?' data-context="'+c+'"':"",h=d?"":' data-analytics="false"';return'<blockquote class="imgur-embed-pub" lang="en" data-id="'+a+'"'+g+h+'><a href="//'+e+"/"+a+'">'+_.escape(b)+'</a></blockquote><script async src="//'+f+'" charset="utf-8"></script>'},bindEmbedImage:function(a){this._.album=this._.album||{};var b=Imgur.Utilities.Embed.getPostMetadata.call(this);b.title||(b.title="View post on imgur.com");var c=Imgur.Utilities.Embed.getSnippet(b.id,b.title,a,!0);if(this._.el.colorboxEmbed.preview.html(Imgur.Utilities.Embed.getSnippet(b.id,b.title,a,!1)),this._.el.colorboxEmbed.embedCodeInput.val(c),flashElement(this._.el.colorboxEmbed.embedCodeInput),Imgur.Utilities.Embed.initEmbedClipboard.call(this,this._.el.colorboxEmbed.clipboardContainer),!this._.vars.newEmbedAlbumFormLoaded){this._.el.colorboxEmbed.embedCodeInput.focus(),_.defer(_.bind(this._.el.colorboxEmbed.embedCodeInput.selectAll,this));try{this._.vars.embedClipboard.glue("new-embedcode-clipboard","new-embedcode-container"),this._.vars.embedClipboard.addEventListener("onMouseUp",_.bind(function(){this._.vars.embedClipboard.setText(this._.el.colorboxEmbed.embedCodeInput.val())},this)),this._.vars.newEmbedAlbumFormLoaded=!0}catch(d){}}$.colorbox.resize()},viewOldEmbed:function(){var a;if(this._.el.colorboxEmbed.form.addClass("nodisplay"),this._.el.embedAlbumForm.form.removeClass("nodisplay"),a="/gallery"===this._.baseURL?this.imgurInsideNav.getHash():this._.album.id||this._.id,Imgur.Utilities.Embed.setEmbedUrl.call(this,"//"+this._.host+"/a/"+a+"/embed"),this._.el.embedAlbumForm.newEmbed.click(_.bind(function(){this._.el.colorboxEmbed.form.removeClass("nodisplay"),this._.el.embedAlbumForm.form.addClass("nodisplay"),Imgur.Utilities.Embed.initEmbedClipboard.call(this,this._.el.colorboxEmbed.clipboardContainer),$.colorbox.resize()},this)),Imgur.Utilities.Embed.initEmbedClipboard.call(this,this._.el.embedAlbumForm.clipboardContainer),flashElement(this._.el.embedAlbumForm.embedCodeInput),Imgur.Util.jafoLog({event:"oldEmbed",meta:{hash:this._.id}}),Imgur.Utilities.Embed.setEmbedCode.call(this),!this._.vars.embedAlbumFormLoaded){this._.el.embedAlbumForm.embedCodeInput.focus(),setTimeout(_.bind(function(){this._.el.embedAlbumForm.embedCodeInput.selectAll()},this),10);try{this._.vars.embedClipboard.glue("embedcode-clipboard","embedcode-container"),this._.vars.embedClipboard.addEventListener("onMouseUp",_.bind(function(){this._.vars.embedClipboard.setText(this._.el.embedAlbumForm.embedCodeInput.val())},this)),this._.vars.embedAlbumFormLoaded=!0}catch(b){}}$.colorbox.resize()},setupEmbedImage:function(){var a=window.addEventListener?"addEventListener":"attachEvent",b=window[a],c="attachEvent"==a?"onmessage":"message";b(c,_.bind(function(a){if(!/^(http(s)?:){0,1}\/\/([a-z]{1,9}\.)*?(imgur(-dev)?.com)/.exec(a.origin))return a;try{var b=JSON.parse(a.data)}catch(c){return a}"resize_imgur"===b.message&&(this._.album.id&&(this._.el.colorboxEmbed.oldEmbed.removeClass("nodisplay"),this._.el.colorboxEmbed.oldEmbed.click(_.bind(Imgur.Utilities.Embed.viewOldEmbed,this))),this._.el.colorboxEmbed.preview.css("height",b.height+"px"),$(".imgur-embed-iframe-pub").height=b.height+"px",0===$(".cboxIframe").length&&$.colorbox.resize())},this),!1)},onEmbedCheckboxClick:function(a){$(this).is(":checked")?Imgur.Utilities.Embed.bindEmbedImage.call(a,!1):Imgur.Utilities.Embed.bindEmbedImage.call(a)},initEmbed:function(){Imgur.Utilities.Embed.setupEmbedCss.call(this),this._.el.layout.global.thumbsCarouselContainer.length&&this.initThumbsCarousel(),this.initMainCarousel(),Imgur.Utilities.Embed.setupEmbedScreen.call(this),$(window).resize(_.bind(function(){Imgur.Utilities.Embed.setupEmbedCss.call(this),Imgur.Utilities.Embed.setupEmbedScreen.call(this)},this))},setupEmbedCss:function(){$("head").append("<style>.main-carousel ul li { width: "+$(".embed").parent().width()+"px; }</style>"),this._.vars.bodyHeight=$(".embed").parent().height();var a=Imgur.Util.getQueryParams(window.location.search),b=$(_.templates["album.embedStyles"]({background:a.background,text:a.text,link:a.link}));this.chooseLogoColor(a.background)&&this._.el.layout.embed.offsite.addClass("light"),b.appendTo("head")},setupEmbedScreen:function(){var a=$(".embed").parent().width(),b=$(".embed").parent().height(),c=1,d=!0;this._.el.layout.global.thumbsCarouselContainer.length?c+=this._.el.layout.global.thumbsCarousel.height()+18:(d=!1,this._.el.layout.global.description.css("maxHeight",121)),this._.el.layout.global.title.is(":visible")&&(c+=$("#title").height()+10),this._.el.layout.global.container.css({lineHeight:b-c+"px",height:this._.vars.bodyHeight-c}),$(".embed #thumbs-top").css({width:Math.min(79*this._.images.count,a-65)}),$(".embed .thumbs-carousel").css({width:Math.min(79*this._.images.count+45,a-20)});var e=$(".embed .image").height();this._.el.layout.global.description.css({top:e-(d?48:Math.min(121,this._.el.layout.global.description.innerHeight()))})},setEmbedUrlAlbumId:function(a){Imgur.Utilities.Embed.setEmbedUrl.call(this,this._.embedUrl.replace(this._.el.embedAlbumForm.hashRegex,"/a/"+a+"/"))},setEmbedUrl:function(a){this._.embedUrl=a},setEmbedCode:function(){this._.el.embedAlbumForm.embedCodeInput.val('<iframe class="imgur-album" width="100%" height="550" frameborder="0" src="'+this._.embedUrl+'"></iframe>'),this._.el.embedAlbumForm.embedCodePreview.attr("href",this._.embedUrl)},clipboardClick:function(a){flashElement($(a).siblings("input")),$(a).attr("title","copied"),$(a).tipsy("show"),$(a).attr("original-title","copy")},initEmbedClipboard:function(a){this._.vars.embedClipboard=new ZeroClipboard.Client,this._.vars.embedClipboard.addEventListener("onMouseUp",_.partial(Imgur.Utilities.Embed.clipboardClick,a)),a.tipsy({gravity:"e",opacity:1,html:!0})}};var rawUtils={dive:function(a,b){var c=(""+b).replace(/^\./,"").split("."),d=c.length>0?c.shift():null;if(d&&a&&"undefined"!=typeof a[d])return 0===c.length?a[d]:rawUtils.dive(a[d],c.join("."))},get_keys:function(a){if("object"==typeof a)return Object.keys(a)},get_scroll_position:function(){return{top:void 0!==window.pageYOffset?window.pageYOffset:(document.documentElement||document.body.parentNode||document.body).scrollTop,left:void 0!==window.pageXOffset?window.pageXOffset:(document.documentElement||document.body.parentNode||document.body).scrollLeft}},get_values:function(a){if("object"==typeof a)return Object.keys(a).map(function(b){return a[b]})},is_array:function(a,b){return!(!this.is_obj(a)||"[object Array]"!==Object.prototype.toString.call(a))&&("boolean"==typeof b?!b||a.length>0:!(!isNaN(b)&&b>-1)||a.length>=parseInt(b,10))},is_obj:function(a,b){if("object"==typeof a&&null!==a){if(b){for(var c in a)if(a.hasOwnProperty(c))return!0;return!1}return!0}return!1},merge:function(){var a,b,c={};for(a=0;a<arguments.length;a++)if(rawUtils.is_obj(arguments[a],!0))for(b in arguments[a])arguments[a].hasOwnProperty(b)&&(c[b]=arguments[a][b]);return c}};Namespace("ImgurIface"),ImgurIface.NextImageReceiver=new Iface(["handleSelectEvent"]),Namespace("Imgur.Album"),Imgur.Album=Class.extend({init:function(a){a=a||{},this._=$.extend(!0,{id:null,album:null,images:null,cover:null,layout:null,cdnUrl:null,preloadCount:4,operation:null,mobile:!1,initialImage:!0,ajaxOptions:null,ajaxGetAlbumsURL:"/ajax/albumslist",ajaxParams:{},albumsPerPage:1e3,totalAlbumsCount:0,albumsLimitReached:!1,changingPage:!1,hasAccess:!1,el:{$albumsContainer:$("#album-thumbs"),$albumsScrollLoader:$("#albums-scroll-control"),$loader:$("#albums-loader"),links:{createAlbum:$(".album-create-link")},albumLinkClasses:{nonAuthorChangeSettings:".album-layout-link",changeImages:".album-images-link.unpublished",changeCover:".album-cover-link",deleteAlbum:".album-delete-link",embedAlbum:".album-embed-link",downloadAlbum:".album-download-link",hideAlbum:".album-hide-link"},embedAlbumForm:Imgur.Utilities.Embed.elEmbedAlbumForm(),colorboxEmbed:Imgur.Utilities.Embed.elColorboxEmbed(),createAlbumForm:{id:"#create-album-form",form:$("#create-album-form form"),header:$("#create-album-form h1"),titleInput:$("#album-title"),descriptionInput:$("#album-description"),layoutInput:$("#album-layout input[type=radio]"),loader:$("#create-album-loader"),cover:$("#album-cover"),errorbox:$("#create-album-form .error"),submitButton:$('#create-album-form input[type="submit"]')},changeLayout:{layoutButton:$(".userSessionLayout"),layoutForm:$("#userLayoutForm")},albumImagesForm:{id:"#album-images",form:$("#album-images form"),selectHeader:$("#album-images-select-header"),coverHeader:$("#album-images-cover-header"),menuFirstItemId:"#album-images .mode.start",imagesMenu:$("#images-menu"),mainColumn:$("#main-column")},deleteAlbumForm:{id:"#delete-album-form",yes:$("#delete-album-yes"),no:$("#delete-album-no"),loader:$("#delete-album-form .small-loader")},hideAlbumForm:{id:"#hide-album-form",yes:$("#hide-album-yes"),no:$("#hide-album-no"),loader:$("#hide-album-form .small-loader")},layout:{global:{title:$("#title"),description:$("#description"),container:$("#image-container"),mainImage:null,thumbsCarousel:$("#thumbs-top, #thumbs-bottom"),thumbsCarouselContainer:$(".thumbs-carousel"),thumbsCarouselNext:$(".thumbs-carousel .carousel-button.next"),thumbsCarouselPrev:$(".thumbs-carousel .carousel-button.prev"),thumbsCarouselTop:$("#thumbs-top"),thumbsCarouselBottom:$("#thumbs-bottom"),nextImage:$("#next"),prevImage:$("#prev"),imageHoverIconClass:".image-hover",actionOptionsClass:".action-options",actionOptionsItems:$(".image-hover .options .item")},blog:{leftPanel:$("#content .main"),sidebar:$("#scrollpanel")},embed:{offsite:$("#offsite")}},subdomain:{container:$(".left .panel"),albumClass:".album",editButtonClass:".edit-button",editOptionsClass:".edit-options",editOptionsItemsClass:".options .item"}},layouts:{blog:"b"},operations:{embed:"embed"},messages:{createAlbum:"Create an album",albumSettings:"Change album settings",switchLayout:"Switch album layout",updateSettings:"Album settings have been updated",updateImages:"Album images have been updated",updateCover:"Album cover has been updated",deleteAlbum:"Album has been deleted",hideAlbum:"Album has been hidden",privateGalleryMessage:"This album is in the gallery, please remove it before making it secret.",privateGalleryError:"A gallery album's privacy cannot be set to secret."},vars:{currentImageIndex:0,ajaxURL:"/ajaxalbums/",albumImages:null,interval:null,loadingViewport:!1,bodyHeight:0,thumbsSpeed:400,embedClipboard:null,scrolling:!1,creatingAlbum:!1,scrolledPage:0,bindings:{create:!1,images:!1,del:!1,thumbs:!1,main:!1},currentTheme:"dark",embedAlbumFormLoaded:!1,newEmbedAlbumFormLoaded:!1,needCaptchaToProceed:!1},themes:{dark:{background:"292929",text:"ffffff",link:"4e76c9"},light:{background:"f2f2f2",text:"1a1a1a",link:"4e76c9"},custom:{background:"292929",text:"ffffff",link:"4e76c9"}}},a),this._=$.extend(this._,Imgur.getInstance().getSettings()),this._.el.colorboxEmbed.embedCodeInput.click($(this).selectAll),this._.hasAccess=Imgur.Environment.auth.hasAccess,this.albumsScrollListener=this.albumsScrollListener.bind(this),this._scrollListener=_.throttle(this.albumsScrollListener,50),$(window).on("scroll",this._scrollListener)},albumsScrollListener:function(){this._.el.$albumsScrollLoader.is(":in-viewport")&&this.loadNextPage()},findImageIndex:function(a){for(var b=0;b<this._.images.count;++b)if(this._.images.images[b].hash==a)return b;return 0},getStartingIndex:function(){var a=Imgur.getInstance().getPageHash();return a?isNaN(a)?this.findImageIndex(a):parseInt(a):0},loadImage:function(a){if(a&&a.hasClass("unloaded")){a.attr("src",a.attr("data-src")),a.removeClass("unloaded");var b=new Image;b.src=a.attr("src");b.onload=function(){var a=$(this).attr("src");a.substring(a.lastIndexOf("/")+1,a.lastIndexOf("."))},b.onerror=function(){var b=$(this).attr("src"),c=b.substring(b.lastIndexOf("/")+1,b.lastIndexOf(".")).length;if(8===c||6===c){var d=b.substring(0,b.lastIndexOf(".")-1);d&&(d+=".jpg",this.src=d,$(a).attr("src",d),$(a).parent().hasClass("zoom")&&$(a).parent().attr("href",this.src))}}}},initAlbumImages:function(a,b,c,d){var e=this;null==this._.images?$.getJSON("/ajax/images",{album:this._.id,sort:0,order:1,page:1,perPage:999999},function(f){var g=f.data;e._.images={},e._.images.images=g.images,e._.images.count=g.count,d?"function"==typeof c&&c():e.setupAlbumImages(a,b,c),e._.images=null}):d?"function"==typeof c&&c():e.setupAlbumImages(a,b,c)},setupAlbumImages:function(a,b,c){var d=[];if(a)d[this._.cover]=!0,this._.el.albumImagesForm.coverHeader.show(),this._.el.albumImagesForm.selectHeader.hide();else{for(i=0;i<this._.images.count;++i)d[this._.images.images[i].hash]=!0;this._.el.albumImagesForm.coverHeader.hide(),this._.el.albumImagesForm.selectHeader.show()}var e=this,f=1;(this._.images.count&&this._.images.count>0||this._.images.images&&this._.images.images.length&&this._.images.images.length>0)&&(f=this._.id);var g={host:this._.host,album:this._.id,images:d,cdnUrl:this._.cdnUrl,totalCounter:$("<div/>"),totalCounterSuffix:$("<div/>"),imagesPerPage:64,changeCover:a,mode:f,onSubmitComplete:function(d){$.colorbox.close(),b&&(a?humanMsg.displayMsg(e._.messages.updateCover):humanMsg.displayMsg(e._.messages.updateImages));var f=e;a?$(document).bind("cbox_closed",function(){$(document).unbind("cbox_closed"),f._.cover=d.data[0][0],$("#album-"+e._.id).attr("data-cover",d.data[0][0]+"b.jpg").find(".cover img").attr("src",f._.cdnUrl+"/"+d.data[0][0]+"s.jpg"),f.changeSettings()}):"function"==typeof c?c(d.data):0!=location.pathname&&location.reload()}};this._.vars.albumImages=Imgur.Album.Images.getInstance(),this._.vars.albumImages.init(g)},bindchangeImages:function(){this._.vars.bindings.images=!0,this._.el.albumImagesForm.form.one("submit",function(){return this._.vars.albumImages._.album=this._.id,this._.vars.albumImages.submit(),!1}.bind(this))},bindDeleteAlbum:function(a){this._.vars.bindings.del=!0,this._.el.deleteAlbumForm.no.click(function(){$.colorbox.close()});var b=this;this._.el.deleteAlbumForm.yes.click(function(){b._.el.deleteAlbumForm.yes.disable(),b._.el.deleteAlbumForm.loader.show();var c=b;$.post(c._.vars.ajaxURL+"delete/"+c._.id,{msid:Imgur.Environment.msid},function(b){if(c._.el.deleteAlbumForm.loader.hide(),c._.el.deleteAlbumForm.yes.enable(),$.colorbox.close(),humanMsg.displayMsg(c._.messages.deleteAlbum),"function"==typeof a)a(b);else if("/"==location.pathname&&$("#album-"+c._.id).fadeOut(),"/"!=location.pathname){var d=c;setTimeout(function(){d._.signed?window.location=location.protocol+"//"+Imgur.getInstance()._.auth.url+"."+d._.host:window.location="/"},1e3)}}).error(function(){b._.el.deleteAlbumForm.yes.enable(),b._.el.deleteAlbumForm.loader.hide()})})},bindHideAlbum:function(a){this._.vars.bindings.del=!0,this._.el.hideAlbumForm.no.click(function(){$.colorbox.close()});var b=this;this._.el.hideAlbumForm.yes.click(function(){b._.el.hideAlbumForm.yes.disable(),b._.el.hideAlbumForm.loader.show(),$.post(b._.vars.ajaxURL+"hide/"+b._.id,{msid:Imgur.Environment.msid},function(c){b._.el.hideAlbumForm.loader.hide(),b._.el.hideAlbumForm.yes.enable(),$.colorbox.close(),humanMsg.displayMsg(b._.messages.hideAlbum),"function"==typeof a?a(c):("/"==location.pathname&&$("#album-"+b._.id).fadeOut(),"/"!=location.pathname&&setTimeout(function(){b._.signed?window.location=location.protocol+"//"+Imgur.getInstance()._.auth.url+"."+b._.host:window.location="/"},1e3))}).error(function(){b._.el.hideAlbumForm.yes.enable(),b._.el.hideAlbumForm.loader.hide()})})},bindCreateAlbum:function(a){this._.vars.bindings.create=!0;var b=this;this._.el.createAlbumForm.form.submit(function(){return b.createAlbumSubmitHandler(a),!1}),this._.el.createAlbumForm.form.change(function(a){$(a.target).attr("data-changed","true")})},initCreateAlbum:function(){this._.vars.creatingAlbum=!0,$(this._.el.createAlbumForm.id).addClass("create"),this._.el.createAlbumForm.header.text(this._.messages.createAlbum),this._.el.createAlbumForm.titleInput.val(""),this._.el.createAlbumForm.descriptionInput.val(""),this._.el.createAlbumForm.layoutInput.removeAttr("checked").filter(":first").attr("checked","checked"),this._.el.createAlbumForm.cover.removeAttr("src"),this._.el.createAlbumForm.titleInput.showPlaceholder(),this._.el.createAlbumForm.descriptionInput.showPlaceholder()},initChangeSettings:function(a){var b=this._.id?$("#album-"+this._.id):$(a).parents("[data-privacy]");if(this._.id||(this._.id=$(a).parents("[data-privacy]").attr("id").split("-")[1]),this._.vars.creatingAlbum=!1,b.length){this._.signed?$(this._.el.createAlbumForm.id).removeClass("create"):$(this._.el.createAlbumForm.id).addClass("create"),this._.el.createAlbumForm.titleInput.length>0?this._.el.createAlbumForm.header.text(this._.messages.albumSettings):this._.el.createAlbumForm.header.text(this._.messages.switchLayout),this._.el.createAlbumForm.titleInput.val(b.attr("data-title")),this._.el.createAlbumForm.descriptionInput.val(b.attr("data-description"));var c=b.attr("data-cover");if(c){var d=this._.cdnUrl+"/"+b.attr("data-cover");Imgur.Util.basename(d).indexOf(".")==-1&&(d+="b.jpg"),this._.el.createAlbumForm.cover.attr("src",d)}this._.el.createAlbumForm.titleInput.val()?this._.el.createAlbumForm.titleInput.removeClass("placeholder"):this._.el.createAlbumForm.titleInput.showPlaceholder(),this._.el.createAlbumForm.descriptionInput.val()?this._.el.createAlbumForm.descriptionInput.removeClass("placeholder"):this._.el.createAlbumForm.descriptionInput.showPlaceholder()}},resizeCreateAlbumForm:function(){var a=$(this._.el.createAlbumForm.id);$.colorbox.resize({innerWidth:a.width()+20,innerHeight:a.height()+20})},createAlbumSubmitHandler:function(a){var b=Imgur.Album.getInstance();if(this._.el.createAlbumForm.errorbox.is(":hidden")||(this._.el.createAlbumForm.errorbox.hide(),this.resizeCreateAlbumForm()),this._.el.createAlbumForm.titleInput.length>0&&"album title (optional)"==this._.el.createAlbumForm.titleInput.val().toLowerCase()&&this._.el.createAlbumForm.titleInput.val(""),this._.el.createAlbumForm.descriptionInput.length>0&&"album description (optional)"==this._.el.createAlbumForm.descriptionInput.val().toLowerCase()&&this._.el.createAlbumForm.descriptionInput.val(""),this._.vars.needCaptchaToProceed){var c=b._.el.createAlbumForm.form.serializeObject();return void $.ajax({url:"//"+Imgur.Environment.host+"/clearprotection",method:"POST",data:{"g-recaptcha-response":grecaptcha.getResponse()}}).success(function(c){c.data.error?(humanMsg.displayMsg("Captcha invalid: "+c.data.error),grecaptcha.reset()):(b._.vars.needCaptchaToProceed=!1,b.createAlbumSubmitHandler(a))}).error(function(a){humanMsg.displayMsg("An error occurred when trying to submit the Captcha."),grecaptcha.reset()})}this._.el.createAlbumForm.submitButton.disable(),this._.el.createAlbumForm.loader.show();var d=this._.vars.creatingAlbum?"create":"settings/"+this._.id,c=this._.el.createAlbumForm.form.serialize();if(!(this._.el.createAlbumForm.titleInput.length>0))return window.location=window.location.protocol+"//"+Imgur.Environment.host+"/a/"+this._.id+"/layout/"+this._.el.changeLayout.layoutForm.find(":radio:checked").attr("id"),a?a.stopPropagation():void 0,!1;var b=this;return $.post(this._.vars.ajaxURL+d,c,function(c){if("object"!=typeof c&&(c=$.parseJSON(c)),c=c.data,b._.el.createAlbumForm.submitButton.enable(),b._.el.createAlbumForm.loader.hide(),b._.vars.creatingAlbum)if($.colorbox.close(),"function"==typeof a)a(c);else if("/"==location.pathname){var d=b;$(document).bind("cbox_closed",function(){$(document).unbind("cbox_closed"),d._.id=c.id,d._.images=[],d.changeImages(!1,!1),$(document).bind("cbox_closed",function(){setTimeout(location.reload,1e3)})})}else window.location="/a/"+c.id;else if(c.id){$.colorbox.close(),humanMsg.displayMsg(b._.messages.updateSettings);var e=$("#album-"+c.id);e.attr("data-description",c.description).attr("data-privacy",c.privacy).attr("data-title",c.title),"function"==typeof a?a(c):location.reload()}else{var f="";for(key in errors)""!=f&&(f+="\n"),f+=errors[key];b._.el.createAlbumForm.errorbox.text(f).show(),b.resizeCreateAlbumForm()}}).error(function(a){b._.el.createAlbumForm.submitButton.enable(),b._.el.createAlbumForm.loader.hide(),a=$.parseJSON(a.responseText),a.data.error==b._.messages.privateGalleryError?humanMsg.displayMsg(b._.messages.privateGalleryMessage):403==a.status&&a.data.error?humanMsg.displayMsg(a.data.error,"error-msg"):429==a.status&&(b._.vars.needCaptchaToProceed=!0,b.showAlbumCaptcha(a))}),!1},showAlbumCaptcha:function(a){return"undefined"==typeof grecaptcha?(window.onloadAlbumCaptchaCallback=function(){this.showAlbumCaptcha.apply(this,a)}.bind(this),void $.getScript("https://www.google.com/recaptcha/api.js?render=explicit&onload=onloadAlbumCaptchaCallback",function(){humanMsg.displayMsg(a.data.error.message)}.bind(this))):(grecaptcha.render("albumCreateCaptcha",{sitekey:Imgur.Environment.recaptcha_key,theme:"dark"}),void this.resizeCreateAlbumForm())},openCreateAlbumColorbox:function(a,b){var c=this;$.colorbox({href:this._.el.createAlbumForm.id,open:!0,top:"15%",inline:!0,transition:"none",preloading:!1,scrolling:!1,onComplete:function(){c._.vars.bindings.create||c.bindCreateAlbum(a),c._.el.createAlbumForm.titleInput.focus()},onCleanup:function(){$(".tipsy").remove(),b&&(c._.id=null)}})},carouselItemFirstIn:function(a,b,c){0==a.index()?c.addClass("disabled"):c.removeClass("disabled")},carouselItemLastIn:function(a,b,c){var d=b.jcarousel("items").length;a.index()==d-1?c.addClass("disabled"):c.removeClass("disabled")},shrinkThumbsCarousel:function(){this._.el.layout.global.thumbsCarouselBottom.remove(),this._.el.layout.global.thumbsCarouselContainer.addClass("shrunk")},getThumbsCarouselScroll:function(){var a=this._.operations,b=this._.layouts;if(this._.operation==a.embed){var c=$(".embed").parent().width(),d=82;return Math.floor(c/d/2)}switch(this._.album.album_layout){case b.blog:return 6;case b.horizontal:return 5}return 0},thumbsCarouselScroll:function(a,b){var c=this._.operations,d=this._.layouts;try{if(!this._.operation&&this._.album.album_layout==d.horizontal||this._.operation==c.embed){var e=this.getThumbsCarouselScroll();a>=e&&a<this._.images.count-e?this._.el.layout.global.thumbsCarousel.jcarousel("scroll",a-e,b):a<e?this._.el.layout.global.thumbsCarousel.jcarousel("scroll",0,b):this._.el.layout.global.thumbsCarousel.jcarousel("scroll",this._.images.count-1,b)}}catch(f){}},thumbsCarouselBind:function(){var a=this._.operations,b=this._.layouts,c=this;this._.el.layout.global.thumbsCarouselNext.click(function(){var d=c.getThumbsCarouselScroll();return c._.operation!=a.embed&&c._.album.album_layout==b.blog&&(d/=2),c._.el.layout.global.thumbsCarousel.jcarousel("scroll","+="+d),!1}),this._.el.layout.global.thumbsCarouselPrev.click(function(){var d=c.getThumbsCarouselScroll();return c._.operation!=a.embed&&c._.album.album_layout==b.blog&&(d/=2),c._.el.layout.global.thumbsCarousel.jcarousel("scroll","-="+d),!1}),this._.el.layout.global.thumbsCarousel.find("img").click(function(){var d=parseInt($(this).attr("data-index")),e=c._.images.images[d];!c._.operation&&c._.album.album_layout==b.horizontal||c._.operation==a.embed?c.scrollMainImage(d):c._.album.album_layout==b.blog&&Imgur.getInstance().setPageHash(e.hash)}),$(".thumb-title-embed").tipsy({gravity:"s",opacity:.95,html:!0,live:!0});var d=this._.album.album_layout==b.blog?this.getThumbsCarouselScroll()/2:this.getThumbsCarouselScroll();this._.images.count<=d&&this.shrinkThumbsCarousel()},thumbsCarouselItemVisibleIn:function(a){Imgur.Album.getInstance().loadImage($(this).find("img"))},initThumbsCarousel:function(){var a=this;this._.el.layout.global.thumbsCarousel.find("li").bind("jcarouselitemvisiblein",a.thumbsCarouselItemVisibleIn),this._.el.layout.global.thumbsCarouselTop.find("li").bind("jcarouselitemfirstin",function(b){a.carouselItemFirstIn($(this),a._.el.layout.global.thumbsCarouselTop,a._.el.layout.global.thumbsCarouselPrev)}).bind("jcarouselitemlastin",function(b){a.carouselItemLastIn($(this),a._.el.layout.global.thumbsCarouselTop,a._.el.layout.global.thumbsCarouselNext)}),this._.el.layout.global.thumbsCarousel.jcarousel({animation:this._.vars.thumbsSpeed}),this.thumbsCarouselBind()},getImageSrc:function(a){a>=this._.images.count&&(a=this._.images.count-1),a<0&&(a=0);var b=this._.images.images[a];return this._.cdnUrl+"/"+b.hash+b.ext},scrollMainImage:function(a){if(0!=this._.images.count){a>=this._.images.count&&(a=this._.images.count-1),a<0&&(a=0);var b=(this.getImageSrc(a),this._.images.images[a]);this._.vars.currentImageIndex=a;var c=$("#image-container-inner"),d="";if(this._.operation==this._.operations.embed&&!b.animated){var e=this._.el.layout.global.container.height(),f=this._.el.layout.global.container.width(),g=e>f?e:f;g<=160?d="t":g<=320?d="m":g<=640?d="l":g<=1024&&(d="h")}this._.el.layout.global.mainImage=ReactDOM.render(React.createElement(Imgur.ImageViewer,{item:b,thumbsize:d,discarding_referrer:!this._.initialImage}),c.get(0));var h=$(".jquery-image-zoom");h.length&&h.click(),this.mainCarouselItemVisible(),Imgur.getInstance().setPageHash(a),this._.initialImage=!1}},mainCarouselSetup:function(){var a=this,b=this._.operations;this._.layouts;this._.el.layout.global.description.tipsy({gravity:$.fn.tipsy.autoNS,opacity:.95,offset:-10,html:!0,delayOut:1200,live:!0}),this._.el.layout.global.nextImage.click(function(){return a.scrollMainImage(a._.vars.currentImageIndex+1),$("."+a._.el.layout.global.actionButtonOpenClass).removeClass("opened"),!1}),this._.el.layout.global.prevImage.click(function(){
return a.scrollMainImage(a._.vars.currentImageIndex-1),$("."+a._.el.layout.global.actionButtonOpenClass).removeClass("opened"),!1}),$(document).keydown(function(b){return!!(b.ctrlKey||b.altKey||b.metaKey)||(37==b.keyCode?a.scrollMainImage(a._.vars.currentImageIndex-1):39==b.keyCode&&a.scrollMainImage(a._.vars.currentImageIndex+1),!0)}),this._.operation==b.embed&&0==this._.el.layout.embed.offsite.length&&this._.el.layout.global.container.parent().mousewheel(function(b,c){return c=c?detla:b.originalEvent.wheelDeltaY||b.originalEvent.detail,c>0?a.scrollMainImage(a._.vars.currentImageIndex-1):a.scrollMainImage(a._.vars.currentImageIndex+1),b.preventDefault(),b.stopPropagation(),!1});var c=a.getStartingIndex();"g"==this._.album.album_layout&&isNaN(parseInt(window.location.hash.substr(1)))||a.scrollMainImage(c)},mainCarouselItemVisible:function(){var a=this._.vars.currentImageIndex,b=this._.images.images[a],c=(this._.layouts,b.prefer_video?".gifv":b.ext);if($(".tipsy").remove(),b.title?this._.el.layout.global.title.text(b.title).show():this._.el.layout.global.title.hide(),b.description){var d=Imgur.Util.htmlEntity(b.description);this._.el.layout.global.description.html(Imgur.Util.linkify(d,!0,!0)).show()}else this._.el.layout.global.description.hide();this._.el.layout.global.description.attr("title","").attr("original-title",""),this._.operation==this._.operations.embed?Imgur.Utilities.Embed.setupEmbedScreen.call(this):$(document).height()>this._.vars.bodyHeight&&(this._.vars.bodyHeight=$(document).height(),$("body").css("height",this._.vars.bodyHeight)),this.thumbsCarouselScroll(a,!1),this._.el.layout.global.thumbsCarousel.find("img").removeClass("selected"),$("#thumb-"+b.hash).addClass("selected"),$(this._.el.layout.global.imageHoverIconClass).find(".album-view-link").html('<a href="/a/'+this._.id+'" target="_blank">View album on Imgur</a>'),$(this._.el.layout.global.imageHoverIconClass).find(".album-view-image-link").html('<a href="'+this._.cdnUrl+"/"+b.hash+c+'" target="_blank">View full resolution</a>'),$(this._.el.layout.global.imageHoverIconClass).find(".download").html('<a href="//'+Imgur.Environment.host+"/download/"+b.hash+(b.title?"/"+encodeURIComponent(b.title):"")+'">Download full resolution</a>'),a==this._.images.count-1?this._.el.layout.global.nextImage.addClass("disabled"):this._.el.layout.global.nextImage.removeClass("disabled"),0==a?this._.el.layout.global.prevImage.addClass("disabled"):this._.el.layout.global.prevImage.removeClass("disabled");for(var e=a-1;e<a+this._.preloadCount&&e<=this._.images.count;++e)"undefined"!=typeof this._.images.images[e]&&(this._.images.images[e].animated&&".gif"===this._.images.images[e].ext||$.preloadImages(this.getImageSrc(e)))},initMainCarousel:function(){this.mainCarouselSetup()},chooseLogoColor:function(a){if(a){var b=parseInt(a.substr(0,2),16),c=parseInt(a.substr(2,2),16),d=parseInt(a.substr(4,2),16),e=(299*b+587*c+114*d)/1e3;return e>=128}return!1},albumSortStop:function(){var a=Imgur.Album.getInstance();if(a._.el.subdomain.container.find(a._.el.subdomain.albumClass).length>0){for(var b=a._.el.subdomain.container.sortable("toArray"),c=[],d=0,e=b.length;d<e;++d)c[d]=b[d].substr(b[d].indexOf("-")+1);$.post(a._.vars.ajaxURL+"rearrangeAlbums","order="+c+"&msid="+Imgur.Environment.msid)}},toggleEditButton:function(a){a.toggleClass("opened"),a.siblings(this._.el.subdomain.editOptionsClass).toggle()},editButtonClickHandler:function(a){$("body").unbind("click");var b=Imgur.Album.getInstance();return/album-/.test($(a.target).parent().attr("id"))&&b.setAlbumID($(a.target).parent().attr("id").replace(/album-/,"")),$("body").click(function(a){var c=b;$("body").find(".opened").each(function(){c.toggleEditButton($(this))})}),b.toggleEditButton($(this)),0!=$(a.target).closest(".gallery-submit-link").length||(a.stopPropagation(),a.preventDefault(),!1)},downloadAlbum:function(){var a=Imgur.Album.getInstance();window.location="https://"+Imgur.Environment.host+"/a/"+a._.id+"/zip"},createAlbum:function(a){var b=Imgur.Album.getInstance();b.initCreateAlbum(),b.openCreateAlbumColorbox(a)},changeSettings:function(a,b){var c=Imgur.Album.getInstance(),d=null===this._.id;c.initChangeSettings(b),c.openCreateAlbumColorbox(a,d)},changeImages:function(a,b,c){if(Imgur.Environment.published)return!1;var d=this;$.colorbox({href:this._.el.albumImagesForm.id,open:!0,inline:!0,transition:"none",scrolling:!1,onComplete:function(){d._.vars.bindings.images||d.bindchangeImages(),a?(d._.el.albumImagesForm.imagesMenu.hide(),$.colorbox.resize({innerWidth:d._.el.albumImagesForm.mainColumn.width()+20,innerHeight:d._.el.albumImagesForm.form.height()+20}),d._.el.albumImagesForm.coverHeader.width(d._.el.albumImagesForm.mainColumn.width()+20)):d._.el.albumImagesForm.imagesMenu.show(),d.initAlbumImages(a,b,c)},onCleanup:function(){d._.el.albumImagesForm.form.off("submit"),d._.vars.albumImages.destroy(),d._.vars.albumImages=null}})},deleteAlbum:function(a){var b=Imgur.Album.getInstance();$.colorbox({href:b._.el.deleteAlbumForm.id,open:!0,inline:!0,top:"15%",transition:"none",scrolling:!1,onComplete:function(){b._.vars.bindings.del||b.bindDeleteAlbum(a)}})},hideAlbum:function(a){var b=Imgur.Album.getInstance();$.colorbox({href:b._.el.hideAlbumForm.id,open:!0,inline:!0,top:"15%",transition:"none",scrolling:!1,onComplete:function(){b._.vars.bindings.del||b.bindHideAlbum(a)}})},generalInit:function(){var a=this._.operations;this._.operation===a.embed&&Imgur.Utilities.Embed.initEmbed.call(this),this._.el.links.createAlbum.unbind("click"),this._.el.links.createAlbum.click(this.createAlbum),this._.el.embedAlbumForm.embedCodeInput.click($(this).selectAll),Imgur.Fullscreen&&Imgur.Fullscreen.getInstance()},afterRenderAlbumsBindMethods:function(){var a=this;$(".thumb-title").tipsy({gravity:"n",opacity:.95,offset:-10,html:!0});var b={nonAuthorChangeSettings:$(a._.el.albumLinkClasses.nonAuthorChangeSettings),changeImages:$(a._.el.albumLinkClasses.changeImages),changeCover:$(a._.el.albumLinkClasses.changeCover),deleteAlbum:$(a._.el.albumLinkClasses.deleteAlbum),embedAlbum:$(a._.el.albumLinkClasses.embedAlbum),downloadAlbum:$(a._.el.albumLinkClasses.downloadAlbum),hideAlbum:$(a._.el.albumLinkClasses.hideAlbum),editButton:$(a._.el.subdomain.editButtonClass),editOptionsItems:$(a._.el.subdomain.editOptionsItemsClass)};b.editOptionsItems.unbind("click"),b.editButton.unbind("click"),b.hideAlbum.unbind("click"),b.deleteAlbum.unbind("click"),b.changeImages.unbind("click"),b.changeCover.unbind("click"),b.embedAlbum.unbind("click"),b.downloadAlbum.unbind("click"),b.editOptionsItems.click(function(){var b=$(this).parent().parent().parent().attr("id");a._.id=b.substr(b.indexOf("-")+1)}),b.editButton.click(this.editButtonClickHandler),b.hideAlbum.click(this.hideAlbum),b.deleteAlbum.click(this.deleteAlbum),b.changeImages.click(function(){a.changeImages(!1,!0)}),b.changeCover.click(function(){a.changeImages(!0,!0)}),b.embedAlbum.click(_.bind(Imgur.Utilities.Embed.embedModal,this)),b.downloadAlbum.click(this.downloadAlbum),this._.vars.bodyHeight=$("body").height(),$(".album-images-link.published").tipsy({gravity:"w"})},profileInit:function(){this._.el.subdomain.container.sortable({stop:this.albumSortStop,items:".album"}),this.generalInit()},setAlbumID:function(a){this._.id=a,this._.vars.bindings.images=!1},getHash:function(){return window.location.hash.substring(1)},getInitPage:function(){var a=parseInt(this.getHash());return a<1&&(a=1),a?a:1},handleAlbumsData:function(a){if(null!=a)if(a.albums.length>0){var b=this;$.each(a.albums,function(a,c){b.addAlbumToContainer(c,!0)});var c=a.albums[a.albums.length-1];this._.ajaxParams.fromDate=c.datetime,this._.ajaxParams.fromOrder=c.order,a.albums.length<this._.ajaxParams.perPage&&(this._.albumsLimitReached=!0,$(window).off("scroll",this._scrollListener))}else this._.albumsLimitReached=!0,$(window).off("scroll",this._scrollListener);this._.changingPage=!1,this._.el.$loader.hide(),this.afterRenderAlbumsBindMethods()},loadNextPage:function(){if(this._.changingPage||this._.albumsLimitReached)return!1;var a=this;return this._.changingPage=!0,this._.el.$loader.show(),this._.ajaxParams.perPage=this._.albumsPerPage,this._.ajax=$.getJSON(this._.ajaxGetAlbumsURL,this._.ajaxParams,function(b){b.success&&a.handleAlbumsData(b.data)}).fail(function(b,c){a.handleAlbumsData(null)}),!0},setTotalAlbumsCount:function(a,b){this._.totalAlbumsCount=a,this._.albumsPerPage=b||this._.albumsPerPage},addAlbumToContainer:function(a,b){a.views=a.views||0,a.num_images=a.num_images||0;var c=["album"];this._.hasAccess&&(c.push("access"),1==a.privacy?c.push("hidden"):2==a.privacy&&c.push("secret")),a.title=Imgur.Util.htmlEntity(a.title),a.description=Imgur.Util.htmlEntity(a.description);var d,e='<div id="album-'+a.id+'" data-title="'+a.title+'" data-cover="'+a.cover+'" data-layout="'+a.layout+'" data-privacy="'+a.privacy+'"  data-description="'+a.description+'" class="album '+c.join(" ")+'">';d=0==a.num_images?Imgur.Environment.staticUrl+"/images/"+a.thumb:Imgur.Environment.cdnUrl+"/"+a.thumb;var f='<div class="cover"><a href="//'+this._.host+"/a/"+a.id+'"><img src="'+d+'" alt="'+a.title+'" /></a>';this._.hasAccess&&(f+='<div class="privacy-dot-container options">',f+=1==a.privacy?'<span class="privacy-dot orange title item album-settings-link" title="Privacy: Hidden"></span>':2==a.privacy?'<span class="privacy-dot red title item album-settings-link" title="Privacy: Secret"></span>':'<span class="privacy-dot green title item album-settings-link" title="Privacy: Public"></span>',f+="</div>"),f+="</div>";var g='<div class="info">';g+=a.title?a.title:"untitled",g+="</div>";var h='<div class="metadata">'+a.num_images+" "+Imgur.Util.pluralize(a.num_images,"image")+'&middot;<span title="'+moment(a.datetime).format("dddd, MMMM D, YYYY a\t HH:mm")+' GMT">'+moment(a.datetime).format("MMM D, YYYY")+"</span> &middot; "+Imgur.Util.numberFormat(a.views)+" "+Imgur.Util.pluralize(a.views,"view")+"</div>",i="";this._.hasAccess&&(i+='<div class="edit-button combobox left" title="edit this album"><div class="options"><div class="item album-images-link '+(a.in_gallery?"published":"unpublished")+'" '+(a.in_gallery?'title="Please remove this album from the gallery to change its images"':"")+'>Change images</div><div class="item album-embed-link">Embed album</div><div class="item album-download-link">Download album</div><div class="item album-delete-link">Delete album</div></div></div>',i+='<div class="move-icon" title="rearrange album"></div>'),e+=f+g+h+i,e+="</div>";var j=$(e);return b?j.appendTo(this._.el.$albumsContainer):j.prependTo(this._.el.$albumsContainer),!0}}),Class.addSingleton(Imgur.Album),Namespace("Imgur.Elements.Tag.View"),Imgur.Elements.Tag.View=React.createClass({displayName:"TagView",getDefaultProps:function(){return{redirectTo:"",redirectAnalytics:function(){},classNames:""}},getBackgroundImage:function(){return this.props.tag?this.props.tag.background?this.props.tag.background:this.props.tag.background_hash?Imgur.Environment.cdnUrl+"/"+this.props.tag.background_hash+"_d.png?maxwidth=200&fidelity=grand":"":""},handleTagClick:function(a){this.props.redirectAnalytics(),this.props.redirectTo||this.removeTag(a)},removeTag:function(a){a.preventDefault(),a.stopPropagation(),this.props.allowRemoval&&this.props.removeTag(this.props.tagName)},render:function(){var a="";this.props.allowRemoval&&(a=React.createElement("span",{className:"post-tag-delete pointer icon-x",onClick:this.removeTag}));var b={};return this.getBackgroundImage()&&(b={background:"linear-gradient(rgba(0, 0, 0, 0.15), rgba(0, 0, 0, 0.15)), url("+this.getBackgroundImage()+")"}),React.createElement("a",{style:b,className:this.props.classNames,onClick:this.handleTagClick,href:this.props.redirectTo},React.createElement("span",{className:"post-tag-link"},this.props.tagName),a)}}),Imgur.Elements.Tag.View.propTypes={tagName:React.PropTypes.string.isRequired,classNames:React.PropTypes.string,redirectTo:React.PropTypes.string,redirectAnalytics:React.PropTypes.func,allowRemoval:React.PropTypes.bool,removeTag:React.PropTypes.func,tag:React.PropTypes.object},Namespace("Imgur.PostOptions"),Imgur.PostOptions=React.createClass({displayName:"PostOptions",_:{embedcoder:null,saving:"Saving...",saved:"Saved!",optionsPos:0,albumInGalleryMessage:"Please remove this album from the gallery to change its images",MAX_TAG_LENGTH:5,DO_NOT_SHOW_SHARE_CONFIRMATION:"DoNotShowShareConfirmation",tagSuggestPosition:{right:{left:17,top:16},left:{left:-230,top:16}}},getInitialState:function(){return{hash:this.props.initialHash,published:this.props.initialIsPublished,privacy:this.props.privacy,showAllLinks:Imgur.LocalStorage.get("post_options::showAllLinks")||!1,save:"",fixed:!1,deletehash:this.props.deletehash||Imgur.Environment.image.deletehash,isAlbum:this.props.isAlbum||Imgur.Environment.image.is_album,image:this.props.image||Imgur.Environment.image,showingGrid:!1,tags:[],suggestedTags:null,query:"",tagError:null,tagSuggestFlag:"right",isPostMarkedAsMature:!1}},componentWillMount:function(){this._.embedcoder=new Imgur.LinkGenerator,this._.embedcoder.setThumbSize(""),this.initPostMatureState()},componentDidMount:function(){$("#deletion-email").find("form").submit(this.deletionEmailSubmitHandler),this.props.emitter.on("saving",this,_.bind(function(){this.setState({save:this._.saving})},this)),this.props.emitter.on("saved",this,_.bind(function(){this.setState({save:this._.saved})},this)),this.props.emitter.on("initGrid",this,function(){this.setState({showingGrid:!0})}),this.props.emitter.on("closeGrid",this,function(){this.setState({showingGrid:!1})}),this.props.emitter.on("tagAdded",this,this.resetTags),this.props.emitter.on("tagRemoved",this,this.resetTags),this.calcOptionsPosition(),$(window).on("scroll",_.throttle(this.checkStickyOptions,50)),this.checkStickyOptions(),this.state.isAlbum||Imgur.TitleDesc.getInstance().bindTitleDescriptionSubmit(null,!0),$(this.refs["mature-tipsy"]).tipsy({opacity:1,gravity:"ne",html:!0}),this.state.published&&($(this.refs["add-images"]).tipsy({opacity:1,gravity:"s",html:!0,offset:10}),$(this.refs["init-rearrange"]).tipsy({opacity:1,gravity:"s",html:!0,offset:15}))},componentDidUpdate:function(a,b){if(this.state.tagInputActive&&!b.tagInputActive){this.refs.addtag.focus();var c=ReactDOM.findDOMNode(this.refs.tagsuggest).getBoundingClientRect();c.right>window.innerWidth?this.setState({tagSuggestFlag:"left"}):c.right+c.width<window.innerWidth&&this.setState({tagSuggestFlag:"right"})}},initPostMatureState:function(){var a=this.getLocalStorageMatureStateKey();Imgur.LocalStorage.exists(a)&&this.setState({isPostMarkedAsMature:!0})},handlePostMatureChanged:function(){var a=this.getLocalStorageMatureStateKey();this.setState({isPostMarkedAsMature:!this.state.isPostMarkedAsMature},function(){this.state.isPostMarkedAsMature?Imgur.LocalStorage.save(a,1):Imgur.LocalStorage.remove(a)})},getLocalStorageMatureStateKey:function(){return"PostMarkedAsMature-"+(this.state.isAlbum?"Album":"Image")+"-"+this.state.hash},resetTags:function(){this.setState({tags:this.props.tagStore.getTags()})},checkStickyOptions:function(){var a=$(window).scrollTop();a>=this._.optionsPos?this.setState({fixed:!0}):this.setState({fixed:!1})},calcOptionsPosition:function(){this._.optionsPos=$(ReactDOM.findDOMNode(this)).offset().top-20},initRearrangeIfUnpublished:function(){this.state.published||this.props.emitter.trigger("initGrid","rearrange")},closeRearrange:function(){this.props.emitter.trigger("closeGrid")},handleEmbed:function(a){a.preventDefault(),$.colorbox({href:'<div id="embed-modal"></div>',open:!0,inline:!0,top:40,transition:"none",scrolling:!1,width:500,height:581,className:"embed-wrapper",title:"Embed this post",onComplete:_.bind(function(){ReactDOM.render(React.createElement(Imgur.Gallery.Embed,{hash:this.state.image.hash,title:this.state.image.title,in_gallery:this.state.published,is_album:this.state.isAlbum,nsfw:!!this.state.image.nsfw}),document.getElementById("embed-modal"))},this)})},handleDelete:function(a){var b=this;if(a.preventDefault(),!this.state.isAlbum)return void(window.location="/delete/"+this.props.deletehash);var c='<span class="attention">also be deleted</span>.',d="Delete Post & Images";Imgur.Environment.auth.id&&(c='<span class="attention">not be deleted</span> from your account.',d="Delete Post Only");var e="Are you sure you want to delete this post? The images in this post will "+c;$.colorbox({href:'<div id="delete-album-form"></div>',open:!0,inline:!0,top:"15%",transition:"none",scrolling:!1,width:420,height:245,className:"blurbox",title:"Delete Post",onComplete:_.bind(function(){ReactDOM.render(React.createElement(Imgur.Elements.Confirm,{message:e,yesButtonText:d,yesButtonClass:"btn-danger",handleNo:$.colorbox.close,handleYes:_.bind(function(){$.ajax({method:"post",url:"/ajaxalbums/delete/"+this.state.image.hash,data:{msid:Imgur.Environment.msid},success:function(){$.colorbox.close(),humanMsg.displayMsg("Album has been deleted"),setTimeout(_.bind(function(){window.location=Imgur.Environment.auth.url?location.protocol+"//"+Imgur.Environment.host+"/user/"+Imgur.Environment.auth.url:"/"},this),1e3)}})},this)}),document.getElementById("delete-album-form"),$.colorbox.resize)},this)});var f=void 0;f=this.props.isAlbum?this.props.uploadStore.getImages().images.reduce(function(a,c){return a+(b.isVideo(c)?1:0)},0):this.isVideo(this.state.image)?1:0,Imgur.Util.jafoLogEvent(Imgur.AnalyticCategories.CREATION,Imgur.AnalyticEventNames.ended,{"Total Count":this.props.isAlbum?this.props.uploadStore.getImages().count:1,Privacy:"Private","Tags Added":this.state.tags.length,"Was Mature":this.refs.mature.checked,"Completion Type":"Discarded","Video Count":f,"Video Sound Count":0,"Meme Count":0})},handleDownload:function(a){a.preventDefault(),Imgur.Util.jafoLog({event:"downloadImage",meta:{control:"postOptions",nsfw:this.state.image.nsfw,hash:this.state.hash,isAlbum:this.state.isAlbum,isAnimated:this.state.image.animated}}),this.state.isAlbum?window.location="/a/"+this.state.hash+"/zip":window.location="/download/"+this.props.hash+"/"+encodeURIComponent(this.state.image.title)},handleLinks:function(a){a&&a.preventDefault();var b="",c=classNames({"post-saving-container":!0,fade:this.state.save===this._.saved}),d=classNames({copyflash:!0,"copy-input-post":!0,"copy-input-post--saving":this.state.save===this._.saving});this.state.save===this._.saving?b=React.createElement("span",{className:"post-saving-status post-saving"}):this.state.save===this._.saved&&(b=React.createElement("span",{className:"post-saving-status icon-good"})),$.colorbox({href:'<div id="links-modal"></div>',open:!0,inline:!0,top:40,transition:"none",scrolling:!1,width:345,height:300,className:"default-modal",title:"Here's Your Post's Link!",onComplete:_.bind(function(){ReactDOM.render(React.createElement(Imgur.Gallery.LinksModal,{saveClasses:c,saveStatus:b,inputClasses:d,save:this.state.save,link:this._.embedcoder.imageLink(this.state.isAlbum),uploadAction:function(){$("#createDropdown .upload-subitem").click()},isLoggedIn:!!Imgur.Environment.auth.id,hash:this.props.hash}),document.getElementById("links-modal"),$.colorbox.resize)},this)})},handleShare:function(a){if(a.preventDefault(),Imgur.Util.jafoLog({event:"shareOnImgurInvoked",meta:{hash:this.state.hash,location:this.state.isAlbum?"albumPostPage":"singleImagePostPage"}}),!Imgur.Environment.auth.id)return void Imgur.getInstance().signin({invokedRegisterSigninBy:"Action - Publish"});if(this.props.imageStore&&0===this.props.imageStore.getImages().count)return void humanMsg.displayMsg("Please add at least one image to submit to the gallery","error-msg");if("ImgurAds"===Imgur.Environment.auth.url)return window.location="//"+Imgur.Environment.host+"/share/"+(this.state.isAlbum?"a":"i")+"/"+this.state.hash;var b=$(".post-header"),c=$(".post-title").eq(0);return c.text()?void(Imgur.LocalStorage.exists(this._.DO_NOT_SHOW_SHARE_CONFIRMATION)?this.makeShareRequest():this.showConfirmModal()):(b.addClass("shake"),setTimeout(function(){b.removeClass("shake")},250),void c.focus())},getLocalStorageDoNotShowStateKey:function(){return"DoNotShowShareConfirm"},showConfirmModal:function(){$.colorbox({href:'<div id="share-modal"></div>',open:!0,inline:!0,top:40,transition:"none",scrolling:!1,width:400,height:300,className:"default-modal",title:"Confirm Public Post",onComplete:_.bind(function(){ReactDOM.render(React.createElement(Imgur.Gallery.ShareModal,{shareAction:this.makeShareRequest,linksAction:this.handleLinks,doNotShowKey:this._.DO_NOT_SHOW_SHARE_CONFIRMATION}),document.getElementById("share-modal"),$.colorbox.resize)},this)})},isVideo:function(a){return a.mimetype?a.mimetype.startsWith("video/"):".mp4"===a.ext||".gifv"===a.ext},makeShareRequest:function(){var a=$(".post-title").eq(0),b=[];this.state.tags.length>0&&this.state.tags.map(function(a){return b.push(a.tagName)}),$.post("/ajax/share",{hash:this.state.hash,title:a.text(),is_album:this.state.isAlbum?1:0,mature:this.refs.mature.checked?1:0,tags:b},_.bind(function(a){var b=this,c=void 0;c=this.props.isAlbum?this.props.uploadStore.getImages().images.reduce(function(a,c){return a+(b.isVideo(c)?1:0)},0):this.isVideo(this.state.image)?1:0,Imgur.Util.jafoLogEvent(Imgur.AnalyticCategories.CREATION,Imgur.AnalyticEventNames.ended,{"Total Count":this.props.isAlbum?this.props.uploadStore.getImages().count:1,Privacy:"Public","Tags Added":this.state.tags.length,"Was Mature":this.refs.mature.checked,"Completion Type":"Uploaded","Video Count":c,"Video Sound Count":0,"Meme Count":0}),window.location="//"+Imgur.Environment.host+"/gallery/"+this.state.hash},this)).fail(_.bind(function(a){try{if(!a)throw"bad response";a.responseText&&(a=$.parseJSON(a.responseText))}catch(b){return humanMsg.displayMsg("An unknown error occurred. Please try again.","error-msg"),void Imgur.Util.jafoLog({event:"shareOnImgurError",meta:{hash:this.state.hash,error:"unparsable",button:"share"}})}if(null==a.data||null==a.data.error||null==a.data.error.message)return humanMsg.displayMsg("An unknown error occurred. Please try again.","error-msg"),void Imgur.Util.jafoLog({event:"shareOnImgurError",meta:{hash:this.state.hash,error:"unknown",button:"share"}});var c=a.data.error,d=c.message,e=c.code,f=parseInt(d),g="unknown";if(!isNaN(f)&&f>0){g="rateLimit";var h=f>60?Math.round(f/60)+Imgur.Util.pluralize(Math.round(f/60)," minute"):f+Imgur.Util.pluralize(f," second");humanMsg.displayMsg("You're sharing too quickly. Please wait "+h+".","error-msg")}else 2007===e?(g="banned",humanMsg.displayMsg("Your account has been blocked. Please contact support@imgur.com.","error-msg")):3105===e?(g="notVerified",$.colorbox({href:"/lightboxes/verifyemail",open:!0,iframe:!0,top:"15%",transition:"none",scrolling:!1,innerWidth:"520px",innerHeight:"256px",onComplete:_.bind(function(){$.get("/ajax/send_email_verification"),checkEmailVerification("",this.handleShare)},this)})):3103===e?(g="op",humanMsg.displayMsg("OP must exist.","error-msg")):3106===e?(g="suspended",humanMsg.displayMsg("Your account is currently suspended","error-msg")):3107===e?window.location="//"+Imgur.Environment.host+"/gallery/"+this.state.hash:[3100,3101,3102].includes(e)?humanMsg.displayMsg(d,"error-msg"):d.includes("Please")?humanMsg.displayMsg(d,"error-msg"):humanMsg.displayMsg("An unknown error occurred. Please try again.","error-msg");Imgur.Util.jafoLog({event:"shareOnImgurError",meta:{hash:this.state.hash,error:g,button:"share"}})},this))},showModalIfUnpublished:function(){this.state.published||this.props.showUploadModal()},addTag:function(a){var b=this;a=a||this.refs.addtag.innerText,this.props.tagStore.addTag(a,"tagModule",function(a,c){a?b.setState({tagInputActive:!1}):b.setState({tagError:c})})},removeTag:function(a){this.props.tagStore.removeTag(a)},renderTagInput:function(){var a=this;if(this.state.tags.length>=this._.MAX_TAG_LENGTH)return React.createElement("div",{className:"post-options-tag-limit center"},this._.MAX_TAG_LENGTH+" tag limit reached");if(!this.state.tagInputActive)return React.createElement("span",{className:"post-options-tag post-options-tag--add",onClick:function(){a.setState({tagInputActive:!0})}},React.createElement("span",{className:"symbol"},"+"),React.createElement("span",{className:"tag-name"},"Tag"));var b=this._.tagSuggestPosition[this.state.tagSuggestFlag],c=b.left,d=b.top;return React.createElement("div",{className:"post-options-tag-input-wrapper"},React.createElement("span",{contentEditable:!0,autoFocus:!0,ref:"addtag",key:"addtag",className:"post-options-tag-input center",onKeyUp:this.getSuggestions,onBlur:function(){a.setState({tagInputActive:!1})},onFocus:this.getSuggestions,onPaste:this.noHTML}),React.createElement(Imgur.Gallery.TagSuggest,{ref:"tagsuggest",onSelect:this.addTag,onHighlightedKeyDown:this.handleHighlighted,left:c,top:d,showingSuggestions:!0,suggestedTags:this.state.suggestedTags,query:this.state.query,error:this.state.tagError,classNames:"tag-suggest--flag-"+this.state.tagSuggestFlag}))},noHTML:function(){var a=this;setTimeout(function(){a.refs.addtag.innerText=a.refs.addtag.innerText.replace(/^\s+|\s+$|\n/g,"")},1)},getSuggestions:function(a){var b=this;if([38,40].indexOf(a.which)===-1){var c=this.refs.addtag.innerText,d=this.props.tagStore.getTagValidator();return d.isValidTag("",c,!1)?(this.setState({tagError:null,query:c}),13!==a.which||this.props.tagStore.isTagExists(c)?void this.props.tagStore.getSuggestions(c,function(a){b.setState({suggestedTags:a})}):void this.addTag(c)):void this.setState({tagError:d.whyNot("",c,!1)})}},handleHighlighted:function(a){this.refs.addtag.innerText=a;var b=this.refs.addtag;if(b.focus(),"undefined"!=typeof window.getSelection&&"undefined"!=typeof document.createRange){var c=document.createRange();c.selectNodeContents(b),c.collapse(!1);var d=window.getSelection();d.removeAllRanges(),d.addRange(c)}else if("undefined"!=typeof document.body.createTextRange){var e=document.body.createTextRange();e.moveToElementText(b),e.collapse(!1),e.select()}},render:function(){var a=this;if(this.props.display===!1)return!1;classNames({"new-panel":!0,"post-options-panel":!0});this._.embedcoder.setItem(this.state.image);classNames({"album-images-link":!0,published:this.state.published});return React.createElement("div",{className:this.state.fixed?"post-options-fixed":""},React.createElement("div",{className:"post-options-gallery-submit"+(this.props.showShareButton!==!1?" show":"")},this.state.published?React.createElement("div",null,React.createElement("div",{className:"post-options-publish published"},"You shared this post!"),React.createElement("a",{className:"post-options-view-gallery",href:"/gallery/"+this.state.hash},"View in gallery")):React.createElement("div",null,React.createElement("div",{className:"post-actions"},React.createElement("a",{className:"post-options-publish btn btn-action",onClick:this.handleShare},"Share to community"),React.createElement("a",{className:"post-options-links-btn btn btn-gray",onClick:this.handleLinks},"Hidden")),React.createElement("div",{className:"post-options-tags-mature-wrap"},React.createElement("input",{ref:"mature",id:"post-options-mature",type:"checkbox",defaultChecked:this.state.isPostMarkedAsMature,onChange:this.handlePostMatureChanged,className:"post-options-mature checkbox-styled"}),React.createElement("label",{className:"icon-check",htmlFor:"post-options-mature"}," "),React.createElement("label",{htmlFor:"post-options-mature"}," Mature ",React.createElement("span",{className:"help",ref:"mature-tipsy",title:"Mature content may include content that is suggestive or provocative. Sexually explicit content is not allowed in the Imgur community."},"(?)"))),React.createElement("div",{className:"divider"}),React.createElement("div",null,React.createElement("span",{className:"post-options-tags-header"},"Help people find your post"),React.createElement("div",{className:"post-options-tags-learn"},React.createElement("a",{target:"_blank",href:"https://help.imgur.com/hc/en-us/articles/115000621783"},"Learn More")),React.createElement("div",{className:"post-options-tag-block"},this.state.tags.map(function(b){return React.createElement(Imgur.Elements.Tag.View,{key:"@tag-"+b.tagName,tagName:b.tagName,classNames:"post-options-tag",allowRemoval:!0,removeTag:a.removeTag})}),this.renderTagInput()))),React.createElement("div",{className:"divider"})),React.createElement("ul",{className:"post-options-extra"},this.state.isAlbum&&this.props.showRearrange?React.createElement("li",{className:"extra-option"},this.state.showingGrid?React.createElement("div",{onClick:this.closeRearrange},React.createElement("span",{className:"extra-option-icon icon-rearrange"}),"Done rearranging"):React.createElement("div",{ref:"init-rearrange",onClick:this.initRearrangeIfUnpublished,title:this.state.published?this._.albumInGalleryMessage:null},React.createElement("span",{className:"extra-option-icon icon-rearrange"}),"Rearrange images")):null,this.state.isAlbum?React.createElement("li",{className:"extra-option",ref:"add-images",title:this.state.published?this._.albumInGalleryMessage:null,onClick:this.showModalIfUnpublished},React.createElement("span",{className:"extra-option-icon icon-plus-light"}),"Add more images"):null,React.createElement("li",{className:"extra-option",onClick:this.handleEmbed},React.createElement("span",{className:"extra-option-icon icon-embed"}),"Embed post"),React.createElement("li",{className:"extra-option download",onClick:this.handleDownload},React.createElement("span",{className:"extra-option-icon icon-download"}),"Download post"),React.createElement("li",{className:"extra-option delete",onClick:this.handleDelete},React.createElement("span",{className:"extra-option-icon icon-trash"}),"Delete post")))}});var ZeroClipboard={version:"1.0.7",clients:{},moviePath:"/include/flash/zeroclipboard.swf",nextId:1,$:function(a){return"string"==typeof a&&(a=document.getElementById(a)),a.addClass||(a.hide=function(){this.style.display="none"},a.show=function(){this.style.display=""},a.addClass=function(a){this.removeClass(a),this.className+=" "+a},a.removeClass=function(a){for(var b=this.className.split(/\s+/),c=-1,d=0;d<b.length;d++)b[d]==a&&(c=d,d=b.length);return c>-1&&(b.splice(c,1),this.className=b.join(" ")),this},a.hasClass=function(a){return!!this.className.match(new RegExp("\\s*"+a+"\\s*"))}),a},setMoviePath:function(a){this.moviePath=a},dispatch:function(a,b,c){var d=this.clients[a];d&&d.receiveEvent(b,c)},register:function(a,b){this.clients[a]=b},getDOMObjectPosition:function(a,b){for(var c={left:0,top:0,width:a.width?a.width:a.offsetWidth,height:a.height?a.height:a.offsetHeight};a&&a!=b;)c.left+=a.offsetLeft,c.top+=a.offsetTop,a=a.offsetParent;return c},Client:function(a){this.handlers={},this.id=ZeroClipboard.nextId++,this.movieId="ZeroClipboardMovie_"+this.id,ZeroClipboard.register(this.id,this),a&&this.glue(a)}};ZeroClipboard.Client.prototype={id:0,ready:!1,movie:null,clipText:"",handCursorEnabled:!0,cssEffects:!0,handlers:null,glue:function(a,b,c){this.domElement=ZeroClipboard.$(a);var d=99;this.domElement.style.zIndex&&(d=parseInt(this.domElement.style.zIndex,10)+1),"string"==typeof b?b=ZeroClipboard.$(b):"undefined"==typeof b&&(b=document.getElementsByTagName("body")[0]);var e=ZeroClipboard.getDOMObjectPosition(this.domElement,b);this.div=document.createElement("div");var f=this.div.style;if(f.position="absolute",f.left=""+e.left+"px",f.top=""+e.top-5+"px",f.width=""+e.width+"px",f.height=""+e.height+"px",f.zIndex=d,"object"==typeof c)for(addedStyle in c)f[addedStyle]=c[addedStyle];b.appendChild(this.div),this.div.innerHTML=this.getHTML(e.width,e.height)},getHTML:function(a,b){var c="",d="id="+this.id+"&width="+a+"&height="+b;if(navigator.userAgent.match(/MSIE/)){var e=location.href.match(/^https/i)?"https://":"http://";c+='<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="'+e+'download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" width="'+a+'" height="'+b+'" id="'+this.movieId+'" align="middle"><param name="allowScriptAccess" value="always" /><param name="allowFullScreen" value="false" /><param name="movie" value="'+ZeroClipboard.moviePath+'" /><param name="loop" value="false" /><param name="menu" value="false" /><param name="quality" value="best" /><param name="bgcolor" value="#ffffff" /><param name="flashvars" value="'+d+'"/><param name="wmode" value="transparent"/></object>';
}else c+='<embed id="'+this.movieId+'" src="'+ZeroClipboard.moviePath+'" loop="false" menu="false" quality="best" bgcolor="#ffffff" width="'+a+'" height="'+b+'" name="'+this.movieId+'" align="middle" allowScriptAccess="always" allowFullScreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" flashvars="'+d+'" wmode="transparent" />';return c},hide:function(){this.div&&(this.div.style.left="-2000px")},show:function(){this.reposition()},destroy:function(){if(this.domElement&&this.div){this.hide(),this.div.innerHTML="";var a=document.getElementsByTagName("body")[0];try{a.removeChild(this.div)}catch(b){}this.domElement=null,this.div=null}},reposition:function(a){if(a&&(this.domElement=ZeroClipboard.$(a),this.domElement||this.hide()),this.domElement&&this.div){var b=ZeroClipboard.getDOMObjectPosition(this.domElement),c=this.div.style;c.left=""+b.left+"px",c.top=""+b.top+"px"}},setText:function(a){this.clipText=a,this.ready&&this.movie.setText(a)},addEventListener:function(a,b){a=a.toString().toLowerCase().replace(/^on/,""),this.handlers[a]||(this.handlers[a]=[]),this.handlers[a].push(b)},setHandCursor:function(a){this.handCursorEnabled=a,this.ready&&this.movie.setHandCursor(a)},setCSSEffects:function(a){this.cssEffects=!!a},receiveEvent:function(a,b){switch(a=a.toString().toLowerCase().replace(/^on/,"")){case"load":if(this.movie=document.getElementById(this.movieId),!this.movie){var c=this;return void setTimeout(function(){c.receiveEvent("load",null)},1)}if(!this.ready&&navigator.userAgent.match(/Firefox/)&&navigator.userAgent.match(/Windows/)){var c=this;return setTimeout(function(){c.receiveEvent("load",null)},100),void(this.ready=!0)}this.ready=!0,this.movie.setText(this.clipText),this.movie.setHandCursor(this.handCursorEnabled);break;case"mouseover":this.domElement&&this.cssEffects&&(this.domElement.addClass("hover"),this.recoverActive&&this.domElement.addClass("active"));break;case"mouseout":this.domElement&&this.cssEffects&&(this.recoverActive=!1,this.domElement.hasClass("active")&&(this.domElement.removeClass("active"),this.recoverActive=!0),this.domElement.removeClass("hover"));break;case"mousedown":this.domElement&&this.cssEffects&&this.domElement.addClass("active");break;case"mouseup":this.domElement&&this.cssEffects&&(this.domElement.removeClass("active"),this.recoverActive=!1)}if(this.handlers[a])for(var d=0,e=this.handlers[a].length;d<e;d++){var f=this.handlers[a][d];"function"==typeof f?f(this,b):"object"==typeof f&&2==f.length?f[0][f[1]](this,b):"string"==typeof f&&window[f](this,b)}}};var _extends=Object.assign||function(a){for(var b=1;b<arguments.length;b++){var c=arguments[b];for(var d in c)Object.prototype.hasOwnProperty.call(c,d)&&(a[d]=c[d])}return a};Namespace("Imgur.SideGallery"),Imgur.SideGallery=React.createClass({displayName:"SideGallery",HEIGHT:485,ROW_HEIGHT:{list:85,grid:138},ITEMS_PER_ROW:{list:1,grid:2},RENDER_BUFFER:1e3,FETCH_MORE_BUFFER:3e3,SELECTED_OFFSET:0,BREAK_HEIGHT:60,GRID_MARGIN:10,isLoading:!1,currentInserted:!1,el:{$sideGallery:null,$content:null,$nano:null},sectionTitles:{hot:"Most Viral Images","new":"User Submitted Images",top:"Highest Scoring Images",custom:"Custom Gallery Images",favorites:"Favorites",random:"Random"},sortTitles:{viral:"sorted by popularity",time:"newest first","new":"newest first",newest:"newest first",oldest:"oldest first",rising:"rising",random:"sorted by random"},windowTitles:{day:"today",week:"this week",month:"this month",year:"this year",all:"all time"},getInitialState:function(){return _.extend(this.getGalleryEnvironment(),{items:[],scrollTop:0,selectedHash:this.props.env.hash,endReached:!1,layout:Imgur.LocalStorage.get("sidegallery_layout_experiment")||"list"})},getGalleryEnvironment:function(){var a=void 0,b=void 0,c=void 0,d=document.createElement("a");return d.href=document.referrer,"twitch.tv"===d.host?(a="tag",b="/t/gaming"):this.props.env.subredditSource&&this.isFromReddit(d.host)?(a="subreddit",c="new",b="/r/"+this.getSubredditName()):Imgur.Environment.image.topic&&"No Topic"!==Imgur.Environment.image.topic&&null===d.host.match(/imgur(-dev)?.com/g)&&(a="tag",b="/t/"+Imgur.Environment.image.topic.replace(/ /g,"_")),Imgur.Environment.searchQuery&&(a="search"),{source:b||this.props.env.baseURL,section:a||this.props.env.section||"hot",sort:c||this.props.env.sort||"viral",window:this.props.env.window||"day",page:this.props.env.page||0}},isFromReddit:function(a){return a.indexOf("reddit.com")>=0},changeLayout:function(a){var b=this.state.scrollTop/(this.ROW_HEIGHT[this.state.layout]/this.ITEMS_PER_ROW[this.state.layout])*(this.ROW_HEIGHT[a]/this.ITEMS_PER_ROW[a]);this.setState({layout:a},function(){this.el.$content.scrollTop(b)}),Imgur.LocalStorage.save("sidegallery_layout_experiment",a),Imgur.Util.jafoLog({event:"sideGalleryLayout",meta:{layout:a}})},uniqueId:function(){for(var a=arguments.length,b=Array(a),c=0;c<a;c++)b[c]=arguments[c];return b.filter(function(a){return void 0!==a}).join("-")},ajaxSuccess:function(a){var b=this;if(this.isLoading=!1,this.isMounted()){var c=this.state.items.length;this.setState({items:_.uniq(this.state.items.concat(a.data),!1,function(a){return b.uniqueId(a.hash,a.promotedPlacementCount)})},function(){this.checkEndReached(a.data.length),!this.currentInserted&&Imgur.Environment.captionsEnabled&&Imgur.Environment.image&&(this.insertSingleItem(Imgur.Environment.image,0,!0),this.currentInserted=!0),a.data.length>0&&this.props.emitter.trigger("sidegalleryPageLoad",0===c?"initial":"append"),"randomized-most-viral"==this.props.variation&&Imgur.Experiments.isActive("expT4377b")&&this.recommendations.fetchControl()}.bind(this))}},onScroll:function(){var a=this.el.$content.scrollTop();this.setState({scrollTop:a},this.checkScrollPageNeeded)},checkEndReached:function(a){(0===a||this.listHeight()<this.HEIGHT)&&this.setState({endReached:!0})},checkScrollPageNeeded:function(){this.state.scrollTop>this.listHeight()-this.FETCH_MORE_BUFFER&&!this.isLoading&&this.setState({page:this.state.page+1},this.loadPage)},listHeight:function(){return Math.ceil(this.state.items.length/this.ITEMS_PER_ROW[this.state.layout])*this.ROW_HEIGHT[this.state.layout]},itemOffset:function(a){return Math.ceil((a+1)/this.ITEMS_PER_ROW[this.state.layout])*this.ROW_HEIGHT[this.state.layout]-this.ROW_HEIGHT[this.state.layout]},loadPage:function(){if(this.state.endReached)return!1;var a={};this.isLoading=!0,$.ajax({url:this.generateURL(),data:a,success:this.ajaxSuccess,error:this.switchToViral})},generateURL:function(){var a=void 0,b=this.state.section&&"group"!=this.state.section&&"tag"!=this.state.section&&"favorites"!=this.state.section&&"favoritefolders"!=this.state.section&&"topic"!=this.state.section&&"subreddit"!=this.state.section?"/"+this.state.section:"",c="top"!=this.state.section?this.state.sort+"/":"",d="top"==this.state.sort||"top"==this.state.section?this.state.window+"/":"",e=""+this.state.source+b+"/"+c+d,f="/gallery/hot/viral/"==e;if(Imgur.Environment.image.is_ad&&f)return"/t/Staff_Picks/viral/page/0/hit.json";if(Imgur.Environment.searchQuery){var g=Imgur.getInstance().getSearchUrl(Imgur.Environment,this.state.page,!0);a=g.url+"?"+g.query}else{var h=this.props.cache;!f||0!=this.state.page&&1!=this.state.page||this.props.votedFavedRecently||(h="/hit.json"+(this.props.showMature?"?mature":"")),a=e+"page/"+this.state.page+h}return a},switchToViral:function(){"hot"==this.state.section&&"viral"==this.state.sort&&"day"==this.state.window||this.setState({items:[],page:0,section:"hot",sort:"viral",window:"day",source:"/gallery",endReached:!1,selectedHash:null},this.loadPage)},nthFromHash:function(a,b){var c=this.hashPosition(b),d=c+a;if(c!==-1)return d>=this.state.items.length&&(d=this.state.items.length-1),this.state.items[d].hash},insertSingleItem:function(a,b,c,d,e){d=d||"inserted";var f=this.uniqueId(a.hash,a.promotedPlacementCount),g=this.hashPosition(f);if(g!==-1&&!a.isAd)return c?this.selectImage(f,null,"direct",d):null,"function"==typeof e&&e(),!1;for(;this.state.items[b]&&this.state.items[b].recommended;)b++;this.state.items.splice(b,0,a),this.setState({items:this.state.items},function(){c&&this.selectImage(f,null,"direct",d),"function"==typeof e&&e()})},selectedPosition:function(){return this.hashPosition(this.state.selectedHash)},hashPosition:function(a){var b=this,c=a.split&&a.split("-");return c&&c.length>1?this.state.items.map(function(a){return b.uniqueId(a.hash,a.promotedPlacementCount)}).indexOf(a):this.state.items.map(function(a){return a.hash}).indexOf(a)},selectImage:function(a,b,c,d){this.setState({selectedHash:a,scrollToHash:a},function(){var e=this.hashPosition(a);if(e===-1)return void(Imgur.Environment.image&&a===Imgur.Environment.image.hash&&(this.props.emitter.trigger("select",Imgur.Environment.image,b,c,d),this.props.emitter.trigger("postRendering",Imgur.Environment.image)));var f=this.state.items[e];this.props.emitter.trigger("select",f,b,c,d),this.props.emitter.trigger("postRendering",f),0==e?this.props.emitter.trigger("firstImage",f,!1):e==this.state.items.length-1&&this.props.emitter.trigger("lastImage",f,!1)})},getImage:function(a){return!this.currentInserted&&Imgur.Environment.image&&Imgur.Environment.image.hash===a?Imgur.Environment.image:this.state.items[this.hashPosition(a)]},getNextImage:function(){var a=this.getNextImageItem();return!!a&&a.hash},getPrevImage:function(){var a=this.getPrevImageItem();return!!a&&a.hash},getNextImageItem:function(a){var b=this.hashPosition(this.state.selectedHash)+1;if(a?b+=a:a=0,b<this.state.items.length){var c=this.state.items[b];return"down"===c.vote||c.nextable===!1?this.getNextImageItem(++a):c}return!1},getPrevImageItem:function(a){var b=this.hashPosition(this.state.selectedHash)-1;if(a?b-=a:a=0,b>=0){var c=this.state.items[b];return"down"===c.vote||c.nextable===!1?this.getPrevImageItem(++a):c}return!1},getSection:function(){return this.state.section},componentDidMount:function(){if(this.props.display!==!1){this.loadPage(),this.bindMouseMove();var a=_.throttle(_.bind(this.onScroll,this),500);this.el.$sideGallery=$(ReactDOM.findDOMNode(this)),this.el.$content=this.el.$sideGallery.find(".content"),this.el.$nano=this.el.$sideGallery.find(".content"),this.el.$content.scroll(a),this.props.emitter.on("keyboardNav",this,_.partialRight(this.nav,"keyboard")),this.props.emitter.on("buttonNav",this,_.partialRight(this.nav,"click"))}},bindMouseMove:function(){var a,b=0,c=(Imgur.Util.getBrowserScrollbarWidth(),$("#side-gallery").find(".content")[0]),d=function(d){var e=$(d.target),f=e.closest(".scroll-content").length,g=Math.abs(d.clientX-a),h=Math.abs(d.clientY-b);(g>5||h>5)&&f?c.style.overflowY="scroll":f||(c.style.overflowY="hidden"),a=d.clientX,b=d.clientY}.bind(this);$("body").mousemove(_.throttle(d,20))},nav:function(a,b){var c;switch(a){case"next":c=this.getNextImageItem();break;case"prev":c=this.getPrevImageItem()}if(c){var d=this.uniqueId(c.hash,c.promotedPlacementCount);this.selectImage(d,void 0,a,b)}return!1},updatePoints:function(a,b,c){var d=this.hashPosition(a);if(d!==-1){var e=this.state.items[d];e.ups=b,e.downs=c,e.points=b-c,this.setState({items:this.state.items})}},updateViews:function(a,b){var c=this.hashPosition(a);if(c!==-1){var d=this.state.items[c];d.views=b,this.setState({items:this.state.items})}},updateVote:function(a,b,c){var d=this.hashPosition(a);if(d===-1)return!1;var e=this.state.items[d];switch(e.vote){case"up":e.ups--;break;case"down":e.downs--}switch(b){case"up":e.ups++;break;case"down":e.downs++}e.vote=b,e.points=e.ups-e.downs,this.setState({items:this.state.items}),c(e.points)},updateFavorite:function(a,b){this.state.items[this.hashPosition(a)].favorited=b,this.setState({items:this.state.items})},shouldComponentUpdate:function(){return!0},componentDidUpdate:function(a,b){b.items.length===this.state.items.length&&b.layout===this.state.layout||this.el.$sideGallery.find(".nano").nanoScroller(),b.scrollToHash!==this.state.scrollToHash&&this.scrollToHash(this.state.scrollToHash)},scrollToHash:function(a){var b=ReactDOM.findDOMNode(this.refs[a]);b&&this.el.$content.stop().animate({scrollTop:b.offsetTop-this.SELECTED_OFFSET})},getSubredditName:function(){return Imgur.Environment.image.subreddit||this.props.env.subredditSource},render:function(){if(this.props.display===!1)return!1;var a,b,c,d,e,f,g,h,i,j=[],k={min:this.state.scrollTop-this.RENDER_BUFFER,max:this.state.scrollTop+this.HEIGHT+this.RENDER_BUFFER};switch(this.state.section){case"subreddit":h=this.getSubredditName();break;case"topic":h=Imgur.Environment.image.topic;break;case"tag":h=Imgur.Environment.tag;break;case"search":switch(h="Searching "+Imgur.Environment.searchQuery,this.state.sort){case"relevance":i="most relevant from "+this.windowTitles[this.state.window];break;case"score":i="highest scoring from "+this.windowTitles[this.state.window]}break;case"favorites":case"favoritefolders":var l=Imgur.Environment.favs_account_url||Imgur.Environment.auth.url,m="s"==l.substr(-1)?l+"'":l+"'s";h=React.createElement("span",null,React.createElement("span",{className:"sg-username"},m)," Favorites"),i=this.sortTitles[this.state.sort];break;case"top":h=this.sectionTitles[this.state.section],i="from "+this.windowTitles[this.state.window];break;default:h=this.sectionTitles[this.state.section]}i=i||("top"==this.state.sort?"from "+this.windowTitles[this.state.window]:this.sortTitles[this.state.sort]);for(var n=0;n<this.state.items.length;n++){g=this.state.items[n],f=this.state.items[n-1],c=this.itemOffset(n),b=c>k.min&&c<k.max,e=b?g.thumb?g.thumb:Imgur.Environment.cdnUrl+"/"+(g.is_album?g.album_cover:g.hash)+"b.jpg":"data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==";var o=this.uniqueId(g.hash,g.promotedPlacementCount);a=_.extend({},g,{thumb:e,selected:o===this.state.selectedHash,selectImage:this.selectImage,shouldRender:b,layout:this.state.layout,position:n+1}),j.push(React.createElement(Imgur.SideGalleryItem,_extends({ref:o,key:o},a)))}return d=this.state.endReached?React.createElement("div",{className:"sidegallery-end"},"You have reached the end of this stream. Continue browsing ",React.createElement("a",{className:"link",onClick:this.switchToViral},"Most Viral")):React.createElement("div",{className:"sidegallery-end loading"}),React.createElement("div",null,React.createElement("div",{className:"sg-header"},React.createElement("a",{className:"sg-title-container",href:this.state.source},React.createElement("h2",{className:"sg-title"},h),i?React.createElement("h3",{className:"sg-subtitle"},i):null),React.createElement("div",{className:"layout-options"},React.createElement("a",{className:classNames({"layout-button":!0,selected:"list"==this.state.layout}),onClick:this.changeLayout.bind(this,"list")},React.createElement("span",{className:"icon-right-list"})),React.createElement("a",{className:classNames({"layout-button":!0,selected:"grid"==this.state.layout}),onClick:this.changeLayout.bind(this,"grid")},React.createElement("span",{className:"icon-grid"})))),React.createElement("div",{className:"nano"},React.createElement("div",{className:"content scroll-content cf"},React.createElement("div",{className:classNames({items:!0,grid:"grid"==this.state.layout,list:"list"==this.state.layout})},j),d)),React.createElement("div",{className:"fade-out"}))}}),Namespace("Imgur.SideGalleryItem"),Imgur.SideGalleryItem=React.createClass({displayName:"SideGalleryItem",mixins:[React.addons.PureRenderMixin],handleClick:function(a){if(1!==a.button){var b=this.props.hash;if(this.props.promotedPlacementCount&&(b=this.props.hash+"-"+this.props.promotedPlacementCount),this.props.selectImage(b,!1,"targeted","click"),a.preventDefault(),this.props.galleryTags&&this.props.galleryTags.length>0){var c=Imgur.UserStatistics.getInstance();c.emitActionUserView(this.props.hash,document.referrer,_.map(this.props.galleryTags,function(a){return a.tag}))}}},getWidePromotedThumb:function(){return React.createElement("a",{className:this.getThumbClasses("PromotedGridItem PromotedGridItem-wide left"),style:this.getThumbStyles(this.props.thumbnail_json.hash),onClick:this.handleClick,href:this.getHref(),title:this.props.title},this.getVoteMarkup(),React.createElement("div",{className:"PromotedGridItem-textContainer"},React.createElement("p",{className:"PromotedGridItem-op font-opensans-bold"},this.props.account_url),React.createElement("p",{className:"PromotedGridItem-text"},this.props.thumbnail_json.title||this.props.title)))},getHref:function(){return this.props.in_gallery?"/gallery/"+this.props.hash:(this.props.is_album?"/a/":"/")+this.props.hash},getThumbStyles:function(a){var b=a?Imgur.Environment.cdnUrl+"/"+a+".jpg":this.props.thumb;return{backgroundImage:"url("+b+")"}},getThumbClasses:function(a){var b={"sg-item":!0,selected:this.props.selected,recommended:this.props.recommended,base:!this.props.recommended,grid:"grid"===this.props.layout,list:"list"===this.props.layout,up:"up"===this.props.vote,down:"down"===this.props.vote,promoted:this.props.isAd&&!this.props.isCta,"sg-cta":this.props.isCta};return this.props.className&&(b[this.props.className]=!0),a&&(b[a]=!0),classNames(b)},getVoteMarkup:function(){var a=classNames({"sg-item-vote":!0,"icon-upvote-fill":"up"===this.props.vote,"icon-downvote-fill":"down"===this.props.vote});return this.props.shouldRender&&this.props.vote?React.createElement("div",{className:a}):null},renderItemStats:function(){return React.createElement("div",{className:"sg-item-stats"},_.isUndefined(this.props.points)?null:React.createElement("span",{className:"icon-upvote-outline"}),_.isUndefined(this.props.points)?null:React.createElement("span",{className:"sg-item-count"},Imgur.Util.numberFormat(this.props.points)),_.isUndefined(this.props.comment_count)?null:React.createElement("span",{className:"icon-messages"}),_.isUndefined(this.props.comment_count)?null:React.createElement("span",{className:"sg-item-count"},Imgur.Util.numberFormat(this.props.comment_count)))},render:function(){var a=this.props.isAd&&this.props.thumbnail_json&&"288x141"===this.props.thumbnail_json.size,b="grid"===this.props.layout;if(a&&b)return this.getWidePromotedThumb();var c=this.getThumbStyles(this.props.isAd&&this.props.thumbnail_json&&this.props.thumbnail_json.hash),d=this.props.isAd?React.createElement("div",{className:"sg-item-tag"},this.props.isAnnouncement?"ANNOUNCEMENT":"PROMOTED"):this.props.shouldRender&&this.props.num_images>1?React.createElement("div",{className:"sg-item-tag"},this.props.num_images):null;if(this.props.isCta)return React.createElement("a",{className:this.getThumbClasses(),title:this.props.title,style:c,onClick:this.handleClick,href:this.getHref()});if(b){var e=this.props.shouldRender?React.createElement("div",{className:"sg-item-title"},this.props.title):null;return React.createElement("a",{className:this.getThumbClasses(),title:this.props.title,style:c,onClick:this.handleClick,href:this.getHref()},this.getVoteMarkup(),d,e)}return React.createElement("a",{className:this.getThumbClasses(),onClick:this.handleClick,href:this.getHref()},React.createElement("div",{className:"sg-list-image",style:c},d),React.createElement("div",{className:"sg-list-metadata"},React.createElement("div",{className:"sg-list-title"},this.props.title)))}}),Namespace("Imgur.ReportBadAds"),Imgur.ReportBadAds=React.createClass({displayName:"Report-Bad-Ads",thanksMessage:"Thanks! This ad has been reported.",getDefaultProps:function(){return{adManager:function(){}}},componentDidMount:function(){this.props.adManager.setDisabledRefresh()},getInitialState:function(){return{name:"",value:""}},getAdInfo:function(a){var b=void 0,c=!0,d=!1,e=void 0;try{for(var f,g=this.props.adManager.slots[Symbol.iterator]();!(c=(f=g.next()).done);c=!0){var h=f.value;h.name===a&&(b=h)}}catch(i){d=!0,e=i}finally{try{!c&&g["return"]&&g["return"]()}finally{if(d)throw e}}if(!b)return{};var j=this.props.adManager.getBidsByHighestCpm(b.element);return j[0]||{}},handleSubmit:function(a){a.preventDefault(),a.stopPropagation();var b=this.refs.form.elements.slotname.value,c=this.getAdInfo(b);$.ajax({url:"/report-badads",method:"POST",data:{slot_name:b,qqid:c.sasSlotId,adid:c.adId,bidder:c.bidder,cpm:c.pbHg,comments:this.refs.comments.value},success:function(){humanMsg.displayMsg(this.thanksMessage)}.bind(this),error:function(a){humanMsg.displayMsg(a.error,"error-msg")}}),this.unmount()},unmount:function(){ReactDOM.unmountComponentAtNode(ReactDOM.findDOMNode(this).parentNode)},stopPropagation:function(a){a.stopPropagation()},render:function(){return React.createElement("div",{className:"modal-backdrop",onClick:this.unmount},React.createElement("form",{onSubmit:this.handleSubmit,onClick:this.stopPropagation,ref:"form"},React.createElement("div",{className:"modal bad-ads-modal"},React.createElement("div",{className:"bad-ads-modal-header"},React.createElement("h2",{className:"headline"},"Report Ad"),React.createElement("div",{className:"icon-x",onClick:this.unmount})),React.createElement("div",{className:"bad-ads-modal-body"},React.createElement("p",null,"See an ad that may violate our ",React.createElement("a",{href:"https://help.imgur.com/hc/en-us/articles/205107685-Bad-ads"},"advertising guidelines"),"? It’s easy to report it using this form."),React.createElement("p",null,"Please indicate the location of the ad:"),React.createElement("div",{className:"bad-ads-layouts"}),React.createElement("radiogroup",null,React.createElement("label",{className:"radio"},React.createElement("input",{type:"radio",name:"slotname",value:"top_banner"}),"Upper Left"),React.createElement("label",{className:"radio"},React.createElement("input",{type:"radio",name:"slotname",value:"under_sidebar"}),"Middle Right"),React.createElement("label",{className:"radio"},React.createElement("input",{type:"radio",name:"slotname",value:"top_med_rec"}),"Lower Right")),React.createElement("textarea",{className:"bad-ads-comments",ref:"comments",placeholder:"Please provide us with additional context for your submission"}),React.createElement("input",{type:"submit",value:"Report",className:"btn-action btn-large right"})))))}});var _createClass=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(a,d.key,d)}}return function(b,c,d){return c&&a(b.prototype,c),d&&a(b,d),b}}(),ImgurRecommendations=function(a){function b(){var a,c,d,e;_classCallCheck(this,b);for(var f=arguments.length,g=Array(f),h=0;h<f;h++)g[h]=arguments[h];return c=d=_possibleConstructorReturn(this,(a=b.__proto__||Object.getPrototypeOf(b)).call.apply(a,[this].concat(g))),d.state={recs:[]},e=c,_possibleConstructorReturn(d,e)}return _inherits(b,a),_createClass(b,[{key:"componentDidMount",value:function(){this.fetchRecommendations()}},{key:"fetchRecommendations",value:function(){return"lift-igniter-no-pp"==this.props.variation?void this.fetchLiftIgniter(!0):void this.fetchControl()}},{key:"fetchControl",value:function(){0!=this.props.sideGallery.state.items.length&&this.setState({recs:_.shuffle(this.props.sideGallery.state.items).slice(0,8)},function(){})}},{key:"fetchLiftIgniter",value:function(a){var b=this;a||$p("resetPageview"),$p("setRequestFields",["title","url","hash","account_id","account_url","album_cover","animated","comment_count","description","ext","height","id","is_album","looping","num_images","points","prefer_video","timestamp","views","recommended","width"]),$p("register",{max:8,widget:"afterContent",callback:function(a){var c=a.items.filter(function(a){return a.url.indexOf("/gallery/")>-1&&"undefined"!=typeof a.is_album}).map(function(a){return a.recommended=!0,a.looping=!0,a.prefer_video=!0,a.place=runSlots._place,a.ups=a.points,a.downs=0,a.in_gallery=!0,a});b.setState({recs:c},function(){$p("track",{elements:document.querySelectorAll(".rec-item"),name:"belowContent",source:"LI"})})},opts:{allowMature:(!(!Imgur.Environment.auth||!Imgur.Environment.auth.show_mature)).toString()}}),$p("fetch")}},{key:"navToRecommendation",value:function(a,b,c){var d=this;c.preventDefault();var e=this.props.sideGallery.selectedPosition()+1;a.recBoxPosition=b,this.props.sideGallery.insertSingleItem(a,e,!0,"recommendationClick",function(){d.fetchRecommendations()})}},{key:"render",value:function(){var a=this,b=this.state.recs.map(function(b,c){var d=Imgur.Environment.cdnUrl+"/"+(b.is_album?b.album_cover:b.hash)+"b.jpg";return React.createElement("a",{href:"/gallery/"+b.hash,key:b.hash,className:"rec-item",style:{backgroundImage:"url("+d+")"},onClick:a.navToRecommendation.bind(a,b,c)},React.createElement("div",{className:"title"},b.title))});return 0==b.length?null:React.createElement("div",null,React.createElement("h2",null,"Recommended On Imgur"),React.createElement("div",null,b))}}]),b}(React.Component);Imgur.Recommendations=ImgurRecommendations,Namespace("Imgur.ShareButtons"),Imgur.ShareButtons=Imgur.extend({init:function(a){this._=$.extend({resetUrl:!1,shareButtonClass:"addthis_button",addthisTimeout:null,shareData:{title:null,url:null,jafoMeta:{}},globalShareData:null},a),this._super(this._),this.bindButtons()},elements:{$social:$(".social")},getAddthisConfig:function(){return{pubid:"imgur",username:"imgur",ui_click:!0,ui_header_color:"#181817",ui_header_background:"#ddddd1",ui_offset_top:"0px",ui_open_windows:!0,data_ga_property:"UA-6671908-2",data_ga_tracker:window._gaq,data_track_clickback:!1,data_ga_social:!0,services_compact:"stumbleupon,google_plusone_share,pinterest_share,tumblr,email,gmail",services_exclude:"facebook,reddit",share:{url:this._.shareData.url,title:this.getShareTitle()}}},initAddthis:function(a){"undefined"==typeof window.addthis_config&&(window.addthis_config=this.getAddthisConfig(),$.getScript(location.protocol+"//s7.addthis.com/js/300/addthis_widget.js#pubid=imgur&domready=1",_.bind(function(){if(this.setupAddthis(),a){var b=function(a){$(".addthis_button").click()};window.addthis.addEventListener("addthis.ready",b),this._.addthisTimeout=setTimeout(b,400)}},this),!0))},setShareData:function(a,b){b=_.merge({global:!1},b),b.global&&(this._.globalShareData=a),this._setShareData(a)},resetShareData:function(){this._.globalShareData&&this._setShareData(this._.globalShareData),this._.shareData.url||(this._.shareData.url=this._.protocol+"//"+this._.host+this._.url)},_setShareData:function(a){this._setJafoMeta(a.jafoMeta),this._setShareTitle(a.title),this._setUrl(a.url)},_setJafoMeta:function(a){this._.shareData.jafoMeta=a},_setShareTitle:function(a){a||(a=document.title),a=a.replace(/\s*\- (?:Album on )?Imgur$/,""),this._.shareData.title=a,"addthis"in window&&"update"in window.addthis&&window.addthis.update("share","title",a)},_setUrl:function(a){this._.shareData.url=a,"addthis"in window&&"update"in window.addthis&&window.addthis.update("share","url",a)},bindButtons:function(){this._.shareData.url=this._.shareData.url?this._.shareData.url:this._.protocol+"//"+this._.host+this._.url,this.elements.$social.unbind("click"),this.elements.$social.on("click","li span[data-jshook]",_.bind(function(a){switch(this.resetShareData(),a.currentTarget.getAttribute("data-jshook")){case"twitter_custom":this.shareTwitter();break;case"facebook_custom":this.shareFacebook();break;case"reddit_custom":this.shareReddit();break;case"digg_custom":this.shareDigg();break;case"tumblr_custom":this.shareTumblr();break;case"stumbleupon_custom":this.shareStumbleupon();break;case"googleplus_custom":this.shareGoogleplus();break;case"pinterest_custom":this.sharePinterest();break;case"st_email_custom":this.shareEmail();break;case"addthis_custom":this.shareAddthis()}},this)),$(document.body).on("hover",".addthis_button",_.bind(function(){this.initAddthis()},this))},bindAddthisButton:function(){try{window.addthis.button("."+this._.shareButtonClass)}catch(a){}},setupAddthis:function(){try{window.addthis.ost=0,window.addthis.addEventListener("addthis.menu.open",_.bind(function(a){this.addthisOpen(a)},this)),window.addthis.addEventListener("addthis.menu.share",_.bind(function(a){this.logSharePostAddthis(a.data.service)},this)),window.addthis.ready(),clearTimeout(this._.addthisTimeout)}catch(a){this._.addthisTimeout=setTimeout(_.bind(this.setupAddthis,this),100)}},addthisOpen:function(a){a.data.share||(a.data.share={}),a.data.share.url=this._.shareData.url},logShare:function(a){this._.resetUrl&&this.resetShareData();try{addthis_share.url=this._.shareData.url,window.addthis.share.track(a,0,addthis_share,window.addthis_config)}catch(b){this.logSharePostAddthis(a)}},logSharePostAddthis:function(a){var b=this._.shareData.url;switch(a){case"google_plusone_share":a="googleplus";break;default:a=a.replace(/_share$/,"")}this._.shareData.jafoMeta.hash&&$.post("//"+this._.host+"/share/share",{hash:this._.shareData.jafoMeta.hash});var b=this._.shareData.url;Imgur.Util.jafoLog({event:"share",meta:_.merge({shareTo:a},this._.shareData.jafoMeta)});try{window.dataLayer=window.dataLayer||[],window.dataLayer.push({socialNetwork:a,socialAction:"share",socialTarget:b,event:"social"})}catch(c){}},getShareTitle:function(){return this._.shareData.title||this._setShareTitle(),this._.shareData.title},shareTwitter:function(){this.logShare("twitter"),Imgur.Util.newWindow("http://twitter.com/share?url="+encodeURIComponent(this._.shareData.url)+"&text="+encodeURIComponent(this.getShareTitle())+"&via=imgur",550,425)},shareFacebook:function(){this.logShare("facebook"),Imgur.Util.newWindow("http://www.facebook.com/sharer.php?u="+encodeURIComponent(this._.shareData.url),755,425)},shareReddit:function(){this.logShare("reddit"),Imgur.Util.newWindow("http://reddit.com/submit?url="+encodeURIComponent(this._.shareData.url)+"&title="+encodeURIComponent(this.getShareTitle()))},shareDigg:function(){this.logShare("digg"),Imgur.Util.newWindow("http://digg.com/submit?phase=2&url="+encodeURIComponent(this._.shareData.url),1060,655)},shareTumblr:function(){this.logShare("tumblr");var a=$('link[rel="image_src"]').attr("href");if(a)var b="http://www.tumblr.com/share/photo?source="+encodeURIComponent(a)+"&caption="+encodeURIComponent(this.getShareTitle())+"&click_thru="+encodeURIComponent(this._.shareData.url);else var b="http://www.tumblr.com/share/link?url="+encodeURIComponent(this._.shareData.url)+"&name="+encodeURIComponent(this.getShareTitle())+"&description="+encodeURIComponent($('meta[name="description"]').attr("content"));Imgur.Util.newWindow(b,450,430)},shareStumbleupon:function(){this.logShare("stumbleupon"),Imgur.Util.newWindow("http://www.stumbleupon.com/submit?url="+encodeURIComponent(this._.shareData.url),1060,500)},shareGoogleplus:function(){this.logShare("googleplus"),Imgur.Util.newWindow("https://plus.google.com/share?url="+encodeURIComponent(this._.shareData.url),520,500)},sharePinterest:function(){this.logShare("pinterest");var a=$('link[rel="image_src"]').attr("href");Imgur.Util.newWindow("http://pinterest.com/pin/create/button/?url="+encodeURIComponent(this._.shareData.url)+"&description="+encodeURIComponent(this.getShareTitle())+"&media="+a,800,340)},shareEmail:function(){},shareAddthis:function(){this.initAddthis(!0)}}),Class.addSingleton(Imgur.ShareButtons),Namespace("Imgur.Caption"),Imgur.Caption=Imgur.extend({sid:$("#sid").val(),init:function(a){this._=$.extend({sid:Imgur.getInstance()._.sid,auth_id:Imgur.Environment.auth.id,signed:Imgur.Environment.signed,baseURL:"/gallery",hash:null,popEventState:"comment",el:{$captions:$("#captions")},$captions:$("#captions"),children:"children",counterClass:".counter",captionBarClass:"caption-bar",commentName:"comment",userCommentsClass:".comment-item",mobile:!1,showRepliesCount:!1,captions:{}},a),this._super(this._)},setupHandlers:function(){Imgur.ShareButtons.getInstance().bindButtons()},addDownvoteLimit:function(){clearTimeout(this._.timeout),$(".caption .arrow.down").unbind("click"),$(".caption .arrow.down").attr("title","Downvoting on this image has been disabled for one minute because you made a comment."),$(".caption .arrow.down").tipsy({gravity:"nw",opacity:1
})},removeDownvoteLimit:function(){var a=this;$(".caption .arrow").unbind("click"),$(".caption .arrow.down").unbind("hover"),$(".tipsy").remove(),$(".caption .arrow.down").attr("title","dislike"),$(".caption .arrow").click(function(b){a.vote(b)})},haveCaptionVotes:function(a){return a in this._.captions&&"votes"in this._.captions[a]},haveCaptions:function(a){return a in this._.captions&&"set"in this._.captions[a]},deleteCaption:function(a,b){this.haveCaptions(a)&&b in this._.captions[a].set&&(this._.captions[a].set[b].deleted=!0,this._.captions[a].set[b].just_deleted=!0)},undeleteCaption:function(a,b){this._.captions[a].set[b].deleted=!1,this._.captions[a].set[b].just_deleted=!1},getCaptionDepthById:function(a,b){if(b=Number(b),this.haveCaptions(a)&&b in this._.captions[a].set){for(var c=[],d=0,e=b;null!=e&&!(e in c);){c.push(e);var f=this._.captions[a].set[e];if(f&&f.hasOwnProperty("depth"))return d+f.depth;e=this._.captions[a].parent[e],d++}return d-1}},countComments:function(a){return this.haveCaptions(a)?Object.keys(this._.captions[a].set).length:null},getCaptionRepliesById:function(a,b){if(b=Number(b),this.haveCaptions(a)&&b in this._.captions[a].set)return _.filter(_.values(this._.captions[a].parent),function(a){return a===b}).length},getCaptionById:function(a,b){return b=Number(b),this.haveCaptions(a)&&b in this._.captions[a].set?this._.captions[a].set[b]:null},getCaptionPropertyById:function(a,b,c){return b=Number(b),this.haveCaptions(a)&&b in this._.captions[a].set&&c in this._.captions[a].set[b]?this._.captions[a].set[b][c]:null},getCaptionParentById:function(a,b){return b=Number(b),this.haveCaptions(a)&&b in this._.captions[a].parent?this._.captions[a].parent[b]:null},getParentIds:function(a){return this.haveCaptions(a)?_.uniq(_.values(this._.captions[a].parent)):[]},getCaptionChildrenIds:function(a,b){return b=b,this.haveCaptions(a)&&b in this._.captions[a].children?this._.captions[a].children[b]:[]},getCaptionIdsByFilter:function(a,b){if(!this.haveCaptions(a))return[];var c=[];return jQuery.each(this._.captions[a].set,function(a,d){b(d)&&c.push(a)}),c},mergeCaptions:function(a,b,c){var d=this;a in this._.captions?"set"in this._.captions[a]||(d._.captions[a].set={},d._.captions[a].parent={},d._.captions[a].children={}):d._.captions[a]={set:{},parent:{},children:{},votes:{}},jQuery.each(b,function(b,c){c.parent_id=Number(c.parent_id),c.id=Number(c.id),c.points=Number(c.points),c.visible_points=Number(c.points),0===c.parent_id&&(c.parent_id=null),d._.captions[a].set[c.id]=c,d._.captions[a].parent[c.id]=c.parent_id,c.parent_id in d._.captions[a].children||(d._.captions[a].children[c.parent_id]=[]),c.just_inserted?d._.captions[a].children[c.parent_id].unshift(c.id):d._.captions[a].children[c.parent_id].push(c.id)}),c&&c()},mergeCaption:function(a,b){this.mergeCaptions(a,[b])},mergeVotes:function(a,b,c){var d=this;b&&(this.haveCaptionVotes(a)||(a in this._.captions?this._.captions[a].votes={}:this._.captions[a]={parent:{},votes:{}}),jQuery.each(b,function(b,c){d._.captions[a].votes[c.caption_id]=c.vote}),c&&c())},getVotes:function(a){return this.haveCaptionVotes(a)?this._.captions[a].votes:{}},setVote:function(a,b,c){var d=this._.captions[a].votes[b];void 0!==d&&null!==d||(d="veto"),this._.captions[a].votes[b]=c;var e=this._.captions[a].set[b].visible_points,f={up:1,veto:0,down:-1},g=e-f[d],h=g+f[c];this._.captions[a].set[b].visible_points=h},getVoteByCaptionId:function(a,b){return this.haveCaptionVotes(a)&&b in this._.captions[a].votes?this._.captions[a].votes[b]:null},isCaptionOrItsSubtreeNSFW:function(a){var b=this._.captions[this._.hash].set;if(b.hasOwnProperty(a)){var c=b[a],d=_.filter(Object.keys(this._.captions[this._.hash].parent),_.bind(function(b){return!(this._.captions[this._.hash].set[b].points<0)&&("Mature"!==Imgur.InsideNav.getInstance()._.topic&&(this._.captions[this._.hash].parent[b]===a&&this._.captions[this._.hash].set[b].caption.match(/nsfw/gi)))},this));return c.caption.match(/nsfw/gi)||d.length}return!1},setCaptionVoteState:function(a){var b=["up","down"],c=a.vote,d=$(document.getElementById("caption-"+a.caption_id)).find(".arrows *");if("veto"==c)d.removeClass("pushed");else{var e=b[1-b.indexOf(c)],f=(d.filter(".up"),d.filter(".down"),d.filter("."+c)),g=d.filter("."+e);f.hasClass("pushed")||f.addClass("pushed"),g.removeClass("pushed")}return!0},purgeCaptionData:function(a){var b=this,c=Object.keys(this._.captions).filter(function(c){return Object.hasOwnProperty.call(b._.captions,c)&&a.indexOf(c)===-1});jQuery.each(c,function(a,c){delete b._.captions[c]})}}),Class.addSingleton(Imgur.Caption),Namespace("Imgur.Elements"),Imgur.Elements.Combobox=React.createClass({displayName:"Combobox",propTypes:{name:React.PropTypes.string.isRequired,value:React.PropTypes.string.isRequired,onChange:React.PropTypes.func.isRequired},getInitialState:function(){return{value:this.props.value}},componentDidMount:function(){$(this.refs.base).combobox({onChange:_.bind(function(a,b){switch(a){case this.props.name:var c=$(this.refs.base).find(".selection").text();this.props.onChange(c,b),this.setState({value:c})}},this)})},render:function(){return React.DOM.div({id:this.props.name,className:"combobox "+this.props.className,ref:"base",name:this.props.name},React.DOM.div({className:"selection"+(this.state.value==this.props.defaultValue?" default":" green")},this.state.value),React.DOM.div({className:"triangle"},""),React.DOM.div({className:"options"},this.props.defaultValue?React.DOM.div({className:"combobox-header"},this.props.defaultValue):"",_.map(this.props.values,_.bind(function(a){return React.DOM.div({className:"item "+(this.state.value==a.label?"selected":""),"data-value":a.value,key:a.label},a.label)},this))))}}),Namespace("Imgur.Elements"),Imgur.Elements.Confirm=React.createClass({displayName:"Elements-Confirm",handleNo:function(a){a.preventDefault(),this.props.handleNo()},handleYes:function(a){a.preventDefault(),this.props.handleYes()},render:function(){var a=this.props.yesButtonText||"I'm sure",b=this.props.noButtonText||"Cancel";return React.createElement("div",{className:"popup"},React.createElement("div",{className:"textbox",dangerouslySetInnerHTML:{__html:this.props.message}}),React.createElement("div",{className:"margin-top cf"},React.createElement("div",{className:"right btn-confirm-yes "+this.props.yesButtonClass},React.createElement("a",{ref:"yes",href:"",onClick:this.handleYes},a)),React.createElement("div",{className:"right btn-confirm-no"},React.createElement("a",{ref:"no",href:"",onClick:this.handleNo},b))))}}),Namespace("Imgur.Elements"),Imgur.Elements.PopupMenu=React.createClass({displayName:"PopupMenu",componentWillUnmount:function(){$("body").off("click",this.handleBodyClick)},getInitialState:function(){return{opened:!1}},handleBodyClick:function(a){this.setState({opened:!1})},handleMenuClick:function(a){a.stopPropagation(),"function"==typeof this.props.menuClick&&this.props.menuClick(!this.state.opened),this.setState({opened:!this.state.opened},_.bind(function(){this.state.opened?$("body").on("click",this.handleBodyClick):$("body").off("click",this.handleBodyClick)},this))},handleChildClick:function(a){a.stopPropagation()},render:function(){return React.DOM.div({onClick:this.handleMenuClick,className:this.props.className+" like-combobox-but-not "+(this.state.opened?" opened":"")},React.DOM.span({},this.props.name),React.DOM.span({className:this.props.afterNameIcon}),React.DOM.div({className:"options"},React.DOM.div({onClick:this.handleChildClick},this.props.children)))}}),Namespace("Imgur.Comment"),Imgur.Comment=React.createClass({displayName:"Comment",_isMounted:!0,propTypes:{childmap:React.PropTypes.object.isRequired,contextids:React.PropTypes.object.isRequired,image:React.PropTypes.object.isRequired,comment:React.PropTypes.object.isRequired,votable:React.PropTypes.bool.isRequired,votemap:React.PropTypes.object,onSubmit:React.PropTypes.func,expanded:React.PropTypes.bool,haveChildren:React.PropTypes.bool,touchEnabled:React.PropTypes.bool.isRequired,forceRenderParent:React.PropTypes.func},getDefaultProps:function(){return{forceRenderParent:function(){}}},contextTypes:{msid:React.PropTypes.string.isRequired,onContextChange:React.PropTypes.func.isRequired,linkifier:React.PropTypes.object.isRequired,onVoteChange:React.PropTypes.func},getInitialState:function(){return{showingReply:!1,reported:!1}},componentWillUnmount:function(){this._isMounted=!1},componentWillUpdate:function(a){this.props.comment.id==a.comment.id&&this.props.comment.visible_points!=a.comment.visible_points&&this.refs.visible_points&&this.refs.visible_points.classList.add("post-action-stats-points--fade")},componentDidUpdate:function(){setTimeout(function(){this.refs.visible_points&&this.refs.visible_points.classList.remove("post-action-stats-points--fade")}.bind(this),150)},handleReplyClicked:function(){Imgur.Util.jafoLog({event:"newComment",meta:{parentId:this.props.comment.parent_id,hash:this.props.comment.hash,state:"initiated"}}),this.setState({showingReply:!0})},handleReplySuccess:function(){this.setState({showingReply:!1}),this.props.onSubmit&&this.props.onSubmit()},handlePermalinkClick:function(a){a.stopPropagation(),this.context.onContextChange(a,this.props.comment.id,0),Imgur.Util.jafoLogEvent(Imgur.AnalyticCategories.SHARE,Imgur.AnalyticEventNames.selected,{Type:"Permalink"})},handleContextClick:function(a){a.stopPropagation(),this.context.onContextChange(a,this.props.comment.id,1),Imgur.Util.jafoLog({event:"contextInvoked",meta:{type:"comment",commentId:this.props.comment.id,hash:this.props.comment.hash,isAlbum:this.props.comment.on_album,nsfw:this.props.image.nsfw,parentId:this.props.comment.parent_id}})},handleShareClick:function(a){Imgur.Util.jafoLog({event:"shareInvoked",meta:{type:"comment",commentId:this.props.comment.id,hash:this.props.comment.hash,isAlbum:this.props.comment.on_album,nsfw:this.props.image.nsfw,parentId:this.props.comment.parent_id}});var b=window.location.protocol+"//"+Imgur.Environment.host+Imgur.Environment.baseURL+"/"+this.props.comment.hash+"/comment/"+this.props.comment.id,c=this.props.comment.author+" comments on '"+this.props.image.title+"' - Imgur",d=Imgur.ShareButtons.getInstance();d.setShareData({jafoMeta:_.extend(Imgur.Gallery.getInstance().getGalleryMetadata(),{type:"comment",hash:this.props.comment.hash,isAlbum:this.props.comment.on_album,inGallery:!0,commentId:this.props.comment.id,parentId:this.props.comment.parent_id}),title:c,url:b})},handleMobileIconClick:function(a){Imgur.Util.jafoLog({event:"viaAppIcon",meta:{type:"comment",commentId:this.props.comment.id,platform:this.props.comment.platform}})},handleDeleteClick:function(a){var b="Are you sure you want to delete this comment?";confirm(b)&&($.ajax({url:"/gallery/action/delete_caption/"+this.props.comment.id,type:"POST",data:{sid:this.context.msid}}).fail(_.bind(function(){Imgur.Caption.getInstance().undeleteCaption(this.props.comment.hash,this.props.comment.id),this._isMounted&&this.forceUpdate()},this)),Imgur.Caption.getInstance().deleteCaption(this.props.comment.hash,this.props.comment.id),Imgur.Util.jafoLogEvent(Imgur.AnalyticCategories.POST,Imgur.AnalyticEventNames.commentInteracted,{Type:"Delete"}),this.props.forceRenderParent())},handleWarnDeleteClick:function(a){var b="main",c="Are you sure you want to delete this comment and warn the user?";confirm(c)&&$.ajax({url:"/adm/removals/delete",type:"POST",data:{type:b,reason:1,caption:this.props.comment.id,shouldWarn:!0,sid:this.context.msid}}).success(_.bind(function(a){Imgur.Caption.getInstance().deleteCaption(this.props.comment.hash,this.props.comment.id),this.props.forceRenderParent()},this)).fail(_.bind(function(){Imgur.Caption.getInstance().undeleteCaption(this.props.comment.hash,this.props.comment.id),this._isMounted&&this.forceUpdate()},this))},handleMatureClick:function(a){$.ajax({url:"/adm/removals/delete",type:"POST",data:{caption:this.props.comment.id,type:"main",reason:4,shouldWarn:!0,sid:this.context.msid}}).success(_.bind(function(a){Imgur.Caption.getInstance().deleteCaption(this.props.comment.hash,this.props.comment.id),this.props.forceRenderParent()},this)).fail(_.bind(function(){Imgur.Caption.getInstance().undeleteCaption(this.props.comment.hash,this.props.comment.id),this._isMounted&&this.forceUpdate()},this))},handleMuteUserClick:function(a){Imgur.Environment.auth.id?$.colorbox({html:'<div id="mute-container"></div>',open:!0,top:"10%",transition:"none",scrolling:!1,fixed:!0,width:Imgur.Elements.Mute.dimensions.width,height:Imgur.Elements.Mute.dimensions.height,className:"noBorder",close:"",onComplete:_.bind(function(){var a=window.ReactDOM||window.React;a.render(React.createElement(Imgur.Elements.Mute,{url:"https://api."+Imgur.Environment.host+"/account/v1/"+this.props.comment.author+"/block?type=comment&id="+this.props.comment.id,type:Imgur.Elements.Mute.types.comment}),$("#mute-container").get(0))},this)}):Imgur.getInstance().signin("Action - Mute")},handleReportClick:function(a){var b={type:"comment",commentId:this.props.comment.id,hash:this.props.comment.hash,isAlbum:this.props.comment.on_album,nsfw:this.props.image.nsfw};Imgur.Environment.auth.id?$.colorbox({html:'<div id="report-container"></div>',open:!0,top:"10%",transition:"none",scrolling:!1,fixed:!0,width:Imgur.Elements.Report.dimensions.width,height:Imgur.Elements.Report.dimensions.height,className:"noBorder",close:"",onComplete:_.bind(function(){var a=window.ReactDOM||window.React;a.render(React.createElement(Imgur.Elements.Report,{type:Imgur.Elements.Report.types.comment,url:"/gallery/action/report_caption/"+this.props.comment.id,metadata:b,cb:_.bind(function(){this.setState({reported:!0})},this)}),$("#report-container").get(0))},this),onClosed:_.bind(function(){Imgur.Gallery.getInstance()._.preventReportCloseAnalytics||Imgur.Util.jafoLog({event:"reportCancel",meta:_.extend({method:"modal"},b)}),Imgur.Gallery.getInstance().resetReportCloseAnalytics()},this)}):Imgur.getInstance().signin("Action - Report")},handleUpvoteClick:function(){var a=this.props.votemap[this.props.comment.id];"up"===a?this._vote("veto"):this._vote("up")},handleDownvoteClick:function(){var a=this.props.votemap[this.props.comment.id];"down"===a?this._vote("veto"):this._vote("down")},_vote:function(a){Imgur.Environment.signed||Imgur.getInstance().signin({invokedRegisterSigninBy:"Action - Vote",type:"comment"});var b=Imgur.InsideNav&&Imgur.InsideNav.getInstance().getHash()?"inside":"outside";Imgur.Caption.getInstance().setVote(this.props.comment.hash,this.props.comment.id,a),this.context.onVoteChange(this.props.comment,a),$.ajax({url:"/gallery/action/vote/"+this.props.comment.id,type:"POST",data:{vote:a,sid:this.context.msid,type:"caption",location:b,gallery:Imgur.Gallery.getInstance().getGalleryMetadata()}});const c={up:"Upvote",down:"Downvote",veto:"Veto"};Imgur.Util.jafoLogEvent(Imgur.AnalyticCategories.POST,Imgur.AnalyticEventNames.commentInteracted,{Type:c[a]})},_nthIfy:function(a){return 1===a?"1st":2===a?"2nd":3===a?"3rd":String(a)+"th"},handleUserProfileClick:function(){Imgur.Util.jafoLog({event:"userProfileNav",meta:{accountId:this.props.comment.author_id,method:"usernameComment"}})},handleMenuClick:function(a){a&&Imgur.Util.jafoLog({event:"moreMenuInvoked",meta:{commentId:this.props.comment.id,hash:this.props.comment.hash,isAlbum:this.props.comment.on_album,nsfw:this.props.image.nsfw,parentId:this.props.comment.parent_id}})},closeReply:function(){this.setState({showingReply:!1})},render:function(){var a,b=0;if(this.props.comment.id in this.props.childmap&&this.props.haveChildren&&(b=this.props.childmap[this.props.comment.id].length,b>0)){var c=React.DOM.span({key:"reply-vertical",className:"comment-reply-icon "+(this.props.expanded?"":" comment-reply-icon--vertical")}),d=this.props.expanded?" Collapse":" "+b+(b>1?" replies":" reply");a=React.DOM.span({className:"comment-reply-count"},React.DOM.span({className:"comment-reply-icon"}),c,React.DOM.span({className:"comment-reply-count-text"},d))}var e="up"==this.props.votemap[this.props.comment.id],f="down"==this.props.votemap[this.props.comment.id],g=classNames({"comment-vote":!0,"icon-upvote-fill":!0,green:e}),h=classNames({"comment-vote":!0,"icon-downvote-fill":!0,red:f}),i=React.DOM.div({className:"comment-votes"+(this.props.touchEnabled?" touch":"")},this.props.comment.deleted?"":React.DOM.div({className:"comment-votes-wrapper"},this.props.votable?React.createElement(Imgur.Elements.PressButton,{onPress:this.handleUpvoteClick,className:g}):"",this.props.votable?React.createElement(Imgur.Elements.PressButton,{onPress:this.handleDownvoteClick,className:h}):"")),j=this.props.comment.best_comment?React.DOM.span({className:"caption-awards right title"},this._nthIfy(this.props.comment.best_comment)):null,k=classNames({caption:!0,pointer:this.props.haveChildren,"caption--haschildren":this.props.haveChildren,"caption-deleted":this.props.comment.deleted,"caption-deleted--noreply":this.props.comment.just_deleted&&!this.props.haveChildren,unvotable:!this.props.votable,contexted:this.props.comment.id in this.props.contextids}),l=classNames({usertext:!0,cf:!0,"comment-upvoted":e,"comment-downvoted":f}),m=this.props.comment.caption;m=this.context.linkifier.grab(m,!0);var n=1===this.props.comment.visible_points?" pt":" pts",o=null,p={iphone:"iPhone",android:"Android"},q=Object.keys(p);return q.indexOf(this.props.comment.platform)>-1&&(o=React.DOM.span({className:"via"}," via ",React.DOM.a({href:"/apps",target:"_blank",onClick:this.handleMobileIconClick},p[this.props.comment.platform],React.DOM.span({className:"icon icon-mobile"},null)))),React.DOM.div({className:k,"data-id":this.props.comment.id},React.DOM.div({className:l},j,React.DOM.div({className:"author"},React.DOM.a({className:"comment-username",href:"/user/"+this.props.comment.author,title:this.props.comment.author,onClick:this.handleUserProfileClick},this.props.comment.author),this.props.image.account_id&&this.props.image.account_id===this.props.comment.author_id&&!this.props.comment.deleted?React.DOM.span({className:"comment-op"},"OP"):"",o,this.props.comment.has_admin_badge?React.DOM.a({className:"comment-meta-spacer comment-admin-badge",href:"https://help.imgur.com/hc/en-us/articles/360038529112",target:"_blank"},"Admin"):"",React.DOM.span({ref:"visible_points",className:this.props.comment.deleted?"":"comment-meta-spacer"},Imgur.Util.numberFormat(this.props.comment.visible_points)+n),React.createElement(Imgur.Elements.Timestamp,{classNames:"comment-meta-spacer",shouldUpdate:!1,timestamp:this.props.comment.datetime}),React.createElement(Imgur.Elements.PopupMenu,{className:"icon-ellipses caption-toolbar edit-button comment-meta-spacer",menuClick:this.handleMenuClick},React.DOM.div({onClick:this.handleShareClick,className:"addthis_button item share-caption-link"},"Share"),React.DOM.a({onClick:this.handlePermalinkClick,className:"item permalink-caption-link",href:"/gallery/"+this.props.comment.hash+"/comment/"+this.props.comment.id},"Permalink"),null!=this.props.comment.parent_id?React.DOM.a({onClick:this.handleContextClick,className:"item context-caption-link",href:"/gallery/"+this.props.comment.hash+"/comment/"+this.props.comment.id+"/1"},"Context"):"",Number(this.props.comment.author_id)!==Imgur.Environment.auth.id?React.DOM.div({onClick:this.handleMuteUserClick,className:"item"},"Mute User"):"",this.state.reported||1==$.cookie("c"+this.props.comment.id)?React.DOM.div({className:"item report-caption-link red"},"Reported"):React.DOM.div({onClick:this.handleReportClick,className:"item report-caption-link"},"Report"),Imgur.Environment.signed&&(Imgur.Environment.isAdmin||Imgur.Environment.isGalleryAdmin||Imgur.Environment.isGalleryModerator)?React.DOM.div({onClick:this.handleWarnDeleteClick,className:"item warn-caption-link"},"Warn"):"",Imgur.Environment.signed&&(Imgur.Environment.isAdmin||Imgur.Environment.isGalleryAdmin||Imgur.Environment.isGalleryModerator)&&!this.props.image.nsfw?React.DOM.div({onClick:this.handleMatureClick,className:"item mature-caption-link"},"Mature"):"",Imgur.Environment.signed&&(Number(this.props.comment.author_id)===Imgur.Environment.auth.id||Imgur.Environment.isGalleryAdmin||Imgur.Environment.isGalleryModerator)?React.DOM.a({onClick:this.handleDeleteClick,className:"item delete-caption-link red",href:"javascript:void(0)"},"Delete"):"")),m,this.props.comment.deleted?"":React.DOM.div({className:"comment-create-reply",onClick:this.handleReplyClicked},React.DOM.div({className:"comment-create-reply-wrapper"},React.DOM.div({className:"icon-reply"}),React.DOM.div({},"Reply")))),this.state.showingReply||!this.props.haveChildren||this.props.expanded?"":React.DOM.div({className:"caption-gradient-wrapper"},React.DOM.div({className:"caption-gradient"})),i,a,this.state.showingReply?React.createElement(Imgur.Caption.Reply,{autofocus:!0,ref:"reply",image:this.props.image,parentId:this.props.comment.id,parentAuthorId:Number(this.props.comment.author_id),onSuccess:this.handleReplySuccess,onClose:this.closeReply}):"")}}),Namespace("Imgur.Comment"),Imgur.CommentTree=React.createClass({statics:{EXPAND_MODE_FORCE_COLLAPSED:-1,EXPAND_MODE_DEFAULT_COLLAPSED:0,EXPAND_MODE_FORCE_EXPANDED:1},displayName:"CommentTree",mixins:[React.addons.PureRenderMixin],propTypes:{comment:React.PropTypes.object.isRequired,image:React.PropTypes.object.isRequired,expandMode:React.PropTypes.number.isRequired,expandedFromPermalink:React.PropTypes.bool.isRequired,groupingBadReplies:React.PropTypes.bool.isRequired,contextids:React.PropTypes.object.isRequired,childmap:React.PropTypes.object.isRequired,votemap:React.PropTypes.object.isRequired,level:React.PropTypes.number,maxLevel:React.PropTypes.number,votable:React.PropTypes.bool},contextTypes:{onContextChange:React.PropTypes.func.isRequired},getInitialState:function(){return{removing:!1,expanded:this.props.expandMode===Imgur.CommentTree.EXPAND_MODE_FORCE_EXPANDED||this.props.expandedFromPermalink}},getDefaultProps:function(){return{level:0,maxLevel:7,votable:!0}},componentWillReceiveProps:function(a){(this.props.expandMode!=a.expandMode||a.expandedFromPermalink)&&(this.state.expanded&&a.expandMode<=Imgur.CommentTree.EXPAND_MODE_FORCE_COLLAPSED?this.setState({expanded:!1}):(!this.state.expanded&&a.expandMode===Imgur.CommentTree.EXPAND_MODE_FORCE_EXPANDED||a.expandedFromPermalink)&&this.setState({expanded:!0}))},handleCommentClick:function(a){var b=$(a.target);if(!b.is("a, button")&&!b.closest(".comment-create-reply").length&&b.closest(".usertext, .comment-reply-count").length){var c=this.props.comment.id in this.props.childmap,d={commentId:this.props.comment.id,hash:this.props.comment.hash,isAlbum:this.props.comment.on_album,nsfw:this.props.image.nsfw,parentId:this.props.comment.parent_id,location:$(a.target).closest(".comment-reply-count").length?"collapseLink":"commentBox"},d={commentId:this.props.comment.id,hash:this.props.comment.hash,isAlbum:this.props.comment.on_album,nsfw:this.props.image.nsfw,parentId:this.props.comment.parent_id};a.stopPropagation(),this.setState({removing:this.state.expanded},_.bind(function(){this.setState({removing:!1,expanded:!this.state.expanded})},this)),this.state.expanded===!1&&c===!0?Imgur.Util.jafoLog({event:"commentExpandInvoked",meta:d}):this.state.expanded===!0&&c===!0&&Imgur.Util.jafoLog({event:"commentCollapseInvoked",meta:d})}},handleSubmit:function(){this.setState({expanded:!0})},handleLoadMoreClicked:function(a){this.context.onContextChange(a,this.props.comment.id,0)},render:function(){var a,b=this.props.comment.id in this.props.childmap,c=this.props.childmap[this.props.comment.id]&&this.props.childmap[this.props.comment.id].length||0;this.props.level<this.props.maxLevel?this.state.expanded&&(a=React.createElement(Imgur.CommentList,{image:this.props.image,contextids:this.props.contextids,childmap:this.props.childmap,votemap:this.props.votemap,expandMode:this.props.expandMode,expandedFromPermalink:this.props.expandedFromPermalink,groupingBadReplies:this.props.groupingBadReplies,level:this.props.level+1,parent_id:this.props.comment.id,votable:this.props.votable,removing:this.state.removing,touchEnabled:this.props.touchEnabled})):b&&(a=React.DOM.a({className:"load-more",href:"javascript:void(0)",onClick:this.handleLoadMoreClicked},"load more"));var d=classNames({comment:!0,expanded:this.state.expanded});return React.DOM.div({onKeyDown:this.handleKeyDown,"data-level":this.props.level,onClick:this.handleCommentClick,className:d},React.createElement(Imgur.Comment,{childmap:this.props.childmap,contextids:this.props.contextids,votemap:this.props.votemap,image:this.props.image,comment:_.extend({},this.props.comment),votable:this.props.votable,onSubmit:this.handleSubmit,expanded:this.state.expanded,haveChildren:b&&this.props.level<this.props.maxLevel&&c>0,level:this.props.level,collapsing:this.state.removing,touchEnabled:this.props.touchEnabled,forceRenderParent:this.forceUpdate.bind(this)}),React.createElement(React.addons.CSSTransitionGroup,{key:"just-collapsed-"+this.props.image.hash,transitionName:"collapsetree",transitionEnter:!1,transitionLeaveTimeout:250},a))}}),Namespace("Imgur"),Imgur.CommentList=React.createClass({RENDERED_AT_A_TIME:20,displayName:"CommentList",mixins:[React.addons.PureRenderMixin],propTypes:{image:React.PropTypes.object.isRequired,contextids:React.PropTypes.object.isRequired,childmap:React.PropTypes.object.isRequired,votemap:React.PropTypes.object.isRequired,level:React.PropTypes.number.isRequired,expandMode:React.PropTypes.number.isRequired,expandedFromPermalink:React.PropTypes.bool.isRequired,groupingBadReplies:React.PropTypes.bool.isRequired,parent_id:React.PropTypes.number},getInitialState:function(){return{rendered:this.RENDERED_AT_A_TIME,bad_comments:!1,truncatingForRecommendations:!0}},_getChildrenIds:function(){return this.props.parent_id in this.props.childmap?this.props.childmap[this.props.parent_id]:[]},componentDidUpdate:function(){this._checkNeedToRenderMore()},componentDidMount:function(){this._mounted=!0,this._listener=_.throttle(this._checkNeedToRenderMore,50),$(window).on("scroll",this._listener),this._checkNeedToRenderMore()},componentWillUnmount:function(){$(window).off("scroll",this._listener),this._mounted=!1},toggleShowingBadComments:function(a){a.stopPropagation(),this.setState({bad_comments:!this.state.bad_comments})},_checkNeedToRenderMore:function(){if(this._mounted){var a=this._getChildrenIds();if(a.length>0&&a.length>this.state.rendered){var b=$(ReactDOM.findDOMNode(this.refs.last));b.is(":in-viewport")&&this.setState({rendered:this.state.rendered+this.RENDERED_AT_A_TIME})}}},_handleBadCaptionsContainerClick:function(a){a.stopPropagation()},render:function(){var a=this.props.image.hash,b=[],c=[],d=[],e=this._getChildrenIds(),f=!1;if(!this.props.removing)for(var g=0;g<Math.min(e.length,this.state.rendered);g++){var h=Imgur.Caption.getInstance().getCaptionById(a,e[g]),i={comment:h,image:this.props.image,key:h.id,level:this.props.level,expandMode:this.props.expandMode,expandedFromPermalink:this.props.expandedFromPermalink,contextids:this.props.contextids,childmap:this.props.childmap,votemap:this.props.votemap,votable:!0,groupingBadReplies:this.props.groupingBadReplies,touchEnabled:this.props.touchEnabled};g==Math.min(e.length,this.state.rendered)-1&&(i.ref="last"),h.points>=0||!this.props.groupingBadReplies?h.just_inserted?d.push(React.createElement(Imgur.CommentTree,i)):b.push(React.createElement(Imgur.CommentTree,i)):(c.push(React.createElement(Imgur.CommentTree,i)),f=!0)}var j=null;return this.state.truncatingForRecommendations&&this.props.inRecommendationsExperiment&&null===this.props.parent_id&&(j=b.length>5?React.DOM.button({className:"btn btn-grey",style:{margin:"0 auto",display:"block"},onClick:function(){this.setState({truncatingForRecommendations:!1})}.bind(this)},"Show More Comments"):null,b=b.slice(0,5)),React.DOM.div({className:"children"},React.createElement(React.addons.CSSTransitionGroup,{key:"just-inserted-"+this.props.image.hash,transitionName:"newcomment",transitionEnterTimeout:500,transitionLeave:!1},d),React.createElement(React.addons.CSSTransitionGroup,{key:"just-expanded-"+this.props.image.hash,transitionName:"expandcomment",transitionAppear:!0,transitionEnter:!1,transitionAppearTimeout:250,transitionLeaveTimeout:250},b,React.DOM.div({onClick:this._handleBadCaptionsContainerClick,className:"bad-captions "+(f?"":"nodisplay")},React.DOM.a({onClick:this.toggleShowingBadComments,href:"javascript:void(0)",className:"link"},(this.state.bad_comments?"hide":"show")+" bad replies"),React.DOM.div({className:this.state.bad_comments?"":"nodisplay"},c)),j))}}),Namespace("Imgur"),Imgur.InsideCommentsArea=React.createClass({displayName:"InsideCommentArea",propTypes:{image:React.PropTypes.object.isRequired,loading:React.PropTypes.bool.isRequired,defaultExpandMode:React.PropTypes.number.isRequired,expandedFromPermalink:React.PropTypes.bool.isRequired,childmap:React.PropTypes.object.isRequired,commentSort:React.PropTypes.string.isRequired,onCommentSortChange:React.PropTypes.func.isRequired,contextId:React.PropTypes.number,contextLevels:React.PropTypes.number,permalink:React.PropTypes.object},contextTypes:{onContextChange:React.PropTypes.func.isRequired},mixins:[React.addons.PureRenderMixin],handleClickPermalinkViewRestBanner:function(a){a.preventDefault(),this.context.onContextChange(a,void 0,void 0)},getInitialState:function(){return{commentReplyNumber:0,expandMode:this.props.defaultExpandMode,expandedFromPermalink:this.props.expandedFromPermalink,forceCollapsed:!1,touchEnabled:!!this.touchEnabled()}},touchEnabled:function(){return"ontouchstart"in window||navigator.maxTouchPoints},componentDidMount:function(){var a=$(ReactDOM.findDOMNode(this).parentNode);a.hasClass("comments-initialized")||a.addClass("comments-initialized"),$(document).on("keyup",this.handleDocumentKeyUp),this.props.emitter.on("pointUpdate",this,function(a){if("comment"===a.type){const b=Imgur.Caption.getInstance().getCaptionById(this.props.image.hash,a.comment);b&&b.visible_points!=a.points&&(b.visible_points=a.points,this.forceUpdate())}}.bind(this))},componentWillUnmount:function(){$(ReactDOM.findDOMNode(this).parentNode);$(document).off("keyup",this.handleDocumentKeyUp)},componentWillReceiveProps:function(a){this.props.contextId!==a.contextId&&a.contextId?this.setState({expandedFromPermalink:!0}):this.setState({expandedFromPermalink:!1}),this.props.image.hash===a.image.hash&&this.props.image.is_album===a.image.is_album||this.setState({showingReply:!0})},handleClickToggleForceExpanded:function(a){this.state.expandMode!==Imgur.CommentTree.EXPAND_MODE_FORCE_EXPANDED?(this.setState({expandMode:Imgur.CommentTree.EXPAND_MODE_FORCE_EXPANDED}),Imgur.Util.jafoLog({event:"expandCollapseAllInvoked",meta:{state:"expand",hash:this.props.image.hash}})):(this.setState({expandMode:Imgur.CommentTree.EXPAND_MODE_FORCE_COLLAPSED-Math.abs(this.state.expandMode)}),Imgur.Util.jafoLog({event:"expandCollapseAllInvoked",meta:{state:"collapse",hash:this.props.image.hash}}))},handleCommentSuccess:function(){this.setState({commentReplyNumber:this.state.commentReplyNumber+1})},handleDocumentKeyUp:function(a){if(!(a.ctrlKey||a.altKey||a.metaKey||$(a.target).is("input,textarea"))){var b={commentId:null,hash:this.props.image.hash,isAlbum:this.props.image.isAlbum,nsfw:this.props.image.nsfw,parentId:null,location:"hotkey"};219===a.keyCode?this.state.expandMode===Imgur.CommentTree.EXPAND_MODE_FORCE_EXPANDED?(Imgur.Util.jafoLog({event:"commentCollapseInvoked",meta:b}),this.setState({expandMode:Imgur.CommentTree.EXPAND_MODE_FORCE_COLLAPSED})):(Imgur.Util.jafoLog({event:"commentExpandInvoked",meta:b}),this.setState({expandMode:Imgur.CommentTree.EXPAND_MODE_FORCE_EXPANDED})):221===a.keyCode&&(Imgur.Util.jafoLog({event:"commentCollapseInvoked",meta:b}),this.setState({expandMode:Imgur.CommentTree.EXPAND_MODE_FORCE_COLLAPSED-Math.abs(this.state.expandMode)}))}},render:function(){var a=[],b=this.state.expandMode===Imgur.CommentTree.EXPAND_MODE_FORCE_EXPANDED;
if(a.push(React.createElement(Imgur.Caption.Reply,{key:"reply:"+String(this.state.commentReplyNumber)+":"+this.props.image.hash,image:this.props.image,parentId:null,parentAuthorId:null,autofocus:!1,onBlur:_.noop,onSuccess:this.handleCommentSuccess})),a.push(React.DOM.div({key:"controls",className:"comments-info"},React.DOM.div({className:"left"},React.DOM.div({className:"inline"},React.DOM.span({className:"comments-count"},this.props.loading?"LOADING":Imgur.Caption.getInstance().countComments(this.props.image.hash))," COMMENTS")),React.createElement(Imgur.Elements.PopupMenu,{className:"comments-sort right",name:this.props.commentSort,afterNameIcon:"icon-arrow-down"},React.DOM.div({className:"item"+("best"==this.props.commentSort?" selected":""),onClick:_.partial(this.props.onCommentSortChange,"best")},"best"),React.DOM.div({className:"item"+("new"==this.props.commentSort?" selected":""),onClick:_.partial(this.props.onCommentSortChange,"new")},"new"),React.DOM.div({className:"item"+("top"==this.props.commentSort?" selected":""),onClick:_.partial(this.props.onCommentSortChange,"top")},"top")),React.DOM.span({className:(b?"icon-collapse-all":"icon-expand")+" comments-expand right pointer",onClick:this.handleClickToggleForceExpanded,href:"javascript:void(0)"},b?"Collapse All":"Expand All"),React.DOM.div({className:"clear"}))),!this.props.loading)if(this.props.contextId){a.push(React.DOM.div({key:"permalink-banner",className:"reply-header"},React.DOM.span(null,"You are viewing a single comment"),React.DOM.p(null,React.DOM.a({className:"load-more",href:"/gallery/"+this.props.image.hash,onClick:this.handleClickPermalinkViewRestBanner},"view the rest of the comments"))));var c={},d=Imgur.Caption.getInstance().getCaptionById(this.props.image.hash,this.props.contextId),e=Imgur.Caption.getInstance().getCaptionById(this.props.image.hash,this.props.permalink.commentId);if(Imgur.Environment.signed&&Imgur.Environment.auth.id==e.author_id){var f=Imgur.Caption.getInstance().getCaptionIdsByFilter(this.props.image.hash,_.bind(function(a){var b=moment.utc(a.datetime,"YYYY-MM-DD HH:mm:ss").unix(),c=e.id==a.parent_id,d=Imgur.Environment.auth.id==a.author_id,f=b>this.props.timeLastRead;return f&&c&&!d},this));_.each(f,function(a){c[a]=!0})}a.push(React.createElement(Imgur.CommentTree,{contextids:c,childmap:this.props.childmap,votemap:this.props.votemap,image:this.props.image,key:"tree:"+this.props.image.hash,expandMode:this.state.expandMode,expandedFromPermalink:this.state.expandedFromPermalink,groupingBadReplies:!1,comment:d,votable:!0,touchEnabled:this.state.touchEnabled}))}else{var g=Imgur.Experiments.getUserBucket("expT4377b"),h=g&&g.variation;Imgur.Experiments.isActive("expT4377b"),a.push(React.createElement(Imgur.CommentList,{contextids:{},childmap:this.props.childmap,votemap:this.props.votemap,image:this.props.image,key:"list:"+this.props.image.hash,expandMode:this.state.expandMode,expandedFromPermalink:this.state.expandedFromPermalink,level:0,parent_id:null,groupingBadReplies:!0,votable:!0,touchEnabled:this.state.touchEnabled,inRecommendationsExperiment:"control"!=h&&Imgur.Experiments.isActive("expT4377b")}))}return React.DOM.div({id:"comments",className:this.props.loading?"":"comments-loaded"},React.DOM.div({id:"captions",className:"root-caption-container"},a))}}),Imgur.PostViewSummary={},function(){function a(a){switch(a.galleryType){case"subreddit":return{galleryType:a.galleryType,galleryName:a.subreddit};case"tag":return{galleryType:a.galleryType,galleryName:a.tagName};case"new":return{galleryType:"gallery",galleryName:"User Submitted"};case"viral":return{galleryType:"gallery",galleryName:"User Submitted"};case"hot":return{galleryType:"gallery",galleryName:"Most Viral"};default:return{galleryType:"deeplink",galleryName:null}}}Imgur.PostViewSummary.ViewedPost=function(b,c,d,e,f,g){var h=a(b),i=h.galleryName,j=h.galleryType,k={"Total Count":1,"NSFW Count":d?1:0,"Promoted Count":c?1:0,"Promoted Eligible Count":e?1:0,"Monetizable Count":g?1:0,Location:Imgur.Util.capitalizeString(j),Type:"Detail","Video Count":f};i&&(k["Location Identifier"]=i),Imgur.Util.jafoLogEvent(Imgur.AnalyticCategories.POST,Imgur.AnalyticEventNames.viewingSummary,k)},Imgur.PostViewSummary.getGalleryNameAndType=a}();var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(a){return typeof a}:function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a};Namespace("Imgur.InsideNav"),Imgur.InsideNav=Imgur.extend({init:function(a,b,c,d,e,f,g,h){h=h||{},this._=$.extend({currentViewedHash:null,ad:{URL:void 0,timeTillRefresh:2e3,nextImageLoadRefreshesAd:!1,injectAd:!$(".advertisement").length,closed:!1,currentTimeout:void 0,abpAdId:$("#div-ad-1421193579422-0")},tallAdParams:{sqWidth:821,sqHeight:599,recWidth:1294,recHeight:599,rightContentHeight:$("#right-content").height()},skyPopMarginTop:40,labelWrapperMarginTop:32,captionLayout:{sort:null},depth:1,insideCommentsArea:null,emitter:c,autoBrowse:!1,autoBrowseTimeout:null,autoBrowseWait:7e3,isHotImage:!0,adType:null,captionInstance:b,albumImageStore:d,postSavingStore:e,tagStore:f,adManager:g,fetchQueue:[],fetchingCaptions:{},image:{},fetchPageEventCount:0,checkFetchQueueInterval:void 0,fetchInterval:250,sideGallery:a,initialImage:!0,isPromoted:!1,headerFixed:!1,scrollPosition:0,postTitleMaxHeight:120,vwUnderImage:{padding:20,timeout:500,lastHash:null},vwTime:{lastHash:null,msec:0},vwUnderComments:{lastHash:null},postContents:{loading:[],loaded:[],hash:null},post:null,elements:{$metadataLink:$('link[rel="image_src"]'),$window:$(window),$inside:$("#inside"),$postHeader:$(".post-header"),$postContainer:$(".post-container"),$navPrev:$(".navPrev"),$navNext:$(".navNext"),$postJump:$("#post-jump-container"),$nicetime:$("#nicetime"),$voteUp:$("#mainUpArrow"),$voteDown:$("#mainDownArrow"),$image:$(".post-images"),$embed:$("#stats-embed-codes"),$postActionBar:$(".post-action"),postActionBar:".post-action",$postTitleContainer:$(".post-title-container"),$captions_count:$("#comment-count"),$actionTabs:$("#action-tabs").find("> div"),$shareLink:$("#under-image").find(".share-link"),imageContainers:".post-images .post-image-container",adframe:$("#adiframe")[0],adWrapper:".advertisement",promoCompanion:".promoCompanion",albumTruncated:".js-post-truncated",albumDescription:".post-description",$favoritedImage:$(".favorite-image"),$randomButton:$(".random-button"),$sideFooterLinks:$("#fixed-side-footer-links")},skyPopYPos:null,insideCommentsAreaWithContext:React.createClass({displayName:"insideCommentsAreaWithContext",childContextTypes:{onContextChange:React.PropTypes.func,msid:React.PropTypes.string,onSubmit:React.PropTypes.func,linkifier:React.PropTypes.object,onVoteChange:React.PropTypes.func},getChildContext:function(){return{onContextChange:this.props.loadmore,msid:this.props.msid,onSubmit:this.props.onsubmit,linkifier:this.props.linkifier,onVoteChange:this.props.onvotechange}},render:function(){return React.createElement(Imgur.InsideCommentsArea,this.props)}})},h),this._super(this._),$(".footerlink-report-ads").removeClass("nodisplay").click(this.reportBadAds.bind(this)),this.renderAds=_.debounce(this.renderAds,1500),this.rotateAds(this.formatPostForAds(Imgur.Environment.image))},formatPostForAds:function(a){return a.is_album?Object.assign({},a,{album_images:a.album_images.images}):a},setHash:function(a){this._.hash=a,this.updateCaptionHash(),Imgur.getInstance().setHash(a)},getHash:function(){return this._.hash},updateCaptionHash:function(){this._.captionInstance.setHash(this._.hash)},updateShare:function(){if(!this.hasImage())return void console.warn("Can't find image when updating share");var a=this.getImage(),b="https://"+this._.host+this.getURL({type:"historyState",hash:a.hash});b=a.is_album?b.replace("/account/favorites/","/a/"):b.replace("/account/favorites/","/");var c=Imgur.ShareButtons.getInstance();c.setShareData({jafoMeta:_.merge(Imgur.Gallery.getInstance().getGalleryMetadata(),{type:"galleryPost"},this._.imageJafoMeta),title:a.title,url:b},{global:!0}),this._.elements.$shareLink.val(b).data("value",b)},hasImage:function(a){return a=a||this._.hash,a==this._.image.hash||null!=this._.sideGallery.getImage(a)},getImage:function(a){return a=a||this._.hash,null==this._.sideGallery?this._.image:this.hasImage(a)?this._.sideGallery.getImage(a):null},getCurrentImage:function(){return this._.sideGallery.getImage(this.getHash())},checkFetchQueue:function(){if(0!==this._.fetchQueue.length){var a=this._.fetchQueue.shift();a&&a()}},generalInit:function(a){var b=this;this._.signed?this._.auth.id:null;this.checkAdTime(),$(".post-image-placeholder").one("mousedown",function(a){a.target.setAttribute("src",a.target.parentNode.getAttribute("href"))}),this._.hasAccess&&!Imgur.Environment.captionsEnabled||(this.bindAutoBrowse(),this.bindHotKeys()),this.setupHistoryState(),a(),this._.checkFetchQueueInterval=window.setInterval(this.checkFetchQueue.bind(this),this._.fetchInterval),"onhashchange"in window&&$(window).bind("hashchange",_.bind(this.forceScrollToCaption,this)),$("body").on("hover",".image-id-link",_.bind(function(a){var b=$(a.target);b.hasClass("imgur-image")||(b.addClass("imgur-image"),$.ajax({url:"/gallery/action/image/"+this.getHash(),type:"GET",data:{order:b.text().match(/\d+/)[0]},success:function(a){a.data&&a.data.url&&a.data.hash&&(b.attr("href",a.data.url),b.attr("data-hash",a.data.hash))}}))},this)),$(window).on("scroll",_.throttle(_.bind(this.checkStickyHeader,this),50)),this.checkStickyHeader(),this._.elements.$navPrev.click(_.bind(function(){this._.emitter.trigger("buttonNav","prev")},this)),this._.elements.$navNext.click(_.bind(function(){this._.emitter.trigger("buttonNav","next")},this)),this._.emitter.on("select",null,_.bind(function(a,b,c,d){this.logNavigation(c,d,a)},this)),this._.emitter.on("hide all ads",null,_.bind(function(){this._.adManager.hideAds()},this)),this._.emitter.on("hide ads - monetization",null,_.bind(function(){this._.adManager.hideAds()},this)),this._.emitter.on("postRendering",null,_.bind(this.checkViewabilityTime,this)),$(window).on("beforeunload",_.bind(this.checkViewabilityTime,this)),this._.emitter.on("select",null,_.partial(setTimeout,_.bind(this.postLoadingQueueContents,this),this._.vwUnderImage.timeout)),this._.emitter.on("postContentsLoaded",null,_.once(_.bind(this.bindViewabilityScroll,this))),this._.emitter.on("postContentsLoaded",null,_.partial(setTimeout,_.bind(this.checkViewabilityScroll,this),this._.vwUnderImage.timeout)),this.bindViewabilityJafo(),this.bindSkyPopScroll(),this.bindPostJump(),$(window).on("beforeunload",function(){var a=b.getPostVideoCount(b._.image);a>0&&b.logVideoWatchTime(a,!0)})},bindSkyPopScroll:function(){if(this._.elements.$skyPop=this._.elements.$skyPop||$("#sidebar-bottom-ads"),0!==this._.elements.$skyPop.length){$("#abp-pop_sky").length&&(this._.skyPopMarginTop=this._.skyPopMarginTop-this._.labelWrapperMarginTop);var a,b=!1,c=_.throttle(function(){return!b&&this._.elements.$sideFooterLinks.length&&(a=this._.elements.$sideFooterLinks.offset().top+this._.elements.$sideFooterLinks.height()+this._.skyPopMarginTop),a}.bind(this),1e3),d=function(){this._.elements.$skyPop.css({right:this._.elements.$window.width()-(this._.elements.$skyPop.parent().offset().left+this._.elements.$skyPop.parent().outerWidth())})}.bind(this);this._.elements.$window.on("scroll.skyPopAdPositioning",_.debounce(function(){if(this._.elements.$sideFooterLinks.length){var a=this._.elements.$window.scrollTop()>c();!b&&a?(this._.elements.$skyPop.addClass("fixed"),b=!0,d()):b&&!a&&(this._.elements.$skyPop.removeClass("fixed"),b=!1)}}.bind(this),10,{trailing:!0})),this._.elements.$window.on("resize.skyPopAdPositioning",_.debounce(d.bind(this),200,{trailing:!0}))}},bindPostJump:function(){var a=!1;this._.elements.$window.on("scroll.postJump",_.debounce(function(){var b=this._.elements.$window.scrollTop(),c=0!=b&&b+this._.elements.$window.height()>this._.elements.$postActionBar.offset().top;!a&&c?(this._.elements.$postJump.addClass("in-comments"),a=!0):a&&!c&&(this._.elements.$postJump.removeClass("in-comments"),a=!1)}.bind(this),200)),this._.elements.$postJump.find(".badge--see-comments").click(this.scrollToCaptions.bind(this)),this._.elements.$postJump.find(".badge--take-up").click(function(){$("html, body").animate({scrollTop:0},500)}.bind(this)),this._.elements.$postJump.find(".badge--new-design").click(function(a){a.preventDefault(),window.location.href="/beta/enable?redirect="+encodeURIComponent(window.location.href)})},bindViewabilityJafo:function(){Math.random()<.01&&(this._.emitter.on("vwTime",null,_.bind(function(a,b){Imgur.Util.jafoLog({event:"vwTime",meta:{hash:a,sec:Math.floor(parseInt(b,10)/1e3)}})},this)),this._.emitter.on("vwUnderImage",null,_.bind(function(a,b,c){Imgur.Util.jafoLog({event:"vwUnderImage",meta:{hash:a,pos:b,target:c}})},this)),this._.emitter.on("vwUnderComments",null,_.bind(function(a,b,c,d){var e={hash:a,isAlbum:b,nsfw:c};b||(e.isAnimated=d),Imgur.Util.jafoLog({event:"vwUnderComments",meta:e})},this)))},postLoadingQueueContents:function(){var a,b,c,d,e;if(this._.image&&!(this._.image.num_images<1))for(this._.postContents.loading=[],this._.postContents.loaded=[],this._.postContents.hash=this._.image.hash,a=$(this._.elements.imageContainers),b=0;b<a.length;b++)c=$(a[b]),e=c.attr("id"),d=c.find("video, img").first(),!e||d.length<1||(this._.postContents.loading.push(e),d.is("video")?this.postLoadingCheckVideo(e,d):this.postLoadingCheckImg(e,d))},postLoadedContentHash:function(a){this.postLoadingVerifyHash(a)&&(this._.postContents.loaded.push(a),this._.postContents.loading.length===this._.postContents.loaded.length&&this._.emitter.trigger("postContentsLoaded",this._.image))},postLoadingVerifyHash:function(a){return this._.postContents.hash===this._.image.hash&&this._.postContents.loaded.indexOf(a)<0&&this._.postContents.loading.indexOf(a)>-1},postLoadingCheckImg:function(a,b){this.postLoadingVerifyHash(a)&&(b[0].complete?this.postLoadedContentHash(a):b.on("load error",{imgHash:a},_.bind(this.postLoadingHandleImg,this)))},postLoadingHandleImg:function(a){var b=Imgur.Util.dive(a,"data.imgHash");_.isString(b)&&this.postLoadedContentHash(b)},postLoadingCheckVideo:function(a,b){return b[0].readyState<1?void b.on("loadeddata",{imgHash:a},_.bind(this.postLoadingHandleVideo,this)):void this.postLoadedContentHash(a)},postLoadingHandleVideo:function(a){var b=Imgur.Util.dive(a,"data.imgHash"),c=$(a.target);c[0].readyState>0&&this.postLoadedContentHash(b)},bindViewabilityScroll:function(){$(window).on("scroll resize",_.throttle(_.bind(this.checkViewabilityScroll,this),250))},checkStickyHeader:function(){var a=$(window).scrollTop(),b=$(".post-header"),c=$(".post-container"),d=c.offset().top,e=a-this._.scrollPosition;if(this._.scrollPosition=a,!this._.headerFixed&&a>d){var f=b.outerHeight();b.addClass("fixed"),c.css("padding-top",f),this._.headerFixed=!0}else this._.headerFixed&&a<=d&&(b.removeClass("fixed"),c.css("padding-top",0),this._.headerFixed=!1);a>d+this._.postTitleMaxHeight&&e>10&&!b.hasClass("animate")&&b.outerHeight()>80?(b.addClass("animate"),b.one("webkitTransitionEnd otransitionend oTransitionEnd msTransitionEnd transitionend",function(){$(this).addClass("animation-finished")})):(a<=d+this._.postTitleMaxHeight||e<-100)&&(b.off("webkitTransitionEnd otransitionend oTransitionEnd msTransitionEnd transitionend"),b.removeClass("animation-finished"),b.removeClass("animate")),this._.captionsEnabled&&($.inviewport($("#right-content"),{threshold:0})?this._.elements.$postJump.removeClass("js-animate"):this._.elements.$postJump.addClass("js-animate"))},checkViewabilityTime:function(a){(_.isObject(a)||this._.vwTime.lastHash!==this._.hash)&&(this._.vwTime.msec>0&&this._.emitter.trigger("vwTime",this._.vwTime.lastHash,(new Date).valueOf()-this._.vwTime.msec),this._.vwTime.lastHash=""+this._.hash,this._.vwTime.msec=(new Date).valueOf())},checkViewabilityScroll:function(){var a=parseInt(this._.elements.$window.scrollTop()+this._.elements.$window.height(),10),b=$(this._.elements.postActionBar),c=parseInt(b.offset().top+b.outerHeight()+this._.vwUnderImage.padding,10),d=$("#comments-container");if(this._.captionsEnabled){var e=d.offset();if(e)var f=e.top+d.height();if(this._.vwUnderImage.lastHash!==this._.hash&&a>=c&&(this._.emitter.trigger("vwUnderImage",this._.hash,a,c),this._.vwUnderImage.lastHash=this._.hash),this._.captionsEnabled&&this._.vwUnderComments.lastHash!==this._.hash&&f<a&&f>=this._.elements.$window.scrollTop()){var g=this._.sideGallery.getImage(this._.hash)||{};this._.emitter.trigger("vwUnderComments",this._.hash,g.is_album,g.nsfw,g.animated),this._.vwUnderComments.lastHash=this._.hash}}},getPostVideoCount:function(a){var b=0;if(a.is_album){var c=this._.albumImageStore.getImages(a.hash);c&&c.images&&(b=c.images.reduce(function(a,b){return a+=b.animated},0))}else b=0|a.animated;return b},logVideoWatchTime:function(a,b){if(0!=a){var c=Imgur.VideoAnalytics.getInstance().getAnalyticsData();Imgur.Util.jafoLogEvent(Imgur.AnalyticCategories.POST,Imgur.AnalyticEventNames.videoSummary,{"Video Count":a,"Video Plays 25":c.video_plays_25,"Video Plays 50":c.video_plays_50,"Video Plays 75":c.video_plays_75,"Video Plays 100":c.video_plays_100},b)}},enablePrevButton:function(){this._.elements.$navPrev.removeClass("disabled")},enableNextButton:function(){this._.elements.$navNext.removeClass("disabled")},disablePrevButton:function(){this._.elements.$navPrev.addClass("disabled")},disableNextButton:function(){this._.elements.$navNext.addClass("disabled")},changeSection:function(a){this._.section=a},changeSort:function(a){this._.sort=a},changeWindow:function(a){this._.window=a},getURL:function(a){return{historyState:this._.baseURL+"/"+a.hash,image:this._.cdnURL+"/"+a.hash+a.ext,thumb:this._.cdnURL+"/"+a.hash+"b"+a.ext,imageVotesJSON:"//"+Imgur.Environment.host+"/gallery/"+a.hash+"/votes.json",captionsJSON:"//"+Imgur.Environment.host+"/gallery/"+a.hash+"/comment/best/hit.json"}[a.type]},fetchImage:function(a,b,c){var d=this._.sideGallery.getImage(a);d&&(d.is_album&&null==this._.albumImageStore.getImages(d.hash)?this._.albumImageStore.fetchImages(d.hash,_.bind(function(a){for(var c=0;c<a.count&&c<5;++c)this.preloadImage(a.images[c]);this.insertPost(d,!0),"function"==typeof b&&b(d)},this)):(this.preloadImage(d),"function"==typeof b&&b(d)),this.fetchCaptions(d.hash,c||_.noop))},fetchCaptions:function(a,b,c){if(this._.captionsEnabled){if(this._.captionInstance.haveCaptions(a))return void b();if(!this._.fetchingCaptions[a]){this._.fetchingCaptions[a]=!0;var d=this,e=this.getURL({type:"captionsJSON",hash:a}),f=this.getURL({type:"imageVotesJSON",hash:a});$.ajax(e,{displayGenericError:!1}).done(function(e){if(e&&e.data&&e.data.captions){var f=e.data.captions;Imgur.Environment.auth.id||(f=f.filter(function(a){return!d.containsProfanity(a.caption)})),d._.captionInstance.mergeCaptions(a,f),b(),delete d._.fetchingCaptions[a]}else c||(delete d._.fetchingCaptions[a],d.fetchCaptions(a,b,!0))}).fail(function(){delete d._.fetchingCaptions[a],c||d.fetchCaptions(a,b,!0)}),this._.signed&&!c&&$.ajax(f,{displayGenericError:!1}).done(function(c){c&&c.data&&c.data.votes&&(d._.captionInstance.mergeVotes(a,c.data.votes),b())})}}},profanityRegex:/\b(ass-fucker|assfuck|bastard|chink|cock-suck|cocksuck|coon|cum|cumming|cumshot|cunt|fag|faggot|fagot|fatass|fuck|fuckhead|jap|jism|jiz|jizm|jizz|motherfuck|nigga|nigger|retard|titty|twat)(ers|er|ed|ing|s|es)?\b/gi,containsProfanity:function(a){return!!a.match(this.profanityRegex)},scrollToCaptions:function(a){var b=$(this._.elements.postActionBar).offset().top-this._.elements.$postHeader.outerHeight();a?$("html, body").animate({scrollTop:b},500,function(){}.bind(this)):window.scrollTo(0,b)},processCaptions:function(){var a=this,b=this._.hash,c=this.getCaptionSorter(),d=b===this._.image.hash?this._.image:this._.sideGallery.getImage(b),e=_.clone(this._.captionInstance.getParentIds(b)),f=_.transform(e,function(d,e){var f=a._.captionInstance.getCaptionChildrenIds(b,e),g=[];if(Imgur.Environment.auth.show_mature)g=f;else for(var h=0;h<f.length;h++){var i=a._.captionInstance.getCaptionById(b,f[h]),j=i.caption.match(/nsfw|mature/i),k=/(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/gi,l=i.caption.match(k);j&&l&&i.author_id!=Imgur.Environment.auth.id||g.push(f[h])}g.sort(function(d,e){var f=a._.captionInstance.getCaptionById(b,d),g=a._.captionInstance.getCaptionById(b,e);return c(f,g)}),d[e]=g},{}),g=_.bind(function(a,b,c){a.preventDefault(),this.pushWindowState(b,c),this.processCaptions()},this),h=_.bind(function(a){this.processCaptions(),this._.emitter.trigger("captionSubmit",a)},this),i=$.cookie("GCS");i||(i="best");var j=_.bind(function(a,b){this.processCaptions(),this._.emitter.trigger("captionVoted",a,b)},this),k=_.bind(function(a){this.setCaptionSort(a),$.cookie("GCS",a,{expires:7,path:"/"}),Imgur.Util.jafoLog({event:"commentSort",meta:{sort:a,state:"done",hash:b}}),this.processCaptions()},this),l=void 0,m=this.getPermalinkIfExists(),n=null;if("undefined"!=typeof m){l=m.commentId;var o=Imgur.Caption.getInstance().getCaptionById(b,l),p=1;if(null!==o){var q=o.parent_id,r=o.id;n=m.contextLevels||p;for(var s=0;s<n&&(f[q]=[r],null!==q);s++)r=q,q=Imgur.Caption.getInstance().getCaptionParentById(b,q);l=n>0?r:o.id}else l=void 0}var t="undefined"!=typeof m&&"undefined"!=typeof l,u=Imgur.Util.getQueryParams(window.location.search),v="lr"in u?parseInt(u.lr):Number.MAX_SAFE_INTEGER,w={image:d,loading:!Imgur.Caption.getInstance().haveCaptions(b),childmap:f,votemap:Imgur.Caption.getInstance().getVotes(b),contextId:l,contextLevels:n,defaultExpandMode:Imgur.CommentTree.EXPAND_MODE_DEFAULT_COLLAPSED,expandedFromPermalink:t,commentSort:i,onCommentSortChange:k,timeLastRead:v,permalink:m,loadmore:g,msid:Imgur.Environment.msid,onsubmit:h,linkifier:this._.linkifier,onvotechange:j,emitter:this._.emitter},x=this._.insideCommentsAreaWithContext,y=$("#comments-container").get(0);y&&(this._.insideCommentsArea=ReactDOM.render(React.createElement(x,w),y)),Imgur.ShareButtons.getInstance().bindAddthisButton()},getPermalinkIfExists:function(){var a=window.location.pathname,b=a.indexOf("comment")!==-1;if(b){var c=a.split("/comment/")[1].split("/");return{commentId:parseInt(c[0]),contextLevels:parseInt(c[1])}}},setupHistoryState:function(){var a=this,b=Imgur.History.getInstance();b.addPopState("inside_nav.comment",function(b){a.handlePopStateComment(b)}),b.addPopState("inside_nav.image",function(b){a.handlePopStateImage(b)})},handlePopStateComment:function(a){var b=window.location.pathname.split("/"),c=null;3==b.length&&b[2].length>=5&&(c=b[2]),b.length>3&&(c="r"===b[1]?b[b.length-1]:"user"===b[1]?b[4]:b[2]),this.setHash(c),this.scrollToCaptions(),this.processCaptions()},handlePopStateImage:function(a){var b=window.location.pathname.split("/"),c=null;3===b.length&&b[2].length>=5&&(c=b[2]),b[2]&&(c=_.indexOf(["r","t","topic"],b[1])!==-1?b[b.length-1]:"user"===b[1]?b[4]:b[2]),this._.sideGallery.getImage(b[1])&&(c=b[1]),this._.sideGallery.selectImage(c,!0),this.processCaptions(),this.updateShare()},pushWindowState:function(a,b){var c=this._.baseURL+"/"+this._.hash;a&&(c+="/comment/"+a,b&&(c+="/"+b)),Imgur.History.getInstance().addWindowState("inside_nav.comment","Comments on "+window.title,c)},setCaptionSort:function(a){var b=a.substr(0,1).toUpperCase()+a.substr(1);this._.captionLayout.sort=this["sortCaptionsBy"+b]},getCaptionSorter:function(){var a=[_.bind(this.sortCaptionsByMineJustSubmitted,this),this._.captionLayout.sort,_.bind(this.sortCaptionsByIdDesc,this)];return function(b,c){for(var d=0;d<a.length;d++){var e=a[d](b,c);if(0!=e)return e}return 0}},sortCaptionsByTop:function(a,b){var c=a.points,d=b.points;return c>d?-1:c<d?1:0},sortCaptionsByBest:function(a,b){var c=a.best_score,d=b.best_score;return c>d?-1:c<d?1:0},sortCaptionsByNew:function(a,b){var c=new Date(a.datetime),d=new Date(b.datetime);return c>d?-1:c<d?1:0},sortCaptionsByMineJustSubmitted:function(a,b){return"just_inserted"in a&&!("just_inserted"in b)?-1:"just_inserted"in b&&!("just_inserted"in a)?1:0},sortCaptionsById:function(a,b){return a.id<b.id?-1:a.id>b.id?1:0},sortCaptionsByIdDesc:function(a,b){return a.id>b.id?-1:a.id<b.id?1:0},blankPage:function(){this._.isPromoted&&this.removePromotedCompanion(),humanMsg.removeMsg(function(){$("#humanMsg").remove(),humanMsg.setup()}),this._.fetchQueue=[]},pushToFetchQueue:function(a,b,c){this._.fetchQueue.push(_.bind(this.fetchImage,this,a,b,c))},setupReportLink:function(){var a=this.getHash(),b=this._.sideGallery.getImage(a),c=Imgur.Environment.auth.url===this._.image.account_url||!this._.captionsEnabled||b.promoId||b.readonly;this._.el.inside.reportImageLink.toggleClass("nodisplay",c),1==$.cookie("r"+this.getHash())?(this._.el.inside.reportImageLink.addClass("red").text(" post reported"),this._.el.inside.reportImageLink.unbind("click")):(this._.el.inside.reportImageLink.removeClass("red").text(" report post"),this._.el.inside.reportImageLink.unbind("click"),this._.el.inside.reportImageLink.click(_.bind(function(){self._.emitter.trigger("report image")},this)))},handleAds:function(){var a=this.getHash(),b=this._.sideGallery.getImage(a);this._.ad.injectAd&&(!this._.isHotImage&&b.is_hot||b.hasOwnProperty("in_gallery")&&b.in_gallery)?this.showAds():this._.ad.injectAd&&this._.section&&0==$(this._.elements.adWrapper).length&&this.showAds()},isSafe:function(){var a=this._.sideGallery.getImage(this.getHash());return!!a&&(a.is_safe===!0||!(a.nsfw_tag||a.nsfw||a.hasOwnProperty("in_gallery")&&!a.in_gallery||a.is_moderated===!1))},updateSponsoredInfo:function(){var a=this.getHash();this._.elements,this._.sideGallery.getImage(a);this._.emitter.trigger("displayPromoted",a)},updateSubmissionInfo:function(){var a=this._.sideGallery.getImage(this.getHash());a.topic?$("#post-topic option").each(function(){if($(this).text()==a.topic)return $(this).attr("selected",!0),!1}):$("#post-topic option").eq(0).attr("selected",!0)},updatePage:function(a,b){var c=this.getHash(),d=this._.elements,e=this._.sideGallery.getImage(c),f=this;if(this._.image=e,Imgur.Gallery.getInstance()._.account_url=e.account_url,a||Imgur.History.getInstance().addWindowState("inside_nav.image",e.title,this.getURL({type:"historyState",hash:c})),$(".opened").removeClass("opened"),!e.comments_disabled&&("comment_count"in e||e.isAd||e.in_gallery)){$("#comments-container").length||($('<div id="comments-container">').insertAfter(".post-container"),this._.captionsEnabled=!0);var g=Imgur.Gallery.getInstance();if(null===g._.sort){var h=this._.sideGallery.getGalleryEnvironment();g._.sort=h.sort,g._.window=h.window,g._.section=h.section}}else $("#comments-container").remove(),this._.captionsEnabled=!1;this.blankPage(),this._.isPromoted=e.isAd,this.rotateAds(e),"object"===_typeof(window.cNEkDpHAxP)&&window.cNEkDpHAxP.push(function(a){a.recordPV()}),this.setupReportLink(),this._.isPromoted||this.handleAds(),this.checkAdTime(),e.is_album&&Imgur.Util.triggerView(e.hash,{album:!0,discard:!0});e.isAd?_.unescape(e.description):e.description;if(null==e.title||"untitled"==e.title?Imgur.Notification.getInstance().setTitle(this._.galleryTitle+" - Imgur"):Imgur.Notification.getInstance().setTitle(e.title+" - Imgur"),e.isAd?this.updateSponsoredInfo():this.updateSubmissionInfo(),e.comments_disabled||!this._.captionsEnabled||this._.captionInstance.haveCaptions(c))f.insertPost(e),this._.captionsEnabled&&this.processCaptions();else{if(this._.insideCommentsArea){var i=this._.insideCommentsArea.props;i.loading=!Imgur.Caption.getInstance().haveCaptions(e.hash),i.image=e;var j=this._.insideCommentsAreaWithContext;this._.insideCommentsArea=ReactDOM.render(React.createElement(j,i),$("#comments-container").get(0))}this.pushToFetchQueue(c,function(a){f.insertPost(a)},_.bind(this.processCaptions,this))}e.is_album===!0?d.$metadataLink.attr("href",this._.protocol+this._.cdnURL+"/"+e.album_cover+e.ext):d.$metadataLink.attr("href",this._.protocol+this._.cdnURL+"/"+e.hash+e.ext),d.$actionTabs.hide(),"up"==e.vote?(this._.elements.$voteUp.addClass("pushed"),this._.elements.$voteDown.removeClass("pushed")):"down"==e.vote?(this._.elements.$voteDown.addClass("pushed"),this._.elements.$voteUp.removeClass("pushed")):(this._.elements.$voteDown.removeClass("pushed"),this._.elements.$voteUp.removeClass("pushed"));var k=this._.sideGallery.getNextImage();null!=k&&this.pushToFetchQueue(k),$(".tipsy").remove(),Imgur.Util.googleTrackPageview(),this.purgeCommentData(),this.updateCaptionHash();var l="item",m=Imgur.Gallery.getInstance(),n=m.getGalleryMetadata(l);n.tags=[],Array.isArray(e.galleryTags)&&(n.tags=e.galleryTags.map(function(a){return a.tag})),n.promotedTagGallery=m.isPromotedTagGallery(n.tagName,e.galleryTags);var o="undefined"!=typeof Imgur.Gallery,p=!!e.isAd,q=e.nsfw,r=_.extend(n,{hash:e.hash,promoted:p,wasInserted:p,inGallery:o,isAlbum:e.is_album,showsAds:e.adConfig&&e.adConfig.showsAds,nsfw:q,galleryEntry:null});"undefined"!=typeof e.promotedPostRequestExpected&&(r.promotedPostRequestExpected=e.promotedPostRequestExpected),"string"==typeof e.subreddit&&(r.subreddit=e.subreddit);try{"string"==typeof e.reddit&&"string"==typeof e.hot_datetime?r.galleryEntry=moment.utc(e.hot_datetime,"YYYY-MM-DD HH:mm:ss").valueOf():"string"==typeof e.timestamp&&(r.galleryEntry=moment.utc(e.timestamp,"YYYY-MM-DD HH:mm:ss").valueOf())}catch(s){r.galleryEntry=null}this._.depth+=a?-1:1,r.depth=this._.depth,Imgur.Util.jafoLog({event:l,meta:r}),this._.imageJafoMeta=r,this.updateShare()},purgeCommentData:function(){var a=this,b=Object.keys(this._.captionInstance._.captions).filter(function(b){return Object.hasOwnProperty.call(a._.captionInstance._.captions,b)&&(a.isImageNearby(b)||a.isImagePromoted(b))});this._.captionInstance.purgeCaptionData(b)},isImagePromoted:function(a){var b=this._.sideGallery.getImage(a);return b.isAd},isImageNearby:function(a){var b=this._.sideGallery.selectedPosition(),c=this._.sideGallery.hashPosition(a);return c!==-1&&c>=b-3&&c<=b+1},_promotedTag:function(a,b){var c=React.DOM.div({className:"promoted-tag"},React.DOM.a({href:Imgur.Environment.ppBlog,className:"title",title:"learn more about promoted posts"},"promoted"));return c},_promotedWrap:function(a){return React.DOM.div({className:"promoted-wrap"},this._promotedTag(),a)},insertPost:function(a,b){if(a.hash==this.getHash()&&this._.currentViewedHash!==a.hash){if(a.is_album&&null==this._.albumImageStore.getImages(a.hash))return void this._.albumImageStore.fetchImages(a.hash,_.bind(this.insertPost,this,this._.sideGallery.getImage(a.hash)||a,b));var c=this._.hasAccess&&!Imgur.Environment.captionsEnabled;if(c&&a.is_album){var d={instance:"album",emitter:this._.emitter,hash:a.hash,privacy:a.album_privacy,deletehash:a.deletehash,datetime:a.datetime,images:this._.albumImageStore.getImages(a.hash),linkifier:this._.linkifier,data:a,host:Imgur.Environment.host};ReactDOM.render(React.createElement(Imgur.Upload,d),document.getElementById("upload-album"),_.bind(this.recachePostElements,this)),this._.elements.$inside.empty()}else{var e={data:a,initial:this._.initialImage,all_loaded:b,album_image_store:this._.albumImageStore,in_gallery:this._.captionsEnabled||a.isAd&&a.hasOwnProperty("starting_score"),has_access:this._.hasAccess,postSavingStore:this._.postSavingStore,showEditTools:c,emitter:this._.emitter,hide_points:!this._.captionsEnabled||this._.isPromoted||this._.image.ad_type>0,hide_views:this._.isPromoted||this._.image.ad_type>0,hide_tags:!this._.captionsEnabled,hide_report:Imgur.Environment.auth.url===a.account_url||this._.isPromoted,linkifier:this._.linkifier,sideGallery:this._.sideGallery,tagStore:this._.tagStore};this._.post=ReactDOM.render(React.createElement(Imgur.Gallery.Post,e),$(".post-images").get(0),_.bind(this.postRendered,this))}this._.currentViewedHash=a.hash;var f=Imgur.Gallery.getInstance().getGalleryMetadata();Imgur.PostViewSummary.ViewedPost(f,this._.isPromoted,a.nsfw,a.promotedPostRequestExpected,this.getPostVideoCount(a),a.adConfig&&a.adConfig.showsAds);
}},postRendered:function(){this._.emitter.trigger("postRendered",this._.sideGallery&&this._.sideGallery.getImage?this._.sideGallery.getImage(this.getHash()):{})},recachePostElements:function(){this._.elements.$postActionBar=$(".post-action"),this._.elements.$postHeader=$(".post-header"),this._.elements.$postContainer=$(".post-container"),this._.emitter.trigger("postRendering",this._.sideGallery&&this._.sideGallery.getImage?this._.sideGallery.getImage(this.getHash()):{}),this.postRendered()},preloadImage:function(a){var b,c=".gif"==a.ext&&a.animated&&a.size>2097152;if(c){var d=document.createElement("video"),e=document.createElement("source");d.canPlayType&&(e.src=Imgur.Environment.cdnUrl+"/"+a.hash+".mp4"),d.appendChild(e),b=d}else{var f=document.createElement("img");f.src=Imgur.Environment.cdnUrl+"/"+a.hash+a.ext,b=f}var g=function(){b&&(c?$(b).find("source").attr("src",""):$(b).attr("src",""),b=null)};b.onload=b.onerror=g,this._.emitter.once("select",null,g)},checkAdTime:function(){var a=(this._.elements,this);if(this._.ad.nextImageLoadRefreshesAd){a._.elements;if(window.usesABP&&"undefined"!=typeof window.abp_ad){this._.ad.abpAdId.removeClass("nodisplay");try{googletag.pubads().refresh([window.abp_ad])}catch(b){}}else if("undefined"!=typeof window.dfp_adslot)try{a._.elements.adframe.contentWindow.tagRefresh()}catch(b){}if("undefined"!=typeof window.leaderboard_slot&&window.leaderboard_slot&&!Imgur.Environment.auth.id)try{window.leaderboard_slot.setTargeting("url",location.href),googletag.pubads().refresh([window.leaderboard_slot])}catch(b){}this._.captionsEnabled||Imgur.Environment.auth.id||($(".trc_rbox").remove(),window._taboola=window._taboola||[],_taboola.push({mode:"thumbnails-a",container:"taboola-below-article-thumbnails",placement:"LoggedOut_NonGallery",target_type:"mix"}),window._taboola=window._taboola||[],_taboola.push({flush:!0})),this._.ad.nextImageLoadRefreshesAd=!1,window.clearTimeout(this._.ad.currentTimeout),this._.ad.currentTimeout=window.setTimeout(function(){a._.ad.nextImageLoadRefreshesAd=!0,a._.ad.currentTimeout=void 0},this._.ad.timeTillRefresh)}else this._.ad.currentTimeout||(this._.ad.currentTimeout=window.setTimeout(function(){a._.ad.nextImageLoadRefreshesAd=!0,a._.ad.currentTimeout=void 0},this._.ad.timeTillRefresh))},removePromotedCompanion:function(){$(this._.elements.promoCompanion).remove()},showAds:function(a,b){if(a&&(this._.adType="normal","undefined"==typeof Imgur.getInstance()._.auth||Imgur.getInstance()._.auth.isPro!==!0)){var c,d,e,f,g=this.getHash(),h=this._.sideGallery.getImage(g),i="//"+Imgur.Environment.host+"/ads?page=";if("https:"==document.location.protocol?(c="div-ad-1378449215044-0",i+="ssl"):h.hasOwnProperty("in_gallery")?(c="div-ad-1345436959737-0",i+="inside"):(c="div-ad-1407357841031-0",i+="inside&main=1&hot=1"),!window.usesABP){var j=$("#right-content #under-sidebar-parent.advertisement");j.length||$("#right-content #side-gallery").after('<div class="advertisement"></div>'),d=$("#right-content #under-sidebar-parent.advertisement .panel-ad"),e=$("#right-content #under-sidebar-parent.advertisement .custom-ad"),a?(d.length&&d.addClass("nodisplay"),e.length<1&&($("#right-content #under-sidebar-parent.advertisement").append('<div class="custom-ad">'+a+"</div>"),e=$("#right-content #under-sidebar-parent.advertisement .custom-ad")),e.html(a),f=e):(e.remove(),d.html('<iframe id="adiframe" class="adframe" src="'+i+'" scrolling="no" frameBorder="0"></iframe>'),f=d),a||(this._.elements.adframe=$("#adiframe").get(0))}this._.ad.nextImageLoadRefreshesAd=!0,this._.ad.injectAd=!1,"function"==typeof b&&b.apply(window,[a,f])}},reportBadAds:function(){this._.adManager.isBlocked()?humanMsg.displayMsg("We’ve detected that you have an ad blocker enabled. If you’d like to help report ads and support Imgur, please consider whitelisting us.","error-msg"):ReactDOM.render(React.createElement(Imgur.ReportBadAds,{adManager:this._.adManager}),document.getElementById("report-bad-ads-modal"))},hideZoomedImage:function(){$(".jquery-image-zoom").is(":visible")&&$("div.jquery-image-zoom a").click(),$.colorbox.close()},timeoutNextImage:function(){if(this._.autoBrowse&&!this._.autoBrowseTimeout){var a=this._.autoBrowseWait,b=this;this._.autoBrowseTimeout=setTimeout(function(){b._.autoBrowseTimeout=null,b._.emitter.trigger("buttonNav","next")},a)}else this._.autoBrowse&&(window.clearTimeout(this._.autoBrowseTimeout),this._.autoBrowseTimeout=null,this.timeoutNextImage())},bindAutoBrowse:function(){var a=this;$(document).keyup(function(b){return b.ctrlKey&&120===b.keyCode&&(a._.autoBrowse=!a._.autoBrowse,a._.autoBrowse?(a.timeoutNextImage(),humanMsg.displayMsg("Starting auto browse in "+Math.ceil(a._.autoBrowseWait/1e3)+" seconds!")):(clearTimeout(a._.autoBrowseTimeout),humanMsg.displayMsg("Done already?"))),!0})},navToImage:function(a,b){if(!("hash"in a&&this._.hash==a.hash)){var c=this.getHash();this._.initialImage=!1,this.hideZoomedImage(),this.setHash(a.hash),this.updatePage(b,c),this.timeoutNextImage();var d=this.getPostVideoCount(this.getImage(c));d>0&&(this.logVideoWatchTime(d,!1),Imgur.VideoAnalytics.getInstance().clearVideos()),this._.emitter.trigger("navToImage",this.getHash())}},logNavigation:function(a,b,c){"inserted"!==b&&Imgur.Util.jafoLog({event:"galleryNav",meta:_.extend(Imgur.Gallery.getInstance().getGalleryMetadata(),{recommendationsBox:"recommendationClick"===b,direction:a,trigger:b,targeted:c.hash,visibleTooltip:this._.tooltip&&this._.tooltip.showing()?this._.tooltip.name():null,layout:this._.sideGallery.state.layout,position:this._.sideGallery.selectedPosition()+1+("next"==a?1:-1),recBoxPosition:c.recBoxPosition})})},isInvalidKeyContext:function(a){var b=$(a.target);return"true"===b.attr("contenteditable")||(!!(a.ctrlKey||a.altKey||a.metaKey)||b.is("input, textarea"))},bindHotKeys:function(){var a=this;this._.emitter.on("blockHotKeys",null,function(b){a.hotKeysBlocked=b});var b={ARROW_LEFT:[37],ARROW_RIGHT:[39],ENTER:[13],MINUS:[109,189],PLUS:[187,61,107],NINE:[57,105],ZERO:[45,48,96],R:[82],S:[83]};navigator.userAgent.toLowerCase().indexOf("firefox")>-1&&b.MINUS.push(173),$(document).keydown(_.throttle(function(c){if(!a.hotKeysBlocked){if(!a.isInvalidKeyContext(c)){if(b.ARROW_LEFT.indexOf(c.keyCode)!==-1&&a._.sideGallery.getPrevImage())c.preventDefault(),a._.emitter.trigger("keyboardNav","prev");else if(b.ARROW_RIGHT.indexOf(c.keyCode)!==-1&&a._.sideGallery.getNextImage()){if(Imgur.Environment.hasAccess&&!Imgur.Environment.captionsEnabled)return!0;c.preventDefault(),a._.emitter.trigger("keyboardNav","next")}else if(b.ENTER.indexOf(c.keyCode)!==-1){var d=$(".jquery-image-zoom");if(d.length)d.click();else{var e=$(".post-image img");e.length&&e[0].click()}}else if(b.MINUS.indexOf(c.keyCode)!==-1&&a._.captionsEnabled){var f=$(".post-action-downvote");f.length&&!f.hasClass("red")&&humanMsg.displayMsg('<div class="favorited downvoted_msg"></div>',"action-msg");var g=new MouseEvent("mouseup",{view:window,bubbles:!0,cancelable:!0});f[0].dispatchEvent(g)}else if(b.PLUS.indexOf(c.keyCode)!==-1&&a._.captionsEnabled){var f=$(".post-action-upvote");f.length&&!f.hasClass("green")&&humanMsg.displayMsg('<div class="favorited upvoted_msg"></div>',"action-msg");var g=new MouseEvent("mouseup",{view:window,bubbles:!0,cancelable:!0});f[0].dispatchEvent(g)}else if(b.NINE.indexOf(c.keyCode)!==-1)a._.post?a._.post.loadAll():$(".post-loadall").click();else if(b.S.indexOf(c.keyCode)!==-1)$(".post-action-stats").click();else if(b.R.indexOf(c.keyCode)!==-1)a.reportBadAds();else if(b.ZERO.indexOf(c.keyCode)!==-1){var h=$(".post-action-favorite");h.length&&!h.hasClass("aqua")?humanMsg.displayMsg('<div class="favorited"></div>',"action-msg"):humanMsg.displayMsg('<div class="favorited unfavorited"></div>',"action-msg");var g=new MouseEvent("mouseup",{view:window,bubbles:!0,cancelable:!0});h[0].dispatchEvent(g)}return!0}return!0}},100)),this._.isRandom&&this._.elements.$randomButton.click(function(a){a.preventDefault(),self._.emitter.trigger("keyboardNav","next")})},getSideGallery:function(){return this._.sideGallery},forceScrollToCaption:function(){var a=document.location.hash.substr(1),b=parseInt(a,10);if(!isNaN(b)){var c=$("#caption-"+a);this.scrollToCaption(c)}},scrollToCaption:function(a){var b=a.offset().top;$("body").scrollTop(b);var c=a.find(".textbox").first();c.addClass("flash"),setTimeout(function(){c.removeClass("flash")},2e3)},renderAds:function(){this._.adManager.post.adConfig&&this._.adManager.post.adConfig.showsAds&&!Imgur.Environment.hasPaid&&(this._.adManager.post.adConfig.highRiskFlags.length>0?this._.adManager.createHighRiskSlots(!0):this._.adManager.createSafeSlots(!0))},rotateAds:function(a){Imgur.Environment.hasAccess&&!Imgur.Environment.captionsEnabled||(this._.adManager.setPost(a),a.adConfig&&a.adConfig.showsAds||Imgur.Environment.hasPaid?this.renderAds():(this._.emitter.trigger("hide all ads",a),this._.adManager.hideAds()))}}),Class.addSingleton(Imgur.InsideNav);var _createClass=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(a,d.key,d)}}return function(b,c,d){return c&&a(b.prototype,c),d&&a(b,d),b}}(),runSlots=runSlots||{},SlotManager=function(){function a(b){_classCallCheck(this,a),this.config=b,this.slots=[],this.disabledRefreshSlots={},this.disabledTimedRefreshSlots={},this.viewedSlots={},this.slotIdentifier="element",this.post=null,this.refreshCount=0,this.disabledRefresh=!1}return _createClass(a,[{key:"getEligibleSlots",value:function(){var a=this;return this.slots.filter(function(b){return a.filterEligibleSlots(b,a.slotIdentifier)})}},{key:"filterEligibleSlots",value:function(a,b){var c=a[b];return void 0===this.disabledTimedRefreshSlots[c]&&void 0===this.disabledRefreshSlots[c]&&this.viewedSlots[c]}},{key:"setPost",value:function(a){this.post=a}},{key:"createSafeSlots",value:function(a){a&&this.clearAllDisabledTimedRefreshSlots(),this.setRefreshCount(a),this.showAds()}},{key:"createHighRiskSlots",value:function(a){a&&this.clearAllDisabledTimedRefreshSlots(),this.setRefreshCount(a),this.showAds()}},{key:"showAds",value:function(){this.slots.forEach(function(a){var b=document.getElementById(a.element);b&&b.classList.remove("nodisplay")})}},{key:"hideAds",value:function(){this.slots.forEach(function(a){var b=document.getElementById(a.element);b&&b.classList.add("nodisplay")})}},{key:"setDisabledRefresh",value:function(){this.disabledRefresh=!0}},{key:"setDisabledRefreshSlot",value:function(a){this.disabledRefreshSlots[a]=!0}},{key:"setDisabledTimedRefreshSlot",value:function(a){this.disabledTimedRefreshSlots[a]=!0}},{key:"setViewedSlot",value:function(a){this.viewedSlots[a]=!0}},{key:"clearAllDisabledTimedRefreshSlots",value:function(){this.disabledTimedRefreshSlots={}}},{key:"clearViewedSlot",value:function(a){delete this.viewedSlots[a]}},{key:"clearViewedSlots",value:function(){this.viewedSlots={}}},{key:"setRefreshCount",value:function(a){a?this.refreshCount=0:this.refreshCount++}},{key:"isBlocked",value:function(){return"undefined"==typeof window.ADBLOCKED||window.ADBLOCKED!==!1}}]),a}(),_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(a){return typeof a}:function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a},_createClass=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(a,d.key,d)}}return function(b,c,d){return c&&a(b.prototype,c),d&&a(b,d),b}}(),_get=function a(b,c,d){null===b&&(b=Function.prototype);var e=Object.getOwnPropertyDescriptor(b,c);if(void 0===e){var f=Object.getPrototypeOf(b);return null===f?void 0:a(f,c,d)}if("value"in e)return e.value;var g=e.get;if(void 0!==g)return g.call(d)},sas=sas||{};sas.cmd=sas.cmd||[];var SmartSlots=function(a){function b(a){_classCallCheck(this,b);var c=_possibleConstructorReturn(this,(b.__proto__||Object.getPrototypeOf(b)).call(this,a)),d=document.createElement("script");d.src="https://ced.sascdn.com/tag/1357/smart.js",d.async=!0,document.getElementsByTagName("head")[0].appendChild(d);var e=document.createElement("script");return e.src="https://ced-ns.sascdn.com/diff/templates/ts/dist/viewability/sas-viewability-1.1.js",e.async=!0,document.getElementsByTagName("head")[0].appendChild(e),window.addEventListener("message",c.receiveMessage.bind(c),!1),c.slots=c.config.active_slots.filter(function(a){return a.sasSlotId}),c.slots.forEach(function(a){c.createSlotHTML(a)}),c.a9SlotsMap={},c.a9Slots=c.slots.map(function(a){return c.a9SlotsMap[a.element]=a.sasSlotId,{slotID:a.element,slotName:a.sasSlotId,sizes:c.getSizes(a)}}),c.refreshTime=3e4,c.refreshInterval=null,c.highRisk=null,c.floor=.05,c.savedBids={},c.stopWords=new window.Set(["a","about","above","after","again","against","all","am","an","and","any","are","as","at","be","because","been","before","being","below","between","both","but","by","could","did","do","does","doing","down","during","each","few","for","from","further","had","has","have","having","he","he'd","he'll","he's","her","here","here's","hers","herself","him","himself","his","how","how's","i","i'd","i'll","i'm","i've","if","in","into","is","it","it's","its","itself","let's","me","more","most","my","myself","nor","of","on","once","only","or","other","ought","our","ours","ourselves","out","over","own","same","she","she'd","she'll","she's","should","so","some","such","than","that","that's","the","their","theirs","them","themselves","then","there","there's","these","they","they'd","they'll","they're","they've","this","those","through","to","too","under","until","up","very","was","we","we'd","we'll","we're","we've","were","what","what's","when","when's","where","where's","which","while","who","who's","whom","why","why's","with","would","you","you'd","you'll","you're","you've","your","yours","yourself","yourselves"]),sas.cmd.push(function(){sas.setup({networkid:3370,domain:"https://www5.smartadserver.com",async:!0,renderMode:2,renderModeTimeout:999999,inSequence:!0})}),pbjs.que.push(function(){pbjs.setConfig({consentManagement:{cmpApi:"iab",timeout:8e3,allowAuctionWithoutConsent:!0},priceGranularity:{buckets:[{precision:2,max:15,increment:.01},{precision:2,max:20,increment:.05},{precision:2,max:50,increment:1}]},enableSendAllBids:!1,userSync:{iframeEnabled:!0,syncsPerBidder:5,filterSettings:{iframe:{bidders:"*",filter:"include"}}}})}),pbjs.que.push(function(){Object.keys(c.config.bidder_adjustments).forEach(function(a){"object"!==_typeof(pbjs.bidderSettings)&&(pbjs.bidderSettings={}),"object"!==_typeof(pbjs.bidderSettings[a])&&(pbjs.bidderSettings[a]={}),pbjs.bidderSettings[a].bidCpmAdjustment=function(b){var d=b*c.config.bidder_adjustments[a];return d<c.floor?0:d}}),"object"!==_typeof(pbjs.bidderSettings.standard)&&(pbjs.bidderSettings.standard={}),pbjs.bidderSettings.standard.adserverTargeting=[{key:"hb_bidder",val:function(a){return a.bidder}},{key:"hb_adid",val:function(a){return a.adId}},{key:"hb_pb",val:function(a){return a.pbHg}}]}),c}return _inherits(b,a),_createClass(b,[{key:"getEligibleA9Slots",value:function(){var a=this;return this.a9Slots.filter(function(b){return a.filterEligibleSlots(b,"slotID")})}},{key:"sasCall",value:function(a,b){var c=this,d=this.getTargeting(),e=this.getPage().pageId,f=!0;this.getEligibleSlots().forEach(function(g){sas.cmd.push(function(){var h=c.getSlotTargeting(a,g,d);sas.call("std",{siteId:290655,formatId:g.sasSlotId,tagId:g.element,pageId:e,target:h},{forceMasterFlag:f&&b,resetTimestamp:f&&b,onNoad:c.handleNoad.bind(c)})}),f=!1})}},{key:"createSafeSlots",value:function(a){window.clearTimeout(this.refreshInterval),this.highRisk=!1,_get(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"createSafeSlots",this).call(this,a),this.fetchBids(a),this.disabledRefresh||(this.refreshInterval=window.setTimeout(this.createSafeSlots.bind(this,!1),this.refreshTime))}},{key:"createHighRiskSlots",value:function(a){window.clearTimeout(this.refreshInterval),this.highRisk=!0,_get(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"createHighRiskSlots",this).call(this,a),this.fetchBids(a),this.disabledRefresh||(this.refreshInterval=window.setTimeout(this.createHighRiskSlots.bind(this,!1),this.refreshTime))}},{key:"fetchBids",value:function(a){var b=this;a&&this.slots.forEach(function(a){b.setViewedSlot(a.element)}),document.hidden||(window.apstag?this.fetchBidsWithAmazon(a):(this.sasCall(null,a),this.requestPrebidBids(null,a)))}},{key:"fetchBidsWithAmazon",value:function(a){var b=this,c=this.getEligibleA9Slots();0!==c.length&&(window.__cmp?window.__cmp("getConsentData",null,function(d){(!d.gdprApplies||d.gdprApplies&&d.hasGlobalConsent)&&apstag.fetchBids({slots:c},function(c){a&&b.sasCall(c,a),b.requestPrebidBids(c,a)})}):apstag.fetchBids({slots:c},function(c){a&&b.sasCall(c,a),b.requestPrebidBids(c,a)}))}},{key:"createSlotHTML",value:function(a){var b=document.getElementById(a.element);if(!b){b=document.createElement("div"),b.setAttribute("id",a.element);var c=$(a.insertSelector);c[a.insertMethod].call(c,b),$(b).addClass("advertisement nodisplay div-ad-active-"+a.name)}}},{key:"getPrebidBidders",value:function(a){var b=[];return Object.keys(a).forEach(function(c){a[c].config&&a[c].prod&&b.push(a[c].config)}),b}},{key:"hideAds",value:function(){window.clearTimeout(this.refreshInterval),sas.cmd.push(function(){sas.clean()}),_get(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"hideAds",this).call(this)}},{key:"setDisabledRefresh",value:function(){window.clearTimeout(this.refreshInterval),this.disabledRefresh=!0}},{key:"requestPrebidBids",value:function(a,b){var c=this;pbjs.que.push(function(){var d=[];c.getEligibleSlots().forEach(function(a){if(a.prebid){var b=c.getPrebidBidders(a.prebid);d.push({code:a.element,mediaTypes:{banner:{sizes:c.getSizes(a)}},bids:b})}}),pbjs.requestBids({bidsBackHandler:c.sendAdserverRequest.bind(c,a,b),timeout:window.PREBID_TIMEOUT,adUnits:d})})}},{key:"getBidsByHighestCpm",value:function(a){var b=pbjs.getBidResponses(),c=b[a],d=this.savedBids[a]?this.savedBids[a].filter(this.isBidValid):[];return c&&0!==c.bids.length?c.bids.concat(d).filter(function(a){return a.cpm>0}).sort(function(a,b){return b.cpm-a.cpm}):d}},{key:"getHighestCpmBid",value:function(a){var b=this.getBidsByHighestCpm(a);return b[0]||{}}},{key:"saveValidBidsForUnit",value:function(a,b){this.savedBids[a]=b.filter(this.isBidValid)}},{key:"isBidValid",value:function(a){return"rendered"!==a.status&&(Date.now()-new Date(a.responseTimestamp).getTime())/1e3<a.ttl}},{key:"viewCallback",value:function(a){this.setViewedSlot(a)}},{key:"sendAdserverRequest",value:function(a,b){var c=this;sas.cmd.push(function(){pbjs.que.push(function(){var d=c.getTargeting();c.getEligibleSlots().forEach(function(e){var f=c.getBidsByHighestCpm(e.element),g=f[0]||{},h=c.getSlotTargeting(a,e,d);g.adId&&(g.currency=g.currency||"USD"),sas.setHeaderBiddingWinner(e.element,g),c.saveValidBidsForUnit(e.element,f.slice(1)),window.Viewability&&(c.clearViewedSlot(e.element),(new window.Viewability).init(document.getElementById(e.element),{},{area:35,delay:1,viewCallback:c.viewCallback.bind(c,e.element)})),b||sas.refresh(e.element,{forceMasterFlag:!1,resetTimestamp:!1,target:h})}),b&&sas.render()})})}},{key:"handleNoad",value:function(a){var b=this.getHighestCpmBid(a.tagId);if(b.adId){var c=document.createElement("iframe");c.style.width=b.width,c.style.height=b.height,c.style.overflow="hidden",c.setAttribute("scrolling","no"),c.setAttribute("frameborder",0),document.getElementById(a.tagId).appendChild(c),pbjs.renderAd(c.contentWindow.document,b.adId),c.contentWindow.document.body.style.padding=0,c.contentWindow.document.body.style.margin=0}}},{key:"receiveMessage",value:function(a){if(a&&a.data&&"string"==typeof a.data){var b=a.data.match(/disableRefreshForSession:(\S+);?/);if(b&&b[1]){var c=b[1];return void this.setDisabledRefreshSlot(c)}if(b=a.data.match(/disableTimedRefresh:(\S+);?/),b&&b[1]){var d=b[1];return void this.setDisabledTimedRefreshSlot(d)}}}},{key:"getTargeting",value:function(){var a="";a+="adblock="+(window.usesABP?"true":"false")+";",a+="login="+(Imgur.Environment.auth.isLoggedIn?"true":"false")+";",a+="3p="+(this.highRisk?"true":"false")+";",a+="page="+this.getPage().name+";",a+="detectedLanguage="+window.navigator.language+";",a+="url="+this.getURL()+";";var b=Imgur.Util.getQueryParams(window.location.search);"insertionID"in b&&b.insertionID&&(a+="insertionID="+b.insertionID+";"),this.config.environment_type&&(a+="environment_type="+this.config.environment_type+";");var c=JSON.parse(window.localStorage.getItem("ccRealtimeData")),d=c?c.audiences.map(function(a){return"crbn_sgmt="+a.id}).join(";"):null;if(d&&(a+=d+";"),this.post){if(this.post.galleryTags&&this.post.galleryTags.forEach(function(b){a+="item_tag="+b.tag+";"}),this.post.adConfig){var e=this.post.adConfig.safeFlags,f=e.indexOf("gallery")>-1?"gallery":"nongallery",g=null;g="gallery"==f?e.indexOf("sixth_mod_safe")>-1?"g_6th":"g_o10":e.indexOf("sixth_mod_safe")>-1?"ng_6th":"ng_unknown",a+="safe_reason="+g+";"}if(this.post.title){var h=this.getTitleKeywords(this.post.title);h.forEach(function(b){a+="keywords="+b+";"})}this.post.is_hot&&(a+="post=mostviral;");var i="videosunmuted",j="videosmuted";if(this.post.is_album){for(var k="",l=0;l<this.post.album_images.length;l++){var m=this.post.album_images[l];if(m.has_sound){k=i;break}m.animated&&(k=j)}k&&(a+="videopost="+k+";")}else this.post.has_sound?a+="videopost="+i+";":this.post.animated&&(a+="videopost="+j+";")}return a+="|refresh_count="+this.refreshCount+";",a+="pv="+Imgur.UserStatistics.getInstance().getPageView().toString()+";"}},{key:"getTargetingWithAmazon",value:function(a,b,c){var d=this,e=c;if(!a)return e;var f=function(f){if(a[f].slotID===b.element){var g="";return Object.keys(a[f].targeting).forEach(function(b){g+=b+"_"+d.a9SlotsMap[a[f].slotID]+"="+a[f].targeting[b]+";"}),e=c?""+g+c:g,"break"}};for(var g in a){var h=f(g);if("break"===h)break}return e}},{key:"getSlotTargeting",value:function(a,b,c){var d=this.getTargetingWithAmazon(a,b,c);if(b.restricted){var e=window.innerHeight>b.restricted?"allowed":"restricted";d="flex="+e+";"+d}if(b.isSCTU){var f=Object.keys(Imgur.LocalStorage.getItems("sctusClosed"));f.length>0&&f.forEach(function(a){d+="HLClose="+a+";"})}return d}},{key:"getPage",value:function(){return"/"===window.location.pathname?{name:"home",pageId:1066790}:window.location.pathname.startsWith("/gallery/")?{name:"gallery",pageId:1068367}:window.location.pathname.startsWith("/a/")?{name:"albums",pageId:1068369}:window.location.pathname.startsWith("/t/")?{name:"t/tag",pageId:1068370}:window.location.pathname.startsWith("/r/")?{name:"r/subreddit",pageId:1068368}:{name:"non-gallery",pageId:1068368}}},{key:"getTitleKeywords",value:function(a){var b=this,c=[];return a.replace(/[^0-9a-zA-Z ]/g,"").split(" ").forEach(function(a){var d=a.toLowerCase();d&&!b.stopWords.has(d)&&c.push(d)}),c}},{key:"getURL",value:function(){return window.location.href}},{key:"getSizes",value:function(a){var b=a.sizes,c=window.innerHeight;if(a.sizeMapping){var d=void 0;Object.keys(a.sizeMapping).forEach(function(b){!d&&c<b&&(d=a.sizeMapping[b])}),d&&(b=d)}return b}}]),b}(SlotManager),_createClass=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(a,d.key,d)}}return function(b,c,d){return c&&a(b.prototype,c),d&&a(b,d),b}}(),_get=function b(a,c,d){null===a&&(a=Function.prototype);var e=Object.getOwnPropertyDescriptor(a,c);if(void 0===e){var f=Object.getPrototypeOf(a);return null===f?void 0:b(f,c,d)}if("value"in e)return e.value;var g=e.get;if(void 0!==g)return g.call(d)};window.yieldlove_site_id="yieldlove.com_demo",window.yieldlove_prevent_autostart=!0,window.yieldlove_cmd=window.yieldlove_cmd||[];var googletag=googletag||{};googletag.cmd=googletag.cmd||[],googletag.cmd.push(function(){googletag.pubads().disableInitialLoad(),googletag.pubads().enableSingleRequest(),googletag.enableServices()});var YieldloveSlots=function(a){function b(a){_classCallCheck(this,b);var c=_possibleConstructorReturn(this,(b.__proto__||Object.getPrototypeOf(b)).call(this,a)),d=document.createElement("script");d.src="https://cdn-a.yieldlove.com/yieldlove-bidder.js?imgur.com",d.async=!0,document.getElementsByTagName("head")[0].appendChild(d);var e=document.createElement("script");return e.src="https://www.googletagservices.com/tag/js/gpt.js",e.async=!0,document.getElementsByTagName("head")[0].appendChild(e),c.slots=c.config.active_slots.filter(function(a){return a.yieldloveId}),c.slots.forEach(function(a){c.createSlotHTML(a)}),c}return _inherits(b,a),_createClass(b,[{key:"createSafeSlots",value:function(a){this.highRisk=!1,_get(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"createSafeSlots",this).call(this,a),this.fetchBids(a)}},{key:"createHighRiskSlots",value:function(a){this.highRisk=!0,_get(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"createHighRiskSlots",this).call(this,a),this.fetchBids(a)}},{key:"fetchBids",value:function(a){var b=this;window.__cmp&&window.__cmp("getConsentData",null,function(c){if(!c.gdprApplies||c.gdprApplies&&c.hasGlobalConsent){if(!a)return void window.yieldlove_cmd.push(function(){window.YLHH.bidder.startAuction()});b.slots.forEach(function(a){googletag.cmd.push(function(){var b=googletag.defineSlot(a.yieldloveId,a.sizes,a.element);b&&b.addService(googletag.pubads()),googletag.display(a.element)}),window.yieldlove_cmd.push(function(){window.YLHH.bidder.startAuction(a.yieldloveId)})})}})}},{key:"hideAds",value:function(){googletag.cmd.push(function(){window.googletag.destroySlots()}),_get(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"hideAds",this).call(this)}},{key:"createSlotHTML",value:function(a){var b=document.getElementById(a.element);if(!b){b=document.createElement("div"),b.setAttribute("id",a.element);var c=$(a.insertSelector);c[a.insertMethod].call(c,b),$(b).addClass("advertisement nodisplay div-ad-active-"+a.name)}}}]),b}(SlotManager),_createClass=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(a,d.key,d)}}return function(b,c,d){return c&&a(b.prototype,c),d&&a(b,d),b}}(),_get=function c(a,b,d){null===a&&(a=Function.prototype);var e=Object.getOwnPropertyDescriptor(a,b);if(void 0===e){var f=Object.getPrototypeOf(a);return null===f?void 0:c(f,b,d)}if("value"in e)return e.value;var g=e.get;if(void 0!==g)return g.call(d)},BlockthroughSlots=function(a){function b(a){_classCallCheck(this,b);var c=_possibleConstructorReturn(this,(b.__proto__||Object.getPrototypeOf(b)).call(this,a));if(c.fetchOnLoad=!1,c.slots=c.config.active_slots.filter(function(a){return a.sasSlotId&&a.blockthrough_id}),c.config.adblock_partners&&c.config.adblock_partners.blockthrough){var d=document.createElement("script");d.src=c.config.adblock_partners.blockthrough.src,d.async=!0,d.onload=function(){c.fetchOnLoad&&c.fetchBids()},document.getElementsByTagName("head")[0].appendChild(d)}return c}return _inherits(b,a),_createClass(b,[{key:"createSafeSlots",value:function(a){_get(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"createSafeSlots",this).call(this,a),this.createSlotHTML(),this.fetchBids()}},{key:"createHighRiskSlots",value:function(a){_get(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"createHighRiskSlots",this).call(this,a),this.createSlotHTML(),this.fetchBids()}},{key:"createSlotHTML",value:function(){var a=this;this.slots.forEach(function(b){var c=document.getElementById(b.element);if(c)return c.innerHTML="",a.createBlockthroughSlotHTML(b,c);c=document.createElement("div"),c.setAttribute("id",b.element);var d=void 0;d=".panel-ad"===b.insertSelector?$(".panel-bt"):$(b.insertSelector),d[b.insertMethod].call(d,c),$(c).addClass("advertisement div-ad-active-"+b.name),a.createBlockthroughSlotHTML(b,c)})}},{key:"createBlockthroughSlotHTML",value:function(a,b){var c=document.createElement("span");c.setAttribute("data-uid",a.blockthrough_id),c.setAttribute("style","display: none !important"),c.classList.add("bt-uid-tg"),b.append(c)}},{key:"hideAds",value:function(){_get(b.prototype.__proto__||Object.getPrototypeOf(b.prototype),"hideAds",this).call(this),this.slots.forEach(function(a){var b=document.getElementById(a.element);b&&(b.innerHTML="")})}},{key:"fetchBids",value:function(){return window.BT?window.BT.clearThrough():void(this.fetchOnLoad=!0)}}]),b}(SlotManager),_createClass=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(a,d.key,d)}}return function(b,c,d){return c&&a(b.prototype,c),d&&a(b,d),b}}(),NoAdSlots=function(a){function b(){return _classCallCheck(this,b),_possibleConstructorReturn(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments))}return _inherits(b,a),_createClass(b,[{key:"createSafeSlots",value:function(){}},{key:"createHighRiskSlots",value:function(){}}]),b}(SlotManager);Namespace("Imgur.Fullscreen"),Imgur.Fullscreen=Class.extend({init:function(a){this._=$.extend({signed:Imgur.getInstance()._.signed,el:{$fullscreenBox:$(".fullscreenBox"),$fullscreenLink:$(".album-fullscreen-link"),$userActionLinks:$(".userActionLinks"),$embed:$("#fullscreenEmbed")}},a),window.fullScreenApi&&fullScreenApi.supportsFullScreen&&this._.el.$embed.length&&(this._.signed&&(this._.el.$fullscreenBox.hide(),this._.el.$fullscreenBox=$(".fullscreenAlbumOptions"),this._.el.$fullscreenLink=$(".fullscreenAlbumOptions .album-fullscreen-link")),this._.el.$fullscreenLink.length&&(this._.el.$fullscreenLink.unbind("click"),this._.el.$fullscreenLink[0].removeEventListener("click",this.viewFullscreen),this._.el.$fullscreenLink[0].addEventListener("click",this.viewFullscreen,!0)),this._.el.$userActionLinks.hasClass("vertical")&&this._.el.$userActionLinks.css({"line-height":"22px",padding:"8px","font-size":"13px"}),this._.el.$embed.attr("src",""),this._.el.$fullscreenBox.show())},viewFullscreen:function(){var a=Imgur.Fullscreen.getInstance(),b=a._.el.$embed,c=b[0];if(a._.el.$embed.length){if(!a._.el.$embed.attr("src")||!a._.el.$embed.attr("src").length)return a._.el.$embed.attr("src","/a/"+Imgur.Album.getInstance()._.id+"/embed"),$(a._.el.$embed[0].contentDocument).ready(a.viewFullscreen),void humanMsg.displayMsg("Starting fullscreen mode...")}else setTimeout(a.viewFullscreen,80);a._.el.$embed.show(),window.fullScreenApi.requestFullScreen(c),setTimeout(a.focusOverlayAfterOpen,99);var d=setInterval(function(){a.showOverlayIfOpen(d)},100),e=setInterval(function(){a.closeOverlayIfExited(e)},100)},focusOverlayAfterOpen:function(){var a=Imgur.Fullscreen.getInstance();fullScreenApi.isFullScreen()?(a._.el.$embed[0].contentWindow.focus(),$(a._.el.$embed[0].contentWindow).keydown(function(b){27==b.which&&a._.el.$embed.hide(),b.stopPropagation()})):(window.fullScreenApi.requestFullScreen(a._.el.$embed[0]),setTimeout(a.focusOverlayAfterOpen,200))},showOverlayIfOpen:function(a){var b=Imgur.Fullscreen.getInstance();b._.el.$embed.is(":visible")?clearInterval(a):b._.el.$embed.css({display:"block",opacity:"100%"})},closeOverlayIfExited:function(a){var b=Imgur.Fullscreen.getInstance();fullScreenApi.isFullScreen()||(b._.el.$embed.is(":visible")?b._.el.$embed.css({display:"none"}):clearInterval(a))}}),Class.addSingleton(Imgur.Fullscreen);var _extends=Object.assign||function(a){for(var b=1;b<arguments.length;b++){var c=arguments[b];for(var d in c)Object.prototype.hasOwnProperty.call(c,d)&&(a[d]=c[d])}return a},_createClass=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(a,d.key,d)}}return function(b,c,d){
return c&&a(b.prototype,c),d&&a(b,d),b}}(),REACTION_STATE_COLLECTIONS="collections",REACTION_STATE_COLLECTION="collection",GRID_COLORS_LOADING=["#ffdd00","#1bb76e","#227efa","#4a58fb","#6432f9","#ec4081","#4366d0","#7b85f7","#fc6369","#f14768","#ff51ba","#2ccaff","#43d0bd","#20bee8","#ffd300","#ff7d00"],ReactionGifPickerHeader=function(a){function b(){return _classCallCheck(this,b),_possibleConstructorReturn(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments))}return _inherits(b,a),_createClass(b,[{key:"render",value:function(){var a={};return this.props.sponsoredReactionGifs.is_active&&(a.backgroundImage="linear-gradient(#"+this.props.sponsoredReactionGifs.header_gradiant_top+", #"+this.props.sponsoredReactionGifs.header_gradiant_bottom+")",a.color="#"+this.props.sponsoredReactionGifs.header_text_color),React.createElement("div",{className:"gifpicker-header",style:a},React.createElement("div",{className:"gifpicker-header-content"},this.props.sponsoredReactionGifs.is_active?React.createElement("div",null,React.createElement("p",{className:"gifpicker-header-content-title"},this.props.sponsoredReactionGifs.header_title),React.createElement("p",{className:"gifpicker-header-content-desc"},this.props.sponsoredReactionGifs.header_subtitle)):React.createElement("p",{className:"gifpicker-header-content-title"},"REACTION GIFs")),this.props.sponsoredReactionGifs.is_active&&React.createElement("img",{className:"gifpicker-header-asset",src:"https:"+Imgur.Environment.cdnUrl+"/"+this.props.sponsoredReactionGifs.header_image+".png"}))}}]),b}(React.Component);Imgur.ReactionGifPickerHeader=ReactionGifPickerHeader;var ReactionGifPickerCollectionItem=function(a){function b(){var a,c,d,e;_classCallCheck(this,b);for(var f=arguments.length,g=Array(f),h=0;h<f;h++)g[h]=arguments[h];return c=d=_possibleConstructorReturn(this,(a=b.__proto__||Object.getPrototypeOf(b)).call.apply(a,[this].concat(g))),d.showCollection=function(){var a=d.props,b=a.shortname,c=a.name;d.props.fetchCollection({shortname:b,name:c})},e=c,_possibleConstructorReturn(d,e)}return _inherits(b,a),_createClass(b,[{key:"render",value:function(){var a=this,b={backgroundImage:"linear-gradient("+getColorByPostIndex(this.props.index)+", #2e3035)"},c="https:"+Imgur.Environment.cdnUrl+"/"+this.props.preview,d=c+"_lq.mp4";return React.createElement("div",{ref:function(b){return a.collection=b},className:"gifpicker-collection",onClick:this.showCollection},React.createElement("video",{style:b,className:"gifpicker-collectionBackground",autoPlay:!0,preload:"none",loop:!0,playsInline:!0},React.createElement("source",{type:"video/mp4",src:d})),React.createElement("h2",{className:"gifpicker-collectionName"},this.props.name,this.props.is_promoted&&React.createElement("span",{className:"gifpicker-collectionByLine"},this.props.subtitle)))}}]),b}(React.Component);Imgur.ReactionGifPickerCollectionItem=ReactionGifPickerCollectionItem;var ReactionGifPickerCollections=function(a){function b(){return _classCallCheck(this,b),_possibleConstructorReturn(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments))}return _inherits(b,a),_createClass(b,[{key:"render",value:function(){var a=this.props.fetchCollection;return React.createElement("div",{className:"gifpicker-body"},this.props.collections.map(function(b,c){return React.createElement(ReactionGifPickerCollectionItem,_extends({key:b.shortname},{fetchCollection:a,index:c},b))}))}}]),b}(React.Component);Imgur.ReactionGifPickerCollections=ReactionGifPickerCollections;var ReactionGifPickerCollectionsLoader=function(a){function b(){return _classCallCheck(this,b),_possibleConstructorReturn(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments))}return _inherits(b,a),_createClass(b,[{key:"render",value:function(){for(var a=[],b=0;b<10;b++)a.push(React.createElement("div",{className:"gifpicker-collection",key:"CollectionsLoaderItem-"+b,style:{backgroundImage:"linear-gradient("+getColorByPostIndex(b)+", #2e3035)"}}));return React.createElement("div",{className:"gifpicker-body"},a)}}]),b}(React.Component);Imgur.ReactionGifPickerCollectionsLoader=ReactionGifPickerCollectionsLoader;var ReactionGifImage=function(a){function b(){var a,c,d,e;_classCallCheck(this,b);for(var f=arguments.length,g=Array(f),h=0;h<f;h++)g[h]=arguments[h];return c=d=_possibleConstructorReturn(this,(a=b.__proto__||Object.getPrototypeOf(b)).call.apply(a,[this].concat(g))),d.selectImage=function(a){d.props.handleImageSelection(a),Imgur.Util.jafoLogEvent(Imgur.AnalyticCategories.SEARCH,Imgur.AnalyticEventNames.reactionGIFSelected,{"Completion Type":"Selected",Location:"Comment",Search:d.props.activeCollectionShortname,"Sponsored Visible":d.props.promoted})},e=c,_possibleConstructorReturn(d,e)}return _inherits(b,a),_createClass(b,[{key:"render",value:function(){var a=this,b="https:"+Imgur.Environment.cdnUrl+"/"+this.props.id,c=b+".gif",d=b+"_lq.mp4",e={height:this.props.gifHeight};return React.createElement("div",{ref:function(b){return a.image=b},style:e,className:"gifpicker-image",onClick:function(){return a.selectImage(c)}},React.createElement("video",{autoPlay:!0,preload:"none",loop:!0,playsInline:!0,height:this.props.gifHeight,width:"142"},React.createElement("source",{type:"video/mp4",src:d})))}}]),b}(React.Component);Imgur.ReactionGifImage=ReactionGifImage;var ReactionGifPickerCollectionList=function(a){function b(){return _classCallCheck(this,b),_possibleConstructorReturn(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments))}return _inherits(b,a),_createClass(b,[{key:"render",value:function(){var a=this.props.images.slice(0,this.props.gifsToLoad).reduce(b.reduceToGrid,_.extend({},{colTotalHeights:[0,0],cols:[]},this.props)),c=a.cols;return React.createElement("div",{className:"gifpicker-body gifpicker-collectionBody"},c.map(function(a){return React.createElement("div",null,a)}),this.props.children)}}],[{key:"reduceToGrid",value:function(a,b,c){for(var d=a.colTotalHeights,e=a.postHash,f=a.handleImageSelection,g=a.promoted,h=a.activeCollectionShortname,i=d.length,j=0,k=Number.POSITIVE_INFINITY,l=142,m=l/b.width,n=b.height*m,o=0;o<i;o++)d[o]<k&&(j=o,k=d[o]);return a.cols[j]||(a.cols[j]=[]),a.cols[j].push(React.createElement(ReactionGifImage,_extends({activeCollectionShortname:h,postHash:e,key:b.id,gifHeight:n,promoted:g},{handleImageSelection:f,index:c},b))),a.colTotalHeights[j]=k+n,a}}]),b}(React.Component);Imgur.ReactionGifPickerCollectionList=ReactionGifPickerCollectionList;var ReactionGifPickerCollectionHeader=function(a){function b(){return _classCallCheck(this,b),_possibleConstructorReturn(this,(b.__proto__||Object.getPrototypeOf(b)).apply(this,arguments))}return _inherits(b,a),_createClass(b,[{key:"render",value:function(){var a=this;return React.createElement("div",{className:"gifpicker-collectionHeader"},React.createElement("div",{ref:function(b){return a.backButton=b},className:"gifpicker-backButton",onClick:this.props.backToCollections},React.createElement(ArrowIcon,{color:"#fff"})),React.createElement("h1",{className:"gifpicker-collectionHeaderText"},this.props.activeCollectionName))}}]),b}(React.Component);Imgur.ReactionGifPickerCollectionHeader=ReactionGifPickerCollectionHeader;var DEFAULT_NUM_GIFS_IN_PICKER=10,NUM_GIFS_TO_ADD_TO_PICKER=5,ReactionGifPicker=function(a){function b(a){_classCallCheck(this,b);var c=_possibleConstructorReturn(this,(b.__proto__||Object.getPrototypeOf(b)).call(this,a));return c.state={gifsToLoad:DEFAULT_NUM_GIFS_IN_PICKER},c.handleOnScrollCollection=_.throttle(c.handleOnScrollCollection.bind(c),50,{leading:!0,trailing:!0}),c}return _inherits(b,a),_createClass(b,[{key:"componentDidUpdate",value:function(a,b){a.mode!==this.props.mode&&this.setState({gifsToLoad:DEFAULT_NUM_GIFS_IN_PICKER})}},{key:"componentDidMount",value:function(){this.props.fetchReactionCollections()}},{key:"handleOnScrollCollection",value:function(){if(this.props.mode!==REACTION_STATE_COLLECTIONS&&this.triggerScroll&&this.gifpicker){var a=this.triggerScroll.getBoundingClientRect().top,b=this.gifpicker.getBoundingClientRect().bottom,c=this.props.activeCollectionItemsFetched<=this.state.gifsToLoad;if(c&&a-200<b)this.props.fetchCollection();else if(!c&&a-300<b){var d=this.state.gifsToLoad+NUM_GIFS_TO_ADD_TO_PICKER;this.setState({gifsToLoad:Math.min(d,this.props.activeCollectionItemsFetched)})}}}},{key:"render",value:function(){var a=this,b="400px",c=classNames({gifpicker:!0,"promo-gifpicker":this.props.sponsoredReactionGifs.is_active});return React.createElement("div",{className:c,onScroll:this.handleOnScrollCollection,ref:function(b){return a.gifpicker=b}},React.createElement(ReactionGifPickerHeader,this.props),this.props.error&&React.createElement("p",{className:"gifpicker-error center"},this.props.error),React.createElement(Imgur.Nanoscroll,{key:"reaction-nanoscroller",options:{preventPageScrolling:!0},contentClassNames:"scroll-content",contentStyle:{height:b},nanoStyle:{height:b}},React.createElement("div",{className:"gifpicker-body-container"},this.props.mode===REACTION_STATE_COLLECTIONS&&React.createElement("div",null,this.props.loading&&React.createElement(ReactionGifPickerCollectionsLoader,null),!this.props.loading&&React.createElement(ReactionGifPickerCollections,{collections:this.props.collections,fetchCollection:this.props.fetchCollection})),this.props.mode===REACTION_STATE_COLLECTION&&React.createElement("div",null,React.createElement(ReactionGifPickerCollectionHeader,this.props),React.createElement(ReactionGifPickerCollectionList,{gifsToLoad:this.state.gifsToLoad,postHash:this.props.postHash,promoted:this.props.promoted,images:this.props.activeCollection,activeCollectionShortname:this.props.activeCollectionShortname,handleImageSelection:this.props.handleImageSelection},!this.props.loading&&this.props.activeCollectionPagingEnabled&&React.createElement("div",{key:"loader",style:{height:50},ref:function(b){return a.triggerScroll=b}}))))))}}]),b}(React.Component);Imgur.ReactionGifPicker=ReactionGifPicker;var ReactionGifPickerContainer=function(a){function b(){var a,c,d,e;_classCallCheck(this,b);for(var f=arguments.length,g=Array(f),h=0;h<f;h++)g[h]=arguments[h];return c=d=_possibleConstructorReturn(this,(a=b.__proto__||Object.getPrototypeOf(b)).call.apply(a,[this].concat(g))),d.state={mode:REACTION_STATE_COLLECTIONS,collections:[],loading:!0,error:"",activeCollection:[],activeCollectionName:"",activeCollectionShortname:"",activeCollectionPagingEnabled:!0,activeCollectionItemsFetched:0,activeCollectionParams:{q:"",page:0}},d.fetchReactionCollections=function(){var a=d.getCollectionsApiEndpoint()+d.getEndpointParameters();fetch(a).then(function(a){if(200===a.status)return a.json();throw new Error(a.statusText)}).then(function(a){d.setState({loading:!1,collections:d.state.collections.concat(a.data),mode:REACTION_STATE_COLLECTIONS,error:""},d.handleOnScrollCollection)})["catch"](function(a){d.setState({loading:!1,error:"There was an error getting reactions",mode:REACTION_STATE_COLLECTIONS})})},d.fetchReactionCollection=function(a){var b=d.state.activeCollectionParams,c={mode:REACTION_STATE_COLLECTION,loading:!0};a&&(b=_.assign(b,{q:a.shortname}),c.activeCollectionName=a.name,c.activeCollectionShortname=a.shortname);var e=d.getSearchFullApiEndpoint()+d.getEndpointParameters(b);d.setState(c),fetch(e).then(function(a){if(200===a.status)return a.json();throw new Error(a.statusText)}).then(function(c){a&&a.shortname!==c.data.query||d.setState({loading:!1,activeCollection:d.state.activeCollection.concat(c.data.images),error:"",activeCollectionItemsFetched:d.state.activeCollectionItemsFetched+c.data.images.length,activeCollectionPagingEnabled:c.data.images.length>0,activeCollectionParams:_.assign({page:d.state.activeCollectionParams.page++},b)})})["catch"](function(a){d.setState({loading:!1,activeCollectionParams:b,error:"There was an error finding images"})})},d.resetCollectionMode=function(){d.setState({mode:REACTION_STATE_COLLECTIONS,activeCollection:[],activeCollectionName:"",activeCollectionShortname:"",activeCollectionItemsFetched:0,error:"",activeCollectionPagingEnabled:!0,activeCollectionParams:{q:"",page:0},imageSelected:!1})},d.handleImageSelection=function(a){d.setState({imageSelected:!0},function(){d.props.handleImageSelection(a)})},e=c,_possibleConstructorReturn(d,e)}return _inherits(b,a),_createClass(b,[{key:"componentWillUnmount",value:function(){this.state.imageSelected||Imgur.Util.jafoLogEvent(Imgur.AnalyticCategories.SEARCH,Imgur.AnalyticEventNames.reactionGIFSelected,{"Completion Type":"Cancelled",Location:"Comment",Search:this.props.activeCollectionShortname,"Sponsored Visible":this.isPromoted()})}},{key:"getReactionApiBaseUrl",value:function(){return Imgur.Environment.apiUrl+"/3/reaction"}},{key:"getCollectionsApiEndpoint",value:function(){return this.getReactionApiBaseUrl()+"/collections"}},{key:"getSearchFullApiEndpoint",value:function(){return this.getReactionApiBaseUrl()+"/search_full"}},{key:"isPromoted",value:function(){return!!this.props.sponsoredReactionGifs.is_active}},{key:"getEndpointParameters",value:function(){var a=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},b=$.cookie("backstage");return b&&(a.backstage=b),"?client_id="+Imgur.Environment.apiClientId+"&"+$.param(a)}},{key:"render",value:function(){var a={fetchReactionCollections:this.fetchReactionCollections,fetchCollection:_.debounce(this.fetchReactionCollection.bind(this),100,{leading:!0,trailing:!0}),backToCollections:this.resetCollectionMode,loading:this.state.loading,error:this.state.error,collections:this.state.collections,activeCollection:this.state.activeCollection,activeCollectionName:this.state.activeCollectionName,activeCollectionShortname:this.state.activeCollectionShortname,activeCollectionItemsFetched:this.state.activeCollectionItemsFetched,mode:this.state.mode,promoted:this.isPromoted(),handleImageSelection:this.handleImageSelection,activeCollectionPagingEnabled:this.state.activeCollectionPagingEnabled,postHash:this.props.postHash,sponsoredReactionGifs:this.props.sponsoredReactionGifs};return React.createElement(ReactionGifPicker,a)}}]),b}(React.Component);ReactionGifPickerContainer.defaultProps={sponsoredReactionGifs:{is_active:!1}},Imgur.ReactionGifPickerContainer=ReactionGifPickerContainer,Namespace("Imgur.Caption.Reply"),Imgur.Caption.Reply=React.createClass({displayName:"Reply",propTypes:{image:React.PropTypes.object.isRequired,parentId:React.PropTypes.number,parentAuthorId:React.PropTypes.number,autofocus:React.PropTypes.bool,onSuccess:React.PropTypes.func,closeReply:React.PropTypes.func,imagePreviewEnabled:React.PropTypes.bool,isCommunityTeam:React.PropTypes.bool},contextTypes:{msid:React.PropTypes.string.isRequired,onSubmit:React.PropTypes.func.isRequired},getDefaultProps:function(){return{maxLength:140,autofocus:!1,imagePreviewEnabled:!0}},getInitialState:function(){return{text:"",imageLinks:[],error:"",showingLoader:!1,showReactionGifPicker:!1,hasAdminBadge:!1}},componentDidMount:function(){$(this.refs.textarea).autoResize({animate:!1,extraSpace:0}),$(this.refs.gifButton).tipsy({opacity:.95,gravity:$.fn.tipsy.autoNS,fade:!0}),this.props.autofocus&&this.refs.textarea.focus()},getValue:function(){return $.trim(this.state.text)},handleSubmit:function(a){a.preventDefault(),a.stopPropagation(),this._submit()},handleEmailNotVerifiedError:function(){$.colorbox({href:"/lightboxes/verifyemail",open:!0,iframe:!0,top:"15%",transition:"none",scrolling:!1,innerWidth:"520px",innerHeight:"256px",onComplete:_.bind(function(){$.get("/ajax/send_email_verification"),checkEmailVerification("",this.handleShare)},this)})},handleError:function(a){var b=_.isObject(a.responseJSON)?a.responseJSON:a;if(b&&"data"in b&&"error"in b.data&&"message"in b.data.error){var c=b.data.error.message;"NotVerified"===c?this.handleEmailNotVerifiedError():this.setState({error:c})}else this.setState({error:"An unknown error occurred."})},getLength:function(a){var b=/((?:[\0-\u02FF\u0370-\u0482\u048A-\u0590\u05BE\u05C0\u05C3\u05C6\u05C8-\u060F\u061B-\u064A\u0660-\u066F\u0671-\u06D5\u06DD\u06DE\u06E5\u06E6\u06E9\u06EE-\u0710\u0712-\u072F\u074B-\u07A5\u07B1-\u07EA\u07F4-\u07FC\u07FE-\u0815\u081A\u0824\u0828\u082E-\u0858\u085C-\u08D2\u08E2\u0904-\u0939\u093D\u0950\u0958-\u0961\u0964-\u0980\u0984-\u09BB\u09BD\u09C5\u09C6\u09C9\u09CA\u09CE-\u09D6\u09D8-\u09E1\u09E4-\u09FD\u09FF\u0A00\u0A04-\u0A3B\u0A3D\u0A43-\u0A46\u0A49\u0A4A\u0A4E-\u0A50\u0A52-\u0A6F\u0A72-\u0A74\u0A76-\u0A80\u0A84-\u0ABB\u0ABD\u0AC6\u0ACA\u0ACE-\u0AE1\u0AE4-\u0AF9\u0B00\u0B04-\u0B3B\u0B3D\u0B45\u0B46\u0B49\u0B4A\u0B4E-\u0B55\u0B58-\u0B61\u0B64-\u0B81\u0B83-\u0BBD\u0BC3-\u0BC5\u0BC9\u0BCE-\u0BD6\u0BD8-\u0BFF\u0C05-\u0C3D\u0C45\u0C49\u0C4E-\u0C54\u0C57-\u0C61\u0C64-\u0C80\u0C84-\u0CBB\u0CBD\u0CC5\u0CC9\u0CCE-\u0CD4\u0CD7-\u0CE1\u0CE4-\u0CFF\u0D04-\u0D3A\u0D3D\u0D45\u0D49\u0D4E-\u0D56\u0D58-\u0D61\u0D64-\u0D81\u0D84-\u0DC9\u0DCB-\u0DCE\u0DD5\u0DD7\u0DE0-\u0DF1\u0DF4-\u0E30\u0E32\u0E33\u0E3B-\u0E46\u0E4F-\u0EB0\u0EB2\u0EB3\u0EBA\u0EBD-\u0EC7\u0ECE-\u0F17\u0F1A-\u0F34\u0F36\u0F38\u0F3A-\u0F3D\u0F40-\u0F70\u0F85\u0F88-\u0F8C\u0F98\u0FBD-\u0FC5\u0FC7-\u102A\u103F-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u1090-\u1099\u109E-\u135C\u1360-\u1711\u1715-\u1731\u1735-\u1751\u1754-\u1771\u1774-\u17B3\u17D4-\u17DC\u17DE-\u180A\u180E-\u1884\u1887-\u18A8\u18AA-\u191F\u192C-\u192F\u193C-\u1A16\u1A1C-\u1A54\u1A5F\u1A7D\u1A7E\u1A80-\u1AAF\u1ABF-\u1AFF\u1B05-\u1B33\u1B45-\u1B6A\u1B74-\u1B7F\u1B83-\u1BA0\u1BAE-\u1BE5\u1BF4-\u1C23\u1C38-\u1CCF\u1CD3\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1CFA-\u1DBF\u1DFA\u1E00-\u20CF\u20F1-\u2CEE\u2CF2-\u2D7E\u2D80-\u2DDF\u2E00-\u3029\u3030-\u3098\u309B-\uA66E\uA673\uA67E-\uA69D\uA6A0-\uA6EF\uA6F2-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA828-\uA87F\uA882-\uA8B3\uA8C6-\uA8DF\uA8F2-\uA8FE\uA900-\uA925\uA92E-\uA946\uA954-\uA97F\uA984-\uA9B2\uA9C1-\uA9E4\uA9E6-\uAA28\uAA37-\uAA42\uAA44-\uAA4B\uAA4E-\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2-\uAAEA\uAAF0-\uAAF4\uAAF7-\uABE2\uABEB\uABEE-\uD7FF\uE000-\uFB1D\uFB1F-\uFDFF\uFE10-\uFE1F\uFE30-\uFFFF]|\uD800[\uDC00-\uDDFC\uDDFE-\uDEDF\uDEE1-\uDF75\uDF7B-\uDFFF]|[\uD801\uD808-\uD819\uD81C-\uD82E\uD830-\uD833\uD835\uD837\uD839\uD83B-\uDB3F\uDB41-\uDBFF][\uDC00-\uDFFF]|\uD802[\uDC00-\uDE00\uDE04\uDE07-\uDE0B\uDE10-\uDE37\uDE3B-\uDE3E\uDE40-\uDEE4\uDEE7-\uDFFF]|\uD803[\uDC00-\uDD23\uDD28-\uDF45\uDF51-\uDFFF]|\uD804[\uDC03-\uDC37\uDC47-\uDC7E\uDC83-\uDCAF\uDCBB-\uDCFF\uDD03-\uDD26\uDD35-\uDD44\uDD47-\uDD72\uDD74-\uDD7F\uDD83-\uDDB2\uDDC1-\uDDC8\uDDCD-\uDE2B\uDE38-\uDE3D\uDE3F-\uDEDE\uDEEB-\uDEFF\uDF04-\uDF3A\uDF3D\uDF45\uDF46\uDF49\uDF4A\uDF4E-\uDF56\uDF58-\uDF61\uDF64\uDF65\uDF6D-\uDF6F\uDF75-\uDFFF]|\uD805[\uDC00-\uDC34\uDC47-\uDC5D\uDC5F-\uDCAF\uDCC4-\uDDAE\uDDB6\uDDB7\uDDC1-\uDDDB\uDDDE-\uDE2F\uDE41-\uDEAA\uDEB8-\uDF1C\uDF2C-\uDFFF]|\uD806[\uDC00-\uDC2B\uDC3B-\uDE00\uDE0B-\uDE32\uDE3A\uDE3F-\uDE46\uDE48-\uDE50\uDE5C-\uDE89\uDE9A-\uDFFF]|\uD807[\uDC00-\uDC2E\uDC37\uDC40-\uDC91\uDCA8\uDCB7-\uDD30\uDD37-\uDD39\uDD3B\uDD3E\uDD46\uDD48-\uDD89\uDD8F\uDD92\uDD98-\uDEF2\uDEF7-\uDFFF]|\uD81A[\uDC00-\uDEEF\uDEF5-\uDF2F\uDF37-\uDFFF]|\uD81B[\uDC00-\uDF50\uDF7F-\uDF8E\uDF93-\uDFFF]|\uD82F[\uDC00-\uDC9C\uDC9F-\uDFFF]|\uD834[\uDC00-\uDD64\uDD6A-\uDD6C\uDD73-\uDD7A\uDD83\uDD84\uDD8C-\uDDA9\uDDAE-\uDE41\uDE45-\uDFFF]|\uD836[\uDC00-\uDDFF\uDE37-\uDE3A\uDE6D-\uDE74\uDE76-\uDE83\uDE85-\uDE9A\uDEA0\uDEB0-\uDFFF]|\uD838[\uDC07\uDC19\uDC1A\uDC22\uDC25\uDC2B-\uDFFF]|\uD83A[\uDC00-\uDCCF\uDCD7-\uDD43\uDD4B-\uDFFF]|\uDB40[\uDC00-\uDCFF\uDDF0-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]))((?:[\u0300-\u036F\u0483-\u0489\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u0711\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F3\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u08D3-\u08E1\u08E3-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u09FE\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A70\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0AFA-\u0AFF\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B62\u0B63\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0C00-\u0C04\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0D00-\u0D03\u0D3B\u0D3C\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D82\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0EB1\u0EB4-\u0EB9\u0EBB\u0EBC\u0EC8-\u0ECD\u0F18\u0F19\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F\u109A-\u109D\u135D-\u135F\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u180B-\u180D\u1885\u1886\u18A9\u1920-\u192B\u1930-\u193B\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F\u1AB0-\u1ABE\u1B00-\u1B04\u1B34-\u1B44\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BE6-\u1BF3\u1C24-\u1C37\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF2-\u1CF4\u1CF7-\u1CF9\u1DC0-\u1DF9\u1DFB-\u1DFF\u20D0-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\uA66F-\uA672\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA880\uA881\uA8B4-\uA8C5\uA8E0-\uA8F1\uA8FF\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9E5\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F]|\uD800[\uDDFD\uDEE0\uDF76-\uDF7A]|\uD802[\uDE01-\uDE03\uDE05\uDE06\uDE0C-\uDE0F\uDE38-\uDE3A\uDE3F\uDEE5\uDEE6]|\uD803[\uDD24-\uDD27\uDF46-\uDF50]|\uD804[\uDC00-\uDC02\uDC38-\uDC46\uDC7F-\uDC82\uDCB0-\uDCBA\uDD00-\uDD02\uDD27-\uDD34\uDD45\uDD46\uDD73\uDD80-\uDD82\uDDB3-\uDDC0\uDDC9-\uDDCC\uDE2C-\uDE37\uDE3E\uDEDF-\uDEEA\uDF00-\uDF03\uDF3B\uDF3C\uDF3E-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF57\uDF62\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC35-\uDC46\uDC5E\uDCB0-\uDCC3\uDDAF-\uDDB5\uDDB8-\uDDC0\uDDDC\uDDDD\uDE30-\uDE40\uDEAB-\uDEB7\uDF1D-\uDF2B]|\uD806[\uDC2C-\uDC3A\uDE01-\uDE0A\uDE33-\uDE39\uDE3B-\uDE3E\uDE47\uDE51-\uDE5B\uDE8A-\uDE99]|\uD807[\uDC2F-\uDC36\uDC38-\uDC3F\uDC92-\uDCA7\uDCA9-\uDCB6\uDD31-\uDD36\uDD3A\uDD3C\uDD3D\uDD3F-\uDD45\uDD47\uDD8A-\uDD8E\uDD90\uDD91\uDD93-\uDD97\uDEF3-\uDEF6]|\uD81A[\uDEF0-\uDEF4\uDF30-\uDF36]|\uD81B[\uDF51-\uDF7E\uDF8F-\uDF92]|\uD82F[\uDC9D\uDC9E]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD838[\uDC00-\uDC06\uDC08-\uDC18\uDC1B-\uDC21\uDC23\uDC24\uDC26-\uDC2A]|\uD83A[\uDCD0-\uDCD6\uDD44-\uDD4A]|\uDB40[\uDD00-\uDDEF])+)/g,c=a.replace(b,function(a,b,c){return b});return punycode.ucs2.decode(c).length},_submit:function(){var a=this.getLength(this.state.text);if(!(0===a||a>this.props.maxLength)){var b={parent_id:this.props.parentId,parent_author:this.props.parentAuthorId,caption:this.state.text,sid:this.context.msid,gallery:Imgur.Gallery.getInstance().getGalleryMetadata(),has_admin_badge:this.state.hasAdminBadge};Imgur.Environment.signed||(Imgur.getInstance().signin("Action - Comment"),b.redirect=!0),this.setState({showingLoader:!0});var c=$.ajax({url:"/gallery/action/caption/"+this.props.image.hash,type:"POST",data:b});c.always(_.bind(function(){this.setState({showingLoader:!1})},this)),Imgur.Util.jafoLogEvent(Imgur.AnalyticCategories.POST,Imgur.AnalyticEventNames.commentEntered,{"Was Reply":!!b.parent_id,"Has React":new Imgur.Linkify.ImgurGrabber(Imgur.Environment.host,Imgur.Environment.cdnUrl).scan(b.caption).length>0,Length:a}),Imgur.Environment.signed&&(c.done(_.bind(function(a){if(a.success){var b=_.map(document.querySelectorAll(".post-tag-link"),function(a){return a.innerText}),c=Imgur.UserStatistics.getInstance();c.emitActionUserAddedComment(a.data.caption.hash,b),a.data.caption.just_inserted=!0,this.props.onSuccess(),Imgur.Caption.getInstance().mergeCaptions(a.data.caption.hash,[a.data.caption]);var d={caption_id:a.data.caption.id,vote:"up"};Imgur.Caption.getInstance().mergeVotes(a.data.caption.hash,[d]),this.context.onSubmit(a.data.caption)}else this.handleError(a)},this)),c.fail(_.bind(this.handleError,this)))}},handleTextChanged:function(a){var b={text:a.target.value};this.props.imagePreviewEnabled&&(b.imageLinks=this.handleImagePreviewUpdate(a.target.value)),this.setState(b)},handleImagePreviewUpdate:function(a){const b=new Imgur.Linkify.CommentImageGrabber(Imgur.Environment.host,Imgur.Environment.cdnUrl);var c=b.scan(a);return 0===c.length?[]:c.map(function(b){return a.slice(b.begin,b.end+1)})},handleClick:function(a){a.stopPropagation(),this.refs.textarea.focus()},handleKeyDown:function(a){13===a.keyCode?(a.preventDefault(),this._submit()):27===a.keyCode&&this.refs.textarea.blur()},handleReactionGifSelection:function(a){var b=this.refs.textarea.value,c="";b.length&&" "!==b[b.length]&&(c=" ");var d={target:{value:b+c+a}};this.handleTextChanged(d),this.toggleShowReactionGifPicker()},handleAdminBadgeChange:function(a){this.setState({hasAdminBadge:a})},getImagePreview:function(){if(0===this.state.imageLinks.length)return"";var a,b=this.state.imageLinks[0],c=b.match(/\.(gifv|mp4|webm)$/);return c?(".gifv"===c[0]&&(b=b.replace(".gifv",".mp4")),a=React.DOM.video({src:b,autoPlay:!0,muted:!0,loop:!0,className:"commentImagePreview-image"})):a=React.DOM.img({src:b,className:"commentImagePreview-image"}),React.DOM.div({className:"commentImagePreview relative display-inline-block"},a,React.DOM.div({className:"commentImagePreview-close",onClick:this.removePreview},React.DOM.img({src:Imgur.Environment.staticUrl+"/images/icons/close-outline.svg",className:"left"})))},removePreview:function(){var a=this.state.imageLinks[0];this.setState({text:this.state.text.replace(a,"").replace("  "," "),imageLinks:this.state.imageLinks.slice(1)})},toggleShowReactionGifPicker:function(){this.setState({showReactionGifPicker:!this.state.showReactionGifPicker},_.bind(function(){this.state.showReactionGifPicker?$("body").on("click",this.handleBodyClick):$("body").off("click",this.handleBodyClick)},this))},handleReactionGifButtonClick:function(a){a.stopPropagation(),Imgur.Util.jafoLog({event:"commentReactInitiate",meta:{hash:this.props.image.hash}}),this.toggleShowReactionGifPicker()},handleBodyClick:function(a){$.contains($(".gifpicker").get(0),a.target)||(a.stopPropagation(),this.setState({showReactionGifPicker:!1},_.bind(function(){$("body").off("click",this.handleBodyClick)},this)))},handleReactionGifClick:function(a){a.stopPropagation()},componentWillUnmount:function(){$(this.refs.gifButton).unbind("mouseenter mouseleave")},render:function(){var a=this.props.maxLength-this.getLength(this.state.text),b=classNames,c=b({"caption-create":!0,loading:this.state.showingLoader,"counter-exceeded":a<0});return React.DOM.form({className:c,onClick:this.handleClick,onSubmit:this.handleSubmit},React.DOM.span({className:"icon-x right pointer",onClick:this.props.onClose}),React.DOM.textarea({ref:"textarea",className:"commentForm",onKeyDown:this.handleKeyDown,onKeyUp:this.handleKeyUp,onChange:this.handleTextChanged,onFocus:this.handleFocus,placeholder:"Write a comment",value:this.state.text}),this.getImagePreview(),this.state.error.length>0?React.DOM.div({className:"error"},this.state.error):"",React.DOM.div({className:"summary"},React.DOM.input({ref:"submitCommentBtn",value:"Post",type:"submit",id:"submit-comment",className:"right btn btn-main",disabled:a==this.props.maxLength||a<0?"disabled":""}),React.DOM.div({className:"right comment-gif-container",onClick:this.handleReactionGifClick},React.DOM.button({type:"button",id:"comment-gif",ref:"gifButton",className:"title btn btn-main right",onClick:this.handleReactionGifButtonClick,title:"Add reaction GIF"},"GIF"),this.state.showReactionGifPicker&&React.createElement(Imgur.ReactionGifPickerContainer,{handleImageSelection:this.handleReactionGifSelection,postHash:this.props.image.hash,sponsoredReactionGifs:Imgur.Environment.sponsoredReactionGifs},null)),React.DOM.a({className:"rules left",href:"/rules",target:"_blank"},"remember the community rules"),Imgur.Environment.isCommunityTeam?React.createElement(Imgur.Elements.CheckBox,{label:"Admin",type:"checkbox",id:"has-admin-badge:"+(this.props.parentId?this.props.parentId:"top-level"),className:"show-admin-badge right",onChange:this.handleAdminBadgeChange.bind(this)}):"",React.DOM.div({className:"counter right"},a)))}}),Namespace("Imgur.Gallery"),Imgur.Gallery=Imgur.extend({init:function(a,b,c){return $.extend(this.settings,b),this._=_.merge({sid:b.sid,auth:b.auth||{},signed:!1,cdnURL:b.cdnUrl,baseURL:b.baseURL,sort:"hot",section:null,window:"day",page:0,maxPage:0,jafoPage:0,hash:null,nextHash:null,prevHash:null,showPast:!0,commentName:"comment",comment_sort:"best",indexName:"gallery",searchQuery:null,account_url:null,emitter:a,mobile:!1,isRandom:!1,gallery_type:null,tagsCookie:"tags",isIPad:navigator.userAgent.match(/iPad/i),history:c,el:{arrows:$(".arrow-up, .arrow-down"),randomButton:$(".random-button"),outside:{pageDivider:"#imagelist .page-divider",noMorePagesID:"#nomore",tagLoaderClass:".outside-loader",loaderID:".imagelist-loader",extendedImagelist:"#extended-imagelist",loadMoreID:"#load-more",$sortOptions:$(".sentence-sorting .options a"),content:$("#imagelist"),messagebox:$("#messagebox"),comboboxes:$(".combobox"),$toggleViral:$("#showviral"),$toggleUserSub:$("#showusersub"),galleryNewInfo:{id:"#gallery-new-info",$okay:$("#gallery-new-info-okay"),$no:$("#gallery-new-info-decline")}},inside:{reportImageLink:$("#report-image"),$shareTabButton:$(".button-container .share"),$optionsButton:$(".button-container .options-btn"),$shareLink:$(".button-container .share-link"),counter:null,image:$(".image"),zoom:$(".zoom"),submitCaptionButton:$(".submit-caption-button"),commentExpand:$("#expand-comments"),comboboxes:$(".combobox"),commentSort:$("#comment-sort"),$comments:$("#captions"),reCaptionLink:$("#meme-image"),downloadAlbumForm:{id:"#download-album-form",emailInput:$("#download-album-form #email"),form:$("#download-album-form #download-form"),message:$("#message"),save:$("#download-album-form #save"),loader:$("#download-loader")}},user:{notorietyLink:$("#notoriety-link"),notorietyList:$("#notoriety-list"),buttonComments:$(".button.comments"),buttonFavorites:$(".button.likes"),buttonSubmitted:$(".button.submitted"),buttonReplies:$(".button.replies"),captions:$("#captions"),favorites:$("#likes"),loader:$("#loader"),pmButton:$("#pm-button"),pmWrapper:$("#pm-wrapper"),pmBody:$("#pm-wrapper textarea"),pmSendButton:$("#pm-send-button"),pmForm:$("#pm-wrapper form"),pmSent:$("#pm-sent"),updateLevelTable:$("#update-level-table"),$carousel:$("#thumbs-top")},past:{wrapper:$("#past-wrapper"),previewContent:$("#past-preview"),loader:$("#past-loader"),link:$("#past-link"),slider:$("#slider"),days:$("#days"),ticker:$("#slider-wrapper .ticker"),positiveTickClass:"positive",negativeTickClass:"negative",submitButton:$("#past-submit"),calendar:$("#past-calendar")},colorboxConfirmForm:{id:"#colorbox-confirm",title:$("#colorbox-confirm h3"),message:$("#colorbox-confirm-message"),yes:$("#colorbox-confirm-yes"),no:$("#colorbox-confirm-no"),loader:$("#colorbox-confirm .small-loader")},embedAlbumForm:Imgur.Utilities.Embed.elEmbedAlbumForm(),colorboxEmbed:Imgur.Utilities.Embed.elColorboxEmbed(),search:{$headerSearch:$(".search-container"),$headerSearchInput:$('.search-container input[name="q"]'),$advanced:$("#search_advanced"),$advancedForm:$("#search_advanced form"),$advancedAllInput:$('#search_advanced form input[name="q_all"]'),imageCard:".posts-search .post-list, .posts-search .post",$container:$("#imagelist"),size:"#q_size",$sizePx:$('input[name="q_size_px"]'),$sizeMpx:$('input[name="q_size_mpx"]'),
$sizeFmt:$('input[name="q_size_fmt"]'),$sizeToggle:$("#q_size_is_mpx"),$pxCombo:$("#size_in_px"),$mpxCombo:$("#size_in_mpx")},side:{links:$("#fixed-side-footer-links"),imagePanels:$(".imagelist-panels")},adm:{$addTag:$("#adm-add-gallery-tag")}},vars:{pastPage:0,scrolledPage:0,scrolledImageSet:0,pastTickerTimer:null,currentTheme:"dark"},messages:null,undoDelay:4e3},b),this._super(this._),this._},getEmitter:function(){return this._.emitter},getCacheValue:function(){var a="";return $("script[type*=javascript]").each(function(){if(this.src){var b=this.src.split("?"),c=$.trim(b[0].split("/").pop());if("gallery.js"==c)return void(a=b[1])}}),a},isNumberKey:function(a){var b=a.which?a.which:a.keyCode;return!(b>31&&(b<48||b>57))},ignorePost:function(a){humanMsg.displayMsg("Working...");var b={hash:a,type:"gallery"};$.post("/adm/removals/ignore",b,function(){humanMsg.displayMsg("Post was ignored")})},dboi:function(a,b){humanMsg.displayMsg("Working...");var c={hash:b,reason:1};$.post("/adm/removals/warnimage",c,function(){humanMsg.displayMsg("Image was removed from the gallery and "+a+" was warned")})},ungallery:function(a){humanMsg.displayMsg("Working...");var b={hash:a,type:"gallery",kill:"true",sid:this._.sid};$.post("/adm/removals/delete",b,function(){humanMsg.displayMsg("Image was removed from the gallery")})},"delete":function(a){humanMsg.displayMsg("Working...");var b={hash:a,type:"gallery",kill:"true","delete":"true",sid:this._.sid};$.post("/adm/removals/delete",b,function(){humanMsg.displayMsg("Post was deleted")})},spamPost:function(a){humanMsg.displayMsg("Working...");var b=this._.baseURL+"/action/remove_image/"+a,c={remove:!0,sid:this._.sid};$.post(b,c,function(){humanMsg.displayMsg("Image was marked as spam")})},mature:function(a){humanMsg.displayMsg("Working...");var b=this._.baseURL+"/action/mature_image/"+a,c={sid:this._.sid};$.post(b,c,_.bind(function(){humanMsg.displayMsg("Image was marked mature")},this))},unmature:function(a){humanMsg.displayMsg("Working...");var b=this._.baseURL+"/action/unmature_image/"+a,c={sid:this._.sid};$.post(b,c,_.bind(function(){humanMsg.displayMsg("Image was marked not mature")},this))},highRisk:function(a,b){humanMsg.displayMsg("Working...");var c={sid:this._.sid,links:a,status:b};$.post("/adm/adops/highrisk",c,_.bind(function(){humanMsg.displayMsg("Image was marked as not safe for ads")},this))},safePost:function(a){humanMsg.displayMsg("Working...");var b={sid:this._.sid,links:a};$.post("/adm/adops/safe",b,_.bind(function(){humanMsg.displayMsg("Image was marked as safe for ads")},this))},ban:function(a,b){var c;""!=this._.account_url&&(c={account_url:a,type:"main",sid:this._.sid,offending_url:b},$.post("/adm/removals/ban",c,_.bind(function(b){var d="The ban hammer hit "+a+" successfully for "+c.offending_url;humanMsg.displayMsg(d)},this)))},obfuscate:function(a){$.post("/adm/obfuscate",{hash:a,sid:this._.sid},_.bind(function(a){humanMsg.displayMsg("Post has been obfuscated")},this))},spam:function(a,b){""!=a&&(postParams={account_url:a,type:"gallery",hash:b,sid:this._.sid},$.post("/adm/removals/markspammer",postParams,_.bind(function(){humanMsg.displayMsg(this._.account_url+" has been spammed")},this)).fail(function(a){const b=a.responseJSON.data.error;humanMsg.displayMsg(b?b:"Unable to spam user")}))},warn:function(a,b){""!=this._.account_url&&$.post("/adm/removals/warn",{account_url:a,data:b,sid:this._.sid},_.bind(function(){humanMsg.displayMsg(a+" has been warned")},this))},ncmec:function(a){""!=this._.account_url&&(postParms={hash:a,is_album:this._.image.is_album?1:0,sid:this._.sid},$.post("/adm/ncmec/report",postParms,_.bind(function(a){humanMsg.displayMsg("Post has been queued for NCMEC reporting and removal")},this)))},trophy:function(a){var b,c,d=$(a.target),e=d.attr("data-type"),f=d.text(),g=d.val(),h=this.imgurInsideNav.getCurrentImage();if("comment"===e){if(b=document.location.pathname.match(/^\/gallery\/[^\/]+\/comment\/([0-9]+)\/?/),!b)return void humanMsg.displayMsg("Please visit a comment permalink to award that.","error-msg");c={comment_id:b[1]}}if("image"===e&&h.account_url){if(!/^\/(gallery\/[^\/]+|topic\/[a-zA-Z0-9_-]+\/[^\/]+)\/?/.test(document.location.pathname))return void humanMsg.displayMsg("Please visit the gallery or topic page for this post to award that.","error-msg");c={hash:h.hash}}"object"==typeof c&&$.post("/adm/trophies/"+g,c,_.bind(function(a){humanMsg.displayMsg("Awarded "+f+" trophy!")},this)),a.preventDefault()},reportImage:function(){var a=this,b=a.imgurInsideNav.getHash(),c={type:"galleryPost",hash:b,isAlbum:a.imgurInsideNav._.image.is_album,nsfw:a.imgurInsideNav._.image.nsfw};Imgur.Util.jafoLog({event:"reportInvoked",meta:c})},bindDeleteImage:function(){var a=this;this._.el.colorboxConfirmForm.no.unbind("click"),this._.el.colorboxConfirmForm.yes.unbind("click"),this._.el.colorboxConfirmForm.title.html("Remove Submission from Gallery"),this._.el.colorboxConfirmForm.message.html(this._.messages.deleteImage),$.colorbox.resize(),this._.el.colorboxConfirmForm.no.click(function(){$.colorbox.close()}),this._.el.colorboxConfirmForm.yes.click(function(){a._.el.colorboxConfirmForm.yes.disable(),a._.el.colorboxConfirmForm.loader.show(),$.post(a._.baseURL+"/action/delete_image/"+a._.hash,{sid:a._.sid},function(b){a._.el.colorboxConfirmForm.loader.hide(),a._.el.colorboxConfirmForm.yes.enable(),Imgur.Util.jafoLog({event:"removeFromGallery",meta:{hash:a._.hash,isAlbum:a._.image.is_album}}),a._.signed&&($.colorbox.close(),humanMsg.displayMsg("Submission has been removed"),setTimeout(function(){window.location="//"+a._.host},500))}).error(function(){a._.el.colorboxConfirmForm.yes.enable(),a._.el.colorboxConfirmForm.loader.hide()})})},deleteImage:function(){var a=this;$.colorbox({href:a._.el.colorboxConfirmForm.id,open:!0,inline:!0,top:"15%",transition:"none",scrolling:!1,onComplete:function(){a.bindDeleteImage()}})},reCaption:function(){var a=Imgur.InsideNav.getInstance().getHash();window.location="/memegen/create/"+a},insertAd:function(a){var b=Math.floor(1e3*Math.random()),c=$('<div id="bottom-ad" class="advertisement"></div>'),d=$('<div class="panel-ad advertisement"></div>'),e=$('<iframe src="//imgur.com/include/rc-iframe.html?cb='+b+'" framespacing="0" frameborder="no" scrolling="no" width="300" height="250" allowtransparency="true"></iframe>');$(d).append(e),$(c).append(d),$(c).css("top",a+"px"),$("#content").append(c)},fadeInLoader:function(a){var b=this._.el.outside.content.find(this._.el.outside.tagLoaderClass);b.length&&b.eq(b.length-1).fadeIn(75,a)},fadeOutLoader:function(a){var b=this._.el.outside.content.find(this._.el.outside.tagLoaderClass);b.length&&b.eq(b.length-1).fadeOut(75,a)},initialPopState:function(a){window.location=window.location},initTipsy:function(){if(!this._.isIPad){var a=$("#imagelist img, .thumbnails img, .thumbs img, .image img, .thumb-title");a.each(function(){$(this).attr("title",$(this).attr("data-title"))}),a.tipsy({gravity:"n",opacity:.95,offset:-15,html:!0,live:!0})}},initAdmAddGalleryTag:function(){var a=new Imgur.Tag.TagValidator(Imgur.Constants.MIN_TAG_LENGTH,Imgur.Constants.MAX_TAG_LENGTH),b=this.getEmitter(),c=new Imgur.Gallery.Store.Tag(null,a,b);ReactDOM.render(React.createElement(Imgur.Adm.GalleryAddTag,{baseUrl:this._.baseURL,insideNav:this.imgurInsideNav,tagStore:c,emitter:b}),this._.el.adm.$addTag.get(0))},initZoom:function(){this._.el.inside.zoom.imageZoom()},showPastPreview:function(){this._.vars.pastPage>this._.vars.maxDays&&(this._.vars.pastPage=this._.vars.maxDays,this._.el.past.days.val(this._.vars.pastPage)),$(".tipsy").remove(),this._.el.past.previewContent.empty(),this._.el.past.loader.show();var a=this,b=Imgur.getInstance()._.signed?"miss":"hit";$.cookie("gallerypage",this._.vars.pastPage+1,{domain:Imgur.Environment.host,path:"/"});var c=this._.vars.pastPage;Imgur.Util.jafoLog({event:"pastImages",meta:{days:c}}),$.get(this._.baseURL+"/past/page/"+(this._.showPast?this._.vars.pastPage+1:this._.vars.pastPage-1)+"/"+b+"?scrolled",function(b){a._.el.past.loader.hide(),a._.el.past.previewContent.html(b),a._.el.past.previewContent.find("img").tipsy({gravity:"n",opacity:.95,offset:-8,html:!0}).on("click",function(a){Imgur.Util.jafoLog({event:"pastImagesClick",meta:{days:c}})})})},pastOnLoad:function(){this.hideAds(),0==this._.el.past.previewContent.find("h3").size()&&this.showPastPreview(),this._.el.past.days.val(this._.vars.pastPage);var a=this;this._.el.past.calendar.DatePicker({format:"m/d/Y",date:"",current:"",starts:1,position:"bottom",onBeforeShow:function(){var b=new Date;b.setUTCHours(0),b.setUTCMinutes(0),b.setUTCSeconds(0),b.setUTCMilliseconds(0);var c=864e5*a._.el.past.days.val(),d=new Date(b.getTime()-c),e=d.getUTCMonth()+1+"/"+d.getUTCDate()+"/"+d.getUTCFullYear();$(this).DatePickerSetDate(e,!0),$(".datepicker").css("z-index",1e4),Imgur.Util.jafoLog({event:"pastImagesCalendarOpen"})},onHide:function(){$(".datepicker").css("z-index",""),Imgur.Util.jafoLog({event:"pastImagesCalendarClose"})},onChange:function(b,c){var d=new Date,e=new Date(c);d.setUTCHours(0),d.setUTCMinutes(0),d.setUTCSeconds(0),d.setUTCMilliseconds(0),e.setUTCHours(0),e.setUTCMinutes(0),e.setUTCSeconds(0),e.setUTCMilliseconds(0);var f=Math.max(Math.floor((d.getTime()-e.getTime())/864e5),0);f=Math.min(f,a._.maxPage),a._.el.past.days.val(f),a._.vars.pastPage=f,a._.el.past.calendar.DatePickerHide(),a._.el.past.slider.val(a._.vars.pastPage),a.showPastPreview(),Imgur.Util.jafoLog({event:"pastImagesCalendarChange"})}}),this._.el.past.slider.val(this._.vars.pastPage).attr("min",this._.vars.showPast?0:1).attr("max",this._.maxPage).on("input",function(){a._.vars.pastPage=$(this).val(),a._.el.past.days.val(a._.vars.pastPage)}).on("change",function(){a.showPastPreview()})},pastClickHandler:function(){var a=this;Imgur.Util.jafoLog({event:"pastImagesClock"}),$.colorbox({href:"#"+this._.el.past.wrapper.attr("id"),inline:!0,innerWidth:this._.el.past.wrapper.width()+20,innerHeight:this._.el.past.wrapper.height()+20,className:"blurbox",transition:"none",title:"Show images from the past",open:!0,onLoad:function(){a.pastOnLoad()},onClosed:function(){$.cookie("gallerypage",null,{expires:-1,domain:Imgur.Environment.host,path:"/"}),a.showAds()}})},pastDaysChangeHandler:function(a){isFinite(a.currentTarget.value)?(this._.vars.pastPage=parseInt(a.currentTarget.value,10),this._.el.past.slider.val(this._.vars.pastPage)):humanMsg.displayMsg("Please enter a number","error-msg")},pastDaysKeypressHandler:function(a){return this.isNumberKey(a)},pastTickerClickHandler:function(a){clearTimeout(this._.vars.pastTickerTimer),$(a.target).hasClass(this._.el.past.positiveTickClass)?this._.vars.pastPage=this._.vars.pastPage+1<this._.maxPage?this._.vars.pastPage+1:this._.maxPage:this._.vars.pastPage=this._.vars.pastPage-1>0?this._.vars.pastPage-1:0,this._.el.past.days.val(this._.vars.pastPage),this._.el.past.slider.val(this._.vars.pastPage);var b=this,c=function(){b.showPastPreview()};this._.vars.pastTickerTimer=setTimeout(c,400)},pastSubmitClickHandler:function(){var a=this._.showPast?this._.vars.pastPage:this._.vars.pastPage-1;Imgur.Util.jafoLog({event:"pastImagesGo",meta:{page:a}}),$.colorbox.close(),window.location=this._.baseURL+"/hot/viral/page/"+a},galleryTagObject:function(a,b){return a&&Array.isArray(b)?b.find(function(b){return b.tag===a}):null},isPromotedTagGallery:function(a,b){var c=this.galleryTagObject(a,b);return!(!c||!parseInt(c.is_promoted))},getGalleryMetadata:function(a){var b={};switch(b.gallerySort=this._.sort,b.galleryWindow=this._.window,b.galleryType=this._.section,this._.subreddit&&(b.galleryType="subreddit"),b.galleryType){case"subreddit":b.subreddit=this._.subreddit;break;case"topic":b.topic=this._.topic;break;case"tag":b.tagName=this._.tag}return b.topicTag=b.tag||b.topic,a&&"item"===a&&(b.promoted=!!this._.image.is_ad,b.promotedTagGallery=this.isPromotedTagGallery(b.tagName,Imgur.Environment.image.galleryTags),b.tags=[],Array.isArray(this._.image.galleryTags)&&(b.tags=this._.image.galleryTags.map(function(a){return a.tag}))),b},getVoteSourceFromEnvironment:function(){return"undefined"!=typeof Imgur.Environment.searchQuery&&null!==Imgur.Environment.searchQuery&&""!==Imgur.Environment.searchQuery?"search:"+Imgur.Environment.sort:"tag"===Imgur.Environment.section?"tag:"+Imgur.Environment.tag+":"+Imgur.Environment.sort:"favorites"===Imgur.Environment.section?"favorites:"+Imgur.Environment.sort:"hot"===Imgur.Environment.section?"mostviral:"+Imgur.Environment.sort:"new"===Imgur.Environment.section?"usersub:"+Imgur.Environment.sort:"feed"===Imgur.Environment.section?"feed":null},getBaseUrl:function(){return this._.overRideUrl?this._.overRideUrl:this._.baseURL},getSectionUrl:function(){var a=this._.section&&!this._.subreddit&&"tag"!=this._.section&&"group"!=this._.section&&"topic"!=this._.section&&"favorites"!=this._.section?"/"+this._.section:"",b=this._.baseURL+a+"/";return b},getUrl:function(a,b){var c="top"==this._.section?"":this._.sort+"/",d="top"==this._.sort||"top"==this._.section?this._.window+"/":"",e=this.getSectionUrl()+c+d+"page/"+a+"/"+(Imgur.Environment.signed?"miss":"hit")+"?scrolled";if(this._.overRideUrl)return this._.overRideUrl+"/"+c+"/page/"+a+"/"+(Imgur.Environment.signed?"miss":"hit")+"?scrolled";if(this._.inSearch){var f=Imgur.getInstance().getSearchUrl(this._,a);e=f.url+"?scrolled&"+f.query}else"hot"==this._.section&&(e+="&set="+b);return e},handleResponse:function(a,b,c){var d=$(a).find("img").length;if(d>0&&(this._.vars.scrolledImageSet>=1||"new"==this._.section)&&!$(this._.el.outside.extendedImagelist).length&&$.cookie("showComments")){var e;e=0==this._.vars.scrolledImageSet?$('<div id="extended-imagelist"></div>'):$('<div id="extended-imagelist"><div class="posts br5"></div><div class="page-divider"><a href="javascript:;" class="scroll-top-text">back to top</a></div></div>'),$(this._.el.outside.pageDivider).remove(),this._.el.outside.content.after(e),this._.el.outside.content=e}if(d>0&&c&&(window.dataLayer=window.dataLayer||[],window.dataLayer.push({event:"load-more"})),0==this._.vars.scrolledPage&&this._.vars.scrolledImageSet<=0){var f=this._.el.outside.content.find(this._.el.outside.tagLoaderClass);if(f.length&&f.eq(f.length-1).is(":visible"))return void this.fadeOutLoader(_.bind(this.handleResponse,this,a,b));$(this._.el.outside.extendedImagelist).length&&(this._.el.outside.content=this._.el.outside.content.prev(),$(this._.el.outside.extendedImagelist).remove()),this._.el.outside.content.find(".posts").remove(),this._.el.outside.content.find(".imagelist-header:gt(0)").remove(),this._.el.outside.content.append(a)}else this._.vars.scrolledImageSet>=1?(this._.el.outside.content.find(".posts:last .clear").remove(),this._.el.outside.content.find(".posts:last").append(a),this._.el.outside.content.find(".posts:last").append('<div class="clear"></div>')):this._.el.outside.content.append(a);this._.el.outside.content.find(".posts:last").find("img").each(function(){$(this).attr("title",$(this).attr("data-title")),$(this).tipsy({gravity:"n",opacity:.95,offset:-15,html:!0})});var g=$(".arrow-up, .arrow-down");g.unbind("click"),g.click(_.bind(function(a){this.vote(a)},this)),this.initOutsideComboboxes(),this.searchHighlight(),0==$(this._.el.outside.noMorePagesID).length?(d<60&&(this._.vars.scrolledPage++,this._.vars.scrolledImageSet=-1),$(this._.el.outside.loaderID+":lt(-1)").remove(),Imgur.InfiniteScroll.getInstance().infiniteScroll(_.bind(function(){this.loadMore()},this))):this._.vars.scrolledImageSet>0?($(this._.el.outside.noMorePagesID).remove(),this._.vars.scrolledPage++,this._.vars.scrolledImageSet=-1,this.loadMore()):$(this._.el.outside.loaderID).eq(0).remove(),this._.emitter.trigger("new gallery page"),"function"==typeof b&&b(),this._.emitter.trigger("gallery page refetched"),this._.jafoPage++,Imgur.Util.jafoLog({event:"galleryPageShown",meta:_.merge(Imgur.Gallery.getInstance().getGalleryMetadata(),{pageNum:this._.jafoPage,itemCount:d})})},fetchImages:function(a,b,c){var d=this.getUrl(a,b);this._.vars.loading=!0,$.ajax({url:d,success:_.bind(function(a){this._.vars.loading=!1,this.handleResponse(a,c,d)},this)}),$(_.bind(function(){Imgur.Util.jafoLog({event:"galleryPageRequest",meta:_.merge(Imgur.Gallery.getInstance().getGalleryMetadata(),{pageNum:a})})},this))},showLoadMore:function(a){$(this._.el.outside.loaderID).eq(0).html(this._.messages.loadMore),$(this._.el.outside.loadMoreID).click(_.bind(function(a){$(a.target).unbind("click"),$(a.target).parent().html('<img src="//s.imgur.com/images/loaders/ddddd1_181817/48.gif" />'),this.loadMore(!0)},this))},loadMore:function(a){if(!this._.vars.loading)return!a&&this._.vars.scrolledPage>0&&this._.vars.scrolledPage%5==0&&this._.vars.scrolledImageSet==-1?void this.showLoadMore():void($(this._.el.outside.loaderID).length>0&&("hot"!=this._.section||this._.inSearch||this._.overRideUrl?this._.vars.scrolledPage++:this._.vars.scrolledImageSet++,this.fetchImages(this._.vars.scrolledPage,this._.vars.scrolledImageSet)))},notorietyLinkClickHandler:function(){this._.el.user.notorietyList.is(":hidden")?(this._.el.user.notorietyList.slideDown(),this._.el.user.notorietyLink.find("a").html("hide list")):(this._.el.user.notorietyList.slideUp(),this._.el.user.notorietyLink.find("a").html("show list"))},userButtonCommentsClickHandler:function(){window.location="/user/"+this._.account_url},userButtonFavoritesClickHandler:function(){window.location="/user/"+this._.account_url+"/favorites"},userButtonSubmittedClickHandler:function(){window.location="/user/"+this._.account_url+"/submitted"},userButtonRepliesClickHandler:function(){window.location="/user/"+this._.account_url+"/replies"},setupUserCaptions:function(){var a=new Imgur.Linkifier;a.addGrabber(new Imgur.Linkify.ImgurGrabber(Imgur.Environment.host,Imgur.Environment.cdnUrl)),a.addGrabber(new Imgur.Linkify.PlainGrabber),a.addGrabber(new Imgur.Linkify.UsernameGrabber),a.addGrabber(new Imgur.Linkify.HashtagGrabber),a.addViewer("youtube",new Imgur.Linkify.YoutubeViewer),a.addViewer("html5video",new Imgur.Linkify.Html5VideoViewer),a.addViewer("gifv",new Imgur.Linkify.ImgurGifvViewer(new Imgur.Linkify.Html5VideoViewer)),a.addViewer("imgur",new Imgur.Linkify.ImgurViewer),a.addViewer("image",new Imgur.Linkify.ImageViewer);var b=React.createClass({childContextTypes:{linkifier:React.PropTypes.object},getChildContext:function(){return{linkifier:a}},render:function(){return React.createElement(Imgur.UserCommentsArea,this.props)}});ReactDOM.render(React.createElement(b,{user:this._.account_url,sort:this._.sort}),$(".left .panel .captions-container").get(0))},setupUserFavorites:function(){var a=this,b=function(){a._.el.user.loader.show(),$.get("/user/"+a._.account_url+"/favorites/page/"+ ++a._.page+"?scrolling",function(c){c?(a._.el.user.loader.hide(),a._.el.user.favorites.append(c),Imgur.InfiniteScroll.getInstance().infiniteScroll(b)):a._.el.user.loader.remove()})};this._.el.user.loader.length>0&&Imgur.InfiniteScroll.getInstance().infiniteScroll(b)},setupUserReplies:function(){var a=new Imgur.Linkifier;a.addGrabber(new Imgur.Linkify.ImgurGrabber(Imgur.Environment.host,Imgur.Environment.cdnUrl)),a.addGrabber(new Imgur.Linkify.PlainGrabber),a.addGrabber(new Imgur.Linkify.UsernameGrabber),a.addGrabber(new Imgur.Linkify.HashtagGrabber),a.addViewer("youtube",new Imgur.Linkify.YoutubeViewer),a.addViewer("html5video",new Imgur.Linkify.Html5VideoViewer),a.addViewer("gifv",new Imgur.Linkify.ImgurGifvViewer(new Imgur.Linkify.Html5VideoViewer)),a.addViewer("imgur",new Imgur.Linkify.ImgurViewer),a.addViewer("image",new Imgur.Linkify.ImageViewer);var b=React.createClass({childContextTypes:{linkifier:React.PropTypes.object},getChildContext:function(){return{linkifier:a}},render:function(){return React.createElement(Imgur.UserRepliesArea,this.props)}});ReactDOM.render(React.createElement(b,{auth:this._.auth}),$(".left .panel .replies-div .captions-container").get(0))},setupUserSubmitted:function(){var a=this,b=function(){a._.el.user.loader.show(),$.get("/user/"+a._.account_url+"/submitted/page/"+ ++a._.page+"?scrolling",function(c){c?(a._.el.user.loader.hide(),a._.el.user.favorites.append(c),Imgur.InfiniteScroll.getInstance().infiniteScroll(b)):a._.el.user.loader.remove()})};this._.el.user.loader.length>0&&Imgur.InfiniteScroll.getInstance().infiniteScroll(b)},userPmButtonClickHandler:function(){return this._.signed?void(window.location="/account/messages#"+this._.account_url):Imgur.getInstance().signin("Action - Chat")},userPmSendButton:function(){var a=this;if(""!=a._.el.user.pmBody.val()&&a._.el.user.pmBody.val()!=a._.el.user.pmBody.attr("title")){for(var b=a._.el.user.pmForm.find("input, textarea"),c=0;c<b.length;++c){var d=$(b[c]);d.val()==d.attr("title")&&d.val("")}$.post("/account/messages/create",a._.el.user.pmForm.serialize(),function(b){a._.el.user.pmSent.fadeIn(250),setTimeout(function(){$.colorbox.close(),a._.el.user.pmSent.hide(),a._.el.user.pmBody.val(""),a._.el.user.pmBody.showPlaceholder()},600)})}},carouselItemFirstIn:function(a,b,c){0==a.index()?c.addClass("disabled"):c.removeClass("disabled")},carouselItemLastIn:function(a,b,c){var d=b.jcarousel("items").length;a.index()==d-1?c.addClass("disabled"):c.removeClass("disabled")},userInit:function(){var a=this;this.generalInit(),this.fireProfileAnalytic(),this._.el.user.notorietyLink.click(function(){a.notorietyLinkClickHandler()}),this._.el.user.buttonComments.click(function(){a.userButtonCommentsClickHandler()}),this._.el.user.buttonFavorites.click(function(){a.userButtonFavoritesClickHandler()}),this._.el.user.buttonSubmitted.click(function(){a.userButtonSubmittedClickHandler()}),this._.el.user.buttonReplies.click(function(){a.userButtonRepliesClickHandler()}),this._.el.user.pmButton.click(function(){a.userPmButtonClickHandler()}),this._.el.user.pmSendButton.click(function(){a.userPmSendButton()}),"index"===this._.window?this.setupUserCaptions():"submitted"===this._.window?this.setupUserSubmitted():"replies"===this._.window?this.setupUserReplies():this.setupUserFavorites(),this._.el.user.$carousel.jcarousel({animation:300}),$(".next").click(function(){a._.el.user.$carousel.jcarousel("scroll","+=3",!0)}),$(".prev").click(function(){a._.el.user.$carousel.jcarousel("scroll","-=3",!0)}),a._.el.user.$carousel.find("li").bind("jcarouselitemfirstin",function(b){a.carouselItemFirstIn($(this),a._.el.user.$carousel,$(".prev"))}).bind("jcarouselitemlastin",function(b){a.carouselItemLastIn($(this),a._.el.user.$carousel,$(".next"))})},fireProfileAnalytic:function(){const a=this._.auth.url&&this._.account_url===this._.auth.url;Imgur.Util.jafoLogEvent(Imgur.AnalyticCategories.PROFILE,Imgur.AnalyticEventNames.viewed,{"Was Current":!!a})},toggleShowViral:function(){$.cookie("hidingviral")?$.removeCookie("hidingviral",{path:"/"}):$.cookie("hidingviral",!0,{expires:30,path:"/"}),window.location=window.location},initOutsideInfScroll:function(){Imgur.InfiniteScroll.getInstance().infiniteScroll(_.bind(function(){this.loadMore()},this))},bindOutsideSortOptions:function(){this._.el.outside.$sortOptions.bind("click",function(a){var b,c=$(this).attr("href").split("?")[0],d=c.split("/");b=d.indexOf("new")!==-1?"User Submitted":d.indexOf("hot")!==-1?"Most Viral":d.pop(),Imgur.Util.jafoLog({event:"galleryDropdownSelection",meta:{galleryName:b,promoted:!1}})})},searchAdvancedHandleSubmit:function(a){a.preventDefault();var b,c,d,e,f=document.location,g=this._.el.search.$advancedForm.find("input"),h=[],i=!0,j=this._.el.search.$advancedAllInput.val(),k=g.length,l=f.protocol+"//"+f.host;if(skip={qs:1,q_all:1},f.port.length&&(l+=":"+f.port),l+="/search/"+this._.sort+"/"+this._.window,k){for(e=0;e<k;e++)if(b=$(g[e]),c=$(g[e]).attr("name"),d=String($(g[e]).val()),!(c in skip))switch(b.attr("type")){case"hidden":d!=$(g[e]).attr("data-default")&&(h.push(c+"="+encodeURIComponent(d)),i=!1);break;case"text":d.length&&(h.push(c+"="+encodeURIComponent(d)),i=!1);break;case"checkbox":b.is(":checked")&&h.push(c+"=on")}i?h=["q="+encodeURIComponent(j)]:h.push("q_all="+encodeURIComponent(j)),h.length&&(l+="?"+h.join("&")),document.location=l}},searchAdvancedToggleHandler:function(a){var b=this,c=$(a.target);this._.el.search.$advanced.is(":visible")?(this._.el.search.$advanced.fadeOut(150,function(){b.syncSearchSimpleAndAdvanced()}),$(a.target).attr("title","show advanced search")):(this._.el.search.$advanced.fadeIn(150,function(){b.syncSearchSimpleAndAdvanced()}),$(a.target).attr("title","hide advanced search")),c.parent().toggleClass("active"),c.tipsy("hide")},searchAdvancedToggleSizeType:function(a){this._.el.search.$sizeToggle.is(":checked")?(this._.el.search.$pxCombo.hide(0),this._.el.search.$mpxCombo.show(0)):(this._.el.search.$mpxCombo.hide(0),this._.el.search.$pxCombo.show(0))},searchHighlight:function(){var a,b,c="",d=!1,e=!1,f={className:"matched-search-term"},g=$(this._.el.search.imageCard);if(this._.inSearch){if("object"!=typeof this._.advSearch||"string"==typeof this._.searchQuery&&""!==this._.searchQuery)this._.searchQuery&&g.strEle(this._.searchQuery,f);else{if("string"==typeof this._.advSearch.q_all&&(c+=" "+this._.advSearch.q_all),"string"==typeof this._.advSearch.q_exactly&&(d=this._.advSearch.q_exactly),"string"==typeof this._.advSearch.q_any&&(c+=" "+this._.advSearch.q_any),c.length&&(e=c.match(/("[^"]+"|[^\s]+)/g),b=e.length,b>0))for(a=0;a<b;a++)g.strEle(e[a],f);d&&g.strEle(d,f)}g.find(".bottom-box span").removeClass(f.className)}},syncSearchSimpleAndAdvanced:function(){this._.el.search.$advanced.length<1||(this._.el.search.$advanced.is(":visible")?(this._syncSearchSimpleAndAdvancedElements(this._.el.search.$headerSearchInput,this._.el.search.$advancedAllInput),this._.el.search.$headerSearch.removeClass("search-focused").addClass("search-forced-closed"),this._.el.search.$advancedAllInput.focus().select()):(this._syncSearchSimpleAndAdvancedElements(this._.el.search.$advancedAllInput,this._.el.search.$headerSearchInput),this._.el.search.$headerSearch.removeClass("search-forced-closed").addClass("search-focused"),this._.el.search.$headerSearchInput.focus().select()))},_syncSearchSimpleAndAdvancedElements:function(a,b){var c=String(b.val()),d=a.val(),e=a.attr("placeholder");c.length<1&&d!=e&&b.val(d).trigger("change"),a.val("")},outsideInit:function(){var a=this;this._.vars.scrolledPage=this._.vars.pastPage=this._.page,this._.showPast||(this._.vars.pastPage+=1),this.generalInit(),this.initOutsideInfScroll(),this.bindOutsideSortOptions(),$(".tooltip").tooltipster({interactive:!0,position:"left",speed:100,offsetX:7}),this._.el.arrows.click(function(b){a.vote(b)}),this._.el.past.link.click(function(){a.pastClickHandler()}),this._.el.past.days.change(function(b){a.pastDaysChangeHandler(b)}),this._.el.past.days.keypress(function(b){a.pastDaysKeypressHandler(b)}),this._.el.past.ticker.click(function(b){a.pastTickerClickHandler(b)}),this._.el.past.submitButton.click(function(){a.pastSubmitClickHandler()}),this._.el.search.$sizeToggle.on("change",function(b){a.searchAdvancedToggleSizeType(b)}),this._.el.search.$advancedForm.on("submit",function(b){a.searchAdvancedHandleSubmit(b)}),"new"==this._.section&&this._.el.outside.$toggleViral.click(function(){a.toggleShowViral()}),this.initOutsideComboboxes(),this.searchHighlight(),this._.el.outside.content.on("mouseenter",".post a",function(a){var b=$(this).data("page");$.cookie("gallerypage",b,{domain:Imgur.Environment.host,path:"/"})}),this._.el.outside.content.on("mouseleave",".post a",function(a){$.cookie("gallerypage",null,{expires:-1,domain:Imgur.Environment.host,path:"/"})}),$(document).ready(function(){a._.showGalleryNewInfo&&$.colorbox({href:a._.el.outside.galleryNewInfo.id,open:!0,inline:!0,top:"15%",transition:"none",scrolling:!1,onComplete:function(){a._.el.outside.galleryNewInfo.$okay.click(function(){$.cookie("IGT",1,{expires:7,path:"/"}),$.colorbox.close()}),a._.el.outside.galleryNewInfo.$no.click(function(){window.location="//"+a._.host+"/hot"})}})})},initOutsideComboboxes:function(){$(".combobox:not(#section):not(#sort)").combobox({onChange:_.bind(function(a,b,c){switch(a){case"q_size_px":$(this._.el.search.size).val(b),this._.el.search.$sizeMpx.val(b);var d=this._.el.search.$mpxCombo.find(".options .item").removeClass("selected").filter('[value="'+b+'"]').addClass("selected").text();this._.el.search.$mpxCombo.find("div.selection").first().text(d);break;case"q_size_mpx":$(this._.el.search.size).val(b),this._.el.search.$sizePx.val(b);var d=this._.el.search.$pxCombo.find(".options .item").removeClass("selected").filter('[value="'+b+'"]').addClass("selected").text();this._.el.search.$pxCombo.find("div.selection").first().text(d)}},this)})},insideInit:function(){var a=_.bind(function(a,b,c){var d=this.imgurInsideNav.getHash(),e=this.imgurInsideNav._.sideGallery.getImage(d);switch(e||(e=this._.image),b){case"download":Imgur.Util.jafoLog({event:"downloadImage",meta:{control:"postOptions",nsfw:e.nsfw,hash:e.hash,isAlbum:e.is_album,isAnimated:e.animated}}),e.is_album?this.imgurInsideNav.startDownload(e.hash):window.location="/download/"+d+"/"+encodeURIComponent(e.title);break;case"meme":Imgur.Util.jafoLog({event:"makeAMeme",meta:{control:"postOptions",nsfw:e.nsfw,hash:e.hash,isAlbum:e.is_album,isAnimated:e.animated}}),window.location="/memegen/create/"+d;break;case"report":1!=$.cookie("r"+d)&&this.reportImage();break;case"delete":this.deleteImage();break;case"embed":Imgur.Utilities.Embed.embedModal.call(this)}return!1},this);if(this.generalInit(),Imgur.getInstance().setHash(this._.hash),this._.el.embedAlbumForm.embedCodeInput.click($(this).selectAll),this._.comment_id||this._.mobile||this._.el.inside.$comments.html('<img class="small-margin-top" src="//s.imgur.com/images/loaders/ddddd1_2b2b2b/24.gif"/>'),Imgur.Util.triggerView(this._.hash,{album:this._.image.is_album,discard:!1}),Imgur.UserStatistics.getInstance().initPageView(),this._.image.is_album)for(var b=0;b<this._.image.album_images.images.length&&b<10;b++){var c=this._.image.album_images.images[b];Imgur.Util.triggerView(c.hash,{image:!0,discard:!1})}this._.el.adm.$addTag.length&&this.initAdmAddGalleryTag(),this.initZoom(),this._.el.colorboxEmbed.embedCodeInput.click($(this).selectAll),this.imgurInsideNav.generalInit(_.bind(function(){this.imgurInsideNav.setCaptionSort(this._.comment_sort),this._.image.comments_disabled||this._.mobile||null===this._.section||!this._.captionsEnabled||this.imgurInsideNav.fetchCaptions(this._.hash,_.bind(function(){Imgur.Caption.getInstance().haveCaptions(this._.hash)&&this.imgurInsideNav.processCaptions(this._.hash)},this)),$(".post-loadall").click(_.bind(function(){return this.imgurInsideNav.insertPost(this._.image,!0),!1},this))},this)),this._.el.inside.reCaptionLink.click(this.reCaption),this._.el.inside.$shareTabButton.click(this.toggleTab),1==$.cookie("r"+this.imgurInsideNav.getHash())?this._.el.inside.reportImageLink.addClass("red").text(" post reported"):this._.el.inside.reportImageLink.removeClass("red").text(" report post"),this.initModerationPanel(),this._.el.inside.$shareLink.focus(this.select),this._.el.inside.$optionsButton.combobox({maybe:a}),$(document).ready(_.bind(function(){this.updateShare()},this))},toggleTab:function(a){if(!a)return void $(".button-container .btn").removeClass("opened");a.stopPropagation();var b=$(a.currentTarget),c=b.hasClass("opened");$(".opened").removeClass("opened"),c||b.addClass("opened")},generalInit:function(){this._.sid=$("#sid").val(),this._.messages={deleteImage:"Are you sure you want to remove this submission from the gallery?",loadMore:'<div id="load-more">load more images</div>',reportImage:"Are you sure you want to report this submission for spam or abuse?"},this.initTipsy()},updateShare:function(){var a=this._.image;if(a){var b=Imgur.ShareButtons.getInstance();b.bindButtons();var c="https://"+this._.host+this._.baseURL+"/"+this._.hash;c=a.is_album?c.replace("/account/favorites/","/a/"):c.replace("/account/favorites/","/"),b.setShareData({title:a.title,jafoMeta:_.merge(this.getGalleryMetadata(),{type:"galleryPost",
hash:this._.hash,isAlbum:a.is_album,inGallery:!0,nsfw:a.nsfw}),url:c},{global:!0})}},getInsideNav:function(){return this.imgurInsideNav},resetReportCloseAnalytics:function(){this._.preventReportCloseAnalytics=!1},preventReportCloseAnalytics:function(){this._.preventReportCloseAnalytics=!0},initModerationPanel:function(){function a(){if(this._.pendingActions.val>0)return"Some moderation actions have not yet saved. Leaving will discard some actions you have taken!"}function b(a){return params={type:"image",hash:a.imgurInsideNav.getImage().album_cover||a.imgurInsideNav.getImage().hash,ext:a.imgurInsideNav.getImage().ext},a.imgurInsideNav.getURL(params)}undoDelay=this._.undoDelay;var c=this;this._.pendingActions={val:0,increment:function(){this.val++},decrement:function(){this.val--}},pendingActions=this._.pendingActions,window.onbeforeunload=a.bind(c),$("#ignore-post").click(function(){var a=(b(this),this.imgurInsideNav.getHash());this.ignorePost(a)}.bind(c)),$("#dboi-post").click(function(){var a=b(this),d=this._.account_url,e=this.imgurInsideNav.getHash();pendingActions=createUndoToast(null,"Warning and removing",function(){this.dboi(d,e)}.bind(c),!0,undoDelay,pendingActions,a)}.bind(c)),$("#ungallery-post").click(function(){var a=b(this),d=this.imgurInsideNav.getHash();pendingActions=createUndoToast(null,"Removing from gallery",function(){this.ungallery(d)}.bind(c),!0,undoDelay,pendingActions,a)}.bind(c)),$("#delete-post").click(function(){var a=b(this),d=this.imgurInsideNav.getHash();pendingActions=createUndoToast(null,"Deleting post",function(){this["delete"](d)}.bind(c),!0,undoDelay,pendingActions,a)}.bind(c)),$("#spam-post").click(function(){var a=b(this),d=this.imgurInsideNav.getHash();pendingActions=createUndoToast(null,"Marking post as spam",function(){this.spamPost(d)}.bind(c),!0,undoDelay,pendingActions,a)}.bind(c)),$("#mature-post").click(function(){var a=b(this),d=this.imgurInsideNav.getHash(),e=this.imgurInsideNav.getImage();pendingActions=createUndoToast(null,"Marking post as mature",function(){this.mature(d),e.nsfw=!0}.bind(c),!0,undoDelay,pendingActions,a)}.bind(c)),$(".high-risk-post").click(function(a){var d=b(this),e=this.imgurInsideNav.getImage();const f=a.target.getAttribute("data-status");pendingActions=createUndoToast(null,"Marking post as not safe for ads",function(){this.highRisk(window.location.href,f),e.nsfw=!0}.bind(c),!0,undoDelay,pendingActions,d)}.bind(c)),$("#safe-post").click(function(){var a=b(this),d=this.imgurInsideNav.getImage();pendingActions=createUndoToast(null,"Marking post as safe for ads",function(){this.safePost(window.location.href),d.nsfw=!1}.bind(c),!0,undoDelay,pendingActions,a)}.bind(c)),$("#unmature-post").click(function(){var a=b(this),d=this.imgurInsideNav.getHash(),e=this.imgurInsideNav.getImage();pendingActions=createUndoToast(null,"Marking post as not mature",function(){this.unmature(d),e.nsfw=!1}.bind(c),!0,undoDelay,pendingActions,a)}.bind(c)),$("#warn-user").click(function(){var a=b(this),d=this._.account_url,e=window.location.href;pendingActions=createUndoToast(null,"Warning user",function(){this.warn(d,e)}.bind(c),!0,undoDelay,pendingActions,a)}.bind(c)),$("#ban-user").click(function(){var a=b(c),d=c._.account_url,e=window.location.href;pendingActions=createUndoToast(null,"Banning user",function(){this.ban(d,e)}.bind(c),!0,undoDelay,pendingActions,a)}.bind(c)),$("#obfuscate-post").click(function(){var a=b(this),d=this.imgurInsideNav.getHash();pendingActions=createUndoToast(null,"Obfuscating post",function(){this.obfuscate(d)}.bind(c),!0,undoDelay,pendingActions,a)}.bind(c)),$("#spam-user").click(function(){var a=b(c),d=c._.account_url,e=this.imgurInsideNav.getHash();pendingActions=createUndoToast(null,"Spamming user & removing",function(){this.spam(d,e)}.bind(c),!0,undoDelay,pendingActions,a)}.bind(c)),$("#ncmec-post").click(function(){var a=b(c),d=c.imgurInsideNav.getHash();pendingActions=createUndoToast(null,"Reporting post to NCMEC",function(){this.ncmec(d)}.bind(c),!0,undoDelay,pendingActions,a)}.bind(c)),$("#trophy-mod").on("click","button",_.bind(this.trophy,this))}}),Class.addSingleton(Imgur.Gallery),Namespace("Imgur.Gallery"),Imgur.Gallery.Inside=Imgur.Gallery.extend({init:function(a,b,c){this.imgurInsideNav=a,this._super(b,c)}}),Namespace("Imgur.Gallery"),Imgur.Gallery.Outside=Imgur.Gallery.extend({}),Namespace("Imgur.Gallery"),Imgur.Gallery.MainOutside=Imgur.Gallery.Outside.extend({init:function(a,b,c,d){this._super(b,c,d),this._.outsideActiveTagStore=a},handleTagChanged:function(a){var b=this._.outsideActiveTagStore.getIsActive();b?this._handleTagSelect(a):this._handleTagDeselect(a)},_handleTagDeselect:function(){this._.overRideUrl=null,this._.history.addWindowState("initial","tagDeselect",this.getSectionUrl()),this.refetchPage()},_handleTagSelect:function(a){var b=this._.outsideActiveTagStore.getActiveTag(),c=encodeURIComponent(this._.outsideActiveTagStore.getActiveTagEncoded());this._.overRideUrl="/t/"+c,"rising"==this._.sort&&(this._.sort="viral"),a||(window.history.replaceState&&!window.history.state&&window.history.replaceState("initial","initial",window.location.href),this._.history.addWindowState("tag","Imgur - "+b,this._.overRideUrl)),this._updatePageOnTagChange(this._.overRideUrl)},_updatePageOnTagChange:function(a){var b=$("#sort"),c=$("#section"),d=b.find('.item[value="rising"]');b.find('.item[value="top"]');if(c.find(".selected").removeClass("selected"),d.hasClass("selected")){var e=b.find('.item[value="'+this._.sort+'"]').addClass("selected");b.find(".selection").html(e.text())}d.hide(),$(".sort-options").hide(),this.refetchPage()},refetchPage:function(){this._.vars.loading||(this._.vars.scrolledPage>0&&(this._.vars.scrolledImageSet=-1),this._.vars.scrolledPage=0,Imgur.InfiniteScroll.getInstance().stopInfiniteScroll(),$(this._.el.outside.pageDivider).remove(),this.fadeInLoader(),this.fetchImages(0,0,_.bind(function(){this._.vars.loading||(Imgur.InfiniteScroll.getInstance().continueInfiniteScroll(),this.initOutsideInfScroll())},this)))}});var _extends=Object.assign||function(a){for(var b=1;b<arguments.length;b++){var c=arguments[b];for(var d in c)Object.prototype.hasOwnProperty.call(c,d)&&(a[d]=c[d])}return a};Namespace("Imgur.Gallery.LinksModal"),Imgur.Gallery.LinksModal=React.createClass({displayName:"Gallery-Link-Modal",componentDidMount:function(){Imgur.Util.jafoLog({event:"openLinkModal",meta:_extends({},this.props)})},handleClose:function(a){a.preventDefault(),$.colorbox.close()},handleUpload:function(a){a.preventDefault(),$.colorbox.close(),this.props.uploadAction()},handleLogin:function(a){a.preventDefault(),Imgur.getInstance().signin({invokedRegisterSigninBy:"Action - Publish"},!0)},handleRegister:function(a){a.preventDefault(),Imgur.getInstance().signin({invokedRegisterSigninBy:"Action - Publish"})},render:function(){var a=this.props,b=a.saveClasses,c=a.saveStatus,d=a.inputClasses,e=a.link,f=a.save,g=a.isLoggedIn;return React.createElement("div",null,React.createElement("p",{className:"subtitle"},"Link"),React.createElement("div",{className:"post-copy-options"},React.createElement("div",{className:b},c,f),React.createElement(Imgur.Elements.Copy,{value:e,inputClass:d,copyClass:"copy-post"})),React.createElement(Imgur.Elements.Socialicons,{classes:"post-options-social cf"}),g?React.createElement("div",{className:"modal-actions"},React.createElement("a",{className:"post-links-again btn btn-gray",onClick:this.handleUpload},"Upload again"),React.createElement("a",{className:"post-links-done btn btn-main",onClick:this.handleClose},"Done")):React.createElement("div",{className:"modal-links"},React.createElement("p",null,React.createElement("a",{onClick:this.handleLogin},"Log in")," or ",React.createElement("a",{onClick:this.handleRegister},"Register")," to save your post")))}});var _extends=Object.assign||function(a){for(var b=1;b<arguments.length;b++){var c=arguments[b];for(var d in c)Object.prototype.hasOwnProperty.call(c,d)&&(a[d]=c[d])}return a};Namespace("Imgur.Gallery.ShareModal"),Imgur.Gallery.ShareModal=React.createClass({displayName:"Gallery-Share-Modal",componentDidMount:function(){Imgur.Util.jafoLog({event:"openLinkModal",meta:_extends({},this.props)})},getInitialState:function(){return{doNotShow:Imgur.LocalStorage.exists(this.props.doNotShowKey)}},handleLinks:function(a){a.preventDefault(),this.props.linksAction()},handleShare:function(a){a.preventDefault(),this.saveDoNotShowState(),this.props.shareAction(),$.colorbox.close()},handleDoNotShowChanged:function(){this.setState({doNotShow:!this.state.doNotShow})},saveDoNotShowState:function(){this.state.doNotShow?Imgur.LocalStorage.save(this.props.doNotShowKey,1):Imgur.LocalStorage.remove(this.props.doNotShowKey)},render:function(){return React.createElement("div",null,React.createElement("p",{className:"modal-text"},"Are you ready to start earning points and comments by sharing your post with the Imgur community?"),React.createElement("div",{className:"post-options-donotshow-wrap"},React.createElement("input",{ref:"donotpost",id:"post-options-donotshow",type:"checkbox",defaultChecked:this.state.doNotShow,onChange:this.handleDoNotShowChanged,className:"post-options-donotshow checkbox-styled"}),React.createElement("label",{className:"icon-check",htmlFor:"post-options-donotshow"}," "),React.createElement("label",{htmlFor:"post-options-donotshow"},"Do not show this again")),React.createElement("div",{className:"modal-actions"},React.createElement("a",{className:"post-share-links btn btn-gray",onClick:this.handleLinks},"No, I wanted to grab a link"),React.createElement("a",{className:"post-share-done btn btn-main",onClick:this.handleShare},"Post publicly")))}}),Namespace("Imgur.Gallery"),Imgur.Gallery.Header=React.createClass({displayName:"Gallery-Header",MAX_ALBUM_TITLE:255,MAX_IMAGE_TITLE:128,propTypes:{noNav:React.PropTypes.bool},getInitialState:function(){return{first:!0,last:!1,image:this.props.initialImage,initial:!0,showingGrid:!1}},componentDidMount:function(){this.props.emitter.on("initGrid",this,function(){this.setState({showingGrid:!0})})},componentWillUnmount:function(){this.props.emitter.off("initGrid")},_next:function(){this.props.emitter.trigger("buttonNav","next")},_prev:function(){this.props.emitter.trigger("buttonNav","prev")},closeRearrange:function(){this.props.emitter.trigger("closeGrid"),this.setState({showingGrid:!1})},componentDidUpdate:function(){if(!this.state.initial){var a=$(".post-header");if(a.hasClass("fixed")&&"click"==this.state.navTrigger){a.removeClass("animate fixed animation-finished");var b=a.outerHeight();a.addClass("fixed"),$(".post-container").css("padding-top",b),$(document).scrollTop($(".post-container").offset().top+1)}else $(document).scrollTop(0)}},renderLastModLog:function(){if(!this.state.image.lastModLog)return null;var a="";switch(this.state.image.lastModLog.action){case 6:a="mod-log-trophy";break;case 7:a="mod-log-spam";break;case 9:a="mod-log-ignored";break;case 11:a="mod-log-mature";break;case 13:a="mod-log-generic"}return React.createElement("div",{className:"mod-log-marker "+a,title:this.state.image.lastModLog.title})},renderIsEmerald:function(){return this.state.image.isEmerald?React.createElement("div",{className:"emerald-marker",title:"Is an Emerald user"}):null},render:function(){var a,b="",c=this.renderIsEmerald(),d=this.renderLastModLog();return(this.props.noNav||Imgur.Environment.hasAccess&&!Imgur.Environment.captionsEnabled&&!this.state.image.is_album)&&(b=" nodisplay"),a=this.state.showingGrid?React.createElement("div",{onClick:this.closeRearrange,className:"right btn btn-action btn-rearrange-done'"},"Done"):React.createElement("div",{className:"next-prev"+b},React.createElement("div",{onClick:this.state.first?_.noop:this._prev,className:"btn navPrev icon icon-arrow-left"+(this.state.first?" disabled":"")}),React.createElement("div",{onClick:this.state.last?_.noop:this._next,className:"btn btn-action navNext"+(this.state.last?" disabled":"")},React.createElement("div",{className:"text"},"Next Post"),React.createElement("span",{className:"icon icon-arrow-right"}))),React.createElement("div",null,c,d,a,React.createElement("div",{className:"post-title-container"},React.createElement(Imgur.Gallery.TitleDesc,{postSavingStore:this.props.postSavingStore,element:"h1",type:"title",classes:"post-title"+(this.state.image.nsfw?" mature-indicator":""),placeholder:"Give your post a title...",text:this.state.image.title,is_album:this.state.image.is_album,deletehash:this.state.image.deletehash,max_length:this.state.image.is_album?this.MAX_ALBUM_TITLE:this.MAX_IMAGE_TITLE,no_enter:!0,published:this.props.published,showEditTools:this.props.showEditTools,tabindex:this.props.showEditTools?1:""})),React.createElement(Imgur.Gallery.SourceBar,{image:this.state.image,slim:this.props.showEditTools}))}}),Namespace("Imgur.Gallery"),Imgur.Gallery.Embed=React.createClass({displayName:"Gallery-Embed",originRegex:/^(http(s)?:){0,1}\/\/([a-z]{1,9}\.)*?(imgur(-dev)?.com)/,checkOrigin:function(a){return this.originRegex.exec(a)},getInitialState:function(){return{showContext:!0}},componentDidMount:function(){Imgur.Util.jafoLog({event:"openEmbedModal",meta:{inGallery:this.props.in_gallery,hash:this.props.hash,isAlbum:this.props.is_album,nsfw:this.props.nsfw,control:"postOptions"}}),$.ajax({url:this.getEmbedScript(),dataType:"script",cache:!0}),window.addEventListener("message",_.bind(function(a){if(!this.checkOrigin(a.origin))return a;try{var b=JSON.parse(a.data)}catch(c){return a}"resize_imgur"===b.message&&(this.refs.preview.style.height=b.height+"px",$.colorbox.resize())},this),!1)},getEmbedScript:function(){return"//"+(Imgur.Environment.isDev?Imgur.Environment.host+"/include/minified":"s.imgur.com/min")+"/embed.js"},getEmbedCode:function(a,b){var c=a===!1?' data-context="'+a+'"':"",d=b?"":' data-analytics="false"';return'<blockquote class="imgur-embed-pub" lang="en" data-id="'+(this.props.is_album?"a/":"")+this.props.hash+'"'+c+d+'><a href="//'+Imgur.Environment.host+"/"+(this.props.is_album?"a/":"")+this.props.hash+'">'+_.escape(this.props.title)+'</a></blockquote><script async src="'+this.getEmbedScript()+'" charset="utf-8"></script>'},handlerHideTitle:function(a,b){a.setState({showContext:!b},function(){window.imgurEmbed.createIframe()})},render:function(){var a=this.state.showContext;return React.createElement("div",null,React.createElement("p",{className:"embed-action"},"Copy + Paste this Code"),React.createElement(Imgur.Elements.Copy,{value:this.getEmbedCode(a,!0),inputClass:"copy-input embed-copy",copyClass:"copy"}),React.createElement("div",{ref:"preview",dangerouslySetInnerHTML:{__html:this.getEmbedCode(a,!1)}}),React.createElement("div",{className:"embed-meta"},React.createElement("span",null,"Include this post in your blog, news site, or anywhere else on the web!"),React.createElement(Imgur.Elements.CheckBox,{className:"right",label:"Hide Title",id:"hideTitle",onChange:this.handlerHideTitle.bind(null,this)})))}});var _slicedToArray=function(){function a(a,b){var c=[],d=!0,e=!1,f=void 0;try{for(var g,h=a[Symbol.iterator]();!(d=(g=h.next()).done)&&(c.push(g.value),!b||c.length!==b);d=!0);}catch(i){e=!0,f=i}finally{try{!d&&h["return"]&&h["return"]()}finally{if(e)throw f}}return c}return function(b,c){if(Array.isArray(b))return b;if(Symbol.iterator in Object(b))return a(b,c);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}();Namespace("Imgur.Gallery");var scaleSpring={stiffness:180,damping:10},positionSpring={stiffness:120,damping:17},width=189,height=189;Imgur.Gallery.Grid=React.createClass({displayName:"Gallery-Grid",COLUMN_COUNT:4,_:{onScroll:null,$window:$(window)},getDefaultProps:function(){return{gridImageClasses:""}},getInitialState:function(){for(var a=this.props.album_image_store.getImages(this.props.hash).images,b=a.length,c=[],d=null,e=0;e<b;e++){var f=Math.floor(e/this.COLUMN_COUNT),g=e%this.COLUMN_COUNT;c.push([width*g,height*f])}return{images:a,count:b,row_count:Math.floor(b/this.COLUMN_COUNT),mouse:[0,0],delta:[0,0],lastPressKey:d,lastPressIndex:null,isPressed:!1,layout:c,container_height:Math.ceil(b/4)*height,offset:this.props.offset,scrolltop:0,window_height:600}},componentWillMount:function(){this._.onScroll=_.throttle(_.bind(this.handleScroll,this),250),this._.$window.on("scroll",this._.onScroll),this.handleScroll()},findIndexByHash:function(a){for(var b=0;b<this.state.count;b++)if(this.state.images[b].hash==a)return b;return-1},handleScroll:function(){this.setState({scrolltop:this._.$window.scrollTop(),window_height:this._.$window.height()})},handleMouseMove:function(a){var b=a.pageX,c=a.pageY,d=this.state,e=d.images,f=d.lastPressKey,g=d.isPressed,h=_slicedToArray(d.delta,2),i=h[0],j=h[1];if(g){var k=[b-i,c-j],l=clamp(Math.floor(k[0]/width),0,this.COLUMN_COUNT-1),m=clamp(Math.floor(k[1]/height),0,this.state.row_count),n=m*this.COLUMN_COUNT+l,o=this.findIndexByHash(f),p=reinsert(e,o,n);this.setState({mouse:k,images:p})}},handleMouseDown:function(a,b,c){var d=_slicedToArray(b,2),e=d[0],f=d[1],g=c.pageX,h=c.pageY;this.setState({lastPressKey:a,lastPressIndex:this.findIndexByHash(a),isPressed:!0,delta:[g-e,h-f],mouse:[e,f]})},handleMouseUp:function(a){a.preventDefault(),this.props.mouseUp(this.state.images,a),this.setState({isPressed:!1,delta:[0,0]})},createRearrangeComponent:function(a){var b,c,d,e=this,f=a.hash,g=Imgur.Environment.cdnUrl+"/"+(a.hash+a.ext);if(f===this.state.lastPressKey&&this.state.isPressed){var h=_slicedToArray(this.state.mouse,2);c=h[0],d=h[1],b={translateX:c,translateY:d,scale:ReactMotion.spring(1.2,scaleSpring)}}else{var i=_slicedToArray(this.state.layout[this.findIndexByHash(f)],2);c=i[0],d=i[1],b={translateX:ReactMotion.spring(c,positionSpring),translateY:ReactMotion.spring(d,positionSpring),scale:ReactMotion.spring(1,scaleSpring)}}return".gif"===a.ext&&(g=Imgur.Environment.cdnUrl+"/"+a.hash+".mp4"),React.createElement(ReactMotion.Motion,{key:f,style:b},function(b){var h=b.translateX,i=b.translateY,j=b.scale;return React.createElement("span",{onMouseDown:_.partial(e.handleMouseDown,f,[c,d]),onMouseUp:e.handleMouseUp,className:"post-grid-image "+e.props.gridImageClasses,"data-href":g,"data-title":a.title,style:{backgroundImage:"url("+(Imgur.Environment.cdnUrl+"/"+a.hash+"b.jpg")+")",WebkitTransform:"translate("+h+"px, "+i+"px) scale("+j+")",transform:"translate("+h+"px, "+i+"px) scale("+j+")",zIndex:f===e.state.lastPressKey?9997:0}})})},render:function(){var a=[],b=this.state,c=b.window_height,d=b.scrolltop,e=b.offset,f=b.container_height,g=b.count,h=b.images,i=5,j=Math.floor((d-e)/height)-i;j<0?(j=0,i*=3):i*=2;for(var k=j+Math.floor(c/height)+i,l=j*this.COLUMN_COUNT,m=k*this.COLUMN_COUNT,n=l;n<m&&n<g;n++)a.push(this.createRearrangeComponent(h[n]));return this.state.isPressed&&(this.state.lastPressIndex<l||this.state.lastPressIndex>=m)&&a.push(this.createRearrangeComponent(h[this.state.lastPressIndex])),React.createElement("div",{ref:"container",className:"post-grid-images",style:{height:f+"px"},onMouseMove:!!this.props.allowRearrange&&this.handleMouseMove},a)}}),Namespace("Imgur.Gallery"),Imgur.Gallery.PostActionBar=React.createClass({PROMOTED_POST_TAG_NAME:"promotedpost",displayName:"Gallery-PostActionBar",actionType:{UPVOTE:"upvote",DOWNVOTE:"downvote",FAVORITE:"favorite"},voteType:{UP:"up",DOWN:"down"},getInitialState:function(){return{ups:this.props.ups,downs:this.props.downs,views:this.props.views,upvoted:"up"==this.props.vote,downvoted:"down"==this.props.vote,favorited:this.props.favorited,points:this.props.points,reported:1==$.cookie("r"+this.props.hash),postOptionsOpened:!1,signupTooltipOptions:null,galleryTags:this.props.galleryTags||[]}},componentDidMount:function(){this.props.in_gallery&&(this.props.emitter.on("pointUpdate",this,this.handlePointUpdate),this.props.emitter.on("addedToFolder",this,this.handleAddedToFolder),this.props.emitter.on("admTagAdded",this,this.handleAdmTagAdded))},componentWillUpdate:function(a,b){this.props.hash!=a.hash||this.props.isAd||(this.refs.points&&this.state.points!=b.points&&this.refs.points.classList.add("post-action-stats-points--fade"),this.refs.views&&this.state.views!=b.views&&this.refs.views.classList.add("post-action-stats-points--fade"))},componentDidUpdate:function(){this.props.isAd||setTimeout(_.bind(function(){this.refs.points&&this.refs.points.classList.remove("post-action-stats-points--fade"),this.refs.views&&this.refs.views.classList.remove("post-action-stats-points--fade")},this),150)},componentWillUnmount:function(){this.props.emitter.off("pointUpdate",this,this.handlePointUpdate),this.props.emitter.off("closed dropdown menu"),this.props.emitter.off("admTagAdded",this,this.handleAdmTagAdded)},handlePointUpdate:function(a){if("hash"in a)switch(a.type){case"image":if(this.state.points==a.points)return;this.props.sideGallery.updatePoints(a.hash,a.ups,a.downs),this.setState({ups:a.ups,downs:a.downs,points:a.points});break;case"views":if(this.state.views==a.views)return;this.props.sideGallery.updateViews(a.hash,a.views),this.setState({views:a.views})}},logCreateSignupTooltip:function(a){var b={type:"gallery"};switch(a){case this.actionType.FAVORITE:b.invokedToolTipBy="Action - Favorite";break;case this.actionType.UPVOTE:b.voteType=this.voteType.UP,b.invokedToolTipBy="Action - Vote";break;case this.actionType.DOWNVOTE:b.voteType=this.voteType.DOWN,b.invokedToolTipBy="Action - Vote"}Imgur.Util.jafoLog({event:"toolTipAppear",meta:b})},createSignupTooltip:function(a){var b=this,c=a.type,d=a.title,e=a.body,f=Imgur.Environment.staticUrl+"/images/icons/large_"+c+".png",g=this.props.in_gallery?"":"-nongallery",h="ActionCard-post ActionCard-animate ActionCard-"+c+g,i=c+"-signup-card",j={invokedRegisterSigninBy:"Action - Vote",type:"image"},k=[Imgur.Elements.ActionCard.createAction("signin","Sign in",function(){return Imgur.getInstance().signin(j,!0)},"btn btn-left-edge"),Imgur.Elements.ActionCard.createAction("signup","Sign up",function(){return Imgur.getInstance().signin(j)},"btn btn-action btn-action-card")];return this.logCreateSignupTooltip(c),React.createElement("div",{id:"signup-tooltip"},React.createElement(Imgur.Elements.ActionCard,{key:c,classNames:h,name:i,title:d,body:e,actions:k,imageUrl:f,close:function(){b.setState({signupTooltipOptions:null})}}))},showSignupTooltip:function(a){var b=this;return this.state.signupTooltipOptions&&a.type===this.state.signupTooltipOptions.type?void this.setState({signupTooltipOptions:null}):void setTimeout(function(){b.setState({signupTooltipOptions:a})},1)},handleVote:function(a,b){if((this.state.upvoted&&"up"==a||this.state.downvoted&&"down"==a)&&!b&&(a="veto"),!Imgur.Environment.auth.id&&!b){var c=void 0;return c="up"===a?{type:this.actionType.UPVOTE,title:"Up and Away!",body:"Sign up to upvote the posts you like and make them more popular."}:{type:this.actionType.DOWNVOTE,title:"Beg to differ?",body:"Sign up to downvote the posts that rub you the wrong way."},void this.showSignupTooltip(c)}var d=Imgur.UserStatistics.getInstance();d.emitActionUserVote(this.props.hash,a,this.getTagsNames()),this.setState({upvoted:"up"==a,downvoted:"down"==a}),$.ajax({url:"/gallery/action/vote/"+this.props.hash,type:"POST",data:{vote:a,sid:Imgur.Environment.msid,type:"image",location:"inside",gallery:Imgur.Gallery.getInstance().getGalleryMetadata(),source:Imgur.Gallery.getInstance().getVoteSourceFromEnvironment()},displayGenericError:!1,success:_.bind(function(b){b.gallery&&b.gallery.message&&humanMsg.displayMsg(b.gallery.message),Imgur.Environment.auth.id&&Imgur.Util.jafoLog({event:"vote"+(this.props.readonly?"ReadOnly":""),meta:_.merge(Imgur.Gallery.getInstance().getGalleryMetadata(),{hash:this.props.hash,type:"image",vote:a,location:"inside"})})},this)}),this.props.sideGallery.updateVote(this.props.hash,a,_.bind(function(a){this.setState({points:a})},this))},handleAddedToFolder:function(){this.setState({favorited:!0})},handleAdmTagAdded:function(a){this.setState(function(b){return{galleryTags:[].concat(_toConsumableArray(b.galleryTags),[{tag:a,display:a}])}})},handleFavorite:function(){var a=this.state.favorited;if(!Imgur.Environment.auth.id)return void this.showSignupTooltip({type:this.actionType.FAVORITE,title:"Fave and Never Forget",body:"Sign up to save your favorite posts to your profile."});if(!this.state.favorited){var b=Imgur.UserStatistics.getInstance();b.emitActionUserAddInFavorite(this.props.hash,this.getTagsNames())}this.setState({favorited:!this.state.favorited});var c="/"+this.props.hash+"/fav.json";this.props.is_album&&(c="/a"+c),$.ajax({url:c,type:"POST",data:{ajax:!0,msid:Imgur.Environment.msid,location:"inside"},error:_.bind(function(){Imgur.Environment.auth.id&&this.setState({favorited:!this.state.favorited})},this)}),Imgur.Util.jafoLog({event:"favorite",meta:{isAlbum:this.props.is_album,hash:this.props.hash,location:"inside",state:a?"unfavorite":"favorite"}})},showAnalytics:function(){var a=this.props.size;if(!this.props.isAd){if(this.props.is_album&&this.props.album_images){a=0;for(var b=0;b<this.props.album_images.length;b++)a+=this.props.album_images[b].size}$.colorbox({html:'<div id="analytics-container"></div>',open:!0,top:"10%",transition:"none",scrolling:!1,fixed:!0,width:636,height:465,className:"blurbox",close:"",title:"Analytics",onComplete:_.bind(function(){ReactDOM.render(React.createElement(Imgur.Elements.Analytics,{ups:this.state.ups,downs:this.state.downs,thumbhash:this.props.is_album?this.props.album_cover:this.props.hash,views:this.state.views,size:a,comments:this.props.comment_count,timestamp:this.props.timestamp,title:this.props.title,inGallery:this.props.in_gallery,galleryHash:this.props.in_gallery?this.props.hash:"",isAlbum:this.props.is_album,favoriteCount:this.props.favorite_count}),document.getElementById("analytics-container"),$.colorbox.resize)},this)})}},handleReport:function(a){a.preventDefault();var b={type:"galleryPost",hash:this.props.hash,isAlbum:this.props.is_album,nsfw:this.props.nsfw};Imgur.Util.jafoLog({event:"reportInvoked",meta:b}),Imgur.Environment.auth.id?$.colorbox({html:'<div id="report-container"></div>',open:!0,top:"10%",transition:"none",scrolling:!1,fixed:!0,width:Imgur.Elements.Report.dimensions.width,height:Imgur.Elements.Report.dimensions.height,className:"noBorder",close:"",onComplete:_.bind(function(){ReactDOM.render(React.createElement(Imgur.Elements.Report,{type:"post",url:"/gallery/action/report_image/"+this.props.hash,metadata:b,cb:_.bind(function(){this.setState({reported:!0})},this)}),$("#report-container").get(0))},this),onClosed:_.bind(function(){Imgur.Gallery.getInstance()._.preventReportCloseAnalytics||Imgur.Util.jafoLog({event:"reportCancel",meta:_.extend({method:"modal"},b)}),Imgur.Gallery.getInstance().resetReportCloseAnalytics()},this)}):Imgur.getInstance().signin("Action - Report")},handleDownload:function(a){a.preventDefault(),Imgur.Util.jafoLog({event:"downloadImage",meta:{control:"postOptions",nsfw:this.props.nsfw,hash:this.props.hash,isAlbum:this.props.is_album,isAnimated:this.props.animated}}),this.props.is_album?window.location="/a/"+this.props.hash+"/zip":window.location="/download/"+this.props.hash+"/"+encodeURIComponent(this.props.title)},handleEmbed:function(a){a.preventDefault(),$.colorbox({href:'<div id="embed-modal"></div>',open:!0,inline:!0,top:40,transition:"none",scrolling:!1,width:500,height:581,className:"embed-wrapper",title:"Embed this post",onComplete:_.bind(function(){ReactDOM.render(React.createElement(Imgur.Gallery.Embed,{hash:this.props.hash,title:this.props.title,in_gallery:!!this.props.in_gallery,is_album:!!this.props.is_album,nsfw:!!this.props.nsfw}),document.getElementById("embed-modal"))},this)})},handleMarkMature:function(a){a.preventDefault();var b="Are you sure you want to mark this submission as mature?";Imgur.Environment.auth.show_mature||(b="<p>"+b+'</p><p>If you\'d like to enable mature content for your account, please visit your <a href="/account/settings">account settings</a> and choose &quot;Show mature posts and comments.&quot; If you mark a post as mature, but choose not to enable mature content, you may not see your post when browsing Imgur.</p>'),$.colorbox({href:'<div id="mark-mature"></div>',open:!0,inline:!0,top:"15%",transition:"none",scrolling:!1,width:420,height:160,className:"blurbox",title:"Mark this submission as mature?",onComplete:_.bind(function(){ReactDOM.render(React.createElement(Imgur.Elements.Confirm,{message:b,handleNo:$.colorbox.close,handleYes:_.bind(function(){$.post("/gallery/action/mature_image/"+this.props.hash,{sid:Imgur.Environment.msid},_.bind(function(a){Imgur.Util.jafoLog({event:"markGalleryAsMature",meta:{hash:this.props.hash,isAlbum:this.props.is_album}}),$.colorbox.close(),humanMsg.displayMsg("Submission marked as mature")},this))},this)}),document.getElementById("mark-mature"),$.colorbox.resize)},this)})},togglePostOptions:function(){this.setState({postOptionsOpened:!this.state.postOptionsOpened},_.bind(function(){this.state.postOptionsOpened?document.addEventListener("click",this.togglePostOptions):document.removeEventListener("click",this.togglePostOptions)},this))},handleHideAlbumFromAccount:function(a){a.preventDefault(),$.colorbox({href:'<div id="hide-album"></div>',open:!0,inline:!0,top:"15%",transition:"none",scrolling:!1,width:420,height:160,className:"blurbox",title:"Hide Album From Account",onComplete:_.bind(function(){ReactDOM.render(React.createElement(Imgur.Elements.Confirm,{message:"Are you sure you want to hide this album? It will still be accessible through the link, but it won't show up in your account. You will also no longer be able to edit it.",handleNo:$.colorbox.close,handleYes:_.bind(function(){$.post("/ajaxalbums/hide/"+this.props.hash,{msid:Imgur.Environment.msid},function(a){$.colorbox.close(),humanMsg.displayMsg("Album has been hidden")})},this)}),document.getElementById("hide-album"),$.colorbox.resize)},this)})},logTopicClick:function(){Imgur.Util.jafoLog({event:"openTopicTag",meta:{hash:this.props.hash,isAlbum:this.props.is_album,nsfw:this.props.nsfw,isHot:this.props.is_hot,control:"topic",location:"inside",galleryType:"topic",topicTag:this.props.topic}})},handleDelete:function(a){a.preventDefault(),$.colorbox({href:'<div id="delete-album-form"></div>',open:!0,inline:!0,top:"15%",transition:"none",scrolling:!1,width:420,height:160,className:"blurbox",title:"Remove Submission from Gallery",onComplete:_.bind(function(){ReactDOM.render(React.createElement(Imgur.Elements.Confirm,{message:"Are you sure you want to remove this submission from the gallery?",handleNo:$.colorbox.close,handleYes:_.bind(function(){$.post("/gallery/action/delete_image/"+this.props.hash,{sid:Imgur.Environment.msid},_.bind(function(a){Imgur.Util.jafoLog({event:"removeFromGallery",meta:{hash:this.props.hash,isAlbum:this.props.is_album}}),Imgur.Environment.auth.id&&($.colorbox.close(),humanMsg.displayMsg("Submission has been removed"),setTimeout(_.bind(function(){this.props.is_album?window.location="/a/"+this.props.hash:window.location="/"+this.props.hash},this),500))},this))},this)}),document.getElementById("delete-album-form"),$.colorbox.resize)},this)})},handleRemoveTag:function(a){var b=this;$.post("/gallery/action/remove_tag/"+this.props.hash,{sid:Imgur.Environment.msid,tag:a.tag},function(){b.setState({galleryTags:b.state.galleryTags.filter(function(b){return b.tag!==a.tag})}),b.props.emitter.trigger("admTagRemoved",a.tag),humanMsg.displayMsg(a.display+" removed from post")}).fail(function(){humanMsg.displayMsg("Unable to remove tag "+a.display+" from post","error-msg")})},getTagsNames:function(){var a=_.values(this.state.galleryTags);return _.map(a,function(a){return a.display||a.tag})},renderTags:function(){var a=this;return this.props.in_gallery?this.props.hide_tags?null:this.state.galleryTags?Object.values(this.state.galleryTags).map(function(b){return React.createElement(Imgur.Elements.Tag.View,{key:b.tag,tagName:b.display||b.tag,redirectTo:"/t/"+b.tag,redirectAnalytics:a.handleTagClick(b.tag),
classNames:"post-action-tags-tag",allowRemoval:Imgur.Environment.isGalleryAdmin||Imgur.Environment.isGalleryModerator||Imgur.Environment.isGallerySupermoderator,removeTag:a.handleRemoveTag.bind(a,b),tag:b})}):null:null},handleTagClick:function(a){return function(){var b=_.extend(Imgur.Gallery.getInstance().getGalleryMetadata(),{location:"tagModule",promotedTagGallery:!1,tagName:a});Imgur.Util.jafoLog({event:"tagClick",meta:b})}},postOption:function(a,b,c){var d=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"#";return React.createElement("li",{key:b},React.createElement("a",{className:"post-action-option",href:d,onClick:c},React.createElement("span",{className:"icon-"+a+" post-action-options-items-icon"}),React.createElement("span",{className:"post-action-link-text"},b)))},openSaveToFolder:function(a){if(a.preventDefault(),!Imgur.Environment.auth.id)return void Imgur.getInstance().signin("Action - Favorite Folder");var b=.9*window.innerHeight;window.document.body.classList.add("modal-open"),$.colorbox({html:'<div id="favorite-folder-container"></div>',open:!0,top:.05*window.innerHeight,transition:"none",scrolling:!1,fixed:!0,width:640,height:b,className:"noBorder",close:"",onComplete:_.bind(function(){ReactDOM.render(React.createElement(Imgur.Elements.FavoriteFolderChooser,{id:this.props.hash,height:b,emitter:this.props.emitter}),$("#favorite-folder-container").get(0))},this),onClosed:_.bind(function(){window.document.body.classList.remove("modal-open")},this)})},render:function(){var a=!this.props.in_gallery||this.props.hide_points,b=classNames({"post-action-icon":!0,"post-action-upvote":!0,"icon-upvote-outline":!this.state.upvoted,"icon-upvote-fill":this.state.upvoted,green:this.state.upvoted}),c=classNames({"post-action-icon":!0,"post-action-downvote":!0,"icon-downvote-outline":!this.state.downvoted,"icon-downvote-fill":this.state.downvoted,red:this.state.downvoted}),d=classNames({"post-action-icon":!0,"post-action-favorite":!0,"icon-favorite-outline":!this.state.favorited,"icon-favorite-fill":this.state.favorited,aqua:this.state.favorited}),e={className:"post-action-stats"};this.props.in_gallery&&(e.className+=" pointer",e.onClick=this.showAnalytics);var f=classNames({"post-action-stats-points":!0,nodisplay:a}),g=classNames({nodisplay:0==this.state.views||this.props.hide_views}),h=classNames({"post-action-options":!0,pointer:!0,right:!0,"post-action-options--opened":this.state.postOptionsOpened}),i=[],j=Imgur.Environment.auth.url&&Imgur.Environment.auth.url==this.props.account_url;this.props.in_gallery&&(this.props.hide_report||(this.state.reported?i.push(this.postOption("flag","Post Reported")):i.push(this.postOption("report-outline","Report Post",this.handleReport))),!this.props.nsfw&&j&&i.push(this.postOption("alert","Mark As Mature",this.handleMarkMature)),(j||this.props.isAd&&Imgur.Environment.isPPUser)&&i.push(this.postOption("trash","Remove From Public",this.handleDelete))),i.push(this.postOption("download","Download Post",this.handleDownload)),i.push(this.postOption("embed","Embed Post",this.handleEmbed)),this.props.is_album||this.props.animated||i.push(this.postOption("meme","Make Meme",void 0,"/memegen/create/"+this.props.hash));var k=null;this.state.signupTooltipOptions&&(k=this.createSignupTooltip(this.state.signupTooltipOptions));var l=React.createElement("a",{className:"Open-Save-To-Folder-Button",onClick:this.openSaveToFolder},"+");return a?React.createElement("div",null,React.createElement("div",{className:"post-action-actions post-action-single"+(this.props.add_border?" post-action-border":"")},k,this.props.in_gallery?React.createElement("span",null,React.createElement(Imgur.Elements.PressButton,{onPress:_.partial(this.handleVote,"up"),className:b}),React.createElement(Imgur.Elements.PressButton,{onPress:_.partial(this.handleVote,"down"),className:c})):"",React.createElement(Imgur.Elements.PressButton,{onPress:_.partial(this.handleFavorite),className:d}),l,Imgur.Environment.subscription.isFoundersClub&&React.createElement(Imgur.Gallery.PostActionConfetti,{hash:this.props.hash}),React.createElement("span",e,React.createElement("span",{className:g},Imgur.Util.numberFormat(this.state.views)," view",1!=this.state.views&&this.state.views!=-1?"s":"")),React.createElement("div",{onClick:this.togglePostOptions,className:h},React.createElement("span",{className:"icon-ellipses"}),React.createElement("ul",{className:"post-action-options-items"},i)),!this.props.in_gallery||this.props.hide_report||this.state.reported||"new"!=this.props.sideGallery.getSection()?"":React.createElement("a",{href:"",onClick:this.handleReport,className:"icon-flag post-action-report right"}),React.createElement(Imgur.Elements.Socialicons,{classes:"right",hash:this.props.hash,tagsNames:this.getTagsNames()})),React.createElement("div",{className:"post-action-tags"},this.renderTags())):React.createElement("div",{className:this.props.add_border?"post-action-border":""},React.createElement("div",{className:"post-action-actions"},k,React.createElement(Imgur.Elements.PressButton,{onPress:_.partial(this.handleVote,"up"),className:b}),React.createElement(Imgur.Elements.PressButton,{onPress:_.partial(this.handleVote,"down"),className:c}),React.createElement(Imgur.Elements.PressButton,{onPress:_.partial(this.handleFavorite),className:d}),l,Imgur.Environment.subscription.isFoundersClub&&React.createElement(Imgur.Gallery.PostActionConfetti,{hash:this.props.hash}),React.createElement("div",{onClick:this.togglePostOptions,className:h},React.createElement("span",{className:"icon-ellipses"}),React.createElement("ul",{className:"post-action-options-items"},i)),React.createElement(Imgur.Elements.Socialicons,{classes:"right",hash:this.props.hash,tagsNames:this.getTagsNames()})),React.createElement("div",{className:"post-action-meta"},React.createElement("span",e,React.createElement("span",{ref:"points",className:f},Imgur.Util.numberFormat(this.state.points)," Point",1!=this.state.points&&this.state.points!=-1?"s":""),React.createElement("span",{ref:"views",className:g},Imgur.Util.numberFormat(this.state.views)," View",1!=this.state.views&&this.state.views!=-1?"s":""))),React.createElement("div",{className:"post-action-tags"},this.renderTags()))}}),Namespace("Imgur.Gallery"),Imgur.Gallery.Privacy=React.createClass({displayName:"Gallery-Privacy",PUBLIC:0,HIDDEN:1,getInitialState:function(){return{publicPrivacy:this.props.privacy==this.PUBLIC}},handleChange:function(a){this.setState({publicPrivacy:this.refs.privacyForm.elements.privacy.value==this.PUBLIC})},handleSave:function(){var a=this.state.publicPrivacy?this.PUBLIC:this.HIDDEN;$.ajax({method:"POST",url:"/ajaxalbums/settings/"+this.props.hash,data:{privacy:a},success:function(){this.props.handleSuccess(a)}.bind(this)})},render:function(){var a="Your posts are hidden to anyone coming to your profile, but can still be accessed via the direct URL.",b="privacy-hidden-message";return this.state.publicPrivacy&&(a="When a post is marked 'public', it can be seen in your profile and shared around the web.",b="privacy-public-message"),React.createElement("div",null,React.createElement("div",{className:"privacy-selection"},React.createElement("div",{className:"privacy-title"},"Select a setting"),React.createElement("div",{className:"spaceform"},React.createElement("form",{ref:"privacyForm"},React.createElement("label",{className:"privacy-public"+(this.state.publicPrivacy?" privacy-selected":"")},React.createElement("input",{type:"radio",name:"privacy",value:this.PUBLIC,checked:this.state.publicPrivacy,onChange:this.handleChange}),React.createElement("i",{className:"spaceform-radio"})," ",React.createElement("span",{className:"privacy-setting"},"Public")," ",React.createElement("i",{className:"icon-globe"})),React.createElement("label",{className:this.state.publicPrivacy?"":"privacy-selected"},React.createElement("input",{type:"radio",name:"privacy",value:this.HIDDEN,checked:!this.state.publicPrivacy,onChange:this.handleChange}),React.createElement("i",{className:"spaceform-radio"})," ",React.createElement("span",{className:"privacy-setting"},"Hidden")," ",React.createElement("i",{className:"icon-lock"}))))),React.createElement("p",{className:b},a),React.createElement("button",{className:"btn btn-action right privacy-save",onClick:this.handleSave},"Save"))}}),Namespace("Imgur.Gallery"),Imgur.Gallery.ShareImage=React.createClass({displayName:"Gallery-ShareImage",render:function(){return React.createElement("div",null,React.createElement("div",{className:"left"},React.createElement("h3",{className:"font-opensans-reg"},"Share Link"),React.createElement(Imgur.Elements.Copy,{value:this.props.embedcoder.imageLink(),inputClass:"copy-input",copyClass:"copy"}),React.createElement("h3",{className:"font-opensans-reg"},"BBCode (Forums)"),React.createElement(Imgur.Elements.Copy,{value:this.props.embedcoder.bbcode(),inputClass:"copy-input",copyClass:"copy"})),React.createElement("div",{className:"right"},React.createElement("h3",{className:"font-opensans-reg"},"Embed in HTML"),React.createElement(Imgur.Elements.Copy,{value:this.props.embedcoder.embed(),inputClass:"copy-input",copyClass:"copy"}),React.createElement("h3",{className:"font-opensans-reg"},"Markdown (Reddit)"),React.createElement(Imgur.Elements.Copy,{value:this.props.embedcoder.markdown(),inputClass:"copy-input",copyClass:"copy"})))}}),Namespace("Imgur.Gallery"),Imgur.Gallery.SharePost=React.createClass({displayName:"Gallery-ShareImage",getInitialState:function(){return{topics:[],validTitle:!1,topicSelected:-1}},componentWillMount:function(){this.topics_request=$.get("https://api.imgur.com/3/topics/defaults",_.bind(function(a){this.setState({topics:a.data},$.colorbox.resize)},this))},componentWillUnmount:function(){this.topics_request.abort()},handleTopicSelect:function(a){this.setState({topicSelected:a})},handleTitleValidation:function(a){this.setState({validTitle:a})},handleShare:function(){},handleFail:function(a){var b=this;try{if(!a)throw"bad response";a.responseText&&(a=$.parseJSON(a.responseText))}catch(c){return humanMsg.displayMsg("An unknown error occurred. Please try again.","error-msg"),void Imgur.Util.jafoLog({event:"shareOnImgurError",meta:{hash:this.props.hash,error:"unparsable",button:"share"}})}if(null==a.data||null==a.data.error||null==a.data.error.message)return humanMsg.displayMsg("An unknown error occurred. Please try again.","error-msg"),void Imgur.Util.jafoLog({event:"shareOnImgurError",meta:{hash:this.props.hash,error:"unknown",button:"share"}});var d=parseInt(a.data.error.message),e="unknown";if(!isNaN(d)&&d>0){e="rateLimit";var f=d>60?Math.round(d/60)+Imgur.Util.pluralize(Math.round(d/60)," minute"):d+Imgur.Util.pluralize(d," second");humanMsg.displayMsg("You're sharing too quickly. Please wait "+f+".","error-msg")}else"Banned"==a.data.error.message?(e="banned",humanMsg.displayMsg("Your account has been blocked. Please contact support@imgur.com.","error-msg")):"Terms"==a.data.error.message?(e="terms",this.showTerms(savePreview)):"NotVerified"==a.data.error.message?(e="notVerified",this.showEmailVerification(function(){savePreview?b.handleSave():b.handleSubmit()})):"OP"==a.data.error.message?humanMsg.displayMsg("OP must exist.","error-msg"):"Suspended"==a.data.error.message?(e="suspended",humanMsg.displayMsg("Your account is currently suspended","error-msg")):humanMsg.displayMsg("An unknown error occurred. Please try again.","error-msg");Imgur.Util.jafoLog({event:"shareOnImgurError",meta:{hash:this.props.hash,error:e,button:"share"}})},render:function(){var a=[],b=this.state.topicSelected>=0,c=classNames({right:!0,btn:!0,"btn-grey":!this.state.validTitle||!b,"btn-action":this.state.validTitle&&b}),d="Share";this.state.validTitle||b?this.state.validTitle?b||(d="Topic Required"):d="Title Required":d="Title & Topic Required";for(var e=0;e<this.state.topics.length;e++){var f="";this.state.topicSelected==e&&(f=" green"),a.push(React.createElement("div",{className:"post-share-topic pointer"+f,onClick:_.partial(this.handleTopicSelect,e),key:"topic"+e},React.createElement("i",{className:"icon-checkmarkcircle"})," ",React.createElement("span",{className:"post-share-topic-name"},this.state.topics[e].name),React.createElement("div",{className:"post-share-topic-desc"+f},this.state.topics[e].description)))}return React.createElement("div",null,React.createElement("div",{className:"tooltip"},"Contains Mature Content ",React.createElement("input",{type:"checkbox"}),React.createElement("span",{className:"tooltip-text tooltip-text-bottom"},"What's this? Mature content is intended for adult audiences only. Selecting this option also enables mature content in your stream.")),React.createElement(Imgur.Elements.NanoScroller,{classes:"post-share-options"},React.createElement(Imgur.Share.Title,{handleChange:this.handleTitleValidation,title:this.props.title,maxLength:255,inputClasses:"post-share-input",limitClasses:"right post-share-counter"}),React.createElement("div",{className:"cf"}),React.createElement("span",{className:"post-share-topics-header"},"Topic"),React.createElement("div",{className:"post-share-topics"},a)),React.createElement("div",{className:"post-share-save"},React.createElement("button",{className:c},d)))}}),Namespace("Imgur.Gallery"),Imgur.Gallery.SourceBar=React.createClass({displayName:"Gallery-SourceBar",viaAppIconClick:function(){Imgur.Util.jafoLog({event:"viaAppIcon",meta:{type:"upload",hash:this.props.image.hash,isAlbum:this.props.image.is_album,nsfw:this.props.image.nsfw,inGallery:!0,platform:"ios"===this.props.image.platform?"iphone":this.props.image.platform}})},_redditSource:function(a,b){return React.DOM.a({href:"https://www.reddit.com"+a,target:"_blank",key:"reddit"},b)},handleUserProfileClick:function(){Imgur.Util.jafoLog({event:"userProfileNav",meta:{accountId:this.props.image.account_id,method:"usernamePost"}})},render:function(){var a=[],b=!1;if((this.props.image.isAd||this.props.image.is_ad)&&a.push(React.DOM.a({href:"https://imgur.com/blog/2015/05/31/about-promoted-posts/",className:"title promoted-tag",title:"learn more about promoted posts",key:"promoted"},this.props.image.isAnnouncement?"Announcement":"Promoted")),this.props.image.account_url)a.push(React.DOM.span({key:"by"}," by "),React.DOM.a({href:"/user/"+this.props.image.account_url,onClick:this.handleUserProfileClick,title:"view account of "+this.props.image.account_url,className:"post-account",key:"account"},this.props.image.account_url));else if(this.props.image.reddit){var c=this.props.image.video_source&&!this.props.image.is_album?" (source) ":"(source) ";a.push(this._redditSource(this.props.image.reddit,c))}else this.props.image.subreddit?a.push(this._redditSource(this.props.image.permalink,"(source) ")):(b=!0,a.push(React.DOM.span({key:"anon"},"Uploaded ")));var d={className:"post-title-meta font-opensans-semibold"};return this.props.image.title||Imgur.Environment.hasAccess||this.props.slim||(d.className+=" post-title-meta--notitle"),this.props.image.isAd||this.props.image.is_ad?React.DOM.div(d,a):(["ios","android"].indexOf(this.props.image.platform)>=0&&a.push(React.DOM.span({key:"platform"}," via ",React.DOM.a({href:"//"+Imgur.Environment.host+"/apps",onClick:this.viaAppIconClick},"ios"==this.props.image.platform?"iPhone":"Android",React.DOM.span({className:"icon-mobile"},null)))),(this.props.image.timestamp||this.props.image.datetime)&&a.push(React.createElement(Imgur.Elements.Timestamp,{key:"humantime"+(this.props.image.timestamp||this.props.image.datetime),shouldUpdate:!1,timestamp:this.props.image.timestamp||this.props.image.datetime})),this.props.image.video_source&&!this.props.image.is_album&&a.push(React.DOM.span({className:"vidgif-info",key:"vidgif"},"Made with ",React.DOM.a({href:"//imgur.com/vidgif",target:"_blank"},"Video to GIF"))),React.DOM.div(d,a))}}),Namespace("Imgur.Gallery.Post"),Imgur.Gallery.Post=React.createClass({INITIAL_LOAD:10,MAX_WIDTH:728,MAX_NON_GALLERY_TITLE:128,MAX_TEXTAREA:32767,ADD_IMAGE_ROW_HEIGHT:30,RENDER_STATE:{PRE:1,POST:2},TAG_REGEX:"(^|\\s|\\W)#((?!\\d+(?:[^a-z0-9_]))[a-z0-9_]{"+Imgur.Constants.MIN_TAG_LENGTH+","+Imgur.Constants.MAX_TAG_LENGTH+"})(?=$|\\s|\\W)",updatingState:!1,_:{onScroll:null,$window:$(window),audioState:Imgur.VideoControls.AudioState.PRESENT_MUTED},displayName:"GalleryPost",getInitialState:function(){var a="",b=!1,c=null;if(this.props.data.force_grid&&(a="browse"),this.props.data.is_album){var d=window.location.hash.substr(1);if(d){var e=this.props.album_image_store.getImages(this.props.data.hash);if(e)for(var f=0;f<e.images.length;f++)if(e.images[f].hash==d||f+1==d){f>=this.INITIAL_LOAD&&(b=!0),c=e.images[f].hash,history.scrollRestoration="manual";break}}}return{all_loaded:b,gridType:a,render_state:this.RENDER_STATE.PRE,scrolltop:0,window_height:600,thumb_size:"0"==localStorage.getItem("retina")?"g":"r",isLoadingTags:!1,hashToScrollTo:c}},componentDidMount:function(){if(this.props.data.is_album&&(this._calculateContainerHeights(),this.setState({render_state:this.RENDER_STATE.POST}),this.props.in_gallery||(this.props.emitter.on("initGrid",this,function(a){this._.$window.off("scroll",this._.onScroll),this.setState({gridType:a})}),this.props.emitter.on("closeGrid",this,function(){this._.$window.on("scroll",this._.onScroll),this._handleScroll(),this.setState({gridType:""})}))),this.props.data.is_viral){var a='<div id="post-edit-message">';a+='<div class="post-edit-message-header"></div>',a+='<div class="post-edit-message-body">',a+="<p><strong>Your post is in Most Viral! Please edit responsibly.</strong></p>",a+='<p>It\'s good Imgur-etiquette to use the phrase "Edit" to distinguish new details about your post.</p>',a+='<p>Bad edits change the context of the post, solicit Imgurians to send inappropriate things, add spammy links, or violate our <a href="/rules">community rules</a>.</p>',a+='<div class="right margin-top margin-bottom"><button class="btn btn-action" onclick="$.colorbox.close()">Okay, got it!</button></div>',a+="</div></div>",$.colorbox({html:a,open:!0,top:"10%",transition:"none",scrolling:!1,fixed:!0,width:540,height:445,className:"noBorder noX"})}this.showTitles=Imgur.LocalStorage.get("showTitles")||!1,this.props.emitter.on("audioStateChange",this,this.handleAudioStateChange)},componentWillMount:function(){this.props.all_loaded&&this.setState({all_loaded:!0}),this._.onScroll=_.throttle(_.bind(this._handleScroll,this),250),this._.$window.on("scroll",this._.onScroll),this._handleScroll()},componentWillUnmount:function(){this.props.data.is_album&&this._.$window.off("scroll",this._.onScroll)},componentDidUpdate:function(a,b){if(this.props.data.is_album&&(this.state.render_state==this.RENDER_STATE.PRE||this.props.has_access&&this.updatingState===!0)&&(this._calculateContainerHeights(),this.updatingState=!1,this.setState({render_state:this.RENDER_STATE.POST})),this.state.hashToScrollTo){var c=this.state.hashToScrollTo;this.setState({hashToScrollTo:null},function(){this.scrollToHash(c)}.bind(this))}},componentWillReceiveProps:function(a){this.setState({all_loaded:a.all_loaded,render_state:this.RENDER_STATE.PRE,gridType:a.gridType})},getSessionAudioState:function(){return this._.audioState},_handleScroll:function(){this.setState({scrolltop:this._.$window.scrollTop(),window_height:this._.$window.height()})},_scaleWidth:function(a,b,c){if(b&&a){var d=b/a;if(a>=c)return Math.round(c*d)}return b},updateTagsFromText:_.debounce(function(a,b,c){var d=this;if("description"===b){var e=a+b,f=new RegExp(this.TAG_REGEX,"gi"),g=[],h=void 0;do h=f.exec(c+" "),h&&g.push(h[2]);while(h);this.props.tagStore.getTags().forEach(function(a){a.addedVia===e&&g.indexOf(a.tagName)===-1&&d.props.tagStore.removeTag(a.tagName)}),g.forEach(function(a){d.props.tagStore.addTag(a,e,function(){})})}},1e3),_setContainerHeightByIndex:function(a,b,c){var d=this.props.album_image_store.getImages(this.props.data.hash),e=d.images[a],f=e.containerHeight;e[b]=c;var g=e.reactKey?e.reactKey:e.hash,h=this._calculateElementHeight(ReactDOM.findDOMNode(this.refs[g]));e.containerHeight=h!==!1?h:e.containerHeight,f!=e.containerHeight&&this._handleScroll(),this.updateTagsFromText(a,b,c)},_calculateContainerHeights:function(){var a=this.props.album_image_store.getImages(this.props.data.hash),b=a.count;a=a.images,this.state.all_loaded||(b=Math.min(b,this.INITIAL_LOAD));for(var c=0;c<b;c++)if("number"!=typeof a[c].containerHeight||a[c].recalcReady){var d=a[c].reactKey?a[c].reactKey:a[c].hash,e=this._calculateElementHeight(ReactDOM.findDOMNode(this.refs[d]));a[c].containerHeight=e!==!1?e:a[c].containerHeight,a[c].needsRecalc=!1,a[c].recalcReady=!1}},_calculateElementHeight:function(a){if(!a)return 0;var b=document.defaultView.getComputedStyle(a,null),c=b.getPropertyValue("height");if("auto"==c)return!1;var d=parseFloat(b.getPropertyValue("height"),10),e=parseFloat(b.getPropertyValue("padding-top"),10)+parseFloat(b.getPropertyValue("padding-bottom"),10);return d+e},loadAll:function(){this.setState({all_loaded:!0,render_state:this.RENDER_STATE.PRE})},_createRenderedImage:function(a,b){var c=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},d=!1;this.props.initial||(d=0===b&&c.sessionAudioState===Imgur.VideoControls.AudioState.PRESENT_ON);var e={thumbsize:a.thumbsize,width:this.MAX_WIDTH,minHeight:a.minHeight,item:a,wrap_with_direct_link:!1,poster:!1,promoted:this.props.data.isAd||this.props.data.is_ad,showShareLinks:c.showShareLinks||this.props.has_access,discarding_referrer:!this.props.initial||b>=this.INITIAL_LOAD&&!a.shown,firing_pixel:!this.props.initial||b>=this.INITIAL_LOAD&&!a.shown,handleRemove:this.handleRemove,album_hash:this.props.data.hash,emitter:this.props.emitter,playAudioIfAvailable:d,handleVideoUpdate:this.handleVideoUpdate};return React.createElement(Imgur.ImageViewer,e)},_createComponent:function(a,b,c,d){var e=c==d-1,f=classNames({"post-image-container":!0,"post-image-container--spacer":!(e||this.props.has_access||a.title||a.description)}),g=classNames({"post-image-meta":a.title||a.description||this.props.showEditTools,"post-image-meta--last":e&&!this.props.showEditTools}),h=a.reactKey?a.reactKey:a.hash,i=2*c+2,j=2*c+3;return React.DOM.div({ref:h,id:a.hash,className:f,key:h},b,React.DOM.div({className:g},this.showTitles||a.title?React.createElement(Imgur.Gallery.TitleDesc,{postSavingStore:this.props.postSavingStore,element:"h2",type:"title",classes:"post-image-title",placeholder:"Image title",text:a.title,deletehash:a.deletehash,triggerSave:a.triggerSaveTitleDesc,max_length:this.MAX_NON_GALLERY_TITLE,no_enter:!0,dont_protect:!0,updateContainer:_.bind(this._setContainerHeightByIndex,this,c),showEditTools:this.props.showEditTools,tabindex:this.props.showEditTools?i:"",handleKeyDown:_.bind(this.editKeyHandler,this,i),key:"tabindex"+i,ref:"tabindex"+i}):null,React.createElement(Imgur.Gallery.DescriptionTagSuggestContainer,{postSavingStore:this.props.postSavingStore,tagStore:this.props.tagStore,element:"div",type:"description",classes:"post-image-description"+(this.props.showEditTools?" post-image-description--editable":""),placeholder:"Add a description #tags and @mention",text:a.description,deletehash:a.deletehash,triggerSave:a.triggerSaveTitleDesc,max_length:this.MAX_TEXTAREA,dont_protect:this.props.data.isAd||this.props.data.is_ad,linkify:!0,linkifier:this.props.linkifier,updateContainer:_.bind(this._setContainerHeightByIndex,this,c),showEditTools:this.props.showEditTools,tabindex:this.props.showEditTools?j:"",handleKeyDown:_.bind(this.editKeyHandler,this,j),key:"tabindex"+j,ref:"tabindex"+j})))},_getThumbSize:function(a){return a.prefer_video?"":"r"==this.state.thumb_size?a.width>2*this.MAX_WIDTH?"r":"":a.width>this.MAX_WIDTH?"g":""},handleRemove:function(a){this.props.album_image_store.deleteImage(this.props.data.hash,a),this.forceUpdate()},editKeyHandler:function(a,b){if(9==b.keyCode){b.shiftKey?a--:a++;var c=ReactDOM.findDOMNode(this.refs["tabindex"+a]);if(!c)return;b.preventDefault(),$("html, body").animate({scrollTop:c.offsetTop-200},100,function(){c.focus()})}},handleGridColorbox:function(a,b){$target=$(b.target),$target.colorbox({rel:"post-grid-image",href:$target.attr("data-href"),open:!0,scrolling:!1,maxWidth:"90%",maxHeight:"90%",className:"blurbox",title:$target.attr("data-title"),transition:"none",onOpen:function(){this.props.emitter.trigger("blockHotKeys",!0)}.bind(this),onClosed:function(){this.props.emitter.trigger("blockHotKeys",!1)}.bind(this)})},handleVideoUpdate:function(a,b,c,d,e,f){var g=this.props.album_image_store.getImage(a,b);g&&(g=_.assign({},g,{playState:c,audioState:d,volume:e,currentTime:f}),this.props.album_image_store.setImage(a,b,g))},handleAudioStateChange:function(a){this._.audioState=a},scrollToHash:function(a){if(this.props.data.is_album){var b=this.props.album_image_store.getImages(this.props.data.hash);if(b)for(var c=$(".post-header").offset().top,d=0;d<b.images.length;d++){if(b.images[d].hash==a||d+1==a){$("html, body").animate({scrollTop:c},350);break}c+=b.images[d].containerHeight,this.props.has_access&&!this.props.in_gallery&&(c+=this.ADD_IMAGE_ROW_HEIGHT)}}},render:function(){var a,b=this.props.album_image_store.getImages(this.props.data.hash),c=[],d=[],e=0,f=null,g=null,h=!1,i=this.getSessionAudioState(),j=this.props.has_access?null:React.DOM.div({className:"post-action"},React.createElement(Imgur.Gallery.PostActionBar,_.extend(this.props.data,{key:this.props.data.hash+"postactionbar",insideTagController:this.props.insideTagController,has_access:this.props.has_access,in_gallery:this.props.in_gallery,emitter:this.props.emitter,analytics:this.props.analytics,hide_points:this.props.hide_points,hide_views:this.props.hide_views,hide_tags:this.props.hide_tags,hide_report:this.props.hide_report,sideGallery:this.props.sideGallery,add_border:h,album_images:this.props.data.is_album?b.images:[]})));if(this.props.data.is_album&&b){e=b.count;var k=$(".post-images"),l=0,m=0,n=0,o=k.length?k.offset().top:0;if("rearrange"===this.state.gridType)return React.createElement(Imgur.Gallery.Grid,{album_image_store:this.props.album_image_store,postSavingStore:this.props.postSavingStore,deletehash:this.props.data.deletehash,hash:this.props.data.hash,thumbnail:this.props.data.album_cover,offset:o,mouseUp:this.props.rearrangeImages,allowRearrange:!0,gridImageClasses:"grab"});if("browse"===this.state.gridType)return React.DOM.div({},React.createElement(Imgur.Gallery.Grid,{album_image_store:this.props.album_image_store,postSavingStore:this.props.postSavingStore,deletehash:this.props.data.deletehash,hash:this.props.data.hash,thumbnail:this.props.data.album_cover,offset:o,mouseUp:this.handleGridColorbox,allowRearrange:!1,gridImageClasses:"pointer"}),j);var p=this.props.data.is_ad||this.props.data.isAd;this.state.all_loaded||p||(e=Math.min(e,this.INITIAL_LOAD));for(var q=0;q<e;q++){var r=b.images[q];if(r.minHeight&&!r.needsRecalc||(!r.animated&&r.width>this.MAX_WIDTH?r.thumbsize=this._getThumbSize(r):r.thumbsize="",r.minHeight=this._scaleWidth(r.width,r.height,this.MAX_WIDTH)),p||this.state.render_state==this.RENDER_STATE.PRE)p||q<this.INITIAL_LOAD?(a=this._createRenderedImage(r,q,{showShareLinks:!1,sessionAudioState:i}),r.shown=!0):a=React.DOM.div({ref:r.hash,style:{minHeight:r.minHeight}}),c.push(this._createComponent(r,a,q,e));else{if("number"!=typeof r.containerHeight||r.needsRecalc){a=this._createRenderedImage(r,q,{sessionAudioState:i}),d.push(this._createComponent(r,a,q,e)),r.recalcReady=!0;continue}var s=this.state.scrolltop-this.state.window_height,t=this.state.scrolltop+2*this.state.window_height,u=o+l+m,v=u+r.containerHeight,w=this.props.has_access&&!this.props.in_gallery&&q!=e-1;u>s&&u<t||v>s&&v<t||u<s&&v>t?(m+=r.containerHeight,a=this._createRenderedImage(r,q,{sessionAudioState:i}),r.shown=!0,c.push(this._createComponent(r,a,q,e)),w&&this.props.addImage&&c.push(React.DOM.label({key:"add-between-"+(q+1),htmlFor:"add-between"},React.DOM.div({key:"addimage"+q,className:"post-add-image between",onClick:function(a){this.props.addImage(a)}.bind(this,q+1)},React.DOM.div({className:"tear"}),React.DOM.div({className:"icon-plus"}))))):0==m?l+=r.containerHeight+(w?this.ADD_IMAGE_ROW_HEIGHT:0):n+=r.containerHeight+(w?this.ADD_IMAGE_ROW_HEIGHT:0)}h=!!(r.description||r.title||b.count>this.INITIAL_LOAD&&e==this.INITIAL_LOAD)}d.length>0&&(this.updatingState=!0),!p&&!this.state.all_loaded&&b.count>this.INITIAL_LOAD&&(f=React.DOM.div({className:"js-post-truncated"},React.DOM.a({className:"post-loadall btn btn-action",onClick:this.loadAll},"Load "+(b.count-this.INITIAL_LOAD)+" more "+Imgur.Util.pluralize(b.count-this.INITIAL_LOAD,"image")),React.DOM.span({className:"post-gridview"},React.DOM.span({className:"icon-grid"}),React.DOM.a({className:"post-gridview-link",target:"_blank",href:"/a/"+this.props.data.hash+"?grid"},"Grid view")))),this.props.data.album_description&&(g=React.createElement(Imgur.Gallery.TitleDesc,{postSavingStore:this.props.postSavingStore,element:"div",type:"description",classes:"post-description",placeholder:"Add a post description",text:this.props.data.album_description,is_album:!0,deletehash:this.props.data.deletehash,max_length:this.MAX_TEXTAREA,dont_protect:this.props.data.isAd||this.props.data.is_ad,linkify:!0,linkifier:this.props.linkifier,showEditTools:this.props.showEditTools,tabindex:this.props.showEditTools?2*e+2:""}));for(var q=0;l>=1e6;q++)c.unshift(React.DOM.div({key:"padtop"+q,style:{height:1e6}})),l-=1e6;c.unshift(React.DOM.div({key:"padtop",style:{height:l}})),c.push(React.DOM.div({key:"padbot",style:{height:n}}))}else{var x=0,y=2;if(this.props.data.width>this.MAX_WIDTH){var z=this.MAX_WIDTH/this.props.data.width;x=this.props.data.height*z}else x=this.props.data.height||0;var A=function(){humanMsg.displayMsg("Deleted"),setTimeout(function(){window.location=Imgur.Environment.auth.url?"//"+Imgur.Environment.auth.url+"."+Imgur.Environment.host:"/"},1e3)};a=React.createElement(Imgur.ImageViewer,{emitter:this.props.emitter,thumbsize:this._getThumbSize(this.props.data),minHeight:x,width:this.MAX_WIDTH,promoted:this.props.data.isAd||this.props.data.is_ad,item:this.props.data,wrap_with_direct_link:!1,poster:!1,showShareLinks:this.props.has_access,discarding_referrer:!this.props.initial,firing_pixel:!this.props.initial,singleImage:!0,handleRemove:A,playAudioIfAvailable:i===Imgur.VideoControls.AudioState.PRESENT_ON});var B=React.DOM.div({id:this.props.data.hash,className:"post-image-container",key:this.props.data.hash},a,React.DOM.div({className:this.props.data.description||this.props.showEditTools?"post-image-meta":""},React.createElement(Imgur.Gallery.DescriptionTagSuggestContainer,{postSavingStore:this.props.postSavingStore,tagStore:this.props.tagStore,element:"div",type:"description",classes:"post-image-description",placeholder:"Image description",text:this.props.data.description,deletehash:this.props.data.deletehash,max_length:this.MAX_TEXTAREA,dont_protect:this.props.data.isAd||this.props.data.is_ad,linkify:!0,showEditTools:this.props.showEditTools,tabindex:this.props.showEditTools?y:"",handleKeyDown:_.bind(this.editKeyHandler,this,y),autoSuggestTags:!0,key:"tabindex"+y,ref:"tabindex"+y,updateContainer:_.bind(this.updateTagsFromText,this,0)})));c.push(B)}var C=this.props.has_access&&this.props.addImage&&!this.props.in_gallery?React.DOM.div({onClick:this.props.addImage.bind(null,b.images.length),className:"post-add-image end"},React.DOM.span({className:"icon-plus"}),React.DOM.span(null,"Add another image")):null;return React.DOM.div({},c,d,f,g,C,j)}}),Namespace("Imgur.Gallery.TitleDesc"),Imgur.Gallery.TitleDesc=React.createClass({displayName:"TitleDesc",TYPING_SPEED:500,savedRequest:null,getDefaultProps:function(){return{linkifier:{grab:function(a){return a}}}},getInitialState:function(){return{savedText:this.props.text}},placeCaretAtEnd:function(a){if(a.focus(),"undefined"!=typeof window.getSelection&&"undefined"!=typeof document.createRange){var b=document.createRange();b.selectNodeContents(a),b.collapse(!1);var c=window.getSelection();c.removeAllRanges(),
c.addRange(b)}else if("undefined"!=typeof document.body.createTextRange){var d=document.body.createTextRange();d.moveToElementText(a),d.collapse(!1),d.select()}},handlePaste:function(a){a.preventDefault();var b="";a.clipboardData?b=a.clipboardData.getData("Text"):window.clipboardData&&(b=window.clipboardData.getData("Text")),b=Imgur.Util.htmlEntity(b),this.props.linkify&&!this.props.dont_protect&&(b=Imgur.Util.linkify(b,!0,!0,!0)),this.insertText(b)},insertText:function(a){var b,c;if(window.getSelection&&(b=window.getSelection(),b.getRangeAt&&b.rangeCount)){c=b.getRangeAt(0),c.deleteContents();var d=document.createElement("div");d.innerHTML=a;for(var e,f,g=document.createDocumentFragment();e=d.firstChild;)f=g.appendChild(e);c.insertNode(g),f&&(c=c.cloneRange(),c.setStartAfter(f),c.collapse(!0),b.removeAllRanges(),b.addRange(c)),this._save(!1,this.TYPING_SPEED)}},handleKeyDown:function(a){var b=a.which||a.keyCode;this.props.no_enter&&13==b&&(this.refs.text.blur(),window.getSelection().removeAllRanges()),this.props.handleKeyDown&&this.props.handleKeyDown(a)},_save:function(a,b,c){var d=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;if(this.props.deletehash&&(!c||9!=c.keyCode)){var e=this.refs.text,f=e.textContent.length,g={is_album:this.props.is_album};clearTimeout(this.typingTimer),f>this.props.max_length&&(e.textContent=e.textContent.substring(0,this.props.max_length),this.placeCaretAtEnd(e));var h=document.createElement("div");h.innerHTML=e.innerHTML.replace(/(<div>|<p>)(.+?)(<br\s*[\/]?>)?(<\/p>|<\/div>)/gi,"\n$2").replace(/<br\s*[\/]?>/gi,"\n");var i=h.textContent.trim();if(a&&this.props.linkify&&!this.props.dont_protect&&(e.innerHTML=Imgur.Util.linkify(Imgur.Util.htmlEntity(i),!0,!0,!0,"postDescription")),i==this.state.savedText)return void this.props.postSavingStore.remove(this.props.deletehash,this.props.type);this.props.postSavingStore.add(this.props.deletehash,this.props.type),"function"==typeof this.props.updateContainer&&this.props.updateContainer(this.props.type,i),g[this.props.type]=i,this.typingTimer=setTimeout(_.bind(function(){this.savedRequest&&this.savedRequest.abort(),this.savedRequest=$.ajax({url:"/ajax/titledesc/"+this.props.deletehash,method:"POST",data:g,success:function(){this.props.postSavingStore.remove(this.props.deletehash,this.props.type),this.savedRequest=null,this.setState({savedText:i})}.bind(this),error:function(a,c){return a.responseJSON&&a.responseJSON.data.error?(this.savedRequest=null,clearTimeout(this.typingTimer),humanMsg.displayMsg(a.responseJSON.data.error,"error-msg")):void("abort"!=c&&(3==d&&humanMsg.displayMsg("Saving is taking longer than expected. We're still trying!","error-msg"),this._save(!1,Math.pow(2,d)*b,null,d+1)))}.bind(this)})},this),b)}},shouldComponentUpdate:function(a,b){return this.props.text!=a.text&&!this.props.showEditTools},componentDidUpdate:function(a){if(this.refs.text){var b=this.props.deletehash?this.refs.text.textContent.length:0;a.triggerSave!=this.props.triggerSave&&0!==b&&this._save(!1,this.TYPING_SPEED)}},render:function(){var a=this.props.text;if(a&&!this.props.dont_protect&&(a=Imgur.Util.htmlEntity(a),this.props.linkify&&(a=Imgur.Util.linkify(a,!0,!0,!0,"postDescription"))),this.props.showEditTools&&!this.props.published){var b={className:this.props.classes+" post-contenteditable",contentEditable:!0,tabIndex:this.props.tabindex,placeholder:this.props.placeholder,ref:"text",onInput:_.partial(this._save,!1,this.TYPING_SPEED),onBlur:_.partial(this._save,!0,0),onPaste:this.handlePaste,dangerouslySetInnerHTML:{__html:a},onKeyDown:this.handleKeyDown,onKeyUp:this.props.onKeyUp};return React.createElement(this.props.element,b)}return!!a&&React.createElement(this.props.element,{className:this.props.classes,dangerouslySetInnerHTML:{__html:a}})}}),Namespace("Imgur.Gallery.TagSuggest"),Imgur.Gallery.TagSuggest=React.createClass({displayName:"TagSuggest",MAX_HEIGHT:223,ROW_HEIGHT:40,getDefaultProps:function(){return{onHighlightedKeyDown:function(){},classNames:"",query:""}},getInitialState:function(){return{highlightedTag:null,mouseOverTag:!1}},componentDidMount:function(){document.addEventListener("keydown",this.handleKeyDown),this.updatePosition()},componentWillUnmount:function(){document.removeEventListener("keydown",this.handleKeyDown)},componentWillReceiveProps:function(a){JSON.stringify(this.props.suggestedTags)!==JSON.stringify(a.suggestedTags)&&this.setState({highlightedTag:null})},componentDidUpdate:function(a){this.props.left!==a.left&&this.updatePosition()},highlightedTagIndex:function(){return this.props.suggestedTags.map(function(a){return a.tag}).indexOf(this.state.highlightedTag)},handleKeyDown:function(a){if([38,40,13].indexOf(a.which)==-1)return void(this.state.mouseOverTag||this.setState({highlightedTag:null}));a.preventDefault();var b=this.highlightedTagIndex(),c=void 0;38==a.which&&(c=this.props.suggestedTags[Math.max(b-1,0)].tag,this.setState({highlightedTag:c}),this.props.onHighlightedKeyDown(c)),40==a.which&&(c=this.props.suggestedTags[Math.min(b+1,this.props.suggestedTags.length-1)].tag,this.setState({highlightedTag:c}),this.props.onHighlightedKeyDown(c)),13==a.which&&this.state.highlightedTag&&this.props.onSelect(this.state.highlightedTag)},updatePosition:function(){this.refs.suggest.style.top=this.props.top+30+"px",this.refs.suggest.style.left=this.props.left-15+"px"},mouseEnter:function(a){this.setState({highlightedTag:a,mouseOverTag:!0})},mouseLeave:function(){this.setState({highlightedTag:null,mouseOverTag:!0})},mouseDown:function(a,b){b.preventDefault(),this.props.onSelect(a)},renderTagRow:function(a){return React.createElement("tr",{className:"tag pointer"+(this.state.highlightedTag==a.tag?" tag-suggest-highlighted":""),onMouseDown:this.mouseDown.bind(this,a.tag),onMouseEnter:this.mouseEnter.bind(this,a.tag),onMouseLeave:this.mouseLeave,key:a.tag},React.createElement("td",{className:"tag-suggest-left"},a.tag),React.createElement("td",{className:"tag-suggest-right"},a.images," ",Imgur.Util.pluralize(a.images,"post")))},render:function(){var a=this,b=void 0;if(this.props.error)b=React.createElement("p",{className:"tag-suggest-error"},this.props.error);else{var c=this.props.suggestedTags?this.props.suggestedTags.length:0,d=Math.min(c*this.ROW_HEIGHT,this.MAX_HEIGHT),e=void 0;if(0===c&&this.props.query.length>0)e=React.createElement("p",{key:"noresults",className:"tag-suggest-noresults"},"Sorry no results");else{if(!(c>0))return React.createElement("span",{ref:"suggest"});e=React.createElement(Imgur.Nanoscroll,{key:"nanoscroller",options:{preventPageScrolling:!0},contentClassNames:"scroll-content",contentStyle:{height:d},nanoStyle:{height:d}},React.createElement("table",null,React.createElement("tbody",null,this.props.suggestedTags.map(function(b){return a.renderTagRow(b)}))))}b=Imgur.Environment.auth.isLoggedIn&&0===this.props.query.length?[React.createElement("div",{key:"header",className:"tag-suggest-header"},"RECENT TAGS"),e]:[React.createElement("div",{key:"header",className:"tag-suggest-header"},"POPULAR ON IMGUR"),e]}return React.createElement("div",{ref:"suggest",className:"tag-suggest "+this.props.classNames},b)}});var _extends=Object.assign||function(a){for(var b=1;b<arguments.length;b++){var c=arguments[b];for(var d in c)Object.prototype.hasOwnProperty.call(c,d)&&(a[d]=c[d])}return a};Namespace("Imgur.Gallery.DescriptionTagSuggestContainer"),Imgur.Gallery.DescriptionTagSuggestContainer=React.createClass({displayName:"DescriptionTagSuggestContainer",TRANSITION_TIMEOUT:150,TAG_SUGGEST_CARRET_DISTANCE_FROM_LEFT:30,getInitialState:function(){return{showingSuggestions:!1,suggestKeyword:null,suggestedTags:[],query:""}},componentDidMount:function(){this.textNode=ReactDOM.findDOMNode(this.refs.text),document.addEventListener("click",this.handleClickOutside,!0)},componentWillUnmount:function(){document.removeEventListener("click",this.handleClickOutside,!0)},handleClickOutside:function(){this.state.showingSuggestions&&this.refs.wrapper&&!this.refs.wrapper.contains(event.target)&&this.hideSuggestions()},tagSelected:function(a){var b=window.getSelection().getRangeAt(0),c=b.startContainer.textContent.substring(0,this.getCaretPosition()).split("#").pop().length,d=b.cloneRange();d.setStart(b.startContainer,b.startOffset-c),d.setEnd(b.startContainer,b.startOffset),d.deleteContents(),this.refs.text.insertText(a+" "),this.setState({showingSuggestions:!1})},handleKeyUp:function(a){if(this.xhr&&this.xhr.abort(),27==a.which)return void this.setState({showingSuggestions:!1});var b=this.getCaretPosition(),c=window.getSelection().getRangeAt(0).startContainer.textContent.substring(0,b).replace(/\n/g," ").split(" ").pop();if("#"==c.substring(0,1)){var d=c.split("#").pop().substr(1);this.fetchSuggestions({updateCoords:!this.state.showingSuggestions,keyword:d}),this.setState({query:d})}else this.setState({showingSuggestions:!1,query:""})},fetchSuggestions:function(){var a=this,b=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},c=this.getCaretPosition(),d=window.getSelection().getRangeAt(0).startContainer.textContent.substring(0,c).replace(/\n/g," ").split(" ").pop().substr(1),e=b.updateCoords?this.getSelectionCoords():{y:this.state.cursorTop,x:this.state.cursorLeft};this.props.tagStore.getSuggestions(d,function(b){a.setState({suggestedTags:a.formatTagSuggestionResponse(b),showingSuggestions:!0,cursorTop:e.y,cursorLeft:e.x})})},formatTagSuggestionResponse:function(a){return a?a.map(function(a){return a.tag=a.tag.replace(" ","_"),a}):a},getCaretPosition:function(){var a,b,c=this.textNode,d=0;return window.getSelection&&(a=window.getSelection(),a.rangeCount&&(b=a.getRangeAt(0),b.commonAncestorContainer.parentNode==c&&(d=b.endOffset))),d},getSelectionCoords:function(a){a=a||window;var b,c,d,e=a.document,f=e.selection,g=0,h=0;return f?"Control"!=f.type&&(b=f.createRange(),b.collapse(!0),g=b.boundingLeft,h=b.boundingTop):a.getSelection&&(f=a.getSelection(),f.rangeCount&&(b=f.getRangeAt(0).cloneRange(),b.getClientRects&&(b.collapse(!0),c=b.getClientRects(),c.length>0&&(d=c[0]),g=d.left,h=d.top))),{x:g,y:h}},hideSuggestions:function(){this.setState({showingSuggestions:!1})},render:function(){return React.createElement("div",{ref:"wrapper"},React.createElement(Imgur.Gallery.TitleDesc,_extends({ref:"text",onKeyUp:this.handleKeyUp},this.props)),React.createElement(React.addons.CSSTransitionGroup,{transitionName:"suggest",transitionEnterTimeout:this.TRANSITION_TIMEOUT,transitionLeaveTimeout:this.TRANSITION_TIMEOUT},this.state.showingSuggestions&&this.state.suggestedTags.length>0?React.createElement(Imgur.Gallery.TagSuggest,{ref:"suggest",onSelect:this.tagSelected,left:this.state.cursorLeft-this.TAG_SUGGEST_CARRET_DISTANCE_FROM_LEFT,top:this.state.cursorTop+$(document).scrollTop(),showingSuggestions:this.state.showingSuggestions,unmount:this.hideSuggestions,suggestedTags:this.state.suggestedTags,query:this.state.query}):null))}}),Namespace("Imgur.Gallery.Store.Saving"),Imgur.Gallery.Store.Saving=Class.extend({init:function(a){this._={posts:{},saving:0,emitter:a}},add:function(a,b){this._.posts[a+b]||(0==this._.saving&&(window.onbeforeunload=function(){return"Your updates are still saving. Are you sure you want to leave?"}),this._.posts[a+b]=!0,this._.saving++,this._.emitter.trigger("saving"))},remove:function(a,b){this._.posts[a+b]&&(this._.posts[a+b]=!1,this._.saving--,0==this._.saving&&(window.onbeforeunload=null,this._.emitter.trigger("saved")))}}),Namespace("Imgur.Gallery.Store"),Imgur.Gallery.Store.Tag=Class.extend({init:function(a,b,c){this._={queries:{},pendingRequestUrl:null,tags:[],maxTags:a,tagValidator:b,emitter:c}},getTagValidator:function(){return this._.tagValidator},getTags:function(){return this._.tags},addTag:function(a,b,c){if(this._.maxTags&&this._.tags.length>=this._.maxTags)return c(!1,this._.maxTags+" limit reached");var d=a.toLowerCase().replace("_"," "),e=this.isTagExists(d);if(!this._.tagValidator.isValidTag("submit",a,e))return c(!1,this._.tagValidator.whyNot("submit",a,e));var f={tagName:a,tagNameNormalized:d,addedVia:b};this._.tags.push(f),this._.emitter.trigger("tagAdded",f);var g="Hashtag";return"tagModule"===b&&(g="Picker"),Imgur.Util.jafoLogEvent(Imgur.AnalyticCategories.CREATION,Imgur.AnalyticEventNames.tagAdded,{Identifier:a,Method:g}),c(!0,null)},removeTag:function(a){for(var b=[],c=void 0,d=0;d<this._.tags.length;d++)this._.tags[d].tagName!==a?b.push(this._.tags[d]):c=this._.tags[d];c&&(this._.tags=b,this._.emitter.trigger("tagRemoved",c))},flushTags:function(){for(var a=0;a<this._.tags.length;a++)this.removeTag(this._.tags[a].tagName)},getSuggestions:function(a,b){var c=this._.queries[a]?this._.queries[a]:null;return c?b(c):this.fetchSuggestions(a,b)},setSuggestions:function(a,b){this._.queries[a]=b},fetchSuggestions:function(a,b){var c="//"+Imgur.Environment.host+"/ajax/suggest_tags";this.xhr&&this.xhr.abort(),this.xhr=$.ajax({method:"GET",url:c,data:{q:a,size:10},success:function(c){for(var d=[],e=a.toLowerCase(),f=!0,g=0;g<c.data.length;g++)d.push({tag:c.data[g].tag,images:c.data[g].images}),c.data[g].tag===e&&(f=!1);f&&this._.tagValidator.isValidTag("submit",a,!1)&&d.push({tag:a,images:0}),this.setSuggestions(a,d),this.getSuggestions(a,b)}.bind(this)})},isTagExists:function(a){return this._.tags.some(function(b){return b.tagNameNormalized===a})}}),Namespace("Imgur.Factory"),Imgur.Factory.Gallery=Class.extend({_getDefaultPredicates:function(a){var b=function(b){return b instanceof a},c=function(a){return function(a){return a instanceof Imgur.Tag.SuggestedTag}};return{base:b,providerByLevDistance:c}},_getAjaxGetWithLoader:function(a){return function(b,c,d,e){return a.show(),e=e||_.noop,d=d||_.noop,$.get(b,c,d).fail(e).always(_.bind(a.hide,a))}},_standardDataResponsePost:function(a){return function(b,c,d,e){e=e||_.noop,d=d||_.noop;var f=function(a,b,c){a&&a.success||!a&&"success"===b?d(a,b,c):e(a&&a.data&&a.data.error&&a.data.error.message||a&&a.data&&a.data.error||b,c,b)},g=function(a,b,c){var d=c;try{var f=a.responseJSON||$.parseJSON(a.responseText);return void e(f.data.error.message,a,b)}catch(g){}e(d,a,b)};return a(b,c,f,g)}},_getStandardPostAuthorized:function(){return this._standardDataResponsePost(this._.postProvider())},_getStandardPostAuthorizedWithLoader:function(a){var b=this._standardDataResponsePost(this._.postProvider());return function(c,d,e,f){return a.show(),b(c,d,e).always(_.bind(a.hide,a))}},_getPostAuthorizedWithLoader:function(a){var b=this._.postProvider();return function(c,d,e,f){return a.show(),b(c,d,e).always(_.bind(a.hide,a))}},_produceEmptyMessageProviderForQuery:function(a){return function(){return _.templates["tags.empty-message-makeone"]({query:a})}},_produceUserGroupProvider:function(a,b,c,d,e,f){var g=new Imgur.Tag.Comparator,h=(_.bind(g.compare,g),_.bind(this._produceUserGroupController,this,a,b,c,d,e,f)),i=_.bind(this._produceUserGroupFromData,this,g),j=_.bind(this._produceUserGroupFromDom,this,h,g,a),k=_.compose(j,i);return k},_produceUserGroupController:function(a,b,c,d,e,f,g,h){return new Imgur.Tag.Controller.UserGroup(a,b,c,g,h,d,e,f)},_produceUserGroupFromData:function(a,b,c,d){return $(_.templates["tags.user-group"]({group:{name:b,hash:c}}))},_produceUserGroupFromDom:function(a,b,c,d,e){var f=new Imgur.Element.SortedListEmptyable($(),b,e||[]),g=new Imgur.Tag.UserGroup(d,f),h=a(g,f);return g.get$RemoveButton().on("click",_.bind(h.handleRemoveEvent,h)),c.on("group.remove",h,h.handleRemoveEventOther),{group:g,adapter:h}}}),Namespace("Imgur.Factory"),Imgur.Factory.InsideGallery=Imgur.Factory.Gallery.extend({init:function(a,b,c,d){this._={parent_factory:a,env:b,gallery_env:b,groups:c,postProvider:d,stores:{},header:null}},produceInsideGallery:function(a){var b,c=Imgur.Environment.hasAccess&&!Imgur.Environment.captionsEnabled,d=new Imgur.Tag.TagValidator(Imgur.Constants.MIN_TAG_LENGTH,Imgur.Constants.MAX_TAG_LENGTH),e=new Imgur.Gallery.Store.Tag(Imgur.Constants.MAX_TAGS_PER_POST,d,a),f=this._.env,g=$("#side-gallery");if(c){if(g.remove(),!Imgur.Environment.image.is_album){var h={initialHash:Imgur.Environment.image.hash,initialIsPublished:Imgur.Environment.image.in_gallery,emitter:a,deletehash:Imgur.Environment.image.deletehash,isAlbum:Imgur.Environment.image.is_album,image:Imgur.Environment.image,tagStore:e};b=ReactDOM.render(React.createElement(Imgur.PostOptions,h),document.getElementById("post-options"))}}else{var i=Imgur.Experiments.getUserBucket("expT4377b"),j=i&&i.variation,k={env:f,variation:j,cache:Imgur.Environment.signed?"/miss.json":"/hit.json",votedFavedRecently:Imgur.Environment.votedFavedRecently,showMature:Imgur.Environment.auth.show_mature,emitter:a};if(b=ReactDOM.render(React.createElement(Imgur.SideGallery,k),g[0]),"control"!=j&&Imgur.Experiments.isActive("expT4377b")){var l=ReactDOM.render(React.createElement(ImgurRecommendations,{variation:j,sideGallery:b,host:Imgur.Environment.host}),$("#recommendations")[0]);b.recommendations=l}}var m=navigator.userAgent.match(/iPad/i),n=this._.parent_factory.produceLinkify(a);n.addGrabber(new Imgur.Linkify.AlbumImageGrabber);var o=new Imgur.Linkify.AlbumImageViewer(f.hash);n.prependViewer("albumimage",o),a.on("select",o,o.handleUpdatedImage),a.trigger("beforeComments",this._.gallery_env.image);var p=new Imgur.Caption({sid:this._.env.sid,signed:this._.env.signed,auth_id:this._.env.auth.id,hash:f.hash,baseURL:f.baseURL,defaultText:"Submit a ",commentName:f.commentName,target:$("#submit-caption"),loadingClass:"#save-caption-loader",isReply:!1,isIPad:m,showRepliesCount:!0,emitter:a});n.prependViewer("nsfw",new Imgur.Linkify.NSFWViewer(p)),Imgur.Caption._instance=p;var q=new Imgur.Store.AlbumImage,r=new Imgur.Gallery.Store.Saving(a),s=void 0,t=["AT","BE","BG","HR","CY","CZ","DK","EE","FI","FR","DE","GR","HU","IE","IT","LV","LT","LU","MT","NL","NO","PL","PT","RO","SK","SI","ES","SE","CH","GB"];s=!Imgur.Environment.adsEnabled||Imgur.Environment.hasPaid||Imgur.Environment.subscription.isSubscribed?new NoAdSlots(window.runSlots.config):window.usesABP?new BlockthroughSlots(window.runSlots.config):t.includes(Imgur.Environment.countryCode)?new YieldloveSlots(window.runSlots.config):new SmartSlots(window.runSlots.config);var u=this.produceInsideNav(a,b,p,f,n,q,r,e,s);Imgur.InsideNav._instance=u;var v=new Imgur.Gallery.Inside(u,a,f);Imgur.Gallery._instance=v,a.on("report image",v,v.reportImage),Imgur.Environment.adsEnabled&&this.producePromoted(a,u,b),n.attachDelegate("#comments-container");var w={showEditTools:c,initialImage:Imgur.Environment.image,emitter:a,postSavingStore:r},x=!1;if(Imgur.Environment.image.is_album){var y=10,z=Imgur.Environment.image.album_images.images.length,A=z-1;if(A>-1){var B=Imgur.Environment.image.album_images.images[A];x=!!(B.title||B.description||Imgur.Environment.image.album_images.count>y&&z==y)}}else x=!!Imgur.Environment.image.description;var C=_.extend({},Imgur.Environment.image,{in_gallery:Imgur.Environment.captionsEnabled||Imgur.Environment.image.isAd&&Imgur.Environment.image.in_gallery,has_access:Imgur.Environment.hasAccess,emitter:a,sideGallery:b,hide_points:Imgur.Environment.image.isAd||Imgur.Environment.image.ad_type>0,hide_views:Imgur.Environment.image.isAd||Imgur.Environment.image.ad_type>0,hide_report:Imgur.Environment.auth.url===Imgur.Environment.image.account_url||Imgur.Environment.image.isAd,add_border:x,album_images:Imgur.Environment.image.is_album?Imgur.Environment.image.album_images.images:[]});this._.header=ReactDOM.render(React.createElement(Imgur.Gallery.Header,w),$(".post-header").get(0)),ReactDOM.render(React.createElement(Imgur.Gallery.PostActionBar,C),$(".post-action").get(0));var D=!0;return a.on("select",null,function(a,b,c,d){return!!this._.header&&(this._.header.setState({image:a,first:!1,last:!1,initial:D,navTrigger:d}),void(D=!1))}.bind(this)),v},produceInsideNav:function(a,b,c,d,e,f,g,h,i){var j=new Imgur.InsideNav(b,c,a,f,g,h,i,_.merge(d,{isPromoted:d.image.isAd||d.image.is_ad,el:{inside:{reportImageLink:$("#report-image"),image:$(".image"),arrows:$(".image-arrows"),zoom:$(".zoom"),accountBio:$("#account-bio.access"),submitCaptionButton:$(".submit-caption-button"),commentExpand:$("#expand-comments"),comboboxes:$(".combobox"),commentSort:$("#comment-sort"),$comments:$("#captions"),favoriteImageLink:$(".favorite-image"),reCaptionLink:$("#meme-image"),downloadAlbumForm:{id:"#download-album-form",emailInput:$("#download-album-form #email"),form:$("#download-album-form #download-form"),message:$("#message"),save:$("#download-album-form #save"),loader:$("#download-loader")}}},linkifier:e}));return a.on("imageRendered",null,function(a,c){a.click(function(a){a.preventDefault(),b.selectImage(c.hash)})}),a.on("reset",null,function(a){b.selectImage(a.hash)}),a.on("select",j,j.navToImage),a.on("firstImage",j,function(a){return!!this._.header&&void this._.header.setState({first:!0,last:!1})}.bind(this)),a.on("lastImage",j,function(a){return!!this._.header&&void this._.header.setState({first:!1,last:!0})}.bind(this)),a.on("sectionChange",j,j.changeSection),a.on("sortChange",j,j.changeSort),a.on("windowChange",j,j.changeWindow),a.on("sidegalleryPageLoad",null,_.bind(function(a){switch(a){case"append":j.enableNextButton();break;case"prepend":j.enablePrevButton()}},this)),j},producePromoted:function(a,b,c){if("undefined"==typeof Imgur.getInstance()._.auth||Imgur.getInstance()._.auth.isPro!==!0){var d=this._.parent_factory.getConfig("promoted"),e=new Imgur.Promoted.Events(a,b),f=new Imgur.Promoted.Source.Adzerk(d,a),g=new Imgur.Promoted(d,a,b,c,e,f,Imgur.Gallery.getInstance()._.safe_tags,Imgur.Environment,Imgur.Util.jafoLog);return g}}}),Namespace("Imgur.Factory"),Imgur.Factory.OutsideGallery=Imgur.Factory.Gallery.extend({init:function(a,b,c,d,e){this._={env:{global:a,gallery:b,groups:c},gallery_env:b,postProvider:d,getProvider:e}},produceOutsideGallery:function(a){var b=new Imgur.Tag.Store.OutsideActiveTag(a),c=new Imgur.History,d=this._.env.gallery,e=new Imgur.Gallery.MainOutside(b,a,d,c);return a.on("show tagset loader",e,e.fadeInLoader),a.on("hide tagset loader",e,e.fadeOutLoader),a.on("new tagset",e,e.refetchPage),a.on("new outside active tag",e,e.handleTagChanged),$("#imagelist").on("click",".remove-outside-image",function(a){var b=$(a.target).attr("data-hash");e.remove(b),$("#"+b).fadeOut()}),$("#imagelist").on("click",".scroll-top-text",function(a){$("html, body").animate({scrollTop:0},"500","easeInOutCirc")}),$("#sponsored-upload").click(_.bind(function(){if(this._.env.gallery.signed)$("#topbar li.upload-button").click();else{var a=new Imgur;a.signin("Action - Sponsored Upload",!0)}},this)),c.addPopState("initial",_.bind(e.initialPopState,e)),Imgur.Gallery._instance=e,{gallery:e,history:c,outsideActiveTagStore:b}},produceOutsideUser:function(a){var b=this._.env.gallery,c=new Imgur.Gallery.Outside(a,b);return Imgur.Gallery._instance=c,c},produceOutsideMemes:function(a){var b=this._.env.gallery,c=new Imgur.Gallery.Outside(a,b);return Imgur.Gallery._instance=c,c},sectionMenuOpened:function(){Imgur.Util.jafoLog({event:"galleryTopicScreenDisplayed",meta:{}})},produceOutsideNonMainSectionChooser:function(a){$("#section").combobox({maybe:function(a,b,c){return!1}}),$("#section").on("open",this.sectionMenuOpened.bind(this)),$("#sort").combobox();var b=null;new Imgur.Tag.GroupSelector(a,this._.env.gallery.section,this._.env.gallery.sort,this._.env.gallery.searchQuery,$(".sentence-sorting"),b)},produceOutsideTaggingWidget:function(a,b){var c=(this._.env.gallery.sid,this._.env.gallery.signed),d=(this._.env.gallery.group,this._.env.gallery.group_type),e=new Imgur,f=function(a){a.preventDefault(),a.stopPropagation(),e.signin("Action - Tag",!0)},g=$("#outside-tagging"),h=$("#content .panel"),i=$("#outside-tagging-showhide");$("#section").combobox({maybe:function(a,b,c){return!1}}),$("#section").on("open",this.sectionMenuOpened.bind(this)),$("#sort").combobox({maybe:function(a,b,c){return!1},onChange:function(b,c,d){a.trigger("chosen.sort",c,d)}});var j=new Imgur.Tag.Store.Tag(a),k=new Imgur.Tag.Store.TagGroup(a),l=new Imgur.Tag.Store.Group(a,this._.env.groups.groups),m=new Imgur.Tag.GroupModel(this._getStandardPostAuthorized(),k,a),n=new Imgur.Tag.TagValidator(Imgur.Constants.MIN_TAG_LENGTH,Imgur.Constants.MAX_TAG_LENGTH),o=new Imgur.Tag.Store.Suggestion(a,n);Imgur.Dev.DebugVar("suggestionstore",o);var p=this._.env.gallery.group.id;_.each(this._.env.gallery.group.tags,function(a){k.addTagToGroup(a,p)}),Imgur.Dev.DebugVar("tagGroupStore",k),Imgur.Dev.DebugVar("outsideActiveTagStore",b.outsideActiveTagStore),Imgur.Dev.DebugVar("tagstore",j),Imgur.Dev.DebugVar("groupstore",l),Imgur.Dev.DebugVar("taggroupstore",k);var q=function(){var a=$("script[type='text/tag-group-data']");a.each(function(){var a={};try{a=$.parseJSON($(this).html())}catch(b){}_.each(a,function(a,b){_.each(a,function(a){k.isTagInGroup(b,a)||k.addTagToGroup(b,a)})}),$(this).remove()})};q();var r=function(){var a=$("script[type='text/tag-data']");a.each(function(){var a=null;try{a=$.parseJSON($(this).html())}catch(b){}a&&j.addTag(a),$(this).remove()})};r(),a.on("new gallery page",null,r);var m=this._produceGroupModel(a,k),s=_.bind(function(){0==k.getTagsForGroup(p).length&&"base"!=d?this._produceEmptyGalleryTagList(a,k,b.outsideActiveTagStore,o,m):this._produceUserTagList(a,k,b.outsideActiveTagStore,o,m)},this);"group"!=this._.env.gallery.section&&"custom"!=this._.env.gallery.section||"base"==d||(s(),a.on("gallery page refetched",null,s));var t=new Imgur.Tag.OutsideTaggingWidget(g,h,i,a);i.on("click",_.bind(t.toggle,t,this._.env.gallery.bestCaps));var u=$(".sentence-sorting"),v=(new Imgur.Tag.GroupValidator(2,25),new Imgur.Tag.Sentence(u.find(".before-text"),u.find(".middle-text"),l)),w=new Imgur.Tag.MainGroupSelector(a,this._.env.gallery.section,this._.env.gallery.sort,this._.env.gallery.inSearch,u,v,b.outsideActiveTagStore);if(b.history.addPopState("tag",function(a){var c=window.location.href.replace(/.*\/t\//i,"").replace(/_/g," ");b.outsideActiveTagStore.setActiveTag(c,!0)}),this._.env.gallery.bestCaps&&$("#top-comments .best-captions img").tipsy({opacity:.95,offset:-2,gravity:"n",html:!0}),!c)return void $("#custom-group a").on("click",f);var x=new Imgur.Tag.Controller.GroupSelectorLimits(a,w,l);return a.on("group.remove",x,x.handleGroupRemove),a.on("group.add",x,x.handleGroupAdd),m},produceSharePage:function(a,b,c,d,e,f,g,h,i){var j=new Imgur.Tag.Store.Tag(a,e);_.each(d,function(a){j.addTag({tag:a})});var k=new Imgur.Tag.TagValidator(2,36),l=new Imgur.Tag.Store.Suggestion(a,k),m="//"+this._.env.global.host,n=new Imgur.Tag.SuggestModelNoProvider(this._.getProvider(),m),o=$("#tags input"),p=o.attr("placeholder"),q=o.attr("tabindex"),r=function(){ReactDOM.render(React.createElement(Imgur.Share.Title,{title:g,maxLength:100,inputClasses:"required input-bb",limitClasses:"limit"}),$("#submission-title").get(0))};r();var s=function(){ReactDOM.render(React.createElement(Imgur.Share.CTATitle,{}),$("#js-cta-title").get(0))};s();var t=function(){ReactDOM.render(React.createElement(Imgur.Tag.ShareTagComponent,{tagStore:j,suggestionStore:l,placeholder:p,tabIndex:q,id:"tagbox",gallery_type:f,defaultTags:i,tagLimit:e}),$("#tags").get(0))};t();var u=Imgur.ShareOnImgur.getInstance({type:b,hash:c,tagStore:j,emitter:a,hasTitle:!!g,hasTopic:!!h});u.generalInit();var v=new Imgur.Tag.Controller.OutsideComponent(n,l);a.on("new suggest query",null,_.bind(v.handleChangedQuery,v)),a.on("select",null,t),a.on("new suggest query",null,t),a.on("new finished query",null,t),a.on("new suggestions",null,t),a.on("tag removed",null,t),a.on("tag limit reached",null,function(){humanMsg.displayMsg("You have already added the maximum number of tags","error-msg")}),$(document).on("click",function(a){return $(a.target).closest(".tag-filter, .tag-list-content").length?void $("#tags").addClass("focus"):void $("#tags").removeClass("focus")})},_produceUserTagList:function(a,b,c,d,e){var f=this._.getProvider(),g="//"+this._.env.global.host,h=new Imgur.Tag.SuggestModelNoProvider(f,g),i={tagGroupStore:b,groupId:this._.env.gallery.group.id,outsideActiveTagStore:c,groupModel:e,suggestionStore:d,placeholder:"add tags to this gallery"};$("#tags-current-list, #outside-tagging-showhide").show(),$.cookie("showTags")&&$("#content > .panel").removeClass("hidden");var j=function(){ReactDOM.render(React.createElement(Imgur.Tag.TagListComponent,i),$("#tags-current-list").get(0))};j(),a.on("tag added to group",null,j),a.on("tag removed from group",null,j),a.on("new tag-group event",null,j),a.on("pending tag removed from group",null,j),a.on("new outside active tag",null,j),a.on("new suggestions",null,j),a.on("new suggest query",null,j),a.on("new finished query",null,j),a.on("new suggest validation mode",null,j);var k=new Imgur.Tag.Controller.OutsideComponent(h,d);a.on("new suggest query",null,_.bind(k.handleChangedQuery,k))},_produceGroupModel:function(a,b){var c=new Imgur.Tag.GroupModel(this._getStandardPostAuthorized(),b,a);return c},_produceSuggestedTagFromData:function(a,b,c,d,e){var f=$(_.templates["tags.tag-suggested"]({is_first:!!e,tag:{name:c,subscribers:d,urlencoded:""}})),g=new Imgur.Tag.SuggestedTag(f,b);return g.get$Add().on("click",_.partial(a,g)),g},_produceRemovableTagFromData:function(a,b,c){var d=$(_.templates["tags.tag-removable"]({tag:b}));return d},produceRemovableTagFromDom:function(a,b,c,d){var e=new Imgur.Tag.RemovableTag(a,d);e.get$RemoveButton().on("click",_.bind(b.handleRemovedTagEvent,b,e));var f=[{spot:"markConfirmed",cover:"recomputeNanoScroller",type:"passAfter"}];return e=Imgur.Util.decorateWithDetailed(e,c,f)},_produceComboboxItemFromSomething:function(a,b){var c=$(_.templates["tags.combobox-item"]({value:b}));return c.append(a),c},_produceEmptyGalleryTagList:function(a,b,c,d,e){var f=this._.getProvider(),g="//"+this._.env.global.host,h=new Imgur.Tag.SuggestModelNoProvider(f,g),i={tagGroupStore:b,groupId:this._.env.gallery.group.id,outsideActiveTagStore:c,groupModel:e,suggestionStore:d,id:"add-tag",placeholder:"Start following tags and stay up to date with the most viral images on the Internet"};$("#tags-current-list, #outside-tagging-showhide").hide(),$("#content > .panel").addClass("hidden");var j=function(){var a=$("#add-tag-container").get(0);a&&ReactDOM.render(React.createElement(Imgur.Tag.TagListComponent,i),a)};j(),a.on("select",null,j),a.on("new suggest query",null,j),a.on("new finished query",null,j),a.on("new suggest validation mode",null,j),a.on("new suggestions",null,j);var k=new Imgur.Tag.Controller.OutsideComponent(h,d);a.on("new suggest query",null,_.bind(k.handleChangedQuery,k)),$(".popular-tag .add-tag").on("click",function(){var a=$(this).parent().find(".tag-name").text();e.subscribe(i.groupId,a)})}}),Namespace("Imgur.Favorite"),Imgur.Favorite=Imgur.extend({init:function(a){this._=$.extend({method:null,hash:null,$favButton:$(".favorite-image"),confirm:{target:"#colorbox-confirm",$message:$("#colorbox-confirm-message"),$title:$("#colorbox-confirm-title")},messages:{favorited:'<div class="favorited"></div>',unfavorited:'<div class="favorited unfavorited"></div>',confirmMsg:function(a){return"Are you sure you want to "+(a?"unfavorite":"favorite")+" this image?"},confirmTitle:function(a){return(a?"Unfavorite":"Favorite")+" this image?"}}},a),this._.method=$.trim(this._.method),this._super(this._),this._.hash||(this._.hash=Imgur.InsideNav.getInstance().getHash())},_init:function(){this.showMessage(),this._init_click_handler()},_init_click_handler:function(){this._.$favButton.unbind("click").on("click",_.bind(function(a){var b,c,d,e=!1;"undefined"!=typeof a.fav_display_msg&&a.fav_display_msg===!0&&(e=!0);try{Imgur.InsideNav&&(c=Imgur.InsideNav.getInstance().getImage()),c&&this._.hash===c.hash&&(b=c.is_album,d=function(a){Imgur.InsideNav.getInstance().updateFavorite("favorited"==a)})}catch(f){}this.favorite(this._.hash,b,d,e)},this))},handleKey:function(a){if(!(a.ctrlKey||a.altKey||a.metaKey||48!=a.keyCode&&45!=a.keyCode&&96!=a.keyCode||$(a.target).is("input, textarea")||"true"==$(a.target).attr("contenteditable"))){
var b=jQuery.Event("click",{fav_display_msg:!0});this._.$favButton.trigger(b)}},showMessage:function(a){"undefined"==typeof a&&(a=this._.method),"favorited"==a?this.showFavorited():"unfavorited"==a?this.showUnfavorited():"confirm"==a&&this.showConfirm()},showFavorited:function(){humanMsg.displayMsg(this._.messages.favorited,"action-msg")},showUnfavorited:function(){humanMsg.displayMsg(this._.messages.unfavorited,"action-msg")},showConfirm:function(){this._.confirm.$message.html(this._.messages.confirmMsg(this.isFavorited())),this._.confirm.$title.html(this._.messages.confirmTitle(this.isFavorited())),Imgur.Utilities.ColorboxConfirm.getInstance().show(this._.confirm.target,_.bind(this.favorite,this))},favorite:function(a,b,c,d){Imgur.getInstance()._.signed||($(".tipsy,#favorite-bar").remove(),Imgur.getInstance().signin("Action - Favorite",!0)),"undefined"==typeof a?a=this._.hash:"function"==typeof a&&(a=a()),Imgur.getInstance()._.signed&&(this._.$favButton.hasClass("favorited")?(this._.$favButton.removeClass("favorited"),this._.method="unfavorited"):(this._.$favButton.addClass("favorited"),this._.method="favorited",$("#mainUpArrow").is(":visible")&&this.upvote()),d&&this.showMessage());var e="/"+a+"/fav.json";(window.location.href.indexOf("/a/")!==-1||b)&&(e="/a"+e);var f={ajax:!0,msid:Imgur.Environment.msid,location:Imgur.InsideNav?"inside":"outside"};Imgur.getInstance()._.signed?Imgur.Util.jafoLog({event:"favorite",meta:{isAlbum:b?b:window.location.href.indexOf("/a/")!==-1,hash:a,location:Imgur.InsideNav?"inside":"outside",state:"unfavorited"===this._.method?"unfavorite":"favorite"}}):_.extend(f,{sid:Imgur.Environment.sid,vote:"up",type:"image"}),$.ajax({url:e,type:"POST",data:f,success:_.bind(this.favoriteSuccess,this,c),error:_.bind(this.favoriteError,this)})},favoriteSuccess:function(a,b){b&&"success"in b&&b.success&&(this._.method=b.data.fav_method,a&&a(b.data.fav_method))},favoriteError:function(){Imgur.getInstance()._.signed&&("favorited"==this._.method?(this._.$favButton.removeClass("favorited"),this._.method="unfavorited"):(this._.$favButton.addClass("favorited"),this._.method="favorited"))},isFavorited:function(){return this._.$favButton.hasClass("favorited")},upvote:function(){Imgur.getInstance()._.signed&&($("#mainUpArrow").hasClass("pushed")||$("#mainDownArrow").hasClass("pushed")||$("#mainUpArrow").click())}}),Namespace("Imgur.ShareOnImgur"),Imgur.ShareOnImgur=Imgur.extend({init:function(a){return a=a||{},this._=$.extend(!0,{gallerySubmitTermsUrl:"/lightboxes/galleryterms",galleryVerifyEmailFormUrl:"/lightboxes/verifyemail",gallerySubmitURL:"/share/i/",loading:!1,shareing:!1,terms:0,messages:{postingTooFast:function(a){var b=a>60?Math.round(a/60)+Imgur.Util.pluralize(Math.round(a/60)," minute"):a+Imgur.Util.pluralize(a," second");return"You're sharing too quickly. Please wait "+b+"."},banned:"Your account has been blocked. Please contact support@imgur.com."},el:{$shareonimgur:$("#shareonimgur"),$shareAlbum:$("#share-album"),$preview:$("#preview"),$descriptions:$("#submission-title input, .data-col textarea"),$topic_id:$('input[name="topic_id"]'),$titleDesc:$('input[name="imageTitle[]"], textarea[name="description[]"]'),$imageTitles:$(".image-title"),$deleteContainers:$(".delete-col"),$required:$(".required"),$submit:$("#share"),$terms:$('input[name="terms"]'),$tagbox:$("#tagbox"),$contentContainer:$("#content-container"),$topicSelect:$(".topic-select"),$publishButtons:$("#publish-buttons"),$missingFields:$("#missing-fields"),$promotedPlatBoxes:$('#platform-target-prompt input[type="checkbox"]'),$promotedPlatAll:$('#platform-target-prompt input[type="checkbox"]#targeting-all'),sortHandler:".move",images:".image-container .zoom"}},a),this._.galleryLink="//"+imgur._.host+"/gallery/"+this._.hash+"/new",this._.publishCortex=new Cortex({submitting:!1,promoted:!1,missingFields:2}),this._=this._super(this._),this._},generalInit:function(){var a=this,b=function(){ReactDOM.render(React.createElement(Imgur.Share.Publish,{cortex:a._.publishCortex,hash:a._.hash,isAlbum:"a"==a._.type,handlePreview:function(b){a._.originalState=a._.el.$shareAlbum.serialize(),a.handleSave(b)},handleSubmit:_.bind(a.handleSubmit,a)}),a._.el.$publishButtons.get(0))};b(),this._.publishCortex.on("update",function(){b()}),$(this._.el.images).imageZoom(),this._.el.$deleteContainers.on("click",function(b){a.handleDelete(b)}),this._.el.$required.on("keyup",function(){""!=$(this).val()?(a._.hasTitle=!0,$(this).removeClass("error")):a._.hasTitle=!1,a.checkMissingFields()}),this._.el.$descriptions.on("keydown",function(a){if(9==a.keyCode&&!a.shiftKey){var b,c=$(this);b=c.hasClass("required")?$(".image-container").eq(0):c.parents(".image-container").next(),$.smoothScroll({scrollTarget:b})}}),this._.el.$titleDesc.on("change",function(){$(this).parents(".image-container").find('input[name="dirty[]"]').val(1)}),this._.originalState=this._.el.$shareAlbum.serialize(),this._.el.$topicSelect.combobox({onChange:function(b,c,d){a._.hasTopic=!0,a.checkMissingFields(),a._.el.$topicSelect.removeClass("error")}}),this._.el.$promotedPlatBoxes.on("change click",_.bind(_.debounce(this.handlePromoPlatformChange,500),this)),this.handlePromoPlatformChange(),this.placeShareButtons(),$(window).on("resize",_.bind(a.placeShareButtons,this)),$(window).on("beforeunload",function(){if(a._.el.$shareAlbum.serialize()!=a._.originalState&&!a._.sharing)return"You have unsaved changes"})},placeShareButtons:function(){$("#topbar").height()+$("#shareonimgur").height()+$("#cta-container-placeholder2").height()>$(window).height()&&$(window).width()>960?this._.el.$publishButtons.addClass("js-fixed"):this._.el.$publishButtons.removeClass("js-fixed")},retabindex:function(){$("#tagbox, #submission-title input, .data-col input, .data-col textarea").each(function(a){$(this).attr("tabindex",a+1)})},handleDelete:function(a){a.preventDefault(),$(a.target).closest(".image-container").remove(),1==$(this._.el.images).length&&this._.el.$imageTitles.remove(),this.retabindex()},serialize:function(){for(var a={},b="",c=this._.el.$shareAlbum.find(":input"),d=0;d<c.length;d++){var e=c[d].name.indexOf("[]"),f=c[d].name.replace("[]",""),g=c[d].value;""!=f&&("dirty"==f?b=g:("description"==f&&!b||"imageTitle"==f&&!b)&&(g=""),e!=-1?Array.isArray(a[f])?a[f].push(g):a[f]=[g]:"radio"==c[d].type||"checkbox"==c[d].type?c[d].checked&&(a[f]=g):a[f]=g)}return JSON.stringify(a)},handleSave:function(a){if(a&&a.preventDefault(),this.handleValidation(!0)){var b=this;this._.previewWindow=window.open("/share/"+this._.type+"/"+this._.hash+"/loading","_blank"),Imgur.Util.jafoLog({event:"shareOnImgurPreview",meta:{hash:this._.hash}}),$.ajax({method:"POST",url:"/share/"+this._.type+"/"+this._.hash+"/save",data:{msid:Imgur.Environment.msid,data:this.serialize()},success:function(a){if(!a||!a.success)return b.handleFail(!0,a)},error:this.handleFail.bind(this,!0)})}},handleSubmit:function(a){if(a&&a.preventDefault(),this.handleValidation()&&!this._.loading){var b=this;this._.loading=!0,this._.publishCortex.submitting.set(!0),Imgur.Util.jafoLog({event:"shareOnImgurButton",meta:{hash:this._.hash,topic:$(".topic-select .selection h4").text().trim(),matureToggle:$("#mature").is(":checked"),location:"uploadModal"}}),$.ajax({method:"POST",url:"/share/"+this._.type+"/"+this._.hash+"/share",data:{msid:Imgur.Environment.msid,data:this.serialize()},success:function(a){if(!a||!a.success)return b.handleFail(!1,a);if(b._.sharing=!0,a.data&&a.data.promoPage){var c="";c+='<div class="panel" id="promo-success">',c+="<h1>Success!</h1>",c+="<ul>",c+='<li><a href="//'+imgur._.host+"/gallery/"+b._.hash+'/" target="_blank">View the gallery page</a></li>',c+='<li><a href="'+a.data.promoPage+'" target="_blank">View the promo flight</a></li>',c+="</ul>",c+="</div>",b._.el.$contentContainer.html(c)}else window.location="//"+imgur._.host+"/gallery/"+b._.hash+"/new"},error:this.handleFail.bind(this,!1)})}},handlePromoPlatformChange:function(a){var b="#targeting-all",c=":not("+b+")",d=this._.el.$promotedPlatAll.attr("checked"),e="object"==typeof a&&$(a.target).is(b);if(this._.el.$promotedPlatBoxes.length)if(e)d?this._.el.$promotedPlatBoxes.filter(c).attr("checked",!0):this._.el.$promotedPlatAll.removeAttr("checked");else{for(var f=this._.el.$promotedPlatBoxes.filter(c).length,g=0,h=0;h<this._.el.$promotedPlatBoxes.length;h++){var i=$(this._.el.$promotedPlatBoxes[h]);i.is(b)||i.attr("checked")&&g++}f==g?this._.el.$promotedPlatAll.attr("checked",!0):this._.el.$promotedPlatAll.removeAttr("checked")}},redirectToGallery:function(){this._.previewWindow.close(),window.location=this._.galleryLink},handleFail:function(a,b){var c=this;this._.loading=!1,this._.publishCortex.submitting.set(!1);try{if(!b)throw"bad response";b.responseText&&(b=$.parseJSON(b.responseText))}catch(d){return humanMsg.displayMsg("An unknown error occurred. Please try again.","error-msg"),$.colorbox.close(),void Imgur.Util.jafoLog({event:"shareOnImgurError",meta:{hash:this._.hash,error:"unparsable",button:"share"}})}if(null==b.data||null==b.data.error||null==b.data.error.message)return humanMsg.displayMsg("An unknown error occurred. Please try again.","error-msg"),$.colorbox.close(),void Imgur.Util.jafoLog({event:"shareOnImgurError",meta:{hash:this._.hash,error:"unknown",button:"share"}});var e=parseInt(b.data.error.message),f="unknown";!isNaN(e)&&e>0?(f="rateLimit",humanMsg.displayMsg(this._.messages.postingTooFast(e),"error-msg")):"Banned"==b.data.error.message?(f="banned",humanMsg.displayMsg(this._.messages.banned,"error-msg"),$.colorbox.close()):"Terms"==b.data.error.message?(f="terms",this.showTerms(a)):"NotVerified"==b.data.error.message?(f="notVerified",this.showEmailVerification(function(){a?c.handleSave():c.handleSubmit()})):"OP"==b.data.error.message?(humanMsg.displayMsg("OP must exist.","error-msg"),$.colorbox.close()):"Suspended"==b.data.error.message?(f="suspended",humanMsg.displayMsg("Your account is currently suspended","error-msg")):(humanMsg.displayMsg(b.data.error.message,"error-msg"),$.colorbox.close()),Imgur.Util.jafoLog({event:"shareOnImgurError",meta:{hash:this._.hash,error:f,button:"share"}})},handleValidation:function(a){var b=!1,c="",d=a===!0?"preview":"share";return this._.el.$required.val()||(this._.el.$required.addClass("error"),this._.el.$required.focus(),b=!0,c+="noTitle"),""==this._.el.$topic_id.val()&&(this._.el.$topicSelect.addClass("error"),b=!0,c+="noTitle"==c?"NoTags":"noTags"),!b||(Imgur.Util.jafoLog({event:"shareOnImgurError",meta:{hash:this._.hash,error:c,button:d}}),!1)},checkMissingFields:function(){var a=0;return this._.hasTopic||a++,this._.hasTitle||a++,this._.publishCortex.missingFields.set(a),a},showTerms:function(a){var b=this,c=Imgur.ShareOnImgur.getInstance();$.colorbox.close(),$.colorbox({href:b._.gallerySubmitTermsUrl,open:!0,iframe:!0,top:"15%",transition:"none",scrolling:!1,innerWidth:"520px",innerHeight:"234px",onComplete:function(){b._.publishCortex.submitting.set(!1)},onCleanup:function(){c._.terms&&(b._.el.$terms.val(1),a?b.handleSave():b.handleSubmit())}})},acceptTerms:function(a,b){var c=Imgur.ShareOnImgur.getInstance();c._.terms=1,c._.el.$terms.val(1),b||$.colorbox.close()},declineTerms:function(){var a=Imgur.ShareOnImgur.getInstance();a._.terms=0,a._.el.$terms.val(0),$.colorbox.close()},showEmailVerification:function(a){var b=Imgur.ShareOnImgur.getInstance();$.colorbox.close(),setTimeout(function(){var c=b;$.colorbox({href:b._.galleryVerifyEmailFormUrl,open:!0,iframe:!0,top:"15%",transition:"none",scrolling:!1,innerWidth:"520px",innerHeight:"256px",onComplete:function(){b.sendVerificationEmail(),c.checkEmailVerification()},onCleanup:function(){a&&a()}})},600)},sendVerificationEmail:function(){$.get("/ajax/send_email_verification")},checkEmailVerification:function(a,b){var c=this;a||(a=""),$.post("/ajax/verify_email/"+a,function(d){d.data.verified?($.colorbox.close(),b&&b()):(d.data.invalid&&a&&humanMsg.displayMsg("Verification code is invalid","error-msg"),setTimeout(function(){c.checkEmailVerification()},1500))})}}),Class.addSingleton(Imgur.ShareOnImgur),Namespace("Imgur"),Imgur.GalleryPost=React.createClass({displayName:"GalleryPost",getInterestingEvents:function(){return["select"]},render:function(){var a=this.props.currentImageStore.getCurrentImage(),b=a.title,c=a.nsfw?"mature-indicator":"";return"untitled"==b&&(b=""),a.isAd?React.DOM.div(null,this.props.promotedTag(),React.DOM.h1({id:"image-title",className:c},b)):React.DOM.div(null,React.DOM.h1({id:"image-title",className:c},b))}}),Namespace("Imgur.Share"),Imgur.Share.CTATitle=React.createClass({displayName:"Share-CTA-Title",getInitialState:function(){return{title:""}},handleChange:function(a){this.setState({title:a.target.value})},render:function(){var a="",b=25;return this.state.title.length>=b?a="filled":this.state.title.length>0&&(a="filling"),React.DOM.div({},React.DOM.input({id:"cta-title",type:"text",className:"input-bb",name:"video-cta-title",placeholder:"Learn More",value:this.state.title,autoComplete:"off",onChange:this.handleChange}),React.DOM.p({className:"limit "+a},"("+this.state.title.length+" "+Imgur.Util.pluralize(this.state.title.length,"character")+")"))}}),Namespace("Imgur.Share"),Imgur.Share.Title=React.createClass({displayName:"Share-Title",getInitialState:function(){return{title:this.props.title,titleLength:this.props.title.length}},handleChange:function(a){var b=a.target.value.length;if(this.setState({title:a.target.value,titleLength:b}),"function"==typeof this.props.handleChange){var c=!1;b>0&&b<=this.props.maxLength&&(c=!0),this.props.handleChange(c)}},render:function(){var a="";return this.state.titleLength>=this.props.maxLength?a=" filled":this.state.titleLength>0&&(a=" filling"),React.DOM.div({},React.DOM.input({type:"text",className:this.props.inputClasses,ref:"title",name:"title",placeholder:"Give your post a title",value:this.state.title,autoComplete:"off",maxLength:this.props.maxLength,tabIndex:1,onChange:this.handleChange}),React.DOM.p({className:this.props.limitClasses+a},"("+this.state.titleLength+"/"+this.props.maxLength+")"))}}),Namespace("Imgur.Share"),Imgur.Share.Publish=React.createClass({displayName:"Share-Publish",handleRules:function(){Imgur.Util.jafoLog({event:"reportRules",meta:{type:"galleryPost",hash:this.props.hash,isAlbum:this.props.is_album}})},render:function(){var a,b,c=this.props.cortex.missingFields.getValue();return c?(a=React.DOM.button({id:"share",className:"btn btn-grey",disabled:"disabled"},"Finish & Share"),b=React.DOM.p({id:"missing-fields"},"missing "+c+" required field"+(0!=c?"s":""))):(a=React.DOM.button({id:"share",className:"btn btn-main",onClick:this.props.handleSubmit},"Finish & Share"),b=React.DOM.p({id:"missing-fields",className:"success"},"Remember our ",React.DOM.a({href:"/rules",target:"_blank",onClick:this.handleRules},"community rules"))),React.DOM.div({},a,React.DOM.span({id:"share-loader",className:this.props.cortex.submitting.getValue()?"":"nodisplay"}),this.props.cortex.promoted.getValue()?"":React.DOM.a({id:"preview",href:"",onClick:this.props.handlePreview},"preview post"),b)}}),Namespace("Imgur.Element"),Imgur.Element.SortedList=Class.extend({init:function(a,b,c){this._={el:{$container:a},comparator:b,list:c||[]}},getComparator:function(){return this._.comparator},getList:function(){return this._.list},get$Container:function(){return this._.el.$container},add:function(a){for(var b=!1,c=0;c<this._.list.length;c++){var d=this._.list[c],e=this._.comparator(a,d);if(e<=0){d.get$Container().before(a.get$Container()),this._.list.splice(c,0,a),b=!0;break}}b||this.append(a)},prepend:function(a){this._.list.length?this._.list[0].insertBefore(a):this._.el.$container.append(a.get$Container()),this._.list.unshift(a)},append:function(a){this._.el.$container.append(a.get$Container()),this._.list.push(a)},remove:function(a){this.removeElementPredicate(function(b){return b.equals(a)})},removeElementPredicate:function(a){this._.list=_.filter(this._.list,function(b){var c=a(b);return c&&b.remove(),!c})},clear:function(){for(var a=0;a<this._.list.length;a++)this._.list[a].remove();this._.list=[]},extend:function(a){_.each(a,_.bind(this.add,this))},length:function(){return this._.list.length},contains:function(a){return _.some(this._.list,function(b){return a.equals(b)})},containsBy:function(a){return _.some(this._.list,a)},moveToTop:function(a){a.remove(),this.remove(a),this.prepend(a)},findFirstBy:function(a){var b=_.filter(this._.list,a);return b.length?b[0]:null}}),Namespace("Imgur.Element"),Imgur.Element.SortedListEmptyable=Imgur.Element.SortedList.extend({init:function(a,b,c,d,e){this._super(a,c,d),this._.el.$empty=b,this._.emptyMessageProvider=e||function(){return b}},setEmptyMessageProvider:function(a){this._.emptyMessageProvider=a},getEmptyMessageProvider:function(){return this._.emptyMessageProvider},_replaceEmptyMessage:function(){var a=$(this._.emptyMessageProvider());this._.el.$empty.replaceWith(a),this._.el.$empty=a},add:function(a){this._super(a),this.hideEmptyMessage()},prepend:function(a){this.hideEmptyMessage(),this._super(a)},append:function(a){this.hideEmptyMessage(),this._super(a)},remove:function(a){this._super(a),0==this._.list.length&&this.showEmptyMessage()},removeElementPredicate:function(a){this._super(a),0==this._.list.length&&this.showEmptyMessage()},clear:function(){this._super(),this.showEmptyMessage()},hasEmptyMessage:function(){return!this._.el.$empty.hasClass("nodisplay")},hideEmptyMessage:function(){this.hasEmptyMessage()&&this._.el.$empty.addClass("nodisplay")},showEmptyMessage:function(){this._replaceEmptyMessage(),this.hasEmptyMessage()||this._.el.$empty.removeClass("nodisplay")}}),Namespace("Imgur.Element"),Imgur.Element.OutsideSortedListEmptyable=Imgur.Element.SortedListEmptyable.extend({hasEmptyMessage:function(){return this._.el.$selectorContainer.hasClass("noGroups")},hideEmptyMessage:function(){this.hasEmptyMessage()&&this._.el.$selectorContainer.removeClass("noGroups")},showEmptyMessage:function(){this._replaceEmptyMessage(),this.hasEmptyMessage()||this._.el.$selectorContainer.addClass("noGroups")}}),Namespace("Imgur.Tag"),Imgur.Tag.Follow=React.createClass({displayName:"Tag-Follow",_handleUnsubscribe:function(){this.props.groupModel.unsubscribe("[custom]",this.props.tag)},_handleSubscribe:function(){this.props.groupModel.subscribe("[custom]",this.props.tag)},render:function(){return this.props.tagFollower?React.DOM.div({className:"btn btn-small btn-main",onClick:_.bind(this._handleUnsubscribe,this)},"following"):React.DOM.div({className:"btn btn-small btn-secondary",onClick:_.bind(this._handleSubscribe,this)},"follow")}}),Namespace("Imgur.Tag"),Imgur.Tag.GroupSelector=Class.extend({init:function(a,b,c,d,e,f){this._=_.merge(this._||{},{emitter:a,section:b,sort:c,inSearch:d,activeGroup:f,el:{$selection:e.find("#section .selection")}})},changeSelectionToTag:function(a){this._.el.$sectionName.html(a)},getActiveGroupId:function(){return this._.activeGroup.getId()},getActiveGroup:function(){return this._.activeGroup},getActiveGroupName:function(){return this._.activeGroup.getName()},getActiveTag:function(){return this._.tag},getActiveTagName:function(){return this._.tag.getName()},setActiveGroupName:function(a){this._.activeGroup.setName(a),this._.el.$selection.text(a).trim()},findTagInActiveGroup:function(a){return this._.activeGroup.findFirstTagBy(function(b){return b.getName()===a})}}),Namespace("Imgur.Tag"),Imgur.Tag.MainGroupSelector=Imgur.Tag.GroupSelector.extend({init:function(a,b,c,d,e,f,g){this._super(a,b,c,d,e),this._=_.merge(this._||{},{emitter:a,section:b,sort:c,inSearch:d,sentence:f,outsideActiveTagStore:g,el:{$container:e,$selectionName:e.find("#section .selection .name")}})},get$Container:function(){return this._.el.$container}}),Namespace("Imgur.Tag"),Imgur.Tag.Group=Class.extend({init:function(a,b){this._={list:b,el:{$container:a,$name:a.find(".name")}}},getId:function(){return this.getIdFrom$Container(this._.el.$container)},getList:function(){return this._.list},setList:function(a){this._.list=a},getName:function(){return this._.el.$name.text()},get$Container:function(){return this._.el.$container},get$Name:function(){return this._.el.$name},setName:function(a){this._.el.$name.text(a)},add:function(a){this._.list.add(a)},contains:function(a){return this._.list.contains(a)},containsBy:function(a){return this._.list.containsBy(a)},findFirstTagBy:function(a){return this._.list.findFirstBy(a)},getIdFrom$Container:function(a){return a.children("div").attr("value")},getTypeFrom$Container:function(a){return a.children("div").attr("data-type")},equals:function(a){return a===this.getId()},insertBefore:function(a){this.get$Container().before(a.get$Container())}}),Namespace("Imgur.Tag"),Imgur.Tag.UserGroup=Imgur.Tag.Group.extend({init:function(a,b){this._super(a,b),this._.el.$remove=a.find(".remove")},setName:function(a){this._.el.$name.text(a)},get$RemoveButton:function(){return this._.el.$remove},remove:function(){this._.el.$container.remove()},equals:function(a){return a===this.getId()}}),Namespace("Imgur.Tag"),Imgur.Tag.GroupModel=Class.extend({init:function(a,b,c){this._={post:a,tagGroupStore:b,emitter:c}},unsubscribe:function(a,b){this._.tagGroupStore.removeTagFromGroup(b,a);var c=_.bind(function(){this._.tagGroupStore.setFailedTag(""),this._.tagGroupStore.pushHistory(b,a,this._.tagGroupStore.ACTIONS.REMOVED),this._.emitter.trigger("new tagset")},this),d=_.bind(function(){this._.tagGroupStore.setFailedTag("Failed to unsubscribe from "+b),this._.tagGroupStore.addTagToGroup(b,a),this._.tagGroupStore.pushHistory(b,a,this._.tagGroupStore.ACTIONS.ERROR),humanMsg.displayMsg("Failed to unfollow tag","error-msg")},this);this._.post("/account/groups/unsubscribe",{group:a,tag:b},c,d)},subscribe:function(a,b){this._.tagGroupStore.addPendingTag(b,a);var c=_.bind(function(){this._.tagGroupStore.addTagToGroup(b,a),this._.tagGroupStore.removePendingTag(b,a),this._.tagGroupStore.setFailedTag(""),this._.tagGroupStore.pushHistory(b,a,this._.tagGroupStore.ACTIONS.ADDED),this._.emitter.trigger("new tagset")},this),d=_.bind(function(){this._.tagGroupStore.setFailedTag("Failed to subscribe to "+b),this._.tagGroupStore.removePendingTag(b,a),this._.tagGroupStore.pushHistory(b,a,this._.tagGroupStore.ACTIONS.ERROR),humanMsg.displayMsg("Failed to follow tag","error-msg")},this);this._.post("/account/groups/subscribe",{group:a,tag:b},c,d)},block:function(a,b){this._.tagGroupStore.addPendingTag(b,a);var c=_.bind(function(){this._.tagGroupStore.addTagToGroup(b,a),this._.tagGroupStore.removePendingTag(b,a),this._.tagGroupStore.setFailedTag(""),this._.tagGroupStore.pushHistory(b,a,this._.tagGroupStore.ACTIONS.BLOCKED),this._.emitter.trigger("new tagset")},this),d=_.bind(function(){this._.tagGroupStore.setFailedTag("Failed to block "+b),this._.tagGroupStore.removePendingTag(b,a),this._.tagGroupStore.pushHistory(b,a,this._.tagGroupStore.ACTIONS.ERROR)},this);this._.post("/account/groups/blocktag",{tag:b},c,d),this._.tagGroupStore.block(b)},unblock:function(a,b){this._.tagGroupStore.removeTagFromGroup(b,a);var c=_.bind(function(){this._.tagGroupStore.setFailedTag(""),this._.tagGroupStore.pushHistory(b,a,this._.tagGroupStore.ACTIONS.UNBLOCKED),this._.emitter.trigger("new tagset")},this),d=_.bind(function(){this._.tagGroupStore.pushHistory(b,a,this._.tagGroupStore.ACTIONS.ERROR),this._.tagGroupStore.setFailedTag("Failed to unblock "+b),this._.tagGroupStore.addTagToGroup(b,a)},this);this._.post("/account/groups/unblocktag",{tag:b},c,d),this._.tagGroupStore.unblock(b)}}),Namespace("Imgur.Tag"),Imgur.Tag.Tag=Class.extend({init:function(a){this._={el:{$container:a,$name:Object.getPrototypeOf(this).get$NameFrom$Container(a)}}},insertBefore:function(a){this._.el.$container.before(a.get$Container())},remove:function(){this._.el.$container.remove()},getName:function(){return this._.el.$name.text().toLowerCase()},get$Container:function(){return this._.el.$container},get$Name:function(){return this._.el.$name},get$NameFrom$Container:function(a){return a.children(".name")},getNameFrom$Container:function(a){return a.children(".name").text()},equals:function(a){return a instanceof Imgur.Tag.Tag&&a.getName()==this.getName()},addSelection:function(){this.get$Container().addClass("selected")},removeSelection:function(){this.get$Container().removeClass("selected")}}),Namespace("Imgur.Tag"),Imgur.Tag.RemovableTag=Imgur.Tag.Tag.extend({init:function(a,b){this._super(b),this._.emitter=a,this._.el.$remove=b.find(".remove")},getEmitter:function(){return this._.emitter},get$RemoveButton:function(){return this._.el.$remove},markConfirmed:function(){this._.el.$container.removeClass("pending")},remove:function(){this._.emitter.trigger("tag.remove",this.getName()),this._super()}}),Namespace("Imgur.Tag"),Imgur.Tag.OutsideTaggingWidget=Class.extend({init:function(a,b,c,d){this._={emitter:d,showBestCommentsCookie:"showComments",showTagsCookie:"showTags",el:{$outsideTaggingParent:b,$outsideTagging:a,$tagShowHide:c}}},isOpen:function(){return $.cookie(this._.showTagsCookie)},toggle:function(a){var b=this._.el.$outsideTaggingParent.hasClass("hidden");$(".tipsy").remove(),b?(this._.el.$outsideTaggingParent.removeClass("hidden"),this._.el.$tagShowHide.attr("title","Hide Sidebar"),this._.el.$outsideTagging.stop(!0,!0).fadeTo(0,1)):(this._.el.$outsideTaggingParent.addClass("hidden"),this._.el.$tagShowHide.attr("title","Show Sidebar"),this._.el.$outsideTagging.stop(!0,!0).delay(100).fadeTo(100,0)),a?this.setBestCommentsCookie(b?1:0):this.setTagBoxCookie(b?1:0)},openTagBox:function(){this.isOpen()||this.toggle(!1)},setTagBoxCookie:function(a){a?$.cookie(this._.showTagsCookie,a,{path:"/",expires:1e4}):$.removeCookie(this._.showTagsCookie,{path:"/"})},setBestCommentsCookie:function(a){a?$.cookie(this._.showBestCommentsCookie,a,{path:"/",expires:1e4}):$.removeCookie(this._.showBestCommentsCookie,{path:"/"})}}),Namespace("Imgur.Tag"),Imgur.Tag.Model=Class.extend({init:function(a,b){this._={ajax:a,tagProvider:b,queryNonce:0,pendingRequest:null}},cancel:function(){this._.queryNonce++,null!=this._.pendingRequest&&this._.pendingRequest.abort()},fetch:function(a,b,c,d){this.cancel(),this._.pendingRequest=this._.ajax(b,d,_.bind(this._handleResponse,this,this._.queryNonce,a,c||_.noop),_.bind(this._handleError,this,a))},responseWasSuccessful:function(a){return!!a.success},_handleResponse:function(a,b,c,d){this._.pendingRequest=null,a<this._.queryNonce||(this._.queryNonce++,d&&this.responseWasSuccessful(d)&&c(b,this._handleResponseSuccess(b,d)))},_handleError:function(a){throw"abstract"},_handleResponseSuccess:function(a,b){throw"abstract"}}),Namespace("Imgur.Tag"),Imgur.Tag.SuggestModel=Imgur.Tag.Model.extend({init:function(a,b,c){this._super(a,b),this._.autoSuggestUrl=c},fetch:function(a,b,c,d){this._super([a,b,d],this._.autoSuggestUrl+"/ajax/suggest_tags?q="+b+"&size=10",c,{})},responseWasSuccessful:function(a){return!!a.success},_handleResponseSuccess:function(a,b){var c=[],d=a[0],e=(a[1],a[2]);return _.each(b.data,_.bind(function(a,b){c.push(this._.tagProvider(e,d,a.tag,a.subscribers))},this)),c},toString:function(){return"[tag suggestion model]"}}),Namespace("Imgur.Tag"),Imgur.Tag.SuggestModelNoProvider=Imgur.Tag.Model.extend({init:function(a,b){this._super(a,null),this._.autoSuggestUrl=b},fetch:function(a,b){a?this._super(a,this._.autoSuggestUrl+"/ajax/suggest_tags?q="+a+"&size=10",b,{}):b("",[])},responseWasSuccessful:function(a){return!!a.success},_handleResponseSuccess:function(a,b){var c=[];return _.each(b.data,_.bind(function(a,b){c.push({tag:a.tag,subscribers:a.subscribers,images:a.images})},this)),c},_handleError:_.noop}),Namespace("Imgur.Tag"),Imgur.Tag.AutocompleteComponent=React.createClass({displayName:"Tag-AutocompleteComponent",getInitialState:function(){return{hidden:""}},getDefaultProps:function(){return{KEYCODES:{KEY_T:84,KEY_ESC:27,KEY_DOWN_ARROW:40,KEY_RIGHT_ARROW:39,KEY_UP_ARROW:38,KEY_ENTER:13,KEY_TAB:9}}},focus:function(){this.refs.query.focus()},moveCursorToEnd:function(a){a.selectionStart=a.selectionEnd=a.value.length,a.style.display="none",a.offsetHeight,a.style.display="block",a.focus()},handleKeyDown:function(a){$(".tipsy").remove(),9==a.keyCode&&""!=this._getAcInfo().queryDisplayed&&a.preventDefault();var b={down_arrow:a.keyCode===this.props.KEYCODES.KEY_DOWN_ARROW,up_arrow:a.keyCode===this.props.KEYCODES.KEY_UP_ARROW,right_arrow:a.keyCode===this.props.KEYCODES.KEY_RIGHT_ARROW,enter:a.keyCode===this.props.KEYCODES.KEY_ENTER,tab:a.keyCode===this.props.KEYCODES.KEY_TAB,modifier:!!a.metaKey||!!a.ctrlKey||!!a.altKey};if(!b.modifier){b.enter&&this.handleSubmit(a);var c=this.props.suggestionStore.getSuggestions();if(0==c.length&&(c=this.props.defaultTags||[]),c.length){var d=this.props.getAutocompleteIdx();if(b.down_arrow||b.up_arrow){var e=0;if(e=b.down_arrow?1:-1,0===d&&b.up_arrow||d===c.length-1&&b.down_arrow)return void this.props.setComponentState({selectionActive:!1,autocompleteIdx:null});d=null==d?b.up_arrow?c.length-1:0:((d+e)%c.length+c.length)%c.length,this.props.setComponentState({selectionActive:!0,autocompleteIdx:d})}else if(b.right_arrow||b.tab){var f=c[0].tag,g=this.refs.query;null!=d?f=c[d].tag:"number"==typeof g.selectionEnd&&g.selectionEnd==g.value.length&&this.moveCursorToEnd(g),this.props.suggestionStore.setQuery(f),this.handleKeyPress(a),b.tab&&this.props.setComponentState({focusDue:!0})}}}},handleKeyPress:function(a){var b=this._getAcInfo().queryDisplayed+(32==a.which?"m":String.fromCharCode(a.which)),c=$("<span />").text(b);$("body").append(c),c.width()>$(this.refs.query).width()?this.setState({hidden:"hidevis"}):this.setState({hidden:""}),c.remove()},handleChangedQuery:function(a){this.props.suggestionStore.setValidationMode("query"),this.props.suggestionStore.setQuery(a.target.value),this.props.setComponentState({selectionActive:!1,autocompleteIdx:null})},handleSubmit:function(a){a.preventDefault(),this.props.suggestionStore.setValidationMode("submit");var b=this._getAcInfo(),c=b.queryDisplayed,d=this.props.suggestionStore.getIsValidQuery(c);d&&this.props.onSubmit(c,a)},focused:function(){this.props.setComponentState({focusDue:!1})},_getAcInfo:function(){var a=this.props.suggestionStore.getQuery(),b="",c=this.props.suggestionStore.getSuggestions();0==c.length&&(c=this.props.defaultTags||[]),c.length&&null!=this.props.getAutocompleteIdx()?b=c[this.props.getAutocompleteIdx()].tag:c.length&&(b=c[0].tag);var d=this._longestCommonPrefix(b,a);return d&&(d==a||this.props.getSelectionActive())||(b=""),{acText:b,queryDisplayed:null!=this.props.getAutocompleteIdx()&&this.props.getSelectionActive()?b:a}},_longestCommonPrefix:function(a,b){if(!b)return a;for(var c=Math.min(a.length,b.length);c>=0;){if(a.substr(0,c)==b.substr(0,c))return a.substr(0,c);c--}return""},componentDidUpdate:function(){(this.props.maybeErrorLabel||this.props.maybeAjaxErrorLabel)&&$(".tipsy-error").tipsy({cls:"error-tipsy",gravity:"w",trigger:"manual",title:"data-title"}).tipsy("show")},render:function(){return React.DOM.div({className:"acContainer"},React.DOM.input({ref:"query",onChange:this.handleChangedQuery,type:"text",id:this.props.id?this.props.id:"tagbox",placeholder:this.props.placeholder,tabIndex:this.props.tabIndex,value:this._getAcInfo().queryDisplayed,onKeyDown:this.handleKeyDown,onKeyPress:this.handleKeyPress,autoComplete:"off","data-title":this.props.maybeErrorLabel?this.props.maybeErrorLabel:this.props.maybeAjaxErrorLabel?this.props.maybeAjaxErrorLabel:"",className:this.props.className+(this.props.maybeErrorLabel||this.props.maybeAjaxErrorLabel?" tipsy-error":"")}),React.DOM.input({id:"acText",type:"text",autoComplete:"off",readOnly:!0,ref:"hint",className:this.state.hidden,value:this._getAcInfo().acText}))}}),Namespace("Imgur.Tag"),Imgur.Tag.Comparator=Class.extend({compare:function(a,b){var c=a.getName(),d=b.getName();if(d==c)return 0;var e=[c,d];return e.sort(),e[0]==c?-1:1}}),Namespace("Imgur.Tag"),Imgur.Tag.ShareTagComponent=React.createClass({displayName:"Tag-ShareTagComponent",
getInitialState:function(){return{focusDue:!0,selectionActive:!1,autocompleteIdx:null}},_encode:function(a){return a.replace(new RegExp(" ","g"),"_")},handleTagClicked:function(a,b){b.preventDefault()},handleRemoveClicked:function(a,b){b.preventDefault(),this.props.tagStore.removeTag(a)},handleQueryChange:function(a){this.props.suggestionStore.setQuery(a.target.value)},handleChoice:function(a,b){b.preventDefault(),this.props.suggestionStore.setValidationMode("query"),this.props.suggestionStore.clear(),this.props.suggestionStore.setQuery(""),this.props.tagStore.addTag({tag:a}),this.setState({selectionActive:!1,autocompleteIdx:null})},getSelectionActive:function(){return this.state.selectionActive},getAutocompleteIdx:function(){return this.state.autocompleteIdx},setComponentState:function(a){this.setState(a)},componentDidMount:function(){this._updateNano()},componentDidUpdate:function(){this._updateNano()},_updateNano:function(){var a=$(this.refs.nano),b=this.refs.content;a.height("inherit").height(b.scrollHeight),a.nanoScroller({preventPageScrolling:!0,alwaysVisible:!0}),a.children(".pane").is(":visible")?a.addClass("nano-visible"):a.removeClass("nano-visible")},stopPropagation:function(a){a.stopPropagation()},_produceTag:function(a,b,c){return React.DOM.div({onClick:_.partial(this.handleChoice,b),className:"tag suggested pointer"+(a?" hover":"")},React.DOM.div({className:"name"},b),React.DOM.div({className:"images"},Imgur.Util.numberFormat(c)+" images"))},render:function(){var a=this.props.suggestionStore.getLastFinishedQuery(),b=this.props.suggestionStore.getQuery(),c=this.props.suggestionStore.getIsValidQuery(b),d=this.props.suggestionStore.getWhyNot(b),e=this.props.suggestionStore.getIsLoading(),f=this.props.suggestionStore.getSuggestions(),g=[],h=[],i=[],j=[],k=Object.keys(this.props.tagStore.getTags()),l=0,m="";if(tagCountText="",a.length){if(_.each(f,_.bind(function(a,b){var c=null!=this.state.autocompleteIdx&&b==this.state.autocompleteIdx&&this.state.selectionActive;g.push(this._produceTag(c,a.tag,a.images))},this)),!f.length&&c){var n=e?a:b;g.push(React.DOM.p({className:"empty"},"No tag like ",React.DOM.em(null,n)," found. ",React.DOM.a({className:"tag-create-from-empty-query",href:"#",onClick:_.partial(this.handleChoice,n)},"Make it!")))}}else g.push(React.DOM.div({className:"empty"},""));return!(g.length<2&&0==k.length)||f.length||e&&b.length||(i=_.filter(this.props.defaultTags,function(a){return k.indexOf(a.tag)==-1}),_.each(i,_.bind(function(a,b){if(k.indexOf(a.tag)==-1){var c=null!=this.state.autocompleteIdx&&b==this.state.autocompleteIdx&&this.state.selectionActive;h.push(this._produceTag(c,a.tag,a.images))}},this))),j=_.map(k,_.bind(function(a){return a==this.props.gallery_type?React.DOM.div({className:"tag-removable"},React.DOM.span(null,a)):React.DOM.div({className:"tag-removable"},React.DOM.span(null,a),React.DOM.a({onClick:_.partial(this.handleRemoveClicked,a),href:"#",className:"remove"},""),React.DOM.input({type:"hidden",name:"tag[]",value:a}))},this)),l=j.length,l>=this.props.tagLimit?m="filled":l>0&&(m="filling"),this.refs.query&&$(this.refs.query).find("input").is(":focus")&&(tagCountText="Press enter to add tag "),React.DOM.div(null,j,React.DOM.div({className:"tag-filter"},React.createElement(Imgur.Tag.AutocompleteComponent,{onSubmit:this.handleChoice,ref:"query",id:l>=this.props.tagLimit?"tagbox-hidden":this.props.id,type:"text",autoComplete:"off",placeholder:this.props.placeholder,tabIndex:this.props.tabIndex,defaultTags:i,suggestionStore:this.props.suggestionStore,getAutocompleteIdx:this.getAutocompleteIdx,getSelectionActive:this.getSelectionActive,setComponentState:this.setComponentState,maybeErrorLabel:d}),React.DOM.div({ref:"nano",className:"tag-list-content nano"},React.DOM.div({ref:"content",className:"tag-list-results scroll-content content"},i.length||f.length&&c?React.DOM.p({},"TAG SUGGESTIONS"):"",g,h))),React.DOM.p({id:"tag-count",className:"limit"},tagCountText,React.DOM.span({className:m},"("+l+"/"+this.props.tagLimit+")")))}}),Namespace("Imgur.Tag"),Imgur.Tag.TagListComponent=React.createClass({displayName:"Tag-TagListComponent",getInitialState:function(){return{focusDue:!0,selectionActive:!1,autocompleteIdx:null}},_encode:function(a){return a.replace(new RegExp(" ","g"),"_")},handleTagClicked:function(a,b){b.preventDefault();var c=this.props.outsideActiveTagStore.getIsActive(),d=this.props.outsideActiveTagStore.getActiveTag();c&&a===d?this.props.outsideActiveTagStore.deactivate():this.props.outsideActiveTagStore.setActiveTag(a)},handleRemoveClicked:function(a,b){b.preventDefault(),"[filtered]"===this.props.groupId?this.props.groupModel.unblock(this.props.groupId,a):this.props.groupModel.unsubscribe(this.props.groupId,a)},handleQueryChange:function(a){this.props.suggestionStore.setQuery(a.target.value)},handleChoice:function(a,b){b.preventDefault(),this.props.suggestionStore.setValidationMode("query"),this.props.suggestionStore.clear(),this.props.suggestionStore.setQuery(""),"[filtered]"===this.props.groupId?this.props.groupModel.block(this.props.groupId,a):this.props.tagGroupStore.isTagInGroup(a,this.props.groupId)||this.props.groupModel.subscribe(this.props.groupId,a)},getSelectionActive:function(){return this.state.selectionActive},getAutocompleteIdx:function(){return this.state.autocompleteIdx},setComponentState:function(a){this.setState(a)},componentDidMount:function(){this._updateNano()},componentDidUpdate:function(){this._updateNano()},_updateNano:function(){var a=$(this.refs.nano),b=this.refs.content;a.height("inherit").height(b.scrollHeight),a.nanoScroller({preventPageScrolling:!0}),a.children(".pane").is(":visible")?a.addClass("nano-visible"):a.removeClass("nano-visible")},render:function(){var a=this.props.suggestionStore.getLastFinishedQuery(),b=this.props.suggestionStore.getQuery(),c=this.props.suggestionStore.getIsValidQuery(b),d=this.props.suggestionStore.getWhyNot(b),e=this.props.groupId,f=this.props.outsideActiveTagStore.getActiveTag(),g=this.props.suggestionStore.getIsLoading(),h=this.props.suggestionStore.getSuggestions(),i=this.props.tagGroupStore.getFailedTag(),j="",k="",l=[];if(a.length){if(l=_.map(h,_.bind(function(a,b){var c=null!=this.state.autocompleteIdx&&b==this.state.autocompleteIdx&&this.state.selectionActive;return React.DOM.div({onClick:_.partial(this.handleChoice,a.tag),className:"tag suggested"+(c?" hover":"")},React.DOM.span({className:"name"},a.tag),React.DOM.div({className:"add"},React.DOM.span({className:"plus-icon"},"")))},this)),!h.length&&c){var m=g?a:b;l.push(React.DOM.p({id:"new-empty-tag"},React.DOM.span({className:"icon-alert"},""),"Are you sure you want to create ",React.DOM.em(null,m)))}}else l=_.map(this.props.tagGroupStore.getTagsForGroup(e),_.bind(function(a){return React.DOM.div({className:"tag tag-removable "+(a===f?"selected":"")+(this.props.tagGroupStore.isPending(a,e)?" pending":"")},React.DOM.a({onClick:_.partial(this.handleTagClicked,a),href:"/t/"+this._encode(a),className:"name"},a),React.DOM.a({onClick:_.partial(this.handleRemoveClicked,a),href:"#",className:"remove"},""))},this));if(!l.length){var n="";"[filtered]"==this.props.groupId&&(n="Add tags to be filtered out."),l.push(React.DOM.div({className:"empty"},n))}return c||(j=d),i&&(k=i),React.DOM.div(null,React.DOM.div({className:"tag-filter"},React.createElement(Imgur.Tag.AutocompleteComponent,{onSubmit:this.handleChoice,ref:"query",id:this.props.id?this.props.id:"tagbox",type:"text",autoComplete:"off",placeholder:this.props.placeholder,maybeErrorLabel:j,maybeAjaxErrorLabel:k,suggestionStore:this.props.suggestionStore,getAutocompleteIdx:this.getAutocompleteIdx,getSelectionActive:this.getSelectionActive,setComponentState:this.setComponentState})),React.DOM.div({ref:"nano",className:"tag-list-content nano"},React.DOM.div({ref:"content",className:"tag-list-results scroll-content content"},l)))}}),Namespace("Imgur.Tag.Validator"),Imgur.Tag.TagValidator=Class.extend({TAG_REGEX:/^[a-zA-Z0-9\_ ]*$/,init:function(a,b){this._={maxLength:b,minLength:a}},isValidTag:function(a,b,c){return this._validateTag(a,b,c).success},whyNot:function(a,b,c){return this._validateTag(a,b,c).message},_validateTag:function(a,b,c){var d={success:!0,message:null};return b=b.trim().toLowerCase(),null==b.match(Object.getPrototypeOf(this).TAG_REGEX)&&(d.message="Tags can only contain alphanumeric, space, and underscore characters.",d.success=!1),c&&(d.message="This tag has already been added",d.success=!1),"submit"==a&&b.length<this._.minLength?(d.message="Tag is too short. Tags can be between "+this._.minLength+" and "+this._.maxLength+" characters.",d.success=!1):b.length>this._.maxLength&&(d.message="Tag is too long. Tags can be between "+this._.minLength+" and "+this._.maxLength+" characters.",d.success=!1),d}}),Namespace("Imgur.Tag.Validator"),Imgur.Tag.GroupValidator=Class.extend({GROUP_REGEX:/^[a-zA-Z0-9&\-\s]*$/,init:function(a,b){this._={maxLength:b,minLength:a}},isValidGroup:function(a,b){return this._validateGroup(a,b).success},whyNot:function(a,b){return this._validateGroup(a,b).message},_validateGroup:function(a,b){var c={success:!0,message:null};return b=b.trim(),null==b.match(Object.getPrototypeOf(this).GROUP_REGEX)&&(c.message="Galleries can only contain alphanumeric and others (&-).",c.success=!1),"submit"==a&&b.length<this._.minLength?(c.message="Gallery is too short. Galleries can be between "+this._.minLength+" and "+this._.maxLength+" characters.",c.success=!1):b.length>this._.maxLength&&(c.message="Gallery is too long. Galleries can be between "+this._.minLength+" and "+this._.maxLength+" characters.",c.success=!1),c}}),Namespace("Imgur.Tag"),Imgur.Tag.Sentence=Class.extend({init:function(a,b,c){this._={groupStore:c,el:{$before:a,$middle:b}}},get$Before:function(){return this._.el.$before},get$Middle:function(){return this._.el.$middle},change:function(a){"hot"==a?this._.el.$before.text("The"):"gallery-other"==a||"usersub"==a||"subreddit"==a?this._.el.$before.text(""):"tag"==a?this._.el.$before.text("Images tagged with"):"gallery"==a&&this._.el.$before.text("Your");var b=", sorted by";"hot"==a?b="images on the Internet"+b:"usersub"==a||"subreddit"==a?b="images"+b:"gallery"!=a&&"gallery-other"!=a||(b=" gallery"+b),this._.el.$middle.text(b)}}),Namespace("Imgur.Tag.Store"),Imgur.Tag.Store.Suggestion=Class.extend({init:function(a,b){this._={tagValidator:b,emitter:a,suggestions:[],query:"",lastFinishedQuery:"",validationMode:"query",loading:!1}},getIsLoading:function(){return this._.loading},setIsLoading:function(a){this._.loading=a,this._.emitter.trigger("new suggestions")},setValidationMode:function(a){this._.validationMode=a,this._.emitter.trigger("new suggest validation mode")},getIsValidQuery:function(a){return this._.tagValidator.isValidTag(this._.validationMode,a)},getWhyNot:function(a){return this._.tagValidator.whyNot(this._.validationMode,a)},getQuery:function(){return this._.query.toLowerCase()},getLastFinishedQuery:function(){return this._.lastFinishedQuery},setLastFinishedQuery:function(a){this._.lastFinishedQuery=a,this._.emitter.trigger("new finished query")},setQuery:function(a){this._.query=a,this._.emitter.trigger("new suggest query")},getSuggestions:function(){return this._.suggestions},setSuggestions:function(a){this._.suggestions=a,this._.emitter.trigger("new suggestions")},addSuggestion:function(a){this._.suggestions.push(a),this._.emitter.trigger("new suggestions")},clear:function(){this._.suggestions=[],this._.emitter.trigger("new suggestions")}}),Namespace("Imgur.Tag.Store"),Imgur.Tag.Store.CurrentImage=Class.extend({init:function(a){this._={emitter:a,currentImage:null}},setCurrentImage:function(a){this._.currentImage=a,this._.emitter.trigger("current image updated")},getCurrentImage:function(){return this._.currentImage},getCurrentImageId:function(){return this._.currentImage?this._.currentImage.hash:null}}),Namespace("Imgur.Tag.Store"),Imgur.Tag.Store.Group=Class.extend({init:function(a,b){this._={emitter:a,groups:b||{}}},getGroups:function(){return _.filter(_.values(this._.groups),function(a){return!a.deleted})},getGroup:function(a){return this._.groups[a]},haveGroup:function(a){return this._.groups.hasOwnProperty(a)&&!this._.groups[a].deleted},addGroup:function(a){this._.groups[a.hash]=a,this._.emitter.trigger("new group added")},removeGroup:function(a){this._.groups.hasOwnProperty(a)&&delete this._.groups[a],this._.emitter.trigger("group deleted")},markDeleted:function(a){this._.groups.hasOwnProperty(a)&&(this._.groups[a].deleted=!0),this._.emitter.trigger("group deleted")}}),Namespace("Imgur.Tag.Store"),Imgur.Tag.Store.TagImage=Class.extend({SOURCE:{DEFAULT:"default",GALLERY_PAGE:"page",SUGGESTION:"suggestion",USER:"user"},init:function(a){this._={emitter:a,tagsByHash:{},ajaxErrors:{},isLoading:!1}},setAjaxError:function(a,b){this._.ajaxErrors[a]=b,this._.emitter.trigger("ajax error added to post")},unsetAjaxError:function(a){delete this._.ajaxErrors[a],this._.emitter.trigger("ajax error removed from post")},getAjaxError:function(a){return this._.ajaxErrors.hasOwnProperty(a)?this._.ajaxErrors[a]:null},getIsLoading:function(){return this._.isLoading},setIsLoading:function(a){this._.isLoading=!!a,this._.emitter.trigger("ajax tag loading finished")},isTagOnPost:function(a,b){return!!this._.tagsByHash.hasOwnProperty(a)&&this._.tagsByHash[a].hasOwnProperty(b)},getTagsForPost:function(a){return this._.tagsByHash.hasOwnProperty(a)?this._.tagsByHash[a]:[]},haveTagsForPost:function(a){return this._.tagsByHash.hasOwnProperty(a)},addTagForPost:function(a,b,c){if(this._.tagsByHash.hasOwnProperty(a)||(this._.tagsByHash[a]={}),this._.tagsByHash[a].hasOwnProperty(b)){var d=this._.tagsByHash[a][b].source;c=_.merge({},this._.tagsByHash[a][b],c,{source:d})}this._.tagsByHash[a][b]=c,this._.emitter.trigger("tag added to post")},removeTagFromPost:function(a,b){this._.tagsByHash.hasOwnProperty(a)&&this._.tagsByHash[a].hasOwnProperty(b)&&delete this._.tagsByHash[a][b],this._.emitter.trigger("tag removed from post")},getTag:function(a,b){if(!this._.tagsByHash.hasOwnProperty(a))return null;if(!this._.tagsByHash[a].hasOwnProperty(b))return null;var c=this._.tagsByHash[a][b];return c},_getTagProp:function(a,b,c){if(!this._.tagsByHash.hasOwnProperty(a))return null;if(!this._.tagsByHash[a].hasOwnProperty(b))return null;var b=this._.tagsByHash[a][b];return b[c]},_setTagProp:function(a,b,c,d){if(this._.tagsByHash.hasOwnProperty(a)&&this._.tagsByHash[a].hasOwnProperty(b)){var b=this._.tagsByHash[a][b];b[c]=d,this._.emitter.trigger("image tag updated")}},getTagVote:function(a,b){return this._getTagProp(a,b,"vote")},setTagVote:function(a,b,c){this._setTagProp(a,b,"vote",c)},setTagSource:function(a,b,c){this._setTagProp(a,b,"source",c)}}),Namespace("Imgur.Tag.Store"),Imgur.Tag.Store.Tag=Class.extend({INTERESTING_FIELDS:["tag","subscribers","images"],init:function(a,b){this._={emitter:a,tags:{},limit:b||0}},getTag:function(a){return this._.tags[a]},getTags:function(){return this._.tags},haveTag:function(a){return this._.tags.hasOwnProperty(a)},getTagSubscribers:function(a){return this._.tags.hasOwnProperty(a)&&this._.tags[a].hasOwnProperty("subscribers")?this._.tags[a].subscribers:"n/a"},addTag:function(a){if(0==this._.limit||Object.keys(this.getTags()).length!=this._.limit){var b={};this._.tags.hasOwnProperty(a.tag)&&(b=this._.tags[a.tag]),a=_.pick(a,this.INTERESTING_FIELDS),this._.tags[a.tag]=_.merge({},b,a),this._.emitter.trigger("tag updated")}else this._.emitter.trigger("tag limit reached")},removeTag:function(a){delete this._.tags[a],this._.emitter.trigger("tag removed")},setFollowing:function(a,b){var c=this.getTag(a);c&&(c.following=b)},encode:function(a){return encodeURIComponent(a.replace(new RegExp(" ","g"),"_"))}}),Namespace("Imgur.Tag.Store"),Imgur.Tag.Store.TagGroup=Class.extend({ACTIONS:{ADDED:"added",REMOVED:"removed",ERROR:"error"},init:function(a){this._={emitter:a,groupsByTag:{},tagsByGroup:{},pendingAddTags:{},groupsEventHistory:{},failedTag:""}},pushHistory:function(a,b,c){this._.groupsEventHistory.hasOwnProperty(a)||(this._.groupsEventHistory[a]={}),this._.groupsEventHistory[a].hasOwnProperty(b)||(this._.groupsEventHistory[a][b]=[]),this._.groupsEventHistory[a][b].push({time:Date.now(),action:c}),this._.emitter.trigger("new tag-group event")},getLatestTagGroupEvent:function(a,b){if(!this._.groupsEventHistory.hasOwnProperty(a)||!this._.groupsEventHistory[a].hasOwnProperty(b))return null;var c=this._.groupsEventHistory[a][b],d=c[c.length-1];return d},isTagInGroup:function(a,b){return!!this._.groupsByTag.hasOwnProperty(a)&&(this._.groupsByTag[a].indexOf(b)!==-1||this._.pendingAddTags.hasOwnProperty(b)&&this._.pendingAddTags[b].indexOf(a)!==-1)},getTagsForGroup:function(a){return this._.tagsByGroup.hasOwnProperty(a)?this._.pendingAddTags.hasOwnProperty(a)?this._.tagsByGroup[a].concat(this._.pendingAddTags[a]):this._.tagsByGroup[a]:[]},getGroupHashesForTag:function(a){return this._.groupsByTag.hasOwnProperty(a)?this._.groupsByTag[a]:[]},addTagToGroup:function(a,b){this._.groupsByTag.hasOwnProperty(a)||(this._.groupsByTag[a]=[]),this._.tagsByGroup.hasOwnProperty(b)||(this._.tagsByGroup[b]=[]),this._.groupsByTag[a].push(b),this._.tagsByGroup[b].push(a),this._.emitter.trigger("tag added to group")},removeTagFromGroup:function(a,b){this._.groupsByTag.hasOwnProperty(a)&&(this._.groupsByTag[a]=_.filter(this._.groupsByTag[a],function(a){return a!=b})),this._.tagsByGroup.hasOwnProperty(b)&&(this._.tagsByGroup[b]=_.filter(this._.tagsByGroup[b],function(b){return b!=a})),this._.emitter.trigger("tag removed from group")},addPendingTag:function(a,b){this._.pendingAddTags[b]&&this._.pendingAddTags[b].length?this._.pendingAddTags[b].push(a):this._.pendingAddTags[b]=[a],this._.emitter.trigger("pending tag added to group")},removePendingTag:function(a,b){var c=this._.pendingAddTags[b].indexOf(a);c>-1&&(this._.pendingAddTags[b].splice(c,1),this._.emitter.trigger("pending tag removed from group"))},isPending:function(a,b){return!!this._.pendingAddTags.hasOwnProperty(b)&&_.contains(this._.pendingAddTags[b],a)},getFailedTag:function(){return this._.failedTag},setFailedTag:function(a){this._.failedTag=a},getTags:function(){return this._.groupsByTag}}),Namespace("Imgur.Tag.Store"),Imgur.Tag.Store.OutsideActiveTag=Class.extend({init:function(a){this._={emitter:a,activeTag:null}},getIsActive:function(){return null!=this._.activeTag},getActiveTag:function(){return this._.activeTag},getActiveTagEncoded:function(){return this._.activeTag.replace(new RegExp(" ","g"),"_")},setActiveTag:function(a,b){this._.activeTag=a,this._.emitter.trigger("new outside active tag",!!b)},deactivate:function(a){this._.activeTag=null,this._.emitter.trigger("new outside active tag",!!a)}}),Namespace("Imgur.Tag.Controller"),Imgur.Tag.Controller.OutsideComponent=Class.extend({init:function(a,b){this._={suggestionModel:a,suggestionStore:b}},handleChangedQuery:function(){var a=this._.suggestionStore.getQuery();this._.suggestionStore.setIsLoading(!0),this._.suggestionModel.cancel(),this._.suggestionModel.fetch(a,_.bind(this._handleSuggestResponse,this),_.bind(this._handleSuggestError,this,a))},_handleSuggestResponse:function(a,b){this._.suggestionStore.setSuggestions(b),this._.suggestionStore.setIsLoading(!1),this._.suggestionStore.setLastFinishedQuery(a)},_handleSuggestError:function(a){this._.suggestionStore.setLastFinishedQuery(a),this._.suggestionStore.setIsLoading(!1)}}),Namespace("Imgur.Tag.Controller"),Imgur.Tag.Controller.UserGroup=Class.extend({init:function(a,b,c,d,e,f,g,h){this._={groupModel:b,activeGroupId:c,group:d,groupList:e,emitter:a,cboxConfirm:f,confirmTarget:"#colorbox-confirm",el:{$confirmMessage:g,$confirmTitle:h}}},handleRemoveConfirmedEvent:function(a){this._.group.remove(),this._.emitter.trigger("group.remove",this._.group.getId()),this._.group.getId()==this._.activeGroupId&&this._.emitter.trigger("command.location","/")},handleRemoveEvent:function(a){a.stopPropagation(),this._.el.$confirmTitle.html("Delete "+this._.group.getName()+"?"),this._.el.$confirmMessage.html('Are you sure you want to delete the gallery <span class="green">'+this._.group.getName()+"</span>?"),this._.cboxConfirm.show(this._.confirmTarget,_.bind(this.handleRemoveConfirmedEvent,this,a))},handleRemovedTagEvent:function(a,b){b.stopPropagation(),this._.groupList.remove(a),this._.groupList.removeCoreSet(a),this._.groupModel.unsubscribe(this._.group.getId(),a.getName(),_.bind(function(){this._.emitter.trigger("new tagset")},this)),this._.emitter.trigger("show tagset loader")},handleRemoveEventOther:function(a){a==this._.group.getId()&&this._.group.remove()},setList:function(a){this._.groupList=a,this._.group.setList(a)}}),Namespace("Imgur.Tag.Controller"),Imgur.Tag.Controller.GroupSelectorLimits=Class.extend({init:function(a,b,c){this._={emitter:a,groupSelector:b,groupStore:c}},_disableNew:function(){this._.groupSelector.disableNewGroupButton()},_enableNew:function(){this._.groupSelector.enableNewGroupButton()},handleGroupRemove:function(a){this._.groupSelector.removeUserGroup(a),this._.groupStore.markDeleted(a),this._.groupSelector.getRemainingUserGroups()>0&&this._enableNew()},handleGroupAdd:function(a){this._.groupSelector.addUserGroup(a),this._.groupStore.addGroup({hash:a.getId(),name:a.getName(),account_id:Imgur.Environment.auth.id,account_url:Imgur.Environment.auth.url}),this._.groupSelector.getRemainingUserGroups()<=0&&this._disableNew()}}),Namespace("Imgur.Tag"),Imgur.Tag.SuggestedTag=Imgur.Tag.Tag.extend({VOTE_UP:"up",init:function(a,b){this._super(a),this._.groupId=b,this._.el.$addBtn=a,this._.el.$subscribers=a.find(".subscribers")},getGroupId:function(){return this._.groupId},get$Add:function(){return this._.el.$addBtn},getSubscribers:function(){return Number(this._.el.$subscribers.attr("data-subscribers"))},get$ExternalLink:function(){return this._.el.$container.find(".external-link")}}),Imgur.Elements.Copy=React.createClass({displayName:"Copy",getDefaultProps:function(){return{inputClass:""}},copy:function(){var a=this.refs.value;a.select();try{document.execCommand("copy"),window.getSelection().removeAllRanges()}catch(b){}flashElement($(a),100,null)},selectAll:function(){ReactDOM.findDOMNode(this.refs.value).select()},render:function(){var a,b=this.props.inputClass;return document.queryCommandSupported("copy")?a=React.DOM.button({onClick:this.copy,className:this.props.copyClass},"Copy"):(a=React.DOM.button({className:this.props.copyClass+" copy-button-unsupported"}),b+=" copy-input-unsupported"),b+=" copyflash",React.DOM.div({className:"copywrapper"},React.DOM.input({type:"text",value:this.props.value,ref:"value",className:b,onClick:this.selectAll,readOnly:!0}),a)}}),Imgur.Flash=React.createClass({displayName:"Flash",getDefaultProps:function(){return{delay:1e3}},getInitialState:function(){return{visible:!1}},componentWillReceiveProps:function(a){a.start===this.props.start&&a.delay===this.props.delay||(this._installTimer(a.start),this.setState({visible:!0}))},_getDuration:function(a){return Math.max(0,a+this.props.delay-+new Date)},componentDidMount:function(){this._getDuration(this.props.start)>0&&(this._installTimer(this.props.start),this.setState({visible:!0}))},_installTimer:function(a){null!==this._timer&&(window.clearTimeout(this._timerRef),this._timerRef=null);var b=this._getDuration(a);this._timerRef=window.setTimeout(_.bind(this._handleTimerExpired,this),b)},_handleTimerExpired:function(){this.setState({visible:!1}),this._timerRef=null},render:function(){return React.createElement(React.addons.CSSTransitionGroup,{transitionName:"flash"},this.state.visible?React.DOM.div(null,this.props.children):null)}});var _extends=Object.assign||function(a){for(var b=1;b<arguments.length;b++){var c=arguments[b];for(var d in c)Object.prototype.hasOwnProperty.call(c,d)&&(a[d]=c[d])}return a};Namespace("Imgur.Elements");var styles={spring:{stiffness:120,damping:9},button:{maxScale:1.25}};Imgur.Elements.PressButton=React.createClass({displayName:"PressButton",propTypes:{isPressed:React.PropTypes.bool,onPress:React.PropTypes.func},getDefaultProps:function(){return{style:{}}},getInitialState:function(){return{isPressed:!1}},isLeftClick:function(a){a=a||window.event;var b=a.which||a.button;return b<2},handleMouseDown:function(a){this.isLeftClick(a)&&this.setState({isPressed:!0})},handleMouseUp:function(a){this.isLeftClick(a)&&(this.props.onPress(),this.setState({isPressed:!1}))},handleMouseLeave:function(){this.setState({isPressed:!1})},render:function(){var a=this,b=this.state.isPressed?styles.button.maxScale:1,c={scale:ReactMotion.spring(b,styles.spring)};return React.createElement(ReactMotion.Motion,{defaultStyle:{scale:1},style:c},function(b){var c=b.scale;return React.createElement("button",_extends({},a.props,{onMouseDown:a.handleMouseDown,onMouseUp:a.handleMouseUp,onMouseLeave:a.handleMouseLeave,style:_extends({transform:"scale("+c+")",WebkitTransform:"scale("+c+")"},a.props.style)}),a.props.children)})}}),Namespace("Imgur.Elements"),Imgur.Elements.NanoScroller=React.createClass({displayName:"NanoScroller",componentDidUpdate:function(){$(ReactDOM.findDOMNode(this.refs.container)).nanoScroller()},componentWillUnmount:function(){this.scrollContainer.nanoScroller({destroy:!0})},render:function(){return React.createElement("div",{ref:"container",className:"js-nanoscroller nano "+this.props.classes,onScroll:this.props.onScroll},React.createElement("div",{className:"scroll-content content cf"},this.props.children))}}),Namespace("Imgur.Elements"),Imgur.Elements.Socialicons=React.createClass({displayName:"Elements-Socialicons",getDefaultProps:function(){return{classes:""}},socialShare:function(a){var b=window.location.href,c="left=20,top=20,width=560,height=500,toolbar=1",d=$(".post-title").text(),e=Imgur.UserStatistics.getInstance();switch(e.emitActionUserShare(this.props.hash,a,this.props.tagsNames),Imgur.Util.jafoLogEvent(Imgur.AnalyticCategories.SHARE,Imgur.AnalyticEventNames.selected,{Type:"Post",Destination:a}),a){case"Facebook":b="https://www.facebook.com/sharer/sharer.php?u="+encodeURIComponent(b),c="left=20,top=20,width=500,height=500,toolbar=1";break;case"Twitter":b="https://twitter.com/home?status="+encodeURIComponent(d+" "+b);break;case"Pinterest":b="https://pinterest.com/pin/create/button/?url="+encodeURIComponent(b)+"&media="+encodeURIComponent($(".post-images img")[0].src)+"&description="+d,c="left=20,top=20,width=750,height=601,toolbar=1";break;case"Reddit":b="//www.reddit.com/submit?title="+encodeURIComponent(d)+"&url="+encodeURIComponent(b),c="left=20,top=20,width=860,height=700,toolbar=1"}window.open(b,"sharer",c)},render:function(){return React.createElement("div",{className:this.props.classes},React.createElement("span",{ref:"facebook",className:"social-icon icon-f",onClick:this.socialShare.bind(null,"Facebook")}),React.createElement("span",{className:"social-icon icon-twttr",onClick:this.socialShare.bind(null,"Twitter")}),React.createElement("span",{className:"social-icon icon-pin",onClick:this.socialShare.bind(null,"Pinterest")}),React.createElement("span",{className:"social-icon icon-reddit",onClick:this.socialShare.bind(null,"Reddit")}))}}),Namespace("Imgur.Elements"),Imgur.Elements.Mute=React.createClass({propTypes:{url:React.PropTypes.string.isRequired,type:React.PropTypes.string},displayName:"ElementsMute",handleSubmit:function(){$.ajax({url:this.props.url,method:"POST",xhrFields:{withCredentials:!0}}).done(this.closeColorbox).fail(function(){humanMsg.displayMsg("Unable to mute user. Please try again","error-msg")}),this.props.type===Imgur.Elements.Mute.types.comment&&Imgur.Util.jafoLogEvent(Imgur.AnalyticCategories.POST,Imgur.AnalyticEventNames.commentInteracted,{Type:"Mute"})},closeColorbox:function(){$.colorbox.close()},render:function(){var a=this;return React.createElement("div",null,React.createElement("h2",null,"Mute User"),React.createElement("p",{className:"mute-text"},"New replies, comments on your posts, mentions, and messages from this user will be muted."),React.createElement("div",{className:"mute-footer"},React.createElement("button",{className:"btn-nebula btn-action btn-small right bold",type:"button",ref:"mute",onClick:function(b){b.preventDefault(),a.handleSubmit()}},"Mute"),React.createElement("a",{className:"btn right",ref:"cancel",onClick:function(b){b.preventDefault(),a.closeColorbox()}},"Cancel")),React.createElement("div",{className:"clear"}))}}),Imgur.Elements.Mute.dimensions={width:400,height:280},Imgur.Elements.Mute.types={comment:"comment"},Namespace("Imgur.Elements"),Imgur.Elements.Report=React.createClass({propTypes:{type:React.PropTypes.string.isRequired,url:React.PropTypes.string.isRequired,metadata:React.PropTypes.object,cb:React.PropTypes.func},displayName:"ElementsReport",strings:{abuse:"Abusive/Offensive",abuseExplanation:function(a){return"This "+a+" contains racism, sexism, slurs, personal attacks, death threats, suicide requests or any form of hate speech."},dboi:"Does Not Belong On Imgur",dboiExplanation:function(a){return"This "+a+" contains illegal activity, suicide threats, personal information, or something else you think doesn't belong on Imgur."},defaultCombobox:"SELECT A REASON",explicit:"Sexually Explicit",explicitExplanation:function(a){return"This "+a+" contains pornography, full or partial nudity."},mature:"Mature",matureExplanation:function(a){return"This "+a+" contains suggestive or provocative content."},matureSettings:React.createElement("div",null,"If you don't want to see mature content on Imgur, please change your ",React.createElement("a",{href:"/account/settings"},"safety settings"),"."),matureWarning:function(a){return"(This "+a+" is already marked as mature)"},spam:"Spam",reportHeading:function(a){return"Report "+a},spamExplanation:function(a){return"This "+a+" contains clickbait, advertising, scams or script bots."}},reportValues:{DBOI:1,SPAM:2,ABUSE:3,MATURE:4,EXPLICIT:5},getInitialState:function(){return{value:null}},getDefaultProps:function(){return{metadata:{}}},shouldComponentUpdate:function(a,b){return this.state.value!==b.value},handleSubmit:function(a){if(a.preventDefault(),this.state.value){var b={sid:Imgur.Environment.msid,type:this.state.value,hash:this.props.metadata.hash};this.props.metadata.isAlbum&&(b.isAlbum=!0),this.props.type===Imgur.Elements.Report.types.comment&&Imgur.Util.jafoLogEvent(Imgur.AnalyticCategories.POST,Imgur.AnalyticEventNames.commentInteracted,{Type:"Report"}),$.post(this.props.url,b),Imgur.Gallery.getInstance().preventReportCloseAnalytics(),$.colorbox.close(),humanMsg.displayMsg("Thanks for reporting!"),"function"==typeof this.props.cb&&this.props.cb()}},setValue:function(a){this.setState({value:a})},render:function(){var a=this.props.type,b=null,c=this.strings.matureExplanation(a),d=this.props.metadata.nsfw;d&&(b=this.strings.matureWarning(a),c=this.strings.matureSettings);var e=[Imgur.Elements.RadioBox.createItem(this.strings.mature,c,this.reportValues.MATURE,b,d),Imgur.Elements.RadioBox.createItem(this.strings.explicit,this.strings.explicitExplanation(a),this.reportValues.EXPLICIT),Imgur.Elements.RadioBox.createItem(this.strings.spam,this.strings.spamExplanation(a),this.reportValues.SPAM),Imgur.Elements.RadioBox.createItem(this.strings.abuse,this.strings.abuseExplanation(a),this.reportValues.ABUSE),Imgur.Elements.RadioBox.createItem(this.strings.dboi,this.strings.dboiExplanation(a),this.reportValues.DBOI)],f=!this.state.value&&"btn-nebula-inactive";return React.createElement("div",null,React.createElement("h2",null,this.strings.reportHeading(a)),React.createElement(Imgur.Elements.RadioBox,{name:"reportpost",enabled:this.state.enabled,items:e,onChange:this.setValue}),React.createElement("div",{className:"report-footer"},React.createElement("p",{className:"community_rules"},"For more info please read the ",React.createElement("a",{target:"_blank",href:"https://imgur.com/rules"},"Community Rules")),React.createElement("button",{className:"btn-nebula "+f+" btn-action btn-small right bold",
type:"button",onClick:this.handleSubmit},"Report")))}}),Imgur.Elements.Report.dimensions={width:540,height:680},Imgur.Elements.Report.types={comment:"comment"},Namespace("Imgur.Elements"),Imgur.Elements.FavoriteFolderChooser=React.createClass({displayName:"FavoriteFolderChooser",getInitialState:function(){var a=window.localStorage.getItem("folders");return{addingFolder:!1,folders:a?JSON.parse(a):[]}},handleSelect:function(a,b,c){var d=Imgur.InsideNav.getInstance()._.image.is_album?"album":"image",e=Imgur.InsideNav.getInstance()._.image.hash;c.preventDefault(),window.fetch("https://api."+Imgur.Environment.host+"/3/folders/"+a+"/favorites/"+d+"/"+e,{method:"PUT",credentials:"include"}).then(function(a){return a.json()}).then(function(a){return a.data&&a.data.error?void humanMsg.displayMsg(a.data.error,"error-msg"):(Imgur.Util.jafoLog({event:"addedToFolder",meta:_.merge(Imgur.Gallery.getInstance().getGalleryMetadata(),{location:"inside"})}),void humanMsg.displayMsg("Added to "+b))}),this.props.emitter.trigger("addedToFolder"),$.colorbox.close()},handleNewFolder:function(a){var b=this;a.preventDefault();var c=this.refs.newFolderName.value.trim();c&&this.state.folders.indexOf(c)===-1&&window.fetch("https://api."+Imgur.Environment.host+"/3/folders",{method:"POST",credentials:"include",headers:{"content-type":"application/json"},body:JSON.stringify({name:c})}).then(function(a){return a.json()}).then(function(a){if(a.data.error)return void humanMsg.displayMsg(a.data.error,"error-msg");var c=[a.data].concat(b.state.folders);b.setState({addingFolder:!1,folders:c}),window.localStorage.setItem("folders",JSON.stringify(c))})},componentDidMount:function(){var a=this;window.fetch("https://api."+Imgur.Environment.host+"/3/folders",{credentials:"include"}).then(function(a){return a.json()}).then(function(b){a.setState({folders:b.data}),window.localStorage.setItem("folders",JSON.stringify(b.data))})},componentDidUpdate:function(){this.state.addingFolder&&this.refs.newFolderName&&this.refs.newFolderName.focus()},addFolderForm:function(){var a=this;return this.state.addingFolder?React.createElement("form",{className:"Folder-Chooser-Create Folder-Chooser-folder Folder-Chooser-new",onSubmit:this.handleNewFolder},React.createElement("input",{onFocus:function(a){return a.target.select()},ref:"newFolderName",type:"text",defaultValue:"New Folder",onBlur:this.handleNewFolder})):React.createElement("div",{onClick:function(){return a.setState({addingFolder:!0})},className:"Folder-Chooser-folder Folder-Chooser-new"},"New Folder")},render:function(){var a=this,b=323,c=this.state.folders.map(function(b){var c=b.name,d=b.id,e=b.is_private;return React.createElement("div",{key:d,onClick:a.handleSelect.bind(a,d,c),className:"Folder-Chooser-folder"},e?React.createElement("span",{className:"icon-lock-private-folder"}):null,c)});return React.createElement("div",{className:"Folder-Chooser"},React.createElement("h2",null,"Add to Folder"),this.addFolderForm(),React.createElement("h2",null,"Newest"),React.createElement("div",{className:"Folder-Chooser-list",style:{height:this.props.height-b}},c))}}),Namespace("Imgur.Elements"),Imgur.Elements.RadioBox=React.createClass({displayName:"RadioBox",propTypes:{name:React.PropTypes.string.isRequired,items:React.PropTypes.array.isRequired,onChange:React.PropTypes.func},onComponentDidMount:function(){this.refs.RadioBox.focus()},onClick:function(a,b){b||(this.refs["RadioBox-item-"+a].focus(),this.props.onChange&&this.props.onChange(a))},renderItem:function(a){var b="RadioBox-item-"+a.value;return React.createElement("label",{ref:b,key:""+b,className:"RadioBox-item",onClick:this.onClick.bind(this,a.value,a.disabled)},React.createElement("input",{ref:b+"-radio",disabled:a.disabled,className:"RadioBox-radio",type:"radio",name:this.props.name}),React.createElement("div",{ref:b+"-checkbox",className:"RadioBox-checkbox"}," "),React.createElement("div",null,React.createElement("div",{ref:b+"-title",className:"RadioBox-title"},a.title," ",React.createElement("span",{ref:b+"-warning",className:"RadioBox-warning"},a.warning)),React.createElement("div",{ref:b+"-description",className:"RadioBox-description"},a.description)))},render:function(){var a=this.props.items.map(this.renderItem,this);return React.createElement("div",{ref:"RadioBox",className:"RadioBox"},a)}}),Imgur.Elements.RadioBox.createItem=function(a,b,c){var d=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,e=arguments.length>4&&void 0!==arguments[4]&&arguments[4];return{title:a,description:b,value:c,warning:d,disabled:e}},function(a){function b(a){return a.replace(/(:|\.)/g,"\\$1")}var c="1.4.7",d={exclude:[],excludeWithin:[],offset:0,direction:"top",scrollElement:null,scrollTarget:null,beforeScroll:function(){},afterScroll:function(){},easing:"swing",speed:400,autoCoefficent:2},e=function(b){var c=[],d=!1,e=b.dir&&"left"==b.dir?"scrollLeft":"scrollTop";return this.each(function(){if(this!=document&&this!=window){var b=a(this);b[e]()>0?c.push(this):(b[e](1),d=b[e]()>0,d&&c.push(this),b[e](0))}}),c.length||this.each(function(a){"BODY"===this.nodeName&&(c=[this])}),"first"===b.el&&c.length>1&&(c=[c[0]]),c};"ontouchend"in document;a.fn.extend({scrollable:function(a){var b=e.call(this,{dir:a});return this.pushStack(b)},firstScrollable:function(a){var b=e.call(this,{el:"first",dir:a});return this.pushStack(b)},smoothScroll:function(c){c=c||{};var d=a.extend({},a.fn.smoothScroll.defaults,c),e=a.smoothScroll.filterPath(location.pathname);return this.unbind("click.smoothscroll").bind("click.smoothscroll",function(c){var f=this,g=a(this),h=d.exclude,i=d.excludeWithin,j=0,k=0,l=!0,m={},n=location.hostname===f.hostname||!f.hostname,o=d.scrollTarget||(a.smoothScroll.filterPath(f.pathname)||e)===e,p=b(f.hash);if(d.scrollTarget||n&&o&&p){for(;l&&j<h.length;)g.is(b(h[j++]))&&(l=!1);for(;l&&k<i.length;)g.closest(i[k++]).length&&(l=!1)}else l=!1;l&&(c.preventDefault(),a.extend(m,d,{scrollTarget:d.scrollTarget||p,link:f}),a.smoothScroll(m))}),this}}),a.smoothScroll=function(b,c){var d,e,f,g,h=0,i="offset",j="scrollTop",k={},l={};"number"==typeof b?(d=a.fn.smoothScroll.defaults,f=b):(d=a.extend({},a.fn.smoothScroll.defaults,b||{}),d.scrollElement&&(i="position","static"==d.scrollElement.css("position")&&d.scrollElement.css("position","relative"))),d=a.extend({link:null},d),j="left"==d.direction?"scrollLeft":j,d.scrollElement?(e=d.scrollElement,h=e[j]()):e=a("html, body").firstScrollable(),d.beforeScroll.call(e,d),f="number"==typeof b?b:c||a(d.scrollTarget)[i]()&&a(d.scrollTarget)[i]()[d.direction]||0,k[j]=f+h+d.offset,g=d.speed,"auto"===g&&(g=k[j]||e.scrollTop(),g/=d.autoCoefficent),l={duration:g,easing:d.easing,complete:function(){d.afterScroll.call(d.link,d)}},d.step&&(l.step=d.step),e.length?e.stop().animate(k,l):d.afterScroll.call(d.link,d)},a.smoothScroll.version=c,a.smoothScroll.filterPath=function(a){return a.replace(/^\//,"").replace(/(index|default).[a-zA-Z]{3,4}$/,"").replace(/\/$/,"")},a.fn.smoothScroll.defaults=d}(jQuery),this._=this._||{},this._.templates=this._.templates||{},this._.templates.favoriteBar=function(obj){function print(){__p+=__j.call(arguments,"")}obj||(obj={});var __t,__p="",__e=_.escape,__j=Array.prototype.join;with(obj)__p+='<div id="favorite-bar">\n    <div original-title="Favorite" class="favorite-image title ',favorited&&(__p+="favorited"),__p+='" href="javascript:;">\n        <span class="icon-fav"></span>\n    </div>\n    <div class="clipboard-container" id="copy-container" title="copy">\n        <div class="icon-copy" id="copy-clipboard"></div>\n    </div>\n    <input type="hidden" id="copy" value="'+(null==(__t=value)?"":__t)+'" readonly="readonly" />\n</div>';return __p},Namespace("Imgur.Promoted");var youtube_ready=!1,youtube_iframes={};Imgur.Promoted=Class.extend({init:function(a,b,c,d,e,f,g,h,i){this._={env:h,logAnalytics:i||function(){},ele:{},config:a,emitter:b,events:e,eventsBound:!1,navs:0,navHashes:[],failMode:!1,isUsingAdBlocker:window.ADBLOCKED!==!1,zrkRegex:/^https:\/\/zrk\.imgur\.com\/.+$/,reservations:[],ads:{},order:[],source:f,rgxSubreddit:/\/r\/([^\/]+)/,rgxPxMacroTimestamp:/[\{\[\%]+(timestamp|cachebust(er)?)[\}\]\%]+/gi,rgxPxMacroRandom:/[\{\[\%]+random[\}\]\%]+/gi,pxMacroRandomLength:10,allowedRandomChars:"abcdefghijklmnopqrstuvwxyz0123456789",inside:c,sectSortWindow:"",sideGallery:d,thumbnailSizes:{wide:"288x141",normal:"141x141"},enabled:g&&!0,youtubeViewabilityTimer:1e3,youtubeMinViewTime:3,waitImpressionEvent:!1,impressionEvents:["IMPRESSION_POST","CLICK_THUMB"],semaphore:0},b.on("gotPromoted",this,this.handleReservation),b.on("sidegalleryPageLoad",this,this.handleNewGalleryPage),b.on("postRendering",this,this.handleNav),b.on("postRendered",this,this.handlePostRendered),b.on("displayPromoted",this,this.handleDisplay),b.on("promoEvent",this,this.handleDomEvent),this._.env.image.isAd&&(this.bindGameLink(this._.env.image.hash),this.initYouTubeAutoPlayMute())},eventsEval:function(a){a in this._.ads?(this._.events.bindAll(),this._.eventsBound=!0):this._.eventsBound&&(this._.events.bindAll(!0),this._.eventsBound=!1)},handleDomEvent:function(a){var b,c=Imgur.Util.dive(a,"data.promoEvent");if(c)for(_.isArray(c)||(c=[c]),b=0;b<c.length;b++)this.pixel(this._.inside.getHash(),c[b])},handleNav:function(a,b,c){var d=a.hash;if(this._.enabled&&(this._.youtubeViewabilityInterval&&this.resetYouTubeAutoPlayMute(),a.isAd&&this.initYouTubeAutoPlayMute(),isNaN(this._.navs)&&(this._.navs=0),!(this._.config.skipPromoNav&&d in this._.ads)&&(!(this._.config.onlyUniqueNavs&&_.indexOf(this._.navHashes,d)>-1)||a.isAd))){this._.navHashes.push(d),this._.navs++;var e=this._.navHashes.length==this._.config.populateFirstThreshold+1,f=this._.navs>0&&this._.navs>=this._.config.navThreshold;if(b||e||f){this._.navs=0,d=this._.sideGallery.uniqueId(d,a.promotedPlacementCount);var g=this._.sideGallery.nthFromHash(isNaN(c)?this._.config.distance:c,d),h=this._.sideGallery.nthFromHash(1,g);if(!this.isSafeForPromotedPostInsertion(this._.sideGallery.getImage(g))||!this.isSafeForPromotedPostInsertion(this._.sideGallery.getImage(h)))return;if(this._.failMode)return void this.flagHashForPromotedInventoryAnalytics(g);if(this._.reservations.push(g),this._.waitImpressionEvent)return this._.emitter.once("wantPromoted",this._.source,this._.source.getPlacement),void(this._.waitImpressionEvent=!1);this._.source.getPlacement()}}},isSafeForPromotedPostInsertion:function(a){return!a||!a.adConfig||0==a.adConfig.highRiskFlags.length&&0==a.adConfig.unsafeFlags.length},handlePostRendered:function(a){this.eventsEval(a.hash)},flagHashForPromotedInventoryAnalytics:function(a){var b=this._.sideGallery.hashPosition(a);if(!isNaN(b)){var c=b+1;this._.sideGallery.state.items[c].promotedPostRequestExpected=!0}},handleDisplay:function(a){var b;this.bindGameLink(a),a in this._.ads&&(b=this._.ads[a],this._.waitImpressionEvent=!0,this._.semaphore=0,this.pixel(a,"IMPRESSION_POST"),this.pixel(a,"CLICK_THUMB"),this.placeCompanion(a),Imgur.Util.jafoLog({event:"ppConv",meta:{hash:a,flightId:Imgur.Util.dive(b,"parts.thumb.flightId"),campaignId:Imgur.Util.dive(b,"parts.thumb.campaignId"),thumbnailSize:Imgur.Util.dive(b,"parts.data.thumbnail_json.size")||this._.thumbnailSizes.normal}}))},bindGameLink:function(a){var b=".play-the-game",c=["0OcVZlb","CZf9o","sAEyl","Dj5dm"];c.indexOf(a)>-1&&$(".post-container").off("click",b,this.handleGameLink).on("click",b,this.handleGameLink)},handleGameLink:function(a){$.colorbox({href:"//www.youroldspicegame.com/",iframe:!0,transition:"fade",width:"1000px",height:"640px",scrolling:!1,trapFocus:!0,top:"50px",onClose:function(){},onComplete:function(){},onOpen:function(){}})},setYouTubeAutoPlayMuteIframes:function(){for(var a in youtube_iframes)youtube_iframes[a].dom&&!document.body.contains(youtube_iframes[a].dom)&&(youtube_iframes[a].isPlaying=!1,youtube_iframes[a].player=null,youtube_iframes[a].dom=null);for(var b=$(".post-image-description .youtube-autoplay-mute"),c=0;c<b.length;c++){var a=b[c].src;youtube_iframes.hasOwnProperty(a)?(youtube_iframes[a].player&&(youtube_iframes[a].soundOn=youtube_iframes[a].player.isMuted(),youtube_iframes[a].isPlaying=youtube_iframes[a].player.getPlayerState()!=YT.PlayerState.PAUSED,youtube_iframes[a].currentTime=youtube_iframes[a].player.getCurrentTime(),youtube_iframes[a].isPlaying&&(youtube_iframes[a].timeViewed+=this._.youtubeViewabilityTimer/1e3,youtube_iframes[a].timeViewed==this._.youtubeMinViewTime&&Imgur.Util.jafoLog({event:"videoView",meta:{hash:youtube_iframes[a].hash}}))),youtube_iframes[a].dom=b[c]):youtube_iframes.hasOwnProperty(a)||(youtube_iframes[a]={soundOn:!1,isPlaying:!1,manuallyPaused:!1,currentTime:0,timeViewed:0,videoLength:0,player:null,hash:null,dom:b[c]})}},initYouTubeAutoPlayMute:function(){this.setYouTubeAutoPlayMuteIframes(),!youtube_ready&&Object.keys(youtube_iframes).length&&($.getScript("//www.youtube.com/iframe_api",_.bind(function(){window.addEventListener("beforeunload",_.bind(function(){this.resetYouTubeAutoPlayMute()},this))},this)),youtube_ready=!0),this._.youtubeViewabilityInterval=clearInterval(this._.youtubeViewabilityInterval),this._.youtubeViewabilityInterval=setInterval(_.bind(this.handleYouTubeAutoPlayMuteUpdate,this),this._.youtubeViewabilityTimer)},handleYouTubeAutoPlayMuteUpdate:function(){youtube_ready?(this.setYouTubeAutoPlayMuteIframes(),onYouTubeIframeAPIReady()):this.initYouTubeAutoPlayMute()},resetYouTubeAutoPlayMute:function(){for(var a in youtube_iframes)Imgur.Util.jafoLog.direct({event:"videoFinished",meta:{hash:youtube_iframes[a].hash,soundOn:youtube_iframes[a].soundOn,timeViewed:youtube_iframes[a].timeViewed,videoLength:youtube_iframes[a].videoLength,percViewed:Math.min(1,youtube_iframes[a].timeViewed/youtube_iframes[a].videoLength)}});this._.youtubeViewabilityInterval=clearInterval(this._.youtubeViewabilityInterval),youtube_iframes={}},tagSectionIsFiltered:function(){return"tag"===this._.inside._.section&&!!this._.env.tagSectionIsPromoted},sectionIsFiltered:function(){var a=this._.config.filteredSections&&this._.sideGallery.state.section in this._.config.filteredSections,b=_.indexOf(this._.config.filteredSections,this._.sideGallery.state.section)>-1;return"subreddit"===this._.sideGallery.state.section?!this.subredditIsAllowed():!(!a&&!b)&&("object"!=typeof this._.config.filteredSections[this._.sideGallery.state.section]||_.indexOf(this._.config.filteredSections[this._.sideGallery.state.section],this._.sideGallery.state.sort)>-1)},subredditIsAllowed:function(){var a=this._.sideGallery.state.source,b=a?a.match(this._.rgxSubreddit):null;return!(!b||2!==b.length)&&_.indexOf(this._.config.allowedSubreddits,b[1].toLowerCase())>-1},handleNewGallery:function(){var a=isNaN(this._.config.populateFirstDistance)?this._.config.distance:this._.config.populateFirstDistance;if(this.tagSectionIsFiltered())return void(this._.enabled=!1);if(this.sectionIsFiltered())return void(this._.enabled=!1);if(this._.navs=0,this._.inside._.image.isAd)return void this._.order.push(this._.inside._.image.hash);if(this._.config.populateFirst){var b=this._.inside.getHash();this.handleNav(this._.inside.getSideGallery().getImage(b),!0,a)}},handleNewGalleryPage:function(a){"initial"===a&&this.handleNewGallery()},nextLocIsFlushedLeft:function(a){return 0===$("#item-"+a).position().left},handleReservation:function(a){var b=(a.getHash(),this._.reservations.shift()),c=0;thumbnailSize=Imgur.Util.dive(a,"parts.data.thumbnail_json.size"),thumbnailSize===this._.thumbnailSizes.wide&&this.nextLocIsFlushedLeft(b)&&c++,this.handlePlacement(a,b,c)},handlePlacement:function(a,b,c){if(a.isValid()){var d=a.getHash(),e=Imgur.Util.dive(a,"parts.data.thumbnail_json.size");if(b||(b=this._.sideGallery.state.items[this._.sideGallery.state.items.length-1].hash),!d)return this.flagHashForPromotedInventoryAnalytics(b),void(this._.failMode=!0);if(d!==b){this._.ads[d]=a,this._.order.push(d),"timestamp"in a.parts.data||(a.parts.data.timestamp=moment().utc().format("YYYY-MM-DD HH:mm:ss")),a.parts.data.placementResponse=a.parts,a.parts.data.promotedPostRequestExpected=!0,a.parts.data.promotedPlacementCount=this._.order.filter(function(a){return a===d}).length;var f=this._.sideGallery.hashPosition(b)+1+c;this._.sideGallery.insertSingleItem(a.parts.data,f),this.pixel(d,"IMPRESSION_THUMB"),this._.logAnalytics({event:"ppImp",meta:{hash:d,flightId:Imgur.Util.dive(a,"parts.thumb.flightId"),campaignId:Imgur.Util.dive(a,"parts.thumb.campaignId"),thumbnailSize:e||this._.thumbnailSizes.normal}})}}},placeCompanion:function(a){var b=Imgur.Util.dive(this._.ads[a],"parts.companion.html"),c='<div class="promoCompanion"><iframe id="promoCompanionFrame" width="300" height="250" marginwidth="0" marginheight="0" hspace="0" vspace="0" scrolling="no" frameBorder="0" seamless="seamless" sandbox="allow-same-origin allow-scripts allow-popups allow-popups-to-escape-sandbox"></iframe></div>';a in this._.ads&&b&&(""+b).length>0&&(this._.inside.showAds(c,function(a,c){var d,e=document.getElementById("promoCompanionFrame");a&&c&&e&&(d=e.contentWindow.document,d.open(),d.write(b),d.close())}),setTimeout(_.bind(function(){$(".promoCompanion").is(":visible")&&this.pixel(a,"IMPRESSION_COMPANION")},this),800))},pixel:function(a,b){var c,d=Imgur.Util.dive(this._.ads,a+".pixels."+b),e=[];if(_.isArray(d))for(c=0;c<d.length;c++)e.push(this.pixelFire(d[c],b,a));return e},pixelFire:function(a,b,c){var d;return"string"==typeof a&&a.length>2&&(this._.rgxPxMacroTimestamp.test(a)&&(a=a.replace(this._.rgxPxMacroTimestamp,(new Date).getTime())),this._.rgxPxMacroRandom.test(a)&&(a=a.replace(this._.rgxPxMacroRandom,this.generateRandomString(this._.pxMacroRandomLength))),this.isURLZrk(a)?(this._.impressionEvents.includes(b)&&this._.semaphore++,this._.isUsingAdBlocker?this.pixelRequestProxy(a,b,c):this.pixelRequest(a,b,c)):(d=document.createElement("img"),d.src=a)),d},isURLZrk:function(a){return this._.zrkRegex.test(a)},pixelRequest:function(a,b,c){$.ajax({type:"GET",url:a,complete:_.bind(this.handlePixelResponse,this,b),error:_.bind(this.handlePixelError,this,b,"Image Pixel",c)})},pixelRequestProxy:function(a,b,c){$.ajax({type:"POST",url:Imgur.Environment.apiUrl+"/proxy/v1/promoted/event",data:JSON.stringify({url:a}),dataType:"json",complete:_.bind(this.handlePixelResponse,this,b),error:_.bind(this.handlePixelError,this,b,"Proxy Request",c)})},handlePixelError:function(a,b,c){this._.enabled=!1,Imgur.Util.jafoLogEvent(Imgur.AnalyticCategories.POST,Imgur.AnalyticEventNames.promotedPixelError,{"Pixel Type":a,"Fire Method":b,"Ad Block User":this._.isUsingAdBlocker,Identifier:c},!0)},handlePixelResponse:function(a){this._.impressionEvents.includes(a)&&(this._.semaphore--,0===this._.semaphore&&(this._.waitImpressionEvents=!1,this._.emitter.trigger("wantPromoted")))},generateRandomString:function(a){var b=parseInt(a,10);if(!(b<1)){var c,d=this._.allowedRandomChars.length,e="";for(c=0;c<b;c++)e+=this._.allowedRandomChars.charAt(Math.floor(Math.random()*d));return e}}}),Namespace("Imgur.Promoted.Events"),Imgur.Promoted.Events=Class.extend({init:function(a,b){this._={ele:{clicks:{ACTION_IMAGE_UPVOTE:".post-action-upvote:not(.green)",ACTION_IMAGE_DOWNVOTE:".post-action-downvote:not(.red)",ACTION_FAVORITE:".post-action-favorite:not(.green)",ACTION_SHARE:".social-icon",ACTION_SHARE_FACEBOOK:".social-icon.icon-f",ACTION_SHARE_TWITTER:".social-icon.icon-twttr",ACTION_SHARE_PINTEREST:".social-icon.icon-pin",ACTION_SHARE_REDDIT:".social-icon.icon-reddit",CLICK_COMPANION:"#right-content .advertisement .promoCompanion a img"}},emitter:a,inside:b}},bindAll:function(a){a?(this._.emitter.off("captionVoted",this,this._handleCommentVote),this._.emitter.off("captionSubmit",this,this._handleCommentSubmit),this._.emitter.off("vwTime",this,this._handleVwTime),this._.emitter.off("vwUnderImage",this,this._handleVwUnderImage)):(this._.emitter.on("captionVoted",this,this._handleCommentVote),this._.emitter.on("captionSubmit",this,this._handleCommentSubmit),this._.emitter.on("vwTime",this,this._handleVwTime),this._.emitter.on("vwUnderImage",this,this._handleVwUnderImage)),this.bindClicks(a)},bindClicks:function(a){var b,c=a?"off":"on";for(b in this._.ele.clicks)this._.ele.clicks.hasOwnProperty(b)&&$(this._.ele.clicks[b])[c]("click",null,{promoEvent:b},_.bind(this._fireEvent,this))},_handleVwTime:function(a,b){Imgur.Util.jafoLogEvent(Imgur.AnalyticCategories.POST,Imgur.AnalyticEventNames.viewedDuration,{Identifier:a,Duration:Math.floor(b/1e3),"Was Promoted":!0});var c={hash:this.getSideImage(a),data:{sec:Math.floor(b/1e3),promoEvent:"VIEW_TIME_0"}};c.data.sec<=10?c.data.promoEvent="VIEW_TIME_"+c.data.sec:c.data.sec<=14?c.data.promoEvent="VIEW_TIME_10":c.data.sec<=19?c.data.promoEvent="VIEW_TIME_15":c.data.sec<=24?c.data.promoEvent="VIEW_TIME_20":c.data.sec<=29?c.data.promoEvent="VIEW_TIME_25":c.data.promoEvent="VIEW_TIME_30_PLUS",this._fireEvent(c)},_handleVwUnderImage:function(a){Imgur.Util.jafoLogEvent(Imgur.AnalyticCategories.POST,Imgur.AnalyticEventNames.viewedComments,{Identifier:a,"Was Promoted":!0});var b={hash:this.getSideImage(a),data:{promoEvent:"VIEW_UNDERIMAGE"}};this._fireEvent(b)},_handleCommentSubmit:function(a){var b={comment:a,data:{promoEvent:"ACTION_COMMENT"}};a.parent_id&&(b.data.promoEvent="ACTION_COMMENT_REPLY"),this._fireEvent(b)},_handleCommentVote:function(a,b){var c={comment:a,data:{promoEvent:null}};"veto"!==b&&("up"===b?c.data.promoEvent="ACTION_COMMENT_UPVOTE":c.data.promoEvent="ACTION_COMMENT_DOWNVOTE",this._fireEvent(c))},getSideImage:function(a){return this._.inside._.sideGallery.getImage(a)},_fireEvent:function(a){this._.emitter.trigger("promoEvent",a)}}),function(){function a(a){this.emitter=a,this.parts={companion:null,page:null,thumb:null,data:{}},this.pixels={}}a.prototype={addPixel:function(a,b){"object"!=typeof this.pixels[a]&&(this.pixels[a]=[]),this.pixels[a].push(b)},addCompanionPlacement:function(a){this.parts.companion=_.extend({},a)},addPagePlacement:function(a){this.parts.page=_.extend({},a)},addThumbPlacement:function(a){this.parts.thumb=_.extend({},a)},getHash:function(){return Imgur.Util.dive(this.parts,"data.hash")},setData:function(a){this.parts.data=_.extend(this.parts.data,a),this.parts.data.starting_score=0},isAnnouncement:function(){return!!Imgur.Util.dive(this.parts,"data.isAnnouncement")},isValid:function(){return!Imgur.Environment.subscription.noPromotedPosts||this.isAnnouncement()}},Imgur.Promoted.Post=a}(),Namespace("Imgur.Promoted.Source"),Imgur.Promoted.Source=Class.extend({init:function(a,b,c){throw"Imgur.Promoted.Source is an abstract class."},getPlacement:function(){}}),Namespace("Imgur.Promoted.Source.Adzerk"),Imgur.Promoted.Source.Adzerk=Imgur.Promoted.Source.extend({init:function(a,b){return this._={emitter:b,config:a,user:{},cookieOpts:{domain:"."+Imgur.Environment.host,path:"/",expires:365},rgxDomain:/\/\/engine\.[^.]+\.net/,evtToPx:{10:"ACTION_IMAGE_UPVOTE",11:"ACTION_IMAGE_DOWNVOTE",22:"ACTION_COMMENT",101:"ACTION_COMMENT_REPLY",102:"ACTION_COMMENT_UPVOTE",103:"ACTION_COMMENT_DOWNVOTE",20:"ACTION_FAVORITE",21:"ACTION_SHARE",50:"ACTION_SHARE_FACEBOOK",51:"ACTION_SHARE_TWITTER",52:"ACTION_SHARE_PINTEREST",53:"ACTION_SHARE_REDDIT",54:"ACTION_SHARE_EMAIL",104:"VIEW_UNDERIMAGE",105:"EXPAND_POST_IMAGES",400:"VIEW_TIME_0",401:"VIEW_TIME_1",402:"VIEW_TIME_2",403:"VIEW_TIME_3",404:"VIEW_TIME_4",405:"VIEW_TIME_5",406:"VIEW_TIME_6",407:"VIEW_TIME_7",408:"VIEW_TIME_8",409:"VIEW_TIME_9",410:"VIEW_TIME_10",415:"VIEW_TIME_15",420:"VIEW_TIME_20",425:"VIEW_TIME_25",430:"VIEW_TIME_30_PLUS"},pendingGetPlacementEvent:null},this._idFromCookie(),window.addEventListener("cmpLoaded",function(){this._.pendingGetPlacementEvent&&this._.pendingGetPlacementEvent()}.bind(this)),window.addEventListener("geoLoaded",function(){this._.pendingGetPlacementEvent&&this._.pendingGetPlacementEvent()}.bind(this)),this._},getPlacement:function(){var a=this._.config.targeting||[];(_.contains(a,Imgur.Environment.countryCode)||0===a.length)&&(window.__cmp?(window.__cmp("getConsentData",null,function(a){if(!a.gdprApplies||a.gdprApplies&&a.hasGlobalConsent){var b={user:this._getUser(),placements:this._.config.adzerk.placementParms,keywords:["platform-desktop"],consent:{gdpr:!0}};if(Imgur.Environment.auth.show_mature&&b.keywords.push("mature"),Imgur.Environment.subscription.noPromotedPosts)for(var c in b.placements)b.placements.hasOwnProperty(c)&&(b.placements[c].properties.announcement=1);return $.ajax({url:this._.config.adzerk.apiLocation,type:"POST",contentType:"application/json",data:JSON.stringify(b),dataType:"json",success:_.bind(this._handleApiResponse,this),error:_.bind(this._handleApiError,this)})}}.bind(this)),this._.pendingGetPlacementEvent=null):this._.pendingGetPlacementEvent=this.getPlacement.bind(this))},_handleApiError:function(a,b,c){console.log("adzerk get fail",arguments)},_decodeEncodedResponse:function(a){var b,c,d,e,f="contents.0.data.customData",g=Imgur.Util.dive(a,"decisions");if("object"==typeof g)for(b in g)if(g.hasOwnProperty(b)){if(c=Imgur.Util.dive(g[b],f+".encoded"),_.isArray(c))for(d=0;d<c.length;d++)e=Imgur.Util.dive(g[b],f+"."+c[d]),"string"==typeof e&&(a.decisions[b].contents[0].data.customData[c[d]]=decodeURIComponent(e),a.decisions[b].contents[0].data.customData[c[d]+"_raw"]=e);if(c=Imgur.Util.dive(g[b],f+".encodedObj"),_.isArray(c))for(d=0;d<c.length;d++)e=Imgur.Util.dive(g[b],f+"."+c[d]),"string"==typeof e&&(a.decisions[b].contents[0].data.customData[c[d]]=JSON.parse(decodeURIComponent(e)),a.decisions[b].contents[0].data.customData[c[d]+"_raw"]=e)}return a},_idFromCookie:function(){var a=$.cookie(this._.config.userCookie);a&&(this._.user.key=a)},_handleApiResponse:function(a,b,c){var d,e=this._.config.adzerk,f=null,g=Imgur.Util.dive(a,"decisions."+e.placementIds.thumb),h=Imgur.Util.dive(a,"decisions."+e.placementIds.page),i=Imgur.Util.dive(a,"decisions."+e.placementIds.companion);"object"==typeof a&&"object"==typeof a.user&&a.user&&this._setUserFromResponse(a),"object"==typeof a&&"object"==typeof a.decisions&&a.decisions?(a=this._decodeEncodedResponse(a),f=new Imgur.Promoted.Post(this._.emitter),i&&(compFormatted=this._formatCompanionData(i),f.addCompanionPlacement(compFormatted),f.addPixel("CLICK_COMPANION",this._cleanPx(i.clickUrl)),f.addPixel("IMPRESSION_COMPANION",this._cleanPx(i.impressionUrl))),h&&(f.addPagePlacement(h),f.addPixel("IMPRESSION_POST",this._cleanPx(h.impressionUrl))),g&&(adData=Imgur.Util.dive(g,"contents.0.data.customData"),d=Imgur.Util.dive(g,"contents.0.data.customData.customPx"),adData&&(f.addThumbPlacement(g),f.addPixel("CLICK_THUMB",this._cleanPx(g.clickUrl)),f.addPixel("IMPRESSION_THUMB",this._cleanPx(g.impressionUrl)),f.setData(adData),"object"==typeof g.events&&this._addEventPixels(f,g.events),"object"==typeof d&&this._addCustomPixels(f,d))),this._.emitter.trigger("gotPromoted",f)):console.warn("Empty or invalid promoted response.",arguments)},_cleanPx:function(a){return"string"==typeof a&&this._.rgxDomain.test(a)&&(a=a.replace(this._.rgxDomain,"https://zrk."+Imgur.Environment.host)),a},_addCustomPixels:function(a,b){var c,d;if("object"==typeof a&&_.isArray(b))for(d=b.length,c=0;c<d;c++)"undefined"!=typeof b[c].id&&"undefined"!=typeof b[c].url&&"string"==typeof b[c].id&&a.addPixel(b[c].id,this._cleanPx(b[c].url))},_addEventPixels:function(a,b){var c,d;if("object"==typeof a&&_.isArray(b))for(d=b.length,c=0;c<d;c++)"undefined"!=typeof b[c].id&&"undefined"!=typeof b[c].url&&"string"==typeof this._.evtToPx[b[c].id]&&a.addPixel(this._.evtToPx[b[c].id],this._cleanPx(b[c].url))},_setUserFromResponse:function(a){"object"==typeof a&&"object"==typeof a.user&&a.user&&(this._.user=_.extend({},a.user),this._idFromCookie(),$.cookie(this._.config.userCookie,this._.user.key,this._.cookieOpts))},_getUser:function(){return this._idFromCookie(),this._.user},_formatCompanionData:function(a){var b,c,d,e,f=Imgur.Util.dive(a,"contents.0.data.customData.adType"),g={type:f,raw:a,html:""};switch(g.raw=a,f){case"hash":case"native":b=Imgur.Environment.cdnUrl+"/"+Imgur.Util.dive(a,"contents.0.data.customData.hash")+".jpg",c=Imgur.Util.dive(a,"contents.0.data.customData.link"),d=Imgur.Util.dive(a,"contents.0.data.customData.title"),g.html='<a href="'+c+'" rel="nofollow" target="_blank" title="'+d+'"><img src="'+b+'" title="'+d+'" alt="'+d+'" border="0" width="300" height="250"></a>';break;case"html":g.html=Imgur.Util.dive(a,"contents.0.data.customData.html");break;default:e=Imgur.Util.dive(a,"contents.0.body"),e&&(g.html=e)}return g}}),Imgur.LinkGenerator=Class.extend({init:function(){this._={item:null,thumbsize:null,threshold:null}},setItem:function(a){return this._.item=a,this},setThumbSize:function(a){return this._.thumbsize=a,this},setThreshold:function(a){return this._.threshold=a,this},reset:function(){return this._.item=null,this._.thumbsize="",this},imageLink:function(a){return"https://"+Imgur.Environment.host+"/"+(a?"a/":"")+this._.item.hash},directishLink:function(){var a=""==this._.thumbsize&&".gif"==this._.item.ext&&this._.item.animated?".gifv":this._.item.ext;return"https:"+Imgur.Environment.cdnUrl+"/"+this._.item.hash+this._.thumbsize+a},directLink:function(){return"https:"+Imgur.Environment.cdnUrl+"/"+this._.item.hash+this._.thumbsize+this._.item.ext},htmlImage:function(){return""==this._.thumbsize&&".gif"==this._.item.ext&&this._.item.animated&&this._.item.size>this._.threshold?'<iframe class="imgur-embed" width="100%" height="'+this._.item.height+'" frameborder="0" src="'+this.directishLink()+'#embed"></iframe>':'<a href="'+this.imageLink()+'"><img src="'+this.directLink()+'" title="source: imgur.com" /></a>'},markdown:function(){var a,b=""==this._.thumbsize&&".gif"==this._.item.ext&&this._.item.animated?".gifv":this._.item.ext;return a=this._.item.title?this._.item.title:"Imgur","["+a+"](https:"+Imgur.Environment.cdnUrl+"/"+this._.item.hash+this._.thumbsize+b+")"},bbcode:function(){return"[img]https:"+Imgur.Environment.cdnUrl+"/"+this._.item.hash+this._.thumbsize+this._.item.ext+"[/img]"},linkedBbcode:function(){return""==this._.thumbsize&&".gif"==this._.item.ext&&this._.item.animated&&this._.item.size>this._.threshold?"[url=https://"+Imgur.Environment.host+"/"+this._.item.hash+"]http:"+Imgur.Environment.cdnUrl+"/"+this._.item.hash+this._.thumbsize+".gifv[/url]":"[url=https://"+Imgur.Environment.host+"/"+this._.item.hash+"][img]http:"+Imgur.Environment.cdnUrl+"/"+this._.item.hash+this._.thumbsize+this._.item.ext+"[/img][/url]"},deletion:function(){return"https://"+Imgur.Environment.host+"/delete/"+this._.item.deletehash},embed:function(){var a=("imgur.com"===Imgur.Environment.host?"s.imgur.com/min":Imgur.Environment.host+"/include/minified")+"/embed.js",b=this._.item.title;b||(b="View post on imgur.com");var c=this._.item.is_album?"a/":"";return'<blockquote class="imgur-embed-pub" lang="en" data-id="'+c+this._.item.hash+'"><a href="//'+Imgur.Environment.host+"/"+c+this._.item.hash+'">'+_.escape(b)+'</a></blockquote><script async src="//'+a+'" charset="utf-8"></script>'}}),Namespace("Imgur.Album.Images"),Imgur.Album.Images=Class.extend({init:function(a){this._=$.extend(!0,{host:"imgur.com",cdnUrl:"//i.imgur.com",postURL:"/ajaxalbums/images",imagesPerPage:25,album:null,images:null,changeCover:!1,albumTitle:null,mode:null,onSubmitComplete:function(){},sort:0,order:1,selected:[],offsetSelectionInterval:null,imgurImages:null,operationQueue:{},el:{$thumbsContainer:$("#album-images #image-thumbs"),thumbsId:"#album-images #image-thumbs",messagesClass:"thumbs-message",$loader:$("#album-images #images-loader"),imageDivClass:"thumb",$modes:$("#album-images #images-menu .mode"),$operationLoader:$("#album-images #small-loader"),imageSelectedClass:"selected",$submitButton:$("#album-images #save")},messages:{noImages:'<span class="thumbs-message">No images were found.</span>'}},a),this._.operationQueue.hashes=null==this._.images?[]:this._.images,this._.operationQueue.count=null==this._.images?0:Object.size(this._.images),this.loadImages(),this.loadPageElements()},getPageOptions:function(){return isNaN(this._.album)?(this._.sort=3,
this._.order=0):(this._.sort=0,this._.order=1),{sort:this._.sort,order:this._.order,album:this._.album}},noImagesFound:function(){var a=Imgur.Album.Images.getInstance();a._.el.$thumbsContainer.html(a._.messages.noImages)},addImageToThumbs:function(a,b,c){var d=Imgur.Album.Images.getInstance();if(!($(d._.el.thumbsId+" #"+a.hash).length>0)){var e=a.ext.match(/\?(.*)/),f="s.jpg"+(null!=e?e[0]:""),g=(d._.cdnUrl+"/"+a.hash+(".gif"==a.ext?a.ext:"h"+a.ext),$('<div class="'+d._.el.imageDivClass+'" id="'+a.hash+'" ext="'+a.ext+'"></div>')),h=$('<div class="selection"></div>');img=$('<img src="'+d._.cdnUrl+"/"+a.hash+f+'" />'),$(g).append(img),$(g).append(h),d._.operationQueue.hashes[a.hash]&&g.addClass(d._.el.imageSelectedClass),$("."+d._.el.messagesClass).remove(),c?$(g).appendTo(d._.el.$thumbsContainer):$(g).prependTo(d._.el.$thumbsContainer).hide().fadeIn("slow")}},queueOperation:function(a){var b=a.attr("id");this._.changeCover?(this._.operationQueue.count=1,this._.operationQueue.hashes[0]=b,this._.el.$thumbsContainer.find("."+this._.el.imageDivClass).removeClass(this._.el.imageSelectedClass),a.addClass(this._.el.imageSelectedClass)):this._.operationQueue.hashes[b]?(this._.operationQueue.count--,this._.operationQueue.hashes[b]=null,a.removeClass(this._.el.imageSelectedClass)):(this._.operationQueue.count++,this._.operationQueue.hashes[b]=!0,a.addClass(this._.el.imageSelectedClass))},isInQueue:function(a){return 1==this._.operationQueue.hashes[a]},startOperation:function(){if(0==this._.operationQueue.count)return null;if(this._.images=[],this._.changeCover)this._.images.push(this._.operationQueue.hashes[0]);else for(var a in this._.operationQueue.hashes)null!=this._.operationQueue.hashes[a]&&this._.images.push(a);return this._.images},toggleOperationsLoader:function(){this._.el.$operationLoader.toggle()},bindOperationClick:function(a){var b=this;a.unbind("click"),a.click(function(){return b.queueOperation($(this).parent()),!1})},offsetSelection:function(){var a=Imgur.Album.Images.getInstance(),b=5,c=a._.el.$thumbsContainer.parent(),d=c.scrollTop(),e=c.selectable();e.y<0?(c.scrollTop(c.scrollTop()-b),c.scrollTop()<d&&c.selectable("recalc",-b)):e.y>c.height()&&(c.scrollTop(c.scrollTop()+b),c.scrollTop()>d&&c.selectable("recalc",b))},makeSelectable:function(){var a=Imgur.Album.Images.getInstance();a._.el.$thumbsContainer.unbind("mousedown"),a._.el.$thumbsContainer.parent().selectable({filter:".thumb",selected:function(b,c){a._.selected.push($(c.selected))},stop:function(b,c){var d=0,e=!1,f=a._.selected.length;for(var g in a._.selected)if(a.isInQueue($(a._.selected[g]).attr("id")))d++,g==f-1&&d<f&&(e=!0);else if(d){e=!0;break}for(var g in a._.selected){var h=$(a._.selected[g]);e?a.isInQueue(h.attr("id"))||a.queueOperation(h):a.queueOperation(h)}a._.selected=[]}}),a._.el.$thumbsContainer.bind("mousedown",function(){clearInterval(a._.offsetSelectionInterval),a._.offsetSelectionInterval=setInterval(a.offsetSelection,50)}),$(document).bind("mouseup",function(){clearInterval(a._.offsetSelectionInterval)})},submit:function(){this._.images=this.startOperation(),this._.el.$submitButton.disable(),this.toggleOperationsLoader();var a=this;return $.post(this._.postURL+"/"+this._.album,"hashes="+this._.images+"&change_cover="+this._.changeCover,function(b){b.success?(a._.el.$submitButton.enable(),a.toggleOperationsLoader(),a._.onSubmitComplete(b)):4344==b.data.error.code?(a._.el.$submitButton.enable(),a.toggleOperationsLoader(),humanMsg.displayMsg("You are trying to add too many images to this album")):403==b.data.error.code?(a._.onSubmitComplete(b),humanMsg.displayMsg("Cannot edit album images while album is in the Gallery")):humanMsg.displayMsg("Unknown error occurred")}).error(function(b){a._.el.$submitButton.enable(),a.toggleOperationsLoader();var c=JSON.parse(b.responseText);humanMsg.displayMsg(c.data.error)}),!1},loadImages:function(){if(null!=this._.album&&"undefined"!=typeof this._.album){var a=Imgur.Images.getInstance();a.init({imagesPerPage:this._.imagesPerPage,addToThumbsFunc:this.addImageToThumbs,noImagesFunc:this.noImagesFound,onComplete:this.makeSelectable,loader:this._.el.$loader,noPageHash:!0}),a.setOptions(this.getPageOptions()),this.next=function(){a.next()},this.prev=function(){a.prev()},this.changePage=function(b){a.changePage(b)},a.bindScrollEvent(),a.reload(),this._.imgurImages=a}},loadPageElements:function(){this._.album&&(this._.el.$modes.filter(":first").attr("data-value",this._.album),this._.el.$modes.removeClass("selected"),this._.mode?(this._.el.$modes.siblings("div[data-value="+this._.mode+"]").addClass("selected"),this._.album=this._.mode):this._.el.$modes.siblings(".start").addClass("selected"),this._.imgurImages.setCurrentPage(1),this._.imgurImages.setOptions(this.getPageOptions()),this._.imgurImages.reload(),this._.el.$modes.click(this.modeClickHandler))},modeClickHandler:function(){var a=Imgur.Album.Images.getInstance();a._.el.$modes.removeClass("selected"),$(this).addClass("selected");var b=$(this).attr("data-value");a._.album=b,a._.imgurImages.setCurrentPage(1),a._.imgurImages.setOptions(a.getPageOptions()),a._.imgurImages.reload()},destroy:function(){this._.el.$thumbsContainer.empty(),this._.el.$modes.unbind("click"),this._.el.$modes.removeClass("selected"),this._.el.$loader.show()}}),Class.addSingleton(Imgur.Album.Images),Namespace("Imgur.Images"),Imgur.Images=Class.extend({init:function(a){this._=$.extend(!0,{imagesPerPage:20,thisName:"app",ajaxURL:"/ajax/images",noPageHash:!1,addToThumbsFunc:function(){return null},hiddenImagesFunc:function(){return null},noImagesFunc:function(){return null},onComplete:function(){return null},currentPage:1,totalPages:0,totalImageCount:0,numImages:0,changingPage:!1,options:null,imageLimit:225,isPro:!1,cache:[],stopOnPaging:!0,lastScrollPos:0,ajax:null,el:{$navigationContainer:$(".navigation"),$loader:$("#images-loader"),$totalCounter:$(".total-images"),$totalCounterSuffix:$(".total-images-suffix"),$thumbsContainer:$("#image-thumbs"),pageNumbersClass:"page-numbers",prevID:"prev",nextID:"next"}},a),this._.el.$totalCounter.text(0),this._.el.$totalCounterSuffix.text("images"),this._.noPageHash||(this._.currentPage=this.getPage())},getHash:function(){return window.location.hash.substring(1)},getPage:function(){var a=parseInt(this.getHash());return a<1&&(a=1),a?a:1},stopPaging:function(){void 0!==window.stop?window.stop():void 0!==document.execCommand&&document.execCommand("Stop",!1)},generatePageLink:function(a,b){if(b>0&&b<=this._.totalPages){var c=$('<a href="javascript:;">'+b+"</a>"),d=this;c.click(function(){d._.el.$thumbsContainer.parent().scrollTop(0),d.changePage(b)}),a.append(c),b==this._.currentPage&&c.addClass("current-selected")}},generateNavigationLinks:function(){if(this._.el.$navigationContainer.empty(),1!=this._.totalPages){var a=(this._.currentPage-1,this._.currentPage+1,$('<span class="'+this._.el.pageNumbersClass+'"></span>')),b=$('<a href="javascript:;" id="'+this._.el.prevID+'">Prev</a>'),c=$('<a href="javascript:;" id="'+this._.el.nextID+'">Next</a>');b.click(this.prev),c.click(this.next);for(var d=this._.currentPage-5;d<this._.currentPage;++d)this.generatePageLink(a,d);for(var d=this._.currentPage;d<this._.currentPage+6;++d)this.generatePageLink(a,d);this._.el.$navigationContainer.append(a),this._.currentPage>1&&this._.el.$navigationContainer.append(b),this._.currentPage<this._.totalPages&&this._.el.$navigationContainer.append(c)}},recalcNavigation:function(){var a=Math.ceil(this._.totalImageCount/this._.imagesPerPage);a<1&&(a=1),a!=this._.totalPages&&(this._.totalPages=a,this.generateNavigationLinks(this._.currentPage)),this.renderTotalCounter()},renderTotalCounter:function(){this._.el.$totalCounter.length&&(this._.el.$totalCounter.text(Imgur.Util.numberFormat(this._.totalImageCount)),this._.el.$totalCounterSuffix.text(Imgur.Util.pluralize(this._.totalImageCount,"image")))},handleJSON:function(a){if(null!=a){if(this._.cache[$.param(this._.options)]=a,this._.isPro=a.isPro,a.count!=this._.totalImageCount&&(this._.totalImageCount=parseInt(a.count),this.recalcNavigation()),a.count>0&&a.images.length>0){var b=this;$.each(a.images,function(a,c){b._.numImages++,b._.addToThumbsFunc(c,null,!0)})}else this._.noImagesFunc();this._.el.$thumbsContainer.append('<div class="clear"></div>')}this._.changingPage=!1,this._.el.$loader.hide(),this._.onComplete()},changePage:function(a,b,c){if(null==this._.options)return!1;if(this._.changingPage){if(c)return!1;this._.ajax.abort()}if(a>this._.totalPages&&this._.totalPages>0)return!1;this._.changingPage=!0,this._.currentPage=a,this._.numImages=this._.imagesPerPage*(this._.currentPage-1),this._.el.$loader.show(),this.generateNavigationLinks(),c||(this._.el.$thumbsContainer.empty(),b||this._.noPageHash||(window.location=window.location.href.substring(0,window.location.href.indexOf("#"))+"#"+this._.currentPage)),this._.options.page=a,this._.options.perPage=this._.imagesPerPage;var d=$.param(this._.options),e=this;return this._.cache[d]?this.handleJSON(this._.cache[d]):(this._.stopOnPaging&&!b&&this.stopPaging(),this._.ajax=$.getJSON(this._.ajaxURL,this._.options,function(a){a.success&&e.handleJSON(a.data)})),!0},bindScrollEvent:function(){var a=80,b=this._.el.$thumbsContainer.parent(),c=this._.el.$thumbsContainer,d=this;this._.el.$thumbsContainer.parent().scroll(function(){b.scrollTop()>c.height()-b.height()-a&&d.changePage(d._.currentPage+1,!0,!0),d._.lastScrollPos=b.scrollTop()})},next:function(){var a=Imgur.Images.getInstance();return a._.el.$thumbsContainer.parent().scrollTop(0),a.changePage(a._.currentPage+1)},prev:function(){var a=Imgur.Images.getInstance();return a._.el.$thumbsContainer.parent().scrollTop(0),a.changePage(a._.currentPage-1)},reload:function(){return this.changePage(this._.currentPage,!0)},getCurrentPage:function(){return this._.currentPage},setCurrentPage:function(a){this._.currentPage=a},setOptions:function(a){this._.options=a},getTotalPages:function(){return this._.totalPages},getImageLimit:function(){return this._.imageLimit},getTotalImageCount:function(){return this._.totalImageCount},increaseImageCount:function(){this._.totalImageCount++},clearCache:function(){this._.cache=[]},stopOnPaging:function(a){this._.stopOnPaging=a}}),Class.addSingleton(Imgur.Images),Namespace("Imgur.TitleDesc"),Imgur.TitleDesc=Imgur.extend({init:function(a){return this._=$.extend(!0,{el:{titleDescriptionForm:{id:"#title-description",$form:$("#title-description form"),$titleInput:$("#title-input"),$descriptionInput:$("#description-input"),$loader:$("#title-description-loader")}}},a),this._=this._super(this._),this._},bindTitleDescriptionSubmit:function(a,b){if(b){this._.el.titleDescriptionForm.$titleInput.val(Imgur.Environment.hashes[0].title);var c=document.createElement("textarea");c.innerHTML=Imgur.Environment.hashes[0].description,this._.el.titleDescriptionForm.$descriptionInput.val(c.value)}var d=this;this._.el.titleDescriptionForm.$form.submit(function(){return d.titleDescriptionSubmitHandler(a)})},titleDescriptionSubmitHandler:function(a){var b=this._.el.titleDescriptionForm.$titleInput.val()!=this._.el.titleDescriptionForm.$titleInput.attr("title")?this._.el.titleDescriptionForm.$titleInput.val():"",c=this._.el.titleDescriptionForm.$descriptionInput.val()!=this._.el.titleDescriptionForm.$descriptionInput.attr("title")?this._.el.titleDescriptionForm.$descriptionInput.val():"";this._.el.titleDescriptionForm.$loader.show(),this._.hash=Imgur.getInstance()._.hash;var d=this,e=this._.hash.deletehash||Imgur.Environment.hashes[0].deletehash;return $.post("/ajax/titledesc/"+e,{title:b,description:c},function(e){$.colorbox.close(),humanMsg.displayMsg(d._.messages.titledesc),d._.el.titleDescriptionForm.$loader.hide(),a?a({title:b,description:c}):window.setTimeout(function(){location.reload()},1e3)}),!1},addTitleDescription:function(){var a=this;$.colorbox({href:a._.el.titleDescriptionForm.id,open:!0,inline:!0,top:"15%",transition:"none",scrolling:!1,onComplete:function(){a._.el.titleDescriptionForm.$titleInput.focus()}})},getElements:function(){return this._.el}}),Class.addSingleton(Imgur.TitleDesc),Imgur.GalleryBundleLoaded=!0,Namespace("Imgur.Elements"),Imgur.Elements.CheckBox=React.createClass({displayName:"CheckBox",propTypes:{className:React.PropTypes.string,defaultValue:React.PropTypes.bool,id:React.PropTypes.string.isRequired,name:React.PropTypes.string,label:React.PropTypes.string,onChange:React.PropTypes.func},getDefaultProps:function(){return{className:"",defaultValue:!1}},handleChange:function(){var a=this.props.onChange;"function"==typeof a&&a(this.refs.toggle.checked)},render:function(){var a=this.props,b=a.label,c=a.id,d=a.name;return React.createElement("div",{className:this.props.className},React.createElement("input",{ref:"toggle",type:"checkbox",className:"checkbox-styled",id:c,name:d||c,defaultChecked:this.props.defaultValue,onChange:this.handleChange.bind(null,this)}),React.createElement("label",{className:"icon-check",htmlFor:c}),React.createElement("label",{className:"checkbox-label",htmlFor:c},b))}}),Namespace("Imgur.Adm.GalleryAddTag"),Imgur.Adm.GalleryAddTag=React.createClass({displayName:"GalleryAddTag",_:{msid:Imgur.Environment.msid,defaultTagName:"staff picks",tagSuggestPosition:{right:{left:17,top:16},left:{left:-230,top:16}}},propTypes:{baseUrl:React.PropTypes.string.isRequired,emitter:React.PropTypes.object.isRequired,insideNav:React.PropTypes.object.isRequired},getInitialState:function(){return{query:this._.defaultTagName,tagStore:this.props.tagStore,suggestedTags:[],tagError:null,tagSuggestFlag:"right"}},componentDidMount:function(){this.props.emitter.on("admTagRemoved",this,function(a){this.state.tagStore.removeTag(a,"tagModule")}),this.props.emitter.on("select",this,function(a){this.setState({query:this._.defaultTagName}),this.state.tagStore.flushTags();for(var b in a.galleryTags)this.state.tagStore.addTag(a.galleryTags[b].tag,"tagModule",function(){})})},componentDidUpdate:function(a,b){if(this.state.tagInputActive&&!b.tagInputActive){var c=ReactDOM.findDOMNode(this.refs.admtagsuggest);if(!c)return;var d=c.getBoundingClientRect();d.right>window.innerWidth?this.setState({tagSuggestFlag:"left"}):d.right+d.width<window.innerWidth&&this.setState({tagSuggestFlag:"right"})}},componentWillUnmount:function(){this.props.emitter.off("admTagRemoved"),this.props.emitter.off("select")},addTag:function(a){var b=this;a=a||this.state.query,this.setState({query:a}),this.state.tagStore.addTag(a,"tagModule",function(c,d){if(c){var e=b.props.insideNav.getHash();$.post(b.props.baseUrl+"/action/set_tag/"+e,{sid:b._.msid,tag:a},function(){humanMsg.displayMsg(a+" added to post"),this.setState({query:""}),this.props.emitter.trigger("admTagAdded",a)}.bind(b)).fail(function(){this.state.tagStore.removeTag(a),humanMsg.displayMsg("Unable to add tag "+a+" to post")}.bind(b))}else b.setState({tagError:d})})},handleInput:function(a){this.setState({query:a.target.value})},getSuggestions:function(a){var b=this;if([38,40].indexOf(a.which)===-1){var c=this.state.query,d=this.state.tagStore.getTagValidator();return d.isValidTag("",c,!1)?(this.setState({tagError:null}),13===a.which?void this.addTag(c):void this.state.tagStore.getSuggestions(c,function(a){b.setState({suggestedTags:a})})):void this.setState({tagError:d.whyNot("",c,!1)})}},handleHighlighted:function(a){this.setState({query:a});var b=this.refs.admaddtag;if(b.focus(),"undefined"!=typeof window.getSelection&&"undefined"!=typeof document.createRange){var c=document.createRange();c.selectNodeContents(b),c.collapse(!1);var d=window.getSelection();d.removeAllRanges(),d.addRange(c)}else if("undefined"!=typeof document.body.createTextRange){var e=document.body.createTextRange();e.moveToElementText(b),e.collapse(!1),e.select()}},renderTagSuggestions:function(){if(this.state.tagInputActive&&this.state.query){var a=this._.tagSuggestPosition[this.state.tagSuggestFlag],b=a.left,c=a.top;return React.createElement(Imgur.Gallery.TagSuggest,{ref:"admtagsuggest",onSelect:this.addTag,onHighlightedKeyDown:this.handleHighlighted,left:b,top:c,showingSuggestions:!1,suggestedTags:this.state.suggestedTags,query:this.state.query,error:this.state.tagError,classNames:"tag-suggest--flag-"+this.state.tagSuggestFlag})}},render:function(){var a=this;return this.props.display!==!1&&React.createElement("div",{className:"adm-add-gallery-tag"},React.createElement("p",null,"Add a tag to this post"),React.createElement("div",{className:"post-options-tag-input-wrapper"},React.createElement("input",{type:"text",value:this.state.query,onChange:this.handleInput,onInput:this.handleInput,ref:"admaddtag",key:"admaddtag",className:"post-options-tag-input",onKeyUp:this.getSuggestions,onBlur:function(){a.setState({tagInputActive:!1})},onFocus:function(){return a.setState({tagInputActive:!0})},onPaste:this.getSuggestions,placeholder:"Enter a tag to add"}),this.renderTagSuggestions()))}}),Namespace("Imgur.Gallery"),Imgur.Gallery.PostActionConfetti=React.createClass({displayName:"PostActionConfetti",componentWillMount:function(){this.setState({confetti:[],totalCreated:0,limit:0})},handleClick:function(){Imgur.Util.jafoLogEvent("Emerald","Founder Cake Interacted",{Location:"Post",Identifier:this.props.hash}),this.startConfetti()},startConfetti:_.debounce(function(){var a=this.state.limit+defaultOptions.limit,b=updateItems(this.state.confetti,this.state.totalCreated,a),c=b.confetti,d=b.totalCreated;this.setState({confetti:c,totalCreated:d,limit:a}),1===c.length&&this.runAnimation()},150,!0),runAnimation:function(){var a=this,b=this.state.confetti,c=this.state.totalCreated;requestAnimationFrame(function(){var d=updateItems(b,c,a.state.limit),e=d.confetti,f=d.totalCreated;a.setState({confetti:e,totalCreated:f}),e.length&&a.runAnimation()})},render:function(){return React.createElement("span",null,React.createElement(Imgur.Elements.PressButton,{className:"post-action-icon post-action-confetti icon-cake",onPress:this.handleClick}),renderConfetti(this.state.confetti))}}),defaultOptions={limit:50,speed:[5.5,2.5],wind:[-.7,.5],spin:[-25,25]},SPRINKLE_ROTATION_RANGE=[-90,90],BALLOON_ROTATION_RANGE=[-45,45],CONFETTI_ONSCREEN_LIMIT=100,BALLOONS=["/images/confetti/b1.svg","/images/confetti/b2.svg","/images/confetti/b3.svg"],SPRINKLES=["/images/confetti/s1.svg","/images/confetti/s2.svg","/images/confetti/s3.svg","/images/confetti/s4.svg"];
//# sourceMappingURL=gallery.js.map