Skip to content

Instantly share code, notes, and snippets.

@samundrak
Created August 4, 2013 13:14
Show Gist options
  • Save samundrak/6150291 to your computer and use it in GitHub Desktop.
Save samundrak/6150291 to your computer and use it in GitHub Desktop.
This file has been truncated, but you can view the full file.
/*! mig33_JS_Client - v2.7.0 - 2013-07-31
* Copyright (c) 2013 ; Licensed */
function pluralRuleParser(e,t){function n(){}function i(e){return function(){for(var t=0;e.length>t;t++){var n=e[t]();if(null!==n)return n}return null}}function o(e){for(var t=w,n=[],i=0;e.length>i;i++){var o=e[i]();if(null===o)return w=t,null;n.push(o)}return n}function a(e,t){return function(){for(var n=w,i=[],o=t();null!==o;)i.push(o),o=t();return e>i.length?(w=n,null):i}}function s(t){var n=t.length;return function(){var i=null;return e.substr(w,n)===t&&(i=t,w+=n),i}}function r(t){return function(){var n=e.substr(w).match(t);return null===n?null:(w+=n[0].length,n[0])}}function l(){var e=k();return null===e?(n(" -- failed n"),e):(e=parseFloat(t),n(" -- passed n ",e),e)}function c(){var e=o([l,b,E,b,x]);return null===e?(n(" -- failed mod"),null):(n(" -- passed mod"),parseInt(e[0],10)%parseInt(e[4],10))}function u(){var e=o([b,T]);return null===e?(n(" -- failed not"),null):e[1]}function h(){var e=o([M,b,C,a(0,u),b,x]);return null!==e?(n(" -- passed is"),"not"===e[3][0]?e[0]!==parseInt(e[5],10):e[0]===parseInt(e[5],10)):(n(" -- failed is"),null)}function d(){var e=o([i([f,x]),a(0,p)]),t=[];return null!==e?(t=t.concat(e[0]),e[1][0]&&(t=t.concat(e[1][0])),t):(n(" -- failed rangeList"),null)}function p(){var e=o([I,d]);return null!==e?e[1]:(n(" -- failed rangeTail"),null)}function f(){var e,t=o([x,A,x]);if(null!==t){n(" -- passed range");var i=[],a=parseInt(t[0],10),s=parseInt(t[2],10);for(e=a;s>=e;e++)i.push(e);return i}return n(" -- failed range"),null}function m(){var e=o([M,a(0,u),b,S,b,d]);if(null!==e){n(" -- passed _in");for(var t=e[5],i=0;t.length>i;i++)if(parseInt(t[i],10)===e[0])return"not"!==e[1][0];return"not"===e[1][0]}return n(" -- failed _in "),null}function g(){var e=o([M,a(0,u),b,P,b,d]);if(null!==e){n(" -- passed within");var t=e[5];return e[0]>=parseInt(t[0])&&e[0]<parseInt(t[t.length-1])?"not"!==e[1][0]:"not"===e[1][0]}return n(" -- failed within "),null}function _(){var e=o([R,b,N,b,j]);return e?(n(" -- passed and"),e[0]&&e[4]):(n(" -- failed and"),null)}function v(){var e=o([R,b,$,b,j]);return e?(n(" -- passed or"),e[0]||e[4]):(n(" -- failed or"),null)}function y(){var e=j();return e}var w=0,b=r(/^\s+/),x=r(/^\d+/),k=s("n"),C=s("is"),E=s("mod"),T=s("not"),S=s("in"),P=s("within"),A=s(".."),I=s(","),$=s("or"),N=s("and");n("pluralRuleParser",e,t);var M=i([c,l]),R=i([h,m,g]),j=i([_,v,R]),O=y();return null===O||w!==e.length,O}var requirejs,require,define;(function(global){function isFunction(e){return"[object Function]"===ostring.call(e)}function isArray(e){return"[object Array]"===ostring.call(e)}function each(e,t){if(e){var n;for(n=0;e.length>n&&(!e[n]||!t(e[n],n,e));n+=1);}}function eachReverse(e,t){if(e){var n;for(n=e.length-1;n>-1&&(!e[n]||!t(e[n],n,e));n-=1);}}function hasProp(e,t){return hasOwn.call(e,t)}function getOwn(e,t){return hasProp(e,t)&&e[t]}function eachProp(e,t){var n;for(n in e)if(hasProp(e,n)&&t(e[n],n))break}function mixin(e,t,n,i){return t&&eachProp(t,function(t,o){(n||!hasProp(e,o))&&(i&&"string"!=typeof t?(e[o]||(e[o]={}),mixin(e[o],t,n,i)):e[o]=t)}),e}function bind(e,t){return function(){return t.apply(e,arguments)}}function scripts(){return document.getElementsByTagName("script")}function defaultOnError(e){throw e}function getGlobal(e){if(!e)return e;var t=global;return each(e.split("."),function(e){t=t[e]}),t}function makeError(e,t,n,i){var o=Error(t+"\nhttp://requirejs.org/docs/errors.html#"+e);return o.requireType=e,o.requireModules=i,n&&(o.originalError=n),o}function newContext(e){function t(e){var t,n;for(t=0;e[t];t+=1)if(n=e[t],"."===n)e.splice(t,1),t-=1;else if(".."===n){if(1===t&&(".."===e[2]||".."===e[0]))break;t>0&&(e.splice(t-1,2),t-=2)}}function n(e,n,i){var o,a,s,r,l,c,u,h,d,p,f,m=n&&n.split("/"),g=m,_=k.map,v=_&&_["*"];if(e&&"."===e.charAt(0)&&(n?(g=getOwn(k.pkgs,n)?m=[n]:m.slice(0,m.length-1),e=g.concat(e.split("/")),t(e),a=getOwn(k.pkgs,o=e[0]),e=e.join("/"),a&&e===o+"/"+a.main&&(e=o)):0===e.indexOf("./")&&(e=e.substring(2))),i&&_&&(m||v)){for(r=e.split("/"),l=r.length;l>0;l-=1){if(u=r.slice(0,l).join("/"),m)for(c=m.length;c>0;c-=1)if(s=getOwn(_,m.slice(0,c).join("/")),s&&(s=getOwn(s,u))){h=s,d=l;break}if(h)break;!p&&v&&getOwn(v,u)&&(p=getOwn(v,u),f=l)}!h&&p&&(h=p,d=f),h&&(r.splice(0,d,h),e=r.join("/"))}return e}function i(e){isBrowser&&each(scripts(),function(t){return t.getAttribute("data-requiremodule")===e&&t.getAttribute("data-requirecontext")===w.contextName?(t.parentNode.removeChild(t),!0):void 0})}function o(e){var t=getOwn(k.paths,e);return t&&isArray(t)&&t.length>1?(i(e),t.shift(),w.require.undef(e),w.require([e]),!0):void 0}function a(e){var t,n=e?e.indexOf("!"):-1;return n>-1&&(t=e.substring(0,n),e=e.substring(n+1,e.length)),[t,e]}function s(e,t,i,o){var s,r,l,c,u=null,h=t?t.name:null,d=e,p=!0,f="";return e||(p=!1,e="_@r"+(I+=1)),c=a(e),u=c[0],e=c[1],u&&(u=n(u,h,o),r=getOwn(P,u)),e&&(u?f=r&&r.normalize?r.normalize(e,function(e){return n(e,h,o)}):n(e,h,o):(f=n(e,h,o),c=a(f),u=c[0],f=c[1],i=!0,s=w.nameToUrl(f))),l=!u||r||i?"":"_unnormalized"+($+=1),{prefix:u,name:f,parentMap:t,unnormalized:!!l,url:s,originalName:d,isDefine:p,id:(u?u+"!"+f:f)+l}}function r(e){var t=e.id,n=getOwn(C,t);return n||(n=C[t]=new w.Module(e)),n}function l(e,t,n){var i=e.id,o=getOwn(C,i);!hasProp(P,i)||o&&!o.defineEmitComplete?(o=r(e),o.error&&"error"===t?n(o.error):o.on(t,n)):"defined"===t&&n(P[i])}function c(e,t){var n=e.requireModules,i=!1;t?t(e):(each(n,function(t){var n=getOwn(C,t);n&&(n.error=e,n.events.error&&(i=!0,n.emit("error",e)))}),i||req.onError(e))}function u(){globalDefQueue.length&&(apsp.apply(S,[S.length-1,0].concat(globalDefQueue)),globalDefQueue=[])}function h(e){delete C[e],delete E[e]}function d(e,t,n){var i=e.map.id;e.error?e.emit("error",e.error):(t[i]=!0,each(e.depMaps,function(i,o){var a=i.id,s=getOwn(C,a);!s||e.depMatched[o]||n[a]||(getOwn(t,a)?(e.defineDep(o,P[a]),e.check()):d(s,t,n))}),n[i]=!0)}function p(){var e,t,n,a,s=1e3*k.waitSeconds,r=s&&w.startTime+s<(new Date).getTime(),l=[],u=[],h=!1,f=!0;if(!v){if(v=!0,eachProp(E,function(n){if(e=n.map,t=e.id,n.enabled&&(e.isDefine||u.push(n),!n.error))if(!n.inited&&r)o(t)?(a=!0,h=!0):(l.push(t),i(t));else if(!n.inited&&n.fetched&&e.isDefine&&(h=!0,!e.prefix))return f=!1}),r&&l.length)return n=makeError("timeout","Load timeout for modules: "+l,null,l),n.contextName=w.contextName,c(n);f&&each(u,function(e){d(e,{},{})}),r&&!a||!h||!isBrowser&&!isWebWorker||x||(x=setTimeout(function(){x=0,p()},50)),v=!1}}function f(e){hasProp(P,e[0])||r(s(e[0],null,!0)).init(e[1],e[2])}function m(e,t,n,i){e.detachEvent&&!isOpera?i&&e.detachEvent(i,t):e.removeEventListener(n,t,!1)}function g(e){var t=e.currentTarget||e.srcElement;return m(t,w.onScriptLoad,"load","onreadystatechange"),m(t,w.onScriptError,"error"),{node:t,id:t&&t.getAttribute("data-requiremodule")}}function _(){var e;for(u();S.length;){if(e=S.shift(),null===e[0])return c(makeError("mismatch","Mismatched anonymous define() module: "+e[e.length-1]));f(e)}}var v,y,w,b,x,k={waitSeconds:7,baseUrl:"./",paths:{},pkgs:{},shim:{},config:{}},C={},E={},T={},S=[],P={},A={},I=1,$=1;return b={require:function(e){return e.require?e.require:e.require=w.makeRequire(e.map)},exports:function(e){return e.usingExports=!0,e.map.isDefine?e.exports?e.exports:e.exports=P[e.map.id]={}:void 0},module:function(e){return e.module?e.module:e.module={id:e.map.id,uri:e.map.url,config:function(){var t,n=getOwn(k.pkgs,e.map.id);return t=n?getOwn(k.config,e.map.id+"/"+n.main):getOwn(k.config,e.map.id),t||{}},exports:P[e.map.id]}}},y=function(e){this.events=getOwn(T,e.id)||{},this.map=e,this.shim=getOwn(k.shim,e.id),this.depExports=[],this.depMaps=[],this.depMatched=[],this.pluginMaps={},this.depCount=0},y.prototype={init:function(e,t,n,i){i=i||{},this.inited||(this.factory=t,n?this.on("error",n):this.events.error&&(n=bind(this,function(e){this.emit("error",e)})),this.depMaps=e&&e.slice(0),this.errback=n,this.inited=!0,this.ignore=i.ignore,i.enabled||this.enabled?this.enable():this.check())},defineDep:function(e,t){this.depMatched[e]||(this.depMatched[e]=!0,this.depCount-=1,this.depExports[e]=t)},fetch:function(){if(!this.fetched){this.fetched=!0,w.startTime=(new Date).getTime();var e=this.map;return this.shim?(w.makeRequire(this.map,{enableBuildCallback:!0})(this.shim.deps||[],bind(this,function(){return e.prefix?this.callPlugin():this.load()})),void 0):e.prefix?this.callPlugin():this.load()}},load:function(){var e=this.map.url;A[e]||(A[e]=!0,w.load(this.map.id,e))},check:function(){if(this.enabled&&!this.enabling){var e,t,n=this.map.id,i=this.depExports,o=this.exports,a=this.factory;if(this.inited){if(this.error)this.emit("error",this.error);else if(!this.defining){if(this.defining=!0,1>this.depCount&&!this.defined){if(isFunction(a)){if(this.events.error&&this.map.isDefine||req.onError!==defaultOnError)try{o=w.execCb(n,a,i,o)}catch(s){e=s}else o=w.execCb(n,a,i,o);if(this.map.isDefine&&(t=this.module,t&&void 0!==t.exports&&t.exports!==this.exports?o=t.exports:void 0===o&&this.usingExports&&(o=this.exports)),e)return e.requireMap=this.map,e.requireModules=this.map.isDefine?[this.map.id]:null,e.requireType=this.map.isDefine?"define":"require",c(this.error=e)}else o=a;this.exports=o,this.map.isDefine&&!this.ignore&&(P[n]=o,req.onResourceLoad&&req.onResourceLoad(w,this.map,this.depMaps)),h(n),this.defined=!0}this.defining=!1,this.defined&&!this.defineEmitted&&(this.defineEmitted=!0,this.emit("defined",this.exports),this.defineEmitComplete=!0)}}else this.fetch()}},callPlugin:function(){var e=this.map,t=e.id,i=s(e.prefix);this.depMaps.push(i),l(i,"defined",bind(this,function(i){var o,a,u,d=this.map.name,p=this.map.parentMap?this.map.parentMap.name:null,f=w.makeRequire(e.parentMap,{enableBuildCallback:!0});return this.map.unnormalized?(i.normalize&&(d=i.normalize(d,function(e){return n(e,p,!0)})||""),a=s(e.prefix+"!"+d,this.map.parentMap),l(a,"defined",bind(this,function(e){this.init([],function(){return e},null,{enabled:!0,ignore:!0})})),u=getOwn(C,a.id),u&&(this.depMaps.push(a),this.events.error&&u.on("error",bind(this,function(e){this.emit("error",e)})),u.enable()),void 0):(o=bind(this,function(e){this.init([],function(){return e},null,{enabled:!0})}),o.error=bind(this,function(e){this.inited=!0,this.error=e,e.requireModules=[t],eachProp(C,function(e){0===e.map.id.indexOf(t+"_unnormalized")&&h(e.map.id)}),c(e)}),o.fromText=bind(this,function(n,i){var a=e.name,l=s(a),u=useInteractive;i&&(n=i),u&&(useInteractive=!1),r(l),hasProp(k.config,t)&&(k.config[a]=k.config[t]);try{req.exec(n)}catch(h){return c(makeError("fromtexteval","fromText eval for "+t+" failed: "+h,h,[t]))}u&&(useInteractive=!0),this.depMaps.push(l),w.completeLoad(a),f([a],o)}),i.load(e.name,f,o,k),void 0)})),w.enable(i,this),this.pluginMaps[i.id]=i},enable:function(){E[this.map.id]=this,this.enabled=!0,this.enabling=!0,each(this.depMaps,bind(this,function(e,t){var n,i,o;if("string"==typeof e){if(e=s(e,this.map.isDefine?this.map:this.map.parentMap,!1,!this.skipMap),this.depMaps[t]=e,o=getOwn(b,e.id))return this.depExports[t]=o(this),void 0;this.depCount+=1,l(e,"defined",bind(this,function(e){this.defineDep(t,e),this.check()})),this.errback&&l(e,"error",bind(this,this.errback))}n=e.id,i=C[n],hasProp(b,n)||!i||i.enabled||w.enable(e,this)})),eachProp(this.pluginMaps,bind(this,function(e){var t=getOwn(C,e.id);t&&!t.enabled&&w.enable(e,this)})),this.enabling=!1,this.check()},on:function(e,t){var n=this.events[e];n||(n=this.events[e]=[]),n.push(t)},emit:function(e,t){each(this.events[e],function(e){e(t)}),"error"===e&&delete this.events[e]}},w={config:k,contextName:e,registry:C,defined:P,urlFetched:A,defQueue:S,Module:y,makeModuleMap:s,nextTick:req.nextTick,onError:c,configure:function(e){e.baseUrl&&"/"!==e.baseUrl.charAt(e.baseUrl.length-1)&&(e.baseUrl+="/");var t=k.pkgs,n=k.shim,i={paths:!0,config:!0,map:!0};eachProp(e,function(e,t){i[t]?"map"===t?(k.map||(k.map={}),mixin(k[t],e,!0,!0)):mixin(k[t],e,!0):k[t]=e}),e.shim&&(eachProp(e.shim,function(e,t){isArray(e)&&(e={deps:e}),!e.exports&&!e.init||e.exportsFn||(e.exportsFn=w.makeShimExports(e)),n[t]=e}),k.shim=n),e.packages&&(each(e.packages,function(e){var n;e="string"==typeof e?{name:e}:e,n=e.location,t[e.name]={name:e.name,location:n||e.name,main:(e.main||"main").replace(currDirRegExp,"").replace(jsSuffixRegExp,"")}}),k.pkgs=t),eachProp(C,function(e,t){e.inited||e.map.unnormalized||(e.map=s(t))}),(e.deps||e.callback)&&w.require(e.deps||[],e.callback)},makeShimExports:function(e){function t(){var t;return e.init&&(t=e.init.apply(global,arguments)),t||e.exports&&getGlobal(e.exports)}return t},makeRequire:function(t,i){function o(n,a,l){var u,h,d;return i.enableBuildCallback&&a&&isFunction(a)&&(a.__requireJsBuild=!0),"string"==typeof n?isFunction(a)?c(makeError("requireargs","Invalid require call"),l):t&&hasProp(b,n)?b[n](C[t.id]):req.get?req.get(w,n,t,o):(h=s(n,t,!1,!0),u=h.id,hasProp(P,u)?P[u]:c(makeError("notloaded",'Module name "'+u+'" has not been loaded yet for context: '+e+(t?"":". Use require([])")))):(_(),w.nextTick(function(){_(),d=r(s(null,t)),d.skipMap=i.skipMap,d.init(n,a,l,{enabled:!0}),p()}),o)}return i=i||{},mixin(o,{isBrowser:isBrowser,toUrl:function(e){var i,o=e.lastIndexOf("."),a=e.split("/")[0],s="."===a||".."===a;return-1!==o&&(!s||o>1)&&(i=e.substring(o,e.length),e=e.substring(0,o)),w.nameToUrl(n(e,t&&t.id,!0),i,!0)},defined:function(e){return hasProp(P,s(e,t,!1,!0).id)},specified:function(e){return e=s(e,t,!1,!0).id,hasProp(P,e)||hasProp(C,e)}}),t||(o.undef=function(e){u();var n=s(e,t,!0),i=getOwn(C,e);delete P[e],delete A[n.url],delete T[e],i&&(i.events.defined&&(T[e]=i.events),h(e))}),o},enable:function(e){var t=getOwn(C,e.id);t&&r(e).enable()},completeLoad:function(e){var t,n,i,a=getOwn(k.shim,e)||{},s=a.exports;for(u();S.length;){if(n=S.shift(),null===n[0]){if(n[0]=e,t)break;t=!0}else n[0]===e&&(t=!0);f(n)}if(i=getOwn(C,e),!t&&!hasProp(P,e)&&i&&!i.inited){if(!(!k.enforceDefine||s&&getGlobal(s)))return o(e)?void 0:c(makeError("nodefine","No define call for "+e,null,[e]));f([e,a.deps||[],a.exportsFn])}p()},nameToUrl:function(e,t,n){var i,o,a,s,r,l,c,u,h;if(req.jsExtRegExp.test(e))u=e+(t||"");else{for(i=k.paths,o=k.pkgs,r=e.split("/"),l=r.length;l>0;l-=1){if(c=r.slice(0,l).join("/"),a=getOwn(o,c),h=getOwn(i,c)){isArray(h)&&(h=h[0]),r.splice(0,l,h);break}if(a){s=e===a.name?a.location+"/"+a.main:a.location,r.splice(0,l,s);break}}u=r.join("/"),u+=t||(/\?/.test(u)||n?"":".js"),u=("/"===u.charAt(0)||u.match(/^[\w\+\.\-]+:/)?"":k.baseUrl)+u}return k.urlArgs?u+((-1===u.indexOf("?")?"?":"&")+k.urlArgs):u},load:function(e,t){req.load(w,e,t)},execCb:function(e,t,n,i){return t.apply(i,n)},onScriptLoad:function(e){if("load"===e.type||readyRegExp.test((e.currentTarget||e.srcElement).readyState)){interactiveScript=null;var t=g(e);w.completeLoad(t.id)}},onScriptError:function(e){var t=g(e);return o(t.id)?void 0:c(makeError("scripterror","Script error for: "+t.id,e,[t.id]))}},w.require=w.makeRequire(),w}function getInteractiveScript(){return interactiveScript&&"interactive"===interactiveScript.readyState?interactiveScript:(eachReverse(scripts(),function(e){return"interactive"===e.readyState?interactiveScript=e:void 0}),interactiveScript)}var req,s,head,baseElement,dataMain,src,interactiveScript,currentlyAddingScript,mainScript,subPath,version="2.1.7",commentRegExp=/(\/\*([\s\S]*?)\*\/|([^:]|^)\/\/(.*)$)/gm,cjsRequireRegExp=/[^.]\s*require\s*\(\s*["']([^'"\s]+)["']\s*\)/g,jsSuffixRegExp=/\.js$/,currDirRegExp=/^\.\//,op=Object.prototype,ostring=op.toString,hasOwn=op.hasOwnProperty,ap=Array.prototype,apsp=ap.splice,isBrowser=!("undefined"==typeof window||!navigator||!window.document),isWebWorker=!isBrowser&&"undefined"!=typeof importScripts,readyRegExp=isBrowser&&"PLAYSTATION 3"===navigator.platform?/^complete$/:/^(complete|loaded)$/,defContextName="_",isOpera="undefined"!=typeof opera&&"[object Opera]"==""+opera,contexts={},cfg={},globalDefQueue=[],useInteractive=!1;if(void 0===define){if(requirejs!==void 0){if(isFunction(requirejs))return;cfg=requirejs,requirejs=void 0}void 0===require||isFunction(require)||(cfg=require,require=void 0),req=requirejs=function(e,t,n,i){var o,a,s=defContextName;return isArray(e)||"string"==typeof e||(a=e,isArray(t)?(e=t,t=n,n=i):e=[]),a&&a.context&&(s=a.context),o=getOwn(contexts,s),o||(o=contexts[s]=req.s.newContext(s)),a&&o.configure(a),o.require(e,t,n)},req.config=function(e){return req(e)},req.nextTick="undefined"!=typeof setTimeout?function(e){setTimeout(e,4)}:function(e){e()},require||(require=req),req.version=version,req.jsExtRegExp=/^\/|:|\?|\.js$/,req.isBrowser=isBrowser,s=req.s={contexts:contexts,newContext:newContext},req({}),each(["toUrl","undef","defined","specified"],function(e){req[e]=function(){var t=contexts[defContextName];return t.require[e].apply(t,arguments)}}),isBrowser&&(head=s.head=document.getElementsByTagName("head")[0],baseElement=document.getElementsByTagName("base")[0],baseElement&&(head=s.head=baseElement.parentNode)),req.onError=defaultOnError,req.createNode=function(e){var t=e.xhtml?document.createElementNS("http://www.w3.org/1999/xhtml","html:script"):document.createElement("script");return t.type=e.scriptType||"text/javascript",t.charset="utf-8",t.async=!0,t},req.load=function(e,t,n){var i,o=e&&e.config||{};if(isBrowser)return i=req.createNode(o,t,n),i.setAttribute("data-requirecontext",e.contextName),i.setAttribute("data-requiremodule",t),!i.attachEvent||i.attachEvent.toString&&0>(""+i.attachEvent).indexOf("[native code")||isOpera?(i.addEventListener("load",e.onScriptLoad,!1),i.addEventListener("error",e.onScriptError,!1)):(useInteractive=!0,i.attachEvent("onreadystatechange",e.onScriptLoad)),i.src=n,currentlyAddingScript=i,baseElement?head.insertBefore(i,baseElement):head.appendChild(i),currentlyAddingScript=null,i;if(isWebWorker)try{importScripts(n),e.completeLoad(t)}catch(a){e.onError(makeError("importscripts","importScripts failed for "+t+" at "+n,a,[t]))}},isBrowser&&eachReverse(scripts(),function(e){return head||(head=e.parentNode),dataMain=e.getAttribute("data-main"),dataMain?(mainScript=dataMain,cfg.baseUrl||(src=mainScript.split("/"),mainScript=src.pop(),subPath=src.length?src.join("/")+"/":"./",cfg.baseUrl=subPath),mainScript=mainScript.replace(jsSuffixRegExp,""),req.jsExtRegExp.test(mainScript)&&(mainScript=dataMain),cfg.deps=cfg.deps?cfg.deps.concat(mainScript):[mainScript],!0):void 0}),define=function(e,t,n){var i,o;"string"!=typeof e&&(n=t,t=e,e=null),isArray(t)||(n=t,t=null),!t&&isFunction(n)&&(t=[],n.length&&((""+n).replace(commentRegExp,"").replace(cjsRequireRegExp,function(e,n){t.push(n)}),t=(1===n.length?["require"]:["require","exports","module"]).concat(t))),useInteractive&&(i=currentlyAddingScript||getInteractiveScript(),i&&(e||(e=i.getAttribute("data-requiremodule")),o=contexts[i.getAttribute("data-requirecontext")])),(o?o.defQueue:globalDefQueue).push([e,t,n])},define.amd={jQuery:!0},req.exec=function(text){return eval(text)},req(cfg)}})(this),function(e,t){function n(e){var t=e.length,n=lt.type(e);return lt.isWindow(e)?!1:1===e.nodeType&&t?!0:"array"===n||"function"!==n&&(0===t||"number"==typeof t&&t>0&&t-1 in e)}function i(e){var t=kt[e]={};return lt.each(e.match(ut)||[],function(e,n){t[n]=!0}),t}function o(e,n,i,o){if(lt.acceptData(e)){var a,s,r=lt.expando,l="string"==typeof n,c=e.nodeType,u=c?lt.cache:e,h=c?e[r]:e[r]&&r;if(h&&u[h]&&(o||u[h].data)||!l||i!==t)return h||(c?e[r]=h=Z.pop()||lt.guid++:h=r),u[h]||(u[h]={},c||(u[h].toJSON=lt.noop)),("object"==typeof n||"function"==typeof n)&&(o?u[h]=lt.extend(u[h],n):u[h].data=lt.extend(u[h].data,n)),a=u[h],o||(a.data||(a.data={}),a=a.data),i!==t&&(a[lt.camelCase(n)]=i),l?(s=a[n],null==s&&(s=a[lt.camelCase(n)])):s=a,s}}function a(e,t,n){if(lt.acceptData(e)){var i,o,a,s=e.nodeType,l=s?lt.cache:e,c=s?e[lt.expando]:lt.expando;if(l[c]){if(t&&(a=n?l[c]:l[c].data)){lt.isArray(t)?t=t.concat(lt.map(t,lt.camelCase)):t in a?t=[t]:(t=lt.camelCase(t),t=t in a?[t]:t.split(" "));for(i=0,o=t.length;o>i;i++)delete a[t[i]];if(!(n?r:lt.isEmptyObject)(a))return}(n||(delete l[c].data,r(l[c])))&&(s?lt.cleanData([e],!0):lt.support.deleteExpando||l!=l.window?delete l[c]:l[c]=null)}}}function s(e,n,i){if(i===t&&1===e.nodeType){var o="data-"+n.replace(Et,"-$1").toLowerCase();if(i=e.getAttribute(o),"string"==typeof i){try{i="true"===i?!0:"false"===i?!1:"null"===i?null:+i+""===i?+i:Ct.test(i)?lt.parseJSON(i):i}catch(a){}lt.data(e,n,i)}else i=t}return i}function r(e){var t;for(t in e)if(("data"!==t||!lt.isEmptyObject(e[t]))&&"toJSON"!==t)return!1;return!0}function l(){return!0}function c(){return!1}function u(e,t){do e=e[t];while(e&&1!==e.nodeType);return e}function h(e,t,n){if(t=t||0,lt.isFunction(t))return lt.grep(e,function(e,i){var o=!!t.call(e,i,e);return o===n});if(t.nodeType)return lt.grep(e,function(e){return e===t===n});if("string"==typeof t){var i=lt.grep(e,function(e){return 1===e.nodeType});if(Wt.test(t))return lt.filter(t,i,!n);t=lt.filter(t,i)}return lt.grep(e,function(e){return lt.inArray(e,t)>=0===n})}function d(e){var t=Bt.split("|"),n=e.createDocumentFragment();if(n.createElement)for(;t.length;)n.createElement(t.pop());return n}function p(e,t){return e.getElementsByTagName(t)[0]||e.appendChild(e.ownerDocument.createElement(t))}function f(e){var t=e.getAttributeNode("type");return e.type=(t&&t.specified)+"/"+e.type,e}function m(e){var t=an.exec(e.type);return t?e.type=t[1]:e.removeAttribute("type"),e}function g(e,t){for(var n,i=0;null!=(n=e[i]);i++)lt._data(n,"globalEval",!t||lt._data(t[i],"globalEval"))}function _(e,t){if(1===t.nodeType&&lt.hasData(e)){var n,i,o,a=lt._data(e),s=lt._data(t,a),r=a.events;if(r){delete s.handle,s.events={};for(n in r)for(i=0,o=r[n].length;o>i;i++)lt.event.add(t,n,r[n][i])}s.data&&(s.data=lt.extend({},s.data))}}function v(e,t){var n,i,o;if(1===t.nodeType){if(n=t.nodeName.toLowerCase(),!lt.support.noCloneEvent&&t[lt.expando]){o=lt._data(t);for(i in o.events)lt.removeEvent(t,i,o.handle);t.removeAttribute(lt.expando)}"script"===n&&t.text!==e.text?(f(t).text=e.text,m(t)):"object"===n?(t.parentNode&&(t.outerHTML=e.outerHTML),lt.support.html5Clone&&e.innerHTML&&!lt.trim(t.innerHTML)&&(t.innerHTML=e.innerHTML)):"input"===n&&tn.test(e.type)?(t.defaultChecked=t.checked=e.checked,t.value!==e.value&&(t.value=e.value)):"option"===n?t.defaultSelected=t.selected=e.defaultSelected:("input"===n||"textarea"===n)&&(t.defaultValue=e.defaultValue)}}function y(e,n){var i,o,a=0,s=typeof e.getElementsByTagName!==V?e.getElementsByTagName(n||"*"):typeof e.querySelectorAll!==V?e.querySelectorAll(n||"*"):t;if(!s)for(s=[],i=e.childNodes||e;null!=(o=i[a]);a++)!n||lt.nodeName(o,n)?s.push(o):lt.merge(s,y(o,n));return n===t||n&&lt.nodeName(e,n)?lt.merge([e],s):s}function w(e){tn.test(e.type)&&(e.defaultChecked=e.checked)}function b(e,t){if(t in e)return t;for(var n=t.charAt(0).toUpperCase()+t.slice(1),i=t,o=En.length;o--;)if(t=En[o]+n,t in e)return t;return i}function x(e,t){return e=t||e,"none"===lt.css(e,"display")||!lt.contains(e.ownerDocument,e)}function k(e,t){for(var n,i,o,a=[],s=0,r=e.length;r>s;s++)i=e[s],i.style&&(a[s]=lt._data(i,"olddisplay"),n=i.style.display,t?(a[s]||"none"!==n||(i.style.display=""),""===i.style.display&&x(i)&&(a[s]=lt._data(i,"olddisplay",S(i.nodeName)))):a[s]||(o=x(i),(n&&"none"!==n||!o)&&lt._data(i,"olddisplay",o?n:lt.css(i,"display"))));for(s=0;r>s;s++)i=e[s],i.style&&(t&&"none"!==i.style.display&&""!==i.style.display||(i.style.display=t?a[s]||"":"none"));return e}function C(e,t,n){var i=vn.exec(t);return i?Math.max(0,i[1]-(n||0))+(i[2]||"px"):t}function E(e,t,n,i,o){for(var a=n===(i?"border":"content")?4:"width"===t?1:0,s=0;4>a;a+=2)"margin"===n&&(s+=lt.css(e,n+Cn[a],!0,o)),i?("content"===n&&(s-=lt.css(e,"padding"+Cn[a],!0,o)),"margin"!==n&&(s-=lt.css(e,"border"+Cn[a]+"Width",!0,o))):(s+=lt.css(e,"padding"+Cn[a],!0,o),"padding"!==n&&(s+=lt.css(e,"border"+Cn[a]+"Width",!0,o)));return s}function T(e,t,n){var i=!0,o="width"===t?e.offsetWidth:e.offsetHeight,a=hn(e),s=lt.support.boxSizing&&"border-box"===lt.css(e,"boxSizing",!1,a);if(0>=o||null==o){if(o=dn(e,t,a),(0>o||null==o)&&(o=e.style[t]),yn.test(o))return o;i=s&&(lt.support.boxSizingReliable||o===e.style[t]),o=parseFloat(o)||0}return o+E(e,t,n||(s?"border":"content"),i,a)+"px"}function S(e){var t=Y,n=bn[e];return n||(n=P(e,t),"none"!==n&&n||(un=(un||lt("<iframe frameborder='0' width='0' height='0'/>").css("cssText","display:block !important")).appendTo(t.documentElement),t=(un[0].contentWindow||un[0].contentDocument).document,t.write("<!doctype html><html><body>"),t.close(),n=P(e,t),un.detach()),bn[e]=n),n}function P(e,t){var n=lt(t.createElement(e)).appendTo(t.body),i=lt.css(n[0],"display");return n.remove(),i}function A(e,t,n,i){var o;if(lt.isArray(t))lt.each(t,function(t,o){n||Sn.test(e)?i(e,o):A(e+"["+("object"==typeof o?t:"")+"]",o,n,i)});else if(n||"object"!==lt.type(t))i(e,t);else for(o in t)A(e+"["+o+"]",t[o],n,i)}function I(e){return function(t,n){"string"!=typeof t&&(n=t,t="*");var i,o=0,a=t.toLowerCase().match(ut)||[];if(lt.isFunction(n))for(;i=a[o++];)"+"===i[0]?(i=i.slice(1)||"*",(e[i]=e[i]||[]).unshift(n)):(e[i]=e[i]||[]).push(n)}}function $(e,n,i,o){function a(l){var c;return s[l]=!0,lt.each(e[l]||[],function(e,l){var u=l(n,i,o);return"string"!=typeof u||r||s[u]?r?!(c=u):t:(n.dataTypes.unshift(u),a(u),!1)}),c}var s={},r=e===Fn;return a(n.dataTypes[0])||!s["*"]&&a("*")}function N(e,n){var i,o,a=lt.ajaxSettings.flatOptions||{};for(o in n)n[o]!==t&&((a[o]?e:i||(i={}))[o]=n[o]);return i&&lt.extend(!0,e,i),e}function M(e,n,i){var o,a,s,r,l=e.contents,c=e.dataTypes,u=e.responseFields;for(r in u)r in i&&(n[u[r]]=i[r]);for(;"*"===c[0];)c.shift(),a===t&&(a=e.mimeType||n.getResponseHeader("Content-Type"));if(a)for(r in l)if(l[r]&&l[r].test(a)){c.unshift(r);break}if(c[0]in i)s=c[0];else{for(r in i){if(!c[0]||e.converters[r+" "+c[0]]){s=r;break}o||(o=r)}s=s||o}return s?(s!==c[0]&&c.unshift(s),i[s]):t}function R(e,t){var n,i,o,a,s={},r=0,l=e.dataTypes.slice(),c=l[0];if(e.dataFilter&&(t=e.dataFilter(t,e.dataType)),l[1])for(o in e.converters)s[o.toLowerCase()]=e.converters[o];for(;i=l[++r];)if("*"!==i){if("*"!==c&&c!==i){if(o=s[c+" "+i]||s["* "+i],!o)for(n in s)if(a=n.split(" "),a[1]===i&&(o=s[c+" "+a[0]]||s["* "+a[0]])){o===!0?o=s[n]:s[n]!==!0&&(i=a[0],l.splice(r--,0,i));break}if(o!==!0)if(o&&e["throws"])t=o(t);else try{t=o(t)}catch(u){return{state:"parsererror",error:o?u:"No conversion from "+c+" to "+i}}}c=i}return{state:"success",data:t}}function j(){try{return new e.XMLHttpRequest}catch(t){}}function O(){try{return new e.ActiveXObject("Microsoft.XMLHTTP")}catch(t){}}function D(){return setTimeout(function(){Zn=t}),Zn=lt.now()}function H(e,t){lt.each(t,function(t,n){for(var i=(ai[t]||[]).concat(ai["*"]),o=0,a=i.length;a>o;o++)if(i[o].call(e,t,n))return})}function L(e,t,n){var i,o,a=0,s=oi.length,r=lt.Deferred().always(function(){delete l.elem}),l=function(){if(o)return!1;for(var t=Zn||D(),n=Math.max(0,c.startTime+c.duration-t),i=n/c.duration||0,a=1-i,s=0,l=c.tweens.length;l>s;s++)c.tweens[s].run(a);return r.notifyWith(e,[c,a,n]),1>a&&l?n:(r.resolveWith(e,[c]),!1)},c=r.promise({elem:e,props:lt.extend({},t),opts:lt.extend(!0,{specialEasing:{}},n),originalProperties:t,originalOptions:n,startTime:Zn||D(),duration:n.duration,tweens:[],createTween:function(t,n){var i=lt.Tween(e,c.opts,t,n,c.opts.specialEasing[t]||c.opts.easing);return c.tweens.push(i),i},stop:function(t){var n=0,i=t?c.tweens.length:0;if(o)return this;for(o=!0;i>n;n++)c.tweens[n].run(1);return t?r.resolveWith(e,[c,t]):r.rejectWith(e,[c,t]),this}}),u=c.props;for(z(u,c.opts.specialEasing);s>a;a++)if(i=oi[a].call(c,e,u,c.opts))return i;return H(c,u),lt.isFunction(c.opts.start)&&c.opts.start.call(e,c),lt.fx.timer(lt.extend(l,{elem:e,anim:c,queue:c.opts.queue})),c.progress(c.opts.progress).done(c.opts.done,c.opts.complete).fail(c.opts.fail).always(c.opts.always)}function z(e,t){var n,i,o,a,s;for(o in e)if(i=lt.camelCase(o),a=t[i],n=e[o],lt.isArray(n)&&(a=n[1],n=e[o]=n[0]),o!==i&&(e[i]=n,delete e[o]),s=lt.cssHooks[i],s&&"expand"in s){n=s.expand(n),delete e[i];for(o in n)o in e||(e[o]=n[o],t[o]=a)}else t[i]=a}function q(e,t,n){var i,o,a,s,r,l,c,u,h,d=this,p=e.style,f={},m=[],g=e.nodeType&&x(e);n.queue||(u=lt._queueHooks(e,"fx"),null==u.unqueued&&(u.unqueued=0,h=u.empty.fire,u.empty.fire=function(){u.unqueued||h()}),u.unqueued++,d.always(function(){d.always(function(){u.unqueued--,lt.queue(e,"fx").length||u.empty.fire()})})),1===e.nodeType&&("height"in t||"width"in t)&&(n.overflow=[p.overflow,p.overflowX,p.overflowY],"inline"===lt.css(e,"display")&&"none"===lt.css(e,"float")&&(lt.support.inlineBlockNeedsLayout&&"inline"!==S(e.nodeName)?p.zoom=1:p.display="inline-block")),n.overflow&&(p.overflow="hidden",lt.support.shrinkWrapBlocks||d.always(function(){p.overflow=n.overflow[0],p.overflowX=n.overflow[1],p.overflowY=n.overflow[2]}));for(o in t)if(s=t[o],ti.exec(s)){if(delete t[o],l=l||"toggle"===s,s===(g?"hide":"show"))continue;m.push(o)}if(a=m.length){r=lt._data(e,"fxshow")||lt._data(e,"fxshow",{}),"hidden"in r&&(g=r.hidden),l&&(r.hidden=!g),g?lt(e).show():d.done(function(){lt(e).hide()}),d.done(function(){var t;lt._removeData(e,"fxshow");for(t in f)lt.style(e,t,f[t])});for(o=0;a>o;o++)i=m[o],c=d.createTween(i,g?r[i]:0),f[i]=r[i]||lt.style(e,i),i in r||(r[i]=c.start,g&&(c.end=c.start,c.start="width"===i||"height"===i?1:0))}}function U(e,t,n,i,o){return new U.prototype.init(e,t,n,i,o)}function W(e,t){var n,i={height:e},o=0;for(t=t?1:0;4>o;o+=2-t)n=Cn[o],i["margin"+n]=i["padding"+n]=e;return t&&(i.opacity=i.width=e),i}function F(e){return lt.isWindow(e)?e:9===e.nodeType?e.defaultView||e.parentWindow:!1}var G,B,V=typeof t,Y=e.document,K=e.location,Q=e.jQuery,X=e.$,J={},Z=[],et="1.9.1",tt=Z.concat,nt=Z.push,it=Z.slice,ot=Z.indexOf,at=J.toString,st=J.hasOwnProperty,rt=et.trim,lt=function(e,t){return new lt.fn.init(e,t,B)},ct=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,ut=/\S+/g,ht=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,dt=/^(?:(<[\w\W]+>)[^>]*|#([\w-]*))$/,pt=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,ft=/^[\],:{}\s]*$/,mt=/(?:^|:|,)(?:\s*\[)+/g,gt=/\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g,_t=/"[^"\\\r\n]*"|true|false|null|-?(?:\d+\.|)\d+(?:[eE][+-]?\d+|)/g,vt=/^-ms-/,yt=/-([\da-z])/gi,wt=function(e,t){return t.toUpperCase()},bt=function(e){(Y.addEventListener||"load"===e.type||"complete"===Y.readyState)&&(xt(),lt.ready())},xt=function(){Y.addEventListener?(Y.removeEventListener("DOMContentLoaded",bt,!1),e.removeEventListener("load",bt,!1)):(Y.detachEvent("onreadystatechange",bt),e.detachEvent("onload",bt))};lt.fn=lt.prototype={jquery:et,constructor:lt,init:function(e,n,i){var o,a;if(!e)return this;if("string"==typeof e){if(o="<"===e.charAt(0)&&">"===e.charAt(e.length-1)&&e.length>=3?[null,e,null]:dt.exec(e),!o||!o[1]&&n)return!n||n.jquery?(n||i).find(e):this.constructor(n).find(e);if(o[1]){if(n=n instanceof lt?n[0]:n,lt.merge(this,lt.parseHTML(o[1],n&&n.nodeType?n.ownerDocument||n:Y,!0)),pt.test(o[1])&&lt.isPlainObject(n))for(o in n)lt.isFunction(this[o])?this[o](n[o]):this.attr(o,n[o]);return this}if(a=Y.getElementById(o[2]),a&&a.parentNode){if(a.id!==o[2])return i.find(e);this.length=1,this[0]=a}return this.context=Y,this.selector=e,this}return e.nodeType?(this.context=this[0]=e,this.length=1,this):lt.isFunction(e)?i.ready(e):(e.selector!==t&&(this.selector=e.selector,this.context=e.context),lt.makeArray(e,this))},selector:"",length:0,size:function(){return this.length},toArray:function(){return it.call(this)},get:function(e){return null==e?this.toArray():0>e?this[this.length+e]:this[e]},pushStack:function(e){var t=lt.merge(this.constructor(),e);return t.prevObject=this,t.context=this.context,t},each:function(e,t){return lt.each(this,e,t)},ready:function(e){return lt.ready.promise().done(e),this},slice:function(){return this.pushStack(it.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(e){var t=this.length,n=+e+(0>e?t:0);return this.pushStack(n>=0&&t>n?[this[n]]:[])},map:function(e){return this.pushStack(lt.map(this,function(t,n){return e.call(t,n,t)}))},end:function(){return this.prevObject||this.constructor(null)
},push:nt,sort:[].sort,splice:[].splice},lt.fn.init.prototype=lt.fn,lt.extend=lt.fn.extend=function(){var e,n,i,o,a,s,r=arguments[0]||{},l=1,c=arguments.length,u=!1;for("boolean"==typeof r&&(u=r,r=arguments[1]||{},l=2),"object"==typeof r||lt.isFunction(r)||(r={}),c===l&&(r=this,--l);c>l;l++)if(null!=(a=arguments[l]))for(o in a)e=r[o],i=a[o],r!==i&&(u&&i&&(lt.isPlainObject(i)||(n=lt.isArray(i)))?(n?(n=!1,s=e&&lt.isArray(e)?e:[]):s=e&&lt.isPlainObject(e)?e:{},r[o]=lt.extend(u,s,i)):i!==t&&(r[o]=i));return r},lt.extend({noConflict:function(t){return e.$===lt&&(e.$=X),t&&e.jQuery===lt&&(e.jQuery=Q),lt},isReady:!1,readyWait:1,holdReady:function(e){e?lt.readyWait++:lt.ready(!0)},ready:function(e){if(e===!0?!--lt.readyWait:!lt.isReady){if(!Y.body)return setTimeout(lt.ready);lt.isReady=!0,e!==!0&&--lt.readyWait>0||(G.resolveWith(Y,[lt]),lt.fn.trigger&&lt(Y).trigger("ready").off("ready"))}},isFunction:function(e){return"function"===lt.type(e)},isArray:Array.isArray||function(e){return"array"===lt.type(e)},isWindow:function(e){return null!=e&&e==e.window},isNumeric:function(e){return!isNaN(parseFloat(e))&&isFinite(e)},type:function(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?J[at.call(e)]||"object":typeof e},isPlainObject:function(e){if(!e||"object"!==lt.type(e)||e.nodeType||lt.isWindow(e))return!1;try{if(e.constructor&&!st.call(e,"constructor")&&!st.call(e.constructor.prototype,"isPrototypeOf"))return!1}catch(n){return!1}var i;for(i in e);return i===t||st.call(e,i)},isEmptyObject:function(e){var t;for(t in e)return!1;return!0},error:function(e){throw Error(e)},parseHTML:function(e,t,n){if(!e||"string"!=typeof e)return null;"boolean"==typeof t&&(n=t,t=!1),t=t||Y;var i=pt.exec(e),o=!n&&[];return i?[t.createElement(i[1])]:(i=lt.buildFragment([e],t,o),o&&lt(o).remove(),lt.merge([],i.childNodes))},parseJSON:function(n){return e.JSON&&e.JSON.parse?e.JSON.parse(n):null===n?n:"string"==typeof n&&(n=lt.trim(n),n&&ft.test(n.replace(gt,"@").replace(_t,"]").replace(mt,"")))?Function("return "+n)():(lt.error("Invalid JSON: "+n),t)},parseXML:function(n){var i,o;if(!n||"string"!=typeof n)return null;try{e.DOMParser?(o=new DOMParser,i=o.parseFromString(n,"text/xml")):(i=new ActiveXObject("Microsoft.XMLDOM"),i.async="false",i.loadXML(n))}catch(a){i=t}return i&&i.documentElement&&!i.getElementsByTagName("parsererror").length||lt.error("Invalid XML: "+n),i},noop:function(){},globalEval:function(t){t&&lt.trim(t)&&(e.execScript||function(t){e.eval.call(e,t)})(t)},camelCase:function(e){return e.replace(vt,"ms-").replace(yt,wt)},nodeName:function(e,t){return e.nodeName&&e.nodeName.toLowerCase()===t.toLowerCase()},each:function(e,t,i){var o,a=0,s=e.length,r=n(e);if(i){if(r)for(;s>a&&(o=t.apply(e[a],i),o!==!1);a++);else for(a in e)if(o=t.apply(e[a],i),o===!1)break}else if(r)for(;s>a&&(o=t.call(e[a],a,e[a]),o!==!1);a++);else for(a in e)if(o=t.call(e[a],a,e[a]),o===!1)break;return e},trim:rt&&!rt.call(" ")?function(e){return null==e?"":rt.call(e)}:function(e){return null==e?"":(e+"").replace(ht,"")},makeArray:function(e,t){var i=t||[];return null!=e&&(n(Object(e))?lt.merge(i,"string"==typeof e?[e]:e):nt.call(i,e)),i},inArray:function(e,t,n){var i;if(t){if(ot)return ot.call(t,e,n);for(i=t.length,n=n?0>n?Math.max(0,i+n):n:0;i>n;n++)if(n in t&&t[n]===e)return n}return-1},merge:function(e,n){var i=n.length,o=e.length,a=0;if("number"==typeof i)for(;i>a;a++)e[o++]=n[a];else for(;n[a]!==t;)e[o++]=n[a++];return e.length=o,e},grep:function(e,t,n){var i,o=[],a=0,s=e.length;for(n=!!n;s>a;a++)i=!!t(e[a],a),n!==i&&o.push(e[a]);return o},map:function(e,t,i){var o,a=0,s=e.length,r=n(e),l=[];if(r)for(;s>a;a++)o=t(e[a],a,i),null!=o&&(l[l.length]=o);else for(a in e)o=t(e[a],a,i),null!=o&&(l[l.length]=o);return tt.apply([],l)},guid:1,proxy:function(e,n){var i,o,a;return"string"==typeof n&&(a=e[n],n=e,e=a),lt.isFunction(e)?(i=it.call(arguments,2),o=function(){return e.apply(n||this,i.concat(it.call(arguments)))},o.guid=e.guid=e.guid||lt.guid++,o):t},access:function(e,n,i,o,a,s,r){var l=0,c=e.length,u=null==i;if("object"===lt.type(i)){a=!0;for(l in i)lt.access(e,n,l,i[l],!0,s,r)}else if(o!==t&&(a=!0,lt.isFunction(o)||(r=!0),u&&(r?(n.call(e,o),n=null):(u=n,n=function(e,t,n){return u.call(lt(e),n)})),n))for(;c>l;l++)n(e[l],i,r?o:o.call(e[l],l,n(e[l],i)));return a?e:u?n.call(e):c?n(e[0],i):s},now:function(){return(new Date).getTime()}}),lt.ready.promise=function(t){if(!G)if(G=lt.Deferred(),"complete"===Y.readyState)setTimeout(lt.ready);else if(Y.addEventListener)Y.addEventListener("DOMContentLoaded",bt,!1),e.addEventListener("load",bt,!1);else{Y.attachEvent("onreadystatechange",bt),e.attachEvent("onload",bt);var n=!1;try{n=null==e.frameElement&&Y.documentElement}catch(i){}n&&n.doScroll&&function o(){if(!lt.isReady){try{n.doScroll("left")}catch(e){return setTimeout(o,50)}xt(),lt.ready()}}()}return G.promise(t)},lt.each("Boolean Number String Function Array Date RegExp Object Error".split(" "),function(e,t){J["[object "+t+"]"]=t.toLowerCase()}),B=lt(Y);var kt={};lt.Callbacks=function(e){e="string"==typeof e?kt[e]||i(e):lt.extend({},e);var n,o,a,s,r,l,c=[],u=!e.once&&[],h=function(t){for(o=e.memory&&t,a=!0,r=l||0,l=0,s=c.length,n=!0;c&&s>r;r++)if(c[r].apply(t[0],t[1])===!1&&e.stopOnFalse){o=!1;break}n=!1,c&&(u?u.length&&h(u.shift()):o?c=[]:d.disable())},d={add:function(){if(c){var t=c.length;(function i(t){lt.each(t,function(t,n){var o=lt.type(n);"function"===o?e.unique&&d.has(n)||c.push(n):n&&n.length&&"string"!==o&&i(n)})})(arguments),n?s=c.length:o&&(l=t,h(o))}return this},remove:function(){return c&&lt.each(arguments,function(e,t){for(var i;(i=lt.inArray(t,c,i))>-1;)c.splice(i,1),n&&(s>=i&&s--,r>=i&&r--)}),this},has:function(e){return e?lt.inArray(e,c)>-1:!(!c||!c.length)},empty:function(){return c=[],this},disable:function(){return c=u=o=t,this},disabled:function(){return!c},lock:function(){return u=t,o||d.disable(),this},locked:function(){return!u},fireWith:function(e,t){return t=t||[],t=[e,t.slice?t.slice():t],!c||a&&!u||(n?u.push(t):h(t)),this},fire:function(){return d.fireWith(this,arguments),this},fired:function(){return!!a}};return d},lt.extend({Deferred:function(e){var t=[["resolve","done",lt.Callbacks("once memory"),"resolved"],["reject","fail",lt.Callbacks("once memory"),"rejected"],["notify","progress",lt.Callbacks("memory")]],n="pending",i={state:function(){return n},always:function(){return o.done(arguments).fail(arguments),this},then:function(){var e=arguments;return lt.Deferred(function(n){lt.each(t,function(t,a){var s=a[0],r=lt.isFunction(e[t])&&e[t];o[a[1]](function(){var e=r&&r.apply(this,arguments);e&&lt.isFunction(e.promise)?e.promise().done(n.resolve).fail(n.reject).progress(n.notify):n[s+"With"](this===i?n.promise():this,r?[e]:arguments)})}),e=null}).promise()},promise:function(e){return null!=e?lt.extend(e,i):i}},o={};return i.pipe=i.then,lt.each(t,function(e,a){var s=a[2],r=a[3];i[a[1]]=s.add,r&&s.add(function(){n=r},t[1^e][2].disable,t[2][2].lock),o[a[0]]=function(){return o[a[0]+"With"](this===o?i:this,arguments),this},o[a[0]+"With"]=s.fireWith}),i.promise(o),e&&e.call(o,o),o},when:function(e){var t,n,i,o=0,a=it.call(arguments),s=a.length,r=1!==s||e&&lt.isFunction(e.promise)?s:0,l=1===r?e:lt.Deferred(),c=function(e,n,i){return function(o){n[e]=this,i[e]=arguments.length>1?it.call(arguments):o,i===t?l.notifyWith(n,i):--r||l.resolveWith(n,i)}};if(s>1)for(t=Array(s),n=Array(s),i=Array(s);s>o;o++)a[o]&&lt.isFunction(a[o].promise)?a[o].promise().done(c(o,i,a)).fail(l.reject).progress(c(o,n,t)):--r;return r||l.resolveWith(i,a),l.promise()}}),lt.support=function(){var t,n,i,o,a,s,r,l,c,u,h=Y.createElement("div");if(h.setAttribute("className","t"),h.innerHTML=" <link/><table></table><a href='/a'>a</a><input type='checkbox'/>",n=h.getElementsByTagName("*"),i=h.getElementsByTagName("a")[0],!n||!i||!n.length)return{};a=Y.createElement("select"),r=a.appendChild(Y.createElement("option")),o=h.getElementsByTagName("input")[0],i.style.cssText="top:1px;float:left;opacity:.5",t={getSetAttribute:"t"!==h.className,leadingWhitespace:3===h.firstChild.nodeType,tbody:!h.getElementsByTagName("tbody").length,htmlSerialize:!!h.getElementsByTagName("link").length,style:/top/.test(i.getAttribute("style")),hrefNormalized:"/a"===i.getAttribute("href"),opacity:/^0.5/.test(i.style.opacity),cssFloat:!!i.style.cssFloat,checkOn:!!o.value,optSelected:r.selected,enctype:!!Y.createElement("form").enctype,html5Clone:"<:nav></:nav>"!==Y.createElement("nav").cloneNode(!0).outerHTML,boxModel:"CSS1Compat"===Y.compatMode,deleteExpando:!0,noCloneEvent:!0,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableMarginRight:!0,boxSizingReliable:!0,pixelPosition:!1},o.checked=!0,t.noCloneChecked=o.cloneNode(!0).checked,a.disabled=!0,t.optDisabled=!r.disabled;try{delete h.test}catch(d){t.deleteExpando=!1}o=Y.createElement("input"),o.setAttribute("value",""),t.input=""===o.getAttribute("value"),o.value="t",o.setAttribute("type","radio"),t.radioValue="t"===o.value,o.setAttribute("checked","t"),o.setAttribute("name","t"),s=Y.createDocumentFragment(),s.appendChild(o),t.appendChecked=o.checked,t.checkClone=s.cloneNode(!0).cloneNode(!0).lastChild.checked,h.attachEvent&&(h.attachEvent("onclick",function(){t.noCloneEvent=!1}),h.cloneNode(!0).click());for(u in{submit:!0,change:!0,focusin:!0})h.setAttribute(l="on"+u,"t"),t[u+"Bubbles"]=l in e||h.attributes[l].expando===!1;return h.style.backgroundClip="content-box",h.cloneNode(!0).style.backgroundClip="",t.clearCloneStyle="content-box"===h.style.backgroundClip,lt(function(){var n,i,o,a="padding:0;margin:0;border:0;display:block;box-sizing:content-box;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;",s=Y.getElementsByTagName("body")[0];s&&(n=Y.createElement("div"),n.style.cssText="border:0;width:0;height:0;position:absolute;top:0;left:-9999px;margin-top:1px",s.appendChild(n).appendChild(h),h.innerHTML="<table><tr><td></td><td>t</td></tr></table>",o=h.getElementsByTagName("td"),o[0].style.cssText="padding:0;margin:0;border:0;display:none",c=0===o[0].offsetHeight,o[0].style.display="",o[1].style.display="none",t.reliableHiddenOffsets=c&&0===o[0].offsetHeight,h.innerHTML="",h.style.cssText="box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;position:absolute;top:1%;",t.boxSizing=4===h.offsetWidth,t.doesNotIncludeMarginInBodyOffset=1!==s.offsetTop,e.getComputedStyle&&(t.pixelPosition="1%"!==(e.getComputedStyle(h,null)||{}).top,t.boxSizingReliable="4px"===(e.getComputedStyle(h,null)||{width:"4px"}).width,i=h.appendChild(Y.createElement("div")),i.style.cssText=h.style.cssText=a,i.style.marginRight=i.style.width="0",h.style.width="1px",t.reliableMarginRight=!parseFloat((e.getComputedStyle(i,null)||{}).marginRight)),typeof h.style.zoom!==V&&(h.innerHTML="",h.style.cssText=a+"width:1px;padding:1px;display:inline;zoom:1",t.inlineBlockNeedsLayout=3===h.offsetWidth,h.style.display="block",h.innerHTML="<div></div>",h.firstChild.style.width="5px",t.shrinkWrapBlocks=3!==h.offsetWidth,t.inlineBlockNeedsLayout&&(s.style.zoom=1)),s.removeChild(n),n=h=o=i=null)}),n=a=s=r=i=o=null,t}();var Ct=/(?:\{[\s\S]*\}|\[[\s\S]*\])$/,Et=/([A-Z])/g;lt.extend({cache:{},expando:"jQuery"+(et+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(e){return e=e.nodeType?lt.cache[e[lt.expando]]:e[lt.expando],!!e&&!r(e)},data:function(e,t,n){return o(e,t,n)},removeData:function(e,t){return a(e,t)},_data:function(e,t,n){return o(e,t,n,!0)},_removeData:function(e,t){return a(e,t,!0)},acceptData:function(e){if(e.nodeType&&1!==e.nodeType&&9!==e.nodeType)return!1;var t=e.nodeName&&lt.noData[e.nodeName.toLowerCase()];return!t||t!==!0&&e.getAttribute("classid")===t}}),lt.fn.extend({data:function(e,n){var i,o,a=this[0],r=0,l=null;if(e===t){if(this.length&&(l=lt.data(a),1===a.nodeType&&!lt._data(a,"parsedAttrs"))){for(i=a.attributes;i.length>r;r++)o=i[r].name,o.indexOf("data-")||(o=lt.camelCase(o.slice(5)),s(a,o,l[o]));lt._data(a,"parsedAttrs",!0)}return l}return"object"==typeof e?this.each(function(){lt.data(this,e)}):lt.access(this,function(n){return n===t?a?s(a,e,lt.data(a,e)):null:(this.each(function(){lt.data(this,e,n)}),t)},null,n,arguments.length>1,null,!0)},removeData:function(e){return this.each(function(){lt.removeData(this,e)})}}),lt.extend({queue:function(e,n,i){var o;return e?(n=(n||"fx")+"queue",o=lt._data(e,n),i&&(!o||lt.isArray(i)?o=lt._data(e,n,lt.makeArray(i)):o.push(i)),o||[]):t},dequeue:function(e,t){t=t||"fx";var n=lt.queue(e,t),i=n.length,o=n.shift(),a=lt._queueHooks(e,t),s=function(){lt.dequeue(e,t)};"inprogress"===o&&(o=n.shift(),i--),a.cur=o,o&&("fx"===t&&n.unshift("inprogress"),delete a.stop,o.call(e,s,a)),!i&&a&&a.empty.fire()},_queueHooks:function(e,t){var n=t+"queueHooks";return lt._data(e,n)||lt._data(e,n,{empty:lt.Callbacks("once memory").add(function(){lt._removeData(e,t+"queue"),lt._removeData(e,n)})})}}),lt.fn.extend({queue:function(e,n){var i=2;return"string"!=typeof e&&(n=e,e="fx",i--),i>arguments.length?lt.queue(this[0],e):n===t?this:this.each(function(){var t=lt.queue(this,e,n);lt._queueHooks(this,e),"fx"===e&&"inprogress"!==t[0]&&lt.dequeue(this,e)})},dequeue:function(e){return this.each(function(){lt.dequeue(this,e)})},delay:function(e,t){return e=lt.fx?lt.fx.speeds[e]||e:e,t=t||"fx",this.queue(t,function(t,n){var i=setTimeout(t,e);n.stop=function(){clearTimeout(i)}})},clearQueue:function(e){return this.queue(e||"fx",[])},promise:function(e,n){var i,o=1,a=lt.Deferred(),s=this,r=this.length,l=function(){--o||a.resolveWith(s,[s])};for("string"!=typeof e&&(n=e,e=t),e=e||"fx";r--;)i=lt._data(s[r],e+"queueHooks"),i&&i.empty&&(o++,i.empty.add(l));return l(),a.promise(n)}});var Tt,St,Pt=/[\t\r\n]/g,At=/\r/g,It=/^(?:input|select|textarea|button|object)$/i,$t=/^(?:a|area)$/i,Nt=/^(?:checked|selected|autofocus|autoplay|async|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped)$/i,Mt=/^(?:checked|selected)$/i,Rt=lt.support.getSetAttribute,jt=lt.support.input;lt.fn.extend({attr:function(e,t){return lt.access(this,lt.attr,e,t,arguments.length>1)},removeAttr:function(e){return this.each(function(){lt.removeAttr(this,e)})},prop:function(e,t){return lt.access(this,lt.prop,e,t,arguments.length>1)},removeProp:function(e){return e=lt.propFix[e]||e,this.each(function(){try{this[e]=t,delete this[e]}catch(n){}})},addClass:function(e){var t,n,i,o,a,s=0,r=this.length,l="string"==typeof e&&e;if(lt.isFunction(e))return this.each(function(t){lt(this).addClass(e.call(this,t,this.className))});if(l)for(t=(e||"").match(ut)||[];r>s;s++)if(n=this[s],i=1===n.nodeType&&(n.className?(" "+n.className+" ").replace(Pt," "):" ")){for(a=0;o=t[a++];)0>i.indexOf(" "+o+" ")&&(i+=o+" ");n.className=lt.trim(i)}return this},removeClass:function(e){var t,n,i,o,a,s=0,r=this.length,l=0===arguments.length||"string"==typeof e&&e;if(lt.isFunction(e))return this.each(function(t){lt(this).removeClass(e.call(this,t,this.className))});if(l)for(t=(e||"").match(ut)||[];r>s;s++)if(n=this[s],i=1===n.nodeType&&(n.className?(" "+n.className+" ").replace(Pt," "):"")){for(a=0;o=t[a++];)for(;i.indexOf(" "+o+" ")>=0;)i=i.replace(" "+o+" "," ");n.className=e?lt.trim(i):""}return this},toggleClass:function(e,t){var n=typeof e,i="boolean"==typeof t;return lt.isFunction(e)?this.each(function(n){lt(this).toggleClass(e.call(this,n,this.className,t),t)}):this.each(function(){if("string"===n)for(var o,a=0,s=lt(this),r=t,l=e.match(ut)||[];o=l[a++];)r=i?r:!s.hasClass(o),s[r?"addClass":"removeClass"](o);else(n===V||"boolean"===n)&&(this.className&&lt._data(this,"__className__",this.className),this.className=this.className||e===!1?"":lt._data(this,"__className__")||"")})},hasClass:function(e){for(var t=" "+e+" ",n=0,i=this.length;i>n;n++)if(1===this[n].nodeType&&(" "+this[n].className+" ").replace(Pt," ").indexOf(t)>=0)return!0;return!1},val:function(e){var n,i,o,a=this[0];{if(arguments.length)return o=lt.isFunction(e),this.each(function(n){var a,s=lt(this);1===this.nodeType&&(a=o?e.call(this,n,s.val()):e,null==a?a="":"number"==typeof a?a+="":lt.isArray(a)&&(a=lt.map(a,function(e){return null==e?"":e+""})),i=lt.valHooks[this.type]||lt.valHooks[this.nodeName.toLowerCase()],i&&"set"in i&&i.set(this,a,"value")!==t||(this.value=a))});if(a)return i=lt.valHooks[a.type]||lt.valHooks[a.nodeName.toLowerCase()],i&&"get"in i&&(n=i.get(a,"value"))!==t?n:(n=a.value,"string"==typeof n?n.replace(At,""):null==n?"":n)}}}),lt.extend({valHooks:{option:{get:function(e){var t=e.attributes.value;return!t||t.specified?e.value:e.text}},select:{get:function(e){for(var t,n,i=e.options,o=e.selectedIndex,a="select-one"===e.type||0>o,s=a?null:[],r=a?o+1:i.length,l=0>o?r:a?o:0;r>l;l++)if(n=i[l],!(!n.selected&&l!==o||(lt.support.optDisabled?n.disabled:null!==n.getAttribute("disabled"))||n.parentNode.disabled&&lt.nodeName(n.parentNode,"optgroup"))){if(t=lt(n).val(),a)return t;s.push(t)}return s},set:function(e,t){var n=lt.makeArray(t);return lt(e).find("option").each(function(){this.selected=lt.inArray(lt(this).val(),n)>=0}),n.length||(e.selectedIndex=-1),n}}},attr:function(e,n,i){var o,a,s,r=e.nodeType;if(e&&3!==r&&8!==r&&2!==r)return typeof e.getAttribute===V?lt.prop(e,n,i):(a=1!==r||!lt.isXMLDoc(e),a&&(n=n.toLowerCase(),o=lt.attrHooks[n]||(Nt.test(n)?St:Tt)),i===t?o&&a&&"get"in o&&null!==(s=o.get(e,n))?s:(typeof e.getAttribute!==V&&(s=e.getAttribute(n)),null==s?t:s):null!==i?o&&a&&"set"in o&&(s=o.set(e,i,n))!==t?s:(e.setAttribute(n,i+""),i):(lt.removeAttr(e,n),t))},removeAttr:function(e,t){var n,i,o=0,a=t&&t.match(ut);if(a&&1===e.nodeType)for(;n=a[o++];)i=lt.propFix[n]||n,Nt.test(n)?!Rt&&Mt.test(n)?e[lt.camelCase("default-"+n)]=e[i]=!1:e[i]=!1:lt.attr(e,n,""),e.removeAttribute(Rt?n:i)},attrHooks:{type:{set:function(e,t){if(!lt.support.radioValue&&"radio"===t&&lt.nodeName(e,"input")){var n=e.value;return e.setAttribute("type",t),n&&(e.value=n),t}}}},propFix:{tabindex:"tabIndex",readonly:"readOnly","for":"htmlFor","class":"className",maxlength:"maxLength",cellspacing:"cellSpacing",cellpadding:"cellPadding",rowspan:"rowSpan",colspan:"colSpan",usemap:"useMap",frameborder:"frameBorder",contenteditable:"contentEditable"},prop:function(e,n,i){var o,a,s,r=e.nodeType;if(e&&3!==r&&8!==r&&2!==r)return s=1!==r||!lt.isXMLDoc(e),s&&(n=lt.propFix[n]||n,a=lt.propHooks[n]),i!==t?a&&"set"in a&&(o=a.set(e,i,n))!==t?o:e[n]=i:a&&"get"in a&&null!==(o=a.get(e,n))?o:e[n]},propHooks:{tabIndex:{get:function(e){var n=e.getAttributeNode("tabindex");return n&&n.specified?parseInt(n.value,10):It.test(e.nodeName)||$t.test(e.nodeName)&&e.href?0:t}}}}),St={get:function(e,n){var i=lt.prop(e,n),o="boolean"==typeof i&&e.getAttribute(n),a="boolean"==typeof i?jt&&Rt?null!=o:Mt.test(n)?e[lt.camelCase("default-"+n)]:!!o:e.getAttributeNode(n);return a&&a.value!==!1?n.toLowerCase():t},set:function(e,t,n){return t===!1?lt.removeAttr(e,n):jt&&Rt||!Mt.test(n)?e.setAttribute(!Rt&&lt.propFix[n]||n,n):e[lt.camelCase("default-"+n)]=e[n]=!0,n}},jt&&Rt||(lt.attrHooks.value={get:function(e,n){var i=e.getAttributeNode(n);return lt.nodeName(e,"input")?e.defaultValue:i&&i.specified?i.value:t},set:function(e,n,i){return lt.nodeName(e,"input")?(e.defaultValue=n,t):Tt&&Tt.set(e,n,i)}}),Rt||(Tt=lt.valHooks.button={get:function(e,n){var i=e.getAttributeNode(n);return i&&("id"===n||"name"===n||"coords"===n?""!==i.value:i.specified)?i.value:t},set:function(e,n,i){var o=e.getAttributeNode(i);return o||e.setAttributeNode(o=e.ownerDocument.createAttribute(i)),o.value=n+="","value"===i||n===e.getAttribute(i)?n:t}},lt.attrHooks.contenteditable={get:Tt.get,set:function(e,t,n){Tt.set(e,""===t?!1:t,n)}},lt.each(["width","height"],function(e,n){lt.attrHooks[n]=lt.extend(lt.attrHooks[n],{set:function(e,i){return""===i?(e.setAttribute(n,"auto"),i):t}})})),lt.support.hrefNormalized||(lt.each(["href","src","width","height"],function(e,n){lt.attrHooks[n]=lt.extend(lt.attrHooks[n],{get:function(e){var i=e.getAttribute(n,2);return null==i?t:i}})}),lt.each(["href","src"],function(e,t){lt.propHooks[t]={get:function(e){return e.getAttribute(t,4)}}})),lt.support.style||(lt.attrHooks.style={get:function(e){return e.style.cssText||t},set:function(e,t){return e.style.cssText=t+""}}),lt.support.optSelected||(lt.propHooks.selected=lt.extend(lt.propHooks.selected,{get:function(e){var t=e.parentNode;return t&&(t.selectedIndex,t.parentNode&&t.parentNode.selectedIndex),null}})),lt.support.enctype||(lt.propFix.enctype="encoding"),lt.support.checkOn||lt.each(["radio","checkbox"],function(){lt.valHooks[this]={get:function(e){return null===e.getAttribute("value")?"on":e.value}}}),lt.each(["radio","checkbox"],function(){lt.valHooks[this]=lt.extend(lt.valHooks[this],{set:function(e,n){return lt.isArray(n)?e.checked=lt.inArray(lt(e).val(),n)>=0:t}})});var Ot=/^(?:input|select|textarea)$/i,Dt=/^key/,Ht=/^(?:mouse|contextmenu)|click/,Lt=/^(?:focusinfocus|focusoutblur)$/,zt=/^([^.]*)(?:\.(.+)|)$/;lt.event={global:{},add:function(e,n,i,o,a){var s,r,l,c,u,h,d,p,f,m,g,_=lt._data(e);if(_){for(i.handler&&(c=i,i=c.handler,a=c.selector),i.guid||(i.guid=lt.guid++),(r=_.events)||(r=_.events={}),(h=_.handle)||(h=_.handle=function(e){return typeof lt===V||e&&lt.event.triggered===e.type?t:lt.event.dispatch.apply(h.elem,arguments)},h.elem=e),n=(n||"").match(ut)||[""],l=n.length;l--;)s=zt.exec(n[l])||[],f=g=s[1],m=(s[2]||"").split(".").sort(),u=lt.event.special[f]||{},f=(a?u.delegateType:u.bindType)||f,u=lt.event.special[f]||{},d=lt.extend({type:f,origType:g,data:o,handler:i,guid:i.guid,selector:a,needsContext:a&&lt.expr.match.needsContext.test(a),namespace:m.join(".")},c),(p=r[f])||(p=r[f]=[],p.delegateCount=0,u.setup&&u.setup.call(e,o,m,h)!==!1||(e.addEventListener?e.addEventListener(f,h,!1):e.attachEvent&&e.attachEvent("on"+f,h))),u.add&&(u.add.call(e,d),d.handler.guid||(d.handler.guid=i.guid)),a?p.splice(p.delegateCount++,0,d):p.push(d),lt.event.global[f]=!0;e=null}},remove:function(e,t,n,i,o){var a,s,r,l,c,u,h,d,p,f,m,g=lt.hasData(e)&&lt._data(e);if(g&&(u=g.events)){for(t=(t||"").match(ut)||[""],c=t.length;c--;)if(r=zt.exec(t[c])||[],p=m=r[1],f=(r[2]||"").split(".").sort(),p){for(h=lt.event.special[p]||{},p=(i?h.delegateType:h.bindType)||p,d=u[p]||[],r=r[2]&&RegExp("(^|\\.)"+f.join("\\.(?:.*\\.|)")+"(\\.|$)"),l=a=d.length;a--;)s=d[a],!o&&m!==s.origType||n&&n.guid!==s.guid||r&&!r.test(s.namespace)||i&&i!==s.selector&&("**"!==i||!s.selector)||(d.splice(a,1),s.selector&&d.delegateCount--,h.remove&&h.remove.call(e,s));l&&!d.length&&(h.teardown&&h.teardown.call(e,f,g.handle)!==!1||lt.removeEvent(e,p,g.handle),delete u[p])}else for(p in u)lt.event.remove(e,p+t[c],n,i,!0);lt.isEmptyObject(u)&&(delete g.handle,lt._removeData(e,"events"))}},trigger:function(n,i,o,a){var s,r,l,c,u,h,d,p=[o||Y],f=st.call(n,"type")?n.type:n,m=st.call(n,"namespace")?n.namespace.split("."):[];if(l=h=o=o||Y,3!==o.nodeType&&8!==o.nodeType&&!Lt.test(f+lt.event.triggered)&&(f.indexOf(".")>=0&&(m=f.split("."),f=m.shift(),m.sort()),r=0>f.indexOf(":")&&"on"+f,n=n[lt.expando]?n:new lt.Event(f,"object"==typeof n&&n),n.isTrigger=!0,n.namespace=m.join("."),n.namespace_re=n.namespace?RegExp("(^|\\.)"+m.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,n.result=t,n.target||(n.target=o),i=null==i?[n]:lt.makeArray(i,[n]),u=lt.event.special[f]||{},a||!u.trigger||u.trigger.apply(o,i)!==!1)){if(!a&&!u.noBubble&&!lt.isWindow(o)){for(c=u.delegateType||f,Lt.test(c+f)||(l=l.parentNode);l;l=l.parentNode)p.push(l),h=l;h===(o.ownerDocument||Y)&&p.push(h.defaultView||h.parentWindow||e)}for(d=0;(l=p[d++])&&!n.isPropagationStopped();)n.type=d>1?c:u.bindType||f,s=(lt._data(l,"events")||{})[n.type]&&lt._data(l,"handle"),s&&s.apply(l,i),s=r&&l[r],s&&lt.acceptData(l)&&s.apply&&s.apply(l,i)===!1&&n.preventDefault();if(n.type=f,!(a||n.isDefaultPrevented()||u._default&&u._default.apply(o.ownerDocument,i)!==!1||"click"===f&&lt.nodeName(o,"a")||!lt.acceptData(o)||!r||!o[f]||lt.isWindow(o))){h=o[r],h&&(o[r]=null),lt.event.triggered=f;try{o[f]()}catch(g){}lt.event.triggered=t,h&&(o[r]=h)}return n.result}},dispatch:function(e){e=lt.event.fix(e);var n,i,o,a,s,r=[],l=it.call(arguments),c=(lt._data(this,"events")||{})[e.type]||[],u=lt.event.special[e.type]||{};if(l[0]=e,e.delegateTarget=this,!u.preDispatch||u.preDispatch.call(this,e)!==!1){for(r=lt.event.handlers.call(this,e,c),n=0;(a=r[n++])&&!e.isPropagationStopped();)for(e.currentTarget=a.elem,s=0;(o=a.handlers[s++])&&!e.isImmediatePropagationStopped();)(!e.namespace_re||e.namespace_re.test(o.namespace))&&(e.handleObj=o,e.data=o.data,i=((lt.event.special[o.origType]||{}).handle||o.handler).apply(a.elem,l),i!==t&&(e.result=i)===!1&&(e.preventDefault(),e.stopPropagation()));return u.postDispatch&&u.postDispatch.call(this,e),e.result}},handlers:function(e,n){var i,o,a,s,r=[],l=n.delegateCount,c=e.target;if(l&&c.nodeType&&(!e.button||"click"!==e.type))for(;c!=this;c=c.parentNode||this)if(1===c.nodeType&&(c.disabled!==!0||"click"!==e.type)){for(a=[],s=0;l>s;s++)o=n[s],i=o.selector+" ",a[i]===t&&(a[i]=o.needsContext?lt(i,this).index(c)>=0:lt.find(i,this,null,[c]).length),a[i]&&a.push(o);a.length&&r.push({elem:c,handlers:a})}return n.length>l&&r.push({elem:this,handlers:n.slice(l)}),r},fix:function(e){if(e[lt.expando])return e;var t,n,i,o=e.type,a=e,s=this.fixHooks[o];for(s||(this.fixHooks[o]=s=Ht.test(o)?this.mouseHooks:Dt.test(o)?this.keyHooks:{}),i=s.props?this.props.concat(s.props):this.props,e=new lt.Event(a),t=i.length;t--;)n=i[t],e[n]=a[n];return e.target||(e.target=a.srcElement||Y),3===e.target.nodeType&&(e.target=e.target.parentNode),e.metaKey=!!e.metaKey,s.filter?s.filter(e,a):e},props:"altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),fixHooks:{},keyHooks:{props:"char charCode key keyCode".split(" "),filter:function(e,t){return null==e.which&&(e.which=null!=t.charCode?t.charCode:t.keyCode),e}},mouseHooks:{props:"button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(e,n){var i,o,a,s=n.button,r=n.fromElement;return null==e.pageX&&null!=n.clientX&&(o=e.target.ownerDocument||Y,a=o.documentElement,i=o.body,e.pageX=n.clientX+(a&&a.scrollLeft||i&&i.scrollLeft||0)-(a&&a.clientLeft||i&&i.clientLeft||0),e.pageY=n.clientY+(a&&a.scrollTop||i&&i.scrollTop||0)-(a&&a.clientTop||i&&i.clientTop||0)),!e.relatedTarget&&r&&(e.relatedTarget=r===e.target?n.toElement:r),e.which||s===t||(e.which=1&s?1:2&s?3:4&s?2:0),e}},special:{load:{noBubble:!0},click:{trigger:function(){return lt.nodeName(this,"input")&&"checkbox"===this.type&&this.click?(this.click(),!1):t}},focus:{trigger:function(){if(this!==Y.activeElement&&this.focus)try{return this.focus(),!1}catch(e){}},delegateType:"focusin"},blur:{trigger:function(){return this===Y.activeElement&&this.blur?(this.blur(),!1):t},delegateType:"focusout"},beforeunload:{postDispatch:function(e){e.result!==t&&(e.originalEvent.returnValue=e.result)}}},simulate:function(e,t,n,i){var o=lt.extend(new lt.Event,n,{type:e,isSimulated:!0,originalEvent:{}});i?lt.event.trigger(o,null,t):lt.event.dispatch.call(t,o),o.isDefaultPrevented()&&n.preventDefault()}},lt.removeEvent=Y.removeEventListener?function(e,t,n){e.removeEventListener&&e.removeEventListener(t,n,!1)}:function(e,t,n){var i="on"+t;e.detachEvent&&(typeof e[i]===V&&(e[i]=null),e.detachEvent(i,n))},lt.Event=function(e,n){return this instanceof lt.Event?(e&&e.type?(this.originalEvent=e,this.type=e.type,this.isDefaultPrevented=e.defaultPrevented||e.returnValue===!1||e.getPreventDefault&&e.getPreventDefault()?l:c):this.type=e,n&&lt.extend(this,n),this.timeStamp=e&&e.timeStamp||lt.now(),this[lt.expando]=!0,t):new lt.Event(e,n)},lt.Event.prototype={isDefaultPrevented:c,isPropagationStopped:c,isImmediatePropagationStopped:c,preventDefault:function(){var e=this.originalEvent;this.isDefaultPrevented=l,e&&(e.preventDefault?e.preventDefault():e.returnValue=!1)},stopPropagation:function(){var e=this.originalEvent;this.isPropagationStopped=l,e&&(e.stopPropagation&&e.stopPropagation(),e.cancelBubble=!0)},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=l,this.stopPropagation()}},lt.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(e,t){lt.event.special[e]={delegateType:t,bindType:t,handle:function(e){var n,i=this,o=e.relatedTarget,a=e.handleObj;return(!o||o!==i&&!lt.contains(i,o))&&(e.type=a.origType,n=a.handler.apply(this,arguments),e.type=t),n}}}),lt.support.submitBubbles||(lt.event.special.submit={setup:function(){return lt.nodeName(this,"form")?!1:(lt.event.add(this,"click._submit keypress._submit",function(e){var n=e.target,i=lt.nodeName(n,"input")||lt.nodeName(n,"button")?n.form:t;i&&!lt._data(i,"submitBubbles")&&(lt.event.add(i,"submit._submit",function(e){e._submit_bubble=!0}),lt._data(i,"submitBubbles",!0))}),t)},postDispatch:function(e){e._submit_bubble&&(delete e._submit_bubble,this.parentNode&&!e.isTrigger&&lt.event.simulate("submit",this.parentNode,e,!0))},teardown:function(){return lt.nodeName(this,"form")?!1:(lt.event.remove(this,"._submit"),t)}}),lt.support.changeBubbles||(lt.event.special.change={setup:function(){return Ot.test(this.nodeName)?(("checkbox"===this.type||"radio"===this.type)&&(lt.event.add(this,"propertychange._change",function(e){"checked"===e.originalEvent.propertyName&&(this._just_changed=!0)}),lt.event.add(this,"click._change",function(e){this._just_changed&&!e.isTrigger&&(this._just_changed=!1),lt.event.simulate("change",this,e,!0)})),!1):(lt.event.add(this,"beforeactivate._change",function(e){var t=e.target;Ot.test(t.nodeName)&&!lt._data(t,"changeBubbles")&&(lt.event.add(t,"change._change",function(e){!this.parentNode||e.isSimulated||e.isTrigger||lt.event.simulate("change",this.parentNode,e,!0)}),lt._data(t,"changeBubbles",!0))}),t)},handle:function(e){var n=e.target;return this!==n||e.isSimulated||e.isTrigger||"radio"!==n.type&&"checkbox"!==n.type?e.handleObj.handler.apply(this,arguments):t},teardown:function(){return lt.event.remove(this,"._change"),!Ot.test(this.nodeName)}}),lt.support.focusinBubbles||lt.each({focus:"focusin",blur:"focusout"},function(e,t){var n=0,i=function(e){lt.event.simulate(t,e.target,lt.event.fix(e),!0)};lt.event.special[t]={setup:function(){0===n++&&Y.addEventListener(e,i,!0)},teardown:function(){0===--n&&Y.removeEventListener(e,i,!0)}}}),lt.fn.extend({on:function(e,n,i,o,a){var s,r;if("object"==typeof e){"string"!=typeof n&&(i=i||n,n=t);for(s in e)this.on(s,n,i,e[s],a);return this}if(null==i&&null==o?(o=n,i=n=t):null==o&&("string"==typeof n?(o=i,i=t):(o=i,i=n,n=t)),o===!1)o=c;else if(!o)return this;return 1===a&&(r=o,o=function(e){return lt().off(e),r.apply(this,arguments)},o.guid=r.guid||(r.guid=lt.guid++)),this.each(function(){lt.event.add(this,e,o,i,n)})},one:function(e,t,n,i){return this.on(e,t,n,i,1)},off:function(e,n,i){var o,a;if(e&&e.preventDefault&&e.handleObj)return o=e.handleObj,lt(e.delegateTarget).off(o.namespace?o.origType+"."+o.namespace:o.origType,o.selector,o.handler),this;if("object"==typeof e){for(a in e)this.off(a,n,e[a]);return this}return(n===!1||"function"==typeof n)&&(i=n,n=t),i===!1&&(i=c),this.each(function(){lt.event.remove(this,e,i,n)})},bind:function(e,t,n){return this.on(e,null,t,n)},unbind:function(e,t){return this.off(e,null,t)},delegate:function(e,t,n,i){return this.on(t,e,n,i)},undelegate:function(e,t,n){return 1===arguments.length?this.off(e,"**"):this.off(t,e||"**",n)},trigger:function(e,t){return this.each(function(){lt.event.trigger(e,t,this)})},triggerHandler:function(e,n){var i=this[0];return i?lt.event.trigger(e,n,i,!0):t}}),function(e,t){function n(e){return ft.test(e+"")}function i(){var e,t=[];return e=function(n,i){return t.push(n+=" ")>C.cacheLength&&delete e[t.shift()],e[n]=i}}function o(e){return e[L]=!0,e}function a(e){var t=$.createElement("div");try{return e(t)}catch(n){return!1}finally{t=null}}function s(e,t,n,i){var o,a,s,r,l,c,u,p,f,m;if((t?t.ownerDocument||t:z)!==$&&I(t),t=t||$,n=n||[],!e||"string"!=typeof e)return n;
if(1!==(r=t.nodeType)&&9!==r)return[];if(!M&&!i){if(o=mt.exec(e))if(s=o[1]){if(9===r){if(a=t.getElementById(s),!a||!a.parentNode)return n;if(a.id===s)return n.push(a),n}else if(t.ownerDocument&&(a=t.ownerDocument.getElementById(s))&&D(t,a)&&a.id===s)return n.push(a),n}else{if(o[2])return X.apply(n,J.call(t.getElementsByTagName(e),0)),n;if((s=o[3])&&q.getByClassName&&t.getElementsByClassName)return X.apply(n,J.call(t.getElementsByClassName(s),0)),n}if(q.qsa&&!R.test(e)){if(u=!0,p=L,f=t,m=9===r&&e,1===r&&"object"!==t.nodeName.toLowerCase()){for(c=h(e),(u=t.getAttribute("id"))?p=u.replace(vt,"\\$&"):t.setAttribute("id",p),p="[id='"+p+"'] ",l=c.length;l--;)c[l]=p+d(c[l]);f=pt.test(e)&&t.parentNode||t,m=c.join(",")}if(m)try{return X.apply(n,J.call(f.querySelectorAll(m),0)),n}catch(g){}finally{u||t.removeAttribute("id")}}}return w(e.replace(st,"$1"),t,n,i)}function r(e,t){var n=t&&e,i=n&&(~t.sourceIndex||Y)-(~e.sourceIndex||Y);if(i)return i;if(n)for(;n=n.nextSibling;)if(n===t)return-1;return e?1:-1}function l(e){return function(t){var n=t.nodeName.toLowerCase();return"input"===n&&t.type===e}}function c(e){return function(t){var n=t.nodeName.toLowerCase();return("input"===n||"button"===n)&&t.type===e}}function u(e){return o(function(t){return t=+t,o(function(n,i){for(var o,a=e([],n.length,t),s=a.length;s--;)n[o=a[s]]&&(n[o]=!(i[o]=n[o]))})})}function h(e,t){var n,i,o,a,r,l,c,u=G[e+" "];if(u)return t?0:u.slice(0);for(r=e,l=[],c=C.preFilter;r;){(!n||(i=rt.exec(r)))&&(i&&(r=r.slice(i[0].length)||r),l.push(o=[])),n=!1,(i=ct.exec(r))&&(n=i.shift(),o.push({value:n,type:i[0].replace(st," ")}),r=r.slice(n.length));for(a in C.filter)!(i=dt[a].exec(r))||c[a]&&!(i=c[a](i))||(n=i.shift(),o.push({value:n,type:a,matches:i}),r=r.slice(n.length));if(!n)break}return t?r.length:r?s.error(e):G(e,l).slice(0)}function d(e){for(var t=0,n=e.length,i="";n>t;t++)i+=e[t].value;return i}function p(e,t,n){var i=t.dir,o=n&&"parentNode"===i,a=W++;return t.first?function(t,n,a){for(;t=t[i];)if(1===t.nodeType||o)return e(t,n,a)}:function(t,n,s){var r,l,c,u=U+" "+a;if(s){for(;t=t[i];)if((1===t.nodeType||o)&&e(t,n,s))return!0}else for(;t=t[i];)if(1===t.nodeType||o)if(c=t[L]||(t[L]={}),(l=c[i])&&l[0]===u){if((r=l[1])===!0||r===k)return r===!0}else if(l=c[i]=[u],l[1]=e(t,n,s)||k,l[1]===!0)return!0}}function f(e){return e.length>1?function(t,n,i){for(var o=e.length;o--;)if(!e[o](t,n,i))return!1;return!0}:e[0]}function m(e,t,n,i,o){for(var a,s=[],r=0,l=e.length,c=null!=t;l>r;r++)(a=e[r])&&(!n||n(a,i,o))&&(s.push(a),c&&t.push(r));return s}function g(e,t,n,i,a,s){return i&&!i[L]&&(i=g(i)),a&&!a[L]&&(a=g(a,s)),o(function(o,s,r,l){var c,u,h,d=[],p=[],f=s.length,g=o||y(t||"*",r.nodeType?[r]:r,[]),_=!e||!o&&t?g:m(g,d,e,r,l),v=n?a||(o?e:f||i)?[]:s:_;if(n&&n(_,v,r,l),i)for(c=m(v,p),i(c,[],r,l),u=c.length;u--;)(h=c[u])&&(v[p[u]]=!(_[p[u]]=h));if(o){if(a||e){if(a){for(c=[],u=v.length;u--;)(h=v[u])&&c.push(_[u]=h);a(null,v=[],c,l)}for(u=v.length;u--;)(h=v[u])&&(c=a?Z.call(o,h):d[u])>-1&&(o[c]=!(s[c]=h))}}else v=m(v===s?v.splice(f,v.length):v),a?a(null,s,v,l):X.apply(s,v)})}function _(e){for(var t,n,i,o=e.length,a=C.relative[e[0].type],s=a||C.relative[" "],r=a?1:0,l=p(function(e){return e===t},s,!0),c=p(function(e){return Z.call(t,e)>-1},s,!0),u=[function(e,n,i){return!a&&(i||n!==A)||((t=n).nodeType?l(e,n,i):c(e,n,i))}];o>r;r++)if(n=C.relative[e[r].type])u=[p(f(u),n)];else{if(n=C.filter[e[r].type].apply(null,e[r].matches),n[L]){for(i=++r;o>i&&!C.relative[e[i].type];i++);return g(r>1&&f(u),r>1&&d(e.slice(0,r-1)).replace(st,"$1"),n,i>r&&_(e.slice(r,i)),o>i&&_(e=e.slice(i)),o>i&&d(e))}u.push(n)}return f(u)}function v(e,t){var n=0,i=t.length>0,a=e.length>0,r=function(o,r,l,c,u){var h,d,p,f=[],g=0,_="0",v=o&&[],y=null!=u,w=A,b=o||a&&C.find.TAG("*",u&&r.parentNode||r),x=U+=null==w?1:Math.random()||.1;for(y&&(A=r!==$&&r,k=n);null!=(h=b[_]);_++){if(a&&h){for(d=0;p=e[d++];)if(p(h,r,l)){c.push(h);break}y&&(U=x,k=++n)}i&&((h=!p&&h)&&g--,o&&v.push(h))}if(g+=_,i&&_!==g){for(d=0;p=t[d++];)p(v,f,r,l);if(o){if(g>0)for(;_--;)v[_]||f[_]||(f[_]=Q.call(c));f=m(f)}X.apply(c,f),y&&!o&&f.length>0&&g+t.length>1&&s.uniqueSort(c)}return y&&(U=x,A=w),v};return i?o(r):r}function y(e,t,n){for(var i=0,o=t.length;o>i;i++)s(e,t[i],n);return n}function w(e,t,n,i){var o,a,s,r,l,c=h(e);if(!i&&1===c.length){if(a=c[0]=c[0].slice(0),a.length>2&&"ID"===(s=a[0]).type&&9===t.nodeType&&!M&&C.relative[a[1].type]){if(t=C.find.ID(s.matches[0].replace(wt,bt),t)[0],!t)return n;e=e.slice(a.shift().value.length)}for(o=dt.needsContext.test(e)?0:a.length;o--&&(s=a[o],!C.relative[r=s.type]);)if((l=C.find[r])&&(i=l(s.matches[0].replace(wt,bt),pt.test(a[0].type)&&t.parentNode||t))){if(a.splice(o,1),e=i.length&&d(a),!e)return X.apply(n,J.call(i,0)),n;break}}return S(e,c)(i,t,M,n,pt.test(e)),n}function b(){}var x,k,C,E,T,S,P,A,I,$,N,M,R,j,O,D,H,L="sizzle"+-new Date,z=e.document,q={},U=0,W=0,F=i(),G=i(),B=i(),V=typeof t,Y=1<<31,K=[],Q=K.pop,X=K.push,J=K.slice,Z=K.indexOf||function(e){for(var t=0,n=this.length;n>t;t++)if(this[t]===e)return t;return-1},et="[\\x20\\t\\r\\n\\f]",tt="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",nt=tt.replace("w","w#"),it="([*^$|!~]?=)",ot="\\["+et+"*("+tt+")"+et+"*(?:"+it+et+"*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|("+nt+")|)|)"+et+"*\\]",at=":("+tt+")(?:\\(((['\"])((?:\\\\.|[^\\\\])*?)\\3|((?:\\\\.|[^\\\\()[\\]]|"+ot.replace(3,8)+")*)|.*)\\)|)",st=RegExp("^"+et+"+|((?:^|[^\\\\])(?:\\\\.)*)"+et+"+$","g"),rt=RegExp("^"+et+"*,"+et+"*"),ct=RegExp("^"+et+"*([\\x20\\t\\r\\n\\f>+~])"+et+"*"),ut=RegExp(at),ht=RegExp("^"+nt+"$"),dt={ID:RegExp("^#("+tt+")"),CLASS:RegExp("^\\.("+tt+")"),NAME:RegExp("^\\[name=['\"]?("+tt+")['\"]?\\]"),TAG:RegExp("^("+tt.replace("w","w*")+")"),ATTR:RegExp("^"+ot),PSEUDO:RegExp("^"+at),CHILD:RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+et+"*(even|odd|(([+-]|)(\\d*)n|)"+et+"*(?:([+-]|)"+et+"*(\\d+)|))"+et+"*\\)|)","i"),needsContext:RegExp("^"+et+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+et+"*((?:-\\d)?\\d*)"+et+"*\\)|)(?=[^-]|$)","i")},pt=/[\x20\t\r\n\f]*[+~]/,ft=/^[^{]+\{\s*\[native code/,mt=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,gt=/^(?:input|select|textarea|button)$/i,_t=/^h\d$/i,vt=/'|\\/g,yt=/\=[\x20\t\r\n\f]*([^'"\]]*)[\x20\t\r\n\f]*\]/g,wt=/\\([\da-fA-F]{1,6}[\x20\t\r\n\f]?|.)/g,bt=function(e,t){var n="0x"+t-65536;return n!==n?t:0>n?String.fromCharCode(n+65536):String.fromCharCode(55296|n>>10,56320|1023&n)};try{J.call(z.documentElement.childNodes,0)[0].nodeType}catch(xt){J=function(e){for(var t,n=[];t=this[e++];)n.push(t);return n}}T=s.isXML=function(e){var t=e&&(e.ownerDocument||e).documentElement;return t?"HTML"!==t.nodeName:!1},I=s.setDocument=function(e){var i=e?e.ownerDocument||e:z;return i!==$&&9===i.nodeType&&i.documentElement?($=i,N=i.documentElement,M=T(i),q.tagNameNoComments=a(function(e){return e.appendChild(i.createComment("")),!e.getElementsByTagName("*").length}),q.attributes=a(function(e){e.innerHTML="<select></select>";var t=typeof e.lastChild.getAttribute("multiple");return"boolean"!==t&&"string"!==t}),q.getByClassName=a(function(e){return e.innerHTML="<div class='hidden e'></div><div class='hidden'></div>",e.getElementsByClassName&&e.getElementsByClassName("e").length?(e.lastChild.className="e",2===e.getElementsByClassName("e").length):!1}),q.getByName=a(function(e){e.id=L+0,e.innerHTML="<a name='"+L+"'></a><div name='"+L+"'></div>",N.insertBefore(e,N.firstChild);var t=i.getElementsByName&&i.getElementsByName(L).length===2+i.getElementsByName(L+0).length;return q.getIdNotName=!i.getElementById(L),N.removeChild(e),t}),C.attrHandle=a(function(e){return e.innerHTML="<a href='#'></a>",e.firstChild&&typeof e.firstChild.getAttribute!==V&&"#"===e.firstChild.getAttribute("href")})?{}:{href:function(e){return e.getAttribute("href",2)},type:function(e){return e.getAttribute("type")}},q.getIdNotName?(C.find.ID=function(e,t){if(typeof t.getElementById!==V&&!M){var n=t.getElementById(e);return n&&n.parentNode?[n]:[]}},C.filter.ID=function(e){var t=e.replace(wt,bt);return function(e){return e.getAttribute("id")===t}}):(C.find.ID=function(e,n){if(typeof n.getElementById!==V&&!M){var i=n.getElementById(e);return i?i.id===e||typeof i.getAttributeNode!==V&&i.getAttributeNode("id").value===e?[i]:t:[]}},C.filter.ID=function(e){var t=e.replace(wt,bt);return function(e){var n=typeof e.getAttributeNode!==V&&e.getAttributeNode("id");return n&&n.value===t}}),C.find.TAG=q.tagNameNoComments?function(e,n){return typeof n.getElementsByTagName!==V?n.getElementsByTagName(e):t}:function(e,t){var n,i=[],o=0,a=t.getElementsByTagName(e);if("*"===e){for(;n=a[o++];)1===n.nodeType&&i.push(n);return i}return a},C.find.NAME=q.getByName&&function(e,n){return typeof n.getElementsByName!==V?n.getElementsByName(name):t},C.find.CLASS=q.getByClassName&&function(e,n){return typeof n.getElementsByClassName===V||M?t:n.getElementsByClassName(e)},j=[],R=[":focus"],(q.qsa=n(i.querySelectorAll))&&(a(function(e){e.innerHTML="<select><option selected=''></option></select>",e.querySelectorAll("[selected]").length||R.push("\\["+et+"*(?:checked|disabled|ismap|multiple|readonly|selected|value)"),e.querySelectorAll(":checked").length||R.push(":checked")}),a(function(e){e.innerHTML="<input type='hidden' i=''/>",e.querySelectorAll("[i^='']").length&&R.push("[*^$]="+et+"*(?:\"\"|'')"),e.querySelectorAll(":enabled").length||R.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),R.push(",.*:")})),(q.matchesSelector=n(O=N.matchesSelector||N.mozMatchesSelector||N.webkitMatchesSelector||N.oMatchesSelector||N.msMatchesSelector))&&a(function(e){q.disconnectedMatch=O.call(e,"div"),O.call(e,"[s!='']:x"),j.push("!=",at)}),R=RegExp(R.join("|")),j=RegExp(j.join("|")),D=n(N.contains)||N.compareDocumentPosition?function(e,t){var n=9===e.nodeType?e.documentElement:e,i=t&&t.parentNode;return e===i||!(!i||1!==i.nodeType||!(n.contains?n.contains(i):e.compareDocumentPosition&&16&e.compareDocumentPosition(i)))}:function(e,t){if(t)for(;t=t.parentNode;)if(t===e)return!0;return!1},H=N.compareDocumentPosition?function(e,t){var n;return e===t?(P=!0,0):(n=t.compareDocumentPosition&&e.compareDocumentPosition&&e.compareDocumentPosition(t))?1&n||e.parentNode&&11===e.parentNode.nodeType?e===i||D(z,e)?-1:t===i||D(z,t)?1:0:4&n?-1:1:e.compareDocumentPosition?-1:1}:function(e,t){var n,o=0,a=e.parentNode,s=t.parentNode,l=[e],c=[t];if(e===t)return P=!0,0;if(!a||!s)return e===i?-1:t===i?1:a?-1:s?1:0;if(a===s)return r(e,t);for(n=e;n=n.parentNode;)l.unshift(n);for(n=t;n=n.parentNode;)c.unshift(n);for(;l[o]===c[o];)o++;return o?r(l[o],c[o]):l[o]===z?-1:c[o]===z?1:0},P=!1,[0,0].sort(H),q.detectDuplicates=P,$):$},s.matches=function(e,t){return s(e,null,null,t)},s.matchesSelector=function(e,t){if((e.ownerDocument||e)!==$&&I(e),t=t.replace(yt,"='$1']"),!(!q.matchesSelector||M||j&&j.test(t)||R.test(t)))try{var n=O.call(e,t);if(n||q.disconnectedMatch||e.document&&11!==e.document.nodeType)return n}catch(i){}return s(t,$,null,[e]).length>0},s.contains=function(e,t){return(e.ownerDocument||e)!==$&&I(e),D(e,t)},s.attr=function(e,t){var n;return(e.ownerDocument||e)!==$&&I(e),M||(t=t.toLowerCase()),(n=C.attrHandle[t])?n(e):M||q.attributes?e.getAttribute(t):((n=e.getAttributeNode(t))||e.getAttribute(t))&&e[t]===!0?t:n&&n.specified?n.value:null},s.error=function(e){throw Error("Syntax error, unrecognized expression: "+e)},s.uniqueSort=function(e){var t,n=[],i=1,o=0;if(P=!q.detectDuplicates,e.sort(H),P){for(;t=e[i];i++)t===e[i-1]&&(o=n.push(i));for(;o--;)e.splice(n[o],1)}return e},E=s.getText=function(e){var t,n="",i=0,o=e.nodeType;if(o){if(1===o||9===o||11===o){if("string"==typeof e.textContent)return e.textContent;for(e=e.firstChild;e;e=e.nextSibling)n+=E(e)}else if(3===o||4===o)return e.nodeValue}else for(;t=e[i];i++)n+=E(t);return n},C=s.selectors={cacheLength:50,createPseudo:o,match:dt,find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(wt,bt),e[3]=(e[4]||e[5]||"").replace(wt,bt),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1].slice(0,3)?(e[3]||s.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3])),e[5]=+(e[7]+e[8]||"odd"===e[3])):e[3]&&s.error(e[0]),e},PSEUDO:function(e){var t,n=!e[5]&&e[2];return dt.CHILD.test(e[0])?null:(e[4]?e[2]=e[4]:n&&ut.test(n)&&(t=h(n,!0))&&(t=n.indexOf(")",n.length-t)-n.length)&&(e[0]=e[0].slice(0,t),e[2]=n.slice(0,t)),e.slice(0,3))}},filter:{TAG:function(e){return"*"===e?function(){return!0}:(e=e.replace(wt,bt).toLowerCase(),function(t){return t.nodeName&&t.nodeName.toLowerCase()===e})},CLASS:function(e){var t=F[e+" "];return t||(t=RegExp("(^|"+et+")"+e+"("+et+"|$)"))&&F(e,function(e){return t.test(e.className||typeof e.getAttribute!==V&&e.getAttribute("class")||"")})},ATTR:function(e,t,n){return function(i){var o=s.attr(i,e);return null==o?"!="===t:t?(o+="","="===t?o===n:"!="===t?o!==n:"^="===t?n&&0===o.indexOf(n):"*="===t?n&&o.indexOf(n)>-1:"$="===t?n&&o.slice(-n.length)===n:"~="===t?(" "+o+" ").indexOf(n)>-1:"|="===t?o===n||o.slice(0,n.length+1)===n+"-":!1):!0}},CHILD:function(e,t,n,i,o){var a="nth"!==e.slice(0,3),s="last"!==e.slice(-4),r="of-type"===t;return 1===i&&0===o?function(e){return!!e.parentNode}:function(t,n,l){var c,u,h,d,p,f,m=a!==s?"nextSibling":"previousSibling",g=t.parentNode,_=r&&t.nodeName.toLowerCase(),v=!l&&!r;if(g){if(a){for(;m;){for(h=t;h=h[m];)if(r?h.nodeName.toLowerCase()===_:1===h.nodeType)return!1;f=m="only"===e&&!f&&"nextSibling"}return!0}if(f=[s?g.firstChild:g.lastChild],s&&v){for(u=g[L]||(g[L]={}),c=u[e]||[],p=c[0]===U&&c[1],d=c[0]===U&&c[2],h=p&&g.childNodes[p];h=++p&&h&&h[m]||(d=p=0)||f.pop();)if(1===h.nodeType&&++d&&h===t){u[e]=[U,p,d];break}}else if(v&&(c=(t[L]||(t[L]={}))[e])&&c[0]===U)d=c[1];else for(;(h=++p&&h&&h[m]||(d=p=0)||f.pop())&&((r?h.nodeName.toLowerCase()!==_:1!==h.nodeType)||!++d||(v&&((h[L]||(h[L]={}))[e]=[U,d]),h!==t)););return d-=o,d===i||0===d%i&&d/i>=0}}},PSEUDO:function(e,t){var n,i=C.pseudos[e]||C.setFilters[e.toLowerCase()]||s.error("unsupported pseudo: "+e);return i[L]?i(t):i.length>1?(n=[e,e,"",t],C.setFilters.hasOwnProperty(e.toLowerCase())?o(function(e,n){for(var o,a=i(e,t),s=a.length;s--;)o=Z.call(e,a[s]),e[o]=!(n[o]=a[s])}):function(e){return i(e,0,n)}):i}},pseudos:{not:o(function(e){var t=[],n=[],i=S(e.replace(st,"$1"));return i[L]?o(function(e,t,n,o){for(var a,s=i(e,null,o,[]),r=e.length;r--;)(a=s[r])&&(e[r]=!(t[r]=a))}):function(e,o,a){return t[0]=e,i(t,null,a,n),!n.pop()}}),has:o(function(e){return function(t){return s(e,t).length>0}}),contains:o(function(e){return function(t){return(t.textContent||t.innerText||E(t)).indexOf(e)>-1}}),lang:o(function(e){return ht.test(e||"")||s.error("unsupported lang: "+e),e=e.replace(wt,bt).toLowerCase(),function(t){var n;do if(n=M?t.getAttribute("xml:lang")||t.getAttribute("lang"):t.lang)return n=n.toLowerCase(),n===e||0===n.indexOf(e+"-");while((t=t.parentNode)&&1===t.nodeType);return!1}}),target:function(t){var n=e.location&&e.location.hash;return n&&n.slice(1)===t.id},root:function(e){return e===N},focus:function(e){return e===$.activeElement&&(!$.hasFocus||$.hasFocus())&&!!(e.type||e.href||~e.tabIndex)},enabled:function(e){return e.disabled===!1},disabled:function(e){return e.disabled===!0},checked:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&!!e.checked||"option"===t&&!!e.selected},selected:function(e){return e.parentNode&&e.parentNode.selectedIndex,e.selected===!0},empty:function(e){for(e=e.firstChild;e;e=e.nextSibling)if(e.nodeName>"@"||3===e.nodeType||4===e.nodeType)return!1;return!0},parent:function(e){return!C.pseudos.empty(e)},header:function(e){return _t.test(e.nodeName)},input:function(e){return gt.test(e.nodeName)},button:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&"button"===e.type||"button"===t},text:function(e){var t;return"input"===e.nodeName.toLowerCase()&&"text"===e.type&&(null==(t=e.getAttribute("type"))||t.toLowerCase()===e.type)},first:u(function(){return[0]}),last:u(function(e,t){return[t-1]}),eq:u(function(e,t,n){return[0>n?n+t:n]}),even:u(function(e,t){for(var n=0;t>n;n+=2)e.push(n);return e}),odd:u(function(e,t){for(var n=1;t>n;n+=2)e.push(n);return e}),lt:u(function(e,t,n){for(var i=0>n?n+t:n;--i>=0;)e.push(i);return e}),gt:u(function(e,t,n){for(var i=0>n?n+t:n;t>++i;)e.push(i);return e})}};for(x in{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})C.pseudos[x]=l(x);for(x in{submit:!0,reset:!0})C.pseudos[x]=c(x);S=s.compile=function(e,t){var n,i=[],o=[],a=B[e+" "];if(!a){for(t||(t=h(e)),n=t.length;n--;)a=_(t[n]),a[L]?i.push(a):o.push(a);a=B(e,v(o,i))}return a},C.pseudos.nth=C.pseudos.eq,C.filters=b.prototype=C.pseudos,C.setFilters=new b,I(),s.attr=lt.attr,lt.find=s,lt.expr=s.selectors,lt.expr[":"]=lt.expr.pseudos,lt.unique=s.uniqueSort,lt.text=s.getText,lt.isXMLDoc=s.isXML,lt.contains=s.contains}(e);var qt=/Until$/,Ut=/^(?:parents|prev(?:Until|All))/,Wt=/^.[^:#\[\.,]*$/,Ft=lt.expr.match.needsContext,Gt={children:!0,contents:!0,next:!0,prev:!0};lt.fn.extend({find:function(e){var t,n,i,o=this.length;if("string"!=typeof e)return i=this,this.pushStack(lt(e).filter(function(){for(t=0;o>t;t++)if(lt.contains(i[t],this))return!0}));for(n=[],t=0;o>t;t++)lt.find(e,this[t],n);return n=this.pushStack(o>1?lt.unique(n):n),n.selector=(this.selector?this.selector+" ":"")+e,n},has:function(e){var t,n=lt(e,this),i=n.length;return this.filter(function(){for(t=0;i>t;t++)if(lt.contains(this,n[t]))return!0})},not:function(e){return this.pushStack(h(this,e,!1))},filter:function(e){return this.pushStack(h(this,e,!0))},is:function(e){return!!e&&("string"==typeof e?Ft.test(e)?lt(e,this.context).index(this[0])>=0:lt.filter(e,this).length>0:this.filter(e).length>0)},closest:function(e,t){for(var n,i=0,o=this.length,a=[],s=Ft.test(e)||"string"!=typeof e?lt(e,t||this.context):0;o>i;i++)for(n=this[i];n&&n.ownerDocument&&n!==t&&11!==n.nodeType;){if(s?s.index(n)>-1:lt.find.matchesSelector(n,e)){a.push(n);break}n=n.parentNode}return this.pushStack(a.length>1?lt.unique(a):a)},index:function(e){return e?"string"==typeof e?lt.inArray(this[0],lt(e)):lt.inArray(e.jquery?e[0]:e,this):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(e,t){var n="string"==typeof e?lt(e,t):lt.makeArray(e&&e.nodeType?[e]:e),i=lt.merge(this.get(),n);return this.pushStack(lt.unique(i))},addBack:function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}}),lt.fn.andSelf=lt.fn.addBack,lt.each({parent:function(e){var t=e.parentNode;return t&&11!==t.nodeType?t:null},parents:function(e){return lt.dir(e,"parentNode")},parentsUntil:function(e,t,n){return lt.dir(e,"parentNode",n)},next:function(e){return u(e,"nextSibling")},prev:function(e){return u(e,"previousSibling")},nextAll:function(e){return lt.dir(e,"nextSibling")},prevAll:function(e){return lt.dir(e,"previousSibling")},nextUntil:function(e,t,n){return lt.dir(e,"nextSibling",n)},prevUntil:function(e,t,n){return lt.dir(e,"previousSibling",n)},siblings:function(e){return lt.sibling((e.parentNode||{}).firstChild,e)},children:function(e){return lt.sibling(e.firstChild)},contents:function(e){return lt.nodeName(e,"iframe")?e.contentDocument||e.contentWindow.document:lt.merge([],e.childNodes)}},function(e,t){lt.fn[e]=function(n,i){var o=lt.map(this,t,n);return qt.test(e)||(i=n),i&&"string"==typeof i&&(o=lt.filter(i,o)),o=this.length>1&&!Gt[e]?lt.unique(o):o,this.length>1&&Ut.test(e)&&(o=o.reverse()),this.pushStack(o)}}),lt.extend({filter:function(e,t,n){return n&&(e=":not("+e+")"),1===t.length?lt.find.matchesSelector(t[0],e)?[t[0]]:[]:lt.find.matches(e,t)},dir:function(e,n,i){for(var o=[],a=e[n];a&&9!==a.nodeType&&(i===t||1!==a.nodeType||!lt(a).is(i));)1===a.nodeType&&o.push(a),a=a[n];return o},sibling:function(e,t){for(var n=[];e;e=e.nextSibling)1===e.nodeType&&e!==t&&n.push(e);return n}});var Bt="abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",Vt=/ jQuery\d+="(?:null|\d+)"/g,Yt=RegExp("<(?:"+Bt+")[\\s/>]","i"),Kt=/^\s+/,Qt=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,Xt=/<([\w:]+)/,Jt=/<tbody/i,Zt=/<|&#?\w+;/,en=/<(?:script|style|link)/i,tn=/^(?:checkbox|radio)$/i,nn=/checked\s*(?:[^=]|=\s*.checked.)/i,on=/^$|\/(?:java|ecma)script/i,an=/^true\/(.*)/,sn=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,rn={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],area:[1,"<map>","</map>"],param:[1,"<object>","</object>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],_default:lt.support.htmlSerialize?[0,"",""]:[1,"X<div>","</div>"]},ln=d(Y),cn=ln.appendChild(Y.createElement("div"));rn.optgroup=rn.option,rn.tbody=rn.tfoot=rn.colgroup=rn.caption=rn.thead,rn.th=rn.td,lt.fn.extend({text:function(e){return lt.access(this,function(e){return e===t?lt.text(this):this.empty().append((this[0]&&this[0].ownerDocument||Y).createTextNode(e))},null,e,arguments.length)},wrapAll:function(e){if(lt.isFunction(e))return this.each(function(t){lt(this).wrapAll(e.call(this,t))});if(this[0]){var t=lt(e,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&t.insertBefore(this[0]),t.map(function(){for(var e=this;e.firstChild&&1===e.firstChild.nodeType;)e=e.firstChild;return e}).append(this)}return this},wrapInner:function(e){return lt.isFunction(e)?this.each(function(t){lt(this).wrapInner(e.call(this,t))}):this.each(function(){var t=lt(this),n=t.contents();n.length?n.wrapAll(e):t.append(e)})},wrap:function(e){var t=lt.isFunction(e);return this.each(function(n){lt(this).wrapAll(t?e.call(this,n):e)})},unwrap:function(){return this.parent().each(function(){lt.nodeName(this,"body")||lt(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(e){(1===this.nodeType||11===this.nodeType||9===this.nodeType)&&this.appendChild(e)})},prepend:function(){return this.domManip(arguments,!0,function(e){(1===this.nodeType||11===this.nodeType||9===this.nodeType)&&this.insertBefore(e,this.firstChild)})},before:function(){return this.domManip(arguments,!1,function(e){this.parentNode&&this.parentNode.insertBefore(e,this)})},after:function(){return this.domManip(arguments,!1,function(e){this.parentNode&&this.parentNode.insertBefore(e,this.nextSibling)})},remove:function(e,t){for(var n,i=0;null!=(n=this[i]);i++)(!e||lt.filter(e,[n]).length>0)&&(t||1!==n.nodeType||lt.cleanData(y(n)),n.parentNode&&(t&&lt.contains(n.ownerDocument,n)&&g(y(n,"script")),n.parentNode.removeChild(n)));return this},empty:function(){for(var e,t=0;null!=(e=this[t]);t++){for(1===e.nodeType&&lt.cleanData(y(e,!1));e.firstChild;)e.removeChild(e.firstChild);e.options&&lt.nodeName(e,"select")&&(e.options.length=0)}return this},clone:function(e,t){return e=null==e?!1:e,t=null==t?e:t,this.map(function(){return lt.clone(this,e,t)})},html:function(e){return lt.access(this,function(e){var n=this[0]||{},i=0,o=this.length;if(e===t)return 1===n.nodeType?n.innerHTML.replace(Vt,""):t;if(!("string"!=typeof e||en.test(e)||!lt.support.htmlSerialize&&Yt.test(e)||!lt.support.leadingWhitespace&&Kt.test(e)||rn[(Xt.exec(e)||["",""])[1].toLowerCase()])){e=e.replace(Qt,"<$1></$2>");try{for(;o>i;i++)n=this[i]||{},1===n.nodeType&&(lt.cleanData(y(n,!1)),n.innerHTML=e);n=0}catch(a){}}n&&this.empty().append(e)},null,e,arguments.length)},replaceWith:function(e){var t=lt.isFunction(e);return t||"string"==typeof e||(e=lt(e).not(this).detach()),this.domManip([e],!0,function(e){var t=this.nextSibling,n=this.parentNode;n&&(lt(this).remove(),n.insertBefore(e,t))})},detach:function(e){return this.remove(e,!0)},domManip:function(e,n,i){e=tt.apply([],e);var o,a,s,r,l,c,u=0,h=this.length,d=this,g=h-1,_=e[0],v=lt.isFunction(_);if(v||!(1>=h||"string"!=typeof _||lt.support.checkClone)&&nn.test(_))return this.each(function(o){var a=d.eq(o);v&&(e[0]=_.call(this,o,n?a.html():t)),a.domManip(e,n,i)});if(h&&(c=lt.buildFragment(e,this[0].ownerDocument,!1,this),o=c.firstChild,1===c.childNodes.length&&(c=o),o)){for(n=n&&lt.nodeName(o,"tr"),r=lt.map(y(c,"script"),f),s=r.length;h>u;u++)a=c,u!==g&&(a=lt.clone(a,!0,!0),s&&lt.merge(r,y(a,"script"))),i.call(n&&lt.nodeName(this[u],"table")?p(this[u],"tbody"):this[u],a,u);if(s)for(l=r[r.length-1].ownerDocument,lt.map(r,m),u=0;s>u;u++)a=r[u],on.test(a.type||"")&&!lt._data(a,"globalEval")&&lt.contains(l,a)&&(a.src?lt.ajax({url:a.src,type:"GET",dataType:"script",async:!1,global:!1,"throws":!0}):lt.globalEval((a.text||a.textContent||a.innerHTML||"").replace(sn,"")));c=o=null}return this}}),lt.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(e,t){lt.fn[e]=function(e){for(var n,i=0,o=[],a=lt(e),s=a.length-1;s>=i;i++)n=i===s?this:this.clone(!0),lt(a[i])[t](n),nt.apply(o,n.get());return this.pushStack(o)}}),lt.extend({clone:function(e,t,n){var i,o,a,s,r,l=lt.contains(e.ownerDocument,e);if(lt.support.html5Clone||lt.isXMLDoc(e)||!Yt.test("<"+e.nodeName+">")?a=e.cloneNode(!0):(cn.innerHTML=e.outerHTML,cn.removeChild(a=cn.firstChild)),!(lt.support.noCloneEvent&&lt.support.noCloneChecked||1!==e.nodeType&&11!==e.nodeType||lt.isXMLDoc(e)))for(i=y(a),r=y(e),s=0;null!=(o=r[s]);++s)i[s]&&v(o,i[s]);if(t)if(n)for(r=r||y(e),i=i||y(a),s=0;null!=(o=r[s]);s++)_(o,i[s]);else _(e,a);return i=y(a,"script"),i.length>0&&g(i,!l&&y(e,"script")),i=r=o=null,a},buildFragment:function(e,t,n,i){for(var o,a,s,r,l,c,u,h=e.length,p=d(t),f=[],m=0;h>m;m++)if(a=e[m],a||0===a)if("object"===lt.type(a))lt.merge(f,a.nodeType?[a]:a);else if(Zt.test(a)){for(r=r||p.appendChild(t.createElement("div")),l=(Xt.exec(a)||["",""])[1].toLowerCase(),u=rn[l]||rn._default,r.innerHTML=u[1]+a.replace(Qt,"<$1></$2>")+u[2],o=u[0];o--;)r=r.lastChild;if(!lt.support.leadingWhitespace&&Kt.test(a)&&f.push(t.createTextNode(Kt.exec(a)[0])),!lt.support.tbody)for(a="table"!==l||Jt.test(a)?"<table>"!==u[1]||Jt.test(a)?0:r:r.firstChild,o=a&&a.childNodes.length;o--;)lt.nodeName(c=a.childNodes[o],"tbody")&&!c.childNodes.length&&a.removeChild(c);for(lt.merge(f,r.childNodes),r.textContent="";r.firstChild;)r.removeChild(r.firstChild);r=p.lastChild}else f.push(t.createTextNode(a));for(r&&p.removeChild(r),lt.support.appendChecked||lt.grep(y(f,"input"),w),m=0;a=f[m++];)if((!i||-1===lt.inArray(a,i))&&(s=lt.contains(a.ownerDocument,a),r=y(p.appendChild(a),"script"),s&&g(r),n))for(o=0;a=r[o++];)on.test(a.type||"")&&n.push(a);return r=null,p},cleanData:function(e,t){for(var n,i,o,a,s=0,r=lt.expando,l=lt.cache,c=lt.support.deleteExpando,u=lt.event.special;null!=(n=e[s]);s++)if((t||lt.acceptData(n))&&(o=n[r],a=o&&l[o])){if(a.events)for(i in a.events)u[i]?lt.event.remove(n,i):lt.removeEvent(n,i,a.handle);l[o]&&(delete l[o],c?delete n[r]:typeof n.removeAttribute!==V?n.removeAttribute(r):n[r]=null,Z.push(o))}}});var un,hn,dn,pn=/alpha\([^)]*\)/i,fn=/opacity\s*=\s*([^)]*)/,mn=/^(top|right|bottom|left)$/,gn=/^(none|table(?!-c[ea]).+)/,_n=/^margin/,vn=RegExp("^("+ct+")(.*)$","i"),yn=RegExp("^("+ct+")(?!px)[a-z%]+$","i"),wn=RegExp("^([+-])=("+ct+")","i"),bn={BODY:"block"},xn={position:"absolute",visibility:"hidden",display:"block"},kn={letterSpacing:0,fontWeight:400},Cn=["Top","Right","Bottom","Left"],En=["Webkit","O","Moz","ms"];lt.fn.extend({css:function(e,n){return lt.access(this,function(e,n,i){var o,a,s={},r=0;if(lt.isArray(n)){for(a=hn(e),o=n.length;o>r;r++)s[n[r]]=lt.css(e,n[r],!1,a);return s}return i!==t?lt.style(e,n,i):lt.css(e,n)},e,n,arguments.length>1)},show:function(){return k(this,!0)},hide:function(){return k(this)},toggle:function(e){var t="boolean"==typeof e;return this.each(function(){(t?e:x(this))?lt(this).show():lt(this).hide()})}}),lt.extend({cssHooks:{opacity:{get:function(e,t){if(t){var n=dn(e,"opacity");return""===n?"1":n}}}},cssNumber:{columnCount:!0,fillOpacity:!0,fontWeight:!0,lineHeight:!0,opacity:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":lt.support.cssFloat?"cssFloat":"styleFloat"},style:function(e,n,i,o){if(e&&3!==e.nodeType&&8!==e.nodeType&&e.style){var a,s,r,l=lt.camelCase(n),c=e.style;if(n=lt.cssProps[l]||(lt.cssProps[l]=b(c,l)),r=lt.cssHooks[n]||lt.cssHooks[l],i===t)return r&&"get"in r&&(a=r.get(e,!1,o))!==t?a:c[n];if(s=typeof i,"string"===s&&(a=wn.exec(i))&&(i=(a[1]+1)*a[2]+parseFloat(lt.css(e,n)),s="number"),!(null==i||"number"===s&&isNaN(i)||("number"!==s||lt.cssNumber[l]||(i+="px"),lt.support.clearCloneStyle||""!==i||0!==n.indexOf("background")||(c[n]="inherit"),r&&"set"in r&&(i=r.set(e,i,o))===t)))try{c[n]=i}catch(u){}}},css:function(e,n,i,o){var a,s,r,l=lt.camelCase(n);return n=lt.cssProps[l]||(lt.cssProps[l]=b(e.style,l)),r=lt.cssHooks[n]||lt.cssHooks[l],r&&"get"in r&&(s=r.get(e,!0,i)),s===t&&(s=dn(e,n,o)),"normal"===s&&n in kn&&(s=kn[n]),""===i||i?(a=parseFloat(s),i===!0||lt.isNumeric(a)?a||0:s):s},swap:function(e,t,n,i){var o,a,s={};for(a in t)s[a]=e.style[a],e.style[a]=t[a];o=n.apply(e,i||[]);for(a in t)e.style[a]=s[a];return o}}),e.getComputedStyle?(hn=function(t){return e.getComputedStyle(t,null)},dn=function(e,n,i){var o,a,s,r=i||hn(e),l=r?r.getPropertyValue(n)||r[n]:t,c=e.style;return r&&(""!==l||lt.contains(e.ownerDocument,e)||(l=lt.style(e,n)),yn.test(l)&&_n.test(n)&&(o=c.width,a=c.minWidth,s=c.maxWidth,c.minWidth=c.maxWidth=c.width=l,l=r.width,c.width=o,c.minWidth=a,c.maxWidth=s)),l}):Y.documentElement.currentStyle&&(hn=function(e){return e.currentStyle},dn=function(e,n,i){var o,a,s,r=i||hn(e),l=r?r[n]:t,c=e.style;return null==l&&c&&c[n]&&(l=c[n]),yn.test(l)&&!mn.test(n)&&(o=c.left,a=e.runtimeStyle,s=a&&a.left,s&&(a.left=e.currentStyle.left),c.left="fontSize"===n?"1em":l,l=c.pixelLeft+"px",c.left=o,s&&(a.left=s)),""===l?"auto":l}),lt.each(["height","width"],function(e,n){lt.cssHooks[n]={get:function(e,i,o){return i?0===e.offsetWidth&&gn.test(lt.css(e,"display"))?lt.swap(e,xn,function(){return T(e,n,o)}):T(e,n,o):t},set:function(e,t,i){var o=i&&hn(e);return C(e,t,i?E(e,n,i,lt.support.boxSizing&&"border-box"===lt.css(e,"boxSizing",!1,o),o):0)}}}),lt.support.opacity||(lt.cssHooks.opacity={get:function(e,t){return fn.test((t&&e.currentStyle?e.currentStyle.filter:e.style.filter)||"")?.01*parseFloat(RegExp.$1)+"":t?"1":""},set:function(e,t){var n=e.style,i=e.currentStyle,o=lt.isNumeric(t)?"alpha(opacity="+100*t+")":"",a=i&&i.filter||n.filter||"";n.zoom=1,(t>=1||""===t)&&""===lt.trim(a.replace(pn,""))&&n.removeAttribute&&(n.removeAttribute("filter"),""===t||i&&!i.filter)||(n.filter=pn.test(a)?a.replace(pn,o):a+" "+o)}}),lt(function(){lt.support.reliableMarginRight||(lt.cssHooks.marginRight={get:function(e,n){return n?lt.swap(e,{display:"inline-block"},dn,[e,"marginRight"]):t}}),!lt.support.pixelPosition&&lt.fn.position&&lt.each(["top","left"],function(e,n){lt.cssHooks[n]={get:function(e,i){return i?(i=dn(e,n),yn.test(i)?lt(e).position()[n]+"px":i):t}}})}),lt.expr&&lt.expr.filters&&(lt.expr.filters.hidden=function(e){return 0>=e.offsetWidth&&0>=e.offsetHeight||!lt.support.reliableHiddenOffsets&&"none"===(e.style&&e.style.display||lt.css(e,"display"))},lt.expr.filters.visible=function(e){return!lt.expr.filters.hidden(e)}),lt.each({margin:"",padding:"",border:"Width"},function(e,t){lt.cssHooks[e+t]={expand:function(n){for(var i=0,o={},a="string"==typeof n?n.split(" "):[n];4>i;i++)o[e+Cn[i]+t]=a[i]||a[i-2]||a[0];return o}},_n.test(e)||(lt.cssHooks[e+t].set=C)});var Tn=/%20/g,Sn=/\[\]$/,Pn=/\r?\n/g,An=/^(?:submit|button|image|reset|file)$/i,In=/^(?:input|select|textarea|keygen)/i;lt.fn.extend({serialize:function(){return lt.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var e=lt.prop(this,"elements");return e?lt.makeArray(e):this}).filter(function(){var e=this.type;return this.name&&!lt(this).is(":disabled")&&In.test(this.nodeName)&&!An.test(e)&&(this.checked||!tn.test(e))}).map(function(e,t){var n=lt(this).val();return null==n?null:lt.isArray(n)?lt.map(n,function(e){return{name:t.name,value:e.replace(Pn,"\r\n")}
}):{name:t.name,value:n.replace(Pn,"\r\n")}}).get()}}),lt.param=function(e,n){var i,o=[],a=function(e,t){t=lt.isFunction(t)?t():null==t?"":t,o[o.length]=encodeURIComponent(e)+"="+encodeURIComponent(t)};if(n===t&&(n=lt.ajaxSettings&&lt.ajaxSettings.traditional),lt.isArray(e)||e.jquery&&!lt.isPlainObject(e))lt.each(e,function(){a(this.name,this.value)});else for(i in e)A(i,e[i],n,a);return o.join("&").replace(Tn,"+")},lt.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu".split(" "),function(e,t){lt.fn[t]=function(e,n){return arguments.length>0?this.on(t,null,e,n):this.trigger(t)}}),lt.fn.hover=function(e,t){return this.mouseenter(e).mouseleave(t||e)};var $n,Nn,Mn=lt.now(),Rn=/\?/,jn=/#.*$/,On=/([?&])_=[^&]*/,Dn=/^(.*?):[ \t]*([^\r\n]*)\r?$/gm,Hn=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,Ln=/^(?:GET|HEAD)$/,zn=/^\/\//,qn=/^([\w.+-]+:)(?:\/\/([^\/?#:]*)(?::(\d+)|)|)/,Un=lt.fn.load,Wn={},Fn={},Gn="*/".concat("*");try{Nn=K.href}catch(Bn){Nn=Y.createElement("a"),Nn.href="",Nn=Nn.href}$n=qn.exec(Nn.toLowerCase())||[],lt.fn.load=function(e,n,i){if("string"!=typeof e&&Un)return Un.apply(this,arguments);var o,a,s,r=this,l=e.indexOf(" ");return l>=0&&(o=e.slice(l,e.length),e=e.slice(0,l)),lt.isFunction(n)?(i=n,n=t):n&&"object"==typeof n&&(s="POST"),r.length>0&&lt.ajax({url:e,type:s,dataType:"html",data:n}).done(function(e){a=arguments,r.html(o?lt("<div>").append(lt.parseHTML(e)).find(o):e)}).complete(i&&function(e,t){r.each(i,a||[e.responseText,t,e])}),this},lt.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(e,t){lt.fn[t]=function(e){return this.on(t,e)}}),lt.each(["get","post"],function(e,n){lt[n]=function(e,i,o,a){return lt.isFunction(i)&&(a=a||o,o=i,i=t),lt.ajax({url:e,type:n,dataType:a,data:i,success:o})}}),lt.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:Nn,type:"GET",isLocal:Hn.test($n[1]),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":Gn,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":e.String,"text html":!0,"text json":lt.parseJSON,"text xml":lt.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(e,t){return t?N(N(e,lt.ajaxSettings),t):N(lt.ajaxSettings,e)},ajaxPrefilter:I(Wn),ajaxTransport:I(Fn),ajax:function(e,n){function i(e,n,i,o){var a,h,v,y,b,k=n;2!==w&&(w=2,l&&clearTimeout(l),u=t,r=o||"",x.readyState=e>0?4:0,i&&(y=M(d,x,i)),e>=200&&300>e||304===e?(d.ifModified&&(b=x.getResponseHeader("Last-Modified"),b&&(lt.lastModified[s]=b),b=x.getResponseHeader("etag"),b&&(lt.etag[s]=b)),204===e?(a=!0,k="nocontent"):304===e?(a=!0,k="notmodified"):(a=R(d,y),k=a.state,h=a.data,v=a.error,a=!v)):(v=k,(e||!k)&&(k="error",0>e&&(e=0))),x.status=e,x.statusText=(n||k)+"",a?m.resolveWith(p,[h,k,x]):m.rejectWith(p,[x,k,v]),x.statusCode(_),_=t,c&&f.trigger(a?"ajaxSuccess":"ajaxError",[x,d,a?h:v]),g.fireWith(p,[x,k]),c&&(f.trigger("ajaxComplete",[x,d]),--lt.active||lt.event.trigger("ajaxStop")))}"object"==typeof e&&(n=e,e=t),n=n||{};var o,a,s,r,l,c,u,h,d=lt.ajaxSetup({},n),p=d.context||d,f=d.context&&(p.nodeType||p.jquery)?lt(p):lt.event,m=lt.Deferred(),g=lt.Callbacks("once memory"),_=d.statusCode||{},v={},y={},w=0,b="canceled",x={readyState:0,getResponseHeader:function(e){var t;if(2===w){if(!h)for(h={};t=Dn.exec(r);)h[t[1].toLowerCase()]=t[2];t=h[e.toLowerCase()]}return null==t?null:t},getAllResponseHeaders:function(){return 2===w?r:null},setRequestHeader:function(e,t){var n=e.toLowerCase();return w||(e=y[n]=y[n]||e,v[e]=t),this},overrideMimeType:function(e){return w||(d.mimeType=e),this},statusCode:function(e){var t;if(e)if(2>w)for(t in e)_[t]=[_[t],e[t]];else x.always(e[x.status]);return this},abort:function(e){var t=e||b;return u&&u.abort(t),i(0,t),this}};if(m.promise(x).complete=g.add,x.success=x.done,x.error=x.fail,d.url=((e||d.url||Nn)+"").replace(jn,"").replace(zn,$n[1]+"//"),d.type=n.method||n.type||d.method||d.type,d.dataTypes=lt.trim(d.dataType||"*").toLowerCase().match(ut)||[""],null==d.crossDomain&&(o=qn.exec(d.url.toLowerCase()),d.crossDomain=!(!o||o[1]===$n[1]&&o[2]===$n[2]&&(o[3]||("http:"===o[1]?80:443))==($n[3]||("http:"===$n[1]?80:443)))),d.data&&d.processData&&"string"!=typeof d.data&&(d.data=lt.param(d.data,d.traditional)),$(Wn,d,n,x),2===w)return x;c=d.global,c&&0===lt.active++&&lt.event.trigger("ajaxStart"),d.type=d.type.toUpperCase(),d.hasContent=!Ln.test(d.type),s=d.url,d.hasContent||(d.data&&(s=d.url+=(Rn.test(s)?"&":"?")+d.data,delete d.data),d.cache===!1&&(d.url=On.test(s)?s.replace(On,"$1_="+Mn++):s+(Rn.test(s)?"&":"?")+"_="+Mn++)),d.ifModified&&(lt.lastModified[s]&&x.setRequestHeader("If-Modified-Since",lt.lastModified[s]),lt.etag[s]&&x.setRequestHeader("If-None-Match",lt.etag[s])),(d.data&&d.hasContent&&d.contentType!==!1||n.contentType)&&x.setRequestHeader("Content-Type",d.contentType),x.setRequestHeader("Accept",d.dataTypes[0]&&d.accepts[d.dataTypes[0]]?d.accepts[d.dataTypes[0]]+("*"!==d.dataTypes[0]?", "+Gn+"; q=0.01":""):d.accepts["*"]);for(a in d.headers)x.setRequestHeader(a,d.headers[a]);if(d.beforeSend&&(d.beforeSend.call(p,x,d)===!1||2===w))return x.abort();b="abort";for(a in{success:1,error:1,complete:1})x[a](d[a]);if(u=$(Fn,d,n,x)){x.readyState=1,c&&f.trigger("ajaxSend",[x,d]),d.async&&d.timeout>0&&(l=setTimeout(function(){x.abort("timeout")},d.timeout));try{w=1,u.send(v,i)}catch(k){if(!(2>w))throw k;i(-1,k)}}else i(-1,"No Transport");return x},getScript:function(e,n){return lt.get(e,t,n,"script")},getJSON:function(e,t,n){return lt.get(e,t,n,"json")}}),lt.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/(?:java|ecma)script/},converters:{"text script":function(e){return lt.globalEval(e),e}}}),lt.ajaxPrefilter("script",function(e){e.cache===t&&(e.cache=!1),e.crossDomain&&(e.type="GET",e.global=!1)}),lt.ajaxTransport("script",function(e){if(e.crossDomain){var n,i=Y.head||lt("head")[0]||Y.documentElement;return{send:function(t,o){n=Y.createElement("script"),n.async=!0,e.scriptCharset&&(n.charset=e.scriptCharset),n.src=e.url,n.onload=n.onreadystatechange=function(e,t){(t||!n.readyState||/loaded|complete/.test(n.readyState))&&(n.onload=n.onreadystatechange=null,n.parentNode&&n.parentNode.removeChild(n),n=null,t||o(200,"success"))},i.insertBefore(n,i.firstChild)},abort:function(){n&&n.onload(t,!0)}}}});var Vn=[],Yn=/(=)\?(?=&|$)|\?\?/;lt.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=Vn.pop()||lt.expando+"_"+Mn++;return this[e]=!0,e}}),lt.ajaxPrefilter("json jsonp",function(n,i,o){var a,s,r,l=n.jsonp!==!1&&(Yn.test(n.url)?"url":"string"==typeof n.data&&!(n.contentType||"").indexOf("application/x-www-form-urlencoded")&&Yn.test(n.data)&&"data");return l||"jsonp"===n.dataTypes[0]?(a=n.jsonpCallback=lt.isFunction(n.jsonpCallback)?n.jsonpCallback():n.jsonpCallback,l?n[l]=n[l].replace(Yn,"$1"+a):n.jsonp!==!1&&(n.url+=(Rn.test(n.url)?"&":"?")+n.jsonp+"="+a),n.converters["script json"]=function(){return r||lt.error(a+" was not called"),r[0]},n.dataTypes[0]="json",s=e[a],e[a]=function(){r=arguments},o.always(function(){e[a]=s,n[a]&&(n.jsonpCallback=i.jsonpCallback,Vn.push(a)),r&&lt.isFunction(s)&&s(r[0]),r=s=t}),"script"):t});var Kn,Qn,Xn=0,Jn=e.ActiveXObject&&function(){var e;for(e in Kn)Kn[e](t,!0)};lt.ajaxSettings.xhr=e.ActiveXObject?function(){return!this.isLocal&&j()||O()}:j,Qn=lt.ajaxSettings.xhr(),lt.support.cors=!!Qn&&"withCredentials"in Qn,Qn=lt.support.ajax=!!Qn,Qn&&lt.ajaxTransport(function(n){if(!n.crossDomain||lt.support.cors){var i;return{send:function(o,a){var s,r,l=n.xhr();if(n.username?l.open(n.type,n.url,n.async,n.username,n.password):l.open(n.type,n.url,n.async),n.xhrFields)for(r in n.xhrFields)l[r]=n.xhrFields[r];n.mimeType&&l.overrideMimeType&&l.overrideMimeType(n.mimeType),n.crossDomain||o["X-Requested-With"]||(o["X-Requested-With"]="XMLHttpRequest");try{for(r in o)l.setRequestHeader(r,o[r])}catch(c){}l.send(n.hasContent&&n.data||null),i=function(e,o){var r,c,u,h;try{if(i&&(o||4===l.readyState))if(i=t,s&&(l.onreadystatechange=lt.noop,Jn&&delete Kn[s]),o)4!==l.readyState&&l.abort();else{h={},r=l.status,c=l.getAllResponseHeaders(),"string"==typeof l.responseText&&(h.text=l.responseText);try{u=l.statusText}catch(d){u=""}r||!n.isLocal||n.crossDomain?1223===r&&(r=204):r=h.text?200:404}}catch(p){o||a(-1,p)}h&&a(r,u,h,c)},n.async?4===l.readyState?setTimeout(i):(s=++Xn,Jn&&(Kn||(Kn={},lt(e).unload(Jn)),Kn[s]=i),l.onreadystatechange=i):i()},abort:function(){i&&i(t,!0)}}}});var Zn,ei,ti=/^(?:toggle|show|hide)$/,ni=RegExp("^(?:([+-])=|)("+ct+")([a-z%]*)$","i"),ii=/queueHooks$/,oi=[q],ai={"*":[function(e,t){var n,i,o=this.createTween(e,t),a=ni.exec(t),s=o.cur(),r=+s||0,l=1,c=20;if(a){if(n=+a[2],i=a[3]||(lt.cssNumber[e]?"":"px"),"px"!==i&&r){r=lt.css(o.elem,e,!0)||n||1;do l=l||".5",r/=l,lt.style(o.elem,e,r+i);while(l!==(l=o.cur()/s)&&1!==l&&--c)}o.unit=i,o.start=r,o.end=a[1]?r+(a[1]+1)*n:n}return o}]};lt.Animation=lt.extend(L,{tweener:function(e,t){lt.isFunction(e)?(t=e,e=["*"]):e=e.split(" ");for(var n,i=0,o=e.length;o>i;i++)n=e[i],ai[n]=ai[n]||[],ai[n].unshift(t)},prefilter:function(e,t){t?oi.unshift(e):oi.push(e)}}),lt.Tween=U,U.prototype={constructor:U,init:function(e,t,n,i,o,a){this.elem=e,this.prop=n,this.easing=o||"swing",this.options=t,this.start=this.now=this.cur(),this.end=i,this.unit=a||(lt.cssNumber[n]?"":"px")},cur:function(){var e=U.propHooks[this.prop];return e&&e.get?e.get(this):U.propHooks._default.get(this)},run:function(e){var t,n=U.propHooks[this.prop];return this.pos=t=this.options.duration?lt.easing[this.easing](e,this.options.duration*e,0,1,this.options.duration):e,this.now=(this.end-this.start)*t+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),n&&n.set?n.set(this):U.propHooks._default.set(this),this}},U.prototype.init.prototype=U.prototype,U.propHooks={_default:{get:function(e){var t;return null==e.elem[e.prop]||e.elem.style&&null!=e.elem.style[e.prop]?(t=lt.css(e.elem,e.prop,""),t&&"auto"!==t?t:0):e.elem[e.prop]},set:function(e){lt.fx.step[e.prop]?lt.fx.step[e.prop](e):e.elem.style&&(null!=e.elem.style[lt.cssProps[e.prop]]||lt.cssHooks[e.prop])?lt.style(e.elem,e.prop,e.now+e.unit):e.elem[e.prop]=e.now}}},U.propHooks.scrollTop=U.propHooks.scrollLeft={set:function(e){e.elem.nodeType&&e.elem.parentNode&&(e.elem[e.prop]=e.now)}},lt.each(["toggle","show","hide"],function(e,t){var n=lt.fn[t];lt.fn[t]=function(e,i,o){return null==e||"boolean"==typeof e?n.apply(this,arguments):this.animate(W(t,!0),e,i,o)}}),lt.fn.extend({fadeTo:function(e,t,n,i){return this.filter(x).css("opacity",0).show().end().animate({opacity:t},e,n,i)},animate:function(e,t,n,i){var o=lt.isEmptyObject(e),a=lt.speed(t,n,i),s=function(){var t=L(this,lt.extend({},e),a);s.finish=function(){t.stop(!0)},(o||lt._data(this,"finish"))&&t.stop(!0)};return s.finish=s,o||a.queue===!1?this.each(s):this.queue(a.queue,s)},stop:function(e,n,i){var o=function(e){var t=e.stop;delete e.stop,t(i)};return"string"!=typeof e&&(i=n,n=e,e=t),n&&e!==!1&&this.queue(e||"fx",[]),this.each(function(){var t=!0,n=null!=e&&e+"queueHooks",a=lt.timers,s=lt._data(this);if(n)s[n]&&s[n].stop&&o(s[n]);else for(n in s)s[n]&&s[n].stop&&ii.test(n)&&o(s[n]);for(n=a.length;n--;)a[n].elem!==this||null!=e&&a[n].queue!==e||(a[n].anim.stop(i),t=!1,a.splice(n,1));(t||!i)&&lt.dequeue(this,e)})},finish:function(e){return e!==!1&&(e=e||"fx"),this.each(function(){var t,n=lt._data(this),i=n[e+"queue"],o=n[e+"queueHooks"],a=lt.timers,s=i?i.length:0;for(n.finish=!0,lt.queue(this,e,[]),o&&o.cur&&o.cur.finish&&o.cur.finish.call(this),t=a.length;t--;)a[t].elem===this&&a[t].queue===e&&(a[t].anim.stop(!0),a.splice(t,1));for(t=0;s>t;t++)i[t]&&i[t].finish&&i[t].finish.call(this);delete n.finish})}}),lt.each({slideDown:W("show"),slideUp:W("hide"),slideToggle:W("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(e,t){lt.fn[e]=function(e,n,i){return this.animate(t,e,n,i)}}),lt.speed=function(e,t,n){var i=e&&"object"==typeof e?lt.extend({},e):{complete:n||!n&&t||lt.isFunction(e)&&e,duration:e,easing:n&&t||t&&!lt.isFunction(t)&&t};return i.duration=lt.fx.off?0:"number"==typeof i.duration?i.duration:i.duration in lt.fx.speeds?lt.fx.speeds[i.duration]:lt.fx.speeds._default,(null==i.queue||i.queue===!0)&&(i.queue="fx"),i.old=i.complete,i.complete=function(){lt.isFunction(i.old)&&i.old.call(this),i.queue&&lt.dequeue(this,i.queue)},i},lt.easing={linear:function(e){return e},swing:function(e){return.5-Math.cos(e*Math.PI)/2}},lt.timers=[],lt.fx=U.prototype.init,lt.fx.tick=function(){var e,n=lt.timers,i=0;for(Zn=lt.now();n.length>i;i++)e=n[i],e()||n[i]!==e||n.splice(i--,1);n.length||lt.fx.stop(),Zn=t},lt.fx.timer=function(e){e()&&lt.timers.push(e)&&lt.fx.start()},lt.fx.interval=13,lt.fx.start=function(){ei||(ei=setInterval(lt.fx.tick,lt.fx.interval))},lt.fx.stop=function(){clearInterval(ei),ei=null},lt.fx.speeds={slow:600,fast:200,_default:400},lt.fx.step={},lt.expr&&lt.expr.filters&&(lt.expr.filters.animated=function(e){return lt.grep(lt.timers,function(t){return e===t.elem}).length}),lt.fn.offset=function(e){if(arguments.length)return e===t?this:this.each(function(t){lt.offset.setOffset(this,e,t)});var n,i,o={top:0,left:0},a=this[0],s=a&&a.ownerDocument;if(s)return n=s.documentElement,lt.contains(n,a)?(typeof a.getBoundingClientRect!==V&&(o=a.getBoundingClientRect()),i=F(s),{top:o.top+(i.pageYOffset||n.scrollTop)-(n.clientTop||0),left:o.left+(i.pageXOffset||n.scrollLeft)-(n.clientLeft||0)}):o},lt.offset={setOffset:function(e,t,n){var i=lt.css(e,"position");"static"===i&&(e.style.position="relative");var o,a,s=lt(e),r=s.offset(),l=lt.css(e,"top"),c=lt.css(e,"left"),u=("absolute"===i||"fixed"===i)&&lt.inArray("auto",[l,c])>-1,h={},d={};u?(d=s.position(),o=d.top,a=d.left):(o=parseFloat(l)||0,a=parseFloat(c)||0),lt.isFunction(t)&&(t=t.call(e,n,r)),null!=t.top&&(h.top=t.top-r.top+o),null!=t.left&&(h.left=t.left-r.left+a),"using"in t?t.using.call(e,h):s.css(h)}},lt.fn.extend({position:function(){if(this[0]){var e,t,n={top:0,left:0},i=this[0];return"fixed"===lt.css(i,"position")?t=i.getBoundingClientRect():(e=this.offsetParent(),t=this.offset(),lt.nodeName(e[0],"html")||(n=e.offset()),n.top+=lt.css(e[0],"borderTopWidth",!0),n.left+=lt.css(e[0],"borderLeftWidth",!0)),{top:t.top-n.top-lt.css(i,"marginTop",!0),left:t.left-n.left-lt.css(i,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){for(var e=this.offsetParent||Y.documentElement;e&&!lt.nodeName(e,"html")&&"static"===lt.css(e,"position");)e=e.offsetParent;return e||Y.documentElement})}}),lt.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(e,n){var i=/Y/.test(n);lt.fn[e]=function(o){return lt.access(this,function(e,o,a){var s=F(e);return a===t?s?n in s?s[n]:s.document.documentElement[o]:e[o]:(s?s.scrollTo(i?lt(s).scrollLeft():a,i?a:lt(s).scrollTop()):e[o]=a,t)},e,o,arguments.length,null)}}),lt.each({Height:"height",Width:"width"},function(e,n){lt.each({padding:"inner"+e,content:n,"":"outer"+e},function(i,o){lt.fn[o]=function(o,a){var s=arguments.length&&(i||"boolean"!=typeof o),r=i||(o===!0||a===!0?"margin":"border");return lt.access(this,function(n,i,o){var a;return lt.isWindow(n)?n.document.documentElement["client"+e]:9===n.nodeType?(a=n.documentElement,Math.max(n.body["scroll"+e],a["scroll"+e],n.body["offset"+e],a["offset"+e],a["client"+e])):o===t?lt.css(n,i,r):lt.style(n,i,o,r)},n,s?o:t,s,null)}})}),e.jQuery=e.$=lt,"function"==typeof define&&define.amd&&define.amd.jQuery&&define("jquery",[],function(){return lt})}(window),function(){var e=this,t=e._,n={},i=Array.prototype,o=Object.prototype,a=Function.prototype,s=i.push,r=i.slice,l=i.concat,c=o.toString,u=o.hasOwnProperty,h=i.forEach,d=i.map,p=i.reduce,f=i.reduceRight,m=i.filter,g=i.every,_=i.some,v=i.indexOf,y=i.lastIndexOf,w=Array.isArray,b=Object.keys,x=a.bind,k=function(e){return e instanceof k?e:this instanceof k?(this._wrapped=e,void 0):new k(e)};"undefined"!=typeof exports?("undefined"!=typeof module&&module.exports&&(exports=module.exports=k),exports._=k):e._=k,k.VERSION="1.4.4";var C=k.each=k.forEach=function(e,t,i){if(null!=e)if(h&&e.forEach===h)e.forEach(t,i);else if(e.length===+e.length){for(var o=0,a=e.length;a>o;o++)if(t.call(i,e[o],o,e)===n)return}else for(var s in e)if(k.has(e,s)&&t.call(i,e[s],s,e)===n)return};k.map=k.collect=function(e,t,n){var i=[];return null==e?i:d&&e.map===d?e.map(t,n):(C(e,function(e,o,a){i[i.length]=t.call(n,e,o,a)}),i)};var E="Reduce of empty array with no initial value";k.reduce=k.foldl=k.inject=function(e,t,n,i){var o=arguments.length>2;if(null==e&&(e=[]),p&&e.reduce===p)return i&&(t=k.bind(t,i)),o?e.reduce(t,n):e.reduce(t);if(C(e,function(e,a,s){o?n=t.call(i,n,e,a,s):(n=e,o=!0)}),!o)throw new TypeError(E);return n},k.reduceRight=k.foldr=function(e,t,n,i){var o=arguments.length>2;if(null==e&&(e=[]),f&&e.reduceRight===f)return i&&(t=k.bind(t,i)),o?e.reduceRight(t,n):e.reduceRight(t);var a=e.length;if(a!==+a){var s=k.keys(e);a=s.length}if(C(e,function(r,l,c){l=s?s[--a]:--a,o?n=t.call(i,n,e[l],l,c):(n=e[l],o=!0)}),!o)throw new TypeError(E);return n},k.find=k.detect=function(e,t,n){var i;return T(e,function(e,o,a){return t.call(n,e,o,a)?(i=e,!0):void 0}),i},k.filter=k.select=function(e,t,n){var i=[];return null==e?i:m&&e.filter===m?e.filter(t,n):(C(e,function(e,o,a){t.call(n,e,o,a)&&(i[i.length]=e)}),i)},k.reject=function(e,t,n){return k.filter(e,function(e,i,o){return!t.call(n,e,i,o)},n)},k.every=k.all=function(e,t,i){t||(t=k.identity);var o=!0;return null==e?o:g&&e.every===g?e.every(t,i):(C(e,function(e,a,s){return(o=o&&t.call(i,e,a,s))?void 0:n}),!!o)};var T=k.some=k.any=function(e,t,i){t||(t=k.identity);var o=!1;return null==e?o:_&&e.some===_?e.some(t,i):(C(e,function(e,a,s){return o||(o=t.call(i,e,a,s))?n:void 0}),!!o)};k.contains=k.include=function(e,t){return null==e?!1:v&&e.indexOf===v?-1!=e.indexOf(t):T(e,function(e){return e===t})},k.invoke=function(e,t){var n=r.call(arguments,2),i=k.isFunction(t);return k.map(e,function(e){return(i?t:e[t]).apply(e,n)})},k.pluck=function(e,t){return k.map(e,function(e){return e[t]})},k.where=function(e,t,n){return k.isEmpty(t)?n?null:[]:k[n?"find":"filter"](e,function(e){for(var n in t)if(t[n]!==e[n])return!1;return!0})},k.findWhere=function(e,t){return k.where(e,t,!0)},k.max=function(e,t,n){if(!t&&k.isArray(e)&&e[0]===+e[0]&&65535>e.length)return Math.max.apply(Math,e);if(!t&&k.isEmpty(e))return-1/0;var i={computed:-1/0,value:-1/0};return C(e,function(e,o,a){var s=t?t.call(n,e,o,a):e;s>=i.computed&&(i={value:e,computed:s})}),i.value},k.min=function(e,t,n){if(!t&&k.isArray(e)&&e[0]===+e[0]&&65535>e.length)return Math.min.apply(Math,e);if(!t&&k.isEmpty(e))return 1/0;var i={computed:1/0,value:1/0};return C(e,function(e,o,a){var s=t?t.call(n,e,o,a):e;i.computed>s&&(i={value:e,computed:s})}),i.value},k.shuffle=function(e){var t,n=0,i=[];return C(e,function(e){t=k.random(n++),i[n-1]=i[t],i[t]=e}),i};var S=function(e){return k.isFunction(e)?e:function(t){return t[e]}};k.sortBy=function(e,t,n){var i=S(t);return k.pluck(k.map(e,function(e,t,o){return{value:e,index:t,criteria:i.call(n,e,t,o)}}).sort(function(e,t){var n=e.criteria,i=t.criteria;if(n!==i){if(n>i||void 0===n)return 1;if(i>n||void 0===i)return-1}return e.index<t.index?-1:1}),"value")};var P=function(e,t,n,i){var o={},a=S(t||k.identity);return C(e,function(t,s){var r=a.call(n,t,s,e);i(o,r,t)}),o};k.groupBy=function(e,t,n){return P(e,t,n,function(e,t,n){(k.has(e,t)?e[t]:e[t]=[]).push(n)})},k.countBy=function(e,t,n){return P(e,t,n,function(e,t){k.has(e,t)||(e[t]=0),e[t]++})},k.sortedIndex=function(e,t,n,i){n=null==n?k.identity:S(n);for(var o=n.call(i,t),a=0,s=e.length;s>a;){var r=a+s>>>1;o>n.call(i,e[r])?a=r+1:s=r}return a},k.toArray=function(e){return e?k.isArray(e)?r.call(e):e.length===+e.length?k.map(e,k.identity):k.values(e):[]},k.size=function(e){return null==e?0:e.length===+e.length?e.length:k.keys(e).length},k.first=k.head=k.take=function(e,t,n){return null==e?void 0:null==t||n?e[0]:r.call(e,0,t)},k.initial=function(e,t,n){return r.call(e,0,e.length-(null==t||n?1:t))},k.last=function(e,t,n){return null==e?void 0:null==t||n?e[e.length-1]:r.call(e,Math.max(e.length-t,0))},k.rest=k.tail=k.drop=function(e,t,n){return r.call(e,null==t||n?1:t)},k.compact=function(e){return k.filter(e,k.identity)};var A=function(e,t,n){return C(e,function(e){k.isArray(e)?t?s.apply(n,e):A(e,t,n):n.push(e)}),n};k.flatten=function(e,t){return A(e,t,[])},k.without=function(e){return k.difference(e,r.call(arguments,1))},k.uniq=k.unique=function(e,t,n,i){k.isFunction(t)&&(i=n,n=t,t=!1);var o=n?k.map(e,n,i):e,a=[],s=[];return C(o,function(n,i){(t?i&&s[s.length-1]===n:k.contains(s,n))||(s.push(n),a.push(e[i]))}),a},k.union=function(){return k.uniq(l.apply(i,arguments))},k.intersection=function(e){var t=r.call(arguments,1);return k.filter(k.uniq(e),function(e){return k.every(t,function(t){return k.indexOf(t,e)>=0})})},k.difference=function(e){var t=l.apply(i,r.call(arguments,1));return k.filter(e,function(e){return!k.contains(t,e)})},k.zip=function(){for(var e=r.call(arguments),t=k.max(k.pluck(e,"length")),n=Array(t),i=0;t>i;i++)n[i]=k.pluck(e,""+i);return n},k.object=function(e,t){if(null==e)return{};for(var n={},i=0,o=e.length;o>i;i++)t?n[e[i]]=t[i]:n[e[i][0]]=e[i][1];return n},k.indexOf=function(e,t,n){if(null==e)return-1;var i=0,o=e.length;if(n){if("number"!=typeof n)return i=k.sortedIndex(e,t),e[i]===t?i:-1;i=0>n?Math.max(0,o+n):n}if(v&&e.indexOf===v)return e.indexOf(t,n);for(;o>i;i++)if(e[i]===t)return i;return-1},k.lastIndexOf=function(e,t,n){if(null==e)return-1;var i=null!=n;if(y&&e.lastIndexOf===y)return i?e.lastIndexOf(t,n):e.lastIndexOf(t);for(var o=i?n:e.length;o--;)if(e[o]===t)return o;return-1},k.range=function(e,t,n){1>=arguments.length&&(t=e||0,e=0),n=arguments[2]||1;for(var i=Math.max(Math.ceil((t-e)/n),0),o=0,a=Array(i);i>o;)a[o++]=e,e+=n;return a},k.bind=function(e,t){if(e.bind===x&&x)return x.apply(e,r.call(arguments,1));var n=r.call(arguments,2);return function(){return e.apply(t,n.concat(r.call(arguments)))}},k.partial=function(e){var t=r.call(arguments,1);return function(){return e.apply(this,t.concat(r.call(arguments)))}},k.bindAll=function(e){var t=r.call(arguments,1);return 0===t.length&&(t=k.functions(e)),C(t,function(t){e[t]=k.bind(e[t],e)}),e},k.memoize=function(e,t){var n={};return t||(t=k.identity),function(){var i=t.apply(this,arguments);return k.has(n,i)?n[i]:n[i]=e.apply(this,arguments)}},k.delay=function(e,t){var n=r.call(arguments,2);return setTimeout(function(){return e.apply(null,n)},t)},k.defer=function(e){return k.delay.apply(k,[e,1].concat(r.call(arguments,1)))},k.throttle=function(e,t){var n,i,o,a,s=0,r=function(){s=new Date,o=null,a=e.apply(n,i)};return function(){var l=new Date,c=t-(l-s);return n=this,i=arguments,0>=c?(clearTimeout(o),o=null,s=l,a=e.apply(n,i)):o||(o=setTimeout(r,c)),a}},k.debounce=function(e,t,n){var i,o;return function(){var a=this,s=arguments,r=function(){i=null,n||(o=e.apply(a,s))},l=n&&!i;return clearTimeout(i),i=setTimeout(r,t),l&&(o=e.apply(a,s)),o}},k.once=function(e){var t,n=!1;return function(){return n?t:(n=!0,t=e.apply(this,arguments),e=null,t)}},k.wrap=function(e,t){return function(){var n=[e];return s.apply(n,arguments),t.apply(this,n)}},k.compose=function(){var e=arguments;return function(){for(var t=arguments,n=e.length-1;n>=0;n--)t=[e[n].apply(this,t)];return t[0]}},k.after=function(e,t){return 0>=e?t():function(){return 1>--e?t.apply(this,arguments):void 0}},k.keys=b||function(e){if(e!==Object(e))throw new TypeError("Invalid object");var t=[];for(var n in e)k.has(e,n)&&(t[t.length]=n);return t},k.values=function(e){var t=[];for(var n in e)k.has(e,n)&&t.push(e[n]);return t},k.pairs=function(e){var t=[];for(var n in e)k.has(e,n)&&t.push([n,e[n]]);return t},k.invert=function(e){var t={};for(var n in e)k.has(e,n)&&(t[e[n]]=n);return t},k.functions=k.methods=function(e){var t=[];for(var n in e)k.isFunction(e[n])&&t.push(n);return t.sort()},k.extend=function(e){return C(r.call(arguments,1),function(t){if(t)for(var n in t)e[n]=t[n]}),e},k.pick=function(e){var t={},n=l.apply(i,r.call(arguments,1));return C(n,function(n){n in e&&(t[n]=e[n])}),t},k.omit=function(e){var t={},n=l.apply(i,r.call(arguments,1));for(var o in e)k.contains(n,o)||(t[o]=e[o]);return t},k.defaults=function(e){return C(r.call(arguments,1),function(t){if(t)for(var n in t)null==e[n]&&(e[n]=t[n])}),e},k.clone=function(e){return k.isObject(e)?k.isArray(e)?e.slice():k.extend({},e):e},k.tap=function(e,t){return t(e),e};var I=function(e,t,n,i){if(e===t)return 0!==e||1/e==1/t;if(null==e||null==t)return e===t;e instanceof k&&(e=e._wrapped),t instanceof k&&(t=t._wrapped);var o=c.call(e);if(o!=c.call(t))return!1;switch(o){case"[object String]":return e==t+"";case"[object Number]":return e!=+e?t!=+t:0==e?1/e==1/t:e==+t;case"[object Date]":case"[object Boolean]":return+e==+t;case"[object RegExp]":return e.source==t.source&&e.global==t.global&&e.multiline==t.multiline&&e.ignoreCase==t.ignoreCase}if("object"!=typeof e||"object"!=typeof t)return!1;for(var a=n.length;a--;)if(n[a]==e)return i[a]==t;n.push(e),i.push(t);var s=0,r=!0;if("[object Array]"==o){if(s=e.length,r=s==t.length)for(;s--&&(r=I(e[s],t[s],n,i)););}else{var l=e.constructor,u=t.constructor;if(l!==u&&!(k.isFunction(l)&&l instanceof l&&k.isFunction(u)&&u instanceof u))return!1;for(var h in e)if(k.has(e,h)&&(s++,!(r=k.has(t,h)&&I(e[h],t[h],n,i))))break;if(r){for(h in t)if(k.has(t,h)&&!s--)break;r=!s}}return n.pop(),i.pop(),r};k.isEqual=function(e,t){return I(e,t,[],[])},k.isEmpty=function(e){if(null==e)return!0;if(k.isArray(e)||k.isString(e))return 0===e.length;for(var t in e)if(k.has(e,t))return!1;return!0},k.isElement=function(e){return!(!e||1!==e.nodeType)},k.isArray=w||function(e){return"[object Array]"==c.call(e)},k.isObject=function(e){return e===Object(e)},C(["Arguments","Function","String","Number","Date","RegExp"],function(e){k["is"+e]=function(t){return c.call(t)=="[object "+e+"]"}}),k.isArguments(arguments)||(k.isArguments=function(e){return!(!e||!k.has(e,"callee"))}),k.isFunction=function(e){return"function"==typeof e},k.isFinite=function(e){return isFinite(e)&&!isNaN(parseFloat(e))},k.isNaN=function(e){return k.isNumber(e)&&e!=+e},k.isBoolean=function(e){return e===!0||e===!1||"[object Boolean]"==c.call(e)},k.isNull=function(e){return null===e},k.isUndefined=function(e){return void 0===e},k.has=function(e,t){return u.call(e,t)},k.noConflict=function(){return e._=t,this},k.identity=function(e){return e},k.times=function(e,t,n){for(var i=Array(e),o=0;e>o;o++)i[o]=t.call(n,o);return i},k.random=function(e,t){return null==t&&(t=e,e=0),e+Math.floor(Math.random()*(t-e+1))};var $={escape:{"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;","/":"&#x2F;"}};$.unescape=k.invert($.escape);var N={escape:RegExp("["+k.keys($.escape).join("")+"]","g"),unescape:RegExp("("+k.keys($.unescape).join("|")+")","g")};k.each(["escape","unescape"],function(e){k[e]=function(t){return null==t?"":(""+t).replace(N[e],function(t){return $[e][t]})}}),k.result=function(e,t){if(null==e)return null;var n=e[t];return k.isFunction(n)?n.call(e):n},k.mixin=function(e){C(k.functions(e),function(t){var n=k[t]=e[t];k.prototype[t]=function(){var e=[this._wrapped];return s.apply(e,arguments),D.call(this,n.apply(k,e))}})};var M=0;k.uniqueId=function(e){var t=++M+"";return e?e+t:t},k.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var R=/(.)^/,j={"'":"'","\\":"\\","\r":"r","\n":"n"," ":"t","\u2028":"u2028","\u2029":"u2029"},O=/\\|'|\r|\n|\t|\u2028|\u2029/g;k.template=function(e,t,n){var i;n=k.defaults({},n,k.templateSettings);var o=RegExp([(n.escape||R).source,(n.interpolate||R).source,(n.evaluate||R).source].join("|")+"|$","g"),a=0,s="__p+='";e.replace(o,function(t,n,i,o,r){return s+=e.slice(a,r).replace(O,function(e){return"\\"+j[e]}),n&&(s+="'+\n((__t=("+n+"))==null?'':_.escape(__t))+\n'"),i&&(s+="'+\n((__t=("+i+"))==null?'':__t)+\n'"),o&&(s+="';\n"+o+"\n__p+='"),a=r+t.length,t}),s+="';\n",n.variable||(s="with(obj||{}){\n"+s+"}\n"),s="var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');};\n"+s+"return __p;\n";try{i=Function(n.variable||"obj","_",s)}catch(r){throw r.source=s,r}if(t)return i(t,k);var l=function(e){return i.call(this,e,k)};return l.source="function("+(n.variable||"obj")+"){\n"+s+"}",l},k.chain=function(e){return k(e).chain()};var D=function(e){return this._chain?k(e).chain():e};k.mixin(k),C(["pop","push","reverse","shift","sort","splice","unshift"],function(e){var t=i[e];k.prototype[e]=function(){var n=this._wrapped;return t.apply(n,arguments),"shift"!=e&&"splice"!=e||0!==n.length||delete n[0],D.call(this,n)}}),C(["concat","join","slice"],function(e){var t=i[e];k.prototype[e]=function(){return D.call(this,t.apply(this._wrapped,arguments))}}),k.extend(k.prototype,{chain:function(){return this._chain=!0,this},value:function(){return this._wrapped}})}.call(this),define("underscore",function(e){return function(){var t;return t||e._}}(this)),function(){var e,t=this,n=t.Backbone,i=[],o=i.push,a=i.slice,s=i.splice;e="undefined"!=typeof exports?exports:t.Backbone={},e.VERSION="1.0.0";var r=t._;r||void 0===require||(r=require("underscore")),e.$=t.jQuery||t.Zepto||t.ender||t.$,e.noConflict=function(){return t.Backbone=n,this},e.emulateHTTP=!1,e.emulateJSON=!1;var l=e.Events={on:function(e,t,n){if(!u(this,"on",e,[t,n])||!t)return this;this._events||(this._events={});var i=this._events[e]||(this._events[e]=[]);return i.push({callback:t,context:n,ctx:n||this}),this},once:function(e,t,n){if(!u(this,"once",e,[t,n])||!t)return this;var i=this,o=r.once(function(){i.off(e,o),t.apply(this,arguments)});return o._callback=t,this.on(e,o,n)},off:function(e,t,n){var i,o,a,s,l,c,h,d;if(!this._events||!u(this,"off",e,[t,n]))return this;if(!e&&!t&&!n)return this._events={},this;for(s=e?[e]:r.keys(this._events),l=0,c=s.length;c>l;l++)if(e=s[l],a=this._events[e]){if(this._events[e]=i=[],t||n)for(h=0,d=a.length;d>h;h++)o=a[h],(t&&t!==o.callback&&t!==o.callback._callback||n&&n!==o.context)&&i.push(o);i.length||delete this._events[e]}return this},trigger:function(e){if(!this._events)return this;var t=a.call(arguments,1);if(!u(this,"trigger",e,t))return this;var n=this._events[e],i=this._events.all;return n&&h(n,t),i&&h(i,arguments),this},stopListening:function(e,t,n){var i=this._listeners;if(!i)return this;var o=!t&&!n;"object"==typeof t&&(n=this),e&&((i={})[e._listenerId]=e);for(var a in i)i[a].off(t,n,this),o&&delete this._listeners[a];return this}},c=/\s+/,u=function(e,t,n,i){if(!n)return!0;if("object"==typeof n){for(var o in n)e[t].apply(e,[o,n[o]].concat(i));return!1}if(c.test(n)){for(var a=n.split(c),s=0,r=a.length;r>s;s++)e[t].apply(e,[a[s]].concat(i));return!1}return!0},h=function(e,t){var n,i=-1,o=e.length,a=t[0],s=t[1],r=t[2];switch(t.length){case 0:for(;o>++i;)(n=e[i]).callback.call(n.ctx);return;case 1:for(;o>++i;)(n=e[i]).callback.call(n.ctx,a);return;case 2:for(;o>++i;)(n=e[i]).callback.call(n.ctx,a,s);return;case 3:for(;o>++i;)(n=e[i]).callback.call(n.ctx,a,s,r);return;default:for(;o>++i;)(n=e[i]).callback.apply(n.ctx,t)}},d={listenTo:"on",listenToOnce:"once"};r.each(d,function(e,t){l[t]=function(t,n,i){var o=this._listeners||(this._listeners={}),a=t._listenerId||(t._listenerId=r.uniqueId("l"));return o[a]=t,"object"==typeof n&&(i=this),t[e](n,i,this),this}}),l.bind=l.on,l.unbind=l.off,r.extend(e,l);var p=e.Model=function(e,t){var n,i=e||{};t||(t={}),this.cid=r.uniqueId("c"),this.attributes={},r.extend(this,r.pick(t,f)),t.parse&&(i=this.parse(i,t)||{}),(n=r.result(this,"defaults"))&&(i=r.defaults({},i,n)),this.set(i,t),this.changed={},this.initialize.apply(this,arguments)
},f=["url","urlRoot","collection"];r.extend(p.prototype,l,{changed:null,validationError:null,idAttribute:"id",initialize:function(){},toJSON:function(){return r.clone(this.attributes)},sync:function(){return e.sync.apply(this,arguments)},get:function(e){return this.attributes[e]},escape:function(e){return r.escape(this.get(e))},has:function(e){return null!=this.get(e)},set:function(e,t,n){var i,o,a,s,l,c,u,h;if(null==e)return this;if("object"==typeof e?(o=e,n=t):(o={})[e]=t,n||(n={}),!this._validate(o,n))return!1;a=n.unset,l=n.silent,s=[],c=this._changing,this._changing=!0,c||(this._previousAttributes=r.clone(this.attributes),this.changed={}),h=this.attributes,u=this._previousAttributes,this.idAttribute in o&&(this.id=o[this.idAttribute]);for(i in o)t=o[i],r.isEqual(h[i],t)||s.push(i),r.isEqual(u[i],t)?delete this.changed[i]:this.changed[i]=t,a?delete h[i]:h[i]=t;if(!l){s.length&&(this._pending=!0);for(var d=0,p=s.length;p>d;d++)this.trigger("change:"+s[d],this,h[s[d]],n)}if(c)return this;if(!l)for(;this._pending;)this._pending=!1,this.trigger("change",this,n);return this._pending=!1,this._changing=!1,this},unset:function(e,t){return this.set(e,void 0,r.extend({},t,{unset:!0}))},clear:function(e){var t={};for(var n in this.attributes)t[n]=void 0;return this.set(t,r.extend({},e,{unset:!0}))},hasChanged:function(e){return null==e?!r.isEmpty(this.changed):r.has(this.changed,e)},changedAttributes:function(e){if(!e)return this.hasChanged()?r.clone(this.changed):!1;var t,n=!1,i=this._changing?this._previousAttributes:this.attributes;for(var o in e)r.isEqual(i[o],t=e[o])||((n||(n={}))[o]=t);return n},previous:function(e){return null!=e&&this._previousAttributes?this._previousAttributes[e]:null},previousAttributes:function(){return r.clone(this._previousAttributes)},fetch:function(e){e=e?r.clone(e):{},void 0===e.parse&&(e.parse=!0);var t=this,n=e.success;return e.success=function(i){return t.set(t.parse(i,e),e)?(n&&n(t,i,e),t.trigger("sync",t,i,e),void 0):!1},D(this,e),this.sync("read",this,e)},save:function(e,t,n){var i,o,a,s=this.attributes;if(null==e||"object"==typeof e?(i=e,n=t):(i={})[e]=t,!(!i||n&&n.wait||this.set(i,n)))return!1;if(n=r.extend({validate:!0},n),!this._validate(i,n))return!1;i&&n.wait&&(this.attributes=r.extend({},s,i)),void 0===n.parse&&(n.parse=!0);var l=this,c=n.success;return n.success=function(e){l.attributes=s;var t=l.parse(e,n);return n.wait&&(t=r.extend(i||{},t)),r.isObject(t)&&!l.set(t,n)?!1:(c&&c(l,e,n),l.trigger("sync",l,e,n),void 0)},D(this,n),o=this.isNew()?"create":n.patch?"patch":"update","patch"===o&&(n.attrs=i),a=this.sync(o,this,n),i&&n.wait&&(this.attributes=s),a},destroy:function(e){e=e?r.clone(e):{};var t=this,n=e.success,i=function(){t.trigger("destroy",t,t.collection,e)};if(e.success=function(o){(e.wait||t.isNew())&&i(),n&&n(t,o,e),t.isNew()||t.trigger("sync",t,o,e)},this.isNew())return e.success(),!1;D(this,e);var o=this.sync("delete",this,e);return e.wait||i(),o},url:function(){var e=r.result(this,"urlRoot")||r.result(this.collection,"url")||O();return this.isNew()?e:e+("/"===e.charAt(e.length-1)?"":"/")+encodeURIComponent(this.id)},parse:function(e){return e},clone:function(){return new this.constructor(this.attributes)},isNew:function(){return null==this.id},isValid:function(e){return this._validate({},r.extend(e||{},{validate:!0}))},_validate:function(e,t){if(!t.validate||!this.validate)return!0;e=r.extend({},this.attributes,e);var n=this.validationError=this.validate(e,t)||null;return n?(this.trigger("invalid",this,n,r.extend(t||{},{validationError:n})),!1):!0}});var m=["keys","values","pairs","invert","pick","omit"];r.each(m,function(e){p.prototype[e]=function(){var t=a.call(arguments);return t.unshift(this.attributes),r[e].apply(r,t)}});var g=e.Collection=function(e,t){t||(t={}),t.url&&(this.url=t.url),t.model&&(this.model=t.model),void 0!==t.comparator&&(this.comparator=t.comparator),this._reset(),this.initialize.apply(this,arguments),e&&this.reset(e,r.extend({silent:!0},t))},_={add:!0,remove:!0,merge:!0},v={add:!0,merge:!1,remove:!1};r.extend(g.prototype,l,{model:p,initialize:function(){},toJSON:function(e){return this.map(function(t){return t.toJSON(e)})},sync:function(){return e.sync.apply(this,arguments)},add:function(e,t){return this.set(e,r.defaults(t||{},v))},remove:function(e,t){e=r.isArray(e)?e.slice():[e],t||(t={});var n,i,o,a;for(n=0,i=e.length;i>n;n++)a=this.get(e[n]),a&&(delete this._byId[a.id],delete this._byId[a.cid],o=this.indexOf(a),this.models.splice(o,1),this.length--,t.silent||(t.index=o,a.trigger("remove",a,this,t)),this._removeReference(a));return this},set:function(e,t){t=r.defaults(t||{},_),t.parse&&(e=this.parse(e,t)),r.isArray(e)||(e=e?[e]:[]);var n,i,a,l,c,u=t.at,h=this.comparator&&null==u&&t.sort!==!1,d=r.isString(this.comparator)?this.comparator:null,p=[],f=[],m={};for(n=0,i=e.length;i>n;n++)(a=this._prepareModel(e[n],t))&&((l=this.get(a))?(t.remove&&(m[l.cid]=!0),t.merge&&(l.set(a.attributes,t),h&&!c&&l.hasChanged(d)&&(c=!0))):t.add&&(p.push(a),a.on("all",this._onModelEvent,this),this._byId[a.cid]=a,null!=a.id&&(this._byId[a.id]=a)));if(t.remove){for(n=0,i=this.length;i>n;++n)m[(a=this.models[n]).cid]||f.push(a);f.length&&this.remove(f,t)}if(p.length&&(h&&(c=!0),this.length+=p.length,null!=u?s.apply(this.models,[u,0].concat(p)):o.apply(this.models,p)),c&&this.sort({silent:!0}),t.silent)return this;for(n=0,i=p.length;i>n;n++)(a=p[n]).trigger("add",a,this,t);return c&&this.trigger("sort",this,t),this},reset:function(e,t){t||(t={});for(var n=0,i=this.models.length;i>n;n++)this._removeReference(this.models[n]);return t.previousModels=this.models,this._reset(),this.add(e,r.extend({silent:!0},t)),t.silent||this.trigger("reset",this,t),this},push:function(e,t){return e=this._prepareModel(e,t),this.add(e,r.extend({at:this.length},t)),e},pop:function(e){var t=this.at(this.length-1);return this.remove(t,e),t},unshift:function(e,t){return e=this._prepareModel(e,t),this.add(e,r.extend({at:0},t)),e},shift:function(e){var t=this.at(0);return this.remove(t,e),t},slice:function(e,t){return this.models.slice(e,t)},get:function(e){return null==e?void 0:this._byId[null!=e.id?e.id:e.cid||e]},at:function(e){return this.models[e]},where:function(e,t){return r.isEmpty(e)?t?void 0:[]:this[t?"find":"filter"](function(t){for(var n in e)if(e[n]!==t.get(n))return!1;return!0})},findWhere:function(e){return this.where(e,!0)},sort:function(e){if(!this.comparator)throw Error("Cannot sort a set without a comparator");return e||(e={}),r.isString(this.comparator)||1===this.comparator.length?this.models=this.sortBy(this.comparator,this):this.models.sort(r.bind(this.comparator,this)),e.silent||this.trigger("sort",this,e),this},sortedIndex:function(e,t,n){t||(t=this.comparator);var i=r.isFunction(t)?t:function(e){return e.get(t)};return r.sortedIndex(this.models,e,i,n)},pluck:function(e){return r.invoke(this.models,"get",e)},fetch:function(e){e=e?r.clone(e):{},void 0===e.parse&&(e.parse=!0);var t=e.success,n=this;return e.success=function(i){var o=e.reset?"reset":"set";n[o](i,e),t&&t(n,i,e),n.trigger("sync",n,i,e)},D(this,e),this.sync("read",this,e)},create:function(e,t){if(t=t?r.clone(t):{},!(e=this._prepareModel(e,t)))return!1;t.wait||this.add(e,t);var n=this,i=t.success;return t.success=function(o){t.wait&&n.add(e,t),i&&i(e,o,t)},e.save(null,t),e},parse:function(e){return e},clone:function(){return new this.constructor(this.models)},_reset:function(){this.length=0,this.models=[],this._byId={}},_prepareModel:function(e,t){if(e instanceof p)return e.collection||(e.collection=this),e;t||(t={}),t.collection=this;var n=new this.model(e,t);return n._validate(e,t)?n:(this.trigger("invalid",this,e,t),!1)},_removeReference:function(e){this===e.collection&&delete e.collection,e.off("all",this._onModelEvent,this)},_onModelEvent:function(e,t,n,i){("add"!==e&&"remove"!==e||n===this)&&("destroy"===e&&this.remove(t,i),t&&e==="change:"+t.idAttribute&&(delete this._byId[t.previous(t.idAttribute)],null!=t.id&&(this._byId[t.id]=t)),this.trigger.apply(this,arguments))}});var y=["forEach","each","map","collect","reduce","foldl","inject","reduceRight","foldr","find","detect","filter","select","reject","every","all","some","any","include","contains","invoke","max","min","toArray","size","first","head","take","initial","rest","tail","drop","last","without","indexOf","shuffle","lastIndexOf","isEmpty","chain"];r.each(y,function(e){g.prototype[e]=function(){var t=a.call(arguments);return t.unshift(this.models),r[e].apply(r,t)}});var w=["groupBy","countBy","sortBy"];r.each(w,function(e){g.prototype[e]=function(t,n){var i=r.isFunction(t)?t:function(e){return e.get(t)};return r[e](this.models,i,n)}});var b=e.View=function(e){this.cid=r.uniqueId("view"),this._configure(e||{}),this._ensureElement(),this.initialize.apply(this,arguments),this.delegateEvents()},x=/^(\S+)\s*(.*)$/,k=["model","collection","el","id","attributes","className","tagName","events"];r.extend(b.prototype,l,{tagName:"div",$:function(e){return this.$el.find(e)},initialize:function(){},render:function(){return this},remove:function(){return this.$el.remove(),this.stopListening(),this},setElement:function(t,n){return this.$el&&this.undelegateEvents(),this.$el=t instanceof e.$?t:e.$(t),this.el=this.$el[0],n!==!1&&this.delegateEvents(),this},delegateEvents:function(e){if(!e&&!(e=r.result(this,"events")))return this;this.undelegateEvents();for(var t in e){var n=e[t];if(r.isFunction(n)||(n=this[e[t]]),n){var i=t.match(x),o=i[1],a=i[2];n=r.bind(n,this),o+=".delegateEvents"+this.cid,""===a?this.$el.on(o,n):this.$el.on(o,a,n)}}return this},undelegateEvents:function(){return this.$el.off(".delegateEvents"+this.cid),this},_configure:function(e){this.options&&(e=r.extend({},r.result(this,"options"),e)),r.extend(this,r.pick(e,k)),this.options=e},_ensureElement:function(){if(this.el)this.setElement(r.result(this,"el"),!1);else{var t=r.extend({},r.result(this,"attributes"));this.id&&(t.id=r.result(this,"id")),this.className&&(t["class"]=r.result(this,"className"));var n=e.$("<"+r.result(this,"tagName")+">").attr(t);this.setElement(n,!1)}}}),e.sync=function(t,n,i){var o=C[t];r.defaults(i||(i={}),{emulateHTTP:e.emulateHTTP,emulateJSON:e.emulateJSON});var a={type:o,dataType:"json"};if(i.url||(a.url=r.result(n,"url")||O()),null!=i.data||!n||"create"!==t&&"update"!==t&&"patch"!==t||(a.contentType="application/json",a.data=JSON.stringify(i.attrs||n.toJSON(i))),i.emulateJSON&&(a.contentType="application/x-www-form-urlencoded",a.data=a.data?{model:a.data}:{}),i.emulateHTTP&&("PUT"===o||"DELETE"===o||"PATCH"===o)){a.type="POST",i.emulateJSON&&(a.data._method=o);var s=i.beforeSend;i.beforeSend=function(e){return e.setRequestHeader("X-HTTP-Method-Override",o),s?s.apply(this,arguments):void 0}}"GET"===a.type||i.emulateJSON||(a.processData=!1),"PATCH"!==a.type||!window.ActiveXObject||window.external&&window.external.msActiveXFilteringEnabled||(a.xhr=function(){return new ActiveXObject("Microsoft.XMLHTTP")});var l=i.xhr=e.ajax(r.extend(a,i));return n.trigger("request",n,l,i),l};var C={create:"POST",update:"PUT",patch:"PATCH","delete":"DELETE",read:"GET"};e.ajax=function(){return e.$.ajax.apply(e.$,arguments)};var E=e.Router=function(e){e||(e={}),e.routes&&(this.routes=e.routes),this._bindRoutes(),this.initialize.apply(this,arguments)},T=/\((.*?)\)/g,S=/(\(\?)?:\w+/g,P=/\*\w+/g,A=/[\-{}\[\]+?.,\\\^$|#\s]/g;r.extend(E.prototype,l,{initialize:function(){},route:function(t,n,i){r.isRegExp(t)||(t=this._routeToRegExp(t)),r.isFunction(n)&&(i=n,n=""),i||(i=this[n]);var o=this;return e.history.route(t,function(a){var s=o._extractParameters(t,a);i&&i.apply(o,s),o.trigger.apply(o,["route:"+n].concat(s)),o.trigger("route",n,s),e.history.trigger("route",o,n,s)}),this},navigate:function(t,n){return e.history.navigate(t,n),this},_bindRoutes:function(){if(this.routes){this.routes=r.result(this,"routes");for(var e,t=r.keys(this.routes);null!=(e=t.pop());)this.route(e,this.routes[e])}},_routeToRegExp:function(e){return e=e.replace(A,"\\$&").replace(T,"(?:$1)?").replace(S,function(e,t){return t?e:"([^/]+)"}).replace(P,"(.*?)"),RegExp("^"+e+"$")},_extractParameters:function(e,t){var n=e.exec(t).slice(1);return r.map(n,function(e){return e?decodeURIComponent(e):null})}});var I=e.History=function(){this.handlers=[],r.bindAll(this,"checkUrl"),"undefined"!=typeof window&&(this.location=window.location,this.history=window.history)},$=/^[#\/]|\s+$/g,N=/^\/+|\/+$/g,M=/msie [\w.]+/,R=/\/$/;I.started=!1,r.extend(I.prototype,l,{interval:50,getHash:function(e){var t=(e||this).location.href.match(/#(.*)$/);return t?t[1]:""},getFragment:function(e,t){if(null==e)if(this._hasPushState||!this._wantsHashChange||t){e=this.location.pathname;var n=this.root.replace(R,"");e.indexOf(n)||(e=e.substr(n.length))}else e=this.getHash();return e.replace($,"")},start:function(t){if(I.started)throw Error("Backbone.history has already been started");I.started=!0,this.options=r.extend({},{root:"/"},this.options,t),this.root=this.options.root,this._wantsHashChange=this.options.hashChange!==!1,this._wantsPushState=!!this.options.pushState,this._hasPushState=!!(this.options.pushState&&this.history&&this.history.pushState);var n=this.getFragment(),i=document.documentMode,o=M.exec(navigator.userAgent.toLowerCase())&&(!i||7>=i);this.root=("/"+this.root+"/").replace(N,"/"),o&&this._wantsHashChange&&(this.iframe=e.$('<iframe src="javascript:0" tabindex="-1" />').hide().appendTo("body")[0].contentWindow,this.navigate(n)),this._hasPushState?e.$(window).on("popstate",this.checkUrl):this._wantsHashChange&&"onhashchange"in window&&!o?e.$(window).on("hashchange",this.checkUrl):this._wantsHashChange&&(this._checkUrlInterval=setInterval(this.checkUrl,this.interval)),this.fragment=n;var a=this.location,s=a.pathname.replace(/[^\/]$/,"$&/")===this.root;return this._wantsHashChange&&this._wantsPushState&&!this._hasPushState&&!s?(this.fragment=this.getFragment(null,!0),this.location.replace(this.root+this.location.search+"#"+this.fragment),!0):(this._wantsPushState&&this._hasPushState&&s&&a.hash&&(this.fragment=this.getHash().replace($,""),this.history.replaceState({},document.title,this.root+this.fragment+a.search)),this.options.silent?void 0:this.loadUrl())},stop:function(){e.$(window).off("popstate",this.checkUrl).off("hashchange",this.checkUrl),clearInterval(this._checkUrlInterval),I.started=!1},route:function(e,t){this.handlers.unshift({route:e,callback:t})},checkUrl:function(){var e=this.getFragment();return e===this.fragment&&this.iframe&&(e=this.getFragment(this.getHash(this.iframe))),e===this.fragment?!1:(this.iframe&&this.navigate(e),this.loadUrl()||this.loadUrl(this.getHash()),void 0)},loadUrl:function(e){var t=this.fragment=this.getFragment(e),n=r.any(this.handlers,function(e){return e.route.test(t)?(e.callback(t),!0):void 0});return n},navigate:function(e,t){if(!I.started)return!1;if(t&&t!==!0||(t={trigger:t}),e=this.getFragment(e||""),this.fragment!==e){this.fragment=e;var n=this.root+e;if(this._hasPushState)this.history[t.replace?"replaceState":"pushState"]({},document.title,n);else{if(!this._wantsHashChange)return this.location.assign(n);this._updateHash(this.location,e,t.replace),this.iframe&&e!==this.getFragment(this.getHash(this.iframe))&&(t.replace||this.iframe.document.open().close(),this._updateHash(this.iframe.location,e,t.replace))}t.trigger&&this.loadUrl(e)}},_updateHash:function(e,t,n){if(n){var i=e.href.replace(/(javascript:|#).*$/,"");e.replace(i+"#"+t)}else e.hash="#"+t}}),e.history=new I;var j=function(e,t){var n,i=this;n=e&&r.has(e,"constructor")?e.constructor:function(){return i.apply(this,arguments)},r.extend(n,i,t);var o=function(){this.constructor=n};return o.prototype=i.prototype,n.prototype=new o,e&&r.extend(n.prototype,e),n.__super__=i.prototype,n};p.extend=g.extend=E.extend=b.extend=I.extend=j;var O=function(){throw Error('A "url" property or function must be specified')},D=function(e,t){var n=t.error;t.error=function(i){n&&n(e,i,t),e.trigger("error",e,i,t)}}}.call(this),define("bb",["underscore","jquery"],function(e){return function(){var t;return t||e.Backbone}}(this));var Handlebars={};(function(e,t){e.VERSION="1.0.0",e.COMPILER_REVISION=4,e.REVISION_CHANGES={1:"<= 1.0.rc.2",2:"== 1.0.0-rc.3",3:"== 1.0.0-rc.4",4:">= 1.0.0"},e.helpers={},e.partials={};var n=Object.prototype.toString,i="[object Function]",o="[object Object]";e.registerHelper=function(t,i,a){if(n.call(t)===o){if(a||i)throw new e.Exception("Arg not supported with multiple helpers");e.Utils.extend(this.helpers,t)}else a&&(i.not=a),this.helpers[t]=i},e.registerPartial=function(t,i){n.call(t)===o?e.Utils.extend(this.partials,t):this.partials[t]=i},e.registerHelper("helperMissing",function(e){if(2===arguments.length)return t;throw Error("Missing helper: '"+e+"'")}),e.registerHelper("blockHelperMissing",function(t,o){var a=o.inverse||function(){},s=o.fn,r=n.call(t);return r===i&&(t=t.call(this)),t===!0?s(this):t===!1||null==t?a(this):"[object Array]"===r?t.length>0?e.helpers.each(t,o):a(this):s(t)}),e.K=function(){},e.createFrame=Object.create||function(t){e.K.prototype=t;var n=new e.K;return e.K.prototype=null,n},e.logger={DEBUG:0,INFO:1,WARN:2,ERROR:3,level:3,methodMap:{0:"debug",1:"info",2:"warn",3:"error"},log:function(t,n){if(t>=e.logger.level){var i=e.logger.methodMap[t];"undefined"!=typeof console&&console[i]&&console[i].call(console,n)}}},e.log=function(t,n){e.logger.log(t,n)},e.registerHelper("each",function(t,o){var a,s=o.fn,r=o.inverse,l=0,c="",u=n.call(t);if(u===i&&(t=t.call(this)),o.data&&(a=e.createFrame(o.data)),t&&"object"==typeof t)if(t instanceof Array)for(var h=t.length;h>l;l++)a&&(a.index=l),c+=s(t[l],{data:a});else for(var d in t)t.hasOwnProperty(d)&&(a&&(a.key=d),c+=s(t[d],{data:a}),l++);return 0===l&&(c=r(this)),c}),e.registerHelper("if",function(t,o){var a=n.call(t);return a===i&&(t=t.call(this)),!t||e.Utils.isEmpty(t)?o.inverse(this):o.fn(this)}),e.registerHelper("unless",function(t,n){return e.helpers["if"].call(this,t,{fn:n.inverse,inverse:n.fn})}),e.registerHelper("with",function(o,a){var s=n.call(o);return s===i&&(o=o.call(this)),e.Utils.isEmpty(o)?t:a.fn(o)}),e.registerHelper("log",function(t,n){var i=n.data&&null!=n.data.level?parseInt(n.data.level,10):1;e.log(i,t)});var a=function(){function e(){this.yy={}}var n={trace:function(){},yy:{},symbols_:{error:2,root:3,program:4,EOF:5,simpleInverse:6,statements:7,statement:8,openInverse:9,closeBlock:10,openBlock:11,mustache:12,partial:13,CONTENT:14,COMMENT:15,OPEN_BLOCK:16,inMustache:17,CLOSE:18,OPEN_INVERSE:19,OPEN_ENDBLOCK:20,path:21,OPEN:22,OPEN_UNESCAPED:23,CLOSE_UNESCAPED:24,OPEN_PARTIAL:25,partialName:26,params:27,hash:28,dataName:29,param:30,STRING:31,INTEGER:32,BOOLEAN:33,hashSegments:34,hashSegment:35,ID:36,EQUALS:37,DATA:38,pathSegments:39,SEP:40,$accept:0,$end:1},terminals_:{2:"error",5:"EOF",14:"CONTENT",15:"COMMENT",16:"OPEN_BLOCK",18:"CLOSE",19:"OPEN_INVERSE",20:"OPEN_ENDBLOCK",22:"OPEN",23:"OPEN_UNESCAPED",24:"CLOSE_UNESCAPED",25:"OPEN_PARTIAL",31:"STRING",32:"INTEGER",33:"BOOLEAN",36:"ID",37:"EQUALS",38:"DATA",40:"SEP"},productions_:[0,[3,2],[4,2],[4,3],[4,2],[4,1],[4,1],[4,0],[7,1],[7,2],[8,3],[8,3],[8,1],[8,1],[8,1],[8,1],[11,3],[9,3],[10,3],[12,3],[12,3],[13,3],[13,4],[6,2],[17,3],[17,2],[17,2],[17,1],[17,1],[27,2],[27,1],[30,1],[30,1],[30,1],[30,1],[30,1],[28,1],[34,2],[34,1],[35,3],[35,3],[35,3],[35,3],[35,3],[26,1],[26,1],[26,1],[29,2],[21,1],[39,3],[39,1]],performAction:function(e,t,n,i,o,a){var s=a.length-1;switch(o){case 1:return a[s-1];case 2:this.$=new i.ProgramNode([],a[s]);break;case 3:this.$=new i.ProgramNode(a[s-2],a[s]);break;case 4:this.$=new i.ProgramNode(a[s-1],[]);break;case 5:this.$=new i.ProgramNode(a[s]);break;case 6:this.$=new i.ProgramNode([],[]);break;case 7:this.$=new i.ProgramNode([]);break;case 8:this.$=[a[s]];break;case 9:a[s-1].push(a[s]),this.$=a[s-1];break;case 10:this.$=new i.BlockNode(a[s-2],a[s-1].inverse,a[s-1],a[s]);break;case 11:this.$=new i.BlockNode(a[s-2],a[s-1],a[s-1].inverse,a[s]);break;case 12:this.$=a[s];break;case 13:this.$=a[s];break;case 14:this.$=new i.ContentNode(a[s]);break;case 15:this.$=new i.CommentNode(a[s]);break;case 16:this.$=new i.MustacheNode(a[s-1][0],a[s-1][1]);break;case 17:this.$=new i.MustacheNode(a[s-1][0],a[s-1][1]);break;case 18:this.$=a[s-1];break;case 19:this.$=new i.MustacheNode(a[s-1][0],a[s-1][1],"&"===a[s-2][2]);break;case 20:this.$=new i.MustacheNode(a[s-1][0],a[s-1][1],!0);break;case 21:this.$=new i.PartialNode(a[s-1]);break;case 22:this.$=new i.PartialNode(a[s-2],a[s-1]);break;case 23:break;case 24:this.$=[[a[s-2]].concat(a[s-1]),a[s]];break;case 25:this.$=[[a[s-1]].concat(a[s]),null];break;case 26:this.$=[[a[s-1]],a[s]];break;case 27:this.$=[[a[s]],null];break;case 28:this.$=[[a[s]],null];break;case 29:a[s-1].push(a[s]),this.$=a[s-1];break;case 30:this.$=[a[s]];break;case 31:this.$=a[s];break;case 32:this.$=new i.StringNode(a[s]);break;case 33:this.$=new i.IntegerNode(a[s]);break;case 34:this.$=new i.BooleanNode(a[s]);break;case 35:this.$=a[s];break;case 36:this.$=new i.HashNode(a[s]);break;case 37:a[s-1].push(a[s]),this.$=a[s-1];break;case 38:this.$=[a[s]];break;case 39:this.$=[a[s-2],a[s]];break;case 40:this.$=[a[s-2],new i.StringNode(a[s])];break;case 41:this.$=[a[s-2],new i.IntegerNode(a[s])];break;case 42:this.$=[a[s-2],new i.BooleanNode(a[s])];break;case 43:this.$=[a[s-2],a[s]];break;case 44:this.$=new i.PartialNameNode(a[s]);break;case 45:this.$=new i.PartialNameNode(new i.StringNode(a[s]));break;case 46:this.$=new i.PartialNameNode(new i.IntegerNode(a[s]));break;case 47:this.$=new i.DataNode(a[s]);break;case 48:this.$=new i.IdNode(a[s]);break;case 49:a[s-2].push({part:a[s],separator:a[s-1]}),this.$=a[s-2];break;case 50:this.$=[{part:a[s]}]}},table:[{3:1,4:2,5:[2,7],6:3,7:4,8:6,9:7,11:8,12:9,13:10,14:[1,11],15:[1,12],16:[1,13],19:[1,5],22:[1,14],23:[1,15],25:[1,16]},{1:[3]},{5:[1,17]},{5:[2,6],7:18,8:6,9:7,11:8,12:9,13:10,14:[1,11],15:[1,12],16:[1,13],19:[1,19],20:[2,6],22:[1,14],23:[1,15],25:[1,16]},{5:[2,5],6:20,8:21,9:7,11:8,12:9,13:10,14:[1,11],15:[1,12],16:[1,13],19:[1,5],20:[2,5],22:[1,14],23:[1,15],25:[1,16]},{17:23,18:[1,22],21:24,29:25,36:[1,28],38:[1,27],39:26},{5:[2,8],14:[2,8],15:[2,8],16:[2,8],19:[2,8],20:[2,8],22:[2,8],23:[2,8],25:[2,8]},{4:29,6:3,7:4,8:6,9:7,11:8,12:9,13:10,14:[1,11],15:[1,12],16:[1,13],19:[1,5],20:[2,7],22:[1,14],23:[1,15],25:[1,16]},{4:30,6:3,7:4,8:6,9:7,11:8,12:9,13:10,14:[1,11],15:[1,12],16:[1,13],19:[1,5],20:[2,7],22:[1,14],23:[1,15],25:[1,16]},{5:[2,12],14:[2,12],15:[2,12],16:[2,12],19:[2,12],20:[2,12],22:[2,12],23:[2,12],25:[2,12]},{5:[2,13],14:[2,13],15:[2,13],16:[2,13],19:[2,13],20:[2,13],22:[2,13],23:[2,13],25:[2,13]},{5:[2,14],14:[2,14],15:[2,14],16:[2,14],19:[2,14],20:[2,14],22:[2,14],23:[2,14],25:[2,14]},{5:[2,15],14:[2,15],15:[2,15],16:[2,15],19:[2,15],20:[2,15],22:[2,15],23:[2,15],25:[2,15]},{17:31,21:24,29:25,36:[1,28],38:[1,27],39:26},{17:32,21:24,29:25,36:[1,28],38:[1,27],39:26},{17:33,21:24,29:25,36:[1,28],38:[1,27],39:26},{21:35,26:34,31:[1,36],32:[1,37],36:[1,28],39:26},{1:[2,1]},{5:[2,2],8:21,9:7,11:8,12:9,13:10,14:[1,11],15:[1,12],16:[1,13],19:[1,19],20:[2,2],22:[1,14],23:[1,15],25:[1,16]},{17:23,21:24,29:25,36:[1,28],38:[1,27],39:26},{5:[2,4],7:38,8:6,9:7,11:8,12:9,13:10,14:[1,11],15:[1,12],16:[1,13],19:[1,19],20:[2,4],22:[1,14],23:[1,15],25:[1,16]},{5:[2,9],14:[2,9],15:[2,9],16:[2,9],19:[2,9],20:[2,9],22:[2,9],23:[2,9],25:[2,9]},{5:[2,23],14:[2,23],15:[2,23],16:[2,23],19:[2,23],20:[2,23],22:[2,23],23:[2,23],25:[2,23]},{18:[1,39]},{18:[2,27],21:44,24:[2,27],27:40,28:41,29:48,30:42,31:[1,45],32:[1,46],33:[1,47],34:43,35:49,36:[1,50],38:[1,27],39:26},{18:[2,28],24:[2,28]},{18:[2,48],24:[2,48],31:[2,48],32:[2,48],33:[2,48],36:[2,48],38:[2,48],40:[1,51]},{21:52,36:[1,28],39:26},{18:[2,50],24:[2,50],31:[2,50],32:[2,50],33:[2,50],36:[2,50],38:[2,50],40:[2,50]},{10:53,20:[1,54]},{10:55,20:[1,54]},{18:[1,56]},{18:[1,57]},{24:[1,58]},{18:[1,59],21:60,36:[1,28],39:26},{18:[2,44],36:[2,44]},{18:[2,45],36:[2,45]},{18:[2,46],36:[2,46]},{5:[2,3],8:21,9:7,11:8,12:9,13:10,14:[1,11],15:[1,12],16:[1,13],19:[1,19],20:[2,3],22:[1,14],23:[1,15],25:[1,16]},{14:[2,17],15:[2,17],16:[2,17],19:[2,17],20:[2,17],22:[2,17],23:[2,17],25:[2,17]},{18:[2,25],21:44,24:[2,25],28:61,29:48,30:62,31:[1,45],32:[1,46],33:[1,47],34:43,35:49,36:[1,50],38:[1,27],39:26},{18:[2,26],24:[2,26]},{18:[2,30],24:[2,30],31:[2,30],32:[2,30],33:[2,30],36:[2,30],38:[2,30]},{18:[2,36],24:[2,36],35:63,36:[1,64]},{18:[2,31],24:[2,31],31:[2,31],32:[2,31],33:[2,31],36:[2,31],38:[2,31]},{18:[2,32],24:[2,32],31:[2,32],32:[2,32],33:[2,32],36:[2,32],38:[2,32]},{18:[2,33],24:[2,33],31:[2,33],32:[2,33],33:[2,33],36:[2,33],38:[2,33]},{18:[2,34],24:[2,34],31:[2,34],32:[2,34],33:[2,34],36:[2,34],38:[2,34]},{18:[2,35],24:[2,35],31:[2,35],32:[2,35],33:[2,35],36:[2,35],38:[2,35]},{18:[2,38],24:[2,38],36:[2,38]},{18:[2,50],24:[2,50],31:[2,50],32:[2,50],33:[2,50],36:[2,50],37:[1,65],38:[2,50],40:[2,50]},{36:[1,66]},{18:[2,47],24:[2,47],31:[2,47],32:[2,47],33:[2,47],36:[2,47],38:[2,47]},{5:[2,10],14:[2,10],15:[2,10],16:[2,10],19:[2,10],20:[2,10],22:[2,10],23:[2,10],25:[2,10]},{21:67,36:[1,28],39:26},{5:[2,11],14:[2,11],15:[2,11],16:[2,11],19:[2,11],20:[2,11],22:[2,11],23:[2,11],25:[2,11]},{14:[2,16],15:[2,16],16:[2,16],19:[2,16],20:[2,16],22:[2,16],23:[2,16],25:[2,16]},{5:[2,19],14:[2,19],15:[2,19],16:[2,19],19:[2,19],20:[2,19],22:[2,19],23:[2,19],25:[2,19]},{5:[2,20],14:[2,20],15:[2,20],16:[2,20],19:[2,20],20:[2,20],22:[2,20],23:[2,20],25:[2,20]},{5:[2,21],14:[2,21],15:[2,21],16:[2,21],19:[2,21],20:[2,21],22:[2,21],23:[2,21],25:[2,21]},{18:[1,68]},{18:[2,24],24:[2,24]},{18:[2,29],24:[2,29],31:[2,29],32:[2,29],33:[2,29],36:[2,29],38:[2,29]},{18:[2,37],24:[2,37],36:[2,37]},{37:[1,65]},{21:69,29:73,31:[1,70],32:[1,71],33:[1,72],36:[1,28],38:[1,27],39:26},{18:[2,49],24:[2,49],31:[2,49],32:[2,49],33:[2,49],36:[2,49],38:[2,49],40:[2,49]},{18:[1,74]},{5:[2,22],14:[2,22],15:[2,22],16:[2,22],19:[2,22],20:[2,22],22:[2,22],23:[2,22],25:[2,22]},{18:[2,39],24:[2,39],36:[2,39]},{18:[2,40],24:[2,40],36:[2,40]},{18:[2,41],24:[2,41],36:[2,41]},{18:[2,42],24:[2,42],36:[2,42]},{18:[2,43],24:[2,43],36:[2,43]},{5:[2,18],14:[2,18],15:[2,18],16:[2,18],19:[2,18],20:[2,18],22:[2,18],23:[2,18],25:[2,18]}],defaultActions:{17:[2,1]},parseError:function(e){throw Error(e)},parse:function(e){function n(){var e;return e=i.lexer.lex()||1,"number"!=typeof e&&(e=i.symbols_[e]||e),e}var i=this,o=[0],a=[null],s=[],r=this.table,l="",c=0,u=0,h=0;this.lexer.setInput(e),this.lexer.yy=this.yy,this.yy.lexer=this.lexer,this.yy.parser=this,this.lexer.yylloc===t&&(this.lexer.yylloc={});var d=this.lexer.yylloc;s.push(d);var p=this.lexer.options&&this.lexer.options.ranges;"function"==typeof this.yy.parseError&&(this.parseError=this.yy.parseError);for(var f,m,g,_,v,y,w,b,x,k={};;){if(g=o[o.length-1],this.defaultActions[g]?_=this.defaultActions[g]:((null===f||f===t)&&(f=n()),_=r[g]&&r[g][f]),_===t||!_.length||!_[0]){var C="";if(!h){x=[];for(y in r[g])this.terminals_[y]&&y>2&&x.push("'"+this.terminals_[y]+"'");C=this.lexer.showPosition?"Parse error on line "+(c+1)+":\n"+this.lexer.showPosition()+"\nExpecting "+x.join(", ")+", got '"+(this.terminals_[f]||f)+"'":"Parse error on line "+(c+1)+": Unexpected "+(1==f?"end of input":"'"+(this.terminals_[f]||f)+"'"),this.parseError(C,{text:this.lexer.match,token:this.terminals_[f]||f,line:this.lexer.yylineno,loc:d,expected:x})}}if(_[0]instanceof Array&&_.length>1)throw Error("Parse Error: multiple actions possible at state: "+g+", token: "+f);switch(_[0]){case 1:o.push(f),a.push(this.lexer.yytext),s.push(this.lexer.yylloc),o.push(_[1]),f=null,m?(f=m,m=null):(u=this.lexer.yyleng,l=this.lexer.yytext,c=this.lexer.yylineno,d=this.lexer.yylloc,h>0&&h--);break;case 2:if(w=this.productions_[_[1]][1],k.$=a[a.length-w],k._$={first_line:s[s.length-(w||1)].first_line,last_line:s[s.length-1].last_line,first_column:s[s.length-(w||1)].first_column,last_column:s[s.length-1].last_column},p&&(k._$.range=[s[s.length-(w||1)].range[0],s[s.length-1].range[1]]),v=this.performAction.call(k,l,u,c,this.yy,_[1],a,s),v!==t)return v;w&&(o=o.slice(0,2*-1*w),a=a.slice(0,-1*w),s=s.slice(0,-1*w)),o.push(this.productions_[_[1]][0]),a.push(k.$),s.push(k._$),b=r[o[o.length-2]][o[o.length-1]],o.push(b);break;case 3:return!0}}return!0}},i=function(){var e={EOF:1,parseError:function(e,t){if(!this.yy.parser)throw Error(e);this.yy.parser.parseError(e,t)},setInput:function(e){return this._input=e,this._more=this._less=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},input:function(){var e=this._input[0];this.yytext+=e,this.yyleng++,this.offset++,this.match+=e,this.matched+=e;var t=e.match(/(?:\r\n?|\n).*/g);return t?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),e},unput:function(e){var t=e.length,n=e.split(/(?:\r\n?|\n)/g);this._input=e+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-t-1),this.offset-=t;var i=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),n.length-1&&(this.yylineno-=n.length-1);var o=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:n?(n.length===i.length?this.yylloc.first_column:0)+i[i.length-n.length].length-n[0].length:this.yylloc.first_column-t},this.options.ranges&&(this.yylloc.range=[o[0],o[0]+this.yyleng-t]),this},more:function(){return this._more=!0,this},less:function(e){this.unput(this.match.slice(e))},pastInput:function(){var e=this.matched.substr(0,this.matched.length-this.match.length);return(e.length>20?"...":"")+e.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var e=this.match;return 20>e.length&&(e+=this._input.substr(0,20-e.length)),(e.substr(0,20)+(e.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){var e=this.pastInput(),t=Array(e.length+1).join("-");return e+this.upcomingInput()+"\n"+t+"^"},next:function(){if(this.done)return this.EOF;this._input||(this.done=!0);var e,n,i,o,a;this._more||(this.yytext="",this.match="");for(var s=this._currentRules(),r=0;s.length>r&&(i=this._input.match(this.rules[s[r]]),!i||n&&!(i[0].length>n[0].length)||(n=i,o=r,this.options.flex));r++);return n?(a=n[0].match(/(?:\r\n?|\n).*/g),a&&(this.yylineno+=a.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:a?a[a.length-1].length-a[a.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+n[0].length},this.yytext+=n[0],this.match+=n[0],this.matches=n,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._input=this._input.slice(n[0].length),this.matched+=n[0],e=this.performAction.call(this,this.yy,this,s[o],this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),e?e:t):""===this._input?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+". Unrecognized text.\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},lex:function(){var e=this.next();return e!==t?e:this.lex()},begin:function(e){this.conditionStack.push(e)},popState:function(){return this.conditionStack.pop()},_currentRules:function(){return this.conditions[this.conditionStack[this.conditionStack.length-1]].rules},topState:function(){return this.conditionStack[this.conditionStack.length-2]},pushState:function(e){this.begin(e)}};return e.options={},e.performAction=function(e,t,n,i){switch(n){case 0:return t.yytext="\\",14;case 1:if("\\"!==t.yytext.slice(-1)&&this.begin("mu"),"\\"===t.yytext.slice(-1)&&(t.yytext=t.yytext.substr(0,t.yyleng-1),this.begin("emu")),t.yytext)return 14;break;case 2:return 14;
case 3:return"\\"!==t.yytext.slice(-1)&&this.popState(),"\\"===t.yytext.slice(-1)&&(t.yytext=t.yytext.substr(0,t.yyleng-1)),14;case 4:return t.yytext=t.yytext.substr(0,t.yyleng-4),this.popState(),15;case 5:return 25;case 6:return 16;case 7:return 20;case 8:return 19;case 9:return 19;case 10:return 23;case 11:return 22;case 12:this.popState(),this.begin("com");break;case 13:return t.yytext=t.yytext.substr(3,t.yyleng-5),this.popState(),15;case 14:return 22;case 15:return 37;case 16:return 36;case 17:return 36;case 18:return 40;case 19:break;case 20:return this.popState(),24;case 21:return this.popState(),18;case 22:return t.yytext=t.yytext.substr(1,t.yyleng-2).replace(/\\"/g,'"'),31;case 23:return t.yytext=t.yytext.substr(1,t.yyleng-2).replace(/\\'/g,"'"),31;case 24:return 38;case 25:return 33;case 26:return 33;case 27:return 32;case 28:return 36;case 29:return t.yytext=t.yytext.substr(1,t.yyleng-2),36;case 30:return"INVALID";case 31:return 5}},e.rules=[/^(?:\\\\(?=(\{\{)))/,/^(?:[^\x00]*?(?=(\{\{)))/,/^(?:[^\x00]+)/,/^(?:[^\x00]{2,}?(?=(\{\{|$)))/,/^(?:[\s\S]*?--\}\})/,/^(?:\{\{>)/,/^(?:\{\{#)/,/^(?:\{\{\/)/,/^(?:\{\{\^)/,/^(?:\{\{\s*else\b)/,/^(?:\{\{\{)/,/^(?:\{\{&)/,/^(?:\{\{!--)/,/^(?:\{\{![\s\S]*?\}\})/,/^(?:\{\{)/,/^(?:=)/,/^(?:\.(?=[}\/ ]))/,/^(?:\.\.)/,/^(?:[\/.])/,/^(?:\s+)/,/^(?:\}\}\})/,/^(?:\}\})/,/^(?:"(\\["]|[^"])*")/,/^(?:'(\\[']|[^'])*')/,/^(?:@)/,/^(?:true(?=[}\s]))/,/^(?:false(?=[}\s]))/,/^(?:-?[0-9]+(?=[}\s]))/,/^(?:[^\s!"#%-,\.\/;->@\[-\^`\{-~]+(?=[=}\s\/.]))/,/^(?:\[[^\]]*\])/,/^(?:.)/,/^(?:$)/],e.conditions={mu:{rules:[5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31],inclusive:!1},emu:{rules:[3],inclusive:!1},com:{rules:[4],inclusive:!1},INITIAL:{rules:[0,1,2,31],inclusive:!0}},e}();return n.lexer=i,e.prototype=n,n.Parser=e,new e}();e.Parser=a,e.parse=function(t){return t.constructor===e.AST.ProgramNode?t:(e.Parser.yy=e.AST,e.Parser.parse(t))},e.AST={},e.AST.ProgramNode=function(t,n){this.type="program",this.statements=t,n&&(this.inverse=new e.AST.ProgramNode(n))},e.AST.MustacheNode=function(e,t,n){this.type="mustache",this.escaped=!n,this.hash=t;var i=this.id=e[0],o=this.params=e.slice(1),a=this.eligibleHelper=i.isSimple;this.isHelper=a&&(o.length||t)},e.AST.PartialNode=function(e,t){this.type="partial",this.partialName=e,this.context=t},e.AST.BlockNode=function(t,n,i,o){var a=function(t,n){if(t.original!==n.original)throw new e.Exception(t.original+" doesn't match "+n.original)};a(t.id,o),this.type="block",this.mustache=t,this.program=n,this.inverse=i,this.inverse&&!this.program&&(this.isInverse=!0)},e.AST.ContentNode=function(e){this.type="content",this.string=e},e.AST.HashNode=function(e){this.type="hash",this.pairs=e},e.AST.IdNode=function(t){this.type="ID";for(var n="",i=[],o=0,a=0,s=t.length;s>a;a++){var r=t[a].part;if(n+=(t[a].separator||"")+r,".."===r||"."===r||"this"===r){if(i.length>0)throw new e.Exception("Invalid path: "+n);".."===r?o++:this.isScoped=!0}else i.push(r)}this.original=n,this.parts=i,this.string=i.join("."),this.depth=o,this.isSimple=1===t.length&&!this.isScoped&&0===o,this.stringModeValue=this.string},e.AST.PartialNameNode=function(e){this.type="PARTIAL_NAME",this.name=e.original},e.AST.DataNode=function(e){this.type="DATA",this.id=e},e.AST.StringNode=function(e){this.type="STRING",this.original=this.string=this.stringModeValue=e},e.AST.IntegerNode=function(e){this.type="INTEGER",this.original=this.integer=e,this.stringModeValue=Number(e)},e.AST.BooleanNode=function(e){this.type="BOOLEAN",this.bool=e,this.stringModeValue="true"===e},e.AST.CommentNode=function(e){this.type="comment",this.comment=e};var s=["description","fileName","lineNumber","message","name","number","stack"];e.Exception=function(){for(var e=Error.prototype.constructor.apply(this,arguments),t=0;s.length>t;t++)this[s[t]]=e[s[t]]},e.Exception.prototype=Error(),e.SafeString=function(e){this.string=e},e.SafeString.prototype.toString=function(){return""+this.string};var r={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;","`":"&#x60;"},l=/[&<>"'`]/g,c=/[&<>"'`]/,u=function(e){return r[e]||"&amp;"};e.Utils={extend:function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},escapeExpression:function(t){return t instanceof e.SafeString?""+t:null==t||t===!1?"":(t=""+t,c.test(t)?t.replace(l,u):t)},isEmpty:function(e){return e||0===e?"[object Array]"===n.call(e)&&0===e.length?!0:!1:!0}};var h=e.Compiler=function(){},d=e.JavaScriptCompiler=function(){};h.prototype={compiler:h,disassemble:function(){for(var e,t,n,i=this.opcodes,o=[],a=0,s=i.length;s>a;a++)if(e=i[a],"DECLARE"===e.opcode)o.push("DECLARE "+e.name+"="+e.value);else{t=[];for(var r=0;e.args.length>r;r++)n=e.args[r],"string"==typeof n&&(n='"'+n.replace("\n","\\n")+'"'),t.push(n);o.push(e.opcode+" "+t.join(" "))}return o.join("\n")},equals:function(e){var t=this.opcodes.length;if(e.opcodes.length!==t)return!1;for(var n=0;t>n;n++){var i=this.opcodes[n],o=e.opcodes[n];if(i.opcode!==o.opcode||i.args.length!==o.args.length)return!1;for(var a=0;i.args.length>a;a++)if(i.args[a]!==o.args[a])return!1}if(t=this.children.length,e.children.length!==t)return!1;for(n=0;t>n;n++)if(!this.children[n].equals(e.children[n]))return!1;return!0},guid:0,compile:function(e,t){this.children=[],this.depths={list:[]},this.options=t;var n=this.options.knownHelpers;if(this.options.knownHelpers={helperMissing:!0,blockHelperMissing:!0,each:!0,"if":!0,unless:!0,"with":!0,log:!0},n)for(var i in n)this.options.knownHelpers[i]=n[i];return this.program(e)},accept:function(e){return this[e.type](e)},program:function(e){var t,n=e.statements;this.opcodes=[];for(var i=0,o=n.length;o>i;i++)t=n[i],this[t.type](t);return this.isSimple=1===o,this.depths.list=this.depths.list.sort(function(e,t){return e-t}),this},compileProgram:function(e){var t,n=(new this.compiler).compile(e,this.options),i=this.guid++;this.usePartial=this.usePartial||n.usePartial,this.children[i]=n;for(var o=0,a=n.depths.list.length;a>o;o++)t=n.depths.list[o],2>t||this.addDepth(t-1);return i},block:function(e){var t=e.mustache,n=e.program,i=e.inverse;n&&(n=this.compileProgram(n)),i&&(i=this.compileProgram(i));var o=this.classifyMustache(t);"helper"===o?this.helperMustache(t,n,i):"simple"===o?(this.simpleMustache(t),this.opcode("pushProgram",n),this.opcode("pushProgram",i),this.opcode("emptyHash"),this.opcode("blockValue")):(this.ambiguousMustache(t,n,i),this.opcode("pushProgram",n),this.opcode("pushProgram",i),this.opcode("emptyHash"),this.opcode("ambiguousBlockValue")),this.opcode("append")},hash:function(e){var t,n,i=e.pairs;this.opcode("pushHash");for(var o=0,a=i.length;a>o;o++)t=i[o],n=t[1],this.options.stringParams?(n.depth&&this.addDepth(n.depth),this.opcode("getContext",n.depth||0),this.opcode("pushStringParam",n.stringModeValue,n.type)):this.accept(n),this.opcode("assignToHash",t[0]);this.opcode("popHash")},partial:function(e){var t=e.partialName;this.usePartial=!0,e.context?this.ID(e.context):this.opcode("push","depth0"),this.opcode("invokePartial",t.name),this.opcode("append")},content:function(e){this.opcode("appendContent",e.string)},mustache:function(e){var t=this.options,n=this.classifyMustache(e);"simple"===n?this.simpleMustache(e):"helper"===n?this.helperMustache(e):this.ambiguousMustache(e),e.escaped&&!t.noEscape?this.opcode("appendEscaped"):this.opcode("append")},ambiguousMustache:function(e,t,n){var i=e.id,o=i.parts[0],a=null!=t||null!=n;this.opcode("getContext",i.depth),this.opcode("pushProgram",t),this.opcode("pushProgram",n),this.opcode("invokeAmbiguous",o,a)},simpleMustache:function(e){var t=e.id;"DATA"===t.type?this.DATA(t):t.parts.length?this.ID(t):(this.addDepth(t.depth),this.opcode("getContext",t.depth),this.opcode("pushContext")),this.opcode("resolvePossibleLambda")},helperMustache:function(e,t,n){var i=this.setupFullMustacheParams(e,t,n),o=e.id.parts[0];if(this.options.knownHelpers[o])this.opcode("invokeKnownHelper",i.length,o);else{if(this.options.knownHelpersOnly)throw Error("You specified knownHelpersOnly, but used the unknown helper "+o);this.opcode("invokeHelper",i.length,o)}},ID:function(e){this.addDepth(e.depth),this.opcode("getContext",e.depth);var t=e.parts[0];t?this.opcode("lookupOnContext",e.parts[0]):this.opcode("pushContext");for(var n=1,i=e.parts.length;i>n;n++)this.opcode("lookup",e.parts[n])},DATA:function(t){if(this.options.data=!0,t.id.isScoped||t.id.depth)throw new e.Exception("Scoped data references are not supported: "+t.original);this.opcode("lookupData");for(var n=t.id.parts,i=0,o=n.length;o>i;i++)this.opcode("lookup",n[i])},STRING:function(e){this.opcode("pushString",e.string)},INTEGER:function(e){this.opcode("pushLiteral",e.integer)},BOOLEAN:function(e){this.opcode("pushLiteral",e.bool)},comment:function(){},opcode:function(e){this.opcodes.push({opcode:e,args:[].slice.call(arguments,1)})},declare:function(e,t){this.opcodes.push({opcode:"DECLARE",name:e,value:t})},addDepth:function(e){if(isNaN(e))throw Error("EWOT");0!==e&&(this.depths[e]||(this.depths[e]=!0,this.depths.list.push(e)))},classifyMustache:function(e){var t=e.isHelper,n=e.eligibleHelper,i=this.options;if(n&&!t){var o=e.id.parts[0];i.knownHelpers[o]?t=!0:i.knownHelpersOnly&&(n=!1)}return t?"helper":n?"ambiguous":"simple"},pushParams:function(e){for(var t,n=e.length;n--;)t=e[n],this.options.stringParams?(t.depth&&this.addDepth(t.depth),this.opcode("getContext",t.depth||0),this.opcode("pushStringParam",t.stringModeValue,t.type)):this[t.type](t)},setupMustacheParams:function(e){var t=e.params;return this.pushParams(t),e.hash?this.hash(e.hash):this.opcode("emptyHash"),t},setupFullMustacheParams:function(e,t,n){var i=e.params;return this.pushParams(i),this.opcode("pushProgram",t),this.opcode("pushProgram",n),e.hash?this.hash(e.hash):this.opcode("emptyHash"),i}};var p=function(e){this.value=e};d.prototype={nameLookup:function(e,t){return/^[0-9]+$/.test(t)?e+"["+t+"]":d.isValidJavaScriptVariableName(t)?e+"."+t:e+"['"+t+"']"},appendToBuffer:function(e){return this.environment.isSimple?"return "+e+";":{appendToBuffer:!0,content:e,toString:function(){return"buffer += "+e+";"}}},initializeBuffer:function(){return this.quotedString("")},namespace:"Handlebars",compile:function(t,n,i,o){this.environment=t,this.options=n||{},e.log(e.logger.DEBUG,this.environment.disassemble()+"\n\n"),this.name=this.environment.name,this.isChild=!!i,this.context=i||{programs:[],environments:[],aliases:{}},this.preamble(),this.stackSlot=0,this.stackVars=[],this.registers={list:[]},this.compileStack=[],this.inlineStack=[],this.compileChildren(t,n);var a,s=t.opcodes;for(this.i=0,_=s.length;_>this.i;this.i++)a=s[this.i],"DECLARE"===a.opcode?this[a.name]=a.value:this[a.opcode].apply(this,a.args);return this.createFunctionContext(o)},nextOpcode:function(){var e=this.environment.opcodes;return e[this.i+1]},eat:function(){this.i=this.i+1},preamble:function(){var e=[];if(this.isChild)e.push("");else{var t=this.namespace,n="helpers = this.merge(helpers, "+t+".helpers);";this.environment.usePartial&&(n=n+" partials = this.merge(partials, "+t+".partials);"),this.options.data&&(n+=" data = data || {};"),e.push(n)}this.environment.isSimple?e.push(""):e.push(", buffer = "+this.initializeBuffer()),this.lastContext=0,this.source=e},createFunctionContext:function(t){var n=this.stackVars.concat(this.registers.list);if(n.length>0&&(this.source[1]=this.source[1]+", "+n.join(", ")),!this.isChild)for(var i in this.context.aliases)this.context.aliases.hasOwnProperty(i)&&(this.source[1]=this.source[1]+", "+i+"="+this.context.aliases[i]);this.source[1]&&(this.source[1]="var "+this.source[1].substring(2)+";"),this.isChild||(this.source[1]+="\n"+this.context.programs.join("\n")+"\n"),this.environment.isSimple||this.source.push("return buffer;");for(var o=this.isChild?["depth0","data"]:["Handlebars","depth0","helpers","partials","data"],a=0,s=this.environment.depths.list.length;s>a;a++)o.push("depth"+this.environment.depths.list[a]);var r=this.mergeSource();if(!this.isChild){var l=e.COMPILER_REVISION,c=e.REVISION_CHANGES[l];r="this.compilerInfo = ["+l+",'"+c+"'];\n"+r}if(t)return o.push(r),Function.apply(this,o);var u="function "+(this.name||"")+"("+o.join(",")+") {\n "+r+"}";return e.log(e.logger.DEBUG,u+"\n\n"),u},mergeSource:function(){for(var e,n="",i=0,o=this.source.length;o>i;i++){var a=this.source[i];a.appendToBuffer?e=e?e+"\n + "+a.content:a.content:(e&&(n+="buffer += "+e+";\n ",e=t),n+=a+"\n ")}return n},blockValue:function(){this.context.aliases.blockHelperMissing="helpers.blockHelperMissing";var e=["depth0"];this.setupParams(0,e),this.replaceStack(function(t){return e.splice(1,0,t),"blockHelperMissing.call("+e.join(", ")+")"})},ambiguousBlockValue:function(){this.context.aliases.blockHelperMissing="helpers.blockHelperMissing";var e=["depth0"];this.setupParams(0,e);var t=this.topStack();e.splice(1,0,t),e[e.length-1]="options",this.source.push("if (!"+this.lastHelper+") { "+t+" = blockHelperMissing.call("+e.join(", ")+"); }")},appendContent:function(e){this.source.push(this.appendToBuffer(this.quotedString(e)))},append:function(){this.flushInline();var e=this.popStack();this.source.push("if("+e+" || "+e+" === 0) { "+this.appendToBuffer(e)+" }"),this.environment.isSimple&&this.source.push("else { "+this.appendToBuffer("''")+" }")},appendEscaped:function(){this.context.aliases.escapeExpression="this.escapeExpression",this.source.push(this.appendToBuffer("escapeExpression("+this.popStack()+")"))},getContext:function(e){this.lastContext!==e&&(this.lastContext=e)},lookupOnContext:function(e){this.push(this.nameLookup("depth"+this.lastContext,e,"context"))},pushContext:function(){this.pushStackLiteral("depth"+this.lastContext)},resolvePossibleLambda:function(){this.context.aliases.functionType='"function"',this.replaceStack(function(e){return"typeof "+e+" === functionType ? "+e+".apply(depth0) : "+e})},lookup:function(e){this.replaceStack(function(t){return t+" == null || "+t+" === false ? "+t+" : "+this.nameLookup(t,e,"context")})},lookupData:function(){this.push("data")},pushStringParam:function(e,t){this.pushStackLiteral("depth"+this.lastContext),this.pushString(t),"string"==typeof e?this.pushString(e):this.pushStackLiteral(e)},emptyHash:function(){this.pushStackLiteral("{}"),this.options.stringParams&&(this.register("hashTypes","{}"),this.register("hashContexts","{}"))},pushHash:function(){this.hash={values:[],types:[],contexts:[]}},popHash:function(){var e=this.hash;this.hash=t,this.options.stringParams&&(this.register("hashContexts","{"+e.contexts.join(",")+"}"),this.register("hashTypes","{"+e.types.join(",")+"}")),this.push("{\n "+e.values.join(",\n ")+"\n }")},pushString:function(e){this.pushStackLiteral(this.quotedString(e))},push:function(e){return this.inlineStack.push(e),e},pushLiteral:function(e){this.pushStackLiteral(e)},pushProgram:function(e){null!=e?this.pushStackLiteral(this.programExpression(e)):this.pushStackLiteral(null)},invokeHelper:function(e,t){this.context.aliases.helperMissing="helpers.helperMissing";var n=this.lastHelper=this.setupHelper(e,t,!0),i=this.nameLookup("depth"+this.lastContext,t,"context");this.push(n.name+" || "+i),this.replaceStack(function(e){return e+" ? "+e+".call("+n.callParams+") "+": helperMissing.call("+n.helperMissingParams+")"})},invokeKnownHelper:function(e,t){var n=this.setupHelper(e,t);this.push(n.name+".call("+n.callParams+")")},invokeAmbiguous:function(e,t){this.context.aliases.functionType='"function"',this.pushStackLiteral("{}");var n=this.setupHelper(0,e,t),i=this.lastHelper=this.nameLookup("helpers",e,"helper"),o=this.nameLookup("depth"+this.lastContext,e,"context"),a=this.nextStack();this.source.push("if ("+a+" = "+i+") { "+a+" = "+a+".call("+n.callParams+"); }"),this.source.push("else { "+a+" = "+o+"; "+a+" = typeof "+a+" === functionType ? "+a+".apply(depth0) : "+a+"; }")},invokePartial:function(e){var t=[this.nameLookup("partials",e,"partial"),"'"+e+"'",this.popStack(),"helpers","partials"];this.options.data&&t.push("data"),this.context.aliases.self="this",this.push("self.invokePartial("+t.join(", ")+")")},assignToHash:function(e){var t,n,i=this.popStack();this.options.stringParams&&(n=this.popStack(),t=this.popStack());var o=this.hash;t&&o.contexts.push("'"+e+"': "+t),n&&o.types.push("'"+e+"': "+n),o.values.push("'"+e+"': ("+i+")")},compiler:d,compileChildren:function(e,t){for(var n,i,o=e.children,a=0,s=o.length;s>a;a++){n=o[a],i=new this.compiler;var r=this.matchExistingProgram(n);null==r?(this.context.programs.push(""),r=this.context.programs.length,n.index=r,n.name="program"+r,this.context.programs[r]=i.compile(n,t,this.context),this.context.environments[r]=n):(n.index=r,n.name="program"+r)}},matchExistingProgram:function(e){for(var t=0,n=this.context.environments.length;n>t;t++){var i=this.context.environments[t];if(i&&i.equals(e))return t}},programExpression:function(e){if(this.context.aliases.self="this",null==e)return"self.noop";for(var t,n=this.environment.children[e],i=n.depths.list,o=[n.index,n.name,"data"],a=0,s=i.length;s>a;a++)t=i[a],1===t?o.push("depth0"):o.push("depth"+(t-1));return(0===i.length?"self.program(":"self.programWithDepth(")+o.join(", ")+")"},register:function(e,t){this.useRegister(e),this.source.push(e+" = "+t+";")},useRegister:function(e){this.registers[e]||(this.registers[e]=!0,this.registers.list.push(e))},pushStackLiteral:function(e){return this.push(new p(e))},pushStack:function(e){this.flushInline();var t=this.incrStack();return e&&this.source.push(t+" = "+e+";"),this.compileStack.push(t),t},replaceStack:function(e){var t,n="",i=this.isInline();if(i){var o=this.popStack(!0);if(o instanceof p)t=o.value;else{var a=this.stackSlot?this.topStackName():this.incrStack();n="("+this.push(a)+" = "+o+"),",t=this.topStack()}}else t=this.topStack();var s=e.call(this,t);return i?((this.inlineStack.length||this.compileStack.length)&&this.popStack(),this.push("("+n+s+")")):(/^stack/.test(t)||(t=this.nextStack()),this.source.push(t+" = ("+n+s+");")),t},nextStack:function(){return this.pushStack()},incrStack:function(){return this.stackSlot++,this.stackSlot>this.stackVars.length&&this.stackVars.push("stack"+this.stackSlot),this.topStackName()},topStackName:function(){return"stack"+this.stackSlot},flushInline:function(){var e=this.inlineStack;if(e.length){this.inlineStack=[];for(var t=0,n=e.length;n>t;t++){var i=e[t];i instanceof p?this.compileStack.push(i):this.pushStack(i)}}},isInline:function(){return this.inlineStack.length},popStack:function(e){var t=this.isInline(),n=(t?this.inlineStack:this.compileStack).pop();return!e&&n instanceof p?n.value:(t||this.stackSlot--,n)},topStack:function(e){var t=this.isInline()?this.inlineStack:this.compileStack,n=t[t.length-1];return!e&&n instanceof p?n.value:n},quotedString:function(e){return'"'+e.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")+'"'},setupHelper:function(e,t,n){var i=[];this.setupParams(e,i,n);var o=this.nameLookup("helpers",t,"helper");return{params:i,name:o,callParams:["depth0"].concat(i).join(", "),helperMissingParams:n&&["depth0",this.quotedString(t)].concat(i).join(", ")}},setupParams:function(e,t,n){var i,o,a,s=[],r=[],l=[];s.push("hash:"+this.popStack()),o=this.popStack(),a=this.popStack(),(a||o)&&(a||(this.context.aliases.self="this",a="self.noop"),o||(this.context.aliases.self="this",o="self.noop"),s.push("inverse:"+o),s.push("fn:"+a));for(var c=0;e>c;c++)i=this.popStack(),t.push(i),this.options.stringParams&&(l.push(this.popStack()),r.push(this.popStack()));return this.options.stringParams&&(s.push("contexts:["+r.join(",")+"]"),s.push("types:["+l.join(",")+"]"),s.push("hashContexts:hashContexts"),s.push("hashTypes:hashTypes")),this.options.data&&s.push("data:data"),s="{"+s.join(",")+"}",n?(this.register("options",s),t.push("options")):t.push(s),t.join(", ")}};for(var f="break else new var case finally return void catch for switch while continue function this with default if throw delete in try do instanceof typeof abstract enum int short boolean export interface static byte extends long super char final native synchronized class float package throws const goto private transient debugger implements protected volatile double import public let yield".split(" "),m=d.RESERVED_WORDS={},g=0,_=f.length;_>g;g++)m[f[g]]=!0;d.isValidJavaScriptVariableName=function(e){return!d.RESERVED_WORDS[e]&&/^[a-zA-Z_$][0-9a-zA-Z_$]+$/.test(e)?!0:!1},e.precompile=function(t,n){if(null==t||"string"!=typeof t&&t.constructor!==e.AST.ProgramNode)throw new e.Exception("You must pass a string or Handlebars AST to Handlebars.precompile. You passed "+t);n=n||{},"data"in n||(n.data=!0);var i=e.parse(t),o=(new h).compile(i,n);return(new d).compile(o,n)},e.compile=function(n,i){function o(){var o=e.parse(n),a=(new h).compile(o,i),s=(new d).compile(a,i,t,!0);return e.template(s)}if(null==n||"string"!=typeof n&&n.constructor!==e.AST.ProgramNode)throw new e.Exception("You must pass a string or Handlebars AST to Handlebars.compile. You passed "+n);i=i||{},"data"in i||(i.data=!0);var a;return function(e,t){return a||(a=o()),a.call(this,e,t)}},e.VM={template:function(t){var n={escapeExpression:e.Utils.escapeExpression,invokePartial:e.VM.invokePartial,programs:[],program:function(t,n,i){var o=this.programs[t];return i?o=e.VM.program(t,n,i):o||(o=this.programs[t]=e.VM.program(t,n)),o},merge:function(t,n){var i=t||n;return t&&n&&(i={},e.Utils.extend(i,n),e.Utils.extend(i,t)),i},programWithDepth:e.VM.programWithDepth,noop:e.VM.noop,compilerInfo:null};return function(i,o){o=o||{};var a=t.call(n,e,i,o.helpers,o.partials,o.data),s=n.compilerInfo||[],r=s[0]||1,l=e.COMPILER_REVISION;if(r!==l){if(l>r){var c=e.REVISION_CHANGES[l],u=e.REVISION_CHANGES[r];throw"Template was precompiled with an older version of Handlebars than the current runtime. Please update your precompiler to a newer version ("+c+") or downgrade your runtime to an older version ("+u+")."}throw"Template was precompiled with a newer version of Handlebars than the current runtime. Please update your runtime to a newer version ("+s[1]+")."}return a}},programWithDepth:function(e,t,n){var i=Array.prototype.slice.call(arguments,3),o=function(e,o){return o=o||{},t.apply(this,[e,o.data||n].concat(i))};return o.program=e,o.depth=i.length,o},program:function(e,t,n){var i=function(e,i){return i=i||{},t(e,i.data||n)};return i.program=e,i.depth=0,i},noop:function(){return""},invokePartial:function(n,i,o,a,s,r){var l={helpers:a,partials:s,data:r};if(n===t)throw new e.Exception("The partial "+i+" could not be found");if(n instanceof Function)return n(o,l);if(e.compile)return s[i]=e.compile(n,{data:r!==t}),s[i](o,l);throw new e.Exception("The partial "+i+" could not be compiled when running in runtime-only mode")}},e.template=e.VM.template})(Handlebars),define("handlebars",function(e){return function(){var t;return t||e.Handlebars}}(this)),Backbone.Wreqr=function(e,t,n){var i={};return i.Handlers=function(e,t){var n=function(e){this.options=e,this._wreqrHandlers={},t.isFunction(this.initialize)&&this.initialize(e)};return n.extend=e.Model.extend,t.extend(n.prototype,e.Events,{setHandlers:function(e){t.each(e,function(e,n){var i=null;t.isObject(e)&&!t.isFunction(e)&&(i=e.context,e=e.callback),this.setHandler(n,e,i)},this)},setHandler:function(e,t,n){var i={callback:t,context:n};this._wreqrHandlers[e]=i,this.trigger("handler:add",e,t,n)},hasHandler:function(e){return!!this._wreqrHandlers[e]},getHandler:function(e){var t=this._wreqrHandlers[e];if(!t)throw Error("Handler not found for '"+e+"'");return function(){var e=Array.prototype.slice.apply(arguments);return t.callback.apply(t.context,e)}},removeHandler:function(e){delete this._wreqrHandlers[e]},removeAllHandlers:function(){this._wreqrHandlers={}}}),n}(e,n),i.CommandStorage=function(){var t=function(e){this.options=e,this._commands={},n.isFunction(this.initialize)&&this.initialize(e)};return n.extend(t.prototype,e.Events,{getCommands:function(e){var t=this._commands[e];return t||(t={command:e,instances:[]},this._commands[e]=t),t},addCommand:function(e,t){var n=this.getCommands(e);n.instances.push(t)},clearCommands:function(e){var t=this.getCommands(e);t.instances=[]}}),t}(),i.Commands=function(e){return e.Handlers.extend({storageType:e.CommandStorage,constructor:function(t){this.options=t||{},this._initializeStorage(this.options),this.on("handler:add",this._executeCommands,this);var n=Array.prototype.slice.call(arguments);e.Handlers.prototype.constructor.apply(this,n)},execute:function(e,t){e=arguments[0],t=Array.prototype.slice.call(arguments,1),this.hasHandler(e)?this.getHandler(e).apply(this,t):this.storage.addCommand(e,t)},_executeCommands:function(e,t,i){var o=this.storage.getCommands(e);n.each(o.instances,function(e){t.apply(i,e)}),this.storage.clearCommands(e)},_initializeStorage:function(e){var t,i=e.storageType||this.storageType;t=n.isFunction(i)?new i:i,this.storage=t}})}(i),i.RequestResponse=function(e){return e.Handlers.extend({request:function(){var e=arguments[0],t=Array.prototype.slice.call(arguments,1);return this.getHandler(e).apply(this,t)}})}(i),i.EventAggregator=function(e,t){var n=function(){};return n.extend=e.Model.extend,t.extend(n.prototype,e.Events),n}(e,n),i}(Backbone,Backbone.Marionette,_),define("backbone.wreqr",["underscore","backbone"],function(e){return function(){var t;return t||e.Backbone.Wreqr}}(this)),define("mig33_backbone",["backbone"],function(e){return e.Model.prototype.parse=function(e){return e.error&&0!==e.error.errno?[]:e.data?e.data:e},e.Collection.prototype.parse=e.Model.prototype.parse,e}),Backbone.ChildViewContainer=function(e,t){var n=function(e){this._views={},this._indexByModel={},this._indexByCustom={},this._updateLength(),t.each(e,this.add,this)};t.extend(n.prototype,{add:function(e,t){var n=e.cid;this._views[n]=e,e.model&&(this._indexByModel[e.model.cid]=n),t&&(this._indexByCustom[t]=n),this._updateLength()},findByModel:function(e){return this.findByModelCid(e.cid)},findByModelCid:function(e){var t=this._indexByModel[e];return this.findByCid(t)},findByCustom:function(e){var t=this._indexByCustom[e];return this.findByCid(t)},findByIndex:function(e){return t.values(this._views)[e]},findByCid:function(e){return this._views[e]},remove:function(e){var n=e.cid;e.model&&delete this._indexByModel[e.model.cid],t.any(this._indexByCustom,function(e,t){return e===n?(delete this._indexByCustom[t],!0):void 0},this),delete this._views[n],this._updateLength()},call:function(e){this.apply(e,t.tail(arguments))},apply:function(e,n){t.each(this._views,function(i){t.isFunction(i[e])&&i[e].apply(i,n||[])})},_updateLength:function(){this.length=t.size(this._views)}});var i=["forEach","each","map","find","detect","filter","select","reject","every","all","some","any","include","contains","invoke","toArray","first","initial","rest","last","without","isEmpty","pluck"];return t.each(i,function(e){n.prototype[e]=function(){var n=t.values(this._views),i=[n].concat(t.toArray(arguments));return t[e].apply(t,i)}}),n}(Backbone,_),define("backbone.babysitter",["underscore","mig33_backbone"],function(){}),Backbone.ChildViewContainer=function(e,t){var n=function(e){this._views={},this._indexByModel={},this._indexByCollection={},this._indexByCustom={},this._updateLength(),this._addInitialViews(e)};t.extend(n.prototype,{add:function(e,t){var n=e.cid;this._views[n]=e,e.model&&(this._indexByModel[e.model.cid]=n),e.collection&&(this._indexByCollection[e.collection.cid]=n),t&&(this._indexByCustom[t]=n),this._updateLength()},findByModel:function(e){var t=this._indexByModel[e.cid];return this.findByCid(t)},findByCollection:function(e){var t=this._indexByCollection[e.cid];return this.findByCid(t)},findByCustom:function(e){var t=this._indexByCustom[e];return this.findByCid(t)},findByIndex:function(e){return t.values(this._views)[e]},findByCid:function(e){return this._views[e]},remove:function(e){var t=e.cid;e.model&&delete this._indexByModel[e.model.cid],e.collection&&delete this._indexByCollection[e.collection.cid];var n;for(var i in this._indexByCustom)if(this._indexByCustom.hasOwnProperty(i)&&this._indexByCustom[i]===t){n=i;break}n&&delete this._indexByCustom[n],delete this._views[t],this._updateLength()},call:function(e,t){t=Array.prototype.slice.call(arguments,1),this.apply(e,t)},apply:function(e,n){n=n||[],t.each(this._views,function(i){t.isFunction(i[e])&&i[e].apply(i,n)})},_updateLength:function(){this.length=t.size(this._views)},_addInitialViews:function(e){if(e){var t,n,i=e.length;for(n=0;i>n;n++)t=e[n],this.add(t)}}});var i=["forEach","each","map","find","detect","filter","select","reject","every","all","some","any","include","contains","invoke","toArray","first","initial","rest","last","without","isEmpty","pluck"];return t.each(i,function(e){n.prototype[e]=function(){var n=t.values(this._views),i=[n].concat(t.toArray(arguments));return t[e].apply(t,i)}}),n}(Backbone,_),Backbone.Wreqr=function(e,t,n){var i={};return i.Handlers=function(e,t){var n=function(e){this.options=e,this._wreqrHandlers={},t.isFunction(this.initialize)&&this.initialize(e)};return n.extend=e.Model.extend,t.extend(n.prototype,e.Events,{setHandlers:function(e){t.each(e,function(e,n){var i=null;t.isObject(e)&&!t.isFunction(e)&&(i=e.context,e=e.callback),this.setHandler(n,e,i)},this)},setHandler:function(e,t,n){var i={callback:t,context:n};this._wreqrHandlers[e]=i,this.trigger("handler:add",e,t,n)},hasHandler:function(e){return!!this._wreqrHandlers[e]},getHandler:function(e){var t=this._wreqrHandlers[e];if(!t)throw Error("Handler not found for '"+e+"'");return function(){var e=Array.prototype.slice.apply(arguments);return t.callback.apply(t.context,e)}},removeHandler:function(e){delete this._wreqrHandlers[e]},removeAllHandlers:function(){this._wreqrHandlers={}}}),n}(e,n),i.CommandStorage=function(){var t=function(e){this.options=e,this._commands={},n.isFunction(this.initialize)&&this.initialize(e)};return n.extend(t.prototype,e.Events,{getCommands:function(e){var t=this._commands[e];return t||(t={command:e,instances:[]},this._commands[e]=t),t},addCommand:function(e,t){var n=this.getCommands(e);n.instances.push(t)},clearCommands:function(e){var t=this.getCommands(e);t.instances=[]}}),t}(),i.Commands=function(e){return e.Handlers.extend({storageType:e.CommandStorage,constructor:function(t){this.options=t||{},this._initializeStorage(this.options),this.on("handler:add",this._executeCommands,this);var n=Array.prototype.slice.call(arguments);e.Handlers.prototype.constructor.apply(this,n)},execute:function(e,t){e=arguments[0],t=Array.prototype.slice.call(arguments,1),this.hasHandler(e)?this.getHandler(e).apply(this,t):this.storage.addCommand(e,t)},_executeCommands:function(e,t,i){var o=this.storage.getCommands(e);n.each(o.instances,function(e){t.apply(i,e)}),this.storage.clearCommands(e)},_initializeStorage:function(e){var t,i=e.storageType||this.storageType;t=n.isFunction(i)?new i:i,this.storage=t}})}(i),i.RequestResponse=function(e){return e.Handlers.extend({request:function(){var e=arguments[0],t=Array.prototype.slice.call(arguments,1);return this.getHandler(e).apply(this,t)}})}(i),i.EventAggregator=function(e,t){var n=function(){};return n.extend=e.Model.extend,t.extend(n.prototype,e.Events),n}(e,n),i}(Backbone,Backbone.Marionette,_);var Marionette=function(e,t,n){function i(e){return s.call(e)}function o(e,t){var n=Error(e);throw n.name=t||"Error",n}var a={};t.Marionette=a,a.$=t.$;var s=Array.prototype.slice;return a.extend=t.Model.extend,a.getOption=function(e,t){if(e&&t){var n;return n=e.options&&t in e.options&&void 0!==e.options[t]?e.options[t]:e[t]}},a.triggerMethod=function(){function e(e,t,n){return n.toUpperCase()}var t=/(^|:)(\w)/gi,i=function(i){var o="on"+i.replace(t,e),a=this[o];return this.trigger.apply(this,arguments),n.isFunction(a)?a.apply(this,n.tail(arguments)):void 0};return i}(),a.MonitorDOMRefresh=function(){function e(e){e._isShown=!0,i(e)}function t(e){e._isRendered=!0,i(e)}function i(e){e._isShown&&e._isRendered&&n.isFunction(e.triggerMethod)&&e.triggerMethod("dom:refresh")
}return function(n){n.listenTo(n,"show",function(){e(n)}),n.listenTo(n,"render",function(){t(n)})}}(),function(e){function t(e,t,i,a){var s=a.split(/\s+/);n.each(s,function(n){var a=e[n];a||o("Method '"+n+"' was configured as an event handler, but does not exist."),e.listenTo(t,i,a,e)})}function i(e,t,n,i){e.listenTo(t,n,i,e)}function a(e,t,i,o){var a=o.split(/\s+/);n.each(a,function(n){var o=e[n];e.stopListening(t,i,o,e)})}function s(e,t,n,i){e.stopListening(t,n,i,e)}function r(e,t,i,o,a){t&&i&&(n.isFunction(i)&&(i=i.call(e)),n.each(i,function(i,s){n.isFunction(i)?o(e,t,s,i):a(e,t,s,i)}))}e.bindEntityEvents=function(e,n,o){r(e,n,o,i,t)},e.unbindEntityEvents=function(e,t,n){r(e,t,n,s,a)}}(a),a.Callbacks=function(){this._deferred=a.$.Deferred(),this._callbacks=[]},n.extend(a.Callbacks.prototype,{add:function(e,t){this._callbacks.push({cb:e,ctx:t}),this._deferred.done(function(n,i){t&&(n=t),e.call(n,i)})},run:function(e,t){this._deferred.resolve(t,e)},reset:function(){var e=this._callbacks;this._deferred=a.$.Deferred(),this._callbacks=[],n.each(e,function(e){this.add(e.cb,e.ctx)},this)}}),a.Controller=function(e){this.triggerMethod=a.triggerMethod,this.options=e||{},n.isFunction(this.initialize)&&this.initialize(this.options)},a.Controller.extend=a.extend,n.extend(a.Controller.prototype,t.Events,{close:function(){this.stopListening(),this.triggerMethod("close"),this.unbind()}}),a.Region=function(e){if(this.options=e||{},this.el=a.getOption(this,"el"),!this.el){var t=Error("An 'el' must be specified for a region.");throw t.name="NoElError",t}if(this.initialize){var n=Array.prototype.slice.apply(arguments);this.initialize.apply(this,n)}},n.extend(a.Region,{buildRegion:function(e,t){var i="string"==typeof e,o="string"==typeof e.selector,a=e.regionType===void 0,s="function"==typeof e;if(!s&&!i&&!o)throw Error("Region must be specified as a Region type, a selector string or an object with selector property");var r,l;i&&(r=e),e.selector&&(r=e.selector),s&&(l=e),!s&&a&&(l=t),e.regionType&&(l=e.regionType);var c=new l({el:r});return e.parentEl&&(c.getEl=function(t){var i=e.parentEl;return n.isFunction(i)&&(i=i()),i.find(t)}),c}}),n.extend(a.Region.prototype,t.Events,{show:function(e){this.ensureEl();var t=e.isClosed||n.isUndefined(e.$el),i=e!==this.currentView;i&&this.close(),e.render(),(i||t)&&this.open(e),this.currentView=e,a.triggerMethod.call(this,"show",e),a.triggerMethod.call(e,"show")},ensureEl:function(){this.$el&&0!==this.$el.length||(this.$el=this.getEl(this.el))},getEl:function(e){return a.$(e)},open:function(e){this.$el.empty().append(e.el)},close:function(){var e=this.currentView;e&&!e.isClosed&&(e.close?e.close():e.remove&&e.remove(),a.triggerMethod.call(this,"close"),delete this.currentView)},attachView:function(e){this.currentView=e},reset:function(){this.close(),delete this.$el}}),a.Region.extend=a.extend,a.RegionManager=function(e){var t=e.Controller.extend({constructor:function(t){this._regions={},e.Controller.prototype.constructor.call(this,t)},addRegions:function(e,t){var i={};return n.each(e,function(e,o){"string"==typeof e&&(e={selector:e}),e.selector&&(e=n.defaults({},e,t));var a=this.addRegion(o,e);i[o]=a},this),i},addRegion:function(t,i){var o,a=n.isObject(i),s=n.isString(i),r=!!i.selector;return o=s||a&&r?e.Region.buildRegion(i,e.Region):n.isFunction(i)?e.Region.buildRegion(i,e.Region):i,this._store(t,o),this.triggerMethod("region:add",t,o),o},get:function(e){return this._regions[e]},removeRegion:function(e){var t=this._regions[e];this._remove(e,t)},removeRegions:function(){n.each(this._regions,function(e,t){this._remove(t,e)},this)},closeRegions:function(){n.each(this._regions,function(e){e.close()},this)},close:function(){this.removeRegions();var t=Array.prototype.slice.call(arguments);e.Controller.prototype.close.apply(this,t)},_store:function(e,t){this._regions[e]=t,this._setLength()},_remove:function(e,t){t.close(),delete this._regions[e],this._setLength(),this.triggerMethod("region:remove",e,t)},_setLength:function(){this.length=n.size(this._regions)}}),i=["forEach","each","map","find","detect","filter","select","reject","every","all","some","any","include","contains","invoke","toArray","first","initial","rest","last","without","isEmpty","pluck"];return n.each(i,function(e){t.prototype[e]=function(){var t=n.values(this._regions),i=[t].concat(n.toArray(arguments));return n[e].apply(n,i)}}),t}(a),a.TemplateCache=function(e){this.templateId=e},n.extend(a.TemplateCache,{templateCaches:{},get:function(e){var t=this.templateCaches[e];return t||(t=new a.TemplateCache(e),this.templateCaches[e]=t),t.load()},clear:function(){var e,t=i(arguments),n=t.length;if(n>0)for(e=0;n>e;e++)delete this.templateCaches[t[e]];else this.templateCaches={}}}),n.extend(a.TemplateCache.prototype,{load:function(){if(this.compiledTemplate)return this.compiledTemplate;var e=this.loadTemplate(this.templateId);return this.compiledTemplate=this.compileTemplate(e),this.compiledTemplate},loadTemplate:function(e){var t=a.$(e).html();return t&&0!==t.length||o("Could not find template: '"+e+"'","NoTemplateError"),t},compileTemplate:function(e){return n.template(e)}}),a.Renderer={render:function(e,t){if(!e){var n=Error("Cannot render the template since it's false, null or undefined.");throw n.name="TemplateNotFoundError",n}var i;return i="function"==typeof e?e:a.TemplateCache.get(e),i(t)}},a.View=t.View.extend({constructor:function(){n.bindAll(this,"render");var e=Array.prototype.slice.apply(arguments);t.View.prototype.constructor.apply(this,e),a.MonitorDOMRefresh(this),this.listenTo(this,"show",this.onShowCalled,this)},triggerMethod:a.triggerMethod,getTemplate:function(){return a.getOption(this,"template")},mixinTemplateHelpers:function(e){e=e||{};var t=this.templateHelpers;return n.isFunction(t)&&(t=t.call(this)),n.extend(e,t)},configureTriggers:function(){if(this.triggers){var e={},t=n.result(this,"triggers");return n.each(t,function(t,n){e[n]=function(e){e&&e.preventDefault&&e.preventDefault(),e&&e.stopPropagation&&e.stopPropagation();var n={view:this,model:this.model,collection:this.collection};this.triggerMethod(t,n)}},this),e}},delegateEvents:function(e){this._delegateDOMEvents(e),a.bindEntityEvents(this,this.model,a.getOption(this,"modelEvents")),a.bindEntityEvents(this,this.collection,a.getOption(this,"collectionEvents"))},_delegateDOMEvents:function(e){e=e||this.events,n.isFunction(e)&&(e=e.call(this));var i={},o=this.configureTriggers();n.extend(i,e,o),t.View.prototype.delegateEvents.call(this,i)},undelegateEvents:function(){var e=Array.prototype.slice.call(arguments);t.View.prototype.undelegateEvents.apply(this,e),a.unbindEntityEvents(this,this.model,a.getOption(this,"modelEvents")),a.unbindEntityEvents(this,this.collection,a.getOption(this,"collectionEvents"))},onShowCalled:function(){},close:function(){if(!this.isClosed){var e=this.triggerMethod("before:close");e!==!1&&(this.isClosed=!0,this.triggerMethod("close"),this.unbindUIElements(),this.remove())}},bindUIElements:function(){if(this.ui){this._uiBindings||(this._uiBindings=this.ui);var e=n.result(this,"_uiBindings");this.ui={},n.each(n.keys(e),function(t){var n=e[t];this.ui[t]=this.$(n)},this)}},unbindUIElements:function(){this.ui&&(n.each(this.ui,function(e,t){delete this.ui[t]},this),this.ui=this._uiBindings,delete this._uiBindings)}}),a.ItemView=a.View.extend({serializeData:function(){var e={};return this.model?e=this.model.toJSON():this.collection&&(e={items:this.collection.toJSON()}),e},render:function(){this.isClosed=!1,this.triggerMethod("before:render",this),this.triggerMethod("item:before:render",this);var e=this.serializeData();e=this.mixinTemplateHelpers(e);var t=this.getTemplate(),n=a.Renderer.render(t,e);return this.$el.html(n),this.bindUIElements(),this.triggerMethod("render",this),this.triggerMethod("item:rendered",this),this},close:function(){this.isClosed||(this.triggerMethod("item:before:close"),a.View.prototype.close.apply(this,i(arguments)),this.triggerMethod("item:closed"))}}),a.CollectionView=a.View.extend({itemViewEventPrefix:"itemview",constructor:function(){this._initChildViewStorage(),a.View.prototype.constructor.apply(this,i(arguments)),this._initialEvents()},_initialEvents:function(){this.collection&&(this.listenTo(this.collection,"add",this.addChildView,this),this.listenTo(this.collection,"remove",this.removeItemView,this),this.listenTo(this.collection,"reset",this.render,this))},addChildView:function(e){this.closeEmptyView();var t=this.getItemView(e),n=this.collection.indexOf(e);this.addItemView(e,t,n)},onShowCalled:function(){this.children.each(function(e){a.triggerMethod.call(e,"show")})},triggerBeforeRender:function(){this.triggerMethod("before:render",this),this.triggerMethod("collection:before:render",this)},triggerRendered:function(){this.triggerMethod("render",this),this.triggerMethod("collection:rendered",this)},render:function(){return this.isClosed=!1,this.triggerBeforeRender(),this._renderChildren(),this.triggerRendered(),this},_renderChildren:function(){this.closeEmptyView(),this.closeChildren(),this.collection&&this.collection.length>0?this.showCollection():this.showEmptyView()},showCollection:function(){var e;this.collection.each(function(t,n){e=this.getItemView(t),this.addItemView(t,e,n)},this)},showEmptyView:function(){var e=a.getOption(this,"emptyView");if(e&&!this._showingEmptyView){this._showingEmptyView=!0;var n=new t.Model;this.addItemView(n,e,0)}},closeEmptyView:function(){this._showingEmptyView&&(this.closeChildren(),delete this._showingEmptyView)},getItemView:function(){var e=a.getOption(this,"itemView");return e||o("An `itemView` must be specified","NoItemViewError"),e},addItemView:function(e,t,i){var o=a.getOption(this,"itemViewOptions");n.isFunction(o)&&(o=o.call(this,e,i));var s=this.buildItemView(e,t,o);this.addChildViewEventForwarding(s),this.triggerMethod("before:item:added",s),this.children.add(s),this.renderItemView(s,i),this._isShown&&a.triggerMethod.call(s,"show"),this.triggerMethod("after:item:added",s)},addChildViewEventForwarding:function(e){var t=a.getOption(this,"itemViewEventPrefix");this.listenTo(e,"all",function(){var n=i(arguments);n[0]=t+":"+n[0],n.splice(1,0,e),a.triggerMethod.apply(this,n)},this)},renderItemView:function(e,t){e.render(),this.appendHtml(this,e,t)},buildItemView:function(e,t,i){var o=n.extend({model:e},i);return new t(o)},removeItemView:function(e){var t=this.children.findByModel(e);this.removeChildView(t),this.checkEmpty()},removeChildView:function(e){e&&(this.stopListening(e),e.close?e.close():e.remove&&e.remove(),this.children.remove(e)),this.triggerMethod("item:removed",e)},checkEmpty:function(){this.collection&&0!==this.collection.length||this.showEmptyView()},appendHtml:function(e,t){e.$el.append(t.el)},_initChildViewStorage:function(){this.children=new t.ChildViewContainer},close:function(){this.isClosed||(this.triggerMethod("collection:before:close"),this.closeChildren(),this.triggerMethod("collection:closed"),a.View.prototype.close.apply(this,i(arguments)))},closeChildren:function(){this.children.each(function(e){this.removeChildView(e)},this),this.checkEmpty()}}),a.CompositeView=a.CollectionView.extend({_initialEvents:function(){this.collection&&(this.listenTo(this.collection,"add",this.addChildView,this),this.listenTo(this.collection,"remove",this.removeItemView,this),this.listenTo(this.collection,"reset",this._renderChildren,this))},getItemView:function(){var e=a.getOption(this,"itemView")||this.constructor;return e||o("An `itemView` must be specified","NoItemViewError"),e},serializeData:function(){var e={};return this.model&&(e=this.model.toJSON()),e},render:function(){this.isRendered=!0,this.isClosed=!1,this.resetItemViewContainer(),this.triggerBeforeRender();var e=this.renderModel();return this.$el.html(e),this.bindUIElements(),this.triggerMethod("composite:model:rendered"),this._renderChildren(),this.triggerMethod("composite:rendered"),this.triggerRendered(),this},_renderChildren:function(){this.isRendered&&(a.CollectionView.prototype._renderChildren.call(this),this.triggerMethod("composite:collection:rendered"))},renderModel:function(){var e={};e=this.serializeData(),e=this.mixinTemplateHelpers(e);var t=this.getTemplate();return a.Renderer.render(t,e)},appendHtml:function(e,t){var n=this.getItemViewContainer(e);n.append(t.el)},getItemViewContainer:function(e){if("$itemViewContainer"in e)return e.$itemViewContainer;var t;if(e.itemViewContainer){var i=n.result(e,"itemViewContainer");t=e.$(i),0>=t.length&&o("The specified `itemViewContainer` was not found: "+e.itemViewContainer,"ItemViewContainerMissingError")}else t=e.$el;return e.$itemViewContainer=t,t},resetItemViewContainer:function(){this.$itemViewContainer&&delete this.$itemViewContainer}}),a.Layout=a.ItemView.extend({regionType:a.Region,constructor:function(e){e=e||{},this._firstRender=!0,this._initializeRegions(e),a.ItemView.call(this,e)},render:function(){this._firstRender?this._firstRender=!1:this.isClosed?this._initializeRegions():this._reInitializeRegions();var e=Array.prototype.slice.apply(arguments),t=a.ItemView.prototype.render.apply(this,e);return t},close:function(){if(!this.isClosed){this.regionManager.close();var e=Array.prototype.slice.apply(arguments);a.ItemView.prototype.close.apply(this,e)}},addRegion:function(e,t){var n={};return n[e]=t,this.addRegions(n)[e]},addRegions:function(e){return this.regions=n.extend(this.regions||{},e),this._buildRegions(e)},removeRegion:function(e){return this.regionManager.removeRegion(e)},_buildRegions:function(e){var t=this,n={parentEl:function(){return t.$el}};return this.regionManager.addRegions(e,n)},_initializeRegions:function(e){var t;this._initRegionManager(),t=n.isFunction(this.regions)?this.regions(e):this.regions||{},this.addRegions(t)},_reInitializeRegions:function(){this.regionManager.closeRegions(),this.regionManager.each(function(e){e.reset()})},_initRegionManager:function(){this.regionManager=new a.RegionManager,this.listenTo(this.regionManager,"region:add",function(e,t){this[e]=t,this.trigger("region:add",e,t)}),this.listenTo(this.regionManager,"region:remove",function(e,t){delete this[e],this.trigger("region:remove",e,t)})}}),a.AppRouter=t.Router.extend({constructor:function(e){if(t.Router.prototype.constructor.apply(this,i(arguments)),this.options=e,this.appRoutes){var n=a.getOption(this,"controller");this.processAppRoutes(n,this.appRoutes)}},processAppRoutes:function(e,t){var i=n.keys(t).reverse();n.each(i,function(i){var o=t[i],a=e[o];if(!a)throw Error("Method '"+o+"' was not found on the controller");this.route(i,o,n.bind(a,e))},this)}}),a.Application=function(e){this._initRegionManager(),this._initCallbacks=new a.Callbacks,this.vent=new t.Wreqr.EventAggregator,this.commands=new t.Wreqr.Commands,this.reqres=new t.Wreqr.RequestResponse,this.submodules={},n.extend(this,e),this.triggerMethod=a.triggerMethod},n.extend(a.Application.prototype,t.Events,{execute:function(){var e=Array.prototype.slice.apply(arguments);this.commands.execute.apply(this.commands,e)},request:function(){var e=Array.prototype.slice.apply(arguments);return this.reqres.request.apply(this.reqres,e)},addInitializer:function(e){this._initCallbacks.add(e)},start:function(e){this.triggerMethod("initialize:before",e),this._initCallbacks.run(e,this),this.triggerMethod("initialize:after",e),this.triggerMethod("start",e)},addRegions:function(e){return this._regionManager.addRegions(e)},removeRegion:function(e){this._regionManager.removeRegion(e)},module:function(){var e=i(arguments);return e.unshift(this),a.Module.create.apply(a.Module,e)},_initRegionManager:function(){this._regionManager=new a.RegionManager,this.listenTo(this._regionManager,"region:add",function(e,t){this[e]=t}),this.listenTo(this._regionManager,"region:remove",function(e){delete this[e]})}}),a.Application.extend=a.extend,a.Module=function(e,t){this.moduleName=e,this.submodules={},this._setupInitializersAndFinalizers(),this.app=t,this.startWithParent=!0,this.triggerMethod=a.triggerMethod},n.extend(a.Module.prototype,t.Events,{addInitializer:function(e){this._initializerCallbacks.add(e)},addFinalizer:function(e){this._finalizerCallbacks.add(e)},start:function(e){this._isInitialized||(n.each(this.submodules,function(t){t.startWithParent&&t.start(e)}),this.triggerMethod("before:start",e),this._initializerCallbacks.run(e,this),this._isInitialized=!0,this.triggerMethod("start",e))},stop:function(){this._isInitialized&&(this._isInitialized=!1,a.triggerMethod.call(this,"before:stop"),n.each(this.submodules,function(e){e.stop()}),this._finalizerCallbacks.run(void 0,this),this._initializerCallbacks.reset(),this._finalizerCallbacks.reset(),a.triggerMethod.call(this,"stop"))},addDefinition:function(e,t){this._runModuleDefinition(e,t)},_runModuleDefinition:function(e,i){if(e){var o=n.flatten([this,this.app,t,a,a.$,n,i]);e.apply(this,o)}},_setupInitializersAndFinalizers:function(){this._initializerCallbacks=new a.Callbacks,this._finalizerCallbacks=new a.Callbacks}}),n.extend(a.Module,{create:function(e,t,o){var a=e,s=i(arguments);s.splice(0,3),t=t.split(".");var r=t.length,l=[];return l[r-1]=o,n.each(t,function(t,n){var i=a;a=this._getModule(i,t,e),this._addModuleDefinition(i,a,l[n],s)},this),a},_getModule:function(e,t,n){var i=e[t];return i||(i=new a.Module(t,n),e[t]=i,e.submodules[t]=i),i},_addModuleDefinition:function(e,t,i,o){var a,s;n.isFunction(i)?(a=i,s=!0):n.isObject(i)?(a=i.define,s=i.startWithParent):s=!0,a&&t.addDefinition(a,o),t.startWithParent=t.startWithParent&&s,t.startWithParent&&!t.startWithParentIsConfigured&&(t.startWithParentIsConfigured=!0,e.addInitializer(function(e){t.startWithParent&&t.start(e)}))}}),a}(this,Backbone,_);if(define("backbone.marionette",["backbone.wreqr","backbone.babysitter"],function(e){return function(){var t;return t||e.Backbone.Marionette}}(this)),function(e,t,n,i,o,a,s){"object"==typeof i?o.exports=a(n("underscore"),n("backbone"),n("backbone.marionette")):"function"==typeof t&&t.amd?t("marionette_handlebars",["underscore","backbone","backbone.marionette"],function(t,n){return t=t===s?e._:t,n=n===s?e.Backbone:n,e.returnExportsGlobal=a(t,n,e)}):e.returnExportsGlobal=a(e._,e.Backbone)}(this,this.define,this.require,this.exports,this.module,function(e,t){var n;return n=t.Marionette.Renderer.render,t.Marionette.Renderer.render=function(t,i){return e.isObject(t)&&"handlebars"===t.type?t.template(i,t.options):n(t,i)},t.Marionette}),define("modules/common/config",["jquery"],function(){var e="datasvc",t="api";return{urls:{miniblog_api_url:url.site+t+"/miniblog",home_feed_url:url.site+t+"/miniblog/homefeed/posts/all",poll_url:url.site+t+"/miniblog/poll",single_post_url:url.site+t+"/miniblog/post",profile_feed_url:url.site+t+"/miniblog/profilefeed",watchlist_url:url.site+t+"/miniblog/watchlist",mentions_url:url.site+t+"/miniblog/mentions",profile_url:url.site+t+"/miniblog/profile",follower_url:url.site+t+"/miniblog/followers",following_url:url.site+t+"/miniblog/following",badges_url:url.site+t+"/miniblog/badges",replies_url:url.site+t+"/miniblog/replies",discover_url:url.site+t+"/miniblog/discover",hashtags_url:url.site+t+"/miniblog/facets",alerts_url:url.site+t+"/miniblog/migalerts",threads_url:url.site+t+"/miniblog/threads",messages_url:url.site+t+"/miniblog/messages",autocomplete_users:url.site+t+"/miniblog/autocomplete/users",autocomplete_groups:url.site+t+"/miniblog/autocomplete/groups",group_feed:url.site+t+"/group/feed/{0}/posts/all/{1}/{2}",group_invalidate_cache:url.site+t+"/group/invalidate_cache/{0}/{1}",user_games:url.site+e+"/user/{0}/games",user_groups:url.site+e+"/user/{0}/groups",groups_official:url.site+e+"/groups/official",groups_games:url.site+e+"/groups/games",group_api:url.site+e+"/group",group:url.site+e+"/group/{0}",group_join:url.site+e+"/group/{0}/join",group_leave:url.site+e+"/group/{0}/leave",group_members:url.site+e+"/group/{0}/members",group_moderators:url.site+e+"/group/{0}/moderators",group_pending_invites:url.site+e+"/group/{0}/pending_invites",group_invite_request:url.site+e+"/group/{0}/invite/request",group_invite_accept:url.site+e+"/group/{0}/invite/{1}/accept",group_invite_reject:url.site+e+"/group/{0}/invite/{1}/reject",group_member_promote:url.site+e+"/group/{0}/member/{1}/promote",group_member_demote:url.site+e+"/group/{0}/member/{1}/demote",group_member_block:url.site+e+"/group/{0}/member/{1}/block",group_chatrooms:url.site+e+"/group/{0}/chatrooms"},grid:{desired_cell_width:188,cell_spacing:16,cell_height:204},variable:{limit:4*Math.floor($(window).width()/192)},timer:{poll:3e5},migalerts:{limit:33},groups:{limit:33,members:{limit:33}},layoutType:{feed:"feed",tile:"tile"},profile:{sidebar:{limit:7}}}}),define("modules/common/date_format",["jquery"],function(e){var t=function(){},n=function(){var t=/d{1,4}|m{1,4}|yy(?:yy)?|([HhMsTt])\1?|[LloSZ]|"[^"]*"|'[^']*'/g,i=/\b(?:[PMCEA][SDP]T|(?:Pacific|Mountain|Central|Eastern|Atlantic) (?:Standard|Daylight|Prevailing) Time|(?:GMT|UTC)(?:[\-+]\d{4})?)\b/g,o=/[^+\dA-Z\-]/g,a=function(e,t){for(e+="",t=t||2;t>e.length;)e="0"+e;return e};return function(s,r,l){var c=n;if(1!=arguments.length||"[object String]"!=Object.prototype.toString.call(s)||/\d/.test(s)||(r=s,s=void 0),s=s?new Date(s):new Date,isNaN(s))throw new SyntaxError("invalid date");r=(c.masks[r]||r||c.masks["default"])+"","UTC:"==r.slice(0,4)&&(r=r.slice(4),l=!0);var u=l?"getUTC":"get",h=s[u+"Date"](),d=s[u+"Day"](),p=s[u+"Month"](),f=s[u+"FullYear"](),m=s[u+"Hours"](),g=s[u+"Minutes"](),_=s[u+"Seconds"](),v=s[u+"Milliseconds"](),y=l?0:s.getTimezoneOffset(),w={d:h,dd:a(h),ddd:e.i18n("date|"+c.i18n.dayNames[d]),dddd:e.i18n("date|"+c.i18n.dayNames[d+7]),m:p+1,mm:a(p+1),mmm:e.i18n("date|"+c.i18n.monthNames[p]),mmmm:e.i18n("date|"+c.i18n.monthNames[p+12]),yy:(f+"").slice(2),yyyy:f,h:m%12||12,hh:a(m%12||12),H:m,HH:a(m),M:g,MM:a(g),s:_,ss:a(_),l:a(v,3),L:a(v>99?Math.round(v/10):v),t:12>m?"a":"p",tt:12>m?"am":"pm",T:12>m?"A":"P",TT:12>m?"AM":"PM",Z:l?"UTC":((s+"").match(i)||[""]).pop().replace(o,""),o:(y>0?"-":"+")+a(100*Math.floor(Math.abs(y)/60)+Math.abs(y)%60,4),S:["th","st","nd","rd"][h%10>3?0:(10!=h%100-h%10)*h%10]};return r.replace(t,function(e){return e in w?w[e]:e.slice(1,e.length-1)})}}();return n.masks={"default":"ddd mmm dd yyyy HH:MM:ss",shortDate:"m/d/yy",mediumDate:"mmm d, yyyy",longDate:"mmmm d, yyyy",fullDate:"dddd, mmmm d, yyyy",shortTime:"h:MM TT",mediumTime:"h:MM:ss TT",longTime:"h:MM:ss TT Z",isoDate:"yyyy-mm-dd",isoTime:"HH:MM:ss",isoDateTime:"yyyy-mm-dd'T'HH:MM:ss",isoUtcDateTime:"UTC:yyyy-mm-dd'T'HH:MM:ss'Z'"},n.i18n={dayNames:["sun","mon","tue","wed","thu","fri","sat","sunday","monday","tuesday","wednesday","thursday","friday","saturday"],monthNames:["jan","feb","mar","apr","may","jun","jul","aug","sep","oct","nov","dec","january","february","march","april","may","june","july","august","september","october","november","december"]},t.format=function(e,t,i){return n(e,t,i)},t}),define("modules/chat/config/config",["underscore","jquery","backbone"],function(e){var t={};return e.extend(t,{Transport_Type:{xml:0,json:1},Presence:{online:1,busy:3,away:4,appear_offline:99,offline:99},IM_Type:{fusion:1,msn:2,yahoo:4,gtalk:6,facebook:7,mobile:"mobile"},Message_Type:{1:1,2:4,4:6,7:7,6:8},Content_Type:{text:1,image:2,audio:3,video:4,file:5,emote:6,system:7},Application_State:{check_session:1,logging_in:2,logged_in:3},DestinationType:{individual:1,group:2,public_chat:3},SettingType:{password:1,mobilephone:2,securityQuestion:3},ChatroomType:{individual:1,group:2,public_chat:3},InitialWindowPosition:{x:0,y:0},emoticon_hotkeys:"",isDebug:function(){return!0},getMessageType:function(e){var n=t.Message_Type[e];return n||1},short_poll_interval:4,default_poll_interval:4,check_session_interval:120,ClientType:5,NoAvatarDisplayPicture:"/sites/resources/images/avatar/default-avatar.png",NoAvatarDisplayPictureSmall:"/sites/resources/images/avatar/default-avatar-24x24.png",session_cookie_domain:url.cookie_domain,gateway_path:"/xml/",image_server:url.image,migcore_url:url.migcore,register_url:url.register,login_url:url.login,config:{username:session_user?session_user.alias:"",presence:1},b_url:url.migbo,site:"miniblog",path:"u/"+(session_user?session_user.alias:""),logout_url:url.logout}),t}),function(e,t,n){function i(e){return e}function o(e){return a(decodeURIComponent(e.replace(r," ")))}function a(e){return 0===e.indexOf('"')&&(e=e.slice(1,-1).replace(/\\"/g,'"').replace(/\\\\/g,"\\")),e}function s(e){return l.json?JSON.parse(e):e}var r=/\+/g,l=e.cookie=function(a,r,c){if(r!==n){if(c=e.extend({},l.defaults,c),null===r&&(c.expires=-1),"number"==typeof c.expires){var u=c.expires,h=c.expires=new Date;h.setDate(h.getDate()+u)}return r=l.json?JSON.stringify(r):r+"",t.cookie=[encodeURIComponent(a),"=",l.raw?r:encodeURIComponent(r),c.expires?"; expires="+c.expires.toUTCString():"",c.path?"; path="+c.path:"",c.domain?"; domain="+c.domain:"",c.secure?"; secure":""].join("")}for(var d=l.raw?i:o,p=t.cookie.split("; "),f=a?null:{},m=0,g=p.length;g>m;m++){var _=p[m].split("="),v=d(_.shift()),y=d(_.join("="));if(a&&a===v){f=s(y);break}a||(f[v]=s(y))}return f};l.defaults={},e.removeCookie=function(t,n){return null!==e.cookie(t)?(e.cookie(t,null,n),!0):!1}}(jQuery,document),define("jquery.cookie",["jquery"],function(){}),define("modules/common/local_storage",["modules/chat/config/config","underscore","backbone","jquery.cookie"],function(e,t,n){var i={};return t.extend(i,n.Events),t.extend(i,{hasKey:function(e){var t;return t=window.localStorage?window.localStorage.getItem(e):$.cookie(e),null!==t},get:function(e){var t;return t=window.localStorage?window.localStorage.getItem(e):$.cookie(e),t=void 0===t||null===t||"undefined"===t?"null":""+t,JSON.parse(t)},set:function(e,t){return window.localStorage?window.localStorage.setItem(e,JSON.stringify(t)):$.cookies(e,JSON.stringify(t))},remove:function(e){return window.localStorage?window.localStorage.removeItem(e):$.cookie(e,null)},create_cookie:function(t,n,i){$.cookie(t,n,{expires:i,domain:e.session_cookie_domain})},get_cookie:function(e){$.cookie(e)},clear_cookie:function(e){this.create_cookie(e,null,-1)},has_cookie:function(e){return null!==$.cookie(e)}}),i}),function(e){"function"==typeof define&&define.amd?define("jquery.mousewheel",["jquery"],e):"object"==typeof exports?module.exports=e:e(jQuery)}(function(e){function t(t){var o,a=t||window.event,s=[].slice.call(arguments,1),r=0,l=0,c=0,u=0,h=0;return t=e.event.fix(a),t.type="mousewheel",a.wheelDelta&&(r=a.wheelDelta),a.detail&&(r=-1*a.detail),a.deltaY&&(c=-1*a.deltaY,r=c),a.deltaX&&(l=a.deltaX,r=-1*l),void 0!==a.wheelDeltaY&&(c=a.wheelDeltaY),void 0!==a.wheelDeltaX&&(l=-1*a.wheelDeltaX),u=Math.abs(r),(!n||n>u)&&(n=u),h=Math.max(Math.abs(c),Math.abs(l)),(!i||i>h)&&(i=h),o=r>0?"floor":"ceil",r=Math[o](r/n),l=Math[o](l/i),c=Math[o](c/i),s.unshift(t,r,l,c),(e.event.dispatch||e.event.handle).apply(this,s)}var n,i,o=["wheel","mousewheel","DOMMouseScroll","MozMousePixelScroll"],a="onwheel"in document||document.documentMode>=9?["wheel"]:["mousewheel","DomMouseScroll","MozMousePixelScroll"];if(e.event.fixHooks)for(var s=o.length;s;)e.event.fixHooks[o[--s]]=e.event.mouseHooks;e.event.special.mousewheel={setup:function(){if(this.addEventListener)for(var e=a.length;e;)this.addEventListener(a[--e],t,!1);else this.onmousewheel=t},teardown:function(){if(this.removeEventListener)for(var e=a.length;e;)this.removeEventListener(a[--e],t,!1);else this.onmousewheel=null}},e.fn.extend({mousewheel:function(e){return e?this.bind("mousewheel",e):this.trigger("mousewheel")},unmousewheel:function(e){return this.unbind("mousewheel",e)}})}),"undefined"!=typeof module&&module.exports&&(module.exports=pluralRuleParser),define("CLDRPluralRuleParser",function(){}),function(e){var t,n=Array.prototype.slice,i=function(t){this.options=e.extend({},i.defaults,t),this.parser=this.options.parser,this.locale=this.options.locale,this.messageStore=this.options.messageStore,this.languages={},this.init()};i.prototype={init:function(){var t;t=this,t.messageStore.init(t.locale),String.locale=t.locale,String.prototype.toLocaleString=function(){var n,i,o,a,s,r;for(a=this.valueOf(),s=t.locale,r=0;s;){n=s.toLowerCase().split("-"),o=n.length;do{var l=n.slice(0,o).join("-");if(t.options.messageLocationResolver&&(i=t.options.messageLocationResolver(l,a))&&!t.messageStore.isLoaded(l,i)&&t.messageStore.load(i,l),i=t.messageStore.get(l,a))return i;o--}while(o);if("en"===s)break;s=e.i18n.fallbacks[t.locale]&&e.i18n.fallbacks[t.locale][r]||t.options.fallbackLocale,t.log("Trying fallback locale for "+t.locale+": "+s),r++}return""}},destroy:function(){e.removeData(document,"i18n")},load:function(e,t){this.messageStore.load(e,t)},log:function(){window.console&&e.i18n.debug&&window.console.log.apply(window.console,arguments)},parse:function(t,n){var i=t.toLocaleString();return this.parser.language=e.i18n.languages[e.i18n().locale]||e.i18n.languages["default"],""===i&&(i=t),this.parser.parse(i,n)}},e.i18n=function(t,o){var a,s=e.data(document,"i18n");return(a="object"==typeof t&&t)&&a.locale&&s&&s.locale!==a.locale&&(String.locale=s.locale=a.locale),s||(s=new i(a),e.data(document,"i18n",s)),"string"==typeof t?(a=void 0!==o?n.call(arguments,1):[],s.parse(t,a)):s},e.fn.i18n=function(){var t=e.data(document,"i18n");return String.locale=t.locale,t||(t=new i,e.data(document,"i18n",t)),this.each(function(){var t=e(this);if(t.data("i18n")){var n=t.data("i18n").toLocaleString();""!==n&&t.text(n)}else t.find("[data-i18n]").i18n()})},String.locale=String.locale||e("html").attr("lang"),String.locale||(void 0!==typeof window.navigator?(t=window.navigator,String.locale=t.language||t.userLanguage||""):String.locale=""),e.i18n.languages={},e.i18n.messageStore=e.i18n.messageStore||{},e.i18n.parser={parse:function(e,t){return e.replace(/\$(\d+)/g,function(e,n){var i=parseInt(n,10)-1;return void 0!==t[i]?t[i]:"$"+n})},emitter:{}},e.i18n.debug=!1,i.defaults={locale:String.locale,fallbackLocale:"en",parser:e.i18n.parser,messageStore:e.i18n.messageStore,messageLocationResolver:null},e.I18N=i}(jQuery),function(e){var t=function(){this.language=e.i18n.languages[String.locale]||e.i18n.languages["default"]};t.prototype={constructor:t,emit:function(t,n){var i,o,a=this;switch(typeof t){case"string":case"number":i=t;break;case"object":if(i=e.map(t.slice(1),function(e){return a.emit(e,n)}),o=t[0].toLowerCase(),"function"!=typeof a[o])throw Error('unknown operation "'+o+'"');i=a[o](i,n);break;case"undefined":i="";break;default:throw Error("unexpected type in AST: "+typeof t)}return i},concat:function(t){var n="";return e.each(t,function(e,t){n+=t}),n},replace:function(e,t){var n=parseInt(e[0],10);return t.length>n?t[n]:"$"+(n+1)},plural:function(e){var t=parseFloat(this.language.convertNumber(e[0],10));return e=e.slice(1),e.length?this.language.convertPlural(t,e):""},gender:function(e){var t=e[0];return e=e.slice(1),this.language.gender(t,e)},grammar:function(e){var t=e[0];return(e=e[1])&&t&&this.language.convertGrammar(e,t)}},e.extend(e.i18n.parser.emitter,new t)}(jQuery),function(e){e.i18n=e.i18n||{},e.i18n.fallbacks={ab:["ru"],ace:["id"],aln:["sq"],als:["gsw","de"],an:["es"],anp:["hi"],arn:["es"],arz:["ar"],av:["ru"],ay:["es"],ba:["ru"],bar:["de"],"bat-smg":["sgs","lt"],bcc:["fa"],"be-x-old":["be-tarask"],bh:["bho"],bjn:["id"],bm:["fr"],bpy:["bn"],bqi:["fa"],bug:["id"],"cbk-zam":["es"],ce:["ru"],crh:["crh-latn"],"crh-cyrl":["ru"],csb:["pl"],cv:["ru"],"de-at":["de"],"de-ch":["de"],"de-formal":["de"],dsb:["de"],dtp:["ms"],egl:["it"],eml:["it"],ff:["fr"],fit:["fi"],"fiu-vro":["vro","et"],frc:["fr"],frp:["fr"],frr:["de"],fur:["it"],gag:["tr"],gan:["gan-hant","zh-hant","zh-hans"],"gan-hans":["zh-hans"],"gan-hant":["zh-hant","zh-hans"],gl:["pt"],glk:["fa"],gn:["es"],gsw:["de"],hif:["hif-latn"],hsb:["de"],ht:["fr"],ii:["zh-cn","zh-hans"],inh:["ru"],iu:["ike-cans"],jut:["da"],jv:["id"],kaa:["kk-latn","kk-cyrl"],kbd:["kbd-cyrl"],khw:["ur"],kiu:["tr"],kk:["kk-cyrl"],"kk-arab":["kk-cyrl"],"kk-latn":["kk-cyrl"],"kk-cn":["kk-arab","kk-cyrl"],"kk-kz":["kk-cyrl"],"kk-tr":["kk-latn","kk-cyrl"],kl:["da"],"ko-kp":["ko"],koi:["ru"],krc:["ru"],ks:["ks-arab"],ksh:["de"],ku:["ku-latn"],"ku-arab":["ckb"],kv:["ru"],lad:["es"],lb:["de"],lbe:["ru"],lez:["ru"],li:["nl"],lij:["it"],liv:["et"],lmo:["it"],ln:["fr"],ltg:["lv"],lzz:["tr"],mai:["hi"],"map-bms":["jv","id"],mg:["fr"],mhr:["ru"],min:["id"],mo:["ro"],mrj:["ru"],mwl:["pt"],myv:["ru"],mzn:["fa"],nah:["es"],nap:["it"],nds:["de"],"nds-nl":["nl"],"nl-informal":["nl"],no:["nb"],os:["ru"],pcd:["fr"],pdc:["de"],pdt:["de"],pfl:["de"],pms:["it"],pt:["pt-br"],"pt-br":["pt"],qu:["es"],qug:["qu","es"],rgn:["it"],rmy:["ro"],"roa-rup":["rup"],rue:["uk","ru"],ruq:["ruq-latn","ro"],"ruq-cyrl":["mk"],"ruq-latn":["ro"],sa:["hi"],sah:["ru"],scn:["it"],sg:["fr"],sgs:["lt"],sli:["de"],sr:["sr-ec"],srn:["nl"],stq:["de"],su:["id"],szl:["pl"],tcy:["kn"],tg:["tg-cyrl"],tt:["tt-cyrl","ru"],"tt-cyrl":["ru"],ty:["fr"],udm:["ru"],ug:["ug-arab"],uk:["ru"],vec:["it"],vep:["et"],vls:["nl"],vmf:["de"],vot:["fi"],vro:["et"],wa:["fr"],wo:["fr"],wuu:["zh-hans"],xal:["ru"],xmf:["ka"],yi:["he"],za:["zh-hans"],zea:["nl"],zh:["zh-hans"],"zh-classical":["lzh"],"zh-cn":["zh-hans"],"zh-hant":["zh-hans"],"zh-hk":["zh-hant","zh-hans"],"zh-min-nan":["nan"],"zh-mo":["zh-hk","zh-hant","zh-hans"],"zh-my":["zh-sg","zh-hans"],"zh-sg":["zh-hans"],"zh-tw":["zh-hant","zh-hans"],"zh-yue":["yue"]}
}(jQuery),function(e){e.extend(e.i18n.languages,{"default":{pluralRules:{gv:{one:"n mod 10 in 1..2 or n mod 20 is 0"},gu:{one:"n is 1"},rof:{one:"n is 1"},ga:{few:"n in 3..6",many:"n in 7..10",two:"n is 2",one:"n is 1"},gl:{one:"n is 1"},lg:{one:"n is 1"},lb:{one:"n is 1"},xog:{one:"n is 1"},ln:{one:"n in 0..1"},lo:"",brx:{one:"n is 1"},tr:"",ts:{one:"n is 1"},tn:{one:"n is 1"},to:"",lt:{few:"n mod 10 in 2..9 and n mod 100 not in 11..19",one:"n mod 10 is 1 and n mod 100 not in 11..19"},tk:{one:"n is 1"},th:"",ksb:{one:"n is 1"},te:{one:"n is 1"},ksh:{zero:"n is 0",one:"n is 1"},fil:{one:"n in 0..1"},haw:{one:"n is 1"},kcg:{one:"n is 1"},ssy:{one:"n is 1"},yo:"",de:{one:"n is 1"},ko:"",da:{one:"n is 1"},dz:"",dv:{one:"n is 1"},guw:{one:"n in 0..1"},shi:{few:"n in 2..10",one:"n within 0..1"},el:{one:"n is 1"},eo:{one:"n is 1"},en:{one:"n is 1"},ses:"",teo:{one:"n is 1"},ee:{one:"n is 1"},kde:"",fr:{one:"n within 0..2 and n is not 2"},eu:{one:"n is 1"},et:{one:"n is 1"},es:{one:"n is 1"},seh:{one:"n is 1"},ru:{few:"n mod 10 in 2..4 and n mod 100 not in 12..14",many:"n mod 10 is 0 or n mod 10 in 5..9 or n mod 100 in 11..14",one:"n mod 10 is 1 and n mod 100 is not 11"},kl:{one:"n is 1"},sms:{two:"n is 2",one:"n is 1"},smn:{two:"n is 2",one:"n is 1"},smj:{two:"n is 2",one:"n is 1"},smi:{two:"n is 2",one:"n is 1"},fy:{one:"n is 1"},rm:{one:"n is 1"},ro:{few:"n is 0 OR n is not 1 AND n mod 100 in 1..19",one:"n is 1"},bn:{one:"n is 1"},sma:{two:"n is 2",one:"n is 1"},be:{few:"n mod 10 in 2..4 and n mod 100 not in 12..14",many:"n mod 10 is 0 or n mod 10 in 5..9 or n mod 100 in 11..14",one:"n mod 10 is 1 and n mod 100 is not 11"},bg:{one:"n is 1"},ms:"",wa:{one:"n in 0..1"},ps:{one:"n is 1"},wo:"",bm:"",jv:"",bo:"",bh:{one:"n in 0..1"},kea:"",asa:{one:"n is 1"},cgg:{one:"n is 1"},br:{few:"n mod 10 in 3..4,9 and n mod 100 not in 10..19,70..79,90..99",many:"n mod 1000000 is 0 and n is not 0",two:"n mod 10 is 2 and n mod 100 not in 12,72,92",one:"n mod 10 is 1 and n mod 100 not in 11,71,91"},bs:{few:"n mod 10 in 2..4 and n mod 100 not in 12..14",many:"n mod 10 is 0 or n mod 10 in 5..9 or n mod 100 in 11..14",one:"n mod 10 is 1 and n mod 100 is not 11"},ja:"",om:{one:"n is 1"},fa:"",vun:{one:"n is 1"},or:{one:"n is 1"},xh:{one:"n is 1"},nso:{one:"n in 0..1"},ca:{one:"n is 1"},cy:{few:"n is 3",zero:"n is 0",many:"n is 6",two:"n is 2",one:"n is 1"},cs:{few:"n in 2..4",one:"n is 1"},zh:"",lv:{zero:"n is 0",one:"n mod 10 is 1 and n mod 100 is not 11"},pt:{one:"n is 1"},wae:{one:"n is 1"},tl:{one:"n in 0..1"},chr:{one:"n is 1"},pa:{one:"n is 1"},ak:{one:"n in 0..1"},pl:{few:"n mod 10 in 2..4 and n mod 100 not in 12..14",many:"n is not 1 and n mod 10 in 0..1 or n mod 10 in 5..9 or n mod 100 in 12..14",one:"n is 1"},hr:{few:"n mod 10 in 2..4 and n mod 100 not in 12..14",many:"n mod 10 is 0 or n mod 10 in 5..9 or n mod 100 in 11..14",one:"n mod 10 is 1 and n mod 100 is not 11"},am:{one:"n in 0..1"},ti:{one:"n in 0..1"},hu:"",hi:{one:"n in 0..1"},jmc:{one:"n is 1"},ha:{one:"n is 1"},he:{one:"n is 1"},mg:{one:"n in 0..1"},fur:{one:"n is 1"},bem:{one:"n is 1"},ml:{one:"n is 1"},mo:{few:"n is 0 OR n is not 1 AND n mod 100 in 1..19",one:"n is 1"},mn:{one:"n is 1"},mk:{one:"n mod 10 is 1 and n is not 11"},ur:{one:"n is 1"},bez:{one:"n is 1"},mt:{few:"n is 0 or n mod 100 in 2..10",many:"n mod 100 in 11..19",one:"n is 1"},uk:{few:"n mod 10 in 2..4 and n mod 100 not in 12..14",many:"n mod 10 is 0 or n mod 10 in 5..9 or n mod 100 in 11..14",one:"n mod 10 is 1 and n mod 100 is not 11"},mr:{one:"n is 1"},ta:{one:"n is 1"},my:"",sah:"",ve:{one:"n is 1"},af:{one:"n is 1"},vi:"",is:{one:"n is 1"},iu:{two:"n is 2",one:"n is 1"},it:{one:"n is 1"},kn:"",ii:"",ar:{few:"n mod 100 in 3..10",zero:"n is 0",many:"n mod 100 in 11..99",two:"n is 2",one:"n is 1"},zu:{one:"n is 1"},saq:{one:"n is 1"},az:"",tzm:{one:"n in 0..1 or n in 11..99"},id:"",ig:"",pap:{one:"n is 1"},nl:{one:"n is 1"},nn:{one:"n is 1"},no:{one:"n is 1"},nah:{one:"n is 1"},nd:{one:"n is 1"},ne:{one:"n is 1"},ny:{one:"n is 1"},naq:{two:"n is 2",one:"n is 1"},nyn:{one:"n is 1"},kw:{two:"n is 2",one:"n is 1"},nr:{one:"n is 1"},tig:{one:"n is 1"},kab:{one:"n within 0..2 and n is not 2"},mas:{one:"n is 1"},rwk:{one:"n is 1"},kaj:{one:"n is 1"},lag:{zero:"n is 0",one:"n within 0..2 and n is not 0 and n is not 2"},syr:{one:"n is 1"},kk:{one:"n is 1"},ff:{one:"n within 0..2 and n is not 2"},fi:{one:"n is 1"},fo:{one:"n is 1"},ka:"",gsw:{one:"n is 1"},ckb:{one:"n is 1"},ss:{one:"n is 1"},sr:{few:"n mod 10 in 2..4 and n mod 100 not in 12..14",many:"n mod 10 is 0 or n mod 10 in 5..9 or n mod 100 in 11..14",one:"n mod 10 is 1 and n mod 100 is not 11"},sq:{one:"n is 1"},sw:{one:"n is 1"},sv:{one:"n is 1"},km:"",st:{one:"n is 1"},sk:{few:"n in 2..4",one:"n is 1"},sh:{few:"n mod 10 in 2..4 and n mod 100 not in 12..14",many:"n mod 10 is 0 or n mod 10 in 5..9 or n mod 100 in 11..14",one:"n mod 10 is 1 and n mod 100 is not 11"},so:{one:"n is 1"},sn:{one:"n is 1"},ku:{one:"n is 1"},sl:{few:"n mod 100 in 3..4",two:"n mod 100 is 2",one:"n mod 100 is 1"},sg:"",nb:{one:"n is 1"},se:{two:"n is 2",one:"n is 1"}},convertPlural:function(t,n){var i;return n&&0!==n.length?(i=this.pluralRules[e.i18n().locale])?(i=this.getPluralForm(t,i),i=Math.min(i,n.length-1),n[i]):1===t?n[0]:n[1]:""},getPluralForm:function(e,t){var n,i="zero one two few many other".split(" "),o=0;for(n=0;i.length>n;n++)if(t[i[n]]){if(pluralRuleParser(t[i[n]],e))break;o++}return o},convertNumber:function(t,n){var i,o,a,s,r;if(a=this.digitTransformTable(e.i18n().locale),s=""+t,r="",!a)return t;if(n){if(parseFloat(t,10)===t)return t;i=[];for(o in a)i[a[o]]=o;a=i}for(i=0;s.length>i;i++)r=a[s[i]]?r+a[s[i]]:r+s[i];return n?parseFloat(r,10):r},convertGrammar:function(e){return e},gender:function(e,t){if(!t||0===t.length)return"";for(;2>t.length;)t.push(t[t.length-1]);return"male"===e?t[0]:"female"===e?t[1]:3===t.length?t[2]:t[0]},digitTransformTable:function(e){var t={ar:"٠١٢٣٤٥٦٧٨٩",fa:"۰۱۲۳۴۵۶۷۸۹",ml:"൦൧൨൩൪൫൬൭൮൯",kn:"೦೧೨೩೪೫೬೭೮೯",lo:"໐໑໒໓໔໕໖໗໘໙",or:"୦୧୨୩୪୫୬୭୮୯",kh:"០១២៣៤៥៦៧៨៩",pa:"੦੧੨੩੪੫੬੭੮੯",gu:"૦૧૨૩૪૫૬૭૮૯",hi:"०१२३४५६७८९",my:"၀၁၂၃၄၅၆၇၈၉",ta:"௦௧௨௩௪௫௬௭௮௯",te:"౦౧౨౩౪౫౬౭౮౯",th:"๐๑๒๓๔๕๖๗๘๙",bo:"༠༡༢༣༤༥༦༧༨༩"};return t[e]?t[e].split(""):!1}}})}(jQuery),function(e,t){var n=function(){this.messages={},this.sources={},this.locale=String.locale};n.prototype={init:function(t){var n=this;n.locale=t,n.log("initializing for "+t),e("link").each(function(t,i){var o=e(i),a=(o.attr("rel")||"").toLowerCase().split(/\s+/);-1!==e.inArray("localizations",a)?n.load(o.attr("href")):-1!==e.inArray("localization",a)&&n.queue((o.attr("hreflang")||"").toLowerCase(),o.attr("href"))})},load:function(e,t){var n=null,i=this,o=Object.prototype.hasOwnProperty;if(e)if("string"==typeof e)i.log("Loading messages from: "+e),i.jsonMessageLoader(e).done(function(n){i.load(n,t),i.queue(t,e),i.markLoaded(t,e)});else for(n in e)o.call(e,n)&&(t?(i.messages[t]||(i.messages[t]={}),i.messages[t][n]=e[n],i.log("["+t+"]["+n+"] : "+e[n])):i.load(e[n],n));else i.log("Resetting for locale "+t),i.messages={}},log:function(){t.console&&e.i18n.debug&&t.console.log.apply(t.console,arguments)},markLoaded:function(e,t){var n,i=this.sources[e];for(i||(this.queue(e,t),i=this.sources[e]),this.sources[e]=this.sources[e]||[],n=0;i.length>n;n++)if(i[n].source.url===t){i[n].source.loaded=!0;break}},queue:function(e,t){var n,i=this.sources[e];if(this.sources[e]=this.sources[e]||[],i)for(n=0;i.length>n;n++)if(i[n].source.url===t)return;this.log("Source for: "+e+" is "+t+" registered"),this.sources[e].push({source:{url:t,loaded:!1}})},loadFromQueue:function(e){var t,n=this.sources[e];if(n)for(t=0;n.length>t;t++)n[t].source.loaded||(this.load(n[t].source.url,e),this.sources[e][t].source.loaded=!0)},isLoaded:function(e,t){var n,i=this.sources[e],o=!1;if(i)for(n=0;i.length>n;n++)i[n].source.url===t&&(o=!0);return o},jsonMessageLoader:function(t){var n=this;return e.ajax({url:t,dataType:"json",async:!1}).fail(function(e,i,o){n.log("Error in loading messages from "+t+" Exception: "+o)})},get:function(e,t){return this.messages[e]||this.loadFromQueue(e),this.messages[e]&&this.messages[e][t]}},e.extend(e.i18n.messageStore,new n)}(jQuery,window),function(e){var t=function(t){this.options=e.extend({},e.i18n.parser.defaults,t),this.language=e.i18n.languages[String.locale]||e.i18n.languages["default"],this.emitter=e.i18n.parser.emitter};t.prototype={constructor:t,simpleParse:function(e,t){return e.replace(/\$(\d+)/g,function(e,n){var i=parseInt(n,10)-1;return void 0!==t[i]?t[i]:"$"+n})},parse:function(t,n){return 0>t.indexOf("{{")?this.simpleParse(t,n):(this.emitter.language=e.i18n.languages[e.i18n().locale]||e.i18n.languages["default"],this.emitter.emit(this.ast(t),n))},ast:function(e){function t(e){return function(){var t,n;for(t=0;e.length>t;t++)if(n=e[t](),null!==n)return n;return null}}function n(e){var t,n,i=d,o=[];for(t=0;e.length>t;t++){if(n=e[t](),null===n)return d=i,null;o.push(n)}return o}function i(e,t){return function(){for(var n=d,i=[],o=t();null!==o;)i.push(o),o=t();return e>i.length?(d=n,null):i}}function o(t){var n=t.length;return function(){var i=null;return e.substr(d,n)===t&&(i=t,d+=n),i}}function a(t){return function(){var n=e.substr(d).match(t);return null===n?null:(d+=n[0].length,n[0])}}function s(){var e=n([m,g]);return null===e?null:e[1]}function r(){var e=n([_,v]);return null===e?null:["REPLACE",parseInt(e[1],10)-1]}function l(){var e=n([p,i(0,A)]);return null===e?null:(e=e[1],e.length>1?["CONCAT"].concat(e):e[0])}function c(){var e=n([x,f,r]);return null===e?null:[e[0],e[2]]}function u(){var e=n([x,f,A]);return null===e?null:[e[0],e[2]]}function h(){var e=n([S,T,P]);return null===e?null:e[1]}var d=0,p=o("|"),f=o(":"),m=o("\\"),g=a(/^./),_=o("$"),v=a(/^\d+/),y=a(/^[^{}\[\]$\\]/),w=a(/^[^{}\[\]$\\|]/),b=a(/^[^{}\[\]$\s]/);t([s,b]);var x,k=t([s,w]),C=t([s,y]),E=a(/^[ !"$&'()*,.\/0-9;=?@A-Z\^_`a-z~\x80-\xFF+\-]+/);x=function(){var e=E();return null===e?null:""+e};var T=t([function(){var e=n([t([c,u]),i(0,l)]);return null===e?null:e[0].concat(e[1])},function(){var e=n([x,i(0,l)]);return null===e?null:[e[0]].concat(e[1])}]),S=o("{{"),P=o("}}"),y=t([h,r,function(){var e=i(1,C)();return null===e?null:e.join("")}]),A=t([h,r,function(){var e=i(1,k)();return null===e?null:e.join("")}]);if(y=i(0,y)(),y=null===y?null:["CONCAT"].concat(y),null===y||d!==e.length)throw Error("Parse error at position "+(""+d)+" in input: "+e);return y}},e.extend(e.i18n.parser,new t)}(jQuery),define("jquery.i18n",["jquery","CLDRPluralRuleParser"],function(){}),define("modules/common/utility",["modules/common/date_format","modules/common/local_storage","underscore","jquery.mousewheel","jquery.i18n"],function(e,t,n){Date.now||(Date.now=function(){return+new Date});var i={};i.is_pushstate_enabled=function(){return window.history&&window.history.pushState},i.isNode=function(e){return"object"==typeof Node?e instanceof Node:e&&"object"==typeof e&&"number"==typeof e.nodeType&&"string"==typeof e.nodeName},i.isElement=function(e){return"object"==typeof HTMLElement?e instanceof HTMLElement:e&&"object"==typeof e&&null!==e&&1===e.nodeType&&"string"==typeof e.nodeName},i.show_document_title=function(e,t){var n="";e=""===e?document.title:e;var i=/\([0-9]+\)?/g,o=t||0,a=document.title.match(i);n=0===o?e.replace(a+" ",""):a&&o>0?e.replace(a,"("+t+")"):"("+o+") "+e,document.title=n.replace("(0) ","")},i.isolate_scroll=function(e){var t=$(e);t.on("mousewheel",function(e,n){var i=t.height(),o=t.get(0).scrollHeight;(this.scrollTop===o-i&&0>n||0===this.scrollTop&&n>0)&&e.preventDefault()})},i.show_success=function(e){this.show_message("success",e)},i.show_error=function(e){this.show_message("error",e)},i.show_info=function(e){this.show_message("info",e)},i.show_message=function(e,t){e=e!==void 0?e:"info";var n=(new Date).getTime(),i='<div id="alert-message-'+n+'" class="alert alert-'+e+'">'+'<button type="button" class="close" data-dismiss="alert">&times;</button>'+'<i class="ico ico-16 ico-alert-'+e+'"></i> '+t+"</div>";$("#alert-message").append(i),window.setTimeout(function(){$("#alert-message-"+n).fadeOut("slow",function(){$(this).remove()})},5e3)},i.parse_location_href=function(){return this.is_pushstate_enabled()?location.href:url.site&&location.hash&&0===location.hash.indexOf("#")?url.site+location.hash.slice(1):location.href},i.parse_ajax_response=function(e){return e.error?e.error.errno?{error:e.error.message}:e.data:e},i.get_profile_url=function(e){return url.personalized+"/"+e},i.get_display_picture_url=function(e,t,i,o){return n.isEmpty(e)?"":(t=t!==void 0?t:1,i=i!==void 0?i:48,o=o!==void 0?o:48,url.image+"/"+(1==t?"a":"u")+"/"+e+"?w="+i+"&h="+o+"&a=1&c=1")},i.get_badge_image_url=function(e,t){return t=t!==void 0?t:64,url.cdn+"/resources/img/badges/"+t+"x"+t+"/"+e},i.get_gift_image_url=function(e,t,n){return t=t!==void 0?t:64,n=n!==void 0?n:"png",url.migcore+"/images/emoticons/virtualgifts/"+e+"_"+t+"."+n},i.get_gender=function(e){switch(e){case"M":return variable.gender.name.M;case"F":return variable.gender.name.F}},i.block_function=function(e){var t=function(){};return t.__blocked_function=e,t},i.unblock_function=function(e){return e.__blocked_function&&n.isFunction(e.__blocked_function)?e.__blocked_function:e},i.translate=function(){return $.i18n.apply(this,arguments)},i.format=function(){for(var e=arguments[0]||"",t=1;arguments.length>t;t++){var n=RegExp("\\{"+(t-1)+"\\}","gi");e=e.replace(n,arguments[t])}return e},i.is_logged_in=function(){var e=!n.isUndefined(session_user)&&!n.isNull(session_user),t=!n.isUndefined(session_user.username)&&!n.isNull(session_user.username);return e&&t},i.show_login_box=function(){var e=/\/u\/(.+)/g,t=window.location.pathname;e.exec(t);var n="login-modal";$("#"+n).length>0&&$("#"+n).remove(),console.log("url:"),console.log(url);var i='<div id="'+n+'" data-backdrop="static" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="login-modal-label" aria-hidden="true">'+'<div class="modal-header">'+'<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>'+"</div>"+'<div class="col login-col">'+'<div class="modal-body">'+"<h4>"+this.translate("login|login")+"</h4>"+'<form action="'+url.login+'" method="post" accept-charset="utf-8">'+"<fieldset>"+'<div class="wrapper">'+'<input type="hidden" name="return_url" value="'+window.location.href+'"/>'+'<label for="username">'+this.translate("login|username")+":</label>"+'<input type="text" name="username" id="username"/>'+'<label for="password">'+this.translate("login|password")+":</label>"+'<input type="password" name="password" id="password"/>'+'<div class="control-group">'+'<a href="/sites/corporate/forgot_password/details" data-toggle="modal" data-target="#'+n+'">'+this.translate("login|forgot_password")+"</a>"+"</div>"+"</div>"+'<div class="control-group">'+'<button type="submit" class="btn btn-login">'+this.translate("login|login")+"</button>"+"</div>"+"</fieldset>"+"</form>"+"</div>"+"</div>"+'<div class="col join-col">'+'<div class="modal-body">'+"<h4>"+this.translate("login|join_us")+"</h4>"+'<div class="wrapper">'+"<ul>"+"<li>"+'<span class="icon icon-chat"/>'+"<h5>"+this.translate("login|chat")+"</h5>"+"<p>"+this.translate("login|chat_desc")+"</p>"+"</li>"+"<li>"+'<span class="icon icon-fun"/>'+"<h5>"+this.translate("login|fun")+"</h5>"+"<p>"+this.translate("login|fun_desc")+"</p>"+"</li>"+"<li>"+'<span class="icon icon-mobile"/>'+"<h5>"+this.translate("login|mobile")+"</h5>"+"<p>"+this.translate("login|mobile_desc")+"</p>"+"</li>"+"</ul>"+"</div>"+'<div class="control-group">'+'<a href="'+url.register+'" class="btn btn-signup" data-bypass="true">'+this.translate("login|create_account")+"</a>"+"</div>"+'<div class="control-group">'+'<a href="'+url.fblogin+'" class="btn btn-fb">'+'<span class="icon"></span><span class="text">'+this.translate("login|connect_with_facebook")+"</span>"+"</a>"+"</div>"+"</div>"+"</div>"+'<div class="modal-footer">'+"</div>"+"</div>";$("#main-container").append(i),$("#"+n).modal("show")},i.add_thousands_seperator=function(e){e+="";for(var t=e.split("."),n=t[0],i=t.length>1?"."+t[1]:"",o=/(\d+)(\d{3})/;o.test(n);)n=n.replace(o,"$1,$2");return n+i},i.round_number_decimal=function(e,t){return t=t!==void 0?t:1,Math.round(e*Math.pow(10,t))/Math.pow(10,t)},i.number_format=function(e,t){if(e=parseFloat(e),isNaN(e))return e;t||(t=0);var n=Math.pow(10,t);return Math.floor(e*n+(10*e*n%10>=5?1:0))/n},i.round_number=function(e,t,n){if(t=t!==void 0?t:1e6,n=n!==void 0?n:1,t>e)return this.add_thousands_seperator(e);var i={1e9:"B",1e6:"M",1e3:"K"};for(var o in i)if(e>=o)return this.round_number_decimal(e/o)+""+i[o]},i.strip_tags=function(e){return e?e.replace(/<\/?[^>]+(>|$)/g,""):void 0},i.htmlspecialchars=function(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")},i.character_limiter=function(e,t){return e===void 0?e:e.length>t?e.substring(0,t)+"...":e};var o,a,s,r,l=function(e,t){return s[t]},c=function(e,t){return t in r?r[t]:String.fromCharCode(parseInt(t.substr(2),10))};i.addCharacterEntities=function(e){var t,n,i=[],l=[];for(t in e)n=e[t],r[t]=n,s[n]=t,i.push(n),l.push(t);o=RegExp("("+i.join("|")+")","g"),a=RegExp("("+l.join("|")+"|&#[0-9]{1,5};"+")","g")},i.resetCharacterEntities=function(){s={},r={},this.addCharacterEntities({"&amp;":"&","&gt;":">","&lt;":"<","&quot;":'"'})},i.htmlEncode=function(e){return e?(e+"").replace(o,l):e},i.htmlDecode=function(e){return e?(e+"").replace(a,c):e},i.resetCharacterEntities(),i.dateFormat=function(t,n,i){return e.format(t,n,i)},i.lpad=function(e,t,i){if(!n.isString(e))throw"lpad function expects a string as the first param";for(var o=e;i>o.length;)o=t+o;return o},i.rpad=function(e,t,i){if(!n.isString(e))throw"rpad function expects a string as the first param";for(var o=e;i>o.length;)o+=t;return o};var u=0,h="mig33";i.set_global_function=function(e){var t=[h,"handler",++u,(new Date).getTime()].join("_");return window[t]=e,t},i.delete_global_function=function(e){return delete window[e],!0};var d=Math.random,p="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx";return i.get_uuid=function(){return p.replace(/[xy]/g,function(e){var t=0|16*d(),n="x"==e?t:8|3&t;return n.toString(16)})},i.get_guid=i.get_uuid,window.show_error=i.show_error,window.show_success=i.show_success,window.show_message=i.show_message,i}),define("modules/common/session_user",["backbone","modules/common/utility","modules/common/config","modules/common/local_storage"],function(e,t,n,i){var o={},a=null,s=!1;return o.Model=e.Model.extend({defaults:function(){return{commit:{}}},getLayoutType:function(){var e=n.layoutType.feed;return i.hasKey("_layout_type")&&(e=i.get("_layout_type")),this.get("layoutType")||e},setLayoutType:function(e){switch(e){case n.layoutType.feed:case n.layoutType.tile:this.set("layoutType",e),this.trigger("layouttype:change"),i.set("_layout_type",e)}},initialize:function(){var e=this,t=require("modules/mig33_app");t.vent.on(t.ApplicationEvents.ACCOUNT_BALANCE,function(t){e.set("account_balance",t)})}}),o.initialize=function(e){return a=new o.Model(e),o.setup_session_user_shim(e),s=!0,a},o.getInstance=function(){return a},o.hasInitialized=function(){return s},o.setup_session_user_shim=function(e){e&&(e.get=function(t){return e[t]},e.set=function(t,n){e[t]=n,a.set({key:n})})},o}),define("modules/common/task_runner",["underscore","backbone","jquery"],function(e){var t=function(){};return e.extend(t.prototype,{start:function(t){this.task_obj=t.scope||window,this.fire_on_start=t.fireOnStart,this.task_fn=t.run,this.task_interval=t.interval||5e3,this.bound_fn=e.bind(this.task_fn,this.task_obj),this.stopped=!1,this.timeout_id=null,this.fire_on_start?this.run():this.check_run()},check_run:function(){if(!this.stopped){var e=this;this.timeout_id=setTimeout(function(){e.run()},this.task_interval)}},run:function(){e.defer(this.bound_fn),this.check_run()},stop:function(){this.stopped=!0,null!==this.timeout_id&&window.clearInterval(this.timeout_id)},clear:function(){this.stop(),this.stopped=!0,this.task_obj=null,this.fire_on_start=null,this.task_fn=null,this.task_interval=null,this.bound_fn=null,this.timeout_id=null}}),t}),define("modules/chat/data/transport_queue",["modules/common/task_runner","underscore","backbone","jquery"],function(e,t){var n={};return t.extend(n,{queue:[],queue_monitor:new e,monitor_timeout:2e4,max_packet_retry:3,config:{transport:null},setTransport:function(e){this.transport=e},start_monitor:function(){this.queue_monitor.clear(),this.queue_monitor.start({scope:this,fireOnStart:!1,run:function(){this.check_queue()},interval:this.monitor_timeout})},stop_monitor:function(){this.queue_monitor.stop()},check_queue:function(){if(this.queue.length>0){var e=this.queue.shift();e.retry_count<this.max_packet_retry&&(e.sent_time=Date.now(),e.retry_count+=1,this.queue.unshift(e),this.transport.send_packet(e,e.callback,e.scope),this.start_monitor())}},add_packet:function(e){var t=0===this.queue.length;this.queue.push(e),t&&this.check_queue()},remove_packet:function(e){if(e.queue===!1||0===this.queue.length)return!1;var t=this.queue[0];return t.transaction_id===e.transaction_id?(this.queue.shift(),!0):!1}}),n}),define("modules/chat/data/thread_manager",["underscore","backbone","jquery"],function(e){var t={};return e.extend(t,{queue:[],timeout:0,process_size:1e3,timer:null,queue_worker:function(t,n){this.queue.push(t),e.isUndefined(n)||n!==!0||this.start()},execute:function(){this.timer=null,e.times(this.process_size,function(){var e=this.queue.shift();e&&(e.working===!1?(e.working=!0,e.execute(),e.working=!1):this.queue.unshift(e))},this),this.queue.length>0?this.start():this.stop()},start:function(){var e=this;null===this.timer&&(this.timer=setTimeout(function(){e.execute()},this.timeout))},stop:function(){null!==this.timer&&clearTimeout(this.timer),this.timer=null}}),t}),define("modules/chat/fusion/packet_defs",[],function(){var e={};return e.FUSION_PACKET_TYPES={ACCEPT_CONTACT_REQUEST:413,ACCOUNT_BALANCE:902,ACTIVATE_ACCOUNT:204,ADD_CONTACT:405,ADD_FAVOURITE_CHATROOM:711,ADD_GROUP:408,ALERT:5,ANONYMOUS_CALL_NOTIFICATION:806,ANONYMOUS_CALL_RESPONSE:807,APPLICATION_MENU:933,APPLICATION_MENU_COMPLETE:934,AVATAR:603,CAPTCHA:16,CAPTCHA_RESPONSE:17,CHANGE_PASSWORD:908,CHANGE_USER_EVENT_SETTING:921,CHAT:560,CHATROOM:701,CHATROOM_CATEGORY:714,CHATROOM_NOTIFICATION:718,CHATROOM_PARTICIPANTS:708,CHATROOM_THEME:719,CHATROOM_USER_STATUS:720,CHAT_LIST_VERSION:561,CLEAR_EMOTICON:915,COMPARE_CALL_RATE:805,CONTACT:402,CONTACT_LIST_VERSION:420,CONTACT_REQUEST:412,CREATE_CHATROOM:705,CREATE_GROUP_CHAT:751,CREATE_SESSION:211,DEVICE_MODE:604,DIAL:804,DISPLAY_PICTURE:423,DYNAMIC_MENU:911,DYNAMIC_MENU_ICON:930,EMOTICON:914,EMOTICON_HOTKEYS:916,END_MESSAGES:562,END_STICKER_PACK:942,ERROR:0,FILE_RECEIVED:502,FORGOT_PASSWORD:904,GET_ACCOUNT_BALANCE:901,GET_CATEGORIZED_CHATROOMS:716,GET_CATEGORIZED_CHATROOMS_COMPLETE:717,GET_CHATROOMS:700,GET_CHATROOMS_COMPLETE:702,GET_CHATROOM_CATEGORIES:713,GET_CHATROOM_CATEGORIES_COMPLETE:715,GET_CHATROOM_PARTICIPANTS:707,GET_CHATS:551,GET_CONTACTS:400,GET_CONTACTS_COMPLETE:403,GET_CONTACT_REQUESTS:425,GET_DYNAMIC_MENU_ICON:929,GET_EMOTICON:913,GET_EMOTICONS_COMPLETE:928,GET_EMOTICON_HOTKEYS:937,GET_GIFT:935,GET_GROUP_CHAT_PARTICIPANTS:754,GET_HELP_TEXT:7,GET_IM_ICONS:926,GET_MESSAGES:550,GET_MIDLET_PROPERTY:12,GET_PERMISSION_LIST:415,GET_PRELOGIN_MARKETING_MSG:931,GET_STICKER_PACK:940,GET_STICKER_PACK_LIST:938,GET_UPLOAD_DATA_TICKET:959,GET_URL:910,GET_USER_INIT_DETAILS:424,GET_USER_PROFILE:905,GIFT_HOTKEYS:936,GROUP:401,GROUP_CHAT:750,GROUP_CHAT_INVITE:752,GROUP_CHAT_PARTICIPANTS:755,GROUP_CHAT_USER_STATUS:756,HAVE_LATEST_CHAT_LIST:552,HAVE_LATEST_CONTACT_LIST:419,HELP_TEXT:6,HTTP_POLL:13,IM_AVAILABLE:208,IM_ICONS:927,IM_LOGIN:206,IM_LOGOUT:302,IM_SESSION_STATUS:207,INVITE_FRIEND:900,JOIN_CHATROOM:703,KICK_CHATROOM_PARTICIPANT:706,LANGUAGE:925,LATEST_MESSAGES_DIGEST:563,LEAVE_CHATROOM:704,LEAVE_GROUP_CHAT:753,LEAVE_PRIVATE_CHAT:507,LOGIN:200,LOGIN_CHALLENGE:201,LOGIN_OK:203,LOGIN_RESPONSE:202,LOGOUT:300,MAIL_INFO:503,MESSAGE:500,MESSAGE_EVENT:506,MIDLET_ACTION:920,MIDLET_PROPERTY:11,MIDLET_TAB:918,MOVE_CONTACT:411,MUTE_CHATROOM_PARTICIPANT:709,NEW_REGISTRATION:100,NOTIFICATION:14,OK:1,OPEN_URL:922,OPEN_URL_RESPONSE:923,PERMISSION_LIST:416,PHONE_CALL:800,PING:2,PING_REPLY:3,PRELOGIN_MARKETING_MSG:932,PRESENCE:404,RECHARGE:903,REGISTRATION:101,REGISTRATION_CHALLENGE:102,REGISTRATION_ERROR:104,REGISTRATION_RESPONSE:103,REJECT_CONTACT_REQUEST:414,REMOVE_CONTACT:406,REMOVE_FAVOURITE_CHATROOM:712,REMOVE_GROUP:409,REPORT:10,RESEND_VERIFICATION_CODE:205,RESERVED:15,SERVER_QUESTION:8,SERVER_QUESTION_REPLY:9,SESSION_TERMINATED:301,SET_CHAT_NAME:564,SET_DISPLAY_PICTURE:602,SET_MESSAGE_EVENT:505,SET_PERMISSION:417,SET_PRESENCE:600,SET_STATUS_MESSAGE:601,SLIM_LOGIN:209,SLIM_LOGIN_CHALLENGE:212,SLIM_LOGIN_OK:210,STATUS_MESSAGE:421,STICKER_PACK:941,STICKER_PACK_LIST:939,TEXT_COLOUR:924,TRANSFER_CREDIT:909,UNMUTE_CHATROOM_PARTICIPANT:710,UPDATE_CONTACT:407,UPDATE_GROUP:410,UPDATE_USER_PROFILE:907,UPLOAD_ADDRESS_BOOK_CONTACTS:960,UPLOAD_FILE:504,USER_EVENT:422,USER_PROFILE:906,VOICE_CAPABILITY:418,WALLPAPER:912,WAP_PUSH:501,WEBCALL:801,WEBCALL_NOTIFICATION:802,WEBCALL_RESPONSE:803},e.FUSION_PACKET_FIELDS={0:{errordescription:2,errornumber:1},1:{serverresponse:1},2:{},3:{},5:{alerttype:1,content:2,contenttype:3,timeout:5,title:4},6:{text:1},7:{id:1},8:{question:2,questiontype:1,timeout:5,title:4,url:3},9:{answer:1,questionid:2},10:{description:2,reporttype:1},11:{key:2,propertytype:1,value:3},12:{key:2,propertytype:1},13:{},14:{notificationtype:3,pendingnotificationstotal:4,text:1,url:2},15:{},16:{captchaimage:2,displaytext:1},17:{captcharesponse:1},100:{dateofbirth:8,displayname:5,emailaddress:9,firstname:6,groupid:12,imei:15,lastname:7,mobiledevice:14,mobilephone:4,password:3,servicetype:1,startupcardnumber:10,startupcardpin:11,useragent:13,username:2},101:{clienttype:3,screenheight:2,screenwidth:1},102:{captchaid:2,captchaimage:3,iddcode:1},103:{captchaid:4,captcharesponse:5,dateofbirth:8,groupid:6,imei:11,mobiledevice:10,mobilephone:3,password:2,useragent:9,username:1},104:{captchaid:2,captchaimage:3,errordescription:1},200:{applicationmenuversion:23,cellid:17,clienttype:2,clientversion:3,emailaddress:6,fontheight:11,initialpresence:9,language:15,localareacode:20,mobilecountrycode:22,mobiledevice:8,mobilenetworkcode:21,protocolversion:1,screenheight:13,screenwidth:12,servicetype:4,sessionid:18,stickersize:26,streamuserevents:19,themeid:16,useragent:7,username:5,vastrackingid:24,vgsize:25,voicecapability:10,wallpaperid:14},201:{challenge:1,sessionid:2},202:{passwordhash:1},203:{aimdetail:7,alert:3,alertcontenttype:4,anonymouscalling:25,asteriskid:9,asteriskserver:10,asteriskservers:5,badgehotkey:28,contactlistversion:20,currency:11,emoticonheight:16,exchangerate:12,facebookdetail:30,fusionpresence:34,gtalkdetail:17,imageserverurl:23,localdidsupport:18,mailcount:14,mailurl:13,mobilephone:1,mobileverified:2,msndetail:6,pageleturl:26,reputationimagepath:32,reputationlevel:31,sendconnectionreport:29,servertime:43,supportschatsync:40,supportsstickers:42,tcptunnelling:33,usereventstokeep:24,userid:38,username:39,usertype:27,virtualgiftsize:41,voipcodec:15,yahoodetail:8},204:{verificationcode:1},205:{mobilephone:1},206:{imtype:1,initialpresence:2,showofflinecontacts:3},207:{imtype:1,reason:3,status:2,supportsconference:4},208:{imdetail:4,imtype:1,messagetype:3,name:2,supportsgroupchat:5},209:{clienttype:2,clientversion:3,initialpresence:7,mobiledevice:9,password:6,protocolversion:10,servicetype:4,useragent:8,username:5},210:{sessionid:1},211:{applicationmenuversion:16,clienttype:2,clientversion:5,fontheight:10,initialpresence:8,language:15,mobiledevice:7,protocolversion:1,screenheight:12,screenwidth:11,sessionid:3,stickersize:19,streamuserevents:4,themeid:14,useragent:6,vastrackingid:17,vgsize:18,voicecapability:9,wallpaperid:13},212:{challenge:2,sessionid:1},300:{},301:{reason:1},302:{imtype:1},400:{contactid:2,presence:1},401:{groupid:1,groupname:2},402:{aimpresence:17,aimusername:16,contactid:1,defaultim:11,defaultphone:7,displayname:3,displaypicture:28,emailaddress:6,facebookpresence:30,facebookusername:29,firstname:4,fusionpresence:13,fusionusername:12,groupid:2,gtalkpresence:23,gtalkusername:22,homephone:9,icqpresence:21,icqusername:20,impresences:32,imtypes:31,imusernames:33,lastname:5,mobilephone:8,msnpresence:15,msnusername:14,officephone:10,sharemobilephone:24,statusmessage:27,voicecapability:25,yahoopresence:19,yahoousername:18},403:{},404:{aimpresence:4,contactid:1,facebookpresence:8,fusionpresence:2,gtalkpresence:7,icqpresence:6,impresences:10,imtypes:9,msnpresence:3,yahoopresence:5},405:{aimusername:16,defaultim:11,defaultphone:7,displayname:3,emailaddress:6,facebookusername:29,firstname:4,fusionusername:12,groupid:2,gtalkusername:22,homephone:9,icqusername:20,imtype:31,imusername:30,lastname:5,mobilephone:8,msnusername:14,officephone:10,sharemobilephone:24,yahoousername:18},406:{contactid:1},407:{aimuserame:16,contactid:1,defaultim:11,defaultphone:7,displayname:3,emailaddress:6,facebookuserame:29,firstname:4,fusionuserame:12,groupid:2,gtalkuserame:22,homephone:9,icquserame:20,imtypes:31,imusernames:30,lastname:5,mobilephone:8,msnuserame:14,officephone:10,yahoouserame:18},408:{groupname:2},409:{groupid:1},410:{groupid:1,groupname:2},411:{contactid:1,groupid:2},412:{profileurl:2,username:1},413:{addcontact:2,contactusername:1,groupid:3,sharemobilephone:4},414:{blockuser:2,contactusername:1},415:{listtype:1},416:{allowlist:1,blocklist:2},417:{permission:2,username:1},418:{contactid:1,voicecapability:2},419:{statustimestamp:1},420:{contactlistversion:1,statustimestamp:2},421:{contactid:1,statusmessage:2,statustimestamp:3},422:{eventtype:2,generatinguserprofileimageguid:3,secondsago:1,text:4,timestamp:5},423:{contactid:1,displaypicture:2,statustimestamp:3},424:{},425:{},500:{badgehotkey:14,contactid:5,contentasstring:8,contenttype:6,destination:4,destinationtype:3,displaypicture:10,emotecontenttype:20,filename:7,fromadministrator:9,groupchatname:17,groupchatowner:18,guid:15,hotkeys:11,messagecolor:13,messagetype:1,previousmessageguid:19,source:2,sourcecolor:12,timestamp:16},501:{username:1},502:{contactid:3,infomessage:4,source:2,sourcetype:1,url:5},503:{mailcount:1},504:{content:2,description:3,destination:4,filetype:1,useasdisplaypicture:5},505:{messagedestination:4,messagedestinationtype:3,messageeventtype:6,messageguid:5,messagesource:2,messagetype:1},506:{messagedestination:4,messagedestinationtype:3,messageeventtype:6,messageguid:5,messagesource:2,messagetype:1},507:{destinationusername:1,imtype:2},550:{chatidentifier:1,chattype:2,latestmessagetimestamp:3,limit:5,oldestmessagetimestamp:4},551:{chattype:3,limit:2,version:1},552:{timestamp:2,version:1},560:{chatdisplayname:2,chatidentifier:1,chatlisttimestamp:12,chatlistversion:11,chattype:3,contactid:5,displayguid:8,groupowner:6,isclosedchat:7,messagetype:9,timestamp:10,unreadmessagecount:4},561:{timestamp:2,version:1},562:{chatidentifier:1,finalmessageguid:3,firstmessageguid:2,messagessent:4},563:{chatid:1,guids:2,timestamps:3},564:{chatidentifier:1,chatname:3,chattype:2},600:{newpresence:1},601:{statusmessage:1},602:{displaypicture:1},603:{avatar:4,badgehotkey:3,displaypicture:2,fullbodyavatar:5,statusmessage:1},604:{devicemode:1},700:{chatroomnames:3,page:2,searchstring:1},701:{adultonly:5,category:6,chatroomid:9,chatroomname:1,creator:10,description:2,groupid:8,maximumsize:3,newowner:12,size:4,themeid:11,userowned:7},702:{infotext:2,pages:1},703:{chatroomname:1},704:{chatroomname:1},705:{chatroomname:1},706:{chatroomname:1,username:2},707:{chatroomname:1},708:{administrators:3,chatroomname:1,mutedparticipants:4,participants:2},709:{chatroomname:1,username:2},710:{chatroomname:1,username:2},711:{chatroomname:1},712:{category:1,chatroomname:2},713:{},714:{category:1,collapse:4,header:2,itemscanbedeleted:5,refreshmethod:3},715:{},716:{category:1,refresh:2},717:{categoryfooter:1},718:{text:1,url:2},719:{adminmsgcolor:10,adminusernamecolor:9,backgroundcolor:2,backgroundimgalignment:4,backgroundimgurl:3,clientmsgcolor:15,emotemsgcolor:11,errormsgcolor:12,recpmsgcolor:8,recpusernamecolor:7,sendermsgcolor:6,senderusernamecolor:5,servermsgcolor:14,serverusernamecolor:13,themeid:1},720:{chatroomname:2,fusionusername:3,userstatustype:1,usertype:4},750:{creator:2,groupchatid:1,imtype:3},751:{imtype:3,inviteduser:2,otherpartylist:4,participant:1},752:{groupchatid:1,imtype:3,username:2,usernames:4},753:{groupchatid:1,imtype:2},754:{groupchatid:1,imtype:2},755:{groupchatid:1,imtype:5,mutedparticipants:4,participants:2},756:{chatroomname:2,fusionusername:3,userstatustype:1,usertype:4},800:{contactid:3,destination:2,evaluate:4,method:5,source:1},801:{destination:2,destinationtype:1,evaluate:5,gateway:3,gatewayname:4,protocol:6},802:{destination:2,gateway:3,gatewayname:4,source:1,sourceprotocol:5},803:{destinationprotocol:5,gateway:2,gatewayname:3,source:1,sourceprotocol:4},804:{confirmationmessage:2,phonenumber:1},805:{destination:2,source:1},806:{description:1,requestingusername:2},807:{blockrequestinguser:3,disableanonymouscalling:4,requestingusername:1,response:2},900:{displayname:2,groupid:3,mobilephone:1},901:{},902:{accountbalance:1},903:{amount:10,cardexpirydate:6,cardholder:7,cardnumber:4,cardpin:5,cardtype:3,receiptnumber:8,rechargecode:9,rechargemethod:2,username:1},904:{mobilephone:2,username:1},905:{},906:{aimautologin:23,aimpassword:22,aimusername:21,autorecharge:14,awaymessage:13,city:4,countryid:6,dateofbirth:8,displayname:1,emailaddress:10,facebookautologin:29,facebookpassword:28,facebookusername:27,firstname:2,gender:9,gtalkautologin:26,gtalkpassword:25,gtalkusername:24,lastname:3,mobilephone:12,msnautologin:17,msnpassword:16,msnusername:15,onmailinglist:11,state:5,utcoffset:7,yahooautologin:20,yahoopassword:19,yahoousername:18},907:{aimautologin:23,aimpassword:22,aimusername:21,autorecharge:14,awaymessage:13,city:4,countryid:6,dateofbirth:8,displayname:1,emailaddress:10,facebookautologin:29,facebookpassword:28,facebookusername:27,firstname:2,gender:9,gtalkautologin:26,gtalkpassword:25,gtalkusername:24,imtypetoremove:30,lastname:3,mobilephone:12,msnautologin:17,msnpassword:16,msnusername:15,onmailinglist:11,state:5,utcoffset:7,yahooautologin:20,yahoopassword:19,yahoousername:18},908:{newpassword:2,oldpassword:1},909:{amount:2,commit:3,username:1},910:{profilename:2,urltype:1},911:{iconid:5,menutype:1,position:2,title:3,url:4},912:{content:2,id:1},913:{hotkeys:1},914:{alias:3,alternatehotkeys:2,content:4,contenttype:5,hotkey:1,packid:6,url:7},915:{},916:{alternatekeys:2,hotkeys:1},918:{focus:2,url:1},920:{action:1},921:{allevents:1},922:{cookies:11,method:1,parameter:3,url:2},923:{content:2,cookies:11,responsecode:1,timetolive:3},924:{chatmessagecolours:2,chatsendercolours:1},925:{language:1},926:{imtypes:1},927:{away:5,busy:4,imtype:1,offline:6,online:2,roaming:3},928:{},929:{iconid:1},930:{icon:2,iconid:1},931:{clienttype:1,clientversion:2},932:{marketingmsg:1,url:2},933:{actionurl:4,iconurl:5,menuversionid:1,position:2,textid:3},934:{menuversionid:1},935:{limit:1},936:{giftnames:2,giftprice:3,hotkeys:1},937:{sessionid:1},938:{},939:{stickerpackids:1,stickerpackversions:2},940:{packids:1},941:{stickerhotkeys:3,stickerpackiconurl:4,stickerpackid:1,stickerpackname:2,stickerpackversion:5},942:{},959:{},960:{}},e
}),function(){function e(){var e=!1;if("localStorage"in window)try{window.localStorage.setItem("_tmptest","tmpval"),e=!0,window.localStorage.removeItem("_tmptest")}catch(t){}if(e)try{window.localStorage&&(b=window.localStorage,C="localStorage",S=b.jStorage_update)}catch(o){}else if("globalStorage"in window)try{window.globalStorage&&(b=window.globalStorage[window.location.hostname],C="globalStorage",S=b.jStorage_update)}catch(a){}else{if(x=document.createElement("link"),!x.addBehavior)return x=null,void 0;x.style.behavior="url(#default#userData)",document.getElementsByTagName("head")[0].appendChild(x);try{x.load("jStorage")}catch(s){x.setAttribute("jStorage","{}"),x.save("jStorage"),x.load("jStorage")}var l="{}";try{l=x.getAttribute("jStorage")}catch(c){}try{S=x.getAttribute("jStorage_update")}catch(d){}b.jStorage=l,C="userDataBehavior"}r(),u(),n(),h(),"addEventListener"in window&&window.addEventListener("pageshow",function(e){e.persisted&&i()},!1)}function t(){var e="{}";if("userDataBehavior"==C){x.load("jStorage");try{e=x.getAttribute("jStorage")}catch(t){}try{S=x.getAttribute("jStorage_update")}catch(n){}b.jStorage=e}r(),u(),h()}function n(){"localStorage"==C||"globalStorage"==C?"addEventListener"in window?window.addEventListener("storage",i,!1):document.attachEvent("onstorage",i):"userDataBehavior"==C&&setInterval(i,1e3)}function i(){var e;clearTimeout(T),T=setTimeout(function(){if("localStorage"==C||"globalStorage"==C)e=b.jStorage_update;else if("userDataBehavior"==C){x.load("jStorage");try{e=x.getAttribute("jStorage_update")}catch(t){}}e&&e!=S&&(S=e,o())},25)}function o(){var e,n=v.parse(v.stringify(w.__jstorage_meta.CRC32));t(),e=v.parse(v.stringify(w.__jstorage_meta.CRC32));var i,o=[],s=[];for(i in n)if(n.hasOwnProperty(i)){if(!e[i]){s.push(i);continue}n[i]!=e[i]&&"2."==(n[i]+"").substr(0,2)&&o.push(i)}for(i in e)e.hasOwnProperty(i)&&(n[i]||o.push(i));a(o,"updated"),a(s,"deleted")}function a(e,t){if(e=[].concat(e||[]),"flushed"==t){e=[];for(var n in E)E.hasOwnProperty(n)&&e.push(n);t="deleted"}for(var i=0,o=e.length;o>i;i++){if(E[e[i]])for(var a=0,s=E[e[i]].length;s>a;a++)E[e[i]][a](e[i],t);if(E["*"])for(var a=0,s=E["*"].length;s>a;a++)E["*"][a](e[i],t)}}function s(){var e=""+ +new Date;"localStorage"==C||"globalStorage"==C?b.jStorage_update=e:"userDataBehavior"==C&&(x.setAttribute("jStorage_update",e),x.save("jStorage")),i()}function r(){if(b.jStorage)try{w=v.parse(b.jStorage+"")}catch(e){b.jStorage="{}"}else b.jStorage="{}";k=b.jStorage?(b.jStorage+"").length:0,w.__jstorage_meta||(w.__jstorage_meta={}),w.__jstorage_meta.CRC32||(w.__jstorage_meta.CRC32={})}function l(){p();try{b.jStorage=v.stringify(w),x&&(x.setAttribute("jStorage",b.jStorage),x.save("jStorage")),k=b.jStorage?(b.jStorage+"").length:0}catch(e){}}function c(e){if(!e||"string"!=typeof e&&"number"!=typeof e)throw new TypeError("Key name must be string or numeric");if("__jstorage_meta"==e)throw new TypeError("Reserved key name");return!0}function u(){var e,t,n,i,o=1/0,r=!1,c=[];if(clearTimeout(y),w.__jstorage_meta&&"object"==typeof w.__jstorage_meta.TTL){e=+new Date,n=w.__jstorage_meta.TTL,i=w.__jstorage_meta.CRC32;for(t in n)n.hasOwnProperty(t)&&(e>=n[t]?(delete n[t],delete i[t],delete w[t],r=!0,c.push(t)):o>n[t]&&(o=n[t]));1/0!=o&&(y=setTimeout(u,o-e)),r&&(l(),s(),a(c,"deleted"))}}function h(){var e,t;if(w.__jstorage_meta.PubSub){var n,i=A;for(e=t=w.__jstorage_meta.PubSub.length-1;e>=0;e--)n=w.__jstorage_meta.PubSub[e],n[0]>A&&(i=n[0],d(n[1],n[2]));A=i}}function d(e,t){if(P[e])for(var n=0,i=P[e].length;i>n;n++)P[e][n](e,v.parse(v.stringify(t)))}function p(){if(w.__jstorage_meta.PubSub){for(var e=+new Date-2e3,t=0,n=w.__jstorage_meta.PubSub.length;n>t;t++)if(e>=w.__jstorage_meta.PubSub[t][0]){w.__jstorage_meta.PubSub.splice(t,w.__jstorage_meta.PubSub.length-t);break}w.__jstorage_meta.PubSub.length||delete w.__jstorage_meta.PubSub}}function f(e,t){w.__jstorage_meta||(w.__jstorage_meta={}),w.__jstorage_meta.PubSub||(w.__jstorage_meta.PubSub=[]),w.__jstorage_meta.PubSub.unshift([+new Date,e,t]),l(),s()}function m(e,t){for(var n,i=e.length,o=t^i,a=0;i>=4;)n=255&e.charCodeAt(a)|(255&e.charCodeAt(++a))<<8|(255&e.charCodeAt(++a))<<16|(255&e.charCodeAt(++a))<<24,n=1540483477*(65535&n)+((65535&1540483477*(n>>>16))<<16),n^=n>>>24,n=1540483477*(65535&n)+((65535&1540483477*(n>>>16))<<16),o=1540483477*(65535&o)+((65535&1540483477*(o>>>16))<<16)^n,i-=4,++a;switch(i){case 3:o^=(255&e.charCodeAt(a+2))<<16;case 2:o^=(255&e.charCodeAt(a+1))<<8;case 1:o^=255&e.charCodeAt(a),o=1540483477*(65535&o)+((65535&1540483477*(o>>>16))<<16)}return o^=o>>>13,o=1540483477*(65535&o)+((65535&1540483477*(o>>>16))<<16),o^=o>>>15,o>>>0}var g="0.4.3",_=window.jQuery||window.$||(window.$={}),v={parse:window.JSON&&(window.JSON.parse||window.JSON.decode)||String.prototype.evalJSON&&function(e){return(e+"").evalJSON()}||_.parseJSON||_.evalJSON,stringify:Object.toJSON||window.JSON&&(window.JSON.stringify||window.JSON.encode)||_.toJSON};if(!v.parse||!v.stringify)throw Error("No JSON support found, include //cdnjs.cloudflare.com/ajax/libs/json2/20110223/json2.js to page");var y,w={__jstorage_meta:{CRC32:{}}},b={jStorage:"{}"},x=null,k=0,C=!1,E={},T=!1,S=0,P={},A=+new Date,I={isXML:function(e){var t=(e?e.ownerDocument||e:0).documentElement;return t?"HTML"!==t.nodeName:!1},encode:function(e){if(!this.isXML(e))return!1;try{return(new XMLSerializer).serializeToString(e)}catch(t){try{return e.xml}catch(n){}}return!1},decode:function(e){var t,n="DOMParser"in window&&(new DOMParser).parseFromString||window.ActiveXObject&&function(e){var t=new ActiveXObject("Microsoft.XMLDOM");return t.async="false",t.loadXML(e),t};return n?(t=n.call("DOMParser"in window&&new DOMParser||window,e,"text/xml"),this.isXML(t)?t:!1):!1}};_.jStorage={version:g,set:function(e,t,n){if(c(e),n=n||{},t===void 0)return this.deleteKey(e),t;if(I.isXML(t))t={_is_xml:!0,xml:I.encode(t)};else{if("function"==typeof t)return void 0;t&&"object"==typeof t&&(t=v.parse(v.stringify(t)))}return w[e]=t,w.__jstorage_meta.CRC32[e]="2."+m(v.stringify(t),2538058380),this.setTTL(e,n.TTL||0),a(e,"updated"),t},get:function(e,t){return c(e),e in w?w[e]&&"object"==typeof w[e]&&w[e]._is_xml?I.decode(w[e].xml):w[e]:t===void 0?null:t},deleteKey:function(e){return c(e),e in w?(delete w[e],"object"==typeof w.__jstorage_meta.TTL&&e in w.__jstorage_meta.TTL&&delete w.__jstorage_meta.TTL[e],delete w.__jstorage_meta.CRC32[e],l(),s(),a(e,"deleted"),!0):!1},setTTL:function(e,t){var n=+new Date;return c(e),t=Number(t)||0,e in w?(w.__jstorage_meta.TTL||(w.__jstorage_meta.TTL={}),t>0?w.__jstorage_meta.TTL[e]=n+t:delete w.__jstorage_meta.TTL[e],l(),u(),s(),!0):!1},getTTL:function(e){var t,n=+new Date;return c(e),e in w&&w.__jstorage_meta.TTL&&w.__jstorage_meta.TTL[e]?(t=w.__jstorage_meta.TTL[e]-n,t||0):0},flush:function(){return w={__jstorage_meta:{CRC32:{}}},l(),s(),a(null,"flushed"),!0},storageObj:function(){function e(){}return e.prototype=w,new e},index:function(){var e,t=[];for(e in w)w.hasOwnProperty(e)&&"__jstorage_meta"!=e&&t.push(e);return t},storageSize:function(){return k},currentBackend:function(){return C},storageAvailable:function(){return!!C},listenKeyChange:function(e,t){c(e),E[e]||(E[e]=[]),E[e].push(t)},stopListening:function(e,t){if(c(e),E[e]){if(!t)return delete E[e],void 0;for(var n=E[e].length-1;n>=0;n--)E[e][n]==t&&E[e].splice(n,1)}},subscribe:function(e,t){if(e=""+(e||""),!e)throw new TypeError("Channel not defined");P[e]||(P[e]=[]),P[e].push(t)},publish:function(e,t){if(e=""+(e||""),!e)throw new TypeError("Channel not defined");f(e,t)},reInit:function(){t()}},e()}(),define("jstorage",["jquery"],function(){}),define("modules/chat/fusion/packet",["modules/chat/fusion/packet_defs","underscore","backbone","jquery","jstorage"],function(e,t,n){var i={},o=n.Model.extend({setPacketParams:function(n,o){var a=!0;o?(this.transaction_id=o,this.parent_packet=i.get_packet_by_id(this.transaction_id)):(this.parent_packet=null,this.transaction_id=i.get_transaction_id(),a=!1),this.type=n,this.field_names=e.FUSION_PACKET_FIELDS[n],this._isPacket=!0,this.queue=!0,this.retry=!0,this.retry_count=0,this.create_time=Date.now(),this.sent_time=null,this.bypass_thread=!1,this.timeout=3e4,this.event_list=i.packet_events;var s=this,r=i.get_packet_listeners(n);t.each(r,function(e){var n,i,o;n=e.listener,o=e.event_handlers,i=e.options;var a=function(e){var a="on_packet_"+e.name;t.isFunction(o[a])?o[a].call(n,s,e,i):t.isFunction(n[a])&&n[a].call(n,s,e,i)};s.on(s.event_list.create,a,this),s.on(s.event_list.sent,a,this),s.on(s.event_list.received,a,this),s.on(s.event_list.ok,a,this),s.on(s.event_list.error,a,this),s.on(s.event_list.response,a,this)}),a||i.add_to_packet_collection(this),this.trigger(this.event_list.create,{event:this,name:this.event_list.create})},fire_send_event:function(){this.trigger(this.event_list.sent,{event:this,name:this.event_list.sent})},fire_send_success_event:function(){this.trigger(this.event_list.sent_success,{event:this,name:this.event_list.sent_success})},fire_send_failed_event:function(){this.trigger(this.event_list.send_failed,{event:this,name:this.event_list.send_failed})},execute:function(){this.trigger(this.event_list.received,{event:this,name:this.event_list.received}),this.parent_packet&&(this.is_ok_packet()?(console.log("Received an ok packet"),this.parent_packet.fire_ok_event(this)):this.is_error_packet()&&(console.log("Received an error packet"),this.parent_packet.fire_error_event(this)),this.is_error_packet()||this.parent_packet.fire_response_event(this))},fire_ok_event:function(e){this.trigger(this.event_list.ok,{response_packet:e,event:this,name:this.event_list.ok})},fire_response_event:function(e){this.trigger(this.event_list.response,{response_packet:e,event:this,name:this.event_list.response})},fire_error_event:function(e){this.trigger(this.event_list.error,{response_packet:e,event:this,name:this.event_list.error})},is_ok_packet:function(){return 1===parseInt(this.type,10)},is_error_packet:function(){return 0===parseInt(this.type,10)},get_error_message:function(){return this.get_field_value(2)},get_key_from_string:function(e){if(t.isString(e)){var n=this.field_names[e];if(t.isUndefined(n)||t.isNull(n))throw e+" Field not found for packet type "+this.type;return n}throw"get_key_from_string method accepts a string value as parameter"},add_field:function(e,t){e=this.get_key_from_string(e),this.set(e,t)},get_field_value:function(e){return t.isNumber(e)||(e=this.get_key_from_string(e)),this.get(e)},toObject:function(){var e={};return t.each(this.field_names,function(t,n){e[n]=this.get(t)},this),e},to_packet_json:function(e){var t=e?0:this.transaction_id;return{T:this.type,I:t,F:this.toJSON()}}});return t.extend(i,{packet_collection:{},packet_listeners:new n.Collection,isPacket:function(e){return e._isPacket},add_to_packet_collection:function(e){return i.isPacket(e)?(this.packet_collection[e.transaction_id]=e,void 0):(console.log("Not a packet"),void 0)},get_packet_by_id:function(e){return this.packet_collection[e]},get_transaction_id:function(){var e="transaction_id_key",t=$.jStorage.get(e);return t||(t=1),t=1+(t+1)%32766,$.jStorage.set(e,t),t},add_packet_listener:function(e,t,n,i){var o,a;a=this.packet_listeners.get(e),a?o=a.get("listeners"):(o=[],this.packet_listeners.add({id:e,listeners:o}));var s=i||{};o.push({listener:t,options:n,event_handlers:s})},get_packet_listeners:function(e){var n=this.packet_listeners.get(e);return t.isUndefined(n)||t.isNull(n)?[]:n.get("listeners")||[]},packet_events:{create:"create",sent:"sent",sent_success:"sent_success",send_failed:"send_failed",received:"received",error:"error",ok:"ok",response:"response"},create_packet:function(e,t){var n=new o;return n.setPacketParams(e,t),n},create_packet_from_json:function(e){var t=e.I,n=i.create_packet(e.T,t);return n.set(e.F),n},FusionPacketType:o}),i}),define("modules/chat/data/thread_worker",["modules/chat/fusion/packet","underscore","jquery","backbone"],function(e,t){var n=function(){};return n.createThreadWorker=function(e,t){var i=new n;return i.data=e,i.options=t,i.batch_id=0,i.working=!1,i},t.extend(n.prototype,{execute:function(){var t;t=e.create_packet_from_json(this.data),t.execute()}}),n}),define("modules/chat/data/transport",["modules/chat/config/config","modules/chat/data/transport_queue","modules/chat/data/thread_manager","modules/chat/data/thread_worker","modules/chat/fusion/packet","modules/common/local_storage","underscore","backbone","jquery","jstorage"],function(e,t,n,i,o,a,s,r){var l={},c="packet_data";return s.extend(l,r.Events),s.extend(l,{events:{connection_error:"connection_error",disconnected:"disconnected",logout_forced:"logout_forced",reconnected:"reconnected"}}),l.initialize=function(){this.server=e.migcore_url+e.gateway_path,this._transport_id=Date.now(),this.allowed_packet_types=null,this.timeout=5e3,this.max_retry_count=3,this.max_connection_error=6,this.connection_error_count=0,this.queue=t,this.queue.setTransport(this),this.is_connection_error=!1,this.thread_manager=n,this.create_connection_shim()},l.create_connection_shim=function(){var e=this;$.jStorage.subscribe(c,function(t,n){e.process_packet_data(n)})},l.add_packet_listener=function(e,t,n){o.add_packet_listener(e,t,n)},l.send_packet=function(e,t,n){var i,o,r,l=null,c=this;if(this.allowed_packet_types&&this.allowed_packet_types.length>0&&(null===e||!s.contains(this.allowed_packet_types,e.type)))return console.log("Blocked packet that are not allowed. Packet Type - "+(e?e.type:null)+"; Allowed packets - "+this.allowed_packet_types),void 0;i=this.timeout,o=!1,null!==e&&(e.callback=t,e.scope=n,o=e.bypass_thread,i=e.timeout,r=e.transaction_id,l=JSON.stringify(e.to_packet_json()),e.fire_send_event()),console.log("Sending request with data - "+l);var u=$.ajax(this.server,{type:"POST",data:l,beforeSend:function(e){e.setRequestHeader("Content-Type","application/json"),e.setRequestHeader("X-Mig33-JSON-Version","2"),$("#loading").hide()},timeout:i});return a.set("_lst_ping",Date.now()),u.success(function(t){c.process_packet_response(e,t,{})}),u.fail(function(t,n,i){c.process_packet_failure(e,t,n,i)}),u.always(function(){}),r},l.process_packet_response=function(e,t){var n=!1;console.log("Got response from server - "+JSON.stringify(t)),this.connection_success(t),e&&(e.fire_send_success_event(),n=this.queue.remove_packet(e),n&&this.queue.check_queue()),this.broadcast_response(t)},l.broadcast_response=function(e){return e&&e.length?($.jStorage.publish(c,e),void 0):(console.log("Empty response not being broadcasted"),void 0)},l.process_packet_failure=function(e,t,n,i){e&&e.fire_send_failed_event(),console.log("Unable to send packet, network error"),this.connection_error(t,n,i),this.queue.check_queue()},l.queue_packet=function(e){if(null===e||!o.isPacket(e))throw"Must send valid packet to the queue_packet function";this.queue.add_packet(e)},l.connection_error=function(e,t,n){console.log("Packet send failed with error: "+n),this.trigger(this.events.connection_error),this.connection_error_count+=1,this.connection_error_count>=this.max_connection_error&&(this.is_connection_error=!0,this.allowed_packet_types=[211],this.trigger(this.events.disconnected))},l.connection_success=function(){this.connection_error_count>0&&this.trigger(this.events.reconnected),this.allowed_packet_types=null,this.is_connection_error=!1,this.connection_error_count=0},l.process_packet_data=function(e){if(null!==e&&e.length>0){for(var t=0;e.length>t;++t){var n=i.createThreadWorker(e[t]);this.thread_manager.queue_worker(n,!1)}this.thread_manager.start()}},l}),define("modules/chat/models/mig_model",["modules/chat/data/transport","modules/chat/fusion/packet","modules/chat/fusion/packet_defs","underscore","backbone","jquery"],function(e,t,n,i,o){var a=o.Model.extend({subscribed_packets:[],constructor:function(){a.__super__.constructor.apply(this,arguments);var e=this;i.isArray(this.subscribed_packets)&&i.each(this.subscribed_packets,function(n){var o,a={},s={};i.isString(n)||(o=n.packet,a=n.options||{},s=n),t.add_packet_listener(o,e,a,s)})},random:function(e){return(i.isUndefined(e)||i.isNaN(e)||null===e)&&(e=1e3),Math.floor(Math.random()*e+1)},send_packet:function(t){return e.send_packet(t)},queue_packet:function(t){return e.queue_packet(t)},on_packet_created:function(){},on_packet_sent:function(){},on_packet_received:function(){},on_packet_error:function(){},on_packet_ok:function(){},on_packet_response:function(){}});return a}),define("modules/chat/models/contact",["modules/chat/models/mig_model","modules/chat/config/config","modules/chat/fusion/packet","modules/chat/fusion/packet_defs","modules/common/local_storage","modules/common/utility","underscore","backbone","jquery"],function(e,t,n,i,o,a,s,r){var l={},c={},u={},h=null,d=null,p=e.extend({idAttribute:"contactId",setPresence:function(e){this.set({fusionPresence:e.fusionPresence,msnPresence:e.msnPresence,gtalkPresence:e.gtalkPresence,yahooPresence:e.yahooPresence,facebookPresence:e.facebookPresence})},getDisplayPicture:function(e,n,i,o){return e=e||32,n=n||32,i=i||1,o=o||1,t.image_server+"/a/"+this.getDisplayName()+"?w="+e+"&h="+n+"&c="+i+"&a="+o},getSortOrder:function(){return a.lpad(this.getPresence()+"","0",2)+"-"+this.getDisplayName()},getDisplayName:function(){return this.get("displayName")},getUsername:function(){var e=this.get("fusionUsername");return s.isEmpty(e)&&(s.isEmpty(this.get("msnUsername"))?s.isEmpty(this.get("yahooUsername"))?s.isEmpty(this.get("gtalkUsername"))?s.isEmpty(this.get("facebookUsername"))?s.isEmpty(this.get("displayName"))||(e=this.get("displayName")):e=this.get("facebookUsername"):e=this.get("gtalkUsername"):e=this.get("yahooUsername"):e=this.get("msnUsername")),e},getType:function(){var e=t.IM_Type.fusion;return s.isEmpty(this.get("fusionUsername"))&&(e=s.isEmpty(this.get("msnUsername"))?s.isEmpty(this.get("yahooUsername"))?s.isEmpty(this.get("gtalkUsername"))?s.isEmpty(this.get("facebookUsername"))?t.IM_Type.mobile:t.IM_Type.facebook:t.IM_Type.gtalk:t.IM_Type.yahoo:t.IM_Type.msn),e},isFusionContact:function(){var e=this.getType();return e===t.IM_Type.fusion},getPresence:function(){var e,n=require("modules/chat/models/session"),i=null;return s.isEmpty(this.get("fusionUsername"))&&(s.isEmpty(this.get("msnUsername"))?s.isEmpty(this.get("yahooUsername"))?s.isEmpty(this.get("gtalkUsername"))?s.isEmpty(this.get("facebookUsername"))||(e=n.get("facebook_signed_in"),i=e?this.get("facebookPresence"):t.Presence.appear_offline):(e=n.get("gtalk_signed_in"),i=e?this.get("gtalkPresence"):t.Presence.appear_offline):(e=n.get("yahoo_signed_in"),i=e?this.get("yahooPresence"):t.Presence.appear_offline):(e=n.get("msn_signed_in"),i=e?this.get("msnPresence"):t.Presence.appear_offline)),null===i&&(i=this.get("fusionPresence")),i=parseInt(i,10)?i:t.Presence.appear_offline,parseInt(i,10)},isOffline:function(){var e=this.getPresence();return null===e||e==t.Presence.appear_offline},getIMPresence:function(e){var n;switch(parseInt(e,10)){case t.IM_Type.fusion:n=this.get("fusionPresence");break;case t.IM_Type.msn:n=this.get("msnPresence");break;case t.IM_Type.gtalk:n=this.get("gtalkPresence");break;case t.IM_Type.yahoo:n=this.get("yahooPresence");break;case t.IM_Type.facebook:n=this.get("facebookPresence");break;default:n=t.Presence.appear_offline}return n||t.Presence.appear_offline},getIconClass:function(e){switch(e){case t.Presence.online:return"online";case t.Presence.busy:return"busy";case t.Presence.away:return"away";case t.Presence.appear_offline:return"offline";default:return"offline"}},getIMType:function(e){switch(e){case t.IM_Type.fusion:return"fusion";case t.IM_Type.msn:return"msn";case t.IM_Type.gtalk:return"gtalk";case t.IM_Type.yahoo:return"yahoo";case t.IM_Type.facebook:return"facebook";default:return""}},getPresenceIconCls:function(){return this.getIMType(this.getType())+"-"+this.getIconClass(this.getPresence())}}),f=r.Collection.extend({model:p}),m=e.extend({idAttribute:"groupId",constructor:function(){m.__super__.constructor.apply(this,arguments),this.contacts=new f,this.contacts.on("add",function(e){this.trigger("contact_added",e)},this),this.contacts.on("remove",function(e){this.trigger("contact_removed",e)},this),this.contacts.on("change",function(e){this.trigger("contact_updated",e)},this)},get_contacts:function(){return this.contacts},get_contact_by_id:function(e){return this.contacts.get(e)},has_contact:function(e){return!!this.contacts.get(e)},add:function(e,t){return this.contacts.add(e,t),e},remove:function(e){return this.contacts.remove(e)},get_contact_by_name:function(e){var t=this.contacts;return t.find(function(t){return t.get("username")===e})}}),g=r.Collection.extend({model:m}),_=e.extend({packets:{GET_CONTACT_REQUESTS:i.FUSION_PACKET_TYPES.GET_CONTACT_REQUESTS,GET_CONTACTS:i.FUSION_PACKET_TYPES.GET_CONTACTS,MOVE_CONTACT:i.FUSION_PACKET_TYPES.MOVE_CONTACT,REMOVE_CONTACT:i.FUSION_PACKET_TYPES.REMOVE_CONTACT,REMOVE_CONTACT_GROUP:i.FUSION_PACKET_TYPES.REMOVE_GROUP,SET_PERMISSION:i.FUSION_PACKET_TYPES.SET_PERMISSION},constructor:function(){_.__super__.constructor.apply(this,arguments);var e=this.contactGroups=new g;this.initial_contacts_loaded=!1;var t=this;e.on("add",function(e){t.trigger("contact_group_added",e)},this),e.on("remove",function(e){this.trigger("contact_group_removed",e)},this),e.on("change",function(e){console.log("me got myself and update!"),this.trigger("contact_group_updated",e)},this),this.all_contacts=new f},filter_contacts:function(e){return this.all_contacts.filter(e)},is_contacts_loaded:function(){return this.initial_contacts_loaded},get_all_contacts:function(){return this.all_contacts},init:function(){var e=require("modules/chat/models/session");e.on("session_created",function(){this.send_get_contacts()},this),e.on("im_status_update",function(e){if(1!==parseInt(e.status,10)){var t=e.imtype;this.all_contacts.each(function(e){e.getType()===t&&e.trigger("change")})}},this),this.contact_cache_by_name={},this.contact_name_cache_by_im_names={}},is_cached_contacts_latest:function(){var e=require("modules/chat/models/session"),t=e.get("contact_list_version"),n=e.get_user_data("contact_list_version");return t==n?e.is_user_data_set("contact_group_list")&&e.is_user_data_set("contact_list"):!1},get_cached_contact_groups:function(){if(!this.is_cached_contacts_latest())return null;var e=require("modules/chat/models/session");return e.get_user_data("contact_group_list")},get_cached_contacts:function(){if(!this.is_cached_contacts_latest())return null;var e=require("modules/chat/models/session");return e.get_user_data("contact_list")},send_get_contacts:function(){var e=n.create_packet(this.packets.GET_CONTACTS);this.is_cached_contacts_latest()?(console.log("GET ONLINE CONTACTS"),u=this.get_cached_contact_groups(),s.each(u,function(e){var t=n.create_packet_from_json(e);t.execute()}),c=this.get_cached_contacts(),s.each(c,function(e){var t=n.create_packet_from_json(e);t.execute()}),e.add_field("presence",1)):(console.log("GET ALL CONTACTS"),e.add_field("presence",null)),this.queue_packet(e)},send_block_user:function(e){var t=n.create_packet(this.packets.SET_PERMISSION);t.add_field("username",e),t.add_field("permission",2),this.send_packet(t)},request_contact:function(e){var t=n.create_packet(this.packets.GET_CONTACTS);t.add_field("contactid",e),this.send_packet(t)},get_group_from_contact_id:function(e){var t=this.contactGroups,n=null;return t.each(function(t){t.has_contact(e)&&(n=t)},this),n},get_contact_group:function(e){var t=this.contactGroups;return t.get(e)},get_contact_groups:function(){return this.contactGroups},send_delete_contact_group:function(e,t){var i=this,o=n.create_packet(this.packets.REMOVE_CONTACT_GROUP);o.add_field("groupid",e),o.on("response",function(){var t=i.contactGroups,n=t.get(e);t.remove(n),i.store_contact_group_local(e,null)}),o.on("error",function(n){var o=n.response_packet,a=o.get_error_message();i.trigger("contact_group_remove_failed",a,e,t)}),this.send_packet(o)},get_display_name_from_cache:function(e){var t=this.contact_name_cache_by_im_names[e];return t||e},send_move_contact:function(e,t){var i=n.create_packet(this.packets.MOVE_CONTACT);i.add_field("contactid",e),i.add_field("groupid",t),this.send_packet(i)},send_remove_friend:function(e){var t=n.create_packet(this.packets.REMOVE_CONTACT);t.add_field("contactid",e),this.send_packet(t)},find_contact_by_id:function(e){var t=this.contactGroups,n=null;return t.each(function(t){var i=t.get_contact_by_id(e);s.isUndefined(i)||s.isNull(i)||(n=i)},this),n},find_contact_by_name:function(e){return this.contact_cache_by_name[e]},store_contact_local:function(e,n){s.isNull(n)?(c[e]=null,delete c[e]):(n.add_field("fusionpresence",t.Presence.appear_offline),n.add_field("msnpresence",t.Presence.appear_offline),n.add_field("yahoopresence",t.Presence.appear_offline),n.add_field("gtalkpresence",t.Presence.appear_offline),n.add_field("facebookpresence",t.Presence.appear_offline),c[e]=n.to_packet_json(!0)),h||(h=s.debounce(function(){var e=require("modules/chat/models/session");e.set_user_data("contact_list",c)},1e3)),h()},store_contact_group_local:function(e,t){s.isNull(t)?(u[e]=null,delete u[e]):u[e]=t.to_packet_json(!0),d||(d=s.debounce(function(){var e=require("modules/chat/models/session");e.set_user_data("contact_group_list",u)},1e3)),d()},subscribed_packets:[{packet:i.FUSION_PACKET_TYPES.GROUP,on_packet_received:function(e){var t=e.field_names,n=parseInt(e.get_field_value(t.groupid),10),i=e.get_field_value(t.groupname),o=this.contactGroups.get(n);o?o.get("name")!=i&&o.set({name:i}):this.contactGroups.add({groupId:n,name:i}),this.store_contact_group_local(n,e)}},{packet:i.FUSION_PACKET_TYPES.REMOVE_CONTACT,on_packet_received:function(e){var t=e.field_names,n=parseInt(e.get_field_value(t.contactid),10),i=this.find_contact_by_id(n),o=this.get_group_from_contact_id(n);i&&o&&o.remove(i),this.store_contact_local(n,null)}},{packet:i.FUSION_PACKET_TYPES.CONTACT,on_packet_received:function(e){var t=!this.initial_contacts_loaded,n=e.field_names,i=e.get_field_value(n.contactid),o=parseInt(e.get_field_value(n.groupid),10),a=this.contactGroups.get(o),s=this.find_contact_by_id(i);if(s){var r=e.get_field_value(n.fusionpresence),l=e.get_field_value(n.msnpresence),c=e.get_field_value(n.aimpresence),u=e.get_field_value(n.yahoopresence),h=e.get_field_value(n.gtalkpresence),d=e.get_field_value(n.facebookpresence);s.setPresence({fusionPresence:r,msnPresence:l,aimPresence:c,yahooPresence:u,gtalkPresence:h,facebookPresence:d});var p=this.get_group_from_contact_id(parseInt(e.get_field_value(n.contactid),10));p.get("groupId")!=o&&(p.remove(s),s.set({groupId:o,groupName:a.get("name")},{silent:!0}),a.add(s),this.store_contact_local(i,e))}else a.add({contactId:e.get_field_value(n.contactid),groupId:o,groupName:a.get("name"),displayName:e.get_field_value(n.displayname),mobilePhone:e.get_field_value(n.mobilephone),fusionUsername:e.get_field_value(n.fusionusername),msnUsername:e.get_field_value(n.msnusername),yahooUsername:e.get_field_value(n.yahoousername),gtalkUsername:e.get_field_value(n.gtalkusername),displayPicture:e.get_field_value(n.displaypicture),facebookUsername:e.get_field_value(n.facebookusername),fusionPresence:e.get_field_value(n.fusionpresence),msnPresence:e.get_field_value(n.msnpresence),yahooPresence:e.get_field_value(n.yahoopresence),gtalkPresence:e.get_field_value(n.gtalkpresence),facebookPresence:e.get_field_value(n.facebookpresence),statusMessage:e.get_field_value(n.statusmessage)},{silent:t}),s=this.find_contact_by_id(i),this.all_contacts.add(s,{silent:t}),this.contact_name_cache_by_im_names[s.getUsername()]=s.getDisplayName(),this.contact_cache_by_name[e.get_field_value(n.displayname)]=s,this.store_contact_local(i,e)}},{packet:i.FUSION_PACKET_TYPES.CONTACT_LIST_VERSION,on_packet_received:function(e){var t=e.field_names,n=e.get_field_value(t.contactlistversion),i=require("modules/chat/models/session");i.set_user_data("contact_list_version",n)}},{packet:i.FUSION_PACKET_TYPES.PRESENCE,on_packet_received:function(e){var t=e.field_names,n=parseInt(e.get_field_value(t.contactid),10),i=e.get_field_value(t.fusionpresence),o=e.get_field_value(t.msnpresence),a=e.get_field_value(t.aimpresence),s=e.get_field_value(t.yahoopresence),r=e.get_field_value(t.gtalkpresence),l=e.get_field_value(t.facebookpresence),c=this.find_contact_by_id(n);c?c.setPresence({fusionPresence:i,msnPresence:o,aimPresence:a,yahooPresence:s,gtalkPresence:r,facebookPresence:l}):this.request_contact(n)}},{packet:i.FUSION_PACKET_TYPES.GET_CONTACTS_COMPLETE,on_packet_received:function(){this.initial_contacts_loaded=!0,this.trigger("contacts_load_complete",this.all_contacts)}}]});return l.contactGroupStore=new _,l}),define("modules/chat/models/chat_message",["modules/chat/models/mig_model","modules/chat/config/config","underscore","backbone","jquery"],function(e,t,n,i){var o=e.extend({idAttribute:"message_id",EMOTE_CONTENT_TYPE:{STICKER:1},isSelfMessage:function(){return this._isSelfMessage},constructor:function(){var e=require("modules/chat/models/session");o.__super__.constructor.apply(this,arguments);var t=this.get("source");e.get("session_user"),this._isSelfMessage=t==e.get("username")},is_live_message:function(){return n.isEmpty(this.get("previous_message_id"))},is_emote:function(){return this.get("content_type")==t.Content_Type.emote},is_sticker:function(){return this.get("emote_type")==this.EMOTE_CONTENT_TYPE.STICKER}}),a=i.Collection.extend({model:o,comparator:function(e){return e.get("time")},next:function(e){var t=this.indexOf(e);return 0>t||t>=this.length-1?null:this.at(t+1)},prev:function(e){var t=this.indexOf(e);return 1>t?null:this.at(t-1)}});return{ChatMessageModel:o,ChatMessagesCollection:a}}),define("modules/chat/models/chat",["modules/common/utility","modules/chat/models/mig_model","modules/chat/models/chat_message","modules/chat/config/config","modules/chat/fusion/packet","modules/chat/fusion/packet_defs","modules/chat/models/contact","modules/chat/data/transport","underscore","backbone","jquery"],function(e,t,n,i,o,a,s,r,l,c){function u(e,t){return[e,t].join("_").replace(".","")}var h=s.contactGroupStore,d=t.extend({idAttribute:"chatHandle",unread_messages_count:0,is_group_chat:function(){return this.get("destinationType")==i.DestinationType.group},is_chat_room:function(){return!1},is_admin:function(){return!1},get_unread_message_count:function(){return this.unread_messages_count||0},reset_unread_message_count:function(){this.unread_messages_count=0,this.trigger("unread_message_count_changed")},had_unread_messages:function(){return this.unread_messages_count>0},increment_unread_message_count:function(){this.unread_messages_count+=1,this.trigger("unread_message_count_changed")},hasParticipant:function(e){return l.contains(this.participants,e)},addParticipants:function(e){var t,n=this,i=[];if(e&&0!==e.length){if(1===e.length)return this.addParticipant(e[0].getDisplayName()),void 0;l.each(e,function(e){i.push(e.getDisplayName())},this),this.is_group_chat()?(t=o.create_packet(this.packets.GROUP_CHAT_INVITE),t.add_field("groupchatid",this.get("destination")),t.add_field("otherPartyList","web:"+i.join(","))):(t=o.create_packet(a.FUSION_PACKET_TYPES.CREATE_GROUP_CHAT),t.add_field("participant",this.get("destination")),t.add_field("otherpartylist","web:"+i.join(","))),t.on("error",function(e){var t=e.response_packet,i=t.get_error_message();n.trigger("chat_invite_failed",i)}),this.send_packet(t)}},addParticipant:function(e){var t,n=this;this.is_group_chat()?(t=o.create_packet(this.packets.GROUP_CHAT_INVITE),t.add_field("groupchatid",this.get("destination")),t.add_field("username",e)):(t=o.create_packet(this.packets.CREATE_GROUP_CHAT),t.add_field("participant",this.get("destination")),t.add_field("inviteduser",e)),t.on("error",function(e){var t=e.response_packet,i=t.get_error_message();n.trigger("chat_invite_failed",i)}),this.send_packet(t)},add_chat_message:function(e){var t=this.messages;return t.add(e),t.get(e.message_id)},leave_chatroom:function(){var e,t=this;this.messages.reset([]),this.is_group_chat()?(e=o.create_packet(this.packets.LEAVE_GROUP_CHAT),e.add_field("groupchatid",this.get("destination")),e.add_field("imtype",this.get("messageType"))):this.is_fusion_chat()&&(e=o.create_packet(this.packets.LEAVE_PRIVATE_CHAT),e.add_field("destinationusername",this.get("destination")),e.add_field("imtype",this.get("messageType"))),e.on("response",function(){t.set({hasJoined:!1})
}),this.send_packet(e)},get_prev_message:function(e){return this.messages.prev(e)},get_next_message:function(e){return this.messages.next(e)},packets:{GET_GROUP_CHAT_PARTICIPANTS:a.FUSION_PACKET_TYPES.GET_GROUP_CHAT_PARTICIPANTS,MESSAGE:a.FUSION_PACKET_TYPES.MESSAGE,CREATE_GROUP_CHAT:a.FUSION_PACKET_TYPES.CREATE_GROUP_CHAT,GROUP_CHAT_INVITE:a.FUSION_PACKET_TYPES.GROUP_CHAT_INVITE,LEAVE_GROUP_CHAT:a.FUSION_PACKET_TYPES.LEAVE_GROUP_CHAT,LEAVE_PRIVATE_CHAT:a.FUSION_PACKET_TYPES.LEAVE_PRIVATE_CHAT,GET_MESSAGES:a.FUSION_PACKET_TYPES.GET_MESSAGES,SET_CHAT_NAME:a.FUSION_PACKET_TYPES.SET_CHAT_NAME},request_group_chat_participant:function(){var e=o.create_packet(this.packets.GET_GROUP_CHAT_PARTICIPANTS);e.add_field("groupchatid",this.get("destination")),e.add_field("imtype",this.get("messageType")),this.send_packet(e)},rename_chat:function(e){if(e=$.trim(e),this.is_group_chat()&&""!==e&&this.getTitle()!==e){var t=o.create_packet(this.packets.SET_CHAT_NAME);t.add_field("chatidentifier",this.get("destination")),t.add_field("chatname",e),t.add_field("chattype",this.get("destinationType")),this.send_packet(t),this.set("destinationName",e)}},constructor:function(){var e=require("modules/chat/models/session");d.__super__.constructor.apply(this,arguments),this.session_user=e.get("session_user"),this.user_owned=this.session_user===this.get("createdBy"),this.participants=[],this.messages=new n.ChatMessagesCollection,this.emoticons=e.emoticon_hotkeys.join(" "),this.initialization_time=Date.now(),this.is_group_chat()?this.request_group_chat_participant():(this.participants.push(this.session_user),this.participants.push(this.get("destinationName"))),this.on("change:destinationName",function(){console.log("We changed the name after all that!"),this.trigger("chat_name_change",this)},this);var t=this.messages;t.on("add",function(e){this.trigger("chat_message_added",e),this.increment_unread_message_count()},this)},getInitializationTime:function(){return this.initialization_time},getLastMessage:function(){return this.messages.last()},getMessages:function(){return this.messages},fetchRecentMessages:function(){this.messages.size()>0?this.fetchMessages():this.fetchMessages()},fetchPreviousMessages:function(){this.messages.size()>0?this.fetchMessages():this.fetchMessages()},is_next_message_contiguous:function(e){var t=this.get_next_message(e);return e.is_live_message()||!t||t.is_live_message()||this.is_prev_message_contiguous(t)},is_prev_message_contiguous:function(e){if(e.is_live_message()||!e.get("previous_message_id"))return!0;var t=e.get("previous_message_id");return!l.isEmpty(this.messages.get(t))},fetchMessages:function(e,t,n){var i=require("modules/chat/models/session"),a=n||10;t=t||i.get_aproximated_server_time(),e=e||0;var s=o.create_packet(this.packets.GET_MESSAGES);s.add_field("chatidentifier",this.get("destination")),s.add_field("chattype",this.get("destinationType")),s.add_field("limit",a),s.add_field("latestmessagetimestamp",t),s.add_field("oldestmessagetimestamp",e),this.send_packet(s)},getTitle:function(){if(this.is_group_chat()){if(this.get("destinationName")&&""!==this.get("destinationName"))return this.get("destinationName");var e=this.participants.join(", ")||"Group Chat";return e}return this.get("destinationName")},invoke_activate_event:function(){this.trigger("chat_activate")},getParticipants:function(){return this.participants},add_participant:function(e){e=$.trim(e),!l.contains(this.participants,e)&&e&&(console.log("Addding "+e+" as participant"),this.participants.push(e),this.trigger("participant_added",e))},remove_participant:function(e){e=$.trim(e),l.without(this.participants,e),this.trigger("participant_added",e)},getUserListAsString:function(){var e=this.participants.join(", ")||"0 Participants";return e},getParticipantCount:function(){return this.participants.length},is_fusion_chat:function(){return this.get("messageType")==i.getMessageType(i.IM_Type.fusion)},addTextMessageToStore:function(e){var t=require("modules/chat/models/session"),n={message:e,source:this.session_user,content_type:i.Content_Type.text,message_type:this.get("messageType"),admin_message:!1,allowed_emoticons:"",emoticons:t.emoticon_hotkeys.join(" "),source_colour:"",message_colour:"",chatroom_type:this.get("destinationType"),chatroom_identifier:this.get("chatHandle"),destination:this.get("destination"),inSync:!1,time:t.get_aproximated_server_time(),message_id:Date.now()},o=this.add_chat_message(n);return o},addUserTextMessage:function(t){var n=require("modules/chat/models/session"),a=o.create_packet(this.packets.MESSAGE);a.add_field("guid",e.get_guid()),a.add_field("messagetype",this.get("messageType")),a.add_field("source",this.session_user),a.add_field("destinationtype",this.get("destinationType")),a.add_field("destination",this.get("destination")),a.add_field("contactid",this.get("contactId")),a.add_field("timestamp",n.get_aproximated_server_time()),a.add_field("contenttype",i.Content_Type.text),a.add_field("contentasstring",t),a.on(o.packet_events.ok,function(){},this),a.on(o.packet_events.error,function(e){var n=e.response_packet;console.log("Failed to send message!");var i="Failed to send the message - "+t,o=n.get_error_message()||i;this.addTextMessageToStore(o)},this),this.send_packet(a);var s="/"==t.charAt(0);s||r.broadcast_response([a.to_packet_json()])},subscribed_packets:[{packet:a.FUSION_PACKET_TYPES.GROUP_CHAT_PARTICIPANTS,on_packet_received:function(e){var t=e.field_names,n=e.get_field_value(t.groupchatid);if(n!=this.get("destination"))return console.log("doesn't belong to this chat"),void 0;var i=e.get_field_value(t.participants);i&&(this.participants=l.compact(i.split(";")),this.trigger("participant_added",this.participants))}}]}),p=c.Collection.extend({model:d}),f=t.extend({constructor:function(){f.__super__.constructor.apply(this,arguments);var e=this;this.chats=new p,this.chats.on("add",function(t){e.trigger("chat_added",t)},this),this.chats.on("update",function(e){this.trigger("chat_updated",e)},this),this.save=l.throttle(l.bind(this._save,this),500)},init:function(){var e=require("modules/chat/models/session");e.on("session_created",this.getChats,this)},getChats:function(){console.log("getChats");var e=require("modules/chat/models/session"),t=null,n=e.get_user_data("chat_list");if(n&&(t=n.chat_list_version,this.chats.reset(n.chats)),!t||t!=e.get("chat_list_version")){var i=o.create_packet(a.FUSION_PACKET_TYPES.GET_CHATS);i.add_field("version",0),this.queue_packet(i)}},_save:function(){var e=require("modules/chat/models/session");e.set_user_data("chat_list",{chat_list_version:e.get("chat_list_version"),chats:this.chats.toJSON()})},startPrivateChat:function(e,t,n,o){console.log("Starting chat"),console.log(arguments);var a=this.chats;n=n||i.IM_Type.fusion;var s=i.getMessageType(n),r=i.DestinationType.individual;o=o||t;var l=u(""+r,""+o),c=a.get(l);return c?c.invoke_activate_event():(a.add({chatHandle:l,messageType:s,destinationType:r,destination:o,destinationName:t,createdBy:o,contactId:e,userInitiated:!0}),c=a.get(l),this.trigger("user_initiated_chat",c)),c},startGroupChat:function(e){var t,n=this,i=[];if(e&&0!==e.length){var s=e[0].getDisplayName();if(1===e.length)return this.startPrivateChat(e[0].get("contactId"),s),void 0;l.each(e,function(e,t){0!==t&&i.push(e.getDisplayName())},this),t=o.create_packet(a.FUSION_PACKET_TYPES.CREATE_GROUP_CHAT),t.add_field("participant",s),t.add_field("otherpartylist","web:"+i.join(",")),t.on("error",function(e){var t=e.response_packet,i=t.get_error_message();n.trigger("chat_invite_failed",i)}),this.send_packet(t)}},subscribed_packets:[{packet:a.FUSION_PACKET_TYPES.MESSAGE,on_packet_received:function(e){var t=this.chats,n=e.field_names,o=e.get_field_value(n.destinationtype);if(o!=i.DestinationType.public_chat){var a=require("modules/chat/models/session"),s=a.get("session_user"),r=e.get_field_value(n.messagetype),c=e.get_field_value(n.source),d=e.get_field_value(n.destination),p=e.get_field_value(n.contactid),f=e.get_field_value(n.contentasstring),m=e.get_field_value(n.contenttype),g=e.get_field_value(n.hotkeys),_=e.get_field_value(n.messagecolor),v=e.get_field_value(n.sourcecolor),y=parseInt(e.get_field_value(n.timestamp),10),w=a.get_aproximated_server_time();y=y?y:w;var b=e.get_field_value(n.guid),x=e.get_field_value(n.emotecontenttype),k=e.get_field_value(n.previousmessageguid),C=c,E=c==s;E&&l.isEmpty(g)&&(g=a.emoticon_hotkeys_all.join(" ")),o==i.DestinationType.individual?C=E?d:c:o==i.DestinationType.group&&(C=d);var T=u(""+o,""+C);console.log("chat_handle: "+T);var S=t.get(T);if(S||(t.add({chatHandle:T,messageType:r,destinationType:o,destination:C,destinationName:o==i.DestinationType.group?"":h.get_display_name_from_cache(C),createdBy:c,contactId:p}),S=t.get(T)),S.add_chat_message({message:f,source:h.get_display_name_from_cache(c),content_type:m,message_type:r,admin_message:!1,allowed_emoticons:g,emoticons:g,source_colour:v,message_colour:_,chatroom_type:o,chatroom_identifier:T,destination:d,time:new Date(y),message_id:b,emote_type:x,previous_message_id:k}),(2==o||3==o)&&e.get_field_value(n.source)==d){if(-1!=f.indexOf("has entered")||-1!=f.indexOf("has left")){var P=$.trim(f).split(" "),A=P[0];A!=s&&(-1!=f.indexOf("has entered")?S.add_participant(A):-1!=f.indexOf("has left")&&S.remove_participant(A))}(-1!=f.indexOf("kicked")||-1!=f.indexOf("invited"))&&S.request_group_chat_participant()}}}},{packet:a.FUSION_PACKET_TYPES.GROUP_CHAT,on_packet_received:function(e){var t=e.field_names,n=this.chats,o=e.get_field_value(t.imtype),a=e.get_field_value(t.groupchatid),s=e.get_field_value(t.creator),r=i.DestinationType.group,l=u(""+r,""+a);n.add({chatHandle:l,messageType:o,destinationType:r,destination:a,createdBy:s,contactId:null})}},{packet:a.FUSION_PACKET_TYPES.CHAT,on_packet_received:function(e){var t=e.toObject(),n=u(t.chattype,t.chatidentifier),o=require("modules/chat/models/session");if(parseInt(t.isclosedchat,10)){var a=this.chats.get(n);a&&this.chats.remove(a)}else{var s={chatHandle:n,messageType:t.messagetype,destinationType:t.chattype,destination:t.chatidentifier,destinationName:t.chatdisplayname};t.chattype===i.DestinationType.individual?l.extend(s,{createdBy:o.get("session_user"),contactId:t.contactid}):l.extend(s,{createdBy:t.groupowner}),this.chats.add(s)}}},{packet:a.FUSION_PACKET_TYPES.CHAT_LIST_VERSION,on_packet_received:function(e){var t=e.field_names,n=require("modules/chat/models/session");n.set("chat_list_version",e.get_field_value(t.version))}}]});return{ChatStore:new f}}),define("modules/chat/models/chat_room",["modules/common/utility","modules/chat/models/mig_model","modules/chat/models/chat_message","modules/chat/config/config","modules/chat/fusion/packet","modules/chat/fusion/packet_defs","modules/chat/data/transport","underscore","backbone","jquery"],function(e,t,n,i,o,a,s,r,l){var c={},u=n.ChatMessageModel,h=n.ChatMessagesCollection,d=1,p=2,f=t.extend({idAttribute:"chatRoomId",unread_messages_count:0,constructor:function(){var e=require("modules/chat/models/session");f.__super__.constructor.apply(this,arguments),this.set("chatHandle","chatroom_"+this.get("name").replace(" ","_")),this.participants=[],this.admins=[],this.participants_received=!1,this.participants_requested=!1,this.join_request_sent=!1,this.initialization_time=Date.now(),this.session_user=e.get("session_user"),this.emoticons=e.emoticon_hotkeys_all.join(" "),this.messages=new h;var t=this;this.messages.on("add",function(e){t.trigger("chat_message_added",e),t.increment_unread_message_count()},this)},packets:{JOIN_CHATROOM:a.FUSION_PACKET_TYPES.JOIN_CHATROOM,LEAVE_CHATROOM:a.FUSION_PACKET_TYPES.LEAVE_CHATROOM,GET_CHATROOM_PARTICIPANTS:a.FUSION_PACKET_TYPES.GET_CHATROOM_PARTICIPANTS,MESSAGE:a.FUSION_PACKET_TYPES.MESSAGE,KICK_CHATROOM_PARTICIPANT:a.FUSION_PACKET_TYPES.KICK_CHATROOM_PARTICIPANT},getUserListAsString:function(){var e=this.participants.join(", ")||"0 Participants";return e},rename_chat:function(){return!1},getParticipantCount:function(){return this.participants.length},get_unread_message_count:function(){return this.unread_messages_count||0},reset_unread_message_count:function(){this.unread_messages_count=0,this.trigger("unread_message_count_changed")},increment_unread_message_count:function(){this.unread_messages_count+=1,this.trigger("unread_message_count_changed")},getInitializationTime:function(){return this.initialization_time},getLastMessage:function(){return this.messages.last()},had_unread_messages:function(){return this.unread_messages_count>0},subscribed_packets:[],is_fusion_chat:function(){return!0},getDisplayName:function(){return this.get("name")+" ("+this.get("size")+"/"+this.get("max_size")+")"},getSize:function(){return this.get("size")},get_prev_message:function(e){return this.messages.prev(e)},get_next_message:function(e){return this.messages.next(e)},getMaxSize:function(){return this.get("max_size")},fetchRecentMessages:function(){return null},fetchPreviousMessages:function(){return null},fetchMessages:function(){return null},getName:function(){return this.get("name")},is_next_message_contiguous:function(){return!1},is_prev_message_contiguous:function(){return!1},setJoinedState:function(e){var t=this;this.get("hasJoined")!=e&&(this.set("hasJoined",e),e?t.trigger("chatroom_joined",t):t.trigger("chatroom_left",t))},invoke_activate_event:function(){this.trigger("chat_activate")},join_chatroom:function(){if(!this.join_request_sent){if(this.get("hasJoined"))return this.invoke_activate_event(),void 0;var e=o.create_packet(this.packets.JOIN_CHATROOM);e.add_field("chatroomname",this.get("name"));var t=this;e.on("response",function(){t.get("hasJoined")||t.request_chatroom_participants(),t.setJoinedState(!0),t.initialization_time=Date.now(),t.join_request_sent=!1}),e.on("error",function(e){var n=e.response_packet,i=n.get_error_message();t.setJoinedState(!1),t.trigger("chatroom_join_failed",i),t.join_request_sent=!1}),this.send_packet(e),t.setJoinedState(!0),this.join_request_sent=!0}},leave_chatroom:function(){this.messages.reset([]);var e=this,t=o.create_packet(this.packets.LEAVE_CHATROOM);t.add_field("chatroomname",this.get("name")),t.on("response",function(){e.set("hasJoined",!1)}),this.send_packet(t)},request_chatroom_participants:function(){if(!this.participants_requested){var e=o.create_packet(this.packets.GET_CHATROOM_PARTICIPANTS);e.add_field("chatroomname",this.get("name"));var t=this;e.on("response",function(e){t.participants_requested=!1;var n=e.response_packet;if(708==n.type){t.admins=[],t.participants=[],t.participants_received=!0;var i=n.field_names,o=n.get_field_value(i.administrators);if(o){var a=o.split(";");r.each(a,function(e){t.add_admin(e)})}var s=n.get_field_value(i.participants);if(!s)return;var l=s.split(";");r.each(l,function(e){t.add_participant(e)})}}),e.on("error",function(){t.participants_requested=!1}),this.send_packet(e),this.participants_requested=!0}},is_admin:function(e){return r.contains(this.admins,e)},is_group_chat:function(){return!1},add_admin:function(e){e=$.trim(e),r.contains(this.participants,e)||""===e||this.admins.push(e)},add_participant:function(e){e=$.trim(e),$.contains(this.participants,e)||""===e||(this.participants.push(e),this.trigger("participant_added",e))},remove_participant:function(e){e=$.trim(e),this.participants=r.without(this.participants,e),this.trigger("participant_removed",e)},is_chat_room:function(){return!0},set_as_favourite:function(){v.add_favourite_chatroom(this.get("name"))},remove_as_favourite:function(){v.remove_favourite_chatroom(this.get("name"))},add_chat_message:function(e){var t=this.messages;return e.message_id=Date.now(),t.add(e),this.setJoinedState(!0),t.get(e.message_id)},getMessages:function(){return this.messages},getTitle:function(){return this.get("name")},getParticipants:function(){return this.participants_received||this.request_chatroom_participants(),this.participants},addParticipants:function(e){e&&0!==e.length&&r.each(e,function(e){this.addParticipant(e.getDisplayName(),e.get("contactId"))},this)},addParticipant:function(e,t){var n=require("modules/chat/models/chat").ChatStore,i=n.startPrivateChat(t,e),o="Come and join me in +["+this.get("name")+"] chatroom";i.addUserTextMessage(o)},send_kick_user:function(e){var t=o.create_packet(this.packets.KICK_CHATROOM_PARTICIPANT);t.add_field("chatroomname",this.get("name")),t.add_field("username",e),this.send_packet(t)},addTextMessageToStore:function(e,t){var n=require("modules/chat/models/session"),o=null,a={message:e,source:this.session_user,content_type:i.Content_Type.text,message_type:this.get("messageType"),admin_message:!1,allowed_emoticons:"",emoticons:n.emoticon_hotkeys_all.join(" "),source_colour:"",message_colour:"",chatroom_type:this.get("destinationType"),chatroom_identifier:this.get("chatHandle"),destination:this.get("destination"),inSync:!1,time:new Date};return t="/"==e.charAt(0),t?(a.id=Date.now(),o=new u(a)):o=this.add_chat_message(a),o},addUserTextMessage:function(t){var n=o.create_packet(this.packets.MESSAGE);n.add_field("guid",e.get_guid()),n.add_field("messagetype",i.getMessageType(i.IM_Type.fusion)),n.add_field("source",this.session_user),n.add_field("destinationtype",i.DestinationType.public_chat),n.add_field("destination",this.get("name")),n.add_field("contenttype",i.Content_Type.text),n.add_field("contentasstring",t),console.log("message supposed to be sent "+t),n.on(o.packet_events.ok,function(){},this);var a=t;n.on(o.packet_events.error,function(e){var t=e.response_packet,n="Failed to send the message - "+a,i=t.get_error_message()||n;this.addTextMessageToStore(i)},this),this.send_packet(n);var r="/"==t.charAt(0);r||s.broadcast_response([n.to_packet_json()])}}),m=l.Collection.extend({model:f}),g=t.extend({idAttribute:"categoryId",packets:{GET_CATEGORIZED_CHATROOMS:a.FUSION_PACKET_TYPES.GET_CATEGORIZED_CHATROOMS,JOIN_CHATROOM:a.FUSION_PACKET_TYPES.JOIN_CHATROOM,LEAVE_CHATROOM:a.FUSION_PACKET_TYPES.LEAVE_CHATROOM},subscribed_packets:[],constructor:function(){g.__super__.constructor.apply(this,arguments),this.chatRooms=new m,this.chatRooms.on("add",function(e){var t=e.get("name");this.chat_room_cache_by_name[t]=e,this.chat_room_cache_by_id[e.get("chatRoomId")]=e,this.trigger("chatroom_added",e)},this),this.chatRooms.on("update",function(e){this.trigger("chatroom_updated",e)},this),this.chatRooms.on("remove",function(e){var t=e.get("name");this.chat_room_cache_by_name[t]=null,this.chat_room_cache_by_id[e.get("chatRoomId")]=null,this.trigger("chatroom_removed",e)},this),this.chat_room_cache_by_name={},this.chat_room_cache_by_id={},this.refreshed_once=!1,this.get("notfromserver")||this.refresh()},add_chatroom_model:function(e){var t=e.get("name"),n=this.get_chatroom_by_name(t);n?this.trigger("chatroom_added",n):this.chatRooms.add(e)},send_remove_chatroom:function(e){v.remove_favourite_chatroom(e)},get_chatroom_by_name:function(e){return this.chat_room_cache_by_name[e]},get_chatroom_by_id:function(e){return this.chat_room_cache_by_id[e]},refresh:function(e){var t=this;if(e=!this.refreshed_once||e,!this._is_refreshing){var n=o.create_packet(this.packets.GET_CATEGORIZED_CHATROOMS);n.add_field("category",this.get("categoryId")),n.add_field("refresh",e?1:0),n.on("response",function(e){t.refreshed_once=!0;var n=e.response_packet;n.type==a.FUSION_PACKET_TYPES.GET_CATEGORIZED_CHATROOMS_COMPLETE&&(t._is_refreshing=!1,t.trigger("refresh_stop",t))}),n.on("error",function(){t._is_refreshing=!1,t.trigger("refresh_stop",t)}),this.queue_packet(n),this._is_refreshing=!0,this.trigger("refresh_start",t)}}}),_=l.Collection.extend({model:g}),v=t.extend({constructor:function(){v.__super__.constructor.apply(this,arguments),this.chatRoomCategories=new _,this.attachCategoryCollectionEvents(this.chatRoomCategories),this.uncategorized_group_id=-999,this.favourite_chatroom_category=null,this.recent_chatroom_category=null,this.uncategorized_chatrooms=new g({categoryId:this.uncategorized_group_id,name:"_uncategorized",notfromserver:"true"}),this.chat_room_cache_by_name={},this.chat_room_cache_by_id={}},attachCategoryCollectionEvents:function(e){e.on("add",function(e){var t=e.get("categoryId");t===d&&(this.favourite_chatroom_category=e),t===p&&(this.recent_chatroom_category=e)},this)},packets:{GET_CHATROOM_CATEGORIES:a.FUSION_PACKET_TYPES.GET_CHATROOM_CATEGORIES,ADD_FAVOURITE_CHATROOM:a.FUSION_PACKET_TYPES.ADD_FAVOURITE_CHATROOM,REMOVE_FAVOURITE_CHATROOM:a.FUSION_PACKET_TYPES.REMOVE_FAVOURITE_CHATROOM},refresh_chatrooms:function(){var e=this.chatRoomCategories;e.each(function(e){e.refresh(!0)},this)},refresh_chatroom_category:function(e){var t=this.chatRoomCategories.get(e);t&&t.refresh(!1)},get_chatroom_categories:function(){var e=o.create_packet(this.packets.GET_CHATROOM_CATEGORIES);this.queue_packet(e)},get_chatroom_category_by_id:function(e){return this.chatRoomCategories.get(e)},get_chatroom_by_id:function(e){return this.chat_room_cache_by_id[e]},get_chatroom_by_name:function(e){return this.chat_room_cache_by_name[e]},join_chatroom_by_name:function(e){var t=this.get_chatroom_by_name(e);t||(t=new f({name:e,destination:e}),this.attach_chatroom_event(t),this.chat_room_cache_by_name[e]=t),t.join_chatroom()},init:function(){var e=require("modules/chat/models/session");e.on("session_created",function(){this.get_chatroom_categories()},this);var t=this.chatRoomCategories;t.on("add",function(e){this.trigger("chatroom_category_added",e)},this),t.on("update",function(e){this.trigger("chatroom_category_update",e)},this)},is_chatroom_favourite:function(e){if(!this.favourite_chatroom_category)return!1;var t=this.favourite_chatroom_category.chatRooms;return-1!==r.indexOf(t.pluck("name"),e)},add_recent_chatroom:function(e){this.recent_chatroom_category&&this.recent_chatroom_category.add_chatroom_model(e)},add_favourite_chatroom:function(e){var t=this.get_chatroom_by_name(e),n=o.create_packet(this.packets.ADD_FAVOURITE_CHATROOM);n.add_field("chatroomname",t.get("name")),n.on("error",function(e){var n=e.response_packet;t.trigger("add_favourite_failed",n.get_error_message(),t),this.trigger("add_favourite_failed",n.get_error_message(),this,t)},this),this.send_packet(n)},remove_favourite_chatroom:function(e){var t=o.create_packet(this.packets.REMOVE_FAVOURITE_CHATROOM),n=this.get_chatroom_by_name(e);t.add_field("category",this.get("categoryId")),t.add_field("chatroomname",e),t.on("error",function(e){var t=e.response_packet;this.favourite_chatroom_category&&this.favourite_chatroom_category.trigger("remove_chatroom_failed",t.get_error_message(),this,n),this.trigger("remove_chatroom_failed",t.get_error_message(),this,n)},this),t.on("response",function(){this.favourite_chatroom_category&&this.favourite_chatroom_category.chatRooms.remove(n)},this),this.send_packet(t)},attach_chatroom_event:function(e){e.on("chatroom_joined",function(e){this.trigger("chatroom_joined",e),this.add_recent_chatroom(e)},this),e.on("chatroom_join_failed",function(e){this.trigger("chatroom_join_failed",e)},this)},subscribed_packets:[{packet:a.FUSION_PACKET_TYPES.CHATROOM_NOTIFICATION,on_packet_received:function(e){e=e.toObject(),this.trigger("chatroom_notification",e.text)}},{packet:a.FUSION_PACKET_TYPES.CHATROOM,on_packet_received:function(e){var t=e.field_names,n=e.get_field_value(t.category),i=this.chatRoomCategories.get(n);i||(i=this.uncategorized_chatrooms);var o=e.get_field_value(t.chatroomid),a=e.get_field_value(t.chatroomname),s=this.get_chatroom_by_name(a);s?(this.chat_room_cache_by_id[o]=s,o!=s.get("chatRoomId")&&s.set("chatRoomId",o)):(s=new f({chatRoomId:o,name:a,destination:a,description:e.get_field_value(t.description),max_size:e.get_field_value(t.maximumsize),size:e.get_field_value(t.size),adult_only:e.get_field_value(t.adultonly),user_owned:e.get_field_value(t.newowner),group_id:e.get_field_value(t.groupid),creator:e.get_field_value(t.userowned)}),this.chat_room_cache_by_name[a]=s,this.chat_room_cache_by_id[o]=s,this.attach_chatroom_event(s)),i.add_chatroom_model(s)}},{packet:a.FUSION_PACKET_TYPES.CHATROOM_CATEGORY,on_packet_received:function(e){var t=e.field_names,n=e.get_field_value(t.category);this.chatRoomCategories.add({categoryId:parseInt(n,10),name:e.get_field_value(t.header),should_replace:e.get_field_value(t.refreshmethod),can_delete:1==e.get_field_value(t.itemscanbedeleted),can_collapse:1==e.get_field_value(t.collapse)});var i=this.chatRoomCategories.get(n);i.on("remove_chatroom_failed",function(e,t,n){this.trigger("remove_chatroom_failed",e,t,n)},this)}},{packet:a.FUSION_PACKET_TYPES.MESSAGE,on_packet_received:function(e){var t=e.field_names,n=e.get_field_value(t.destinationtype);if(n==i.DestinationType.public_chat){var o=e.get_field_value(t.messagetype),a=e.get_field_value(t.source),s=e.get_field_value(t.destination),l=this.get_chatroom_by_name(s);if(l){e.get_field_value(t.contactid);var c=e.get_field_value(t.contentasstring),u=e.get_field_value(t.contenttype),h=e.get_field_value(t.hotkeys),d=e.get_field_value(t.messagecolor),p=e.get_field_value(t.sourcecolor),f=require("modules/chat/models/session"),m=f.get("session_user"),g=a==s,_=a==m,v=e.get_field_value(t.emotecontenttype);if(_&&r.isEmpty(h)&&(h=f.emoticon_hotkeys_all.join(" ")),l.add_chat_message({message:c,source:a,content_type:u,message_type:o,admin_message:!1,allowed_emoticons:h,emoticons:h,source_colour:p,message_colour:d,chatroom_type:n,chatroom_identifier:s,destination:s,emote_type:v,time:new Date}),(2==n||3==n)&&g){if(-1!=c.indexOf("has entered")||-1!=c.indexOf("has left")){var y=$.trim(c).split(" "),w=y[0];w!=m&&(-1!=c.indexOf("has entered")?l.add_participant(w):-1!=c.indexOf("has left")&&l.remove_participant(w))}(-1!=c.indexOf("kicked")||-1!=c.indexOf("invited"))&&l.request_chatroom_participants()}}}}}]});return c.ChatRoomCategoryStore=new v,(r.isUndefined(window.mig33)||r.isNull(window.mig33))&&(window.mig33={}),mig33.chatroom_manager||(mig33.chatroom_manager={}),mig33.chatroom_manager.join_chatroom=function(e){c.ChatRoomCategoryStore.join_chatroom_by_name(e)},c}),define("modules/chat/models/session",["modules/chat/models/mig_model","modules/chat/fusion/packet_defs","modules/chat/fusion/packet","modules/chat/config/config","modules/chat/models/contact","modules/chat/models/chat","modules/chat/models/chat_room","modules/chat/data/transport","modules/common/utility","modules/common/local_storage","modules/common/task_runner","underscore","backbone","jquery"],function(e,t,n,i,o,a,s,r,l,c,u,h){var d=o.contactGroupStore,p=s.ChatRoomCategoryStore,f=e.extend({packets:{SET_PRESENCE:t.FUSION_PACKET_TYPES.SET_PRESENCE,CREATE_SESSION:t.FUSION_PACKET_TYPES.CREATE_SESSION,GET_ACCOUNT_BALANCE:t.FUSION_PACKET_TYPES.GET_ACCOUNT_BALANCE,CHANGE_USER_EVENT_SETTING:t.FUSION_PACKET_TYPES.CHANGE_USER_EVENT_SETTING,GET_CONTACT_REQUESTS:t.FUSION_PACKET_TYPES.GET_CONTACT_REQUESTS,GET_CONTACTS:t.FUSION_PACKET_TYPES.GET_CONTACTS,GET_CHATROOM_CATEGORIES:t.FUSION_PACKET_TYPES.GET_CHATROOM_CATEGORIES,SET_STATUS_MESSAGE:t.FUSION_PACKET_TYPES.SET_STATUS_MESSAGE,GET_EMOTICON_HOTKEYS:t.FUSION_PACKET_TYPES.GET_EMOTICON_HOTKEYS,GET_STICKER_PACK_LIST:t.FUSION_PACKET_TYPES.GET_STICKER_PACK_LIST,IM_LOGOUT:t.FUSION_PACKET_TYPES.IM_LOGOUT,GET_STICKER_PACK:t.FUSION_PACKET_TYPES.GET_STICKER_PACK,GET_EMOTICON:t.FUSION_PACKET_TYPES.GET_EMOTICON,IM_LOGIN:t.FUSION_PACKET_TYPES.IM_LOGIN,LOGOUT:t.FUSION_PACKET_TYPES.LOGOUT},subscribed_packets:[{packet:t.FUSION_PACKET_TYPES.STICKER_PACK_LIST,on_packet_received:function(e){e=e.toObject(),console.log(e);var t=e.stickerpackids,i=n.create_packet(this.packets.GET_STICKER_PACK);i.add_field("packids",t),this.queue_packet(i)}},{packet:t.FUSION_PACKET_TYPES.EMOTICON,on_packet_received:function(e){if(console.log("Hey got a emoticon packet"),e=e.toObject(),!h.isEmpty(e.packid)){var t=this.sticker_packs_by_id[e.packid];h.isEmpty(t)||t.stickers.push(e),t.stickers_by_hotkey[e.hotkey]=e,this.sticker_by_hotkeys[e.hotkey]=e,this.trigger("sticker_received",e,t)}}},{packet:t.FUSION_PACKET_TYPES.STICKER_PACK,on_packet_received:function(e){console.log("Hey got a sticker pack packet"),e=e.toObject(),console.log(e),this.sticker_packs_by_id[e.stickerpackid]||(e.hotkeys_cached=!1,e.stickers=[],e.stickers_by_hotkey={},e.stickerhotkeys=h.unique(e.stickerhotkeys.split(" ")).join(" "),this.sticker_packs.push(e),this.sticker_packs_by_id[e.stickerpackid]=e,this.trigger_fetch_stickers(e.stickerpackid),this.trigger("sticker_pack_received",e))}},{packet:t.FUSION_PACKET_TYPES.ERROR,on_packet_received:function(e){if(!e.parent_packet||500!=e.parent_packet.type){var t=e.get_error_message();h.isEmpty(t)||(console.log(e),l.show_error(t))}}},{packet:t.FUSION_PACKET_TYPES.ALERT,on_packet_received:function(e){var t=e.field_names,n=e.get_field_value(t.content);l.show_info(n)}},{packet:t.FUSION_PACKET_TYPES.GET_CHATROOM_CATEGORIES_COMPLETE,on_packet_received:function(){this.session_initialization_complete||(this.session_initialization_complete=!0,this.trigger("session_startup_completed"))}},{packet:t.FUSION_PACKET_TYPES.IM_SESSION_STATUS,on_packet_received:function(e){var t=e.field_names,n=parseInt(e.get_field_value(t.imtype),10),o=e.get_field_value(t.reason),a=e.get_field_value(t.status);switch(n){case i.IM_Type.msn:this.set("msn_signed_in","1"==a);break;case i.IM_Type.yahoo:this.set("yahoo_signed_in","1"==a);break;case i.IM_Type.gtalk:this.set("gtalk_signed_in","1"==a);break;case i.IM_Type.facebook:this.set("facebook_signed_in","1"==a)}this.trigger("im_status_update",{imtype:n,status:a,reason:o})}},{packet:t.FUSION_PACKET_TYPES.ALERT,on_packet_received:function(e){var t=parseInt(e.get_field_value(1),10),n=e.get_field_value(2),i=e.get_field_value(3),o="Alert";switch(t){case 1:o="Information";break;case 2:o="Warning";break;case 3:o="Error"}this.trigger("incident_alert",{title:o,content:n,content_type:i})}},{packet:t.FUSION_PACKET_TYPES.SET_STATUS_MESSAGE,on_packet_error:function(){console.log("Unable to set the status message")}},{packet:t.FUSION_PACKET_TYPES.CREATE_SESSION,on_packet_error:function(){console.log("Unable to create session in the server"),this.force_logout()}},{packet:t.FUSION_PACKET_TYPES.LOGIN_OK,on_packet_received:function(e){this.reconnecting=!1;var t=e.field_names,n=e.get_field_value(t.msndetail),o=e.get_field_value(t.yahoodetail),a=e.get_field_value(t.gtalkdetail),s=e.get_field_value(t.facebookdetail),r=e.get_field_value(t.mailurl)&&e.get_field_value(t.mailurl).length>0,l=e.get_field_value(t.servertime)||Date.now(),u=Date.now()-parseInt(l,10);this.set({msn_signed_in:2==n,yahoo_signed_in:2==o,gtalk_signed_in:2==a,facebook_signed_in:2==s,new_email:e.get_field_value(t.mailcount),contact_list_version:e.get_field_value(t.contactlistversion),chat_list_version:0,allow_email:r,supports_stickers:parseInt(e.get_field_value(t.supportsstickers),10),login_message:e.get_field_value(t.alert),login_mtype:e.get_field_value(t.alertcontenttype),session_user_level:e.get_field_value(t.reputationlevel),session_user_level_image:e.get_field_value(t.reputationimagepath),session_user_type:e.get_field_value(t.usertype),session_state:i.Application_State.logged_in,server_time_delta:u}),this.session_initialization_complete||(c.create_cookie("active_ajax",1),this.trigger("session_created",this),this.get_session_data(),this.start_check_session(),this.start_poll())}},{packet:t.FUSION_PACKET_TYPES.EMOTICON_HOTKEYS,on_packet_received:function(e){var t=e.field_names,n=e.get_field_value(t.hotkeys)+" "+e.get_field_value(t.alternatekeys);this.emoticon_hotkeys=e.get_field_value(t.hotkeys).split(" "),this.emoticon_hotkeys_alt=e.get_field_value(t.alternatekeys).split(" "),this.emoticon_hotkeys_all=n.split(" "),this.emoticon_hotkeys_array=[],this.trigger("emoticon_hotkeys",this)}},{packet:t.FUSION_PACKET_TYPES.CREATE_SESSION,on_packet_received:function(){}},{packet:t.FUSION_PACKET_TYPES.OK,on_packet_received:function(){}},{packet:t.FUSION_PACKET_TYPES.ERROR,on_packet_received:function(e){var t=e.field_names,n=e.get_field_value(t.errordescription);this.get("session_state")==i.Application_State.logging_in?this.force_logout(n):this.trigger("error",n)}},{packet:t.FUSION_PACKET_TYPES.ACCOUNT_BALANCE,on_packet_received:function(e){var t=e.field_names,n=e.get_field_value(t.accountbalance);
this.set({account_balance:n}),this.trigger("balance_updated")}},{packet:t.FUSION_PACKET_TYPES.AVATAR,on_packet_received:function(e){var t=e.field_names,n=e.get_field_value(t.statusmessage);this.set({status_message:n}),this.trigger("status_updated",this)}}],constructor:function(){f.__super__.constructor.apply(this,arguments),this.session_initialization_complete=!1,setTimeout(function(){d.init(),p.init(),a.ChatStore.init()},0),this.set("session_state",i.Application_State.check_session),this.poll_task_runner=new u,this.check_session_task_runner=new u,this.reconnecting=!1;var e=this;$(window).on("beforeunload",function(){e.clear_session()}),$(window).on("unload",function(){e.clear_session()}),this.emoticon_hotkeys=[],this.emoticon_hotkeys_alt=[],this.emoticon_hotkeys_all=[],this.emoticon_hotkeys_array=[],this.sticker_packs=[],this.sticker_packs_by_id={},this.sticker_by_hotkeys={},this.setup_transport_event_listener()},setup_transport_event_listener:function(){r.on(r.events.disconnected,function(){this.check_session()},this)},get_contact_request:function(){var e=n.create_packet(this.packets.GET_CONTACT_REQUESTS);this.queue_packet(e)},trigger_fetch_stickers:function(e){var t=this.sticker_packs_by_id[e];if(!h.isEmpty(t)){console.log(t);var i=n.create_packet(this.packets.GET_EMOTICON);i.add_field("hotkeys",t.stickerhotkeys),i.on("response",function(e){var t=e.response_packet.toObject();console.log("--"),console.log(t)}),this.queue_packet(i)}},trigger_fetch_sticker:function(e,t){var i=n.create_packet(this.packets.GET_EMOTICON);i.add_field("hotkeys",e),i.on("response",function(n){var i=n.response_packet.toObject();console.log(i),t(e,i)},this),this.send_packet(i)},get_sticker:function(e,t){var n=this;return this.sticker_by_hotkeys[e]?(h.defer(function(){t(e,n.sticker_by_hotkeys[e])}),void 0):(this.trigger_fetch_sticker(e,t),void 0)},init:function(){return i&&i.config.username?(console.log($.cookie("eid")),this.set({sid:$.cookie("eid"),session_state:i.Application_State.logging_in,presence:i.Presence.appear_offline,invisible_login:!0,session_user:i.config.username}),this.initiate_fusion_session(),void 0):(console.log("No need to create session, user is from non logged in public page"),this.trigger("no_session_initiated",this),void 0)},initiate_fusion_session:function(){if(console.log("Initiating fusion session for chat"),this.reconnecting)this.force_logout();else{this.reconnecting=!0;var e=n.create_packet(this.packets.CREATE_SESSION);e.add_field("clienttype",i.ClientType),e.add_field("sessionid",this.get("sid")),e.add_field("fontheight",16),e.add_field("screenwidth",800),e.add_field("stickersize",240),this.send_packet(e)}},setPresence:function(e){this.set({presence:e}),this.send_presence()},force_logout:function(e){e=e||"Unable to establish session",this.stop_poll(),this.stop_check_session(),this.clear_session(),this.set("session_state",i.Application_State.logging_in),this.trigger("logout_forced","We are having trouble connecting to mig33. You will be sent back to the login screen.")},user_logout:function(e){var t=this,o=n.create_packet(this.packets.LOGOUT);this.send_packet(o);var a=function(){t.stop_poll(),t.stop_check_session(),t.tear_down(),e&&(t.clear_session(),window.location=i.logout_url)};o.on("sent_success",a,this),o.on("send_failed",a,this)},tear_down:function(){c.clear_cookie("sid"),c.clear_cookie("eid"),c.remove("sess")},clear_session:function(){c.clear_cookie("active_ajax")},is_user_data_set:function(e){if(!this.get("session_user"))throw"No active session found;";return c.hasKey(this.get("session_user")+"_"+e)},get_aproximated_server_time:function(){return Date.now()-this.get("server_time_delta")},set_user_data:function(e,t){if(!this.get("session_user"))throw"No active session found;";c.set(this.get("session_user")+"_"+e,t)},get_user_data:function(e){if(!this.get("session_user"))throw"No active session found;";return c.get(this.get("session_user")+"_"+e)},remove_user_data:function(e){if(!this.get("session_user"))throw"No active session found;";return c.remove(this.get("session_user")+"_"+e)},get_user_im_status:function(e){var t=!1;switch(e){case"-3":t=this.get("facebook_signed_in")?!0:!1;break;case"-4":t=this.get("gtalk_signed_in")?!0:!1;break;case"-5":t=this.get("msn_signed_in")?!0:!1;break;case"-6":t=this.get("yahoo_signed_in")?!0:!1;break;default:}return t},get_session_data:function(){this.fetch_presence(),this.fetch_status_message(),this.fetch_emoticon_hotkeys()},fetch_emoticon_hotkeys:function(){var e=n.create_packet(this.packets.GET_EMOTICON_HOTKEYS);this.queue_packet(e)},fetch_emoticon:function(){var e;this.get("supports_stickers")&&(e=n.create_packet(this.packets.GET_STICKER_PACK_LIST),this.queue_packet(e))},fetch_status_message:function(){var e="/sites/ajax/profile/display_pic_xml",t=this,n=$.ajax(e,{dataType:"xml"});n.success(function(e){var n=null,i=$(e).find("displaypic").get(0);i&&(n=$(i).attr("statusMessage"),t.set({status_message:n}),t.trigger("status_updated",this))})},fetch_presence:function(){var e="/sites/ajax/api/profile_compat",t=this,n=$.ajax(e,{dataType:"json"});n.success(function(e){var n=l.parse_ajax_response(e);if(n.presence){if(n.presence==t.get("presence"))return;t.setPresence(n.presence)}else console.log(["Unable to query presence: ",e]);if(n.balance){var i=require("modules/mig33_app");i.vent.trigger(i.ApplicationEvents.ACCOUNT_BALANCE,n.balance)}else console.log(["Unable to get account balance: ",e])})},get_display_picture:function(e){var t=e&&e.x?e.x:"50",n=e&&e.y?e.y:"50";return i.image_server+"/a/"+this.get("session_user")+"?w="+t+"&h="+n+"&a=1&c=1&r="+this.random()},fetch_user_permissions:function(){var e="/sites/json/api/user_permissions",t=this,n=$.ajax(e,{type:"GET",dataType:"json"});n.success(function(e){var n,i,o,a,s;e&&(null===e.allow_add_to_photo_wall||h.isUndefined(e.allow_add_to_photo_wall)||(n=e.allow_add_to_photo_wall),null===e.allow_like||h.isUndefined(e.allow_like)||(i=e.allow_like),null===e.allow_like_level||h.isUndefined(e.allow_like_level)||(o=e.allow_like_level),null===e.avatar_created||h.isUndefined(e.avatar_created)||(a=e.avatar_created),null===e.allow_use_display_picture||h.isUndefined(e.allow_use_display_picture)||(s=e.allow_use_display_picture)),t.set({allow_add_to_photo_wall:n,allow_like:i,allow_like_level:o,avatar_created:a,allow_use_display_picture:s})})},send_presence:function(){console.log("Setting presence to "+this.get("presence"));var e=n.create_packet(this.packets.SET_PRESENCE);e.add_field("newpresence",this.get("presence")),e.on("response",function(){this.trigger("presence_changed",this.get("presence"))},this),this.queue_packet(e)},fetch_account_balance:function(){var e=n.create_packet(this.packets.GET_ACCOUNT_BALANCE);this.queue_packet(e)},send_user_event_setting:function(){var e=n.create_packet(this.packets.CHANGE_USER_EVENT_SETTING);e.add_field("allevents",1),this.queue_packet(e)},set_status_message:function(e){console.log("Setting status message to ["+e+"]"),session_user.status_message=e;var t=n.create_packet(this.packets.SET_STATUS_MESSAGE);t.add_field("statusmessage",e),this.send_packet(t)},retry_login:function(){this.initiate_fusion_session()},start_short_poll:function(){this.start_poll(i.short_poll_interval)},start_check_session:function(){this.stop_check_session(),console.log("Starting check session task");var e=i.check_session_interval,t={run:this.check_session,interval:1e3*e,scope:this};this.check_session_task_runner.start(t)},stop_check_session:function(){this.check_session_task_runner.stop()},check_session:function(){var e=this,t=$.ajax("/sites/ajax/session/check",{cache:!1,type:"GET",dataType:"json",timeout:3e4});t.done(function(t){t.error&&0!==parseInt(t.error.errno,10)?e.check_session_failure():e.check_session_success(t.data)}),t.fail(function(){e.check_session_failure()})},check_session_success:function(e){if(e&&e.is_logged_in){if(console.log("Session still alive"),r.is_connection_error&&(r.connection_success(),this.start_poll()),this.get("session_state")==i.Application_State.logged_in)return;this.set({session_user:e.username}),this.trigger("session_check_complete",this)}else console.log("Session died"),this.check_session_failure()},check_session_failure:function(){return this.force_logout("Unable to connect to the server.")},other_im_signout:function(e){var t=this,i=n.create_packet(this.packets.IM_LOGOUT);i.size=1,i.add_field("imtype",e),i.on("ok",function(){console.log("Successfuly signed out of IM"),t.trigger("im_status_change")}),i.on("error",function(e){var n=e.response_packet,i=n.get_error_message();t.trigger("im_signout_error",i)}),this.send_packet(i)},other_im_signin:function(e){var t=this,i=n.create_packet(this.packets.IM_LOGIN);i.size=3,i.add_field("imtype",e),i.add_field("initialpresence",1),i.add_field("showofflinecontacts",1),i.on("ok",function(){console.log("Successfull signed in")}),i.on("error",function(e){var n=e.response_packet,i=n.get_error_message();t.trigger("im_signin_error",i)}),this.send_packet(i)},start_poll:function(e){this.poll_task_runner.stop(),e=e||i.default_poll_interval,this.polling_interval=1e3*e;var t={run:this.do_poll,interval:this.polling_interval,scope:this};this.is_polling=!0,this.poll_task_runner.start(t)},stop_poll:function(){this.is_polling=!1,this.poll_task_runner.stop()},do_poll:function(){var e=10,t=Date.now(),n=c.hasKey("_lst_ping")?c.get("_lst_ping"):0;return console.log(t-n),console.log(this.polling_interval),this.polling_interval-e>t-n?(console.log("Some one else aleady pinged"),void 0):(console.log("Polling...."),this.send_packet(null),void 0)}});return new f({sid:null,session_user:null,presence:null,invisible_login:null,msn_signed_in:null,new_mail:null,yahoo_signed_in:null,gtalk_signed_in:null,facebook_signed_in:null,allow_email:null,login_message:null,login_mtype:null,session_user_level:null,session_user_level_image:null,session_user_type:null,session_state:null,allow_add_to_photo_wall:null,allow_like:null,allow_like_level:null,avatar_created:null,allow_use_display_picture:null,account_balance:null,status_message:null})}),define("modules/chat/util/emoticon_cache",["underscore","backbone","jquery"],function(e,t){var n=function(){},i=new t.Collection;return e.extend(n,t.Events),e.extend(n,{_get_emoticon_data:function(t,n,o){var a=this,s=$.ajax("/sites/ajax/api/get_emoticon",{type:"POST",dataType:"json",beforeSend:function(e){e.setRequestHeader("Content-Type","application/json"),e.setRequestHeader("X-Mig33-JSON-Version","2")},data:JSON.stringify(t)});console.log("sending request"),console.log(t),s.success(function(t){console.log("welll well!"),console.log(t),e.each(t.emoticons,function(e){i.get(e.hk)||i.add({id:e.hk,data:e})},this),n&&n.call(o||a,t.emoticons),a.trigger("cachefilled")}),s.fail(function(){a.trigger("cache_failed")})},_load_emoticon:function(t,n,o){var a=this,s=[],r=[];e.isArray(t)||(t=t.split(" ")),e.each(t,function(e){i.get(e)?s.push(i.get(e).get("data")):r.push(e)}),n&&s.length>0&&n.call(o||a,s),0!==r.length&&this._get_emoticon_data({hotkeys:r},n,o)},get_cached_emoticon:function(e){return console.log("hotkey "+e),console.log(i),i.get(e)?i.get(e).get("data"):null},get_emoticon:function(e,t,n){e&&0!==e.length&&(i.get(e)?t&&t.call(n||this,i.get(e).get("data")):this._load_emoticon(e,t,n))},get_emoticons:function(t,n,i){if(t&&0!==t.length){var o=[];this._load_emoticon(t,function(t){e.each(t,function(e){o.push(e)}),n&&n.call(i||this,o)},this)}}}),n}),function(e,t,n){(function(e){"function"==typeof define&&define.amd?define("qtip",["jquery"],e):jQuery&&!jQuery.fn.qtip&&e(jQuery)})(function(i){function o(n){m={pageX:n.pageX,pageY:n.pageY,type:"mousemove",scrollX:e.pageXOffset||t.body.scrollLeft||t.documentElement.scrollLeft,scrollY:e.pageYOffset||t.body.scrollTop||t.documentElement.scrollTop}}function a(e){var t=function(e){return e===y||"object"!=typeof e},n=function(e){return!i.isFunction(e)&&(!e&&!e.attr||1>e.length||"object"==typeof e&&!e.jquery&&!e.then)};return e&&"object"==typeof e?(t(e.metadata)&&(e.metadata={type:e.metadata}),"content"in e&&((t(e.content)||e.content.jquery)&&(e.content={text:e.content}),n(e.content.text||v)&&(e.content.text=v),"title"in e.content&&(t(e.content.title)&&(e.content.title={text:e.content.title}),n(e.content.title.text||v)&&(e.content.title.text=v))),"position"in e&&t(e.position)&&(e.position={my:e.position,at:e.position}),"show"in e&&t(e.show)&&(e.show=e.show.jquery?{target:e.show}:e.show===_?{ready:_}:{event:e.show}),"hide"in e&&t(e.hide)&&(e.hide=e.hide.jquery?{target:e.hide}:{event:e.hide}),"style"in e&&t(e.style)&&(e.style={classes:e.style}),i.each(f,function(){this.sanitize&&this.sanitize(e)}),e):v}function s(s,r,l,c){function u(e){for(var t,n=0,i=r,o=e.split(".");i=i[o[n++]];)o.length>n&&(t=i);return[t||r,o.pop()]}function h(e){return j.concat("").join(e?"-"+e+" ":" ")}function d(){var e=r.style.widget,t=Q.hasClass(J);Q.removeClass(J),J=e?"ui-state-disabled":"qtip-disabled",Q.toggleClass(J,t),Q.toggleClass("ui-helper-reset "+h(),e).toggleClass(D,r.style.def&&!e),F.content&&F.content.toggleClass(h("content"),e),F.titlebar&&F.titlebar.toggleClass(h("header"),e),F.button&&F.button.toggleClass(N+"-icon",!e)}function w(e){F.title&&(F.titlebar.remove(),F.titlebar=F.title=F.button=y,e!==v&&B.reposition())}function b(){var e=r.content.title.button,t="string"==typeof e,n=t?e:"Close tooltip";F.button&&F.button.remove(),F.button=e.jquery?e:i("<a />",{"class":"qtip-close "+(r.style.widget?"":N+"-icon"),title:n,"aria-label":n}).prepend(i("<span />",{"class":"ui-icon ui-icon-close",html:"&times;"})),F.button.appendTo(F.titlebar||Q).attr("role","button").click(function(e){return Q.hasClass(J)||B.hide(e),v})}function x(){var e=V+"-title";F.titlebar&&w(),F.titlebar=i("<div />",{"class":N+"-titlebar "+(r.style.widget?h("header"):"")}).append(F.title=i("<div />",{id:e,"class":N+"-title","aria-atomic":_})).insertBefore(F.content).delegate(".qtip-close","mousedown keydown mouseup keyup mouseout",function(e){i(this).toggleClass("ui-state-active ui-state-focus","down"===e.type.substr(-4))}).delegate(".qtip-close","mouseover mouseout",function(e){i(this).toggleClass("ui-state-hover","mouseover"===e.type)}),r.content.title.button&&b()}function k(e){var t=F.button;return B.rendered?(e?b():t.remove(),n):v}function A(e,t){var o=F.title;return B.rendered&&e?(i.isFunction(e)&&(e=e.call(s,G.event,B)),e===v||!e&&""!==e?w(v):(e.jquery&&e.length>0?o.empty().append(e.css({display:"block"})):o.html(e),t!==v&&B.rendered&&Q[0].offsetWidth>0&&B.reposition(G.event),n)):v}function I(e){e&&i.isFunction(e.done)&&e.done(function(e){z(e,null,v)})}function z(e,t,o){function a(e){function t(t){t.src!==$&&-1===i.inArray(t,s)&&(s.push(t),i.data(t,"imagesLoaded",{src:t.src}),a.length===s.length&&(setTimeout(e),a.unbind(".imagesLoaded")))}var o=i(this),a=o.find("img").add(o.filter("img")),s=[];return a.length?(a.bind("load.imagesLoaded error.imagesLoaded",function(e){t(e.target)}).each(function(e,n){var o=n.src,a=i.data(n,"imagesLoaded");a&&a.src===o||n.complete&&n.naturalWidth?t(n):(n.readyState||n.complete)&&(n.src=$,n.src=o)}),n):e()}var l=F.content;return B.rendered&&e?(i.isFunction(e)&&(e=e.call(s,G.event,B)||""),o!==v&&I(r.content.deferred),e.jquery&&e.length>0?l.empty().append(e.css({display:"block"})):l.html(e),0>B.rendered?Q.queue("fx",a):(K=0,a.call(Q[0],i.noop)),B):v}function U(){function a(e){if(Q.hasClass(J))return v;clearTimeout(B.timers.show),clearTimeout(B.timers.hide);var t=function(){B.toggle(_,e)};r.show.delay>0?B.timers.show=setTimeout(t,r.show.delay):t()}function c(e){if(Q.hasClass(J)||Y||K)return v;var t=i(e.relatedTarget),n=t.closest(O)[0]===Q[0],o=t[0]===g.show[0];if(clearTimeout(B.timers.show),clearTimeout(B.timers.hide),this!==t[0]&&"mouse"===d.target&&n||r.hide.fixed&&/mouse(out|leave|move)/.test(e.type)&&(n||o))try{e.preventDefault(),e.stopImmediatePropagation()}catch(a){}else r.hide.delay>0?B.timers.hide=setTimeout(function(){B.hide(e)},r.hide.delay):B.hide(e)}function u(e){return Q.hasClass(J)?v:(clearTimeout(B.timers.inactive),B.timers.inactive=setTimeout(function(){B.hide(e)},r.hide.inactive),n)}function h(e){B.rendered&&Q[0].offsetWidth>0&&B.reposition(e)}var d=r.position,g={show:r.show.target,hide:r.hide.target,viewport:i(d.viewport),document:i(t),body:i(t.body),window:i(e)},y={show:i.trim(""+r.show.event).split(" "),hide:i.trim(""+r.hide.event).split(" ")};6===f.ie,Q.bind("mouseenter"+X+" mouseleave"+X,function(e){var t="mouseenter"===e.type;t&&B.focus(e),Q.toggleClass(L,t)}),/mouse(out|leave)/i.test(r.hide.event)&&"window"===r.hide.leave&&g.document.bind("mouseout"+X+" blur"+X,function(e){/select|option/.test(e.target.nodeName)||e.relatedTarget||B.hide(e)}),r.hide.fixed?(g.hide=g.hide.add(Q),Q.bind("mouseover"+X,function(){Q.hasClass(J)||clearTimeout(B.timers.hide)})):/mouse(over|enter)/i.test(r.show.event)&&g.hide.bind("mouseleave"+X,function(){clearTimeout(B.timers.show)}),(""+r.hide.event).indexOf("unfocus")>-1&&d.container.closest("html").bind("mousedown"+X+" touchstart"+X,function(e){var t=i(e.target),n=B.rendered&&!Q.hasClass(J)&&Q[0].offsetWidth>0,o=t.parents(O).filter(Q[0]).length>0;t[0]===s[0]||t[0]===Q[0]||o||s.has(t[0]).length||!n||B.hide(e)}),"number"==typeof r.hide.inactive&&(g.show.bind("qtip-"+l+"-inactive",u),i.each(p.inactiveEvents,function(e,t){g.hide.add(F.tooltip).bind(t+X+"-inactive",u)})),i.each(y.hide,function(e,t){var n=i.inArray(t,y.show),o=i(g.hide);n>-1&&o.add(g.show).length===o.length||"unfocus"===t?(g.show.bind(t+X,function(e){Q[0].offsetWidth>0?c(e):a(e)}),delete y.show[n]):g.hide.bind(t+X,c)}),i.each(y.show,function(e,t){g.show.bind(t+X,a)}),"number"==typeof r.hide.distance&&g.show.add(Q).bind("mousemove"+X,function(e){var t=G.origin||{},n=r.hide.distance,i=Math.abs;(i(e.pageX-t.pageX)>=n||i(e.pageY-t.pageY)>=n)&&B.hide(e)}),"mouse"===d.target&&(g.show.bind("mousemove"+X,o),d.adjust.mouse&&(r.hide.event&&(Q.bind("mouseleave"+X,function(e){(e.relatedTarget||e.target)!==g.show[0]&&B.hide(e)}),F.target.bind("mouseenter"+X+" mouseleave"+X,function(e){G.onTarget="mouseenter"===e.type})),g.document.bind("mousemove"+X,function(e){B.rendered&&G.onTarget&&!Q.hasClass(J)&&Q[0].offsetWidth>0&&B.reposition(e||m)}))),(d.adjust.resize||g.viewport.length)&&(i.event.special.resize?g.viewport:g.window).bind("resize"+X,h),d.adjust.scroll&&g.window.add(d.container).bind("scroll"+X,h)}function W(){var n=[r.show.target[0],r.hide.target[0],B.rendered&&F.tooltip[0],r.position.container[0],r.position.viewport[0],r.position.container.closest("html")[0],e,t];B.rendered?i([]).pushStack(i.grep(n,function(e){return"object"==typeof e})).unbind(X):r.show.target.unbind(X+"-create")}var F,G,B=this,V=(t.body,N+"-"+l),Y=0,K=0,Q=i(),X=".qtip-"+l,J="qtip-disabled";B.id=l,B.rendered=v,B.destroyed=v,B.elements=F={target:s},B.timers={img:{}},B.options=r,B.checks={},B.plugins={},B.cache=G={event:{},target:i(),disabled:v,attr:c,onTarget:v,lastClass:""},B.checks.builtin={"^id$":function(e,t,n){var o=n===_?p.nextid:n,a=N+"-"+o;o!==v&&o.length>0&&!i("#"+a).length&&(Q[0].id=a,F.content[0].id=a+"-content",F.title[0].id=a+"-title")},"^content.text$":function(){z(r.content.text)},"^content.deferred$":function(){I(r.content.deferred)},"^content.title.text$":function(e,t,i){return i?(!F.title&&i&&x(),A(i),n):w()},"^content.title.button$":function(e,t,n){k(n)},"^position.(my|at)$":function(e,t,n){"string"==typeof n&&(e[t]=new f.Corner(n))},"^position.container$":function(e,t,n){B.rendered&&Q.appendTo(n)},"^show.ready$":function(){B.rendered?B.toggle(_):B.render(1)},"^style.classes$":function(e,t,n){Q.attr("class",N+" qtip "+n)},"^style.width|height":function(e,t,n){Q.css(t,n)},"^style.widget|content.title":d,"^events.(render|show|move|hide|focus|blur)$":function(e,t,n){Q[(i.isFunction(n)?"":"un")+"bind"]("tooltip"+t,n)},"^(show|hide|position).(event|target|fixed|inactive|leave|distance|viewport|adjust)":function(){var e=r.position;Q.attr("tracking","mouse"===e.target&&e.adjust.mouse),W(),U()}},i.extend(B,{_triggerEvent:function(e,t,n){var o=i.Event("tooltip"+e);return o.originalEvent=(n?i.extend({},n):y)||G.event||y,Q.trigger(o,[B].concat(t||[])),!o.isDefaultPrevented()},render:function(e){if(B.rendered)return B;var t=r.content.text,n=r.content.title,o=r.position;return i.attr(s[0],"aria-describedby",V),Q=F.tooltip=i("<div/>",{id:V,"class":[N,D,r.style.classes,N+"-pos-"+r.position.my.abbrev()].join(" "),width:r.style.width||"",height:r.style.height||"",tracking:"mouse"===o.target&&o.adjust.mouse,role:"alert","aria-live":"polite","aria-atomic":v,"aria-describedby":V+"-content","aria-hidden":_}).toggleClass(J,G.disabled).data("qtip",B).appendTo(r.position.container).append(F.content=i("<div />",{"class":N+"-content",id:V+"-content","aria-atomic":_})),B.rendered=-1,Y=1,n.text?(x(),i.isFunction(n.text)||A(n.text,v)):n.button&&b(),(!i.isFunction(t)||t.then)&&z(t,v),B.rendered=_,d(),i.each(r.events,function(e,t){i.isFunction(t)&&Q.bind("toggle"===e?"tooltipshow tooltiphide":"tooltip"+e,t)}),i.each(f,function(){"render"===this.initialize&&this(B)}),U(),Q.queue("fx",function(t){B._triggerEvent("render"),Y=0,(r.show.ready||e)&&B.toggle(_,G.event,v),t()}),B},get:function(e){var t,n;switch(e.toLowerCase()){case"dimensions":t={height:Q.outerHeight(v),width:Q.outerWidth(v)};break;case"offset":t=f.offset(Q,r.position.container);break;default:n=u(e.toLowerCase()),t=n[0][n[1]],t=t.precedance?t.string():t}return t},set:function(e,t){function n(e,t){var n,i,o;for(n in c)for(i in c[n])(o=RegExp(i,"i").exec(e))&&(t.push(o),c[n][i].apply(B,t))}var o,s=/^position\.(my|at|adjust|target|container)|style|content|show\.ready/i,l=v,c=B.checks;return"string"==typeof e?(o=e,e={},e[o]=t):e=i.extend(_,{},e),i.each(e,function(t,n){var o,a=u(t.toLowerCase());o=a[0][a[1]],a[0][a[1]]="object"==typeof n&&n.nodeType?i(n):n,e[t]=[a[0],a[1],n,o],l=s.test(t)||l}),a(r),Y=1,i.each(e,n),Y=0,B.rendered&&Q[0].offsetWidth>0&&l&&B.reposition("mouse"===r.position.target?y:G.event),B},toggle:function(e,n){function a(){e?(f.ie&&Q[0].style.removeAttribute("filter"),Q.css("overflow",""),"string"==typeof c.autofocus&&i(c.autofocus,Q).focus(),c.target.trigger("qtip-"+l+"-inactive")):Q.css({display:"",visibility:"",opacity:"",left:"",top:""}),B._triggerEvent(e?"visible":"hidden")}if(n){if(/over|enter/.test(n.type)&&/out|leave/.test(G.event.type)&&r.show.target.add(n.target).length===r.show.target.length&&Q.has(n.relatedTarget).length)return B;G.event=i.extend({},n)}if(!B.rendered)return e?B.render(1):B;var s=e?"show":"hide",c=r[s],u=(r[e?"hide":"show"],r.position),h=r.content,d=Q.css("width"),p=Q[0].offsetWidth>0,y=e||1===c.target.length,w=!n||2>c.target.length||G.target[0]===n.target;return(typeof e).search("boolean|number")&&(e=!p),!Q.is(":animated")&&p===e&&w?B:B._triggerEvent(s,[90])?(i.attr(Q[0],"aria-hidden",!e),e?(G.origin=i.extend({},m),B.focus(n),i.isFunction(h.text)&&z(h.text,v),i.isFunction(h.title.text)&&A(h.title.text,v),!g&&"mouse"===u.target&&u.adjust.mouse&&(i(t).bind("mousemove.qtip",o),g=_),d||Q.css("width",Q.outerWidth()),B.reposition(n,arguments[2]),d||Q.css("width",""),c.solo&&("string"==typeof c.solo?i(c.solo):i(O,c.solo)).not(Q).not(c.target).qtip("hide",i.Event("tooltipsolo"))):(clearTimeout(B.timers.show),delete G.origin,g&&!i(O+'[tracking="true"]:visible',c.solo).not(Q).length&&(i(t).unbind("mousemove.qtip"),g=v),B.blur(n)),c.effect===v||y===v?(Q[s](),a.call(Q)):i.isFunction(c.effect)?(Q.stop(1,1),c.effect.call(Q,B),Q.queue("fx",function(e){a(),e()})):Q.fadeTo(90,e?1:0,a),e&&c.target.trigger("qtip-"+l+"-inactive"),B):B},show:function(e){return B.toggle(_,e)},hide:function(e){return B.toggle(v,e)},focus:function(e){if(!B.rendered)return B;var t=i(O),n=parseInt(Q[0].style.zIndex,10),o=p.zindex+t.length,a=i.extend({},e);return Q.hasClass(H)||B._triggerEvent("focus",[o],a)&&(n!==o&&(t.each(function(){this.style.zIndex>n&&(this.style.zIndex=this.style.zIndex-1)}),t.filter("."+H).qtip("blur",a)),Q.addClass(H)[0].style.zIndex=o),B},blur:function(e){return Q.removeClass(H),B._triggerEvent("blur",[Q.css("zIndex")],e),B},reposition:function(n,o){if(!B.rendered||Y)return B;Y=1;var a,s,l=r.position.target,c=r.position,u=c.my,h=c.at,d=c.adjust,p=d.method.split(" "),g=Q.outerWidth(v),_=Q.outerHeight(v),y=0,w=0,b=Q.css("position"),x=c.viewport,k={left:0,top:0},A=c.container,I=Q[0].offsetWidth>0,$=n&&"scroll"===n.type,N=i(e);if(i.isArray(l)&&2===l.length)h={x:E,y:C},k={left:l[0],top:l[1]};else if("mouse"===l&&(n&&n.pageX||G.event.pageX))h={x:E,y:C},n=!m||!m.pageX||!d.mouse&&n&&n.pageX?(!n||"resize"!==n.type&&"scroll"!==n.type?n&&n.pageX&&"mousemove"===n.type?n:(!d.mouse||r.show.distance)&&G.origin&&G.origin.pageX?G.origin:n:G.event)||n||G.event||m||{}:{pageX:m.pageX,pageY:m.pageY},"static"!==b&&(k=A.offset()),k={left:n.pageX-k.left,top:n.pageY-k.top},d.mouse&&$&&(k.left-=m.scrollX-N.scrollLeft(),k.top-=m.scrollY-N.scrollTop());else{if("event"===l&&n&&n.target&&"scroll"!==n.type&&"resize"!==n.type?G.target=i(n.target):"event"!==l&&(G.target=i(l.jquery?l:F.target)),l=G.target,l=i(l).eq(0),0===l.length)return B;l[0]===t||l[0]===e?(y=f.iOS?e.innerWidth:l.width(),w=f.iOS?e.innerHeight:l.height(),l[0]===e&&(k={top:(x||l).scrollTop(),left:(x||l).scrollLeft()})):f.imagemap&&l.is("area")?a=f.imagemap(B,l,h,f.viewport?p:v):f.svg&&l[0].ownerSVGElement?a=f.svg(B,l,h,f.viewport?p:v):(l.parents("body").append(Q),g=Q.outerWidth(v),_=Q.outerHeight(v),y=l.outerWidth(v),w=l.outerHeight(v),k=f.offset(l,A)),a&&(y=a.width,w=a.height,s=a.offset,k=a.position),(f.iOS>3.1&&4.1>f.iOS||f.iOS>=4.3&&4.33>f.iOS||!f.iOS&&"fixed"===b)&&(k.left-=N.scrollLeft(),k.top-=N.scrollTop()),k.left+=h.x===S?y:h.x===P?y/2:0,k.top+=h.y===T?w:h.y===P?w/2:0}return k.left+=d.x+(u.x===S?-g:u.x===P?-g/2:0),k.top+=d.y+(u.y===T?-_:u.y===P?-_/2:0),f.viewport?(k.adjusted=f.viewport(B,k,c,y,w,g,_),s&&k.adjusted.left&&(k.left+=s.left),s&&k.adjusted.top&&(k.top+=s.top)):k.adjusted={left:0,top:0},B._triggerEvent("move",[k,x.elem||x],n)?(delete k.adjusted,o===v||!I||isNaN(k.left)||isNaN(k.top)||"mouse"===l||!i.isFunction(c.effect)?Q.css(k):i.isFunction(c.effect)&&(c.effect.call(Q,B,i.extend({},k)),Q.queue(function(e){i(this).css({opacity:"",height:""}),f.ie&&this.style.removeAttribute("filter"),e()})),Y=0,B):B},disable:function(e){return"boolean"!=typeof e&&(e=!(Q.hasClass(J)||G.disabled)),B.rendered?(Q.toggleClass(J,e),i.attr(Q[0],"aria-disabled",e)):G.disabled=!!e,B},enable:function(){return B.disable(v)},destroy:function(e){function t(){var e=s[0],t=i.attr(e,q),n=s.data("qtip");B.rendered&&(i.each(B.plugins,function(e){this.destroy&&this.destroy(),delete B.plugins[e]}),Q.stop(1,0).find("*").remove().end().remove()),clearTimeout(B.timers.show),clearTimeout(B.timers.hide),W(),n&&B!==n||(s.removeData("qtip").removeAttr(M),r.suppress&&t&&(s.attr("title",t),s.removeAttr(q)),s.removeAttr("aria-describedby")),s.unbind(".qtip-"+l),delete R[B.id],delete B.options,delete B.elements,delete B.cache,delete B.timers,delete B.checks}if(!B.destroyed)return B.destroyed=!(B.rendered=v),e===_?t():(Q.bind("tooltiphidden",t),B.hide()),s}})}function r(e,n,o){var r,l,c,u,h,d=i(t.body),m=e[0]===t?d:e,g=e.metadata?e.metadata(o.metadata):y,w="html5"===o.metadata.type&&g?g[o.metadata.name]:y,b=e.data(o.metadata.name||"qtipopts");try{b="string"==typeof b?i.parseJSON(b):b}catch(x){}if(u=i.extend(_,{},p.defaults,o,"object"==typeof b?a(b):y,a(w||g)),l=u.position,u.id=n,"boolean"==typeof u.content.text){if(c=e.attr(u.content.attr),u.content.attr===v||!c)return v;u.content.text=c}if(l.container.length||(l.container=d),l.target===v&&(l.target=m),u.show.target===v&&(u.show.target=m),u.show.solo===_&&(u.show.solo=l.container.closest("body")),u.hide.target===v&&(u.hide.target=m),u.position.viewport===_&&(u.position.viewport=l.container),l.container=l.container.eq(0),l.at=new f.Corner(l.at),l.my=new f.Corner(l.my),e.data("qtip"))if(u.overwrite)e.qtip("destroy");else if(u.overwrite===v)return v;return e.attr(M,!0),u.suppress&&(h=e.attr("title"))&&e.removeAttr("title").attr(q,h).attr("title",""),r=new s(e,u,n,!!c),e.data("qtip",r),e.one("remove.qtip-"+n+" removeqtip.qtip-"+n,function(){var e;(e=i(this).data("qtip"))&&e.destroy()}),r}function l(e){var t,o=this,a=e.elements.tooltip,s=e.options.content.ajax,r=p.defaults.content.ajax,l=_,c=v;e.checks.ajax={"^content.ajax":function(e,t,n){"ajax"===t&&(s=n),"once"===t?o.init():s&&s.url?o.load():a.unbind(W)}},i.extend(o,{init:function(){return s&&s.url&&a.unbind(W)[s.once?"one":"bind"]("tooltipshow"+W,o.load),o},load:function(a){function u(){var t;e.destroyed||(l=v,g&&(c=_,e.show(a.originalEvent)),(t=r.complete||s.complete)&&i.isFunction(t)&&t.apply(s.context||e,arguments))}function h(t,n,o){var a;e.destroyed||(p&&"string"==typeof t&&(t=i("<div/>").append(t.replace(F,"")).find(p)),(a=r.success||s.success)&&i.isFunction(a)?a.call(s.context||e,t,n,o):e.set("content.text",t))}function d(t,n,i){e.destroyed||0===t.status||e.set("content.text",n+": "+i)}if(c)return c=v,n;var p,f=s.url.lastIndexOf(" "),m=s.url,g=!s.loading&&l;if(g)try{a.preventDefault()}catch(y){}else if(a&&a.isDefaultPrevented())return o;t&&t.abort&&t.abort(),f>-1&&(p=m.substr(f),m=m.substr(0,f)),t=i.ajax(i.extend({error:r.error||d,context:e},s,{url:m,success:h,complete:u}))},destroy:function(){t&&t.abort&&t.abort(),e.destroyed=_}}),o.init()}function c(e,t,n){var i=Math.ceil(t/2),o=Math.ceil(n/2),a={bottomright:[[0,0],[t,n],[t,0]],bottomleft:[[0,0],[t,0],[0,n]],topright:[[0,n],[t,0],[t,n]],topleft:[[0,0],[0,n],[t,n]],topcenter:[[0,n],[i,0],[t,n]],bottomcenter:[[0,0],[t,0],[i,n]],rightcenter:[[0,0],[t,o],[0,n]],leftcenter:[[t,0],[t,n],[0,o]]};return a.lefttop=a.bottomright,a.righttop=a.bottomleft,a.leftbottom=a.topright,a.rightbottom=a.topleft,a[e.string()]}function u(e){function t(e){var t=$.is(":visible");$.show(),e(),$.toggle(t)}function o(){M.width=g.height,M.height=g.width}function a(){M.width=g.width,M.height=g.height}function s(t,i,o){if(A.tip){var a,s,r=m.corner.clone(),c=o.adjusted,u=e.options.position.adjust.method.split(" "),h=u[0],d=u[1]||u[0],p={left:v,top:v,x:0,y:0},f={};m.corner.fixed!==_&&(h===I&&r.precedance===w&&c.left&&r.y!==P?r.precedance=r.precedance===w?b:w:h!==I&&c.left&&(r.x=r.x===P?c.left>0?E:S:r.x===E?S:E),d===I&&r.precedance===b&&c.top&&r.x!==P?r.precedance=r.precedance===b?w:b:d!==I&&c.top&&(r.y=r.y===P?c.top>0?C:T:r.y===C?T:C),r.string()===N.corner.string()||N.top===c.top&&N.left===c.left||m.update(r,v)),a=m.position(r,c),a[r.x]+=l(r,r.x),a[r.y]+=l(r,r.y),a.right!==n&&(a.left=-a.right),a.bottom!==n&&(a.top=-a.bottom),a.user=Math.max(0,g.offset),(p.left=h===I&&!!c.left)&&(r.x===P?f["margin-left"]=p.x=a["margin-left"]-c.left:(s=a.right!==n?[c.left,-a.left]:[-c.left,a.left],(p.x=Math.max(s[0],s[1]))>s[0]&&(o.left-=c.left,p.left=v),f[a.right!==n?S:E]=p.x)),(p.top=d===I&&!!c.top)&&(r.y===P?f["margin-top"]=p.y=a["margin-top"]-c.top:(s=a.bottom!==n?[c.top,-a.top]:[-c.top,a.top],(p.y=Math.max(s[0],s[1]))>s[0]&&(o.top-=c.top,p.top=v),f[a.bottom!==n?T:C]=p.y)),A.tip.css(f).toggle(!(p.x&&p.y||r.x===P&&p.y||r.y===P&&p.x)),o.left-=a.left.charAt?a.user:h!==I||p.top||!p.left&&!p.top?a.left:0,o.top-=a.top.charAt?a.user:d!==I||p.left||!p.left&&!p.top?a.top:0,N.left=c.left,N.top=c.top,N.corner=r.clone()}}function r(){var t=g.corner,n=e.options.position,i=n.at,o=n.my.string?n.my.string():n.my;return t===v||o===v&&i===v?v:(t===_?m.corner=new f.Corner(o):t.string||(m.corner=new f.Corner(t),m.corner.fixed=_),N.corner=new f.Corner(m.corner.string()),"centercenter"!==m.corner.string())}function l(e,n,i){n=n?n:e[e.precedance];var o,a=A.titlebar&&e.y===C,s=a?A.titlebar:$,r="border-"+n+"-width",l=function(e){return parseInt(e.css(r),10)};return t(function(){o=(i?l(i):l(A.content)||l(s)||l($))||0}),o}function u(e){var n,i=A.titlebar&&e.y===C,o=i?A.titlebar:A.content,a="-moz-",s="-webkit-",r="border-radius-"+e.y+e.x,l="border-"+e.y+"-"+e.x+"-radius",c=function(e){return parseInt(o.css(e),10)||parseInt($.css(e),10)};return t(function(){n=c(l)||c(r)||c(a+l)||c(a+r)||c(s+l)||c(s+r)||0}),n}function h(e){function n(e,t,n){var i=e.css(t)||c;return n&&i===e.css(n)?v:s.test(i)?v:i
}var o=A.tip.css("cssText",""),a=e||m.corner,s=/rgba?\(0, 0, 0(, 0)?\)|transparent|#123456/i,r="border-"+a[a.precedance]+"-color",l="background-color",c="transparent",u=" !important",h=A.titlebar,d=h&&(a.y===C||a.y===P&&o.position().top+M.height/2+g.offset<h.outerHeight(_)),p=d?h:A.content;t(function(){R.fill=n(o,l)||n(p,l)||n(A.content,l)||n($,l)||o.css(l),R.border=n(o,r,"color")||n(p,r,"color")||n(A.content,r,"color")||n($,r,"color")||$.css(r),i("*",o).add(o).css("cssText",l+":"+c+u+";border:0"+u+";")})}function d(e){var t,n,i,o=e.precedance===b,a=M[o?x:k],s=M[o?k:x],r=e.string().indexOf(P)>-1,l=a*(r?.5:1),c=Math.pow,u=Math.round,h=Math.sqrt(c(l,2)+c(s,2)),d=[j/l*h,j/s*h];return d[2]=Math.sqrt(c(d[0],2)-c(j,2)),d[3]=Math.sqrt(c(d[1],2)-c(j,2)),t=h+d[2]+d[3]+(r?0:d[0]),n=t/h,i=[u(n*s),u(n*a)],{height:i[o?0:1],width:i[o?1:0]}}function p(e,t,n){return"<qvml:"+e+' xmlns="urn:schemas-microsoft.com:vml" class="qtip-vml" '+(t||"")+' style="behavior: url(#default#VML); '+(n||"")+'" />'}var m=this,g=e.options.style.tip,A=e.elements,$=A.tooltip,N={top:0,left:0},M={width:g.width,height:g.height},R={},j=g.border||0;m.corner=y,m.mimic=y,m.border=j,m.offset=g.offset,m.size=M,e.checks.tip={"^position.my|style.tip.(corner|mimic|border)$":function(){m.init()||m.destroy(),e.reposition()},"^style.tip.(height|width)$":function(){M={width:g.width,height:g.height},m.create(),m.update(),e.reposition()},"^content.title.text|style.(classes|widget)$":function(){A.tip&&A.tip.length&&m.update()}},i.extend(m,{init:function(){var e=r()&&(V||f.ie);return e&&(m.create(),m.update(),$.unbind(B).bind("tooltipmove"+B,s)),e},create:function(){var e,t=M.width,n=M.height;A.tip&&A.tip.remove(),A.tip=i("<div />",{"class":"qtip-tip"}).css({width:t,height:n}).prependTo($),V?i("<canvas />").appendTo(A.tip)[0].getContext("2d").save():(e=p("shape",'coordorigin="0,0"',"position:absolute;"),A.tip.html(e+e),i("*",A.tip).bind("click"+B+" mousedown"+B,function(e){e.stopPropagation()}))},update:function(e,t){var n,s,r,u,x,k=A.tip,I=k.children(),O=M.width,D=M.height,H=g.mimic,L=Math.round;e||(e=N.corner||m.corner),H===v?H=e:(H=new f.Corner(H),H.precedance=e.precedance,"inherit"===H.x?H.x=e.x:"inherit"===H.y?H.y=e.y:H.x===H.y&&(H[e.precedance]=e[e.precedance])),n=H.precedance,e.precedance===w?o():a(),A.tip.css({width:O=M.width,height:D=M.height}),h(e),"transparent"!==R.border?(j=l(e,y),0===g.border&&j>0&&(R.fill=R.border),m.border=j=g.border!==_?g.border:j):m.border=j=0,r=c(H,O,D),m.size=x=d(e),k.css(x).css("line-height",x.height+"px"),u=e.precedance===b?[L(H.x===E?j:H.x===S?x.width-O-j:(x.width-O)/2),L(H.y===C?x.height-D:0)]:[L(H.x===E?x.width-O:0),L(H.y===C?j:H.y===T?x.height-D-j:(x.height-D)/2)],V?(I.attr(x),s=I[0].getContext("2d"),s.restore(),s.save(),s.clearRect(0,0,3e3,3e3),s.fillStyle=R.fill,s.strokeStyle=R.border,s.lineWidth=2*j,s.lineJoin="miter",s.miterLimit=100,s.translate(u[0],u[1]),s.beginPath(),s.moveTo(r[0][0],r[0][1]),s.lineTo(r[1][0],r[1][1]),s.lineTo(r[2][0],r[2][1]),s.closePath(),j&&("border-box"===$.css("background-clip")&&(s.strokeStyle=R.fill,s.stroke()),s.strokeStyle=R.border,s.stroke()),s.fill()):(r="m"+r[0][0]+","+r[0][1]+" l"+r[1][0]+","+r[1][1]+" "+r[2][0]+","+r[2][1]+" xe",u[2]=j&&/^(r|b)/i.test(e.string())?8===f.ie?2:1:0,I.css({coordsize:O+j+" "+(D+j),antialias:""+(H.string().indexOf(P)>-1),left:u[0],top:u[1],width:O+j,height:D+j}).each(function(e){var t=i(this);t[t.prop?"prop":"attr"]({coordsize:O+j+" "+(D+j),path:r,fillcolor:R.fill,filled:!!e,stroked:!e}).toggle(!(!j&&!e)),e||""!==t.html()||t.html(p("stroke",'weight="'+2*j+'px" color="'+R.border+'" miterlimit="1000" joinstyle="miter"'))})),setTimeout(function(){A.tip.css({display:"inline-block",visibility:"visible"})},1),t!==v&&m.position(e)},position:function(e){var t,n,o,a=A.tip,s={},r=Math.max(0,g.offset);return g.corner!==v&&a?(e=e||m.corner,t=e.precedance,n=d(e),o=[e.x,e.y],t===w&&o.reverse(),i.each(o,function(i,o){var a,c,h;o===P?(a=t===b?E:C,s[a]="50%",s["margin-"+a]=-Math.round(n[t===b?x:k]/2)+r):(a=l(e,o),c=l(e,o,A.content),h=u(e),s[o]=i?c:r+(h>a?h:-a))}),s[e[t]]-=n[t===w?x:k],a.css({top:"",bottom:"",left:"",right:"",margin:""}).css(s),s):v},destroy:function(){$.unbind(B),A.tip&&A.tip.find("*").remove().end().remove(),delete m.corner,delete m.mimic,delete m.size}}),m.init()}function h(e){var n,o=this,a=e.options.show.modal,s=e.elements,r=s.tooltip,l=J+e.id;e.checks.modal={"^show.modal.(on|blur)$":function(){o.destroy(),o.init(),n.toggle(r.is(":visible"))}},i.extend(o,{init:function(){return a.on?(n=s.overlay=K.elem,r.attr(Q,_).css("z-index",f.modal.zindex+i(X).length).bind("tooltipshow"+l+" tooltiphide"+l,function(e,t,a){var s=e.originalEvent;if(e.target===r[0])if(s&&"tooltiphide"===e.type&&/mouse(leave|enter)/.test(s.type)&&i(s.relatedTarget).closest(n[0]).length)try{e.preventDefault()}catch(l){}else(!s||s&&!s.solo)&&o.toggle(e,"tooltipshow"===e.type,a)}).bind("tooltipfocus"+l,function(e,t){if(!e.isDefaultPrevented()&&e.target===r[0]){var o=i(X),a=f.modal.zindex+o.length,s=parseInt(r[0].style.zIndex,10);n[0].style.zIndex=a-1,o.each(function(){this.style.zIndex>s&&(this.style.zIndex-=1)}),o.filter("."+H).qtip("blur",e.originalEvent),r.addClass(H)[0].style.zIndex=a,K.update(t);try{e.preventDefault()}catch(l){}}}).bind("tooltiphide"+l,function(e){e.target===r[0]&&i(X).filter(":visible").not(r).last().qtip("focus",e)}),o):o},toggle:function(t,n,i){return t&&t.isDefaultPrevented()?o:(K.toggle(e,!!n,i),o)},destroy:function(){i([t,r]).removeAttr(Q).unbind(l),K.toggle(e,v),delete s.overlay}}),o.init()}function d(n){var o,a=this,s=n.elements,r=n.options,l=s.tooltip,c=".ie6-"+n.id,u=1>i("select, object").length,h=0,d=v;n.checks.ie6={"^content|style$":function(){redraw()}},i.extend(a,{init:function(){var n,r=i(e);u&&(s.bgiframe=i('<iframe class="qtip-bgiframe" frameborder="0" tabindex="-1" src="javascript:\'\';" style="display:block; position:absolute; z-index:-1; filter:alpha(opacity=0); -ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=0)";"></iframe>'),s.bgiframe.appendTo(l),l.bind("tooltipmove"+c,a.adjustBGIFrame)),o=i("<div/>",{id:"qtip-rcontainer"}).appendTo(t.body),a.redraw(),s.overlay&&!d&&(n=function(){s.overlay[0].style.top=r.scrollTop()+"px"},r.bind("scroll.qtip-ie6, resize.qtip-ie6",n),n(),s.overlay.addClass("qtipmodal-ie6fix"),d=_)},adjustBGIFrame:function(){var e,t,i=n.get("dimensions"),o=n.plugins.tip,a=s.tip;t=parseInt(l.css("border-left-width"),10)||0,t={left:-t,top:-t},o&&a&&(e="x"===o.corner.precedance?["width","left"]:["height","top"],t[e[1]]-=a[e[0]]()),s.bgiframe.css(t).css(i)},redraw:function(){if(1>n.rendered||h)return a;var e,t,i,s,c=r.style,u=r.position.container;return h=1,c.height&&l.css(k,c.height),c.width?l.css(x,c.width):(l.css(x,"").appendTo(o),t=l.width(),1>t%2&&(t+=1),i=l.css("max-width")||"",s=l.css("min-width")||"",e=(i+s).indexOf("%")>-1?u.width()/100:0,i=(i.indexOf("%")>-1?e:1)*parseInt(i,10)||t,s=(s.indexOf("%")>-1?e:1)*parseInt(s,10)||0,t=i+s?Math.min(Math.max(t,s),i):t,l.css(x,Math.round(t)).appendTo(u)),h=0,a},destroy:function(){u&&s.bgiframe.remove(),l.unbind(c)}}),a.init()}var p,f,m,g,_=!0,v=!1,y=null,w="x",b="y",x="width",k="height",C="top",E="left",T="bottom",S="right",P="center",A="flipinvert",I="shift",$="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///ywAAAAAAQABAAACAUwAOw==",N="qtip",M="data-hasqtip",R={},j=["ui-widget","ui-tooltip"],O="div.qtip."+N,D=N+"-default",H=N+"-focus",L=N+"-hover",z="_replacedByqTip",q="oldtitle";p=i.fn.qtip=function(e,t,o){var s=(""+e).toLowerCase(),r=y,l=i.makeArray(arguments).slice(1),c=l[l.length-1],u=this[0]?i.data(this[0],"qtip"):y;return!arguments.length&&u||"api"===s?u:"string"==typeof e?(this.each(function(){var e=i.data(this,"qtip");if(!e)return _;if(c&&c.timeStamp&&(e.cache.event=c),"option"!==s&&"options"!==s||!t)e[s]&&e[s].apply(e[s],l);else{if(!i.isPlainObject(t)&&o===n)return r=e.get(t),v;e.set(t,o)}}),r!==y?r:this):"object"!=typeof e&&arguments.length?n:(u=a(i.extend(_,{},e)),p.bind.call(this,u,c))},p.bind=function(e,t){return this.each(function(a){function s(e){function t(){d.render("object"==typeof e||l.show.ready),c.show.add(c.hide).unbind(h)}return d.cache.disabled?v:(d.cache.event=i.extend({},e),d.cache.target=e?i(e.target):[n],l.show.delay>0?(clearTimeout(d.timers.show),d.timers.show=setTimeout(t,l.show.delay),u.show!==u.hide&&c.hide.bind(u.hide,function(){clearTimeout(d.timers.show)})):t(),n)}var l,c,u,h,d,m;return m=i.isArray(e.id)?e.id[a]:e.id,m=!m||m===v||1>m.length||R[m]?p.nextid++:R[m]=m,h=".qtip-"+m+"-create",d=r(i(this),m,e),d===v?_:(l=d.options,i.each(f,function(){"initialize"===this.initialize&&this(d)}),c={show:l.show.target,hide:l.hide.target},u={show:i.trim(""+l.show.event).replace(/ /g,h+" ")+h,hide:i.trim(""+l.hide.event).replace(/ /g,h+" ")+h},/mouse(over|enter)/i.test(u.show)&&!/mouse(out|leave)/i.test(u.hide)&&(u.hide+=" mouseleave"+h),c.show.bind("mousemove"+h,function(e){o(e),d.cache.onTarget=_}),c.show.bind(u.show,s),(l.show.ready||l.prerender)&&s(t),n)})},f=p.plugins={Corner:function(e){e=(""+e).replace(/([A-Z])/," $1").replace(/middle/gi,P).toLowerCase(),this.x=(e.match(/left|right/i)||e.match(/center/)||["inherit"])[0].toLowerCase(),this.y=(e.match(/top|bottom|center/i)||["inherit"])[0].toLowerCase();var t=e.charAt(0);this.precedance="t"===t||"b"===t?b:w,this.string=function(){return this.precedance===b?this.y+this.x:this.x+this.y},this.abbrev=function(){var e=this.x.substr(0,1),t=this.y.substr(0,1);return e===t?e:this.precedance===b?t+e:e+t},this.invertx=function(e){this.x=this.x===E?S:this.x===S?E:e||this.x},this.inverty=function(e){this.y=this.y===C?T:this.y===T?C:e||this.y},this.clone=function(){return{x:this.x,y:this.y,precedance:this.precedance,string:this.string,abbrev:this.abbrev,clone:this.clone,invertx:this.invertx,inverty:this.inverty}}},offset:function(e,n){function o(e,t){l.left+=t*e.scrollLeft(),l.top+=t*e.scrollTop()}var a,s,r,l=e.offset(),c=e.closest("body"),u=f.ie&&"CSS1Compat"!==t.compatMode,h=n;if(h){do"static"!==h.css("position")&&(s=h.position(),l.left-=s.left+(parseInt(h.css("borderLeftWidth"),10)||0)+(parseInt(h.css("marginLeft"),10)||0),l.top-=s.top+(parseInt(h.css("borderTopWidth"),10)||0)+(parseInt(h.css("marginTop"),10)||0),a||"hidden"===(r=h.css("overflow"))||"visible"===r||(a=h));while((h=i(h[0].offsetParent)).length);(a&&a[0]!==c[0]||u)&&o(a||c,1)}return l},ie:function(){for(var e=3,n=t.createElement("div");(n.innerHTML="<!--[if gt IE "+ ++e+"]><i></i><![endif]-->")&&n.getElementsByTagName("i")[0];);return e>4?e:v}(),iOS:parseFloat((""+(/CPU.*OS ([0-9_]{1,5})|(CPU like).*AppleWebKit.*Mobile/i.exec(navigator.userAgent)||[0,""])[1]).replace("undefined","3_2").replace("_",".").replace("_",""))||v,fn:{attr:function(e,t){if(this.length){var n=this[0],o="title",a=i.data(n,"qtip");if(e===o&&a&&"object"==typeof a&&a.options.suppress)return 2>arguments.length?i.attr(n,q):(a&&a.options.content.attr===o&&a.cache.attr&&a.set("content.text",t),this.attr(q,t))}return i.fn["attr"+z].apply(this,arguments)},clone:function(e){var t=(i([]),i.fn["clone"+z].apply(this,arguments));return e||t.filter("["+q+"]").attr("title",function(){return i.attr(this,q)}).removeAttr(q),t}}},i.each(f.fn,function(e,t){if(!t||i.fn[e+z])return _;var n=i.fn[e+z]=i.fn[e];i.fn[e]=function(){return t.apply(this,arguments)||n.apply(this,arguments)}}),i.ui||(i["cleanData"+z]=i.cleanData,i.cleanData=function(e){for(var t,o=0;(t=e[o])!==n&&t.getAttribute(M);o++)try{i(t).triggerHandler("removeqtip")}catch(a){}i["cleanData"+z](e)}),p.version="2.0.1-26-",p.nextid=0,p.inactiveEvents="click dblclick mousedown mouseup mousemove mouseleave mouseenter".split(" "),p.zindex=15e3,p.defaults={prerender:v,id:v,overwrite:_,suppress:_,content:{text:_,attr:"title",deferred:v,title:{text:v,button:v}},position:{my:"top left",at:"bottom right",target:v,container:v,viewport:v,adjust:{x:0,y:0,mouse:_,scroll:_,resize:_,method:"flipinvert flipinvert"},effect:function(e,t){i(this).animate(t,{duration:200,queue:v})}},show:{target:v,event:"mouseenter",effect:_,delay:90,solo:v,ready:v,autofocus:v},hide:{target:v,event:"mouseleave",effect:_,delay:0,fixed:v,inactive:v,leave:"window",distance:v},style:{classes:"",widget:v,width:v,height:v,def:_},events:{render:y,move:y,show:y,hide:y,toggle:y,visible:y,hidden:y,focus:y,blur:y}},f.svg=function(e,n){for(var o,a,s,r,l,c=i(t),u=n[0],h={width:0,height:0,position:{top:1e10,left:1e10}};!u.getBBox;)u=u.parentNode;if(u.getBBox&&u.parentNode){if(o=u.getBBox(),a=u.getScreenCTM(),s=u.farthestViewportElement||u,!s.createSVGPoint)return h;r=s.createSVGPoint(),r.x=o.x,r.y=o.y,l=r.matrixTransform(a),h.position.left=l.x,h.position.top=l.y,r.x+=o.width,r.y+=o.height,l=r.matrixTransform(a),h.width=l.x-h.position.left,h.height=l.y-h.position.top,h.position.left+=c.scrollLeft(),h.position.top+=c.scrollTop()}return h};var U,W=".qtip-ajax",F=/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi;U=f.ajax=function(e){var t=e.plugins.ajax;return"object"==typeof t?t:e.plugins.ajax=new l(e)},U.initialize="render",U.sanitize=function(e){var t,n=e.content;n&&"ajax"in n&&(t=n.ajax,"object"!=typeof t&&(t=e.content.ajax={url:t}),"boolean"!=typeof t.once&&t.once&&(t.once=!!t.once))},i.extend(_,p.defaults,{content:{ajax:{loading:_,once:_}}});var G,B=".qtip-tip",V=!!t.createElement("canvas").getContext;G=f.tip=function(e){var t=e.plugins.tip;return"object"==typeof t?t:e.plugins.tip=new u(e)},G.initialize="render",G.sanitize=function(e){var t,n=e.style;n&&"tip"in n&&(t=e.style.tip,"object"!=typeof t&&(e.style.tip={corner:t}),/string|boolean/i.test(typeof t.corner)||(t.corner=_),"number"!=typeof t.width&&delete t.width,"number"!=typeof t.height&&delete t.height,"number"!=typeof t.border&&t.border!==_&&delete t.border,"number"!=typeof t.offset&&delete t.offset)},i.extend(_,p.defaults,{style:{tip:{corner:_,mimic:v,width:6,height:6,border:_,offset:0}}});var Y,K,Q="is-modal-qtip",X=O+"["+Q+"]",J=".qtipmodal";K=function(){function n(e){if(i.expr[":"].focusable)return i.expr[":"].focusable;var t,n,o,a=!isNaN(i.attr(e,"tabindex")),s=e.nodeName.toLowerCase();return"area"===s?(t=e.parentNode,n=t.name,e.href&&n&&"map"===t.nodeName.toLowerCase()?(o=i("img[usemap=#"+n+"]")[0],!!o&&o.is(":visible")):!1):/input|select|textarea|button|object/.test(s)?!e.disabled:"a"===s?e.href||a:a}function o(e){1>h.length&&e.length?e.not("body").blur():h.first().focus()}function a(e){if(c.is(":visible")){var t,n=i(e.target),a=s.elements.tooltip,l=n.closest(O);t=1>l.length?v:parseInt(l[0].style.zIndex,10)>parseInt(a[0].style.zIndex,10),t||n.closest(O)[0]===a[0]||o(n),r=e.target===h[h.length-1]}}var s,r,l,c,u=this,h={};i.extend(u,{init:function(){function n(){var e=i(this);c.css({height:e.height(),width:e.width()})}return c=u.elem=i("<div />",{id:"qtip-overlay",html:"<div></div>",mousedown:function(){return v}}).hide(),i(e).bind("resize"+J,n),n(),i(t.body).bind("focusin"+J,a),i(t).bind("keydown"+J,function(e){s&&s.options.show.modal.escape&&27===e.keyCode&&s.hide(e)}),c.bind("click"+J,function(e){s&&s.options.show.modal.blur&&s.hide(e)}),u},update:function(e){s=e,h=e.options.show.modal.stealfocus!==v?e.elements.tooltip.find("*").filter(function(){return n(this)}):[]},toggle:function(e,n,a){var r=(i(t.body),e.elements.tooltip),h=e.options.show.modal,d=h.effect,p=n?"show":"hide",f=c.is(":visible"),m=i(X).filter(":visible:not(:animated)").not(r);return u.update(e),n&&h.stealfocus!==v&&o(i(":focus")),c.toggleClass("blurs",h.blur),n&&c.css({left:0,top:0}).appendTo(t.body),c.is(":animated")&&f===n&&l!==v||!n&&m.length?u:(c.stop(_,v),i.isFunction(d)?d.call(c,n):d===v?c[p]():c.fadeTo(parseInt(a,10)||90,n?1:0,function(){n||c.hide()}),n||c.queue(function(e){c.css({left:"",top:""}),m.length||c.detach(),e()}),l=n,s.destroyed&&(s=y),u)}}),u.init()},K=new K,Y=f.modal=function(e){var t=e.plugins.modal;return"object"==typeof t?t:e.plugins.modal=new h(e)},Y.sanitize=function(e){e.show&&("object"!=typeof e.show.modal?e.show.modal={on:!!e.show.modal}:e.show.modal.on===n&&(e.show.modal.on=_))},Y.zindex=p.zindex-200,Y.initialize="render",i.extend(_,p.defaults,{show:{modal:{on:v,effect:_,blur:_,stealfocus:_,escape:_}}}),f.viewport=function(n,i,o,a,s,r,l){function c(e,t,n,o,a,s,r,l,c){var u=i[a],d=m[e],p=g[e],f=n===I,_=-R.offset[a]+M.offset[a]+M["scroll"+a],v=d===a?c:d===s?-c:-c/2,y=p===a?l:p===s?-l:-l/2,w=O&&O.size?O.size[r]||0:0,b=O&&O.corner&&O.corner.precedance===e&&!f?w:0,x=_-u+b,k=u+c-M[r]-_+b,C=v-(m.precedance===e||d===m[t]?y:0)-(p===P?l/2:0);return f?(b=O&&O.corner&&O.corner.precedance===t?w:0,C=(d===a?1:-1)*v-b,i[a]+=x>0?x:k>0?-k:0,i[a]=Math.max(-R.offset[a]+M.offset[a]+(b&&O.corner[e]===P?O.offset:0),u-C,Math.min(Math.max(-R.offset[a]+M.offset[a]+M[r],u+C),i[a]))):(o*=n===A?2:0,x>0&&(d!==a||k>0)?(i[a]-=C+o,h["invert"+e](a)):k>0&&(d!==s||x>0)&&(i[a]-=(d===P?-C:C)+o,h["invert"+e](s)),_>i[a]&&-i[a]>k&&(i[a]=u,h=m.clone())),i[a]-u}var u,h,d,p=o.target,f=n.elements.tooltip,m=o.my,g=o.at,_=o.adjust,v=_.method.split(" "),y=v[0],$=v[1]||v[0],M=o.viewport,R=o.container,j=n.cache,O=n.plugins.tip,D={left:0,top:0};return M.jquery&&p[0]!==e&&p[0]!==t.body&&"none"!==_.method?(u="fixed"===f.css("position"),M={elem:M,height:M[(M[0]===e?"h":"outerH")+"eight"](),width:M[(M[0]===e?"w":"outerW")+"idth"](),scrollleft:u?0:M.scrollLeft(),scrolltop:u?0:M.scrollTop(),offset:M.offset()||{left:0,top:0}},R={elem:R,scrollLeft:R.scrollLeft(),scrollTop:R.scrollTop(),offset:R.offset()||{left:0,top:0}},("shift"!==y||"shift"!==$)&&(h=m.clone()),D={left:"none"!==y?c(w,b,y,_.x,E,S,x,a,r):0,top:"none"!==$?c(b,w,$,_.y,C,T,k,s,l):0},h&&j.lastClass!==(d=N+"-pos-"+h.abbrev())&&f.removeClass(n.cache.lastClass).addClass(n.cache.lastClass=d),D):D},f.imagemap=function(e,t,n,o){function a(e,t,n){for(var i=0,o=1,a=1,s=0,r=0,l=e.width,c=e.height;l>0&&c>0&&o>0&&a>0;)for(l=Math.floor(l/2),c=Math.floor(c/2),n.x===E?o=l:n.x===S?o=e.width-l:o+=Math.floor(l/2),n.y===C?a=c:n.y===T?a=e.height-c:a+=Math.floor(c/2),i=t.length;i--&&!(2>t.length);)s=t[i][0]-e.position.left,r=t[i][1]-e.position.top,(n.x===E&&s>=o||n.x===S&&o>=s||n.x===P&&(o>s||s>e.width-o)||n.y===C&&r>=a||n.y===T&&a>=r||n.y===P&&(a>r||r>e.height-a))&&t.splice(i,1);return{left:t[0][0],top:t[0][1]}}t.jquery||(t=i(t));var s=e.cache.areas={},r=(t[0].shape||t.attr("shape")).toLowerCase(),l=t[0].coords||t.attr("coords"),c=l.split(","),u=[],h=i('img[usemap="#'+t.parent("map").attr("name")+'"]'),d=h.offset(),p={width:0,height:0,position:{top:1e10,right:0,bottom:0,left:1e10}},f=0,m=0;if(d.left+=Math.ceil((h.outerWidth()-h.width())/2),d.top+=Math.ceil((h.outerHeight()-h.height())/2),"poly"===r)for(f=c.length;f--;)m=[parseInt(c[--f],10),parseInt(c[f+1],10)],m[0]>p.position.right&&(p.position.right=m[0]),m[0]<p.position.left&&(p.position.left=m[0]),m[1]>p.position.bottom&&(p.position.bottom=m[1]),m[1]<p.position.top&&(p.position.top=m[1]),u.push(m);else for(f=-1;f++<c.length;)u.push(parseInt(c[f],10));switch(r){case"rect":p={width:Math.abs(u[2]-u[0]),height:Math.abs(u[3]-u[1]),position:{left:Math.min(u[0],u[2]),top:Math.min(u[1],u[3])}};break;case"circle":p={width:u[2]+2,height:u[2]+2,position:{left:u[0],top:u[1]}};break;case"poly":p.width=Math.abs(p.position.right-p.position.left),p.height=Math.abs(p.position.bottom-p.position.top),"c"===n.abbrev()?p.position={left:p.position.left+p.width/2,top:p.position.top+p.height/2}:(s[n+l]||(p.position=a(p,u.slice(),n),!o||"flip"!==o[0]&&"flip"!==o[1]||(p.offset=a(p,u.slice(),{x:n.x===E?S:n.x===S?E:P,y:n.y===C?T:n.y===T?C:P}),p.offset.left-=p.position.left,p.offset.top-=p.position.top),s[n+l]=p),p=s[n+l]),p.width=p.height=0}return p.position.left+=d.left,p.position.top+=d.top,p};var Z;Z=f.ie6=function(e){var t=e.plugins.ie6;return 6!==f.ie?v:"object"==typeof t?t:e.plugins.ie6=new d(e)},Z.initialize="render"})}(window,document),define("modules/chat/views/emoticon_panel",["handlebars","modules/chat/util/emoticon_cache","modules/chat/models/session","backbone","underscore","jquery","qtip"],function(e,t,n,i,o){var a=e.compile('<div class="emoticon"><a href="#" id="{{hk}}" data-hk="{{hk}}" hidefocus="on"><img src="{{url}}" border=0 height=16 width=16></a></div>'),s=function(){this.is_panel_rendered=!1,this.$el=$("<div class='emoticon-container'></div>")},r=s.prototype;return o.extend(r,i.Events),o.extend(r,{render:function(){return this.$el.append("<div>loading...</div>"),this.render_emoticon_content(),this.is_panel_rendered=!0,this.$el},getContent:function(){var e=this;return $("a",this.$el).off("click"),$("a",this.$el).on("click",function(t){t.preventDefault();var n=$(this).data("hk");console.log(n),e.trigger("select",n)}),this.$el},render_emoticon_content:function(){var e=this;t.get_emoticons(n.emoticon_hotkeys.join(" "),function(t){e.$el.empty(),o.each(t,function(t){var n=$(a(t));e.$el.append(n)})})}}),s}),function(e){e.fn.easyPaginate=function(t){function n(){clearTimeout(c),o=(m-1)*h,a=o+h,e(d).each(function(n){var i=e(this);i.hide(),n>=o&&a>n&&setTimeout(function(){i.fadeIn("fast")},(n-Math.floor(n/h)*h)*t.delay),t.nextprev&&(a>=p?r.fadeOut("fast"):r.fadeIn("fast"),o>=1?l.fadeIn("fast"):l.fadeOut("fast"))}),e("li","#"+t.controls).removeClass(t.current),e('li[data-index="'+m+'"]',"#"+t.controls).addClass(t.current),t.auto&&(t.clickstop&&g||(c=setTimeout(i,t.pause)))}function i(){t.loop&&a>=p&&(m=0,n()),p>a&&(m++,n())}var o,a,s,r,l,c,u={step:4,delay:100,numeric:!0,nextprev:!0,auto:!1,loop:!1,pause:4e3,clickstop:!0,controls:"pagination",current:"current",randomstart:!1},t=e.extend(u,t),h=t.step,d=e(this).children(),p=d.length,f=Math.floor(p/h),m=t.randomstart?Math.floor(Math.random()*f)+1:1,g=!1;this.each(function(){if(s=this,p>h){p/h>f&&f++;var i=e('<ol id="'+t.controls+'"></ol>').insertAfter(s);if(t.nextprev&&(l=e('<li class="prev">Previous</li>').hide().appendTo(i).click(function(){g=!0,m--,n()})),t.numeric)for(var o=1;f>=o;o++)e('<li data-index="'+o+'">'+o+"</li>").appendTo(i).click(function(){g=!0,m=e(this).attr("data-index"),n()});t.nextprev&&(r=e('<li class="next">Next</li>').hide().appendTo(i).click(function(){g=!0,m++,n()})),n()}})}}(jQuery),define("easypaginate",["jquery"],function(){}),define("modules/chat/views/sticker_panel",["handlebars","modules/chat/util/emoticon_cache","modules/chat/models/session","modules/common/utility","underscore","backbone","jquery","easypaginate","qtip"],function(e,t,n,i,o,a){var s=e.compile('<div class="emoticon sticker"><a href="#" data-alias="{{alias}}" id="{{hk}}" hidefocus="on"><img src="{{url}}" border=0></a></div>'),r=function(){this.$el=$("<div class='emoticon-container'>"+i.translate("common|loading")+"..."+"</div>"),this.render_one=!1,this.sticker_dom_by_hk={}},l=r.prototype;return o.extend(l,a.Events),o.extend(l,{render:function(){return this.$el},getContent:function(){var e=this;return $("a",this.$el).off("click"),$("a",this.$el).on("click",function(t){t.preventDefault();var n=$(this).data("alias");console.log(n),e.trigger("select",n)}),this.$el},renderSticker:function(e){if(this.render_one||(this.$el.empty(),this.render_one=!0),!this.sticker_dom_by_hk[e.hotkey]){var t=$(s({hk:e.hotkey,url:e.url,alias:e.alias}));this.sticker_dom_by_hk[e.hotkey]=t,t.appendTo(this.$el)}}}),r}),define("modules/chat/views/emote_menu",["modules/chat/views/emoticon_panel","modules/chat/views/sticker_panel","modules/chat/models/session","modules/common/utility","backbone","underscore","handlebars","jquery","qtip"],function(e,t,n,i,o,a,s){var r=document.location.protocol+"//"+document.location.host;r+="/sites/ajax/store/show_with_category?ty=3&catid=3&e=5&sp=1";var l='<div class="chat-window-toybox"><div class="chat-window-toybox-content"></div><div class="chat-window-toybox-footer"><i class="ico ico-24 ico-emoticon"></i><i class="ico ico-24 ico-shopping-cart"></i></div></div>',c=s.compile('<i class="ico ico-24" style="background-size:24px 24px; background-image:url(\'{{stickerpackiconurl}}\');background-repeat: no-repeat;" data-packid="{{stickerpackid}}"></i>'),u=function(){a.bindAll(this),this.current_target=null,this.current_chat=null,this.emoticon_panel=new e,this.emoticon_panel.on("select",this.send_emoticon_event),this.toybox_footer_emoticon_btn=$('<i class="ico ico-24 ico-emoticon"></i>'),this.toybox_footer_sticker_btns={},this.toybox_footer_shop_btn=$('<i class="ico ico-24 ico-shopping-cart"></i>'),this.sticker_panels={},this.$container=$(l),this.listen_to_session(),this.opened_once=!1},h=u.prototype;return a.extend(h,{send_emoticon_event:function(e){if(this.current_target){var t=jQuery.Event("select",{value:e});$(this.current_btn).trigger(t),this.hide()}},send_sticker_event:function(e){if(this.current_target){var t=jQuery.Event("sticker_select",{value:e});$(this.current_btn).trigger(t),this.hide()}},show:function(e,t){this.opened_once||(this.opened_once=!0,n.fetch_emoticon()),this.$container.on("click",function(e){e.stopPropagation(),e.preventDefault()}),$("body").on("click",this.hide),$(e).before(this.$container),this.$container.show(),this.current_target=e,this.current_btn=t,this.attachButtons(this.$container),this.attachPanels(this.$container)},attachButtons:function(e){var t=$(".chat-window-toybox-footer",e),n=this;t.empty(),t.append(this.toybox_footer_emoticon_btn),a.each(this.toybox_footer_sticker_btns,function(e,i){e.off("click"),t.append(e),e.on("click",function(e){e.preventDefault(),n.sticker_panels[i]&&n.show_element(n.sticker_panels[i].getContent())})}),t.append(this.toybox_footer_shop_btn),this.attach_button_events()},attachPanels:function(e){var t=$(".chat-window-toybox-content",e);t.empty(),t.append(this.emoticon_panel.getContent()),a.each(this.sticker_panels,function(e){t.append(e.getContent())}),this.show_element(this.emoticon_panel.getContent())},hide:function(){this.$container.off("click"),$("body").off("click"),this.current_target=null,this.$container.hide()},listen_to_session:function(){n.on("sticker_pack_received",function(e){console.log("sticker_pack_received"),this.render_sticker_panel(this.$container,e),this.add_sticker_button(this.$container,e)},this),n.on("sticker_received",function(e,t){var n=t.stickerpackid,i=this.sticker_panels[n];i&&i.renderSticker(e)},this),n.on("emoticon_hotkeys",function(){console.log("emoticon_hotkeys_received"),this.render_emoticon_panel()},this)},close_all:function(){this.emoticon_panel.getContent().hide(),a.each(this.sticker_panels,function(e){e.getContent().hide()})},show_element:function(e){this.close_all(),e.show()},render_emoticon_panel:function(){this.emoticon_panel.render()},render_sticker_panel:function(e,n){if(!this.sticker_panels[n.stickerpackid]){var i=new t;i.on("select",this.send_sticker_event),this.sticker_panels[n.stickerpackid]=i,this.attachPanels(e)}},add_sticker_button:function(e,t){if(!this.toybox_footer_sticker_btns[t.stickerpackid]){var n=$(c(t));this.toybox_footer_sticker_btns[t.stickerpackid]=n,this.attachButtons(e)}},attach_button_events:function(){var e=this;this.toybox_footer_emoticon_btn.click(function(){e.show_element(e.emoticon_panel.getContent())}),this.toybox_footer_shop_btn.click(function(){var e=require("modules/mig33_app");e.navigate_to(r)})}}),new u}),function(e){function t(e){return"object"==typeof e?e:{top:e,left:e}}var n=e.scrollTo=function(t,n,i){e(window).scrollTo(t,n,i)};n.defaults={axis:"xy",duration:parseFloat(e.fn.jquery)>=1.3?0:1,limit:!0},n.window=function(){return e(window)._scrollable()},e.fn._scrollable=function(){return this.map(function(){var t=this,n=!t.nodeName||-1!=e.inArray(t.nodeName.toLowerCase(),["iframe","#document","html","body"]);if(!n)return t;var i=(t.contentWindow||t).document||t.ownerDocument||t;return/webkit/i.test(navigator.userAgent)||"BackCompat"==i.compatMode?i.body:i.documentElement})},e.fn.scrollTo=function(i,o,a){return"object"==typeof o&&(a=o,o=0),"function"==typeof a&&(a={onAfter:a}),"max"==i&&(i=9e9),a=e.extend({},n.defaults,a),o=o||a.duration,a.queue=a.queue&&a.axis.length>1,a.queue&&(o/=2),a.offset=t(a.offset),a.over=t(a.over),this._scrollable().each(function(){function s(e){c.animate(h,o,a.easing,e&&function(){e.call(this,i,a)})}if(null!=i){var r,l=this,c=e(l),u=i,h={},d=c.is("html,body");switch(typeof u){case"number":case"string":if(/^([+-]=?)?\d+(\.\d+)?(px|%)?$/.test(u)){u=t(u);break}if(u=e(u,this),!u.length)return;case"object":(u.is||u.style)&&(r=(u=e(u)).offset())}e.each(a.axis.split(""),function(e,t){var i="x"==t?"Left":"Top",o=i.toLowerCase(),p="scroll"+i,f=l[p],m=n.max(l,t);if(r)h[p]=r[o]+(d?0:f-c.offset()[o]),a.margin&&(h[p]-=parseInt(u.css("margin"+i))||0,h[p]-=parseInt(u.css("border"+i+"Width"))||0),h[p]+=a.offset[o]||0,a.over[o]&&(h[p]+=u["x"==t?"width":"height"]()*a.over[o]);else{var g=u[o];h[p]=g.slice&&"%"==g.slice(-1)?parseFloat(g)/100*m:g}a.limit&&/^\d+$/.test(h[p])&&(h[p]=0>=h[p]?0:Math.min(h[p],m)),!e&&a.queue&&(f!=h[p]&&s(a.onAfterFirst),delete h[p])}),s(a.onAfter)}}).end()},n.max=function(t,n){var i="x"==n?"Width":"Height",o="scroll"+i;if(!e(t).is("html,body"))return t[o]-e(t)[i.toLowerCase()]();var a="client"+i,s=t.ownerDocument.documentElement,r=t.ownerDocument.body;return Math.max(s[o],r[o])-Math.min(s[a],r[a])}}(jQuery),define("jquery.scrollTo",["jquery"],function(){}),define("modules/chat/views/chat_input_panel",["modules/chat/models/session","modules/chat/views/emote_menu","underscore","backbone","jquery.scrollTo","jquery"],function(e,t,n,i){var o=function(e,t,n){this.$el=$(e),this.$toy_box=$(n),this.$message_input=this.$el.find("input.messagebox"),this.$send_btn=this.$el.find("button.sendbutton"),this.$emoticon_btn=this.$el.find(".chat-window-emoticon"),this.$chat_window=this.$el.parent().find(".chat-window-messages"),this.chat_model=t,this.init()};return n.extend(o.prototype,i.Events),n.extend(o.prototype,{init:function(){var e=this;this.toy_box_shown=!1;var n=function(){e.send_message(e.$message_input.val()),e.$message_input.val(""),e.$chat_window.scrollTo("120%",100)};this.$message_input.keypress(function(e){13==e.which&&n()}),this.$emoticon_btn.on("click",function(n){n.preventDefault(),n.stopPropagation(),t.show(e.$el,e.$emoticon_btn)}),this.$emoticon_btn.on("select",function(t){var n=e.$message_input.val();e.$message_input.val(n+t.value+" ").focus()}),this.$emoticon_btn.on("sticker_select",function(t){var n=t.value;e.send_message("/sticker "+n),e.$message_input.focus()})},send_message:function(e){e=$.trim(e),""!==e&&(this.trigger("user_entered_message",e),this.chat_model.addUserTextMessage(e))}}),o}),define("modules/chat/util/avatar_cache",["underscore","backbone","jquery"],function(e,t){var n={},i=new t.Collection;return e.extend(n,t.Events),e.extend(n,{get_avatar_data:function(e){var t=this,n=$.ajax("/sites/json/avatar_api/get_image_key",{type:"GET",data:{username:e},timeout:5e3});n.success(function(e){console.log(e),t.save_data(e)}),n.fail(function(){t.trigger("avatar_error",{username:e})})},get_avatar_key:function(t){var n=i.get(t);console.log("--"),console.log(n),e.isUndefined(n)||e.isNull(n)?this.get_avatar_data(t,this.save_data,this):(this.trigger("head_key",t,n.get("keys").head_key),this.trigger("body_key",t,n.get("keys").body_key))},save_data:function(e,t){i.add({id:e,keys:{head_key:t.head_key,body_key:t.body_key}}),this.trigger("head_key",e,t.head_key),this.trigger("body_key",e,t.body_key)}}),n}),define("modules/chat/util/chat_message_renderer",["modules/common/utility","modules/chat/config/config","modules/chat/models/session","underscore","jquery","backbone"],function(e,t,n,i,o){var a={};return i.extend(a,{render:function(){function a(t,n){if(t){var i=parseInt(t,10).toString(16);return'style="color:#'+e.lpad(i,"0",6)+'"'}return n?'style="color:#'+n+'"':""}function s(e){var t=/(\b(https?|ftp|file):\/\/[\-A-Z0-9+&@#\/%?=~_|!:,.;]*[\-A-Z0-9+&@#\/%=~_|])/gi;return e.replace(t,"<a href='$1' target='mig33-new-window'>$1</a>")}function r(e){var t=/\+\[.*?\]/gi;if(!e.match(t))return e;var n=e.match(t)[0];return n=n.split("[")[1].split("]")[0],e.replace(t,'<a data-roomname="'+n+'" href="#" target="mig33-new-window">'+n+"</a>")}function l(e){return e==n.get("session_user")}function c(e,t){return l(e)?"username-author":t?"username-admin":"username"}function u(e,n,i,o,a){return i==t.Content_Type.emote&&!a.is_sticker()||i==t.Content_Type.file?!1:o!=t.DestinationType.individual&&e==n?!1:!0
}function h(e,n,i,o,a){return console.log(arguments),i==t.Content_Type.emote?"emote":o?"admin":l(n)?"author":a!=t.ChatroomType.group&&a!=t.ChatroomType.public_chat||n!=e?"normal":"server"}function d(e){return e==t.Content_Type.system}function p(e){return e.replace(/([.*+?\^${}()|\[\]\/\\])/g,"\\$1")}function f(t,n){var o=n.split(" ").sort(function(e,t){return t.length-e.length}),a=t,s=[];return i.each(o,function(e,t){if(!(0>=e.length)){var n={reference:"%%"+t+"%%",str:e};s.push(n),a=a.replace(RegExp(p(n.str),"g"),n.reference)}},this),i.each(s,function(t){var n=e.htmlEncode(t.str);a=a.replace(RegExp(t.reference,"g"),'<img src="" emoticon:id="'+n+'" class="emoticon-pending" alt="'+n+'" title="'+n+'">')},this),{message:a,type:"NORMAL"}}function m(e,t){console.log(t);var i="st_"+Date.now(),a='<div><img src="" id="'+i+'" class="sticker emoticon-pending" alt="'+t+'" title="'+t+'"></div>';return n.trigger_fetch_sticker(t,function(e,t){o("#"+i).attr("src",t.url)}),{message:a,type:"NORMAL"}}return function(n){var i=e.htmlDecode(n.get("message")),p=n.get("source"),g=n.get("content_type"),_=n.get("admin_message")||!1,v=o.trim(n.get("emoticons")),y=n.get("source_colour"),w=n.get("message_colour"),b=n.get("chatroom_type"),x=n.get("chatroom_identifier"),k=n.get("destination"),C=n.get("time"),E=n.get("message_type")==t.IM_Type.fusion,T=n.isSelfMessage(),S=n.is_sticker();i=i.replace(/&apos;/g,"'");var P="/sites/resources/images/avatar/default-avatar.png",A=P,I={w:24,h:24};(E||T)&&(A=t.image_server+"/a/"+p+"?w="+I.w+"&h="+I.h+"&c=1&a=1");var $=new Date;$.setHours(0,0,0,0);var N="HH:MM";try{C.getTime()<$.getTime()&&(N="mmm dd, HH:MM")}catch(M){console.log("error manipulating time")}var R='<span class="message-source"><a href="/u/'+p+'" onclick="mig33.show_profile(\''+p+'\')"><img height="'+I.h+'" width="'+I.w+'" src="'+A+'"/></a> <a class="chat-user" href="/u/'+p+'" onclick="mig33.show_participant_menu(event, \''+p+"', '"+x+"', '"+b+'\'); return false;" class="username-link"><span class="'+c(p,_)+'" '+a(y,l(p)?"007700":"444444")+">"+p+'</span></a><span class="message-time"> '+e.dateFormat(C,N)+"</span></span>",j=u(k,p,g,b,n)?R:"";if(d(g)||(i=e.htmlEncode(i)),g!=t.Content_Type.file){var O;O=S?m(i,v):f(i,v),i=O.message}return i=i.replace(RegExp("\\n","g"),"<br />"),i=s(i),i=r(i),i='<span class="message '+h(k,p,g,_,b)+'" '+a(w)+">"+i+"</span>",j+i}}()}),a}),define("modules/chat/views/chat_message_panel",["modules/chat/models/session","modules/chat/util/avatar_cache","modules/chat/util/emoticon_cache","modules/chat/util/chat_message_renderer","modules/chat/config/config","modules/common/utility","underscore","backbone","jquery","jquery.scrollTo"],function(e,t,n,i,o,a,s,r){var l=function(e){var t=$(this).data("roomname");t&&(e.preventDefault(),mig33.chatroom_manager.join_chatroom(t))},c=function(e,n){this.$el=$(e),this.$message_container=$(e).find("ul"),this.message_limit=50,this.messages=[],this.chat_model=n;var i=this;this.chat_model.on("chat_message_added",function(e){console.log("going to call show_message"),i.show_message(e)});var a=this.chat_model.getMessages();a.each(function(e){i.show_message(e)},this),t.on("head_key",function(e,t){var n="/sites/resources/images/avatar/default-avatar.png",a="."+e.replace(/\./gi,"--").replace(/@/gi,""),s=i.$message_container.find(a);s.each(function(){var e=$(this),i=n;t&&t.length>0&&(i=o.image_server+"/"+t+"?w=24&h=24&a=1"),e.src!==i&&(e.src=i),e.removeClass(a)}),console.log("User avatar updated for "+e)})};return s.extend(c.prototype,r.Events),s.extend(c.prototype,{is_scrollbar_at_bottom:function(){var e=this.$el.height(),t=this.$el.prop("scrollHeight"),n=this.$el.scrollTop();return e>=t||e+n>=t-40},show_message:function(e){var t=i.render(e),n=this,o=this.is_scrollbar_at_bottom();this.scroller_placeholder&&this.scroller_placeholder.remove();var r=$("<li id='"+e.get("message_id")+"'>"+t+"</li>");$("a",r).click(l),this.messages.push(r),this.scroller_placeholder=this.scroller_placeholder=$("<li>&nbsp;</li>").css({height:"5px",width:"100%"});var c;if(this.chat_model.is_chat_room()){c=this.chat_model.get_prev_message(e),this.$message_container.append(r);try{c&&c.get("source")===e.get("source")&&18e4>e.get("time").getTime()-c.get("time").getTime()&&$(".message-source",r).hide()}catch(u){console.log("time manipulation seem to fail")}if(this.messages.length>this.message_limit){var h=this.messages.shift();h&&h.remove()}}else{var d=this.chat_model.get_next_message(e);if(this.chat_model.is_prev_message_contiguous(e)){c=n.chat_model.get_prev_message(e);try{c&&c.get("source")===e.get("source")&&18e4>e.get("time").getTime()-c.get("time").getTime()&&$(".message-source",r).hide()}catch(u){console.log("time manipulation seem to fail")}}else r.prepend("<div class='getmore'><a class='btn btn-mini'>"+a.translate("chat|load_previous_message")+"</a></div>"),$(".btn",r).click(function(t){t.preventDefault();var i,o;o=e.get("time").getTime(),c=n.chat_model.get_prev_message(e),s.isEmpty(c)?n.chat_model.fetchMessages(0,o):(i=c.get("time").getTime(),n.chat_model.fetchMessages(i,o))});if(1!==this.messages.length&&d){var p=$("#"+d.get("message_id"),this.$message_container);p.before(r),this.chat_model.is_next_message_contiguous(e)&&$(".getmore",p).remove()}else this.$message_container.append(r)}this.$message_container.append(this.scroller_placeholder),this.fetch_emoticons(e.get("emoticons")),o&&this.$el.scrollTo(this.scroller_placeholder)},fetch_emoticons:function(e){if(e=$.trim(e),!s.isUndefined(e)&&null!==e&&"undefined"!=e){var t=!1,i=this;n.get_emoticons(e,function(){var e=i.$message_container.find(".emoticon-pending");e.each(function(e,i){var o=$(i),a=o.attr("emoticon:id"),s=n.get_cached_emoticon(a);s&&(o.attr("src",s.url),o.removeClass("emoticon-pending"),"VIBRATION"==s.t&&(t=!0))})},this)}}}),c}),define("modules/chat/views/qtip_menu_container_mixin",["qtip"],function(){var e=function(e,t,n){return e.$qtip_container=$("<div class='dropdown-container'></div>"),t=t||"bottom center",n=n||"top center",e.qtip_params={content:" ",position:{target:"event",at:t,my:n},events:{visible:function(e,i){var o=i.get("content.text"),a=o.height();i.set("style.height",a+10+"px"),$("li",o).click(function(e){e.stopPropagation(),e.preventDefault(),i.hide()});var s=$(e.target).parents("body"),r=s.height(),l=e.target.offsetTop+a+10;l>r?(i.set("position.at",t),i.set("position.my",n),i.reposition()):(i.set("position.at",n),i.set("position.my",t),i.reposition())}},style:{classes:"qtip-bootstrap",width:"auto",height:"auto"},hide:{effect:!1,event:"unfocus",leave:!1},show:{effect:!1}},e.$qtip_container.qtip(e.qtip_params),!0};return e}),define("modules/chat/views/context_menu_items",["modules/chat/models/session","modules/chat/models/contact","modules/common/utility","modules/chat/models/chat","underscore","jquery","backbone"],function(e,t,n,i,o){var a=i.ChatStore,s=t.contactGroupStore,r=function(t,i){var a=!(t.is_chat_room()||t.is_group_chat()),r=[];if(r.push({label:n.translate("user|view_profile"),events:{click:function(){u(i)}}}),a)r.push({label:n.translate("user|transfer_credit"),events:{click:function(){f(i)}}});else if(r.push({klass:"follow-contacts-btn",label:n.translate("user|follow"),events:""}),r.push({label:n.translate("user|send_gift"),events:{click:function(){p(i)}}}),i!==e.get("session_user")){var m=s.find_contact_by_name(i),g=m?m.get("contactId"):null;r.push({label:n.translate("user|private_chat"),events:{click:function(){l({userid:g,username:i})}}}),t.is_chat_room()&&r.push({label:n.translate("chat|kick"),events:{click:function(){c(i,t)}}})}r.push({label:n.translate("user|block_and_mute"),events:{click:function(){h(i)}}}),r.push({label:n.translate("common|report_abuse"),events:{click:function(){d(i,t)}}});var _=$("<ul class='nav nav-list no-padding'></ul>");return o.each(r,function(e){var t=e.klass?"class='"+e.klass+"'":" ",n=$("<li><a href='#' "+t+" >"+e.label+"</a></li>");o.each(e.events,function(e,t){n.on(t,e)}),_.append(n)}),_},l=function(e){a.startPrivateChat(e.userid,e.username,null,e.username)},c=function(e,t){var i=n.translate("chat|are_you_sure_kick_user",e,t.get("name")),o=window.confirm(i);o&&t.send_kick_user(e)},u=function(e){var t=require("modules/mig33_app"),i=n.get_profile_url(e);t.navigate_to(i),console.log(i+" - we will be taking you there in a while")},h=function(e){var t=n.translate("chat|are_you_sure_block_mute",e),i=window.confirm(t);i&&s.send_block_user(e)},d=function(e,t){var n=3,i=t.get("destination");console.log("subject : "+i);var o=document.location.protocol+"//"+document.location.host;o+="/sites/ajax/report/report_abuse?win_id=report_abuse&type="+n+"&offender="+e+"&subject="+i+"&subject_id="+i;var a=require("modules/mig33_app");a.navigate_to(o)},p=function(e){var t=document.location.protocol+"//"+document.location.host;t+="/sites/ajax/store/all_items?ty=1&username=&catid=1&e=8&username="+e+"&win_id=store-window";var n=require("modules/mig33_app");n.navigate_to(t)},f=function(e){var t=document.location.protocol+"//"+document.location.host;t+="/sites/ajax/account/transfer_credit?"+$.param({win_id:"account-window",recipient_username:e});var n=require("modules/mig33_app");n.navigate_to(t)};return r}),define("modules/model/common/mig33_collection",["underscore","backbone","modules/mig33_app","modules/common/config","modules/common/utility"],function(e,t,n,i,o){var a=t.Collection.extend({currentPage:1,fetch:function(e){var t,n=this;return e=e||{},this.currentPage=e.page||this.currentPage,t=a.__super__.fetch.apply(this,arguments),t.done(function(e){var t=o.parse_ajax_response(e);t.error?n.trigger("fetch:error",t):n.trigger("fetch:done",t)}),t.fail(function(e){n.trigger("fetch:fail",e)}),t.always(function(){n.trigger("fetch:complete")}),t},getPage:function(){return this.currentPage},setPage:function(e){this.currentPage=e},nextPage:function(){this.currentPage++},prevPage:function(){this.currentPage--},resetPage:function(){this.currentPage=1}});return a}),define("modules/model/post/replies_collection",["underscore","backbone","modules/model/common/mig33_collection","modules/common/config"],function(e,t,n,i){var o=t.Model.extend({}),a=n.extend({model:o,currentPage:1,comparator:function(e){return-e.get("timestamp")},parentId:null,url:function(){return i.urls.replies_url+"/"+this.parentId+"/"+this.currentPage},initialize:function(){this.on("add",function(e){e.set("parent_post",this.parentpost),this.sort()},this)},parse:function(t){return e.isUndefined(t.data.replies)?t:t.data.replies},setParent:function(e,t){this.parentId=e,this.parentpost=t,this.each(function(e){e.set("parent_post",t)})},resetPage:function(){this.currentPage=1},nextPage:function(){this.currentPage++}});return a}),define("modules/model/homefeed/post_model",["underscore","backbone","modules/common/config","modules/common/utility","modules/model/post/replies_collection"],function(e,t,n,i,o){var a=t.Model.extend({url:function(){return n.urls.single_post_url+"/"+this.get("id")+"/33/33"},parse:function(t){if(!e.isUndefined(t.data)){var n=t.data;return(n.num_of_replies<n.replies.length||n.num_of_replies>n.replies.length&&33>n.num_of_replies&&33>n.replies.length)&&(n.num_of_replies=n.replies.length),(n.num_of_reshares<n.reshares.length||n.num_of_reshares>n.reshares.length&&33>n.num_of_reshares&&33>n.reshares.length)&&(n.num_of_reshares=n.reshares.length),n.replies=new o(n.replies),n.replies.setParent(n.id,this),n.replies.resetPage(),n}return t},watchPost:function(){_gaq.push(["_trackEvent","Clicks","Web","Watch Post"]);var e=this,t=require("modules/mig33_app"),o=$.ajax({type:"post",dataType:"json",url:n.urls.miniblog_api_url+"/watch/"+e.get("id")});return o.done(function(e){e?(i.show_success(i.translate("post|success_watch")),t.vent.trigger(t.ApplicationEvents.POST_WATCH)):i.show_error(i.translate("post|error_watch"))}),o.fail(function(e,t,n){i.show_error(n)}),o},unwatchPost:function(){_gaq.push(["_trackEvent","Clicks","Web","Unwatch Post"]);var e=this,t=require("modules/mig33_app"),o=$.ajax({type:"delete",dataType:"json",url:n.urls.miniblog_api_url+"/unwatch/"+e.get("id")});return o.done(function(e){e=i.parse_ajax_response(e),e?(i.show_success(i.translate("post|success_unwatch")),t.vent.trigger(t.ApplicationEvents.POST_UNWATCH)):i.show_error(i.translate("post|error_unwatch"))}),o.fail(function(e,t,n){i.show_error(n)}),o},reportPost:function(){if(_gaq.push(["_trackEvent","Clicks","Web","Report Post"]),window.confirm(i.translate("post|confirm_report"))){var e=this,t=$.ajax({type:"post",dataType:"json",url:n.urls.miniblog_api_url+"/report/"+e.get("id")});t.done(function(e){e=i.parse_ajax_response(e),e?i.show_success(i.translate("post|success_report")):i.show_error(i.translate("post|error_report"))}),t.fail(function(e,t,n){i.show_error(n)})}},setReplyPermission:function(e){_gaq.push(["_trackEvent","Clicks","Web","Set Reply Permission "+e]);var t=this,o=$.ajax({type:"post",dataType:"json",url:n.urls.miniblog_api_url+"/replies_permission/"+t.get("id")+"/"+e}),a=1===e?"lock":"unlock";return o.done(function(n){n=i.parse_ajax_response(n),n?(t.trigger("set:reply_permission:success",e),i.show_success(i.translate("post|success_"+a))):i.show_error(i.translate("post|error_"+a))}),o.fail(function(e,t,n){i.show_error(n)}),o},deletePost:function(){if(_gaq.push(["_trackEvent","Clicks","Web","Delete Post"]),window.confirm(i.translate("post|confirm_delete"))){var e=this,o=$.ajax({type:"delete",dataType:"json",url:n.urls.miniblog_api_url+"/delete/"+e.get("id")});o.done(function(e){e=i.parse_ajax_response(e),e?(i.show_success(i.translate("post|success_delete")),t.history.navigate("/home",{trigger:!0})):i.show_error(i.translate("post|error_delete"))}),o.fail(function(e,t,n){i.show_error(n)})}},tagPost:function(e,t){_gaq.push(["_trackEvent","Clicks","Web","Tag Post"]);var o=this,a=$.ajax({type:"post",dataType:"json",url:n.urls.miniblog_api_url+"/tag_post/"+e+"/"+o.get("id")+"/"+t});a.done(function(e){e=i.parse_ajax_response(e),null!==e&&o.set({tag_entity:e})}),a.fail(function(){i.show_error(i.translate("post|error_tag"))})},deleteReply:function(e){if(_gaq.push(["_trackEvent","Clicks","Web","Delete Post Reply"]),window.confirm(i.translate("post|confirm_delete_reply"))){var t=this,o=$.ajax({type:"delete",dataType:"json",url:n.urls.miniblog_api_url+"/delete/"+e});o.done(function(n){if(n=i.parse_ajax_response(n)){i.show_success(i.translate("post|success_delete_reply"));var o=t.get("replies"),a=o.get(e);o.remove(a),t.set({num_of_replies:t.get("num_of_replies")-1}),t.trigger("post-reply:delete",e)}else i.show_error(i.translate("post|error_delete_reply"))}),o.fail(function(e,t,n){i.show_error(n)})}},repostPost:function(t){if(_gaq.push(["_trackEvent","Clicks","Web","Repost Post"]),window.confirm(i.translate("post|confirm_repost"))){var o,a=this,s=a.get("root_post"),r={originality:3,root_post_id:s.id,parent_post_id:a.id,post_to_twitter:0,post_to_facebook:0,body:""},l=$.ajax({url:n.urls.miniblog_api_url+"/post",type:"post",data:r});1==arguments.length&&(o=t),l.done(function(t){if(t=i.parse_ajax_response(t),null!==t){i.show_success(i.translate("post|success_repost"));var n=a.get("reshares"),s=[t];e.each(n,function(e){s.push(e)}),a.set({num_of_reshares:a.get("num_of_reshares")+1,reshares:s}),"undefined"!==o&&o(t)}}),l.fail(function(){i.show_error(i.translat("post|error_repost"))}),l.always(function(){$("#repost-tab").addClass("active"),$("#reply-tab").removeClass("active")})}}});return a}),define("modules/model/homefeed/posts_collection",["modules/model/common/mig33_collection","modules/mig33_app","modules/common/config","modules/model/homefeed/post_model","underscore","backbone"],function(e,t,n,i){var o=e.extend({model:i,initialize:function(){},url:function(){return n.urls.home_feed_url+"/"+this.currentPage+"/"+n.variable.limit},comparator:function(e){return-e.get("timestamp")}});return o}),define("modules/model/user/user_model",["underscore","backbone","modules/mig33_app","modules/common/config","modules/common/utility","modules/model/homefeed/posts_collection"],function(e,t,n,i,o,a){var s=t.Model.extend({initialize:function(){var e=this;this.profile_feed=new a,this.profile_feed.url=function(){return i.urls.profile_feed_url+"/"+e.get("id")+"/"+e.profile_feed.currentPage+"/"+i.variable.limit}},defaults:function(){return{is_cached:!1,is_404:!1,failed_fetch:!1}},isCached:function(){return this.get("is_cached")},url:function(){return i.urls.profile_url+"/"+this.get("username")},isAlreadyFollowing:function(){var e=this.get("relationship");return e.is_follower},follow:function(){if(o.is_logged_in()){_gaq.push(["_trackEvent","Clicks","Web","Follow User"]);var t=this,n=$.ajax({type:"post",cache:!1,dataType:"json",url:i.urls.miniblog_api_url+"/follow/"+parseInt(t.get("id"),10),success:function(n){if(n=o.parse_ajax_response(n),n.error)o.show_error(o.translate(n.error,t.get("username")));else{var i=t.get("relationship"),a={};e.extend(a,i),a.is_follower=!0,t.set({num_followers:t.get("num_followers")+1,relationship:a});var s=require("modules/common/session_user");s&&s.getInstance().set({num_following:s.getInstance().get("num_following")+1}),o.show_success(o.translate(n.success,t.get("username")))}},error:function(){o.show_error(o.translate("user|follow_error",t.get("username")))}});return n}},unfollow:function(){if(o.is_logged_in()){_gaq.push(["_trackEvent","Clicks","Web","Unfollow User"]);var t=this,n=$.ajax({type:"post",cache:!1,dataType:"json",url:i.urls.miniblog_api_url+"/unfollow/"+parseInt(t.get("id"),10),success:function(n){if(n=o.parse_ajax_response(n),n.error)o.show_error(o.translate(n.error,t.get("username")));else{var i=t.get("relationship"),a={};e.extend(a,i),a.is_follower=!1,t.set({num_followers:t.get("num_followers")-1,relationship:a});var s=require("modules/common/session_user");s&&s.getInstance().set({num_following:s.getInstance().get("num_following")-1}),o.show_success(o.translate(n.success,t.get("username")))}},error:function(){o.show_error(o.translate("user|unfollow_error",t.get("username")))}});return n}},block:function(){if(o.is_logged_in()&&window.confirm(o.translate("user|confirm_block"))){_gaq.push(["_trackEvent","Clicks","Web","Block User"]);var t=this;$.ajax({type:"post",cache:!1,dataType:"json",url:i.urls.miniblog_api_url+"/block_user/"+parseInt(t.get("id"),10),success:function(n){if(n=o.parse_ajax_response(n),n.error)o.show_error(o.translate("user|block_error",t.get("username")));else{var i=t.get("relationship"),a={};e.extend(a,i),a.is_blocked_by=!0,t.set("relationship",a),o.show_error(o.translate("user|block_successful",t.get("username")))}},error:function(){o.show_error(o.translate("user|block_error",this.get("username")))}})}},unblock:function(){if(o.is_logged_in()){_gaq.push(["_trackEvent","Clicks","Web","Unblock User"]);var t=this;$.ajax({type:"post",cache:!1,dataType:"json",url:i.urls.miniblog_api_url+"/unblock_user/"+parseInt(t.get("id"),10),success:function(n){if(n=o.parse_ajax_response(n),n.error)o.show_error(o.translate("user|unblock_error",t.get("username")));else{var i=t.get("relationship"),a={};e.extend(a,i),a.is_blocked_by=!1,t.set("relationship",a),o.show_error(o.translate("user|unblock_successful",t.get("username")))}},error:function(){o.show_error(o.translate("user|unblock_error",t.get("username")))}})}},mention:function(){var e=this;o.is_logged_in()&&e.get("username")}});return s}),define("modules/chat/views/chat_participant_list",["modules/chat/models/session","modules/chat/models/contact","modules/chat/config/config","modules/common/utility","modules/chat/models/chat","modules/chat/views/qtip_menu_container_mixin","modules/chat/views/context_menu_items","modules/model/user/user_model","underscore","backbone","jquery"],function(e,t,n,i,o,a,s,r,l,c){o.ChatStore,t.contactGroupStore;var u=function(e,t){this.random_seed=(new Date).getTime(),this.$el=$(e),this.$el.empty(),this.$el.addClass("participant-list"),this.chat_model=t,(t.is_chat_room()||t.is_group_chat())&&(this.renderParticipants(),this.chat_model.on("participant_added",function(){console.log("participant was added rendering"),this.renderParticipants()},this),this.chat_model.on("participant_removed",function(){console.log("participant was added rendering"),this.renderParticipants()},this),this.chat_model.on("chatroom_joined",function(){console.log("The chat room was joined, going to get participants"),this.chat_model.getParticipants()},this),a(this,"right center","top center"))};return l.extend(u.prototype,c.Events),l.extend(u.prototype,{renderParticipants:function(){console.log("render participants was called"),this.clearParticipants();var e=this.chat_model.getParticipants(),t=this;l.each(e,function(e){t.addParticipant(e,t.chat_model.is_admin(e))})},addParticipant:function(e){var t=e.replace(/\./gi,"--").replace(/@/gi,""),n=t+"_"+this.random_seed,o=this.$el.find("#"+n);if(!(o.length>0)){var a=this,l=$("<div id='"+n+"'><a href='#'>"+e+"</a></div>").appendTo(this.$el).addClass("x-tree-node-leaf participant participant_"+this.random_seed);l.on("click",function(){a.launch_profile_view(e)}),l.on("contextmenu",function(t){t.preventDefault(),t.stopPropagation();var n=a.$qtip_container.qtip("api"),o=s(a.chat_model,e);n.set("content.text",s(a.chat_model,e)),n.show(t);var l=new r({username:e});l.fetch(),l.on("change",function(){$(".follow-contacts-btn",o).off("click"),l.isAlreadyFollowing()?($(".follow-contacts-btn",o).text(i.translate("user|unfollow")),$(".follow-contacts-btn",o).on("click",function(){l.unfollow()})):($(".follow-contacts-btn",o).text(i.translate("user|follow")),$(".follow-contacts-btn",o).on("click",function(){l.follow()})),n.set("content.text",o)})})}},clearParticipants:function(){this.$el.empty()},launch_profile_view:function(e){var t=require("modules/mig33_app"),n=i.get_profile_url(e);t.navigate_to(n)}}),u}),!function(e,t){var n=t.prototype.trim,i=t.prototype.trimRight,o=t.prototype.trimLeft,a=function(e){return 1*e||0},s=function(e,t){if(1>t)return"";for(var n="";t>0;)1&t&&(n+=e),t>>=1,e+=e;return n},r=[].slice,l=function(e){return null==e?"\\s":e.source?e.source:"["+p.escapeRegExp(e)+"]"},c={lt:"<",gt:">",quot:'"',amp:"&",apos:"'"},u={};for(var h in c)u[c[h]]=h;u["'"]="#39";var d=function(){function e(e){return Object.prototype.toString.call(e).slice(8,-1).toLowerCase()}var n=s,i=function(){return i.cache.hasOwnProperty(arguments[0])||(i.cache[arguments[0]]=i.parse(arguments[0])),i.format.call(null,i.cache[arguments[0]],arguments)};return i.format=function(i,o){var a,s,r,l,c,u,h,p=1,f=i.length,m="",g=[];for(s=0;f>s;s++)if(m=e(i[s]),"string"===m)g.push(i[s]);else if("array"===m){if(l=i[s],l[2])for(a=o[p],r=0;l[2].length>r;r++){if(!a.hasOwnProperty(l[2][r]))throw Error(d('[_.sprintf] property "%s" does not exist',l[2][r]));a=a[l[2][r]]}else a=l[1]?o[l[1]]:o[p++];if(/[^s]/.test(l[8])&&"number"!=e(a))throw Error(d("[_.sprintf] expecting number but found %s",e(a)));switch(l[8]){case"b":a=a.toString(2);break;case"c":a=t.fromCharCode(a);break;case"d":a=parseInt(a,10);break;case"e":a=l[7]?a.toExponential(l[7]):a.toExponential();break;case"f":a=l[7]?parseFloat(a).toFixed(l[7]):parseFloat(a);break;case"o":a=a.toString(8);break;case"s":a=(a=t(a))&&l[7]?a.substring(0,l[7]):a;break;case"u":a=Math.abs(a);break;case"x":a=a.toString(16);break;case"X":a=a.toString(16).toUpperCase()}a=/[def]/.test(l[8])&&l[3]&&a>=0?"+"+a:a,u=l[4]?"0"==l[4]?"0":l[4].charAt(1):" ",h=l[6]-t(a).length,c=l[6]?n(u,h):"",g.push(l[5]?a+c:c+a)}return g.join("")},i.cache={},i.parse=function(e){for(var t=e,n=[],i=[],o=0;t;){if(null!==(n=/^[^\x25]+/.exec(t)))i.push(n[0]);else if(null!==(n=/^\x25{2}/.exec(t)))i.push("%");else{if(null===(n=/^\x25(?:([1-9]\d*)\$|\(([^\)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-fosuxX])/.exec(t)))throw Error("[_.sprintf] huh?");if(n[2]){o|=1;var a=[],s=n[2],r=[];if(null===(r=/^([a-z_][a-z_\d]*)/i.exec(s)))throw Error("[_.sprintf] huh?");for(a.push(r[1]);""!==(s=s.substring(r[0].length));)if(null!==(r=/^\.([a-z_][a-z_\d]*)/i.exec(s)))a.push(r[1]);else{if(null===(r=/^\[(\d+)\]/.exec(s)))throw Error("[_.sprintf] huh?");a.push(r[1])}n[2]=a}else o|=2;if(3===o)throw Error("[_.sprintf] mixing positional and named placeholders is not (yet) supported");i.push(n)}t=t.substring(n[0].length)}return i},i}(),p={VERSION:"2.3.1",isBlank:function(e){return null==e&&(e=""),/^\s*$/.test(e)},stripTags:function(e){return null==e?"":t(e).replace(/<\/?[^>]+>/g,"")},capitalize:function(e){return e=null==e?"":t(e),e.charAt(0).toUpperCase()+e.slice(1)},chop:function(e,n){return null==e?[]:(e=t(e),n=~~n,n>0?e.match(RegExp(".{1,"+n+"}","g")):[e])},clean:function(e){return p.strip(e).replace(/\s+/g," ")},count:function(e,n){if(null==e||null==n)return 0;e=t(e),n=t(n);for(var i=0,o=0,a=n.length;;){if(o=e.indexOf(n,o),-1===o)break;i++,o+=a}return i},chars:function(e){return null==e?[]:t(e).split("")},swapCase:function(e){return null==e?"":t(e).replace(/\S/g,function(e){return e===e.toUpperCase()?e.toLowerCase():e.toUpperCase()})},escapeHTML:function(e){return null==e?"":t(e).replace(/[&<>"']/g,function(e){return"&"+u[e]+";"})},unescapeHTML:function(e){return null==e?"":t(e).replace(/\&([^;]+);/g,function(e,n){var i;return n in c?c[n]:(i=n.match(/^#x([\da-fA-F]+)$/))?t.fromCharCode(parseInt(i[1],16)):(i=n.match(/^#(\d+)$/))?t.fromCharCode(~~i[1]):e})},escapeRegExp:function(e){return null==e?"":t(e).replace(/([.*+?^=!:${}()|[\]\/\\])/g,"\\$1")},splice:function(e,t,n,i){var o=p.chars(e);return o.splice(~~t,~~n,i),o.join("")},insert:function(e,t,n){return p.splice(e,t,0,n)},include:function(e,n){return""===n?!0:null==e?!1:-1!==t(e).indexOf(n)},join:function(){var e=r.call(arguments),t=e.shift();return null==t&&(t=""),e.join(t)},lines:function(e){return null==e?[]:t(e).split("\n")},reverse:function(e){return p.chars(e).reverse().join("")},startsWith:function(e,n){return""===n?!0:null==e||null==n?!1:(e=t(e),n=t(n),e.length>=n.length&&e.slice(0,n.length)===n)},endsWith:function(e,n){return""===n?!0:null==e||null==n?!1:(e=t(e),n=t(n),e.length>=n.length&&e.slice(e.length-n.length)===n)},succ:function(e){return null==e?"":(e=t(e),e.slice(0,-1)+t.fromCharCode(e.charCodeAt(e.length-1)+1))},titleize:function(e){return null==e?"":t(e).replace(/(?:^|\s)\S/g,function(e){return e.toUpperCase()})},camelize:function(e){return p.trim(e).replace(/[-_\s]+(.)?/g,function(e,t){return t.toUpperCase()})},underscored:function(e){return p.trim(e).replace(/([a-z\d])([A-Z]+)/g,"$1_$2").replace(/[-\s]+/g,"_").toLowerCase()},dasherize:function(e){return p.trim(e).replace(/([A-Z])/g,"-$1").replace(/[-_\s]+/g,"-").toLowerCase()},classify:function(e){return p.titleize(t(e).replace(/[\W_]/g," ")).replace(/\s/g,"")},humanize:function(e){return p.capitalize(p.underscored(e).replace(/_id$/,"").replace(/_/g," "))},trim:function(e,i){return null==e?"":!i&&n?n.call(e):(i=l(i),t(e).replace(RegExp("^"+i+"+|"+i+"+$","g"),""))},ltrim:function(e,n){return null==e?"":!n&&o?o.call(e):(n=l(n),t(e).replace(RegExp("^"+n+"+"),""))},rtrim:function(e,n){return null==e?"":!n&&i?i.call(e):(n=l(n),t(e).replace(RegExp(n+"+$"),""))},truncate:function(e,n,i){return null==e?"":(e=t(e),i=i||"...",n=~~n,e.length>n?e.slice(0,n)+i:e)},prune:function(e,n,i){if(null==e)return"";if(e=t(e),n=~~n,i=null!=i?t(i):"...",n>=e.length)return e;var o=function(e){return e.toUpperCase()!==e.toLowerCase()?"A":" "},a=e.slice(0,n+1).replace(/.(?=\W*\w*$)/g,o);return a=a.slice(a.length-2).match(/\w\w/)?a.replace(/\s*\S+$/,""):p.rtrim(a.slice(0,a.length-1)),(a+i).length>e.length?e:e.slice(0,a.length)+i},words:function(e,t){return p.isBlank(e)?[]:p.trim(e,t).split(t||/\s+/)},pad:function(e,n,i,o){e=null==e?"":t(e),n=~~n;var a=0;switch(i?i.length>1&&(i=i.charAt(0)):i=" ",o){case"right":return a=n-e.length,e+s(i,a);case"both":return a=n-e.length,s(i,Math.ceil(a/2))+e+s(i,Math.floor(a/2));default:return a=n-e.length,s(i,a)+e}},lpad:function(e,t,n){return p.pad(e,t,n)},rpad:function(e,t,n){return p.pad(e,t,n,"right")},lrpad:function(e,t,n){return p.pad(e,t,n,"both")},sprintf:d,vsprintf:function(e,t){return t.unshift(e),d.apply(null,t)},toNumber:function(e,t){return e?(e=p.trim(e),e.match(/^-?\d+(?:\.\d+)?$/)?a(a(e).toFixed(~~t)):0/0):0},numberFormat:function(e,t,n,i){if(isNaN(e)||null==e)return"";e=e.toFixed(~~t),i="string"==typeof i?i:",";var o=e.split("."),a=o[0],s=o[1]?(n||".")+o[1]:"";return a.replace(/(\d)(?=(?:\d{3})+$)/g,"$1"+i)+s},strRight:function(e,n){if(null==e)return"";e=t(e),n=null!=n?t(n):n;var i=n?e.indexOf(n):-1;return~i?e.slice(i+n.length,e.length):e},strRightBack:function(e,n){if(null==e)return"";e=t(e),n=null!=n?t(n):n;var i=n?e.lastIndexOf(n):-1;return~i?e.slice(i+n.length,e.length):e},strLeft:function(e,n){if(null==e)return"";e=t(e),n=null!=n?t(n):n;var i=n?e.indexOf(n):-1;return~i?e.slice(0,i):e},strLeftBack:function(e,t){if(null==e)return"";e+="",t=null!=t?""+t:t;var n=e.lastIndexOf(t);return~n?e.slice(0,n):e},toSentence:function(e,t,n,i){t=t||", ",n=n||" and ";var o=e.slice(),a=o.pop();return e.length>2&&i&&(n=p.rtrim(t)+n),o.length?o.join(t)+n+a:a},toSentenceSerial:function(){var e=r.call(arguments);return e[3]=!0,p.toSentence.apply(p,e)},slugify:function(e){if(null==e)return"";var n="ąàáäâãåæćęèéëêìíïîłńòóöôõøùúüûñçżź",i="aaaaaaaaceeeeeiiiilnoooooouuuunczz",o=RegExp(l(n),"g");return e=t(e).toLowerCase().replace(o,function(e){var t=n.indexOf(e);return i.charAt(t)||"-"}),p.dasherize(e.replace(/[^\w\s-]/g,""))},surround:function(e,t){return[t,e,t].join("")},quote:function(e){return p.surround(e,'"')},exports:function(){var e={};for(var t in this)this.hasOwnProperty(t)&&!t.match(/^(?:include|contains|reverse)$/)&&(e[t]=this[t]);return e},repeat:function(e,n,i){if(null==e)return"";if(n=~~n,null==i)return s(t(e),n);for(var o=[];n>0;o[--n]=e);return o.join(i)},levenshtein:function(e,n){if(null==e&&null==n)return 0;if(null==e)return t(n).length;if(null==n)return t(e).length;e=t(e),n=t(n);for(var i,o,a=[],s=0;n.length>=s;s++)for(var r=0;e.length>=r;r++)o=s&&r?e.charAt(r-1)===n.charAt(s-1)?i:Math.min(a[r],a[r-1],i)+1:s+r,i=a[r],a[r]=o;return a.pop()}};p.strip=p.trim,p.lstrip=p.ltrim,p.rstrip=p.rtrim,p.center=p.lrpad,p.rjust=p.lpad,p.ljust=p.rpad,p.contains=p.include,p.q=p.quote,"undefined"!=typeof exports&&("undefined"!=typeof module&&module.exports&&(module.exports=p),exports._s=p),"function"==typeof define&&define.amd&&define("underscore.string",[],function(){return p}),e._=e._||{},e._.string=e._.str=p}(this,String),define("modules/chat/views/content_window_helper",["underscore.string","modules/common/utility","underscore","jquery","qtip"],function(e,t,n){var i=function(){var e=this;this.tearaway_window_refs={},this.current_window=null,window.closeWindow=function(t){e.close_window(t)},this.$window_parent=$("<div></div>"),this.modal_window_id=n.uniqueId("modal-"),this.$window_parent.qtip({id:this.modal_window_id,content:{text:t.translate("chat|content"),title:{text:"title",button:!0}},position:{my:"center",at:"center",target:$(window)},show:{effect:!1,event:"click",solo:!0,modal:!0},hide:{effect:!1,event:"",leave:!1},style:"qtip-shadow qtip-bootstrap"}),this.once_shown=!1,this.$content_iframe=$("<iframe id='"+n.uniqueId("ifr_")+"' src='about:blank' style='border:0px;padding:0px;margin:0px;'></iframe>")},o=function(t){var i=t;return function(){return e.sprintf.apply(e,n.union([i],n.values(arguments)))}};return n.extend(i.prototype,{window_details:{add_contact:{height:300,width:550,title:t.translate("chat|add_contact"),url:"/sites/ajax/contacts/add_contact?win_id=add-contact"},add_contact_group:{height:300,width:550,title:t.translate("chat|add_contact_group"),url:"/sites/ajax/contacts/add_contact_group?win_id=add-contact-group&action=add"},search_chat_room:{height:300,width:550,title:t.translate("chat|search_chatrooms"),url:"/sites/ajax/chatroom/search?win_id=chatroom-search"},report_abuse:{height:300,width:550,title:t.translate("common|report_abuse"),url:o("/sites/ajax/report/report_abuse?win_id=report_abuse&type=%1$s&offender=%2$s&subject=%3$s&subject_id=%4$s")},transfer_credit:{height:300,width:550,title:t.translate("user|transfer_credit"),url:o("/sites/ajax/account/transfer_credit?win_id=account-window&recipient_username=%1s")},create_chat_room:{height:300,width:550,title:t.translate("chat|create_chatroom"),url:"/sites/ajax/chatroom/create?win-id=create-chatroom"},edit_msn_details:{height:300,width:550,title:t.translate("chat|edit_msn"),url:"/sites/ajax/im/edit?win_id=edit-im-2&imtype=2"},edit_yahoo_details:{height:300,width:550,title:t.translate("chat|edit_yahoo"),url:"/sites/ajax/im/edit?win_id=edit-im-4&imtype=4"},edit_gtalk_details:{height:300,width:550,title:t.translate("chat|edit_gtalk"),url:"/sites/ajax/im/edit?win_id=edit-im-6&imtype=6"},edit_facebook_details:{height:300,width:550,title:t.translate("chat|edit_facebook"),url:"/sites/ajax/im/edit?win_id=edit-im-7&imtype=7"},add_contact_user:{height:300,width:550,title:t.translate("chat|follow_a_user"),url:o("/sites/ajax/contacts/add_mig33_user_submit?win_id=add-contact&username=%1$s&sharemobile=0")},rename_contact_group:{height:300,width:550,title:t.translate("chat|rename_group"),url:o("/sites/ajax/contacts/add_contact_group?win_id=rename-contact-group&action=rename&group_id=%1$s&group_name=%2$s&")},change_chatroom_multiid:{height:300,width:550,title:t.translate("chat|settings_control_multids"),url:o("/sites/ajax/chatroom/setup_multiids/?roomName=%1$s&win_id=chatroom-settings-setup_multiids")},setup_chatroom_settings:{height:300,width:550,title:t.translate("chat|settings_chatroom"),url:o("/sites/ajax/chatroom/setup/?roomName=%1$s&win_id=chatroom-settings-setup")},create_new_chatroom:{height:300,width:500,title:t.translate("chat|create_chatroom"),url:"/sites/ajax/chatroom/create"},invite_friends:{height:400,width:500,title:t.translate("chat|invite_friends"),url:"/wap/bv4/discover/emailrefer"}},show_window:function(e){var t=this.window_details[e];
if(!t)return console.log("unable to find window schema for - "+e),void 0;this.close_window();var i="";if(n.isFunction(t.url)){var o=n.rest(arguments);i=t.url.apply(this,o)}else i=t.url;this.show_inpage_window(i,t.title,t.width,t.height)},show_inpage_window:function(e,t,i,o){var a=this.$content_iframe,s=this.$window_parent,r=s.qtip("api");r.set("content.text",a),r.set("content.title.text",t),r.set("style.width",i),r.set("style.height",o),a.css({width:"100%",height:o-50}),this.once_shown&&a.contents().get(0).location.replace("about:blank");try{a.contents().get(0).location.replace("about:blank")}catch(l){}n.defer(function(){a.contents().get(0).location.replace(e)}),r.show(),this.current_window=r,this.once_shown=!0},show_tearaway_window:function(e,t,n,i,o){if(this.tearaway_window_refs[o])try{this.tearaway_window_refs[o].close()}catch(a){}this.tearaway_window_refs[o]=window.open(e+"?noredir=1",o,"width="+n+",height="+i)},close_window:function(){this.current_window&&this.current_window.hide(),this.current_window=null}}),new i}),function(e){function t(){var e=!1,t=!1;this.stopPropagation=function(){e=!0},this.isPropagationStopped=function(){return e},this.stopImmediatePropagation=function(){t=!0},this.isImmediatePropagationStopped=function(){return t}}function n(){var e=[];this.subscribe=function(t){e.push(t)},this.unsubscribe=function(t){for(var n=e.length-1;n>=0;n--)e[n]===t&&e.splice(n,1)},this.notify=function(n,i,o){i=i||new t,o=o||this;for(var a,s=0;e.length>s&&!i.isPropagationStopped()&&!i.isImmediatePropagationStopped();s++)a=e[s].call(o,i,n);return a}}function i(){var e=[];this.subscribe=function(t,n){return e.push({event:t,handler:n}),t.subscribe(n),this},this.unsubscribe=function(t,n){for(var i=e.length;i--;)if(e[i].event===t&&e[i].handler===n)return e.splice(i,1),t.unsubscribe(n),void 0;return this},this.unsubscribeAll=function(){for(var t=e.length;t--;)e[t].event.unsubscribe(e[t].handler);return e=[],this}}function o(e,t,n,i){void 0===n&&void 0===i&&(n=e,i=t),this.fromRow=Math.min(e,n),this.fromCell=Math.min(t,i),this.toRow=Math.max(e,n),this.toCell=Math.max(t,i),this.isSingleRow=function(){return this.fromRow==this.toRow},this.isSingleCell=function(){return this.fromRow==this.toRow&&this.fromCell==this.toCell},this.contains=function(e,t){return e>=this.fromRow&&this.toRow>=e&&t>=this.fromCell&&this.toCell>=t},this.toString=function(){return this.isSingleCell()?"("+this.fromRow+":"+this.fromCell+")":"("+this.fromRow+":"+this.fromCell+" - "+this.toRow+":"+this.toCell+")"}}function a(){this.__nonDataRow=!0}function s(){this.__group=!0,this.level=0,this.count=0,this.value=null,this.title=null,this.collapsed=!1,this.totals=null,this.rows=null,this.groups=null,this.groupingKey=null}function r(){this.__groupTotals=!0,this.group=null}function l(){var e=null;this.isActive=function(t){return t?e===t:null!==e},this.activate=function(t){if(t!==e){if(null!==e)throw"SlickGrid.EditorLock.activate: an editController is still active, can't activate another editController";if(!t.commitCurrentEdit)throw"SlickGrid.EditorLock.activate: editController must implement .commitCurrentEdit()";if(!t.cancelCurrentEdit)throw"SlickGrid.EditorLock.activate: editController must implement .cancelCurrentEdit()";e=t}},this.deactivate=function(t){if(e!==t)throw"SlickGrid.EditorLock.deactivate: specified editController is not the currently active one";e=null},this.commitCurrentEdit=function(){return e?e.commitCurrentEdit():!0},this.cancelCurrentEdit=function(){return e?e.cancelCurrentEdit():!0}}e.extend(!0,window,{Slick:{Event:n,EventData:t,EventHandler:i,Range:o,NonDataRow:a,Group:s,GroupTotals:r,EditorLock:l,GlobalEditorLock:new l}}),s.prototype=new a,s.prototype.equals=function(e){return this.value===e.value&&this.count===e.count&&this.collapsed===e.collapsed},r.prototype=new a}(jQuery),define("slick.core",["jquery"],function(){}),function(e){function t(t){function n(){vt=!0}function i(){vt=!1,tt()}function o(e){wt=e}function a(e){st=e}function s(e){e=e||0;for(var t,n=e,i=dt.length;i>n;n++){if(t=dt[n][ht],void 0===t)throw"Each data element must implement a unique 'id' property";ft[t]=n}}function r(){for(var e,t=0,n=dt.length;n>t;t++)if(e=dt[t][ht],void 0===e||ft[e]!==t)throw"Each data element must implement a unique 'id' property"}function l(){return dt}function c(e,t){void 0!==t&&(ht=t),dt=xt=e,ft={},s(),r(),tt()}function u(e){void 0!=e.pageSize&&(At=e.pageSize,It=At?Math.min(It,Math.max(0,Math.ceil($t/At)-1)):0),void 0!=e.pageNum&&(It=Math.min(e.pageNum,Math.max(0,Math.ceil($t/At)-1))),Rt.notify(h(),null,ct),tt()}function h(){var e=At?Math.max(1,Math.ceil($t/At)):1;return{pageSize:At,pageNum:It,totalRows:$t,totalPages:e}}function d(e,t){yt=t,at=e,ot=null,t===!1&&dt.reverse(),dt.sort(e),t===!1&&dt.reverse(),ft={},s(),tt()}function p(e,t){yt=t,ot=e,at=null;var n=Object.prototype.toString;Object.prototype.toString="function"==typeof e?e:function(){return this[e]},t===!1&&dt.reverse(),dt.sort(),Object.prototype.toString=n,t===!1&&dt.reverse(),ft={},s(),tt()}function f(){at?d(at,yt):ot&&p(ot,yt)}function m(e){gt=e,t.inlineFilters&&(rt=Y(),lt=K()),tt()}function g(){return Et}function _(n){t.groupItemMetadataProvider||(t.groupItemMetadataProvider=new Slick.Data.GroupItemMetadataProvider),Tt=[],St=[],n=n||[],Et=n instanceof Array?n:[n];for(var i=0;Et.length>i;i++){var o=Et[i]=e.extend(!0,{},Ct,Et[i]);o.getterIsAFn="function"==typeof o.getter,o.compiledAccumulators=[];for(var a=o.aggregators.length;a--;)o.compiledAccumulators[a]=V(o.aggregators[a]);St[i]={}}tt()}function v(e,t,n){return null==e?(_([]),void 0):(_({getter:e,formatter:t,comparer:n}),void 0)}function y(e,t){if(!Et.length)throw Error("At least must setGrouping must be specified before calling setAggregators().");Et[0].aggregators=e,Et[0].aggregateCollapsed=t,_(Et)}function w(e){return dt[e]}function b(e){return ft[e]}function x(){if(!mt){mt={};for(var e=0,t=pt.length;t>e;e++)mt[pt[e][ht]]=e}}function k(e){return x(),mt[e]}function C(e){return dt[ft[e]]}function E(e){var t=[];x();for(var n=0;e.length>n;n++){var i=mt[e[n]];null!=i&&(t[t.length]=i)}return t}function T(e){for(var t=[],n=0;e.length>n;n++)e[n]<pt.length&&(t[t.length]=pt[e[n]][ht]);return t}function S(e,t){if(void 0===ft[e]||e!==t[ht])throw"Invalid or non-matching id";dt[ft[e]]=t,_t||(_t={}),_t[e]=!0,tt()}function P(e,t){dt.splice(e,0,t),s(e),tt()}function A(e){dt.push(e),s(dt.length-1),tt()}function I(e){var t=ft[e];if(void 0===t)throw"Invalid id";delete ft[e],dt.splice(t,1),s(t),tt()}function $(){return pt.length}function N(e){return pt[e]}function M(e){var n=pt[e];return void 0===n?null:n.__group?t.groupItemMetadataProvider.getGroupRowMetadata(n):n.__groupTotals?t.groupItemMetadataProvider.getTotalsRowMetadata(n):null}function R(e,t){if(null==e)for(var n=0;Et.length>n;n++)St[n]={},Et[n].collapsed=t;else St[e]={},Et[e].collapsed=t;tt()}function j(e){R(e,!0)}function O(e){R(e,!1)}function D(e,t,n){St[e][t]=Et[e].collapsed^n,tt()}function H(){var e=Array.prototype.slice.call(arguments),t=e[0];1==e.length&&-1!=t.indexOf(Pt)?D(t.split(Pt).length-1,t,!0):D(e.length-1,e.join(Pt),!0)}function L(){var e=Array.prototype.slice.call(arguments),t=e[0];1==e.length&&-1!=t.indexOf(Pt)?D(t.split(Pt).length-1,t,!1):D(e.length-1,e.join(Pt),!1)}function z(){return Tt}function q(e,t){for(var n,i,o,a=[],s=[],r=t?t.level+1:0,l=Et[r],c=0,u=e.length;u>c;c++)o=e[c],i=l.getterIsAFn?l.getter(o):o[l.getter],i=i||0,n=s[i],n||(n=new Slick.Group,n.count=0,n.value=i,n.level=r,n.groupingKey=(t?t.groupingKey+Pt:"")+i,n.rows=[],a[a.length]=n,s[i]=n),n.rows[n.count++]=o;if(Et.length-1>r)for(var c=0;a.length>c;c++)n=a[c],n.groups=q(n.rows,n);return a.sort(Et[r].comparer),a}function U(e){for(var t,n=Et[e.level],i=e.level==Et.length,o=new Slick.GroupTotals,a=n.aggregators.length;a--;)t=n.aggregators[a],t.init(),n.compiledAccumulators[a].call(t,!i&&n.aggregateChildGroups?e.groups:e.rows),t.storeResult(o);o.group=e,e.totals=o}function W(e){for(var t,n=e.length;n--;)t=e[n],(!t.collapsed||Et[t.level].aggregateCollapsed)&&(t.groups&&W(t.groups),Et[t.level].aggregators.length&&U(t))}function F(e,t){t=t||0;for(var n,i=Et[t],o=i.collapsed,a=St[t],s=e.length;s--;)n=e[s],n.collapsed=o^a[n.groupingKey],n.title=i.formatter?i.formatter(n):n.value,n.groups&&(F(n.groups,t+1),n.rows=null)}function G(e){for(var t,n,i=[],o=0,a=0,s=e.length;s>a;a++){if(n=e[a],i[o++]=n,!n.collapsed){t=n.groups?G(n.groups):n.rows;for(var r=0,l=t.length;l>r;r++)i[o++]=t[r]}!n.totals||n.collapsed&&!Et[n.level].aggregateCollapsed||(i[o++]=n.totals)}return i}function B(e){var t=/^function[^(]*\(([^)]*)\)\s*{([\s\S]*)}$/,n=(""+e).match(t);return{params:n[1].split(","),body:n[2]}}function V(e){var t=B(e.accumulate),n=Function("_items","for (var "+t.params[0]+", _i=0, _il=_items.length; _i<_il; _i++) {"+t.params[0]+" = _items[_i]; "+t.body+"}");return n.displayName=n.name="compiledAccumulatorLoop",n}function Y(){var e=B(gt),t=e.body.replace(/return false[;}]/gi,"{ continue _coreloop; }").replace(/return true[;}]/gi,"{ _retval[_idx++] = $item$; continue _coreloop; }").replace(/return ([^;}]+?);/gi,"{ if ($1) { _retval[_idx++] = $item$; }; continue _coreloop; }"),n=["var _retval = [], _idx = 0; ","var $item$, $args$ = _args; ","_coreloop: ","for (var _i = 0, _il = _items.length; _i < _il; _i++) { ","$item$ = _items[_i]; ","$filter$; ","} ","return _retval; "].join("");n=n.replace(/\$filter\$/gi,t),n=n.replace(/\$item\$/gi,e.params[0]),n=n.replace(/\$args\$/gi,e.params[1]);var i=Function("_items,_args",n);return i.displayName=i.name="compiledFilter",i}function K(){var e=B(gt),t=e.body.replace(/return false[;}]/gi,"{ continue _coreloop; }").replace(/return true[;}]/gi,"{ _cache[_i] = true;_retval[_idx++] = $item$; continue _coreloop; }").replace(/return ([^;}]+?);/gi,"{ if ((_cache[_i] = $1)) { _retval[_idx++] = $item$; }; continue _coreloop; }"),n=["var _retval = [], _idx = 0; ","var $item$, $args$ = _args; ","_coreloop: ","for (var _i = 0, _il = _items.length; _i < _il; _i++) { ","$item$ = _items[_i]; ","if (_cache[_i]) { ","_retval[_idx++] = $item$; ","continue _coreloop; ","} ","$filter$; ","} ","return _retval; "].join("");n=n.replace(/\$filter\$/gi,t),n=n.replace(/\$item\$/gi,e.params[0]),n=n.replace(/\$args\$/gi,e.params[1]);var i=Function("_items,_args,_cache",n);return i.displayName=i.name="compiledFilterWithCaching",i}function Q(e,t){for(var n=[],i=0,o=0,a=e.length;a>o;o++)gt(e[o],t)&&(n[i++]=e[o]);return n}function X(e,t,n){for(var i,o=[],a=0,s=0,r=e.length;r>s;s++)i=e[s],n[s]?o[a++]=i:gt(i,t)&&(o[a++]=i,n[s]=!0);return o}function J(e){if(gt){var n=t.inlineFilters?rt:Q,i=t.inlineFilters?lt:X;wt.isFilterNarrowing?xt=n(xt,st):wt.isFilterExpanding?xt=i(e,st,kt):wt.isFilterUnchanged||(xt=n(e,st))}else xt=At?e:e.concat();var o;return At?(It*At>xt.length&&(It=Math.floor(xt.length/At)),o=xt.slice(At*It,At*It+At)):o=xt,{totalRows:xt.length,rows:o}}function Z(e,t){var n,i,o,a=[],s=0,r=t.length;wt&&wt.ignoreDiffsBefore&&(s=Math.max(0,Math.min(t.length,wt.ignoreDiffsBefore))),wt&&wt.ignoreDiffsAfter&&(r=Math.min(t.length,Math.max(0,wt.ignoreDiffsAfter)));for(var l=s,c=e.length;r>l;l++)l>=c?a[a.length]=l:(n=t[l],i=e[l],(Et.length&&(o=n.__nonDataRow||i.__nonDataRow)&&n.__group!==i.__group||n.__group&&!n.equals(i)||o&&(n.__groupTotals||i.__groupTotals)||n[ht]!=i[ht]||_t&&_t[n[ht]])&&(a[a.length]=l));return a}function et(e){mt=null,(wt.isFilterNarrowing!=bt.isFilterNarrowing||wt.isFilterExpanding!=bt.isFilterExpanding)&&(kt=[]);var t=J(e);$t=t.totalRows;var n=t.rows;Tt=[],Et.length&&(Tt=q(n),Tt.length&&(W(Tt),F(Tt),n=G(Tt)));var i=Z(pt,n);return pt=n,i}function tt(){if(!vt){var e=pt.length,t=$t,n=et(dt,gt);At&&It*At>$t&&(It=Math.max(0,Math.ceil($t/At)-1),n=et(dt,gt)),_t=null,bt=wt,wt={},t!=$t&&Rt.notify(h(),null,ct),e!=pt.length&&Nt.notify({previous:e,current:pt.length},null,ct),n.length>0&&Mt.notify({rows:n},null,ct)}}function nt(e,t){function n(){if(a.length>0){i=!0;var n=o.mapIdsToRows(a);t||(a=o.mapRowsToIds(n)),e.setSelectedRows(n),i=!1}}var i,o=this,a=o.mapRowsToIds(e.getSelectedRows());e.onSelectedRowsChanged.subscribe(function(){i||(a=o.mapRowsToIds(e.getSelectedRows()))}),this.onRowsChanged.subscribe(n),this.onRowCountChanged.subscribe(n)}function it(e,t){function n(e){o={};for(var t in e){var n=pt[t][ht];o[n]=e[t]}}function i(){if(o){a=!0,x();var n={};for(var i in o){var s=mt[i];void 0!=s&&(n[s]=o[i])}e.setCellCssStyles(t,n),a=!1}}var o,a;n(e.getCellCssStyles(t)),e.onCellCssStylesChanged.subscribe(function(e,i){a||t==i.key&&i.hash&&n(i.hash)}),this.onRowsChanged.subscribe(i),this.onRowCountChanged.subscribe(i)}var ot,at,st,rt,lt,ct=this,ut={groupItemMetadataProvider:null,inlineFilters:!1},ht="id",dt=[],pt=[],ft={},mt=null,gt=null,_t=null,vt=!1,yt=!0,wt={},bt={},xt=[],kt=[],Ct={getter:null,formatter:null,comparer:function(e,t){return e.value-t.value},aggregators:[],aggregateCollapsed:!1,aggregateChildGroups:!1,collapsed:!1},Et=[],Tt=[],St=[],Pt=":|:",At=0,It=0,$t=0,Nt=new Slick.Event,Mt=new Slick.Event,Rt=new Slick.Event;return t=e.extend(!0,{},ut,t),{beginUpdate:n,endUpdate:i,setPagingOptions:u,getPagingInfo:h,getItems:l,setItems:c,setFilter:m,sort:d,fastSort:p,reSort:f,setGrouping:_,getGrouping:g,groupBy:v,setAggregators:y,collapseAllGroups:j,expandAllGroups:O,collapseGroup:H,expandGroup:L,getGroups:z,getIdxById:b,getRowById:k,getItemById:C,getItemByIdx:w,mapRowsToIds:T,mapIdsToRows:E,setRefreshHints:o,setFilterArgs:a,refresh:tt,updateItem:S,insertItem:P,addItem:A,deleteItem:I,syncGridSelection:nt,syncGridCellCssStyles:it,getLength:$,getItem:N,getItemMetadata:M,onRowCountChanged:Nt,onRowsChanged:Mt,onPagingInfoChanged:Rt}}function n(e){this.field_=e,this.init=function(){this.count_=0,this.nonNullCount_=0,this.sum_=0},this.accumulate=function(e){var t=e[this.field_];this.count_++,null!=t&&""!==t&&0/0!==t&&(this.nonNullCount_++,this.sum_+=parseFloat(t))},this.storeResult=function(e){e.avg||(e.avg={}),0!=this.nonNullCount_&&(e.avg[this.field_]=this.sum_/this.nonNullCount_)}}function i(e){this.field_=e,this.init=function(){this.min_=null},this.accumulate=function(e){var t=e[this.field_];null!=t&&""!==t&&0/0!==t&&(null==this.min_||this.min_>t)&&(this.min_=t)},this.storeResult=function(e){e.min||(e.min={}),e.min[this.field_]=this.min_}}function o(e){this.field_=e,this.init=function(){this.max_=null},this.accumulate=function(e){var t=e[this.field_];null!=t&&""!==t&&0/0!==t&&(null==this.max_||t>this.max_)&&(this.max_=t)},this.storeResult=function(e){e.max||(e.max={}),e.max[this.field_]=this.max_}}function a(e){this.field_=e,this.init=function(){this.sum_=null},this.accumulate=function(e){var t=e[this.field_];null!=t&&""!==t&&0/0!==t&&(this.sum_+=parseFloat(t))},this.storeResult=function(e){e.sum||(e.sum={}),e.sum[this.field_]=this.sum_}}e.extend(!0,window,{Slick:{Data:{DataView:t,Aggregators:{Avg:n,Min:i,Max:o,Sum:a}}}})}(jQuery),define("slick.dataview",["jquery"],function(){}),function(e){function t(t){function n(e,n,i,o,a){return t.enableExpandCollapse?"<span class='"+t.toggleCssClass+" "+(a.collapsed?t.toggleCollapsedCssClass:t.toggleExpandedCssClass)+"'></span>"+a.title:a.title}function i(e,t,n,i,o){return i.groupTotalsFormatter&&i.groupTotalsFormatter(o,i)||""}function o(e){h=e,h.onClick.subscribe(s),h.onKeyDown.subscribe(l)}function a(){h&&(h.onClick.unsubscribe(s),h.onKeyDown.unsubscribe(l))}function s(t,n){var i=this.getDataItem(n.row),o=e(t.target);r(i,o)&&(i.collapsed?this.getData().expandGroup(i.value):this.getData().collapseGroup(i.value),t.stopImmediatePropagation(),t.preventDefault())}function r(e,n){return e&&e instanceof Slick.Group&&(n.hasClass(t.toggleCssClass)||n.hasClass("slick-group-title")||n.hasClass("slick-cell"))}function l(e){if(t.enableExpandCollapse&&32==e.which){var n=this.getActiveCell();if(n){var i=this.getDataItem(n.row);i&&i instanceof Slick.Group&&(i.collapsed?this.getData().expandGroup(i.value):this.getData().collapseGroup(i.value),e.stopImmediatePropagation(),e.preventDefault())}}}function c(){return{selectable:!1,focusable:t.groupFocusable,cssClasses:t.groupCssClass,columns:{0:{colspan:"*",formatter:n,editor:null}}}}function u(){return{selectable:!1,focusable:t.totalsFocusable,cssClasses:t.totalsCssClass,formatter:i,editor:null}}var h,d={groupCssClass:"slick-group",totalsCssClass:"slick-group-totals",groupFocusable:!0,totalsFocusable:!1,toggleCssClass:"slick-group-toggle",toggleExpandedCssClass:"expanded",toggleCollapsedCssClass:"collapsed",enableExpandCollapse:!0};return t=e.extend(!0,{},d,t),{init:o,destroy:a,getGroupRowMetadata:c,getTotalsRowMetadata:u}}e.extend(!0,window,{Slick:{Data:{GroupItemMetadataProvider:t}}})}(jQuery),define("slick.groupitemmetadataprovider",["jquery"],function(){}),function(e){e.fn.drag=function(t,n,i){var o="string"==typeof t?t:"",a=e.isFunction(t)?t:e.isFunction(n)?n:null;return 0!==o.indexOf("drag")&&(o="drag"+o),i=(t==a?n:i)||{},a?this.bind(o,i,a):this.trigger(o)};var t=e.event,n=t.special,i=n.drag={defaults:{which:1,distance:0,not:":input",handle:null,relative:!1,drop:!0,click:!1},datakey:"dragdata",noBubble:!0,add:function(t){var n=e.data(this,i.datakey),o=t.data||{};n.related+=1,e.each(i.defaults,function(e){void 0!==o[e]&&(n[e]=o[e])})},remove:function(){e.data(this,i.datakey).related-=1},setup:function(){if(!e.data(this,i.datakey)){var n=e.extend({related:0},i.defaults);e.data(this,i.datakey,n),t.add(this,"touchstart mousedown",i.init,n),this.attachEvent&&this.attachEvent("ondragstart",i.dontstart)}},teardown:function(){var n=e.data(this,i.datakey)||{};n.related||(e.removeData(this,i.datakey),t.remove(this,"touchstart mousedown",i.init),i.textselect(!0),this.detachEvent&&this.detachEvent("ondragstart",i.dontstart))},init:function(o){if(!i.touched){var a,s=o.data;if(!(0!=o.which&&s.which>0&&o.which!=s.which||e(o.target).is(s.not)||s.handle&&!e(o.target).closest(s.handle,o.currentTarget).length||(i.touched="touchstart"==o.type?this:null,s.propagates=1,s.mousedown=this,s.interactions=[i.interaction(this,s)],s.target=o.target,s.pageX=o.pageX,s.pageY=o.pageY,s.dragging=null,a=i.hijack(o,"draginit",s),!s.propagates)))return a=i.flatten(a),a&&a.length&&(s.interactions=[],e.each(a,function(){s.interactions.push(i.interaction(this,s))})),s.propagates=s.interactions.length,s.drop!==!1&&n.drop&&n.drop.handler(o,s),i.textselect(!1),i.touched?t.add(i.touched,"touchmove touchend",i.handler,s):t.add(document,"mousemove mouseup",i.handler,s),!i.touched||s.live?!1:void 0}},interaction:function(t,n){var o=e(t)[n.relative?"position":"offset"]()||{top:0,left:0};return{drag:t,callback:new i.callback,droppable:[],offset:o}},handler:function(o){var a=o.data;switch(o.type){case!a.dragging&&"touchmove":o.preventDefault();case!a.dragging&&"mousemove":if(Math.pow(o.pageX-a.pageX,2)+Math.pow(o.pageY-a.pageY,2)<Math.pow(a.distance,2))break;o.target=a.target,i.hijack(o,"dragstart",a),a.propagates&&(a.dragging=!0);case"touchmove":o.preventDefault();case"mousemove":if(a.dragging){if(i.hijack(o,"drag",a),a.propagates){a.drop!==!1&&n.drop&&n.drop.handler(o,a);break}o.type="mouseup"}case"touchend":case"mouseup":default:i.touched?t.remove(i.touched,"touchmove touchend",i.handler):t.remove(document,"mousemove mouseup",i.handler),a.dragging&&(a.drop!==!1&&n.drop&&n.drop.handler(o,a),i.hijack(o,"dragend",a)),i.textselect(!0),a.click===!1&&a.dragging&&e.data(a.mousedown,"suppress.click",(new Date).getTime()+5),a.dragging=i.touched=!1}},hijack:function(n,o,a,s,r){if(a){var l,c,u,h={event:n.originalEvent,type:n.type},d=o.indexOf("drop")?"drag":"drop",p=s||0,f=isNaN(s)?a.interactions.length:s;n.type=o,n.originalEvent=null,a.results=[];do if(c=a.interactions[p]){if("dragend"!==o&&c.cancelled)continue;u=i.properties(n,a,c),c.results=[],e(r||c[d]||a.droppable).each(function(s,r){return u.target=r,n.isPropagationStopped=function(){return!1},l=r?t.dispatch.call(r,n,u):null,l===!1?("drag"==d&&(c.cancelled=!0,a.propagates-=1),"drop"==o&&(c[d][s]=null)):"dropinit"==o&&c.droppable.push(i.element(l)||r),"dragstart"==o&&(c.proxy=e(i.element(l)||c.drag)[0]),c.results.push(l),delete n.result,"dropinit"!==o?l:void 0}),a.results[p]=i.flatten(c.results),"dropinit"==o&&(c.droppable=i.flatten(c.droppable)),"dragstart"!=o||c.cancelled||u.update()}while(f>++p);return n.type=h.type,n.originalEvent=h.event,i.flatten(a.results)}},properties:function(e,t,n){var o=n.callback;return o.drag=n.drag,o.proxy=n.proxy||n.drag,o.startX=t.pageX,o.startY=t.pageY,o.deltaX=e.pageX-t.pageX,o.deltaY=e.pageY-t.pageY,o.originalX=n.offset.left,o.originalY=n.offset.top,o.offsetX=o.originalX+o.deltaX,o.offsetY=o.originalY+o.deltaY,o.drop=i.flatten((n.drop||[]).slice()),o.available=i.flatten((n.droppable||[]).slice()),o},element:function(e){return e&&(e.jquery||1==e.nodeType)?e:void 0},flatten:function(t){return e.map(t,function(t){return t&&t.jquery?e.makeArray(t):t&&t.length?i.flatten(t):t})},textselect:function(t){e(document)[t?"unbind":"bind"]("selectstart",i.dontstart).css("MozUserSelect",t?"":"none"),document.unselectable=t?"off":"on"},dontstart:function(){return!1},callback:function(){}};i.callback.prototype={update:function(){n.drop&&this.available.length&&e.each(this.available,function(e){n.drop.locate(this,e)})}};var o=t.dispatch;t.dispatch=function(t){return e.data(this,"suppress."+t.type)-(new Date).getTime()>0?(e.removeData(this,"suppress."+t.type),void 0):o.apply(this,arguments)};var a=t.fixHooks.touchstart=t.fixHooks.touchmove=t.fixHooks.touchend=t.fixHooks.touchcancel={props:"clientX clientY pageX pageY screenX screenY".split(" "),filter:function(t,n){if(n){var i=n.touches&&n.touches[0]||n.changedTouches&&n.changedTouches[0]||null;i&&e.each(a.props,function(e,n){t[n]=i[n]})}return t}};n.draginit=n.dragstart=n.dragend=i}(jQuery),define("jquery.event.drag",["jquery"],function(){}),function(e){e.fn.drop=function(t,n,i){var o="string"==typeof t?t:"",a=e.isFunction(t)?t:e.isFunction(n)?n:null;return 0!==o.indexOf("drop")&&(o="drop"+o),i=(t==a?n:i)||{},a?this.bind(o,i,a):this.trigger(o)},e.drop=function(t){t=t||{},i.multi=t.multi===!0?1/0:t.multi===!1?1:isNaN(t.multi)?i.multi:t.multi,i.delay=t.delay||i.delay,i.tolerance=e.isFunction(t.tolerance)?t.tolerance:null===t.tolerance?null:i.tolerance,i.mode=t.mode||i.mode||"intersect"};var t=e.event,n=t.special,i=e.event.special.drop={multi:1,delay:20,mode:"overlap",targets:[],datakey:"dropdata",livekey:"livedrop",add:function(n){var o=e.data(this,i.datakey);o.related+=1,!o.live&&n.selector&&(o.live=!0,t.add(this,"dropinit."+i.livekey,i.delegate))},remove:function(){e.data(this,i.datakey).related-=1},setup:function(){e.data(this,i.datakey)||(e.data(this,i.datakey,{related:0,active:[],anyactive:0,winner:0,location:{}}),i.targets.push(this))},teardown:function(){if(!e.data(this,i.datakey).related){e.removeData(this,i.datakey),t.remove(this,"dropinit",i.delegate);var n=this;i.targets=e.grep(i.targets,function(e){return e!==n})}},handler:function(o,a){var s;if(a)switch(o.type){case"mousedown":s=e(i.targets),"string"==typeof a.drop&&(s=s.filter(a.drop)),s.each(function(){var t=e.data(this,i.datakey);t.active=[],t.anyactive=0,t.winner=0}),a.droppable=s,i.delegates=[],n.drag.hijack(o,"dropinit",a),i.delegates=e.unique(n.drag.flatten(i.delegates));break;case"mousemove":i.event=o,i.timer||i.tolerate(a);break;case"mouseup":i.timer=clearTimeout(i.timer),a.propagates&&(n.drag.hijack(o,"drop",a),n.drag.hijack(o,"dropend",a),e.each(i.delegates||[],function(){t.remove(this,"."+i.livekey)}))}},delegate:function(n){var o,a=[],s=e.data(this,"events")||{};return e.each(s.live||[],function(s,r){0===r.preType.indexOf("drop")&&(o=e(n.currentTarget).find(r.selector),o.length&&o.each(function(){t.add(this,r.origType+"."+i.livekey,r.origHandler,r.data),0>e.inArray(this,a)&&a.push(this)}))}),i.delegates.push(a),a.length?e(a):!1},locate:function(t,n){var o=e.data(t,i.datakey),a=e(t),s=a.offset()||{},r=a.outerHeight();return a=a.outerWidth(),s={elem:t,width:a,height:r,top:s.top,left:s.left,right:s.left+a,bottom:s.top+r},o&&(o.location=s,o.index=n,o.elem=t),s},contains:function(e,t){return(t[0]||t.left)>=e.left&&(t[0]||t.right)<=e.right&&(t[1]||t.top)>=e.top&&(t[1]||t.bottom)<=e.bottom},modes:{intersect:function(e,t,n){return this.contains(n,[e.pageX,e.pageY])?1e9:this.modes.overlap.apply(this,arguments)},overlap:function(e,t,n){return Math.max(0,Math.min(n.bottom,t.bottom)-Math.max(n.top,t.top))*Math.max(0,Math.min(n.right,t.right)-Math.max(n.left,t.left))},fit:function(e,t,n){return this.contains(n,t)?1:0},middle:function(e,t,n){return this.contains(n,[t.left+.5*t.width,t.top+.5*t.height])?1:0}},sort:function(e,t){return t.winner-e.winner||e.index-t.index},tolerate:function(t){var o,a,s,r,l,c,u,h=0,d=t.interactions.length,p=[i.event.pageX,i.event.pageY],f=i.tolerance||i.modes[i.mode];do if(u=t.interactions[h]){if(!u)return;u.drop=[],l=[],c=u.droppable.length,f&&(s=i.locate(u.proxy)),o=0;do(a=u.droppable[o])&&(r=e.data(a,i.datakey),(a=r.location)&&(r.winner=f?f.call(i,i.event,s,a):i.contains(a,p)?1:0,l.push(r)));while(c>++o);l.sort(i.sort),o=0;do(r=l[o])&&(r.winner&&u.drop.length<i.multi?(r.active[h]||r.anyactive||(n.drag.hijack(i.event,"dropstart",t,h,r.elem)[0]!==!1?(r.active[h]=1,r.anyactive+=1):r.winner=0),r.winner&&u.drop.push(r.elem)):r.active[h]&&1==r.anyactive&&(n.drag.hijack(i.event,"dropend",t,h,r.elem),r.active[h]=0,r.anyactive-=1));while(c>++o)}while(d>++h);i.last&&p[0]==i.last.pageX&&p[1]==i.last.pageY?delete i.timer:i.timer=setTimeout(function(){i.tolerate(t)},i.delay),i.last=i.event}};n.dropinit=n.dropstart=n.dropend=i}(jQuery),define("jquery.event.drop",["jquery"],function(){}),"undefined"==typeof jQuery)throw"SlickGrid requires jquery module to be loaded";if(!jQuery.fn.drag)throw"SlickGrid requires jquery.event.drag module to be loaded";if("undefined"==typeof Slick)throw"slick.core.js not loaded";(function($){function SlickGrid(container,data,columns,options){function init(){if($container=$(container),1>$container.length)throw Error("SlickGrid requires a valid container, "+container+" does not exist in the DOM.");maxSupportedCssHeight=maxSupportedCssHeight||getMaxSupportedCssHeight(),scrollbarDimensions=scrollbarDimensions||measureScrollbar(),options=$.extend({},defaults,options),validateAndEnforceOptions(),columnDefaults.width=options.defaultColumnWidth,columnsById={};for(var e=0;columns.length>e;e++){var t=columns[e]=$.extend({},columnDefaults,columns[e]);columnsById[t.id]=e,t.minWidth&&t.width<t.minWidth&&(t.width=t.minWidth),t.maxWidth&&t.width>t.maxWidth&&(t.width=t.maxWidth)}if(options.enableColumnReorder&&!$.fn.sortable)throw Error("SlickGrid's 'enableColumnReorder = true' option requires jquery-ui.sortable module to be loaded");editController={commitCurrentEdit:commitCurrentEdit,cancelCurrentEdit:cancelCurrentEdit},$container.empty().css("overflow","hidden").css("outline",0).addClass(uid).addClass("ui-widget"),/relative|absolute|fixed/.test($container.css("position"))||$container.css("position","relative"),$focusSink=$("<div tabIndex='0' hideFocus style='position:fixed;width:0;height:0;top:0;left:0;outline:0;'></div>").appendTo($container),$headerScroller=$("<div class='slick-header ui-state-default' style='overflow:hidden;position:relative;' />").appendTo($container),$headers=$("<div class='slick-header-columns' style='left:-1000px' />").appendTo($headerScroller),$headers.width(getHeadersWidth()),$headerRowScroller=$("<div class='slick-headerrow ui-state-default' style='overflow:hidden;position:relative;' />").appendTo($container),$headerRow=$("<div class='slick-headerrow-columns' />").appendTo($headerRowScroller),$headerRowSpacer=$("<div style='display:block;height:1px;position:absolute;top:0;left:0;'></div>").css("width",getCanvasWidth()+scrollbarDimensions.width+"px").appendTo($headerRowScroller),$topPanelScroller=$("<div class='slick-top-panel-scroller ui-state-default' style='overflow:hidden;position:relative;' />").appendTo($container),$topPanel=$("<div class='slick-top-panel' style='width:10000px' />").appendTo($topPanelScroller),options.showTopPanel||$topPanelScroller.hide(),options.showHeaderRow||$headerRowScroller.hide(),$viewport=$("<div class='slick-viewport' style='width:100%;overflow:auto;outline:0;position:relative;;'>").appendTo($container),$viewport.css("overflow-y",options.autoHeight?"hidden":"auto"),$canvas=$("<div class='grid-canvas' />").appendTo($viewport),$focusSink2=$focusSink.clone().appendTo($container),options.explicitInitialization||finishInitialization()}function finishInitialization(){initialized||(initialized=!0,viewportW=parseFloat($.css($container[0],"width",!0)),measureCellPaddingAndBorder(),disableSelection($headers),options.enableTextSelectionOnCells||$viewport.bind("selectstart.ui",function(e){return $(e.target).is("input,textarea")}),updateColumnCaches(),createColumnHeaders(),setupColumnSort(),createCssRules(),resizeCanvas(),bindAncestorScrollEvents(),$container.bind("resize.slickgrid",resizeCanvas),$viewport.bind("scroll",handleScroll),$headerScroller.bind("contextmenu",handleHeaderContextMenu).bind("click",handleHeaderClick).delegate(".slick-header-column","mouseenter",handleHeaderMouseEnter).delegate(".slick-header-column","mouseleave",handleHeaderMouseLeave),$headerRowScroller.bind("scroll",handleHeaderRowScroll),$focusSink.add($focusSink2).bind("keydown",handleKeyDown),$canvas.bind("keydown",handleKeyDown).bind("click",handleClick).bind("dblclick",handleDblClick).bind("contextmenu",handleContextMenu).bind("draginit",handleDragInit).bind("dragstart",{distance:3},handleDragStart).bind("drag",handleDrag).bind("dragend",handleDragEnd).delegate(".slick-cell","mouseenter",handleMouseEnter).delegate(".slick-cell","mouseleave",handleMouseLeave))}function registerPlugin(e){plugins.unshift(e),e.init(self)}function unregisterPlugin(e){for(var t=plugins.length;t>=0;t--)if(plugins[t]===e){plugins[t].destroy&&plugins[t].destroy(),plugins.splice(t,1);break}}function setSelectionModel(e){selectionModel&&(selectionModel.onSelectedRangesChanged.unsubscribe(handleSelectedRangesChanged),selectionModel.destroy&&selectionModel.destroy()),selectionModel=e,selectionModel&&(selectionModel.init(self),selectionModel.onSelectedRangesChanged.subscribe(handleSelectedRangesChanged))}function getSelectionModel(){return selectionModel}function getCanvasNode(){return $canvas[0]}function measureScrollbar(){var e=$("<div style='position:absolute; top:-10000px; left:-10000px; width:100px; height:100px; overflow:scroll;'></div>").appendTo("body"),t={width:e.width()-e[0].clientWidth,height:e.height()-e[0].clientHeight};return e.remove(),t}function getHeadersWidth(){for(var e=0,t=0,n=columns.length;n>t;t++){var i=columns[t].width;e+=i}return e+=scrollbarDimensions.width,Math.max(e,viewportW)+1e3}function getCanvasWidth(){for(var e=viewportHasVScroll?viewportW-scrollbarDimensions.width:viewportW,t=0,n=columns.length;n--;)t+=columns[n].width;return options.fullWidthRows?Math.max(t,e):t}function updateCanvasWidth(e){var t=canvasWidth;canvasWidth=getCanvasWidth(),canvasWidth!=t&&($canvas.width(canvasWidth),$headerRow.width(canvasWidth),$headers.width(getHeadersWidth()),viewportHasHScroll=canvasWidth>viewportW-scrollbarDimensions.width),$headerRowSpacer.width(canvasWidth+(viewportHasVScroll?scrollbarDimensions.width:0)),(canvasWidth!=t||e)&&applyColumnWidths()}function disableSelection(e){e&&e.jquery&&e.attr("unselectable","on").css("MozUserSelect","none").bind("selectstart.ui",function(){return!1})}function getMaxSupportedCssHeight(){for(var e=1e6,t=navigator.userAgent.toLowerCase().match(/firefox/)?6e6:1e9,n=$("<div style='display:none' />").appendTo(document.body);;){var i=2*e;if(n.css("height",i),i>t||n.height()!==i)break;e=i}return n.remove(),e}function bindAncestorScrollEvents(){for(var e=$canvas[0];(e=e.parentNode)!=document.body&&null!=e;)if(e==$viewport[0]||e.scrollWidth!=e.clientWidth||e.scrollHeight!=e.clientHeight){var t=$(e);$boundAncestors=$boundAncestors?$boundAncestors.add(t):t,t.bind("scroll."+uid,handleActiveCellPositionChange)}}function unbindAncestorScrollEvents(){$boundAncestors&&($boundAncestors.unbind("scroll."+uid),$boundAncestors=null)
}function updateColumnHeader(e,t,n){if(initialized){var i=getColumnIndex(e);if(null!=i){var o=columns[i],a=$headers.children().eq(i);a&&(void 0!==t&&(columns[i].name=t),void 0!==n&&(columns[i].toolTip=n),trigger(self.onBeforeHeaderCellDestroy,{node:a[0],column:o}),a.attr("title",n||"").children().eq(0).html(t),trigger(self.onHeaderCellRendered,{node:a[0],column:o}))}}}function getHeaderRow(){return $headerRow[0]}function getHeaderRowColumn(e){var t=getColumnIndex(e),n=$headerRow.children().eq(t);return n&&n[0]}function createColumnHeaders(){function e(){$(this).addClass("ui-state-hover")}function t(){$(this).removeClass("ui-state-hover")}$headers.find(".slick-header-column").each(function(){var e=$(this).data("column");e&&trigger(self.onBeforeHeaderCellDestroy,{node:this,column:e})}),$headers.empty(),$headers.width(getHeadersWidth()),$headerRow.find(".slick-headerrow-column").each(function(){var e=$(this).data("column");e&&trigger(self.onBeforeHeaderRowCellDestroy,{node:this,column:e})}),$headerRow.empty();for(var n=0;columns.length>n;n++){var i=columns[n],o=$("<div class='ui-state-default slick-header-column' id='"+uid+i.id+"' />").html("<span class='slick-column-name'>"+i.name+"</span>").width(i.width-headerColumnWidthDiff).attr("title",i.toolTip||"").data("column",i).addClass(i.headerCssClass||"").appendTo($headers);if((options.enableColumnReorder||i.sortable)&&o.on("mouseenter",e).on("mouseleave",t),i.sortable&&(o.addClass("slick-header-sortable"),o.append("<span class='slick-sort-indicator' />")),trigger(self.onHeaderCellRendered,{node:o[0],column:i}),options.showHeaderRow){var a=$("<div class='ui-state-default slick-headerrow-column l"+n+" r"+n+"'></div>").data("column",i).appendTo($headerRow);trigger(self.onHeaderRowCellRendered,{node:a[0],column:i})}}setSortColumns(sortColumns),setupColumnResize(),options.enableColumnReorder&&setupColumnReorder()}function setupColumnSort(){$headers.click(function(e){if(e.metaKey=e.metaKey||e.ctrlKey,!$(e.target).hasClass("slick-resizable-handle")){var t=$(e.target).closest(".slick-header-column");if(t.length){var n=t.data("column");if(n.sortable){if(!getEditorLock().commitCurrentEdit())return;for(var i=null,o=0;sortColumns.length>o;o++)if(sortColumns[o].columnId==n.id){i=sortColumns[o],i.sortAsc=!i.sortAsc;break}e.metaKey&&options.multiColumnSort?i&&sortColumns.splice(o,1):((e.shiftKey||e.metaKey)&&options.multiColumnSort||(sortColumns=[]),i?0==sortColumns.length&&sortColumns.push(i):(i={columnId:n.id,sortAsc:n.defaultSortAsc},sortColumns.push(i))),setSortColumns(sortColumns),options.multiColumnSort?trigger(self.onSort,{multiColumnSort:!0,sortCols:$.map(sortColumns,function(e){return{sortCol:columns[getColumnIndex(e.columnId)],sortAsc:e.sortAsc}})},e):trigger(self.onSort,{multiColumnSort:!1,sortCol:n,sortAsc:i.sortAsc},e)}}}})}function setupColumnReorder(){$headers.filter(":ui-sortable").sortable("destroy"),$headers.sortable({containment:"parent",distance:3,axis:"x",cursor:"default",tolerance:"intersection",helper:"clone",placeholder:"slick-sortable-placeholder ui-state-default slick-header-column",forcePlaceholderSize:!0,start:function(e,t){$(t.helper).addClass("slick-header-column-active")},beforeStop:function(e,t){$(t.helper).removeClass("slick-header-column-active")},stop:function(e){if(!getEditorLock().commitCurrentEdit())return $(this).sortable("cancel"),void 0;for(var t=$headers.sortable("toArray"),n=[],i=0;t.length>i;i++)n.push(columns[getColumnIndex(t[i].replace(uid,""))]);setColumns(n),trigger(self.onColumnsReordered,{}),e.stopPropagation(),setupColumnResize()}})}function setupColumnResize(){var e,t,n,i,o,a,s,r,l;o=$headers.children(),o.find(".slick-resizable-handle").remove(),o.each(function(e){columns[e].resizable&&(void 0===r&&(r=e),l=e)}),void 0!==r&&o.each(function(c,u){r>c||options.forceFitColumns&&c>=l||(e=$(u),$("<div class='slick-resizable-handle' />").appendTo(u).bind("dragstart",function(e){if(!getEditorLock().commitCurrentEdit())return!1;i=e.pageX,$(this).parent().addClass("slick-header-column-active");var r=null,l=null;if(o.each(function(e,t){columns[e].previousWidth=$(t).outerWidth()}),options.forceFitColumns)for(r=0,l=0,t=c+1;o.length>t;t++)n=columns[t],n.resizable&&(null!==l&&(n.maxWidth?l+=n.maxWidth-n.previousWidth:l=null),r+=n.previousWidth-Math.max(n.minWidth||0,absoluteColumnMinWidth));var u=0,h=0;for(t=0;c>=t;t++)n=columns[t],n.resizable&&(null!==h&&(n.maxWidth?h+=n.maxWidth-n.previousWidth:h=null),u+=n.previousWidth-Math.max(n.minWidth||0,absoluteColumnMinWidth));null===r&&(r=1e5),null===u&&(u=1e5),null===l&&(l=1e5),null===h&&(h=1e5),s=i+Math.min(r,h),a=i-Math.min(u,l)}).bind("drag",function(e){var r,l,u=Math.min(s,Math.max(a,e.pageX))-i;if(0>u){for(l=u,t=c;t>=0;t--)n=columns[t],n.resizable&&(r=Math.max(n.minWidth||0,absoluteColumnMinWidth),l&&r>n.previousWidth+l?(l+=n.previousWidth-r,n.width=r):(n.width=n.previousWidth+l,l=0));if(options.forceFitColumns)for(l=-u,t=c+1;o.length>t;t++)n=columns[t],n.resizable&&(l&&n.maxWidth&&l>n.maxWidth-n.previousWidth?(l-=n.maxWidth-n.previousWidth,n.width=n.maxWidth):(n.width=n.previousWidth+l,l=0))}else{for(l=u,t=c;t>=0;t--)n=columns[t],n.resizable&&(l&&n.maxWidth&&l>n.maxWidth-n.previousWidth?(l-=n.maxWidth-n.previousWidth,n.width=n.maxWidth):(n.width=n.previousWidth+l,l=0));if(options.forceFitColumns)for(l=-u,t=c+1;o.length>t;t++)n=columns[t],n.resizable&&(r=Math.max(n.minWidth||0,absoluteColumnMinWidth),l&&r>n.previousWidth+l?(l+=n.previousWidth-r,n.width=r):(n.width=n.previousWidth+l,l=0))}applyColumnHeaderWidths(),options.syncColumnCellResize&&applyColumnWidths()}).bind("dragend",function(){var e;for($(this).parent().removeClass("slick-header-column-active"),t=0;o.length>t;t++)n=columns[t],e=$(o[t]).outerWidth(),n.previousWidth!==e&&n.rerenderOnResize&&invalidateAllRows();updateCanvasWidth(!0),render(),trigger(self.onColumnsResized,{})}))})}function getVBoxDelta(e){var t=["borderTopWidth","borderBottomWidth","paddingTop","paddingBottom"],n=0;return $.each(t,function(t,i){n+=parseFloat(e.css(i))||0}),n}function measureCellPaddingAndBorder(){var e,t=["borderLeftWidth","borderRightWidth","paddingLeft","paddingRight"],n=["borderTopWidth","borderBottomWidth","paddingTop","paddingBottom"];e=$("<div class='ui-state-default slick-header-column' style='visibility:hidden'>-</div>").appendTo($headers),headerColumnWidthDiff=headerColumnHeightDiff=0,$.each(t,function(t,n){headerColumnWidthDiff+=parseFloat(e.css(n))||0}),$.each(n,function(t,n){headerColumnHeightDiff+=parseFloat(e.css(n))||0}),e.remove();var i=$("<div class='slick-row' />").appendTo($canvas);e=$("<div class='slick-cell' id='' style='visibility:hidden'>-</div>").appendTo(i),cellWidthDiff=cellHeightDiff=0,$.each(t,function(t,n){cellWidthDiff+=parseFloat(e.css(n))||0}),$.each(n,function(t,n){cellHeightDiff+=parseFloat(e.css(n))||0}),i.remove(),absoluteColumnMinWidth=Math.max(headerColumnWidthDiff,cellWidthDiff)}function createCssRules(){$style=$("<style type='text/css' rel='stylesheet' />").appendTo($("head"));for(var e=options.rowHeight-cellHeightDiff,t=["."+uid+" .slick-header-column { left: 1000px; }","."+uid+" .slick-top-panel { height:"+options.topPanelHeight+"px; }","."+uid+" .slick-headerrow-columns { height:"+options.headerRowHeight+"px; }","."+uid+" .slick-cell { height:"+e+"px; }","."+uid+" .slick-row { height:"+options.rowHeight+"px; }"],n=0;columns.length>n;n++)t.push("."+uid+" .l"+n+" { }"),t.push("."+uid+" .r"+n+" { }");$style[0].styleSheet?$style[0].styleSheet.cssText=t.join(" "):$style[0].appendChild(document.createTextNode(t.join(" ")))}function getColumnCssRules(e){if(!stylesheet){for(var t=document.styleSheets,n=0;t.length>n;n++)if((t[n].ownerNode||t[n].owningElement)==$style[0]){stylesheet=t[n];break}if(!stylesheet)throw Error("Cannot find stylesheet.");columnCssRulesL=[],columnCssRulesR=[];for(var i,o,a=stylesheet.cssRules||stylesheet.rules,n=0;a.length>n;n++){var s=a[n].selectorText;(i=/\.l\d+/.exec(s))?(o=parseInt(i[0].substr(2,i[0].length-2),10),columnCssRulesL[o]=a[n]):(i=/\.r\d+/.exec(s))&&(o=parseInt(i[0].substr(2,i[0].length-2),10),columnCssRulesR[o]=a[n])}}return{left:columnCssRulesL[e],right:columnCssRulesR[e]}}function removeCssRules(){$style.remove(),stylesheet=null}function destroy(){getEditorLock().cancelCurrentEdit(),trigger(self.onBeforeDestroy,{});for(var e=plugins.length;e--;)unregisterPlugin(plugins[e]);options.enableColumnReorder&&$headers.sortable&&$headers.sortable("destroy"),unbindAncestorScrollEvents(),$container.unbind(".slickgrid"),removeCssRules(),$canvas.unbind("draginit dragstart dragend drag"),$container.empty().removeClass(uid)}function trigger(e,t,n){return n=n||new Slick.EventData,t=t||{},t.grid=self,e.notify(t,n,self)}function getEditorLock(){return options.editorLock}function getEditController(){return editController}function getColumnIndex(e){return columnsById[e]}function autosizeColumns(){var e,t,n,i=[],o=0,a=0,s=viewportHasVScroll?viewportW-scrollbarDimensions.width:viewportW;for(e=0;columns.length>e;e++)t=columns[e],i.push(t.width),a+=t.width,t.resizable&&(o+=t.width-Math.max(t.minWidth,absoluteColumnMinWidth));for(n=a;a>s&&o;){var r=(a-s)/o;for(e=0;columns.length>e&&a>s;e++){t=columns[e];var l=i[e];if(!(!t.resizable||t.minWidth>=l||absoluteColumnMinWidth>=l)){var c=Math.max(t.minWidth,absoluteColumnMinWidth),u=Math.floor(r*(l-c))||1;u=Math.min(u,l-c),a-=u,o-=u,i[e]-=u}}if(n==a)break;n=a}for(n=a;s>a;){var h=s/a;for(e=0;columns.length>e&&s>a;e++)if(t=columns[e],t.resizable&&!(t.maxWidth<=t.width)){var d=Math.min(Math.floor(h*t.width)-t.width,t.maxWidth-t.width||1e6)||1;a+=d,i[e]+=d}if(n==a)break;n=a}var p=!1;for(e=0;columns.length>e;e++)columns[e].rerenderOnResize&&columns[e].width!=i[e]&&(p=!0),columns[e].width=i[e];applyColumnHeaderWidths(),updateCanvasWidth(!0),p&&(invalidateAllRows(),render())}function applyColumnHeaderWidths(){if(initialized){for(var e,t=0,n=$headers.children(),i=n.length;i>t;t++)e=$(n[t]),e.width()!==columns[t].width-headerColumnWidthDiff&&e.width(columns[t].width-headerColumnWidthDiff);updateColumnCaches()}}function applyColumnWidths(){for(var e,t,n=0,i=0;columns.length>i;i++)e=columns[i].width,t=getColumnCssRules(i),t.left.style.left=n+"px",t.right.style.right=canvasWidth-n-e+"px",n+=columns[i].width}function setSortColumn(e,t){setSortColumns([{columnId:e,sortAsc:t}])}function setSortColumns(e){sortColumns=e;var t=$headers.children();t.removeClass("slick-header-column-sorted").find(".slick-sort-indicator").removeClass("slick-sort-indicator-asc slick-sort-indicator-desc"),$.each(sortColumns,function(e,n){null==n.sortAsc&&(n.sortAsc=!0);var i=getColumnIndex(n.columnId);null!=i&&t.eq(i).addClass("slick-header-column-sorted").find(".slick-sort-indicator").addClass(n.sortAsc?"slick-sort-indicator-asc":"slick-sort-indicator-desc")})}function getSortColumns(){return sortColumns}function handleSelectedRangesChanged(e,t){selectedRows=[];for(var n={},i=0;t.length>i;i++)for(var o=t[i].fromRow;t[i].toRow>=o;o++){n[o]||(selectedRows.push(o),n[o]={});for(var a=t[i].fromCell;t[i].toCell>=a;a++)canCellBeSelected(o,a)&&(n[o][columns[a].id]=options.selectedCellCssClass)}setCellCssStyles(options.selectedCellCssClass,n),trigger(self.onSelectedRowsChanged,{rows:getSelectedRows()},e)}function getColumns(){return columns}function updateColumnCaches(){columnPosLeft=[],columnPosRight=[];for(var e=0,t=0,n=columns.length;n>t;t++)columnPosLeft[t]=e,columnPosRight[t]=e+columns[t].width,e+=columns[t].width}function setColumns(e){columns=e,columnsById={};for(var t=0;columns.length>t;t++){var n=columns[t]=$.extend({},columnDefaults,columns[t]);columnsById[n.id]=t,n.minWidth&&n.width<n.minWidth&&(n.width=n.minWidth),n.maxWidth&&n.width>n.maxWidth&&(n.width=n.maxWidth)}updateColumnCaches(),initialized&&(invalidateAllRows(),createColumnHeaders(),removeCssRules(),createCssRules(),resizeCanvas(),applyColumnWidths(),handleScroll())}function getOptions(){return options}function setOptions(e){getEditorLock().commitCurrentEdit()&&(makeActiveCellNormal(),options.enableAddRow!==e.enableAddRow&&invalidateRow(getDataLength()),options=$.extend(options,e),validateAndEnforceOptions(),$viewport.css("overflow-y",options.autoHeight?"hidden":"auto"),render())}function validateAndEnforceOptions(){options.autoHeight&&(options.leaveSpaceForNewRows=!1)}function setData(e,t){data=e,invalidateAllRows(),updateRowCount(),t&&scrollTo(0)}function getData(){return data}function getDataLength(){return data.getLength?data.getLength():data.length}function getDataItem(e){return data.getItem?data.getItem(e):data[e]}function getTopPanel(){return $topPanel[0]}function setTopPanelVisibility(e){options.showTopPanel!=e&&(options.showTopPanel=e,e?$topPanelScroller.slideDown("fast",resizeCanvas):$topPanelScroller.slideUp("fast",resizeCanvas))}function setHeaderRowVisibility(e){options.showHeaderRow!=e&&(options.showHeaderRow=e,e?$headerRowScroller.slideDown("fast",resizeCanvas):$headerRowScroller.slideUp("fast",resizeCanvas))}function scrollTo(e){e=Math.max(e,0),e=Math.min(e,th-viewportH+(viewportHasHScroll?scrollbarDimensions.height:0));var t=offset;page=Math.min(n-1,Math.floor(e/ph)),offset=Math.round(page*cj);var i=e-offset;if(offset!=t){var o=getVisibleRange(i);cleanupRows(o),updateRowPositions()}prevScrollTop!=i&&(vScrollDir=i+offset>prevScrollTop+t?1:-1,$viewport[0].scrollTop=lastRenderedScrollTop=scrollTop=prevScrollTop=i,trigger(self.onViewportChanged,{}))}function defaultFormatter(e,t,n){return null==n?"":(""+n).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function getFormatter(e,t){var n=data.getItemMetadata&&data.getItemMetadata(e),i=n&&n.columns&&(n.columns[t.id]||n.columns[getColumnIndex(t.id)]);return i&&i.formatter||n&&n.formatter||t.formatter||options.formatterFactory&&options.formatterFactory.getFormatter(t)||options.defaultFormatter}function getEditor(e,t){var n=columns[t],i=data.getItemMetadata&&data.getItemMetadata(e),o=i&&i.columns;return o&&o[n.id]&&void 0!==o[n.id].editor?o[n.id].editor:o&&o[t]&&void 0!==o[t].editor?o[t].editor:n.editor||options.editorFactory&&options.editorFactory.getEditor(n)}function getDataItemValueForColumn(e,t){return options.dataItemColumnValueExtractor?options.dataItemColumnValueExtractor(e,t):e[t.field]}function appendRowHtml(e,t,n){var i=getDataItem(t),o=getDataLength()>t&&!i,a="slick-row"+(o?" loading":"")+(t===activeRow?" active":"")+(1==t%2?" odd":" even"),s=data.getItemMetadata&&data.getItemMetadata(t);s&&s.cssClasses&&(a+=" "+s.cssClasses),e.push("<div class='ui-widget-content "+a+"' style='top:"+(options.rowHeight*t-offset)+"px'>");for(var r,l,c=0,u=columns.length;u>c;c++){if(l=columns[c],r=1,s&&s.columns){var h=s.columns[l.id]||s.columns[c];r=h&&h.colspan||1,"*"===r&&(r=u-c)}if(columnPosRight[Math.min(u-1,c+r-1)]>n.leftPx){if(columnPosLeft[c]>n.rightPx)break;appendCellHtml(e,t,c,r)}r>1&&(c+=r-1)}e.push("</div>")}function appendCellHtml(e,t,n,i){var o=columns[n],a=getDataItem(t),s="slick-cell l"+n+" r"+Math.min(columns.length-1,n+i-1)+(o.cssClass?" "+o.cssClass:"");t===activeRow&&n===activeCell&&(s+=" active");for(var r in cellCssClasses)cellCssClasses[r][t]&&cellCssClasses[r][t][o.id]&&(s+=" "+cellCssClasses[r][t][o.id]);if(e.push("<div class='"+s+"'>"),a){var l=getDataItemValueForColumn(a,o);e.push(getFormatter(t,o)(t,n,l,o,a))}e.push("</div>"),rowsCache[t].cellRenderQueue.push(n),rowsCache[t].cellColSpans[n]=i}function cleanupRows(e){for(var t in rowsCache)(t=parseInt(t,10))!==activeRow&&(e.top>t||t>e.bottom)&&removeRowFromCache(t)}function invalidate(){updateRowCount(),invalidateAllRows(),render()}function invalidateAllRows(){currentEditor&&makeActiveCellNormal();for(var e in rowsCache)removeRowFromCache(e)}function removeRowFromCache(e){var t=rowsCache[e];t&&($canvas[0].removeChild(t.rowNode),delete rowsCache[e],delete postProcessedRows[e],renderedRows--,counter_rows_removed++)}function invalidateRows(e){var t,n;if(e&&e.length)for(vScrollDir=0,t=0,n=e.length;n>t;t++)currentEditor&&activeRow===e[t]&&makeActiveCellNormal(),rowsCache[e[t]]&&removeRowFromCache(e[t])}function invalidateRow(e){invalidateRows([e])}function updateCell(e,t){var n=getCellNode(e,t);if(n){var i=columns[t],o=getDataItem(e);currentEditor&&activeRow===e&&activeCell===t?currentEditor.loadValue(o):(n.innerHTML=o?getFormatter(e,i)(e,t,getDataItemValueForColumn(o,i),i,o):"",invalidatePostProcessingResults(e))}}function updateRow(e){var t=rowsCache[e];if(t){ensureCellNodesInRowsCache(e);for(var n in t.cellNodesByColumnIdx)if(t.cellNodesByColumnIdx.hasOwnProperty(n)){n=0|n;var i=columns[n],o=getDataItem(e),a=t.cellNodesByColumnIdx[n];e===activeRow&&n===activeCell&&currentEditor?currentEditor.loadValue(o):a.innerHTML=o?getFormatter(e,i)(e,n,getDataItemValueForColumn(o,i),i,o):""}invalidatePostProcessingResults(e)}}function getViewportHeight(){return parseFloat($.css($container[0],"height",!0))-parseFloat($.css($container[0],"paddingTop",!0))-parseFloat($.css($container[0],"paddingBottom",!0))-parseFloat($.css($headerScroller[0],"height"))-getVBoxDelta($headerScroller)-(options.showTopPanel?options.topPanelHeight+getVBoxDelta($topPanelScroller):0)-(options.showHeaderRow?options.headerRowHeight+getVBoxDelta($headerRowScroller):0)}function resizeCanvas(){initialized&&(viewportH=options.autoHeight?options.rowHeight*(getDataLength()+(options.enableAddRow?1:0)):getViewportHeight(),numVisibleRows=Math.ceil(viewportH/options.rowHeight),viewportW=parseFloat($.css($container[0],"width",!0)),options.autoHeight||$viewport.height(viewportH),options.forceFitColumns&&autosizeColumns(),updateRowCount(),handleScroll(),render())}function updateRowCount(){if(initialized){numberOfRows=getDataLength()+(options.enableAddRow?1:0)+(options.leaveSpaceForNewRows?numVisibleRows-1:0);var e=viewportHasVScroll;viewportHasVScroll=!options.autoHeight&&numberOfRows*options.rowHeight>viewportH;var t=options.enableAddRow?getDataLength():getDataLength()-1;for(var i in rowsCache)i>=t&&removeRowFromCache(i);activeCellNode&&activeRow>t&&resetActiveCell();var o=h;th=Math.max(options.rowHeight*numberOfRows,viewportH-scrollbarDimensions.height),maxSupportedCssHeight>th?(h=ph=th,n=1,cj=0):(h=maxSupportedCssHeight,ph=h/100,n=Math.floor(th/ph),cj=(th-h)/(n-1)),h!==o&&($canvas.css("height",h),scrollTop=$viewport[0].scrollTop);var a=th-viewportH>=scrollTop+offset;0==th||0==scrollTop?page=offset=0:a?scrollTo(scrollTop+offset):scrollTo(th-viewportH),h!=o&&options.autoHeight&&resizeCanvas(),options.forceFitColumns&&e!=viewportHasVScroll&&autosizeColumns(),updateCanvasWidth(!1)}}function getVisibleRange(e,t){return null==e&&(e=scrollTop),null==t&&(t=scrollLeft),{top:Math.floor((e+offset)/options.rowHeight),bottom:Math.ceil((e+offset+viewportH)/options.rowHeight),leftPx:t,rightPx:t+viewportW}}function getRenderedRange(e,t){var n=getVisibleRange(e,t),i=Math.round(viewportH/options.rowHeight),o=3;return-1==vScrollDir?(n.top-=i,n.bottom+=o):1==vScrollDir?(n.top-=o,n.bottom+=i):(n.top-=o,n.bottom+=o),n.top=Math.max(0,n.top),n.bottom=Math.min(options.enableAddRow?getDataLength():getDataLength()-1,n.bottom),n.leftPx-=viewportW,n.rightPx+=viewportW,n.leftPx=Math.max(0,n.leftPx),n.rightPx=Math.min(canvasWidth,n.rightPx),n}function ensureCellNodesInRowsCache(e){var t=rowsCache[e];if(t&&t.cellRenderQueue.length)for(var n=t.rowNode.lastChild;t.cellRenderQueue.length;){var i=t.cellRenderQueue.pop();t.cellNodesByColumnIdx[i]=n,n=n.previousSibling}}function cleanUpCells(e,t){var n=0,i=rowsCache[t],o=[];for(var a in i.cellNodesByColumnIdx)if(i.cellNodesByColumnIdx.hasOwnProperty(a)){a=0|a;var s=i.cellColSpans[a];(columnPosLeft[a]>e.rightPx||columnPosRight[Math.min(columns.length-1,a+s-1)]<e.leftPx)&&(t!=activeRow||a!=activeCell)&&o.push(a)}for(var r;null!=(r=o.pop());)i.rowNode.removeChild(i.cellNodesByColumnIdx[r]),delete i.cellColSpans[r],delete i.cellNodesByColumnIdx[r],postProcessedRows[t]&&delete postProcessedRows[t][r],n++}function cleanUpAndRenderCells(e){for(var t,n,i,o=[],a=[],s=0,r=e.top;e.bottom>=r;r++)if(t=rowsCache[r]){ensureCellNodesInRowsCache(r),cleanUpCells(e,r),n=0;var l=data.getItemMetadata&&data.getItemMetadata(r);l=l&&l.columns;for(var c=0,u=columns.length;u>c&&!(columnPosLeft[c]>e.rightPx);c++)if(null==(i=t.cellColSpans[c])){if(i=1,l){var h=l[columns[c].id]||l[c];i=h&&h.colspan||1,"*"===i&&(i=u-c)}columnPosRight[Math.min(u-1,c+i-1)]>e.leftPx&&(appendCellHtml(o,r,c,i),n++),c+=i>1?i-1:0}else c+=i>1?i-1:0;n&&(s+=n,a.push(r))}if(o.length){var d=document.createElement("div");d.innerHTML=o.join("");for(var p,f;null!=(p=a.pop());){t=rowsCache[p];for(var m;null!=(m=t.cellRenderQueue.pop());)f=d.lastChild,t.rowNode.appendChild(f),t.cellNodesByColumnIdx[m]=f}}}function renderRows(e){for(var t=$canvas[0],n=[],i=[],o=!1,a=e.top;e.bottom>=a;a++)rowsCache[a]||(renderedRows++,i.push(a),rowsCache[a]={rowNode:null,cellColSpans:[],cellNodesByColumnIdx:[],cellRenderQueue:[]},appendRowHtml(n,a,e),activeCellNode&&activeRow===a&&(o=!0),counter_rows_rendered++);if(i.length){var s=document.createElement("div");s.innerHTML=n.join("");for(var a=0,r=i.length;r>a;a++)rowsCache[i[a]].rowNode=t.appendChild(s.firstChild);o&&(activeCellNode=getCellNode(activeRow,activeCell))}}function startPostProcessing(){options.enableAsyncPostRender&&(clearTimeout(h_postrender),h_postrender=setTimeout(asyncPostProcessRows,options.asyncPostRenderDelay))}function invalidatePostProcessingResults(e){delete postProcessedRows[e],postProcessFromRow=Math.min(postProcessFromRow,e),postProcessToRow=Math.max(postProcessToRow,e),startPostProcessing()}function updateRowPositions(){for(var e in rowsCache)rowsCache[e].rowNode.style.top=e*options.rowHeight-offset+"px"}function render(){if(initialized){var e=getVisibleRange(),t=getRenderedRange();cleanupRows(t),lastRenderedScrollLeft!=scrollLeft&&cleanUpAndRenderCells(t),renderRows(t),postProcessFromRow=e.top,postProcessToRow=Math.min(options.enableAddRow?getDataLength():getDataLength()-1,e.bottom),startPostProcessing(),lastRenderedScrollTop=scrollTop,lastRenderedScrollLeft=scrollLeft,h_render=null}}function handleHeaderRowScroll(){var e=$headerRowScroller[0].scrollLeft;e!=$viewport[0].scrollLeft&&($viewport[0].scrollLeft=e)}function handleScroll(){scrollTop=$viewport[0].scrollTop,scrollLeft=$viewport[0].scrollLeft;var e=Math.abs(scrollTop-prevScrollTop),t=Math.abs(scrollLeft-prevScrollLeft);if(t&&(prevScrollLeft=scrollLeft,$headerScroller[0].scrollLeft=scrollLeft,$topPanelScroller[0].scrollLeft=scrollLeft,$headerRowScroller[0].scrollLeft=scrollLeft),e)if(vScrollDir=scrollTop>prevScrollTop?1:-1,prevScrollTop=scrollTop,viewportH>e)scrollTo(scrollTop+offset);else{var i=offset;page=h==viewportH?0:Math.min(n-1,Math.floor(scrollTop*((th-viewportH)/(h-viewportH))*(1/ph))),offset=Math.round(page*cj),i!=offset&&invalidateAllRows()}(t||e)&&(h_render&&clearTimeout(h_render),(Math.abs(lastRenderedScrollTop-scrollTop)>20||Math.abs(lastRenderedScrollLeft-scrollLeft)>20)&&(options.forceSyncScrolling||viewportH>Math.abs(lastRenderedScrollTop-scrollTop)&&viewportW>Math.abs(lastRenderedScrollLeft-scrollLeft)?render():h_render=setTimeout(render,50),trigger(self.onViewportChanged,{}))),trigger(self.onScroll,{scrollLeft:scrollLeft,scrollTop:scrollTop})}function asyncPostProcessRows(){for(;postProcessToRow>=postProcessFromRow;){var e=vScrollDir>=0?postProcessFromRow++:postProcessToRow--,t=rowsCache[e];if(t&&!(e>=getDataLength())){postProcessedRows[e]||(postProcessedRows[e]={}),ensureCellNodesInRowsCache(e);for(var n in t.cellNodesByColumnIdx)if(t.cellNodesByColumnIdx.hasOwnProperty(n)){n=0|n;var i=columns[n];if(i.asyncPostRender&&!postProcessedRows[e][n]){var o=t.cellNodesByColumnIdx[n];o&&i.asyncPostRender(o,e,getDataItem(e),i),postProcessedRows[e][n]=!0}}return h_postrender=setTimeout(asyncPostProcessRows,options.asyncPostRenderDelay),void 0}}}function updateCellCssStylesOnRenderedRows(e,t){var n,i,o,a;for(var s in rowsCache){if(a=t&&t[s],o=e&&e[s],a)for(i in a)o&&a[i]==o[i]||(n=getCellNode(s,getColumnIndex(i)),n&&$(n).removeClass(a[i]));if(o)for(i in o)a&&a[i]==o[i]||(n=getCellNode(s,getColumnIndex(i)),n&&$(n).addClass(o[i]))}}function addCellCssStyles(e,t){if(cellCssClasses[e])throw"addCellCssStyles: cell CSS hash with key '"+e+"' already exists.";cellCssClasses[e]=t,updateCellCssStylesOnRenderedRows(t,null),trigger(self.onCellCssStylesChanged,{key:e,hash:t})}function removeCellCssStyles(e){cellCssClasses[e]&&(updateCellCssStylesOnRenderedRows(null,cellCssClasses[e]),delete cellCssClasses[e],trigger(self.onCellCssStylesChanged,{key:e,hash:null}))}function setCellCssStyles(e,t){var n=cellCssClasses[e];cellCssClasses[e]=t,updateCellCssStylesOnRenderedRows(t,n),trigger(self.onCellCssStylesChanged,{key:e,hash:t})}function getCellCssStyles(e){return cellCssClasses[e]}function flashCell(e,t,n){function i(e){e&&setTimeout(function(){o.queue(function(){o.toggleClass(options.cellFlashingCssClass).dequeue(),i(e-1)})},n)}if(n=n||100,rowsCache[e]){var o=$(getCellNode(e,t));i(4)}}function handleDragInit(e,t){var n=getCellFromEvent(e);return n&&cellExists(n.row,n.cell)?(retval=trigger(self.onDragInit,t,e),e.isImmediatePropagationStopped()?retval:!1):!1}function handleDragStart(e,t){var n=getCellFromEvent(e);if(!n||!cellExists(n.row,n.cell))return!1;var i=trigger(self.onDragStart,t,e);return e.isImmediatePropagationStopped()?i:!1}function handleDrag(e,t){return trigger(self.onDrag,t,e)}function handleDragEnd(e,t){trigger(self.onDragEnd,t,e)}function handleKeyDown(e){trigger(self.onKeyDown,{row:activeRow,cell:activeCell},e);var t=e.isImmediatePropagationStopped();if(!t)if(e.shiftKey||e.altKey||e.ctrlKey)9!=e.which||!e.shiftKey||e.ctrlKey||e.altKey||(t=navigatePrev());else if(27==e.which){if(!getEditorLock().isActive())return;cancelEditAndSetFocus()}else 37==e.which?t=navigateLeft():39==e.which?t=navigateRight():38==e.which?t=navigateUp():40==e.which?t=navigateDown():9==e.which?t=navigateNext():13==e.which&&(options.editable&&(currentEditor?activeRow===getDataLength()?navigateDown():commitEditAndSetFocus():getEditorLock().commitCurrentEdit()&&makeActiveCellEditable()),t=!0);if(t){e.stopPropagation(),e.preventDefault();try{e.originalEvent.keyCode=0}catch(n){}}}function handleClick(e){currentEditor||e.target!=document.activeElement&&setFocus();var t=getCellFromEvent(e);!t||null!==currentEditor&&activeRow==t.row&&activeCell==t.cell||(trigger(self.onClick,{row:t.row,cell:t.cell},e),e.isImmediatePropagationStopped()||activeCell==t.cell&&activeRow==t.row||!canCellBeActive(t.row,t.cell)||(!getEditorLock().isActive()||getEditorLock().commitCurrentEdit())&&(scrollRowIntoView(t.row,!1),setActiveCellInternal(getCellNode(t.row,t.cell),t.row===getDataLength()||options.autoEdit)))}function handleContextMenu(e){var t=$(e.target).closest(".slick-cell",$canvas);0!==t.length&&(activeCellNode!==t[0]||null===currentEditor)&&trigger(self.onContextMenu,{},e)}function handleDblClick(e){var t=getCellFromEvent(e);!t||null!==currentEditor&&activeRow==t.row&&activeCell==t.cell||(trigger(self.onDblClick,{row:t.row,cell:t.cell},e),e.isImmediatePropagationStopped()||options.editable&&gotoCell(t.row,t.cell,!0))}function handleHeaderMouseEnter(e){trigger(self.onHeaderMouseEnter,{column:$(this).data("column")},e)}function handleHeaderMouseLeave(e){trigger(self.onHeaderMouseLeave,{column:$(this).data("column")},e)}function handleHeaderContextMenu(e){var t=$(e.target).closest(".slick-header-column",".slick-header-columns"),n=t&&t.data("column");trigger(self.onHeaderContextMenu,{column:n},e)}function handleHeaderClick(e){var t=$(e.target).closest(".slick-header-column",".slick-header-columns"),n=t&&t.data("column");n&&trigger(self.onHeaderClick,{column:n},e)}function handleMouseEnter(e){trigger(self.onMouseEnter,{},e)}function handleMouseLeave(e){trigger(self.onMouseLeave,{},e)}function cellExists(e,t){return!(0>e||e>=getDataLength()||0>t||t>=columns.length)}function getCellFromPoint(e,t){for(var n=Math.floor((t+offset)/options.rowHeight),i=0,o=0,a=0;columns.length>a&&e>o;a++)o+=columns[a].width,i++;return 0>i&&(i=0),{row:n,cell:i-1}}function getCellFromNode(e){var t=/l\d+/.exec(e.className);if(!t)throw"getCellFromNode: cannot get cell - "+e.className;return parseInt(t[0].substr(1,t[0].length-1),10)}function getRowFromNode(e){for(var t in rowsCache)if(rowsCache[t].rowNode===e)return 0|t;return null}function getCellFromEvent(e){var t=$(e.target).closest(".slick-cell",$canvas);if(!t.length)return null;var n=getRowFromNode(t[0].parentNode),i=getCellFromNode(t[0]);return null==n||null==i?null:{row:n,cell:i}}function getCellNodeBox(e,t){if(!cellExists(e,t))return null;for(var n=e*options.rowHeight-offset,i=n+options.rowHeight-1,o=0,a=0;t>a;a++)o+=columns[a].width;var s=o+columns[t].width;return{top:n,left:o,bottom:i,right:s}}function resetActiveCell(){setActiveCellInternal(null,!1)}function setFocus(){-1==tabbingDirection?$focusSink[0].focus():$focusSink2[0].focus()}function scrollCellIntoView(e,t){var n=getColspan(e,t),i=columnPosLeft[t],o=columnPosRight[t+(n>1?n-1:0)],a=scrollLeft+viewportW;scrollLeft>i?($viewport.scrollLeft(i),handleScroll(),render()):o>a&&($viewport.scrollLeft(Math.min(i,o-$viewport[0].clientWidth)),handleScroll(),render())}function setActiveCellInternal(e,t){null!==activeCellNode&&(makeActiveCellNormal(),$(activeCellNode).removeClass("active"),rowsCache[activeRow]&&$(rowsCache[activeRow].rowNode).removeClass("active"));var n=activeCellNode!==e;activeCellNode=e,null!=activeCellNode?(activeRow=getRowFromNode(activeCellNode.parentNode),activeCell=activePosX=getCellFromNode(activeCellNode),$(activeCellNode).addClass("active"),$(rowsCache[activeRow].rowNode).addClass("active"),options.editable&&t&&isCellPotentiallyEditable(activeRow,activeCell)&&(clearTimeout(h_editorLoader),options.asyncEditorLoading?h_editorLoader=setTimeout(function(){makeActiveCellEditable()},options.asyncEditorLoadDelay):makeActiveCellEditable())):activeRow=activeCell=null,n&&trigger(self.onActiveCellChanged,getActiveCell())}function clearTextSelection(){if(document.selection&&document.selection.empty)document.selection.empty();else if(window.getSelection){var e=window.getSelection();e&&e.removeAllRanges&&e.removeAllRanges()}}function isCellPotentiallyEditable(e,t){return getDataLength()>e&&!getDataItem(e)?!1:columns[t].cannotTriggerInsert&&e>=getDataLength()?!1:getEditor(e,t)?!0:!1}function makeActiveCellNormal(){if(currentEditor){if(trigger(self.onBeforeCellEditorDestroy,{editor:currentEditor}),currentEditor.destroy(),currentEditor=null,activeCellNode){var e=getDataItem(activeRow);if($(activeCellNode).removeClass("editable invalid"),e){var t=columns[activeCell],n=getFormatter(activeRow,t);activeCellNode.innerHTML=n(activeRow,activeCell,getDataItemValueForColumn(e,t),t,getDataItem(activeRow)),invalidatePostProcessingResults(activeRow)}}$.browser.msie&&clearTextSelection(),getEditorLock().deactivate(editController)}}function makeActiveCellEditable(e){if(activeCellNode){if(!options.editable)throw"Grid : makeActiveCellEditable : should never get called when options.editable is false";if(clearTimeout(h_editorLoader),isCellPotentiallyEditable(activeRow,activeCell)){var t=columns[activeCell],n=getDataItem(activeRow);if(trigger(self.onBeforeEditCell,{row:activeRow,cell:activeCell,item:n,column:t})===!1)return setFocus(),void 0;getEditorLock().activate(editController),$(activeCellNode).addClass("editable"),e||(activeCellNode.innerHTML=""),currentEditor=new(e||getEditor(activeRow,activeCell))({grid:self,gridPosition:absBox($container[0]),position:absBox(activeCellNode),container:activeCellNode,column:t,item:n||{},commitChanges:commitEditAndSetFocus,cancelChanges:cancelEditAndSetFocus}),n&&currentEditor.loadValue(n),serializedEditorValue=currentEditor.serializeValue(),currentEditor.position&&handleActiveCellPositionChange()}}}function commitEditAndSetFocus(){getEditorLock().commitCurrentEdit()&&(setFocus(),options.autoEdit&&navigateDown())}function cancelEditAndSetFocus(){getEditorLock().cancelCurrentEdit()&&setFocus()}function absBox(e){var t={top:e.offsetTop,left:e.offsetLeft,bottom:0,right:0,width:$(e).outerWidth(),height:$(e).outerHeight(),visible:!0};
t.bottom=t.top+t.height,t.right=t.left+t.width;for(var n=e.offsetParent;(e=e.parentNode)!=document.body;)t.visible&&e.scrollHeight!=e.offsetHeight&&"visible"!=$(e).css("overflowY")&&(t.visible=t.bottom>e.scrollTop&&t.top<e.scrollTop+e.clientHeight),t.visible&&e.scrollWidth!=e.offsetWidth&&"visible"!=$(e).css("overflowX")&&(t.visible=t.right>e.scrollLeft&&t.left<e.scrollLeft+e.clientWidth),t.left-=e.scrollLeft,t.top-=e.scrollTop,e===n&&(t.left+=e.offsetLeft,t.top+=e.offsetTop,n=e.offsetParent),t.bottom=t.top+t.height,t.right=t.left+t.width;return t}function getActiveCellPosition(){return absBox(activeCellNode)}function getGridPosition(){return absBox($container[0])}function handleActiveCellPositionChange(){if(activeCellNode&&(trigger(self.onActiveCellPositionChanged,{}),currentEditor)){var e=getActiveCellPosition();currentEditor.show&&currentEditor.hide&&(e.visible?currentEditor.show():currentEditor.hide()),currentEditor.position&&currentEditor.position(e)}}function getCellEditor(){return currentEditor}function getActiveCell(){return activeCellNode?{row:activeRow,cell:activeCell}:null}function getActiveCellNode(){return activeCellNode}function scrollRowIntoView(e,t){var n=e*options.rowHeight,i=(e+1)*options.rowHeight-viewportH+(viewportHasHScroll?scrollbarDimensions.height:0);(e+1)*options.rowHeight>scrollTop+viewportH+offset?(scrollTo(t?n:i),render()):scrollTop+offset>e*options.rowHeight&&(scrollTo(t?i:n),render())}function scrollRowToTop(e){scrollTo(e*options.rowHeight),render()}function getColspan(e,t){var n=data.getItemMetadata&&data.getItemMetadata(e);if(!n||!n.columns)return 1;var i=n.columns[columns[t].id]||n.columns[t],o=i&&i.colspan;return o="*"===o?columns.length-t:o||1}function findFirstFocusableCell(e){for(var t=0;columns.length>t;){if(canCellBeActive(e,t))return t;t+=getColspan(e,t)}return null}function findLastFocusableCell(e){for(var t=0,n=null;columns.length>t;)canCellBeActive(e,t)&&(n=t),t+=getColspan(e,t);return n}function gotoRight(e,t){if(t>=columns.length)return null;do t+=getColspan(e,t);while(columns.length>t&&!canCellBeActive(e,t));return columns.length>t?{row:e,cell:t,posX:t}:null}function gotoLeft(e,t){if(0>=t)return null;var n=findFirstFocusableCell(e);if(null===n||n>=t)return null;for(var i,o={row:e,cell:n,posX:n};;){if(i=gotoRight(o.row,o.cell,o.posX),!i)return null;if(i.cell>=t)return o;o=i}}function gotoDown(e,t,n){for(var i;;){if(++e>=getDataLength()+(options.enableAddRow?1:0))return null;for(i=t=0;n>=t;)i=t,t+=getColspan(e,t);if(canCellBeActive(e,i))return{row:e,cell:i,posX:n}}}function gotoUp(e,t,n){for(var i;;){if(0>--e)return null;for(i=t=0;n>=t;)i=t,t+=getColspan(e,t);if(canCellBeActive(e,i))return{row:e,cell:i,posX:n}}}function gotoNext(e,t,n){if(null==e&&null==t&&(e=t=n=0,canCellBeActive(e,t)))return{row:e,cell:t,posX:t};var i=gotoRight(e,t,n);if(i)return i;for(var o=null;++e<getDataLength()+(options.enableAddRow?1:0);)if(o=findFirstFocusableCell(e),null!==o)return{row:e,cell:o,posX:o};return null}function gotoPrev(e,t,n){if(null==e&&null==t&&(e=getDataLength()+(options.enableAddRow?1:0)-1,t=n=columns.length-1,canCellBeActive(e,t)))return{row:e,cell:t,posX:t};for(var i,o;!i&&!(i=gotoLeft(e,t,n));){if(0>--e)return null;t=0,o=findLastFocusableCell(e),null!==o&&(i={row:e,cell:o,posX:o})}return i}function navigateRight(){return navigate("right")}function navigateLeft(){return navigate("left")}function navigateDown(){return navigate("down")}function navigateUp(){return navigate("up")}function navigateNext(){return navigate("next")}function navigatePrev(){return navigate("prev")}function navigate(e){if(!options.enableCellNavigation)return!1;if(!activeCellNode&&"prev"!=e&&"next"!=e)return!1;if(!getEditorLock().commitCurrentEdit())return!0;setFocus();var t={up:-1,down:1,left:-1,right:1,prev:-1,next:1};tabbingDirection=t[e];var n={up:gotoUp,down:gotoDown,left:gotoLeft,right:gotoRight,prev:gotoPrev,next:gotoNext},i=n[e],o=i(activeRow,activeCell,activePosX);if(o){var a=o.row==getDataLength();return scrollRowIntoView(o.row,!a),scrollCellIntoView(o.row,o.cell),setActiveCellInternal(getCellNode(o.row,o.cell),a||options.autoEdit),activePosX=o.posX,!0}return setActiveCellInternal(getCellNode(activeRow,activeCell),activeRow==getDataLength()||options.autoEdit),!1}function getCellNode(e,t){return rowsCache[e]?(ensureCellNodesInRowsCache(e),rowsCache[e].cellNodesByColumnIdx[t]):null}function setActiveCell(e,t){initialized&&(e>getDataLength()||0>e||t>=columns.length||0>t||options.enableCellNavigation&&(scrollRowIntoView(e,!1),scrollCellIntoView(e,t),setActiveCellInternal(getCellNode(e,t),!1)))}function canCellBeActive(e,t){if(!options.enableCellNavigation||e>=getDataLength()+(options.enableAddRow?1:0)||0>e||t>=columns.length||0>t)return!1;var n=data.getItemMetadata&&data.getItemMetadata(e);if(n&&"boolean"==typeof n.focusable)return n.focusable;var i=n&&n.columns;return i&&i[columns[t].id]&&"boolean"==typeof i[columns[t].id].focusable?i[columns[t].id].focusable:i&&i[t]&&"boolean"==typeof i[t].focusable?i[t].focusable:"boolean"==typeof columns[t].focusable?columns[t].focusable:!0}function canCellBeSelected(e,t){if(e>=getDataLength()||0>e||t>=columns.length||0>t)return!1;var n=data.getItemMetadata&&data.getItemMetadata(e);if(n&&"boolean"==typeof n.selectable)return n.selectable;var i=n&&n.columns&&(n.columns[columns[t].id]||n.columns[t]);return i&&"boolean"==typeof i.selectable?i.selectable:"boolean"==typeof columns[t].selectable?columns[t].selectable:!0}function gotoCell(e,t,n){if(initialized&&canCellBeActive(e,t)&&getEditorLock().commitCurrentEdit()){scrollRowIntoView(e,!1),scrollCellIntoView(e,t);var i=getCellNode(e,t);setActiveCellInternal(i,n||e===getDataLength()||options.autoEdit),currentEditor||setFocus()}}function commitCurrentEdit(){var e=getDataItem(activeRow),t=columns[activeCell];if(currentEditor){if(currentEditor.isValueChanged()){var n=currentEditor.validate();if(n.valid){if(getDataLength()>activeRow){var i={row:activeRow,cell:activeCell,editor:currentEditor,serializedValue:currentEditor.serializeValue(),prevSerializedValue:serializedEditorValue,execute:function(){this.editor.applyValue(e,this.serializedValue),updateRow(this.row)},undo:function(){this.editor.applyValue(e,this.prevSerializedValue),updateRow(this.row)}};options.editCommandHandler?(makeActiveCellNormal(),options.editCommandHandler(e,t,i)):(i.execute(),makeActiveCellNormal()),trigger(self.onCellChange,{row:activeRow,cell:activeCell,item:e})}else{var o={};currentEditor.applyValue(o,currentEditor.serializeValue()),makeActiveCellNormal(),trigger(self.onAddNewRow,{item:o,column:t})}return!getEditorLock().isActive()}return $(activeCellNode).addClass("invalid"),$(activeCellNode).stop(!0,!0).effect("highlight",{color:"red"},300),trigger(self.onValidationError,{editor:currentEditor,cellNode:activeCellNode,validationResults:n,row:activeRow,cell:activeCell,column:t}),currentEditor.focus(),!1}makeActiveCellNormal()}return!0}function cancelCurrentEdit(){return makeActiveCellNormal(),!0}function rowsToRanges(e){for(var t=[],n=columns.length-1,i=0;e.length>i;i++)t.push(new Slick.Range(e[i],0,e[i],n));return t}function getSelectedRows(){if(!selectionModel)throw"Selection model is not set";return selectedRows}function setSelectedRows(e){if(!selectionModel)throw"Selection model is not set";selectionModel.setSelectedRanges(rowsToRanges(e))}var defaults={explicitInitialization:!1,rowHeight:25,defaultColumnWidth:80,enableAddRow:!1,leaveSpaceForNewRows:!1,editable:!1,autoEdit:!0,enableCellNavigation:!0,enableColumnReorder:!0,asyncEditorLoading:!1,asyncEditorLoadDelay:100,forceFitColumns:!1,enableAsyncPostRender:!1,asyncPostRenderDelay:50,autoHeight:!1,editorLock:Slick.GlobalEditorLock,showHeaderRow:!1,headerRowHeight:25,showTopPanel:!1,topPanelHeight:25,formatterFactory:null,editorFactory:null,cellFlashingCssClass:"flashing",selectedCellCssClass:"selected",multiSelect:!0,enableTextSelectionOnCells:!1,dataItemColumnValueExtractor:null,fullWidthRows:!1,multiColumnSort:!1,defaultFormatter:defaultFormatter,forceSyncScrolling:!1},columnDefaults={name:"",resizable:!0,sortable:!1,minWidth:30,rerenderOnResize:!1,headerCssClass:null,defaultSortAsc:!0},th,h,ph,n,cj,page=0,offset=0,vScrollDir=1,initialized=!1,$container,uid="slickgrid_"+Math.round(1e6*Math.random()),self=this,$focusSink,$focusSink2,$headerScroller,$headers,$headerRow,$headerRowScroller,$headerRowSpacer,$topPanelScroller,$topPanel,$viewport,$canvas,$style,$boundAncestors,stylesheet,columnCssRulesL,columnCssRulesR,viewportH,viewportW,canvasWidth,viewportHasHScroll,viewportHasVScroll,headerColumnWidthDiff=0,headerColumnHeightDiff=0,cellWidthDiff=0,cellHeightDiff=0,absoluteColumnMinWidth,numberOfRows=0,tabbingDirection=1,activePosX,activeRow,activeCell,activeCellNode=null,currentEditor=null,serializedEditorValue,editController,rowsCache={},renderedRows=0,numVisibleRows,prevScrollTop=0,scrollTop=0,lastRenderedScrollTop=0,lastRenderedScrollLeft=0,prevScrollLeft=0,scrollLeft=0,selectionModel,selectedRows=[],plugins=[],cellCssClasses={},columnsById={},sortColumns=[],columnPosLeft=[],columnPosRight=[],h_editorLoader=null,h_render=null,h_postrender=null,postProcessedRows={},postProcessToRow=null,postProcessFromRow=null,counter_rows_rendered=0,counter_rows_removed=0;this.debug=function(){var e="";e+="\ncounter_rows_rendered: "+counter_rows_rendered,e+="\ncounter_rows_removed: "+counter_rows_removed,e+="\nrenderedRows: "+renderedRows,e+="\nnumVisibleRows: "+numVisibleRows,e+="\nmaxSupportedCssHeight: "+maxSupportedCssHeight,e+="\nn(umber of pages): "+n,e+="\n(current) page: "+page,e+="\npage height (ph): "+ph,e+="\nvScrollDir: "+vScrollDir,alert(e)},this.eval=function(expr){return eval(expr)},$.extend(this,{slickGridVersion:"2.1",onScroll:new Slick.Event,onSort:new Slick.Event,onHeaderMouseEnter:new Slick.Event,onHeaderMouseLeave:new Slick.Event,onHeaderContextMenu:new Slick.Event,onHeaderClick:new Slick.Event,onHeaderCellRendered:new Slick.Event,onBeforeHeaderCellDestroy:new Slick.Event,onHeaderRowCellRendered:new Slick.Event,onBeforeHeaderRowCellDestroy:new Slick.Event,onMouseEnter:new Slick.Event,onMouseLeave:new Slick.Event,onClick:new Slick.Event,onDblClick:new Slick.Event,onContextMenu:new Slick.Event,onKeyDown:new Slick.Event,onAddNewRow:new Slick.Event,onValidationError:new Slick.Event,onViewportChanged:new Slick.Event,onColumnsReordered:new Slick.Event,onColumnsResized:new Slick.Event,onCellChange:new Slick.Event,onBeforeEditCell:new Slick.Event,onBeforeCellEditorDestroy:new Slick.Event,onBeforeDestroy:new Slick.Event,onActiveCellChanged:new Slick.Event,onActiveCellPositionChanged:new Slick.Event,onDragInit:new Slick.Event,onDragStart:new Slick.Event,onDrag:new Slick.Event,onDragEnd:new Slick.Event,onSelectedRowsChanged:new Slick.Event,onCellCssStylesChanged:new Slick.Event,registerPlugin:registerPlugin,unregisterPlugin:unregisterPlugin,getColumns:getColumns,setColumns:setColumns,getColumnIndex:getColumnIndex,updateColumnHeader:updateColumnHeader,setSortColumn:setSortColumn,setSortColumns:setSortColumns,getSortColumns:getSortColumns,autosizeColumns:autosizeColumns,getOptions:getOptions,setOptions:setOptions,getData:getData,getDataLength:getDataLength,getDataItem:getDataItem,setData:setData,getSelectionModel:getSelectionModel,setSelectionModel:setSelectionModel,getSelectedRows:getSelectedRows,setSelectedRows:setSelectedRows,render:render,invalidate:invalidate,invalidateRow:invalidateRow,invalidateRows:invalidateRows,invalidateAllRows:invalidateAllRows,updateCell:updateCell,updateRow:updateRow,getViewport:getVisibleRange,getRenderedRange:getRenderedRange,resizeCanvas:resizeCanvas,updateRowCount:updateRowCount,scrollRowIntoView:scrollRowIntoView,scrollRowToTop:scrollRowToTop,scrollCellIntoView:scrollCellIntoView,getCanvasNode:getCanvasNode,focus:setFocus,getCellFromPoint:getCellFromPoint,getCellFromEvent:getCellFromEvent,getActiveCell:getActiveCell,setActiveCell:setActiveCell,getActiveCellNode:getActiveCellNode,getActiveCellPosition:getActiveCellPosition,resetActiveCell:resetActiveCell,editActiveCell:makeActiveCellEditable,getCellEditor:getCellEditor,getCellNode:getCellNode,getCellNodeBox:getCellNodeBox,canCellBeSelected:canCellBeSelected,canCellBeActive:canCellBeActive,navigatePrev:navigatePrev,navigateNext:navigateNext,navigateUp:navigateUp,navigateDown:navigateDown,navigateLeft:navigateLeft,navigateRight:navigateRight,gotoCell:gotoCell,getTopPanel:getTopPanel,setTopPanelVisibility:setTopPanelVisibility,setHeaderRowVisibility:setHeaderRowVisibility,getHeaderRow:getHeaderRow,getHeaderRowColumn:getHeaderRowColumn,getGridPosition:getGridPosition,flashCell:flashCell,addCellCssStyles:addCellCssStyles,setCellCssStyles:setCellCssStyles,removeCellCssStyles:removeCellCssStyles,getCellCssStyles:getCellCssStyles,init:finishInitialization,destroy:destroy,getEditorLock:getEditorLock,getEditController:getEditController}),init()}$.extend(!0,window,{Slick:{Grid:SlickGrid}});var scrollbarDimensions,maxSupportedCssHeight})(jQuery),define("slick.grid",["slick.core","slick.dataview","slick.groupitemmetadataprovider","jquery.event.drag","jquery.event.drop"],function(){}),define("modules/chat/views/contact_grid",["modules/chat/config/config","modules/chat/models/session","modules/chat/models/contact","modules/chat/models/chat","handlebars","modules/common/utility","modules/common/local_storage","modules/chat/views/content_window_helper","modules/chat/views/qtip_menu_container_mixin","underscore","backbone","slick.grid","slick.dataview","slick.groupitemmetadataprovider","jquery","qtip"],function(e,t,n,i,o,a,s,r,l,c,u){var h=n.contactGroupStore,d={},p=o.compile("<div class='cell-inner chat-list-contact {{inselection}}'><p class='empty_list_message'>{{message}}</p></div>"),f=o.compile("<div class='cell-inner chat-list-contact {{inselection}}'> <a><span class='status {{online_status}}'></span><span class='contact-name'>{{username}}</span> <span class='status_message'>&nbsp;{{status_message}}</span></a></div>"),m=["var filterText=args.filterText, onlyFusion = args.onlyFusion, showOffline=args.showOffline,excludeList = args.excludeList;","if(onlyFusion && item.group_id != -1){return false;}","if(excludeList.indexOf('~*.*~'+item.username+'~*.*~') !== -1) return false;","if(item.notfromserver) return true;","if(filterText != ''){if(item.username.indexOf(filterText) != -1){return true;}else{return false;}","if(!onlyFusion){if(item.group_id == -1){return true;}else{return false;}}","}else if(!showOffline){if(item.presence != args.offline_presence){return true;} else{return false;}}return true;"],g=Function("item,args",m.join("")),_=function(e){var t=h.get_contact_group(e);return t?t.get("name"):"unnamed"},v=function(e,t,n,i,o){this.$el=e,this.isMultiSelect=t||!1,this.selected_items=[],this.selected_contacts=[],this.showOffline=n||s.get("showOffline")||!1,this.onlyFusion=i||!1,c.isArray(o)?(o=o.join("~*.*~"),o="~*.*~"+o+"~*.*~"):o="",this.excludelist=o,this.setup_grid_column_meta_details(),this.setupGrid(),this.setup_initial_data(),this.setup_contact_group_store_model_events()};return c.extend(v.prototype,u.Events),c.extend(v.prototype,{setup_grid_column_meta_details:function(){function e(e,n,i,o,s){return s.inselection=s.isRowSelected?"contact-selected":"",s.notfromserver?(-1>s.group_id&&!t.get_user_im_status(s.group_id)?s.message=a.translate("chat|please_sign_in_message"):-1>s.group_id&&t.get_user_im_status(s.group_id)&&1>h.get_contact_group(s.group_id).get_contacts().length?s.message=a.translate("chat|empty_group_message"):s.group_id>0&&1>h.get_contact_group(s.group_id).get_contacts().length&&(s.message=a.translate("chat|empty_group_message")),p(s)):f(s)}this.contact_columns=[{id:"contact-cell",name:"Contacts",formatter:e,width:260,cssClass:"contact-card-cell"}]},setup_initial_data:function(){h.is_contacts_loaded()&&this.initialize_with_data(h.get_all_contacts())},remove_contact_group:function(e){var t=this.contactsDataView,n=t.getGroups();c.each(n,function(n){e.get("groupId")==n.value&&c.each(n.rows,function(e){t.deleteItem(e.id)})}),t.reSort(),t.refresh()},create_contact_data_model:function(e,t){return{id:e?e.get("contactId"):c.uniqueId("cg_"),online_status:e?e.getPresenceIconCls():"",presence:e?e.getPresence():1,username:e?e.getDisplayName():"",avatar:e?e.getDisplayPicture():"",group_id:e?e.get("groupId")+"":t.get("groupId")+"",group_name:e?e.get("groupName"):t.get("name"),status_message:e?e.get("statusMessage"):"",notfromserver:!e,sort_attribute:e?e.getSortOrder():"999-zzzzzz",isRowSelected:e?this.isInSelection(e.getDisplayName()):!1,message:"",button:""}},setup_contact_group_store_model_events:function(){h.on("contact_group_added",function(e){this.setup_contact_group_events(e),d[e.get("groupId")]=this.create_contact_data_model(null,e),this.received_contacts_complete&&(this.contactsDataView.addItem(d[e.get("groupId")]),this.contactsDataView.reSort())},this),h.on("contact_group_removed",function(e){this.teardown_contact_group_events(e),this.received_contacts_complete&&this.remove_contact_group(e)},this),h.on("contact_group_updated",function(e){var t=e.get("groupId");$(".sg-cg-"+t).text(_(t))},this),h.on("contacts_load_complete",this.initialize_with_data,this)},initialize_with_data:function(e){console.log("all_contacts"),console.log(e);var t=this;(new Date).getTime();var n=[];c.each(d,function(e){console.log(e),n.push(e)}),e.each(function(e){n.push(t.create_contact_data_model(e)),t.setup_contact_events(e,e.get("groupId"),e.get("groupName"))}),this.contactsDataView.beginUpdate(),this.contactsDataView.setItems(n),this.contactsDataView.setFilter(g),this.setFilterArgs("",this.showOffline),this.contactsDataView.endUpdate(),this.contactsDataView.reSort(),this.contactsDataView.refresh(),this.setupGridGroup(this.contactsDataView);for(var i=0;this.contactsDataView.getGroups().length>i;i++){var o=this.contactsDataView.getGroups()[i].value;-1>o&&this.contactsDataView.collapseGroup(o)}this.received_contacts_complete=!0},set_show_offline:function(e){this.showOffline=e,s.set("showOffline",e),this.setFilterArgs("",this.showOffline)},setupGridGroup:function(e){e.setGrouping({getter:"group_id",formatter:function(e){var n="slick-group-settings",i="<span class='slick-group-title sg-cg-"+e.rows[0].group_id+"'>"+_(e.rows[0].group_id)+"</span> <span class='slick-group-count'>("+(e.rows.length-1)+")</span>";return-1>e.rows[0].group_id?(n+=t.get_user_im_status(e.rows[0].group_id)?" online-settings":" offline-settings",i+="<span class='"+n+"'></span>"):e.rows[0].group_id>0&&(n+=" settings",i+="<span class='"+n+"'></span>"),i},comparer:function(e,t){return Math.abs(e.rows[0].group_id)-Math.abs(t.rows[0].group_id)}})},toggleSelection:function(e,t){var n=e.username;this.isMultiSelect&&(c.contains(this.selected_items,n)?(this.selected_items=c.without(this.selected_items,n),this.selected_contacts=c.without(this.selected_contacts,t),this.changeSelection(e,!1)):(this.selected_items.push(n),this.selected_contacts.push(t),this.changeSelection(e,!0)))},getSelectedUsers:function(){return this.selected_contacts},getSelectedUserNames:function(){return this.selected_items},changeSelection:function(e,t){e.isRowSelected=t,this.contactsDataView.updateItem(e.id,e),this.contactsDataView.reSort()},isInSelection:function(e){return c.contains(this.selected_items,e)},setupGrid:function(){var e=this;this.groupItemMetadataProvider=new Slick.Data.GroupItemMetadataProvider;var t=new Slick.Data.DataView({groupItemMetadataProvider:this.groupItemMetadataProvider,inlineFilters:!0});t.fastSort("sort_attribute",!0);var n=new Slick.Grid(this.$el,t,this.contact_columns,this.grid_options);n.resizeCanvas(),n.registerPlugin(this.groupItemMetadataProvider),t.onRowCountChanged.subscribe(function(){n.updateRowCount(),n.render()}),t.onRowsChanged.subscribe(function(e,t){n.invalidateRows(t.rows),n.render()}),n.onClick.subscribe(function(i){var o=n.getCellFromEvent(i),a=t.getItem(o.row);if(!a.notfromserver){if(a.__group)return e.trigger("ContactGroupSetting",i,a),void 0;var s=h.get_contact_group(a.group_id),r=s.get_contact_by_id(a.id);e.isMultiSelect?(e.toggleSelection(a,r),e.trigger("ContactSelectionChange",e)):e.trigger("ContactClick",r)}}),n.onContextMenu.subscribe(function(i){i.stopPropagation(),i.preventDefault();var o=n.getCellFromEvent(i),a=t.getItem(o.row),s=$(i.target);if(s.hasClass("slick-row")||(s=$(s.closest(".slick-row"))),!a.notfromserver){if(a.__group)e.trigger("GroupContextMenu",i,a);else{var r=h.get_contact_group(a.group_id),l=r.get_contact_by_id(a.id);e.trigger("ContactContextMenu",i,a,l)}e.trigger("ContextMenu",i)}}),this.contactsDataView=t,this.contactGrid=n,a.isolate_scroll(this.$el.find(".slick-viewport"))},getGrid:function(){return this.contactGrid},expandIM:function(e){for(var t=0;this.contactsDataView.getGroups().length>t;t++){var n=this.contactsDataView.getGroups()[t].value;n!=e?this.contactsDataView.collapseGroup(n):this.contactsDataView.expandGroup(n)}},setup_contact_events:function(e){e.on("change",function(){var t=e.get("contactId"),n=this.create_contact_data_model(e);this.received_contacts_complete&&(this.contactsDataView.updateItem(t,n),this.contactsDataView.reSort())},this)},teardown_contact_events:function(e){e.off(null,null,this)},setup_contact_group_events:function(e){e.on("contact_added",function(t){this.contactsDataView.addItem(this.create_contact_data_model(t)),this.contactsDataView.reSort(),this.setup_contact_events(t,e.get("groupId"),e.get("name"))},this),e.on("contact_removed",function(e){if(console.log("contact_was_removed"),this.received_contacts_complete){try{this.contactsDataView.deleteItem(e.get("contactId"))}catch(t){console.log("Unable to locate the contact id in the grid. ")}this.contactsDataView.reSort(),this.teardown_contact_events(e)}},this)},teardown_contact_group_events:function(e){e.off(null,null,this)},setFilterArgs:function(t,n){console.log("showOffline - "+n),this.contactsDataView.setFilterArgs({showOffline:n,filterText:t,onlyFusion:this.onlyFusion,offline_presence:e.Presence.appear_offline,excludeList:this.excludelist}),this.contactsDataView.refresh()}}),v}),define("modules/chat/views/add_participant_menu",["handlebars","modules/chat/models/contact","modules/chat/models/session","modules/chat/views/contact_grid","modules/chat/config/config","modules/common/utility","underscore","backbone","jquery","qtip"],function(e,t,n,i,o,a,s){var r=260,l=function(){this.current_target=null,this.current_chat=null;var e=this;this.$qtip_container=$("<div/>"),this.qtip_params={title:{text:a.translate("chat|add_participant"),button:!0},content:" ",position:{target:"event",at:"bottom center",my:"top center"},show:{modal:{on:!1,blur:!0},effect:!1},hide:{effect:!1,event:"unfocus"},events:{show:function(t,n){var o=$("<div style='height:"+r+"px;width:100%;'></div>"),l=$("<div style='height:"+(r-90)+"px;width:100%;'></div>"),c=$('<input type="text" value="" class="search-in-contacts-text" style="width:90%" placeholder="'+a.translate("chat|search_your_friends")+'"/>');o.append(c),o.append(l);var u=$('<div style="width:100%;padding-top:10px"><input type="button" class="pull-right btn btn-small btn-mig33" name="close" value="'+e.btn_txt+'"></div>');o.append(u),n.set("content.text",o);var h=e.current_chat?e.current_chat.getParticipants():[],d=new i(l,!0,!0,!0,h);d.getGrid().resizeCanvas(),d.on("ContactClick",function(e){if(this.current_target){var t=jQuery.Event("ContactClick",{contact:e});$(this.current_target).trigger(t),this.$qtip_container.qtip("hide")}},e),u.find("input").on("click",function(t){t.preventDefault();var n=d.getSelectedUsers();if(0!==n.length&&e.current_target){var i=jQuery.Event("ContactsSelected",{contacts:n});$(e.current_target).trigger(i),e.$qtip_container.qtip("hide")}});var p=s.debounce(function(){d.setFilterArgs(c.val(),!0)},300);c.on("keyup",function(e){27==e.keyCode&&(e.preventDefault(),$(this).val("")),p()})}},style:{classes:"qtip-shadow qtip-bootstrap",width:"200px",height:r+"px"}},this.$qtip_container.qtip(this.qtip_params)},c=l.prototype;return s.extend(c,{show:function(e,t,n,i,o){this.btn_txt=o||a.translate("chat|invite_friends_to_chat"),this.current_target=e,this.current_chat=t;var s=this.$qtip_container.qtip("api");i?(s.set("position.target","event"),s.set("position.at","bottom center"),s.set("position.my","top center")):(s.set("position.target",n.target),s.set("position.at","center"),s.set("position.my","center")),s.show(n)}}),new l}),define("modules/chat/views/more_options_menu",["handlebars","modules/chat/models/contact","modules/chat/models/session","modules/chat/config/config","modules/common/utility","underscore","modules/chat/models/chat_room","jquery","backbone","qtip"],function(e,t,n,i,o,a,s){var r=s.ChatRoomCategoryStore,l='<ul class="more-options-list">{{{list_html}}}</ul>',c=function(){var e=this;this.current_target=null,this.current_chat=null,this.current_chat_window=null,this.registered_elems=[],this.$qtip_container=$("<div/>"),this.more_options_html=l,this.qtip_params={title:{text:o.translate("common|more"),button:!0},content:this.more_options_html,position:{target:"event",at:"bottom center",my:"top center"},events:{show:function(){var t=e.current_chat,n="";if(t.is_chat_room()){var i="/v4/sites/ajax/chatroom/setup/?"+$.param({roomName:t.get("name")}),a="/group/"+t.get("group_id"),s='<li><a href="#" class="ico-fav-chat">'+o.translate("chat|add_to_favourites")+"</a></li>";r.is_chatroom_favourite(t.get("name"))&&(s='<li><a href="#" class="ico-fav-chat">'+o.translate("chat|remove_from_favourites")+"</a></li>"),n='<li><a href="#" class="add-people">'+o.translate("chat|add_people")+"</a></li>"+s+'<li><a href="'+a+'" class="ico-chatroom-info">'+o.translate("Go to group page")+"</a></li>"+'<li><a href="'+i+'" class="ico-chatroom-info">'+o.translate("Room Information")+"</a></li>"}else n=t.is_group_chat()?'<li><a href="#" class="add-people">'+o.translate("chat|add_people")+"</a></li>"+'<li><a href="#" class="rename-chat">'+o.translate("chat|rename_group_chat")+"</a></li>"+'<li><a href="#" class="leave-chat">'+o.translate("chat|leave_chat")+"</a></li>":'<li><a href="#" class="add-people">'+o.translate("chat|add_people")+"</a></li>";var l=$(".more-options-list");l.html(n),l.find("a").on("click",function(){e.$qtip_container.qtip("hide",function(){})}).end().find(".ico-fav-chat").on("click",function(e){e.preventDefault(),r.is_chatroom_favourite(t.get("name"))?r.remove_favourite_chatroom(t.get("name")):r.add_favourite_chatroom(t.get("name"))}),l.find(".add-people").on("click",function(t){t.preventDefault(),e.current_chat_window.show_add_people()}),l.find(".rename-chat").on("click",function(t){t.preventDefault(),e.current_chat_window.show_rename_chat()}),l.find(".leave-chat").on("click",function(t){t.preventDefault(),e.current_chat_window.leave_chat()})}},style:{classes:"qtip-shadow qtip-bootstrap",width:"auto",height:"auto"},show:{effect:!1},hide:{effect:!1,event:"unfocus"}},this.$qtip_container.qtip(this.qtip_params)},u=c.prototype;return a.extend(u,{show:function(e,t,n,i){this.current_target=e,this.current_chat=t,this.current_chat_window=i,this.$qtip_container.qtip("show",n)}}),new c}),define("modules/chat/views/chat_window",["modules/common/utility","modules/chat/views/chat_input_panel","modules/chat/views/chat_message_panel","modules/chat/views/chat_participant_list","modules/chat/views/add_participant_menu","modules/chat/views/more_options_menu","handlebars","modules/chat/views/qtip_menu_container_mixin","modules/chat/views/context_menu_items","underscore.string","underscore","backbone","jquery"],function(e,t,n,i,o,a,s,r,l,c,u,h){var d=8,p=96,f=68+d,m=52,g='<div class="input-container"><input type="text" style="" autocomplete="off" /></div>',_='<div id="{{chat_id}}" class="mig-window"><div class="mig-window-header clearfix"><div class="mig-window-icon"><i class="ico ico-24 {{{display_picture}}}"></i></div><div class="mig-window-title"><a class="participant-count" title="{{full_title}}" href="#">({{count}})</a><span class="title-text" title="{{{chat_title}}}">{{{chat_title}}}</span></div><div class="mig-window-actions"><div class="mig-window-option pull-right" ><a href="#" class="minimize-mig-window" title="'+e.translate("chat|more_options")+'"><i class="ico ico-24 ico-window-settings"></i></a>'+'<a href="#" class="close-mig-window" title="'+e.translate("chat|close_window")+'"><i class="ico ico-24 ico-window-close"></i></a>'+"</div>"+"</div>"+"</div>"+'<div class="mig-window-content mig-window-chat-content">'+'<div class="chat-window-messages pull-left">'+'<ul class="unstyled"></ul>'+"</div>"+'<div class="parent-chat-window-participants pull-right">'+"{{{toggle_button}}}"+'<div class="chat-window-participants">'+'<div><a href="#">Refresh Participant List</a></div>'+'<ul class="unstyled"></ul>'+"</div>"+"</div>"+'<div class="clearfix"></div>'+"</div>"+'<div class="mig-window-footer">'+"{{{adduser_html}}}"+'<div class="chat-window-messagebox pull-left">'+'<input class="messagebox" type="text" />'+"</div>"+'<div class="chat-window-emoticon pull-right">'+'<a href="#" class="insert-chat-emoticon"><i class="ico ico-28 ico-chat-emoticon"></i></a>'+"</div>"+'<div class="clearfix"></div>'+"</div>"+"</div>",v=s.compile(_),y=function(o){var s,c,h=this;this._isActive=!1,this.__chatmodel=o,this._chatHandle=o.get("chatHandle");var d=!(o.is_chat_room()||o.is_group_chat());s='<div class="chat-window-adduser pull-left"><a href="#" class="insert-chat-adduser btn-add-user-info"><i class="ico ico-28 ico-chat-adduser"></i></a></div>',c="";var p=o.getTitle();this.dom_html=v({chat_id:o.get("chatHandle"),send_btn_label:e.translate("common|send"),chat_title:p,full_title:o.getUserListAsString(),count:o.getParticipantCount(),adduser_html:"",toggle_button:c,display_picture:d?'" style="background-image: url('+url.image+"/u/"+o.getTitle()+"?w=24&h=24&a=1&c=1);":o.is_group_chat()?"ico-groupchat-default":"ico-chatroom-default"});var f=this.$window_el=$(this.dom_html),m=$(".mig-window-title",f);d?$(".parent-chat-window-participants, .participant-count",f).remove():o.is_group_chat()&&($(g).appendTo(m).hide(),$("input",m).on("keyup",function(e){var t=!1,n=!1,i=$(this).val();27==e.keyCode&&(t=!0,n=!1),13==e.keyCode&&(t=!0,n=!0),t&&($(this).val(""),h.hide_rename_chat(),n&&h.update_chat_name(i))}),$("input",m).on("blur",function(){var e=$(this).val();$(this).val(""),h.hide_rename_chat(),h.update_chat_name(e)}),$("input",m).on("click",function(e){e.stopPropagation(),e.preventDefault()})),$(".participant-count",m).qtip({hide:{fixed:!0,delay:300},position:{at:"bottom center",my:"top center"},style:{classes:"qtip-shadow qtip-bootstrap"}}),r(this,"top center","bottom center"),o.on("participant_added",function(){var e=o.getTitle();f.find(".participant-count",m).attr("title",o.getUserListAsString()),f.find(".participant-count",m).text("("+o.getParticipantCount()+")"),f.find(".title-text",m).text(e),f.find(".title-text",m).attr("title",e)}),o.on("chat_name_change",function(){var e=o.getTitle();f.find(".title-text",m).text(e),f.find(".title-text",m).attr("title",e)}),o.on("unread_message_count_changed",function(){var e=o.get_unread_message_count();e&&this.isActive()&&o.reset_unread_message_count()},this),f.on("click",function(){h.trigger("chat_window_accessed",h)}),f.find(".close-mig-window").on("click",function(e){e.stopPropagation(),e.preventDefault(),h.close($(this).offset())}),f.find(".btn-add-user-info").on("click",function(e){e.preventDefault()}),f.on("ContactClick",function(e){var t=e.contact;h.__chatmodel.addParticipant(t.getUsername(),t.get("contactId"),t.getType(),t.getDisplayName())}),f.on("ContactsSelected",function(e){var t=e.contacts;h.__chatmodel.addParticipants(t)}),f.find(".minimize-mig-window").on("click",function(e){e.preventDefault(),a.show($(this),h.__chatmodel,e,h)}),f.find(".ico-fav-chat").on("click",function(e){e.preventDefault(),o.set_as_favourite()}),$(".mig-window-icon, .participant-count",f).click(function(e){if(e.preventDefault(),!d)return h.participant_panel_open?h.close_participant_panel():h.open_participant_panel(),void 0;
var t=h.$qtip_container.qtip("api");t.set("content.text",l(o,o.getTitle())),t.show(e),e.preventDefault()}),$(".parent-chat-window-participants").click(function(e){e.preventDefault(),e.stopPropagation()});var _=f.find(".mig-window-footer");f.find(".ico-refresh-chat").on("click",function(e){e.preventDefault(),o.is_group_chat()?o.request_group_chat_participant():o.request_chatroom_participants()}),new t(_,o,$(".chat-window-toybox",f)),this.messagebox=f.find(".chat-window-messagebox .messagebox"),this.messages_pane=f.find(".chat-window-messages"),this.messages_pane.click(function(){h.close_participant_panel()}),this.participant_panel_open=!1,new n(this.messages_pane,o),f.find(".mig-window-content").addClass(d?"private-chat":"multi-chat"),d||(this.participant_pane=f.find(".chat-window-participants"),this.participant_area=new i(this.participant_pane,o),e.isolate_scroll($(this.participant_pane))),e.isolate_scroll($(this.messages_pane)),this.fetchPreviousMessageOnce=u.once(function(){o.fetchRecentMessages()}),this.resizeWindow(y.DEFAULT_HEIGHT,y.DEFAULT_WIDTH),y.trigger("chat_window_created",this)};return y.DEFAULT_WIDTH=250,y.DEFAULT_HEIGHT=371,u.extend(y,h.Events),u.extend(y.prototype,h.Events),u.extend(y.prototype,{open_participant_panel:function(){var e=this.$window_el.find(".parent-chat-window-participants");e.animate({marginLeft:"0px"},50),this.participant_panel_open=!0},close_participant_panel:function(){var e=this.$window_el.find(".parent-chat-window-participants");e.animate({marginLeft:"-"+e.width()+"px"},50),this.participant_panel_open=!1},show_add_people:function(){o.show(this.$window_el,this.__chatmodel,{target:this.$window_el},!1,e.translate("chat|add_to_chat"))},show_rename_chat:function(){console.log("rename-chat");var e=$(".mig-window-title",this.$window_el);$(".participant-count, .title-text",e).hide(),$(".input-container",e).show(),$("input",e).val(this.__chatmodel.getTitle()),$("input",e).select().focus()},hide_rename_chat:function(){console.log("close rename-chat");var e=$(".mig-window-title",this.$window_el);$("a, .title-text",e).show(),$(".input-container",e).hide()},update_chat_name:function(e){this.__chatmodel.rename_chat(e)},leave_chat:function(){var t=this.__chatmodel,n=!(t.is_chat_room()||t.is_group_chat());n||(n=window.confirm(e.translate("chat|confirm_group_chat_close"))),n&&this.trigger("chat_close_request",t)},switchContainer:function(e){e.append(this.$window_el)},getChatHandle:function(){return this._chatHandle},get$Element:function(){return this.$window_el},destroyWindow:function(){this.$window_el.remove(),this.off()},isActive:function(){return this._isActive},activate:function(){this._isActive=!0,this.$window_el.addClass("active").find("input.messagebox").focus(),this.__chatmodel.reset_unread_message_count(),this.bringToTop()},deactivate:function(){this._isActive=!1,this.$window_el.removeClass("active")},setPosition:function(e,t,n){e&&this.$window_el.css({left:e+"px"}),t&&(n?this.$window_el.css({bottom:t+"px",top:"auto"}):this.$window_el.css({top:t+"px",bottom:"auto"}))},setZIndex:function(e){this.$window_el.css({zIndex:e})},bringToTop:function(){var e=require("modules/mig33_window_manager");this.setZIndex(e.getNextZIndex())},getChatModel:function(){return this.__chatmodel},closeAndQuit:function(){this.trigger("chat_close_request",this)},close:function(){$(".messages a").tab("show"),this.$window_el.effect("transfer",{to:$("#l_"+this.$window_el.attr("id")),className:"ui-effects-transfer"},"fast"),this.deactivate(),this.$window_el.hide(),this.trigger("chat_window_closed",this)},hide:function(){this.$window_el.hide(),this.trigger("chat_window_hidden",this)},toggleResizable:function(e){var t=this;u.isUndefined(e)&&(e=!this.isResizable),e?this.$window_el.resizable({containment:"parent",minWidth:y.DEFAULT_WIDTH-10,minHeight:y.DEFAULT_HEIGHT-10,resize:function(e,n){t._height=n.size.height,t._width=n.size.width,t.resizeContent(t._height,t._width)},start:function(){t.bringToTop()}}):this.$window_el.resizable("destroy"),this.isResizable=e},toggleDraggable:function(e){var t=this;u.isUndefined(e)&&(e=!this.isDraggable),e?this.$window_el.draggable({containment:"parent",cancel:"a",handle:".mig-window-header",start:function(){t.bringToTop()}}):this.$window_el.draggable("destroy"),this.isDraggable=e},show:function(){this.$window_el.show(),this.fetchPreviousMessageOnce(),this.trigger("chat_window_shown",this)},getWindowWidth:function(){return this.$window_el.width()},getWindowHeight:function(){return this.$window_el.height()},getPosition:function(){var e=this.$window_el.position();return{x:e.left,y:e.top}},resizeWindow:function(e,t){this.$window_el.height(e),this.$window_el.width(t),this.resizeContent(e,t)},resizeContent:function(e,t){e-=f,this.$window_el.find(".mig-window-content").height(e),this.$window_el.find(".mig-window-content .parent-chat-window-participants").height(e),this.$window_el.find(".mig-window-content .chat-window-messages").height(e-0),this.$window_el.find(".mig-window-title").width(t-p),this.$window_el.find(".input-container").width(t-p),this.messagebox.width(t-m)},resetSize:function(){this.resizeWindow(y.DEFAULT_HEIGHT,y.DEFAULT_WIDTH)}}),y}),define("modules/chat/views/contact_list",["modules/chat/config/config","modules/chat/models/session","modules/chat/models/contact","modules/chat/models/chat","handlebars","modules/common/utility","modules/common/local_storage","modules/chat/views/content_window_helper","modules/chat/views/qtip_menu_container_mixin","modules/chat/views/contact_grid","underscore","backbone","slick.grid","slick.dataview","slick.groupitemmetadataprovider","jquery","qtip"],function(e,t,n,i,o,a,s,r,l,c,u,h){function d(n){switch(n){case"-3":t.get("facebook_signed_in")?t.other_im_signout(e.IM_Type.facebook):t.other_im_signin(e.IM_Type.facebook);break;case"-4":t.get("gtalk_signed_in")?t.other_im_signout(e.IM_Type.gtalk):t.other_im_signin(e.IM_Type.gtalk);break;case"-5":t.get("msn_signed_in")?t.other_im_signout(e.IM_Type.msn):t.other_im_signin(e.IM_Type.msn);break;case"-6":t.get("yahoo_signed_in")?t.other_im_signout(e.IM_Type.yahoo):t.other_im_signin(e.IM_Type.yahoo);break;default:}}function p(e){var t=null;switch(e){case"-3":t="edit_facebook_details";break;case"-4":t="edit_gtalk_details";break;case"-5":t="edit_msn_details";break;case"-6":t="edit_yahoo_details";break;default:}t&&r.show_window(t)}function f(e){var t=[{label:"Facebook",events:{click:function(){e.expandIM("-3")}}},{label:"Google Talk",events:{click:function(){e.expandIM("-4")}}},{label:"MSN",events:{click:function(){e.expandIM("-5")}}},{label:"Yahoo!",events:{click:function(){e.expandIM("-6")}}}],n=$("<ul class='nav nav-list no-padding'></ul>");return u.each(t,function(e){var t=$("<li><a href='#'>"+e.label+"</a></li>");u.each(e.events,function(e,n){t.on(n,e)}),n.append(t)}),n}function m(e){var t=e.value,n=y.get_contact_group(t),i=[{label:a.translate("chat|rename_group"),events:{click:function(){r.show_window("rename_contact_group",t,n.get("name"))}}},{label:a.translate("chat|delete_group"),events:{click:function(){y.send_delete_contact_group(t,n.get("name"))}}}],o=$("<ul class='nav nav-list no-padding'></ul>");return u.each(i,function(e){var t=$("<li><a href='#'>"+e.label+"</a></li>");u.each(e.events,function(e,n){t.on(n,e)}),o.append(t)}),o}function g(e){var n=e.value;y.get_contact_group(n);var i=t.get_user_im_status(n)?a.translate("chat|signout_3rd_party"):a.translate("chat|signin_3rd_party"),o=[{label:i,events:{click:function(){d(n)}}},{label:a.translate("chat|setup_details"),events:{click:function(e){e.preventDefault(),e.stopPropagation(),p(n)}}}],s=$("<ul class='nav nav-list no-padding'></ul>");return u.each(o,function(e){var t=$("<li><a href='#'>"+e.label+"</a></li>");u.each(e.events,function(e,n){t.on(n,e)}),s.append(t)}),s}function _(e){var t=y.get_contact_group(e.group_id),n=t.get_contact_by_id(e.id),i=[{label:a.translate("user|view_profile"),events:{click:function(){var e=n.getUsername(),t=a.get_profile_url(e),i=require("modules/mig33_app");i.navigate_to(t)}}},{label:a.translate("user|private_chat"),events:{click:function(){E(n)}}},{label:a.translate("user|send_gift"),events:{click:function(){var e=n.getUsername(),t=require("modules/mig33_app");t.navigate_to([document.location.protocol,"//",document.location.host,t.root,b,e].join(""))}}},{label:a.translate("user|transfer_credit"),events:{click:function(){var e=n.getUsername(),t=require("modules/mig33_app");t.navigate_to([document.location.protocol,"//",document.location.host,t.root,x,e].join(""))}}},{label:a.translate("user|block_and_mute"),events:{click:function(){var e=n.getUsername(),t=window.confirm(a.translate("chat|are_you_sure_block_mute",e));t&&y.send_block_user(e)}}},{label:a.translate("user|remove_friend"),events:{click:function(){var e=n.getUsername(),t=window.confirm(a.translate("chat|are_you_sure_remove_friend",e));t&&y.send_remove_friend(n.get("contactId"))}}}],o=$("<ul class='nav nav-list no-padding'></ul>");u.each(i,function(e){var t=$("<li><a href='#'>"+e.label+"</a></li>");u.each(e.events,function(e,n){t.on(n,e)}),o.append(t)}),o.append("<li class='divider'></li>"),o.append("<li class='submenu disabled'><a href='#'>"+a.translate("chat|move_to_group")+"</a></li>");var s=y.get_contact_groups();return s.each(function(e){if(!(e.get("groupId")===t.get("groupId")||-1>e.get("groupId"))){var i=$("<li><a href='#' class='contact-submenu-item'>"+e.get("name")+"</a></li>");i.on("click",function(){y.send_move_contact(n.get("contactId"),e.get("groupId"))}),o.append(i)}}),o}var v=i.ChatStore,y=n.contactGroupStore,w=(o.compile("<ul class='nav nav-list no-padding'><li><label class='checkbox'><input class='show-offline-cb' type='checkbox' value=''>{{translate \"chat|show_offline_contacts\"}}</label></li><li class='divider' /><li><a href='#' data-pagetype='add_contact_group' class='add-contact-group-btn'>{{translate \"chat|add_contact_group\"}}</a></li><li class='divider' /><li><a href='#' class='signin-gtalk-btn'>{{translate \"chat|signin_gtalk\"}}</a></li><li><a href='#' data-pagetype='edit_gtalk_details' class='edit-gtalk-btn'>{{translate \"chat|edit_gtalk\"}}</a></li><li class='divider' /><li><a href='#' class='signin-yahoo-btn'>{{translate \"chat|signin_yahoo\"}}</a></li><li><a href='#' data-pagetype='edit_yahoo_details' class='edit-yahoo-btn'>{{translate \"chat|edit_yahoo\"}}</a></li><li class='divider' /><li><a href='#' class='signin-facebook-btn'>{{translate \"chat|signin_facebook\"}}</a></li><li><a href='#' data-pagetype='edit_facebook_details' class='edit-facebook-btn'>{{translate \"chat|edit_facebook\"}}</a></li></ul>"),o.compile('<span id="search-in-contacts-span" class="clearable"><input type="text" id="search-in-contacts" placeholder="{{translate "chat|search_your_friends"}}"><span class="clear-input">x</span></span>')),b="/sites/ajax/store/show_with_category?ty=1&catid=1&e=5&sp=1&username=",x="/sites/ajax/account/transfer_credit?win_id=account-window&recipient_username=",k=function(e){this.$el=$(e),l(this,"top right","bottom center",this.$el),this.contactGrid=new c(this.$el.find(".grid"),!1),this.setup_contact_grid_events(),this.setupContactHeaderButtons(),this.set_default_contactlist_status()},C=k.prototype;u.extend(C,h.Events),u.extend(C,{showOffline:!1,filterText:"",received_contacts_complete:!1,contactsDataView:null,contactGrid:null,groupItemMetadataProvider:null,grid_options:{editable:!1,enableAddRow:!1,enableCellNavigation:!1,enableColumnReorder:!1},getGrid:function(){return this.contactGrid.getGrid()},setup_contact_grid_events:function(){this.contactGrid.on("ContactClick",function(e){E(e)}),this.contactGrid.on("ContactContextMenu",this.showContactContextMenu,this),this.contactGrid.on("ContactGroupSetting",this.showGroupSettingMenu,this)},set_default_contactlist_status:function(){this.showOffline=s.hasKey("showOffline")?s.get("showOffline"):!1,this.showOffline&&this.$el.find(".chat-list-header .contacts-toggle i").addClass("offline")},set_show_offline:function(e){this.showOffline=e,s.set("showOffline",e),this.contactGrid.setFilterArgs("",this.showOffline)},setup_toggle_offline_online:function(e){var t=$(e.target);this.showOffline=!this.showOffline,t.toggleClass("offline"),this.set_show_offline(this.showOffline)},toggle_search_input:function(e){var t=this,n=this.$el.find(".chat-list-header"),i=$("#search-in-contacts-span");e?(i.show(),i.find("#search-in-contacts").focus(),n.hide()):(i.hide(),i.find("#search-in-contacts").val(""),t.contactGrid.setFilterArgs("",t.showOffline),n.show())},setupContactHeaderButtons:function(){var e=this,t=this.$el.find(".chat-list-header"),n=$(w({}));n.insertBefore(t).hide().data({isCollapsed:!0});var i=u.debounce(function(){e.contactGrid.setFilterArgs(n.find("#search-in-contacts").val(),e.showOffline)},300);n.find("#search-in-contacts").on("keyup",function(t){27==t.keyCode&&e.toggle_search_input(!1),i()}),n.find(".clear-input").on("click",function(t){t.preventDefault(),e.toggle_search_input(!1)}),t.find(".search-friends").click(function(t){t.preventDefault(),e.toggle_search_input(!0)}),t.find(".invite-friends").click(function(e){e.preventDefault(),r.show_window("add_contact_group")}),t.find(".contacts-toggle").click(function(t){t.preventDefault(),e.setup_toggle_offline_online(t)}),t.find(".chat-im-aggregator").click(function(t){t.preventDefault();var n=e.$qtip_container.qtip("api");n.set("content.text",f(e.contactGrid)),n.show(t)})},showGroupSettingMenu:function(e,t){var n=this.$qtip_container.qtip("api");-1>t.value?n.set("content.text",g(t)):n.set("content.text",m(t)),n.show(e)},showContactContextMenu:function(e,t,n){if(n.isFusionContact()){console.log(this.$qtip_container);var i=this.$qtip_container.qtip("api");i.set("content.text",_(t)),i.show(e)}}});var E=function(e){v.startPrivateChat(e.get("contactId"),e.getDisplayName(),e.getType(),e.getUsername())};return k}),function(e,t){function n(t,n){var o,a,s,r=t.nodeName.toLowerCase();return"area"===r?(o=t.parentNode,a=o.name,t.href&&a&&"map"===o.nodeName.toLowerCase()?(s=e("img[usemap=#"+a+"]")[0],!!s&&i(s)):!1):(/input|select|textarea|button|object/.test(r)?!t.disabled:"a"===r?t.href||n:n)&&i(t)}function i(t){return e.expr.filters.visible(t)&&!e(t).parents().addBack().filter(function(){return"hidden"===e.css(this,"visibility")}).length}var o=0,a=/^ui-id-\d+$/;e.ui=e.ui||{},e.ui.version||(e.extend(e.ui,{version:"1.10.0",keyCode:{BACKSPACE:8,COMMA:188,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,LEFT:37,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106,NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SPACE:32,TAB:9,UP:38}}),e.fn.extend({_focus:e.fn.focus,focus:function(t,n){return"number"==typeof t?this.each(function(){var i=this;setTimeout(function(){e(i).focus(),n&&n.call(i)},t)}):this._focus.apply(this,arguments)},scrollParent:function(){var t;return t=e.ui.ie&&/(static|relative)/.test(this.css("position"))||/absolute/.test(this.css("position"))?this.parents().filter(function(){return/(relative|absolute|fixed)/.test(e.css(this,"position"))&&/(auto|scroll)/.test(e.css(this,"overflow")+e.css(this,"overflow-y")+e.css(this,"overflow-x"))}).eq(0):this.parents().filter(function(){return/(auto|scroll)/.test(e.css(this,"overflow")+e.css(this,"overflow-y")+e.css(this,"overflow-x"))}).eq(0),/fixed/.test(this.css("position"))||!t.length?e(document):t},zIndex:function(n){if(n!==t)return this.css("zIndex",n);if(this.length)for(var i,o,a=e(this[0]);a.length&&a[0]!==document;){if(i=a.css("position"),("absolute"===i||"relative"===i||"fixed"===i)&&(o=parseInt(a.css("zIndex"),10),!isNaN(o)&&0!==o))return o;a=a.parent()}return 0},uniqueId:function(){return this.each(function(){this.id||(this.id="ui-id-"+ ++o)})},removeUniqueId:function(){return this.each(function(){a.test(this.id)&&e(this).removeAttr("id")})}}),e.extend(e.expr[":"],{data:e.expr.createPseudo?e.expr.createPseudo(function(t){return function(n){return!!e.data(n,t)}}):function(t,n,i){return!!e.data(t,i[3])},focusable:function(t){return n(t,!isNaN(e.attr(t,"tabindex")))},tabbable:function(t){var i=e.attr(t,"tabindex"),o=isNaN(i);return(o||i>=0)&&n(t,!o)}}),e("<a>").outerWidth(1).jquery||e.each(["Width","Height"],function(n,i){function o(t,n,i,o){return e.each(a,function(){n-=parseFloat(e.css(t,"padding"+this))||0,i&&(n-=parseFloat(e.css(t,"border"+this+"Width"))||0),o&&(n-=parseFloat(e.css(t,"margin"+this))||0)}),n}var a="Width"===i?["Left","Right"]:["Top","Bottom"],s=i.toLowerCase(),r={innerWidth:e.fn.innerWidth,innerHeight:e.fn.innerHeight,outerWidth:e.fn.outerWidth,outerHeight:e.fn.outerHeight};e.fn["inner"+i]=function(n){return n===t?r["inner"+i].call(this):this.each(function(){e(this).css(s,o(this,n)+"px")})},e.fn["outer"+i]=function(t,n){return"number"!=typeof t?r["outer"+i].call(this,t):this.each(function(){e(this).css(s,o(this,t,!0,n)+"px")})}}),e.fn.addBack||(e.fn.addBack=function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}),e("<a>").data("a-b","a").removeData("a-b").data("a-b")&&(e.fn.removeData=function(t){return function(n){return arguments.length?t.call(this,e.camelCase(n)):t.call(this)}}(e.fn.removeData)),e.ui.ie=!!/msie [\w.]+/.exec(navigator.userAgent.toLowerCase()),e.support.selectstart="onselectstart"in document.createElement("div"),e.fn.extend({disableSelection:function(){return this.bind((e.support.selectstart?"selectstart":"mousedown")+".ui-disableSelection",function(e){e.preventDefault()})},enableSelection:function(){return this.unbind(".ui-disableSelection")}}),e.extend(e.ui,{plugin:{add:function(t,n,i){var o,a=e.ui[t].prototype;for(o in i)a.plugins[o]=a.plugins[o]||[],a.plugins[o].push([n,i[o]])},call:function(e,t,n){var i,o=e.plugins[t];if(o&&e.element[0].parentNode&&11!==e.element[0].parentNode.nodeType)for(i=0;o.length>i;i++)e.options[o[i][0]]&&o[i][1].apply(e.element,n)}},hasScroll:function(t,n){if("hidden"===e(t).css("overflow"))return!1;var i=n&&"left"===n?"scrollLeft":"scrollTop",o=!1;return t[i]>0?!0:(t[i]=1,o=t[i]>0,t[i]=0,o)}}))}(jQuery),function(e,t){var n=0,i=Array.prototype.slice,o=e.cleanData;e.cleanData=function(t){for(var n,i=0;null!=(n=t[i]);i++)try{e(n).triggerHandler("remove")}catch(a){}o(t)},e.widget=function(t,n,i){var o,a,s,r,l={},c=t.split(".")[0];t=t.split(".")[1],o=c+"-"+t,i||(i=n,n=e.Widget),e.expr[":"][o.toLowerCase()]=function(t){return!!e.data(t,o)},e[c]=e[c]||{},a=e[c][t],s=e[c][t]=function(e,t){return this._createWidget?(arguments.length&&this._createWidget(e,t),void 0):new s(e,t)},e.extend(s,a,{version:i.version,_proto:e.extend({},i),_childConstructors:[]}),r=new n,r.options=e.widget.extend({},r.options),e.each(i,function(t,i){return e.isFunction(i)?(l[t]=function(){var e=function(){return n.prototype[t].apply(this,arguments)},o=function(e){return n.prototype[t].apply(this,e)};return function(){var t,n=this._super,a=this._superApply;return this._super=e,this._superApply=o,t=i.apply(this,arguments),this._super=n,this._superApply=a,t}}(),void 0):(l[t]=i,void 0)}),s.prototype=e.widget.extend(r,{widgetEventPrefix:a?r.widgetEventPrefix:t},l,{constructor:s,namespace:c,widgetName:t,widgetFullName:o}),a?(e.each(a._childConstructors,function(t,n){var i=n.prototype;e.widget(i.namespace+"."+i.widgetName,s,n._proto)}),delete a._childConstructors):n._childConstructors.push(s),e.widget.bridge(t,s)},e.widget.extend=function(n){for(var o,a,s=i.call(arguments,1),r=0,l=s.length;l>r;r++)for(o in s[r])a=s[r][o],s[r].hasOwnProperty(o)&&a!==t&&(n[o]=e.isPlainObject(a)?e.isPlainObject(n[o])?e.widget.extend({},n[o],a):e.widget.extend({},a):a);return n},e.widget.bridge=function(n,o){var a=o.prototype.widgetFullName||n;e.fn[n]=function(s){var r="string"==typeof s,l=i.call(arguments,1),c=this;return s=!r&&l.length?e.widget.extend.apply(null,[s].concat(l)):s,r?this.each(function(){var i,o=e.data(this,a);return o?e.isFunction(o[s])&&"_"!==s.charAt(0)?(i=o[s].apply(o,l),i!==o&&i!==t?(c=i&&i.jquery?c.pushStack(i.get()):i,!1):void 0):e.error("no such method '"+s+"' for "+n+" widget instance"):e.error("cannot call methods on "+n+" prior to initialization; "+"attempted to call method '"+s+"'")}):this.each(function(){var t=e.data(this,a);t?t.option(s||{})._init():e.data(this,a,new o(s,this))}),c}},e.Widget=function(){},e.Widget._childConstructors=[],e.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",defaultElement:"<div>",options:{disabled:!1,create:null},_createWidget:function(t,i){i=e(i||this.defaultElement||this)[0],this.element=e(i),this.uuid=n++,this.eventNamespace="."+this.widgetName+this.uuid,this.options=e.widget.extend({},this.options,this._getCreateOptions(),t),this.bindings=e(),this.hoverable=e(),this.focusable=e(),i!==this&&(e.data(i,this.widgetFullName,this),this._on(!0,this.element,{remove:function(e){e.target===i&&this.destroy()}}),this.document=e(i.style?i.ownerDocument:i.document||i),this.window=e(this.document[0].defaultView||this.document[0].parentWindow)),this._create(),this._trigger("create",null,this._getCreateEventData()),this._init()},_getCreateOptions:e.noop,_getCreateEventData:e.noop,_create:e.noop,_init:e.noop,destroy:function(){this._destroy(),this.element.unbind(this.eventNamespace).removeData(this.widgetName).removeData(this.widgetFullName).removeData(e.camelCase(this.widgetFullName)),this.widget().unbind(this.eventNamespace).removeAttr("aria-disabled").removeClass(this.widgetFullName+"-disabled "+"ui-state-disabled"),this.bindings.unbind(this.eventNamespace),this.hoverable.removeClass("ui-state-hover"),this.focusable.removeClass("ui-state-focus")},_destroy:e.noop,widget:function(){return this.element},option:function(n,i){var o,a,s,r=n;if(0===arguments.length)return e.widget.extend({},this.options);if("string"==typeof n)if(r={},o=n.split("."),n=o.shift(),o.length){for(a=r[n]=e.widget.extend({},this.options[n]),s=0;o.length-1>s;s++)a[o[s]]=a[o[s]]||{},a=a[o[s]];if(n=o.pop(),i===t)return a[n]===t?null:a[n];a[n]=i}else{if(i===t)return this.options[n]===t?null:this.options[n];r[n]=i}return this._setOptions(r),this},_setOptions:function(e){var t;for(t in e)this._setOption(t,e[t]);return this},_setOption:function(e,t){return this.options[e]=t,"disabled"===e&&(this.widget().toggleClass(this.widgetFullName+"-disabled ui-state-disabled",!!t).attr("aria-disabled",t),this.hoverable.removeClass("ui-state-hover"),this.focusable.removeClass("ui-state-focus")),this},enable:function(){return this._setOption("disabled",!1)},disable:function(){return this._setOption("disabled",!0)},_on:function(t,n,i){var o,a=this;"boolean"!=typeof t&&(i=n,n=t,t=!1),i?(n=o=e(n),this.bindings=this.bindings.add(n)):(i=n,n=this.element,o=this.widget()),e.each(i,function(i,s){function r(){return t||a.options.disabled!==!0&&!e(this).hasClass("ui-state-disabled")?("string"==typeof s?a[s]:s).apply(a,arguments):void 0}"string"!=typeof s&&(r.guid=s.guid=s.guid||r.guid||e.guid++);var l=i.match(/^(\w+)\s*(.*)$/),c=l[1]+a.eventNamespace,u=l[2];u?o.delegate(u,c,r):n.bind(c,r)})},_off:function(e,t){t=(t||"").split(" ").join(this.eventNamespace+" ")+this.eventNamespace,e.unbind(t).undelegate(t)},_delay:function(e,t){function n(){return("string"==typeof e?i[e]:e).apply(i,arguments)}var i=this;return setTimeout(n,t||0)},_hoverable:function(t){this.hoverable=this.hoverable.add(t),this._on(t,{mouseenter:function(t){e(t.currentTarget).addClass("ui-state-hover")},mouseleave:function(t){e(t.currentTarget).removeClass("ui-state-hover")}})},_focusable:function(t){this.focusable=this.focusable.add(t),this._on(t,{focusin:function(t){e(t.currentTarget).addClass("ui-state-focus")},focusout:function(t){e(t.currentTarget).removeClass("ui-state-focus")}})},_trigger:function(t,n,i){var o,a,s=this.options[t];if(i=i||{},n=e.Event(n),n.type=(t===this.widgetEventPrefix?t:this.widgetEventPrefix+t).toLowerCase(),n.target=this.element[0],a=n.originalEvent,a)for(o in a)o in n||(n[o]=a[o]);return this.element.trigger(n,i),!(e.isFunction(s)&&s.apply(this.element[0],[n].concat(i))===!1||n.isDefaultPrevented())}},e.each({show:"fadeIn",hide:"fadeOut"},function(t,n){e.Widget.prototype["_"+t]=function(i,o,a){"string"==typeof o&&(o={effect:o});var s,r=o?o===!0||"number"==typeof o?n:o.effect||n:t;o=o||{},"number"==typeof o&&(o={duration:o}),s=!e.isEmptyObject(o),o.complete=a,o.delay&&i.delay(o.delay),s&&e.effects&&e.effects.effect[r]?i[t](o):r!==t&&i[r]?i[r](o.duration,o.easing,a):i.queue(function(n){e(this)[t](),a&&a.call(i[0]),n()})}})}(jQuery),function(e){var t=!1;e(document).mouseup(function(){t=!1}),e.widget("ui.mouse",{version:"1.10.0",options:{cancel:"input,textarea,button,select,option",distance:1,delay:0},_mouseInit:function(){var t=this;this.element.bind("mousedown."+this.widgetName,function(e){return t._mouseDown(e)}).bind("click."+this.widgetName,function(n){return!0===e.data(n.target,t.widgetName+".preventClickEvent")?(e.removeData(n.target,t.widgetName+".preventClickEvent"),n.stopImmediatePropagation(),!1):void 0}),this.started=!1},_mouseDestroy:function(){this.element.unbind("."+this.widgetName),this._mouseMoveDelegate&&e(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate)},_mouseDown:function(n){if(!t){this._mouseStarted&&this._mouseUp(n),this._mouseDownEvent=n;var i=this,o=1===n.which,a="string"==typeof this.options.cancel&&n.target.nodeName?e(n.target).closest(this.options.cancel).length:!1;return o&&!a&&this._mouseCapture(n)?(this.mouseDelayMet=!this.options.delay,this.mouseDelayMet||(this._mouseDelayTimer=setTimeout(function(){i.mouseDelayMet=!0},this.options.delay)),this._mouseDistanceMet(n)&&this._mouseDelayMet(n)&&(this._mouseStarted=this._mouseStart(n)!==!1,!this._mouseStarted)?(n.preventDefault(),!0):(!0===e.data(n.target,this.widgetName+".preventClickEvent")&&e.removeData(n.target,this.widgetName+".preventClickEvent"),this._mouseMoveDelegate=function(e){return i._mouseMove(e)},this._mouseUpDelegate=function(e){return i._mouseUp(e)},e(document).bind("mousemove."+this.widgetName,this._mouseMoveDelegate).bind("mouseup."+this.widgetName,this._mouseUpDelegate),n.preventDefault(),t=!0,!0)):!0}},_mouseMove:function(t){return e.ui.ie&&(!document.documentMode||9>document.documentMode)&&!t.button?this._mouseUp(t):this._mouseStarted?(this._mouseDrag(t),t.preventDefault()):(this._mouseDistanceMet(t)&&this._mouseDelayMet(t)&&(this._mouseStarted=this._mouseStart(this._mouseDownEvent,t)!==!1,this._mouseStarted?this._mouseDrag(t):this._mouseUp(t)),!this._mouseStarted)},_mouseUp:function(t){return e(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate),this._mouseStarted&&(this._mouseStarted=!1,t.target===this._mouseDownEvent.target&&e.data(t.target,this.widgetName+".preventClickEvent",!0),this._mouseStop(t)),!1},_mouseDistanceMet:function(e){return Math.max(Math.abs(this._mouseDownEvent.pageX-e.pageX),Math.abs(this._mouseDownEvent.pageY-e.pageY))>=this.options.distance},_mouseDelayMet:function(){return this.mouseDelayMet},_mouseStart:function(){},_mouseDrag:function(){},_mouseStop:function(){},_mouseCapture:function(){return!0}})}(jQuery),function(e,t){function n(e,t,n){return[parseInt(e[0],10)*(p.test(e[0])?t/100:1),parseInt(e[1],10)*(p.test(e[1])?n/100:1)]}function i(t,n){return parseInt(e.css(t,n),10)||0}function o(t){var n=t[0];return 9===n.nodeType?{width:t.width(),height:t.height(),offset:{top:0,left:0}}:e.isWindow(n)?{width:t.width(),height:t.height(),offset:{top:t.scrollTop(),left:t.scrollLeft()}}:n.preventDefault?{width:0,height:0,offset:{top:n.pageY,left:n.pageX}}:{width:t.outerWidth(),height:t.outerHeight(),offset:t.offset()}}e.ui=e.ui||{};var a,s=Math.max,r=Math.abs,l=Math.round,c=/left|center|right/,u=/top|center|bottom/,h=/[\+\-]\d+%?/,d=/^\w+/,p=/%$/,f=e.fn.position;e.position={scrollbarWidth:function(){if(a!==t)return a;var n,i,o=e("<div style='display:block;width:50px;height:50px;overflow:hidden;'><div style='height:100px;width:auto;'></div></div>"),s=o.children()[0];return e("body").append(o),n=s.offsetWidth,o.css("overflow","scroll"),i=s.offsetWidth,n===i&&(i=o[0].clientWidth),o.remove(),a=n-i},getScrollInfo:function(t){var n=t.isWindow?"":t.element.css("overflow-x"),i=t.isWindow?"":t.element.css("overflow-y"),o="scroll"===n||"auto"===n&&t.width<t.element[0].scrollWidth,a="scroll"===i||"auto"===i&&t.height<t.element[0].scrollHeight;return{width:o?e.position.scrollbarWidth():0,height:a?e.position.scrollbarWidth():0}},getWithinInfo:function(t){var n=e(t||window),i=e.isWindow(n[0]);return{element:n,isWindow:i,offset:n.offset()||{left:0,top:0},scrollLeft:n.scrollLeft(),scrollTop:n.scrollTop(),width:i?n.width():n.outerWidth(),height:i?n.height():n.outerHeight()}}},e.fn.position=function(t){if(!t||!t.of)return f.apply(this,arguments);t=e.extend({},t);var a,p,m,g,_,v,y=e(t.of),w=e.position.getWithinInfo(t.within),b=e.position.getScrollInfo(w),x=(t.collision||"flip").split(" "),k={};return v=o(y),y[0].preventDefault&&(t.at="left top"),p=v.width,m=v.height,g=v.offset,_=e.extend({},g),e.each(["my","at"],function(){var e,n,i=(t[this]||"").split(" ");1===i.length&&(i=c.test(i[0])?i.concat(["center"]):u.test(i[0])?["center"].concat(i):["center","center"]),i[0]=c.test(i[0])?i[0]:"center",i[1]=u.test(i[1])?i[1]:"center",e=h.exec(i[0]),n=h.exec(i[1]),k[this]=[e?e[0]:0,n?n[0]:0],t[this]=[d.exec(i[0])[0],d.exec(i[1])[0]]}),1===x.length&&(x[1]=x[0]),"right"===t.at[0]?_.left+=p:"center"===t.at[0]&&(_.left+=p/2),"bottom"===t.at[1]?_.top+=m:"center"===t.at[1]&&(_.top+=m/2),a=n(k.at,p,m),_.left+=a[0],_.top+=a[1],this.each(function(){var o,c,u=e(this),h=u.outerWidth(),d=u.outerHeight(),f=i(this,"marginLeft"),v=i(this,"marginTop"),C=h+f+i(this,"marginRight")+b.width,E=d+v+i(this,"marginBottom")+b.height,T=e.extend({},_),S=n(k.my,u.outerWidth(),u.outerHeight());"right"===t.my[0]?T.left-=h:"center"===t.my[0]&&(T.left-=h/2),"bottom"===t.my[1]?T.top-=d:"center"===t.my[1]&&(T.top-=d/2),T.left+=S[0],T.top+=S[1],e.support.offsetFractions||(T.left=l(T.left),T.top=l(T.top)),o={marginLeft:f,marginTop:v},e.each(["left","top"],function(n,i){e.ui.position[x[n]]&&e.ui.position[x[n]][i](T,{targetWidth:p,targetHeight:m,elemWidth:h,elemHeight:d,collisionPosition:o,collisionWidth:C,collisionHeight:E,offset:[a[0]+S[0],a[1]+S[1]],my:t.my,at:t.at,within:w,elem:u})}),t.using&&(c=function(e){var n=g.left-T.left,i=n+p-h,o=g.top-T.top,a=o+m-d,l={target:{element:y,left:g.left,top:g.top,width:p,height:m},element:{element:u,left:T.left,top:T.top,width:h,height:d},horizontal:0>i?"left":n>0?"right":"center",vertical:0>a?"top":o>0?"bottom":"middle"};h>p&&p>r(n+i)&&(l.horizontal="center"),d>m&&m>r(o+a)&&(l.vertical="middle"),l.important=s(r(n),r(i))>s(r(o),r(a))?"horizontal":"vertical",t.using.call(this,e,l)}),u.offset(e.extend(T,{using:c}))})},e.ui.position={fit:{left:function(e,t){var n,i=t.within,o=i.isWindow?i.scrollLeft:i.offset.left,a=i.width,r=e.left-t.collisionPosition.marginLeft,l=o-r,c=r+t.collisionWidth-a-o;t.collisionWidth>a?l>0&&0>=c?(n=e.left+l+t.collisionWidth-a-o,e.left+=l-n):e.left=c>0&&0>=l?o:l>c?o+a-t.collisionWidth:o:l>0?e.left+=l:c>0?e.left-=c:e.left=s(e.left-r,e.left)},top:function(e,t){var n,i=t.within,o=i.isWindow?i.scrollTop:i.offset.top,a=t.within.height,r=e.top-t.collisionPosition.marginTop,l=o-r,c=r+t.collisionHeight-a-o;t.collisionHeight>a?l>0&&0>=c?(n=e.top+l+t.collisionHeight-a-o,e.top+=l-n):e.top=c>0&&0>=l?o:l>c?o+a-t.collisionHeight:o:l>0?e.top+=l:c>0?e.top-=c:e.top=s(e.top-r,e.top)}},flip:{left:function(e,t){var n,i,o=t.within,a=o.offset.left+o.scrollLeft,s=o.width,l=o.isWindow?o.scrollLeft:o.offset.left,c=e.left-t.collisionPosition.marginLeft,u=c-l,h=c+t.collisionWidth-s-l,d="left"===t.my[0]?-t.elemWidth:"right"===t.my[0]?t.elemWidth:0,p="left"===t.at[0]?t.targetWidth:"right"===t.at[0]?-t.targetWidth:0,f=-2*t.offset[0];0>u?(n=e.left+d+p+f+t.collisionWidth-s-a,(0>n||r(u)>n)&&(e.left+=d+p+f)):h>0&&(i=e.left-t.collisionPosition.marginLeft+d+p+f-l,(i>0||h>r(i))&&(e.left+=d+p+f))},top:function(e,t){var n,i,o=t.within,a=o.offset.top+o.scrollTop,s=o.height,l=o.isWindow?o.scrollTop:o.offset.top,c=e.top-t.collisionPosition.marginTop,u=c-l,h=c+t.collisionHeight-s-l,d="top"===t.my[1],p=d?-t.elemHeight:"bottom"===t.my[1]?t.elemHeight:0,f="top"===t.at[1]?t.targetHeight:"bottom"===t.at[1]?-t.targetHeight:0,m=-2*t.offset[1];
0>u?(i=e.top+p+f+m+t.collisionHeight-s-a,e.top+p+f+m>u&&(0>i||r(u)>i)&&(e.top+=p+f+m)):h>0&&(n=e.top-t.collisionPosition.marginTop+p+f+m-l,e.top+p+f+m>h&&(n>0||h>r(n))&&(e.top+=p+f+m))}},flipfit:{left:function(){e.ui.position.flip.left.apply(this,arguments),e.ui.position.fit.left.apply(this,arguments)},top:function(){e.ui.position.flip.top.apply(this,arguments),e.ui.position.fit.top.apply(this,arguments)}}},function(){var t,n,i,o,a,s=document.getElementsByTagName("body")[0],r=document.createElement("div");t=document.createElement(s?"div":"body"),i={visibility:"hidden",width:0,height:0,border:0,margin:0,background:"none"},s&&e.extend(i,{position:"absolute",left:"-1000px",top:"-1000px"});for(a in i)t.style[a]=i[a];t.appendChild(r),n=s||document.documentElement,n.insertBefore(t,n.firstChild),r.style.cssText="position: absolute; left: 10.7432222px;",o=e(r).offset().left,e.support.offsetFractions=o>10&&11>o,t.innerHTML="",n.removeChild(t)}()}(jQuery),function(e){e.widget("ui.draggable",e.ui.mouse,{version:"1.10.0",widgetEventPrefix:"drag",options:{addClasses:!0,appendTo:"parent",axis:!1,connectToSortable:!1,containment:!1,cursor:"auto",cursorAt:!1,grid:!1,handle:!1,helper:"original",iframeFix:!1,opacity:!1,refreshPositions:!1,revert:!1,revertDuration:500,scope:"default",scroll:!0,scrollSensitivity:20,scrollSpeed:20,snap:!1,snapMode:"both",snapTolerance:20,stack:!1,zIndex:!1,drag:null,start:null,stop:null},_create:function(){"original"===this.options.helper&&!/^(?:r|a|f)/.test(this.element.css("position"))&&(this.element[0].style.position="relative"),this.options.addClasses&&this.element.addClass("ui-draggable"),this.options.disabled&&this.element.addClass("ui-draggable-disabled"),this._mouseInit()},_destroy:function(){this.element.removeClass("ui-draggable ui-draggable-dragging ui-draggable-disabled"),this._mouseDestroy()},_mouseCapture:function(t){var n=this.options;return this.helper||n.disabled||e(t.target).closest(".ui-resizable-handle").length>0?!1:(this.handle=this._getHandle(t),this.handle?(e(n.iframeFix===!0?"iframe":n.iframeFix).each(function(){e("<div class='ui-draggable-iframeFix' style='background: #fff;'></div>").css({width:this.offsetWidth+"px",height:this.offsetHeight+"px",position:"absolute",opacity:"0.001",zIndex:1e3}).css(e(this).offset()).appendTo("body")}),!0):!1)},_mouseStart:function(t){var n=this.options;return this.helper=this._createHelper(t),this.helper.addClass("ui-draggable-dragging"),this._cacheHelperProportions(),e.ui.ddmanager&&(e.ui.ddmanager.current=this),this._cacheMargins(),this.cssPosition=this.helper.css("position"),this.scrollParent=this.helper.scrollParent(),this.offset=this.positionAbs=this.element.offset(),this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left},e.extend(this.offset,{click:{left:t.pageX-this.offset.left,top:t.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()}),this.originalPosition=this.position=this._generatePosition(t),this.originalPageX=t.pageX,this.originalPageY=t.pageY,n.cursorAt&&this._adjustOffsetFromHelper(n.cursorAt),n.containment&&this._setContainment(),this._trigger("start",t)===!1?(this._clear(),!1):(this._cacheHelperProportions(),e.ui.ddmanager&&!n.dropBehaviour&&e.ui.ddmanager.prepareOffsets(this,t),this._mouseDrag(t,!0),e.ui.ddmanager&&e.ui.ddmanager.dragStart(this,t),!0)},_mouseDrag:function(t,n){if(this.position=this._generatePosition(t),this.positionAbs=this._convertPositionTo("absolute"),!n){var i=this._uiHash();if(this._trigger("drag",t,i)===!1)return this._mouseUp({}),!1;this.position=i.position}return this.options.axis&&"y"===this.options.axis||(this.helper[0].style.left=this.position.left+"px"),this.options.axis&&"x"===this.options.axis||(this.helper[0].style.top=this.position.top+"px"),e.ui.ddmanager&&e.ui.ddmanager.drag(this,t),!1},_mouseStop:function(t){var n,i=this,o=!1,a=!1;for(e.ui.ddmanager&&!this.options.dropBehaviour&&(a=e.ui.ddmanager.drop(this,t)),this.dropped&&(a=this.dropped,this.dropped=!1),n=this.element[0];n&&(n=n.parentNode);)n===document&&(o=!0);return o||"original"!==this.options.helper?("invalid"===this.options.revert&&!a||"valid"===this.options.revert&&a||this.options.revert===!0||e.isFunction(this.options.revert)&&this.options.revert.call(this.element,a)?e(this.helper).animate(this.originalPosition,parseInt(this.options.revertDuration,10),function(){i._trigger("stop",t)!==!1&&i._clear()}):this._trigger("stop",t)!==!1&&this._clear(),!1):!1},_mouseUp:function(t){return e("div.ui-draggable-iframeFix").each(function(){this.parentNode.removeChild(this)}),e.ui.ddmanager&&e.ui.ddmanager.dragStop(this,t),e.ui.mouse.prototype._mouseUp.call(this,t)},cancel:function(){return this.helper.is(".ui-draggable-dragging")?this._mouseUp({}):this._clear(),this},_getHandle:function(t){var n=this.options.handle&&e(this.options.handle,this.element).length?!1:!0;return e(this.options.handle,this.element).find("*").addBack().each(function(){this===t.target&&(n=!0)}),n},_createHelper:function(t){var n=this.options,i=e.isFunction(n.helper)?e(n.helper.apply(this.element[0],[t])):"clone"===n.helper?this.element.clone().removeAttr("id"):this.element;return i.parents("body").length||i.appendTo("parent"===n.appendTo?this.element[0].parentNode:n.appendTo),i[0]!==this.element[0]&&!/(fixed|absolute)/.test(i.css("position"))&&i.css("position","absolute"),i},_adjustOffsetFromHelper:function(t){"string"==typeof t&&(t=t.split(" ")),e.isArray(t)&&(t={left:+t[0],top:+t[1]||0}),"left"in t&&(this.offset.click.left=t.left+this.margins.left),"right"in t&&(this.offset.click.left=this.helperProportions.width-t.right+this.margins.left),"top"in t&&(this.offset.click.top=t.top+this.margins.top),"bottom"in t&&(this.offset.click.top=this.helperProportions.height-t.bottom+this.margins.top)},_getParentOffset:function(){this.offsetParent=this.helper.offsetParent();var t=this.offsetParent.offset();return"absolute"===this.cssPosition&&this.scrollParent[0]!==document&&e.contains(this.scrollParent[0],this.offsetParent[0])&&(t.left+=this.scrollParent.scrollLeft(),t.top+=this.scrollParent.scrollTop()),(this.offsetParent[0]===document.body||this.offsetParent[0].tagName&&"html"===this.offsetParent[0].tagName.toLowerCase()&&e.ui.ie)&&(t={top:0,left:0}),{top:t.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:t.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if("relative"===this.cssPosition){var e=this.element.position();return{top:e.top-(parseInt(this.helper.css("top"),10)||0)+this.scrollParent.scrollTop(),left:e.left-(parseInt(this.helper.css("left"),10)||0)+this.scrollParent.scrollLeft()}}return{top:0,left:0}},_cacheMargins:function(){this.margins={left:parseInt(this.element.css("marginLeft"),10)||0,top:parseInt(this.element.css("marginTop"),10)||0,right:parseInt(this.element.css("marginRight"),10)||0,bottom:parseInt(this.element.css("marginBottom"),10)||0}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},_setContainment:function(){var t,n,i,o=this.options;if("parent"===o.containment&&(o.containment=this.helper[0].parentNode),("document"===o.containment||"window"===o.containment)&&(this.containment=["document"===o.containment?0:e(window).scrollLeft()-this.offset.relative.left-this.offset.parent.left,"document"===o.containment?0:e(window).scrollTop()-this.offset.relative.top-this.offset.parent.top,("document"===o.containment?0:e(window).scrollLeft())+e("document"===o.containment?document:window).width()-this.helperProportions.width-this.margins.left,("document"===o.containment?0:e(window).scrollTop())+(e("document"===o.containment?document:window).height()||document.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top]),/^(document|window|parent)$/.test(o.containment)||o.containment.constructor===Array)o.containment.constructor===Array&&(this.containment=o.containment);else{if(n=e(o.containment),i=n[0],!i)return;t="hidden"!==e(i).css("overflow"),this.containment=[(parseInt(e(i).css("borderLeftWidth"),10)||0)+(parseInt(e(i).css("paddingLeft"),10)||0),(parseInt(e(i).css("borderTopWidth"),10)||0)+(parseInt(e(i).css("paddingTop"),10)||0),(t?Math.max(i.scrollWidth,i.offsetWidth):i.offsetWidth)-(parseInt(e(i).css("borderLeftWidth"),10)||0)-(parseInt(e(i).css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left-this.margins.right,(t?Math.max(i.scrollHeight,i.offsetHeight):i.offsetHeight)-(parseInt(e(i).css("borderTopWidth"),10)||0)-(parseInt(e(i).css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top-this.margins.bottom],this.relative_container=n}},_convertPositionTo:function(t,n){n||(n=this.position);var i="absolute"===t?1:-1,o="absolute"!==this.cssPosition||this.scrollParent[0]!==document&&e.contains(this.scrollParent[0],this.offsetParent[0])?this.scrollParent:this.offsetParent,a=/(html|body)/i.test(o[0].tagName);return{top:n.top+this.offset.relative.top*i+this.offset.parent.top*i-("fixed"===this.cssPosition?-this.scrollParent.scrollTop():a?0:o.scrollTop())*i,left:n.left+this.offset.relative.left*i+this.offset.parent.left*i-("fixed"===this.cssPosition?-this.scrollParent.scrollLeft():a?0:o.scrollLeft())*i}},_generatePosition:function(t){var n,i,o,a,s=this.options,r="absolute"!==this.cssPosition||this.scrollParent[0]!==document&&e.contains(this.scrollParent[0],this.offsetParent[0])?this.scrollParent:this.offsetParent,l=/(html|body)/i.test(r[0].tagName),c=t.pageX,u=t.pageY;return this.originalPosition&&(this.containment&&(this.relative_container?(i=this.relative_container.offset(),n=[this.containment[0]+i.left,this.containment[1]+i.top,this.containment[2]+i.left,this.containment[3]+i.top]):n=this.containment,t.pageX-this.offset.click.left<n[0]&&(c=n[0]+this.offset.click.left),t.pageY-this.offset.click.top<n[1]&&(u=n[1]+this.offset.click.top),t.pageX-this.offset.click.left>n[2]&&(c=n[2]+this.offset.click.left),t.pageY-this.offset.click.top>n[3]&&(u=n[3]+this.offset.click.top)),s.grid&&(o=s.grid[1]?this.originalPageY+Math.round((u-this.originalPageY)/s.grid[1])*s.grid[1]:this.originalPageY,u=n?o-this.offset.click.top>=n[1]||o-this.offset.click.top>n[3]?o:o-this.offset.click.top>=n[1]?o-s.grid[1]:o+s.grid[1]:o,a=s.grid[0]?this.originalPageX+Math.round((c-this.originalPageX)/s.grid[0])*s.grid[0]:this.originalPageX,c=n?a-this.offset.click.left>=n[0]||a-this.offset.click.left>n[2]?a:a-this.offset.click.left>=n[0]?a-s.grid[0]:a+s.grid[0]:a)),{top:u-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+("fixed"===this.cssPosition?-this.scrollParent.scrollTop():l?0:r.scrollTop()),left:c-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+("fixed"===this.cssPosition?-this.scrollParent.scrollLeft():l?0:r.scrollLeft())}},_clear:function(){this.helper.removeClass("ui-draggable-dragging"),this.helper[0]!==this.element[0]&&!this.cancelHelperRemoval&&this.helper.remove(),this.helper=null,this.cancelHelperRemoval=!1},_trigger:function(t,n,i){return i=i||this._uiHash(),e.ui.plugin.call(this,t,[n,i]),"drag"===t&&(this.positionAbs=this._convertPositionTo("absolute")),e.Widget.prototype._trigger.call(this,t,n,i)},plugins:{},_uiHash:function(){return{helper:this.helper,position:this.position,originalPosition:this.originalPosition,offset:this.positionAbs}}}),e.ui.plugin.add("draggable","connectToSortable",{start:function(t,n){var i=e(this).data("ui-draggable"),o=i.options,a=e.extend({},n,{item:i.element});i.sortables=[],e(o.connectToSortable).each(function(){var n=e.data(this,"ui-sortable");n&&!n.options.disabled&&(i.sortables.push({instance:n,shouldRevert:n.options.revert}),n.refreshPositions(),n._trigger("activate",t,a))})},stop:function(t,n){var i=e(this).data("ui-draggable"),o=e.extend({},n,{item:i.element});e.each(i.sortables,function(){this.instance.isOver?(this.instance.isOver=0,i.cancelHelperRemoval=!0,this.instance.cancelHelperRemoval=!1,this.shouldRevert&&(this.instance.options.revert=!0),this.instance._mouseStop(t),this.instance.options.helper=this.instance.options._helper,"original"===i.options.helper&&this.instance.currentItem.css({top:"auto",left:"auto"})):(this.instance.cancelHelperRemoval=!1,this.instance._trigger("deactivate",t,o))})},drag:function(t,n){var i=e(this).data("ui-draggable"),o=this;e.each(i.sortables,function(){var a=!1,s=this;this.instance.positionAbs=i.positionAbs,this.instance.helperProportions=i.helperProportions,this.instance.offset.click=i.offset.click,this.instance._intersectsWith(this.instance.containerCache)&&(a=!0,e.each(i.sortables,function(){return this.instance.positionAbs=i.positionAbs,this.instance.helperProportions=i.helperProportions,this.instance.offset.click=i.offset.click,this!==s&&this.instance._intersectsWith(this.instance.containerCache)&&e.ui.contains(s.instance.element[0],this.instance.element[0])&&(a=!1),a})),a?(this.instance.isOver||(this.instance.isOver=1,this.instance.currentItem=e(o).clone().removeAttr("id").appendTo(this.instance.element).data("ui-sortable-item",!0),this.instance.options._helper=this.instance.options.helper,this.instance.options.helper=function(){return n.helper[0]},t.target=this.instance.currentItem[0],this.instance._mouseCapture(t,!0),this.instance._mouseStart(t,!0,!0),this.instance.offset.click.top=i.offset.click.top,this.instance.offset.click.left=i.offset.click.left,this.instance.offset.parent.left-=i.offset.parent.left-this.instance.offset.parent.left,this.instance.offset.parent.top-=i.offset.parent.top-this.instance.offset.parent.top,i._trigger("toSortable",t),i.dropped=this.instance.element,i.currentItem=i.element,this.instance.fromOutside=i),this.instance.currentItem&&this.instance._mouseDrag(t)):this.instance.isOver&&(this.instance.isOver=0,this.instance.cancelHelperRemoval=!0,this.instance.options.revert=!1,this.instance._trigger("out",t,this.instance._uiHash(this.instance)),this.instance._mouseStop(t,!0),this.instance.options.helper=this.instance.options._helper,this.instance.currentItem.remove(),this.instance.placeholder&&this.instance.placeholder.remove(),i._trigger("fromSortable",t),i.dropped=!1)})}}),e.ui.plugin.add("draggable","cursor",{start:function(){var t=e("body"),n=e(this).data("ui-draggable").options;t.css("cursor")&&(n._cursor=t.css("cursor")),t.css("cursor",n.cursor)},stop:function(){var t=e(this).data("ui-draggable").options;t._cursor&&e("body").css("cursor",t._cursor)}}),e.ui.plugin.add("draggable","opacity",{start:function(t,n){var i=e(n.helper),o=e(this).data("ui-draggable").options;i.css("opacity")&&(o._opacity=i.css("opacity")),i.css("opacity",o.opacity)},stop:function(t,n){var i=e(this).data("ui-draggable").options;i._opacity&&e(n.helper).css("opacity",i._opacity)}}),e.ui.plugin.add("draggable","scroll",{start:function(){var t=e(this).data("ui-draggable");t.scrollParent[0]!==document&&"HTML"!==t.scrollParent[0].tagName&&(t.overflowOffset=t.scrollParent.offset())},drag:function(t){var n=e(this).data("ui-draggable"),i=n.options,o=!1;n.scrollParent[0]!==document&&"HTML"!==n.scrollParent[0].tagName?(i.axis&&"x"===i.axis||(n.overflowOffset.top+n.scrollParent[0].offsetHeight-t.pageY<i.scrollSensitivity?n.scrollParent[0].scrollTop=o=n.scrollParent[0].scrollTop+i.scrollSpeed:t.pageY-n.overflowOffset.top<i.scrollSensitivity&&(n.scrollParent[0].scrollTop=o=n.scrollParent[0].scrollTop-i.scrollSpeed)),i.axis&&"y"===i.axis||(n.overflowOffset.left+n.scrollParent[0].offsetWidth-t.pageX<i.scrollSensitivity?n.scrollParent[0].scrollLeft=o=n.scrollParent[0].scrollLeft+i.scrollSpeed:t.pageX-n.overflowOffset.left<i.scrollSensitivity&&(n.scrollParent[0].scrollLeft=o=n.scrollParent[0].scrollLeft-i.scrollSpeed))):(i.axis&&"x"===i.axis||(t.pageY-e(document).scrollTop()<i.scrollSensitivity?o=e(document).scrollTop(e(document).scrollTop()-i.scrollSpeed):e(window).height()-(t.pageY-e(document).scrollTop())<i.scrollSensitivity&&(o=e(document).scrollTop(e(document).scrollTop()+i.scrollSpeed))),i.axis&&"y"===i.axis||(t.pageX-e(document).scrollLeft()<i.scrollSensitivity?o=e(document).scrollLeft(e(document).scrollLeft()-i.scrollSpeed):e(window).width()-(t.pageX-e(document).scrollLeft())<i.scrollSensitivity&&(o=e(document).scrollLeft(e(document).scrollLeft()+i.scrollSpeed)))),o!==!1&&e.ui.ddmanager&&!i.dropBehaviour&&e.ui.ddmanager.prepareOffsets(n,t)}}),e.ui.plugin.add("draggable","snap",{start:function(){var t=e(this).data("ui-draggable"),n=t.options;t.snapElements=[],e(n.snap.constructor!==String?n.snap.items||":data(ui-draggable)":n.snap).each(function(){var n=e(this),i=n.offset();this!==t.element[0]&&t.snapElements.push({item:this,width:n.outerWidth(),height:n.outerHeight(),top:i.top,left:i.left})})},drag:function(t,n){var i,o,a,s,r,l,c,u,h,d,p=e(this).data("ui-draggable"),f=p.options,m=f.snapTolerance,g=n.offset.left,_=g+p.helperProportions.width,v=n.offset.top,y=v+p.helperProportions.height;for(h=p.snapElements.length-1;h>=0;h--)r=p.snapElements[h].left,l=r+p.snapElements[h].width,c=p.snapElements[h].top,u=c+p.snapElements[h].height,g>r-m&&l+m>g&&v>c-m&&u+m>v||g>r-m&&l+m>g&&y>c-m&&u+m>y||_>r-m&&l+m>_&&v>c-m&&u+m>v||_>r-m&&l+m>_&&y>c-m&&u+m>y?("inner"!==f.snapMode&&(i=m>=Math.abs(c-y),o=m>=Math.abs(u-v),a=m>=Math.abs(r-_),s=m>=Math.abs(l-g),i&&(n.position.top=p._convertPositionTo("relative",{top:c-p.helperProportions.height,left:0}).top-p.margins.top),o&&(n.position.top=p._convertPositionTo("relative",{top:u,left:0}).top-p.margins.top),a&&(n.position.left=p._convertPositionTo("relative",{top:0,left:r-p.helperProportions.width}).left-p.margins.left),s&&(n.position.left=p._convertPositionTo("relative",{top:0,left:l}).left-p.margins.left)),d=i||o||a||s,"outer"!==f.snapMode&&(i=m>=Math.abs(c-v),o=m>=Math.abs(u-y),a=m>=Math.abs(r-g),s=m>=Math.abs(l-_),i&&(n.position.top=p._convertPositionTo("relative",{top:c,left:0}).top-p.margins.top),o&&(n.position.top=p._convertPositionTo("relative",{top:u-p.helperProportions.height,left:0}).top-p.margins.top),a&&(n.position.left=p._convertPositionTo("relative",{top:0,left:r}).left-p.margins.left),s&&(n.position.left=p._convertPositionTo("relative",{top:0,left:l-p.helperProportions.width}).left-p.margins.left)),!p.snapElements[h].snapping&&(i||o||a||s||d)&&p.options.snap.snap&&p.options.snap.snap.call(p.element,t,e.extend(p._uiHash(),{snapItem:p.snapElements[h].item})),p.snapElements[h].snapping=i||o||a||s||d):(p.snapElements[h].snapping&&p.options.snap.release&&p.options.snap.release.call(p.element,t,e.extend(p._uiHash(),{snapItem:p.snapElements[h].item})),p.snapElements[h].snapping=!1)}}),e.ui.plugin.add("draggable","stack",{start:function(){var t,n=e(this).data("ui-draggable").options,i=e.makeArray(e(n.stack)).sort(function(t,n){return(parseInt(e(t).css("zIndex"),10)||0)-(parseInt(e(n).css("zIndex"),10)||0)});i.length&&(t=parseInt(i[0].style.zIndex,10)||0,e(i).each(function(e){this.style.zIndex=t+e}),this[0].style.zIndex=t+i.length)}}),e.ui.plugin.add("draggable","zIndex",{start:function(t,n){var i=e(n.helper),o=e(this).data("ui-draggable").options;i.css("zIndex")&&(o._zIndex=i.css("zIndex")),i.css("zIndex",o.zIndex)},stop:function(t,n){var i=e(this).data("ui-draggable").options;i._zIndex&&e(n.helper).css("zIndex",i._zIndex)}})}(jQuery),function(e){function t(e,t,n){return e>t&&t+n>e}e.widget("ui.droppable",{version:"1.10.0",widgetEventPrefix:"drop",options:{accept:"*",activeClass:!1,addClasses:!0,greedy:!1,hoverClass:!1,scope:"default",tolerance:"intersect",activate:null,deactivate:null,drop:null,out:null,over:null},_create:function(){var t=this.options,n=t.accept;this.isover=!1,this.isout=!0,this.accept=e.isFunction(n)?n:function(e){return e.is(n)},this.proportions={width:this.element[0].offsetWidth,height:this.element[0].offsetHeight},e.ui.ddmanager.droppables[t.scope]=e.ui.ddmanager.droppables[t.scope]||[],e.ui.ddmanager.droppables[t.scope].push(this),t.addClasses&&this.element.addClass("ui-droppable")},_destroy:function(){for(var t=0,n=e.ui.ddmanager.droppables[this.options.scope];n.length>t;t++)n[t]===this&&n.splice(t,1);this.element.removeClass("ui-droppable ui-droppable-disabled")},_setOption:function(t,n){"accept"===t&&(this.accept=e.isFunction(n)?n:function(e){return e.is(n)}),e.Widget.prototype._setOption.apply(this,arguments)},_activate:function(t){var n=e.ui.ddmanager.current;this.options.activeClass&&this.element.addClass(this.options.activeClass),n&&this._trigger("activate",t,this.ui(n))},_deactivate:function(t){var n=e.ui.ddmanager.current;this.options.activeClass&&this.element.removeClass(this.options.activeClass),n&&this._trigger("deactivate",t,this.ui(n))},_over:function(t){var n=e.ui.ddmanager.current;n&&(n.currentItem||n.element)[0]!==this.element[0]&&this.accept.call(this.element[0],n.currentItem||n.element)&&(this.options.hoverClass&&this.element.addClass(this.options.hoverClass),this._trigger("over",t,this.ui(n)))},_out:function(t){var n=e.ui.ddmanager.current;n&&(n.currentItem||n.element)[0]!==this.element[0]&&this.accept.call(this.element[0],n.currentItem||n.element)&&(this.options.hoverClass&&this.element.removeClass(this.options.hoverClass),this._trigger("out",t,this.ui(n)))},_drop:function(t,n){var i=n||e.ui.ddmanager.current,o=!1;return i&&(i.currentItem||i.element)[0]!==this.element[0]?(this.element.find(":data(ui-droppable)").not(".ui-draggable-dragging").each(function(){var t=e.data(this,"ui-droppable");return t.options.greedy&&!t.options.disabled&&t.options.scope===i.options.scope&&t.accept.call(t.element[0],i.currentItem||i.element)&&e.ui.intersect(i,e.extend(t,{offset:t.element.offset()}),t.options.tolerance)?(o=!0,!1):void 0}),o?!1:this.accept.call(this.element[0],i.currentItem||i.element)?(this.options.activeClass&&this.element.removeClass(this.options.activeClass),this.options.hoverClass&&this.element.removeClass(this.options.hoverClass),this._trigger("drop",t,this.ui(i)),this.element):!1):!1},ui:function(e){return{draggable:e.currentItem||e.element,helper:e.helper,position:e.position,offset:e.positionAbs}}}),e.ui.intersect=function(e,n,i){if(!n.offset)return!1;var o,a,s=(e.positionAbs||e.position.absolute).left,r=s+e.helperProportions.width,l=(e.positionAbs||e.position.absolute).top,c=l+e.helperProportions.height,u=n.offset.left,h=u+n.proportions.width,d=n.offset.top,p=d+n.proportions.height;switch(i){case"fit":return s>=u&&h>=r&&l>=d&&p>=c;case"intersect":return s+e.helperProportions.width/2>u&&h>r-e.helperProportions.width/2&&l+e.helperProportions.height/2>d&&p>c-e.helperProportions.height/2;case"pointer":return o=(e.positionAbs||e.position.absolute).left+(e.clickOffset||e.offset.click).left,a=(e.positionAbs||e.position.absolute).top+(e.clickOffset||e.offset.click).top,t(a,d,n.proportions.height)&&t(o,u,n.proportions.width);case"touch":return(l>=d&&p>=l||c>=d&&p>=c||d>l&&c>p)&&(s>=u&&h>=s||r>=u&&h>=r||u>s&&r>h);default:return!1}},e.ui.ddmanager={current:null,droppables:{"default":[]},prepareOffsets:function(t,n){var i,o,a=e.ui.ddmanager.droppables[t.options.scope]||[],s=n?n.type:null,r=(t.currentItem||t.element).find(":data(ui-droppable)").addBack();e:for(i=0;a.length>i;i++)if(!(a[i].options.disabled||t&&!a[i].accept.call(a[i].element[0],t.currentItem||t.element))){for(o=0;r.length>o;o++)if(r[o]===a[i].element[0]){a[i].proportions.height=0;continue e}a[i].visible="none"!==a[i].element.css("display"),a[i].visible&&("mousedown"===s&&a[i]._activate.call(a[i],n),a[i].offset=a[i].element.offset(),a[i].proportions={width:a[i].element[0].offsetWidth,height:a[i].element[0].offsetHeight})}},drop:function(t,n){var i=!1;return e.each(e.ui.ddmanager.droppables[t.options.scope]||[],function(){this.options&&(!this.options.disabled&&this.visible&&e.ui.intersect(t,this,this.options.tolerance)&&(i=this._drop.call(this,n)||i),!this.options.disabled&&this.visible&&this.accept.call(this.element[0],t.currentItem||t.element)&&(this.isout=!0,this.isover=!1,this._deactivate.call(this,n)))}),i},dragStart:function(t,n){t.element.parentsUntil("body").bind("scroll.droppable",function(){t.options.refreshPositions||e.ui.ddmanager.prepareOffsets(t,n)})},drag:function(t,n){t.options.refreshPositions&&e.ui.ddmanager.prepareOffsets(t,n),e.each(e.ui.ddmanager.droppables[t.options.scope]||[],function(){if(!this.options.disabled&&!this.greedyChild&&this.visible){var i,o,a,s=e.ui.intersect(t,this,this.options.tolerance),r=!s&&this.isover?"isout":s&&!this.isover?"isover":null;r&&(this.options.greedy&&(o=this.options.scope,a=this.element.parents(":data(ui-droppable)").filter(function(){return e.data(this,"ui-droppable").options.scope===o}),a.length&&(i=e.data(a[0],"ui-droppable"),i.greedyChild="isover"===r)),i&&"isover"===r&&(i.isover=!1,i.isout=!0,i._out.call(i,n)),this[r]=!0,this["isout"===r?"isover":"isout"]=!1,this["isover"===r?"_over":"_out"].call(this,n),i&&"isout"===r&&(i.isout=!1,i.isover=!0,i._over.call(i,n)))}})},dragStop:function(t,n){t.element.parentsUntil("body").unbind("scroll.droppable"),t.options.refreshPositions||e.ui.ddmanager.prepareOffsets(t,n)}}}(jQuery),function(e){function t(e){return parseInt(e,10)||0}function n(e){return!isNaN(parseInt(e,10))}e.widget("ui.resizable",e.ui.mouse,{version:"1.10.0",widgetEventPrefix:"resize",options:{alsoResize:!1,animate:!1,animateDuration:"slow",animateEasing:"swing",aspectRatio:!1,autoHide:!1,containment:!1,ghost:!1,grid:!1,handles:"e,s,se",helper:!1,maxHeight:null,maxWidth:null,minHeight:10,minWidth:10,zIndex:90,resize:null,start:null,stop:null},_create:function(){var t,n,i,o,a,s=this,r=this.options;if(this.element.addClass("ui-resizable"),e.extend(this,{_aspectRatio:!!r.aspectRatio,aspectRatio:r.aspectRatio,originalElement:this.element,_proportionallyResizeElements:[],_helper:r.helper||r.ghost||r.animate?r.helper||"ui-resizable-helper":null}),this.element[0].nodeName.match(/canvas|textarea|input|select|button|img/i)&&(this.element.wrap(e("<div class='ui-wrapper' style='overflow: hidden;'></div>").css({position:this.element.css("position"),width:this.element.outerWidth(),height:this.element.outerHeight(),top:this.element.css("top"),left:this.element.css("left")})),this.element=this.element.parent().data("ui-resizable",this.element.data("ui-resizable")),this.elementIsWrapper=!0,this.element.css({marginLeft:this.originalElement.css("marginLeft"),marginTop:this.originalElement.css("marginTop"),marginRight:this.originalElement.css("marginRight"),marginBottom:this.originalElement.css("marginBottom")}),this.originalElement.css({marginLeft:0,marginTop:0,marginRight:0,marginBottom:0}),this.originalResizeStyle=this.originalElement.css("resize"),this.originalElement.css("resize","none"),this._proportionallyResizeElements.push(this.originalElement.css({position:"static",zoom:1,display:"block"})),this.originalElement.css({margin:this.originalElement.css("margin")}),this._proportionallyResize()),this.handles=r.handles||(e(".ui-resizable-handle",this.element).length?{n:".ui-resizable-n",e:".ui-resizable-e",s:".ui-resizable-s",w:".ui-resizable-w",se:".ui-resizable-se",sw:".ui-resizable-sw",ne:".ui-resizable-ne",nw:".ui-resizable-nw"}:"e,s,se"),this.handles.constructor===String)for("all"===this.handles&&(this.handles="n,e,s,w,se,sw,ne,nw"),t=this.handles.split(","),this.handles={},n=0;t.length>n;n++)i=e.trim(t[n]),a="ui-resizable-"+i,o=e("<div class='ui-resizable-handle "+a+"'></div>"),o.css({zIndex:r.zIndex}),"se"===i&&o.addClass("ui-icon ui-icon-gripsmall-diagonal-se"),this.handles[i]=".ui-resizable-"+i,this.element.append(o);this._renderAxis=function(t){var n,i,o,a;t=t||this.element;for(n in this.handles)this.handles[n].constructor===String&&(this.handles[n]=e(this.handles[n],this.element).show()),this.elementIsWrapper&&this.originalElement[0].nodeName.match(/textarea|input|select|button/i)&&(i=e(this.handles[n],this.element),a=/sw|ne|nw|se|n|s/.test(n)?i.outerHeight():i.outerWidth(),o=["padding",/ne|nw|n/.test(n)?"Top":/se|sw|s/.test(n)?"Bottom":/^e$/.test(n)?"Right":"Left"].join(""),t.css(o,a),this._proportionallyResize()),e(this.handles[n]).length},this._renderAxis(this.element),this._handles=e(".ui-resizable-handle",this.element).disableSelection(),this._handles.mouseover(function(){s.resizing||(this.className&&(o=this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i)),s.axis=o&&o[1]?o[1]:"se")}),r.autoHide&&(this._handles.hide(),e(this.element).addClass("ui-resizable-autohide").mouseenter(function(){r.disabled||(e(this).removeClass("ui-resizable-autohide"),s._handles.show())}).mouseleave(function(){r.disabled||s.resizing||(e(this).addClass("ui-resizable-autohide"),s._handles.hide())})),this._mouseInit()},_destroy:function(){this._mouseDestroy();var t,n=function(t){e(t).removeClass("ui-resizable ui-resizable-disabled ui-resizable-resizing").removeData("resizable").removeData("ui-resizable").unbind(".resizable").find(".ui-resizable-handle").remove()};return this.elementIsWrapper&&(n(this.element),t=this.element,this.originalElement.css({position:t.css("position"),width:t.outerWidth(),height:t.outerHeight(),top:t.css("top"),left:t.css("left")}).insertAfter(t),t.remove()),this.originalElement.css("resize",this.originalResizeStyle),n(this.originalElement),this},_mouseCapture:function(t){var n,i,o=!1;for(n in this.handles)i=e(this.handles[n])[0],(i===t.target||e.contains(i,t.target))&&(o=!0);return!this.options.disabled&&o},_mouseStart:function(n){var i,o,a,s=this.options,r=this.element.position(),l=this.element;return this.resizing=!0,/absolute/.test(l.css("position"))?l.css({position:"absolute",top:l.css("top"),left:l.css("left")}):l.is(".ui-draggable")&&l.css({position:"absolute",top:r.top,left:r.left}),this._renderProxy(),i=t(this.helper.css("left")),o=t(this.helper.css("top")),s.containment&&(i+=e(s.containment).scrollLeft()||0,o+=e(s.containment).scrollTop()||0),this.offset=this.helper.offset(),this.position={left:i,top:o},this.size=this._helper?{width:l.outerWidth(),height:l.outerHeight()}:{width:l.width(),height:l.height()},this.originalSize=this._helper?{width:l.outerWidth(),height:l.outerHeight()}:{width:l.width(),height:l.height()},this.originalPosition={left:i,top:o},this.sizeDiff={width:l.outerWidth()-l.width(),height:l.outerHeight()-l.height()},this.originalMousePosition={left:n.pageX,top:n.pageY},this.aspectRatio="number"==typeof s.aspectRatio?s.aspectRatio:this.originalSize.width/this.originalSize.height||1,a=e(".ui-resizable-"+this.axis).css("cursor"),e("body").css("cursor","auto"===a?this.axis+"-resize":a),l.addClass("ui-resizable-resizing"),this._propagate("start",n),!0},_mouseDrag:function(t){var n,i=this.helper,o={},a=this.originalMousePosition,s=this.axis,r=this.position.top,l=this.position.left,c=this.size.width,u=this.size.height,h=t.pageX-a.left||0,d=t.pageY-a.top||0,p=this._change[s];return p?(n=p.apply(this,[t,h,d]),this._updateVirtualBoundaries(t.shiftKey),(this._aspectRatio||t.shiftKey)&&(n=this._updateRatio(n,t)),n=this._respectSize(n,t),this._updateCache(n),this._propagate("resize",t),this.position.top!==r&&(o.top=this.position.top+"px"),this.position.left!==l&&(o.left=this.position.left+"px"),this.size.width!==c&&(o.width=this.size.width+"px"),this.size.height!==u&&(o.height=this.size.height+"px"),i.css(o),!this._helper&&this._proportionallyResizeElements.length&&this._proportionallyResize(),e.isEmptyObject(o)||this._trigger("resize",t,this.ui()),!1):!1},_mouseStop:function(t){this.resizing=!1;var n,i,o,a,s,r,l,c=this.options,u=this;return this._helper&&(n=this._proportionallyResizeElements,i=n.length&&/textarea/i.test(n[0].nodeName),o=i&&e.ui.hasScroll(n[0],"left")?0:u.sizeDiff.height,a=i?0:u.sizeDiff.width,s={width:u.helper.width()-a,height:u.helper.height()-o},r=parseInt(u.element.css("left"),10)+(u.position.left-u.originalPosition.left)||null,l=parseInt(u.element.css("top"),10)+(u.position.top-u.originalPosition.top)||null,c.animate||this.element.css(e.extend(s,{top:l,left:r})),u.helper.height(u.size.height),u.helper.width(u.size.width),this._helper&&!c.animate&&this._proportionallyResize()),e("body").css("cursor","auto"),this.element.removeClass("ui-resizable-resizing"),this._propagate("stop",t),this._helper&&this.helper.remove(),!1
},_updateVirtualBoundaries:function(e){var t,i,o,a,s,r=this.options;s={minWidth:n(r.minWidth)?r.minWidth:0,maxWidth:n(r.maxWidth)?r.maxWidth:1/0,minHeight:n(r.minHeight)?r.minHeight:0,maxHeight:n(r.maxHeight)?r.maxHeight:1/0},(this._aspectRatio||e)&&(t=s.minHeight*this.aspectRatio,o=s.minWidth/this.aspectRatio,i=s.maxHeight*this.aspectRatio,a=s.maxWidth/this.aspectRatio,t>s.minWidth&&(s.minWidth=t),o>s.minHeight&&(s.minHeight=o),s.maxWidth>i&&(s.maxWidth=i),s.maxHeight>a&&(s.maxHeight=a)),this._vBoundaries=s},_updateCache:function(e){this.offset=this.helper.offset(),n(e.left)&&(this.position.left=e.left),n(e.top)&&(this.position.top=e.top),n(e.height)&&(this.size.height=e.height),n(e.width)&&(this.size.width=e.width)},_updateRatio:function(e){var t=this.position,i=this.size,o=this.axis;return n(e.height)?e.width=e.height*this.aspectRatio:n(e.width)&&(e.height=e.width/this.aspectRatio),"sw"===o&&(e.left=t.left+(i.width-e.width),e.top=null),"nw"===o&&(e.top=t.top+(i.height-e.height),e.left=t.left+(i.width-e.width)),e},_respectSize:function(e){var t=this._vBoundaries,i=this.axis,o=n(e.width)&&t.maxWidth&&t.maxWidth<e.width,a=n(e.height)&&t.maxHeight&&t.maxHeight<e.height,s=n(e.width)&&t.minWidth&&t.minWidth>e.width,r=n(e.height)&&t.minHeight&&t.minHeight>e.height,l=this.originalPosition.left+this.originalSize.width,c=this.position.top+this.size.height,u=/sw|nw|w/.test(i),h=/nw|ne|n/.test(i);return s&&(e.width=t.minWidth),r&&(e.height=t.minHeight),o&&(e.width=t.maxWidth),a&&(e.height=t.maxHeight),s&&u&&(e.left=l-t.minWidth),o&&u&&(e.left=l-t.maxWidth),r&&h&&(e.top=c-t.minHeight),a&&h&&(e.top=c-t.maxHeight),e.width||e.height||e.left||!e.top?!e.width&&!e.height&&!e.top&&e.left&&(e.left=null):e.top=null,e},_proportionallyResize:function(){if(this._proportionallyResizeElements.length){var e,t,n,i,o,a=this.helper||this.element;for(e=0;this._proportionallyResizeElements.length>e;e++){if(o=this._proportionallyResizeElements[e],!this.borderDif)for(this.borderDif=[],n=[o.css("borderTopWidth"),o.css("borderRightWidth"),o.css("borderBottomWidth"),o.css("borderLeftWidth")],i=[o.css("paddingTop"),o.css("paddingRight"),o.css("paddingBottom"),o.css("paddingLeft")],t=0;n.length>t;t++)this.borderDif[t]=(parseInt(n[t],10)||0)+(parseInt(i[t],10)||0);o.css({height:a.height()-this.borderDif[0]-this.borderDif[2]||0,width:a.width()-this.borderDif[1]-this.borderDif[3]||0})}}},_renderProxy:function(){var t=this.element,n=this.options;this.elementOffset=t.offset(),this._helper?(this.helper=this.helper||e("<div style='overflow:hidden;'></div>"),this.helper.addClass(this._helper).css({width:this.element.outerWidth()-1,height:this.element.outerHeight()-1,position:"absolute",left:this.elementOffset.left+"px",top:this.elementOffset.top+"px",zIndex:++n.zIndex}),this.helper.appendTo("body").disableSelection()):this.helper=this.element},_change:{e:function(e,t){return{width:this.originalSize.width+t}},w:function(e,t){var n=this.originalSize,i=this.originalPosition;return{left:i.left+t,width:n.width-t}},n:function(e,t,n){var i=this.originalSize,o=this.originalPosition;return{top:o.top+n,height:i.height-n}},s:function(e,t,n){return{height:this.originalSize.height+n}},se:function(t,n,i){return e.extend(this._change.s.apply(this,arguments),this._change.e.apply(this,[t,n,i]))},sw:function(t,n,i){return e.extend(this._change.s.apply(this,arguments),this._change.w.apply(this,[t,n,i]))},ne:function(t,n,i){return e.extend(this._change.n.apply(this,arguments),this._change.e.apply(this,[t,n,i]))},nw:function(t,n,i){return e.extend(this._change.n.apply(this,arguments),this._change.w.apply(this,[t,n,i]))}},_propagate:function(t,n){e.ui.plugin.call(this,t,[n,this.ui()]),"resize"!==t&&this._trigger(t,n,this.ui())},plugins:{},ui:function(){return{originalElement:this.originalElement,element:this.element,helper:this.helper,position:this.position,size:this.size,originalSize:this.originalSize,originalPosition:this.originalPosition}}}),e.ui.plugin.add("resizable","animate",{stop:function(t){var n=e(this).data("ui-resizable"),i=n.options,o=n._proportionallyResizeElements,a=o.length&&/textarea/i.test(o[0].nodeName),s=a&&e.ui.hasScroll(o[0],"left")?0:n.sizeDiff.height,r=a?0:n.sizeDiff.width,l={width:n.size.width-r,height:n.size.height-s},c=parseInt(n.element.css("left"),10)+(n.position.left-n.originalPosition.left)||null,u=parseInt(n.element.css("top"),10)+(n.position.top-n.originalPosition.top)||null;n.element.animate(e.extend(l,u&&c?{top:u,left:c}:{}),{duration:i.animateDuration,easing:i.animateEasing,step:function(){var i={width:parseInt(n.element.css("width"),10),height:parseInt(n.element.css("height"),10),top:parseInt(n.element.css("top"),10),left:parseInt(n.element.css("left"),10)};o&&o.length&&e(o[0]).css({width:i.width,height:i.height}),n._updateCache(i),n._propagate("resize",t)}})}}),e.ui.plugin.add("resizable","containment",{start:function(){var n,i,o,a,s,r,l,c=e(this).data("ui-resizable"),u=c.options,h=c.element,d=u.containment,p=d instanceof e?d.get(0):/parent/.test(d)?h.parent().get(0):d;p&&(c.containerElement=e(p),/document/.test(d)||d===document?(c.containerOffset={left:0,top:0},c.containerPosition={left:0,top:0},c.parentData={element:e(document),left:0,top:0,width:e(document).width(),height:e(document).height()||document.body.parentNode.scrollHeight}):(n=e(p),i=[],e(["Top","Right","Left","Bottom"]).each(function(e,o){i[e]=t(n.css("padding"+o))}),c.containerOffset=n.offset(),c.containerPosition=n.position(),c.containerSize={height:n.innerHeight()-i[3],width:n.innerWidth()-i[1]},o=c.containerOffset,a=c.containerSize.height,s=c.containerSize.width,r=e.ui.hasScroll(p,"left")?p.scrollWidth:s,l=e.ui.hasScroll(p)?p.scrollHeight:a,c.parentData={element:p,left:o.left,top:o.top,width:r,height:l}))},resize:function(t){var n,i,o,a,s=e(this).data("ui-resizable"),r=s.options,l=s.containerOffset,c=s.position,u=s._aspectRatio||t.shiftKey,h={top:0,left:0},d=s.containerElement;d[0]!==document&&/static/.test(d.css("position"))&&(h=l),c.left<(s._helper?l.left:0)&&(s.size.width=s.size.width+(s._helper?s.position.left-l.left:s.position.left-h.left),u&&(s.size.height=s.size.width/s.aspectRatio),s.position.left=r.helper?l.left:0),c.top<(s._helper?l.top:0)&&(s.size.height=s.size.height+(s._helper?s.position.top-l.top:s.position.top),u&&(s.size.width=s.size.height*s.aspectRatio),s.position.top=s._helper?l.top:0),s.offset.left=s.parentData.left+s.position.left,s.offset.top=s.parentData.top+s.position.top,n=Math.abs((s._helper?s.offset.left-h.left:s.offset.left-h.left)+s.sizeDiff.width),i=Math.abs((s._helper?s.offset.top-h.top:s.offset.top-l.top)+s.sizeDiff.height),o=s.containerElement.get(0)===s.element.parent().get(0),a=/relative|absolute/.test(s.containerElement.css("position")),o&&a&&(n-=s.parentData.left),n+s.size.width>=s.parentData.width&&(s.size.width=s.parentData.width-n,u&&(s.size.height=s.size.width/s.aspectRatio)),i+s.size.height>=s.parentData.height&&(s.size.height=s.parentData.height-i,u&&(s.size.width=s.size.height*s.aspectRatio))},stop:function(){var t=e(this).data("ui-resizable"),n=t.options,i=t.containerOffset,o=t.containerPosition,a=t.containerElement,s=e(t.helper),r=s.offset(),l=s.outerWidth()-t.sizeDiff.width,c=s.outerHeight()-t.sizeDiff.height;t._helper&&!n.animate&&/relative/.test(a.css("position"))&&e(this).css({left:r.left-o.left-i.left,width:l,height:c}),t._helper&&!n.animate&&/static/.test(a.css("position"))&&e(this).css({left:r.left-o.left-i.left,width:l,height:c})}}),e.ui.plugin.add("resizable","alsoResize",{start:function(){var t=e(this).data("ui-resizable"),n=t.options,i=function(t){e(t).each(function(){var t=e(this);t.data("ui-resizable-alsoresize",{width:parseInt(t.width(),10),height:parseInt(t.height(),10),left:parseInt(t.css("left"),10),top:parseInt(t.css("top"),10)})})};"object"!=typeof n.alsoResize||n.alsoResize.parentNode?i(n.alsoResize):n.alsoResize.length?(n.alsoResize=n.alsoResize[0],i(n.alsoResize)):e.each(n.alsoResize,function(e){i(e)})},resize:function(t,n){var i=e(this).data("ui-resizable"),o=i.options,a=i.originalSize,s=i.originalPosition,r={height:i.size.height-a.height||0,width:i.size.width-a.width||0,top:i.position.top-s.top||0,left:i.position.left-s.left||0},l=function(t,i){e(t).each(function(){var t=e(this),o=e(this).data("ui-resizable-alsoresize"),a={},s=i&&i.length?i:t.parents(n.originalElement[0]).length?["width","height"]:["width","height","top","left"];e.each(s,function(e,t){var n=(o[t]||0)+(r[t]||0);n&&n>=0&&(a[t]=n||null)}),t.css(a)})};"object"!=typeof o.alsoResize||o.alsoResize.nodeType?l(o.alsoResize):e.each(o.alsoResize,function(e,t){l(e,t)})},stop:function(){e(this).removeData("resizable-alsoresize")}}),e.ui.plugin.add("resizable","ghost",{start:function(){var t=e(this).data("ui-resizable"),n=t.options,i=t.size;t.ghost=t.originalElement.clone(),t.ghost.css({opacity:.25,display:"block",position:"relative",height:i.height,width:i.width,margin:0,left:0,top:0}).addClass("ui-resizable-ghost").addClass("string"==typeof n.ghost?n.ghost:""),t.ghost.appendTo(t.helper)},resize:function(){var t=e(this).data("ui-resizable");t.ghost&&t.ghost.css({position:"relative",height:t.size.height,width:t.size.width})},stop:function(){var t=e(this).data("ui-resizable");t.ghost&&t.helper&&t.helper.get(0).removeChild(t.ghost.get(0))}}),e.ui.plugin.add("resizable","grid",{resize:function(){var t=e(this).data("ui-resizable"),n=t.options,i=t.size,o=t.originalSize,a=t.originalPosition,s=t.axis,r="number"==typeof n.grid?[n.grid,n.grid]:n.grid,l=r[0]||1,c=r[1]||1,u=Math.round((i.width-o.width)/l)*l,h=Math.round((i.height-o.height)/c)*c,d=o.width+u,p=o.height+h,f=n.maxWidth&&d>n.maxWidth,m=n.maxHeight&&p>n.maxHeight,g=n.minWidth&&n.minWidth>d,_=n.minHeight&&n.minHeight>p;n.grid=r,g&&(d+=l),_&&(p+=c),f&&(d-=l),m&&(p-=c),/^(se|s|e)$/.test(s)?(t.size.width=d,t.size.height=p):/^(ne)$/.test(s)?(t.size.width=d,t.size.height=p,t.position.top=a.top-h):/^(sw)$/.test(s)?(t.size.width=d,t.size.height=p,t.position.left=a.left-u):(t.size.width=d,t.size.height=p,t.position.top=a.top-h,t.position.left=a.left-u)}})}(jQuery),function(e){e.widget("ui.selectable",e.ui.mouse,{version:"1.10.0",options:{appendTo:"body",autoRefresh:!0,distance:0,filter:"*",tolerance:"touch",selected:null,selecting:null,start:null,stop:null,unselected:null,unselecting:null},_create:function(){var t,n=this;this.element.addClass("ui-selectable"),this.dragged=!1,this.refresh=function(){t=e(n.options.filter,n.element[0]),t.addClass("ui-selectee"),t.each(function(){var t=e(this),n=t.offset();e.data(this,"selectable-item",{element:this,$element:t,left:n.left,top:n.top,right:n.left+t.outerWidth(),bottom:n.top+t.outerHeight(),startselected:!1,selected:t.hasClass("ui-selected"),selecting:t.hasClass("ui-selecting"),unselecting:t.hasClass("ui-unselecting")})})},this.refresh(),this.selectees=t.addClass("ui-selectee"),this._mouseInit(),this.helper=e("<div class='ui-selectable-helper'></div>")},_destroy:function(){this.selectees.removeClass("ui-selectee").removeData("selectable-item"),this.element.removeClass("ui-selectable ui-selectable-disabled"),this._mouseDestroy()},_mouseStart:function(t){var n=this,i=this.options;this.opos=[t.pageX,t.pageY],this.options.disabled||(this.selectees=e(i.filter,this.element[0]),this._trigger("start",t),e(i.appendTo).append(this.helper),this.helper.css({left:t.pageX,top:t.pageY,width:0,height:0}),i.autoRefresh&&this.refresh(),this.selectees.filter(".ui-selected").each(function(){var i=e.data(this,"selectable-item");i.startselected=!0,!t.metaKey&&!t.ctrlKey&&(i.$element.removeClass("ui-selected"),i.selected=!1,i.$element.addClass("ui-unselecting"),i.unselecting=!0,n._trigger("unselecting",t,{unselecting:i.element}))}),e(t.target).parents().addBack().each(function(){var i,o=e.data(this,"selectable-item");return o?(i=!t.metaKey&&!t.ctrlKey||!o.$element.hasClass("ui-selected"),o.$element.removeClass(i?"ui-unselecting":"ui-selected").addClass(i?"ui-selecting":"ui-unselecting"),o.unselecting=!i,o.selecting=i,o.selected=i,i?n._trigger("selecting",t,{selecting:o.element}):n._trigger("unselecting",t,{unselecting:o.element}),!1):void 0}))},_mouseDrag:function(t){if(this.dragged=!0,!this.options.disabled){var n,i=this,o=this.options,a=this.opos[0],s=this.opos[1],r=t.pageX,l=t.pageY;return a>r&&(n=r,r=a,a=n),s>l&&(n=l,l=s,s=n),this.helper.css({left:a,top:s,width:r-a,height:l-s}),this.selectees.each(function(){var n=e.data(this,"selectable-item"),c=!1;n&&n.element!==i.element[0]&&("touch"===o.tolerance?c=!(n.left>r||a>n.right||n.top>l||s>n.bottom):"fit"===o.tolerance&&(c=n.left>a&&r>n.right&&n.top>s&&l>n.bottom),c?(n.selected&&(n.$element.removeClass("ui-selected"),n.selected=!1),n.unselecting&&(n.$element.removeClass("ui-unselecting"),n.unselecting=!1),n.selecting||(n.$element.addClass("ui-selecting"),n.selecting=!0,i._trigger("selecting",t,{selecting:n.element}))):(n.selecting&&((t.metaKey||t.ctrlKey)&&n.startselected?(n.$element.removeClass("ui-selecting"),n.selecting=!1,n.$element.addClass("ui-selected"),n.selected=!0):(n.$element.removeClass("ui-selecting"),n.selecting=!1,n.startselected&&(n.$element.addClass("ui-unselecting"),n.unselecting=!0),i._trigger("unselecting",t,{unselecting:n.element}))),n.selected&&!t.metaKey&&!t.ctrlKey&&!n.startselected&&(n.$element.removeClass("ui-selected"),n.selected=!1,n.$element.addClass("ui-unselecting"),n.unselecting=!0,i._trigger("unselecting",t,{unselecting:n.element}))))}),!1}},_mouseStop:function(t){var n=this;return this.dragged=!1,e(".ui-unselecting",this.element[0]).each(function(){var i=e.data(this,"selectable-item");i.$element.removeClass("ui-unselecting"),i.unselecting=!1,i.startselected=!1,n._trigger("unselected",t,{unselected:i.element})}),e(".ui-selecting",this.element[0]).each(function(){var i=e.data(this,"selectable-item");i.$element.removeClass("ui-selecting").addClass("ui-selected"),i.selecting=!1,i.selected=!0,i.startselected=!0,n._trigger("selected",t,{selected:i.element})}),this._trigger("stop",t),this.helper.remove(),!1}})}(jQuery),function(e){function t(e,t,n){return e>t&&t+n>e}e.widget("ui.sortable",e.ui.mouse,{version:"1.10.0",widgetEventPrefix:"sort",ready:!1,options:{appendTo:"parent",axis:!1,connectWith:!1,containment:!1,cursor:"auto",cursorAt:!1,dropOnEmpty:!0,forcePlaceholderSize:!1,forceHelperSize:!1,grid:!1,handle:!1,helper:"original",items:"> *",opacity:!1,placeholder:!1,revert:!1,scroll:!0,scrollSensitivity:20,scrollSpeed:20,scope:"default",tolerance:"intersect",zIndex:1e3,activate:null,beforeStop:null,change:null,deactivate:null,out:null,over:null,receive:null,remove:null,sort:null,start:null,stop:null,update:null},_create:function(){var e=this.options;this.containerCache={},this.element.addClass("ui-sortable"),this.refresh(),this.floating=this.items.length?"x"===e.axis||/left|right/.test(this.items[0].item.css("float"))||/inline|table-cell/.test(this.items[0].item.css("display")):!1,this.offset=this.element.offset(),this._mouseInit(),this.ready=!0},_destroy:function(){this.element.removeClass("ui-sortable ui-sortable-disabled"),this._mouseDestroy();for(var e=this.items.length-1;e>=0;e--)this.items[e].item.removeData(this.widgetName+"-item");return this},_setOption:function(t,n){"disabled"===t?(this.options[t]=n,this.widget().toggleClass("ui-sortable-disabled",!!n)):e.Widget.prototype._setOption.apply(this,arguments)},_mouseCapture:function(t,n){var i=null,o=!1,a=this;return this.reverting?!1:this.options.disabled||"static"===this.options.type?!1:(this._refreshItems(t),e(t.target).parents().each(function(){return e.data(this,a.widgetName+"-item")===a?(i=e(this),!1):void 0}),e.data(t.target,a.widgetName+"-item")===a&&(i=e(t.target)),i?!this.options.handle||n||(e(this.options.handle,i).find("*").addBack().each(function(){this===t.target&&(o=!0)}),o)?(this.currentItem=i,this._removeCurrentsFromItems(),!0):!1:!1)},_mouseStart:function(t,n,i){var o,a=this.options;if(this.currentContainer=this,this.refreshPositions(),this.helper=this._createHelper(t),this._cacheHelperProportions(),this._cacheMargins(),this.scrollParent=this.helper.scrollParent(),this.offset=this.currentItem.offset(),this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left},e.extend(this.offset,{click:{left:t.pageX-this.offset.left,top:t.pageY-this.offset.top},parent:this._getParentOffset(),relative:this._getRelativeOffset()}),this.helper.css("position","absolute"),this.cssPosition=this.helper.css("position"),this.originalPosition=this._generatePosition(t),this.originalPageX=t.pageX,this.originalPageY=t.pageY,a.cursorAt&&this._adjustOffsetFromHelper(a.cursorAt),this.domPosition={prev:this.currentItem.prev()[0],parent:this.currentItem.parent()[0]},this.helper[0]!==this.currentItem[0]&&this.currentItem.hide(),this._createPlaceholder(),a.containment&&this._setContainment(),a.cursor&&(e("body").css("cursor")&&(this._storedCursor=e("body").css("cursor")),e("body").css("cursor",a.cursor)),a.opacity&&(this.helper.css("opacity")&&(this._storedOpacity=this.helper.css("opacity")),this.helper.css("opacity",a.opacity)),a.zIndex&&(this.helper.css("zIndex")&&(this._storedZIndex=this.helper.css("zIndex")),this.helper.css("zIndex",a.zIndex)),this.scrollParent[0]!==document&&"HTML"!==this.scrollParent[0].tagName&&(this.overflowOffset=this.scrollParent.offset()),this._trigger("start",t,this._uiHash()),this._preserveHelperProportions||this._cacheHelperProportions(),!i)for(o=this.containers.length-1;o>=0;o--)this.containers[o]._trigger("activate",t,this._uiHash(this));return e.ui.ddmanager&&(e.ui.ddmanager.current=this),e.ui.ddmanager&&!a.dropBehaviour&&e.ui.ddmanager.prepareOffsets(this,t),this.dragging=!0,this.helper.addClass("ui-sortable-helper"),this._mouseDrag(t),!0},_mouseDrag:function(t){var n,i,o,a,s=this.options,r=!1;for(this.position=this._generatePosition(t),this.positionAbs=this._convertPositionTo("absolute"),this.lastPositionAbs||(this.lastPositionAbs=this.positionAbs),this.options.scroll&&(this.scrollParent[0]!==document&&"HTML"!==this.scrollParent[0].tagName?(this.overflowOffset.top+this.scrollParent[0].offsetHeight-t.pageY<s.scrollSensitivity?this.scrollParent[0].scrollTop=r=this.scrollParent[0].scrollTop+s.scrollSpeed:t.pageY-this.overflowOffset.top<s.scrollSensitivity&&(this.scrollParent[0].scrollTop=r=this.scrollParent[0].scrollTop-s.scrollSpeed),this.overflowOffset.left+this.scrollParent[0].offsetWidth-t.pageX<s.scrollSensitivity?this.scrollParent[0].scrollLeft=r=this.scrollParent[0].scrollLeft+s.scrollSpeed:t.pageX-this.overflowOffset.left<s.scrollSensitivity&&(this.scrollParent[0].scrollLeft=r=this.scrollParent[0].scrollLeft-s.scrollSpeed)):(t.pageY-e(document).scrollTop()<s.scrollSensitivity?r=e(document).scrollTop(e(document).scrollTop()-s.scrollSpeed):e(window).height()-(t.pageY-e(document).scrollTop())<s.scrollSensitivity&&(r=e(document).scrollTop(e(document).scrollTop()+s.scrollSpeed)),t.pageX-e(document).scrollLeft()<s.scrollSensitivity?r=e(document).scrollLeft(e(document).scrollLeft()-s.scrollSpeed):e(window).width()-(t.pageX-e(document).scrollLeft())<s.scrollSensitivity&&(r=e(document).scrollLeft(e(document).scrollLeft()+s.scrollSpeed))),r!==!1&&e.ui.ddmanager&&!s.dropBehaviour&&e.ui.ddmanager.prepareOffsets(this,t)),this.positionAbs=this._convertPositionTo("absolute"),this.options.axis&&"y"===this.options.axis||(this.helper[0].style.left=this.position.left+"px"),this.options.axis&&"x"===this.options.axis||(this.helper[0].style.top=this.position.top+"px"),n=this.items.length-1;n>=0;n--)if(i=this.items[n],o=i.item[0],a=this._intersectsWithPointer(i),a&&i.instance===this.currentContainer&&o!==this.currentItem[0]&&this.placeholder[1===a?"next":"prev"]()[0]!==o&&!e.contains(this.placeholder[0],o)&&("semi-dynamic"===this.options.type?!e.contains(this.element[0],o):!0)){if(this.direction=1===a?"down":"up","pointer"!==this.options.tolerance&&!this._intersectsWithSides(i))break;this._rearrange(t,i),this._trigger("change",t,this._uiHash());break}return this._contactContainers(t),e.ui.ddmanager&&e.ui.ddmanager.drag(this,t),this._trigger("sort",t,this._uiHash()),this.lastPositionAbs=this.positionAbs,!1},_mouseStop:function(t,n){if(t){if(e.ui.ddmanager&&!this.options.dropBehaviour&&e.ui.ddmanager.drop(this,t),this.options.revert){var i=this,o=this.placeholder.offset();this.reverting=!0,e(this.helper).animate({left:o.left-this.offset.parent.left-this.margins.left+(this.offsetParent[0]===document.body?0:this.offsetParent[0].scrollLeft),top:o.top-this.offset.parent.top-this.margins.top+(this.offsetParent[0]===document.body?0:this.offsetParent[0].scrollTop)},parseInt(this.options.revert,10)||500,function(){i._clear(t)})}else this._clear(t,n);return!1}},cancel:function(){if(this.dragging){this._mouseUp({target:null}),"original"===this.options.helper?this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper"):this.currentItem.show();for(var t=this.containers.length-1;t>=0;t--)this.containers[t]._trigger("deactivate",null,this._uiHash(this)),this.containers[t].containerCache.over&&(this.containers[t]._trigger("out",null,this._uiHash(this)),this.containers[t].containerCache.over=0)}return this.placeholder&&(this.placeholder[0].parentNode&&this.placeholder[0].parentNode.removeChild(this.placeholder[0]),"original"!==this.options.helper&&this.helper&&this.helper[0].parentNode&&this.helper.remove(),e.extend(this,{helper:null,dragging:!1,reverting:!1,_noFinalSort:null}),this.domPosition.prev?e(this.domPosition.prev).after(this.currentItem):e(this.domPosition.parent).prepend(this.currentItem)),this},serialize:function(t){var n=this._getItemsAsjQuery(t&&t.connected),i=[];return t=t||{},e(n).each(function(){var n=(e(t.item||this).attr(t.attribute||"id")||"").match(t.expression||/(.+)[\-=_](.+)/);n&&i.push((t.key||n[1]+"[]")+"="+(t.key&&t.expression?n[1]:n[2]))}),!i.length&&t.key&&i.push(t.key+"="),i.join("&")},toArray:function(t){var n=this._getItemsAsjQuery(t&&t.connected),i=[];return t=t||{},n.each(function(){i.push(e(t.item||this).attr(t.attribute||"id")||"")}),i},_intersectsWith:function(e){var t=this.positionAbs.left,n=t+this.helperProportions.width,i=this.positionAbs.top,o=i+this.helperProportions.height,a=e.left,s=a+e.width,r=e.top,l=r+e.height,c=this.offset.click.top,u=this.offset.click.left,h=i+c>r&&l>i+c&&t+u>a&&s>t+u;return"pointer"===this.options.tolerance||this.options.forcePointerForContainers||"pointer"!==this.options.tolerance&&this.helperProportions[this.floating?"width":"height"]>e[this.floating?"width":"height"]?h:t+this.helperProportions.width/2>a&&s>n-this.helperProportions.width/2&&i+this.helperProportions.height/2>r&&l>o-this.helperProportions.height/2},_intersectsWithPointer:function(e){var n="x"===this.options.axis||t(this.positionAbs.top+this.offset.click.top,e.top,e.height),i="y"===this.options.axis||t(this.positionAbs.left+this.offset.click.left,e.left,e.width),o=n&&i,a=this._getDragVerticalDirection(),s=this._getDragHorizontalDirection();return o?this.floating?s&&"right"===s||"down"===a?2:1:a&&("down"===a?2:1):!1},_intersectsWithSides:function(e){var n=t(this.positionAbs.top+this.offset.click.top,e.top+e.height/2,e.height),i=t(this.positionAbs.left+this.offset.click.left,e.left+e.width/2,e.width),o=this._getDragVerticalDirection(),a=this._getDragHorizontalDirection();return this.floating&&a?"right"===a&&i||"left"===a&&!i:o&&("down"===o&&n||"up"===o&&!n)},_getDragVerticalDirection:function(){var e=this.positionAbs.top-this.lastPositionAbs.top;return 0!==e&&(e>0?"down":"up")},_getDragHorizontalDirection:function(){var e=this.positionAbs.left-this.lastPositionAbs.left;return 0!==e&&(e>0?"right":"left")},refresh:function(e){return this._refreshItems(e),this.refreshPositions(),this},_connectWith:function(){var e=this.options;return e.connectWith.constructor===String?[e.connectWith]:e.connectWith},_getItemsAsjQuery:function(t){var n,i,o,a,s=[],r=[],l=this._connectWith();if(l&&t)for(n=l.length-1;n>=0;n--)for(o=e(l[n]),i=o.length-1;i>=0;i--)a=e.data(o[i],this.widgetFullName),a&&a!==this&&!a.options.disabled&&r.push([e.isFunction(a.options.items)?a.options.items.call(a.element):e(a.options.items,a.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"),a]);for(r.push([e.isFunction(this.options.items)?this.options.items.call(this.element,null,{options:this.options,item:this.currentItem}):e(this.options.items,this.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"),this]),n=r.length-1;n>=0;n--)r[n][0].each(function(){s.push(this)});return e(s)},_removeCurrentsFromItems:function(){var t=this.currentItem.find(":data("+this.widgetName+"-item)");this.items=e.grep(this.items,function(e){for(var n=0;t.length>n;n++)if(t[n]===e.item[0])return!1;return!0})},_refreshItems:function(t){this.items=[],this.containers=[this];var n,i,o,a,s,r,l,c,u=this.items,h=[[e.isFunction(this.options.items)?this.options.items.call(this.element[0],t,{item:this.currentItem}):e(this.options.items,this.element),this]],d=this._connectWith();if(d&&this.ready)for(n=d.length-1;n>=0;n--)for(o=e(d[n]),i=o.length-1;i>=0;i--)a=e.data(o[i],this.widgetFullName),a&&a!==this&&!a.options.disabled&&(h.push([e.isFunction(a.options.items)?a.options.items.call(a.element[0],t,{item:this.currentItem}):e(a.options.items,a.element),a]),this.containers.push(a));for(n=h.length-1;n>=0;n--)for(s=h[n][1],r=h[n][0],i=0,c=r.length;c>i;i++)l=e(r[i]),l.data(this.widgetName+"-item",s),u.push({item:l,instance:s,width:0,height:0,left:0,top:0})},refreshPositions:function(t){this.offsetParent&&this.helper&&(this.offset.parent=this._getParentOffset());var n,i,o,a;for(n=this.items.length-1;n>=0;n--)i=this.items[n],i.instance!==this.currentContainer&&this.currentContainer&&i.item[0]!==this.currentItem[0]||(o=this.options.toleranceElement?e(this.options.toleranceElement,i.item):i.item,t||(i.width=o.outerWidth(),i.height=o.outerHeight()),a=o.offset(),i.left=a.left,i.top=a.top);if(this.options.custom&&this.options.custom.refreshContainers)this.options.custom.refreshContainers.call(this);else for(n=this.containers.length-1;n>=0;n--)a=this.containers[n].element.offset(),this.containers[n].containerCache.left=a.left,this.containers[n].containerCache.top=a.top,this.containers[n].containerCache.width=this.containers[n].element.outerWidth(),this.containers[n].containerCache.height=this.containers[n].element.outerHeight();return this},_createPlaceholder:function(t){t=t||this;var n,i=t.options;i.placeholder&&i.placeholder.constructor!==String||(n=i.placeholder,i.placeholder={element:function(){var i=e(document.createElement(t.currentItem[0].nodeName)).addClass(n||t.currentItem[0].className+" ui-sortable-placeholder").removeClass("ui-sortable-helper")[0];return n||(i.style.visibility="hidden"),i},update:function(e,o){(!n||i.forcePlaceholderSize)&&(o.height()||o.height(t.currentItem.innerHeight()-parseInt(t.currentItem.css("paddingTop")||0,10)-parseInt(t.currentItem.css("paddingBottom")||0,10)),o.width()||o.width(t.currentItem.innerWidth()-parseInt(t.currentItem.css("paddingLeft")||0,10)-parseInt(t.currentItem.css("paddingRight")||0,10)))}}),t.placeholder=e(i.placeholder.element.call(t.element,t.currentItem)),t.currentItem.after(t.placeholder),i.placeholder.update(t,t.placeholder)},_contactContainers:function(t){var n,i,o,a,s,r,l,c,u,h=null,d=null;for(n=this.containers.length-1;n>=0;n--)if(!e.contains(this.currentItem[0],this.containers[n].element[0]))if(this._intersectsWith(this.containers[n].containerCache)){if(h&&e.contains(this.containers[n].element[0],h.element[0]))continue;h=this.containers[n],d=n}else this.containers[n].containerCache.over&&(this.containers[n]._trigger("out",t,this._uiHash(this)),this.containers[n].containerCache.over=0);if(h)if(1===this.containers.length)this.containers[d]._trigger("over",t,this._uiHash(this)),this.containers[d].containerCache.over=1;else{for(o=1e4,a=null,s=this.containers[d].floating?"left":"top",r=this.containers[d].floating?"width":"height",l=this.positionAbs[s]+this.offset.click[s],i=this.items.length-1;i>=0;i--)e.contains(this.containers[d].element[0],this.items[i].item[0])&&this.items[i].item[0]!==this.currentItem[0]&&(c=this.items[i].item.offset()[s],u=!1,Math.abs(c-l)>Math.abs(c+this.items[i][r]-l)&&(u=!0,c+=this.items[i][r]),o>Math.abs(c-l)&&(o=Math.abs(c-l),a=this.items[i],this.direction=u?"up":"down"));if(!a&&!this.options.dropOnEmpty)return;this.currentContainer=this.containers[d],a?this._rearrange(t,a,null,!0):this._rearrange(t,null,this.containers[d].element,!0),this._trigger("change",t,this._uiHash()),this.containers[d]._trigger("change",t,this._uiHash(this)),this.options.placeholder.update(this.currentContainer,this.placeholder),this.containers[d]._trigger("over",t,this._uiHash(this)),this.containers[d].containerCache.over=1}},_createHelper:function(t){var n=this.options,i=e.isFunction(n.helper)?e(n.helper.apply(this.element[0],[t,this.currentItem])):"clone"===n.helper?this.currentItem.clone():this.currentItem;return i.parents("body").length||e("parent"!==n.appendTo?n.appendTo:this.currentItem[0].parentNode)[0].appendChild(i[0]),i[0]===this.currentItem[0]&&(this._storedCSS={width:this.currentItem[0].style.width,height:this.currentItem[0].style.height,position:this.currentItem.css("position"),top:this.currentItem.css("top"),left:this.currentItem.css("left")}),(!i[0].style.width||n.forceHelperSize)&&i.width(this.currentItem.width()),(!i[0].style.height||n.forceHelperSize)&&i.height(this.currentItem.height()),i},_adjustOffsetFromHelper:function(t){"string"==typeof t&&(t=t.split(" ")),e.isArray(t)&&(t={left:+t[0],top:+t[1]||0}),"left"in t&&(this.offset.click.left=t.left+this.margins.left),"right"in t&&(this.offset.click.left=this.helperProportions.width-t.right+this.margins.left),"top"in t&&(this.offset.click.top=t.top+this.margins.top),"bottom"in t&&(this.offset.click.top=this.helperProportions.height-t.bottom+this.margins.top)},_getParentOffset:function(){this.offsetParent=this.helper.offsetParent();var t=this.offsetParent.offset();return"absolute"===this.cssPosition&&this.scrollParent[0]!==document&&e.contains(this.scrollParent[0],this.offsetParent[0])&&(t.left+=this.scrollParent.scrollLeft(),t.top+=this.scrollParent.scrollTop()),(this.offsetParent[0]===document.body||this.offsetParent[0].tagName&&"html"===this.offsetParent[0].tagName.toLowerCase()&&e.ui.ie)&&(t={top:0,left:0}),{top:t.top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:t.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if("relative"===this.cssPosition){var e=this.currentItem.position();return{top:e.top-(parseInt(this.helper.css("top"),10)||0)+this.scrollParent.scrollTop(),left:e.left-(parseInt(this.helper.css("left"),10)||0)+this.scrollParent.scrollLeft()}}return{top:0,left:0}},_cacheMargins:function(){this.margins={left:parseInt(this.currentItem.css("marginLeft"),10)||0,top:parseInt(this.currentItem.css("marginTop"),10)||0}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},_setContainment:function(){var t,n,i,o=this.options;"parent"===o.containment&&(o.containment=this.helper[0].parentNode),("document"===o.containment||"window"===o.containment)&&(this.containment=[0-this.offset.relative.left-this.offset.parent.left,0-this.offset.relative.top-this.offset.parent.top,e("document"===o.containment?document:window).width()-this.helperProportions.width-this.margins.left,(e("document"===o.containment?document:window).height()||document.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top]),/^(document|window|parent)$/.test(o.containment)||(t=e(o.containment)[0],n=e(o.containment).offset(),i="hidden"!==e(t).css("overflow"),this.containment=[n.left+(parseInt(e(t).css("borderLeftWidth"),10)||0)+(parseInt(e(t).css("paddingLeft"),10)||0)-this.margins.left,n.top+(parseInt(e(t).css("borderTopWidth"),10)||0)+(parseInt(e(t).css("paddingTop"),10)||0)-this.margins.top,n.left+(i?Math.max(t.scrollWidth,t.offsetWidth):t.offsetWidth)-(parseInt(e(t).css("borderLeftWidth"),10)||0)-(parseInt(e(t).css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left,n.top+(i?Math.max(t.scrollHeight,t.offsetHeight):t.offsetHeight)-(parseInt(e(t).css("borderTopWidth"),10)||0)-(parseInt(e(t).css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top])
},_convertPositionTo:function(t,n){n||(n=this.position);var i="absolute"===t?1:-1,o="absolute"!==this.cssPosition||this.scrollParent[0]!==document&&e.contains(this.scrollParent[0],this.offsetParent[0])?this.scrollParent:this.offsetParent,a=/(html|body)/i.test(o[0].tagName);return{top:n.top+this.offset.relative.top*i+this.offset.parent.top*i-("fixed"===this.cssPosition?-this.scrollParent.scrollTop():a?0:o.scrollTop())*i,left:n.left+this.offset.relative.left*i+this.offset.parent.left*i-("fixed"===this.cssPosition?-this.scrollParent.scrollLeft():a?0:o.scrollLeft())*i}},_generatePosition:function(t){var n,i,o=this.options,a=t.pageX,s=t.pageY,r="absolute"!==this.cssPosition||this.scrollParent[0]!==document&&e.contains(this.scrollParent[0],this.offsetParent[0])?this.scrollParent:this.offsetParent,l=/(html|body)/i.test(r[0].tagName);return"relative"===this.cssPosition&&(this.scrollParent[0]===document||this.scrollParent[0]===this.offsetParent[0])&&(this.offset.relative=this._getRelativeOffset()),this.originalPosition&&(this.containment&&(t.pageX-this.offset.click.left<this.containment[0]&&(a=this.containment[0]+this.offset.click.left),t.pageY-this.offset.click.top<this.containment[1]&&(s=this.containment[1]+this.offset.click.top),t.pageX-this.offset.click.left>this.containment[2]&&(a=this.containment[2]+this.offset.click.left),t.pageY-this.offset.click.top>this.containment[3]&&(s=this.containment[3]+this.offset.click.top)),o.grid&&(n=this.originalPageY+Math.round((s-this.originalPageY)/o.grid[1])*o.grid[1],s=this.containment?n-this.offset.click.top>=this.containment[1]&&n-this.offset.click.top<=this.containment[3]?n:n-this.offset.click.top>=this.containment[1]?n-o.grid[1]:n+o.grid[1]:n,i=this.originalPageX+Math.round((a-this.originalPageX)/o.grid[0])*o.grid[0],a=this.containment?i-this.offset.click.left>=this.containment[0]&&i-this.offset.click.left<=this.containment[2]?i:i-this.offset.click.left>=this.containment[0]?i-o.grid[0]:i+o.grid[0]:i)),{top:s-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+("fixed"===this.cssPosition?-this.scrollParent.scrollTop():l?0:r.scrollTop()),left:a-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+("fixed"===this.cssPosition?-this.scrollParent.scrollLeft():l?0:r.scrollLeft())}},_rearrange:function(e,t,n,i){n?n[0].appendChild(this.placeholder[0]):t.item[0].parentNode.insertBefore(this.placeholder[0],"down"===this.direction?t.item[0]:t.item[0].nextSibling),this.counter=this.counter?++this.counter:1;var o=this.counter;this._delay(function(){o===this.counter&&this.refreshPositions(!i)})},_clear:function(t,n){this.reverting=!1;var i,o=[];if(!this._noFinalSort&&this.currentItem.parent().length&&this.placeholder.before(this.currentItem),this._noFinalSort=null,this.helper[0]===this.currentItem[0]){for(i in this._storedCSS)("auto"===this._storedCSS[i]||"static"===this._storedCSS[i])&&(this._storedCSS[i]="");this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper")}else this.currentItem.show();for(this.fromOutside&&!n&&o.push(function(e){this._trigger("receive",e,this._uiHash(this.fromOutside))}),(this.fromOutside||this.domPosition.prev!==this.currentItem.prev().not(".ui-sortable-helper")[0]||this.domPosition.parent!==this.currentItem.parent()[0])&&!n&&o.push(function(e){this._trigger("update",e,this._uiHash())}),this!==this.currentContainer&&(n||(o.push(function(e){this._trigger("remove",e,this._uiHash())}),o.push(function(e){return function(t){e._trigger("receive",t,this._uiHash(this))}}.call(this,this.currentContainer)),o.push(function(e){return function(t){e._trigger("update",t,this._uiHash(this))}}.call(this,this.currentContainer)))),i=this.containers.length-1;i>=0;i--)n||o.push(function(e){return function(t){e._trigger("deactivate",t,this._uiHash(this))}}.call(this,this.containers[i])),this.containers[i].containerCache.over&&(o.push(function(e){return function(t){e._trigger("out",t,this._uiHash(this))}}.call(this,this.containers[i])),this.containers[i].containerCache.over=0);if(this._storedCursor&&e("body").css("cursor",this._storedCursor),this._storedOpacity&&this.helper.css("opacity",this._storedOpacity),this._storedZIndex&&this.helper.css("zIndex","auto"===this._storedZIndex?"":this._storedZIndex),this.dragging=!1,this.cancelHelperRemoval){if(!n){for(this._trigger("beforeStop",t,this._uiHash()),i=0;o.length>i;i++)o[i].call(this,t);this._trigger("stop",t,this._uiHash())}return this.fromOutside=!1,!1}if(n||this._trigger("beforeStop",t,this._uiHash()),this.placeholder[0].parentNode.removeChild(this.placeholder[0]),this.helper[0]!==this.currentItem[0]&&this.helper.remove(),this.helper=null,!n){for(i=0;o.length>i;i++)o[i].call(this,t);this._trigger("stop",t,this._uiHash())}return this.fromOutside=!1,!0},_trigger:function(){e.Widget.prototype._trigger.apply(this,arguments)===!1&&this.cancel()},_uiHash:function(t){var n=t||this;return{helper:n.helper,placeholder:n.placeholder||e([]),position:n.position,originalPosition:n.originalPosition,offset:n.positionAbs,item:n.currentItem,sender:t?t.element:null}}})}(jQuery),jQuery.effects||function(e,t){var n="ui-effects-";e.effects={effect:{}},function(e,t){function n(e,t,n){var i=h[t.type]||{};return null==e?n||!t.def?null:t.def:(e=i.floor?~~e:parseFloat(e),isNaN(e)?t.def:i.mod?(e+i.mod)%i.mod:0>e?0:e>i.max?i.max:e)}function i(t){var n=c(),i=n._rgba=[];return t=t.toLowerCase(),f(l,function(e,o){var a,s=o.re.exec(t),r=s&&o.parse(s),l=o.space||"rgba";return r?(a=n[l](r),n[u[l].cache]=a[u[l].cache],i=n._rgba=a._rgba,!1):void 0}),i.length?("0,0,0,0"===i.join()&&e.extend(i,a.transparent),n):a[t]}function o(e,t,n){return n=(n+1)%1,1>6*n?e+6*(t-e)*n:1>2*n?t:2>3*n?e+6*(t-e)*(2/3-n):e}var a,s="backgroundColor borderBottomColor borderLeftColor borderRightColor borderTopColor color columnRuleColor outlineColor textDecorationColor textEmphasisColor",r=/^([\-+])=\s*(\d+\.?\d*)/,l=[{re:/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,parse:function(e){return[e[1],e[2],e[3],e[4]]}},{re:/rgba?\(\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,parse:function(e){return[2.55*e[1],2.55*e[2],2.55*e[3],e[4]]}},{re:/#([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})/,parse:function(e){return[parseInt(e[1],16),parseInt(e[2],16),parseInt(e[3],16)]}},{re:/#([a-f0-9])([a-f0-9])([a-f0-9])/,parse:function(e){return[parseInt(e[1]+e[1],16),parseInt(e[2]+e[2],16),parseInt(e[3]+e[3],16)]}},{re:/hsla?\(\s*(\d+(?:\.\d+)?)\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,space:"hsla",parse:function(e){return[e[1],e[2]/100,e[3]/100,e[4]]}}],c=e.Color=function(t,n,i,o){return new e.Color.fn.parse(t,n,i,o)},u={rgba:{props:{red:{idx:0,type:"byte"},green:{idx:1,type:"byte"},blue:{idx:2,type:"byte"}}},hsla:{props:{hue:{idx:0,type:"degrees"},saturation:{idx:1,type:"percent"},lightness:{idx:2,type:"percent"}}}},h={"byte":{floor:!0,max:255},percent:{max:1},degrees:{mod:360,floor:!0}},d=c.support={},p=e("<p>")[0],f=e.each;p.style.cssText="background-color:rgba(1,1,1,.5)",d.rgba=p.style.backgroundColor.indexOf("rgba")>-1,f(u,function(e,t){t.cache="_"+e,t.props.alpha={idx:3,type:"percent",def:1}}),c.fn=e.extend(c.prototype,{parse:function(o,s,r,l){if(o===t)return this._rgba=[null,null,null,null],this;(o.jquery||o.nodeType)&&(o=e(o).css(s),s=t);var h=this,d=e.type(o),p=this._rgba=[];return s!==t&&(o=[o,s,r,l],d="array"),"string"===d?this.parse(i(o)||a._default):"array"===d?(f(u.rgba.props,function(e,t){p[t.idx]=n(o[t.idx],t)}),this):"object"===d?(o instanceof c?f(u,function(e,t){o[t.cache]&&(h[t.cache]=o[t.cache].slice())}):f(u,function(t,i){var a=i.cache;f(i.props,function(e,t){if(!h[a]&&i.to){if("alpha"===e||null==o[e])return;h[a]=i.to(h._rgba)}h[a][t.idx]=n(o[e],t,!0)}),h[a]&&0>e.inArray(null,h[a].slice(0,3))&&(h[a][3]=1,i.from&&(h._rgba=i.from(h[a])))}),this):void 0},is:function(e){var t=c(e),n=!0,i=this;return f(u,function(e,o){var a,s=t[o.cache];return s&&(a=i[o.cache]||o.to&&o.to(i._rgba)||[],f(o.props,function(e,t){return null!=s[t.idx]?n=s[t.idx]===a[t.idx]:void 0})),n}),n},_space:function(){var e=[],t=this;return f(u,function(n,i){t[i.cache]&&e.push(n)}),e.pop()},transition:function(e,t){var i=c(e),o=i._space(),a=u[o],s=0===this.alpha()?c("transparent"):this,r=s[a.cache]||a.to(s._rgba),l=r.slice();return i=i[a.cache],f(a.props,function(e,o){var a=o.idx,s=r[a],c=i[a],u=h[o.type]||{};null!==c&&(null===s?l[a]=c:(u.mod&&(c-s>u.mod/2?s+=u.mod:s-c>u.mod/2&&(s-=u.mod)),l[a]=n((c-s)*t+s,o)))}),this[o](l)},blend:function(t){if(1===this._rgba[3])return this;var n=this._rgba.slice(),i=n.pop(),o=c(t)._rgba;return c(e.map(n,function(e,t){return(1-i)*o[t]+i*e}))},toRgbaString:function(){var t="rgba(",n=e.map(this._rgba,function(e,t){return null==e?t>2?1:0:e});return 1===n[3]&&(n.pop(),t="rgb("),t+n.join()+")"},toHslaString:function(){var t="hsla(",n=e.map(this.hsla(),function(e,t){return null==e&&(e=t>2?1:0),t&&3>t&&(e=Math.round(100*e)+"%"),e});return 1===n[3]&&(n.pop(),t="hsl("),t+n.join()+")"},toHexString:function(t){var n=this._rgba.slice(),i=n.pop();return t&&n.push(~~(255*i)),"#"+e.map(n,function(e){return e=(e||0).toString(16),1===e.length?"0"+e:e}).join("")},toString:function(){return 0===this._rgba[3]?"transparent":this.toRgbaString()}}),c.fn.parse.prototype=c.fn,u.hsla.to=function(e){if(null==e[0]||null==e[1]||null==e[2])return[null,null,null,e[3]];var t,n,i=e[0]/255,o=e[1]/255,a=e[2]/255,s=e[3],r=Math.max(i,o,a),l=Math.min(i,o,a),c=r-l,u=r+l,h=.5*u;return t=l===r?0:i===r?60*(o-a)/c+360:o===r?60*(a-i)/c+120:60*(i-o)/c+240,n=0===c?0:.5>=h?c/u:c/(2-u),[Math.round(t)%360,n,h,null==s?1:s]},u.hsla.from=function(e){if(null==e[0]||null==e[1]||null==e[2])return[null,null,null,e[3]];var t=e[0]/360,n=e[1],i=e[2],a=e[3],s=.5>=i?i*(1+n):i+n-i*n,r=2*i-s;return[Math.round(255*o(r,s,t+1/3)),Math.round(255*o(r,s,t)),Math.round(255*o(r,s,t-1/3)),a]},f(u,function(i,o){var a=o.props,s=o.cache,l=o.to,u=o.from;c.fn[i]=function(i){if(l&&!this[s]&&(this[s]=l(this._rgba)),i===t)return this[s].slice();var o,r=e.type(i),h="array"===r||"object"===r?i:arguments,d=this[s].slice();return f(a,function(e,t){var i=h["object"===r?e:t.idx];null==i&&(i=d[t.idx]),d[t.idx]=n(i,t)}),u?(o=c(u(d)),o[s]=d,o):c(d)},f(a,function(t,n){c.fn[t]||(c.fn[t]=function(o){var a,s=e.type(o),l="alpha"===t?this._hsla?"hsla":"rgba":i,c=this[l](),u=c[n.idx];return"undefined"===s?u:("function"===s&&(o=o.call(this,u),s=e.type(o)),null==o&&n.empty?this:("string"===s&&(a=r.exec(o),a&&(o=u+parseFloat(a[2])*("+"===a[1]?1:-1))),c[n.idx]=o,this[l](c)))})})}),c.hook=function(t){var n=t.split(" ");f(n,function(t,n){e.cssHooks[n]={set:function(t,o){var a,s,r="";if("transparent"!==o&&("string"!==e.type(o)||(a=i(o)))){if(o=c(a||o),!d.rgba&&1!==o._rgba[3]){for(s="backgroundColor"===n?t.parentNode:t;(""===r||"transparent"===r)&&s&&s.style;)try{r=e.css(s,"backgroundColor"),s=s.parentNode}catch(l){}o=o.blend(r&&"transparent"!==r?r:"_default")}o=o.toRgbaString()}try{t.style[n]=o}catch(l){}}},e.fx.step[n]=function(t){t.colorInit||(t.start=c(t.elem,n),t.end=c(t.end),t.colorInit=!0),e.cssHooks[n].set(t.elem,t.start.transition(t.end,t.pos))}})},c.hook(s),e.cssHooks.borderColor={expand:function(e){var t={};return f(["Top","Right","Bottom","Left"],function(n,i){t["border"+i+"Color"]=e}),t}},a=e.Color.names={aqua:"#00ffff",black:"#000000",blue:"#0000ff",fuchsia:"#ff00ff",gray:"#808080",green:"#008000",lime:"#00ff00",maroon:"#800000",navy:"#000080",olive:"#808000",purple:"#800080",red:"#ff0000",silver:"#c0c0c0",teal:"#008080",white:"#ffffff",yellow:"#ffff00",transparent:[null,null,null,0],_default:"#ffffff"}}(jQuery),function(){function n(t){var n,i,o=t.ownerDocument.defaultView?t.ownerDocument.defaultView.getComputedStyle(t,null):t.currentStyle,a={};if(o&&o.length&&o[0]&&o[o[0]])for(i=o.length;i--;)n=o[i],"string"==typeof o[n]&&(a[e.camelCase(n)]=o[n]);else for(n in o)"string"==typeof o[n]&&(a[n]=o[n]);return a}function i(t,n){var i,o,s={};for(i in n)o=n[i],t[i]!==o&&!a[i]&&(e.fx.step[i]||!isNaN(parseFloat(o)))&&(s[i]=o);return s}var o=["add","remove","toggle"],a={border:1,borderBottom:1,borderColor:1,borderLeft:1,borderRight:1,borderTop:1,borderWidth:1,margin:1,padding:1};e.each(["borderLeftStyle","borderRightStyle","borderBottomStyle","borderTopStyle"],function(t,n){e.fx.step[n]=function(e){("none"!==e.end&&!e.setAttr||1===e.pos&&!e.setAttr)&&(jQuery.style(e.elem,n,e.end),e.setAttr=!0)}}),e.fn.addBack||(e.fn.addBack=function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}),e.effects.animateClass=function(t,a,s,r){var l=e.speed(a,s,r);return this.queue(function(){var a,s=e(this),r=s.attr("class")||"",c=l.children?s.find("*").addBack():s;c=c.map(function(){var t=e(this);return{el:t,start:n(this)}}),a=function(){e.each(o,function(e,n){t[n]&&s[n+"Class"](t[n])})},a(),c=c.map(function(){return this.end=n(this.el[0]),this.diff=i(this.start,this.end),this}),s.attr("class",r),c=c.map(function(){var t=this,n=e.Deferred(),i=e.extend({},l,{queue:!1,complete:function(){n.resolve(t)}});return this.el.animate(this.diff,i),n.promise()}),e.when.apply(e,c.get()).done(function(){a(),e.each(arguments,function(){var t=this.el;e.each(this.diff,function(e){t.css(e,"")})}),l.complete.call(s[0])})})},e.fn.extend({_addClass:e.fn.addClass,addClass:function(t,n,i,o){return n?e.effects.animateClass.call(this,{add:t},n,i,o):this._addClass(t)},_removeClass:e.fn.removeClass,removeClass:function(t,n,i,o){return n?e.effects.animateClass.call(this,{remove:t},n,i,o):this._removeClass(t)},_toggleClass:e.fn.toggleClass,toggleClass:function(n,i,o,a,s){return"boolean"==typeof i||i===t?o?e.effects.animateClass.call(this,i?{add:n}:{remove:n},o,a,s):this._toggleClass(n,i):e.effects.animateClass.call(this,{toggle:n},i,o,a)},switchClass:function(t,n,i,o,a){return e.effects.animateClass.call(this,{add:n,remove:t},i,o,a)}})}(),function(){function i(t,n,i,o){return e.isPlainObject(t)&&(n=t,t=t.effect),t={effect:t},null==n&&(n={}),e.isFunction(n)&&(o=n,i=null,n={}),("number"==typeof n||e.fx.speeds[n])&&(o=i,i=n,n={}),e.isFunction(i)&&(o=i,i=null),n&&e.extend(t,n),i=i||n.duration,t.duration=e.fx.off?0:"number"==typeof i?i:i in e.fx.speeds?e.fx.speeds[i]:e.fx.speeds._default,t.complete=o||n.complete,t}function o(t){return!t||"number"==typeof t||e.fx.speeds[t]?!0:"string"==typeof t&&!e.effects.effect[t]}e.extend(e.effects,{version:"1.10.0",save:function(e,t){for(var i=0;t.length>i;i++)null!==t[i]&&e.data(n+t[i],e[0].style[t[i]])},restore:function(e,i){var o,a;for(a=0;i.length>a;a++)null!==i[a]&&(o=e.data(n+i[a]),o===t&&(o=""),e.css(i[a],o))},setMode:function(e,t){return"toggle"===t&&(t=e.is(":hidden")?"show":"hide"),t},getBaseline:function(e,t){var n,i;switch(e[0]){case"top":n=0;break;case"middle":n=.5;break;case"bottom":n=1;break;default:n=e[0]/t.height}switch(e[1]){case"left":i=0;break;case"center":i=.5;break;case"right":i=1;break;default:i=e[1]/t.width}return{x:i,y:n}},createWrapper:function(t){if(t.parent().is(".ui-effects-wrapper"))return t.parent();var n={width:t.outerWidth(!0),height:t.outerHeight(!0),"float":t.css("float")},i=e("<div></div>").addClass("ui-effects-wrapper").css({fontSize:"100%",background:"transparent",border:"none",margin:0,padding:0}),o={width:t.width(),height:t.height()},a=document.activeElement;try{a.id}catch(s){a=document.body}return t.wrap(i),(t[0]===a||e.contains(t[0],a))&&e(a).focus(),i=t.parent(),"static"===t.css("position")?(i.css({position:"relative"}),t.css({position:"relative"})):(e.extend(n,{position:t.css("position"),zIndex:t.css("z-index")}),e.each(["top","left","bottom","right"],function(e,i){n[i]=t.css(i),isNaN(parseInt(n[i],10))&&(n[i]="auto")}),t.css({position:"relative",top:0,left:0,right:"auto",bottom:"auto"})),t.css(o),i.css(n).show()},removeWrapper:function(t){var n=document.activeElement;return t.parent().is(".ui-effects-wrapper")&&(t.parent().replaceWith(t),(t[0]===n||e.contains(t[0],n))&&e(n).focus()),t},setTransition:function(t,n,i,o){return o=o||{},e.each(n,function(e,n){var a=t.cssUnit(n);a[0]>0&&(o[n]=a[0]*i+a[1])}),o}}),e.fn.extend({effect:function(){function t(t){function i(){e.isFunction(a)&&a.call(o[0]),e.isFunction(t)&&t()}var o=e(this),a=n.complete,r=n.mode;(o.is(":hidden")?"hide"===r:"show"===r)?i():s.call(o[0],n,i)}var n=i.apply(this,arguments),o=n.mode,a=n.queue,s=e.effects.effect[n.effect];return e.fx.off||!s?o?this[o](n.duration,n.complete):this.each(function(){n.complete&&n.complete.call(this)}):a===!1?this.each(t):this.queue(a||"fx",t)},_show:e.fn.show,show:function(e){if(o(e))return this._show.apply(this,arguments);var t=i.apply(this,arguments);return t.mode="show",this.effect.call(this,t)},_hide:e.fn.hide,hide:function(e){if(o(e))return this._hide.apply(this,arguments);var t=i.apply(this,arguments);return t.mode="hide",this.effect.call(this,t)},__toggle:e.fn.toggle,toggle:function(t){if(o(t)||"boolean"==typeof t||e.isFunction(t))return this.__toggle.apply(this,arguments);var n=i.apply(this,arguments);return n.mode="toggle",this.effect.call(this,n)},cssUnit:function(t){var n=this.css(t),i=[];return e.each(["em","px","%","pt"],function(e,t){n.indexOf(t)>0&&(i=[parseFloat(n),t])}),i}})}(),function(){var t={};e.each(["Quad","Cubic","Quart","Quint","Expo"],function(e,n){t[n]=function(t){return Math.pow(t,e+2)}}),e.extend(t,{Sine:function(e){return 1-Math.cos(e*Math.PI/2)},Circ:function(e){return 1-Math.sqrt(1-e*e)},Elastic:function(e){return 0===e||1===e?e:-Math.pow(2,8*(e-1))*Math.sin((80*(e-1)-7.5)*Math.PI/15)},Back:function(e){return e*e*(3*e-2)},Bounce:function(e){for(var t,n=4;((t=Math.pow(2,--n))-1)/11>e;);return 1/Math.pow(4,3-n)-7.5625*Math.pow((3*t-2)/22-e,2)}}),e.each(t,function(t,n){e.easing["easeIn"+t]=n,e.easing["easeOut"+t]=function(e){return 1-n(1-e)},e.easing["easeInOut"+t]=function(e){return.5>e?n(2*e)/2:1-n(-2*e+2)/2}})}()}(jQuery),function(e){var t=/up|down|vertical/,n=/up|left|vertical|horizontal/;e.effects.effect.blind=function(i,o){var a,s,r,l=e(this),c=["position","top","bottom","left","right","height","width"],u=e.effects.setMode(l,i.mode||"hide"),h=i.direction||"up",d=t.test(h),p=d?"height":"width",f=d?"top":"left",m=n.test(h),g={},_="show"===u;l.parent().is(".ui-effects-wrapper")?e.effects.save(l.parent(),c):e.effects.save(l,c),l.show(),a=e.effects.createWrapper(l).css({overflow:"hidden"}),s=a[p](),r=parseFloat(a.css(f))||0,g[p]=_?s:0,m||(l.css(d?"bottom":"right",0).css(d?"top":"left","auto").css({position:"absolute"}),g[f]=_?r:s+r),_&&(a.css(p,0),m||a.css(f,r+s)),a.animate(g,{duration:i.duration,easing:i.easing,queue:!1,complete:function(){"hide"===u&&l.hide(),e.effects.restore(l,c),e.effects.removeWrapper(l),o()}})}}(jQuery),function(e){e.effects.effect.bounce=function(t,n){var i,o,a,s=e(this),r=["position","top","bottom","left","right","height","width"],l=e.effects.setMode(s,t.mode||"effect"),c="hide"===l,u="show"===l,h=t.direction||"up",d=t.distance,p=t.times||5,f=2*p+(u||c?1:0),m=t.duration/f,g=t.easing,_="up"===h||"down"===h?"top":"left",v="up"===h||"left"===h,y=s.queue(),w=y.length;for((u||c)&&r.push("opacity"),e.effects.save(s,r),s.show(),e.effects.createWrapper(s),d||(d=s["top"===_?"outerHeight":"outerWidth"]()/3),u&&(a={opacity:1},a[_]=0,s.css("opacity",0).css(_,v?2*-d:2*d).animate(a,m,g)),c&&(d/=Math.pow(2,p-1)),a={},a[_]=0,i=0;p>i;i++)o={},o[_]=(v?"-=":"+=")+d,s.animate(o,m,g).animate(a,m,g),d=c?2*d:d/2;c&&(o={opacity:0},o[_]=(v?"-=":"+=")+d,s.animate(o,m,g)),s.queue(function(){c&&s.hide(),e.effects.restore(s,r),e.effects.removeWrapper(s),n()}),w>1&&y.splice.apply(y,[1,0].concat(y.splice(w,f+1))),s.dequeue()}}(jQuery),function(e){e.effects.effect.clip=function(t,n){var i,o,a,s=e(this),r=["position","top","bottom","left","right","height","width"],l=e.effects.setMode(s,t.mode||"hide"),c="show"===l,u=t.direction||"vertical",h="vertical"===u,d=h?"height":"width",p=h?"top":"left",f={};e.effects.save(s,r),s.show(),i=e.effects.createWrapper(s).css({overflow:"hidden"}),o="IMG"===s[0].tagName?i:s,a=o[d](),c&&(o.css(d,0),o.css(p,a/2)),f[d]=c?a:0,f[p]=c?0:a/2,o.animate(f,{queue:!1,duration:t.duration,easing:t.easing,complete:function(){c||s.hide(),e.effects.restore(s,r),e.effects.removeWrapper(s),n()}})}}(jQuery),function(e){e.effects.effect.drop=function(t,n){var i,o=e(this),a=["position","top","bottom","left","right","opacity","height","width"],s=e.effects.setMode(o,t.mode||"hide"),r="show"===s,l=t.direction||"left",c="up"===l||"down"===l?"top":"left",u="up"===l||"left"===l?"pos":"neg",h={opacity:r?1:0};e.effects.save(o,a),o.show(),e.effects.createWrapper(o),i=t.distance||o["top"===c?"outerHeight":"outerWidth"](!0)/2,r&&o.css("opacity",0).css(c,"pos"===u?-i:i),h[c]=(r?"pos"===u?"+=":"-=":"pos"===u?"-=":"+=")+i,o.animate(h,{queue:!1,duration:t.duration,easing:t.easing,complete:function(){"hide"===s&&o.hide(),e.effects.restore(o,a),e.effects.removeWrapper(o),n()}})}}(jQuery),function(e){e.effects.effect.explode=function(t,n){function i(){y.push(this),y.length===h*d&&o()}function o(){p.css({visibility:"visible"}),e(y).remove(),m||p.hide(),n()}var a,s,r,l,c,u,h=t.pieces?Math.round(Math.sqrt(t.pieces)):3,d=h,p=e(this),f=e.effects.setMode(p,t.mode||"hide"),m="show"===f,g=p.show().css("visibility","hidden").offset(),_=Math.ceil(p.outerWidth()/d),v=Math.ceil(p.outerHeight()/h),y=[];for(a=0;h>a;a++)for(l=g.top+a*v,u=a-(h-1)/2,s=0;d>s;s++)r=g.left+s*_,c=s-(d-1)/2,p.clone().appendTo("body").wrap("<div></div>").css({position:"absolute",visibility:"visible",left:-s*_,top:-a*v}).parent().addClass("ui-effects-explode").css({position:"absolute",overflow:"hidden",width:_,height:v,left:r+(m?c*_:0),top:l+(m?u*v:0),opacity:m?0:1}).animate({left:r+(m?0:c*_),top:l+(m?0:u*v),opacity:m?1:0},t.duration||500,t.easing,i)}}(jQuery),function(e){e.effects.effect.fade=function(t,n){var i=e(this),o=e.effects.setMode(i,t.mode||"toggle");i.animate({opacity:o},{queue:!1,duration:t.duration,easing:t.easing,complete:n})}}(jQuery),function(e){e.effects.effect.fold=function(t,n){var i,o,a=e(this),s=["position","top","bottom","left","right","height","width"],r=e.effects.setMode(a,t.mode||"hide"),l="show"===r,c="hide"===r,u=t.size||15,h=/([0-9]+)%/.exec(u),d=!!t.horizFirst,p=l!==d,f=p?["width","height"]:["height","width"],m=t.duration/2,g={},_={};e.effects.save(a,s),a.show(),i=e.effects.createWrapper(a).css({overflow:"hidden"}),o=p?[i.width(),i.height()]:[i.height(),i.width()],h&&(u=parseInt(h[1],10)/100*o[c?0:1]),l&&i.css(d?{height:0,width:u}:{height:u,width:0}),g[f[0]]=l?o[0]:u,_[f[1]]=l?o[1]:0,i.animate(g,m,t.easing).animate(_,m,t.easing,function(){c&&a.hide(),e.effects.restore(a,s),e.effects.removeWrapper(a),n()})}}(jQuery),function(e){e.effects.effect.highlight=function(t,n){var i=e(this),o=["backgroundImage","backgroundColor","opacity"],a=e.effects.setMode(i,t.mode||"show"),s={backgroundColor:i.css("backgroundColor")};"hide"===a&&(s.opacity=0),e.effects.save(i,o),i.show().css({backgroundImage:"none",backgroundColor:t.color||"#ffff99"}).animate(s,{queue:!1,duration:t.duration,easing:t.easing,complete:function(){"hide"===a&&i.hide(),e.effects.restore(i,o),n()}})}}(jQuery),function(e){e.effects.effect.pulsate=function(t,n){var i,o=e(this),a=e.effects.setMode(o,t.mode||"show"),s="show"===a,r="hide"===a,l=s||"hide"===a,c=2*(t.times||5)+(l?1:0),u=t.duration/c,h=0,d=o.queue(),p=d.length;for((s||!o.is(":visible"))&&(o.css("opacity",0).show(),h=1),i=1;c>i;i++)o.animate({opacity:h},u,t.easing),h=1-h;o.animate({opacity:h},u,t.easing),o.queue(function(){r&&o.hide(),n()}),p>1&&d.splice.apply(d,[1,0].concat(d.splice(p,c+1))),o.dequeue()}}(jQuery),function(e){e.effects.effect.puff=function(t,n){var i=e(this),o=e.effects.setMode(i,t.mode||"hide"),a="hide"===o,s=parseInt(t.percent,10)||150,r=s/100,l={height:i.height(),width:i.width(),outerHeight:i.outerHeight(),outerWidth:i.outerWidth()};e.extend(t,{effect:"scale",queue:!1,fade:!0,mode:o,complete:n,percent:a?s:100,from:a?l:{height:l.height*r,width:l.width*r,outerHeight:l.outerHeight*r,outerWidth:l.outerWidth*r}}),i.effect(t)},e.effects.effect.scale=function(t,n){var i=e(this),o=e.extend(!0,{},t),a=e.effects.setMode(i,t.mode||"effect"),s=parseInt(t.percent,10)||(0===parseInt(t.percent,10)?0:"hide"===a?0:100),r=t.direction||"both",l=t.origin,c={height:i.height(),width:i.width(),outerHeight:i.outerHeight(),outerWidth:i.outerWidth()},u={y:"horizontal"!==r?s/100:1,x:"vertical"!==r?s/100:1};o.effect="size",o.queue=!1,o.complete=n,"effect"!==a&&(o.origin=l||["middle","center"],o.restore=!0),o.from=t.from||("show"===a?{height:0,width:0,outerHeight:0,outerWidth:0}:c),o.to={height:c.height*u.y,width:c.width*u.x,outerHeight:c.outerHeight*u.y,outerWidth:c.outerWidth*u.x},o.fade&&("show"===a&&(o.from.opacity=0,o.to.opacity=1),"hide"===a&&(o.from.opacity=1,o.to.opacity=0)),i.effect(o)},e.effects.effect.size=function(t,n){var i,o,a,s=e(this),r=["position","top","bottom","left","right","width","height","overflow","opacity"],l=["position","top","bottom","left","right","overflow","opacity"],c=["width","height","overflow"],u=["fontSize"],h=["borderTopWidth","borderBottomWidth","paddingTop","paddingBottom"],d=["borderLeftWidth","borderRightWidth","paddingLeft","paddingRight"],p=e.effects.setMode(s,t.mode||"effect"),f=t.restore||"effect"!==p,m=t.scale||"both",g=t.origin||["middle","center"],_=s.css("position"),v=f?r:l,y={height:0,width:0,outerHeight:0,outerWidth:0};"show"===p&&s.show(),i={height:s.height(),width:s.width(),outerHeight:s.outerHeight(),outerWidth:s.outerWidth()},"toggle"===t.mode&&"show"===p?(s.from=t.to||y,s.to=t.from||i):(s.from=t.from||("show"===p?y:i),s.to=t.to||("hide"===p?y:i)),a={from:{y:s.from.height/i.height,x:s.from.width/i.width},to:{y:s.to.height/i.height,x:s.to.width/i.width}},("box"===m||"both"===m)&&(a.from.y!==a.to.y&&(v=v.concat(h),s.from=e.effects.setTransition(s,h,a.from.y,s.from),s.to=e.effects.setTransition(s,h,a.to.y,s.to)),a.from.x!==a.to.x&&(v=v.concat(d),s.from=e.effects.setTransition(s,d,a.from.x,s.from),s.to=e.effects.setTransition(s,d,a.to.x,s.to))),("content"===m||"both"===m)&&a.from.y!==a.to.y&&(v=v.concat(u).concat(c),s.from=e.effects.setTransition(s,u,a.from.y,s.from),s.to=e.effects.setTransition(s,u,a.to.y,s.to)),e.effects.save(s,v),s.show(),e.effects.createWrapper(s),s.css("overflow","hidden").css(s.from),g&&(o=e.effects.getBaseline(g,i),s.from.top=(i.outerHeight-s.outerHeight())*o.y,s.from.left=(i.outerWidth-s.outerWidth())*o.x,s.to.top=(i.outerHeight-s.to.outerHeight)*o.y,s.to.left=(i.outerWidth-s.to.outerWidth)*o.x),s.css(s.from),("content"===m||"both"===m)&&(h=h.concat(["marginTop","marginBottom"]).concat(u),d=d.concat(["marginLeft","marginRight"]),c=r.concat(h).concat(d),s.find("*[width]").each(function(){var n=e(this),i={height:n.height(),width:n.width(),outerHeight:n.outerHeight(),outerWidth:n.outerWidth()};f&&e.effects.save(n,c),n.from={height:i.height*a.from.y,width:i.width*a.from.x,outerHeight:i.outerHeight*a.from.y,outerWidth:i.outerWidth*a.from.x},n.to={height:i.height*a.to.y,width:i.width*a.to.x,outerHeight:i.height*a.to.y,outerWidth:i.width*a.to.x},a.from.y!==a.to.y&&(n.from=e.effects.setTransition(n,h,a.from.y,n.from),n.to=e.effects.setTransition(n,h,a.to.y,n.to)),a.from.x!==a.to.x&&(n.from=e.effects.setTransition(n,d,a.from.x,n.from),n.to=e.effects.setTransition(n,d,a.to.x,n.to)),n.css(n.from),n.animate(n.to,t.duration,t.easing,function(){f&&e.effects.restore(n,c)})})),s.animate(s.to,{queue:!1,duration:t.duration,easing:t.easing,complete:function(){0===s.to.opacity&&s.css("opacity",s.from.opacity),"hide"===p&&s.hide(),e.effects.restore(s,v),f||("static"===_?s.css({position:"relative",top:s.to.top,left:s.to.left}):e.each(["top","left"],function(e,t){s.css(t,function(t,n){var i=parseInt(n,10),o=e?s.to.left:s.to.top;return"auto"===n?o+"px":i+o+"px"})})),e.effects.removeWrapper(s),n()}})}}(jQuery),function(e){e.effects.effect.shake=function(t,n){var i,o=e(this),a=["position","top","bottom","left","right","height","width"],s=e.effects.setMode(o,t.mode||"effect"),r=t.direction||"left",l=t.distance||20,c=t.times||3,u=2*c+1,h=Math.round(t.duration/u),d="up"===r||"down"===r?"top":"left",p="up"===r||"left"===r,f={},m={},g={},_=o.queue(),v=_.length;for(e.effects.save(o,a),o.show(),e.effects.createWrapper(o),f[d]=(p?"-=":"+=")+l,m[d]=(p?"+=":"-=")+2*l,g[d]=(p?"-=":"+=")+2*l,o.animate(f,h,t.easing),i=1;c>i;i++)o.animate(m,h,t.easing).animate(g,h,t.easing);o.animate(m,h,t.easing).animate(f,h/2,t.easing).queue(function(){"hide"===s&&o.hide(),e.effects.restore(o,a),e.effects.removeWrapper(o),n()}),v>1&&_.splice.apply(_,[1,0].concat(_.splice(v,u+1))),o.dequeue()}}(jQuery),function(e){e.effects.effect.slide=function(t,n){var i,o=e(this),a=["position","top","bottom","left","right","width","height"],s=e.effects.setMode(o,t.mode||"show"),r="show"===s,l=t.direction||"left",c="up"===l||"down"===l?"top":"left",u="up"===l||"left"===l,h={};e.effects.save(o,a),o.show(),i=t.distance||o["top"===c?"outerHeight":"outerWidth"](!0),e.effects.createWrapper(o).css({overflow:"hidden"}),r&&o.css(c,u?isNaN(i)?"-"+i:-i:i),h[c]=(r?u?"+=":"-=":u?"-=":"+=")+i,o.animate(h,{queue:!1,duration:t.duration,easing:t.easing,complete:function(){"hide"===s&&o.hide(),e.effects.restore(o,a),e.effects.removeWrapper(o),n()}})}}(jQuery),function(e){e.effects.effect.transfer=function(t,n){var i=e(this),o=e(t.to),a="fixed"===o.css("position"),s=e("body"),r=a?s.scrollTop():0,l=a?s.scrollLeft():0,c=o.offset(),u={top:c.top-r,left:c.left-l,height:o.innerHeight(),width:o.innerWidth()},h=i.offset(),d=e("<div class='ui-effects-transfer'></div>").appendTo(document.body).addClass(t.className).css({top:h.top-r,left:h.left-l,height:i.innerHeight(),width:i.innerWidth(),position:a?"fixed":"absolute"}).animate(u,t.duration,t.easing,function(){d.remove(),n()})}}(jQuery),define("jqueryui",["jquery"],function(){}),define("modules/chat/views/chat_list",["handlebars","modules/common/utility","underscore.string","underscore","backbone","jquery","jqueryui","modules/common/date_format"],function(e,t,n,i,o){var a='<li><div class="chat-list-avatar pull-left">{{#if is_private_chat}}<i class="chat-list-item-unread-msgs ico ico-32" style="background-image: url('+url.image+'/u/{{chatname}}?w=32&h=32&a=1&c=1);"></i>'+"{{else}}"+"{{#if is_chatroom}}"+'<i class="ico ico-32 ico-chatroom-default"></i>'+"{{else}}"+"{{#if is_group_chat}}"+'<i class="ico ico-32 ico-groupchat-default"></i>'+"{{/if}}"+"{{/if}}"+"{{/if}}"+"</div>"+'<div class="chat-list-details pull-left">'+'<a href="#" class="chat-list-title" id="l_{{chat_handle}}">{{chatname}}</a>'+'<div class="chat-list-message">{{translate "chat|default_chat_message_text"}}</div>'+"</div>"+'<div class="chat-list-time pull-right"></div>'+'<a href="#" class="pull-right chat-list-close-btn" title="{{translate "chat|leave_conversation"}}">&times;</a>'+'<br class="clear" />'+"</li>",s=e.compile(a),r=function(e){this.$el=$(e),t.isolate_scroll(this.$el),this.__cache={},this.__chat_model_cache={}};return i.extend(r.prototype,o.Events),i.extend(r.prototype,{addChatItem:function(e){var n=e.getTitle(),i=e.get("chatHandle"),o=this.__cache[i];if(!(o&&o.length>0)){var a=s({chatname:n,is_chatroom:e.is_chat_room(),is_group_chat:e.is_group_chat(),is_private_chat:!(e.is_chat_room()||e.is_group_chat()),chat_handle:e.get("chatHandle")}),r=this,l=$(a);l.appendTo(this.$el),this.__cache[i]=l,this.__chat_model_cache[i]=e,l.find(".chat-list-close-btn").on("click",function(n){var i=!(e.is_chat_room()||e.is_group_chat());i||(i=window.confirm(t.translate("chat|confirm_group_chat_close"))),i&&r.trigger("chat_close_request",e),n.preventDefault(),n.stopPropagation()}),l.on("click",function(t){t.preventDefault(),t.stopPropagation(),r.trigger("chat_list_click",e)}),l.find(".badge").css("visibility","hidden"),e.is_group_chat()&&(e.on("participant_added",function(){this.updateTitle(e)},this),e.on("chat_name_change",function(){this.updateTitle(e)},this)),e.on("unread_message_count_changed",function(){this.setUnreadCount(e),this.trigger("unread_message_count_changed",this.get_unread_chat_count())},this),e.on("chat_message_added",function(){this.setMessageTime(e),this.setLastMessage(e)
},this),this.setMessageTime(e),this.setLastMessage(e)}},updateTitle:function(e){var t=e.get("chatHandle"),i=this.__cache[t];if(i){var o=i.find("a.chat-list-title"),a=e.getTitle();a=n.truncate(a,40),o.text(a)}},get_unread_chat_count:function(){var e=0;return i.each(this.__chat_model_cache,function(t){t&&t.get_unread_message_count()&&(e+=1)}),e},removeChatItem:function(e){var t=e.get("chatHandle"),n=this.__cache[t];n&&n.remove(),this.__cache[t]=null,this.__chat_model_cache[t]=null},setMessageTime:function(e){var n=e.getLastMessage(),o=null;if(n)try{o=n.get("time").getTime()}catch(a){console.log("Failed to parse time!")}(!o||i.isNaN(o))&&(o=e.getInitializationTime());var s=t.dateFormat(o,"HH:MM"),r=e.get("chatHandle"),l=this.__cache[r];l&&$(".chat-list-time",l).text(s)},setLastMessage:function(e){var n=e.getLastMessage(),i=null;i=n?t.htmlDecode(n.get("message")):t.translate("chat|default_chat_message_text");var o=e.get("chatHandle"),a=this.__cache[o];a&&$(".chat-list-message",a).text(i)},setUnreadCount:function(e){var t=e.get_unread_message_count(),n=e.get("chatHandle"),i=this.__cache[n];if(i){var o=i.find(".chat-list-item-unread-msgs");t>0?o.empty().append('<span class="badge badge-mig33">'+t+"</span>"):o.empty()}},hilightChatItem:function(e){var t=e.get("chatHandle"),n=this.__cache[t];n&&n.effect("shake",{times:1,distance:2,direction:"left"},600)},resize:function(e){this.$el.height(e-22)}}),r}),define("modules/chat/views/chat_summary",["modules/chat/config/config","modules/chat/models/session","modules/common/utility","underscore","backbone","jquery"],function(e,t,n,i,o){var a=30,s={};for(var r in e.Presence)s[e.Presence[r]]=r;var l=function(e){this.$el=e,this.$status_input=$(".status-msg",e),this.$presence_change_links=$("ul#presence-list span.status",e).parent(),this.init()};return i.extend(l.prototype,o.Events),i.extend(l.prototype,{init:function(){if(session_user){this.$status_input.val(session_user.status_message);var n=this;this.$status_input.keyup(function(e){13==e.keyCode&&(n.set_status_message(),n.$status_input.blur()),27==e.keyCode&&(n.$status_input.val(session_user.status_message),n.$status_input.blur())}),this.$status_input.on("focus",function(e){i.delay(function(){n.$status_input.select()},0),e.preventDefault(),e.stopPropagation()}),this.$status_input.on("blur",function(){n.set_status_message()}),this.$presence_change_links.click(function(n){n.preventDefault();var i=$("span.status",this).attr("class"),o=i.match(/(fusion-(\S+))/);o&&t.setPresence(e.Presence[o[2]])}),t.on("change:presence",this.set_presence,this)}},set_presence:function(e,t){$(".current-presence .status",this.$el).removeAttr("class").addClass("status fusion-"+s[t])},set_status_message:function(){var e=this.$status_input.val();e=$.trim(e),""!==e&&e!==session_user.status_message&&(t.set_status_message(e),n.show_success(n.translate("chat|status_message_set")))},resize:function(e){this.$status_input.width(e-a)},resetResize:function(){this.$status_input.removeAttr("style")}}),l}),define("hbs",["handlebars"],function(e){var t={},n=".hbs";return{load:function(i,o,a,s){var r=s.hbs&&s.hbs.templateExtension?s.hbs.templateExtension:n;if(s.isBuild){var l=nodeRequire("fs"),c=s.dirBaseUrl+"/"+i+r;t[i]=""+l.readFileSync(c),a()}else o(["text!"+i+r],function(t){a(e.compile(t))})},write:function(n,i,o){var a=e.precompile(t[i]);o("define('hbs!"+i+"', ['handlebars'], function(Handlebars){ \n"+"return Handlebars.template("+(""+a)+");\n"+"});\n")}}}),define("hbs!modules/template/chat/chat-panel",["handlebars"],function(e){return e.template(function(e,t,n,i,o){this.compilerInfo=[4,">= 1.0.0"],n=this.merge(n,e.helpers),o=o||{};var a,s,r="",l=n.helperMissing,c=this.escapeExpression;return r+='<ul class="nav nav-tabs" id="chat-sidebar-tabs">\n <li id="messages-panel-tab" class="messages active" style="display:none">\n <a href="#messages-panel" data-toggle="tab">\n <img src="',s={hash:{},data:o},r+=c((a=n.getUrl||t.getUrl,a?a.call(t,"cdn",s):l.call(t,"getUrl","cdn",s))),s={hash:{},data:o},r+=c((a=n.getUrl||t.getUrl,a?a.call(t,"jsclient",s):l.call(t,"getUrl","jsclient",s)))+'/app/images/w_ic_chatmanager.png" />\n <span class="chat-unread-count" style="display: none;"></span>\n </a>\n </li>\n <li id="chat-panel-tab" class="contacts minimized-display">\n <a href="#chat-panel" data-toggle="tab">\n <img src="',s={hash:{},data:o},r+=c((a=n.getUrl||t.getUrl,a?a.call(t,"cdn",s):l.call(t,"getUrl","cdn",s))),s={hash:{},data:o},r+=c((a=n.getUrl||t.getUrl,a?a.call(t,"jsclient",s):l.call(t,"getUrl","jsclient",s)))+'/app/images/w_ic_friendlist.png" />\n </a>\n </li>\n</ul>\n\n<div class="tab-content">\n <div class="tab-pane" id="chat-panel">\n <div class="chat-content">\n <div class="chat-header-bar">\n <div class="chat-summary">\n <div class="btn-group pull-left" id="presence">\n <a class="btn dropdown-toggle current-presence" data-toggle="dropdown" href="#" title="',s={hash:{},data:o},r+=c((a=n.translate||t.translate,a?a.call(t,"chat|change_presence",s):l.call(t,"translate","chat|change_presence",s)))+'">\n <span class="status fusion-offline"></span>\n <span class="downward-arrow"></span>\n </a>\n <ul id="presence-list" class="dropdown-menu">\n <li><a href="#"><span class="status fusion-online"></span>&nbsp;',s={hash:{},data:o},r+=c((a=n.translate||t.translate,a?a.call(t,"chat|status_online",s):l.call(t,"translate","chat|status_online",s)))+'</a></li>\n <li><a href="#"><span class="status fusion-busy"></span>&nbsp;',s={hash:{},data:o},r+=c((a=n.translate||t.translate,a?a.call(t,"chat|status_busy",s):l.call(t,"translate","chat|status_busy",s)))+'</a></li>\n <li><a href="#"><span class="status fusion-away"></span>&nbsp;',s={hash:{},data:o},r+=c((a=n.translate||t.translate,a?a.call(t,"chat|status_away",s):l.call(t,"translate","chat|status_away",s)))+'</a></li>\n <li><a href="#"><span class="status fusion-offline"></span>&nbsp;',s={hash:{},data:o},r+=c((a=n.translate||t.translate,a?a.call(t,"chat|status_offline",s):l.call(t,"translate","chat|status_offline",s)))+'</a></li>\n </ul>\n </div>\n <div class="status-msg-container pull-left">\n <input type="text" class="status-msg" placeholder="',s={hash:{},data:o},r+=c((a=n.translate||t.translate,a?a.call(t,"chat|update_status",s):l.call(t,"translate","chat|update_status",s)))+'" />\n </div>\n <div class="clear"></div>\n </div>\n </div>\n <div id="friends" class="chat-list contact-list">\n <div class="chat-list-header">\n <ul class="contact-action-container inline">\n <li><a href="#" class="search-friends" title="',s={hash:{},data:o},r+=c((a=n.translate||t.translate,a?a.call(t,"chat|search_friends",s):l.call(t,"translate","chat|search_friends",s)))+'"><i class="ico ico-32 ico-search"></i></a></li>\n <li><a href="#" class="invite-friends" title="',s={hash:{},data:o},r+=c((a=n.translate||t.translate,a?a.call(t,"chat|add_contact_group",s):l.call(t,"translate","chat|add_contact_group",s)))+'"><i class="ico ico-32 ico-add-friends"></i></a></li>\n <li><a href="#" class="contacts-toggle" title="',s={hash:{},data:o},r+=c((a=n.translate||t.translate,a?a.call(t,"chat|show_offline_contacts",s):l.call(t,"translate","chat|show_offline_contacts",s)))+'"><i class="ico ico-32 ico-contacts-toggle"></i></a></li>\n <li><a href="#" class="chat-im-aggregator" title="',s={hash:{},data:o},r+=c((a=n.translate||t.translate,a?a.call(t,"chat|im_chat",s):l.call(t,"translate","chat|im_chat",s)))+'"><i class="ico ico-32 ico-im-aggregator"></i></a></li>\n </ul>\n </div>\n <div class="clear"></div>\n <div id="friends-list" class="grid"></div>\n </div>\n </div>\n </div>\n <div class="tab-pane active" id="messages-panel">\n <div id="my-chats" class="chat-content individual">\n <div class="chat-list">\n <ul id="my-chats-list"></ul>\n </div>\n </div>\n </div>\n</div>\n'})}),function(e){e.fn.mask=function(t,n){e(this).each(function(){if(void 0!==n&&n>0){var i=e(this);i.data("_mask_timeout",setTimeout(function(){e.maskElement(i,t)},n))}else e.maskElement(e(this),t)})},e.fn.unmask=function(){e(this).each(function(){e.unmaskElement(e(this))})},e.fn.isMasked=function(){return this.hasClass("masked")},e.maskElement=function(t,n){void 0!==t.data("_mask_timeout")&&(clearTimeout(t.data("_mask_timeout")),t.removeData("_mask_timeout")),t.isMasked()&&e.unmaskElement(t),"static"==t.css("position")&&t.addClass("masked-relative"),t.addClass("masked");var i=e('<div class="loadmask"></div>');if(navigator.userAgent.toLowerCase().indexOf("msie")>-1&&(i.height(t.height()+parseInt(t.css("padding-top"))+parseInt(t.css("padding-bottom"))),i.width(t.width()+parseInt(t.css("padding-left"))+parseInt(t.css("padding-right")))),navigator.userAgent.toLowerCase().indexOf("msie 6")>-1&&t.find("select").addClass("masked-hidden"),t.append(i),void 0!==n){var o=e('<div class="loadmask-msg" style="display:none;"></div>');o.append("<div>"+n+"</div>"),t.append(o),o.css("top",Math.round(t.height()/2-(o.height()-parseInt(o.css("padding-top"))-parseInt(o.css("padding-bottom")))/2)+"px"),o.css("left",Math.round(t.width()/2-(o.width()-parseInt(o.css("padding-left"))-parseInt(o.css("padding-right")))/2)+"px"),o.show()}},e.unmaskElement=function(e){void 0!==e.data("_mask_timeout")&&(clearTimeout(e.data("_mask_timeout")),e.removeData("_mask_timeout")),e.find(".loadmask-msg,.loadmask").remove(),e.removeClass("masked"),e.removeClass("masked-relative"),e.find("select").removeClass("masked-hidden")}}(jQuery),define("jquery.loadmask",["jquery"],function(){}),define("modules/chat/views/chat_view",["modules/chat/models/session","modules/chat/views/contact_list","modules/chat/views/chat_list","modules/chat/views/chat_summary","modules/chat/config/config","modules/common/config","modules/common/utility","handlebars","hbs!modules/template/chat/chat-panel","underscore","backbone","backbone.marionette","jquery.loadmask","slick.dataview","jquery"],function(e,t,n,i,o,a,s,r,l,c,u){var h={_common_decoration:52,chat:{decoration:99,setup:[{selector:"#friends-list",ratio:1,min:100}]},message:{decoration:59,setup:[{selector:"#my-chats-list",ratio:1,min:100}]}},d='<div id="{{modal_window_id}}" data-backdrop="static" data-keyboard="false" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="{{window_label}}" aria-hidden="true"><div class="modal-header"><h3 id="myModalLabel">{{window_header}}</h3></div><div class="modal-body"><p>{{{message}}}</p></div><div class="modal-footer"><button class="btn modal_close_btn" data-dismiss="modal" aria-hidden="true">{{close_label}}</button></div></div>',p=r.compile(d),f=u.Marionette.Layout.extend({template:{type:"handlebars",template:l},regions:{offline_chats:"#offline-chats"},initialize:function(){c.bindAll(this),console.log("chat panel initializing"),this.model=new u.Model({}),this.showing_force_logout_dialog=!1,e.on("session_created",function(){this.listenToChatListEvents()},this),e.on("session_startup_completed",function(){$("#chat-bar").unmask()},this),e.on("logout_forced",function(e){this.showForcedLogoutMessage(e)},this),this.render()},showForcedLogoutMessage:function(e){if(!this.showing_force_logout_dialog){this.showing_force_logout_dialog=!0;var t=p({message:e,modal_window_id:"m_"+Date.now(),window_label:s.translate("chat|notification"),window_header:s.translate("chat|system_message"),close_label:s.translate("common|ok")}),n=$(t),i=n.find(".modal_close_btn");i.click(function(e){e.preventDefault(),window.location=o.logout_url}),n.appendTo($("body")),n.modal("show")}},onRender:function(){console.log("chat_view.afterRender");var o=this;this.$(".tearaway-chat-bar").on("click",function(e){e.preventDefault(),o.trigger("tear_away_click")}),this.$(".dock-chat-bar").on("click",function(e){e.preventDefault(),o.trigger("dock_click")}),this.$("#chat-sidebar-tabs a").on("click",function(e){e.preventDefault(),e.stopPropagation();var t=$(this).attr("href");o.toggleTabs(t),$(window).trigger("resize"),o.isPanelMinimized()&&o.trigger("contact_tab_open",o)}),this.chatList=new n(this.$("#my-chats-list")),this.contactList=new t(this.$(".contact-list")),this.chatSummary=new i(this.$(".chat-summary")),e.session_initialization_complete||this.$el.mask(s.translate("common|loading"),10),this.is_rendered=!0,this.trigger("after_render")},isPanelMinimized:function(){return this.$(".nav-tabs li.contacts").hasClass("minimized-display")},toggleTabs:function(e){var t=this.$(e);t.is(":visible")||(this.$(".nav-tabs li").removeClass("active"),this.$(".tab-pane").not(t).removeClass("active"),t.addClass("active"),this.$(e+"-tab").addClass("active"),this.trigger("show_tab"))},minimize:function(){this.$("#chat-sidebar-tabs li").removeClass("active"),this.$(".tab-content .tab-pane").removeClass("active")},get$Element:function(){return this.$el},resize:function(e,t){e-=h._common_decoration,this.resizeChat(e,t),this.chatList.resize(e,t)},resizeChat:function(e,t){this._calculateTabContentHeight(e,t,"chat"),this.contactList&&this.contactList.getGrid().resizeCanvas()},listenToChatListEvents:function(){this.chatList.on("chat_list_click",function(e){this.trigger("chat_list_click",e)},this),this.chatList.on("chat_close_request",function(e){this.trigger("chat_close_request",e)},this),this.chatList.on("unread_message_count_changed",function(e){var t=$(".messages-unread-count",this.$el);t.text(e),e?(t.show(),t.css("visibility","visible")):t.hide()},this)},removeChatItem:function(e){this.chatList.removeChatItem(e)},addChatItem:function(e){this.chatList.addChatItem(e)},highlightChatItem:function(e){this.chatList.hilightChatItem(e)},_calculateTabContentHeight:function(e,t,n){for(var i,o,a=h[n],s=e-a.decoration,r=0;a.setup.length>r;r++){var l=a.setup[r];o=this.$(l.selector),i=Math.floor(s*l.ratio),i=Math.max(l.min,i),o.height(i)}},showMessagesTab:function(){this.$(".nav-tabs li.messages a").tab("show"),this.$(".tab-pane").removeClass("active").filter("#messages-panel").addClass("active")},toggleChatManagerDisplay:function(e){var t=this.$(".nav-tabs li.messages a").attr("href");"minimized"==e?(this.minimizeChatManager(),this.$(".nav-tabs li.messages.active").length||this.toggleTabs(t)):(this.maximizeChatManager(),this.toggleTabs(t))},minimizeChatManager:function(){this.$(".nav-tabs li.messages").hide(50),this.$(".nav-tabs li.contacts").addClass("minimized-display")},maximizeChatManager:function(){this.$(".nav-tabs li.messages").show(50),this.$(".nav-tabs li.contacts").removeClass("minimized-display")}});return f}),define("modules/chat/views/chat_sidebar",["modules/chat/views/chat_view","underscore","backbone","jquery"],function(e,t,n){var i=10,o=function(e,n){this.$el=e,this.chat_view=n,this.attachToggleButton(),this.debounced_resize=t.debounce(t.bind(this.resize,this),100),this.chat_view.is_rendered&&this.attach_chat_view(),this.chat_view.on("after_render",function(){this.attach_chat_view()},this),this.chat_view.on("contact_tab_open",function(){var e=this.chat_view,t=this.$el;t.animate({marginRight:0===parseInt(t.css("marginRight"),10)?-(t.outerWidth()-47):0},50,function(){e.maximizeChatManager()})},this)},a=o.prototype;return t.extend(a,n.Events),a.attach_chat_view=function(){this.dockChatView(),this.initialized=!0,$(window).on("resize",this.debounced_resize),this.resize();var e=this;t.defer(function(){e.trigger("chat_sidebar_ready")})},a.getHeight=function(){return $(window).height()-i},a.resize=function(){this.chat_view.resize(this.getHeight())},a.show=function(){this.$el.show()},a.hide=function(){this.$el.hide()},a.minimize=function(){},a.destroy=function(){this.$el.remove()},a.dockChatView=function(){this.$el.append(this.chat_view.$el)},a.setZIndex=function(e){this.$el.css({zIndex:e})},a.bringToTop=function(){var e=require("modules/mig33_window_manager");this.setZIndex(e.getNextZIndex())},a.attachToggleButton=function(){var e=$("<a href='#' class='toggle-sidebar-button'></a>");this.$el.append(e);var t=this;e.on("click",function(e){e.stopPropagation(),e.preventDefault(),t.animateSideBar()})},a.animateSideBar=function(){var e=this.chat_view,t=this.$el;t.animate({marginRight:0===parseInt(t.css("marginRight"),10)?-(t.outerWidth()-47):0},50,function(){var n=parseInt(t.css("marginRight"),10);0>n?e.toggleChatManagerDisplay("minimized"):e.toggleChatManagerDisplay("expand")})},o}),define("hbs!modules/template/common/mig33_window",["handlebars"],function(e){return e.template(function(e,t,n,i,o){this.compilerInfo=[4,">= 1.0.0"],n=this.merge(n,e.helpers),o=o||{};var a,s,r="",l="function",c=this.escapeExpression,u=n.helperMissing;return r+='<div id="',(a=n.chat_id)?a=a.call(t,{hash:{},data:o}):(a=t.chat_id,a=typeof a===l?a.apply(t):a),r+=c(a)+'" class="mig-window">\n <div class="mig-window-header clearfix">\n <div class="mig-window-icon"></div>\n <div class="mig-window-title"><a href="#">',(a=n.chat_title)?a=a.call(t,{hash:{},data:o}):(a=t.chat_title,a=typeof a===l?a.apply(t):a),(a||0===a)&&(r+=a),r+='</a></div>\n <div class="mig-window-actions">\n <div class="mig-window-option pull-right" title="',s={hash:{},data:o},r+=c((a=n.translate||t.translate,a?a.call(t,"chat|close_window",s):u.call(t,"translate","chat|close_window",s)))+'">\n <a href="#" class="close-chat-window"><i class="ico ico-24 ico-window-close"></i></a>\n </div>\n </div>\n </div>\n <div class="mig-window-content"></div>\n</div>'})}),define("modules/view/common/mig33_window",["modules/common/utility","hbs!modules/template/common/mig33_window","handlebars","underscore.string","underscore","backbone","jquery"],function(e,t,n,i,o,a){var s=40,r=function(e,n){n=n?$(n):$("body"),this._isActive=!1,this._windowHandle="w_"+Date.now();var i=t({window_id:this._windowHandle,title:"New Window"}),o=this.$window_el=$(i);n.append(o),o.show();var a=this;o.on("click",function(){a.trigger("window_focused",a)}),o.find(".close-chat-window").on("click",function(e){e.stopPropagation(),e.preventDefault(),a.trigger("window_close_request",a)});var s,l=r.DEFAULT_HEIGHT,c=r.DEFAULT_WIDTH,u=r.DEFAULT_X,h=r.DEFAULT_Y;e&&(l=e.height||l,c=e.width||c,u=e.x||u,h=e.y||h,s=e.content),this.original_height=l,this.original_width=c,this.setContent(s),this.resize(l,c),this.setPosition(u,h),this.toggleDraggable(),this.toggleResizable()};return r.DEFAULT_WIDTH=500,r.DEFAULT_HEIGHT=350,r.DEFAULT_X=90,r.DEFAULT_Y=90,o.extend(r,a.Events),o.extend(r.prototype,a.Events),o.extend(r.prototype,{switchContainer:function(e){e.append(this.$window_el)},getWindowHandle:function(){return this._windowHandle},get$Element:function(){return this.$window_el},destroyWindow:function(){this.$window_el.remove(),this.off()},setZIndex:function(e){this.$window_el.css({zIndex:e})},bringToTop:function(){var e=require("modules/mig33_window_manager");this.setZIndex(e.getNextZIndex())},setContent:function(t){var n;if(t=t||$("<div></div>"),t instanceof jQuery)n=t;else if(t)if(e.isElement(t))n=$(t);else{if(!(t.$el&&t.$el instanceof jQuery))throw"Unable to find a valid dom node in passed in parameters";n=t.$el}this.original_content=t,this.set$Content(n)},getContent:function(){return this.original_content},get$Content:function(){return this.$content},set$Content:function(e){$(".mig-window-content",this.$window_el).html(e),this.$content=e},isActive:function(){return this._isActive},activate:function(){this._isActive=!0,this.$window_el.addClass("active"),this.bringToTop()},deactivate:function(){this._isActive=!1,this.$window_el.removeClass("active")},setPosition:function(e,t){this.$window_el.css({left:e+"px",top:t+"px"})},close:function(e){e&&this.$window_el.effect("transfer",{to:e,className:"ui-effects-transfer"},"fast"),this.$window_el.hide(),this.trigger("window_closed",this)},hide:function(){this.$window_el.hide(),this.trigger("window_hidden",this)},show:function(){this.$window_el.show(),this.trigger("window_shown",this)},getWindowWidth:function(){return this.$window_el.width()},getWindowHeight:function(){return this.$window_el.height()},toggleResizable:function(e){var t=this;o.isUndefined(e)&&(e=!this.isResizable),e?this.$window_el.resizable({containment:"parent",minWidth:400,minHeight:200,resize:function(e,n){t._height=n.size.height,t._width=n.size.width,t.resize_content(t._height,t._width)},start:function(){t.bringToTop()}}):this.$window_el.resizable("destroy"),this.isResizable=e},toggleDraggable:function(e){var t=this;o.isUndefined(e)&&(e=!this.isDraggable),e?this.$window_el.draggable({cancel:"a",containment:"parent",handle:"table.mig-window-header",start:function(){t.bringToTop()}}):this.$window_el.draggable("destroy"),this.isDraggable=e},resize:function(e,t){this._height=e||this._height,this._width=t||this._width,this.$window_el.height(this._height),this.$window_el.width(this._width),this.resize_content(this._height,this._width)},resize_content:function(e,t){var n=$(".mig-window-content",this.$window_el);e-=s,n.height(e),n.width(t),this.original_content instanceof jQuery||!this.original_content.resize?(this.$content.height(e),this.$content.width(t-10)):this.original_content.resize(e,t)},resetSize:function(){this.resize(this.original_height,this.original_width)}}),r}),define("modules/mig33_window_manager",["modules/chat/models/session","modules/chat/models/chat_room","modules/chat/models/chat","modules/chat/views/chat_window","modules/chat/views/chat_view","modules/chat/views/chat_sidebar","modules/view/common/mig33_window","modules/common/utility","underscore","backbone","jquery"],function(e,t,n,i,o,a,s,r,l,c){var u=n.ChatStore,h=t.ChatRoomCategoryStore,d=.7,p=55,f=200,m=1e3,g=function(){this.window_mode=this.MODE_DOCK,this.chat_window_cache=[],this.active_window_cache=new c.Collection,this.active_window_cache.comparator=function(e,t){var n=e.get("lastOpenTime"),i=t.get("lastOpenTime");return n-i}},_=g.prototype;return _.MODE_DOCK={},_.MODE_TEARAWAY={},l.extend(_,c.Events),l.extend(_,{init:function(){console.log("window_manager.init"),this.initWindowsWorkSpace(),this.initChatView(),this.initChatSideBar(),this.main_content=$("#main"),this.attachAppEvents(),this.attachWindowEvents(),this.attachModelEvents(),console.log("window_manager.after.event listening")},initWindowsWorkSpace:function(){var e=$("#main-header").height();this.workSpace=$("<div class='windows-workspace' />"),this.workSpace.css({zIndex:f,width:$(window).width(),height:$(window).height()-e,position:"fixed",top:e,left:0,overflow:"hidden"}),$("body").append(this.workSpace),this.workSpace.hide()},initChatView:function(){this.chat_view=new o({el:'<div id="chat-bar"></div>'}),this.chat_view.on("chat_list_click",l.bind(this.focusChatWindow,this)),this.chat_view.on("chat_close_request",l.bind(this.closeChat,this)),this.chat_view.on("minimize_request",l.bind(this.minimizeChat,this))},initChatSideBar:function(){var e=$("#chat-container"),t=this;this.chat_sidebar=new a(e,this.chat_view),this.chat_sidebar.on("chat_sidebar_ready",function(){this.trigger("window_manager_ready")},this),e.click(function(){t.bringChatSideBarToTop()})},bringChatSideBarToTop:function(){this.chat_sidebar.bringToTop()},attachAppEvents:function(){var e=require("modules/mig33_app");e.vent.on(e.ApplicationEvents.TOGGLE_TEARAWAY,l.bind(this.checkAndActivateTearAway,this))},attachWindowEvents:function(){$(window).resize(l.bind(function(){this.resizeWorkspace(),this.position_windows(),this.positionMainWindowButton()},this))},attachModelEvents:function(){u.on("user_initiated_chat",this.handleUserInitiatedChat,this),u.on("chat_added",this.handleChatAdded,this),h.on("chatroom_joined",this.handleChatRoomJoined,this)},attachChatModelEvents:function(e){e.on("chat_message_added",function(){},this),e.on("chat_activate",function(){this.createOrGetChatWindow(e),this.focusChatWindow(e)},this)},attachChatRoomEvents:function(e){e.on("chat_activate",function(){this.createOrGetChatWindow(e)},this),e.on("chat_message_added",function(){this.createOrGetChatWindow(e)},this)},attachChatWindowEvents:function(e){e.on("chat_window_accessed",function(e){this.setActiveWindow(e)},this),e.on("chat_window_closed",function(e){var t=e.getChatModel(),n=t.get("chatHandle"),i=this.active_window_cache.get(n);i.set("isShown",!1),i.set("isOpen",!1),this.position_windows()},this),e.on("chat_close_request",l.bind(this.closeChat,this))},checkAndActivateTearAway:function(e){e=l.isUndefined(e)?!this.isTearAwayMode():e,e?this.activateTearAwayMode():this.closeTearAwayMode()},getWindowMode:function(){return this.window_mode},isTearAwayMode:function(){return this.window_mode===this.MODE_TEARAWAY},createOrGetChatWindow:function(e){var t=e.get("chatHandle"),n=this.chat_window_cache[t];return n||(n=this.createChatWindow(e)),n},handleUserInitiatedChat:function(e){var t=this.createOrGetChatWindow(e);this.setWindowOpenState(t,!0),this.setActiveWindow(t)},handleChatAdded:function(e){this.createOrGetChatWindow(e),this.attachChatModelEvents(e)},handleChatRoomJoined:function(e){var t=this.createOrGetChatWindow(e);this.setWindowOpenState(t,!0),this.setActiveWindow(t),this.attachChatRoomEvents(e)},createChatWindow:function(e){console.log("A new chat was added - creating dom for it"),this.chat_view.addChatItem(e),this.chat_view.showMessagesTab(),$(window).trigger("resize");var t=new i(e);return this.attachChatWindowEvents(t),this.chat_window_cache[e.get("chatHandle")]=t,this.attachAndPositionChatWindow(t),t},attachAndPositionChatWindow:function(e){var t=e.getChatModel(),n=t.get("chatHandle"),i={posy:0,posx:0,lastOpenTime:Date.now(),isOpen:!1,isShown:!1},o=this.active_window_cache.get(n);o?o.set(i):(i.id=n,i.isTearAway=this.isTearAwayMode(),o=e.metadata_model=new c.Model(i),this.active_window_cache.add(o)),e.get$Element().hide().appendTo("body"),this.isTearAwayMode()&&(e.switchContainer(this.workSpace),e.toggleDraggable(!0),e.toggleResizable(!0)),this._position_windows()},removeChatWindow:function(e){var t=e.get("chatHandle"),n=this.chat_window_cache[t];n&&n.destroyWindow();var i=this.active_window_cache.get(t);this.active_window_cache.remove(i),delete this.chat_window_cache[t]},activateTearAwayMode:function(){this.window_mode=this.MODE_TEARAWAY,this.trigger("before_enter_tearaway_mode"),this.showWorkSpace(),this.tearAwayMainWindow(),this.tearAwayChatWindows(),this.tearAwayChatSideBar(),this.createAndShowMainWindowButton(),this.trigger("enter_tearaway_mode"),this.trigger("state_change")},createAndShowMainWindowButton:function(){var e=this;this.$main_window_button||(this.$main_window_button=$("<div class='mig-window-button'>"+r.translate("chat|main_window_default_title")+"</div>"),$("body").append(this.$main_window_button),this.$main_window_button.css({zIndex:3e3,position:"fixed"}),this.$main_window_button.on("click",function(){e.focusWindow()})),this.$main_window_button.show(),this.positionMainWindowButton()},hideMainWindowButton:function(){this.$main_window_button&&this.$main_window_button.hide()},positionMainWindowButton:function(){if(this.$main_window_button){var e=$(window).height();this.$main_window_button.css({left:"10px",top:e-this.$main_window_button.height()})}},tearAwayChatSideBar:function(){var e=$("#chat-container");this.workSpace.append(e)},tearAwayChatWindows:function(){var e=this;this.active_window_cache.each(function(t){var n=t.get("id"),i=e.chat_window_cache[n];i.switchContainer(e.workSpace),i.toggleDraggable(!0),i.toggleResizable(!0)}),this.position_windows()},tearAwayMainWindow:function(){this.main_content_window?this.main_content_window.show():(this.main_content_window=new s({content:this.main_content,x:2,y:p,height:this.workSpace.height()-p,width:this.workSpace.width()*d},this.workSpace),this.main_content_window.on("window_focused",function(){this.focusMainWindow()},this),this.main_content_window.on("window_close_request",function(){this.main_content_window.close(this.$main_window_button)},this))},focusWindow:function(e){e?this.focusChatWindow(e):this.focusMainWindow()},focusChatWindow:function(e){e.get("chatHandle");var t=this.createOrGetChatWindow(e);this.setActiveWindow(t),this.setWindowOpenState(t,!0)},focusMainWindow:function(){this.main_content_window&&(this.main_content_window.show(),this.setActiveWindow(this.main_content_window))},resizeMainWindow:function(){},closeTearAwayMode:function(){console.log("updating wmode to DOCK"),this.window_mode=this.MODE_DOCK,this.dockMainWindow(),this.dockChatWindows(),this.dockChatSideBar(),this.hideWorkSpace(),this.hideMainWindowButton(),this.trigger("enter_dock_mode"),this.trigger("state_change")},showWorkSpace:function(){this.workSpace.show()},hideWorkSpace:function(){this.workSpace.hide()},dockMainWindow:function(){$("#main-container").append(this.main_content),this.main_content.attr("style",""),this.main_content_window.destroyWindow(),delete this.main_content_window},dockChatWindows:function(){var e=this;this.active_window_cache.each(function(t){var n=t.get("id"),i=e.chat_window_cache[n];i.resetSize(),i.toggleDraggable(!1),i.toggleResizable(!1),i.switchContainer($("body"))}),this._position_windows()},dockChatSideBar:function(){var e=$("#chat-container");$("#main-container").append(e)},setWindowOpenState:function(e,t){var n,i=e.getChatHandle(),o=this.active_window_cache.get(i);console.log(o.toJSON()),n=o.get("isShown")?o.get("lastOpenTime"):Date.now();var a={isOpen:t,lastOpenTime:n};t&&(a.isShown=!0),o.set(a),this.active_window_cache.sort(),this._position_windows()},resizeWorkspace:function(){this.workSpace.css({width:$(window).width(),height:$(window).height()})},position_windows:function(){this._position_windows()},_position_windows:function(){var e,t,n,i,o,a=null,s=null,r=null,l=null;e=20,t=i=$(window).width()-$("#chat-bar").width(),n=$(window).height();var c=this;this.active_window_cache.each(function(u){var h,d,p=!1;if(h=u.get("id"),d=c.chat_window_cache[h],!u.get("isOpen"))return u.set({posx:0,isShown:!1}),void 0;if(s=d,r=u,c.isTearAwayMode()){if(u.get("isShown")){var f,m,g,_=d.getPosition(),v=_.x+d.getWindowWidth(),y=_.y+d.getWindowHeight();v>t&&(f=t-d.getWindowWidth(),g=!0),y>n&&(m=t-d.getWindowHeight(),g=!0),d.show()}}else d.resetSize(),i=i-d.getWindowWidth()-e,o=10,i>0?(console.log([i,o]),d.setPosition(i,o,!0),d.show(),d.isActive()&&d.activate(),p=!0,a=d,l=u):d.hide(),u.set({posx:i,posy:o,isShown:p})}),this.isTearAwayMode()||s==a||(a&&l&&(a.hide(),l.set({isShown:!1}),i=l.get("posx"),o=l.get("posy")),s.setPosition(i,o,!0),s.show(),r.set({posx:i,posy:o,isShown:!0}))},getNextZIndex:function(){return++m},setActiveWindow:function(e){if(this.active_window)try{this.active_window.deactivate()}catch(t){}this.active_window=e,e.activate()},closeChat:function(e){e.leave_chatroom(),this.removeChatWindow(e),this.chat_view.removeChatItem(e)},minimizeChat:function(){}}),new g}),define("modules/chat/chat_loader",["backbone","modules/chat/config/config","modules/chat/data/transport","modules/chat/models/session","modules/mig33_window_manager","underscore","jquery"],function(e,t,n,i,o){var a={};return a.initializeChatClient=function(){settings.is_chat_supported&&$(function(){console.log("chat_loader.init"),o.on("window_manager_ready",function(){i.init()}),n.initialize(),o.init()})},a}),define("hbs!modules/template/common/header-layout",["handlebars"],function(e){return e.template(function(e,t,n,i,o){function a(e,t){var i,o,a="";return a+='\n <div class="container">\n <a class="brand" href="/home" title="',o={hash:{},data:t},a+=c((i=n.translate||e.translate,i?i.call(e,"header|home",o):l.call(e,"translate","header|home",o)))+'"><img src="',o={hash:{},data:t},a+=c((i=n.getUrl||e.getUrl,i?i.call(e,"cdn",o):l.call(e,"getUrl","cdn",o))),o={hash:{},data:t},a+=c((i=n.getUrl||e.getUrl,i?i.call(e,"jsclient",o):l.call(e,"getUrl","jsclient",o)))+'/app/images/w_ic_mig33logo.png"/></a>\n <ul class="nav">\n <li class="dropdown">\n <a href="#" class="dropdown-toggle" data-toggle="dropdown" title="',o={hash:{},data:t},a+=c((i=n.translate||e.translate,i?i.call(e,"discover|discover",o):l.call(e,"translate","discover|discover",o)))+'">',o={hash:{},data:t},a+=c((i=n.translate||e.translate,i?i.call(e,"discover|discover",o):l.call(e,"translate","discover|discover",o)))+' <b class="caret"></b></a>\n <ul class="dropdown-menu">\n <li><a href="/discover">',o={hash:{},data:t},a+=c((i=n.translate||e.translate,i?i.call(e,"discover|recommendations",o):l.call(e,"translate","discover|recommendations",o)))+'</a></li>\n <li><a href="/group">',o={hash:{},data:t},a+=c((i=n.translate||e.translate,i?i.call(e,"group|groups",o):l.call(e,"translate","group|groups",o)))+'</a></li>\n <li><a href="/tag/migup">',o={hash:{},data:t},a+=c((i=n.translate||e.translate,i?i.call(e,"header|migups",o):l.call(e,"translate","header|migups",o)))+'</a></li>\n <li><a href="/sites/ajax/migworld/get_wappage">',o={hash:{},data:t},a+=c((i=n.translate||e.translate,i?i.call(e,"header|whats_new",o):l.call(e,"translate","header|whats_new",o)))+'</a></li>\n </ul>\n </li>\n <li class="dropdown">\n <a href="#" class="dropdown-toggle" data-toggle="dropdown" title="',o={hash:{},data:t},a+=c((i=n.translate||e.translate,i?i.call(e,"game|play",o):l.call(e,"translate","game|play",o)))+'">',o={hash:{},data:t},a+=c((i=n.translate||e.translate,i?i.call(e,"game|play",o):l.call(e,"translate","game|play",o)))+' <b class="caret"></b></a>\n <ul class="dropdown-menu">\n <li><a href="/sites/ajax/avatar/home">',o={hash:{},data:t},a+=c((i=n.translate||e.translate,i?i.call(e,"user|avatar",o):l.call(e,"translate","user|avatar",o)))+'</a></li>\n <li><a href="/sites/ajax/bot/bot_list">',o={hash:{},data:t},a+=c((i=n.translate||e.translate,i?i.call(e,"game|miggames",o):l.call(e,"translate","game|miggames",o)))+'</a></li>\n <li><a href="/sites/ajax/leaderboard/home">',o={hash:{},data:t},a+=c((i=n.translate||e.translate,i?i.call(e,"leaderboard|leaderboards",o):l.call(e,"translate","leaderboard|leaderboards",o)))+'</a></li>\n <li><a href="/sites/ajax/store/home">',o={hash:{},data:t},a+=c((i=n.translate||e.translate,i?i.call(e,"store|migstore",o):l.call(e,"translate","store|migstore",o)))+'</a></li>\n </ul>\n </li>\n <li class="dropdown">\n <a href="#" class="dropdown-toggle" data-toggle="dropdown" title="',o={hash:{},data:t},a+=c((i=n.translate||e.translate,i?i.call(e,"user|friends",o):l.call(e,"translate","user|friends",o)))+'">',o={hash:{},data:t},a+=c((i=n.translate||e.translate,i?i.call(e,"user|friends",o):l.call(e,"translate","user|friends",o)))+' <b class="caret"></b></a>\n <ul class="dropdown-menu">\n <li><a href="/discover/emailrefer">',o={hash:{},data:t},a+=c((i=n.translate||e.translate,i?i.call(e,"discover|find_friends",o):l.call(e,"translate","discover|find_friends",o)))+'</a></li>\n <li><a href="',o={hash:{},data:t},a+=c((i=n.getSessionUser||e.getSessionUser,i?i.call(e,"personalized_url",o):l.call(e,"getSessionUser","personalized_url",o)))+'/following">',o={hash:{},data:t},a+=c((i=n.translate||e.translate,i?i.call(e,"user|following",o):l.call(e,"translate","user|following",o)))+'</a></li>\n <li><a href="',o={hash:{},data:t},a+=c((i=n.getSessionUser||e.getSessionUser,i?i.call(e,"personalized_url",o):l.call(e,"getSessionUser","personalized_url",o)))+'/followers">',o={hash:{},data:t},a+=c((i=n.translate||e.translate,i?i.call(e,"user|followers",o):l.call(e,"translate","user|followers",o)))+'</a></li>\n </ul>\n </li>\n </ul>\n <div class="visible-desktop">\n <ul class="nav pull-right">\n <li class="with-icon"><a class="tearaway-btn" href="#" title="',o={hash:{},data:t},a+=c((i=n.translate||e.translate,i?i.call(e,"header|float_view",o):l.call(e,"translate","header|float_view",o)))+'"><i class="ico ico-32 ico-dock-view"></i></a></li>\n </ul>\n <form class="search-form navbar-form pull-right" action="/search" method="get" onsubmit="return false;">\n <div class="input-append">\n <input class="span2" name="search-form-query" type="text" placeholder="',o={hash:{},data:t},a+=c((i=n.translate||e.translate,i?i.call(e,"header|search",o):l.call(e,"translate","header|search",o)))+'">\n <button class="search-form-submit btn" type="button"><i class="ico ico-24 ico-search"></i></button>\n </div>\n </form>\n <ul class="nav pull-right">\n <li class="with-icon"><a href="',o={hash:{},data:t},a+=c((i=n.getSessionUser||e.getSessionUser,i?i.call(e,"personalized_url",o):l.call(e,"getSessionUser","personalized_url",o)))+'" class="caret-before" title="',o={hash:{},data:t},a+=c((i=n.getSessionUser||e.getSessionUser,i?i.call(e,"username",o):l.call(e,"getSessionUser","username",o)))+'"><img src="',o={hash:{},data:t},a+=c((i=n.getSessionUserDisplayPictureUrl||e.getSessionUserDisplayPictureUrl,i?i.call(e,"32","32",o):l.call(e,"getSessionUserDisplayPictureUrl","32","32",o)))+'"/></a></li>\n <li class="dropdown with-icon">\n <a href="#" class="dropdown-toggle caret-after" data-toggle="dropdown">&nbsp;<b class="caret"></b></a>\n <ul class="dropdown-menu">\n <li><a href="/sites/ajax/settings/account_profile">',o={hash:{},data:t},a+=c((i=n.translate||e.translate,i?i.call(e,"common|settings",o):l.call(e,"translate","common|settings",o)))+'</a></li>\n <li><a href="/sites/corporate/merchant/dashboard" data-bypass="true" target="mig33-new-window">',o={hash:{},data:t},a+=c((i=n.translate||e.translate,i?i.call(e,"merchant|merchant_center",o):l.call(e,"translate","merchant|merchant_center",o)))+'</a></li>\n <li><a href="/sites/ajax/account/recharge_credit">',o={hash:{},data:t},a+=c((i=n.translate||e.translate,i?i.call(e,"store|credits",o):l.call(e,"translate","store|credits",o)))+'</a></li>\n <li><a href="http://help.mig33.com/" data-bypass="true" target="mig33-new-window">',o={hash:{},data:t},a+=c((i=n.translate||e.translate,i?i.call(e,"common|help",o):l.call(e,"translate","common|help",o)))+'</a></li>\n <li><a href="',o={hash:{},data:t},a+=c((i=n.getUrl||e.getUrl,i?i.call(e,"logout",o):l.call(e,"getUrl","logout",o)))+'" data-bypass="true">',o={hash:{},data:t},a+=c((i=n.translate||e.translate,i?i.call(e,"login|logout",o):l.call(e,"translate","login|logout",o)))+'</a></li>\n </ul>\n </li>\n <li class="dropdown with-icon">\n <a href="#" class="dropdown-toggle" data-toggle="dropdown" title="',o={hash:{},data:t},a+=c((i=n.translate||e.translate,i?i.call(e,"migalert|migalerts",o):l.call(e,"translate","migalert|migalerts",o)))+'">\n <i class="ico ico-32 ico-migalerts"></i>\n <span class="badge badge-mig33 migalerts-unread-count"></span>\n </a>\n <div id="migalerts" class="dropdown-menu"></div>\n </li>\n <li id="sharebox-dropdown" class="dropdown with-icon">\n <a href="#" class="dropdown-toggle" data-toggle="dropdown" title="',o={hash:{},data:t},a+=c((i=n.translate||e.translate,i?i.call(e,"homefeed|say_something",(i=e.session_user,null==i||i===!1?i:i.username),o):l.call(e,"translate","homefeed|say_something",(i=e.session_user,null==i||i===!1?i:i.username),o)))+'">\n <i class="ico ico-32 ico-sharebox"></i>\n </a>\n <div id="sharebox" class="dropdown-menu"></div>\n </li>\n <li class="with-icon"><a class="trigger-chat-btn" href="#" title="',o={hash:{},data:t},a+=c((i=n.translate||e.translate,i?i.call(e,"chat|chat",o):l.call(e,"translate","chat|chat",o)))+'"><i class="ico ico-32 ico-chat"></i></a></li>\n </ul>\n </div>\n </div>\n'
}this.compilerInfo=[4,">= 1.0.0"],n=this.merge(n,e.helpers),o=o||{};var s,r,l=n.helperMissing,c=this.escapeExpression,u=this,h="function",d=n.blockHelperMissing;return r={hash:{},inverse:u.noop,fn:u.program(1,a,o),data:o},(s=n.ifLoggedIn)?s=s.call(t,r):(s=t.ifLoggedIn,s=typeof s===h?s.apply(t):s),n.ifLoggedIn||(s=d.call(t,s,r)),s||0===s?s:""})}),define("modules/model/migalert/migalert_model",["underscore","backbone","modules/mig33_app","modules/common/config","modules/common/utility"],function(e,t,n,i,o){var a=t.Model.extend({approveRejectFollowingRequest:function(e){var t=this,n=$.ajax({type:"post",dataType:"json",url:i.urls.miniblog_api_url+"/pending_request/"+e+"/"+t.get("user").id});n.done(function(e){e=o.parse_ajax_response(e),e.error?o.show_error(o.translate(e.error,t.get("user").username)):o.show_success(o.translate(e.success,t.get("user").username))}),n.fail(function(e,t,n){o.show_error(n)})},acceptRejectGroupInvite:function(e){var t=this,n=$.ajax({type:"post",dataType:"json",url:i.urls.miniblog_api_url+"/group_invite/"+e+"/"+t.get("content").group_id});n.done(function(e){e=o.parse_ajax_response(e),e.error?o.show_error(o.translate(e.error,t.get("content").group_name,t.get("user").username)):o.show_success(o.translate(e.success,t.get("content").group_name,t.get("user").username))}),n.fail(function(e,t,n){o.show_error(n)})},acceptRejectGameInvite:function(e){var n=e,a=this,s=$.ajax({type:"post",dataType:"json",url:i.urls.miniblog_api_url+"/game_invite/"+e+"/"+a.get("content").game_id,data:{invitation_id:a.get("content").game_invitation_id,alert_id:a.get("id")}});s.done(function(e){e=o.parse_ajax_response(e),e.error?o.show_error(o.translate(e.error,a.get("content").game_name,a.get("user").username)):o.show_success(o.translate(e.success,a.get("content").game_name,a.get("user").username)),"accept"==n&&t.history.navigate("group/"+a.get("content").group_id,{trigger:!0})}),s.fail(function(e,t,n){o.show_error(n)})}});return a}),define("modules/model/migalert/migalert_collection",["modules/model/common/mig33_collection","modules/mig33_app","modules/common/config","modules/common/utility","modules/model/migalert/migalert_model","underscore"],function(e,t,n,i,o,a){var s=e.extend({model:o,type:"all",comparator:function(e){return-e.get("timestamp")},url:function(){return n.urls.alerts_url+"/"+this.type+"/"+this.currentPage},parse:function(e){return e.data&&!a.isUndefined(e.data.alerts)?e.data.alerts:e},setType:function(e){this.type=e}});return s}),define("hbs!modules/template/migalert/migalert-list",["handlebars"],function(e){return e.template(function(e,t,n,i,o){function a(e,t){var i,o,a,s="";return s+='\n <div class="alert-image">\n <img src="',a={hash:{},data:t},s+=P((i=n.getDisplayPictureUrl||e.getDisplayPictureUrl,i?i.call(e,(i=e.user,null==i||i===!1?i:i.username),(i=e.user,null==i||i===!1?i:i.display_picture_type),32,32,a):S.call(e,"getDisplayPictureUrl",(i=e.user,null==i||i===!1?i:i.username),(i=e.user,null==i||i===!1?i:i.display_picture_type),32,32,a)))+'" width="32" height="32" title="'+P((i=e.user,i=null==i||i===!1?i:i.username,typeof i===A?i.apply(e):i))+'" alt="'+P((i=e.user,i=null==i||i===!1?i:i.username,typeof i===A?i.apply(e):i))+'" />\n </div>\n <div class="alert-content">\n <div class="alert-title">\n <a href="'+P((i=e.user,i=null==i||i===!1?i:i.personalized_url,typeof i===A?i.apply(e):i))+'" title="'+P((i=e.user,i=null==i||i===!1?i:i.username,typeof i===A?i.apply(e):i))+'">'+P((i=e.user,i=null==i||i===!1?i:i.username,typeof i===A?i.apply(e):i))+"</a> ",a={hash:{},data:t},s+=P((i=n.translate||e.translate,i?i.call(e,"migalert|group_request_requested",a):S.call(e,"translate","migalert|group_request_requested",a)))+' <a href="'+P((i=e.content,i=null==i||i===!1?i:i.group_url,typeof i===A?i.apply(e):i))+'" title="'+P((i=e.content,i=null==i||i===!1?i:i.group_name,typeof i===A?i.apply(e):i))+'">'+P((i=e.content,i=null==i||i===!1?i:i.group_name,typeof i===A?i.apply(e):i))+'</a>\n </div>\n <div class="alert-actions">\n <a href="#" title="',a={hash:{},data:t},s+=P((i=n.translate||e.translate,i?i.call(e,"common|join",a):S.call(e,"translate","common|join",a)))+'" class="accept-group-invite btn-small btn-success">',a={hash:{},data:t},s+=P((i=n.translate||e.translate,i?i.call(e,"common|join",a):S.call(e,"translate","common|join",a)))+'</a>\n &nbsp;&nbsp;\n <a href="#" title="',a={hash:{},data:t},s+=P((i=n.translate||e.translate,i?i.call(e,"common|reject",a):S.call(e,"translate","common|reject",a)))+'" class="reject-group-invite btn-small btn-danger">',a={hash:{},data:t},s+=P((i=n.translate||e.translate,i?i.call(e,"common|reject",a):S.call(e,"translate","common|reject",a)))+'</a>\n </div>\n </div>\n <div class="alert-time">\n ',(o=n.timestamp_relative)?o=o.call(e,{hash:{},data:t}):(o=e.timestamp_relative,o=typeof o===A?o.apply(e):o),s+=P(o)+"\n </div>\n"}function s(e,t){var i,o,a,s="";return s+='\n <div class="alert-image">\n <img src="',a={hash:{},data:t},s+=P((i=n.getDisplayPictureUrl||e.getDisplayPictureUrl,i?i.call(e,(i=e.user,null==i||i===!1?i:i.username),(i=e.user,null==i||i===!1?i:i.display_picture_type),32,32,a):S.call(e,"getDisplayPictureUrl",(i=e.user,null==i||i===!1?i:i.username),(i=e.user,null==i||i===!1?i:i.display_picture_type),32,32,a)))+'" width="32" height="32" title="'+P((i=e.user,i=null==i||i===!1?i:i.username,typeof i===A?i.apply(e):i))+'" alt="'+P((i=e.user,i=null==i||i===!1?i:i.username,typeof i===A?i.apply(e):i))+'" />\n </div>\n <div class="alert-content">\n <div class="alert-title">\n <a href="'+P((i=e.user,i=null==i||i===!1?i:i.personalized_url,typeof i===A?i.apply(e):i))+'" title="'+P((i=e.user,i=null==i||i===!1?i:i.username,typeof i===A?i.apply(e):i))+'">'+P((i=e.user,i=null==i||i===!1?i:i.username,typeof i===A?i.apply(e):i))+"</a> ",a={hash:{},data:t},s+=P((i=n.translate||e.translate,i?i.call(e,"migalert|virtualgift_received",a):S.call(e,"translate","migalert|virtualgift_received",a)))+' <a href="'+P((i=e.url,i=null==i||i===!1?i:i.ajax,typeof i===A?i.apply(e):i))+"#show=virtualgift_received&args="+P((i=e.user,i=null==i||i===!1?i:i.username,typeof i===A?i.apply(e):i))+"::"+P((i=e.content,i=null==i||i===!1?i:i.gift_received_id,typeof i===A?i.apply(e):i))+'" title="'+P((i=e.content,i=null==i||i===!1?i:i.gift_name,typeof i===A?i.apply(e):i))+'">'+P((i=e.content,i=null==i||i===!1?i:i.gift_name,typeof i===A?i.apply(e):i))+'</a> <img src="'+P((i=e.content,i=null==i||i===!1?i:i.gift_image_png_16,typeof i===A?i.apply(e):i))+'" title="'+P((i=e.content,i=null==i||i===!1?i:i.gift_name,typeof i===A?i.apply(e):i))+'" alt="'+P((i=e.content,i=null==i||i===!1?i:i.gift_name,typeof i===A?i.apply(e):i))+'" />\n </div>\n </div>\n <div class="alert-time">\n ',(o=n.timestamp_relative)?o=o.call(e,{hash:{},data:t}):(o=e.timestamp_relative,o=typeof o===A?o.apply(e):o),s+=P(o)+"\n </div>\n"}function r(e,t){var i,o,a,s="";return s+='\n <div class="alert-image">\n <img src="',a={hash:{},data:t},s+=P((i=n.getDisplayPictureUrl||e.getDisplayPictureUrl,i?i.call(e,(i=e.user,null==i||i===!1?i:i.username),(i=e.user,null==i||i===!1?i:i.display_picture_type),32,32,a):S.call(e,"getDisplayPictureUrl",(i=e.user,null==i||i===!1?i:i.username),(i=e.user,null==i||i===!1?i:i.display_picture_type),32,32,a)))+'" width="32" height="32" title="'+P((i=e.user,i=null==i||i===!1?i:i.username,typeof i===A?i.apply(e):i))+'" alt="'+P((i=e.user,i=null==i||i===!1?i:i.username,typeof i===A?i.apply(e):i))+'" />\n </div>\n <div class="alert-content">\n <div class="alert-title">\n <a href="'+P((i=e.user,i=null==i||i===!1?i:i.personalized_url,typeof i===A?i.apply(e):i))+'" title="'+P((i=e.user,i=null==i||i===!1?i:i.username,typeof i===A?i.apply(e):i))+'">'+P((i=e.user,i=null==i||i===!1?i:i.username,typeof i===A?i.apply(e):i))+"</a> ",a={hash:{},data:t},s+=P((i=n.translate||e.translate,i?i.call(e,"migalert|game_invite_requested",a):S.call(e,"translate","migalert|game_invite_requested",a)))+' <a href="'+P((i=e.content,i=null==i||i===!1?i:i.return_url,typeof i===A?i.apply(e):i))+'" title="'+P((i=e.content,i=null==i||i===!1?i:i.return_url,typeof i===A?i.apply(e):i))+'">'+P((i=e.content,i=null==i||i===!1?i:i.game_name,typeof i===A?i.apply(e):i))+'</a>\n </div>\n <div class="alert-actions">\n <a href="#" title="',a={hash:{},data:t},s+=P((i=n.translate||e.translate,i?i.call(e,"common|accept",a):S.call(e,"translate","common|accept",a)))+'" class="accept-game-invite btn-small btn-success">',a={hash:{},data:t},s+=P((i=n.translate||e.translate,i?i.call(e,"common|accept",a):S.call(e,"translate","common|accept",a)))+'</a>\n &nbsp;&nbsp;\n <a href="#" title="',a={hash:{},data:t},s+=P((i=n.translate||e.translate,i?i.call(e,"common|reject",a):S.call(e,"translate","common|reject",a)))+'" class="reject-game-invite btn-small btn-danger">',a={hash:{},data:t},s+=P((i=n.translate||e.translate,i?i.call(e,"common|reject",a):S.call(e,"translate","common|reject",a)))+'</a>\n </div>\n </div>\n <div class="alert-time">\n ',(o=n.timestamp_relative)?o=o.call(e,{hash:{},data:t}):(o=e.timestamp_relative,o=typeof o===A?o.apply(e):o),s+=P(o)+"\n </div>\n"}function l(e,t){var i,o,a,s="";return s+='\n <div class="alert-image">\n <img src="',a={hash:{},data:t},s+=P((i=n.getUrl||e.getUrl,i?i.call(e,"cdn",a):S.call(e,"getUrl","cdn",a)))+'/resources/img/icons/32x32/mig33.png" width="32" height="32" />\n </div>\n <div class="alert-content">\n <div class="alert-title">\n ',a={hash:{},data:t},i=n.translate||e.translate,o=i?i.call(e,"migalert|new_badge_alert_unlock",(i=e.content,null==i||i===!1?i:i.name),a):S.call(e,"translate","migalert|new_badge_alert_unlock",(i=e.content,null==i||i===!1?i:i.name),a),(o||0===o)&&(s+=o),s+='\n Go to <a href="',a={hash:{},data:t},s+=P((i=n.getSessionUser||e.getSessionUser,i?i.call(e,"personalized_url",a):S.call(e,"getSessionUser","personalized_url",a)))+'/badges" title="your badges page">your badges page</a> to view more.\n </div>\n <div class="alert_body">\n <img src="',a={hash:{},data:t},s+=P((i=n.getBadgeImageUrl||e.getBadgeImageUrl,i?i.call(e,(i=e.content,null==i||i===!1?i:i.image_name),24,a):S.call(e,"getBadgeImageUrl",(i=e.content,null==i||i===!1?i:i.image_name),24,a)))+'" width="24" height="24" />\n </div>\n </div>\n <div class="alert-time">\n ',(o=n.timestamp_relative)?o=o.call(e,{hash:{},data:t}):(o=e.timestamp_relative,o=typeof o===A?o.apply(e):o),s+=P(o)+"\n </div>\n"}function c(e,t){var i,o,a,s="";return s+='\n <div class="alert-image">\n <img src="',a={hash:{},data:t},s+=P((i=n.getDisplayPictureUrl||e.getDisplayPictureUrl,i?i.call(e,(i=e.user,null==i||i===!1?i:i.username),(i=e.user,null==i||i===!1?i:i.display_picture_type),32,32,a):S.call(e,"getDisplayPictureUrl",(i=e.user,null==i||i===!1?i:i.username),(i=e.user,null==i||i===!1?i:i.display_picture_type),32,32,a)))+'" width="32" height="32" title="'+P((i=e.user,i=null==i||i===!1?i:i.username,typeof i===A?i.apply(e):i))+'" alt="'+P((i=e.user,i=null==i||i===!1?i:i.username,typeof i===A?i.apply(e):i))+'" />\n </div>\n <div class="alert-content">\n <div class="alert-title">\n <a href="'+P((i=e.user,i=null==i||i===!1?i:i.personalized_url,typeof i===A?i.apply(e):i))+'" title="'+P((i=e.user,i=null==i||i===!1?i:i.username,typeof i===A?i.apply(e):i))+'">'+P((i=e.user,i=null==i||i===!1?i:i.username,typeof i===A?i.apply(e):i))+"</a> ",a={hash:{},data:t},s+=P((i=n.translate||e.translate,i?i.call(e,"migalert|new_follower_alert",a):S.call(e,"translate","migalert|new_follower_alert",a)))+' <a href="',a={hash:{},data:t},s+=P((i=n.getSessionUser||e.getSessionUser,i?i.call(e,"personalized_url",a):S.call(e,"getSessionUser","personalized_url",a)))+'/followers" title="',a={hash:{},data:t},s+=P((i=n.translate||e.translate,i?i.call(e,"user|follow_back",a):S.call(e,"translate","user|follow_back",a)))+'">',a={hash:{},data:t},s+=P((i=n.translate||e.translate,i?i.call(e,"user|follow_back",a):S.call(e,"translate","user|follow_back",a)))+"</a> ",a={hash:{},data:t},s+=P((i=n.translate||e.translate,i?i.call(e,"migalert|new_follower_alert_2",a):S.call(e,"translate","migalert|new_follower_alert_2",a)))+'\n </div>\n </div>\n <div class="alert-time">\n ',(o=n.timestamp_relative)?o=o.call(e,{hash:{},data:t}):(o=e.timestamp_relative,o=typeof o===A?o.apply(e):o),s+=P(o)+"\n </div>\n"}function u(e,t){var i,o,a,s="";return s+='\n <div class="alert-image">\n <img src="',a={hash:{},data:t},s+=P((i=n.getDisplayPictureUrl||e.getDisplayPictureUrl,i?i.call(e,(i=e.user,null==i||i===!1?i:i.username),(i=e.user,null==i||i===!1?i:i.display_picture_type),32,32,a):S.call(e,"getDisplayPictureUrl",(i=e.user,null==i||i===!1?i:i.username),(i=e.user,null==i||i===!1?i:i.display_picture_type),32,32,a)))+'" width="32" height="32" title="'+P((i=e.user,i=null==i||i===!1?i:i.username,typeof i===A?i.apply(e):i))+'" alt="'+P((i=e.user,i=null==i||i===!1?i:i.username,typeof i===A?i.apply(e):i))+'" />\n </div>\n <div class="alert-content">\n <div class="alert-title">\n <a href="'+P((i=e.user,i=null==i||i===!1?i:i.personalized_url,typeof i===A?i.apply(e):i))+'" title="'+P((i=e.user,i=null==i||i===!1?i:i.username,typeof i===A?i.apply(e):i))+'">'+P((i=e.user,i=null==i||i===!1?i:i.username,typeof i===A?i.apply(e):i))+"</a> ",a={hash:{},data:t},s+=P((i=n.translate||e.translate,i?i.call(e,"migalert|new_mutual_follower_alert",a):S.call(e,"translate","migalert|new_mutual_follower_alert",a)))+'\n </div>\n </div>\n <div class="alert-time">\n ',(o=n.timestamp_relative)?o=o.call(e,{hash:{},data:t}):(o=e.timestamp_relative,o=typeof o===A?o.apply(e):o),s+=P(o)+"\n </div>\n"}function h(e,t){var i,o,a,s="";return s+='\n <div class="alert-image">\n <img src="',a={hash:{},data:t},s+=P((i=n.getDisplayPictureUrl||e.getDisplayPictureUrl,i?i.call(e,(i=e.user,null==i||i===!1?i:i.username),(i=e.user,null==i||i===!1?i:i.display_picture_type),32,32,a):S.call(e,"getDisplayPictureUrl",(i=e.user,null==i||i===!1?i:i.username),(i=e.user,null==i||i===!1?i:i.display_picture_type),32,32,a)))+'" width="32" height="32" title="'+P((i=e.user,i=null==i||i===!1?i:i.username,typeof i===A?i.apply(e):i))+'" alt="'+P((i=e.user,i=null==i||i===!1?i:i.username,typeof i===A?i.apply(e):i))+'" />\n </div>\n <div class="alert-content">\n <div class="alert-title">\n <a href="'+P((i=e.user,i=null==i||i===!1?i:i.personalized_url,typeof i===A?i.apply(e):i))+'" title="'+P((i=e.user,i=null==i||i===!1?i:i.username,typeof i===A?i.apply(e):i))+'">'+P((i=e.user,i=null==i||i===!1?i:i.username,typeof i===A?i.apply(e):i))+"</a> ",a={hash:{},data:t},s+=P((i=n.translate||e.translate,i?i.call(e,"migalert|following_request_requested",a):S.call(e,"translate","migalert|following_request_requested",a)))+'\n </div>\n <div class="alert_body">\n ',o=n["if"].call(e,(i=e.user,null==i||i===!1?i:i.gender),{hash:{},inverse:I.noop,fn:I.program(14,d,t),data:t}),(o||0===o)&&(s+=o),s+="\n ",o=n["if"].call(e,(i=e.user,null==i||i===!1?i:i.country),{hash:{},inverse:I.noop,fn:I.program(16,p,t),data:t}),(o||0===o)&&(s+=o),s+="\n ",a={hash:{},data:t},s+=P((i=n.translate||e.translate,i?i.call(e,"user|miglevel_with_level",(i=e.user,null==i||i===!1?i:i.mig_level),a):S.call(e,"translate","user|miglevel_with_level",(i=e.user,null==i||i===!1?i:i.mig_level),a)))+", "+P((i=e.user,i=null==i||i===!1?i:i.num_followers,typeof i===A?i.apply(e):i))+" ",a={hash:{},data:t},s+=P((i=n.translate||e.translate,i?i.call(e,"user|followers",a):S.call(e,"translate","user|followers",a)))+"\n ",o=n["if"].call(e,(i=e.user,i=null==i||i===!1?i:i.label,null==i||i===!1?i:i.verified),{hash:{},inverse:I.program(20,m,t),fn:I.program(18,f,t),data:t}),(o||0===o)&&(s+=o),s+='\n </div>\n <div class="alert-actions">\n <a href="#" title="',a={hash:{},data:t},s+=P((i=n.translate||e.translate,i?i.call(e,"common|approve",a):S.call(e,"translate","common|approve",a)))+'" class="approve-following-request btn-small btn-success">',a={hash:{},data:t},s+=P((i=n.translate||e.translate,i?i.call(e,"common|approve",a):S.call(e,"translate","common|approve",a)))+'</a>\n &nbsp;&nbsp;\n <a href="#" title="',a={hash:{},data:t},s+=P((i=n.translate||e.translate,i?i.call(e,"common|reject",a):S.call(e,"translate","common|reject",a)))+'" class="reject-following-request btn-small btn-danger">',a={hash:{},data:t},s+=P((i=n.translate||e.translate,i?i.call(e,"common|reject",a):S.call(e,"translate","common|reject",a)))+'</a>\n </div>\n </div>\n <div class="alert-time">\n ',(o=n.timestamp_relative)?o=o.call(e,{hash:{},data:t}):(o=e.timestamp_relative,o=typeof o===A?o.apply(e):o),s+=P(o)+"\n </div>\n"}function d(e,t){var i,o,a="";return a+="\n ",o={hash:{},data:t},a+=P((i=n.getGender||e.getGender,i?i.call(e,(i=e.user,null==i||i===!1?i:i.gender),o):S.call(e,"getGender",(i=e.user,null==i||i===!1?i:i.gender),o)))+",\n "}function p(e){var t,n="";return n+="\n "+P((t=e.user,t=null==t||t===!1?t:t.country,typeof t===A?t.apply(e):t))+",\n "}function f(e,t){var i,o,a="";return a+="\n <br />",o={hash:{},data:t},a+=P((i=n.translate||e.translate,i?i.call(e,"migalert|about_me_verified_details",(i=e.user,null==i||i===!1?i:i.about_me_verified),o):S.call(e,"translate","migalert|about_me_verified_details",(i=e.user,null==i||i===!1?i:i.about_me_verified),o)))+"\n "}function m(e,t){var i,o,a="";return a+="\n ",o=n["if"].call(e,(i=e.user,null==i||i===!1?i:i.about_me),{hash:{},inverse:I.noop,fn:I.program(21,g,t),data:t}),(o||0===o)&&(a+=o),a+="\n "}function g(e,t){var i,o,a="";return a+="\n <br />",o={hash:{},data:t},a+=P((i=n.translate||e.translate,i?i.call(e,"migalert|about_me_details",(i=e.user,null==i||i===!1?i:i.about_me),o):S.call(e,"translate","migalert|about_me_details",(i=e.user,null==i||i===!1?i:i.about_me),o)))+"\n "}function _(e,t){var i,o,a,s="";return s+='\n <div class="alert-image">\n <img src="',a={hash:{},data:t},s+=P((i=n.getUrl||e.getUrl,i?i.call(e,"cdn",a):S.call(e,"getUrl","cdn",a)))+'/resources/img/icons/32x32/mig33.png" width="32" height="32" />\n </div>\n <div class="alert-content">\n <div class="alert-title">\n ',a={hash:{},data:t},s+=P((i=n.translate||e.translate,i?i.call(e,"migalert|miglevel_increase",(i=e.content,null==i||i===!1?i:i.miglevel),a):S.call(e,"translate","migalert|miglevel_increase",(i=e.content,null==i||i===!1?i:i.miglevel),a)))+'\n </div>\n </div>\n <div class="alert-time">\n ',(o=n.timestamp_relative)?o=o.call(e,{hash:{},data:t}):(o=e.timestamp_relative,o=typeof o===A?o.apply(e):o),s+=P(o)+"\n </div>\n"}function v(e,t){var i,o,a,s="";return s+='\n <div class="alert-image">\n <img src="',a={hash:{},data:t},s+=P((i=n.getDisplayPictureUrl||e.getDisplayPictureUrl,i?i.call(e,(i=e.user,null==i||i===!1?i:i.username),(i=e.user,null==i||i===!1?i:i.display_picture_type),32,32,a):S.call(e,"getDisplayPictureUrl",(i=e.user,null==i||i===!1?i:i.username),(i=e.user,null==i||i===!1?i:i.display_picture_type),32,32,a)))+'" width="32" height="32" title="'+P((i=e.user,i=null==i||i===!1?i:i.username,typeof i===A?i.apply(e):i))+'" alt="'+P((i=e.user,i=null==i||i===!1?i:i.username,typeof i===A?i.apply(e):i))+'" />\n </div>\n <div class="alert-content">\n <div class="alert-title">\n <a href="'+P((i=e.user,i=null==i||i===!1?i:i.personalized_url,typeof i===A?i.apply(e):i))+'" title="'+P((i=e.user,i=null==i||i===!1?i:i.username,typeof i===A?i.apply(e):i))+'">'+P((i=e.user,i=null==i||i===!1?i:i.username,typeof i===A?i.apply(e):i))+"</a> ",a={hash:{},data:t},s+=P((i=n.translate||e.translate,i?i.call(e,"migalert|post_reply",a):S.call(e,"translate","migalert|post_reply",a)))+' <a href="'+P((i=e.content,i=null==i||i===!1?i:i.parent_post,i=null==i||i===!1?i:i.permalink,typeof i===A?i.apply(e):i))+'" title="',a={hash:{},data:t},s+=P((i=n.stripTags||e.stripTags,i?i.call(e,(i=e.content,null==i||i===!1?i:i.body),a):S.call(e,"stripTags",(i=e.content,null==i||i===!1?i:i.body),a)))+'">',a={hash:{},data:t},s+=P((i=n.stripTags||e.stripTags,i?i.call(e,(i=e.content,null==i||i===!1?i:i.body),a):S.call(e,"stripTags",(i=e.content,null==i||i===!1?i:i.body),a)))+'</a>\n </div>\n </div>\n <div class="alert-time">\n ',(o=n.timestamp_relative)?o=o.call(e,{hash:{},data:t}):(o=e.timestamp_relative,o=typeof o===A?o.apply(e):o),s+=P(o)+"\n </div>\n"}function y(e,t){var i,o,a,s="";return s+='\n <div class="alert-image">\n <img src="',a={hash:{},data:t},s+=P((i=n.getDisplayPictureUrl||e.getDisplayPictureUrl,i?i.call(e,(i=e.user,null==i||i===!1?i:i.username),(i=e.user,null==i||i===!1?i:i.display_picture_type),32,32,a):S.call(e,"getDisplayPictureUrl",(i=e.user,null==i||i===!1?i:i.username),(i=e.user,null==i||i===!1?i:i.display_picture_type),32,32,a)))+'" width="32" height="32" title="'+P((i=e.user,i=null==i||i===!1?i:i.username,typeof i===A?i.apply(e):i))+'" alt="'+P((i=e.user,i=null==i||i===!1?i:i.username,typeof i===A?i.apply(e):i))+'" />\n </div>\n <div class="alert-content">\n <div class="alert-title">\n <a href="'+P((i=e.user,i=null==i||i===!1?i:i.personalized_url,typeof i===A?i.apply(e):i))+'" title="'+P((i=e.user,i=null==i||i===!1?i:i.username,typeof i===A?i.apply(e):i))+'">'+P((i=e.user,i=null==i||i===!1?i:i.username,typeof i===A?i.apply(e):i))+"</a> ",a={hash:{},data:t},s+=P((i=n.translate||e.translate,i?i.call(e,"migalert|credit_transfer",(i=e.content,null==i||i===!1?i:i.currency),(i=e.content,null==i||i===!1?i:i.amount),a):S.call(e,"translate","migalert|credit_transfer",(i=e.content,null==i||i===!1?i:i.currency),(i=e.content,null==i||i===!1?i:i.amount),a)))+' > <a href="',a={hash:{},data:t},s+=P((i=n.getUrl||e.getUrl,i?i.call(e,"site",a):S.call(e,"getUrl","site",a)))+'/sites/ajax/account/recharge_credit" title="',a={hash:{},data:t},s+=P((i=n.translate||e.translate,i?i.call(e,"migalert|check_account",a):S.call(e,"translate","migalert|check_account",a)))+'">',a={hash:{},data:t},s+=P((i=n.translate||e.translate,i?i.call(e,"migalert|check_account",a):S.call(e,"translate","migalert|check_account",a)))+'</a>.\n </div>\n </div>\n <div class="alert-time">\n ',(o=n.timestamp_relative)?o=o.call(e,{hash:{},data:t}):(o=e.timestamp_relative,o=typeof o===A?o.apply(e):o),s+=P(o)+"\n </div>\n"}function w(e,t){var i,o,a,s="";return s+='\n <div class="alert-image">\n <img src="',a={hash:{},data:t},s+=P((i=n.getUrl||e.getUrl,i?i.call(e,"cdn",a):S.call(e,"getUrl","cdn",a)))+'/resources/img/icons/32x32/mig33.png" width="32" height="32" />\n </div>\n <div class="alert-content">\n <div class="alert-title">\n ',a={hash:{},data:t},s+=P((i=n.translate||e.translate,i?i.call(e,"migalert|became_merchant",a):S.call(e,"translate","migalert|became_merchant",a)))+'\n </div>\n </div>\n <div class="alert-time">\n ',(o=n.timestamp_relative)?o=o.call(e,{hash:{},data:t}):(o=e.timestamp_relative,o=typeof o===A?o.apply(e):o),s+=P(o)+"\n </div>\n"}function b(e,t){var i,o,a,s="";return s+='\n <div class="alert-image">\n <img src="',a={hash:{},data:t},s+=P((i=n.getDisplayPictureUrl||e.getDisplayPictureUrl,i?i.call(e,(i=e.user,null==i||i===!1?i:i.username),(i=e.user,null==i||i===!1?i:i.display_picture_type),32,32,a):S.call(e,"getDisplayPictureUrl",(i=e.user,null==i||i===!1?i:i.username),(i=e.user,null==i||i===!1?i:i.display_picture_type),32,32,a)))+'" width="32" height="32" title="'+P((i=e.user,i=null==i||i===!1?i:i.username,typeof i===A?i.apply(e):i))+'" alt="'+P((i=e.user,i=null==i||i===!1?i:i.username,typeof i===A?i.apply(e):i))+'" />\n </div>\n <div class="alert-content">\n <div class="alert-title">\n <a href="'+P((i=e.user,i=null==i||i===!1?i:i.personalized_url,typeof i===A?i.apply(e):i))+'" title="'+P((i=e.user,i=null==i||i===!1?i:i.username,typeof i===A?i.apply(e):i))+'">'+P((i=e.user,i=null==i||i===!1?i:i.username,typeof i===A?i.apply(e):i))+"</a> ",a={hash:{},data:t},s+=P((i=n.translate||e.translate,i?i.call(e,"migalert|watched_post_reply",a):S.call(e,"translate","migalert|watched_post_reply",a)))+' <a href="'+P((i=e.content,i=null==i||i===!1?i:i.parent_post,i=null==i||i===!1?i:i.permalink,typeof i===A?i.apply(e):i))+'" title="',a={hash:{},data:t},s+=P((i=n.stripTags||e.stripTags,i?i.call(e,(i=e.content,i=null==i||i===!1?i:i.parent_post,null==i||i===!1?i:i.body_snippet),a):S.call(e,"stripTags",(i=e.content,i=null==i||i===!1?i:i.parent_post,null==i||i===!1?i:i.body_snippet),a)))+'">',a={hash:{},data:t},s+=P((i=n.stripTags||e.stripTags,i?i.call(e,(i=e.content,i=null==i||i===!1?i:i.parent_post,null==i||i===!1?i:i.body_snippet),a):S.call(e,"stripTags",(i=e.content,i=null==i||i===!1?i:i.parent_post,null==i||i===!1?i:i.body_snippet),a)))+'</a>\n </div>\n <div class="alert_body">\n "<a href="'+P((i=e.content,i=null==i||i===!1?i:i.permalink,typeof i===A?i.apply(e):i))+'" title="'+P((i=e.content,i=null==i||i===!1?i:i.body_snippet,typeof i===A?i.apply(e):i))+'">'+P((i=e.content,i=null==i||i===!1?i:i.body_snippet,typeof i===A?i.apply(e):i))+'</a>"\n </div>\n </div>\n <div class="alert-time">\n ',(o=n.timestamp_relative)?o=o.call(e,{hash:{},data:t}):(o=e.timestamp_relative,o=typeof o===A?o.apply(e):o),s+=P(o)+"\n </div>\n"}function x(e,t){var i,o,a,s="";return s+='\n <div class="alert-image">\n <img src="',a={hash:{},data:t},s+=P((i=n.getDisplayPictureUrl||e.getDisplayPictureUrl,i?i.call(e,(i=e.user,null==i||i===!1?i:i.username),(i=e.user,null==i||i===!1?i:i.display_picture_type),32,32,a):S.call(e,"getDisplayPictureUrl",(i=e.user,null==i||i===!1?i:i.username),(i=e.user,null==i||i===!1?i:i.display_picture_type),32,32,a)))+'" width="32" height="32" title="'+P((i=e.user,i=null==i||i===!1?i:i.username,typeof i===A?i.apply(e):i))+'" alt="'+P((i=e.user,i=null==i||i===!1?i:i.username,typeof i===A?i.apply(e):i))+'" />\n </div>\n <div class="alert-content">\n <div class="alert-title">\n <a href="'+P((i=e.user,i=null==i||i===!1?i:i.personalized_url,typeof i===A?i.apply(e):i))+'" title="'+P((i=e.user,i=null==i||i===!1?i:i.username,typeof i===A?i.apply(e):i))+'">'+P((i=e.user,i=null==i||i===!1?i:i.username,typeof i===A?i.apply(e):i))+"</a> ",a={hash:{},data:t},s+=P((i=n.translate||e.translate,i?i.call(e,"migalert|participated_post_reply",a):S.call(e,"translate","migalert|participated_post_reply",a)))+' <a href="'+P((i=e.content,i=null==i||i===!1?i:i.parent_post,i=null==i||i===!1?i:i.permalink,typeof i===A?i.apply(e):i))+'" title="',a={hash:{},data:t},s+=P((i=n.stripTags||e.stripTags,i?i.call(e,(i=e.content,i=null==i||i===!1?i:i.parent_post,null==i||i===!1?i:i.body_snippet),a):S.call(e,"stripTags",(i=e.content,i=null==i||i===!1?i:i.parent_post,null==i||i===!1?i:i.body_snippet),a)))+'">',a={hash:{},data:t},s+=P((i=n.stripTags||e.stripTags,i?i.call(e,(i=e.content,i=null==i||i===!1?i:i.parent_post,null==i||i===!1?i:i.body_snippet),a):S.call(e,"stripTags",(i=e.content,i=null==i||i===!1?i:i.parent_post,null==i||i===!1?i:i.body_snippet),a)))+'</a>\n </div>\n <div class="alert_body">\n "<a href="'+P((i=e.content,i=null==i||i===!1?i:i.permalink,typeof i===A?i.apply(e):i))+'" title="'+P((i=e.content,i=null==i||i===!1?i:i.body_snippet,typeof i===A?i.apply(e):i))+'">'+P((i=e.content,i=null==i||i===!1?i:i.body_snippet,typeof i===A?i.apply(e):i))+'</a>"\n </div>\n </div>\n <div class="alert-time">\n ',(o=n.timestamp_relative)?o=o.call(e,{hash:{},data:t}):(o=e.timestamp_relative,o=typeof o===A?o.apply(e):o),s+=P(o)+"\n </div>\n"}this.compilerInfo=[4,">= 1.0.0"],n=this.merge(n,e.helpers),o=o||{};var k,C,E,T="",S=n.helperMissing,P=this.escapeExpression,A="function",I=this;return E={hash:{},inverse:I.noop,fn:I.program(1,a,o),data:o},k=n.compare||t.compare,C=k?k.call(t,t.type,"GROUP_INVITE",E):S.call(t,"compare",t.type,"GROUP_INVITE",E),(C||0===C)&&(T+=C),T+="\n",E={hash:{},inverse:I.noop,fn:I.program(3,s,o),data:o},k=n.compare||t.compare,C=k?k.call(t,t.type,"VIRTUALGIFT_ALERT",E):S.call(t,"compare",t.type,"VIRTUALGIFT_ALERT",E),(C||0===C)&&(T+=C),T+="\n",E={hash:{},inverse:I.noop,fn:I.program(5,r,o),data:o},k=n.compare||t.compare,C=k?k.call(t,t.type,"GAME_INVITE",E):S.call(t,"compare",t.type,"GAME_INVITE",E),(C||0===C)&&(T+=C),T+="\n",E={hash:{},inverse:I.noop,fn:I.program(7,l,o),data:o},k=n.compare||t.compare,C=k?k.call(t,t.type,"NEW_BADGE_ALERT",E):S.call(t,"compare",t.type,"NEW_BADGE_ALERT",E),(C||0===C)&&(T+=C),T+="\n",E={hash:{},inverse:I.noop,fn:I.program(9,c,o),data:o},k=n.compare||t.compare,C=k?k.call(t,t.type,"NEW_FOLLOWER_ALERT",E):S.call(t,"compare",t.type,"NEW_FOLLOWER_ALERT",E),(C||0===C)&&(T+=C),T+="\n",E={hash:{},inverse:I.noop,fn:I.program(11,u,o),data:o},k=n.compare||t.compare,C=k?k.call(t,t.type,"MUTUAL_FOLLOWING_ALERT",E):S.call(t,"compare",t.type,"MUTUAL_FOLLOWING_ALERT",E),(C||0===C)&&(T+=C),T+="\n",E={hash:{},inverse:I.noop,fn:I.program(13,h,o),data:o},k=n.compare||t.compare,C=k?k.call(t,t.type,"FOLLOWING_REQUEST",E):S.call(t,"compare",t.type,"FOLLOWING_REQUEST",E),(C||0===C)&&(T+=C),T+="\n",E={hash:{},inverse:I.noop,fn:I.program(23,_,o),data:o},k=n.compare||t.compare,C=k?k.call(t,t.type,"MIGLEVEL_INCREASE_ALERT",E):S.call(t,"compare",t.type,"MIGLEVEL_INCREASE_ALERT",E),(C||0===C)&&(T+=C),T+="\n",E={hash:{},inverse:I.noop,fn:I.program(25,v,o),data:o},k=n.compare||t.compare,C=k?k.call(t,t.type,"REPLY_TO_MIGBO_POST_ALERT",E):S.call(t,"compare",t.type,"REPLY_TO_MIGBO_POST_ALERT",E),(C||0===C)&&(T+=C),T+="\n",E={hash:{},inverse:I.noop,fn:I.program(27,y,o),data:o},k=n.compare||t.compare,C=k?k.call(t,t.type,"INCOMING_CREDIT_TRANSFER_ALERT",E):S.call(t,"compare",t.type,"INCOMING_CREDIT_TRANSFER_ALERT",E),(C||0===C)&&(T+=C),T+="\n",E={hash:{},inverse:I.noop,fn:I.program(29,w,o),data:o},k=n.compare||t.compare,C=k?k.call(t,t.type,"MERCHANT_STATUS_CHANGE_ALERT",E):S.call(t,"compare",t.type,"MERCHANT_STATUS_CHANGE_ALERT",E),(C||0===C)&&(T+=C),T+="\n",E={hash:{},inverse:I.noop,fn:I.program(31,b,o),data:o},k=n.compare||t.compare,C=k?k.call(t,t.type,"REPLY_TO_MIGBO_WATCHED_POST_ALERT",E):S.call(t,"compare",t.type,"REPLY_TO_MIGBO_WATCHED_POST_ALERT",E),(C||0===C)&&(T+=C),T+="\n",E={hash:{},inverse:I.noop,fn:I.program(33,x,o),data:o},k=n.compare||t.compare,C=k?k.call(t,t.type,"REPLY_TO_MIGBO_PARTICIPATED_POST_ALERT",E):S.call(t,"compare",t.type,"REPLY_TO_MIGBO_PARTICIPATED_POST_ALERT",E),(C||0===C)&&(T+=C),T})}),define("modules/template/helpers/general_helpers",["underscore","handlebars","modules/common/utility","modules/common/local_storage","modules/common/session_user"],function(e,t,n,i,o){t.registerHelper("translate",function(){return new t.SafeString(n.translate.apply(this,arguments))}),t.registerHelper("ifLoggedIn",function(e){return n.is_logged_in()?e.fn(this):e.inverse(this)}),t.registerHelper("isLoggedIn",function(){return n.is_logged_in()}),t.registerHelper("getVariable",function(e,t){return variable[e][t]}),t.registerHelper("getUrl",function(e){return url[e]}),t.registerHelper("getSessionUser",function(e){var t=o.getInstance();return t.has(e)?t.get(e):t.toJSON()}),t.registerHelper("getSettings",function(e){return e===void 0?settings:settings[e]}),t.registerHelper("ifSystemPropertyEnabled",function(e,t){return settings[e].enabled?t.fn(this):t.inverse(this)}),t.registerHelper("mysqlDateFormat",function(t,i){i=i||"fullDate";var o=new Date;if(!e.isUndefined(t)){var a=RegExp("(\\d{4})-(\\d{2})-(\\d{2}) (\\d{2}):(\\d{2}):(\\d{2})"),s=t.match(a);o=new Date(parseInt(s[1],10),parseInt(s[2],10)-1,parseInt(s[3],10),parseInt(s[4],10),parseInt(s[5],10),parseInt(s[6],10),0)
}return n.dateFormat(o,"fullDate")}),t.registerHelper("characterLimiter",function(e,i){return new t.SafeString(n.character_limiter(e,i))}),t.registerHelper("getProfileUrl",function(e){return n.get_profile_url(e)}),t.registerHelper("getDisplayPictureUrl",function(e,t,i,o){return n.get_display_picture_url(e,t,i,o)}),t.registerHelper("getSessionUserDisplayPictureUrl",function(e,t){return n.get_display_picture_url(session_user.username,session_user.display_picture_type,e,t)}),t.registerHelper("getBadgeImageUrl",function(e,t){return n.get_badge_image_url(e,t)}),t.registerHelper("getGiftImageUrl",function(e,t,i){return n.get_gift_image_url(e,t,i)}),t.registerHelper("getGender",function(e){return n.get_gender(e)}),t.registerHelper("showHeaderLayoutSignupMessage",function(){return n.translate("header|nonlogin_message",'<span id="login-signup-message"></span>',url.login,url.register)}),t.registerHelper("ifSessionUserSettingsThirdPartySite",function(e,t){var n=e.split("|");return session_user_settings.thirdpartysite[n[0]][n[1]]?t.fn(this):t.inverse(this)}),t.registerHelper("ifGetSessionUserLayoutType",function(e,t){var n=o.getInstance().getLayoutType();return n===e?t.fn(this):t.inverse(this)}),t.registerHelper("ifIsNumeric",function(e,t){return isNaN(e)?t.fn(this):t.inverse(this)}),t.registerHelper("log",function(e){console.log("\nCurrent Context"),console.log("===================="),console.log(this),console.log(arguments),arguments.length>1&&(console.log("Value"),console.log("===================="),console.log(e))}),t.registerHelper("iterator",function(t,n){var i=n.fn,o=n.inverse,a="";if(t&&t.length>0)for(var s=0,r=t.length;r>s;s++)a+=i(e.extend({},t[s],{i:s,iPlus1:s+1}));else a=o(this);return a}),t.registerHelper("key_value",function(e,t){var n,i="";for(n in e)e.hasOwnProperty(n)&&(i+=t.fn({key:n,value:e[n]}));return i}),t.registerHelper("isNotEmpty",function(e,t){var n=$.trim(e);return n===void 0||""===n||null===n?t.inverse(this):t.fn(this)}),t.registerHelper("limit",function(e,t){var n="",i=parseInt(t.hash.offset,10)||0,o=parseInt(t.hash.limit,10)||5,a=e.length>i?i:0,s=e.length>o+i?o+i:e.length;for(s;s>a;a++)n+=t.fn(e[a]);return n}),t.registerHelper("compare",function(e,t,n){var i;if(3>arguments.length)throw Error("Handlerbars Helper 'compare' needs 2 parameters");i=n.hash.operator||"==";var o={"==":function(e,t){return e==t},"===":function(e,t){return e===t},"!=":function(e,t){return e!=t},"<":function(e,t){return t>e},">":function(e,t){return e>t},"<=":function(e,t){return t>=e},">=":function(e,t){return e>=t},"typeof":function(e,t){return typeof e==t}};if(!o[i])throw Error("Handlerbars Helper 'compare' doesn't know the operator "+i);var a=o[i](e,t);return a?n.fn(this):n.inverse(this)}),t.registerHelper("withFirst",function(t,n){var i="";if(!e.isArray(t))throw Error("Handlerbars Helper 'withFirst' needs an array to work with");return i+=n.fn(t[0])}),t.registerHelper("stripTags",function(e){return n.strip_tags(e)})}),define("modules/view/migalert/migalert_item_view",["underscore","jquery","backbone","handlebars","backbone.marionette","marionette_handlebars","hbs!modules/template/migalert/migalert-list","modules/common/config","modules/common/utility","modules/template/helpers/general_helpers"],function(e,t,n,i,o,a,s,r,l){var c=o.ItemView.extend({template:{type:"handlebars",template:s},initialize:function(){e.bindAll(this)},id:function(){return"alert-"+this.model.get("id")},tagName:"li",className:function(){var e=this.model.get("type"),t="migalert clearfix";switch(e){case"FRIEND_INVITE":case"GROUP_INVITE":case"FOLLOWING_REQUEST":t+=" alert-no-action"}return t},events:{"click .approve-following-request":"approveFollowingRequest","click .reject-following-request":"rejectFollowingRequest","click .accept-group-invite":"acceptGroupInvite","click .reject-group-invite":"rejectGroupInvite","click .accept-game-invite":"acceptGameInvite","click .reject-game-invite":"rejectGameInvite",'click a[href^="http"]':"navigateTo"},navigateTo:function(e){var i=t(e.currentTarget).attr("href").replace(window.location.protocol+"//"+window.location.hostname,"");n.history.navigate(i,{trigger:!0})},approveFollowingRequest:function(e){l.is_logged_in()&&(this.model.approveRejectFollowingRequest("approve"),this.$(e.currentTarget).parent(".alert-actions").fadeOut())},rejectFollowingRequest:function(e){l.is_logged_in()&&(this.model.approveRejectFollowingRequest("reject"),this.$(e.currentTarget).parent(".alert-actions").fadeOut())},acceptGroupInvite:function(e){l.is_logged_in()&&(this.model.acceptRejectGroupInvite("accept"),this.$(e.currentTarget).parent(".alert-actions").fadeOut())},rejectGroupInvite:function(e){l.is_logged_in()&&(this.model.acceptRejectGroupInvite("reject"),this.$(e.currentTarget).parent(".alert-actions").fadeOut())},acceptGameInvite:function(e){l.is_logged_in()&&(this.model.acceptRejectGameInvite("accept"),this.$(e.currentTarget).parent(".alert-actions").fadeOut())},rejectGameInvite:function(e){l.is_logged_in()&&(this.model.acceptRejectGameInvite("reject"),this.$(e.currentTarget).parent(".alert-actions").fadeOut())}});return c}),define("hbs!modules/template/migalert/migalert-collection",["handlebars"],function(e){return e.template(function(e,t,n,i,o){this.compilerInfo=[4,">= 1.0.0"],n=this.merge(n,e.helpers),o=o||{};var a,s,r="",l=n.helperMissing,c=this.escapeExpression;return r+='<div class="migalerts-filter">\n <div class="btn-group">\n <a class="btn dropdown-toggle" data-toggle="dropdown" href="#">\n <span class="current-filter">',s={hash:{},data:o},r+=c((a=n.translate||t.translate,a?a.call(t,"migalert|all_alerts",s):l.call(t,"translate","migalert|all_alerts",s)))+'</span>\n <span class="caret"></span>\n </a>\n <ul class="dropdown-menu">\n <li><a href="#" data-type="all" class="filter" onclick="return false;">',s={hash:{},data:o},r+=c((a=n.translate||t.translate,a?a.call(t,"migalert|all_alerts",s):l.call(t,"translate","migalert|all_alerts",s)))+'</a></li>\n <li><a href="#" data-type="requests" class="filter" onclick="return false;">',s={hash:{},data:o},r+=c((a=n.translate||t.translate,a?a.call(t,"migalert|requests",s):l.call(t,"translate","migalert|requests",s)))+'</a></li>\n <li><a href="#" data-type="invitations" class="filter" onclick="return false;">',s={hash:{},data:o},r+=c((a=n.translate||t.translate,a?a.call(t,"migalert|invitations",s):l.call(t,"translate","migalert|invitations",s)))+'</a></li>\n <li><a href="#" data-type="system" class="filter" onclick="return false;">',s={hash:{},data:o},r+=c((a=n.translate||t.translate,a?a.call(t,"migalert|system_alerts",s):l.call(t,"translate","migalert|system_alerts",s)))+'</a></li>\n </ul>\n </div>\n <div class="migalerts-refresh">\n <a href="#" class="previous hide" onclick="return false;"><i class="icon-arrow-left"></i></a>\n <a href="#" class="next" onclick="return false;"><i class="icon-arrow-right"></i></a>\n <!-- <a href="#" class="refresh" onclick="return false;"><i class="ico ico-16 ico-refresh"></i></a> -->\n </div>\n</div>\n<ul id="migalerts-list" class="unstyled"></ul>'})}),define("modules/view/common/mig33_collection_view_mixin",["underscore","backbone","handlebars","backbone.marionette"],function(e,t,n,i){var o={showEmptyView:function(){var e,n;if(e=!this.__collection_synced&&i.getOption(this,"loadingView")?i.getOption(this,"loadingView"):i.getOption(this,"emptyView"),n=i.getOption(this,"emptyViewModel"),e&&!this._showingEmptyView){this._showingEmptyView=!0;var o=n||new t.Model;this.addItemView(o,e,0)}},setupCollectionEventForEmptyView:function(e){e.collection&&e.collection.on("sync",function(){var t=this.__collection_synced;this.__collection_synced=!0,t||0!==e.collection.length||this.render()},this),this.__collection_synced=!1}};return o}),define("modules/view/common/mig33_composite_view",["underscore","backbone","handlebars","backbone.marionette","modules/view/common/mig33_collection_view_mixin"],function(e,t,n,i,o){var a=i.CompositeView.extend({constructor:function(e){this.setupCollectionEventForEmptyView(e),a.__super__.constructor.apply(this,arguments)}});return e.extend(a.prototype,o),a}),define("modules/view/migalert/migalert_collection_view",["underscore","jquery","backbone","handlebars","backbone.marionette","marionette_handlebars","modules/common/config","modules/common/utility","modules/view/migalert/migalert_item_view","hbs!modules/template/migalert/migalert-collection","modules/view/common/mig33_composite_view","modules/template/helpers/general_helpers"],function(e,t,n,i,o,a,s,r,l,c,u){var h=i.compile('<li class="migalert-error">'+r.translate("migalerts|empty")+"</li>"),d=i.compile('<div class="loading">{{translate "common|loading"}}...</div>'),p=o.ItemView.extend({template:{type:"handlebars",template:h}}),f=o.ItemView.extend({template:{type:"handlebars",template:d}}),m=u.extend({itemView:l,emptyView:p,loadingView:f,itemViewContainer:"#migalerts-list",prevScrollY:0,template:{type:"handlebars",template:c},className:"migalerts",initialize:function(){e.bindAll(this)},onRender:function(){r.isolate_scroll("#migalerts-list")},appendHtml:function(e,t,n){0===n?e.$("#migalerts-list").prepend(t.el):e.$("#migalerts-list").append(t.el)},fetchMigAlerts:function(t){var n,i=this,o="all";if(!e.isUndefined(t)){var a=this.$(t.currentTarget);o=a.data("type")}i.collection.setType(o),i.collection.resetPage(),n=i.collection.fetch(),n.done(function(){e.isUndefined(a)||i.$(".current-filter").text(a.text()),i.$(".dropdown-menu > li.active").removeClass("active")})},refreshMigAlerts:function(){this.collection.fetch()},fetchNextMigAlerts:function(){this.hideNext(),this.hidePrevious(),this.collection.nextPage(),this.collection.fetch()},fetchPreviousMigAlerts:function(){this.hideNext(),this.hidePrevious(),this.collection.prevPage(),this.collection.fetch()},events:{"click .filter":"fetchMigAlerts","click .refresh":"refreshMigAlerts","click .next":"fetchNextMigAlerts","click .previous":"fetchPreviousMigAlerts"},showNext:function(){t(".next",this.$el).show()},hideNext:function(){t(".next",this.$el).hide()},showPrevious:function(){t(".previous",this.$el).show()},hidePrevious:function(){t(".previous",this.$el).hide()}});return m}),define("hbs!modules/template/common/postbox",["handlebars"],function(e){return e.template(function(e,t,n,i,o){function a(e,t){var i,o,a,l="";return l+='\n <div class="postbox postbox-collapsed">\n <form\n class="navbar-form"\n action="/post/hidden_post"\n method="post"\n accept-charset="utf-8"\n target="hidden_post"\n enctype="multipart/form-data">\n\n <input type="hidden" name="callback" value="" />\n <input type="hidden" name="originality" value="1" />\n\n <div class="postbox-body-wrapper">\n\n <textarea name="body" cols="50" rows="3" placeholder="',a={hash:{},data:t},l+=_((i=n.translate||e.translate,i?i.call(e,"homefeed|say_something_user",(i=e.session_user,null==i||i===!1?i:i.username),a):v.call(e,"translate","homefeed|say_something_user",(i=e.session_user,null==i||i===!1?i:i.username),a)))+'"></textarea>\n\n <div class="postbox-charcount-wrapper">\n <span class="postbox-charcount">'+_((i=e.variables,i=null==i||i===!1?i:i.characters_count,i=null==i||i===!1?i:i.max,typeof i===g?i.apply(e):i))+'</span>\n <span class="text">',a={hash:{},data:t},l+=_((i=n.translate||e.translate,i?i.call(e,"homefeed|characters_left",a):v.call(e,"translate","homefeed|characters_left",a)))+'</span>\n </div>\n\n <div class="postbox-media-wrapper">\n <a href="javascript:;" class="close">&times;</a>\n <span class=\'postbox-media\'></span>\n </div>\n </div>\n\n <div class="postbox-footer">\n <div class="postbox-actions">\n <ul class="postbox-actions-insert">\n <li><i class="ico ico-24 ico-emoticon insert-emoticon" title="',a={hash:{},data:t},l+=_((i=n.translate||e.translate,i?i.call(e,"homefeed|emotions",a):v.call(e,"translate","homefeed|emotions",a)))+'"></i></li>\n <li>\n <div class="insert-photo-wrapper" title="',a={hash:{},data:t},l+=_((i=n.translate||e.translate,i?i.call(e,"homefeed|postbox_attach_image",a):v.call(e,"translate","homefeed|postbox_attach_image",a)))+'">\n <i class="ico ico-24 ico-photo insert-photo"></i>\n <input type="file" name="media" class="postbox-media-upload" />\n </div>\n </li>\n </ul>\n <div class="postbox-emoticons">\n <ul>\n ',i=e.variables,i=null==i||i===!1?i:i.emoticons,i=typeof i===g?i.apply(e):i,o=w.call(e,i,{hash:{},inverse:y.noop,fn:y.program(2,s,t),data:t}),(o||0===o)&&(l+=o),l+='\n </ul>\n <div class="clear"></div>\n </div>\n </div>\n <div class="postbox-postto">\n <ul>\n <li class="reply_fields hide"></li>\n ',a={hash:{},inverse:y.noop,fn:y.program(4,r,t),data:t},i=n.ifSessionUserSettingsThirdPartySite||e.ifSessionUserSettingsThirdPartySite,o=i?i.call(e,"status|twitter",a):v.call(e,"ifSessionUserSettingsThirdPartySite","status|twitter",a),(o||0===o)&&(l+=o),l+="\n ",a={hash:{},inverse:y.noop,fn:y.program(9,u,t),data:t},i=n.ifSessionUserSettingsThirdPartySite||e.ifSessionUserSettingsThirdPartySite,o=i?i.call(e,"status|facebook",a):v.call(e,"ifSessionUserSettingsThirdPartySite","status|facebook",a),(o||0===o)&&(l+=o),l+="\n ",a={hash:{},inverse:y.noop,fn:y.program(14,p,t),data:t},i=n.ifSystemPropertyEnabled||e.ifSystemPropertyEnabled,o=i?i.call(e,"post_reply_permission",a):v.call(e,"ifSystemPropertyEnabled","post_reply_permission",a),(o||0===o)&&(l+=o),l+='\n <li class="postbox-submitbutton"><input type="button" class="btn btn-small btn-mig33" name="post" value="',a={hash:{},data:t},l+=_((i=n.translate||e.translate,i?i.call(e,"homefeed|post",a):v.call(e,"translate","homefeed|post",a)))+'" /></li>\n </ul>\n </div>\n <div class="clear"></div>\n </div>\n </form>\n\n <iframe id="hidden_post" name="hidden_post" src="" style="width: 0; height: 0; border: 0; display: none;"></iframe>\n </div>\n'}function s(e,t){var i,o="";return o+='\n <li><a data-emoticon="',(i=n.hotkey)?i=i.call(e,{hash:{},data:t}):(i=e.hotkey,i=typeof i===g?i.apply(e):i),o+=_(i)+'" href="javascript:;"><img width="16" height="16" title="',(i=n.name)?i=i.call(e,{hash:{},data:t}):(i=e.name,i=typeof i===g?i.apply(e):i),o+=_(i)+'" alt="',(i=n.name)?i=i.call(e,{hash:{},data:t}):(i=e.name,i=typeof i===g?i.apply(e):i),o+=_(i)+'" src="',(i=n.url)?i=i.call(e,{hash:{},data:t}):(i=e.url,i=typeof i===g?i.apply(e):i),o+=_(i)+'" /></a></li>\n '}function r(e,t){var i,o,a,s="";return s+='\n <li class="postbox-twitter-field">\n ',a={hash:{},inverse:y.program(7,c,t),fn:y.program(5,l,t),data:t},i=n.ifSessionUserSettingsThirdPartySite||e.ifSessionUserSettingsThirdPartySite,o=i?i.call(e,"linked|twitter",a):v.call(e,"ifSessionUserSettingsThirdPartySite","linked|twitter",a),(o||0===o)&&(s+=o),s+="\n </li>\n "}function l(){return'\n <input type="hidden" name="post_to_twitter" value="1" />\n <i class="ico ico-24 ico-twitter post-to-twitter"></i>\n '}function c(e,t){var i,o,a="";return a+='\n <input type="hidden" name="post_to_twitter" value="0" />\n <a href="',o={hash:{},data:t},a+=_((i=n.getUrl||e.getUrl,i?i.call(e,"settings",o):v.call(e,"getUrl","settings",o)))+'/connect_apps" title="',o={hash:{},data:t},a+=_((i=n.translate||e.translate,i?i.call(e,"homefeed|postbox_to_twitter",o):v.call(e,"translate","homefeed|postbox_to_twitter",o)))+'"><i class="ico ico-24 ico-twitter-off"></i></a>\n '}function u(e,t){var i,o,a,s="";return s+='\n <li class="postbox-facebook-field">\n ',a={hash:{},inverse:y.program(12,d,t),fn:y.program(10,h,t),data:t},i=n.ifSessionUserSettingsThirdPartySite||e.ifSessionUserSettingsThirdPartySite,o=i?i.call(e,"linked|facebook",a):v.call(e,"ifSessionUserSettingsThirdPartySite","linked|facebook",a),(o||0===o)&&(s+=o),s+="\n </li>\n "}function h(){return'\n <input type="hidden" name="post_to_facebook" value="1" />\n <i class="ico ico-24 ico-facebook post-to-facebook"></i>\n '}function d(e,t){var i,o,a="";return a+='\n <input type="hidden" name="post_to_facebook" value="0" />\n <a href="',o={hash:{},data:t},a+=_((i=n.getUrl||e.getUrl,i?i.call(e,"settings",o):v.call(e,"getUrl","settings",o)))+'/connect_apps" title="',o={hash:{},data:t},a+=_((i=n.translate||e.translate,i?i.call(e,"homefeed|postbox_to_facebook",o):v.call(e,"translate","homefeed|postbox_to_facebook",o)))+'"><i class="ico ico-24 ico-facebook-off"></i></a>\n '}function p(e,t){var i,o,a="";return a+='\n <li class="postbox-reply_permission-field">\n <input type="hidden" name="reply_permission" value="0" />\n <i class="ico ico-24 ico-unlock set-reply-permission" title="',o={hash:{},data:t},a+=_((i=n.translate||e.translate,i?i.call(e,"homefeed|postbox_reply_permission",o):v.call(e,"translate","homefeed|postbox_reply_permission",o)))+'" />\n </li>\n '}this.compilerInfo=[4,">= 1.0.0"],n=this.merge(n,e.helpers),o=o||{};var f,m,g="function",_=this.escapeExpression,v=n.helperMissing,y=this,w=n.blockHelperMissing;return m={hash:{},inverse:y.noop,fn:y.program(1,a,o),data:o},(f=n.ifLoggedIn)?f=f.call(t,m):(f=t.ifLoggedIn,f=typeof f===g?f.apply(t):f),n.ifLoggedIn||(f=w.call(t,f,m)),f||0===f?f:""})}),function(){(function(e){return e(window.jQuery)})(function(e){var t,n,i,o;return o="caret",t=function(){function t(e){this.$inputor=e,this.domInputor=this.$inputor[0]}return t.prototype.getPos=function(){var e,t,n,i,o,a,s,r,l;return n=this.domInputor,n.focus(),document.selection?(s=document.selection.createRange(),a=0,s&&s.parentElement()===n&&(o=n.value.replace(/\r\n/g,"\n"),i=o.length,l=n.createTextRange(),l.moveToBookmark(s.getBookmark()),t=n.createTextRange(),t.collapse(!1),l.compareEndPoints("StartToEnd",t)>-1?r=e=i:(r=-l.moveStart("character",-i),e=-l.moveEnd("character",-i)))):r=n.selectionStart,r},t.prototype.setPos=function(e){var t,n;return t=this.domInputor,document.selection?(n=t.createTextRange(),n.move("character",e),n.select()):t.setSelectionRange(e,e)},t.prototype.getPosition=function(e){var t,i,o,a,s,r,l,c,u;return t=this.$inputor,o=function(e){return e.replace(/</g,"&lt").replace(/>/g,"&gt").replace(/`/g,"&#96").replace(/"/g,"&quot").replace(/\r\n|\r|\n/g,"<br />")},e=e||this.getPos(),l=t.val().slice(0,e),s="<span>"+o(l)+"</span>",s+="<span id='caret'>|</span>",r=new n(t),i=r.create(s).rect(),c=i.left-t.scrollLeft(),u=i.top-t.scrollTop(),a=i.height,{left:c,top:u,height:a}},t.prototype.getOffset=function(t){var n,i,o,a,s,r,l;return n=this.$inputor,document.selection?(s=this.domInputor.createTextRange(),t&&s.move("character",t),r=s.boundingLeft+n.scrollLeft(),l=s.boundingTop+e(window).scrollTop()+n.scrollTop(),i=s.boundingHeight):(o=n.offset(),a=this.getPosition(t),r=o.left+a.left,l=o.top+a.top,i=a.height),{left:r,top:l,height:i}},t}(),n=function(){function t(e){this.$inputor=e}return t.prototype.css_attr=["overflowY","height","width","paddingTop","paddingLeft","paddingRight","paddingBottom","marginTop","marginLeft","marginRight","marginBottom","fontFamily","borderStyle","borderWidth","wordWrap","fontSize","lineHeight","overflowX","text-align"],t.prototype.mirrorCss=function(){var t,n=this;return t={position:"absolute",left:-9999,top:0,zIndex:-2e4,"white-space":"pre-wrap"},e.each(this.css_attr,function(e,i){return t[i]=n.$inputor.css(i)}),t},t.prototype.create=function(t){return this.$mirror=e("<div></div>"),this.$mirror.css(this.mirrorCss()),this.$mirror.html(t),this.$inputor.after(this.$mirror),this},t.prototype.rect=function(){var e,t,n;return e=this.$mirror.find("#caret"),t=e.position(),n={left:t.left,top:t.top,height:e.height()},this.$mirror.remove(),n},t}(),i={pos:function(e){return e?this.setPos(e):this.getPos()},position:function(e){return this.getPosition(e)},offset:function(e){return this.getOffset(e)}},e.fn.caret=function(n){var o;return o=new t(this),i[n]?i[n].apply(o,Array.prototype.slice.call(arguments,1)):e.error("Method "+n+" does not exist on jQuery.caret")}})}.call(this),define("jquery.caret",["jquery"],function(){}),function(){var e=[].slice;(function(e){return"function"==typeof define&&define.amd?define("jquery.atwho",["jquery"],e):e(window.jQuery)})(function(t){var n,i,o,a,s,r,l,c,u;return o=function(){function e(e){this.current_flag=null,this.controllers={},this.$inputor=t(e),this.listen()}return e.prototype.controller=function(e){return this.controllers[e||this.current_flag]},e.prototype.set_context_for=function(e){return this.current_flag=e,this},e.prototype.reg=function(e,t){var n,i;return n=(i=this.controllers)[e]||(i[e]=new a(this,e)),t.alias&&(this.controllers[t.alias]=n),n.init(t),this},e.prototype.listen=function(){var e=this;return this.$inputor.on("keyup.atwho",function(t){return e.on_keyup(t)}).on("keydown.atwho",function(t){return e.on_keydown(t)}).on("scroll.atwho",function(){var t;return null!=(t=e.controller())?t.view.hide():void 0}).on("blur.atwho",function(){var t;return(t=e.controller())?t.view.hide(t.get_opt("display_timeout")):void 0})},e.prototype.dispatch=function(){var e=this;return t.map(this.controllers,function(t){return t.look_up()?e.set_context_for(t.key):void 0})},e.prototype.on_keyup=function(e){var n;switch(e.keyCode){case l.ESC:e.preventDefault(),null!=(n=this.controller())&&n.view.hide();break;case l.DOWN:case l.UP:t.noop();break;default:this.dispatch()}},e.prototype.on_keydown=function(e){var n,i;if(n=null!=(i=this.controller())?i.view:void 0,n&&n.visible())switch(e.keyCode){case l.ESC:e.preventDefault(),n.hide();break;case l.UP:e.preventDefault(),n.prev();break;case l.DOWN:e.preventDefault(),n.next();break;case l.TAB:case l.ENTER:if(!n.visible())return;e.preventDefault(),n.choose();break;default:t.noop()}},e}(),a=function(){function i(e,i){this.app=e,this.key=i,this.$inputor=this.app.$inputor,this.id=this.$inputor[0].id||o(),this.setting=null,this.query=null,this.pos=0,n.append(this.$el=t("<div id='atwho-ground-"+this.id+"'></div>")),this.model=new c(this),this.view=new u(this)}var o,a;return a=0,o=function(){return a+=1},i.prototype.init=function(e){return this.setting=t.extend({},this.setting||t.fn.atwho["default"],e),this.model.reload(this.setting.data)},i.prototype.super_call=function(){var n,i;i=arguments[0],n=arguments.length>=2?e.call(arguments,1):[];try{return s[i].apply(this,n)}catch(o){return t.error(""+o+" Or maybe At.js doesn't have function "+i)}},i.prototype.trigger=function(e,t){var n,i;return t.push(this),n=this.get_opt("alias"),i=n?""+e+"-"+n+".atwho":""+e+".atwho",this.$inputor.trigger(i,t)},i.prototype.callbacks=function(e){return this.get_opt("callbacks")[e]||s[e]},i.prototype.get_opt=function(e){try{return this.setting[e]}catch(t){return null}},i.prototype.catch_query=function(){var e,t,n,i,o,a;return t=this.$inputor.val(),e=this.$inputor.caret("pos"),a=t.slice(0,e),i=this.callbacks("matcher").call(this,this.key,a),"string"==typeof i&&i.length<=this.get_opt("max_len",20)?(o=e-i.length,n=o+i.length,this.pos=o,i={text:i.toLowerCase(),head_pos:o,end_pos:n},this.trigger("matched",[this.key,i.text])):this.view.hide(),this.query=i},i.prototype.rect=function(){var e,t;return e=this.$inputor.caret("offset",this.pos-1),t=document.selection?0:2,{left:e.left,top:e.top,bottom:e.top+e.height+t}},i.prototype.insert=function(e){var t,n,i,o,a;return t=this.$inputor,e=""+e,i=t.val(),n=this.get_opt("display_flag")?0:this.key.length,o=i.slice(0,(this.query.head_pos||0)-n),a=""+o+e+" "+i.slice(this.query.end_pos||0),t.val(a),t.caret("pos",o.length+e.length+1),t.change()},i.prototype.render_view=function(e){var t;return t=this.get_opt("search_key"),e=this.callbacks("sorter").call(this,this.query.text,e.slice(0,1001),t),this.view.render(e.slice(0,this.get_opt("limit")))},i.prototype.look_up=function(){var e,n;if(e=this.catch_query())return n=function(e){return e&&e.length>0?this.render_view(e):this.view.hide()},this.model.query(e.text,t.proxy(n,this)),e},i}(),c=function(){function e(e){this.context=e,this.key=this.context.key}var n;return n={},e.prototype.saved=function(){return this.fetch()>0},e.prototype.query=function(e,t){var n,i,o;return n=this.fetch(),i=this.context.get_opt("search_key"),t(n=this.context.callbacks("filter").call(this.context,e,n,i)),n&&n.length>0?void 0:null!=(o=this.context.callbacks("remote_filter"))?o.call(this.context,e,t):void 0},e.prototype.fetch=function(){return n[this.key]||[]},e.prototype.save=function(e){return n[this.key]=this.context.callbacks("before_save").call(this.context,e||[])},e.prototype.load=function(e){return!this.saved()&&e?this._load(e):void 0},e.prototype.reload=function(e){return this._load(e)},e.prototype._load=function(e){var n=this;return"string"==typeof e?t.ajax(e,{dataType:"json"}).done(function(e){return n.save(e)}):this.save(e)},e}(),u=function(){function e(e){this.context=e,this.key=this.context.key,this.id=this.context.get_opt("alias")||"at-view-"+this.key.charCodeAt(0),this.$el=t("<div id='"+this.id+"' class='atwho-view'><ul id='"+this.id+"-ul' class='atwho-view-url'></ul></div>"),this.timeout_id=null,this.context.$el.append(this.$el),this.bind_event()}return e.prototype.bind_event=function(){var e,n=this;return e=this.$el.find("ul"),e.on("mouseenter.view","li",function(n){return e.find(".cur").removeClass("cur"),t(n.currentTarget).addClass("cur")}).on("click",function(e){return n.choose(),e.preventDefault()})},e.prototype.visible=function(){return this.$el.is(":visible")},e.prototype.choose=function(){var e;return e=this.$el.find(".cur"),this.context.insert(this.context.callbacks("before_insert").call(this.context,e.data("value"),e)),this.context.trigger("inserted",[e]),this.hide()},e.prototype.reposition=function(){var e,n;return n=this.context.rect(),n.bottom+this.$el.height()-t(window).scrollTop()>t(window).height()&&(n.bottom=n.top-this.$el.height()),e={left:n.left,top:n.bottom},this.$el.offset(e),this.context.trigger("reposition",[e])},e.prototype.next=function(){var e,t;return e=this.$el.find(".cur").removeClass("cur"),t=e.next(),t.length||(t=this.$el.find("li:first")),t.addClass("cur")},e.prototype.prev=function(){var e,t;return e=this.$el.find(".cur").removeClass("cur"),t=e.prev(),t.length||(t=this.$el.find("li:last")),t.addClass("cur")},e.prototype.show=function(){return this.visible()||this.$el.show(),this.reposition()},e.prototype.hide=function(e){var t,n=this;return isNaN(e&&this.visible())?this.$el.hide():(t=function(){return n.hide()},clearTimeout(this.timeout_id),this.timeout_id=setTimeout(t,e))},e.prototype.render=function(e){var n,i,o,a,s,l,c;if(!t.isArray(e||0>=e.length))return this.hide(),void 0;for(this.$el.find("ul").empty(),i=this.$el.find("ul"),s=this.context.get_opt("tpl",r),l=0,c=e.length;c>l;l++)o=e[l],a=this.context.callbacks("tpl_eval").call(this.context,s,o),n=t(this.context.callbacks("highlighter").call(this.context,a,this.context.query.text)),n.data("atwho-info",o),i.append(n);return this.show(),i.find("li:first").addClass("cur")},e}(),l={DOWN:40,UP:38,ESC:27,TAB:9,ENTER:13},s={before_save:function(e){var n,i,o,a;if(!t.isArray(e))return e;for(a=[],i=0,o=e.length;o>i;i++)n=e[i],t.isPlainObject(n)?a.push(n):a.push({name:n});return a},matcher:function(e,t){var n,i;return e="(?:^|\\s)"+e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&"),i=RegExp(e+"([A-Za-z0-9_+-]*)$|"+e+"([^\\x00-\\xff]*)$","gi"),n=i.exec(t),n?n[2]||n[1]:null},filter:function(e,t,n){var i,o,a,s;for(s=[],o=0,a=t.length;a>o;o++)i=t[o],~i[n].toLowerCase().indexOf(e)&&s.push(i);return s},remote_filter:null,sorter:function(e,t,n){var i,o,a,s;if(!e)return t;for(s=[],o=0,a=t.length;a>o;o++)i=t[o],i.atwho_order=i[n].toLowerCase().indexOf(e),i.atwho_order>-1&&s.push(i);return s.sort(function(e,t){return e.atwho_order-t.atwho_order})},tpl_eval:function(e,t){try{return e.replace(/\$\{([^\}]*)\}/g,function(e,n){return t[n]})}catch(n){return""}},highlighter:function(e,t){var n;return t?(n=RegExp(">\\s*(\\w*)("+t.replace("+","\\+")+")(\\w*)\\s*<","ig"),e.replace(n,function(e,t,n,i){return"> "+t+"<strong>"+n+"</strong>"+i+" <"})):e},before_insert:function(e){return e}},r="<li data-value='${name}'>${name}</li>",i={init:function(e){var n,i;return i=(n=t(this)).data("atwho"),i||n.data("atwho",i=new o(this)),i.reg(e.at,e)},load:function(e,t){var n;return(n=this.controller(e))?n.model.load(t):void 0},run:function(){return this.dispatch()}},n=t("<div id='atwho-container'></div>"),t.fn.atwho=function(e){var o;return o=arguments,t("body").append(n),this.filter("textarea, input").each(function(){var n;return"object"!=typeof e&&e?i[e]?(n=t(this).data("atwho"))?i[e].apply(n,Array.prototype.slice.call(o,1)):void 0:t.error("Method "+e+" does not exist on jQuery.caret"):i.init.apply(this,o)})},t.fn.atwho["default"]={at:void 0,alias:void 0,data:null,tpl:r,callbacks:s,search_key:"name",limit:5,max_len:20,display_flag:!0,display_timeout:300}})}.call(this),function(e){function t(e,t){var n=typeof e[t];return"function"===n||!("object"!=n||!e[t])||"unknown"==n}function n(e,t,n){return 0>t&&(t+=e.value.length),n===void 0&&(n=t),0>n&&(n+=e.value.length),{start:t,end:n}}function i(){return"object"==typeof document.body&&document.body?document.body:document.getElementsByTagName("body")[0]}var o,a,s,r,l,c,u,h,d;e(document).ready(function(){function p(e,t){return function(){var n=this.jquery?this[0]:this,i=n.nodeName.toLowerCase();return 1!=n.nodeType||"textarea"!=i&&("input"!=i||"text"!=n.type)||(n=[n].concat(Array.prototype.slice.call(arguments)),n=e.apply(this,n),t)?t?this:void 0:n}}var f=document.createElement("textarea");if(i().appendChild(f),f.selectionStart!==void 0&&f.selectionEnd!==void 0)o=function(e){return{start:e.selectionStart,end:e.selectionEnd,length:e.selectionEnd-e.selectionStart,text:e.value.slice(e.selectionStart,e.selectionEnd)}},a=function(e,t,i){t=n(e,t,i),e.selectionStart=t.start,e.selectionEnd=t.end},d=function(e,t){t?e.selectionEnd=e.selectionStart:e.selectionStart=e.selectionEnd};else{if(!(t(f,"createTextRange")&&"object"==typeof document.selection&&document.selection&&t(document.selection,"createRange")))return i().removeChild(f),window.console&&window.console.log&&window.console.log("TextInputs module for Rangy not supported in your browser. Reason: No means of finding text input caret position"),void 0;o=function(e){var t,n,i,o=0,a=0;return(i=document.selection.createRange())&&i.parentElement()==e&&(n=e.value.length,t=e.value.replace(/\r\n/g,"\n"),a=e.createTextRange(),a.moveToBookmark(i.getBookmark()),i=e.createTextRange(),i.collapse(!1),a.compareEndPoints("StartToEnd",i)>-1?o=a=n:(o=-a.moveStart("character",-n),o+=t.slice(0,o).split("\n").length-1,a.compareEndPoints("EndToEnd",i)>-1?a=n:(a=-a.moveEnd("character",-n),a+=t.slice(0,a).split("\n").length-1))),{start:o,end:a,length:a-o,text:e.value.slice(o,a)}
},a=function(e,t,i){t=n(e,t,i),i=e.createTextRange();var o=t.start-(e.value.slice(0,t.start).split("\r\n").length-1);i.collapse(!0),t.start==t.end?i.move("character",o):(i.moveEnd("character",t.end-(e.value.slice(0,t.end).split("\r\n").length-1)),i.moveStart("character",o)),i.select()},d=function(e,t){var n=document.selection.createRange();n.collapse(t),n.select()}}i().removeChild(f),r=function(e,t,n,i){var o;t!=n&&(o=e.value,e.value=o.slice(0,t)+o.slice(n)),i&&a(e,t,t)},s=function(e){var t=o(e);r(e,t.start,t.end,!0)},h=function(e){var t,n=o(e);return n.start!=n.end&&(t=e.value,e.value=t.slice(0,n.start)+t.slice(n.end)),a(e,n.start,n.start),n.text},l=function(e,t,n,i){var o=e.value;e.value=o.slice(0,n)+t+o.slice(n),i&&(t=n+t.length,a(e,t,t))},c=function(e,t){var n=o(e),i=e.value;e.value=i.slice(0,n.start)+t+i.slice(n.end),n=n.start+t.length,a(e,n,n)},u=function(e,t,n){var i=o(e),s=e.value;e.value=s.slice(0,i.start)+t+i.text+n+s.slice(i.end),t=i.start+t.length,a(e,t,t+i.length)},e.fn.extend({getSelection:p(o,!1),setSelection:p(a,!0),collapseSelection:p(d,!0),deleteSelectedText:p(s,!0),deleteText:p(r,!0),extractSelectedText:p(h,!1),insertText:p(l,!0),replaceSelectedText:p(c,!0),surroundSelectedText:p(u,!0)})})}(jQuery),define("jquery.textinputs",["jquery"],function(){}),define("modules/view/common/postbox_view",["underscore","backbone","handlebars","backbone.marionette","marionette_handlebars","hbs!modules/template/common/postbox","modules/common/config","modules/common/utility","modules/common/session_user","modules/common/local_storage","modules/template/helpers/general_helpers","jquery.atwho","jquery.textinputs"],function(e,t,n,i,o,a,s,r,l,c){var u=/https?:\/\/([a-z0-9]([a-z0-9_\-]*[a-z0-9])?\.)*([a-z0-9]([a-z0-9\-]*[a-z0-9])?\.)[a-z]{2,4}(:[0-9]{1,4})?(\$|(\?|\/)\S+)?/gi,h={post_btn:'input[name="post"]',body:'[name="body"]',body_txtarea:"textarea",char_counter:".postbox-charcount",field_callback:'input[name="callback"]',postbox:".postbox",insert_emoticons:".insert-emoticon",insert_username:".insert-username",insert_hashtag:".insert-hashtag",insert_photo:".postbox-media-upload",insert_photo_close:".postbox-media-wrapper > .close",insert_photo_wrapper:".postbox-media-wrapper",insert_photo_media:".postbox-media",show_emoticons:".postbox-emoticons",insert_emoticon:".postbox-emoticons > UL > LI > A",post_to_twitter:".post-to-twitter",post_to_facebook:".post-to-facebook",post_to_twitter_input:'input[name="post_to_twitter"]',post_to_facebook_input:'input[name="post_to_facebook"]',postbox_collapsed:".postbox-collapsed",set_reply_permission:".set-reply-permission",set_reply_permission_input:'input[name="reply_permission"]'},d={cacheFollowings:[],cacheHashTags:[],cacheUrls:[],collapsible:!0},p={};p["click "+h.postbox]="stopPropagation",p["click "+h.post_btn]="send_post",p["focus "+h.body_txtarea]="expand",p["click "+h.body_txtarea]="focusPostBox",p["keypress "+h.body_txtarea]="update_char_count",p["keyup "+h.body_txtarea]="update_char_count",p["keydown "+h.body_txtarea]="update_char_count",p["paste "+h.body_txtarea]="update_char_count",p["mouseover "+h.body_txtarea]="update_char_count",p["click "+h.insert_emoticons]="insert_emoticons",p["click "+h.insert_username]="insert_username",p["click "+h.insert_hashtag]="insert_hashtag",p["change "+h.insert_photo]="insert_photo",p["click "+h.insert_photo_close]="insert_photo_close",p["click "+h.insert_emoticon]="insert_emoticon",p["click "+h.post_to_twitter]="post_to_twitter",p["click "+h.post_to_facebook]="post_to_facebook",p["click "+h.set_reply_permission]="set_reply_permission";var f={group:"!"},m=i.ItemView.extend({trigger_char:f,initialize:function(e){this.settings=$.extend({},d),this.settings.collapsible=e.collapsible;var t=this,n=t.$el;$(document).click(function(){r.is_logged_in()&&($(h.show_emoticons,n).is(":visible")&&($(h.show_emoticons,n).hide(),$(h.insert_emoticons,n).parent("li").removeClass("active")),t.settings.collapsible&&($(h.postbox,n).hasClass(h.postbox_collapsed.substr(1))||0===$(h.body_txtarea,n).val().length&&0===$(h.insert_photo,n).val().length&&($(h.body_txtarea,this.$el).blur(),$(h.postbox,n).addClass(h.postbox_collapsed.substr(1)))))})},focusPostBox:function(){$(h.body_txtarea,this.$el).focus()},readyPostBox:function(t){if(0===$('input[name="root_post_id"]',this.$el).length){var n=this.$el,i="";i=e.isUndefined(t.get("root_post"))?t.get("id"):t.get("root_post").id;var o=$("<input>").attr("name","root_post_id").attr("type","hidden").val(i),a=$("<input>").attr("name","parent_post_id").attr("type","hidden").val(t.get("id")),s=$("<input>").attr("name","reply_to_root").attr("type","hidden").val("1");if($(".postbox form",n).append(o),$(".postbox form",n).append(a),$(".postbox form",n).append(s),$('textarea[name="body"]',n).attr("placeholder",r.translate("homefeed|postbox_any_thoughts")),$(".postbox-twitter-field",n).hide(),$(".postbox-facebook-field",n).hide(),$('input[name="post_to_twitter"]',n).val("0"),$('input[name="post_to_facebook"]',n).val("0"),$('input[name="reply_permission"]',n).val("0"),$('input[name="originality"]',n).val("2"),$(".set-reply-permission",n).removeClass("ico-lock").addClass('ico-unlock"'),!t.get("group")){var l=$("<input>").attr("name","show_reply_in_feed").attr("type","checkbox").val("1").on("click",function(){c.set("_also_post_miniblog",$('input[name="show_reply_in_feed"]',n).is(":checked"))});c.hasKey("_also_post_miniblog")?l.prop("checked",c.get("_also_post_miniblog")):c.set("_also_post_miniblog",!0),$(".reply_fields",n).append(l).append(" "+r.translate("homefeed|postbox_also_to_miniblog")).show()}}},events:p,reset:function(){$(h.body_txtarea,this.$el).val(""),$(h.post_btn,this.$el).prop("disabled",!1),$(h.char_counter,this.$el).text(variable.characters_count.max),this.insert_photo_close(),$(h.set_reply_permission_input,this.$el).val("0"),$(h.set_reply_permission,this.$el).removeClass("ico-lock").addClass("ico-unlock")},onRender:function(){var e=this;$(h.body_txtarea,this.$el).atwho({at:"@",limit:7,search_key:"username",tpl:'<li data-value="${username}"><img src="'+r.get_display_picture_url("${username}","${display_picture_type}",24,24)+'" width="24" height="24" />&nbsp;${username}</li>',data:s.urls.autocomplete_users,callbacks:{before_save:function(e){return e.data.users}}}).atwho({at:"!",limit:7,tpl:'<li data-value="${id}">${name}</li>',data:s.urls.autocomplete_groups,callbacks:{before_save:function(e){return e.data}}}).atwho({at:":",limit:7,tpl:'<li data-value="${hotkey}"><img src="${url}" width="16" height="16" />&nbsp;${name}</li>',search_key:"hotkey",data:variable.emoticons}),$(window).resize(function(){e.resizePostBox()}),e.resizePostBox(),this.options&&"reply"===this.options.mode&&this.options.parent_post&&this.readyPostBox(this.options.parent_post),this.settings.collapsible||this.expand()},resizePostBox:function(){},send_post:function(){var e=this,t=this.$el,n="",i="",o=$(h.post_btn,t);$('input[name="root_post_id"]',t).length>0&&(n=$('input[name="root_post_id"]',t).val()),$('input[name="parent_post_id"]',t).length>0&&(i=$('input[name="parent_post_id"]',t).val());var a=$('input[name="originality"]',t).val();isNaN(a)&&(a=1);var l=0;$('input[name="reply_to_root"]',t).is(":checked")&&(l=1);var c=0;$('input[name="show_reply_in_feed"]',t).is(":checked")&&(c=1);var u=parseInt($('input[name="post_to_twitter"]',t).val(),10);(isNaN(u)||1!=u)&&(u=0);var d=parseInt($('input[name="post_to_facebook"]',t).val(),10);(isNaN(d)||1!=d)&&(d=0);var p=parseInt($('input[name="reply_permission"]',t).val(),10);isNaN(p)&&(p=0);var m=jQuery.trim($('[name="body"]',t).val()),g=jQuery.trim($('[name="media"]',t).val()),_=parseInt($('input[name="group_id"]',t).val(),10);if((isNaN(_)||1>_)&&(_=0),(1==a||2==a)&&""===g&&""===m)return r.show_error(r.translate("homefeed|postbox_error_body_empty")),void 0;o.prop("disabled",!0);var v=function(t){var n,i=r.parse_ajax_response(t);if(i.error)return r.show_error(i.error),void 0;n=t.group&&t.group.id?t.group.id:0;var o=require("modules/mig33_app");if(n)$(window).trigger("resize"),e.reset(),_&&(o.vent.trigger(r.format(o.ApplicationEvents.GROUP_POST_ADDED,n),t),$(h.body_txtarea,e.$el).val(f.group+n+" "));else{if("reply"==t.originality_text){var a=t.parent_post.id;o.vent.trigger("reply-added-"+a,t)}else o.vent.trigger(o.ApplicationEvents.POST_ADDED,t),$(window).trigger("resize");e.reset()}var s=$("#sharebox-dropdown");s.hasClass("open")&&$("a.dropdown-toggle",s).dropdown("toggle")};return v._name=r.set_global_function(v),1==a||2==a?($(h.field_callback,t).val(v._name),$("form",t).submit(),void 0):($.ajax({type:"post",cache:!1,dataType:"json",url:s.urls.miniblog_api_url+"/post",data:{originality:a,reply_to_root:l,show_reply_in_feed:c,root_post_id:n,parent_post_id:i,post_to_twitter:u,post_to_facebook:d,reply_permission:p,body:m},success:v,error:function(e,t,n){r.show_error(n)},complete:function(){o.prop("disabled",!1)}}),void 0)},update_char_count:function(){var e,t=$(h.body_txtarea,this.$el).val(),n=t.length,i=t.match(u),o=0;null!==i&&($.each(i,function(e,t){o+=t.length}),o-=i.length*variable.characters_count.link),e=variable.characters_count.max-n+o,0>e?($(h.post_btn,this.$el).prop("disabled",!0),$(h.postbox,this.$el).addClass("error")):($(h.post_btn,this.$el).prop("disabled",!1),$(h.postbox,this.$el).removeClass("error")),$(h.char_counter,this.$el).text(e)},insert_emoticons:function(){_gaq.push(["_trackEvent","Clicks","Web","PostBox - Insert Emoticon"]),$(h.show_emoticons,this.$el).show(),$(h.insert_emoticons,this.$el).parent("li").addClass("active")},insert_emoticon:function(e){_gaq.push(["_trackEvent","Clicks","Web","PostBox - Inserted Emoticon"]);var t=$(h.body,this.$el).getSelection().start;$(h.body,this.$el).focus().insertText($(e.currentTarget,this.$el).data("emoticon"),t),$(h.show_emoticons,this.$el).fadeToggle("fast"),$(h.insert_emoticons,this.$el).parent("li").removeClass("active")},insert_username:function(){_gaq.push(["_trackEvent","Clicks","Web","PostBox - Insert Username"]);var e=$(h.body_txtarea,this.$el),t=$(e).getSelection().start;$(e).focus().insertText("@",t,!0)},insert_hashtag:function(){_gaq.push(["_trackEvent","Clicks","Web","PostBox - Insert Hashtag"]);var e=$(h.body_txtarea,this.$el),t=$(e).getSelection().start;$(e).focus().insertText(r.translate("homefeed|postbox_insert_hashtag"),t,!0).setSelection(t+1,$(e).val().length+r.translate("homefeed|postbox_insert_hashtag").length)},insert_photo:function(){_gaq.push(["_trackEvent","Clicks","Web","PostBox - Insert Photo"]);var e=$(h.insert_photo_wrapper,this.$el),t=$(h.insert_photo,this.$el).val().replace(/^C:\\fakepath\\/i,"");$(h.insert_photo_media,e).text(r.translate("homefeed|postbox_media_attached",t)),$(e).show()},insert_photo_close:function(){var e=$(h.insert_photo_wrapper,this.$el);$(h.insert_photo_media,e).text(""),$(e).hide(),$(h.insert_photo,this.$el).replaceWith('<input type="file" name="media" class="'+h.insert_photo.substr(1)+'" />')},post_to_twitter:function(){$(h.post_to_twitter,this.$el).toggleClass("ico-twitter ico-twitter-off"),$(h.post_to_twitter,this.$el).hasClass("ico-twitter-off")?$(h.post_to_twitter_input,this.$el).val("0"):$(h.post_to_twitter_input,this.$el).val("1")},post_to_facebook:function(){$(h.post_to_facebook,this.$el).toggleClass("ico-facebook ico-facebook-off"),$(h.post_to_facebook,this.$el).hasClass("ico-facebook-off")?$(h.post_to_facebook_input,this.$el).val("0"):$(h.post_to_facebook_input,this.$el).val("1")},set_reply_permission:function(){$(h.set_reply_permission,this.$el).toggleClass("ico-unlock ico-lock"),$(h.set_reply_permission,this.$el).hasClass("ico-unlock")?$(h.set_reply_permission_input,this.$el).val("0"):$(h.set_reply_permission_input,this.$el).val("1")},expand:function(){this.settings.collapsible&&$(h.postbox,this.$el).removeClass(h.postbox_collapsed.substr(1))},stopPropagation:function(e){e.stopPropagation()},setContent:function(e){e&&$('[name="body"]',this.$el).val(e)},template:function(){return a({avatar_url:r.is_logged_in()?r.get_display_picture_url(session_user.username):"",session_user:session_user,variables:variable,trigger_char:f})}});return m}),define("modules/view/common/header_layout",["underscore","jquery","backbone","handlebars","backbone.marionette","marionette_handlebars","hbs!modules/template/common/header-layout","modules/model/migalert/migalert_collection","modules/view/migalert/migalert_collection_view","modules/view/common/postbox_view","modules/common/config","modules/common/utility","modules/chat/views/add_participant_menu","modules/chat/models/chat","modules/template/helpers/general_helpers"],function(e,t,n,i,o,a,s,r,l,c,u,h,d,p){var f=p.ChatStore,m=n.Marionette.Layout.extend({template:{type:"handlebars",template:s},regions:{migalerts:"#migalerts",sharebox:"#sharebox"},className:"navbar-inner",events:{"click .search-form-submit":"search",'keyup input[name="search-form-query"]':"searchEnter","click .tearaway-btn":"trigger_tearaway","click .trigger-chat-btn":"trigger_create_chat"},counterMigalerts:0,initialize:function(){e.bindAll(this),this.isTearAway=!1},onRender:function(){var e=this,n=require("modules/mig33_app"),i=new r;i.fetch(),n.vent.on(n.ApplicationEvents.NEW_MIGALERT,function(){i.fetch()});var o=new l({collection:i});this.migalerts.show(o),i.on("fetch:done",function(t){h.show_document_title("",t.unread),0===t.unread?e.resetAndHideMigalertCount():e.incrementAndShowMigalertCount(t.unread),t.alerts&&t.alerts.length<u.migalerts.limit?o.hideNext():o.showNext(),1===i.getPage()?o.hidePrevious():o.showPrevious()});var a=new c({collapsible:!1});this.sharebox.show(a),t(".postbox",t("#sharebox",this.$el)).removeClass("postbox-collapsed"),t(".trigger-chat-btn",this.$el).on("ContactsSelected",function(e){var t=e.contacts;f.startGroupChat(t)})},resetAndHideMigalertCount:function(){this.counterMigalerts=0,t(".migalerts-unread-count",this.$el).text("").css("visibility","hidden")},incrementAndShowMigalertCount:function(e){this.counterMigalerts+=e,t(".migalerts-unread-count",this.$el).text(this.counterMigalerts).css("visibility","visible")},searchEnter:function(e){13==e.keyCode&&this.search(e)},search:function(){var e=require("modules/mig33_app");e.navigate_to(document.location.protocol+"//"+document.location.host+e.root+"search?query="+encodeURIComponent(t('input[name="search-form-query"]',this.$el).val()))},trigger_tearaway:function(e){e.preventDefault(),this.isTearAway=!this.isTearAway;var n=require("modules/mig33_app");n.vent.trigger(n.ApplicationEvents.TOGGLE_TEARAWAY,this.isTearAway),t("> i",e.currentTarget).toggleClass("ico-dock-view ico-float-view"),this.isTearAway?t(e.currentTarget).attr("title",h.translate("header|dock_view")):t(e.currentTarget).attr("title",h.translate("header|float_view"))},trigger_create_chat:function(e){e.preventDefault(),d.show(t(".trigger-chat-btn",this.$el),null,e,!0,h.translate("chat|start_a_chat"))}});return m}),function(e,t,n,i){var o=n("html"),a=n(e),s=n(t),r=n.fancybox=function(){r.open.apply(this,arguments)},l=navigator.userAgent.match(/msie/i),c=null,u=t.createTouch!==i,h=function(e){return e&&e.hasOwnProperty&&e instanceof n},d=function(e){return e&&"string"===n.type(e)},p=function(e){return d(e)&&e.indexOf("%")>0},f=function(e){return e&&!(e.style.overflow&&"hidden"===e.style.overflow)&&(e.clientWidth&&e.scrollWidth>e.clientWidth||e.clientHeight&&e.scrollHeight>e.clientHeight)},m=function(e,t){var n=parseInt(e,10)||0;return t&&p(e)&&(n=r.getViewport()[t]/100*n),Math.ceil(n)},g=function(e,t){return m(e,t)+"px"};n.extend(r,{version:"2.1.5",defaults:{padding:15,margin:20,width:800,height:600,minWidth:100,minHeight:100,maxWidth:9999,maxHeight:9999,pixelRatio:1,autoSize:!0,autoHeight:!1,autoWidth:!1,autoResize:!0,autoCenter:!u,fitToView:!0,aspectRatio:!1,topRatio:.5,leftRatio:.5,scrolling:"auto",wrapCSS:"",arrows:!0,closeBtn:!0,closeClick:!1,nextClick:!1,mouseWheel:!0,autoPlay:!1,playSpeed:3e3,preload:3,modal:!1,loop:!0,ajax:{dataType:"html",headers:{"X-fancyBox":!0}},iframe:{scrolling:"auto",preload:!0},swf:{wmode:"transparent",allowfullscreen:"true",allowscriptaccess:"always"},keys:{next:{13:"left",34:"up",39:"left",40:"up"},prev:{8:"right",33:"down",37:"right",38:"down"},close:[27],play:[32],toggle:[70]},direction:{next:"left",prev:"right"},scrollOutside:!0,index:0,type:null,href:null,content:null,title:null,tpl:{wrap:'<div class="fancybox-wrap" tabIndex="-1"><div class="fancybox-skin"><div class="fancybox-outer"><div class="fancybox-inner"></div></div></div></div>',image:'<img class="fancybox-image" src="{href}" alt="" />',iframe:'<iframe id="fancybox-frame{rnd}" name="fancybox-frame{rnd}" class="fancybox-iframe" frameborder="0" vspace="0" hspace="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen'+(l?' allowtransparency="true"':"")+"></iframe>",error:'<p class="fancybox-error">The requested content cannot be loaded.<br/>Please try again later.</p>',closeBtn:'<a title="Close" class="fancybox-item fancybox-close" href="javascript:;"></a>',next:'<a title="Next" class="fancybox-nav fancybox-next" href="javascript:;"><span></span></a>',prev:'<a title="Previous" class="fancybox-nav fancybox-prev" href="javascript:;"><span></span></a>'},openEffect:"fade",openSpeed:250,openEasing:"swing",openOpacity:!0,openMethod:"zoomIn",closeEffect:"fade",closeSpeed:250,closeEasing:"swing",closeOpacity:!0,closeMethod:"zoomOut",nextEffect:"elastic",nextSpeed:250,nextEasing:"swing",nextMethod:"changeIn",prevEffect:"elastic",prevSpeed:250,prevEasing:"swing",prevMethod:"changeOut",helpers:{overlay:!0,title:!0},onCancel:n.noop,beforeLoad:n.noop,afterLoad:n.noop,beforeShow:n.noop,afterShow:n.noop,beforeChange:n.noop,beforeClose:n.noop,afterClose:n.noop},group:{},opts:{},previous:null,coming:null,current:null,isActive:!1,isOpen:!1,isOpened:!1,wrap:null,skin:null,outer:null,inner:null,player:{timer:null,isActive:!1},ajaxLoad:null,imgPreload:null,transitions:{},helpers:{},open:function(e,t){return e&&(n.isPlainObject(t)||(t={}),!1!==r.close(!0))?(n.isArray(e)||(e=h(e)?n(e).get():[e]),n.each(e,function(o,a){var s,l,c,u,p,f,m,g={};"object"===n.type(a)&&(a.nodeType&&(a=n(a)),h(a)?(g={href:a.data("fancybox-href")||a.attr("href"),title:a.data("fancybox-title")||a.attr("title"),isDom:!0,element:a},n.metadata&&n.extend(!0,g,a.metadata())):g=a),s=t.href||g.href||(d(a)?a:null),l=t.title!==i?t.title:g.title||"",c=t.content||g.content,u=c?"html":t.type||g.type,!u&&g.isDom&&(u=a.data("fancybox-type"),u||(p=a.prop("class").match(/fancybox\.(\w+)/),u=p?p[1]:null)),d(s)&&(u||(r.isImage(s)?u="image":r.isSWF(s)?u="swf":"#"===s.charAt(0)?u="inline":d(a)&&(u="html",c=a)),"ajax"===u&&(f=s.split(/\s+/,2),s=f.shift(),m=f.shift())),c||("inline"===u?s?c=n(d(s)?s.replace(/.*(?=#[^\s]+$)/,""):s):g.isDom&&(c=a):"html"===u?c=s:u||s||!g.isDom||(u="inline",c=a)),n.extend(g,{href:s,type:u,content:c,title:l,selector:m}),e[o]=g}),r.opts=n.extend(!0,{},r.defaults,t),t.keys!==i&&(r.opts.keys=t.keys?n.extend({},r.defaults.keys,t.keys):!1),r.group=e,r._start(r.opts.index)):i},cancel:function(){var e=r.coming;e&&!1!==r.trigger("onCancel")&&(r.hideLoading(),r.ajaxLoad&&r.ajaxLoad.abort(),r.ajaxLoad=null,r.imgPreload&&(r.imgPreload.onload=r.imgPreload.onerror=null),e.wrap&&e.wrap.stop(!0,!0).trigger("onReset").remove(),r.coming=null,r.current||r._afterZoomOut(e))},close:function(e){r.cancel(),!1!==r.trigger("beforeClose")&&(r.unbindEvents(),r.isActive&&(r.isOpen&&e!==!0?(r.isOpen=r.isOpened=!1,r.isClosing=!0,n(".fancybox-item, .fancybox-nav").remove(),r.wrap.stop(!0,!0).removeClass("fancybox-opened"),r.transitions[r.current.closeMethod]()):(n(".fancybox-wrap").stop(!0).trigger("onReset").remove(),r._afterZoomOut())))},play:function(e){var t=function(){clearTimeout(r.player.timer)},n=function(){t(),r.current&&r.player.isActive&&(r.player.timer=setTimeout(r.next,r.current.playSpeed))},i=function(){t(),s.unbind(".player"),r.player.isActive=!1,r.trigger("onPlayEnd")},o=function(){r.current&&(r.current.loop||r.current.index<r.group.length-1)&&(r.player.isActive=!0,s.bind({"onCancel.player beforeClose.player":i,"onUpdate.player":n,"beforeLoad.player":t}),n(),r.trigger("onPlayStart"))};e===!0||!r.player.isActive&&e!==!1?o():i()},next:function(e){var t=r.current;t&&(d(e)||(e=t.direction.next),r.jumpto(t.index+1,e,"next"))},prev:function(e){var t=r.current;t&&(d(e)||(e=t.direction.prev),r.jumpto(t.index-1,e,"prev"))},jumpto:function(e,t,n){var o=r.current;o&&(e=m(e),r.direction=t||o.direction[e>=o.index?"next":"prev"],r.router=n||"jumpto",o.loop&&(0>e&&(e=o.group.length+e%o.group.length),e%=o.group.length),o.group[e]!==i&&(r.cancel(),r._start(e)))},reposition:function(e,t){var i,o=r.current,a=o?o.wrap:null;a&&(i=r._getPosition(t),e&&"scroll"===e.type?(delete i.position,a.stop(!0,!0).animate(i,200)):(a.css(i),o.pos=n.extend({},o.dim,i)))},update:function(e){var t=e&&e.type,n=!t||"orientationchange"===t;n&&(clearTimeout(c),c=null),r.isOpen&&!c&&(c=setTimeout(function(){var i=r.current;i&&!r.isClosing&&(r.wrap.removeClass("fancybox-tmp"),(n||"load"===t||"resize"===t&&i.autoResize)&&r._setDimension(),"scroll"===t&&i.canShrink||r.reposition(e),r.trigger("onUpdate"),c=null)},n&&!u?0:300))},toggle:function(e){r.isOpen&&(r.current.fitToView="boolean"===n.type(e)?e:!r.current.fitToView,u&&(r.wrap.removeAttr("style").addClass("fancybox-tmp"),r.trigger("onUpdate")),r.update())},hideLoading:function(){s.unbind(".loading"),n("#fancybox-loading").remove()},showLoading:function(){var e,t;r.hideLoading(),e=n('<div id="fancybox-loading"><div></div></div>').click(r.cancel).appendTo("body"),s.bind("keydown.loading",function(e){27===(e.which||e.keyCode)&&(e.preventDefault(),r.cancel())}),r.defaults.fixed||(t=r.getViewport(),e.css({position:"absolute",top:.5*t.h+t.y,left:.5*t.w+t.x}))},getViewport:function(){var t=r.current&&r.current.locked||!1,n={x:a.scrollLeft(),y:a.scrollTop()};return t?(n.w=t[0].clientWidth,n.h=t[0].clientHeight):(n.w=u&&e.innerWidth?e.innerWidth:a.width(),n.h=u&&e.innerHeight?e.innerHeight:a.height()),n},unbindEvents:function(){r.wrap&&h(r.wrap)&&r.wrap.unbind(".fb"),s.unbind(".fb"),a.unbind(".fb")},bindEvents:function(){var e,t=r.current;t&&(a.bind("orientationchange.fb"+(u?"":" resize.fb")+(t.autoCenter&&!t.locked?" scroll.fb":""),r.update),e=t.keys,e&&s.bind("keydown.fb",function(o){var a=o.which||o.keyCode,s=o.target||o.srcElement;return 27===a&&r.coming?!1:(o.ctrlKey||o.altKey||o.shiftKey||o.metaKey||s&&(s.type||n(s).is("[contenteditable]"))||n.each(e,function(e,s){return t.group.length>1&&s[a]!==i?(r[e](s[a]),o.preventDefault(),!1):n.inArray(a,s)>-1?(r[e](),o.preventDefault(),!1):i}),i)}),n.fn.mousewheel&&t.mouseWheel&&r.wrap.bind("mousewheel.fb",function(e,i,o,a){for(var s=e.target||null,l=n(s),c=!1;l.length&&!(c||l.is(".fancybox-skin")||l.is(".fancybox-wrap"));)c=f(l[0]),l=n(l).parent();0===i||c||r.group.length>1&&!t.canShrink&&(a>0||o>0?r.prev(a>0?"down":"left"):(0>a||0>o)&&r.next(0>a?"up":"right"),e.preventDefault())}))},trigger:function(e,t){var i,o=t||r.coming||r.current;if(o){if(n.isFunction(o[e])&&(i=o[e].apply(o,Array.prototype.slice.call(arguments,1))),i===!1)return!1;o.helpers&&n.each(o.helpers,function(t,i){i&&r.helpers[t]&&n.isFunction(r.helpers[t][e])&&r.helpers[t][e](n.extend(!0,{},r.helpers[t].defaults,i),o)}),s.trigger(e)}},isImage:function(e){return d(e)&&e.match(/(^data:image\/.*,)|(\.(jp(e|g|eg)|gif|png|bmp|webp|svg)((\?|#).*)?$)/i)},isSWF:function(e){return d(e)&&e.match(/\.(swf)((\?|#).*)?$/i)},_start:function(e){var t,o,a,s,l,c={};if(e=m(e),t=r.group[e]||null,!t)return!1;if(c=n.extend(!0,{},r.opts,t),s=c.margin,l=c.padding,"number"===n.type(s)&&(c.margin=[s,s,s,s]),"number"===n.type(l)&&(c.padding=[l,l,l,l]),c.modal&&n.extend(!0,c,{closeBtn:!1,closeClick:!1,nextClick:!1,arrows:!1,mouseWheel:!1,keys:null,helpers:{overlay:{closeClick:!1}}}),c.autoSize&&(c.autoWidth=c.autoHeight=!0),"auto"===c.width&&(c.autoWidth=!0),"auto"===c.height&&(c.autoHeight=!0),c.group=r.group,c.index=e,r.coming=c,!1===r.trigger("beforeLoad"))return r.coming=null,i;if(a=c.type,o=c.href,!a)return r.coming=null,r.current&&r.router&&"jumpto"!==r.router?(r.current.index=e,r[r.router](r.direction)):!1;if(r.isActive=!0,("image"===a||"swf"===a)&&(c.autoHeight=c.autoWidth=!1,c.scrolling="visible"),"image"===a&&(c.aspectRatio=!0),"iframe"===a&&u&&(c.scrolling="scroll"),c.wrap=n(c.tpl.wrap).addClass("fancybox-"+(u?"mobile":"desktop")+" fancybox-type-"+a+" fancybox-tmp "+c.wrapCSS).appendTo(c.parent||"body"),n.extend(c,{skin:n(".fancybox-skin",c.wrap),outer:n(".fancybox-outer",c.wrap),inner:n(".fancybox-inner",c.wrap)}),n.each(["Top","Right","Bottom","Left"],function(e,t){c.skin.css("padding"+t,g(c.padding[e]))}),r.trigger("onReady"),"inline"===a||"html"===a){if(!c.content||!c.content.length)return r._error("content")}else if(!o)return r._error("href");"image"===a?r._loadImage():"ajax"===a?r._loadAjax():"iframe"===a?r._loadIframe():r._afterLoad()},_error:function(e){n.extend(r.coming,{type:"html",autoWidth:!0,autoHeight:!0,minWidth:0,minHeight:0,scrolling:"no",hasError:e,content:r.coming.tpl.error}),r._afterLoad()},_loadImage:function(){var e=r.imgPreload=new Image;e.onload=function(){this.onload=this.onerror=null,r.coming.width=this.width/r.opts.pixelRatio,r.coming.height=this.height/r.opts.pixelRatio,r._afterLoad()},e.onerror=function(){this.onload=this.onerror=null,r._error("image")},e.src=r.coming.href,e.complete!==!0&&r.showLoading()},_loadAjax:function(){var e=r.coming;r.showLoading(),r.ajaxLoad=n.ajax(n.extend({},e.ajax,{url:e.href,error:function(e,t){r.coming&&"abort"!==t?r._error("ajax",e):r.hideLoading()},success:function(t,n){"success"===n&&(e.content=t,r._afterLoad())}}))},_loadIframe:function(){var e=r.coming,t=n(e.tpl.iframe.replace(/\{rnd\}/g,(new Date).getTime())).attr("scrolling",u?"auto":e.iframe.scrolling).attr("src",e.href);n(e.wrap).bind("onReset",function(){try{n(this).find("iframe").hide().attr("src","//about:blank").end().empty()}catch(e){}}),e.iframe.preload&&(r.showLoading(),t.one("load",function(){n(this).data("ready",1),u||n(this).bind("load.fb",r.update),n(this).parents(".fancybox-wrap").width("100%").removeClass("fancybox-tmp").show(),r._afterLoad()})),e.content=t.appendTo(e.inner),e.iframe.preload||r._afterLoad()},_preloadImages:function(){var e,t,n=r.group,i=r.current,o=n.length,a=i.preload?Math.min(i.preload,o-1):0;for(t=1;a>=t;t+=1)e=n[(i.index+t)%o],"image"===e.type&&e.href&&((new Image).src=e.href)},_afterLoad:function(){var e,t,o,a,s,l,c=r.coming,u=r.current,d="fancybox-placeholder";if(r.hideLoading(),c&&r.isActive!==!1){if(!1===r.trigger("afterLoad",c,u))return c.wrap.stop(!0).trigger("onReset").remove(),r.coming=null,i;switch(u&&(r.trigger("beforeChange",u),u.wrap.stop(!0).removeClass("fancybox-opened").find(".fancybox-item, .fancybox-nav").remove()),r.unbindEvents(),e=c,t=c.content,o=c.type,a=c.scrolling,n.extend(r,{wrap:e.wrap,skin:e.skin,outer:e.outer,inner:e.inner,current:e,previous:u}),s=e.href,o){case"inline":case"ajax":case"html":e.selector?t=n("<div>").html(t).find(e.selector):h(t)&&(t.data(d)||t.data(d,n('<div class="'+d+'"></div>').insertAfter(t).hide()),t=t.show().detach(),e.wrap.bind("onReset",function(){n(this).find(t).length&&t.hide().replaceAll(t.data(d)).data(d,!1)}));break;case"image":t=e.tpl.image.replace("{href}",s);break;case"swf":t='<object id="fancybox-swf" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="100%" height="100%"><param name="movie" value="'+s+'"></param>',l="",n.each(e.swf,function(e,n){t+='<param name="'+e+'" value="'+n+'"></param>',l+=" "+e+'="'+n+'"'}),t+='<embed src="'+s+'" type="application/x-shockwave-flash" width="100%" height="100%"'+l+"></embed></object>"}h(t)&&t.parent().is(e.inner)||e.inner.append(t),r.trigger("beforeShow"),e.inner.css("overflow","yes"===a?"scroll":"no"===a?"hidden":a),r._setDimension(),r.reposition(),r.isOpen=!1,r.coming=null,r.bindEvents(),r.isOpened?u.prevMethod&&r.transitions[u.prevMethod]():n(".fancybox-wrap").not(e.wrap).stop(!0).trigger("onReset").remove(),r.transitions[r.isOpened?e.nextMethod:e.openMethod](),r._preloadImages()}},_setDimension:function(){var e,t,i,o,a,s,l,c,u,h,d,f,_,v,y,w=r.getViewport(),b=0,x=!1,k=!1,C=r.wrap,E=r.skin,T=r.inner,S=r.current,P=S.width,A=S.height,I=S.minWidth,$=S.minHeight,N=S.maxWidth,M=S.maxHeight,R=S.scrolling,j=S.scrollOutside?S.scrollbarWidth:0,O=S.margin,D=m(O[1]+O[3]),H=m(O[0]+O[2]);if(C.add(E).add(T).width("auto").height("auto").removeClass("fancybox-tmp"),e=m(E.outerWidth(!0)-E.width()),t=m(E.outerHeight(!0)-E.height()),i=D+e,o=H+t,a=p(P)?(w.w-i)*m(P)/100:P,s=p(A)?(w.h-o)*m(A)/100:A,"iframe"===S.type){if(v=S.content,S.autoHeight&&1===v.data("ready"))try{v[0].contentWindow.document.location&&(T.width(a).height(9999),y=v.contents().find("body"),j&&y.css("overflow-x","hidden"),s=y.outerHeight(!0))}catch(L){}}else(S.autoWidth||S.autoHeight)&&(T.addClass("fancybox-tmp"),S.autoWidth||T.width(a),S.autoHeight||T.height(s),S.autoWidth&&(a=T.width()),S.autoHeight&&(s=T.height()),T.removeClass("fancybox-tmp"));if(P=m(a),A=m(s),u=a/s,I=m(p(I)?m(I,"w")-i:I),N=m(p(N)?m(N,"w")-i:N),$=m(p($)?m($,"h")-o:$),M=m(p(M)?m(M,"h")-o:M),l=N,c=M,S.fitToView&&(N=Math.min(w.w-i,N),M=Math.min(w.h-o,M)),f=w.w-D,_=w.h-H,S.aspectRatio?(P>N&&(P=N,A=m(P/u)),A>M&&(A=M,P=m(A*u)),I>P&&(P=I,A=m(P/u)),$>A&&(A=$,P=m(A*u))):(P=Math.max(I,Math.min(P,N)),S.autoHeight&&"iframe"!==S.type&&(T.width(P),A=T.height()),A=Math.max($,Math.min(A,M))),S.fitToView)if(T.width(P).height(A),C.width(P+e),h=C.width(),d=C.height(),S.aspectRatio)for(;(h>f||d>_)&&P>I&&A>$&&!(b++>19);)A=Math.max($,Math.min(M,A-10)),P=m(A*u),I>P&&(P=I,A=m(P/u)),P>N&&(P=N,A=m(P/u)),T.width(P).height(A),C.width(P+e),h=C.width(),d=C.height();else P=Math.max(I,Math.min(P,P-(h-f))),A=Math.max($,Math.min(A,A-(d-_)));j&&"auto"===R&&s>A&&f>P+e+j&&(P+=j),T.width(P).height(A),C.width(P+e),h=C.width(),d=C.height(),x=(h>f||d>_)&&P>I&&A>$,k=S.aspectRatio?l>P&&c>A&&a>P&&s>A:(l>P||c>A)&&(a>P||s>A),n.extend(S,{dim:{width:g(h),height:g(d)},origWidth:a,origHeight:s,canShrink:x,canExpand:k,wPadding:e,hPadding:t,wrapSpace:d-E.outerHeight(!0),skinSpace:E.height()-A}),!v&&S.autoHeight&&A>$&&M>A&&!k&&T.height("auto")},_getPosition:function(e){var t=r.current,n=r.getViewport(),i=t.margin,o=r.wrap.width()+i[1]+i[3],a=r.wrap.height()+i[0]+i[2],s={position:"absolute",top:i[0],left:i[3]};return t.autoCenter&&t.fixed&&!e&&n.h>=a&&n.w>=o?s.position="fixed":t.locked||(s.top+=n.y,s.left+=n.x),s.top=g(Math.max(s.top,s.top+(n.h-a)*t.topRatio)),s.left=g(Math.max(s.left,s.left+(n.w-o)*t.leftRatio)),s},_afterZoomIn:function(){var e=r.current;e&&(r.isOpen=r.isOpened=!0,r.wrap.css("overflow","visible").addClass("fancybox-opened"),r.update(),(e.closeClick||e.nextClick&&r.group.length>1)&&r.inner.css("cursor","pointer").bind("click.fb",function(t){n(t.target).is("a")||n(t.target).parent().is("a")||(t.preventDefault(),r[e.closeClick?"close":"next"]())}),e.closeBtn&&n(e.tpl.closeBtn).appendTo(r.skin).bind("click.fb",function(e){e.preventDefault(),r.close()}),e.arrows&&r.group.length>1&&((e.loop||e.index>0)&&n(e.tpl.prev).appendTo(r.outer).bind("click.fb",r.prev),(e.loop||e.index<r.group.length-1)&&n(e.tpl.next).appendTo(r.outer).bind("click.fb",r.next)),r.trigger("afterShow"),e.loop||e.index!==e.group.length-1?r.opts.autoPlay&&!r.player.isActive&&(r.opts.autoPlay=!1,r.play()):r.play(!1))},_afterZoomOut:function(e){e=e||r.current,n(".fancybox-wrap").trigger("onReset").remove(),n.extend(r,{group:{},opts:{},router:!1,current:null,isActive:!1,isOpened:!1,isOpen:!1,isClosing:!1,wrap:null,skin:null,outer:null,inner:null}),r.trigger("afterClose",e)}}),r.transitions={getOrigPosition:function(){var e=r.current,t=e.element,n=e.orig,i={},o=50,a=50,s=e.hPadding,l=e.wPadding,c=r.getViewport();return!n&&e.isDom&&t.is(":visible")&&(n=t.find("img:first"),n.length||(n=t)),h(n)?(i=n.offset(),n.is("img")&&(o=n.outerWidth(),a=n.outerHeight())):(i.top=c.y+(c.h-a)*e.topRatio,i.left=c.x+(c.w-o)*e.leftRatio),("fixed"===r.wrap.css("position")||e.locked)&&(i.top-=c.y,i.left-=c.x),i={top:g(i.top-s*e.topRatio),left:g(i.left-l*e.leftRatio),width:g(o+l),height:g(a+s)}},step:function(e,t){var n,i,o,a=t.prop,s=r.current,l=s.wrapSpace,c=s.skinSpace;
("width"===a||"height"===a)&&(n=t.end===t.start?1:(e-t.start)/(t.end-t.start),r.isClosing&&(n=1-n),i="width"===a?s.wPadding:s.hPadding,o=e-i,r.skin[a](m("width"===a?o:o-l*n)),r.inner[a](m("width"===a?o:o-l*n-c*n)))},zoomIn:function(){var e=r.current,t=e.pos,i=e.openEffect,o="elastic"===i,a=n.extend({opacity:1},t);delete a.position,o?(t=this.getOrigPosition(),e.openOpacity&&(t.opacity=.1)):"fade"===i&&(t.opacity=.1),r.wrap.css(t).animate(a,{duration:"none"===i?0:e.openSpeed,easing:e.openEasing,step:o?this.step:null,complete:r._afterZoomIn})},zoomOut:function(){var e=r.current,t=e.closeEffect,n="elastic"===t,i={opacity:.1};n&&(i=this.getOrigPosition(),e.closeOpacity&&(i.opacity=.1)),r.wrap.animate(i,{duration:"none"===t?0:e.closeSpeed,easing:e.closeEasing,step:n?this.step:null,complete:r._afterZoomOut})},changeIn:function(){var e,t=r.current,n=t.nextEffect,i=t.pos,o={opacity:1},a=r.direction,s=200;i.opacity=.1,"elastic"===n&&(e="down"===a||"up"===a?"top":"left","down"===a||"right"===a?(i[e]=g(m(i[e])-s),o[e]="+="+s+"px"):(i[e]=g(m(i[e])+s),o[e]="-="+s+"px")),"none"===n?r._afterZoomIn():r.wrap.css(i).animate(o,{duration:t.nextSpeed,easing:t.nextEasing,complete:r._afterZoomIn})},changeOut:function(){var e=r.previous,t=e.prevEffect,i={opacity:.1},o=r.direction,a=200;"elastic"===t&&(i["down"===o||"up"===o?"top":"left"]=("up"===o||"left"===o?"-":"+")+"="+a+"px"),e.wrap.animate(i,{duration:"none"===t?0:e.prevSpeed,easing:e.prevEasing,complete:function(){n(this).trigger("onReset").remove()}})}},r.helpers.overlay={defaults:{closeClick:!0,speedOut:200,showEarly:!0,css:{},locked:!u,fixed:!0},overlay:null,fixed:!1,el:n("html"),create:function(e){e=n.extend({},this.defaults,e),this.overlay&&this.close(),this.overlay=n('<div class="fancybox-overlay"></div>').appendTo(r.coming?r.coming.parent:e.parent),this.fixed=!1,e.fixed&&r.defaults.fixed&&(this.overlay.addClass("fancybox-overlay-fixed"),this.fixed=!0)},open:function(e){var t=this;e=n.extend({},this.defaults,e),this.overlay?this.overlay.unbind(".overlay").width("auto").height("auto"):this.create(e),this.fixed||(a.bind("resize.overlay",n.proxy(this.update,this)),this.update()),e.closeClick&&this.overlay.bind("click.overlay",function(e){return n(e.target).hasClass("fancybox-overlay")?(r.isActive?r.close():t.close(),!1):i}),this.overlay.css(e.css).show()},close:function(){var e,t;a.unbind("resize.overlay"),this.el.hasClass("fancybox-lock")&&(n(".fancybox-margin").removeClass("fancybox-margin"),e=a.scrollTop(),t=a.scrollLeft(),this.el.removeClass("fancybox-lock"),a.scrollTop(e).scrollLeft(t)),n(".fancybox-overlay").remove().hide(),n.extend(this,{overlay:null,fixed:!1})},update:function(){var e,n="100%";this.overlay.width(n).height("100%"),l?(e=Math.max(t.documentElement.offsetWidth,t.body.offsetWidth),s.width()>e&&(n=s.width())):s.width()>a.width()&&(n=s.width()),this.overlay.width(n).height(s.height())},onReady:function(e,t){var i=this.overlay;n(".fancybox-overlay").stop(!0,!0),i||this.create(e),e.locked&&this.fixed&&t.fixed&&(i||(this.margin=s.height()>a.height()?n("html").css("margin-right").replace("px",""):!1),t.locked=this.overlay.append(t.wrap),t.fixed=!1),e.showEarly===!0&&this.beforeShow.apply(this,arguments)},beforeShow:function(e,t){var i,o;t.locked&&(this.margin!==!1&&(n("*").filter(function(){return"fixed"===n(this).css("position")&&!n(this).hasClass("fancybox-overlay")&&!n(this).hasClass("fancybox-wrap")}).addClass("fancybox-margin"),this.el.addClass("fancybox-margin")),i=a.scrollTop(),o=a.scrollLeft(),this.el.addClass("fancybox-lock"),a.scrollTop(i).scrollLeft(o)),this.open(e)},onUpdate:function(){this.fixed||this.update()},afterClose:function(e){this.overlay&&!r.coming&&this.overlay.fadeOut(e.speedOut,n.proxy(this.close,this))}},r.helpers.title={defaults:{type:"float",position:"bottom"},beforeShow:function(e){var t,i,o=r.current,a=o.title,s=e.type;if(n.isFunction(a)&&(a=a.call(o.element,o)),d(a)&&""!==n.trim(a)){switch(t=n('<div class="fancybox-title fancybox-title-'+s+'-wrap">'+a+"</div>"),s){case"inside":i=r.skin;break;case"outside":i=r.wrap;break;case"over":i=r.inner;break;default:i=r.skin,t.appendTo("body"),l&&t.width(t.width()),t.wrapInner('<span class="child"></span>'),r.current.margin[2]+=Math.abs(m(t.css("margin-bottom")))}t["top"===e.position?"prependTo":"appendTo"](i)}}},n.fn.fancybox=function(e){var t,i=n(this),o=this.selector||"",a=function(a){var s,l,c=n(this).blur(),u=t;a.ctrlKey||a.altKey||a.shiftKey||a.metaKey||c.is(".fancybox-wrap")||(s=e.groupAttr||"data-fancybox-group",l=c.attr(s),l||(s="rel",l=c.get(0)[s]),l&&""!==l&&"nofollow"!==l&&(c=o.length?n(o):i,c=c.filter("["+s+'="'+l+'"]'),u=c.index(this)),e.index=u,r.open(c,e)!==!1&&a.preventDefault())};return e=e||{},t=e.index||0,o&&e.live!==!1?s.undelegate(o,"click.fb-start").delegate(o+":not('.fancybox-item, .fancybox-nav')","click.fb-start",a):i.unbind("click.fb-start").bind("click.fb-start",a),this.filter("[data-fancybox-start=1]").trigger("click"),this},s.ready(function(){var t,a;n.scrollbarWidth===i&&(n.scrollbarWidth=function(){var e=n('<div style="width:50px;height:50px;overflow:auto"><div/></div>').appendTo("body"),t=e.children(),i=t.innerWidth()-t.height(99).innerWidth();return e.remove(),i}),n.support.fixedPosition===i&&(n.support.fixedPosition=function(){var e=n('<div style="position:fixed;top:20px;"></div>').appendTo("body"),t=20===e[0].offsetTop||15===e[0].offsetTop;return e.remove(),t}()),n.extend(r.defaults,{scrollbarWidth:n.scrollbarWidth(),fixed:n.support.fixedPosition,parent:n("body")}),t=n(e).width(),o.addClass("fancybox-lock-test"),a=n(e).width(),o.removeClass("fancybox-lock-test"),n("<style type='text/css'>.fancybox-margin{margin-right:"+(a-t)+"px;}</style>").appendTo("head")})}(window,document,jQuery),define("fancybox",["jquery","jquery.mousewheel"],function(){}),function(e){var t=e.fancybox;t.helpers.buttons={defaults:{skipSingle:!1,position:"top",tpl:'<div id="fancybox-buttons"><ul><li><a class="btnPrev" title="Previous" href="javascript:;"></a></li><li><a class="btnPlay" title="Start slideshow" href="javascript:;"></a></li><li><a class="btnNext" title="Next" href="javascript:;"></a></li><li><a class="btnToggle" title="Toggle size" href="javascript:;"></a></li><li><a class="btnClose" title="Close" href="javascript:;"></a></li></ul></div>'},list:null,buttons:null,beforeLoad:function(e,t){return e.skipSingle&&2>t.group.length?(t.helpers.buttons=!1,t.closeBtn=!0,void 0):(t.margin["bottom"===e.position?2:0]+=30,void 0)},onPlayStart:function(){this.buttons&&this.buttons.play.attr("title","Pause slideshow").addClass("btnPlayOn")},onPlayEnd:function(){this.buttons&&this.buttons.play.attr("title","Start slideshow").removeClass("btnPlayOn")},afterShow:function(n,i){var o=this.buttons;o||(this.list=e(n.tpl).addClass(n.position).appendTo("body"),o={prev:this.list.find(".btnPrev").click(t.prev),next:this.list.find(".btnNext").click(t.next),play:this.list.find(".btnPlay").click(t.play),toggle:this.list.find(".btnToggle").click(t.toggle),close:this.list.find(".btnClose").click(t.close)}),i.index>0||i.loop?o.prev.removeClass("btnDisabled"):o.prev.addClass("btnDisabled"),i.loop||i.index<i.group.length-1?(o.next.removeClass("btnDisabled"),o.play.removeClass("btnDisabled")):(o.next.addClass("btnDisabled"),o.play.addClass("btnDisabled")),this.buttons=o,this.onUpdate(n,i)},onUpdate:function(e,t){var n;this.buttons&&(n=this.buttons.toggle.removeClass("btnDisabled btnToggleOn"),t.canShrink?n.addClass("btnToggleOn"):t.canExpand||n.addClass("btnDisabled"))},beforeClose:function(){this.list&&this.list.remove(),this.list=null,this.buttons=null}}}(jQuery),define("fancybox.buttons",["jquery","jquery.mousewheel","fancybox"],function(){}),function(e){var t=e.fancybox;t.helpers.thumbs={defaults:{width:50,height:50,position:"bottom",source:function(t){var n;return t.element&&(n=e(t.element).find("img").attr("src")),!n&&"image"===t.type&&t.href&&(n=t.href),n}},wrap:null,list:null,width:0,init:function(t,n){var i,o=this,a=t.width,s=t.height,r=t.source;i="";for(var l=0;n.group.length>l;l++)i+='<li><a style="width:'+a+"px;height:"+s+'px;" href="javascript:jQuery.fancybox.jumpto('+l+');"></a></li>';this.wrap=e('<div id="fancybox-thumbs"></div>').addClass(t.position).appendTo("body"),this.list=e("<ul>"+i+"</ul>").appendTo(this.wrap),e.each(n.group,function(t){var i=r(n.group[t]);i&&e("<img />").load(function(){var n,i,r,l=this.width,c=this.height;o.list&&l&&c&&(n=l/a,i=c/s,r=o.list.children().eq(t).find("a"),n>=1&&i>=1&&(n>i?(l=Math.floor(l/i),c=s):(l=a,c=Math.floor(c/n))),e(this).css({width:l,height:c,top:Math.floor(s/2-c/2),left:Math.floor(a/2-l/2)}),r.width(a).height(s),e(this).hide().appendTo(r).fadeIn(300))}).attr("src",i)}),this.width=this.list.children().eq(0).outerWidth(!0),this.list.width(this.width*(n.group.length+1)).css("left",Math.floor(.5*e(window).width()-(n.index*this.width+.5*this.width)))},beforeLoad:function(e,t){return 2>t.group.length?(t.helpers.thumbs=!1,void 0):(t.margin["top"===e.position?0:2]+=e.height+15,void 0)},afterShow:function(e,t){this.list?this.onUpdate(e,t):this.init(e,t),this.list.children().removeClass("active").eq(t.index).addClass("active")},onUpdate:function(t,n){this.list&&this.list.stop(!0).animate({left:Math.floor(.5*e(window).width()-(n.index*this.width+.5*this.width))},150)},beforeClose:function(){this.wrap&&this.wrap.remove(),this.wrap=null,this.list=null,this.width=0}}}(jQuery),define("fancybox.thumbs",["jquery","jquery.mousewheel","fancybox"],function(){}),define("modules/view/nue/nue",["jquery","fancybox","fancybox.buttons","fancybox.thumbs"],function(){var e={};return e.show=function(){function e(e){var t=$("<ul/>");$.each($.fancybox.group,function(n){var i=$('<li><a href=""><span/></a></li>').data("index",n);n==e.index?i.find("span").addClass("active"):i.find("span").removeClass("active"),i.find("a").click(function(e){e.preventDefault(),$.fancybox.jumpto($(this).parent().data("index"))}),t.append(i)}),$(".fancybox-outer").append(t)}$.fancybox.open([{afterLoad:e,href:url.cdn+url.jsclient+"/app/images/nue/web-nue-01.png"},{afterLoad:e,href:url.cdn+url.jsclient+"/app/images/nue/web-nue-02.png"},{afterLoad:e,href:url.cdn+url.jsclient+"/app/images/nue/web-nue-03.png"},{afterLoad:e,href:url.cdn+url.jsclient+"/app/images/nue/web-nue-04.png"},{afterLoad:e,href:url.cdn+url.jsclient+"/app/images/nue/web-nue-05.png"}],{openEffect:"none",closeEffect:"none",nextEffect:"none",prevEffect:"none",openEasing:"none",closeEasing:"none",nextEasing:"none",prevEasing:"none",padding:0,preload:5,loop:!1,wrapCSS:"nue",helpers:{overlay:{closeClick:!1}},keys:{next:{13:"left",34:"up",39:"left",40:"up"},prev:{8:"right",33:"down",37:"right",38:"down"},close:null}})},e}),define("modules/model/common/poll_model",["underscore","backbone","modules/mig33_app","modules/common/config","modules/common/utility"],function(e,t,n,i){var o=t.Model.extend({initialize:function(e){this.options=e},url:function(){return i.urls.poll_url+"/"+((new Date).getTime()-i.timer.poll)}});return o}),define("modules/template/helpers/user_helpers",["underscore","handlebars","modules/common/utility"],function(e,t,n){t.registerHelper("userGetLabels",function(e,i){var o,a,s=[];if("session_user"===e&&session_user?o=session_user:"user"===e&&this.username?o=this:"author"===e&&this.author.username?o=this.author:"root_post"===e&&this.root_post.author.username&&(o=this.root_post.author),!o||!o.label)return"";if(o.label.verified&&(a=n.translate("user|label_verified"),s.push('<img src="'+url.cdn+"/resources/img/labels/"+i+"x"+i+"/v"+'.png" title="'+a+'" alt="'+a+'" />')),o.label.staff&&(a=n.translate("user|label_staff"),s.push('<img src="'+url.cdn+"/resources/img/labels/"+i+"x"+i+"/s"+'.png" title="'+a+'" alt="'+a+'" />')),null!==o.label.merchant){switch(a="",o.label.merchant){case"M":a=n.translate("user|label_merchant");break;case"MT":a=n.translate("user|label_merchant_mentor")}s.push('<img src="'+url.cdn+"/resources/img/labels/"+i+"x"+i+"/"+o.label.merchant.toLowerCase()+'.png" title="'+a+'" alt="'+a+'" />')}if(null!==o.label.admin){switch(a="",o.label.admin){case"A":a=n.translate("user|label_admin");break;case"GA":a=n.translate("user|label_admin_group");break;case"CA":a=n.translate("user|label_admin_chatroom")}s.push('<img src="'+url.cdn+"/resources/img/labels/"+i+"x"+i+"/"+o.label.admin.toLowerCase()+'.png" title="'+a+'" alt="'+a+'" />')}return new t.SafeString(s.join("&nbsp;"))}),t.registerHelper("fn_user_profile_hover",function(){var e=this.model;if(!e)return"";var n='<a href="'+e.personalized_url+'" class="profile-hover" title="'+e.username+'">'+e.username+"</a>";return new t.SafeString(n)}),t.registerHelper("userGetDisplayPictureUrl",function(e,t){var i=this;return i?n.get_display_picture_url(i.username,i.display_picture_type,e,t):""}),t.registerHelper("fn_user_get_relationship",function(){var e=this;return e?variable.relationship.status[e.relationship_status]:""}),t.registerHelper("userGetGenderHeShe",function(){var e=this;if(!e)return"";switch(e.gender){case"M":return variable.gender.heshe.M;case"F":return variable.gender.heshe.F}}),t.registerHelper("userGetGender",function(){var e=this;if(!e)return"";switch(e.gender){case"M":return variable.gender.name.M;case"F":return variable.gender.name.F}}),t.registerHelper("userGetDob",function(){var e=this;if(!e)return"";var t=new Date(0);return t.setUTCSeconds(e.date_of_birth),t.getDate()+"-"+(t.getMonth()+1)+"-"+t.getFullYear()});var i=function(){var e=this;if(!e)return"";var t=new Date,n=new Date(1e3*e.date_of_birth),i=t.getFullYear()-n.getFullYear();return!isNaN(i)};t.registerHelper("ifUserCanShowAge",function(e){var t=i.apply(this);return t?e.fn(this):e.inverse(this)}),t.registerHelper("userCanShowAge",i),t.registerHelper("userGetAge",function(){var e=this;if(!e)return"";var t=new Date,n=new Date(1e3*e.date_of_birth),i=t.getFullYear()-n.getFullYear();if(!isNaN(i)){var o=t.getMonth()-n.getMonth();return(0>o||0===o&&t.getDate()<n.getDate())&&i--,i}return 0}),t.registerHelper("userGetMigbotImage",function(e,i,o){var a=this;"session_user"===e&&session_user?a=session_user:"user"===e&&this.username&&(a=this);var s=n.translate("user|miglevel_with_level",a.mig_level);o=o||!1;var r="";return r=null===a.migbot_image?'<img src="'+url.cdn+'/resources/img/icons/icon_miglevel.png" title="'+s+'" alt="'+s+'" />':'<img src="'+url.emoticon+"/images/reputation/"+a.migbot_image+"-"+i+"x"+i+'.png" title="'+s+'" alt="'+s+'" />',o&&(r+="&nbsp;"+s),new t.SafeString(r)})}),!function(e){e(function(){e.support.transition=function(){var e=function(){var e,t=document.createElement("bootstrap"),n={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",transition:"transitionend"};for(e in n)if(void 0!==t.style[e])return n[e]}();return e&&{end:e}}()})}(window.jQuery),!function(e){var t='[data-dismiss="alert"]',n=function(n){e(n).on("click",t,this.close)};n.prototype.close=function(t){function n(){i.trigger("closed").remove()}var i,o=e(this),a=o.attr("data-target");a||(a=o.attr("href"),a=a&&a.replace(/.*(?=#[^\s]*$)/,"")),i=e(a),t&&t.preventDefault(),i.length||(i=o.hasClass("alert")?o:o.parent()),i.trigger(t=e.Event("close")),t.isDefaultPrevented()||(i.removeClass("in"),e.support.transition&&i.hasClass("fade")?i.on(e.support.transition.end,n):n())};var i=e.fn.alert;e.fn.alert=function(t){return this.each(function(){var i=e(this),o=i.data("alert");o||i.data("alert",o=new n(this)),"string"==typeof t&&o[t].call(i)})},e.fn.alert.Constructor=n,e.fn.alert.noConflict=function(){return e.fn.alert=i,this},e(document).on("click.alert.data-api",t,n.prototype.close)}(window.jQuery),!function(e){var t=function(t,n){this.$element=e(t),this.options=e.extend({},e.fn.button.defaults,n)};t.prototype.setState=function(e){var t="disabled",n=this.$element,i=n.data(),o=n.is("input")?"val":"html";e+="Text",i.resetText||n.data("resetText",n[o]()),n[o](i[e]||this.options[e]),setTimeout(function(){"loadingText"==e?n.addClass(t).attr(t,t):n.removeClass(t).removeAttr(t)},0)},t.prototype.toggle=function(){var e=this.$element.closest('[data-toggle="buttons-radio"]');e&&e.find(".active").removeClass("active"),this.$element.toggleClass("active")};var n=e.fn.button;e.fn.button=function(n){return this.each(function(){var i=e(this),o=i.data("button"),a="object"==typeof n&&n;o||i.data("button",o=new t(this,a)),"toggle"==n?o.toggle():n&&o.setState(n)})},e.fn.button.defaults={loadingText:"loading..."},e.fn.button.Constructor=t,e.fn.button.noConflict=function(){return e.fn.button=n,this},e(document).on("click.button.data-api","[data-toggle^=button]",function(t){var n=e(t.target);n.hasClass("btn")||(n=n.closest(".btn")),n.button("toggle")})}(window.jQuery),!function(e){var t=function(t,n){this.$element=e(t),this.$indicators=this.$element.find(".carousel-indicators"),this.options=n,"hover"==this.options.pause&&this.$element.on("mouseenter",e.proxy(this.pause,this)).on("mouseleave",e.proxy(this.cycle,this))};t.prototype={cycle:function(t){return t||(this.paused=!1),this.interval&&clearInterval(this.interval),this.options.interval&&!this.paused&&(this.interval=setInterval(e.proxy(this.next,this),this.options.interval)),this},getActiveIndex:function(){return this.$active=this.$element.find(".item.active"),this.$items=this.$active.parent().children(),this.$items.index(this.$active)},to:function(t){var n=this.getActiveIndex(),i=this;if(!(t>this.$items.length-1||0>t))return this.sliding?this.$element.one("slid",function(){i.to(t)}):n==t?this.pause().cycle():this.slide(t>n?"next":"prev",e(this.$items[t]))},pause:function(t){return t||(this.paused=!0),this.$element.find(".next, .prev").length&&e.support.transition.end&&(this.$element.trigger(e.support.transition.end),this.cycle(!0)),clearInterval(this.interval),this.interval=null,this},next:function(){return this.sliding?void 0:this.slide("next")},prev:function(){return this.sliding?void 0:this.slide("prev")},slide:function(t,n){var i,o=this.$element.find(".item.active"),a=n||o[t](),s=this.interval,r="next"==t?"left":"right",l="next"==t?"first":"last",c=this;if(this.sliding=!0,s&&this.pause(),a=a.length?a:this.$element.find(".item")[l](),i=e.Event("slide",{relatedTarget:a[0],direction:r}),!a.hasClass("active")){if(this.$indicators.length&&(this.$indicators.find(".active").removeClass("active"),this.$element.one("slid",function(){var t=e(c.$indicators.children()[c.getActiveIndex()]);t&&t.addClass("active")})),e.support.transition&&this.$element.hasClass("slide")){if(this.$element.trigger(i),i.isDefaultPrevented())return;a.addClass(t),a[0].offsetWidth,o.addClass(r),a.addClass(r),this.$element.one(e.support.transition.end,function(){a.removeClass([t,r].join(" ")).addClass("active"),o.removeClass(["active",r].join(" ")),c.sliding=!1,setTimeout(function(){c.$element.trigger("slid")},0)})}else{if(this.$element.trigger(i),i.isDefaultPrevented())return;o.removeClass("active"),a.addClass("active"),this.sliding=!1,this.$element.trigger("slid")}return s&&this.cycle(),this}}};var n=e.fn.carousel;e.fn.carousel=function(n){return this.each(function(){var i=e(this),o=i.data("carousel"),a=e.extend({},e.fn.carousel.defaults,"object"==typeof n&&n),s="string"==typeof n?n:a.slide;o||i.data("carousel",o=new t(this,a)),"number"==typeof n?o.to(n):s?o[s]():a.interval&&o.pause().cycle()})},e.fn.carousel.defaults={interval:5e3,pause:"hover"},e.fn.carousel.Constructor=t,e.fn.carousel.noConflict=function(){return e.fn.carousel=n,this},e(document).on("click.carousel.data-api","[data-slide], [data-slide-to]",function(t){var n,i,o=e(this),a=e(o.attr("data-target")||(n=o.attr("href"))&&n.replace(/.*(?=#[^\s]+$)/,"")),s=e.extend({},a.data(),o.data());a.carousel(s),(i=o.attr("data-slide-to"))&&a.data("carousel").pause().to(i).cycle(),t.preventDefault()})}(window.jQuery),!function(e){var t=function(t,n){this.$element=e(t),this.options=e.extend({},e.fn.collapse.defaults,n),this.options.parent&&(this.$parent=e(this.options.parent)),this.options.toggle&&this.toggle()};t.prototype={constructor:t,dimension:function(){var e=this.$element.hasClass("width");return e?"width":"height"},show:function(){var t,n,i,o;if(!this.transitioning&&!this.$element.hasClass("in")){if(t=this.dimension(),n=e.camelCase(["scroll",t].join("-")),i=this.$parent&&this.$parent.find("> .accordion-group > .in"),i&&i.length){if(o=i.data("collapse"),o&&o.transitioning)return;i.collapse("hide"),o||i.data("collapse",null)}this.$element[t](0),this.transition("addClass",e.Event("show"),"shown"),e.support.transition&&this.$element[t](this.$element[0][n])}},hide:function(){var t;!this.transitioning&&this.$element.hasClass("in")&&(t=this.dimension(),this.reset(this.$element[t]()),this.transition("removeClass",e.Event("hide"),"hidden"),this.$element[t](0))},reset:function(e){var t=this.dimension();return this.$element.removeClass("collapse")[t](e||"auto")[0].offsetWidth,this.$element[null!==e?"addClass":"removeClass"]("collapse"),this},transition:function(t,n,i){var o=this,a=function(){"show"==n.type&&o.reset(),o.transitioning=0,o.$element.trigger(i)};this.$element.trigger(n),n.isDefaultPrevented()||(this.transitioning=1,this.$element[t]("in"),e.support.transition&&this.$element.hasClass("collapse")?this.$element.one(e.support.transition.end,a):a())},toggle:function(){this[this.$element.hasClass("in")?"hide":"show"]()}};var n=e.fn.collapse;e.fn.collapse=function(n){return this.each(function(){var i=e(this),o=i.data("collapse"),a=e.extend({},e.fn.collapse.defaults,i.data(),"object"==typeof n&&n);o||i.data("collapse",o=new t(this,a)),"string"==typeof n&&o[n]()})},e.fn.collapse.defaults={toggle:!0},e.fn.collapse.Constructor=t,e.fn.collapse.noConflict=function(){return e.fn.collapse=n,this},e(document).on("click.collapse.data-api","[data-toggle=collapse]",function(t){var n,i=e(this),o=i.attr("data-target")||t.preventDefault()||(n=i.attr("href"))&&n.replace(/.*(?=#[^\s]+$)/,""),a=e(o).data("collapse")?"toggle":i.data();i[e(o).hasClass("in")?"addClass":"removeClass"]("collapsed"),e(o).collapse(a)})}(window.jQuery),!function(e){function t(){e(".dropdown-backdrop").remove(),e(i).each(function(){n(e(this)).removeClass("open")})}function n(t){var n,i=t.attr("data-target");return i||(i=t.attr("href"),i=i&&/#/.test(i)&&i.replace(/.*(?=#[^\s]*$)/,"")),n=i&&e(i),n&&n.length||(n=t.parent()),n}var i="[data-toggle=dropdown]",o=function(t){var n=e(t).on("click.dropdown.data-api",this.toggle);e("html").on("click.dropdown.data-api",function(){n.parent().removeClass("open")})};o.prototype={constructor:o,toggle:function(){var i,o,a=e(this);if(!a.is(".disabled, :disabled"))return i=n(a),o=i.hasClass("open"),t(),o||("ontouchstart"in document.documentElement&&e('<div class="dropdown-backdrop"/>').insertBefore(e(this)).on("click",t),i.toggleClass("open")),a.focus(),!1},keydown:function(t){var o,a,s,r,l;if(/(38|40|27)/.test(t.keyCode)&&(o=e(this),t.preventDefault(),t.stopPropagation(),!o.is(".disabled, :disabled"))){if(s=n(o),r=s.hasClass("open"),!r||r&&27==t.keyCode)return 27==t.which&&s.find(i).focus(),o.click();a=e("[role=menu] li:not(.divider):visible a",s),a.length&&(l=a.index(a.filter(":focus")),38==t.keyCode&&l>0&&l--,40==t.keyCode&&a.length-1>l&&l++,~l||(l=0),a.eq(l).focus())}}};var a=e.fn.dropdown;e.fn.dropdown=function(t){return this.each(function(){var n=e(this),i=n.data("dropdown");i||n.data("dropdown",i=new o(this)),"string"==typeof t&&i[t].call(n)})},e.fn.dropdown.Constructor=o,e.fn.dropdown.noConflict=function(){return e.fn.dropdown=a,this},e(document).on("click.dropdown.data-api",t).on("click.dropdown.data-api",".dropdown form",function(e){e.stopPropagation()}).on("click.dropdown.data-api",i,o.prototype.toggle).on("keydown.dropdown.data-api",i+", [role=menu]",o.prototype.keydown)}(window.jQuery),!function(e){var t=function(t,n){this.options=n,this.$element=e(t).delegate('[data-dismiss="modal"]',"click.dismiss.modal",e.proxy(this.hide,this)),this.options.remote&&this.$element.find(".modal-body").load(this.options.remote)};t.prototype={constructor:t,toggle:function(){return this[this.isShown?"hide":"show"]()},show:function(){var t=this,n=e.Event("show");this.$element.trigger(n),this.isShown||n.isDefaultPrevented()||(this.isShown=!0,this.escape(),this.backdrop(function(){var n=e.support.transition&&t.$element.hasClass("fade");t.$element.parent().length||t.$element.appendTo(document.body),t.$element.show(),n&&t.$element[0].offsetWidth,t.$element.addClass("in").attr("aria-hidden",!1),t.enforceFocus(),n?t.$element.one(e.support.transition.end,function(){t.$element.focus().trigger("shown")}):t.$element.focus().trigger("shown")}))},hide:function(t){t&&t.preventDefault(),t=e.Event("hide"),this.$element.trigger(t),this.isShown&&!t.isDefaultPrevented()&&(this.isShown=!1,this.escape(),e(document).off("focusin.modal"),this.$element.removeClass("in").attr("aria-hidden",!0),e.support.transition&&this.$element.hasClass("fade")?this.hideWithTransition():this.hideModal())},enforceFocus:function(){var t=this;e(document).on("focusin.modal",function(e){t.$element[0]===e.target||t.$element.has(e.target).length||t.$element.focus()})},escape:function(){var e=this;this.isShown&&this.options.keyboard?this.$element.on("keyup.dismiss.modal",function(t){27==t.which&&e.hide()}):this.isShown||this.$element.off("keyup.dismiss.modal")},hideWithTransition:function(){var t=this,n=setTimeout(function(){t.$element.off(e.support.transition.end),t.hideModal()},500);this.$element.one(e.support.transition.end,function(){clearTimeout(n),t.hideModal()})},hideModal:function(){var e=this;this.$element.hide(),this.backdrop(function(){e.removeBackdrop(),e.$element.trigger("hidden")})},removeBackdrop:function(){this.$backdrop&&this.$backdrop.remove(),this.$backdrop=null},backdrop:function(t){var n=this.$element.hasClass("fade")?"fade":"";if(this.isShown&&this.options.backdrop){var i=e.support.transition&&n;if(this.$backdrop=e('<div class="modal-backdrop '+n+'" />').appendTo(document.body),this.$backdrop.click("static"==this.options.backdrop?e.proxy(this.$element[0].focus,this.$element[0]):e.proxy(this.hide,this)),i&&this.$backdrop[0].offsetWidth,this.$backdrop.addClass("in"),!t)return;i?this.$backdrop.one(e.support.transition.end,t):t()}else!this.isShown&&this.$backdrop?(this.$backdrop.removeClass("in"),e.support.transition&&this.$element.hasClass("fade")?this.$backdrop.one(e.support.transition.end,t):t()):t&&t()}};var n=e.fn.modal;e.fn.modal=function(n){return this.each(function(){var i=e(this),o=i.data("modal"),a=e.extend({},e.fn.modal.defaults,i.data(),"object"==typeof n&&n);o||i.data("modal",o=new t(this,a)),"string"==typeof n?o[n]():a.show&&o.show()})},e.fn.modal.defaults={backdrop:!0,keyboard:!0,show:!0},e.fn.modal.Constructor=t,e.fn.modal.noConflict=function(){return e.fn.modal=n,this},e(document).on("click.modal.data-api",'[data-toggle="modal"]',function(t){var n=e(this),i=n.attr("href"),o=e(n.attr("data-target")||i&&i.replace(/.*(?=#[^\s]+$)/,"")),a=o.data("modal")?"toggle":e.extend({remote:!/#/.test(i)&&i},o.data(),n.data());t.preventDefault(),o.modal(a).one("hide",function(){n.focus()})})}(window.jQuery),!function(e){var t=function(e,t){this.init("tooltip",e,t)};t.prototype={constructor:t,init:function(t,n,i){var o,a,s,r,l;for(this.type=t,this.$element=e(n),this.options=this.getOptions(i),this.enabled=!0,s=this.options.trigger.split(" "),l=s.length;l--;)r=s[l],"click"==r?this.$element.on("click."+this.type,this.options.selector,e.proxy(this.toggle,this)):"manual"!=r&&(o="hover"==r?"mouseenter":"focus",a="hover"==r?"mouseleave":"blur",this.$element.on(o+"."+this.type,this.options.selector,e.proxy(this.enter,this)),this.$element.on(a+"."+this.type,this.options.selector,e.proxy(this.leave,this)));this.options.selector?this._options=e.extend({},this.options,{trigger:"manual",selector:""}):this.fixTitle()},getOptions:function(t){return t=e.extend({},e.fn[this.type].defaults,this.$element.data(),t),t.delay&&"number"==typeof t.delay&&(t.delay={show:t.delay,hide:t.delay}),t},enter:function(t){var n,i=e.fn[this.type].defaults,o={};return this._options&&e.each(this._options,function(e,t){i[e]!=t&&(o[e]=t)},this),n=e(t.currentTarget)[this.type](o).data(this.type),n.options.delay&&n.options.delay.show?(clearTimeout(this.timeout),n.hoverState="in",this.timeout=setTimeout(function(){"in"==n.hoverState&&n.show()},n.options.delay.show),void 0):n.show()},leave:function(t){var n=e(t.currentTarget)[this.type](this._options).data(this.type);return this.timeout&&clearTimeout(this.timeout),n.options.delay&&n.options.delay.hide?(n.hoverState="out",this.timeout=setTimeout(function(){"out"==n.hoverState&&n.hide()},n.options.delay.hide),void 0):n.hide()},show:function(){var t,n,i,o,a,s,r=e.Event("show");if(this.hasContent()&&this.enabled){if(this.$element.trigger(r),r.isDefaultPrevented())return;switch(t=this.tip(),this.setContent(),this.options.animation&&t.addClass("fade"),a="function"==typeof this.options.placement?this.options.placement.call(this,t[0],this.$element[0]):this.options.placement,t.detach().css({top:0,left:0,display:"block"}),this.options.container?t.appendTo(this.options.container):t.insertAfter(this.$element),n=this.getPosition(),i=t[0].offsetWidth,o=t[0].offsetHeight,a){case"bottom":s={top:n.top+n.height,left:n.left+n.width/2-i/2};break;case"top":s={top:n.top-o,left:n.left+n.width/2-i/2};break;case"left":s={top:n.top+n.height/2-o/2,left:n.left-i};break;case"right":s={top:n.top+n.height/2-o/2,left:n.left+n.width}}this.applyPlacement(s,a),this.$element.trigger("shown")}},applyPlacement:function(e,t){var n,i,o,a,s=this.tip(),r=s[0].offsetWidth,l=s[0].offsetHeight;s.offset(e).addClass(t).addClass("in"),n=s[0].offsetWidth,i=s[0].offsetHeight,"top"==t&&i!=l&&(e.top=e.top+l-i,a=!0),"bottom"==t||"top"==t?(o=0,0>e.left&&(o=-2*e.left,e.left=0,s.offset(e),n=s[0].offsetWidth,i=s[0].offsetHeight),this.replaceArrow(o-r+n,n,"left")):this.replaceArrow(i-l,i,"top"),a&&s.offset(e)},replaceArrow:function(e,t,n){this.arrow().css(n,e?50*(1-e/t)+"%":"")},setContent:function(){var e=this.tip(),t=this.getTitle();e.find(".tooltip-inner")[this.options.html?"html":"text"](t),e.removeClass("fade in top bottom left right")},hide:function(){function t(){var t=setTimeout(function(){n.off(e.support.transition.end).detach()},500);n.one(e.support.transition.end,function(){clearTimeout(t),n.detach()})}var n=this.tip(),i=e.Event("hide");return this.$element.trigger(i),i.isDefaultPrevented()?void 0:(n.removeClass("in"),e.support.transition&&this.$tip.hasClass("fade")?t():n.detach(),this.$element.trigger("hidden"),this)},fixTitle:function(){var e=this.$element;(e.attr("title")||"string"!=typeof e.attr("data-original-title"))&&e.attr("data-original-title",e.attr("title")||"").attr("title","")},hasContent:function(){return this.getTitle()},getPosition:function(){var t=this.$element[0];return e.extend({},"function"==typeof t.getBoundingClientRect?t.getBoundingClientRect():{width:t.offsetWidth,height:t.offsetHeight},this.$element.offset())},getTitle:function(){var e,t=this.$element,n=this.options;return e=t.attr("data-original-title")||("function"==typeof n.title?n.title.call(t[0]):n.title)},tip:function(){return this.$tip=this.$tip||e(this.options.template)},arrow:function(){return this.$arrow=this.$arrow||this.tip().find(".tooltip-arrow")},validate:function(){this.$element[0].parentNode||(this.hide(),this.$element=null,this.options=null)},enable:function(){this.enabled=!0},disable:function(){this.enabled=!1},toggleEnabled:function(){this.enabled=!this.enabled},toggle:function(t){var n=t?e(t.currentTarget)[this.type](this._options).data(this.type):this;n.tip().hasClass("in")?n.hide():n.show()},destroy:function(){this.hide().$element.off("."+this.type).removeData(this.type)}};var n=e.fn.tooltip;e.fn.tooltip=function(n){return this.each(function(){var i=e(this),o=i.data("tooltip"),a="object"==typeof n&&n;o||i.data("tooltip",o=new t(this,a)),"string"==typeof n&&o[n]()})},e.fn.tooltip.Constructor=t,e.fn.tooltip.defaults={animation:!0,placement:"top",selector:!1,template:'<div class="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>',trigger:"hover focus",title:"",delay:0,html:!1,container:!1},e.fn.tooltip.noConflict=function(){return e.fn.tooltip=n,this
}}(window.jQuery),!function(e){var t=function(e,t){this.init("popover",e,t)};t.prototype=e.extend({},e.fn.tooltip.Constructor.prototype,{constructor:t,setContent:function(){var e=this.tip(),t=this.getTitle(),n=this.getContent();e.find(".popover-title")[this.options.html?"html":"text"](t),e.find(".popover-content")[this.options.html?"html":"text"](n),e.removeClass("fade top bottom left right in")},hasContent:function(){return this.getTitle()||this.getContent()},getContent:function(){var e,t=this.$element,n=this.options;return e=("function"==typeof n.content?n.content.call(t[0]):n.content)||t.attr("data-content")},tip:function(){return this.$tip||(this.$tip=e(this.options.template)),this.$tip},destroy:function(){this.hide().$element.off("."+this.type).removeData(this.type)}});var n=e.fn.popover;e.fn.popover=function(n){return this.each(function(){var i=e(this),o=i.data("popover"),a="object"==typeof n&&n;o||i.data("popover",o=new t(this,a)),"string"==typeof n&&o[n]()})},e.fn.popover.Constructor=t,e.fn.popover.defaults=e.extend({},e.fn.tooltip.defaults,{placement:"right",trigger:"click",content:"",template:'<div class="popover"><div class="arrow"></div><h3 class="popover-title"></h3><div class="popover-content"></div></div>'}),e.fn.popover.noConflict=function(){return e.fn.popover=n,this}}(window.jQuery),!function(e){function t(t,n){var i,o=e.proxy(this.process,this),a=e(t).is("body")?e(window):e(t);this.options=e.extend({},e.fn.scrollspy.defaults,n),this.$scrollElement=a.on("scroll.scroll-spy.data-api",o),this.selector=(this.options.target||(i=e(t).attr("href"))&&i.replace(/.*(?=#[^\s]+$)/,"")||"")+" .nav li > a",this.$body=e("body"),this.refresh(),this.process()}t.prototype={constructor:t,refresh:function(){var t,n=this;this.offsets=e([]),this.targets=e([]),t=this.$body.find(this.selector).map(function(){var t=e(this),i=t.data("target")||t.attr("href"),o=/^#\w/.test(i)&&e(i);return o&&o.length&&[[o.position().top+(!e.isWindow(n.$scrollElement.get(0))&&n.$scrollElement.scrollTop()),i]]||null}).sort(function(e,t){return e[0]-t[0]}).each(function(){n.offsets.push(this[0]),n.targets.push(this[1])})},process:function(){var e,t=this.$scrollElement.scrollTop()+this.options.offset,n=this.$scrollElement[0].scrollHeight||this.$body[0].scrollHeight,i=n-this.$scrollElement.height(),o=this.offsets,a=this.targets,s=this.activeTarget;if(t>=i)return s!=(e=a.last()[0])&&this.activate(e);for(e=o.length;e--;)s!=a[e]&&t>=o[e]&&(!o[e+1]||o[e+1]>=t)&&this.activate(a[e])},activate:function(t){var n,i;this.activeTarget=t,e(this.selector).parent(".active").removeClass("active"),i=this.selector+'[data-target="'+t+'"],'+this.selector+'[href="'+t+'"]',n=e(i).parent("li").addClass("active"),n.parent(".dropdown-menu").length&&(n=n.closest("li.dropdown").addClass("active")),n.trigger("activate")}};var n=e.fn.scrollspy;e.fn.scrollspy=function(n){return this.each(function(){var i=e(this),o=i.data("scrollspy"),a="object"==typeof n&&n;o||i.data("scrollspy",o=new t(this,a)),"string"==typeof n&&o[n]()})},e.fn.scrollspy.Constructor=t,e.fn.scrollspy.defaults={offset:10},e.fn.scrollspy.noConflict=function(){return e.fn.scrollspy=n,this},e(window).on("load",function(){e('[data-spy="scroll"]').each(function(){var t=e(this);t.scrollspy(t.data())})})}(window.jQuery),!function(e){var t=function(t){this.element=e(t)};t.prototype={constructor:t,show:function(){var t,n,i,o=this.element,a=o.closest("ul:not(.dropdown-menu)"),s=o.attr("data-target");s||(s=o.attr("href"),s=s&&s.replace(/.*(?=#[^\s]*$)/,"")),o.parent("li").hasClass("active")||(t=a.find(".active:last a")[0],i=e.Event("show",{relatedTarget:t}),o.trigger(i),i.isDefaultPrevented()||(n=e(s),this.activate(o.parent("li"),a),this.activate(n,n.parent(),function(){o.trigger({type:"shown",relatedTarget:t})})))},activate:function(t,n,i){function o(){a.removeClass("active").find("> .dropdown-menu > .active").removeClass("active"),t.addClass("active"),s?(t[0].offsetWidth,t.addClass("in")):t.removeClass("fade"),t.parent(".dropdown-menu")&&t.closest("li.dropdown").addClass("active"),i&&i()}var a=n.find("> .active"),s=i&&e.support.transition&&a.hasClass("fade");s?a.one(e.support.transition.end,o):o(),a.removeClass("in")}};var n=e.fn.tab;e.fn.tab=function(n){return this.each(function(){var i=e(this),o=i.data("tab");o||i.data("tab",o=new t(this)),"string"==typeof n&&o[n]()})},e.fn.tab.Constructor=t,e.fn.tab.noConflict=function(){return e.fn.tab=n,this},e(document).on("click.tab.data-api",'[data-toggle="tab"], [data-toggle="pill"]',function(t){t.preventDefault(),e(this).tab("show")})}(window.jQuery),!function(e){var t=function(t,n){this.$element=e(t),this.options=e.extend({},e.fn.typeahead.defaults,n),this.matcher=this.options.matcher||this.matcher,this.sorter=this.options.sorter||this.sorter,this.highlighter=this.options.highlighter||this.highlighter,this.updater=this.options.updater||this.updater,this.source=this.options.source,this.$menu=e(this.options.menu),this.shown=!1,this.listen()};t.prototype={constructor:t,select:function(){var e=this.$menu.find(".active").attr("data-value");return this.$element.val(this.updater(e)).change(),this.hide()},updater:function(e){return e},show:function(){var t=e.extend({},this.$element.position(),{height:this.$element[0].offsetHeight});return this.$menu.insertAfter(this.$element).css({top:t.top+t.height,left:t.left}).show(),this.shown=!0,this},hide:function(){return this.$menu.hide(),this.shown=!1,this},lookup:function(){var t;return this.query=this.$element.val(),!this.query||this.query.length<this.options.minLength?this.shown?this.hide():this:(t=e.isFunction(this.source)?this.source(this.query,e.proxy(this.process,this)):this.source,t?this.process(t):this)},process:function(t){var n=this;return t=e.grep(t,function(e){return n.matcher(e)}),t=this.sorter(t),t.length?this.render(t.slice(0,this.options.items)).show():this.shown?this.hide():this},matcher:function(e){return~e.toLowerCase().indexOf(this.query.toLowerCase())},sorter:function(e){for(var t,n=[],i=[],o=[];t=e.shift();)t.toLowerCase().indexOf(this.query.toLowerCase())?~t.indexOf(this.query)?i.push(t):o.push(t):n.push(t);return n.concat(i,o)},highlighter:function(e){var t=this.query.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&");return e.replace(RegExp("("+t+")","ig"),function(e,t){return"<strong>"+t+"</strong>"})},render:function(t){var n=this;return t=e(t).map(function(t,i){return t=e(n.options.item).attr("data-value",i),t.find("a").html(n.highlighter(i)),t[0]}),t.first().addClass("active"),this.$menu.html(t),this},next:function(){var t=this.$menu.find(".active").removeClass("active"),n=t.next();n.length||(n=e(this.$menu.find("li")[0])),n.addClass("active")},prev:function(){var e=this.$menu.find(".active").removeClass("active"),t=e.prev();t.length||(t=this.$menu.find("li").last()),t.addClass("active")},listen:function(){this.$element.on("focus",e.proxy(this.focus,this)).on("blur",e.proxy(this.blur,this)).on("keypress",e.proxy(this.keypress,this)).on("keyup",e.proxy(this.keyup,this)),this.eventSupported("keydown")&&this.$element.on("keydown",e.proxy(this.keydown,this)),this.$menu.on("click",e.proxy(this.click,this)).on("mouseenter","li",e.proxy(this.mouseenter,this)).on("mouseleave","li",e.proxy(this.mouseleave,this))},eventSupported:function(e){var t=e in this.$element;return t||(this.$element.setAttribute(e,"return;"),t="function"==typeof this.$element[e]),t},move:function(e){if(this.shown){switch(e.keyCode){case 9:case 13:case 27:e.preventDefault();break;case 38:e.preventDefault(),this.prev();break;case 40:e.preventDefault(),this.next()}e.stopPropagation()}},keydown:function(t){this.suppressKeyPressRepeat=~e.inArray(t.keyCode,[40,38,9,13,27]),this.move(t)},keypress:function(e){this.suppressKeyPressRepeat||this.move(e)},keyup:function(e){switch(e.keyCode){case 40:case 38:case 16:case 17:case 18:break;case 9:case 13:if(!this.shown)return;this.select();break;case 27:if(!this.shown)return;this.hide();break;default:this.lookup()}e.stopPropagation(),e.preventDefault()},focus:function(){this.focused=!0},blur:function(){this.focused=!1,!this.mousedover&&this.shown&&this.hide()},click:function(e){e.stopPropagation(),e.preventDefault(),this.select(),this.$element.focus()},mouseenter:function(t){this.mousedover=!0,this.$menu.find(".active").removeClass("active"),e(t.currentTarget).addClass("active")},mouseleave:function(){this.mousedover=!1,!this.focused&&this.shown&&this.hide()}};var n=e.fn.typeahead;e.fn.typeahead=function(n){return this.each(function(){var i=e(this),o=i.data("typeahead"),a="object"==typeof n&&n;o||i.data("typeahead",o=new t(this,a)),"string"==typeof n&&o[n]()})},e.fn.typeahead.defaults={source:[],items:8,menu:'<ul class="typeahead dropdown-menu"></ul>',item:'<li><a href="#"></a></li>',minLength:1},e.fn.typeahead.Constructor=t,e.fn.typeahead.noConflict=function(){return e.fn.typeahead=n,this},e(document).on("focus.typeahead.data-api",'[data-provide="typeahead"]',function(){var t=e(this);t.data("typeahead")||t.typeahead(t.data())})}(window.jQuery),!function(e){var t=function(t,n){this.options=e.extend({},e.fn.affix.defaults,n),this.$window=e(window).on("scroll.affix.data-api",e.proxy(this.checkPosition,this)).on("click.affix.data-api",e.proxy(function(){setTimeout(e.proxy(this.checkPosition,this),1)},this)),this.$element=e(t),this.checkPosition()};t.prototype.checkPosition=function(){if(this.$element.is(":visible")){var t,n=e(document).height(),i=this.$window.scrollTop(),o=this.$element.offset(),a=this.options.offset,s=a.bottom,r=a.top,l="affix affix-top affix-bottom";"object"!=typeof a&&(s=r=a),"function"==typeof r&&(r=a.top()),"function"==typeof s&&(s=a.bottom()),t=null!=this.unpin&&i+this.unpin<=o.top?!1:null!=s&&o.top+this.$element.height()>=n-s?"bottom":null!=r&&r>=i?"top":!1,this.affixed!==t&&(this.affixed=t,this.unpin="bottom"==t?o.top-i:null,this.$element.removeClass(l).addClass("affix"+(t?"-"+t:"")))}};var n=e.fn.affix;e.fn.affix=function(n){return this.each(function(){var i=e(this),o=i.data("affix"),a="object"==typeof n&&n;o||i.data("affix",o=new t(this,a)),"string"==typeof n&&o[n]()})},e.fn.affix.Constructor=t,e.fn.affix.defaults={offset:0},e.fn.affix.noConflict=function(){return e.fn.affix=n,this},e(window).on("load",function(){e('[data-spy="affix"]').each(function(){var t=e(this),n=t.data();n.offset=n.offset||{},n.offsetBottom&&(n.offset.bottom=n.offsetBottom),n.offsetTop&&(n.offset.top=n.offsetTop),t.affix(n)})})}(window.jQuery),define("bootstrap",["jquery"],function(){}),define("modules/mig33_app",["jquery","underscore","backbone","backbone.marionette","marionette_handlebars","handlebars","modules/common/config","modules/common/utility","modules/common/session_user","modules/common/task_runner","modules/chat/chat_loader","modules/view/common/header_layout","modules/view/nue/nue","modules/model/common/poll_model","modules/template/helpers/general_helpers","modules/template/helpers/user_helpers","bootstrap","fancybox"],function(e,t,n,i,o,a,s,r,l,c,u,h,d,p){e.ajaxSetup({cache:!1});var f=new n.Marionette.Application;f.addRegions({header:"#main-header",content:"#main",chat:"#chat-container"}),f.addInitializer(function(){var t=new h({model:new n.Model(session_user)});f.header.show(t),f.header.on("update:signup_message:username",function(t){e("#login-signup-message",this.$el).text(t)})}),f.root="/";var m=document.location.protocol+"//"+document.location.host+f.root,g=[document.location.protocol+"//"+document.location.host+"/wap2/"];return f.link_hijack_selector="a[href]:not([data-bypass])",f.link_hijack_handler=function(n){var i={prop:e(this).prop("href"),attr:e(this).attr("href")},o=!1;return t.each(g,function(e){-1!==i.attr.indexOf(e)&&(o=!0)}),o||null!==i.attr.match(/^https/)?(e(this).attr("target","_blank"),void 0):(f.navigate_to(i,n),void 0)},f.navigate_to=function(e,i){t.isString(e)&&(e={prop:e,attr:e}),e.attr.match(/\/v4\/(sites|debug)\//)||(e.attr=e.attr.replace(/\/(sites|debug)\//,"/v4/$1/")),null!==e.attr.match(RegExp("^(((https?:)?//[^/]+)?/wap)(/.*)?$","i"))&&(e.attr=e.attr.replace(/\/wap\//,"/")),null!==e.attr.match(RegExp("^(((https?:)?//[^/]+)?/web)(/.*)?$","i"))&&(e.attr=e.attr.replace(/\/web\//,"/")),"#"!=e.attr.charAt(0)&&e.prop.slice(0,m.length)===m&&(i&&i.preventDefault(),e.attr&&0===e.attr.indexOf(m)&&(e.attr=e.attr.slice(m.length)),n.history.navigate(e.attr,!0))},f.setup_link_hijacks=function(e){e.on("click",f.link_hijack_selector,f.link_hijack_handler)},f.setup_link_hijacks(e(document)),f.on("initialize:after",function(){if(n.history.start({pushState:r.is_pushstate_enabled(),root:f.root}),r.is_logged_in()){u.initializeChatClient(),3>=session_user.mig_level&&d.show();var e=new p;e.on("change",function(e){var t=e.get("unread_count").migalerts,n=e.get("unread_count").mentions,i=e.get("unread_count").posts;t>0&&f.vent.trigger(f.ApplicationEvents.NEW_MIGALERT,t),n>0&&f.vent.trigger(f.ApplicationEvents.NEW_MENTIONS,n),i>0&&f.vent.trigger(f.ApplicationEvents.NEW_POSTS,i)});var t=new c;t.clear(),t.start({scope:this,fireOnStart:!1,run:function(){e.fetch()},interval:s.timer.poll})}}),f.ApplicationEvents={POST_ADDED:"userfeed|post|added",GROUP_POST_ADDED:"groupfeed|%s|post|added",NEW_MIGALERT:"migalert|new",NEW_MENTIONS:"mentions|new",NEW_POSTS:"userfeed|post|new",ACCOUNT_BALANCE:"user|account|balance",TOGGLE_TEARAWAY:"window|mode|toggle",POST_WATCH:"post|watch",POST_UNWATCH:"post|unwatch"},f}),define("hbs!modules/template/homefeed/homefeed-layout",["handlebars"],function(e){return e.template(function(e,t,n,i,o){function a(){return'\n <a href="#" class="toggle-layout-type" data-type="feed"><i class="ico ico-24 ico-feed-view"></i></a>\n '}function s(){return'\n <a href="#" class="toggle-layout-type" data-type="tile"><i class="ico ico-24 ico-tile-view"></i></a>\n '}this.compilerInfo=[4,">= 1.0.0"],n=this.merge(n,e.helpers),o=o||{};var r,l,c,u="",h=n.helperMissing,d=this.escapeExpression,p=this;return u+='<div id="socialspace" class="span3">\n <div class="profile">\n <div class="profile-avatar pull-left">\n <img src="',c={hash:{},data:o},u+=d((r=n.getSessionUserDisplayPictureUrl||t.getSessionUserDisplayPictureUrl,r?r.call(t,"54","54",c):h.call(t,"getSessionUserDisplayPictureUrl","54","54",c)))+'" />\n </div>\n <div class="profile-details pull-left">\n <div class="profile-username"><a href="',c={hash:{},data:o},u+=d((r=n.getSessionUser||t.getSessionUser,r?r.call(t,"personalized_url",c):h.call(t,"getSessionUser","personalized_url",c)))+'">',c={hash:{},data:o},u+=d((r=n.getSessionUser||t.getSessionUser,r?r.call(t,"username",c):h.call(t,"getSessionUser","username",c)))+'</a></div>\n <div class="profile-miglevel">\n ',c={hash:{},data:o},u+=d((r=n.translate||t.translate,r?r.call(t,"user|miglevel",c):h.call(t,"translate","user|miglevel",c)))+"<br />",c={hash:{},data:o},u+=d((r=n.userGetMigbotImage||t.userGetMigbotImage,r?r.call(t,"session_user","16",!1,c):h.call(t,"userGetMigbotImage","session_user","16",!1,c)))+' <span class="level">',c={hash:{},data:o},u+=d((r=n.getSessionUser||t.getSessionUser,r?r.call(t,"mig_level",c):h.call(t,"getSessionUser","mig_level",c)))+'</span>\n <div class="profile-labels">',c={hash:{},data:o},u+=d((r=n.userGetLabels||t.userGetLabels,r?r.call(t,"session_user","16",c):h.call(t,"userGetLabels","session_user","16",c)))+'</div>\n </div>\n </div>\n <div class="clearfix"></div>\n <div class="profile-stats">\n <ul>\n <li><a href="',c={hash:{},data:o},u+=d((r=n.getSessionUser||t.getSessionUser,r?r.call(t,"personalized_url",c):h.call(t,"getSessionUser","personalized_url",c)))+'"><i class="ico ico-32 ico-post"></i><span class="profile-stats-text">',c={hash:{},data:o},u+=d((r=n.translate||t.translate,r?r.call(t,"homefeed|posts",c):h.call(t,"translate","homefeed|posts",c)))+"</span><br />",c={hash:{},data:o},u+=d((r=n.getSessionUser||t.getSessionUser,r?r.call(t,"num_posts",c):h.call(t,"getSessionUser","num_posts",c)))+'</a></li>\n <li><a href="',c={hash:{},data:o},u+=d((r=n.getSessionUser||t.getSessionUser,r?r.call(t,"personalized_url",c):h.call(t,"getSessionUser","personalized_url",c)))+'/badges"><i class="ico ico-32 ico-badge"></i><span class="profile-stats-text">',c={hash:{},data:o},u+=d((r=n.translate||t.translate,r?r.call(t,"user|badges",c):h.call(t,"translate","user|badges",c)))+"</span><br />",c={hash:{},data:o},u+=d((r=n.getSessionUser||t.getSessionUser,r?r.call(t,"num_badges_unlocked",c):h.call(t,"getSessionUser","num_badges_unlocked",c)))+'</a></li>\n <li><a href="/sites/ajax/profile/gifts_received?username=',c={hash:{},data:o},u+=d((r=n.getSessionUser||t.getSessionUser,r?r.call(t,"username",c):h.call(t,"getSessionUser","username",c)))+'"><i class="ico ico-32 ico-gift"></i><span class="profile-stats-text">',c={hash:{},data:o},u+=d((r=n.translate||t.translate,r?r.call(t,"user|gifts",c):h.call(t,"translate","user|gifts",c)))+"</span><br />",c={hash:{},data:o},u+=d((r=n.getSessionUser||t.getSessionUser,r?r.call(t,"num_gifts_received",c):h.call(t,"getSessionUser","num_gifts_received",c)))+'</a></li>\n <li><a href="',c={hash:{},data:o},u+=d((r=n.getSessionUser||t.getSessionUser,r?r.call(t,"personalized_url",c):h.call(t,"getSessionUser","personalized_url",c)))+'/followers"><i class="ico ico-32 ico-followers"></i><span class="profile-stats-text">',c={hash:{},data:o},u+=d((r=n.translate||t.translate,r?r.call(t,"user|followers",c):h.call(t,"translate","user|followers",c)))+"</span><br />",c={hash:{},data:o},u+=d((r=n.getSessionUser||t.getSessionUser,r?r.call(t,"num_followers",c):h.call(t,"getSessionUser","num_followers",c)))+'</a></li>\n </ul>\n </div>\n </div>\n <div class="post-box-container"></div>\n\n <div class="details sidebar-details">\n <div class="hot-topics section">\n <div class="header">',c={hash:{},data:o},u+=d((r=n.translate||t.translate,r?r.call(t,"discover|hot_topics",c):h.call(t,"translate","discover|hot_topics",c)))+'</div>\n <div class="body">\n <div class="hashtags content"></div>\n </div>\n </div>\n <div class="recommended-users section">\n <div class="header">',c={hash:{},data:o},u+=d((r=n.translate||t.translate,r?r.call(t,"discover|fun_people_to_follow",c):h.call(t,"translate","discover|fun_people_to_follow",c)))+'</div>\n <div class="body">\n <div class="more"><a href="/discover" class="expand" data-type="users"><i class="ico ico-24 ico-more"></i></a></div>\n <div class="content"></div>\n </div>\n </div>\n </div>\n</div>\n<div id="center-content" class="span7">\n <ul class="nav nav-tabs">\n <li class="active"><a href="/home"><span class="posts-unread-count"></span>&nbsp;',c={hash:{},data:o},u+=d((r=n.translate||t.translate,r?r.call(t,"homefeed|all_posts",c):h.call(t,"translate","homefeed|all_posts",c)))+'</a></li>\n <li><a href="/mentions"><span class="mentions-unread-count"></span>&nbsp;',c={hash:{},data:o},u+=d((r=n.translate||t.translate,r?r.call(t,"homefeed|mentions",c):h.call(t,"translate","homefeed|mentions",c)))+'</a></li>\n <li><a href="/watchlist"><span class="subscriptions-count">',c={hash:{},data:o},u+=d((r=n.getSessionUser||t.getSessionUser,r?r.call(t,"num_watched_posts",c):h.call(t,"getSessionUser","num_watched_posts",c)))+"</span>&nbsp;",c={hash:{},data:o},u+=d((r=n.translate||t.translate,r?r.call(t,"homefeed|subscriptions",c):h.call(t,"translate","homefeed|subscriptions",c)))+'</a></li>\n </ul>\n <div class="new-posts-message alert alert-success hide"></div>\n <div class="layout-view">\n ',c={hash:{},inverse:p.program(3,s,o),fn:p.program(1,a,o),data:o},r=n.ifGetSessionUserLayoutType||t.ifGetSessionUserLayoutType,l=r?r.call(t,"tile",c):h.call(t,"ifGetSessionUserLayoutType","tile",c),(l||0===l)&&(u+=l),u+='\n </div>\n <div class="box-container"></div>\n <div class="homefeed pagination">',c={hash:{},data:o},u+=d((r=n.translate||t.translate,r?r.call(t,"common|more",c):h.call(t,"translate","common|more",c)))+"</div>\n</div>"})}),define("modules/template/helpers/post_helpers",["handlebars","modules/common/utility"],function(e,t){var n={width:500,height:600},i=[96,120,200,320,480,800],o=i.concat().reverse(),a=function(e){var t="box";if(null!==e.media){if(null!==e.media.photo){var i=e.media.photo.original_width,o=e.media.photo.original_height;0===i||0===o?null!==e.media.photo.url.size_480&&(t+=" box-horizontal"):i>=n.width&&o>=n.height?t+=" box-large":i>=n.width&&n.height>o?t+=" box-horizontal":n.width>i&&o>=n.height&&(t+=" box-vertical")}null!==e.media.video&&"vimeo"==e.media.video.type&&(t+=" box-horizontal")}return t+=1===e.originality?" box-original":2===e.originality?" box-reply":" box-reshare",t+=" box-"+e.type_text};e.registerHelper("fn_post_get_css_class",function(){var e=this;a(e)});var s=function(e,t){for(var n=t?i:o,a=n.length;a--;){var s=n[a];if(e["size_"+s])return{size:s,value:e["size_"+s]}}return""};e.registerHelper("fn_post_get_big_image",function(e){var t=this;return e&&e.type_text&&(t=e),"photo"!==t.type_text?"":t.media&&t.media.photo&&t.media.photo.url?s(t.media.photo.url,!0).value:""}),e.registerHelper("fn_post_reply_get_big_image",function(e){return e&&e.url?s(e.url,!0).value:""}),e.registerHelper("fn_post_get_small_image",function(e){var t=this;return e&&e.type_text&&(t=e),"photo"!==t.type_text?"":t.media&&t.media.photo&&t.media.photo.url?s(t.media.photo.url).value:""}),e.registerHelper("fn_post_id_valid",function(){var e=this;return 0===e.id.search(/^\d+-\d+$/)}),e.registerHelper("fn_get_flickr_relative_url",function(e){return e.replace("http://www.flickr.com","")});var r=function(){var e=this;return e.body?-1!==e.body.indexOf(session_user.get("personalized_url")):!1};e.registerHelper("ifMentionMe",function(e){var t=r.apply(this);return t?e.fn(this):e.inverse(this)}),e.registerHelper("fn_did_mention_me",r);var l=function(){var e=this;return e.author&&t.is_logged_in()?e.author.relationship.is_self||"A"==session_user.get("label").admin:!1};e.registerHelper("fn_can_delete_post",l),e.registerHelper("if_can_delete_post",function(e){return l.call(this)?e.fn(this):e.inverse(this)}),e.registerHelper("if_non_group_post",function(e){return this.group?e.inverse(this):e.fn(this)});var c=function(){var e=this,n=e.parent_post;return e.author&&t.is_logged_in()&&n?e.author.relationship.is_self||n.get("author")&&n.get("author").username==session_user.get("username")||"A"==session_user.get("label").admin:!1};e.registerHelper("if_can_delete_reply",function(e){var t=c.apply(this);return t?e.fn(this):e.inverse(this)}),e.registerHelper("fn_can_delete_reply",c),e.registerHelper("fn_author_get_labels",function(n,i){var o,a=[];if(!n||!n.label)return"";if(n.label.verified&&(o=t.translate("user|label_verified"),a.push('<img src="'+url.cdn+"/resources/img/labels/"+i+"x"+i+"/v"+'.png" title="'+o+'" alt="'+o+'" />')),n.label.staff&&(o=t.translate("user|label_staff"),a.push('<img src="'+url.cdn+"/resources/img/labels/"+i+"x"+i+"/s"+'.png" title="'+o+'" alt="'+o+'" />')),null!==n.label.merchant){switch(o="",n.label.merchant){case"M":o=t.translate("user|label_merchant");break;case"MT":o=t.translate("user|label_merchant_mentor")}a.push('<img src="'+url.cdn+"/resources/img/labels/"+i+"x"+i+"/"+n.label.merchant.toLowerCase()+'.png" title="'+o+'" alt="'+o+'" />')}if(null!==n.label.admin){switch(o="",n.label.admin){case"A":o=t.translate("user|label_admin");break;case"GA":o=t.translate("user|label_admin_group");break;case"CA":o=t.translate("user|label_admin_chatroom")}a.push('<img src="'+url.cdn+"/resources/img/labels/"+i+"x"+i+"/"+n.label.admin.toLowerCase()+'.png" title="'+o+'" alt="'+o+'" />')}return new e.SafeString(a.join("&nbsp;"))}),e.registerHelper("ifCanShowRootPost",function(e){var t=this;if("reply"===t.originality_text&&t.root_post.author&&t.root_post.author.username){if("photo"===t.root_post.type_text&&"photo"===t.type_text){if("mig33"===t.root_post.media.photo.type)return e.inverse(this)}else{if("photo"===t.root_post.type_text&&"video"===t.type_text)return e.inverse(this);if("video"===t.root_post.type_text&&"video"===t.type_text)return e.inverse(this);if("video"===t.root_post.type_text&&"photo"===t.type_text)return e.inverse(this)}return e.fn(this)}return e.inverse(this)}),e.registerHelper("getPostTagPropertyImage",function(e,t){return 36===t?e:e.replace("/36/","/"+t+"/")})}),define("modules/view/homefeed/homefeed_layout",["jquery","underscore","backbone","handlebars","backbone.marionette","marionette_handlebars","modules/common/config","modules/common/utility","modules/common/session_user","modules/view/common/postbox_view","hbs!modules/template/homefeed/homefeed-layout","modules/template/helpers/general_helpers","modules/template/helpers/post_helpers"],function(e,t,n,i,o,a,s,r,l,c,u){var h=o.Layout.extend({onShow:function(){var e=new c({collapsible:!0});this.postbox.show(e)},template:{type:"handlebars",template:u},className:"row",regions:{postbox:".post-box-container",filters:".box-filter-container",hashtags:".hot-topics .content",recommended_users:".recommended-users .content",container:".box-container",pagination:".pagination"},triggers:{"click .new-posts-message":"homefeed:posts:new"},events:{"click .toggle-layout-type":"toggleLayoutType","click .expand":"toggleExpanded","click .collapse":"toggleCollapsed"},showChatrooms:function(t){e(".sidebar-details .chatrooom-sidebar-control",this.$el).remove(),e(".sidebar-details",this.$el).prepend(t)},toggleLayoutType:function(t){t.preventDefault();var n=e(t.currentTarget,this.$el).data("type"),i=n===s.layoutType.feed?s.layoutType.tile:s.layoutType.feed;n!==i&&(e(t.currentTarget,this.$el).data("type",i),e("> i",t.currentTarget).toggleClass("ico-"+n+"-view ico-"+i+"-view"),l.getInstance().setLayoutType(n))},toggleExpanded:function(t){t.preventDefault();var n=e(t.currentTarget,this.$el).data("type");e("."+n,this.$el).find(".expanded").css("display","block").end().find(".collapsed").css("display","none")},toggleCollapsed:function(t){t.preventDefault();var n=e(t.currentTarget,this.$el).data("type");e("."+n,this.$el).find(".collapsed").css("display","block").end().find(".expanded").css("display","none")},showPagination:function(){e(".pagination",this.$el).show()},hidePagination:function(){e(".pagination",this.$el).hide()},setPostsTabActive:function(){e("ul.nav > li",this.$el).removeClass("active"),e("ul.nav > li",this.$el).eq(0).addClass("active")},setMentionsTabActive:function(){e("ul.nav > li",this.$el).removeClass("active"),e("ul.nav > li",this.$el).eq(1).addClass("active")},setWatchlistTabActive:function(){e("ul.nav > li",this.$el).removeClass("active"),e("ul.nav > li",this.$el).eq(2).addClass("active")},updateMentionsCount:function(t){t>0?e(".mentions-unread-count",this.$el).css("visibility","visible").text(t):e(".mentions-unread-count",this.$el).css("visibility","hidden").text("")},updatePostsCount:function(t){t>0?e(".posts-unread-count",this.$el).css("visibility","visible").text(t):e(".posts-unread-count",this.$el).css("visibility","hidden").text("")},updateSubscriptionsCount:function(t){var n=e(".subscriptions-count",this.$el),i=parseInt(n.text(),10);n.text(i+t)},showOrHideNewPostsMessage:function(t){t>0?e(".new-posts-message",this.$el).text(r.translate("homefeed|new_posts",t)).show():e(".new-posts-message",this.$el).hide()}});return h}),define("modules/view/common/mig33_collection_view",["underscore","backbone","handlebars","backbone.marionette","modules/view/common/mig33_collection_view_mixin"],function(e,t,n,i,o){var a=i.CollectionView.extend({constructor:function(e){this.setupCollectionEventForEmptyView(e),a.__super__.constructor.apply(this,arguments)}});return e.extend(a.prototype,o),a}),define("hbs!modules/template/homefeed/post-tile-view",["handlebars"],function(e){return e.template(function(e,t,n,i,o){function a(e,t){var i,o,a,r="";return r+='\n <div class="post-body">\n \n ',a={hash:{},inverse:it.program(8,u,t),fn:it.program(2,s,t),data:t},i=n.compare||e.compare,o=i?i.call(e,(i=e.media,i=null==i||i===!1?i:i.photo,null==i||i===!1?i:i.type),"link",a):tt.call(e,"compare",(i=e.media,i=null==i||i===!1?i:i.photo,null==i||i===!1?i:i.type),"link",a),(o||0===o)&&(r+=o),r+="\n </div>\n ",a={hash:{},inverse:it.noop,fn:it.program(14,f,t),data:t},i=n.compare||e.compare,o=i?i.call(e,(i=e.media,i=null==i||i===!1?i:i.photo,null==i||i===!1?i:i.type),"link",a):tt.call(e,"compare",(i=e.media,i=null==i||i===!1?i:i.photo,null==i||i===!1?i:i.type),"link",a),(o||0===o)&&(r+=o),r+="\n"}function s(e,t){var i,o,a,s="";return s+="\n ",a={hash:{},inverse:it.noop,fn:it.program(3,r,t),data:t},i=n.isNotEmpty||e.isNotEmpty,o=i?i.call(e,e.body,a):tt.call(e,"isNotEmpty",e.body,a),(o||0===o)&&(s+=o),s+="\n \n "}function r(e,t){var i,o,a,s="";return s+='\n <div class="post-text">\n ',a={hash:{},inverse:it.noop,fn:it.program(4,l,t),data:t},i=n.compare||e.compare,o=i?i.call(e,e.originality_text,"reply",a):tt.call(e,"compare",e.originality_text,"reply",a),(o||0===o)&&(s+=o),s+="\n ",a={hash:{},inverse:it.noop,fn:it.program(6,c,t),data:t},i=n.compare||e.compare,o=i?i.call(e,e.originality_text,"reshare",a):tt.call(e,"compare",e.originality_text,"reshare",a),(o||0===o)&&(s+=o),s+="\n ",(o=n.body)?o=o.call(e,{hash:{},data:t}):(o=e.body,o=typeof o===ot?o.apply(e):o),(o||0===o)&&(s+=o),s+="\n </div>\n "}function l(e,t){var i,o,a="";return a+='\n <span class="post-originality-text">',o={hash:{},data:t},a+=nt((i=n.translate||e.translate,i?i.call(e,"post|reply",o):tt.call(e,"translate","post|reply",o)))+"</span>&nbsp;\n "}function c(e,t){var i,o,a="";return a+='\n <span class="post-originality-text">',o={hash:{},data:t},a+=nt((i=n.translate||e.translate,i?i.call(e,"post|shared",o):tt.call(e,"translate","post|shared",o)))+"</span>&nbsp;\n "}function u(e,t){var i,o,a,s="";return s+='\n <div class="post-image">\n <div class="post-image-img" style="background-image: url(\'',(i=n.fn_post_get_big_image)?i=i.call(e,{hash:{},data:t}):(i=e.fn_post_get_big_image,i=typeof i===ot?i.apply(e):i),s+=nt(i)+"');\"></div>\n ",a={hash:{},inverse:it.noop,fn:it.program(9,h,t),data:t},i=n.isNotEmpty||e.isNotEmpty,o=i?i.call(e,e.body,a):tt.call(e,"isNotEmpty",e.body,a),(o||0===o)&&(s+=o),s+="\n </div>\n "}function h(e,t){var i,o,a,s="";return s+='\n <div class="post-image-caption">\n <div class="post-image-caption-text">\n ',a={hash:{},inverse:it.noop,fn:it.program(10,d,t),data:t},i=n.compare||e.compare,o=i?i.call(e,e.originality_text,"reply",a):tt.call(e,"compare",e.originality_text,"reply",a),(o||0===o)&&(s+=o),s+="\n ",a={hash:{operator:"!="},inverse:it.noop,fn:it.program(12,p,t),data:t},i=n.compare||e.compare,o=i?i.call(e,e.originality_text,"reshare",a):tt.call(e,"compare",e.originality_text,"reshare",a),(o||0===o)&&(s+=o),s+="\n </div>\n </div>\n "}function d(e,t){var i,o,a,s="";return s+="\n ",a={hash:{},data:t},s+=nt((i=n.translate||e.translate,i?i.call(e,"post|reply",a):tt.call(e,"translate","post|reply",a)))+":&nbsp;\n ",(o=n.body)?o=o.call(e,{hash:{},data:t}):(o=e.body,o=typeof o===ot?o.apply(e):o),(o||0===o)&&(s+=o),s+="\n "}function p(e,t){var i,o="";return o+="\n ",(i=n.body)?i=i.call(e,{hash:{},data:t}):(i=e.body,i=typeof i===ot?i.apply(e):i),(i||0===i)&&(o+=i),o+="\n "}function f(e,t){var i,o,a,s="";return s+='\n <div class="post-meta-wrapper">\n <div class="post-meta">\n ',a={hash:{},inverse:it.noop,fn:it.program(15,m,t),data:t},i=n.isNotEmpty||e.isNotEmpty,o=i?i.call(e,(i=e.media,i=null==i||i===!1?i:i.photo,i=null==i||i===!1?i:i.url,null==i||i===!1?i:i.original),a):tt.call(e,"isNotEmpty",(i=e.media,i=null==i||i===!1?i:i.photo,i=null==i||i===!1?i:i.url,null==i||i===!1?i:i.original),a),(o||0===o)&&(s+=o),s+="\n </div>\n </div>\n "
}function m(e){var t,n="";return n+='\n <div class="post-meta-thumbnail"><img src="'+nt((t=e.media,t=null==t||t===!1?t:t.photo,t=null==t||t===!1?t:t.url,t=null==t||t===!1?t:t.original,typeof t===ot?t.apply(e):t))+'"/></div>\n '}function g(e,t){var i,o,a,s="";return s+='\n <div class="post-body">\n <div class="post-image">\n <div class="post-image-img" style="background-image: url(\''+nt((i=e.media,i=null==i||i===!1?i:i.video,i=null==i||i===!1?i:i.thumbnail_url,i=null==i||i===!1?i:i.large,typeof i===ot?i.apply(e):i))+'\');">\n <div class="play">\n <i class="ico ico-24 ico-video-play"></i>\n </div>\n </div>\n ',a={hash:{},inverse:it.noop,fn:it.program(18,_,t),data:t},i=n.isNotEmpty||e.isNotEmpty,o=i?i.call(e,e.body,a):tt.call(e,"isNotEmpty",e.body,a),(o||0===o)&&(s+=o),s+="\n </div>\n </div>\n"}function _(e,t){var i,o,a,s="";return s+='\n <div class="post-image-caption">\n <div class="post-image-caption-text">\n ',a={hash:{},inverse:it.noop,fn:it.program(19,v,t),data:t},i=n.compare||e.compare,o=i?i.call(e,e.originality_text,"reply",a):tt.call(e,"compare",e.originality_text,"reply",a),(o||0===o)&&(s+=o),s+="\n ",a={hash:{operator:"!="},inverse:it.noop,fn:it.program(21,y,t),data:t},i=n.compare||e.compare,o=i?i.call(e,e.originality_text,"reshare",a):tt.call(e,"compare",e.originality_text,"reshare",a),(o||0===o)&&(s+=o),s+="\n </div>\n </div>\n "}function v(e,t){var i,o,a,s="";return s+="\n ",a={hash:{},data:t},s+=nt((i=n.translate||e.translate,i?i.call(e,"post|reply",a):tt.call(e,"translate","post|reply",a)))+":&nbsp;\n ",(o=n.body)?o=o.call(e,{hash:{},data:t}):(o=e.body,o=typeof o===ot?o.apply(e):o),(o||0===o)&&(s+=o),s+="\n "}function y(e,t){var i,o="";return o+="\n ",(i=n.body)?i=i.call(e,{hash:{},data:t}):(i=e.body,i=typeof i===ot?i.apply(e):i),(i||0===i)&&(o+=i),o+="\n "}function w(e,t){var i,o,a,s="";return s+='\n <div class="post-body">\n ',a={hash:{},inverse:it.noop,fn:it.program(24,b,t),data:t},i=n.isNotEmpty||e.isNotEmpty,o=i?i.call(e,e.body,a):tt.call(e,"isNotEmpty",e.body,a),(o||0===o)&&(s+=o),s+='\n </div>\n <div class="post-meta-wrapper">\n <div class="post-meta clearfix">\n ',a={hash:{},inverse:it.noop,fn:it.program(29,C,t),data:t},i=n.withFirst||e.withFirst,o=i?i.call(e,(i=e.media,null==i||i===!1?i:i.links),a):tt.call(e,"withFirst",(i=e.media,null==i||i===!1?i:i.links),a),(o||0===o)&&(s+=o),s+="\n </div>\n </div>\n"}function b(e,t){var i,o,a,s="";return s+='\n <div class="post-text">\n ',a={hash:{},inverse:it.noop,fn:it.program(25,x,t),data:t},i=n.compare||e.compare,o=i?i.call(e,e.originality_text,"reply",a):tt.call(e,"compare",e.originality_text,"reply",a),(o||0===o)&&(s+=o),s+="\n ",a={hash:{},inverse:it.noop,fn:it.program(27,k,t),data:t},i=n.compare||e.compare,o=i?i.call(e,e.originality_text,"reshare",a):tt.call(e,"compare",e.originality_text,"reshare",a),(o||0===o)&&(s+=o),s+="\n ",(o=n.body)?o=o.call(e,{hash:{},data:t}):(o=e.body,o=typeof o===ot?o.apply(e):o),(o||0===o)&&(s+=o),s+="\n </div>\n "}function x(e,t){var i,o,a="";return a+='\n <span class="post-originality-text">',o={hash:{},data:t},a+=nt((i=n.translate||e.translate,i?i.call(e,"post|reply",o):tt.call(e,"translate","post|reply",o)))+"</span>&nbsp;\n "}function k(e,t){var i,o,a="";return a+='\n <span class="post-originality-text">',o={hash:{},data:t},a+=nt((i=n.translate||e.translate,i?i.call(e,"post|shared",o):tt.call(e,"translate","post|shared",o)))+"</span>&nbsp;\n "}function C(e,t){var i,o,a,s="";return s+="\n ",a={hash:{},inverse:it.noop,fn:it.program(30,E,t),data:t},i=n.isNotEmpty||e.isNotEmpty,o=i?i.call(e,e.image,a):tt.call(e,"isNotEmpty",e.image,a),(o||0===o)&&(s+=o),s+='\n <div class="post-meta-details">\n ',a={hash:{},inverse:it.program(34,S,t),fn:it.program(32,T,t),data:t},i=n.isNotEmpty||e.isNotEmpty,o=i?i.call(e,e.title,a):tt.call(e,"isNotEmpty",e.title,a),(o||0===o)&&(s+=o),s+="\n ",a={hash:{},inverse:it.noop,fn:it.program(36,P,t),data:t},i=n.isNotEmpty||e.isNotEmpty,o=i?i.call(e,e.url,a):tt.call(e,"isNotEmpty",e.url,a),(o||0===o)&&(s+=o),s+="\n ",a={hash:{},inverse:it.noop,fn:it.program(38,A,t),data:t},i=n.isNotEmpty||e.isNotEmpty,o=i?i.call(e,e.description,a):tt.call(e,"isNotEmpty",e.description,a),(o||0===o)&&(s+=o),s+="\n </div>\n "}function E(e,t){var i,o="";return o+='\n <div class="post-meta-thumbnail pull-left"><img src="',(i=n.image)?i=i.call(e,{hash:{},data:t}):(i=e.image,i=typeof i===ot?i.apply(e):i),o+=nt(i)+'"/></div>\n '}function T(e,t){var i,o="";return o+='\n <div class="post-meta-title"><a href="',(i=n.url)?i=i.call(e,{hash:{},data:t}):(i=e.url,i=typeof i===ot?i.apply(e):i),o+=nt(i)+'" target="mig33-new-window">',(i=n.title)?i=i.call(e,{hash:{},data:t}):(i=e.title,i=typeof i===ot?i.apply(e):i),o+=nt(i)+"</a></div>\n "}function S(e,t){var i,o="";return o+='\n <div class="post-meta-title"><a href="',(i=n.url)?i=i.call(e,{hash:{},data:t}):(i=e.url,i=typeof i===ot?i.apply(e):i),o+=nt(i)+'" target="mig33-new-window">',(i=n.url)?i=i.call(e,{hash:{},data:t}):(i=e.url,i=typeof i===ot?i.apply(e):i),o+=nt(i)+"</a></div>\n "}function P(e,t){var i,o="";return o+='\n <div class="post-meta-url"><a href="',(i=n.url)?i=i.call(e,{hash:{},data:t}):(i=e.url,i=typeof i===ot?i.apply(e):i),o+=nt(i)+'" target="mig33-new-window">',(i=n.url)?i=i.call(e,{hash:{},data:t}):(i=e.url,i=typeof i===ot?i.apply(e):i),o+=nt(i)+"</a></div>\n "}function A(e,t){var i,o,a="";return a+='\n <div class="post-meta-description">',o={hash:{},data:t},a+=nt((i=n.characterLimiter||e.characterLimiter,i?i.call(e,e.description,100,o):tt.call(e,"characterLimiter",e.description,100,o)))+"</div>\n "}function I(e,t){var i,o,a,s="";return s+='\n <div class="post-body">\n ',a={hash:{},inverse:it.noop,fn:it.program(41,$,t),data:t},i=n.isNotEmpty||e.isNotEmpty,o=i?i.call(e,(i=e.event,null==i||i===!1?i:i.title),a):tt.call(e,"isNotEmpty",(i=e.event,null==i||i===!1?i:i.title),a),(o||0===o)&&(s+=o),s+="\n </div>\n"}function $(e,t){var i,o,a,s="";return s+='\n <div class="post-text game-event-post">\n <table cellpadding="0" cellspacing="0" width="100%">\n <tr>\n <td valign="top">\n ',a={hash:{},inverse:it.noop,fn:it.program(42,N,t),data:t},i=n.isNotEmpty||e.isNotEmpty,o=i?i.call(e,(i=e.event,i=null==i||i===!1?i:i.media,i=null==i||i===!1?i:i.icon,null==i||i===!1?i:i.size_999),a):tt.call(e,"isNotEmpty",(i=e.event,i=null==i||i===!1?i:i.media,i=null==i||i===!1?i:i.icon,null==i||i===!1?i:i.size_999),a),(o||0===o)&&(s+=o),s+='\n </td>\n <td class="game-post-text" valign="top">\n ',a={hash:{},inverse:it.noop,fn:it.program(44,M,t),data:t},i=n.isNotEmpty||e.isNotEmpty,o=i?i.call(e,(i=e.event,i=null==i||i===!1?i:i.application,null==i||i===!1?i:i.title),a):tt.call(e,"isNotEmpty",(i=e.event,i=null==i||i===!1?i:i.application,null==i||i===!1?i:i.title),a),(o||0===o)&&(s+=o),s+="\n ",i=e.event,i=null==i||i===!1?i:i.title,o=typeof i===ot?i.apply(e):i,(o||0===o)&&(s+=o),s+='\n <br/><a href="'+nt((i=e.event,i=null==i||i===!1?i:i.custom_url,i=null==i||i===!1?i:i.ajax,typeof i===ot?i.apply(e):i))+'">',i=e.event,i=null==i||i===!1?i:i.template,i=null==i||i===!1?i:i.action_button_title,o=typeof i===ot?i.apply(e):i,(o||0===o)&&(s+=o),s+="</a><br/>\n ",a={hash:{},inverse:it.noop,fn:it.program(46,R,t),data:t},i=n.isNotEmpty||e.isNotEmpty,o=i?i.call(e,(i=e.event,i=null==i||i===!1?i:i.media,i=null==i||i===!1?i:i.image,null==i||i===!1?i:i.size_120),a):tt.call(e,"isNotEmpty",(i=e.event,i=null==i||i===!1?i:i.media,i=null==i||i===!1?i:i.image,null==i||i===!1?i:i.size_120),a),(o||0===o)&&(s+=o),s+="\n </td>\n </tr>\n </table>\n </div>\n "}function N(e){var t,n="";return n+='\n <div class="game-icon">\n <img src="'+nt((t=e.event,t=null==t||t===!1?t:t.media,t=null==t||t===!1?t:t.icon,t=null==t||t===!1?t:t.size_999,typeof t===ot?t.apply(e):t))+'?w=64&h=64"/>\n </div>\n '}function M(e){var t,n="";return n+='\n <strong><a href="'+nt((t=e.event,t=null==t||t===!1?t:t.application,t=null==t||t===!1?t:t.view,t=null==t||t===!1?t:t.ajax,typeof t===ot?t.apply(e):t))+'" class="game-title">'+nt((t=e.event,t=null==t||t===!1?t:t.application,t=null==t||t===!1?t:t.title,typeof t===ot?t.apply(e):t))+"</a></strong><br/>\n "}function R(e){var t,n="";return n+='\n <div class="post-meta-thumbnail">\n <a href="'+nt((t=e.event,t=null==t||t===!1?t:t.custom_url,t=null==t||t===!1?t:t.ajax,typeof t===ot?t.apply(e):t))+'"><img src="'+nt((t=e.event,t=null==t||t===!1?t:t.media,t=null==t||t===!1?t:t.image,t=null==t||t===!1?t:t.size_120,typeof t===ot?t.apply(e):t))+'"/></a>\n </div>\n '}function j(e,t){var i,o,a,s="";return s+='\n <div class="post-body">\n ',a={hash:{},inverse:it.noop,fn:it.program(24,b,t),data:t},i=n.isNotEmpty||e.isNotEmpty,o=i?i.call(e,e.body,a):tt.call(e,"isNotEmpty",e.body,a),(o||0===o)&&(s+=o),s+="\n </div>\n"}function O(e,t){var i,o,a,s="";return s+='\n <div class="post-meta-wrapper">\n <div class="post-meta clearfix">\n <div class="post-meta-author">\n <a href="'+nt((i=e.root_post,i=null==i||i===!1?i:i.author,i=null==i||i===!1?i:i.personalized_url,typeof i===ot?i.apply(e):i))+'" title="'+nt((i=e.root_post,i=null==i||i===!1?i:i.author,i=null==i||i===!1?i:i.username,typeof i===ot?i.apply(e):i))+'">'+nt((i=e.root_post,i=null==i||i===!1?i:i.author,i=null==i||i===!1?i:i.username,typeof i===ot?i.apply(e):i))+"</a> ",a={hash:{},data:t},s+=nt((i=n.userGetLabels||e.userGetLabels,i?i.call(e,"root_post.author","16",a):tt.call(e,"userGetLabels","root_post.author","16",a)))+"\n </div>\n "+"\n ",a={hash:{},inverse:it.noop,fn:it.program(51,D,t),data:t},i=n.compare||e.compare,o=i?i.call(e,(i=e.root_post,null==i||i===!1?i:i.type_text),"photo",a):tt.call(e,"compare",(i=e.root_post,null==i||i===!1?i:i.type_text),"photo",a),(o||0===o)&&(s+=o),s+='\n <div class="post-meta-details">\n ',a={hash:{},inverse:it.noop,fn:it.program(55,z,t),data:t},i=n.isNotEmpty||e.isNotEmpty,o=i?i.call(e,(i=e.root_post,null==i||i===!1?i:i.body),a):tt.call(e,"isNotEmpty",(i=e.root_post,null==i||i===!1?i:i.body),a),(o||0===o)&&(s+=o),s+="\n </div>\n </div>\n </div>\n"}function D(e,t){var i,o,a,s="";return s+="\n ",a={hash:{},inverse:it.noop,fn:it.program(52,H,t),data:t},i=n.compare||e.compare,o=i?i.call(e,(i=e.root_post,i=null==i||i===!1?i:i.media,i=null==i||i===!1?i:i.photo,null==i||i===!1?i:i.type),"mig33",a):tt.call(e,"compare",(i=e.root_post,i=null==i||i===!1?i:i.media,i=null==i||i===!1?i:i.photo,null==i||i===!1?i:i.type),"mig33",a),(o||0===o)&&(s+=o),s+="\n "}function H(e,t){var i,o,a,s="";return s+="\n ",a={hash:{},inverse:it.noop,fn:it.program(53,L,t),data:t},i=n.isNotEmpty||e.isNotEmpty,o=i?i.call(e,(i=e.root_post,null==i||i===!1?i:i.body),a):tt.call(e,"isNotEmpty",(i=e.root_post,null==i||i===!1?i:i.body),a),(o||0===o)&&(s+=o),s+="\n "}function L(e,t){var i,o,a="";return a+='\n <div class="post-meta-thumbnail pull-left"><img src="',o={hash:{},data:t},a+=nt((i=n.fn_post_get_small_image||e.fn_post_get_small_image,i?i.call(e,e.root_post,o):tt.call(e,"fn_post_get_small_image",e.root_post,o)))+'"/></div>\n '}function z(e){var t,n,i="";return i+='\n <div class="post-meta-description">',t=e.root_post,t=null==t||t===!1?t:t.body,n=typeof t===ot?t.apply(e):t,(n||0===n)&&(i+=n),i+="</div>\n "}function q(e,t){var i,o,a="";return a+='\n <div class="post-originality">\n <div class="post-parent-details">\n ',o={hash:{},data:t},a+=nt((i=n.translate||e.translate,i?i.call(e,"post|originally_posted_by",o):tt.call(e,"translate","post|originally_posted_by",o)))+'\n <a href="'+nt((i=e.root_post,i=null==i||i===!1?i:i.author,i=null==i||i===!1?i:i.personalized_url,typeof i===ot?i.apply(e):i))+'" title="'+nt((i=e.root_post,i=null==i||i===!1?i:i.author,i=null==i||i===!1?i:i.username,typeof i===ot?i.apply(e):i))+'">'+nt((i=e.root_post,i=null==i||i===!1?i:i.author,i=null==i||i===!1?i:i.username,typeof i===ot?i.apply(e):i))+'</a>\n &nbsp;\n <a href="'+nt((i=e.root_post,i=null==i||i===!1?i:i.permalink,typeof i===ot?i.apply(e):i))+'" title="'+nt((i=e.root_post,i=null==i||i===!1?i:i.timestamp_relative,typeof i===ot?i.apply(e):i))+'">'+nt((i=e.root_post,i=null==i||i===!1?i:i.timestamp_relative,typeof i===ot?i.apply(e):i))+"</a>\n </div>\n </div>\n"}function U(e,t){var i;return(i=n.num_of_replies)?i=i.call(e,{hash:{},data:t}):(i=e.num_of_replies,i=typeof i===ot?i.apply(e):i),nt(i)}function W(){return"0"}function F(e,t){var i;return(i=n.num_of_reshares)?i=i.call(e,{hash:{},data:t}):(i=e.num_of_reshares,i=typeof i===ot?i.apply(e):i),nt(i)}function G(e,t){var i,o,a="";return a+='\n <i class="ico ico-18" style="background:top left no-repeat url(\'',o={hash:{},data:t},a+=nt((i=n.getUrl||e.getUrl,i?i.call(e,"cdn",o):tt.call(e,"getUrl","cdn",o)))+"/"+nt((i=e.tag_entity,i=null==i||i===!1?i:i.requesting_user_tag_id,i=null==i||i===!1?i:i.image,i=null==i||i===!1?i:i.size_16,typeof i===ot?i.apply(e):i))+"')\" />\n "}function B(){return'\n <i class="ico ico-18 ico-tile-view ico-emotes"></i>\n '}function V(e){var t;return nt((t=e.tag_entity,t=null==t||t===!1?t:t.total_count,typeof t===ot?t.apply(e):t))}function Y(e,t){var i,o="";return o+="\n \n <li>\n ",i=n["if"].call(e,e.is_watching,{hash:{},inverse:it.program(74,Q,t),fn:it.program(72,K,t),data:t}),(i||0===i)&&(o+=i),o+="\n </li>\n "}function K(e,t){var i,o,a="";return a+='\n <a href="#" onclick="return false;" class="watch-post detail-ico" title="',o={hash:{},data:t},a+=nt((i=n.translate||e.translate,i?i.call(e,"post|unsubscribe",o):tt.call(e,"translate","post|unsubscribe",o)))+'"><i class="ico ico-18 ico-tile-view ico-watched"></i>&nbsp;</a>\n '}function Q(e,t){var i,o,a="";return a+='\n <a href="#" onclick="return false;" class="watch-post detail-ico" title="',o={hash:{},data:t},a+=nt((i=n.translate||e.translate,i?i.call(e,"post|subscribe",o):tt.call(e,"translate","post|subscribe",o)))+'"><i class="ico ico-18 ico-tile-view ico-watch"></i>&nbsp;</a>\n '}this.compilerInfo=[4,">= 1.0.0"],n=this.merge(n,e.helpers),o=o||{};var X,J,Z,et="",tt=n.helperMissing,nt=this.escapeExpression,it=this,ot="function",at=n.blockHelperMissing;return et+='<div class="post-header clearfix">\n <div class="post-authortime">\n <div class="post-author-avatar pull-left"><img src="',Z={hash:{},data:o},et+=nt((X=n.getDisplayPictureUrl||t.getDisplayPictureUrl,X?X.call(t,(X=t.author,null==X||X===!1?X:X.username),(X=t.author,null==X||X===!1?X:X.type),24,24,Z):tt.call(t,"getDisplayPictureUrl",(X=t.author,null==X||X===!1?X:X.username),(X=t.author,null==X||X===!1?X:X.type),24,24,Z)))+'"/></div>\n <div class="post-author-details pull-left">\n <div class="post-author">\n <a href="'+nt((X=t.author,X=null==X||X===!1?X:X.personalized_url,typeof X===ot?X.apply(t):X))+'" title="'+nt((X=t.author,X=null==X||X===!1?X:X.username,typeof X===ot?X.apply(t):X))+'">'+nt((X=t.author,X=null==X||X===!1?X:X.username,typeof X===ot?X.apply(t):X))+"</a> ",Z={hash:{},data:o},et+=nt((X=n.userGetLabels||t.userGetLabels,X?X.call(t,"author","14",Z):tt.call(t,"userGetLabels","author","14",Z)))+'\n </div>\n <div class="post-time" data-timestamp="',(J=n.timestamp)?J=J.call(t,{hash:{},data:o}):(J=t.timestamp,J=typeof J===ot?J.apply(t):J),et+=nt(J)+'">\n <a href="',(J=n.permalink)?J=J.call(t,{hash:{},data:o}):(J=t.permalink,J=typeof J===ot?J.apply(t):J),et+=nt(J)+'" title="',(J=n.timestamp_relative)?J=J.call(t,{hash:{},data:o}):(J=t.timestamp_relative,J=typeof J===ot?J.apply(t):J),et+=nt(J)+'">',(J=n.timestamp_relative)?J=J.call(t,{hash:{},data:o}):(J=t.timestamp_relative,J=typeof J===ot?J.apply(t):J),et+=nt(J)+" via ",(J=n.application_text)?J=J.call(t,{hash:{},data:o}):(J=t.application_text,J=typeof J===ot?J.apply(t):J),et+=nt(J)+"</a>\n </div>\n </div>\n </div>\n </div>\n</div>\n\n"+"\n",Z={hash:{},inverse:it.noop,fn:it.program(1,a,o),data:o},X=n.compare||t.compare,J=X?X.call(t,t.type_text,"photo",Z):tt.call(t,"compare",t.type_text,"photo",Z),(J||0===J)&&(et+=J),et+="\n\n\n",Z={hash:{},inverse:it.noop,fn:it.program(17,g,o),data:o},X=n.compare||t.compare,J=X?X.call(t,t.type_text,"video",Z):tt.call(t,"compare",t.type_text,"video",Z),(J||0===J)&&(et+=J),et+="\n\n\n",Z={hash:{},inverse:it.noop,fn:it.program(23,w,o),data:o},X=n.compare||t.compare,J=X?X.call(t,t.type_text,"link",Z):tt.call(t,"compare",t.type_text,"link",Z),(J||0===J)&&(et+=J),et+="\n\n\n",Z={hash:{},inverse:it.noop,fn:it.program(40,I,o),data:o},X=n.compare||t.compare,J=X?X.call(t,t.type_text,"event",Z):tt.call(t,"compare",t.type_text,"event",Z),(J||0===J)&&(et+=J),et+="\n\n\n",Z={hash:{},inverse:it.noop,fn:it.program(48,j,o),data:o},X=n.compare||t.compare,J=X?X.call(t,t.type_text,"text",Z):tt.call(t,"compare",t.type_text,"text",Z),(J||0===J)&&(et+=J),et+="\n\n\n",Z={hash:{},inverse:it.noop,fn:it.program(50,O,o),data:o},(J=n.ifCanShowRootPost)?J=J.call(t,Z):(J=t.ifCanShowRootPost,J=typeof J===ot?J.apply(t):J),n.ifCanShowRootPost||(J=at.call(t,J,Z)),(J||0===J)&&(et+=J),et+="\n\n",Z={hash:{},inverse:it.noop,fn:it.program(57,q,o),data:o},X=n.compare||t.compare,J=X?X.call(t,t.originality_text,"reshare",Z):tt.call(t,"compare",t.originality_text,"reshare",Z),(J||0===J)&&(et+=J),et+='\n\n\n<div class="post-footer">\n <div class="post-reactions">\n <ul>\n \n <li>\n <a href="',(J=n.permalink)?J=J.call(t,{hash:{},data:o}):(J=t.permalink,J=typeof J===ot?J.apply(t):J),et+=nt(J)+'" class="detail-ico" title="',Z={hash:{},data:o},et+=nt((X=n.translate||t.translate,X?X.call(t,"post|replies",Z):tt.call(t,"translate","post|replies",Z)))+'">\n <i class="ico ico-18 ico-tile-view ico-replies"></i>\n <span class="count">',J=n["if"].call(t,t.num_of_replies,{hash:{},inverse:it.program(61,W,o),fn:it.program(59,U,o),data:o}),(J||0===J)&&(et+=J),et+='</span>\n </a>\n </li>\n \n <li>\n <a href="',(J=n.permalink)?J=J.call(t,{hash:{},data:o}):(J=t.permalink,J=typeof J===ot?J.apply(t):J),et+=nt(J)+'" class="detail-ico" title="',Z={hash:{},data:o},et+=nt((X=n.translate||t.translate,X?X.call(t,"post|reposts",Z):tt.call(t,"translate","post|reposts",Z)))+'">\n <i class="ico ico-18 ico-tile-view ico-reposts"></i>\n <span class="count">',J=n["if"].call(t,t.num_of_reshares,{hash:{},inverse:it.program(61,W,o),fn:it.program(63,F,o),data:o}),(J||0===J)&&(et+=J),et+='</span>\n </a>\n </li>\n \n <li>\n <a href="',(J=n.permalink)?J=J.call(t,{hash:{},data:o}):(J=t.permalink,J=typeof J===ot?J.apply(t):J),et+=nt(J)+'" class="detail-ico" title="',Z={hash:{},data:o},et+=nt((X=n.translate||t.translate,X?X.call(t,"homefeed|emotions",Z):tt.call(t,"translate","homefeed|emotions",Z)))+'">\n ',J=n["if"].call(t,(X=t.tag_entity,X=null==X||X===!1?X:X.requesting_user_tag_id,null==X||X===!1?X:X.tag_id),{hash:{},inverse:it.program(67,B,o),fn:it.program(65,G,o),data:o}),(J||0===J)&&(et+=J),et+='\n <span class="count">',J=n["if"].call(t,t.tag_entity,{hash:{},inverse:it.program(61,W,o),fn:it.program(69,V,o),data:o}),(J||0===J)&&(et+=J),et+="</span>\n </a>\n </li>\n ",Z={hash:{},inverse:it.noop,fn:it.program(71,Y,o),data:o},(J=n.ifLoggedIn)?J=J.call(t,Z):(J=t.ifLoggedIn,J=typeof J===ot?J.apply(t):J),n.ifLoggedIn||(J=at.call(t,J,Z)),(J||0===J)&&(et+=J),et+="\n </ul>\n</div>\n</div>"})}),define("hbs!modules/template/homefeed/post-feed-view",["handlebars"],function(e){return e.template(function(e,t,n,i,o){function a(e,t){var i,o,a,r="";return r+='\n <div class="post-body">\n <div class="post-text">\n ',a={hash:{},inverse:vt.noop,fn:vt.program(2,s,t),data:t},i=n.compare||e.compare,o=i?i.call(e,e.originality_text,"reshare",a):gt.call(e,"compare",e.originality_text,"reshare",a),(o||0===o)&&(r+=o),r+="\n </div>\n </div>\n"}function s(e,t){var i,o,a="";return a+='\n <span class="post-originality-text">',o={hash:{},data:t},a+=_t((i=n.translate||e.translate,i?i.call(e,"post|shared",o):gt.call(e,"translate","post|shared",o)))+"</span>&nbsp;\n "}function r(e,t){var i,o,a,s="";return s+="\n \n ",a={hash:{},inverse:vt.noop,fn:vt.program(5,l,t),data:t},i=n.compare||e.compare,o=i?i.call(e,e.type_text,"photo",a):gt.call(e,"compare",e.type_text,"photo",a),(o||0===o)&&(s+=o),s+="\n\n \n ",a={hash:{},inverse:vt.noop,fn:vt.program(14,f,t),data:t},i=n.compare||e.compare,o=i?i.call(e,e.type_text,"video",a):gt.call(e,"compare",e.type_text,"video",a),(o||0===o)&&(s+=o),s+="\n\n \n ",a={hash:{},inverse:vt.noop,fn:vt.program(19,_,t),data:t},i=n.compare||e.compare,o=i?i.call(e,e.type_text,"link",a):gt.call(e,"compare",e.type_text,"link",a),(o||0===o)&&(s+=o),s+="\n\n \n ",a={hash:{},inverse:vt.noop,fn:vt.program(31,C,t),data:t},i=n.compare||e.compare,o=i?i.call(e,e.type_text,"event",a):gt.call(e,"compare",e.type_text,"event",a),(o||0===o)&&(s+=o),s+="\n\n \n ",a={hash:{},inverse:vt.noop,fn:vt.program(39,A,t),data:t},i=n.compare||e.compare,o=i?i.call(e,e.type_text,"text",a):gt.call(e,"compare",e.type_text,"text",a),(o||0===o)&&(s+=o),s+="\n"}function l(e,t){var i,o,a,s="";return s+='\n <div class="post-body">\n ',a={hash:{},inverse:vt.noop,fn:vt.program(6,c,t),data:t},i=n.isNotEmpty||e.isNotEmpty,o=i?i.call(e,e.body,a):gt.call(e,"isNotEmpty",e.body,a),(o||0===o)&&(s+=o),s+='\n <div class="post-image">\n \n ',a={hash:{},inverse:vt.program(12,p,t),fn:vt.program(9,h,t),data:t},i=n.compare||e.compare,o=i?i.call(e,(i=e.media,i=null==i||i===!1?i:i.photo,null==i||i===!1?i:i.type),"link",a):gt.call(e,"compare",(i=e.media,i=null==i||i===!1?i:i.photo,null==i||i===!1?i:i.type),"link",a),(o||0===o)&&(s+=o),s+="\n </div>\n </div>\n "}function c(e,t){var i,o,a,s="";return s+='\n <div class="post-text">\n ',a={hash:{},inverse:vt.noop,fn:vt.program(7,u,t),data:t},i=n.compare||e.compare,o=i?i.call(e,e.originality_text,"reply",a):gt.call(e,"compare",e.originality_text,"reply",a),(o||0===o)&&(s+=o),s+="\n ",(o=n.body)?o=o.call(e,{hash:{},data:t}):(o=e.body,o=typeof o===yt?o.apply(e):o),(o||0===o)&&(s+=o),s+="\n </div>\n "}function u(e,t){var i,o,a="";return a+='\n <span class="post-originality-text">',o={hash:{},data:t},a+=_t((i=n.translate||e.translate,i?i.call(e,"post|reply",o):gt.call(e,"translate","post|reply",o)))+"</span>&nbsp;\n "}function h(e,t){var i,o,a,s="";return s+="\n ",a={hash:{},inverse:vt.noop,fn:vt.program(10,d,t),data:t},i=n.isNotEmpty||e.isNotEmpty,o=i?i.call(e,(i=e.media,i=null==i||i===!1?i:i.photo,i=null==i||i===!1?i:i.url,null==i||i===!1?i:i.original),a):gt.call(e,"isNotEmpty",(i=e.media,i=null==i||i===!1?i:i.photo,i=null==i||i===!1?i:i.url,null==i||i===!1?i:i.original),a),(o||0===o)&&(s+=o),s+="\n \n "}function d(e){var t,n="";return n+='\n <img src="'+_t((t=e.media,t=null==t||t===!1?t:t.photo,t=null==t||t===!1?t:t.url,t=null==t||t===!1?t:t.original,typeof t===yt?t.apply(e):t))+'" class="post-image-img"/>\n '}function p(e,t){var i,o="";return o+='\n <img src="',(i=n.fn_post_get_big_image)?i=i.call(e,{hash:{},data:t}):(i=e.fn_post_get_big_image,i=typeof i===yt?i.apply(e):i),o+=_t(i)+'" class="post-image-img"/>\n '}function f(e,t){var i,o,a,s="";return s+='\n <div class="post-body">\n ',a={hash:{},inverse:vt.noop,fn:vt.program(6,c,t),data:t},i=n.isNotEmpty||e.isNotEmpty,o=i?i.call(e,e.body,a):gt.call(e,"isNotEmpty",e.body,a),(o||0===o)&&(s+=o),s+='\n <div class="post-video">\n ',a={hash:{},inverse:vt.noop,fn:vt.program(15,m,t),data:t},i=n.compare||e.compare,o=i?i.call(e,(i=e.media,i=null==i||i===!1?i:i.video,null==i||i===!1?i:i.type),"youtube",a):gt.call(e,"compare",(i=e.media,i=null==i||i===!1?i:i.video,null==i||i===!1?i:i.type),"youtube",a),(o||0===o)&&(s+=o),s+="\n ",a={hash:{},inverse:vt.noop,fn:vt.program(15,m,t),data:t},i=n.compare||e.compare,o=i?i.call(e,(i=e.media,i=null==i||i===!1?i:i.video,null==i||i===!1?i:i.type),"vimeo",a):gt.call(e,"compare",(i=e.media,i=null==i||i===!1?i:i.video,null==i||i===!1?i:i.type),"vimeo",a),(o||0===o)&&(s+=o),s+="\n ",a={hash:{},inverse:vt.noop,fn:vt.program(17,g,t),data:t},i=n.compare||e.compare,o=i?i.call(e,(i=e.media,i=null==i||i===!1?i:i.video,null==i||i===!1?i:i.type),"flickr",a):gt.call(e,"compare",(i=e.media,i=null==i||i===!1?i:i.video,null==i||i===!1?i:i.type),"flickr",a),(o||0===o)&&(s+=o),s+="\n </div>\n </div>\n "}function m(e){var t,n="";return n+='\n <object class="post-video-object" type="application/x-shockwave-flash" data="'+_t((t=e.media,t=null==t||t===!1?t:t.video,t=null==t||t===!1?t:t.url,typeof t===yt?t.apply(e):t))+'">\n <param name="allowfullscreen" value="true"/>\n <param name="movie" value="'+_t((t=e.media,t=null==t||t===!1?t:t.video,t=null==t||t===!1?t:t.url,typeof t===yt?t.apply(e):t))+'"/>\n </object>\n '}function g(e,t){var i,o,a="";return a+='\n <object class="post-video-object" type="application/x-shockwave-flash"\n data="http://www.flickr.com/apps/slideshow/show.swf?v=71649">\n <param name="allowFullScreen" value="true"/>\n <param name="movie" value="http://www.flickr.com/apps/slideshow/show.swf?v=71649"/>\n <param name="flashvars"\n value="offsite=true&amp;lang=en-us&amp;page_show_url=',o={hash:{},data:t},a+=_t((i=n.fn_get_flickr_relative_url||e.fn_get_flickr_relative_url,i?i.call(e,(i=e.media,i=null==i||i===!1?i:i.video,null==i||i===!1?i:i.url),o):gt.call(e,"fn_get_flickr_relative_url",(i=e.media,i=null==i||i===!1?i:i.video,null==i||i===!1?i:i.url),o)))+"/show/&amp;page_show_back_url=",o={hash:{},data:t},a+=_t((i=n.fn_get_flickr_relative_url||e.fn_get_flickr_relative_url,i?i.call(e,(i=e.media,i=null==i||i===!1?i:i.video,null==i||i===!1?i:i.url),o):gt.call(e,"fn_get_flickr_relative_url",(i=e.media,i=null==i||i===!1?i:i.video,null==i||i===!1?i:i.url),o)))+"/&amp;set_id="+_t((i=e.media,i=null==i||i===!1?i:i.video,i=null==i||i===!1?i:i.id,typeof i===yt?i.apply(e):i))+'"/>\n </object>\n '}function _(e,t){var i,o,a,s="";return s+='\n <div class="post-body">\n ',a={hash:{},inverse:vt.noop,fn:vt.program(6,c,t),data:t},i=n.isNotEmpty||e.isNotEmpty,o=i?i.call(e,e.body,a):gt.call(e,"isNotEmpty",e.body,a),(o||0===o)&&(s+=o),s+='\n <div class="post-meta-wrapper">\n <div class="post-meta clearfix">\n ',a={hash:{},inverse:vt.noop,fn:vt.program(20,v,t),data:t},i=n.withFirst||e.withFirst,o=i?i.call(e,(i=e.media,null==i||i===!1?i:i.links),a):gt.call(e,"withFirst",(i=e.media,null==i||i===!1?i:i.links),a),(o||0===o)&&(s+=o),s+="\n </div>\n </div>\n </div>\n "}function v(e,t){var i,o,a,s="";return s+="\n ",a={hash:{},inverse:vt.noop,fn:vt.program(21,y,t),data:t},i=n.isNotEmpty||e.isNotEmpty,o=i?i.call(e,e.image,a):gt.call(e,"isNotEmpty",e.image,a),(o||0===o)&&(s+=o),s+='\n <div class="post-meta-details">\n ',a={hash:{},inverse:vt.program(25,b,t),fn:vt.program(23,w,t),data:t},i=n.isNotEmpty||e.isNotEmpty,o=i?i.call(e,e.title,a):gt.call(e,"isNotEmpty",e.title,a),(o||0===o)&&(s+=o),s+="\n ",a={hash:{},inverse:vt.noop,fn:vt.program(27,x,t),data:t},i=n.isNotEmpty||e.isNotEmpty,o=i?i.call(e,e.url,a):gt.call(e,"isNotEmpty",e.url,a),(o||0===o)&&(s+=o),s+="\n ",a={hash:{},inverse:vt.noop,fn:vt.program(29,k,t),data:t},i=n.isNotEmpty||e.isNotEmpty,o=i?i.call(e,e.description,a):gt.call(e,"isNotEmpty",e.description,a),(o||0===o)&&(s+=o),s+="\n </div>\n "}function y(e,t){var i,o="";return o+='\n <div class="post-meta-thumbnail pull-left"><img src="',(i=n.image)?i=i.call(e,{hash:{},data:t}):(i=e.image,i=typeof i===yt?i.apply(e):i),o+=_t(i)+'"/></div>\n '}function w(e,t){var i,o="";return o+='\n <div class="post-meta-title"><a href="',(i=n.url)?i=i.call(e,{hash:{},data:t}):(i=e.url,i=typeof i===yt?i.apply(e):i),o+=_t(i)+'" target="mig33-new-window">',(i=n.title)?i=i.call(e,{hash:{},data:t}):(i=e.title,i=typeof i===yt?i.apply(e):i),o+=_t(i)+"</a></div>\n "}function b(e,t){var i,o="";return o+='\n <div class="post-meta-title"><a href="',(i=n.url)?i=i.call(e,{hash:{},data:t}):(i=e.url,i=typeof i===yt?i.apply(e):i),o+=_t(i)+'" target="mig33-new-window">',(i=n.url)?i=i.call(e,{hash:{},data:t}):(i=e.url,i=typeof i===yt?i.apply(e):i),o+=_t(i)+"</a></div>\n "}function x(e,t){var i,o="";return o+='\n <div class="post-meta-url"><a href="',(i=n.url)?i=i.call(e,{hash:{},data:t}):(i=e.url,i=typeof i===yt?i.apply(e):i),o+=_t(i)+'" target="mig33-new-window">',(i=n.url)?i=i.call(e,{hash:{},data:t}):(i=e.url,i=typeof i===yt?i.apply(e):i),o+=_t(i)+"</a></div>\n "}function k(e,t){var i,o,a="";return a+='\n <div class="post-meta-description">',o={hash:{},data:t},a+=_t((i=n.characterLimiter||e.characterLimiter,i?i.call(e,e.description,100,o):gt.call(e,"characterLimiter",e.description,100,o)))+"</div>\n "}function C(e,t){var i,o,a,s="";return s+='\n <div class="post-body">\n ',a={hash:{},inverse:vt.noop,fn:vt.program(32,E,t),data:t},i=n.isNotEmpty||e.isNotEmpty,o=i?i.call(e,(i=e.event,null==i||i===!1?i:i.title),a):gt.call(e,"isNotEmpty",(i=e.event,null==i||i===!1?i:i.title),a),(o||0===o)&&(s+=o),s+="\n </div>\n "}function E(e,t){var i,o,a,s="";return s+='\n <div class="post-text game-event-post">\n <table cellpadding="0" cellspacing="0" width="100%">\n <tr>\n <td valign="top">\n ',a={hash:{},inverse:vt.noop,fn:vt.program(33,T,t),data:t},i=n.isNotEmpty||e.isNotEmpty,o=i?i.call(e,(i=e.event,i=null==i||i===!1?i:i.media,i=null==i||i===!1?i:i.icon,null==i||i===!1?i:i.size_999),a):gt.call(e,"isNotEmpty",(i=e.event,i=null==i||i===!1?i:i.media,i=null==i||i===!1?i:i.icon,null==i||i===!1?i:i.size_999),a),(o||0===o)&&(s+=o),s+='\n </td>\n <td class="game-post-text" valign="top">\n ',a={hash:{},inverse:vt.noop,fn:vt.program(35,S,t),data:t},i=n.isNotEmpty||e.isNotEmpty,o=i?i.call(e,(i=e.event,i=null==i||i===!1?i:i.application,null==i||i===!1?i:i.title),a):gt.call(e,"isNotEmpty",(i=e.event,i=null==i||i===!1?i:i.application,null==i||i===!1?i:i.title),a),(o||0===o)&&(s+=o),s+="\n ",i=e.event,i=null==i||i===!1?i:i.title,o=typeof i===yt?i.apply(e):i,(o||0===o)&&(s+=o),s+='\n <br/><a href="'+_t((i=e.event,i=null==i||i===!1?i:i.custom_url,i=null==i||i===!1?i:i.ajax,typeof i===yt?i.apply(e):i))+'">',i=e.event,i=null==i||i===!1?i:i.template,i=null==i||i===!1?i:i.action_button_title,o=typeof i===yt?i.apply(e):i,(o||0===o)&&(s+=o),s+="</a><br/>\n ",a={hash:{},inverse:vt.noop,fn:vt.program(37,P,t),data:t},i=n.isNotEmpty||e.isNotEmpty,o=i?i.call(e,(i=e.event,i=null==i||i===!1?i:i.media,i=null==i||i===!1?i:i.image,null==i||i===!1?i:i.size_120),a):gt.call(e,"isNotEmpty",(i=e.event,i=null==i||i===!1?i:i.media,i=null==i||i===!1?i:i.image,null==i||i===!1?i:i.size_120),a),(o||0===o)&&(s+=o),s+="\n </td>\n </tr>\n </table>\n </div>\n "
}function T(e){var t,n="";return n+='\n <div class="game-icon">\n <img src="'+_t((t=e.event,t=null==t||t===!1?t:t.media,t=null==t||t===!1?t:t.icon,t=null==t||t===!1?t:t.size_999,typeof t===yt?t.apply(e):t))+'?w=64&h=64"/>\n </div>\n '}function S(e){var t,n="";return n+='\n <strong><a href="'+_t((t=e.event,t=null==t||t===!1?t:t.application,t=null==t||t===!1?t:t.view,t=null==t||t===!1?t:t.ajax,typeof t===yt?t.apply(e):t))+'" class="game-title">'+_t((t=e.event,t=null==t||t===!1?t:t.application,t=null==t||t===!1?t:t.title,typeof t===yt?t.apply(e):t))+"</a></strong><br/>\n "}function P(e){var t,n="";return n+='\n <div class="post-meta-thumbnail">\n <a href="'+_t((t=e.event,t=null==t||t===!1?t:t.custom_url,t=null==t||t===!1?t:t.ajax,typeof t===yt?t.apply(e):t))+'"><img src="'+_t((t=e.event,t=null==t||t===!1?t:t.media,t=null==t||t===!1?t:t.image,t=null==t||t===!1?t:t.size_120,typeof t===yt?t.apply(e):t))+'"/></a>\n </div>\n '}function A(e,t){var i,o,a,s="";return s+="\n ",a={hash:{},inverse:vt.noop,fn:vt.program(40,I,t),data:t},i=n.isNotEmpty||e.isNotEmpty,o=i?i.call(e,e.body,a):gt.call(e,"isNotEmpty",e.body,a),(o||0===o)&&(s+=o),s+="\n "}function I(e,t){var i,o,a,s="";return s+='\n <div class="post-body">\n <div class="post-text">\n ',a={hash:{},inverse:vt.noop,fn:vt.program(41,$,t),data:t},i=n.compare||e.compare,o=i?i.call(e,e.originality_text,"reply",a):gt.call(e,"compare",e.originality_text,"reply",a),(o||0===o)&&(s+=o),s+="\n ",(o=n.body)?o=o.call(e,{hash:{},data:t}):(o=e.body,o=typeof o===yt?o.apply(e):o),(o||0===o)&&(s+=o),s+="\n </div>\n </div>\n "}function $(e,t){var i,o,a="";return a+='\n <span class="post-originality-text">',o={hash:{},data:t},a+=_t((i=n.translate||e.translate,i?i.call(e,"post|reply",o):gt.call(e,"translate","post|reply",o)))+"</span>&nbsp;\n "}function N(e,t){var i,o,a="";return a+="\n ",o=n["if"].call(e,(i=e.root_post,i=null==i||i===!1?i:i.author,null==i||i===!1?i:i.username),{hash:{},inverse:vt.noop,fn:vt.program(44,M,t),data:t}),(o||0===o)&&(a+=o),a+="\n"}function M(e,t){var i,o,a,s="";return s+='\n <div class="post-parent">\n \n <div class="post-header clearfix">\n <div class="post-authortime">\n <div class="post-author-avatar pull-left">\n <img src="',a={hash:{},data:t},s+=_t((i=n.getDisplayPictureUrl||e.getDisplayPictureUrl,i?i.call(e,(i=e.root_post,i=null==i||i===!1?i:i.author,null==i||i===!1?i:i.username),(i=e.root_post,i=null==i||i===!1?i:i.author,null==i||i===!1?i:i.type),24,24,a):gt.call(e,"getDisplayPictureUrl",(i=e.root_post,i=null==i||i===!1?i:i.author,null==i||i===!1?i:i.username),(i=e.root_post,i=null==i||i===!1?i:i.author,null==i||i===!1?i:i.type),24,24,a)))+'"/>\n </div>\n <div class="post-author-details pull-left">\n <div class="post-author">\n <a href="'+_t((i=e.root_post,i=null==i||i===!1?i:i.author,i=null==i||i===!1?i:i.personalized_url,typeof i===yt?i.apply(e):i))+'" title="'+_t((i=e.root_post,i=null==i||i===!1?i:i.author,i=null==i||i===!1?i:i.username,typeof i===yt?i.apply(e):i))+'">'+_t((i=e.root_post,i=null==i||i===!1?i:i.author,i=null==i||i===!1?i:i.username,typeof i===yt?i.apply(e):i))+"</a> ",a={hash:{},data:t},s+=_t((i=n.userGetLabels||e.userGetLabels,i?i.call(e,"root_post.author","16",a):gt.call(e,"userGetLabels","root_post.author","16",a)))+'\n </div>\n <div class="post-time" data-timestamp="'+_t((i=e.root_post,i=null==i||i===!1?i:i.timestamp,typeof i===yt?i.apply(e):i))+'">\n <a href="'+_t((i=e.root_post,i=null==i||i===!1?i:i.permalink,typeof i===yt?i.apply(e):i))+'" title="'+_t((i=e.root_post,i=null==i||i===!1?i:i.timestamp_relative,typeof i===yt?i.apply(e):i))+'">'+_t((i=e.root_post,i=null==i||i===!1?i:i.timestamp_relative,typeof i===yt?i.apply(e):i))+" via "+_t((i=e.root_post,i=null==i||i===!1?i:i.application_text,typeof i===yt?i.apply(e):i))+"</a>\n </div>\n </div>\n </div>\n </div>\n "+"\n ",a={hash:{},inverse:vt.noop,fn:vt.program(45,R,t),data:t},i=n.compare||e.compare,o=i?i.call(e,(i=e.root_post,null==i||i===!1?i:i.type_text),"photo",a):gt.call(e,"compare",(i=e.root_post,null==i||i===!1?i:i.type_text),"photo",a),(o||0===o)&&(s+=o),s+="\n\n \n ",a={hash:{},inverse:vt.noop,fn:vt.program(53,L,t),data:t},i=n.compare||e.compare,o=i?i.call(e,(i=e.root_post,null==i||i===!1?i:i.type_text),"video",a):gt.call(e,"compare",(i=e.root_post,null==i||i===!1?i:i.type_text),"video",a),(o||0===o)&&(s+=o),s+="\n\n \n ",a={hash:{},inverse:vt.noop,fn:vt.program(58,U,t),data:t},i=n.compare||e.compare,o=i?i.call(e,(i=e.root_post,null==i||i===!1?i:i.type_text),"link",a):gt.call(e,"compare",(i=e.root_post,null==i||i===!1?i:i.type_text),"link",a),(o||0===o)&&(s+=o),s+="\n\n \n ",a={hash:{},inverse:vt.noop,fn:vt.program(72,Q,t),data:t},i=n.compare||e.compare,o=i?i.call(e,(i=e.root_post,null==i||i===!1?i:i.type_text),"event",a):gt.call(e,"compare",(i=e.root_post,null==i||i===!1?i:i.type_text),"event",a),(o||0===o)&&(s+=o),s+="\n\n \n ",a={hash:{},inverse:vt.noop,fn:vt.program(80,tt,t),data:t},i=n.compare||e.compare,o=i?i.call(e,(i=e.root_post,null==i||i===!1?i:i.type_text),"text",a):gt.call(e,"compare",(i=e.root_post,null==i||i===!1?i:i.type_text),"text",a),(o||0===o)&&(s+=o),s+="\n </div>\n "}function R(e,t){var i,o,a,s="";return s+='\n <div class="post-body">\n ',a={hash:{},inverse:vt.noop,fn:vt.program(46,j,t),data:t},i=n.isNotEmpty||e.isNotEmpty,o=i?i.call(e,(i=e.root_post,null==i||i===!1?i:i.body),a):gt.call(e,"isNotEmpty",(i=e.root_post,null==i||i===!1?i:i.body),a),(o||0===o)&&(s+=o),s+='\n <div class="post-image">\n \n ',a={hash:{},inverse:vt.program(51,H,t),fn:vt.program(48,O,t),data:t},i=n.compare||e.compare,o=i?i.call(e,(i=e.root_post,i=null==i||i===!1?i:i.media,i=null==i||i===!1?i:i.photo,null==i||i===!1?i:i.type),"link",a):gt.call(e,"compare",(i=e.root_post,i=null==i||i===!1?i:i.media,i=null==i||i===!1?i:i.photo,null==i||i===!1?i:i.type),"link",a),(o||0===o)&&(s+=o),s+="\n </div>\n </div>\n "}function j(e){var t,n,i="";return i+='\n <div class="post-text">',t=e.root_post,t=null==t||t===!1?t:t.body,n=typeof t===yt?t.apply(e):t,(n||0===n)&&(i+=n),i+="</div>\n "}function O(e,t){var i,o,a,s="";return s+="\n ",a={hash:{},inverse:vt.noop,fn:vt.program(49,D,t),data:t},i=n.isNotEmpty||e.isNotEmpty,o=i?i.call(e,(i=e.root_post,i=null==i||i===!1?i:i.media,i=null==i||i===!1?i:i.photo,i=null==i||i===!1?i:i.url,null==i||i===!1?i:i.original),a):gt.call(e,"isNotEmpty",(i=e.root_post,i=null==i||i===!1?i:i.media,i=null==i||i===!1?i:i.photo,i=null==i||i===!1?i:i.url,null==i||i===!1?i:i.original),a),(o||0===o)&&(s+=o),s+="\n \n "}function D(e){var t,n="";return n+='\n <img src="'+_t((t=e.root_post,t=null==t||t===!1?t:t.media,t=null==t||t===!1?t:t.photo,t=null==t||t===!1?t:t.url,t=null==t||t===!1?t:t.original,typeof t===yt?t.apply(e):t))+'" class="post-image-img"/>\n '}function H(e,t){var i,o,a="";return a+='\n <img src="',o={hash:{},data:t},a+=_t((i=n.fn_post_get_big_image||e.fn_post_get_big_image,i?i.call(e,e.root_post,o):gt.call(e,"fn_post_get_big_image",e.root_post,o)))+'" class="post-image-img"/>\n '}function L(e,t){var i,o,a,s="";return s+='\n <div class="post-body">\n ',a={hash:{},inverse:vt.noop,fn:vt.program(46,j,t),data:t},i=n.isNotEmpty||e.isNotEmpty,o=i?i.call(e,(i=e.root_post,null==i||i===!1?i:i.body),a):gt.call(e,"isNotEmpty",(i=e.root_post,null==i||i===!1?i:i.body),a),(o||0===o)&&(s+=o),s+='\n <div class="post-video">\n ',a={hash:{},inverse:vt.noop,fn:vt.program(54,z,t),data:t},i=n.compare||e.compare,o=i?i.call(e,(i=e.root_post,i=null==i||i===!1?i:i.media,i=null==i||i===!1?i:i.video,null==i||i===!1?i:i.type),"youtube",a):gt.call(e,"compare",(i=e.root_post,i=null==i||i===!1?i:i.media,i=null==i||i===!1?i:i.video,null==i||i===!1?i:i.type),"youtube",a),(o||0===o)&&(s+=o),s+="\n ",a={hash:{},inverse:vt.noop,fn:vt.program(54,z,t),data:t},i=n.compare||e.compare,o=i?i.call(e,(i=e.root_post,i=null==i||i===!1?i:i.media,i=null==i||i===!1?i:i.video,null==i||i===!1?i:i.type),"vimeo",a):gt.call(e,"compare",(i=e.root_post,i=null==i||i===!1?i:i.media,i=null==i||i===!1?i:i.video,null==i||i===!1?i:i.type),"vimeo",a),(o||0===o)&&(s+=o),s+="\n ",a={hash:{},inverse:vt.noop,fn:vt.program(56,q,t),data:t},i=n.compare||e.compare,o=i?i.call(e,(i=e.root_post,i=null==i||i===!1?i:i.media,i=null==i||i===!1?i:i.video,null==i||i===!1?i:i.type),"flickr",a):gt.call(e,"compare",(i=e.root_post,i=null==i||i===!1?i:i.media,i=null==i||i===!1?i:i.video,null==i||i===!1?i:i.type),"flickr",a),(o||0===o)&&(s+=o),s+="\n </div>\n </div>\n "}function z(e){var t,n="";return n+='\n <object class="post-video-object" type="application/x-shockwave-flash"\n data="'+_t((t=e.root_post,t=null==t||t===!1?t:t.media,t=null==t||t===!1?t:t.video,t=null==t||t===!1?t:t.url,typeof t===yt?t.apply(e):t))+'">\n <param name="allowfullscreen" value="true"/>\n <param name="movie" value="'+_t((t=e.root_post,t=null==t||t===!1?t:t.media,t=null==t||t===!1?t:t.video,t=null==t||t===!1?t:t.url,typeof t===yt?t.apply(e):t))+'"/>\n </object>\n '}function q(e,t){var i,o,a="";return a+='\n <object class="post-video-object" type="application/x-shockwave-flash"\n data="http://www.flickr.com/apps/slideshow/show.swf?v=71649">\n <param name="allowFullScreen" value="true"/>\n <param name="movie" value="http://www.flickr.com/apps/slideshow/show.swf?v=71649"/>\n <param name="flashvars"\n value="offsite=true&amp;lang=en-us&amp;page_show_url=',o={hash:{},data:t},a+=_t((i=n.fn_get_flickr_relative_url||e.fn_get_flickr_relative_url,i?i.call(e,(i=e.root_post,i=null==i||i===!1?i:i.media,i=null==i||i===!1?i:i.video,null==i||i===!1?i:i.url),o):gt.call(e,"fn_get_flickr_relative_url",(i=e.root_post,i=null==i||i===!1?i:i.media,i=null==i||i===!1?i:i.video,null==i||i===!1?i:i.url),o)))+"/show/&amp;page_show_back_url=",o={hash:{},data:t},a+=_t((i=n.fn_get_flickr_relative_url||e.fn_get_flickr_relative_url,i?i.call(e,(i=e.root_post,i=null==i||i===!1?i:i.media,i=null==i||i===!1?i:i.video,null==i||i===!1?i:i.url),o):gt.call(e,"fn_get_flickr_relative_url",(i=e.root_post,i=null==i||i===!1?i:i.media,i=null==i||i===!1?i:i.video,null==i||i===!1?i:i.url),o)))+"/&amp;set_id="+_t((i=e.root_post,i=null==i||i===!1?i:i.media,i=null==i||i===!1?i:i.video,i=null==i||i===!1?i:i.id,typeof i===yt?i.apply(e):i))+'"/>\n </object>\n '}function U(e,t){var i,o,a,s="";return s+='\n <div class="post-body">\n ',a={hash:{},inverse:vt.noop,fn:vt.program(59,W,t),data:t},i=n.isNotEmpty||e.isNotEmpty,o=i?i.call(e,(i=e.root_post,null==i||i===!1?i:i.body),a):gt.call(e,"isNotEmpty",(i=e.root_post,null==i||i===!1?i:i.body),a),(o||0===o)&&(s+=o),s+='\n <div class="post-meta-wrapper">\n <div class="post-meta clearfix">\n ',a={hash:{},inverse:vt.noop,fn:vt.program(61,F,t),data:t},i=n.withFirst||e.withFirst,o=i?i.call(e,(i=e.root_post,i=null==i||i===!1?i:i.media,null==i||i===!1?i:i.links),a):gt.call(e,"withFirst",(i=e.root_post,i=null==i||i===!1?i:i.media,null==i||i===!1?i:i.links),a),(o||0===o)&&(s+=o),s+="\n </div>\n </div>\n </div>\n "}function W(e){var t,n,i="";return i+='\n <div class="post-text">',t=e.root_post,t=null==t||t===!1?t:t.body,n=typeof t===yt?t.apply(e):t,(n||0===n)&&(i+=n),i+=" </div>\n "}function F(e,t){var i,o,a,s="";return s+="\n ",a={hash:{},inverse:vt.noop,fn:vt.program(62,G,t),data:t},i=n.isNotEmpty||e.isNotEmpty,o=i?i.call(e,e.image,a):gt.call(e,"isNotEmpty",e.image,a),(o||0===o)&&(s+=o),s+='\n <div class="post-meta-details">\n ',a={hash:{},inverse:vt.program(66,V,t),fn:vt.program(64,B,t),data:t},i=n.isNotEmpty||e.isNotEmpty,o=i?i.call(e,e.title,a):gt.call(e,"isNotEmpty",e.title,a),(o||0===o)&&(s+=o),s+="\n ",a={hash:{},inverse:vt.noop,fn:vt.program(68,Y,t),data:t},i=n.isNotEmpty||e.isNotEmpty,o=i?i.call(e,e.url,a):gt.call(e,"isNotEmpty",e.url,a),(o||0===o)&&(s+=o),s+="\n ",a={hash:{},inverse:vt.noop,fn:vt.program(70,K,t),data:t},i=n.isNotEmpty||e.isNotEmpty,o=i?i.call(e,e.description,a):gt.call(e,"isNotEmpty",e.description,a),(o||0===o)&&(s+=o),s+="\n </div>\n "}function G(e,t){var i,o="";return o+='\n <div class="post-meta-thumbnail pull-left"><img src="',(i=n.image)?i=i.call(e,{hash:{},data:t}):(i=e.image,i=typeof i===yt?i.apply(e):i),o+=_t(i)+'"/></div>\n '}function B(e,t){var i,o="";return o+='\n <div class="post-meta-title"><a href="',(i=n.url)?i=i.call(e,{hash:{},data:t}):(i=e.url,i=typeof i===yt?i.apply(e):i),o+=_t(i)+'"\n target="mig33-new-window">',(i=n.title)?i=i.call(e,{hash:{},data:t}):(i=e.title,i=typeof i===yt?i.apply(e):i),o+=_t(i)+"</a></div>\n "}function V(e,t){var i,o="";return o+='\n <div class="post-meta-title"><a href="',(i=n.url)?i=i.call(e,{hash:{},data:t}):(i=e.url,i=typeof i===yt?i.apply(e):i),o+=_t(i)+'"\n target="mig33-new-window">',(i=n.url)?i=i.call(e,{hash:{},data:t}):(i=e.url,i=typeof i===yt?i.apply(e):i),o+=_t(i)+"</a></div>\n "}function Y(e,t){var i,o="";return o+='\n <div class="post-meta-url"><a href="',(i=n.url)?i=i.call(e,{hash:{},data:t}):(i=e.url,i=typeof i===yt?i.apply(e):i),o+=_t(i)+'"\n target="mig33-new-window">',(i=n.url)?i=i.call(e,{hash:{},data:t}):(i=e.url,i=typeof i===yt?i.apply(e):i),o+=_t(i)+"</a></div>\n "}function K(e,t){var i,o,a="";return a+='\n <div class="post-meta-description">',o={hash:{},data:t},a+=_t((i=n.characterLimiter||e.characterLimiter,i?i.call(e,e.description,100,o):gt.call(e,"characterLimiter",e.description,100,o)))+"</div>\n "}function Q(e,t){var i,o,a,s="";return s+='\n <div class="post-body">\n ',a={hash:{},inverse:vt.noop,fn:vt.program(73,X,t),data:t},i=n.isNotEmpty||e.isNotEmpty,o=i?i.call(e,(i=e.root_post,i=null==i||i===!1?i:i.event,null==i||i===!1?i:i.title),a):gt.call(e,"isNotEmpty",(i=e.root_post,i=null==i||i===!1?i:i.event,null==i||i===!1?i:i.title),a),(o||0===o)&&(s+=o),s+="\n </div>\n "}function X(e,t){var i,o,a,s="";return s+='\n <div class="post-text game-event-post">\n <table cellpadding="0" cellspacing="0" width="100%">\n <tr>\n <td valign="top">\n ',a={hash:{},inverse:vt.noop,fn:vt.program(74,J,t),data:t},i=n.isNotEmpty||e.isNotEmpty,o=i?i.call(e,(i=e.root_post,i=null==i||i===!1?i:i.event,i=null==i||i===!1?i:i.media,i=null==i||i===!1?i:i.icon,null==i||i===!1?i:i.size_999),a):gt.call(e,"isNotEmpty",(i=e.root_post,i=null==i||i===!1?i:i.event,i=null==i||i===!1?i:i.media,i=null==i||i===!1?i:i.icon,null==i||i===!1?i:i.size_999),a),(o||0===o)&&(s+=o),s+='\n </td>\n <td class="game-post-text" valign="top">\n ',a={hash:{},inverse:vt.noop,fn:vt.program(76,Z,t),data:t},i=n.isNotEmpty||e.isNotEmpty,o=i?i.call(e,(i=e.root_post,i=null==i||i===!1?i:i.event,i=null==i||i===!1?i:i.application,null==i||i===!1?i:i.title),a):gt.call(e,"isNotEmpty",(i=e.root_post,i=null==i||i===!1?i:i.event,i=null==i||i===!1?i:i.application,null==i||i===!1?i:i.title),a),(o||0===o)&&(s+=o),s+="\n ",i=e.root_post,i=null==i||i===!1?i:i.event,i=null==i||i===!1?i:i.title,o=typeof i===yt?i.apply(e):i,(o||0===o)&&(s+=o),s+='\n <br/><a\n href="'+_t((i=e.root_post,i=null==i||i===!1?i:i.event,i=null==i||i===!1?i:i.custom_url,i=null==i||i===!1?i:i.ajax,typeof i===yt?i.apply(e):i))+'">',i=e.root_post,i=null==i||i===!1?i:i.event,i=null==i||i===!1?i:i.template,i=null==i||i===!1?i:i.action_button_title,o=typeof i===yt?i.apply(e):i,(o||0===o)&&(s+=o),s+="</a><br/>\n ",a={hash:{},inverse:vt.noop,fn:vt.program(78,et,t),data:t},i=n.isNotEmpty||e.isNotEmpty,o=i?i.call(e,(i=e.root_post,i=null==i||i===!1?i:i.vent,i=null==i||i===!1?i:i.media,i=null==i||i===!1?i:i.image,null==i||i===!1?i:i.size_120),a):gt.call(e,"isNotEmpty",(i=e.root_post,i=null==i||i===!1?i:i.vent,i=null==i||i===!1?i:i.media,i=null==i||i===!1?i:i.image,null==i||i===!1?i:i.size_120),a),(o||0===o)&&(s+=o),s+="\n </td>\n </tr>\n </table>\n </div>\n "}function J(e){var t,n="";return n+='\n <div class="game-icon">\n <img src="'+_t((t=e.root_post,t=null==t||t===!1?t:t.event,t=null==t||t===!1?t:t.media,t=null==t||t===!1?t:t.icon,t=null==t||t===!1?t:t.size_999,typeof t===yt?t.apply(e):t))+'?w=64&h=64"/>\n </div>\n '}function Z(e){var t,n="";return n+='\n <strong><a href="'+_t((t=e.root_post,t=null==t||t===!1?t:t.event,t=null==t||t===!1?t:t.application,t=null==t||t===!1?t:t.view,t=null==t||t===!1?t:t.ajax,typeof t===yt?t.apply(e):t))+'"\n class="game-title">'+_t((t=e.root_post,t=null==t||t===!1?t:t.event,t=null==t||t===!1?t:t.application,t=null==t||t===!1?t:t.title,typeof t===yt?t.apply(e):t))+"</a></strong><br/>\n "}function et(e){var t,n="";return n+='\n <div class="post-meta-thumbnail">\n <a href="'+_t((t=e.root_post,t=null==t||t===!1?t:t.event,t=null==t||t===!1?t:t.custom_url,t=null==t||t===!1?t:t.ajax,typeof t===yt?t.apply(e):t))+'"><img\n src="'+_t((t=e.root_post,t=null==t||t===!1?t:t.event,t=null==t||t===!1?t:t.media,t=null==t||t===!1?t:t.image,t=null==t||t===!1?t:t.size_120,typeof t===yt?t.apply(e):t))+'"/></a>\n </div>\n '}function tt(e,t){var i,o,a,s="";return s+="\n ",a={hash:{},inverse:vt.noop,fn:vt.program(81,nt,t),data:t},i=n.isNotEmpty||e.isNotEmpty,o=i?i.call(e,(i=e.root_post,null==i||i===!1?i:i.body),a):gt.call(e,"isNotEmpty",(i=e.root_post,null==i||i===!1?i:i.body),a),(o||0===o)&&(s+=o),s+="\n "}function nt(e){var t,n,i="";return i+='\n <div class="post-body">\n <div class="post-text">',t=e.root_post,t=null==t||t===!1?t:t.body,n=typeof t===yt?t.apply(e):t,(n||0===n)&&(i+=n),i+="</div>\n </div>\n "}function it(e,t){var i;return(i=n.num_of_replies)?i=i.call(e,{hash:{},data:t}):(i=e.num_of_replies,i=typeof i===yt?i.apply(e):i),_t(i)}function ot(){return"0"}function at(e,t){var i;return(i=n.num_of_reshares)?i=i.call(e,{hash:{},data:t}):(i=e.num_of_reshares,i=typeof i===yt?i.apply(e):i),_t(i)}function st(e,t){var i,o,a="";return a+='\n <i class="ico ico-18" style="background:top left no-repeat url(\'',o={hash:{},data:t},a+=_t((i=n.getUrl||e.getUrl,i?i.call(e,"cdn",o):gt.call(e,"getUrl","cdn",o)))+"/"+_t((i=e.tag_entity,i=null==i||i===!1?i:i.requesting_user_tag_id,i=null==i||i===!1?i:i.image,i=null==i||i===!1?i:i.size_16,typeof i===yt?i.apply(e):i))+"')\"/>\n "}function rt(){return'\n <i class="ico ico-18 ico-emotes"></i>\n '}function lt(e){var t;return _t((t=e.tag_entity,t=null==t||t===!1?t:t.total_count,typeof t===yt?t.apply(e):t))}function ct(e,t){var i,o="";return o+="\n \n <li>\n ",i=n["if"].call(e,e.is_watching,{hash:{},inverse:vt.program(98,ht,t),fn:vt.program(96,ut,t),data:t}),(i||0===i)&&(o+=i),o+="\n </li>\n "}function ut(e,t){var i,o,a="";return a+='\n <a href="#" onclick="return false;" class="watch-post detail-ico" title="',o={hash:{},data:t},a+=_t((i=n.translate||e.translate,i?i.call(e,"post|unsubscribe",o):gt.call(e,"translate","post|unsubscribe",o)))+'"><i class="ico ico-18 ico-watched"></i>&nbsp;</a>\n '}function ht(e,t){var i,o,a="";return a+='\n <a href="#" onclick="return false;" class="watch-post detail-ico" title="',o={hash:{},data:t},a+=_t((i=n.translate||e.translate,i?i.call(e,"post|subscribe",o):gt.call(e,"translate","post|subscribe",o)))+'"><i class="ico ico-18 ico-watch"></i>&nbsp;</a>\n '}this.compilerInfo=[4,">= 1.0.0"],n=this.merge(n,e.helpers),o=o||{};var dt,pt,ft,mt="",gt=n.helperMissing,_t=this.escapeExpression,vt=this,yt="function",wt=n.blockHelperMissing;return mt+='<div class="post-header clearfix">\n <div class="post-authortime pull-left">\n <div class="post-author-avatar pull-left"><img src="',ft={hash:{},data:o},mt+=_t((dt=n.getDisplayPictureUrl||t.getDisplayPictureUrl,dt?dt.call(t,(dt=t.author,null==dt||dt===!1?dt:dt.username),(dt=t.author,null==dt||dt===!1?dt:dt.type),32,32,ft):gt.call(t,"getDisplayPictureUrl",(dt=t.author,null==dt||dt===!1?dt:dt.username),(dt=t.author,null==dt||dt===!1?dt:dt.type),32,32,ft)))+'"/></div>\n <div class="post-author-details pull-left">\n <div class="post-author">\n <a href="'+_t((dt=t.author,dt=null==dt||dt===!1?dt:dt.personalized_url,typeof dt===yt?dt.apply(t):dt))+'" title="'+_t((dt=t.author,dt=null==dt||dt===!1?dt:dt.username,typeof dt===yt?dt.apply(t):dt))+'">'+_t((dt=t.author,dt=null==dt||dt===!1?dt:dt.username,typeof dt===yt?dt.apply(t):dt))+"</a> ",ft={hash:{},data:o},mt+=_t((dt=n.userGetLabels||t.userGetLabels,dt?dt.call(t,"author","16",ft):gt.call(t,"userGetLabels","author","16",ft)))+'\n </div>\n <div class="post-time" data-timestamp="',(pt=n.timestamp)?pt=pt.call(t,{hash:{},data:o}):(pt=t.timestamp,pt=typeof pt===yt?pt.apply(t):pt),mt+=_t(pt)+'">\n <a href="',(pt=n.permalink)?pt=pt.call(t,{hash:{},data:o}):(pt=t.permalink,pt=typeof pt===yt?pt.apply(t):pt),mt+=_t(pt)+'" title="',(pt=n.timestamp_relative)?pt=pt.call(t,{hash:{},data:o}):(pt=t.timestamp_relative,pt=typeof pt===yt?pt.apply(t):pt),mt+=_t(pt)+'">',(pt=n.timestamp_relative)?pt=pt.call(t,{hash:{},data:o}):(pt=t.timestamp_relative,pt=typeof pt===yt?pt.apply(t):pt),mt+=_t(pt)+" via ",(pt=n.application_text)?pt=pt.call(t,{hash:{},data:o}):(pt=t.application_text,pt=typeof pt===yt?pt.apply(t):pt),mt+=_t(pt)+"</a>\n </div>\n </div>\n </div>\n</div>\n\n",ft={hash:{},inverse:vt.program(4,r,o),fn:vt.program(1,a,o),data:o},dt=n.compare||t.compare,pt=dt?dt.call(t,t.originality_text,"reshare",ft):gt.call(t,"compare",t.originality_text,"reshare",ft),(pt||0===pt)&&(mt+=pt),mt+="\n\n\n",ft={hash:{operator:">"},inverse:vt.noop,fn:vt.program(43,N,o),data:o},dt=n.compare||t.compare,pt=dt?dt.call(t,t.originality,1,ft):gt.call(t,"compare",t.originality,1,ft),(pt||0===pt)&&(mt+=pt),mt+='\n\n\n<div class="post-footer">\n <div class="post-reactions clearfix">\n <ul>\n \n <li>\n <a href="',(pt=n.permalink)?pt=pt.call(t,{hash:{},data:o}):(pt=t.permalink,pt=typeof pt===yt?pt.apply(t):pt),mt+=_t(pt)+'" class="detail-ico" title="',ft={hash:{},data:o},mt+=_t((dt=n.translate||t.translate,dt?dt.call(t,"post|replies",ft):gt.call(t,"translate","post|replies",ft)))+'">\n <i class="ico ico-18 ico-replies"></i>\n <span class="count">',pt=n["if"].call(t,t.num_of_replies,{hash:{},inverse:vt.program(85,ot,o),fn:vt.program(83,it,o),data:o}),(pt||0===pt)&&(mt+=pt),mt+='</span>\n </a>\n </li>\n \n <li>\n <a href="',(pt=n.permalink)?pt=pt.call(t,{hash:{},data:o}):(pt=t.permalink,pt=typeof pt===yt?pt.apply(t):pt),mt+=_t(pt)+'" class="detail-ico" title="',ft={hash:{},data:o},mt+=_t((dt=n.translate||t.translate,dt?dt.call(t,"post|reposts",ft):gt.call(t,"translate","post|reposts",ft)))+'">\n <i class="ico ico-18 ico-reposts"></i>\n <span class="count">',pt=n["if"].call(t,t.num_of_reshares,{hash:{},inverse:vt.program(85,ot,o),fn:vt.program(87,at,o),data:o}),(pt||0===pt)&&(mt+=pt),mt+='</span>\n </a>\n </li>\n \n <li>\n <a href="',(pt=n.permalink)?pt=pt.call(t,{hash:{},data:o}):(pt=t.permalink,pt=typeof pt===yt?pt.apply(t):pt),mt+=_t(pt)+'" class="detail-ico" title="',ft={hash:{},data:o},mt+=_t((dt=n.translate||t.translate,dt?dt.call(t,"homefeed|emotions",ft):gt.call(t,"translate","homefeed|emotions",ft)))+'">\n ',pt=n["if"].call(t,(dt=t.tag_entity,dt=null==dt||dt===!1?dt:dt.requesting_user_tag_id,null==dt||dt===!1?dt:dt.tag_id),{hash:{},inverse:vt.program(91,rt,o),fn:vt.program(89,st,o),data:o}),(pt||0===pt)&&(mt+=pt),mt+='\n <span class="count">',pt=n["if"].call(t,t.tag_entity,{hash:{},inverse:vt.program(85,ot,o),fn:vt.program(93,lt,o),data:o}),(pt||0===pt)&&(mt+=pt),mt+="</span>\n </a>\n </li>\n ",ft={hash:{},inverse:vt.noop,fn:vt.program(95,ct,o),data:o},(pt=n.ifLoggedIn)?pt=pt.call(t,ft):(pt=t.ifLoggedIn,pt=typeof pt===yt?pt.apply(t):pt),n.ifLoggedIn||(pt=wt.call(t,pt,ft)),(pt||0===pt)&&(mt+=pt),mt+='\n </ul>\n </div>\n</div>\n<div class="post-divider"></div>'})}),define("modules/view/homefeed/homefeed_post_item_view",["underscore","jquery","backbone","handlebars","backbone.marionette","marionette_handlebars","hbs!modules/template/homefeed/post-tile-view","hbs!modules/template/homefeed/post-feed-view","modules/common/config","modules/common/utility","modules/common/session_user","modules/template/helpers/general_helpers","modules/template/helpers/post_helpers"],function(e,t,n,i,o,a,s,r,l,c,u){var h=o.ItemView.extend({layoutType:"feed",showReplyInFeed:!0,getTemplate:function(){return"feed"==this.layoutType?{type:"handlebars",template:r}:{type:"handlebars",template:s}},initialize:function(t){this.layoutType=t.layoutType,e.bindAll(this)},id:function(){return"post-"+this.model.get("id")},className:function(){return p(this.model.toJSON())},events:{"click .post-body":"goToSinglePost","click .watch-post":"watchPost","click .post-tag > .ico-tag-mentioned":"goToMentions","click .post-tag > .ico-tag-watched":"goToWatchlist"},goToSinglePost:function(){if(u.getInstance().getLayoutType()===l.layoutType.tile)if("reshare"==this.model.get("originality_text")){var e=this.model.get("parent_post").permalink.replace(window.location.protocol+"//"+window.location.hostname,"");n.history.navigate(e,{trigger:!0})}else{var t=this.model.get("permalink").replace(window.location.protocol+"//"+window.location.hostname,"");n.history.navigate(t,{trigger:!0})}},goToMentions:function(){n.history.navigate("mentions",{trigger:!0})},goToWatchlist:function(){n.history.navigate("watchlist",{trigger:!0})},watchPost:function(){if(c.is_logged_in()){var e=t(".watch-post > i",this.$el);e.hasClass("ico-watched")?(this.model.unwatchPost(),e.next("span").text(c.translate("post|subscribe"))):(this.model.watchPost(),e.next("span").text(c.translate("post|subscribed"))),e.toggleClass("ico-watch ico-watched")}}}),d={width:500,height:600},p=function(e){var t="box";if(e.media&&null!==e.media){if(null!==e.media.photo){var n=e.media.photo.original_width,i=e.media.photo.original_height;0===n||0===i?null!==e.media.photo.url.size_480&&(t+=" box-horizontal"):n>=d.width&&i>=d.height?t+=" box-large":n>=d.width&&d.height>i?t+=" box-horizontal":d.width>n&&i>=d.height&&(t+=" box-vertical")}null!==e.media.video&&"vimeo"==e.media.video.type&&(t+=" box-horizontal")}return t+=1===e.originality?" box-original":2===e.originality?" box-reply":" box-reshare",t+=" box-"+e.type_text};return h}),function(e,t){var n,i=e.document,o=e.Modernizr,a=function(e){return e.charAt(0).toUpperCase()+e.slice(1)},s="Moz Webkit O Ms".split(" "),r=function(e){var t,n=i.documentElement.style;if("string"==typeof n[e])return e;e=a(e);for(var o=0,r=s.length;r>o;o++)if(t=s[o]+e,"string"==typeof n[t])return t},l=r("transform"),c=r("transitionProperty"),u={csstransforms:function(){return!!l},csstransforms3d:function(){var e=!!r("perspective");if(e){var n=" -o- -moz- -ms- -webkit- -khtml- ".split(" "),i="@media ("+n.join("transform-3d),(")+"modernizr)",o=t("<style>"+i+"{#modernizr{height:3px}}"+"</style>").appendTo("head"),a=t('<div id="modernizr" />').appendTo("html");e=3===a.height(),a.remove(),o.remove()}return e},csstransitions:function(){return!!c}};if(o)for(n in u)o.hasOwnProperty(n)||o.addTest(n,u[n]);else{o=e.Modernizr={_version:"1.6ish: miniModernizr for Isotope"};var h,d=" ";for(n in u)h=u[n](),o[n]=h,d+=" "+(h?"":"no-")+n;t("html").addClass(d)}if(o.csstransforms){var p=o.csstransforms3d?{translate:function(e){return"translate3d("+e[0]+"px, "+e[1]+"px, 0) "},scale:function(e){return"scale3d("+e+", "+e+", 1) "}}:{translate:function(e){return"translate("+e[0]+"px, "+e[1]+"px) "},scale:function(e){return"scale("+e+") "}},f=function(e,n,i){var o,a,s=t.data(e,"isoTransform")||{},r={},c={};r[n]=i,t.extend(s,r);for(o in s)a=s[o],c[o]=p[o](a);var u=c.translate||"",h=c.scale||"",d=u+h;t.data(e,"isoTransform",s),e.style[l]=d};t.cssNumber.scale=!0,t.cssHooks.scale={set:function(e,t){f(e,"scale",t)},get:function(e){var n=t.data(e,"isoTransform");return n&&n.scale?n.scale:1}},t.fx.step.scale=function(e){t.cssHooks.scale.set(e.elem,e.now+e.unit)},t.cssNumber.translate=!0,t.cssHooks.translate={set:function(e,t){f(e,"translate",t)},get:function(e){var n=t.data(e,"isoTransform");return n&&n.translate?n.translate:[0,0]}}}var m,g;o.csstransitions&&(m={WebkitTransitionProperty:"webkitTransitionEnd",MozTransitionProperty:"transitionend",OTransitionProperty:"oTransitionEnd otransitionend",transitionProperty:"transitionend"}[c],g=r("transitionDuration"));var _,v=t.event,y=t.event.handle?"handle":"dispatch";v.special.smartresize={setup:function(){t(this).bind("resize",v.special.smartresize.handler)},teardown:function(){t(this).unbind("resize",v.special.smartresize.handler)},handler:function(e,t){var n=this,i=arguments;e.type="smartresize",_&&clearTimeout(_),_=setTimeout(function(){v[y].apply(n,i)},"execAsap"===t?0:100)}},t.fn.smartresize=function(e){return e?this.bind("smartresize",e):this.trigger("smartresize",["execAsap"])},t.Isotope=function(e,n,i){this.element=t(n),this._create(e),this._init(i)};var w=["width","height"],b=t(e);t.Isotope.settings={resizable:!0,layoutMode:"masonry",containerClass:"isotope",itemClass:"isotope-item",hiddenClass:"isotope-hidden",hiddenStyle:{opacity:0,scale:.001},visibleStyle:{opacity:1,scale:1},containerStyle:{position:"relative",overflow:"hidden"},animationEngine:"best-available",animationOptions:{queue:!1,duration:800},sortBy:"original-order",sortAscending:!0,resizesContainer:!0,transformsEnabled:!0,itemPositionDataEnabled:!1},t.Isotope.prototype={_create:function(e){this.options=t.extend({},t.Isotope.settings,e),this.styleQueue=[],this.elemCount=0;var n=this.element[0].style;this.originalStyle={};var i=w.slice(0);for(var o in this.options.containerStyle)i.push(o);for(var a=0,s=i.length;s>a;a++)o=i[a],this.originalStyle[o]=n[o]||"";this.element.css(this.options.containerStyle),this._updateAnimationEngine(),this._updateUsingTransforms();var r={"original-order":function(e,t){return t.elemCount++,t.elemCount},random:function(){return Math.random()}};this.options.getSortData=t.extend(this.options.getSortData,r),this.reloadItems(),this.offset={left:parseInt(this.element.css("padding-left")||0,10),top:parseInt(this.element.css("padding-top")||0,10)};var l=this;setTimeout(function(){l.element.addClass(l.options.containerClass)},0),this.options.resizable&&b.bind("smartresize.isotope",function(){l.resize()}),this.element.delegate("."+this.options.hiddenClass,"click",function(){return!1})},_getAtoms:function(e){var t=this.options.itemSelector,n=t?e.filter(t).add(e.find(t)):e,i={position:"absolute"};return n=n.filter(function(e,t){return 1===t.nodeType}),this.usingTransforms&&(i.left=0,i.top=0),n.css(i).addClass(this.options.itemClass),this.updateSortData(n,!0),n},_init:function(e){this.$filteredAtoms=this._filter(this.$allAtoms),this._sort(),this.reLayout(e)
},option:function(e){if(t.isPlainObject(e)){this.options=t.extend(!0,this.options,e);var n;for(var i in e)n="_update"+a(i),this[n]&&this[n]()}},_updateAnimationEngine:function(){var e,t=this.options.animationEngine.toLowerCase().replace(/[ _\-]/g,"");switch(t){case"css":case"none":e=!1;break;case"jquery":e=!0;break;default:e=!o.csstransitions}this.isUsingJQueryAnimation=e,this._updateUsingTransforms()},_updateTransformsEnabled:function(){this._updateUsingTransforms()},_updateUsingTransforms:function(){var e=this.usingTransforms=this.options.transformsEnabled&&o.csstransforms&&o.csstransitions&&!this.isUsingJQueryAnimation;e||(delete this.options.hiddenStyle.scale,delete this.options.visibleStyle.scale),this.getPositionStyles=e?this._translate:this._positionAbs},_filter:function(e){var t=""===this.options.filter?"*":this.options.filter;if(!t)return e;var n=this.options.hiddenClass,i="."+n,o=e.filter(i),a=o;if("*"!==t){a=o.filter(t);var s=e.not(i).not(t).addClass(n);this.styleQueue.push({$el:s,style:this.options.hiddenStyle})}return this.styleQueue.push({$el:a,style:this.options.visibleStyle}),a.removeClass(n),e.filter(t)},updateSortData:function(e,n){var i,o,a=this,s=this.options.getSortData;e.each(function(){i=t(this),o={};for(var e in s)o[e]=n||"original-order"!==e?s[e](i,a):t.data(this,"isotope-sort-data")[e];t.data(this,"isotope-sort-data",o)})},_sort:function(){var e=this.options.sortBy,t=this._getSorter,n=this.options.sortAscending?1:-1,i=function(i,o){var a=t(i,e),s=t(o,e);return a===s&&"original-order"!==e&&(a=t(i,"original-order"),s=t(o,"original-order")),(a>s?1:s>a?-1:0)*n};this.$filteredAtoms.sort(i)},_getSorter:function(e,n){return t.data(e,"isotope-sort-data")[n]},_translate:function(e,t){return{translate:[e,t]}},_positionAbs:function(e,t){return{left:e,top:t}},_pushPosition:function(e,t,n){t=Math.round(t+this.offset.left),n=Math.round(n+this.offset.top);var i=this.getPositionStyles(t,n);this.styleQueue.push({$el:e,style:i}),this.options.itemPositionDataEnabled&&e.data("isotope-item-position",{x:t,y:n})},layout:function(e,t){var n=this.options.layoutMode;if(this["_"+n+"Layout"](e),this.options.resizesContainer){var i=this["_"+n+"GetContainerSize"]();this.styleQueue.push({$el:this.element,style:i})}this._processStyleQueue(e,t),this.isLaidOut=!0},_processStyleQueue:function(e,n){var i,a,s,r,l=this.isLaidOut?this.isUsingJQueryAnimation?"animate":"css":"css",c=this.options.animationOptions,u=this.options.onLayout;if(a=function(e,t){t.$el[l](t.style,c)},this._isInserting&&this.isUsingJQueryAnimation)a=function(e,t){i=t.$el.hasClass("no-transition")?"css":l,t.$el[i](t.style,c)};else if(n||u||c.complete){var h=!1,d=[n,u,c.complete],p=this;if(s=!0,r=function(){if(!h){for(var t,n=0,i=d.length;i>n;n++)t=d[n],"function"==typeof t&&t.call(p.element,e,p);h=!0}},this.isUsingJQueryAnimation&&"animate"===l)c.complete=r,s=!1;else if(o.csstransitions){for(var f,_=0,v=this.styleQueue[0],y=v&&v.$el;!y||!y.length;){if(f=this.styleQueue[_++],!f)return;y=f.$el}var w=parseFloat(getComputedStyle(y[0])[g]);w>0&&(a=function(e,t){t.$el[l](t.style,c).one(m,r)},s=!1)}}t.each(this.styleQueue,a),s&&r(),this.styleQueue=[]},resize:function(){this["_"+this.options.layoutMode+"ResizeChanged"]()&&this.reLayout()},reLayout:function(e){this["_"+this.options.layoutMode+"Reset"](),this.layout(this.$filteredAtoms,e)},addItems:function(e,t){var n=this._getAtoms(e);this.$allAtoms=this.$allAtoms.add(n),t&&t(n)},insert:function(e,t){this.element.append(e);var n=this;this.addItems(e,function(e){var i=n._filter(e);n._addHideAppended(i),n._sort(),n.reLayout(),n._revealAppended(i,t)})},appended:function(e,t){var n=this;this.addItems(e,function(e){n._addHideAppended(e),n.layout(e),n._revealAppended(e,t)})},_addHideAppended:function(e){this.$filteredAtoms=this.$filteredAtoms.add(e),e.addClass("no-transition"),this._isInserting=!0,this.styleQueue.push({$el:e,style:this.options.hiddenStyle})},_revealAppended:function(e,t){var n=this;setTimeout(function(){e.removeClass("no-transition"),n.styleQueue.push({$el:e,style:n.options.visibleStyle}),n._isInserting=!1,n._processStyleQueue(e,t)},10)},reloadItems:function(){this.$allAtoms=this._getAtoms(this.element.children())},remove:function(e,t){this.$allAtoms=this.$allAtoms.not(e),this.$filteredAtoms=this.$filteredAtoms.not(e);var n=this,i=function(){e.remove(),t&&t.call(n.element)};e.filter(":not(."+this.options.hiddenClass+")").length?(this.styleQueue.push({$el:e,style:this.options.hiddenStyle}),this._sort(),this.reLayout(i)):i()},shuffle:function(e){this.updateSortData(this.$allAtoms),this.options.sortBy="random",this._sort(),this.reLayout(e)},destroy:function(){var e=this.usingTransforms,t=this.options;this.$allAtoms.removeClass(t.hiddenClass+" "+t.itemClass).each(function(){var t=this.style;t.position="",t.top="",t.left="",t.opacity="",e&&(t[l]="")});var n=this.element[0].style;for(var i in this.originalStyle)n[i]=this.originalStyle[i];this.element.unbind(".isotope").undelegate("."+t.hiddenClass,"click").removeClass(t.containerClass).removeData("isotope"),b.unbind(".isotope")},_getSegments:function(e){var t,n=this.options.layoutMode,i=e?"rowHeight":"columnWidth",o=e?"height":"width",s=e?"rows":"cols",r=this.element[o](),l=this.options[n]&&this.options[n][i]||this.$filteredAtoms["outer"+a(o)](!0)||r;t=Math.floor(r/l),t=Math.max(t,1),this[n][s]=t,this[n][i]=l},_checkIfSegmentsChanged:function(e){var t=this.options.layoutMode,n=e?"rows":"cols",i=this[t][n];return this._getSegments(e),this[t][n]!==i},_masonryReset:function(){this.masonry={},this._getSegments();var e=this.masonry.cols;for(this.masonry.colYs=[];e--;)this.masonry.colYs.push(0)},_masonryLayout:function(e){var n=this,i=n.masonry;e.each(function(){var e=t(this),o=Math.ceil(e.outerWidth(!0)/i.columnWidth);if(o=Math.min(o,i.cols),1===o)n._masonryPlaceBrick(e,i.colYs);else{var a,s,r=i.cols+1-o,l=[];for(s=0;r>s;s++)a=i.colYs.slice(s,s+o),l[s]=Math.max.apply(Math,a);n._masonryPlaceBrick(e,l)}})},_masonryPlaceBrick:function(e,t){for(var n=Math.min.apply(Math,t),i=0,o=0,a=t.length;a>o;o++)if(t[o]===n){i=o;break}var s=this.masonry.columnWidth*i,r=n;this._pushPosition(e,s,r);var l=n+e.outerHeight(!0),c=this.masonry.cols+1-a;for(o=0;c>o;o++)this.masonry.colYs[i+o]=l},_masonryGetContainerSize:function(){var e=Math.max.apply(Math,this.masonry.colYs);return{height:e}},_masonryResizeChanged:function(){return this._checkIfSegmentsChanged()},_fitRowsReset:function(){this.fitRows={x:0,y:0,height:0}},_fitRowsLayout:function(e){var n=this,i=this.element.width(),o=this.fitRows;e.each(function(){var e=t(this),a=e.outerWidth(!0),s=e.outerHeight(!0);0!==o.x&&a+o.x>i&&(o.x=0,o.y=o.height),n._pushPosition(e,o.x,o.y),o.height=Math.max(o.y+s,o.height),o.x+=a})},_fitRowsGetContainerSize:function(){return{height:this.fitRows.height}},_fitRowsResizeChanged:function(){return!0},_cellsByRowReset:function(){this.cellsByRow={index:0},this._getSegments(),this._getSegments(!0)},_cellsByRowLayout:function(e){var n=this,i=this.cellsByRow;e.each(function(){var e=t(this),o=i.index%i.cols,a=Math.floor(i.index/i.cols),s=(o+.5)*i.columnWidth-e.outerWidth(!0)/2,r=(a+.5)*i.rowHeight-e.outerHeight(!0)/2;n._pushPosition(e,s,r),i.index++})},_cellsByRowGetContainerSize:function(){return{height:Math.ceil(this.$filteredAtoms.length/this.cellsByRow.cols)*this.cellsByRow.rowHeight+this.offset.top}},_cellsByRowResizeChanged:function(){return this._checkIfSegmentsChanged()},_straightDownReset:function(){this.straightDown={y:0}},_straightDownLayout:function(e){var n=this;e.each(function(){var e=t(this);n._pushPosition(e,0,n.straightDown.y),n.straightDown.y+=e.outerHeight(!0)})},_straightDownGetContainerSize:function(){return{height:this.straightDown.y}},_straightDownResizeChanged:function(){return!0},_masonryHorizontalReset:function(){this.masonryHorizontal={},this._getSegments(!0);var e=this.masonryHorizontal.rows;for(this.masonryHorizontal.rowXs=[];e--;)this.masonryHorizontal.rowXs.push(0)},_masonryHorizontalLayout:function(e){var n=this,i=n.masonryHorizontal;e.each(function(){var e=t(this),o=Math.ceil(e.outerHeight(!0)/i.rowHeight);if(o=Math.min(o,i.rows),1===o)n._masonryHorizontalPlaceBrick(e,i.rowXs);else{var a,s,r=i.rows+1-o,l=[];for(s=0;r>s;s++)a=i
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment