text: /*!
   * jQuery JavaScript Library v1.11.1
   * http://jquery.com/
   *
   * Includes Sizzle.js
   * http://sizzlejs.com/
   *
   * Copyright 2005, 2014 jQuery Foundation, Inc. and other contributors
   * Released under the MIT license
   * http://jquery.org/license
   *
   * Date: 2014-05-01T17:42Z
   */
  (function(b,a){if(typeof module==="object"&&typeof module.exports==="object"){module.exports=b.document?a(b,true):function(c){if(!c.document){throw new Error("jQuery requires a window with a document")}return a(c)}}else{a(b)}}(typeof window!=="undefined"?window:this,function(a4,au){var aO=[];var O=aO.slice;var ay=aO.concat;var w=aO.push;var bT=aO.indexOf;var ab={};var x=ab.toString;var J=ab.hasOwnProperty;var C={};var ah="1.11.1",bH=function(e,i){return new bH.fn.init(e,i)},D=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,bR=/^-ms-/,aV=/-([\da-z])/gi,N=function(e,i){return i.toUpperCase()};bH.fn=bH.prototype={jquery:ah,constructor:bH,selector:"",length:0,toArray:function(){return O.call(this)},get:function(e){return e!=null?(e<0?this[e+this.length]:this[e]):O.call(this)},pushStack:function(e){var i=bH.merge(this.constructor(),e);i.prevObject=this;i.context=this.context;return i},each:function(i,e){return bH.each(this,i,e)},map:function(e){return this.pushStack(bH.map(this,function(b6,b5){return e.call(b6,b5,b6)}))},slice:function(){return this.pushStack(O.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(b6){var e=this.length,b5=+b6+(b6<0?e:0);return this.pushStack(b5>=0&&b5<e?[this[b5]]:[])},end:function(){return this.prevObject||this.constructor(null)},push:w,sort:aO.sort,splice:aO.splice};bH.extend=bH.fn.extend=function(){var e,ca,b5,b6,cd,cb,b9=arguments[0]||{},b8=1,b7=arguments.length,cc=false;if(typeof b9==="boolean"){cc=b9;b9=arguments[b8]||{};b8++}if(typeof b9!=="object"&&!bH.isFunction(b9)){b9={}}if(b8===b7){b9=this;b8--}for(;b8<b7;b8++){if((cd=arguments[b8])!=null){for(b6 in cd){e=b9[b6];b5=cd[b6];if(b9===b5){continue}if(cc&&b5&&(bH.isPlainObject(b5)||(ca=bH.isArray(b5)))){if(ca){ca=false;cb=e&&bH.isArray(e)?e:[]}else{cb=e&&bH.isPlainObject(e)?e:{}}b9[b6]=bH.extend(cc,cb,b5)}else{if(b5!==undefined){b9[b6]=b5}}}}}return b9};bH.extend({expando:"jQuery"+(ah+Math.random()).replace(/\D/g,""),isReady:true,error:function(e){throw new Error(e)},noop:function(){},isFunction:function(e){return bH.type(e)==="function"},isArray:Array.isArray||function(e){return bH.type(e)==="array"},isWindow:function(e){return e!=null&&e==e.window},isNumeric:function(e){return !bH.isArray(e)&&e-parseFloat(e)>=0},isEmptyObject:function(i){var e;for(e in i){return false}return true},isPlainObject:function(b6){var i;if(!b6||bH.type(b6)!=="object"||b6.nodeType||bH.isWindow(b6)){return false}try{if(b6.constructor&&!J.call(b6,"constructor")&&!J.call(b6.constructor.prototype,"isPrototypeOf")){return false}}catch(b5){return false}if(C.ownLast){for(i in b6){return J.call(b6,i)}}for(i in b6){}return i===undefined||J.call(b6,i)},type:function(e){if(e==null){return e+""}return typeof e==="object"||typeof e==="function"?ab[x.call(e)]||"object":typeof e},globalEval:function(e){if(e&&bH.trim(e)){(a4.execScript||function(i){a4["eval"].call(a4,i)})(e)}},camelCase:function(e){return e.replace(bR,"ms-").replace(aV,N)},nodeName:function(i,e){return i.nodeName&&i.nodeName.toLowerCase()===e.toLowerCase()},each:function(b9,ca,b5){var b8,b6=0,b7=b9.length,e=ac(b9);if(b5){if(e){for(;b6<b7;b6++){b8=ca.apply(b9[b6],b5);if(b8===false){break}}}else{for(b6 in b9){b8=ca.apply(b9[b6],b5);if(b8===false){break}}}}else{if(e){for(;b6<b7;b6++){b8=ca.call(b9[b6],b6,b9[b6]);if(b8===false){break}}}else{for(b6 in b9){b8=ca.call(b9[b6],b6,b9[b6]);if(b8===false){break}}}}return b9},trim:function(e){return e==null?"":(e+"").replace(D,"")},makeArray:function(e,b5){var i=b5||[];if(e!=null){if(ac(Object(e))){bH.merge(i,typeof e==="string"?[e]:e)}else{w.call(i,e)}}return i},inArray:function(b7,b5,b6){var e;if(b5){if(bT){return bT.call(b5,b7,b6)}e=b5.length;b6=b6?b6<0?Math.max(0,e+b6):b6:0;for(;b6<e;b6++){if(b6 in b5&&b5[b6]===b7){return b6}}}return -1},merge:function(b8,b6){var e=+b6.length,b5=0,b7=b8.length;while(b5<e){b8[b7++]=b6[b5++]}if(e!==e){while(b6[b5]!==undefined){b8[b7++]=b6[b5++]}}b8.length=b7;return b8},grep:function(e,cb,b8){var ca,b7=[],b5=0,b6=e.length,b9=!b8;for(;b5<b6;b5++){ca=!cb(e[b5],b5);if(ca!==b9){b7.push(e[b5])}}return b7},map:function(b6,cb,e){var ca,b8=0,b9=b6.length,b5=ac(b6),b7=[];if(b5){for(;b8<b9;b8++){ca=cb(b6[b8],b8,e);if(ca!=null){b7.push(ca)}}}else{for(b8 in b6){ca=cb(b6[b8],b8,e);if(ca!=null){b7.push(ca)}}}return ay.apply([],b7)},guid:1,proxy:function(b7,b6){var e,b5,i;if(typeof b6==="string"){i=b7[b6];b6=b7;b7=i}if(!bH.isFunction(b7)){return undefined}e=O.call(arguments,2);b5=function(){return b7.apply(b6||this,e.concat(O.call(arguments)))};b5.guid=b7.guid=b7.guid||bH.guid++;return b5},now:function(){return +(new Date())},support:C});bH.each("Boolean Number String Function Array Date RegExp Object Error".split(" "),function(b5,e){ab["[object "+e+"]"]=e.toLowerCase()});function ac(b5){var i=b5.length,e=bH.type(b5);if(e==="function"||bH.isWindow(b5)){return false}if(b5.nodeType===1&&i){return true}return e==="array"||i===0||typeof i==="number"&&i>0&&(i-1) in b5}var m=
  /*!
   * Sizzle CSS Selector Engine v1.10.19
   * http://sizzlejs.com/
   *
   * Copyright 2013 jQuery Foundation, Inc. and other contributors
   * Released under the MIT license
   * http://jquery.org/license
   *
   * Date: 2014-04-18
   */
  (function(dd){var cw,dg,cm,cF,cI,cg,cU,df,dk,cG,cV,cX,cA,cn,c6,c1,de,cd,cD,c8="sizzle"+-(new Date()),cH=dd.document,dh=0,c2=0,b8=cy(),c7=cy(),cE=cy(),cC=function(i,e){if(i===e){cV=true}return 0},dc=typeof undefined,cO=1<<31,cM=({}).hasOwnProperty,da=[],db=da.pop,cK=da.push,b6=da.push,cl=da.slice,cc=da.indexOf||function(dm){var dl=0,e=this.length;for(;dl<e;dl++){if(this[dl]===dm){return dl}}return -1},b7="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",co="[\\x20\\t\\r\\n\\f]",b5="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",cJ=b5.replace("w","w#"),c4="\\["+co+"*("+b5+")(?:"+co+"*([*^$|!~]?=)"+co+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+cJ+"))|)"+co+"*\\]",cj=":("+b5+")(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|"+c4+")*)|.*)\\)|)",cq=new RegExp("^"+co+"+|((?:^|[^\\\\])(?:\\\\.)*)"+co+"+$","g"),ct=new RegExp("^"+co+"*,"+co+"*"),cz=new RegExp("^"+co+"*([>+~]|"+co+")"+co+"*"),cs=new RegExp("="+co+"*([^\\]'\"]*?)"+co+"*\\]","g"),cQ=new RegExp(cj),cS=new RegExp("^"+cJ+"$"),c0={ID:new RegExp("^#("+b5+")"),CLASS:new RegExp("^\\.("+b5+")"),TAG:new RegExp("^("+b5.replace("w","w*")+")"),ATTR:new RegExp("^"+c4),PSEUDO:new RegExp("^"+cj),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+co+"*(even|odd|(([+-]|)(\\d*)n|)"+co+"*(?:([+-]|)"+co+"*(\\d+)|))"+co+"*\\)|)","i"),bool:new RegExp("^(?:"+b7+")$","i"),needsContext:new RegExp("^"+co+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+co+"*((?:-\\d)?\\d*)"+co+"*\\)|)(?=[^-]|$)","i")},cb=/^(?:input|select|textarea|button)$/i,ck=/^h\d$/i,cN=/^[^{]+\{\s*\[native \w/,cP=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,cZ=/[+~]/,cL=/'|\\/g,cr=new RegExp("\\\\([\\da-f]{1,6}"+co+"?|("+co+")|.)","ig"),c3=function(e,dm,i){var dl="0x"+dm-65536;return dl!==dl||i?dm:dl<0?String.fromCharCode(dl+65536):String.fromCharCode(dl>>10|55296,dl&1023|56320)};try{b6.apply((da=cl.call(cH.childNodes)),cH.childNodes);da[cH.childNodes.length].nodeType}catch(cB){b6={apply:da.length?function(i,e){cK.apply(i,cl.call(e))}:function(dn,dm){var e=dn.length,dl=0;while((dn[e++]=dm[dl++])){}dn.length=e-1}}}function cu(dt,dl,dx,dz){var dy,dq,dr,dv,dw,dp,dn,e,dm,du;if((dl?dl.ownerDocument||dl:cH)!==cA){cX(dl)}dl=dl||cA;dx=dx||[];if(!dt||typeof dt!=="string"){return dx}if((dv=dl.nodeType)!==1&&dv!==9){return[]}if(c6&&!dz){if((dy=cP.exec(dt))){if((dr=dy[1])){if(dv===9){dq=dl.getElementById(dr);if(dq&&dq.parentNode){if(dq.id===dr){dx.push(dq);return dx}}else{return dx}}else{if(dl.ownerDocument&&(dq=dl.ownerDocument.getElementById(dr))&&cD(dl,dq)&&dq.id===dr){dx.push(dq);return dx}}}else{if(dy[2]){b6.apply(dx,dl.getElementsByTagName(dt));return dx}else{if((dr=dy[3])&&dg.getElementsByClassName&&dl.getElementsByClassName){b6.apply(dx,dl.getElementsByClassName(dr));return dx}}}}if(dg.qsa&&(!c1||!c1.test(dt))){e=dn=c8;dm=dl;du=dv===9&&dt;if(dv===1&&dl.nodeName.toLowerCase()!=="object"){dp=cg(dt);if((dn=dl.getAttribute("id"))){e=dn.replace(cL,"\\$&")}else{dl.setAttribute("id",e)}e="[id='"+e+"'] ";dw=dp.length;while(dw--){dp[dw]=e+ch(dp[dw])}dm=cZ.test(dt)&&cR(dl.parentNode)||dl;du=dp.join(",")}if(du){try{b6.apply(dx,dm.querySelectorAll(du));return dx}catch(ds){}finally{if(!dn){dl.removeAttribute("id")}}}}}return df(dt.replace(cq,"$1"),dl,dx,dz)}function cy(){var i=[];function e(dl,dm){if(i.push(dl+" ")>cm.cacheLength){delete e[i.shift()]}return(e[dl+" "]=dm)}return e}function ci(e){e[c8]=true;return e}function ce(i){var dm=cA.createElement("div");try{return !!i(dm)}catch(dl){return false}finally{if(dm.parentNode){dm.parentNode.removeChild(dm)}dm=null}}function di(dl,dn){var e=dl.split("|"),dm=dl.length;while(dm--){cm.attrHandle[e[dm]]=dn}}function b9(i,e){var dm=e&&i,dl=dm&&i.nodeType===1&&e.nodeType===1&&(~e.sourceIndex||cO)-(~i.sourceIndex||cO);if(dl){return dl}if(dm){while((dm=dm.nextSibling)){if(dm===e){return -1}}}return i?1:-1}function cv(e){return function(dl){var i=dl.nodeName.toLowerCase();return i==="input"&&dl.type===e}}function ca(e){return function(dl){var i=dl.nodeName.toLowerCase();return(i==="input"||i==="button")&&dl.type===e}}function c5(e){return ci(function(i){i=+i;return ci(function(dl,dq){var dn,dm=e([],dl.length,i),dp=dm.length;while(dp--){if(dl[(dn=dm[dp])]){dl[dn]=!(dq[dn]=dl[dn])}}})})}function cR(e){return e&&typeof e.getElementsByTagName!==dc&&e}dg=cu.support={};cI=cu.isXML=function(e){var i=e&&(e.ownerDocument||e).documentElement;return i?i.nodeName!=="HTML":false};cX=cu.setDocument=function(dl){var e,dm=dl?dl.ownerDocument||dl:cH,i=dm.defaultView;if(dm===cA||dm.nodeType!==9||!dm.documentElement){return cA}cA=dm;cn=dm.documentElement;c6=!cI(dm);if(i&&i!==i.top){if(i.addEventListener){i.addEventListener("unload",function(){cX()},false)}else{if(i.attachEvent){i.attachEvent("onunload",function(){cX()})}}}dg.attributes=ce(function(dn){dn.className="i";return !dn.getAttribute("className")});dg.getElementsByTagName=ce(function(dn){dn.appendChild(dm.createComment(""));return !dn.getElementsByTagName("*").length});dg.getElementsByClassName=cN.test(dm.getElementsByClassName)&&ce(function(dn){dn.innerHTML="<div class='a'></div><div class='a i'></div>";dn.firstChild.className="i";return dn.getElementsByClassName("i").length===2});dg.getById=ce(function(dn){cn.appendChild(dn).id=c8;return !dm.getElementsByName||!dm.getElementsByName(c8).length});if(dg.getById){cm.find.ID=function(dq,dp){if(typeof dp.getElementById!==dc&&c6){var dn=dp.getElementById(dq);return dn&&dn.parentNode?[dn]:[]}};cm.filter.ID=function(dp){var dn=dp.replace(cr,c3);return function(dq){return dq.getAttribute("id")===dn}}}else{delete cm.find.ID;cm.filter.ID=function(dp){var dn=dp.replace(cr,c3);return function(dr){var dq=typeof dr.getAttributeNode!==dc&&dr.getAttributeNode("id");return dq&&dq.value===dn}}}cm.find.TAG=dg.getElementsByTagName?function(dn,dp){if(typeof dp.getElementsByTagName!==dc){return dp.getElementsByTagName(dn)}}:function(dn,ds){var dt,dr=[],dq=0,dp=ds.getElementsByTagName(dn);if(dn==="*"){while((dt=dp[dq++])){if(dt.nodeType===1){dr.push(dt)}}return dr}return dp};cm.find.CLASS=dg.getElementsByClassName&&function(dp,dn){if(typeof dn.getElementsByClassName!==dc&&c6){return dn.getElementsByClassName(dp)}};de=[];c1=[];if((dg.qsa=cN.test(dm.querySelectorAll))){ce(function(dn){dn.innerHTML="<select msallowclip=''><option selected=''></option></select>";if(dn.querySelectorAll("[msallowclip^='']").length){c1.push("[*^$]="+co+"*(?:''|\"\")")}if(!dn.querySelectorAll("[selected]").length){c1.push("\\["+co+"*(?:value|"+b7+")")}if(!dn.querySelectorAll(":checked").length){c1.push(":checked")}});ce(function(dp){var dn=dm.createElement("input");dn.setAttribute("type","hidden");dp.appendChild(dn).setAttribute("name","D");if(dp.querySelectorAll("[name=d]").length){c1.push("name"+co+"*[*^$|!~]?=")}if(!dp.querySelectorAll(":enabled").length){c1.push(":enabled",":disabled")}dp.querySelectorAll("*,:x");c1.push(",.*:")})}if((dg.matchesSelector=cN.test((cd=cn.matches||cn.webkitMatchesSelector||cn.mozMatchesSelector||cn.oMatchesSelector||cn.msMatchesSelector)))){ce(function(dn){dg.disconnectedMatch=cd.call(dn,"div");cd.call(dn,"[s!='']:x");de.push("!=",cj)})}c1=c1.length&&new RegExp(c1.join("|"));de=de.length&&new RegExp(de.join("|"));e=cN.test(cn.compareDocumentPosition);cD=e||cN.test(cn.contains)?function(dp,dn){var dr=dp.nodeType===9?dp.documentElement:dp,dq=dn&&dn.parentNode;return dp===dq||!!(dq&&dq.nodeType===1&&(dr.contains?dr.contains(dq):dp.compareDocumentPosition&&dp.compareDocumentPosition(dq)&16))}:function(dp,dn){if(dn){while((dn=dn.parentNode)){if(dn===dp){return true}}}return false};cC=e?function(dp,dn){if(dp===dn){cV=true;return 0}var dq=!dp.compareDocumentPosition-!dn.compareDocumentPosition;if(dq){return dq}dq=(dp.ownerDocument||dp)===(dn.ownerDocument||dn)?dp.compareDocumentPosition(dn):1;if(dq&1||(!dg.sortDetached&&dn.compareDocumentPosition(dp)===dq)){if(dp===dm||dp.ownerDocument===cH&&cD(cH,dp)){return -1}if(dn===dm||dn.ownerDocument===cH&&cD(cH,dn)){return 1}return cG?(cc.call(cG,dp)-cc.call(cG,dn)):0}return dq&4?-1:1}:function(dp,dn){if(dp===dn){cV=true;return 0}var dv,ds=0,du=dp.parentNode,dr=dn.parentNode,dq=[dp],dt=[dn];if(!du||!dr){return dp===dm?-1:dn===dm?1:du?-1:dr?1:cG?(cc.call(cG,dp)-cc.call(cG,dn)):0}else{if(du===dr){return b9(dp,dn)}}dv=dp;while((dv=dv.parentNode)){dq.unshift(dv)}dv=dn;while((dv=dv.parentNode)){dt.unshift(dv)}while(dq[ds]===dt[ds]){ds++}return ds?b9(dq[ds],dt[ds]):dq[ds]===cH?-1:dt[ds]===cH?1:0};return dm};cu.matches=function(i,e){return cu(i,null,null,e)};cu.matchesSelector=function(dl,dn){if((dl.ownerDocument||dl)!==cA){cX(dl)}dn=dn.replace(cs,"='$1']");if(dg.matchesSelector&&c6&&(!de||!de.test(dn))&&(!c1||!c1.test(dn))){try{var i=cd.call(dl,dn);if(i||dg.disconnectedMatch||dl.document&&dl.document.nodeType!==11){return i}}catch(dm){}}return cu(dn,cA,null,[dl]).length>0};cu.contains=function(e,i){if((e.ownerDocument||e)!==cA){cX(e)}return cD(e,i)};cu.attr=function(dl,e){if((dl.ownerDocument||dl)!==cA){cX(dl)}var i=cm.attrHandle[e.toLowerCase()],dm=i&&cM.call(cm.attrHandle,e.toLowerCase())?i(dl,e,!c6):undefined;return dm!==undefined?dm:dg.attributes||!c6?dl.getAttribute(e):(dm=dl.getAttributeNode(e))&&dm.specified?dm.value:null};cu.error=function(e){throw new Error("Syntax error, unrecognized expression: "+e)};cu.uniqueSort=function(dm){var dn,dp=[],e=0,dl=0;cV=!dg.detectDuplicates;cG=!dg.sortStable&&dm.slice(0);dm.sort(cC);if(cV){while((dn=dm[dl++])){if(dn===dm[dl]){e=dp.push(dl)}}while(e--){dm.splice(dp[e],1)}}cG=null;return dm};cF=cu.getText=function(dp){var dn,dl="",dm=0,e=dp.nodeType;if(!e){while((dn=dp[dm++])){dl+=cF(dn)}}else{if(e===1||e===9||e===11){if(typeof dp.textContent==="string"){return dp.textContent}else{for(dp=dp.firstChild;dp;dp=dp.nextSibling){dl+=cF(dp)}}}else{if(e===3||e===4){return dp.nodeValue}}}return dl};cm=cu.selectors={cacheLength:50,createPseudo:ci,match:c0,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:true}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:true},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){e[1]=e[1].replace(cr,c3);e[3]=(e[3]||e[4]||e[5]||"").replace(cr,c3);if(e[2]==="~="){e[3]=" "+e[3]+" "}return e.slice(0,4)},CHILD:function(e){e[1]=e[1].toLowerCase();if(e[1].slice(0,3)==="nth"){if(!e[3]){cu.error(e[0])}e[4]=+(e[4]?e[5]+(e[6]||1):2*(e[3]==="even"||e[3]==="odd"));e[5]=+((e[7]+e[8])||e[3]==="odd")}else{if(e[3]){cu.error(e[0])}}return e},PSEUDO:function(i){var e,dl=!i[6]&&i[2];if(c0.CHILD.test(i[0])){return null}if(i[3]){i[2]=i[4]||i[5]||""}else{if(dl&&cQ.test(dl)&&(e=cg(dl,true))&&(e=dl.indexOf(")",dl.length-e)-dl.length)){i[0]=i[0].slice(0,e);i[2]=dl.slice(0,e)}}return i.slice(0,3)}},filter:{TAG:function(i){var e=i.replace(cr,c3).toLowerCase();return i==="*"?function(){return true}:function(dl){return dl.nodeName&&dl.nodeName.toLowerCase()===e}},CLASS:function(e){var i=b8[e+" "];return i||(i=new RegExp("(^|"+co+")"+e+"("+co+"|$)"))&&b8(e,function(dl){return i.test(typeof dl.className==="string"&&dl.className||typeof dl.getAttribute!==dc&&dl.getAttribute("class")||"")})},ATTR:function(dl,i,e){return function(dn){var dm=cu.attr(dn,dl);if(dm==null){return i==="!="}if(!i){return true}dm+="";return i==="="?dm===e:i==="!="?dm!==e:i==="^="?e&&dm.indexOf(e)===0:i==="*="?e&&dm.indexOf(e)>-1:i==="$="?e&&dm.slice(-e.length)===e:i==="~="?(" "+dm+" ").indexOf(e)>-1:i==="|="?dm===e||dm.slice(0,e.length+1)===e+"-":false}},CHILD:function(i,dn,dm,dp,dl){var dr=i.slice(0,3)!=="nth",e=i.slice(-4)!=="last",dq=dn==="of-type";return dp===1&&dl===0?function(ds){return !!ds.parentNode}:function(dy,dw,dB){var ds,dE,dz,dD,dA,dv,dx=dr!==e?"nextSibling":"previousSibling",dC=dy.parentNode,du=dq&&dy.nodeName.toLowerCase(),dt=!dB&&!dq;if(dC){if(dr){while(dx){dz=dy;while((dz=dz[dx])){if(dq?dz.nodeName.toLowerCase()===du:dz.nodeType===1){return false}}dv=dx=i==="only"&&!dv&&"nextSibling"}return true}dv=[e?dC.firstChild:dC.lastChild];if(e&&dt){dE=dC[c8]||(dC[c8]={});ds=dE[i]||[];dA=ds[0]===dh&&ds[1];dD=ds[0]===dh&&ds[2];dz=dA&&dC.childNodes[dA];while((dz=++dA&&dz&&dz[dx]||(dD=dA=0)||dv.pop())){if(dz.nodeType===1&&++dD&&dz===dy){dE[i]=[dh,dA,dD];break}}}else{if(dt&&(ds=(dy[c8]||(dy[c8]={}))[i])&&ds[0]===dh){dD=ds[1]}else{while((dz=++dA&&dz&&dz[dx]||(dD=dA=0)||dv.pop())){if((dq?dz.nodeName.toLowerCase()===du:dz.nodeType===1)&&++dD){if(dt){(dz[c8]||(dz[c8]={}))[i]=[dh,dD]}if(dz===dy){break}}}}}dD-=dl;return dD===dp||(dD%dp===0&&dD/dp>=0)}}},PSEUDO:function(dm,dl){var e,i=cm.pseudos[dm]||cm.setFilters[dm.toLowerCase()]||cu.error("unsupported pseudo: "+dm);if(i[c8]){return i(dl)}if(i.length>1){e=[dm,dm,"",dl];return cm.setFilters.hasOwnProperty(dm.toLowerCase())?ci(function(dq,ds){var dp,dn=i(dq,dl),dr=dn.length;while(dr--){dp=cc.call(dq,dn[dr]);dq[dp]=!(ds[dp]=dn[dr])}}):function(dn){return i(dn,0,e)}}return i}},pseudos:{not:ci(function(e){var i=[],dl=[],dm=cU(e.replace(cq,"$1"));return dm[c8]?ci(function(dp,du,ds,dq){var dt,dn=dm(dp,null,dq,[]),dr=dp.length;while(dr--){if((dt=dn[dr])){dp[dr]=!(du[dr]=dt)}}}):function(dq,dp,dn){i[0]=dq;dm(i,null,dn,dl);return !dl.pop()}}),has:ci(function(e){return function(i){return cu(e,i).length>0}}),contains:ci(function(e){return function(i){return(i.textContent||i.innerText||cF(i)).indexOf(e)>-1}}),lang:ci(function(e){if(!cS.test(e||"")){cu.error("unsupported lang: "+e)}e=e.replace(cr,c3).toLowerCase();return function(dl){var i;do{if((i=c6?dl.lang:dl.getAttribute("xml:lang")||dl.getAttribute("lang"))){i=i.toLowerCase();return i===e||i.indexOf(e+"-")===0}}while((dl=dl.parentNode)&&dl.nodeType===1);return false}}),target:function(e){var i=dd.location&&dd.location.hash;return i&&i.slice(1)===e.id},root:function(e){return e===cn},focus:function(e){return e===cA.activeElement&&(!cA.hasFocus||cA.hasFocus())&&!!(e.type||e.href||~e.tabIndex)},enabled:function(e){return e.disabled===false},disabled:function(e){return e.disabled===true},checked:function(e){var i=e.nodeName.toLowerCase();return(i==="input"&&!!e.checked)||(i==="option"&&!!e.selected)},selected:function(e){if(e.parentNode){e.parentNode.selectedIndex}return e.selected===true},empty:function(e){for(e=e.firstChild;e;e=e.nextSibling){if(e.nodeType<6){return false}}return true},parent:function(e){return !cm.pseudos.empty(e)},header:function(e){return ck.test(e.nodeName)},input:function(e){return cb.test(e.nodeName)},button:function(i){var e=i.nodeName.toLowerCase();return e==="input"&&i.type==="button"||e==="button"},text:function(i){var e;return i.nodeName.toLowerCase()==="input"&&i.type==="text"&&((e=i.getAttribute("type"))==null||e.toLowerCase()==="text")},first:c5(function(){return[0]}),last:c5(function(e,i){return[i-1]}),eq:c5(function(e,dl,i){return[i<0?i+dl:i]}),even:c5(function(e,dm){var dl=0;for(;dl<dm;dl+=2){e.push(dl)}return e}),odd:c5(function(e,dm){var dl=1;for(;dl<dm;dl+=2){e.push(dl)}return e}),lt:c5(function(e,dn,dm){var dl=dm<0?dm+dn:dm;for(;--dl>=0;){e.push(dl)}return e}),gt:c5(function(e,dn,dm){var dl=dm<0?dm+dn:dm;for(;++dl<dn;){e.push(dl)}return e})}};cm.pseudos.nth=cm.pseudos.eq;for(cw in {radio:true,checkbox:true,file:true,password:true,image:true}){cm.pseudos[cw]=cv(cw)}for(cw in {submit:true,reset:true}){cm.pseudos[cw]=ca(cw)}function cT(){}cT.prototype=cm.filters=cm.pseudos;cm.setFilters=new cT();cg=cu.tokenize=function(dn,dt){var i,dp,dr,ds,dq,dl,e,dm=c7[dn+" "];if(dm){return dt?0:dm.slice(0)}dq=dn;dl=[];e=cm.preFilter;while(dq){if(!i||(dp=ct.exec(dq))){if(dp){dq=dq.slice(dp[0].length)||dq}dl.push((dr=[]))}i=false;if((dp=cz.exec(dq))){i=dp.shift();dr.push({value:i,type:dp[0].replace(cq," ")});dq=dq.slice(i.length)}for(ds in cm.filter){if((dp=c0[ds].exec(dq))&&(!e[ds]||(dp=e[ds](dp)))){i=dp.shift();dr.push({value:i,type:ds,matches:dp});dq=dq.slice(i.length)}}if(!i){break}}return dt?dq.length:dq?cu.error(dn):c7(dn,dl).slice(0)};function ch(dn){var dm=0,dl=dn.length,e="";for(;dm<dl;dm++){e+=dn[dm].value}return e}function cp(dn,dl,dm){var e=dl.dir,dp=dm&&e==="parentNode",i=c2++;return dl.first?function(ds,dr,dq){while((ds=ds[e])){if(ds.nodeType===1||dp){return dn(ds,dr,dq)}}}:function(du,ds,dr){var dv,dt,dq=[dh,i];if(dr){while((du=du[e])){if(du.nodeType===1||dp){if(dn(du,ds,dr)){return true}}}}else{while((du=du[e])){if(du.nodeType===1||dp){dt=du[c8]||(du[c8]={});if((dv=dt[e])&&dv[0]===dh&&dv[1]===i){return(dq[2]=dv[2])}else{dt[e]=dq;if((dq[2]=dn(du,ds,dr))){return true}}}}}}}function dj(e){return e.length>1?function(dp,dn,dl){var dm=e.length;while(dm--){if(!e[dm](dp,dn,dl)){return false}}return true}:e[0]}function cx(dl,dp,dn){var dm=0,e=dp.length;for(;dm<e;dm++){cu(dl,dp[dm],dn)}return dn}function cY(e,dl,dm,dn,dr){var dp,du=[],dq=0,ds=e.length,dt=dl!=null;for(;dq<ds;dq++){if((dp=e[dq])){if(!dm||dm(dp,dn,dr)){du.push(dp);if(dt){dl.push(dq)}}}}return du}function cf(dl,i,dn,dm,dp,e){if(dm&&!dm[c8]){dm=cf(dm)}if(dp&&!dp[c8]){dp=cf(dp,e)}return ci(function(dA,dx,ds,dz){var dC,dy,du,dt=[],dB=[],dr=dx.length,dq=dA||cx(i||"*",ds.nodeType?[ds]:ds,[]),dv=dl&&(dA||!i)?cY(dq,dt,dl,ds,dz):dq,dw=dn?dp||(dA?dl:dr||dm)?[]:dx:dv;if(dn){dn(dv,dw,ds,dz)}if(dm){dC=cY(dw,dB);dm(dC,[],ds,dz);dy=dC.length;while(dy--){if((du=dC[dy])){dw[dB[dy]]=!(dv[dB[dy]]=du)}}}if(dA){if(dp||dl){if(dp){dC=[];dy=dw.length;while(dy--){if((du=dw[dy])){dC.push((dv[dy]=du))}}dp(null,(dw=[]),dC,dz)}dy=dw.length;while(dy--){if((du=dw[dy])&&(dC=dp?cc.call(dA,du):dt[dy])>-1){dA[dC]=!(dx[dC]=du)}}}}else{dw=cY(dw===dx?dw.splice(dr,dw.length):dw);if(dp){dp(null,dx,dw,dz)}else{b6.apply(dx,dw)}}})}function c9(dr){var dl,dp,dm,dq=dr.length,du=cm.relative[dr[0].type],dv=du||cm.relative[" "],dn=du?1:0,ds=cp(function(i){return i===dl},dv,true),dt=cp(function(i){return cc.call(dl,i)>-1},dv,true),e=[function(dx,dw,i){return(!du&&(i||dw!==dk))||((dl=dw).nodeType?ds(dx,dw,i):dt(dx,dw,i))}];for(;dn<dq;dn++){if((dp=cm.relative[dr[dn].type])){e=[cp(dj(e),dp)]}else{dp=cm.filter[dr[dn].type].apply(null,dr[dn].matches);if(dp[c8]){dm=++dn;for(;dm<dq;dm++){if(cm.relative[dr[dm].type]){break}}return cf(dn>1&&dj(e),dn>1&&ch(dr.slice(0,dn-1).concat({value:dr[dn-2].type===" "?"*":""})).replace(cq,"$1"),dp,dn<dm&&c9(dr.slice(dn,dm)),dm<dq&&c9((dr=dr.slice(dm))),dm<dq&&ch(dr))}e.push(dp)}}return dj(e)}function cW(dm,dl){var e=dl.length>0,dn=dm.length>0,i=function(dy,ds,dx,dw,dB){var dt,du,dz,dD=0,dv="0",dp=dy&&[],dE=[],dC=dk,dr=dy||dn&&cm.find.TAG("*",dB),dq=(dh+=dC==null?1:Math.random()||0.1),dA=dr.length;if(dB){dk=ds!==cA&&ds}for(;dv!==dA&&(dt=dr[dv])!=null;dv++){if(dn&&dt){du=0;while((dz=dm[du++])){if(dz(dt,ds,dx)){dw.push(dt);break}}if(dB){dh=dq}}if(e){if((dt=!dz&&dt)){dD--}if(dy){dp.push(dt)}}}dD+=dv;if(e&&dv!==dD){du=0;while((dz=dl[du++])){dz(dp,dE,ds,dx)}if(dy){if(dD>0){while(dv--){if(!(dp[dv]||dE[dv])){dE[dv]=db.call(dw)}}}dE=cY(dE)}b6.apply(dw,dE);if(dB&&!dy&&dE.length>0&&(dD+dl.length)>1){cu.uniqueSort(dw)}}if(dB){dh=dq;dk=dC}return dp};return e?ci(i):i}cU=cu.compile=function(e,dm){var dn,dl=[],dq=[],dp=cE[e+" "];if(!dp){if(!dm){dm=cg(e)}dn=dm.length;while(dn--){dp=c9(dm[dn]);if(dp[c8]){dl.push(dp)}else{dq.push(dp)}}dp=cE(e,cW(dq,dl));dp.selector=e}return dp};df=cu.select=function(dm,e,dn,dr){var dp,du,dl,dv,ds,dt=typeof dm==="function"&&dm,dq=!dr&&cg((dm=dt.selector||dm));dn=dn||[];if(dq.length===1){du=dq[0]=dq[0].slice(0);if(du.length>2&&(dl=du[0]).type==="ID"&&dg.getById&&e.nodeType===9&&c6&&cm.relative[du[1].type]){e=(cm.find.ID(dl.matches[0].replace(cr,c3),e)||[])[0];if(!e){return dn}else{if(dt){e=e.parentNode}}dm=dm.slice(du.shift().value.length)}dp=c0.needsContext.test(dm)?0:du.length;while(dp--){dl=du[dp];if(cm.relative[(dv=dl.type)]){break}if((ds=cm.find[dv])){if((dr=ds(dl.matches[0].replace(cr,c3),cZ.test(du[0].type)&&cR(e.parentNode)||e))){du.splice(dp,1);dm=dr.length&&ch(du);if(!dm){b6.apply(dn,dr);return dn}break}}}}(dt||cU(dm,dq))(dr,e,!c6,dn,cZ.test(dm)&&cR(e.parentNode)||e);return dn};dg.sortStable=c8.split("").sort(cC).join("")===c8;dg.detectDuplicates=!!cV;cX();dg.sortDetached=ce(function(e){return e.compareDocumentPosition(cA.createElement("div"))&1});if(!ce(function(e){e.innerHTML="<a href='#'></a>";return e.firstChild.getAttribute("href")==="#"})){di("type|href|height|width",function(i,e,dl){if(!dl){return i.getAttribute(e,e.toLowerCase()==="type"?1:2)}})}if(!dg.attributes||!ce(function(e){e.innerHTML="<input/>";e.firstChild.setAttribute("value","");return e.firstChild.getAttribute("value")===""})){di("value",function(i,e,dl){if(!dl&&i.nodeName.toLowerCase()==="input"){return i.defaultValue}})}if(!ce(function(e){return e.getAttribute("disabled")==null})){di(b7,function(i,e,dm){var dl;if(!dm){return i[e]===true?e.toLowerCase():(dl=i.getAttributeNode(e))&&dl.specified?dl.value:null}})}return cu})(a4);bH.find=m;bH.expr=m.selectors;bH.expr[":"]=bH.expr.pseudos;bH.unique=m.uniqueSort;bH.text=m.getText;bH.isXMLDoc=m.isXML;bH.contains=m.contains;var z=bH.expr.match.needsContext;var a=(/^<(\w+)\s*\/?>(?:<\/\1>|)$/);var aK=/^.[^:#\[\.,]*$/;function aQ(b5,e,i){if(bH.isFunction(e)){return bH.grep(b5,function(b7,b6){return !!e.call(b7,b6,b7)!==i})}if(e.nodeType){return bH.grep(b5,function(b6){return(b6===e)!==i})}if(typeof e==="string"){if(aK.test(e)){return bH.filter(e,b5,i)}e=bH.filter(e,b5)}return bH.grep(b5,function(b6){return(bH.inArray(b6,e)>=0)!==i})}bH.filter=function(b6,e,b5){var i=e[0];if(b5){b6=":not("+b6+")"}return e.length===1&&i.nodeType===1?bH.find.matchesSelector(i,b6)?[i]:[]:bH.find.matches(b6,bH.grep(e,function(b7){return b7.nodeType===1}))};bH.fn.extend({find:function(b5){var b8,b7=[],b6=this,e=b6.length;if(typeof b5!=="string"){return this.pushStack(bH(b5).filter(function(){for(b8=0;b8<e;b8++){if(bH.contains(b6[b8],this)){return true}}}))}for(b8=0;b8<e;b8++){bH.find(b5,b6[b8],b7)}b7=this.pushStack(e>1?bH.unique(b7):b7);b7.selector=this.selector?this.selector+" "+b5:b5;return b7},filter:function(e){return this.pushStack(aQ(this,e||[],false))},not:function(e){return this.pushStack(aQ(this,e||[],true))},is:function(e){return !!aQ(this,typeof e==="string"&&z.test(e)?bH(e):e||[],false).length}});var y,n=a4.document,bs=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,bU=bH.fn.init=function(e,b5){var i,b6;if(!e){return this}if(typeof e==="string"){if(e.charAt(0)==="<"&&e.charAt(e.length-1)===">"&&e.length>=3){i=[null,e,null]}else{i=bs.exec(e)}if(i&&(i[1]||!b5)){if(i[1]){b5=b5 instanceof bH?b5[0]:b5;bH.merge(this,bH.parseHTML(i[1],b5&&b5.nodeType?b5.ownerDocument||b5:n,true));if(a.test(i[1])&&bH.isPlainObject(b5)){for(i in b5){if(bH.isFunction(this[i])){this[i](b5[i])}else{this.attr(i,b5[i])}}}return this}else{b6=n.getElementById(i[2]);if(b6&&b6.parentNode){if(b6.id!==i[2]){return y.find(e)}this.length=1;this[0]=b6}this.context=n;this.selector=e;return this}}else{if(!b5||b5.jquery){return(b5||y).find(e)}else{return this.constructor(b5).find(e)}}}else{if(e.nodeType){this.context=this[0]=e;this.length=1;return this}else{if(bH.isFunction(e)){return typeof y.ready!=="undefined"?y.ready(e):e(bH)}}}if(e.selector!==undefined){this.selector=e.selector;this.context=e.context}return bH.makeArray(e,this)};bU.prototype=bH.fn;y=bH(n);var bu=/^(?:parents|prev(?:Until|All))/,by={children:true,contents:true,next:true,prev:true};bH.extend({dir:function(b5,i,b7){var e=[],b6=b5[i];while(b6&&b6.nodeType!==9&&(b7===undefined||b6.nodeType!==1||!bH(b6).is(b7))){if(b6.nodeType===1){e.push(b6)}b6=b6[i]}return e},sibling:function(b5,i){var e=[];for(;b5;b5=b5.nextSibling){if(b5.nodeType===1&&b5!==i){e.push(b5)}}return e}});bH.fn.extend({has:function(b7){var b6,b5=bH(b7,this),e=b5.length;return this.filter(function(){for(b6=0;b6<e;b6++){if(bH.contains(this,b5[b6])){return true}}})},closest:function(b8,b7){var b9,b6=0,b5=this.length,e=[],ca=z.test(b8)||typeof b8!=="string"?bH(b8,b7||this.context):0;for(;b6<b5;b6++){for(b9=this[b6];b9&&b9!==b7;b9=b9.parentNode){if(b9.nodeType<11&&(ca?ca.index(b9)>-1:b9.nodeType===1&&bH.find.matchesSelector(b9,b8))){e.push(b9);break}}}return this.pushStack(e.length>1?bH.unique(e):e)},index:function(e){if(!e){return(this[0]&&this[0].parentNode)?this.first().prevAll().length:-1}if(typeof e==="string"){return bH.inArray(this[0],bH(e))}return bH.inArray(e.jquery?e[0]:e,this)},add:function(e,i){return this.pushStack(bH.unique(bH.merge(this.get(),bH(e,i))))},addBack:function(e){return this.add(e==null?this.prevObject:this.prevObject.filter(e))}});function aX(i,e){do{i=i[e]}while(i&&i.nodeType!==1);return i}bH.each({parent:function(i){var e=i.parentNode;return e&&e.nodeType!==11?e:null},parents:function(e){return bH.dir(e,"parentNode")},parentsUntil:function(b5,e,b6){return bH.dir(b5,"parentNode",b6)},next:function(e){return aX(e,"nextSibling")},prev:function(e){return aX(e,"previousSibling")},nextAll:function(e){return bH.dir(e,"nextSibling")},prevAll:function(e){return bH.dir(e,"previousSibling")},nextUntil:function(b5,e,b6){return bH.dir(b5,"nextSibling",b6)},prevUntil:function(b5,e,b6){return bH.dir(b5,"previousSibling",b6)},siblings:function(e){return bH.sibling((e.parentNode||{}).firstChild,e)},children:function(e){return bH.sibling(e.firstChild)},contents:function(e){return bH.nodeName(e,"iframe")?e.contentDocument||e.contentWindow.document:bH.merge([],e.childNodes)}},function(e,i){bH.fn[e]=function(b7,b5){var b6=bH.map(this,i,b7);if(e.slice(-5)!=="Until"){b5=b7}if(b5&&typeof b5==="string"){b6=bH.filter(b5,b6)}if(this.length>1){if(!by[e]){b6=bH.unique(b6)}if(bu.test(e)){b6=b6.reverse()}}return this.pushStack(b6)}});var aE=(/\S+/g);var b1={};function ae(i){var e=b1[i]={};bH.each(i.match(aE)||[],function(b6,b5){e[b5]=true});return e}bH.Callbacks=function(cd){cd=typeof cd==="string"?(b1[cd]||ae(cd)):bH.extend({},cd);var b7,b6,e,b8,b9,b5,ca=[],cb=!cd.once&&[],i=function(ce){b6=cd.memory&&ce;e=true;b9=b5||0;b5=0;b8=ca.length;b7=true;for(;ca&&b9<b8;b9++){if(ca[b9].apply(ce[0],ce[1])===false&&cd.stopOnFalse){b6=false;break}}b7=false;if(ca){if(cb){if(cb.length){i(cb.shift())}}else{if(b6){ca=[]}else{cc.disable()}}}},cc={add:function(){if(ca){var cf=ca.length;(function ce(cg){bH.each(cg,function(ci,ch){var cj=bH.type(ch);if(cj==="function"){if(!cd.unique||!cc.has(ch)){ca.push(ch)}}else{if(ch&&ch.length&&cj!=="string"){ce(ch)}}})})(arguments);if(b7){b8=ca.length}else{if(b6){b5=cf;i(b6)}}}return this},remove:function(){if(ca){bH.each(arguments,function(cg,ce){var cf;while((cf=bH.inArray(ce,ca,cf))>-1){ca.splice(cf,1);if(b7){if(cf<=b8){b8--}if(cf<=b9){b9--}}}})}return this},has:function(ce){return ce?bH.inArray(ce,ca)>-1:!!(ca&&ca.length)},empty:function(){ca=[];b8=0;return this},disable:function(){ca=cb=b6=undefined;return this},disabled:function(){return !ca},lock:function(){cb=undefined;if(!b6){cc.disable()}return this},locked:function(){return !cb},fireWith:function(cf,ce){if(ca&&(!e||cb)){ce=ce||[];ce=[cf,ce.slice?ce.slice():ce];if(b7){cb.push(ce)}else{i(ce)}}return this},fire:function(){cc.fireWith(this,arguments);return this},fired:function(){return !!e}};return cc};bH.extend({Deferred:function(b5){var i=[["resolve","done",bH.Callbacks("once memory"),"resolved"],["reject","fail",bH.Callbacks("once memory"),"rejected"],["notify","progress",bH.Callbacks("memory")]],b6="pending",b7={state:function(){return b6},always:function(){e.done(arguments).fail(arguments);return this},then:function(){var b8=arguments;return bH.Deferred(function(b9){bH.each(i,function(cb,ca){var cc=bH.isFunction(b8[cb])&&b8[cb];e[ca[1]](function(){var cd=cc&&cc.apply(this,arguments);if(cd&&bH.isFunction(cd.promise)){cd.promise().done(b9.resolve).fail(b9.reject).progress(b9.notify)}else{b9[ca[0]+"With"](this===b7?b9.promise():this,cc?[cd]:arguments)}})});b8=null}).promise()},promise:function(b8){return b8!=null?bH.extend(b8,b7):b7}},e={};b7.pipe=b7.then;bH.each(i,function(b9,b8){var cb=b8[2],ca=b8[3];b7[b8[1]]=cb.add;if(ca){cb.add(function(){b6=ca},i[b9^1][2].disable,i[2][2].lock)}e[b8[0]]=function(){e[b8[0]+"With"](this===e?b7:this,arguments);return this};e[b8[0]+"With"]=cb.fireWith});b7.promise(e);if(b5){b5.call(e,e)}return e},when:function(b8){var b6=0,ca=O.call(arguments),e=ca.length,b5=e!==1||(b8&&bH.isFunction(b8.promise))?e:0,cd=b5===1?b8:bH.Deferred(),b7=function(cf,cg,ce){return function(i){cg[cf]=this;ce[cf]=arguments.length>1?O.call(arguments):i;if(ce===cc){cd.notifyWith(cg,ce)}else{if(!(--b5)){cd.resolveWith(cg,ce)}}}},cc,b9,cb;if(e>1){cc=new Array(e);b9=new Array(e);cb=new Array(e);for(;b6<e;b6++){if(ca[b6]&&bH.isFunction(ca[b6].promise)){ca[b6].promise().done(b7(b6,cb,ca)).fail(cd.reject).progress(b7(b6,b9,cc))}else{--b5}}}if(!b5){cd.resolveWith(cb,ca)}return cd.promise()}});var aj;bH.fn.ready=function(e){bH.ready.promise().done(e);return this};bH.extend({isReady:false,readyWait:1,holdReady:function(e){if(e){bH.readyWait++}else{bH.ready(true)}},ready:function(e){if(e===true?--bH.readyWait:bH.isReady){return}if(!n.body){return setTimeout(bH.ready)}bH.isReady=true;if(e!==true&&--bH.readyWait>0){return}aj.resolveWith(n,[bH]);if(bH.fn.triggerHandler){bH(n).triggerHandler("ready");bH(n).off("ready")}}});function bl(){if(n.addEventListener){n.removeEventListener("DOMContentLoaded",bY,false);a4.removeEventListener("load",bY,false)}else{n.detachEvent("onreadystatechange",bY);a4.detachEvent("onload",bY)}}function bY(){if(n.addEventListener||event.type==="load"||n.readyState==="complete"){bl();bH.ready()}}bH.ready.promise=function(b7){if(!aj){aj=bH.Deferred();if(n.readyState==="complete"){setTimeout(bH.ready)}else{if(n.addEventListener){n.addEventListener("DOMContentLoaded",bY,false);a4.addEventListener("load",bY,false)}else{n.attachEvent("onreadystatechange",bY);a4.attachEvent("onload",bY);var b6=false;try{b6=a4.frameElement==null&&n.documentElement}catch(b5){}if(b6&&b6.doScroll){(function i(){if(!bH.isReady){try{b6.doScroll("left")}catch(b8){return setTimeout(i,50)}bl();bH.ready()}})()}}}}return aj.promise(b7)};var aB=typeof undefined;var bg;for(bg in bH(C)){break}C.ownLast=bg!=="0";C.inlineBlockNeedsLayout=false;bH(function(){var b5,b6,e,i;e=n.getElementsByTagName("body")[0];if(!e||!e.style){return}b6=n.createElement("div");i=n.createElement("div");i.style.cssText="position:absolute;border:0;width:0;height:0;top:0;left:-9999px";e.appendChild(i).appendChild(b6);if(typeof b6.style.zoom!==aB){b6.style.cssText="display:inline;margin:0;border:0;padding:1px;width:1px;zoom:1";C.inlineBlockNeedsLayout=b5=b6.offsetWidth===3;if(b5){e.style.zoom=1}}e.removeChild(i)});(function(){var b5=n.createElement("div");if(C.deleteExpando==null){C.deleteExpando=true;try{delete b5.test}catch(i){C.deleteExpando=false}}b5=null})();bH.acceptData=function(b5){var i=bH.noData[(b5.nodeName+" ").toLowerCase()],e=+b5.nodeType||1;return e!==1&&e!==9?false:!i||i!==true&&b5.getAttribute("classid")===i};var bx=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,aP=/([A-Z])/g;function bz(b6,b5,b7){if(b7===undefined&&b6.nodeType===1){var i="data-"+b5.replace(aP,"-$1").toLowerCase();b7=b6.getAttribute(i);if(typeof b7==="string"){try{b7=b7==="true"?true:b7==="false"?false:b7==="null"?null:+b7+""===b7?+b7:bx.test(b7)?bH.parseJSON(b7):b7}catch(b8){}bH.data(b6,b5,b7)}else{b7=undefined}}return b7}function P(i){var e;for(e in i){if(e==="data"&&bH.isEmptyObject(i[e])){continue}if(e!=="toJSON"){return false}}return true}function bb(b6,i,b8,b7){if(!bH.acceptData(b6)){return}var ca,b9,cb=bH.expando,cc=b6.nodeType,e=cc?bH.cache:b6,b5=cc?b6[cb]:b6[cb]&&cb;if((!b5||!e[b5]||(!b7&&!e[b5].data))&&b8===undefined&&typeof i==="string"){return}if(!b5){if(cc){b5=b6[cb]=aO.pop()||bH.guid++}else{b5=cb}}if(!e[b5]){e[b5]=cc?{}:{toJSON:bH.noop}}if(typeof i==="object"||typeof i==="function"){if(b7){e[b5]=bH.extend(e[b5],i)}else{e[b5].data=bH.extend(e[b5].data,i)}}b9=e[b5];if(!b7){if(!b9.data){b9.data={}}b9=b9.data}if(b8!==undefined){b9[bH.camelCase(i)]=b8}if(typeof i==="string"){ca=b9[i];if(ca==null){ca=b9[bH.camelCase(i)]}}else{ca=b9}return ca}function aa(b8,b6,e){if(!bH.acceptData(b8)){return}var ca,b7,b9=b8.nodeType,b5=b9?bH.cache:b8,cb=b9?b8[bH.expando]:bH.expando;if(!b5[cb]){return}if(b6){ca=e?b5[cb]:b5[cb].data;if(ca){if(!bH.isArray(b6)){if(b6 in ca){b6=[b6]}else{b6=bH.camelCase(b6);if(b6 in ca){b6=[b6]}else{b6=b6.split(" ")}}}else{b6=b6.concat(bH.map(b6,bH.camelCase))}b7=b6.length;while(b7--){delete ca[b6[b7]]}if(e?!P(ca):!bH.isEmptyObject(ca)){return}}}if(!e){delete b5[cb].data;if(!P(b5[cb])){return}}if(b9){bH.cleanData([b8],true)}else{if(C.deleteExpando||b5!=b5.window){delete b5[cb]}else{b5[cb]=null}}}bH.extend({cache:{},noData:{"applet ":true,"embed ":true,"object ":"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"},hasData:function(e){e=e.nodeType?bH.cache[e[bH.expando]]:e[bH.expando];return !!e&&!P(e)},data:function(i,e,b5){return bb(i,e,b5)},removeData:function(i,e){return aa(i,e)},_data:function(i,e,b5){return bb(i,e,b5,true)},_removeData:function(i,e){return aa(i,e,true)}});bH.fn.extend({data:function(b7,ca){var b6,b5,b9,b8=this[0],e=b8&&b8.attributes;if(b7===undefined){if(this.length){b9=bH.data(b8);if(b8.nodeType===1&&!bH._data(b8,"parsedAttrs")){b6=e.length;while(b6--){if(e[b6]){b5=e[b6].name;if(b5.indexOf("data-")===0){b5=bH.camelCase(b5.slice(5));bz(b8,b5,b9[b5])}}}bH._data(b8,"parsedAttrs",true)}}return b9}if(typeof b7==="object"){return this.each(function(){bH.data(this,b7)})}return arguments.length>1?this.each(function(){bH.data(this,b7,ca)}):b8?bz(b8,b7,bH.data(b8,b7)):undefined},removeData:function(e){return this.each(function(){bH.removeData(this,e)})}});bH.extend({queue:function(b5,i,b6){var e;if(b5){i=(i||"fx")+"queue";e=bH._data(b5,i);if(b6){if(!e||bH.isArray(b6)){e=bH._data(b5,i,bH.makeArray(b6))}else{e.push(b6)}}return e||[]}},dequeue:function(b8,b7){b7=b7||"fx";var i=bH.queue(b8,b7),b9=i.length,b6=i.shift(),e=bH._queueHooks(b8,b7),b5=function(){bH.dequeue(b8,b7)};if(b6==="inprogress"){b6=i.shift();b9--}if(b6){if(b7==="fx"){i.unshift("inprogress")}delete e.stop;b6.call(b8,b5,e)}if(!b9&&e){e.empty.fire()}},_queueHooks:function(b5,i){var e=i+"queueHooks";return bH._data(b5,e)||bH._data(b5,e,{empty:bH.Callbacks("once memory").add(function(){bH._removeData(b5,i+"queue");bH._removeData(b5,e)})})}});bH.fn.extend({queue:function(e,i){var b5=2;if(typeof e!=="string"){i=e;e="fx";b5--}if(arguments.length<b5){return bH.queue(this[0],e)}return i===undefined?this:this.each(function(){var b6=bH.queue(this,e,i);bH._queueHooks(this,e);if(e==="fx"&&b6[0]!=="inprogress"){bH.dequeue(this,e)}})},dequeue:function(e){return this.each(function(){bH.dequeue(this,e)})},clearQueue:function(e){return this.queue(e||"fx",[])},promise:function(b6,ca){var b5,b7=1,cb=bH.Deferred(),b9=this,e=this.length,b8=function(){if(!(--b7)){cb.resolveWith(b9,[b9])}};if(typeof b6!=="string"){ca=b6;b6=undefined}b6=b6||"fx";while(e--){b5=bH._data(b9[e],b6+"queueHooks");if(b5&&b5.empty){b7++;b5.empty.add(b8)}}b8();return cb.promise(ca)}});var aD=(/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/).source;var bS=["Top","Right","Bottom","Left"];var R=function(i,e){i=e||i;return bH.css(i,"display")==="none"||!bH.contains(i.ownerDocument,i)};var aA=bH.access=function(e,b9,cb,ca,b7,cd,cc){var b6=0,b5=e.length,b8=cb==null;if(bH.type(cb)==="object"){b7=true;for(b6 in cb){bH.access(e,b9,b6,cb[b6],true,cd,cc)}}else{if(ca!==undefined){b7=true;if(!bH.isFunction(ca)){cc=true}if(b8){if(cc){b9.call(e,ca);b9=null}else{b8=b9;b9=function(ce,i,cf){return b8.call(bH(ce),cf)}}}if(b9){for(;b6<b5;b6++){b9(e[b6],cb,cc?ca:ca.call(e[b6],b6,b9(e[b6],cb)))}}}}return b7?e:b8?b9.call(e):b5?b9(e[0],cb):cd};var aL=(/^(?:checkbox|radio)$/i);(function(){var i=n.createElement("input"),b7=n.createElement("div"),b5=n.createDocumentFragment();b7.innerHTML="  <link/><table></table><a href='/a'>a</a><input type='checkbox'/>";C.leadingWhitespace=b7.firstChild.nodeType===3;C.tbody=!b7.getElementsByTagName("tbody").length;C.htmlSerialize=!!b7.getElementsByTagName("link").length;C.html5Clone=n.createElement("nav").cloneNode(true).outerHTML!=="<:nav></:nav>";i.type="checkbox";i.checked=true;b5.appendChild(i);C.appendChecked=i.checked;b7.innerHTML="<textarea>x</textarea>";C.noCloneChecked=!!b7.cloneNode(true).lastChild.defaultValue;b5.appendChild(b7);b7.innerHTML="<input type='radio' checked='checked' name='t'/>";C.checkClone=b7.cloneNode(true).cloneNode(true).lastChild.checked;C.noCloneEvent=true;if(b7.attachEvent){b7.attachEvent("onclick",function(){C.noCloneEvent=false});b7.cloneNode(true).click()}if(C.deleteExpando==null){C.deleteExpando=true;try{delete b7.test}catch(b6){C.deleteExpando=false}}})();(function(){var b5,e,b6=n.createElement("div");for(b5 in {submit:true,change:true,focusin:true}){e="on"+b5;if(!(C[b5+"Bubbles"]=e in a4)){b6.setAttribute(e,"t");C[b5+"Bubbles"]=b6.attributes[e].expando===false}}b6=null})();var bF=/^(?:input|select|textarea)$/i,a5=/^key/,bL=/^(?:mouse|pointer|contextmenu)|click/,bB=/^(?:focusinfocus|focusoutblur)$/,bw=/^([^.]*)(?:\.(.+)|)$/;function T(){return true}function Y(){return false}function al(){try{return n.activeElement}catch(e){}}bH.event={global:{},add:function(b7,cc,ch,b9,b8){var ca,ci,cj,b5,ce,cb,cg,b6,cf,e,i,cd=bH._data(b7);if(!cd){return}if(ch.handler){b5=ch;ch=b5.handler;b8=b5.selector}if(!ch.guid){ch.guid=bH.guid++}if(!(ci=cd.events)){ci=cd.events={}}if(!(cb=cd.handle)){cb=cd.handle=function(ck){return typeof bH!==aB&&(!ck||bH.event.triggered!==ck.type)?bH.event.dispatch.apply(cb.elem,arguments):undefined};cb.elem=b7}cc=(cc||"").match(aE)||[""];cj=cc.length;while(cj--){ca=bw.exec(cc[cj])||[];cf=i=ca[1];e=(ca[2]||"").split(".").sort();if(!cf){continue}ce=bH.event.special[cf]||{};cf=(b8?ce.delegateType:ce.bindType)||cf;ce=bH.event.special[cf]||{};cg=bH.extend({type:cf,origType:i,data:b9,handler:ch,guid:ch.guid,selector:b8,needsContext:b8&&bH.expr.match.needsContext.test(b8),namespace:e.join(".")},b5);if(!(b6=ci[cf])){b6=ci[cf]=[];b6.delegateCount=0;if(!ce.setup||ce.setup.call(b7,b9,e,cb)===false){if(b7.addEventListener){b7.addEventListener(cf,cb,false)}else{if(b7.attachEvent){b7.attachEvent("on"+cf,cb)}}}}if(ce.add){ce.add.call(b7,cg);if(!cg.handler.guid){cg.handler.guid=ch.guid}}if(b8){b6.splice(b6.delegateCount++,0,cg)}else{b6.push(cg)}bH.event.global[cf]=true}b7=null},remove:function(b6,cc,cj,b7,cb){var b9,cg,ca,b8,ci,ch,ce,b5,cf,e,i,cd=bH.hasData(b6)&&bH._data(b6);if(!cd||!(ch=cd.events)){return}cc=(cc||"").match(aE)||[""];ci=cc.length;while(ci--){ca=bw.exec(cc[ci])||[];cf=i=ca[1];e=(ca[2]||"").split(".").sort();if(!cf){for(cf in ch){bH.event.remove(b6,cf+cc[ci],cj,b7,true)}continue}ce=bH.event.special[cf]||{};cf=(b7?ce.delegateType:ce.bindType)||cf;b5=ch[cf]||[];ca=ca[2]&&new RegExp("(^|\\.)"+e.join("\\.(?:.*\\.|)")+"(\\.|$)");b8=b9=b5.length;while(b9--){cg=b5[b9];if((cb||i===cg.origType)&&(!cj||cj.guid===cg.guid)&&(!ca||ca.test(cg.namespace))&&(!b7||b7===cg.selector||b7==="**"&&cg.selector)){b5.splice(b9,1);if(cg.selector){b5.delegateCount--}if(ce.remove){ce.remove.call(b6,cg)}}}if(b8&&!b5.length){if(!ce.teardown||ce.teardown.call(b6,e,cd.handle)===false){bH.removeEvent(b6,cf,cd.handle)}delete ch[cf]}}if(bH.isEmptyObject(ch)){delete cd.handle;bH._removeData(b6,"events")}},trigger:function(b5,cc,b8,cj){var cd,b7,ch,ci,cf,cb,ca,b9=[b8||n],cg=J.call(b5,"type")?b5.type:b5,b6=J.call(b5,"namespace")?b5.namespace.split("."):[];ch=cb=b8=b8||n;if(b8.nodeType===3||b8.nodeType===8){return}if(bB.test(cg+bH.event.triggered)){return}if(cg.indexOf(".")>=0){b6=cg.split(".");cg=b6.shift();b6.sort()}b7=cg.indexOf(":")<0&&"on"+cg;b5=b5[bH.expando]?b5:new bH.Event(cg,typeof b5==="object"&&b5);b5.isTrigger=cj?2:3;b5.namespace=b6.join(".");b5.namespace_re=b5.namespace?new RegExp("(^|\\.)"+b6.join("\\.(?:.*\\.|)")+"(\\.|$)"):null;b5.result=undefined;if(!b5.target){b5.target=b8}cc=cc==null?[b5]:bH.makeArray(cc,[b5]);cf=bH.event.special[cg]||{};if(!cj&&cf.trigger&&cf.trigger.apply(b8,cc)===false){return}if(!cj&&!cf.noBubble&&!bH.isWindow(b8)){ci=cf.delegateType||cg;if(!bB.test(ci+cg)){ch=ch.parentNode}for(;ch;ch=ch.parentNode){b9.push(ch);cb=ch}if(cb===(b8.ownerDocument||n)){b9.push(cb.defaultView||cb.parentWindow||a4)}}ca=0;while((ch=b9[ca++])&&!b5.isPropagationStopped()){b5.type=ca>1?ci:cf.bindType||cg;cd=(bH._data(ch,"events")||{})[b5.type]&&bH._data(ch,"handle");if(cd){cd.apply(ch,cc)}cd=b7&&ch[b7];if(cd&&cd.apply&&bH.acceptData(ch)){b5.result=cd.apply(ch,cc);if(b5.result===false){b5.preventDefault()}}}b5.type=cg;if(!cj&&!b5.isDefaultPrevented()){if((!cf._default||cf._default.apply(b9.pop(),cc)===false)&&bH.acceptData(b8)){if(b7&&b8[cg]&&!bH.isWindow(b8)){cb=b8[b7];if(cb){b8[b7]=null}bH.event.triggered=cg;try{b8[cg]()}catch(ce){}bH.event.triggered=undefined;if(cb){b8[b7]=cb}}}}return b5.result},dispatch:function(e){e=bH.event.fix(e);var b8,b9,cd,b5,b7,cc=[],cb=O.call(arguments),b6=(bH._data(this,"events")||{})[e.type]||[],ca=bH.event.special[e.type]||{};cb[0]=e;e.delegateTarget=this;if(ca.preDispatch&&ca.preDispatch.call(this,e)===false){return}cc=bH.event.handlers.call(this,e,b6);b8=0;while((b5=cc[b8++])&&!e.isPropagationStopped()){e.currentTarget=b5.elem;b7=0;while((cd=b5.handlers[b7++])&&!e.isImmediatePropagationStopped()){if(!e.namespace_re||e.namespace_re.test(cd.namespace)){e.handleObj=cd;e.data=cd.data;b9=((bH.event.special[cd.origType]||{}).handle||cd.handler).apply(b5.elem,cb);if(b9!==undefined){if((e.result=b9)===false){e.preventDefault();e.stopPropagation()}}}}}if(ca.postDispatch){ca.postDispatch.call(this,e)}return e.result},handlers:function(e,b6){var b5,cb,b9,b8,ca=[],b7=b6.delegateCount,cc=e.target;if(b7&&cc.nodeType&&(!e.button||e.type!=="click")){for(;cc!=this;cc=cc.parentNode||this){if(cc.nodeType===1&&(cc.disabled!==true||e.type!=="click")){b9=[];for(b8=0;b8<b7;b8++){cb=b6[b8];b5=cb.selector+" ";if(b9[b5]===undefined){b9[b5]=cb.needsContext?bH(b5,this).index(cc)>=0:bH.find(b5,this,null,[cc]).length}if(b9[b5]){b9.push(cb)}}if(b9.length){ca.push({elem:cc,handlers:b9})}}}}if(b7<b6.length){ca.push({elem:this,handlers:b6.slice(b7)})}return ca},fix:function(b7){if(b7[bH.expando]){return b7}var b5,ca,b9,b6=b7.type,e=b7,b8=this.fixHooks[b6];if(!b8){this.fixHooks[b6]=b8=bL.test(b6)?this.mouseHooks:a5.test(b6)?this.keyHooks:{}}b9=b8.props?this.props.concat(b8.props):this.props;b7=new bH.Event(e);b5=b9.length;while(b5--){ca=b9[b5];b7[ca]=e[ca]}if(!b7.target){b7.target=e.srcElement||n}if(b7.target.nodeType===3){b7.target=b7.target.parentNode}b7.metaKey=!!b7.metaKey;return b8.filter?b8.filter(b7,e):b7},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(i,e){if(i.which==null){i.which=e.charCode!=null?e.charCode:e.keyCode}return i}},mouseHooks:{props:"button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(b6,b5){var e,b7,b8,i=b5.button,b9=b5.fromElement;if(b6.pageX==null&&b5.clientX!=null){b7=b6.target.ownerDocument||n;b8=b7.documentElement;e=b7.body;b6.pageX=b5.clientX+(b8&&b8.scrollLeft||e&&e.scrollLeft||0)-(b8&&b8.clientLeft||e&&e.clientLeft||0);b6.pageY=b5.clientY+(b8&&b8.scrollTop||e&&e.scrollTop||0)-(b8&&b8.clientTop||e&&e.clientTop||0)}if(!b6.relatedTarget&&b9){b6.relatedTarget=b9===b6.target?b5.toElement:b9}if(!b6.which&&i!==undefined){b6.which=(i&1?1:(i&2?3:(i&4?2:0)))}return b6}},special:{load:{noBubble:true},focus:{trigger:function(){if(this!==al()&&this.focus){try{this.focus();return false}catch(i){}}},delegateType:"focusin"},blur:{trigger:function(){if(this===al()&&this.blur){this.blur();return false}},delegateType:"focusout"},click:{trigger:function(){if(bH.nodeName(this,"input")&&this.type==="checkbox"&&this.click){this.click();return false}},_default:function(e){return bH.nodeName(e.target,"a")}},beforeunload:{postDispatch:function(e){if(e.result!==undefined&&e.originalEvent){e.originalEvent.returnValue=e.result}}}},simulate:function(b5,b7,b6,i){var b8=bH.extend(new bH.Event(),b6,{type:b5,isSimulated:true,originalEvent:{}});if(i){bH.event.trigger(b8,null,b7)}else{bH.event.dispatch.call(b7,b8)}if(b8.isDefaultPrevented()){b6.preventDefault()}}};bH.removeEvent=n.removeEventListener?function(i,e,b5){if(i.removeEventListener){i.removeEventListener(e,b5,false)}}:function(b5,i,b6){var e="on"+i;if(b5.detachEvent){if(typeof b5[e]===aB){b5[e]=null}b5.detachEvent(e,b6)}};bH.Event=function(i,e){if(!(this instanceof bH.Event)){return new bH.Event(i,e)}if(i&&i.type){this.originalEvent=i;this.type=i.type;this.isDefaultPrevented=i.defaultPrevented||i.defaultPrevented===undefined&&i.returnValue===false?T:Y}else{this.type=i}if(e){bH.extend(this,e)}this.timeStamp=i&&i.timeStamp||bH.now();this[bH.expando]=true};bH.Event.prototype={isDefaultPrevented:Y,isPropagationStopped:Y,isImmediatePropagationStopped:Y,preventDefault:function(){var i=this.originalEvent;this.isDefaultPrevented=T;if(!i){return}if(i.preventDefault){i.preventDefault()}else{i.returnValue=false}},stopPropagation:function(){var i=this.originalEvent;this.isPropagationStopped=T;if(!i){return}if(i.stopPropagation){i.stopPropagation()}i.cancelBubble=true},stopImmediatePropagation:function(){var i=this.originalEvent;this.isImmediatePropagationStopped=T;if(i&&i.stopImmediatePropagation){i.stopImmediatePropagation()}this.stopPropagation()}};bH.each({mouseenter:"mouseover",mouseleave:"mouseout",pointerenter:"pointerover",pointerleave:"pointerout"},function(i,e){bH.event.special[i]={delegateType:e,bindType:e,handle:function(b7){var b5,b9=this,b8=b7.relatedTarget,b6=b7.handleObj;if(!b8||(b8!==b9&&!bH.contains(b9,b8))){b7.type=b6.origType;b5=b6.handler.apply(this,arguments);b7.type=e}return b5}}});if(!C.submitBubbles){bH.event.special.submit={setup:function(){if(bH.nodeName(this,"form")){return false}bH.event.add(this,"click._submit keypress._submit",function(b6){var b5=b6.target,i=bH.nodeName(b5,"input")||bH.nodeName(b5,"button")?b5.form:undefined;if(i&&!bH._data(i,"submitBubbles")){bH.event.add(i,"submit._submit",function(e){e._submit_bubble=true});bH._data(i,"submitBubbles",true)}})},postDispatch:function(e){if(e._submit_bubble){delete e._submit_bubble;if(this.parentNode&&!e.isTrigger){bH.event.simulate("submit",this.parentNode,e,true)}}},teardown:function(){if(bH.nodeName(this,"form")){return false}bH.event.remove(this,"._submit")}}}if(!C.changeBubbles){bH.event.special.change={setup:function(){if(bF.test(this.nodeName)){if(this.type==="checkbox"||this.type==="radio"){bH.event.add(this,"propertychange._change",function(e){if(e.originalEvent.propertyName==="checked"){this._just_changed=true}});bH.event.add(this,"click._change",function(e){if(this._just_changed&&!e.isTrigger){this._just_changed=false}bH.event.simulate("change",this,e,true)})}return false}bH.event.add(this,"beforeactivate._change",function(b5){var i=b5.target;if(bF.test(i.nodeName)&&!bH._data(i,"changeBubbles")){bH.event.add(i,"change._change",function(e){if(this.parentNode&&!e.isSimulated&&!e.isTrigger){bH.event.simulate("change",this.parentNode,e,true)}});bH._data(i,"changeBubbles",true)}})},handle:function(i){var e=i.target;if(this!==e||i.isSimulated||i.isTrigger||(e.type!=="radio"&&e.type!=="checkbox")){return i.handleObj.handler.apply(this,arguments)}},teardown:function(){bH.event.remove(this,"._change");return !bF.test(this.nodeName)}}}if(!C.focusinBubbles){bH.each({focus:"focusin",blur:"focusout"},function(b5,e){var i=function(b6){bH.event.simulate(e,b6.target,bH.event.fix(b6),true)};bH.event.special[e]={setup:function(){var b7=this.ownerDocument||this,b6=bH._data(b7,e);if(!b6){b7.addEventListener(b5,i,true)}bH._data(b7,e,(b6||0)+1)},teardown:function(){var b7=this.ownerDocument||this,b6=bH._data(b7,e)-1;if(!b6){b7.removeEventListener(b5,i,true);bH._removeData(b7,e)}else{bH._data(b7,e,b6)}}}})}bH.fn.extend({on:function(b5,e,b8,b7,i){var b6,b9;if(typeof b5==="object"){if(typeof e!=="string"){b8=b8||e;e=undefined}for(b6 in b5){this.on(b6,e,b8,b5[b6],i)}return this}if(b8==null&&b7==null){b7=e;b8=e=undefined}else{if(b7==null){if(typeof e==="string"){b7=b8;b8=undefined}else{b7=b8;b8=e;e=undefined}}}if(b7===false){b7=Y}else{if(!b7){return this}}if(i===1){b9=b7;b7=function(ca){bH().off(ca);return b9.apply(this,arguments)};b7.guid=b9.guid||(b9.guid=bH.guid++)}return this.each(function(){bH.event.add(this,b5,b7,b8,e)})},one:function(i,e,b6,b5){return this.on(i,e,b6,b5,1)},off:function(b5,e,b7){var i,b6;if(b5&&b5.preventDefault&&b5.handleObj){i=b5.handleObj;bH(b5.delegateTarget).off(i.namespace?i.origType+"."+i.namespace:i.origType,i.selector,i.handler);return this}if(typeof b5==="object"){for(b6 in b5){this.off(b6,e,b5[b6])}return this}if(e===false||typeof e==="function"){b7=e;e=undefined}if(b7===false){b7=Y}return this.each(function(){bH.event.remove(this,b5,b7,e)})},trigger:function(e,i){return this.each(function(){bH.event.trigger(e,i,this)})},triggerHandler:function(e,b5){var i=this[0];if(i){return bH.event.trigger(e,b5,i,true)}}});function A(e){var b5=d.split("|"),i=e.createDocumentFragment();if(i.createElement){while(b5.length){i.createElement(b5.pop())}}return i}var d="abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",aC=/ jQuery\d+="(?:null|\d+)"/g,L=new RegExp("<(?:"+d+")[\\s/>]","i"),b4=/^\s+/,aG=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,o=/<([\w:]+)/,bZ=/<tbody/i,K=/<|&#?\w+;/,am=/<(?:script|style|link)/i,bV=/checked\s*(?:[^=]|=\s*.checked.)/i,bA=/^$|\/(?:java|ecma)script/i,aq=/^true\/(.*)/,aN=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,V={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:C.htmlSerialize?[0,"",""]:[1,"X<div>","</div>"]},aS=A(n),k=aS.appendChild(n.createElement("div"));V.optgroup=V.option;V.tbody=V.tfoot=V.colgroup=V.caption=V.thead;V.th=V.td;function l(b7,e){var b5,b8,b6=0,b9=typeof b7.getElementsByTagName!==aB?b7.getElementsByTagName(e||"*"):typeof b7.querySelectorAll!==aB?b7.querySelectorAll(e||"*"):undefined;if(!b9){for(b9=[],b5=b7.childNodes||b7;(b8=b5[b6])!=null;b6++){if(!e||bH.nodeName(b8,e)){b9.push(b8)}else{bH.merge(b9,l(b8,e))}}}return e===undefined||e&&bH.nodeName(b7,e)?bH.merge([b7],b9):b9}function bX(e){if(aL.test(e.type)){e.defaultChecked=e.checked}}function a2(i,e){return bH.nodeName(i,"table")&&bH.nodeName(e.nodeType!==11?e:e.firstChild,"tr")?i.getElementsByTagName("tbody")[0]||i.appendChild(i.ownerDocument.createElement("tbody")):i}function t(e){e.type=(bH.find.attr(e,"type")!==null)+"/"+e.type;return e}function be(i){var e=aq.exec(i.type);if(e){i.type=e[1]}else{i.removeAttribute("type")}return i}function bt(e,b6){var b7,b5=0;for(;(b7=e[b5])!=null;b5++){bH._data(b7,"globalEval",!b6||bH._data(b6[b5],"globalEval"))}}function ar(cb,b5){if(b5.nodeType!==1||!bH.hasData(cb)){return}var b8,b7,e,ca=bH._data(cb),b9=bH._data(b5,ca),b6=ca.events;if(b6){delete b9.handle;b9.events={};for(b8 in b6){for(b7=0,e=b6[b8].length;b7<e;b7++){bH.event.add(b5,b8,b6[b8][b7])}}}if(b9.data){b9.data=bH.extend({},b9.data)}}function S(b7,i){var b8,b6,b5;if(i.nodeType!==1){return}b8=i.nodeName.toLowerCase();if(!C.noCloneEvent&&i[bH.expando]){b5=bH._data(i);for(b6 in b5.events){bH.removeEvent(i,b6,b5.handle)}i.removeAttribute(bH.expando)}if(b8==="script"&&i.text!==b7.text){t(i).text=b7.text;be(i)}else{if(b8==="object"){if(i.parentNode){i.outerHTML=b7.outerHTML}if(C.html5Clone&&(b7.innerHTML&&!bH.trim(i.innerHTML))){i.innerHTML=b7.innerHTML}}else{if(b8==="input"&&aL.test(b7.type)){i.defaultChecked=i.checked=b7.checked;if(i.value!==b7.value){i.value=b7.value}}else{if(b8==="option"){i.defaultSelected=i.selected=b7.defaultSelected}else{if(b8==="input"||b8==="textarea"){i.defaultValue=b7.defaultValue}}}}}}bH.extend({clone:function(b5,b7,e){var b9,b6,cc,b8,ca,cb=bH.contains(b5.ownerDocument,b5);if(C.html5Clone||bH.isXMLDoc(b5)||!L.test("<"+b5.nodeName+">")){cc=b5.cloneNode(true)}else{k.innerHTML=b5.outerHTML;k.removeChild(cc=k.firstChild)}if((!C.noCloneEvent||!C.noCloneChecked)&&(b5.nodeType===1||b5.nodeType===11)&&!bH.isXMLDoc(b5)){b9=l(cc);ca=l(b5);for(b8=0;(b6=ca[b8])!=null;++b8){if(b9[b8]){S(b6,b9[b8])}}}if(b7){if(e){ca=ca||l(b5);b9=b9||l(cc);for(b8=0;(b6=ca[b8])!=null;b8++){ar(b6,b9[b8])}}else{ar(b5,cc)}}b9=l(cc,"script");if(b9.length>0){bt(b9,!cb&&l(b5,"script"))}b9=ca=b6=null;return cc},buildFragment:function(b5,b7,cc,ch){var cd,b9,cb,cg,ci,cf,b6,ca=b5.length,b8=A(b7),e=[],ce=0;for(;ce<ca;ce++){b9=b5[ce];if(b9||b9===0){if(bH.type(b9)==="object"){bH.merge(e,b9.nodeType?[b9]:b9)}else{if(!K.test(b9)){e.push(b7.createTextNode(b9))}else{cg=cg||b8.appendChild(b7.createElement("div"));ci=(o.exec(b9)||["",""])[1].toLowerCase();b6=V[ci]||V._default;cg.innerHTML=b6[1]+b9.replace(aG,"<$1></$2>")+b6[2];cd=b6[0];while(cd--){cg=cg.lastChild}if(!C.leadingWhitespace&&b4.test(b9)){e.push(b7.createTextNode(b4.exec(b9)[0]))}if(!C.tbody){b9=ci==="table"&&!bZ.test(b9)?cg.firstChild:b6[1]==="<table>"&&!bZ.test(b9)?cg:0;cd=b9&&b9.childNodes.length;while(cd--){if(bH.nodeName((cf=b9.childNodes[cd]),"tbody")&&!cf.childNodes.length){b9.removeChild(cf)}}}bH.merge(e,cg.childNodes);cg.textContent="";while(cg.firstChild){cg.removeChild(cg.firstChild)}cg=b8.lastChild}}}}if(cg){b8.removeChild(cg)}if(!C.appendChecked){bH.grep(l(e,"input"),bX)}ce=0;while((b9=e[ce++])){if(ch&&bH.inArray(b9,ch)!==-1){continue}cb=bH.contains(b9.ownerDocument,b9);cg=l(b8.appendChild(b9),"script");if(cb){bt(cg)}if(cc){cd=0;while((b9=cg[cd++])){if(bA.test(b9.type||"")){cc.push(b9)}}}}cg=null;return b8},cleanData:function(b5,cd){var b7,cc,b6,b8,b9=0,ce=bH.expando,e=bH.cache,ca=C.deleteExpando,cb=bH.event.special;for(;(b7=b5[b9])!=null;b9++){if(cd||bH.acceptData(b7)){b6=b7[ce];b8=b6&&e[b6];if(b8){if(b8.events){for(cc in b8.events){if(cb[cc]){bH.event.remove(b7,cc)}else{bH.removeEvent(b7,cc,b8.handle)}}}if(e[b6]){delete e[b6];if(ca){delete b7[ce]}else{if(typeof b7.removeAttribute!==aB){b7.removeAttribute(ce)}else{b7[ce]=null}}aO.push(b6)}}}}}});bH.fn.extend({text:function(e){return aA(this,function(i){return i===undefined?bH.text(this):this.empty().append((this[0]&&this[0].ownerDocument||n).createTextNode(i))},null,e,arguments.length)},append:function(){return this.domManip(arguments,function(e){if(this.nodeType===1||this.nodeType===11||this.nodeType===9){var i=a2(this,e);i.appendChild(e)}})},prepend:function(){return this.domManip(arguments,function(e){if(this.nodeType===1||this.nodeType===11||this.nodeType===9){var i=a2(this,e);i.insertBefore(e,i.firstChild)}})},before:function(){return this.domManip(arguments,function(e){if(this.parentNode){this.parentNode.insertBefore(e,this)}})},after:function(){return this.domManip(arguments,function(e){if(this.parentNode){this.parentNode.insertBefore(e,this.nextSibling)}})},remove:function(e,b8){var b7,b5=e?bH.filter(e,this):this,b6=0;for(;(b7=b5[b6])!=null;b6++){if(!b8&&b7.nodeType===1){bH.cleanData(l(b7))}if(b7.parentNode){if(b8&&bH.contains(b7.ownerDocument,b7)){bt(l(b7,"script"))}b7.parentNode.removeChild(b7)}}return this},empty:function(){var b5,e=0;for(;(b5=this[e])!=null;e++){if(b5.nodeType===1){bH.cleanData(l(b5,false))}while(b5.firstChild){b5.removeChild(b5.firstChild)}if(b5.options&&bH.nodeName(b5,"select")){b5.options.length=0}}return this},clone:function(i,e){i=i==null?false:i;e=e==null?i:e;return this.map(function(){return bH.clone(this,i,e)})},html:function(e){return aA(this,function(b8){var b7=this[0]||{},b6=0,b5=this.length;if(b8===undefined){return b7.nodeType===1?b7.innerHTML.replace(aC,""):undefined}if(typeof b8==="string"&&!am.test(b8)&&(C.htmlSerialize||!L.test(b8))&&(C.leadingWhitespace||!b4.test(b8))&&!V[(o.exec(b8)||["",""])[1].toLowerCase()]){b8=b8.replace(aG,"<$1></$2>");try{for(;b6<b5;b6++){b7=this[b6]||{};if(b7.nodeType===1){bH.cleanData(l(b7,false));b7.innerHTML=b8}}b7=0}catch(b9){}}if(b7){this.empty().append(b8)}},null,e,arguments.length)},replaceWith:function(){var e=arguments[0];this.domManip(arguments,function(i){e=this.parentNode;bH.cleanData(l(this));if(e){e.replaceChild(i,this)}});return e&&(e.length||e.nodeType)?this:this.remove()},detach:function(e){return this.remove(e,true)},domManip:function(cc,ch){cc=ay.apply([],cc);var ca,b6,e,b8,cf,cb,b9=0,b7=this.length,ce=this,cg=b7-1,cd=cc[0],b5=bH.isFunction(cd);if(b5||(b7>1&&typeof cd==="string"&&!C.checkClone&&bV.test(cd))){return this.each(function(ci){var i=ce.eq(ci);if(b5){cc[0]=cd.call(this,ci,i.html())}i.domManip(cc,ch)})}if(b7){cb=bH.buildFragment(cc,this[0].ownerDocument,false,this);ca=cb.firstChild;if(cb.childNodes.length===1){cb=ca}if(ca){b8=bH.map(l(cb,"script"),t);e=b8.length;for(;b9<b7;b9++){b6=cb;if(b9!==cg){b6=bH.clone(b6,true,true);if(e){bH.merge(b8,l(b6,"script"))}}ch.call(this[b9],b6,b9)}if(e){cf=b8[b8.length-1].ownerDocument;bH.map(b8,be);for(b9=0;b9<e;b9++){b6=b8[b9];if(bA.test(b6.type||"")&&!bH._data(b6,"globalEval")&&bH.contains(cf,b6)){if(b6.src){if(bH._evalUrl){bH._evalUrl(b6.src)}}else{bH.globalEval((b6.text||b6.textContent||b6.innerHTML||"").replace(aN,""))}}}}cb=ca=null}}return this}});bH.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(e,i){bH.fn[e]=function(b5){var b6,b8=0,b7=[],ca=bH(b5),b9=ca.length-1;for(;b8<=b9;b8++){b6=b8===b9?this:this.clone(true);bH(ca[b8])[i](b6);w.apply(b7,b6.get())}return this.pushStack(b7)}});var aH,bk={};function a3(e,b7){var i,b5=bH(b7.createElement(e)).appendTo(b7.body),b6=a4.getDefaultComputedStyle&&(i=a4.getDefaultComputedStyle(b5[0]))?i.display:bH.css(b5[0],"display");b5.detach();return b6}function aZ(b5){var i=n,e=bk[b5];if(!e){e=a3(b5,i);if(e==="none"||!e){aH=(aH||bH("<iframe frameborder='0' width='0' height='0'/>")).appendTo(i.documentElement);i=(aH[0].contentWindow||aH[0].contentDocument).document;i.write();i.close();e=a3(b5,i);aH.detach()}bk[b5]=e}return e}(function(){var e;C.shrinkWrapBlocks=function(){if(e!=null){return e}e=false;var b6,i,b5;i=n.getElementsByTagName("body")[0];if(!i||!i.style){return}b6=n.createElement("div");b5=n.createElement("div");b5.style.cssText="position:absolute;border:0;width:0;height:0;top:0;left:-9999px";i.appendChild(b5).appendChild(b6);if(typeof b6.style.zoom!==aB){b6.style.cssText="-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;display:block;margin:0;border:0;padding:1px;width:1px;zoom:1";b6.appendChild(n.createElement("div")).style.width="5px";e=b6.offsetWidth!==3}i.removeChild(b5);return e}})();var aY=(/^margin/);var X=new RegExp("^("+aD+")(?!px)[a-z%]+$","i");var bp,F,bn=/^(top|right|bottom|left)$/;if(a4.getComputedStyle){bp=function(e){return e.ownerDocument.defaultView.getComputedStyle(e,null)};F=function(ca,i,b9){var b7,b6,b8,e,b5=ca.style;b9=b9||bp(ca);e=b9?b9.getPropertyValue(i)||b9[i]:undefined;if(b9){if(e===""&&!bH.contains(ca.ownerDocument,ca)){e=bH.style(ca,i)}if(X.test(e)&&aY.test(i)){b7=b5.width;b6=b5.minWidth;b8=b5.maxWidth;b5.minWidth=b5.maxWidth=b5.width=e;e=b9.width;b5.width=b7;b5.minWidth=b6;b5.maxWidth=b8}}return e===undefined?e:e+""}}else{if(n.documentElement.currentStyle){bp=function(e){return e.currentStyle};F=function(b9,b6,b8){var ca,i,e,b5,b7=b9.style;b8=b8||bp(b9);b5=b8?b8[b6]:undefined;if(b5==null&&b7&&b7[b6]){b5=b7[b6]}if(X.test(b5)&&!bn.test(b6)){ca=b7.left;i=b9.runtimeStyle;e=i&&i.left;if(e){i.left=b9.currentStyle.left}b7.left=b6==="fontSize"?"1em":b5;b5=b7.pixelLeft+"px";b7.left=ca;if(e){i.left=e}}return b5===undefined?b5:b5+""||"auto"}}}function a6(e,i){return{get:function(){var b5=e();if(b5==null){return}if(b5){delete this.get;return}return(this.get=i).apply(this,arguments)}}}(function(){var ca,b8,b6,b9,b5,b7,i;ca=n.createElement("div");ca.innerHTML="  <link/><table></table><a href='/a'>a</a><input type='checkbox'/>";b6=ca.getElementsByTagName("a")[0];b8=b6&&b6.style;if(!b8){return}b8.cssText="float:left;opacity:.5";C.opacity=b8.opacity==="0.5";C.cssFloat=!!b8.cssFloat;ca.style.backgroundClip="content-box";ca.cloneNode(true).style.backgroundClip="";C.clearCloneStyle=ca.style.backgroundClip==="content-box";C.boxSizing=b8.boxSizing===""||b8.MozBoxSizing===""||b8.WebkitBoxSizing==="";bH.extend(C,{reliableHiddenOffsets:function(){if(b7==null){e()}return b7},boxSizingReliable:function(){if(b5==null){e()}return b5},pixelPosition:function(){if(b9==null){e()}return b9},reliableMarginRight:function(){if(i==null){e()}return i}});function e(){var ce,cb,cc,cd;cb=n.getElementsByTagName("body")[0];if(!cb||!cb.style){return}ce=n.createElement("div");cc=n.createElement("div");cc.style.cssText="position:absolute;border:0;width:0;height:0;top:0;left:-9999px";cb.appendChild(cc).appendChild(ce);ce.style.cssText="-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;display:block;margin-top:1%;top:1%;border:1px;padding:1px;width:4px;position:absolute";b9=b5=false;i=true;if(a4.getComputedStyle){b9=(a4.getComputedStyle(ce,null)||{}).top!=="1%";b5=(a4.getComputedStyle(ce,null)||{width:"4px"}).width==="4px";cd=ce.appendChild(n.createElement("div"));cd.style.cssText=ce.style.cssText="-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;display:block;margin:0;border:0;padding:0";cd.style.marginRight=cd.style.width="0";ce.style.width="1px";i=!parseFloat((a4.getComputedStyle(cd,null)||{}).marginRight)}ce.innerHTML="<table><tr><td></td><td>t</td></tr></table>";cd=ce.getElementsByTagName("td");cd[0].style.cssText="margin:0;border:0;padding:0;display:none";b7=cd[0].offsetHeight===0;if(b7){cd[0].style.display="";cd[1].style.display="none";b7=cd[0].offsetHeight===0}cb.removeChild(cc)}})();bH.swap=function(b8,b7,b9,b6){var b5,i,e={};for(i in b7){e[i]=b8.style[i];b8.style[i]=b7[i]}b5=b9.apply(b8,b6||[]);for(i in b7){b8.style[i]=e[i]}return b5};var bi=/alpha\([^)]*\)/i,aT=/opacity\s*=\s*([^)]*)/,G=/^(none|table(?!-c[ea]).+)/,ba=new RegExp("^("+aD+")(.*)$","i"),U=new RegExp("^([+-])=("+aD+")","i"),bd={position:"absolute",visibility:"hidden",display:"block"},bC={letterSpacing:"0",fontWeight:"400"},av=["Webkit","O","Moz","ms"];function c(b7,b5){if(b5 in b7){return b5}var b8=b5.charAt(0).toUpperCase()+b5.slice(1),e=b5,b6=av.length;while(b6--){b5=av[b6]+b8;if(b5 in b7){return b5}}return e}function r(b9,e){var ca,b7,b8,i=[],b5=0,b6=b9.length;for(;b5<b6;b5++){b7=b9[b5];if(!b7.style){continue}i[b5]=bH._data(b7,"olddisplay");ca=b7.style.display;if(e){if(!i[b5]&&ca==="none"){b7.style.display=""}if(b7.style.display===""&&R(b7)){i[b5]=bH._data(b7,"olddisplay",aZ(b7.nodeName))}}else{b8=R(b7);if(ca&&ca!=="none"||!b8){bH._data(b7,"olddisplay",b8?ca:bH.css(b7,"display"))}}}for(b5=0;b5<b6;b5++){b7=b9[b5];if(!b7.style){continue}if(!e||b7.style.display==="none"||b7.style.display===""){b7.style.display=e?i[b5]||"":"none"}}return b9}function aM(e,b5,b6){var i=ba.exec(b5);return i?Math.max(0,i[1]-(b6||0))+(i[2]||"px"):b5}function aw(b8,b5,e,ca,b7){var b6=e===(ca?"border":"content")?4:b5==="width"?1:0,b9=0;for(;b6<4;b6+=2){if(e==="margin"){b9+=bH.css(b8,e+bS[b6],true,b7)}if(ca){if(e==="content"){b9-=bH.css(b8,"padding"+bS[b6],true,b7)}if(e!=="margin"){b9-=bH.css(b8,"border"+bS[b6]+"Width",true,b7)}}else{b9+=bH.css(b8,"padding"+bS[b6],true,b7);if(e!=="padding"){b9+=bH.css(b8,"border"+bS[b6]+"Width",true,b7)}}}return b9}function u(b7,i,e){var b6=true,b8=i==="width"?b7.offsetWidth:b7.offsetHeight,b5=bp(b7),b9=C.boxSizing&&bH.css(b7,"boxSizing",false,b5)==="border-box";if(b8<=0||b8==null){b8=F(b7,i,b5);if(b8<0||b8==null){b8=b7.style[i]}if(X.test(b8)){return b8}b6=b9&&(C.boxSizingReliable()||b8===b7.style[i]);b8=parseFloat(b8)||0}return(b8+aw(b7,i,e||(b9?"border":"content"),b6,b5))+"px"}bH.extend({cssHooks:{opacity:{get:function(b5,i){if(i){var e=F(b5,"opacity");return e===""?"1":e}}}},cssNumber:{columnCount:true,fillOpacity:true,flexGrow:true,flexShrink:true,fontWeight:true,lineHeight:true,opacity:true,order:true,orphans:true,widows:true,zIndex:true,zoom:true},cssProps:{"float":C.cssFloat?"cssFloat":"styleFloat"},style:function(b6,b5,cc,b7){if(!b6||b6.nodeType===3||b6.nodeType===8||!b6.style){return}var ca,cb,cd,b8=bH.camelCase(b5),i=b6.style;b5=bH.cssProps[b8]||(bH.cssProps[b8]=c(i,b8));cd=bH.cssHooks[b5]||bH.cssHooks[b8];if(cc!==undefined){cb=typeof cc;if(cb==="string"&&(ca=U.exec(cc))){cc=(ca[1]+1)*ca[2]+parseFloat(bH.css(b6,b5));cb="number"}if(cc==null||cc!==cc){return}if(cb==="number"&&!bH.cssNumber[b8]){cc+="px"}if(!C.clearCloneStyle&&cc===""&&b5.indexOf("background")===0){i[b5]="inherit"}if(!cd||!("set" in cd)||(cc=cd.set(b6,cc,b7))!==undefined){try{i[b5]=cc}catch(b9){}}}else{if(cd&&"get" in cd&&(ca=cd.get(b6,false,b7))!==undefined){return ca}return i[b5]}},css:function(b9,b7,i,b8){var b6,ca,e,b5=bH.camelCase(b7);b7=bH.cssProps[b5]||(bH.cssProps[b5]=c(b9.style,b5));e=bH.cssHooks[b7]||bH.cssHooks[b5];if(e&&"get" in e){ca=e.get(b9,true,i)}if(ca===undefined){ca=F(b9,b7,b8)}if(ca==="normal"&&b7 in bC){ca=bC[b7]}if(i===""||i){b6=parseFloat(ca);return i===true||bH.isNumeric(b6)?b6||0:ca}return ca}});bH.each(["height","width"],function(b5,e){bH.cssHooks[e]={get:function(b7,b6,i){if(b6){return G.test(bH.css(b7,"display"))&&b7.offsetWidth===0?bH.swap(b7,bd,function(){return u(b7,e,i)}):u(b7,e,i)}},set:function(b7,b8,i){var b6=i&&bp(b7);return aM(b7,b8,i?aw(b7,e,i,C.boxSizing&&bH.css(b7,"boxSizing",false,b6)==="border-box",b6):0)}}});if(!C.opacity){bH.cssHooks.opacity={get:function(i,e){return aT.test((e&&i.currentStyle?i.currentStyle.filter:i.style.filter)||"")?(0.01*parseFloat(RegExp.$1))+"":e?"1":""},set:function(b7,b8){var b6=b7.style,i=b7.currentStyle,e=bH.isNumeric(b8)?"alpha(opacity="+b8*100+")":"",b5=i&&i.filter||b6.filter||"";b6.zoom=1;if((b8>=1||b8==="")&&bH.trim(b5.replace(bi,""))===""&&b6.removeAttribute){b6.removeAttribute("filter");if(b8===""||i&&!i.filter){return}}b6.filter=bi.test(b5)?b5.replace(bi,e):b5+" "+e}}}bH.cssHooks.marginRight=a6(C.reliableMarginRight,function(i,e){if(e){return bH.swap(i,{display:"inline-block"},F,[i,"marginRight"])}});bH.each({margin:"",padding:"",border:"Width"},function(e,i){bH.cssHooks[e+i]={expand:function(b7){var b6=0,b5={},b8=typeof b7==="string"?b7.split(" "):[b7];for(;b6<4;b6++){b5[e+bS[b6]+i]=b8[b6]||b8[b6-2]||b8[0]}return b5}};if(!aY.test(e)){bH.cssHooks[e+i].set=aM}});bH.fn.extend({css:function(e,i){return aA(this,function(b9,b6,ca){var b8,b5,cb={},b7=0;if(bH.isArray(b6)){b8=bp(b9);b5=b6.length;for(;b7<b5;b7++){cb[b6[b7]]=bH.css(b9,b6[b7],false,b8)}return cb}return ca!==undefined?bH.style(b9,b6,ca):bH.css(b9,b6)},e,i,arguments.length>1)},show:function(){return r(this,true)},hide:function(){return r(this)},toggle:function(e){if(typeof e==="boolean"){return e?this.show():this.hide()}return this.each(function(){if(R(this)){bH(this).show()}else{bH(this).hide()}})}});function I(b5,i,b7,e,b6){return new I.prototype.init(b5,i,b7,e,b6)}bH.Tween=I;I.prototype={constructor:I,init:function(b6,i,b8,e,b7,b5){this.elem=b6;this.prop=b8;this.easing=b7||"swing";this.options=i;this.start=this.now=this.cur();this.end=e;this.unit=b5||(bH.cssNumber[b8]?"":"px")},cur:function(){var e=I.propHooks[this.prop];return e&&e.get?e.get(this):I.propHooks._default.get(this)},run:function(b5){var i,e=I.propHooks[this.prop];if(this.options.duration){this.pos=i=bH.easing[this.easing](b5,this.options.duration*b5,0,1,this.options.duration)}else{this.pos=i=b5}this.now=(this.end-this.start)*i+this.start;if(this.options.step){this.options.step.call(this.elem,this.now,this)}if(e&&e.set){e.set(this)}else{I.propHooks._default.set(this)}return this}};I.prototype.init.prototype=I.prototype;I.propHooks={_default:{get:function(i){var e;if(i.elem[i.prop]!=null&&(!i.elem.style||i.elem.style[i.prop]==null)){return i.elem[i.prop]}e=bH.css(i.elem,i.prop,"");return !e||e==="auto"?0:e},set:function(e){if(bH.fx.step[e.prop]){bH.fx.step[e.prop](e)}else{if(e.elem.style&&(e.elem.style[bH.cssProps[e.prop]]!=null||bH.cssHooks[e.prop])){bH.style(e.elem,e.prop,e.now+e.unit)}else{e.elem[e.prop]=e.now}}}}};I.propHooks.scrollTop=I.propHooks.scrollLeft={set:function(e){if(e.elem.nodeType&&e.elem.parentNode){e.elem[e.prop]=e.now}}};bH.easing={linear:function(e){return e},swing:function(e){return 0.5-Math.cos(e*Math.PI)/2}};bH.fx=I.prototype.init;bH.fx.step={};var M,ad,bQ=/^(?:toggle|show|hide)$/,bI=new RegExp("^(?:([+-])=|)("+aD+")([a-z%]*)$","i"),bO=/queueHooks$/,aF=[h],a1={"*":[function(e,b9){var cb=this.createTween(e,b9),b7=cb.cur(),b6=bI.exec(b9),ca=b6&&b6[3]||(bH.cssNumber[e]?"":"px"),i=(bH.cssNumber[e]||ca!=="px"&&+b7)&&bI.exec(bH.css(cb.elem,e)),b5=1,b8=20;if(i&&i[3]!==ca){ca=ca||i[3];b6=b6||[];i=+b7||1;do{b5=b5||".5";i=i/b5;bH.style(cb.elem,e,i+ca)}while(b5!==(b5=cb.cur()/b7)&&b5!==1&&--b8)}if(b6){i=cb.start=+i||+b7||0;cb.unit=ca;cb.end=b6[1]?i+(b6[1]+1)*b6[2]:+b6[2]}return cb}]};function bm(){setTimeout(function(){M=undefined});return(M=bH.now())}function bG(b6,b8){var b7,e={height:b6},b5=0;b8=b8?1:0;for(;b5<4;b5+=2-b8){b7=bS[b5];e["margin"+b7]=e["padding"+b7]=b6}if(b8){e.opacity=e.width=b6}return e}function bc(b7,b9,b6){var i,b8=(a1[b9]||[]).concat(a1["*"]),e=0,b5=b8.length;for(;e<b5;e++){if((i=b8[e].call(b6,b9,b7))){return i}}}function h(b6,cb,e){var b5,ce,b8,ch,ci,cf,ca,cd,b7=this,cc={},i=b6.style,b9=b6.nodeType&&R(b6),cg=bH._data(b6,"fxshow");if(!e.queue){ci=bH._queueHooks(b6,"fx");if(ci.unqueued==null){ci.unqueued=0;cf=ci.empty.fire;ci.empty.fire=function(){if(!ci.unqueued){cf()}}}ci.unqueued++;b7.always(function(){b7.always(function(){ci.unqueued--;if(!bH.queue(b6,"fx").length){ci.empty.fire()}})})}if(b6.nodeType===1&&("height" in cb||"width" in cb)){e.overflow=[i.overflow,i.overflowX,i.overflowY];ca=bH.css(b6,"display");cd=ca==="none"?bH._data(b6,"olddisplay")||aZ(b6.nodeName):ca;if(cd==="inline"&&bH.css(b6,"float")==="none"){if(!C.inlineBlockNeedsLayout||aZ(b6.nodeName)==="inline"){i.display="inline-block"}else{i.zoom=1}}}if(e.overflow){i.overflow="hidden";if(!C.shrinkWrapBlocks()){b7.always(function(){i.overflow=e.overflow[0];i.overflowX=e.overflow[1];i.overflowY=e.overflow[2]})}}for(b5 in cb){ce=cb[b5];if(bQ.exec(ce)){delete cb[b5];b8=b8||ce==="toggle";if(ce===(b9?"hide":"show")){if(ce==="show"&&cg&&cg[b5]!==undefined){b9=true}else{continue}}cc[b5]=cg&&cg[b5]||bH.style(b6,b5)}else{ca=undefined}}if(!bH.isEmptyObject(cc)){if(cg){if("hidden" in cg){b9=cg.hidden}}else{cg=bH._data(b6,"fxshow",{})}if(b8){cg.hidden=!b9}if(b9){bH(b6).show()}else{b7.done(function(){bH(b6).hide()})}b7.done(function(){var cj;bH._removeData(b6,"fxshow");for(cj in cc){bH.style(b6,cj,cc[cj])}});for(b5 in cc){ch=bc(b9?cg[b5]:0,b5,b7);if(!(b5 in cg)){cg[b5]=ch.start;if(b9){ch.end=ch.start;ch.start=b5==="width"||b5==="height"?1:0}}}}else{if((ca==="none"?aZ(b6.nodeName):ca)==="inline"){i.display=ca}}}function an(b6,b8){var b5,i,b9,b7,e;for(b5 in b6){i=bH.camelCase(b5);b9=b8[i];b7=b6[b5];if(bH.isArray(b7)){b9=b7[1];b7=b6[b5]=b7[0]}if(b5!==i){b6[i]=b7;delete b6[b5]}e=bH.cssHooks[i];if(e&&"expand" in e){b7=e.expand(b7);delete b6[i];for(b5 in b7){if(!(b5 in b6)){b6[b5]=b7[b5];b8[b5]=b9}}}else{b8[i]=b9}}}function f(b5,b9,cc){var cd,e,b8=0,i=aF.length,cb=bH.Deferred().always(function(){delete b7.elem}),b7=function(){if(e){return false}var cj=M||bm(),cg=Math.max(0,b6.startTime+b6.duration-cj),ce=cg/b6.duration||0,ci=1-ce,cf=0,ch=b6.tweens.length;for(;cf<ch;cf++){b6.tweens[cf].run(ci)}cb.notifyWith(b5,[b6,ci,cg]);if(ci<1&&ch){return cg}else{cb.resolveWith(b5,[b6]);return false}},b6=cb.promise({elem:b5,props:bH.extend({},b9),opts:bH.extend(true,{specialEasing:{}},cc),originalProperties:b9,originalOptions:cc,startTime:M||bm(),duration:cc.duration,tweens:[],createTween:function(cg,ce){var cf=bH.Tween(b5,b6.opts,cg,ce,b6.opts.specialEasing[cg]||b6.opts.easing);b6.tweens.push(cf);return cf},stop:function(cf){var ce=0,cg=cf?b6.tweens.length:0;if(e){return this}e=true;for(;ce<cg;ce++){b6.tweens[ce].run(1)}if(cf){cb.resolveWith(b5,[b6,cf])}else{cb.rejectWith(b5,[b6,cf])}return this}}),ca=b6.props;an(ca,b6.opts.specialEasing);for(;b8<i;b8++){cd=aF[b8].call(b6,b5,ca,b6.opts);if(cd){return cd}}bH.map(ca,bc,b6);if(bH.isFunction(b6.opts.start)){b6.opts.start.call(b5,b6)}bH.fx.timer(bH.extend(b7,{elem:b5,anim:b6,queue:b6.opts.queue}));return b6.progress(b6.opts.progress).done(b6.opts.done,b6.opts.complete).fail(b6.opts.fail).always(b6.opts.always)}bH.Animation=bH.extend(f,{tweener:function(i,b7){if(bH.isFunction(i)){b7=i;i=["*"]}else{i=i.split(" ")}var b6,e=0,b5=i.length;for(;e<b5;e++){b6=i[e];a1[b6]=a1[b6]||[];a1[b6].unshift(b7)}},prefilter:function(i,e){if(e){aF.unshift(i)}else{aF.push(i)}}});bH.speed=function(b5,b6,i){var e=b5&&typeof b5==="object"?bH.extend({},b5):{complete:i||!i&&b6||bH.isFunction(b5)&&b5,duration:b5,easing:i&&b6||b6&&!bH.isFunction(b6)&&b6};e.duration=bH.fx.off?0:typeof e.duration==="number"?e.duration:e.duration in bH.fx.speeds?bH.fx.speeds[e.duration]:bH.fx.speeds._default;if(e.queue==null||e.queue===true){e.queue="fx"}e.old=e.complete;e.complete=function(){if(bH.isFunction(e.old)){e.old.call(this)}if(e.queue){bH.dequeue(this,e.queue)}};return e};bH.fn.extend({fadeTo:function(e,b6,b5,i){return this.filter(R).css("opacity",0).show().end().animate({opacity:b6},e,b5,i)},animate:function(b9,b6,b8,b7){var b5=bH.isEmptyObject(b9),e=bH.speed(b6,b8,b7),i=function(){var ca=f(this,bH.extend({},b9),e);if(b5||bH._data(this,"finish")){ca.stop(true)}};i.finish=i;return b5||e.queue===false?this.each(i):this.queue(e.queue,i)},stop:function(b5,i,e){var b6=function(b7){var b8=b7.stop;delete b7.stop;b8(e)};if(typeof b5!=="string"){e=i;i=b5;b5=undefined}if(i&&b5!==false){this.queue(b5||"fx",[])}return this.each(function(){var ca=true,b7=b5!=null&&b5+"queueHooks",b9=bH.timers,b8=bH._data(this);if(b7){if(b8[b7]&&b8[b7].stop){b6(b8[b7])}}else{for(b7 in b8){if(b8[b7]&&b8[b7].stop&&bO.test(b7)){b6(b8[b7])}}}for(b7=b9.length;b7--;){if(b9[b7].elem===this&&(b5==null||b9[b7].queue===b5)){b9[b7].anim.stop(e);ca=false;b9.splice(b7,1)}}if(ca||!e){bH.dequeue(this,b5)}})},finish:function(e){if(e!==false){e=e||"fx"}return this.each(function(){var b6,b9=bH._data(this),b5=b9[e+"queue"],i=b9[e+"queueHooks"],b8=bH.timers,b7=b5?b5.length:0;b9.finish=true;bH.queue(this,e,[]);if(i&&i.stop){i.stop.call(this,true)}for(b6=b8.length;b6--;){if(b8[b6].elem===this&&b8[b6].queue===e){b8[b6].anim.stop(true);b8.splice(b6,1)}}for(b6=0;b6<b7;b6++){if(b5[b6]&&b5[b6].finish){b5[b6].finish.call(this)}}delete b9.finish})}});bH.each(["toggle","show","hide"],function(b5,e){var b6=bH.fn[e];bH.fn[e]=function(i,b8,b7){return i==null||typeof i==="boolean"?b6.apply(this,arguments):this.animate(bG(e,true),i,b8,b7)}});bH.each({slideDown:bG("show"),slideUp:bG("hide"),slideToggle:bG("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(e,i){bH.fn[e]=function(b5,b7,b6){return this.animate(i,b5,b7,b6)}});bH.timers=[];bH.fx.tick=function(){var b6,b5=bH.timers,e=0;M=bH.now();for(;e<b5.length;e++){b6=b5[e];if(!b6()&&b5[e]===b6){b5.splice(e--,1)}}if(!b5.length){bH.fx.stop()}M=undefined};bH.fx.timer=function(e){bH.timers.push(e);if(e()){bH.fx.start()}else{bH.timers.pop()}};bH.fx.interval=13;bH.fx.start=function(){if(!ad){ad=setInterval(bH.fx.tick,bH.fx.interval)}};bH.fx.stop=function(){clearInterval(ad);ad=null};bH.fx.speeds={slow:600,fast:200,_default:400};bH.fn.delay=function(i,e){i=bH.fx?bH.fx.speeds[i]||i:i;e=e||"fx";return this.queue(e,function(b6,b5){var b7=setTimeout(b6,i);b5.stop=function(){clearTimeout(b7)}})};(function(){var b5,b7,e,i,b6;b7=n.createElement("div");b7.setAttribute("className","t");b7.innerHTML="  <link/><table></table><a href='/a'>a</a><input type='checkbox'/>";i=b7.getElementsByTagName("a")[0];e=n.createElement("select");b6=e.appendChild(n.createElement("option"));b5=b7.getElementsByTagName("input")[0];i.style.cssText="top:1px";C.getSetAttribute=b7.className!=="t";C.style=/top/.test(i.getAttribute("style"));C.hrefNormalized=i.getAttribute("href")==="/a";C.checkOn=!!b5.value;C.optSelected=b6.selected;C.enctype=!!n.createElement("form").enctype;e.disabled=true;C.optDisabled=!b6.disabled;b5=n.createElement("input");b5.setAttribute("value","");C.input=b5.getAttribute("value")==="";b5.value="t";b5.setAttribute("type","radio");C.radioValue=b5.value==="t"})();var ak=/\r/g;bH.fn.extend({val:function(b6){var e,i,b7,b5=this[0];if(!arguments.length){if(b5){e=bH.valHooks[b5.type]||bH.valHooks[b5.nodeName.toLowerCase()];if(e&&"get" in e&&(i=e.get(b5,"value"))!==undefined){return i}i=b5.value;return typeof i==="string"?i.replace(ak,""):i==null?"":i}return}b7=bH.isFunction(b6);return this.each(function(b8){var b9;if(this.nodeType!==1){return}if(b7){b9=b6.call(this,b8,bH(this).val())}else{b9=b6}if(b9==null){b9=""}else{if(typeof b9==="number"){b9+=""}else{if(bH.isArray(b9)){b9=bH.map(b9,function(ca){return ca==null?"":ca+""})}}}e=bH.valHooks[this.type]||bH.valHooks[this.nodeName.toLowerCase()];if(!e||!("set" in e)||e.set(this,b9,"value")===undefined){this.value=b9}})}});bH.extend({valHooks:{option:{get:function(e){var i=bH.find.attr(e,"value");return i!=null?i:bH.trim(bH.text(e))}},select:{get:function(e){var ca,b6,cc=e.options,b8=e.selectedIndex,b7=e.type==="select-one"||b8<0,cb=b7?null:[],b9=b7?b8+1:cc.length,b5=b8<0?b9:b7?b8:0;for(;b5<b9;b5++){b6=cc[b5];if((b6.selected||b5===b8)&&(C.optDisabled?!b6.disabled:b6.getAttribute("disabled")===null)&&(!b6.parentNode.disabled||!bH.nodeName(b6.parentNode,"optgroup"))){ca=bH(b6).val();if(b7){return ca}cb.push(ca)}}return cb},set:function(b9,ca){var cb,b8,b6=b9.options,e=bH.makeArray(ca),b7=b6.length;while(b7--){b8=b6[b7];if(bH.inArray(bH.valHooks.option.get(b8),e)>=0){try{b8.selected=cb=true}catch(b5){b8.scrollHeight}}else{b8.selected=false}}if(!cb){b9.selectedIndex=-1}return b6}}}});bH.each(["radio","checkbox"],function(){bH.valHooks[this]={set:function(e,i){if(bH.isArray(i)){return(e.checked=bH.inArray(bH(e).val(),i)>=0)}}};if(!C.checkOn){bH.valHooks[this].get=function(e){return e.getAttribute("value")===null?"on":e.value}}});var a9,b2,bN=bH.expr.attrHandle,ap=/^(?:checked|selected)$/i,bM=C.getSetAttribute,bE=C.input;bH.fn.extend({attr:function(e,i){return aA(this,bH.attr,e,i,arguments.length>1)},removeAttr:function(e){return this.each(function(){bH.removeAttr(this,e)})}});bH.extend({attr:function(b7,b6,b8){var e,b5,i=b7.nodeType;if(!b7||i===3||i===8||i===2){return}if(typeof b7.getAttribute===aB){return bH.prop(b7,b6,b8)}if(i!==1||!bH.isXMLDoc(b7)){b6=b6.toLowerCase();e=bH.attrHooks[b6]||(bH.expr.match.bool.test(b6)?b2:a9)}if(b8!==undefined){if(b8===null){bH.removeAttr(b7,b6)}else{if(e&&"set" in e&&(b5=e.set(b7,b8,b6))!==undefined){return b5}else{b7.setAttribute(b6,b8+"");return b8}}}else{if(e&&"get" in e&&(b5=e.get(b7,b6))!==null){return b5}else{b5=bH.find.attr(b7,b6);return b5==null?undefined:b5}}},removeAttr:function(b6,b8){var e,b7,b5=0,b9=b8&&b8.match(aE);if(b9&&b6.nodeType===1){while((e=b9[b5++])){b7=bH.propFix[e]||e;if(bH.expr.match.bool.test(e)){if(bE&&bM||!ap.test(e)){b6[b7]=false}else{b6[bH.camelCase("default-"+e)]=b6[b7]=false}}else{bH.attr(b6,e,"")}b6.removeAttribute(bM?e:b7)}}},attrHooks:{type:{set:function(e,i){if(!C.radioValue&&i==="radio"&&bH.nodeName(e,"input")){var b5=e.value;e.setAttribute("type",i);if(b5){e.value=b5}return i}}}}});b2={set:function(i,b5,e){if(b5===false){bH.removeAttr(i,e)}else{if(bE&&bM||!ap.test(e)){i.setAttribute(!bM&&bH.propFix[e]||e,e)}else{i[bH.camelCase("default-"+e)]=i[e]=true}}return e}};bH.each(bH.expr.match.bool.source.match(/\w+/g),function(b6,b5){var e=bN[b5]||bH.find.attr;bN[b5]=bE&&bM||!ap.test(b5)?function(b8,b7,ca){var i,b9;if(!ca){b9=bN[b7];bN[b7]=i;i=e(b8,b7,ca)!=null?b7.toLowerCase():null;bN[b7]=b9}return i}:function(b7,i,b8){if(!b8){return b7[bH.camelCase("default-"+i)]?i.toLowerCase():null}}});if(!bE||!bM){bH.attrHooks.value={set:function(i,b5,e){if(bH.nodeName(i,"input")){i.defaultValue=b5}else{return a9&&a9.set(i,b5,e)}}}}if(!bM){a9={set:function(b5,b6,i){var e=b5.getAttributeNode(i);if(!e){b5.setAttributeNode((e=b5.ownerDocument.createAttribute(i)))}e.value=b6+="";if(i==="value"||b6===b5.getAttribute(i)){return b6}}};bN.id=bN.name=bN.coords=function(b5,i,b6){var e;if(!b6){return(e=b5.getAttributeNode(i))&&e.value!==""?e.value:null}};bH.valHooks.button={get:function(b5,i){var e=b5.getAttributeNode(i);if(e&&e.specified){return e.value}},set:a9.set};bH.attrHooks.contenteditable={set:function(i,b5,e){a9.set(i,b5===""?false:b5,e)}};bH.each(["width","height"],function(b5,e){bH.attrHooks[e]={set:function(i,b6){if(b6===""){i.setAttribute(e,"auto");return b6}}}})}if(!C.style){bH.attrHooks.style={get:function(e){return e.style.cssText||undefined},set:function(e,i){return(e.style.cssText=i+"")}}}var aI=/^(?:input|select|textarea|button|object)$/i,E=/^(?:a|area)$/i;bH.fn.extend({prop:function(e,i){return aA(this,bH.prop,e,i,arguments.length>1)},removeProp:function(e){e=bH.propFix[e]||e;return this.each(function(){try{this[e]=undefined;delete this[e]}catch(i){}})}});bH.extend({propFix:{"for":"htmlFor","class":"className"},prop:function(b8,b6,b9){var b5,e,b7,i=b8.nodeType;if(!b8||i===3||i===8||i===2){return}b7=i!==1||!bH.isXMLDoc(b8);if(b7){b6=bH.propFix[b6]||b6;e=bH.propHooks[b6]}if(b9!==undefined){return e&&"set" in e&&(b5=e.set(b8,b9,b6))!==undefined?b5:(b8[b6]=b9)}else{return e&&"get" in e&&(b5=e.get(b8,b6))!==null?b5:b8[b6]}},propHooks:{tabIndex:{get:function(i){var e=bH.find.attr(i,"tabindex");return e?parseInt(e,10):aI.test(i.nodeName)||E.test(i.nodeName)&&i.href?0:-1}}}});if(!C.hrefNormalized){bH.each(["href","src"],function(b5,e){bH.propHooks[e]={get:function(i){return i.getAttribute(e,4)}}})}if(!C.optSelected){bH.propHooks.selected={get:function(i){var e=i.parentNode;if(e){e.selectedIndex;if(e.parentNode){e.parentNode.selectedIndex}}return null}}}bH.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){bH.propFix[this.toLowerCase()]=this});if(!C.enctype){bH.propFix.enctype="encoding"}var bK=/[\t\r\n\f]/g;bH.fn.extend({addClass:function(cc){var b6,b5,cd,ca,b7,e,b8=0,b9=this.length,cb=typeof cc==="string"&&cc;if(bH.isFunction(cc)){return this.each(function(i){bH(this).addClass(cc.call(this,i,this.className))})}if(cb){b6=(cc||"").match(aE)||[];for(;b8<b9;b8++){b5=this[b8];cd=b5.nodeType===1&&(b5.className?(" "+b5.className+" ").replace(bK," "):" ");if(cd){b7=0;while((ca=b6[b7++])){if(cd.indexOf(" "+ca+" ")<0){cd+=ca+" "}}e=bH.trim(cd);if(b5.className!==e){b5.className=e}}}}return this},removeClass:function(cc){var b6,b5,cd,ca,b7,e,b8=0,b9=this.length,cb=arguments.length===0||typeof cc==="string"&&cc;if(bH.isFunction(cc)){return this.each(function(i){bH(this).removeClass(cc.call(this,i,this.className))})}if(cb){b6=(cc||"").match(aE)||[];for(;b8<b9;b8++){b5=this[b8];cd=b5.nodeType===1&&(b5.className?(" "+b5.className+" ").replace(bK," "):"");if(cd){b7=0;while((ca=b6[b7++])){while(cd.indexOf(" "+ca+" ")>=0){cd=cd.replace(" "+ca+" "," ")}}e=cc?bH.trim(cd):"";if(b5.className!==e){b5.className=e}}}}return this},toggleClass:function(b5,e){var i=typeof b5;if(typeof e==="boolean"&&i==="string"){return e?this.addClass(b5):this.removeClass(b5)}if(bH.isFunction(b5)){return this.each(function(b6){bH(this).toggleClass(b5.call(this,b6,this.className,e),e)})}return this.each(function(){if(i==="string"){var b8,b7=0,b6=bH(this),b9=b5.match(aE)||[];while((b8=b9[b7++])){if(b6.hasClass(b8)){b6.removeClass(b8)}else{b6.addClass(b8)}}}else{if(i===aB||i==="boolean"){if(this.className){bH._data(this,"__className__",this.className)}this.className=this.className||b5===false?"":bH._data(this,"__className__")||""}}})},hasClass:function(e){var b7=" "+e+" ",b6=0,b5=this.length;for(;b6<b5;b6++){if(this[b6].nodeType===1&&(" "+this[b6].className+" ").replace(bK," ").indexOf(b7)>=0){return true}}return false}});bH.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(b5,e){bH.fn[e]=function(b6,i){return arguments.length>0?this.on(e,null,b6,i):this.trigger(e)}});bH.fn.extend({hover:function(e,i){return this.mouseenter(e).mouseleave(i||e)},bind:function(e,b5,i){return this.on(e,null,b5,i)},unbind:function(e,i){return this.off(e,null,i)},delegate:function(e,i,b6,b5){return this.on(i,e,b6,b5)},undelegate:function(e,i,b5){return arguments.length===1?this.off(e,"**"):this.off(i,e||"**",b5)}});var bo=bH.now();var bP=(/\?/);var a0=/(,)|(\[|{)|(}|])|"(?:[^"\\\r\n]|\\["\\\/bfnrt]|\\u[\da-fA-F]{4})*"\s*:?|true|false|null|-?(?!0\d)\d+(?:\.\d+|)(?:[eE][+-]?\d+|)/g;bH.parseJSON=function(e){if(a4.JSON&&a4.JSON.parse){return a4.JSON.parse(e+"")}var b6,b5=null,i=bH.trim(e+"");return i&&!bH.trim(i.replace(a0,function(b9,b7,b8,ca){if(b6&&b7){b5=0}if(b5===0){return b9}b6=b8||b7;b5+=!ca-!b8;return""}))?(Function("return "+i))():bH.error("Invalid JSON: "+e)};bH.parseXML=function(b6){var i,b5;if(!b6||typeof b6!=="string"){return null}try{if(a4.DOMParser){b5=new DOMParser();i=b5.parseFromString(b6,"text/xml")}else{i=new ActiveXObject("Microsoft.XMLDOM");i.async="false";i.loadXML(b6)}}catch(b7){i=undefined}if(!i||!i.documentElement||i.getElementsByTagName("parsererror").length){bH.error("Invalid XML: "+b6)}return i};var b3,Z,ao=/#.*$/,Q=/([?&])_=[^&]*/,ag=/^(.*?):[ \t]*([^\r\n]*)\r?$/mg,B=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,q=/^(?:GET|HEAD)$/,aJ=/^\/\//,aU=/^([\w.+-]+:)(?:\/\/(?:[^\/?#]*@|)([^\/?#:]*)(?::(\d+)|)|)/,v={},a8={},aW="*/".concat("*");try{Z=location.href}catch(bh){Z=n.createElement("a");Z.href="";Z=Z.href}b3=aU.exec(Z.toLowerCase())||[];function bJ(e){return function(b8,b9){if(typeof b8!=="string"){b9=b8;b8="*"}var b5,b6=0,b7=b8.toLowerCase().match(aE)||[];if(bH.isFunction(b9)){while((b5=b7[b6++])){if(b5.charAt(0)==="+"){b5=b5.slice(1)||"*";(e[b5]=e[b5]||[]).unshift(b9)}else{(e[b5]=e[b5]||[]).push(b9)}}}}}function p(e,b5,b9,b6){var i={},b7=(e===a8);function b8(ca){var cb;i[ca]=true;bH.each(e[ca]||[],function(cd,cc){var ce=cc(b5,b9,b6);if(typeof ce==="string"&&!b7&&!i[ce]){b5.dataTypes.unshift(ce);b8(ce);return false}else{if(b7){return !(cb=ce)}}});return cb}return b8(b5.dataTypes[0])||!i["*"]&&b8("*")}function s(b5,b6){var e,i,b7=bH.ajaxSettings.flatOptions||{};for(i in b6){if(b6[i]!==undefined){(b7[i]?b5:(e||(e={})))[i]=b6[i]}}if(e){bH.extend(true,b5,e)}return b5}function g(cb,ca,b7){var e,b6,b5,b8,i=cb.contents,b9=cb.dataTypes;while(b9[0]==="*"){b9.shift();if(b6===undefined){b6=cb.mimeType||ca.getResponseHeader("Content-Type")}}if(b6){for(b8 in i){if(i[b8]&&i[b8].test(b6)){b9.unshift(b8);break}}}if(b9[0] in b7){b5=b9[0]}else{for(b8 in b7){if(!b9[0]||cb.converters[b8+" "+b9[0]]){b5=b8;break}if(!e){e=b8}}b5=b5||e}if(b5){if(b5!==b9[0]){b9.unshift(b5)}return b7[b5]}}function af(cf,b7,cc,b5){var i,ca,cd,b8,b6,ce={},cb=cf.dataTypes.slice();if(cb[1]){for(cd in cf.converters){ce[cd.toLowerCase()]=cf.converters[cd]}}ca=cb.shift();while(ca){if(cf.responseFields[ca]){cc[cf.responseFields[ca]]=b7}if(!b6&&b5&&cf.dataFilter){b7=cf.dataFilter(b7,cf.dataType)}b6=ca;ca=cb.shift();if(ca){if(ca==="*"){ca=b6}else{if(b6!=="*"&&b6!==ca){cd=ce[b6+" "+ca]||ce["* "+ca];if(!cd){for(i in ce){b8=i.split(" ");if(b8[1]===ca){cd=ce[b6+" "+b8[0]]||ce["* "+b8[0]];if(cd){if(cd===true){cd=ce[i]}else{if(ce[i]!==true){ca=b8[0];cb.unshift(b8[1])}}break}}}}if(cd!==true){if(cd&&cf["throws"]){b7=cd(b7)}else{try{b7=cd(b7)}catch(b9){return{state:"parsererror",error:cd?b9:"No conversion from "+b6+" to "+ca}}}}}}}}return{state:"success",data:b7}}bH.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:Z,type:"GET",isLocal:B.test(b3[1]),global:true,processData:true,async:true,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":aW,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",json:"responseJSON"},converters:{"* text":String,"text html":true,"text json":bH.parseJSON,"text xml":bH.parseXML},flatOptions:{url:true,context:true}},ajaxSetup:function(i,e){return e?s(s(i,bH.ajaxSettings),e):s(bH.ajaxSettings,i)},ajaxPrefilter:bJ(v),ajaxTransport:bJ(a8),ajax:function(b9,b6){if(typeof b9==="object"){b6=b9;b9=undefined}b6=b6||{};var ci,ck,ca,cp,ce,b5,cl,b7,cd=bH.ajaxSetup({},b6),cr=cd.context||cd,cg=cd.context&&(cr.nodeType||cr.jquery)?bH(cr):bH.event,cq=bH.Deferred(),cn=bH.Callbacks("once memory"),cb=cd.statusCode||{},ch={},co={},b8=0,cc="canceled",cj={readyState:0,getResponseHeader:function(i){var e;if(b8===2){if(!b7){b7={};while((e=ag.exec(cp))){b7[e[1].toLowerCase()]=e[2]}}e=b7[i.toLowerCase()]}return e==null?null:e},getAllResponseHeaders:function(){return b8===2?cp:null},setRequestHeader:function(i,cs){var e=i.toLowerCase();if(!b8){i=co[e]=co[e]||i;ch[i]=cs}return this},overrideMimeType:function(e){if(!b8){cd.mimeType=e}return this},statusCode:function(i){var e;if(i){if(b8<2){for(e in i){cb[e]=[cb[e],i[e]]}}else{cj.always(i[cj.status])}}return this},abort:function(i){var e=i||cc;if(cl){cl.abort(e)}cf(0,e);return this}};cq.promise(cj).complete=cn.add;cj.success=cj.done;cj.error=cj.fail;cd.url=((b9||cd.url||Z)+"").replace(ao,"").replace(aJ,b3[1]+"//");cd.type=b6.method||b6.type||cd.method||cd.type;cd.dataTypes=bH.trim(cd.dataType||"*").toLowerCase().match(aE)||[""];if(cd.crossDomain==null){ci=aU.exec(cd.url.toLowerCase());cd.crossDomain=!!(ci&&(ci[1]!==b3[1]||ci[2]!==b3[2]||(ci[3]||(ci[1]==="http:"?"80":"443"))!==(b3[3]||(b3[1]==="http:"?"80":"443"))))}if(cd.data&&cd.processData&&typeof cd.data!=="string"){cd.data=bH.param(cd.data,cd.traditional)}p(v,cd,b6,cj);if(b8===2){return cj}b5=cd.global;if(b5&&bH.active++===0){bH.event.trigger("ajaxStart")}cd.type=cd.type.toUpperCase();cd.hasContent=!q.test(cd.type);ca=cd.url;if(!cd.hasContent){if(cd.data){ca=(cd.url+=(bP.test(ca)?"&":"?")+cd.data);delete cd.data}if(cd.cache===false){cd.url=Q.test(ca)?ca.replace(Q,"$1_="+bo++):ca+(bP.test(ca)?"&":"?")+"_="+bo++}}if(cd.ifModified){if(bH.lastModified[ca]){cj.setRequestHeader("If-Modified-Since",bH.lastModified[ca])}if(bH.etag[ca]){cj.setRequestHeader("If-None-Match",bH.etag[ca])}}if(cd.data&&cd.hasContent&&cd.contentType!==false||b6.contentType){cj.setRequestHeader("Content-Type",cd.contentType)}cj.setRequestHeader("Accept",cd.dataTypes[0]&&cd.accepts[cd.dataTypes[0]]?cd.accepts[cd.dataTypes[0]]+(cd.dataTypes[0]!=="*"?", "+aW+"; q=0.01":""):cd.accepts["*"]);for(ck in cd.headers){cj.setRequestHeader(ck,cd.headers[ck])}if(cd.beforeSend&&(cd.beforeSend.call(cr,cj,cd)===false||b8===2)){return cj.abort()}cc="abort";for(ck in {success:1,error:1,complete:1}){cj[ck](cd[ck])}cl=p(a8,cd,b6,cj);if(!cl){cf(-1,"No Transport")}else{cj.readyState=1;if(b5){cg.trigger("ajaxSend",[cj,cd])}if(cd.async&&cd.timeout>0){ce=setTimeout(function(){cj.abort("timeout")},cd.timeout)}try{b8=1;cl.send(ch,cf)}catch(cm){if(b8<2){cf(-1,cm)}else{throw cm}}}function cf(cv,i,cw,ct){var e,cz,cx,cu,cy,cs=i;if(b8===2){return}b8=2;if(ce){clearTimeout(ce)}cl=undefined;cp=ct||"";cj.readyState=cv>0?4:0;e=cv>=200&&cv<300||cv===304;if(cw){cu=g(cd,cj,cw)}cu=af(cd,cu,cj,e);if(e){if(cd.ifModified){cy=cj.getResponseHeader("Last-Modified");if(cy){bH.lastModified[ca]=cy}cy=cj.getResponseHeader("etag");if(cy){bH.etag[ca]=cy}}if(cv===204||cd.type==="HEAD"){cs="nocontent"}else{if(cv===304){cs="notmodified"}else{cs=cu.state;cz=cu.data;cx=cu.error;e=!cx}}}else{cx=cs;if(cv||!cs){cs="error";if(cv<0){cv=0}}}cj.status=cv;cj.statusText=(i||cs)+"";if(e){cq.resolveWith(cr,[cz,cs,cj])}else{cq.rejectWith(cr,[cj,cs,cx])}cj.statusCode(cb);cb=undefined;if(b5){cg.trigger(e?"ajaxSuccess":"ajaxError",[cj,cd,e?cz:cx])}cn.fireWith(cr,[cj,cs]);if(b5){cg.trigger("ajaxComplete",[cj,cd]);if(!(--bH.active)){bH.event.trigger("ajaxStop")}}}return cj},getJSON:function(e,i,b5){return bH.get(e,i,b5,"json")},getScript:function(e,i){return bH.get(e,undefined,i,"script")}});bH.each(["get","post"],function(e,b5){bH[b5]=function(i,b7,b8,b6){if(bH.isFunction(b7)){b6=b6||b8;b8=b7;b7=undefined}return bH.ajax({url:i,type:b5,dataType:b6,data:b7,success:b8})}});bH.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(e,b5){bH.fn[b5]=function(i){return this.on(b5,i)}});bH._evalUrl=function(e){return bH.ajax({url:e,type:"GET",dataType:"script",async:false,global:false,"throws":true})};bH.fn.extend({wrapAll:function(e){if(bH.isFunction(e)){return this.each(function(b5){bH(this).wrapAll(e.call(this,b5))})}if(this[0]){var i=bH(e,this[0].ownerDocument).eq(0).clone(true);if(this[0].parentNode){i.insertBefore(this[0])}i.map(function(){var b5=this;while(b5.firstChild&&b5.firstChild.nodeType===1){b5=b5.firstChild}return b5}).append(this)}return this},wrapInner:function(e){if(bH.isFunction(e)){return this.each(function(b5){bH(this).wrapInner(e.call(this,b5))})}return this.each(function(){var i=bH(this),b5=i.contents();if(b5.length){b5.wrapAll(e)}else{i.append(e)}})},wrap:function(e){var i=bH.isFunction(e);return this.each(function(b5){bH(this).wrapAll(i?e.call(this,b5):e)})},unwrap:function(){return this.parent().each(function(){if(!bH.nodeName(this,"body")){bH(this).replaceWith(this.childNodes)}}).end()}});bH.expr.filters.hidden=function(e){return e.offsetWidth<=0&&e.offsetHeight<=0||(!C.reliableHiddenOffsets()&&((e.style&&e.style.display)||bH.css(e,"display"))==="none")};bH.expr.filters.visible=function(e){return !bH.expr.filters.hidden(e)};var bv=/%20/g,aR=/\[\]$/,W=/\r?\n/g,b=/^(?:submit|button|image|reset|file)$/i,at=/^(?:input|select|textarea|keygen)/i;function j(b5,b7,i,b6){var e;if(bH.isArray(b7)){bH.each(b7,function(b9,b8){if(i||aR.test(b5)){b6(b5,b8)}else{j(b5+"["+(typeof b8==="object"?b9:"")+"]",b8,i,b6)}})}else{if(!i&&bH.type(b7)==="object"){for(e in b7){j(b5+"["+e+"]",b7[e],i,b6)}}else{b6(b5,b7)}}}bH.param=function(e,b5){var b6,i=[],b7=function(b8,b9){b9=bH.isFunction(b9)?b9():(b9==null?"":b9);i[i.length]=encodeURIComponent(b8)+"="+encodeURIComponent(b9)};if(b5===undefined){b5=bH.ajaxSettings&&bH.ajaxSettings.traditional}if(bH.isArray(e)||(e.jquery&&!bH.isPlainObject(e))){bH.each(e,function(){b7(this.name,this.value)})}else{for(b6 in e){j(b6,e[b6],b5,b7)}}return i.join("&").replace(bv,"+")};bH.fn.extend({serialize:function(){return bH.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var e=bH.prop(this,"elements");return e?bH.makeArray(e):this}).filter(function(){var e=this.type;return this.name&&!bH(this).is(":disabled")&&at.test(this.nodeName)&&!b.test(e)&&(this.checked||!aL.test(e))}).map(function(e,b5){var b6=bH(this).val();return b6==null?null:bH.isArray(b6)?bH.map(b6,function(i){return{name:b5.name,value:i.replace(W,"\r\n")}}):{name:b5.name,value:b6.replace(W,"\r\n")}}).get()}});bH.ajaxSettings.xhr=a4.ActiveXObject!==undefined?function(){return !this.isLocal&&/^(get|post|head|put|delete|options)$/i.test(this.type)&&bD()||bf()}:bD;var az=0,ai={},ax=bH.ajaxSettings.xhr();if(a4.ActiveXObject){bH(a4).on("unload",function(){for(var e in ai){ai[e](undefined,true)}})}C.cors=!!ax&&("withCredentials" in ax);ax=C.ajax=!!ax;if(ax){bH.ajaxTransport(function(e){if(!e.crossDomain||C.cors){var i;return{send:function(b8,b5){var b6,b7=e.xhr(),b9=++az;b7.open(e.type,e.url,e.async,e.username,e.password);if(e.xhrFields){for(b6 in e.xhrFields){b7[b6]=e.xhrFields[b6]}}if(e.mimeType&&b7.overrideMimeType){b7.overrideMimeType(e.mimeType)}if(!e.crossDomain&&!b8["X-Requested-With"]){b8["X-Requested-With"]="XMLHttpRequest"}for(b6 in b8){if(b8[b6]!==undefined){b7.setRequestHeader(b6,b8[b6]+"")}}b7.send((e.hasContent&&e.data)||null);i=function(cc,cb){var ca,cf,cd;if(i&&(cb||b7.readyState===4)){delete ai[b9];i=undefined;b7.onreadystatechange=bH.noop;if(cb){if(b7.readyState!==4){b7.abort()}}else{cd={};ca=b7.status;if(typeof b7.responseText==="string"){cd.text=b7.responseText}try{cf=b7.statusText}catch(ce){cf=""}if(!ca&&e.isLocal&&!e.crossDomain){ca=cd.text?200:404}else{if(ca===1223){ca=204}}}}if(cd){b5(ca,cf,cd,b7.getAllResponseHeaders())}};if(!e.async){i()}else{if(b7.readyState===4){setTimeout(i)}else{b7.onreadystatechange=ai[b9]=i}}},abort:function(){if(i){i(undefined,true)}}}}})}function bD(){try{return new a4.XMLHttpRequest()}catch(i){}}function bf(){try{return new a4.ActiveXObject("Microsoft.XMLHTTP")}catch(i){}}bH.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/(?:java|ecma)script/},converters:{"text script":function(e){bH.globalEval(e);return e}}});bH.ajaxPrefilter("script",function(e){if(e.cache===undefined){e.cache=false}if(e.crossDomain){e.type="GET";e.global=false}});bH.ajaxTransport("script",function(b5){if(b5.crossDomain){var e,i=n.head||bH("head")[0]||n.documentElement;return{send:function(b6,b7){e=n.createElement("script");e.async=true;if(b5.scriptCharset){e.charset=b5.scriptCharset}e.src=b5.url;e.onload=e.onreadystatechange=function(b9,b8){if(b8||!e.readyState||/loaded|complete/.test(e.readyState)){e.onload=e.onreadystatechange=null;if(e.parentNode){e.parentNode.removeChild(e)}e=null;if(!b8){b7(200,"success")}}};i.insertBefore(e,i.firstChild)},abort:function(){if(e){e.onload(undefined,true)}}}}});var br=[],a7=/(=)\?(?=&|$)|\?\?/;bH.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=br.pop()||(bH.expando+"_"+(bo++));this[e]=true;return e}});bH.ajaxPrefilter("json jsonp",function(b6,e,b7){var b9,i,b5,b8=b6.jsonp!==false&&(a7.test(b6.url)?"url":typeof b6.data==="string"&&!(b6.contentType||"").indexOf("application/x-www-form-urlencoded")&&a7.test(b6.data)&&"data");if(b8||b6.dataTypes[0]==="jsonp"){b9=b6.jsonpCallback=bH.isFunction(b6.jsonpCallback)?b6.jsonpCallback():b6.jsonpCallback;if(b8){b6[b8]=b6[b8].replace(a7,"$1"+b9)}else{if(b6.jsonp!==false){b6.url+=(bP.test(b6.url)?"&":"?")+b6.jsonp+"="+b9}}b6.converters["script json"]=function(){if(!b5){bH.error(b9+" was not called")}return b5[0]};b6.dataTypes[0]="json";i=a4[b9];a4[b9]=function(){b5=arguments};b7.always(function(){a4[b9]=i;if(b6[b9]){b6.jsonpCallback=e.jsonpCallback;br.push(b9)}if(b5&&bH.isFunction(i)){i(b5[0])}b5=i=undefined});return"script"}});bH.parseHTML=function(b7,b5,b6){if(!b7||typeof b7!=="string"){return null}if(typeof b5==="boolean"){b6=b5;b5=false}b5=b5||n;var i=a.exec(b7),e=!b6&&[];if(i){return[b5.createElement(i[1])]}i=bH.buildFragment([b7],b5,e);if(e&&e.length){bH(e).remove()}return bH.merge([],i.childNodes)};var b0=bH.fn.load;bH.fn.load=function(b6,b9,ca){if(typeof b6!=="string"&&b0){return b0.apply(this,arguments)}var e,b5,b7,i=this,b8=b6.indexOf(" ");if(b8>=0){e=bH.trim(b6.slice(b8,b6.length));b6=b6.slice(0,b8)}if(bH.isFunction(b9)){ca=b9;b9=undefined}else{if(b9&&typeof b9==="object"){b7="POST"}}if(i.length>0){bH.ajax({url:b6,type:b7,dataType:"html",data:b9}).done(function(cb){b5=arguments;i.html(e?bH("<div>").append(bH.parseHTML(cb)).find(e):cb)}).complete(ca&&function(cc,cb){i.each(ca,b5||[cc.responseText,cb,cc])})}return this};bH.expr.filters.animated=function(e){return bH.grep(bH.timers,function(i){return e===i.elem}).length};var bW=a4.document.documentElement;function bq(e){return bH.isWindow(e)?e:e.nodeType===9?e.defaultView||e.parentWindow:false}bH.offset={setOffset:function(b6,cg,ca){var cc,b9,e,b7,b5,ce,cf,cb=bH.css(b6,"position"),b8=bH(b6),cd={};if(cb==="static"){b6.style.position="relative"}b5=b8.offset();e=bH.css(b6,"top");ce=bH.css(b6,"left");cf=(cb==="absolute"||cb==="fixed")&&bH.inArray("auto",[e,ce])>-1;if(cf){cc=b8.position();b7=cc.top;b9=cc.left}else{b7=parseFloat(e)||0;b9=parseFloat(ce)||0}if(bH.isFunction(cg)){cg=cg.call(b6,ca,b5)}if(cg.top!=null){cd.top=(cg.top-b5.top)+b7}if(cg.left!=null){cd.left=(cg.left-b5.left)+b9}if("using" in cg){cg.using.call(b6,cd)}else{b8.css(cd)}}};bH.fn.extend({offset:function(i){if(arguments.length){return i===undefined?this:this.each(function(b9){bH.offset.setOffset(this,i,b9)})}var e,b8,b6={top:0,left:0},b5=this[0],b7=b5&&b5.ownerDocument;if(!b7){return}e=b7.documentElement;if(!bH.contains(e,b5)){return b6}if(typeof b5.getBoundingClientRect!==aB){b6=b5.getBoundingClientRect()}b8=bq(b7);return{top:b6.top+(b8.pageYOffset||e.scrollTop)-(e.clientTop||0),left:b6.left+(b8.pageXOffset||e.scrollLeft)-(e.clientLeft||0)}},position:function(){if(!this[0]){return}var b5,b6,e={top:0,left:0},i=this[0];if(bH.css(i,"position")==="fixed"){b6=i.getBoundingClientRect()}else{b5=this.offsetParent();b6=this.offset();if(!bH.nodeName(b5[0],"html")){e=b5.offset()}e.top+=bH.css(b5[0],"borderTopWidth",true);e.left+=bH.css(b5[0],"borderLeftWidth",true)}return{top:b6.top-e.top-bH.css(i,"marginTop",true),left:b6.left-e.left-bH.css(i,"marginLeft",true)}},offsetParent:function(){return this.map(function(){var e=this.offsetParent||bW;while(e&&(!bH.nodeName(e,"html")&&bH.css(e,"position")==="static")){e=e.offsetParent}return e||bW})}});bH.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(b5,i){var e=/Y/.test(i);bH.fn[b5]=function(b6){return aA(this,function(b7,ca,b9){var b8=bq(b7);if(b9===undefined){return b8?(i in b8)?b8[i]:b8.document.documentElement[ca]:b7[ca]}if(b8){b8.scrollTo(!e?b9:bH(b8).scrollLeft(),e?b9:bH(b8).scrollTop())}else{b7[ca]=b9}},b5,b6,arguments.length,null)}});bH.each(["top","left"],function(e,b5){bH.cssHooks[b5]=a6(C.pixelPosition,function(b6,i){if(i){i=F(b6,b5);return X.test(i)?bH(b6).position()[b5]+"px":i}})});bH.each({Height:"height",Width:"width"},function(e,i){bH.each({padding:"inner"+e,content:i,"":"outer"+e},function(b5,b6){bH.fn[b6]=function(ca,b9){var b8=arguments.length&&(b5||typeof ca!=="boolean"),b7=b5||(ca===true||b9===true?"margin":"border");return aA(this,function(cc,cb,cd){var ce;if(bH.isWindow(cc)){return cc.document.documentElement["client"+e]}if(cc.nodeType===9){ce=cc.documentElement;return Math.max(cc.body["scroll"+e],ce["scroll"+e],cc.body["offset"+e],ce["offset"+e],ce["client"+e])}return cd===undefined?bH.css(cc,cb,b7):bH.style(cc,cb,cd,b7)},i,b8?ca:undefined,b8,null)}})});bH.fn.size=function(){return this.length};bH.fn.andSelf=bH.fn.addBack;if(typeof define==="function"&&define.amd){define("jquery",[],function(){return bH})}var bj=a4.jQuery,H=a4.$;bH.noConflict=function(e){if(a4.$===bH){a4.$=H}if(e&&a4.jQuery===bH){a4.jQuery=bj}return bH};if(typeof au===aB){a4.jQuery=a4.$=bH}return bH}));if(!window.require){window.require=function require(){}}if(!window.sc_require){window.sc_require=require}if(!window.sc_resource){window.sc_resource=function sc_resource(){}}sc_require("license");window.YES=true;window.NO=false;if(typeof console==="undefined"){window.console={};console.log=console.info=console.warn=console.error=function(){}}window.SC=window.SC||{};window.SproutCore=window.SproutCore||SC;SC=window.SC;SC.VERSION="1.11.0";SC._baseMixin=function(e,c){var g=c[0]||{},a=1,f=c.length,b,h,d;if(f===1){g=this||{};a=0}for(;a<f;a++){if(!(b=c[a])){continue}for(d in b){if(!b.hasOwnProperty(d)){continue}h=b[d];if(g===h){continue}if(h!==undefined&&(e||(g[d]===undefined))){g[d]=h}}if(b.hasOwnProperty("toString")){g.toString=b.toString}}return g};SC.mixin=function(){var b=new Array(arguments.length);for(var c=0,a=b.length;c<a;c++){b[c]=arguments[c]}return SC._baseMixin(true,b)};SC.supplement=function(){var b=new Array(arguments.length);for(var c=0,a=b.length;c<a;c++){b[c]=arguments[c]}return SC._baseMixin(false,b)};SC.extend=SC.mixin;SC.mixin({T_ERROR:"error",T_OBJECT:"object",T_NULL:"null",T_CLASS:"class",T_HASH:"hash",T_FUNCTION:"function",T_UNDEFINED:"undefined",T_NUMBER:"number",T_BOOL:"boolean",T_ARRAY:"array",T_STRING:"string",T_DATE:"date",T_REGEXP:"regexp",typeOf:function(a){var b=SC._nativeTypeOf(a);if(b==="function"){return a.isClass?SC.T_CLASS:SC.T_FUNCTION}else{if(b==="object"){if(SC.Error&&(a instanceof SC.Error)){return SC.T_ERROR}else{if(a instanceof SC.Object){return SC.T_OBJECT}else{return SC.T_HASH}}}}return b},_nativeTypeOf:function(a){if(a===undefined){return SC.T_UNDEFINED}if(a===null){return SC.T_NULL}var c=typeof a,b;if(c==="object"||c==="function"){b=SC._nativeToString.call(a);return SC._nativeTypeHash[b]||"object"}else{return c}},_nativeTypeHash:{"[object Boolean]":"boolean","[object Number]":"number","[object String]":"string","[object Function]":"function","[object Array]":"array","[object Date]":"date","[object RegExp]":"regexp","[object Object]":"object"},_nativeToString:Object.prototype.toString,none:function(a){return a==null},empty:function(a){return a===null||a===undefined||a===""},isArray:function(a){if(!a||a.setInterval){return false}if(Array.isArray&&Array.isArray(a)){return true}if(a.objectAt){return true}if(a.length!==undefined&&SC._nativeTypeOf(a)==="object"){return true}return false},makeArray:function(a){return SC.isArray(a)?a:SC.A(a)},A:function(c){if(c===null||c===undefined){return[]}if(c.slice instanceof Function){if(typeof(c)==="string"){return[c]}else{return c.slice()}}if(c.toArray){return c.toArray()}if(!SC.isArray(c)){return[c]}var b=[],a=c.length;while(--a>=0){b[a]=c[a]}return b},guidKey:"SproutCore"+(SC.VERSION+Math.random()).replace(/\D/g,""),_guidPrefixes:{number:"nu",string:"st"},_guidCaches:{number:{},string:{}},_numberGuids:[],_stringGuids:{},_keyCache:{},_uuid:0,guidFor:function(e){var b,c,d=typeof e;if(e===undefined){return"(undefined)"}if(e===null){return"(null)"}if(d===SC.T_NUMBER||d===SC.T_STRING){b=this._guidCaches[d];c=b[e];if(!c){c="st"+(SC._uuid++);b[e]=c}return c}else{if(d===SC.T_BOOL){return(e)?"(true)":"(false)"}}var a=this.guidKey;if(e[a]){return e[a]}if(e===Object){return"(Object)"}if(e===Array){return"(Array)"}return SC.generateGuid(e,"sc")},keyFor:function(d,c){var b,a=this._keyCache[d];if(!a){a=this._keyCache[d]={}}b=a[c];if(!b){b=a[c]=d+"_"+c}return b},generateGuid:function(c,b){var a=(b+(SC._uuid++));if(c){c[this.guidKey]=a}return a},hashFor:function(){var a=arguments.length,c="",e,d,b;for(b=0;b<a;++b){e=arguments[b];c+=(e&&(d=e.hash)&&(typeof d===SC.T_FUNCTION))?d.call(e):this.guidFor(e)}return c===""?null:c},isEqual:function(d,c){return this.hashFor(d)===this.hashFor(c)},compare:function(s,p){if(s===p){return 0}var j=SC.typeOf(s);var g=SC.typeOf(p);var b=SC.ORDER_DEFINITION_MAPPING;if(!b){var d=SC.ORDER_DEFINITION;b=SC.ORDER_DEFINITION_MAPPING={};var q,n;for(q=0,n=d.length;q<n;++q){b[d[q]]=q}delete SC.ORDER_DEFINITION}var t=b[j];var c=b[g];if(t<c){return -1}if(t>c){return 1}switch(j){case SC.T_BOOL:case SC.T_NUMBER:if(s<p){return -1}if(s>p){return 1}return 0;case SC.T_STRING:var k=s.localeCompare(p);if(k<0){return -1}if(k>0){return 1}return 0;case SC.T_ARRAY:var o=s.length;var m=p.length;var e=Math.min(o,m);var a=0;var h=0;var f=arguments.callee;while(a===0&&h<e){a=f(s[h],p[h]);h++}if(a!==0){return a}if(o<m){return -1}if(o>m){return 1}return 0;case SC.T_OBJECT:if(s.constructor.isComparable===YES){return s.constructor.compare(s,p)}return 0;default:return 0}},K:function(){return this},EMPTY_ARRAY:[],EMPTY_HASH:{},EMPTY_RANGE:{start:0,length:0},beget:function(c){if(c===null||c===undefined){return null}var a=SC.K;a.prototype=c;var b=new a();a.prototype=null;if(typeof c.didBeget==="function"){b=c.didBeget(b)}return b},copy:function(d,b){var c=d,a;if(d){if(d.isCopyable){return d.copy(b)}if(d.clone){return d.clone()}}switch(SC._nativeTypeOf(d)){case"array":c=d.slice();if(b){a=c.length;while(a--){c[a]=SC.copy(c[a],true)}}break;case"object":c={};for(var e in d){c[e]=b?SC.copy(d[e],true):d[e]}}return c},merge:function(){var c={},b=arguments.length,a;for(a=0;a<b;a++){SC.mixin(c,arguments[a])}return c},keys:function(c){var a=[];for(var b in c){a.push(b)}return a},inspect:function(d){var a,b=[];for(var c in d){a=d[c];if(a==="toString"){continue}if(SC.typeOf(a)===SC.T_FUNCTION){a="function () { ... }"}b.push(c+": "+a)}return"{ "+b.join(", ")+" }"},tupleForPropertyPath:function(e,a){if(e==null){return null}if(typeof e==="object"&&(e instanceof Array)){return e}var c;var b=e.indexOf("*");if(b<0){b=e.lastIndexOf(".")}c=(b>=0)?e.slice(b+1):e;var d=this.objectForPropertyPath(e,a,b);return(d&&c)?[d,c]:null},objectForPropertyPath:function(f,c,d){var g,b,e,a;if(!c){c=window}if(typeof f==="string"){if(d===undefined){d=f.length}g=0;while((c)&&(g<d)){b=f.indexOf(".",g);if((b<0)||(b>d)){b=d}e=f.slice(g,b);c=c.get?c.get(e):c[e];g=b+1}if(g<d){c=undefined}}else{g=0;a=f.length;e=null;while((g<a)&&c){e=f[g++];if(e){c=(c.get)?c.get(e):c[e]}}if(g<a){c=undefined}}return c},requiredObjectForPropertyPath:function(c,a,b){var d=SC.objectForPropertyPath(c,a,b);if(!d){throw c+" could not be found"}return d}});SC.clone=SC.copy;SC.$A=SC.A;SC.didLoad=SC.K;SC.ORDER_DEFINITION=[SC.T_ERROR,SC.T_UNDEFINED,SC.T_NULL,SC.T_BOOL,SC.T_NUMBER,SC.T_STRING,SC.T_ARRAY,SC.T_HASH,SC.T_OBJECT,SC.T_FUNCTION,SC.T_CLASS];SC.Function={property:function(b,c){b.dependentKeys=SC.$A(c);var a=SC.guidFor(b);b.cacheKey="__cache__"+a;b.lastSetValueKey="__lastValue__"+a;b.isProperty=true;return b},cacheable:function(a,b){a.isProperty=true;if(!a.dependentKeys){a.dependentKeys=[]}a.isCacheable=(b===undefined)?true:b;return a},idempotent:function(a,b){a.isProperty=true;if(!a.dependentKeys){this.dependentKeys=[]}a.isVolatile=(b===undefined)?true:b;return a},enhance:function(a){a.isEnhancement=true;return a},observes:function(c,a){var f=a.length,b=null,e=null;while(--f>=0){var d=a[f];if((d.indexOf(".")<0)&&(d.indexOf("*")<0)){if(!b){b=c.localPropertyPaths=[]}b.push(d)}else{if(!e){e=c.propertyPaths=[]}e.push(d)}}return c}};sc_require("system/function");SC.mixin(Function.prototype,{property:function(){return SC.Function.property(this,arguments)},cacheable:function(a){return SC.Function.cacheable(this,a)},idempotent:function(a){return SC.Function.idempotent(this,a)},enhance:function(){return SC.Function.enhance(this)},observes:function(a){return SC.Function.observes(this,arguments)}});SC.ObserverSet={add:function(j,a,c){var b=SC.guidFor(j),f=SC.guidFor(a),i=this._members,d=this.members,g=i[b],h,e;if(!g){g=i[b]={_size:0}}h=g[f];if(h===undefined){g[f]=d.length;g._size++;e=[j,a,c];d.push(e)}else{}},remove:function(g,h){var e=SC.guidFor(g),b=SC.guidFor(h);var d=this._members[e],a=this.members;if(!d){return false}var c=d[b];if(c===undefined){return false}if(c!==a.length-1){var f=(a[c]=a[a.length-1]);this._members[SC.guidFor(f[0])][SC.guidFor(f[1])]=c}a.pop();delete this._members[e][b];if(--this._members[e]._size===0){delete this._members[e]}return true},invokeMethods:function(){var b=this.members,d;for(var c=0,a=b.length;c<a;c++){d=b[c];d[1].call(d[0],d[2])}},clone:function(){var c=SC.ObserverSet.create(),d=this.members;c._members=SC.clone(this._members);var e=c.members;for(var b=0,a=d.length;b<a;b++){e[b]=SC.clone(d[b]);e[b].length=3}return c},create:function(){return new SC.ObserverSet.constructor()},getMembers:function(){return this.members.slice(0)},constructor:function(){this._members={};this.members=[]}};SC.ObserverSet.constructor.prototype=SC.ObserverSet;SC.ObserverSet.slice=SC.ObserverSet.clone;SC.ObserverSet.copy=SC.ObserverSet.clone;SC._ChainObserver=function(b,a){this.property=b;this.root=a||this};SC._ChainObserver.createChain=function(e,l,g,a,b){var c=l.split("."),j=new SC._ChainObserver(c[0]),h=j;for(var d=1,f=c.length;d<f;d++){h=h.next=new SC._ChainObserver(c[d],j)}var k=j.tails=[h];j.objectDidChange(e);k.forEach(function(i){i.target=g;i.method=a;i.context=b});j.tails=null;return j};SC._ChainObserver.prototype={isChainObserver:true,object:null,property:null,next:null,root:null,target:null,method:null,tail:function(){if(this._tail){return this._tail}var a=this;while(a.next){a=a.next}this._tail=a;return a},objectDidChange:function(a){if(a===this.object){return}if(this.object){if(this.property==="@each"&&this.object._removeContentObserver){this.object._removeContentObserver(this)}else{if(this.object.removeObserver){this.object.removeObserver(this.property,this,this.propertyDidChange)}}}this.object=a;if(this.property==="@each"&&this.next){if(this.object&&this.object._addContentObserver){this.object._addContentObserver(this)}}else{if(this.object&&this.object.addObserver){this.object.addObserver(this.property,this,this.propertyDidChange)}this.propertyDidChange()}},propertyDidChange:function(){var b=this.object;var e=this.property;var d=(b&&b.get)?b.get(e):null;if(this.next){this.next.objectDidChange(d)}var f=this.target,g=this.method,c=this.context;if(f&&g){var a=b?b.propertyRevision:null;if(c){g.call(f,b,e,d,c,a)}else{g.call(f,b,e,d,a)}}},destroyChain:function(){var a=this.object;if(a){if(this.property==="@each"&&this.next&&a._removeContentObserver){a._removeContentObserver(this)}if(a.removeObserver){a.removeObserver(this.property,this,this.propertyDidChange)}}if(this.next){this.next.destroyChain()}this.next=this.target=this.method=this.object=this.context=null;return null}};sc_require("ext/function");sc_require("private/observer_set");sc_require("private/chain_observer");SC.OBSERVES_HANDLER_ADD=0;SC.OBSERVES_HANDLER_REMOVE=1;SC.Observable={_kvo_cache:null,_kvo_cacheable:false,_kvo_cachedep:null,_kvo_changeLevel:0,_kvo_changes:null,_kvo_cloned:null,_kvo_revision:0,_observableInited:false,isObservable:YES,automaticallyNotifiesObserversFor:function(a){return YES},get:function(c){var b=this[c],a;if(b===undefined){return this.unknownProperty(c)}else{if(b&&b.isProperty){if(b.isCacheable){a=this._kvo_cache;if(!a){a=this._kvo_cache={}}return(a[b.cacheKey]!==undefined)?a[b.cacheKey]:(a[b.cacheKey]=b.call(this,c))}else{return b.call(this,c)}}else{return b}}},set:function(i,g){var b=this[i],j=this.automaticallyNotifiesObserversFor(i),f=g,d,a,h,e;if(g===undefined&&SC.typeOf(i)===SC.T_HASH){var c=i;for(var k in c){if(!c.hasOwnProperty(k)){continue}this.set(k,c[k])}return this}if(!j&&this._kvo_cacheable&&(a=this._kvo_cache)){d=this._kvo_cachedep;if(!d||(d=d[i])===undefined){d=this._kvo_computeCachedDependentsFor(i)}if(d){h=d.length;while(--h>=0){e=d[h];a[e.cacheKey]=a[e.lastSetValueKey]=undefined}}}if(b&&b.isProperty){a=this._kvo_cache;if(b.isVolatile||!a||(a[b.lastSetValueKey]!==g)){if(!a){a=this._kvo_cache={}}a[b.lastSetValueKey]=g;if(j){this.propertyWillChange(i)}f=b.call(this,i,g);if(b.isCacheable){a[b.cacheKey]=f}if(j){this.propertyDidChange(i,f,YES)}}}else{if(b===undefined){if(j){this.propertyWillChange(i)}this.unknownProperty(i,g);if(j){this.propertyDidChange(i,f)}}else{if(this[i]!==g){if(j){this.propertyWillChange(i)}f=this[i]=g;if(j){this.propertyDidChange(i,f)}}}}return this},unknownProperty:function(a,b){if(b!==undefined){this[a]=b}return b},beginPropertyChanges:function(){this._kvo_changeLevel=this._kvo_changeLevel+1;return this},endPropertyChanges:function(){this._kvo_changeLevel=(this._kvo_changeLevel||1)-1;var b=this._kvo_changeLevel,a=this._kvo_changes;if((b<=0)&&a&&(a.length>0)&&!SC.Observers.isObservingSuspended){this._notifyPropertyObservers()}return this},propertyWillChange:function(a){return this},propertyDidChange:function(m,k,c){this._kvo_revision=this._kvo_revision+1;var b=this._kvo_changeLevel,g,l,h,d;var i=this._kvo_property_chains;if(i){var f=i[m];if(f){this.beginPropertyChanges();f=SC.clone(f);f.forEach(function(n){n.notifyPropertyDidChange()});this.endPropertyChanges()}}var a=this._kvo_cache;if(a){if(!c){d=this[m];if(d&&d.isProperty){a[d.cacheKey]=a[d.lastSetValueKey]=undefined}}if(this._kvo_cacheable){g=this._kvo_cachedep;if(!g||(g=g[m])===undefined){g=this._kvo_computeCachedDependentsFor(m)}if(g){l=g.length;while(--l>=0){h=g[l];a[h.cacheKey]=a[h.lastSetValueKey]=undefined}}}}var e=SC.Observers.isObservingSuspended;if((b>0)||e){var j=this._kvo_changes;if(!j){j=this._kvo_changes=SC.CoreSet.create()}j.add(m);if(e){SC.Observers.objectHasPendingChanges(this)}}else{this._notifyPropertyObservers(m)}return this},registerDependentKey:function(c,g){var h=this._kvo_dependents,d,b,f,e,a;if(typeof g==="object"&&(g instanceof Array)){d=g;f=0}else{d=arguments;f=1}b=d.length;if(!h){this._kvo_dependents=h={}}while(--b>=f){e=d[b];if(e.indexOf(".")>=0){SC._PropertyChain.createChain(e,this,c).activate()}else{a=h[e];if(!a){a=h[e]=[]}a.push(c)}}},registerDependentKeyWithChain:function(b,a){var c=this._chainsFor(b);c.add(a)},removeDependentKeyWithChain:function(b,a){var c=this._chainsFor(b);c.remove(a);if(c.get("length")===0){delete this._kvo_property_chains[b]}},_chainsFor:function(a){this._kvo_property_chains=this._kvo_property_chains||{};var b=this._kvo_property_chains[a]||SC.CoreSet.create();this._kvo_property_chains[a]=b;return b},_kvo_addCachedDependents:function(b,f,h,c){var a=f.length,e,d,g;while(--a>=0){d=f[a];c.add(d);e=this[d];if(e&&(e instanceof Function)&&e.isProperty){if(e.isCacheable){b.push(e)}if((g=h[d])&&g.length>0){this._kvo_addCachedDependents(b,g,h,c)}}}},_kvo_computeCachedDependentsFor:function(c){var d=this._kvo_cachedep,f=this._kvo_dependents,e=f?f[c]:null,a,b;if(!d){d=this._kvo_cachedep={}}if(!e||e.length===0){return d[c]=null}a=d[c]=[];b=SC._TMP_SEEN_SET=(SC._TMP_SEEN_SET||SC.CoreSet.create());b.add(c);this._kvo_addCachedDependents(a,e,f,b);b.clear();if(a.length===0){a=d[c]=null}return a},_kvo_for:function(c,b){var a=this[c];if(!this._kvo_cloned){this._kvo_cloned={}}if(!a){a=this[c]=(b===undefined)?[]:b.create();this._kvo_cloned[c]=YES}else{if(!this._kvo_cloned[c]){a=this[c]=a.copy();this._kvo_cloned[c]=YES}}return a},addObserver:function(c,e,f,b){var d,a;if(f===undefined){f=e;e=this}if(!e){e=this}if(typeof f==="string"){f=e[f]}if(!f){throw new Error("You must pass a method to addObserver()")}c=c.toString();if(c.indexOf(".")>=0){a=SC._ChainObserver.createChain(this,c,e,f,b);a.masterTarget=e;a.masterMethod=f;this._kvo_for(SC.keyFor("_kvo_chains",c)).push(a)}else{if((this[c]===undefined)&&(c.indexOf("@")===0)){this.get(c)}if(e===this){e=null}d=SC.keyFor("_kvo_observers",c);this._kvo_for(d,SC.ObserverSet).add(e,f,b);this._kvo_for("_kvo_observed_keys",SC.CoreSet).add(c)}if(this.didAddObserver){this.didAddObserver(c,e,f)}return this},removeObserver:function(c,f,h){var d,e,b,g,a;if(h===undefined){h=f;f=this}if(!f){f=this}if(typeof h==="string"){h=f[h]}if(!h){throw new Error("You must pass a method to removeObserver()")}c=c.toString();if(c.indexOf(".")>=0){d=SC.keyFor("_kvo_chains",c);if(e=this[d]){e=this._kvo_for(d);a=e.length;while(--a>=0){b=e[a];if(b&&(b.masterTarget===f)&&(b.masterMethod===h)){e[a]=b.destroyChain()}}}}else{if(f===this){f=null}d=SC.keyFor("_kvo_observers",c);if(g=this[d]){g=this._kvo_for(d);g.remove(f,h);if(g.getMembers().length===0){this._kvo_for("_kvo_observed_keys",SC.CoreSet).remove(c)}}}if(this.didRemoveObserver){this.didRemoveObserver(c,f,h)}return this},hasObserverFor:function(j,g,a){SC.Observers.flush(this);var e=this[SC.keyFor("_kvo_observers",j)],h=this._kvo_for(SC.keyFor("_kvo_chains",j)),b=this[SC.keyFor("_kvo_local",j)],k=j.indexOf(".")>=0;if(g===undefined){if(k){if(h&&h.length>0){return YES}}else{if(b&&b.length>0){return YES}if(e&&e.getMembers().length>0){return YES}}return NO}else{if(a===undefined){a=g;g=this}if(typeof a==="string"){a=g[a]}if(!a){throw new Error("Developer Error: If present, the `method` argument of hasObserverFor must be (or refer to) a function.")}var d,f;if(k){if(!h||!h.length){return NO}f=h.length;for(d=0;d<f;d++){if(h[d].masterTarget===g&&h[d].masterMethod===a){return YES}}return NO}else{if(g===this){if(!b){return NO}f=b.length;for(d=0;d<f;d++){if(this[b[d]]===a){return YES}}return NO}else{if(!e||!e.members){return NO}f=e.members.length;var c;for(d=0;d<f;d++){c=e.members[d];if(c[0]===g&&c[1]===a){return YES}}return NO}}}},initObservable:function(){if(this._observableInited){return}this._observableInited=YES;var e,k,i,h,g,d,j,f,b,l,c,a;if(k=this._observers){f=k.length;for(e=0;e<f;e++){i=k[e];g=this[i];d=g.propertyPaths;j=(d)?d.length:0;for(b=0;b<j;b++){l=d[b];this.addObservesHandler(g,l)}}}this.bindings=[];if(k=this._bindings){for(e=0,a=k.length;e<a;e++){i=k[e];h=this[i];c=i.slice(0,-7);this[i]=this.bind(c,h)}}if(k=this._properties){for(e=0,a=k.length;e<a;e++){i=k[e];if(h=this[i]){if(h.isCacheable){this._kvo_cacheable=YES}if(h.dependentKeys&&(h.dependentKeys.length>0)){this.registerDependentKey(i,h.dependentKeys)}}}}delete this._bindings;delete this._properties;return this},destroyObservable:function(){var f,h,d,e,i,b,g;this.bindings.invoke("destroy");delete this.bindings;if(h=this._observers){d=h.length;for(var c=0;c<d;c++){f=h[c];e=this[f];b=e.propertyPaths;g=(b)?b.length:0;for(var a=0;a<g;a++){i=b[a];this.removeObservesHandler(e,i)}}}delete this._observers;return this},addObservesHandler:function(a,b){this._configureObservesHandler(SC.OBSERVES_HANDLER_ADD,a,b);return this},removeObservesHandler:function(a,b){this._configureObservesHandler(SC.OBSERVES_HANDLER_REMOVE,a,b);return this},_configureObservesHandler:function(d,b,e){var c,a;switch(d){case SC.OBSERVES_HANDLER_ADD:d="addObserver";break;case SC.OBSERVES_HANDLER_REMOVE:d="removeObserver";break;default:throw new Error("invalid action provided: "+d)}c=e.indexOf(".");if(c<0){this[d](e,this,b)}else{if(e.indexOf("*")===0){this[d](e.slice(1),this,b)}else{a=null;if(c===0){a=this;e=e.slice(1)}else{if(c===4&&e.slice(0,5)==="this."){a=this;e=e.slice(5)}else{if(c<0&&e.length===4&&e==="this"){a=this;e=""}else{if(c>0&&e[0]===e.charAt(0).toLowerCase()){a=this}}}}SC.Observers[d](e,this,b,a)}}},observersForKey:function(a){SC.Observers.flush(this);var b=this[SC.keyFor("_kvo_observers",a)];return b?b.getMembers():[]},_notifyPropertyObservers:function(s){if(!this._observableInited){this.initObservable()}SC.Observers.flush(this);var n,q,l,d,m,k,p,o,i,a,f,r,c,h,e,b,g,j;d=this["_kvo_observers_*"];this._kvo_changeLevel=this._kvo_changeLevel+1;while(((q=this._kvo_changes)&&(q.length>0))||s){p=++this.propertyRevision;if(!q){q=SC.CoreSet.create()}this._kvo_changes=null;if(s==="*"){q.add("*");q.addEach(this._kvo_for("_kvo_observed_keys",SC.CoreSet))}else{if(s){q.add(s)}}l=this._kvo_dependents;if(l){for(m=0;m<q.length;m++){s=q[m];k=l[s];if(k&&(h=k.length)){j=this._kvo_cache;if(!j){j=this._kvo_cache={}}while(--h>=0){q.add(s=k[h]);if(e=this[s]){this[e.cacheKey]=undefined;j[e.cacheKey]=j[e.lastSetValueKey]=undefined}}}}}while(q.length>0){s=q.pop();n=this[SC.keyFor("_kvo_observers",s)];if(n){o=n.getMembers();i=o.length;for(f=0;f<i;f++){a=o[f];if(a[3]===p){continue}if(!a[1]){console.log(a)}r=a[0]||this;c=a[1];b=a[2];a[3]=p;if(b!==undefined){c.call(r,this,s,null,b,p)}else{c.call(r,this,s,null,p)}}}o=this[SC.keyFor("_kvo_local",s)];if(o){i=o.length;for(f=0;f<i;f++){a=o[f];c=this[a];if(c){c.call(this,this,s,null,p)}}}if(d&&s!=="*"){o=d.getMembers();i=o.length;for(f=0;f<i;f++){a=o[f];r=a[0]||this;c=a[1];b=a[2];if(b!==undefined){c.call(r,this,s,null,b,p)}else{c.call(r,this,s,null,p)}}}if(this.propertyObserver){this.propertyObserver(this,s,null,p)}}if(q){q.destroy()}s=null}this._kvo_changeLevel=(this._kvo_changeLevel||1)-1;return YES},bind:function(a,c,e){var d,b;if(e!==undefined){c=[c,e]}b=typeof c;if(b==="string"||(b==="object"&&(c instanceof Array))){d=this[a+"BindingDefault"]||SC.Binding;d=d.beget().from(c)}else{d=c.beget()}d=d.to(a,this).connect();this.bindings.push(d);return d},didChangeFor:function(a){var b,f,e,j,d,c,h,i,g;a=SC.hashFor(a);b=this._kvo_didChange_valueCache;if(!b){b=this._kvo_didChange_valueCache={}}f=this._kvo_didChange_revisionCache;if(!f){f=this._kvo_didChange_revisionCache={}}e=b[a]||{};j=f[a]||{};d=false;c=this._kvo_revision;h=arguments.length;while(--h>=1){i=arguments[h];if(j[i]!=c){g=this.get(i);if(e[i]!==g){d=true;e[i]=g}}j[i]=c}b[a]=e;f[a]=j;return d},setIfChanged:function(a,b){if(b===undefined&&SC.typeOf(a)===SC.T_HASH){var c=a;for(a in c){if(!c.hasOwnProperty(a)){continue}this.setIfChanged(a,c[a])}return this}return(this.get(a)!==b)?this.set(a,b):this},getPath:function(b){var a=SC.tupleForPropertyPath(b,this);if(a===null||a[0]===null){return undefined}return SC.get(a[0],a[1])},setPath:function(c,b){if(c.indexOf(".")>=0){var a=SC.tupleForPropertyPath(c,this);if(!a||!a[0]){return null}a[0].set(a[1],b)}else{this.set(c,b)}return this},setPathIfChanged:function(c,b){if(c.indexOf(".")>=0){var a=SC.tupleForPropertyPath(c,this);if(!a||!a[0]){return null}if(a[0].get(a[1])!==b){a[0].set(a[1],b)}}else{this.setIfChanged(c,b)}return this},getEach:function(){var c=[],a,b;for(a=0,b=arguments.length;a<b;a++){c[c.length]=this.getPath(arguments[a])}return c},incrementProperty:function(b,a){if(!a){a=1}this.set(b,(this.get(b)||0)+a);return this.get(b)},decrementProperty:function(b,a){if(!a){a=1}this.set(b,(this.get(b)||0)-a);return this.get(b)},toggleProperty:function(a,b,c){if(b===undefined){b=true}if(c===undefined){c=false}b=(this.get(a)==b)?c:b;this.set(a,b);return this.get(a)},notifyPropertyChange:function(a,b){this.propertyWillChange(a);this.propertyDidChange(a,b);return this},allPropertiesDidChange:function(){this._kvo_cache=null;this._notifyPropertyObservers("*");return this},propertyRevision:1};SC.mixin(SC,{get:function(a,b){if(!a){return undefined}if(b===undefined){return this[a]}if(a.get){return a.get(b)}return a[b]},getPath:function(a,b){if(b===undefined){b=a;a=window}return SC.objectForPropertyPath(b,a)}});SC.mixin(Array.prototype,SC.Observable);SC.Enumerator=function(a){this.enumerable=a;this.reset();return this};SC.Enumerator.prototype={nextObject:function(){var c=this._index;var a=this._length;if(c>=a){return undefined}var b=this.enumerable.nextObject(c,this._previousObject,this._context);this._previousObject=b;this._index=c+1;if(c>=a){this._context=SC.Enumerator._pushContext(this._context)}return b},reset:function(){var b=this.enumerable;if(!b){SC.throw("Enumerator has been destroyed")}this._length=b.get?b.get("length"):b.length;var a=this._length;this._index=0;this._previousObject=null;this._context=(a>0)?SC.Enumerator._popContext():null},destroy:function(){this.enumerable=this._length=this._index=this._previousObject=this._context=null}};SC.Enumerator.create=function(a){return new SC.Enumerator(a)};SC.Enumerator._popContext=function(){var a=this._contextCache?this._contextCache.pop():null;return a||{}};SC.Enumerator._pushContext=function(b){this._contextCache=this._contextCache||[];var a=this._contextCache;a.push(b);return null};sc_require("core");sc_require("ext/function");sc_require("system/enumerator");SC.Enumerable={isEnumerable:YES,nextObject:function(a,c,b){return this.objectAt?this.objectAt(a):this[a]},firstObject:function(){if(this.get("length")===0){return undefined}if(this.objectAt){return this.objectAt(0)}var b=SC.Enumerator._popContext(),a;a=this.nextObject(0,null,b);b=SC.Enumerator._pushContext(b);return a}.property().cacheable(),lastObject:function(){var a=this.get("length");if(a===0){return undefined}if(this.objectAt){return this.objectAt(a-1)}}.property().cacheable(),enumerator:function(){return SC.Enumerator.create(this)},forEach:function(g,f){if(typeof g!=="function"){throw new TypeError()}var b=this.get?this.get("length"):this.length;if(f===undefined){f=null}var e=null;var c=SC.Enumerator._popContext();for(var a=0;a<b;a++){var d=this.nextObject(a,e,c);g.call(f,d,a,this);e=d}e=null;c=SC.Enumerator._pushContext(c);return this},getEach:function(a){return this.map(function(b){return b?(b.get?b.get(a):b[a]):null},this)},setEach:function(a,b){this.forEach(function(c){if(c){if(c.set){c.set(a,b)}else{c[a]=b}}},this);return this},map:function(h,g){if(typeof h!=="function"){throw new TypeError()}var b=this.get?this.get("length"):this.length;if(g===undefined){g=null}var c=[];var f=null;var d=SC.Enumerator._popContext();for(var a=0;a<b;a++){var e=this.nextObject(a,f,d);c[a]=h.call(g,e,a,this);f=e}f=null;d=SC.Enumerator._pushContext(d);return c},mapProperty:function(a){return this.map(function(b){return b?(b.get?b.get(a):b[a]):null})},filter:function(h,g){if(typeof h!=="function"){throw new TypeError()}var b=this.get?this.get("length"):this.length;if(g===undefined){g=null}var c=[];var f=null;var d=SC.Enumerator._popContext();for(var a=0;a<b;a++){var e=this.nextObject(a,f,d);if(h.call(g,e,a,this)){c.push(e)}f=e}f=null;d=SC.Enumerator._pushContext(d);return c},sortProperty:function(b){var c=(typeof b===SC.T_STRING)?arguments:b,a=c.length,d;if(this instanceof Array){d=this}else{d=[];this.forEach(function(e){d.push(e)})}if(!d){return[]}return d.sort(function(g,f){var e,i,k,j,h=0;for(e=0;h===0&&e<a;e++){i=c[e];k=g?(g.get?g.get(i):g[i]):null;j=f?(f.get?f.get(i):f[i]):null;h=SC.compare(k,j)}return h})},filterProperty:function(h,d){var b=this.get?this.get("length"):this.length,c=[],g=null,a=SC.Enumerator._popContext(),e,i,f;if(d===undefined){for(e=0;e<b;e++){i=this.nextObject(e,g,a);f=i?(i.get?i.get(h):i[h]):null;if(!!f){c.push(i)}g=i}}else{for(e=0;e<b;e++){i=this.nextObject(e,g,a);f=i?(i.get?i.get(h):i[h]):null;if(SC.isEqual(f,d)){c.push(i)}g=i}}g=null;a=SC.Enumerator._pushContext(a);return c},find:function(h,d){var c=this.get?this.get("length"):this.length;if(d===undefined){d=null}var g=null,b,i=NO,e=null;var a=SC.Enumerator._popContext();for(var f=0;f<c&&!i;f++){b=this.nextObject(f,g,a);if(i=h.call(d,b,f,this)){e=b}g=b}b=g=null;a=SC.Enumerator._pushContext(a);return e},findProperty:function(i,f){var c=this.get?this.get("length"):this.length;var j=NO,d=null,h=null,b,g;var a=SC.Enumerator._popContext();for(var e=0;e<c&&!j;e++){b=this.nextObject(e,h,a);g=b?(b.get?b.get(i):b[i]):null;j=(f===undefined)?!!g:SC.isEqual(g,f);if(j){d=b}h=b}h=b=null;a=SC.Enumerator._pushContext(a);return d},every:function(h,g){if(typeof h!=="function"){throw new TypeError()}var b=this.get?this.get("length"):this.length;if(g===undefined){g=null}var c=YES;var f=null;var d=SC.Enumerator._popContext();for(var a=0;c&&(a<b);a++){var e=this.nextObject(a,f,d);if(!h.call(g,e,a,this)){c=NO}f=e}f=null;d=SC.Enumerator._pushContext(d);return c},everyProperty:function(i,e){var c=this.get?this.get("length"):this.length;var d=YES;var h=null;var a=SC.Enumerator._popContext();for(var f=0;d&&(f<c);f++){var b=this.nextObject(f,h,a);var g=b?(b.get?b.get(i):b[i]):null;d=(e===undefined)?!!g:SC.isEqual(g,e);h=b}h=null;a=SC.Enumerator._pushContext(a);return d},some:function(h,g){if(typeof h!=="function"){throw new TypeError()}var b=this.get?this.get("length"):this.length;if(g===undefined){g=null}var c=NO;var f=null;var d=SC.Enumerator._popContext();for(var a=0;(!c)&&(a<b);a++){var e=this.nextObject(a,f,d);if(h.call(g,e,a,this)){c=YES}f=e}f=null;d=SC.Enumerator._pushContext(d);return c},someProperty:function(i,e){var c=this.get?this.get("length"):this.length;var d=NO;var h=null;var a=SC.Enumerator._popContext();for(var f=0;!d&&(f<c);f++){var b=this.nextObject(f,h,a);var g=b?(b.get?b.get(i):b[i]):null;d=(e===undefined)?!!g:SC.isEqual(g,e);h=b}h=null;a=SC.Enumerator._pushContext(a);return d},reduce:function(g,h,i){if(typeof g!=="function"){throw new TypeError()}var c=this.get?this.get("length"):this.length;if(c===0&&h===undefined){throw new TypeError()}var d=h;var f=null;var a=SC.Enumerator._popContext();for(var e=0;e<c;e++){var b=this.nextObject(e,f,a);if(b!==null){if(d===undefined){d=b}else{d=g.call(null,d,b,e,this,i)}}f=b}f=null;a=SC.Enumerator._pushContext(a);if(d===undefined){throw new TypeError()}return d},invoke:function(h){var e=this.get?this.get("length"):this.length;if(e<=0){return[]}var i;var g=[];var c=arguments.length;if(c>1){for(i=1;i<c;i++){g.push(arguments[i])}}var f=[];var j=null;var b=SC.Enumerator._popContext();for(i=0;i<e;i++){var d=this.nextObject(i,j,b);var a=d?d[h]:null;if(a){f[i]=a.apply(d,g)}j=d}j=null;b=SC.Enumerator._pushContext(b);return f},invokeWhile:function(d,i){var f=this.get?this.get("length"):this.length;if(f<=0){return null}var j;var h=[];var c=arguments.length;if(c>2){for(j=2;j<c;j++){h.push(arguments[j])}}var g=d;var k=null;var b=SC.Enumerator._popContext();for(j=0;(g===d)&&(j<f);j++){var e=this.nextObject(j,k,b);var a=e?e[i]:null;if(a){g=a.apply(e,h)}k=e}k=null;b=SC.Enumerator._pushContext(b);return g},toArray:function(){var a=[];this.forEach(function(b){a.push(b)},this);return a},groupBy:function(i){var c=this.get?this.get("length"):this.length,d=[],h=null,a=SC.Enumerator._popContext(),e=[],j=[],f,b,g;for(f=0;f<c;f++){b=this.nextObject(f,h,a);g=b?(b.get?b.get(i):b[i]):null;if(SC.none(e[g])){e[g]=[];j.push(g)}e[g].push(b);h=b}h=null;a=SC.Enumerator._pushContext(a);for(f=0,c=j.length;f<c;f++){d.push(e[j[f]])}return d}};SC._buildReducerFor=function(a,b){return function(d,e){var f=this[a];if(SC.typeOf(f)!==SC.T_FUNCTION){return this.unknownProperty?this.unknownProperty(d,e):null}else{var c=SC.Enumerable.reduce.call(this,f,null,b);return c}}.property("[]")};SC.Reducers={"[]":function(a,b){return this}.property(),enumerableContentDidChange:function(c,a,b){if(!SC.none(c)){if(c===0){this.notifyPropertyChange("firstObject")}if(!SC.none(a)&&c+a>=this.get("length")-1){this.notifyPropertyChange("lastObject")}}this.notifyPropertyChange("[]")},reducedProperty:function(i,g,f){if(!i||typeof i!==SC.T_STRING||i.charAt(0)!=="@"){return undefined}var d=i.match(/^@([^(]*)(\(([^)]*)\))?$/);if(!d||d.length<2){return undefined}var h=d[1];var j=d[3];h="reduce"+h.slice(0,1).toUpperCase()+h.slice(1);var a=this[h];if(SC.typeOf(a)!==SC.T_FUNCTION){return undefined}if(f===NO){return SC.Enumerable.reduce.call(this,a,null,j)}var c=SC._buildReducerFor(h,j);var b=this.constructor.prototype;if(b){b[i]=c;var e=b._properties||[];e.push(i);b._properties=e;this.registerDependentKey(i,"[]")}return SC.Enumerable.reduce.call(this,a,null,j)},reduceMax:function(a,d,b,f,c){if(c&&d){d=d.get?d.get(c):d[c]}if(a===null){return d}return(d>a)?d:a},reduceMaxObject:function(b,f,c,g,d){var a=b,h=f;if(d){if(f){h=f.get?f.get(d):f[d]}if(b){a=b.get?b.get(d):b[d]}}if(a===null){return f}return(h>a)?f:b},reduceMin:function(a,d,b,f,c){if(c&&d){d=d.get?d.get(c):d[c]}if(a===null){return d}return(d<a)?d:a},reduceMinObject:function(b,f,c,g,d){var a=b,h=f;if(d){if(f){h=f.get?f.get(d):f[d]}if(b){a=b.get?b.get(d):b[d]}}if(a===null){return f}return(h<a)?f:b},reduceAverage:function(b,g,d,h,f){if(f&&g){g=g.get?g.get(f):g[f]}var c=(b||0)+g;var a=h.get?h.get("length"):h.length;if(d>=a-1){c=c/a}return c},reduceSum:function(a,d,b,f,c){if(c&&d){d=d.get?d.get(c):d[c]}return(a===null)?d:a+d}};SC.mixin(SC.Enumerable,SC.Reducers);SC.mixin(Array.prototype,SC.Reducers);Array.prototype.isEnumerable=YES;(function(){var a={nextObject:SC.Enumerable.nextObject,enumerator:SC.Enumerable.enumerator,firstObject:SC.Enumerable.firstObject,lastObject:SC.Enumerable.lastObject,sortProperty:SC.Enumerable.sortProperty,mapProperty:function(g){var e=this.length;var f=[];for(var d=0;d<e;d++){var h=this[d];f[d]=h?(h.get?h.get(g):h[g]):null}return f},filterProperty:function(g,i){var e=this.length,f=[],d,h,j;if(i===undefined){for(d=0;d<e;d++){h=this[d];j=h?(h.get?h.get(g):h[g]):null;if(!!j){f.push(h)}}}else{for(d=0;d<e;d++){h=this[d];j=h?(h.get?h.get(g):h[g]):null;if(SC.isEqual(j,i)){f.push(h)}}}return f},groupBy:function(h){var e=this.length,g=[],j=[],f=[],d,i,k;for(d=0;d<e;d++){i=this[d];k=i?(i.get?i.get(h):i[h]):null;if(SC.none(j[k])){j[k]=[];f.push(k)}j[k].push(i)}for(d=0,e=f.length;d<e;d++){g.push(j[f[d]])}return g},find:function(j,i){if(typeof j!=="function"){throw new TypeError()}var e=this.length;if(i===undefined){i=null}var g,f=null,h=NO;for(var d=0;d<e&&!h;d++){g=this[d];if(h=j.call(i,g,d,this)){f=g}}g=null;return f},findProperty:function(g,j){var e=this.length;var h,k,i=NO,f=null;for(var d=0;d<e&&!i;d++){k=(h=this[d])?(h.get?h.get(g):h[g]):null;i=(j===undefined)?!!k:SC.isEqual(k,j);if(i){f=h}}h=null;return f},everyProperty:function(g,i){var e=this.length;var f=YES;for(var d=0;f&&(d<e);d++){var h=this[d];var j=h?(h.get?h.get(g):h[g]):null;f=(i===undefined)?!!j:SC.isEqual(j,i)}return f},someProperty:function(g,i){var e=this.length;var f=NO;for(var d=0;!f&&(d<e);d++){var h=this[d];var j=h?(h.get?h.get(g):h[g]):null;f=(i===undefined)?!!j:SC.isEqual(j,i)}return f},invoke:function(f){var e=this.length;if(e<=0){return[]}var d;var h=[];var j=arguments.length;if(j>1){for(d=1;d<j;d++){h.push(arguments[d])}}var g=[];for(d=0;d<e;d++){var i=this[d];var k=i?i[f]:null;if(k){g[d]=k.apply(i,h)}}return g},invokeWhile:function(f,k){var h=this.length;if(h<=0){return null}var l;var j=[];var e=arguments.length;if(e>2){for(l=2;l<e;l++){j.push(arguments[l])}}var i=f;for(l=0;(i===f)&&(l<h);l++){var g=this[l];var d=g?g[k]:null;if(d){i=d.apply(g,j)}}return i},toArray:function(){var e=this.length;if(e<=0){return[]}var f=[];for(var d=0;d<e;d++){var g=this[d];f.push(g)}return f},getEach:function(g){var f=[];var e=this.length;for(var d=0;d<e;d++){var h=this[d];f[d]=h?(h.get?h.get(g):h[g]):null}return f},setEach:function(f,g){var e=this.length;for(var d=0;d<e;d++){var h=this[d];if(h){if(h.set){h.set(f,g)}else{h[f]=g}}}return this}};var c={forEach:function(h,g){if(typeof h!=="function"){throw new TypeError()}if(g===undefined){g=null}for(var e=0,d=this.length;e<d;e++){var f=this[e];h.call(g,f,e,this)}return this},map:function(j,h){if(typeof j!=="function"){throw new TypeError()}if(h===undefined){h=null}var e=[];for(var f=0,d=this.length;f<d;f++){var g=this[f];e[f]=j.call(h,g,f,this)}return e},filter:function(j,h){if(typeof j!=="function"){throw new TypeError()}if(h===undefined){h=null}var e=[];for(var f=0,d=this.length;f<d;f++){var g=this[f];if(j.call(h,g,f,this)){e.push(g)}}return e},every:function(i,h){if(typeof i!=="function"){throw new TypeError()}var e=this.length;if(h===undefined){h=null}var f=YES;for(var d=0;f&&(d<e);d++){var g=this[d];if(!i.call(h,g,d,this)){f=NO}}return f},some:function(i,h){if(typeof i!=="function"){throw new TypeError()}var e=this.length;if(h===undefined){h=null}var f=NO;for(var d=0;(!f)&&(d<e);d++){var g=this[d];if(i.call(h,g,d,this)){f=YES}}return f},reduce:function(j,f,i){if(typeof j!=="function"){throw new TypeError()}var e=this.length;if(e===0&&f===undefined){throw new TypeError()}var g=f;for(var d=0;d<e;d++){var h=this[d];if(h!==null){if(g===undefined){g=h}else{g=j.call(null,g,h,d,this,i)}}}if(g===undefined){throw new TypeError()}return g}};for(var b in c){if(!c.hasOwnProperty(b)){continue}if(!Array.prototype[b]||((typeof Prototype==="object")&&Prototype.Version.match(/^1\.6/))){Array.prototype[b]=c[b]}}SC.mixin(Array.prototype,a)})();SC.RangeObserver={isRangeObserver:YES,toString:function(){var a=this.indexes?this.indexes.toString():"SC.IndexSet<..>";return a.replace("IndexSet","RangeObserver(%@)".fmt(SC.guidFor(this)))},create:function(d,f,e,g,c,a){var b=SC.beget(this);b.source=d;b.indexes=f?f.frozenCopy():null;b.target=e;b.method=(typeof g==="string")?e[g]:g;b.context=c;b.isDeep=a||false;b.beginObserving();return b},extend:function(d){var c=SC.beget(this),b=arguments;for(var e=0,a=b.length;e<a;e++){SC.mixin(c,b[e])}return c},destroy:function(a){this.endObserving();return this},update:function(a,b){if(this.indexes&&this.indexes.isEqual(b)){return this}this.indexes=b?b.frozenCopy():null;this.endObserving().beginObserving();return this},beginObserving:function(){if(!this.isDeep){return this}var c=this.observing=this.observing||SC.CoreSet.create();var a=this._beginObservingForEach,b=this.source;if(!a){a=this._beginObservingForEach=function(d){var e=b.objectAt(d);if(e&&e.addObserver){c.push(e);e._kvo_needsRangeObserver=true}}}this.indexes.forEach(a);this.isObserving=false;SC.Observers.addPendingRangeObserver(this);return this},setupPending:function(b){var e=this.observing;if(this.isObserving||!e||(e.get("length")===0)){return true}if(e.contains(b)){this.isObserving=true;var c=this._setupPendingForEach;if(!c){var d=this.source,f=this.objectPropertyDidChange,a=this;c=this._setupPendingForEach=function(g){var j=d.objectAt(g),h=SC.guidFor(j),i;if(j&&j.addObserver){e.push(j);j.addObserver("*",a,f);i=a[h];if(i==null){a[h]=g}else{if(i.isIndexSet){i.add(g)}else{a[h]=SC.IndexSet.create(i).add(g)}}}}}this.indexes.forEach(c);return true}else{return false}},endObserving:function(){if(!this.isDeep){return this}var e=this.observing;if(this.isObserving){var b=this.objectPropertyDidChange,c=this.source,a,f,d;if(e){f=e.length;for(a=0;a<f;a++){d=e[a];d.removeObserver("*",this,b);this[SC.guidFor(d)]=null}e.length=0}this.isObserving=false}if(e){e.clear()}return this},rangeDidChange:function(b){var a=this.indexes;if(!b||!a||a.intersects(b)){this.endObserving();this.method.call(this.target,this.source,null,"[]",b,this.context);this.beginObserving()}return this},objectPropertyDidChange:function(d,f,g,a){var e=this.context,h=this.method,c=SC.guidFor(d),b=this[c];if(b&&!b.isIndexSet){b=this[c]=SC.IndexSet.create(b).freeze()}h.call(this.target,this.source,d,f,b,e||a,a)}};sc_require("ext/function");sc_require("mixins/observable");sc_require("mixins/enumerable");sc_require("system/range_observer");SC.OUT_OF_RANGE_EXCEPTION="Index out of range";SC.CoreArray={isSCArray:YES,replace:function(a,c,b){throw new Error("replace() must be implemented to support SC.Array")},indexOf:function(d,c){var b,a=this.get("length");if(c===undefined){c=0}else{c=(c<0)?Math.ceil(c):Math.floor(c)}if(c<0){c+=a}for(b=c;b<a;b++){if(this.objectAt(b,YES)===d){return b}}return -1},lastIndexOf:function(d,c){var b,a=this.get("length");if(c===undefined){c=a-1}else{c=(c<0)?Math.ceil(c):Math.floor(c)}if(c<0){c+=a}for(b=c;b>=0;b--){if(this.objectAt(b)===d){return b}}return -1},objectAt:function(a){if(a<0){return undefined}if(a>=this.get("length")){return undefined}return this.get(a)},"[]":function(a,b){if(b!==undefined){this.replace(0,this.get("length"),b)}return this}.property(),insertAt:function(a,b){if(a>this.get("length")){throw new Error(SC.OUT_OF_RANGE_EXCEPTION)}this.replace(a,0,[b]);return this},removeAt:function(d,a){var c=0,b=[];if(typeof d===SC.T_NUMBER){if((d<0)||(d>=this.get("length"))){throw new Error(SC.OUT_OF_RANGE_EXCEPTION)}if(a===undefined){this.replace(d,1,b);return this}else{d=SC.IndexSet.create(d,a)}}this.beginPropertyChanges();d.forEachRange(function(f,e){f-=c;c+=e;this.replace(f,e,b)},this);this.endPropertyChanges();return this},removeObject:function(b){var c=this.get("length")||0;while(--c>=0){var a=this.objectAt(c);if(a===b){this.removeAt(c)}}return this},removeObjects:function(a){this.beginPropertyChanges();a.forEach(function(b){this.removeObject(b)},this);this.endPropertyChanges();return this},slice:function(b,d){var a=[];var c=this.get("length");if(SC.none(b)){b=0}if(SC.none(d)||(d>c)){d=c}while(b<d){a[a.length]=this.objectAt(b++)}return a},pushObject:function(a){this.insertAt(this.get("length"),a);return a},pushObjects:function(a){this.beginPropertyChanges();a.forEach(function(b){this.pushObject(b)},this);this.endPropertyChanges();return this},popObject:function(){var a=this.get("length");if(a===0){return null}var b=this.objectAt(a-1);this.removeAt(a-1);return b},shiftObject:function(){if(this.get("length")===0){return null}var a=this.objectAt(0);this.removeAt(0);return a},unshiftObject:function(a){this.insertAt(0,a);return a},unshiftObjects:function(a){this.beginPropertyChanges();a.forEach(function(b){this.unshiftObject(b)},this);this.endPropertyChanges();return this},isEqual:function(a){if(!a){return false}if(a==this){return true}var b=a.get("length");if(b!=this.get("length")){return false}while(--b>=0){if(!SC.isEqual(a.objectAt(b),this.objectAt(b))){return false}}return true},compact:function(){return this.without(null)},without:function(b){if(this.indexOf(b)<0){return this}var a=[];this.forEach(function(c){if(c!==b){a[a.length]=c}});return a},uniq:function(){var a=[];this.forEach(function(b){if(a.indexOf(b)<0){a[a.length]=b}});return a},flatten:function(){var a=[];this.forEach(function(b){if(b&&b.isEnumerable){a=a.pushObjects(b.flatten())}else{a.pushObject(b)}});return a},max:function(){return Math.max.apply(Math,this)},min:function(){return Math.min.apply(Math,this)},rangeObserverClass:SC.RangeObserver,contains:function(a){return this.indexOf(a)>=0},addRangeObserver:function(d,f,h,e){var a=this._array_rangeObservers;if(!a){a=this._array_rangeObservers=SC.CoreSet.create()}if(this._array_oldLength===undefined){this._array_oldLength=this.get("length")}var g=this.rangeObserverClass;var b=NO;var c=g.create(this,d,f,h,e,b);a.add(c);if(!this._array_isNotifyingRangeObservers){this._array_isNotifyingRangeObservers=YES;this.addObserver("[]",this,this._array_notifyRangeObservers)}return c},updateRangeObserver:function(b,a){return b.update(this,a)},removeRangeObserver:function(c){var b=c.destroy(this);var a=this._array_rangeObservers;if(a){a.remove(c)}return b},addArrayObservers:function(a){this._modifyObserverSet("add",a)},removeArrayObservers:function(a){this._modifyObserverSet("remove",a)},_modifyObserverSet:function(h,c){var e,b;var g=c.target||this;var a=c.willChange||"arrayWillChange";var f=c.didChange||"arrayDidChange";var d=c.context;if(typeof a==="string"){a=g[a]}if(typeof f==="string"){f=g[f]}e=this._kvo_for("_kvo_array_will_change",SC.ObserverSet);b=this._kvo_for("_kvo_array_did_change",SC.ObserverSet);e[h](g,a,d);b[h](g,f,d)},arrayContentWillChange:function(b,i,a){this._teardownContentObservers(b,i);var f,d,h,j;var g,c;var e=this._kvo_array_will_change;if(e){d=e.members;h=d.length;for(j=0;j<h;j++){f=d[j];g=f[0];c=f[1];c.call(g,b,i,a,this)}}},arrayContentDidChange:function(b,m,a){var d=this._array_rangeObservers,c,k;this.beginPropertyChanges();this.notifyPropertyChange("length");if(d&&d.length>0){k=this._array_rangeChanges;if(!k){k=this._array_rangeChanges=SC.IndexSet.create()}if(m===a){c=m}else{c=this.get("length")-b;if(m>a){c+=(m-a)}}k.add(b,c)}this._setupContentObservers(b,a);var g,f,j,l;var h,e;var i=this._kvo_array_did_change;if(i){if(b===undefined){b=0;m=this.get("length");a=0}f=i.members;j=f.length;for(l=0;l<j;l++){g=f[l];h=g[0];e=g[1];e.call(h,b,m,a,this)}}this.enumerableContentDidChange(b,a,a-m);this.endPropertyChanges();return this},_setupContentObservers:function(f,e){var c=this._kvo_for("_kvo_content_observed_keys",SC.CoreSet);var d;var b;if(c.get("length")>0){d=this.slice(f,f+e);var a=this;c.forEach(function(g){b=SC.keyFor("_kvo_content_observers",g);a._kvo_for(b).forEach(function(h){d.forEach(function(i){a._resumeChainObservingForItemWithChainObserver(i,h)})})})}},_teardownContentObservers:function(e,a){var c=this._kvo_for("_kvo_content_observed_keys",SC.CoreSet);var d;var b;if(c.get("length")>0){d=this.slice(e,e+a);c.forEach(function(f){b=SC.keyFor("_kvo_content_observers",f);d.forEach(function(g){g._kvo_for(b).forEach(function(h){h.destroyChain()})})})}},teardownEnumerablePropertyChains:function(b){var a=this._kvo_enumerable_property_chains;if(a){a.forEach(function(g){var d,c=b.get("length"),i=SC.guidFor(g),f,h,e="_kvo_enumerable_property_clones";g.notifyPropertyDidChange();for(d=0;d<c;d++){h=b.objectAt(d);f=h[e][i];f.deactivate();delete h[e][i]}},this)}return this},setupEnumerablePropertyChains:function(b){var a=this._kvo_enumerable_property_chains;if(a){a.forEach(function(e){var d,c=b.get("length");e.notifyPropertyDidChange();c=b.get("length");for(d=0;d<c;d++){this._clonePropertyChainToItem(e,b.objectAt(d))}},this)}return this},registerDependentKeyWithChain:function(c,b){var a="_kvo_enumerable_property_chains",d;d=this._kvo_for(a,SC.CoreSet);d.add(b);this.forEach(function(e){this._clonePropertyChainToItem(b,e)},this)},_clonePropertyChainToItem:function(c,d){var e=SC.clone(c),b="_kvo_enumerable_property_clones",a;e.object=d;a=d[b]=d[b]||{};a[SC.guidFor(c)]=e;e.activate(d)},removeDependentKeyWithChain:function(d,c){var b="_kvo_enumerable_property_clones",e,a;this.forEach(function(f){f.removeDependentKeyWithChain(d,c);a=f[b];e=a[SC.guidFor(c)];e.deactivate(f)},this)},_resumeChainObservingForItemWithChainObserver:function(d,a){var b=SC.clone(a.next);var c=b.property;b.object=d;d.addObserver(c,b,b.propertyDidChange);if(a.root.tails){a.root.tails.pushObject(b.tail())}d._kvo_for(SC.keyFor("_kvo_content_observers",c)).push(b)},_addContentObserver:function(a){var c=a.next.property;this._kvo_for("_kvo_content_observed_keys",SC.CoreSet).push(c);var d=SC.keyFor("_kvo_content_observers",c);this._kvo_for(d).push(a);var b=a.tail();this.addObserver("[]",b,b.propertyDidChange);this._setupContentObservers(0,a.object.get("length"))},_removeContentObserver:function(a){var f,d;var e=this._kvo_content_observed_keys;var c=a.next.property;var b=a.tail();this.removeObserver("[]",b,b.propertyDidChange);if(e.contains(c)){d=SC.keyFor("_kvo_content_observers",c);f=this._kvo_for(d);f.removeObject(a);this._teardownContentObservers(0,a.object.get("length"));if(f.length===0){this._kvo_for("_kvo_content_observed_keys").remove(c)}}},_array_notifyRangeObservers:function(){var c=this._array_rangeObservers,d=this._array_rangeChanges,b=c?c.length:0,a;if(b>0&&d&&d.length>0){for(a=0;a<b;a++){c[a].rangeDidChange(d)}d.clear()}}};SC.Array=SC.mixin({},SC.Enumerable,SC.CoreArray);sc_require("mixins/array");SC.supplement(Array.prototype,SC.CoreArray);SC.mixin(Array.prototype,{replace:function(b,e,d){if(this.isFrozen){throw new Error(SC.FROZEN_ERROR)}var c;var a=d?(d.get?d.get("length"):d.length):0;this.arrayContentWillChange(b,e,a);if(a===0){this.splice(b,e)}else{c=[b,e].concat(d);this.splice.apply(this,c)}this.arrayContentDidChange(b,e,a);return this},unknownProperty:function(b,c){var a=this.reducedProperty(b,c);if((c!==undefined)&&a===undefined){a=this[b]=c}return a}});if(Array.prototype.indexOf===SC.CoreArray.indexOf){Array.prototype.indexOf=function(d,c){var b,a=this.length;if(c===undefined){c=0}else{c=(c<0)?Math.ceil(c):Math.floor(c)}if(c<0){c+=a}for(b=c;b<a;b++){if(this[b]===d){return b}}return -1}}if(Array.prototype.lastIndexOf===SC.CoreArray.lastIndexOf){Array.prototype.lastIndexOf=function(d,c){var b,a=this.length;if(c===undefined){c=a-1}else{c=(c<0)?Math.ceil(c):Math.floor(c)}if(c<0){c+=a}for(b=c;b>=0;b--){if(this[b]===d){return b}}return -1}}if(!Date.now){Date.now=function(){return new Date().getTime()}}SC.supplement(Number.prototype,{ordinal:function(){if(SC.Locale){return SC.Locale.currentLocale.ordinalForNumber(this)}var a=this%10;return(~~(this%100/10)===1)?"th":(a===1)?"st":(a===2)?"nd":(a===3)?"rd":"th"}});SC.String={_scs_valueForKey:function(e,g,c){var a,f,d,b=e.indexOf(":");if(b>-1){a=e.substr(b+1);e=e.substr(0,b)}f=g.get?g.get(e):g[e];d=g[e+"Formatter"];if(d){f=d(f,a)}else{if(a){throw new Error("String.fmt was given a formatting string, but key `"+e+"` has no formatter! String: "+c)}}return f},fmt:function(b,a){var c=0,d,e;if(a){d=a[0]}return b.replace(/%\{(.*?)\}/g,function(g,h){e=YES;if(!d){throw new Error("Cannot use named parameters with `fmt` without a data hash. String: '"+b+"'")}var f=SC.String._scs_valueForKey(h,d,b);if(!SC.none(f)){return f}else{return g}}).replace(/%@([0-9]+)?/g,function(g,f){if(e){throw new Error("Invalid attempt to use both named parameters and indexed parameters. String: '"+b+"'")}f=f?parseInt(f,10)-1:c++;if(a[f]!==undefined){return a[f]}else{return""}})},w:function(f){var d=[],e=f.split(" "),b=e.length,c,a=0;for(a=0;a<b;++a){c=e[a];if(c.length!==0){d.push(c)}}return d}};sc_require("system/string");SC.mixin(String.prototype,{fmt:function(){return SC.String.fmt(this,arguments)},w:function(){return SC.String.w(this)}});(function(){if(window&&typeof window.performance==="undefined"){window.performance={}}if(window&&!window.performance.now){var a;if(window.performance.timing&&window.performance.timing.navigationStart){a=window.performance.timing.navigationStart}else{window.performance.timing={};a=window.performance.timing.navigationStart=Date.now?Date.now():(new Date()).getTime()}window.performance.now=function(){var b=Date.now?Date.now():(new Date()).getTime();return b-a}}})();SC.Comparable={isComparable:YES,compare:function(d,c){throw new Error("%@.compare() is not implemented".fmt(this.toString()))}};SC.Copyable={isCopyable:YES,copy:function(a){var b=SC._object_className(this.constructor);throw new Error("%@.copy() is not implemented".fmt(b))},frozenCopy:function(){var a=this.get?this.get("isFrozen"):this.isFrozen;if(a===YES){return this}else{if(a===undefined){throw new Error("%@ does not support freezing".fmt(this))}else{return this.copy().freeze()}}}};SC.mixin(Array.prototype,SC.Copyable);Array.prototype.copy=function(b){var c=this.slice(),a;if(b){a=c.length;while(a--){c[a]=SC.copy(c[a],true)}}return c};SC.FROZEN_ERROR="Cannot modify a frozen object";SC.Freezable={isFreezable:YES,isFrozen:NO,freeze:function(){if(this.set){this.set("isFrozen",YES)}else{this.isFrozen=YES}return this}};SC.mixin(Array.prototype,SC.Freezable);SC.Tree={invoke:function(b,a,d){var h,f=this.get("childViews"),g,e;for(var c=f.length-1;c>=0;c--){h=f[c];if(!h){continue}g=h[b];if(a===undefined||a){e=g.call(h,d)}if(e===undefined||e){h._callOnChildViews(b,a,d)}if(a===false){g.call(h,d)}}}};sc_require("mixins/enumerable");sc_require("mixins/observable");sc_require("mixins/freezable");sc_require("mixins/copyable");SC.Set=SC.mixin({},SC.Observable,SC.Enumerable,SC.Freezable,{create:function(c){var d,b,e=SC.Set._pool,f=this.isObservable,a;if(!f&&c===undefined&&e.length>0){return e.pop()}else{d=SC.beget(this);if(f){d.initObservable()}if(c&&c.isEnumerable&&c.get("length")>0){d.isObservable=NO;if(c.isSCArray){a=c.get("length");for(b=0;b<a;b++){d.add(c.objectAt(b))}}else{if(c.isSet){a=c.length;for(b=0;b<a;b++){d.add(c[b])}}else{c.forEach(function(g){d.add(g)},this)}}d.isObservable=f}}return d},isSet:YES,length:0,firstObject:function(){return(this.length>0)?this[0]:undefined}.property(),clear:function(){if(this.isFrozen){throw new Error(SC.FROZEN_ERROR)}this.length=0;return this},contains:function(b){if(b===null){return NO}var a=this[SC.hashFor(b)];return(!SC.none(a)&&(a<this.length)&&(this[a]===b))},isEqual:function(a){if(!a||!a.isSet||(a.get("length")!==this.get("length"))){return NO}var b=this.get("length");while(--b>=0){if(!a.contains(this[b])){return NO}}return YES},addSetObserver:function(a){if(!this.setObservers){this.setObservers=SC.CoreSet.create()}this.setObservers.add(a)},removeSetObserver:function(a){if(!this.setObservers){return}this.setObservers.remove(a)},add:function(e){if(this.isFrozen){throw new Error(SC.FROZEN_ERROR)}if(e===null||e===undefined){return this}var c,d=((c=e.hash)&&(typeof c==="function"))?c.call(e):SC.guidFor(e),b=this[d],a=this.length;if((b>=a)||(this[b]!==e)){this[a]=e;this[d]=a;this.length=a+1;if(this.setObservers){this.didAddItem(e)}}if(this.isObservable){this.enumerableContentDidChange()}return this},addEach:function(c){if(this.isFrozen){throw new Error(SC.FROZEN_ERROR)}if(!c||!c.isEnumerable){throw new Error("%@.addEach must pass enumerable".fmt(this))}var a,b=this.isObservable;if(b){this.beginPropertyChanges()}if(c.isSCArray){a=c.get("length");while(--a>=0){this.add(c.objectAt(a))}}else{if(c.isSet){a=c.length;while(--a>=0){this.add(c[a])}}else{c.forEach(function(d){this.add(d)},this)}}if(b){this.endPropertyChanges()}return this},remove:function(f){if(this.isFrozen){throw new Error(SC.FROZEN_ERROR)}if(f===null||f===undefined){return this}var c,d=(f&&(c=f.hash)&&(typeof c===SC.T_FUNCTION))?c.call(f):SC.guidFor(f),b=this[d],a=this.length,e;if((b===null||b===undefined)||(b>=a)||(this[b]!==f)){return this}delete this[d];if(b<(a-1)){e=this[b]=this[a-1];d=(e&&(c=e.hash)&&(typeof c===SC.T_FUNCTION))?c.call(e):SC.guidFor(e);this[d]=b}delete this[a-1];this.length=a-1;if(this.isObservable){this.enumerableContentDidChange()}if(this.setObservers){this.didRemoveItem(f)}return this},pop:function(){if(this.isFrozen){throw new Error(SC.FROZEN_ERROR)}var a=(this.length>0)?this[this.length-1]:null;this.remove(a);return a},removeEach:function(c){if(this.isFrozen){throw new Error(SC.FROZEN_ERROR)}if(!c||!c.isEnumerable){throw new Error("%@.addEach must pass enumerable".fmt(this))}var a,b=this.isObservable;if(b){this.beginPropertyChanges()}if(c.isSCArray){a=c.get("length");while(--a>=0){this.remove(c.objectAt(a))}}else{if(c.isSet){a=c.length;while(--a>=0){this.remove(c[a])}}else{c.forEach(function(d){this.remove(d)},this)}}if(b){this.endPropertyChanges()}return this},copy:function(){return this.constructor.create(this)},destroy:function(){this.isFrozen=NO;if(!this.isObservable){SC.Set._pool.push(this.clear())}return this},forEach:function(c,d){var b=this.length;if(!d){d=this}for(var a=0;a<b;a++){c.call(d,this[a],a,this)}return this},toString:function(){var b=this.length,a,c=[];for(a=0;a<b;a++){c[a]=this[a]}return"SC.Set<%@>".fmt(c.join(","))},didAddItem:function(c){var d=this.setObservers;if(!d){return}var b=d.length,a;for(a=0;a<b;a++){d[a].didAddItem(this,c)}},didRemoveItem:function(c){var d=this.setObservers;if(!d){return}var b=d.length,a;for(a=0;a<b;a++){d[a].didRemoveItem(this,c)}},isObservable:YES});SC.Set.constructor=SC.Set;SC.Set.clone=SC.Set.copy;SC.Set.push=SC.Set.unshift=SC.Set.add;SC.Set.shift=SC.Set.pop;SC.Set.addObject=SC.Set.add;SC.Set.removeObject=SC.Set.remove;SC.Set._pool=[];SC.CoreSet=SC.beget(SC.Set);SC.CoreSet.isObservable=NO;SC.CoreSet.constructor=SC.CoreSet;sc_require("mixins/observable");sc_require("system/set");SC.Observers={queue:[],addObserver:function(c,d,e,b){var a;if(typeof c==="string"){a=SC.tupleForPropertyPath(c,b)}else{a=c}if(a&&a[0].addObserver){a[0].addObserver(a[1],d,e)}else{this.queue.push([c,d,e,b])}},removeObserver:function(c,e,a,b){var h,d,f,i;f=SC.tupleForPropertyPath(c,b);if(f){f[0].removeObserver(f[1],e,a)}h=this.queue.length;d=this.queue;var g;while(--h>=0){i=d[h];if(i[0]!==c||i[1]!==e||i[2]!==a||i[3]!==b){if(!g){g=[]}g.push(i)}}this.queue=g||this.queue},addPendingRangeObserver:function(a){var b=this.rangeObservers;if(!b){b=this.rangeObservers=SC.CoreSet.create()}b.add(a);return this},_TMP_OUT:[],flush:function(b){var g=this.queue,d,a=g.length;if(g&&a>0){var k=(this.queue=[]);for(d=0;d<a;d++){var l=g[d];if(!l){continue}var h=SC.tupleForPropertyPath(l[0],l[3]);if(h&&h[0].addObserver){h[0].addObserver(h[1],l[1],l[2])}else{k.push(l)}}}if(b._kvo_needsRangeObserver){var j=this.rangeObservers,f=j?j.get("length"):0,c=this._TMP_OUT,e;for(d=0;d<f;d++){e=j[d];if(e.setupPending(b)){c.push(e)}}if(c.length>0){j.removeEach(c)}c.length=0;b._kvo_needsRangeObserver=false}},isObservingSuspended:0,_pending:SC.CoreSet.create(),objectHasPendingChanges:function(a){this._pending.add(a)},suspendPropertyObserving:function(){this.isObservingSuspended++},resumePropertyObserving:function(){var c;if(--this.isObservingSuspended<=0){c=this._pending;this._pending=SC.CoreSet.create();var b,a=c.length;for(b=0;b<a;b++){c[b]._notifyPropertyObservers()}c.clear();c=null}}};sc_require("core");sc_require("mixins/observable");sc_require("private/observer_queue");sc_require("mixins/array");sc_require("system/set");SC.BENCHMARK_OBJECTS=NO;SC._detect_base=function _detect_base(c,b,a){return function d(){var h=b[a],f,g,e;if(c.isEnhancement){f=new Array(arguments.length-1);for(g=0,e=f.length;g<e;g++){f[g]=arguments[g+1]}}else{f=new Array(arguments.length);for(g=0,e=f.length;g<e;g++){f[g]=arguments[g]}}return h.apply(this,f)}};SC._object_extend=function _object_extend(g,f,n){g._kvo_cloned=null;var w,m,e,h=g.concatenatedProperties,k=SC.K,c,b;m=(h)?h.length:0;var a=(m>0)?{}:null;while(--m>=0){w=h[m];c=g[w];b=f[w];if(c){if(!(c instanceof Array)){c=SC.$A(c)}a[w]=(b)?c.concat(b):b}else{if(!(b instanceof Array)){b=SC.$A(b)}a[w]=b}}var v=g._bindings,l=NO,t=g._observers,u=NO,i=g._properties,d=NO,q,j,o,p;var s=g.outlets,r=NO;if(f.outlets){s=(s||SC.EMPTY_ARRAY).concat(f.outlets);r=YES}for(w in f){if(w==="_kvo_cloned"){continue}if(!f.hasOwnProperty(w)){continue}p=(a.hasOwnProperty(w)?a[w]:null)||f[w];if(w.length>7&&w.slice(-7)==="Binding"){if(!l){v=(v||SC.EMPTY_ARRAY).slice();l=YES}if(g[w]==null){v[v.length]=w}}else{if(p&&(p instanceof Function)){if(!p.superclass&&(p!==(e=g[w]))){p.superclass=e||k;p.base=n?SC._detect_base(p,n,w):e||k}if(p.propertyPaths){if(!u){t=(t||SC.EMPTY_ARRAY).slice();u=YES}t[t.length]=w}q=p.localPropertyPaths;if(q){j=q.length;while(--j>=0){o=g._kvo_for(SC.keyFor("_kvo_local",q[j]),SC.CoreSet);o.add(w);g._kvo_for("_kvo_observed_keys",SC.CoreSet).add(q[j])}}if(p.dependentKeys){if(!d){i=(i||SC.EMPTY_ARRAY).slice();d=YES}i[i.length]=w}if(p.autoconfiguredOutlet){if(!r){s=(s||SC.EMPTY_ARRAY).slice();r=YES}s[s.length]=w}if(p.isEnhancement){p=SC._enhance(g[w]||k,p)}}}g[w]=p}if(f.hasOwnProperty("toString")){w="toString";p=(a.hasOwnProperty(w)?a[w]:null)||f[w];if(!p.superclass&&(p!==(e=g[w]))){p.superclass=p.base=e||k}g[w]=p}g._bindings=v||[];g._observers=t||[];g._properties=i||[];g.outlets=s||[];return g};SC._enhance=function(b,a){return function(){var d=new Array(arguments.length+1);for(var f=1,c=d.length;f<c;f++){d[f]=arguments[f-1]}var e=this;d[0]=function(){var h=new Array(arguments.length);for(var j=0,g=h.length;j<g;j++){h[j]=arguments[j]}return b.apply(e,h)};return a.apply(this,d)}};SC.Object=function(a){this.__sc_super__=SC.Object.prototype;return this._object_init(a)};SC.mixin(SC.Object,{mixin:function(){var a=arguments.length,b;for(b=0;b<a;b++){SC.mixin(this,arguments[b])}return this},superclass:null,extend:function(){var e,c=function(f){this.__sc_super__=c.prototype;return this._object_init(f)};for(e in this){if(!this.hasOwnProperty(e)){continue}c[e]=this[e]}if(this.hasOwnProperty("toString")){c.toString=this.toString}c.superclass=this;c.__sc_super__=this.prototype;SC.generateGuid(c,"sc");c.subclasses=SC.Set.create();this.subclasses.add(c);var d=(c.prototype=SC.beget(this.prototype)),b,a=arguments.length;for(b=0;b<a;b++){SC._object_extend(d,arguments[b],c.__sc_super__)}d.constructor=c;return c},reopen:function(f){if(this.subclasses){var b,e,g,c,a=this.subclasses.length,d;for(d=0;d<a;d++){c=null;b=this.subclasses[d];for(e in f){if(!f.hasOwnProperty(e)){continue}if(b.prototype.hasOwnProperty(e)){if(!c){c=SC.clone(f)}delete c[e];continue}g=f[e];if(g&&(g instanceof Function)&&(g.isEnhancement)){if(!c){c=SC.clone(f)}delete c[e];continue}}b.reopen(c||f)}}return SC._object_extend(this.prototype,f,this.__sc_super__)},create:function(){var b=this,a=new b(arguments);if(SC.ObjectDesigner){SC.ObjectDesigner.didCreateObject(a,SC.$A(arguments))}return a},isClass:YES,subclasses:SC.Set.create(),toString:function(){return SC._object_className(this)},subclassOf:function(b){if(this===b){return NO}var a=this;while((a=a.superclass)){if(a===b){return YES}}return NO},hasSubclass:function(a){return(a&&a.subclassOf)?a.subclassOf(this):NO},kindOf:function(a){return(this===a)||this.subclassOf(a)},design:function(){if(this.isDesign){return this}var a=this.extend.apply(this,arguments);a.isDesign=YES;if(SC.ObjectDesigner){SC.ObjectDesigner.didLoadDesign(a,this,SC.A(arguments))}return a}});SC.Object.prototype={_kvo_enabled:YES,_object_init:function(c){var b,a=(c)?c.length:0;for(b=0;b<a;b++){SC._object_extend(this,c[b],this.__sc_super__)}SC.generateGuid(this,"sc");this.init();var d=this.initMixin;a=(d)?d.length:0;for(b=0;b<a;b++){d[b].call(this)}return this},mixin:function(){var b,a=arguments.length,c;for(b=0;b<a;b++){SC._object_extend(this,arguments[b])}this._observableInited=NO;this.initObservable();for(b=0;b<a;b++){c=arguments[b].initMixin;if(c){c.call(this)}}return this},init:function(){this.initObservable();return this},isDestroyed:NO,destroy:function(){if(this.get("isDestroyed")){return this}this.set("isDestroyed",YES);var b,c=this.destroyMixin,a=(c)?c.length:0;for(b=0;b<a;b++){c[b].call(this)}this.destroyObservable();return this},isObject:true,respondsTo:function(a){return !!(this[a] instanceof Function)},tryToPerform:function(b,c,a){return this.respondsTo(b)&&(this[b](c,a)!==NO)},superclass:function(){var a=arguments.callee.caller;return a.superclass?a.superclass.apply(this,arguments):null},instanceOf:function(a){return this.constructor===a},kindOf:function(a){return this.constructor.kindOf(a)},toString:function(){if(!this._object_toString){var a=SC._object_className(this.constructor),b=a+":"+SC.guidFor(this);if(a){this._object_toString=b}else{return b}}return this._object_toString},invokeOnce:function(a){SC.RunLoop.currentRunLoop.invokeOnce(this,a);return this},invokeLast:function(a){SC.RunLoop.currentRunLoop.invokeLast(this,a);return this},invokeNext:function(a){SC.RunLoop.currentRunLoop.invokeNext(this,a);return this},concatenatedProperties:["concatenatedProperties","initMixin","destroyMixin"]};SC.Object.prototype.constructor=SC.Object;SC.mixin(SC.Object.prototype,SC.Observable);SC.findClassNames=function(){if(SC._object_foundObjectClassNames){return}SC._object_foundObjectClassNames=true;var b=[],c=false;var a=function(d,f,j){var l,i,h;j--;if(b.indexOf(f)>=0){return}b.push(f);for(var g in f){if(g==="__scope__"){continue}if(g==="superclass"){continue}if(g==="__SC__"){g="SC"}if(!g.match(/^[A-Z0-9]/)){continue}if(g==="SC"){if(c){continue}c=true}l=(d)?[d,g].join("."):g;i=f[g];try{h=SC.typeOf(i)}catch(k){break}switch(h){case SC.T_CLASS:if(!i._object_className){i._object_className=l}if(j>=0){a(l,i,j)}break;case SC.T_OBJECT:if(j>=0){a(l,i,j)}break;case SC.T_HASH:if(((d)||(l==="SC"))&&(j>=0)){a(l,i,j)}break;default:break}}};window.__SC__=SC;a(null,window,2)};SC.instanceOf=function(a,b){return !!(a&&a.constructor===b)};SC.kindOf=function(a,b){if(a&&!a.isClass){a=a.constructor}return !!(a&&a.kindOf&&a.kindOf(b))};SC._object_className=function(b){if(SC.isReady===NO){return""}if(!b._object_className){SC.findClassNames()}if(b._object_className){return b._object_className}var a=b;while(a&&!a._object_className){a=a.superclass}return(a&&a._object_className)?a._object_className:"Anonymous"};sc_require("system/object");SC._PropertyChain=SC.Object.extend({object:null,property:null,target:null,toInvalidate:null,nextProperty:null,activate:function(b){var a=this.get("object"),c=this.get("property"),d;if(!b){b=this.get("target")}if(a&&a!==b){this.deactivate()}this.set("object",b);if(b&&c!=="@each"){b.registerDependentKeyWithChain(c,this)}if(this.next){d=b?b.get(c):undefined;this.next.activate(d)}return this},deactivate:function(){var a=this.get("object"),b=this.get("property");if(a){a.removeDependentKeyWithChain(b,this)}if(this.next){this.next.deactivate()}return this},notifyPropertyDidChange:function(){var d=this.get("target"),c=this.get("toInvalidate"),b,a;d.propertyDidChange(c);if(this.next){b=this.get("object");a=b.get(this.get("property"));this.next.activate(a)}}});SC._PropertyChain.createChain=function(h,g,e){var f=h.split(".");var a=f.length,d=1;var b=SC._PropertyChain.create({property:f[0],target:g,toInvalidate:e,nextProperty:f[1]});b.set("length",a);var c=b;while(--a>=1){c=c.next=SC._PropertyChain.create({property:f[d],target:g,toInvalidate:e,nextProperty:f[++d]});c.set("length",a)}return b};sc_require("ext/function");sc_require("system/object");SC.MULTIPLE_PLACEHOLDER="@@MULT@@";SC.NULL_PLACEHOLDER="@@NULL@@";SC.EMPTY_PLACEHOLDER="@@EMPTY@@";SC.Binding={isBinding:YES,beget:function(b){var a=SC.beget(this);a.parentBinding=this;if(a._MixAdapter){a._mixAdapter=a._MixAdapter.create(a._mixAdapterHash);a=a.from("aggregateProperty",a._mixAdapter).oneWay()}if(b!==undefined){a=a.from(b)}return a},builder:function(){var b=this,a=function(c){return b.beget().from(c)};a.beget=function(){return b.beget()};return a},from:function(b,a){if(!b){return this}var c=(this===SC.Binding)?this.beget():this;c._fromPropertyPath=b;c._fromRoot=a;c._fromTuple=null;return c},to:function(b,a){var c=(this===SC.Binding)?this.beget():this;c._toPropertyPath=b;c._toRoot=a;c._toTuple=null;return c},connect:function(){if(this.isConnected){return this}this.isConnected=YES;this._connectionPending=YES;this._syncOnConnect=YES;SC.Binding._connectQueue.add(this);if(!SC.RunLoop.isRunLoopInProgress()){this._scheduleSync()}return this},_connect:function(){if(!this._connectionPending){return}this._connectionPending=NO;var b,a;b=this._fromPropertyPath;a=this._fromRoot;if(typeof b==="string"){if(b.indexOf(".")===0){b=b.slice(1);if(!a){a=this._toRoot}}else{if(b.indexOf("*")===0){b=[this._fromRoot||this._toRoot,b.slice(1)];a=null}}}this._fromObserverData=[b,this,this.fromPropertyDidChange,a];SC.Observers.addObserver.apply(SC.Observers,this._fromObserverData);if(!this._oneWay){b=this._toPropertyPath;a=this._toRoot;this._toObserverData=[b,this,this.toPropertyDidChange,a];SC.Observers.addObserver.apply(SC.Observers,this._toObserverData)}if(this._syncOnConnect){this._syncOnConnect=NO;this.sync()}},disconnect:function(){if(!this.isConnected){return this}if(this._connectionPending){this._connectionPending=NO;SC.Binding._connectQueue.remove(this)}else{SC.Observers.removeObserver.apply(SC.Observers,this._fromObserverData);if(!this._oneWay){SC.Observers.removeObserver.apply(SC.Observers,this._toObserverData)}SC.Binding._changeQueue.remove(this)}this.isConnected=NO;return this},isDestroyed:NO,destroy:function(){if(this.isDestroyed){return}this.isDestroyed=YES;if(this._mixAdapter){this._mixAdapter.destroy();this._mixAdapter=null;this._MixAdapter=null;this._mixAdapterHash=null}this.disconnect();this._bindingSource=null;this._toRoot=this._toTarget=null;this._fromRoot=this._fromTarget=null;this._toObserverData=this._fromObserverData=null},fromPropertyDidChange:function(c,b){var a=c?c.get(b):null;if(!this.isConnected){return}if(a!==this._bindingValue||b==="[]"){this._setBindingValue(c,b);SC.Binding._changeQueue.add(this);this._scheduleSync()}},toPropertyDidChange:function(c,b){if(this._oneWay){return}var a=c.get(b);if(!this.isConnected){return}if(a!==this._transformedBindingValue){this._setBindingValue(c,b);SC.Binding._changeQueue.add(this);this._scheduleSync()}},_scheduleSync:function(){if(SC.RunLoop.isRunLoopInProgress()||SC.Binding._syncScheduled){return}SC.Binding._syncScheduled=YES;setTimeout(function(){SC.run();SC.Binding._syncScheduled=NO},1)},_setBindingValue:function(b,a){this._bindingSource=b;this._bindingKey=a},_computeBindingValue:function(){var c=this._bindingSource,b=this._bindingKey,a;this._bindingValue=a=(c?c.getPath(b):null);this._transformedBindingValue=this._computeTransformedValue(a)},_computeTransformedValue:function(e){var d=this._transforms,b,a,c;if(d){a=d.length;for(b=0;b<a;b++){c=d[b];e=c(e,this)}}if(this._noError&&SC.typeOf(e)===SC.T_ERROR){e=null}return e},_connectQueue:SC.CoreSet.create(),_alternateConnectQueue:SC.CoreSet.create(),_changeQueue:SC.CoreSet.create(),_alternateChangeQueue:SC.CoreSet.create(),flushPendingChanges:function(){if(this._isFlushing){return NO}this._isFlushing=YES;SC.Observers.suspendPropertyObserving();var b=NO,a,c;while((a=this._connectQueue).length>0){this._connectQueue=this._alternateConnectQueue;this._alternateConnectQueue=a;while((c=a.pop())){c._connect()}}while((a=this._changeQueue).length>0){b=YES;this._changeQueue=this._alternateChangeQueue;this._alternateChangeQueue=a;while((c=a.pop())){c.applyBindingValue()}}this._isFlushing=NO;SC.Observers.resumePropertyObserving();return b},applyBindingValue:function(){this._computeBindingTargets();this._computeBindingValue();var a=this._bindingValue,b=this._transformedBindingValue;if(!this._oneWay&&this._fromTarget){this._fromTarget.setPathIfChanged(this._fromPropertyKey,a)}if(this._toTarget){this._toTarget.setPathIfChanged(this._toPropertyKey,b)}},sync:function(){var d,c,a,b;if(!this.isConnected){return this}if(this._connectionPending){this._syncOnConnect=YES}else{this._computeBindingTargets();d=this._fromTarget;c=this._fromPropertyKey;if(!d||!c){return this}if(!d.isObservable){return this}a=d.getPath(c);b=this._computeTransformedValue(a);if(a!==this._bindingValue||b!==this._transformedBindingValue||c==="[]"){this._setBindingValue(d,c);SC.Binding._changeQueue.add(this)}}return this},_syncOnConnect:NO,_computeBindingTargets:function(){var c,b,a;if(!this._fromTarget){c=this._fromPropertyPath;b=this._fromRoot;if(typeof c==="string"){if(c.indexOf(".")===0){c=c.slice(1);if(!b){b=this._toRoot}}else{if(c.indexOf("*")===0){c=[b||this._toRoot,c.slice(1)];b=null}}}a=SC.tupleForPropertyPath(c,b);if(a){this._fromTarget=a[0];this._fromPropertyKey=a[1]}}if(!this._toTarget){c=this._toPropertyPath;b=this._toRoot;a=SC.tupleForPropertyPath(c,b);if(a){this._toTarget=a[0];this._toPropertyKey=a[1];if(this._mixAdapter){this._mixAdapter.set("localObject",this._toTarget)}}}},oneWay:function(c,a){if((a===undefined)&&(SC.typeOf(c)===SC.T_BOOL)){a=c;c=null}var b=this.from(c);if(b===SC.Binding){b=b.beget()}b._oneWay=(a===undefined)?YES:a;return b},transform:function(b){var c=(this===SC.Binding)?this.beget():this;var a=c._transforms;if(a&&(a===c.parentBinding._transforms)){a=c._transforms=a.slice()}if(!a){a=c._transforms=[]}a.push(b);return c},resetTransforms:function(){var a=(this===SC.Binding)?this.beget():this;a._transforms=null;return a},bool:function(a){return this.from(a).transform(function(b){var c=SC.typeOf(b);if(c===SC.T_ERROR){return b}return(c==SC.T_ARRAY)?(b.length>0):(b==="")?NO:!!b})},integer:function(a,b){if(b===undefined){b=a;a=null}if(b===undefined){b=10}return this.from(a).transform(function(c){if(SC.none(c)){c=0}else{if(typeof c===SC.T_STRING){c=window.parseInt(c,b)}else{if(typeof c===SC.T_BOOL){c=c?1:0}}}if(typeof c!==SC.T_NUMBER||isNaN(c)){c=0}return c})},isNull:function(a){return this.from(a).transform(function(b){var c=SC.typeOf(b);return(c===SC.T_ERROR)?b:SC.none(b)})},noError:function(c,a){if((a===undefined)&&(SC.typeOf(c)===SC.T_BOOL)){a=c;c=null}var b=this.from(c);if(b===SC.Binding){b=b.beget()}b._noError=(a===undefined)?YES:a;return b},not:function(a){return this.from(a).transform(function(b){var c=SC.typeOf(b);if(c===SC.T_ERROR){return b}return !((c==SC.T_ARRAY)?(b.length>0):(b==="")?NO:!!b)})},multiple:function(a){return this.from(a).transform(function(b){if(!SC.isArray(b)){b=(b==null)?[]:[b]}return b})},notEmpty:function(b,a){if(a===undefined){a=SC.EMPTY_PLACEHOLDER}return this.from(b).transform(function(d,c){if(SC.none(d)||(d==="")||(SC.isArray(d)&&(d.get?d.get("length"):d.length)===0)){d=a}return d})},notNull:function(b,a){if(a===undefined){a=SC.EMPTY_PLACEHOLDER}return this.from(b).transform(function(d,c){if(SC.none(d)){d=a}return d})},single:function(b,a){if(a===undefined){a=SC.MULTIPLE_PLACEHOLDER}return this.from(b).transform(function(e,d){if(e&&e.isEnumerable){var c=e.get("length");e=(c>1)?a:(c<=0)?null:e.firstObject()}return e})},string:function(a){return this.from(a).transform(function(b){if(SC.none(b)){b=""}else{if(typeof b!==SC.T_STRING&&b.toString){b=b.toString()}}return b})},_sc_mixAdapterBinding:function(h){var g=[];for(var e=1;e<arguments.length;e++){var f=arguments[e];if(f.indexOf("*")===0||f.indexOf(".")===0){f=f.slice(1).replace(/\*/g,".");f="*localObject."+f}g.push(f)}var d={localObject:null};for(e=0;e<g.length;++e){var c="value"+e;d[c+"Binding"]=SC.Binding.oneWay(g[e])}var a=h.create(d);var b=this.from("aggregateProperty",a).oneWay();b._MixAdapter=h;b._mixAdapterHash=d;b._mixAdapter=a;return b},_sc_mixImpl:function(f,e){var a=f.length,d=[];for(var c=0;c<a;++c){d.push("value"+c)}var b=SC.Object.extend({aggregateProperty:SC.Function.property(function(){var g=d.map(function(h){return this.get(h)},this);return e.apply(null,g)},d).cacheable()});return this._sc_mixAdapterBinding.apply(this,[b].concat(f))},and:function(){var a=arguments.length,c=new Array(a);for(var b=0;b<a;b++){c[b]=arguments[b]}return this._sc_mixImpl(c,function(){var d=true;for(b=0;d&&(b<arguments.length);b++){d=d&&arguments[b]}return d})},or:function(){var a=arguments.length,c=new Array(a);for(var b=0;b<a;b++){c[b]=arguments[b]}return this._sc_mixImpl(c,function(){var d=false;for(b=0;!d&&(b<arguments.length);b++){d=d||arguments[b]}return d})},mix:function(){var a=arguments.length-1,c=new Array(a);for(var b=0;b<a;b++){c[b]=arguments[b]}return this._sc_mixImpl(c,arguments[a])},equalTo:function(b,a){if(a===undefined){a=b;b=null}return this.from(b).transform(function(c,d){return c===a})},toString:function(){var c=this._fromRoot?"<%@>:%@".fmt(this._fromRoot,this._fromPropertyPath):this._fromPropertyPath;var b=this._toRoot?"<%@>:%@".fmt(this._toRoot,this._toPropertyPath):this._toPropertyPath;var a=this._oneWay?"[oneWay]":"";return"SC.Binding%@(%@ -> %@)%@".fmt(SC.guidFor(this),c,b,a)}};SC.binding=function(b,a){return SC.Binding.from(b,a)};sc_require("ext/function");SC.Error=SC.Object.extend({code:-1,message:"",errorValue:null,errorObject:function(){return this}.property().cacheable(),"throw":function(){var a=this.toString();SC.Logger.error(a);throw new Error(a)},trace:function(){return(new Error()).trace}.property().cacheable(),label:null,toString:function(){return"SC.Error:%@:%@ (%@)".fmt(SC.guidFor(this),this.get("message"),this.get("code"))},isError:YES});SC.Error.mixin({desc:function(d,a,e,c){var b={message:d};if(a!==undefined){b.label=a}if(c!==undefined){b.code=c}if(e!==undefined){b.errorValue=e}return this.create(b)},"throw":function(c,a,d,b){this.desc.apply(this,arguments).throw()}});SC.$error=function(b,a,d,e){return SC.Error.desc(b,a,d,e)};SC.throw=function(b,a,d,e){SC.Error.throw(b,a,d,e)};SC.$throw=SC.throw;SC.ok=function(a){return(a!==false)&&!(a&&a.isError)};SC.$ok=SC.ok;SC.val=function(a){if(a&&a.isError){return a.get?a.get("errorValue"):null}else{return a}};SC.$val=SC.val;SC.Error.HAS_MULTIPLE_VALUES=-100;sc_require("mixins/enumerable");sc_require("mixins/observable");sc_require("mixins/freezable");sc_require("mixins/copyable");SC.IndexSet=SC.mixin({},SC.Observable,SC.Enumerable,SC.Freezable,SC.Copyable,{_sc_sliceContent:function(e){if(e.length<1000){return e.slice()}var d=0,a=[],b=e[0];while(b!==0){a[d]=b;d=(b<0)?(0-b):b;b=e[d]}a[d]=0;this._hint(0,d,a);return a},create:function(c,b){var a=SC.beget(this);a.initObservable();a.registerDependentKey("min","[]");if(c&&c.isIndexSet){a._content=this._sc_sliceContent(c._content);a.max=c.max;a.length=c.length;a.source=c.source}else{a._content=[0];if(c!==undefined){a.add(c,b)}}return a},isIndexSet:YES,HINT_SIZE:256,length:0,max:0,min:function(){var a=this._content,b=a[0];return(b===0)?-1:(b>0)?0:Math.abs(b)}.property("[]").cacheable(),firstObject:function(){return(this.get("length")>0)?this.get("min"):undefined}.property(),rangeStartForIndex:function(c){var f=this._content,a=this.get("max"),b,e,d;if(c>=a){return a}if(Math.abs(f[c])>c){return c}d=c-(c%SC.IndexSet.HINT_SIZE);b=f[d];if(SC.none(b)){b=this._infRange}if(b<0||b>c){b=d}e=f[b];if(e===undefined){e=this.rangeStartForIndex(b)}else{e=Math.abs(e)}while(e<c){b=e;e=Math.abs(f[b])}return b},isEqual:function(c){if(c===this){return YES}if(!c||!c.isIndexSet||(c.max!==this.max)||(c.length!==this.length)){return NO}var e=this._content,b=c._content,d=0,a=e[d];do{if(b[d]!==a){return NO}d=Math.abs(a);a=e[d]}while(d!==0);return YES},indexBefore:function(b){if(b===0){return -1}b--;var c=this._content,a=this.get("max"),d=this.rangeStartForIndex(b);if(!c){return null}if(!isFinite(d)){return b}while((d===a)||(c[d]<0)){if(d===0){return -1}b=d-1;d=this.rangeStartForIndex(b)}return b},indexAfter:function(b){var d=this._content,a=this.get("max"),e,c;if(!d||(b>=a)){return -1}b++;e=this.rangeStartForIndex(b);c=d[e];while(c<0){if(c===0){return -1}b=e=Math.abs(c);c=d[e]}return b},contains:function(g,c){var b,f,a,e,d;if(c===undefined){if(g===null||g===undefined){return NO}if(typeof g===SC.T_NUMBER){c=1}else{if(g&&g.isIndexSet){if(g===this){return YES}b=g._content;f=0;a=b[f];while(a!==0){if((a>0)&&!this.contains(f,a-f)){return NO}f=Math.abs(a);a=b[f]}return YES}else{c=g.length;g=g.start}}}e=this.rangeStartForIndex(g);if(isFinite(e)){d=this._content[e];return(d>0)&&(e<=g)&&(d>=(g+c))}else{return true}},intersects:function(f,c){var b,e,a,d;if(c===undefined){if(typeof f===SC.T_NUMBER){c=1}else{if(f&&f.isIndexSet){if(f===this){return YES}b=f._content;e=0;a=b[e];while(a!==0){if((a>0)&&this.intersects(e,a-e)){return YES}e=Math.abs(a);a=b[e]}return NO}else{c=f.length;f=f.start}}}e=this.rangeStartForIndex(f);b=this._content;a=b[e];d=f+c;while(e<d){if(a===0){return NO}if((a>0)&&(a>f)){return YES}e=Math.abs(a);a=b[e]}return NO},without:function(b,a){if(b===this){return SC.IndexSet.create()}return this.clone().remove(b,a)},replace:function(b,a){if(a===undefined){if(typeof b===SC.T_NUMBER){a=1}else{if(b&&b.isIndexSet){this._content=this._sc_sliceContent(b._content);this.beginPropertyChanges().set("max",b.max).set("length",b.length).set("source",b.source).enumerableContentDidChange();this.endPropertyChanges();return this}else{a=b.length;b=b.start}}}this._content.length=1;this._content[0]=0;this.length=this.max=0;return this.add(b,a)},add:function(a,b){if(this.isFrozen){throw new Error(SC.FROZEN_ERROR)}var e,i,d;if(a&&a.isIndexSet){e=a._content;if(!e){return this}i=0;d=e[0];while(d!==0){if(d>0){this.add(i,d-i)}i=d<0?0-d:d;d=e[i]}return this}else{if(b===undefined){if(a===null||a===undefined){return this}else{if(typeof a===SC.T_NUMBER){b=1}else{b=a.length;a=a.start}}}else{if(b===null){b=1}}}if(b<=0){return this}var f=this.get("max"),c=f,h,g;e=this._content;if(a===f){if(a>0){i=this.rangeStartForIndex(a-1);d=e[i];if(d>0){delete e[f];e[i]=f=a+b;a=i}else{e[f]=f=a+b}}else{e[a]=f=b}e[f]=0;this.set("max",f);this.set("length",this.length+b);b=f-a}else{if(a>f){e[f]=0-a;e[a]=a+b;e[a+b]=0;this.set("max",a+b);this.set("length",this.length+b);b=a+b-f;a=f}else{i=this.rangeStartForIndex(a);d=e[i];f=a+b;h=0;if((a>0)&&(i===a)&&(d<=0)){i=this.rangeStartForIndex(a-1);d=e[i]}if(d<0){e[i]=0-a;if(Math.abs(d)>f){e[a]=0-f;e[f]=d}else{e[a]=d}}else{a=i;if(d>f){f=d}}i=a;while(i<f){g=e[i];if(g===0){e[f]=0;d=f;h+=f-i}else{d=Math.abs(g);if(d>f){e[f]=g;d=f}if(g<0){h+=d-i}}delete e[i];i=d}if((i=e[f])>0){delete e[f];f=i}e[a]=f;if(f>c){this.set("max",f)}this.set("length",this.get("length")+h);b=f-a}}this._hint(a,b);if(h!==0){this.enumerableContentDidChange()}return this},remove:function(a,b){if(this.isFrozen){throw new Error(SC.FROZEN_ERROR)}if(b===undefined){if(a===null||a===undefined){return this}else{if(typeof a===SC.T_NUMBER){b=1}else{if(a.isIndexSet){a.forEachRange(this.remove,this);return this}else{b=a.length;a=a.start}}}}if(b<=0){return this}var e=this.get("max"),d=this._content,i,c,h,f,g;if(a>=e){return this}i=this.rangeStartForIndex(a);c=d[i];g=a+b;h=0;if((a>0)&&(i===a)&&(c>0)){i=this.rangeStartForIndex(a-1);c=d[i]}if(c>0){d[i]=a;if(c>g){d[a]=g;d[g]=c}else{d[a]=c}}else{a=i;c=Math.abs(c);if(c>g){g=c}}if(!isFinite(c)){this._hint(i,a-i);this._infRange=g}i=a;while(i<g){f=d[i];if(f===0){d[g]=0;c=g}else{c=Math.abs(f);if(c>g){d[g]=f;c=g}if(f>0){h+=c-i}}delete d[i];i=c}if((i=d[g])<0){delete d[g];g=Math.abs(i)}if(d[g]===0){delete d[g];d[a]=0;this.set("max",a)}else{d[a]=0-g}if(isFinite(h)){this.set("length",this.get("length")-h)}else{this.set("length",0)}b=Math.min(d.length,g-a);this._hint(a,b);if(h!==0){this.enumerableContentDidChange()}return this},_hint:function(g,d,c){if(c===undefined){c=this._content}var b=SC.IndexSet.HINT_SIZE,a=Math.abs(c[g]),f=g-(g%b)+b,e=g+d;while(f<e){while((a!==0)&&(a<=f)){g=a;a=Math.abs(c[g])}if(a===0){delete c[f]}else{if(!isFinite(a)){this._infRange=g;f=Infinity}else{if(f!==g){c[f]=g}}}f+=b}},clear:function(){if(this.isFrozen){throw new Error(SC.FROZEN_ERROR)}var a=this.length;this._content.length=1;this._content[0]=0;this._infRange=null;this.set("length",0).set("max",0);if(a>0){this.enumerableContentDidChange()}},addEach:function(b){if(this.isFrozen){throw new Error(SC.FROZEN_ERROR)}this.beginPropertyChanges();var a=b.get("length");if(b.isSCArray){while(--a>=0){this.add(b.objectAt(a))}}else{if(b.isEnumerable){b.forEach(function(c){this.add(c)},this)}}this.endPropertyChanges();return this},removeEach:function(b){if(this.isFrozen){throw new Error(SC.FROZEN_ERROR)}this.beginPropertyChanges();var a=b.get("length");if(b.isSCArray){while(--a>=0){this.remove(b.objectAt(a))}}else{if(b.isEnumerable){b.forEach(function(c){this.remove(c)},this)}}this.endPropertyChanges();return this},clone:function(){return SC.IndexSet.create(this)},inspect:function(){var e=this._content,b=e.length,a=0,c=[],d;for(a=0;a<b;a++){d=e[a];if(d!==undefined){c.push("%@:%@".fmt(a,d))}}return"SC.IndexSet<%@>".fmt(c.join(" , "))},forEachRange:function(f,d){var b=this._content,e=0,a=b[e],c=this.source;if(d===undefined){d=null}while(a!==0){if(a>0){f.call(d,e,a-e,this,c)}e=Math.abs(a);a=b[e]}return this},forEachIn:function(b,c,j,f){var g=this._content,i=0,h=0,d=b+c,a=this.source,e=g[i];if(f===undefined){f=null}while(e!==0){if(i<b){i=b}while((i<e)&&(i<d)){j.call(f,i++,h++,this,a)}if(i>=d){i=e=0}else{i=Math.abs(e);e=g[i]}}return this},lengthIn:function(g,d){var a=0;if(d===undefined){if(g===null||g===undefined){return 0}else{if(typeof g===SC.T_NUMBER){d=1}else{if(g.isIndexSet){g.forEachRange(function(i,h){a+=this.lengthIn(i,h)},this);return a}else{d=g.length;g=g.start}}}}if(this.get("length")===0){return 0}var c=this._content,f=0,b=c[f],e=g+d;while(f<e&&b!==0){if(b>0){a+=(b>e)?e-f:b-f}f=Math.abs(b);b=c[f]}return a},source:null,indexOf:function(d,c){var f=this.source;if(!f){throw new Error("%@.indexOf() requires source".fmt(this))}var b=f.get("length"),e=this._content,g=e[0]<0?Math.abs(e[0]):0,a;while(g>=0&&g<b){a=f.indexOf(d,g);if(a<0){return -1}if(this.contains(a)){return a}g=a+1}return -1},lastIndexOf:function(d,c){var e=this.source;if(!e){throw new Error("%@.lastIndexOf() requires source".fmt(this))}var b=e.get("length"),f=this.max-1,a;if(f>=b){f=b-1}while(f>=0){a=e.lastIndexOf(d,f);if(a<0){return -1}if(this.contains(a)){return a}f=a+1}return -1},forEachObject:function(f,d){var c=this.source;if(!c){throw new Error("%@.forEachObject() requires source".fmt(this))}var b=this._content,e=0,a=b[e];if(d===undefined){d=null}while(a!==0){while(e<a){f.call(d,c.objectAt(e),e,c,this);e++}e=Math.abs(a);a=b[e]}return this},addObject:function(c,d){var e=this.source;if(!e){throw new Error("%@.addObject() requires source".fmt(this))}var b=e.get("length"),f=0,a;while(f>=0&&f<b){a=e.indexOf(c,f);if(a>=0){this.add(a);if(d){return this}f=a++}else{return this}}return this},addObjects:function(b,a){b.forEach(function(c){this.addObject(c,a)},this);return this},removeObject:function(c,d){var e=this.source;if(!e){throw new Error("%@.removeObject() requires source".fmt(this))}var b=e.get("length"),f=0,a;while(f>=0&&f<b){a=e.indexOf(c,f);if(a>=0){this.remove(a);if(d){return this}f=a+1}else{return this}}return this},removeObjects:function(b,a){b.forEach(function(c){this.removeObject(c,a)},this);return this},LOG_OBSERVING:NO,forEach:function(g,e){var c=this._content,f=0,a=0,d=this.source,b=c[f];if(e===undefined){e=null}while(b!==0){if(isFinite(b)){while(f<b){g.call(e,f++,a++,this,d)}f=Math.abs(b);b=c[f]}else{throw new Error("Developer Error: You may not iterate an infinite range in SC.IndexSet.")}}return this},nextObject:function(f,b,c){var e=this._content,d=c.next,a=this.get("max");if(b===null){b=d=0}else{if(b>=a){delete c.next;return null}else{b++}}if(b===d){do{b=Math.abs(d);d=e[b]}while(d<0);c.next=d}return b},toString:function(){var a=[];this.forEachRange(function(c,b){a.push(b===1?c:"%@..%@".fmt(c,c+b-1))},this);return"SC.IndexSet<%@>".fmt(a.join(","))}});SC.IndexSet.slice=SC.IndexSet.copy=SC.IndexSet.clone;SC.IndexSet.EMPTY=SC.IndexSet.create().freeze();SC.json={encode:function(a){return JSON.stringify(a)},decode:function(a){return JSON.parse(a)}};if(!this.JSON){this.JSON={}}(function(){function f(n){return n<10?"0"+n:n}if(typeof Date.prototype.toJSON!=="function"){Date.prototype.toJSON=function(key){return isFinite(this.valueOf())?this.getUTCFullYear()+"-"+f(this.getUTCMonth()+1)+"-"+f(this.getUTCDate())+"T"+f(this.getUTCHours())+":"+f(this.getUTCMinutes())+":"+f(this.getUTCSeconds())+"Z":null};String.prototype.toJSON=Number.prototype.toJSON=Boolean.prototype.toJSON=function(key){return this.valueOf()}}var cx=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,escapable=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,gap,indent,meta={"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},rep;function quote(string){escapable.lastIndex=0;return escapable.test(string)?'"'+string.replace(escapable,function(a){var c=meta[a];return typeof c==="string"?c:"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+string+'"'}function str(key,holder){var i,k,v,length,mind=gap,partial,value=holder[key];if(value&&typeof value==="object"&&typeof value.toJSON==="function"){value=value.toJSON(key)}if(typeof rep==="function"){value=rep.call(holder,key,value)}switch(typeof value){case"string":return quote(value);case"number":return isFinite(value)?String(value):"null";case"boolean":case"null":return String(value);case"object":if(!value){return"null"}gap+=indent;partial=[];if(Object.prototype.toString.apply(value)==="[object Array]"){length=value.length;for(i=0;i<length;i+=1){partial[i]=str(i,value)||"null"}v=partial.length===0?"[]":gap?"[\n"+gap+partial.join(",\n"+gap)+"\n"+mind+"]":"["+partial.join(",")+"]";gap=mind;return v}if(rep&&typeof rep==="object"){length=rep.length;for(i=0;i<length;i+=1){k=rep[i];if(typeof k==="string"){v=str(k,value);if(v){partial.push(quote(k)+(gap?": ":":")+v)}}}}else{for(k in value){if(Object.hasOwnProperty.call(value,k)){v=str(k,value);if(v){partial.push(quote(k)+(gap?": ":":")+v)}}}}v=partial.length===0?"{}":gap?"{\n"+gap+partial.join(",\n"+gap)+"\n"+mind+"}":"{"+partial.join(",")+"}";gap=mind;return v}}if(typeof JSON.stringify!=="function"){JSON.stringify=function(value,replacer,space){var i;gap="";indent="";if(typeof space==="number"){for(i=0;i<space;i+=1){indent+=" "}}else{if(typeof space==="string"){indent=space}}rep=replacer;if(replacer&&typeof replacer!=="function"&&(typeof replacer!=="object"||typeof replacer.length!=="number")){throw new Error("JSON.stringify")}return str("",{"":value})}}if(typeof JSON.parse!=="function"){JSON.parse=function(text,reviver){var j;function walk(holder,key){var k,v,value=holder[key];if(value&&typeof value==="object"){for(k in value){if(Object.hasOwnProperty.call(value,k)){v=walk(value,k);if(v!==undefined){value[k]=v}else{delete value[k]}}}}return reviver.call(holder,key,value)}text=String(text);cx.lastIndex=0;if(cx.test(text)){text=text.replace(cx,function(a){return"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)})}if(/^[\],:{}\s]*$/.test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:\s*\[)+/g,""))){j=eval("("+text+")");return typeof reviver==="function"?walk({"":j},""):j}throw new SyntaxError("JSON.parse")}}}());sc_require("ext/function");SC.LOGGER_LOG_DELIMITER=", ";SC.LOGGER_LOG_ERROR="ERROR: ";SC.LOGGER_LOG_INFO="INFO:  ";SC.LOGGER_LOG_WARN="WARN:  ";SC.LOGGER_LOG_DEBUG="DEBUG: ";SC.LOGGER_LOG_GROUP_HEADER="** %@";SC.LOGGER_LOG_GROUP_INDENTATION="    ";SC.LOGGER_RECORDED_LOG_TIMESTAMP_PREFIX="%@:  ";SC.LOGGER_LEVEL_DEBUG="debug";SC.LOGGER_LEVEL_INFO="info";SC.LOGGER_LEVEL_WARN="warn";SC.LOGGER_LEVEL_ERROR="error";SC.LOGGER_LEVEL_NONE="none";SC.Logger=SC.Object.create({messagePrefix:null,outputMessagePrefix:null,recordedMessagePrefix:null,logOutputLevel:null,logRecordingLevel:SC.LOGGER_LEVEL_NONE,recordedLogMessages:null,recordedLogMessagesMaximumLength:500,recordedLogMessagesPruningMinimumLength:100,debugEnabled:NO,exists:function(){return !SC.none(this.get("reporter"))}.property("reporter").cacheable(),fallBackOnAlert:NO,reporter:console,debug:function(a,b){SC.Logger._handleMessage(SC.LOGGER_LEVEL_DEBUG,YES,a,arguments)},debugWithoutFmt:function(){this._handleMessage(SC.LOGGER_LEVEL_DEBUG,NO,null,arguments)},debugGroup:function(a,b){SC.Logger._handleGroup(SC.LOGGER_LEVEL_DEBUG,a,arguments)},debugGroupEnd:function(){SC.Logger._handleGroupEnd(SC.LOGGER_LEVEL_DEBUG)},info:function(a,b){SC.Logger._handleMessage(SC.LOGGER_LEVEL_INFO,YES,a,arguments)},infoWithoutFmt:function(){this._handleMessage(SC.LOGGER_LEVEL_INFO,NO,null,arguments)},infoGroup:function(a,b){SC.Logger._handleGroup(SC.LOGGER_LEVEL_INFO,a,arguments)},infoGroupEnd:function(){SC.Logger._handleGroupEnd(SC.LOGGER_LEVEL_INFO)},warn:function(a,b){SC.Logger._handleMessage(SC.LOGGER_LEVEL_WARN,YES,a,arguments)},warnWithoutFmt:function(){this._handleMessage(SC.LOGGER_LEVEL_WARN,NO,null,arguments)},warnGroup:function(a,b){SC.Logger._handleGroup(SC.LOGGER_LEVEL_WARN,a,arguments)},warnGroupEnd:function(){SC.Logger._handleGroupEnd(SC.LOGGER_LEVEL_WARN)},error:function(a,b){SC.Logger._handleMessage(SC.LOGGER_LEVEL_ERROR,YES,a,arguments)},errorWithoutFmt:function(){this._handleMessage(SC.LOGGER_LEVEL_ERROR,NO,null,arguments)},errorGroup:function(a,b){SC.Logger._handleGroup(SC.LOGGER_LEVEL_ERROR,a,arguments)},errorGroupEnd:function(){SC.Logger._handleGroupEnd(SC.LOGGER_LEVEL_ERROR)},outputRecordedLogMessages:function(n){if(!this.get("exists")){return}var r=this.get("reporter"),k=this.get("recordedLogMessages"),a=0,d=SC.LOGGER_RECORDED_LOG_TIMESTAMP_PREFIX,q,o,b,c,g,h,e,f,t,m,l,p,s;if(k){for(q=0,o=k.length;q<o;++q){b=k[q];c=b.type;if(n){g=d.fmt(b.timestamp.toUTCString())}h=b.message;if(h){e=b.originalArguments;this._outputMessage(c,g,a,h,e)}else{m=b.indentation;t=b.title;l=m-a;if(r.group){if(Math.abs(l)>1){for(p=0,s=(l-1);p<s;++p){if(l>0){r.group()}else{r.groupEnd()}}}if(l>0){f=g?g:"";f+=t;r.group(f)}else{r.groupEnd()}}else{if(l>0){this._outputGroup(c,g,m-1,t)}}a=m}}}},stringifyRecordedLogMessages:function(){var j="",f=this.get("recordedLogMessages"),m=0,h=SC.LOGGER_RECORDED_LOG_TIMESTAMP_PREFIX,d=this._LOG_FALLBACK_PREFIX_MAPPING,c=SC.LOGGER_LOG_GROUP_HEADER,e,a,o,l,r,q,g,p,n,k,b;if(f){for(e=0,a=f.length;e<a;++e){o=f[e];l=o.type;g=h.fmt(o.timestamp.toUTCString());g+=d[l]||"";r=o.message;if(r){q=o.originalArguments;p=g+this._indentation(m);p+=q?this._argumentsToString(q):r}else{k=o.indentation;n=o.title;b=k-m;if(b>0){p=g+this._indentation(m)+c.fmt(n)}m=k}j+=p+"\n"}}return j},log:function(){var a=this.get("reporter"),c=arguments[0],d=this.get("messagePrefix"),e=this.get("outputMessagePrefix"),b=NO;if(c&&SC.typeOf(c)===SC.T_STRING){if(d||e){if(d){c=d+c}if(e){c=e+c}arguments[0]=c}}if(this.get("exists")){if(typeof a.log==="function"){a.log.apply(a,arguments);b=YES}else{if(a.log){a.log(this._argumentsToArray(arguments));b=YES}}}if(!b&&this.get("fallBackOnAlert")){if(this.get("exists")&&(typeof a.alert==="function")){a.alert(arguments);b=YES}else{alert(arguments);b=YES}}return b},group:function(b){var a=this.get("reporter");if(this.get("exists")&&(typeof a.group==="function")){a.group(b)}},groupEnd:function(){var a=this.get("reporter");if(this.get("exists")&&(typeof a.groupEnd==="function")){a.groupEnd()}},dir:function(){var a=this.get("reporter");if(this.get("exists")&&(typeof a.dir==="function")){a.dir.apply(a,arguments)}else{this.log.apply(this,arguments)}},dirxml:function(){var a=this.get("reporter");if(this.get("exists")&&(typeof a.dirxml==="function")){a.dirxml.apply(a,arguments)}else{this.log.apply(this,arguments)}},profile:function(b){var a=this.get("reporter");if(this.get("exists")&&(typeof a.profile==="function")){a.profile(b);return YES}return NO},profileEnd:function(b){var a=this.get("reporter");if(this.get("exists")&&(typeof a.profileEnd==="function")){a.profileEnd(b);return YES}return NO},time:function(b){var a=this.get("reporter");if(this.get("exists")&&(typeof a.time==="function")){a.time(b);return YES}return NO},timeEnd:function(b){var a=this.get("reporter");if(this.get("exists")&&(typeof a.timeEnd==="function")){a.timeEnd(b);return YES}return NO},trace:function(){var a=this.get("reporter");if(this.get("exists")&&(typeof a.trace==="function")){a.trace();return YES}return NO},init:function(){arguments.callee.base.apply(this,arguments);if(!this.get("logOutputLevel")){if(SC.buildMode==="debug"){this.set("logOutputLevel",SC.LOGGER_LEVEL_DEBUG)}else{this.set("logOutputLevel",SC.LOGGER_LEVEL_INFO)}}this.debugEnabledDidChange()},debugEnabledDidChange:function(){if(this.get("debugEnabled")){this.set("logOutputLevel",SC.LOGGER_LEVEL_DEBUG)}}.observes("debugEnabled"),_handleMessage:function(l,n,p,o){var a=this._shouldOutputType(l),d=this._shouldRecordType(l),e,f,j,k,b,m,h,c,g;if(!(a||d)){return}e=(o&&o.length>1);if(n&&(SC.none(p)||(typeof p!=="string"))){n=NO}if(n){if(e){k=[];for(f=1,j=o.length;f<j;++f){k.push(o[f])}p=p.fmt.apply(p,k)}}h=this.get("messagePrefix");if(h){p=h+p}if(a){c=this.get("outputMessagePrefix");k=n?null:o;this._outputMessage(l,null,this._outputIndentationLevel,(c?c+p:p),k)}if(d){g=this.get("recordedMessagePrefix");m={type:l,message:p?(g?g+p:p):YES,timestamp:new Date()};if(!n&&e){m.originalArguments=o}this._addRecordedMessageEntry(m)}},_handleGroup:function(l,n,q){var a=this._shouldOutputType(l),e=this._shouldRecordType(l),f,g,j,k,p,d,c,h,b,m,o;if(!(a||e)){return}f=(q&&q.length>1);if(n&&f){k=[];for(g=1,j=q.length;g<j;++g){k.push(q[g])}n=n.fmt.apply(n,k)}if(a){this._outputGroup(l,null,this._outputIndentationLevel,n);this._outputIndentationLevel++}if(e){m=++this._recordingIndentationLevel;o={type:l,indentation:m,beginGroup:YES,title:n,timestamp:new Date()};this._addRecordedMessageEntry(o)}},_handleGroupEnd:function(d){var g=this._shouldOutputType(d),c=this._shouldRecordType(d),a,f,b,e;if(!(g||c)){return}if(g){this._outputIndentationLevel--;if(this.get("exists")){a=this.get("reporter");f=a.groupEnd;if(f){f.call(a)}}}if(c){b=--this._recordingIndentationLevel;e={type:d,indentation:b,timestamp:new Date()};this._addRecordedMessageEntry(e)}},_shouldOutputType:function(a){var c=this._LOG_LEVEL_MAPPING,d=c[a]||0,b=c[this.get("logOutputLevel")]||0;return(d<=b)},_shouldRecordType:function(a){var c=this._LOG_LEVEL_MAPPING,d=c[a]||0,b=c[this.get("logRecordingLevel")]||0;return(d<=b)},_outputMessage:function(h,g,i,l,k){if(!this.get("exists")){return}var d=this.get("reporter"),b,a,c,e,f,j;a=!d.group;c=d[h];if(c){if(!k){b=g?g:"";if(a){b+=this._indentation(i)}b+=l;d[h](b)}else{f=this._argumentsToArray(k);e="";if(g){e=g}if(a){e+=this._indentation(i)}if(e){f.splice(0,0,e)}if(c.apply){c.apply(d,f)}else{d[h](f)}}}else{if(d.log){e="";if(g){e=g}e+=this._LOG_FALLBACK_PREFIX_MAPPING[h]||"";if(a){e+=this._indentation(i)}if(!k){d.log(e+l)}else{f=this._argumentsToArray(k);if(e){f.splice(0,0,e)}d.log(f)}}}},_outputGroup:function(d,f,c,g){if(!this.get("exists")){return}var b=this.get("reporter"),e=b.group,a;if(e){a=f?f:"";a+=g;e.call(b,a)}else{if(b.log){a="";if(f){a=f}a+=this._LOG_FALLBACK_PREFIX_MAPPING[d]||"";a+=this._indentation(c);a+=SC.LOGGER_LOG_GROUP_HEADER.fmt(g);b.log(a)}}},_addRecordedMessageEntry:function(c){var b=this.get("recordedLogMessages"),a;if(!b){b=[];this.set("recordedLogMessages",b)}b.push(c);a=b.length;if(a>this.get("recordedLogMessagesMaximumLength")){b.splice(0,(a-this.get("recordedLogMessagesPruningMinimumLength")))}b.enumerableContentDidChange()},_argumentsToArray:function(c){var b=[],d,a;if(c){for(d=0,a=c.length;d<a;++d){b[d]=c[d]}}return b},_argumentsToString:function(){var c="",b=SC.LOGGER_LOG_DELIMITER,d,a;for(d=0,a=(arguments.length-1);d<a;++d){c+=arguments[d]+b}c+=arguments[a];return c},_indentation:function(d){if(!d||d<0){d=0}var b="",a=SC.LOGGER_LOG_GROUP_INDENTATION,c;for(c=0;c<d;++c){b+=a}return b},_outputIndentationLevel:0,_recordingIndentationLevel:0,_LOG_LEVEL_MAPPING:{debug:4,info:3,warn:2,error:1,none:0},_LOG_FALLBACK_PREFIX_MAPPING:{debug:SC.LOGGER_LOG_DEBUG,info:SC.LOGGER_LOG_INFO,warn:SC.LOGGER_LOG_WARN,error:SC.LOGGER_LOG_ERROR}});SC.debug=SC.Logger.debug;SC.info=SC.Logger.info;SC.warn=SC.Logger.warn;SC.error=SC.Logger.error;sc_require("ext/function");sc_require("private/observer_set");SC.RunLoop=SC.Object.extend({beginRunLoop:function(){this._start=new Date().getTime();this._runLoopInProgress=YES;this._flushinvokeNextQueue();return this},isRunLoopInProgress:function(){return this._runLoopInProgress}.property(),endRunLoop:function(){this.flushAllPending();this._start=null;SC.RunLoop.lastRunLoopEnd=Date.now();this._runLoopInProgress=NO;var a=this._invokeNextQueue;if(a&&a.getMembers().length){this._invokeNextTimeout=this.scheduleRunLoop(SC.RunLoop.lastRunLoopEnd)}return this},flushAllPending:function(){var a;do{a=this.flushApplicationQueues();if(!a){a=this._flushinvokeLastQueue()}}while(a)},invokeOnce:function(b,c){if(c===undefined){c=b;b=this}var a;if(typeof c==="string"){c=b[c]}if(!this._invokeQueue){this._invokeQueue=SC.ObserverSet.create()}if(c){this._invokeQueue.add(b,c,undefined,a)}return this},invokeLast:function(b,c){if(c===undefined){c=b;b=this}var a;if(typeof c==="string"){c=b[c]}if(!this._invokeLastQueue){this._invokeLastQueue=SC.ObserverSet.create()}this._invokeLastQueue.add(b,c,undefined,a);return this},invokeNext:function(a,b){if(b===undefined){b=a;a=this}if(typeof b==="string"){b=a[b]}if(!this._invokeNextQueue){this._invokeNextQueue=SC.ObserverSet.create()}this._invokeNextQueue.add(a,b);return this},flushApplicationQueues:function(){var b=NO,a=this._invokeQueue;if(a&&a.getMembers().length){this._invokeQueue=null;b=YES;a.invokeMethods()}return SC.Binding.flushPendingChanges()||b},_flushinvokeLastQueue:function(){var a=this._invokeLastQueue,b=NO;if(a&&a.getMembers().length){this._invokeLastQueue=null;b=YES;if(b){a.invokeMethods()}}return b},_flushinvokeNextQueue:function(){var a=this._invokeNextQueue,b=NO;if(a&&a.getMembers().length){this._invokeNextQueue=null;b=YES;if(b){a.invokeMethods()}}return b},scheduleRunLoop:function(b){if(this._timeoutAt==null||this._timeoutAt>b){if(this._timeout){clearTimeout(this._timeout)}var a=Math.max(0,b-Date.now());this._timeout=setTimeout(this._timeoutDidFire,a);this._timeoutAt=b}return this._timeout},_timeoutDidFire:function(){var a=SC.RunLoop.currentRunLoop;a._timeout=a._timeoutAt=a._invokeNextTimeout=null;SC.run()},unscheduleRunLoop:function(){if(!this._invokeNextTimeout){clearTimeout(this._timeout);this._timeout=this._timeoutAt=null}}});SC.RunLoop.currentRunLoop=null;SC.RunLoop.runLoopClass=SC.RunLoop;SC.RunLoop.begin=function(){var a=this.currentRunLoop;if(!a){a=this.currentRunLoop=this.runLoopClass.create()}a.beginRunLoop();return this};SC.RunLoop.end=function(){var a=this.currentRunLoop;if(!a){throw new Error("SC.RunLoop.end() called outside of a runloop!")}a.endRunLoop();return this};SC.RunLoop.kill=function(){this.currentRunLoop=this.runLoopClass.create();return this};SC.RunLoop.isRunLoopInProgress=function(){if(this.currentRunLoop){return this.currentRunLoop.get("isRunLoopInProgress")}return NO};SC.run=function(g,f,b){var a=SC.RunLoop.isRunLoopInProgress();if(SC.ExceptionHandler&&SC.ExceptionHandler.enabled){try{if(b||!a){SC.RunLoop.begin()}if(g){g.call(f)}if(b||!a){SC.RunLoop.end()}}catch(d){var c=SC.ExceptionHandler.handleException(d);if(!c&&!SC.browser.isIE){throw d}}}else{if(b||!a){SC.RunLoop.begin()}if(g){g.call(f)}if(b||!a){SC.RunLoop.end()}}};SC.RunLoop.wrapFunction=function(b){var a=function(){var c=SC.RunLoop.isRunLoopInProgress();if(!c){SC.RunLoop.begin()}var d=arguments.callee.wrapped.apply(this,arguments);if(!c){SC.RunLoop.end()}return d};a.wrapped=b;return a};SC.DROP_ON=1;SC.DROP_BEFORE=2;SC.DROP_AFTER=4;SC.DROP_ANY=7;SC.ALIGN_LEFT="left";SC.ALIGN_RIGHT="right";SC.ALIGN_CENTER="center";SC.ALIGN_TOP="top";SC.ALIGN_MIDDLE="middle";SC.ALIGN_BOTTOM="bottom";SC.ALIGN_TOP_LEFT="top-left";SC.ALIGN_TOP_RIGHT="top-right";SC.ALIGN_BOTTOM_LEFT="bottom-left";SC.ALIGN_BOTTOM_RIGHT="bottom-right";SC.ALIGN_DEFAULT="default";SC.POSITION_RIGHT=0;SC.POSITION_LEFT=1;SC.POSITION_TOP=2;SC.POSITION_BOTTOM=3;SC.mixin({data:$.data,removeData:$.removeData,STRINGS:{},stringsFor:function(b,a){SC.mixin(SC.STRINGS,a);return this},viewFor:function(d){var c=SC.View.views,b=c[d.getAttribute("id")];if(!b){var a;while(!b&&(a=d.parentNode)&&(a!==document)){var e;if((e=a.getAttribute("id"))){b=c[e]}d=a}d=a=null}return b||null}});SC.mixin(SC.browser,{_cachedNames:null,_testEl:null,_testSupportFor:function(e,b,d){var c=e[b]!=null,a;if(d!=null){a=e[b];e[b]=d;c=e[b]===d;e[b]=a}return c},compare:function(c,a){var f,g,e;if(typeof c==="number"||typeof a==="number"){c=String(c);a=String(a)}f=function(h){return Number(h.match(/^[0-9]+/))};g=SC.A(c.split(".")).map(f);e=SC.A(a.split(".")).map(f);for(var d=0;d<e.length;d++){var b=g[d]-e[d];if(isNaN(b)){return 0}if(b!==0){return b}}return 0},experimentalNameFor:function(d,b,c){var a=b;if(!this._testSupportFor(d,a,c)){a=SC.browser.classPrefix+b.capitalize();if(!this._testSupportFor(d,a,c)){if(SC.browser.domPrefix===SC.browser.classPrefix){SC.warn("SC.browser.experimentalNameFor(): target, %@, does not have property `%@` or `%@`.".fmt(d,b,a));a=SC.UNSUPPORTED}else{a=SC.browser.domPrefix+b.capitalize();if(!this._testSupportFor(d,a,c)){SC.warn("SC.browser.experimentalNameFor(): target, %@, does not have property `%@`, '%@' or `%@`.".fmt(d,b,SC.browser.classPrefix+b.capitalize(),a));a=SC.UNSUPPORTED}}}}return a},experimentalStyleNameFor:function(c,e){var d=this._sc_experimentalStyleNames,a;if(!d){d=this._sc_experimentalStyleNames={}}if(d[c]){a=d[c]}else{var b=this._testEl;if(!b){b=this._testEl=document.createElement("div")}a=d[c]=this.experimentalNameFor(b.style,c,e)}return a},experimentalCSSNameFor:function(a,e){var b=a,d=a.camelize(),c=this.experimentalStyleNameFor(d,e);if(c===SC.UNSUPPORTED){b=SC.UNSUPPORTED}else{if(c!==d){b=SC.browser.cssPrefix+a}}return b}});SC.Builder=function(a){return SC.Builder.create(a)};SC.Builder.create=function create(c){var b=SC.mixin(SC.beget(this.fn),c||{});if(c.hasOwnProperty("toString")){b.toString=c.toString}var a=function(){var d=SC.beget(b);d.defaultClass=this;d.constructor=a;return d.init.apply(d,arguments)};a.fn=a.prototype=b;a.extend=SC.Builder.create;a.mixin=SC.Builder.mixin;return a};SC.Builder.mixin=function(){var b=arguments.length,a;for(a=0;a<b;a++){SC.mixin(this,arguments[a])}return this};SC.Builder.fn={init:function(a){if(a!==undefined){if(SC.typeOf(a)===SC.T_ARRAY){var b=a.length;while(--b>=0){this[b]=a.objectAt?a.objectAt(b):a[b]}this.length=a.length}else{this[0]=a;this.length=1}}return this},size:function(){return this.length},pushStack:function(){var a=this.constructor.apply(this,arguments);a.prevObject=this;return a},end:function(){return this.prevObject||this.constructor()},toString:function(){return"%@$(%@)".fmt(this.defaultClass.toString(),SC.A(this).invoke("toString").join(","))},mixin:SC.Builder.mixin};(function(){var a=SC.Enumerable,c=SC.Builder.fn,b,d;for(b in a){if(!a.hasOwnProperty(b)){continue}d=Array.prototype[b]||a[b];c[b]=d}})();sc_require("system/builder");SC.$=SC.CoreQuery=jQuery;SC.mixin(SC.$.fn,{isCoreQuery:YES,toString:function(){var c=[],b=this.length,a=0;for(a=0;a<b;a++){c[a]="%@: %@".fmt(a,this[a]?this[a].toString():"(null)")}return"<$:%@>(%@)".fmt(SC.guidFor(this),c.join(" , "))},isVisible:function(){return Array.prototype.every.call(this,function(a){return SC.$.isVisible(a)})},view:function(){return SC.viewFor(this[0])},within:function(a){if(this.filter(a).length){return true}return !!this.has(a).length}});(function(){var c={},f={find:function(h,g){return(g!==undefined)?SC.Enumerable.find.call(this,h,g):c.find.call(this,h)},filter:function(h,g){return(g!==undefined)?this.pushStack(SC.Enumerable.filter.call(this,h,g)):c.filter.call(this,h)},filterProperty:function(g,h){return this.pushStack(SC.Enumerable.filterProperty.call(this,g,h))},indexOf:SC.$.index,map:function(h,g){return(g!==undefined)?SC.Enumerable.map.call(this,h,g):c.map.call(this,h)}};var d=SC.$.fn,a=SC.Enumerable,e;for(var b in a){if(a.hasOwnProperty(b)){e=a[b];if(b in f){c[b]=d[b];e=f[b]}d[b]=e}}})();SC.mixin(SC.$,{isVisible:function(a){var b=SC.$;return("hidden"!=a.type)&&(b.css(a,"display")!="none")&&(b.css(a,"visibility")!="hidden")}});sc_require("system/core_query");SC.Event=function(a){this._sc_updateNormalizedEvent(a);return this};SC.mixin(SC.Event,{MOUSE_WHEEL_MULTIPLIER:function(){var b=1,a=SC.browser.engineVersion;if(SC.browser.name===SC.BROWSER.safari){b=0.4;if(SC.browser.compare(a,"533.17")>0&&SC.browser.compare(a,"534")<0){b=0.004}else{if(SC.browser.compare(a,"533")<0){b=40}}}else{if(SC.browser.name===SC.BROWSER.ie){b=0.3}else{if(SC.browser.name===SC.BROWSER.chrome){b=0.4}}}return b}(),MOUSE_WHEEL_DELTA_LIMIT:1000,_MOUSE_WHEEL_LIMIT_INVALIDATED:NO,create:function(a){return new SC.Event(a)},add:function(f,e,g,h,d,a){if(f&&f.isCoreQuery){if(f.length>0){f.forEach(function(i){this.add(i,e,g,h,d)},this);return this}else{f=f[0]}}if(!f){return this}if(!a){a=NO}if(f.nodeType===3||f.nodeType===8){return SC.Event}if(SC.browser.name===SC.BROWSER.ie&&f.setInterval){f=window}if(SC.typeOf(g)===SC.T_FUNCTION){d=h;h=g;g=null}else{if(g&&SC.typeOf(h)===SC.T_STRING){h=g[h]}}var c=SC.data(f,"sc_events")||SC.data(f,"sc_events",{}),b=c[e];if(!b){b=c[e]={};this._addEventListener(f,e,a)}b[SC.hashFor(g,h)]=[g,h,d];SC.Event._global[e]=YES;f=c=b=null;return this},remove:function(c,b,f,a){if(c&&c.isCoreQuery){if(c.length>0){c.forEach(function(j){this.remove(j,b,f,a)},this);return this}else{c=c[0]}}if(!c){return this}if(c.nodeType===3||c.nodeType===8){return SC.Event}var d,g,i=SC.data(c,"sc_events");if(!i){return this}if(b===undefined){for(var h in i){this.remove(c,h)}}else{if((d=i[b])){var e=NO;if(f||a){if(SC.typeOf(f)===SC.T_FUNCTION){a=f;f=null}else{if(SC.typeOf(a)===SC.T_STRING){a=f[a]}}delete d[SC.hashFor(f,a)];g=null;for(g in d){break}if(g===null){e=YES}}else{e=YES}if(e){delete i[b];this._removeEventListener(c,b)}g=null;for(g in i){break}if(!g){SC.removeData(c,"sc_events");delete this._elements[SC.guidFor(c)];SC.removeData(c,"listener")}}}c=i=d=null;return this},NO_BUBBLE:["blur","focus","change"],simulateEvent:function(d,c,b){var a=SC.Event.create({type:c,target:d,preventDefault:function(){this.cancelled=YES},stopPropagation:function(){this.bubbles=NO},allowDefault:function(){this.hasCustomEventHandling=YES},timeStamp:Date.now(),bubbles:(this.NO_BUBBLE.indexOf(c)<0),cancelled:NO,normalized:YES,simulated:true});if(b){SC.mixin(a,b)}return a},trigger:function(c,b,a,i){if(c&&c.isCoreQuery){if(c.length>0){c.forEach(function(l){this.trigger(l,b,a,i)},this);return this}else{c=c[0]}}if(!c){return this}if(c.nodeType===3||c.nodeType===8){return undefined}if(SC.typeOf(a)===SC.T_ARRAY){a=a[0]}var h,j=SC.typeOf(c[b]||null)===SC.T_FUNCTION,g,d,k;if(!a||!a.preventDefault){a=this.simulateEvent(c,b)}a.type=b;g=c;do{h=SC.Event.handle.call(g,a);g=(g===document)?null:(g.parentNode||document)}while(!h&&a.bubbles&&g);g=null;d=c["on"+b];k=SC.$.nodeName(c,"a")&&b==="click";if((!j||k)&&d&&d.call(c,a)===NO){h=NO}if(j&&i!==NO&&h!==NO&&!k){this.triggered=YES;try{c[b]()}catch(f){}}this.triggered=NO;return h},handle:function(e){if((typeof SC==="undefined")||SC.Event.triggered){return true}var g,b,a,h,f;a=(SC.data(this,"sc_events")||{})[e.type];if(!a){g=false}else{e=SC.Event.normalizeEvent(e||window.event);for(var c in a){var d=a[c];h=d[1];e.handler=h;e.data=e.context=d[2];f=d[0]||this;b=h.call(f,e);if(g!==false){g=b}if(b===false){e.preventDefault();e.stopPropagation()}}if(e.originalEvent&&!e.originalEvent.simulated){e._sc_clearNormalizedEvent()}}return g},unload:function(){var a,b=this._elements;for(a in b){this.remove(b[a])}for(a in b){delete b[a]}delete this._elements},special:{ready:{setup:function(){SC._bindReady();return},teardown:function(){return}},mouseenter:{setup:function(){if(SC.browser.name===SC.BROWSER.ie){return NO}SC.Event.add(this,"mouseover",SC.Event.special.mouseenter.handler);return YES},teardown:function(){if(SC.browser.name===SC.BROWSER.ie){return NO}SC.Event.remove(this,"mouseover",SC.Event.special.mouseenter.handler);return YES},handler:function(a){if(SC.Event._withinElement(a,this)){return YES}a.type="mouseenter";return SC.Event.handle.call(this,a)}},mouseleave:{setup:function(){if(SC.browser.name===SC.BROWSER.ie){return NO}SC.Event.add(this,"mouseout",SC.Event.special.mouseleave.handler);return YES},teardown:function(){if(SC.browser.name===SC.BROWSER.ie){return NO}SC.Event.remove(this,"mouseout",SC.Event.special.mouseleave.handler);return YES},handler:function(a){if(SC.Event._withinElement(a,this)){return YES}a.type="mouseleave";return SC.Event.handle.call(this,a)}}},KEY_BACKSPACE:8,KEY_TAB:9,KEY_RETURN:13,KEY_ESC:27,KEY_SPACE:32,KEY_LEFT:37,KEY_UP:38,KEY_RIGHT:39,KEY_DOWN:40,KEY_DELETE:46,KEY_HOME:36,KEY_END:35,KEY_PAGEUP:33,KEY_PAGEDOWN:34,KEY_INSERT:45,_withinElement:function(d,c){var b=d.relatedTarget;while(b&&b!==c){try{b=b.parentNode}catch(a){b=c}}return b===c},_addEventListener:function(f,d,a){var g,c=this.special[d];if(!a){a=false}if(!c||c.setup.call(f)===false){var b=SC.guidFor(f);this._elements[b]=f;g=SC.data(f,"listener")||SC.data(f,"listener",function e(h){return SC.Event.handle.call(SC.Event._elements[b],h)});if(f.addEventListener){f.addEventListener(d,g,a)}else{if(f.attachEvent){f.attachEvent("on"+d,g)}}}f=c=g=null},_removeEventListener:function(c,b){var d,a=SC.Event.special[b];if(!a||(a.teardown.call(c)===NO)){d=SC.data(c,"listener");if(d){if(c.removeEventListener){c.removeEventListener(b,d,NO)}else{if(c.detachEvent){c.detachEvent("on"+b,d)}}}}c=a=d=null},_elements:{},_sc_normalizedEvents:null,normalizeEvent:function(b){var a;if(!this._sc_normalizedEvents){this._sc_normalizedEvents={}}a=this._sc_normalizedEvents[b.type];if(!a){if(b===window.event){a=SC.Event.create(b)}else{a=b.normalized?b:SC.Event.create(b)}}else{if(b.normalized){a=b}else{a._sc_updateNormalizedEvent(b)}}this._sc_normalizedEvents[b.type]=a;return a},_global:{},_props:["altKey","attrChange","attrName","bubbles","button","cancelable","charCode","clientX","clientY","ctrlKey","currentTarget","data","detail","fromElement","handler","keyCode","metaKey","newValue","originalTarget","pageX","pageY","prevValue","relatedNode","relatedTarget","screenX","screenY","shiftKey","srcElement","target","timeStamp","toElement","type","view","which","touches","targetTouches","changedTouches","animationName","elapsedTime","dataTransfer"]});SC.Event.prototype={hasCustomEventHandling:false,_sc_clearNormalizedEvent:function(){this.originalEvent=null;this.hasCustomEventHandling=false;this.normalized=false;var c=SC.Event._props,a;a=c.length;while(--a>=0){var b=c[a];this[b]=null}this.timeStamp=null;this.target=null;this.relatedTarget=null;this.pageX=null;this.pageY=null;this.which=null;this.metaKey=null;this.wheelDelta=null;this.wheelDeltaY=null;this.wheelDeltaX=null},_sc_updateNormalizedEvent:function(d){var c,b;this.normalized=true;if(d){this.originalEvent=d;var g=SC.Event._props,f;b=g.length;c=b;while(--c>=0){f=g[c];this[f]=d[f]}}this.timeStamp=this.timeStamp||Date.now();if(!this.target){this.target=this.srcElement||document}if(this.target.nodeType===3){this.target=this.target.parentNode}if(!this.relatedTarget&&this.fromElement){this.relatedTarget=(this.fromElement===this.target)?this.toElement:this.fromElement}if(SC.none(this.pageX)&&!SC.none(this.clientX)){var h=document.documentElement,a=document.body;this.pageX=this.clientX+(h&&h.scrollLeft||a&&a.scrollLeft||0)-(h.clientLeft||0);this.pageY=this.clientY+(h&&h.scrollTop||a&&a.scrollTop||0)-(h.clientTop||0)}if(!this.which&&((this.charCode||d.charCode===0)?this.charCode:this.keyCode)){this.which=this.charCode||this.keyCode}if(!this.metaKey&&this.ctrlKey){this.metaKey=this.ctrlKey}if(!this.which&&this.button){this.which=((this.button&1)?1:((this.button&2)?3:((this.button&4)?2:0)))}if(this.type==="mousewheel"||this.type==="DOMMouseScroll"||this.type==="MozMousePixelScroll"){var e=SC.Event.MOUSE_WHEEL_MULTIPLIER;if(SC.browser.isWebkit&&d.wheelDelta!==undefined){this.wheelDelta=0-(d.wheelDeltaY||d.wheelDeltaX);this.wheelDeltaY=0-(d.wheelDeltaY||0);this.wheelDeltaX=0-(d.wheelDeltaX||0)}else{if(!SC.none(d.detail)&&SC.browser.isMozilla){if(d.axis&&(d.axis===d.HORIZONTAL_AXIS)){this.wheelDeltaX=d.detail;this.wheelDelta=this.wheelDeltaY=0}else{this.wheelDelta=this.wheelDeltaY=d.detail;this.wheelDeltaX=0}}else{this.wheelDelta=this.wheelDeltaY=SC.browser.isIE||SC.browser.isOpera?0-d.wheelDelta:d.wheelDelta;this.wheelDeltaX=0}}this.wheelDelta*=e;this.wheelDeltaX*=e;this.wheelDeltaY*=e}},touchesForView:function(a){if(this.touchContext){return this.touchContext.touchesForView(a)}},touchesForResponder:function(a){if(this.touchContext){return this.touchContext.touchesForView(a)}},averagedTouchesForView:function(a){if(this.touchContext){return this.touchContext.averagedTouchesForView(a)}return null},allowDefault:function(){this.hasCustomEventHandling=YES;return this},preventDefault:function(){var a=this.originalEvent;if(a){if(a.preventDefault){a.preventDefault()}else{a.returnValue=NO}}this.hasCustomEventHandling=YES;return this},stopPropagation:function(){var a=this.originalEvent;if(a){if(a.stopPropagation){a.stopPropagation()}a.cancelBubble=YES}this.hasCustomEventHandling=YES;return this},stop:function(){return this.preventDefault().stopPropagation()},normalized:YES,getCharString:function(){if(SC.browser.name===SC.BROWSER.ie&&SC.browser.compare(SC.browser.version,"9.0")<0){if(this.keyCode===8||this.keyCode===9||(this.keyCode>=37&&this.keyCode<=40)){return String.fromCharCode(0)}else{return(this.keyCode>0)?String.fromCharCode(this.keyCode):null}}else{return(this.charCode>0)?String.fromCharCode(this.charCode):null}},commandCodes:function(){var b=this.charCode,f=this.keyCode,a=null,e=null,d;if(f&&f!==b){e=SC.FUNCTION_KEYS[f]}if(e){d=e}else{d=SC.PRINTABLE_KEYS[f]}if(d){var c="";if(this.ctrlKey||this.metaKey){c+="ctrl_"}if(this.altKey){c+="alt_"}if(this.shiftKey){c+="shift_"}e=c+d}a=this.getCharString();return[e,a]}};SC.Event.observe=SC.Event.add;SC.Event.stopObserving=SC.Event.remove;SC.Event.fire=SC.Event.trigger;if(SC.browser.name===SC.BROWSER.ie){SC.Event.add(window,"unload",SC.Event.prototype,SC.Event.unload)}SC.MODIFIER_KEYS={16:"shift",17:"ctrl",18:"alt"};SC.FUNCTION_KEYS={8:"backspace",9:"tab",13:"return",19:"pause",27:"escape",33:"pageup",34:"pagedown",35:"end",36:"home",37:"left",38:"up",39:"right",40:"down",44:"printscreen",45:"insert",46:"delete",112:"f1",113:"f2",114:"f3",115:"f4",116:"f5",117:"f7",119:"f8",120:"f9",121:"f10",122:"f11",123:"f12",144:"numlock",145:"scrolllock"};SC.PRINTABLE_KEYS={32:" ",48:"0",49:"1",50:"2",51:"3",52:"4",53:"5",54:"6",55:"7",56:"8",57:"9",59:";",61:"=",65:"a",66:"b",67:"c",68:"d",69:"e",70:"f",71:"g",72:"h",73:"i",74:"j",75:"k",76:"l",77:"m",78:"n",79:"o",80:"p",81:"q",82:"r",83:"s",84:"t",85:"u",86:"v",87:"w",88:"x",89:"y",90:"z",107:"+",109:"-",110:".",188:",",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:'"'};SC.SYSTEM_CURSOR=SC.DEFAULT_CURSOR="default";SC.AUTO_CURSOR="auto";SC.CROSSHAIR_CURSOR="crosshair";SC.HAND_CURSOR=SC.POINTER_CURSOR="pointer";SC.MOVE_CURSOR="move";SC.E_RESIZE_CURSOR="e-resize";SC.NE_RESIZE_CURSOR="ne-resize";SC.NW_RESIZE_CURSOR="nw-resize";SC.N_RESIZE_CURSOR="n-resize";SC.SE_RESIZE_CURSOR="se-resize";SC.SW_RESIZE_CURSOR="sw-resize";SC.S_RESIZE_CURSOR="s-resize";SC.W_RESIZE_CURSOR="w-resize";SC.IBEAM_CURSOR=SC.TEXT_CURSOR="text";SC.WAIT_CURSOR="wait";SC.HELP_CURSOR="help";SC.Cursor=SC.Object.extend({init:function(){arguments.callee.base.apply(this,arguments);var a=this.get("cursorStyle")||SC.DEFAULT_CURSOR,c=this.constructor.sharedStyleSheet(),b=SC.guidFor(this);if(c.insertRule){c.insertRule("."+b+" {cursor: "+a+";}",c.cssRules?c.cssRules.length:0)}else{if(c.addRule){c.addRule("."+b,"cursor: "+a)}}this.cursorStyle=a;this.className=b;return this},className:null,cursorStyle:SC.DEFAULT_CURSOR,cursorStyleDidChange:function(){var d,f,c,e,g,b,a;d=this.get("cursorStyle")||SC.DEFAULT_CURSOR;f=this._rule;if(f){f.style.cursor=d;return}c="."+this.get("className");e=this.constructor.sharedStyleSheet();g=(e.cssRules?e.cssRules:e.rules)||[];for(b=0,a=g.length;b<a;++b){f=g[b];if(f.selectorText===c){this._rule=f;f.style.cursor=d;break}}}.observes("cursorStyle")});SC.Cursor.sharedStyleSheet=function(){var d,c,b=this._styleSheet;if(!b){d=document.createElement("style");c=document.getElementsByTagName("head")[0];if(!c){c=document.documentElement}c.appendChild(d);for(var a=document.styleSheets.length-1;a>=0;a--){b=document.styleSheets[a];if(b.ownerNode===d){this._styleSheet=b;break}}}return b};SC.Responder=SC.Object.extend({isResponder:YES,pane:null,responderContext:null,nextResponder:null,isFirstResponder:NO,hasFirstResponder:NO,acceptsFirstResponder:YES,becomingFirstResponder:NO,becomeFirstResponder:function(){var a=this.get("pane")||this.get("responderContext")||this.pane();if(a&&this.get("acceptsFirstResponder")){if(a.get("firstResponder")!==this){a.makeFirstResponder(this)}}return this},resignFirstResponder:function(a){var b=this.get("pane")||this.get("responderContext");if(b&&(b.get("firstResponder")===this)){b.makeFirstResponder(null,a)}return YES},willLoseFirstResponder:function(a){},didBecomeFirstResponder:function(a){},destroy:function(){this.resignFirstResponder();arguments.callee.base.apply(this,arguments)}});SC.Theme={isTheme:YES,classNames:[],_extend_class_names:function(c){if(c){if(SC.typeOf(c)===SC.T_HASH&&!c.isSet){for(var b in c){var a=this.classNames.indexOf(b);if(c[b]&&a<0){this.classNames.push(b)}else{if(a>=0){this.classNames.removeAt(a)}}}}else{if(typeof c==="string"){c=c.split(" ")}c.forEach(function(d){if(!this.classNames.contains(d)){this.classNames.push(d)}},this)}}},_extend_self:function(b){if(b.classNames){this._extend_class_names(b.classNames)}var a,c,d;for(a in b){if(a==="classNames"){continue}if(!b.hasOwnProperty(a)){continue}c=b[a];if(c instanceof Function&&!c.base&&(c!==(d=this[a]))){c.base=d}this[a]=c}},create:function(){var c=SC.beget(this);c.baseTheme=this;if(this.themes===SC.Theme.themes){c.themes={}}else{c.themes=SC.beget(this.themes)}c._privateThemes={};c._specializedThemes={};c.classNames=SC.clone(this.classNames);var e=arguments,b=e.length,a,d;for(a=0;a<b;a++){c._extend_self(e[a])}if(c.name&&!c.classNames.contains(c.name)){c.classNames.push(c.name)}return c},subtheme:function(a){var b=this.create({name:a});this.addTheme(b);return b},invisibleSubtheme:function(a){var b=this.create({name:a});this._privateThemes[a]=b;return b},themes:{},find:function(a){if(this===SC.Theme){return this.themes[a]}var b;b=this._privateThemes[a];if(b){return b}b=this._specializedThemes[a];if(b){return b}b=this.themes[a];if(b&&!this._specializedThemes[a]){return(this._specializedThemes[a]=b.create({classNames:this.classNames}))}b=SC.Theme.themes[a];if(b){return b}return null},addTheme:function(a){this.themes[a.name]=a}};SC.BaseTheme=SC.Theme.create({name:""});SC.Theme.themes["sc-base"]=SC.BaseTheme;SC.defaultTheme="sc-base";SC.Locale=SC.Object.extend({init:function(){if(!this.language){SC.Locale._assignLocales()}if(!this.hasStrings){var c=this._deprecatedLanguageCodes||[];c.push(this.language);var b=c.length;var a=null;while(!a&&--b>=0){a=String[c[b]]}if(a){this.hasStrings=YES;this.strings=a}}},hasStrings:NO,strings:{},metrics:{},inflectionConstants:null,ordinalForNumber:function(a){return""},toString:function(){if(!this.language){SC.Locale._assignLocales()}return"SC.Locale["+this.language+"]"+SC.guidFor(this)},locWithDefault:function(b,c){var a=this.strings[b];if(SC.typeOf(a)===SC.T_STRING){return a}else{if(SC.typeOf(c)===SC.T_STRING){return c}}return b},locMetric:function(b){var a=this.metrics[b];if(SC.typeOf(a)===SC.T_NUMBER){return a}else{if(a===undefined){SC.warn('No localized metric found for key "'+b+'"');return undefined}else{SC.warn('Unexpected metric type for key "'+b+'"');return undefined}}},locLayout:function(c,b){var e,g,f,m,l,a=SC.Locale.layoutKeys,k=this.metrics,j=SC.typeOf,d=SC.T_NUMBER,h={};if(b){SC.mixin(h,b)}for(e=0,g=a.length;e<g;++e){f=a[e];m=c+"."+f;l=k[m];if(j(l)===d){if(b&&b[f]){throw new Error("locLayout():  There is a localized value for the key '"+m+"' but a value for '"+f+"' was also specified in the non-localized hash")}h[f]=l}}return h}});SC.Locale.mixin({useAutodetectedLanguage:NO,preferredLanguage:null,layoutKeys:["left","top","right","bottom","width","height","minWidth","minHeight","centerX","centerY"],createCurrentLocale:function(){var c=(String.useAutodetectedLanguage!==undefined)?String.useAutodetectedLanguage:this.useAutodetectedLanguage;var b=(String.preferredLanguage!==undefined)?String.preferredLanguage:this.preferredLanguage;var d=((c)?SC.browser.language:null)||b||SC.browser.language||"en";d=SC.Locale.normalizeLanguage(d);var a=this.localeClassFor(d);if(d!=this.currentLanguage){this.currentLanguage=d;this.currentLocale=a.create()}return this.currentLocale},localeClassFor:function(c){c=SC.Locale.normalizeLanguage(c);var b,a=this.locales[c];if(!a&&((b=c.split("-")[0])!==c)&&(a=this.locales[b])){a=this.locales[c]=a.extend()}if(!a){a=this.locales[c]=this.locales.en.extend()}return a},define:function(b,c){var a;if(c===undefined&&(SC.typeOf(b)!==SC.T_STRING)){a=this;c=b}else{a=SC.Locale.localeClassFor(b)}SC.mixin(a.prototype,c);return a},options:function(){return this.prototype},addHashes:function(a,c){var b=this.prototype[a];if(b){if(!this.prototype.hasOwnProperty(b)){b=this.prototype[a]=SC.clone(b)}}else{b=this.prototype[a]={}}if(c){this.prototype[a]=SC.mixin(b,c)}return this},addMethod:function(a,b){this.prototype[a]=b;return this},addStrings:function(a){var b=this.addHashes("strings",a);this.prototype.hasStrings=YES;return b},addMetrics:function(a){return this.addHashes("metrics",a)},_map:{english:"en",french:"fr",german:"de",japanese:"ja",jp:"ja",spanish:"es"},normalizeLanguage:function(a){if(!a){return"en"}return SC.Locale._map[a.toLowerCase()]||a},_assignLocales:function(){for(var a in this.locales){this.locales[a].prototype.language=a}},toString:function(){if(!this.prototype.language){SC.Locale._assignLocales()}return"SC.Locale["+this.prototype.language+"]"},extend:function(){var a=SC.Object.extend.apply(this,arguments);a.addStrings=SC.Locale.addStrings;a.define=SC.Locale.define;a.options=SC.Locale.options;a.toString=SC.Locale.toString;return a}});SC.Locale.locales={en:SC.Locale.extend({_deprecatedLanguageCodes:["English"]}),fr:SC.Locale.extend({_deprecatedLanguageCodes:["French"]}),de:SC.Locale.extend({_deprecatedLanguageCodes:["German"]}),ja:SC.Locale.extend({_deprecatedLanguageCodes:["Japanese","jp"]}),es:SC.Locale.extend({_deprecatedLanguageCodes:["Spanish"]})};SC.hashesForLocale=function(d,b,c){var a=SC.Locale.localeClassFor(d);a.addHashes(b,c)};SC.methodForLocale=function(c,b,d){var a=SC.Locale.localeClassFor(c);a.addMethod(b,d)};SC.stringsFor=function(c,b){var a=SC.Locale.localeClassFor(c);a.addStrings(b);return this};SC.metricsFor=function(c,b){var a=SC.Locale.localeClassFor(c);a.addMetrics(b);return this};sc_require("system/locale");SC.STRING_TITLEIZE_REGEXP=(/([\s|\-|\_|\n])([^\s|\-|\_|\n]?)/g);SC.STRING_DECAMELIZE_REGEXP=(/([a-z])([A-Z])/g);SC.STRING_DASHERIZE_REGEXP=(/[ _]/g);SC.STRING_DASHERIZE_CACHE={};SC.STRING_TRIM_LEFT_REGEXP=(/^\s+/g);SC.STRING_TRIM_RIGHT_REGEXP=(/\s+$/g);SC.STRING_CSS_ESCAPED_REGEXP=(/(:|\.|\[|\])/g);SC.mixin(SC.String,{capitalize:function(a){return a.charAt(0).toUpperCase()+a.slice(1)},camelize:function(d){var b=d.replace(SC.STRING_TITLEIZE_REGEXP,function(f,g,e){return e?e.toUpperCase():""});var c=b.charAt(0),a=c.toLowerCase();return c!==a?a+b.slice(1):b},decamelize:function(a){return a.replace(SC.STRING_DECAMELIZE_REGEXP,"$1_$2").toLowerCase()},dasherize:function(c){var a=SC.STRING_DASHERIZE_CACHE,b=a[c];if(b){return b}else{b=SC.String.decamelize(c).replace(SC.STRING_DASHERIZE_REGEXP,"-");a[c]=b}return b},escapeCssIdForSelector:function(a){return a.replace(SC.STRING_CSS_ESCAPED_REGEXP,"\\$1")},loc:function(d){if(!SC.Locale.currentLocale){SC.Locale.createCurrentLocale()}var b=SC.Locale.currentLocale.locWithDefault(d);if(SC.typeOf(b)!==SC.T_STRING){b=d}var a=SC.$A(arguments);a.shift();if(a.length>0&&a[0]&&a[0].isSCArray){a=a[0]}try{return SC.String.fmt(b,a)}catch(c){SC.error("Error processing string with key: "+d);SC.error("Localized String: "+b);SC.error("Error: "+c)}},locMetric:function(b){var a=SC.Locale,c=a.currentLocale;if(!c){a.createCurrentLocale();c=a.currentLocale}return c.locMetric(b)},locLayout:function(b,c){var a=SC.Locale,d=a.currentLocale;if(!d){a.createCurrentLocale();d=a.currentLocale}return d.locLayout(b,c)},locWithDefault:function(d,c){if(!SC.Locale.currentLocale){SC.Locale.createCurrentLocale()}var b=SC.Locale.currentLocale.locWithDefault(d,c);if(SC.typeOf(b)!==SC.T_STRING){b=d}var a=SC.$A(arguments);a.shift();a.shift();return SC.String.fmt(b,a)},trim:jQuery.trim,trimLeft:function(a){return a.replace(SC.STRING_TRIM_LEFT_REGEXP,"")},trimRight:function(a){return a.replace(SC.STRING_TRIM_RIGHT_REGEXP,"")},mult:function(d,c){if(SC.typeOf(c)!==SC.T_NUMBER||c<1){return null}var a="";for(var b=0;b<c;b+=1){a+=d}return a}});if(String.prototype.trim){SC.supplement(String.prototype,{trim:function(){return SC.String.trim(this,arguments)},trimLeft:function(){return SC.String.trimLeft(this,arguments)},trimRight:function(){return SC.String.trimRight(this,arguments)}})}SC.mixin(String.prototype,{loc:function(){return SC.String.loc(this.toString(),SC.$A(arguments))},locMetric:function(){return SC.String.locMetric(this.toString())},locLayout:function(a){return SC.String.locLayout(this.toString(),a)}});SC.DelegateSupport={delegateFor:function(c){var b=1,a=arguments.length,d;while(b<a){d=arguments[b];if(d&&d[c]!==undefined){return d}b++}return(this[c]!==undefined)?this:null},invokeDelegateMethod:function(e,b){var c=new Array(arguments.length-2);for(var d=0,a=c.length;d<a;d++){c[d]=arguments[d+2]}if(!e||!e[b]){e=this}var f=e[b];return f?f.apply(e,c):null},getDelegateProperty:function(d,e){var b=1,a=arguments.length,c;while(b<a){c=arguments[b++];if(c&&c[d]!=undefined){return c.get?c.get(d):c[d]}}return(this[d]!=undefined)?this.get(d):undefined}};sc_require("mixins/delegate_support");SC.CoreView=SC.Responder.extend(SC.DelegateSupport);sc_require("views/view/base");SC.CoreView.mixin({IS_RENDERED:256,IS_ATTACHED:128,IS_SHOWN:64,IS_HIDDEN:32,UNRENDERED:512,UNATTACHED:768,ATTACHED_PARTIAL:896,ATTACHED_HIDDEN:928,ATTACHED_SHOWN:960,ATTACHED_HIDDEN_BY_PARENT:929,ATTACHED_BUILDING_IN:961,ATTACHED_BUILDING_OUT:964,ATTACHED_BUILDING_OUT_BY_PARENT:965,ATTACHED_SHOWING:962,ATTACHED_HIDING:963,ATTACHED_SHOWN_ANIMATING:966});SC.CoreView.reopen({_sc_buildOutCount:null,_owningView:null,_preTransitionLayout:null,_preTransitionFrame:null,_transitionLayoutCache:null,viewState:SC.CoreView.UNRENDERED,isAttached:function(){return(this.get("viewState")&SC.CoreView.IS_ATTACHED)>0}.property("viewState").cacheable(),_isRendered:function(){return(this.get("viewState")&SC.CoreView.IS_RENDERED)>0}.property("viewState").cacheable(),isVisibleInWindow:function(){return(this.get("viewState")&SC.CoreView.IS_SHOWN)>0}.property("viewState").cacheable(),_doAdopt:function(k,c){var e=this.get("parentView"),g=true,a=this.get("viewState");if(e&&e!==k){this._doOrphan();e=false}var h=k.get("childViews");if(!e||h.indexOf(this)<0){var j,b=k.get("viewState"),f,d,i;if(k.willAddChild){k.willAddChild(this,c)}if(this.willAddToParent){this.willAddToParent(k,c)}this.set("parentView",k);if(h.needsClone){k.set("childViews",[])}j=(c)?h.indexOf(c):h.length;if(j<0){j=h.length}h.insertAt(j,this);this.updateDesignMode(this.get("designMode"),k.get("designMode"));this._adopted(c);switch(a){case SC.CoreView.UNRENDERED:switch(b){case SC.CoreView.UNRENDERED:break;default:this._doRender()}break;case SC.CoreView.UNATTACHED:switch(b){case SC.CoreView.UNRENDERED:this._doDestroyLayer();break;default:f=k.get("containerLayer");i=h.objectAt(h.indexOf(this)+1);d=(i)?i.get("layer"):null;this._doAttach(f,d)}break;default:switch(b){case SC.CoreView.UNRENDERED:this._doDestroyLayer();break;default:f=k.get("containerLayer");i=h.objectAt(h.indexOf(this)+1);d=(i)?i.get("layer"):null;this._doAttach(f,d)}}}else{if(a===SC.CoreView.ATTACHED_BUILDING_OUT){this._doAttach()}else{g=false}}return g},_doAttach:function(b,a){var g=this.get("viewState"),d=this.get("transitionIn"),f,c=false;switch(g){case SC.CoreView.UNATTACHED:var e=this.get("layer");this._executeQueuedUpdates();b.insertBefore(e,a||null);f=this.get("parentView");if(!f||(f&&f.get("isAttached"))){this._executeDoAttach();if(d){this._transitionIn(false)}}else{this._gotoAttachedPartialState()}c=true;break;case SC.CoreView.ATTACHED_BUILDING_OUT:this._callOnChildViews("_parentDidCancelBuildOut");this._sc_buildOutCount=null;if(this.get("transitionOut")){this.cancelAnimation();this._gotoAttachedShownState();if(d){this._transitionIn(true)}}else{this._gotoAttachedShownState()}c=true;break;case SC.CoreView.ATTACHED_HIDING:case SC.CoreView.ATTACHED_HIDDEN:case SC.CoreView.ATTACHED_HIDDEN_BY_PARENT:case SC.CoreView.ATTACHED_BUILDING_IN:case SC.CoreView.ATTACHED_BUILDING_OUT_BY_PARENT:case SC.CoreView.ATTACHED_SHOWING:case SC.CoreView.UNRENDERED:break;case SC.CoreView.ATTACHED_SHOWN:case SC.CoreView.ATTACHED_SHOWN_ANIMATING:break;case SC.CoreView.ATTACHED_PARTIAL:break}return c},_doDestroyLayer:function(){var b=this.get("viewState"),a=false;switch(b){case SC.CoreView.UNRENDERED:case SC.CoreView.ATTACHED_HIDING:case SC.CoreView.ATTACHED_HIDDEN:case SC.CoreView.ATTACHED_HIDDEN_BY_PARENT:case SC.CoreView.ATTACHED_BUILDING_IN:case SC.CoreView.ATTACHED_BUILDING_OUT_BY_PARENT:case SC.CoreView.ATTACHED_SHOWING:case SC.CoreView.ATTACHED_SHOWN:case SC.CoreView.ATTACHED_SHOWN_ANIMATING:case SC.CoreView.ATTACHED_BUILDING_OUT:case SC.CoreView.ATTACHED_PARTIAL:break;default:this._callOnChildViews("_teardownLayer",false);this._teardownLayer();a=true}return a},_doDetach:function(b){var d=this.get("viewState"),c=this.get("transitionOut"),a=true;switch(d){case SC.CoreView.ATTACHED_SHOWN:this._executeDoBuildOut(b);break;case SC.CoreView.ATTACHED_PARTIAL:case SC.CoreView.ATTACHED_HIDDEN:case SC.CoreView.ATTACHED_HIDDEN_BY_PARENT:this._executeDoDetach();break;case SC.CoreView.ATTACHED_HIDING:this.cancelAnimation();this._gotoAttachedHiddenState();this._executeDoDetach();break;case SC.CoreView.ATTACHED_SHOWING:case SC.CoreView.ATTACHED_SHOWN_ANIMATING:this.cancelAnimation();this._gotoAttachedShownState();this._executeDoBuildOut(b);break;case SC.CoreView.ATTACHED_BUILDING_IN:this.cancelAnimation();this._gotoAttachedShownState();this._executeDoBuildOut(b,true);break;case SC.CoreView.ATTACHED_BUILDING_OUT_BY_PARENT:this.cancelAnimation(SC.LayoutState.CURRENT);this._gotoAttachedShownState();this._executeDoBuildOut(b,true);break;case SC.CoreView.ATTACHED_BUILDING_OUT:if(b){this.cancelAnimation();this._executeDoDetach()}break;default:a=false}return a},_doHide:function(){var c=this.get("viewState"),b=this.get("transitionHide"),a=true;switch(c){case SC.CoreView.ATTACHED_SHOWN:case SC.CoreView.ATTACHED_BUILDING_IN:case SC.CoreView.ATTACHED_BUILDING_OUT:case SC.CoreView.ATTACHED_BUILDING_OUT_BY_PARENT:case SC.CoreView.ATTACHED_SHOWN_ANIMATING:if(b){this._transitionHide()}else{this._executeDoHide()}break;case SC.CoreView.ATTACHED_SHOWING:if(b){this.cancelAnimation(SC.LayoutState.CURRENT)}else{this.cancelAnimation()}this._gotoAttachedShownState();if(b){this._transitionHide(true)}else{this._executeDoHide()}break;case SC.CoreView.UNATTACHED:case SC.CoreView.ATTACHED_PARTIAL:this._visibleStyleNeedsUpdate=true;break;case SC.CoreView.UNRENDERED:a=false;break;case SC.CoreView.ATTACHED_HIDDEN:case SC.CoreView.ATTACHED_HIDING:return false;case SC.CoreView.ATTACHED_HIDDEN_BY_PARENT:this._doUpdateVisibleStyle();this._gotoAttachedHiddenState();return true;default:a=false}return a},_doOrphan:function(){var b=this.get("parentView"),d=true;if(b){var c=b.get("childViews"),a=c.indexOf(this);this.set("parentView",null);if(a>=0){c.removeAt(a)}this._orphaned(b)}else{d=false}return d},_doRender:function(){var f=this.get("viewState"),c=true;switch(f){case SC.CoreView.UNRENDERED:this._executeDoRender();var e=this.get("parentView");if(e&&e.get("_isRendered")){var b=e.get("containerLayer"),g=e.get("childViews"),d=g.objectAt(g.indexOf(this)+1),a=(d)?d.get("layer"):null;this._doAttach(b,a)}break;default:c=false}return c},_doShow:function(){var f=this.get("viewState"),d=this.get("transitionShow"),a=true;switch(f){case SC.CoreView.ATTACHED_HIDDEN:var e=this.get("parentView"),b=e?e.get("viewState")&SC.CoreView.IS_SHOWN:true;if(b){var g=[];this._executeQueuedUpdates();this._callOnChildViews("_parentWillShowInDocument",true,g);for(var c=g.length-1;c>=0;c--){var h=g[c];h._notifyWillShowInDocument()}this._notifyWillShowInDocument();this._executeDoShow();if(d){this._transitionShow(false)}}else{this._visibleStyleNeedsUpdate=true;this._gotoAttachedHiddenByParentState()}break;case SC.CoreView.ATTACHED_HIDING:this.cancelAnimation(d?SC.LayoutState.CURRENT:SC.LayoutState.START);this._gotoAttachedShownState();if(d){this._transitionShow(true)}break;case SC.CoreView.UNATTACHED:case SC.CoreView.ATTACHED_PARTIAL:this._visibleStyleNeedsUpdate=true;break;case SC.CoreView.UNRENDERED:a=false;break;default:a=false}return a},_doUpdateContent:function(b){var a=this.get("isVisibleInWindow"),c=true;if(this.get("_isRendered")){if(a||b){this._executeDoUpdateContent()}else{this._contentNeedsUpdate=true}}else{c=false}return c},didTransitionIn:function(){var a=this.get("viewState");if(a===SC.CoreView.ATTACHED_SHOWING||a===SC.CoreView.ATTACHED_BUILDING_IN){this._teardownTransition();this._gotoAttachedShownState()}},didTransitionOut:function(){var b=this.get("viewState");if(b===SC.CoreView.ATTACHED_BUILDING_OUT){this._teardownTransition();this._executeDoDetach()}else{if(b===SC.CoreView.ATTACHED_BUILDING_OUT_BY_PARENT){var a=this._owningView;a._sc_buildOutCount--;if(a._sc_buildOutCount===0){a._executeDoDetach();this._owningView=null}}else{if(b===SC.CoreView.ATTACHED_HIDING){this._teardownTransition();this._executeDoHide()}}}},_adopted:function(b){this._callOnChildViews("_ancestorDidChangeParent",false);var a=this.get("parentView");if(this.didAddToParent){this.didAddToParent(a,b)}if(a.didAddChild){a.didAddChild(this,b)}},_orphaned:function(a){if(!this.isDestroyed){this._callOnChildViews("_ancestorDidChangeParent",false);if(a.didRemoveChild){a.didRemoveChild(this)}if(this.didRemoveFromParent){this.didRemoveFromParent(a)}}},_gotoAttachedBuildingInState:function(){this.set("viewState",SC.CoreView.ATTACHED_BUILDING_IN)},_gotoAttachedBuildingOutState:function(){this.set("viewState",SC.CoreView.ATTACHED_BUILDING_OUT)},_gotoAttachedBuildingOutByParentState:function(){this.set("viewState",SC.CoreView.ATTACHED_BUILDING_OUT_BY_PARENT)},_gotoAttachedHiddenState:function(){this.set("viewState",SC.CoreView.ATTACHED_HIDDEN)},_gotoAttachedHiddenByParentState:function(){this.set("viewState",SC.CoreView.ATTACHED_HIDDEN_BY_PARENT)},_gotoAttachedHidingState:function(){this.set("viewState",SC.CoreView.ATTACHED_HIDING)},_gotoAttachedShowingState:function(){this.set("viewState",SC.CoreView.ATTACHED_SHOWING)},_gotoAttachedShownState:function(){this.set("viewState",SC.CoreView.ATTACHED_SHOWN)},_gotoUnattachedState:function(){this.set("viewState",SC.CoreView.UNATTACHED)},_gotoAttachedPartialState:function(){this.set("viewState",SC.CoreView.ATTACHED_PARTIAL)},_gotoUnrenderedState:function(){this.set("viewState",SC.CoreView.UNRENDERED)},_sc_addRenderedStateObservers:function(){var c,b,a;c=this.get("displayProperties");for(a=0,b=c.length;a<b;a++){this.addObserver(c[a],this,this.displayDidChange)}this.addObserver("isVisible",this,this._isVisibleDidChange);this.addObserver("isFirstResponder",this,this._isFirstResponderDidChange)},_ancestorDidChangeParent:function(){this.notifyPropertyChange("pane")},_cancelTransition:function(){this.cancelAnimation()},_doUpdateVisibleStyle:function(){var a=this.get("isVisible");this.$().toggleClass("sc-hidden",!a);this.$().attr("aria-hidden",a?null:true);this._visibleStyleNeedsUpdate=false},_teardownLayer:function(){this._notifyWillDestroyLayer();var c,b,a;c=this.get("displayProperties");for(b=0,a=c.length;b<a;b++){this.removeObserver(c[b],this,this.displayDidChange)}this.removeObserver("isVisible",this,this._isVisibleDidChange);this.removeObserver("isFirstResponder",this,this._isFirstResponderDidChange);this.set("layer",null);this._gotoUnrenderedState()},_executeDoAttach:function(){var b=[];this._executeQueuedUpdates();this._gotoSomeAttachedState();this._callOnChildViews("_parentDidAttach",true,b);for(var a=b.length-1;a>=0;a--){var c=b[a];c._notifyDidAttach()}this._notifyDidAttach()},_executeDoBuildOut:function(a,c){if(a){this._executeDoDetach()}else{this._sc_buildOutCount=0;this._callOnChildViews("_parentWillBuildOutFromDocument",true,this);var b=this.get("transitionOut");if(b){c=c||false;this._transitionOut(c,this)}else{if(this._sc_buildOutCount>0){this._gotoAttachedBuildingOutState()}else{this._sc_buildOutCount=null;this._executeDoDetach()}}}},_executeDoDetach:function(){var d=[];this._callOnChildViews("_parentWillDetach",true,d);for(var a=d.length-1;a>=0;a--){var e=d[a];e._notifyWillDetach()}this._notifyWillDetach();var c=this.get("viewState");switch(c){case SC.CoreView.ATTACHED_HIDING:case SC.CoreView.ATTACHED_SHOWN_ANIMATING:this.cancelAnimation();break}var b=this.get("layer");b.parentNode.removeChild(b);this._gotoUnattachedState();this._callOnChildViews("_parentDidDetach",true)},_executeDoHide:function(){var c=[];this._callOnChildViews("_parentWillHideInDocument",true,c);for(var a=c.length-1;a>=0;a--){var d=c[a];d._notifyWillHideInDocument()}this._notifyWillHideInDocument();var b=this.get("viewState");switch(b){case SC.CoreView.ATTACHED_BUILDING_IN:case SC.CoreView.ATTACHED_BUILDING_OUT:case SC.CoreView.ATTACHED_BUILDING_OUT_BY_PARENT:case SC.CoreView.ATTACHED_SHOWN_ANIMATING:this.cancelAnimation();break}this._doUpdateVisibleStyle();this._gotoAttachedHiddenState();this._callOnChildViews("_parentDidHideInDocument",true);this._notifyDidHideInDocument()},_executeDoRender:function(){var c=[];var b=this.renderContext(this.get("tagName"));this.renderToContext(b);this.set("layer",b.element());this._gotoUnattachedState();this._callOnChildViews("_parentDidRender",true,c);this._sc_addRenderedStateObservers();for(var a=c.length-1;a>=0;a--){var d=c[a];d._notifyDidRender()}this._notifyDidRender()},_executeDoShow:function(){this._doUpdateVisibleStyle();this._gotoAttachedShownState();this._callOnChildViews("_parentDidShowInDocument",true);this._notifyDidShowInDocument()},_executeDoUpdateContent:function(){var c=this.renderMixin,d=this.renderContext(this.get("layer"));if(!this.update){this.render(d,false)}else{this.update(d.$())}if(c){var b=c.length;for(var a=0;a<b;++a){c[a].call(this,d,false)}}this.applyAttributesToContext(d);d.update();this.set("layerNeedsUpdate",false);this._contentNeedsUpdate=false;this.notifyPropertyChange("layer");if(this.didUpdateLayer){this.didUpdateLayer()}if(this.designer&&this.designer.viewDidUpdateLayer){this.designer.viewDidUpdateLayer()}},_executeQueuedUpdates:function(){if(this._visibleStyleNeedsUpdate){this._doUpdateVisibleStyle()}if(this._contentNeedsUpdate){this._executeDoUpdateContent()}},_isVisibleDidChange:function(){if(this.get("isVisible")){this._doShow()}else{this._doHide()}},_isFirstResponderDidChange:function(){var a=this.get("isFirstResponder");this.$().toggleClass("focus",a)},_notifyDidAttach:function(){this.notifyPropertyChange("frame");if(this.didAppendToDocument){this.didAppendToDocument()}},_notifyDidHideInDocument:function(){if(this.didHideInDocument){this.didHideInDocument()}},_notifyDidRender:function(){var c=this.didCreateLayerMixin,b,a;if(this.didCreateLayer){this.didCreateLayer()}if(c){a=c.length;for(b=0;b<a;++b){c[b].call(this)}}},_notifyDidShowInDocument:function(){if(this.didShowInDocument){this.didShowInDocument()}},_notifyWillDestroyLayer:function(){var b,a,c;c=this.willDestroyLayerMixin;if(c){a=c.length;for(b=0;b<a;++b){c[b].call(this)}}if(this.willDestroyLayer){this.willDestroyLayer()}},_notifyWillDetach:function(){if(this.willRemoveFromDocument){this.willRemoveFromDocument()}},_notifyWillHideInDocument:function(){if(this.willHideInDocument){this.willHideInDocument()}},_notifyWillShowInDocument:function(){if(this.willShowInDocument){this.willShowInDocument()}},_parentDidAttach:function(d){var c=this.get("viewState"),b=true;switch(c){case SC.CoreView.ATTACHED_PARTIAL:this._executeQueuedUpdates();this._gotoSomeAttachedState();var a=this.get("transitionIn");if(a){this._transitionIn(false)}break;case SC.CoreView.UNRENDERED:case SC.CoreView.UNATTACHED:b=false;break;default:b=false}if(b){d.push(this)}return b},_parentDidCancelBuildOut:function(){var b=this.get("viewState");if(b===SC.CoreView.ATTACHED_BUILDING_OUT_BY_PARENT){var a=this.get("transitionIn");this.cancelAnimation(a?SC.LayoutState.CURRENT:undefined);this._gotoAttachedShownState();if(a){this._transitionIn(true)}}else{if(b===SC.CoreView.ATTACHED_BUILDING_OUT||b&SC.CoreView.IS_HIDDEN){return false}}},_parentDidHideInDocument:function(){var b=this.get("viewState"),a=false;switch(b){case SC.CoreView.ATTACHED_SHOWN:this._gotoAttachedHiddenByParentState();a=true;break;case SC.CoreView.UNRENDERED:case SC.CoreView.UNATTACHED:case SC.CoreView.ATTACHED_HIDDEN:break;default:}return a},_parentDidDetach:function(){var a=this.get("viewState");if(a&SC.CoreView.IS_ATTACHED){this._gotoAttachedPartialState()}else{return false}},_parentDidRender:function(c){var b=this.get("viewState"),a=true;switch(b){case SC.CoreView.UNRENDERED:this._sc_addRenderedStateObservers();this._gotoAttachedPartialState();break;default:a=false}if(a){c.push(this)}return a},_parentDidShowInDocument:function(){var b=this.get("viewState"),a=true;switch(b){case SC.CoreView.ATTACHED_HIDDEN_BY_PARENT:this._gotoAttachedShownState();break;case SC.CoreView.UNRENDERED:case SC.CoreView.UNATTACHED:case SC.CoreView.ATTACHED_HIDDEN:a=false;break;default:a=false}return a},_parentWillBuildOutFromDocument:function(a){var d=this.get("viewState"),b=this.get("transitionOut"),c=true;switch(d){case SC.CoreView.UNRENDERED:case SC.CoreView.UNATTACHED:case SC.CoreView.ATTACHED_BUILDING_OUT:case SC.CoreView.ATTACHED_HIDDEN:c=false;break;case SC.CoreView.ATTACHED_BUILDING_IN:if(b){this.cancelAnimation(SC.LayoutState.CURRENT)}else{this.cancelAnimation()}this._gotoAttachedShownState();if(b){this._transitionOut(true,a)}break;case SC.CoreView.ATTACHED_HIDING:case SC.CoreView.ATTACHED_SHOWN_ANIMATING:case SC.CoreView.ATTACHED_SHOWING:case SC.CoreView.ATTACHED_SHOWN:if(b){this._transitionOut(false,a)}break;default:c=false}return c},_parentWillHideInDocument:function(){var b=this.get("viewState"),a=true;switch(b){case SC.CoreView.ATTACHED_SHOWN:break;case SC.CoreView.ATTACHED_SHOWN_ANIMATING:case SC.CoreView.ATTACHED_SHOWING:case SC.CoreView.ATTACHED_BUILDING_IN:case SC.CoreView.ATTACHED_BUILDING_OUT:case SC.CoreView.ATTACHED_BUILDING_OUT_BY_PARENT:case SC.CoreView.ATTACHED_HIDING:this.cancelAnimation();break;case SC.CoreView.UNRENDERED:case SC.CoreView.UNATTACHED:case SC.CoreView.ATTACHED_HIDDEN:break;default:a=false}return a},_parentWillDetach:function(c){var b=this.get("viewState"),a=true;switch(b){case SC.CoreView.ATTACHED_SHOWN:break;case SC.CoreView.ATTACHED_SHOWN_ANIMATING:case SC.CoreView.ATTACHED_SHOWING:case SC.CoreView.ATTACHED_BUILDING_IN:case SC.CoreView.ATTACHED_BUILDING_OUT:case SC.CoreView.ATTACHED_HIDING:this.cancelAnimation();break;case SC.CoreView.UNRENDERED:case SC.CoreView.UNATTACHED:case SC.CoreView.ATTACHED_HIDDEN:a=false;break;default:a=false}if(a){c.push(this)}return a},_parentWillShowInDocument:function(c){var b=this.get("viewState"),a=true;switch(b){case SC.CoreView.ATTACHED_HIDDEN_BY_PARENT:this._executeQueuedUpdates();break;case SC.CoreView.UNRENDERED:case SC.CoreView.UNATTACHED:case SC.CoreView.ATTACHED_HIDDEN:a=false;break;default:a=false}if(a){c.push(this)}return a},_setupTransition:function(e){var d=SC.clone(this.get("layout"));this._preTransitionLayout=d;this._preTransitionFrame=this.get("borderFrame");var c=SC.get(e,"layoutProperties");if(c&&c.length){this._transitionLayoutCache={};var b,f,a=c.length;for(b=0;b<a;b++){f=c[b];this._transitionLayoutCache[f]=d[f]===undefined?null:d[f]}}},_teardownTransition:function(){if(this._transitionLayoutCache){this.adjust(this._transitionLayoutCache)}else{if(this._preTransitionLayout){this.set("layout",this._preTransitionLayout)}}this._preTransitionLayout=null;this._preTransitionFrame=null;this._transitionLayoutCache=null},_transitionHide:function(c){var b=this.get("transitionHide"),a=this.get("transitionHideOptions")||{};if(!c){this._setupTransition(b)}if(b.setup){b.setup(this,a,c)}b.run(this,a,this._preTransitionLayout,this._preTransitionFrame);this._gotoAttachedHidingState()},_transitionIn:function(c){var a=this.get("transitionIn"),b=this.get("transitionInOptions")||{};if(!c){this._setupTransition(a)}if(a.setup){a.setup(this,b,c)}a.run(this,b,this._preTransitionLayout,this._preTransitionFrame);this._gotoAttachedBuildingInState()},_transitionOut:function(d,a){var c=this.get("transitionOut"),b=this.get("transitionOutOptions")||{};if(!d){this._setupTransition(c)}a._sc_buildOutCount++;if(c.setup){c.setup(this,b,d)}c.run(this,b,this._preTransitionLayout,this._preTransitionFrame);if(a===this){this._gotoAttachedBuildingOutState()}else{this._gotoAttachedBuildingOutByParentState()}},_transitionShow:function(c){var b=this.get("transitionShow"),a=this.get("transitionShowOptions")||{};if(!c){this._setupTransition(b)}if(b.setup){b.setup(this,a,c)}b.run(this,a,this._preTransitionLayout,this._preTransitionFrame);this._gotoAttachedShowingState()},_gotoSomeAttachedState:function(){var b=this.get("parentView"),c=b?b.get("viewState")&SC.CoreView.IS_HIDDEN:false,a=b?b.get("viewState")&SC.CoreView.IS_SHOWN:true;if(a){if(this.get("isVisible")){this._gotoAttachedShownState()}else{this._gotoAttachedHiddenState()}}else{if(c){this._gotoAttachedHiddenByParentState()}else{this._gotoAttachedPartialState()}}}});sc_require("system/browser");sc_require("system/event");sc_require("system/cursor");sc_require("system/responder");sc_require("system/theme");sc_require("system/string");sc_require("views/view/statechart");SC.CONTEXT_MENU_ENABLED=YES;SC.TABBING_ONLY_INSIDE_DOCUMENT=NO;SC.FROM_THEME="__FROM_THEME__";SC.EMPTY_CHILD_VIEWS_ARRAY=[];SC.EMPTY_CHILD_VIEWS_ARRAY.needsClone=YES;SC.CoreView.reopen({concatenatedProperties:["outlets","displayProperties","classNames","renderMixin","didCreateLayerMixin","willDestroyLayerMixin","classNameBindings","attributeBindings"],ariaRole:null,ariaHidden:null,createdByParent:false,owner:function(){return this.get("parentView")}.property("parentView").cacheable(),pane:function(){var a=this;while(a&&!a.isPane){a=a.get("parentView")}return a}.property("parentView").cacheable(),page:null,parentView:null,isVisible:true,isVisibleBindingDefault:SC.Binding.bool(),childViews:SC.EMPTY_CHILD_VIEWS_ARRAY,autoMixins:null,layer:function(a,c){if(c!==undefined){this._view_layer=c}else{c=this._view_layer;if(!c){var b=this.get("parentView");if(b){b=b.get("layer")}this._view_layer=c=this.findLayerInParentLayer(b)}}return c}.property("isVisibleInWindow").cacheable(),$:function(b){var a=this.get("layer");if(!a){return SC.$()}else{if(b===undefined){return SC.$(a)}else{return SC.$(b,a)}}},containerLayer:function(){return this.get("layer")}.property("layer").cacheable(),layerId:function(a,b){if(b){this._layerId=b}if(this._layerId){return this._layerId}return SC.guidFor(this)}.property().cacheable(),findLayerInParentLayer:function(a){var b="#"+this.get("layerId").escapeCssIdForSelector();return jQuery(b,a)[0]||jQuery(b)[0]},isDescendantOf:function(a){var b=this.get("parentView");if(this===a){return YES}else{if(b){return b.isDescendantOf(a)}else{return NO}}},displayDidChange:function(){if(this.get("_isRendered")){this.set("layerNeedsUpdate",true);this.invokeOnce(this._doUpdateContent)}return this},layerNeedsUpdate:NO,updateLayerIfNeeded:function(a){this._doUpdateContent(false);return this},updateLayer:function(){this._doUpdateContent(true);return this},parentViewDidResize:function(){if(!this.get("hasLayout")){this.notifyPropertyChange("frame")}this.viewDidResize()},viewDidResize:function(){},renderContext:function(a){return SC.RenderContext(a)},createLayer:function(){if(!this.get("_isRendered")){this._doRender()}return this},destroyLayer:function(){if(this.get("isAttached")){this._doDetach()}if(this.get("_isRendered")){this._doDestroyLayer()}return this},replaceLayer:function(){var b,a;if(this.get("isAttached")){b=this.get("layer");a=b.parentNode;this._doDetach()}this.destroyLayer().createLayer();if(a&&!this.get("isAttached")){this._doAttach(a)}return this},parentViewDidChange:function(){},layerLocationNeedsUpdate:NO,updateLayerLocationIfNeeded:function(){return this},updateLayerLocation:function(){return this},renderToContext:function(d){var c,b,a;this.beginPropertyChanges();d.id(this.get("layerId"));d.setAttr("role",this.get("ariaRole"));this._applyClassNameBindings();this._applyAttributeBindings(d);d.addClass(this.get("classNames"));if(this.get("isTextSelectable")){d.addClass("allow-select")}if(!this.get("isVisible")){d.addClass("sc-hidden");d.setAttr("aria-hidden","true")}this.applyAttributesToContext(d);this.render(d,true);if(!this._didRenderChildViews){this.renderChildViews(d)}this._didRenderChildViews=false;if(c=this.renderMixin){a=c.length;for(b=0;b<a;++b){c[b].call(this,d,true)}}this.endPropertyChanges()},applyAttributesToContext:function(a){},_applyClassNameBindings:function(){var a=this.get("classNameBindings"),b=this.get("classNames"),c;if(!a){return}a.forEach(function(f){var e;var d=function(){var h=this._classStringForProperty(f);var g=this.$();if(e){g.removeClass(e);b.removeObject(e)}if(h){g.addClass(h);b.push(h);e=h}else{e=null}};this.addObserver(f.split(":")[0],this,d);c=this._classStringForProperty(f);if(c){b.push(c);e=c}},this)},_applyAttributeBindings:function(a){var e=this.get("attributeBindings"),c,d,b;if(!e){return}e.forEach(function(g){var f=function(){d=this.$();var h=d.attr(g);c=this.get(g);b=typeof c;if((b==="string"||b==="number")&&c!==h){d.attr(g,c)}else{if(c&&b==="boolean"){d.attr(g,g)}else{if(c===NO){d.removeAttr(g)}}}};this.addObserver(g,this,f);c=this.get(g);b=typeof c;if(b==="string"||b==="number"){a.setAttr(g,c)}else{if(c&&b==="boolean"){a.setAttr(g,g)}}},this)},_classStringForProperty:function(c){var a=c.split(":"),b=a[1];c=a[0];var d=SC.getPath(this,c);if(d===YES){if(b){return b}return SC.String.dasherize(c.split(".").get("lastObject"))}else{if(d!==NO&&d!==undefined&&d!==null){return d}else{return null}}},renderChildViews:function(e){var d=this.get("childViews"),b=d.length,a,c;for(a=0;a<b;++a){c=d[a];if(!c){continue}e=e.begin(c.get("tagName"));c.renderToContext(e);e=e.end()}this._didRenderChildViews=true;return e},render:function(){},attributeBindings:null,tagName:"div",classNames:[],classNameBindings:null,toolTip:null,displayToolTip:function(){var a=this.get("toolTip");return(a&&this.get("localize"))?SC.String.loc(a):(a||"")}.property("toolTip","localize").cacheable(),isTextSelectable:NO,displayProperties:[],nextResponder:function(){return this.get("parentView")}.property("parentView").cacheable(),acceptsFirstResponder:NO,_lastLayerId:null,init:function(){var b,a;arguments.callee.base.apply(this,arguments);a=this._lastLayerId=this.get("layerId");SC.View.views[a]=this;this.classNames=this.get("classNames").slice();b=this.childViews=this.get("childViews").slice();this.createChildViews()},frame:function(){return this.computeFrameWithParentFrame(null)}.property("useStaticLayout").cacheable(),computeFrameWithParentFrame:function(){var a,b=this.get("parentView"),c;if(a=this.get("layer")){c=SC.offset(a);if(b){c=b.convertFrameFromView(c,null)}c.width=a.offsetWidth;c.height=a.offsetHeight;return c}if(this.get("hasLayout")){return null}else{return{x:0,y:0,width:0,height:0}}},_callOnChildViews:function(b,a,d){var h,f=this.get("childViews"),g,e;for(var c=f.length-1;c>=0;c--){h=f[c];if(!h){continue}g=h[b];if(a===undefined||a){e=g.call(h,d)}if(e===undefined||e){h._callOnChildViews(b,a,d)}if(a===false){g.call(h,d)}}},clippingFrame:function(){var e=this.get("frame");if(!e){return null}var g=(e.scale==null)?1:e.scale,d=this.get("parentView"),h=d?d.get("clippingFrame"):null,c;if(!h){return{x:0,y:0,width:e.width/g,height:e.height/g}}c=SC.intersectRects(h,e);c.x-=e.x;c.y-=e.y;if(g!==1){var b,a;if(SC.typeOf(g)===SC.T_ARRAY){b=1/g[0];a=1/g[1]}else{b=a=1/g}c.x*=b;c.width*=b;c.y*=a;c.height*=a}return c}.property("parentView","frame").cacheable(),_sc_clippingFrameDidChange:function(){this.notifyPropertyChange("clippingFrame")},removeChild:function(b,a){if(b.get("isAttached")){b._doDetach(a)}if(!a&&b.get("viewState")===SC.CoreView.ATTACHED_BUILDING_OUT){b.addObserver("isAttached",this,this._orphanChildView)}else{b._doOrphan()}return this},removeChildAndDestroy:function(b,a){b._doDetach(a);if(b.get("transitionOut")&&!a){b.addObserver("isAttached",this,this._destroyChildView)}else{b.destroy()}return this},removeAllChildren:function(b){var d=this.get("childViews"),a=d.get("length"),c;for(c=a-1;c>=0;c--){this.removeChildAndDestroy(d.objectAt(c),b)}return this},removeFromParent:function(){var a=this.get("parentView");if(a){a.removeChild(this)}return this},_destroyChildView:function(a){if(!a.get("isAttached")){a.removeObserver("isAttached",this,this._destroyChildView);a.destroy()}},_orphanChildView:function(a){if(!a.get("isAttached")){a.removeObserver("isAttached",this,this._orphanChildView);a._doOrphan()}},destroy:function(){if(this.get("isDestroyed")){return this}var a=arguments.callee.base.apply(this,arguments);if(this.getPath("parentView.isDestroyed")){this.invokeNext(this._destroy)}else{if(this.get("isAttached")){this._doDetach(true)}if(this.get("_isRendered")){this._doDestroyLayer()}this._destroy()}delete SC.View.views[this.get("layerId")];var c=this.get("childViews");for(var b=c.length-1;b>=0;b--){c[b].destroy()}return a},_destroy:function(){this._doOrphan();delete this.page},createChildViews:function(){var e=this.get("childViews"),b=e.length,f=false,a,d,c;this.beginPropertyChanges();for(a=0;a<b;++a){d=c=e[a];if(typeof d===SC.T_STRING){c=this[d]}else{d=null}if(!c){f=true;e[a]=null;continue}c=this.createChildView(c);if(d){this[d]=c}e[a]=c}if(f){this.set("childViews",e.compact())}this.endPropertyChanges();return this},createChildView:function(b,c){if(b.isClass){if(!c){c={}}else{c=SC.clone(c)}c.parentView=this;if(!c.page){c.page=this.page}c.createdByParent=true;var a=this.autoMixins;if(!!a){a=SC.clone(a);a.push(c);b=b.create.apply(b,a)}else{b=b.create(c)}}else{b.set("parentView",this);b._adopted();if(!b.get("page")){b.set("page",this.page)}}return b},isView:YES,selectStart:function(a){return this.get("isTextSelectable")},contextMenu:function(a){if(this.get("isContextMenuEnabled")){a.allowDefault();return YES}},transitionIn:null,transitionInOptions:null,transitionOut:null,transitionOutOptions:null,transitionShow:null,transitionShowOptions:null,transitionHide:null,transitionHideOptions:null,updateDesignMode:function(a,b){}});SC.CoreView.mixin({isViewClass:YES,design:function(){if(this.isDesign){return this}var a=this.extend.apply(this,arguments);a.isDesign=YES;if(SC.ViewDesigner){SC.ViewDesigner.didLoadDesign(a,this,SC.A(arguments))}return a},extend:function(){var a=arguments[arguments.length-1];if(a&&!SC.none(a.theme)){a.themeName=a.theme;delete a.theme}return SC.Object.extend.apply(this,arguments)},layout:function(a){this.prototype.layout=a;return this},classNames:function(a){a=(this.prototype.classNames||[]).concat(a);this.prototype.classNames=a;return this},tagName:function(a){this.prototype.tagName=a;return this},childView:function(a){var b=this.prototype.childViews||[];if(b===this.superclass.prototype.childViews){b=b.slice()}b.push(a);this.prototype.childViews=b;return this},bind:function(b,d){var c=this.prototype,a=this.superclass.prototype;var e=c._bindings;if(!e||e===a._bindings){e=c._bindings=(e||[]).slice()}b=b+"Binding";c[b]=d;e.push(b);return this},prop:function(a,b){this.prototype[a]=b;return this},localization:function(b,a){if(a){b.rootElement=SC.$(a)[0]}return b},viewFor:function(d,c){var b=SC.$A(arguments);if(SC.none(d)){b.shift()}else{b[0]={rootElement:SC.$(d)[0]}}var a=this.create.apply(this,arguments);b=b[0]=null;return a},create:function(){var b=arguments[arguments.length-1];if(b&&b.theme){b.themeName=b.theme;delete b.theme}var c=this,a=new c(arguments);if(SC.ViewDesigner){SC.ViewDesigner.didCreateView(a,SC.$A(arguments))}return a},loc:function(e){var b=e.childViews;delete e.childViews;this.applyLocalizedAttributes(e);if(SC.ViewDesigner){SC.ViewDesigner.didLoadLocalization(this,SC.$A(arguments))}var d=this.prototype.childViews,a=d.length,c;while(--a>=0){c=d[a];e=b[a];if(e&&c&&typeof c===SC.T_STRING){SC.String.loc(c,e)}}return this},applyLocalizedAttributes:function(a){SC.mixin(this.prototype,a)},views:{}});SC.outlet=function(b,a){return function(c){return(this[c]=SC.objectForPropertyPath(b,(a!==undefined)?a:this))}.property()};SC.CoreView.unload=function(){var a=SC.View.views;if(a){for(var b in a){if(!a.hasOwnProperty(b)){continue}delete a[b]}}};SC.View=SC.CoreView.extend({classNames:["sc-view"],displayProperties:[],_executeQueuedUpdates:function(){arguments.callee.base.apply(this,arguments);if(this._enabledStyleNeedsUpdate){this._doUpdateEnabledStyle()}if(this._layoutStyleNeedsUpdate){this._doUpdateLayoutStyle()}},applyAttributesToContext:function(f){var h=this.get("cursor");if(h){f.addClass(h.get("className"))}if(!this.get("isEnabled")){f.addClass("disabled");f.setAttr("aria-disabled","true")}this.renderLayout(f,true);if(this.get("useStaticLayout")){f.addClass("sc-static-layout")}var d=this.get("backgroundColor");if(!SC.none(d)||this._scv_hasBackgroundColor){this._scv_hasBackgroundColor=YES;if(d){f.setStyle("backgroundColor",d)}else{f.removeStyle("backgroundColor")}}var g=this.get("theme");var c=g.classNames,b,a=c.length;for(b=0;b<a;b++){f.addClass(c[b])}arguments.callee.base.apply(this,arguments);var e=this.get("renderDelegate");if(e&&e.className){f.addClass(e.className)}},computeFrameWithParentFrame:function(e){var i=this.get("layout"),l;if(this.get("useStaticLayout")){l=arguments.callee.base.apply(this,arguments);l=l?this._sc_adjustForBorder(l,i):null;l=l?this._sc_adjustForScale(l,i):null;return l}l={};var n,j,q=SC.LAYOUT_AUTO,a,h,p=i.right,b=i.left,o=i.top,k=i.bottom,m=i.width,g=i.height,d=i.centerX,c=i.centerY;if(m===q){SC.throw(("%@.layout() cannot use width:auto if staticLayout is disabled").fmt(this),"%@".fmt(this),-1)}if(g===q){SC.throw(("%@.layout() cannot use height:auto if staticLayout is disabled").fmt(this),"%@".fmt(this),-1)}if(!e){e=this.computeParentDimensions(i)}a=e.height;h=e.width;if(!SC.none(b)){if(SC.isPercentage(b)){l.x=h*b}else{l.x=b}if(m!==undefined){if(m===q){l.width=q}else{if(SC.isPercentage(m)){l.width=h*m}else{l.width=m}}}else{l.width=h-l.x;if(p&&SC.isPercentage(p)){l.width=l.width-(p*h)}else{l.width=l.width-(p||0)}}}else{if(!SC.none(p)){if(SC.none(m)){if(SC.isPercentage(p)){l.width=h-(h*p)}else{l.width=h-p}l.x=0}else{if(m===q){l.width=q}else{if(SC.isPercentage(m)){l.width=h*m}else{l.width=(m||0)}}if(SC.isPercentage(m)){l.x=h-(p*h)-l.width}else{l.x=h-p-l.width}}}else{if(!SC.none(d)){if(m===q){l.width=q}else{if(SC.isPercentage(m)){l.width=m*h}else{l.width=(m||0)}}if(SC.isPercentage(d)){l.x=(h-l.width)/2+(d*h)}else{l.x=(h-l.width)/2+d}}else{l.x=0;if(SC.none(m)){l.width=h}else{if(m===q){l.width=q}if(SC.isPercentage(m)){l.width=m*h}else{l.width=(m||0)}}}}}if(!SC.none(o)){if(SC.isPercentage(o)){l.y=o*a}else{l.y=o}if(g!==undefined){if(g===q){l.height=q}else{if(SC.isPercentage(g)){l.height=g*a}else{l.height=g}}}else{if(k&&SC.isPercentage(k)){l.height=a-l.y-(k*a)}else{l.height=a-l.y-(k||0)}}}else{if(!SC.none(k)){if(SC.none(g)){if(SC.isPercentage(k)){l.height=a-(k*a)}else{l.height=a-k}l.y=0}else{if(g===q){l.height=q}if(g&&SC.isPercentage(g)){l.height=g*a}else{l.height=(g||0)}if(SC.isPercentage(k)){l.y=a-(k*a)-l.height}else{l.y=a-k-l.height}}}else{if(!SC.none(c)){if(g===q){l.height=q}if(g&&SC.isPercentage(g)){l.height=g*a}else{l.height=(g||0)}if(SC.isPercentage(c)){l.y=(a-l.height)/2+(c*a)}else{l.y=(a-l.height)/2+c}}else{l.y=0;if(SC.none(g)){l.height=a}else{if(g===q){l.height=q}if(SC.isPercentage(g)){l.height=g*a}else{l.height=g||0}}}}}l.x=Math.floor(l.x);l.y=Math.floor(l.y);if(l.height!==q){l.height=Math.floor(l.height)}if(l.width!==q){l.width=Math.floor(l.width)}if(l.height===q||l.width===q){j=this.get("layer");if(l.height===q){l.height=j?j.clientHeight:0}if(l.width===q){l.width=j?j.clientWidth:0}}l=this._sc_adjustForBorder(l,i);if((i.maxHeight!=null)&&(l.height>i.maxHeight)){l.height=i.maxHeight}if((i.minHeight!=null)&&(l.height<i.minHeight)){l.height=i.minHeight}if((i.maxWidth!=null)&&(l.width>i.maxWidth)){l.width=i.maxWidth}if((i.minWidth!=null)&&(l.width<i.minWidth)){l.width=i.minWidth}l=this._sc_adjustForScale(l,i);return l},init:function(){arguments.callee.base.apply(this,arguments);if(!this.get("isEnabled")){this._doDisable()}this._previousLayout=this.get("layout");var a=this.childViewLayout;if(a){this.set("childViewsNeedLayout",true);this.layoutChildViewsIfNeeded();if(this.get("isChildViewLayoutLive")){this.addObserver("childViews.[]",this,this._cvl_childViewsDidChange);this.addObserver("childViewLayoutOptions",this,this._cvl_childViewLayoutDidChange);this._cvl_setupChildViewsLiveLayout();if(!this.get("isFixedSize")&&a.layoutDependsOnSize&&a.layoutDependsOnSize(this)){this.addObserver("frame",this,this._cvl_childViewLayoutDidChange)}}}this._lastTheme=this.get("theme")},destroy:function(){this._previousLayout=null;return arguments.callee.base.apply(this,arguments)},removeChild:function(a){if(!a){return this}if(a.parentView!==this){throw new Error("%@.removeChild(%@) must belong to parent".fmt(this,a))}if(a.willRemoveFromParent){a.willRemoveFromParent()}if(this.willRemoveChild){this.willRemoveChild(a)}arguments.callee.base.apply(this,arguments);return this}});if(SC.browser.isIE){SC.Event.add(window,"unload",SC.View,SC.View.unload)}sc_require("views/view");function _SC_VIEW_STACK_PLUGIN(a){this.direction=a}_SC_VIEW_STACK_PLUGIN.prototype.childLayoutProperties=["marginBefore","marginAfter","isVisible"];_SC_VIEW_STACK_PLUGIN.prototype.layoutDependsOnSize=function(a){var b=a.get("childViewLayoutOptions");if(b){return SC.none(b.resizeToFit)?false:!b.resizeToFit}else{return false}};_SC_VIEW_STACK_PLUGIN.prototype.layoutChildViews=function(m){var y=m.get("childViews"),c=m.get("childViewLayoutOptions")||{},s=SC.none(c.resizeToFit)?true:c.resizeToFit,w=0,l=c.paddingBefore||0,h=c.paddingAfter||0,v=0,e=0,r=0,n=0,f=0,d=c.spacing||0,a=this.direction==="vertical"?"height":"width",b=this.direction==="vertical"?"minHeight":"minWidth",g=this.direction==="vertical"?"top":"left",C,x,B,k,t,u;if(!s){n=m.get("frame")[a];if(!n){return}for(t=0,u=y.get("length");t<u;t++){C=y.objectAt(t);if(!C.get("isVisible")||C.get("useAbsoluteLayout")||C.get("useStaticLayout")){continue}B=C.get("layout");k=C.get("marginBefore")||0;e+=Math.max(l,k);if(SC.none(B[a])){x=C.get("fillRatio");if(!SC.none(x)){f+=x}else{if(t===u-1&&f===0){f=1}}}else{e+=C.get("borderFrame")[a]}w=C.get("marginAfter")||0;l=w||d}if(e!==0||f!==0){e+=Math.max(w,h)}r=Math.max(0,n-e)}w=0;l=c.paddingBefore||0;h=c.paddingAfter||0;for(t=0,u=y.get("length");t<u;t++){var p,A,z;C=y.objectAt(t);if(!C.get("isVisible")||C.get("useAbsoluteLayout")||C.get("useStaticLayout")){continue}B=C.get("layout");k=C.get("marginBefore")||0;v+=Math.max(l,k);A=B[g]!==v;C.beginPropertyChanges();if(!s&&!B[a]){var j=this.direction==="vertical"?"bottom":"right",o;x=C.get("fillRatio");if(t===u-1&&SC.none(x)){x=1}if(!SC.none(x)){var q=(x/f);p=Math.ceil(r*q);o=Math.max(0,n-v-p);z=B[j]!==o;if(z){C.adjust(j,o)}}}if(A){C.adjust(g,v)}C.endPropertyChanges();v+=C.get("borderFrame")[a];w=C.get("marginAfter")||0;l=w||d}if(v!==0){v+=Math.max(w,h)}if(s&&m.get("layout")[a]!==v){m.adjust(a,v)}};SC.mixin(SC.View,{HORIZONTAL_STACK:new _SC_VIEW_STACK_PLUGIN("horizontal"),VERTICAL_STACK:new _SC_VIEW_STACK_PLUGIN("vertical")});SC.Controller=SC.Object.extend({isEditable:YES,destroyContentOnReplace:NO,contentObjectDidChanged:function(){var b,a;if(!this.get("destroyContentOnReplace")){return}b=this._oldContent;a=this.get("content");if(b&&a!==b&&b.destroy){b.destroy()}this._oldContent=a}.observes("content")});SC.SelectionSupport={hasSelectionSupport:YES,allowsSelection:YES,allowsMultipleSelection:YES,allowsEmptySelection:YES,firstSelectableObject:function(){return this.get("firstObject")}.property(),selection:function(d,f){var c=this._scsel_selection,g=c?c.get("length"):0,e,b=this.get("arrangedObjects"),a;if((f===undefined)||!this.get("allowsSelection")){f=c}a=(f&&f.isEnumerable)?f.get("length"):0;if((a>1)&&!this.get("allowsMultipleSelection")){if(g>1){f=SC.SelectionSet.create().addObject(c.get("firstObject")).freeze();a=1}else{f=c;a=g}}if((a===0)&&!this.get("allowsEmptySelection")&&b&&b.get("length")!==0){if(g===0){f=this.get("firstSelectableObject");if(f){f=SC.SelectionSet.create().addObject(f).freeze()}else{f=SC.SelectionSet.EMPTY}a=f.get("length")}else{f=c;a=g}}if(a===0){f=SC.SelectionSet.EMPTY}if(f!==c){f=f.frozenCopy()}this._scsel_selection=f;return f}.property("arrangedObjects","allowsEmptySelection","allowsMultipleSelection","allowsSelection").cacheable(),hasSelection:function(){var a=this.get("selection");return !!a&&(a.get("length")>0)}.property("selection").cacheable(),selectObjects:function(b,c){if(!b||b.get("length")===0){if(!c){this.set("selection",SC.SelectionSet.EMPTY)}return this}var a=this.get("selection");if(c&&a){a=a.copy()}else{a=SC.SelectionSet.create()}a.addObjects(b).freeze();this.set("selection",a);return this},selectObject:function(a,b){if(a===null){if(!b){this.set("selection",null)}return this}else{return this.selectObjects([a],b)}},deselectObjects:function(b){if(!b||b.get("length")===0){return this}var a=this.get("selection");if(!a||a.get("length")===0){return this}a=a.copy().removeObjects(b).freeze();this.set("selection",a.freeze());return this},deselectObject:function(a){if(!a){return this}else{return this.deselectObjects([a])}},updateSelectionAfterContentChange:function(){var a=this.get("arrangedObjects");var b=this.get("selection");var d=this.get("allowsEmptySelection");var c;if(!b){return this}c=b.indexSetForSource(a);if((c&&(c.get("length")!==b.get("length")))||(!c&&(b.get("length")>0))){if(a){b=b.copy().constrain(a).freeze()}else{b=SC.SelectionSet.EMPTY}this.set("selection",b)}if((b.get("length")===0)&&a&&(a.get("length")>0)&&!d){this.selectObject(this.get("firstSelectableObject"),NO)}return this}};sc_require("controllers/controller");sc_require("mixins/selection_support");SC.ArrayController=SC.Controller.extend(SC.Array,SC.SelectionSupport,{content:null,isEditable:YES,orderBy:null,allowsSingleContent:YES,destroyOnRemoval:NO,arrangedObjects:function(){return this}.property().cacheable(),canRemoveContent:function(){var b=this.get("content"),a;a=!!b&&this.get("isEditable")&&this.get("hasContent");if(a){return !b.isEnumerable||(SC.typeOf(b.removeObject)===SC.T_FUNCTION)}else{return NO}}.property("content","isEditable","hasContent"),canReorderContent:function(){var b=this.get("content"),a;a=!!b&&this.get("isEditable")&&!this.get("orderBy");return a&&!!b.isSCArray}.property("content","isEditable","orderBy"),canAddContent:function(){var b=this.get("content"),a;a=b&&this.get("isEditable")&&b.isEnumerable;if(a){return(SC.typeOf(b.addObject)===SC.T_FUNCTION)||(SC.typeOf(b.pushObject)===SC.T_FUNCTION)}else{return NO}}.property("content","isEditable"),hasContent:function(){var a=this.get("content");return !!a&&(!!a.isEnumerable||!!this.get("allowsSingleContent"))}.property("content","allowSingleContent"),status:function(){var b=this.get("content"),a=b?b.get("status"):null;return a?a:SC.Record.READY}.property().cacheable(),addObject:function(a){if(!this.get("canAddContent")){throw new Error("%@ cannot add content".fmt(this))}var b=this.get("content");if(b.isSCArray){b.pushObject(a)}else{if(b.addObject){b.addObject(a)}else{throw new Error("%@.content does not support addObject".fmt(this))}}return this},removeObject:function(a){if(!this.get("canRemoveContent")){throw new Error("%@ cannot remove content".fmt(this))}var b=this.get("content");if(b.isEnumerable){b.removeObject(a)}else{this.set("content",null)}if(this.get("destroyOnRemoval")&&a.destroy){a.destroy()}return this},length:function(){var a=this._scac_observableContent();return a?a.get("length"):0}.property().cacheable(),objectAt:function(a){var b=this._scac_observableContent();return b?b.objectAt(a):undefined},replace:function(g,f,d){if(!d||d.get("length")===0){if(!this.get("canRemoveContent")){throw new Error("%@ cannot remove objects from the current content".fmt(this))}}else{if(!this.get("canReorderContent")){throw new Error("%@ cannot add or reorder the current content".fmt(this))}}var c=this.get("content");var b=[],a,e;if(this.get("destroyOnRemoval")){for(a=0;a<f;a++){b.push(c.objectAt(a+g))}}if(c){c.replace(g,f,d)}for(a=0,e=b.length;a<e;a++){b[a].destroy()}b=null;return this},indexOf:function(b,a){var c=this._scac_observableContent();return c?c.indexOf(b,a):-1},init:function(){arguments.callee.base.apply(this,arguments);this._scac_contentDidChange()},_scac_cached:NO,_scac_observableContent:function(){var b=this._scac_cached;if(b){return b}var e=this.get("content"),d,a;if(SC.none(e)){return(this._scac_cached=[])}if(!e.isEnumerable){b=this.get("allowsSingleContent")?[e]:[];return(this._scac_cached=b)}var f=this.get("orderBy");if(!f){if(e.isSCArray){return(this._scac_cached=e)}else{throw new Error("%@.orderBy is required for unordered content".fmt(this))}}var c=SC.typeOf(f);if(c===SC.T_STRING){f=[f]}else{if(c===SC.T_FUNCTION){d=f}else{if(c!==SC.T_ARRAY){throw new Error("%@.orderBy must be Array, String, or Function".fmt(this))}}}d=d||function(o,n){var j,p,m,g,q;for(var k=0,h=f.get("length");k<h&&!j;k++){p=f.objectAt(k);if(p.search(/(ASC|DESC)/)===0){m=p.match(/^(ASC )?(DESC )?(.*)$/);p=m[3]}else{m=p.match(/^(\S*)\s*(DESC)?(?:ASC)?$/);p=m[1]}a=m[2]?-1:1;if(o){g=o.isObservable?o.get(p):o[p]}if(n){q=n.isObservable?n.get(p):n[p]}j=SC.compare(g,q)*a}return j};return(this._scac_cached=e.toArray().sort(d))},propertyWillChange:function(a){if(a==="content"){this.arrayContentWillChange(0,this.get("length"),0)}else{return arguments.callee.base.apply(this,arguments)}},_scac_arrayContentWillChange:function(e,d,b){if(this.get("orderBy")){var a=this.get("length");e=0;b=a+b-d;d=a}this.arrayContentWillChange(e,d,b);if(this._kvo_enumerable_property_chains){var c=this.slice(e,e+d);this.teardownEnumerablePropertyChains(c)}},_scac_arrayContentDidChange:function(e,d,b){this._scac_cached=NO;if(this.get("orderBy")){var a=this.get("length");e=0;b=a+b-d;d=a}this.arrayContentDidChange(e,d,b);if(this._kvo_enumerable_property_chains){var c=this.slice(e,e+b);this.setupEnumerablePropertyChains(c)}this.updateSelectionAfterContentChange()},_scac_contentDidChange:function(){this._scac_cached=NO;var d=this.get("content"),b=this._scac_content,f=this._scac_arrayContentDidChange,a=this._scac_arrayContentWillChange,c=this._scac_contentStatusDidChange,e=this._scac_enumerableDidChange,g;if(d===b){return this}if(b){if(b.isSCArray){b.removeArrayObservers({target:this,didChange:f,willChange:a})}else{if(b.isEnumerable){b.removeObserver("[]",this,e)}}b.removeObserver("status",this,c);this.teardownEnumerablePropertyChains(b)}this._scac_cached=NO;this._scac_content=d;if(d){if(d.isSCArray){d.addArrayObservers({target:this,didChange:f,willChange:a});g=d.get("length")}else{if(d.isEnumerable){d.addObserver("[]",this,e);g=d.get("length")}else{g=1}}d.addObserver("status",this,c);this.setupEnumerablePropertyChains(d)}else{g=SC.none(d)?0:1}this._scac_length=g;this._scac_contentStatusDidChange();this.arrayContentDidChange(0,0,g);this.updateSelectionAfterContentChange()}.observes("content"),_scac_enumerableDidChange:function(){var a=this.get("content"),c=a?a.get("length"):0,b=this._scac_length;this._scac_length=c;this._scac_cached=NO;this.arrayContentWillChange(0,b,c);this.arrayContentDidChange(0,b,c);this.updateSelectionAfterContentChange()}.observes("orderBy"),_scac_contentStatusDidChange:function(){this.notifyPropertyChange("status")}});sc_require("controllers/controller");SC.ObjectController=SC.Controller.extend({content:null,allowsMultipleContent:NO,hasContent:function(){return !SC.none(this.get("observableContent"))}.property("observableContent"),isEditable:YES,observableContent:function(){var b=this.get("content"),a,c;if(b&&b.isEnumerable){a=b.get("length");c=this.get("allowsMultipleContent");if(a===1){b=b.firstObject()}else{if(a===0||!c){b=null}}if(b&&!c&&b.isEnumerable){b=null}}return b}.property("content","allowsMultipleContent").cacheable(),destroy:function(){var a=this.get("observableContent");if(a&&SC.typeOf(a.destroy)===SC.T_FUNCTION){a.destroy()}this.set("content",null);return this},contentPropertyDidChange:function(b,a){if(a==="*"){this.allPropertiesDidChange()}else{this.notifyPropertyChange(a)}},unknownProperty:function(b,d){if(b==="content"){if(d!==undefined){this.content=d}return this.content}var c=this.get("observableContent"),f,e,a;if(c===null||c===undefined){return undefined}if(d===undefined){if(c.isEnumerable){d=c.getEach(b);f=d.get("length");if(f>0){a=YES;e=d.objectAt(0);while((--f>0)&&a){if(e!==d.objectAt(f)){a=NO}}if(a){d=e}}else{d=undefined}}else{d=(c.isObservable)?c.get(b):c[b]}}else{if(!this.get("isEditable")){throw new Error("%@.%@ is not editable".fmt(this,b))}if(c.isEnumerable){c.setEach(b,d)}else{if(c.isObservable){c.set(b,d)}else{c[b]=d}}}return d},init:function(){arguments.callee.base.apply(this,arguments);if(this.get("content")){this._scoc_contentDidChange()}if(this.get("observableContent")){this._scoc_observableContentDidChange()}},_scoc_contentDidChange:function(){var b=this._scoc_content,c=this.get("content");if(b!==c){this._scoc_content=c;var a=this._scoc_enumerableContentDidChange;if(b&&b.isEnumerable){b.removeObserver("[]",this,a)}if(c&&c.isEnumerable){c.addObserver("[]",this,a)}}}.observes("content"),_scoc_observableContentDidChange:function(){var b=this._scoc_observableContent,d=this.get("observableContent"),a=this.contentPropertyDidChange,c=this._scoc_enumerableContentDidChange;if(b===d){return this}this._scoc_observableContent=d;if(b){if(b.isEnumerable){b.removeObserver("[]",this,c)}else{if(b.isObservable){b.removeObserver("*",this,a)}}}if(d){if(d.isEnumerable){d.addObserver("[]",this,c)}else{if(d.isObservable){d.addObserver("*",this,a)}}}if((b&&b.isEnumerable)||(d&&d.isEnumerable)){this._scoc_enumerableContentDidChange()}else{this.contentPropertyDidChange(d,"*")}}.observes("observableContent"),_scoc_enumerableContentDidChange:function(){var b=this.get("observableContent"),c=this._scoc_observableContentItems,a=this.contentPropertyDidChange;if(c){c.forEach(function(d){if(d.isObservable){d.removeObserver("*",this,a)}},this);c.clear()}if(b&&b.isEnumerable){if(!c){c=SC.Set.create()}b.forEach(function(d){if(c.contains(d)){return}c.add(d);if(d.isObservable){d.addObserver("*",this,a)}},this)}else{c=null}this._scoc_observableContentItems=c;this.contentPropertyDidChange(b,"*");return this}});SC.mixin(Function.prototype,{invokeLater:function(e,a){if(a===undefined){a=1}var d=this;if(arguments.length>2){var b=SC.$A(arguments).slice(2,arguments.length);b.unshift(e);var c=d;d=function(){return c.apply(this,b.slice(1))}}return SC.Timer.schedule({target:e,action:d,interval:a})}});SC.mixin(SC.Object.prototype,{invokeLater:function(d,a){var c,b;if(SC.typeOf(d)===SC.T_STRING){d=this[d]}if(a===undefined){a=1}if(arguments.length>2){b=SC.$A(arguments).slice(2);c=function(){return d.apply(this,b)}}else{c=d}return SC.Timer.schedule({target:this,action:c,interval:a})},invokeOnceLater:function(i,c){var d,g,b,e=this._sc_invokeOnceLaterTimers,h,a;if(SC.typeOf(i)===SC.T_STRING){i=this[i]}if(c===undefined){c=1}if(!e){e=this._sc_invokeOnceLaterTimers={}}b=SC.guidFor(i);h=e[b];if(h){h.invalidate()}if(arguments.length>2){d=SC.$A(arguments).slice(2)}else{d=arguments}g=function(){delete e[b];return i.apply(this,d)};a=SC.Timer.schedule({target:this,action:g,interval:c});e[b]=a;return a},invokeWith:function(b,c,d){if(d===undefined){d=c;c=this}if(!c){c=this}if(SC.typeOf(d)===SC.T_STRING){d=c[d]}var a=this.getPath(b);d.call(c,a,this);return this}});SC.RunLoop=SC.RunLoop.extend({startTime:function(){if(!this._start){this._start=Date.now()}return this._start}.property(),endRunLoop:function(){this.fireExpiredTimers();var a=arguments.callee.base.apply(this,arguments);this.scheduleNextTimeout();return a},scheduleTimer:function(b,a){this._timerQueue=b.removeFromTimerQueue(this._timerQueue);this._timerQueue=b.scheduleInTimerQueue(this._timerQueue,a);return this},cancelTimer:function(a){this._timerQueue=a.removeFromTimerQueue(this._timerQueue);return this},TIMER_ARRAY:[],fireExpiredTimers:function(){if(!this._timerQueue||this._firing){return NO}var d=this.get("startTime"),e=this.TIMER_ARRAY,c,b,a;this._firing=YES;this._timerQueue=this._timerQueue.collectExpiredTimers(e,d);b=e.length;for(c=0;c<b;c++){e[c].fire()}a=e.length>0;e.length=0;this._firing=NO;return a},scheduleNextTimeout:function(){var a=NO,c=this._timerQueue;if(!c){if(this._timerTimeout){this.unscheduleRunLoop()}this._timerTimeout=null}else{var b=c._timerQueueRunTime;this._timerTimeout=this.scheduleRunLoop(b);a=YES}return a}});SC.RunLoop.currentRunLoop=SC.RunLoop.create();SC.RunLoop.runLoopClass=SC.RunLoop;sc_require("system/string");SC.supplement(String.prototype,{capitalize:function(){return SC.String.capitalize(this,arguments)},camelize:function(){return SC.String.camelize(this,arguments)},decamelize:function(){return SC.String.decamelize(this,arguments)},dasherize:function(){return SC.String.dasherize(this,arguments)},escapeCssIdForSelector:function(){return SC.String.escapeCssIdForSelector(this)},loc:function(){var a=SC.$A(arguments);a.unshift(this);return SC.String.loc.apply(SC.String,a)},locWithDefault:function(b){var a=SC.$A(arguments);a.unshift(this);return SC.String.locWithDefault.apply(SC.String,a)},mult:function(a){return SC.String.mult(this,a)}});SC.methodForLocale("en","ordinalForNumber",function(a){var b=a%10;return(~~(a%100/10)===1)?"th":(b===1)?"st":(b===2)?"nd":(b===3)?"rd":"th"});SC.ActionSupport={action:null,actionContext:null,target:null,fireAction:function(b){var e=this.get("pane"),c=e.get("rootResponder"),d=this.get("action"),a;if(b===undefined){a=this.get("actionContext")}else{if(typeof b===SC.T_STRING&&d==null){d=b;a=this.get("actionContext")}else{a=b}}if(d&&c){return c.sendAction(d,this.get("target"),this,e,a,this)}return false}};sc_require("system/responder");SC.ResponderContext={isResponderContext:YES,defaultResponder:null,nextResponder:function(){return this.get("defaultResponder")}.property("defaultResponder").cacheable(),firstResponder:null,nextResponderFor:function(a){var b=a.get("nextResponder");if(typeof b===SC.T_STRING){b=SC.objectForPropertyPath(b,this)}else{if(!b&&(a!==this)){b=this}}return b},responderNameFor:function(a){if(!a){return"(No Responder)"}else{if(a._scrc_name){return a._scrc_name}}var b=this.NAMESPACE;this._findResponderNamesFor(this,3,b?[this.NAMESPACE]:[]);return a._scrc_name||a.toString()},_findResponderNamesFor:function(a,e,d){var b,c;for(b in a){if(b==="nextResponder"){continue}c=a[b];if(c&&c.isResponder){if(c._scrc_name){continue}d.push(b);c._scrc_name=d.join(".");if(e>0){this._findResponderNamesFor(c,e-1,d)}d.pop()}}},makeFirstResponder:function(b,a){var e=this.get("firstResponder"),d=this.get("nextResponder"),c;if(this._locked){this._pendingResponder=b;return}if(b){b.set("becomingFirstResponder",YES)}this._locked=YES;this._pendingResponder=null;c=b?b:null;while(c){if(c.get("hasFirstResponder")){break}c=(c===d)?null:this.nextResponderFor(c)}if(!c){c=d}this._notifyWillLoseFirstResponder(e,e,c,a);if(e){e.set("isFirstResponder",NO)}this.beginPropertyChanges();this.set("firstResponder",b);if(b){b.set("isFirstResponder",YES)}this._notifyDidBecomeFirstResponder(b,b,c);this.endPropertyChanges();this._locked=NO;if(this._pendingResponder){this.makeFirstResponder(this._pendingResponder);this._pendingResponder=null}if(b){b.set("becomingFirstResponder",NO)}return this},_notifyWillLoseFirstResponder:function(c,e,b,a){if(!e||e===b){return}e.willLoseFirstResponder(c,a);e.set("hasFirstResponder",NO);var d=this.nextResponderFor(e);if(d){this._notifyWillLoseFirstResponder(c,d,b)}},_notifyDidBecomeFirstResponder:function(b,d,a){if(!d||d===a){return}var c=this.nextResponderFor(d);if(c){this._notifyDidBecomeFirstResponder(b,c,a)}d.set("hasFirstResponder",YES);d.didBecomeFirstResponder(b)},resetFirstResponder:function(){var a=this.get("firstResponder");if(!a){return}a.willLoseFirstResponder();a.didBecomeFirstResponder()},sendAction:function(f,d,c){var a=this.get("firstResponder"),e=this.get("nextResponder"),g=NO,b;this._locked=YES;if(!g&&!a&&this.tryToPerform){g=this.tryToPerform(f,d,c)}while(!g&&a){if(a.tryToPerform){g=a.tryToPerform(f,d,c)}if(!g){a=(a===e)?null:this.nextResponderFor(a)}}this._locked=NO;if(b=this._pendingResponder){this._pendingResponder=null;this.makeFirstResponder(b)}return a}};SC.bodyOverflowArbitrator=SC.Object.create({requestHidden:function(b,a){this._makeRequest(b,-1-9*!!a)},requestVisible:function(b,a){this._makeRequest(b,1+9*!!a)},withdrawRequest:function(c){if(!c){return}var a=SC.guidFor(c),b=this._requests[a];if(b){delete this._requests[a];this.setOverflow()}},setOverflow:function(){var a=this._decideOverflow();if(a!==undefined){document.body.style.overflow=a?"auto":"hidden"}},_makeRequest:function(d,c){if(!d){return}var a=SC.guidFor(d),b=this._requests[a];if(b!=c){this._requests[a]=c;this.setOverflow()}},_requests:{},_decideOverflow:function(){var a,e,c,f,b=this._requests,g;for(var d in b){if((g=b[d])<0){a=YES}if(g<-1){c=YES}if(g>0){e=YES}if(g>1){f=YES}}if(f){return YES}if(e&&c){return NO}if(e){return YES}if(a){return NO}return undefined}});sc_require("views/view");SC.ANIMATABLE_PROPERTIES={top:YES,left:YES,bottom:YES,right:YES,width:YES,height:YES,centerX:YES,centerY:YES,opacity:YES,scale:YES,rotate:YES,rotateX:YES,rotateY:YES,rotateZ:YES};SC.LayoutState={START:1,CURRENT:2,END:3};SC.View.reopen({_SC_DECOMPOSED_TRANSFORM_MAP:null,_activeAnimations:null,_activeAnimationsLength:null,_animateLayout:null,_pendingAnimations:null,_prevLayout:null,animate:function(m,j,o,i,a){var l,e,c=NO,n=NO,f,h,d,g=this._pendingAnimations,b;if(typeof m===SC.T_STRING){f={};f[m]=j}else{a=i;i=o;o=j;f=m}d=SC.typeOf(o);if(d===SC.T_NUMBER){o={duration:o}}else{if(d!==SC.T_HASH){throw new Error("Must provide options hash!")}}if(o.callback){a=o.callback;delete o.callback}if(a===undefined){a=i;i=this}if(!i){i=this}if(a){if(typeof a==="string"){a=i[a]}o.target=i;o.method=a}if(o.duration===0){this.invokeNext(function(){this.adjust(f);this.runAnimationCallback(o,null,false)});return this}if(!this.get("isVisibleInWindow")){this.invokeNext(function(){this.adjust(f);this.runAnimationCallback(o,null)});return this}b=o.timing;if(b){if(typeof b!==SC.T_STRING){o.timing="cubic-bezier("+b[0]+", "+b[1]+", "+b[2]+", "+b[3]+")"}}else{o.timing="ease"}if(SC.none(o.delay)){o.delay=0}if(!this._prevLayout){this._prevLayout=SC.clone(this.get("explicitLayout"))}if(!g){g=this._pendingAnimations={}}h=this._animateLayout||SC.clone(this.get("explicitLayout"));if(!SC.none(f.rotate)){if(SC.none(f.rotateZ)){f.rotateZ=f.rotate}delete f.rotate}for(var k in f){if(!f.hasOwnProperty(k)||!SC.ANIMATABLE_PROPERTIES[k]){continue}j=f[k];l=h[k];e=g[k];if(SC.none(j)){throw new Error("Can only animate to an actual value!")}if(e&&(e.duration!==o.duration||e.timing!==o.timing||e.delay!==o.delay)){n=YES;this.runAnimationCallback(e,null,YES)}if(l!==j||n){c=YES;h[k]=j;g[k]=o}}if(c){if(!SC.none(g.height)&&!SC.none(h.centerY)&&SC.none(g.centerY)){if(Math.abs(f.height-this.get("layout").height)>=2){g.centerY=o}}if(!SC.none(g.width)&&!SC.none(h.centerX)&&SC.none(g.centerX)){if(Math.abs(f.width-this.get("layout").width)>=2){g.centerX=o}}this._animateLayout=h;this.invokeNext("_animate")}else{if(!n){this.invokeNext(function(){this.runAnimationCallback(o,null,false)})}}return this},_animate:function(){var a=this._animateLayout;if(a){this.willRenderAnimations();this._animateLayout=null;this.set("layout",a);if(this.get("viewState")===SC.CoreView.ATTACHED_SHOWN){this.set("viewState",SC.CoreView.ATTACHED_SHOWN_ANIMATING)}}},_animateFrames:function(d,e,b,a){if(SC.none(a)){a=0}var c=d[a];this.animate(c.value,{delay:b,duration:c.duration,timing:c.timing},function(f){a+=1;if(!f.isCancelled&&a<d.length){this._animateFrames(d,e,0,a)}else{if(e){e(f)}}});return this},cancelAnimation:function(d){var a=this._activeAnimations,f=this._pendingAnimations,g,c,e,b=NO;switch(d){case SC.LayoutState.START:e=this._prevLayout;break;case SC.LayoutState.CURRENT:e=this.get("liveAdjustments");break;default:e=this._animateLayout}if(this.get("viewState")===SC.CoreView.ATTACHED_SHOWN_ANIMATING){this.set("viewState",SC.CoreView.ATTACHED_SHOWN)}for(c in f){g=f[c];b=YES;delete f[c];this.runAnimationCallback(g,null,YES)}for(c in a){g=a[c];b=YES;delete a[c];this.removeAnimationFromLayout(c,YES);this.runAnimationCallback(g,null,YES)}if(b&&!!e){this.set("layout",e)}this._prevLayout=this._activeAnimations=this._pendingAnimations=this._animateLayout=null;return this},didRenderAnimations:function(){if(!SC.platform.supportsCSSTransitions||document.hidden){var b=this._pendingAnimations;for(var a in b){this.removeAnimationFromLayout(a,NO);this.runAnimationCallback(b[a],null,NO)}if(this.get("viewState")===SC.CoreView.ATTACHED_SHOWN_ANIMATING){this.set("viewState",SC.CoreView.ATTACHED_SHOWN)}this._activeAnimations=this._pendingAnimations=null}},_sc_decompose3DTransformMatrix:function(a,d){var b=SC.View._SC_DECOMPOSED_TRANSFORM_MAP,c=180/Math.PI;if(!b){b=SC.View._SC_DECOMPOSED_TRANSFORM_MAP={}}if(d){b.scaleX=Math.sqrt((a.m11*a.m11)+(a.m12*a.m12)+(a.m13*a.m13));b.scaleY=Math.sqrt((a.m21*a.m21)+(a.m22*a.m22)+(a.m23*a.m23));b.scaleZ=Math.sqrt((a.m31*a.m31)+(a.m32*a.m32)+(a.m33*a.m33));a=a.scale(1/b.scaleX,1/b.scaleY,1/b.scaleZ)}else{b.scaleX=1;b.scaleY=1;b.scaleZ=1}b.rotateZ=-Math.atan2(a.m21,a.m11)*c;if(b.rotateZ<0){b.rotateZ=360+b.rotateZ}b.translateX=a.m41;b.translateY=a.m42;b.translateZ=a.m43;return b},_sc_removeENotationFromMatrixString:function(b){var g,c,d;g=b.split(/\(|\)/);c=g[1].split(",");for(var e=0,a=c.length;e<a;e++){var f=c[e];if(f.indexOf("e")>0){c[e]=window.parseFloat(f).toFixed(20)}}d=g[0]+"("+c.join(", ")+")";return d},liveAdjustments:function(){var l=this._activeAnimations,b=this.get("layer"),f={},g=SC.browser.experimentalCSSNameFor("transform");if(l){for(var k in l){var j=document.defaultView.getComputedStyle(b)[k];if(k===g){var i=SC.browser.experimentalNameFor(window,"CSSMatrix"),h;if(i!==SC.UNSUPPORTED){j=this._sc_removeENotationFromMatrixString(j);h=new window[i](j);var d=this.get("layout"),e=d.scale,c=e!=null,a=this._sc_decompose3DTransformMatrix(h,c);if(d.rotateZ!=null){f.rotateZ=a.rotateZ}if(c){if(SC.typeOf(e)===SC.T_ARRAY){f.scale=[a.scaleX,a.scaleY]}else{if(SC.typeOf(e)===SC.T_HASH){f.scale={x:a.scaleX,y:a.scaleY}}else{f.scale=a.scaleX}}}if(this.get("hasAcceleratedLayer")){f.left=a.translateX;f.top=a.translateY}}else{h=j.match(/^matrix\((.*)\)$/)[1].split(/,\s*/);if(h&&this.get("hasAcceleratedLayer")){f.left=parseInt(h[4],10);f.top=parseInt(h[5],10)}}}else{j=window.parseFloat(j,10);if(k==="centerX"){j=j+parseInt(document.defaultView.getComputedStyle(b).width,10)/2}else{if(k==="centerY"){j=j+parseInt(document.defaultView.getComputedStyle(b).height,10)/2}}f[k]=j}}}return f}.property(),removeAnimationFromLayout:function(b,c){var a=this._activeAnimations,e=this.get("layer");if(!!e&&c){var f=[];for(var d in a){if(d!==b){f.push(a[d].css)}}e.style[SC.browser.experimentalStyleNameFor("transition")]=f.join(", ")}},resetAnimation:function(){return this.cancelAnimation()},runAnimationCallback:function(c,a,b){var e=c.method,d=c.target;if(e){e.call(d,{event:a,view:this,isCancelled:b});delete c.method;delete c.target}},transitionDidEnd:function(b){var c=b.originalEvent.propertyName,a=this._activeAnimations,d;if(c==="margin-left"){c="centerX"}if(c==="margin-top"){c="centerY"}d=a?a[c]:null;if(d){delete a[c];this.removeAnimationFromLayout(c,YES);this._activeAnimationsLength-=1;if(this._activeAnimationsLength===0){if(this.get("viewState")===SC.CoreView.ATTACHED_SHOWN_ANIMATING){this.set("viewState",SC.CoreView.ATTACHED_SHOWN)}this._activeAnimations=this._prevLayout=null}this.runAnimationCallback(d,b,NO)}},willRenderAnimations:function(){if(SC.platform.supportsCSSTransitions&&!document.hidden){var e=this._pendingAnimations;if(e){var b=this._activeAnimations;if(!b){this._activeAnimationsLength=0;b={}}for(var d in e){if(!e.hasOwnProperty(d)){continue}var a=b[d],c=e[d];if(a){this.runAnimationCallback(a,null,YES)}b[d]=c;this._activeAnimationsLength+=1}this._activeAnimations=b;this._pendingAnimations=null}}}});sc_require("ext/string");sc_require("views/view");sc_require("views/view/animation");SC.CSS_TRANSFORM_NAMES=["rotateX","rotateY","rotateZ","scale"];SC.CSS_TRANSFORM_MAP={rotate:function(a){if(SC.typeOf(a)===SC.T_NUMBER){a+="deg"}return"rotate("+a+")"},rotateX:function(a){if(SC.typeOf(a)===SC.T_NUMBER){a+="deg"}return"rotateX("+a+")"},rotateY:function(a){if(SC.typeOf(a)===SC.T_NUMBER){a+="deg"}return"rotateY("+a+")"},rotateZ:function(a){if(SC.typeOf(a)===SC.T_NUMBER){a+="deg"}return"rotateZ("+a+")"},scale:function(a){if(SC.typeOf(a)===SC.T_ARRAY){a=a.join(", ")}return"scale("+a+")"}};SC.View.LayoutStyleCalculator={_SC_STATE_MAP:null,_SC_TRANSFORMS_ARRAY:null,_SC_TRANSITIONS_ARRAY:null,_valueOrNull:function(a){return a===undefined?null:a},_prepareStyle:function(b,d){var f=this._valueOrNull(d.border);b.marginLeft=null;b.marginTop=null;b.bottom=d.bottom;b.right=d.right;b.left=d.left;b.top=d.top;b.centerX=d.centerX;b.centerY=d.centerY;b.height=d.height;b.width=d.width;b.borderTopWidth=d.borderTop!==undefined?d.borderTop:f;b.borderRightWidth=d.borderRight!==undefined?d.borderRight:f;b.borderBottomWidth=d.borderBottom!==undefined?d.borderBottom:f;b.borderLeftWidth=d.borderLeft!==undefined?d.borderLeft:f;b.maxHeight=this._valueOrNull(d.maxHeight);b.maxWidth=this._valueOrNull(d.maxWidth);b.minWidth=this._valueOrNull(d.minWidth);b.minHeight=this._valueOrNull(d.minHeight);b.zIndex=(d.zIndex!=null)?d.zIndex.toString():null;b.opacity=(d.opacity!=null)?d.opacity.toString():null;b.backgroundPosition=this._valueOrNull(d.backgroundPosition);if(SC.platform.supportsCSSTransforms){var a=SC.browser.experimentalStyleNameFor("transform"),g=this._SC_TRANSFORMS_ARRAY,l=SC.CSS_TRANSFORM_MAP;if(!g){g=this._SC_TRANSFORMS_ARRAY=[]}for(var c=0,e=SC.CSS_TRANSFORM_NAMES.length;c<e;c++){var h=SC.CSS_TRANSFORM_NAMES[c],j=d[h];if(j!=null){g.push(l[h](j))}}b[a]=g.length>0?g.join(" "):null;var n=SC.browser.experimentalStyleNameFor("transformOrigin"),m=d.transformOriginX,k=d.transformOriginY;if(m==null&&k==null){b[n]=null}else{if(m==null){m=0.5}if(k==null){k=0.5}b[n]=(m*100)+"% "+(k*100)+"%"}}if(SC.platform.supportsCSSTransitions){b[SC.browser.experimentalStyleNameFor("transition")]=null}this._SC_TRANSFORMS_ARRAY.length=0},_prepareState:function(b,a){b.hasBottom=(a.bottom!=null);b.hasRight=(a.right!=null);b.hasLeft=(a.left!=null);b.hasTop=(a.top!=null);b.hasCenterX=(a.centerX!=null);b.hasCenterY=(a.centerY!=null);b.hasHeight=(a.height!=null);b.hasWidth=(a.width!=null);b.hasMaxWidth=(a.maxWidth!=null);b.hasMaxHeight=(a.maxHeight!=null)},_invalidAutoValue:function(a,b){SC.throw("%@.layout() you cannot use %@:auto if staticLayout is disabled".fmt(a,b),"%@".fmt(a),-1)},_calculatePosition:function(c,b,l){var d,m,o,e,n,i,h,g,k;if(l==="X"){d="left";m="right";o="width";g="borderLeftWidth";k="borderRightWidth";e=b.hasLeft;n=b.hasRight;i=b.hasWidth;h=b.hasMaxWidth}else{d="top";m="bottom";o="height";g="borderTopWidth";k="borderBottomWidth";e=b.hasTop;n=b.hasBottom;i=b.hasHeight;h=b.hasMaxHeight}c[d]=this._cssNumber(c[d]);c[m]=this._cssNumber(c[m]);var j=this._cssNumber(c[g]),f=this._cssNumber(c[k]),a=c[o];c[g]=j;c[k]=f;if(a>=1){a-=(j+f)}c[o]=this._cssNumber(a);if(e){if(n&&i){c[m]=null}}else{if(!n||(n&&!i&&!h)){c[d]=0}}if(!i&&!n){c[m]=0}},_calculateCenter:function(b,l){var o,a,c,m,e,f,k;if(l==="X"){o="width";a="centerX";c="left";m="right";e="marginLeft";f="borderLeftWidth";k="borderRightWidth"}else{o="height";a="centerY";c="top";m="bottom";e="marginTop";f="borderTopWidth";k="borderBottomWidth"}b[c]="50%";var j=this._cssNumber(b[f]),d=this._cssNumber(b[k]),i=b[o],h=b[a],g=SC.isPercentage(i),n;b[f]=j;b[k]=d;if(SC.none(i)){b[e]="50%"}else{n=h-i/2;b[e]=(g)?Math.floor(n*100)+"%":Math.floor(n)}if(i>1){i-=(j+d)}b[o]=this._cssNumber(i)||0;b[m]=b[a]=null},_cssNumber:function(a){if(a==null){return null}else{if(a===SC.LAYOUT_AUTO){return SC.LAYOUT_AUTO}else{if(SC.isPercentage(a)){return(a*100)+"%"}else{return Math.floor(a)}}}},calculate:function(a,c){var d=a.get("layout"),h=a._activeAnimations,f=this._SC_STATE_MAP,g=a.get("useStaticLayout");if(g&&d===SC.View.prototype.layout){return{}}this._prepareStyle(c,d);if(!f){f=this._SC_STATE_MAP={}}this._prepareState(f,c);if(!g){if(c.width===SC.LAYOUT_AUTO){this._invalidAutoValue(a,"width")}if(c.height===SC.LAYOUT_AUTO){this._invalidAutoValue(a,"height")}}if(f.hasLeft||f.hasRight||!f.hasCenterX){this._calculatePosition(c,f,"X")}else{this._calculateCenter(c,"X")}if(f.hasTop||f.hasBottom||!f.hasCenterY){this._calculatePosition(c,f,"Y")}else{this._calculateCenter(c,"Y")}this._calculateAnimations(c,h,a.get("hasAcceleratedLayer"));for(var b in c){var e=c[b];if(typeof e===SC.T_NUMBER){c[b]=(e+"px")}}return c},_calculateAnimations:function(b,l,f){var k,e;if(f){e=YES;if(l&&(l.top||l.left)){for(k in l){if(SC.CSS_TRANSFORM_MAP[k]&&((l.top&&l.top.duration!==l[k].duration)||(l.left&&l.left.duration!==l[k].duration))){e=NO}}}if(e){var a=SC.browser.experimentalStyleNameFor("transform"),h=b[a],d;d="translateX("+b.left+"px) translateY("+b.top+"px)";if(SC.platform.supportsCSS3DTransforms){d+=" translateZ(0px)"}if(h){d+=" "+h}b[a]=d;b.left=0;b.top=0}}if(l){if(SC.platform.supportsCSSTransitions){var i=this._SC_TRANSITIONS_ARRAY;if(!i){i=this._SC_TRANSITIONS_ARRAY=[]}for(k in l){var g=l[k],m=!!SC.CSS_TRANSFORM_MAP[k],c=e&&(k==="top"||k==="left");if(SC.platform.supportsCSSTransforms&&(c||m)){delete l[k];k=SC.browser.experimentalCSSNameFor("transform");var j=l[k];if(j){g=j}else{l[k]=g}}if(k==="centerX"){k="margin-left"}if(k==="centerY"){k="margin-top"}g.css=k+" "+g.duration+"s "+g.timing+" "+g.delay+"s";if(i.indexOf(g.css)<0){i.push(g.css)}}b[SC.browser.experimentalStyleNameFor("transition")]=i.join(", ");this._SC_TRANSITIONS_ARRAY.length=0}else{}}}};SC.View.reopen({_SC_STYLE_MAP:null,layoutStyle:function(){var a=this._SC_STYLE_MAP;if(!a){a=this._SC_STYLE_MAP={}}return SC.View.LayoutStyleCalculator.calculate(this,a)}.property("hasAcceleratedLayer","useStaticLayout").cacheable()});sc_require("views/view");sc_require("views/view/layout_style");SC.LAYOUT_HORIZONTAL="sc-layout-horizontal";SC.LAYOUT_VERTICAL="sc-layout-vertical";SC.FULL_WIDTH={left:0,right:0};SC.FULL_HEIGHT={top:0,bottom:0};SC.ANCHOR_CENTER={centerX:0,centerY:0};SC.LAYOUT_AUTO="auto";SC._ROTATION_VALUE_REGEX=/^\-?\d+(\.\d*)?(rad|deg)$/;SC._SCALE_VALUE_REGEX=/^\d+(,\d+){0,2}$/;SC.View.reopen({_sc_previousLayout:null,backgroundColor:null,borderFrame:function(){var b=this.get("frame"),h=null;if(b){var f=this.get("layout"),k=f.border==null?0:f.border,d=this._sc_explicitValueFor(f.borderTop,k),m=this._sc_explicitValueFor(f.borderRight,k),j=this._sc_explicitValueFor(f.borderBottom,k),i=this._sc_explicitValueFor(f.borderLeft,k);h={x:b.x,y:b.y,width:b.width,height:b.height};var c=b.scale;if(c!=null){var a=d*c,e=m*c,g=j*c,l=i*c;h.scale=c;h.x-=l;h.y-=a;h.width+=l+e;h.height+=a+g}else{h.x-=i;h.y-=d;h.width+=i+m;h.height+=d+j}if(b.transformOriginX!=null){h.transformOriginX=b.transformOriginX}if(b.transformOriginY!=null){h.transformOriginY=b.transformOriginY}}return h}.property("frame").cacheable(),childViewsNeedLayout:NO,childViewLayout:null,childViewLayoutOptions:null,explicitLayout:function(){var b=this.get("layout"),a=null;if(b){a=this._sc_computeExplicitLayout(b)}return a}.property("layout").cacheable(),hasLayout:true,isChildViewLayoutLive:true,isFixedHeight:function(){var a=this.get("layout");return(a.height!==undefined)&&!SC.isPercentage(a.height)&&(a.height!==SC.LAYOUT_AUTO)}.property("layout").cacheable(),isFixedLayout:function(){return this.get("isFixedPosition")&&this.get("isFixedSize")}.property("isFixedPosition","isFixedSize").cacheable(),isFixedPosition:function(){var e=this.get("explicitLayout"),d=e.left,c=e.top,b,a;b=d!==undefined&&!SC.isPercentage(d)&&d!==SC.LAYOUT_AUTO;a=c!==undefined&&!SC.isPercentage(c)&&c!==SC.LAYOUT_AUTO;return b&&a}.property("explicitLayout").cacheable(),isFixedSize:function(){return this.get("isFixedHeight")&&this.get("isFixedWidth")}.property("isFixedWidth","isFixedHeight").cacheable(),isFixedWidth:function(){var a=this.get("layout");return(a.width!==undefined)&&!SC.isPercentage(a.width)&&(a.width!==SC.LAYOUT_AUTO)}.property("layout").cacheable(),layout:{top:0,left:0,bottom:0,right:0},layoutView:function(){return this.get("parentView")}.property("parentView").cacheable(),transitionAdjust:null,transitionAdjustOptions:null,useStaticLayout:NO,_sc_adjustForBorder:function(f,d){var b=d.border==null?0:d.border,g=this._sc_explicitValueFor(d.borderTop,b),e=this._sc_explicitValueFor(d.borderLeft,b),c=this._sc_explicitValueFor(d.borderBottom,b),a=this._sc_explicitValueFor(d.borderRight,b);f.x+=e;f.y+=g;f.width-=(e+a);f.height-=(g+c);return f},_sc_adjustForScale:function(e,c){if(!SC.platform.supportsCSSTransforms){e.scale=1;e.transformOriginX=e.transformOriginY=0.5}else{var d=c.scale,b=c.transformOriginX,a=c.transformOriginY;if(d!=null&&d!==1){e=SC.scaleRect(e,d,b,a);e.scale=d}if(b!=null&&b!==0.5){e.transformOriginX=b}if(a!=null&&a!==0.5){e.transformOriginY=a}}if(e.height<0){e.height=0}if(e.width<0){e.width=0}return e},_sc_applyAdjustment:function(a,e,b,d){var c=this._animateLayout;if(c){if(e===null){delete c[a]}else{c[a]=e}if(this._pendingAnimations&&this._pendingAnimations[a]){delete this._pendingAnimations[a]}}if(e!==undefined&&b[a]!=e){if(!d){d=SC.clone(this.get("layout"))}if(e===null){delete d[a]}else{d[a]=e}}return d},_sc_checkForResize:function(b,d){var e=true,c=true,a=true;if(b!=null&&((b.width!=null&&b.width===d.width)||(b.width==null&&d.width==null&&b.left===d.left&&b.right===d.right))){c=false}if(!c&&((b.height!=null&&b.height===d.height)||(b.height==null&&d.height==null&&b.top===d.top&&b.bottom===d.bottom))){e=false}if(!e&&!c){a=!(b.border===d.border&&b.borderTop===d.borderTop&&b.borderLeft===d.borderLeft&&b.borderBottom===d.borderBottom&&b.borderRight===d.borderRight)}return a},_cvl_childViewLayoutDidChange:function(){this.set("childViewsNeedLayout",true);this.invokeOnce(this.layoutChildViewsIfNeeded)},_cvl_childViewsDidChange:function(){this._cvl_teardownChildViewsLiveLayout();this._cvl_setupChildViewsLiveLayout();this.set("childViewsNeedLayout",true);this.invokeOnce(this.layoutChildViewsIfNeeded)},_cvl_setupChildViewsLiveLayout:function(){var a=this.childViewLayout,h,b=a.childLayoutProperties||[];h=this._cvl_childViews=this.get("childViews");for(var d=0,g=b.length;d<g;d++){var f=b[d];for(var c=0,k=h.get("length");c<k;c++){var e=h.objectAt(c);if(!e.get("useAbsoluteLayout")&&!e.get("useStaticLayout")){e.addObserver(f,this,this._cvl_childViewLayoutDidChange)}}}},_cvl_teardownChildViewsLiveLayout:function(){var a=this.childViewLayout,h=this._cvl_childViews||[],b=a.childLayoutProperties||[];for(var d=0,g=b.length;d<g;d++){var f=b[d];for(var c=0,k=h.get("length");c<k;c++){var e=h.objectAt(c);if(!e.get("useAbsoluteLayout")&&!e.get("useStaticLayout")){e.removeObserver(f,this,this._cvl_childViewLayoutDidChange)}}}},_sc_computeExplicitLayout:function(g){var h=SC.copy(g);var b=(g.bottom!=null);var k=(g.right!=null);var i=(g.left!=null);var e=(g.top!=null);var c=(g.centerX!=null);var a=(g.centerY!=null);var j=(g.height!=null);var d=(g.width!=null);delete h.right;delete h.bottom;if(i){h.left=g.left}else{if(!c&&!(d&&k)){h.left=0}}if(k&&!(i&&d)){h.right=g.right}else{if(!c&&!d){h.right=0}}if(e){h.top=g.top}else{if(!a&&!(j&&b)){h.top=0}}if(b&&!(e&&j)){h.bottom=g.bottom}else{if(!a&&!j){h.bottom=0}}if(c){h.centerX=g.centerX}if(a){h.centerY=g.centerY}var f=g.border;if(f!=null){h.borderTop=f;h.borderRight=f;h.borderBottom=f;h.borderLeft=f;delete h.border}if(g.borderTop!=null){h.borderTop=g.borderTop}if(g.borderRight!=null){h.borderRight=g.borderRight}if(g.borderBottom!=null){h.borderBottom=g.borderBottom}if(g.borderLeft!=null){h.borderLeft=g.borderLeft}return h},_sc_convertFrameFromViewHelper:function(d,e,a){var l=d.x,j=d.y,b=d.width,c=d.height,k,h;if(e){k=e;while(k&&(h=k.get("frame"))){if(h.scale&&h.scale!==1){l*=h.scale;j*=h.scale;b*=h.scale;c*=h.scale}l+=h.x;j+=h.y;k=k.get("layoutView")}}if(a){var m=[];k=a;while(k&&k.get("frame")){m.unshift(k);k=k.get("layoutView")}for(var g=0;g<m.length;g++){k=m[g];h=k.get("frame");l-=h.x;j-=h.y;if(h.scale&&h.scale!==1){l/=h.scale;j/=h.scale;b/=h.scale;c/=h.scale}}}return{x:l,y:j,width:b,height:c}},_sc_explicitValueFor:function(a,b){return a===undefined?b:a},_sc_transitionAdjust:function(c){var b=this.get("transitionAdjust"),a=this.get("transitionAdjustOptions")||{};b.run(this,a,c)},_sc_viewFrameDidChange:function(){this.notifyPropertyChange("frame");this._callOnChildViews("_sc_clippingFrameDidChange")},adjust:function(b,f){if(b===undefined){return this}var d=this.get("layout"),e;if(SC.typeOf(b)===SC.T_STRING){e=this._sc_applyAdjustment(b,f,d)}else{for(var c in b){if(!b.hasOwnProperty(c)){continue}e=this._sc_applyAdjustment(c,b[c],d,e)}}if(e){var a=this.get("transitionAdjust");if(this.get("viewState")&SC.CoreView.IS_SHOWN&&a){this._sc_transitionAdjust(e)}else{this.set("layout",e)}}return this},computeParentDimensions:function(d){var b=this.get("parentView"),c=(b)?b.get("frame"):null,a;if(c){a={width:c.width,height:c.height}}else{if(d){a={width:(d.left||0)+(d.width||0)+(d.right||0),height:(d.top||0)+(d.height||0)+(d.bottom||0)}}else{a={width:0,height:0}}}return a},convertFrameToView:function(b,a){return this._sc_convertFrameFromViewHelper(b,this,a)},convertFrameFromView:function(b,a){return this._sc_convertFrameFromViewHelper(b,a,this)},didTransitionAdjust:function(){},layoutDidChange:function(){var c=this.get("layout");if(!SC.none(c.rotate)){if(SC.none(c.rotateZ)&&SC.platform.get("supportsCSS3DTransforms")){c.rotateZ=c.rotate;delete c.rotate}}var a=this._sc_checkForResize(this._sc_previousLayout,c);this._sc_previousLayout=c;if(a){this.viewDidResize()}else{this._sc_viewFrameDidChange()}var b=this.get("layoutView");if(b){b.set("childViewsNeedLayout",YES);b.layoutDidChangeFor(this);if(b.get("childViewsNeedLayout")){b.invokeOnce(b.layoutChildViewsIfNeeded)}}else{this.invokeOnce(this.updateLayout)}return this},layoutDidChangeFor:function(b){var a=this._needLayoutViews;if(!a){a=this._needLayoutViews=SC.CoreSet.create()}a.add(b)},layoutChildViewsIfNeeded:function(a){if(this.get("childViewsNeedLayout")){this.layoutChildViews(a);this.set("childViewsNeedLayout",NO)}return this},layoutChildViews:function(d){var c=this.childViewLayout,e,a,b;if(c){c.layoutChildViews(this)}e=this._needLayoutViews;if(e){for(b=0,a=e.length;b<a;++b){e[b].updateLayout(d)}e.clear()}},parentViewDidResize:function(k){var c=!this.get("isFixedPosition");var i=this.get("useStaticLayout"),f=k?k.height:0,a=f!==this._scv_parentHeight,b=this.get("isFixedHeight"),h=i||(a&&!b),j=k?k.width:0,e=j!==this._scv_parentWidth,g=this.get("isFixedWidth"),d=i||(e&&!g);this._scv_parentHeight=f;this._scv_parentWidth=j;if(h||d){this.viewDidResize()}else{if(c){this._sc_viewFrameDidChange()}}},propertyDidChange:function(b,d,c){var a=false;if(typeof this.layout==="function"&&this._kvo_dependents){var e=this._kvo_dependents[b];if(e&&e.indexOf("layout")!==-1){a=true}}if(b==="layout"||a){this.layoutDidChange()}return arguments.callee.base.apply(this,arguments)},scrollToVisible:function(){var a=this.get("parentView");while(a&&!a.get("isScrollable")){a=a.get("parentView")}if(a){a.scrollToVisible();return a.scrollToVisible(this)}else{return NO}},viewDidResize:function(){this._sc_viewFrameDidChange();var d=this.childViews,e=this.get("frame"),b,a,c;for(a=0;a<(b=d.length);++a){c=d[a];c.tryToPerform("parentViewDidResize",e)}},beginLiveResize:function(){if(this.willBeginLiveResize){this.willBeginLiveResize()}var d=this.get("childViews"),b=d.length,a,c;for(a=0;a<b;++a){c=d[a];if(c.beginLiveResize){c.beginLiveResize()}}return this},endLiveResize:function(){var d=this.get("childViews"),b=d.length,a,c;for(a=b-1;a>=0;--a){c=d[a];if(c.endLiveResize){c.endLiveResize()}}if(this.didEndLiveResize){this.didEndLiveResize()}return this},updateLayout:function(a){this._doUpdateLayout(a);return this},renderLayout:function(a){a.setStyle(this.get("layoutStyle"))},_doUpdateLayout:function(b){var d=this.get("_isRendered"),a=this.get("isVisibleInWindow"),c=true;if(d){if(a||b){this._doUpdateLayoutStyle()}else{this._layoutStyleNeedsUpdate=true}}else{c=false}return c},_doUpdateLayoutStyle:function(){var c=this.get("layer"),a=this.get("layoutStyle");for(var b in a){c.style[b]=a[b]}this._layoutStyleNeedsUpdate=false;this._updatedLayout()},_notifyDidAttach:function(){if(this.get("useStaticLayout")){this.viewDidResize()}if(this.didAppendToDocument){this.didAppendToDocument()}},_adopted:function(b){var a=this.get("isFixedSize");if(a){this._sc_viewFrameDidChange()}else{this.viewDidResize()}arguments.callee.base.apply(this,arguments)},_orphaned:function(){arguments.callee.base.apply(this,arguments);if(!this.isDestroyed){var a=this.get("isFixedSize");if(a){this._sc_viewFrameDidChange()}else{this.viewDidResize()}}},_updatedContent:function(){arguments.callee.base.apply(this,arguments);if(this.get("useStaticLayout")){this.viewDidResize()}},_updatedLayout:function(){this.didRenderAnimations()}});SC.View.mixin({convertLayoutToAnchoredLayout:function(f,m){var h={top:0,left:0,width:m.width,height:m.height},d=m.width,k=m.height,l=f.right,a=f.left,j=f.top,g=f.bottom,i=f.width,e=f.height,c=f.centerX,b=f.centerY;if(!SC.none(a)){if(SC.isPercentage(a)){h.left=a*d}else{h.left=a}if(i!==undefined){if(i===SC.LAYOUT_AUTO){h.width=SC.LAYOUT_AUTO}else{if(SC.isPercentage(i)){h.width=i*d}else{h.width=i}}}else{if(l&&SC.isPercentage(l)){h.width=d-h.left-(l*d)}else{h.width=d-h.left-(l||0)}}}else{if(!SC.none(l)){if(SC.none(i)){h.left=0;if(l&&SC.isPercentage(l)){h.width=d-(l*d)}else{h.width=d-(l||0)}}else{if(i===SC.LAYOUT_AUTO){h.width=SC.LAYOUT_AUTO}else{if(SC.isPercentage(i)){h.width=i*d}else{h.width=i}if(SC.isPercentage(l)){h.left=d-(h.width+l)}else{h.left=d-(h.width+l)}}}}else{if(!SC.none(c)){if(i&&SC.isPercentage(i)){h.width=(i*d)}else{h.width=(i||0)}h.left=((d-h.width)/2);if(SC.isPercentage(c)){h.left=h.left+c*d}else{h.left=h.left+c}}else{if(!SC.none(i)){h.left=0;if(i===SC.LAYOUT_AUTO){h.width=SC.LAYOUT_AUTO}else{if(SC.isPercentage(i)){h.width=i*d}else{h.width=i}}}else{h.left=0;h.width=0}}}}if(f.minWidth!==undefined){h.minWidth=f.minWidth}if(f.maxWidth!==undefined){h.maxWidth=f.maxWidth}if(!SC.none(j)){if(SC.isPercentage(j)){h.top=j*k}else{h.top=j}if(e!==undefined){if(e===SC.LAYOUT_AUTO){h.height=SC.LAYOUT_AUTO}else{if(SC.isPercentage(e)){h.height=e*k}else{h.height=e}}}else{h.height=k-h.top;if(g&&SC.isPercentage(g)){h.height=h.height-(g*k)}else{h.height=h.height-(g||0)}}}else{if(!SC.none(g)){if(SC.none(e)){h.top=0;if(g&&SC.isPercentage(g)){h.height=k-(g*k)}else{h.height=k-(g||0)}}else{if(e===SC.LAYOUT_AUTO){h.height=SC.LAYOUT_AUTO}else{if(SC.isPercentage(e)){h.height=e*k}else{h.height=e}h.top=k-h.height;if(SC.isPercentage(g)){h.top=h.top-(g*k)}else{h.top=h.top-g}}}}else{if(!SC.none(b)){if(e&&SC.isPercentage(e)){h.height=(e*k)}else{h.height=(e||0)}h.top=((k-h.height)/2);if(SC.isPercentage(b)){h.top=h.top+b*k}else{h.top=h.top+b}}else{if(!SC.none(e)){h.top=0;if(e===SC.LAYOUT_AUTO){h.height=SC.LAYOUT_AUTO}else{if(SC.isPercentage(e)){h.height=e*k}else{h.height=e}}}else{h.top=0;h.height=0}}}}if(h.top){h.top=Math.floor(h.top)}if(h.bottom){h.bottom=Math.floor(h.bottom)}if(h.left){h.left=Math.floor(h.left)}if(h.right){h.right=Math.floor(h.right)}if(h.width!==SC.LAYOUT_AUTO){h.width=Math.floor(h.width)}if(h.height!==SC.LAYOUT_AUTO){h.height=Math.floor(h.height)}if(f.minHeight!==undefined){h.minHeight=f.minHeight}if(f.maxHeight!==undefined){h.maxHeight=f.maxHeight}return h},convertLayoutToCustomLayout:function(b,a,c){}});sc_require("views/view");sc_require("views/view/layout");sc_require("views/view/layout_style");SC.View.reopen({wantsAcceleratedLayer:NO,hasAcceleratedLayer:function(){return(SC.platform.supportsCSSTransforms&&this.get("wantsAcceleratedLayer")&&this.get("isFixedLayout"))}.property("wantsAcceleratedLayer","isFixedLayout").cacheable()});sc_require("views/view");SC.View.reopen({cursor:function(a,c){var b;if(c){this._setCursor=c}if(this._setCursor!==undefined){return this._setCursor}b=this.get("parentView");if(this.get("shouldInheritCursor")&&b){return b.get("cursor")}return null}.property("parentView","shouldInheritCursor").cacheable(),shouldInheritCursor:YES});sc_require("views/view");SC.CoreView.mixin({ENABLED:8,IS_DISABLED:16,DISABLED:17,DISABLED_BY_PARENT:18,DISABLED_AND_BY_PARENT:19});SC.View.reopen({enabledState:SC.CoreView.ENABLED,isEnabled:YES,isEnabledBindingDefault:SC.Binding.oneWay().bool(),isEnabledInPane:function(){return this.get("enabledState")===SC.CoreView.ENABLED}.property("enabledState").cacheable(),shouldInheritEnabled:true,_doEnable:function(){var b=true,a=this.get("enabledState");if(a===SC.CoreView.DISABLED){this._callOnChildViews("_parentDidEnableInPane");this._gotoEnabledState()}else{if(a===SC.CoreView.DISABLED_AND_BY_PARENT){this._gotoDisabledByParentState()}else{b=false}}return b},_doDisable:function(){var b=true,a=this.get("enabledState");if(a===SC.CoreView.ENABLED){this._callOnChildViews("_parentDidDisableInPane");this._gotoDisabledState();if(this.get("isFirstResponder")){this.resignFirstResponder()}}else{if(a===SC.CoreView.DISABLED_BY_PARENT){this._gotoDisabledAndByParentState()}else{b=false}}return b},_sc_view_isEnabledDidChange:function(){this.invokeOnce(this._doUpdateEnabled)}.observes("isEnabled"),_doUpdateEnabled:function(){var a=this.get("viewState");if(this.get("isEnabled")){this._doEnable()}else{this._doDisable()}switch(a){case SC.CoreView.ATTACHED_SHOWN:case SC.CoreView.ATTACHED_SHOWING:case SC.CoreView.ATTACHED_BUILDING_IN:this._doUpdateEnabledStyle();break;default:this._enabledStyleNeedsUpdate=true}},_doUpdateEnabledStyle:function(){var a=this.get("isEnabled");this.$().toggleClass("disabled",!a);this.$().attr("aria-disabled",!a?true:null);this._enabledStyleNeedsUpdate=false},_parentDidEnableInPane:function(){var a=this.get("enabledState");if(this.get("shouldInheritEnabled")){if(a===SC.CoreView.DISABLED_BY_PARENT){this._gotoEnabledState()}else{if(a===SC.CoreView.DISABLED_AND_BY_PARENT){this._gotoDisabledState();return false}}}else{return false}},_parentDidDisableInPane:function(){var a=this.get("enabledState");if(this.get("shouldInheritEnabled")){if(a===SC.CoreView.ENABLED){this._gotoDisabledByParentState()}else{if(a===SC.CoreView.DISABLED){this._gotoDisabledAndByParentState()}else{return false}}}else{return false}},_gotoEnabledState:function(){this.set("enabledState",SC.CoreView.ENABLED)},_gotoDisabledState:function(){this.set("enabledState",SC.CoreView.DISABLED)},_gotoDisabledAndByParentState:function(){this.set("enabledState",SC.CoreView.DISABLED_AND_BY_PARENT)},_gotoDisabledByParentState:function(){this.set("enabledState",SC.CoreView.DISABLED_BY_PARENT)}});sc_require("views/view");SC.View.reopen({isKeyResponder:NO,willLoseKeyResponderTo:function(a){},willBecomeKeyResponderFrom:function(a){},didLoseKeyResponderTo:function(a){},didBecomeKeyResponderFrom:function(a){},interpretKeyEvents:function(b){var a=b.commandCodes(),d=a[0],e=a[1],h,f,i,g,c,j;if(!d&&!e){return null}if(d){f=d.match(/[^_]+$/);i=SC.MODIFIED_KEY_BINDINGS[d];if(!i&&f&&f.length>0){i=SC.BASE_KEY_BINDINGS[f[0]]}if(i){g=this;c=this.get("pane");j=null;while(g&&!(j=g.tryToPerform(i,b))){g=(g===c)?null:g.get("nextResponder")}return j}}if(e&&this.respondsTo("insertText")){h=this.insertText(e,b);return h?(h===YES?this:h):null}return null},insertText:function(a){return NO},performKeyEquivalent:function(f,d){var e=NO,g=this.get("childViews"),b=g.length,a=-1,c;while(!e&&(++a<b)){c=g[a];e=c.tryToPerform("performKeyEquivalent",f,d)}return e},firstKeyView:null,_getFirstKeyView:function(){var a=this.get("firstKeyView");if(a){return a}var b=this.get("childViews");if(b){return b[0]}},lastKeyView:null,_getLastKeyView:function(){var d=this.get("lastKeyView");if(d){return d}var a,b=this.get("firstKeyView");if(b){while(a=b._getNextKeyView()){b=a}return b}else{var c=this.get("childViews");if(c){return c[c.length-1]}}},nextKeyView:undefined,_getNextKeyView:function(){var b=this.get("parentView"),a=this.get("nextKeyView");if(b&&b.get("lastKeyView")===this){return null}if(a!==undefined){return a}if(b){var c=b.get("childViews");return c[c.indexOf(this)+1]}},nextValidKeyView:function(){var b=this,a;while(a!==this){a=null;if(b.get("isVisibleInWindow")){a=b._getFirstKeyView()}if(!a){a=b._getNextKeyView()}if(!a){while(b=b.get("parentView")){if(a=b._getNextKeyView()){break}}}if(!a){if(!SC.TABBING_ONLY_INSIDE_DOCUMENT){break}else{a=this.get("pane")}}if(a.get("isVisibleInWindow")&&a.get("acceptsFirstResponder")){return a}b=a}return null}.property("nextKeyView"),previousKeyView:undefined,_getPreviousKeyView:function(){var b=this.get("parentView"),a=this.get("previousKeyView");if(b&&b.get("firstKeyView")===this){return null}if(a!==undefined){return a}if(b){var c=b.get("childViews");return c[c.indexOf(this)-1]}},previousValidKeyView:function(){var b=this,a;while(a!==this){if(b.get("parentView")){a=b._getPreviousKeyView()}else{if(!SC.TABBING_ONLY_INSIDE_DOCUMENT){break}else{a=b}}if(a){do{b=a;a=a._getLastKeyView()}while(a&&a.get("isVisibleInWindow"));if(!a){a=b}}else{a=b.get("parentView")}if(a.get("isVisibleInWindow")&&a.get("acceptsFirstResponder")){return a}b=a}return null}.property("previousKeyView")});sc_require("views/view");SC.View.reopen({layerIdDidChange:function(){var a=this.get("layer"),b=this.get("layerId"),c=this._lastLayerId;if(b!==c){if(c&&SC.View.views[c]===this){delete SC.View.views[c]}this._lastLayerId=b;SC.View.views[b]=this;if(a){a.id=b}}}.observes("layerId"),insertBefore:function(a,b){a.beginPropertyChanges();if(a.resetBuildState){a.resetBuildState()}a._doAdopt(this,b);a.endPropertyChanges();return this},replaceChild:function(a,b){a.beginPropertyChanges();b.beginPropertyChanges();this.beginPropertyChanges();this.insertBefore(a,b).removeChild(b);this.endPropertyChanges();b.endPropertyChanges();a.endPropertyChanges();return this},replaceAllChildren:function(c){this.beginPropertyChanges();this.removeAllChildren(true);for(var b=0,a=c.get("length");b<a;b++){this.appendChild(c.objectAt(b))}this.endPropertyChanges();return this},appendChild:function(a){return this.insertBefore(a,null)},buildInChild:function(a){a.willBuildInToView(this);this.appendChild(a);a.buildInToView(this)},buildOutChild:function(a){a.buildOutFromView(this)},buildInDidFinishFor:function(a){},buildOutDidFinishFor:function(a){this.removeChild(a)},isBuildingIn:NO,isBuildingOut:NO,buildIn:function(){this.buildInDidFinish()},buildOut:function(){this.buildOutDidFinish()},resetBuild:function(){},buildOutDidCancel:function(){},buildInDidCancel:function(){},buildInDidFinish:function(){this.isBuildingIn=NO;this._buildingInTo.buildInDidFinishFor(this);this._buildingInTo=null},buildOutDidFinish:function(){this.isBuildingOut=NO;this._buildingOutFrom.buildOutDidFinishFor(this);this._buildingOutFrom=null},resetBuildState:function(){if(this.isBuildingIn){this.buildInDidCancel();this.isBuildingIn=NO}if(this.isBuildingOut){this.buildOutDidCancel();this.isBuildingOut=NO}this.buildingInTo=null;this.buildingOutFrom=null;this.resetBuild()},willBuildInToView:function(a){if(this.isBuildingOut){this.buildOutDidCancel()}},buildInToView:function(a){if(this.isBuildingIn){return}this._buildingInTo=a;this.isBuildingOut=NO;this.isBuildingIn=YES;this.buildIn()},buildOutFromView:function(a){if(this.isBuildingOut){return}if(this.isBuildingIn){this.buildInDidCancel()}this.isBuildingOut=YES;this.isBuildingIn=NO;this._buildingOutFrom=a;this.buildOut()}});sc_require("views/view");SC.View.reopen({themeName:null,baseThemeName:null,theme:function(){var b=this.get("baseTheme"),a=this.get("themeName");if(a){var c;if(b){c=b.find(a);if(c){return c}}c=SC.Theme.find(a);if(c){return c}return b.invisibleSubtheme(a)}return b}.property("baseTheme","themeName").cacheable(),_sc_view_themeDidChange:function(){var d=this.get("theme");if(this._lastTheme===d){return}this._lastTheme=d;var c=this.childViews,b=c.length,a;for(a=0;a<b;a++){c[a].notifyPropertyChange("baseTheme")}if(this.get("layer")){this.replaceLayer()}}.observes("theme"),baseTheme:function(){var b;var a=this.get("baseThemeName");if(a){return SC.Theme.find(a)}else{b=this.get("parentView");var c=b&&b.get("theme");return c||SC.Theme.find(SC.defaultTheme)}}.property("baseThemeName","parentView").cacheable(),renderDelegate:function(c,d){if(d){this._setRenderDelegate=d}if(this._setRenderDelegate){return this._setRenderDelegate}var a=this.get("renderDelegateName"),b;if(a){b=this.get("theme")[a];if(!b){throw new Error('%@: Unable to locate render delegate "%@" in theme.'.fmt(this,a))}return b}return null}.property("renderDelegateName","theme"),renderDelegateName:null,renderDelegateProxy:function(){return SC.View._RenderDelegateProxy.createForView(this)}.property("renderDelegate").cacheable(),render:function(b,c){var a=this.get("renderDelegate");if(a){if(c){a.render(this.get("renderDelegateProxy"),b)}else{a.update(this.get("renderDelegateProxy"),b.$())}}},invokeRenderDelegateMethod:function(c,b){var a=this.get("renderDelegate");if(!a){return undefined}if(SC.typeOf(a[c])!==SC.T_FUNCTION){return undefined}b=SC.$A(arguments);b.shift();b.unshift(this.get("renderDelegateProxy"));return a[c].apply(a,b)}});SC.View._RenderDelegateProxy={createForView:function(c){var d=SC.beget(this);var f=c.get("displayProperties"),e={};for(var b=0,a=f.length;b<a;b++){e[f[b]]=YES}e.theme=YES;d._displayPropertiesLookup=e;d.renderState={};d._view=c;return d},get:function(b){if(this[b]!==undefined){return this[b]}var a="display"+b.capitalize();if(this._displayPropertiesLookup[a]){return this._view.get(a)}else{return this._view.get(b)}},didChangeFor:function(d){var b=arguments.length,a;for(a=1;a<b;a++){var e=arguments[a],c="display"+e.capitalize();if(this._displayPropertiesLookup[c]){if(this._view.didChangeFor(d,c)){return YES}}else{if(this._view.didChangeFor(d,e)){return YES}}}return NO}};SC.propertyFromRenderDelegate=function(a,b){return function(f,g){if(g!==undefined){this["_set_rd_"+f]=g}var d=this["_set_rd_"+f];if(d!==undefined){return d}var c=this.get("renderDelegate");if(c&&c.get){var e=this.get("renderDelegateProxy");d=c.getPropertyFor(e,a)}if(d!==undefined){return d}return b}.property("renderDelegate").cacheable()};sc_require("views/view");SC.View.reopen({acceptsMultitouch:NO,hasTouch:NO,touchBoundary:{left:25,right:25,top:25,bottom:25},_touchBoundaryFrame:function(){var b=this.get("touchBoundary"),a;a=this.get("parentView").convertFrameToView(this.get("frame"),null);a.x-=b.left;a.y-=b.top;a.width+=b.left+b.right;a.height+=b.top+b.bottom;return a}.property("touchBoundary","clippingFrame").cacheable(),touchIsInBoundary:function(a){return SC.pointInRect({x:a.pageX,y:a.pageY},this.get("_touchBoundaryFrame"))}});sc_require("views/view");SC.View.reopen({hasVisibility:YES,isContextMenuEnabled:function(){return SC.CONTEXT_MENU_ENABLED}.property(),recomputeIsVisibleInWindow:function(){return this}});sc_require("views/view");sc_require("views/view/acceleration");sc_require("views/view/cursor");sc_require("views/view/enabled");sc_require("views/view/keyboard");sc_require("views/view/layout");sc_require("views/view/manipulation");sc_require("views/view/theming");sc_require("views/view/touch");sc_require("views/view/visibility");sc_require("mixins/responder_context");SC.MIXED_STATE="__MIXED__";SC.Pane=SC.View.extend(SC.ResponderContext,{isPane:YES,page:null,rootResponder:null,sendEvent:function(c,a,d,b){if(!d){d=this.get("firstResponder")}while(d){if(c==="touchStart"){if(a.touchResponder===d){d=null;break}if(!d.get("hasTouch")||d.get("acceptsMultitouch")){if(d.tryToPerform("touchStart",a)){break}}}else{if(c==="touchEnd"&&!d.get("acceptsMultitouch")){if(!d.get("hasTouch")){if(d.tryToPerform("touchEnd",a)){break}}}else{if(d.tryToPerform(c,a)){break}}}d=(d===this)?null:d.get("nextResponder");if(d===b){return(a&&a.mouseHandler)||null}}if(!d&&(d=this.get("defaultResponder"))){if(typeof d===SC.T_STRING){d=SC.objectForPropertyPath(d)}if(!d){d=null}else{d=d.tryToPerform(c,a)?d:null}}else{if(!d&&!(d=this.get("defaultResponder"))){d=this.tryToPerform(c,a)?this:null}}return(a&&a.mouseHandler)||d},nextResponder:function(){return null}.property().cacheable(),firstResponder:null,acceptsKeyPane:YES,isKeyPane:NO,becomeKeyPane:function(){if(this.get("isKeyPane")){return this}if(this.rootResponder){this.rootResponder.makeKeyPane(this)}return this},resignKeyPane:function(){if(!this.get("isKeyPane")){return this}if(this.rootResponder){this.rootResponder.makeKeyPane(null)}return this},makeFirstResponder:function(c,b,a){if(!b){b=this}var e=this.get("firstResponder"),d=this.get("isKeyPane");if(e===b){return this}if(d){if(e){e.tryToPerform("willLoseKeyResponderTo",b)}if(b){b.tryToPerform("willBecomeKeyResponderFrom",e)}}if(e){e.beginPropertyChanges();e.set("isKeyResponder",NO)}if(b){b.beginPropertyChanges();b.set("isKeyResponder",d)}c(b,a);if(e){e.endPropertyChanges()}if(b){b.endPropertyChanges()}if(d){if(b){b.tryToPerform("didBecomeKeyResponderFrom",e)}if(e){e.tryToPerform("didLoseKeyResponderTo",b)}}return this}.enhance(),willLoseKeyPaneTo:function(a){this._forwardKeyChange(this.get("isKeyPane"),"willLoseKeyResponderTo",a,NO);return this},willBecomeKeyPaneFrom:function(a){this._forwardKeyChange(!this.get("isKeyPane"),"willBecomeKeyResponderFrom",a,YES);return this},didBecomeKeyResponderFrom:function(a){},didLoseKeyPaneTo:function(b){var a=this.get("isKeyPane");this.set("isKeyPane",NO);this._forwardKeyChange(a,"didLoseKeyResponderTo",b);return this},didBecomeKeyPaneFrom:function(b){var a=this.get("isKeyPane");this.set("isKeyPane",YES);this._forwardKeyChange(!a,"didBecomeKeyResponderFrom",b,YES);return this},isMainPane:NO,focusFrom:function(a){},blurTo:function(a){},blurMainTo:function(a){this.set("isMainPane",NO)},focusMainFrom:function(a){this.set("isMainPane",YES)},append:function(){return this.appendTo(document.body)},remove:function(){if(this.get("isAttached")){this._doDetach()}return this},insert:function(b){this.createLayer();var a=this.get("layer");b(a);return this},appendTo:function(b){var a=this;return this.insert(function(){a._doAttach(jQuery(b)[0])})},paneDidAttach:function(){},recomputeDependentProperties:function(){},isPaneAttached:function(){return this.get("isAttached")}.property("isAttached").cacheable(),wantsTouchIntercept:NO,hasTouchIntercept:function(){return this.get("wantsTouchIntercept")&&SC.platform.touch}.property("wantsTouchIntercept").cacheable(),zIndex:0,touchZ:99,_addIntercept:function(){if(this.get("hasTouchIntercept")){var b=document.createElement("div");var a=b.style;a.position="absolute";a.left="0px";a.top="0px";a.right="0px";a.bottom="0px";a[SC.browser.experimentalStyleNameFor("transform")]="translateZ(0px)";a.zIndex=this.get("zIndex")+this.get("touchZ");b.className="touch-intercept";b.id="touch-intercept-"+SC.guidFor(this);this._touchIntercept=b;document.body.appendChild(b)}},_removeIntercept:function(){if(this._touchIntercept){document.body.removeChild(this._touchIntercept);this._touchIntercept=null}},hideTouchIntercept:function(){if(this._touchIntercept){this._touchIntercept.style.display="none"}},showTouchIntercept:function(){if(this._touchIntercept){this._touchIntercept.style.display="block"}},init:function(){var a=!!this.get("layer");arguments.callee.base.apply(this,arguments);if(a){this._attached()}},classNames:["sc-pane"]});sc_require("panes/pane");SC.Pane.reopen({performKeyEquivalent:function(c,a){var b=arguments.callee.base.apply(this,arguments);if(!b){var d=this.get("defaultResponder");if(d){if(d.performKeyEquivalent){b=d.performKeyEquivalent(c,a)}if(!b&&d.tryToPerform){b=d.tryToPerform(c,a)}}}return b},keyDown:function(a){var b;if(a.keyCode===9&&!this.get("firstResponder")){if(a.shiftKey){b=this.get("previousValidKeyView")}else{b=this.get("nextValidKeyView")}if(b){this.makeFirstResponder(b);return YES}else{if(!SC.TABBING_ONLY_INSIDE_DOCUMENT){a.allowDefault()}}}return NO},_forwardKeyChange:function(d,b,g,f){var c,a,e;if(d&&(a=this.get("firstResponder"))){e=(g)?g.get("firstResponder"):null;c=this.get("firstResponder");if(c&&c[b]){c[b](e)}if((f!==undefined)&&a){a.set("isKeyResponder",f)}}}});sc_require("panes/pane");SC.Pane.reopen({currentWindowSize:null,computeParentDimensions:function(c){if(this.get("designer")&&SC.suppressMain){return arguments.callee.base.apply(this,arguments)}var d={x:0,y:0,width:1000,height:1000},b=this.get("layout");if(document&&document.body){d.width=document.body.clientWidth;d.height=document.body.clientHeight;if(SC.browser.name===SC.BROWSER.ie&&SC.browser.compare(SC.browser.version,"7")===0){var a=SC.platform.get("scrollbarSize");if(document.body.scrollWidth>d.width){d.width-=a}if(document.body.scrollHeight>d.height){d.height-=a}}}if(b.minHeight||b.minWidth){if(b.minHeight){d.height=Math.max(d.height,b.minHeight)}if(b.minWidth){d.width=Math.max(d.width,b.minWidth)}}return d},windowSizeDidChange:function(b,a){this.set("currentWindowSize",a);this.setBodyOverflowIfNeeded();this.parentViewDidResize(a);return this},setBodyOverflowIfNeeded:function(e){var d=this.get("layout"),b=this.get("currentWindowSize");if(!d||!b||!b.width||!b.height){return}var a=d.minWidth,c=d.minHeight;if(e===true||a||c){if((c&&b.height<c)||(a&&b.width<a)){SC.bodyOverflowArbitrator.requestVisible(this)}else{SC.bodyOverflowArbitrator.requestHidden(this)}}},unsetBodyOverflowIfNeeded:function(){SC.bodyOverflowArbitrator.withdrawRequest(this)}});sc_require("panes/pane");SC.Pane.reopen({prependTo:function(b){var a=this;return this.insert(function(){var c=jQuery(b)[0];a._doAttach(c,c.firstChild)})},removeFromParent:function(){SC.throw("SC.Pane cannot be removed from its parent, since it's the root. Did you mean remove()?")}});sc_require("panes/pane");SC.Pane.reopen({_executeDoAttach:function(){var a=(this.rootResponder=SC.RootResponder.responder);a.panes.add(this);this.set("currentWindowSize",a.currentWindowSize);this.updateDesignMode(this.get("designMode"),a.get("currentDesignMode"));arguments.callee.base.apply(this,arguments);this.paneDidAttach();this.recomputeDependentProperties();this._addIntercept();if(!this.get("isFixedSize")){this.viewDidResize()}},_executeDoDetach:function(){arguments.callee.base.apply(this,arguments);this._removeIntercept();var a=this.rootResponder;a.panes.remove(this);this.rootResponder=null}});SC.BENCHMARK_LOG_READY=YES;sc_require("system/event");SC.mixin({isReady:NO,suppressOnReady:SC.suppressOnReady?YES:NO,suppressMain:SC.suppressMain?YES:NO,ready:function(b,c){var a=SC._readyQueue;if(c===undefined){c=b;b=null}else{if(SC.typeOf(c)===SC.T_STRING){c=b[c]}}if(SC.isReady){jQuery(document).ready(function(){c.call(b)})}else{if(!a){SC._readyQueue=[]}SC._readyQueue.push(function(){c.call(b)})}return this},onReady:{done:function(){if(SC.isReady){return}SC.isReady=true;SC.RunLoop.begin();SC.Locale.createCurrentLocale();var d=SC.Locale.currentLanguage.toLowerCase();jQuery("body").addClass(d);jQuery("html").attr("lang",d);jQuery("#loading").remove();var c=SC._readyQueue,b,a;if(c){for(b=0,a=c.length;b<a;b++){c[b].call()}SC._readyQueue=null}if(window.main&&!SC.suppressMain&&(SC.mode===SC.APP_MODE)){window.main()}SC.RunLoop.end()}}});if(!SC.suppressOnReady){$(document).ready(SC.onReady.done)}SC.APP_MODE="APP_MODE";SC.TEST_MODE="TEST_MODE";SC.mode=SC.APP_MODE;SC.UNSUPPORTED="_sc_unsupported";SC.platform=SC.Object.create({scrollbarSize:function(){var a=document.createElement("DIV"),d;a.innerHTML="<div style='height:1px;'></div>";a.style.cssText="position:absolute;width:100px;height:100px;overflow-y:visible;";d=a.childNodes[0];document.body.appendChild(a);var b=d.innerWidth||d.clientWidth;a.style.overflowY="scroll";var c=d.innerWidth||d.clientWidth;document.body.removeChild(a);return b-c}.property().cacheable(),touch:(!SC.none(window.ontouchstart)||SC.browser.name===SC.BROWSER.android||"ontouchstart" in document.documentElement)&&SC.none(window._phantom),bounceOnScroll:SC.browser.os===SC.OS.ios,pinchToZoom:SC.browser.os===SC.OS.ios,a:function(){var a=document.createElement("a");return{download:!!("download" in a),media:!!("media" in a),ping:!!("ping" in a)}}(),input:function(d){var e={},c=d.length,f=document.createElement("input"),b,a;for(a=0;a<c;a++){b=d[a];e[b]=!!(b in f)}return e}(["autocomplete","readonly","list","size","required","multiple","maxlength","pattern","min","max","step","placeholder","selectionStart","selectionEnd","selectionDirection"]),standalone:!!navigator.standalone,cssPrefix:SC.browser.cssPrefix,domCSSPrefix:SC.browser.domPrefix,simulateTouchEvents:function(){if(this.touch){return}SC.Logger.log("Simulating touch events");SC.platform.touch=YES;SC.platform.bounceOnScroll=YES;document.body.className=document.body.className+" touch";this._simtouch_counter=1;this.removeEvents(["click","dblclick","mouseout","mouseover","mousewheel"]);this.replaceEvent("mousemove",this._simtouch_mousemove);this.replaceEvent("mousedown",this._simtouch_mousedown);this.replaceEvent("mouseup",this._simtouch_mouseup);SC.platform.windowSizeDeterminesOrientation=YES;SC.device.orientationHandlingShouldChange()},removeEvents:function(d){var b,a=d.length,c;for(b=0;b<a;b++){c=d[b];SC.Event.remove(document,c,SC.RootResponder.responder,SC.RootResponder.responder[c])}},replaceEvent:function(a,b){SC.Event.remove(document,a,SC.RootResponder.responder,SC.RootResponder.responder[a]);SC.Event.add(document,a,this,b)},_simtouch_mousemove:function(a){if(!this._mousedown){if(a.altKey&&this._pinchCenter===null){this._pinchCenter={pageX:a.pageX,pageY:a.pageY,screenX:a.screenX,screenY:a.screenY,clientX:a.clientX,clientY:a.clientY}}else{if(!a.altKey&&this._pinchCenter!==null){this._pinchCenter=null}}return NO}var b=this.manufactureTouchEvent(a,"touchmove");return SC.RootResponder.responder.touchmove(b)},_simtouch_mousedown:function(a){this._mousedown=YES;var b=this.manufactureTouchEvent(a,"touchstart");return SC.RootResponder.responder.touchstart(b)},_simtouch_mouseup:function(a){var c=this.manufactureTouchEvent(a,"touchend"),b=SC.RootResponder.responder.touchend(c);this._mousedown=NO;this._simtouch_counter++;return b},manufactureTouchEvent:function(k,j){var c,l,f=this._simtouch_counter;c={type:j,target:k.target,identifier:f,pageX:k.pageX,pageY:k.pageY,screenX:k.screenX,screenY:k.screenY,clientX:k.clientX,clientY:k.clientY};k.touches=[c];if(k.altKey&&this._pinchCenter!==null){var h=this._pinchCenter.pageX+this._pinchCenter.pageX-k.pageX,g=this._pinchCenter.pageY+this._pinchCenter.pageY-k.pageY,e=this._pinchCenter.screenX+this._pinchCenter.screenX-k.screenX,d=this._pinchCenter.screenY+this._pinchCenter.screenY-k.screenY,b=this._pinchCenter.clientX+this._pinchCenter.clientX-k.clientX,a=this._pinchCenter.clientY+this._pinchCenter.clientY-k.clientY,i=this._simtouch_counter+1;l={type:j,target:k.target,identifier:i,pageX:h,pageY:g,screenX:e,screenY:d,clientX:b,clientY:a};k.touches=[c,l]}k.changedTouches=k.touches;return k},supportsCSSAnimations:SC.browser.experimentalStyleNameFor("animation")!==SC.UNSUPPORTED,supportsCSSTransitions:SC.browser.experimentalStyleNameFor("transition")!==SC.UNSUPPORTED,supportsCSSTransforms:SC.browser.experimentalStyleNameFor("transform")!==SC.UNSUPPORTED,supportsCSS3DTransforms:SC.browser.experimentalStyleNameFor("perspective")!==SC.UNSUPPORTED,supportsApplicationCache:("applicationCache" in window),supportsHashChange:function(){return("onhashchange" in window)&&(document.documentMode===undefined||document.documentMode>7)}(),supportsHistory:function(){return !!(window.history&&window.history.pushState)}(),supportsIndexedDB:function(){return !!(window.indexedDB||window[SC.browser.domPrefix+"IndexedDB"])}(),supportsCanvas:function(){return !!document.createElement("canvas").getContext}(),supportsXHR2ProgressEvent:("ProgressEvent" in window),supportsXHR2FormData:("FormData" in window),supportsXHR2LoadEndEvent:function(){return(new XMLHttpRequest).onloadend===null}(),supportsOrientationChange:("onorientationchange" in window),supportsWebSQL:("openDatabase" in window),windowSizeDeterminesOrientation:SC.browser.os===SC.OS.ios||!("onorientationchange" in window),cordova:(typeof window.cordova!=="undefined")});SC.ready(function(){var a=function(j,h,m,i){var l=SC.browser.domPrefix,g=l.toLowerCase(),k=h+"EventName",n=function(o){var r=SC.browser.domPrefix,p=r.toLowerCase(),q=h+"EventName";j.removeEventListener(h,n,NO);j.removeEventListener(p+h,n,NO);j.removeEventListener(p+m,n,NO);j.removeEventListener(r+m,n,NO);if(o){SC.platform[q]=o.type;o.stopPropagation()}if(i){i(!!o)}};SC.platform[k]=SC.UNSUPPORTED;j.addEventListener(h,n,NO);j.addEventListener(g+h,n,NO);j.addEventListener(g+m,n,NO);j.addEventListener(l+m,n,NO)};if(SC.platform.supportsCSSTransitions){var e=document.createElement("div"),d=SC.browser.experimentalStyleNameFor("transition","all 1ms linear");e.style[d]="all 1ms linear";a(e,"transitionend","TransitionEnd",function(g){if(g){SC.RootResponder.responder.cleanUpTransitionListeners()}else{SC.platform.supportsCSSTransitions=NO}e.parentNode.removeChild(e);e=null});document.documentElement.appendChild(e);setTimeout(function(){e.style.opacity="0"});if(SC.platform.supportsCSSAnimations){var c=document.createElement("div"),f,b;f="@keyframes _sc_animation_test { from { opacity: 1; } to { opacity: 0; } }";b="@"+SC.browser.cssPrefix+"keyframes _sc_prefixed_animation_test { from { opacity: 1; } to { opacity: 0; } }";c.innerHTML="<style>"+f+"\n"+b+"</style>";c.style.animation="_sc_animation_test 1ms linear";c.style[SC.browser.domPrefix+"Animation"]="_sc_prefixed_animation_test 5ms linear";a(c,"animationend","AnimationEnd",function(j){if(j){var i=SC.browser.domPrefix,g=i.toLowerCase(),h=SC.platform.animationendEventName;switch(h){case g+"animationend":SC.platform.animationstartEventName=g+"animationstart";SC.platform.animationiterationEventName=g+"animationiteration";break;case g+"AnimationEnd":SC.platform.animationstartEventName=g+"AnimationStart";SC.platform.animationiterationEventName=g+"AnimationIteration";break;case i+"AnimationEnd":SC.platform.animationstartEventName=i+"AnimationStart";SC.platform.animationiterationEventName=i+"AnimationIteration";break;default:SC.platform.animationstartEventName="animationstart";SC.platform.animationiterationEventName="animationiteration"}SC.RootResponder.responder.cleanUpAnimationListeners()}else{SC.platform.supportsCSSAnimations=NO}c.parentNode.removeChild(c);c=null});document.documentElement.appendChild(c)}}});SC.Touch=function(d,a){this.touchContext=a;this.identifier=d.identifier;var c=d.target,b;if(c&&SC.$(c).hasClass("touch-intercept")){d.target.style[SC.browser.experimentalStyleNameFor("transform")]="translate3d(0px,-5000px,0px)";c=document.elementFromPoint(d.pageX,d.pageY);if(c){b=SC.viewFor(c)}this.hidesTouchIntercept=NO;if(c.tagName==="INPUT"){this.hidesTouchIntercept=d.target}else{d.target.style[SC.browser.experimentalStyleNameFor("transform")]="translate3d(0px,0px,0px)"}}else{b=d.target?SC.viewFor(d.target):null}this.targetView=b;this.target=c;this.type=d.type;this.touchResponders=[];this.startX=this.pageX=d.pageX;this.startY=this.pageY=d.pageY;this.clientX=d.clientX;this.clientY=d.clientY;this.screenX=d.screenX;this.screenY=d.screenY};SC.Touch.prototype={touchContext:null,identifier:null,target:null,targetView:null,view:null,touchResponder:null,hasEnded:NO,type:null,clickCount:1,timeStamp:null,clientX:null,clientY:null,screenX:null,screenY:null,pageX:null,pageY:null,startX:null,startY:null,velocityX:0,velocityY:0,unhideTouchIntercept:function(){var a=this.hidesTouchIntercept;if(a){setTimeout(function(){a.style[SC.browser.experimentalStyleNameFor("transform")]="translate3d(0px,0px,0px)"},500)}},allowDefault:function(){if(this.event){this.event.hasCustomEventHandling=YES}},preventDefault:function(){if(this.event){this.event.preventDefault()}},stopPropagation:function(){if(this.event){this.event.stopPropagation()}},stop:function(){if(this.event){this.event.stop()}},end:function(){this.touchContext.endTouch(this)},nextTouchResponder:null,touchResponders:null,candidateTouchResponders:null,stackNextTouchResponder:function(a,b){this.makeTouchResponder(a,YES,b)},restoreLastTouchResponder:function(){if(this.nextTouchResponder){this.makeTouchResponder(this.nextTouchResponder)}else{var b=this.candidateTouchResponders,a=b?b.pop():null;if(a){this.makeTouchResponder(a)}}},makeTouchResponder:function(b,c,a){return this.touchContext.makeTouchResponder(this,b,c,a)},stackCandidateTouchResponder:function(a){if(!this.candidateTouchResponders){this.candidateTouchResponders=[a]}else{if(a!==this.candidateTouchResponders[this.candidateTouchResponders.length-1]){this.candidateTouchResponders.push(a)}}},captureTouch:function(a,b){return this.touchContext.captureTouch(this,a,b)},touchesForView:function(a){return this.touchContext.touchesForView(a)},touchesForResponder:function(a){return this.touchContext.touchesForView(a)},averagedTouchesForView:function(a,b){return this.touchContext.averagedTouchesForView(a,(b?this:null))}};SC.mixin(SC.Touch,{create:function(b,a){return new SC.Touch(b,a)},averagedTouch:function(d,b){var e=d.length,a=0,l=0,g=0,f=0,h,c;if(b===undefined){b={}}for(h=0;h<e;h++){c=d[h];a+=c.pageX;l+=c.pageY;g+=c.velocityX;f+=c.velocityY}a/=e;l/=e;g/=e;f/=e;var i=0;for(h=0;h<e;h++){c=d[h];var k=Math.abs(c.pageX-a);var j=Math.abs(c.pageY-l);i+=Math.pow(k*k+j*j,0.5)}i/=e;b.x=a;b.y=l;b.velocityX=g;b.velocityY=f;b.d=i;return b}});sc_require("system/ready");sc_require("system/platform");sc_require("system/touch");SC.CAPTURE_BACKSPACE_KEY=NO;SC.RootResponder=SC.Object.extend({panes:null,init:function(){arguments.callee.base.apply(this,arguments);this.panes=SC.Set.create()},mainPane:null,makeMainPane:function(b){var a=this.get("mainPane");if(a===b){return this}this.beginPropertyChanges();if(this.get("keyPane")===a){this.makeKeyPane(b)}this.set("mainPane",b);if(a){a.blurMainTo(b)}if(b){b.focusMainFrom(a)}this.endPropertyChanges();return this},menuPane:null,makeMenuPane:function(b){if(b&&!b.get("acceptsMenuPane")){return this}else{var a=this.get("menuPane");if(a===b){return this}this.set("menuPane",b)}return this},keyPane:null,previousKeyPanes:[],makeKeyPane:function(f){var e,a,d;if(f){if(!f.get("acceptsKeyPane")){return this}else{a=this.get("keyPane");if(a===f){return this}else{if(a){d=this.get("previousKeyPanes");d.push(a)}e=f}}}else{a=this.get("keyPane");d=this.get("previousKeyPanes");e=null;var c;while(d.length>0){c=d.pop();if(c.get("isVisibleInWindow")&&c.get("acceptsKeyPane")){e=c;break}}}if(!e){var b=this.get("mainPane");if(b&&b.get("acceptsKeyPane")){e=b}}if(a){a.willLoseKeyPaneTo(e)}if(e){e.willBecomeKeyPaneFrom(a)}this.set("keyPane",e);if(e){e.didBecomeKeyPaneFrom(a)}if(a){a.didLoseKeyPaneTo(e)}return this},currentWindowSize:null,computeWindowSize:function(){var c,b,a;if(!this._bod||!this._docElement){b=document.body;a=document.documentElement;this._bod=b;this._docElement=a}else{b=this._bod;a=this._docElement}if(window.innerHeight){c={width:window.innerWidth,height:window.innerHeight}}else{if(a&&a.clientHeight){c={width:a.clientWidth,height:a.clientHeight}}else{if(b){c={width:b.clientWidth,height:b.clientHeight}}}}return c},resize:function(){this._resize();this._assignDesignMode();return YES},_resize:function(){var a=this.computeWindowSize(),b=this.get("currentWindowSize");this.set("currentWindowSize",a);if(!SC.rectsEqual(a,b)){SC.run(function(){SC.device.windowSizeDidChange(a);if(this.panes){if(b!==a){this.panes.invoke("windowSizeDidChange",b,a)}}},this)}},_assignDesignMode:function(){var a=this.computeDesignMode(),b=this.get("currentDesignMode");if(b!==a){this.set("currentDesignMode",a);if(this.panes){SC.run(function(){this.panes.invoke("updateDesignMode",b,a)},this)}}},hasFocus:NO,focus:function(a){if(!this.get("hasFocus")){SC.$("body").addClass("sc-focus").removeClass("sc-blur");SC.run(function(){if(!SC.TABBING_ONLY_INSIDE_DOCUMENT&&!SC.browser.isIE8OrLower){var b=SC.RootResponder.responder.get("keyPane");if(b){var c=b.get("nextValidKeyView");if(c){b.makeFirstResponder(c)}}}this.set("hasFocus",YES)},this)}return YES},focusin:function(a){if(this._focusTimeout){clearTimeout(this._focusTimeout)}this.focus(a)},focusout:function(a){var b=this;this._focusTimeout=setTimeout(function(){b.blur(a)},300)},blur:function(a){if(this.get("hasFocus")){SC.$("body").addClass("sc-blur").removeClass("sc-focus");SC.run(function(){this.set("hasFocus",NO)},this)}return YES},dragDidStart:function(a){this._mouseDownView=a;this._drag=a},currentDesignMode:null,designModes:function(a,b){if(SC.none(b)){if(this._designModeNames){delete this._designModeNames;delete this._designModeThresholds}b=null}else{this._prepOrderedArrays(b)}this._assignDesignMode();return b}.property().cacheable(),computeDesignMode:function(){var e=null,c=this._designModeNames,h=this._designModeThresholds,g,f;if(!c){return null}g=this.get("currentWindowSize");f=(g.width*g.height);var d,a;for(d=0,a=h.get("length");d<a;d++){var b=h.objectAt(d);if(f<b){e=c.objectAt(d);break}}if(SC.none(e)&&c&&c.get("length")>0){e=c.objectAt(d)}return SC.device.orientation===SC.PORTRAIT_ORIENTATION?e+"_p":e+"_l"},fallbackDesignMode:function(d){var c=this._designModeNames,b,a=null;b=c.indexOf(d);if(b>=0){a=c[b-1]}return a},_prepOrderedArrays:function(e){var a,f;if(e){a=this._designModeNames=[];f=this._designModeThresholds=[];var c;outer:for(c in e){var b,d;d=e[c];inner:for(b=f.length-1;b>=0;b--){if(f[b]<d){break inner}}b+=1;a.splice(b,0,c);f.splice(b,0,d)}}},defaultResponder:null,sendAction:function(d,e,c,f,b,a){e=this.targetForAction(d,e,c,f,a);if(e){if(e.isResponderContext){return !!e.sendAction(d,c,b,a)}else{return e.tryToPerform(d,c,b)}}},_responderFor:function(d,b,a){var c=d?d.get("defaultResponder"):null;if(d){d=a||d.get("firstResponder")||d;do{if(d.respondsTo(b)){return d}}while((d=d.get("nextResponder")))}if(typeof c===SC.T_STRING){c=SC.objectForPropertyPath(c)}if(!c){return null}else{if(c.isResponderContext){return c}else{if(c.respondsTo(b)){return c}else{return null}}}},targetForAction:function(c,f,e,g,a){if(!c||(SC.typeOf(c)!==SC.T_STRING)){return null}if(f){if(SC.typeOf(f)===SC.T_STRING){f=SC.objectForPropertyPath(f)||SC.objectForPropertyPath(f,e)}if(f&&!f.isResponderContext){if(f.respondsTo&&!f.respondsTo(c)){f=null}else{if(SC.typeOf(f[c])!==SC.T_FUNCTION){f=null}}}return f}if(g){f=this._responderFor(g,c,a);if(f){return f}}var b=this.get("keyPane"),d=this.get("mainPane");if(b&&(b!==g)){f=this._responderFor(b,c)}if(!f&&d&&(d!==b)){f=this._responderFor(d,c)}if(!f&&(f=this.get("defaultResponder"))){if(SC.typeOf(f)===SC.T_STRING){f=SC.objectForPropertyPath(f);if(f){this.set("defaultResponder",f)}}if(f&&!f.isResponderContext){if(f.respondsTo&&!f.respondsTo(c)){f=null}else{if(SC.typeOf(f[c])!==SC.T_FUNCTION){f=null}}}}return f},targetViewForEvent:function(a){var b=null;if(a.target){b=SC.viewFor(a.target)}return b},sendEvent:function(d,a,e){var f,c;SC.run(function b(){if(e){f=e.get("pane")}else{f=this.get("menuPane")||this.get("keyPane")||this.get("mainPane")}c=(f)?f.sendEvent(d,a,e):null},this);return c},listenFor:function(d,c,b,a){b=b?b:this;d.forEach(function(e){var f=b[e];if(f){SC.Event.add(c,e,b,f,null,a)}},this);c=null;return b},setup:function(){this.listenFor(["touchstart","touchmove","touchend","touchcancel","keydown","keyup","beforedeactivate","mousedown","mouseup","dragenter","dragover","dragleave","drop","click","dblclick","mousemove","contextmenu"],document).listenFor(["resize"],window);if(SC.browser.isIE8OrLower){this.listenFor(["focusin","focusout"],document)}else{this.listenFor(["focus","blur"],window)}if(this.keypress){if(SC.CAPTURE_BACKSPACE_KEY&&SC.browser.isMozilla){var d=this;document.onkeypress=function(f){f=SC.Event.normalizeEvent(f);return d.keypress.call(d,f)}}else{SC.Event.add(document,"keypress",this,this.keypress)}}if(SC.platform.supportsCSSTransitions){var c=SC.browser.domPrefix,a=c.toLowerCase(),j=a+"transitionend",h=a+"TransitionEnd",g=c+"TransitionEnd";this[j]=this[h]=this[g]=this.transitionend;this.listenFor(["transitionend",j,h,g],document);if(SC.platform.supportsCSSAnimations){j=a+"animationstart";h=a+"AnimationStart";g=c+"AnimationStart";this[j]=this[h]=this[g]=this.animationstart;this.listenFor(["animationstart",j,h,g],document);j=a+"animationiteration";h=a+"AnimationIteration";g=c+"AnimationIteration";this[j]=this[h]=this[g]=this.animationiteration;this.listenFor(["animationiteration",j,h,g],document);j=a+"animationend";h=a+"AnimationEnd";g=c+"AnimationEnd";this[j]=this[h]=this[g]=this.animationend;this.listenFor(["animationend",j,h,g],document)}}["drag","selectstart"].forEach(function(k){var l=this[k];if(l){if(SC.browser.isIE){var f=this;document.body["on"+k]=function(m){return l.call(f,SC.Event.normalizeEvent(event||window.event))};SC.Event.add(window,"unload",this,function(){document.body["on"+k]=null})}else{SC.Event.add(document,k,this,l)}}},this);var i="mousewheel";if(SC.browser.isMozilla){if(SC.browser.compare(SC.browser.engineVersion,"1.9.1")<0){i="DOMMouseScroll"}else{i="MozMousePixelScroll"}}SC.Event.add(document,i,this,this.mousewheel);this.set("currentWindowSize",this.computeWindowSize());if(SC.browser.os===SC.OS.ios&&SC.browser.name===SC.BROWSER.safari){if(SC.platform&&!SC.platform.touch){SC.platform.simulateTouchEvents()}var e=SC.RunLoop.prototype.endRunLoop,b;b=function(){if(e){e.apply(this,arguments)}var n=SC.RootResponder.responder._touches,p,k,m,l=NO;if(n){for(p in n){if(n[p]._rescuedElement){continue}m=k=n[p].target;while(k&&(k=k.parentNode)&&!l){l=(k===document.body)}if(!l&&m){if(m.parentNode&&m.cloneNode){var o=m.cloneNode(true);m.parentNode.replaceChild(o,m);m.swapNode=o}var f=SC.touchHoldingPen;if(!f){f=SC.touchHoldingPen=document.createElement("div");f.style.display="none";document.body.appendChild(f)}f.appendChild(m);n[p]._rescuedElement=m}}}};SC.RunLoop.prototype.endRunLoop=b}},cleanUpTransitionListeners:function(){var a=SC.platform.transitionendEventName,c=SC.browser.domPrefix,b=c.toLowerCase(),f=b+"transitionend",e=b+"TransitionEnd",d=c+"TransitionEnd";["transitionend",f,e,d].forEach(function(g){if(g!==a){SC.Event.remove(document,g,this,this[g]);this[g]=null}})},cleanUpAnimationListeners:function(){var c=SC.browser.domPrefix,b=c.toLowerCase(),a=SC.platform.animationendEventName,f=b+"animationend",e=b+"AnimationEnd",d=c+"AnimationEnd";["animationend",f,e,d].forEach(function(g){if(g!==a){SC.Event.remove(document,g,this,this[g]);this[g]=null}});a=SC.platform.animationiterationEventName;f=b+"animationiteration";e=b+"AnimationIteration";d=c+"AnimationIteration";["animationiteration",f,e,d].forEach(function(g){if(g!==a){SC.Event.remove(document,g,this,this[g]);this[g]=null}});a=SC.platform.animationstartEventName;f=b+"animationstart";e=b+"AnimationStart";d=c+"AnimationStart";["animationstart",f,e,d].forEach(function(g){if(g!==a){SC.Event.remove(document,g,this,this[g]);this[g]=null}})},_touchedViews:{},_touches:{},touchesForView:function(a){if(this._touchedViews[SC.guidFor(a)]){return this._touchedViews[SC.guidFor(a)].touches}},averagedTouchesForView:function(b,f){var e=this.touchesForView(b),a,d,h;d=b._scrr_averagedTouches||(b._scrr_averagedTouches={});if((!e||e.length===0)&&!f){d.x=0;d.y=0;d.d=0;d.velocityX=0;d.velocityY=0}else{var g=this._averagedTouches_touches||(this._averagedTouches_touches=[]);if(e){var c;a=e.length;for(c=0;c<a;c++){g.push(e[c]);if(f&&e[c]===f){h=YES}}}if(f&&!h){g.push(f)}SC.Touch.averagedTouch(g,d);g.length=0}return d},assignTouch:function(b,a){if(b.hasEnded){throw new Error("Attempt to assign a touch that is already finished.")}if(b.view===a){return}if(b.view){this.unassignTouch(b)}if(!this._touchedViews[SC.guidFor(a)]){this._touchedViews[SC.guidFor(a)]={view:a,touches:SC.CoreSet.create([]),touchCount:0};a.set("hasTouch",YES)}b.view=a;this._touchedViews[SC.guidFor(a)].touches.add(b);this._touchedViews[SC.guidFor(a)].touchCount++},unassignTouch:function(c){var a,b;if(!c.view){return}a=c.view;b=this._touchedViews[SC.guidFor(a)];b.touches.remove(c);b.touchCount--;if(b.touchCount<1){a.set("hasTouch",NO);b.view=null;delete this._touchedViews[SC.guidFor(a)]}c.view=undefined},_flushQueuedTouchResponder:function(){if(this._queuedTouchResponder){var a=this._queuedTouchResponder;this._queuedTouchResponder=null;this.makeTouchResponder.apply(this,a)}},makeTouchResponder:function(f,d,c,k){if(this._isMakingTouchResponder){this._queuedTouchResponder=[f,d,c,k];return YES}this._isMakingTouchResponder=YES;var h=f.touchResponders,b;if(f.touchResponder===d){this._isMakingTouchResponder=NO;this._flushQueuedTouchResponder();return YES}var a;if(d){a=d.get("pane")}else{a=this.get("keyPane")||this.get("mainPane")}if(h.indexOf(d)<0){if(k){try{d=a?a.sendEvent("touchStart",f,d,k):null}catch(g){SC.Logger.error("Error in touchStart: "+g);d=null}}else{if(d&&((d.get?d.get("acceptsMultitouch"):d.acceptsMultitouch)||!d.hasTouch)){if(!d.respondsTo("touchStart")){d=null}else{if(d.touchStart(f)===NO){d=null}}}}}if(!c||(h.indexOf(d)>-1&&h[h.length-1]!==d)){this.unassignTouch(f);var i=h.length-1,j=h[i];while(j&&j!==d){b=this.touchesForView(j);if((j.get?j.get("acceptsMultitouch"):j.acceptsMultitouch)||!b){if(j.touchCancelled){j.touchCancelled(f)}}i--;j=h[i];h.pop();f.touchResponder=h[i];f.nextTouchResponder=h[i-1]}}if(d){this.assignTouch(f,d);if(d!==f.touchResponder){h.push(d);f.touchResponder=d;f.nextTouchResponder=h[h.length-2]}}this._isMakingTouchResponder=NO;this._flushQueuedTouchResponder();return !!d},captureTouch:function(h,e,g){if(!e){e=this}var f=h.targetView,c=f,d=[],b,a;while(c&&(c!==e)){d.unshift(c);c=c.get("nextResponder")}for(a=d.length,b=0;b<a;b++){c=d[b];if(c.tryToPerform("captureTouch",h)){this.makeTouchResponder(h,c,g,e);return YES}}return NO},_touchCount:0,endTouch:function(b,g,c){if(!g){g="touchEnd"}var a,f,d,e;this.unassignTouch(b);if(b.touchResponder){e=b.touchResponder;f=b.touchResponders;a=f.length-1;d=f[a];while(d){if(d[g]){d[g](b,c)}if(b.touchResponder!==e){break}a--;d=f[a];g="touchCancelled"}}},finishTouch:function(b){this.unassignTouch(b);var a=b._rescuedElement;if(a){if(a.swapNode&&a.swapNode.parentNode){a.swapNode.parentNode.replaceChild(a,a.swapNode)}else{if(a.parentNode===SC.touchHoldingPen){SC.touchHoldingPen.removeChild(a)}}delete b._rescuedElement;a.swapNode=null;a=null}b.touchResponders=null;b.touchResponder=null;b.nextTouchResponder=null;b.hasEnded=YES;if(this._touches[b.identifier]){delete this._touches[b.identifier]}},touchstart:function(a){if(this.ignoreTouchHandle(a)){return YES}var b=NO;SC.run(function(){var f=a.changedTouches,e=f.length,d,h,c;a.touchContext=this;for(d=0;d<e;d++){h=f[d];c=SC.Touch.create(h,this);if(!c.targetView){continue}if(c.hidesTouchIntercept){b=YES}c.timeStamp=a.timeStamp;this._touches[h.identifier]=c;c.event=a;var g=this.captureTouch(c,this);if(!g){this.makeTouchResponder(c,c.targetView,NO,YES)}c.event=null}a.touchContext=null},this);if(b){return YES}return a.hasCustomEventHandling},touchmove:function(a){if(this.ignoreTouchHandle(a)){return YES}SC.run(function(){var e=a.changedTouches,d,q,n,h=e.length,m,l,k,p,i={},j,f=NO;if(this._drag){d=SC.Touch.create(a.changedTouches[0],this);this._drag.tryToPerform("mouseDragged",d)}for(n=0;n<h;n++){d=e[n];q=this._touches[d.identifier];if(!q){continue}if(q.hidesTouchIntercept){f=YES}var c=a.timeStamp-q.timeStamp,o,b,g;if(c!==0){o=Math.min(1,c/80);b=(d.pageX-q.pageX)/c;q.velocityX=(1-o)*q.velocityX+o*(b);g=(d.pageY-q.pageY)/c;q.velocityY=(1-o)*q.velocityY+o*(g)}q.pageX=d.pageX;q.pageY=d.pageY;q.clientX=d.clientX;q.clientY=d.clientY;q.screenX=d.screenX;q.screenY=d.screenY;q.timeStamp=a.timeStamp;q.type=a.type;q.event=a;if(q.touchResponder){m=q.touchResponder;j=SC.guidFor(m);if(!i[j]){i[j]={view:m,touches:[]}}i[j].touches.push(q)}}if(f){a.allowDefault();return YES}for(n in i){m=i[n].view;l=i[n].touches;a.viewChangedTouches=l;k=this.touchesForView(m);p=k.firstObject();a.pageX=p.pageX;a.pageY=p.pageY;a.clientX=p.clientX;a.clientY=p.clientY;a.screenX=p.screenX;a.screenY=p.screenY;a.startX=p.startX;a.startY=p.startY;a.velocityX=p.velocityX;a.velocityY=p.velocityY;a.touchContext=this;m.tryToPerform("touchesDragged",a,k)}e=a.changedTouches;h=e.length;for(n=0;n<h;n++){d=e[n];q=this._touches[d.identifier];if(q){q.event=null}}a.touchContext=null;a.viewChangedTouches=null},this);return a.hasCustomEventHandling},touchend:function(a){var b=NO;if(this.ignoreTouchHandle(a)){return YES}SC.run(function(){var g=a.changedTouches,f,l,j,i=g.length,e=a.isCancel?"touchCancelled":"touchEnd";for(j=0;j<i;j++){f=g[j];f.type="touchend";l=this._touches[f.identifier];if(!l){continue}var d=a.timeStamp-l.timeStamp,k,c,h;if(d!==0){k=Math.min(1,d/80);c=(f.pageX-l.pageX)/d;l.velocityX=(1-k)*l.velocityX+k*(c);h=(f.pageY-l.pageY)/d;l.velocityY=(1-k)*l.velocityY+k*(h)}l.timeStamp=a.timeStamp;l.pageX=f.pageX;l.pageY=f.pageY;l.clientX=f.clientX;l.clientY=f.clientY;l.screenX=f.screenX;l.screenY=f.screenY;l.type="touchend";l.event=a;if(l.hidesTouchIntercept){l.unhideTouchIntercept();b=YES}if(this._drag){this._drag.tryToPerform("mouseUp",f);this._drag=null}this.endTouch(l,e,a);this.finishTouch(l)}},this);if(b){return YES}return a.hasCustomEventHandling},touchcancel:function(a){a.isCancel=YES;this.touchend(a)},ignoreTouchHandle:function(b){if(SC.browser.isMobileSafari){var a=b.target.tagName;if(a==="INPUT"||a==="TEXTAREA"||a==="A"||a==="SELECT"){b.allowDefault();return YES}}return NO},attemptKeyEquivalent:function(b){var d=null;var c=b.commandCodes()[0];if(!c){return NO}var f=this.get("menuPane"),a=this.get("keyPane"),e=this.get("mainPane");if(f){d=f.performKeyEquivalent(c,b);if(d){return d}}if(a){d=a.performKeyEquivalent(c,b);if(d||a.get("isModal")){return d}}if(!d&&e&&(e!==a)){d=e.performKeyEquivalent(c,b);if(d||e.get("isModal")){return d}}return d},_lastModifiers:null,_handleModifierChanges:function(b){var a;a=this._lastModifiers=(this._lastModifiers||{alt:false,ctrl:false,shift:false});var c=false;if(b.altKey!==a.alt){a.alt=b.altKey;c=true}if(b.ctrlKey!==a.ctrl){a.ctrl=b.ctrlKey;c=true}if(b.shiftKey!==a.shift){a.shift=b.shiftKey;c=true}b.modifiers=a;return(c)?(this.sendEvent("flagsChanged",b)?b.hasCustomEventHandling:YES):YES},_isFunctionOrNonPrintableKey:function(a){return !!(a.altKey||a.ctrlKey||a.metaKey||SC.FUNCTION_KEYS[a.which])},_isModifierKey:function(a){return !!SC.MODIFIER_KEYS[a.charCode]},_isPrintableKey:function(a){return((a.originalEvent.which===undefined||a.originalEvent.which>0)&&!(a.which===8||a.which===9||a.which===13||a.which===27))},keydown:function(a){if(SC.none(a)){return YES}var e=a.keyCode;if(SC.browser.isMozilla&&a.keyCode===9){this.keydownCounter=1}if(e===229){this._IMEInputON=YES;return this.sendEvent("keyDown",a)}if(e===27&&this._drag){this._drag.cancelDrag(a);this._drag=null;this._mouseDownView=null;return YES}if(SC.browser.isMozilla&&(a.which===8)){return true}var b=this._handleModifierChanges(a),d=a.target||a.srcElement,c=(a.which===8)&&!SC.allowsBackspaceToPreviousPage&&(d===document.body);if(this._isModifierKey(a)){return(c?NO:b)}b=YES;if(this._isFunctionOrNonPrintableKey(a)){if(e>=37&&e<=40&&SC.browser.isMozilla){return YES}b=this.sendEvent("keyDown",a);if(!b){SC.run(function(){b=!this.attemptKeyEquivalent(a)},this)}else{b=a.hasCustomEventHandling;if(b){c=NO}}}return c?NO:b},keypress:function(b){var c,e=b.keyCode,f=SC.browser.isMozilla;if(f&&b.keyCode===9){this.keydownCounter++;if(this.keydownCounter===2){return YES}}if(f&&(b.which===8)){b.which=e;c=this.sendEvent("keyDown",b);return c?(SC.allowsBackspaceToPreviousPage||b.hasCustomEventHandling):YES}else{var d=(e>=37&&e<=40&&f),a=b.charCode;if((a!==undefined&&a===0&&b.keyCode!==9)&&!d){return YES}if(d){b.which=e}if(d||this._isPrintableKey(b)){return this.sendEvent("keyDown",b)?b.hasCustomEventHandling:YES}}},keyup:function(a){if(this._ffevt){this._ffevt=null}var b=this._handleModifierChanges(a);if(this._isModifierKey(a)){return b}if(this._IMEInputON&&a.keyCode===13){a.isIMEInput=YES;this.sendEvent("keyDown",a);this._IMEInputON=NO}return this.sendEvent("keyUp",a)?a.hasCustomEventHandling:YES},beforedeactivate:function(c){var b=c.toElement;if(b&&b.tagName&&b.tagName!=="IFRAME"){var a=SC.viewFor(b);if(a&&a.get("blocksIEDeactivate")){return NO}}return YES},mousedown:function(d){this._clickCount+=1;var c=this.targetViewForEvent(d);c=this._mouseDownView=this.sendEvent("mouseDown",d,c);if(c&&c.respondsTo("mouseDragged")){this._mouseCanDrag=YES}var e=c?d.hasCustomEventHandling:YES;this._lastMouseDownCustomHandling=e;if(!this._lastMouseUpAt||this._lastMouseDownView!==this._mouseDownView||((Date.now()-this._lastMouseUpAt)>250)){this._clickCount=1}else{var b=this._lastMouseDownX-d.clientX,a=this._lastMouseDownY-d.clientY,f=Math.sqrt(b*b+a*a);if(f>8){this._clickCount=1}}d.clickCount=this._clickCount;this._lastMouseDownView=this._mouseDownView;this._lastMouseDownX=d.clientX;this._lastMouseDownY=d.clientY;return e},mouseup:function(b){var g=NO,c=this._drag,f=null;if(c){SC.run(function(){c.tryToPerform("mouseUp",b)})}else{var a=this._mouseDownView,e=this.targetViewForEvent(b);b.clickCount=this._clickCount;if(a){f=this.sendEvent("mouseUp",b,a);if(!f&&this._clickCount===2){f=this.sendEvent("doubleClick",b,a);g=YES}if(!f){f=this.sendEvent("click",b,a);g=YES}}if(!f&&!g){if(this._clickCount===2){f=this.sendEvent("doubleClick",b,e)}if(!f){f=this.sendEvent("click",b,e)}}}this._mouseCanDrag=NO;this._mouseDownView=this._drag=null;this._lastMouseUpAt=Date.now();var d=f?b.hasCustomEventHandling:YES;this._lastMouseUpCustomHandling=d;return d},click:function(a){if(!this._lastMouseUpCustomHandling||!this._lastMouseDownCustomHandling){a.preventDefault();a.stopPropagation();return NO}return YES},dblclick:function(a){if(SC.browser.isIE8OrLower){this._clickCount=2;this.mouseup(a)}},mousewheel:function(b){var a=this.targetViewForEvent(b),c=this.sendEvent("mouseWheel",b,a);return(c)?b.hasCustomEventHandling:YES},_lastHovered:null,mousemove:function(a){if(SC.browser.isIE){if(this._lastMoveX===a.clientX&&this._lastMoveY===a.clientY){return}}this._lastMoveX=a.clientX;this._lastMoveY=a.clientY;SC.run(function(){var e=this._drag;if(e){if(SC.browser.isIE){if(this._lastMouseDownX!==a.clientX||this._lastMouseDownY!==a.clientY){e.tryToPerform("mouseDragged",a)}}else{e.tryToPerform("mouseDragged",a)}}else{var d=this._lastHovered||[],f=[],g,b,c=this.targetViewForEvent(a);while(c&&(c!==this)){f.push(c);c=c.get("nextResponder")}for(g=0,b=d.length;g<b;g++){c=d[g];if(f.indexOf(c)===-1&&!c.isDestroyed){c.tryToPerform("mouseExited",a)}}for(g=0,b=f.length;g<b;g++){c=f[g];if(d.indexOf(c)!==-1){c.tryToPerform("mouseMoved",a)}else{c.tryToPerform("mouseEntered",a)}}this._lastHovered=f;if(this._mouseDownView){if(SC.browser.isIE){if(this._lastMouseDownX!==a.clientX&&this._lastMouseDownY!==a.clientY){this._mouseDownView.tryToPerform("mouseDragged",a)}}else{this._mouseDownView.tryToPerform("mouseDragged",a)}}}},this)},dragenter:function(a){SC.run(function(){this._dragenter(a)},this)},_dragenter:function(a){if(!this._dragCounter){this._dragCounter=1}else{this._dragCounter++}return this._dragover(a)},dragleave:function(a){SC.run(function(){this._dragleave(a)},this)},_dragleave:function(a){this._dragCounter--;var b=this._dragover(a);return b},_forceDragLeave:function(){this.invokeLast(function(){if(this._dragCounter===0){return}this._dragCounter=0;var a=this._lastDraggedEvt;this._dragover(a)})},dragover:function(a){SC.run(function(){this._dragover(a)},this)},_dragover:function(c){if(c.dataTransfer.types&&(c.dataTransfer.types.contains("Files")||c.dataTransfer.types.contains("text/uri-list"))){c.preventDefault();c.stopPropagation();c.dataTransfer.dropEffect="none"}var d=this._lastDraggedOver||[],f=[],e,a,b=this.targetViewForEvent(c);while(b&&(b!==this)){f.push(b);b=b.get("nextResponder")}if(this._dragLeaveTimer){this._dragLeaveTimer.invalidate()}if(this._dragCounter===0){for(e=0,a=f.length;e<a;e++){b=f[e];b.tryToPerform("dataDragExited",c)}this._lastDraggedOver=this._lastDraggedEvt=this._dragLeaveTimer=null}else{if(c.type!=="dragleave"){for(e=0,a=d.length;e<a;e++){b=d[e];if(f.indexOf(b)===-1){b.tryToPerform("dataDragExited",c)}}for(e=f.length-1;e>=0;e--){b=f[e];if(d.indexOf(b)===-1){b.tryToPerform("dataDragEntered",c)}}for(e=0,a=f.length;e<a;e++){b=f[e];b.tryToPerform("dataDragHovered",c)}this._lastDraggedOver=f;this._lastDraggedEvt=c;this._dragLeaveTimer=SC.Timer.schedule({target:this,action:"_forceDragLeave",interval:300})}}},drop:function(a){SC.run(function(){this._drop(a)},this)},_drop:function(c){if(c.dataTransfer.types&&(c.dataTransfer.types.contains("Files")||c.dataTransfer.types.contains("text/uri-list"))){c.preventDefault();c.stopPropagation();c.dataTransfer.dropEffect="none"}var d=this._lastDraggedOver||[],f=[],e,a,b=this.targetViewForEvent(c);while(b&&(b!==this)){f.push(b);b=b.get("nextResponder")}for(e=0,a=d.length;e<a;e++){b=d[e];if(f.indexOf(b)===-1){b.tryToPerform("dataDragExited",c)}}for(e=0,a=f.length;e<a;e++){b=f[e];if(b.tryToPerform("dataDragDropped",c)){break}}for(e=0,a=f.length;e<a;e++){b=f[e];b.tryToPerform("dataDragExited",c)}this._lastDraggedOver=null;this._lastDraggedAt=null;this._dragCounter=0;if(this._dragLeaveTimer){this._dragLeaveTimer.invalidate()}this._dragLeaveTimer=null},_mouseCanDrag:YES,selectstart:function(b){var c=this.targetViewForEvent(b),a=this.sendEvent("selectStart",b,c);if(c&&c.respondsTo("mouseDragged")){return(a!==null?YES:NO)&&!this._mouseCanDrag}else{return(a!==null?YES:NO)}},drag:function(){return false},contextmenu:function(b){var a=this.targetViewForEvent(b),c;a=this.sendEvent("contextMenu",b,a);c=a?b.hasCustomEventHandling:YES;return c},animationstart:function(b){var a=this.targetViewForEvent(b);this.sendEvent("animationDidStart",b,a);return a?b.hasCustomEventHandling:YES},animationiteration:function(b){var a=this.targetViewForEvent(b);this.sendEvent("animationDidIterate",b,a);return a?b.hasCustomEventHandling:YES},animationend:function(b){var a=this.targetViewForEvent(b);this.sendEvent("animationDidEnd",b,a);return a?b.hasCustomEventHandling:YES},transitionend:function(b){var a=this.targetViewForEvent(b);this.sendEvent("transitionDidEnd",b,a);return a?b.hasCustomEventHandling:YES}});SC.ready(SC.RootResponder,SC.RootResponder.ready=function(){var a;a=SC.RootResponder.responder=SC.RootResponder.create();a.setup()});sc_require("system/root_responder");SC.Application=SC.Responder.extend(SC.ResponderContext,{designModes:{s:500000,m:2000000,l:Infinity},init:function(){arguments.callee.base.apply(this,arguments);SC.ready(this,"_setDesignModes")},_setDesignModes:function(){var b=this.get("designModes"),a=SC.RootResponder.responder;if(b){a.set("designModes",b)}}});SC.CubicBezierEquation=function(h,g,f,d){var e=function(i){return(1-i)*(1-i)*(1-i)};var c=function(i){return 3*i*(1-i)*(1-i)};var b=function(i){return 3*i*i*(1-i)};var a=function(i){return i*i*i};this.position=function(i){var j={};j.x=h.x*e(i)+g.x*c(i)+f.x*b(i)+d.x*a(i);j.y=h.y*e(i)+g.y*c(i)+f.y*b(i)+d.y*a(i);return j}};SC.easingCurve=function(i,h,f,d){var e={x:0,y:0},c={x:i,y:h},b={x:f,y:d},a={x:1,y:1};var g=new SC.CubicBezierEquation(e,c,b,a);g.value=function(j){j=Math.max(0,Math.min(j,1));return this.position(j).y};g.toString=function(){return"cubic-bezier(%@, %@, %@, %@)".fmt(i,h,f,d)};return g};SC.Color=SC.Object.extend(SC.Copyable,{original:null,isError:NO,errorValue:null,a:function(a,b){if(b===undefined){return this._a}else{if(this.get("isError")){b=this._a}this._a=b;return b}}.property().cacheable(),_a:1,r:function(a,b){if(b===undefined){return this._r}else{if(this.get("isError")){b=this._r}this._r=b;return b}}.property().cacheable(),_r:0,g:function(a,b){if(b===undefined){return this._g}else{if(this.get("isError")){b=this._g}this._g=b;return b}}.property().cacheable(),_g:0,b:function(a,b){if(b===undefined){return this._b}else{if(this.get("isError")){b=this._b}this._b=b;return b}}.property().cacheable(),_b:0,hue:function(c,d){var e=SC.Color.clampToDeviceGamut,a=SC.Color.rgbToHsl(e(this.get("r")),e(this.get("g")),e(this.get("b"))),b;if(d!==undefined){a[0]=(d%360+360)%360;b=SC.Color.hslToRgb(a[0],a[1],a[2]);this.beginPropertyChanges();this.set("r",b[0]);this.set("g",b[1]);this.set("b",b[2]);this.endPropertyChanges()}return a[0]}.property("r","g","b").cacheable(),saturation:function(c,d){var e=SC.Color.clampToDeviceGamut,a=SC.Color.rgbToHsl(e(this.get("r")),e(this.get("g")),e(this.get("b"))),b;if(d!==undefined){a[1]=SC.Color.clamp(d,0,1);b=SC.Color.hslToRgb(a[0],a[1],a[2]);this.beginPropertyChanges();this.set("r",b[0]);this.set("g",b[1]);this.set("b",b[2]);this.endPropertyChanges()}return a[1]}.property("r","g","b").cacheable(),luminosity:function(c,d){var e=SC.Color.clampToDeviceGamut,a=SC.Color.rgbToHsl(e(this.get("r")),e(this.get("g")),e(this.get("b"))),b;if(d!==undefined){a[2]=SC.Color.clamp(d,0,1);b=SC.Color.hslToRgb(a[0],a[1],a[2]);this.beginPropertyChanges();this.set("r",b[0]);this.set("g",b[1]);this.set("b",b[2]);this.endPropertyChanges()}return a[2]}.property("r","g","b").cacheable(),isEqualTo:function(a){return this.get("r")===a.get("r")&&this.get("g")===a.get("g")&&this.get("b")===a.get("b")&&this.get("a")===a.get("a")},toArgb:function(){var a=SC.Color.clampToDeviceGamut;return"#"+[a(255*this.get("a")),a(this.get("r")),a(this.get("g")),a(this.get("b"))].map(function(b){b=b.toString(16);return b.length===1?"0"+b:b}).join("")},toHex:function(){var a=SC.Color.clampToDeviceGamut;return"#"+[a(this.get("r")),a(this.get("g")),a(this.get("b"))].map(function(b){b=b.toString(16);return b.length===1?"0"+b:b}).join("")},toRgb:function(){var a=SC.Color.clampToDeviceGamut;return"rgb("+a(this.get("r"))+","+a(this.get("g"))+","+a(this.get("b"))+")"},toRgba:function(){var a=SC.Color.clampToDeviceGamut;return"rgba("+a(this.get("r"))+","+a(this.get("g"))+","+a(this.get("b"))+","+this.get("a")+")"},toHsl:function(){var a=Math.round;return"hsl("+a(this.get("hue"))+","+a(this.get("saturation")*100)+"%,"+a(this.get("luminosity")*100)+"%)"},toHsla:function(){var a=Math.round;return"hsla("+a(this.get("hue"))+","+a(this.get("saturation")*100)+"%,"+a(this.get("luminosity")*100)+"%,"+this.get("a")+")"},cssText:function(a,c){if(c===undefined){if(this.get("isError")){return this.get("errorValue")}if(this.get("a")===0){return"transparent"}var b=SC.Color.supportsRgba||SC.Color.supportsArgb;return(this.get("a")===1||!b)?this.toHex():SC.Color.supportsRgba?this.toRgba():this.toArgb()}else{var d=SC.Color._parse(c);this.beginPropertyChanges();if(!d){this._lastValidHash={r:this._r,g:this._g,b:this._b,a:this._a};this.set("r",0);this.set("g",0);this.set("b",0);this.set("a",0);this.set("errorValue",c);this.set("isError",YES)}else{this.setIfChanged("isError",NO);this.setIfChanged("errorValue",null);this.set("r",d.r);this.set("g",d.g);this.set("b",d.b);this.set("a",d.a)}this.endPropertyChanges();return c}}.property("r","g","b","a").cacheable(),validCssText:function(){if(this.get("isError")){return"transparent"}else{return this.get("cssText")}}.property("cssText","isError").cacheable(),reset:function(){if(!this.get("isError")){return this}var a=this._lastValidHash||{r:0,g:0,b:0,a:1};this.beginPropertyChanges();this.set("isError",NO);this.set("errorValue",null);this.set("r",a.r);this.set("g",a.g);this.set("b",a.b);this.set("a",a.a);this.endPropertyChanges();return this},copy:function(){return SC.Color.create({original:this.get("original"),r:this.get("r"),g:this.get("g"),b:this.get("b"),a:this.get("a"),isError:this.get("isError"),errorValue:this.get("errorValue")})},sub:function(a){return SC.Color.create({r:this.get("r")-a.get("r"),g:this.get("g")-a.get("g"),b:this.get("b")-a.get("b"),a:this.get("a")-a.get("a"),isError:this.get("isError")||a.get("isError")})},add:function(a){return SC.Color.create({r:this.get("r")+a.get("r"),g:this.get("g")+a.get("g"),b:this.get("b")+a.get("b"),a:this.get("a")+a.get("a"),isError:this.get("isError")})},mult:function(b){var a=Math.round;return SC.Color.create({r:a(this.get("r")*b),g:a(this.get("g")*b),b:a(this.get("b")*b),a:this.get("a")*b,isError:this.get("isError")})}});SC.Color.mixin({create:function(){var g={},a=NO,j=["a","r","g","b"],f,e,c,d,b,h;f=new Array(arguments.length);e=f.length;for(d=0;d<e;d++){c=arguments[d];if(SC.typeOf(c.a)===SC.T_NUMBER||SC.typeOf(c.r)===SC.T_NUMBER||SC.typeOf(c.g)===SC.T_NUMBER||SC.typeOf(c.b)===SC.T_NUMBER){a=YES;c=f[d]=SC.clone(c);for(b=0;b<4;b++){h=j[b];if(SC.typeOf(c[h])===SC.T_NUMBER){g["_"+h]=c[h];delete c[h]}}}else{f[d]=c}}if(a){f.push(g)}return SC.Object.create.apply(this,f)},supportsRgba:(function(){var c=document.getElementsByTagName("script")[0].style,b=c.cssText,a;c.cssText="background-color:rgba(5,2,1,.5)";a=c.backgroundColor.indexOf("rgba")!==-1;c.cssText=b;return a}()),supportsArgb:(function(){var c=document.getElementsByTagName("script")[0].style,b=c.cssText,a;c.cssText='filter: progid:DXImageTransform.Microsoft.gradient(startColorstr="#55000000", endColorstr="#55000000");';a=c.backgroundColor.indexOf("#55000000")!==-1;c.cssText=b;return a}()),clamp:function(c,b,a){return Math.max(Math.min(c,a),b)},clampInt:function(c,b,a){return Math.round(SC.Color.clamp(c,b,a))},clampToDeviceGamut:function(a){return SC.Color.clampInt(a,0,255)},hsvToRgb:function(j,x,u){j/=360;var a,l,o,e=Math.floor(j*6),m=j*6-e,d=u*(1-x),c=u*(1-(x*m)),w=u*(1-(x*(1-m))),n=[[u,w,d],[c,u,d],[d,u,w],[d,c,u],[w,d,u],[u,d,c]],k=SC.Color.clampToDeviceGamut;e=e%6;a=k(n[e][0]*255);l=k(n[e][1]*255);o=k(n[e][2]*255);return[a,l,o]},rgbToHsv:function(a,f,j){a/=255;f/=255;j/=255;var k=Math.max(a,f,j),c=Math.min(a,f,j),i=k-c,e,m=k===0?0:i/k,l=k;if(k===c){e=0}else{switch(k){case a:e=(f-j)/i+(f<j?6:0);break;case f:e=(j-a)/i+2;break;case j:e=(a-f)/i+4;break}e/=6}e*=360;return[e,m,l]},hslToRgb:function(f,e,b){f/=360;var d,c,a=SC.Color.hueToRgb,g=SC.Color.clampToDeviceGamut;c=b<=0.5?b*(e+1):b+e-b*e;d=b*2-c;return[g(a(d,c,f+1/3)*255),g(a(d,c,f)*255),g(a(d,c,f-1/3)*255)]},hueToRgb:function(b,a,c){if(c<0){c++}if(c>1){c--}if(c<1/6){return b+(a-b)*c*6}if(c<1/2){return a}if(c<2/3){return b+(a-b)*(2/3-c)*6}return b},rgbToHsl:function(a,i,k){a/=255;i/=255;k/=255;var m=Math.max(a,i,k),e=Math.min(a,i,k),f,n,c=(m+e)/2,j=m-e;if(m===e){f=n=0}else{n=c>0.5?j/(2-m-e):j/(m+e);switch(m){case a:f=(i-k)/j+(i<k?6:0);break;case i:f=(k-a)/j+2;break;case k:f=(a-i)/j+4;break}f/=6}f*=360;return[f,n,c]},PARSE_RGBA:/^rgba\(\s*([\d]+%?)\s*,\s*([\d]+%?)\s*,\s*([\d]+%?)\s*,\s*([.\d]+)\s*\)$/,PARSE_RGB:/^rgb\(\s*([\d]+%?)\s*,\s*([\d]+%?)\s*,\s*([\d]+%?)\s*\)$/,PARSE_HSLA:/^hsla\(\s*(-?[\d]+)\s*\s*,\s*([\d]+)%\s*,\s*([\d]+)%\s*,\s*([.\d]+)\s*\)$/,PARSE_HSL:/^hsl\(\s*(-?[\d]+)\s*,\s*([\d]+)%\s*,\s*([\d]+)%\s*\)$/,PARSE_HEX:/^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/,PARSE_ARGB:/^#[0-9a-fA-F]{8}$/,KEYWORDS:{aliceblue:"#F0F8FF",antiquewhite:"#FAEBD7",aqua:"#00FFFF",aquamarine:"#7FFFD4",azure:"#F0FFFF",beige:"#F5F5DC",bisque:"#FFE4C4",black:"#000000",blanchedalmond:"#FFEBCD",blue:"#0000FF",blueviolet:"#8A2BE2",brown:"#A52A2A",burlywood:"#DEB887",cadetblue:"#5F9EA0",chartreuse:"#7FFF00",chocolate:"#D2691E",coral:"#FF7F50",cornflowerblue:"#6495ED",cornsilk:"#FFF8DC",crimson:"#DC143C",cyan:"#00FFFF",darkblue:"#00008B",darkcyan:"#008B8B",darkgoldenrod:"#B8860B",darkgray:"#A9A9A9",darkgreen:"#006400",darkgrey:"#A9A9A9",darkkhaki:"#BDB76B",darkmagenta:"#8B008B",darkolivegreen:"#556B2F",darkorange:"#FF8C00",darkorchid:"#9932CC",darkred:"#8B0000",darksalmon:"#E9967A",darkseagreen:"#8FBC8F",darkslateblue:"#483D8B",darkslategray:"#2F4F4F",darkslategrey:"#2F4F4F",darkturquoise:"#00CED1",darkviolet:"#9400D3",deeppink:"#FF1493",deepskyblue:"#00BFFF",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1E90FF",firebrick:"#B22222",floralwhite:"#FFFAF0",forestgreen:"#228B22",fuchsia:"#FF00FF",gainsboro:"#DCDCDC",ghostwhite:"#F8F8FF",gold:"#FFD700",goldenrod:"#DAA520",gray:"#808080",green:"#008000",greenyellow:"#ADFF2F",grey:"#808080",honeydew:"#F0FFF0",hotpink:"#FF69B4",indianred:"#CD5C5C",indigo:"#4B0082",ivory:"#FFFFF0",khaki:"#F0E68C",lavender:"#E6E6FA",lavenderblush:"#FFF0F5",lawngreen:"#7CFC00",lemonchiffon:"#FFFACD",lightblue:"#ADD8E6",lightcoral:"#F08080",lightcyan:"#E0FFFF",lightgoldenrodyellow:"#FAFAD2",lightgray:"#D3D3D3",lightgreen:"#90EE90",lightgrey:"#D3D3D3",lightpink:"#FFB6C1",lightsalmon:"#FFA07A",lightseagreen:"#20B2AA",lightskyblue:"#87CEFA",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#B0C4DE",lightyellow:"#FFFFE0",lime:"#00FF00",limegreen:"#32CD32",linen:"#FAF0E6",magenta:"#FF00FF",maroon:"#800000",mediumaquamarine:"#66CDAA",mediumblue:"#0000CD",mediumorchid:"#BA55D3",mediumpurple:"#9370DB",mediumseagreen:"#3CB371",mediumslateblue:"#7B68EE",mediumspringgreen:"#00FA9A",mediumturquoise:"#48D1CC",mediumvioletred:"#C71585",midnightblue:"#191970",mintcream:"#F5FFFA",mistyrose:"#FFE4E1",moccasin:"#FFE4B5",navajowhite:"#FFDEAD",navy:"#000080",oldlace:"#FDF5E6",olive:"#808000",olivedrab:"#6B8E23",orange:"#FFA500",orangered:"#FF4500",orchid:"#DA70D6",palegoldenrod:"#EEE8AA",palegreen:"#98FB98",paleturquoise:"#AFEEEE",palevioletred:"#DB7093",papayawhip:"#FFEFD5",peachpuff:"#FFDAB9",peru:"#CD853F",pink:"#FFC0CB",plum:"#DDA0DD",powderblue:"#B0E0E6",purple:"#800080",red:"#FF0000",rosybrown:"#BC8F8F",royalblue:"#4169E1",saddlebrown:"#8B4513",salmon:"#FA8072",sandybrown:"#F4A460",seagreen:"#2E8B57",seashell:"#FFF5EE",sienna:"#A0522D",silver:"#C0C0C0",skyblue:"#87CEEB",slateblue:"#6A5ACD",slategray:"#708090",slategrey:"#708090",snow:"#FFFAFA",springgreen:"#00FF7F",steelblue:"#4682B4",tan:"#D2B48C",teal:"#008080",thistle:"#D8BFD8",tomato:"#FF6347",turquoise:"#40E0D0",violet:"#EE82EE",wheat:"#F5DEB3",white:"#FFFFFF",whitesmoke:"#F5F5F5",yellow:"#FFFF00",yellowgreen:"#9ACD32"},from:function(a){if(SC.kindOf(a,SC.Color)){return a.copy()}var b=SC.Color._parse(a),c=SC.Color;if(!b){return SC.Color.create({original:a,isError:YES})}return c.create({original:a,r:c.clampInt(b.r,0,255),g:c.clampInt(b.g,0,255),b:c.clampInt(b.b,0,255),a:c.clamp(b.a,0,1)})},_parse:function(f){var k=SC.Color,j=f,i,h,c,d=1,e=function(b){var a=parseInt(b,10);return b.slice(-1)==="%"?k.clampInt(a*2.55,0,255):k.clampInt(a,0,255)};if(k.KEYWORDS.hasOwnProperty(f)){f=k.KEYWORDS[f]}else{if(SC.none(f)||f===""){f="transparent"}}if(k.PARSE_RGB.test(f)){f=f.match(k.PARSE_RGB);i=e(f[1]);h=e(f[2]);c=e(f[3])}else{if(k.PARSE_RGBA.test(f)){f=f.match(k.PARSE_RGBA);i=e(f[1]);h=e(f[2]);c=e(f[3]);d=parseFloat(f[4],10)}else{if(k.PARSE_HEX.test(f)){if(f.length===4){f="#"+f.charAt(1)+f.charAt(1)+f.charAt(2)+f.charAt(2)+f.charAt(3)+f.charAt(3)}i=parseInt(f.slice(1,3),16);h=parseInt(f.slice(3,5),16);c=parseInt(f.slice(5,7),16)}else{if(k.PARSE_ARGB.test(f)){i=parseInt(f.slice(3,5),16);h=parseInt(f.slice(5,7),16);c=parseInt(f.slice(7,9),16);d=parseInt(f.slice(1,3),16)/255}else{if(k.PARSE_HSL.test(f)){f=f.match(k.PARSE_HSL);f=k.hslToRgb(((parseInt(f[1],10)%360+360)%360),k.clamp(parseInt(f[2],10)/100,0,1),k.clamp(parseInt(f[3],10)/100,0,1));i=f[0];h=f[1];c=f[2]}else{if(k.PARSE_HSLA.test(f)){f=f.match(k.PARSE_HSLA);d=parseFloat(f[4],10);f=k.hslToRgb(((parseInt(f[1],10)%360+360)%360),k.clamp(parseInt(f[2],10)/100,0,1),k.clamp(parseInt(f[3],10)/100,0,1));i=f[0];h=f[1];c=f[2]}else{if(f==="transparent"){i=h=c=0;d=0}else{return null}}}}}}}return{r:i,g:h,b:c,a:d}}});sc_require("system/core_query");sc_require("system/ready");sc_require("system/root_responder");sc_require("system/platform");SC.PORTRAIT_ORIENTATION="portrait";SC.LANDSCAPE_ORIENTATION="landscape";SC.NO_ORIENTATION="desktop";SC.device=SC.Object.create({orientation:SC.PORTRAIT_ORIENTATION,isOffline:NO,mouseLocation:function(){var a=SC.RootResponder.responder,c=a._lastMoveX,b=a._lastMoveY;if(SC.empty(c)||SC.empty(b)){return null}return{x:c,y:b}}.property(),init:function(){arguments.callee.base.apply(this,arguments);if(navigator&&navigator.onLine===false){this.set("isOffline",YES)}},setup:function(){var a=SC.RootResponder.responder;a.listenFor(["online","offline"],window,this);this.orientationHandlingShouldChange()},orientationHandlingShouldChange:function(){if(SC.platform.windowSizeDeterminesOrientation){SC.Event.remove(window,"orientationchange",this,this.orientationchange);this.windowSizeDidChange(SC.RootResponder.responder.get("currentWindowSize"))}else{if(SC.platform.supportsOrientationChange){SC.Event.add(window,"orientationchange",this,this.orientationchange);this.orientationchange()}}},windowSizeDidChange:function(a){if(SC.platform.windowSizeDeterminesOrientation){if(a.height>=a.width){SC.device.set("orientation",SC.PORTRAIT_ORIENTATION)}else{SC.device.set("orientation",SC.LANDSCAPE_ORIENTATION)}return YES}return NO},orientationchange:function(a){SC.run(function(){if(window.orientation===0||window.orientation===180){SC.device.set("orientation",SC.PORTRAIT_ORIENTATION)}else{SC.device.set("orientation",SC.LANDSCAPE_ORIENTATION)}})},orientationObserver:function(){var a=SC.$(document.body),b=this.get("orientation");if(b===SC.PORTRAIT_ORIENTATION){a.addClass("sc-portrait")}else{a.removeClass("sc-portrait")}if(b===SC.LANDSCAPE_ORIENTATION){a.addClass("sc-landscape")}else{a.removeClass("sc-landscape")}}.observes("orientation"),online:function(a){SC.run(function(){this.set("isOffline",NO)},this)},offline:function(a){SC.run(function(){this.set("isOffline",YES)},this)}});SC.ready(function(){SC.device.setup()});SC.MODIFIED_KEY_BINDINGS={"ctrl_.":"cancel",shift_tab:"insertBacktab",shift_left:"moveLeftAndModifySelection",shift_right:"moveRightAndModifySelection",shift_up:"moveUpAndModifySelection",shift_down:"moveDownAndModifySelection",alt_left:"moveLeftAndModifySelection",alt_right:"moveRightAndModifySelection",alt_up:"moveUpAndModifySelection",alt_down:"moveDownAndModifySelection",ctrl_a:"selectAll"};SC.BASE_KEY_BINDINGS={escape:"cancel",backspace:"deleteBackward","delete":"deleteForward","return":"insertNewline",tab:"insertTab",left:"moveLeft",right:"moveRight",up:"moveUp",down:"moveDown",home:"moveToBeginningOfDocument",end:"moveToEndOfDocument",pagedown:"pageDown",pageup:"pageUp"};SC.Page=SC.Object.extend({owner:null,get:function(a){var b=this[a];if(b&&b.isClass){this[a]=b=b.create({page:this});return b}else{return arguments.callee.base.apply(this,arguments)}},getIfConfigured:function(b){var a=this[b];return(a&&a.isViewClass)?null:this.get(b)},loc:function(c){var a,b;for(b in c){if(!c.hasOwnProperty(b)){continue}a=this[b];if(!a||!a.isViewClass){continue}a.loc(c[b])}return this}});SC.Page.design=SC.Page.create;SC.Page.localization=function(a){return a};sc_require("system/builder");SC.MODE_REPLACE="replace";SC.MODE_APPEND="append";SC.MODE_PREPEND="prepend";SC.NON_PIXEL_PROPERTIES=["zIndex","opacity"];SC.COMBO_STYLES={WebkitTransition:["WebkitTransitionProperty","WebkitTransitionDuration","WebkitTransitionDelay","WebkitTransitionTimingFunction"]};SC.RenderContext=SC.Builder.create({SELF_CLOSING:SC.CoreSet.create().addEach(["area","base","basefront","br","hr","input","img","link","meta"]),init:function(d,b){var a;if(b){this.prevObject=b;this.strings=b.strings;this.offset=b.length+b.offset}if(!this.strings){this.strings=[]}if(d===undefined){d="div";a=YES}else{if(d==="div"||d==="label"||d==="a"){a=YES}else{if(SC.typeOf(d)===SC.T_STRING){d=d.toLowerCase();a=YES}}}if(a){this._tagName=d;this._needsTag=YES;this.needsContent=YES;var e=this;while(e){e.length++;e=e.prevObject}this.strings.push(null);this._selfClosing=this.SELF_CLOSING.contains(d)}else{this._elem=d;this._needsTag=NO;this.length=0;this.needsContent=NO}return this},strings:null,offset:0,length:0,updateMode:SC.MODE_REPLACE,needsContent:NO,get:function(b){var a=this.strings||[];return(b===undefined)?a.slice(this.offset,this.length):a[b+this.offset]},html:function(a){return this.push(a)},push:function(d){var b=this.strings,a=arguments.length;if(!b){this.strings=b=[]}if(a>1){b.push.apply(b,arguments)}else{b.push(d)}var e=this;while(e){e.length+=a;e=e.prevObject}this.needsContent=YES;return this},text:function(){var b=arguments.length,a=0;for(a=0;a<b;a++){this.push(SC.RenderContext.escapeHTML(arguments[a]))}return this},join:function(b){if(this._needsTag){this.end()}var a=this.strings;return a?a.join(b||""):""},begin:function(a){return SC.RenderContext(a,this)},element:function(){return this._elem?this._elem:SC.$(this.join())[0]},remove:function(a){if(!a){return}var b,c=this._elem;if(!c||!c.removeChild){return}b=document.getElementById(a);if(b){b=c.removeChild(b);b=null}},update:function(){var c=this._elem,g=this.updateMode,e,d,a,f,b;if(!c){return}e=this.$();if(this.length>0){if(g===SC.MODE_REPLACE){e.html(this.join())}else{a=c.cloneNode(false);a.innerHTML=this.join();f=a.firstChild;while(f){b=f.nextSibling;c.insertBefore(f,b);f=b}f=b=a=null}}if(this._idDidChange&&(d=this._id)){e.attr("id",d)}c=this._elem=null;return this.prevObject||this},_DEFAULT_ATTRS:{},end:function(){var l="",b="",i,g,j=this._attrs,d=this._classes,a=this._id,k=this._styles,h,f;l="<"+this._tagName;if(j||d||k||a){if(!j){j=this._DEFAULT_ATTRS}if(a){j.id=a}if(d){j["class"]=d.join(" ")}if(k){for(i in k){if(!k.hasOwnProperty(i)){continue}g=k[i];if(g===null){continue}if(typeof g===SC.T_NUMBER&&!SC.NON_PIXEL_PROPERTIES.contains(i)){g+="px"}b=b+this._dasherizeStyleName(i)+": "+g+"; "}j.style=b}l=l+" ";for(i in j){if(!j.hasOwnProperty(i)){continue}g=j[i];if(g===null){continue}l=l+i+'="'+g+'" '}if(j===this._DEFAULT_ATTRS){delete j.style;delete j["class"];delete j.id}}h=this.strings;f=(this._selfClosing===NO)?NO:(this.length===1);l=l+(f?" />":">");h[this.offset]=l;if(!f){h.push("</"+this._tagName+">");var e=this;while(e){e.length++;e=e.prevObject}}this._elem=null;return this.prevObject||this},tag:function(a,b){return this.begin(a,b).end()},tagName:function(a){if(a===undefined){if(!this._tagName&&this._elem){this._tagName=this._elem.tagName}return this._tagName}else{this._tagName=a;this._tagNameDidChange=YES;return this}},id:function(a){if(a===undefined){if(!this._id&&this._elem){this._id=this._elem.id}return this._id}else{this._id=a;this._idDidChange=YES;return this}},classNames:function(a){if(a){return this.setClass(a)}else{return this.classes()}},classes:function(){if(!this._classes){if(this._elem){var a=this.$().attr("class");if(a&&(a=a.toString()).length>0){this._classes=a.split(/\s/)}else{this._classes=[]}}else{this._classes=[]}}return this._classes},addClass:function(b){if(SC.typeOf(b)===SC.T_ARRAY){for(var a=0,c=b.length,d={};a<c;a++){d[b[a]]=YES}b=d}return this.setClass(b,YES)},removeClass:function(a){return this.setClass(a,NO)},setClass:function(d,e){var g=NO,c=this.classes();if(SC.typeOf(d)===SC.T_ARRAY){this.resetClasses();c=this.classes();for(var b=0,f=d.length;b<f;b++){g=this._setClass(c,d[b],YES)||g}}else{if(SC.typeOf(d)===SC.T_HASH){for(var a in d){if(!d.hasOwnProperty(a)){continue}e=d[a];g=this._setClass(c,a,e)||g}}else{g=this._setClass(c,d,e)}}if(g){this._classesDidChange=YES;if(this._elem){this.$().attr("class",c.join(" "))}}return this},_setClass:function(c,b,d){var e=NO,a;a=c.indexOf(b);if(a>=0&&!d){c.splice(a,1);e=YES}else{if(a<0&&d){c.push(b);e=YES}}return e},hasClass:function(a){if(this._elem){return this.$().hasClass(a)}return this.classes().indexOf(a)>=0},resetClassNames:function(){return this.resetClasses()},resetClasses:function(){var b=NO,a=this.classes();b=a.length;this._classes=[];if(b){this._classesDidChange=YES;if(this._elem){this.$().attr("class","")}}return this},_STYLE_REGEX:/-?\s*([^:\s]+)\s*:\s*([^;]+)\s*;?/g,styles:function(e){if(e){return this.setStyle(e)}if(!this._styles){if(this._elem){var a=this.$().attr("style");if(a&&(a=a.toString()).length>0){if(SC.browser.name===SC.BROWSER.ie){a=a.toLowerCase()}var d={},b,c=this._STYLE_REGEX;c.lastIndex=0;while(b=c.exec(a)){d[this._camelizeStyleName(b[1])]=b[2]}this._styles=d}else{this._styles={}}}else{this._styles={}}}return this._styles},addStyle:function(a,b){return this.setStyle(a,b)},removeStyle:function(a){return this.setStyle(a)},css:function(a,b){return this.setStyle(a,b)},setStyle:function(a,e){var d=NO,c=this.styles();if(SC.typeOf(a)===SC.T_HASH){for(var b in a){d=this._sc_setStyleFromObject(d,b,a,c)}}else{d=this._deleteComboStyles(c,a);d=this._setOnHash(c,a,e)||d}if(d&&this._elem){this.$().css(c)}return this},_sc_setStyleFromObject:function(e,a,d,b){if(!d.hasOwnProperty(a)){return false}var c=d[a];e=this._deleteComboStyles(b,a)||e;e=this._setOnHash(b,a,c)||e;return e},_deleteComboStyles:function(e,d){var g=SC.COMBO_STYLES[d],f=NO,c;if(g){for(var a=0,b=g.length;a<b;a++){c=g[a];if(e[c]){delete e[c];f=YES}}}return f},_setOnHash:function(d,a,c){var e=d[a],b=true;if(e==null&&c!=null){d[a]=c}else{if(e!=null&&c==null){d[a]=""}else{if(e!=c){d[a]=c}else{b=false}}}return b},resetStyles:function(){var c=NO,b=this.styles();for(var a in b){if(!b.hasOwnProperty(a)){continue}c=YES}this._styles={};if(c){if(this._elem){this.$().attr("style","")}}return this},attrs:function(){if(!this._attrs){if(this._elem){var d={},b=this._elem.attributes,f=b.length;for(var e=0,a,c;e<f;e++){a=b.item(e);c=a.nodeName;if(c.match(/^(?!class|style).*$/i)){d[c]=a.value}}this._attrs=d}else{this._attrs={}}}return this._attrs},attr:function(a,b){if(a){if(SC.typeOf(a)===SC.T_HASH||b!==undefined){return this.setAttr(a,b)}else{return this.attrs()[a]}}return this.attrs()},addAttr:function(a,b){return this.setAttr(a,b)},removeAttr:function(a){return this.setAttr(a)},setAttr:function(a,e){var d=NO,b=this.attrs(),c;if(SC.typeOf(a)===SC.T_HASH){for(c in a){if(!a.hasOwnProperty(c)){continue}e=a[c];d=this._setOnHash(b,c,e)||d}}else{d=this._setOnHash(b,a,e)}if(d){this._attrsDidChange=YES;if(this._elem){this.$().attr(a,e)}}return this},$:function(c){var a,b=this._elem;a=!b?SC.$([]):(c===undefined)?SC.$(b):SC.$(c,b);b=null;return a},_camelizeStyleName:function(a){var b=a.match(/^-(webkit|moz|o)-/),c=SC.String.camelize(a);if(b){return c.substr(0,1).toUpperCase()+c.substr(1)}else{return c}},_dasherizeStyleName:function(a){var b=SC.String.dasherize(a);if(b.match(/^(webkit|moz|ms|o)-/)){b="-"+b}return b}});(function(){var b=/[<>]|&(?![\d\w#]{1,7};)/g,a=function(c){switch(c){case"&":return"&amp;";case"<":return"&lt;";case">":return"&gt;"}};SC.RenderContext.escapeHTML=function(c){if(!c){return""}if(SC.typeOf(c)===SC.T_NUMBER){c=c.toString()}return c.replace(b,a)}})();SC.SelectionSet=SC.Object.extend(SC.Enumerable,SC.Freezable,SC.Copyable,{isSelectionSet:YES,length:function(){var a=0,b=this._sets,c=this._objects;if(c){a+=c.get("length")}if(b){b.forEach(function(d){a+=d.get("length")})}return a}.property().cacheable(),sources:function(){var c=[],d=this._sets,b=d?d.length:0,a,f,e;for(a=0;a<b;a++){f=d[a];if(f&&f.get("length")>0&&f.source){c.push(f.source)}}return c}.property().cacheable(),indexSetForSource:function(e){if(!e||!e.isSCArray){return null}var b=this._indexSetCache,d=this._objects,c,a;if(!b){b=this._indexSetCache={}}c=b[SC.guidFor(e)];if(c&&c._sourceRevision&&(c._sourceRevision!==e.propertyRevision)){c=null}if(!c){c=this._indexSetForSource(e,NO);if(c&&c.get("length")===0){c=null}if(d){if(c){c=c.copy()}d.forEach(function(f){if((a=e.indexOf(f))>=0){if(!c){c=SC.IndexSet.create()}c.add(a)}},this)}if(c){c=b[SC.guidFor(e)]=c.frozenCopy();c._sourceRevision=e.propertyRevision}}return c},_indexSetForSource:function(f,g){if(g===undefined){g=YES}var d=SC.guidFor(f),c=this[d],e=this._sets,a=e?e.length:0,b=null;if(c>=a){c=null}if(SC.none(c)){if(g&&!this.isFrozen){this.propertyWillChange("sources");if(!e){e=this._sets=[]}b=e[a]=SC.IndexSet.create();b.source=f;this[d]=a;this.propertyDidChange("sources")}}else{b=e?e[c]:null}return b},add:function(a,b,d){if(this.isFrozen){throw new Error(SC.FROZEN_ERROR)}var g,f,j,i,c,e,h,k;if(b===undefined&&d===undefined){if(!a){throw new Error("Must pass params to SC.SelectionSet.add()")}if(a.isIndexSet){return this.add(a.source,a)}if(a.isSelectionSet){g=a._sets;k=a._objects;f=g?g.length:0;this.beginPropertyChanges();for(j=0;j<f;j++){i=g[j];if(i&&i.get("length")>0){this.add(i.source,i)}}if(k){this.addObjects(k)}this.endPropertyChanges();return this}}i=this._indexSetForSource(a,YES);c=this.get("length");h=i.get("length");e=c-h;i.add(b,d);this._indexSetCache=null;e+=i.get("length");if(e!==c){this.propertyDidChange("length");this.enumerableContentDidChange();if(h===0){this.notifyPropertyChange("sources")}}return this},remove:function(a,c,d){if(this.isFrozen){throw new Error(SC.FROZEN_ERROR)}var j,h,m,f,l,b,g,k,n,e;if(c===undefined&&d===undefined){if(!a){throw new Error("Must pass params to SC.SelectionSet.remove()")}if(a.isIndexSet){return this.remove(a.source,a)}if(a.isSelectionSet){j=a._sets;n=a._objects;h=j?j.length:0;this.beginPropertyChanges();for(m=0;m<h;m++){l=j[m];if(l&&l.get("length")>0){this.remove(l.source,l)}}if(n){this.removeObjects(n)}this.endPropertyChanges();return this}}l=this._indexSetForSource(a,YES);b=this.get("length");g=b-l.get("length");if(l&&(n=this._objects)){if(d!==undefined){c=SC.IndexSet.create(c,d);d=undefined}for(f=n.get("length")-1;f>=0;--f){e=n[f];m=a.indexOf(e);if(c.contains(m)){n.remove(e);g--}}}l.remove(c,d);k=l.get("length");g+=k;this._indexSetCache=null;if(g!==b){this.propertyDidChange("length");this.enumerableContentDidChange();if(k===0){this.notifyPropertyChange("sources")}}return this},contains:function(b,d,a){if(d===undefined&&a===undefined){return this.containsObject(b)}var c=this.indexSetForSource(b);if(!c){return NO}return c.contains(d,a)},intersects:function(b,d,a){var c=this.indexSetForSource(b,NO);if(!c){return NO}return c.intersects(d,a)},_TMP_ARY:[],addObject:function(b){var c=this._TMP_ARY,a;c[0]=b;a=this.addObjects(c);c.length=0;return a},addObjects:function(a){var d=this._objects,b,c;if(!d){d=this._objects=SC.CoreSet.create()}b=d.get("length");d.addEach(a);c=d.get("length");this._indexSetCache=null;if(c!==b){this.propertyDidChange("length");this.enumerableContentDidChange()}return this},removeObject:function(b){var c=this._TMP_ARY,a;c[0]=b;a=this.removeObjects(c);c.length=0;return a},removeObjects:function(b){var e=this._objects,c,d,a;if(!e){return this}c=e.get("length");e.removeEach(b);d=e.get("length");if(a=this._sets){a.forEach(function(f){c+=f.get("length");f.removeObjects(b);d+=f.get("length")},this)}this._indexSetCache=null;if(d!==c){this.propertyDidChange("length");this.enumerableContentDidChange()}return this},containsObject:function(c){var e=this._objects;if(e&&e.contains(c)){return YES}var d=this._sets,b=d?d.length:0,a,f;for(a=0;a<b;a++){f=d[a];if(f&&f.indexOf(c)>=0){return YES}}return NO},constrain:function(e){var g,b,a,d;this.beginPropertyChanges();this.get("sources").forEach(function(h){if(h===e){return}var i=this._indexSetForSource(e,NO);if(i){this.remove(e,i)}},this);g=this._indexSetForSource(e,NO);if(g&&((a=g.get("max"))>(b=e.get("length")))){this.remove(e,b,a-b)}if(d=this._objects){var c,f;for(c=d.length-1;c>=0;c--){f=d[c];if(e.indexOf(f)<0){this.removeObject(f)}}}this.endPropertyChanges();return this},isEqual:function(g){var f,d,b,a,c,e;if(!g||!g.isSelectionSet){return NO}if(g===this){return YES}if((this._sets===g._sets)&&(this._objects===g._objects)){return YES}if(this.get("length")!==g.get("length")){return NO}f=this._objects;d=g._objects;if(f||d){if((f?f.get("length"):0)!==(d?d.get("length"):0)){return NO}if(f&&!f.isEqual(d)){return NO}}c=this.get("sources");a=c.get("length");for(b=0;b<a;b++){e=c.objectAt(b);f=this._indexSetForSource(e,NO);d=this._indexSetForSource(e,NO);if(!!d!==!!f){return NO}if(f&&!f.isEqual(d)){return NO}}return YES},clear:function(){if(this.isFrozen){throw new Error(SC.FROZEN_ERROR)}if(this._sets){this._sets.length=0}if(this._objects){this._objects=null}this._indexSetCache=null;this.propertyDidChange("length");this.enumerableContentDidChange();this.notifyPropertyChange("sources");return this},copy:function(){var c=this.constructor.create(),d=this._sets,b=d?d.length:0,a,e;if(d&&b>0){d=c._sets=d.slice();for(a=0;a<b;a++){if(!(e=d[a])){continue}e=d[a]=e.copy();c[SC.guidFor(e.source)]=a}}if(this._objects){c._objects=this._objects.copy()}return c},freeze:function(){if(this.get("isFrozen")){return this}var a=this._sets,b=a?a.length:0,c;while(--b>=0){c=a[b];if(c){c.freeze()}}if(this._objects){this._objects.freeze()}this.set("isFrozen",YES);return this},toString:function(){var a=this._sets||[];a=a.map(function(b){return b.toString().replace("SC.IndexSet",SC.guidFor(b.source))},this);if(this._objects){a.push(this._objects.toString())}return"SC.SelectionSet:%@<%@>".fmt(SC.guidFor(this),a.join(","))},firstObject:function(){var b=this._sets,c=this._objects;if(b&&b.get("length")>0){var e=b?b[0]:null,d=e?e.source:null,a=e?e.firstObject():-1;if(d&&a>=0){return d.objectAt(a)}}return c?c.firstObject():undefined}.property(),nextObject:function(c,e,b){var d,a;if(c===0){d=b.objects=[];this.forEach(function(f){d.push(f)},this);b.max=d.length}d=b.objects;a=d[c];if(c+1>=b.max){b.objects=b.max=null}return a},forEach:function(g,e){var c=this._sets,d=this._objects,b=c?c.length:0,f,a;for(a=0;a<b;a++){f=c[a];if(f){f.forEachObject(g,e)}}if(d){d.forEach(g,e)}return this}});SC.SelectionSet.prototype.clone=SC.SelectionSet.prototype.copy;SC.SelectionSet.EMPTY=SC.SelectionSet.create().freeze();sc_require("mixins/delegate_support");SC.SparseArray=SC.Object.extend(SC.Observable,SC.Enumerable,SC.Array,SC.DelegateSupport,{_requestingLength:0,_requestingIndex:0,length:function(){var a=this.delegate;if(a&&SC.none(this._length)&&a.sparseArrayDidRequestLength){this._requestingLength++;a.sparseArrayDidRequestLength(this);this._requestingLength--}return this._length||0}.property().cacheable(),provideLength:function(b){var a;if(SC.none(b)){this._sa_content=null}if(b!==this._length){a=this._length;this._length=b;if(this._requestingLength<=0){this.arrayContentDidChange(0,a||0,b||0)}}return this},rangeWindowSize:1,requestedRangeIndex:null,init:function(){arguments.callee.base.apply(this,arguments);this.requestedRangeIndex=[];this._TMP_PROVIDE_ARRAY=[];this._TMP_PROVIDE_RANGE={length:1};this._TMP_RANGE={}},objectAt:function(a,d){var c=this._sa_content,b;if(a>=this.get("length")){return undefined}if(!c){c=this._sa_content=[]}if((b=c[a])===undefined){if(!d){this.requestIndex(a)}b=c[a]}return b},definedIndexes:function(d){var c=SC.IndexSet.create(),e=this._sa_content,b,a;if(!e){return c.freeze()}if(d){d.forEach(function(f){if(e[f]!==undefined){c.add(f)}})}else{a=e.length;for(b=0;b<a;b++){if(e[b]!==undefined){c.add(b)}}}return c.freeze()},_TMP_RANGE:{},requestIndex:function(b){var c=this.delegate;if(!c){return this}var a=this.get("rangeWindowSize"),e=b;if(a>1){e=e-Math.floor(e%a)}if(a<1){a=1}this._requestingIndex++;if(c.sparseArrayDidRequestRange){var d=this._TMP_RANGE;if(this.wasRangeRequested(e)===-1){d.start=e;d.length=a;this.requestedRangeIndex.push(e);c.sparseArrayDidRequestRange(this,d)}}else{if(c.sparseArrayDidRequestIndex){while(--a>=0){c.sparseArrayDidRequestIndex(this,e+a)}}}this._requestingIndex--;return this},wasRangeRequested:function(c){var b,a;for(b=0,a=this.requestedRangeIndex.length;b<a;b++){if(this.requestedRangeIndex[b]===c){return b}}return -1},rangeRequestCompleted:function(b){var a=this.wasRangeRequested(b);if(a>=0){this.requestedRangeIndex.removeAt(a,1);return YES}return NO},provideObjectsInRange:function(b,e){var c=this._sa_content;if(!c){c=this._sa_content=[]}var d=b.start,a=b.length;while(--a>=0){c[d+a]=e.objectAt(a)}if(this._requestingIndex<=0){this.arrayContentDidChange(b.start,b.length,b.length)}return this},provideObjectAtIndex:function(c,b){var d=this._TMP_PROVIDE_ARRAY,a=this._TMP_PROVIDE_RANGE;d[0]=b;a.start=c;return this.provideObjectsInRange(a,d)},objectsDidChangeInRange:function(a){var b=this._sa_content;if(b){if(a.start===0&&SC.maxRange(a)>=b.length){this._sa_content=null}else{var d=a.start,c=Math.min(d+a.length,b.length);while(--c>=d){b[c]=undefined}}}this.arrayContentDidChange(a.start,a.length,a.length);return this},indexOf:function(d){var e,b,a=this.delegate;if(a&&a.sparseArrayDidRequestIndexOf){b=a.sparseArrayDidRequestIndexOf(this,d)}if(SC.none(b)){e=this._sa_content;if(!e){e=this._sa_content=[]}b=e.indexOf(d)}return b},replace:function(b,g,e){e=e||[];var c=this.delegate;if(c){if(!c.sparseArrayShouldReplace||!c.sparseArrayShouldReplace(this,b,g,e)){return this}}var d=this._sa_content;if(!d){d=this._sa_content=[]}d.replace(b,g,e);var a=e?(e.get?e.get("length"):e.length):0;var f=a-g;this.arrayContentWillChange(b,g,a);if(!SC.none(this._length)){this.propertyWillChange("length");this._length+=f;this.propertyDidChange("length")}this.arrayContentDidChange(b,g,a);return this},reset:function(){var a;this._sa_content=null;a=this._length;this._length=null;this.arrayContentDidChange(0,a,0);this.invokeDelegateMethod(this.delegate,"sparseArrayDidReset",this);return this}});SC.SparseArray.array=function(a){return this.create({_length:a||0})};SC.Timer=SC.Object.extend({target:null,action:null,isPooled:NO,interval:0,startTime:null,repeats:NO,until:null,isPaused:NO,isScheduled:NO,isValid:YES,lastFireTime:0,fireTime:function(){if(!this.get("isValid")){return -1}var e=this.get("startTime");if(!e||e===0){return -1}var a=this.get("interval"),c=this.get("lastFireTime");if(c<e){c=e}var b;if(this.get("repeats")){if(a===0){b=c}else{b=e+(Math.floor((c-e)/a)+1)*a}}else{b=e+a}var d=this.get("until");if(d&&d>0&&b>d){b=d}return b}.property("interval","startTime","repeats","until","isValid","lastFireTime").cacheable(),schedule:function(){if(!this.get("isValid")){return this}this.beginPropertyChanges();if(!this.startTime){this.set("startTime",SC.RunLoop.currentRunLoop.get("startTime"))}var a=this.get("fireTime"),b=this.get("lastFireTime");if(a>=b){this.set("isScheduled",YES);SC.RunLoop.currentRunLoop.scheduleTimer(this,a)}this.endPropertyChanges();return this},invalidate:function(){this.beginPropertyChanges();this.set("isValid",NO);var a=SC.RunLoop.currentRunLoop;if(a){a.cancelTimer(this)}this.action=this.target=null;this.endPropertyChanges();if(this.get("isPooled")){SC.Timer.returnTimerToPool(this)}return this},fire:function(){var b=Date.now();this.set("lastFireTime",b);var a=this.get("fireTime");if(!this.get("isPaused")){this.performAction()}if(a>b){this.schedule()}else{this.invalidate()}},performAction:function(){var a=SC.typeOf(this.action);if(a==SC.T_FUNCTION){this.action.call((this.target||this),this)}else{if(a===SC.T_STRING){if(this.action.indexOf(".")>=0){var e=this.action.split(".");var c=e.pop();var d=SC.objectForPropertyPath(e,window);var b=d.get?d.get(c):d[c];if(b&&SC.typeOf(b)==SC.T_FUNCTION){b.call(d,this)}else{throw new Error("%@: Timer could not find a function at %@".fmt(this,this.action))}}else{SC.RootResponder.responder.sendAction(this.action,this.target,this)}}}},init:function(){arguments.callee.base.apply(this,arguments);if(this.startTime instanceof Date){this.startTime=this.startTime.getTime()}if(this.until instanceof Date){this.until=this.until.getTime()}},RESET_DEFAULTS:{target:null,action:null,isPooled:NO,isPaused:NO,isScheduled:NO,isValid:YES,interval:0,repeats:NO,until:null,startTime:null,lastFireTime:0},reset:function(b){if(!b){b=SC.EMPTY_HASH}this.propertyWillChange("fireTime");var c=this.RESET_DEFAULTS;for(var a in c){if(!c.hasOwnProperty(a)){continue}this[a]=SC.none(b[a])?c[a]:b[a]}this.propertyDidChange("fireTime");return this},removeFromTimerQueue:function(c){var b=this._timerQueuePrevious,a=this._timerQueueNext;if(!b&&!a&&c!==this){return c}if(b){b._timerQueueNext=a}if(a){a._timerQueuePrevious=b}this._timerQueuePrevious=this._timerQueueNext=null;return(c===this)?a:c},scheduleInTimerQueue:function(c,b){this._timerQueueRunTime=b;var a=c;var d=null;while(a&&a._timerQueueRunTime<b){d=a;a=a._timerQueueNext}if(d){d._timerQueueNext=this;this._timerQueuePrevious=d}if(a){a._timerQueuePrevious=this;this._timerQueueNext=a}return(a===c)?this:c},collectExpiredTimers:function(c,a){if(this._timerQueueRunTime>a){return this}c.push(this);var b=this._timerQueueNext;this._timerQueueNext=null;if(b){b._timerQueuePrevious=null}return b?b.collectExpiredTimers(c,a):null}});SC.Timer.schedule=function(a){var b;if(!a||SC.none(a.isPooled)||a.isPooled){b=this.timerFromPool(a)}else{b=this.create(a)}return b.schedule()};SC.Timer.timerFromPool=function(a){var b=this._timerPool;if(!b){b=this._timerPool=[]}var c=b.pop();if(!c){c=this.create()}return c.reset(a)};SC.Timer.returnTimerToPool=function(a){if(!this._timerPool){this._timerPool=[]}this._timerPool.push(a);return this};sc_require("system/browser");SC.mixin({normalizeURL:function(a){if(a.slice(0,1)=="/"){a=window.location.protocol+"//"+window.location.host+a}else{if((a.slice(0,5)=="http:")||(a.slice(0,6)=="https:")){}else{a=window.location.href+"/"+a}}return a},isPercentage:function(a){return(a<1&&a>0)},minX:function(a){return a.x||0},maxX:function(a){return(a.x||0)+(a.width||0)},midX:function(a){return(a.x||0)+((a.width||0)/2)},minY:function(a){return a.y||0},maxY:function(a){return(a.y||0)+(a.height||0)},midY:function(a){return(a.y||0)+((a.height||0)/2)},centerX:function(b,a){return(a.width-b.width)/2},centerY:function(b,a){return(a.height-b.height)/2},offset:function(d,c){var f,b,h,a;c=c||"document";if(c==="parent"){a=jQuery(d).position()}else{a=jQuery(d).offset();if(SC.browser.isMobileSafari){f=navigator.userAgent;b=f.indexOf("Mobile/");h=f.substring(b+7,b+9);if(parseInt(SC.browser.mobileSafari,0)<=532||(h<="8A")){a.left-=window.pageXOffset;a.top-=window.pageYOffset}}if(c==="viewport"){if(SC.browser.isIE8OrLower){a.left-=$(window).scrollLeft();a.top-=$(window).scrollTop()}else{a.left-=window.pageXOffset;a.top-=window.pageYOffset}}}try{a.x=a.left;a.y=a.top}catch(g){a={x:a.left,y:a.top}}delete a.left;delete a.top;return a},viewportOffset:function(b){var a=SC.offset(b,"viewport");return{x:a.left,y:a.top}}});SC.mixin({ZERO_POINT:{x:0,y:0},pointInRect:function(a,b){return(a.x>=SC.minX(b))&&(a.y>=SC.minY(b))&&(a.x<=SC.maxX(b))&&(a.y<=SC.maxY(b))},rectsEqual:function(b,a,c){if(!b||!a){return(b==a)}if(!c&&c!==0){c=0.1}if((b.y!=a.y)&&(Math.abs(b.y-a.y)>c)){return NO}if((b.x!=a.x)&&(Math.abs(b.x-a.x)>c)){return NO}if((b.width!=a.width)&&(Math.abs(b.width-a.width)>c)){return NO}if((b.height!=a.height)&&(Math.abs(b.height-a.height)>c)){return NO}return YES},intersectRects:function(b,a){var c={x:Math.max(SC.minX(b),SC.minX(a)),y:Math.max(SC.minY(b),SC.minY(a)),width:Math.min(SC.maxX(b),SC.maxX(a)),height:Math.min(SC.maxY(b),SC.maxY(a))};c.width=Math.max(0,c.width-c.x);c.height=Math.max(0,c.height-c.y);return c},unionRects:function(b,a){var c={x:Math.min(SC.minX(b),SC.minX(a)),y:Math.min(SC.minY(b),SC.minY(a)),width:Math.max(SC.maxX(b),SC.maxX(a)),height:Math.max(SC.maxY(b),SC.maxY(a))};c.width=Math.max(0,c.width-c.x);c.height=Math.max(0,c.height-c.y);return c},scaleRect:function(h,a,l,k){if(a==null){a=1}if(l==null){l=0.5}if(k==null){k=0.5}if(a===1){return SC.cloneRect(h)}var j,i;switch(SC.typeOf(a)){case SC.T_ARRAY:j=a[0];i=a[1];break;case SC.T_HASH:j=a.x;i=a.y;break;default:j=a;i=a;break}var g=h.height*i,e=h.width*j,c=g-h.height,f=e-h.width;var d=h.x-(f*l),b=h.y-(c*k);return{height:g,width:e,x:d,y:b}},cloneRect:function(a){return{x:a.x,y:a.y,width:a.width,height:a.height}},stringFromRect:function(a){if(!a){return"(null)"}else{return"{ x:"+a.x+", y:"+a.y+", width:"+a.width+", height:"+a.height+" }"}}});sc_require("views/view");SC.DESIGN_MODE_CLASS_NAMES={s:"sc-small",m:"sc-medium",l:"sc-large",xl:"sc-xlarge"};SC.View.reopen({designMode:null,modeAdjust:null,adjustChildDesignModes:function(b,d){var e=this.get("childViews");var c,a=e.get("length");for(c=0;c<a;c++){var f=e.objectAt(c);f.updateDesignMode(b,d)}},_sc_assignProperty:function(c,e){if(c==="layout"){var b=this._sc_computeExplicitLayout(e),f={},g=this.get("explicitLayout");for(var a in b){var d=g[a];f[a]=d===undefined?null:d;if(a==="centerX"){f.left=g.left;f.right=g.right}if(a==="centerY"){f.top=g.top;f.bottom=g.bottom}}this._originalProperties.layout=f}else{this._originalProperties[c]=this.get(c)}if(c==="layout"){this.adjust(e)}else{this.set(c,e)}},_sc_revertProperty:function(b,a){if(b==="layout"){this.adjust(a)}else{this.set(b,a)}},updateDesignMode:function(c,h){if(c===h){return}var a=this.get("classNames"),g,d,i,f,e,b,k;this.set("designMode",h);if(h){k=h.split("_")[0]}g=this.get("modeAdjust");if(g){this.beginPropertyChanges();b=this._originalProperties;if(b){for(i in b){this._sc_revertProperty(i,b[i])}this._originalProperties=null}if(h){if(g[k]||g[h]){e=SC.merge(g[k],g[h]);this._originalProperties={};for(i in e){this._sc_assignProperty(i,e[i])}}}this.endPropertyChanges()}var j;f=this.get("layer");if(f){d=this.$();if(c){j=SC.DESIGN_MODE_CLASS_NAMES[c.split("_")[0]];d.removeClass(j);a.removeObject(j)}if(h){j=SC.DESIGN_MODE_CLASS_NAMES[k];d.addClass(j);a.push(j)}}else{if(h){j=SC.DESIGN_MODE_CLASS_NAMES[k];a.push(j)}}this.adjustChildDesignModes(c,h)}});sc_require("panes/pane");sc_require("panes/keyboard");sc_require("panes/layout");sc_require("panes/manipulation");sc_require("panes/pane_statechart");SC.MainPane=SC.Pane.extend({layout:{minHeight:200,minWidth:200},didAppendToDocument:function(){var a=this.rootResponder;a.makeMainPane(this);this.becomeKeyPane();this.setBodyOverflowIfNeeded()},willRemoveFromDocument:function(){var a=this.rootResponder;this.unsetBodyOverflowIfNeeded();a.makeMainPane(null);this.resignKeyPane()},_updatedLayout:function(){arguments.callee.base.apply(this,arguments);this.setBodyOverflowIfNeeded()},acceptsKeyPane:YES,classNames:["sc-main"]});SC.routes=SC.Object.create({wantsHistory:NO,usesHistory:null,baseURI:document.baseURI,_didSetup:NO,_location:null,_firstRoute:null,_extractParametersAndRoute:function(d,b){var a={},j=d.route||"",f,c,e,h,g,k;f=(j.indexOf("?")<0&&j.indexOf("&")>=0)?"&":"?";c=j.split(f);j=c.shift();a=this.deparam(c.join("&"),b||false);for(k in d){if(d.hasOwnProperty(k)&&k!=="route"){a[k]=""+d[k]}}a.params=f+$.param(a);a.route=j;return a},location:function(a,b){var c;this._skipRoute=NO;if(b!==undefined){c=this.informLocation.lastSetValueKey;if(c&&this._kvo_cache){this._kvo_cache[c]=b}}return this._extractLocation(a,b)}.property(),informLocation:function(a,b){var c;this._skipRoute=YES;if(b!==undefined){c=this.location.lastSetValueKey;if(c&&this._kvo_cache){this._kvo_cache[c]=b}}return this._extractLocation(a,b)}.property(),_extractLocation:function(c,d){var a,b;if(d!==undefined){if(d===null){d=""}if(typeof(d)==="object"){a=this._extractParametersAndRoute(d);d=a.route+a.params}if(!this._exogenous){if(!SC.empty(d)||(this._location&&this._location!==d)){b=encodeURI(d);if(this.usesHistory){if(b.length>0){b="/"+b}window.history.pushState(null,null,this.get("baseURI")+b)}else{window.location.hash=b}}}this._location=d}return this._location},ping:function(){var a;if(!this._didSetup){this._didSetup=YES;if(this.get("wantsHistory")&&SC.platform.supportsHistory){this.usesHistory=YES;this.popState();SC.Event.add(window,"popstate",this,this.popState)}else{this.usesHistory=NO;if(SC.platform.supportsHashChange){this.hashChange();SC.Event.add(window,"hashchange",this,this.hashChange)}else{a=this;this._invokeHashChange=function(){a.hashChange();setTimeout(a._invokeHashChange,100)};this._invokeHashChange()}}}},hashChange:function(a){this._exogenous=YES;var b=window.location.hash;b=(b&&b.length>0)?b.slice(1,b.length):"";if(!SC.browser.isMozilla){b=decodeURI(b)}if(this.get("location")!==b&&!this._skipRoute){SC.run(function(){this.set("location",b)},this)}this._skipRoute=NO;this._exogenous=NO},popState:function(a){this._exogenous=YES;var b=this.get("baseURI"),c=document.location.href;if(c.slice(0,b.length)===b){c=c.slice(b.length+1,c.length);if(this.get("location")!==c&&!this._skipRoute){SC.run(function(){this.set("location",c)},this)}}this._skipRoute=NO;this._exogenous=NO},add:function(a,b,c){if(!this._didSetup){this.invokeNext(this.ping)}if(c===undefined&&SC.typeOf(b)===SC.T_FUNCTION){c=b;b=null}else{if(SC.typeOf(c)===SC.T_STRING){c=b[c]}}if(!this._firstRoute){this._firstRoute=this._Route.create()}this._firstRoute.add(a.split("/"),b,c);return this},locationDidChange:function(){this.trigger()}.observes("location"),trigger:function(){var a=this._firstRoute,b=this.get("location"),d,c;if(a){d=this._extractParametersAndRoute({route:b});b=d.route;delete d.route;delete d.params;c=a.routeForParts(b.split("/"),d);if(c&&c.method){c.method.call(c.target||this,d)}}},deparam:function(k,g){var j={},b={"true":!0,"false":!1,"null":null},f,l,n,d,p,c,o,h,q,m,e=decodeURIComponent,a=Object.prototype.toString;if(k.indexOf("?")>=0){k=k.split("?")[1];if(k.indexOf("#")>=0){k=k.split("#")[0]}}else{if(k.indexOf("#")>=0){k=k.split("#")[1]}}f=k.replace(/\+/g," ").split("&");l=f.length;for(n=0;n<l;++n){d=f[n].split("="),p=e(d[0]),o=j,q=p.split("]["),m=p.length-1;if(/\[/.test(q[0])&&/\]$/.test(q[m])){q[m]=q[m].replace(/\]$/,"");q=q.shift().split("[").concat(q);m=q.length-1}else{m=0}if(d.length===2){c=e(d[1]);if(g){c=c&&!isNaN(c)?+c:c==="undefined"?undefined:b[c]!==undefined?b[c]:c}if(m){for(h=0;h<m;++h){p=q[h]===""?o.length:q[h];o=o[p]=h<m?o[p]||(q[h+1]&&isNaN(q[h+1])?{}:[]):c}}else{if(a.apply(j[p])==="[object Array]"){j[p].push(c)}else{if(j[p]!==undefined){j[p]=[j[p],c]}else{j[p]=c}}}}else{if(p){j[p]=g?undefined:""}}}return j},_Route:SC.Object.extend({target:null,method:null,staticRoutes:null,dynamicRoutes:null,wildcardRoutes:null,add:function(c,b,e){var a,d;c=SC.clone(c);if(!c||c.length===0){this.target=b;this.method=e}else{a=c.shift();switch(a.slice(0,1)){case":":a=a.slice(1,a.length);if(!this.dynamicRoutes){this.dynamicRoutes={}}if(!this.dynamicRoutes[a]){this.dynamicRoutes[a]=this.constructor.create()}d=this.dynamicRoutes[a];break;case"*":a=a.slice(1,a.length);if(!this.wildcardRoutes){this.wildcardRoutes={}}d=this.wildcardRoutes[a]=this.constructor.create();break;default:if(!this.staticRoutes){this.staticRoutes={}}if(!this.staticRoutes[a]){this.staticRoutes[a]=this.constructor.create()}d=this.staticRoutes[a]}if(d){d.add(c,b,e)}}},routeForParts:function(d,e){var b,c,a;d=SC.clone(d);if(!d||d.length===0){return this.method?this:null}else{b=d.shift();if(this.staticRoutes&&this.staticRoutes[b]){return this.staticRoutes[b].routeForParts(d,e)}else{for(c in this.dynamicRoutes){a=this.dynamicRoutes[c].routeForParts(d,e);if(a){e[c]=b;return a}}for(c in this.wildcardRoutes){d.unshift(b);e[c]=d.join("/");return this.wildcardRoutes[c].routeForParts(null,e)}return null}}}})});SC.SCANNER_OUT_OF_BOUNDS_ERROR=SC.$error("Out of bounds.");SC.SCANNER_INT_ERROR=SC.$error("Not an int.");SC.SCANNER_SKIP_ERROR=SC.$error("Did not find the string to skip.");SC.SCANNER_SCAN_ARRAY_ERROR=SC.$error("Did not find any string of the given array to scan.");SC.DATETIME_COMPAREDATE_TIMEZONE_ERROR=SC.$error("Can't compare the dates of two DateTimes that don't have the same timezone.");SC.DATETIME_ISO8601="%Y-%m-%dT%H:%M:%S%Z";SC.Scanner=SC.Object.extend({string:null,scanLocation:0,scan:function(a){if(this.scanLocation+a>this.length){SC.SCANNER_OUT_OF_BOUNDS_ERROR.throw()}var b=this.string.substr(this.scanLocation,a);this.scanLocation+=a;return b},scanInt:function(c,e){if(e===undefined){e=c}var d=this.scan(e);var b=new RegExp("^\\d{"+c+","+e+"}");var a=d.match(b);if(!a){SC.SCANNER_INT_ERROR.throw()}if(a[0].length<e){this.scanLocation+=a[0].length-e}return parseInt(a[0],10)},skipString:function(a){if(this.scan(a.length)!==a){SC.SCANNER_SKIP_ERROR.throw()}return YES},scanArray:function(c){for(var b=0,a=c.length;b<a;b++){if(this.scan(c[b].length)===c[b]){return b}this.scanLocation-=c[b].length}SC.SCANNER_SCAN_ARRAY_ERROR.throw()}});SC.DateTime=SC.Object.extend(SC.Freezable,SC.Copyable,{_ms:0,timezone:0,isFrozen:YES,adjust:function(b,a){var c;b=b?SC.clone(b):{};c=(b.timezone!==undefined)?b.timezone:(this.timezone!==undefined)?this.timezone:0;return this.constructor._adjust(b,this._ms,c,a)._createFromCurrentState()},advance:function(a){return this.constructor._advance(a,this._ms,this.timezone)._createFromCurrentState()},unknownProperty:function(a){return this.constructor._get(a,this._ms,this.timezone)},toFormattedString:function(a){return this.constructor._toFormattedString(a,this._ms,this.timezone)},toISO8601:function(){return this.constructor._toFormattedString(SC.DATETIME_ISO8601,this._ms,this.timezone)},dayOrdinal:function(){return this.get("day").ordinal()}.property(),toString:function(){return"UTC: "+new Date(this._ms).toUTCString()+", timezone: "+this.timezone},isEqual:function(a){return this.constructor.compare(this,a)===0},copy:function(){return this},toTimezone:function(a){if(a===undefined){a=0}return this.advance({timezone:a-this.timezone})}});SC.DateTime.mixin(SC.Comparable,{recordFormat:SC.DATETIME_ISO8601,dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],_englishDayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],abbreviatedDayNames:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],abbreviatedMonthNames:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],AMPMNames:["AM","PM"],_date:new Date(),_tz:0,timezone:new Date().getTimezoneOffset(),_dt_cache:{},_dt_cache_index:-1,_DT_CACHE_MAX_LENGTH:1000,_setCalcState:function(a,c){var b={milliseconds:this._date.getTime(),timezone:this._tz};if(a!==undefined){this._date.setTime(a)}if(c!==undefined){this._tz=c}return b},_setCalcStateFromHash:function(c,b){var d=(b!==undefined)?b:this._tz;var a=this._toMilliseconds(c,this._ms,d);return this._setCalcState(a,d)},_get:function(t,b,n){var l,h,o,e,j,k,f,p,a;var c,i;var r=this._date;var q,g=null;q=this._setCalcState(b,n);if(t==="milliseconds"){g=r.getTime()}else{if(t==="timezone"){g=this._tz}}if(g===null){p=t.slice(0,4);a=t.slice(4);if(p==="last"||p==="next"){c=this._get("dayOfWeek",b,n);i=this._englishDayNames.indexOf(a);if(i>=0){var s=i-c;if(p==="last"&&s>=0){s-=7}if(p==="next"&&s<0){s+=7}this._advance({day:s},b,n);g=this._createFromCurrentState()}}}if(g===null){if(n!==undefined){this._setCalcState(r.getTime()-(n*60000),0)}switch(t){case"year":g=r.getUTCFullYear();break;case"month":g=r.getUTCMonth()+1;break;case"day":g=r.getUTCDate();break;case"dayOfWeek":g=r.getUTCDay();break;case"hour":g=r.getUTCHours();break;case"minute":g=r.getUTCMinutes();break;case"second":g=r.getUTCSeconds();break;case"millisecond":g=r.getUTCMilliseconds();break;case"elapsed":g=+new Date()-r.getTime()-(n*60000);break}if((g===null)&&(t==="isLeapYear")){e=this._get("year");g=(e%4===0&&e%100!==0)||e%400===0}if((g===null)&&(t==="daysInMonth")){switch(this._get("month")){case 4:case 6:case 9:case 11:g=30;break;case 2:g=this._get("isLeapYear")?29:28;break;default:g=31;break}}if((g===null)&&(t==="dayOfYear")){l=r.getTime();h=this._get("day");this._setCalcStateFromHash({day:1});for(o=this._get("month")-1;o>0;o--){this._setCalcStateFromHash({month:o});h+=this._get("daysInMonth")}r.setTime(l);g=h}if((g===null)&&(t.slice(0,4)==="week")){j=t.length===4?1:parseInt(t.slice("4"),10);k=this._get("dayOfWeek");f=this._get("dayOfYear")-1;if(j===0){g=parseInt((f-k+7)/7,10)}else{g=parseInt((f-(k-1+7)%7+7)/7,10)}}}this._setCalcState(q.milliseconds,q.timezone);return g},_adjust:function(c,e,d,a){var b=this._toMilliseconds(c,e,d,a);this._setCalcState(b,d);return this},_advance:function(a,f,d){var c=a?SC.clone(a):{};var e;for(var b in c){c[b]+=this._get(b,f,d)}e=(c.timezone!==undefined)?c.timezone:d;return this._adjust(c,f,e,NO)},_toMilliseconds:function(j,c,h,f){var a=j?SC.clone(j):{};var i=this._date;var g=i.getTime();var b,e;if(!SC.none(c)){i.setTime(c)}e=(h!==undefined)?h:(this.timezone!==undefined)?this.timezone:0;i.setTime(i.getTime()-(e*60000));if(f===undefined||f===YES){if(!SC.none(a.hour)&&SC.none(a.minute)){a.minute=0}if(!(SC.none(a.hour)&&SC.none(a.minute))&&SC.none(a.second)){a.second=0}if(!(SC.none(a.hour)&&SC.none(a.minute)&&SC.none(a.second))&&SC.none(a.millisecond)){a.millisecond=0}}if(SC.none(a.year)){a.year=i.getUTCFullYear()}if(SC.none(a.month)){a.month=i.getUTCMonth()+1}if(SC.none(a.day)){a.day=i.getUTCDate()}if(SC.none(a.hour)){a.hour=i.getUTCHours()}if(SC.none(a.minute)){a.minute=i.getUTCMinutes()}if(SC.none(a.second)){a.second=i.getUTCSeconds()}if(SC.none(a.millisecond)){a.millisecond=i.getUTCMilliseconds()}b=Date.UTC(a.year,a.month-1,a.day,a.hour,a.minute,a.second,a.millisecond);i.setTime(b+(e*60000));b=i.getTime();i.setTime(g);return b},create:function(){var i=arguments.length===0?{}:arguments[0];var d;if(SC.typeOf(i)===SC.T_NUMBER){i={milliseconds:i}}d=(i.timezone!==undefined)?i.timezone:this.timezone;if(d===undefined){d=0}if(!SC.none(i.milliseconds)){var h="nu"+i.milliseconds+d,a=this._dt_cache;var e=a[h];if(!e){var f,g=this._dt_cache_index,b=this;e=a[h]=new b([{_ms:i.milliseconds,timezone:d}]);g=this._dt_cache_index=(g+1)%this._DT_CACHE_MAX_LENGTH;f=a[g];if(f!==undefined&&a[f]){delete a[f]}a[g]=h}return e}else{var c=new Date();return this.create({milliseconds:this._toMilliseconds(i,c.getTime(),d,i.resetCascadingly),timezone:d})}},_createFromCurrentState:function(){return this.create({milliseconds:this._date.getTime(),timezone:this._tz})},parse:function(o,c){var p=new RegExp("(?:%([aAbBcdDhHiIjmMpsSUWwxXyYZ%])|(.))","g");var n,j,a={},b={},i=SC.Scanner.create({string:o});if(SC.none(c)){c=SC.DATETIME_ISO8601}try{while((j=p.exec(c))!==null){switch(j[1]){case"a":b.dayOfWeek=i.scanArray(this.abbreviatedDayNames);break;case"A":b.dayOfWeek=i.scanArray(this.dayNames);break;case"b":a.month=i.scanArray(this.abbreviatedMonthNames)+1;break;case"B":a.month=i.scanArray(this.monthNames)+1;break;case"c":throw new Error("%c is not implemented");case"d":case"D":a.day=i.scanInt(1,2);break;case"e":throw new Error("%e is not implemented");case"E":throw new Error("%E is not implemented");case"h":case"H":a.hour=i.scanInt(1,2);break;case"i":case"I":a.hour=i.scanInt(1,2);break;case"j":throw new Error("%j is not implemented");case"m":a.month=i.scanInt(1,2);break;case"M":a.minute=i.scanInt(1,2);break;case"p":a.meridian=i.scanArray(this.AMPMNames);break;case"S":a.second=i.scanInt(1,2);break;case"s":a.millisecond=i.scanInt(1,3);break;case"U":throw new Error("%U is not implemented");case"W":throw new Error("%W is not implemented");case"w":throw new Error("%w is not implemented");case"x":throw new Error("%x is not implemented");case"X":throw new Error("%X is not implemented");case"y":a.year=i.scanInt(2);a.year+=(a.year>70?1900:2000);break;case"Y":a.year=i.scanInt(4);break;case"Z":var g=i.scan(1);if(g==="Z"){a.timezone=0}else{if(g==="+"||g==="-"){var k=i.scanInt(2);if(i.scan(1)!==":"){i.scan(-1)}var f=i.scanInt(2);a.timezone=(g==="+"?-1:1)*(k*60+f)}}break;case"%":i.skipString("%");break;default:i.skipString(j[0]);break}}}catch(l){SC.Logger.log("SC.DateTime.createFromString "+l.toString());return null}if(!SC.none(a.meridian)&&!SC.none(a.hour)){if((a.meridian===1&&a.hour!==12)||(a.meridian===0&&a.hour===12)){a.hour=(a.hour+12)%24}delete a.meridian}n=this.create(a);if(!SC.none(b.dayOfWeek)&&n.get("dayOfWeek")!==b.dayOfWeek){return null}return n},_pad:function(b,a){var c=""+b;if(a===undefined){a=2}while(c.length<a){c="0"+c}return c},__toFormattedString:function(b,e,c){var a,d;switch(b[1]){case"a":return this.abbreviatedDayNames[this._get("dayOfWeek")];case"A":return this.dayNames[this._get("dayOfWeek")];case"b":return this.abbreviatedMonthNames[this._get("month")-1];case"B":return this.monthNames[this._get("month")-1];case"c":return this._date.toString();case"d":return this._pad(this._get("day"));case"D":return this._get("day");case"E":return this._toFormattedString(this.__getElapsedStringFormat(e,c),e,c);case"h":return this._get("hour");case"H":return this._pad(this._get("hour"));case"i":a=this._get("hour");return(a===12||a===0)?12:(a+12)%12;case"I":a=this._get("hour");return this._pad((a===12||a===0)?12:(a+12)%12);case"j":return this._pad(this._get("dayOfYear"),3);case"m":return this._pad(this._get("month"));case"M":return this._pad(this._get("minute"));case"o":return this._get("day").ordinal();case"p":return this._get("hour")>11?this.AMPMNames[1]:this.AMPMNames[0];case"S":return this._pad(this._get("second"));case"s":return this._pad(this._get("millisecond"),3);case"u":return this._pad(this._get("utc"));case"U":return this._pad(this._get("week0"));case"W":return this._pad(this._get("week1"));case"w":return this._get("dayOfWeek");case"x":return this._date.toDateString();case"X":return this._date.toTimeString();case"y":return this._pad(this._get("year")%100);case"Y":return this._get("year");case"Z":d=-1*c;return(d>=0?"+":"-")+this._pad(parseInt(Math.abs(d)/60,10))+":"+this._pad(Math.abs(d)%60);case"%":return"%"}},_toFormattedString:function(c,d,b){var a=this;this._setCalcState(d-(b*60000),0);return c.replace(/\%([aAbBcdeEDhHiIjmMopsSUWwxXyYZ\%])/g,function(){var e=a.__toFormattedString.call(a,arguments,d,b);return e})},__getElapsedStringFormat:function(b,a){return""},compare:function(d,c){if(SC.none(d)||SC.none(c)){throw new Error("You must pass two valid dates to compare()")}var f=d.get("milliseconds");var e=c.get("milliseconds");return f<e?-1:f===e?0:1},compareDate:function(d,c){if(SC.none(d)||SC.none(c)){throw new Error("You must pass two valid dates to compareDate()")}if(d.get("timezone")!==c.get("timezone")){SC.DATETIME_COMPAREDATE_TIMEZONE_ERROR.throw()}var f=d.adjust({hour:0}).get("milliseconds");var e=c.adjust({hour:0}).get("milliseconds");return f<e?-1:f===e?0:1},difference:function(d,c,h){if(SC.none(d)||SC.none(c)){throw new Error("You must pass two valid dates to difference()")}var j=d.get("milliseconds"),i=c.get("milliseconds"),g=i-j,f;switch(h){case"d":case"D":f=86400000;break;case"h":case"H":f=3600000;break;case"M":f=60000;break;case"S":f=1000;break;case"s":f=1;break;case"W":f=604800000;break;default:throw new Error(h+" is not supported")}var e=g/f;return Math.round(e)}});SC.Binding.dateTime=function(a){return this.transform(function(b){return b?b.toFormattedString(a):null})};SC.stringsFor("English",{"_SC.DateTime.dayNames":"Sunday Monday Tuesday Wednesday Thursday Friday Saturday","_SC.DateTime.abbreviatedDayNames":"Sun Mon Tue Wed Thu Fri Sat","_SC.DateTime.monthNames":"January February March April May June July August September October November December","_SC.DateTime.abbreviatedMonthNames":"Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec","_SC.DateTime.AMPMNames":"AM PM","_SC.DateTime.now":"Right now","_SC.DateTime.secondIn":"In a moment","_SC.DateTime.secondsIn":"In %e seconds","_SC.DateTime.minuteIn":"In a minute","_SC.DateTime.minutesIn":"In %e minutes","_SC.DateTime.hourIn":"An hour from now","_SC.DateTime.hoursIn":"In about %e hours","_SC.DateTime.dayIn":"Tomorrow at %i:%M %p","_SC.DateTime.daysIn":"%A at %i:%M %p","_SC.DateTime.weekIn":"Next week","_SC.DateTime.weeksIn":"In %e weeks","_SC.DateTime.monthIn":"Next month","_SC.DateTime.monthsIn":"In %e months","_SC.DateTime.yearIn":"Next year","_SC.DateTime.yearsIn":"In %e years","_SC.DateTime.secondAgo":"A moment ago","_SC.DateTime.secondsAgo":"%e seconds ago","_SC.DateTime.minuteAgo":"A minute ago","_SC.DateTime.minutesAgo":"%e minutes ago","_SC.DateTime.hourAgo":"An hour ago","_SC.DateTime.hoursAgo":"About %e hours ago","_SC.DateTime.dayAgo":"Yesterday at %i:%M %p","_SC.DateTime.daysAgo":"%A at %i:%M %p","_SC.DateTime.weekAgo":"About a week ago","_SC.DateTime.weeksAgo":"%e weeks ago","_SC.DateTime.monthAgo":"About a month ago","_SC.DateTime.monthsAgo":"%e months ago","_SC.DateTime.yearAgo":"Last year","_SC.DateTime.yearsAgo":"%e years ago"});SC.DateTime.mixin({_setup:function(){SC.DateTime.dayNames=SC.String.w(SC.String.loc("_SC.DateTime.dayNames"));SC.DateTime.abbreviatedDayNames=SC.String.w(SC.String.loc("_SC.DateTime.abbreviatedDayNames"));SC.DateTime.monthNames=SC.String.w(SC.String.loc("_SC.DateTime.monthNames"));SC.DateTime.abbreviatedMonthNames=SC.String.w(SC.String.loc("_SC.DateTime.abbreviatedMonthNames"));SC.DateTime.AMPMNames=SC.String.w(SC.String.loc("_SC.DateTime.AMPMNames"))},__getElapsedStringFormat:function(g,e){var c=Math.floor((+new Date()-this._date.getTime()-(e*60000))/1000);var b=!!(c<0)?"In":"Ago";var d=0;var f="now";if(Math.abs(c)>31536000){d=Math.floor(Math.abs(c/31536000));f="year"}else{if(Math.abs(c)>2678400){d=Math.floor(Math.abs(c/2678400));f="month"}else{if(Math.abs(c)>604800){d=Math.floor(Math.abs(c/604800));f="week"}else{if(Math.abs(c)>86400){d=Math.floor(Math.abs(c/86400));f="day"}else{if(Math.abs(c)>3600){d=Math.floor(Math.abs(c/3600));f="hour"}else{if(Math.abs(c)>60){d=Math.floor(Math.abs(c/60));f="minute"}else{if(Math.abs(c)>0){d=Math.abs(c);f="second"}}}}}}}var a="_SC.DateTime.now";if(f!=="now"){a="_SC.DateTime.%@%@%@".fmt(f,d>1?"s":"",b)}return a.loc().replace("%e",d)}});jQuery(document).ready(function(){SC.DateTime._setup()});SC.WebSocketDelegate={isWebSocketDelegate:true,webSocketDidOpen:function(a,b){},webSocketDidReceiveMessage:function(a,b){switch(b){case"ping":return true;break}if(this.get("isJSON")){try{JSON.parse(b)}catch(c){return true}}},webSocketDidClose:function(a,b){},webSocketDidError:function(a,b){}};SC.Response=SC.Object.extend({isResponse:YES,isError:NO,errorValue:function(){return this}.property().cacheable(),errorObject:null,request:null,originalRequest:function(){var a=this.get("request");while(a.get("source")){a=a.get("source")}return a}.property("request").cacheable(),type:function(){return this.getPath("request.type")}.property("request").cacheable(),address:function(){return this.getPath("request.address")}.property("request").cacheable(),isJSON:function(){return this.getPath("request.isJSON")||NO}.property("request").cacheable(),isXML:function(){return this.getPath("request.isXML")||NO}.property("request").cacheable(),listeners:function(){return this.getPath("request.listeners")}.property("request").cacheable(),status:-100,headers:null,body:function(){var a=this.get("encodedBody");if(a&&this.get("isJSON")){try{a=SC.json.decode(a)}catch(b){return SC.Error.create({message:b.name+": "+b.message,label:"Response",errorValue:this})}}return a}.property("encodedBody").cacheable(),response:function(){return this.get("body")}.property("body").cacheable(),isCancelled:NO,timedOut:null,timeoutTimer:null,fire:function(){var a=this.get("request"),c=a?a.get("source"):null;if(c&&c.willSend){c.willSend(a,this)}a.freeze();if(!this.get("isCancelled")){this.invokeTransport()}var b=a.get("timeout");if(b){var d=SC.Timer.schedule({target:this,action:"timeoutReached",interval:b,repeats:NO});this.set("timeoutTimer",d)}if(!this.get("isCancelled")&&c&&c.didSend){c.didSend(a,this)}},invokeTransport:function(){this.receive(function(a){this.set("status",200)},this)},receive:function(e,a){if(!this.get("timedOut")){var d=this.get("timeoutTimer");if(d){d.invalidate()}this.set("timedOut",NO)}var b=this.get("request");var c=b?b.get("source"):null;SC.run(function(){if(c&&c.willReceive){c.willReceive(b,this)}e.call(a,!this.get("isCancelled"));if(!this.get("isCancelled")&&c&&c.didReceive){c.didReceive(b,this)}if(!this.get("isCancelled")){this.notify()}},this);SC.Request.manager.transportDidClose(this);return this},cancel:function(){if(!this.get("isCancelled")){this.set("isCancelled",YES);this.cancelTransport();SC.Request.manager.transportDidClose(this)}},timeoutReached:function(){if(this.get("timedOut")===null){this.set("timedOut",YES);this.cancelTransport();this.receive(function(b){if(!b){return}var a=SC.$error("HTTP Request timed out","Request",0);a.set("errorValue",this);this.set("isError",YES);this.set("errorObject",a);this.set("status",0)},this);return YES}return NO},cancelTransport:function(){},_notifyListeners:function(h,b){var j=h[b],g,f,a;if(!j){return NO}var d=NO;var e=j.length;for(var c=0;c<e;c++){var k=j[c];g=(k.args||[]).copy();g.unshift(this);f=k.target;a=k.action;if(SC.typeOf(a)===SC.T_STRING){a=f[a]}d=a.apply(f,g)}return d},notify:function(){var b=this.get("listeners"),a=this.get("status"),c=Math.floor(a/100)*100,d=NO;if(!b){return this}d=this._notifyListeners(b,a);if(!d&&c!==a){d=this._notifyListeners(b,c)}if(!d&&a!==0){d=this._notifyListeners(b,0)}return this},toString:function(){var a=arguments.callee.base.apply(this,arguments);return"%@<%@ %@, status=%@".fmt(a,this.get("type"),this.get("address"),this.get("status"))}});SC.XHRResponse=SC.Response.extend({headers:function(){var c=this.get("rawRequest"),b=c?c.getAllResponseHeaders():null,a={};if(!b){return a}b.split("\n").forEach(function(g){var d=g.indexOf(":"),e,f;if(d>=0){e=g.slice(0,d);f=g.slice(d+1).trim();a[e]=f}},this);return a}.property("status").cacheable(),header:function(a){var b=this.get("rawRequest");return b?b.getResponseHeader(a):null},encodedBody:function(){var a=this.get("rawRequest");if(!a){return null}if(this.get("isXML")){return a.responseXML}return a.responseText}.property("status").cacheable(),cancelTransport:function(){var a=this.get("rawRequest");if(a){a.abort()}this.set("rawRequest",null)},invokeTransport:function(){var d,n,b,g,h=this.get("request"),e,a,f,c;g=this.createRequest();this.set("rawRequest",g);f=!!h.get("isAsynchronous");if(f){if(SC.platform.get("supportsXHR2ProgressEvent")){n=h.get("listeners");if(n){for(var o in n){if(isNaN(parseInt(o,10))){b=n[o];for(var k=0,l=b.length;k<l;k++){d=b[k];var m=o.split(".");if(SC.none(m[1])){SC.Event.add(g,m[0],d.target,d.action,d.args)}else{SC.Event.add(g[m[0]],m[1],d.target,d.action,d.args)}}}}}if(SC.platform.get("supportsXHR2LoadEndEvent")){SC.Event.add(g,"loadend",this,this.finishRequest)}else{SC.Event.add(g,"load",this,this.finishRequest);SC.Event.add(g,"error",this,this.finishRequest);SC.Event.add(g,"abort",this,this.finishRequest)}}else{if(window.XMLHttpRequest&&g.addEventListener){SC.Event.add(g,"readystatechange",this,this.finishRequest)}else{e=this;a=function(){if(!e){return null}var i=e.finishRequest();if(i){e=null}return i};g.onreadystatechange=a}}}g.open(this.get("type"),this.get("address"),f);c=this.getPath("request.headers");for(var j in c){g.setRequestHeader(j,c[j])}if(!this.getPath("request.isSameDomain")&&this.getPath("request.allowCredentials")){g.withCredentials=true}g.send(this.getPath("request.encodedBody"));if(!f){this.finishRequest()}return g},createRequest:function(){var a;if(window.XMLHttpRequest){a=new XMLHttpRequest()}else{try{a=new ActiveXObject("MSXML2.XMLHTTP.6.0")}catch(b){}try{if(!a){a=new ActiveXObject("MSXML2.XMLHTTP")}}catch(b){}}return a},finishRequest:function(o){var c,l,a,e=this.get("rawRequest"),h=e.readyState,f,m,d,b;if(h===4&&!this.get("timedOut")){this.receive(function(i){if(!i){return}d=-1;try{d=e.status||0;d=d===1223?204:d}catch(q){}if((d<200)||(d>=300)){try{b=e.statusText||""}catch(p){b=""}m=SC.$error(b||"HTTP Request failed","Request",d);m.set("errorValue",this);this.set("isError",YES);this.set("errorObject",m)}this.set("status",d)},this);if(SC.platform.get("supportsXHR2ProgressEvent")){if(SC.platform.get("supportsXHR2LoadEndEvent")){SC.Event.remove(e,"loadend",this,this.finishRequest)}else{SC.Event.remove(e,"load",this,this.finishRequest);SC.Event.remove(e,"error",this,this.finishRequest);SC.Event.remove(e,"abort",this,this.finishRequest)}f=this.get("request");l=f.get("listeners");if(l){for(var n in l){if(isNaN(parseInt(n,10))){a=l[n];for(var g=0,j=a.length;g<j;g++){c=a[g];var k=n.split(".");if(SC.none(k[1])){SC.Event.remove(e,k[0],c.target,c.action,c.args)}else{SC.Event.remove(e[k[0]],k[1],c.target,c.action,c.args)}}}}}}else{if(window.XMLHttpRequest&&e.addEventListener){SC.Event.remove(e,"readystatechange",this,this.finishRequest)}else{e.onreadystatechange=null}}return YES}return NO}});sc_require("system/response");SC.Request=SC.Object.extend(SC.Copyable,SC.Freezable,{allowCredentials:YES,isAsynchronous:YES,isJSON:NO,isXML:NO,attachIdentifyingHeaders:YES,headers:function(){var a=this._headers;if(!a){a=this._headers={}}return a}.property().cacheable(),isSameDomain:function(){var b=this.get("address"),e=/^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+)|)|)/,a=window.location,d,c;d=e.exec(b.toLowerCase());c=e.exec(a.href.toLowerCase());return SC.none(d)||(d[1]===c[1]&&d[2]===c[2]&&(d[3]||(d[1]==="http:"?80:443))===(c[3]||(c[1]==="http:"?80:443)))}.property("address").cacheable(),responseClass:SC.XHRResponse,source:null,address:null,type:"GET",timeout:null,body:null,encodedBody:function(){var a=this.get("body");if(a&&this.get("isJSON")){a=SC.json.encode(a)}return a}.property("isJSON","isXML","body").cacheable(),willSend:function(b,a){},didSend:function(b,a){},willReceive:function(b,a){},didReceive:function(b,a){},concatenatedProperties:"COPY_KEYS",COPY_KEYS:["attachIdentifyingHeaders","allowCredentials","isAsynchronous","isJSON","isXML","address","type","timeout","body","responseClass","willSend","didSend","willReceive","didReceive"],copy:function(){var a={},c=this.COPY_KEYS,d=c.length,b;while(--d>=0){b=c[d];if(this.hasOwnProperty(b)){a[b]=this.get(b)}}if(this.hasOwnProperty("listeners")){a.listeners=SC.copy(this.get("listeners"))}if(this.hasOwnProperty("_headers")){a._headers=SC.copy(this._headers)}a.source=this.get("source")||this;return this.constructor.create(a)},header:function(a,b){var d,c;if(SC.typeOf(a)===SC.T_STRING){c=this._headers;if(arguments.length===1){return c?c[a]:null}else{this.propertyWillChange("headers");if(!c){c=this._headers={}}c[a]=b;this.propertyDidChange("headers");return this}}else{if(b===undefined){c=a;this.beginPropertyChanges();for(d in c){if(!c.hasOwnProperty(d)){continue}this.header(d,c[d])}this.endPropertyChanges();return this}}return this},clearHeaders:function(){this.propertyWillChange("headers");this._headers={};this.propertyDidChange("headers")},async:function(a){if(a===undefined){a=YES}return this.set("isAsynchronous",a)},credentials:function(a){if(a===undefined){a=YES}return this.set("allowCredentials",a)},timeoutAfter:function(a){return this.set("timeout",a)},json:function(a){if(a===undefined){a=YES}if(a){this.set("isXML",NO)}return this.set("isJSON",a)},xml:function(a){if(a===undefined){a=YES}if(a){this.set("isJSON",NO)}return this.set("isXML",a)},_prep:function(){var a=!!this.header("Content-Type");if(this.get("attachIdentifyingHeaders")){this.header("X-Requested-With","XMLHttpRequest");this.header("X-SproutCore-Version",SC.VERSION)}if(!a&&!!this.get("body")){if(this.get("isJSON")){this.header("Content-Type","application/json")}else{if(this.get("isXML")){this.header("Content-Type","text/xml")}}}return this},send:function(a){var b=this.get("timeout");if(b&&!this.get("isAsynchronous")){throw new Error("Timeout values cannot be used with synchronous requests")}else{if(b===0){throw new Error("The timeout value must either not be specified or must be greater than 0")}}if(a){this.set("body",a)}return SC.Request.manager.sendRequest(this.copy()._prep())},resend:function(){var a=this.get("source")?this:this.copy()._prep();return SC.Request.manager.sendRequest(a)},notify:function(g,f,e){var b,c,a;if(SC.typeOf(g)!==SC.T_NUMBER&&SC.typeOf(g)!==SC.T_STRING){b=new Array(arguments.length-2);for(c=0,a=b.length;c<a;c++){b[c]=arguments[c+2]}e=f;f=g;g=0}else{if(arguments.length>3){b=new Array(arguments.length-3);for(c=0,a=b.length;c<a;c++){b[c]=arguments[c+3]}}else{b=[]}}var d=this.get("listeners");if(!d){this.set("listeners",d={})}if(!d[g]){d[g]=[]}d[g].push({target:f,action:e,args:b});return this}});SC.Request.mixin({getUrl:function(a){return this.create().set("address",a).set("type","GET")},postUrl:function(b,a){var c=this.create().set("address",b).set("type","POST");if(a){c.set("body",a)}return c},deleteUrl:function(a){return this.create().set("address",a).set("type","DELETE")},putUrl:function(b,a){var c=this.create().set("address",b).set("type","PUT");if(a){c.set("body",a)}return c},patchUrl:function(b,a){var c=this.create().set("address",b).set("type","PATCH");if(a){c.set("body",a)}return c}});SC.Request.WARN_ON_LOADEND=YES;SC.Request.manager=SC.Object.create({maxRequests:6,inflight:[],pending:[],sendRequest:function(b){if(!b){return null}var a=b.get("responseClass").create({request:b});this.get("pending").pushObject(a);this.fireRequestIfNeeded();return a},cancel:function(a){var c=this.get("pending"),b=this.get("inflight");if(c.indexOf(a)>=0){this.propertyWillChange("pending");c.removeObject(a);this.propertyDidChange("pending");return YES}else{if(b.indexOf(a)>=0){a.cancel();b.removeObject(a);this.fireRequestIfNeeded();return YES}}return NO},cancelAll:function(){var a=this.getPath("pending.length"),c=this.getPath("inflight.length"),e=this.get("inflight"),f=this.get("pending");if(a||c){for(var b=c-1;b>=0;b--){var d=e.objectAt(b);d.cancel()}f.replace(0,a);e.replace(0,c);return YES}return NO},fireRequestIfNeeded:function(){var d=this.get("pending"),c=this.get("inflight"),a=this.get("maxRequests"),b;if((d.length>0)&&(c.length<a)){b=d.shiftObject();c.pushObject(b);b.fire()}},transportDidClose:function(a){this.get("pending").removeObject(a);this.get("inflight").removeObject(a);this.fireRequestIfNeeded()},isPending:function(a){return this.get("pending").contains(a)},isInFlight:function(a){return this.get("inflight").contains(a)}});sc_require("mixins/websocket_delegate");SC.WebSocket=SC.Object.extend(SC.DelegateSupport,SC.WebSocketDelegate,{server:null,isSupported:null,isConnected:false,isAuth:null,isJSON:true,delegate:null,autoReconnect:true,reconnectInterval:10000,connect:function(){var b=this;if(this.isSupported===null){this.set("isSupported",!!window.WebSocket)}if(!this.isSupported||this.socket){return this}try{var a=this.socket=new WebSocket(this.get("server"));a.onopen=function(){SC.RunLoop.begin();b.onOpen.apply(b,arguments);SC.RunLoop.end()};a.onmessage=function(){SC.RunLoop.begin();b.onMessage.apply(b,arguments);SC.RunLoop.end()};a.onclose=function(){SC.RunLoop.begin();b.onClose.apply(b,arguments);SC.RunLoop.end()};a.onerror=function(){SC.RunLoop.begin();b.onError.apply(b,arguments);SC.RunLoop.end()}}catch(c){SC.error("An error has occurred while connnecting to the websocket server: "+c)}return this},close:function(b,c){var a=this.socket;if(a&&a.readyState===SC.WebSocket.OPEN){this.socket.close(b,c)}return this},notify:function(e,g,f){var b,c,a;if(SC.typeOf(e)!==SC.T_STRING){b=new Array(arguments.length-2);for(c=0,a=b.length;c<a;c++){b[c]=arguments[c+2]}f=g;g=e;e="onmessage"}else{if(arguments.length>3){b=new Array(arguments.length-3);for(c=0,a=b.length;c<a;c++){b[c]=arguments[c+3]}}else{b=[]}}var d=this.get("listeners");if(!d){this.set("listeners",d={})}if(!d[e]){d[e]=[]}d[e].push({target:g,action:f,args:b});return this},send:function(a){if(this.isConnected===true&&this.isAuth!==false){if(this.isJSON){a=JSON.stringify(a)}this.socket.send(a)}else{this.addToQueue(a)}return this},onOpen:function(c){var a=this.get("objectDelegate");this.set("isConnected",true);var b=a.webSocketDidOpen(this,c);if(b!==true){this._notifyListeners("onopen",c)}this.fireQueue()},onMessage:function(a){if(a){var b=this.get("objectDelegate"),d,e,c;d=e=a.data;c=b.webSocketDidReceiveMessage(this,e);if(c!==true){if(this.isJSON){d=JSON.parse(e)}this._notifyListeners("onmessage",d)}}this.fireQueue()},onClose:function(c){var a=this.get("objectDelegate");this.set("isConnected",false);this.set("isAuth",null);this.socket=null;var b=a.webSocketDidClose(this,c);if(b!==true){this._notifyListeners("onclose",c);this.tryReconnect()}},onError:function(c){var a=this.get("objectDelegate"),b=a.webSocketDidError(this,c);if(b!==true){this._notifyListeners("onerror",c)}},addToQueue:function(b){var a=this.queue;if(!a){this.queue=a=[]}a.push(b)},fireQueue:function(){var b=this.queue;if(!b||b.length===0){return}b=SC.A(b);this.queue=null;for(var c=0,a=b.length;c<a;c++){var d=b[c];this.send(d)}},tryReconnect:function(){if(!this.get("autoReconnect")){return}var a=this;setTimeout(function(){a.connect()},this.get("reconnectInterval"))},_notifyListeners:function(a,j){var h=(this.listeners||{})[a],k,f,b,g;if(!h){return NO}var e=NO,d=h.length;for(var c=0;c<d;c++){k=h[c];g=(k.args||[]).copy();g.unshift(j);g.unshift(this);f=k.target;b=k.action;if(SC.typeOf(b)===SC.T_STRING){b=f[b]}e=b.apply(f,g);if(e===true){return e}}return e},objectDelegate:function(){var a=this.get("delegate");return this.delegateFor("isWebSocketDelegate",a,this)}.property("delegate").cacheable(),socket:null,listeners:null,queue:null});SC.WebSocket.mixin({CONNECTING:0,OPEN:1,CLOSING:2,CLOSED:3});SC.FOCUS_ALL_CONTROLS=false;SC.TreeItemContent={isTreeItemContent:YES,treeItemChildren:null,treeItemIsExpanded:YES,treeItemIsGrouped:NO,treeItemDisclosureState:function(b,a){return this.get("treeItemIsExpanded")?SC.BRANCH_OPEN:SC.BRANCH_CLOSED},treeItemCollapse:function(b,a){this.setIfChanged("treeItemIsExpanded",NO)},treeItemExpand:function(b,a){this.setIfChanged("treeItemIsExpanded",YES)},treeItemBranchIndexes:function(e,c){var d=this.get("treeItemChildren"),b,g,a,f;if(!d){return null}b=SC.IndexSet.create();g=d.get("length");for(a=0;a<g;a++){if(!(f=d.objectAt(a))){continue}if(!f.get("treeItemChildren")){continue}if(f.treeItemDisclosureState(this,a)!==SC.LEAF_NODE){b.add(a)}}return b.get("length")>0?b:null}};SC.BRANCH_OPEN=17;SC.BRANCH_CLOSED=18;SC.LEAF_NODE=32;SC.CollectionContent={isCollectionContent:YES,contentIndexIsSelected:function(d,b,a){var c=d.get("selection");return c?c.contains(b,a):NO},contentIndexIsEnabled:function(c,b,a){return c.get("isEnabled")},contentGroupIndexes:function(b,a){return null},contentIndexIsGroup:function(c,b,a){return NO},contentIndexOutlineLevel:function(c,b,a){return -1},contentIndexDisclosureState:function(c,b,a){return SC.LEAF_NODE},contentIndexExpand:function(c,b,a){SC.Logger.log("contentIndexExpand(%@, %@, %@)".fmt(c,b,a))},contentIndexCollapse:function(c,b,a){SC.Logger.log("contentIndexCollapse(%@, %@, %@)".fmt(c,b,a))}};sc_require("mixins/tree_item_content");sc_require("mixins/collection_content");SC.TreeItemObserver=SC.Object.extend(SC.Array,SC.CollectionContent,{_cachedItem:null,_cachedDelegate:null,item:null,delegate:null,treeItemChildrenKey:"treeItemChildren",treeItemIsExpandedKey:"treeItemIsExpanded",parentObserver:null,parentItem:function(){var a=this.get("parentObserver");return a?a.get("item"):null}.property("parentObserver").cacheable(),index:null,outlineLevel:0,children:null,disclosureState:SC.BRANCH_OPEN,branchIndexes:function(){var e=this.get("item"),b,f,a,d,c;if(!e){return SC.IndexSet.EMPTY}else{if(e.isTreeItemContent){f=this.get("parentItem");a=this.get("index");return e.treeItemBranchIndexes(f,a)}else{d=this.get("children");if(!d){return null}c=SC.IndexSet.create();b=d.get("length");f=e;for(a=0;a<b;a++){e=d.objectAt(a);if(!e){continue}if(!this._computeChildren(e,f,a)){continue}if(this._computeDisclosureState(e,f,a)!==SC.LEAF_NODE){c.add(a)}}return c.get("length")>0?c:null}}}.property("children").cacheable(),isHeaderVisible:function(){return !!this.get("parentObserver")}.property("parentObserver").cacheable(),length:0,objectAt:function(d,g){var a=this.get("length"),f=this.get("item"),b=this._objectAtCache,h=d,c,e;if(d>=a){return undefined}if(this.get("isHeaderVisible")){if(d===0){return f}else{h--}}f=null;if(!b){b=this._objectAtCache=[]}if((f=b[d])!==undefined){return f}e=this.get("children");if(!e){return undefined}c=this.get("branchIndexes");if(c){c.forEach(function(l){if(f||(l>h)){return}var k=this.branchObserverAt(l),j;if(!k){return}j=k.get("length");if(l+j>h){f=k.objectAt(h-l,g);h=-1}else{h=h-(j-1)}},this)}if(h>=0){f=e.objectAt(h,g)}b[d]=f;return f},replace:function(a,b,j,d){var i=a,g=null,e,f,h;if(d===undefined){d=SC.DROP_BEFORE}if(this.get("isHeaderVisible")){i--}if(i<0){throw new Error("Tree Item cannot replace itself")}e=this.get("branchIndexes");if(e){e.forEach(function(k){if(g||(k>=i)){return}g=this.branchObserverAt(k);if(!g){return}f=g.get("length");if((k+f===i)&&d===SC.DROP_AFTER){i=i-k}else{if(k+f>i){i=i-k}else{i=i-(f-1);g=null}}},this)}if(g){g.replace(i,b,j,d);return this}h=i+b;if(b>1&&e){e.forEachIn(i,e.get("max")-i,function(k){if(k>h){return}if(!(g=this.branchObserverAt(k))){return}f=g.get("length");h=h-(f-1)},this)}b=h-i;var c=this.get("children");if(!c){throw new Error("cannot replace() tree item with no children")}if((b<0)||(h>c.get("length"))){throw new Error("replace() range must lie within a single tree item")}c.replace(i,b,j,d);return this},observerContentDidChange:function(b,c,i){this.invalidateBranchObserversAt(b);this._objectAtCache=this._outlineLevelCache=null;this._disclosureStateCache=null;this.notifyPropertyChange("branchIndexes");var d=this.get("length"),e=this._computeLength(),g=this.get("parentObserver"),f;if(d!==e){this.set("length",e)}if(!this._notifyParent){return this}if(g){f=SC.IndexSet.create(this.get("index"));g._childrenRangeDidChange(g.get("children"),null,"[]",f)}else{if(d===e){c=this.expandChildIndex(b+c);b=this.expandChildIndex(b);c=c-b;i=0}else{b=this.expandChildIndex(b);c=e-b;i=e-d}var h=c;var a=i+h;this.arrayContentDidChange(b,h,a)}},expandChildIndex:function(c){var b=c;if(this.get("isHeaderVisible")){c++}var a=this.get("branchIndexes");if(!a||a.get("length")===0){return b}a.forEachIn(0,c,function(d){b+=this.branchObserverAt(d).get("length")-1},this);return b},contentGroupIndexes:function(a,e){var c;if(e!==this){return null}if(this.get("parentObserver")){return null}var d=this.get("item"),g,b,h,f;if(d&&d.isTreeItemContent){g=d.get("treeItemIsGrouped")}else{g=!!this.delegate.get("treeItemIsGrouped")}if(g){c=SC.IndexSet.create();b=this.get("branchIndexes");if(b){h=b.min();f=0;b.forEach(function(k){c.add(k+f,1);var j=this.branchObserverAt(k);if(j){f+=j.get("length")-1;h+=f}},this)}}else{c=null}return c},contentIndexIsGroup:function(b,d,a){var c=this.contentGroupIndexes(b,d);return c?c.contains(a):NO},contentIndexOutlineLevel:function(b,g,f){if(g!==this){return -1}var c=this._outlineLevelCache;if(c&&(c[f]!==undefined)){return c[f]}if(!c){c=this._outlineLevelCache=[]}var a=this.get("length"),h=f,e=null,d;if(f>=a){return -1}if(this.get("isHeaderVisible")){if(f===0){c[0]=this.get("outlineLevel")-1;return c[0]}else{h--}}d=this.get("branchIndexes");if(d){d.forEach(function(l){if((e!==null)||(l>h)){return}var k=this.branchObserverAt(l),j;if(!k){return}j=k.get("length");if(l+j>h){e=k.contentIndexOutlineLevel(b,k,h-l);h=-1}else{h=h-(j-1)}},this)}if(h>=0){e=this.get("outlineLevel")}c[f]=e;return e},contentIndexDisclosureState:function(b,g,f){if(g!==this){return -1}var c=this._disclosureStateCache;if(c&&(c[f]!==undefined)){return c[f]}if(!c){c=this._disclosureStateCache=[]}var a=this.get("length"),h=f,e=null,d;if(f>=a){return SC.LEAF_NODE}if(this.get("isHeaderVisible")){if(f===0){c[0]=this.get("disclosureState");return c[0]}else{h--}}d=this.get("branchIndexes");if(d){d.forEach(function(l){if((e!==null)||(l>h)){return}var k=this.branchObserverAt(l),j;if(!k){return}j=k.get("length");if(l+j>h){e=k.contentIndexDisclosureState(b,k,h-l);h=-1}else{h=h-(j-1)}},this)}if(h>=0){e=SC.LEAF_NODE}c[f]=e;return e},contentIndexExpand:function(b,f,a){var c,g=a,d,e;if(f!==this){return}if(this.get("isHeaderVisible")){if(a===0){this._expand(this.get("item"));return}else{g--}}c=this.get("branchIndexes");if(c){c.forEach(function(k){if(k>=g){return}var j=this.branchObserverAt(k),h;if(!j){return}h=j.get("length");if(k+h>g){j.contentIndexExpand(b,j,g-k);g=-1}else{g=g-(h-1)}},this)}if(g>=0){d=this.get("children");e=d?d.objectAt(g):null;if(e){this._expand(e,this.get("item"),g)}}},contentIndexCollapse:function(b,f,a){var c,d,e,g=a;if(f!==this){return}if(this.get("isHeaderVisible")){if(a===0){this._collapse(this.get("item"));return}else{g--}}c=this.get("branchIndexes");if(c){c.forEach(function(k){if(k>=g){return}var j=this.branchObserverAt(k),h;if(!j){return}h=j.get("length");if(k+h>g){j.contentIndexCollapse(b,j,g-k);g=-1}else{g=g-(h-1)}},this)}if(g>=0){d=this.get("children");e=d?d.objectAt(g):null;if(e){this._collapse(e,this.get("item"),g)}}},branchObserverAt:function(d){var c=this._branchObserversByIndex,b=this._branchObserverIndexes,a,f,e;if(!c){c=this._branchObserversByIndex=[]}if(!b){b=this._branchObserverIndexes=SC.IndexSet.create()}a=c[d];if(a){return a}e=this.get("children");f=e?e.objectAt(d):null;if(!f){return null}c[d]=a=SC.TreeItemObserver.create({item:f,delegate:this.get("delegate"),parentObserver:this,index:d,outlineLevel:this.get("outlineLevel")+1});b.add(d);return a},invalidateBranchObserversAt:function(c){var b=this._branchObserversByIndex,a=this._branchObserverIndexes;if(!b||b.length<=c){return this}if(c<0){c=0}a.forEachIn(c,a.get("max")-c,function(e){var d=b[e];if(d){d.destroy()}},this);b.length=c;return this},_cleanUpCachedDelegate:function(){var a=this._cachedDelegate;if(a){a.removeObserver("treeItemIsExpandedKey",this,this.treeItemIsExpandedKeyDidChange);a.removeObserver("treeItemChildrenKey",this,this.treeItemChildrenKeyDidChange);a.removeObserver("treeItemIsGrouped",this,this.treeItemIsGroupedDidChange);this._cleanUpCachedItem();this.set("treeItemChildrenKey","treeItemChildren");this.set("treeItemIsExpandedKey","treeItemIsExpanded");this._cachedDelegate=null}},_cleanUpCachedItem:function(){var b=this._cachedItem,c=this.get("treeItemIsExpandedKey"),a=this.get("treeItemChildrenKey");if(b){b.removeObserver(c,this,this._itemIsExpandedDidChange);b.removeObserver(a,this,this._itemChildrenDidChange);this._cachedItem=null}},init:function(){arguments.callee.base.apply(this,arguments);this._delegateDidChange();this._itemDidChange();this._notifyParent=YES},destroy:function(){this.invalidateBranchObserversAt(0);this._objectAtCache=null;this._notifyParent=NO;this._cleanUpCachedItem();this._cleanUpCachedDelegate();var a=this._children,b=this._childrenRangeObserver;if(a&&b){a.removeRangeObserver(b)}this.set("length",0);arguments.callee.base.apply(this,arguments)},_itemDidChange:function(){var b=this.get("item"),a,c;c=this.get("treeItemIsExpandedKey");a=this.get("treeItemChildrenKey");this._cleanUpCachedItem();b.addObserver(c,this,this._itemIsExpandedDidChange);b.addObserver(a,this,this._itemChildrenDidChange);this.beginPropertyChanges();this._itemIsExpandedDidChange();this._itemChildrenDidChange();this.endPropertyChanges();this._cachedItem=b}.observes("item"),_itemIsExpandedDidChange:function(){var c=this.get("disclosureState"),b=this.get("item"),a;a=this._computeDisclosureState(b);if(c!==a){this.set("disclosureState",a)}},_itemChildrenDidChange:function(){var a=this.get("children"),c=this.get("item"),b;b=this._computeChildren(c);if(a!==b){this.set("children",b)}},_childrenDidChange:function(){var c=this.get("disclosureState"),d=c===SC.BRANCH_OPEN?this.get("children"):null,b=this._children,a=this._childrenRangeObserver;if(b===d){return this}if(a){b.removeRangeObserver(a)}if(d){this._childrenRangeObserver=d.addRangeObserver(null,this,this._childrenRangeDidChange)}else{this._childrenRangeObserver=null}this._children=d;this._childrenRangeDidChange(d,null,"[]",null)}.observes("children","disclosureState"),_childrenRangeDidChange:function(f,i,h,d){var a=this.get("children"),e=a?a.get("length"):0,c=d?d.get("min"):0,g=d?d.get("max"):e,b=this._childrenLen||0;this._childrenLen=e;this.observerContentDidChange(c,g-c,e-b)},_computeDisclosureState:function(c,d,a){var b;if(!c||!this._computeChildren(c)){return SC.LEAF_NODE}else{if(c.isTreeItemContent){if(d===undefined){d=this.get("parentItem")}if(a===undefined){a=this.get("index")}return c.treeItemDisclosureState(d,a)}else{b=this.get("treeItemIsExpandedKey");return c.get(b)?SC.BRANCH_OPEN:SC.BRANCH_CLOSED}}},_collapse:function(c,d,a){var b;if(!c||!this._computeChildren(c)){return this}else{if(c.isTreeItemContent){if(d===undefined){d=this.get("parentItem")}if(a===undefined){a=this.get("index")}c.treeItemCollapse(d,a)}else{b=this.get("treeItemIsExpandedKey");c.setIfChanged(b,NO)}}return this},_delegateDidChange:function(){var a=this.get("delegate");this._cleanUpCachedDelegate();if(a){a.addObserver("treeItemChildrenKey",this,this.treeItemChildrenKeyDidChange);a.addObserver("treeItemIsExpandedKey",this,this.treeItemIsExpandedKeyDidChange);a.addObserver("treeItemIsGrouped",this,this.treeItemIsGroupedDidChange);this.treeItemChildrenKeyDidChange();this.treeItemIsExpandedKeyDidChange();this.treeItemIsGroupedDidChange()}this._itemDidChange();this._cachedDelegate=a}.observes("delegate"),_expand:function(c,d,a){var b;if(!c||!this._computeChildren(c)){return this}else{if(c.isTreeItemContent){if(d===undefined){d=this.get("parentItem")}if(a===undefined){a=this.get("index")}c.treeItemExpand(d,a)}else{b=this.get("treeItemIsExpandedKey");c.setIfChanged(b,YES)}}return this},_computeChildren:function(b){var a;if(!b){return null}else{if(b.isTreeItemContent){return b.get("treeItemChildren")}else{a=this.get("treeItemChildrenKey");return b.get(a)}}},_computeLength:function(){var b=this.get("isHeaderVisible")?1:0,d=this.get("disclosureState"),c=this.get("children"),a;if((d===SC.BRANCH_OPEN)&&c){b+=c.get("length");a=this.get("branchIndexes");if(a){a.forEach(function(e){var f=this.branchObserverAt(e);b+=f.get("length")-1},this)}}return b},treeItemChildrenKeyDidChange:function(){var a=this.get("delegate"),b;b=a?a.get("treeItemChildrenKey"):"treeItemChildren";this.set("treeItemChildrenKey",b?b:"treeItemChildren")},treeItemIsExpandedKeyDidChange:function(){var a=this.get("delegate"),b;b=a?a.get("treeItemIsExpandedKey"):"treeItemIsExpanded";this.set("treeItemIsExpandedKey",b?b:"treeItemIsExpanded")},treeItemIsGroupedDidChange:function(){this.notifyPropertyChange("branchIndexes")}});sc_require("private/tree_item_observer");SC.TreeController=SC.ObjectController.extend(SC.SelectionSupport,{treeItemIsGrouped:NO,treeItemIsExpandedKey:"treeItemIsExpanded",treeItemChildrenKey:"treeItemChildren",arrangedObjects:null,init:function(){arguments.callee.base.apply(this,arguments);this._contentDidChange()},_contentDidChange:function(){var a=this.get("arrangedObjects"),b=this.get("content");if(b){if(a){a.set("item",b)}else{a=SC.TreeItemObserver.create({item:b,delegate:this});a.bind("allowsSelection",this,"allowsSelection");a.bind("allowsMultipleSelection",this,"allowsMultipleSelection");a.bind("allowsEmptySelection",this,"allowsEmptySelection");a.addObserver("[]",this,this._sctc_arrangedObjectsContentDidChange);this.set("arrangedObjects",a)}}else{if(a){a.destroy();this.set("arrangedObjects",null);this._sctc_arrangedObjectsContentDidChange()}}}.observes("content"),_sctc_arrangedObjectsContentDidChange:function(){this.updateSelectionAfterContentChange()}.observes(),canSelectGroups:NO,firstSelectableObject:function(){var d=this.get("arrangedObjects"),c,b,a=0;if(!d){return null}if(this.get("canSelectGroups")){return d.get("firstObject")}c=d.contentGroupIndexes(null,d);b=d.get("length");while(c.contains(a)&&(a<b)){a++}return a>=b?null:d.objectAt(a)}.property()});SC.InlineTextFieldDelegate={editor:null,acquireEditor:function(a){var b=this.editor;if(b){if(b.get("isEditing")&&!b.commitEditing()&&!b.discardEditing()){return null}this.releaseEditor(b)}var d=a.exampleEditor?a.exampleEditor:SC.InlineTextFieldView,c=a.get("parentView");b=this.editor=c.createChildView(d,{inlineEditorDelegate:this});c.appendChild(b);return b},releaseEditor:function(a){a.destroy();this.editor=null;return YES}};SC.STRING_TITLEIZE_REGEXP=(/([\s|\-|\_|\n])([^\s|\-|\_|\n]?)/g);SC.STRING_HUMANIZE_REGEXP=(/[\-_]/g);SC.STRING_REGEXP_ESCAPED_REGEXP=(/([\\\.\+\*\?\[\^\]\$\(\)\{\}\=\!\<\>\|\:])/g);SC.STRING_DASHERIZE_CACHE={top:"top",left:"left",right:"right",bottom:"bottom",width:"width",height:"height",minWidth:"min-width",maxWidth:"max-width"};SC.mixin(SC.String,{capitalizeEach:function(a){return a.replace(SC.STRING_TITLEIZE_REGEXP,function(c,b,d){return(d)?(b+d.toUpperCase()):b}).capitalize()},titleize:function(b){var a=b.replace(SC.STRING_DECAMELIZE_REGEXP,"$1_$2");return a.replace(SC.STRING_TITLEIZE_REGEXP,function(c,e,d){return d?" "+d.toUpperCase():" "}).capitalize()},classify:function(d){var a=d.replace(SC.STRING_TITLEIZE_REGEXP,function(e,g,f){return f?f.toUpperCase():""});var c=a.charAt(0),b=c.toUpperCase();return c!==b?b+a.slice(1):a},humanize:function(a){return SC.String.decamelize(a).replace(SC.STRING_HUMANIZE_REGEXP," ")},escapeForRegExp:function(a){return a.replace(SC.STRING_REGEXP_ESCAPED_REGEXP,"\\$1")},removeDiacritics:function(g){var a=SC.diacriticMappingTable;if(!a){SC.diacriticMappingTable={"À":"A","Á":"A","Â":"A","Ã":"A","Ä":"A","Å":"A","Ā":"A","Ă":"A","Ą":"A","Ǎ":"A","Ǟ":"A","Ǡ":"A","Ǻ":"A","Ȁ":"A","Ȃ":"A","Ȧ":"A","Ḁ":"A","Ạ":"A","Ả":"A","Ấ":"A","Ầ":"A","Ẩ":"A","Ẫ":"A","Ậ":"A","Ắ":"A","Ằ":"A","Ẳ":"A","Ẵ":"A","Ặ":"A","Å":"A","Ḃ":"B","Ḅ":"B","Ḇ":"B","Ç":"C","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","Ḉ":"C","Ď":"D","Ḋ":"D","Ḍ":"D","Ḏ":"D","Ḑ":"D","Ḓ":"D","È":"E","É":"E","Ê":"E","Ë":"E","Ē":"E","Ĕ":"E","Ė":"E","Ę":"E","Ě":"E","Ȅ":"E","Ȇ":"E","Ȩ":"E","Ḕ":"E","Ḗ":"E","Ḙ":"E","Ḛ":"E","Ḝ":"E","Ẹ":"E","Ẻ":"E","Ẽ":"E","Ế":"E","Ề":"E","Ể":"E","Ễ":"E","Ệ":"E","Ḟ":"F","Ĝ":"G","Ğ":"G","Ġ":"G","Ģ":"G","Ǧ":"G","Ǵ":"G","Ḡ":"G","Ĥ":"H","Ȟ":"H","Ḣ":"H","Ḥ":"H","Ḧ":"H","Ḩ":"H","Ḫ":"H","Ì":"I","Í":"I","Î":"I","Ï":"I","Ĩ":"I","Ī":"I","Ĭ":"I","Į":"I","İ":"I","Ǐ":"I","Ȉ":"I","Ȋ":"I","Ḭ":"I","Ḯ":"I","Ỉ":"I","Ị":"I","Ĵ":"J","Ķ":"K","Ǩ":"K","Ḱ":"K","Ḳ":"K","Ḵ":"K","Ĺ":"L","Ļ":"L","Ľ":"L","Ḷ":"L","Ḹ":"L","Ḻ":"L","Ḽ":"L","Ḿ":"M","Ṁ":"M","Ṃ":"M","Ñ":"N","Ń":"N","Ņ":"N","Ň":"N","Ǹ":"N","Ṅ":"N","Ṇ":"N","Ṉ":"N","Ṋ":"N","Ò":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"O","Ō":"O","Ŏ":"O","Ő":"O","Ơ":"O","Ǒ":"O","Ǫ":"O","Ǭ":"O","Ȍ":"O","Ȏ":"O","Ȫ":"O","Ȭ":"O","Ȯ":"O","Ȱ":"O","Ṍ":"O","Ṏ":"O","Ṑ":"O","Ṓ":"O","Ọ":"O","Ỏ":"O","Ố":"O","Ồ":"O","Ổ":"O","Ỗ":"O","Ộ":"O","Ớ":"O","Ờ":"O","Ở":"O","Ỡ":"O","Ợ":"O","Ṕ":"P","Ṗ":"P","Ŕ":"R","Ŗ":"R","Ř":"R","Ȑ":"R","Ȓ":"R","Ṙ":"R","Ṛ":"R","Ṝ":"R","Ṟ":"R","Ś":"S","Ŝ":"S","Ş":"S","Š":"S","Ș":"S","Ṡ":"S","Ṣ":"S","Ṥ":"S","Ṧ":"S","Ṩ":"S","Ţ":"T","Ť":"T","Ț":"T","Ṫ":"T","Ṭ":"T","Ṯ":"T","Ṱ":"T","Ù":"U","Ú":"U","Û":"U","Ü":"U","Ũ":"U","Ū":"U","Ŭ":"U","Ů":"U","Ű":"U","Ų":"U","Ư":"U","Ǔ":"U","Ǖ":"U","Ǘ":"U","Ǚ":"U","Ǜ":"U","Ȕ":"U","Ȗ":"U","Ṳ":"U","Ṵ":"U","Ṷ":"U","Ṹ":"U","Ṻ":"U","Ụ":"U","Ủ":"U","Ứ":"U","Ừ":"U","Ử":"U","Ữ":"U","Ự":"U","Ṽ":"V","Ṿ":"V","Ŵ":"W","Ẁ":"W","Ẃ":"W","Ẅ":"W","Ẇ":"W","Ẉ":"W","Ẋ":"X","Ẍ":"X","Ý":"Y","Ŷ":"Y","Ÿ":"Y","Ȳ":"Y","Ẏ":"Y","Ỳ":"Y","Ỵ":"Y","Ỷ":"Y","Ỹ":"Y","Ź":"Z","Ż":"Z","Ž":"Z","Ẑ":"Z","Ẓ":"Z","Ẕ":"Z","`":"`","à":"a","á":"a","â":"a","ã":"a","ä":"a","å":"a","ā":"a","ă":"a","ą":"a","ǎ":"a","ǟ":"a","ǡ":"a","ǻ":"a","ȁ":"a","ȃ":"a","ȧ":"a","ḁ":"a","ạ":"a","ả":"a","ấ":"a","ầ":"a","ẩ":"a","ẫ":"a","ậ":"a","ắ":"a","ằ":"a","ẳ":"a","ẵ":"a","ặ":"a","ḃ":"b","ḅ":"b","ḇ":"b","ç":"c","ć":"c","ĉ":"c","ċ":"c","č":"c","ḉ":"c","ď":"d","ḋ":"d","ḍ":"d","ḏ":"d","ḑ":"d","ḓ":"d","è":"e","é":"e","ê":"e","ë":"e","ē":"e","ĕ":"e","ė":"e","ę":"e","ě":"e","ȅ":"e","ȇ":"e","ȩ":"e","ḕ":"e","ḗ":"e","ḙ":"e","ḛ":"e","ḝ":"e","ẹ":"e","ẻ":"e","ẽ":"e","ế":"e","ề":"e","ể":"e","ễ":"e","ệ":"e","ḟ":"f","ĝ":"g","ğ":"g","ġ":"g","ģ":"g","ǧ":"g","ǵ":"g","ḡ":"g","ĥ":"h","ȟ":"h","ḣ":"h","ḥ":"h","ḧ":"h","ḩ":"h","ḫ":"h","ẖ":"h","ì":"i","í":"i","î":"i","ï":"i","ĩ":"i","ī":"i","ĭ":"i","į":"i","ǐ":"i","ȉ":"i","ȋ":"i","ḭ":"i","ḯ":"i","ỉ":"i","ị":"i","ĵ":"j","ǰ":"j","ķ":"k","ǩ":"k","ḱ":"k","ḳ":"k","ḵ":"k","ĺ":"l","ļ":"l","ľ":"l","ḷ":"l","ḹ":"l","ḻ":"l","ḽ":"l","ḿ":"m","ṁ":"m","ṃ":"m","ñ":"n","ń":"n","ņ":"n","ň":"n","ǹ":"n","ṅ":"n","ṇ":"n","ṉ":"n","ṋ":"n","ò":"o","ó":"o","ô":"o","õ":"o","ö":"o","ō":"o","ŏ":"o","ő":"o","ơ":"o","ǒ":"o","ǫ":"o","ǭ":"o","ȍ":"o","ȏ":"o","ȫ":"o","ȭ":"o","ȯ":"o","ȱ":"o","ṍ":"o","ṏ":"o","ṑ":"o","ṓ":"o","ọ":"o","ỏ":"o","ố":"o","ồ":"o","ổ":"o","ỗ":"o","ộ":"o","ớ":"o","ờ":"o","ở":"o","ỡ":"o","ợ":"o","ṕ":"p","ṗ":"p","ŕ":"r","ŗ":"r","ř":"r","ȑ":"r","ȓ":"r","ṙ":"r","ṛ":"r","ṝ":"r","ṟ":"r","ś":"s","ŝ":"s","ş":"s","š":"s","ș":"s","ṡ":"s","ṣ":"s","ṥ":"s","ṧ":"s","ṩ":"s","ţ":"t","ť":"t","ț":"t","ṫ":"t","ṭ":"t","ṯ":"t","ṱ":"t","ẗ":"t","ù":"u","ú":"u","û":"u","ü":"u","ũ":"u","ū":"u","ŭ":"u","ů":"u","ű":"u","ų":"u","ư":"u","ǔ":"u","ǖ":"u","ǘ":"u","ǚ":"u","ǜ":"u","ȕ":"u","ȗ":"u","ṳ":"u","ṵ":"u","ṷ":"u","ṹ":"u","ṻ":"u","ụ":"u","ủ":"u","ứ":"u","ừ":"u","ử":"u","ữ":"u","ự":"u","ṽ":"v","ṿ":"v","ŵ":"w","ẁ":"w","ẃ":"w","ẅ":"w","ẇ":"w","ẉ":"w","ẘ":"w","ẋ":"x","ẍ":"x","ý":"y","ÿ":"y","ŷ":"y","ȳ":"y","ẏ":"y","ẙ":"y","ỳ":"y","ỵ":"y","ỷ":"y","ỹ":"y","ź":"z","ż":"z","ž":"z","ẑ":"z","ẓ":"z","ẕ":"z"};a=SC.diacriticMappingTable}var d,e,b="",f=g.length;for(var c=0;c<=f;++c){d=g.charAt(c);e=a[d];b+=e||d}return b},pluralize:function(h){var d=SC.Locale.currentLocale.inflectionConstants;if(!d){return h.toString()}var l,f,b=h.split(/\s/).pop(),i=h.replace(b,""),a=b.charAt(0).match(/[A-Z]/)?true:false;b=b.toLowerCase();for(l=0,f=d.UNCOUNTABLE.length;l<f;l++){var g=d.UNCOUNTABLE[l];if(b==g){return h.toString()}}for(l=0,f=d.IRREGULAR.length;l<f;l++){var c=d.IRREGULAR[l][0],k=d.IRREGULAR[l][1];if((b==c)||(b==k)){if(a){k=k.capitalize()}return i+k}}for(l=0,f=d.PLURAL.length;l<f;l++){var j=d.PLURAL[l][0],e=d.PLURAL[l][1];if(j.test(b)){return h.replace(j,e)}}},singularize:function(h){var d=SC.Locale.currentLocale.inflectionConstants;if(!d){return h.toString()}var l,f,b=h.split(/\s/).pop(),i=h.replace(b,""),a=b.charAt(0).match(/[A-Z]/)?true:false;b=b.toLowerCase();for(l=0,f=d.UNCOUNTABLE.length;l<f;l++){var g=d.UNCOUNTABLE[l];if(b==g){return h.toString()}}for(l=0,f=d.IRREGULAR.length;l<f;l++){var c=d.IRREGULAR[l][0],k=d.IRREGULAR[l][1];if((b==c)||(b==k)){if(a){c=c.capitalize()}return i+c}}for(l=0,f=d.SINGULAR.length;l<f;l++){var j=d.SINGULAR[l][0],e=d.SINGULAR[l][1];if(j.test(b)){return h.replace(j,e)}}}});SC.String.strip=SC.String.trim;sc_require("system/string");SC.supplement(String.prototype,{capitalizeEach:function(){return SC.String.capitalizeEach(this,arguments)},titleize:function(a){return SC.String.titleize(this,arguments)},classify:function(a){return SC.String.classify(this,arguments)},humanize:function(a){return SC.String.humanize(this,arguments)},escapeForRegExp:function(a){return SC.String.escapeForRegExp(this,arguments)},removeDiacritics:function(a){return SC.String.removeDiacritics(this,arguments)},trim:function(a){return SC.String.trim(this,arguments)},trimLeft:function(a){return SC.String.trimLeft(this,arguments)},trimRight:function(a){return SC.String.trimRight(this,arguments)},pluralize:function(a){return SC.String.pluralize(this,arguments)},singularize:function(a){return SC.String.singularize(this,arguments)}});SC.Gesture=SC.Object.extend({_sc_isActive:false,acceptsMultitouch:false,name:"gesture",touchIsInGesture:function(b,a){return NO},touchStart:function(a){return true},start:function(){if(!this._sc_isActive){this._sc_isActive=true;var e=arguments.length,c=new Array(e);for(var d=0,a=e;d<a;d++){c[d]=arguments[d]}var b=this.name+"Start";if(this.view[b]){this.view[b].apply(this.view,c)}}},end:function(){if(this._sc_isActive){this._sc_isActive=false;var e=arguments.length,c=new Array(e);for(var d=0,a=e;d<a;d++){c[d]=arguments[d]}var b=this.name+"End";if(this.view[b]){this.view[b].apply(this.view,c)}}},change:function(){if(this._sc_isActive){var e=arguments.length,c=new Array(e);for(var d=0,a=e;d<a;d++){c[d]=arguments[d]}var b=this.name+"Changed";if(this.view[b]){this.view[b].apply(this.view,c)}}},cancel:function(){if(this._sc_isActive){this._sc_isActive=false;var e=arguments.length,c=new Array(e);for(var d=0,a=e;d<a;d++){c[d]=arguments[d]}var b=this.name+"Cancelled";if(this.view[b]){this.view[b].apply(this.view,c)}}},trigger:function(){var e=arguments.length,c=new Array(e);for(var d=0,a=e;d<a;d++){c[d]=arguments[d]}var b=this.name;if(this.view[b]){this.view[b].apply(this.view,c)}},touchSessionStarted:function(a){},touchSessionEnded:function(){},touchSessionCancelled:function(){},touchAddedToSession:function(b,a){return true},touchCancelledInSession:function(b,a){return true},touchEndedInSession:function(b,a){return true},touchesMovedInSession:function(a){return true}});sc_require("system/gesture");SC.PinchGesture=SC.Gesture.extend({_sc_isPinching:false,_sc_pinchAnchorD:null,_sc_pinchAnchorScale:null,name:"pinch",pinchDelay:500,_sc_cleanUpTouchSession:function(){if(this._sc_isPinching){this._sc_pinchingTimer.invalidate();this._sc_pinchingTimer=null;this._sc_lastPinchTime=null;this._sc_isPinching=false;this.end()}this._sc_pinchAnchorD=null},_sc_touchFinishedInSession:function(c,a){if(a.length>1){var b=c.averagedTouchesForView(this.view);this._sc_pinchAnchorD=b.d}else{this._sc_cleanUpTouchSession()}},_sc_triggerPinchEnd:function(){if(this._sc_lastPinchTime){var a=Date.now()-this._sc_lastPinchTime,b=this.get("pinchDelay");this._sc_pinchingTimer=SC.Timer.schedule({target:this,action:this._sc_triggerPinchEnd,interval:b-a});this._sc_lastPinchTime=null}else{this.end();this._sc_isPinching=false;this._sc_pinchingTimer=null}},touchAddedToSession:function(c,a){var b=c.averagedTouchesForView(this.view,true);this._sc_pinchAnchorD=b.d;return true},touchCancelledInSession:function(b,a){this._sc_touchFinishedInSession(b,a);return true},touchEndedInSession:function(b,a){this._sc_touchFinishedInSession(b,a);return true},touchesMovedInSession:function(b){if(b.length>1){var c=SC.Touch.averagedTouch(b);var a=this._sc_pinchAnchorD-c.d,f=Math.abs(a);if(f>0){if(!this._sc_isPinching){this.start();this._sc_pinchingTimer=SC.Timer.schedule({target:this,action:this._sc_triggerPinchEnd,interval:this.get("pinchDelay")});this._sc_isPinching=true}else{this._sc_lastPinchTime=Date.now()}var e=c.d/this._sc_pinchAnchorD,d=this._sc_pinchAnchorScale*e;this.trigger(d,b.length);this._sc_pinchAnchorD=c.d;this._sc_pinchAnchorScale=d}}return true},touchSessionCancelled:function(){this._sc_cleanUpTouchSession()},touchSessionEnded:function(){this._sc_cleanUpTouchSession()},touchSessionStarted:function(b){var a=this.view.get("layout");this._sc_pinchAnchorScale=a.scale==null?1:a.scale}});sc_require("system/gesture");SC.SWIPE_HORIZONTAL=[0,180];SC.SWIPE_VERTICAL=[90,-90];SC.SWIPE_ANY=null;SC.SWIPE_LEFT=[180];SC.SWIPE_RIGHT=[0];SC.SWIPE_UP=[-90];SC.SWIPE_DOWN=[90];SC.SwipeGesture=SC.Gesture.extend({_sc_lastAngle:null,_sc_lastDistance:null,_sc_numberOfTouches:0,_sc_swipeAnchorX:null,_sc_swipeAnchorY:null,_sc_swipeLastMovedAt:null,angles:function(b,c){var d=this.get("direction"),a=SC.SWIPE_HORIZONTAL;if(!SC.none(d)){return d}if(!SC.none(c)){a=c}return a}.property("direction").cacheable(),direction:SC.SWIPE_HORIZONTAL,name:"swipe",swipeDistance:40,swipeVelocity:0.5,tolerance:15,_sc_cleanUpTouchSession:function(a){this._sc_numberOfTouches=0;this._sc_lastDistance=null;this._sc_swipeStartedAt=null;this._sc_lastAngle=null;this._sc_swipeAnchorX=null;this._sc_swipeAnchorY=null},_sc_swipeTooSlow:function(){this._sc_cleanUpTouchSession()},touchAddedToSession:function(c,a){var b=c.averagedTouchesForView(this.view,true);this._sc_swipeAnchorX=b.x;this._sc_swipeAnchorY=b.y;return true},touchCancelledInSession:function(b,a){return true},touchEndedInSession:function(b,a){return true},_sc_testAngle:function(b,c,k,f){var g=k>=0,i=!g?Math.abs(k):k,a=i+f,j=i-f,e=false;if(j<=b&&b<=a){var h=a>=0&&a<=180,d=j>=0;e=h===d?c===g:true}return e},touchesMovedInSession:function(g){var n=this.get("direction"),a=g[0].averagedTouchesForView(this.view),r=a.x-this._sc_swipeAnchorX,j=a.y-this._sc_swipeAnchorY,m=Math.atan2(j,r)*(180/Math.PI),t=Math.abs(m),u=m>=0,p=this.get("tolerance"),c=null,s;if(n===null){s=this._sc_lastAngle;if(s!==null){var e=this._sc_testAngle(t,u,s,p);if(e){c=s}else{c=m}}else{c=m}}else{for(var o=0,q=n.length;o<q;o++){s=n[o];if(this._sc_testAngle(t,u,s,p)){c=s;break}}}if(c!==null){if(this._sc_lastAngle===c){var l=Math.abs(r),k=Math.abs(j),b=Date.now(),d,h;d=Math.pow(l*l+k*k,0.5);h=d/(b-this._sc_swipeStartedAt);var f=this.get("swipeVelocity");if(h<f){this._sc_lastAngle=null;this._sc_swipeAnchorX=a.x;this._sc_swipeAnchorY=a.y;this._sc_lastDistance=0;this._sc_swipeStartedAt=null}else{this._sc_lastDistance=d;this._sc_swipeLastMovedAt=Date.now()}}else{this._sc_lastAngle=c;this._sc_swipeStartedAt=Date.now();this._sc_numberOfTouches=g.length}}else{this._sc_lastAngle=null;this._sc_swipeAnchorX=a.x;this._sc_swipeAnchorY=a.y;this._sc_lastDistance=0;this._sc_swipeStartedAt=null}return true},touchSessionCancelled:function(){this._sc_cleanUpTouchSession(true)},touchSessionEnded:function(){var a=(Date.now()-this._sc_swipeLastMovedAt)<200;if(this._sc_lastAngle!==null&&this._sc_lastDistance>this.get("swipeDistance")&&a){this.trigger(this._sc_lastAngle,this._sc_numberOfTouches)}this._sc_cleanUpTouchSession(false)},touchSessionStarted:function(a){this._sc_swipeAnchorX=a.pageX;this._sc_swipeAnchorY=a.pageY}});sc_require("system/gesture");SC.TapGesture=SC.Gesture.extend({_sc_firstTouchAddedAt:null,_sc_firstTouchEndedAt:null,_sc_isTapping:false,_sc_numberOfTouches:0,_sc_tapStartTimer:null,name:"tap",tapLengthDelay:250,tapStartDelay:150,tapWiggle:10,touchUnityDelay:75,_sc_calculateDragDistance:function(a){return Math.sqrt(Math.pow(a.pageX-a.startX,2)+Math.pow(a.pageY-a.startY,2))},_sc_cleanUpTouchSession:function(a){if(this._sc_isTapping){if(a){this.cancel()}else{this.end()}this._sc_isTapping=false}this._sc_tapStartTimer.invalidate();this._sc_numberOfTouches=0;this._sc_tapStartTimer=this._sc_firstTouchAddedAt=this._sc_firstTouchEndedAt=null},_sc_triggerTapStart:function(){this.start();this._sc_isTapping=true},touchAddedToSession:function(d,a){var c,b;b=Date.now()-this._sc_firstTouchAddedAt;c=b<this.get("touchUnityDelay");return c},touchCancelledInSession:function(b,a){return true},touchEndedInSession:function(c,a){var b;this._sc_numberOfTouches+=1;if(this._sc_firstTouchEndedAt===null){this._sc_firstTouchEndedAt=Date.now();b=this._sc_firstTouchEndedAt-this._sc_firstTouchAddedAt<this.get("tapLengthDelay")}else{b=Date.now()-this._sc_firstTouchEndedAt<this.get("touchUnityDelay")}return b},touchesMovedInSession:function(b){var c=true;for(var d=0,a=b.length;d<a;d++){var f=b[d],e=this._sc_calculateDragDistance(f)>this.get("tapWiggle");if(e){c=false;break}}return c},touchSessionCancelled:function(){this._sc_cleanUpTouchSession(true)},touchSessionEnded:function(){this.trigger(this._sc_numberOfTouches);this._sc_cleanUpTouchSession(false)},touchSessionStarted:function(a){this._sc_firstTouchAddedAt=Date.now();this._sc_tapStartTimer=SC.Timer.schedule({target:this,action:this._sc_triggerTapStart,interval:this.get("tapStartDelay")})}});SC.hashesForLocale("en","inflectionConstants",{PLURAL:[[/(quiz)$/i,"$1zes"],[/^(ox)$/i,"$1en"],[/([m|l])ouse$/i,"$1ice"],[/(matr|vert|ind)ix|ex$/i,"$1ices"],[/(x|ch|ss|sh)$/i,"$1es"],[/([^aeiouy]|qu)y$/i,"$1ies"],[/(hive)$/i,"$1s"],[/(?:([^f])fe|([lr])f)$/i,"$1$2ves"],[/sis$/i,"ses"],[/([ti])um$/i,"$1a"],[/(buffal|tomat)o$/i,"$1oes"],[/(bu)s$/i,"$1ses"],[/(alias|status)$/i,"$1es"],[/(octop|vir)us$/i,"$1i"],[/(ax|test)is$/i,"$1es"],[/s$/i,"s"],[/$/,"s"]],SINGULAR:[[/(quiz)zes$/i,"$1"],[/(matr)ices$/i,"$1ix"],[/(vert|ind)ices$/i,"$1ex"],[/^(ox)en/i,"$1"],[/(alias|status)es$/i,"$1"],[/(octop|vir)i$/i,"$1us"],[/(cris|ax|test)es$/i,"$1is"],[/(shoe)s$/i,"$1"],[/(o)es$/i,"$1"],[/(bus)es$/i,"$1"],[/([m|l])ice$/i,"$1ouse"],[/(x|ch|ss|sh)es$/i,"$1"],[/(m)ovies$/i,"$1ovie"],[/(s)eries$/i,"$1eries"],[/([^aeiouy]|qu)ies$/i,"$1y"],[/([lr])ves$/i,"$1f"],[/(tive)s$/i,"$1"],[/(hive)s$/i,"$1"],[/([^f])ves$/i,"$1fe"],[/(^analy)ses$/i,"$1sis"],[/((a)naly|(b)a|(d)iagno|(p)arenthe|(p)rogno|(s)ynop|(t)he)ses$/i,"$1$2sis"],[/([ti])a$/i,"$1um"],[/(n)ews$/i,"$1ews"],[/s$/i,""]],IRREGULAR:[["move","moves"],["sex","sexes"],["child","children"],["man","men"],["person","people"],["woman","women"],["self","selves"]],UNCOUNTABLE:["sheep","fish","series","species","money","rice","information","info","equipment"]});SC.AutoMixin={autoMixins:[],createChildView:function(b,c){if(!b.isClass){c=b}else{if(!c){c={}}else{c=SC.clone(c)}}c.owner=c.parentView=this;if(!c.page){c.page=this.page}if(b.isClass){c.createdByParent=true;var a=SC.clone(this.get("autoMixins"));a.push(c);b=b.create.apply(b,a)}return b}};SC.mixin({_copy_computed_props:["maxWidth","maxHeight","paddingLeft","paddingRight","paddingTop","paddingBottom","fontFamily","fontSize","fontStyle","fontWeight","fontVariant","lineHeight","whiteSpace","letterSpacing","wordWrap"],stringFromLayout:function(e){var d=["maxHeight","maxWidth","minHeight","minWidth","centerY","centerX","width","height","bottom","right","top","left","zIndex","opacity","border","borderLeft","borderRight","borderTop","borderBottom","rotateX","rotateY","rotateZ","scale"],a=[],c,b=d.length;while(--b>=0){c=d[b];if(e.hasOwnProperty(c)){a.push(c+":"+e[c])}}return"{ "+a.join(", ")+" }"},heightForString:function(h,c,b,a,g){var e=this._heightCalcElement,f,i;if(!g){h=SC.RenderContext.escapeHTML(h)}f=(a&&SC.typeOf(a)===SC.T_ARRAY)?a.join(" "):"";if(!c){c=100}if(!e){e=this._heightCalcElement=document.createElement("div");document.body.insertBefore(e,null)}b=b+"; width: "+c+"px; left: "+(-1*c)+"px; position: absolute";var d=SC.$(e);d.attr("style",b);if(f!==""){d.attr("class",f)}e.innerHTML=h;i=e.clientHeight;e=null;return i},prepareStringMeasurement:function(o,a){var k=this._metricsCalculationElement,h,c,d;h=SC.A(a).join(" ");if(!k){var n=document.createElement("div");n.style.cssText="position:absolute; left:-10010px; top:-10px;width:10000px; height:0px; overflow:hidden;visibility:hidden;";k=this._metricsCalculationElement=document.createElement("div");n.appendChild(k);document.body.insertBefore(n,null)}d=SC.$(k);if(SC.typeOf(o)!=SC.T_STRING){var g=null;if(document.defaultView&&document.defaultView.getComputedStyle){g=document.defaultView.getComputedStyle(o,null)}else{g=o.currentStyle}var m=this._copy_computed_props;for(var j=0;j<m.length;j++){var b=m[j],f=g[b];k.style[b]=f}var l=k.style;if(l.font===""){var e="";if(l.fontStyle){e+=l.fontStyle+" "}if(l.fontVariant){e+=l.fontVariant+" "}if(l.fontWeight){e+=l.fontWeight+" "}if(l.fontSize){e+=l.fontSize}else{e+="10px"}if(l.lineHeight){e+="/"+l.lineHeight}e+=" ";if(l.fontFamily){e+=l.fontFamily}else{l+="sans-serif"}k.style.font=e}SC.mixin(k.style,{left:"0px",top:"0px",position:"absolute",bottom:"auto",right:"auto",width:"auto",height:"auto"});g=null}else{c=o;d.attr("style",c+"; position:absolute; left: 0px; top: 0px; bottom: auto; right: auto; width: auto; height: auto;")}k.className=h;k=null},teardownStringMeasurement:function(){var a=this._metricsCalculationElement;a.innerHTML="";a.className="";a.setAttribute("style","");a=null},measureString:function(c,b){var d=this._metricsCalculationElement,e=0;if(!d){throw new Error("measureString requires a string measurement environment to be set up. Did you mean metricsForString?")}if(b){d.innerHTML=c}else{if(typeof d.innerText!="undefined"){d.innerText=c}else{d.textContent=c}}if(SC.browser.isIE){e=1}var a={width:d.clientWidth+e,height:d.clientHeight};if(SC.browser.isMozilla){a.width+=1}d=null;return a},metricsForString:function(c,d,e,b){SC.prepareStringMeasurement(d,e);var a=SC.measureString(c,b);SC.teardownStringMeasurement();return a}});sc_require("system/utils/string_measurement");SC.AutoResize={shouldAutoResize:YES,shouldMeasureSize:YES,shouldCacheSizes:NO,shouldResizeWidth:YES,shouldResizeHeight:NO,measuredSize:{width:0,height:0},maxWidth:null,maxHeight:null,shouldAutoFitText:NO,autoFitDiscreteFontSizes:NO,minFontSize:12,maxFontSize:20,calculatedFontSize:20,fontPropertyDidChange:function(){if(this.get("shouldAutoFitText")){this.invokeLast(this.fitTextToFrame)}}.observes("shouldAutoFitText","minFontSize","maxFontSize","measuredSize"),measuredSizeDidChange:function(){var c=this.get("measuredSize"),b=c.width,h=c.height,g,a,d=this.get("autoResizePadding")||0,f=this.get("maxWidth"),e=this.get("maxHeight");if(SC.typeOf(d)===SC.T_NUMBER){g=a=d}else{g=d.height;a=d.width}h+=g;b+=a;if(this.get("shouldAutoResize")){if(this.get("shouldResizeWidth")){if(f&&b>f){b=f}this.set("calculatedWidth",b);this.adjust("width",b)}if(this.get("shouldResizeHeight")){if(e&&h>e){h=e}this.set("calculatedHeight",h);this.adjust("height",h)}}}.observes("shouldAutoResize","measuredSize","autoResizePadding","maxWidth","maxHeight","shouldResizeWidth","shouldResizeHeight"),batchResizeId:null,scheduleMeasurement:function(){var a=this.get("batchResizeId");if(!this.get("shouldMeasureSize")||!this.get("isVisibleInWindow")||(this.get("autoResizeText")===this._lastMeasuredText&&a===this._lastMeasuredId)){return}SC.AutoResizeManager.scheduleMeasurementForView(this,a)}.observes("isVisibleInWindow","shouldMeasureSize","autoResizeText","batchResizeId"),_lastMeasuredText:null,_cachedMetrics:function(c,d){if(!this.get("shouldCacheSizes")){return}var b=SC.cacheSlotFor(this.get("batchResizeId")||this),a=this.get("autoResizeText");if(d){b[a]=d}else{d=b[a]}return d}.property("shouldCacheSizes","autoResizeText","batchResizeId").cacheable(),measureSize:function(d){var g,e=this.get("autoResizeLayer"),c=this.get("autoResizeText"),b=!this.get("escapeHTML"),f=this.get("batchResizeId"),a=this.get("_cachedMetrics");if(!e){return}if(a){g=a}else{if(SC.none(c)||c===""){g={width:0,height:0}}else{if(d){g=SC.measureString(c,b)}else{this.prepareLayerForStringMeasurement(e);g=SC.metricsForString(c,e,this.get("classNames"),b)}}}this.set("measuredSize",g);if(this.get("shouldCacheSizes")){this.setIfChanged("_cachedMetrics",g)}this._lastMeasuredText=c;this._lastMeasuredId=f;return g},prepareLayerForStringMeasurement:function(a){var b=this.get("maxFontSize");if(this.get("shouldAutoFitText")&&this.get("calculatedFontSize")!==b){a.style.fontSize=b+"px"}if(!this.get("shouldResizeWidth")){a.style.maxWidth=$(a).outerWidth()+"px"}},viewDidResize:function(a){a();this.fontPropertyDidChange()}.enhance(),fitTextToFrame:function(){var q=this.get("autoResizeLayer");if(!q){return}var c=this.get("maxFontSize"),d=this.get("minFontSize");this.prepareLayerForStringMeasurement(q);var e=this.get("frame"),f=this.get("autoResizePadding")||0,j=e.width-1,g=e.height-1,p=this.get("measuredSize"),a=p.width,r=p.height,h;if(SC.typeOf(f)===SC.T_NUMBER){j-=f;g-=f}else{j-=f.width;g-=f.height}if(a<=j&&r<=g){return}if(this.get("autoFitDiscreteFontSizes")){h=d}else{var b=j/a,i=g/r,l=Math.floor(c*Math.min(b,i)),o=this.get("classNames"),n=!this.get("escapeHTML"),k=this.get("autoResizeText"),m;l=h=Math.min(c,Math.max(d,l));q.style.fontSize=l+"px";m=SC.metricsForString(k,q,o,n);if(m.width>j||m.height>g){for(l=l-1;l>=d;l--){q.style.fontSize=l+"px";m=SC.metricsForString(k,q,o,n);h=l;if(m.width<=j&&m.height<=g){break}}}else{if(m.width<j||m.height<g){for(l=l+1;l<=c;l++){q.style.fontSize=l+"px";m=SC.metricsForString(k,q,o,n);if(m.width<=j&&m.height<=g){h=l}if(m.width>=j||m.height>=g){break}}}}}q.style.fontSize=h+"px";this.set("calculatedFontSize",h)},applyAttributesToContext:function(b,a){b(a);if(this.get("shouldAutoFitText")){a.setStyle("font-size",this.get("calculatedFontSize")+"px")}}.enhance(),didCreateLayer:function(a){a();this.scheduleMeasurement()}.enhance(),_transitionIn:function(b,c){var a=this.get("layout").opacity||1;this.adjust("opacity",0);this.invokeNext(function(){this.adjust("opacity",a);b(c)})}.enhance()};SC.AutoResizeManager={measurementQueue:SC.CoreSet.create(),scheduleMeasurementForView:function(a){this.measurementQueue.add(a);SC.RunLoop.currentRunLoop.invokeOnce(this.doBatchResize)},cancelMeasurementForView:function(a,b){this.measurementQueue.remove(a)},doBatchResize:function(){if(this!==SC.AutoResizeManager){return SC.AutoResizeManager.doBatchResize()}var b,d,f,g=this.measurementQueue,h,c,e,a;while((a=g.get("length"))>0){h=NO;b=g[a-1].get("batchResizeId");for(e=a-1;e>=0;--e){d=g[e];if(d.get("batchResizeId")!==b){continue}if(d.get("isVisibleInWindow")&&d.get("shouldMeasureSize")&&(f=d.get("autoResizeLayer"))){c=d.get("autoResizeText");if(!SC.none(c)&&c!==""&&!d.get("_cachedMetrics")&&!h){d.prepareLayerForStringMeasurement(f);SC.prepareStringMeasurement(f,d.get("classNames"));h=YES}d.measureSize(YES)}g.remove(d);if(!b){break}}if(h){SC.teardownStringMeasurement()}}}};if(SC.Button){SC.Button.initMixin=function(){throw new Error("SC.Button is deprecated as a mixin and is now a subclass of SC.TemplateView. Subclass SC.ButtonView instead.")}}SC.ContentDisplay={concatenatedProperties:"contentDisplayProperties",contentDisplayProperties:[],initMixin:function(){this._display_contentDidChange()},destroyMixin:function(){if(!this._display_content){return}this._display_stopObservingContent(this._display_content);this._display_content=null},_display_beginObservingContent:function(a){var b=this._display_contentPropertyDidChange;if(SC.isArray(a)){a.invoke("addObserver","*",this,b)}else{if(a.addObserver){a.addObserver("*",this,b)}}},_display_stopObservingContent:function(a){var b=this._display_contentPropertyDidChange;if(SC.isArray(a)){a.invoke("removeObserver","*",this,b)}else{if(a.removeObserver){a.removeObserver("*",this,b)}}},_display_contentDidChange:function(d,a,c){if((c=this.get("content"))===this._display_content){return}var b=this._display_content;if(b){this._display_stopObservingContent(b)}b=this._display_content=c;if(b){this._display_beginObservingContent(b)}this.displayDidChange()}.observes("content"),_display_contentPropertyDidChange:function(e,c,d,b){if(c==="*"){this.displayDidChange()}else{var a=this.get("contentDisplayProperties");if(a&&a.indexOf(c)>=0){this.displayDidChange()}}}};SC.ContentValueSupport={hasContentValueSupport:YES,initMixin:function(){this._control_contentKeysDidChange()},destroyMixin:function(){this._cleanup_old_observers();this._cleanup_old_content_observers()},value:null,content:null,contentKeys:null,_default_contentKeys:{contentValueKey:"value"},contentValueKey:null,contentPropertyDidChange:function(c,b){var a=this.get("contentKeys");if(a){var d;for(d in a){if(b===this.getDelegateProperty(d,this,this.get("displayDelegate"),a)){return this.updatePropertyFromContent(a[d],b,d,c)}else{if(b==="*"){this.updatePropertyFromContent(a[d],b,d,c)}}}}else{return this.updatePropertyFromContent("value",b,"contentValueKey",c)}},updatePropertyFromContent:function(f,c,e,d){var a,b;if(e===undefined){e="content"+f.capitalize()+"Key"}if(this[e]){e=this.get(e)}else{if((a=this.get("displayDelegate"))&&(b=a[e])){e=a.get?a.get(e):b}else{return this}}if(c==="*"||c===e){if(d===undefined){d=this.get("content")}if(d){b=d.get?d.get(e):d[e]}else{b=null}this.setIfChanged(f,b)}return this},updateContentWithValueObserver:function(d,a){var f=this._reverseContentKeys;if(!a||a==="*"){for(a in f){this.updateContentWithValueObserver(this,a)}}var c=this.get(a);var b=this.get("content"),e=this.getDelegateProperty(f[a],this,this.displayDelegate);if(!e||!b){return this}if(typeof b.setIfChanged===SC.T_FUNCTION){b.setIfChanged(e,c)}else{if(b[e]!==c){b[e]=c}}},_control_content:null,_old_contentValueKeys:null,_old_contentKeys:null,_control_contentDidChange:function(g,b){this._cleanup_old_content_observers();var c=this.get("content"),a=this.get("contentKeys"),h,e=this._old_contentValueKeys,d=this.contentPropertyDidChange;if(c&&c.addObserver){if(a){if(!e){e=SC.CoreSet.create()}for(h in a){h=this.getDelegateProperty(h,this,this.get("displayDelegate"));if(h){c.addObserver(h,this,d);e.add(h)}}}else{h=this.getDelegateProperty("contentValueKey",this,this.get("displayDelegate"));if(h){c.addObserver(h,this,d);if(e){e.add(h)}else{e=h}}}}b=(!b||b==="content")?"*":this.get(b);if(b){this.contentPropertyDidChange(c,b)}this._control_content=c;this._old_contentValueKeys=e}.observes("content"),_control_contentKeysDidChange:function(){var c,b={},a=this.get("contentKeys")||this._default_contentKeys,g,e=this._control_contentDidChange,d=this.updateContentWithValueObserver;this._cleanup_old_observers();for(c in a){g=a[c];b[g]=c;this.addObserver(g,this,d);this.addObserver(c,this,e)}this._reverseContentKeys=b;this._old_contentKeys=a;this._control_contentDidChange()}.observes("contentKeys"),_cleanup_old_content_observers:function(){var b=this._control_content,g=this._old_contentValueKeys,e=SC.typeOf(g),d=this.contentPropertyDidChange,h;if(b&&b.removeObserver&&g){if(e===SC.T_STRING){b.removeObserver(g,this,d);this._old_contentValueKeys=g=null}else{var c,a=g.get("length");for(c=0;c<a;c++){h=g[c];b.removeObserver(h,this,d)}g.clear()}}},_cleanup_old_observers:function(){var a=this._old_contentKeys,d=this._control_contentDidChange,c=this.updateContentWithValueObserver,e,b;for(b in a){e=a[b];this.removeObserver(e,this,c);this.removeObserver(b,this,d)}}};sc_require("mixins/content_value_support");sc_require("system/string");SC.AUTO_CONTROL_SIZE="__AUTO__";SC.JUMBO_CONTROL_SIZE="sc-jumbo-size";SC.HUGE_CONTROL_SIZE="sc-huge-size";SC.LARGE_CONTROL_SIZE="sc-large-size";SC.REGULAR_CONTROL_SIZE="sc-regular-size";SC.SMALL_CONTROL_SIZE="sc-small-size";SC.TINY_CONTROL_SIZE="sc-tiny-size";SC.Control=SC.mixin(SC.clone(SC.ContentValueSupport),{isControl:YES,isSelected:NO,isSelectedBindingDefault:SC.Binding.oneWay().bool(),isActive:NO,isActiveBindingDefault:SC.Binding.oneWay().bool(),fieldKey:null,fieldLabel:null,errorLabel:function(){var a=this.get("fieldLabel"),d,c,b;if(a){return a}d=this.get("fieldKey")||this.constructor.toString();c=d?SC.String.capitalize(SC.String.humanize(d)):"";b=SC.String.locWithDefault("FieldKey."+d,c);return SC.String.locWithDefault("ErrorLabel."+d,b)}.property("fieldLabel","fieldKey").cacheable(),controlSize:SC.REGULAR_CONTROL_SIZE,displayProperties:["isSelected","isActive","controlSize"],_CONTROL_TMP_CLASSNAMES:{},renderMixin:function(b,g){var d=this.get("isSelected"),c=!this.get("isEnabledInPane"),e=this._CONTROL_TMP_CLASSNAMES;e.mixed=d===SC.MIXED_STATE;e.sel=d&&(d!==SC.MIXED_STATE);e.active=this.get("isActive");var f=this.get("controlSize");if(!f){f=SC.REGULAR_CONTROL_SIZE}if(g){b.setClass(e);if(!this.get("renderDelegate")){b.addClass(f)}}else{b.$().setClass(e);if(!this.get("renderDelegate")){b.$().addClass(f)}}if(!g&&this.$input){var a=this.$input();if(a.attr("type")!=="radio"){this.$input().attr("disabled",c)}}}});SC.Editable={isEditable:NO,isEditing:NO,beginEditing:function(){if(!this.get("isEditable")){return NO}if(this.get("isEditing")){return YES}this.beginPropertyChanges();this.set("isEditing",YES);this.becomeFirstResponder();this.endPropertyChanges();return YES},discardEditing:function(){return !this.get("isEditing")},commitEditing:function(){if(!this.get("isEditing")){return YES}this.set("isEditing",NO);this.resignFirstResponder();return YES}};SC.ALIGN_JUSTIFY="justify";SC.FlowedLayout={isFlowedLayout:YES,layoutDirection:SC.LAYOUT_HORIZONTAL,autoResize:YES,shouldResizeWidth:YES,shouldResizeHeight:YES,align:SC.ALIGN_LEFT,canWrap:YES,defaultFlowSpacing:{left:0,bottom:0,top:0,right:0},flowPadding:{left:0,bottom:0,right:0,top:0},_scfl_validFlowPadding:function(){var b=this.get("flowPadding")||{},a={};a.left=b.left||0;a.top=b.top||0;a.bottom=b.bottom||0;a.right=b.right||0;return a}.property("flowPadding").cacheable(),concatenatedProperties:["childMixins"],initMixin:function(){this._scfl_tileOnce();this.addObserver("childViews.[]",this,this._scfl_childViewsDidChange)},_scfl_childViewsDidChange:function(a){this._scfl_tileOnce()},_scfl_layoutPropertyDidChange:function(a){this._scfl_tileOnce()}.observes("layoutDirection","align","flowPadding","canWrap","defaultFlowSpacing","isVisibleInWindow"),layoutDidChangeFor:function(g){var b=g._scfl_lastLayout,a=g.get("layout"),d=g.get("frame");if(!b){return arguments.callee.base.apply(this,arguments)}var e=YES;if(b.left&&b.left!==a.left){e=NO}else{if(b.top&&b.top!==a.top){e=NO}else{if(!g.get("fillWidth")&&b.width&&b.width!==a.width){e=NO}else{if(!b.width&&!g.get("fillWidth")&&d.width!==g._scfl_lastFrame.width){e=NO}else{if(!g.get("fillHeight")&&b.height&&b.height!==a.height){e=NO}else{if(!b.height&&!g.get("fillHeight")&&d.height!==g._scfl_lastFrame.height){e=NO}}}}}}if(e){return arguments.callee.base.apply(this,arguments)}this._scfl_tileOnce();arguments.callee.base.apply(this,arguments)},observeChildLayout:function(a){if(a._scfl_isBeingObserved){return}a._scfl_isBeingObserved=YES;a.addObserver("flowSpacing",this,"_scfl_tileOnce");a.addObserver("isVisible",this,"_scfl_tileOnce");a.addObserver("useAbsoluteLayout",this,"_scfl_tileOnce");a.addObserver("calculatedWidth",this,"_scfl_tileOnce");a.addObserver("calculatedHeight",this,"_scfl_tileOnce");a.addObserver("startsNewRow",this,"_scfl_tileOnce");a.addObserver("isSpacer",this,"_scfl_tileOnce");a.addObserver("maxSpacerLength",this,"_scfl_tileOnce");a.addObserver("fillWidth",this,"_scfl_tileOnce");a.addObserver("fillHeight",this,"_scfl_tileOnce")},unobserveChildLayout:function(a){a._scfl_isBeingObserved=NO;a.removeObserver("flowSpacing",this,"_scfl_tileOnce");a.removeObserver("isVisible",this,"_scfl_tileOnce");a.removeObserver("useAbsoluteLayout",this,"_scfl_tileOnce");a.removeObserver("calculatedWidth",this,"_scfl_tileOnce");a.removeObserver("calculatedHeight",this,"_scfl_tileOnce");a.removeObserver("startsNewRow",this,"_scfl_tileOnce");a.removeObserver("isSpacer",this,"_scfl_tileOnce");a.removeObserver("maxSpacerLength",this,"_scfl_tileOnce");a.removeObserver("fillWidth",this,"_scfl_tileOnce");a.removeObserver("fillHeight",this,"_scfl_tileOnce")},shouldIncludeChildInFlow:function(a,b){return b.get("isVisible")&&!b.get("useAbsoluteLayout")},flowSpacingForChild:function(a,b){var c=b.get("flowSpacing");if(SC.none(c)){c=this.get("defaultFlowSpacing")}if(SC.none(c)){c=0}if(SC.typeOf(c)===SC.T_NUMBER){c={left:c,right:c,bottom:c,top:c}}else{c.left=c.left||0;c.right=c.right||0;c.top=c.top||0;c.bottom=c.bottom||0}return c},flowSizeForChild:function(a,d){var c=d.get("calculatedWidth"),g=d.get("calculatedHeight"),i=this.get("layoutDirection"),e={},h=d.get("frame"),b=d.get("layout");d._scfl_lastFrame=h;if(c){e.width=c}else{e.width=b.width||h.width}if(g){e.height=g}else{e.height=b.height||h.height}if(d.get("isSpacer")){e.maxSpacerLength=d.get("maxSpacerLength");if(i===SC.LAYOUT_HORIZONTAL){e.width=b.minWidth||0}else{e.height=b.minHeight||0}}if(i===SC.LAYOUT_HORIZONTAL&&d.get("fillHeight")){e.height=b.minHeight||0}else{if(i===SC.LAYOUT_VERTICAL&&d.get("fillWidth")){e.width=b.minWidth||0}}return e},clippingFrame:function(){return{left:0,top:0,width:this.get("calculatedWidth"),height:this.get("calculatedHeight")}}.property("calculatedWidth","calculatedHeight"),_scfl_maxCollapsedRowLength:0,_scfl_totalCollapsedRowSize:0,_scfl_calculatedSizeDidChange:function(){if(this.get("autoResize")){if(this.get("layoutDirection")==SC.LAYOUT_VERTICAL){if(this.get("shouldResizeHeight")){this.adjust("minHeight",this.get("_scfl_maximumCollapsedRowLength"))}if(this.get("shouldResizeWidth")){this.adjust("minWidth",this.get("_scfl_totalCollapsedRowSize"))}}else{if(this.get("shouldResizeWidth")){this.adjust("minWidth",this.get("_scfl_maximumCollapsedRowLength"))}if(this.get("shouldResizeHeight")){this.adjust("minHeight",this.get("_scfl_totalCollapsedRowSize"))}}}}.observes("autoResize","shouldResizeWidth","_scfl_maximumCollapsedRowLength","_scfl_totalCollapsedRowSize","shouldResizeHeight"),_scfl_createPlan:function(){var e=this.get("layoutDirection"),a=this.get("_scfl_validFlowPadding"),d=this.get("frame");var c=(e===SC.LAYOUT_VERTICAL);var b={rows:undefined,maximumCollapsedRowLength:0,totalCollapsedRowSize:0,isVertical:e===SC.LAYOUT_VERTICAL,isHorizontal:e===SC.LAYOUT_HORIZONTAL,flowPadding:a,planStartPadding:a[c?"left":"top"],planEndPadding:a[c?"right":"bottom"],rowStartPadding:a[c?"top":"left"],rowEndPadding:a[c?"bottom":"right"],maximumRowLength:undefined,fitToPlanSize:undefined,align:this.get("align")};if(c){b.maximumRowLength=d.height-b.rowStartPadding-b.rowEndPadding;b.fitToPlanSize=d.width-b.planStartPadding-b.planEndPadding}else{b.maximumRowLength=d.width-b.rowStartPadding-b.rowEndPadding;b.fitToPlanSize=d.height-b.planStartPadding-b.planEndPadding}return b},_scfl_distributeChildrenIntoRows:function(d){var b=this.get("childViews"),a,g,c=b.length,e=d.isVertical,i=[],f;f=-1;g=0;while(g<c&&g!==f){f=g;var h={plan:d,rowLength:undefined,rowSize:undefined,shouldExpand:undefined,items:undefined,position:undefined};g=this._scfl_distributeChildrenIntoRow(b,g,h);i.push(h)}d.rows=i},_scfl_distributeChildrenIntoRow:function(e,m,i){var o,t=e.length,b=i.plan,g,a,d,p=[],k=0,l=b.isVertical,j,f,c,n=this.get("canWrap"),h=NO,q=0,s=i.plan.maximumRowLength;for(o=m;o<t;o++){g=e[o];h=h||(p.length>0&&g.get("startsNewRow"));if(!this.shouldIncludeChildInFlow(o,g)){continue}a=this.flowSizeForChild(o,g);d=this.flowSpacingForChild(o,g);a.width+=d.left+d.right;a.height+=d.top+d.bottom;f=a[l?"height":"width"];if(!SC.none(a.maxSpacerLength)){c=a.maxSpacerLength+(l?d.top+d.bottom:d.left+d.right)}j=a[l?"width":"height"];if((h||(n&&k+f>s))&&p.length>0){break}var u={child:g,itemLength:f,maxSpacerLength:c,itemSize:j,spacing:d,position:undefined,fillRow:l?g.get("fillWidth"):g.get("fillHeight"),isSpacer:g.get("isSpacer"),left:undefined,top:undefined,width:undefined,height:undefined};p.push(u);k+=f;q=Math.max(f,q)}i.rowLength=k;var r=n?q:i.rowLength;i.plan.maximumCollapsedRowLength=Math.max(r,i.plan.maximumCollapsedRowLength);i.items=p;return o},_scfl_positionChildrenInRows:function(d){var c=d.rows,b=c.length,a;for(a=0;a<b;a++){this._scfl_positionChildrenInRow(c[a])}},_scfl_positionChildrenInRow:function(m){var g=m.items,e=g.length,j,l,d,k=0,a=0,c,f=m.plan.align,i=YES,b=0,h=NO;for(j=0;j<e;j++){l=g[j];if(l.isSpacer){a+=l.child.get("spaceUnits")||1}}if(f===SC.ALIGN_JUSTIFY){a+=e-1}c=Math.max(0,m.plan.maximumRowLength-m.rowLength)/a;while(c>0){for(j=0;j<e;j++){l=g[j];if(l.isSpacer){l.itemLength+=c*(l.child.get("spaceUnits")||1);if(l.itemLength>l.maxSpacerLength){b+=l.itemLength-l.maxSpacerLength;l.itemLength=l.maxSpacerLength}else{h=YES}}}if(!h){break}c=Math.round(b/a);b=0}d=0;if(a===0&&(f===SC.ALIGN_RIGHT||f===SC.ALIGN_BOTTOM)){d=m.plan.maximumRowLength-m.rowLength}else{if(a===0&&(f===SC.ALIGN_CENTER||f===SC.ALIGN_MIDDLE)){d=(m.plan.maximumRowLength/2)-(m.rowLength/2)}}d+=m.plan.rowStartPadding;for(j=0;j<e;j++){l=g[j];if(!l.fillRow){i=NO}k=Math.max(l.itemSize,k);l.position=d;d+=l.itemLength;if(f===SC.ALIGN_JUSTIFY&&j<e-1){d+=c}}m.shouldExpand=e>0?i:NO;m.rowLength=d-m.plan.rowStartPadding;m.rowSize=k;m.plan.totalCollapsedRowSize+=m.rowSize},_scfl_positionRows:function(d){var i=d.rows,c=i.length,f,h,b,a=0,g=0,e;for(f=0;f<c;f++){if(i[f].shouldExpand){a++}g+=i[f].rowSize}e=d.fitToPlanSize-g;b=d.planStartPadding;for(f=0;f<c;f++){h=i[f];if(h.shouldExpand&&e>0){h.rowSize+=e/a;a--}h.position=b;b+=h.rowSize}},_scfl_applyPlan:function(h){var n=h.rows,b,c,m,e=0,j=0,g,a,d,l,f,k,i=h.isVertical;c=n.length;for(b=0;b<c;b++){m=n[b];e=Math.max(e,m.rowLength);j+=m.rowSize;g=m.items;d=g.length;for(a=0;a<d;a++){l=g[a];l.child.beginPropertyChanges();k=l.fillRow?m.rowSize:l.itemSize;f={left:l.spacing.left+(i?m.position:l.position),top:l.spacing.top+(i?l.position:m.position),width:i?k:l.itemLength,height:i?l.itemLength:k};f.width-=l.spacing.left+l.spacing.right;f.height-=l.spacing.top+l.spacing.bottom;this.applyPlanToView(l.child,f);l.child._scfl_lastLayout=f;l.child.endPropertyChanges()}}j+=h.planStartPadding+h.planEndPadding;e+=h.rowStartPadding+h.rowEndPadding;this.beginPropertyChanges();this.set("calculatedHeight",i?e:j);this.set("calculatedWidth",i?j:e);this.set("_scfl_maximumCollapsedRowLength",h.maximumCollapsedRowLength);this.set("_scfl_totalCollapsedRowSize",h.totalCollapsedRowSize);this.endPropertyChanges()},applyPlanToView:function(a,b){a.adjust(b)},_scfl_tileOnce:function(){this.invokeLast(this._scfl_tile)},_scfl_tile:function(){if(!this.get("isVisibleInWindow")){return}var f=this._scfl_createPlan();this._scfl_distributeChildrenIntoRows(f);this._scfl_positionChildrenInRows(f);this._scfl_positionRows(f);this._scfl_applyPlan(f);this.setIfChanged("numberOfRows",f.rows.length);var d=this._scfl_isObserving||SC.CoreSet.create(),c=this._scfl_isObserving=SC.CoreSet.create();var e=this.get("childViews"),b=e.length,a,g;for(a=0;a<b;a++){g=e[a];if(!d.contains(g)){this.observeChildLayout(g)}else{d.remove(g)}c.add(g)}b=d.length;for(a=0;a<b;a++){this.unobserveChildLayout(d[a])}},_scfl_frameDidChange:function(){var b=this.get("frame"),a=this._scfl_lastFrameSize||{};this._scfl_lastFrameSize=SC.clone(b);if(a.width==b.width&&a.height==b.height){return}this._scfl_tileOnce()}.observes("frame"),destroyMixin:function(){this.removeObserver("childViews.[]",this,this._scfl_childViewsDidChange);var c=this._scfl_isObserving;if(!c){return}var b=c.length,a;for(a=0;a<b;a++){this.unobserveChildLayout(c[a])}},reorder:function(b){if(!SC.typeOf(b)===SC.T_ARRAY){b=arguments}var c=b.length,d=this.childViews,a;this.beginPropertyChanges();while(c-->0){a=b[c];if(SC.typeOf(a)===SC.T_STRING){a=this.get(a)}d.removeObject(a);d.unshiftObject(a)}this.endPropertyChanges();this._scfl_childViewsDidChange();return this}};SC.Gesturable={_sc_interestedGestures:null,_sc_touchesInSession:null,acceptsMultitouch:true,concatenatedProperties:["gestures"],gestures:null,_sc_gestureTouchFinish:function(c,g){var a=this._sc_touchesInSession,d=a.indexOf(c);a.replace(d,1);var e=this._sc_interestedGestures,h,i;for(h=e.length-1;h>=0;h--){var b;i=e[h];if(g){b=i.touchCancelledInSession(c,a)}else{b=i.touchEndedInSession(c,a)}if(!b){i.touchSessionCancelled();e.replace(h,1)}}if(a.length===0){var f;for(h=0,f=e.length;h<f;h++){i=e[h];i.touchSessionEnded()}this._sc_interestedGestures.length=0}},initMixin:function(){this.createGestures()},createGestures:function(){var e=this.get("gestures"),b=e.length,c=[],a;for(a=0;a<b;a++){var d;if(SC.typeOf(e[a])===SC.T_STRING){d=this.get(e[a])}else{d=e[a]}if(!d){throw new Error("Developer Error: Could not find gesture named '"+e[a]+"' on view.")}if(d.isClass){d=d.create({view:this})}if(SC.typeOf(e[a])===SC.T_STRING){this[e[a]]=d}c.push(d)}this.set("gestures",c)},touchStart:function(a){return this.gestureTouchStart(a)},touchesDragged:function(a,b){this.gestureTouchesDragged(a,b)},touchEnd:function(a){this.gestureTouchEnd(a)},touchCancelled:function(a){this.gestureTouchCancelled(a)},gestureLostInterest:function(a){var c=this._sc_interestedGestures,b=c.indexOf(a);if(b>=0){a.touchSessionCancelled();c.replace(b,1)}},gestureTouchStart:function(e){var c=this._sc_interestedGestures,a=this._sc_touchesInSession,h=false,i;if(a===null){a=this._sc_touchesInSession=[];c=this._sc_interestedGestures=[]}if(a.length===0){var f=this.get("gestures"),g;for(i=0,g=f.length;i<g;i++){var j=f[i];j.touchSessionStarted(e);c.push(j)}h=true}else{for(i=c.length-1;i>=0;i--){var b=c[i],d;d=b.touchAddedToSession(e,a);if(d){h=true}else{b.touchSessionCancelled();c.replace(i,1)}}}if(h){a.push(e)}return h},gestureTouchesDragged:function(b,f){var g=this._sc_interestedGestures,a=this._sc_touchesInSession;for(var e=g.length-1;e>=0;e--){var d=g[e],c=d.touchesMovedInSession(a);if(!c){d.touchSessionCancelled();g.replace(e,1)}}},gestureTouchEnd:function(a){this._sc_gestureTouchFinish(a,false)},gestureTouchCancelled:function(a){this._sc_gestureTouchFinish(a,true)}};SC.InlineEditable={isInlineEditable:YES,isEditable:YES,exampleEditor:SC.InlineTextFieldView,isEditing:NO,inlineEditorDelegate:SC.InlineTextFieldDelegate,_editor:null,beginEditing:function(){var a;a=this.delegateFor("inlineEditorShouldBeginEditing",this.inlineEditorDelegate);if(a&&!a.inlineEditorShouldBeginEditing(this,this.get("value"))){return NO}this._editor=this.invokeDelegateMethod(this.inlineEditorDelegate,"acquireEditor",this);if(this._editor){return this._editor.beginEditing(this)}else{return NO}},commitEditing:function(){return this._editor?this._editor.commitEditing():NO},discardEditing:function(){return this._editor?this._editor.discardEditing():NO},inlineEditorShouldBeginEditing:function(){return !this.get("isEditing")&&this.get("isEditable")},inlineEditorWillBeginEditing:function(b,c,a){b.set("value",this.get("value"))},inlineEditorDidBeginEditing:function(b,c,a){this.set("isEditing",YES)},inlineEditorWillCommitEditing:function(b,c,a){if(this.inlineEditorWillEndEditing){this.inlineEditorWillEndEditing(b,c)}},inlineEditorDidCommitEditing:function(b,c,a){a.setIfChanged("value",c);if(this.inlineEditorDidEndEditing){this.inlineEditorDidEndEditing(b,c)}this._endEditing()},inlineEditorWillDiscardEditing:function(b,a){if(this.inlineEditorWillEndEditing){this.inlineEditorWillEndEditing(b,this.get("value"))}},inlineEditorDidDiscardEditing:function(b,a){if(this.inlineEditorDidEndEditing){this.inlineEditorDidEndEditing(b,this.get("value"))}this._endEditing()},_endEditing:function(){if(this._editor){this.invokeDelegateMethod(this.inlineEditorDelegate,"releaseEditor",this._editor);this._editor=null}this.set("isEditing",NO)}};SC.InlineEditor={isInlineEditor:YES,isEditing:NO,inlineEditorDelegate:null,_target:null,beginEditing:function(b){if(this.get("isEditing")||!b||!b.isInlineEditable){return NO}var a,c;c=this._target=b;a=this.delegateFor("inlineEditorWillBeginEditing",this.inlineEditorDelegate,c);if(a){a.inlineEditorWillBeginEditing(this,this.get("value"),c)}this.set("isEditing",YES);this.invokeLast(this._callDidBegin);this._didBeginInvoked=YES;return YES},_callDidBegin:function(){if(!this.get("isEditing")){return NO}this._didBeginInvoked=NO;var b=this._target,a;a=this.delegateFor("inlineEditorDidBeginEditing",this.inlineEditorDelegate,b);if(a){a.inlineEditorDidBeginEditing(this,this.get("value"),b)}},commitEditing:function(){if(!this.get("isEditing")){return NO}if(this._didBeginInvoked){this._callDidBegin()}var a,b=this._target;a=this.delegateFor("inlineEditorShouldCommitEditing",this.inlineEditorDelegate,b);if(a&&!a.inlineEditorShouldCommitEditing(this,this.get("value"),b)){return NO}a=this.delegateFor("inlineEditorWillCommitEditing",this.inlineEditorDelegate,b);if(a){a.inlineEditorWillCommitEditing(this,this.get("value"),b)}this._endEditing();a=this.delegateFor("inlineEditorDidCommitEditing",this.inlineEditorDelegate,b);if(a){a.inlineEditorDidCommitEditing(this,this.get("value"),b)}return YES},discardEditing:function(){if(!this.get("isEditing")){return NO}if(this._didBeginInvoked){this._callDidBegin()}var a,b=this._target;a=this.delegateFor("inlineEditorShouldDiscardEditing",this.inlineEditorDelegate,b);if(a&&!a.inlineEditorShouldDiscardEditing(this,b)){return NO}a=this.delegateFor("inlineEditorWillDiscardEditing",this.inlineEditorDelegate,b);if(a){a.inlineEditorWillDiscardEditing(this,b)}this._endEditing();a=this.delegateFor("inlineEditorDidDiscardEditing",this.inlineEditorDelegate,b);if(a){a.inlineEditorDidDiscardEditing(this,b)}return YES},_endEditing:function(){this.set("isEditing",NO);this._target=null}};SC.InlineEditorDelegate={acquireEditor:function(a){},releaseEditor:function(a){},inlineEditorShouldBeginEditing:function(a,b){},inlineEditorWillBeginEditing:function(b,c,a){},inlineEditorDidBeginEditing:function(b,c,a){},inlineEditorShouldCommitEditing:function(b,c,a){},inlineEditorWillCommitEditing:function(b,c,a){},inlineEditorDidCommitEditing:function(b,c,a){},inlineEditorShouldDiscardEditing:function(b,a){},inlineEditorWillDiscardEditing:function(b,a){},inlineEditorDidDiscardEditing:function(b,a){},inlineEditorWillEndEditing:function(b,c,a){},inlineEditorDidEndEditing:function(b,c,a){}};SC.SCALE_NONE="none";SC.FILL="fill";SC.FILL_PROPORTIONALLY=SC.BEST_FILL="best-fill";SC.BEST_FIT="best-fit";SC.BEST_FIT_DOWN_ONLY="best-fit-down";SC.InnerFrame={align:SC.ALIGN_CENTER,innerFrameForSize:function(a,c,h,b){var e=this.get("align"),d=this.get("scale"),g,f,i;i={x:0,y:0,width:h,height:b};if(d===SC.FILL){return i}g=h/a;f=b/c;switch(d){case SC.BEST_FILL:d=g>f?g:f;break;case SC.BEST_FIT:d=g<f?g:f;break;case SC.BEST_FIT_DOWN_ONLY:if((a>h)||(c>b)){d=g<f?g:f}else{d=1}break;case SC.SCALE_NONE:d=1;break;default:if(isNaN(window.parseFloat(d))||(window.parseFloat(d)<=0)){SC.Logger.warn("SC.InnerFrame: The scale '%@' was not understood.  Scale must be one of SC.FILL, SC.BEST_FILL, SC.BEST_FIT, SC.BEST_FIT_DOWN_ONLY or a positive number greater than 0.00.".fmt(d));return i}}a*=d;c*=d;i.width=Math.round(a);i.height=Math.round(c);switch(e){case SC.ALIGN_LEFT:i.x=0;i.y=(b/2)-(c/2);break;case SC.ALIGN_RIGHT:i.x=h-a;i.y=(b/2)-(c/2);break;case SC.ALIGN_TOP:i.x=(h/2)-(a/2);i.y=0;break;case SC.ALIGN_BOTTOM:i.x=(h/2)-(a/2);i.y=b-c;break;case SC.ALIGN_TOP_LEFT:i.x=0;i.y=0;break;case SC.ALIGN_TOP_RIGHT:i.x=h-a;i.y=0;break;case SC.ALIGN_BOTTOM_LEFT:i.x=0;i.y=b-c;break;case SC.ALIGN_BOTTOM_RIGHT:i.x=h-a;i.y=b-c;break;default:i.x=(h/2)-(a/2);i.y=(b/2)-(c/2)}return i},scale:SC.FILL};SC.StaticLayout={hasStaticLayout:YES,initMixin:function(){}};SC.Validatable={initMixin:function(){this._validatable_validatorDidChange()},validator:null,errorLabel:null,isValid:function(){return SC.typeOf(this.get("value"))!==SC.T_ERROR}.property("value"),ownerForm:null,performValidate:function(c){var a=SC.VALIDATE_OK;if(this._validator){var b=this.get("ownerForm");if(c){a=this._validator.validatePartial(b,this);if((a==SC.VALIDATE_NO_CHANGE)&&(this._validator.validateChange(b,this)==SC.VALIDATE_OK)){a=SC.VALIDATE_OK}}else{a=this._validator.validateChange(b,this)}}return a},performValidateSubmit:function(){return this._validator?this._validator.validateSubmit(this.get("ownerForm"),this):SC.VALIDATE_OK},performValidateKeyDown:function(a){var b=a.getCharString();if(!b){return YES}return this._validator?this._validator.validateKeyDown(this.get("ownerForm"),this,b):YES},validatorObject:function(){return this._validator}.property(),validateSubmit:function(){return this.performValidateSubmit()},objectForFieldValue:function(b,a){return this._validator?this._validator.objectForFieldValue(b,this.get("ownerForm"),this):b},fieldValueForObject:function(a){return this._validator?this._validator.fieldValueForObject(a,this.get("ownerForm"),this):a},_validatable_displayObserver:function(){this.displayDidChange()}.observes("isValid"),renderMixin:function(a){a.setClass("invalid",!this.get("isValid"))},_validatable_validatorDidChange:function(){var a=this.get("ownerForm");var b=SC.Validator.findFor(a,this,this.get("validator"));if(b!=this._validator){this.propertyWillChange("validatorObject");if(this._validator){this._validator.detachFrom(a,this)}this._validator=b;if(this._validator){this._validator.attachTo(a,this)}this.propertyDidChange("validatorObject")}}.observes("validator","ownerForm")};SC.RenderDelegate={create:function(){var c=SC.beget(this);var b,a=arguments.length;for(b=0;b<a;b++){c.mixin(arguments[b])}return c},reopen:function(b){var c,a;for(c in b){a=b[c];if(!b.hasOwnProperty(c)){continue}if(typeof a==="function"&&a!==this[c]){a.base=this[c]||SC.K}if(a&&a.isEnhancement&&a!==this[c]){a=SC._enhance(this[c]||SC.K,a)}this[c]=a}},get:function(a){return this[a]},getPropertyFor:function(b,a){if(this[a+"For"]){return this[a+"For"](b,a)}return this[a]},className:undefined,render:function(b,a){},update:function(b,a){}};SC.RenderDelegate.extend=SC.RenderDelegate.create;SC.RenderDelegate.mixin=SC.RenderDelegate.reopen;sc_require("render_delegates/render_delegate");SC.BaseTheme.canvasImageRenderDelegate=SC.RenderDelegate.create({className:"canvasImage",render:function(f,b){var d=f.get("width")||0,a=f.get("height")||0,c=f.get("type")||SC.IMAGE_TYPE_URL,e=f.get("value");if(e&&c===SC.IMAGE_TYPE_CSS_CLASS){b.addClass(e);f.renderState._last_class=e}b.setAttr("width",d);b.setAttr("height",a)},update:function(o,f){var p=f[0],l=o.get("image"),j=o.get("frame"),n=j.width,h=j.height,k=o.get("innerFrame"),e=o.get("backgroundColor"),r=o.get("renderState"),c,a=o.renderState._last_class,d=o.get("type")||SC.IMAGE_TYPE_URL,m=o.get("value");if(a){f.removeClass(a)}if(m&&d===SC.IMAGE_TYPE_CSS_CLASS){f.addClass(m);o.renderState._last_class=m;if(p&&p.getContext){c=p.getContext("2d");c.clearRect(0,0,n,h)}}else{var b=![k.x,k.y,k.width,k.height].isEqual(r._lastInnerFrameValues),g=![p.width,p.height].isEqual(r._lastElemSizeValues),q=o.didChangeFor("canvasImageRenderDelegate","backgroundColor"),i=o.didChangeFor("canvasImageRenderDelegate","image")||(l&&l.complete)!==r._lastImageComplete;if(g||b||q||i){if(p&&p.getContext){p.height=h;p.width=n;c=p.getContext("2d");c.clearRect(0,0,n,h);if(e){c.fillStyle=e;c.fillRect(0,0,n,h)}if(l&&l.complete){c.drawImage(l,Math.floor(k.x),Math.floor(k.y),Math.floor(k.width),Math.floor(k.height))}}r._lastInnerFrameValues=[k.x,k.y,k.width,k.height];r._lastElemSizeValues=[p.width,p.height];r._lastImageComplete=l&&l.complete}}}});sc_require("render_delegates/render_delegate");SC.BaseTheme.containerRenderDelegate=SC.RenderDelegate.create({render:function(b,a){},update:function(){}});sc_require("render_delegates/render_delegate");SC.RenderDelegate.reopen({sizes:[SC.TINY_CONTROL_SIZE,SC.SMALL_CONTROL_SIZE,SC.REGULAR_CONTROL_SIZE,SC.LARGE_CONTROL_SIZE,SC.HUGE_CONTROL_SIZE,SC.JUMBO_CONTROL_SIZE],sizeFor:function(f){var e=f.get("controlSize"),c,b,a;if(e){if(!this[e]){this[e]={}}c=this[e];if(!c.name){c.name=e}return c}var d=f.get("frame");if(!d){c=this["sc-regular-size"];if(!c){c=this["sc-regular-size"]={}}if(!c.name){c.name="sc-regular-size"}return c}for(b=0;b<a;b++){key=sizes[b];c=this[key];if(!c){continue}if((c.width===undefined&&c.height===undefined&&c.minHeight===undefined&&c.minWidth===undefined&&c.maxHeight===undefined&&c.maxWidth===undefined)||(c.width!==undefined&&d.width!==c.width)||(c.minWidth!==undefined&&d.width<c.minWidth)||(c.maxWidth!==undefined&&d.width>c.maxWidth)||(c.height!==undefined&&d.height!==c.height)||(c.minHeight!==undefined&&d.height<c.minHeight)||(c.maxHeight!==undefined&&d.height<c.maxHeight)){continue}if(!c.name){c.name=key}return c}c=this["sc-regular-size"];if(!c){c=this["sc-regular-size"]={}}if(!c.name){c.name="sc-regular-size"}return c},addSizeClassName:function(c,b){var a=this.sizeFor(c);if(a){b.addClass(a.name)}},updateSizeClassName:function(c,a){var b=this.sizeFor(c);if(b){a.addClass(b.name)}},getPropertyFor:function(c,a){var b=this.sizeFor(c);if(b){if(b[a+"For"]){return b[a+"For"](c,a)}else{if(b[a]!==undefined){return b[a]}}}if(this[a+"For"]){return this[a+"For"]}return this[a]}});sc_require("render_delegates/render_delegate");SC.BaseTheme.imageRenderDelegate=SC.RenderDelegate.create({className:"image",render:function(f,b){var e=f.get("image"),d=f.get("value"),c=f.get("type")||SC.IMAGE_TYPE_URL,a=f.get("toolTip");b=b.begin("img");b.setAttr("src",e.src);if(d&&c===SC.IMAGE_TYPE_CSS_CLASS){b.addClass(d);f.renderState._last_class=d}if(a){b.setAttr("title",a);b.setAttr("alt",a)}b.addStyle(this.imageStyles(f));b=b.end()},update:function(g,a){var f=g.get("image"),c=g.renderState._last_class,e=g.get("value"),d=g.get("type")||SC.IMAGE_TYPE_URL,b=g.get("toolTip");a=a.find("img");a.attr("src",f.src);if(c){a.removeClass(c)}if(e&&d===SC.IMAGE_TYPE_CSS_CLASS){a.addClass(e);g.renderState._last_class=e}if(b){a.attr("title",b);a.attr("alt",b)}a.css(this.imageStyles(g))},imageStyles:function(b){var a=b.get("innerFrame");return{position:"absolute",left:Math.round(a.x),top:Math.round(a.y),width:Math.round(a.width),height:Math.round(a.height)}}});sc_require("render_delegates/render_delegate");SC.BaseTheme.labelRenderDelegate=SC.RenderDelegate.create({className:"label",render:function(d,c){var a=d.get("toolTip");this.addSizeClassName(d,c);if(a){c.setAttr("title",a)}c.addStyle({textAlign:d.get("textAlign")||null});c.setClass("ellipsis",d.get("needsEllipsis")||NO);c.setClass("icon",d.get("icon")||NO);var b=this.htmlForTitleAndIcon(d);c.push(b);d.get("renderState")._lastHTMLForTitleAndIcon=b},update:function(d,a){var b=d.get("toolTip");this.updateSizeClassName(d,a);a.css({textAlign:d.get("textAlign")||null});if(b){a.attr("title",b)}else{a.removeAttr("title")}a.setClass("ellipsis",d.get("needsEllipsis")||NO);var c=this.htmlForTitleAndIcon(d);if(d.get("renderState")._lastHTMLForTitleAndIcon!==c){a.html(c);d.get("renderState")._lastHTMLForTitleAndIcon=c}},htmlForTitleAndIcon:function(e){var d=e.get("title"),c=e.get("hint"),b=e.get("escapeHTML"),a=e.get("icon")||"";if(d&&b){d=SC.RenderContext.escapeHTML(d)}if(c&&b){c=SC.RenderContext.escapeHTML(c)}if(c&&!d){d="<span class='sc-hint'>"+c+"</span>"}if(a){if(a.indexOf("/")>=0){a='<img src="'+a+'" alt="" class="icon" />'}else{a='<img src="'+SC.BLANK_IMAGE_URL+'" alt="" class="icon '+a+'" />'}}return a+(SC.none(d)?"":d)}});SC.Task=SC.Object.extend({run:function(a){}});sc_require("tasks/task");SC.AppCacheTask=SC.Task.extend({run:function(){window.applicationCache.update();SC.appCache._appCacheStatusDidChange()}});SC.appCache=SC.Object.create({isNewVersionValid:function(){var c=this.get("hasNewVersion"),b,a=this.get("status");if(SC.platform.supportsApplicationCache){if(c){if(a===window.applicationCache.UPDATEREADY){b=true}else{b=false}}}else{b=false}return b}.property("hasNewVersion").cacheable(),isReadyForOffline:function(){var b,a=this.get("status");if(SC.platform.supportsApplicationCache){if(a===window.applicationCache.IDLE||a===window.applicationCache.UPDATEREADY){b=true}else{if(a===window.applicationCache.UNCACHED||a===window.applicationCache.OBSOLETE){b=false}}}else{b=false}return b}.property("status").cacheable(),hasNewVersion:function(){var b,a=this.get("status");if(SC.platform.supportsApplicationCache){if(a===window.applicationCache.UPDATEREADY||a===window.applicationCache.OBSOLETE){b=true}else{if(a===window.applicationCache.IDLE){b=false}}}else{b=false}return b}.property("status").cacheable(),interval:1800000,progress:0,shouldPoll:function(b,c){if(SC.none(c)){c=false}else{if(c){var a=this.get("status");if(a===window.applicationCache.IDLE){this._timer=SC.Timer.schedule({target:this,action:"_checkForUpdates",interval:this.get("interval"),repeats:YES})}else{}}else{if(this._timer){this._timer.invalidate();this._timer=null;this._task=null}}}return c}.property().cacheable(),status:0,_appCacheDidProgress:function(a){a=a.originalEvent;if(a.lengthComputable){this.set("progress",a.loaded/a.total)}else{this.set("progress",null)}},_appCacheStatusDidChange:function(){var b=window.applicationCache,a;a=b.status;SC.Event.remove(b);switch(a){case b.UNCACHED:break;case b.IDLE:this.set("progress",1);break;case b.CHECKING:SC.Event.add(b,"downloading",this,"_appCacheStatusDidChange");SC.Event.add(b,"noupdate",this,"_appCacheStatusDidChange");SC.Event.add(b,"error",this,"_appCacheStatusDidChange");break;case b.DOWNLOADING:SC.Event.add(b,"progress",this,"_appCacheDidProgress");SC.Event.add(b,"cached",this,"_appCacheStatusDidChange");SC.Event.add(b,"updateready",this,"_appCacheStatusDidChange");SC.Event.add(b,"error",this,"_appCacheStatusDidChange");break;case b.UPDATEREADY:break;case b.OBSOLETE:break;default:SC.error("Unknown application cache status: %@".fmt(b.status));break}this.set("status",a)},_checkForUpdates:function(){var a=this._task;if(this.get("status")===window.applicationCache.IDLE){if(!a){a=this._task=SC.AppCacheTask.create()}SC.backgroundTaskQueue.push(a)}else{this.set("shouldPoll",false)}},init:function(){arguments.callee.base.apply(this,arguments);if(SC.platform.supportsApplicationCache){this._appCacheStatusDidChange()}else{SC.warn("Unable to use SC.appCache, the browser does not support the application cache.")}}});SC.Benchmark={verbose:NO,enabled:YES,events:{},stats:{},globalStartTime:null,addEvent:function(a,b){if(!b){b=new Date().getTime()}this.events[a]=b},start:function(b,a,e,d){var f,c;if(this.enabled){f=e||Date.now();if(a){c=this._subStatFor(b,a)}else{c=this._statFor(b)}if(c){if(d&&c._starts.length>0){c._starts.push("ignore")}else{c._starts.push(f)}c._times.push({start:f,_subStats:{}})}}return b},end:function(c,b,f){var e,g,a,d;if(!this.enabled){return}if(b){e=this._subStatFor(c,b)}else{e=this._statFor(c)}if(e&&e._starts.length){g=e._starts.pop();if(g!=="ignore"){a=(f||Date.now());d=a-g;e._times[e._times.length-1].end=a;e._times[e._times.length-1].dur=d;e.amt+=d;e.runs++;if(this.verbose){this.log(c)}}}else{SC.Logger.log('SC.Benchmark "%@" ended without a matching start.  No information was saved.'.fmt(c))}},setGlobalStartTime:function(a){this.globalStartTime=a},bench:function(d,c,a){var b;if(!c){c="bench%@".fmt(this._benchCount++)}if(!a){a=1}while(--a>=0){SC.Benchmark.start(c);b=d();SC.Benchmark.end(c)}return b},install:function(a,e,c){var b=a["b__"+e]=a[e],d=Array.prototype.join;a[e]=function(){var g="%@(%@)".fmt(e,d.call(arguments,", ")),f;SC.Benchmark.start(g,null,null,c);f=b.apply(this,arguments);SC.Benchmark.end(g);return f}},restore:function(a,b){a[b]=a["b__"+b]},report:function(c){if(c){return this._genReport(c)}var b=[];for(var a in this.stats){if(!this.stats.hasOwnProperty(a)){continue}b.push(this._genReport(a))}return b.join("\n")},timelineReport:function(a){a=(a)?"SproutCore Application":a;var b=[a,"User-Agent: %@".fmt(navigator.userAgent),"Report Generated: %@ (%@)".fmt(new Date().toString(),Date.now()),""];var d=this._compileChartData(true);for(var c=0;c<d.length;c++){if(d[c][4]){b.push(this._timelineGenSubReport(d[c]))}else{b.push(this._timelineGenReport(d[c]))}}return b.join("\n")},getTimelineChartContent:function(){var l=this._compileChartData(false);var g=l.length;if(g===0){return}var c=this.globalStartTime?this.globalStartTime:l[0][1];var d=l[g-1][2]-c;var n=25+g*30;var q=Math.ceil(d/200)+1;var r=q*50;var m=10,s=300;var o="<div class = 'sc-benchmark-timeline-chart' style = 'position:relative;'>";o+="<div class = 'sc-benchmark-top'></div>";for(var p=0;p<q;p++){o+="<div class = 'sc-benchmark-tick' style = '";o+="left: "+(m+p*50)+"px; ";o+="height: "+n+"px;";o+="'></div>";o+="<div class = 'sc-benchmark-tick-label' style = '";o+="left: "+(m+p*50)+"px; ";o+="'>"+(p*200)+"ms</div>"}for(p=0;p<g;p++){o+="<div class = 'sc-benchmark-row ";o+=(p%2===0)?"even":"odd";o+="' style = '";o+="top: "+(50+(p*30))+"px; ";o+="'></div>";var j=document.createElement("div");var f=l[p][1];var e=l[p][2];var a=l[p][3];o+="<div class = 'sc-benchmark-bar' style = '";o+="left:"+(m+((f-c)/4))+"px; width: "+((a/4))+"px;";o+="top: "+(28+(p*30))+"px;";o+="' title = 'start: "+(f-c)+" ms, end: "+(e-c)+" ms, duration: "+a+" ms'";o+=">";o+="&nbsp;"+l[p][0]+" <span class='sc-benchmark-emphasis'>";o+=a+"ms (start: "+(f-c)+"ms)";o+="</span>";o+="</div>"}var b=this.events,k=0;for(p in b){var h=b[p]-c;o+="<div class = 'sc-benchmark-event idx"+(k%10)+"' style = '";o+="left: "+(m+h/4)+"px; height: "+n+"px; top: 20px;";o+="' title = '"+p+": "+h+"'></div>";k++}o+="</div>";return{html:o,totalCapturedTime:d,pointsCaptured:g,width:r+m+s,height:n}},getTimelineChartView:function(){var a=SC.ScrollView.create({contentView:SC.StaticContentView.extend({}),reload:function(){var b=SC.Benchmark.getTimelineChartContent();this.contentView.set("content",b.html);this.contentView.adjust({width:b.width,height:b.height});this.chartContent=b;SC.RunLoop.invokeLater(SC.Benchmark,function(){this.contentView.notifyPropertyChange("frame")})}});a.reload();return a},timelineChart:function(a){SC.RunLoop.begin();var c=0;this.hideChart();var b=this.getTimelineChartView();var e=b.chartContent.pointsCaptured,d=b.chartContent.totalCapturedTime;this._benchmarkChart=SC.Pane.create({classNames:["sc-benchmark-pane"],layout:{left:20,right:20,bottom:20,top:20},childViews:["title","exit"],exit:SC.ButtonView.extend({layout:{right:20,top:20,width:100,height:30},title:"Hide Chart",target:this,action:"hideChart"}),title:SC.LabelView.extend({classNames:["sc-benchmark-title"],layout:{left:20,top:23,right:200,height:30},value:((a)?a:"SproutCore Application")+(" - Total Captured Time: "+d+" ms - Points Captured: "+e)})}).append();b.set("layout",{left:20,top:60,bottom:20,right:20});this._benchmarkChart.appendChild(b);SC.RunLoop.end()},hideChart:function(){if(this._benchmarkChart){this._benchmarkChart.remove();this._benchmarkChart=null}return YES},tryToPerform:function(b,a){if(this[b]){return this[b](a)}return NO},log:function(d){var c=this.report(d).split("\n"),b=c.length,a;for(a=0;a<b;a++){SC.Logger.log(c[a])}},startProfile:function(a){if(!this.enabled){return}SC.Logger.profile(a)},endProfile:function(a){if(!this.enabled){return}SC.Logger.profileEnd(a)},loadPreloadEvents:function(){var f=SC.benchmarkPreloadEvents,e=[],b,a,c;if(typeof webkitPerformance!=="undefined"){SC.mixin(f,webkitPerformance.timing)}if(!this.globalStartTime){var d=["navigation","navigationStart","headStart"];a=d.length;for(b=0;b<a;b++){if(f[d[b]]){this.globalStartTime=f[d[b]];break}}}this.javascriptStartTime=f.headStart;SC.mixin(this.events,f);this._hasLoadedPreloadEvents=true},_loadBenchmarksFromEvents:function(){if(!this._hasLoadedPreloadEvents){this.loadPreloadEvents()}var b=this.events;for(var a in b){if(a.substr(-3)!=="End"){continue}var c=a.substr(0,a.length-3);if(!b[c+"Start"]){continue}SC.Benchmark.start(c,undefined,b[c+"Start"]);SC.Benchmark.end(c,undefined,b[c+"End"]);delete b[c+"Start"];delete b[c+"End"]}},_compileChartData:function(g){this._loadBenchmarksFromEvents();var l=[],a;for(var m in this.stats){var e=this.stats[m];for(var f=0;f<e._times.length;f++){var n=e._times[f];a=(e._times.length>1)?(f+1)+" - "+m:m;l.push([a,n.start,n.end,n.dur,false]);if(g){var b=n._subStats;for(var c in b){var h=b[c];for(var d=0;d<h._times.length;d++){var o=h._times[d];a=(h._times.length>1)?(d+1)+" - "+c:c;l.push([a,o.start,o.end,o.dur,true])}}}}}l.sort(function(j,i){if(j[1]<i[1]){return -1}else{if(j[1]==i[1]){if(j[3]&&!i[3]){return -1}if(!j[3]&&i[3]){return 1}return 0}}return 1});return l},_genReport:function(b){var c=this._statFor(b),e=(c.runs>0)?(Math.floor(c.amt*1000/c.runs)/1000):0,d,a;if(c._times.length){d=c._times[c._times.length-1];a="BENCH %@ msec: %@ (%@x); latest: %@".fmt(e,(c.name||b),c.runs,d.end-d.start)}else{a='No information for SC.Benchmark "%@".'.fmt(b)}return a},_timelineGenReport:function(a){if(this.globalStartTime){return"BENCH start: %@ msec, duration: %@ msec,  %@".fmt((a[1]-this.globalStartTime),a[3],a[0])}else{return"BENCH duration: %@ msec, %@".fmt(a[3],a[0])}},_timelineGenSubReport:function(a){if(this.globalStartTime){return"   CHECKPOINT BENCH start: %@ msec, duration: %@ msec,  %@".fmt((a[1]-this.globalStartTime),a[3],a[0])}else{return"   CHECKPOINT BENCH duration: %@ msec, %@".fmt(a[3],a[0])}},_subStatFor:function(d,c){var f=this.stats[c],e=f?f._times.length:0,a,b;if(!e){return}a=f._times[e-1]._subStats;b=a[d];if(!b){b=a[d]={runs:0,amt:0,name:d,_starts:[],_times:[]}}return b},_statFor:function(b){var a=this.stats[b];if(!a){a=this.stats[b]={runs:0,amt:0,name:b,_starts:[],_times:[]}}return a},reset:function(){this.stats={}},_bench:function(b,a){SC.Benchmark.bench(b,a,1)},_benchCount:1};SC.Benchmark=SC.Benchmark;SC.Cookie=SC.Object.extend({name:null,value:"",expires:null,path:null,domain:null,secure:NO,isCookie:YES,destroy:function(){this.set("expires",-1);this.write();arguments.callee.base.apply(this,arguments)},write:function(){var d=this.get("name"),f=this.get("value"),a=this.get("expires"),h=this.get("path"),e=this.get("domain"),g=this.get("secure"),b="",c;if(a){if(typeof a===SC.T_NUMBER){c=new Date();c.setTime(c.getTime()+(a*24*60*60*1000))}else{if(SC.DateTime&&a.get&&a.get("milliseconds")){c=new Date(a.get("milliseconds"))}else{if(a.toUTCString&&a.toUTCString.apply){c=a}}}if(c){b="; expires="+c.toUTCString()}}if(!SC.none(h)){b+="; path="+h}if(!SC.none(e)){b+="; domain="+e}if(g===YES){b+="; secure"}document.cookie=d+"="+encodeURIComponent(f)+b;return this}});SC.Cookie.mixin({find:function(a){if(document.cookie&&document.cookie!==""){var d=document.cookie.split(";");for(var c=0;c<d.length;c++){var b=SC.String.trim(String(d[c]));if(b.substring(0,a.length+1)===(a+"=")){return SC.Cookie.create({name:a,value:decodeURIComponent(b.substring(a.length+1))})}}}return null}});SC.CookieMonster={nomNomNom:function(b){var a=SC.kindOf(b,SC.Cookie);if(a){SC.Logger.log("YUM!");return b.destroy()}SC.Logger.error("Y U PASS ME NO COOKIE? %@",b);return NO}};SC.mixin(SC.$.fn,{setClass:function(d,c){if(SC.none(d)){return this}var e=SC.typeOf(d)!==SC.T_STRING,a=this._fixupClass,b;this.each(function(){if(this.nodeType!==1){return}var h=this.className.split(/\s+/),g=NO;if(e){for(var f in d){if(d.hasOwnProperty(f)){g=a(h,f,d[f])||g}}}else{g=a(h,d,c)}if(g){this.className=h.join(" ")}});return this},_fixupClass:function(d,a,c){var b=d.indexOf(a);if(c){if(b<0){d.push(a);return YES}}else{if(b>=0){d[b]=null;return YES}}return NO}});SC.ExceptionHandler={enabled:(SC.buildMode!=="debug"),handleException:function(a){if(this.isShowingErrorDialog){return NO}this._displayErrorDialog(a);return NO},_displayErrorDialog:function(b){var a=this._errorDialogHTMLForException(b),c=document.createElement("div");c.style.cssText="left: 0px; right: 0px; top: 0px; bottom: 0px; position: absolute; background-color: white; background-color: rgba(255,255,255,0.6); z-index:100;";c.innerHTML=a;document.body.appendChild(c);this.isShowingErrorDialog=YES},_errorDialogHTMLForException:function(b){var a;a=['<div id="sc-error-dialog" style="position: absolute; width: 500px; left: 50%; top: 50%; margin-left: -250px; background-color: white; border: 1px solid black; font-family: Monaco, monospace; font-size: 9px; letter-spacing: 1px; padding: 10px">',"An error has occurred which prevents the application from running:","<br><br>",b.message,'<div id="sc-error-dialog-reload-button" onclick="window.location.reload();" style="float: right; font-family: Monaco, monospace; font-size: 9px; letter-spacing: 1px; border: 1px solid black; padding: 3px; clear: both; margin-top: 20px; cursor: pointer;">',"Reload","</div>","</div>"];return a.join("")},isShowingErrorDialog:NO};SC.IMAGE_ABORTED_ERROR=SC.$error("SC.Image.AbortedError","Image",-100);SC.IMAGE_FAILED_ERROR=SC.$error("SC.Image.FailedError","Image",-101);SC.imageQueue=SC.Object.create({loadLimit:4,activeRequests:0,loadImage:function(a,e,f,d){var b=SC.typeOf(e);if(SC.none(f)&&SC.typeOf(e)===SC.T_FUNCTION){e=null;f=e}if(SC.typeOf(f)===SC.T_STRING){f=e[f]}if(SC.none(d)){d=SC.none(e)&&SC.none(f)}var c=this._imageEntryFor(a);if(c.status===this.IMAGE_LOADED){if(f){f.call(e||c.image,c.url,c.image)}}else{if(e||f){this._addCallback(c,e,f)}c.retainCount++;this._scheduleImageEntry(c,d)}},releaseImage:function(a,d,e){var c=this._imageEntryFor(a,NO);if(!c){return this}if(--c.retainCount<=0){this._deleteEntry(c)}else{if(d||e){var b=SC.typeOf(d);if(SC.none(e)&&SC.typeOf(d)===SC.T_FUNCTION){d=null;e=d}if(SC.typeOf(e)===SC.T_STRING){e=d[e]}this._removeCallback(c,d,e)}}},reloadImage:function(a){var b=this._imageEntryFor(a,NO);if(b&&b.status===this.IMAGE_LOADED){b.status=this.IMAGE_WAITING}},loadNextImage:function(){var c=null,a;if(this.get("activeRequests")>=this.get("loadLimit")){return}a=this._foregroundQueue;while(a.length>0&&!c){c=a.shift()}if(!c){a=this._backgroundQueue;while(a.length>0&&!c){c=a.shift()}}this.set("isLoading",!!c);if(c){var b=c.image;if(!b){return}$(b).bind("abort",this._imageDidAbort);$(b).bind("error",this._imageDidError);$(b).bind("load",this._imageDidLoad);b.src=c.url;this._loading.push(c);this.incrementProperty("activeRequests");this.loadNextImage()}},_imageEntryFor:function(c,a){if(a===undefined){a=YES}var d=this._images[c];if(!d&&a){var b=new Image();d=this._images[c]={url:c,status:this.IMAGE_WAITING,callbacks:[],retainCount:0,image:b};b.entry=d}else{if(d&&d.image===null){d.image=new Image();d.image.entry=d}}return d},_deleteEntry:function(a){this._unscheduleImageEntry(a);delete this._images[a.url]},_addCallback:function(c,d,e){var b=c.callbacks;var a=b.find(function(f){return f[0]===d&&f[1]===e},this);if(!a){b.push([d,e])}b=null;return this},_removeCallback:function(b,c,d){var a=b.callbacks;a.forEach(function(f,e){if(f[0]===c&&f[1]===d){a[e]=null}},this);a=null;return this},_scheduleImageEntry:function(d,c){var b=this._backgroundQueue;var e=this._foregroundQueue;if(d.status===this.IMAGE_LOADED){return this}if((d.status===this.IMAGE_QUEUED)&&!c&&d.isBackground){b[b.indexOf(d)]=null;d.status=this.IMAGE_WAITING}if(d.status!==this.IMAGE_QUEUED){var a=(c)?b:e;a.push(d);d.status=this.IMAGE_QUEUED;d.isBackground=c}if(!this.isLoading){this.invokeLater(this.loadNextImage,100)}this.set("isLoading",YES);return this},_unscheduleImageEntry:function(b){if(b.status!==this.IMAGE_QUEUED){return this}var a=b.isBackground?this._backgroundQueue:this._foregroundQueue;a[a.indexOf(b)]=null;if(this._loading.indexOf(b)>=0){if(a.image){a.image.abort()}this.imageStatusDidChange(b,this.ABORTED)}return this},_imageDidAbort:function(){SC.run(function(){SC.imageQueue.imageStatusDidChange(this.entry,SC.imageQueue.ABORTED)},this)},_imageDidError:function(){SC.run(function(){SC.imageQueue.imageStatusDidChange(this.entry,SC.imageQueue.ERROR)},this)},_imageDidLoad:function(){SC.run(function(){SC.imageQueue.imageStatusDidChange(this.entry,SC.imageQueue.LOADED)},this)},imageStatusDidChange:function(c,a){if(!c){return}var b=c.url;var d;switch(a){case this.LOADED:d=c.image;break;case this.ABORTED:d=SC.IMAGE_ABORTED_ERROR;break;case this.ERROR:d=SC.IMAGE_FAILED_ERROR;break;default:d=SC.IMAGE_FAILED_ERROR;break}c.callbacks.forEach(function(f){var g=f[0],h=f[1];h.call(g,b,d)},this);c.callbacks=[];c.status=(a===this.LOADED)?this.IMAGE_LOADED:this.IMAGE_WAITING;var e=c.image;if(e){e.onload=e.onerror=e.onabort=null;if(a!==this.LOADED){c.image=null}}this._loading[this._loading.indexOf(c)]=null;if(this._loading.length>this.loadLimit*2){this._loading=this._loading.compact()}this.decrementProperty("activeRequests");this.loadNextImage()},init:function(){arguments.callee.base.apply(this,arguments);this._images={};this._loading=[];this._foregroundQueue=[];this._backgroundQueue=[]},IMAGE_LOADED:"loaded",IMAGE_QUEUED:"queued",IMAGE_WAITING:"waiting",ABORTED:"aborted",ERROR:"error",LOADED:"loaded"});SC.Math=SC.Object.create({near:function(c,b,a){if(!a){a=0.00001}return Math.abs(c-b)<=a},round:function(d,a){if(!a){a=0}var b=Math.pow(10,a);if(a<0){var c=b.toString();b=c.substring(0,c.indexOf("1")+1)}d=d.valueOf();return Math.round(d*b)/b}});sc_require("tasks/task");SC.Module=SC.Object.create({isModuleReady:function(a){var b=SC.MODULE_INFO[a];return b?!!b.isReady:NO},loadModule:function(c,f,g){var e=SC.MODULE_INFO[c],b;if(arguments.length>3){b=new Array(arguments.length-3);for(var d=0,a=b.length;d<a;d++){b[d]=arguments[d+3]}}else{b=[]}if(g===undefined&&SC.typeOf(f)===SC.T_FUNCTION){g=f;f=null}if(!e){throw new Error("SC.Module: could not find module '%@'".fmt(c))}e.isPrefetching=NO;if(e.isLoaded&&!e.isWaitingForRunLoop){if(!this._dependenciesMetForModule(c)){this._addCallbackForModule(c,f,g,b);this._loadDependenciesForModule(c);return NO}if(e.source){this._evaluateStringLoadedModule(e);this._addCallbackForModule(c,f,g,b);this.invokeLast(function(){e.isReady=YES;this._moduleDidBecomeReady(c)});return NO}if(g){if(SC.isReady){SC.Module._invokeCallback(c,f,g,b)}else{SC.ready(SC.Module,function(){SC.Module._invokeCallback(c,f,g,b)})}}return YES}else{if(e.isWaitingForRunLoop){this._addCallbackForModule(c,f,g,b)}else{this._addCallbackForModule(c,f,g,b);if(!e.isLoading){this._loadDependenciesForModule(c);this._loadCSSForModule(c);this._loadJavaScriptForModule(c);e.isLoading=YES}return NO}}},_addCallbackForModule:function(b,e,f,a){var c=SC.MODULE_INFO[b];var d=c.callbacks||[];if(f){d.push(function(){SC.Module._invokeCallback(b,e,f,a)})}c.callbacks=d},prefetchModule:function(a){var b=SC.MODULE_INFO[a];if(b.isLoading||b.isLoaded){return}if(SC.LOG_MODULE_LOADING){SC.debug("SC.Module: Prefetching module '%@'.",a)}this._loadDependenciesForModule(a);this._loadCSSForModule(a);this._loadJavaScriptForModule(a);b.isLoading=YES;b.isPrefetching=YES},_executeLazilyInstantiatedModule:function(b,c,i){var h=SC.LAZY_INSTANTIATION[b];var g;var a;var j,d;if(SC.LOG_MODULE_LOADING){SC.debug("SC.Module: Module '%@' is marked for lazy instantiation, instantiating it now…",b)}d=h.length;for(j=0;j<d;j++){try{h[j]()}catch(f){SC.Logger.error("SC.Module: Failed to lazily instatiate entry for  '%@'".fmt(b))}}delete SC.LAZY_INSTANTIATION[b];g=this._targetForTargetName(c);a=this._methodForMethodNameInTarget(i,g);if(!a){throw new Error("SC.Module: could not find callback for lazily instantiated module '%@'".fmt(b))}},_evaluateStringLoadedModule:function(b){var a=b.source;jQuery.globalEval(a);delete b.source;if(b.cssSource){var c=document.createElement("style");c.setAttribute("type","text/css");if(c.styleSheet){c.styleSheet.cssText=b.cssSource}else{var d=document.createTextNode(b.cssSource);c.appendChild(d)}document.getElementsByTagName("head")[0].appendChild(c)}b.isReady=YES},_loadCSSForModule:function(d){var f=document.getElementsByTagName("head")[0];var e=SC.MODULE_INFO[d];var h=e.styles||[];var b=h.length;var c;var g;var a;if(!f){f=document.documentElement}b=h.length;for(a=0;a<b;a++){c=h[a];if(c.length>0){if(SC.LOG_MODULE_LOADING){SC.debug("SC.Module: Loading CSS file in '%@' -> '%@'",d,c)}if(window.devicePixelRatio>1||window.location.search.indexOf("2x")>-1){c=c.replace(".css","@2x.css")}g=document.createElement("link");g.setAttribute("href",c);g.setAttribute("rel","stylesheet");g.setAttribute("type","text/css");f.appendChild(g)}}g=null},_loadJavaScriptForModule:function(b){var c=SC.MODULE_INFO[b];var d;var a;var e=c.dependencies;var f=YES;if(e&&e.length>0){f=this._dependenciesMetForModule(b)}if(c.isPrefetched){a=c.stringURL}else{if(f){a=c.scriptURL}else{a=c.stringURL}}if(a.length>0){if(SC.LOG_MODULE_LOADING){SC.debug("SC.Module: Loading JavaScript file in '%@' -> '%@'",b,a)}d=document.createElement("script");d.setAttribute("type","text/javascript");d.setAttribute("src",a);if(d.addEventListener){d.addEventListener("load",function(){SC.run(function(){SC.Module._moduleDidLoad(b)})},false)}else{if(d.readyState){d.onreadystatechange=function(){if(this.readyState==="complete"||this.readyState==="loaded"){SC.run(function(){SC.Module._moduleDidLoad(b)})}}}}document.body.appendChild(d)}},_dependenciesMetForModule:function(c){var e=SC.MODULE_INFO[c].dependencies||[];var b,a=e.length;var f;var d;for(b=0;b<a;b++){f=e[b];d=SC.MODULE_INFO[f];if(!d){throw new Error("SC.loadModule: Unable to find dependency %@ for module %@.".fmt(f,c))}if(!d.isReady){return NO}}return YES},_loadDependenciesForModule:function(a){var b=SC.MODULE_INFO[a];var h=b.dependencies||[];var e=YES;var f=h.length;var i;var d;var c;var g;for(i=0;i<f;i++){d=h[i];c=SC.MODULE_INFO[d];if(!c){throw new Error("SC.Module: could not find required module '%@' for module '%@'".fmt(d,a))}else{if(c.isLoading){e=NO;g=c.dependents;if(!g){c.dependents=g=[]}g.push(a)}else{if(c.isReady){continue}else{e=NO;g=c.dependents;if(!g){c.dependents=g=[]}g.push(a);SC.Module.loadModule(d)}}}}},_invokeCallback:function(c,d,a,b){var g;var f;f=this._targetForTargetName(d);g=this._methodForMethodNameInTarget(a,f);if(!g){if(SC.LAZY_INSTANTIATION[c]){this._executeLazilyInstantiatedModule(c,d,a);f=this._targetForTargetName(d);g=this._methodForMethodNameInTarget(a,f)}else{throw new Error("SC.Module: could not find callback for '%@'".fmt(c))}}if(!b){b=[]}b.unshift(c);var e=!!SC.RunLoop.currentRunLoop;if(e){SC.run(function(){g.apply(f,b)})}else{g.apply(f,b)}},_invokeCallbacksForModule:function(c){var e=SC.MODULE_INFO[c],d;if(!e){return}d=e.callbacks||[];for(var b=0,a=d.length;b<a;++b){d[b]()}},_evaluateAndInvokeCallbacks:function(a){var c=SC.MODULE_INFO;var b=c[a];if(b.source){this._evaluateStringLoadedModule(b)}b.isWaitingForRunLoop=YES;this.invokeLast(function(){b.isReady=YES;this._moduleDidBecomeReady(a)})},_moduleDidBecomeReady:function(c){var g=SC.MODULE_INFO;var d=g[c];d.isWaitingForRunLoop=NO;if(SC.isReady){SC.Module._invokeCallbacksForModule(c);delete d.callbacks}else{SC.ready(SC,function(){SC.Module._invokeCallbacksForModule(c);delete d.callbacks})}var h=d.dependents||[];var f,e;for(var b=0,a=h.length;b<a;b++){f=h[b];e=g[f];if(e.isLoaded&&this._dependenciesMetForModule(f)){this._evaluateAndInvokeCallbacks(f)}}},_moduleDidLoad:function(a){var b=SC.MODULE_INFO[a];var c;if(!b){b=SC.MODULE_INFO[a]={isLoaded:YES,isReady:YES};return}if(b.isLoaded){return}delete b.isLoading;b.isLoaded=YES;if(!b.isPrefetching){c=this._dependenciesMetForModule(a);if(c){this._evaluateAndInvokeCallbacks(a)}else{}}else{delete b.isPrefetching}},_targetForTargetName:function(a){if(SC.typeOf(a)===SC.T_STRING){return SC.objectForPropertyPath(a)}return a},_methodForMethodNameInTarget:function(a,b){if(SC.typeOf(a)===SC.T_STRING){return SC.objectForPropertyPath(a,b)}return a},methodsForSuspend:"loadModule _moduleDidLoad prefetchModule _moduleDidBecomeReady".w(),suspend:function(){this._suspendCount=(this._suspendCount||0)+1;if(this._suspendCount!==1){return}var a=this.get("methodsForSuspend"),e,d,c,b;for(b=0;(c=a[b]);b++){if(!this[e="__replacement_"+c+"__"]){(this[e]=function(){(this._bufferedCalls||(this._bufferedCalls=[])).push({method:arguments.callee.methodName,arguments:arguments})}).methodName=c}if(!this[d="__saved_"+c+"__"]){this[d]=this[c]}this[c]=this[e]}},resume:function(){this._suspendCount=(this._suspendCount||0)-1;if(this._suspendCount<0){SC.warn("SC.Module.resume() was called without SC.Module having been in a suspended state. Call aborted.");this._suspendCount=0;return}if(this._suspendCount>0){return}var a=this.get("methodsForSuspend"),d=this._bufferedCalls,c,b,e;for(b=0;(c=a[b]);b++){this[c]=this["__saved_"+c+"__"]}for(b=0;(e=d)&&d[b];b++){this[e.method].apply(this,e.arguments)}if(d){d.length=0}}});SC.ready(function(){var d=SC.MODULE_INFO;var b;var c;var a;for(b in d){c=d[b];if(c.isPrefetched){a=SC.Module.PrefetchModuleTask.create({prefetchedModuleName:b});SC.backgroundTaskQueue.push(a)}}});SC.Module.PrefetchModuleTask=SC.Task.extend({prefetchedModuleName:null,run:function(){SC.Module.prefetchModule(this.prefetchedModuleName)}});sc_require("tasks/task");SC.TaskQueue=SC.Task.extend({init:function(){var a=this;this._doIdleEntry=function(){a._idleEntry()};this._suspendCount=0;this._tasks=[]},runWhenIdle:NO,runLimit:50,interval:50,isRunning:NO,minimumIdleDuration:500,_tasks:null,hasTasks:function(){return this._tasks.length>0}.property("taskCount").cacheable(),taskCount:function(){return this._tasks.length}.property().cacheable(),push:function(a){this._tasks.push(a);this.notifyPropertyChange("taskCount")},next:function(){if(this._tasks.length<1){return null}var a=this._tasks.shift();this.notifyPropertyChange("taskCount");return a},suspend:function(){this._suspendCount++},resume:function(){this._suspendCount--;if(this._suspendCount<=0){this._setupIdle()}},_taskCountDidChange:function(){this._setupIdle()}.observes("taskCount"),_runWhenIdleDidChange:function(){this._setupIdle()}.observes("runWhenIdle"),_setupIdle:function(){if(!this._suspendCount&&this.get("runWhenIdle")&&!this._idleIsScheduled&&this.get("taskCount")>0){setTimeout(this._doIdleEntry,this.get("interval"));this._idleIsScheduled=YES}},_idleEntry:function(){this._idleIsScheduled=NO;var a=SC.RunLoop.lastRunLoopEnd;if(!this.get("runWhenIdle")&&!this._suspendCount){return}if(Date.now()-a>this.get("minimumIdleDuration")){SC.run(this.run,this);SC.RunLoop.lastRunLoopEnd=a}this._setupIdle()},run:function(a){this.set("isRunning",YES);if(!a){a=this.get("runLimit")}var b,c=Date.now();while(b=this.next()){b.run(this);if(Date.now()-c>a){break}}this.set("isRunning",NO)}});SC.backgroundTaskQueue=SC.TaskQueue.create({runWhenIdle:YES});SC.TextSelection=SC.Object.extend(SC.Copyable,SC.Freezable,{start:-1,end:-1,direction:"none",length:function(){var b=this.get("start");var a=this.get("end");if(b===-1||a===-1){return -1}else{return a-b}}.property("start","end").cacheable(),init:function(){arguments.callee.base.apply(this,arguments);this.freeze()},copy:function(){return SC.TextSelection.create({start:this.get("start"),end:this.get("end"),direction:this.get("direction")})},toString:function(){var b=this.get("length"),d=this.get("start"),a=this.get("end"),c=this.get("direction");if(b&&b>0){if(b===1){return"[%@ character selected: {%@, %@}; direction: %@]".fmt(b,d,a,c)}else{return"[%@ characters selected: {%@, %@}; direction: %@]".fmt(b,d,a,c)}}else{return"[no text selected; caret at %@]".fmt(d)}}});SC.UndoManager=SC.Object.extend({undoActionName:function(){return this.undoStack?this.undoStack.name:null}.property("undoStack").cacheable(),undoActionTimestamp:function(){return this.undoStack?this.undoStack.timeStamp:null}.property("undoStack").cacheable(),redoActionName:function(){return this.redoStack?this.redoStack.name:null}.property("redoStack").cacheable(),redoActionTimestamp:function(){return this.redoStack?this.redoStack.timeStamp:null}.property("redoStack").cacheable(),canUndo:function(){return !SC.none(this.undoStack)}.property("undoStack").cacheable(),canRedo:function(){return !SC.none(this.redoStack)}.property("redoStack").cacheable(),undo:function(){this._undoOrRedo("undoStack","isUndoing")},redo:function(){this._undoOrRedo("redoStack","isRedoing")},reset:function(){this._activeGroup=null;this.set("undoStack",null);this.set("redoStack",null)},maxStackLength:0,isUndoing:NO,isRedoing:NO,registerUndoAction:function(d,c,b,a){if(!this.isUndoing&&!this.isRedoing){if(this._activeGroup){this.endUndoGroup()}this.beginUndoGroup(a)}this.registerGroupedUndoAction(d,c,b)},registerGroupedUndoAction:function(d,c,b,a){if(!this._activeGroup){this.registerUndoAction(d,c,b,a)}else{if(a){this._activeGroup.name=a}this._activeGroup.targets.push(d);this._activeGroup.actions.push(c);this._activeGroup.contexts.push(b);this._activeGroup.timeStamp=SC.DateTime.create();if(!this.isUndoing&&!this.isRedoing){this.set("redoStack",null)}}},beginUndoGroup:function(b){if(this._activeGroup){return}var a=this.isUndoing?"redoStack":"undoStack";this._activeGroup={name:b,targets:[],actions:[],contexts:[],prev:this.get(a),timeStamp:SC.DateTime.create()};this.set(a,this._activeGroup)},endUndoGroup:function(){var d=this.get("maxStackLength"),b=this.isUndoing?"redoStack":"undoStack";if(!this._activeGroup){return}this._activeGroup=null;this.notifyPropertyChange(b);if(d>0){var a=this[b],c=1;while(a=a.prev){c++;if(c>=d){a.prev=null}}}},setActionName:function(a){if(!this._activeGroup){return}this._activeGroup.name=a},_activeGroup:null,undoStack:null,redoStack:null,_undoOrRedo:function(b,f){if(this._activeGroup){this.endUndoGroup()}this.set(f,true);var h=this.get(b);if(h){this.set(b,h.prev);this.beginUndoGroup(h.name);var a=h.actions.length,g,e,d,c;for(c=a-1;c>=0;c--){g=h.targets[c];e=h.actions[c];d=h.contexts[c];if(SC.typeOf(g)===SC.T_FUNCTION){e=g;g=null}if(SC.typeOf(g)===SC.T_STRING){g=SC.objectForPropertyPath(g)}if(g&&SC.typeOf(e)===SC.T_STRING&&SC.typeOf(g[e])===SC.T_FUNCTION){e=g[e]}if(SC.typeOf(e)===SC.T_FUNCTION){e.call(g,d)}}this.endUndoGroup()}this.set(f,false)},destroy:function(){this._activeGroup=null;this.set("undoStack",null);this.set("redoStack",null);return arguments.callee.base.apply(this,arguments)},registerUndo:function(b,a){this.registerUndoAction(null,b,null,a)}});SC.UserDefaults=SC.Object.extend({ready:NO,userDomain:null,appDomain:null,_defaults:null,_safari3DB:null,defaults:function(a){this._defaults=a;this.allPropertiesDidChange()},readDefault:function(i){var a,d,b,j,h,k,g;i=this._normalizeKeyName(i);b=this._userKeyName(i);if(this._written){d=this._written[b]}a=SC.browser.isIE&&SC.browser.compare(SC.browser.version,"7")===0;if(a){j=document.body;try{j.load("SC.UserDefaults")}catch(c){SC.Logger.error("Couldn't load userDefaults in IE7: "+c.description)}}else{if(this.HTML5DB_noLocalStorage){g=this._safari3DB}else{j=window.localStorage;if(!j&&window.globalStorage){j=window.globalStorage[window.location.hostname]}}}if(j||g){h=["SC.UserDefaults",b].join("-at-");if(a){d=j.getAttribute(h.replace(/\W/gi,""))}else{if(g){d=this.dataHash[h]}else{d=j[h]}}if(!SC.none(d)){try{d=SC.json.decode(d)}catch(f){}}}k=this.delegate;if(k&&k.userDefaultsNeedsDefault){d=k.userDefaultsNeedsDefault(this,i,b)}if(SC.none(d)&&this._defaults){d=this._defaults[b]||this._defaults[i]}return d},writeDefault:function(k,i){var b,f,c,l,j,m,h;k=this._normalizeKeyName(k);f=this._userKeyName(k);c=this._written;if(!c){c=this._written={}}c[f]=i;b=SC.browser.isIE&&SC.browser.compare(SC.browser.version,"7")===0;if(b){l=document.body}else{if(this.HTML5DB_noLocalStorage){h=this._safari3DB}else{l=window.localStorage;if(!l&&window.globalStorage){l=window.globalStorage[window.location.hostname]}}}j=["SC.UserDefaults",f].join("-at-");if(l||h){var a=SC.json.encode(i);if(b){l.setAttribute(j.replace(/\W/gi,""),a);l.save("SC.UserDefaults")}else{if(h){var d=this;h.transaction(function(e){e.executeSql("delete from SCLocalStorage where key = ?",[j],function(){e.executeSql("insert into SCLocalStorage(key, value) VALUES ('"+j+"', '"+a+"');",[],d._nullDataHandler,d.killTransaction)})});this.dataHash[j]=a}else{try{l[j]=a}catch(g){SC.Logger.error("Failed using localStorage. "+g)}}}}m=this.delegate;if(m&&m.userDefaultsDidChange){m.userDefaultsDidChange(this,k,i,f)}return this},resetDefault:function(j){var b,a,f,c,k,i,h;b=this._normalizeKeyName(j);f=this._userKeyName(b);this.propertyWillChange(j);this.propertyWillChange(b);c=this._written;if(c){delete c[f]}a=SC.browser.isIE&&SC.browser.compare(SC.browser.version,"7")===0;if(a){k=document.body}else{if(this.HTML5DB_noLocalStorage){h=this._safari3DB}else{k=window.localStorage;if(!k&&window.globalStorage){k=window.globalStorage[window.location.hostname]}}}i=["SC.UserDefaults",f].join("-at-");if(k){if(a){k.setAttribute(i.replace(/\W/gi,""),null);k.save("SC.UserDefaults")}else{if(h){var d=this;h.transaction(function(e){e.executeSql("delete from SCLocalStorage where key = ?",[i],null)});delete this.dataHash[i]}else{try{delete k[i]}catch(g){SC.Logger.warn("Deleting local storage encountered a problem. "+g)}}}}this.propertyDidChange(j);this.propertyDidChange(b);return this},unknownProperty:function(a,b){if(b===undefined){return this.readDefault(a)}else{this.writeDefault(a,b);return b}},_normalizeKeyName:function(a){if(a.indexOf(":")<0){var b=this.get("appDomain")||"app";a=[b,a].join(":")}return a},_userKeyName:function(b){var a=this.get("userDomain")||"(anonymous)";return[a,b].join("-at-")},_domainDidChange:function(){var a=NO;if(this.get("userDomain")!==this._scud_userDomain){this._scud_userDomain=this.get("userDomain");a=YES}if(this.get("appDomain")!==this._scud_appDomain){this._scud_appDomain=this.get("appDomain");a=YES}if(a){this.allPropertiesDidChange()}}.observes("userDomain","appDomain"),init:function(){arguments.callee.base.apply(this,arguments);var a;jQuery.readyWait++;if(SC.userDefaults&&SC.userDefaults.get("dataHash")){var g=SC.userDefaults.get("dataHash");if(g){this.dataHash=SC.userDefaults.get("dataHash")}}this._scud_userDomain=this.get("userDomain");this._scud_appDomain=this.get("appDomain");a=SC.browser.isIE&&SC.browser.compare(SC.browser.version,"7")===0;if(a){document.body.addBehavior("#default#userData")}this.HTML5DB_noLocalStorage=SC.browser.isWebkit&&SC.browser.compare(SC.browser.engineVersion,"523")>0&&SC.browser.compare(SC.browser.engineVersion,"528")<0;if(this.HTML5DB_noLocalStorage){var b;try{if(!window.openDatabase){SC.Logger.error("Trying to load a database with safari version 3.1 to get SC.UserDefaults to work. You are either in a previous version or there is a problem with your browser.");return}else{var h="scdb",f="1.0",i="SproutCore database",j=65536;b=openDatabase(h,f,i,j)}}catch(d){SC.Logger.error("Trying to load a database with safari version 3.1 to get SC.UserDefaults to work. You are either in a previous version or there is a problem with your browser.");return}if(b){var c=this;b.transaction(function(e){e.executeSql("CREATE TABLE IF NOT EXISTS SCLocalStorage(key TEXT NOT NULL PRIMARY KEY, value TEXT NOT NULL);",[],c._nullDataHandler,c.killTransaction)});b.transaction(function(e){e.parent=c;e.executeSql("SELECT * from SCLocalStorage;",[],function(p,m){var n={},o;for(var l=0,k=m.rows.length;l<k;l++){o=m.rows.item(l);n[o.key]=o.value}p.parent.dataHash=n;SC.run(function(){jQuery.ready(true)})},c.killTransaction)});this._safari3DB=b}}else{jQuery.ready(true)}},_killTransaction:function(b,a){return true},_nullDataHandler:function(b,a){}});SC.userDefaults=SC.UserDefaults.create();SC.mixin({convertHsvToHex:function(d,c,a){var b=SC.Color.hsvToRgb(d,c,a);return SC.Color.create({r:b[0],g:b[1],b:b[2]}).toHex()},convertHexToHsv:function(b){var a=SC.Color.from(b);return a&&SC.Color.rgbToHsv(a.r,a.g,a.b)},PARSE_COLOR_RGBRE:/^rgb\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$/i,PARSE_COLOR_HEXRE:/^\#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/,expandColor:function(b){var c,e,d,a;c=this.parseColor(b);if(c){e=parseInt(c.slice(1,3),16);d=parseInt(c.slice(3,5),16);a=parseInt(c.slice(5,7),16);return[e,d,a]}},parseColor:function(d){var e=0,a="#",c,b;if(c=this.PARSE_COLOR_RGBRE.exec(d)){for(e=1;e<=3;e++){b=Math.max(0,Math.min(255,parseInt(c[e],0)));a+=this.toColorPart(b)}return a}if(c=this.PARSE_COLOR_HEXRE.exec(d)){if(c[1].length==3){for(e=0;e<3;e++){a+=c[1].charAt(e)+c[1].charAt(e)}return a}return"#"+c[1]}return false},toColorPart:function(a){if(a>255){a=255}var b=a.toString(16);if(a<16){return"0"+b}return b}});SC.mixin({_downloadFrames:0,download:function(d){var a=document.createElement("iframe"),c="DownloadFrame_"+this._downloadFrames;SC.$(a).attr("id",c);a.style.border="10px";a.style.width="0px";a.style.height="0px";a.style.position="absolute";a.style.top="-10000px";a.style.left="-10000px";if(!SC.browser.isSafari){SC.$(a).attr("src",d)}document.getElementsByTagName("body")[0].appendChild(a);if(SC.browser.isSafari){SC.$(a).attr("src",d)}this._downloadFrames=this._downloadFrames+1;if(!SC.browser.isSafari){var b=function(){document.body.removeChild(document.getElementById(c));c=null};b.invokeLater(null,2000)}a=null},getStyle:function(a,b){var c="";if(document.defaultView&&document.defaultView.getComputedStyle){c=document.defaultView.getComputedStyle(a,"").getPropertyValue(b)}else{if(a.currentStyle){b=b.replace(/\-(\w)/g,function(d,e){return e.toUpperCase()});c=a.currentStyle[b]}}return c},uniJapaneseConvert:function(e){var a,c="",b,d;for(b=0,d=e.length;b<d;b++){a=e.charCodeAt(b);a=((a>=65281&&a<=65392)?a-65248:a);a=(a===12540?45:a);c=c+String.fromCharCode(a)}return c},pointInElement:function(b,g,c,f){var h,d,a,e;g=jQuery(g);c=c||"border";h=SC.offset(g,f);if(c==="padding"){d=g.innerWidth();a=g.innerHeight();h.x+=window.parseInt(g.css("border-left-width").replace("px",""));h.y+=window.parseInt(g.css("border-top-width").replace("px",""))}else{d=g.outerWidth(c==="margin");a=g.outerHeight(c==="margin");if(c==="margin"){h.x-=window.parseInt(g.css("margin-left").replace("px",""));h.y-=window.parseInt(g.css("margin-top").replace("px",""))}}e={x:h.x,y:h.y,width:d,height:a};return SC.pointInRect(b,e)},switchScale:function(){$("head meta[name=viewport]").remove();if(window.innerWidth===window.screen.width){$("head").prepend('<meta name="viewport" content="width=device-width, initial-scale=0.5, maximum-scale=0.5, minimum-scale=0.5, user-scalable=0" />')}else{$("head").prepend('<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=0" />')}}});SC.mixin({ZERO_RANGE:{start:0,length:0},RANGE_NOT_FOUND:{start:0,length:-1},valueInRange:function(b,a){return(b>=0)&&(b>=a.start)&&(b<(a.start+a.length))},minRange:function(a){return a.start},maxRange:function(a){return(a.length<0)?-1:(a.start+a.length)},unionRanges:function(c,b){if((c==null)||(c.length<0)){return b}if((b==null)||(b.length<0)){return c}var d=Math.min(c.start,b.start),a=Math.max(SC.maxRange(c),SC.maxRange(b));return{start:d,length:a-d}},intersectRanges:function(c,b){if((c==null)||(b==null)){return SC.RANGE_NOT_FOUND}if((c.length<0)||(b.length<0)){return SC.RANGE_NOT_FOUND}var d=Math.max(SC.minRange(c),SC.minRange(b)),a=Math.min(SC.maxRange(c),SC.maxRange(b));if(a<d){return SC.RANGE_NOT_FOUND}return{start:d,length:a-d}},subtractRanges:function(c,b){if((c==null)||(b==null)){return SC.RANGE_NOT_FOUND}if((c.length<0)||(b.length<0)){return SC.RANGE_NOT_FOUND}var a=Math.max(SC.minRange(c),SC.minRange(b)),d=Math.min(SC.maxRange(c),SC.maxRange(b));if(a<d){return SC.RANGE_NOT_FOUND}return{start:d,length:a-d}},cloneRange:function(a){return{start:a.start,length:a.length}},rangesEqual:function(b,a){if(b===a){return true}if(b==null){return a.length<0}if(a==null){return b.length<0}return(b.start==a.start)&&(b.length==a.length)}});SC.mixin({bestStringMetricsForMaxWidth:function(a,x,n,z,w){if(!x){SC.warn("When calling bestMetricsForWidth, the second argument, maxWidth, is required. There's no reason to call this without a maxWidth.");return undefined}x=Math.ceil(parseFloat(x));var A=arguments.callee,h=SC.typeOf(n||(n=""))!==SC.T_STRING,m=h?n.style.maxWidth:undefined,o=(!h||n.cacheableForMetrics)?SC.cacheSlotFor(n,z,w,a):undefined,r=h?(A._applyMaxToEl||(A._applyMaxToEl=function(l,i){l.style.maxWidth=i+"px";return l})):(A._applyMaxToStr||(A._applyMaxToStr=function(l,i){return l.replace(/max-width:[^;]*;/g,"")+" max-width:"+i+"px"})),u=h?(A._removeMaxFromEl||(A._removeMaxFromEl=function(i){i.style.maxWidth="none";return i})):(A._removeMaxFromStr||(A._removeMaxFromStr=function(i){return i.replace(/max-width:[^;]*;/g,"")+" max-width:none"})),p=false;if(o){o.list||(o.list=[{width:Infinity,height:0}]);for(var v=1,t=o.list.length,C,b,D;v<t&&!D;v++){C=o.list[v];b=o.list[v-1];if(!C||!C.width){continue}if(x>=C.width){if((b&&b.width)||(x<=C.maxWidth)){return C}D=C}}}var q=r(n,x),s=SC.metricsForString(a,q,z,w),y=s.height,d=o?o.parent.height||(o.parent.height=SC.metricsForString("W",q,z).height):SC.metricsForString("W",q,z).height,c=Math.round(y/d);if(p){c--;y=c*d}if(y>d){var g=p?Math.ceil(s.width*2.5):s.width,k=p?s.width:Math.floor(s.width/2.5),B,f=new Date()*1,j=0;while(g-k>1||(s.height>y&&!p)||(s.height<y&&p)){j++;B=(g+k)/2;q=r(q,B);s=SC.metricsForString(a,q,z,w);if(s.height>y){k=B}else{g=B}}s.width=Math.ceil(B);s.height=y;s.maxWidth=x;s.lineHeight=d;s.lines=c;s.searchPerformed=true;s.searchTime=new Date()*1-f;s.searchCount=j}else{if(p){s=SC.metricsForString(a,q=u(q),z,w)}s.maxWidth=x;s.lineHeight=d;s.lines=c;s.searchPerformed=false}s.browserCorrection=0;if(SC.browser.isIE){s.browserCorrection=1}if(SC.browser.isMozilla){s.browserCorrection=1}s.width=Math.min(x,s.width+s.browserCorrection);if(o){var e=o.list[c];if(e&&e.maxWidth<x){e.maxWidth=x}if(!e){e=o.list[c]=s}}if(h){q.style.maxWidth=m}D=p?D:s;return D},cacheSlotFor:function(){var e=arguments.callee.caller,f=e.cache||(e.cache={});if(!arguments[0]){return f}var b=(arguments[0] instanceof Array||arguments[0].callee)?arguments[0]:arguments,d=b.length,a,c;for(c=0;c<d;c++){if(typeof(a=b[c])==="object"){a=SC.guidFor(a)}f=f[a]||(f[a]={parent:f})}return f},cachedVersionOf:function(){var a=function(c){var b=function(){var d=SC.cacheSlotFor(arguments);return d.result||(d.result=arguments.callee.func.apply(this,arguments))};b.func=c;return b};return a(a)}()});SC.mixin(SC.View,{BOUNCE_ADJUST:{run:function(h,o,j){var l=o.bounces||2,e=o.bounciness||0.25,f=h.get("layout"),g=[],b=(l*2)+1,c,d;c=o.duration||0.4;c=c/b;for(d=0;d<b;d++){if(d%2){g[d]={value:SC.clone(j),duration:c,timing:"ease-out"}}else{if(d===b-1){g[d]={value:SC.clone(j),duration:c,timing:"ease-in-out"}}else{g[d]={value:SC.clone(j),duration:c,timing:"ease-in"}}}}for(var k in j){var a=j[k],n=Math.round((a-f[k])*e);for(d=0;d<l;d++){g[(d*2)+1].value[k]=a-n;n=Math.round(n*0.5)}}var m=function(){h.didTransitionAdjust()};h._animateFrames(g,m,o.delay||0)}}});SC.mixin(SC.View,{SMOOTH_ADJUST:{run:function(a,b,d){var c,e;a.animate(d,{delay:b.delay||0,duration:b.duration||0.4,timing:b.timing||"ease"},function(f){this.didTransitionAdjust()})}}});SC.mixin(SC.View,{SPRING_ADJUST:{run:function(j,o,k){var g=o.springs||4,h=o.springiness||0.25,e=j.get("layout"),f=[],b=g+1,c,d;c=o.duration||0.4;c=c/b;for(d=0;d<b;d++){if(d!==0){f[d]={value:SC.clone(k),duration:c,timing:"ease-in-out"}}else{f[d]={value:SC.clone(k),duration:c,timing:"ease-out"}}}for(var m in k){var a=k[m],l=Math.round((a-e[m])*h);for(d=0;d<g;d++){if(d%2){f[d].value[m]=a-l}else{f[d].value[m]=a+l}l=Math.round(l*0.5)}}var n=function(){j.didTransitionAdjust()};j._animateFrames(f,n,o.delay||0)}}});SC.mixin(SC.View,{BOUNCE_IN:{setup:function(a,b,f){var c=a.get("parentView"),h,g=a.get("borderFrame"),e,d;if(f){}else{if(c){h=c.get("borderFrame")}else{h=SC.RootResponder.responder.currentWindowSize}switch(b.direction){case"left":e=h.width;break;case"up":d=h.height;break;case"down":d=-g.height;break;default:e=-g.width}}a.adjust({centerX:null,centerY:null,bottom:null,left:e||g.x,right:null,top:d||g.y,height:g.height,width:g.width})},run:function(i,n,j,c){var e=i.get("layout"),d=n.bounciness||0.25,m,b,f,a,k,h,g;switch(n.direction){case"left":a=c.x;k={left:a};m=-(a-e.left)*d;h={left:a+m};g={left:a+(m*0.5)};break;case"up":a=c.y;k={top:a};m=-(a-e.top)*d;h={top:a+m};g={top:a+(m*0.5)};break;case"down":a=c.y;k={top:a};m=(e.top-a)*d;h={top:a+m};g={top:a+(m*0.5)};break;default:a=c.x;k={left:a};m=(e.left-a)*d;h={left:a+m};g={left:a+(m*0.5)}}b=n.duration||0.4;b=b*0.2;f=[{value:k,duration:b,timing:"ease-in"},{value:h,duration:b,timing:"ease-out"},{value:k,duration:b,timing:"ease-in"},{value:g,duration:b,timing:"ease-out"},{value:k,duration:b,timing:"ease-in-out"}];var l=function(o){if(!o.isCancelled){i.didTransitionIn()}};i._animateFrames(f,l,n.delay||0)}},BOUNCE_OUT:{setup:function(b,c){var g=b.get("borderFrame"),f=g.x,e=g.y,a=g.height,d=g.width;b.adjust({centerX:null,centerY:null,bottom:null,left:f,right:null,top:e,height:a,width:d})},run:function(j,q,k,e){var f=q.bounciness||0.25,o,p,c,d,a,i,h=j.get("layout"),g=j.get("borderFrame"),n=j.get("parentView"),m,b;if(n){m=n.get("borderFrame")}else{m=SC.RootResponder.responder.currentWindowSize}switch(q.direction){case"left":b={left:h.left};a={left:-g.width};o=(h.left+g.width)*f;p={left:h.left-(o*0.5)};c={left:h.left-o};break;case"up":b={top:h.top};a={top:-g.height};o=(h.top+g.height)*f;p={top:h.top-(o*0.5)};c={top:h.top-o};break;case"down":b={top:h.top};a={top:m.height};o=(m.height-h.top)*f;p={top:h.top+(o*0.5)};c={top:h.top+o};break;default:b={left:h.left};a={left:m.width};o=(m.width-h.left)*f;p={left:h.left+(o*0.5)};c={left:h.left+o}}d=q.duration||0.6;d=d*0.2;i=[{value:p,duration:d,timing:"ease-out"},{value:b,duration:d,timing:"ease-in"},{value:c,duration:d,timing:"ease-out"},{value:b,duration:d,timing:"ease-in-out"},{value:a,duration:d,timing:"ease-in"}];var l=function(r){if(!r.isCancelled){j.didTransitionOut()}};j._animateFrames(i,l,q.delay||0)}}});SC.mixin(SC.View,{FADE_IN:{layoutProperties:["opacity"],setup:function(a,b,c){a.adjust({opacity:c?a.get("layout").opacity||0:0})},run:function(b,c,d,a){b.animate("opacity",d.opacity||1,{delay:c.delay||0,duration:c.duration||0.4,timing:c.timing||"ease"},function(e){if(!e.isCancelled){this.didTransitionIn()}})}},FADE_OUT:{layoutProperties:["opacity"],run:function(a,b){a.animate("opacity",0,{delay:b.delay||0,duration:b.duration||0.4,timing:b.timing||"ease"},function(c){if(!c.isCancelled){this.didTransitionOut()}})}}});SC.mixin(SC.View,{POP_IN:{layoutProperties:["scale"],setup:function(a,b,c){a.adjust({scale:c?a.get("layout").scale||0:0})},run:function(g,j,h,d){var a,c,e,f=j.poppiness||0.2,b;b=h.scale||1;a=b*(f+1);c=j.duration||0.25;e=[{value:{scale:a},duration:c*0.6,timing:"ease-out"},{value:{scale:b},duration:c*0.4,timing:"ease-in-out"}];var i=function(k){if(!k.isCancelled){g.didTransitionIn()}};g._animateFrames(e,i,j.delay||0)}},POP_OUT:{layoutProperties:["scale"],run:function(a,b){var f,c,e,h=b.poppiness||0.15,d;d=a.get("layout").scale||1;f=d*(h+1);c=b.duration||0.2;e=[{value:{scale:f},duration:c*0.4,timing:"ease-out"},{value:{scale:0},duration:c*0.6,timing:"ease-in-out"}];var g=function(i){if(!i.isCancelled){a.didTransitionOut()}};a._animateFrames(e,g,b.delay||0)}}});SC.mixin(SC.View,{SCALE_IN:{layoutProperties:["scale"],setup:function(a,b,c){a.adjust({scale:c?a.get("layout").scale||0:0})},run:function(b,c,d,a){b.animate("scale",d.scale||1,{delay:c.delay||0,duration:c.duration||0.4,timing:c.timing||"ease"},function(e){if(!e.isCancelled){this.didTransitionIn()}})}},SCALE_OUT:{layoutProperties:["scale"],run:function(a,b){a.animate("scale",0,{delay:b.delay||0,duration:b.duration||0.4,timing:b.timing||"ease"},function(c){if(!c.isCancelled){this.didTransitionOut()}})}}});SC.mixin(SC.View,{SLIDE_IN:{layoutProperties:["top","bottom","left","right","height","width","centerX","centerY"],setup:function(a,b,f){var c=a.get("parentView"),h,g=a.get("borderFrame"),e,d;if(f){}else{if(c){h=c.get("borderFrame")}else{h=SC.RootResponder.responder.currentWindowSize}switch(b.direction){case"left":e=h.width;break;case"up":d=h.height;break;case"down":d=-g.height;break;default:e=-g.width}}a.adjust({centerX:null,centerY:null,bottom:null,left:e||g.x,right:null,top:d||g.y,height:g.height,width:g.width})},run:function(b,c,e,a){var d,f;if(c.direction==="up"||c.direction==="down"){d="top";f=a.y}else{d="left";f=a.x}b.animate(d,f,{delay:c.delay||0,duration:c.duration||0.4,timing:c.timing||"ease"},function(g){if(!g.isCancelled){this.didTransitionIn()}})}},SLIDE_OUT:{layoutProperties:["top","bottom","left","right","height","width","centerX","centerY"],setup:function(b,c){var g=b.get("borderFrame"),f=g.x,e=g.y,a=g.height,d=g.width;b.adjust({centerX:null,centerY:null,bottom:null,left:f,right:null,top:e,height:a,width:d})},run:function(c,i,d,a){var b=c.get("borderFrame"),h=c.get("parentView"),g,f,e;if(h){g=h.get("borderFrame")}else{g=SC.RootResponder.responder.currentWindowSize}switch(i.direction){case"left":f="left";e=-b.width;break;case"up":f="top";e=-b.height;break;case"down":f="top";e=g.height;break;default:f="left";e=g.width}c.animate(f,e,{delay:i.delay||0,duration:i.duration||0.4,timing:i.timing||"ease"},function(j){if(!j.isCancelled){this.didTransitionOut()}})}}});SC.mixin(SC.View,{SPRING_IN:{setup:function(a,b,f){var c=a.get("parentView"),h,g=a.get("borderFrame"),e,d;if(f){}else{if(c){h=c.get("borderFrame")}else{h=SC.RootResponder.responder.currentWindowSize}switch(b.direction){case"left":e=h.width;break;case"up":d=h.height;break;case"down":d=-g.height;break;default:e=-g.width}}a.adjust({centerX:null,centerY:null,bottom:null,left:e||g.x,right:null,top:d||g.y,height:g.height,width:g.width})},run:function(j,o,k,c){var g=j.get("layout"),i=o.springiness||0.25,m,b,h,a,f,e,d,l;switch(o.direction){case"left":a=c.x;l={left:a};m=(g.left-a)*i;f={left:a-m};e={left:a+(m*0.5)};d={left:a-(m*0.25)};break;case"up":a=c.y;l={top:a};m=(g.top-a)*i;f={top:a-m};e={top:a+(m*0.5)};d={top:a-(m*0.25)};break;case"down":a=c.y;l={top:a};m=(a-g.top)*i;f={top:a+m};e={top:a-(m*0.5)};d={top:a+(m*0.25)};break;default:a=c.x;l={left:a};m=(a-g.left)*i;f={left:a+m};e={left:a-(m*0.5)};d={left:a+(m*0.25)}}b=o.duration||0.4;b=b*0.25;h=[{value:f,duration:b,timing:"ease-out"},{value:e,duration:b,timing:"ease-in-out"},{value:d,duration:b,timing:"ease-in-out"},{value:l,duration:b,timing:"ease-in-out"}];var n=function(p){if(!p.isCancelled){j.didTransitionIn()}};j._animateFrames(h,n,o.delay||0)}},SPRING_OUT:{setup:function(b,c){var g=b.get("borderFrame"),f=g.x,e=g.y,a=g.height,d=g.width;b.adjust({centerX:null,centerY:null,bottom:null,left:f,right:null,top:e,height:a,width:d})},run:function(j,p,k,c){var i=p.springiness||0.25,b,a,h,g=j.get("layout"),f=j.get("borderFrame"),o=j.get("parentView"),n,l,e,d;if(o){n=o.get("borderFrame")}else{n=SC.RootResponder.responder.currentWindowSize}switch(p.direction){case"left":a={left:-f.width};l=(g.left+f.width)*i;e={left:g.left-(l*0.5)};d={left:g.left+l};break;case"up":a={top:-f.height};l=(g.top+f.height)*i;e={top:g.top-(l*0.5)};d={top:g.top+l};break;case"down":a={top:n.height};l=(n.height-g.top)*i;e={top:g.top+(l*0.5)};d={top:g.top-l};break;default:a={left:n.width};l=(n.width-g.left)*i;e={left:g.left+(l*0.5)};d={left:g.left-l}}b=p.duration||0.3;b=b*0.33;h=[{value:e,duration:b,timing:"ease-in-out"},{value:d,duration:b,timing:"ease-in-out"},{value:a,duration:b,timing:"ease-in"}];var m=function(q){if(!q.isCancelled){j.didTransitionOut()}};j._animateFrames(h,m,p.delay||0)}}});SC.ContainerView=SC.View.extend({classNames:["sc-container-view"],contentView:null,contentViewBindingDefault:SC.Binding.single(),isTransitioning:NO,nowShowing:null,renderDelegateName:"containerRenderDelegate",transitionSwap:null,transitionSwapOptions:null,init:function(){var a;arguments.callee.base.apply(this,arguments);if(this.get("nowShowing")){this.nowShowingDidChange()}else{a=this.get("contentView");if(a){this.set("nowShowing",a)}}this.addObserver("contentView",this,this._sc_contentViewDidChange);this._sc_contentViewDidChange()},_sc_cancelTransitions:function(){var b=this._contentStatecharts;if(b){for(var a=b.length-1;a>=0;a--){b[a].doExit(true)}}},clippingFrame:function(){var d=this._contentStatecharts,c=this.get("frame"),a=arguments.callee.base.apply(this,arguments);if(this.get("isTransitioning")){for(var b=d.length-1;b>=0;b--){a=d[b].transitionClippingFrame(a)}}else{a.width=c.width}return a}.property("parentView","frame").cacheable(),_sc_contentViewDidChange:function(){var a=this.get("contentView");if(a&&a.kindOf(SC.CoreView)){a=this.createChildView(a)}this.replaceContent(a)},destroy:function(){this.removeObserver("contentView",this,this._sc_contentViewDidChange);this._sc_cancelTransitions();this._contentStatecharts=this._currentStatechart=null;return arguments.callee.base.apply(this,arguments)},nowShowingDidChange:function(){var c=this.get("nowShowing");if(SC.typeOf(c)===SC.T_STRING&&c.length>0){var b=c.indexOf(".");if(b===-1){var a=this.get(c);c=SC.kindOf(a,SC.CoreView)?a:SC.objectForPropertyPath(c,this.get("page"))}else{if(b===0){c=this.getPath(c.slice(1))}else{c=SC.objectForPropertyPath(c)}}}if(c&&c.kindOf(SC.CoreView)){c=this.createChildView(c)}this.set("contentView",c)}.observes("nowShowing"),statechartReady:function(){var b=this._contentStatecharts;for(var a=b.length-2;a>=0;a--){b[a].doExit(true)}this.set("isTransitioning",NO)},statechartEnded:function(a){var b=this._contentStatecharts;b.removeObject(a);if(b.length===1){b[0].entered()}},replaceContent:function(b){var f,d=this._currentStatechart,a;this.set("isTransitioning",YES);f=this._contentStatecharts;if(!f){f=this._contentStatecharts=[]}for(var c=f.length-1;c>=0;c--){var e=f[c].doExit(false,b);if(e){a=f[c];a.set("previousStatechart",d);a.gotoEnteringState()}}if(!a){a=SC.ContainerContentStatechart.create({container:this,content:b,previousStatechart:d});f.pushObject(a)}this._currentStatechart=a},set:function(a,b){if(a==="transitionSwap"&&this.get("isTransitioning")){this._sc_cancelTransitions()}return arguments.callee.base.apply(this,arguments)}});SC.ContainerContentStatechart=SC.Object.extend({container:null,content:null,previousStatechart:null,state:"none",init:function(){arguments.callee.base.apply(this,arguments);this.gotoEnteringState()},transitionClippingFrame:function(d){var b=this.get("container"),c=b.get("transitionSwapOptions")||{},a=b.get("transitionSwap");if(a&&a.transitionClippingFrame){return a.transitionClippingFrame(b,d,c)}else{return d}},entered:function(){if(this.state==="entering"){this.gotoReadyState()}},doExit:function(b,a){if(this.state!=="exited"){this.gotoExitingState(b,a)}if(this.get("content")===a){return true}else{return false}},exited:function(){if(this.state==="exiting"){this.gotoExitedState()}},gotoEnteringState:function(){var b=this.get("container"),d=this.get("content"),e=this.get("previousStatechart"),c=b.get("transitionSwapOptions")||{},a=b.get("transitionSwap");if(this.state==="exiting"&&a.reverseBuildOut){a.reverseBuildOut(this,b,d,c);this.set("state","entering");return}else{if(d){b.appendChild(d)}}this.set("state","entering");if(e&&d&&a){if(a.willBuildInToView){a.willBuildInToView(b,d,e,c)}if(a.buildInToView){a.buildInToView(this,b,d,e,c)}else{this.entered()}}else{this.entered()}},gotoExitingState:function(c){var b=this.get("container"),f=this.get("content"),e=this._exitCount,d=b.get("transitionSwapOptions")||{},a=b.get("transitionSwap");if(this.state==="entering"&&a.reverseBuildIn){a.reverseBuildIn(this,b,f,d);this.set("state","exiting");return}this.set("state","exiting");if(!c&&f&&a){if(!e){e=this._exitCount=1}if(a.willBuildOutFromView){a.willBuildOutFromView(b,f,d,e)}if(a.buildOutFromView){a.buildOutFromView(this,b,f,d,e)}else{}this._exitCount+=1}else{this.exited()}},gotoExitedState:function(){var b=this.get("container"),d=this.get("content"),c=b.get("transitionSwapOptions")||{},a=b.get("transitionSwap");if(d){if(a&&a.didBuildOutFromView){a.didBuildOutFromView(b,d,c)}if(d.createdByParent){b.removeChildAndDestroy(d)}else{b.removeChild(d)}}b.statechartEnded(this);this._exitCount=0;this.set("state","exited")},gotoReadyState:function(){var b=this.get("container"),d=this.get("content"),c=b.get("transitionSwapOptions")||{},a=b.get("transitionSwap");if(d&&a&&a.didBuildInToView){a.didBuildInToView(b,d,c)}b.statechartReady();this.set("state","ready")}});sc_require("views/container");SC.mixin(SC.ContainerView,{DISSOLVE:{willBuildInToView:function(a,c,d,b){c.adjust({opacity:0})},buildInToView:function(b,a,d,e,c){d.animate("opacity",1,{duration:c.duration||0.4,timing:c.timing||"ease"},function(f){if(b.get("state")==="entering"){b.entered()}})},buildOutFromView:function(b,a,e,c,d){if(d==1){e.animate("opacity",0,{duration:c.duration||0.4,timing:c.timing||"ease"},function(f){if(!f.isCancelled){b.exited()}})}},didBuildOutFromView:function(a,c,b){c.adjust({opacity:1})}}});sc_require("views/container");SC.mixin(SC.ContainerView,{FADE_COLOR:{willBuildInToView:function(a,d,e,c){var b,f;d.adjust({opacity:0});b=SC.Color.from(c.color||"black");f=SC.View.create({layout:{opacity:0,zIndex:1},render:function(g){g.addStyle("background-color",b.get("cssText"))}});a.appendChild(f)},buildInToView:function(b,a,d,e,c){var f=a.get("childViews"),g;g=f.objectAt(f.get("length")-1);g.animate("opacity",1,{duration:c.duration*0.5||0.4,timing:c.timing||"ease-in"},function(){d.adjust("opacity",1);g.animate("opacity",0,{duration:c.duration*0.5||0.4,timing:c.timing||"ease-in"},function(h){a.removeChild(this);this.destroy();if(b.get("state")==="entering"){b.entered()}})})},buildOutFromView:function(b,a,e,c,d){}}});sc_require("views/container");SC.mixin(SC.ContainerView,{MOVE_IN:{willBuildInToView:function(a,f,e,i){var c=a.get("frame"),d,g,h,b;h=c.height;b=c.width;switch(i.direction){case"right":d=-b;break;case"up":g=h;break;case"down":g=-h;break;default:d=b}f.adjust({bottom:null,left:d||0,right:null,top:g||0,height:h,width:b})},buildInToView:function(b,a,e,g,c){var d,f;switch(c.direction){case"right":d="left";break;case"up":d="top";break;case"down":d="top";break;default:d="left"}e.animate(d,0,{duration:c.duration||0.4,timing:c.timing||"ease"},function(h){if(b.get("state")==="entering"){b.entered()}})},didBuildInToView:function(a,c,b){c.adjust({bottom:0,right:0,height:null,width:null})},didBuildOutFromView:function(a,c,b){c.adjust({bottom:0,right:0,height:null,width:null})},buildOutFromView:function(b,a,d,c){}}});sc_require("views/container");SC.mixin(SC.ContainerView,{PUSH:{willBuildInToView:function(a,h,g,l){var e=0,j=0,c=a.get("frame"),f=0,i=0,k,b;k=c.height;b=c.width;if(g&&g.get("content")){var d=g.getPath("content.liveAdjustments");e=d.left||0;j=d.top||0}switch(l.direction){case"right":f=-b+e;break;case"up":i=k+j;break;case"down":i=-k+j;break;default:f=b+e}h.adjust({bottom:null,right:null,left:f,top:i,height:k,width:b})},buildInToView:function(b,a,e,f,c){var d;switch(c.direction){case"up":d="top";break;case"down":d="top";break;default:d="left"}e.animate(d,0,{duration:c.duration||0.4,timing:c.timing||"ease"},function(g){if(b.get("state")==="entering"){b.entered()}})},didBuildInToView:function(a,c,b){c.adjust({bottom:0,right:0,height:null,width:null})},willBuildOutFromView:function(b,e,c){var f=b.get("frame"),a,d;a=f.height;d=f.width;e.adjust({bottom:null,right:null,height:a,width:d})},buildOutFromView:function(b,a,f,c,e){var h=a.get("frame"),d,g;switch(c.direction){case"right":d="left";g=h.width;break;case"up":d="top";g=-h.height;break;case"down":d="top";g=h.height;break;default:d="left";g=-h.width}f.animate(d,g*e,{duration:c.duration||0.4,timing:c.timing||"ease"},function(i){if(!i.isCancelled){b.exited()}})},didBuildOutFromView:function(a,c,b){c.adjust({bottom:0,right:0,height:null,width:null})},transitionClippingFrame:function(a,d,b){var c=a.get("frame");switch(b.direction){case"right":d.width=c.width*2;d.x=-c.width;break;case"up":d.height=c.height*2;d.y=-c.height;break;case"down":d.height=c.height*2;d.y=0;break;default:d.width=c.width*2;d.x=0}return d}}});sc_require("views/container");SC.mixin(SC.ContainerView,{REVEAL:{buildInToView:function(b,a,d,e,c){},didBuildInToView:function(a,c,b){c.adjust({bottom:0,right:0,height:null,width:null,zIndex:null})},willBuildOutFromView:function(b,f,c,d){var g=b.get("frame"),a,e;a=g.height;e=g.width;f.adjust({bottom:null,right:null,height:a,width:e,zIndex:d})},buildOutFromView:function(b,a,f,c,e){if(e===1){var h=a.get("frame"),d,g;switch(c.direction){case"right":d="left";g=-h.width;break;case"up":d="top";g=-h.height;break;case"down":d="top";g=h.height;break;default:d="left";g=h.width}f.animate(d,g,{duration:c.duration||0.4,timing:c.timing||"ease"},function(i){if(!i.isCancelled){b.exited()}})}},didBuildOutFromView:function(a,c,b){c.adjust({top:0,left:0,bottom:0,right:0,height:null,width:null,zIndex:null})}}});sc_require("system/string");SC.VALIDATE_OK=YES;SC.VALIDATE_NO_CHANGE=NO;SC.Validator=SC.Object.extend({fieldValueForObject:function(b,c,a){return b},objectForFieldValue:function(c,b,a){return c},validate:function(a,b){return true},validateError:function(a,b){return SC.$error(SC.String.loc("Invalid.General(%@)",b.get("fieldValue")),b.get("fieldKey"))},validateChange:function(b,c,a){return this.validate(b,c)?SC.VALIDATE_OK:this.validateError(b,c)},validateSubmit:function(a,b){return this.validate(a,b)?SC.VALIDATE_OK:this.validateError(a,b)},validatePartial:function(a,b){if(!b.get("isValid")){return this.validate(a,b)?SC.VALIDATE_OK:this.validateError(a,b)}else{return SC.VALIDATE_NO_CHANGE}},validateKeyDown:function(b,c,a){return true},attachTo:function(a,b){},detachFrom:function(a,b){}});SC.Validator.mixin({OK:true,NO_CHANGE:false,findFor:function(e,g,f){var c;if(!f){return}if(f instanceof SC.Validator){c=f}else{if(f.isClass){c=f.create()}else{if(SC.typeOf(f)===SC.T_STRING){var b=null;var a=f.match(/^(.+)\[(.*)\]/);if(a){f=a[1];b=a[2]}f=SC.String.classify(f);var d=SC.Validator[f];if(SC.none(d)){throw new Error("validator %@ not found for %@".fmt(f,g))}else{if(b){if(!e){throw new Error("named validator (%@) could not be found for field %@ because the field does not belong to a form".fmt(b,g))}if(!e._validatorHash){e._validatorHash={}}c=(b)?e._validatorHash[b]:null;if(!c){c=d.create()}if(b){e._validatorHash[b]=c}}else{c=d.create()}}}}}return c},fieldValueForObject:function(a,b,c){if(this.prototype&&this.prototype.fieldValueForObject){return this.prototype.fieldValueForObject(a,b,c)}else{return null}},objectForFieldValue:function(b,a,c){if(this.prototype&&this.prototype.objectForFieldValue){return this.prototype.objectForFieldValue(b,a,c)}else{return null}}});sc_require("validators/validator");SC.Validator.CreditCard=SC.Validator.extend({fieldValueForObject:function(a,b,c){if(typeof(a)=="string"&&a.length==16){a=[a.slice(0,4),a.slice(4,8),a.slice(8,12),a.slice(12,16)].join(" ")}return a},objectForFieldValue:function(b,a,c){return b.replace(/[\s-\.\:]/g,"")},validate:function(a,b){return this.checkNumber(b.get("fieldValue"))},validateError:function(b,c){var a=c.get("errorLabel")||"Field";return SC.$error(SC.String.loc("Invalid.CreditCard(%@)",a),a)},validateKeyDown:function(b,c,a){return !!a.match(/[0-9\- ]/)},checkNumber:function(h){if(!h||h.length===0){return YES}h=h.replace(/[^0-9]/g,"");var a="0123456789";var g=h.length;var f=parseInt(h,0);var l=h.toString();l=l.replace(/^\s+|\s+$/g,"");var k=0;var n=true;var b=false;var m;var d;for(var c=0;c<g;c++){m=""+l.substring(c,c+1);if(a.indexOf(m)=="-1"){n=false}}if(!n){b=false}if((g===0)&&(b)){b=false}else{if(g>=15){for(var e=g;e>0;e--){d=parseInt(f,0)%10;d=parseInt(d,0);k+=d;e--;f=f/10;d=parseInt(f,0)%10;d=d*2;switch(d){case 10:d=1;break;case 12:d=3;break;case 14:d=5;break;case 16:d=7;break;case 18:d=9;break;default:d=d}f=f/10;k+=d}if((k%10)===0){b=true}else{b=false}}}return b}});sc_require("validators/validator");SC.Validator.Date=SC.Validator.extend({format:"%b %d, %Y %i:%M:%S %p",fieldValueForObject:function(a,b,e){var d=this.get("format"),c;if(SC.typeOf(a)===SC.T_NUMBER){c=SC.DateTime.create(a)}else{if(a instanceof Date){c=a.getTime()}}if(c){a=c.toFormattedString(d)}return a},objectForFieldValue:function(c,a,e){var d=this.get("format"),b;if(c){b=SC.DateTime.parse(c,d);c=b?b._ms:null}return c}});sc_require("validators/validator");SC.Validator.DateTime=SC.Validator.extend({format:"%d/%m/%Y",fieldValueForObject:function(a,b,c){if(SC.kindOf(a,SC.DateTime)){a=a.toFormattedString(this.get("format"))}else{a=null}return a},objectForFieldValue:function(b,a,c){if(b){b=SC.DateTime.parse(b,this.get("format"))}return b}});sc_require("validators/validator");SC.Validator.Email=SC.Validator.extend({validate:function(a,b){return(b.get("fieldValue")||"").match(/.+@.+\...+/)},validateError:function(b,c){var a=c.get("errorLabel")||"Field";return SC.$error(SC.String.loc("Invalid.Email(%@)",a),a)}});SC.Validator.EmailOrEmpty=SC.Validator.Email.extend({validate:function(a,c){var b=c.get("fieldValue");return(b&&b.length>0)?b.match(/.+@.+\...+/):true}});sc_require("validators/validator");SC.Validator.NotEmpty=SC.Validator.extend({validate:function(a,c){var b=c.get("fieldValue");if(SC.none(b)){return NO}if(!SC.none(b.length)){return b.length>0}return YES},validateError:function(b,c){var a=c.get("errorLabel")||"Field";return SC.$error(SC.String.loc("Invalid.NotEmpty(%@)",SC.String.capitalize(a)),c.get("errorLabel"))}});sc_require("validators/validator");sc_require("system/utils/misc");SC.Validator.Number=SC.Validator.extend({places:0,fieldValueForObject:function(a,b,c){switch(SC.typeOf(a)){case SC.T_NUMBER:a=a.toFixed(this.get("places"));break;case SC.T_NULL:case SC.T_UNDEFINED:a="";break}return a},objectForFieldValue:function(c,b,d){var a;c=c.replace(/,/g,"");switch(SC.typeOf(c)){case SC.T_STRING:if(c.length===0){c=null}else{if(this.get("places")>0){c=parseFloat(c)}else{if(c.length===1&&c.match(/-/)){c=null}else{a=parseInt(c,0);if(isNaN(a)){c=SC.uniJapaneseConvert(c);c=parseInt(c,0);if(isNaN(c)){c=""}}else{c=a}}}}break;case SC.T_NULL:case SC.T_UNDEFINED:c=null;break}return c},validate:function(a,c){var b=c.get("fieldValue");return(b==="")||!(isNaN(b)||isNaN(parseFloat(b)))},validateError:function(b,c){var a=c.get("errorLabel")||"Field";return SC.$error(SC.String.loc("Invalid.Number(%@)",a),a)},validateKeyDown:function(b,c,a){if(!a){a=""}var d=c.$input().val();if(!d){d=""}d+=a;if(this.get("places")===0){if(a.length===0){return true}else{return d.match(/^[\-{0,1}]?[0-9,\0]*/)[0]===d}}else{if(a.length===0){return true}else{return d.match(/^[\-{0,1}]?[0-9,\0]*\.?[0-9\0]+/)===d}}}});sc_require("validators/validator");SC.Validator.Password=SC.Validator.extend({attachTo:function(a,b){arguments.callee.base.apply(this,arguments);if(!this.fields){this.fields=[]}this.fields.push(b)},validate:function(e){if(!this.fields||this.fields.length===0){return true}var d=false;var b=false;var a=true;var c=this.fields[0].get("fieldValue");this.fields.forEach(function(g){var f=g.get("fieldValue");if(f!=c){a=false}if(!f||f.length===0){d=true}if(f&&f.length>0){b=true}});if(e){return(b===false)?false:a}else{return(d===true)?true:a}},updateFields:function(c,b){if(!this.fields||this.fields.length===0){return true}var a=SC.String.loc("Invalid.Password");var d=this._field;this.fields.forEach(function(e){var g=(b)?null:((e==d)?a:"");c.setErrorFor(e,g)});return(b)?SC.VALIDATE_OK:a},validateChange:function(b,c,a){return this.updateFields(b,this.validate(false))},validateSubmit:function(a,b){return this.updateFields(a,this.validate(true))},validatePartial:function(b,c){var a=!this._field.get("isValid");if(a){return this.updateFields(b,this.validate(false))}else{return SC.VALIDATE_NO_CHANGE}}});sc_require("validators/validator");SC.Validator.PositiveInteger=SC.Validator.extend({defaultValue:null,fieldValueForObject:function(a,b,c){switch(SC.typeOf(a)){case SC.T_NUMBER:a=a.toFixed(0);break;case SC.T_NULL:case SC.T_UNDEFINED:a=this.get("defaultValue");break}return a},objectForFieldValue:function(b,a,c){b=b.replace(/,/g,"");switch(SC.typeOf(b)){case SC.T_STRING:if(b.length===0){b=this.get("defaultValue")}else{b=parseInt(b,0)}break;case SC.T_NULL:case SC.T_UNDEFINED:b=this.get("defaultValue");break}if(isNaN(b)){return this.get("defaultValue")}return b},validate:function(a,c){var b=c.get("fieldValue");return(b==="")||!isNaN(b)},validateError:function(b,c){var a=c.get("errorLabel")||"Field";return SC.$error(SC.String.loc("Invalid.Number(%@)",a),a)},validateKeyDown:function(b,c,a){var d=c.$input().val();if(!d){d=""}d+=a;if(a.length===0){return true}else{return d.match(/^[0-9\0]*/)[0]===d}}});sc_require("mixins/validatable");SC.FieldView=SC.View.extend(SC.Control,SC.Validatable,{fieldValue:function(){var a=this.get("value");if(SC.typeOf(a)===SC.T_ERROR){a=a.get("errorValue")}return this.fieldValueForObject(a)}.property("value","validator").cacheable(),$input:function(){var a=this._inputElementTagName();return this.$(a).andSelf().filter(a)},_inputElementTagName:function(){return"input"},setFieldValue:function(b){if(SC.none(b)){b=""}var a=this.$input();if(a.val()!==b){a.val(b)}return this},getFieldValue:function(){return this.$input().val()},_field_fieldValueDidChange:function(a){SC.run(function(){this.fieldValueDidChange(NO)},this)},fieldValueDidChange:function(a){var c=this.getFieldValue();var b=this.objectForFieldValue(c,a);this.setIfChanged("value",b)},_field_valueDidChange:function(){this.setFieldValue(this.get("fieldValue"))}.observes("fieldValue"),didCreateLayer:function(){this.setFieldValue(this.get("fieldValue"));this._addChangeEvent()},willDestroyLayer:function(){SC.Event.remove(this.$input(),"change",this,this._field_fieldValueDidChange)},mouseDown:function(a){this._field_isMouseDown=YES;a.allowDefault();return YES},mouseExited:function(a){if(this._field_isMouseDown){this.set("isActive",NO)}a.allowDefault();return YES},mouseEntered:function(a){this.set("isActive",this._field_isMouseDown);a.allowDefault();return YES},mouseUp:function(a){if(this._field_isMouseDown){this.set("isActive",NO)}this._field_isMouseDown=NO;a.allowDefault();return YES},keyDown:function(b){if(b.which===9||b.keyCode===9){var a=b.shiftKey?this.get("previousValidKeyView"):this.get("nextValidKeyView");if(a){a.becomeFirstResponder()}else{b.allowDefault()}return YES}if(this.performValidateKeyDown(b)){this._isKeyDown=YES;b.allowDefault()}else{b.stop()}return YES},acceptsFirstResponder:function(){if(SC.FOCUS_ALL_CONTROLS){return this.get("isEnabledInPane")}return NO}.property("isEnabledInPane"),_addChangeEvent:function(){SC.Event.add(this.$input(),"change",this,this._field_fieldValueDidChange)},_field_setFieldValue:function(b){this.propertyWillChange("fieldValue");if(this.fieldValueForObject){b=this.fieldValueForObject(b)}var a=this.setFieldValue(b);this.propertyDidChange("fieldValue");return a},_field_getFieldValue:function(){var a=this.getFieldValue();if(this.objectForFieldValue){a=this.objectForFieldValue(a)}return a}});SC.IMAGE_STATE_NONE="none";SC.IMAGE_STATE_LOADING="loading";SC.IMAGE_STATE_LOADED="loaded";SC.IMAGE_STATE_FAILED="failed";SC.IMAGE_TYPE_NONE="NONE";SC.IMAGE_TYPE_URL="URL";SC.IMAGE_TYPE_CSS_CLASS="CSS_CLASS";SC.BLANK_IMAGE_DATAURL="data:image/gif;base64,R0lGODlhAQABAJAAAP///wAAACH5BAUQAAAALAAAAAABAAEAAAICBAEAOw==";SC.BLANK_IMAGE_URL=SC.browser.isIE&&SC.browser.compare(SC.browser.version,"8")<=0?"/static/sproutcore/foundation/en/59d34ccce9224b8f2d5b5388a339517aa7ec0fc2/source/resources/blank.gif":SC.BLANK_IMAGE_DATAURL;SC.BLANK_IMAGE=new Image();SC.BLANK_IMAGE.src=SC.BLANK_IMAGE_URL;SC.BLANK_IMAGE.width=SC.BLANK_IMAGE.height=1;SC.ImageView=SC.View.extend(SC.Control,SC.InnerFrame,{classNames:"sc-image-view",displayProperties:["align","scale","value","displayToolTip"],renderDelegateName:function(){return(this.get("useCanvas")?"canvasImage":"image")+"RenderDelegate"}.property("useCanvas").cacheable(),tagName:function(){return this.get("useCanvas")?"canvas":"div"}.property("useCanvas").cacheable(),canLoadInBackground:NO,image:SC.BLANK_IMAGE,innerFrame:function(){var c=this.get("image"),b=c.width,a=c.height,d=this.get("frame");if(SC.none(d)){return{x:0,y:0,width:0,height:0}}return this.innerFrameForSize(b,a,d.width,d.height)}.property("align","image","scale","frame").cacheable(),localize:YES,status:SC.IMAGE_STATE_NONE,type:function(){var a=this.get("value");if(SC.ImageView.valueIsUrl(a)){return SC.IMAGE_TYPE_URL}else{if(!SC.none(a)){return SC.IMAGE_TYPE_CSS_CLASS}}return SC.IMAGE_TYPE_NONE}.property("value").cacheable(),useCanvas:function(){return SC.platform.supportsCanvas&&!this.get("useStaticLayout")}.property("useStaticLayout").cacheable(),useImageQueue:YES,value:null,valueBindingDefault:SC.Binding.oneWay(),viewDidResize:function(){arguments.callee.base.apply(this,arguments);if(this.get("useStaticLayout")){if(this._updatingOnce){this._updatingOnce=false}else{this._updatingOnce=true;this.updateLayerIfNeeded()}}else{this.updateLayerIfNeeded()}},init:function(){arguments.callee.base.apply(this,arguments);this._valueDidChange();if(this.get("useImageCache")!==undefined){this.set("useImageQueue",this.get("useImageCache"))}},didAppendToDocument:function(){if(this.get("useStaticLayout")){this.updateLayerIfNeeded()}},didCreateLayer:function(){if(this.get("useCanvas")){this.updateLayerIfNeeded()}},_valueDidChange:function(){var b=this.get("value"),a=this.get("type");this.set("image",SC.BLANK_IMAGE);if(a==SC.IMAGE_TYPE_URL){this.set("status",SC.IMAGE_STATE_LOADING);if(!this._loadImageUsingCache()){this._loadImage()}}}.observes("value"),_loadImageUsingCache:function(){var c=this.get("value"),b=this.get("type");if(b===SC.IMAGE_TYPE_URL&&this.get("useImageQueue")){var a=this.get("isVisibleInWindow")||this.get("canLoadInBackground");SC.imageQueue.loadImage(c,this,this._loadImageUsingCacheDidComplete,a);return YES}return NO},_loadImageUsingCacheDidComplete:function(a,c){var b=this.get("value");if(b===a){if(SC.ok(c)){this.didLoad(c)}else{this.didError(c)}}},_loadImage:function(){var d=this.get("value"),b=this.get("type"),c=this,f,a;if(b===SC.IMAGE_TYPE_URL){f=new Image();var e=function(){SC.run(function(){c._loadImageDidComplete(d,SC.$error("SC.Image.FailedError","Image",-101))})};var g=function(){SC.run(function(){c._loadImageDidComplete(d,f)})};a=$(f);a.bind("error",e);a.bind("abort",e);a.bind("load",g);f.src=d;return YES}return NO},_loadImageDidComplete:function(a,c){var b=this.get("value");if(b===a){if(SC.ok(c)){this.didLoad(c)}else{this.didError(c)}}},didLoad:function(a){this.set("status",SC.IMAGE_STATE_LOADED);if(!a){a=SC.BLANK_IMAGE}this.set("image",a);this.displayDidChange()},didError:function(a){this.set("status",SC.IMAGE_STATE_FAILED);this.set("image",SC.BLANK_IMAGE)}});SC.ImageView.valueIsUrl=function(a){return a&&SC.typeOf(a)===SC.T_STRING?a.indexOf("/")>=0:NO};sc_require("views/field");sc_require("system/text_selection");sc_require("mixins/editable");SC.AUTOCAPITALIZE_NONE="none";SC.AUTOCAPITALIZE_SENTENCES="sentences";SC.AUTOCAPITALIZE_WORDS="words";SC.AUTOCAPITALIZE_CHARACTERS="characters";SC.TextFieldView=SC.FieldView.extend(SC.Editable,{classNames:["sc-text-field-view"],isTextField:true,applyImmediately:true,commitOnBlur:true,isTextArea:false,focused:false,hint:"",type:"text",isBrowserFocusable:true,autoCorrect:true,autoCapitalize:SC.CAPITALIZE_SENTENCES,autoComplete:null,formattedHint:function(){var a=this.get("hint");a=typeof(a)==="string"&&this.get("localize")?SC.String.loc(a):a;if(this.get("useHintOverlay")){a=this.get("escapeHTML")?SC.RenderContext.escapeHTML(a):a}return a}.property("hint","localize").cacheable(),hintOnFocus:true,localize:true,isEditing:false,defaultTabbingEnabled:true,isContextMenuEnabled:true,allowsErrorAsValue:true,leftAccessoryView:null,rightAccessoryView:null,spellCheckEnabled:true,maxLength:5096,shouldRenderBorder:true,supportsAutoResize:true,autoResizeLayer:function(){return this.$input()[0]}.property("layer").cacheable(),autoResizeText:function(){return this.get("value")}.property("value").cacheable(),autoResizePadding:SC.propertyFromRenderDelegate("autoResizePadding",20),isEditable:true,selection:function(m,l){var d=this.$input()[0],j="none",f,a,c;if(l===undefined){if(d){a=null;c=null;if(!d.value){a=c=0}else{try{if(SC.platform.input.selectionStart){a=d.selectionStart}if(SC.platform.input.selectionEnd){c=d.selectionEnd}if(SC.platform.input.selectionDirection){j=d.selectionDirection}}catch(g){return null}if(a===null||c===null){var k=document.selection;if(k){var i=k.type;if(i&&(i==="None"||i==="Text")){f=k.createRange();if(!this.get("isTextArea")){var b=f.text.length;a=Math.abs(f.moveStart("character",0-(d.value.length+1)));c=a+b}else{var h=f.duplicate();h.moveToElementText(d);h.setEndPoint("EndToStart",f);a=h.text.length;c=a+f.text.length}}}}}return SC.TextSelection.create({start:a,end:c,direction:j})}else{return null}}else{if(!l||!l.kindOf||!l.kindOf(SC.TextSelection)){throw new Error("When setting the selection, you must specify an SC.TextSelection instance.")}if(d){if(d.setSelectionRange){try{d.setSelectionRange(l.get("start"),l.get("end"),l.get("direction"))}catch(g){return null}if(!SC.platform.input.selectionDirection){l.set("direction","none")}}else{f=d.createTextRange();a=l.get("start");f.move("character",a);f.moveEnd("character",l.get("end")-a);f.select()}}return l}}.property("fieldValue").cacheable(),useHintOverlay:function(){return this.get("hintOnFocus")||!SC.platform.input.placeholder}.property().cacheable(),displayProperties:["isBrowserFocusable","formattedHint","fieldValue","isEditing","isEditable","isEnabledInPane","leftAccessoryView","rightAccessoryView","isTextArea","maxLength"],createChildViews:function(){arguments.callee.base.apply(this,arguments);this.accessoryViewObserver()},acceptsFirstResponder:function(){return this.get("isEnabledInPane")}.property("isEnabledInPane"),accessoryViewObserver:function(){var a,c=["leftAccessoryView","rightAccessoryView"],f=c.length,d,g,b,j;for(d=0;d<f;d++){g=c[d];b=this["_"+g];j=this.get(g);if(!(b&&j&&(b===j))){if(b){a=b.get("classNames");a=a.without("sc-text-field-accessory-view");b.set("classNames",a);if(b.createdByParent){this.removeChildAndDestroy(b)}else{this.removeChild(b)}b=this["_"+g]=this["_created"+g]=null}if(j){j=this.createChildView(j);if(g==="rightAccessoryView"){var e=j.get("layout");j.adjust({left:null,right:e.right||0})}a=j.get("classNames");var h="sc-text-field-accessory-view";if(a.indexOf(h)<0){a=SC.clone(a);a.push(h);j.set("classNames",a)}this.appendChild(j);this["_"+g]=j}}}}.observes("leftAccessoryView","rightAccessoryView"),render:function(e,f){var a,d,c,b;a=this.get("fieldValue");if(SC.none(a)){a=""}a=String(a);e.setClass("not-empty",a.length>0);d=this._getAccessoryViewWidths();c=d.left;b=d.right;if(c){c+="px"}if(b){b+="px"}this._renderField(e,f,a,c,b)},_forceRenderFirstTime:false,_renderFieldLikeFirstTime:function(){this.set("_forceRenderFirstTime",true)}.observes("isTextArea"),_renderField:function(f,l,y,j,t){var u=this.get("formattedHint"),d="",k=this.get("maxLength"),w=this.get("isTextArea"),i=this.get("isEnabledInPane"),q=this.get("isEditable"),v=this.get("autoCorrect"),A=this.get("autoCapitalize"),D=this.get("autoComplete"),o=this.get("isBrowserFocusable"),C="",e="",c="",s="",n="",m="",B,z,g,p,h,a;f.setClass("text-area",w);a=SC.browser.isWebkit&&SC.browser.compare(SC.browser.engineVersion,"532")<0;f.setClass("oldWebKitFieldPadding",a);if(l||this._forceRenderFirstTime){this._forceRenderFirstTime=false;n=i?(q?"":' readonly="readonly"'):' disabled="disabled"';B=this.get("layerId");C=this.get("spellCheckEnabled")?' spellcheck="true"':' spellcheck="false"';if(!SC.none(v)){c=" autocorrect="+(!v?'"off"':'"on"')}if(!SC.none(A)){if(SC.typeOf(A)==="boolean"){e=" autocapitalize="+(!A?'"none"':'"sentences"')}else{e=" autocapitalize="+A}}if(!SC.none(D)){s=" autocomplete="+(!D?'"off"':'"on"')}if(!o){m=' tabindex="-1"'}if(this.get("shouldRenderBorder")){f.push('<div class="border"></div>')}z="";if(j||t){z='style="';if(j){z+="left:"+j+";"}if(t){z+="right:"+t+";"}z+='"'}f.push('<div class="padding" '+z+">");y=this.get("escapeHTML")?SC.RenderContext.escapeHTML(y):y;if(this.get("useHintOverlay")){var x='<div aria-hidden="true" class="hint '+(w?"":"ellipsis")+'%@">'+u+"</div>";f.push(x.fmt(y?" sc-hidden":""))}else{d=' placeholder="'+u+'"'}h="field";if(w){f.push('<textarea aria-label="'+u+'" class="'+h+'" aria-multiline="true"" name="'+B+'"'+n+d+C+c+e+m+' maxlength="'+k+'">'+y+"</textarea></div>")}else{g=this.get("type");f.push('<input aria-label="'+u+'" class="'+h+'" type="'+g+'" name="'+B+'"'+n+d+C+c+e+s+m+' maxlength="'+k+'" value="'+y+'"/></div>')}}else{var r=this.$input(),b=r[0];if(this.get("useHintOverlay")){f.$(".hint")[0].innerHTML=u}else{r.attr("placeholder",u)}r.attr("maxLength",k);if(SC.browser.name===SC.BROWSER.ie&&SC.browser.version<=8&&!w){r.css("line-height",this.get("frame").height+"px")}if(!SC.none(v)){r.attr("autocorrect",!v?"off":"on")}else{r.attr("autocorrect",null)}if(!SC.none(A)){if(SC.typeOf(A)==="boolean"){r.attr("autocapitalize",!A?"none":"sentences")}else{r.attr("autocapitalize",A)}}else{r.attr("autocapitalize",null)}if(!SC.none(D)){r.attr("autoComplete",!D?"off":"on")}else{r.attr("autoComplete",null)}if(o){r.removeAttr("tabindex")}else{r.attr("tabindex","-1")}if(!q){r.attr("readOnly",true)}else{r.attr("readOnly",null)}if(b){p=b.parentNode.style;if(j){if(p.left!==j){p.left=j}}else{p.left=null}if(t){if(p.right!==t){p.right=t}}else{p.right=null}}}},_getAccessoryViewWidths:function(){var c={},j=["left","right"],d=j.length,f,g,k,a,h,e,b;for(f=0;f<d;f++){g=j[f];k=this["_"+g+"AccessoryView"];if(k&&k.isObservable){b=k.get("frame");if(b){a=b.width;if(a){h=k.get("layout");if(h){e=h[g];a+=e}c[g]=a}}}}return c},didCreateLayer:function(){arguments.callee.base.apply(this,arguments);if(this.get("isTextArea")){this.invokeLast(this._addTextAreaEvents)}else{this._addTextAreaEvents();if(SC.browser.isMozilla){var a=this.$input();SC.Event.add(a,"keypress",this,this._firefox_dispatch_keypress)}}},didAppendToDocument:function(){this._fixupTextLayout()},_fixupTextLayout:function(){var a=this.get("frame").height;if(SC.browser.name===SC.BROWSER.ie&&SC.browser.version<=8&&!this.get("isTextArea")){this.$input().css("line-height",a+"px")}if(this.get("useHintOverlay")&&!this.get("isTextArea")){var b=this.$(".hint");b.css("line-height",b.outerHeight()+"px")}},_addTextAreaEvents:function(){var a=this.$input();SC.Event.add(a,"focus",this,this._textField_fieldDidFocus);SC.Event.add(a,"blur",this,this._textField_fieldDidBlur);SC.Event.add(a,"select",this,this._textField_selectionDidChange);SC.Event.add(a,"input",this,this._textField_inputDidChange)},willDestroyLayer:function(){arguments.callee.base.apply(this,arguments);var a=this.$input();SC.Event.remove(a,"focus",this,this._textField_fieldDidFocus);SC.Event.remove(a,"blur",this,this._textField_fieldDidBlur);SC.Event.remove(a,"select",this,this._textField_selectionDidChange);SC.Event.remove(a,"keypress",this,this._firefox_dispatch_keypress);SC.Event.remove(a,"input",this,this._textField_inputDidChange)},_textField_fieldDidFocus:function(a){SC.run(function(){this.set("focused",true);this.fieldDidFocus(a)},this)},_textField_fieldDidBlur:function(a){SC.run(function(){this.set("focused",false);this.fieldDidBlur(this._origEvent||a)},this)},fieldDidFocus:function(a){this.becomeFirstResponder();this.beginEditing(a);if(this._didHideInterceptForPane){this._didHideInterceptForPane.showTouchIntercept();this._didHideInterceptForPane=null}var b=this.get("pane");if(b&&b.get("hasTouchIntercept")){b.hideTouchIntercept();this._didHideInterceptForPane=this.get("pane")}},fieldDidBlur:function(a){this.resignFirstResponder(a);if(this.get("commitOnBlur")){this.commitEditing(a)}var b=this._didHideInterceptForPane;if(b){b.showTouchIntercept();b=null}},_field_fieldValueDidChange:function(a){if(this.get("focused")){SC.run(function(){this.fieldValueDidChange(false)},this)}this.updateHintOnFocus()},_textField_inputDidChange:function(){var a=SC.empty(this._fieldValueDidChangeTimer)||!this._fieldValueDidChangeTimer.get("isValid");if(this.get("applyImmediately")&&a){this.invokeLater(this.fieldValueDidChange,10)}},updateHintOnFocus:function(){if(!this.get("useHintOverlay")){return}if(this.getFieldValue()){this.$(".hint").addClass("sc-hidden")}else{this.$(".hint").removeClass("sc-hidden");this._fixupTextLayout()}}.observes("value"),_topOffsetForFirefoxCursorFix:3,_firefox_dispatch_keypress:function(a){var d=this.get("selection"),e=this.get("value"),c=e?e.length:0,b;if(!d||((d.get("length")===0&&(d.get("start")===0)||d.get("end")===c))){b=SC.RootResponder.responder;if(a.keyCode===9){return}b.keypress.call(b,a);a.stopPropagation()}},_textField_selectionDidChange:function(){this.notifyPropertyChange("selection")},didBecomeKeyResponderFrom:function(a){if(this.get("isVisibleInWindow")){var b=this.$input()[0];try{if(b){b.focus()}}catch(c){}if(!this._txtFieldMouseDown){this.invokeLast(this._selectRootElement)}}},_selectRootElement:function(){var b=this.$input()[0],a;if(b){a=SC.browser.os===SC.OS.mac&&SC.browser.compare(SC.browser.osVersion,"10.7")===0;if(!(SC.browser.name===SC.BROWSER.safari&&a&&SC.buildLocale==="ko-kr")){b.select()}}else{this._textField_selectionDidChange()}},didLoseKeyResponderTo:function(a){var b=this.$input()[0];if(b){b.blur()}this.invokeLater("scrollToOriginIfNeeded",100)},scrollToOriginIfNeeded:function(){var b=this.get("pane");if(!b){return}var a=b.get("firstResponder");if(!a||!a.get("isTextField")){document.body.scrollTop=document.body.scrollLeft=0}},keyDown:function(a){return this.interpretKeyEvents(a)||false},insertText:function(c,a){var f=a.which,d=a.keyCode,b=false;if(!SC.platform.input.maxlength&&this.get("isTextArea")){var e=this.get("value");if(e&&((!SC.browser.isMozilla&&f>47)||(SC.browser.isMozilla&&((f>32&&f<43)||f>47)&&!(d>36&&d<41)))&&(e.length>=this.get("maxLength"))){b=true}}if(this.performValidateKeyDown(a)&&!b){a.allowDefault()}else{a.stop()}if(this.get("applyImmediately")){this._fieldValueDidChangeTimer=this.invokeLater(this.fieldValueDidChange,10)}return true},insertTab:function(b){if(!this.get("defaultTabbingEnabled")){b.preventDefault();return false}var a=this.get("nextValidKeyView");if(a){a.becomeFirstResponder()}else{b.allowDefault()}return true},insertBacktab:function(b){if(!this.get("defaultTabbingEnabled")){b.preventDefault();return false}var a=this.get("previousValidKeyView");if(a){a.becomeFirstResponder()}else{b.allowDefault()}return true},insertNewline:function(a){if(this.get("isTextArea")||a.isIMEInput){a.allowDefault();return true}return false},deleteForward:function(a){a.allowDefault();return true},deleteBackward:function(a){a.allowDefault();return true},moveLeft:function(a){a.allowDefault();return true},moveRight:function(a){a.allowDefault();return true},selectAll:function(a){a.allowDefault();return true},moveUp:function(a){if(this.get("isTextArea")){a.allowDefault();return true}return false},moveDown:function(a){if(this.get("isTextArea")){a.allowDefault();return true}return false},keyUp:function(a){if(SC.browser.isMozilla&&a.keyCode===SC.Event.KEY_RETURN){this.fieldValueDidChange()}this.invokeNext(this._textField_selectionDidChange);a.allowDefault();return true},mouseDown:function(a){if(!this.get("isEnabledInPane")){a.stop();return true}else{this._txtFieldMouseDown=true;this.becomeFirstResponder();return arguments.callee.base.apply(this,arguments)}},mouseUp:function(a){this._txtFieldMouseDown=false;if(!this.get("isEnabledInPane")){a.stop();return true}this.invokeNext(this._textField_selectionDidChange);return arguments.callee.base.apply(this,arguments)},touchStart:function(a){return this.mouseDown(a)},touchEnd:function(a){return this.mouseUp(a)},mouseWheel:function(a){if(this.get("isTextArea")){a.allowDefault();return true}else{return false}},selectStart:function(a){return true},_inputElementTagName:function(){if(this.get("isTextArea")){return"textarea"}else{return"input"}},_valueObserver:function(){var b=this.get("value"),a;if(b&&b.length>0){a=this.get("maxLength");if(!SC.platform.input.maxlength&&b.length>a){this.set("value",b.substr(0,a))}}}.observes("value")});sc_require("views/text_field");sc_require("system/utils/misc");sc_require("delegates/inline_text_field");sc_require("mixins/inline_editor");SC.InlineTextFieldView=SC.TextFieldView.extend(SC.InlineEditor,{classNames:["inline-editor"],_topOffsetForFirefoxCursorFix:0,layout:{height:0,width:0},useAbsoluteLayout:YES,_updateViewStyle:function(b){var c="",a=SC.getStyle(b,"font-size");if(a&&a.length>0){c=c+"font-size: "+a+" !important; "}a=SC.getStyle(b,"font-family");if(a&&a.length>0){c=c+"font-family: "+a+" !important; "}a=SC.getStyle(b,"font-weight");if(a&&a.length>0){c=c+"font-weight: "+a+" !important; "}a=SC.getStyle(b,"z-index");if(a&&a.length>0){c=c+"z-index: "+a+" !important; "}a=SC.getStyle(b,"line-height");if(a&&a.length>0){c=c+"line-height: "+a+" !important; "}a=SC.getStyle(b,"text-align");if(a&&a.length>0){c=c+"text-align: "+a+" !important; "}a=SC.getStyle(b,"top-margin");if(a&&a.length>0){c=c+"top-margin: "+a+" !important; "}a=SC.getStyle(b,"bottom-margin");if(a&&a.length>0){c=c+"bottom-margin: "+a+" !important; "}a=SC.getStyle(b,"left-margin");if(a&&a.length>0){c=c+"left-margin: "+a+" !important; "}a=SC.getStyle(b,"right-margin");if(a&&a.length>0){c=c+"right-margin: "+a+" !important; "}return c},_updateViewPaddingStyle:function(b){var c="",a=SC.getStyle(b,"padding-top");if(a&&a.length>0){c=c+"top: "+a+" !important; "}a=SC.getStyle(b,"padding-bottom");if(a&&a.length>0){c=c+"bottom: "+a+" !important; "}a=SC.getStyle(b,"padding-left");if(a&&a.length>0){c=c+"left: "+a+" !important; "}a=SC.getStyle(b,"padding-right");if(a&&a.length>0){c=c+"right: "+a+" !important; "}return c},updateStyle:function(d){if(d.length){d=d[0]}var a=document.getElementById("sc-inline-text-field-style"),c=this._updateViewStyle(d),e=this._updateViewPaddingStyle(d),f=".inline-editor input{"+c+"}.inline-editor textarea{"+c+"}.inline-editor .padding{"+e+"}";if(!a){var b=document.getElementsByTagName("head")[0];a=document.createElement("style");a.type="text/css";a.media="screen";a.id="sc-inline-text-field-style";b.appendChild(a)}if(a.styleSheet){a.styleSheet.cssText=f}else{a.innerHTML=f}},positionOverTargetView:function(g,f,e,a,b){var d=g.get("layout"),c={};if(!SC.none(a)){f=a;e=b}if(f&&e){var h=SC.offset(e,"parent");c.top=d.top+h.y-f.height/2;c.left=d.left+h.x;c.height=f.height;c.width=f.width}else{c=SC.copy(d)}this.set("layout",c)},multiline:NO,isTextArea:function(){return this.get("multiline")}.property("multiline").cacheable(),beginEditing:function(b,a){if(!b(a)){return NO}var d=a.get("pane"),c=this.get("exampleElement");this.beginPropertyChanges();if(a.multiline){this.set("multiline",a.multiline)}if(c){if(c.length){c=c[0]}}else{c=a.$()[0]}this.updateStyle(c);this.positionOverTargetView(a,this.get("exampleFrame"),c);this._previousFirstResponder=d?d.get("firstResponder"):null;this.becomeFirstResponder();this.endPropertyChanges();return YES}.enhance(),blurEditor:function(a){if(this.get("isEditing")){return this.commitOnBlur?this.commitEditing():this.discardEditing()}else{return true}},_endEditing:function(b){var a=b();if(this.get("isFirstResponder")){var c=this.get("pane");if(c&&this._previousFirstResponder){c.makeFirstResponder(this._previousFirstResponder)}else{this.resignFirstResponder()}}this._previousFirstResponder=null;return a}.enhance(),mouseDown:function(a){arguments.callee.base.call(this,a);return this.get("isEditing")},touchStart:function(a){this.mouseDown(a)},_scitf_blurInput:function(){var a=this.$input()[0];if(a){a.blur()}a=null},willRemoveFromParent:function(){return this._scitf_blurInput()},willLoseFirstResponder:function(b,a){if(b!==this){return}this._previousFirstResponder=null;this._origEvent=a;this._scitf_blurInput();return this.blurEditor(a)},cancel:function(){this.discardEditing();return YES},insertNewline:function(a){if(this.get("isTextArea")){return arguments.callee.base.apply(this,arguments)}else{this.commitEditing();return YES}},insertTab:function(a){var c=this.target;this.resignFirstResponder();if(c){var b=c.get("nextValidKeyView");if(b&&b.beginEditing){b.beginEditing()}}return YES},insertBacktab:function(a){var c=this.target;this.resignFirstResponder();if(c){var b=c.get("previousValidKeyView");if(b&&b.beginEditing){b.beginEditing()}}return YES}});sc_require("mixins/inline_editable");sc_require("mixins/inline_editor_delegate");sc_require("delegates/inline_text_field");SC.LabelView=SC.View.extend(SC.Control,SC.InlineEditable,{classNames:["sc-label-view"],displayProperties:["displayTitle","displayHint","displayToolTip","icon"],inlineEditorDelegate:SC.InlineTextFieldDelegate,isEditable:NO,exampleEditor:SC.InlineTextFieldView,escapeHTML:true,localize:NO,localizeBindingDefault:SC.Binding.oneWay().bool(),needsEllipsis:false,formatter:null,value:"",hint:null,hintEnabled:function(){return this.get("isEditable")}.property("isEditable").cacheable(),icon:null,textAlign:null,supportsAutoResize:YES,autoResizeLayer:function(){return this.get("layer")}.property("layer").cacheable(),autoResizeText:function(){return this.get("displayTitle")}.property("displayTitle").cacheable(),autoResizePadding:SC.propertyFromRenderDelegate("autoResizePadding",{height:0,width:10}),renderDelegateName:"labelRenderDelegate",displayTitle:function(){var g,e;g=this.get("value");e=this.getDelegateProperty("formatter",this.displayDelegate);if(e){var f=(SC.typeOf(e)===SC.T_FUNCTION)?e(g,this):e.fieldValueForObject(g,this);if(!SC.none(f)){g=f}}if(SC.typeOf(g)===SC.T_ARRAY){var d=[];for(var b=0,c=g.get("length");b<c;b++){var a=g.objectAt(b);if(!SC.none(a)&&a.toString){a=a.toString()}d.push(a)}g=d.join(",")}if(!SC.none(g)&&g.toString){g=g.toString()}if(g&&this.getDelegateProperty("localize",this.displayDelegate)){g=SC.String.loc(g)}return g}.property("value","localize","formatter").cacheable(),displayHint:function(){var b=this.get("hint"),a=this.get("isEditable");if(a){if(b&&this.getDelegateProperty("localize",this.displayDelegate)){b=SC.String.loc(b)}}else{b=null}return b}.property("hint","localize","isEditable").cacheable(),hintValue:function(){var a=this.get("hint");return a}.property("hint").cacheable(),mouseDown:function(a){return this.get("isEditable")&&a.clickCount===2},doubleClick:function(a){return this.beginEditing()},inlineEditorDidBeginEditing:function(b,c,d,a){this._oldOpacity=this.get("layout").opacity||1;this.adjust("opacity",0);b(c,d,a)}.enhance(),inlineEditorDidEndEditing:function(){this.adjust("opacity",this._oldOpacity);this._oldOpacity=null}});SC.allowsBackspaceToPreviousPage=NO;SC.HORIZONTAL_ORIENTATION="horizontal";SC.VERTICAL_ORIENTATION="vertical";SC.CollectionGroup={classNames:["sc-collection-group"]};SC.CollectionRowDelegate={isCollectionRowDelegate:true,itemHeight:null,rowSize:function(b,c){var d=this.get("itemHeight"),a=24;if(!SC.none(d)){return d}if(!SC.none(c)){a=c}return a}.property("itemHeight").cacheable(),rowSpacing:0,rowPadding:0,rowHeight:function(c,d){var a=this.get("rowPadding"),b=this.get("rowSize");if(d!==undefined){this.set("rowSize",d-a*2);return d}return b+a*2}.property("rowSize","rowPadding"),_sc_totalRowSize:function(){return this.get("rowHeight")}.property("rowHeight"),customRowHeightIndexes:null,customRowSizeIndexes:function(c,d){var a=this.get("customRowHeightIndexes"),b=null;if(!SC.none(a)){return a}if(!SC.none(d)){b=d}return b}.property("customRowHeightIndexes").cacheable(),contentIndexRowHeight:function(a,b,c){return this.get("_sc_totalRowSize")},contentIndexRowSize:function(a,b,c){return this.contentIndexRowHeight(a,b,c)}};SC.CollectionViewDelegate={isCollectionViewDelegate:YES,collectionViewSelectionForProposedSelection:function(a,b){return b},collectionViewShouldSelectIndexes:function(a,b,c){return b},collectionViewShouldDeselectIndexes:function(a,b){return b},collectionViewShouldDeleteIndexes:function(a,b){return b},collectionViewDeleteContent:function(a,c,b){if(!c){return NO}if(SC.typeOf(c.destroyAt)===SC.T_FUNCTION){c.destroyAt(b);a.selectPreviousItem(NO,1);return YES}else{if(SC.typeOf(c.removeAt)===SC.T_FUNCTION){c.removeAt(b);a.selectPreviousItem(NO,1);return YES}else{return NO}}},collectionViewShouldBeginDrag:function(a){return YES},collectionViewDragDataTypes:function(a){return[]},collectionViewDragDataForType:function(a,c,b){return null},collectionViewComputeDragOperations:function(a,b,c){return c},collectionViewValidateDragOperation:function(b,d,e,c,a){return(a&SC.DROP_ON)?SC.DRAG_NONE:e},collectionViewPerformDragOperation:function(b,d,e,c,a){return SC.DRAG_NONE},collectionViewDragViewFor:function(a,b){return null},ghostActsLikeCursor:NO};SC.NavigationBuilder={isNavigationBuilder:YES,navigationTransitions:NO,initMixin:function(){var b=SC.Animatable;if(b&&!this.isAnimatable){this.mixin(b)}else{if(!b){SC.Logger.error("SC.NavigationView and SC.NavigationBuilder require SC.Animatable to perform animations, but it is not present. Please ensure your app or framework references it.")}}var a=this.get("navigationTransitions");if(!a&&SC.Animatable){a={left:{duration:0.25,timing:SC.Animatable.TRANSITION_EASE_IN_OUT,action:"navigationBuildDidFinish"},transform:{duration:0.25,timing:SC.Animatable.TRANSITION_EASE_IN_OUT,action:"navigationBuildDidFinish"}}}if(SC.Animatable){SC.mixin(this.transitions,a)}},metrics:function(){var a=this.computeFrameWithParentFrame();return a},transform:function(a){if(SC.platform.supportsCSS3DTransforms){this.adjust("transform","translate3d("+a+"px,0px,0px)")}else{this.adjust("transform","translate("+a+"px,0px)")}},buildInNavigation:function(){var a=this.metrics();this.disableAnimation();this.transform(this.get("buildDirection")===SC.TO_LEFT?a.width:-a.width);this.enableAnimation();this.invokeLater("transform",10,0)},buildOutNavigation:function(){var a=this.metrics();this.transform(this.get("buildDirection")===SC.TO_LEFT?-a.width:a.width)},buildIn:function(){this.buildInNavigation()},buildOut:function(){this.buildOutNavigation()},resetBuild:function(){this.transform(0)},navigationBuildDidFinish:function(){if(this.isBuildingIn){this.buildInDidFinish()}else{if(this.isBuildingOut){this.buildOutDidFinish()}}}};SC.NeedsSplitParent={splitView:function(){var a=this.get("parentView");while(a&&!a.isSplitView){a=a.get("parentView")}return a}.property("parentView").cacheable(),splitViewLayoutDirection:null,splitViewLayoutDirectionBinding:SC.Binding.oneWay("*splitView.layoutDirection")};SC.SplitChild={isSplitDivider:NO,minimumSize:100,maximumSize:undefined,size:undefined,position:0,positionOffset:SC.propertyFromRenderDelegate("splitPositionOffset",0),sizeOffset:SC.propertyFromRenderDelegate("splitSizeOffset",0),canCollapse:NO,collapseAtSize:undefined,autoResizeStyle:undefined,compensatesForMovement:YES,allowsIndirectAdjustments:YES,initMixin:function(){if(!this.splitView){this.mixin(SC.NeedsSplitParent)}},_scsvc_positionOrSizeDidChange:function(){this.invokeOnce("splitChildLayoutDidChange")}.observes("position","size"),splitChildLayoutDidChange:function(){var c=this.get("splitView");if(!c){return}var a=this.get("position")+this.get("positionOffset"),b=this.get("size")+this.get("sizeOffset");if(c.get("layoutDirection")===SC.LAYOUT_HORIZONTAL){this.set("layout",{left:a,width:b,top:0,bottom:0})}else{this.set("layout",{top:a,height:b,right:0,left:0})}},splitViewLayoutDirectionDidChange:function(){this.invokeOnce("splitChildLayoutDidChange")}.observes("splitViewLayoutDirection")};SC.MOVES_AUTOMATIC_CHILD="moves-automatic-child";SC.MOVES_CHILD="moves-child";SC.MOVES_PREVIOUS_CHILD="moves-previous-child";SC.MOVES_NEXT_CHILD="moves-next-child";SC.SplitThumb={movesChild:function(){var a=this,d,c=this.get("splitView"),b=this.get("movesSibling");while(a&&a!==c){d=a;a=a.get("parentView")}if(b===SC.MOVES_NEXT_CHILD){return d.nextView}if(b===SC.MOVES_PREVIOUS_CHILD){return d.previousView}if(b===SC.MOVES_AUTOMATIC_CHILD){if(!d.nextView){return d.previousView}if(!d.previousView){return d.nextView}}return d}.property("splitView","movesSibling").cacheable(),movesSibling:SC.MOVES_AUTOMATIC_CHILD,splitCursorStyle:function(){if(this.get("splitViewLayoutDirection")===SC.LAYOUT_HORIZONTAL){return"ew-resize"}else{return"ns-resize"}}.property("splitViewLayoutDirection").cacheable(),splitCursorStyleDidChange:function(){if(this._isDragging){this.get("splitView").set("splitChildCursorStyle",this.get("splitCursorStyle"))}this.$().css("cursor",this.get("splitCursorStyle"))}.observes("splitCursorStyle"),initMixin:function(){if(!this.splitView){this.mixin(SC.NeedsSplitParent)}},renderMixin:function(a){a.setStyle("cursor",this.get("splitCursorStyle"))},touchStart:function(b){this._isDragging=YES;var a=this.get("splitView");a.beginLiveResize();this._scst_mouseStartPosition=a.get("layoutDirection")===SC.LAYOUT_HORIZONTAL?b.pageX:b.pageY;this._scst_childStartPosition=a.getPositionForChild(this.get("movesChild"));return YES},touchesDragged:function(a){var b=this.get("splitView");var e=b.get("layoutDirection")===SC.LAYOUT_HORIZONTAL?a.pageX:a.pageY;var c=e-this._scst_mouseStartPosition,d=this._scst_childStartPosition;b.adjustPositionForChild(this.get("movesChild"),d+c);return YES},touchEnd:function(e){this._isDragging=NO;var a=this.get("splitView");var d=a.get("layoutDirection")===SC.LAYOUT_HORIZONTAL?e.pageX:e.pageY;var b=d-this._scst_mouseStartPosition,c=this._scst_childStartPosition;a.adjustPositionForChild(this.get("movesChild"),c+b);a.set("splitChildCursorStyle",null);a.endLiveResize();return YES},mouseDown:function(a){var b=this.get("splitView");b.set("splitChildCursorStyle",this.get("splitCursorStyle"));return this.touchStart(a)},mouseDragged:function(a){return this.touchesDragged(a)},mouseUp:function(a){this.get("splitView").set("splitChildCursorStyle",null);return this.touchEnd(a)}};SC.ModalPane=SC.Pane.extend({classNames:"sc-modal",_openPaneCount:0,paneWillAppend:function(e){var d;this._openPaneCount++;if(!this.get("isVisibleInWindow")){this.append()}var c=SC.RootResponder.responder.panes;for(var b=0,a=c.length;b<a;b++){d=c[b];if(d!==e){this._hideShowTextfields(d,NO)}}return this},paneDidRemove:function(e){var d;this._openPaneCount--;var c=SC.RootResponder.responder.panes;for(var b=0,a=c.length;b<a;b++){d=c[b];if(d!==e){this._hideShowTextfields(d,YES)}}if(this._openPaneCount<=0){this._openPaneCount=0;if(this.get("isVisibleInWindow")){this.remove()}}},_hideShowTextfields:function(c,b){var a;for(a in SC.View.views){a=SC.View.views[a];if(a.get("isTextField")&&a!==c&&a.get("pane")===c){if(b){if(a._scmp_isBrowserFocusable!==undefined){b=a._scmp_isBrowserFocusable;delete a._scmp_isBrowserFocusable}}else{a._scmp_isBrowserFocusable=a.get("isBrowserFocusable")}a.set("isBrowserFocusable",b)}}},mouseDown:function(b){var a=this.get("owner");if(a&&a.modalPaneDidClick){a.modalPaneDidClick(b)}},touchStart:function(a){this.mouseDown(a)}});sc_require("panes/modal");SC.PanelPane=SC.Pane.extend({isPanelPane:YES,classNames:["sc-panel"],acceptsKeyPane:YES,ariaRole:"dialog",ariaLabel:null,ariaLabelledBy:null,ariaDescribedBy:null,isModal:YES,modalPane:SC.ModalPane.extend({classNames:"for-sc-panel"}),contentView:null,contentViewBindingDefault:SC.Binding.single(),replaceContent:function(a){this.removeAllChildren();if(a){this.appendChild(a)}},createChildViews:function(){var a=this.contentView;if(a){a=this.contentView=this.createChildView(a);this.childViews=[a]}},contentViewDidChange:function(){this.replaceContent(this.get("contentView"))}.observes("contentView"),renderDelegateName:"panelRenderDelegate",_modalPane:function(){var a=this.get("modalPane");if(a&&a.isClass){a=a.create({owner:this});this.set("modalPane",a)}return a},appendTo:function(a){var b;if(!this.get("isVisibleInWindow")&&this.get("isModal")&&(b=this._modalPane())){this._isShowingModal=YES;b.paneWillAppend(this)}return arguments.callee.base.apply(this,arguments)},remove:function(){var b,a=arguments.callee.base.apply(this,arguments);if(this._isShowingModal){this._isShowingModal=NO;if(b=this._modalPane()){b.paneDidRemove(this)}}return a},destroy:function(){var a=this.get("modalPane");if(a&&!a.isClass){a.destroy()}arguments.callee.base.apply(this,arguments)},_isModalDidChange:function(){var a,b=this.get("isModal");if(b){if(!this._isShowingModal&&(a=this._modalPane())){this._isShowingModal=YES;a.paneWillAppend(this)}}else{if(this._isShowingModal&&(a=this._modalPane())){this._isShowingModal=NO;a.paneDidRemove(this)}}}.observes("isModal"),didShowInDocument:function(){this.becomeKeyPane()},didAppendToDocument:function(){this.becomeKeyPane()},willRemoveFromDocument:function(){this.resignKeyPane()},willHideInDocument:function(){this.resignKeyPane()},displayProperties:["ariaLabel","ariaLabelledBy","ariaDescribedBy"]});SC.TOGGLE_BEHAVIOR="toggle";SC.PUSH_BEHAVIOR="push";SC.TOGGLE_ON_BEHAVIOR="on";SC.TOGGLE_OFF_BEHAVIOR="off";SC.HOLD_BEHAVIOR="hold";SC.ButtonView=SC.View.extend(SC.ActionSupport,SC.Control,{acceptsFirstResponder:function(){if(SC.FOCUS_ALL_CONTROLS){return this.get("isEnabledInPane")}return NO}.property("isEnabledInPane"),action:null,classNames:["sc-button-view"],escapeHTML:true,target:null,themeName:"square",value:null,toggleOnValue:YES,toggleOffValue:NO,localize:NO,localizeBindingDefault:SC.Binding.bool(),title:"",contentTitleKey:null,icon:null,contentIconKey:null,needsEllipsis:YES,displayTitle:function(){var a=this.get("title");return(a&&this.get("localize"))?SC.String.loc(a):(a||"")}.property("title","localize").cacheable(),keyEquivalent:null,buttonBehavior:SC.PUSH_BEHAVIOR,holdInterval:100,isDefault:NO,isDefaultBindingDefault:SC.Binding.oneWay().bool(),isCancel:NO,isCancelBindingDefault:SC.Binding.oneWay().bool(),supportFocusRing:NO,supportsAutoResize:YES,autoResizeLayer:function(){var a=this.invokeRenderDelegateMethod("getRenderedAutoResizeLayer",this.$());return a||this.get("layer")}.property("layer").cacheable(),autoResizeText:function(){return this.get("displayTitle")}.property("displayTitle").cacheable(),autoResizePadding:SC.propertyFromRenderDelegate("autoResizePadding",10),_labelMinWidthIE7:0,triggerActionAfterDelay:function(a){if(!this.get("isEnabledInPane")){return NO}this.set("isActive",YES);this.invokeLater("triggerAction",SC.ButtonView.TRIGGER_DELAY,a);return YES},triggerAction:function(a){this._action(a,YES);this.didTriggerAction();this.set("isActive",NO)},didTriggerAction:function(){},init:function(){arguments.callee.base.apply(this,arguments);var a=this.get("keyEquivalent");if(a){this._defaultKeyEquivalent=a}if(!SC.none(this.get("value"))){this._button_valueDidChange()}},ariaRole:"button",displayProperties:["icon","displayTitle","displayToolTip","supportFocusRing","buttonBehavior"],renderDelegateName:"buttonRenderDelegate",contentKeys:{contentValueKey:"value",contentTitleKey:"title",contentIconKey:"icon"},performKeyEquivalent:function(c,b){if(!this.get("isVisibleInWindow")){return NO}if(!this.get("isEnabledInPane")){return NO}var a=this.get("keyEquivalent");if(a){if(a===c){return this.triggerAction(b)}}else{if((this.get("isDefault")&&(c==="return"))||(this.get("isCancel")&&(c==="escape"))){return this.triggerAction(b)}}return NO},computeIsSelectedForValue:function(d){var b=this.get("toggleOnValue"),c,a;if(SC.typeOf(d)===SC.T_ARRAY){if(d.length===1){c=(d[0]==b)}else{c=null;d.find(function(e){a=(e==b);if(c===null){c=a}else{if(a!==c){c=SC.MIXED_STATE}}return c===SC.MIXED_STATE})}}else{if(d===SC.MIXED_STATE){c=SC.MIXED_STATE}else{c=(d===b)}}return c},_button_valueDidChange:function(){var b=this.get("value"),a=this.computeIsSelectedForValue(b);this.set("isSelected",a);this.displayDidChange()}.observes("value"),_button_isSelectedDidChange:function(){var c=this.get("isSelected"),b=this.computeIsSelectedForValue(this.get("value"));if((c!==SC.MIXED_STATE)&&(b!==c)){var a=(c)?"toggleOnValue":"toggleOffValue";this.set("value",this.get(a))}}.observes("isSelected"),_defaultKeyEquivalent:null,_isDefaultOrCancelDidChange:function(){var b=!!this.get("isDefault"),a=!b&&this.get("isCancel");if(b){this.set("keyEquivalent","return")}else{if(a){this.set("keyEquivalent","escape")}else{this.set("keyEquivalent",this._defaultKeyEquivalent)}}this.displayDidChange()}.observes("isDefault","isCancel"),mouseDown:function(a){if(a.which!==1){return false}var b=this.get("buttonBehavior");if(!this.get("isEnabledInPane")){return YES}this.set("isActive",YES);this._isMouseDown=YES;if(b===SC.HOLD_BEHAVIOR){this._action(a)}else{if(!this._isFocused&&(b!==SC.PUSH_BEHAVIOR)){this._isFocused=YES;this.becomeFirstResponder()}}return YES},mouseExited:function(a){if(this._isMouseDown){this.set("isActive",NO)}return YES},mouseEntered:function(a){if(this._isMouseDown){this.set("isActive",YES)}return YES},mouseUp:function(b){if(this._isMouseDown){this.set("isActive",NO)}this._isMouseDown=false;if(this.get("buttonBehavior")!==SC.HOLD_BEHAVIOR){var a=this.$().within(b.target);if(a&&this.get("isEnabledInPane")){this._action(b)}}return YES},touchStart:function(b){var a=this.get("buttonBehavior");if(!this.get("isEnabledInPane")){return YES}this.set("isActive",YES);if(a===SC.HOLD_BEHAVIOR){this._action(b)}else{if(!this._isFocused&&(a!==SC.PUSH_BEHAVIOR)){this._isFocused=YES;this.becomeFirstResponder()}}b.preventDefault();return YES},touchesDragged:function(a,b){if(!this.touchIsInBoundary(a)){if(!this._touch_exited){this.set("isActive",NO)}this._touch_exited=YES}else{if(this._touch_exited){this.set("isActive",YES)}this._touch_exited=NO}a.preventDefault();return YES},touchEnd:function(a){this._touch_exited=NO;this.set("isActive",NO);if(this.get("buttonBehavior")!==SC.HOLD_BEHAVIOR){if(this.touchIsInBoundary(a)&&this.get("isEnabledInPane")){this._action()}}a.preventDefault();return YES},keyDown:function(b){if(!this.get("isEnabledInPane")){return YES}if(b.which===9||b.keyCode===9){var a=b.shiftKey?this.get("previousValidKeyView"):this.get("nextValidKeyView");if(a){a.becomeFirstResponder()}else{b.allowDefault()}return YES}if(b.which===13||b.which===32){this.triggerActionAfterDelay(b);return YES}b.allowDefault();return NO},_action:function(a,c){switch(this.get("buttonBehavior")){case SC.TOGGLE_BEHAVIOR:var b=this.get("isSelected");if(b){this.set("value",this.get("toggleOffValue"))}else{this.set("value",this.get("toggleOnValue"))}break;case SC.TOGGLE_ON_BEHAVIOR:this.set("value",this.get("toggleOnValue"));break;case SC.TOGGLE_OFF_BEHAVIOR:this.set("value",this.get("toggleOffValue"));break;case SC.HOLD_BEHAVIOR:this._runHoldAction(a,c);break;default:this._runAction(a)}},_runAction:function(a){var b=this.get("action");if(b){if(b&&(SC.typeOf(b)===SC.T_FUNCTION)){this.action(a)}else{this.fireAction()}}},_runHoldAction:function(a,b){if(this.get("isActive")){this._runAction();if(!b){SC.RunLoop.begin();this.invokeLater("_runHoldAction",this.get("holdInterval"),a);SC.RunLoop.end()}}},didBecomeKeyResponderFrom:function(a){if(!this._isFocused){this._isFocused=YES;this.becomeFirstResponder();if(this.get("isVisibleInWindow")){this.$().focus()}}},willLoseKeyResponderTo:function(a){if(this._isFocused){this._isFocused=NO}},didAppendToDocument:function(){if(SC.browser.isIE&&SC.browser.compare(SC.browser.version,"7")===0&&this.get("useStaticLayout")){var e=this.get("layout"),d=this.$(),a=0;if(d&&d[0]&&(a=d[0].clientWidth)&&a!==0&&this._labelMinWidthIE7===0){var c=this.$(".sc-button-label"),h=parseInt(c.css("paddingRight"),0),b=parseInt(c.css("paddingLeft"),0),g=parseInt(c.css("marginRight"),0),f=parseInt(c.css("marginLeft"),0);if(g=="auto"){SC.Logger.log(g+","+f+","+h+","+b)}if(!h&&isNaN(h)){h=0}if(!b&&isNaN(b)){b=0}if(!g&&isNaN(g)){g=0}if(!f&&isNaN(f)){f=0}this._labelMinWidthIE7=a-(h+b)-(g+f);c.css("minWidth",this._labelMinWidthIE7+"px")}else{this.invokeLater(this.didAppendToDocument,1)}}}});SC.ButtonView.TRIGGER_DELAY=200;SC.ButtonView.CLICK_AND_HOLD_DELAY=SC.browser.isIE?600:300;SC.REGULAR_BUTTON_HEIGHT=24;sc_require("panes/panel");sc_require("views/button");SC.BUTTON1_STATUS="button1";SC.BUTTON2_STATUS="button2";SC.BUTTON3_STATUS="button3";SC.AlertPane=SC.PanelPane.extend({classNames:["sc-alert"],ariaRole:"alertdialog",delegate:null,icon:"sc-icon-alert-48",message:"",ariaLabel:function(){return this.get("message")}.property("message").cacheable(),description:"",displayDescription:function(){var a=this.get("description");if(!a||a.length===0){return a}a=SC.RenderContext.escapeHTML(a);return'<p class="description">'+a.split("\n").join('</p><p class="description">')+"</p>"}.property("description").cacheable(),caption:"",displayCaption:function(){var a=this.get("caption");if(!a||a.length===0){return a}a=SC.RenderContext.escapeHTML(a);return'<p class="caption">'+a.split("\n").join('</p><p class="caption">')+"</p>"}.property("caption").cacheable(),button1:SC.outlet("contentView.childViews.1.childViews.1"),button2:SC.outlet("contentView.childViews.1.childViews.0"),button3:SC.outlet("contentView.childViews.2.childViews.0"),buttonThreeWrapper:SC.outlet("contentView.childViews.2"),layout:{top:0.3,centerX:0,width:500},contentView:SC.View.extend({useStaticLayout:YES,layout:{left:0,right:0,top:0,height:"auto"},childViews:[SC.View.extend({classNames:["info"],useStaticLayout:YES,render:function(a,c){var b=this.get("pane");if(b.get("icon")=="blank"){a.addClass("plain")}a.push('<img src="'+SC.BLANK_IMAGE_URL+'" class="icon '+b.get("icon")+'" />');a.begin("h1").addClass("header").text(b.get("message")||"").end();a.push(b.get("displayDescription")||"");a.push(b.get("displayCaption")||"");a.push('<div class="separator"></div>')}}),SC.View.extend({layout:{bottom:13,height:24,right:18,width:466},childViews:["cancelButton","okButton"],classNames:["text-align-right"],cancelButton:SC.ButtonView.extend({useStaticLayout:YES,actionKey:SC.BUTTON2_STATUS,localize:YES,layout:{right:5,height:"auto",width:"auto",bottom:0},isCancel:YES,action:"dismiss",isVisible:NO}),okButton:SC.ButtonView.extend({useStaticLayout:YES,actionKey:SC.BUTTON1_STATUS,localize:YES,layout:{left:0,height:"auto",width:"auto",bottom:0},isDefault:YES,action:"dismiss",isVisible:NO})}),SC.View.extend({layout:{bottom:13,height:24,left:18,width:150},childViews:[SC.ButtonView.extend({useStaticLayout:YES,actionKey:SC.BUTTON3_STATUS,localize:YES,layout:{left:0,height:"auto",width:"auto",bottom:0},action:"dismiss",isVisible:NO})]})]}),dismiss:function(b){var a=this.delegate,c,d,e;if(a&&a.alertPaneDidDismiss){a.alertPaneDidDismiss(this,b.get("actionKey"))}if(d=(b&&b.get("customAction"))){if(SC.typeOf(d)===SC.T_FUNCTION){d.call(d)}else{c=this.getPath("pane.rootResponder");if(c){e=b.get("customTarget");c.sendAction(d,e||a,this,this,null,this)}}}this.remove()},alertInfoDidChange:function(){var a=this.getPath("contentView.childViews.0");if(a){a.displayDidChange()}}.observes("icon","message","displayDescription","displayCaption")});SC.AlertPane.mixin({show:function(l){l=SC.AlertPane._argumentsCall.apply(this,arguments);var b=this.create(l),p,m=l.buttons,f,k,e,n,a,d,j,h,c,i,g,q;if(m){g=!!m.findProperty("isDefault");q=!!m.findProperty("isCancel");for(p=0;p<3;p++){f=m[p];if(!f){continue}k=b.get("button%@".fmt(p+1));e=f.layerId;n=f.title;localize=f.localize;a=f.toolTip;d=f.action;j=f.target;h=l.themeName||"capsule";c=g?!!f.isDefault:undefined;i=q?!!f.isCancel:undefined;k.set("title",n);if(localize===YES){k.set("localize",YES)}if(a){k.set("toolTip",a)}if(d){k.set("customAction",d)}if(j){k.set("customTarget",j)}if(e!==undefined){k.set("layerId",e)}if(c!==undefined){k.set("isDefault",c)}if(i!==undefined){k.set("isCancel",i)}k.set("isVisible",!!n);k.set("themeName",h)}}else{k=b.get("button1");k.set("title","OK");k.set("isVisible",YES)}var o=b.append();b.adjust("height",b.childViews[0].$().height());b.updateLayout();return o},warn:function(a){a=SC.AlertPane._argumentsCall.apply(this,arguments);a.icon="sc-icon-alert-48";return this.show(a)},info:function(a){a=SC.AlertPane._argumentsCall.apply(this,arguments);a.icon="sc-icon-info-48";return this.show(a)},error:function(a){a=SC.AlertPane._argumentsCall.apply(this,arguments);a.icon="sc-icon-error-48";return this.show(a)},plain:function(a){a=SC.AlertPane._argumentsCall.apply(this,arguments);a.icon="blank";return this.show(a)},_argumentsCall:function(b){var a=b;if(SC.typeOf(b)!==SC.T_HASH){var c=this._normalizeArguments(arguments);a={message:c[0],description:c[1],caption:c[2],delegate:c[7],icon:(c[6]||"sc-icon-alert-48"),themeName:"capsule"};if(SC.typeOf(c[3])===SC.T_STRING||SC.typeOf(c[4])===SC.T_STRING||SC.typeOf(c[5])===SC.T_STRING){a.buttons=[{title:c[3]},{title:c[4]},{title:c[5]}]}}return a},_normalizeArguments:function(b){b=SC.A(b);var a=b.length,c=b[a-1];if(SC.typeOf(c)!==SC.T_STRING){b[a-1]=null}else{c=null}b[7]=c;return b}});SC.DraggablePaneSupport={isDraggablePane:YES,isAnchored:NO,_drag_cachedMouseX:null,_drag_cachedMouseY:null,initMixin:function(){if(this.mouseDown){this.mouseDown=SC._enhance(this.mouseDown,function(c,a){var b=this._drag_mouseDown(a);return c(a)||b})}else{this.mouseDown=this._drag_mouseDown}if(this.mouseDragged){this.mouseDragged=SC._enhance(this.mouseDragged,function(c,a){var b=this._drag_mouseDragged(a);return c(a)||b})}else{this.mouseDragged=this._drag_mouseDragged}if(this.touchStart){this.touchStart=SC._enhance(this.touchStart,function(c,a){var b=this._drag_touchStart(a);return c(a)||b})}else{this.touchStart=this._drag_touchStart}if(this.touchesDragged){this.touchesDragged=SC._enhance(this.touchesDragged,function(c,a){var b=this._drag_touchesDragged(a);return c(a)||b})}else{this.touchesDragged=this._drag_touchesDragged}},_drag_targetHasSelectableText:function(a){var b=SC.RootResponder.responder.targetViewForEvent(a);return !!(b&&b.isTextSelectable)},_drag_shouldHandleDrag:function(a){return !this.get("isAnchored")&&!this._drag_targetHasSelectableText(a)},_drag_mouseDown:function(a){this._drag_cachedMouseX=a.pageX;this._drag_cachedMouseY=a.pageY;return this._drag_shouldHandleDrag(a)},_drag_mouseDragged:function(a){var c=this._drag_cachedMouseX-a.pageX,g=this._drag_cachedMouseY-a.pageY,f=this.get("frame"),e=SC.RootResponder.responder.computeWindowSize(),b=SC.clone(this.get("layout")),d={},h=function(i){return(i<1&&i>0)};this._drag_cachedMouseX=a.pageX;this._drag_cachedMouseY=a.pageY;if(!this._drag_shouldHandleDrag(a)){return NO}if(b.hasOwnProperty("left")){if(h(b.left)){b.left=f.x}d.left=b.left-c}if(b.hasOwnProperty("right")){if(h(b.right)){b.right=e.width-(f.x+f.width)}d.right=b.right+c}if(b.hasOwnProperty("centerX")){d.centerX=b.centerX-c}if(b.hasOwnProperty("top")){if(h(b.top)){b.top=f.y}d.top=b.top-g}if(b.hasOwnProperty("bottom")){if(h(b.bottom)){b.bottom=e.height-(f.y+f.height)}d.bottom=b.bottom+g}if(b.hasOwnProperty("centerY")){d.centerY=b.centerY-g}this.adjust(d);return YES},_drag_touchStart:function(a){return this._drag_mouseDown(a)},_drag_touchesDragged:function(a){return this._drag_mouseDragged(a)}};sc_require("panes/panel");SC.PalettePane=SC.PanelPane.extend(SC.DraggablePaneSupport,{classNames:["sc-palette"],isModal:NO,modalPane:SC.ModalPane});sc_require("panes/palette");SC.PICKER_MENU="menu";SC.PICKER_FIXED="fixed";SC.PICKER_POINTER="pointer";SC.PICKER_MENU_POINTER="menu-pointer";SC.PickerPane=SC.PalettePane.extend({classNames:["sc-picker"],isAnchored:YES,isModal:YES,_sc_pointerLayout:SC.POINTER_LAYOUT||["perfectRight","perfectLeft","perfectTop","perfectBottom"],pointerPos:"perfectRight",pointerPosX:0,pointerPosY:0,anchorElement:function(a,b){if(b===undefined){if(this._anchorView){return this._anchorView.get("layer")}else{return this._anchorHTMLElement}}else{if(b&&b.isCoreQuery){b=b[0]}if(!b){SC.throw("You must set 'anchorElement' to either a view or a DOM element")}this._removeScrollObservers();if(b.isView){this._setupScrollObservers(b);this._anchorView=b;this._anchorHTMLElement=null;return b.get("layer")}else{this._anchorView=null;this._anchorHTMLElement=b;return b}}}.property().cacheable(),anchorCached:null,preferType:null,preferMatrix:null,pointerOffset:null,extraRightOffset:function(){return this.get("windowPadding")}.property("windowPadding").cacheable(),removeTarget:null,removeAction:null,repositionOnWindowResize:YES,windowPadding:null,viewDidResize:function(){arguments.callee.base.apply(this,arguments);this.positionPane(true)},popup:function(c,b,d,a){this.beginPropertyChanges();this.setIfChanged("anchorElement",c);if(b){this.set("preferType",b)}if(d){this.set("preferMatrix",d)}if(a){this.set("pointerOffset",a)}this.endPropertyChanges();this.positionPane();this._hideOverflow();return this.append()},positionPane:function(a){var c=this.get("borderFrame"),i=this.get("preferType"),h=this.get("preferMatrix"),k,f,g,b,j;b=this.get("anchorCached");j=this.get("anchorElement");if(a&&b){g=b}else{if(j){g=this.computeAnchorRect(j);this.set("anchorCached",g)}}if(g){k=SC.cloneRect(g);switch(i){case SC.PICKER_MENU:case SC.PICKER_FIXED:if(!h||h.length!==3){this.set("preferMatrix",[1,4,3]);h=this.get("preferMatrix")}k.x+=((h[2]===0)?k.width:0)+h[0];k.y+=((h[2]===3)?k.height:0)+h[1];break;default:k.y+=k.height;break}g.halfWidth=parseInt(g.width*0.5,0);g.halfHeight=parseInt(g.height*0.5,0);c=SC.cloneRect(c);c.halfWidth=parseInt(c.width*0.5,0);c.halfHeight=parseInt(c.height*0.5,0);c=this.fitPositionToScreen(k,c,g);f={left:c.x,top:c.y};if(c.width!=null){f.width=c.width}if(c.height!=null){f.height=c.height}var l=this.get("transitionIn");if(l&&(l.layoutProperties.indexOf("scale")>=0||l.layoutProperties.indexOf("rotate")>=0)){var e,d;switch(i){case SC.PICKER_POINTER:case SC.PICKER_MENU_POINTER:switch(this.get("pointerPos")){case"perfectTop":e=(c.halfWidth+this.get("pointerPosX"))/c.width;d=1;break;case"perfectRight":e=0;d=(c.halfHeight+this.get("pointerPosY"))/c.height;break;case"perfectBottom":e=(c.halfWidth+this.get("pointerPosX"))/c.width;d=0;break;case"perfectLeft":e=1;d=(c.halfHeight+this.get("pointerPosY"))/c.height;break}break;case SC.PICKER_MENU:case SC.PICKER_FIXED:if(c.x>=g.x){e=0}else{e=1}if(c.y>=g.y){d=0}else{d=1}break}f.transformOriginX=e;f.transformOriginY=d}this.adjust(f)}else{this.adjust({centerX:0,centerY:0})}return this},computeAnchorRect:function(c){var e,b,d,a=SC.RootResponder.responder.computeWindowSize();if(c.getBoundingClientRect){e=c.getBoundingClientRect();b={x:e.left,y:e.top,width:e.width,height:e.height};if(b.width===undefined||b.height===undefined){d=SC.$(c);b.width=d.outerWidth();b.height=d.outerHeight()}}else{b=SC.offset(c);d=SC.$(c);b.width=d.outerWidth();b.height=d.outerHeight()}b.height=(a.height-b.y)<b.height?(a.height-b.y):b.height;if(!SC.browser.isIE&&window.scrollX>0||window.scrollY>0){b.x+=window.scrollX;b.y+=window.scrollY}else{if(SC.browser.isIE&&(document.documentElement.scrollTop>0||document.documentElement.scrollLeft>0)){b.x+=document.documentElement.scrollLeft;b.y+=document.documentElement.scrollTop}}return b},fitPositionToScreen:function(f,c,d){var h=SC.RootResponder.responder.computeWindowSize(),e={x:0,y:0,width:h.width,height:h.height};var b=SC.RootResponder.responder.mainPane;if(b){var a=b.layout.minWidth,i=b.layout.minHeight;if(a&&e.width<a){e.width=b.layout.minWidth}if(i&&e.height<i){e.height=b.layout.minHeight}}c.x=f.x;c.y=f.y;var g=this.get("preferType");if(g){switch(g){case SC.PICKER_MENU:c=this.fitPositionToScreenMenu(e,c,this.get("isSubMenu"));break;case SC.PICKER_MENU_POINTER:this.setupPointer(d);c=this.fitPositionToScreenMenuPointer(e,c,d);break;case SC.PICKER_POINTER:this.setupPointer(d);c=this.fitPositionToScreenPointer(e,c,d);break;case SC.PICKER_FIXED:break;default:break}}else{c=this.fitPositionToScreenDefault(e,c,d)}return c},fitPositionToScreenDefault:function(b,d,a){var c;if(SC.maxX(d)>b.width){c=Math.max(SC.maxX(a),d.width);d.x=Math.min(c,b.width)-d.width}if(SC.minX(d)<0){d.x=SC.minX(Math.max(a,0));if(SC.maxX(d)>b.width){d.x=Math.max(0,b.width-d.width)}}if(SC.maxY(d)>b.height){c=Math.max((a.y-d.height),0);if(c>b.height){d.y=Math.max(0,b.height-d.height)}else{d.y=c}}if(SC.minY(d)<0){c=Math.min(SC.maxY(a),(b.height-a.height));d.y=Math.max(c,0)}return d},fitPositionToScreenMenu:function(c,d,a){var b=this.get("windowPadding");if(a){d.x-=this.get("submenuOffsetX");d.y-=Math.floor(this.get("menuHeightPadding")/2)}if(d.x<b){d.x=b}if((d.x+d.width+b)>c.width){if(a){d.x=d.x-(d.width*2)}else{d.x=c.width-d.width-b}}if(d.y<b){d.y=b}if(d.y+d.height+b>c.height){d.y=Math.max(b,c.height-d.height-b)}if(d.y+d.height+b>c.height){d.height=c.height-(2*b)}return d},fitPositionToScreenMenuPointer:function(b,c,a){c=this.fitPositionToScreenPointer(b,c,a);if(c.height+c.y+35>=b.height){c.height=b.height-c.y-(SC.MenuPane.VERTICAL_OFFSET*2)}return c},fitPositionToScreenPointer:function(d,b,c){var l,e,m=this.get("preferMatrix"),f=this.get("pointerOffset"),j,k,a=this.get("windowPadding");j=[[c.x+c.width+f[0],c.y+c.halfHeight-b.halfHeight],[c.x-b.width+f[1],c.y+c.halfHeight-b.halfHeight],[c.x+c.halfWidth-b.halfWidth,c.y-b.height+f[2]],[c.x+c.halfWidth-b.halfWidth,c.y+c.height+f[3]]];k=[[c.x+c.width+b.width+f[0],c.y+c.halfHeight+b.halfHeight],[c.x+f[1],c.y+c.halfHeight+b.halfHeight],[c.x+c.halfWidth+b.halfWidth,c.y+f[2]],[c.x+c.halfWidth+b.halfWidth,c.y+c.height+b.height+f[3]]];for(var g=0,h=this._sc_pointerLayout.length;g<h;g++){l=m[g];e={top:j[l][1]-a,right:d.width-a-k[l][0],bottom:d.height-a-k[l][1],left:j[l][0]-a};if(e.top>=0&&e.right>=0&&e.bottom>=0&&e.left>=0){b.x=j[l][0];b.y=j[l][1];this.set("pointerPosX",0);this.set("pointerPosY",0);this.set("pointerPos",this._sc_pointerLayout[l]);break}else{if(((l===0&&e.right>=0)||(l===1&&e.left>=0))&&e.top<0&&e.top+b.halfHeight>=0){b.x=j[l][0];b.y=j[l][1]-e.top;this.set("pointerPosX",0);this.set("pointerPosY",e.top);this.set("pointerPos",this._sc_pointerLayout[l]);break}else{if(((l===0&&e.right>=0)||(l===1&&e.left>=0))&&e.bottom<0&&e.bottom+b.halfHeight>=0){b.x=j[l][0];b.y=j[l][1]+e.bottom;this.set("pointerPosX",0);this.set("pointerPosY",Math.abs(e.bottom));this.set("pointerPos",this._sc_pointerLayout[l]);break}else{if(((l===2&&e.top>=0)||(l===3&&e.bottom>=0))&&e.right<0&&e.right+b.halfWidth>=0){b.x=j[l][0]+e.right;b.y=j[l][1];this.set("pointerPosX",Math.abs(e.right));this.set("pointerPosY",0);this.set("pointerPos",this._sc_pointerLayout[l]);break}else{if(((l===2&&e.top>=0)||(l===3&&e.bottom>=0))&&e.left<0&&e.left+b.halfWidth>=0){b.x=j[l][0]-e.left;b.y=j[l][1];this.set("pointerPosX",e.left);this.set("pointerPosY",0);this.set("pointerPos",this._sc_pointerLayout[l]);break}}}}}}if(g===h){if(m[4]===-1){b.x=c.x+c.halfWidth;b.y=c.y+c.halfHeight-b.halfHeight;this.set("pointerPos",this._sc_pointerLayout[0]+" fallback");this.set("pointerPosY",b.halfHeight-40)}else{b.x=j[m[4]][0];b.y=j[m[4]][1];this.set("pointerPos",this._sc_pointerLayout[m[4]]);this.set("pointerPosY",0)}this.set("pointerPosX",0)}this.invokeLast(this._adjustPointerPosition);return b},_adjustPointerPosition:function(){var d=this.$(".sc-pointer"),a=this.get("pointerPos"),c,b;switch(a){case"perfectRight":case"perfectLeft":b=-Math.round(d.outerHeight()/2);b+=this.get("pointerPosY");d.attr("style","margin-top: "+b+"px");break;case"perfectTop":case"perfectBottom":c=-Math.round(d.outerWidth()/2);c+=this.get("pointerPosX");d.attr("style","margin-left: "+c+"px;");break}},setupPointer:function(f){var g=this.get("pointerOffset"),e=SC.PickerPane;if(!g||g.length!==4){if(this.get("preferType")===SC.PICKER_MENU||this.get("preferType")===SC.PICKER_MENU_POINTER){switch(this.get("controlSize")){case SC.TINY_CONTROL_SIZE:this.set("pointerOffset",e.TINY_PICKER_MENU_POINTER_OFFSET);this.set("windowPadding",e.TINY_MENU_WINDOW_PADDING);break;case SC.SMALL_CONTROL_SIZE:this.set("pointerOffset",e.SMALL_PICKER_MENU_POINTER_OFFSET);this.set("windowPadding",e.SMALL_MENU_WINDOW_PADDING);break;case SC.REGULAR_CONTROL_SIZE:this.set("pointerOffset",e.REGULAR_PICKER_MENU_POINTER_OFFSET);this.set("windowPadding",e.REGULAR_MENU_WINDOW_PADDING);break;case SC.LARGE_CONTROL_SIZE:this.set("pointerOffset",e.LARGE_PICKER_MENU_POINTER_OFFSET);this.set("windowPadding",e.LARGE_MENU_WINDOW_PADDING);break;case SC.HUGE_CONTROL_SIZE:this.set("pointerOffset",e.HUGE_PICKER_MENU_POINTER_OFFSET);this.set("windowPadding",e.HUGE_MENU_WINDOW_PADDING);break;default:this.set("pointerOffset",e.REGULAR_PICKER_MENU_POINTER_OFFSET);this.set("windowPadding",e.REGULAR_MENU_WINDOW_PADDING)}}else{var d=(f.width<16)?((f.width<4)?9:6):0,b=(f.height<16)?((f.height<4)?9:6):0,c=e.PICKER_POINTER_OFFSET;var i=[c[0]+d,c[1]-d,c[2]-b,c[3]+b];this.set("pointerOffset",i)}}var h=this.get("preferMatrix");if(!h||h.length!==5){this.set("preferMatrix",this.get("preferType")===SC.PICKER_MENU_POINTER?[3,2,1,0,3]:[0,1,2,3,2])}},displayProperties:["pointerPos"],renderDelegateName:"pickerRenderDelegate",modalPaneDidClick:function(a){var d=this.get("frame"),e=this.get("removeTarget")||null,c=this.get("removeAction"),b=this.get("rootResponder");if(!this.clickInside(d,a)){if(c){b.sendAction(c,e,this,this,null,this)}else{this.remove()}return YES}return NO},mouseDown:function(a){return this.modalPaneDidClick(a)},clickInside:function(b,a){return SC.pointInRect({x:a.pageX,y:a.pageY},b)},windowSizeDidChange:function(b,a){arguments.callee.base.apply(this,arguments);if(this.repositionOnWindowResize){this.invokeNext(this.positionPane)}},remove:function(){if(this.get("isVisibleInWindow")){this._withdrawOverflowRequest()}this._removeScrollObservers();return arguments.callee.base.apply(this,arguments)},_hideOverflow:function(){var a=SC.$(".sc-main"),c=parseInt(a.css("minWidth"),0),d=parseInt(a.css("minHeight"),0),b=SC.RootResponder.responder.get("currentWindowSize");if(b.width>=c&&b.height>=d){SC.bodyOverflowArbitrator.requestHidden(this)}},_withdrawOverflowRequest:function(){SC.bodyOverflowArbitrator.withdrawRequest(this)},_getScrollViewOfView:function(b){var a=b;while(a){if(a.isScrollable){break}a=a.get("parentView")}return a},_setupScrollObservers:function(b){var a=this._getScrollViewOfView(b);if(a){a.addObserver("canScrollHorizontal",this,this._scrollCanScrollHorizontalDidChange);a.addObserver("canScrollVertical",this,this._scrollCanScrollVerticalDidChange);this._scrollCanScrollHorizontalDidChange(a);this._scrollCanScrollVerticalDidChange(a);this._scrollView=a}},_scrollCanScrollHorizontalDidChange:function(a){if(a.get("canScrollHorizontal")){a.addObserver("horizontalScrollOffset",this,this._scrollOffsetDidChange)}else{a.removeObserver("horizontalScrollOffset",this,this._scrollOffsetDidChange)}},_scrollCanScrollVerticalDidChange:function(a){if(a.get("canScrollVertical")){a.addObserver("verticalScrollOffset",this,this._scrollOffsetDidChange)}else{a.removeObserver("verticalScrollOffset",this,this._scrollOffsetDidChange)}},_removeScrollObservers:function(){var a=this._scrollView;if(a){a.removeObserver("canScrollHorizontal",this,this._scrollCanScrollHorizontalDidChange);a.removeObserver("canScrollVertical",this,this._scrollCanScrollVerticalDidChange);a.removeObserver("horizontalScrollOffset",this,this._scrollOffsetDidChange);a.removeObserver("verticalScrollOffset",this,this._scrollOffsetDidChange)}},_scrollOffsetDidChange:function(){this.invokeNext(this.positionPane)},init:function(){arguments.callee.base.apply(this,arguments);if(!this.windowPadding){this.windowPadding=SC.PickerPane.WINDOW_PADDING}},destroy:function(){this._scrollView=null;this._anchorView=null;this._anchorHTMLElement=null;return arguments.callee.base.apply(this,arguments)}});SC.PickerPane.mixin({WINDOW_PADDING:20,TINY_MENU_WINDOW_PADDING:12,SMALL_MENU_WINDOW_PADDING:11,REGULAR_MENU_WINDOW_PADDING:12,LARGE_MENU_WINDOW_PADDING:17,HUGE_MENU_WINDOW_PADDING:12,PICKER_POINTER_OFFSET:[9,-9,-18,18],TINY_PICKER_MENU_POINTER_OFFSET:[9,-9,-18,18],SMALL_PICKER_MENU_POINTER_OFFSET:[9,-9,-8,8],REGULAR_PICKER_MENU_POINTER_OFFSET:[9,-9,-12,12],LARGE_PICKER_MENU_POINTER_OFFSET:[9,-9,-16,16],HUGE_PICKER_MENU_POINTER_OFFSET:[9,-9,-18,18],PICKER_EXTRA_RIGHT_OFFSET:20,TINY_PICKER_MENU_EXTRA_RIGHT_OFFSET:12,SMALL_PICKER_MENU_EXTRA_RIGHT_OFFSET:11,REGULAR_PICKER_MENU_EXTRA_RIGHT_OFFSET:12,LARGE_PICKER_MENU_EXTRA_RIGHT_OFFSET:17,HUGE_PICKER_MENU_EXTRA_RIGHT_OFFSET:12});SC.SeparatorView=SC.View.extend({classNames:["sc-separator-view"],tagName:"span",layoutDirection:SC.LAYOUT_HORIZONTAL,render:function(a,b){if(b){a.push("<span></span>")}a.addClass(this.get("layoutDirection"))}});sc_require("views/separator");SC.MenuItemView=SC.View.extend(SC.ContentDisplay,{classNames:["sc-menu-item"],displayProperties:["title","toolTip","isEnabled","icon","isSeparator","shortcut","isChecked"],ariaRole:"menuitem",escapeHTML:YES,acceptsFirstResponder:YES,blocksIEDeactivate:YES,isContextMenuEnabled:NO,content:null,title:function(){var b=this.getContentProperty("itemTitleKey"),a=this.getPath("parentMenu.localize");if(a&&b){b=SC.String.loc(b)}return b||""}.property().cacheable(),value:function(){return this.getContentProperty("itemValueKey")}.property().cacheable(),toolTip:function(){var b=this.getContentProperty("itemToolTipKey"),a=this.getPath("parentMenu.localize");if(a&&b){b=SC.String.loc(b)}return b||""}.property().cacheable(),isEnabled:function(){return this.getContentProperty("itemIsEnabledKey")!==NO&&this.getContentProperty("itemSeparatorKey")!==YES}.property().cacheable(),icon:function(){return this.getContentProperty("itemIconKey")}.property().cacheable(),isSeparator:function(){return this.getContentProperty("itemSeparatorKey")===YES}.property().cacheable(),shortcut:function(){return this.getContentProperty("itemShortCutKey")}.property().cacheable(),isChecked:function(){return this.getContentProperty("itemCheckboxKey")}.property().cacheable(),subMenu:function(){var b=this.get("parentMenu"),c=this.getContentProperty("itemSubMenuKey");if(c){if(SC.kindOf(c,SC.MenuPane)){c.set("isModal",NO);c.set("isSubMenu",YES);c.set("parentMenu",b);return c}else{var a=this._subMenu;if(a){if(a.get("isAttached")){this.invokeLast("showSubMenu")}a.remove();a.destroy()}a=this._subMenu=SC.MenuPane.create({layout:{width:200},items:c,isModal:NO,isSubMenu:YES,parentMenu:b,controlSize:b.get("controlSize"),exampleView:b.get("exampleView")});return a}}return null}.property().cacheable(),hasSubMenu:function(){return !!this.get("subMenu")}.property("subMenu").cacheable(),getContentProperty:function(b){var a=this.get("content"),c=this.get("parentMenu");if(a&&c){return a.get(c.get(b))}},init:function(){arguments.callee.base.apply(this,arguments);this.contentDidChange()},destroy:function(){arguments.callee.base.apply(this,arguments);var a=this._subMenu;if(a){a.destroy();this._subMenu=null}},isReusable:false,render:function(a){var b=this.get("content"),f,e=this.get("parentMenu"),c=this.get("itemWidth")||e.layout.width,g=this.get("itemHeight")||SC.DEFAULT_MENU_ITEM_HEIGHT,d=this.get("escapeHTML");this.set("itemWidth",c);this.set("itemHeight",g);if(this.get("isSeparator")){a.setAttr("role","separator")}else{if(this.get("isChecked")){a.setAttr("role","menuitemcheckbox");a.setAttr("aria-checked",true)}}a=a.begin("a").addClass("menu-item");if(this.get("isSeparator")){a.push('<span class="separator"></span>');a.addClass("disabled")}else{f=this.get("icon");if(f){this.renderImage(a,f);a.addClass("has-icon")}f=this.get("title");if(SC.typeOf(f)!==SC.T_STRING){f=f.toString()}this.renderLabel(a,f);f=this.get("toolTip");if(SC.typeOf(f)!==SC.T_STRING){f=f.toString()}if(d){f=SC.RenderContext.escapeHTML(f)}a.setAttr("title",f);if(this.get("isChecked")){a.push('<div class="checkbox"></div>')}if(this.get("hasSubMenu")){this.renderBranch(a)}f=this.get("shortcut");if(f){this.renderShortcut(a,f)}}a=a.end()},renderImage:function(b,d){var a,c;if(d&&SC.ImageView.valueIsUrl(d)){a=d;c=""}else{c=d;a=SC.BLANK_IMAGE_URL}b.begin("img").addClass("image").addClass(c).setAttr("src",a).end()},renderLabel:function(b,a){if(this.get("escapeHTML")){a=SC.RenderContext.escapeHTML(a)}b.push("<span class='value ellipsis'>"+a+"</span>")},renderBranch:function(a){a.push('<span class="has-branch"></span>')},renderShortcut:function(b,a){b.push('<span class = "shortcut">'+a+"</span>")},showSubMenu:function(){var a=this.get("subMenu");if(a&&!a.get("isAttached")){a.set("mouseHasEntered",NO);a.popup(this,[0,0,0])}this._subMenuTimer=null},mouseUp:function(b){var a;a=this.getPath("parentMenu.rootMenu.targetMenuItem");if(a){a.performAction()}return YES},performAction:function(){if(!this.get("isEnabled")){this.getPath("parentMenu.rootMenu").remove();return YES}if(this.get("hasSubMenu")){return NO}var b=this.getContentProperty("itemDisableMenuFlashKey"),a;if(b){this.sendAction()}else{this._flashCounter=0;a=this.getPath("parentMenu.rootMenu");a._isFlashing=YES;this.invokeLater(this.flashHighlight,25);this.invokeLater(this.sendAction,150)}return YES},sendAction:function(){var c=this.getContentProperty("itemActionKey"),d=this.getContentProperty("itemTargetKey"),b=this.getPath("parentMenu.rootMenu"),a;this.getPath("parentMenu.rootMenu").remove();b._isFlashing=NO;c=(c===undefined)?b.get("action"):c;d=(d===undefined)?b.get("target"):d;b.set("selectedItem",this.get("content"));if(SC.typeOf(c)===SC.T_FUNCTION){c.apply(d,[b])}else{a=this.getPath("pane.rootResponder")||SC.RootResponder.responder;if(a){a.sendAction(c,d,b)}}},flashHighlight:function(){var a=this._flashCounter,b=this.$();if(a%2===0){b.addClass("focus")}else{b.removeClass("focus")}if(a<=2){this.invokeLater(this.flashHighlight,50);this._flashCounter++}},mouseDown:function(a){return a.which===1},mouseEntered:function(a){var c=this.get("parentMenu"),b=c.get("rootMenu");if(b._isFlashing){return}c.set("mouseHasEntered",YES);this.set("mouseHasEntered",YES);c.set("currentMenuItem",this);if(this.get("isEnabled")){this.becomeFirstResponder()}if(this.get("hasSubMenu")){this._subMenuTimer=this.invokeLater(this.showSubMenu,100)}return YES},mouseExited:function(a){var b,c;if(this.get("hasSubMenu")){c=this._subMenuTimer;if(c){c.invalidate()}else{this.invokeLater(this.checkMouseLocation,100)}}else{b=this.get("parentMenu");if(b.get("currentMenuItem")===this){b.set("currentMenuItem",null)}}return YES},touchStart:function(a){this.mouseEntered(a);return YES},touchEnd:function(a){return this.mouseUp(a)},touchEntered:function(a){return this.mouseEntered(a)},touchExited:function(a){return this.mouseExited(a)},checkMouseLocation:function(){var b=this.get("subMenu"),c=this.get("parentMenu"),a,d;if(!b.get("mouseHasEntered")){a=c.get("currentMenuItem");if(a===this||a===null){d=c.get("previousMenuItem");if(d){d.resignFirstResponder()}this.resignFirstResponder();b.remove()}}},moveUp:function(b,a){var c=this.get("parentMenu");if(c){c.moveUp(this)}return YES},moveDown:function(b,a){var c=this.get("parentMenu");if(c){c.moveDown(this)}return YES},moveRight:function(b,a){this.showSubMenu();return YES},insertText:function(b,a){var c=this.get("parentMenu");if(c){c.insertText(b,a)}},keyDown:function(a){return this.interpretKeyEvents(a)},keyUp:function(a){return YES},cancel:function(a){this.getPath("parentMenu.rootMenu").remove();return YES},didBecomeFirstResponder:function(a){if(a!==this){return}var b=this.get("parentMenu");if(b){b.set("currentSelectedMenuItem",this)}},willLoseFirstResponder:function(a){if(a!==this){return}var b=this.get("parentMenu");if(b){b.set("currentSelectedMenuItem",null);b.set("previousSelectedMenuItem",this)}},insertNewline:function(b,a){this.mouseUp(a)},closeParent:function(){this.$().removeClass("focus");var a=this.get("parentMenu");if(a){a.remove()}},clickInside:function(b,a){return SC.pointInRect({x:a.pageX,y:a.pageY},b)},contentDidChange:function(){var b=this.get("content"),a=this._content;if(b===a){return}var c=this.contentPropertyDidChange;if(a&&a.removeObserver){a.removeObserver("*",this,c)}this._content=b;if(b&&b.addObserver){b.addObserver("*",this,c)}this.contentPropertyDidChange(b,"*")}.observes("content"),contentPropertyDidChange:function(g,j){var b=this.get("parentMenu");if(!b){return}var a=SC.MenuItemView._contentPropertyToMenuItemPropertyMapping,h=SC.keys(a),e,f,d,c;if(j==="*"){for(e=0,f=h.length;e<f;++e){d=h[e];c=a[d];this.notifyPropertyChange(c)}}else{for(e=0,f=h.length;e<f;++e){d=h[e];if(b.get(d)===j){c=a[d];this.notifyPropertyChange(c)}}}}});SC.MenuItemView._contentPropertyToMenuItemPropertyMapping={itemTitleKey:"title",itemValueKey:"value",itemToolTipKey:"toolTip",itemIsEnabledKey:"isEnabled",itemIconKey:"icon",itemSeparatorKey:"isSeparator",itemShortCutKey:"shortcut",itemCheckboxKey:"isChecked",itemSubMenuKey:"subMenu"};sc_require("panes/picker");sc_require("views/menu_item");SC.MenuPane=SC.PickerPane.extend({_sc_menu_items:null,classNames:["sc-menu"],ariaRole:"menu",items:null,controlSize:SC.REGULAR_CONTROL_SIZE,itemHeight:SC.propertyFromRenderDelegate("itemHeight",20),itemSeparatorHeight:SC.propertyFromRenderDelegate("itemSeparatorHeight",9),menuHeight:0,menuHeightPadding:SC.propertyFromRenderDelegate("menuHeightPadding",6),submenuOffsetX:SC.propertyFromRenderDelegate("submenuOffsetX",2),selectedItem:null,exampleView:SC.MenuItemView,anchor:null,isSubMenu:NO,escapeHTML:YES,localize:YES,acceptsMenuPane:YES,isContextMenuEnabled:NO,popup:function(a,b){this.beginPropertyChanges();if(a){if(a.isView){this._anchorView=a;this._setupScrollObservers(a)}else{this._anchorHTMLElement=a}}if(b){this.set("preferMatrix",b)}this.adjust("height",this.get("menuHeight"));this.positionPane();this.set("defaultResponder",this);this.endPropertyChanges();SC.bodyOverflowArbitrator.requestHidden(this,true);this.append()},itemTitleKey:"title",itemValueKey:"value",itemToolTipKey:"toolTip",itemIsEnabledKey:"isEnabled",itemIconKey:"icon",itemHeightKey:"height",itemSubMenuKey:"subMenu",itemSeparatorKey:"isSeparator",itemTargetKey:"target",itemActionKey:"action",itemCheckboxKey:"checkbox",itemShortCutKey:"shortcut",itemKeyEquivalentKey:"keyEquivalent",itemDisableMenuFlashKey:"disableMenuFlash",itemLayerIdKey:"layerId",itemExampleViewKey:"exampleView",menuItemKeys:["itemTitleKey","itemValueKey","itemToolTipKey","itemIsEnabledKey","itemIconKey","itemSeparatorKey","itemActionKey","itemCheckboxKey","itemShortCutKey","itemHeightKey","itemSubMenuKey","itemKeyEquivalentKey","itemTargetKey","itemLayerIdKey"],target:null,action:null,preferType:SC.PICKER_MENU,init:function(){if(!this.items){this.items=[]}this._keyEquivalents={};arguments.callee.base.apply(this,arguments);this._sc_menu_itemsDidChange()},displayProperties:["controlSize"],renderDelegateName:"menuRenderDelegate",createChildViews:function(){var b,a;a=this._menuView=SC.View.create({layout:{height:0}});b=this._menuScrollView=this.createChildView(SC.MenuScrollView,{controlSize:this.get("controlSize"),contentView:a});this.childViews=[b];return this},didAppendToDocument:function(){this.becomeMenuPane()},willRemoveFromDocument:function(){var a=this.get("parentMenu");this.set("currentMenuItem",null);this.closeOpenMenus();this.resignMenuPane();if(a){a.becomeMenuPane()}},becomeMenuPane:function(){if(this.rootResponder){this.rootResponder.makeMenuPane(this)}return this},resignMenuPane:function(){if(this.rootResponder){this.rootResponder.makeMenuPane(null)}return this},menuItemViews:function(){return this.createMenuItemViews()}.property("displayItems").cacheable(),createMenuItemViews:function(){var i=[],q=this.get("displayItems"),a=this.get("exampleView"),u,d,l,k,e,p,n,g,b,j,r,c,f,m,h,o,w,v,s,t;if(!q){return i}n=this.get("itemHeightKey");g=this.get("itemSeparatorKey");k=this.get("itemExampleViewKey");b=this.get("itemHeight");f=this.get("itemKeyEquivalentKey");j=this.get("itemSeparatorHeight");w=this.get("itemLayerIdKey");s=this.get("escapeHTML");c=Math.floor(this.get("menuHeightPadding")/2);r=c;h=this.menuItemKeys.map(SC._menu_fetchKeys,this);t=q.get("length");for(o=0;o<t;o++){u=q[o];p=u.get(n);if(!p){p=u.get(g)?j:b}v={layout:{height:p,top:r},contentDisplayProperties:h,content:u,parentMenu:this,escapeHTML:s};if(u.get(w)){v.layerId=u.get(w)}e=u.get(k);if(e){d=e}else{d=a}l=this._menuView.createChildView(d,v);i[o]=l;r+=p;m=u.get(f);if(m){if(SC.typeOf(m)===SC.T_ARRAY){m.forEach(function(x){this._keyEquivalents[x]=l},this)}else{this._keyEquivalents[m]=l}}}this.set("menuHeight",r+c);return i},menuItemViewForContentIndex:function(a){var b=this.get("menuItemViews");if(!b){return undefined}return b.objectAt(a)},rootMenu:function(){if(this.get("isSubMenu")){return this.getPath("parentMenu.rootMenu")}return this}.property("isSubMenu").cacheable(),destroy:function(){var a=arguments.callee.base.apply(this,arguments);if(this._sc_menu_items){this._sc_menu_items.removeObserver("[]",this,"_sc_menu_itemPropertiesDidChange")}this._menuView.destroy();this._sc_menu_items=null;this._menuView=null;return a},windowSizeDidChange:function(){this.remove();return arguments.callee.base.apply(this,arguments)},displayItems:function(){var c=this.get("items"),b,d=[],a,e,f;if(!c){return null}b=c.get("length");for(a=0;a<b;a++){e=c.objectAt(a);if(!e||(!d.length&&e[this.get("itemSeparatorKey")])){continue}f=SC.typeOf(e);if(f===SC.T_STRING){e=SC.Object.create({title:e,value:e,isEnabled:YES})}else{if(f===SC.T_HASH){e=SC.Object.create(e)}}e.contentIndex=a;d.push(e)}return d}.property("items").cacheable(),_sc_menu_itemsDidChange:function(){var a=this.get("items");if(this._sc_menu_items){this._sc_menu_items.removeObserver("[]",this,"_sc_menu_itemPropertiesDidChange")}if(a){a.addObserver("[]",this,"_sc_menu_itemPropertiesDidChange")}this._sc_menu_items=a;var b;b=this.get("menuItemViews");this._menuView.replaceAllChildren(b);this._menuView.adjust("height",this.get("menuHeight"))}.observes("items"),_sc_menu_itemPropertiesDidChange:function(){this.notifyPropertyChange("displayItems");var a;a=this.get("menuItemViews");this._menuView.replaceAllChildren(a);this._menuView.adjust("height",this.get("menuHeight"))},currentMenuItem:function(a,b){if(b!==undefined){if(this._currentMenuItem!==null){this.set("previousMenuItem",this._currentMenuItem)}this._currentMenuItem=b;this.setPath("rootMenu.targetMenuItem",b);return b}return this._currentMenuItem}.property().cacheable(),_sc_menu_currentMenuItemDidChange:function(){var a=this.get("currentMenuItem"),b=this.get("previousMenuItem");if(b){if(b.get("hasSubMenu")&&a===null){}else{b.resignFirstResponder();this.closeOpenMenusFor(b)}}if(a&&a.get("isEnabled")){a.scrollToVisible()}}.observes("currentMenuItem"),closeOpenMenusFor:function(a){if(!a){return}var b=a.get("parentMenu");while(b&&a){b=a.get("subMenu");if(b){b.remove();a.resignFirstResponder();a=b.get("previousMenuItem")}}},closeOpenMenus:function(){this.closeOpenMenusFor(this.get("previousMenuItem"))},mouseDown:function(a){this.modalPaneDidClick(a);return YES},mouseEntered:function(){this.set("mouseHasEntered",YES)},keyUp:function(a){var b=this.interpretKeyEvents(a);return !b?NO:b},moveUp:function(){var c=this.get("currentMenuItem"),d=this.get("menuItemViews"),b,a;if(!c){a=d.get("length")-1}else{b=c.getPath("content.contentIndex");if(b===0){return YES}a=b-1}while(a>=0){if(d[a].get("isEnabled")){this.set("currentMenuItem",d[a]);d[a].becomeFirstResponder();break}a--}return YES},moveDown:function(){var d=this.get("currentMenuItem"),e=this.get("menuItemViews"),b=e.get("length"),c,a;if(!d){a=0}else{c=d.getPath("content.contentIndex");if(c===b){return YES}a=c+1}while(a<b){if(e[a].get("isEnabled")){this.set("currentMenuItem",e[a]);e[a].becomeFirstResponder();break}a++}return YES},moveToBeginningOfDocument:function(){var c=this.get("menuItemViews"),b=c.get("length"),a=0;while(a<b){if(c[a].get("isEnabled")){this.set("currentMenuItem",c[a]);c[a].becomeFirstResponder();break}++a}return YES},moveToEndOfDocument:function(){var c=this.get("menuItemViews"),b=c.get("length"),a=b-1;while(a>=0){if(c[a].get("isEnabled")){this.set("currentMenuItem",c[a]);c[a].becomeFirstResponder();break}--a}return YES},pageDown:function(){var c=this.get("currentMenuItem"),h,e=this.get("menuItemViews"),b=e.get("length"),a=0,g,d=0,f;if(this._menuScrollView&&this._menuScrollView.bottomScrollerView){if(c){a=c.getPath("content.contentIndex")}g=a;f=this._menuScrollView.get("verticalPageScroll");for(a;a<b;a++){h=e[a];d+=h.get("layout").height;if(d>f){break}else{if(h.get("isEnabled")){g=a}}}h=e[g];this.set("currentMenuItem",h);h.becomeFirstResponder()}else{this.moveToEndOfDocument()}return YES},pageUp:function(){var c=this.get("currentMenuItem"),h,e=this.get("menuItemViews"),b=e.get("length"),a=b-1,g,d=0,f;if(this._menuScrollView&&this._menuScrollView.topScrollerView){if(c){a=c.getPath("content.contentIndex")}g=a;f=this._menuScrollView.get("verticalPageScroll");for(a;a>=0;a--){h=e[a];d+=h.get("layout").height;if(d>f){break}else{if(h.get("isEnabled")){g=a}}}h=e[g];this.set("currentMenuItem",h);h.becomeFirstResponder()}else{this.moveToBeginningOfDocument()}return YES},insertText:function(a){var c=this._timer,b=this._keyBuffer;if(c){c.invalidate()}c=this._timer=SC.Timer.schedule({target:this,action:"clearKeyBuffer",interval:500,isPooled:NO});b=b||"";b+=a.toUpperCase();this.selectMenuItemForString(b);this._keyBuffer=b;return YES},performKeyEquivalent:function(d,a,b){if(!b&&!this.get("isVisibleInWindow")){return NO}var c=this._keyEquivalents[d];if(c){c.performAction(YES);return YES}if(d==="escape"||d==="return"){this.remove();return YES}return NO},selectMenuItemForString:function(c){var d=this.get("menuItemViews"),f,g,b,a,e;if(!d){return}e=c.length;a=d.get("length");for(b=0;b<a;b++){f=d.objectAt(b);g=f.get("title");if(!g){continue}g=g.replace(/ /g,"").substr(0,e).toUpperCase();if(g===c){this.set("currentMenuItem",f);f.becomeFirstResponder();break}}},clearKeyBuffer:function(){this._keyBuffer=""},modalPaneDidClick:function(){this.remove();return YES}});SC._menu_fetchKeys=function(a){return this.get(a)};SC._menu_fetchItem=function(a){if(!a){return null}return this.get?this.get(a):this[a]};SC.MenuPane.TINY_MENU_ITEM_HEIGHT=10;SC.MenuPane.SMALL_MENU_ITEM_HEIGHT=16;SC.MenuPane.REGULAR_MENU_ITEM_HEIGHT=22;SC.MenuPane.LARGE_MENU_ITEM_HEIGHT=31;SC.MenuPane.HUGE_MENU_ITEM_HEIGHT=20;sc_require("panes/panel");SC.SheetPane=SC.PanelPane.extend({classNames:["sc-sheet"],modalPane:SC.ModalPane,duration:0.3,timing:"ease-in-out",transitionIn:SC.View.SLIDE_IN,transitionInOptions:function(){return{direction:"down",duration:this.get("duration"),timing:this.get("timing")}}.property("timing","duration").cacheable(),transitionOut:SC.View.SLIDE_OUT,transitionOutOptions:function(){return{direction:"up",duration:this.get("duration"),timing:this.get("timing")}}.property("timing","duration").cacheable()});SC.BaseTheme.buttonRenderDelegate=SC.RenderDelegate.create({className:"button","sc-small-size":{height:18,autoResizePadding:{width:15,height:0}},"sc-regular-size":{height:24,autoResizePadding:{width:20,height:0}},"sc-huge-size":{height:30,autoResizePadding:{width:30,height:0}},"sc-jumbo-size":{height:44,autoResizePadding:{width:50,height:0}},render:function(a,e){this.addSizeClassName(a,e);var b=a.get("toolTip"),f=a.get("isSelected")||NO,i=a.get("isActive")||NO,g=a.get("isDefault")||NO,h=a.get("isCancel")||NO,d=(a.get("buttonBehavior")===SC.TOGGLE_BEHAVIOR),c=SC.guidFor(a)+"-label";e.setClass({icon:!!a.get("icon"),def:g,cancel:h&&!g,active:i,sel:f});if(b){e.setAttr("title",b)}this.includeSlices(a,e,SC.THREE_SLICE);if(a.get("isSegment")){e.setAttr("aria-selected",f.toString())}else{if(d){e.setAttr("aria-pressed",i.toString())}}e.setAttr("aria-labelledby",c);e=e.begin("label").addClass("sc-button-label").id(c);a.get("theme").labelRenderDelegate.render(a,e);e=e.end();if(a.get("supportFocusRing")){e=e.begin("div").addClass("focus-ring");this.includeSlices(a,e,SC.THREE_SLICE);e=e.end()}},update:function(f,a){var e=(f.get("buttonBehavior")===SC.TOGGLE_BEHAVIOR),d=f.get("isDefault"),c=f.get("isCancel"),b=f.get("toolTip");this.updateSizeClassName(f,a);if(f.get("isActive")){a.addClass("active")}if(f.get("isSegment")){a.attr("aria-selected",f.get("isSelected").toString())}else{if(e){a.attr("aria-pressed",f.get("isActive").toString())}}if(b){a.attr("title",b)}else{a.removeAttr("title")}a.setClass("icon",!!f.get("icon"));a.setClass("def",!!d);a.setClass("cancel",!!c&&!d);f.get("theme").labelRenderDelegate.update(f,a.find("label"))},getRenderedAutoResizeLayer:function(a,b){return b.find(".sc-button-label")[0]}});SC.BaseTheme.checkboxRenderDelegate=SC.RenderDelegate.create({className:"checkbox",render:function(g,c){this.addSizeClassName(g,c);var f=g.get("theme"),e;e=SC.guidFor(g)+"-label";var b=g.get("isSelected")||NO;var d=g.get("isActive");var a;if(b===SC.MIXED_STATE){a="mixed"}else{if(b){a="true"}else{a="false"}}c.setAttr("role","checkbox");c.setAttr("aria-checked",a);c.setAttr("aria-labelledby",e);c.setClass({sel:b,active:d});c.push('<span class = "button"></span>');c=c.begin("span").addClass("label").id(e);f.labelRenderDelegate.render(g,c);c=c.end()},update:function(f,b){this.updateSizeClassName(f,b);var e=f.get("theme");var c=f.get("isSelected");var d=f.get("isActive");var a;if(c===SC.MIXED_STATE){a="mixed"}else{if(c){a="true"}else{a="false"}}b.attr("aria-checked",a);e.labelRenderDelegate.update(f,b.find("span.label"));b.setClass({sel:c,active:d})}});SC.BaseTheme.collectionRenderDelegate=SC.RenderDelegate.create({className:"collection",render:function(b,a){a.setClass("active",b.get("isActive"))},update:function(b,a){a.setClass("active",b.get("isActive"))}});SC.BaseTheme.disclosureRenderDelegate=SC.RenderDelegate.create({className:"disclosure",render:function(g,a){this.addSizeClassName(g,a);var f=g.get("theme"),d=g.get("value"),b=["sc-button-label","sc-disclosure-label"];var e=SC.guidFor(g)+"-label";a.setAttr("aria-expanded",d);a.setAttr("aria-labelledby",e);if(g.get("isSelected")){a.addClass("sel")}var c="";c+=g.get("isSelected")?"open":"closed";if(g.get("isActive")){c+=" active"}a.push('<img src = "'+SC.BLANK_IMAGE_URL+'" class = "disclosure button '+c+'" />');a=a.begin("span").addClass(b).id(e);f.labelRenderDelegate.render(g,a);a=a.end()},update:function(d,a){this.updateSizeClassName(d,a);var c=d.get("theme"),b=d.get("value");a.attr("aria-expanded",b);if(d.get("isSelected")){a.addClass("sel")}a.find("img").setClass({open:d.get("isSelected"),closed:!d.get("isSelected"),active:d.get("isActive")});c.labelRenderDelegate.update(d,a.find("span.sc-disclosure-label"))}});SC.THREE_SLICE=["left","middle","right"];SC.NINE_SLICE=["top-left","top","top-right","left","middle","right","bottom-left","bottom","bottom-right"];SC.RenderDelegate.reopen({includeSlices:function(e,c,d){for(var b=0,a=d.length;b<a;b++){c.push('<div class="'+d[b]+'"></div>')}}});SC.BaseTheme.imageButtonRenderDelegate=SC.RenderDelegate.create({className:"image-button",render:function(d,b){var c=d.get("image"),a=d.get("toolTip");this.addSizeClassName(d,b);if(a){b.setAttr("title",a);b.setAttr("alt",a)}if(c){b.addClass(c);d.renderState._cachedImage=c}},update:function(d,b){var c,a;this.updateSizeClassName(d,b);if(d.didChangeFor("imageButtonRenderDelegate","toolTip")){a=d.get("toolTip");b.attr("title",a);b.attr("alt",a)}if(d.didChangeFor("imageButtonRenderDelegate","image")){c=d.get("image");if(d.renderState._cachedImage){b.removeClass(d.renderState._cachedImage)}if(c){b.addClass(c);d.renderState._cachedImage=c}}}});SC.BaseTheme.MASTER_DETAIL_DIVIDER_WIDTH=1;SC.BaseTheme.masterDetailRenderDelegate=SC.RenderDelegate.create({className:"master-detail",dividerWidth:1,render:function(b,a){a.setClass("round-toolbars",SC.platform.touch)},update:function(b,a){a.setClass("round-toolbars",SC.platform.touch)}});SC.BaseTheme.panelRenderDelegate=SC.RenderDelegate.create({className:"panel",render:function(e,b){b=b.begin("div").addClass("panel-background");this.includeSlices(e,b,SC.NINE_SLICE);b=b.end();var a=e.get("ariaLabel"),c=e.get("ariaLabelledBy"),d=e.get("ariaDescribedBy");if(a){b.setAttr("aria-label",a)}if(c){b.setAttr("aria-labelledby",c)}if(d){b.setAttr("aria-describedby",d)}},update:function(e,c){var a=e.get("ariaLabel"),b=e.get("ariaLabelledBy"),d=e.get("ariaDescribedBy");if(a){c.attr("aria-label",a)}if(b){c.attr("aria-labelledby",b)}if(d){c.attr("aria-describedby",d)}}});sc_require("render_delegates/panel");SC.BaseTheme.pickerRenderDelegate=SC.RenderDelegate.create({className:"picker",render:function(e,c){var a=e.get("theme").panelRenderDelegate;a.render(e,c);var b=e.get("preferType"),d=e.get("pointerPos");if(b==SC.PICKER_POINTER||b==SC.PICKER_MENU_POINTER){c.push('<div class="sc-pointer '+d+'"></div>');c.addClass(d);e.renderState._lastPointerPosition=d}},update:function(g,e){var a=g.get("theme").panelRenderDelegate;a.update(g,e);var b=g.get("preferType"),d=g.get("pointerPos");if(b==SC.PICKER_POINTER||b==SC.PICKER_MENU_POINTER){var f=g.renderState._lastPointerPosition;if(f!==d){var c=e.find(".sc-pointer");c.attr("class","sc-pointer "+d);e.removeClass(f);e.addClass(d);g.renderState._lastPointerPosition=d}}}});sc_require("render_delegates/picker");SC.BaseTheme.menuRenderDelegate=SC.BaseTheme.pickerRenderDelegate.create({className:"menu",render:function(c,b,a){this.addSizeClassName(b,a);c(b,a)}.enhance(),update:function(c,b,a){this.updateSizeClassName(b,a);c(b,a)}.enhance(),itemHeight:20,itemSeparatorHeight:9,menuHeightPadding:6,menuWidthPadding:50,minimumMenuWidth:50,submenuOffsetX:2,verticalOffset:23,"sc-tiny-size":{itemHeight:10,itemSeparatorHeight:2,menuHeightPadding:2,submenuOffsetX:0},"sc-small-size":{itemHeight:16,itemSeparatorHeight:7,menuHeightPadding:4,submenuOffsetX:2},"sc-large-size":{itemHeight:60,itemSeparatorHeight:20,menuHeightPadding:0,submenuOffsetX:4},"sc-huge-size":{itemHeight:20,itemSeparatorHeight:9,menuHeightPadding:0,submenuOffsetX:0}});SC.BaseTheme.popupButtonRenderDelegate=SC.BaseTheme.buttonRenderDelegate.create({render:function(b,a){a.setAttr("aria-haspopup","true");arguments.callee.base.apply(this,arguments)},update:function(b,a){arguments.callee.base.apply(this,arguments)}});SC.BaseTheme.PROGRESS_OFFSET=0.5;SC.BaseTheme.PROGRESS_OFFSET_RANGE=42;SC.BaseTheme.progressRenderDelegate=SC.RenderDelegate.create({className:"progress",render:function(h,c){this.addSizeClassName(h,c);var a=h.get("isIndeterminate"),g=h.get("theme"),b=h.get("maximum"),e=h.get("minimum"),d=h.get("ariaValue");var f;if(a){f=1}else{f=h.get("value")}c.setAttr("aria-valuemax",b);c.setAttr("aria-valuemin",e);c.setAttr("aria-valuenow",d);c.setAttr("aria-valuetext",d);c.setClass({indeterminate:a,running:h.get("isRunning")&&a,"sc-empty":(f<=0),"sc-complete":(f>=1&&!a)});c=c.begin("div").addClass("track");this.includeSlices(h,c,SC.THREE_SLICE);c=c.end();c=c.begin("div").addClass("content");c.setStyle("width",(f*100)+"%");this.includeSlices(h,c,SC.THREE_SLICE);c=c.end()},update:function(a,j){this.updateSizeClassName(a,j);var d=a.get("theme"),g,h=a.get("maximum"),e=a.get("minimum"),b=a.get("ariaValue"),c=a.get("isIndeterminate"),i=a.get("isRunning"),f=a.get("isVisibleInWindow");j.attr("aria-valuemax",h);j.attr("aria-valuemin",e);j.attr("aria-valuenow",b);j.attr("aria-valuetext",b);if(c){g=1}else{g=a.get("value")}j.setClass({indeterminate:c,running:i&&c,"sc-empty":(g<=0),"sc-complete":(g>=1&&!c)});j.find(".content").css("width",(g*100)+"%");if(!SC.platform.supportsCSSTransitions){if(!this._queue[j[0].id]){this._queue[j[0].id]={offset:0,element:SC.$(j).find(".content .middle"),shouldAnimate:false}}if(c&&i&&f){this._queue[j[0].id].shouldAnimate=true;this.animate(a)}else{if(!c){this._queue[j[0].id].element.css("background-position","")}else{this._queue[j[0].id].shouldAnimate=false}}}},_queue:{},_animating:false,animate:function(b){var a=this;if(this._animating){return}function c(){var h,e,f,d=a._queue,j=0,g;var i;for(i in d){if(d.hasOwnProperty(i)){g=d[i];if(g.shouldAnimate){a._animating=true;j++;e=g.offset||0;h=(e+SC.BaseTheme.PROGRESS_OFFSET)%SC.BaseTheme.PROGRESS_OFFSET_RANGE;f=Math.round(h);if(f>Math.round(e)){g.element.css("background-position",f+"px 0px")}g.offset=h}}}if(j===0){a._animating=false}else{window.requestAnimationFrame(c)}}c()}});SC.BaseTheme.radioRenderDelegate=SC.RenderDelegate.create({className:"radio",render:function(f,b){this.addSizeClassName(f,b);var e=f.get("theme");var a=f.get("isSelected"),c=f.get("width"),d=SC.guidFor(f)+"-label";b.setClass({active:f.get("isActive"),mixed:f.get("isMixed"),sel:f.get("isSelected"),disabled:!f.get("isEnabled")});b.setAttr("role","radio");b.setAttr("aria-checked",a);b.setAttr("aria-labelledby",d);b.setAttr("aria-disabled",f.get("isEnabled")?"false":"true");if(c){b.setStyle("width",c)}b.push('<span class = "button"></span>');b=b.begin("span").addClass("sc-button-label").id(d);e.labelRenderDelegate.render(f,b);b=b.end()},update:function(f,a){this.updateSizeClassName(f,a);var e=f.get("theme");var b=f.get("isSelected"),c=f.get("width"),d=f.get("value");a.setClass({active:f.get("isActive"),mixed:f.get("isMixed"),sel:f.get("isSelected"),disabled:!f.get("isEnabled")});a.attr("aria-disabled",f.get("isEnabled")?"false":"true");a.attr("aria-checked",b);a.css("width",c?c:null);e.labelRenderDelegate.update(f,a.find(".sc-button-label"))}});SC.BaseTheme.radioGroupRenderDelegate=SC.RenderDelegate.create({className:"radio-group",render:function(h,e){this.addSizeClassName(h,e);var g=h.get("theme"),d=SC.guidFor(this),c=h.get("items"),b,a=c.length,f;e.addClass(h.get("layoutDirection"));e.setAttr("role","radiogroup");e.setAttr("aria-disabled",h.get("isEnabled")?"false":"true");for(b=0;b<a;b++){f=c[b];e=e.begin("div").addClass("radio-"+b).setAttr("index",b).addClass(g.classNames).addClass(g.radioRenderDelegate.className).addClass("sc-radio-button");g.radioRenderDelegate.render(f,e);e=e.end()}h.get("renderState").radioCount=b},update:function(a,d){this.updateSizeClassName(a,d);var e=a.get("theme"),b=SC.guidFor(this),g=a.get("items"),h,f=g.length,i;d.addClass(a.get("layoutDirection"));d.attr("aria-disabled",a.get("isEnabled")?"false":"true");if(a.get("renderState").radioCount!==f){var c=SC.RenderContext(d[0]);this.render(a,c);c.update();return}for(h=0;h<f;h++){i=g[h];e.radioRenderDelegate.update(i,d.find(".radio-"+h))}},updateRadioAtIndex:function(d,a,b){var c=d.get("items")[b];d.get("theme").radioRenderDelegate.update(c,a.find(".radio-"+b))},indexForEvent:function(d,b,a){var c=$(a.target).closest(".sc-radio-button").attr("index");if(isNaN(c)){return undefined}return parseInt(c,0)}});SC.BaseTheme.segmentRenderDelegate=SC.RenderDelegate.create({className:"segment",render:function(e,b){var c=e.get("theme"),d,a;a={"sc-first-segment":e.get("isFirstSegment"),"sc-middle-segment":e.get("isMiddleSegment"),"sc-last-segment":e.get("isLastSegment"),"sc-overflow-segment":e.get("isOverflowSegment"),vertical:e.get("layoutDirection")!==SC.LAYOUT_HORIZONTAL};if(!SC.none(e.get("index"))){a["sc-segment-"+e.get("index")]=YES}b.setClass(a);d=c.buttonRenderDelegate;d.render(e,b)},update:function(e,a){var c=e.get("theme"),d,b={};b={"sc-first-segment":e.get("isFirstSegment"),"sc-middle-segment":e.get("isMiddleSegment"),"sc-last-segment":e.get("isLastSegment"),"sc-overflow-segment":e.get("isOverflowSegment")||NO,vertical:e.get("layoutDirection")!==SC.LAYOUT_HORIZONTAL};if(!SC.none(e.get("index"))){b["sc-segment-"+e.get("index")]=YES}a.setClass(b);d=c.buttonRenderDelegate;d.update(e,a)}});SC.BaseTheme.segmentedRenderDelegate=SC.RenderDelegate.create({className:"segmented",render:function(b,a){this.addSizeClassName(b,a);a.addStyle("text-align",b.get("align"))},update:function(b,a){this.updateSizeClassName(b,a);a.css("text-align",b.get("align"))}});SC.BaseTheme.sliderRenderDelegate=SC.RenderDelegate.create({className:"slider",render:function(h,d){this.addSizeClassName(h,d);var b=h.get("maximum"),f=h.get("minimum"),e=h.get("ariaValue");d.setAttr("aria-valuemax",b);d.setAttr("aria-valuemin",f);d.setAttr("aria-valuenow",e);if(f!==0||b!==100){d.setAttr("aria-valuetext",e)}d.setAttr("aria-orientation","horizontal");d=d.begin("span").addClass("track");this.includeSlices(h,d,SC.THREE_SLICE);if(h.get("markSteps")){var g=h.get("stepPositions");if(g){var c,a=g.length;for(c=0;c<a;c++){d.begin().setStyle("left","%@%".fmt(g[c]*100)).addClass(["sc-slider-step-mark","sc-slider-step-mark-%@".fmt(c)]).setClass({"sc-slider-step-mark-first":c===0,"sc-slider-step-mark-last":c===a-1}).end()}}}d.begin("img").setAttr("src",SC.BLANK_IMAGE_URL).addClass("sc-handle").setStyle("left","%@%".fmt(h.get("value"))).end();d=d.end();h.get("renderState")._cachedHandle=null},update:function(b,c){this.updateSizeClassName(b,c);var o=b.get("maximum"),h=b.get("minimum"),e=b.get("ariaValue"),k=b.get("renderState")._cachedHandle;if(!k){k=b.get("renderState")._cachedHandle=c.find(".sc-handle")}c.attr("aria-valuemax",o);c.attr("aria-valuemin",h);c.attr("aria-valuenow",e);if(h!==0||o!==100){c.attr("aria-valuetext",e)}c.attr("aria-orientation","horizontal");if(b.didChangeFor("sliderRenderDelegateMinimumMaximumStepMarkSteps","minimum","maximum","step","markSteps")){var m=c.find(".sc-slider-step-mark"),q=b.get("markSteps"),p;if(!q||!(p=b.get("stepPositions"))){m.remove()}else{var f,g,j=p.length,a,d='<div style="left:%@%" class="sc-slider-step-mark sc-slider-step-mark-%@ %@"></div>',l;for(g=0;g<j;g++){if(m[g]){m.eq(g).css("left","%@%".fmt(p[g]*100)).setClass({"sc-slider-step-mark-first":g===0,"sc-slider-step-mark-last":g===j-1})}else{if(g===0){a="sc-slider-step-mark-first"}else{if(g===j-1){a="sc-slider-step-mark-last"}else{a=""}}l=d.fmt(p[g]*100,g,a);k.before(l)}}m.slice(g).remove()}}if(b.didChangeFor("sliderRenderDelegateValue","value")){var n=b.get("value");k.css("left",n+"%")}}});SC.BaseTheme.SourceList=SC.BaseTheme.subtheme("source-list");SC.BaseTheme.splitRenderDelegate=SC.RenderDelegate.create({className:"split",_classesForDataSource:function(b){var a={},c=b.get("layoutDirection");a[SC.LAYOUT_VERTICAL]=c===SC.LAYOUT_VERTICAL;a[SC.LAYOUT_HORIZONTAL]=c===SC.LAYOUT_HORIZONTAL;return a},render:function(b,a){a.setClass(this._classesForDataSource(b))},update:function(b,a){a.setClass(this._classesForDataSource(b))}});SC.BaseTheme.splitDividerRenderDelegate=SC.RenderDelegate.create({className:"split-divider",dividerSize:1,splitPositionOffset:-5,splitSizeOffset:10,render:function(b,a){this.addSizeClassName(b,a);a.push("<div class='line'></div>")},update:function(b,a){this.updateSizeClassName(b,a)}});SC.BaseTheme.toolbarRenderDelegate=SC.RenderDelegate.create({className:"toolbar",render:function(b,a){},update:function(){}});SC.BaseTheme.wellRenderDelegate=SC.RenderDelegate.create({className:"well",render:function(b,a){this.includeSlices(b,a,SC.NINE_SLICE)},update:function(){}});SC.BaseTheme.workspaceRenderDelegate=SC.RenderDelegate.create({className:"workspace",render:function(){},update:function(){}});SC.DRAG_LINK=4;SC.DRAG_COPY=1;SC.DRAG_MOVE=2;SC.DRAG_NONE=0;SC.DRAG_ANY=15;SC.DRAG_DATA=8;SC.DRAG_AUTOSCROLL_ZONE_THICKNESS=20;SC.View.reopen({init:function(a){a();if(this.get("isDropTarget")){SC.Drag.addDropTarget(this)}if(this.get("isScrollable")){SC.Drag.addScrollableView(this)}}.enhance(),destroy:function(a){if(this.get("isDropTarget")){SC.Drag.removeDropTarget(this)}if(this.get("isScrollable")){SC.Drag.removeScrollableView(this)}return a()}.enhance()});SC.Drag=SC.Object.extend({source:null,ghostView:null,ghostActsLikeCursor:NO,dragView:null,ghost:YES,sourceIsDraggable:YES,slideBack:YES,ghostOffset:{x:0,y:0},location:{},dataTypes:function(){if(this.dataSource){return this.dataSource.get("dragDataTypes")||[]}var d=this.data;if(d){var a=[];for(var b in d){if(d.hasOwnProperty(b)){a.push(b)}}return a}var c=this.get("source");if(c&&c.dragDataTypes){return c.get("dragDataTypes")||[]}return[]}.property().cacheable(),hasDataType:function(a){return(this.get("dataTypes").indexOf(a)>=0)},dataForType:function(a){if(this.dataSource){return this.dataSource.dragDataForType(this,a)}else{if(this.data){return this.data[a]}else{var b=this.get("source");if(b&&SC.typeOf(b.dragDataForType)===SC.T_FUNCTION){return b.dragDataForType(this,a)}else{return null}}}},dataSource:null,data:null,allowedDragOperations:SC.DRAG_ANY,_dragInProgress:YES,_dragViewWasVisible:null,startDrag:function(){if(this.get("sourceIsDraggable")){this._createGhostView()}var i=this.event;var e={x:i.pageX,y:i.pageY};this.set("location",e);if(this.get("sourceIsDraggable")){var b=this._getDragView();var j=b.get("parentView");var h=j?j.convertFrameToView(b.get("frame"),null):b.get("frame");if(this.get("ghost")){this._dragViewWasVisible=b.get("isVisible");b.set("isVisible",NO)}if(this.ghostActsLikeCursor){this.ghostOffset={x:14,y:14}}else{this.ghostOffset={x:(e.x-h.x),y:(e.y-h.y)}}if(!this._ghostViewHidden){this._positionGhostView(i)}if(i.makeTouchResponder){var k=this;SC.Timer.schedule({target:i,action:function(){if(!i.hasEnded){i.makeTouchResponder(k,YES)}},interval:1})}else{this.ghostView.rootResponder.dragDidStart(this,i)}}var a=this.source;if(a&&a.dragDidBegin){a.dragDidBegin(this,e)}var c=this._dropTargets();for(var g=0,d=c.length;g<d;g++){var f=c[g];if(!f.get("isVisibleInWindow")){continue}f.tryToPerform("dragStarted",this,i)}},cancelDrag:function(a){var b=this._lastTarget;if(b&&b.dragExited){b.dragExited(this,this._lastMouseDraggedEvent)}this.endDrag(a,SC.DRAG_NONE)},endDrag:function(c,h){var g=this.get("location");var d=this._dropTargets();for(var b=0,a=d.length;b<a;b++){try{d[b].tryToPerform("dragEnded",this,c)}catch(e){SC.Logger.error("Exception in SC.Drag.mouseUp(dragEnded on %@): %@".fmt(d[b],e))}}if(this.get("sourceIsDraggable")&&this.get("slideBack")&&h===SC.DRAG_NONE){this._slideGhostViewBack()}else{this._endDrag()}var f=this.get("source");if(f){if(f.dragDidSucceed&&h!==SC.DRAG_NONE){f.dragDidSucceed(this,g,h)}else{if(f.dragDidCancel&&h===SC.DRAG_NONE){f.dragDidCancel(this,g,h)}}if(f.dragDidEnd){f.dragDidEnd(this,g,h)}}},touchStart:function(a){return YES},mouseDragged:function(a){var b=this._autoscroll(a);var f=this.get("location");if(!b&&(a.pageX===f.x)&&(a.pageY===f.y)){return}f={x:a.pageX,y:a.pageY};this.set("location",f);this._lastMouseDraggedEvent=a;var d=this.source;var c=this._lastTarget;var e=this._findDropTarget(a);var g=SC.DRAG_NONE;while(e&&(e!==c)&&(g===SC.DRAG_NONE)){if(e&&d&&d.dragSourceOperationMaskFor){g=d.dragSourceOperationMaskFor(this,e)}else{g=SC.DRAG_ANY}if((g!==SC.DRAG_NONE)&&e&&e.computeDragOperations){g=g&e.computeDragOperations(this,a,g)}else{g=SC.DRAG_NONE}this.allowedDragOperations=g;if(g===SC.DRAG_NONE){e=this._findNextDropTarget(e)}}if(e!==c){if(c&&c.dragExited){c.dragExited(this,a)}if(e){if(e.dragEntered){e.dragEntered(this,a)}if(e.dragUpdated){e.dragUpdated(this,a)}}this._lastTarget=e}else{if(e&&e.dragUpdated){e.dragUpdated(this,a)}}if(d&&d.dragDidMove){d.dragDidMove(this,f)}if(this.get("sourceIsDraggable")&&!this._ghostViewHidden){this._positionGhostView(a)}},touchesDragged:function(a){this.mouseDragged(a)},mouseUp:function(a){var d={x:a.pageX,y:a.pageY},c=this._lastTarget,f=this.allowedDragOperations;this.set("location",d);try{if(c&&c.acceptDragOperation&&c.acceptDragOperation(this,f)){f=c.performDragOperation?c.performDragOperation(this,f):SC.DRAG_NONE}else{f=SC.DRAG_NONE}}catch(b){SC.Logger.error("Exception in SC.Drag.mouseUp(acceptDragOperation|performDragOperation): %@".fmt(b))}this.endDrag(a,f)},touchEnd:function(a){this.mouseUp(a)},_getDragView:function(){if(!this.dragView){if(!this.source||!this.source.isView){throw new Error("Source can't be used as dragView, because it's not a view.")}this.dragView=this.source}return this.dragView},_createGhostView:function(){var b=this._getDragView(),d=b.get("borderFrame"),c,a;c={top:d.y,left:d.x,width:d.width,height:d.height};a=this.ghostView=SC.Pane.create({classNames:["sc-ghost-view"],layout:c,owner:this,wantsAcceleratedLayer:b.get("wantsAcceleratedLayer"),didCreateLayer:function(){if(b){var j=b.get("layer");if(j){var h=j.cloneNode(true);var l=b.$().find("canvas");if(l.length){var m=$(h).find("canvas"),f=l.length,g,k,e;for(g=0;g<f;g++){k=l[g];e=m[g];e.width=k.width;e.height=k.height;e.getContext("2d").drawImage(k,0,0)}}h.style.top="0px";h.style.left="0px";h.style.bottom="0px";h.style.right="0px";this.get("layer").appendChild(h)}}}});a.append()},_positionGhostView:function(a){var b=this.ghostView,c;if(b){c=this.get("location");c.x-=this.ghostOffset.x;c.y-=this.ghostOffset.y;b.adjust({top:c.y,left:c.x})}},_ghostViewHidden:NO,hideGhostView:function(){if(this.ghostView&&!this._ghostViewHidden){this.ghostView.remove();this._ghostViewHidden=YES}},unhideGhostView:function(){if(this._ghostViewHidden){this._ghostViewHidden=NO;this._createGhostView()}},_slideGhostViewBack:function(){if(this.ghostView){var b=this._getDragView(),e=b.get("borderFrame"),a=b.get("parentView"),d=a?a.convertFrameToView(e,null):b.get("frame"),c;c={top:d.y,left:d.x};this.ghostView.animate(c,0.5,this,function(){this.invokeNext(function(){var f=this.get("source");if(this.get("slideBack")&&f&&f.dragSlideBackDidEnd){f.dragSlideBackDidEnd(this)}this._endDrag()})})}else{this._endDrag()}},_destroyGhostView:function(){if(this.ghostView){this.ghostView.remove();this.ghostView=null;this._ghostViewHidden=NO}},_endDrag:function(){if(this.get("sourceIsDraggable")){this._destroyGhostView();if(this.get("ghost")){if(this._dragViewWasVisible){this._getDragView().set("isVisible",YES)}this._dragViewWasVisible=null}}this._cleanUpDrag()},_cleanUpDrag:function(){this._lastTarget=null;this._dragInProgress=NO;this._cachedDropTargets=null},_dropTargets:function(){if(this._cachedDropTargets){return this._cachedDropTargets}var b=[];var d=SC.Drag._dropTargets;for(var c in d){if(d.hasOwnProperty(c)){b.push(d[c])}}var f={};var e=SC.Drag._dropTargets;var a=function(g){if(!g){return 0}var i=SC.guidFor(g);var h=f[i];if(!h){h=1;while((g=g.get("parentView"))){if(e[SC.guidFor(g)]!==undefined){h=h+1}if(g.isPane&&g.isMainPane){h=h+10000}}f[i]=h}return h};b.sort(function(h,g){if(h===g){return 0}h=a(h);g=a(g);return(h>g)?-1:1});this._cachedDropTargets=b;return b},_findDropTarget:function(c){var g={x:c.pageX,y:c.pageY};var e,f;var d=this._dropTargets();for(var b=0,a=d.length;b<a;b++){e=d[b];if(!e.get("isVisibleInWindow")){continue}f=e.convertFrameToView(e.get("clippingFrame"),null);if(SC.pointInRect(g,f)){return e}}return null},_findNextDropTarget:function(a){var b=SC.Drag._dropTargets;while((a=a.get("parentView"))){if(b[SC.guidFor(a)]){return a}}return null},_autoscroll:function(k){if(!k){k=this._lastAutoscrollEvent}if(!this._dragInProgress){return NO}var e=k?{x:k.pageX,y:k.pageY}:this.get("location"),g=this._findScrollableView(e),l=null,j,b,c,h,a,d;while(g&&!l){j=g.get("canScrollVertical")?1:0;b=g.get("canScrollHorizontal")?1:0;if(j||b){a=g.get("containerView");if(a){d=g.convertFrameToView(a.get("frame"),null)}else{j=b=0}}if(j){h=SC.maxY(d);c=h-SC.DRAG_AUTOSCROLL_ZONE_THICKNESS;if(e.y>=c&&e.y<=h){j=1}else{c=SC.minY(d);h=c+SC.DRAG_AUTOSCROLL_ZONE_THICKNESS;if(e.y>=c&&e.y<=h){j=-1}else{j=0}}}if(b){h=SC.maxX(d);c=h-SC.DRAG_AUTOSCROLL_ZONE_THICKNESS;if(e.x>=c&&e.x<=h){b=1}else{c=SC.minX(d);h=c+SC.DRAG_AUTOSCROLL_ZONE_THICKNESS;if(e.x>=c&&e.x<=h){b=-1}else{b=0}}}if(j||b){l=g}else{g=this._findNextScrollableView(g)}}if(l&&(this._lastScrollableView===l)){if((Date.now()-this._hotzoneStartTime)>100){this._horizontalScrollAmount*=1.05;this._verticalScrollAmount*=1.05}}else{this._lastScrollableView=l;this._horizontalScrollAmount=15;this._verticalScrollAmount=15;this._hotzoneStartTime=(l)?Date.now():null;b=j=0}if(l&&(b||j)){var i={x:b*this._horizontalScrollAmount,y:j*this._verticalScrollAmount};l.scrollBy(i)}if(l){if(k){this._lastAutoscrollEvent={pageX:k.pageX,pageY:k.pageY}}this.invokeLater(this._autoscroll,100,null);return YES}else{this._lastAutoscrollEvent=null;return NO}},_scrollableViews:function(){if(this._cachedScrollableView){return this._cachedScrollableView}var a=[];var c=SC.Drag._scrollableViews;for(var b in c){if(c.hasOwnProperty(b)){a.push(c[b])}}a=a.sort(function(f,d){var e=f;while((e=e.get("parentView"))){if(d===e){return -1}}return 1});this._cachedScrollableView=a;return a},_findScrollableView:function(f){var c=this._scrollableViews(),b=c?c.length:0,d,e,a;for(a=0;a<b;a++){d=c[a];if(!d.get("isVisibleInWindow")){continue}e=d.convertFrameToView(d.get("clippingFrame"),null);if(SC.pointInRect(f,e)){return d}}return null},_findNextScrollableView:function(a){var b=SC.Drag._scrollableViews;while((a=a.get("parentView"))){if(b[SC.guidFor(a)]){return a}}return null}});SC.Drag.mixin({start:function(b){var a=this.create(b);a.startDrag();return a},_dropTargets:{},_scrollableViews:{},addDropTarget:function(a){this._dropTargets[SC.guidFor(a)]=a},removeDropTarget:function(a){delete this._dropTargets[SC.guidFor(a)]},addScrollableView:function(a){this._scrollableViews[SC.guidFor(a)]=a},removeScrollableView:function(a){delete this._scrollableViews[SC.guidFor(a)]}});SC.CheckboxView=SC.ButtonView.extend({classNames:["sc-checkbox-view","sc-checkbox-control"],ariaRole:"checkbox",themeName:null,renderDelegateName:"checkboxRenderDelegate",needsEllipsis:NO,acceptsFirstResponder:function(){if(SC.FOCUS_ALL_CONTROLS){return this.get("isEnabledInPane")}return NO}.property("isEnabledInPane"),_toggleValue:function(){var a=this.get("value")===this.get("toggleOnValue");this.set("value",a?this.get("toggleOffValue"):this.get("toggleOnValue"))},mouseDown:function(a){if(a.which&&a.which!==1){return false}if(!this.get("isEnabledInPane")){return YES}this.set("isActive",YES);this._isMouseDown=YES;if(a&&this.get("acceptsFirstResponder")){a.allowDefault()}return YES},mouseUp:function(a){if(!this.get("isEnabledInPane")){return YES}this.set("isActive",NO);this._isMouseDown=NO;if(this.get("buttonBehavior")!==SC.HOLD_BEHAVIOR){if(this.$().within(a.target)){this._toggleValue();this._action(a)}}return YES},keyDown:function(b){if(!this.get("isEnabledInPane")){return YES}if(b.which===9||b.keyCode===9){var a=b.shiftKey?this.get("previousValidKeyView"):this.get("nextValidKeyView");if(a){a.becomeFirstResponder()}else{b.allowDefault()}return YES}if(b.which===13||b.which===32){this._toggleValue();if(this.get("buttonBehavior")!==SC.HOLD_BEHAVIOR){if(this.$().within(b.target)){this._action(b)}}return YES}b.allowDefault();return NO},touchStart:function(a){return this.mouseDown(a)},touchEnd:function(a){return this.mouseUp(a)}});sc_require("mixins/collection_view_delegate");SC.DRAG_REORDER=16;SC.CollectionView=SC.View.extend(SC.ActionSupport,SC.CollectionViewDelegate,SC.CollectionContent,{_content:null,_cv_actionTimer:null,_cv_contentRangeObserver:null,_cv_selection:null,_pools:null,_sc_clearMouseJustDownTimer:null,_sc_isMouseDown:false,_sc_isMouseJustDown:false,_sc_itemViews:null,_TMP_DIFF1:SC.IndexSet.create(),_TMP_DIFF2:SC.IndexSet.create(),classNames:["sc-collection-view"],displayProperties:["isActive"],renderDelegateName:"collectionRenderDelegate",ACTION_DELAY:200,useFastPath:NO,content:null,contentBindingDefault:SC.Binding.multiple(),length:0,nowShowing:function(){var a=this.get("clippingFrame");return this.computeNowShowing(a)}.property("length","clippingFrame").cacheable(),selection:null,isSelectable:YES,isSelectableBindingDefault:SC.Binding.bool(),isEnabled:YES,isEnabledBindingDefault:SC.Binding.bool(),isEditable:YES,isEditableBindingDefault:SC.Binding.bool(),canReorderContent:NO,canReorderContentBindingDefault:SC.Binding.bool(),canDeleteContent:NO,canDeleteContentBindingDefault:SC.Binding.bool(),canEditContent:NO,canEditContentBindingDefault:SC.Binding.bool(),isDropTarget:NO,useToggleSelection:NO,actOnSelect:NO,selectOnMouseDown:YES,exampleView:SC.View,contentExampleViewKey:null,groupExampleView:null,contentGroupExampleViewKey:null,action:null,target:null,rightIconAction:null,rightIconTarget:null,contentValueKey:null,acceptsFirstResponder:NO,isActive:NO,calculatedHeight:0,calculatedWidth:0,adjustLayout:function(){var a=this.computeLayout();if(a){this.adjust(a)}},computeLayout:function(){return null},layoutForContentIndex:function(a){return null},allContentIndexes:function(){return SC.IndexSet.create(0,this.get("length")).freeze()}.property("length").cacheable(),contentIndexesInRect:function(a){return null},computeNowShowing:function(d){var c=this.contentIndexesInRect(d);if(!c){c=this.get("allContentIndexes")}else{var b=this.get("length"),a=c.get("max");if(a>b){c=c.copy().remove(b,a-b).freeze()}}return c},showInsertionPoint:function(a,b){},hideInsertionPoint:function(){},delegate:null,selectionDelegate:function(){var a=this.get("delegate"),b=this.get("content");return this.delegateFor("isCollectionViewDelegate",a,b)}.property("delegate","content").cacheable(),contentDelegate:function(){var a=this.get("delegate"),b=this.get("content");return this.delegateFor("isCollectionContent",a,b)}.property("delegate","content").cacheable(),contentRangeDidChange:function(d,b,c,a){if(!b&&(c==="[]")){this.notifyPropertyChange("_contentGroupIndexes");this.reload(a)}else{this.contentPropertyDidChange(b,c,a)}},contentPropertyDidChange:function(c,b,a){},updateContentRangeObserver:function(){var d=this.get("nowShowing"),a=this._cv_contentRangeObserver,c=this.get("content");if(!c){return}if(a){c.updateRangeObserver(a,d)}else{var b=this.contentRangeDidChange;a=c.addRangeObserver(d,this,b,null);this._cv_contentRangeObserver=a}},removeContentRangeObserver:function(){var b=this.get("content"),a=this._cv_contentRangeObserver;if(a){if(b){b.removeRangeObserver(a)}this._cv_contentRangeObserver=null}},contentLengthDidChange:function(){var a=this.get("content");this.set("length",a?a.get("length"):0);this.invokeOnce(this.adjustLayout)},_cv_contentDidChange:function(){var c=this.get("content"),b=this.contentLengthDidChange;if(c===this._content){return}this.removeContentRangeObserver();if(this._content){this._content.removeObserver("length",this,b)}if(this._pools){for(var a in this._pools){this._pools[a].invoke("destroy")}this._pools=null}this._content=c;if(c){c.addObserver("length",this,b)}this.contentLengthDidChange();this.contentRangeDidChange(c,null,"[]",null)}.observes("content"),_invalidIndexes:NO,_isEnabledDidChange:function(){this.reload()}.observes("isEnabled","isEditable","canEditContent","canReorderContent","canDeleteContent"),reload:function(a){var c=this._invalidIndexes,b;if(a&&c!==YES){if(c){c.add(a)}else{c=this._invalidIndexes=a.clone()}b=this.get("length");if(b>1&&c.max===b){c.add(b-2)}}else{this._invalidIndexes=YES}if(this.get("isVisibleInWindow")){this.invokeOnce(this.reloadIfNeeded)}return this},reloadIfNeeded:function(){var f=this._invalidIndexes;if(!f||!this.get("isVisibleInWindow")){return this}this._invalidIndexes=NO;var b,d,e=this.get("nowShowing"),c=this._sc_itemViews||[],a;if(f.isIndexSet&&f.contains(e)){f=YES}if(f.isIndexSet){f.forEach(function(g){d=c[g];if(d){this._removeItemView(d,g)}if(e.contains(g)){this.itemViewForContentIndex(g,YES)}},this)}else{for(a=0,b=c.length;a<b;a++){d=c?c[a]:null;if(d){this._removeItemView(d,a)}}e.forEach(function(g){this.itemViewForContentIndex(g,YES)},this)}return this},_TMP_ATTRS:{},_COLLECTION_CLASS_NAMES:["sc-collection-item","sc-item"],_GROUP_COLLECTION_CLASS_NAMES:["sc-collection-item","sc-group-item"],itemViewForContentIndex:function(g,d){var c,i;if(SC.none(g)||g<0||g>=this.get("length")){return null}i=this._sc_itemViews;if(!i){i=this._sc_itemViews=[]}c=i[g];if(c){if(d){c.destroy();c=null}else{return c}}var h,f=this.get("containerView")||this,a,b,e;h=this._attrsForContentIndex(g);a=this._exampleViewForContentIndex(g);e=a.prototype;if(SC.none(e.isReusable)||e.isReusable){b=this._poolForExampleView(a);if(b.length>0){c=b.shift();this._reconfigureItemView(c,h);if(c.awakeFromPool){c.awakeFromPool(this)}if(!c.get("_isRendered")){c.invokeOnce(c._doRender)}}}if(!c){c=this.createItemView(a,g,h);f.insertBefore(c,null)}i[g]=c;return c},itemViewForContentObject:function(a){var b=this.get("content");if(!b){return null}var c=b.indexOf(a);if(c===-1){return null}return this.itemViewForContentIndex(c)},_TMP_LAYERID:[],createItemView:function(c,a,b){return c.create(b)},layerIdFor:function(a){var b=this._TMP_LAYERID;b[0]=this.get("layerId");b[1]=a;return b.join("-")},contentIndexForLayerId:function(c){if(!c||!(c=c.toString())){return null}var b=this.get("layerId")+"-";if((c.length<=b.length)||(c.indexOf(b)!==0)){return null}var a=Number(c.slice(c.lastIndexOf("-")+1));return isNaN(a)?null:a},itemViewForEvent:function(a){var b=this.getPath("pane.rootResponder");if(!b){return null}var d=a.target,c=this.get("layer"),f=null,e;while(d&&d!==document&&d!==c){e=d?SC.$(d).attr("id"):null;if(e&&(f=this.contentIndexForLayerId(e))!==null){break}d=d.parentNode}if(f===null||(d===c)){d=c=null;return null}if(f>=this.get("length")){throw new Error("layout for item view %@ was found when item view does not exist (%@)".fmt(e,this))}return this.itemViewForContentIndex(f)},expand:function(b){if(!b){return this}var a=this.get("contentDelegate"),c=this.get("content");b.forEach(function(d){var e=a.contentIndexDisclosureState(this,c,d);if(e===SC.BRANCH_CLOSED){a.contentIndexExpand(this,c,d)}},this);return this},collapse:function(b){if(!b){return this}var a=this.get("contentDelegate"),c=this.get("content");b.forEach(function(d){var e=a.contentIndexDisclosureState(this,c,d);if(e===SC.BRANCH_OPEN){a.contentIndexCollapse(this,c,d)}},this);return this},_cv_selectionDidChange:function(){var c=this.get("selection"),b=this._cv_selection,a=this._cv_selectionContentDidChange;if(c===b){return}if(b){b.removeObserver("[]",this,a)}if(c){c.addObserver("[]",this,a)}this._cv_selection=c;this._cv_selectionContentDidChange()}.observes("selection"),_cv_selectionContentDidChange:function(){var c=this.get("selection"),b=this._cv_selindexes,a=this.get("content"),d;this._cv_selindexes=c?c.frozenCopy():null;if(b){b=b.indexSetForSource(a)}if(c){c=c.indexSetForSource(a)}if(c&&b){d=c.without(b).add(b.without(c))}else{d=c||b}if(d&&d.get("length")>0){this.reloadSelectionIndexes(d)}},_invalidSelection:NO,reloadSelectionIndexes:function(a){var b=this._invalidSelection;if(a&&(b!==YES)){if(b){b.add(a)}else{b=this._invalidSelection=a.copy()}}else{this._invalidSelection=YES}if(this.get("isVisibleInWindow")){this.invokeOnce(this.reloadSelectionIndexesIfNeeded)}return this},reloadSelectionIndexesIfNeeded:function(){var e=this._invalidSelection;if(!e||!this.get("isVisibleInWindow")){return this}var d=this.get("nowShowing"),b=this._invalidIndexes,a=this.get("content"),c=this.get("selection");this._invalidSelection=NO;if(b===YES||!d){return this}if(e===YES){e=d}if(b&&b.isIndexSet){e=e.without(b)}e.forEach(function(f){if(!d.contains(f)){return}var g=this.itemViewForContentIndex(f,NO);if(g){g.set("isSelected",c?c.contains(a,f):NO)}},this);return this},select:function(c,f){var d=this.get("content"),a=this.get("selectionDelegate"),b=this.get("_contentGroupIndexes"),e;if(!this.get("isSelectable")||!this.get("isEnabledInPane")){return this}if(SC.typeOf(c)===SC.T_NUMBER){c=SC.IndexSet.create(c,1)}if(c&&c.get("length")>0){if(b&&b.get("length")>0){c=c.copy().remove(b)}c=a.collectionViewShouldSelectIndexes(this,c,f);if(!c||c.get("length")===0){return this}}else{c=null}if(f&&(e=this.get("selection"))){e=e.copy()}else{e=SC.SelectionSet.create()}if(c&&c.get("length")>0){if(c.get("length")===1&&!this.get("allowDuplicateItems")){e.addObject(d.objectAt(c.get("firstObject")))}else{e.add(d,c)}}e=a.collectionViewSelectionForProposedSelection(this,e);if(!e){e=SC.SelectionSet.create()}this._selectionAnchor=null;this.set("selection",e.freeze());return this},deselect:function(b){var d=this.get("selection"),c=this.get("content"),a=this.get("selectionDelegate");if(!this.get("isSelectable")||!this.get("isEnabledInPane")){return this}if(!d||d.get("length")===0){return this}if(SC.typeOf(b)===SC.T_NUMBER){b=SC.IndexSet.create(b,1)}b=a.collectionViewShouldDeselectIndexes(this,b);if(!b||b.get("length")===0){return this}d=d.copy().remove(c,b);d=a.collectionViewSelectionForProposedSelection(this,d);if(!d){d=SC.SelectionSet.create()}this.set("selection",d.freeze());return this},_findNextSelectableItemFromIndex:function(b,d){var h=this.get("length"),c=SC.IndexSet.create(),a=this.get("selectionDelegate"),f=this.get("_contentGroupIndexes"),e,g;if(!f&&(a.collectionViewShouldSelectIndexes===this.collectionViewShouldSelectIndexes)){return b}while(b<h){if(!f||!f.contains(b)){c.add(b);e=a.collectionViewShouldSelectIndexes(this,c);if(e&&e.get("length")>=1){return b}c.remove(b)}b++}if(d===undefined){g=this.get("selection");d=g?g.get("max"):-1}return d},_findPreviousSelectableItemFromIndex:function(b,g){var c=SC.IndexSet.create(),a=this.get("selectionDelegate"),e=this.get("_contentGroupIndexes"),d;if(SC.none(b)){b=-1}if(!e&&(a.collectionViewShouldSelectIndexes===this.collectionViewShouldSelectIndexes)){return b}while(b>=0){if(!e||!e.contains(b)){c.add(b);d=a.collectionViewShouldSelectIndexes(this,c);if(d&&d.get("length")>=1){return b}c.remove(b)}b--}if(g===undefined){var f=this.get("selection");g=f?f.get("min"):-1}if(SC.none(g)){g=-1}return g},selectPreviousItem:function(h,b){if(SC.none(b)){b=1}if(SC.none(h)){h=false}var f=this.get("selection"),e=this.get("content");if(f){f=f.indexSetForSource(e)}var g=f?f.get("min"):-1,a=f?f.get("max")-1:-1,d=this._selectionAnchor;if(SC.none(d)){d=g}if(h){if(a>d){a=a-b}else{g=this._findPreviousSelectableItemFromIndex(g-b)}if(SC.none(g)||(g<0)){g=0}if(!e.objectAt(g)){g=f?f.get("min"):-1}if(a<g){a=g}}else{g=this._findPreviousSelectableItemFromIndex(g-b);if(SC.none(g)||(g<0)){g=0}if(!e.objectAt(g)){g=f?f.get("min"):-1}a=g;d=null}var c=g;f=SC.IndexSet.create(g,a+1-g);this.scrollToContentIndex(c);this.select(f);this._selectionAnchor=d;return this},selectNextItem:function(h,i){if(SC.none(i)){i=1}if(SC.none(h)){h=false}var b=this.get("selection"),g=this.get("content");if(b){b=b.indexSetForSource(g)}var a=b?b.get("min"):-1,d=b?b.get("max")-1:-1,e=this._selectionAnchor,c=this.get("length");if(SC.none(e)){e=a}if(h){if(a<e){a=a+i}else{d=this._findNextSelectableItemFromIndex(d+i,d)}if(d>=c){d=c-1}if(!g.objectAt(d)){d=b?b.get("max")-1:-1}if(a>d){a=d}}else{d=this._findNextSelectableItemFromIndex(d+i,d);if(d>=c){d=c-1}if(!g.objectAt(d)){d=b?b.get("max")-1:-1}a=d;e=null}var f=d;b=SC.IndexSet.create(a,d-a+1);this.scrollToContentIndex(f);this.select(b);this._selectionAnchor=e;return this},deleteSelection:function(){if(!this.get("isEditable")||!this.get("canDeleteContent")){return NO}var d=this.get("selection"),c=this.get("content"),a=this.get("selectionDelegate"),b=d&&c?d.indexSetForSource(c):null;if(!c||!b||b.get("length")===0){return NO}b=a.collectionViewShouldDeleteIndexes(this,b);if(!b||b.get("length")===0){return NO}a.collectionViewDeleteContent(this,this.get("content"),b);return YES},scrollToContentIndex:function(b){var a=this.itemViewForContentIndex(b);if(a){this.scrollToItemView(a)}return this},scrollToItemView:function(a){if(a){a.scrollToVisible()}return this},keyDown:function(a){var b=this.interpretKeyEvents(a);return !b?NO:b},keyUp:function(){return true},insertText:function(b,a){if(b===" "){var c=this.get("selection");if(c&&c.get("length")>0){this.invokeLater(this._cv_action,0,null,a)}return YES}else{return NO}},selectAll:function(b){var c=this.get("content"),a=this.delegateFor("allowsMultipleSelection",this.get("delegate"),c);if(a&&a.get("allowsMultipleSelection")){var d=c?SC.IndexSet.create(0,c.get("length")):null;this.select(d,NO)}return YES},deselectAll:function(){var b=this.get("content"),a=this.delegateFor("allowsEmptySelection",this.get("delegate"),b);if(a&&a.get("allowsEmptySelection")){var c=b?SC.IndexSet.create(0,b.get("length")):null;this.deselect(c,NO)}return YES},deleteBackward:function(a){return this.deleteSelection()},deleteForward:function(a){return this.deleteSelection()},moveDown:function(b,a){this.selectNextItem(false,this.get("itemsPerRow")||1);this._cv_performSelectAction(null,a,this.ACTION_DELAY);return true},moveUp:function(b,a){this.selectPreviousItem(false,this.get("itemsPerRow")||1);this._cv_performSelectAction(null,a,this.ACTION_DELAY);return true},moveLeft:function(k){if(k.ctrlKey||k.metaKey){return NO}if((this.get("itemsPerRow")||1)>1){this.selectPreviousItem(false,1);this._cv_performSelectAction(null,k,this.ACTION_DELAY)}else{var c=this.get("selection"),i=this.get("content"),g=c?c.indexSetForSource(i):null;if(g){var l,f=false,h;if(g.get("length")===1){h=g.get("firstObject");l=this.get("contentDelegate");var b=l.contentIndexDisclosureState(this,i,h);if(b!==SC.BRANCH_OPEN){f=true}}if(f){var a=l.contentIndexOutlineLevel(this,i,h)-1;if(a>=0){var e=-1;while(e<0){var d=this._findPreviousSelectableItemFromIndex(h-1);if(d<0){return false}h=d;var j=l.contentIndexOutlineLevel(this,i,h);if(j===a){e=d}}if(e!==-1){this.select(h)}}}else{this.collapse(g)}}}return true},moveRight:function(a){if(a.ctrlKey||a.metaKey){return NO}if((this.get("itemsPerRow")||1)>1){this.selectNextItem(false,1);this._cv_performSelectAction(null,a,this.ACTION_DELAY)}else{var d=this.get("selection"),c=this.get("content"),b=d?d.indexSetForSource(c):null;if(b){this.expand(b)}}return true},moveDownAndModifySelection:function(c,b){var d=this.get("content"),a=this.delegateFor("allowsMultipleSelection",this.get("delegate"),d);if(a&&a.get("allowsMultipleSelection")){this.selectNextItem(true,this.get("itemsPerRow")||1);this._cv_performSelectAction(null,b,this.ACTION_DELAY)}return true},moveUpAndModifySelection:function(c,b){var d=this.get("content"),a=this.delegateFor("allowsMultipleSelection",this.get("delegate"),d);if(a&&a.get("allowsMultipleSelection")){this.selectPreviousItem(true,this.get("itemsPerRow")||1);this._cv_performSelectAction(null,b,this.ACTION_DELAY)}return true},moveLeftAndModifySelection:function(b,a){if((this.get("itemsPerRow")||1)>1){this.selectPreviousItem(true,1);this._cv_performSelectAction(null,a,this.ACTION_DELAY)}return true},moveRightAndModifySelection:function(b,a){if((this.get("itemsPerRow")||1)>1){this.selectNextItem(true,1);this._cv_performSelectAction(null,a,this.ACTION_DELAY)}return true},insertNewline:function(c,i){var d=this.get("isEditable")&&this.get("canEditContent"),a=false,b,e,g,h,f;if(d){b=this.get("selection");e=this.get("content");if(b&&b.get("length")===1){g=b.indexSetForSource(e);h=g?g.get("min"):-1;f=this.itemViewForContentIndex(h);a=f&&SC.typeOf(f.beginEditing)===SC.T_FUNCTION}}if(a){this.scrollToContentIndex(h);f.beginEditing()}else{this.invokeLater(this._cv_action,0,f,null)}return YES},insertTab:function(b){var a=this.get("nextValidKeyView");if(a){a.becomeFirstResponder()}else{b.allowDefault()}return YES},insertBacktab:function(b){var a=this.get("previousValidKeyView");if(a){a.becomeFirstResponder()}else{b.allowDefault()}return YES},doubleClick:function(c){var b=this.get("isEnabledInPane"),e=false;if(b){var d=this.get("action");if(d){var a=this.itemViewForEvent(c);this._cv_performSelectAction(a,c,0,c.clickCount);e=true}}return e},mouseDown:function(m){var g=this.get("isEnabledInPane"),e=this.get("isSelectable"),h=false;if(g&&e){var j=this.get("content");h=true;if(j){var k=this.itemViewForEvent(m),l=j.get("allowsMultipleSelection"),i=false,b,a,f;this.becomeFirstResponder();f=k?k.get("contentIndex"):-1;if(this.get("useToggleSelection")){if(this.get("selectOnMouseDown")&&k){b=this.get("selection");a=b&&b.contains(j,f,1);if(a){this.deselect(f)}else{if(!l){this.select(f,false);i=true}else{this.select(f,true);i=true}}}}else{var c,d,n;if(!k){if(this.get("allowDeselectAll")){this.select(null,false)}}else{b=this.get("selection");if(b){b=b.indexSetForSource(j)}c=this.mouseDownInfo={event:m,itemView:k,contentIndex:f,at:Date.now()};a=b?b.contains(f):NO;c.modifierKeyPressed=n=m.ctrlKey||m.metaKey;if(n&&a){c.shouldDeselect=f>=0}else{if(m.shiftKey&&b&&b.get("length")>0&&l){b=this._findSelectionExtendedByShift(b,f);d=this._selectionAnchor;this.select(b);i=true;this._selectionAnchor=d}else{if(!n&&a){c.shouldReselect=f>=0}else{if((m.shiftKey||n)&&!l){this.select(null,false);i=true}if(this.get("selectOnMouseDown")){this.select(f,n);i=true}else{c.shouldSelect=f>=0}}}}c.previousContentIndex=f}}if(i&&this.get("actOnSelect")){this._cv_performSelectAction(k,m)}}}if(h){this._sc_isMouseDown=true}return h},mouseUp:function(l){var g=this.get("isEnabledInPane"),e=this.get("isSelectable");if(g&&e){var i=this.get("content");if(i){var j=this.itemViewForEvent(l),d=this.mouseDownInfo,h=false,c,b,f;f=j?j.get("contentIndex"):-1;if(this.get("useToggleSelection")){if(!this.get("selectOnMouseDown")&&j){var k=i.get("allowsMultipleSelection");c=this.get("selection");b=c&&c.contains(i,f,1);if(b){this.deselect(f)}else{if(!k){this.select(f,false);h=true}else{this.select(f,true);h=true}}}}else{if(d){var m=d.contentIndex;if(d.shouldSelect){this.select(m,d.modifierKeyPressed);h=true}if(d.shouldDeselect){this.deselect(m)}if(d.shouldReselect){var a=this.get("isEditable")&&this.get("canEditContent");if(a){c=this.get("selection");a=c&&(c.get("length")===1)}if(a){j=this.itemViewForContentIndex(m);a=j&&(!j.contentHitTest||j.contentHitTest(l));a=(a&&j.beginEditing)?j.beginEditing():NO}if(!a){if(this._cv_reselectTimer){this._cv_reselectTimer.invalidate()}this._cv_reselectTimer=this.invokeLater(this.select,300,m,false)}}this._cleanupMouseDown()}}if(h&&this.get("actOnSelect")){this._cv_performSelectAction(j,l)}}this._sc_isMouseJustDown=true;this._sc_clearMouseJustDownTimer=this.invokeLater(this._sc_clearMouseJustDown,250)}this._sc_isMouseDown=false;return false},_cleanupMouseDown:function(){var b=this.mouseDownInfo,a;if(b){for(a in b){if(!b.hasOwnProperty(a)){continue}delete b[a]}}this.mouseDownInfo=null},mouseMoved:function(c){var a=this.itemViewForEvent(c),b=this._lastHoveredItem;if(a!==b){if(b&&b.mouseExited){b.mouseExited(c)}if(a&&a.mouseEntered){a.mouseEntered(c)}}this._lastHoveredItem=a;if(a&&a.mouseMoved){a.mouseMoved(c)}return YES},mouseExited:function(b){var a=this._lastHoveredItem;this._lastHoveredItem=null;if(a&&a.mouseExited){a.mouseExited(b)}return YES},mouseWheel:function(a){return this._sc_isMouseDown||this._sc_isMouseJustDown},touchStart:function(d,a){var b=this.itemViewForEvent(d),c=b?b.get("contentIndex"):-1;if(!this.get("isEnabledInPane")){return c>-1}this.becomeFirstResponder();this._touchSelectedView=b;if(!this.get("useToggleSelection")){if(b&&!b.get("isSelected")){b.set("isSelected",YES)}}return YES},touchesDragged:function(a,b){b.forEach(function(c){if(Math.abs(c.pageX-c.startX)>5||Math.abs(c.pageY-c.startY)>5){c.makeTouchResponder(c.nextTouchResponder)}},this)},touchEnd:function(g){var d=this.get("content"),c=this._touchSelectedView,f=c?c.get("contentIndex"):-1,a=NO,e,b;if(!this.get("isEnabledInPane")){return f>-1}if(f>-1){if(this.get("useToggleSelection")){e=this.get("selection");a=e&&e.contains(d,f,1);b=!a}else{b=true}if(b){this.select(f,NO);this._cv_performSelectAction(c,g,0)}else{this.deselect(f)}}this._touchSelectedView=null},touchCancelled:function(a){if(this._touchSelectedView){this._touchSelectedView.set("isSelected",NO);this._touchSelectedView=null}},_findSelectionExtendedByShift:function(d,e){if(!d||d.get("length")===0){return SC.IndexSet.create(e)}var c=d.get("min"),a=d.get("max")-1,b=this._selectionAnchor;if(SC.none(b)){b=-1}if(e<c){c=e;if(b<0){this._selectionAnchor=b=a}}else{if(e>a){a=e;if(b<0){this._selectionAnchor=b=c}}else{if(e>=c&&e<=a){if(b<0){this._selectionAnchor=b=c}if(e===b){c=a=e}else{if(e>b){c=b;a=e}else{if(e<b){c=e;a=b}}}}}}return SC.IndexSet.create(c,a-c+1)},reorderDataType:function(){return"SC.CollectionView.Reorder."+SC.guidFor(this)}.property().cacheable(),dragContent:null,proposedInsertionIndex:null,proposedDropOperation:null,mouseDragged:function(h){var i=this.get("selectionDelegate"),e=this.get("content"),a=this.get("selection"),c=this.mouseDownInfo,f=this.get("_contentGroupIndexes"),d,b,g;if(!c||c.contentIndex<0){return YES}if((Date.now()-c.at)<123){return YES}if(this.get("isEditable")&&i.collectionViewShouldBeginDrag(this)){if(!this.get("selectOnMouseDown")){d=SC.IndexSet.create(c.contentIndex)}else{d=a?a.indexSetForSource(e):null}if(d&&f&&f.get("length")>0){d=d.copy().remove(f);if(d.get("length")===0){d=null}else{d.freeze()}}if(!d){return YES}else{d=d.frozenCopy()}d={content:e,indexes:d};this.set("dragContent",d);b=this.get("dragDataTypes");if(b&&b.get("length")>0){g=i.collectionViewDragViewFor(this,d.indexes);if(!g){g=this._cv_dragViewFor(d.indexes)}SC.Drag.start({event:c.event,source:this,dragView:g,ghost:NO,ghostActsLikeCursor:i.ghostActsLikeCursor,slideBack:YES,dataSource:this});this._cleanupMouseDown();this._lastInsertionIndex=null}else{this.set("dragContent",null)}return YES}},_cv_dragViewFor:function(f){var c=this.get("nowShowing").without(f),d=this.get("layer").cloneNode(false),b=SC.View.create({layer:d,parentView:this}),a=0,e;c=this.get("nowShowing").without(c);SC.$(d).css("backgroundColor","transparent").css("border","none").css("top",0).css("left",0);c.forEach(function(j){var o=this.itemViewForContentIndex(j),g,l,m;if(o){g=o.get("isSelected");o.set("isSelected",NO);o.updateLayerIfNeeded();l=o.get("layer");if(l){m=l.cloneNode(true);var p=o.$().find("canvas");if(p){var h=$(m).find("canvas"),n=p.length,k,q;for(j=0;j<n;j++){k=p[j];q=h[j];q.height=k.height;q.width=k.width;q.getContext("2d").drawImage(k,0,0)}}}o.set("isSelected",g);o.updateLayerIfNeeded()}if(m){d.appendChild(m);e=o.get("layout");if(e.height+e.top>a){a=e.height+e.top}}m=null},this);b.set("layout",{height:a});d=null;return b},dragDataTypes:function(){var a=this.get("selectionDelegate"),b=a.collectionViewDragDataTypes(this),c;if(this.get("canReorderContent")){b=b?b.copy():[];c=this.get("reorderDataType");if(b.indexOf(c)<0){b.push(c)}}return b?b:[]}.property(),dragDataForType:function(c,b){if(this.get("canReorderContent")){if(b===this.get("reorderDataType")){return this.get("dragContent")}}var a=this.get("selectionDelegate");return a.collectionViewDragDataForType(this,c,b)},computeDragOperations:function(c,b){var d=SC.DRAG_NONE,a=this.get("selectionDelegate");if(this.get("canReorderContent")){if(c.get("dataTypes").indexOf(this.get("reorderDataType"))>=0){d=SC.DRAG_REORDER}}d=a.collectionViewComputeDragOperations(this,c,d);if(d&SC.DRAG_REORDER){d=SC.DRAG_MOVE}return d},_computeDropOperationState:function(c,l,e){var g=this.convertFrameFromView(c.get("location"),null),k=SC.DROP_BEFORE,m=this.get("selectionDelegate"),d=this.get("canReorderContent"),n,h,a,i,f,b;var j=this.insertionIndexForLocation(g,SC.DROP_ON);if(SC.typeOf(j)===SC.T_ARRAY){k=j[1];j=j[0]}if(k===SC.DROP_ON){this.set("proposedInsertionIndex",j);this.set("proposedDropOperation",k);b=m.collectionViewValidateDragOperation(this,c,e,j,k);j=this.get("proposedInsertionIndex");k=this.get("proposedDropOperation");this._dropInsertionIndex=this._dropOperation=null;if(b!==SC.DRAG_NONE){return[j,k,b]}else{k=SC.DROP_BEFORE;j=this.insertionIndexForLocation(g,SC.DROP_BEFORE);if(SC.typeOf(j)===SC.T_ARRAY){k=j[1];j=j[0]}}}if((j>=0)&&d&&(k!==SC.DROP_ON)){n=c.dataForType(this.get("reorderDataType"));if(n){h=this.get("content");if(k===SC.DROP_BEFORE){a=n.indexes.contains(j-1);i=n.indexes.contains(j)}else{a=n.indexes.contains(j);i=n.indexes.contains(j-1)}if(a&&i){if(SC.none(this._lastInsertionIndex)){if(k===SC.DROP_BEFORE){while((j>=0)&&n.indexes.contains(j)){j--}}else{f=h?h.get("length"):0;while((j<f)&&n.indexes.contains(j)){j++}}}else{j=this._lastInsertionIndex}}if(j>=0){e=SC.DRAG_REORDER}}}this.set("proposedInsertionIndex",j);this.set("proposedDropOperation",k);e=m.collectionViewValidateDragOperation(this,c,e,j,k);j=this.get("proposedInsertionIndex");k=this.get("proposedDropOperation");this._dropInsertionIndex=this._dropOperation=null;return[j,k,e]},dragUpdated:function(f,b){var h=f.get("allowedDragOperations"),g=this._computeDropOperationState(f,b,h),a=g[0],c=g[1],e=g[2];if(e!==SC.DRAG_NONE){if((this._lastInsertionIndex!==a)||(this._lastDropOperation!==c)){var d=this.itemViewForContentIndex(a);this.showInsertionPoint(d,c)}this._lastInsertionIndex=a;this._lastDropOperation=c}else{this.hideInsertionPoint();this._lastInsertionIndex=this._lastDropOperation=null}return(e&SC.DRAG_REORDER)?SC.DRAG_MOVE:e},dragEnded:function(){this.hideInsertionPoint();this._lastInsertionIndex=this._lastDropOperation=null},acceptDragOperation:function(a,b){return YES},performDragOperation:function(e,g){var a=this._computeDropOperationState(e,null,g),k=a[0],j=a[1],h=a[2],l=this.get("selectionDelegate"),c,m,d,i,b,f;if(h&SC.DRAG_REORDER){g=(g&SC.DRAG_MOVE)?SC.DRAG_REORDER:SC.DRAG_NONE}else{g=g&h}if(g===SC.DRAG_NONE){return g}c=l.collectionViewPerformDragOperation(this,e,g,k,j);if((c===SC.DRAG_NONE)&&(g&SC.DRAG_REORDER)){d=e.dataForType(this.get("reorderDataType"));if(!d){return SC.DRAG_NONE}i=this.get("content");f=d.indexes;if(f.get("length")===1){if(((j===SC.DROP_BEFORE)||(j===SC.DROP_AFTER))&&(f.get("min")===k)){return SC.DRAG_MOVE}}i.beginPropertyChanges();m=[];b=0;d.indexes.forEach(function(n){m.push(i.objectAt(n-b));i.removeAt(n-b);b++;if(n<k){k--}},this);if(j===SC.DROP_AFTER){k++}i.replace(k,0,m,j);this.select(SC.IndexSet.create(k,m.length));i.endPropertyChanges();g=SC.DRAG_MOVE}return g},collectionViewShouldBeginDrag:function(a){return this.get("canReorderContent")},insertionIndexForLocation:function(a,b){return -1},_sc_clearMouseJustDown:function(){this._sc_isMouseJustDown=false},willShowInDocument:function(){if(this._invalidIndexes){this.invokeOnce(this.reloadIfNeeded)}if(this._invalidSelection){this.invokeOnce(this.reloadSelectionIndexesIfNeeded)}},didAppendToDocument:function(){if(this._invalidIndexes){this.invokeOnce(this.reloadIfNeeded)}if(this._invalidSelection){this.invokeOnce(this.reloadSelectionIndexesIfNeeded)}},collectionViewShouldSelectItem:function(a,b){return this.get("isSelectable")},_cv_nowShowingDidChange:function(){var b=this.get("nowShowing"),a=this._sccv_lastNowShowing,d,e,c;if(a!==b){if(a&&b){e=this._TMP_DIFF1.add(a).remove(b);c=this._TMP_DIFF2.add(b).remove(a);d=e.add(c)}else{d=a||b}}if(d&&d.get("length")>0){this._sccv_lastNowShowing=b?b.frozenCopy():null;this.updateContentRangeObserver();this.reload(d)}if(e){e.clear()}if(c){c.clear()}}.observes("nowShowing"),init:function(){arguments.callee.base.apply(this,arguments);if(this.get("canReorderContent")){this._cv_canReorderContentDidChange()}this._sccv_lastNowShowing=this.get("nowShowing").clone();if(this.content){this._cv_contentDidChange()}if(this.selection){this._cv_selectionDidChange()}this.adjustLayout()},destroy:function(){arguments.callee.base.apply(this,arguments);var a=this._content;if(a){a.removeObserver("length",this,this.contentLengthDidChange);this._content=null}var b=this._cv_selection;if(b){b.removeObserver("[]",this,this._cv_selectionContentDidChange);this._cv_selection=null}var c=this._cv_contentRangeObserver;if(c){if(a){a.removeRangeObserver(c)}this._cv_contentRangeObserver=null}},_cv_canReorderContentDidChange:function(){if(this.get("canReorderContent")){if(!this.get("isDropTarget")){this.set("isDropTarget",YES)}SC.Drag.addDropTarget(this)}}.observes("canReorderContent"),_cv_performSelectAction:function(b,d,c,a){var e;if(c===undefined){c=0}if(a===undefined){a=1}if((a>1)||this.get("actOnSelect")){if(this._cv_reselectTimer){this._cv_reselectTimer.invalidate()}e=this.get("selection");e=e?e.toArray():[];if(this._cv_actionTimer){this._cv_actionTimer.invalidate()}this._cv_actionTimer=this.invokeLater(this._cv_action,c,b,d,e)}},_cv_action:function(b,a,c){var d=this.get("action");this._cv_actionTimer=null;if(d){if(d&&(SC.typeOf(d)===SC.T_FUNCTION)){return this.action(b,a)}else{return this.fireAction(c)}}else{if(!b){return}else{if(SC.typeOf(b._action)===SC.T_FUNCTION){return b._action(a)}else{if(SC.typeOf(b.action)===SC.T_FUNCTION){return b.action(a)}}}}},_attrsForContentIndex:function(j){var k=this._TMP_ATTRS,l=this.get("contentDelegate"),g=this.get("content"),c=this._contentIndexIsGroup(j),m=this.get("isEditable")&&this.get("canEditContent"),b=this.get("isEditable")&&this.get("canReorderContent"),e=this.get("isEditable")&&this.get("canDeleteContent"),i=l.contentIndexIsEnabled(this,g,j),a=l.contentIndexIsSelected(this,g,j),h=l.contentIndexOutlineLevel(this,g,j),f=l.contentIndexDisclosureState(this,g,j);k.contentIndex=j;k.content=g.objectAt(j);k.disclosureState=f;k.isEnabled=i;k.isEditable=m;k.isReorderable=b;k.isDeletable=e;k.isSelected=a;k.isGroupView=c;k.layerId=this.layerIdFor(j);k.owner=k.displayDelegate=this;k.page=this.page;k.outlineLevel=h;k.isLast=j===g.get("length")-1;if(c){k.classNames=this._GROUP_COLLECTION_CLASS_NAMES}else{k.classNames=this._COLLECTION_CLASS_NAMES}var d=this.layoutForContentIndex(j);if(d){k.layout=d}else{delete k.layout}return k},_contentGroupIndexes:function(){return this.get("contentDelegate").contentGroupIndexes(this,this.get("content"))}.property("contentDelegate").cacheable(),_contentIndexIsGroup:function(a){var d=this.get("_contentGroupIndexes");if(d&&d.contains(a)){var b=this.get("contentDelegate"),c=this.get("content");return b.contentIndexIsGroup(this,c,a)}else{return false}},_exampleViewForContentIndex:function(b){var d,a,c=this.get("content"),e=c.objectAt(b);if(this._contentIndexIsGroup(b)){d=this.get("contentGroupExampleViewKey");if(d&&e){a=e.get(d)}if(!a){a=this.get("groupExampleView")||this.get("exampleView")}}else{d=this.get("contentExampleViewKey");if(d&&e){a=e.get(d)}if(!a){a=this.get("exampleView")}}return a},_poolForExampleView:function(a){var b=SC.guidFor(a);if(!this._pools){this._pools={}}if(!this._pools[b]){this._pools[b]=[]}return this._pools[b]},_poolLayoutForContentIndex:function(b){var a=this.layoutForContentIndex(b);if(a&&a.height){if(a.top){a.top=-a.height}else{a.bottom=-a.height}}else{if(a&&a.width){if(a.left){a.left=-a.width}else{a.right=-a.width}}}return a},_reconfigureItemView:function(c,b){c.beginPropertyChanges();c.set("content",b.content);c.set("contentIndex",b.contentIndex);c.set("isEnabled",b.isEnabled);c.set("isEditable",b.isEditable);c.set("isReorderable",b.isReorderable);c.set("isDeletable",b.isDeletable);c.set("isSelected",b.isSelected);c.set("layerId",b.layerId);c.set("outlineLevel",b.outlineLevel);c.set("disclosureState",b.disclosureState);c.set("isLast",b.isLast);if(b.layout){c.set("layout",b.layout)}var e=c.get("isGroupView"),a=b.isGroupView;if(e!==a){c.set("isGroupView",a);var f=c.get("classNames"),d=c.$();if(e&&!a){f.pushObject("sc-item");f.removeObject("sc-group-item");d.setClass({"sc-item":YES,"sc-group-item":NO})}else{f.removeObject("sc-item");f.pushObject("sc-group-item");d.setClass({"sc-item":NO,"sc-group-item":YES})}}c.endPropertyChanges()},_removeItemView:function(f,j){var d,g=this.get("content"),a,h,c,e,i,b=false;if(g&&f.get("content")===g.objectAt(j)){d=this._exampleViewForContentIndex(j);i=d.prototype;a=SC.none(i.isReusable)||i.isReusable;if(a){e=this._poolForExampleView(d);if(f.sleepInPool){f.sleepInPool(this)}e.push(f);c=this._poolLayoutForContentIndex(j);h=c&&(SC.none(i.isLayerReusable)||i.isLayerReusable);if(h){f.set("layout",c)}else{f.destroyLayer()}f.set("layerId",SC.generateGuid(null,"pool-"));b=true}}if(!b){f.destroy()}delete this._sc_itemViews[j]}});SC.DateFieldView=SC.TextFieldView.extend({value:null,showDate:YES,showTime:NO,allowNumericInput:YES,formatTime:"%I:%M %p",formatDate:"%d/%m/%Y",formatDateTime:"%d/%m/%Y %I:%M %p",_dtConstants:["%a","%b","%d","%H","%I","%j","%m","%M","%p","%S","%U","%W","%y","%Y"],_wtConstants:[3,3,2,2,2,3,2,2,2,2,2,2,2,4],activeSelection:0,format:function(){var a=this.get("showTime");var b=this.get("showDate");if(a===YES&&b===YES){return this.get("formatDateTime")}if(a===YES){return this.get("formatTime")}return this.get("formatDate")}.property("showTime","showDate","formatDateTime","formatDate","formatTime").cacheable(),validator:function(){return SC.Validator.DateTime.extend({format:this.get("format")})}.property("format").cacheable(),tabsSelections:function(){var f=[];var d=this.get("format");var i=this.get("_dtConstants");var b=this.get("_wtConstants");if(SC.empty(d)){throw new Error("The format string is empty, and must be a valid string.")}var g,j,c,e=0,a=0,h=0;while(e<d.length&&d.indexOf("%",e)!==-1){g=d.indexOf("%",e);j=d.substring(g,g+2);e=g+2;c=i.indexOf(j);if(c===-1){throw new Error("SC.DateFieldView: The format's key '%@' is not supported.".fmt(j))}a=a+g-h;f.push(SC.Object.create({key:j,textSelection:SC.TextSelection.create({start:a,end:a+b[c]})}));a=a+b[c];h=e}g=j=c=null;return f}.property("format").cacheable(),updateTextSelectionObserver:function(){var a=this.get("activeSelection");var b=this.get("tabsSelections");if(this.get("isEditing")){this.selection(null,b[a].get("textSelection"))}}.observes("activeSelection","value"),updateValue:function(b,c){var e=(c===0)?-1:1;var d=this.get("value"),a;switch(b){case"%a":case"%d":case"%j":this.set("value",d.advance({day:e}));break;case"%b":case"%m":this.set("value",d.advance({month:e}));break;case"%H":case"%I":this.set("value",d.advance({hour:e}));break;case"%M":this.set("value",d.advance({minute:e}));break;case"%p":a=d.get("hour")>=12?-12:12;this.set("value",d.advance({hour:a}));break;case"%S":this.set("value",d.advance({second:e}));break;case"%U":this.set("value",d.advance({week1:e}));break;case"%W":this.set("value",d.advance({week0:e}));break;case"%y":case"%Y":this.set("value",d.advance({year:e}));break}},_lastValue:null,_lastKey:null,_selectRootElement:function(){},keyDown:function(a){if(this.interpretKeyEvents(a)){a.stop();return YES}return arguments.callee.base.apply(this,arguments)},ctrl_a:function(){return YES},moveUp:function(b){var a=this.get("activeSelection");var c=this.get("tabsSelections");this.updateValue(c[a].get("key"),1);return YES},moveDown:function(b){var a=this.get("activeSelection");var c=this.get("tabsSelections");this.updateValue(c[a].get("key"),0);return YES},moveRight:function(a){var c=this.get("tabsSelections");var b=this.get("activeSelection")+1;if(b===c.length){b=0}this.set("activeSelection",b);return YES},moveLeft:function(a){var c=this.get("tabsSelections");var b=this.get("activeSelection")-1;if(b===-1){b=c.length-1}this.set("activeSelection",b);return YES},insertTab:function(a){var c=this.get("tabsSelections");var b=this.get("activeSelection")+1;if(b<c.length){this.set("activeSelection",b);return YES}return NO},insertBacktab:function(a){var b=this.get("activeSelection")-1;if(b!==-1){this.set("activeSelection",b);return YES}return NO},mouseUp:function(b){var c=arguments.callee.base.apply(this,arguments);var e=this.get("selection");if(SC.none(e)){this.set("activeSelection",0)}else{var h=e.get("start");var g=this.get("tabsSelections");var a=g.length,f;for(var d=0;d<a;d++){f=g[d].get("textSelection");if(h>=f.get("start")&&h<=f.get("end")){this.set("activeSelection",d)}}}return c},deleteBackward:function(a){return YES},deleteForward:function(a){return YES},_numericCharacters:["0","1","2","3","4","5","6","7","8","9"],_nonnumericCharacters:[" ","-","/",":"],insertText:function(e,l){if(this._nonnumericCharacters.contains(e)){this.moveRight()}if(this.get("allowNumericInput")&&this._numericCharacters.contains(e)){var c=this.get("activeSelection"),g=this.get("tabsSelections"),k=g[c].get("key");var j=this.get("value"),i=this._lastValue,b=2,d=0,h,k,a;switch(k){case"%Y":k="year";d=1000;h=9999;b=4;break;case"%y":k="year";h=99;break;case"%m":k="month";d=1;h=12;break;case"%d":k="day";d=1;h=j.advance({month:1}).adjust({day:0}).get("day");break;case"%H":k="hour";h=23;break;case"%I":k="hour";h=11;break;case"%M":k="minute";h=59;break;case"%S":k="second";h=59;break}if(SC.none(i)||this._lastKey!==k){i=j.get(k);i=(i<10?"0":"")+i}if(i.length>b){i=i.substr(-b)}i=i.slice(1)+e;a=parseInt(i,10);if(a<=h&&a>=d){var f={};f[k]=a;this.set("value",j.adjust(f,NO))}this._lastValue=i;this._lastKey=k}return YES}});SC.DisclosureView=SC.ButtonView.extend({classNames:["sc-disclosure-view"],renderDelegateName:"disclosureRenderDelegate",buttonBehavior:SC.TOGGLE_BEHAVIOR,toggleOnValue:YES,toggleOffValue:NO,valueBindingDefault:SC.Binding.bool(),keyDown:function(a){if(a.which===37||a.which===38){this.set("value",this.get("toggleOffValue"));return YES}if(a.which===39||a.which===40){this.set("value",this.get("toggleOnValue"));return YES}arguments.callee.base.apply(this,arguments)}});SC.LIST_ITEM_ACTION_CANCEL="sc-list-item-cancel-action";SC.LIST_ITEM_ACTION_REFRESH="sc-list-item-cancel-refresh";SC.LIST_ITEM_ACTION_EJECT="sc-list-item-cancel-eject";SC.ListItemView=SC.View.extend(SC.InlineEditable,SC.Control,{classNames:["sc-list-item-view"],displayProperties:["disclosureState","escapeHTML","isDropTarget"],contentIndex:null,hasContentIcon:NO,hasContentRightIcon:NO,hasContentBranch:NO,contentCheckboxKey:null,icon:null,isDropTarget:NO,contentIconKey:null,rightIcon:null,contentRightIconKey:null,contentValueKey:null,escapeHTML:YES,contentUnreadCountKey:null,contentIsBranchKey:null,outlineIndent:16,outlineLevel:0,disclosureState:SC.LEAF_NODE,validator:null,contentKeys:{contentValueKey:"title",contentCheckboxKey:"checkbox",contentIconKey:"icon",contentRightIconKey:"rightIcon",contentUnreadCountKey:"count",contentIsBranchKey:"branch"},contentPropertyDidChange:function(){if(this.get("contentIsEditable")!==this.contentIsEditable()){this.notifyPropertyChange("contentIsEditable")}this.displayDidChange()},contentIsEditable:function(){var a=this.get("content");return a&&(a.get?a.get("isEditable")!==NO:NO)}.property("content").cacheable(),inlineEditorDelegate:SC.InlineTextFieldDelegate,$label:function(){return this.$("label")},_isInsideElementWithClassName:function(e,a){var c=this.get("layer");if(!c){return NO}var d=SC.$(a.target);var b=NO;while(!b&&d.length>0&&(d[0]!==c)){if(d.hasClass(e)){b=YES}d=d.parent()}d=c=null;return b},_isInsideCheckbox:function(b){var a=this.displayDelegate;var c=this.getDelegateProperty("contentCheckboxKey",a);return c&&this._isInsideElementWithClassName("sc-checkbox-view",b)},_isInsideDisclosure:function(a){if(this.get("disclosureState")===SC.LEAF_NODE){return NO}return this._isInsideElementWithClassName("sc-disclosure-view",a)},_isInsideRightIcon:function(c){var b=this.displayDelegate;var a=this.getDelegateProperty("hasContentRightIcon",b)||!SC.none(this.rightIcon);return a&&this._isInsideElementWithClassName("right-icon",c)},mouseDown:function(a){if(a.which&&a.which!==1){return false}if(!this.get("contentIsEditable")){return NO}if(this._isInsideCheckbox(a)){this._addCheckboxActiveState();this._isMouseDownOnCheckbox=YES;this._isMouseInsideCheckbox=YES;return YES}else{if(this._isInsideDisclosure(a)){this._addDisclosureActiveState();this._isMouseDownOnDisclosure=YES;this._isMouseInsideDisclosure=YES;return YES}else{if(this._isInsideRightIcon(a)){this._addRightIconActiveState();this._isMouseDownOnRightIcon=YES;this._isMouseInsideRightIcon=YES;return YES}}}return NO},mouseUp:function(h){var c=NO,i,d,b,a,g,f;if(this._isMouseDownOnCheckbox){if(this._isInsideCheckbox(h)){i=this.displayDelegate;d=this.getDelegateProperty("contentCheckboxKey",i);b=this.get("content");if(b&&b.get){var e=b.get(d);e=(e===SC.MIXED_STATE)?YES:!e;b.set(d,e);this.displayDidChange()}}this._removeCheckboxActiveState();c=YES}else{if(this._isMouseDownOnDisclosure){if(this._isInsideDisclosure(h)){a=this.get("disclosureState");g=this.get("contentIndex");f=(!SC.none(g))?SC.IndexSet.create(g):null;i=this.get("displayDelegate");if(a===SC.BRANCH_OPEN){if(f&&i&&i.collapse){i.collapse(f)}else{this.set("disclosureState",SC.BRANCH_CLOSED)}this.displayDidChange()}else{if(a===SC.BRANCH_CLOSED){if(f&&i&&i.expand){i.expand(f)}else{this.set("disclosureState",SC.BRANCH_OPEN)}this.displayDidChange()}}}this._removeDisclosureActiveState();c=YES}else{if(this._isMouseDownOnRightIcon){this._removeRightIconActiveState();c=YES}}}this._isMouseInsideCheckbox=this._isMouseDownOnCheckbox=NO;this._isMouseDownOnDisclosure=this._isMouseInsideDisclosure=NO;this._isMouseInsideRightIcon=this._isMouseDownOnRightIcon=NO;return c},mouseMoved:function(a){if(this._isMouseDownOnCheckbox&&this._isInsideCheckbox(a)){this._addCheckboxActiveState();this._isMouseInsideCheckbox=YES}else{if(this._isMouseDownOnCheckbox){this._removeCheckboxActiveState();this._isMouseInsideCheckbox=NO}else{if(this._isMouseDownOnDisclosure&&this._isInsideDisclosure(a)){this._addDisclosureActiveState();this._isMouseInsideDisclosure=YES}else{if(this._isMouseDownOnDisclosure){this._removeDisclosureActiveState();this._isMouseInsideDisclosure=NO}else{if(this._isMouseDownOnRightIcon&&this._isInsideRightIcon(a)){this._addRightIconActiveState();this._isMouseInsideRightIcon=YES}else{if(this._isMouseDownOnRightIcon){this._removeRightIconActiveState();this._isMouseInsideRightIcon=NO}}}}}}return NO},touchStart:function(a){return this.mouseDown(a)},touchEnd:function(a){return this.mouseUp(a)},touchEntered:function(a){return this.mouseEntered(a)},touchExited:function(a){return this.mouseExited(a)},_addCheckboxActiveState:function(){if(this.get("isEnabled")){if(this._checkboxRenderDelegate){var a=this._checkboxRenderSource;a.set("isActive",YES);this._checkboxRenderDelegate.update(a,this.$(".sc-checkbox-view"))}else{this.$(".sc-checkbox-view").addClass("active")}}},_removeCheckboxActiveState:function(){if(this._checkboxRenderer){var a=this._checkboxRenderSource;a.set("isActive",NO);this._checkboxRenderDelegate.update(a,this.$(".sc-checkbox-view"))}else{this.$(".sc-checkbox-view").removeClass("active")}},_addDisclosureActiveState:function(){if(this.get("isEnabled")){if(this._disclosureRenderDelegate){var a=this._disclosureRenderSource;a.set("isActive",YES);this._disclosureRenderDelegate.update(a,this.$(".sc-disclosure-view"))}else{this.$(".sc-disclosure-view").addClass("active")}}},_removeDisclosureActiveState:function(){if(this._disclosureRenderer){var a=this._disclosureRenderSource;a.set("isActive",NO);this._disclosureRenderDelegate.update(a,this.$(".sc-disclosure-view"))}else{this.$(".sc-disclosure-view").addClass("active")}},_addRightIconActiveState:function(){this.$("img.right-icon").setClass("active",YES)},_removeRightIconActiveState:function(){this.$("img.right-icon").removeClass("active");var d=this.get("pane"),a=this.displayDelegate,c=this.getDelegateProperty("rightIconTarget",a),b=this.getDelegateProperty("rightIconAction",a);if(b&&d){d.rootResponder.sendAction(b,c,this,d)}},contentHitTest:function(b){var a=this.displayDelegate;var c=this.getDelegateProperty("contentValueKey",a);if(!c){return NO}var e=this.$label()[0];if(!e){return NO}var f=b.target,d=this.get("layer");while(f&&(f!==d)&&(f!==window)){if(f===e){return YES}f=f.parentNode}return NO},beginEditing:function(d,c){var f=this.$label(),e=this.get("parentView");if(c&&this.scrollToVisible()){var b=this.get("owner"),a=this.get("contentIndex");this.invokeLast(function(){var g=b.itemViewForContentIndex(a);if(g&&g.beginEditing){g.beginEditing(NO)}});return YES}else{if(!e||!f||f.get("length")===0){return NO}else{return d()}}}.enhance(),inlineEditorWillBeginEditing:function(i,d,m){var j=this.get("content"),o=this.get("displayDelegate"),e=this.getDelegateProperty("contentValueKey",o),b=this.$label(),a=this.get("validator"),h,n,g,r,k,l,q,p,c;n=(e&&j)?(j.get?j.get(e):j[e]):j;h=this.computeFrameWithParentFrame(null);l=this._oldLineHeight=b.css("lineHeight");r=b.css("fontSize");k=this.$().css("top");if(k){k=parseInt(k.substring(0,k.length-2),0)}else{k=0}p=0;if(r&&l){c=r*1.5;if(c<l){b.css({lineHeight:"1.5"});p=(l-c)/2}else{this._oldLineHeight=null}}b=b[0];g=SC.offset(b);h.x=g.x;h.y=g.y+k+p;h.height=b.offsetHeight;h.width=b.offsetWidth;q=this.get("escapeHTML");i.set({value:n,exampleFrame:h,exampleElement:b,multiline:NO,validator:a,escapeHTML:q})},inlineEditorShouldBeginEditing:function(a){return YES},inlineEditorDidBeginEditing:function(b,d,e,a){b(d,e,a);var c=this.$label();this._oldOpacity=c.css("opacity");c.css("opacity",0);if(this._oldLineHeight){c.css({lineHeight:this._oldLineHeight})}}.enhance(),inlineEditorDidCommitEditing:function(d,f,c){var e=this.get("content");var a=this.displayDelegate;var b=this.getDelegateProperty("contentValueKey",a);if(b&&e){if(e.set){e.set(b,f)}else{e[b]=f}}else{this.set("content",f)}this.displayDidChange();this._endEditing()},_endEditing:function(a){this.$label().css("opacity",this._oldOpacity);a()}.enhance(),isReusable:false,render:function(c,a){var f=this.get("content"),m=this.displayDelegate,b=this.get("outlineLevel"),e=this.get("outlineIndent"),l,j,i,n=[];n.push((this.get("contentIndex")%2===0)?"even":"odd");c.setClass("disabled",!this.get("isEnabled"));c.setClass("drop-target",this.get("isDropTarget"));i=c.begin("div").addClass("sc-outline");if(b>=0&&e>0){i.addStyle("left",e*(b+1))}j=this.get("disclosureState");if(j!==SC.LEAF_NODE){this.renderDisclosure(i,j);n.push("has-disclosure")}else{if(this._disclosureRenderSource){c.removeClass("has-disclosure");this._disclosureRenderSource.destroy();this._disclosureRenderSource=this._disclosureRenderDelegate=null}}l=this.getDelegateProperty("contentCheckboxKey",m);if(l){j=f?(f.get?f.get(l):f[l]):NO;if(j!==null){this.renderCheckbox(i,j);n.push("has-checkbox")}else{if(this._checkboxRenderSource){c.removeClass("has-checkbox");this._checkboxRenderSource.destroy();this._checkboxRenderSource=this._checkboxRenderDelegate=null}}}if(this.getDelegateProperty("hasContentIcon",m)){l=this.getDelegateProperty("contentIconKey",m);j=(l&&f)?(f.get?f.get(l):f[l]):null;if(j){this.renderIcon(i,j);n.push("has-icon")}}else{if(this.get("icon")){j=this.get("icon");this.renderIcon(i,j);n.push("has-icon")}}l=this.getDelegateProperty("contentValueKey",m);j=(l&&f)?(f.get?f.get(l):f[l]):f;if(j&&SC.typeOf(j)!==SC.T_STRING){j=j.toString()}if(this.get("escapeHTML")){j=SC.RenderContext.escapeHTML(j)}this.renderLabel(i,j);if(this.getDelegateProperty("hasContentRightIcon",m)){l=this.getDelegateProperty("contentRightIconKey",m);j=(l&&f)?(f.get?f.get(l):f[l]):null;if(j){this.renderRightIcon(i,j);n.push("has-right-icon")}}else{if(this.get("rightIcon")){j=this.get("rightIcon");this.renderRightIcon(i,j);n.push("has-right-icon")}}l=this.getDelegateProperty("contentUnreadCountKey",m);j=(l&&f)?(f.get?f.get(l):f[l]):null;if(!SC.none(j)&&(j!==0)){this.renderCount(i,j);var d=["zero","one","two","three","four","five"];var k=j.toString().length;var h=d.length;var g=(k<h)?d[k]:d[h-1];n.push("has-count",g+"-digit")}else{c.removeClass("has-count")}l=this.getDelegateProperty("listItemActionProperty",m);j=(l&&f)?(f.get?f.get(l):f[l]):null;if(j){this.renderAction(i,j);n.push("has-action")}if(this.getDelegateProperty("hasContentBranch",m)){l=this.getDelegateProperty("contentIsBranchKey",m);j=(l&&f)?(f.get?f.get(l):f[l]):NO;this.renderBranch(i,j);n.push("has-branch")}c.addClass(n);c=i.end()},renderDisclosure:function(a,d){var c=this.get("theme").disclosureRenderDelegate;a=a.begin("div").addClass("sc-disclosure-view").addClass("sc-regular-size").addClass(this.get("theme").classNames).addClass(c.get("className"));var b=this._disclosureRenderSource;if(!b){this._disclosureRenderSource=b=SC.Object.create({renderState:{},theme:this.get("theme")})}b.set("isSelected",d===SC.BRANCH_OPEN).set("isEnabled",this.get("isEnabled")).set("title","");c.render(b,a);a=a.end();this._disclosureRenderDelegate=c},renderCheckbox:function(a,d){var c=this.get("theme").checkboxRenderDelegate;a=a.begin("div").addClass("sc-checkbox-view").addClass("sc-regular-size").addClass(this.get("theme").classNames).addClass(c.get("className"));var b=this._checkboxRenderSource;if(!b){b=this._checkboxRenderSource=SC.Object.create({renderState:{},theme:this.get("theme")})}b.set("isSelected",d&&(d!==SC.MIXED_STATE)).set("isEnabled",this.get("isEnabled")&&this.get("contentIsEditable")).set("isActive",this._checkboxIsActive).set("title","");c.render(b,a);a=a.end();this._checkboxRenderDelegate=c},renderIcon:function(c,e){var b=null,d=null,a=[];if(e&&SC.ImageView.valueIsUrl(e)){b=e;d=""}else{d=e;b=SC.BLANK_IMAGE_URL}a.push(d,"icon");c.begin("img").addClass(a).setAttr("src",b).end()},renderLabel:function(b,a){b.push("<label>",a||"","</label>")},renderRightIcon:function(c,e){var b=null,d=null,a=[];if(e&&SC.ImageView.valueIsUrl(e)){b=e;d=""}else{d=e;b=SC.BLANK_IMAGE_URL}a.push("right-icon",d);c.begin("img").addClass(a).setAttr("src",b).end()},renderCount:function(a,b){a.push('<span class="count"><span class="inner">',b.toString(),"</span></span>")},renderAction:function(a,b){a.push('<img src="',SC.BLANK_IMAGE_URL,'" class="action" />')},renderBranch:function(c,b){var a=[];a.push("branch",b?"branch-visible":"branch-hidden");c.begin("span").addClass(a).push("&nbsp;").end()}});SC.ListItemView._deprecatedRenderWarningHasBeenIssued=false;sc_require("views/collection");sc_require("views/list_item");sc_require("mixins/collection_row_delegate");SC.ListView=SC.CollectionView.extend(SC.CollectionRowDelegate,{_sc_customRowSizeIndexes:null,_sc_insertionPointView:null,_sc_lastDropOnView:null,_sc_layout:null,_sc_sizeCache:null,_sc_offsetCache:null,_sc_rowDelegate:null,_sc_rowSize:null,classNames:["sc-list-view"],acceptsFirstResponder:true,exampleView:SC.ListItemView,layoutDirection:SC.LAYOUT_VERTICAL,showAlternatingRows:false,init:function(){arguments.callee.base.apply(this,arguments);this._sc_rowDelegateDidChange()},destroy:function(){arguments.callee.base.apply(this,arguments);var b=this._sc_rowDelegate;if(b){b.removeObserver("_sc_totalRowSize",this,this._sc_rowSizeDidChange);b.removeObserver("customRowSizeIndexes",this,this._sc_customRowSizeIndexesDidChange);this._sc_rowDelegate=null}var a=this._sc_customRowSizeIndexes;if(a){a.removeObserver("[]",this,this._sc_customRowSizeIndexesContentDidChange);this._sc_customRowSizeIndexes=null}},render:function(a,b){a.setClass("alternating",this.get("showAlternatingRows"));return arguments.callee.base.apply(this,arguments)},rowDelegate:function(){var a=this.delegate,b=this.get("content");return this.delegateFor("isCollectionRowDelegate",a,b)}.property("delegate","content").cacheable(),_sc_rowDelegateDidChange:function(){var d=this._sc_rowDelegate,b=this.get("rowDelegate"),c=this._sc_rowSizeDidChange,a=this._sc_customRowSizeIndexesDidChange;if(d===b){return this}this._sc_rowDelegate=b;if(d){d.removeObserver("_sc_totalRowSize",this,c);d.removeObserver("customRowSizeIndexes",this,a)}b.addObserver("_sc_totalRowSize",this,c);b.addObserver("customRowSizeIndexes",this,a);this._sc_rowSizeDidChange()._sc_customRowSizeIndexesDidChange();return this}.observes("rowDelegate"),_sc_rowSizeDidChange:function(){var b=this.get("rowDelegate"),a=b.get("_sc_totalRowSize"),c;if(a===this._sc_rowSize){return this}this._sc_rowSize=a;c=SC.IndexSet.create(0,this.get("length"));this.rowSizeDidChangeForIndexes(c);return this},_sc_customRowSizeIndexesDidChange:function(){var a=this.get("rowDelegate"),b=a.get("customRowSizeIndexes"),d=this._sc_customRowSizeIndexes,c=this._sc_customRowSizeIndexesContentDidChange;if((b===d)||(d&&d.isEqual(b))){return this}if(d&&this._sc_isObservingCustomRowSizeIndexes){d.removeObserver("[]",this,c)}this._sc_isObservingCustomRowSizeIndexes=b;if(b&&!b.get("isFrozen")){b.addObserver("[]",this,c)}this._sc_customRowSizeIndexesContentDidChange();return this},_sc_customRowSizeIndexesContentDidChange:function(){var a=this.get("rowDelegate"),b=a.get("customRowSizeIndexes"),c=this._sc_customRowSizeIndexes,d;if(b&&c){d=b.copy().add(c)}else{d=b||c}this._sc_customRowSizeIndexes=b?b.frozenCopy():null;this.rowSizeDidChangeForIndexes(d);return this},rowOffsetForContentIndex:function(g){if(g===0){return 0}var i=this.get("rowDelegate"),c=i.get("_sc_totalRowSize"),e=i.get("rowSpacing"),d,b,a,h,f;d=g*c;if(e){d+=g*e}if(i.customRowSizeIndexes&&(b=i.get("customRowSizeIndexes"))){a=this._sc_offsetCache;if(!a){a=[];h=f=0;b.forEach(function(j){h+=this.rowSizeForContentIndex(j)-c;a[j+1]=h;f=j},this);this._sc_max=f+1;this._sc_offsetCache=a}h=a[g];if(h===undefined){h=a[g]=a[g-1];if(h===undefined){f=this._sc_max;if(g<f){f=b.indexBefore(g)+1}h=a[g]=a[f]||0}}d+=h}return d},rowHeightForContentIndex:null,rowSizeForContentIndex:function(a){var b=this.get("rowDelegate"),e,c,f,d;if(this.rowHeightForContentIndex){return this.rowHeightForContentIndex(a)}if(b.customRowSizeIndexes&&(d=b.get("customRowSizeIndexes"))){c=this._sc_sizeCache;if(!c){c=[];f=this.get("content");d.forEach(function(g){c[g]=b.contentIndexRowSize(this,f,g)},this);this._sc_sizeCache=c}e=c[a];if(e===undefined){e=b.get("_sc_totalRowSize")}}else{e=b.get("_sc_totalRowSize")}return e},rowHeightDidChangeForIndexes:function(a){return this.rowSizeDidChangeForIndexes(a)},rowSizeDidChangeForIndexes:function(b){var a=this.get("length");this._sc_sizeCache=this._sc_offsetCache=null;if(b&&b.isIndexSet){b=b.get("min")}this.reload(SC.IndexSet.create(b,a-b));this.invokeOnce("adjustLayout");return this},computeLayout:function(){var c=this._sc_layout,d=this.get("layoutDirection"),b=this.get("rowDelegate"),a=b.get("rowSpacing");if(!c){c=this._sc_layout={}}if(d===SC.LAYOUT_HORIZONTAL){c.width=Math.max(this.rowOffsetForContentIndex(this.get("length"))-a,0)}else{c.height=Math.max(this.rowOffsetForContentIndex(this.get("length"))-a,0)}return c},layoutForContentIndex:function(e){var a=this.get("rowDelegate"),d=this.get("layoutDirection"),c,b;c=this.rowOffsetForContentIndex(e);b=this.rowSizeForContentIndex(e)-a.get("rowPadding")*2;if(d===SC.LAYOUT_HORIZONTAL){return{left:c,width:b,top:0,bottom:0}}else{return{top:c,height:b,left:0,right:0}}},contentIndexesInRect:function(i){var j=this.get("rowDelegate"),b=j.get("_sc_totalRowSize"),h=j.get("rowSpacing"),f=b+h,e=this.get("layoutDirection"),g=this.get("length"),d,a,c,k,m,l;if(e===SC.LAYOUT_HORIZONTAL){k=SC.minX(i);m=SC.maxX(i);l=i.width||0}else{k=SC.minY(i);m=SC.maxY(i);l=i.height||0}a=(k-(k%f))/f;d=this.rowOffsetForContentIndex(a);while(a>0&&d>k){a--;d-=(this.rowSizeForContentIndex(a)+h)}d+=this.rowSizeForContentIndex(a);while(a<g&&d<=k){a++;d+=this.rowSizeForContentIndex(a)+h}if(a<0){a=0}if(a>=g){a=g}c=a+((l-(l%f))/f);if(c>g){c=g}d=this.rowOffsetForContentIndex(c);while(c>=a&&d>=m){c--;d-=(this.rowSizeForContentIndex(c)+h)}d+=this.rowSizeForContentIndex(c)+h;while(c<g&&d<m){c++;d+=this.rowSizeForContentIndex(c)+h}c++;if(c<a){c=a}if(c>g){c=g}return SC.IndexSet.create(a,c-a)},insertionPointView:SC.View.extend({classNames:"sc-list-insertion-point",layout:function(a,b){var c=this.get("layoutDirection");a=c===SC.LAYOUT_HORIZONTAL?"width":"height";if(b===undefined){b={}}if(SC.none(b[a])){b[a]=2}return b}.property("layoutDirection").cacheable(),layoutDirection:SC.LAYOUT_VERTICAL,render:function(a,b){if(b){a.push('<div class="anchor"></div>')}}}),showInsertionPoint:function(j,i){if(i&SC.DROP_ON){if(j&&j!==this._sc_lastDropOnView){this.hideInsertionPoint();j.set("isDropTarget",YES);this._sc_lastDropOnView=j}return}if(this._sc_lastDropOnView){this._sc_lastDropOnView.set("isDropTarget",NO);this._sc_lastDropOnView=null}var g=this.get("length"),f,a,b;if(j){f=j.get("contentIndex");a=j.get("outlineLevel");b=j.get("outlineIndent")}f=f||0;if(SC.none(a)){a=-1}b=b||0;if((f>=g)&&f>0){var e=this.itemViewForContentIndex(g-1);if(e.get("isGroupView")){a=1;b=e.get("outlineIndent")}}var h=this._sc_insertionPointView,d=this.get("layoutDirection");if(!h){h=this._sc_insertionPointView=this.get("insertionPointView").create({layoutDirection:d})}var l=j?j.get("layout"):{top:0,left:0},k,c;if(d===SC.LAYOUT_HORIZONTAL){c=l.left;if(i&SC.DROP_AFTER){c+=l.width}k=((a+1)*b)+12}else{k=l.top;if(i&SC.DROP_AFTER){k+=l.height}c=((a+1)*b)+12}h.adjust({top:k,left:c});this.appendChild(h)},hideInsertionPoint:function(){if(this._sc_lastDropOnView){this._sc_lastDropOnView.set("isDropTarget",NO);this._sc_lastDropOnView=null}var a=this._sc_insertionPointView;if(a){a.removeFromParent().destroy()}this._sc_insertionPointView=null},insertionIndexForLocation:function(f,j){var a={x:f.x,y:f.y,width:1,height:1},e=this.contentIndexesInRect(a),g=e.get("min"),h=this.get("length"),b,k,l,d,n,c,m,i;if(SC.none(g)||g<0){if((h===0)||(f.y<=this.rowOffsetForContentIndex(0))){g=0}else{if(f.y>=this.rowOffsetForContentIndex(h)){g=h}}}b=this.rowOffsetForContentIndex(g);k=b+this.rowSizeForContentIndex(g);if(j===SC.DROP_ON){if(this.get("isEditable")){l=Math.min(Math.floor((k-b)*0.2),5)}else{l=0}if(f.y>=(b+l)||f.y<=(k+l)){return[g,SC.DROP_ON]}}if(g>0){i=this.itemViewForContentIndex(g-1);m=(i?i.get("outlineIndent"):0)||0;c=i?i.get("outlineLevel"):0;if(g<h){i=this.itemViewForContentIndex(g);d=i?i.get("outlineLevel"):0;n=(i?i.get("outlineIndent"):0)||0;n*=d}else{d=i.get("isGroupView")?1:0;n=m*d}m*=c;if((d!==c)&&(n!==m)){if(m>n){g--;j=SC.DROP_AFTER}}}if(j===SC.DROP_BEFORE){i=(g<h)?this.itemViewForContentIndex(g):null;if(!i||i.get("isGroupView")){if(g>0){i=this.itemViewForContentIndex(g-1);if(!i.get("isGroupView")||(i.get("disclosureState")===SC.BRANCH_OPEN)){g=g-1;j=SC.DROP_AFTER}else{g=-1}}else{g=-1}}if(g<0){j=SC.DRAG_NONE}}return[g,j]}});sc_require("views/list");SC.GridView=SC.ListView.extend({_lastFrameWidth:null,classNames:["sc-grid-view"],layout:{left:0,right:0,top:0,bottom:0},rowHeight:48,columnWidth:64,exampleView:SC.LabelView,insertionOrientation:SC.HORIZONTAL_ORIENTATION,itemsPerRow:function(){var a=this.get("frame").width,b=this.get("columnWidth")||0;return(b<1)?1:Math.floor(a/b)}.property("columnWidth","_frameWidth").cacheable(),contentIndexesInRect:function(e){var d=this.get("rowHeight")||48,b=this.get("itemsPerRow"),c=Math.floor(SC.minY(e)/d)*b,a=Math.ceil(SC.maxY(e)/d)*b;return SC.IndexSet.create(c,a-c)},layoutForContentIndex:function(g){var d=this.get("rowHeight")||48,a=this.get("frame").width,b=this.get("itemsPerRow"),e=Math.floor(a/b),f=Math.floor(g/b),c=g-(b*f);if(a===0||b===0){return{}}return{left:c*e,top:f*d,height:d,width:e}},computeLayout:function(){var e=this.get("content"),d=(e)?e.get("length"):0,c=this.get("rowHeight")||48,a=this.get("itemsPerRow"),f=a?Math.ceil(d/a):0;var b=this._cachedLayoutHash;if(!b){b=this._cachedLayoutHash={}}b.height=f*c;return b},insertionPointClass:SC.View.extend({classNames:["sc-grid-insertion-point"],layout:{width:2},render:function(a,b){if(b){a.push('<div class="anchor"></div>')}}}),showInsertionPoint:function(c,g){if(!c){return}if(g&SC.DROP_ON){if(c!==this._lastDropOnView){this.hideInsertionPoint();c.set("isDropTarget",YES);this._lastDropOnView=c}}else{if(this._lastDropOnView){this._lastDropOnView.set("isDropTarget",NO);this._lastDropOnView=null}var b=this._insertionPointView,d=c.get("layout"),f,e;if(!b){b=this._insertionPointView=this.insertionPointClass.create()}f=d.top;e=d.left;if(g&SC.DROP_AFTER){e+=d.width}var a=d.height;b.adjust({top:f,left:e,height:a});this.appendChild(b)}},hideInsertionPoint:function(){if(this._lastDropOnView){this._lastDropOnView.set("isDropTarget",NO);this._lastDropOnView=null}var a=this._insertionPointView;if(a){a.removeFromParent().destroy()}this._insertionPointView=null},insertionIndexForLocation:function(d,j){var e=this.get("frame"),g=this.get("clippingFrame"),k=this.get("itemsPerRow"),a=Math.floor(e.width/k),m=Math.floor((d.y-e.y-g.y)/this.get("rowHeight"));var i=SC.DROP_BEFORE,c=(d.x-e.x-g.x),b=Math.floor(c/a),l=(c/a)-b;if(j===SC.DROP_ON){if(l>0.8){b++}if((l>=0.2)&&(l<=0.8)){i=SC.DROP_ON}}else{if(l>0.45){b++}}var h=(m*k)+b;return[h,i]},_gv_frameDidChange:function(){var e=this.get("frame"),c=this._lastFrameWidth,b=e.width;if(!SC.none(c)&&b!==c){var a,d=this.get("nowShowing");this.set("_frameWidth",b);d.forEach(function(f){a=this.itemViewForContentIndex(f);a.adjust(this.layoutForContentIndex(f))},this)}this._lastFrameWidth=b}.observes("frame"),_gv_itemsPerRowDidChange:function(){var a=this.get("itemsPerRow"),b=this._lastItemsPerRow||0;if(a!==b){this.invokeOnce("adjustLayout")}this._lastItemsPerRow=a}.observes("itemsPerRow")});SC.ImageButtonView=SC.ButtonView.extend({classNames:["sc-image-button-view"],themeName:null,renderDelegateName:"imageButtonRenderDelegate",displayProperties:["image"],image:null});SC.LinkView=SC.View.extend({ariaRole:"link",body:"",classNames:["sc-link-view"],displayBody:function(){var a=this.get("body");return(a&&this.get("localize"))?SC.String.loc(a):(a||"")}.property("body","localize").cacheable(),displayProperties:["displayBody","displayToolTip","fileName","href","hreflang"],fileName:null,escapeHTML:true,href:"#",language:null,hreflang:function(){var b=this.get("language"),a;a=b||SC.Locale.currentLocale.language;return a}.property("language","localize").cacheable(),ping:null,rel:null,tagName:"a",target:"_blank",type:null,render:function(b){var c=this.get("displayBody"),f=this.get("displayToolTip"),e=this.get("fileName"),k=this.get("escapeHTML"),a=this.get("href"),d=this.get("hreflang"),i=this.get("ping"),j=this.get("rel"),g=this.get("target"),h=this.get("type");if(f&&k){f=SC.RenderContext.escapeHTML(f)}b.setAttr({download:e,href:a,hreflang:d,ping:i?i.join(" "):null,rel:j?j.join(" "):null,target:g,title:f,type:h});if(c&&k){c=SC.RenderContext.escapeHTML(c)}b.push(c)},mouseDown:function(a){a.allowDefault();return true},mouseUp:function(a){a.allowDefault();return true},touchStart:function(a){a.allowDefault();return true},touchEnd:function(a){a.allowDefault();return true},update:function(c){var f=this.get("displayBody"),e=this.get("displayToolTip"),g=this.get("fileName"),d=this.get("escapeHTML"),b=this.get("href"),a=this.get("hreflang");c.attr("download",g);c.attr("href",b);c.attr("hreflang",a);if(e&&d){e=SC.RenderContext.escapeHTML(e)}c.attr("title",e);if(f&&d){f=SC.RenderContext.escapeHTML(f)}c.html(f)}});SC.ANCHOR_TOP={top:0};SC.ANCHOR_LEFT={left:0};SC.ANCHOR_TOP_LEFT={top:0,left:0};SC.ANCHOR_BOTTOM={bottom:0};SC.ANCHOR_RIGHT={right:0};SC.ANCHOR_BOTTOM_RIGHT={bottom:0,right:0};SC.ToolbarView=SC.View.extend({classNames:["sc-toolbar-view"],ariaRole:"toolbar",renderDelegateName:"toolbarRenderDelegate",anchorLocation:null,layout:{left:0,right:0,height:32,zIndex:10},init:function(){if(this.anchorLocation){this.layout=SC.merge(this.layout,this.anchorLocation);switch(this.anchorLocation){case SC.ANCHOR_TOP:case SC.ANCHOR_TOP_LEFT:this.layout.borderBottom=1;break;case SC.ANCHOR_BOTTOM:case SC.ANCHOR_BOTTOM_RIGHT:this.layout.borderTop=1;break;default:}}arguments.callee.base.apply(this,arguments)}});sc_require("views/toolbar");SC.WorkspaceView=SC.View.extend({classNames:["sc-workspace-view"],displayProperties:["hasTopToolbar","hasBottomToolbar"],renderDelegateName:"workspaceRenderDelegate",topToolbar:SC.ToolbarView.extend(),bottomToolbar:null,contentView:SC.View.extend(),autoResizeToolbars:NO,defaultToolbarSize:44,largeToolbarSize:44,smallToolbarSize:30,toolbarSize:function(){if(!this.get("autoResizeToolbars")){return this.get("defaultToolbarSize")}if(this.get("orientation")===SC.HORIZONTAL_ORIENTATION){return this.get("smallToolbarSize")}return this.get("largeToolbarSize")}.property("autoHideMaster","orientation"),orientation:function(){var a=this.get("frame");if(a.width>a.height){return SC.HORIZONTAL_ORIENTATION}else{return SC.VERTICAL_ORIENTATION}}.property("frame").cacheable(),masterIsHidden:NO,masterIsHiddenDidChange:function(){var a,b=this.get("masterIsHidden");if(a=this.get("topToolbar")){a.set("masterIsHidden",b)}if(a=this.get("bottomToolbar")){a.set("masterIsHidden",b)}}.observes("masterIsHidden"),_scmd_tilePropertyDidChange:function(){this.invokeOnce("_scws_tile")}.observes("toolbarSize"),createChildViews:function(){arguments.callee.base.apply(this,arguments);var a=this.get("topToolbar");if(a){a=this.topToolbar=this.activeTopToolbar=this.createChildView(a);this.appendChild(a)}var c=this.get("bottomToolbar");if(c){c=this.bottomToolbar=this.activeBottomToolbar=this.createChildView(c);this.appendChild(c)}var b=this.get("contentView");b=this.contentView=this.activeContentView=this.createChildView(b);this.appendChild(b);this.invokeOnce("_scws_tile")},_scws_tile:function(){var b=0,e=0,a=this.get("topToolbar"),f=this.get("bottomToolbar"),d=this.get("contentView"),c=this.get("toolbarSize");if(a){a.set("layout",{left:0,right:0,top:0,height:c});b+=c}if(f){f.set("layout",{left:0,right:0,bottom:0,height:c});e+=c}this.contentView.set("layout",{left:0,right:0,top:b,bottom:e})},hasTopToolbar:function(){if(this.get("topToolbar")){return YES}return NO}.property("topToolbar").cacheable(),hasBottomToolbar:function(){if(this.get("bottomToolbar")){return YES}return NO}.property("bottomToolbar").cacheable(),childDidChange:function(){this._scws_tile()},activeTopToolbar:null,activeBottomToolbar:null,activeContentView:null,topToolbarDidChange:function(){var b=this.activeTopToolbar,a=this.get("topToolbar");if(b){if(b.createdByParent){container.removeChildAndDestroy(b)}else{container.removeChild(b)}}if(a){this.appendChild(a)}this.activeTopToolbar=a;this.invokeLast("childDidChange")}.observes("topToolbar"),bottomToolbarDidChange:function(){var b=this.activeBottomToolbar,a=this.get("bottomToolbar");if(b){if(b.createdByParent){container.removeChildAndDestroy(b)}else{container.removeChild(b)}}if(a){this.appendChild(a)}this.activeBottomToolbar=a;this.invokeLast("childDidChange")}.observes("bottomToolbar"),contentViewDidChange:function(){var b=this.activeContentView,a=this.get("contentView");if(b){if(b.createdByParent){container.removeChildAndDestroy(b)}else{container.removeChild(b)}}if(a){this.appendChild(a)}this.activeContentView=a;this.invokeLast("childDidChange")}.observes("contentView")});sc_require("views/workspace");sc_require("views/toolbar");SC.MasterDetailView=SC.View.extend({classNames:["sc-master-detail-view"],renderDelegateName:"masterDetailRenderDelegate",masterView:SC.WorkspaceView.extend({topToolbar:SC.ToolbarView.extend({}),contentView:SC.View.extend({backgroundColor:"white"})}),detailView:SC.WorkspaceView.extend({topToolbar:SC.ToolbarView.extend({childViews:["showHidePicker"],showHidePicker:SC.ButtonView.extend({layout:{left:7,centerY:0,height:30,width:100},controlSize:SC.AUTO_CONTROL_SIZE,title:"Picker",action:"toggleMasterPicker",isVisible:NO,isVisibleBinding:".parentView.masterIsHidden"})})}),autoHideMaster:function(){if(SC.platform.touch){return YES}return NO}.property().cacheable(),masterWidth:250,dividerWidth:SC.propertyFromRenderDelegate("dividerWidth",1),masterIsHidden:function(){if(!this.get("autoHideMaster")){return NO}if(this.get("orientation")===SC.HORIZONTAL_ORIENTATION){return NO}return YES}.property("autoHideMaster","orientation"),orientation:SC.VERTICAL_ORIENTATION,_scmd_frameDidChange:function(){var b=this.get("frame"),a;if(b.width>b.height){a=SC.HORIZONTAL_ORIENTATION}else{a=SC.VERTICAL_ORIENTATION}this.setIfChanged("orientation",a)}.observes("frame"),init:function(){arguments.callee.base.apply(this,arguments);this._scmd_frameDidChange();this._scmd_masterIsHiddenDidChange()},toggleMasterPicker:function(a){if(!this.get("masterIsHidden")){return}if(this._picker&&this._picker.get("isVisibleInWindow")){this.hideMasterPicker()}else{this.showMasterPicker(a)}},showMasterPicker:function(b){if(this._picker&&this._picker.get("isVisibleInWindow")){return}if(!this._picker){var a=this.get("pickerPane");this._picker=a.create({})}this._picker.set("contentView",this.get("masterView"));this._picker.set("extraRightOffset",this.get("pointerDistanceFromEdge"));this.showPicker(this._picker,b)},hideMasterPicker:function(){if(this._picker&&this._picker.get("isVisibleInWindow")){this.hidePicker(this._picker)}},showPicker:function(b,a){b.popup(a,SC.PICKER_POINTER,[3,0,1,2,3],[9,-9,-18,18])},hidePicker:function(a){a.remove()},pickerPane:SC.PickerPane.extend({layout:{width:250,height:480},themeName:"popover"}),_picker:null,pointerDistanceFromEdge:46,_scmd_masterIsHiddenDidChange:function(){var a=this.get("masterIsHidden");this.get("masterView").set("masterIsHidden",a);this.get("detailView").set("masterIsHidden",a)}.observes("masterIsHidden"),_scmd_orientationDidChange:function(){this.invokeOnce("_scmd_tile")}.observes("orientation"),_scmd_retileProperties:function(){this.invokeOnce("_scmd_tile")}.observes("masterIsHidden","masterWidth"),createChildViews:function(){var b=this.get("masterView");b=this.masterView=this.createChildView(b);var a=this.get("detailView");a=this.detailView=this.createChildView(a);this.appendChild(a);this.invokeOnce("_scmd_tile")},_masterIsDrawn:NO,_scmd_tile:function(){var b=!this.get("masterIsHidden");var e=this.get("masterWidth"),d=this.get("masterView"),c=this.get("detailView");if(b){this.hideMasterPicker();if(!this._masterIsDrawn){if(this._picker){this._picker.set("contentView",null)}this.appendChild(d);this._masterIsDrawn=YES}d.set("layout",{left:0,top:0,bottom:0,width:e});var a=this.get("dividerWidth");c.set("layout",{left:e+a,right:0,top:0,bottom:0})}else{if(this._masterIsDrawn){this.removeChild(d);this._masterIsDrawn=NO}c.set("layout",{left:0,right:0,top:0,bottom:0})}}});SC.ScrollerView=SC.View.extend({classNames:["sc-scroller-view"],displayProperties:["thumbPosition","thumbLength","controlsHidden"],ariaRole:"scrollbar",shouldScrollToClick:NO,value:null,displayValue:function(){return Math.max(Math.min(this.get("value"),this.get("maximum")),this.get("minimum"))}.property("value","minimum","maximum").cacheable(),proportion:0,maximum:0,minimum:0,isEnabled:function(a,b){if(b!==undefined){this._scsv_isEnabled=b}if(this._scsv_isEnabled!==undefined){return this._scsv_isEnabled}return this.get("proportion")<1}.property("proportion").cacheable(),_scsv_isEnabled:undefined,layoutDirection:SC.LAYOUT_VERTICAL,hasButtons:YES,scrollbarThickness:14,capLength:18,capOverlap:14,buttonLength:41,buttonOverlap:9,minimumThumbLength:20,render:function(c,a){var g="vertical",b={},i=this.get("parentView"),f=this.get("layoutDirection"),d,h,e;switch(f){case SC.LAYOUT_VERTICAL:b["sc-vertical"]=YES;break;case SC.LAYOUT_HORIZONTAL:b["sc-horizontal"]=YES;g="horizontal";break}b["controls-hidden"]=this.get("controlsHidden");c.setClass(b);h=this.get("thumbLength");d=this.get("thumbPosition");if(a){c.push('<div class="track"></div>','<div class="cap"></div>');this.renderButtons(c,this.get("hasButtons"));this.renderThumb(c,f,h,d);c.setAttr("aria-orientation",g);c.setAttr("aria-valuemax",this.get("maximum"));c.setAttr("aria-valuemin",this.get("minimum"));c.setAttr("aria-valuenow",this.get("value"));c.setAttr("aria-controls",i.getPath("contentView.layerId"))}else{if(this.get("controlsHidden")){return}e=this.$(".thumb");this.adjustThumb(e,d,h);c.setAttr("aria-valuenow",this.get("value"));if(this.didChangeFor("render-min","minimum")){c.setAttr("aria-valuemin",this.get("minimum"))}if(this.didChangeFor("render-max","maximum")){c.setAttr("aria-valuemax",this.get("maximum"))}}},renderThumb:function(d,e,b,c){var a;if(e===SC.LAYOUT_HORIZONTAL){a="width: "+b+"px; left: "+c+"px;"}else{a="height: "+b+"px; top: "+c+"px;"}d.push('<div class="thumb" style="%@">'.fmt(a),'<div class="thumb-center"></div>','<div class="thumb-top"></div>','<div class="thumb-bottom"></div></div>')},renderButtons:function(b,a){if(a){b.push('<div class="button-bottom"></div><div class="button-top"></div>')}else{b.push('<div class="endcap"></div>')}},adjustThumb:function(b,a,c){this.adjustThumbPosition(b,a);this.adjustThumbSize(b,c)},adjustThumbPosition:function(b,d){var a=SC.browser.experimentalCSSNameFor("transform"),i=b[0];if(this._thumbPosition!==d){var j=this.get("parentView"),g=j._sc_isAnimating;if(SC.platform.supportsCSSTransitions){var e=SC.browser.experimentalStyleNameFor("transition");if(g){var f=j._sc_animationDuration,c=j._sc_animationTiming.toString();if(SC.platform.supportsCSSTransforms){i.style[e]=a+" "+f+"s "+c}else{switch(this.get("layoutDirection")){case SC.LAYOUT_VERTICAL:i.style[e]="top "+f+"s "+c;break;case SC.LAYOUT_HORIZONTAL:i.style[e]="left "+f+"s "+c;break}}}else{i.style[e]=""}}var h;switch(this.get("layoutDirection")){case SC.LAYOUT_VERTICAL:if(SC.platform.supportsCSSTransforms){h="translateX(0px) translateY("+d+"px)";if(SC.platform.supportsCSS3DTransforms){h+=" translateZ(0px)"}i.style[a]=h}else{i.style.top=d}break;case SC.LAYOUT_HORIZONTAL:if(SC.platform.supportsCSSTransforms){h="translateX("+d+"px) translateY(0px)";if(SC.platform.supportsCSS3DTransforms){h+=" translateZ(0px)"}i.style[a]=h}else{i.style.left=d}break}}this._thumbPosition=d},adjustThumbSize:function(a,b){if(this._thumbSize===b){return}switch(this.get("layoutDirection")){case SC.LAYOUT_VERTICAL:a.css("height",Math.max(b,this.get("minimumThumbLength")));break;case SC.LAYOUT_HORIZONTAL:a.css("width",Math.max(b,this.get("minimumThumbLength")));break}this._thumbSize=b},trackLength:function(){var a=this.get("scrollerLength");a-=this.get("capLength")-this.get("capOverlap");a-=this.buttonLength-this.buttonOverlap;return a}.property("scrollerLength").cacheable(),scrollerLength:function(){switch(this.get("layoutDirection")){case SC.LAYOUT_VERTICAL:return this.get("frame").height;case SC.LAYOUT_HORIZONTAL:return this.get("frame").width}return 0}.property("frame").cacheable(),thumbLength:function(){var c=this.get("value"),e=this.get("maximum"),b=this.get("minimum"),d=this.get("proportion"),a;if(c<b){d-=(b-c)/e}else{if(c>e){d-=(c-e)/e}}a=Math.floor(this.get("trackLength")*d);a=isNaN(a)?0:a;return Math.max(a,this.get("minimumThumbLength"))}.property("value","minimum","maximum","trackLength","proportion").cacheable(),thumbPosition:function(){var e=this.get("displayValue"),g=this.get("maximum"),b=this.get("trackLength"),c=this.get("thumbLength"),f=this.get("capLength"),d=this.get("capOverlap"),a;a=(e/g)*(b-c);a+=f-d;return Math.floor(isNaN(a)?0:a)}.property("displayValue","maximum","trackLength","thumbLength").cacheable(),controlsHidden:function(){return this.get("proportion")>=1}.property("proportion").cacheable(),fadeIn:null,fadeOut:null,valueForPosition:function(g){var b=this.get("maximum"),a=this.get("trackLength"),c=this.get("thumbLength"),f=this.get("capLength"),d=this.get("capOverlap"),e;e=g-(f-d);e=e/(a-c);e=e*b;return e},mouseDown:function(g){if(g.which!==1){return false}if(!this.get("isEnabledInPane")){return NO}this._altIsDown=g.altKey;this._shiftIsDown=g.shiftKey;var d=g.target,b=this.get("thumbPosition"),c,e=this.get("scrollerLength");if(d.className.indexOf("thumb")>=0){c=this.convertFrameFromView({x:g.pageX,y:g.pageY});c.x-=b;c.y-=b;this._thumbDragging=YES;this._thumbOffset=c;this._mouseDownLocation={x:g.pageX,y:g.pageY};this._thumbPositionAtDragStart=this.get("thumbPosition");this._valueAtDragStart=this.get("value")}else{if(d.className.indexOf("button-top")>=0){this.decrementProperty("value",(this._altIsDown?e:30));this.makeButtonActive(".button-top");this.startMouseDownTimer("scrollUp");this._isScrollingUp=YES}else{if(d.className.indexOf("button-bottom")>=0){this.incrementProperty("value",(this._altIsDown?e:30));this.makeButtonActive(".button-bottom");this.startMouseDownTimer("scrollDown");this._isScrollingDown=YES}else{var i=this.get("shouldScrollToClick");if(g.altKey){i=!i}var f=this.get("thumbLength"),a=this.convertFrameFromView({x:g.pageX,y:g.pageY}),h;switch(this.get("layoutDirection")){case SC.LAYOUT_VERTICAL:this._mouseDownLocation=h=a.y;break;case SC.LAYOUT_HORIZONTAL:this._mouseDownLocation=h=a.x;break}if(i){this.set("value",Math.min(this.get("maximum"),Math.max(this.get("minimum"),this.valueForPosition(h-(f/2)))));b=this.get("thumbPosition");this._thumbDragging=YES;this._thumbOffset={x:a.x-b,y:a.y-b};this._mouseDownLocation={x:g.pageX,y:g.pageY};this._thumbPositionAtDragStart=b;this._valueAtDragStart=this.get("value")}else{if(h<b){this.decrementProperty("value",e);this.startMouseDownTimer("page")}else{this.incrementProperty("value",e);this.startMouseDownTimer("page")}}}}}return YES},mouseUp:function(a){var c=this._scs_buttonActive,b=NO,d;if(c){c.removeClass("active");b=YES}d=this._mouseDownTimer;if(d){d.invalidate();this._mouseDownTimer=null}this._thumbDragging=NO;this._isScrollingDown=NO;this._isScrollingUp=NO;return b},mouseDragged:function(i){if(!this.get("isEnabledInPane")){return NO}var a,h,b,c=this._thumbPositionAtDragStart,f=this._isScrollingUp,k=this._isScrollingDown,d=this._scs_buttonActive;if(this._thumbDragging){switch(this.get("layoutDirection")){case SC.LAYOUT_VERTICAL:h=(i.pageY-this._mouseDownLocation.y);break;case SC.LAYOUT_HORIZONTAL:h=(i.pageX-this._mouseDownLocation.x);break}if(i.altKey){if(!this._altIsDown||(this._shiftIsDown!==i.shiftKey)){c=this._thumbPositionAtDragStart=c+h;h=0;this._mouseDownLocation={x:i.pageX,y:i.pageY};this._valueAtDragStart=this.get("value")}if(i.shiftKey){h=-h}this.set("value",Math.min(this.get("maximum"),Math.max(this.get("minimum"),Math.round(this._valueAtDragStart+h*2))))}else{b=c+h;a=this.get("trackLength")-this.get("thumbLength");this.set("value",Math.min(this.get("maximum"),Math.max(this.get("minimum"),Math.round((b/a)*this.get("maximum")))))}}else{if(f||k){var j=NO,e=NO;var g=this.$(".button-top")[0].getBoundingClientRect();switch(this.get("layoutDirection")){case SC.LAYOUT_VERTICAL:if(i.clientY<g.bottom){j=YES}else{e=YES}break;case SC.LAYOUT_HORIZONTAL:if(i.clientX<g.right){j=YES}else{e=YES}break}if((j||e)&&j!==f){if(d){d.removeClass("active")}this._mouseDownTimerAction=j?"scrollUp":"scrollDown";if(j){this.makeButtonActive(".button-top")}else{if(e){this.makeButtonActive(".button-bottom")}}this._isScrollingUp=j;this._isScrollingDown=e}}}this._altIsDown=i.altKey;this._shiftIsDown=i.shiftKey;return YES},startMouseDownTimer:function(b,a){this._mouseDownTimerAction=b;this._mouseDownTimer=SC.Timer.schedule({target:this,action:this.mouseDownTimerDidFire,interval:a?0:300})},mouseDownTimerDidFire:function(){var d=this.get("scrollerLength"),a=SC.device.get("mouseLocation"),c=this.get("thumbPosition"),b=this.get("thumbLength"),e=50;switch(this.get("layoutDirection")){case SC.LAYOUT_VERTICAL:a=this.convertFrameFromView(a).y;break;case SC.LAYOUT_HORIZONTAL:a=this.convertFrameFromView(a).x;break}switch(this._mouseDownTimerAction){case"scrollDown":this.incrementProperty("value",this._altIsDown?d:30);break;case"scrollUp":this.decrementProperty("value",this._altIsDown?d:30);break;case"page":e=150;if(a<c){this.decrementProperty("value",d)}else{if(a>c+b){this.incrementProperty("value",d)}}}this._mouseDownTimer=SC.Timer.schedule({target:this,action:this.mouseDownTimerDidFire,interval:e})},makeButtonActive:function(a){this._scs_buttonActive=this.$(a).addClass("active")}});SC.OverlayScrollerView=SC.ScrollerView.extend({fadeIn:function(){this.$().toggleClass("fade-in",true);this.$().toggleClass("fade-out",false)},fadeOut:function(){this.$().toggleClass("fade-in",false);this.$().toggleClass("fade-out",true)},classNames:["sc-touch-scroller-view","sc-overlay-scroller-view"],scrollbarThickness:12,capLength:3,capOverlap:0,buttonLength:3,buttonOverlap:0,hasButtons:NO,adjustThumb:function(b,d,j){var a=SC.browser.experimentalCSSNameFor("transform"),l=b[0],i=this.$(".thumb-inner"),h=i[0];if(this._thumbPosition!==d){var m=this.get("parentView"),g=m._sc_isAnimating;if(SC.platform.supportsCSSTransitions){var e=SC.browser.experimentalStyleNameFor("transition");if(g){var f=m._sc_animationDuration,c=m._sc_animationTiming.toString();if(SC.platform.supportsCSSTransforms){l.style[e]=a+" "+f+"s "+c;if(this._thumbSize!==j){h.style[e]=a+" "+f+"s "+c}}else{switch(this.get("layoutDirection")){case SC.LAYOUT_VERTICAL:l.style[e]="top "+f+"s "+c;if(this._thumbSize!==j){h.style[e]="top "+f+"s "+c}break;case SC.LAYOUT_HORIZONTAL:l.style[e]="left "+f+"s "+c;if(this._thumbSize!==j){h.style[e]="left "+f+"s "+c}break}}}else{l.style[e]="";h.style[e]=""}}var k;switch(this.get("layoutDirection")){case SC.LAYOUT_VERTICAL:if(SC.platform.supportsCSSTransforms){k="translateX(0px) translateY("+d+"px)";if(SC.platform.supportsCSS3DTransforms){k+=" translateZ(0px)"}l.style[a]=k;if(this._thumbSize!==j){k="translateX(0px) translateY("+Math.round(j-1044)+"px)";if(SC.platform.supportsCSS3DTransforms){k+=" translateZ(0px)"}h.style[a]=k}}else{l.style.top=d;if(this._thumbSize!==j){h.style.top=Math.round(j-1044)}}break;case SC.LAYOUT_HORIZONTAL:if(SC.platform.supportsCSSTransforms){k="translateX("+d+"px) translateY(0px)";if(SC.platform.supportsCSS3DTransforms){k+=" translateZ(0px)"}l.style[a]=k;if(this._thumbSize!==j){k="translateX("+Math.round(j-1044)+"px) translateY(0px)";if(SC.platform.supportsCSS3DTransforms){k+=" translateZ(0px)"}h.style[a]=k}}else{l.style.left=d;if(this._thumbSize!==j){h.style.left=Math.round(j-1044)}}break}}this._thumbPosition=d;this._thumbSize=j},render:function(c,f){var e=[],b,a,d;switch(this.get("layoutDirection")){case SC.LAYOUT_VERTICAL:e.push("sc-vertical");break;case SC.LAYOUT_HORIZONTAL:e.push("sc-horizontal");break}if(this.get("controlsHidden")){e.push("controls-hidden")}c.addClass(e);a=this.get("thumbLength");b=this.get("thumbPosition");if(f){c.push('<div class="track"></div><div class="cap"></div>');this.renderButtons(c,this.get("hasButtons"));this.renderThumb(c,b,a)}else{if(this.get("controlsHidden")){return}d=this.$(".thumb");this.adjustThumb(d,b,a)}},renderThumb:function(f,e,c){var b=SC.browser.experimentalCSSNameFor("transform"),d,a;switch(this.get("layoutDirection")){case SC.LAYOUT_VERTICAL:d=b+": translate3d(0px,"+e+"px,0px)";a=b+": translateY("+(c-1044)+"px)".fmt();break;case SC.LAYOUT_HORIZONTAL:d=b+": translate3d("+e+"px,0px,0px)";a=b+": translateX("+(c-1044)+"px)".fmt();break}f.push('<div class="thumb" style="%@;">'.fmt(d)+'<div class="thumb-top"></div><div class="thumb-clip">'+'<div class="thumb-inner" style="%@;">'.fmt(a)+'<div class="thumb-center"></div><div class="thumb-bottom"></div></div></div></div>');this._thumbPosition=e;this._thumbSize=c}});SC.TouchScrollerView=SC.OverlayScrollerView.extend({});sc_require("views/scroller");SC.SCROLL={DRAG_SCROLL_DECELERATION:3,SCROLL_GESTURE_THRESHOLD:5,SCROLL_LOCK_GESTURE_THRESHOLD:50,SCALE_GESTURE_THRESHOLD:3};SC.ScrollView=SC.View.extend({_sc_animationDuration:null,_sc_animationTiming:null,_sc_containerHeight:0,_sc_containerOffset:null,_sc_containerWidth:0,_sc_contentHeight:0,_sc_contentHeightDidChange:false,_sc_contentScale:undefined,_sc_contentScaleDidChange:false,_sc_contentWidth:0,_sc_contentWidthDidChange:false,_sc_gestureAnchorHOffset:null,_sc_gestureAnchorTotalD:null,_sc_gestureAnchorTotalX:null,_sc_gestureAnchorTotalY:null,_sc_gestureAnchorVOffset:null,_sc_gestureAnchorX:null,_sc_gestureAnchorY:null,_sc_gestureAnchorD:null,_sc_gestureAnchorScale:null,_sc_horizontalFadeOutTimer:null,_sc_horizontalScrollOffset:null,_sc_horizontalPct:null,_sc_isTouchScaling:false,_sc_isTouchScrollingH:false,_sc_isTouchScrollingHOnly:false,_sc_isTouchScrollingV:false,_sc_isTouchScrollingVOnly:false,_sc_minimumFadeOutDelay:function(){return Math.max(Math.max(this.get("fadeOutDelay")||0,0.1),this.get("fadeInDuration")||0)*1000}.property("fadeOutDelay").cacheable(),_sc_overDragSlip:0.5,_sc_passTouchToContentTimer:null,_sc_scale:1,_sc_touchCenterX:null,_sc_touchCenterY:null,_sc_verticalFadeOutTimer:null,_sc_verticalScrollOffset:null,_sc_verticalPct:null,acceptsMultitouch:true,animationCurveDecelerate:SC.easingCurve(0.35,0.34,0.84,1),animationCurveReverse:SC.easingCurve(0.45,-0.47,0.73,1.3),animationCurveSnap:SC.easingCurve(0.28,0.36,0.52,1),autohidesHorizontalScroller:true,autohidesVerticalScroller:true,canScale:false,canScrollHorizontal:function(){return !!(this.get("hasHorizontalScroller")&&this.get("horizontalScrollerView")&&this.get("isHorizontalScrollerVisible"))}.property("isHorizontalScrollerVisible").cacheable(),canScrollVertical:function(){return !!(this.get("hasVerticalScroller")&&this.get("verticalScrollerView")&&this.get("isVerticalScrollerVisible"))}.property("isVerticalScrollerVisible").cacheable(),classNames:["sc-scroll-view"],containerView:SC.ContainerView,contentView:null,decelerationRate:SC.SCROLL.DRAG_SCROLL_DECELERATION,delaysContentTouches:true,fadeOutDelay:0.4,hasHorizontalScroller:true,hasVerticalScroller:true,horizontalAlign:SC.ALIGN_CENTER,horizontalFade:true,horizontalLineScroll:20,horizontalOverlay:false,horizontalPageScroll:function(){return this.get("frame").width}.property("frame"),horizontalScrollOffset:function(e,g){var f=this._sc_containerWidth,b=this._sc_contentWidth,d=this.get("minimumHorizontalScrollOffset"),a=this.get("maximumHorizontalScrollOffset");if(g!=null){if(!this._sc_isTouchScrollingH){g=Math.max(d,Math.min(a,g))}if(b>0){this._sc_horizontalPct=(g+(f/2))/b}}else{g=this._sc_horizontalScrollOffset;if(g==null){var c=this.get("initialHorizontalAlign");g=this._sc_alignedHorizontalOffset(c,f,b)}}this._sc_horizontalScrollOffset=g;return g}.property().cacheable(),horizontalScrollerLayout:null,horizontalScrollerView:null,initialHorizontalAlign:SC.outlet("horizontalAlign"),initialVerticalAlign:SC.outlet("verticalAlign"),isHorizontalScrollerVisible:true,isScrollable:true,isVerticalScrollerVisible:true,maximumHorizontalScrollOffset:function(){return Math.max(this._sc_contentWidth-this._sc_containerWidth,0)}.property("_sc_containerWidth","_sc_contentWidth").cacheable(),maximumScale:2,maximumVerticalScrollOffset:function(){return Math.max(this._sc_contentHeight-this._sc_containerHeight,0)}.property("_sc_containerHeight","_sc_contentHeight").cacheable(),minimumHorizontalScrollOffset:function(){return Math.min(this._sc_contentWidth-this._sc_containerWidth,0)}.property("_sc_containerWidth","_sc_contentWidth").cacheable(),minimumScale:0.25,minimumVerticalScrollOffset:function(){return Math.min(this._sc_contentHeight-this._sc_containerHeight,0)}.property("_sc_containerHeight","_sc_contentHeight").cacheable(),scale:function(c,d){if(d!=null){if(!this.get("canScale")){d=1}else{var b=this.get("minimumScale"),a=this.get("maximumScale");if(this._sc_isTouchScaling){b=b-(b*0.1);a=a+(a*0.1);if((d<b||d>a)){d=Math.min(Math.max(b,d),a)}}else{if((d<b||d>a)){d=Math.min(Math.max(b,d),a)}}}}else{d=this._sc_scale}this._sc_scale=d;return d}.property("canScale","minimumScale","maximumScale").cacheable(),scaleGestureThreshold:SC.SCROLL.SCALE_GESTURE_THRESHOLD,scrollGestureThreshold:SC.SCROLL.SCROLL_GESTURE_THRESHOLD,scrollLockGestureThreshold:SC.SCROLL.SCROLL_LOCK_GESTURE_THRESHOLD,verticalAlign:SC.ALIGN_TOP,verticalFade:true,verticalLineScroll:20,verticalOverlay:false,verticalPageScroll:function(){return this.get("frame").height}.property("frame"),verticalScrollOffset:function(c,f){var e=this._sc_containerHeight,d=this._sc_contentHeight,b=this.get("minimumVerticalScrollOffset"),a=this.get("maximumVerticalScrollOffset");if(f!=null){if(!this._sc_isTouchScrollingV){f=Math.max(b,Math.min(a,f))}if(d>0){this._sc_verticalPct=(f+(e/2))/d}}else{f=this._sc_verticalScrollOffset;if(f==null){var g=this.get("initialVerticalAlign");f=this._sc_alignedVerticalOffset(g,e,d)}}this._sc_verticalScrollOffset=f;return f}.property().cacheable(),verticalScrollerLayout:null,verticalScrollerView:null,_sc_alignedHorizontalOffset:function(b,c,a){switch(b){case SC.ALIGN_RIGHT:return 0-(c-a);case SC.ALIGN_CENTER:return 0-((c-a)/2);default:return 0}},_sc_alignedVerticalOffset:function(c,b,a){switch(c){case SC.ALIGN_BOTTOM:return 0-(b-a);case SC.ALIGN_MIDDLE:return 0-((b-a)/2);default:return 0}},_sc_animateContentView:function(j){var h=this._sc_animationTiming,l=this._sc_animationDuration*1000,d=new Date(),m=this.get("contentView"),b=m.get("layout"),f=b.left,c=j.left-f,a=b.scale==null?1:b.scale,k=j.scale-a,i=b.top,g=j.top-i,n=this;function e(){if(n._sc_isAnimating){var p=new Date()-d,o=Math.min(p/l,1);SC.run(function(){var r=f+c*h.value(o),s=a+k*h.value(o),q=i+g*h.value(o);j.left=r;j.top=q;j.scale=s;m.adjust(j)});if(o<1){window.requestAnimationFrame(e)}else{n._sc_isAnimating=false;n._sc_animationDuration=null;n._sc_animationTiming=null}}}n._sc_isAnimating=true;e()},_sc_cancelAnimation:function(){if(this._sc_isAnimating){var b=this.get("contentView");var a=b.get("layout");this.set("horizontalScrollOffset",-a.left);this.set("verticalScrollOffset",-a.top);this.set("scale",a.scale);this._sc_isAnimating=false;this._sc_animationDuration=null;this._sc_animationTiming=null}},_sc_containerViewFrameDidChange:function(){var a=this.getPath("containerView.frame"),c=this.get("contentView"),f=this.get("maximumHorizontalScrollOffset"),b=this.get("maximumVerticalScrollOffset"),e=this.get("minimumHorizontalScrollOffset"),d=this.get("minimumVerticalScrollOffset");this.set("_sc_containerHeight",a.height);this.set("_sc_containerWidth",a.width);if(c){this._sc_contentViewSizeDidChange(e,f,d,b)}},_sc_contentViewDidChange:function(){var c=this.get("contentView"),b=this.get("containerView"),a=this._sc_contentViewFrameDidChange;this._sc_removeContentViewObservers();this._sc_contentHeight=0;this._sc_contentWidth=0;this._sc_contentScale=undefined;b.set("contentView",c);c=this.contentView=b.get("contentView");if(c){if(!c.useStaticLayout){}c.addObserver("frame",this,a);this._sc_contentViewFrameDidChange()}this._sc_contentView=c},_sc_contentViewFrameDidChange:function(){var e=this._sc_contentHeight,c=this._sc_contentScale,a=this._sc_contentWidth,h=this.getPath("contentView.borderFrame"),g=this.get("maximumHorizontalScrollOffset"),b=this.get("maximumVerticalScrollOffset"),f=this.get("minimumHorizontalScrollOffset"),d=this.get("minimumVerticalScrollOffset");if(h){if(c!==h.scale){this._sc_contentScaleDidChange=true;this.set("_sc_contentScale",h.scale)}if(a!==h.width){this._sc_contentWidthDidChange=true;this.set("_sc_contentWidth",h.width)}if(e!==h.height){this._sc_contentHeightDidChange=true;this.set("_sc_contentHeight",h.height)}if(this._sc_contentScaleDidChange||this._sc_contentWidthDidChange||this._sc_contentHeightDidChange){this._sc_contentViewSizeDidChange(f,g,d,b)}}},_sc_contentViewSizeDidChange:function(k,i,o,h){var f=this.get("maximumHorizontalScrollOffset"),p=this.get("maximumVerticalScrollOffset"),q,l,n,a;q=this._sc_containerHeight;l=this._sc_containerWidth;n=this._sc_contentHeight;a=this._sc_contentWidth;var m;if(a){if(f===0){m=this._sc_alignedHorizontalOffset(this.get("horizontalAlign"),l,a);this.set("horizontalScrollOffset",m)}else{if(this._sc_horizontalPct==null){this._sc_horizontalScrollOffset=null;this.notifyPropertyChange("horizontalScrollOffset")}else{if(this._sc_contentScaleDidChange){if(this._sc_touchCenterX!=null){m=(this._sc_horizontalPct*a)-this._sc_touchCenterX}else{m=(this._sc_horizontalPct*a)-(l/2)}this.set("horizontalScrollOffset",m);if(this._sc_gestureAnchorHOffset!=null){this._sc_gestureAnchorHOffset=m}}else{if(this.get("canScrollHorizontal")){var b=this.get("horizontalAlign"),g=this._sc_horizontalScrollOffset,e=this.get("minimumHorizontalScrollOffset");switch(b){case SC.ALIGN_CENTER:if((k<0&&e===0)||(g===i/2)){this.set("horizontalScrollOffset",f/2)}break;case SC.ALIGN_RIGHT:if((k<0&&e===0)||(g===i)){this.set("horizontalScrollOffset",f)}break}if(g>f){this.set("horizontalScrollOffset",f)}}}}}}if(n){if(p===0){m=this._sc_alignedVerticalOffset(this.get("verticalAlign"),q,n);this.set("verticalScrollOffset",m)}else{if(this._sc_verticalPct==null){this._sc_verticalScrollOffset=null;this.notifyPropertyChange("verticalScrollOffset")}else{if(this._sc_contentScaleDidChange){if(this._sc_touchCenterY!=null){m=(this._sc_verticalPct*n)-this._sc_touchCenterY}else{m=(this._sc_verticalPct*n)-(q/2)}this.set("verticalScrollOffset",m);if(this._sc_gestureAnchorVOffset!=null){this._sc_gestureAnchorVOffset=m}}else{if(this.get("canScrollVertical")){var d=this.get("verticalAlign"),c=this._sc_verticalScrollOffset,j=this.get("minimumVerticalScrollOffset");switch(d){case SC.ALIGN_MIDDLE:if((o<0&&j===0)||(c===h/2)){this.set("verticalScrollOffset",p/2)}break;case SC.ALIGN_BOTTOM:if((o<0&&j===0)||(c===h)){this.set("verticalScrollOffset",p)}break}if(c>p){this.set("verticalScrollOffset",p)}}}}}}this._sc_contentScaleDidChange=false;this._sc_contentHeightDidChange=false;this._sc_contentWidthDidChange=false;this._sc_updateScrollers()},_sc_fadeInHorizontalScroller:function(){var b=this.get("canScrollHorizontal"),c=this.get("horizontalScrollerView"),a;if(b&&c&&c.get("fadeIn")){if(this._sc_horizontalFadeOutTimer){this._sc_horizontalFadeOutTimer.startTime=null;this._sc_horizontalFadeOutTimer.schedule()}else{c.fadeIn();a=this.get("_sc_minimumFadeOutDelay");this._sc_horizontalFadeOutTimer=this.invokeLater(this._sc_fadeOutHorizontalScroller,a)}}},_sc_fadeInVerticalScroller:function(){var b=this.get("canScrollVertical"),a=this.get("verticalScrollerView"),c;if(b&&a&&a.get("fadeIn")){if(this._sc_verticalFadeOutTimer){this._sc_verticalFadeOutTimer.startTime=null;this._sc_verticalFadeOutTimer.schedule()}else{a.fadeIn();c=this.get("_sc_minimumFadeOutDelay");this._sc_verticalFadeOutTimer=this.invokeLater(this._sc_fadeOutVerticalScroller,c)}}},_sc_fadeOutHorizontalScroller:function(){var a=this.get("horizontalScrollerView");if(a&&a.get("fadeOut")){a.fadeOut()}this._sc_horizontalFadeOutTimer=null},_sc_fadeOutVerticalScroller:function(){var a=this.get("verticalScrollerView");if(a&&a.get("fadeOut")){a.fadeOut()}this._sc_verticalFadeOutTimer=null},_sc_horizontalAlignDidChange:function(){var c=this.get("maximumHorizontalScrollOffset");if(c===0&&this._sc_contentWidth){var a=this.get("horizontalAlign"),b;b=this._sc_alignedHorizontalOffset(a,this._sc_containerWidth,this._sc_contentWidth);this.set("horizontalScrollOffset",b)}},_sc_maximumScrollOffset:function(c,b,d,a){if(a===NO){c=Math.min(c,b)}if(c>=b){return c-b}if(d===SC.ALIGN_LEFT||d===SC.ALIGN_TOP){return 0}else{if(d===SC.ALIGN_MIDDLE||d===SC.ALIGN_CENTER){return 0-Math.round((b-c)/2)}else{return 0-(b-c)}}},_sc_minimumScrollOffset:function(c,b,d,a){if(a===NO){c=Math.min(c,b)}if(c>b){return 0}if(d===SC.ALIGN_LEFT||d===SC.ALIGN_TOP){return 0}else{if(d===SC.ALIGN_MIDDLE||d===SC.ALIGN_CENTER){return 0-Math.round((b-c)/2)}else{return 0-(b-c)}}},_sc_registerAutoscroll:function(){if(this.get("isVisibleInWindow")&&this.get("isEnabledInPane")){SC.Drag.addScrollableView(this)}else{SC.Drag.removeScrollableView(this)}},_sc_repositionContentView:function(){var a=this.get("contentView");if(a){this.invokeOnce(this._sc_repositionContentViewUnfiltered)}},_sc_repositionContentViewUnfiltered:function(){var j=this.get("containerView"),k=this.get("contentView"),f=this.get("horizontalScrollOffset"),b=this.get("verticalScrollOffset"),e=this.get("scale");if(k.useStaticLayout){var g=j.get("layer");g.style.marginLeft=-f+"px";g.style.marginTop=-b+"px"}else{var a=this.get("horizontalAlign"),d=this.get("verticalAlign"),c,i;c=-f;switch(a){case SC.ALIGN_CENTER:c=Math.round(c);break;case SC.ALIGN_RIGHT:c=Math.ceil(c);break;default:c=Math.floor(c)}i=-b;switch(d){case SC.ALIGN_MIDDLE:i=Math.round(i);break;case SC.ALIGN_BOTTOM:i=Math.ceil(i);break;default:i=Math.floor(i)}var h=SC.ScrollView._SC_CONTENT_ADJUST_MAP;if(!h){h=SC.ScrollView._SC_CONTENT_ADJUST_MAP={transformOriginX:0,transformOriginY:0}}h.left=c;h.top=i;h.scale=e;if(this._sc_animationDuration){this._sc_animateContentView(h)}else{k.adjust(h)}}},_sc_repositionScrollers:function(){this.invokeOnce(this._sc_repositionScrollersUnfiltered)},_sc_repositionScrollersUnfiltered:function(){var k=this.get("hasHorizontalScroller"),o=this.get("hasVerticalScroller"),g=this.get("canScrollHorizontal"),c=this.get("canScrollVertical"),j=SC.ScrollView._SC_CONTAINER_LAYOUT_MAP,b=this.get("horizontalScrollerView"),i=b&&g?b.get("scrollbarThickness"):0,l=this.get("verticalScrollerView"),e=l&&c?l.get("scrollbarThickness"):0,h;if(!j){j=SC.ScrollView._SC_CONTAINER_LAYOUT_MAP={}}j.bottom=0;j.right=0;if(k){var d=this.get("horizontalOverlay"),a=this.get("horizontalScrollerLayout");if(a){h={left:a.left,bottom:a.bottom,right:a.right+e,height:i}}else{h={left:0,bottom:0,right:e,height:i}}b.set("layout",h);if(g&&!d){j.bottom=i}b.set("isVisible",g);this._sc_fadeInHorizontalScroller()}if(o){var n=this.get("verticalOverlay"),f=this.get("verticalScrollerLayout");if(f){h={top:f.top,right:f.right,bottom:f.bottom+i,width:e}}else{h={top:0,right:0,bottom:i,width:e}}l.set("layout",h);if(c&&!n){j.right=e}l.set("isVisible",c);this._sc_fadeInVerticalScroller()}var m=this.get("containerView");m.adjust(j)},_sc_removeContentViewObservers:function(){var b=this._sc_contentView,a=this._sc_contentViewFrameDidChange;if(b){b.removeObserver("frame",this,a)}},_sc_scaleDidChange:function(){var a=this.get("contentView"),b=this.get("scale");if(a){if(a.useStaticLayout){}else{this._sc_repositionContentView()}}},_sc_scrollOffsetHorizontalDidChange:function(){this._sc_repositionContentView();this.invokeLast(this._sc_fadeInHorizontalScroller)},_sc_scrollOffsetVerticalDidChange:function(){this._sc_repositionContentView();this.invokeLast(this._sc_fadeInVerticalScroller)},_sc_updateScrollers:function(){var b=this.get("horizontalScrollerView"),g=this.get("verticalScrollerView"),c=this.get("minimumHorizontalScrollOffset"),f=this.get("minimumVerticalScrollOffset"),d=this.get("maximumHorizontalScrollOffset"),j=this.get("maximumVerticalScrollOffset"),k,h,i,a;k=this._sc_containerHeight;h=this._sc_containerWidth;i=this._sc_contentHeight;a=this._sc_contentWidth;var e;if(b){b.set("minimum",c);b.set("maximum",d);if(this.get("autohidesHorizontalScroller")){this.setIfChanged("isHorizontalScrollerVisible",a>h)}e=Math.min(h/a,1);b.setIfChanged("proportion",e)}if(g){g.set("minimum",f);g.set("maximum",j);if(this.get("autohidesVerticalScroller")){this.setIfChanged("isVerticalScrollerVisible",i>k)}e=Math.min(k/i,1);g.setIfChanged("proportion",e)}},_sc_verticalAlignDidChange:function(){var b=this.get("maximumVerticalScrollOffset");if(b===0&&this._sc_contentHeight){var c=this.get("verticalAlign"),a;a=this._sc_alignedVerticalOffset(c,this._sc_containerHeight,this._sc_contentHeight);this.set("verticalScrollOffset",a)}},createChildViews:function(){var c=[];var b=this.get("containerView");b=this.containerView=this.createChildView(b,{contentView:this.contentView});this.contentView=b.get("contentView");c.push(b);var a;if(!this.get("hasHorizontalScroller")){this.horizontalScrollerView=null}else{a=this.get("horizontalScrollerView");if(a==null){a=this.get("horizontalOverlay")?SC.OverlayScrollerView:SC.ScrollerView}a=this.horizontalScrollerView=this.createChildView(a,{isVisible:!this.get("autohidesHorizontalScroller"),layoutDirection:SC.LAYOUT_HORIZONTAL,value:this.get("horizontalScrollOffset"),valueBinding:".parentView.horizontalScrollOffset",minimum:this.get("minimumHorizontalScrollOffset"),maximum:this.get("maximumHorizontalScrollOffset")});c.push(a)}if(!this.get("hasVerticalScroller")){this.verticalScrollerView=null}else{a=this.get("verticalScrollerView");if(a==null){a=this.get("verticalOverlay")?SC.OverlayScrollerView:SC.ScrollerView}a=this.verticalScrollerView=this.createChildView(a,{isVisible:!this.get("autohidesVerticalScroller"),layoutDirection:SC.LAYOUT_VERTICAL,value:this.get("verticalScrollOffset"),valueBinding:".parentView.verticalScrollOffset",minimum:this.get("minimumVerticalScrollOffset"),maximum:this.get("maximumVerticalScrollOffset")});c.push(a)}this.childViews=c},destroy:function(){this._sc_removeContentViewObservers();this.removeObserver("contentView",this,this._sc_contentViewDidChange);this.removeObserver("horizontalAlign",this,this._sc_horizontalAlignDidChange);this.removeObserver("verticalAlign",this,this._sc_verticalAlignDidChange);arguments.callee.base.apply(this,arguments)},didCreateLayer:function(){this.addObserver("horizontalScrollOffset",this,this._sc_scrollOffsetHorizontalDidChange);this.addObserver("verticalScrollOffset",this,this._sc_scrollOffsetVerticalDidChange);this._sc_scrollOffsetHorizontalDidChange();this._sc_scrollOffsetVerticalDidChange();this.addObserver("isHorizontalScrollerVisible",this,this._sc_repositionScrollers);this.addObserver("isVerticalScrollerVisible",this,this._sc_repositionScrollers);this._sc_repositionScrollers();this.addObserver("scale",this,this._sc_scaleDidChange);this._sc_scaleDidChange();var a=this.get("containerView");a.addObserver("frame",this,this._sc_containerViewFrameDidChange);this._sc_containerViewFrameDidChange();this.addObserver("isVisibleInWindow",this,this._sc_registerAutoscroll);this.addObserver("isEnabledInPane",this,this._sc_registerAutoscroll);this._sc_registerAutoscroll()},init:function(){arguments.callee.base.apply(this,arguments);this.addObserver("contentView",this,this._sc_contentViewDidChange);this._sc_contentViewDidChange();this.addObserver("horizontalAlign",this,this._sc_horizontalAlignDidChange);this.addObserver("verticalAlign",this,this._sc_verticalAlignDidChange)},scrollBy:function(a,b){if(b===undefined&&SC.typeOf(a)===SC.T_HASH){b=a.y;a=a.x}a=(a)?this.get("horizontalScrollOffset")+a:null;b=(b)?this.get("verticalScrollOffset")+b:null;if(a!==null){a=Math.min(Math.max(this.get("minimumHorizontalScrollOffset"),a),this.get("maximumHorizontalScrollOffset"))}if(b!==null){b=Math.min(Math.max(this.get("minimumVerticalScrollOffset"),b),this.get("maximumVerticalScrollOffset"))}return this.scrollTo(a,b)},scrollDownLine:function(a){if(a===undefined){a=1}return this.scrollBy(null,this.get("verticalLineScroll")*a)},scrollDownPage:function(a){if(a===undefined){a=1}return this.scrollBy(null,this.get("verticalPageScroll")*a)},scrollLeftLine:function(a){if(a===undefined){a=1}return this.scrollTo(0-this.get("horizontalLineScroll")*a,null)},scrollLeftPage:function(a){if(a===undefined){a=1}return this.scrollBy(0-(this.get("horizontalPageScroll")*a),null)},scrollRightLine:function(a){if(a===undefined){a=1}return this.scrollTo(this.get("horizontalLineScroll")*a,null)},scrollRightPage:function(a){if(a===undefined){a=1}return this.scrollBy(this.get("horizontalPageScroll")*a,null)},scrollTo:function(a,b){if(b===undefined&&SC.typeOf(a)===SC.T_HASH){b=a.y;a=a.x}if(!SC.none(a)){this.set("horizontalScrollOffset",a)}if(!SC.none(b)){this.set("verticalScrollOffset",b)}return this},scrollToRect:function(b){var a=SC.cloneRect(this.get("containerView").get("frame")),e=this.get("horizontalScrollOffset"),d=this.get("verticalScrollOffset"),c=this.get("scale");a.x=e;a.y=d;if(c!==1){b=SC.cloneRect(b);b.x*=c;b.y*=c;b.height*=c;b.width*=c}a.y+=Math.max(0,SC.maxY(b)-SC.maxY(a));a.x+=Math.max(0,SC.maxX(b)-SC.maxX(a));a.y-=Math.max(0,SC.minY(a)-SC.minY(b));a.x-=Math.max(0,SC.minX(a)-SC.minX(b));if((e!==a.x)||(d!==a.y)){this.scrollTo(a.x,a.y);return YES}else{return NO}},scrollUpLine:function(a){if(a===undefined){a=1}return this.scrollBy(null,0-this.get("verticalLineScroll")*a)},scrollUpPage:function(a){if(a===undefined){a=1}return this.scrollBy(null,0-(this.get("verticalPageScroll")*a))},scrollToVisible:function(a){if(arguments.length===0){return arguments.callee.base.apply(this,arguments)}var b=this.get("contentView");if(!b){return NO}var c=a.get("borderFrame");if(!c){return NO}c=b.convertFrameFromView(c,a.get("parentView"));return this.scrollToRect(c)},willDestroyLayer:function(){this.removeObserver("horizontalScrollOffset",this,this._sc_scrollOffsetHorizontalDidChange);this.removeObserver("verticalScrollOffset",this,this._sc_scrollOffsetVerticalDidChange);this.removeObserver("isHorizontalScrollerVisible",this,this._sc_repositionScrollers);this.removeObserver("isVerticalScrollerVisible",this,this._sc_repositionScrollers);this.removeObserver("scale",this,this._sc_scaleDidChange);var a=this.get("containerView");a.removeObserver("frame",this,this._sc_containerViewFrameDidChange);this.removeObserver("isVisibleInWindow",this,this._sc_registerAutoscroll);this.removeObserver("isEnabledInPane",this,this._sc_registerAutoscroll);SC.Drag.removeScrollableView(this)},_sc_beginTouchesInContent:function(a){this._sc_passTouchToContentTimer=null;if(!a.captureTouch(this,true)){a.makeTouchResponder(a.targetView,true,this)}},_sc_touchEnded:function(j,q){var t=this.get("hasTouch");if(t){var b=j.averagedTouchesForView(this);this._sc_gestureAnchorD=this._sc_gestureAnchorTotalD=b.d;this._sc_gestureAnchorX=this._sc_gestureAnchorTotalX=b.x;this._sc_gestureAnchorY=this._sc_gestureAnchorTotalY=b.y;if(this._sc_containerOffset){this._sc_touchCenterX=b.x-this._sc_containerOffset.x;this._sc_touchCenterY=b.y-this._sc_containerOffset.y}}else{if(this._sc_isTouchScrollingV||this._sc_isTouchScrollingH||this._sc_isTouchScaling){var i=this.get("decelerationRate"),p=this._sc_containerHeight,m=this._sc_containerWidth,c=0,r=0,h,g;if(this._sc_isTouchScrollingH){var d=this.get("horizontalScrollOffset"),e=this.get("maximumHorizontalScrollOffset"),k=this.get("minimumHorizontalScrollOffset"),u=this._sc_touchVelocityH;if(d>e){this.set("horizontalScrollOffset",e);if(u<0.2){this._sc_animationTiming=this.get("animationCurveReverse")}else{this._sc_animationTiming=this.get("animationCurveSnap")}c=0.8*(d-e)/m}else{if(d<k){this.set("horizontalScrollOffset",k);if(u>0.2){this._sc_animationTiming=this.get("animationCurveReverse")}else{this._sc_animationTiming=this.get("animationCurveSnap")}c=0.8*(k-d)/m}else{d-=(Math.abs(u)*u*1000)/(2*i);if(d>e){h=(d-e)/m;g=2*h;this._sc_animationTiming=SC.easingCurve(0,0.5,h.toFixed(1),g.toFixed(1));d=e}else{if(d<k){h=(k-d)/m;g=2*h;this._sc_animationTiming=SC.easingCurve(0,0.5,h.toFixed(1),g.toFixed(1));d=k}else{this._sc_animationTiming=this.get("animationCurveDecelerate")}}this.set("horizontalScrollOffset",d);c=Math.abs(u/i)}}}if(this._sc_isTouchScrollingV){var o=this.get("verticalScrollOffset"),n=this.get("maximumVerticalScrollOffset"),f=this.get("minimumVerticalScrollOffset"),a=this._sc_touchVelocityV;if(o>n){this.set("verticalScrollOffset",n);if(a<0.2){this._sc_animationTiming=this.get("animationCurveReverse")}else{this._sc_animationTiming=this.get("animationCurveSnap")}r=0.8*(o-n)/p}else{if(o<f){this.set("verticalScrollOffset",f);if(a>0.2){this._sc_animationTiming=this.get("animationCurveReverse")}else{this._sc_animationTiming=this.get("animationCurveSnap")}r=0.8*(f-o)/p}else{o-=(Math.abs(a)*a*1000)/(2*i);if(o>n){h=(o-n)/p;g=2*h;this._sc_animationTiming=SC.easingCurve(0,0.5,h.toFixed(1),g.toFixed(1));"cubic-bezier(0.0,0.5,%@,%@)".fmt(h.toFixed(1),g.toFixed(1));o=n}else{if(o<f){h=(f-o)/p;g=2*h;this._sc_animationTiming=SC.easingCurve(0,0.5,h.toFixed(1),g.toFixed(1));"cubic-bezier(0.0,0.5,%@,%@)".fmt(h.toFixed(1),g.toFixed(1));o=f}else{this._sc_animationTiming=this.get("animationCurveDecelerate")}}this.set("verticalScrollOffset",o);r=Math.abs(a/i)}}}var v=this.get("scale"),w=this.get("maximumScale"),l=this.get("minimumScale"),s=0;if(v>w){this.set("scale",w);s=0.25}else{if(v<l){this.set("scale",l);s=0.25}else{}}this._sc_animationDuration=Math.max(Math.max(c,r),s);this._sc_touchVelocityH=null;this._sc_touchVelocityV=null}else{if(this._sc_passTouchToContentTimer){this._sc_passTouchToContentTimer.invalidate();this._sc_passTouchToContentTimer=null;if(!q){if(j.makeTouchResponder(j.targetView,true,this)){j.end()}}}}this._sc_gestureAnchorX=this._sc_gestureAnchorY=this._sc_gestureAnchorD=null;this._sc_gestureAnchorTotalX=this._sc_gestureAnchorTotalY=this._sc_gestureAnchorTotalD=null;this._sc_gestureAnchorScale=null;this._sc_gestureAnchorHOffset=null;this._sc_gestureAnchorVOffset=null;this._sc_containerOffset=null;this._sc_touchCenterX=null;this._sc_touchCenterY=null}this._sc_isTouchScrollingH=false;this._sc_isTouchScrollingHOnly=false;this._sc_isTouchScrollingV=false;this._sc_isTouchScrollingVOnly=false;this._sc_isTouchScaling=false;return true},captureTouch:function(a){if(this.get("delaysContentTouches")){return true}else{a.stackCandidateTouchResponder(this);return false}},mouseWheel:function(i){var h=false,j=this.get("contentView");if(j&&this.get("isEnabledInPane")){var f=this.get("horizontalScrollOffset"),d=this.get("minimumHorizontalScrollOffset"),g=this.get("minimumVerticalScrollOffset"),e=this.get("maximumHorizontalScrollOffset"),k=this.get("maximumVerticalScrollOffset"),b=this.get("verticalScrollOffset"),c=i.wheelDeltaX,a=i.wheelDeltaY;if(!this.get("canScrollHorizontal")){c=0}if(!this.get("canScrollVertical")){a=0}h=((c<0&&f>d)||(c>0&&f<e))||((a<0&&b>g)||(a>0&&b<k));if(h){this.scrollBy(c,a)}}return h},touchesDragged:function(t,i){var b=t.averagedTouchesForView(this),p=this.get("canScale"),f=this.get("canScrollHorizontal"),w=this.get("canScrollVertical"),x=this.get("scrollGestureThreshold"),n=this.get("scaleGestureThreshold"),u=this.get("scrollLockGestureThreshold"),d,s;if(!(this._sc_isTouchScrollingH&&this._sc_isTouchScrollingV)&&!this._sc_isTouchScrollingHOnly&&!this._sc_isTouchScrollingVOnly){if(f){var m=Math.abs(this._sc_gestureAnchorTotalX-b.x);if(!this._sc_isTouchScrollingH){this._sc_isTouchScrollingH=m>=x}else{this._sc_isTouchScrollingHOnly=m>=u}}if(w){var k=Math.abs(this._sc_gestureAnchorTotalY-b.y);if(!this._sc_isTouchScrollingV){this._sc_isTouchScrollingV=k>=x}else{this._sc_isTouchScrollingVOnly=k>=u}}}var A=this._sc_gestureAnchorX-b.x,c=Math.abs(A);if(f&&c>=1&&!this._sc_isTouchScrollingVOnly){this._sc_touchVelocityH=b.velocityX;var l=this.get("minimumHorizontalScrollOffset"),g=this.get("maximumHorizontalScrollOffset");d=this._sc_gestureAnchorHOffset+A;this._sc_gestureAnchorX=b.x;this._sc_gestureAnchorHOffset=d;if(d>g){d=d-this._sc_overDragSlip*(d-g)}else{if(d<l){d=d+this._sc_overDragSlip*(l-d)}}this.set("horizontalScrollOffset",d)}var z=this._sc_gestureAnchorY-b.y,a=Math.abs(z);if(w&&a>0&&!this._sc_isTouchScrollingHOnly){this._sc_touchVelocityV=b.velocityY;var h=this.get("minimumVerticalScrollOffset"),r=this.get("maximumVerticalScrollOffset");s=this._sc_gestureAnchorVOffset+z;this._sc_gestureAnchorY=b.y;this._sc_gestureAnchorVOffset=s;if(s>r){s=s-this._sc_overDragSlip*(s-r)}else{if(s<h){s=s+this._sc_overDragSlip*(h-s)}}this.set("verticalScrollOffset",s)}if(p){if(!this._sc_isTouchScaling){var v=Math.abs(this._sc_gestureAnchorTotalD-b.d);this._sc_isTouchScaling=!!b.d&&v>n}var o=this._sc_gestureAnchorD-b.d,q=Math.abs(o);if(q>0){var j=b.d/this._sc_gestureAnchorD,y=this._sc_gestureAnchorScale*j;d=this._sc_horizontalScrollOffset;s=this._sc_verticalScrollOffset;if(!this._sc_containerOffset){var e=this.getPath("containerView.layer");this._sc_containerOffset=SC.offset(e);this._sc_touchCenterX=b.x-this._sc_containerOffset.x;this._sc_touchCenterY=b.y-this._sc_containerOffset.y}this._sc_horizontalPct=(d+this._sc_touchCenterX)/this._sc_contentWidth;this._sc_verticalPct=(s+this._sc_touchCenterY)/this._sc_contentHeight;this.set("scale",y);this._sc_gestureAnchorD=b.d;this._sc_gestureAnchorScale=y}}if(this._sc_passTouchToContentTimer&&(this._sc_isTouchScrollingV||this._sc_isTouchScrollingH||this._sc_isTouchScaling)){this._sc_passTouchToContentTimer.invalidate();this._sc_passTouchToContentTimer=null}},touchCancelled:function(a){return this._sc_touchEnded(a,true)},touchEnd:function(a){return this._sc_touchEnded(a,false)},touchStart:function(e){var d=false,b=this.get("contentView");if(b&&this.get("isEnabledInPane")){var c=this.get("hasTouch");if(c){this._sc_isTouchScrollingV=this._sc_isTouchScrollingH=false;this._sc_isTouchScrollingHOnly=this._sc_isTouchScrollingHOnly=false;if(this._sc_passTouchToContentTimer){this._sc_passTouchToContentTimer.invalidate();this._sc_passTouchToContentTimer=null}}else{this._sc_cancelAnimation();if(this.get("delaysContentTouches")){this._sc_passTouchToContentTimer=this.invokeLater(this._sc_beginTouchesInContent,150,e)}}var a=e.averagedTouchesForView(this,true);this._sc_gestureAnchorX=this._sc_gestureAnchorTotalX=a.x;this._sc_gestureAnchorY=this._sc_gestureAnchorTotalY=a.y;this._sc_gestureAnchorD=this._sc_gestureAnchorTotalD=a.d;this._sc_gestureAnchorScale=this.get("scale");this._sc_gestureAnchorHOffset=this.get("horizontalScrollOffset");this._sc_gestureAnchorVOffset=this.get("verticalScrollOffset");d=true}return d}});SC.ScrollView.mixin({_SC_CONTAINER_LAYOUT_MAP:null,_SC_CONTENT_ADJUST_MAP:null});sc_require("views/scroll_view");SC.MenuScrollView=SC.ScrollView.extend({bottomScrollerView:SC.MenuScrollerView,canScrollVertical:function(){return !!(this.get("hasVerticalScroller")&&this.get("bottomScrollerView")&&this.get("topScrollerView")&&this.get("isVerticalScrollerVisible"))}.property("isVerticalScrollerVisible").cacheable(),classNames:["sc-menu-scroll-view"],controlSize:SC.REGULAR_CONTROL_SIZE,hasHorizontalScroller:false,topScrollerView:SC.MenuScrollerView,_sc_contentViewFrameDidChange:function(){arguments.callee.base.apply(this,arguments);this._sc_repositionScrollers()},_sc_repositionContentViewUnfiltered:function(){var e=this.get("hasVerticalScroller"),f=this.get("maximumVerticalScrollOffset");if(e){var a=this.get("bottomScrollerView"),b=this.get("topScrollerView");b.set("maximum",f);a.set("maximum",f);var d=this._sc_containerHeight,c=this._sc_contentHeight;if(this.get("autohidesVerticalScroller")){this.setIfChanged("isVerticalScrollerVisible",c>d)}}arguments.callee.base.apply(this,arguments)},_sc_repositionScrollersUnfiltered:function(){var g=this.get("hasVerticalScroller"),e=this.get("containerView");if(g&&this.get("autohidesVerticalScroller")){var c=this.get("bottomScrollerView"),a=c.get("scrollerThickness"),i=this.get("maximumVerticalScrollOffset"),d=this.get("topScrollerView"),b=d.get("scrollerThickness"),j=this.get("verticalScrollOffset"),h=c.get("isVisible"),f=d.get("isVisible");if(f){if(j<=b){d.set("isVisible",false);e.adjust("top",0);this.decrementProperty("verticalScrollOffset",b)}}else{if(j>0){d.set("isVisible",true);e.adjust("top",b);this.incrementProperty("verticalScrollOffset",b)}}if(h){if(j>=i-a){c.set("isVisible",false);e.adjust("bottom",0);this.incrementProperty("verticalScrollOffset",a)}}else{if(j<i){c.set("isVisible",true);e.adjust("bottom",a);this.decrementProperty("verticalScrollOffset",a)}}}},createChildViews:function(){var e=[],h=this.get("autohidesVerticalScroller");var d=this.get("containerView");d=this.containerView=this.createChildView(d,{contentView:this.contentView});this.contentView=d.get("contentView");e.push(d);if(!this.get("hasVerticalScroller")){this.topScrollerView=null;this.bottomScrollerView=null}else{var f=this.get("controlSize"),c=this.get("topScrollerView");if(c==null){c=SC.MenuScrollerView}c=this.topScrollerView=this.createChildView(c,{controlSize:f,scrollDown:false,isVisible:!h,layout:{height:0},value:this.get("verticalScrollOffset"),valueBinding:".parentView.verticalScrollOffset",minimum:this.get("minimumVerticalScrollOffset"),maximum:this.get("maximumVerticalScrollOffset")});var b=c.get("scrollerThickness");c.adjust("height",b);e.push(c);var a=this.get("bottomScrollerView");if(a==null){a=SC.MenuScrollerView}a=this.bottomScrollerView=this.createChildView(a,{controlSize:f,scrollDown:true,isVisible:!h,layout:{bottom:0,height:0},value:this.get("verticalScrollOffset"),valueBinding:".parentView.verticalScrollOffset",minimum:this.get("minimumVerticalScrollOffset"),maximum:this.get("maximumVerticalScrollOffset")});var g=a.get("scrollerThickness");a.adjust("height",g);e.push(a);if(!h){d.adjust("top",b);d.adjust("bottom",g)}}this.childViews=e}});sc_require("views/scroller");SC.MenuScrollerView=SC.ScrollerView.extend({classNames:["sc-menu-scroller-view"],scrollDown:false,verticalLineScroll:20,init:function(){switch(this.get("controlSize")){case SC.TINY_CONTROL_SIZE:this.set("scrollerThickness",SC.MenuScrollerView.TINY_SCROLLER_THICKNESS);break;case SC.SMALL_CONTROL_SIZE:this.set("scrollerThickness",SC.MenuScrollerView.SMALL_SCROLLER_THICKNESS);break;case SC.REGULAR_CONTROL_SIZE:this.set("scrollerThickness",SC.MenuScrollerView.REGULAR_SCROLLER_THICKNESS);break;case SC.LARGE_CONTROL_SIZE:this.set("scrollerThickness",SC.MenuScrollerView.LARGE_SCROLLER_THICKNESS);break;case SC.HUGE_CONTROL_SIZE:this.set("scrollerThickness",SC.MenuScrollerView.HUGE_SCROLLER_THICKNESS);break}return arguments.callee.base.apply(this,arguments)},render:function(a,c){a.addClass("sc-vertical");a.addClass(this.get("controlSize"));if(c){var b=this.get("scrollDown")?"arrowDown":"arrowUp";a.push('<span class="scrollArrow '+b+'">&nbsp;</span>')}},mouseEntered:function(a){this.set("isMouseOver",YES);this._invokeScrollOnMouseOver()},mouseExited:function(a){this.set("isMouseOver",NO)},_scrollMenu:function(){var a=this.get("value");if(this.get("scrollDown")){a=a+this.verticalLineScroll;a=Math.min(a,this.get("maximum"))}else{a=a-this.verticalLineScroll;a=Math.max(a,this.get("minimum"))}this.set("value",a);return YES},_invokeScrollOnMouseOver:function(){this._scrollMenu();if(this.get("isMouseOver")){this.invokeLater(this._invokeScrollOnMouseOver,50)}}});SC.MenuScrollerView.REGULAR_SCROLLER_THICKNESS=18;SC.MenuScrollerView.TINY_SCROLLER_THICKNESS=10;SC.MenuScrollerView.SMALL_SCROLLER_THICKNESS=14;SC.MenuScrollerView.LARGE_SCROLLER_THICKNESS=23;SC.MenuScrollerView.HUGE_SCROLLER_THICKNESS=26;sc_require("views/workspace");SC.TO_LEFT="TOLEFT";SC.TO_RIGHT="TORIGHT";SC.NavigationView=SC.WorkspaceView.extend({_views:null,_current:null,navigationContentView:SC.View,init:function(){arguments.callee.base.apply(this,arguments);this._views=[]},createChildViews:function(){arguments.callee.base.apply(this,arguments);var a=this.get("navigationContentView");if(a.isClass){a=this.createChildView(a)}this._defaultContent=this.navigationContentView=a;this.contentView.appendChild(a)},changeNavigationContent:function(a){var c=null,b=null;if(a){c=a.get("topToolbar");b=a.get("bottomToolbar")}if(c&&c.isClass){a.set("topToolbar",c=c.create())}if(b&&b.isClass){a.set("bottomToolbar",b=b.create())}this.beginPropertyChanges();this._current=a;this.set("navigationContentView",a?a:this._defaultContent);this.set("topToolbar",c);this.set("bottomToolbar",b);this.endPropertyChanges()},push:function(a){this._currentDirection=this._current?SC.TO_LEFT:null;if(this._current){this._views.push(this._current)}this.changeNavigationContent(a)},pop:function(){this._currentDirection=SC.TO_RIGHT;var a=this._views.pop();this.changeNavigationContent(a)},popToView:function(b){this._currentDirection=SC.TO_RIGHT;var d=this._views,a=d.length-1,c=d[a];while(c&&c!==b){this._views.pop();a--;c=d[a]}this.changeNavigationContent(c)},topToolbarDidChange:function(){var b=this.activeTopToolbar,a=this.get("topToolbar");if(b){if(this._currentDirection!==null){b.set("buildDirection",this._currentDirection);this.buildOutChild(b)}else{this.removeChild(b)}}if(a){if(this._currentDirection!==null){a.set("buildDirection",this._currentDirection);this.buildInChild(a)}else{this.appendChild(a)}}this.activeTopToolbar=a;this.invokeOnce("childDidChange")}.observes("topToolbar"),bottomToolbarDidChange:function(){var b=this.activeBottomToolbar,a=this.get("bottomToolbar");if(b){if(this._currentDirection!==null){b.set("buildDirection",this._currentDirection);this.buildOutChild(b)}else{this.removeChild(b)}}if(a){if(this._currentDirection!==null){a.set("buildDirection",this._currentDirection);this.buildInChild(a)}else{this.appendChild(a)}}this.activeBottomToolbar=a;this.invokeOnce("childDidChange")}.observes("topToolbar"),contentViewDidChange:function(){var b=this.activeNavigationContentView,a=this.get("navigationContentView");if(!a.isNavigationBuilder){a.mixin(SC.NavigationBuilder)}this._pendingBuildOut=b;this._pendingBuildIn=a;this.activeNavigationContentView=a;this.invokeOnce("childDidChange")}.observes("navigationContentView"),childDidChange:function(){var a=this._pendingBuildIn,b=this._pendingBuildOut;if(b){if(this._currentDirection!==null){b.set("buildDirection",this._currentDirection);this.contentView.buildOutChild(b)}else{this.contentView.removeChild(b)}}this._scws_tile();if(a){if(this._currentDirection!==null){a.set("buildDirection",this._currentDirection);this.contentView.buildInChild(a)}else{this.contentView.appendChild(a)}}}});sc_require("views/toolbar");SC.NavigationBarView=SC.ToolbarView.extend(SC.Gesturable,{init:function(){arguments.callee.base.apply(this,arguments);if(!SC.Animatable){SC.Logger.error("NavigationBarView requires SC.Animatable. Please make your app or framework require the animation framework. CRASH.")}},mixinAnimatable:function(){this.mixin(SC.Animatable);this.transitions=this.navigationTransitions},navigationTransitions:{opacity:{duration:0.25,action:"didFinishTransition"}},style:{opacity:1},gestures:["swipeGesture"],swipeGesture:SC.SwipeGesture,swipe:function(d,h,f){var e=(f===SC.SWIPE_LEFT)?"isSwipeLeft":"isSwipeRight",c=this.get("childViews"),g,b,a=c.get("length");for(b=0;b<a;b++){g=c[b];if(g.get(e)){h.makeTouchResponder(g);h.end();return}}},resetBuild:function(){if(!this.isAnimatable){this.mixinAnimatable()}},didFinishTransition:function(){if(this.isBuildingIn){this.buildInDidFinish()}else{if(this.isBuildingOut){this.buildOutDidFinish()}}},preBuildIn:function(){this.disableAnimation();this.adjust("opacity",0).updateLayout();this.enableAnimation();var c=this.get("childViews"),d,b,a=c.get("length");for(b=0;b<a;b++){d=c[b];if(d.disableNavigationTransition){continue}if(!d._nv_mixedIn){this.mixinNavigationChild(d)}d.disableAnimation();d.transform(this.buildDirection===SC.TO_LEFT?100:-100);d.enableAnimation()}},buildIn:function(){this.preBuildIn();this.invokeLater("startBuildIn",10)},startBuildIn:function(){this.adjust("opacity",1);var c=this.get("childViews"),d,b,a=c.get("length");for(b=0;b<a;b++){d=c[b];if(d.disableNavigationTransition){continue}d.transform(0)}},buildOut:function(){this.adjust("opacity",0);var c=this.get("childViews"),d,b,a=c.get("length");for(b=0;b<a;b++){d=c[b];if(d.disableNavigationTransition){continue}if(!d._nv_mixedIn){this.mixinNavigationChild(d)}d.transform(this.buildDirection===SC.TO_LEFT?-100:100)}},mixinNavigationChild:function(a){if(a.isAnimatable){return}a.mixin(SC.Animatable);a.mixin({transitions:{transform:{timing:SC.Animatable.TRANSITION_EASE_IN_OUT,duration:0.25}},naturalLayout:a.get("layout"),transform:function(b){if(SC.platform.supportsCSS3DTransforms){this.adjust("transform","translate3d("+b+"px,0px,0px)")}else{this.adjust("transform","translate("+b+"px,0px)")}}});a._nv_mixedIn=YES}});sc_require("views/button");SC.PopupButtonView=SC.ButtonView.extend({classNames:["sc-popup-button"],renderDelegateName:"popupButtonRenderDelegate",preferMatrix:null,menu:null,shouldLoadInBackground:NO,init:function(){arguments.callee.base.apply(this,arguments);this._setupMenu();if(this.get("shouldLoadInBackground")){SC.backgroundTaskQueue.push(SC.PopupButtonMenuLoader.create({popupButton:this}))}},_setupMenu:function(){var a=this.get("instantiatedMenu");if(this.isActiveBinding){this.isActiveBinding.disconnect()}this.isActiveBinding=null;if(a&&!a.isClass){this.isActiveBinding=this.bind("isActive",a,"isVisibleInWindow")}},_popup_menuDidChange:function(){this._setupMenu()}.observes("menu"),isActive:NO,_instantiateMenu:function(){var a=this.get("menu");if(!a||!a.isClass){return}this.menu=a.create();this._setupMenu()},instantiatedMenu:function(){var a=this.get("menu");if(a&&a.isClass){this._instantiateMenu();a=this.get("menu")}return a}.property("menu").cacheable(),action:function(a){var b=this.get("instantiatedMenu");if(!b){return NO}b.popup(this,this.get("preferMatrix"));return YES},mouseDown:function(a){if(a.which&&a.which!==1){return false}if(!this.get("isEnabledInPane")){return YES}this._isMouseDown=YES;this._action();this._menuRenderedTimestamp=0;var b=this;setTimeout(function(){SC.run(function(){b._menuRenderedTimestamp=Date.now()})},1);this.becomeFirstResponder();return YES},mouseUp:function(b){var d=new Date().getTime(),c=this._menuRenderedTimestamp,e=this.get("instantiatedMenu"),f=SC.platform.touch,a;if(c===0){c=Date.now()}if(e){a=e.getPath("rootMenu.targetMenuItem");if(a){if(!a.performAction()){e.remove()}}else{if(!f&&(d-c>SC.ButtonView.CLICK_AND_HOLD_DELAY)){e.remove()}}}this._isMouseDown=NO;arguments.callee.base.apply(this,arguments);return YES},mouseExited:function(a){return YES},performKeyEquivalent:function(b,a){if(!this.get("isEnabledInPane")){return NO}var c=this.get("instantiatedMenu");return(!!c&&c.performKeyEquivalent(b,a,YES))},touchStart:function(a){return this.mouseDown(a)},touchEnd:function(a){return this.mouseUp(a)}});SC.PopupButtonMenuLoader=SC.Task.extend({popupButton:null,run:function(){if(this.popupButton){this.popupButton._instantiateMenu()}}});SC.ProgressView=SC.View.extend(SC.Control,{classNames:["sc-progress-view"],displayProperties:["displayValue","ariaValue","minimum","maximum","isIndeterminate","isRunning","isVisibleInWindow"],renderDelegateName:"progressRenderDelegate",value:0.5,valueBindingDefault:SC.Binding.single().notEmpty(),displayValue:function(){var b=this.get("minimum")||0,c=this.get("maximum")||1,a=this.get("value")||0;a=(a-b)/(c-b);if(isNaN(a)){a=0}if(a<0){a=0}if(a>1){a=1}return a}.property("value","maximum","minimum").cacheable(),ariaRole:"progressbar",ariaValue:function(){return this.get("value")}.property("value").cacheable(),minimum:0,minimumBindingDefault:SC.Binding.single().notEmpty(),contentMinimumKey:null,maximum:1,maximumBindingDefault:SC.Binding.single().notEmpty(),contentMaximumKey:null,isIndeterminate:NO,isIndeterminateBindingDefault:SC.Binding.bool(),isRunning:NO,isRunningBindingDefault:SC.Binding.bool(),contentIsIndeterminateKey:null,contentPropertyDidChange:function(c,a){var b=this.get("content");this.beginPropertyChanges().updatePropertyFromContent("value",a,"contentValueKey",b).updatePropertyFromContent("minimum",a,"contentMinimumKey",b).updatePropertyFromContent("maximum",a,"contentMaximumKey",b).updatePropertyFromContent("isIndeterminate",a,"contentIsIndeterminateKey",b).endPropertyChanges()},didCreateLayer:function(){if(this.get("isIndeterminate")&&this.get("isRunning")&&this.get("isVisibleInWindow")){this.displayDidChange()}}});SC.RadioView=SC.View.extend(SC.Control,{acceptsFirstResponder:function(){if(SC.FOCUS_ALL_CONTROLS){return this.get("isEnabledInPane")}return NO}.property("isEnabledInPane"),classNames:["sc-radio-view"],ariaRole:"radiogroup",displayProperties:["displayItems","layoutDirection"],renderDelegateName:"radioGroupRenderDelegate",itemAriaLabeledByKey:null,itemAriaLabelKey:null,value:null,layoutDirection:SC.LAYOUT_VERTICAL,escapeHTML:YES,items:[],itemTitleKey:null,itemWidthKey:null,itemValueKey:null,itemIsEnabledKey:null,itemIconKey:null,itemsDidChange:function(){if(this._items){this._items.removeObserver("[]",this,this.itemContentDidChange)}this._items=this.get("items");if(this._items){this._items.addObserver("[]",this,this.itemContentDidChange)}this.itemContentDidChange()}.observes("items"),itemContentDidChange:function(){this._renderAsFirstTime=YES;this.notifyPropertyChange("displayItems")},displayItems:function(){var k=this.get("items"),p=this.get("value"),h=SC.isArray(p),f=this.get("localize"),d=this.get("itemTitleKey"),e=this.get("itemValueKey"),o=this.get("itemWidthKey"),c=this.get("layoutDirection")===SC.LAYOUT_HORIZONTAL,j=this.get("itemIsEnabledKey"),w=this.get("itemIconKey"),g=this.get("itemAriaLabeledByKey"),y=this.get("itemAriaLabelKey"),v=this._displayItems||[],q=(k)?k.get("length"):0,t,x,l,m,i,u,s,n,b,a,r;for(i=0;i<q;i++){t=k.objectAt(i);if(SC.typeOf(t)===SC.T_ARRAY){x=t[0];m=t[1]}else{if(t){if(d){x=t.get?t.get(d):t[d]}else{x=(t.toString)?t.toString():null}if(o&&c){l=t.get?t.get(o):t[o]}if(e){m=t.get?t.get(e):t[e]}else{m=t}if(j){u=t.get?t.get(j):t[j]}else{u=YES}if(w){s=t.get?t.get(w):t[w]}else{s=null}if(g){a=t.get?t.get(g):t[g]}else{a=null}if(y){r=t.get?t.get(y):t[y]}else{r=null}}else{x=m=s=null;u=NO}}u=u&&this.get("isEnabled");if(t){n=(h)?(p.indexOf(m)>=0):(p===m)}else{n=NO}if(f){x=SC.String.loc(x)}v.push(SC.Object.create({title:x,icon:s,width:l,value:m,isEnabled:u,isSelected:(h&&p.indexOf(m)>=0&&p.length===1)||(p===m),isMixed:(h&&p.indexOf(m)>=0),isActive:this._activeRadioButton===i,theme:this.get("theme"),renderState:{}}))}return v}.property("isEnabled","value","items","itemTitleKey","itemWidthKey","itemValueKey","itemIsEnabledKey","localize","itemIconKey","itemAriaLabeledByKey","itemAriaLabelKey").cacheable(),mouseDown:function(a){if(a.which&&a.which!==1){return false}if(!this.get("isEnabledInPane")){return YES}var d=this.get("renderDelegate"),c=this.get("renderDelegateProxy"),f=this.$(),b=d.indexForEvent(c,f,a);this._activeRadioButton=b;if(b!==undefined){var e=this.get("displayItems")[b];if(e.get("isEnabled")){e.set("isActive",YES);d.updateRadioAtIndex(c,f,b)}}a.allowDefault();return YES},mouseUp:function(a){if(!this.get("isEnabledInPane")){return YES}var d=this.get("renderDelegate"),c=this.get("renderDelegateProxy"),f=this.$(),g=this.get("displayItems"),b=d.indexForEvent(c,f,a);if(this._activeRadioButton!==undefined&&b!==this._activeRadioButton){g[this._activeRadioButton].set("isActive",NO);d.updateRadioAtIndex(c,f,this._activeRadioButton)}this._activeRadioButton=undefined;if(b!==undefined){var e=this.get("displayItems")[b];if(e.get("isEnabled")){e.set("isActive",NO);d.updateRadioAtIndex(c,f,b);this.set("value",e.value)}}a.allowDefault();return YES},keyDown:function(j){if(!this.get("isEnabledInPane")){return YES}if(j.which===9||j.keyCode===9){var h=j.shiftKey?this.get("previousValidKeyView"):this.get("nextValidKeyView");if(h){h.becomeFirstResponder()}else{j.allowDefault()}return YES}if(j.which>=37&&j.which<=40){var g=this.get("renderDelegate"),f=this.get("renderDelegateProxy"),c=this.$(),e=this.get("displayItems"),b=this.get("value");for(var d=0,a=e.length;d<a;d++){if(b===e[d].value){break}}if(j.which===37||j.which===38){if(d<=0){d=e.length-1}else{d--}}if(j.which===39||j.which===40){if(d>=e.length-1){d=0}else{d++}}g.updateRadioAtIndex(f,c,d);this.set("value",e[d].value)}j.allowDefault();return NO},touchStart:function(a){return this.mouseDown(a)},touchEnd:function(a){return this.mouseUp(a)}});SC.SceneView=SC.ContainerView.extend({scenes:null,transitionBackward:SC.ContainerView.PUSH,transitionBackwardOptions:{duration:0.25,direction:"right"},transitionForward:SC.ContainerView.PUSH,transitionForwardOptions:{duration:0.25,direction:"left"},replaceContent:function(b){var a=this.get("scenes"),c=this.get("nowShowing"),e=a?a.indexOf(this._lastNowShowingView):-1,d=a?a.indexOf(c):-1;this._lastNowShowingView=c;if(e<d){this.transitionSwap=this.transitionForward;this.transitionSwapOptions=this.transitionForwardOptions}else{this.transitionSwap=this.transitionBackward;this.transitionSwapOptions=this.transitionBackwardOptions}arguments.callee.base.apply(this,arguments)}});SC.SegmentView=SC.View.extend(SC.Control,{ariaRole:"button",isSegment:YES,classNames:["sc-segment-view"],toolTip:null,isActive:NO,isSelected:NO,layoutDirection:SC.LAYOUT_HORIZONTAL,controlSize:null,supportFocusRing:NO,displayProperties:["icon","displayTitle","value","displayToolTip","isDefault","isCancel","width","isSegment","isFirstSegment","isMiddleSegment","isLastSegment","isOverflowSegment","index","layoutDirection"],renderDelegateName:"segmentRenderDelegate",useStaticLayout:YES,title:"",value:null,icon:null,localize:NO,keyEquivalent:null,escapeHTML:YES,needsEllipsis:YES,displayTitle:function(){var a=this.get("title");if(this.get("localize")){a=SC.String.loc(a)}return a}.property("title","localize").cacheable(),width:null,localItem:null,widthDidChange:function(){this.adjust("width",this.get("width"))}.observes("width"),updateItem:function(d,c){var g=d.get("itemKeys"),f,a=d.get("viewKeys"),e,b;for(b=g.get("length")-1;b>=0;b--){f=d.get(g.objectAt(b));e=a.objectAt(b);if(!SC.none(c.get(f))){this.set(e,c.get(f))}}this.set("localItem",c)}});sc_require("views/segment");SC.SegmentedView=SC.View.extend(SC.Control,{acceptsFirstResponder:function(){if(SC.FOCUS_ALL_CONTROLS){return this.get("isEnabledInPane")}return NO}.property("isEnabledInPane").cacheable(),ariaRole:"group",classNames:["sc-segmented-view"],theme:"square",value:null,allowsEmptySelection:NO,allowsMultipleSelection:NO,selectSegmentWhenTriggeringAction:NO,localize:YES,align:SC.ALIGN_CENTER,layoutDirection:SC.LAYOUT_HORIZONTAL,items:null,itemTitleKey:null,itemValueKey:null,itemIsEnabledKey:null,itemIconKey:null,itemWidthKey:null,itemActionKey:null,itemTargetKey:null,itemLayerIdKey:null,itemKeyEquivalentKey:null,shouldHandleOverflow:YES,overflowTitle:"&raquo;",overflowToolTip:"More…",overflowIcon:null,segmentViewClass:SC.SegmentView,shouldAutoResize:NO,itemKeys:["itemTitleKey","itemValueKey","itemIsEnabledKey","itemIconKey","itemWidthKey","itemToolTipKey","itemKeyEquivalentKey","itemLayerIdKey"],viewKeys:["title","value","isEnabled","icon","width","toolTip","keyEquivalent","layerId"],init:function(){arguments.callee.base.apply(this,arguments);this.shouldHandleOverflowDidChange();this.itemsDidChange()},shouldHandleOverflowDidChange:function(){var c=this.get("overflowView");if(this.get("shouldHandleOverflow")){var d=this.get("overflowTitle"),a=this.get("overflowToolTip"),b=this.get("overflowIcon");c=this.get("segmentViewClass").create({controlSize:this.get("controlSize"),escapeHTML:false,localize:this.get("localize"),title:d,toolTip:a,icon:b,isLastSegment:YES,isOverflowSegment:YES,layoutDirection:this.get("layoutDirection")});this.appendChild(c);this.set("overflowView",c);this.invokeLast(this.remeasure)}else{if(c){this.removeChildAndDestroy(c);this.set("overflowView",null)}}}.observes("shouldHandleOverflow"),itemsDidChange:function(){var m=this.get("items")||[],c,g,n=this.get("childViews"),h,d=this.get("overflowView"),o=this.get("value"),b,p=this.get("itemKeys"),a,l=this.get("segmentViewClass"),f,e;var k=this.get("shouldHandleOverflow")?n.get("length")-1:n.get("length");if(k>m.get("length")){for(f=k-1;f>=m.get("length");f--){h=n.objectAt(f);c=h.get("localItem");if(c instanceof SC.Object){for(e=p.get("length")-1;e>=0;e--){a=this.get(p.objectAt(e));if(a){c.removeObserver(a,this,this.itemContentDidChange)}}}if(SC.isArray(o)){o.removeObject(c)}else{if(o===c){o=null}}this.removeChildAndDestroy(h)}this.set("value",o)}else{if(k<m.get("length")){for(f=k;f<m.get("length");f++){h=l.create({controlSize:this.get("controlSize"),localize:this.get("localize"),layoutDirection:this.get("layoutDirection")});this.insertBefore(h,d)}}}n=this.get("childViews");for(f=0;f<m.get("length");f++){c=m.objectAt(f);h=n.objectAt(f);g=h.get("localItem");if(g instanceof SC.Object&&!m.contains(g)){for(e=p.get("length")-1;e>=0;e--){a=this.get(p.objectAt(e));if(a){g.removeObserver(a,this,this.itemContentDidChange)}}}if(SC.none(c)){continue}if(SC.typeOf(c)===SC.T_STRING){c=SC.Object.create({title:c.humanize().titleize(),value:c});this.set("itemTitleKey","title");this.set("itemValueKey","value")}else{if(SC.typeOf(c)===SC.T_HASH){c=SC.Object.create(c)}else{if(c instanceof SC.Object){for(e=p.get("length")-1;e>=0;e--){a=this.get(p.objectAt(e));if(a){c.removeObserver(a,this,this.itemContentDidChange);c.addObserver(a,this,this.itemContentDidChange,f)}}}else{SC.Logger.error("SC.SegmentedView items may be Strings, Objects (ie. Hashes) or SC.Objects only")}}}b=NO;if(SC.isArray(o)?o.indexOf(c.get(this.get("itemValueKey")))>=0:o===c.get(this.get("itemValueKey"))){b=YES}h.set("isSelected",b);h.set("index",f);h.set("isFirstSegment",f===0);h.set("isMiddleSegment",f<m.get("length")-1&&f>0);h.set("isLastSegment",f===m.get("length")-1);h.updateItem(this,c)}if(this.get("shouldHandleOverflow")){this.invokeLast(this.remeasure)}}.observes("*items.[]"),itemContentDidChange:function(d,c,a,b){var e=this.get("childViews"),f;f=e.objectAt(b);if(f){f.updateItem(this,d);if(this.get("shouldHandleOverflow")){this.invokeLast(this.remeasure)}}},viewDidResize:function(){this._sc_viewFrameDidChange();var b=this.get("layoutDirection")===SC.LAYOUT_HORIZONTAL,a=b?this.$().width():this.$().height();if(this.get("shouldHandleOverflow")&&(this.get("isOverflowing")||a<=this.cachedMinimumDim)){this.invokeLast(this.remeasure)}},isVisibleInWindowDidChange:function(){if(this.get("shouldHandleOverflow")){this.invokeLast(this.remeasure)}}.observes("isVisibleInWindow"),remeasure:function(){if(!this.get("shouldHandleOverflow")){return}var c=this.get("childViews"),b;if(this.get("isVisibleInWindow")){b=this.get("overflowView");b.set("isVisible",YES);for(var a=c.get("length")-1;a>=0;a--){c.objectAt(a).set("isVisible",YES)}this.cachedDims=this.segmentDimensions();this.cachedOverflowDim=this.overflowSegmentDim();this.adjustOverflow()}},adjustOverflow:function(){if(!this.get("shouldHandleOverflow")){return}var j=this.get("childViews"),f,m=this.get("value"),c=this.get("overflowView"),k=this.get("layoutDirection")===SC.LAYOUT_HORIZONTAL,p=k?this.$().width():this.$().height(),e=0,o,b,d,a=NO,n=this.get("shouldAutoResize"),g=k?"width":"height",l=!SC.none(this.getPath("layout.%@".fmt(g))),h=n&&l;if(j.get("length")!==this.cachedDims.length+1){return}a=NO;c.set("isSelected",NO);this.overflowItems=[];b=this.cachedDims.length;for(d=0;d<b;d++){f=j.objectAt(d);e+=this.cachedDims[d];if(!a&&!h){o=(d===b-1)?e:e+this.cachedOverflowDim;if(o>p){a=YES}}if(a){this.overflowItems.pushObject(f.get("localItem"));f.set("isVisible",NO);if(d===0){c.set("isFirstSegment",YES)}if(SC.isArray(m)?m.indexOf(f.get("value"))>=0:m===f.get("value")){c.set("isSelected",YES)}}else{f.set("isVisible",YES);if(d===0){c.set("isFirstSegment",NO)}}}c.set("isVisible",a);this.setIfChanged("isOverflowing",a);if(h){this.adjust(g,this.isOverflowing?this.cachedMinimumDim:e)}this.cachedMinimumDim=e+this.cachedOverflowDim},segmentDimensions:function(){var b=this.get("childViews"),a,e,h=[],g=this.get("layoutDirection")===SC.LAYOUT_HORIZONTAL;for(var c=0,d=b.length;c<d-1;c++){a=b[c];e=a.get("frame");h[c]=g?e.width:e.height}return h},overflowSegmentDim:function(){var b=this.get("childViews"),a,c,d=this.get("layoutDirection")===SC.LAYOUT_HORIZONTAL;a=b.length&&b[b.length-1];if(a){c=a.get("frame");return d?c.width:c.height}return 0},indexForClientPosition:function(b,h){var d=this.get("childViews"),g,e,c,f,a;a={x:b,y:h};for(e=0,g=d.length;e<g;e++){c=d[e];f=c.get("layer").getBoundingClientRect();f={x:f.left,y:f.top,width:(f.right-f.left),height:(f.bottom-f.top)};if(SC.pointInRect(a,f)){return e}}return -1},displayProperties:["align"],renderDelegateName:"segmentedRenderDelegate",displayItemIndexForEvent:function(b){var e=b.target,a=b.clientX,g=b.clientY,d=-1;if(e&&e!==this.get("layer")){if(a===0&&g===0){var f=SC.offset(e);a=f.x+Math.round(e.offsetWidth/2);g=f.y+Math.round(e.offsetHeight/2)}var c=this.get("renderDelegate");if(c&&c.indexForClientPosition){d=c.indexForClientPosition(this,a,g)}else{d=this.indexForClientPosition(a,g)}}return d},keyDown:function(c){var g,h,d,e,f,b;if(c.which===9||c.keyCode===9){var a=c.shiftKey?this.get("previousValidKeyView"):this.get("nextValidKeyView");if(a){a.becomeFirstResponder()}else{c.allowDefault()}return YES}if(!this.get("allowsMultipleSelection")){g=this.get("childViews");e=g.get("length");f=this.get("value");b=SC.isArray(f);if(c.which===39||c.which===40){if(f){for(d=0;d<e-2;d++){h=g.objectAt(d);if(b?(f.indexOf(h.get("value"))>=0):(h.get("value")===f)){this.triggerItemAtIndex(d+1)}}}else{this.triggerItemAtIndex(0)}return YES}else{if(c.which===37||c.which===38){if(f){for(d=1;d<e-1;d++){h=g.objectAt(d);if(b?(f.indexOf(h.get("value"))>=0):(h.get("value")===f)){this.triggerItemAtIndex(d-1)}}}else{this.triggerItemAtIndex(e-2)}return YES}}}return NO},mouseDown:function(a){if(a.which!==1){return false}var c=this.get("childViews"),e,b;if(!this.get("isEnabledInPane")){return YES}b=this.displayItemIndexForEvent(a);if(b>=0){e=c.objectAt(b);if(e.get("isEnabled")){e.set("isActive",YES)}this.activeChildView=e;var d=this.get("shouldHandleOverflow")?c.get("length")-1:null;if(b===d){this.showOverflowMenu()}else{this._isMouseDown=YES}return YES}else{return NO}},mouseUp:function(a){var c,b;b=this.displayItemIndexForEvent(a);if(this._isMouseDown&&(b>=0)){this.triggerItemAtIndex(b);c=this.activeChildView;if(c){c.set("isActive",NO);this.activeChildView=null}}this._isMouseDown=NO;return YES},mouseMoved:function(a){var d=this.get("childViews"),c,f,b;if(this._isMouseDown){b=this.displayItemIndexForEvent(a);c=this.activeChildView;f=d.objectAt(b);if(f&&f!==c){if(c){c.set("isActive",NO)}if(f.get("isEnabled")){f.set("isActive",YES)}this.activeChildView=f;var e=this.get("shouldHandleOverflow")?d.get("length")-1:null;if(b===e){this.showOverflowMenu();this._isMouseDown=NO}}}return YES},mouseEntered:function(a){var c=this.get("childViews"),e,b;if(this._isMouseDown){b=this.displayItemIndexForEvent(a);var d=this.get("shouldHandleOverflow")?c.get("length")-1:null;if(b===d){this.showOverflowMenu();this._isMouseDown=NO}else{if(b>=0){e=c.objectAt(b);if(e.get("isEnabled")){e.set("isActive",YES)}this.activeChildView=e}}}return YES},mouseExited:function(a){var b;if(this._isMouseDown){b=this.activeChildView;if(b){b.set("isActive",NO)}this.activeChildView=null}return YES},touchStart:function(e){var b=this.get("childViews"),d,a;if(!this.get("isEnabledInPane")){return YES}a=this.displayItemIndexForEvent(e);if(a>=0){d=b.objectAt(a);d.set("isActive",YES);this.activeChildView=d;var c=this.get("shouldHandleOverflow")?b.get("length")-1:null;if(a===c){this.showOverflowMenu()}else{this._isTouching=YES}}return YES},touchEnd:function(c){var b,a;a=this.displayItemIndexForEvent(c);if(this._isTouching&&(a>=0)){this.triggerItemAtIndex(a);b=this.activeChildView;b.set("isActive",NO);this.activeChildView=null;this._isTouching=NO}return YES},touchesDragged:function(a,e){var h=this.touchIsInBoundary(a),d=this.get("childViews"),c,g,b;if(h){if(!this._isTouching){this._touchDidEnter(a)}b=this.displayItemIndexForEvent(a);c=this.activeChildView;g=d[b];if(g&&g!==c){if(c){c.set("isActive",NO)}g.set("isActive",YES);this.activeChildView=g;var f=this.get("shouldHandleOverflow")?d.get("length")-1:null;if(b===f){this.showOverflowMenu();this._isMouseDown=NO}}}else{if(this._isTouching){this._touchDidExit(a)}}this._isTouching=h;return YES},_touchDidExit:function(a){var b;if(this.isTouching){b=this.activeChildView;b.set("isActive",NO);this.activeChildView=null}return YES},_touchDidEnter:function(a){var c=this.get("childViews"),e,b;b=this.displayItemIndexForEvent(a);var d=this.get("shouldHandleOverflow")?c.get("length")-1:null;if(b===d){this.showOverflowMenu();this._isTouching=NO}else{if(b>=0){e=c.objectAt(b);e.set("isActive",YES);this.activeChildView=e}}return YES},triggerItemAtIndex:function(f){var j=this.get("childViews"),e,h,k,b,i;e=j.objectAt(f);if(!e.get("isEnabled")){return this}b=this.get("allowsEmptySelection");i=this.get("allowsMultipleSelection");h=e.get("value");k=this.get("value");if(!i){if(b&&k===h){k=null}else{k=h}}else{if(!k){k=[]}else{if(!SC.isArray(k)){k=[k]}}if(k.indexOf(h)>=0){if(k.get("length")>1||(k.objectAt(0)!==h)||b){k=k.without(h)}}else{k=k.concat(h)}}var m=this.get("itemActionKey"),a=this.get("itemTargetKey"),d,g=null,c=this.getPath("pane.rootResponder"),l;if(m&&(l=this.get("items").objectAt(f))){d=l.get?l.get(m):l[m];if(a){g=l.get?l.get(a):l[a]}if(c){c.sendAction(d,g,this,this.get("pane"),k)}}if(k!==undefined&&(!d||this.get("selectSegmentWhenTriggeringAction"))){this.set("value",k)}d=this.get("action");if(d&&c){c.sendAction(d,this.get("target"),this,this.get("pane"),k)}},selectOverflowItem:function(b){var a=b.get("selectedItem");this.triggerItemAtIndex(a.get("index"));b.removeObserver("selectedItem",this,"selectOverflowItem");this.activeChildView.set("isActive",NO);this.activeChildView=null},showOverflowMenu:function(){var p=this,f=this.get("childViews"),m=this.get("itemValueKey"),g=this.get("itemLayerIdKey"),o=this.overflowItems,l,k,e,j,n,b,d,h;l=o.get("length");k=f.get("length")-1-l;j=this.get("value");e=SC.isArray(j);for(var c=0;c<l;c++){n=o.objectAt(c);if(e?j.indexOf(n.get(m))>=0:j===n.get(m)){n.set("isChecked",YES)}else{n.set("isChecked",NO)}n.set("index",k+c);b=n.get(g);if(b){n.set("overflowLayerId",b+"-overflow-menu-item")}}var a=SC.MenuPane.create({layout:{width:200},items:o,itemTitleKey:this.get("itemTitleKey"),itemIconKey:this.get("itemIconKey"),itemIsEnabledKey:this.get("itemIsEnabledKey"),itemKeyEquivalentKey:this.get("itemKeyEquivalentKey"),itemCheckboxKey:"isChecked",itemLayerIdKey:"overflowLayerId",modalPaneDidClick:function(){arguments.callee.base.apply(this,arguments);this.removeObserver("selectedItem",p,"selectOverflowItem");p.activeChildView.set("isActive",NO);p.activeChildView=null}});d=this.get("layer");h=d.childNodes[d.childNodes.length-1];a.popup(h);a.addObserver("selectedItem",this,"selectOverflowItem")},valueDidChange:function(){var d=this.get("value"),c,f=this.get("childViews"),a=this.get("shouldHandleOverflow")?f.get("length")-1:f.get("length"),g=Infinity,e=this.get("overflowView"),h;if(this.overflowItems){c=this.overflowItems.get("length");g=a-c;e.set("isSelected",NO)}for(var b=a-1;b>=0;b--){h=f.objectAt(b);if(SC.isArray(d)?d.indexOf(h.get("value"))>=0:d===h.get("value")){h.set("isSelected",YES);if(b>=g){e.set("isSelected",YES)}}else{h.set("isSelected",NO)}}}.observes("value")});sc_require("views/button");SC.SelectView=SC.ButtonView.extend({acceptsFirstResponder:function(){return this.get("isEnabledInPane")}.property("isEnabledInPane"),escapeHTML:YES,escapeHTMLBindingDefault:SC.Binding.oneWay().bool(),items:[],itemsBindingDefault:SC.Binding.multiple(),itemTitleKey:null,itemSortKey:null,itemValueKey:null,itemIconKey:null,itemSeparatorKey:"isSeparator",itemIsEnabledKey:"isEnabled",localize:YES,disableSort:YES,classNames:["sc-select-view"],menu:null,_itemList:[],_itemIdx:null,value:null,checkboxEnabled:YES,showCheckbox:YES,emptyName:null,_defaultVal:null,_defaultTitle:null,_defaultIcon:null,theme:"popup",displayProperties:["icon","value","controlSize","escapeHTML","emptyName"],preferMatrix:null,CUSTOM_MENU_ITEM_HEIGHT:20,isActiveBinding:"*menu.isVisibleInWindow",isDefaultPosition:NO,lastMenuWidth:null,exampleView:null,customViewMenuOffsetWidth:0,needsEllipsis:YES,menuPaneHeightPadding:0,menuItemPadding:35,isContextMenuEnabled:NO,supportFocusRing:YES,init:function(){arguments.callee.base.apply(this,arguments);this.itemsDidChange()},leftAlign:function(){switch(this.get("controlSize")){case SC.TINY_CONTROL_SIZE:return SC.SelectView.TINY_OFFSET_X;case SC.SMALL_CONTROL_SIZE:return SC.SelectView.SMALL_OFFSET_X;case SC.REGULAR_CONTROL_SIZE:return SC.SelectView.REGULAR_OFFSET_X;case SC.LARGE_CONTROL_SIZE:return SC.SelectView.LARGE_OFFSET_X;case SC.HUGE_CONTROL_SIZE:return SC.SelectView.HUGE_OFFSET_X}return 0}.property("controlSize"),sortObjects:function(b){if(!this.get("disableSort")){var a=this.get("itemSortKey")||this.get("itemTitleKey");b=b.sort(function(d,c){if(a){d=d.get?d.get(a):d[a];c=c.get?c.get(a):c[a]}return(d<c)?-1:((d>c)?1:0)})}return b},itemsDidChange:function(){var m,i,o,q,u,e,d,t,f,l,a,k,c,h,v,p,n,r,j,g,s,b;i=this.get("items")||[];i=this.sortObjects(i);o=i.length;q=this.get("itemTitleKey");u=this.get("itemIconKey");e=this.get("itemValueKey");d=this.get("itemSeparatorKey");t=this.get("showCheckbox");g=this.get("itemIsEnabledKey");m=this.get("escapeHTML");f=this.get("value");l=this.get("localize");k=[];c=YES;h=0;s=this.get("emptyName");if(!SC.none(s)){s=l?SC.String.loc(s):s;s=m?SC.RenderContext.escapeHTML(s):s;r=SC.Object.create({isSeparator:NO,title:s,icon:null,value:null,isEnabled:YES,checkbox:NO,target:this,action:"displaySelectedItem"});if(SC.none(f)){this.set("title",s)}k.push(r)}i.forEach(function(w){if(w||w===0){a=d?(w.get?w.get(d):w[d]):NO;if(a){r=SC.Object.create({isSeparator:true,value:"_sc_separator_item"})}else{v=q?(w.get?w.get(q):w[q]):w.toString();v=l?SC.String.loc(v):v;v=m?SC.RenderContext.escapeHTML(v):v;p=u?(w.get?w.get(u):w[u]):null;if(SC.none(w[u])){p=null}n=e?(w.get?w.get(e):w[e]):w;if(!SC.none(f)&&!SC.none(n)){b=false;if(SC.kindOf(f,SC.Record)&&SC.kindOf(n,SC.Record)){b=f.get("storeKey")===n.get("storeKey")}if(f===n||b){this.set("title",v);this.set("icon",p)}}if(n===this.get("value")){this.set("_itemIdx",h);c=!t?NO:YES}else{c=NO}j=(w.get?w.get(g):w[g]);if(NO!==j){j=YES}if(SC.none(this._defaultVal)&&j){this._defaultVal=n;this._defaultTitle=v;this._defaultIcon=p}r=SC.Object.create({action:"displaySelectedItem",title:v,icon:p,value:n,isEnabled:j,checkbox:c,target:this})}k.push(r)}h+=1},this);this.set("_itemList",k);var n=this.get("value");if(SC.none(n)){if(SC.none(s)){this.set("value",this._defaultVal);this.set("title",this._defaultTitle);this.set("icon",this._defaultIcon)}else{this.set("title",s)}}this.changeSelectPreferMatrix()}.observes("*items.[]"),_action:function(k){var h,a,i,j,o,m,w,d,v,l,q,n,t,e,f,b,u,g,p;h=this.$(".sc-button-label")[0];var x=SC.SelectView.MENU_WIDTH_OFFSET;if(!this.get("isDefaultPosition")){switch(this.get("controlSize")){case SC.TINY_CONTROL_SIZE:x+=SC.SelectView.TINY_POPUP_MENU_WIDTH_OFFSET;break;case SC.SMALL_CONTROL_SIZE:x+=SC.SelectView.SMALL_POPUP_MENU_WIDTH_OFFSET;break;case SC.REGULAR_CONTROL_SIZE:x+=SC.SelectView.REGULAR_POPUP_MENU_WIDTH_OFFSET;break;case SC.LARGE_CONTROL_SIZE:x+=SC.SelectView.LARGE_POPUP_MENU_WIDTH_OFFSET;break;case SC.HUGE_CONTROL_SIZE:x+=SC.SelectView.HUGE_POPUP_MENU_WIDTH_OFFSET;break}}a=this.get("layer").offsetWidth+x;a=this.get("layer").offsetWidth;i=h.scrollWidth;j=this.get("lastMenuWidth");if(i){o=h.offsetWidth;if(i&&o){a=a+i-o}}if(!j||(a>j)){j=a}m=this.get("_itemList");var r=this.get("customViewClassName");var c="sc-view sc-pane sc-panel sc-palette sc-picker sc-menu select-button sc-scroll-view sc-menu-scroll-view sc-container-view menuContainer sc-button-view sc-menu-item sc-regular-size";c=r?(c+" "+r):c;SC.prepareStringMeasurement("",c);for(l=0,u=m.length;l<u;++l){v=m.objectAt(l);w=SC.measureString(v.title).width;if(!d||(w>d)){d=w}}SC.teardownStringMeasurement();j=(d+this.menuItemPadding>j)?d+this.menuItemPadding:j;var s=SC.RootResponder.responder.get("currentWindowSize").width;if(j>s){j=(s-25)}this.set("lastMenuWidth",j);q=this.get("value");n=this.get("_itemList");t=this.get("controlSize");e=this.get("menuPaneHeightPadding");p=this.get("escapeHTML");f=this.get("exampleView")||SC.MenuItemView.extend({escapeHTML:p});b=SC.MenuPane.create({classNames:["select-button"],items:n,exampleView:f,isEnabled:YES,menuHeightPadding:e,preferType:SC.PICKER_MENU,itemHeightKey:"height",layout:{width:j},controlSize:t,itemWidth:j});if(!b){return NO}b.popup(this,this.preferMatrix);this.set("menu",b);g=this._itemIdx;if(!SC.empty(g)&&g>-1){f=b.menuItemViewForContentIndex(g);if(f){f.becomeFirstResponder()}}this.set("isActive",YES);return YES},displaySelectedItem:function(a){var b=a.get("selectedItem");this.set("value",b.get("value"))},valueDidChange:function(){var b=this._itemList,c=this.get("showCheckbox"),f=this.get("value");for(var d=0,a=b.length;d<a;d++){var e=b[d],g=false;if(f===e.get("value")){g=c;this.set("title",e.get("title"));this.set("icon",e.get("icon"));this.set("_itemIdx",e.get("contentIndex"))}e.set("checkbox",g)}}.observes("value"),changeSelectPreferMatrix:function(){var c=0,g=0;switch(this.get("controlSize")){case SC.TINY_CONTROL_SIZE:c=SC.SelectView.TINY_OFFSET_Y;g=SC.MenuPane.TINY_MENU_ITEM_HEIGHT;break;case SC.SMALL_CONTROL_SIZE:c=SC.SelectView.SMALL_OFFSET_Y;g=SC.MenuPane.SMALL_MENU_ITEM_HEIGHT;break;case SC.REGULAR_CONTROL_SIZE:c=SC.SelectView.REGULAR_OFFSET_Y;g=SC.MenuPane.REGULAR_MENU_ITEM_HEIGHT;break;case SC.LARGE_CONTROL_SIZE:c=SC.SelectView.LARGE_OFFSET_Y;g=SC.MenuPane.LARGE_MENU_ITEM_HEIGHT;break;case SC.HUGE_CONTROL_SIZE:c=SC.SelectView.HUGE_OFFSET_Y;g=SC.MenuPane.HUGE_MENU_ITEM_HEIGHT;break}var e=c,b=this.get("_itemIdx"),a=this.get("leftAlign"),f,d;if(this.get("isDefaultPosition")){f=[1,0,3];this.set("preferMatrix",f)}else{if(b){e=b*g+c}d=[a,-e,2];this.set("preferMatrix",d)}},mouseDown:function(a){if(a.which!==1){return false}if(!this.get("isEnabledInPane")){return YES}this.set("isActive",YES);this._isMouseDown=YES;this.becomeFirstResponder();this._action();return YES},mouseUp:function(b){var c=this.get("menu"),a;if(c){a=c.getPath("rootMenu.targetMenuItem");if(a&&c.get("mouseHasEntered")){if(!a.performAction()){c.remove()}}else{if(b.timeStamp-this._mouseDownTimestamp>400){c.remove()}}}this._isMouseDown=NO;this.set("isActive",NO);return YES},mouseExited:function(){return YES},keyDown:function(a){if(this.interpretKeyEvents(a)){return YES}else{return arguments.callee.base.apply(this,arguments)}},moveUp:function(a){this._action();return YES},moveDown:function(a){this._action();return YES},cancel:function(a){this.resignFirstResponder()},_button_isSelectedDidChange:function(){}.observes("isSelected")});SC.SelectView.TINY_OFFSET_X=0;SC.SelectView.TINY_OFFSET_Y=0;SC.SelectView.TINY_POPUP_MENU_WIDTH_OFFSET=0;SC.SelectView.SMALL_OFFSET_X=-18;SC.SelectView.SMALL_OFFSET_Y=3;SC.SelectView.SMALL_POPUP_MENU_WIDTH_OFFSET=7;SC.SelectView.REGULAR_OFFSET_X=-17;SC.SelectView.REGULAR_OFFSET_Y=0;SC.SelectView.REGULAR_POPUP_MENU_WIDTH_OFFSET=4;SC.SelectView.LARGE_OFFSET_X=-17;SC.SelectView.LARGE_OFFSET_Y=6;SC.SelectView.LARGE_POPUP_MENU_WIDTH_OFFSET=3;SC.SelectView.HUGE_OFFSET_X=0;SC.SelectView.HUGE_OFFSET_Y=0;SC.SelectView.HUGE_POPUP_MENU_WIDTH_OFFSET=0;SC.SelectView.MENU_WIDTH_OFFSET=-2;SC.SliderView=SC.View.extend(SC.Control,{classNames:"sc-slider-view",ariaRole:"slider",value:0.5,valueBindingDefault:SC.Binding.single().notEmpty(),minimum:0,minimumBindingDefault:SC.Binding.single().notEmpty(),contentMinimumKey:null,maximum:1,maximumBindingDefault:SC.Binding.single().notEmpty(),contentMaximumKey:null,step:0.1,markSteps:false,updateOnScroll:true,displayProperties:["displayValue","markSteps"],ariaValue:function(){return this.get("value")}.property("value").cacheable(),renderDelegateName:"sliderRenderDelegate",displayValue:function(){return this._displayValueForValue(this.get("value"))}.property("value","minimum","maximum","step").cacheable(),steps:function(){var d=this.get("step");if(!d){return null}var c=this.get("minimum"),a=this.get("maximum"),e=c,b=[];while(e<a){b.push(e);e+=d;e=Math.round(e/d)*d}b.push(a);return b}.property("minimum","maximum","step").cacheable(),stepPositions:function(){var c=this.get("steps");if(!c){return null}var f=c[0],b=c[c.length-1],d=[],a=c.length,e;for(e=0;e<a;e++){d[e]=Math.round((c[e]-f)/(b-f)*1000)/1000}return d}.property("steps").cacheable(),_displayValueForValue:function(d){var b=this.get("minimum"),a=this.get("maximum"),c=this.get("step");d=Math.min(Math.max(d,b),a);if(!SC.none(c)&&c!==0){d=Math.round(d/c)*c}d=Math.round((d-b)/(a-b)*100);return d},_sc_clearMouseJustDown:function(){this._sc_isMouseJustDown=NO},_isMouseDown:NO,_sc_isMouseJustDown:NO,_sc_clearMouseJustDownTimer:null,mouseDown:function(a){if(a.which&&a.which!==1){return false}if(!this.get("isEnabledInPane")){return YES}this.set("isActive",YES);this._isMouseDown=YES;if(this._sc_clearMouseJustDownTimer){this._sc_clearMouseJustDownTimer.invalidate();this._sc_clearMouseJustDownTimer=null}this._sc_isMouseJustDown=NO;return this._triggerHandle(a,YES)},mouseDragged:function(a){return this._isMouseDown?this._triggerHandle(a):YES},mouseUp:function(a){if(this._isMouseDown){this.set("isActive",NO)}var b=this._isMouseDown?this._triggerHandle(a):YES;this._isMouseDown=NO;this._sc_isMouseJustDown=YES;this._sc_clearMouseJustDownTimer=this.invokeLater(this._sc_clearMouseJustDown,250);return b},mouseWheel:function(b){if(!this.get("isEnabledInPane")){return NO}if(!this.get("updateOnScroll")){return NO}if(this._isMouseDown||this._sc_isMouseJustDown){return NO}var d=this.get("minimum"),a=this.get("maximum"),e=this.get("step")||((a-d)/20),c=this.get("value")+((b.wheelDeltaX+b.wheelDeltaY)*e),f=Math.round(c/e)*e;if(c<d){this.setIfChanged("value",d)}else{if(c>a){this.setIfChanged("value",a)}else{this.setIfChanged("value",c)}}return YES},touchStart:function(a){return this.mouseDown(a)},touchEnd:function(a){return this.mouseUp(a)},touchesDragged:function(a){return this.mouseDragged(a)},_triggerHandle:function(i,e){var a=this.get("frame").width,c=this.get("minimum"),f=this.get("maximum"),b=this.get("step"),h=this.get("value"),d;if(e){d=this.convertFrameFromView({x:i.pageX}).x;this._evtDiff=i.pageX-d}else{d=i.pageX-this._evtDiff}d=Math.max(0,Math.min(d/a,1));if(e){var g=this.get("value");g=(g-c)/(f-c);if(Math.abs(g*a-d*a)<16){this._offset=g-d}else{this._offset=0}}d=Math.max(0,Math.min(d+this._offset,1));d=c+((f-c)*d);if(!SC.none(b)&&b!==0){d=Math.round(d/b)*b}if(Math.abs(h-d)>=0.01){this.set("value",d)}return YES},acceptsFirstResponder:function(){if(SC.FOCUS_ALL_CONTROLS){return this.get("isEnabledInPane")}return NO}.property("isEnabledInPane"),keyDown:function(h){if(h.which===9||h.keyCode===9){var f=h.shiftKey?this.get("previousValidKeyView"):this.get("nextValidKeyView");if(f){f.becomeFirstResponder()}else{h.allowDefault()}return YES}if(h.which>=33&&h.which<=40){var d=this.get("minimum"),g=this.get("maximum"),b=this.get("step"),i=g-d,a=0,c,e=this.get("value");if(h.which===37||h.which===38||h.which===34){if(SC.none(b)||b===0){if(i<100){a=e-1}else{c=Math.abs(i/100);if(c<2){c=2}a=e-c}}else{a=e-b}}if(h.which===39||h.which===40||h.which===33){if(SC.none(b)||b===0){if(i<100){a=e+2}else{c=Math.abs(i/100);if(c<2){c=2}a=e+c}}else{a=e+b}}if(h.which===36){a=g}if(h.which===35){a=d}if(a>=d&&a<=g){this.set("value",a)}}else{h.allowDefault();return NO}return YES},contentKeys:{contentValueKey:"value",contentMinimumKey:"minimum",contentMaximumKey:"maximum",contentIsIndeterminateKey:"isIndeterminate"}});sc_require("mixins/collection_group");sc_require("views/disclosure");SC.SourceListGroupView=SC.View.extend(SC.Control,SC.CollectionGroup,{classNames:["sc-source-list-group"],content:null,isGroupVisible:YES,hasGroupTitle:YES,groupTitleKey:null,groupVisibleKey:null,render:function(a,b){a.push('<div role="button" class="sc-source-list-label sc-disclosure-view sc-button-view button disclosure no-disclosure">','<img src="'+SC.BLANK_IMAGE_URL+'" class="button" />','<span class="label"></span></div>')},createChildViews:function(){},contentPropertyDidChange:function(f,c){var e=this.get("content");var h=this.outlet("labelView");if(e===null){h.setIfChanged("isVisible",NO);this.setIfChanged("hasGroupTitle",NO);return}else{h.setIfChanged("isVisible",YES);this.setIfChanged("hasGroupTitle",YES)}var b=this.getDelegateProperty("groupTitleKey",this.displayDelegate);if((c=="*")||(b&&(c==b))){var g=(e&&e.get&&b)?e.get(b):e;if(g!=this._title){this._title=g;if(g){g=g.capitalize()}h.set("title",g)}}var d=this.getDelegateProperty("groupVisibleKey",this.displayDelegate);if((c=="*")||(d&&(c==d))){if(d){h.removeClassName("no-disclosure");var a=(e&&e.get)?!!e.get(d):YES;if(a!=this.get("isGroupVisible")){this.set("isGroupVisible",a);h.set("value",a)}}else{h.addClassName("no-disclosure")}}},disclosureValueDidChange:function(c){if(c==this.get("isGroupVisible")){return}var b=this.get("content");var a=this.getDelegateProperty("groupVisibleKey",this.displayDelegate);if(b&&b.set&&a){b.set(a,c)}this.set("isGroupVisible",c);if(this.owner&&this.owner.updateChildren){this.owner.updateChildren(true)}},labelView:SC.DisclosureView.extend({value:YES,_valueObserver:function(){if(this.owner){this.owner.disclosureValueDidChange(this.get("value"))}}.observes("value")})});sc_require("views/list");sc_require("views/source_list_group");SC.SourceListView=SC.ListView.extend({theme:"source-list",classNames:["sc-source-list"],rowHeight:32,selectOnMouseDown:NO,actOnSelect:YES});sc_require("mixins/split_child");sc_require("mixins/split_thumb");SC.SplitDividerView=SC.View.extend(SC.SplitChild,SC.SplitThumb,{classNames:["sc-split-divider-view"],classNameBindings:["layoutDirection"],isSplitDivider:YES,layoutDirection:SC.LAYOUT_HORIZONTAL,autoResizeStyle:"sc-fixed-size",movesSibling:SC.MOVES_CHILD,size:SC.propertyFromRenderDelegate("dividerSize",10),renderDelegateName:"splitDividerRenderDelegate"});sc_require("views/split_divider");SC.FIXED_SIZE="sc-fixed-size";SC.RESIZE_MANUAL="sc-manual-size";SC.RESIZE_AUTOMATIC="sc-automatic-resize";SC.SplitView=SC.View.extend({childViews:["topLeftView","bottomRightView"],classNames:["sc-split-view"],isSplitView:YES,splitDividerView:SC.SplitDividerView,layoutDirection:SC.LAYOUT_HORIZONTAL,shouldResizeChildrenToFit:YES,splitChildCursorStyle:null,_scsv_splitChildCursorDidChange:function(){this.get("cursor").set("cursorStyle",this.get("splitChildCursorStyle"))}.observes("splitChildCursorStyle"),init:function(){this.cursor=SC.Cursor.create();arguments.callee.base.apply(this,arguments)},displayProperties:["layoutDirection"],renderDelegateName:"splitRenderDelegate",_frameSize:function(){if(this.get("layoutDirection")===SC.LAYOUT_HORIZONTAL){return this.get("frame").width}else{return this.get("frame").height}}.property("frame","layoutDirection").cacheable(),viewDidResize:function(){this.scheduleTiling();arguments.callee.base.apply(this,arguments)},layoutDirectionDidChange:function(){this.scheduleTiling();var e=this.get("layoutDirection"),d=this.get("childViews"),a=d?d.get("length"):0,c,b;for(c=0;c<a;c++){b=d[c];if(b.get("isSplitDivider")){b.setIfChanged("layoutDirection",e)}}}.observes("layoutDirection"),adjustPositionForChild:function(b,a){return this.invokeDelegateMethod(this.get("delegate"),"splitViewAdjustPositionForChild",this,b,a)},getPositionForChild:function(a){return this.invokeDelegateMethod(this.get("delegate"),"splitViewGetPositionForChild",this,a)},didAddChild:function(){if(this._scsv_settingUpChildViews){return}this._scsv_settingUpChildViews=YES;this.invokeOnce("_scsv_setupChildViews");this._scsv_settingUpChildViews=NO},didRemoveChild:function(){if(this._scsv_settingUpChildViews){return}this._scsv_settingUpChildViews=YES;this.invokeOnce("_scsv_setupChildViews");this._scsv_settingUpChildViews=NO},createChildViews:function(){arguments.callee.base.apply(this,arguments);if(this._scsv_settingUpChildViews){return}this._scsv_settingUpChildViews=YES;this.invokeOnce("_scsv_setupChildViews");this._scsv_settingUpChildViews=NO},_scsv_setupChildViews:function(){var l=this.get("delegate"),g=this.get("layoutDirection"),d=this.get("childViews").copy(),h=d.length,k,c,a,e,j=this._scsv_dividers||{},b={},f,i;for(k=0;k<h;k++){c=d[k];if(!c.get("autoResizeStyle")){if(c.get("size")!==undefined){c.set("autoResizeStyle",SC.RESIZE_MANUAL)}else{c.set("autoResizeStyle",SC.RESIZE_AUTOMATIC)}}var m=this.invokeDelegateMethod(l,"splitViewGetSizeForChild",this,c);m=this.invokeDelegateMethod(l,"splitViewConstrainSizeForChild",this,c,m);this.invokeDelegateMethod(l,"splitViewSetSizeForChild",this,c,m);c.previousView=a;c.nextView=undefined;c.viewIndex=k;if(a){a.nextView=c}if(e&&!c.isSplitDivider){i=SC.guidFor(e)+"-"+SC.guidFor(c);f=j[i];if(!f){f=this.invokeDelegateMethod(l,"splitViewDividerBetween",this,e,c)}if(f){f.setIfChanged("isSplitDivider",YES);f.setIfChanged("layoutDirection",g);b[i]=f;if(j[i]){delete j[i]}else{this.insertBefore(f,c)}}}a=c;if(!c.isSplitDivider){e=c}}for(i in j){j[i].destroy()}this._scsv_dividers=b;this._scsv_tile()},needsTiling:YES,scheduleTiling:function(){this.set("needsTiling",YES);this.invokeOnce("_scsv_tile")},tileIfNeeded:function(){if(!this.get("needsTiling")){return}this._scsv_tile()},_scsv_tile:function(){var a=this.get("delegate");var c,b=this.get("_frameSize");c=this.invokeDelegateMethod(a,"splitViewLayoutChildren",this);if(this.get("shouldResizeChildrenToFit")&&c!==b){this.invokeDelegateMethod(a,"splitViewResizeChildrenToFit",this,c);c=this.invokeDelegateMethod(a,"splitViewLayoutChildren",this)}if(!this.get("shouldResizeChildrenToFit")){if(this.get("layoutDirection")===SC.LAYOUT_HORIZONTAL){this.adjust("width",c)}else{this.adjust("height",c)}}this.set("needsTiling",NO)},splitViewLayoutChildren:function(e){var c=this.get("delegate");var d=this.get("childViews"),b=d.length,a,g,f=0;for(a=0;a<b;a++){g=d[a];this.invokeDelegateMethod(c,"splitViewSetPositionForChild",this,d[a],f);f+=this.invokeDelegateMethod(c,"splitViewGetSizeForChild",this,d[a])}return f},splitViewResizeChildrenToFit:function(h,d){var l=this.get("delegate");var g=this.get("_frameSize");var e=this.get("childViews"),i=e.length,k,c,a=0,f=0,j;for(k=0;k<i;k++){c=e[k];j=this.invokeDelegateMethod(l,"splitViewGetSizeForChild",this,c);if(this.invokeDelegateMethod(l,"splitViewShouldResizeChildToFit",this,c)){a+=j}else{f+=j}}var b=d;b=this._resizeChildrenForSize(b,g,YES,a);b=this._resizeChildrenForSize(b,g,YES,-1);b=this._resizeChildrenForSize(b,g,NO,f);b=this._resizeChildrenForSize(b,g,NO,-1)},_resizeChildrenForSize:function(d,e,f,h){var l=this.get("delegate");var c=this.get("childViews"),j,g=c.length,b;var i=e-d;for(j=0;j<g;j++){b=c[j];var k=this.invokeDelegateMethod(l,"splitViewGetSizeForChild",this,b),m=k;var a=this.invokeDelegateMethod(l,"splitViewShouldResizeChildToFit",this,b);if(a===f){if(h===-1){m+=i}else{m+=(m/h)*i}m=Math.round(m);m=this.invokeDelegateMethod(l,"splitViewConstrainSizeForChild",this,b,m);this.invokeDelegateMethod(l,"splitViewSetSizeForChild",this,b,m);if(h!==-1){h-=k}}d-=k;d+=m;i=e-d}return d},splitViewShouldResizeChildToFit:function(a,b){return(this.get("shouldResizeChildrenToFit")&&b.get("autoResizeStyle")===SC.RESIZE_AUTOMATIC)},splitViewAdjustPositionForChild:function(c,e,a){var d=this._scsv_createPlan();var b=this._scsv_adjustPositionForChildInPlan(d,e,a,e);this._scsv_commitPlan(d);return b},_scsv_createPlan:function(){var c=this.get("delegate"),g=[],f=this.get("childViews"),b,a=f.length,h,e,d;for(b=0;b<a;b++){h=f[b];e=this.invokeDelegateMethod(c,"splitViewGetPositionForChild",this,h);d=this.invokeDelegateMethod(c,"splitViewGetSizeForChild",this,h);g[b]={child:h,originalPosition:e,position:e,originalSize:d,size:d}}return g},_scsv_resetPlanRange:function(c,d,b){for(var a=d;a<=b;a++){c[a].position=c[a].originalPosition;c[a].size=c[a].originalSize}},_scsv_commitPlan:function(f){var d=this.get("delegate"),b=f.length,a,e,c=0;for(a=0;a<b;a++){e=f[a];if(e.size!==e.originalSize){this.invokeDelegateMethod(d,"splitViewSetSizeForChild",this,e.child,e.size)}if(e.position!==e.originalPosition){this.invokeDelegateMethod(d,"splitViewSetPositionForChild",this,e.child,e.position)}c=e.position+e.size}if(!this.get("shouldResizeChildrenToFit")){if(this.get("layoutDirection")===SC.LAYOUT_HORIZONTAL){this.adjust("width",c)}else{this.adjust("height",c)}}},_scsv_adjustPositionForChildInPlan:function(i,d,f,a){var j=this.get("delegate");if(!d.get("allowsIndirectAdjustments")&&a!==d&&a!==d.previousView){return i[d.viewIndex].position}if(d._splitViewIsAdjusting){return i[d.viewIndex].position}d._splitViewIsAdjusting=YES;var g=d.previousView,b=d.nextView,c,k,h,e,l=i[d.viewIndex].size;if(g&&!g._splitViewIsAdjusting){c=i[g.viewIndex].position;k=f-c;k=this._scsv_adjustSizeForChildInPlan(i,g,k,a);f=c+k}else{if(!g){f=0}}if(b&&b._splitViewIsAdjusting){d._splitViewIsAdjusting=NO;i[d.viewIndex].position=f;return f}if(d.get("compensatesForMovement")&&b){h=i[b.viewIndex].position;l=this._scsv_adjustSizeForChildInPlan(i,d,h-f)}else{if(!b&&this.get("shouldResizeChildrenToFit")){h=this.get("_frameSize");l=this._scsv_adjustSizeForChildInPlan(i,d,h-f);f=h-l}}if(b){h=f+l;h=this._scsv_adjustPositionForChildInPlan(i,b,h,a)}if(h&&f!==h-l){f=h-l;if(g&&!g._splitViewIsAdjusting){this._scsv_resetPlanRange(i,0,g.viewIndex);k=f-i[g.viewIndex].position;this._scsv_adjustSizeForChildInPlan(i,g,k,d)}}i[d.viewIndex].position=f;d._splitViewIsAdjusting=NO;return f},_scsv_adjustSizeForChildInPlan:function(f,b,i,a){var g=this.get("delegate");if(a&&!b.get("allowsIndirectAdjustments")&&a!==b&&a!==b.nextView&&a!==b.previousView){return f[b.viewIndex].size}var h=this.invokeDelegateMethod(g,"splitViewConstrainSizeForChild",this,b,i);f[b.viewIndex].size=h;if(i===h){return i}var c=f[b.viewIndex].position,d=c+i-h;var e=this._scsv_adjustPositionForChildInPlan(f,b,d,a);return e+h-c},splitViewDividerBetween:function(c,b,a){if(!this.get("splitDividerView")){return null}return this.get("splitDividerView").create()},splitViewGetPositionForChild:function(a,b){return b.get("position")},splitViewSetPositionForChild:function(b,c,a){c.set("position",a)},splitViewGetSizeForChild:function(b,c){var a=c.get("size");if(SC.none(a)){return 100}return a},splitViewSetSizeForChild:function(b,c,a){c.set("size",a)},splitViewConstrainSizeForChild:function(c,f,a){if(f.get("autoResizeStyle")===SC.FIXED_SIZE){return this.invokeDelegateMethod(this.get("delegate"),"splitViewGetSizeForChild",this,f)}if(f.get("canCollapse")){var b=f.get("collapseAtSize");if(b&&a<b){return 0}}var d=f.get("minimumSize")||0;if(d!==undefined&&d!==null){a=Math.max(d,a)}var e=f.get("maximumSize");if(e!==undefined&&e!==null){a=Math.min(e,a)}return a}});sc_require("views/collection");SC.StackedView=SC.CollectionView.extend({classNames:["sc-stacked-view"],layout:{top:0,left:0,right:0,height:1},computeNowShowing:function(){return this.get("allContentIndexes")},updateHeight:function(a){if(a){this._updateHeight()}else{this.invokeLast(this._updateHeight)}return this},_updateHeight:function(){var e=this.get("childViews"),b=e.get("length"),c,d,a;if(b===0){a=1}else{c=e.objectAt(b-1);d=c?c.get("layer"):null;a=d?(d.offsetTop+d.offsetHeight):1;d=null}this.adjust("minHeight",a);this.set("calculatedHeight",a)},reloadIfNeeded:function(){arguments.callee.base.apply(this,arguments);return this.updateHeight()},didCreateLayer:function(){return this.updateHeight()}});SC.StaticContentView=SC.View.extend({classNames:["sc-static-content-view"],displayProperties:["content"],content:null,contentLayoutDidChange:function(){this._sc_viewFrameDidChange()},useStaticLayout:YES,frame:function(){var a=this.get("layer"),b;if(!a){return{x:0,y:0,width:0,height:0}}if(a.getBoundingClientRect&&!SC.browser.isIE8OrLower){b=a.getBoundingClientRect();return{x:0,y:0,width:b.width,height:b.height}}else{return{x:0,y:0,width:a.clientWidth,height:a.clientHeight}}}.property("content").cacheable(),parentViewDidResize:function(){this.contentLayoutDidChange()},didUpdateLayer:function(){this.contentLayoutDidChange()},render:function(a,c){var b=this.get("content");a.push(b||"")},touchStart:function(a){a.allowDefault();return YES},touchEnd:function(a){a.allowDefault();return YES}});sc_require("views/segmented");SC.TOP_LOCATION="top";SC.TOP_TOOLBAR_LOCATION="top-toolbar";SC.BOTTOM_LOCATION="bottom";SC.TabView=SC.View.extend({classNames:["sc-tab-view"],displayProperties:["nowShowing"],nowShowing:null,items:[],itemTitleKey:null,itemValueKey:null,itemIsEnabledKey:null,itemIconKey:null,itemWidthKey:null,itemToolTipKey:null,tabHeight:SC.REGULAR_BUTTON_HEIGHT,tabLocation:SC.TOP_LOCATION,userDefaultKey:null,_tab_nowShowingDidChange:function(){var d=this.get("nowShowing");this.get("segmentedView").set("value",d);var c=this.get("userDefaultKey");if(c){SC.userDefaults.set([c,"nowShowing"].join(":"),d)}if(SC.typeOf(d)===SC.T_STRING&&d.length>0){var b=d.indexOf(".");if(b===-1){var a=this.get(d);d=SC.kindOf(a,SC.CoreView)?a:SC.objectForPropertyPath(d,this.get("page"))}else{if(b===0){d=this.getPath(d.slice(1))}else{d=SC.objectForPropertyPath(d)}}}this.get("containerView").set("nowShowing",d);return this}.observes("nowShowing"),_tab_itemsDidChange:function(){this.get("segmentedView").set("items",this.get("items"));return this}.observes("items"),init:function(){arguments.callee.base.apply(this,arguments);this._tab_nowShowingDidChange()._tab_itemsDidChange();var a=this.get("userDefaultKey");if(a){a=[a,"nowShowing"].join(":");var b=SC.userDefaults.get(a);if(!SC.none(b)){this.set("nowShowing",b)}}},createChildViews:function(){var e=[],d,c,b=this.get("tabLocation"),a=this.get("tabHeight"),f=this.get("controlSize");if(b===SC.TOP_LOCATION){c={top:a/2+1,left:0,right:0,bottom:0,border:1}}else{if(b===SC.TOP_TOOLBAR_LOCATION){c={top:a+1,left:0,right:0,bottom:0,border:1}}else{c={top:0,left:0,right:0,bottom:(a/2)-1,border:1}}}d=this.containerView.extend({layout:c,ariaRole:"tabpanel"});this.containerView=this.createChildView(d);c=(b===SC.TOP_LOCATION||b===SC.TOP_TOOLBAR_LOCATION)?{height:a,left:0,right:0,top:0}:{height:a,left:0,right:0,bottom:0};this.segmentedView=this.get("segmentedView").extend({layout:c,controlSize:f,_sc_tab_segmented_valueDidChange:function(){var g=this.get("parentView");if(g){g.set("nowShowing",this.get("value"))}}.observes("value"),init:function(){var g=this.get("parentView");if(g){SC._TAB_ITEM_KEYS.forEach(function(h){this[h]=g.get(h)},this)}return arguments.callee.base.apply(this,arguments)}});this.segmentedView=this.createChildView(this.segmentedView);e.push(this.containerView);e.push(this.segmentedView);this.set("childViews",e);return this},containerView:SC.ContainerView.extend({renderDelegateName:"wellRenderDelegate"}),segmentedView:SC.SegmentedView});SC._TAB_ITEM_KEYS=["itemTitleKey","itemValueKey","itemIsEnabledKey","itemIconKey","itemWidthKey","itemToolTipKey","itemActionKey","itemTargetKey"];SC.ThumbView=SC.View.extend(SC.SplitThumb,{classNames:["sc-thumb-view"],init:function(){arguments.callee.base.apply(this,arguments);console.warn("SC.ThumbView is deprecated. Please use a normal view and mix in SC.SplitThumb instead.")}});SC.WebView=SC.View.extend(SC.Control,{classNames:"sc-web-view",displayProperties:["value","shouldAutoResize"],shouldAutoResize:NO,render:function(a,d){var c=this.get("value")||"",b;if(d){a.push('<iframe src="'+c+'" style="position: absolute; width: 100%; height: 100%; border: 0px; margin: 0px; padding: 0px;"></iframe>')}else{if(c!==this._lastSrc){b=this.$("iframe");b.attr("src","javascript:;");b.attr("src",c)}}this._lastSrc=c},didCreateLayer:function(){var a=this.$("iframe");SC.Event.add(a,"load",this,this.iframeDidLoad)},willDestroyLayer:function(){var a=this.$("iframe");SC.Event.remove(a,"load",this,this.iframeDidLoad)},iframeDidLoad:function(){if(this.get("shouldAutoResize")===YES){var a;var c=this.$("iframe")[0];if(c&&c.contentWindow){a=c.contentWindow;if(a&&a.document&&a.document.documentElement){var b=a.document.documentElement;if(!SC.browser.isIE){this.$().width(b.scrollWidth);this.$().height(b.scrollHeight)}else{this.$().width(b.scrollWidth+12);this.$().height(b.scrollHeight+5)}}}}}});SC.WELL_CONTAINER_PADDING=15;SC.WellView=SC.ContainerView.extend({classNames:"sc-well-view",contentLayout:{top:SC.WELL_CONTAINER_PADDING,bottom:SC.WELL_CONTAINER_PADDING,left:SC.WELL_CONTAINER_PADDING,right:SC.WELL_CONTAINER_PADDING},renderDelegateName:"wellRenderDelegate",createChildViews:function(){var a=this.get("contentView");if(a){a=this.contentView=this.createChildView(a);a.set("layout",this.contentLayout);this.childViews=[a]}},contentViewDidChange:function(){var a=this.get("contentView");a.set("layout",this.contentLayout);this.replaceContent(a)}.observes("contentView")});if(!Object.keys){Object.keys=(function(){var c=Object.prototype.hasOwnProperty,d=!({toString:null}).propertyIsEnumerable("toString"),b=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],a=b.length;return function(g){if(typeof g!=="object"&&(typeof g!=="function"||g===null)){throw new TypeError("Object.keys called on non-object")}var e=[],h,f;for(h in g){if(c.call(g,h)){e.push(h)}}if(d){for(f=0;f<a;f++){if(c.call(g,b[f])){e.push(b[f])}}}return e}}())}(function(){var b=0;var c=["ms","moz","webkit","o"];for(var a=0;a<c.length&&!window.requestAnimationFrame;++a){window.requestAnimationFrame=window[c[a]+"RequestAnimationFrame"];window.cancelRequestAnimationFrame=window[c[a]+"CancelRequestAnimationFrame"]}if(!window.requestAnimationFrame){window.requestAnimationFrame=function(g){var d=new Date().getTime();var e=Math.max(0,16-(d-b));var f=window.setTimeout(function(){g(window.performance.now())},e);b=d+e;return f}}if(!window.cancelAnimationFrame){window.cancelAnimationFrame=function(d){clearTimeout(d)}}}());SC.MIXED_STATE="__MIXED__";SC.DataSource=SC.Object.extend({fetch:function(a,b){return NO},retrieveRecords:function(a,c,b){return this._handleEach(a,c,this.retrieveRecord,b)},commitRecords:function(c,b,g,f,h){var e,a,d;if(b.length>0){d=this.createRecords.call(this,c,b,h)}if(g.length>0){e=this.updateRecords.call(this,c,g,h);d=SC.none(d)?e:(d===e)?d:SC.MIXED_STATE}if(f.length>0){a=this.destroyRecords.call(this,c,f,h);d=SC.none(d)?a:(d===a)?d:SC.MIXED_STATE}return d||NO},cancel:function(a,b){return NO},updateRecords:function(a,b,c){return this._handleEach(a,b,this.updateRecord,null,c)},createRecords:function(a,b,c){return this._handleEach(a,b,this.createRecord,null,c)},destroyRecords:function(a,b,c){return this._handleEach(a,b,this.destroyRecord,null,c)},_handleEach:function(h,e,c,a,b){var f=e.length,i,g,j,d;for(i=0;i<f;i++){d=a?a[i]:b;j=c.call(this,h,e[i],d);if(g===undefined){g=j}else{if(g===YES){g=(j===YES)?YES:SC.MIXED_STATE}else{if(g===NO){g=(j===NO)?NO:SC.MIXED_STATE}}}}return !SC.none(g)?g:null},updateRecord:function(a,b,c){return NO},retrieveRecord:function(a,b,c){return NO},createRecord:function(a,b,c){return NO},destroyRecord:function(a,b,c){return NO}});sc_require("data_sources/data_source");SC.CascadeDataSource=SC.DataSource.extend({dataSources:null,from:function(a){var b=this.get("dataSources");if(!b){this.set("dataSources",b=[])}b.push(a);return this},fetch:function(c,g){var e=this.get("dataSources"),b=e?e.length:0,d=NO,h,f,a;for(a=0;(d!==YES)&&a<b;a++){f=e.objectAt(a);h=f.fetch?f.fetch.apply(f,arguments):NO;d=this._handleResponse(d,h)}return d},retrieveRecords:function(h,d,b){var c=this.get("dataSources"),e=c?c.length:0,f=NO,i,a,g;for(g=0;(f!==YES)&&g<e;g++){a=c.objectAt(g);i=a.retrieveRecords.apply(a,arguments);f=this._handleResponse(f,i)}return f},commitRecords:function(j,c,h,e,d){var b=this.get("dataSources"),f=b?b.length:0,g=NO,k,a,i;for(i=0;(g!==YES)&&i<f;i++){a=b.objectAt(i);k=a.commitRecords.apply(a,arguments);g=this._handleResponse(g,k)}return g},cancel:function(c,f){var e=this.get("dataSources"),b=e?e.length:0,d=NO,h,g,a;for(a=0;(d!==YES)&&a<b;a++){g=e.objectAt(a);h=g.cancel.apply(g,arguments);d=this._handleResponse(d,h)}return d},init:function(){arguments.callee.base.apply(this,arguments);var b=this.get("dataSources"),a=b?b.get("length"):0,c;while(--a>=0){c=b[a];if(SC.typeOf(c)===SC.T_STRING){b[a]=this.get(c)}}},_handleResponse:function(b,a){if(a===YES){return YES}else{if(b===NO){return(a===NO)?NO:SC.MIXED_STATE}else{return SC.MIXED_STATE}}}});sc_require("core");sc_require("models/record");SC.Query=SC.Object.extend(SC.Copyable,SC.Freezable,{isQuery:YES,conditions:null,orderBy:null,recordType:null,recordTypes:null,expandedRecordTypes:function(){var b=SC.CoreSet.create(),a,c;if(a=this.get("recordType")){this._scq_expandRecordType(a,b)}else{if(a=this.get("recordTypes")){a.forEach(function(d){this._scq_expandRecordType(d,b)},this)}else{this._scq_expandRecordType(SC.Record,b)}}c=SC.Query._scq_queriesWithExpandedRecordTypes;if(!c){c=SC.Query._scq_queriesWithExpandedRecordTypes=SC.CoreSet.create()}c.add(this);return b.freeze()}.property("recordType","recordTypes").cacheable(),_scq_expandRecordType:function(b,a){if(a.contains(b)){return}a.add(b);if(SC.typeOf(b)===SC.T_STRING){b=SC.objectForPropertyPath(b)}b.subclasses.forEach(function(c){this._scq_expandRecordType(c,a)},this)},parameters:null,location:"local",scope:null,isRemote:function(){return this.get("location")===SC.Query.REMOTE}.property("location").cacheable(),isLocal:function(){return this.get("location")===SC.Query.LOCAL}.property("location").cacheable(),isEditable:NO,contains:function(a,d){var e,b=YES;if(e=this.get("recordTypes")){b=e.find(function(f){return SC.kindOf(a,f)})}else{if(e=this.get("recordType")){b=SC.kindOf(a,e)}}if(!b){return NO}var c=this.get("scope");if(c&&!c.contains(a)){return NO}if(!this._isReady){this.parse()}if(!this._isReady){return NO}if(d===undefined){d=this.parameters||this}return this._tokenTree.evaluate(a,d)},containsRecordTypes:function(a){var b=this.get("recordType");if(b){return !!a.find(function(c){return SC.kindOf(c,b)})}else{if(b=this.get("recordTypes")){return !!b.find(function(c){return !!a.find(function(d){return SC.kindOf(d,c)})})}else{return YES}}},compare:function(g,d){var c=0,f,b,a,h,e;if(g===d){return 0}if(!this._isReady){this.parse()}if(!this._isReady){return SC.compare(g.get("storeKey"),d.get("storeKey"))}b=this._order;if(SC.typeOf(b)===SC.T_FUNCTION){c=b.call(null,g,d)}else{a=b?b.length:0;for(h=0;c===0&&(h<a);h++){f=b[h].propertyName;e=/\./.test(f)?"getPath":"get";if(SC.Query.comparisons[f]){c=SC.Query.comparisons[f](g[e](f),d[e](f))}else{c=SC.compare(g[e](f),d[e](f))}if((c!==0)&&b[h].descending){c=(-1)*c}}}if(c!==0){return c}else{return SC.compare(g.get("storeKey"),d.get("storeKey"))}},_isReady:NO,parse:function(){var c=this.get("conditions"),d=this.get("queryLanguage"),b,a;b=this._tokenList=this.tokenizeString(c,d);a=this._tokenTree=this.buildTokenTree(b,d);this._order=this.buildOrder(this.get("orderBy"));this._isReady=!!a&&!a.error;if(a&&a.error){SC.throw(a.error)}return this._isReady},queryWithScope:function(c){var b=SC.keyFor("__query__",SC.guidFor(this)),a=c[b];if(!a){c[b]=a=this.copy();a.set("scope",c);a.freeze()}return a},copyKeys:["conditions","orderBy","recordType","recordTypes","parameters","location","scope"],concatenatedProperties:["copyKeys"],copy:function(){var d={},c=this.get("copyKeys"),f=c?c.length:0,b,e,a;while(--f>=0){b=c[f];e=this.get(b);if(e!==undefined){d[b]=e}}a=this.constructor.create(d);d=null;return a},queryLanguage:{UNKNOWN:{firstCharacter:/[^\s'"\w\d\(\)\{\}]/,notAllowed:/[\-\s'"\w\d\(\)\{\}]/},PROPERTY:{firstCharacter:/[a-zA-Z_]/,notAllowed:/[^a-zA-Z_0-9\.]/,evalType:"PRIMITIVE",evaluate:function(e,b){var f=this.tokenValue.split(".");var a=f.length;if(a<2){return e.get(this.tokenValue)}var c=e;for(var d=0;d<a;d++){if(!c){return}if(c.get){c=c.get(f[d])}else{c=c[f[d]]}}return c}},NUMBER:{firstCharacter:/[\d\-]/,notAllowed:/[^\d\-\.]/,format:/^-?\d+$|^-?\d+\.\d+$/,evalType:"PRIMITIVE",evaluate:function(b,a){return parseFloat(this.tokenValue)}},STRING:{firstCharacter:/['"]/,delimited:true,evalType:"PRIMITIVE",evaluate:function(b,a){return this.tokenValue}},PARAMETER:{firstCharacter:/\{/,lastCharacter:"}",delimited:true,evalType:"PRIMITIVE",evaluate:function(b,a){return a[this.tokenValue]}},"%@":{rememberCount:true,reservedWord:true,evalType:"PRIMITIVE",evaluate:function(b,a){return a[this.tokenValue]}},OPEN_PAREN:{firstCharacter:/\(/,singleCharacter:true},CLOSE_PAREN:{firstCharacter:/\)/,singleCharacter:true},AND:{reservedWord:true,leftType:"BOOLEAN",rightType:"BOOLEAN",evalType:"BOOLEAN",evaluate:function(c,a){var d=this.leftSide.evaluate(c,a);var b=this.rightSide.evaluate(c,a);return d&&b}},OR:{reservedWord:true,leftType:"BOOLEAN",rightType:"BOOLEAN",evalType:"BOOLEAN",evaluate:function(c,a){var d=this.leftSide.evaluate(c,a);var b=this.rightSide.evaluate(c,a);return d||b}},NOT:{reservedWord:true,rightType:"BOOLEAN",evalType:"BOOLEAN",evaluate:function(c,a){var b=this.rightSide.evaluate(c,a);return !b}},"=":{reservedWord:true,leftType:"PRIMITIVE",rightType:"PRIMITIVE",evalType:"BOOLEAN",evaluate:function(c,a){var d=this.leftSide.evaluate(c,a);var b=this.rightSide.evaluate(c,a);return SC.isEqual(d,b)}},"!=":{reservedWord:true,leftType:"PRIMITIVE",rightType:"PRIMITIVE",evalType:"BOOLEAN",evaluate:function(c,a){var d=this.leftSide.evaluate(c,a);var b=this.rightSide.evaluate(c,a);return !SC.isEqual(d,b)}},"<":{reservedWord:true,leftType:"PRIMITIVE",rightType:"PRIMITIVE",evalType:"BOOLEAN",evaluate:function(c,a){var d=this.leftSide.evaluate(c,a);var b=this.rightSide.evaluate(c,a);return SC.compare(d,b)===-1}},"<=":{reservedWord:true,leftType:"PRIMITIVE",rightType:"PRIMITIVE",evalType:"BOOLEAN",evaluate:function(c,a){var d=this.leftSide.evaluate(c,a);var b=this.rightSide.evaluate(c,a);return SC.compare(d,b)!==1}},">":{reservedWord:true,leftType:"PRIMITIVE",rightType:"PRIMITIVE",evalType:"BOOLEAN",evaluate:function(c,a){var d=this.leftSide.evaluate(c,a);var b=this.rightSide.evaluate(c,a);return SC.compare(d,b)===1}},">=":{reservedWord:true,leftType:"PRIMITIVE",rightType:"PRIMITIVE",evalType:"BOOLEAN",evaluate:function(c,a){var d=this.leftSide.evaluate(c,a);var b=this.rightSide.evaluate(c,a);return SC.compare(d,b)!==-1}},BEGINS_WITH:{reservedWord:true,leftType:"PRIMITIVE",rightType:"PRIMITIVE",evalType:"BOOLEAN",evaluate:function(c,a){var b=this.leftSide.evaluate(c,a);var d=this.rightSide.evaluate(c,a);return(b&&b.indexOf(d)===0)}},ENDS_WITH:{reservedWord:true,leftType:"PRIMITIVE",rightType:"PRIMITIVE",evalType:"BOOLEAN",evaluate:function(d,b){var c=this.leftSide.evaluate(d,b);var a=this.rightSide.evaluate(d,b);return(c&&c.length>=a.length&&c.lastIndexOf(a)===(c.length-a.length))}},CONTAINS:{reservedWord:true,leftType:"PRIMITIVE",rightType:"PRIMITIVE",evalType:"BOOLEAN",evaluate:function(e,a){var d=this.leftSide.evaluate(e,a)||[];var g=this.rightSide.evaluate(e,a);var c=SC.typeOf(d);if(c===SC.T_STRING){return(d.indexOf(g)!==-1)}else{if(c===SC.T_ARRAY||d.toArray){if(c!==SC.T_ARRAY){d=d.toArray()}var f=false;var b=0;while(f===false&&b<d.length){if(g==d[b]){f=true}b++}return f}}}},ANY:{reservedWord:true,leftType:"PRIMITIVE",rightType:"PRIMITIVE",evalType:"BOOLEAN",evaluate:function(d,a){var f=this.leftSide.evaluate(d,a);var b=this.rightSide.evaluate(d,a);var e=false;var c=0;while(e===false&&c<b.length){if(f==b[c]){e=true}c++}return e}},MATCHES:{reservedWord:true,leftType:"PRIMITIVE",rightType:"PRIMITIVE",evalType:"BOOLEAN",evaluate:function(c,a){var d=this.leftSide.evaluate(c,a);var b=this.rightSide.evaluate(c,a);return b.test(d)}},TYPE_IS:{reservedWord:true,rightType:"PRIMITIVE",evalType:"BOOLEAN",evaluate:function(d,a){var c=SC.Store.recordTypeFor(d.storeKey);var b=this.rightSide.evaluate(d,a);var e=SC.objectForPropertyPath(b);return c==e}},"null":{reservedWord:true,evalType:"PRIMITIVE",evaluate:function(b,a){return null}},"undefined":{reservedWord:true,evalType:"PRIMITIVE",evaluate:function(b,a){return undefined}},"false":{reservedWord:true,evalType:"PRIMITIVE",evaluate:function(b,a){return false}},"true":{reservedWord:true,evalType:"PRIMITIVE",evaluate:function(b,a){return true}},YES:{reservedWord:true,evalType:"PRIMITIVE",evaluate:function(b,a){return true}},NO:{reservedWord:true,evalType:"PRIMITIVE",evaluate:function(b,a){return false}}},tokenizeString:function(o,b){var p=[],n=null,s=null,e=null,f=null,h=null,a=null,r=null,q=false,g=false,d=false,l={};function k(t,c){s=b[t];if(s.format&&!s.format.test(c)){t="UNKNOWN"}if(s.delimited){d=true}if(!s.delimited){for(var i in b){if(b[i].reservedWord&&i==c){t=i}}}s=b[t];if(s&&s.rememberCount){if(!l[t]){l[t]=0}c=l[t];l[t]+=1}p.push({tokenType:t,tokenValue:c});f=null;h=null;a=null}if(!o){return[]}var m=o.length;for(var j=0;j<m;j++){q=(j===m-1);n=o.charAt(j);d=false;if(f){s=b[f];g=s.delimited?n===r:s.notAllowed.test(n);if(!g){a+=n}if(g||q){k(f,a)}if(q&&!g){d=true}}if(!f&&!d){for(e in b){s=b[e];if(s.firstCharacter&&s.firstCharacter.test(n)){f=e}}if(f){s=b[f];a=n;if(s.delimited){a="";if(s.lastCharacter){r=s.lastCharacter}else{r=n}}if(s.singleCharacter||q){k(f,a)}}}}return p},buildTokenTree:function(k,a){var o=k.slice();var q=0;var s=[];var c=false;var p=[];if(!k||k.length===0){return{evaluate:function(){return true}}}function r(i){var v=i;if(v<0){return false}var l=a[o[v].tokenType];if(!l){p.push("logic for token '"+o[v].tokenType+"' is not defined");return false}o[v].evaluate=l.evaluate;return l}function b(v,i){var w=i;var l=r(w);if(!l){return false}if(v==="left"){return l.leftType}if(v==="right"){return l.rightType}}function n(i){var v=i;var l=r(v);if(!l){return false}else{return l.evalType}}function f(i){o.splice(i,1);if(i<=q){q--}}function t(i){var l=i||q;if(l>0){return true}else{return false}}function j(i){var l=i;if(l<0){return true}return(b("left",l)&&!o[l].leftSide)||(b("right",l)&&!o[l].rightSide)}function h(l,v){var i=(v<l)?"left":"right";if(l<0||v<0){return false}if(!b(i,l)){return false}if(!n(v)){return false}if(b(i,l)==n(v)){return true}else{return false}}function m(i){var l=i;if(!j(l)){return false}if(!t(l)){return false}if(h(l,l-1)){return true}else{return false}}function d(i){var l=i;if(j(l)){return false}if(!t(l)){return false}if(!j(l-1)){return false}if(h(l-1,l)){return true}else{return false}}function g(i){var l=i;if(l<1){return false}o[l].leftSide=o[l-1];f(l-1)}function u(i){var l=i;if(l<1){return false}o[l-1].rightSide=o[l];f(l)}function e(i){f(i);f(s.pop())}for(q=0;q<o.length;q++){c=false;if(o[q].tokenType==="UNKNOWN"){p.push("found unknown token: "+o[q].tokenValue)}if(o[q].tokenType==="OPEN_PAREN"){s.push(q)}if(o[q].tokenType==="CLOSE_PAREN"){e(q)}if(m(q)){g(q)}if(d(q)){u(q);c=true}if(c){q--}}if(o.length===1){o=o[0]}else{p.push("string did not resolve to a single tree")}if(p.length>0){return{error:p.join(",\n"),tree:o,isError:YES,errorVal:function(){return this.error}}}else{return o}},buildOrder:function(a){if(!a){return[]}else{if(SC.typeOf(a)===SC.T_FUNCTION){return a}else{var d=a.split(",");for(var b=0;b<d.length;b++){var c=d[b];c=c.replace(/^\s+|\s+$/,"");c=c.replace(/\s+/,",");c=c.split(",");d[b]={propertyName:c[0]};if(c[1]&&c[1]==="DESC"){d[b].descending=true}}return d}}}});SC.Query.mixin({LOCAL:"local",REMOTE:"remote",storeKeyFor:function(a){return a?a.get("storeKey"):null},containsRecords:function(g,e,d){var f=[];for(var b=0,a=e.get("length");b<a;b++){var c=e.objectAt(b);if(c&&g.contains(c)){f.push(c.get("storeKey"))}}f=SC.Query.orderStoreKeys(f,g,d);return f},orderStoreKeys:function(b,c,a){if(b){b.sort(function(e,d){return SC.Query.compareStoreKeys(c,a,e,d)})}return b},compareStoreKeys:function(f,c,e,d){var b=c.materializeRecord(e),a=c.materializeRecord(d);return f.compare(b,a)},build:function(g,c,f,i){var a=null,e,b,h,d;if(c&&c.isQuery){if(c.get("location")===g){return c}else{return c.copy().set("location",g).freeze()}}if(typeof c===SC.T_STRING){e=SC.objectForPropertyPath(c);if(!e){throw new Error("%@ did not resolve to a class".fmt(c))}c=e}else{if(c&&c.isEnumerable){e=[];c.forEach(function(j){if(typeof j===SC.T_STRING){j=SC.objectForPropertyPath(j)}if(!j){throw new Error("cannot resolve record types: %@".fmt(c))}e.push(j)},this);c=e}else{if(!c){c=SC.Record}}}if(i===undefined){i=null}if(f===undefined){f=null}if(!i&&(typeof f!==SC.T_STRING)){a=f;f=null}if(!i&&!a){d=SC.Query._scq_recordTypeCache;if(!d){d=SC.Query._scq_recordTypeCache={}}b=d[g];if(!b){b=d[g]={}}if(c.isEnumerable){h=c.map(function(j){return SC.guidFor(j)});h=h.sort().join(":")}else{h=SC.guidFor(c)}if(f){h=[h,f].join("::")}e=b[h];if(!e){if(c.isEnumerable){a={recordTypes:c.copy()}}else{a={recordType:c}}a.location=g;a.conditions=f;e=b[h]=SC.Query.create(a).freeze()}}else{if(!a){a={}}if(!a.location){a.location=g}if(c&&c.isEnumerable){a.recordTypes=c}else{a.recordType=c}if(f){a.conditions=f}if(i){a.parameters=i}e=SC.Query.create(a).freeze()}return e},local:function(c,a,b){return this.build(SC.Query.LOCAL,c,a,b)},remote:function(c,a,b){return this.build(SC.Query.REMOTE,c,a,b)},_scq_didDefineRecordType:function(){var a=SC.Query._scq_queriesWithExpandedRecordTypes;if(a){a.forEach(function(b){b.notifyPropertyChange("expandedRecordTypes")},this);a.clear()}}});SC.Query.comparisons={};SC.Query.registerComparison=function(a,b){SC.Query.comparisons[a]=b};SC.Query.registerQueryExtension=function(b,a){SC.Query.prototype.queryLanguage[b]=a};SC.Q=SC.Query.from;sc_require("system/query");SC.Record=SC.Object.extend({isRecord:YES,id:function(a,b){if(b!==undefined){this.writeAttribute(this.get("primaryKey"),b);return b}else{return SC.Store.idFor(this.storeKey)}}.property("storeKey").cacheable(),isParentRecord:NO,primaryKey:"guid",status:function(){return this.store.readStatus(this.storeKey)}.property("storeKey").cacheable(),store:null,storeKey:null,isDestroyed:function(){return !!(this.get("status")&SC.Record.DESTROYED)}.property("status").cacheable(),isEditable:function(a,b){if(b!==undefined){this._screc_isEditable=b}if(this.get("status")&SC.Record.READY){return this._screc_isEditable}else{return NO}}.property("status").cacheable(),_screc_isEditable:YES,isLoaded:function(){var b=SC.Record,a=this.get("status");return !((a===b.EMPTY)||(a===b.BUSY_LOADING)||(a===b.ERROR))}.property("status").cacheable(),relationships:null,attributes:function(){var a=this.get("store"),b=this.storeKey;return a.readEditableDataHash(b)}.property(),readOnlyAttributes:function(){var a=this.get("store"),c=this.storeKey,b=a.readDataHash(c);if(b){b=SC.clone(b,YES)}return b}.property(),nestedRecordNamespace:null,isNestedRecord:function(){var c=this.get("store"),d,b=this.get("storeKey"),a=c.parentStoreKeyExists(b);d=a?YES:NO;return d}.property().cacheable(),parentRecord:function(){var a=this.storeKey,b=this.get("store");return b.materializeParentRecord(a)}.property(),refresh:function(e,g){var c=this.get("store"),f,d,b=this.get("storeKey"),a=c.parentStoreKeyExists();d=e||(SC.none(e)&&SC.none(a));if(d){c.refreshRecord(null,null,b,g)}else{if(a){f=c.materializeRecord(a);f.refresh(e,g)}}return this},destroy:function(e){var c=this.get("store"),f,d,b=this.get("storeKey"),a=c.parentStoreKeyExists();d=e||(SC.none(e)&&SC.none(a));if(d){c.destroyRecord(null,null,b);this.notifyPropertyChange("status");this.propagateToAggregates()}else{if(a){f=c.materializeRecord(a);f.destroy(e)}}return this},recordDidChange:function(a){var b=this.get("parentRecord");if(b){b.recordDidChange()}this.get("store").recordDidChange(null,null,this.get("storeKey"),a);this.notifyPropertyChange("status");this.propagateToAggregates();return this},toJSON:function(){return this.get("attributes")},_editLevel:0,beginEditing:function(){this._editLevel++;return this},endEditing:function(a){if(--this._editLevel<=0){this._editLevel=0;this.recordDidChange(a)}return this},readAttribute:function(c){var a=this.get("store"),d=this.storeKey;var b=a.readDataHash(d);return b?b[c]:undefined},writeAttribute:function(c,f,e){var a=this.get("store"),d=this.storeKey,b;b=a.readEditableDataHash(d);if(!b){SC.Record.BAD_STATE_ERROR.throw()}if(f!==b[c]){if(!e){this.beginEditing()}b[c]=f;if(c===this.get("primaryKey")){SC.Store.replaceIdFor(d,f);this.propertyDidChange("id")}if(!e){this.endEditing(c)}else{a.dataHashDidChange(d,null,undefined,c)}}return this},propagateToAggregates:function(){var m=this.get("storeKey"),d=SC.Store.recordTypeFor(m),f=d.__sc_aggregate_keys,k,g,l,b,c,j;if(!f){f=[];for(l in this){b=this[l];if(b&&b.isRecordAttribute&&b.aggregate===YES){f.push(l)}}d.__sc_aggregate_keys=f}var i=SC.Record,a=i.DIRTY,e=i.READY_NEW,n=i.DESTROYED,o=i.READY_CLEAN,h;h=function(t){var p,q,r,s;if(t){p=this.get("status");if((p&a)||(p&e)||(p&n)){q=t.get("store");r=t.get("storeKey");s=q.peekStatus(r);if(s===o){t.get("store").recordDidChange(t.constructor,null,t.get("storeKey"),null,YES)}}}};for(k=0,g=f.length;k<g;++k){l=f[k];c=this.get(l);j=SC.kindOf(c,SC.ManyArray)?c:[c];j.forEach(h,this)}},storeDidChangeProperties:function(a,b){if(a){this.notifyPropertyChange("status")}else{if(b){this.beginPropertyChanges();b.forEach(function(e){this.notifyPropertyChange(e)},this);this.notifyPropertyChange("status");this.endPropertyChanges()}else{this.allPropertiesDidChange()}var d=this.relationships,c=d?d.length:0;while(--c>=0){d[c].recordPropertyDidChange(b)}}},normalize:function(d){var j=this.primaryKey,k=this.get("store"),m=this.get("storeKey"),n={},l,g,c,p,f,b,a,i,o,h;var e=k.readEditableDataHash(m)||{};p=k.readDataHash(m);n[j]=YES;for(l in this){g=this[l];if(g){c=g.typeClass;if(c){o=g.get("key")||l;n[o]=YES;b=SC.typeOf(c.call(g))===SC.T_CLASS;a=g.isNestedRecordTransform;if(!b&&!a){f=this.get(l);if(f!==undefined&&(f!==null||d)){h=this[l];if(SC.kindOf(h,SC.RecordAttribute)){f=h.fromType(this,l,f)}e[o]=f}else{if(!d){n[o]=NO}}}else{if(a){f=this.get(l);if(f&&f.normalize){f.normalize()}}else{if(b){f=p[o];if(f!==undefined){e[o]=f}else{i=g.get("defaultValue");if(SC.typeOf(i)===SC.T_FUNCTION){e[o]=i(this,l,i)}else{e[o]=i}}}}}}}}for(l in e){if(!n[l]){SC.debug("%@:  Deleting key from underlying data hash due to normalization:  %@",this,l);delete e[l]}}return this},unknownProperty:function(b,d){if(d!==undefined){var c=this.get("storeKey"),e=SC.Store.recordTypeFor(c);if(e.ignoreUnknownProperties===YES){this[b]=d;return d}var a=this.get("primaryKey");this.writeAttribute(b,d);if(b===a){SC.Store.replaceIdFor(c,d)}}return this.readAttribute(b)},commitRecord:function(f,d,g){var b=this.get("store"),e,c,a=b.parentStoreKeyExists();c=d||(SC.none(d)&&SC.none(a));if(c){b.commitRecord(undefined,undefined,this.get("storeKey"),f,g)}else{if(a){e=b.materializeRecord(a);e.commitRecord(f,d,g)}}return this},isError:function(){return !!(this.get("status")&SC.Record.ERROR)}.property("status").cacheable(),errorValue:function(){return this.get("isError")?SC.val(this.get("errorObject")):null}.property("isError").cacheable(),errorObject:function(){if(this.get("isError")){var a=this.get("store");return a.readError(this.get("storeKey"))||SC.Record.GENERIC_ERROR}else{return null}}.property("isError").cacheable(),set:function(a,c){var b=this[a];if(b&&b.isProperty&&b.get&&!b.get("isEditable")){return this}return arguments.callee.base.apply(this,arguments)},registerNestedRecord:function(f,e,g){var c,d=this.get("storeKey"),b,a,h;if(SC.none(g)){g=e}if(f&&f.get&&f.get("isRecord")){a=f}else{h=this._materializeNestedRecordType(f,e);a=this.createNestedRecord(h,f,d,g)}if(a){this.isParentRecord=YES;c=this.get("store");b=a.get("storeKey");c.registerChildToParent(d,b,g)}return a},unregisterNestedRecord:function(d){var b,a,c;c=this.get("store");b=this.getPath(d);a=b.get("storeKey");c.unregisterChildFromParent(a)},_materializeNestedRecordType:function(c,b){var a,d;if(SC.typeOf(c)===SC.T_HASH){a=this.get("nestedRecordNamespace");if(c.type&&!SC.none(a)){d=a[c.type]}}if(!d&&b&&this[b]){d=this[b].get("typeClass")}if(!d||!SC.kindOf(d,SC.Record)){throw new Error("SC.Child: Error during transform: Invalid record type.")}return d},createNestedRecord:function(h,f,c,e){var b=this.get("store"),g,a,d=null;f=f||{};if(SC.none(b)){throw new Error("Error: during the creation of a child record: NO STORE ON PARENT!")}g=f[h.prototype.primaryKey];if(!g){g=this.generateIdForChild(d)}if(!g){g=c+"."+e}a=b.storeKeyExists(h,g);if(a){b.writeDataHash(a,f);d=b.materializeRecord(a)}else{d=b.createRecord(h,f,g)}return d},_nestedRecordKey:0,generateIdForChild:function(a){}});SC.Record.mixin({ignoreUnknownProperties:NO,CLEAN:1,DIRTY:2,EMPTY:256,ERROR:4096,READY:512,READY_CLEAN:513,READY_DIRTY:514,READY_NEW:515,DESTROYED:1024,DESTROYED_CLEAN:1025,DESTROYED_DIRTY:1026,BUSY:2048,BUSY_LOADING:2052,BUSY_CREATING:2056,BUSY_COMMITTING:2064,BUSY_REFRESH:2080,BUSY_REFRESH_CLEAN:2081,BUSY_REFRESH_DIRTY:2082,BUSY_DESTROYING:2112,BAD_STATE_ERROR:SC.$error("Internal Inconsistency"),RECORD_EXISTS_ERROR:SC.$error("Record Exists"),NOT_FOUND_ERROR:SC.$error("Not found "),BUSY_ERROR:SC.$error("Busy"),GENERIC_ERROR:SC.$error("Generic Error"),isPolymorphic:NO,_nextChildKey:0,attr:function(a,b){return SC.RecordAttribute.attr(a,b)},fetch:function(b,a){return SC.FetchedAttribute.attr(b,a)},toMany:function(d,b){b=b||{};var c=b.nested||b.isNested;var a;this._throwUnlessRecordTypeDefined(d,"toMany");if(c){a=SC.ChildrenAttribute.attr(d,b)}else{a=SC.ManyAttribute.attr(d,b)}return a},toOne:function(d,b){b=b||{};var c=b.nested||b.isNested;var a;this._throwUnlessRecordTypeDefined(d,"toOne");if(c){a=SC.ChildAttribute.attr(d,b)}else{a=SC.SingleAttribute.attr(d,b)}return a},_throwUnlessRecordTypeDefined:function(b,a){if(!b){throw new Error("Attempted to create "+a+" attribute with undefined recordType. Did you forget to sc_require a dependency?")}},storeKeysById:function(){var c=this.superclass,b=SC.keyFor("storeKey",SC.guidFor(this)),a=this[b];if(!a){if(this.isPolymorphic&&c.isPolymorphic&&c!==SC.Record){a=this[b]=c.storeKeysById()}else{a=this[b]={}}}return a},storeKeyFor:function(c){var b=this.storeKeysById(),a=b[c];if(!a){a=SC.Store.generateStoreKey();SC.Store.idsByStoreKey[a]=c;SC.Store.recordTypesByStoreKey[a]=this;b[c]=a}return a},storeKeyExists:function(c){var b=this.storeKeysById(),a=b[c];return a},find:function(a,b){return a.find(this,b)},extend:function(){var a=SC.Object.extend.apply(this,arguments);if(SC.Query){SC.Query._scq_didDefineRecordType(a)}if(a.prototype.hasOwnProperty("isPolymorphic")){a.isPolymorphic=a.prototype.isPolymorphic;delete a.prototype.isPolymorphic}return a}});sc_require("data_sources/data_source");sc_require("models/record");SC.FixturesDataSource=SC.DataSource.extend({simulateRemoteResponse:NO,latency:50,cancel:function(a,b){return NO},fetch:function(a,b){if(b.get("location")!==SC.Query.LOCAL){SC.throw("SC.Fixture data source can only fetch local queries")}if(!b.get("recordType")&&!b.get("recordTypes")){SC.throw("SC.Fixture data source can only fetch queries with one or more record types")}if(this.get("simulateRemoteResponse")){this.invokeLater(this._fetch,this.get("latency"),a,b)}else{this._fetch(a,b)}},_fetch:function(a,c){var d=c.get("recordType"),b=c.get("recordTypes")||[d];b.forEach(function(e){if(SC.typeOf(e)===SC.T_STRING){e=SC.objectForPropertyPath(e)}if(e){this.loadFixturesFor(a,e)}},this);a.dataSourceDidFetchQuery(c)},retrieveRecords:function(a,c){var d=this.get("latency"),b=this.hasFixturesFor(c);if(!b){return b}if(this.get("simulateRemoteResponse")){this.invokeLater(this._retrieveRecords,d,a,c)}else{this._retrieveRecords(a,c)}return b},_retrieveRecords:function(a,b){b.forEach(function(d){var c=[],g=SC.Store.recordTypeFor(d),f=a.idFor(d),e=this.fixtureForStoreKey(a,d);c.push(d);a.dataSourceDidComplete(d,e,f)},this)},updateRecords:function(a,c,e){var d=this.get("latency"),b=this.hasFixturesFor(c);if(!b){return b}if(this.get("simulateRemoteResponse")){this.invokeLater(this._updateRecords,d,a,c)}else{this._updateRecords(a,c)}return b},_updateRecords:function(a,b){b.forEach(function(c){var d=a.readDataHash(c);this.setFixtureForStoreKey(a,c,d);a.dataSourceDidComplete(c)},this)},createRecords:function(a,b,d){var c=this.get("latency");if(this.get("simulateRemoteResponse")){this.invokeLater(this._createRecords,c,a,b)}else{this._createRecords(a,b)}return YES},_createRecords:function(a,b){b.forEach(function(e){var g=a.idFor(e),f=a.recordTypeFor(e),d=a.readDataHash(e),c=this.fixturesFor(f);if(!g){g=this.generateIdFor(f,d,a,e)}this._invalidateCachesFor(f,e,g);c[g]=d;a.dataSourceDidComplete(e,null,g)},this)},destroyRecords:function(a,c,e){var d=this.get("latency"),b=this.hasFixturesFor(c);if(!b){return b}if(this.get("simulateRemoteResponse")){this.invokeLater(this._destroyRecords,d,a,c)}else{this._destroyRecords(a,c)}return b},_destroyRecords:function(a,b){b.forEach(function(d){var f=a.idFor(d),e=a.recordTypeFor(d),c=this.fixturesFor(e);this._invalidateCachesFor(e,d,f);if(f){delete c[f]}a.dataSourceDidDestroy(d)},this)},loadFixturesFor:function(a,g,c){var b=[],e,d,f;e=this.fixturesFor(g);for(d in e){f=g.storeKeyFor(d);if(a.peekStatus(f)===SC.Record.EMPTY){b.push(e[d])}if(c){c.push(f)}}if(b&&b.length>0){a.loadRecords(g,b)}return this},generateIdFor:function(d,b,a,c){return"@id%@".fmt(SC.Store.generateStoreKey())},fixtureForStoreKey:function(a,c){var e=a.idFor(c),d=a.recordTypeFor(c),b=this.fixturesFor(d);return b?b[e]:null},setFixtureForStoreKey:function(a,d,c){var f=a.idFor(d),e=a.recordTypeFor(d),b=this.fixturesFor(e);this._invalidateCachesFor(e,d,f);b[f]=c;return this},fixturesFor:function(h){if(!this._fixtures){this._fixtures={}}var f=this._fixtures[SC.guidFor(h)];if(f){return f}var e=h?h.FIXTURES:null,b=e?e.length:0,c=h?h.prototype.primaryKey:"guid",a,d,g;this._fixtures[SC.guidFor(h)]=f={};for(a=0;a<b;a++){d=e[a];g=d[c];if(!g){g=this.generateIdFor(h,d)}f[g]=d}return f},fixturesLoadedFor:function(c){if(!this._fixtures){return NO}var a=[],b=this._fixtures[SC.guidFor(c)];return b?YES:NO},reset:function(){this._fixtures=null;return this},hasFixturesFor:function(b){var a=NO;b.forEach(function(d){if(a!==SC.MIXED_STATE){var e=SC.Store.recordTypeFor(d),c=e?e.FIXTURES:null;if(c&&c.length&&c.length>0){if(a===NO){a=YES}}else{if(a===YES){a=SC.MIXED_STATE}}}},this);return a},_invalidateCachesFor:function(d,b,c){var a=this._storeKeyCache;if(a){delete a[SC.guidFor(d)]}return this}});SC.Record.fixtures=SC.FixturesDataSource.create();SC.RelationshipSupport={_srs_inverseDidRelinquishRelationships:function(d,c,a,b){c.forEach(function(e){this._srs_inverseDidRelinquishRelationship(d,e,a,b)},this)},_srs_inverseDidRelinquishRelationship:function(b,a,f,i){var h=b.storeKeyFor(a),e=this.readDataHash(h),g=f.inverse,d=b.prototype;if(!e||!g){return}if(SC.instanceOf(d[g],SC.SingleAttribute)){delete e[g]}else{if(SC.instanceOf(d[g],SC.ManyAttribute)&&SC.typeOf(e[g])===SC.T_ARRAY){e[g].removeObject(i);var c=this.records[h];if(c){c.get(g)._records=null}}}this.pushRetrieve(b,a,e,undefined,true)},_srs_inverseDidAddRelationships:function(d,c,a,b){c.forEach(function(e){this._srs_inverseDidAddRelationship(d,e,a,b)},this)},_srs_inverseDidAddRelationship:function(b,a,i,k){var j=b.storeKeyFor(a),g=this.readDataHash(j),d=this.peekStatus(j),f=b.prototype,h=i.inverse,l=f[h],c=f[f.primaryKey],e=false;l=(l&&l.get&&l.get("key")||l.key)||h;if((d===SC.Record.EMPTY)&&(SC.typeOf(i.lazilyInstantiate)===SC.T_FUNCTION&&i.lazilyInstantiate()||SC.typeOf(i.lazilyInstantiate)!==SC.T_FUNCTION&&i.lazilyInstantiate)){if(!SC.none(c)&&c.typeClass&&SC.typeOf(c.typeClass())===SC.T_CLASS){e=true}g={};g[f.primaryKey]=a}if(!g||!h){return}if(SC.instanceOf(f[h],SC.SingleAttribute)){g[l]=k}else{if(SC.instanceOf(f[h],SC.ManyAttribute)){g[l]=g[l]||[];if(g[l].indexOf(k)<0){g[l].push(k)}}}this.pushRetrieve(b,a,g,undefined,!e)},_srs_pushIterator:function(d,b,i,f){var e=d.prototype,g,c,h,a;if(typeof i==="undefined"){i=d.storeKeyFor(b)}c=this.readDataHash(i)||{};for(h in e){g=e[h];if(g&&g.typeClass&&g.inverse&&g.isMaster){a=g.typeClass();if(SC.typeOf(a)!==SC.T_CLASS){continue}f.apply(this,[a,c,g,g.get&&g.get("key")||h])}}},pushDestroy:function(a,e,d,c){var b;this._srs_pushIterator(e,d,c,function(f,g,i,h){b=[g[h]||null].flatten().compact().uniq();this._srs_inverseDidRelinquishRelationships(f,b,i,d)});return a(e,d,c)}.enhance(),pushRetrieve:function(b,h,g,c,e,f){if(!f){var d,a;this._srs_pushIterator(h,g,e,function(i,j,l,k){a=[c[k]||null].flatten().compact().uniq();d=[j[k]||null].flatten().compact().uniq();d=d.filter(function(m){return a.indexOf(m)===-1});this._srs_inverseDidRelinquishRelationships(i,d,l,g);this._srs_inverseDidAddRelationships(i,a,l,g)})}e=e||h.storeKeyFor(g);return b(h,g,c,e)}.enhance()};sc_require("models/record");SC.RecordAttribute=SC.Object.extend({isRecordAttribute:YES,defaultValue:null,type:String,key:null,isRequired:NO,isEditable:YES,useIsoDate:YES,aggregate:NO,lazilyInstantiate:NO,typeClass:function(){var a=this.get("type");if(SC.typeOf(a)===SC.T_STRING){a=SC.requiredObjectForPropertyPath(a)}return a}.property("type").cacheable(),transform:function(){var a=this.get("typeClass")||String,c=SC.RecordAttribute.transforms,b;while(a&&!(b=c[SC.guidFor(a)])){if(a.superclass.hasOwnProperty("create")){a=a.superclass}else{a=SC.T_FUNCTION}}return b}.property("typeClass").cacheable(),toType:function(e,j,h){var c=this.get("transform"),g=this.get("typeClass"),b;if(c&&c.to){h=c.to(h,this,g,e,j);if(!SC.none(h)&&(b=c.observesChildren)){var d,f=b.length,a={record:e,key:j};for(d=0;d<f;d++){h.addObserver(b[d],this,this._SCRA_childObserver,a)}}}return h},_SCRA_childObserver:function(d,b,c,a){this.call(a.record,a.key,d);a.record.notifyPropertyChange(a.key)},fromType:function(a,c,e){var b=this.get("transform"),d=this.get("typeClass");if(b&&b.from){e=b.from(e,this,d,a,c)}return e},call:function(a,b,c){var d=this.get("key")||b,e;if((c!==undefined)&&this.get("isEditable")){e=this.fromType(a,b,c);a.writeAttribute(d,e)}c=a.readAttribute(d);if(SC.none(c)&&(c=this.get("defaultValue"))){if(typeof c===SC.T_FUNCTION){c=c(a,b,this)}}c=this.toType(a,b,c);return c},apply:function(b,a){return this.call.apply(b,a)},isProperty:YES,isCacheable:YES,dependentKeys:[],init:function(){arguments.callee.base.apply(this,arguments);this.cacheKey="__cache__recattr__"+SC.guidFor(this);this.lastSetValueKey="__lastValue__recattr__"+SC.guidFor(this)}});SC.RecordAttribute.mixin({attr:function(a,b){if(!b){b={}}if(!b.type){b.type=a||String}return this.create(b)},transforms:{},registerTransform:function(a,b){SC.RecordAttribute.transforms[SC.guidFor(a)]=b}});SC.RecordAttribute.registerTransform(Boolean,{to:function(a){return SC.none(a)?null:!!a}});SC.RecordAttribute.registerTransform(Number,{to:function(a){return SC.none(a)?null:Number(a)}});SC.RecordAttribute.registerTransform(String,{to:function(a){if(!(typeof a===SC.T_STRING)&&!SC.none(a)&&a.toString){a=a.toString()}return a}});SC.RecordAttribute.registerTransform(Array,{to:function(a){if(!SC.isArray(a)&&!SC.none(a)){a=[]}return a},observesChildren:["[]"]});SC.RecordAttribute.registerTransform(Object,{to:function(a){if(!(typeof a==="object")&&!SC.none(a)){a={}}return a}});SC.RecordAttribute.registerTransform(SC.Record,{to:function(e,a,d,c){var b=c.get("store");if(SC.none(e)||(e==="")){return null}else{return b.find(d,e)}},from:function(a){return a?a.get("id"):null}});SC.RecordAttribute.registerTransform(SC.T_FUNCTION,{to:function(e,a,d,c){d=d.apply(c);var b=c.get("store");return b.find(d,e)},from:function(a){return a.get("id")}});SC.RecordAttribute.registerTransform(Date,{to:function(i,a){if(SC.none(i)){return i}var c;i=i.toString()||"";if(a.get("useIsoDate")){var e="([0-9]{4})(-([0-9]{2})(-([0-9]{2})(T([0-9]{2}):([0-9]{2})(:([0-9]{2})(\\.([0-9]+))?)?(Z|(([-+])([0-9]{2}):([0-9]{2})))?)?)?)?",h=i.match(new RegExp(e)),g=0,b=new Date(h[1],0,1),f;if(h[3]){b.setMonth(h[3]-1)}if(h[5]){b.setDate(h[5])}if(h[7]){b.setHours(h[7])}if(h[8]){b.setMinutes(h[8])}if(h[10]){b.setSeconds(h[10])}if(h[12]){b.setMilliseconds(Number("0."+h[12])*1000)}if(h[14]){g=(Number(h[16])*60)+Number(h[17]);g*=((h[15]==="-")?1:-1)}g-=b.getTimezoneOffset();f=(Number(b)+(g*60*1000));c=new Date();c.setTime(Number(f))}else{c=new Date(Date.parse(i))}return c},_dates:{},_zeropad:function(a){return((a<0)?"-":"")+((a<10)?"0":"")+Math.abs(a)},from:function(b){if(SC.none(b)){return null}var a=this._dates[b.getTime()];if(a){return a}var d=this._zeropad,c=0-b.getTimezoneOffset()/60;c=(c===0)?"Z":"%@:00".fmt(d(c));this._dates[b.getTime()]=a="%@-%@-%@T%@:%@:%@%@".fmt(d(b.getFullYear()),d(b.getMonth()+1),d(b.getDate()),d(b.getHours()),d(b.getMinutes()),d(b.getSeconds()),c);return a}});if(SC.DateTime&&!SC.RecordAttribute.transforms[SC.guidFor(SC.DateTime)]){SC.RecordAttribute.registerTransform(SC.DateTime,{to:function(c,a){if(SC.none(c)||SC.instanceOf(c,SC.DateTime)){return c}if(a.get("useUnixTime")){if(SC.typeOf(c)===SC.T_STRING){c=parseInt(c)}if(isNaN(c)||SC.typeOf(c)!==SC.T_NUMBER){c=0}return SC.DateTime.create({milliseconds:c*1000,timezone:0})}if(SC.instanceOf(c,Date)){return SC.DateTime.create(c.getTime())}var b=a.get("format");return SC.DateTime.parse(c,b?b:SC.DateTime.recordFormat)},from:function(b,a){if(SC.none(b)){return b}if(a.get("useUnixTime")){return b.get("milliseconds")/1000}var c=a.get("format");return b.toFormattedString(c?c:SC.DateTime.recordFormat)}})}SC.RecordAttribute.registerTransform(SC.Set,{to:function(e,a,d,b,c){return SC.Set.create(e)},from:function(e,a,d,b,c){return e.toArray()},observesChildren:["[]"]});sc_require("models/record");sc_require("models/record_attribute");SC.ChildAttribute=SC.RecordAttribute.extend({isNestedRecordTransform:YES,toType:function(b,d,e){var c=null,a,f=this.get("typeClass");if(!b){throw new Error("SC.Child: Error during transform: Unable to retrieve parent record.")}if(!SC.none(e)){c=b.registerNestedRecord(e,d)}return c},fromType:function(b,e,f){var a,c,d;if(b){if(b.readAttribute(e)){b.unregisterNestedRecord(e)}if(SC.none(f)){b.writeAttribute(e,f);d=f}else{d=b.registerNestedRecord(f,e);if(d){a=d.get("storeKey");c=d.get("store");b.writeAttribute(e,c.readDataHash(a))}else{if(f){b.writeAttribute(e,f)}}}}return d},call:function(a,b,c){var d=this.get("key")||b;if(c!==undefined){c=this.fromType(a,b,c)}else{c=a.readAttribute(d);if(SC.none(c)&&(c=this.get("defaultValue"))){if(typeof c===SC.T_FUNCTION){c=this.defaultValue(a,b,this);if(a.attributes()){a.writeAttribute(d,c,true)}}}else{c=this.toType(a,b,c)}}return c}});sc_require("models/record");SC.ChildRecord=SC.Record.extend({});SC.ChildRecord.extend=function(){return SC.Record.extend.apply(this,arguments)};SC.ChildArray=SC.Object.extend(SC.Enumerable,SC.Array,{defaultRecordType:null,record:null,propertyName:null,store:function(){return this.getPath("record.store")}.property("record").cacheable(),storeKey:function(){return this.getPath("record.storeKey")}.property("record").cacheable(),readOnlyChildren:function(){return this.get("record").readAttribute(this.get("propertyName"))}.property(),editableChildren:function(){var a=this.get("store"),d=this.get("storeKey"),c=this.get("propertyName"),b,e;b=a.readEditableProperty(d,c);if(!b){e=a.readEditableDataHash(d);b=e[c]=[]}return b}.property(),length:function(){var a=this.get("readOnlyChildren");return a?a.length:0}.property("readOnlyChildren"),objectAt:function(b){var g=this._records,e=this.get("readOnlyChildren"),h,c,d=this.get("propertyName"),f=this.get("record"),a=e?e.length:0;if(!e){return undefined}if(g&&(c=g[b])){return c}if(b>=a){return undefined}h=e.objectAt(b);if(!h){return undefined}if(!g){this._records=g=[]}g[b]=c=f.registerNestedRecord(h,d,d+"."+b);return c},replace:function(p,c,l){var d=this.get("editableChildren"),m=l?(l.get?l.get("length"):l.length):0,n=this.get("record"),f=this.get("propertyName"),o=this.get("store"),b,q,j,r,a,e,g,h;if(!this._records){this._records=[]}a=this._processRecordsToHashes(l);j=this.get("defaultRecordType");r=j.storeKeysById();for(g=p,h=p+c;g<h;g++){e=this._records[g];if(!e){e=n.registerNestedRecord(d[g],f,f+"."+g)}else{this._records[g]=null}r[e.get("id")]=null}for(g=p+c,h=this._records.length;g<h;g++){e=this._records[g];if(e){o.unregisterChildFromParent(e.get("storeKey"));this._records[g]=null}}b=d.length-p;q=d.length-p-c+m;this.arrayContentWillChange(p,b,q);if(a.length===0){d.splice(p,c)}else{var k=[p,c].concat(a);d.splice.apply(d,k)}for(g=p,h=d.length;g<h;g++){this._records[g]=n.registerNestedRecord(d[g],f,f+"."+g)}this.arrayContentDidChange(p,b,q);this._sc_prevChildren=d;n.recordDidChange(f);return this},normalize:function(){this.forEach(function(a){if(a.normalize){a.normalize()}})},_processRecordsToHashes:function(d){var b,a,c=[];d.forEach(function(f,e){if(f.isNestedRecord){b=f.get("store");a=f.storeKey;c[e]=b.readDataHash(a)}else{c[e]=f}});return c},recordPropertyDidChange:function(d){var c=this.get("length"),b=this.get("readOnlyChildren"),e=b?b.length:0,a=this._sc_prevChildren;if(a===b){return}this._records=null;this.arrayContentDidChange(0,c,e);this._sc_prevChildren=b}});sc_require("models/record");sc_require("models/record_attribute");sc_require("models/child_attribute");sc_require("system/child_array");SC.ChildrenAttribute=SC.ChildAttribute.extend({toType:function(b,d,e){var g=this.get("key")||d,f=SC.keyFor("__kidsArray__",SC.guidFor(this)),c=b[f],h=this.get("typeClass"),a;if(!c){c=SC.ChildArray.create({record:b,propertyName:g,defaultRecordType:h});b[f]=c;a=b.get("relationships");if(!a){b.set("relationships",a=[])}a.push(c)}return c},fromType:function(b,e,f){var a,c,g=SC.keyFor("__kidsArray__",SC.guidFor(this)),d=b[g];if(b){b.writeAttribute(e,f);if(d){d=d.recordPropertyDidChange()}}return d}});sc_require("models/record");sc_require("models/record_attribute");SC.FetchedAttribute=SC.RecordAttribute.extend({paramValueKey:"link",paramOwnerKey:"owner",paramRelKey:"rel",queryKey:null,isEditable:NO,toType:function(d,i,g){var h=d.get("store");if(!h){return null}var b=this.get("paramValueKey"),a=this.get("paramOwnerKey"),f=this.get("paramRelKey"),e=this.get("queryKey")||this.get("typeClass"),c={};if(b){c[b]=g}if(a){c[a]=d}if(f){c[f]=this.get("key")||i}return h.find(e,c)},fromType:function(a,b,c){return c}});SC.ManyArray=SC.Object.extend(SC.Enumerable,SC.Array,{recordType:null,record:null,propertyName:null,manyAttribute:null,store:function(){return this.get("record").get("store")}.property("record").cacheable(),storeKey:function(){return this.get("record").get("storeKey")}.property("record").cacheable(),supportNewRecords:NO,readOnlyStoreIds:function(){return this.get("record").readAttribute(this.get("propertyName"))}.property(),editableStoreIds:function(){var a=this.get("store"),d=this.get("storeKey"),c=this.get("propertyName"),b,e;b=a.readEditableProperty(d,c);if(!b){e=a.readEditableDataHash(d);b=e[c]=[]}return b}.property(),isEditable:function(){var a=this.manyAttribute;return a?a.get("isEditable"):NO}.property("manyAttribute").cacheable(),inverse:function(){var a=this.manyAttribute;return a?a.get("inverse"):null}.property("manyAttribute").cacheable(),isMaster:function(){var a=this.manyAttribute;return a?a.get("isMaster"):null}.property("manyAttribute").cacheable(),orderBy:function(){var a=this.manyAttribute;return a?a.get("orderBy"):null}.property("manyAttribute").cacheable(),length:function(){var a=this.get("readOnlyStoreIds");return a?a.get("length"):0}.property("readOnlyStoreIds"),objectAt:function(g){var e=this._records,a=this.get("readOnlyStoreIds"),f=this.get("store"),b=this.get("recordType"),c=a?a.length:0,i,d,h;if(!a||!f){return undefined}if(e&&(d=e[g])){return d}if(g>=c){return undefined}h=a.objectAt(g);if(!h){return undefined}if(!e){this._records=e=[]}if(typeof h===SC.T_STRING&&h.indexOf("_sc_id_placeholder_")===0){i=h.replace("_sc_id_placeholder_","")}else{i=f.storeKeyFor(b,h)}if(f.readStatus(i)===SC.Record.EMPTY){f.retrieveRecord(b,null,i)}e[g]=d=f.materializeRecord(i);return d},replace:function(r,e,o){var c=this.get("editableStoreIds"),p=o?(o.get?o.get("length"):o.length):0,q=this.get("record"),g=this.get("propertyName"),n=this.get("supportNewRecords"),a,b,h,l,k,j;if(!this._records){this._records=[]}a=[];for(j=0;j<p;j++){var f=o.objectAt(j),d=f.get("id");if(SC.none(d)){if(n){a[j]="_sc_id_placeholder_"+f.get("storeKey")}else{throw new Error("Developer Error: Attempted to add a record without a primary key to a to-many relationship (%@). The record must have a real id or be given a temporary id before it can be used. ".fmt(g))}}else{a[j]=d}}h=this.get("inverse");if(h&&e>0){b=SC.ManyArray._toRemove;if(b){SC.ManyArray._toRemove=null}else{b=[]}for(j=0;j<e;j++){b[j]=this.objectAt(r+j)}}this.arrayContentWillChange(r,e,p);if(a.length===0){c.splice(r,e);this._records.splice(r,e)}else{var m=[r,e].concat(a);c.splice.apply(c,m);m=[r,e].concat(new Array(a.length));this._records.splice.apply(this._records,m)}if(h){for(j=0;j<e;j++){k=b[j];l=k?k[h]:null;if(l&&l.inverseDidRemoveRecord){l.inverseDidRemoveRecord(k,h,q,g)}}if(b){b.length=0;if(!SC.ManyArray._toRemove){SC.ManyArray._toRemove=b}}for(j=0;j<p;j++){k=o.objectAt(j);l=k?k[h]:null;if(l&&l.inverseDidAddRecord){l.inverseDidAddRecord(k,h,q,g)}}}this.arrayContentDidChange(r,e,p);this._sc_prevStoreIds=c;if(q&&(!h||this.get("isMaster"))){q.recordDidChange(g)}return this},removeInverseRecord:function(c){if(!c){return this}var e=c.get("id"),d=this.get("editableStoreIds"),a=(d&&e)?d.indexOf(e):-1,b;if(a>=0){this.arrayContentWillChange(a,1,0);d.splice(a,1);if(this._records){this._records.splice(a,1)}this.arrayContentDidChange(a,1,0);this._sc_prevStoreIds=d;if(this.get("isMaster")&&(b=this.get("record"))){b.recordDidChange(this.get("propertyName"))}}return this},addInverseRecord:function(d){if(!d){return this}var f=this.get("editableStoreIds"),h=this.get("orderBy"),b=f.get("length"),a,c,g,e;if(h){a=this._findInsertionLocation(d,0,b,h);g=f.length-a;e=f.length-a+1}else{a=b;g=0;e=1}this.arrayContentWillChange(a,g,e);f.splice(a,0,d.get("id"));if(this._records){this._records.splice(a,0,null)}this.arrayContentDidChange(a,g,e);this._sc_prevStoreIds=f;if(this.get("isMaster")&&(c=this.get("record"))){c.recordDidChange(this.get("propertyName"))}return this},_findInsertionLocation:function(g,d,c,f){var b=d+Math.floor((c-d)/2),e=this.objectAt(b),a=this._compare(g,e,f);if(a<0){if(b===0){return b}else{return this._findInsertionLocation(g,0,b-1,f)}}else{if(a>0){if(b>=c){return b+1}else{return this._findInsertionLocation(g,b+1,c,f)}}else{return b}}},_compare:function(f,e,i){var h=SC.typeOf(i),g,d,c;if(h===SC.T_FUNCTION){g=i(f,e)}else{if(h===SC.T_STRING){g=SC.compare(f,e)}else{c=i.get("length");g=0;for(d=0;g===0&&d<c;d++){g=SC.compare(f,e)}}}return g},updateNewRecordId:function(c){var b=this.get("editableStoreIds"),a;a=b.indexOf("_sc_id_placeholder_"+c.get("storeKey"));if(a>=0){b.replace(a,1,[c.get("id")])}},unknownProperty:function(b,c){var a;if(SC.typeOf(b)===SC.T_STRING){a=this.reducedProperty(b,c)}return a===undefined?arguments.callee.base.apply(this,arguments):a},init:function(){arguments.callee.base.apply(this,arguments);this.recordPropertyDidChange()},recordPropertyDidChange:function(c){if(c&&!c.contains(this.get("propertyName"))){return this}var a=this.get("length"),e=this.get("readOnlyStoreIds"),d=e?e.length:0,b=this._sc_prevStoreIds;if(e===b){return}this._records=null;this.arrayContentDidChange(0,a,d);this._sc_prevStoreIds=e}});sc_require("models/record");sc_require("models/record_attribute");sc_require("system/many_array");SC.ManyAttribute=SC.RecordAttribute.extend({inverse:null,isMaster:YES,orderBy:null,supportNewRecords:true,toType:function(c,h,g){var f=this.get("typeClass"),e=this.get("supportNewRecords"),a=this.get("key")||h,b=SC.keyFor("__manyArray__",SC.guidFor(this)),d=c[b],i;if(!d){d=SC.ManyArray.create({recordType:f,record:c,propertyName:a,manyAttribute:this,supportNewRecords:e});c[b]=d;i=c.get("relationships");if(!i){c.set("relationships",i=[])}i.push(d)}return d},fromType:function(b,e,f){var c=[];if(!SC.isArray(f)){throw new Error("Expects toMany attribute to be an array")}var a=f.get("length");for(var d=0;d<a;d++){c[d]=f.objectAt(d).get("id")}return c},inverseDidRemoveRecord:function(a,b,c,d){var e=a.get(b);if(e){e.removeInverseRecord(c)}},inverseDidAddRecord:function(a,b,c,d){var e=a.get(b);if(e){e.addInverseRecord(c)}}});sc_require("models/record");sc_require("models/record_attribute");SC.SingleAttribute=SC.RecordAttribute.extend({inverse:null,isMaster:YES,call:function(c,i,b){var a=this.get("key")||i,h,g,j,f,e,d;if(b!==undefined&&this.get("isEditable")){h=this.get("inverse");if(h){j=this._scsa_call(c,i)}d=this.fromType(c,i,b);c.writeAttribute(a,d,!this.get("isMaster"));e=b;if(h&&(j!==b)){if(j&&(f=j[h])){f.inverseDidRemoveRecord(j,h,c,i)}if(b&&(f=b[h])){f.inverseDidAddRecord(b,h,c,i)}}}else{e=this._scsa_call(c,i,b)}return e},_scsa_call:SC.RecordAttribute.prototype.call,inverseDidRemoveRecord:function(c,f,g,h){var b=this.get("inverse"),e=this._scsa_call(c,f),d=this.get("isMaster"),a;c.writeAttribute(this.get("key")||f,null,!d);c.notifyPropertyChange(f);if((e!==g)||(h!==b)){if(e&&(a=e[b])){a.inverseDidRemoveRecord(e,b,c,f)}}},inverseDidAddRecord:function(a,h,c,g){var e=this.get("inverse"),i=this._scsa_call(a,h),f=this.get("isMaster"),d,b;b=this.fromType(a,h,c);a.writeAttribute(this.get("key")||h,b,!f);a.notifyPropertyChange(h);if((i!==c)||(g!==e)){if(i&&(d=i[e])){d.inverseDidRemoveRecord(i,e,a,h)}}}});sc_require("models/record");SC.Store=SC.Object.extend({name:null,nestedStores:null,dataSource:null,isNested:NO,commitRecordsAutomatically:NO,from:function(a){this.set("dataSource",a);return this},_getDataSource:function(){var a=this.get("dataSource");if(typeof a===SC.T_STRING){a=SC.requiredObjectForPropertyPath(a);if(a.isClass){a=a.create()}this.set("dataSource",a)}return a},cascade:function(c){var d;d=new Array(arguments.length);for(var b=0,a=d.length;b<a;b++){d[b]=arguments[b]}c=SC.CascadeDataSource.create({dataSources:d});return this.from(c)},chain:function(b,c){if(!b){b={}}b.parentStore=this;if(c){if(SC.typeOf(c)!=="class"){throw new Error("%@ is not a valid class".fmt(c))}if(!SC.kindOf(c,SC.NestedStore)){throw new Error("%@ is not a type of SC.NestedStore".fmt(c))}}else{c=SC.NestedStore}b.childRecords=this.childRecords?SC.clone(this.childRecords):{};b.parentRecords=this.parentRecords?SC.clone(this.parentRecords):{};var a=c.create(b),d=this.nestedStores;if(!d){d=this.nestedStores=[]}d.push(a);return a},chainAutonomousStore:function(a,d){var b=a?SC.clone(a):{};var c=this._getDataSource();b.dataSource=c;return this.chain(b,d)},willDestroyNestedStore:function(a){if(this.nestedStores){this.nestedStores.removeObject(a)}return this},hasNestedStore:function(a){while(a&&(a!==this)){a=a.get("parentStore")}return a===this},dataHashes:null,statuses:null,revisions:null,editables:null,changelog:null,recordErrors:null,queryErrors:null,childRecords:null,parentRecords:null,storeKeyEditState:function(a){var b=this.editables;return(b&&b[a])?SC.Store.EDITABLE:SC.Store.LOCKED},readDataHash:function(a){return this.dataHashes[a]},readEditableDataHash:function(b){var a=this.dataHashes[b];if(!a){return a}var c=this.editables;if(!c){c=this.editables=[]}if(!c[b]){c[b]=1;a=this.dataHashes[b]=SC.clone(a,YES)}return a},readEditableProperty:function(c,a){var e=this.readEditableDataHash(c),d=this.editables[c],b=e[a];if(d===1){d=this.editables[c]={}}if(!d[a]){b=e[a];if(b&&b.isCopyable){b=e[a]=b.copy(YES)}d[a]=YES}return b},writeDataHash:function(b,d,a){if(d){this.dataHashes[b]=d}if(a){this.statuses[b]=a}var c=this.editables;if(!c){c=this.editables=[]}c[b]=1;this._updateChildRecordHashes(b,d,a);return this},_updateChildRecordHashes:function(i,d,c){var e={};if(!SC.none(this.parentRecords)){var a=this.parentRecords[i]||{},b;for(var h in a){if(a.hasOwnProperty(h)){if(d){var g=a[h];g=g.split(".");if(g.length>1){b=d[g[0]][g[1]]}else{b=d[g[0]]}if(!e[d[g[0]]]){this.writeDataHash(h,b,c)}if(g.length>1&&!e[d[g[0]]]){e[d[g[0]]]=true;var f=this;this.invokeLast(function(){f.records[i].get(g[0]).forEach(function(j){})})}}else{this.writeDataHash(h,null,c)}}}}},removeDataHash:function(b,a){this.dataHashes[b]=null;this.statuses[b]=a||SC.Record.EMPTY;var c=this.editables;if(c){c[b]=0}return this},readStatus:function(a){this.readDataHash(a);return this.statuses[a]||SC.Record.EMPTY},peekStatus:function(a){return this.statuses[a]||SC.Record.EMPTY},writeStatus:function(d,a){var c=this,b;b=this.writeDataHash(d,null,a);this._propagateToChildren(d,function(e){c.writeStatus(e,a)});return b},dataHashDidChange:function(e,b,a,h){if(!b){b=SC.Store.generateStoreKey()}var c,f,g,i;c=SC.typeOf(e)===SC.T_ARRAY;if(c){f=e.length}else{f=1;i=e}var d=this;for(g=0;g<f;g++){if(c){i=e[g]}this.revisions[i]=b;this._notifyRecordPropertyChange(i,a,h);this._propagateToChildren(i,function(j){d.dataHashDidChange(j,null,a,h)})}return this},_notifyRecordPropertyChange:function(m,e,l){var a=this.records,g=this.get("nestedStores"),h=SC.Store,c,b,f,k,j,d,n;f=g?g.length:0;for(k=0;k<f;k++){j=g[k];d=j.peekStatus(m);b=j.storeKeyEditState(m);if(b===h.INHERITED){j._notifyRecordPropertyChange(m,e,l)}else{if(d&SC.Record.BUSY){if(j.get("hasChanges")){h.CHAIN_CONFLICT_ERROR.throw()}j.reset()}}}var i=this.recordPropertyChanges;if(!i){i=this.recordPropertyChanges={storeKeys:SC.CoreSet.create(),records:SC.CoreSet.create(),hasDataChanges:SC.CoreSet.create(),propertyForStoreKeys:{}}}i.storeKeys.add(m);if(a&&(c=a[m])){i.records.push(m);if(!e){i.hasDataChanges.push(m)}if(l){if(!(n=i.propertyForStoreKeys[m])){n=i.propertyForStoreKeys[m]=SC.CoreSet.create()}if(n!=="*"){n.add(l)}}else{i.propertyForStoreKeys[m]="*"}}this.invokeOnce(this.flush);return this},flush:function(){if(!this.recordPropertyChanges){return this}var h=this.recordPropertyChanges,g=h.storeKeys,i=h.hasDataChanges,a=h.records,f=h.propertyForStoreKeys,d=SC.CoreSet.create(),c,b,e,j;g.forEach(function(k){if(a.contains(k)){e=i.contains(k)?NO:YES;c=this.records[k];j=f?f[k]:null;if(j==="*"){j=null}a.remove(k);if(c){c.storeDidChangeProperties(e,j)}}b=SC.Store.recordTypeFor(k);d.add(b)},this);if(g.get("length")>0){this._notifyRecordArrays(g,d)}g.clear();i.clear();a.clear();this.recordPropertyChanges.propertyForStoreKeys={};return this},reset:function(){this.dataHashes={};this.revisions={};this.statuses={};this.records={};this.childRecords={};this.parentRecords={};this.chainedChanges=this.locks=this.editables=null;this.changelog=null;this.recordErrors=null;this.queryErrors=null;var e=this.get("dataSource");if(e&&e.reset){e.reset()}var b=this.records,c;if(b){for(c in b){if(!b.hasOwnProperty(c)){continue}this._notifyRecordPropertyChange(parseInt(c,10),NO)}}var d,a=this.get("recordArrays");if(a){while((d=a.pop())){d.destroy()}a.clear();this.set("recordArrays",null)}this.set("hasChanges",NO)},commitChangesFromNestedStore:function(j,t,d){if(!d&&j.get("conflictedStoreKeys")){SC.Store.CHAIN_CONFLICT_ERROR.throw()}var p=t.length,o,f,c,l,e,b,h,a,q,r,g,m,k;b=this.revisions;c=this.dataHashes;l=this.statuses;e=this.editables;h=this.parentRecords?this.parentRecords:this.parentRecords={};a=this.childRecords?this.childRecords:this.childRecords={};if(!e){e=this.editables=[]}q=j.dataHashes;g=j.revisions;r=j.statuses;m=j.parentRecords||{};k=j.childRecords||{};for(o=0;o<p;o++){f=t[o];c[f]=q[f];l[f]=r[f];b[f]=g[f];h[f]=m[f];a[f]=k[f];e[f]=0;this._notifyRecordPropertyChange(f,NO)}var n=this.changelog,s=j.changelog;if(s){if(!n){n=this.changelog=SC.CoreSet.create()}n.addEach(s)}this.changelog=n;if(!this.get("parentStore")){this.flush()}return this},find:function(b,a){if(SC.typeOf(b)===SC.T_STRING){b=SC.objectForPropertyPath(b)}if((arguments.length===1)&&!(b&&b.get&&b.get("isRecord"))){if(!b){throw new Error("SC.Store#find() must pass recordType or query")}if(!b.isQuery){b=SC.Query.local(b)}return this._findQuery(b,YES,YES)}else{return this._findRecord(b,a)}},_findQuery:function(f,a,e){var b=this._scst_recordArraysByQuery,d=SC.guidFor(f),c,g;if(!b){b=this._scst_recordArraysByQuery={}}c=b[d];if(!c&&a){b[d]=c=SC.RecordArray.create({store:this,query:f});g=this.get("recordArrays");if(!g){this.set("recordArrays",g=SC.Set.create())}g.add(c);if(e){this.refreshQuery(f)}}this.flush();return c},_findRecord:function(c,b){var a;if(c&&c.get&&c.get("isRecord")){a=c.get("storeKey")}else{a=b?c.storeKeyFor(b):null}if(a&&(this.peekStatus(a)===SC.Record.EMPTY)){a=this.retrieveRecord(c,b)}return a?this.materializeRecord(a):null},recordArrayWillDestroy:function(b){var a=this._scst_recordArraysByQuery,c=this.get("recordArrays");if(a){delete a[SC.guidFor(b.get("query"))]}if(c){c.remove(b)}return this},refreshQuery:function(d){if(!d){throw new Error("refreshQuery() requires a query")}var a=this._scst_recordArraysByQuery,c=a?a[SC.guidFor(d)]:null,b=this._getDataSource();if(b&&b.fetch){if(c){c.storeWillFetchQuery(d)}b.fetch.call(b,this,d)}return this},_notifyRecordArrays:function(b,a){var c=this.get("recordArrays");if(!c){return this}c.forEach(function(d){if(d){d.storeDidChangeStoreKeys(b,a)}},this);return this},recordsFor:function(f){var d=[],a=f.storeKeysById(),e,c,b;for(e in a){c=a[e];if(this.readStatus(c)!==SC.RECORD_EMPTY){d.push(c)}}if(d.length>0){b=SC.RecordArray.create({store:this,storeKeys:d})}else{b=d}return b},_CACHED_REC_ATTRS:{},_CACHED_REC_INIT:function(){},materializeRecord:function(e){var b=this.records,d,f,c;if(!b){b=this.records={}}d=b[e];if(d){return d}f=SC.Store.recordTypeFor(e);if(!f){return null}c=this._CACHED_REC_ATTRS;c.storeKey=e;c.store=this;var a=f.prototype._object_init;f.prototype._object_init=this._CACHED_REC_INIT;d=b[e]=f.create();f.prototype._object_init=d._object_init=a;d._object_init([c]);return d},createRecord:function(d,f,b){var m,l,n,e,k=SC.Record,h,j,i;f=(f?f:{});if(!b&&(m=d.prototype.primaryKey)){b=f[m];j=d.prototype[m]?d.prototype[m].defaultValue:null;if(!b&&SC.typeOf(j)===SC.T_FUNCTION){b=f[m]=j()}}n=b?d.storeKeyFor(b):SC.Store.generateStoreKey();e=this.readStatus(n);if((e&k.BUSY)||(e&k.READY)||(e===k.DESTROYED_DIRTY)){(b?k.RECORD_EXISTS_ERROR:k.BAD_STATE_ERROR).throw()}else{if(!b&&(e===SC.DESTROYED_CLEAN||e===SC.ERROR)){k.BAD_STATE_ERROR.throw()}}this.writeDataHash(n,f,k.READY_NEW);SC.Store.replaceRecordTypeFor(n,d);this.dataHashDidChange(n);i=this.materializeRecord(n);l=d.prototype;for(var a in l){var g=l[a];if(g&&g.isRecordAttribute){var c=g.key||a;if(!f.hasOwnProperty(c)){if(f.hasOwnProperty(a)){f[c]=f[a];delete f[a]}else{j=g.defaultValue;if(j){if(SC.typeOf(j)===SC.T_FUNCTION){f[c]=SC.copy(j(i,c),YES)}else{f[c]=SC.copy(j,YES)}}}}else{if(c!==a&&f.hasOwnProperty(a)){delete f[a]}}}}h=this.changelog;if(!h){h=SC.Set.create()}h.add(n);this.changelog=h;if(this.get("commitRecordsAutomatically")){this.invokeLast(this.commitRecords)}if(i){i.propagateToAggregates()}return i},createRecords:function(d,i,a){var g=[],c,b,e,f=i.length,h;e=SC.typeOf(d)===SC.T_ARRAY;if(!e){c=d}for(h=0;h<f;h++){if(e){c=d[h]||SC.Record}b=a?a[h]:undefined;g.push(this.createRecord(c,i[h],b))}return g},unloadRecord:function(g,f,e,c){if(e===undefined){e=g.storeKeyFor(f)}var b=this.readStatus(e),a=SC.Record;c=c||a.EMPTY;if((b===a.BUSY_DESTROYING)||(b&a.DESTROYED)){return this}else{if(b&a.BUSY){a.BUSY_ERROR.throw()}else{b=c}}this.removeDataHash(e,b);this.dataHashDidChange(e);delete this.records[e];var d=this;this._propagateToChildren(e,function(h){d.unregisterChildFromParent(h)});if(this.parentRecords){delete this.parentRecords[e]}return this},unloadRecords:function(d,a,g,e){var h,f,i,b,c,j;if(g===undefined){f=SC.typeOf(d)===SC.T_ARRAY;if(!f){c=d}if(a===undefined){h=f?d.length:1;for(i=0;i<h;i++){if(f){c=d[i]}g=this.storeKeysFor(c);this.unloadRecords(undefined,undefined,g,e)}}else{h=a.length;for(i=0;i<h;i++){if(f){c=d[i]||SC.Record}b=a?a[i]:undefined;this.unloadRecord(c,b,undefined,e)}}}else{h=g.length;for(i=0;i<h;i++){j=g?g[i]:undefined;this.unloadRecord(undefined,undefined,j,e)}}return this},destroyRecord:function(g,f,e){if(e===undefined){e=g.storeKeyFor(f)}var b=this.readStatus(e),c,a=SC.Record;if((b===a.BUSY_DESTROYING)||(b&a.DESTROYED)){return this}else{if(b===a.EMPTY){a.NOT_FOUND_ERROR.throw()}else{if(b&a.BUSY){a.BUSY_ERROR.throw()}else{if(b===a.READY_NEW){b=a.DESTROYED_CLEAN;this.removeDataHash(e,b)}else{b=a.DESTROYED_DIRTY}}}}this.writeStatus(e,b);this.dataHashDidChange(e);c=this.changelog;if(!c){c=this.changelog=SC.Set.create()}if(b&a.DIRTY){c.add(e)}else{c.remove(e)}this.changelog=c;if(this.get("commitRecordsAutomatically")){this.invokeLast(this.commitRecords)}var d=this;this._propagateToChildren(e,function(h){d.destroyRecord(null,null,h)});return this},destroyRecords:function(d,a,f){var g,e,h,b,c,i;if(f===undefined){g=a.length;e=SC.typeOf(d)===SC.T_ARRAY;if(!e){c=d}for(h=0;h<g;h++){if(e){c=d[h]||SC.Record}b=a?a[h]:undefined;this.destroyRecord(c,b,undefined)}}else{g=f.length;for(h=0;h<g;h++){i=f?f[h]:undefined;this.destroyRecord(undefined,undefined,i)}}return this},registerChildToParent:function(c,f,e){var h,b,d,g,a;b=this.childRecords||{};h=this.parentRecords||{};d=b[f];if(d){g=h[d];delete g[f]}a=h[c]||{};a[f]=e||YES;h[c]=a;b[f]=c;this.writeStatus(f,this.statuses[c]);this.childRecords=b;this.parentRecords=h},unregisterChildFromParent:function(e){var a,b,d,g=this.recordTypeFor(e),f=this.idFor(e),c=this;a=this.childRecords;this.removeDataHash(e);if(this.records){delete this.records[e]}if(a){b=a[e];if(b){delete this.parentRecords[b][e]}delete a[e]}delete SC.Store.idsByStoreKey[e];d=g.storeKeysById();delete d[f];this._propagateToChildren(e,function(h){c.unregisterChildFromParent(h)})},materializeParentRecord:function(c){var b,a;if(SC.none(c)){return null}a=this.childRecords;b=a?this.childRecords[c]:null;if(SC.none(b)){return null}return this.materializeRecord(b)},parentStoreKeyExists:function(b){if(SC.none(b)){return}var a=this.childRecords||{};return a[b]},_propagateToChildren:function(d,c){if(SC.none(this.parentRecords)){return}var b=this.parentRecords[d]||{};if(SC.none(c)){return}for(var a in b){if(b.hasOwnProperty(a)){c(parseInt(a,10))}}},recordDidChange:function(h,g,f,d,c){if(f===undefined){f=h.storeKeyFor(g)}var b=this.readStatus(f),e,a=SC.Record;if(b&a.BUSY){a.BUSY_ERROR.throw()}else{if(!(b&a.READY)){a.NOT_FOUND_ERROR.throw()}else{if(b!==a.READY_NEW){this.writeStatus(f,a.READY_DIRTY)}}}this.dataHashDidChange(f,null,c,d);e=this.changelog;if(!e){e=this.changelog=SC.Set.create()}e.add(f);this.changelog=e;if(this.get("commitRecordsAutomatically")){this.invokeLast(this.commitRecords)}return this},recordsDidChange:function(d,a,f){var g,e,h,b,c,i;if(f===undefined){g=a.length;e=SC.typeOf(d)===SC.T_ARRAY;if(!e){c=d}for(h=0;h<g;h++){if(e){c=d[h]||SC.Record}b=a?a[h]:undefined;i=f?f[h]:undefined;this.recordDidChange(c,b,i)}}else{g=f.length;for(h=0;h<g;h++){i=f?f[h]:undefined;this.recordDidChange(undefined,undefined,i)}}return this},retrieveRecords:function(f,m,b,c,q){var l=this._getDataSource(),h=SC.typeOf(f)===SC.T_ARRAY,k=SC.typeOf(q)===SC.T_ARRAY,o=(!b)?m.length:b.length,r=[],p=SC.Store.generateStoreKey(),g=SC.Record,a,j,e,n,i,d;if(!h){a=f}for(j=0;j<o;j++){if(b){e=b[j]}else{if(h){a=f[j]}e=a.storeKeyFor(m[j])}d=k?q[j]:q;n=this.readStatus(e);if((n===g.EMPTY)||(n===g.ERROR)||(n===g.DESTROYED_CLEAN)){this.writeStatus(e,g.BUSY_LOADING);this.dataHashDidChange(e,p,YES);r.push(e);this._setCallbackForStoreKey(e,d,k,b)}else{if(c){if(n&g.READY){this.writeStatus(e,g.BUSY_REFRESH|(n&3));this.dataHashDidChange(e,p,YES);r.push(e);this._setCallbackForStoreKey(e,d,k,b)}else{if((n===g.BUSY_DESTROYING)||(n===g.BUSY_CREATING)||(n===g.BUSY_COMMITTING)){g.BUSY_ERROR.throw()}else{if(n===g.DESTROYED_DIRTY){g.BAD_STATE_ERROR.throw()}}}}}}i=NO;if(l){i=l.retrieveRecords.call(l,this,r,m)}if(!i){o=r.length;p=SC.Store.generateStoreKey();for(j=0;j<o;j++){e=r[j];n=this.readStatus(e);if(n===g.BUSY_LOADING){this.writeStatus(e,g.ERROR);this.dataHashDidChange(e,p,YES)}else{if(n&g.BUSY_REFRESH){this.writeStatus(e,g.READY|(n&3));this.dataHashDidChange(e,p,YES)}}}r.length=0}return r},_TMP_RETRIEVE_ARRAY:[],_callback_queue:{},_setCallbackForStoreKey:function(d,e,b,c){var a=this._callback_queue;if(b){a[d]={callback:e,otherKeys:c}}else{a[d]=e}},_retrieveCallbackForStoreKey:function(c){var a=this._callback_queue,e=a[c],d,b;if(e){if(SC.typeOf(e)===SC.T_FUNCTION){e.call();delete a[c]}else{if(SC.typeOf(e)===SC.T_HASH){e.completed=YES;b=e.storeKeys;b.forEach(function(f){if(!a[f].completed){d=YES}});if(d){e.callback.call();b.forEach(function(f){delete a[f]})}}}}},_cancelCallback:function(b){var a=this._callback_queue;if(a[b]){delete a[b]}},retrieveRecord:function(g,f,b,c,e){var d=this._TMP_RETRIEVE_ARRAY,a;if(b){d[0]=b;b=d;f=null}else{d[0]=f;f=d}a=this.retrieveRecords(g,f,b,c,e);d.length=0;return a[0]},refreshRecord:function(d,c,a,b){return !!this.retrieveRecord(d,c,a,YES,b)},refreshRecords:function(b,c,d,e){var a=this.retrieveRecords(b,c,d,YES,e);return a&&a.length>0},commitRecords:function(f,n,b,q,t){var m=this._getDataSource(),h=SC.typeOf(f)===SC.T_ARRAY,k=SC.typeOf(t)===SC.T_ARRAY,c=[],j=[],l=[],r=SC.Store.generateStoreKey(),g=SC.Record,a,i,e,o,s,p,d;if(!f&&!n&&!b){b=this.changelog}p=b?b.get("length"):(n?n.get("length"):0);for(i=0;i<p;i++){if(b){e=b[i]}else{if(h){a=f[i]||SC.Record}else{a=f}e=a.storeKeyFor(n[i])}d=k?t[i]:t;o=this.readStatus(e);if(o===g.ERROR){g.NOT_FOUND_ERROR.throw()}else{if(o===g.READY_NEW){this.writeStatus(e,g.BUSY_CREATING);this.dataHashDidChange(e,r,YES);c.push(e);this._setCallbackForStoreKey(e,d,k,b)}else{if(o===g.READY_DIRTY){this.writeStatus(e,g.BUSY_COMMITTING);this.dataHashDidChange(e,r,YES);j.push(e);this._setCallbackForStoreKey(e,d,k,b)}else{if(o===g.DESTROYED_DIRTY){this.writeStatus(e,g.BUSY_DESTROYING);this.dataHashDidChange(e,r,YES);l.push(e);this._setCallbackForStoreKey(e,d,k,b)}else{if(o===g.DESTROYED_CLEAN){this.dataHashDidChange(e,r,YES)}}}}}}if(m&&(p>0||q)){s=m.commitRecords.call(m,this,c,j,l,q)}if(s&&!f&&!n){if(b===this.changelog){this.changelog=null}else{this.changelog.removeEach(b)}}return s},commitRecord:function(g,f,b,c,e){var d=this._TMP_RETRIEVE_ARRAY,a;if(f===undefined&&b===undefined){return NO}if(b!==undefined){d[0]=b;b=d;f=null}else{d[0]=f;f=d}a=this.commitRecords(g,f,b,c,e);d.length=0;return a},cancelRecords:function(e,b,i){var a=this._getDataSource(),g=SC.typeOf(e)===SC.T_ARRAY,k=SC.Record,j=[],f,h,l,c,d,m;h=(i===undefined)?b.length:i.length;for(l=0;l<h;l++){if(g){d=e[l]||SC.Record}else{d=e||SC.Record}c=b?b[l]:undefined;if(i===undefined){m=d.storeKeyFor(c)}else{m=i?i[l]:undefined}if(m){f=this.readStatus(m);if((f===k.EMPTY)||(f===k.ERROR)){k.NOT_FOUND_ERROR.throw()}j.push(m);this._cancelCallback(m)}}if(a){a.cancel.call(a,this,j)}return this},cancelRecord:function(e,d,b){var c=this._TMP_RETRIEVE_ARRAY,a;if(b!==undefined){c[0]=b;b=c;d=null}else{c[0]=d;d=c}a=this.cancelRecords(e,d,b);c.length=0;return this},loadRecord:function(g,d,f){var a=SC.Record,c,b,e;g=g||SC.Record;b=g.prototype.primaryKey;f=f||d[b];c=e=g.storeKeyFor(f);if(this.readStatus(e)&a.BUSY){this.dataSourceDidComplete(e,d,f)}else{this.pushRetrieve(g,f,d,e)}return c},loadRecords:function(d,k,a){var f=SC.typeOf(d)===SC.T_ARRAY,g=k.get("length"),h=[],c,b,j,i,e;if(!f){c=d||SC.Record;j=c.prototype.primaryKey}for(i=0;i<g;i++){e=k.objectAt(i);if(f){c=d.objectAt(i)||SC.Record;j=c.prototype.primaryKey}b=(a)?a.objectAt(i):e[j];h[i]=this.loadRecord(c,e,b)}return h},readError:function(a){var b=this.recordErrors;return b?b[a]:undefined},readQueryError:function(a){var b=this.queryErrors;return b?b[SC.guidFor(a)]:undefined},dataSourceDidCancel:function(c){var b=this.readStatus(c),a=SC.Record;if(!(b&a.BUSY)){a.BAD_STATE_ERROR.throw()}switch(b){case a.BUSY_LOADING:b=a.EMPTY;break;case a.BUSY_CREATING:b=a.READY_NEW;break;case a.BUSY_COMMITTING:b=a.READY_DIRTY;break;case a.BUSY_REFRESH_CLEAN:b=a.READY_CLEAN;break;case a.BUSY_REFRESH_DIRTY:b=a.READY_DIRTY;break;case a.BUSY_DESTROYING:b=a.DESTROYED_DIRTY;break;default:a.BAD_STATE_ERROR.throw()}this.writeStatus(c,b);this.dataHashDidChange(c,null,YES);this._cancelCallback(c);return this},dataSourceDidComplete:function(g,f,e){var c=this.readStatus(g),b=SC.Record,d;if(!(c&b.BUSY)){b.BAD_STATE_ERROR.throw()}if(c===b.BUSY_DESTROYING){b.BAD_STATE_ERROR.throw()}else{c=b.READY_CLEAN}this.writeStatus(g,c);if(f){this.writeDataHash(g,f,c)}if(e){SC.Store.replaceIdFor(g,e)}d=f||e?NO:YES;this.dataHashDidChange(g,null,d);var a=this.materializeRecord(g);if(a!==null){if(e){a.propertyDidChange("id")}a.notifyPropertyChange("status")}this._retrieveCallbackForStoreKey(g);return this},dataSourceDidDestroy:function(d){var c=this.readStatus(d),b=SC.Record;if(!(c&b.BUSY)){b.BAD_STATE_ERROR.throw()}else{c=b.DESTROYED_CLEAN}this.removeDataHash(d,c);this.dataHashDidChange(d);var a=this.materializeRecord(d);if(a!==null){a.notifyPropertyChange("status")}this._retrieveCallbackForStoreKey(d);return this},dataSourceDidError:function(e,d){var c=this.readStatus(e),f=this.recordErrors,b=SC.Record;if(!(c&b.BUSY)){b.BAD_STATE_ERROR.throw()}else{c=b.ERROR}if(d&&d.isError){if(!f){f=this.recordErrors=[]}f[e]=d}this.writeStatus(e,c);this.dataHashDidChange(e,null,YES);var a=this.materializeRecord(e);if(a){a.notifyPropertyChange("status")}this._retrieveCallbackForStoreKey(e);return this},pushRetrieve:function(g,f,d,e){var c=SC.Record,b;if(e===undefined){e=g.storeKeyFor(f)}b=this.readStatus(e);if(b===c.EMPTY||b===c.ERROR||b===c.READY_CLEAN||b===c.DESTROYED_CLEAN){b=c.READY_CLEAN;if(d===undefined){this.writeStatus(e,b)}else{this.writeDataHash(e,d,b)}if(f&&this.idFor(e)!==f){SC.Store.replaceIdFor(e,f);var a=this.materializeRecord(e);a.propertyDidChange("id")}this.dataHashDidChange(e);return e}return NO},pushDestroy:function(e,d,c){var b=SC.Record,a;if(c===undefined){c=e.storeKeyFor(d)}a=this.readStatus(c);if(a===b.EMPTY||a===b.ERROR||a===b.READY_CLEAN||a===b.DESTROYED_CLEAN){a=b.DESTROYED_CLEAN;this.removeDataHash(c,a);this.dataHashDidChange(c);return c}return NO},pushError:function(g,f,c,d){var b=SC.Record,a,e=this.recordErrors;if(d===undefined){d=g.storeKeyFor(f)}a=this.readStatus(d);if(a===b.EMPTY||a===b.ERROR||a===b.READY_CLEAN||a===b.DESTROYED_CLEAN){a=b.ERROR;if(c&&c.isError){if(!e){e=this.recordErrors=[]}e[d]=c}this.writeStatus(d,a);this.dataHashDidChange(d,null,YES);return d}return NO},loadQueryResults:function(b,a){return this.dataSourceDidFetchQuery(b,a)},dataSourceDidFetchQuery:function(c,a){var b=this._findQuery(c,YES,NO);if(b&&c.get("isRemote")){b.set("storeKeys",a)}return this._scstore_dataSourceDidFetchQuery(c)},_scstore_dataSourceDidFetchQuery:function(c){var b=this._findQuery(c,NO,NO),a=this.get("nestedStores"),d=a?a.get("length"):0;if(b){b.storeDidFetchQuery(c)}while(--d>=0){a[d]._scstore_dataSourceDidFetchQuery(c)}return this},dataSourceDidCancelQuery:function(a){return this._scstore_dataSourceDidCancelQuery(a,YES)},_scstore_dataSourceDidCancelQuery:function(d,a){var c=this._findQuery(d,a,NO),b=this.get("nestedStores"),e=b?b.get("length"):0;if(c){c.storeDidCancelQuery(d)}while(--e>=0){b[e]._scstore_dataSourceDidCancelQuery(d,NO)}return this},dataSourceDidErrorQuery:function(b,a){var c=this.queryErrors;if(a&&a.isError){if(!c){c=this.queryErrors={}}c[SC.guidFor(b)]=a}return this._scstore_dataSourceDidErrorQuery(b,YES)},_scstore_dataSourceDidErrorQuery:function(d,a){var c=this._findQuery(d,a,NO),b=this.get("nestedStores"),e=b?b.get("length"):0;if(c){c.storeDidErrorQuery(d)}while(--e>=0){b[e]._scstore_dataSourceDidErrorQuery(d,NO)}return this},init:function(){arguments.callee.base.apply(this,arguments);this.reset()},toString:function(){var b=this.get("name");if(!b){return arguments.callee.base.apply(this,arguments)}else{var a=arguments.callee.base.apply(this,arguments);return"%@ (%@)".fmt(b,a)}},idFor:function(a){return SC.Store.idFor(a)},recordTypeFor:function(a){return SC.Store.recordTypeFor(a)},storeKeyFor:function(b,a){return b.storeKeyFor(a)},storeKeyExists:function(b,a){return b.storeKeyExists(a)},storeKeysFor:function(f){var a=[],e=f&&f.isEnumerable,c,d,b;if(!this.statuses){return a}for(d in SC.Store.recordTypesByStoreKey){c=SC.Store.recordTypesByStoreKey[d];if(e){b=f.contains(c)}else{b=c===f}if(b&&this.statuses[d]){a.push(parseInt(d,10))}}return a},storeKeys:function(){var a=[],b;if(!this.statuses){return a}for(b in this.statuses){if(this.statuses[b]!==SC.Record.EMPTY){a.push(parseInt(b,10))}}return a},statusString:function(a){var b=this.materializeRecord(a);return b.statusString()}});SC.Store.mixin({CHAIN_CONFLICT_ERROR:SC.$error("Nested Store Conflict"),NO_PARENT_STORE_ERROR:SC.$error("Parent Store Required"),NESTED_STORE_UNSUPPORTED_ERROR:SC.$error("Unsupported In Nested Store"),NESTED_STORE_RETRIEVE_DIRTY_ERROR:SC.$error("Cannot Retrieve Dirty Record in Nested Store"),EDITABLE:"editable",LOCKED:"locked",INHERITED:"inherited",idsByStoreKey:[],recordTypesByStoreKey:{},queriesByStoreKey:[],nextStoreKey:1,generateStoreKey:function(){return this.nextStoreKey++},idFor:function(a){return this.idsByStoreKey[a]},queryFor:function(a){return this.queriesByStoreKey[a]},recordTypeFor:function(a){return this.recordTypesByStoreKey[a]},replaceIdFor:function(c,a){var d=this.idsByStoreKey[c],e,b;if(d!==a){e=this.recordTypeFor(c);if(!e){throw new Error("replaceIdFor: storeKey %@ does not exist".fmt(c))}this.idsByStoreKey[c]=a;b=e.storeKeysById();delete b[d];b[a]=c}return this},replaceRecordTypeFor:function(a,b){this.recordTypesByStoreKey[a]=b;return this}});sc_require("system/store");SC.NestedStore=SC.Store.extend({hasChanges:NO,parentStore:null,isNested:YES,lockOnRead:YES,locks:null,chainedChanges:null,find:function(a){if(a&&a.isQuery&&a.get("location")!==SC.Query.LOCAL){throw new Error("SC.Store#find() can only accept LOCAL queries in nested stores")}return arguments.callee.base.apply(this,arguments)},commitChanges:function(b){if(this.get("hasChanges")){var a=this.get("parentStore");a.commitChangesFromNestedStore(this,this.get("chainedChanges"),b)}this.reset();return this},conflictedStoreKeys:function(){var d=null;if(this.get("hasChanges")){var a=this.get("parentStore"),k=this.locks,j=a.revisions;if(k&&j){var f=this.get("chainedChanges");for(var b=0,c=f.length;b<c;b++){var h=f[b],g=k[h]||1,e=j[h]||1;if(g<e){if(!d){d=[]}d.push(h)}}}}return d}.property("chainedChanges").cacheable(),commitSuccessfulChanges:function(b){var a=this.get("chainedChanges");if(this.get("hasChanges")&&a){var m=this.dataHashes,k=this.revisions,d=this.statuses,h=this.editables,l=this.locks;var f=a.filter(function(i){var n=this.readStatus(i);return n===SC.Record.READY_CLEAN||n===SC.Record.DESTROYED_CLEAN},this);var c=this.get("parentStore");c.commitChangesFromNestedStore(this,f,b);for(var e=0,g=f.get("length");e<g;e++){var j=f.objectAt(e);if(m&&m.hasOwnProperty(j)){delete m[j]}if(k&&k.hasOwnProperty(j)){delete k[j]}if(h){delete h[j]}if(l){delete l[j]}if(d&&d.hasOwnProperty(j)){delete d[j]}a.remove(j)}if(f.length>0){this.notifyPropertyChange("chainedChanges")}}return this},discardChanges:function(){var c,f;if((c=this.records)&&(f=this.locks)){var b=this.get("parentStore"),h=b.revisions;var g=this.revisions,e,d,a;for(e in c){if(!c.hasOwnProperty(e)){continue}if(!(d=f[e])){continue}a=h[e];if((a!==d)||(g[e]>a)){this._notifyRecordPropertyChange(parseInt(e,10))}}}this.reset();this.flush();return this},destroy:function(){this.discardChanges();var a=this.get("parentStore");if(a){a.willDestroyNestedStore(this)}arguments.callee.base.apply(this,arguments);return this},reset:function(){var a=this.get("parentStore");if(!a){SC.Store.NO_PARENT_STORE_ERROR.throw()}this.dataHashes=SC.beget(a.dataHashes);this.revisions=SC.beget(a.revisions);this.statuses=SC.beget(a.statuses);this.childRecords=a.childRecords?SC.beget(a.childRecords):{};this.parentRecords=a.parentRecords?SC.beget(a.parentRecords):{};this.set("hasChanges",false);this.chainedChanges=this.locks=this.editables=null;this.changelog=null},refreshQuery:function(b){var a=this.get("parentStore");if(a){a.refreshQuery(b)}return this},readError:function(b){var a=this.get("parentStore");return a?a.readError(b):null},readQueryError:function(b){var a=this.get("parentStore");return a?a.readQueryError(b):null},chainAutonomousStore:function(a,b){SC.Store.NESTED_STORE_UNSUPPORTED_ERROR.throw()},storeKeyEditState:function(b){var c=this.editables,a=this.locks;return(c&&c[b])?SC.Store.EDITABLE:(a&&a[b])?SC.Store.LOCKED:SC.Store.INHERITED},_lock:function(j){var k=this.locks,f,h,d,a,l,g,e,i;if(k&&k[j]){return this}if(!k){k=this.locks=[]}h=this.editables;if(h){h[j]=0}var b=this.get("parentStore"),c;while(b&&(c=b.storeKeyEditState(j))===SC.Store.INHERITED){b=b.get("parentStore")}if(b&&c===SC.Store.EDITABLE){d=this.childRecords[j];if(d){this._lock(d);a=this.parentRecords[d];if(a){l=a[j];g=l?SC.tupleForPropertyPath(l,this.dataHashes[d]):null;if(g){e=g[0];i=g[1]}this.dataHashes[j]=e&&i?e[i]:null}}else{this.dataHashes[j]=SC.clone(b.dataHashes[j],YES)}if(!h){h=this.editables=[]}h[j]=1}else{this.dataHashes[j]=b.dataHashes[j]}this.statuses[j]=this.statuses[j];f=this.revisions[j]=this.revisions[j];k[j]=f||1;return this},readDataHash:function(a){if(this.get("lockOnRead")){this._lock(a)}return this.dataHashes[a]},readEditableDataHash:function(a){this._lock(a);return arguments.callee.base.apply(this,arguments)},writeDataHash:function(d,f,b){var c=this.locks,g=NO,a;if(f){this.dataHashes[d]=f}else{this._lock(d);g=YES}if(b){this.statuses[d]=b}else{if(!g){this.statuses[d]=(this.statuses[d]||SC.Record.READY_NEW)}}if(!g){a=this.revisions[d]=this.revisions[d];if(!c){c=this.locks=[]}if(!c[d]){c[d]=a||1}}var e=this.editables;if(!e){e=this.editables=[]}e[d]=1;this._updateChildRecordHashes(d,f,b);return this},removeDataHash:function(c,a){var b=this.locks;if(!b){b=this.locks=[]}if(!b[c]){b[c]=this.revisions[c]||1}return arguments.callee.base.apply(this,arguments)},dataHashDidChange:function(e,b,a,j){if(!b){b=SC.Store.generateStoreKey()}var c,f,h,k;c=SC.typeOf(e)===SC.T_ARRAY;if(c){f=e.length}else{f=1;k=e}var g=this.get("chainedChanges");if(!g){g=this.chainedChanges=SC.Set.create()}var d=this,i=false;for(h=0;h<f;h++){if(c){k=e[h]}this._lock(k);this.revisions[k]=b;if(!g.contains(k)){g.add(k);i=true}this._notifyRecordPropertyChange(k,a,j);this._propagateToChildren(k,function(l){d.dataHashDidChange(l,null,a,j)})}this.setIfChanged("hasChanges",YES);if(i){this.notifyPropertyChange("chainedChanges")}return this},commitChangesFromNestedStore:function(e,f,a){arguments.callee.base.apply(this,arguments);var b=this.get("parentStore"),h=b.revisions,c;var k=this.locks,g=this.get("chainedChanges"),d,j;if(!k){k=this.locks=[]}if(!g){g=this.chainedChanges=SC.Set.create()}d=f.length;for(c=0;c<d;c++){j=f[c];if(!k[j]){k[j]=h[j]||1}g.add(j)}this.setIfChanged("hasChanges",g.get("length")>0);this.notifyPropertyChange("chainedChanges");this.flush();return this},queryFor:function(c,a,b){return this.get("parentStore").queryFor(c,a,b)},retrieveRecords:function(f,m,b,c,r){var a=this.get("parentStore"),k,d,o=(!b)?m.length:b.length,i=SC.Record,n;if(c){for(k=0;k<o;k++){d=!b?a.storeKeyFor(f,m[k]):b[k];n=this.peekStatus(d);if(n&i.DIRTY){SC.Store.NESTED_STORE_RETRIEVE_DIRTY_ERROR.throw()}else{var g=this.dataHashes,j=this.revisions,h=this.statuses,l=this.editables,q=this.locks;var e=NO;var p=NO;if(g&&g.hasOwnProperty(d)){delete g[d];e=YES}if(j&&j.hasOwnProperty(d)){delete j[d];e=YES}if(l){delete l[d]}if(q){delete q[d]}if(h&&h.hasOwnProperty(d)){delete h[d];if(!e){p=YES}e=YES}if(e){this._notifyRecordPropertyChange(d,p)}}}}return a.retrieveRecords(f,m,b,c,r)},commitRecords:function(a,b,c){if(this.get("dataSource")){return arguments.callee.base.apply(this,arguments)}else{SC.Store.NESTED_STORE_UNSUPPORTED_ERROR.throw()}},commitRecord:function(c,b,a){if(this.get("dataSource")){return arguments.callee.base.apply(this,arguments)}else{SC.Store.NESTED_STORE_UNSUPPORTED_ERROR.throw()}},cancelRecords:function(a,b,c){if(this.get("dataSource")){return arguments.callee.base.apply(this,arguments)}else{SC.Store.NESTED_STORE_UNSUPPORTED_ERROR.throw()}},cancelRecord:function(c,b,a){if(this.get("dataSource")){return arguments.callee.base.apply(this,arguments)}else{SC.Store.NESTED_STORE_UNSUPPORTED_ERROR.throw()}},dataSourceDidCancel:function(a){if(this.get("dataSource")){return arguments.callee.base.apply(this,arguments)}else{SC.Store.NESTED_STORE_UNSUPPORTED_ERROR.throw()}},dataSourceDidComplete:function(c,b,a){if(this.get("dataSource")){return arguments.callee.base.apply(this,arguments)}else{SC.Store.NESTED_STORE_UNSUPPORTED_ERROR.throw()}},dataSourceDidDestroy:function(a){if(this.get("dataSource")){return arguments.callee.base.apply(this,arguments)}else{SC.Store.NESTED_STORE_UNSUPPORTED_ERROR.throw()}},dataSourceDidError:function(b,a){if(this.get("dataSource")){return arguments.callee.base.apply(this,arguments)}else{SC.Store.NESTED_STORE_UNSUPPORTED_ERROR.throw()}},pushRetrieve:function(d,c,a,b){if(this.get("dataSource")){return arguments.callee.base.apply(this,arguments)}else{SC.Store.NESTED_STORE_UNSUPPORTED_ERROR.throw()}},pushDestroy:function(c,b,a){if(this.get("dataSource")){return arguments.callee.base.apply(this,arguments)}else{SC.Store.NESTED_STORE_UNSUPPORTED_ERROR.throw()}},pushError:function(d,c,a,b){if(this.get("dataSource")){return arguments.callee.base.apply(this,arguments)}else{SC.Store.NESTED_STORE_UNSUPPORTED_ERROR.throw()}}});sc_require("models/record");SC.RecordArray=SC.Object.extend(SC.Enumerable,SC.Array,{store:null,query:null,storeKeys:null,_prevStoreKeys:null,status:SC.Record.EMPTY,isEditable:function(){var a=this.get("query");return a?a.get("isEditable"):YES}.property("query").cacheable(),length:function(){this.flush();var a=this.get("storeKeys");return a?a.get("length"):0}.property("storeKeys").cacheable(),_scra_records:null,objectAt:function(a){this.flush();var f=this._scra_records,e=this.get("storeKeys"),b=this.get("store"),d,c;if(!e||!b){return undefined}if(f&&(c=f[a])){return c}if(!f){this._scra_records=f=[]}d=e.objectAt(a);if(d){if(b.peekStatus(d)===SC.Record.EMPTY){b.retrieveRecord(null,null,d)}f[a]=c=b.materializeRecord(d)}return c},forEach:function(h,d){this.flush();var e=this._scra_records,b=this.get("storeKeys"),f=this.get("store"),c=b?b.get("length"):0,g,i,a;if(!b||!f){return this}if(!e){e=this._scra_records=[]}if(!d){d=this}for(g=0;g<c;g++){a=e[g];if(!a){a=e[g]=f.materializeRecord(b.objectAt(g))}h.call(d,a,g,this)}return this},replace:function(b,g,f){this.flush();var e=this.get("storeKeys"),a=f?(f.get?f.get("length"):f.length):0,c,d;if(!e){throw new Error("Unable to edit an SC.RecordArray that does not have its storeKeys property set.")}if(!this.get("isEditable")){SC.RecordArray.NOT_EDITABLE.throw()}d=[];for(c=0;c<a;c++){d[c]=f.objectAt(c).get("storeKey")}e.replace(b,g,d);return this},contains:function(a){return this.indexOf(a)>=0},indexOf:function(b,a){if(!SC.kindOf(b,SC.Record)){return -1}this.flush();var d=b.get("storeKey"),c=this.get("storeKeys");return c?c.indexOf(d,a):-1},lastIndexOf:function(b,a){if(!SC.kindOf(b,SC.Record)){return -1}this.flush();var d=b.get("storeKey"),c=this.get("storeKeys");return c?c.lastIndexOf(d,a):-1},add:function(a){if(!SC.kindOf(a,SC.Record)){return this}if(this.indexOf(a)<0){this.pushObject(a)}return this},remove:function(a){if(!SC.kindOf(a,SC.Record)){return this}this.removeObject(a);return this},find:function(a,b,c){if(b&&b.isQuery){return this.get("store").find(b.queryWithScope(this))}else{return a.apply(this,SC.$A(arguments).slice(1))}}.enhance(),refresh:function(){this.get("store").refreshQuery(this.get("query"));return this},reload:function(){this.flush(YES);return this},destroy:function(){if(!this.get("isDestroyed")){this.get("store").recordArrayWillDestroy(this)}arguments.callee.base.apply(this,arguments)},storeWillFetchQuery:function(c){var b=this.get("status"),a=SC.Record;if((b===a.EMPTY)||(b===a.ERROR)){b=a.BUSY_LOADING}if(b&a.READY){b=a.BUSY_REFRESH}this.setIfChanged("status",b);return this},storeDidFetchQuery:function(a){this.setIfChanged("status",SC.Record.READY_CLEAN);return this},storeDidCancelQuery:function(c){var b=this.get("status"),a=SC.Record;if(b===a.BUSY_LOADING){b=a.EMPTY}else{if(b===a.BUSY_REFRESH){b=a.READY_CLEAN}}this.setIfChanged("status",b);return this},storeDidErrorQuery:function(a){this.setIfChanged("status",SC.Record.ERROR);return this},storeDidChangeStoreKeys:function(b,a){var c=this.get("query");if(c.get("location")!==SC.Query.LOCAL){return this}if(!c.containsRecordTypes(a)){return this}var d=this._scq_changedStoreKeys;if(!d){d=this._scq_changedStoreKeys=SC.IndexSet.create()}d.addEach(b);this.set("needsFlush",YES);if(this.get("storeKeys")){this.flush()}return this},flush:function(a){if(this._insideFlush){this.set("needsFlush",YES);return this}if(!this.get("needsFlush")&&!a){return this}this.set("needsFlush",NO);var j=this.get("query"),m=this.get("store");if(!m||!j||j.get("location")!==SC.Query.LOCAL){return this}this._insideFlush=YES;var h=this.get("storeKeys"),f=this._scq_changedStoreKeys,g=NO,k=SC.Record,o=[],b=new Date(),d,e,c,p,n,i;var l=h;if(h&&!a){if(f){f.forEach(function(q){if(o.length>0||new Date()-b>SC.RecordArray.QUERY_MATCHING_THRESHOLD){o.push(q);return}e=m.peekStatus(q);if(!(e&k.EMPTY)&&!((e&k.DESTROYED)||(e===k.BUSY_DESTROYING))){d=m.materializeRecord(q);i=!!(d&&j.contains(d))}else{i=NO}if(i){if(h.indexOf(q)<0){if(!g){h=h.copy()}h.pushObject(q)}}else{if(h.indexOf(q)>=0){if(!g){h=h.copy()}h.removeObject(q)}}},this);g=YES}}else{if(n=j.get("scope")){p=n.flush().get("storeKeys")}else{if(c=j.get("expandedRecordTypes")){p=SC.IndexSet.create();c.forEach(function(q){p.addEach(m.storeKeysFor(q))})}}h=[];p.forEach(function(q){if(o.length>0||new Date()-b>SC.RecordArray.QUERY_MATCHING_THRESHOLD){o.push(q);return}e=m.peekStatus(q);if(!(e&k.EMPTY)&&!((e&k.DESTROYED)||(e===k.BUSY_DESTROYING))){d=m.materializeRecord(q);if(d&&j.contains(d)){h.push(q)}}});g=YES}if(o.length>0){this.invokeNext(function(){if(!this||this.get("isDestroyed")){return}this.set("needsFlush",YES);this._scq_changedStoreKeys=SC.IndexSet.create().addEach(o);this.flush()})}if(f){f.clear()}this._insideFlush=NO;if(g){if(h&&(h===l)){h=h.copy()}h=SC.Query.orderStoreKeys(h,j,m);if(SC.compare(l,h)!==0){this.set("storeKeys",SC.clone(h))}}return this},needsFlush:YES,isError:function(){return !!(this.get("status")&SC.Record.ERROR)}.property("status").cacheable(),errorValue:function(){return this.get("isError")?SC.val(this.get("errorObject")):null}.property("isError").cacheable(),errorObject:function(){if(this.get("isError")){var a=this.get("store");return a.readQueryError(this.get("query"))||SC.Record.GENERIC_ERROR}else{return null}}.property("isError").cacheable(),propertyWillChange:function(b){if(b==="storeKeys"){var c=this.get("storeKeys");var a=c?c.get("length"):0;this.arrayContentWillChange(0,a,0)}return arguments.callee.base.apply(this,arguments)},_storeKeysDidChange:function(){var d=this.get("storeKeys");var c=this._prevStoreKeys,a,b;if(d===c){return}if(c){c.removeArrayObservers({target:this,willChange:this.arrayContentWillChange,didChange:this._storeKeysContentDidChange});a=c.get("length")}else{a=0}this._prevStoreKeys=d;if(d){d.addArrayObservers({target:this,willChange:this.arrayContentWillChange,didChange:this._storeKeysContentDidChange});b=d.get("length")}else{b=0}this._storeKeysContentDidChange(0,a,b)}.observes("storeKeys"),addArrayObservers:function(){this.flush();return SC.Array.addArrayObservers.apply(this,arguments)},_storeKeysContentDidChange:function(c,a,b){if(this._scra_records){this._scra_records.length=0}this.arrayContentDidChange(c,a,b)},init:function(){arguments.callee.base.apply(this,arguments);this._storeKeysDidChange()}});SC.RecordArray.mixin({NOT_EDITABLE:SC.$error("SC.RecordArray is not editable"),QUERY_MATCHING_THRESHOLD:100});Function.prototype.handleEvents=function(){this.isEventHandler=YES;this.events=arguments;return this};Function.prototype.stateObserves=function(){this.isStateObserveHandler=YES;this.args=new Array(arguments.length);for(var b=0,a=this.args.length;b<a;b++){this.args[b]=arguments[b]}return this};SC.StatechartDelegate={isStatechartDelegate:YES,statechartUpdateLocationForState:function(b,a,c){SC.routes.set("location",a)},statechartAcquireLocationForState:function(a,b){return SC.routes.get("location")},statechartBindStateToRoute:function(b,d,a,c){SC.routes.add(a,d,c)},statechartShouldStateHandleTriggeredRoute:function(a,c,b){return YES},statechartStateCancelledHandlingTriggeredRoute:function(a,c,b){}};SC.StatePathMatcher=SC.Object.extend({state:null,expression:null,tokens:null,init:function(){arguments.callee.base.apply(this,arguments);this._parseExpression()},_parseExpression:function(){var h=this.expression?this.expression.split("."):[],b=h.length,f=0,c,e=null,d,g=[];for(;f<b;f+=1){c=h[f];if(c.indexOf("~")>=0){c=c.split("~");if(c.length>2){throw new Error("Invalid use of '~' at part %@".fmt(f))}d=SC.StatePathMatcher._ExpandToken.create({start:c[0],end:c[1]})}else{if(c==="this"){if(g.length>0){throw new Error("Invalid use of 'this' at part %@".fmt(f))}d=SC.StatePathMatcher._ThisToken.create()}else{d=SC.StatePathMatcher._BasicToken.create({value:c})}}d.owner=this;g.push(d)}this.set("tokens",g);var a=SC.clone(g);this._chain=e=a.pop();while(d=a.pop()){e.nextToken=d;e=d}},lastPart:function(){var c=this.get("tokens"),a=c?c.length:0,b=a>0?c[a-1]:null;return b.get("lastPart")}.property("tokens").cacheable(),match:function(a){this._stack=a.split(".");if(SC.empty(a)||SC.typeOf(a)!==SC.T_STRING){return NO}return this._chain.match()},_pop:function(){this._lastPopped=this._stack.pop();return this._lastPopped}});SC.StatePathMatcher._Token=SC.Object.extend({type:null,owner:null,nextToken:null,lastPart:null,match:function(){return NO}});SC.StatePathMatcher._BasicToken=SC.StatePathMatcher._Token.extend({type:"basic",value:null,lastPart:function(){return this.value}.property("value").cacheable(),match:function(){var a=this.owner._pop(),b=this.nextToken;if(this.value!==a){return NO}return b?b.match():YES}});SC.StatePathMatcher._ExpandToken=SC.StatePathMatcher._Token.extend({type:"expand",start:null,end:null,lastPart:function(){return this.end}.property("end").cacheable(),match:function(){var d=this.start,a=this.end,b,c=this.nextToken;b=this.owner._pop();if(b!==a){return NO}while(b=this.owner._pop()){if(b===d){return c?c.match():YES}}return NO}});SC.StatePathMatcher._ThisToken=SC.StatePathMatcher._Token.extend({type:"this",lastPart:"this",match:function(){var e=this.owner.state,c=e.get("substates"),a=c.length,d=0,b;b=this.owner._lastPopped;if(!b||this.owner._stack.length!==0){return NO}for(;d<a;d+=1){if(c[d].get("name")===b){return YES}}return NO}});SC.Async=SC.Object.extend({func:null,arg1:null,arg2:null,tryToPerform:function(d){var c=this.get("func"),b=this.get("arg1"),a=this.get("arg2"),e=SC.typeOf(c);if(e===SC.T_STRING){d.tryToPerform(c,b,a)}else{if(e===SC.T_FUNCTION){c.apply(d,[b,a])}}}});SC.Async.mixin({perform:function(c,b,a){return SC.Async.create({func:c,arg1:b,arg2:a})}});SC.State=SC.Object.extend({name:null,parentState:null,historyState:null,initialSubstate:null,substatesAreConcurrent:NO,substates:null,statechart:null,stateIsInitialized:NO,currentSubstates:null,enteredSubstates:null,representRoute:null,owner:function(){var c=this.get("statechart"),b=c?c.get("statechartOwnerKey"):null,a=c?c.get(b):null;return a?a:c}.property().cacheable(),statechartDelegate:function(){return this.getPath("statechart.statechartDelegate")}.property().cacheable(),location:function(b,c){var d=this.get("statechart"),a=this.get("statechartDelegate");if(c!==undefined){a.statechartUpdateLocationForState(d,c,this)}return a.statechartAcquireLocationForState(d,this)}.property().idempotent(),init:function(){arguments.callee.base.apply(this,arguments);this._registeredEventHandlers={};this._registeredStringEventHandlers={};this._registeredRegExpEventHandlers=[];this._registeredStateObserveHandlers={};this._registeredSubstatePaths={};this._registeredSubstates=[];this._isEnteringState=NO;this._isExitingState=NO;var a=this.get("statechart"),b=a?a.get("statechartOwnerKey"):null;if(a){a.addObserver(b,this,"_statechartOwnerDidChange")}},destroy:function(){var b=this.get("statechart"),c=b?b.get("statechartOwnerKey"):null;if(b){b.removeObserver(c,this,"_statechartOwnerDidChange")}var a=this.get("substates");if(a){a.forEach(function(d){d.destroy()})}this._teardownAllStateObserveHandlers();this.set("substates",null);this.set("currentSubstates",null);this.set("enteredSubstates",null);this.set("parentState",null);this.set("historyState",null);this.set("initialSubstate",null);this.set("statechart",null);this.notifyPropertyChange("owner");this._registeredEventHandlers=null;this._registeredStringEventHandlers=null;this._registeredRegExpEventHandlers=null;this._registeredStateObserveHandlers=null;this._registeredSubstatePaths=null;this._registeredSubstates=null;arguments.callee.base.apply(this,arguments)},initState:function(){if(this.get("stateIsInitialized")){return}this._registerWithParentStates();this._setupRouteHandling();var h=null,g=null,b=null,i=[],f=NO,e=this.get("initialSubstate"),c=this.get("substatesAreConcurrent"),d=NO,a=null;this.set("substates",i);if(SC.kindOf(e,SC.HistoryState)&&e.isClass){a=this.createSubstate(e);this.set("initialSubstate",a);if(SC.none(a.get("defaultState"))){this.stateLogError("Initial substate is invalid. History state requires the name of a default state to be set");this.set("initialSubstate",null);a=null}}for(h in this){g=this[h];d=SC.typeOf(g)===SC.T_FUNCTION;if(d&&g.isEventHandler){this._registerEventHandler(h,g);continue}if(d&&g.isStateObserveHandler){this._registerStateObserveHandler(h,g);continue}if(d&&g.statePlugin){g=g.apply(this)}if(SC.kindOf(g,SC.State)&&g.isClass&&this[h]!==this.constructor){b=this._addSubstate(h,g);if(h===e){this.set("initialSubstate",b);f=YES}else{if(a&&a.get("defaultState")===h){a.set("defaultState",b);f=YES}}}}if(!SC.none(e)&&!f){this.stateLogError("Unable to set initial substate %@ since it did not match any of state's %@ substates".fmt(e,this))}if(i.length===0){if(!SC.none(e)){this.stateLogWarning("Unable to make %@ an initial substate since state %@ has no substates".fmt(e,this))}}else{if(i.length>0){b=this._addEmptyInitialSubstateIfNeeded();if(!b&&e&&c){this.set("initialSubstate",null);this.stateLogWarning("Can not use %@ as initial substate since substates are all concurrent for state %@".fmt(e,this))}}}this.notifyPropertyChange("substates");this.set("currentSubstates",[]);this.set("enteredSubstates",[]);this.set("stateIsInitialized",YES)},_setupRouteHandling:function(){var b=this.get("representRoute"),c=this.get("statechart"),a=this.get("statechartDelegate");if(SC.none(b)){return}if(this.get("isConcurrentState")){this.stateLogError("State %@ cannot handle route '%@' since state is concurrent".fmt(this,b));return}a.statechartBindStateToRoute(c,this,b,this.routeTriggered)},routeTriggered:function(f){if(this._isEnteringState){return}var e=this.get("statechart"),b=this.get("statechartDelegate"),d=this.get("location");var a={state:this,location:d,params:f,handler:this.routeTriggered};var c=this.createStateRouteHandlerContext(a);if(b.statechartShouldStateHandleTriggeredRoute(e,this,c)){this.handleTriggeredRoute(c)}else{b.statechartStateCancelledHandlingTriggeredRoute(e,this,c)}},createStateRouteHandlerContext:function(a){return SC.StateRouteHandlerContext.create(a)},handleTriggeredRoute:function(a){this.gotoState(this,a)},_addEmptyInitialSubstateIfNeeded:function(){var c=this.get("initialSubstate"),b=this.get("substatesAreConcurrent");if(c||b){return null}var a=this.createSubstate(SC.EmptyState);this.set("initialSubstate",a);this.get("substates").push(a);this[a.get("name")]=a;a.initState();this.stateLogWarning("state %@ has no initial substate defined. Will default to using an empty state as initial substate".fmt(this));return a},_addSubstate:function(c,d,a){var b=this.get("substates");a=SC.clone(a)||{};a.name=c;d=this.createSubstate(d,a);b.push(d);this[c]=d;d.initState();return d},addSubstate:function(c,e,b){if(SC.empty(c)){this.stateLogError("Can not add substate. name required");return null}if(this[c]!==undefined){this.stateLogError("Can not add substate '%@'. Already a defined property".fmt(c));return null}if(!this.get("stateIsInitialized")){this.stateLogError("Can not add substate '%@'. this state is not yet initialized".fmt(c));return null}var a=arguments.length;if(a===1){e=SC.State}else{if(a===2&&SC.typeOf(e)===SC.T_HASH){b=e;e=SC.State}}var d=SC.kindOf(e,SC.State)&&e.isClass;if(!d){this.stateLogError("Can not add substate '%@'. must provide a state class".fmt(c));return null}e=this._addSubstate(c,e,b);this._addEmptyInitialSubstateIfNeeded();this.notifyPropertyChange("substates");return e},createSubstate:function(b,a){a=a||{};return b.create({parentState:this,statechart:this.get("statechart")},a)},_registerEventHandler:function(b,e){var d=e.events,f=null,a=d.length,c=0;this._registeredEventHandlers[b]=e;for(;c<a;c+=1){f=d[c];if(SC.typeOf(f)===SC.T_STRING){this._registeredStringEventHandlers[f]={name:b,handler:e};continue}if(f instanceof RegExp){this._registeredRegExpEventHandlers.push({name:b,handler:e,regexp:f});continue}this.stateLogError("Invalid event %@ for event handler %@ in state %@".fmt(f,b,this))}},_registerStateObserveHandler:function(d,f){var e=0,c=f.args,b=c.length,a,g=YES;for(;e<b;e+=1){a=c[e];if(SC.typeOf(a)!==SC.T_STRING||SC.empty(a)){this.stateLogError("Invalid argument %@ for state observe handler %@ in state %@".fmt(a,d,this));g=NO}}if(!g){return}this._registeredStateObserveHandlers[d]=f.args},_registerWithParentStates:function(){var a=this.get("parentState");while(!SC.none(a)){a._registerSubstate(this);a=a.get("parentState")}},_registerSubstate:function(b){var c=b.pathRelativeTo(this);if(SC.none(c)){return}this._registeredSubstates.push(b);var a=this._registeredSubstatePaths;if(a[b.get("name")]===undefined){a[b.get("name")]={}}var d=a[b.get("name")];d[c]=b},pathRelativeTo:function(b){var c=this.get("name"),a=this.get("parentState");while(!SC.none(a)&&a!==b){c="%@.%@".fmt(a.get("name"),c);a=a.get("parentState")}if(a!==b&&b!==this){this.stateLogError("Can not generate relative path from %@ since it not a parent state of %@".fmt(b,this));return null}return c},getSubstate:function(f,h,e){if(!f){return null}var b=SC.typeOf(f);if(b===SC.T_OBJECT){return this._registeredSubstates.indexOf(f)>-1?f:null}if(b!==SC.T_STRING){this.stateLogError("Can not find matching subtype. value must be an object or string: %@".fmt(f));return null}var d=SC.StatePathMatcher.create({state:this,expression:f}),c=[],g;if(d.get("tokens").length===0){return null}var j=this._registeredSubstatePaths[d.get("lastPart")];if(!j){return this._notifySubstateNotFound(h,e,f)}for(g in j){if(d.match(g)){c.push(j[g])}}if(c.length===1){return c[0]}if(c.length>1){var i=[];for(g in j){i.push(g)}if(h){return this._notifySubstateNotFound(h,e,f,i)}var a="Can not find substate matching '%@' in state %@. Ambiguous with the following: %@";this.stateLogError(a.fmt(f,this.get("fullPath"),i.join(", ")))}return this._notifySubstateNotFound(h,e,f)},_notifySubstateNotFound:function(d,c,b,a){return d?d.call(c||this,this,b,a):null},getState:function(a){if(a===this.get("name")){return this}if(SC.kindOf(a,SC.State)){return a}return this.getSubstate(a,this._handleSubstateNotFound)},_handleSubstateNotFound:function(d,c,a){var b=this.get("parentState");if(b){return b.getState(c)}if(a){var e="Can not find state matching '%@'. Ambiguous with the following: %@";this.stateLogError(e.fmt(c,a.join(", ")))}return null},gotoState:function(c,a){var b=this.getState(c);if(!b){var d="can not go to state %@ from state %@. Invalid value.";this.stateLogError(d.fmt(c,this));return}var e=this.findFirstRelativeCurrentState(b);this.get("statechart").gotoState(b,e,false,a)},gotoHistoryState:function(d,a,b){var c=this.getState(d);if(!c){var e="can not go to history state %@ from state %@. Invalid value.";this.stateLogError(e.fmt(d,this));return}var f=this.findFirstRelativeCurrentState(c);this.get("statechart").gotoHistoryState(c,f,a,b)},resumeGotoState:function(){this.get("statechart").resumeGotoState()},stateIsCurrentSubstate:function(a){if(SC.typeOf(a)===SC.T_STRING){a=this.get("statechart").getState(a)}var b=this.get("currentSubstates");return !!b&&b.indexOf(a)>=0},stateIsEnteredSubstate:function(b){if(SC.typeOf(b)===SC.T_STRING){b=this.get("statechart").getState(b)}var a=this.get("enteredSubstates");return !!a&&a.indexOf(b)>=0},isRootState:function(){return this.getPath("statechart.rootState")===this}.property(),isCurrentState:function(){return this.stateIsCurrentSubstate(this)}.property("currentSubstates").cacheable(),isConcurrentState:function(){return this.getPath("parentState.substatesAreConcurrent")}.property(),isEnteredState:function(){return this.stateIsEnteredSubstate(this)}.property("enteredSubstates").cacheable(),hasSubstates:function(){return this.getPath("substates.length")>0}.property("substates"),hasCurrentSubstates:function(){var a=this.get("currentSubstates");return !!a&&a.get("length")>0}.property("currentSubstates").cacheable(),hasEnteredSubstates:function(){var a=this.get("enteredSubstates");return !!a&&a.get("length")>0}.property("enteredSubstates").cacheable(),findFirstRelativeCurrentState:function(b){if(this.get("isCurrentState")){return this}var a=this.get("currentSubstates")||[],d=a.get("length"),c=this.get("parentState");if(d===0){return c?c.findFirstRelativeCurrentState():null}if(d>1){b=this.getSubstate(b);if(b){return b.findFirstRelativeCurrentState()}}return a[0]},reenter:function(){if(this.get("isEnteredState")){this.gotoState(this)}else{SC.Logger.error("Can not re-enter state %@ since it is not an entered state in the statechart".fmt(this))}},tryToHandleEvent:function(g,d,b){var h=this.get("statechart"),c;if(this._registeredEventHandlers[g]){this.stateLogWarning("state %@ can not handle event '%@' since it is a registered event handler".fmt(this,g));return NO}if(this._registeredStateObserveHandlers[g]){this.stateLogWarning("state %@ can not handle event '%@' since it is a registered state observe handler".fmt(this,g));return NO}if(SC.typeOf(this[g])===SC.T_FUNCTION){h.stateWillTryToHandleEvent(this,g,g);c=(this[g](d,b)!==NO);h.stateDidTryToHandleEvent(this,g,g,c);return c}var f=this._registeredStringEventHandlers[g];if(f){h.stateWillTryToHandleEvent(this,g,f.name);c=(f.handler.call(this,g,d,b)!==NO);h.stateDidTryToHandleEvent(this,g,f.name,c);return c}var a=this._registeredRegExpEventHandlers.length,e=0;for(;e<a;e+=1){f=this._registeredRegExpEventHandlers[e];if(g.match(f.regexp)){h.stateWillTryToHandleEvent(this,g,f.name);c=(f.handler.call(this,g,d,b)!==NO);h.stateDidTryToHandleEvent(this,g,f.name,c);return c}}if(SC.typeOf(this["unknownEvent"])===SC.T_FUNCTION){h.stateWillTryToHandleEvent(this,g,"unknownEvent");c=(this.unknownEvent(g,d,b)!==NO);h.stateDidTryToHandleEvent(this,g,"unknownEvent",c);return c}return NO},enterState:function(a){},stateWillBecomeEntered:function(a){this._isEnteringState=YES},stateDidBecomeEntered:function(a){this._setupAllStateObserveHandlers();this._isEnteringState=NO},exitState:function(a){},stateWillBecomeExited:function(a){this._isExitingState=YES;this._teardownAllStateObserveHandlers()},stateDidBecomeExited:function(a){this._isExitingState=NO},_setupAllStateObserveHandlers:function(){this._configureAllStateObserveHandlers("addObserver")},_teardownAllStateObserveHandlers:function(){this._configureAllStateObserveHandlers("removeObserver")},_configureAllStateObserveHandlers:function(g){var e,c,f,h,b,d,a;for(e in this._registeredStateObserveHandlers){c=this._registeredStateObserveHandlers[e];for(d=0;d<c.length;d+=1){h=c[d];b=e;f=h.indexOf(".");if(f<0){this[g](h,this,b)}else{if(h.indexOf("*")===0){this[g](h.slice(1),this,b)}else{a=null;if(f===0){a=this;h=h.slice(1)}else{if(f===4&&h.slice(0,5)==="this."){a=this;h=h.slice(5)}else{if(f<0&&h.length===4&&h==="this"){a=this;h=""}}}SC.Observers[g](h,this,b,a)}}}}},performAsync:function(c,b,a){return SC.Async.perform(c,b,a)},respondsToEvent:function(d){if(this._registeredEventHandlers[d]){return false}if(SC.typeOf(this[d])===SC.T_FUNCTION){return true}if(this._registeredStringEventHandlers[d]){return true}if(this._registeredStateObserveHandlers[d]){return false}var a=this._registeredRegExpEventHandlers.length,b=0,c;for(;b<a;b+=1){c=this._registeredRegExpEventHandlers[b];if(d.match(c.regexp)){return true}}return SC.typeOf(this["unknownEvent"])===SC.T_FUNCTION},fullPath:function(){var a=this.getPath("statechart.rootState");if(!a){return this.get("name")}return this.pathRelativeTo(a)}.property("name","parentState").cacheable(),toString:function(){return this.get("fullPath")},_statechartOwnerDidChange:function(){this.notifyPropertyChange("owner")},stateLogWarning:function(b){var a=this.get("statechart");a.statechartLogWarning(b)},stateLogError:function(b){var a=this.get("statechart");a.statechartLogError(b)}});SC.State.plugin=function(e){var b;b=new Array(arguments.length-1);for(var c=0,a=b.length;c<a;c++){b[c]=arguments[c+1]}var d=function(){var f=SC.objectForPropertyPath(e);if(!f){console.error("SC.State.plugin: Unable to determine path %@".fmt(e));return undefined}if(!f.isClass||!f.kindOf(SC.State)){console.error("SC.State.plugin: Unable to extend. %@ must be a class extending from SC.State".fmt(e));return undefined}return f.extend.apply(f,b)};d.statePlugin=YES;return d};SC.State.design=SC.State.extend;sc_require("system/state");SC.EMPTY_STATE_NAME="__EMPTY_STATE__";SC.EmptyState=SC.State.extend({name:SC.EMPTY_STATE_NAME,enterState:function(){var a="No initial substate was defined for state %@. Entering default empty state";this.stateLogWarning(a.fmt(this.get("parentState")))}});sc_require("system/state");SC.HistoryState=SC.Object.extend({isRecursive:NO,defaultState:null,statechart:null,parentState:null,state:function(){var b=this.get("defaultState"),a=this.getPath("parentState.historyState");return !!a?a:b}.property().cacheable(),parentHistoryStateDidChange:function(){this.notifyPropertyChange("state")}.observes("*parentState.historyState")});SC.StateRouteHandlerContext=SC.Object.extend({state:null,location:null,params:null,handler:null,retry:function(){var b=this.get("state"),c=this.get("params"),a=this.get("handler");if(SC.typeOf(a)===SC.T_STRING){a=b[a]}if(SC.typeOf(a)===SC.T_FUNCTION){a.apply(b,[c])}}});sc_require("system/state");sc_require("mixins/statechart_delegate");SC.StatechartManager={isResponderContext:YES,isStatechart:YES,statechartIsInitialized:NO,name:null,rootState:null,rootStateExample:SC.State,initialState:null,statesAreConcurrent:NO,statechartOwnerKey:"owner",owner:null,autoInitStatechart:YES,suppressStatechartWarnings:NO,delegate:null,statechartDelegate:function(){var a=this.get("delegate");return this.delegateFor("isStatechartDelegate",a)}.property("delegate"),initMixin:function(){if(this.get("autoInitStatechart")){this.initStatechart()}},destroyMixin:function(){var a=this.get("rootState");a.destroy();this.set("rootState",null);this.notifyPropertyChange("currentStates")},initStatechart:function(){if(this.get("statechartIsInitialized")){return}this._gotoStateLocked=NO;this._sendEventLocked=NO;this._pendingStateTransitions=[];this._pendingSentEvents=[];this.sendAction=this.sendEvent;var b=this.get("rootState"),c;if(!b){b=this._constructRootStateClass()}else{if(SC.typeOf(b)===SC.T_FUNCTION&&b.statePlugin){b=b.apply(this)}}if(!(SC.kindOf(b,SC.State)&&b.isClass)){c="Unable to initialize statechart. Root state must be a state class";this.statechartLogError(c);SC.throw(c)}b=this.createRootState(b,{statechart:this,name:SC.ROOT_STATE_NAME});this.set("rootState",b);b.initState();if(SC.kindOf(b.get("initialSubstate"),SC.EmptyState)){c="Unable to initialize statechart. Root state must have an initial substate explicitly defined";this.statechartLogError(c);SC.throw(c)}if(!SC.empty(this.get("initialState"))){var a="initialState";this.set(a,b.get(this.get(a)))}this.set("statechartIsInitialized",YES);this.gotoState(b)},createRootState:function(b,a){if(!a){a={}}b=b.create(a);return b},currentStates:function(){return this.getPath("rootState.currentSubstates")}.property().cacheable(),firstCurrentState:function(){var a=this.get("currentStates");return a?a.objectAt(0):null}.property("currentStates").cacheable(),currentStateCount:function(){return this.getPath("currentStates.length")}.property("currentStates").cacheable(),stateIsCurrentState:function(a){return this.get("rootState").stateIsCurrentSubstate(a)},enteredStates:function(){return this.getPath("rootState.enteredSubstates")}.property().cacheable(),stateIsEntered:function(a){return this.get("rootState").stateIsEnteredSubstate(a)},doesContainState:function(a){return !SC.none(this.getState(a))},getState:function(b){var a=this.get("rootState");return a===b?a:a.getSubstate(b)},gotoState:function(a,l,m,b){if(!this.get("statechartIsInitialized")){this.statechartLogError("can not go to state %@. statechart has not yet been initialized".fmt(a));return}if(this.get("isDestroyed")){this.statechartLogError("can not go to state %@. statechart is destroyed".fmt(this));return}var j=new Array(arguments.length);for(var e=0,h=j.length;e<h;e++){j[e]=arguments[e]}j=this._processGotoStateArgs(j);a=j.state;l=j.fromCurrentState;m=j.useHistory;b=j.context;var o=null,k=[],n=[],g=a,d=l,c;a=this.getState(a);if(SC.none(a)){this.statechartLogError("Can not to goto state %@. Not a recognized state in statechart".fmt(g));return}if(this._gotoStateLocked){this._pendingStateTransitions.push({state:a,fromCurrentState:l,useHistory:m,context:b});return}this._gotoStateLocked=YES;if(l){l=this.getState(l);if(SC.none(l)||!l.get("isCurrentState")){c="Can not to goto state %@. %@ is not a recognized current state in statechart";this.statechartLogError(c.fmt(g,d));this._gotoStateLocked=NO;return}}else{l=a.findFirstRelativeCurrentState();if(!l){l=this.get("firstCurrentState")}}if(!SC.none(l)){k=this._createStateChain(l)}n=this._createStateChain(a);o=this._findPivotState(k,n);if(o){if(o.get("substatesAreConcurrent")&&o!==a){this.statechartLogError("Can not go to state %@ from %@. Pivot state %@ has concurrent substates.".fmt(a,l,o));this._gotoStateLocked=NO;return}}var f=[];this._traverseStatesToExit(k.shift(),k,o,f);if(o!==a){this._traverseStatesToEnter(n.pop(),n,o,m,f)}else{this._traverseStatesToExit(o,[],null,f);this._traverseStatesToEnter(o,null,null,m,f)}this._gotoStateActions=f;this._executeGotoStateActions(a,f,null,b)},gotoStateActive:function(){return this._gotoStateLocked}.property(),gotoStateSuspended:function(){return this._gotoStateLocked&&!!this._gotoStateSuspendedPoint}.property(),resumeGotoState:function(){if(!this.get("gotoStateSuspended")){this.statechartLogError("Can not resume goto state since it has not been suspended");return}var a=this._gotoStateSuspendedPoint;this._executeGotoStateActions(a.gotoState,a.actions,a.marker,a.context)},_executeGotoStateActions:function(g,f,b,c){var e=null,a=f.length,d=null;b=SC.none(b)?0:b;for(;b<a;b+=1){this._currentGotoStateAction=e=f[b];switch(e.action){case SC.EXIT_STATE:d=this._exitState(e.state,c);break;case SC.ENTER_STATE:d=this._enterState(e.state,e.currentState,c);break}if(SC.kindOf(d,SC.Async)){this._gotoStateSuspendedPoint={gotoState:g,actions:f,marker:b+1,context:c};d.tryToPerform(e.state);return}}this.beginPropertyChanges();this.notifyPropertyChange("currentStates");this.notifyPropertyChange("enteredStates");this.endPropertyChanges();this._cleanupStateTransition()},_cleanupStateTransition:function(){this._currentGotoStateAction=null;this._gotoStateSuspendedPoint=null;this._gotoStateActions=null;this._gotoStateLocked=NO;this._flushPendingStateTransition();if(!this._sendEventLocked&&!this._gotoStateLocked){this._flushPendingSentEvents()}},_exitState:function(d,b){var c;if(d.get("currentSubstates").indexOf(d)>=0){c=d.get("parentState");while(c){c.get("currentSubstates").removeObject(d);c.notifyPropertyChange("currentSubstates");c=c.get("parentState")}}c=d;while(c){c.get("enteredSubstates").removeObject(d);c.notifyPropertyChange("enteredSubstates");c=c.get("parentState")}d.set("currentSubstates",[]);d.notifyPropertyChange("currentSubstates");d.stateWillBecomeExited(b);var a=this.exitState(d,b);d.stateDidBecomeExited(b);d._traverseStatesToExit_skipState=NO;return a},exitState:function(b,a){return b.exitState(a)},_enterState:function(d,e,b){var c=d.get("parentState");if(c&&!d.get("isConcurrentState")){c.set("historyState",d)}if(e){c=d;while(c){c.get("currentSubstates").pushObject(d);c.notifyPropertyChange("currentSubstates");c=c.get("parentState")}}c=d;while(c){c.get("enteredSubstates").pushObject(d);c.notifyPropertyChange("enteredSubstates");c=c.get("parentState")}d.stateWillBecomeEntered(b);var a=this.enterState(d,b);d.stateDidBecomeEntered(b);return a},enterState:function(b,a){if(b.enterStateByRoute&&SC.kindOf(a,SC.StateRouteHandlerContext)){return b.enterStateByRoute(a)}else{return b.enterState(a)}},gotoHistoryState:function(h,g,d,f){if(!this.get("statechartIsInitialized")){this.statechartLogError("can not go to state %@'s history state. Statechart has not yet been initialized".fmt(h));return}var c=new Array(arguments.length);for(var e=0,b=c.length;e<b;e++){c[e]=arguments[e]}c=this._processGotoStateArgs(c);h=c.state;g=c.fromCurrentState;d=c.useHistory;f=c.context;h=this.getState(h);if(!h){this.statechartLogError("Can not to goto state %@'s history state. Not a recognized state in statechart".fmt(h));return}var a=h.get("historyState");if(!d){if(a){this.gotoState(a,g,f)}else{this.gotoState(h,g,f)}}else{this.gotoState(h,g,YES,f)}},sendEvent:function(b,f,e){if(this.get("isDestroyed")){this.statechartLogError("can not send event %@. statechart is destroyed".fmt(b));return}var c=NO,l=this,k=NO,g=this.get("currentStates").slice(),j={},h=0,d=0,a=null;if(this._sendEventLocked||this._gotoStateLocked){this._pendingSentEvents.push({event:b,arg1:f,arg2:e});return}this._sendEventLocked=YES;h=g.get("length");for(;d<h;d+=1){k=NO;a=g[d];if(!a.get("isCurrentState")){continue}while(!k&&a){if(!j[a.get("fullPath")]){k=a.tryToHandleEvent(b,f,e);j[a.get("fullPath")]=YES}if(!k){a=a.get("parentState")}else{c=YES}}}this._sendEventLocked=NO;if(!this._sendEventLocked&&!this._gotoStateLocked){l=this._flushPendingSentEvents()}return c?this:(l?this:null)},stateWillTryToHandleEvent:function(c,b,a){this._stateHandleEventInfo={state:c,event:b,handler:a}},stateDidTryToHandleEvent:function(c,b,a,d){this._stateHandleEventInfo=null},_createStateChain:function(b){var a=[];while(b){a.push(b);b=b.get("parentState")}return a},_findPivotState:function(c,b){if(c.length===0||b.length===0){return null}var a=c.find(function(e,d){if(b.indexOf(e)>=0){return YES}});return a},_traverseStatesToExit:function(b,j,d,g){if(!b||b===d){return}if(b.get("substatesAreConcurrent")){var e=0,f=b.get("currentSubstates"),h=f.length,c=null;for(;e<h;e+=1){c=f[e];if(c._traverseStatesToExit_skipState===YES){continue}var a=this._createStateChain(c);this._traverseStatesToExit(a.shift(),a,b,g)}}g.push({action:SC.EXIT_STATE,state:b});if(b.get("isCurrentState")){b._traverseStatesToExit_skipState=YES}this._traverseStatesToExit(j.shift(),j,d,g)},_traverseStatesToEnter:function(b,d,h,f,c){if(!b){return}if(h){if(b!==h){this._traverseStatesToEnter(d.pop(),d,h,f,c)}else{this._traverseStatesToEnter(d.pop(),d,null,f,c)}}else{if(!d||d.length===0){var g={action:SC.ENTER_STATE,state:b,currentState:NO};c.push(g);var e=b.get("initialSubstate"),a=b.get("historyState");if(b.get("substatesAreConcurrent")){this._traverseConcurrentStatesToEnter(b.get("substates"),null,f,c)}else{if(b.get("hasSubstates")&&a&&f){this._traverseStatesToEnter(a,null,null,f,c)}else{if(e){if(SC.kindOf(e,SC.HistoryState)){if(!f){f=e.get("isRecursive")}e=e.get("state")}this._traverseStatesToEnter(e,null,null,f,c)}else{g.currentState=YES}}}}else{if(d.length>0){c.push({action:SC.ENTER_STATE,state:b});var i=d.pop();this._traverseStatesToEnter(i,d,null,f,c);if(b.get("substatesAreConcurrent")){this._traverseConcurrentStatesToEnter(b.get("substates"),i,f,c)}}}}},respondsTo:function(d){if(this.get("isDestroyed")){this.statechartLogError("can not respond to event %@. statechart is destroyed".fmt(d));return false}var b=this.get("currentStates"),a=b.get("length"),c=0,e=null;for(;c<a;c+=1){e=b.objectAt(c);while(e){if(e.respondsToEvent(d)){return true}e=e.get("parentState")}}return SC.typeOf(this[d])===SC.T_FUNCTION},tryToPerform:function(d,c,b){if(!this.respondsTo(d)){return NO}if(SC.typeOf(this[d])===SC.T_FUNCTION){var a=this[d](c,b);if(a!==NO){return YES}}return !!this.sendEvent(d,c,b)},invokeStateMethod:function(k,j,c){if(k==="unknownEvent"){this.statechartLogError("can not invoke method unkownEvent");return}j=SC.A(arguments);j.shift();var f=j.length,m=f>0?j[f-1]:null,l=SC.typeOf(m)===SC.T_FUNCTION?j.pop():null,e=this.get("currentStates"),d=0,b=null,h={},a,n,g=0;f=e.get("length");for(;d<f;d+=1){b=e.objectAt(d);while(b){if(h[b.get("fullPath")]){break}h[b.get("fullPath")]=YES;a=b[k];if(SC.typeOf(a)===SC.T_FUNCTION&&!a.isEventHandler){n=a.apply(b,j);if(l){l.call(this,b,n)}g+=1;break}b=b.get("parentState")}}return g===1?n:undefined},_traverseConcurrentStatesToEnter:function(d,c,f,b){var e=0,a=d.length,g=null;for(;e<a;e+=1){g=d[e];if(g!==c){this._traverseStatesToEnter(g,null,null,f,b)}}},_flushPendingStateTransition:function(){if(!this._pendingStateTransitions){this.statechartLogError("Unable to flush pending state transition. _pendingStateTransitions is invalid");return}var a=this._pendingStateTransitions.shift();if(!a){return}this.gotoState(a.state,a.fromCurrentState,a.useHistory,a.context)},_flushPendingSentEvents:function(){var a=this._pendingSentEvents.shift();if(!a){return null}return this.sendEvent(a.event,a.arg1,a.arg2)},_processGotoStateArgs:function(b){var d={state:null,fromCurrentState:null,useHistory:false,context:null},a=null,c=null;b=b.filter(function(e){return e!==undefined});a=b.length;if(a<1){return d}d.state=b[0];if(a===2){c=b[1];switch(SC.typeOf(c)){case SC.T_BOOL:d.useHistory=c;break;case SC.T_HASH:case SC.T_OBJECT:if(!SC.kindOf(c,SC.State)){d.context=c}break;default:d.fromCurrentState=c}}else{if(a===3){c=b[1];if(SC.typeOf(c)===SC.T_BOOL){d.useHistory=c;d.context=b[2]}else{d.fromCurrentState=c;c=b[2];if(SC.typeOf(c)===SC.T_BOOL){d.useHistory=c}else{d.context=c}}}else{d.fromCurrentState=b[1];d.useHistory=b[2];d.context=b[3]}}return d},_constructRootStateClass:function(){var d="rootStateExample",e=this.get(d),b=this.get("initialState"),c=this.get("statesAreConcurrent"),a=0,i,g,f,h={};if(SC.typeOf(e)===SC.T_FUNCTION&&e.statePlugin){e=e.apply(this)}if(!(SC.kindOf(e,SC.State)&&e.isClass)){this._logStatechartCreationError("Invalid root state example");return null}if(c&&!SC.empty(b)){this._logStatechartCreationError("Can not assign an initial state when states are concurrent")}else{if(c){h.substatesAreConcurrent=YES}else{if(SC.typeOf(b)===SC.T_STRING){h.initialSubstate=b}else{this._logStatechartCreationError("Must either define initial state or assign states as concurrent");return null}}}for(i in this){if(i===d){continue}g=this[i];f=SC.typeOf(g)===SC.T_FUNCTION;if(f&&g.statePlugin){g=g.apply(this)}if(SC.kindOf(g,SC.State)&&g.isClass&&this[i]!==this.constructor){h[i]=g;a+=1}}if(a===0){this._logStatechartCreationError("Must define one or more states");return null}return e.extend(h)},_logStatechartCreationError:function(a){SC.Logger.error("Unable to create statechart for %@: %@.".fmt(this,a))},statechartLogError:function(a){SC.Logger.error("ERROR %@: %@".fmt(this.get("statechartLogPrefix"),a))},statechartLogWarning:function(a){if(this.get("suppressStatechartWarnings")){return}SC.Logger.warn("WARN %@: %@".fmt(this.get("statechartLogPrefix"),a))},statechartLogPrefix:function(){var b=SC._object_className(this.constructor),a=this.get("name"),c;if(SC.empty(a)){c="%@<%@>".fmt(b,SC.guidFor(this))}else{c="%@<%@, %@>".fmt(b,a,SC.guidFor(this))}return c}.property().cacheable()};SC.mixin(SC.StatechartManager,SC.StatechartDelegate,SC.DelegateSupport);SC.ROOT_STATE_NAME="__ROOT_STATE__";SC.EXIT_STATE=0;SC.ENTER_STATE=1;SC.Statechart=SC.Object.extend(SC.StatechartManager,{autoInitStatechart:NO});SC.Statechart.design=SC.Statechart.extend;
  /*!
   * ==========================================================================
   * SproutCore -- JavaScript Application Framework
   * Copyright ©2008-2011 Apple Inc. All rights reserved.
   * Copyright 2006-2011, Strobe Inc. and contributors.
   * 
   * Permission is hereby granted, free of charge, to any person obtaining a 
   * copy of this software and associated documentation files (the "Software"), 
   * to deal in the Software without restriction, including without limitation 
   * the rights to use, copy, modify, merge, publish, distribute, sublicense, 
   * and/or sell copies of the Software, and to permit persons to whom the 
   * Software is furnished to do so, subject to the following conditions:
   * 
   * The above copyright notice and this permission notice shall be included in 
   * all copies or substantial portions of the Software.
   * 
   * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 
   * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 
   * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 
   * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 
   * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 
   * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 
   * DEALINGS IN THE SOFTWARE.
   * 
   * SproutCore and the SproutCore logo are trademarks of Strobe Inc.
   * 
   * For more information about SproutCore, visit http://www.sproutcore.com
   * 
   * ==========================================================================
   */
  ;SC.EmptyTheme=SC.BaseTheme.create({name:"sc-empty-theme"});SC.Theme.addTheme(SC.EmptyTheme);SC.AceTheme=SC.BaseTheme.create({name:"ace",description:"A SproutCore built-in theme by Alex Iskander and contributors. Only supports browsers that implement CSS3."});SC.Theme.addTheme(SC.AceTheme);SC.AceTheme.PointLeft=SC.AceTheme.subtheme("point-left","point-left");SC.AceTheme.PointRight=SC.AceTheme.subtheme("point-right","point-right");SC.AceTheme.Capsule=SC.AceTheme.subtheme("capsule","capsule");SC.AceTheme.Dark=SC.AceTheme.subtheme("dark");SC.defaultTheme="ace";sc_require("theme");SC.AceTheme.Dark.PointLeft=SC.AceTheme.Dark.subtheme("point-left","point-left");SC.AceTheme.Dark.PointRight=SC.AceTheme.Dark.subtheme("point-right","point-right");SC.AceTheme.Dark.PointRight=SC.AceTheme.Dark.subtheme("capsule","capsule");SC.AceTheme.SourceList=SC.AceTheme.subtheme("source-list");sc_require("theme");SC.AceTheme.Popover=SC.AceTheme.Dark.subtheme("popover");SC.AceTheme.addTheme(SC.AceTheme.Popover);SC.AceTheme.SolidPopover=SC.AceTheme.Popover.subtheme("solid");SC.AceTheme.addTheme(SC.AceTheme.SolidPopover.create({name:"solid-popover"}));sc_require("resources/picker/popover/popover");SC.AceTheme.Popover.pickerRenderDelegate=SC.RenderDelegate.create({className:"picker",render:function(e,b){var a=e.get("preferType");var d=e.get("pointerPos");var c=e.get("pointerPosY");if(a==SC.PICKER_POINTER||a==SC.PICKER_MENU_POINTER){b.addClass(d)}},update:function(e,d){var a=e.get("preferType");var c=e.get("pointerPos");var b=e.get("pointerPosY");if(a==SC.PICKER_POINTER||a==SC.PICKER_MENU_POINTER){d.addClass(c)}}});SC.AceTheme.Popover.workspaceRenderDelegate=SC.RenderDelegate.create({className:"workspace",render:function(b,a){a.setClass({"top-toolbar":b.get("hasTopToolbar"),"bottom-toolbar":b.get("hasBottomToolbar")});a=a.begin("div").addClass("popover-background");this.includeSlices(b,a,SC.NINE_SLICE);a.push("<div class = 'sc-pointer'></div>");a=a.end()},update:function(b,a){a.setClass({"top-toolbar":b.get("hasTopToolbar"),"bottom-toolbar":b.get("hasBottomToolbar")})}});Df=SC.Application.create({NAMESPACE:"Df",VERSION:"0.1.0",store:SC.Store.create().from(SC.Record.fixtures)});Df.Obj=SC.Object.extend({x:0,y:0,vx:0,vy:0,width:30,height:30,rotation:0,color:"#DD55DD",scope:null,init:function(){console.log("Obj init")},paint:function(a,b,c){a.save();a.translate(this.x,this.y);a.rotate(this.rotation-Math.PI/2);this.paintObj(a,b,c);a.restore()},paintObj:function(a,b,c){a.strokeStyle=this.color;a.lineWidth=this.width;a.beginPath();a.moveTo(0,-this.height/2);a.lineTo(0,this.height/2);a.stroke()},beforeStep:function(a){},afterStep:function(a){},step:function(a){this.beforeStep(a);this.x+=this.vx*a;this.y+=this.vy*a;this.afterStep(a)}});sc_require("obj");Df.Bot=Df.Obj.extend({color:"#DD5555",init:function(){console.log("Bot init")}});sc_require("obj");Df.Bullet=Df.Obj.extend({width:5,height:5,color:"#DD7777",pixelage:0,isActive:false,next:null,init:function(){console.log("bullet init")}});sc_require("bullet");Df.BulletCloud=SC.Object.extend({scope:null,init:function(){console.log("Bullet cloud init");this.maxCount=1000;this.dummyHead=Df.Bullet.create({});this.tail=this.dummyHead;for(var a=0;a<this.maxCount;a++){this.tail.next=Df.Bullet.create({scope:this.scope});this.tail=this.tail.next}this.nextAvail=this.dummyHead.next},fire:function(a,d,c,b){if(!this.nextAvail){this.nextAvail=this.dummyHead.next;this.dummyHead.next=this.dummyHead.next.next;this.nextAvail.next=null;this.tail.next=this.nextAvail;this.tail=this.tail.next}this.nextAvail.x=a;this.nextAvail.y=d;this.nextAvail.vx=c;this.nextAvail.vy=b;this.nextAvail.isActive=true;this.nextAvail=this.nextAvail.next},paint:function(b,c,d){var a=this.dummyHead.next;while(a&&a.isActive){a.paint(b,c,d);a=a.next}},step:function(b){var a=this.dummyHead.next;while(a&&a.isActive){a.step(b);a=a.next}}});Df.Camera=SC.Object.extend({zoom:1,x:0,y:0,applyInverseTransform:function(a){a.translate(-this.x,-this.y);a.scale(this.zoom,this.zoom)}});sc_require("bullet_cloud");Df.Scope=SC.Object.extend({init:function(){console.log("Scope init");this.objs=[];this.bulletCloud=Df.BulletCloud.create({scope:this})},fireBullet:function(a,d,c,b){this.bulletCloud.fire(a,d,c,b)},getBound:function(){return this.engine.bound},add:function(a){console.log("Adding "+a.toString());this.objs.push(a);a.scope=this},paint:function(a,b,c){this.objs.forEach(function(d){d.paint(a,b,c)});this.bulletCloud.paint(a,b,c)},step:function(a){this.objs.forEach(function(b){b.step(a)});this.bulletCloud.step(a)}});sc_require("scope");Df.Engine=SC.Object.extend({init:function(){this.msStep=Math.floor(1000/60);this.scope=Df.Scope.create({engine:this});this.bound={x0:-10000,x1:10000,y0:-10000,y1:10000};this.control={intentX:0,intentY:0,up:false,down:false,left:false,right:false,touchId:null,touchStartX:undefined,touchStartY:undefined};this.aim={isDown:false,x:0,y:-1,vx:0,vy:0,intentX:0,intentY:0,clientX:undefined,clientY:undefined,cameraX:undefined,cameraY:undefined,touchId:null,isTouch:false,touchStartX:undefined,touchStartY:undefined};this.fuel(this.scope)},fuel:function(a){this.mach=Df.Mach.create({});this.scope.add(this.mach);this.scope.add(Df.Bot.create({x:100,y:100}))},ignite:function(){console.log("Ignite");this.worker=setInterval(this.step.bind(this),this.msStep)},step:function(){var a=this.msStep/1000;this.mach.applyControl(this.control);this.mach.applyAim(this.aim);this.scope.step(a)}});sc_require("obj");Df.Mach=Df.Obj.extend({color:"#DDDD55",pps:400,accelFactor:30,airDragFactor:0.1,recoil:15,init:function(){this.recoilTimer=0;this.control={intentX:0,intentY:0};this.aim={x:undefined,y:undefined,isDown:false};console.log("Mach init")},applyControl:function(a){this.control.intentX=a.intentX;this.control.intentY=a.intentY},applyAim:function(a){this.aim.x=a.x;this.aim.y=a.y;this.aim.isDown=a.isDown},beforeStep:function(a){arguments.callee.base.apply(this,arguments);this.drag(a);this.accel(this.control.intentX,this.control.intentY,a);this.steer(a);if(this.aim.isDown&&this.recoilTimer--<=0){this.shoot()}},afterStep:function(a){arguments.callee.base.apply(this,arguments);var b=this.scope.getBound();if(this.x<b.x0){this.x=b.x0}else{if(this.x>b.x1){this.x=b.x1}}if(this.y<b.y0){this.y=b.y0}else{if(this.y>b.y1){this.y=b.y1}}},shoot:function(){this.recoilTimer=this.recoil;var a=this.x;var d=this.y;var c=Math.cos(this.rotation)*370;var b=Math.sin(this.rotation)*370;this.scope.fireBullet(a,d,c,b)},steer:function(c){var b=this.aim.x-this.x;var a=this.aim.y-this.y;var e=Math.sqrt(b*b+a*a);if(e>0){this.rotation=Math.atan2(a,b)}},accel:function(g,e,c){var a=g*g+e*e;var d=Math.sqrt(a);if(d>1){g=g/d;e=e/d}this.vx+=g*this.accelFactor;this.vy+=e*this.accelFactor;var f=this.vx*this.vx+this.vy*this.vy;if(f>0){var b=Math.sqrt(f);if(b>this.pps){this.vx*=this.pps/b;this.vy*=this.pps/b}}},drag:function(a){this.vx-=this.vx*this.airDragFactor;this.vy-=this.vy*this.airDragFactor},paint:function(a,b,c){arguments.callee.base.apply(this,arguments);this.paintAim(a,b,c)},paintObj:function(a,b,c){arguments.callee.base.apply(this,arguments)},paintAim:function(a,b,c){a.save();a.translate(this.aim.x,this.aim.y);a.strokeStyle="#dddddd";a.lineWidth=1;a.beginPath();a.arc(0,0,10,0,2*Math.PI);a.stroke();a.restore()}});Df.Theme=SC.AceTheme.create({name:"df"});SC.Theme.addTheme(Df.Theme);SC.defaultTheme="df";Df.CanvasView=SC.View.extend({classNames:["canvas-view"],acceptsFirstResponder:YES,acceptsKeyPane:YES,acceptsMultitouch:YES,render:function(a,b){if(b){a.push('<canvas style="background:#666;"></canvas>')}},didCreateLayer:function(){var a=this;this.canvas=this.$("canvas")[0];this.engine=Df.engine;Df.camera=this.camera=Df.Camera.create({x:0,y:0,zoom:1});this.ctx=this.canvas.getContext("2d");this.resizeCanvas();window.addEventListener("resize",this.resizeCanvas.bind(this),false);this.worker=setInterval(this.step.bind(this),this.engine.msStep);this.becomeFirstResponder()},didUpdateLayer:function(){},paint:function(b){var a=this.engine.scope;this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height);this.ctx.save();this.camera.applyInverseTransform(this.ctx);this.applyCameraToViewPortTransform(this.ctx);a.paint(this.ctx,this.camera,b);this.ctx.restore();this.paintControl()},paintControl:function(){var a=this.engine.control.intentX;var f=this.engine.control.intentY;var e=Math.sqrt(a*a+f*f);if(e>1){a=a/e;f=f/e}a*=10;f*=10;var d=0;var c=0;if(this.engine.aim.isDown){d=this.engine.aim.intentX;c=this.engine.aim.intentY;var b=Math.sqrt(d*d+c*c);if(b>1){d=d/b;c=c/b}d*=10;c*=10}this.ctx.strokeStyle="rgba(255,255,255,0.4)";this.ctx.lineWidth=3;this.ctx.beginPath();this.ctx.arc(70,this.canvas.height-70,50,0,2*Math.PI);this.ctx.stroke();this.ctx.beginPath();this.ctx.arc(70+a,this.canvas.height-70+f,50,0,2*Math.PI);this.ctx.stroke();this.ctx.beginPath();this.ctx.arc(this.canvas.width-70,this.canvas.height-70,50,0,2*Math.PI);this.ctx.stroke();this.ctx.beginPath();this.ctx.arc(this.canvas.width-70+d,this.canvas.height-70+c,50,0,2*Math.PI);this.ctx.stroke()},applyCameraToViewPortTransform:function(a){a.translate(this.canvas.width/2,this.canvas.height/2)},step:function(){var a=this.engine.msStep/1000;this.computeTouchAim(a);window.requestAnimationFrame(this.paint.bind(this))},resizeCanvas:function(){this.canvas.width=window.innerWidth;this.canvas.height=window.innerHeight;this.engine.bound.x0=-this.canvas.width/2/this.camera.zoom-this.camera.x;this.engine.bound.x1=this.canvas.width/2/this.camera.zoom-this.camera.x;this.engine.bound.y0=-this.canvas.height/2/this.camera.zoom-this.camera.y;this.engine.bound.y1=this.canvas.height/2/this.camera.zoom- -this.camera.y;console.log(this.engine.bound)},updateAim:function(a){this.engine.aim.clientX=a.clientX;this.engine.aim.clientY=a.clientY;this.engine.aim.cameraX=a.clientX-this.canvas.width/2;this.engine.aim.cameraY=a.clientY-this.canvas.height/2;this.engine.aim.x=this.engine.aim.cameraX/this.camera.zoom+this.camera.x;this.engine.aim.y=this.engine.aim.cameraY/this.camera.zoom+this.camera.y},computeTouchAim:function(i){var b=500;var e=30;var c=0.2;this.engine.aim.vx-=this.engine.aim.vx*c;this.engine.aim.vy-=this.engine.aim.vy*c;if(this.engine.aim.isDown&&this.engine.aim.isTouch){var a=Math.sqrt(this.engine.aim.intentX*this.engine.aim.intentX+this.engine.aim.intentY*this.engine.aim.intentY);this.engine.aim.vx+=this.engine.aim.intentX*e;this.engine.aim.vy+=this.engine.aim.intentY*e;var g=Math.sqrt(this.engine.aim.vx*this.engine.aim.vx+this.engine.aim.vy*this.engine.aim.vy);if(g>b){this.engine.aim.vx*=b/g;this.engine.aim.vy*=b/g}}this.engine.aim.x+=this.engine.aim.vx*i;this.engine.aim.y+=this.engine.aim.vy*i;var j=this.engine.aim.x-this.engine.mach.x;var h=this.engine.aim.y-this.engine.mach.y;var f=Math.sqrt(j*j+h*h);if(f>100){this.engine.aim.x=this.engine.mach.x+j/f*100;this.engine.aim.y=this.engine.mach.y+h/f*100}},mouseEntered:function(a){this.updateAim(a);return YES},mouseMoved:function(a){this.updateAim(a);return YES},mouseExited:function(a){this.updateAim(a);return YES},mouseDown:function(a){console.log("Mouse down");this.updateAim(a);this.engine.aim.isDown=true;return YES},mouseDragged:function(a){return YES},mouseUp:function(a){console.log("Mouse up");if(!this.isFirstResponder){this.becomeFirstResponder()}this.updateAim(a);this.engine.aim.isDown=false;return YES},touchStart:function(b){var a=b.clientX<=this.canvas.width/2;if(a){this.engine.control.intentX=0;this.engine.control.intentY=0;this.engine.control.touchStartX=b.clientX;this.engine.control.touchStartY=b.clientY;this.engine.control.touchId=b.identifier}else{this.engine.aim.touchStartX=b.clientX;this.engine.aim.touchStartY=b.clientY;this.engine.aim.touchId=b.identifier;this.engine.aim.isDown=true;this.engine.aim.isTouch=true}},touchesDragged:function(c){var a=4;for(var e=0;e<c.touches.length;e++){var f=c.touches[e];if(f.identifier===this.engine.control.touchId){var d=f.clientX-this.engine.control.touchStartX;var b=f.clientY-this.engine.control.touchStartY;this.engine.control.intentX=d/a;this.engine.control.intentY=b/a;console.log(this.engine.control.intentX)}else{if(f.identifier===this.engine.aim.touchId){var d=f.clientX-this.engine.aim.touchStartX;var b=f.clientY-this.engine.aim.touchStartY;this.engine.aim.intentX=d/a/3;this.engine.aim.intentY=b/a/3}}}},touchEnd:function(a){if(a.identifier===this.engine.control.touchId){this.engine.control.intentX=0;this.engine.control.intentY=0;this.engine.control.touchId=null;this.engine.control.touchStartX=undefined;this.engine.control.touchStartY=undefined}else{if(a.identifier===this.engine.aim.touchId){this.engine.aim.touchId=null;this.engine.aim.touchStartX=undefined;this.engine.aim.touchStartY=undefined;this.engine.aim.intentX=0;this.engine.aim.intentY=0;this.engine.aim.isDown=false;this.engine.aim.isTouch=false}}},keyDown:function(a){var b=a.timeStamp;switch(a.keyCode){case SC.Event.KEY_RETURN:console.log("Enter down at "+b);break;case SC.Event.KEY_UP:case 119:this.engine.control.up=b;break;case SC.Event.KEY_DOWN:case 115:this.engine.control.down=b;break;case SC.Event.KEY_LEFT:case 97:this.engine.control.left=b;break;case SC.Event.KEY_RIGHT:case 100:this.engine.control.right=b;break;default:console.log("Key down "+a.keyCode+" at "+b)}this.updateControlIntent();return YES},keyUp:function(a){var b=a.timeStamp;switch(a.keyCode){case SC.Event.KEY_RETURN:console.log("Enter up at "+b);break;case SC.Event.KEY_UP:case 87:this.engine.control.up=false;break;case SC.Event.KEY_DOWN:case 83:this.engine.control.down=false;break;case SC.Event.KEY_LEFT:case 65:this.engine.control.left=false;break;case SC.Event.KEY_RIGHT:case 68:this.engine.control.right=false;break;default:console.log("Key up "+a.keyCode+" at "+b)}this.updateControlIntent();return YES},updateControlIntent:function(){this.engine.control.intentX=((this.engine.control.left?-1:0)+(this.engine.control.right?1:0));this.engine.control.intentY=((this.engine.control.up?-1:0)+(this.engine.control.down?1:0))}});Df.mainPage=SC.Page.design({mainPane:SC.MainPane.design({childViews:["canvasView"],canvasView:Df.CanvasView.design({layout:{top:0,right:0,bottom:0,left:0}})})});sc_require("engine");Df.main=function main(){Df.engine=Df.Engine.create({});Df.engine.ignite();Df.getPath("mainPage.mainPane").append()};function main(){Df.main()};