/** * @license Portions of this software are copyright Yahoo, Inc, used under the following license: * Software License Agreement (BSD License) * Copyright (c) 2009, Yahoo! Inc. * All rights reserved. * Redistribution and use of this software in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright notice, this list of conditions and the * following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of Yahoo! Inc. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission of Yahoo! Inc. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * Sources of Intellectual Property Included in the YUI Library * Where not otherwise indicated, all YUI content is authored by Yahoo! engineers and consists of Yahoo!-owned intellectual property. YUI is issued by Yahoo! under the BSD license above. In some specific instances, YUI will incorporate work done by developers outside of Yahoo! with their express permission. */ /*! * jQuery JavaScript Library v1.8.3 * http://jquery.com/ * * Includes Sizzle.js * http://sizzlejs.com/ * * Copyright 2012 jQuery Foundation and other contributors * Released under the MIT license * http://jquery.org/license * * Date: Tue Nov 13 2012 08:20:33 GMT-0500 (Eastern Standard Time) */ /** @license * ========================================================================== * 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 * * ========================================================================== */ /*! @license * Raphael 1.5.2 - JavaScript Vector Library * * Copyright (c) 2010 Dmitry Baranovskiy (http://raphaeljs.com) * Licensed under the MIT (http://raphaeljs.com/license.html) license. */ /*! @license * URI.js - Mutating URLs * * Version: 1.18.1 * * Author: Rodney Rehm * Web: http://medialize.github.io/URI.js/ * * Published under the MIT License http://www.opensource.org/licenses/mit-license * */ /*! @license Copyright Mathias Bynens 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. */ /*! * @license * * ]{ UUID - Ultra liteweight, blazing fast JavaScript UUID v4 generator * https://bitbucket.org/kodifica/uuid/ * * Copyright 2009-2010 Massimo Lombardo * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ function findClassNames(){if(SC._object_foundObjectClassNames)return;SC._object_foundObjectClassNames=!0;var e=[],t=!1,n=function(r,i,s){var o,u,a;s--;if(e.indexOf(i)>=0)return;e.push(i);for(var f in i){if(f=="__scope__")continue;if(f=="superclass")continue;f=="__SC__"&&(f="SC");if(!f.match(/^[A-Z0-9]/))continue;if(f=="SC"){if(t)continue;t=!0}o=r?[r,f].join("."):f,u=i[f];try{a=SC.typeOf(u)}catch(l){break}switch(a){case SC.T_CLASS:u._object_className||(u._object_className=o),s>=0&&n(o,u,s);break;case SC.T_OBJECT:s>=0&&n(o,u,s);break;case SC.T_HASH:(r||o==="SC")&&s>=0&&n(o,u,s);break;default:}}};window.__SC__=SC,n(null,window,2)}function LZ(e){return(e<0||e>9?"":"0")+e}function main(){CloudOS.main()}(function(e,t){function u(e){var t=o[e]={},n,r;e=e.split(/\s+/);for(n=0,r=e.length;n=0===n})}function V(e){var t=$.split("|"),n=e.createDocumentFragment();if(n.createElement)while(t.length)n.createElement(t.pop());return n}function at(e,t){return s.nodeName(e,"table")?e.getElementsByTagName("tbody")[0]||e.appendChild(e.ownerDocument.createElement("tbody")):e}function ft(e,t){if(t.nodeType!==1||!s.hasData(e))return;var n,r,i,o=s._data(e),u=s._data(t,o),a=o.events;if(a){delete u.handle,u.events={};for(n in a)for(r=0,i=a[n].length;r0){if(n!=="border")for(;i").appendTo(t),i=r.css("display");r.remove();if(i==="none"||i===""){At||(At=n.createElement("iframe"),At.frameBorder=At.width=At.height=0),t.appendChild(At);if(!Ot||!At.createElement)Ot=(At.contentWindow||At.contentDocument).document,Ot.write((s.support.boxModel?"":"")+""),Ot.close();r=Ot.createElement(e),Ot.body.appendChild(r),i=s.css(r,"display"),t.removeChild(At)}Lt[e]=i}return Lt[e]}function zt(e){return s.isWindow(e)?e:e.nodeType===9?e.defaultView||e.parentWindow:!1}var n=e.document ,r=e.navigator,i=e.location,s=function(){function H(){if(i.isReady)return;try{n.documentElement.doScroll("left")}catch(e){setTimeout(H,1);return}i.ready()}var i=function(e,t){return new i.fn.init(e,t,u)},s=e.jQuery,o=e.$,u,a=/^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/,f=/\S/,l=/^\s+/,c=/\s+$/,h=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,p=/^[\],:{}\s]*$/,d=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,v=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,m=/(?:^|:|,)(?:\s*\[)+/g,g=/(webkit)[ \/]([\w.]+)/,y=/(opera)(?:.*version)?[ \/]([\w.]+)/,b=/(msie) ([\w.]+)/,w=/(mozilla)(?:.*? rv:([\w.]+))?/,E=/-([a-z]|[0-9])/ig,S=/^-ms-/,x=function(e,t){return(t+"").toUpperCase()},T=r.userAgent,N,C,k,L=Object.prototype.toString,A=Object.prototype.hasOwnProperty,O=Array.prototype.push,M=Array.prototype.slice,_=String.prototype.trim,D=Array.prototype.indexOf,P={};return i.fn=i.prototype={constructor:i,init:function(e,r,s){var o,u,f,l;if(!e)return this;if(e.nodeType)return this.context=this[0]=e,this.length=1,this;if(e==="body"&&!r&&n.body)return this.context=n,this[0]=n.body,this.selector=e,this.length=1,this;if(typeof e=="string"){e.charAt(0)==="<"&&e.charAt(e.length-1)===">"&&e.length>=3?o=[null,e,null]:o=a.exec(e);if(o&&(o[1]||!r)){if(o[1])return r=r instanceof i?r[0]:r,l=r?r.ownerDocument||r:n,f=h.exec(e),f?i.isPlainObject(r)?(e=[n.createElement(f[1])],i.fn.attr.call(e,r,!0)):e=[l.createElement(f[1])]:(f=i.buildFragment([o[1]],[l]),e=(f.cacheable?i.clone(f.fragment):f.fragment).childNodes),i.merge(this,e);u=n.getElementById(o[2]);if(u&&u.parentNode){if(u.id!==o[2])return s.find(e);this.length=1 ,this[0]=u}return this.context=n,this.selector=e,this}return!r||r.jquery?(r||s).find(e):this.constructor(r).find(e)}return i.isFunction(e)?s.ready(e):(e.selector!==t&&(this.selector=e.selector,this.context=e.context),i.makeArray(e,this))},selector:"",jquery:"1.7.2",length:0,size:function(){return this.length},toArray:function(){return M.call(this,0)},get:function(e){return e==null?this.toArray():e<0?this[this.length+e]:this[e]},pushStack:function(e,t,n){var r=this.constructor();return i.isArray(e)?O.apply(r,e):i.merge(r,e),r.prevObject=this,r.context=this.context,t==="find"?r.selector=this.selector+(this.selector?" ":"")+n:t&&(r.selector=this.selector+"."+t+"("+n+")"),r},each:function(e,t){return i.each(this,e,t)},ready:function(e){return i.bindReady(),C.add(e),this},eq:function(e){return e=+e,e===-1?this.slice(e):this.slice(e,e+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(M.apply(this,arguments),"slice",M.call(arguments).join(","))},map:function(e){return this.pushStack(i.map(this,function(t,n){return e.call(t,n,t)}))},end:function(){return this.prevObject||this.constructor(null)},push:O,sort:[].sort,splice:[].splice},i.fn.init.prototype=i.fn,i.extend=i.fn.extend=function(){var e,n,r,s,o,u,a=arguments[0]||{},f=1,l=arguments.length,c=!1;typeof a=="boolean"&&(c=a,a=arguments[1]||{},f=2),typeof a!="object"&&!i.isFunction(a)&&(a={}),l===f&&(a=this,--f);for(;f0)return;C.fireWith(n,[i]),i.fn.trigger&&i(n).trigger("ready").off("ready")}},bindReady:function(){if(C)return;C=i.Callbacks("once memory");if(n.readyState==="complete")return setTimeout(i.ready,1);if(n.addEventListener)n.addEventListener("DOMContentLoaded",k,!1),e.addEventListener("load",i.ready,!1);else if(n.attachEvent){n.attachEvent("onreadystatechange",k),e.attachEvent("onload",i.ready);var t=!1;try{t=e.frameElement==null}catch(r){}n.documentElement.doScroll&&t&&H()}},isFunction:function(e){return i.type(e)==="function"},isArray:Array.isArray||function(e){return i.type(e)==="array"},isWindow:function(e){return e!=null&&e==e.window},isNumeric:function(e){return!isNaN(parseFloat(e))&&isFinite(e)},type:function(e){return e==null?String(e):P[L.call(e)]||"object"},isPlainObject:function(e){if(!e||i.type(e)!=="object"||e.nodeType||i.isWindow(e))return!1;try{if(e.constructor&&!A.call(e,"constructor")&&!A.call(e.constructor.prototype,"isPrototypeOf"))return!1}catch(n){return!1}var r;for(r in e);return r===t||A.call(e,r)},isEmptyObject:function(e){for(var t in e)return!1;return!0},error:function(e){throw new Error(e)},parseJSON:function(t){if(typeof t!="string"||!t)return null;t=i.trim(t);if(e.JSON&& e.JSON.parse)return e.JSON.parse(t);if(p.test(t.replace(d,"@").replace(v,"]").replace(m,"")))return(new Function("return "+t))();i.error("Invalid JSON: "+t)},parseXML:function(n){if(typeof n!="string"||!n)return null;var r,s;try{e.DOMParser?(s=new DOMParser,r=s.parseFromString(n,"text/xml")):(r=new ActiveXObject("Microsoft.XMLDOM"),r.async="false",r.loadXML(n))}catch(o){r=t}return(!r||!r.documentElement||r.getElementsByTagName("parsererror").length)&&i.error("Invalid XML: "+n),r},noop:function(){},globalEval:function(t){t&&f.test(t)&&(e.execScript||function(t){e.eval.call(e,t)})(t)},camelCase:function(e){return e.replace(S,"ms-").replace(E,x)},nodeName:function(e,t){return e.nodeName&&e.nodeName.toUpperCase()===t.toUpperCase()},each:function(e,n,r){var s,o=0,u=e.length,a=u===t||i.isFunction(e);if(r){if(a){for(s in e)if(n.apply(e[s],r)===!1)break}else for(;o0&&e[0]&&e[f-1]||f===0||i.isArray(e));if(l)for(;a1?a.call(arguments,0):n,--o||f.resolveWith(f,t)}}function h(e){return function(t){i[e]=arguments.length>1?a.call(arguments,0):t,f.notifyWith(l,i)}}var t=a.call(arguments,0),n=0,r=t.length,i=new Array(r),o=r,u=r,f=r<=1&&e&&s.isFunction(e.promise)?e:s.Deferred(),l=f.promise();if(r>1){for(;n
a",r=v.getElementsByTagName("*"),i=v.getElementsByTagName("a")[0];if(!r||!r.length||!i)return{};o=n.createElement("select"),u=o.appendChild(n.createElement("option")),a=v.getElementsByTagName("input")[0],t={leadingWhitespace:v.firstChild.nodeType===3,tbody:!v.getElementsByTagName("tbody").length,htmlSerialize:!!v.getElementsByTagName("link").length,style:/top/.test(i.getAttribute("style")),hrefNormalized:i.getAttribute("href")==="/a",opacity:/^0.55/.test(i.style.opacity),cssFloat:!!i.style.cssFloat,checkOn:a.value==="on",optSelected:u.selected,getSetAttribute:v.className!=="t",enctype:!!n.createElement("form").enctype,html5Clone:n.createElement("nav").cloneNode(!0).outerHTML!=="<:nav>",submitBubbles:!0,changeBubbles:!0,focusinBubbles:!1,deleteExpando:!0,noCloneEvent:!0,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableMarginRight:!0,pixelMargin:!0},s.boxModel=t.boxModel=n.compatMode==="CSS1Compat",a.checked=!0,t.noCloneChecked=a.cloneNode(!0).checked,o.disabled=!0,t.optDisabled=!u.disabled;try{delete v.test}catch(g){t.deleteExpando=!1}!v.addEventListener&&v.attachEvent&&v.fireEvent&&(v.attachEvent("onclick",function(){t.noCloneEvent=!1}),v.cloneNode(!0).fireEvent("onclick")),a=n.createElement("input"),a.value="t",a.setAttribute("type","radio"),t.radioValue=a.value==="t",a.setAttribute("checked","checked"),a.setAttribute("name","t"),v.appendChild (a),f=n.createDocumentFragment(),f.appendChild(v.lastChild),t.checkClone=f.cloneNode(!0).cloneNode(!0).lastChild.checked,t.appendChecked=a.checked,f.removeChild(a),f.appendChild(v);if(v.attachEvent)for(p in{submit:1,change:1,focusin:1})h="on"+p,d=h in v,d||(v.setAttribute(h,"return;"),d=typeof v[h]=="function"),t[p+"Bubbles"]=d;return f.removeChild(v),f=o=u=v=a=null,s(function(){var r,i,o,u,a,f,c,h,p,m,g,y,b,w=n.getElementsByTagName("body")[0];if(!w)return;h=1,b="padding:0;margin:0;border:",g="position:absolute;top:0;left:0;width:1px;height:1px;",y=b+"0;visibility:hidden;",p="style='"+g+b+"5px solid #000;",m="
"+""+"
",r=n.createElement("div"),r.style.cssText=y+"width:0;height:0;position:static;top:0;margin-top:"+h+"px",w.insertBefore(r,w.firstChild),v=n.createElement("div"),r.appendChild(v),v.innerHTML="
t
",l=v.getElementsByTagName("td"),d=l[0].offsetHeight===0,l[0].style.display="",l[1].style.display="none",t.reliableHiddenOffsets=d&&l[0].offsetHeight===0,e.getComputedStyle&&(v.innerHTML="",c=n.createElement("div"),c.style.width="0",c.style.marginRight="0",v.style.width="2px",v.appendChild(c),t.reliableMarginRight=(parseInt((e.getComputedStyle(c,null)||{marginRight:0}).marginRight,10)||0)===0),typeof v.style.zoom!="undefined"&&(v.innerHTML="",v.style.width=v.style.padding="1px",v.style.border=0,v.style.overflow="hidden",v.style.display="inline",v.style .zoom=1,t.inlineBlockNeedsLayout=v.offsetWidth===3,v.style.display="block",v.style.overflow="visible",v.innerHTML="
",t.shrinkWrapBlocks=v.offsetWidth!==3),v.style.cssText=g+y,v.innerHTML=m,i=v.firstChild,o=i.firstChild,a=i.nextSibling.firstChild.firstChild,f={doesNotAddBorder:o.offsetTop!==5,doesAddBorderForTableAndCells:a.offsetTop===5},o.style.position="fixed",o.style.top="20px",f.fixedPosition=o.offsetTop===20||o.offsetTop===15,o.style.position=o.style.top="",i.style.overflow="hidden",i.style.position="relative",f.subtractsBorderForOverflowNotVisible=o.offsetTop===-5,f.doesNotIncludeMarginInBodyOffset=w.offsetTop!==h,e.getComputedStyle&&(v.style.marginTop="1%",t.pixelMargin=(e.getComputedStyle(v,null)||{marginTop:0}).marginTop!=="1%"),typeof r.style.zoom!="undefined"&&(r.style.zoom=1),w.removeChild(r),c=v=r=null,s.extend(t,f)}),t}();var f=/^(?:\{.*\}|\[.*\])$/,l=/([A-Z])/g;s.extend({cache:{},uuid:0,expando:"jQuery"+(s.fn.jquery+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(e){return e=e.nodeType?s.cache[e[s.expando]]:e[s.expando],!!e&&!h(e)},data:function(e,n,r,i){if(!s.acceptData(e))return;var o,u,a,f=s.expando,l=typeof n=="string",c=e.nodeType,h=c?s.cache:e,p=c?e[f]:e[f]&&f,d=n==="events";if((!p||!h[p]||!d&&!i&&!h[p].data)&&l&&r===t)return;p||(c?e[f]=p=++s.uuid:p=f),h[p]||(h[p]={},c||(h[p].toJSON=s.noop));if(typeof n=="object"||typeof n=="function")i?h[p]=s.extend(h[p],n):h[p].data=s.extend(h[p].data,n);return o=u=h[p],i||(u.data||(u.data={}),u=u.data),r!==t&& (u[s.camelCase(n)]=r),d&&!u[n]?o.events:(l?(a=u[n],a==null&&(a=u[s.camelCase(n)])):a=u,a)},removeData:function(e,t,n){if(!s.acceptData(e))return;var r,i,o,u=s.expando,a=e.nodeType,f=a?s.cache:e,l=a?e[u]:u;if(!f[l])return;if(t){r=n?f[l]:f[l].data;if(r){s.isArray(t)||(t in r?t=[t]:(t=s.camelCase(t),t in r?t=[t]:t=t.split(" ")));for(i=0,o=t.length;i1,null,!1))},removeData:function(e){return this.each(function(){s.removeData(this,e) })}}),s.extend({_mark:function(e,t){e&&(t=(t||"fx")+"mark",s._data(e,t,(s._data(e,t)||0)+1))},_unmark:function(e,t,n){e!==!0&&(n=t,t=e,e=!1);if(t){n=n||"fx";var r=n+"mark",i=e?0:(s._data(t,r)||1)-1;i?s._data(t,r,i):(s.removeData(t,r,!0),p(t,n,"mark"))}},queue:function(e,t,n){var r;if(e)return t=(t||"fx")+"queue",r=s._data(e,t),n&&(!r||s.isArray(n)?r=s._data(e,t,s.makeArray(n)):r.push(n)),r||[]},dequeue:function(e,t){t=t||"fx";var n=s.queue(e,t),r=n.shift(),i={};r==="inprogress"&&(r=n.shift()),r&&(t==="fx"&&n.unshift("inprogress"),s._data(e,t+".run",i),r.call(e,function(){s.dequeue(e,t)},i)),n.length||(s.removeData(e,t+"queue "+t+".run",!0),p(e,t,"queue"))}}),s.fn.extend({queue:function(e,n){var r=2;return typeof e!="string"&&(n=e,e="fx",r--),arguments.length1)},removeAttr:function(e){return this.each(function(){s.removeAttr(this,e)})},prop:function(e,t){return s.access(this,s.prop,e,t,arguments.length>1)},removeProp:function(e){return e=s.propFix[e]||e,this.each(function(){try{this[e]=t,delete this[e]}catch(n){}})},addClass:function(e){var t,n,r,i,o,u,a;if(s.isFunction(e))return this.each(function(t){s(this).addClass(e.call(this,t,this.className))});if(e&&typeof e=="string"){t=e.split(v);for(n=0,r=this.length;n-1)return!0;return!1},val:function(e){var n,r,i,o=this[0];if(!arguments.length){if(o)return n=s.valHooks[o.type]||s.valHooks[o.nodeName.toLowerCase()],n&&"get"in n&&(r=n.get(o,"value"))!==t?r:(r=o.value,typeof r=="string"?r.replace(m,""):r==null?"":r);return}return i=s.isFunction(e),this.each(function(r){var o=s(this),u;if(this.nodeType!==1)return;i?u=e.call(this,r,o.val()):u=e,u==null?u="":typeof u=="number"?u+="":s.isArray(u)&&(u=s.map(u,function(e){return e==null?"":e+""})),n=s.valHooks[this.type]||s.valHooks[this.nodeName.toLowerCase()];if(!n||!("set"in n)||n.set(this,u,"value")===t)this.value=u})}}),s.extend({valHooks:{option:{get:function(e){var t=e.attributes.value;return!t||t.specified?e.value:e.text}},select:{get:function(e){var t,n,r,i,o=e.selectedIndex,u=[],a=e.options,f=e.type==="select-one";if(o<0)return null;n=f?o:0,r=f?o+1:a.length;for(;n=0}),n.length||(e.selectedIndex=-1),n}}},attrFn:{val:!0,css:!0,html:!0,text:!0,data:!0,width:!0,height:!0,offset:!0},attr:function(e,n,r,i){var o,u,a,f=e.nodeType;if(!e||f===3||f===8||f===2)return;if(i&&n in s.attrFn)return s(e)[n](r);if(typeof e.getAttribute=="undefined")return s.prop(e,n,r);a=f!==1||!s.isXMLDoc(e),a&&(n=n.toLowerCase(),u=s.attrHooks[n]||(w.test(n)?x:S));if(r!==t){if(r===null){s.removeAttr(e,n);return}return u&&"set"in u&&a&&(o=u.set(e,r,n))!==t?o:(e.setAttribute(n,""+r),r)}return u&&"get"in u&&a&&(o=u.get(e,n))!==null?o:(o=e.getAttribute(n),o===null?t:o)},removeAttr:function(e,t){var n,r,i,o,u,a=0;if(t&&e.nodeType===1){r=t.toLowerCase().split(v),o=r.length;for(;a=0}})});var N=/^(?:textarea|input|select)$/i,C=/^([^\.]*)?(?:\.(.+))?$/,k=/(?:^|\s)hover(\.\S+)?\b/,L=/^key/,A=/^(?:mouse|contextmenu)|click/,O=/^(?:focusinfocus|focusoutblur)$/,M=/^(\w*)(?:#([\w\-]+))?(?:\.([\w\-]+))?$/,_=function(e){var t=M.exec(e);return t&&(t[1]=(t[1]||"").toLowerCase(),t[3]=t[3]&&new RegExp("(?:^|\\s)"+t[3]+"(?:\\s|$)")),t},D=function(e,t){var n=e.attributes||{};return(!t[1]||e.nodeName.toLowerCase()===t[1])&&(!t[2]||(n.id||{}).value===t[2])&&(!t[3]||t[3].test((n["class"]||{}).value))},P=function(e){return s.event.special.hover?e:e.replace(k,"mouseenter$1 mouseleave$1")};s.event={add:function(e,n,r,i,o){var u,a,f,l,c,h,p,d,v,m,g,y;if(e.nodeType===3||e.nodeType===8||!n||!r||!(u=s._data(e)))return;r.handler&&(v=r,r=v.handler,o=v.selector),r.guid||(r.guid=s.guid++),f=u.events,f||(u.events=f={}),a=u.handle,a||(u.handle=a=function(e){return typeof s=="undefined"||!!e&&s.event.triggered===e.type?t:s.event.dispatch.apply(a.elem,arguments)},a.elem=e),n=s.trim(P(n)).split(" ");for(l=0;l=0&&(u=u.slice(0,-1),l=!0),u.indexOf(".")>=0&&(a=u.split("."),u=a.shift(),a.sort ());if((!i||s.event.customEvent[u])&&!s.event.global[u])return;n=typeof n=="object"?n[s.expando]?n:new s.Event(u,n):new s.Event(u),n.type=u,n.isTrigger=!0,n.exclusive=l,n.namespace=a.join("."),n.namespace_re=n.namespace?new RegExp("(^|\\.)"+a.join("\\.(?:.*\\.)?")+"(\\.|$)"):null,d=u.indexOf(":")<0?"on"+u:"";if(!i){f=s.cache;for(c in f)f[c].events&&f[c].events[u]&&s.event.trigger(n,r,f[c].handle.elem,!0);return}n.result=t,n.target||(n.target=i),r=r!=null?s.makeArray(r):[],r.unshift(n),v=s.event.special[u]||{};if(v.trigger&&v.trigger.apply(i,r)===!1)return;g=[[i,v.bindType||u]];if(!o&&!v.noBubble&&!s.isWindow(i)){y=v.delegateType||u,h=O.test(y+u)?i:i.parentNode,p=null;for(;h;h=h.parentNode)g.push([h,y]),p=h;p&&p===i.ownerDocument&&g.push([p.defaultView||p.parentWindow||e,y])}for(c=0;ci&&f.push({elem:this,matches:r.slice(i)});for(l=0;l0?this.on(t,null,e,n):this.trigger(t)},s.attrFn&&(s.attrFn[t]=!0),L.test(t)&&(s.event.fixHooks[t]=s.event.keyHooks),A.test(t)&&(s.event.fixHooks[t]=s.event.mouseHooks)}),function(){function S(e,t,n,i,s,o){for(var u=0,a=i.length;u0){l=f;break}}f=f[e]}i[u]=l}}}var e=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,r="sizcache"+(Math.random()+"").replace(".",""),i=0,o=Object.prototype.toString,u=!1,a=!0,f=/\\/g,l=/\r\n/g,c=/\W/;[0,0].sort(function(){return a=!1,0});var h=function(t,r,i,s){i=i||[],r=r||n;var u=r;if(r.nodeType!==1&&r.nodeType!==9)return[];if(!t||typeof t!="string")return i;var a,f,l,c,p,m,g,b,w=!0,E=h.isXML(r),S=[],x=t;do{e.exec(""),a=e.exec(x);if(a){x=a[3],S.push(a[1]);if(a[2]){c=a[3];break}}}while(a);if(S.length>1&&v.exec(t))if(S.length===2&&d.relative[S[0]])f=T(S[0]+S[1],r,s);else{f=d.relative[S[0]]?[r]:h(S.shift(),r);while(S.length)t=S.shift(),d.relative[t]&&(t+=S.shift()),f=T(t,f,s)}else{!s&&S.length>1&&r.nodeType===9&&!E&&d.match.ID.test(S[0])&&!d.match.ID.test(S[S.length-1])&&(p=h.find(S.shift(),r,E),r=p.expr?h.filter(p.expr,p.set)[0]:p.set[0]);if(r){p=s?{expr:S.pop(),set:y(s)}:h.find(S.pop(),S.length!==1||S[0]!=="~"&&S[0]!=="+"||!r.parentNode?r:r.parentNode,E),f=p.expr?h.filter(p.expr,p.set):p.set,S.length>0?l=y(f):w=!1;while(S.length)m=S.pop(),g=m,d.relative[m]?g=S.pop():m="",g==null&&(g=r),d.relative [m](l,g,E)}else l=S=[]}l||(l=f),l||h.error(m||t);if(o.call(l)==="[object Array]")if(!w)i.push.apply(i,l);else if(r&&r.nodeType===1)for(b=0;l[b]!=null;b++)l[b]&&(l[b]===!0||l[b].nodeType===1&&h.contains(r,l[b]))&&i.push(f[b]);else for(b=0;l[b]!=null;b++)l[b]&&l[b].nodeType===1&&i.push(f[b]);else y(l,i);return c&&(h(c,u,i,s),h.uniqueSort(i)),i};h.uniqueSort=function(e){if(w){u=a,e.sort(w);if(u)for(var t=1;t0},h.find=function(e,t,n){var r,i,s,o,u,a;if(!e)return[];for(i=0,s=d.order.length;i":function(e,t){var n,r=typeof t=="string",i=0,s=e.length;if(r&&!c.test(t)){t=t.toLowerCase();for(;i=0)?n||r.push(u):n&&(t[o]=!1));return!1},ID:function(e){return e[1].replace(f,"")},TAG:function(e,t){return e[1].replace(f,"").toLowerCase()},CHILD:function(e){if(e[1]==="nth"){e[2]||h.error(e[0]),e[2]=e[2].replace(/^\+|\s*/g,"");var t=/(-?)(\d*)(?:n([+\-]?\d*))?/.exec(e[2]==="even"&&"2n"||e[2]==="odd"&&"2n+1"||!/\D/.test(e[2])&&"0n+"+e[2]||e[2]);e[2]=t[1]+(t[2]||1)-0,e[3]=t[3]-0}else e[2]&&h.error(e[0]);return e[0]=i++,e},ATTR:function(e,t,n,r,i,s){var o=e[1]=e[1].replace(f,"");return!s&&d.attrMap[o]&&(e[1]=d.attrMap[o]),e[4]=(e[4]||e[5]||"").replace(f,""),e[2]==="~="&&(e[4]=" "+e[4]+" "),e},PSEUDO:function(t,n,r,i,s){if(t[1]==="not"){if(!((e.exec(t[3 ])||"").length>1||/^\w/.test(t[3]))){var o=h.filter(t[3],n,r,!0^s);return r||i.push.apply(i,o),!1}t[3]=h(t[3],null,null,n)}else if(d.match.POS.test(t[0])||d.match.CHILD.test(t[0]))return!0;return t},POS:function(e){return e.unshift(!0),e}},filters:{enabled:function(e){return e.disabled===!1&&e.type!=="hidden"},disabled:function(e){return e.disabled===!0},checked:function(e){return e.checked===!0},selected:function(e){return e.parentNode&&e.parentNode.selectedIndex,e.selected===!0},parent:function(e){return!!e.firstChild},empty:function(e){return!e.firstChild},has:function(e,t,n){return!!h(n[3],e).length},header:function(e){return/h\d/i.test(e.nodeName)},text:function(e){var t=e.getAttribute("type"),n=e.type;return e.nodeName.toLowerCase()==="input"&&"text"===n&&(t===n||t===null)},radio:function(e){return e.nodeName.toLowerCase()==="input"&&"radio"===e.type},checkbox:function(e){return e.nodeName.toLowerCase()==="input"&&"checkbox"===e.type},file:function(e){return e.nodeName.toLowerCase()==="input"&&"file"===e.type},password:function(e){return e.nodeName.toLowerCase()==="input"&&"password"===e.type},submit:function(e){var t=e.nodeName.toLowerCase();return(t==="input"||t==="button")&&"submit"===e.type},image:function(e){return e.nodeName.toLowerCase()==="input"&&"image"===e.type},reset:function(e){var t=e.nodeName.toLowerCase();return(t==="input"||t==="button")&&"reset"===e.type},button:function(e){var t=e.nodeName.toLowerCase();return t==="input"&&"button"===e.type||t==="button"},input:function(e){return/input|select|textarea|button/i.test(e.nodeName)},focus:function(e){return e=== e.ownerDocument.activeElement}},setFilters:{first:function(e,t){return t===0},last:function(e,t,n,r){return t===r.length-1},even:function(e,t){return t%2===0},odd:function(e,t){return t%2===1},lt:function(e,t,n){return tn[3]-0},nth:function(e,t,n){return n[3]-0===t},eq:function(e,t,n){return n[3]-0===t}},filter:{PSEUDO:function(e,t,n,r){var i=t[1],s=d.filters[i];if(s)return s(e,n,t,r);if(i==="contains")return(e.textContent||e.innerText||p([e])||"").indexOf(t[3])>=0;if(i==="not"){var o=t[3];for(var u=0,a=o.length;u=0}},ID:function(e,t){return e.nodeType===1&&e.getAttribute("id")===t},TAG:function(e,t){return t==="*"&&e.nodeType===1||!!e.nodeName&&e.nodeName.toLowerCase()===t},CLASS:function(e,t){return(" "+(e.className||e.getAttribute("class"))+" ").indexOf(t)>-1},ATTR:function(e,t){var n=t[1],r=h.attr?h.attr(e,n):d.attrHandle[n]?d.attrHandle[n](e):e[n]!=null?e[n]:e.getAttribute(n),i=r+"",s=t[2],o=t[4];return r==null?s==="!=":!s&&h.attr?r!=null:s==="="?i===o:s==="*="?i.indexOf(o)>=0:s==="~="?(" "+i+" ").indexOf(o)>=0:o?s==="!="?i!==o:s==="^="? i.indexOf(o)===0:s==="$="?i.substr(i.length-o.length)===o:s==="|="?i===o||i.substr(0,o.length+1)===o+"-":!1:i&&r!==!1},POS:function(e,t,n,r){var i=t[2],s=d.setFilters[i];if(s)return s(e,n,t,r)}}},v=d.match.POS,m=function(e,t){return"\\"+(t-0+1)};for(var g in d.match)d.match[g]=new RegExp(d.match[g].source+/(?![^\[]*\])(?![^\(]*\))/.source),d.leftMatch[g]=new RegExp(/(^(?:.|\r|\n)*?)/.source+d.match[g].source.replace(/\\(\d+)/g,m));d.match.globalPOS=v;var y=function(e,t){return e=Array.prototype.slice.call(e,0),t?(t.push.apply(t,e),t):e};try{Array.prototype.slice.call(n.documentElement.childNodes,0)[0].nodeType}catch(b){y=function(e,t){var n=0,r=t||[];if(o.call(e)==="[object Array]")Array.prototype.push.apply(r,e);else if(typeof e.length=="number")for(var i=e.length;n",i.insertBefore(e,i.firstChild),n.getElementById(r)&&(d.find.ID=function(e,n,r){if(typeof n.getElementById!="undefined"&&!r){var i=n.getElementById(e[1]);return i?i.id===e[1]||typeof i.getAttributeNode!="undefined"&&i.getAttributeNode("id").nodeValue===e[1]?[i]:t:[]}},d.filter.ID=function(e,t){var n=typeof e.getAttributeNode!="undefined"&&e.getAttributeNode("id");return e.nodeType===1&&n&&n.nodeValue===t}),i.removeChild(e),i=e=null}(),function(){var e=n.createElement("div");e.appendChild(n.createComment("")),e.getElementsByTagName("*").length>0&&(d.find.TAG=function(e,t){var n=t.getElementsByTagName(e[1]);if(e[1]==="*"){var r=[];for(var i=0;n[i];i++)n[i].nodeType===1&&r.push(n[i]);n=r}return n}),e.innerHTML="",e.firstChild&&typeof e.firstChild.getAttribute!="undefined"&&e.firstChild.getAttribute("href")!=="#"&&(d.attrHandle.href=function(e){return e.getAttribute("href",2)}),e=null}(),n.querySelectorAll&&function(){var e=h,t=n.createElement("div"),r="__sizzle__";t.innerHTML="

";if(t.querySelectorAll&&t.querySelectorAll(".TEST").length===0)return;h=function(t,i,s,o){i=i||n;if(!o&&!h.isXML(i)){var u=/^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec(t);if(u&&(i.nodeType===1||i.nodeType===9)){if(u[1])return y(i.getElementsByTagName(t),s);if(u[2]&&d.find.CLASS&&i.getElementsByClassName)return y(i.getElementsByClassName(u[2]),s)}if(i.nodeType===9){if(t==="body"&&i.body)return y([i.body],s);if(u&&u[3]){var a=i.getElementById(u[3]);if(!a||!a.parentNode)return y([],s); if(a.id===u[3])return y([a],s)}try{return y(i.querySelectorAll(t),s)}catch(f){}}else if(i.nodeType===1&&i.nodeName.toLowerCase()!=="object"){var l=i,c=i.getAttribute("id"),p=c||r,v=i.parentNode,m=/^\s*[+~]/.test(t);c?p=p.replace(/'/g,"\\$&"):i.setAttribute("id",p),m&&v&&(i=i.parentNode);try{if(!m||v)return y(i.querySelectorAll("[id='"+p+"'] "+t),s)}catch(g){}finally{c||l.removeAttribute("id")}}}return e(t,i,s,o)};for(var i in e)h[i]=e[i];t=null}(),function(){var e=n.documentElement,t=e.matchesSelector||e.mozMatchesSelector||e.webkitMatchesSelector||e.msMatchesSelector;if(t){var r=!t.call(n.createElement("div"),"div"),i=!1;try{t.call(n.documentElement,"[test!='']:sizzle")}catch(s){i=!0}h.matchesSelector=function(e,n){n=n.replace(/\=\s*([^'"\]]*)\s*\]/g,"='$1']");if(!h.isXML(e))try{if(i||!d.match.PSEUDO.test(n)&&!/!=/.test(n)){var s=t.call(e,n);if(s||!r||e.document&&e.document.nodeType!==11)return s}}catch(o){}return h(n,null,null,[e]).length>0}}}(),function(){var e=n.createElement("div");e.innerHTML="
";if(!e.getElementsByClassName||e.getElementsByClassName("e").length===0)return;e.lastChild.className="e";if(e.getElementsByClassName("e").length===1)return;d.order.splice(1,0,"CLASS"),d.find.CLASS=function(e,t,n){if(typeof t.getElementsByClassName!="undefined"&&!n)return t.getElementsByClassName(e[1])},e=null}(),n.documentElement.contains?h.contains=function(e,t){return e!==t&&(e.contains?e.contains(t):!0)}:n.documentElement.compareDocumentPosition?h.contains=function(e,t){return!!(e.compareDocumentPosition(t)&16)}:h.contains=function( ){return!1},h.isXML=function(e){var t=(e?e.ownerDocument||e:0).documentElement;return t?t.nodeName!=="HTML":!1};var T=function(e,t,n){var r,i=[],s="",o=t.nodeType?[t]:t;while(r=d.match.PSEUDO.exec(e))s+=r[0],e=e.replace(d.match.PSEUDO,"");e=d.relative[e]?e+"*":e;for(var u=0,a=o.length;u0)for(u=o;u=0:s.filter(e,this).length>0:this.filter(e).length>0)},closest:function(e,t){var n=[],r,i,o=this[0];if(s.isArray(e)){var u=1;while(o&&o.ownerDocument&&o!==t){for(r=0;r-1:s.find.matchesSelector(o,e)){n.push(o);break}o=o.parentNode;if(!o||!o.ownerDocument||o===t||o.nodeType===11)break}}return n=n.length>1?s.unique(n):n,this.pushStack(n,"closest",e)},index:function(e){return e?typeof e=="string"?s.inArray(this[0],s(e)):s.inArray(e.jquery?e[0]:e,this):this[0]&&this[0].parentNode?this.prevAll().length:-1},add:function(e,t){var n=typeof e=="string"?s(e,t):s.makeArray(e&&e.nodeType?[e]:e),r=s.merge(this.get(),n);return this.pushStack(W(n[0])||W(r[0])?r:s.unique(r))},andSelf:function(){return this.add(this.prevObject)}}),s.each({parent:function(e){var t=e.parentNode;return t&&t.nodeType!==11?t:null},parents:function(e){return s.dir(e,"parentNode")},parentsUntil:function(e,t,n){return s.dir(e,"parentNode",n)},next:function(e){return s.nth(e,2,"nextSibling")},prev:function(e){return s.nth(e,2,"previousSibling")},nextAll:function(e){return s.dir(e,"nextSibling")},prevAll:function(e){return s.dir(e,"previousSibling")},nextUntil:function(e,t,n){return s.dir(e,"nextSibling",n)},prevUntil:function(e,t,n){return s.dir(e,"previousSibling",n)},siblings:function(e){return s.sibling((e.parentNode||{}).firstChild,e)},children:function(e){return s.sibling(e.firstChild)},contents:function(e){return s.nodeName(e,"iframe")?e.contentDocument||e.contentWindow.document:s.makeArray(e.childNodes)}},function(e,t){s.fn[e]=function(n,r){var i=s.map(this,t,n);return j.test(e)||(r=n),r&&typeof r=="string"&&(i=s.filter (r,i)),i=this.length>1&&!z[e]?s.unique(i):i,(this.length>1||I.test(r))&&F.test(e)&&(i=i.reverse()),this.pushStack(i,e,R.call(arguments).join(","))}}),s.extend({filter:function(e,t,n){return n&&(e=":not("+e+")"),t.length===1?s.find.matchesSelector(t[0],e)?[t[0]]:[]:s.find.matches(e,t)},dir:function(e,n,r){var i=[],o=e[n];while(o&&o.nodeType!==9&&(r===t||o.nodeType!==1||!s(o).is(r)))o.nodeType===1&&i.push(o),o=o[n];return i},nth:function(e,t,n,r){t=t||1;var i=0;for(;e;e=e[n])if(e.nodeType===1&&++i===t)break;return e},sibling:function(e,t){var n=[];for(;e;e=e.nextSibling)e.nodeType===1&&e!==t&&n.push(e);return n}});var $="abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",J=/ jQuery\d+="(?:\d+|null)"/g,K=/^\s+/,Q=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,G=/<([\w:]+)/,Y=/]","i"),rt=/checked\s*(?:[^=]|=\s*.checked.)/i,it=/\/(java|ecma)script/i,st=/^\s*",""],legend:[1,"
","
"],thead:[1,"","
"],tr:[2,"","
"],td:[3,"","
"],col:[2,"","
"],area:[1,"",""],_default:[0,"",""]},ut=V(n);ot.optgroup=ot.option,ot.tbody=ot.tfoot=ot.colgroup=ot.caption=ot.thead,ot.th=ot.td,s.support.htmlSerialize||(ot._default= [1,"div
","
"]),s.fn.extend({text:function(e){return s.access(this,function(e){return e===t?s.text(this):this.empty().append((this[0]&&this[0].ownerDocument||n).createTextNode(e))},null,e,arguments.length)},wrapAll:function(e){if(s.isFunction(e))return this.each(function(t){s(this).wrapAll(e.call(this,t))});if(this[0]){var t=s(e,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&t.insertBefore(this[0]),t.map(function(){var e=this;while(e.firstChild&&e.firstChild.nodeType===1)e=e.firstChild;return e}).append(this)}return this},wrapInner:function(e){return s.isFunction(e)?this.each(function(t){s(this).wrapInner(e.call(this,t))}):this.each(function(){var t=s(this),n=t.contents();n.length?n.wrapAll(e):t.append(e)})},wrap:function(e){var t=s.isFunction(e);return this.each(function(n){s(this).wrapAll(t?e.call(this,n):e)})},unwrap:function(){return this.parent().each(function(){s.nodeName(this,"body")||s(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(e){this.nodeType===1&&this.appendChild(e)})},prepend:function(){return this.domManip(arguments,!0,function(e){this.nodeType===1&&this.insertBefore(e,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(e){this.parentNode.insertBefore(e,this)});if(arguments.length){var e=s.clean(arguments);return e.push.apply(e,this.toArray()),this.pushStack(e,"before",arguments)}},after:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(e){this.parentNode.insertBefore(e,this.nextSibling) });if(arguments.length){var e=this.pushStack(this,"after",arguments);return e.push.apply(e,s.clean(arguments)),e}},remove:function(e,t){for(var n=0,r;(r=this[n])!=null;n++)if(!e||s.filter(e,[r]).length)!t&&r.nodeType===1&&(s.cleanData(r.getElementsByTagName("*")),s.cleanData([r])),r.parentNode&&r.parentNode.removeChild(r);return this},empty:function(){for(var e=0,t;(t=this[e])!=null;e++){t.nodeType===1&&s.cleanData(t.getElementsByTagName("*"));while(t.firstChild)t.removeChild(t.firstChild)}return this},clone:function(e,t){return e=e==null?!1:e,t=t==null?e:t,this.map(function(){return s.clone(this,e,t)})},html:function(e){return s.access(this,function(e){var n=this[0]||{},r=0,i=this.length;if(e===t)return n.nodeType===1?n.innerHTML.replace(J,""):null;if(typeof e=="string"&&!et.test(e)&&(s.support.leadingWhitespace||!K.test(e))&&!ot[(G.exec(e)||["",""])[1].toLowerCase()]){e=e.replace(Q,"<$1>");try{for(;r1&&c0?this.clone(!0):this).get ();s(i[u])[t](f),r=r.concat(f)}return this.pushStack(r,e,i.selector)}}),s.extend({clone:function(e,t,n){var r,i,o,u=s.support.html5Clone||s.isXMLDoc(e)||!nt.test("<"+e.nodeName+">")?e.cloneNode(!0):dt(e);if((!s.support.noCloneEvent||!s.support.noCloneChecked)&&(e.nodeType===1||e.nodeType===11)&&!s.isXMLDoc(e)){lt(e,u),r=ct(e),i=ct(u);for(o=0;r[o];++o)i[o]&<(r[o],i[o])}if(t){ft(e,u);if(n){r=ct(e),i=ct(u);for(o=0;r[o];++o)ft(r[o],i[o])}}return r=i=null,u},clean:function(e,t,r,i){var o,u,a,f=[];t=t||n,typeof t.createElement=="undefined"&&(t=t.ownerDocument||t[0]&&t[0].ownerDocument||n);for(var l=0,c;(c=e[l])!=null;l++){typeof c=="number"&&(c+="");if(!c)continue;if(typeof c=="string")if(!Z.test(c))c=t.createTextNode(c);else{c=c.replace(Q,"<$1>");var h=(G.exec(c)||["",""])[1].toLowerCase(),p=ot[h]||ot._default,d=p[0],v=t.createElement("div"),m=ut.childNodes,g;t===n?ut.appendChild(v):V(t).appendChild(v),v.innerHTML=p[1]+c+p[2];while(d--)v=v.lastChild;if(!s.support.tbody){var y=Y.test(c),b=h==="table"&&!y?v.firstChild&&v.firstChild.childNodes:p[1]===""&&!y?v.childNodes:[];for(a=b.length-1;a>=0;--a)s.nodeName(b[a],"tbody")&&!b[a].childNodes.length&&b[a].parentNode.removeChild(b[a])}!s.support.leadingWhitespace&&K.test(c)&&v.insertBefore(t.createTextNode(K.exec(c)[0]),v.firstChild),c=v.childNodes,v&&(v.parentNode.removeChild(v),m.length>0&&(g=m[m.length-1],g&&g.parentNode&&g.parentNode.removeChild(g)))}var w;if(!s.support.appendChecked)if(c[0]&&typeof (w=c.length)=="number")for(a=0;a1)},s.extend({cssHooks:{opacity:{get:function(e,t){if(t){var n=Tt(e,"opacity");return n===""?"1":n}return e.style.opacity}}},cssNumber:{fillOpacity:!0,fontWeight:!0,lineHeight:!0,opacity:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":s.support.cssFloat?"cssFloat":"styleFloat"},style:function(e,n,r,i){if(!e||e.nodeType===3||e.nodeType===8||!e.style)return;var o,u,a=s.camelCase(n),f=e.style,l=s.cssHooks[a];n=s.cssProps[a]||a;if(r===t)return l&&"get"in l&&(o=l.get(e,!1,i))!==t?o: f[n];u=typeof r,u==="string"&&(o=wt.exec(r))&&(r=+(o[1]+1)*+o[2]+parseFloat(s.css(e,n)),u="number");if(r==null||u==="number"&&isNaN(r))return;u==="number"&&!s.cssNumber[a]&&(r+="px");if(!l||!("set"in l)||(r=l.set(e,r))!==t)try{f[n]=r}catch(c){}},css:function(e,n,r){var i,o;n=s.camelCase(n),o=s.cssHooks[n],n=s.cssProps[n]||n,n==="cssFloat"&&(n="float");if(o&&"get"in o&&(i=o.get(e,!0,r))!==t)return i;if(Tt)return Tt(e,n)},swap:function(e,t,n){var r={},i,s;for(s in t)r[s]=e.style[s],e.style[s]=t[s];i=n.call(e);for(s in t)e.style[s]=r[s];return i}}),s.curCSS=s.css,n.defaultView&&n.defaultView.getComputedStyle&&(Nt=function(e,t){var n,r,i,o,u=e.style;return t=t.replace(gt,"-$1").toLowerCase(),(r=e.ownerDocument.defaultView)&&(i=r.getComputedStyle(e,null))&&(n=i.getPropertyValue(t),n===""&&!s.contains(e.ownerDocument.documentElement,e)&&(n=s.style(e,t))),!s.support.pixelMargin&&i&&Et.test(t)&&bt.test(n)&&(o=u.width,u.width=n,n=i.width,u.width=o),n}),n.documentElement.currentStyle&&(Ct=function(e,t){var n,r,i,s=e.currentStyle&&e.currentStyle[t],o=e.style;return s==null&&o&&(i=o[t])&&(s=i),bt.test(s)&&(n=o.left,r=e.runtimeStyle&&e.runtimeStyle.left,r&&(e.runtimeStyle.left=e.currentStyle.left),o.left=t==="fontSize"?"1em":s,s=o.pixelLeft+"px",o.left=n,r&&(e.runtimeStyle.left=r)),s===""?"auto":s}),Tt=Nt||Ct,s.each(["height","width"],function(e,t){s.cssHooks[t]={get:function(e,n,r){if(n)return e.offsetWidth!==0?kt(e,t,r):s.swap(e,St,function(){return kt(e,t,r)})},set:function(e,t){return yt.test(t)?t+"px":t}}}),s.support.opacity||(s.cssHooks.opacity={get:function(e,t){return mt.test((t&& e.currentStyle?e.currentStyle.filter:e.style.filter)||"")?parseFloat(RegExp.$1)/100+"":t?"1":""},set:function(e,t){var n=e.style,r=e.currentStyle,i=s.isNumeric(t)?"alpha(opacity="+t*100+")":"",o=r&&r.filter||n.filter||"";n.zoom=1;if(t>=1&&s.trim(o.replace(vt,""))===""){n.removeAttribute("filter");if(r&&!r.filter)return}n.filter=vt.test(o)?o.replace(vt,i):o+" "+i}}),s(function(){s.support.reliableMarginRight||(s.cssHooks.marginRight={get:function(e,t){return s.swap(e,{display:"inline-block"},function(){return t?Tt(e,"margin-right"):e.style.marginRight})}})}),s.expr&&s.expr.filters&&(s.expr.filters.hidden=function(e){var t=e.offsetWidth,n=e.offsetHeight;return t===0&&n===0||!s.support.reliableHiddenOffsets&&(e.style&&e.style.display||s.css(e,"display"))==="none"},s.expr.filters.visible=function(e){return!s.expr.filters.hidden(e)}),s.each({margin:"",padding:"",border:"Width"},function(e,t){s.cssHooks[e+t]={expand:function(n){var r,i=typeof n=="string"?n.split(" "):[n],s={};for(r=0;r<4;r++)s[e+xt[r]+t]=i[r]||i[r-2]||i[0];return s}}});var Lt={},At,Ot,Mt=/^(?:toggle|show|hide)$/,_t=/^([+\-]=)?([\d+.\-]+)([a-z%]*)$/i,Dt,Pt=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]],Ht;s.fn.extend({show:function(e,t,n){var r,i;if(e||e===0)return this.animate(Ft("show",3),e,t,n);for(var o=0,u=this.length;o=a.duration+this.startTime){this.now=this.end,this.pos=this.state=1,this.update(),a.animatedProperties[this.prop]=!0;for(t in a.animatedProperties)a.animatedProperties[t]!==!0&&(o=!1);if(o){a.overflow!=null&&!s.support.shrinkWrapBlocks&&s.each(["","X","Y"],function(e,t){u.style["overflow"+t]=a.overflow[e]}),a.hide&&s(u).hide();if(a.hide||a.show)for(t in a.animatedProperties)s.style(u,t,a.orig[t]),s.removeData(u,"fxshow"+t,!0),s.removeData(u,"toggle"+t,!0);r=a.complete,r&&(a.complete=!1,r.call(u))}return!1}return a.duration==Infinity?this.now=i:(n=i-this.startTime,this.state=n/a.duration,this.pos=s.easing[a.animatedProperties[this.prop]](this.state,n,0,1,a.duration),this.now=this.start+(this.end-this.start)*this.pos),this.update(),!0}},s.extend(s.fx,{tick:function(){var e,t=s.timers,n=0;for(;n-1,l={},c={},h,p;f?(c=i.position(),h=c.top,p=c.left):(h=parseFloat(u)||0,p=parseFloat(a)||0),s.isFunction(t)&&(t=t.call(e,n,o)),t.top!=null&&(l.top=t.top-o.top+h),t.left!=null&&(l.left=t.left-o.left+p),"using"in t?t.using.call(e,l):i.css(l)}},s.fn.extend({position:function(){if(!this[0])return null;var e=this[0],t=this.offsetParent(),n=this.offset(),r=Ut.test(t[0].nodeName)?{top:0,left:0}:t.offset();return n.top-=parseFloat(s.css(e,"marginTop"))||0,n.left-=parseFloat(s.css(e,"marginLeft"))||0,r.top+=parseFloat(s.css(t[0],"borderTopWidth"))||0,r.left+=parseFloat(s.css(t[0],"borderLeftWidth"))||0,{top:n.top-r.top,left:n.left-r.left}},offsetParent:function(){return this.map(function(){var e=this.offsetParent||n.body;while(e&&!Ut.test(e.nodeName)&&s.css(e,"position")==="static")e=e.offsetParent;return e})}}),s.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(e,n){var r=/Y/.test(n);s.fn[e]=function(i){return s.access(this,function(e,i,o){var u=zt(e);if(o===t)return u?n in u?u[n]:s.support.boxModel&&u.document.documentElement[i]||u.document.body[i]:e[i];u?u.scrollTo(r?s(u) .scrollLeft():o,r?o:s(u).scrollTop()):e[i]=o},e,i,arguments.length,null)}}),s.each({Height:"height",Width:"width"},function(e,n){var r="client"+e,i="scroll"+e,o="offset"+e;s.fn["inner"+e]=function(){var e=this[0];return e?e.style?parseFloat(s.css(e,n,"padding")):this[n]():null},s.fn["outer"+e]=function(e){var t=this[0];return t?t.style?parseFloat(s.css(t,n,e?"margin":"border")):this[n]():null},s.fn[n]=function(e){return s.access(this,function(e,n,u){var a,f,l,c;if(s.isWindow(e))return a=e.document,f=a.documentElement[r],s.support.boxModel&&f||a.body&&a.body[r]||f;if(e.nodeType===9)return a=e.documentElement,a[r]>=a[i]?a[r]:Math.max(e.body[i],a[i],e.body[o],a[o]);if(u===t)return l=s.css(e,n),c=parseFloat(l),s.isNumeric(c)?c:l;s(e).css(n,u)},n,e,arguments.length,null)}}),e.jQuery=e.$=s,typeof define=="function"&&define.amd&&define.amd.jQuery&&define("jquery",[],function(){return s})})(window),jQuery.Buffer=function(){function t(e){for(var t in e)typeof e[t]=="function"&&(e[t].displayName=t)}var e=function(e){e&&this.assign(e),this._bufferedCommandList=[],this._bufferedCommands={}};return e._buffers=[],e._pool=[],e.bufferForElement=function(e){return e._jquery_buffer?e._jquery_buffer:this.bufferFromPool().assign(e)},e.bufferFromPool=function(){var t=null;return this._pool.length===0?t=new e:t=this._pool.pop(),e._buffers.push(t),this.flushingScheduled||this.scheduleFlushing(),t},e.returnToPool=function(e){e.unassign(),this._pool.push(e)},e.scheduleFlushing=function(){this.flushingScheduled=!0},e.flush=function(){var e=this._buffers,t,n=e.length;for(t=0;t0){SC.browser.msie&&(e=e.toLowerCase());var t={},n=this._STYLE_REGEX,r;n.lastIndex=0;while(r=n.exec(e))t[this._camelizeStyleName(r[1])]=r[2];return t}return{}},e.prototype.resetStyles=function(e){var t=this.bufferedCommand("flushStyles");t._styles=this._loadStyles(e||" ")},e.prototype.styles=function(){var e=this.bufferedCommand("flushStyles");return e._styles||(e._styles=this._loadStyles()),e._styles},e.prototype.css=function(e,t){if(typeof e=="object"){for(var n in e)this.css(n,e[n]);return}var r=this.bufferedCommand("flushStyles");r._styles||(r._styles=this._loadStyles()),r._styles[e]=t},e.prototype.flushStyles=function(e){var t=e._styles,n="",r,i,s=[],o=0;for(r in t){if(!t.hasOwnProperty(r))continue;i=t[r];if(i===null)continue;typeof i=="number"&&r!=="zIndex"&&r!=="fontWeight"&&r!=="opacity"&&(i+="px"),s [o++]=this._dasherizeStyleName(r)+": "+i}this.$().attr("style",s.join("; "))},e.prototype._hashFromClassNames=function(e){typeof e=="string"&&(e=e.split(" "));var t,n=e.length,r={};for(t=0;t=0)t[n]=e[n];return t},guidKey:"SproutCore"+(SC.VERSION+Math.random()).replace(/\D/g,""),_guidPrefixes:{number:"nu",string:"st"},_guidCaches:{number:{},string:{}},_numberGuids:[],_stringGuids:{},_keyCache:{},guidFor:function(e){var t,n,r=typeof e;if(e===null)return"(null)";if(r===SC.T_STRING||r===SC.T_NUMBER)return t=this._guidCaches[r],n=t[e],n||(n="st"+jQuery.uuid++,t[e]=n),n;if(e===undefined)return"(undefined)";if(r===SC.T_BOOL)return e?"(true)":"(false)";var i=this.guidKey,s=e[i];return s?s:e===Object?"(Object)":e===Array?"(Array)":SC.generateGuid(e,"sc")},keyFor:function(e,t){var n,r=this._keyCache[e];return r||(r=this._keyCache[e]={}),n=r[t],n||(n=r[t]=e+"_"+t),n},generateGuid:function(e,t){var n=t+jQuery.uuid++;return e&&(e[this.guidKey]=n),n},hashFor:function(){var e=arguments.length,t="",n,r,i;for(i=0;if)return 1;switch(n){case SC.T_BOOL:case SC.T_NUMBER:if(et)return 1;return 0;case SC.T_STRING:var l=e.localeCompare(t);if(l<0)return-1;if(l>0)return 1;return 0;case SC.T_ARRAY:var c=e.length,h=t.length,p=Math.min(c,h),d=0,v=0,m=arguments.callee;while(d===0&&vh)return 1;return 0;case SC.T_OBJECT:if(e.constructor.isComparable===YES)return e.constructor.compare(e,t);return 0;default:return 0}},K:function(){return this},EMPTY_ARRAY:[],EMPTY_HASH:{},EMPTY_RANGE:{start:0,length:0},beget:function(e){if(e===null||e===undefined)return null;var t=SC.K;t.prototype=e;var n=new t;return t.prototype=null,typeof e.didBeget=="function"&&(n=e.didBeget(n)),n[this.guidKey]=null,n},copy:function(e,t){var n=e,r;if(e){if(e.isCopyable)return e.copy(t);if(e.clone)return e.clone()}switch(jQuery.type(e)){case"array":n=e.slice();if(t){r=n.length;while(r--)n[r]=SC.copy(n[r],!0)}break;case"object":n={};for(var i in e)n[i]=t?SC.copy(e[i],!0):e[i]}return n},merge:function(){var e={},t=arguments.length,n;for(n=0;n=0?e.slice(r+1):e;var i=this.objectForPropertyPath(e,t,r);return i&&n?[i,n]:null},objectForPropertyPath:function(e,t,n){var r,i,s,o;t||(t=window);if(typeof e=="string"){n===undefined&&(n=e.length),r=0;while(t&&rn)i=n;s=e.slice(r,i),t=t.get?t.get(s):t[s],r=i+1}r=0){var s=t[n];s.indexOf(".")<0&&s.indexOf("*")<0?(r||(r=e.localPropertyPaths=[]),r.push(s)):(i||(i=e.propertyPaths=[]),i.push(s))}return e}},SC.mixin(Function.prototype,{property:function(){return SC.Function.property(this,arguments)},cacheable:function(e){return SC.Function.cacheable(this,e)},idempotent:function(e){return SC.Function.idempotent(this,e)},enhance:function(){return SC.Function.enhance(this)},observes:function(e){return SC.Function.observes(this,arguments)}}),SC.ObserverSet={add:function(e,t,n){var r=SC.guidFor(e),i=SC.guidFor(t),s=this._members,o=this.members,u=s[r],a,f;u||(u=s[r]={}),a=u[i],a===undefined&&(u[i]=o.length,f=[e,t,n],o.push(f))},remove:function(e,t){var n=SC.guidFor(e),r=SC.guidFor(t),i=this._members[n],s=this.members;if(!i)return!1;var o=i[r];if(o===undefined)return!1;if(o!==s.length-1){var u=s[o]=s[s.length-1];this._members[SC.guidFor(u[0])][SC.guidFor(u[1])]=o}return s.pop(),delete this._members[n][r],!0},invokeMethods:function(){var e=this.members,t;for(var n=0,r=e.length;n=0)a=s[u],o[a.cacheKey]=o[a.lastSetValueKey]=undefined}}if(n&&n.isProperty){o=this._kvo_cache;if(n.isVolatile||!o||o[n.lastSetValueKey]!==t)o||(o=this._kvo_cache={}),o[n.lastSetValueKey]=t,r&&this.propertyWillChange(e,i),i=n.call(this,e,t),n.isCacheable&&(o[n.cacheKey]=i),r&&this.propertyDidChange(e,i,YES)}else n===undefined?(r&&this.propertyWillChange(e,i),this.unknownProperty(e,t),r&&this.propertyDidChange(e,i)):this[e]!==t&&(r&&this.propertyWillChange(e,i),i=this[e]=t,r&&this.propertyDidChange(e,i));return this},unknownProperty:function(e,t){return t!==undefined&&(this[e]=t),t},beginPropertyChanges:function(){return this._kvo_changeLevel=(this._kvo_changeLevel||0)+1,this},endPropertyChanges:function(){this._kvo_changeLevel=(this._kvo_changeLevel||1)-1;var e=this._kvo_changeLevel,t=this._kvo_changes;return e<=0&&t&&t.length>0&&! SC.Observers.isObservingSuspended&&this._notifyPropertyObservers(),this},propertyWillChange:function(e,t){return this},propertyDidChange:function(e,t,n){this._kvo_revision=(this._kvo_revision||0)+1;var r=this._kvo_changeLevel||0,i,s,o,u,a=SC.LOG_OBSERVERS&&this.LOG_OBSERVING!==NO,f=this._kvo_property_chains;if(f){var l=f[e];l&&(this.beginPropertyChanges(),l=SC.clone(l),l.forEach(function(e){e.notifyPropertyDidChange()}),this.endPropertyChanges())}var c=this._kvo_cache;if(c){n||(u=this[e],u&&u.isProperty&&(c[u.cacheKey]=c[u.lastSetValueKey]=undefined));if(this._kvo_cacheable){i=this._kvo_cachedep;if(!i||(i=i[e])===undefined)i=this._kvo_computeCachedDependentsFor(e);if(i){s=i.length;while(--s>=0)o=i[s],c[o.cacheKey]=c[o.lastSetValueKey]=undefined}}}var h=SC.Observers.isObservingSuspended;if(r>0||h){var p=this._kvo_changes;p||(p=this._kvo_changes=SC.CoreSet.create()),p.add(e),h&&(a&&SC.Logger.log("%@%@: will not notify observers because observing is suspended".fmt(SC.KVO_SPACES,this)),SC.Observers.objectHasPendingChanges(this))}else this._notifyPropertyObservers(e);return this},registerDependentKey:function(e,t){var n=this._kvo_dependents,r=this._kvo_chain_dependents,i=this[e],s,o,u,a,f;typeof t=="object"&&t instanceof Array?(s=t,u=0):(s=arguments,u=1),o=s.length,n||(this._kvo_dependents=n={});while(--o>=u)a=s[o],a.indexOf(".")>=0?SC._PropertyChain.createChain(a,this,e).activate():(f=n[a],f||(f=n[a]=[]),f.push(e))},registerDependentKeyWithChain:function(e,t){var n=this._chainsFor(e),r;n.add(t)},removeDependentKeyWithChain:function(e,t){var n=this._chainsFor(e),r;n.remove(t),n.get ("length")===0&&delete this._kvo_property_chains[e]},_chainsFor:function(e){this._kvo_property_chains=this._kvo_property_chains||{};var t=this._kvo_property_chains[e]||SC.CoreSet.create();return this._kvo_property_chains[e]=t,t},_kvo_addCachedDependents:function(e,t,n){var r=t.length,i,s,o;while(--r>=0)s=t[r],i=this[s],i&&i instanceof Function&&i.isProperty&&(i.isCacheable&&e.push(i),(o=n[s])&&o.length>0&&this._kvo_addCachedDependents(e,o,n))},_kvo_computeCachedDependentsFor:function(e){var t=this._kvo_cachedep,n=this._kvo_dependents,r=n?n[e]:null,i;return t||(t=this._kvo_cachedep={}),!r||r.length===0?t[e]=null:(i=t[e]=[],this._kvo_addCachedDependents(i,r,n),i.length===0&&(i=t[e]=null),i)},_kvo_for:function(e,t){var n=this[e];return this._kvo_cloned||(this._kvo_cloned={}),n?this._kvo_cloned[e]||(n=this[e]=n.copy(),this._kvo_cloned[e]=YES):(n=this[e]=t===undefined?[]:t.create(),this._kvo_cloned[e]=YES),n},addObserver:function(e,t,n,r){var i,s,o,u;n===undefined&&(n=t,t=this),t||(t=this),typeof n=="string"&&(n=t[n]);if(!n)throw"You must pass a method to addObserver()";return e=e.toString(),e.indexOf(".")>=0?(s=SC._ChainObserver.createChain(this,e,t,n,r),s.masterTarget=t,s.masterMethod=n,this._kvo_for(SC.keyFor("_kvo_chains",e)).push(s)):(this[e]===undefined&&e.indexOf("@")===0&&this.get(e),t===this&&(t=null),i=SC.keyFor("_kvo_observers",e),this._kvo_for(i,SC.ObserverSet).add(t,n,r),this._kvo_for("_kvo_observed_keys",SC.CoreSet).add(e)),this.didAddObserver&&this.didAddObserver(e,t,n),this},removeObserver:function(e,t,n){var r,i,s,o,u;n===undefined&&(n=t,t=this),t||(t=this),typeof n=="string"&&(n=t[n]);if(!n)throw"You must pass a method to removeObserver()";e=e.toString();if(e.indexOf(".")>=0){r=SC.keyFor("_kvo_chains",e);if(i=this[r]){i=this._kvo_for(r),u=i.length;while(--u>=0)s=i[u],s&&s.masterTarget===t&&s.masterMethod===n&&(i[u]=s.destroyChain())}}else{t===this&&(t=null),r=SC.keyFor("_kvo_observers",e);if(o=this[r])o=this._kvo_for(r),o.remove(t,n),o.getMembers().length===0&&this._kvo_for("_kvo_observed_keys",SC.CoreSet).remove(e)}return this.didRemoveObserver&&this.didRemoveObserver(e,t,n),this},hasObserverFor:function(e){SC.Observers.flush(this);var t=this[SC.keyFor("_kvo_observers",e)],n=this[SC.keyFor("_kvo_local",e)],r;return n&&n.length>0?YES:t&&t.getMembers().length>0?YES:NO},initObservable:function(){if(this._observableInited)return;this._observableInited=YES;var e,t,n,r,i,s,o,u,a,f,l,c,h,p;if(t=this._observers){u=t.length;for(e=0;e0&&this.registerDependentKey(n,r.dependentKeys)}},addObservesHandler:function(e,t){return this._configureObservesHandler(SC.OBSERVES_HANDLER_ADD,e,t),this},removeObservesHandler:function(e,t){return this._configureObservesHandler(SC.OBSERVES_HANDLER_REMOVE,e,t),this},_configureObservesHandler:function(e,t,n){var r,i;switch(e){case SC.OBSERVES_HANDLER_ADD :e="addObserver";break;case SC.OBSERVES_HANDLER_REMOVE:e="removeObserver";break;default:throw"invalid action provided: "+e}r=n.indexOf("."),r<0?this[e](n,this,t):n.indexOf("*")===0?this[e](n.slice(1),this,t):(i=null,r===0?(i=this,n=n.slice(1)):r===4&&n.slice(0,5)==="this."?(i=this,n=n.slice(5)):r<0&&n.length===4&&n==="this"?(i=this,n=""):r>0&&n[0]===n.charAt(0).toLowerCase()&&(i=this),SC.Observers[e](n,this,t,i))},observersForKey:function(e){SC.Observers.flush(this);var t=this[SC.keyFor("_kvo_observers",e)];return t?t.getMembers():[]},_notifyPropertyObservers:function(e){this._observableInited||this.initObservable(),SC.Observers.flush(this);var t=SC.LOG_OBSERVERS&&this.LOG_OBSERVING!==NO,n,r,i,s,o,u,a,f,l,c,h,p,d,v,m,g,y,b;t&&(y=SC.KVO_SPACES=(SC.KVO_SPACES||"")+" ",SC.Logger.log('%@%@: notifying observers after change to key "%@"'.fmt(y,this,e))),s=this["_kvo_observers_*"],this._kvo_changeLevel=(this._kvo_changeLevel||0)+1;while((r=this._kvo_changes)&&r.length>0||e){a=++this.propertyRevision,r||(r=SC.CoreSet.create()),this._kvo_changes=null,e==="*"?(r.add("*"),r.addEach(this._kvo_for("_kvo_observed_keys",SC.CoreSet))):e&&r.add(e);if(i=this._kvo_dependents)for(o=0;o=0){r.add(e=u[v]);if(m=this[e])this[m.cacheKey]=undefined,b[m.cacheKey]=b[m.lastSetValueKey]=undefined}}}while(r.length>0){e=r.pop(),n=this[SC.keyFor("_kvo_observers",e)];if(n){f=SC.clone(n.getMembers()),l=f.length;for(h=0;h=1)a=arguments[u],i[a]!=o&&(f=this.get(a),r[a]!==f&&(s=!0,r[a]=f)),i[a]=o;return t[e]=r,n[e]=i,s},setIfChanged:function(e,t){if(t===undefined&&SC.typeOf(e )===SC.T_HASH){var n=e;for(e in n){if(!n.hasOwnProperty(e))continue;this.setIfChanged(e,n[e])}return this}return this.get(e)!==t?this.set(e,t):this},getPath:function(e){var t=SC.tupleForPropertyPath(e,this);return t===null||t[0]===null?undefined:SC.get(t[0],t[1])},setPath:function(e,t){if(e.indexOf(".")>=0){var n=SC.tupleForPropertyPath(e,this);if(!n||!n[0])return null;n[0].set(n[1],t)}else this.set(e,t);return this},setPathIfChanged:function(e,t){if(e.indexOf(".")>=0){var n=SC.tupleForPropertyPath(e,this);if(!n||!n[0])return null;n[0].get(n[1])!==t&&n[0].set(n[1],t)}else this.setIfChanged(e,t);return this},getEach:function(){var e=SC.A(arguments),t=[],n,r;for(n=0,r=e.length;n %@" .fmt(t,n,t.get(n)))},SC.mixin(SC,{get:function(e,t){return e?t===undefined?this[e]:e.get?e.get(t):e[t]:undefined},getPath:function(e,t){return t===undefined&&(t=e,e=window),SC.objectForPropertyPath(t,e)}}),SC.mixin(Array.prototype,SC.Observable),SC.Enumerator=function(e){return this.enumerable=e,this.reset(),this},SC.Enumerator.prototype={nextObject:function(){var e=this._index,t=this._length;if(e>=t)return undefined;var n=this.enumerable.nextObject(e,this._previousObject,this._context);return this._previousObject=n,this._index=e+1,e>=t&&(this._context=SC.Enumerator._pushContext(this._context)),n},reset:function(){var e=this.enumerable;if(!e)throw SC.$error("Enumerator has been destroyed");this._length=e.get?e.get("length"):e.length;var t=this._length;this._index=0,this._previousObject=null,this._context=t>0?SC.Enumerator._popContext():null},destroy:function(){this.enumerable=this._length=this._index=this._previousObject=this._context=null}},SC.Enumerator.create=function(e){return new SC.Enumerator(e)},SC.Enumerator._popContext=function(){var e=this._contextCache?this._contextCache.pop():null;return e||{}},SC.Enumerator._pushContext=function(e){this._contextCache=this._contextCache||[];var t=this._contextCache;return t.push(e),null},SC.Enumerable={isEnumerable:YES,nextObject:function(e,t,n){return this.objectAt?this.objectAt(e):this[e]},firstObject:function(){if(this.get("length")===0)return undefined;if(this.objectAt)return this.objectAt(0);var e=SC.Enumerator._popContext(),t;return t=this.nextObject(0,null,e),e=SC.Enumerator._pushContext(e),t}.property(),lastObject:function( ){var e=this.get("length");if(e===0)return undefined;if(this.objectAt)return this.objectAt(e-1)}.property(),enumerator:function(){return SC.Enumerator.create(this)},forEach:function(e,t){if(typeof e!="function")throw new TypeError;var n=this.get?this.get("length"):this.length;t===undefined&&(t=null);var r=null,i=SC.Enumerator._popContext();for(var s=0;s1)for(n=1;n2)for(r=2;re?t:e},reduceMaxObject:function(e,t,n,r,i){var s=e,o=t;return i&&(t&&(o=t.get?t.get(i):t[i]),e&&(s=e.get?e.get(i):e[i])),s===null?t: o>s?t:e},reduceMin:function(e,t,n,r,i){return i&&t&&(t=t.get?t.get(i):t[i]),e===null?t:t=o-1&&(s/=o),s},reduceSum:function(e,t,n,r,i){return i&&t&&(t=t.get?t.get(i):t[i]),e===null?t:e+t}},SC.mixin(SC.Enumerable,SC.Reducers),SC.mixin(Array.prototype,SC.Reducers),Array.prototype.isEnumerable=YES,function(){var e={nextObject:SC.Enumerable.nextObject,enumerator:SC.Enumerable.enumerator,firstObject:SC.Enumerable.firstObject,lastObject:SC.Enumerable.lastObject,sortProperty:SC.Enumerable.sortProperty,mapProperty:function(e){var t=this.length,n=[];for(var r=0;r1)for(n=1;n2)for(r=2;r";return e.replace("IndexSet","RangeObserver(%@)".fmt(SC.guidFor(this)))},create:function(e,t,n,r,i,s){var o=SC.beget(this);return o.source=e,o.indexes=t?t.frozenCopy():null,o.target=n,o.method=typeof r=="string"?n[r]:r,o.context=i,o.isDeep=s||!1,o.beginObserving(),o},extend:function(e){var t=SC.beget(this),n=arguments;for(var r=0,i=n.length;r=0;n--)if(this.objectAt(n)===e)return n;return-1},objectAt:function(e){return e<0?undefined:e>=this.get("length")?undefined:this.get(e)},"[]":function(e,t){return t!==undefined&&this.replace(0,this.get("length"),t),this}.property(),insertAt:function(e,t){if(e>this.get("length"))throw SC.OUT_OF_RANGE_EXCEPTION;return this.replace(e,0,[t]),this},removeAt:function(e,t){var n=0,r=[];if(typeof e===SC.T_NUMBER){if(e<0||e>=this.get("length"))throw SC.OUT_OF_RANGE_EXCEPTION;if(t===undefined)return this.replace(e,1,r),this;e=SC.IndexSet.create(e,t)}return this.beginPropertyChanges(),e.forEachRange(function(e,t){e-=n,n+=t,this.replace(e,t,r)},this),this.endPropertyChanges(),this},removeObject:function(e){var t=this.get("length")||0;while(--t>=0){var n=this.objectAt(t);n==e&&this.removeAt(t)}return this},removeObjects:function(e){return this.beginPropertyChanges(),e.forEach(function(e){this.removeObject(e)},this),this.endPropertyChanges(),this},slice:function(e,t){var n=[],r=this.get("length");SC.none(e)&&(e=0);if(SC.none(t)||t>r)t=r;while(e=0)if(!SC.isEqual(e.objectAt(t),this.objectAt(t)))return!1;return!0},compact:function(){return this.without(null)},without:function(e){if(this.indexOf(e)<0)return this;var t=[];return this.forEach(function(n){n!==e&&(t[t.length]=n)}),t},uniq:function(){var e=[];return this.forEach(function(t){e.indexOf(t)<0&&(e[e.length]=t)}),e},flatten:function(){var e=[];return this.forEach(function(t){t&&t.isEnumerable?e=e.pushObjects(t.flatten()):e.pushObject(t)}),e},max:function(){return Math.max.apply(Math,this)},min:function(){return Math.min.apply(Math,this)},rangeObserverClass:SC.RangeObserver,contains:function(e){return this.indexOf(e)>=0},addRangeObserver:function(e,t,n,r){var i=this._array_rangeObservers;i||(i=this._array_rangeObservers=SC.CoreSet.create()),this._array_oldLength===undefined&&(this._array_oldLength=this.get("length"));var s=this.rangeObserverClass ,o=NO,u=s.create(this,e,t,n,r,o);return i.add(u),this._array_isNotifyingRangeObservers||(this._array_isNotifyingRangeObservers=YES,this.addObserver("[]",this,this._array_notifyRangeObservers)),u},updateRangeObserver:function(e,t){return e.update(this,t)},removeRangeObserver:function(e){var t=e.destroy(this),n=this._array_rangeObservers;return n&&n.remove(e),t},addArrayObservers:function(e){this._modifyObserverSet("add",e)},removeArrayObservers:function(e){this._modifyObserverSet("remove",e)},_modifyObserverSet:function(e,t){var n,r,i=t.target||this,s=t.willChange||"arrayWillChange",o=t.didChange||"arrayDidChange",u=t.context;typeof s=="string"&&(s=i[s]),typeof o=="string"&&(o=i[o]),n=this._kvo_for("_kvo_array_will_change",SC.ObserverSet),r=this._kvo_for("_kvo_array_did_change",SC.ObserverSet),n[e](i,s,u),r[e](i,o,u)},arrayContentWillChange:function(e,t,n){this._teardownContentObservers(e,t);var r,i,s,o,u,a,f=this._kvo_array_will_change;if(f){i=f.members,s=i.length;for(o=0;o0&&(o=this._array_rangeChanges,o||(o=this._array_rangeChanges=SC.IndexSet.create()),t===n?s=t:(s=this.get("length")-e,t>n&&(s+=t-n)),o.add(e,s)),this._setupContentObservers(e,n);var u,a,f,l,c,h,p=this._kvo_array_did_change;if(p){e===undefined&&(e=0,t=this.get("length"),n=0),a=p.members,f=a.length;for(l=0;l0){r=this.slice(e,e+t);var s=this;n.forEach(function(e){i=SC.keyFor("_kvo_content_observers",e),s._kvo_for(i).forEach(function(e){r.forEach(function(t){s._resumeChainObservingForItemWithChainObserver(t,e)})})})}},_teardownContentObservers:function(e,t){var n=this._kvo_for("_kvo_content_observed_keys",SC.CoreSet),r,i;n.get("length")>0&&(r=this.slice(e,e+t),n.forEach(function(e){i=SC.keyFor("_kvo_content_observers",e),r.forEach(function(e){e._kvo_for(i).forEach(function(e){e.destroyChain()})})}))},teardownEnumerablePropertyChains:function(e){var t=this._kvo_enumerable_property_chains;return t&&t.forEach(function(t){var n,r=e.get("length"),i=SC.guidFor(t),s,o,u="_kvo_enumerable_property_clones";t.notifyPropertyDidChange();for(n=0;n0&&t&&t.length>0){for(r=0;r=0;n--)if(this[n]===e)return n;return-1}),Date.now||(Date.now=function(){return(new Date).getTime()}),function(){var e=0,t=["ms","moz","webkit","o"],n;for(var r=0,i=t.length;r-1&&(r=e.substr(o+1),e=e.substr(0,o)),i=t[e],s=t[e+"Formatter"];if(s)i=s(i,r);else if(r)throw"String.fmt was given a formatting string, but key `"+e+"` has no formatter! String: "+n;return i},fmt:function(e,t){var n=0,r=undefined,i,s,o;return t&&(r=t[0]),s=e,o=e.replace(/%\{(.*?)\}/g,function(t,n){i=YES;if(! r)throw"Cannot use named parameters with `fmt` without a data hash. String: '"+e+"'";return SC.String._scs_valueForKey(n,r,e)}),s.match(/%@/)&&(o=o.replace(/%@([0-9]+)?/g,function(r,s){if(i)throw"Invalid attempt to use both named parameters and indexed parameters. String: '"+e+"'";return s=s?parseInt(s,10)-1:n++,t[s]})),o},w:function(e){var t=[],n=e.split(" "),r=n.length,i,s=0;for(s=0;s0)return r.pop();t=SC.beget(this),i&&t.initObservable();if(e&&e.isEnumerable&& e.get("length")>0){t.isObservable=NO;if(e.isSCArray){s=e.get("length");for(n=0;n0?this[0]:undefined}.property(),clear:function(){if(this.isFrozen)throw SC.FROZEN_ERROR;return this.length=0,this},contains:function(e){if(e===null)return NO;var t=this[SC.hashFor(e)];return!SC.none(t)&&t=0)if(!e.contains(this[t]))return NO;return YES},addSetObserver:function(e){this.setObservers||(this.setObservers=SC.CoreSet.create()),this.setObservers.add(e)},removeSetObserver:function(e){if(!this.setObservers)return;this.setObservers.remove(e)},add:function(e){if(this.isFrozen)throw SC.FROZEN_ERROR;if(SC.none(e))return this;var t,n=(t=e.hash)&&typeof t=="function"?t.call(e):SC.guidFor(e),r=this[n],i=this.length;if(r>=i||this[r]!==e)this[i]=e,this[n]=i,this.length=i+1,this.setObservers&&this.didAddItem(e);return this.isObservable&&this.enumerableContentDidChange(),this},addEach:function(e){if(this.isFrozen)throw SC.FROZEN_ERROR;if(!e||!e.isEnumerable)throw"%@.addEach must pass enumerable".fmt(this);var t,n=this.isObservable;n&&this.beginPropertyChanges();if(e.isSCArray){t=e.get("length");while(--t>=0)this.add(e.objectAt(t))}else if(e.isSet){t=e.length;while(--t>=0)this.add(e[t])}else e.forEach(function(e){this.add(e)},this);return n&&this. endPropertyChanges(),this},remove:function(e){if(this.isFrozen)throw SC.FROZEN_ERROR;if(e===null||e===undefined)return this;var t,n=e&&(t=e.hash)&&typeof t===SC.T_FUNCTION?t.call(e):SC.guidFor(e),r=this[n],i=this.length,s;return r===null||r===undefined||r>=i||this[r]!==e?this:(delete this[n],r0?this[e-1]:null;return this.remove(t),t},removeEach:function(e){if(this.isFrozen)throw SC.FROZEN_ERROR;if(!e||!e.isEnumerable)throw"%@.addEach must pass enumerable".fmt(this);var t,n=this.isObservable;n&&this.beginPropertyChanges();if(e.isSCArray){t=e.get("length");while(--t>=0)this.remove(e.objectAt(t))}else if(e.isSet){t=e.length;while(--t>=0)this.remove(e[t])}else e.forEach(function(e){this.remove(e)},this);return n&&this.endPropertyChanges(),this},copy:function(){return this.constructor.create(this)},destroy:function(){return this.isFrozen=NO,this.isObservable||SC.Set._pool.push(this.clear()),this},forEach:function(e,t){var n=this.length;t||(t=this);for(var r=0;r".fmt(n.join(","))},didAddItem:function(e){var t=this.setObservers;if(!t)return;var n=t.length,r;for(r=0;r=0){u=s[i];if(u[0]!==e||u[1]!==t||u[2]!==n||u[3]!==r)newQueue||(newQueue=[]),newQueue.push(u)}this.queue=newQueue||this.queue},addPendingRangeObserver:function(e){var t=this.rangeObservers;return t||(t=this.rangeObservers=SC.CoreSet.create()),t.add(e),this},_TMP_OUT:[],flush:function(e){var t=this.queue,n,r=t.length;if(t&&r>0){var i=this.queue=[];for(n=0;n0&&u.removeEach(f),f.length=0,e._kvo_needsRangeObserver=!1}},isObservingSuspended:0,_pending:SC.CoreSet.create(),objectHasPendingChanges:function(e){this._pending.add(e)},suspendPropertyObserving:function( ){this.isObservingSuspended++},resumePropertyObserving:function(){var e;if(--this.isObservingSuspended<=0){e=this._pending,this._pending=SC.CoreSet.create();var t,n=e.length;for(t=0;t0?{}:null;while(--s>=0)i=a[s],l=t[i],c=n[i],l?(l instanceof Array||(l=SC.$A(l)),h[i]=c?l.concat(c):c):(c instanceof Array||(c=SC.$A(c)),h[i]=c);var p=t._bindings,d=NO,v=t._observers,m=NO,g=t._properties,y=NO,b,w,E,S,x=t.outlets,T=NO;n.outlets&&(x=(x||SC.EMPTY_ARRAY).concat(n.outlets),T=YES);for(i in n){if(i==="_kvo_cloned")continue;if(!n.hasOwnProperty(i))continue;S=(h.hasOwnProperty(i)?h[i]:null)||n[i];if(i.length>7&&i.slice(-7)==="Binding")d||(p=(p||SC.EMPTY_ARRAY).slice(),d=YES),p===null&&(p=(t._bindings||SC.EMPTY_ARRAY).slice()),p[p.length]=i;else if(S&&S instanceof Function){!S.superclass&&S!==(u=t[i])&&(S.superclass=u||f,S.base=r?SC._detect_base(S,r,i):u||f),S.propertyPaths&&(m||(v=(v||SC.EMPTY_ARRAY).slice(),m=YES),v[v.length]=i);if(b=S.localPropertyPaths){w=b.length;while(--w>=0)E=t._kvo_for(SC. keyFor("_kvo_local",b[w]),SC.CoreSet),E.add(i),t._kvo_for("_kvo_observed_keys",SC.CoreSet).add(b[w])}S.dependentKeys&&(y||(g=(g||SC.EMPTY_ARRAY).slice(),y=YES),g[g.length]=i),S.autoconfiguredOutlet&&(T||(x=(x||SC.EMPTY_ARRAY).slice(),T=YES),x[x.length]=i),S.isEnhancement&&(S=SC._enhance(t[i]||f,S))}t[i]=S}return n.hasOwnProperty("toString")&&(i="toString",S=(h.hasOwnProperty(i)?h[i]:null)||n[i],!S.superclass&&S!==(u=t[i])&&(S.superclass=S.base=u||f),t[i]=S),t._bindings=p||[],t._observers=v||[],t._properties=g||[],t.outlets=x||[],t},SC._enhance=function(e,t){return function(){var n=Array.prototype.slice.call(arguments,0),r=this;return n.unshift(function(){return e.apply(r,arguments)}),t.apply(this,n)}},SC.Object=function(e){return this.__sc_super__=SC.Object.prototype,this._object_init(e)},SC.mixin(SC.Object,{mixin:function(e){var t=arguments.length,n;for(n=0;n=1)u=u.next=SC._PropertyChain.create({property:r[s],target:t,toInvalidate:n,nextProperty:r[++s]}),u.set("length",i);return o},SC.LOG_BINDINGS=NO,SC.BENCHMARK_BINDING_NOTIFICATIONS=NO,SC.BENCHMARK_BINDING_SETUP=NO,SC.MULTIPLE_PLACEHOLDER="@@MULT@@",SC.NULL_PLACEHOLDER="@@NULL@@",SC.EMPTY_PLACEHOLDER="@@EMPTY@@",SC.Binding={beget:function(e){var t=SC.beget(this);return t.parentBinding=this,e!==undefined&&(t=t.from(e)),t},builder:function(){var e=this,t=function(t){return e.beget().from(t)};return t.beget=function(){return e.beget()},t},from:function(e,t){if(!e)return this;var n=this===SC.Binding?this.beget():this;return n._fromPropertyPath=e,n._fromRoot=t,n._fromTuple=null,n},to:function(e,t){var n=this===SC.Binding?this.beget():this;return n._toPropertyPath=e,n._toRoot=t,n._toTuple=null,n},connect:function(){return this.isConnected?this:(this.isConnected=YES,this._connectionPending=YES,this._syncOnConnect=YES,SC.Binding._connectQueue.add(this),SC.RunLoop.isRunLoopInProgress()||this._scheduleSync(),this)},_connect:function(){if(!this._connectionPending)return;this._connectionPending=NO;var e,t,n=SC.BENCHMARK_BINDING_SETUP;e=this._fromPropertyPath ,t=this._fromRoot,typeof e=="string"&&(e.indexOf(".")===0?(e=e.slice(1),t||(t=this._toRoot)):e.indexOf("*")===0&&(e=[this._fromRoot||this._toRoot,e.slice(1)],t=null)),this._fromObserverData=[e,this,this.fromPropertyDidChange,t],SC.Observers.addObserver.apply(SC.Observers,this._fromObserverData),this._oneWay||(e=this._toPropertyPath,t=this._toRoot,this._toObserverData=[e,this,this.toPropertyDidChange,t],SC.Observers.addObserver.apply(SC.Observers,this._toObserverData)),this._syncOnConnect&&(this._syncOnConnect=NO,this.sync())},disconnect:function(){return this.isConnected?(this._connectionPending?this._connectionPending=NO:(SC.Observers.removeObserver.apply(SC.Observers,this._fromObserverData),this._oneWay||SC.Observers.removeObserver.apply(SC.Observers,this._toObserverData)),this.isConnected=NO,this):this},fromPropertyDidChange:function(e,t){var n=e?e.get(t):null;if(n!==this._bindingValue||t==="[]")this._setBindingValue(e,t),this._changePending=YES,SC.Binding._changeQueue.add(this),this._scheduleSync()},toPropertyDidChange:function(e,t){if(this._oneWay)return;var n=e.get(t);n!==this._transformedBindingValue&&(this._setBindingValue(e,t),this._changePending=YES,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(e,t){this._bindingSource=e,this._bindingKey=t},_computeBindingValue:function(){var e=this._bindingSource,t=this._bindingKey,n,r;this._bindingValue=n=e? e.getPath(t):null;var i=this._transforms;if(i){var s=i.length,o;for(r=0;r0){this._connectQueue=this._alternateConnectQueue,this._alternateConnectQueue=n;while(r=n.pop())r._connect()}while((n=this._changeQueue).length>0){e=YES,this._changeQueue=this._alternateChangeQueue,this._alternateChangeQueue=n;while(r=n.pop())r.applyBindingValue()}return this._isFlushing=NO,SC.Observers.resumePropertyObserving(),e},applyBindingValue:function(){this._changePending=NO,this._computeBindingTargets(),this._computeBindingValue();var e=this._bindingValue,t=this._transformedBindingValue,n=SC.BENCHMARK_BINDING_NOTIFICATIONS,r=SC.LOG_BINDINGS;!this._oneWay&&this._fromTarget&&this._fromTarget.setPathIfChanged(this._fromPropertyKey,e),this._toTarget&&this._toTarget.setPathIfChanged(this._toPropertyKey,t)},sync:function(){if(!this.isConnected)return this;if(this._connectionPending)this._syncOnConnect=YES;else{this._computeBindingTargets();var e=this._fromTarget,t=this._fromPropertyKey;if(!e||!t)return this;if(!e.isObservable)return SC.Logger.warn("Cannot bind '%@' to property '%@' on non-observable '%@'".fmt(this._toPropertyPath,t,e)),this ;var n=e.getPath(t);if(n!==this._bindingValue||t==="[]")this._setBindingValue(e,t),this._changePending=YES,SC.Binding._changeQueue.add(this)}return this},_syncOnConnect:NO,_computeBindingTargets:function(){if(!this._fromTarget){var e,t,n;e=this._fromPropertyPath,t=this._fromRoot,typeof e=="string"&&(e.indexOf(".")===0?(e=e.slice(1),t||(t=this._toRoot)):e.indexOf("*")===0&&(e=[t||this._toRoot,e.slice(1)],t=null)),n=SC.tupleForPropertyPath(e,t),n&&(this._fromTarget=n[0],this._fromPropertyKey=n[1])}this._toTarget||(e=this._toPropertyPath,t=this._toRoot,n=SC.tupleForPropertyPath(e,t),n&&(this._toTarget=n[0],this._toPropertyKey=n[1]))},oneWay:function(e,t){t===undefined&&SC.typeOf(e)===SC.T_BOOL&&(t=e,e=null);var n=this.from(e);return n===SC.Binding&&(n=n.beget()),n._oneWay=t===undefined?YES:t,n},transform:function(e){var t=this===SC.Binding?this.beget():this,n=t._transforms;return n&&n===t.parentBinding._transforms&&(n=t._transforms=n.slice()),n||(n=t._transforms=[]),n.push(e),t},resetTransforms:function(){var e=this===SC.Binding?this.beget():this;return e._transforms=null,e},noError:function(e,t){t===undefined&&SC.typeOf(e)===SC.T_BOOL&&(t=e,e=null);var n=this.from(e);return n===SC.Binding&&(n=n.beget()),n._noError=t===undefined?YES:t,n},single:function(e,t){return t===undefined&&(t=SC.MULTIPLE_PLACEHOLDER),this.from(e).transform(function(e,n){if(e&&e.isEnumerable){var r=e.get("length");e=r>1?t:r<=0?null:e.firstObject()}return e})},notEmpty:function(e,t){return t===undefined&&(t=SC.EMPTY_PLACEHOLDER),this.from(e).transform(function(e,n){if(SC.none(e)||e===""||SC.isArray(e)&&e.length===0 )e=t;return e})},notNull:function(e,t){return t===undefined&&(t=SC.EMPTY_PLACEHOLDER),this.from(e).transform(function(e,n){return SC.none(e)&&(e=t),e})},multiple:function(e){return this.from(e).transform(function(e){return SC.isArray(e)||(e=e==null?[]:[e]),e})},bool:function(e){return this.from(e).transform(function(e){var t=SC.typeOf(e);return t===SC.T_ERROR?e:t==SC.T_ARRAY?e.length>0:e===""?NO:!!e})},and:function(e,t){var n=SC.Object.create({valueABinding:e,valueBBinding:t,and:function(){return this.get("valueA")&&this.get("valueB")}.property("valueA","valueB").cacheable()});return this.from("and",n).oneWay()},or:function(e,t){var n=SC.Object.create({valueABinding:e,valueBBinding:t,or:function(){return this.get("valueA")||this.get("valueB")}.property("valueA","valueB").cacheable()});return this.from("or",n).oneWay()},not:function(e){return this.from(e).transform(function(e){var t=SC.typeOf(e);return t===SC.T_ERROR?e:!(t==SC.T_ARRAY?e.length>0:e===""?NO:!!e)})},isNull:function(e){return this.from(e).transform(function(e){var t=SC.typeOf(e);return t===SC.T_ERROR?e:SC.none(e)})},toString:function(){var e=this._fromRoot?"<%@>:%@".fmt(this._fromRoot,this._fromPropertyPath):this._fromPropertyPath,t=this._toRoot?"<%@>:%@".fmt(this._toRoot,this._toPropertyPath):this._toPropertyPath,n=this._oneWay?"[oneWay]":"";return"SC.Binding%@(%@ -> %@)%@".fmt(SC.guidFor(this),e,t,n)}},SC.binding=function(e,t){return SC.Binding.from(e,t)},SC.Error=SC.Object.extend({code:-1,message:"",errorValue:null,errorObject:function(){return this}.property().cacheable(),label:null,toString:function(){return"SC.Error:%@:%@ (%@)" .fmt(SC.guidFor(this),this.get("message"),this.get("code"))},isError:YES}),SC.Error.desc=function(e,t,n,r){var i={message:e};return t!==undefined&&(i.label=t),r!==undefined&&(i.code=r),n!==undefined&&(i.errorValue=n),this.create(i)},SC.$error=function(e,t,n,r){return SC.Error.desc(e,t,n,r)},SC.ok=function(e){return e!==!1&&(!e||!e.isError)},SC.$ok=SC.ok,SC.val=function(e){return e&&e.isError?e.get?e.get("errorValue"):null:e},SC.$val=SC.val,SC.Error.HAS_MULTIPLE_VALUES=-100,SC.IndexSet=SC.mixin({},SC.Enumerable,SC.Observable,SC.Freezable,SC.Copyable,{_sc_sliceContent:function(e){if(e.length<1e3)return e.slice();var t=0,n=[],r=e[0];while(r!==0)n[t]=r,t=r<0?0-r:r,r=e[t];return n[t]=0,this._hint(0,t,n),n},create:function(e,t){var n=SC.beget(this);return n.initObservable(),n.registerDependentKey("min","[]"),e&&e.isIndexSet?(n._content=this._sc_sliceContent(e._content),n.max=e.max,n.length=e.length,n.source=e.source):(n._content=[0],e!==undefined&&n.add(e,t)),n},isIndexSet:YES,HINT_SIZE:256,length:0,max:0,min:function(){var e=this._content,t=e[0];return t===0?-1:t>0?0:Math.abs(t)}.property("[]").cacheable(),firstObject:function(){return this.get("length")>0?this.get("min"):undefined}.property(),rangeStartForIndex:function(e){var t=this._content,n=this.get("max"),r,i,s;if(e>=n)return n;if(Math.abs(t[e])>e)return e;s=e-e%SC.IndexSet.HINT_SIZE,r=t[s];if(r<0||r>e)r=s;i=Math.abs(t[r]);while(i=n)return-1;e++,r=this.rangeStartForIndex(e),i=t[r];while(i<0){if(i===0)return-1;e=r=Math.abs(i),i=t[r]}return e},contains:function(e,t){var n,r,i,s,o;if(t===undefined){if(e===null||e===undefined)return NO;if(typeof e===SC.T_NUMBER)t=1;else{if(e&&e.isIndexSet){if(e===this)return YES;n=e._content,r=0,i=n[r];while(i!==0){if(i>0&&!this.contains(r,i-r))return NO;r=Math.abs(i),i=n[r]}return YES}t=e.length,e=e.start}}return s=this.rangeStartForIndex(e),o=this._content[s],o>0&&s<=e&&o>=e+t},intersects:function(e,t){var n,r,i,s;if(t===undefined)if(typeof e===SC.T_NUMBER)t=1;else{if(e&&e.isIndexSet){if(e===this)return YES;n=e._content,r=0,i=n[r];while(i!==0){if(i>0&&this.intersects(r,i-r))return YES;r=Math.abs(i),i=n[r]}return NO}t=e.length,e=e.start}r=this.rangeStartForIndex(e),n=this._content,i=n[r],s=e+t;while(r0&&i>e)return YES;r=Math.abs(i),i=n[r]}return NO},without:function(e,t){return e===this?SC.IndexSet.create():this.clone().remove(e,t)},replace:function(e,t){if(t===undefined)if(typeof e===SC.T_NUMBER)t=1;else{if(e&&e.isIndexSet)return this._content=this._sc_sliceContent(e._content),this.beginPropertyChanges().set("max",e.max).set("length",e.length).set("source",e.source).enumerableContentDidChange (),this.endPropertyChanges(),this;t=e.length,e=e.start}var n=this.length;return this._content.length=1,this._content[0]=0,this.length=this.max=0,this.add(e,t)},add:function(e,t){if(this.isFrozen)throw SC.FROZEN_ERROR;var n,r,i;if(e&&e.isIndexSet){n=e._content;if(!n)return this;r=0,i=n[0];while(i!==0)i>0&&this.add(r,i-r),r=i<0?0-i:i,i=n[r];return this}if(t===undefined){if(e===null||e===undefined)return this;typeof e===SC.T_NUMBER?t=1:(t=e.length,e=e.start)}else t===null&&(t=1);if(t<=0)return this;var s=this.get("max"),o=s,u,a;n=this._content;if(e===s)e>0?(r=this.rangeStartForIndex(e-1),i=n[r],i>0?(delete n[s],n[r]=s=e+t,e=r):n[s]=s=e+t):n[e]=s=t,n[s]=0,this.set("max",s),this.set("length",this.length+t),t=s-e;else if(e>s)n[s]=0-e,n[e]=e+t,n[e+t]=0,this.set("max",e+t),this.set("length",this.length+t),t=e+t-s,e=s;else{r=this.rangeStartForIndex(e),i=n[r],s=e+t,u=0,e>0&&r===e&&i<=0&&(r=this.rangeStartForIndex(e-1),i=n[r]),i<0?(n[r]=0-e,Math.abs(i)>s?(n[e]=0-s,n[s]=i):n[e]=i):(e=r,i>s&&(s=i)),r=e;while(rs&&(n[s]=a,i=s),a<0&&(u+=i-r)),delete n[r],r=i;(r=n[s])>0&&(delete n[s],s=r),n[e]=s,s>o&&this.set("max",s),this.set("length",this.get("length")+u),t=s-e}return this._hint(e,t),u!==0&&this.enumerableContentDidChange(),this},remove:function(e,t){if(this.isFrozen)throw SC.FROZEN_ERROR;if(t===undefined){if(e===null||e===undefined)return this;if(typeof e===SC.T_NUMBER)t=1;else{if(e.isIndexSet)return e.forEachRange(this.remove,this),this;t=e.length,e=e.start}}if(t<=0)return this;var n=this.get("max"),r=n,i=this._content,s,o,u,a,f;if(e>= n)return this;s=this.rangeStartForIndex(e),o=i[s],f=e+t,u=0;var l=this.HINT_SIZE,c=e-e%l+l;Math.abs(i[c])===e&&(i[c]=0),e>0&&s===e&&o>0&&(s=this.rangeStartForIndex(e-1),o=i[s]),o>0?(i[s]=e,o>f?(i[e]=f,i[f]=o):i[e]=o):(e=s,o=Math.abs(o),o>f&&(f=o)),s=e;while(sf&&(i[f]=a,o=f),a>0&&(u+=o-s)),delete i[s],s=o;return(s=i[f])<0&&(delete i[f],f=Math.abs(s)),i[f]===0?(delete i[f],i[e]=0,this.set("max",e)):i[e]=0-f,this.set("length",this.get("length")-u),t=f-e,this._hint(e,t),u!==0&&this.enumerableContentDidChange(),this},_hint:function(e,t,n){n===undefined&&(n=this._content);var r=SC.IndexSet.HINT_SIZE,i=Math.abs(n[e]),s=e-e%r+r,o=e+t;while(s0&&this.enumerableContentDidChange()},addEach:function(e){if(this.isFrozen)throw SC.FROZEN_ERROR;this.beginPropertyChanges();var t=e.get("length");if(e.isSCArray)while(--t>=0)this.add(e.objectAt(t));else e.isEnumerable&&e.forEach(function(e){this.add(e)},this);return this.endPropertyChanges(),this},removeEach:function(e){if(this.isFrozen)throw SC.FROZEN_ERROR;this.beginPropertyChanges();var t=e.get("length");if(e.isSCArray)while(--t>=0)this.remove(e.objectAt(t));else e.isEnumerable&&e.forEach(function(e){this.remove(e)},this);return this.endPropertyChanges(),this},clone:function(){return SC.IndexSet.create(this)},inspect:function(){var e=this._content,t=e.length,n=0,r= [],i;for(n=0;n".fmt(r.join(" , "))},forEachRange:function(e,t){var n=this._content,r=0,i=n[r],s=this.source;t===undefined&&(t=null);while(i!==0)i>0&&e.call(t,r,i-r,this,s),r=Math.abs(i),i=n[r];return this},forEachIn:function(e,t,n,r){var i=this._content,s=0,o=0,u=e+t,a=this.source,f=i[s];r===undefined&&(r=null);while(f!==0){s=u?s=f=0:(s=Math.abs(f),f=i[s])}return this},lengthIn:function(e,t){var n=0;if(t===undefined){if(e===null||e===undefined)return 0;if(typeof e===SC.T_NUMBER)t=1;else{if(e.isIndexSet)return e.forEachRange(function(e,t){n+=this.lengthIn(e,t)},this),n;t=e.length,e=e.start}}if(this.get("length")===0)return 0;var r=this._content,i=0,s=r[i],o=e+t;while(i0&&(n+=s>o?o-i:s-i),i=Math.abs(s),s=r[i];return n},source:null,indexOf:function(e,t){var n=this.source;if(!n)throw"%@.indexOf() requires source".fmt(this);var r=n.get("length"),i=this._content,s=i[0]<0?Math.abs(i[0]):0,o;while(s>=0&&s=r&&(i=r-1);while(i>=0){s=n.lastIndexOf(e,i);if(s<0)return-1;if(this.contains(s))return s;i=s+1}return-1},forEachObject:function(e,t){var n=this.source;if(!n)throw"%@.forEachObject() requires source".fmt(this);var r=this._content,i=0,s=0,o=r[i];t===undefined&&(t=null);while(o!==0){while(i=0&&i=0))return this;this.add(s);if(t)return this;i=s++}return this},addObjects:function(e,t){return e.forEach(function(e){this.addObject(e,t)},this),this},removeObject:function(e,t){var n=this.source;if(!n)throw"%@.removeObject() requires source".fmt(this);var r=n.get("length"),i=0,s;while(i>=0&&i=0))return this;this.remove(s);if(t)return this;i=s+1}return this},removeObjects:function(e,t){return e.forEach(function(e){this.removeObject(e,t)},this),this},LOG_OBSERVING:NO,forEach:function(e,t){var n=this._content,r=0,i=0,s=this.source,o=n[r];t===undefined&&(t=null);while(o!==0){while(r=s)return delete n.next,null;t++}if(t===i){do t=Math.abs(i),i=r[t];while(i<0);n.next=i}return t".fmt(e.join(","))}}),SC.IndexSet.slice=SC.IndexSet.copy=SC.IndexSet.clone,SC.IndexSet.EMPTY=SC.IndexSet.create().freeze(),SC.json={encode:function(e){return JSON.stringify(e)},decode:function(e){return JSON.parse(e)}},this.JSON||(this.JSON={}),function(){function f(e){return e<10?"0"+e:e}function quote(e){return escapable.lastIndex=0,escapable.test(e)?'"'+e.replace(escapable,function(e){ var t=meta[e];return typeof t=="string"?t:"\\u"+("0000"+e.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+e+'"'}function str(e,t){var n,r,i,s,o=gap,u,a=t[e];a&&typeof a=="object"&&typeof a.toJSON=="function"&&(a=a.toJSON(e)),typeof rep=="function"&&(a=rep.call(t,e,a));switch(typeof a){case"string":return quote(a);case"number":return isFinite(a)?String(a):"null";case"boolean":case"null":return String(a);case"object":if(!a)return"null";gap+=indent,u=[];if(Object.prototype.toString.apply(a)==="[object Array]"){s=a.length;for(n=0;n1)for(m=0,g=v-1;m0?t.group():t.groupEnd();v>0?(h=f?f:"",h+=p,t.group(h)):t.groupEnd()}else v>0&&this._outputGroup(a,f,d-1,p);r=d}}},stringifyRecordedLogMessages:function(){var e="",t=this.get("recordedLogMessages"),n=0,r=SC.LOGGER_RECORDED_LOG_TIMESTAMP_PREFIX,i=this._LOG_FALLBACK_PREFIX_MAPPING,s=SC.LOGGER_LOG_GROUP_HEADER,o,u,a,f,l,c,h,p,d,v,m;if(t)for(o=0,u=t.length;o0&&(p=h+this._indentation(n)+s.fmt(d)),n=v),e+=p+"\n";return e},log:function(){var e=this.get("reporter"),t=arguments[0],n=this.get("messagePrefix"),r=this.get("outputMessagePrefix"),i=NO;return t&&SC.typeOf(t)===SC.T_STRING&&(n||r)&&(n&&(t=n+t),r&&(t=r+t),arguments[0]=t),this.get("exists")&&(typeof e.log=="function"?(e.log.apply(e,arguments),i=YES):e.log&&(e.log(this._argumentsToArray(arguments)),i=YES)),!i&&this.get("fallBackOnAlert")&&(this.get("exists")&&typeof e.alert=="function"?(e.alert(arguments),i=YES):(alert(arguments),i=YES)),i} ,group:function(e){var t=this.get("reporter");this.get("exists")&&typeof t.group=="function"&&t.group(e)},groupEnd:function(){var e=this.get("reporter");this.get("exists")&&typeof e.groupEnd=="function"&&e.groupEnd()},dir:function(){var e=this.get("reporter");this.get("exists")&&typeof e.dir=="function"?e.dir.apply(e,arguments):this.log.apply(this,arguments)},dirxml:function(){var e=this.get("reporter");this.get("exists")&&typeof e.dirxml=="function"?e.dirxml.apply(e,arguments):this.log.apply(this,arguments)},profile:function(e){var t=this.get("reporter");return this.get("exists")&&typeof t.profile=="function"?(t.profile(e),YES):NO},profileEnd:function(e){var t=this.get("reporter");return this.get("exists")&&typeof t.profileEnd=="function"?(t.profileEnd(e),YES):NO},time:function(e){var t=this.get("reporter");return this.get("exists")&&typeof t.time=="function"?(t.time(e),YES):NO},timeEnd:function(e){var t=this.get("reporter");return this.get("exists")&&typeof t.timeEnd=="function"?(t.timeEnd(e),YES):NO},trace:function(){var e=this.get("reporter");return this.get("exists")&&typeof e.trace=="function"?(e.trace(),YES):NO},init:function(){arguments.callee.base.apply(this,arguments),this.get("logOutputLevel")||(SC.buildMode==="debug"?this.set("logOutputLevel",SC.LOGGER_LEVEL_DEBUG):this.set("logOutputLevel",SC.LOGGER_LEVEL_INFO)),this.debugEnabledDidChange()},debugEnabledDidChange:function(){this.get("debugEnabled")&&this.set("logOutputLevel",SC.LOGGER_LEVEL_DEBUG)}.observes("debugEnabled"),_handleMessage:function(e,t,n,r){var i=this._shouldOutputType(e),s=this._shouldRecordType( e),o,u,a,f,l,c,h,p,d;if(!i&&!s)return;o=r&&r.length>1,t&&(SC.none(n)||typeof n!="string")&&(t=NO);if(t&&o){f=[];for(u=1,a=r.length;u1;if(t&&s){a=[];for(o=1,u=n.length;othis.get("recordedLogMessagesMaximumLength")&&t.splice(0,n-this.get("recordedLogMessagesPruningMinimumLength")),t.enumerableContentDidChange()},_argumentsToArray:function(e){var t=[],n,r;if(e)for(n=0,r=e.length;n1&&!this.get("allowsMultipleSelection")&&(r>1?(t=SC.SelectionSet.create().addObject(n.get("firstObject")).freeze(),o=1):(t=n,o=r)),o===0&&!this.get("allowsEmptySelection")&&s&&s.get("length")!==0&&(r===0?(t=this.get("firstSelectableObject"),t?t=SC.SelectionSet.create().addObject(t).freeze():t=SC.SelectionSet.EMPTY,o=t.get("length")):(t=n,o=r)),o===0&&(t=SC.SelectionSet.EMPTY),t!==n&&(t=t.frozenCopy()),this._scsel_selection=t,t}.property("arrangedObjects","allowsEmptySelection","allowsMultipleSelection","allowsSelection").cacheable(),hasSelection:function(){var e=this.get("selection");return!!e&&e.get("length")>0}.property("selection").cacheable(),selectObjects:function(e,t){if(!e||e.get("length")===0)return t||this.set("selection",SC.SelectionSet.EMPTY),this;var n=this.get("selection");return t&&n?n=n.copy():n=SC.SelectionSet.create(),n.addObjects(e).freeze(),this.set("selection",n),this},selectObject:function(e,t){return e===null?(t||this.set("selection",null),this):this.selectObjects([e],t)},deselectObjects:function(e){if(!e||e.get("length")===0)return this;var t=this.get("selection");return!t||t.get("length")===0?this:(t=t.copy().removeObjects(e).freeze(),this.set("selection",t.freeze()),this)},deselectObject:function(e){return e?this.deselectObjects([e]):this},updateSelectionAfterContentChange:function(){var e=this.get("arrangedObjects") ,t=this.get("selection"),n=this.get("allowsEmptySelection"),r;if(!t)return this;r=t.indexSetForSource(e);if(r&&r.get("length")!==t.get("length")||!r&&t.get("length")>0)t=t.copy().constrain(e).freeze(),this.set("selection",t);return t.get("length")===0&&e&&e.get("length")>0&&!n&&this.selectObject(this.get("firstSelectableObject"),NO),this}},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 e=this.get("content"),t;return t=!!e&&this.get("isEditable")&&this.get("hasContent"),t?!e.isEnumerable||SC.typeOf(e.removeObject)===SC.T_FUNCTION:NO}.property("content","isEditable","hasContent"),canReorderContent:function(){var e=this.get("content"),t;return t=!!e&&this.get("isEditable")&&!this.get("orderBy"),t&&!!e.isSCArray}.property("content","isEditable","orderBy"),canAddContent:function(){var e=this.get("content"),t;return t=e&&this.get("isEditable")&&e.isEnumerable,t?SC.typeOf(e.addObject)===SC.T_FUNCTION||SC.typeOf(e.pushObject)===SC.T_FUNCTION:NO}.property("content","isEditable"),hasContent:function(){var e=this.get("content");return!!e&&(!!e.isEnumerable||!!this.get("allowsSingleContent"))}.property("content","allowSingleContent"),status:function(){var e=this.get("content"),t=e?e.get("status"):null;return t?t:SC.Record.READY}.property().cacheable(),addObject:function(e){if(!this.get("canAddContent"))throw"%@ cannot add content".fmt(this);var t=this.get("content");if(t.isSCArray)t.pushObject (e);else{if(!t.addObject)throw"%@.content does not support addObject".fmt(this);t.addObject(e)}return this},removeObject:function(e){if(!this.get("canRemoveContent"))throw"%@ cannot remove content".fmt(this);var t=this.get("content");return t.isEnumerable?t.removeObject(e):this.set("content",null),this.get("destroyOnRemoval")&&e.destroy&&e.destroy(),this},length:function(){var e=this._scac_observableContent();return e?e.get("length"):0}.property().cacheable(),objectAt:function(e){var t=this._scac_observableContent();return t?t.objectAt(e):undefined},replace:function(e,t,n){if(!n||n.get("length")===0){if(!this.get("canRemoveContent"))throw"%@ cannot remove objects from the current content".fmt(this)}else if(!this.get("canReorderContent"))throw"%@ cannot add or reorder the current content".fmt(this);var r=this.get("content"),i=[],s,o;if(this.get("destroyOnRemoval"))for(s=0;s0){s=YES,i=t.objectAt(0);while(--r>0&&s)i!==t.objectAt(r)&&(s=NO);s&&(t=i)}else t=undefined}else t=n.isObservable?n.get(e):n[e];else{if(!this.get("isEditable"))throw"%@.%@ is not editable".fmt(this,e);n.isEnumerable?n.setEach(e,t):n.isObservable?n.set(e,t):n[e]=t}return t},init:function(){arguments.callee.base.apply(this,arguments),this.get("content")&&this._scoc_contentDidChange(),this.get("observableContent")&&this._scoc_observableContentDidChange()},_scoc_contentDidChange:function(){var e=this._scoc_content,t=this.get("content");if(e!==t){this._scoc_content=t;var n=this._scoc_enumerableContentDidChange;e&&e.isEnumerable&&e.removeObserver("[]",this,n),t&&t.isEnumerable&&t.addObserver("[]",this,n)}}.observes("content"),_scoc_observableContentDidChange:function(){var e=this._scoc_observableContent,t=this.get("observableContent"),n=this.contentPropertyDidChange,r=this._scoc_enumerableContentDidChange;if(e===t)return this;this._scoc_observableContent=t,e&&(e.isEnumerable?e.removeObserver("[]",this,r):e.isObservable&&e.removeObserver("*",this,n)),t&&(t.isEnumerable?t.addObserver("[]",this,r):t.isObservable&&t.addObserver("*",this,n)),e&&e.isEnumerable||t&&t.isEnumerable?this._scoc_enumerableContentDidChange():this.contentPropertyDidChange(t,"*")}.observes("observableContent"),_scoc_enumerableContentDidChange:function(){var e=this.get("observableContent" ),t=this._scoc_observableContentItems,n=this.contentPropertyDidChange;return t&&(t.forEach(function(e){e.isObservable&&e.removeObserver("*",this,n)},this),t.clear()),e&&e.isEnumerable?(t||(t=SC.Set.create()),e.forEach(function(e){if(t.contains(e))return;t.add(e),e.isObservable&&e.addObserver("*",this,n)},this)):t=null,this._scoc_observableContentItems=t,this.contentPropertyDidChange(e,"*"),this}}),SC.mixin(Function.prototype,{invokeLater:function(e,t){t===undefined&&(t=1);var n=this;if(arguments.length>2){var r=SC.$A(arguments).slice(2,arguments.length);r.unshift(e);var i=n;n=function(){return i.apply(this,r.slice(1))}}return SC.Timer.schedule({target:e,action:n,interval:t})}}),SC.mixin(SC.Object.prototype,{invokeLater:function(e,t){t===undefined&&(t=1);var n=e,r,i;return arguments.length>2&&(r=SC.$A(arguments).slice(2),SC.typeOf(n)===SC.T_STRING&&(n=this[e]),i=n,n=function(){return i.apply(this,r)}),SC.Timer.schedule({target:this,action:n,interval:t})},invokeOnceLater:function(e,t){t===undefined&&(t=1);var n=this._sc_invokeOnceLaterTimers,r,i,s,o;return SC.typeOf(e)===SC.T_STRING&&(e=this[e]),r=SC.guidFor(e),n||(this._sc_invokeOnceLaterTimers=n={}),i=n[r],i&&i.invalidate(),s=function(){return delete n[r],e.apply(this,arguments)},o=SC.Timer.schedule({target:this,action:s,interval:t}),n[r]=o,o},invokeWith:function(e,t,n){n===undefined&&(n=t,t=this),t||(t=this),SC.typeOf(n)===SC.T_STRING&&(n=t[n]);var r=this.getPath(e);return n.call(t,r,this),this}}),SC.RunLoop=SC.RunLoop.extend({startTime:function(){return this._start||(this._start=Date.now()),this._start}.property(),endRunLoop :function(){this.fireExpiredTimers();var e=arguments.callee.base.apply(this,arguments);return this.scheduleNextTimeout(),e},scheduleTimer:function(e,t){return this._timerQueue=e.removeFromTimerQueue(this._timerQueue),this._timerQueue=e.scheduleInTimerQueue(this._timerQueue,t),this},cancelTimer:function(e){return this._timerQueue=e.removeFromTimerQueue(this._timerQueue),this},TIMER_ARRAY:[],fireExpiredTimers:function(){if(!this._timerQueue||this._firing)return NO;var e=this.get("startTime"),t=this.TIMER_ARRAY,n,r,i;this._firing=YES;try{this._timerQueue=this._timerQueue.collectExpiredTimers(t,e),r=t.length;for(n=0;n0,t.length=0}catch(s){throw t.splice(0,n+1),s}finally{this._firing=NO}return i},scheduleNextTimeout:function(){var e=this._timerQueue,t=NO;if(!e)this._timeout&&clearTimeout(this._timeout);else{var n=e._timerQueueRunTime;if(this._timeoutAt!==n){this._timeout&&clearTimeout(this._timeout);var r=Math.max(0,n-Date.now());this._timeout=setTimeout(this._timeoutDidFire,r),this._timeoutAt=n}t=YES}return t},_timeoutDidFire:function(){var e=SC.RunLoop.currentRunLoop;e._timeout=e._timeoutAt=null,SC.run()}}),SC.RunLoop.currentRunLoop=SC.RunLoop.create(),SC.RunLoop.runLoopClass=SC.RunLoop,SC.Locale=SC.Object.extend(SC.Observable,{init:function(){this.language||SC.Locale._assignLocales();if(!this.hasStrings){var e=this._deprecatedLanguageCodes||[];e.push(this.language);var t=e.length,n=null;while(!n&&--t>=0)n=String[e[t]];n&&(this.hasStrings=YES,this.strings=n)}},hasStrings:NO,strings:{},metrics:{},language:null,isRTL:function(){return!!this.get("language" ).match(/^(ar|iw)-.*/)}.property("language").cacheable(),toString:function(){return this.language||SC.Locale._assignLocales(),"SC.Locale["+this.language+"]"+SC.guidFor(this)},locWithDefault:function(e,t){var n=this.strings[e];return SC.typeOf(n)===SC.T_STRING?n:SC.typeOf(t)===SC.T_STRING?t:e},locMetric:function(e){var t=this.metrics[e];return SC.typeOf(t)===SC.T_NUMBER?t:t===undefined?(SC.warn('No localized metric found for key "'+e+'"'),undefined):(SC.warn('Unexpected metric type for key "'+e+'"'),undefined)},locLayout:function(e,t){var n,r,i,s,o,u=SC.Locale.layoutKeys,a=this.metrics,f=SC.typeOf,l=SC.T_NUMBER,c={};t&&SC.mixin(c,t);for(n=0,r=u.length;n0&&n[0].isSCArray&&(n=n[0]);try{return SC.String.fmt(t,n)}catch(r){SC.error("Error processing string with key: "+e),SC.error("Localized String: "+t),SC.error("Error: "+r)}},locMetric:function(e){var t=SC.Locale,n=t.currentLocale;return n||(t.createCurrentLocale(),n=t.currentLocale),n.locMetric(e)},locLayout:function(e,t){var n=SC.Locale,r=n.currentLocale;return r||(n.createCurrentLocale(),r=n.currentLocale ),r.locLayout(e,t)},locWithDefault:function(e,t){SC.Locale.currentLocale||SC.Locale.createCurrentLocale();var n=SC.Locale.currentLocale.locWithDefault(e,t);SC.typeOf(n)!==SC.T_STRING&&(n=e);var r=SC.$A(arguments);return r.shift(),r.shift(),SC.String.fmt(n,r)},trim:jQuery.trim,trimLeft:function(e){return e.replace(SC.STRING_TRIM_LEFT_REGEXP,"")},trimRight:function(e){return e.replace(SC.STRING_TRIM_RIGHT_REGEXP,"")},mult:function(e,t){if(SC.typeOf(t)!==SC.T_NUMBER||t<1)return null;var n="";for(var r=0;r0&&this._findResponderNamesFor(i,t-1,n),n.pop()}}},makeFirstResponder:function(e,t){var n=this.get("firstResponder"),r=this.get("nextResponder"),i=this.get("trace"),s;if(this._locked){i&&SC.Logger.log("%@: AFTER ACTION: makeFirstResponder => %@".fmt(this,this.responderNameFor(e))),this._pendingResponder=e;return}i&&SC.Logger.log("%@: makeFirstResponder => %@".fmt(this,this.responderNameFor(e))),e&&e.set("becomingFirstResponder",YES),this._locked=YES,this._pendingResponder=null,s=e?e:null;while(s){if(s.get("hasFirstResponder"))break;s=s===r?null:this.nextResponderFor(s)}return s||(s=r),this._notifyWillLoseFirstResponder(n,n,s,t),n&&n.set("isFirstResponder",NO),this.beginPropertyChanges(),this.set("firstResponder",e),e&&e.set("isFirstResponder",YES),this._notifyDidBecomeFirstResponder(e,e,s),this.endPropertyChanges(),this._locked=NO,this._pendingResponder&&(this.makeFirstResponder(this._pendingResponder),this._pendingResponder=null),e&&e.set("becomingFirstResponder",NO),this},_notifyWillLoseFirstResponder:function(e,t,n,r){if(!t||t===n)return;t.willLoseFirstResponder(e,r),t.set("hasFirstResponder",NO);var i=this.nextResponderFor(t);i&&this._notifyWillLoseFirstResponder(e,i,n)},_notifyDidBecomeFirstResponder:function( e,t,n){if(!t||t===n)return;var r=this.nextResponderFor(t);r&&this._notifyDidBecomeFirstResponder(e,r,n),t.set("hasFirstResponder",YES),t.didBecomeFirstResponder(e)},resetFirstResponder:function(){var e=this.get("firstResponder");if(!e)return;e.willLoseFirstResponder(),e.didBecomeFirstResponder()},sendAction:function(e,t,n){var r=this.get("firstResponder"),i=this.get("nextResponder"),s=this.get("trace"),o=NO,u;this._locked=YES,s&&SC.Logger.log("%@: begin action '%@' (%@, %@)".fmt(this,e,t,n)),!o&&!r&&this.tryToPerform&&(o=this.tryToPerform(e,t,n));while(!o&&r)r.tryToPerform&&(o=r.tryToPerform(e,t,n)),o||(r=r===i?null:this.nextResponderFor(r));s&&(o?SC.Logger.log("%@: action '%@' handled by %@".fmt(this,e,this.responderNameFor(r))):SC.Logger.log("%@: action '%@' NOT HANDLED".fmt(this,e))),this._locked=NO;if(u=this._pendingResponder)this._pendingResponder=null,this.makeFirstResponder(u);return r}},SC.RTLSupport={layoutRecipe:null,init:function(e){e();if(!this._isLayoutHashEqualToDefault())throw new Error('The layout value set for "%@" is neither null nor has the default value of {top: 0, left: 0, bottom: 0, right: 0}.'.fmt(this)+"While using this mixin the layout value should not be set. Instead layoutRecipe should be used.");this.layoutDirectionDidChange()}.enhance(),layoutDirectionDidChange:function(){if(!this._isLayoutRecipeValid())throw new Error('The layoutRecipe set for "%@" is not valid. Either it is null or it has "left" and "right" values.'.fmt(this));var e=this.get("layoutRecipe"),t=this._isPreviousLayoutDirectionRTL,n=SC.Locale.currentLocale.get("isRTL");if(t!==n){var r= SC.clone(e),i=r.start,s=r.end,o,u;n?(u=i,o=s):(o=i,u=s),delete r.start,delete r.end,o!==undefined&&(r.left=o),u!==undefined&&(r.right=u),this.set("layout",r)}this._isPreviousLayoutDirectionRTL=n}.observes("SC.Locale.currentLocale"),_isPreviousLayoutDirectionRTL:null,_isLayoutHashEqualToDefault:function(){var e=this.get("layout"),t=!0,n;if(e){var r=SC.View.prototype.layout,i={};for(n in e){if(e[n]!==r[n]){t=!1;break}i[n]=!0}if(t)for(n in r)if(!i[n]){t=!1;break}}return t},_isLayoutRecipeValid:function(){var e=this.get("layoutRecipe"),t=!0;if(e){if(e.left!==undefined||e.right!==undefined)t=!1}else t=!1;return t}},SC.bodyOverflowArbitrator=SC.Object.create({requestHidden:function(e,t){this._makeRequest(e,-1-9*!!t)},requestVisible:function(e,t){this._makeRequest(e,1+9*!!t)},withdrawRequest:function(e){if(!e)return;var t=SC.guidFor(e);this._requests[t]&&delete this._requests[t],this.setOverflow()},setOverflow:function(){var e=this._decideOverflow();e!==undefined&&(document.body.style.overflow=e?"auto":"hidden")},_makeRequest:function(e,t){if(!e)return;var n=SC.guidFor(e);this._requests[n]=t,this.setOverflow()},_requests:{},_decideOverflow:function(){var e,t,n,r,i=this._requests,s;for(var o in i)(s=i[o])<0&&(e=YES),s<-1&&(n=YES),s>0&&(t=YES),s>1&&(r=YES);return r?YES:t&&n?NO:t?YES:e?NO:undefined}}),SC.mixin(SC.browser,{compareVersion:function(){if(this._versionSplit===undefined){var e=function(e){return Number(e.match(/^[0-9]+/))};this._versionSplit=SC.A(this.version.split(".")).map(e)}var t=SC.A(arguments).map(Number);for(var n=0;n=0)this[t]=e.objectAt?e.objectAt(t):e[t];this.length=e.length}else this[0]=e,this.length=1;return this},size:function(){return this.length},pushStack:function(){var e=this.constructor.apply(this,arguments);return e.prevObject=this,e},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 e=SC.Enumerable,t=SC.Builder.fn,n,r;for(n in e){if(!e.hasOwnProperty(n))continue;r=Array.prototype[n]||e[n],t[n]=r}}(),SC.$=SC.CoreQuery=jQuery,SC.mixin(SC.$.fn,{isCoreQuery:YES,toString:function(){var e=[],t=this.length,n=0;for(n=0;n(%@)".fmt(SC.guidFor(this),e.join(" , "))},isVisible:function(){return Array.prototype.every.call(this,function(e){return SC.$.isVisible(e)})},view:function(){return this.map(function(){var e=null,t=SC.viewKey,n=this,r;while(! e&&n&&n!==document)n.nodeType===1&&(r=n.getAttribute("id"))&&(e=SC.View.views[r]),n=n.parentNode;return n=null,e})},within:function(e){return this.filter(e).length?!0:!!this.has(e).length}}),function(){var e={},t={find:function(t,n){return n!==undefined?SC.Enumerable.find.call(this,t,n):e.find.call(this,t)},filter:function(t,n){return n!==undefined?this.pushStack(SC.Enumerable.filter.call(this,t,n)):e.filter.call(this,t)},filterProperty:function(e,t){return this.pushStack(SC.Enumerable.filterProperty.call(this,e,t))},indexOf:SC.$.index,map:function(t,n){return n!==undefined?SC.Enumerable.map.call(this,t,n):e.map.call(this,t)}},n=SC.$.fn,r=SC.Enumerable,i;for(var s in r)r.hasOwnProperty(s)&&(i=r[s],s in t&&(e[s]=n[s],i=t[s]),n[s]=i)}(),SC.mixin(SC.$,{isVisible:function(e){var t=SC.$;return"hidden"!=e.type&&t.css(e,"display")!="none"&&t.css(e,"visibility")!="hidden"}}),SC.Event=function(e){var t,n;if(e){this.originalEvent=e;var r=SC.Event._props,i;n=r.length,t=n;while(--t>=0)i=r[t],this[i]=e[i]}this.timeStamp=this.timeStamp||Date.now(),this.target||(this.target=this.srcElement||document),this.target.nodeType===3&&(this.target=this.target.parentNode),!this.relatedTarget&&this.fromElement&&(this.relatedTarget=this.fromElement===this.target?this.toElement:this.fromElement);if(SC.none(this.pageX)&&!SC.none(this.clientX)){var s=document.documentElement,o=document.body;this.pageX=this.clientX+(s&&s.scrollLeft||o&&o.scrollLeft||0)-(s.clientLeft||0),this.pageY=this.clientY+(s&&s.scrollTop||o&&o.scrollTop||0)-(s.clientTop||0)}!this.which&&(this.charCode||e.charCode===0?this.charCode:this .keyCode)&&(this.which=this.charCode||this.keyCode),!this.metaKey&&this.ctrlKey&&(this.metaKey=this.ctrlKey),!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"||this.type==="wheel"){var u=SC.Event.MOUSE_WHEEL_MULTIPLIER;(SC.browser.webkit||SC.browser.edge)&&e.wheelDelta!==undefined?(this.wheelDelta=0-(e.wheelDeltaY||e.wheelDeltaX),this.wheelDeltaY=0-(e.wheelDeltaY||0),this.wheelDeltaX=0-(e.wheelDeltaX||0)):!SC.none(e.detail)&&SC.browser.mozilla?e.axis&&e.axis===e.HORIZONTAL_AXIS?(this.wheelDeltaX=e.detail,this.wheelDeltaY=this.wheelDelta=0):(this.wheelDeltaY=this.wheelDelta=e.detail,this.wheelDeltaX=0):!SC.none(e.deltaX)&&SC.browser.msie?(this.wheelDeltaY=e.deltaY||0,this.wheelDeltaX=e.deltaX||0,this.wheelDelta=this.wheelDeltaY||this.wheelDeltaX):(this.wheelDelta=this.wheelDeltaY=SC.browser.msie||SC.browser.opera?0-e.wheelDelta:e.wheelDelta,this.wheelDeltaX=0),this.wheelDelta*=u,this.wheelDeltaX*=u,this.wheelDeltaY*=u}return this},SC.mixin(SC.Event,{MOUSE_WHEEL_MULTIPLIER:function(){var e=1,t=parseFloat(SC.browser.version);return SC.browser.safari?(e=.4,t>=533.17&&t<534?e=.004:t<533&&(e=40)):SC.browser.msie?e=.3:SC.browser.chrome&&(e=.4),e}(),MOUSE_WHEEL_DELTA_LIMIT:1e3,_MOUSE_WHEEL_LIMIT_INVALIDATED:NO,create:function(e){return new SC.Event(e)},add:function(e,t,n,r,i,s){if(e&&e.isCoreQuery){if(e.length>0)return e.forEach(function(e){this.add(e,t,n,r,i)},this),this;e=e[0]}if(!e)return this;s||(s=NO);if(e.nodeType===3||e.nodeType===8)return SC.Event ;SC.typeOf(n)===SC.T_FUNCTION?(i=r,r=n,n=null):n&&SC.typeOf(r)===SC.T_STRING&&(r=n[r]);var o=SC.data(e,"sc_events")||SC.data(e,"sc_events",{}),u=o[t];return u||(u=o[t]={},this._addEventListener(e,t,s)),u[SC.hashFor(n,r)]=[n,r,i],SC.Event._global[t]=YES,e=o=u=null,this},remove:function(e,t,n,r){if(e&&e.isCoreQuery){if(e.length>0)return e.forEach(function(e){this.remove(e,t,n,r)},this),this;e=e[0]}if(!e)return this;if(e.nodeType===3||e.nodeType===8)return SC.Event;var i,s,o=SC.data(e,"sc_events");if(!o)return this;if(t===undefined)for(t in o)this.remove(e,t);else if(i=o[t]){var u=NO;if(n||r){SC.typeOf(n)===SC.T_FUNCTION?(r=n,n=null):SC.typeOf(r)===SC.T_STRING&&(r=n[r]),delete i[SC.hashFor(n,r)],s=null;for(s in i)break;s===null&&(u=YES)}else u=YES;u&&(delete o[t],this._removeEventListener(e,t)),s=null;for(s in o)break;s||(SC.removeData(e,"sc_events"),delete this._elements[SC.guidFor(e)])}return e=o=i=null,this},NO_BUBBLE:["blur","focus","change"],simulateEvent:function(e,t,n){var r=SC.Event.create({type:t,target:e,preventDefault:function(){this.cancelled=YES},stopPropagation:function(){this.bubbles=NO},allowDefault:function(){this.hasCustomEventHandling=YES},timeStamp:Date.now(),bubbles:this.NO_BUBBLE.indexOf(t)<0,cancelled:NO,normalized:YES});return n&&SC.mixin(r,n),r},trigger:function(e,t,n,r){if(e&&e.isCoreQuery){if(e.length>0)return e.forEach(function(e){this.trigger(e,t,n,r)},this),this;e=e[0]}if(!e)return this;if(e.nodeType===3||e.nodeType===8)return undefined;n=SC.A(n);var i,s=SC.typeOf(e[t]||null)===SC.T_FUNCTION,o,u,a,f;o=n[0];if(!o||!o.preventDefault)o=this.simulateEvent (e,t),n.unshift(o);o.type=t,u=e;do i=SC.Event.handle.apply(u,n),u=u===document?null:u.parentNode||document;while(!i&&o.bubbles&&u);u=null,a=e["on"+t],f=SC.$.nodeName(e,"a")&&t==="click",(!s||f)&&a&&a.apply(e,n)===NO&&(i=NO);if(s&&r!==NO&&i!==NO&&!f){this.triggered=YES;try{e[t]()}catch(l){}}return this.triggered=NO,i},handle:function(e){if(typeof SC=="undefined"||SC.Event.triggered)return YES;var t,n,r,i,s,o,u,a,f,l;o=SC.A(arguments),o[0]=e=SC.Event.normalizeEvent(e||window.event),s=(SC.data(this,"sc_events")||{})[e.type];if(!s)return NO;for(u in s)a=s[u],f=a[1],e.handler=f,e.data=e.context=a[2],l=a[0]||this,n=f.apply(l,o),t!==NO&&(t=n),n===NO&&(e.preventDefault(),e.stopPropagation());return t},unload:function(){var e,t=this._elements;for(e in t)this.remove(t[e]);for(e in t)delete t[e];delete this._elements},special:{ready:{setup:function(){SC._bindReady();return},teardown:function(){return}},mouseenter:{setup:function(){return SC.browser.msie?NO:(SC.Event.add(this,"mouseover",SC.Event.special.mouseenter.handler),YES)},teardown:function(){return SC.browser.msie?NO:(SC.Event.remove(this,"mouseover",SC.Event.special.mouseenter.handler),YES)},handler:function(e){return SC.Event._withinElement(e,this)?YES:(e.type="mouseenter",SC.Event.handle.apply(this,arguments))}},mouseleave:{setup:function(){return SC.browser.msie?NO:(SC.Event.add(this,"mouseout",SC.Event.special.mouseleave.handler),YES)},teardown:function(){return SC.browser.msie?NO:(SC.Event.remove(this,"mouseout",SC.Event.special.mouseleave.handler),YES)},handler:function(e){return SC.Event._withinElement(e,this)?YES:(e.type="mouseleave" ,SC.Event.handle.apply(this,arguments))}}},KEY_BACKSPACE:8,KEY_TAB:9,KEY_RETURN:13,KEY_ESC:27,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(e,t){var n=e.relatedTarget;while(n&&n!==t)try{n=n.parentNode}catch(r){n=t}return n===t},_addEventListener:function(e,t,n){var r,i=this.special[t];n||(n=NO);if(!i||i.setup.call(e)===NO){var s=SC.guidFor(e);this._elements[s]=e,r=SC.data(e,"listener")||SC.data(e,"listener",function(){return SC.Event.handle.apply(SC.Event._elements[s],arguments)}),e.addEventListener?e.addEventListener(t,r,n):e.attachEvent&&e.attachEvent("on"+t,r)}e=i=r=null},_removeEventListener:function(e,t){var n,r=SC.Event.special[t];if(!r||r.teardown.call(e)===NO)n=SC.data(e,"listener"),n&&(e.removeEventListener?e.removeEventListener(t,n,NO):e.detachEvent&&e.detachEvent("on"+t,n));e=r=n=null},_elements:{},normalizeEvent:function(e){return e===window.event?SC.Event.create(e):e.normalized?e:SC.Event.create(e)},_global:{},_props:"altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase 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".split(" ")}),SC.Event.prototype={hasCustomEventHandling:NO,touchesForView:function(e){if(this.touchContext)return this.touchContext.touchesForView(e)},touchesForResponder :function(e){if(this.touchContext)return this.touchContext.touchesForView(e)},averagedTouchesForView:function(e){return this.touchContext?this.touchContext.averagedTouchesForView(e):null},allowDefault:function(){return this.hasCustomEventHandling=YES,this},preventDefault:function(){var e=this.originalEvent;return e&&(e.preventDefault&&e.preventDefault(),e.returnValue=NO),this.hasCustomEventHandling=YES,this},stopPropagation:function(){var e=this.originalEvent;return e&&(e.stopPropagation&&e.stopPropagation(),e.cancelBubble=YES),this.hasCustomEventHandling=YES,this},stop:function(){return this.preventDefault().stopPropagation()},normalized:YES,getCharString:function(){if(SC.browser.msie){if(this.keyCode==8||this.keyCode==9||this.keyCode>=37&&this.keyCode<=40)return String.fromCharCode(0);var e=this.keyCode>=96&&this.keyCode<=105?this.charCode:this.keyCode;return e>0?String.fromCharCode(e):null}return this.charCode>0?String.fromCharCode(this.charCode):null},commandCodes:function(){var e=this.keyCode,t=null,n=null,r="",i;if(e){t=SC.FUNCTION_KEYS[e],!t&&(this.altKey||this.ctrlKey||this.metaKey)&&(t=SC.PRINTABLE_KEYS[e]);if(t){this.altKey&&(r+="alt_");if(this.ctrlKey||this.metaKey)r+="ctrl_";this.shiftKey&&(r+="shift_")}}return t||(e=this.which,e>95&&e<106&&(e-=48),n=t=String.fromCharCode(e),i=t.toLowerCase(),this.metaKey?(r="meta_",t=i):t=null),t&&(t=r+t),[t,n]}},SC.Event.observe=SC.Event.add,SC.Event.stopObserving=SC.Event.remove,SC.Event.fire=SC.Event.trigger,SC.browser.msie&&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="default",SC.AUTO_CURSOR=SC.DEFAULT_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 e=this.get("cursorStyle")||SC.DEFAULT_CURSOR,t=this.constructor.sharedStyleSheet(),n=SC.guidFor(this);return t.insertRule?t.insertRule("."+n+" {cursor: "+e+";}",t.cssRules?t.cssRules.length:0):t.addRule&&t.addRule("."+n,"cursor: "+e),this.cursorStyle=e,this.className=n,this},className:null ,cursorStyle:SC.DEFAULT_CURSOR,cursorStyleDidChange:function(){var e,t,n,r,i,s,o;e=this.get("cursorStyle")||SC.DEFAULT_CURSOR,t=this._rule;if(t){t.style.cursor=e;return}n="."+this.get("className"),r=this.constructor.sharedStyleSheet(),i=(r.cssRules?r.cssRules:r.rules)||[];for(s=0,o=i.length;s=0&&t.removeAt(n),this},removeAllChildren:function(){var e=this.get("childViews"),t;while(t=e.objectAt(e.get("length")-1))this.removeChild(t);return this},removeFromParent:function(){var e=this.get("parentView" );return e&&e.removeChild(this),this},destroy:function(){return this.get("isDestroyed")?this:(this._destroy(),this.get("parentView")&&this.removeFromParent(),arguments.callee.base.apply(this,arguments))},_destroy:function(){this.destroyLayer();var e=this.get("childViews"),t=e.length,n;if(t){e=e.slice();for(n=0;n=0)i=n[r],e=t[r],e&&i&&typeof i===SC.T_STRING&&SC.String.loc(i,e);return this},applyLocalizedAttributes:function(e){SC.mixin(this.prototype,e)},views:{}}),SC.outlet=function(e,t){return function(n){return this[n]=SC.objectForPropertyPath(e,t!==undefined?t:this)}.property()},SC.CoreView.unload=function(){var e=SC.View.views;if(e)for(var t in e){if(!e.hasOwnProperty(t))continue;delete e[t]}},SC.View=SC.CoreView.extend({classNames:["sc-view"],displayProperties:["isFirstResponder" ]}),SC.browser.msie&&SC.Event.add(window,"unload",SC.View,SC.View.unload),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.View.reopen({didCreateLayerMixin:function(){SC.platform.supportsCSSTransitions&&this.resetAnimation()},animate:function(e,t,n,r){var i,s;typeof e===SC.T_STRING?(i={},i[e]=t,s=n):(i=e,s=t,r=n);var o=SC.typeOf(s);if(o===SC.T_NUMBER)s={duration:s};else if(o!==SC.T_HASH)throw"Must provide options hash or duration!";r&&(s.callback=r);var u=s.timing;u?typeof u!==SC.T_STRING&&(s.timing="cubic-bezier("+u[0]+", "+u[1]+", "+u[2]+", "+u[3]+")"):s.timing="linear";var a=SC.clone(this.get("layout")),f=NO,l,c,h,p,d;a.animate||(a.animate={});for(d in i){if(!i.hasOwnProperty(d)||!SC.ANIMATABLE_PROPERTIES[d])continue;l=i[d],c=a[d],p=a.animate[d];if(l==null)throw"Can only animate to an actual value!";if(c!==l||p&&p.duration!==s.duration)f=YES,a.animate[d]=s,a[d]=l}return f&&this.set("layout",a),this},resetAnimation:function(){var e=this.get("layout"),t=e.animate,n=NO,r;if(!t)return;var i;for(r in t)n=YES,delete t[r];return n&&(this.set("layout",e),this.notifyPropertyChange("layout")),this},transitionDidEnd:function(e){this.get("layoutStyleCalculator").transitionDidEnd(e)}}),SC.CSS_TRANSFORM_MAP={rotate:function(e){return null},rotateX:function(e){return SC.typeOf(e)===SC.T_NUMBER&&(e+="deg"),"rotateX("+e+")"},rotateY:function(e){return SC.typeOf(e)===SC.T_NUMBER&&(e+="deg"),"rotateY("+e+")"},rotateZ:function(e){return SC.typeOf(e)===SC.T_NUMBER&& (e+="deg"),"rotateZ("+e+")"},scale:function(e){return SC.typeOf(e)===SC.T_ARRAY&&(e=e.join(", ")),"scale("+e+")"}},SC.View.reopen({layoutStyleCalculator:null,layoutStyle:function(){var e={layout:this.get("layout"),turbo:this.get("hasAcceleratedLayer"),staticLayout:this.get("useStaticLayout")},t=this.get("layoutStyleCalculator");return t.set(e),t._layoutDidUpdate(),t.calculate()}.property().cacheable()}),SC.View.LayoutStyleCalculator=SC.Object.extend({_layoutDidUpdate:function(){var e=this.get("layout");if(!e)return;this.dims=SC._VIEW_DEFAULT_DIMS,this.loc=this.dims.length;var t=this.right=e.right;this.hasRight=t!=null;var n=this.left=e.left;this.hasLeft=n!=null;var r=this.top=e.top;this.hasTop=r!=null;var i=this.bottom=e.bottom;this.hasBottom=i!=null;var s=this.width=e.width;this.hasWidth=s!=null;var o=this.height=e.height;this.hasHeight=o!=null,this.minWidth=e.minWidth===undefined?null:e.minWidth;var u=this.maxWidth=e.maxWidth===undefined?null:e.maxWidth;this.hasMaxWidth=u!=null,this.minHeight=e.minHeight===undefined?null:e.minHeight;var a=this.maxHeight=e.maxHeight===undefined?null:e.maxHeight;this.hasMaxHeight=a!=null;var f=this.centerX=e.centerX;this.hasCenterX=f!=null;var l=this.centerY=e.centerY;this.hasCenterY=l!=null;var c=this.borderTop=(e.borderTop!==undefined?e.borderTop:e.border)||0,h=this.borderRight=(e.borderRight!==undefined?e.borderRight:e.border)||0,p=this.borderBottom=(e.borderBottom!==undefined?e.borderBottom:e.border)||0,d=this.borderLeft=(e.borderLeft!==undefined?e.borderLeft:e.border)||0;this.zIndex=e.zIndex!=null?e.zIndex.toString():null,this.opacity=e .opacity!=null?e.opacity.toString():null,this.backgroundPosition=e.backgroundPosition!=null?e.backgroundPosition:null,this.ret={marginTop:null,marginLeft:null}},_invalidAutoValue:function(e){var t=SC.Error.desc("%@.layout() you cannot use %@:auto if staticLayout is disabled".fmt(this.get("view"),e),"%@".fmt(this.get("view")),-1);throw SC.Logger.error(t.toString()),t},_handleMistakes:function(){var e=this.get("layout");this.staticLayout||(this.width===SC.LAYOUT_AUTO&&this._invalidAutoValue("width"),this.height===SC.LAYOUT_AUTO&&this._invalidAutoValue("height"));if(SC.platform.supportsCSSTransforms){var t=e.animate,n,r;if(t)for(r in t)if(SC.CSS_TRANSFORM_MAP[r]){if(this._pendingAnimations&&this._pendingAnimations["-"+SC.platform.cssPrefix+"-transform"])throw"Animations of transforms must be executed simultaneously!";n&&t[r].duration!==n&&(SC.Logger.warn("Can't animate transforms with different durations! Using first duration specified."),t[r].duration=n),n=t[r].duration}}},_calculatePosition:function(e){var t=null,n=this.get("turbo"),r=this.ret;if(!r)return t;var i,s,o,u,a,f,l,c,h,p,d,v,m,g;e==="x"?(i="left",s="right",o="width",u="maxWidth",a="marginLeft",p="borderLeft",v="borderRight",f=this.hasLeft,l=this.hasRight,c=this.hasWidth,h=this.hasMaxWidth):(i="top",s="bottom",o="height",u="maxHeight",a="marginTop",p="borderTop",v="borderBottom",f=this.hasTop,l=this.hasBottom,c=this.hasHeight,h=this.hasMaxHeight),r[i]=this._cssNumber(this[i]),r[s]=this._cssNumber(this[s]),d=this._cssNumber(this[p]),m=this._cssNumber(this[v]),r[p+"Width"]=d||null,r[v+"Width"]=m||null,g=this[o],g>=1&& (g-=d+m),r[o]=this._cssNumber(g);if(f)n&&(t=r[i],r[i]=0),l&&c&&(r[s]=null);else if(!l||l&&!c&&!h)r[i]=0;return!c&&!l&&(r[s]=0),t},_calculateCenter:function(e){var t=this.ret,n,r,i,s,o,u,a,f,l;e==="x"?(n="width",r="centerX",i="left",s="right",o="marginLeft",u="borderLeft",f="borderRight"):(n="height",r="centerY",i="top",s="bottom",o="marginTop",u="borderTop",f="borderBottom"),t[i]="50%",a=this._cssNumber(this[u]),l=this._cssNumber(this[f]),t[u+"Width"]=a||null,t[f+"Width"]=l||null;var c=this[n],h=this[r],p=this[i],d=SC.isPercentage(c),v=SC.isPercentage(h,YES);c>1&&(c-=a+l);if(d&&v||!d&&!v){var m=h-c/2;t[o]=d?m*100+"%":m}else SC.Logger.warn("You have to set "+n+" and "+r+" using both percentages or pixels"),t[o]="50%";t[n]=this._cssNumber(c)||0,t[s]=null},_calculateTransforms:function(e,t){if(SC.platform.supportsCSSTransforms){var n=this.get("layout"),r=SC.platform.domCSSPrefix+"Transform",i=[];this.turbo&&(i.push("translateX("+(e||0)+"px)","translateY("+(t||0)+"px)"),SC.platform.supportsCSS3DTransforms&&i.push("translateZ(0px)"));var s=SC.CSS_TRANSFORM_MAP;for(var o in s){var u=n[o];u!=null&&i.push(s[o](u))}this.ret[r]=i.length>0?i.join(" "):null}},_calculateAnimations:function(e,t){var n=this.layout,r=n.animate,i;if(!r)return;if(this.getPath("view.isAnimatable"))return;var s=[],o;this._animatedTransforms=[],this._pendingAnimations||(this._pendingAnimations={});var u="-"+SC.platform.cssPrefix+"-transform";if(SC.platform.supportsCSSTransitions){for(i in r){o=r[i];var a=SC.CSS_TRANSFORM_MAP[i],f=i==="top"&&t!=null||i==="left"&&e!=null;SC.platform.supportsCSSTransforms&&(f||a)&& (this._animatedTransforms.push(i),i=u),o.css=i+" "+o.duration+"s "+o.timing,this._pendingAnimations[i]||(this._pendingAnimations[i]=o,s.push(o.css))}this.ret[SC.platform.domCSSPrefix+"Transition"]=s.join(", ")}else for(i in r)this._pendingAnimations[i]=r[i];delete n.animate},_cssNumber:function(e){return e==null?null:e===SC.LAYOUT_AUTO?SC.LAYOUT_AUTO:SC.isPercentage(e)?e*100+"%":e},calculate:function(){var e=this.get("layout"),t=null,n=this.get("staticLayout"),r=null,i=null,s=this.get("turbo"),o=this.ret,u=this.dims,a=this.loc,f=this.get("view"),l,c;this._handleMistakes(e);if(n&&e===SC.View.prototype.layout)return{};this.hasLeft||this.hasRight||!this.hasCenterX?i=this._calculatePosition("x"):this._calculateCenter("x"),this.hasTop||this.hasBottom||!this.hasCenterY?r=this._calculatePosition("y"):this._calculateCenter("y"),o.minWidth=this.minWidth,o.maxWidth=this.maxWidth,o.minHeight=this.minHeight,o.maxHeight=this.maxHeight,o.zIndex=this.zIndex,o.opacity=this.opacity,o.backgroundPosition=this.backgroundPosition,this._calculateTransforms(i,r),this._calculateAnimations(i,r);for(l in o)c=o[l],typeof c===SC.T_NUMBER&&(o[l]=c+"px");return o},willRenderAnimations:function(){if(SC.platform.supportsCSSTransitions){var e=this.get("view"),t=e.get("layer"),n=t?t.style:null,r=e.get("layoutStyle"),i=this._activeAnimations,s,o=this._pendingAnimations,u,a=this._animatedTransforms,f=a?a.length:0,l=r[SC.platform.domCSSPrefix+"Transition"],c=e.get("layout"),h,p,d,v;if(o){i||(i={});for(h in o){if(!o.hasOwnProperty(h))continue;u=o[h],s=i[h],v=NO,r[h]!==(n?n[h]:null)&&(v=YES),s&&(s.duration!==u.duration|| s.timing!==u.timing)&&(v=YES);if(v&&s){if(p=s.callback)if(f>0){for(d=0;d0)for(r=0;r0){for(u=0;u=0){var r=e.action.split("."),i=r.pop(),s=SC.objectForPropertyPath(r,window),o=s.get?s.get(i):s[i];if(!o||SC.typeOf(o)!=SC.T_FUNCTION)throw"SC.runCallback could not find a function at %@".fmt(e.action);o.apply(s,t)}},SC.View.runCallback=SC.CoreView.runCallback,SC.View.reopen({wantsAcceleratedLayer:NO,hasAcceleratedLayer:function(){if(this.get("wantsAcceleratedLayer")&&SC.platform.supportsAcceleratedLayers){var e=this.get("layout"),t=e.animate,n=SC.LAYOUT_AUTO,r;if(t&&(t.top||t.left))for(r in t)if(SC.CSS_TRANSFORM_MAP[r]&&(t.top&&t.top.duration!==t[r].duration||t.left&&t.left.duration!==t[r].duration))return NO;if(e.left!=null&&!SC.isPercentage(e.left)&&e.left!==n&&e.top!=null&&!SC.isPercentage(e.top)&&e.top!==n&&e.width!=null&&!SC.isPercentage(e.width)&&e.width!==n&&e.height!=null&&!SC.isPercentage(e.height)&&e.height!==n)return YES}return NO}.property("wantsAcceleratedLayer").cacheable()}),SC.View.reopen({cursor:function(e,t){var n;return t&&(this._setCursor=t),this._setCursor!==undefined?this._setCursor:(n=this.get("parentView"),this.get("shouldInheritCursor")&&n?n.get("cursor"):null)}.property("parentView","shouldInheritCursor" ).cacheable(),applyAttributesToContext:function(e,t){var n=this.get("cursor");n&&t.addClass(n.get("className")),e(t)}.enhance(),shouldInheritCursor:YES}),SC.View.reopen({isEnabled:YES,isEnabledBindingDefault:SC.Binding.oneWay().bool(),isEnabledInPane:function(){var e=this.get("isEnabled"),t;return e&&(t=this.get("parentView"))&&(e=t.get("isEnabledInPane")),e}.property("parentView","isEnabled"),_sc_view_isEnabledDidChange:function(){!this.get("isEnabled")&&this.get("isFirstResponder")&&this.resignFirstResponder()}.observes("isEnabled"),applyAttributesToContext:function(e,t){var n=this.get("isEnabled");e(t),t.setClass("disabled",!n),t.attr("aria-disabled",n?null:"true")}.enhance()}),SC.View.reopen({isKeyResponder:NO,willLoseKeyResponderTo:function(e){},willBecomeKeyResponderFrom:function(e){},didLoseKeyResponderTo:function(e){},didBecomeKeyResponderFrom:function(e){},interpretKeyEvents:function(e){var t=e.commandCodes(),n=t[0],r=t[1],i;if(!n&&!r)return null;if(n){var s=SC.MODIFIED_KEY_BINDINGS[n]||SC.BASE_KEY_BINDINGS[n.match(/[^_]+$/)[0]];if(s){var o=this,u=this.get("pane"),a=null;while(o&&!(a=o.tryToPerform(s,e)))o=o===u?null:o.get("nextResponder");return a}}return r&&this.respondsTo("insertText")?(i=this.insertText(r,e),i?i===YES?this:i:null):null},insertText:function(e){return NO},performKeyEquivalent:function(e,t){var n=NO,r=this.get("childViews"),i=r.length,s=-1,o;while(!n&&++sr.maxHeight&&(n.height=r.maxHeight),!SC.none(r.minHeight)&&n.heightr.maxWidth&&(n.width=r.maxWidth),!SC.none(r.minWidth)&&n.width=0;--n)r=e[n],r.endLiveResize&&r.endLiveResize();return this.didEndLiveResize&&this.didEndLiveResize(),this},layoutView:function(){return this.get("parentView")}.property("parentView").cacheable(),layoutDidChange:function(){var e=this._previousLayout,t=this.get("layout"),n=YES,r,i,s,o;SC.none(t.rotate)||SC.none(t.rotateX)&&(t.rotateX=t.rotate,SC.Logger.warn("Please set rotateX instead of rotate")),SC.none(t.rotateX)?delete t.rotate:t.rotate=t.rotateX;var u=t.animations;u&&(SC.none(u.rotate)||SC.none(u.rotateX)&&(u.rotateX=u.rotate,SC.Logger.warn("Please animate rotateX instead of rotate")),SC.none(u.rotateX)?delete u.rotate:u.rotate=u.rotateX),e&&e!==t&&(r=e.width,r!==undefined&&(s=t.width,r===s&&(i=e.height,e!==undefined&&(o=t.height,i===o&&(n=NO))))),this.beginPropertyChanges(),this.notifyPropertyChange("hasAcceleratedLayer"),this.notifyPropertyChange("layoutStyle"),n?this.viewDidResize():this._viewFrameDidChange(),this.endPropertyChanges();var a=this.get("layoutView");return a&&(a.set("childViewsNeedLayout",YES),a.layoutDidChangeFor(this),a.get("childViewsNeedLayout")&&a.invokeOnce(a.layoutChildViewsIfNeeded)),this._previousLayout=t,this},childViewsNeedLayout:NO,layoutDidChangeFor:function(e){var t=this._needLayoutViews;t||(t=this._needLayoutViews=SC.CoreSet.create()),t.add(e)},layoutChildViewsIfNeeded:function(e){return e||(e=this.get("isVisibleInWindow")),e&&this.get("childViewsNeedLayout")&&(this.set("childViewsNeedLayout",NO),this.layoutChildViews()),this},layoutChildViews:function(){var e= this._needLayoutViews,t=e?e.length:0,n;for(n=0;nt.x+t.width?(s-=t.x+t.width,n=i.right):(s=0,n=1),ot.y+t.height?(o-=t.y+t.height,r=i.bottom):(o=0,r=1),s>100||o>100?NO:YES}}),SC.View.reopen({hasVisibility:YES,isVisibleInWindow:NO,recomputeIsVisibleInWindow:function(e){var t=this.get("isVisibleInWindow"),n=this.get("isVisible"),r;n&&(e===undefined&&(r=this.get("parentView"),e=r?r.get("isVisibleInWindow"):NO),n=n&&e);if(t!==n){this.set("isVisibleInWindow",n);var i=this.get("childViews"),s=i.length,o,u;for(o=0;o",e.style.cssText="position:absolute;width:100px;height:100px;overflow-y:visible;",t=e.childNodes[0],document.body.appendChild(e);var n=t.innerWidth||t.clientWidth;e.style.overflowY="scroll";var r=t.innerWidth||t.clientWidth;return document.body.removeChild(e),n-r}.property().cacheable(),touch:"createTouch"in document&&(SC.browser.iOS||SC.browser.android||SC.browser.silk),bounceOnScroll:SC.browser.iOS,pinchToZoom:SC.browser.iOS,input:function(e){var t={},n=e.length,r=document.createElement("input"),i,s;for(s=0;s7)}(),supportsHistory:function(){return!!window.history&&!!window.history.pushState}(),supportsCanvas:function(){return!!document.createElement("canvas").getContext}(),supportsOrientationChange:"onorientationchange"in window,windowSizeDeterminesOrientation:SC.browser.iOS||!("onorientationchange"in window)}),function(){var e=navigator.userAgent.toLowerCase();/webkit/.test(e)?(SC.platform.cssPrefix="webkit",SC.platform.domCSSPrefix="Webkit"):/opera/.test(e)?(SC.platform.cssPrefix="opera",SC.platform.domCSSPrefix="O"):/msie/.test(e)&&!/opera/.test(e)?(SC.platform.cssPrefix="ms",SC.platform.domCSSPrefix="ms"):/mozilla/.test(e)&&!/(compatible|webkit)/.test(e)&&(SC.platform.cssPrefix="moz",SC.platform.domCSSPrefix="Moz")}(),function(){var e=document.createElement("div"),t=["-moz-","-moz-","-o-","-ms-","-webkit-"],n=["moz","Moz","o","ms" ,"webkit"],r="",i=null,s,o;for(i=0,o=t.length;i0){i=r.pop();if(i.get("isPaneAttached")&&i.get("acceptsKeyPane")){t=i;break}}}if(!t){var s=this.get("mainPane");s&&s.get("acceptsKeyPane")&&(t=s)}return n&&n.willLoseKeyPaneTo(t),t&&t.willBecomeKeyPaneFrom(n),this.set("keyPane",t),t&&t.didBecomeKeyPaneFrom(n),n&&n.didLoseKeyPaneTo(t),this},currentWindowSize:null,computeWindowSize:function(){var e,t,n;return!this._bod||!this._docElement?(t=document.body,n=document.documentElement,this._bod=t,this._docElement=n):(t=this._bod,n=this._docElement),window.innerHeight?e={width:window.innerWidth,height:window.innerHeight}:n&&n.clientHeight?e={width:n.clientWidth,height:n.clientHeight}:t&&(e={width:t.clientWidth,height:t.clientHeight}),e},resize:function(){return this._resize(),YES},_resize:function(){var e=this.computeWindowSize(),t=this.get("currentWindowSize");this.set("currentWindowSize",e),SC.rectsEqual(e,t)||(SC.device.windowSizeDidChange(e),this.panes&&SC.run(function(){this.panes.invoke("windowSizeDidChange",t,e)},this))},hasFocus:NO,focus:function(e){return!this.get("hasFocus")&&document.hasFocus()&&SC.run(function(){SC.$("body").addClass("sc-focus").removeClass("sc-blur");if(!SC.TABBING_ONLY_INSIDE_DOCUMENT&&! SC.browser.isIE8OrLower&&!SC.APP_HAS_NONSC_IFRAME){var e=SC.RootResponder.responder.get("keyPane");if(e){var t=e.get("lastViewFirstResponder");if(t)e.makeFirstResponder(t),e.set("lastViewFirstResponder",null);else{var n=e.get("nextValidKeyView");n&&e.makeFirstResponder(n)}}}this.set("hasFocus",YES)},this),YES},focusin:function(e){this._focusTimeout&&clearTimeout(this._focusTimeout),this.focus(e)},focusout:function(e){var t=this;this._focusTimeout=setTimeout(function(){t.blur(e)},300)},blur:function(e){if(this.get("hasFocus")&&!document.hasFocus()){SC.$("body").addClass("sc-blur").removeClass("sc-focus");var t=SC.RootResponder.responder.get("keyPane");if(t){var n=t.get("firstResponder");n&&!SC.browser.isIE8OrLower&&!SC.APP_HAS_NONSC_IFRAME&&n.resignFirstResponder(e)}SC.run(function(){this.set("hasFocus",NO)},this)}return YES},dragDidStart:function(e){this._mouseDownView=e,this._drag=e},defaultResponder:null,sendAction:function(e,t,n,r,i,s){return t=this.targetForAction(e,t,n,r,s),t&&t.isResponderContext?!!t.sendAction(e,n,i,s):t&&t.tryToPerform(e,n)},_responderFor:function(e,t,n){var r=e?e.get("defaultResponder"):null;if(e){e=n||e.get("firstResponder")||e;do if(e.respondsTo(t))return e;while(e=e.get("nextResponder"))}return typeof r===SC.T_STRING&&(r=SC.objectForPropertyPath(r)),r?r.isResponderContext?r:r.respondsTo(t)?r:null:null},targetForAction:function(e,t,n,r,i){if(!e||SC.typeOf(e)!==SC.T_STRING)return null;if(t)return SC.typeOf(t)===SC.T_STRING&&(t=SC.objectForPropertyPath(t)||SC.objectForPropertyPath(t,n)),t&&!t.isResponderContext&&(t.respondsTo&&!t.respondsTo(e)?t=null :SC.typeOf(t[e])!==SC.T_FUNCTION&&(t=null)),t;if(r){t=this._responderFor(r,e,i);if(t)return t}var s=this.get("keyPane"),o=this.get("mainPane");return s&&s!==r&&(t=this._responderFor(s,e)),!t&&o&&o!==s&&(t=this._responderFor(o,e)),!t&&(t=this.get("defaultResponder"))&&(SC.typeOf(t)===SC.T_STRING&&(t=SC.objectForPropertyPath(t),t&&this.set("defaultResponder",t)),t&&!t.isResponderContext&&(t.respondsTo&&!t.respondsTo(e)?t=null:SC.typeOf(t[e])!==SC.T_FUNCTION&&(t=null))),t},targetViewForEvent:function(e){return e.target?SC.$(e.target).view()[0]:null},sendEvent:function(e,t,n){var r,i;return SC.run(function(){n?r=n.get("pane"):r=this.get("menuPane")||this.get("keyPane")||this.get("mainPane"),i=r?r.sendEvent(e,t,n):null},this),i},listenFor:function(e,t,n,r){return n=n?n:this,e.forEach(function(e){var i=n[e];i&&SC.Event.add(t,e,n,i,null,r)},this),t=null,n},setup:function(){this.listenFor(["touchstart","touchmove","touchend","touchcancel"],document),this.listenFor(["keydown","keyup","beforedeactivate","mousedown","mouseup","click","dblclick","mousemove","selectstart","contextmenu","scroll"],document).listenFor(["resize"],window),SC.browser.isIE8OrLower?this.listenFor(["focusin","focusout"],document):this.listenFor(["focus","blur"],window),this.listenFor(["webkitAnimationStart","webkitAnimationIteration","webkitAnimationEnd"],document),SC.platform.supportsCSSTransitions&&this.listenFor(["transitionend",SC.platform.cssPrefix+"TransitionEnd"],document);if(this.keypress)if(SC.CAPTURE_BACKSPACE_KEY&&SC.browser.mozilla){var e=this;document.onkeypress=function(t){return t=SC.Event.normalizeEvent (t),e.keypress.call(e,t)}}else SC.Event.add(document,"keypress",this,this.keypress);["drag","selectstart"].forEach(function(e){var t=this[e];if(t)if(SC.browser.msie){var n=this;document.body["on"+e]=function(e){return t.call(n,SC.Event.normalizeEvent(event||window.event))},SC.Event.add(window,"unload",this,function(){document.body["on"+e]=null})}else SC.Event.add(document,e,this,t)},this);var t="mousewheel";if(SC.browser.mozilla)SC.browser.compareVersion(1,9,1)<0?t="DOMMouseScroll":t="MozMousePixelScroll";else if(parseInt(SC.browser.chrome)>=31||parseInt(SC.browser.msie)>=9||parseInt(SC.browser.safari)>=600||SC.browser.isEdge)t="wheel";SC.Event.add(document,t,this,this.mousewheel),this.set("currentWindowSize",this.computeWindowSize());if(SC.browser.mobileSafari){SC.platform&&!SC.platform.touch&&SC.platform.simulateTouchEvents();var n=SC.RunLoop.prototype.endRunLoop,r;r=function(){n&&n.apply(this,arguments);var e=SC.RootResponder.responder._touches,t,r,i,s,o,u=NO;if(e)for(t in e){if(e[t]._rescuedElement)continue;i=r=e[t].target;while(r&&(r=r.parentNode)&&!u)u=r===document.body;if(!u&&i){if(i.parentNode&&i.cloneNode){var a=i.cloneNode(!0);i.parentNode.replaceChild(a,i),i.swapNode=a}var l=SC.touchHoldingPen;l||(l=SC.touchHoldingPen=document.createElement("div"),l.style.display="none",document.body.appendChild(l)),l.appendChild(i),e[t]._rescuedElement=i}}},SC.RunLoop.prototype.endRunLoop=r}},_touchedViews:{},_touches:{},touchesForView:function(e){if(this._touchedViews[SC.guidFor(e)])return this._touchedViews[SC.guidFor(e)].touches},averagedTouchesForView:function(e,t){var n=this .touchesForView(e),r=e._scrr_averagedTouches||(e._scrr_averagedTouches={});if((!n||n.length===0)&&!t)r.x=0,r.y=0,r.d=0,r.touchCount=0;else{var i=this._averagedTouches_touches||(this._averagedTouches_touches=[]),s;i.length=0;if(n){var o;s=n.length;for(o=0;o-1&&i[i.length-1]!==t){this.unassignTouch(e);var a=i.length-1,f=i[a];while(f&&f!==t)s=this.touchesForView(f),((f.get?f.get("acceptsMultitouch"):f.acceptsMultitouch)||!s)&&f.touchCancelled&&f.touchCancelled(e),a--,f=i[a],i.pop(),e.touchResponder=i[a],e.nextTouchResponder=i[a-1]}t&&(this.assignTouch(e,t),t!==e.touchResponder&&(i.push(t),e.touchResponder=t,e.nextTouchResponder=i[i.length-2])),this._isMakingTouchResponder=NO,this._flushQueuedTouchResponder()},captureTouch:function(e,t,n){t||(t=this);var r=e.targetView,i=r,s=[],o,u;SC.LOG_TOUCH_EVENTS&&SC.Logger.info(" -- Received one touch on %@".fmt(r.toString()));while(i&&i!==t)s.unshift(i),i=i.get("nextResponder");for(u=s.length,o=0;o=37&&t<=40&&SC.browser.mozilla)return YES;n=this.sendEvent("keyDown",e),n?(n=e.hasCustomEventHandling,n&&(i=NO)):n=SC.run(function(){return!this.attemptKeyEquivalent(e)},this)}return i?NO:n} ,keypress:function(e){var t,n=e.keyCode,r=!!SC.browser.mozilla;e.keyCode=e.which=this._lastKeyDownKeyCodeForKeyPress;if(SC.browser.mozilla&&e.keyCode===9){this.keydownCounter++;if(this.keydownCounter==2)return YES}if(r&&e.which===8)return t=this.sendEvent("keyDown",e)||!this.attemptKeyEquivalent(e),t?SC.allowsBackspaceToPreviousPage||e.hasCustomEventHandling:YES;var i=n>=37&&n<=40&&r,s=e.charCode;if(s!==undefined&&s===0&&e.keyCode!==9&&!i)return YES;if(i||!SC.isFunctionOrNonPrintableKey(e))t=this.sendEvent("keyDown",e),t?t=e.hasCustomEventHandling:t=!this.attemptKeyEquivalent(e);return t},keyup:function(e){this._lastKeyDownKeyCodeForKeyPress=null,this._ffevt&&(this._ffevt=null);var t=this._handleModifierChanges(e);return this._isModifierKey(e)?t:(this._IMEInputON&&e.keyCode===13&&(e.isIMEInput=YES,this.sendEvent("keyDown",e),this._IMEInputON=NO),this.sendEvent("keyUp",e)?e.hasCustomEventHandling:YES)},beforedeactivate:function(e){var t=e.toElement;if(t&&t.tagName&&t.tagName!=="IFRAME"){var n=SC.$(t).view()[0];if(n&&n.get("blocksIEDeactivate"))return NO}return YES},mousedown:function(e){if(SC.platform.touch)return e.allowDefault(),this._lastMouseDownCustomHandling=YES,YES;if(e.target&&e.target.tagName==="HTML")return YES;this._clickCount+=1;if(!this._lastMouseUpAt||SC.getCurrentTimeForPerformance()-this._lastMouseUpAt>250)this._clickCount=1;else{var t=this._lastMouseDownX-e.clientX,n=this._lastMouseDownY-e.clientY,r=Math.sqrt(t*t+n*n);r>8&&(this._clickCount=1)}e.clickCount=this._clickCount,this._lastMouseDownX=e.clientX,this._lastMouseDownY=e.clientY;var i,s=this.targetViewForEvent (e);s&&(i=s.getPath("pane.firstResponder")),i&&i.get("blurOnMouseDown")&&i!==s&&i.resignFirstResponder(e),s=this._mouseDownView=this.sendEvent("mouseDown",e,s),s&&s.respondsTo("mouseDragged")&&(this._mouseCanDrag=YES);var o=s?e.hasCustomEventHandling:YES;return this._lastMouseDownCustomHandling=o,o},mouseup:function(e){var t=NO;if(SC.platform.touch)return e.allowDefault(),this._lastMouseUpCustomHandling=YES,YES;this._drag&&(this._drag.tryToPerform("mouseUp",e),this._drag=null);var n=null,r=this._mouseDownView,i=this.targetViewForEvent(e);e.clickCount=this._clickCount,r&&(n=this.sendEvent("mouseUp",e,r),!n&&this._clickCount===2&&(n=this.sendEvent("doubleClick",e,r),t=YES),n||(n=this.sendEvent("click",e,r),t=YES)),!n&&!t&&(this._clickCount===2&&(n=this.sendEvent("doubleClick",e,i)),n||(n=this.sendEvent("click",e,i))),this._mouseCanDrag=NO,this._mouseDownView=null,this._lastMouseUpAt=SC.getCurrentTimeForPerformance();var s=n?e.hasCustomEventHandling:YES;return this._lastMouseUpCustomHandling=s,s},click:function(e){return!this._lastMouseUpCustomHandling||!this._lastMouseDownCustomHandling?(e.preventDefault(),e.stopPropagation(),NO):YES},dblclick:function(e){SC.browser.isIE8OrLower&&(this._clickCount=2,this._mouseDownView=this.targetViewForEvent(e),this.mouseup(e))},mousewheel:function(e){var t=this.targetViewForEvent(e),n=this.sendEvent("mouseWheel",e,t);return n?e.hasCustomEventHandling:YES},_lastHovered:null,mousemove:function(e){if(SC.platform.touch)return e.allowDefault(),YES;if(SC.browser.msie&&this._lastMoveX===e.clientX&&this._lastMoveY===e.clientY)return;this._lastMoveX= e.clientX,this._lastMoveY=e.clientY,SC.run(function(){if(this._drag)SC.browser.msie?(this._lastMouseDownX!==e.clientX||this._lastMouseDownY!==e.clientY)&&this._drag.tryToPerform("mouseDragged",e):this._drag.tryToPerform("mouseDragged",e);else{var t=this._lastHovered||[],n=[],r,i,s,o=this.targetViewForEvent(e);while(o&&o!==this)n.push(o),o=o.get("nextResponder");for(i=0,s=t.length;i=e.width?SC.device.set("orientation",SC.PORTRAIT_ORIENTATION):SC.device.set("orientation",SC.LANDSCAPE_ORIENTATION):SC.device.set("orientation",SC.NO_ORIENTATION)}),YES):NO},orientationchange:function(e){SC.run(function(){window.orientation===0||window.orientation===180?SC.device.set("orientation",SC.PORTRAIT_ORIENTATION):SC.device.set("orientation",SC.LANDSCAPE_ORIENTATION)})},orientationObserver:function(){var e=SC.$(document.body),t=this.get("orientation");t===SC.PORTRAIT_ORIENTATION?e.addClass("portrait"):e.removeClass("portrait"),t===SC.LANDSCAPE_ORIENTATION?e.addClass("landscape"):e.removeClass("landscape")}.observes("orientation"),online:function(e){this.set("isOffline",NO)},offline:function(e){this.set("isOffline",YES)}}),SC.ready(function(){SC.device.setup()}),SC.Page=SC.Object .extend({owner:null,get:function(e){var t=this[e];return t&&t.isClass?(this[e]=t=t.create({page:this}),t.awake(),t):arguments.callee.base.apply(this,arguments)},awake:function(){var e,t;for(t in this){if(!this.hasOwnProperty(t))continue;e=this[t],e&&e.isViewClass&&(this[t]=e=e.create({page:this}))}return this},getIfConfigured:function(e){var t=this[e];return t&&t.isViewClass?null:this.get(e)}}),SC.Page.design=SC.Page.create,SC.Page.localization=function(e){return e},SC.MODE_REPLACE="replace",SC.MODE_APPEND="append",SC.MODE_PREPEND="prepend",SC.NON_PIXEL_PROPERTIES=["zIndex","fontWeight","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(e,t){var n,r;t&&(this.prevObject=t,this.strings=t.strings,this.offset=t.length+t.offset),this.strings||(this.strings=[]),e===undefined?(e="div",r=YES):e==="div"||e==="label"||e==="a"?r=YES:SC.typeOf(e)===SC.T_STRING&&(e=e.toLowerCase(),r=YES);if(r){this._tagName=e,this._needsTag=YES,this.needsContent=YES;var i=this;while(i)i.length++,i=i.prevObject;this.strings.push(null),this._selfClosing=this.SELF_CLOSING.contains(e)}else this._elem=e,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(e){var t=this.strings||[];return e===undefined?t.slice(this.offset,this.length):t[e+this.offset] },push:function(e){var t=this.strings,n=arguments.length;t||(this.strings=t=[]),n>1?t.push.apply(t,arguments):t.push(e);var r=this;while(r)r.length+=n,r=r.prevObject;return this.needsContent=YES,this},text:function(e){var t=arguments.length,n=0;for(n=0;n0){this._innerHTMLReplaced=YES;if(t===SC.MODE_REPLACE)n.html(this.join());else{i=e.cloneNode(!1),i.innerHTML=this.join(),s=i.firstChild;while(s)o=s.nextSibling,e.insertBefore(s,o),s=o;s=o=i=null}}return this._idDidChange&&(r=this._id)&&n.attr("id",r),jQuery.Buffer.flush(),e=this._elem=null,this.prevObject||this},_DEFAULT_ATTRS:{},end:function(){var e=this._classNames,t=this._styles,n=this._attrs,r=this._id,i=SC.RenderContext,s="",o="",u,a,f,l,c,h,p;s="<"+this._tagName;if(n||e||t||r){n||(n=this._DEFAULT_ATTRS),r&&(n.id=r),e&&(n["class"]=e.join(" "));if(t){for(f in t){if(!t.hasOwnProperty(f))continue;l=t[f];if(l===null)continue;typeof l===SC.T_NUMBER&&!SC.NON_PIXEL_PROPERTIES.contains(f)&&(l+="px"),o=o+this._dasherizeStyleName(f)+": "+l+"; "}n.style=o}s+=" ";for(f in n){if(!n.hasOwnProperty (f))continue;l=n[f];if(l===null)continue;p=i.escapeAttribute(l),s=s+f+'="'+p+'" '}n===this._DEFAULT_ATTRS&&(delete n.style,delete n["class"],delete n.id)}c=this.strings,h=this._selfClosing===NO?NO:this.length===1,s+=h?" />":">",c[this.offset]=s;if(!h){c.push("");var d=this;while(d)d.length++,d=d.prevObject}return this._elem=null,this.prevObject||this},tag:function(e,t){return this.begin(e,t).end()},tagName:function(e){return e===undefined?(!this._tagName&&this._elem&&(this._tagName=this._elem.tagName),this._tagName):(this._tagName=e,this._tagNameDidChange=YES,this)},id:function(e){return e===undefined?(!this._id&&this._elem&&(this._id=this._elem.id),this._id):(this._id=e,this._idDidChange=YES,this)},classNames:function(e,t){return this._elem?e?(this.$().resetClassNames().addClass(e),this):this.$().attr("class").split(" "):e===undefined?(this._cloneClassNames&&(this._classNames=(this._classNames||[]).slice(),this._cloneClassNames=NO),this._classNames||(this._classNames=[]),this._classNames):(this._classNames=e,this._cloneClassNames=t||NO,this._classNamesDidChange=YES,this)},hasClass:function(e){return this._elem?this.$().hasClass(e):this.classNames().indexOf(e)>=0},addClass:function(e){if(e===undefined||e===null)return SC.Logger.warn("You are adding an undefined or empty class"+this.toString()),this;if(this._elem){if(SC.typeOf(e)===SC.T_STRING)this.$().addClass(e);else{var t,n=e.length;for(t=0;t=0&&(this._cloneClassNames&&(t=this._classNames=t.slice(),this._cloneClassNames=NO),t[n]=null,this._classNamesDidChange=YES),this},resetClassNames:function(){return this._elem?(this.$().resetClassNames(),this):(this._classNames=[],this._classNamesDidChange=YES,this)},setClass:function(e,t){if(this._elem)return this.$().setClass(e,t),this;var n,r,i,s;if(t!==undefined)return t?this.addClass(e):this.removeClass(e);n=this._classNames,n||(n=this._classNames=[]),this._cloneClassNames&&(n=this._classNames=n.slice(),this._cloneClassNames=NO),s=NO;for(i in e){if(!e.hasOwnProperty(i))continue;r=n.indexOf(i),e[i]?r<0&&(n.push(i),s=YES):r>=0&&(n[r]=null,s=YES)}return s&&(this._classNamesDidChange=YES),this},_STYLE_REGEX:/-?\s*([^:\s]+)\s*:\s*([^;]+)\s*;?/g,styles:function(e,t){if(this._elem)return e&&this.$().resetStyles().css(e),this.$().styles();var n,r,i;if(e===undefined){if(!this._styles&&this._elem){n=this.$().attr("style");if(n&&(n=n.toString()).length>0){SC.browser.msie&&(n=n.toLowerCase()),e={},r=this._STYLE_REGEX,r.lastIndex=0;while(i=r.exec(n))e[this._camelizeStyleName(i[1])]=i[2];this._styles=e,this._cloneStyles=NO}else this._styles={}}else this._styles?this._cloneStyles&&(this._styles=SC.clone(this._styles),this._cloneStyles=NO):this._styles={};return this._styles}return this._styles=e,this._cloneStyles=t||NO,this._stylesDidChange=YES,this},_deleteComboStyles :function(e,t){var n=SC.COMBO_STYLES[t],r=NO,i;if(n)for(var s=0,o=n.length;s]/g,t=function(e){switch(e){case"&":return"&";case"<":return"<";case">":return">"}},n=/[\/\*\+\^'"%`=, ]/g,r=function(e){switch(e){case'"':return""";case" ":return" ";case"%":return"%";case"'":return"'";case"*":return"*";case"+":return"+";case",":return",";case"/":return"/";case"=":return"=";case"^":return"^";case"`":return"`"}};SC.RenderContext.escapeHTML=function(n){return SC.none(n)?"":n.replace(e,t)},SC.RenderContext.escapeAttribute=function(i){if(SC.none(i))return;return SC.typeOf(i)!==SC.T_STRING&&(i=String(i)),i.replace(e,t).replace(n,r)}}(),SC.SelectionSet=SC.Object.extend(SC.Enumerable,SC.Freezable,SC.Copyable,{isSelectionSet:YES,length:function(){var e=0,t=this._sets,n=this._objects;return n&&(e+=n.get("length")),t&&t.forEach(function(t){e+=t.get("length")}),e}.property().cacheable(),sources:function(){var e=[],t=this._sets,n=t?t.length:0,r,i,s;for(r=0;r0&&i.source&&e.push(i.source);return e}.property().cacheable(),indexSetForSource:function(e){if(!e||!e.isSCArray)return null;var t=this._indexSetCache,n=this._objects,r,i;return t||(t=this._indexSetCache={}),r=t[SC.guidFor(e)],r&&r._sourceRevision&&r._sourceRevision!==e.propertyRevision&&(r=null),r||(r=this._indexSetForSource(e,NO),r&&r.get("length")===0&&(r=null),n&&(r&&(r=r.copy()),n.forEach(function(t){(i=e.indexOf(t))>=0&&(r||(r=SC.IndexSet.create()),r.add(i))},this)),r&&(r=t[SC.guidFor(e)]=r.frozenCopy(),r._sourceRevision=e.propertyRevision)),r},_indexSetForSource:function(e,t){t===undefined&& (t=YES);var n=SC.guidFor(e),r=this[n],i=this._sets,s=i?i.length:0,o=null;return r>=s&&(r=null),SC.none(r)?t&&!this.isFrozen&&(this.propertyWillChange("sources"),i||(i=this._sets=[]),o=i[s]=SC.IndexSet.create(),o.source=e,this[n]=s,this.propertyDidChange("sources")):o=i?i[r]:null,o},add:function(e,t,n){if(this.isFrozen)throw SC.FROZEN_ERROR;var r,i,s,o,u,a,f,l;if(t===undefined&&n===undefined){if(!e)throw"Must pass params to SC.SelectionSet.add()";if(e.isIndexSet)return this.add(e.source,e);if(e.isSelectionSet){r=e._sets,l=e._objects,i=r?r.length:0,this.beginPropertyChanges();for(s=0;s0&&this.add(o.source,o);return l&&this.addObjects(l),this.endPropertyChanges(),this}}return o=this._indexSetForSource(e,YES),u=this.get("length"),f=o.get("length"),a=u-f,o.add(t,n),this._indexSetCache=null,a+=o.get("length"),a!==u&&(this.propertyDidChange("length"),this.enumerableContentDidChange(),f===0&&this.notifyPropertyChange("sources")),this},remove:function(e,t,n){if(this.isFrozen)throw SC.FROZEN_ERROR;var r,i,s,o,u,a,f,l;if(t===undefined&&n===undefined){if(!e)throw"Must pass params to SC.SelectionSet.remove()";if(e.isIndexSet)return this.remove(e.source,e);if(e.isSelectionSet){r=e._sets,l=e._objects,i=r?r.length:0,this.beginPropertyChanges();for(s=0;s0&&this.remove(o.source,o);return l&&this.removeObjects(l),this.endPropertyChanges(),this}}return o=this._indexSetForSource(e,YES),u=this.get("length"),a=u-o.get("length"),o&&(l=this._objects)&&(n!==undefined&&(t=SC.IndexSet.create(t,n),n=undefined),l.forEach(function(n){s=e.indexOf (n),t.contains(s)&&(l.remove(n),a--)},this)),o.remove(t,n),f=o.get("length"),a+=f,this._indexSetCache=null,a!==u&&(this.propertyDidChange("length"),this.enumerableContentDidChange(),f===0&&this.notifyPropertyChange("sources")),this},contains:function(e,t,n){if(t===undefined&&n===undefined)return this.containsObject(e);var r=this.indexSetForSource(e);return r?r.contains(t,n):NO},intersects:function(e,t,n){var r=this.indexSetForSource(e,NO);return r?r.intersects(t,n):NO},_TMP_ARY:[],addObject:function(e){var t=this._TMP_ARY,n;return t[0]=e,n=this.addObjects(t),t.length=0,n},addObjects:function(e){var t=this._objects,n,r;return t||(t=this._objects=SC.CoreSet.create()),n=t.get("length"),t.addEach(e),r=t.get("length"),this._indexSetCache=null,r!==n&&(this.propertyDidChange("length"),this.enumerableContentDidChange()),this},removeObject:function(e){var t=this._TMP_ARY,n;return t[0]=e,n=this.removeObjects(t),t.length=0,n},removeObjects:function(e){var t=this._objects,n,r,i;return t?(n=t.get("length"),t.removeEach(e),r=t.get("length"),(i=this._sets)&&i.forEach(function(t){n+=t.get("length"),t.removeObjects(e),r+=t.get("length")},this),this._indexSetCache=null,r!==n&&(this.propertyDidChange("length"),this.enumerableContentDidChange()),this):this},containsObject:function(e){var t=this._objects;if(t&&t.contains(e))return YES;var n=this._sets,r=n?n.length:0,i,s;for(i=0;i=0)return YES}return NO},constrain:function(e){var t,n,r,i;this.beginPropertyChanges(),this.get("sources").forEach(function(t){if(t===e)return;var n=this._indexSetForSource(e,NO);n&&this .remove(e,n)},this),t=this._indexSetForSource(e,NO),t&&(r=t.get("max"))>(n=e.get("length"))&&this.remove(e,n,r-n);if(i=this._objects){var s,o;for(s=i.length-1;s>=0;s--)o=i[s],e.indexOf(o)<0&&this.removeObject(o)}return this.endPropertyChanges(),this},isEqual:function(e){var t,n,r,i,s,o;if(!e||!e.isSelectionSet)return NO;if(e===this)return YES;if(this._sets===e._sets&&this._objects===e._objects)return YES;if(this.get("length")!==e.get("length"))return NO;t=this._objects,n=e._objects;if(t||n){if((t?t.get("length"):0)!==(n?n.get("length"):0))return NO;if(t&&!t.isEqual(n))return NO}s=this.get("sources"),i=s.get("length");for(r=0;r0){t=e._sets=t.slice();for(r=0;r=0)n=e[t],n&&n.freeze();return this._objects&&this._objects.freeze(),this.set("isFrozen",YES),this},toString:function(){var e=this._sets||[];return e=e.map(function(e){return e.toString().replace("SC.IndexSet" ,SC.guidFor(e.source))},this),this._objects&&e.push(this._objects.toString()),"SC.SelectionSet:%@<%@>".fmt(SC.guidFor(this),e.join(","))},firstObject:function(){var e=this._sets,t=this._objects;if(e&&e.get("length")>0){var n=e?e[0]:null,r=n?n.source:null,i=n?n.firstObject():-1;if(r&&i>=0)return r.objectAt(i)}return t?t.firstObject():undefined}.property(),nextObject:function(e,t,n){var r,i;return e===0&&(r=n.objects=[],this.forEach(function(e){r.push(e)},this),n.max=r.length),r=n.objects,i=r[e],e+1>=n.max&&(n.objects=n.max=null),i},forEach:function(e,t){var n=this._sets,r=this._objects,i=n?n.length:0,s,o;for(o=0;o1&&(r-=Math.floor(r%n)),n<1&&(n=1),this._requestingIndex++;if(t.sparseArrayDidRequestRange){var i=this._TMP_RANGE;this.wasRangeRequested(r)===-1&&(i.start=r,i.length=n,this.requestedRangeIndex.push(r),t.sparseArrayDidRequestRange(this,i))}else if(t.sparseArrayDidRequestIndex)while(--n>=0)t.sparseArrayDidRequestIndex(this,r+n);return this._requestingIndex--,this},wasRangeRequested:function(e){var t,n;for(t=0,n=this.requestedRangeIndex.length;t=0?(this.requestedRangeIndex.removeAt(t,1),YES):NO},provideObjectsInRange:function(e,t){var n=this._sa_content;n||(n=this._sa_content=[]);var r=e.start,i=e.length,s=this._requestingIndex<=0;s&&this.arrayContentWillChange(e.start,e.length,e.length);while(--i>=0)n[r+i]=t.objectAt(i);return s&&this.arrayContentDidChange(e.start,e.length,e.length),this},provideObjectAtIndex:function(e,t){var n=this._TMP_PROVIDE_ARRAY,r=this._TMP_PROVIDE_RANGE;return n[0]=t,r.start=e,this .provideObjectsInRange(r,n)},objectsDidChangeInRange:function(e){this.arrayContentWillChange(e.start,e.length,e.length);var t=this._sa_content;if(t)if(e.start===0&&SC.maxRange(e)>=t.length)this._sa_content=null;else{var n=e.start,r=Math.min(n+e.length,t.length);while(--r>=n)t[r]=undefined}return this.arrayContentDidChange(e.start,e.length,e.length),this},indexOf:function(e){var t=this.delegate;if(t&&t.sparseArrayDidRequestIndexOf)return t.sparseArrayDidRequestIndexOf(this,e);var n=this._sa_content;return n||(n=this._sa_content=[]),n.indexOf(e)},replace:function(e,t,n){n=n||[];var r=this.delegate;if(r)if(!r.sparseArrayShouldReplace||!r.sparseArrayShouldReplace(this,e,t,n))return this;var i=n?n.get?n.get("length"):n.length:0;this.arrayContentWillChange(e,t,i);var s=this._sa_content;s||(s=this._sa_content=[]),s.replace(e,t,n);var o=i-t;return SC.none(this._length)||(this.propertyWillChange("length"),this._length+=o,this.propertyDidChange("length")),this.arrayContentDidChange(e,t,i),this.enumerableContentDidChange(e,t,o),this},reset:function(){var e=this._length;return this.arrayContentWillChange(0,e,0),this._sa_content=null,this._length=null,this.arrayContentDidChange(0,e,0),this.invokeDelegateMethod(this.delegate,"sparseArrayDidReset",this),this}}),SC.SparseArray.array=function(e){return this.create({_length:e||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 t=this.get("interval"),n=this.get("lastFireTime");n0&&r>i&&(r=i),r}.property("interval","startTime","repeats","until","isValid","lastFireTime").cacheable(),schedule:function(){if(!this.get("isValid"))return this;this.beginPropertyChanges(),this.startTime||this.set("startTime",SC.RunLoop.currentRunLoop.get("startTime"));var e=this.get("fireTime"),t=this.get("lastFireTime");return e>=t&&(this.set("isScheduled",YES),SC.RunLoop.currentRunLoop.scheduleTimer(this,e)),this.endPropertyChanges(),this},invalidate:function(){this.beginPropertyChanges(),this.set("isValid",NO);var e=SC.RunLoop.currentRunLoop;return e&&e.cancelTimer(this),this.action=this.target=null,this.endPropertyChanges(),this.get("isPooled")&&SC.Timer.returnTimerToPool(this),this},fire:function(){var e=Date.now();this.set("lastFireTime",e);var t=this.get("fireTime");this.get("isPaused")||this.performAction(),t>e?this.schedule():this.invalidate()},performAction:function(){var e=SC.typeOf(this.action);if(e==SC.T_FUNCTION)this.action.call(this.target||this,this);else if(e===SC.T_STRING)if(this.action.indexOf(".")>=0){var t=this.action.split("."),n=t.pop(),r=SC.objectForPropertyPath(t,window),i=r.get?r.get(n):r[n];if(!i||SC.typeOf(i)!=SC.T_FUNCTION)throw"%@: Timer could not find a function at %@".fmt(this,this.action);i.call(r,this)}else SC.RootResponder.responder.sendAction(this.action,this.target,this)},init:function(){arguments.callee.base.apply(this,arguments),this.startTime instanceof Date&&(this .startTime=this.startTime.getTime()),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(e){e||(e=SC.EMPTY_HASH),this.propertyWillChange("fireTime");var t=this.RESET_DEFAULTS;for(var n in t){if(!t.hasOwnProperty(n))continue;this[n]=SC.none(e[n])?t[n]:e[n]}return this.propertyDidChange("fireTime"),this},removeFromTimerQueue:function(e){var t=this._timerQueuePrevious,n=this._timerQueueNext;return!t&&!n&&e!==this?e:(t&&(t._timerQueueNext=n),n&&(n._timerQueuePrevious=t),this._timerQueuePrevious=this._timerQueueNext=null,e===this?n:e)},scheduleInTimerQueue:function(e,t){this._timerQueueRunTime=t;var n=e,r=null;while(n&&n._timerQueueRunTimet)return this;e.push(this);var n=this._timerQueueNext;return this._timerQueueNext=null,n&&(n._timerQueuePrevious=null),n?n.collectExpiredTimers(e,t):null}}),SC.Timer.schedule=function(e){var t;return!e||SC.none(e.isPooled)||e.isPooled?t=this.timerFromPool(e):t=this.create(e),t.schedule()},SC.Timer.timerFromPool=function(e){var t=this._timerPool;t||(t=this._timerPool=[]);var n=t.pop();return n||(n=this.create()),n.reset(e)},SC.Timer.returnTimerToPool=function(e){return this._timerPool||(this._timerPool=[]),this._timerPool.push(e),this},SC.mixin({normalizeURL :function(e){return e.slice(0,1)=="/"?e=window.location.protocol+"//"+window.location.host+e:e.slice(0,5)!="http:"&&e.slice(0,6)!="https:"&&(e=window.location.href+"/"+e),e},isPercentage:function(e){return e<1&&e>0},minX:function(e){return e.x||0},maxX:function(e){return(e.x||0)+(e.width||0)},midX:function(e){return(e.x||0)+(e.width||0)/2},minY:function(e){return e.y||0},maxY:function(e){return(e.y||0)+(e.height||0)},midY:function(e){return(e.y||0)+(e.height||0)/2},centerX:function(e,t){return(t.width-e.width)/2},centerY:function(e,t){return(t.height-e.height)/2},offset:function(e,t){var n,r,i,s;t=t||"document";if(t==="parent")s=jQuery(e).position();else{s=jQuery(e).offset();if(SC.browser.mobileSafari){n=navigator.userAgent,r=n.indexOf("Mobile/"),i=n.substring(r+7,r+9);if(parseInt(SC.browser.mobileSafari,0)<=532||i<="8A")s.left-=window.pageXOffset,s.top-=window.pageYOffset}if(t==="viewport")if(SC.browser.isIE8OrLower){var o=SC.$(window);s.left-=o.scrollLeft(),s.top-=o.scrollTop()}else s.left-=window.pageXOffset,s.top-=window.pageYOffset}try{s.x=s.left,s.y=s.top}catch(u){s={x:s.left,y:s.top}}return delete s.left,delete s.top,s},viewportOffset:function(e){console.warn("SC.viewportOffset() has been deprecated in favor of SC.offset(). Please use SC.offset() from here on.");var t=SC.offset(e,"viewport");return{x:t.left,y:t.top}},isFunctionOrNonPrintableKey:function(e){return!!(e.altKey||e.ctrlKey||e.metaKey||e.charCode!==e.which&&SC.FUNCTION_KEYS[e.which])}}),SC.mixin({ZERO_POINT:{x:0,y:0},pointInRect:function(e,t){return e.x>=SC.minX(t)&&e.y>=SC.minY(t)&&e.x<=SC.maxX(t)&&e.y<=SC .maxY(t)},rectsEqual:function(e,t,n){return!e||!t?e==t:(!n&&n!==0&&(n=.1),e.y!=t.y&&Math.abs(e.y-t.y)>n?NO:e.x!=t.x&&Math.abs(e.x-t.x)>n?NO:e.width!=t.width&&Math.abs(e.width-t.width)>n?NO:e.height!=t.height&&Math.abs(e.height-t.height)>n?NO:YES)},intersectRects:function(e,t){var n={x:Math.max(SC.minX(e),SC.minX(t)),y:Math.max(SC.minY(e),SC.minY(t)),width:Math.min(SC.maxX(e),SC.maxX(t)),height:Math.min(SC.maxY(e),SC.maxY(t))};return n.width=Math.max(0,n.width-n.x),n.height=Math.max(0,n.height-n.y),n},unionRects:function(e,t){var n={x:Math.min(SC.minX(e),SC.minX(t)),y:Math.min(SC.minY(e),SC.minY(t)),width:Math.max(SC.maxX(e),SC.maxX(t)),height:Math.max(SC.maxY(e),SC.maxY(t))};return n.width=Math.max(0,n.width-n.x),n.height=Math.max(0,n.height-n.y),n},cloneRect:function(e){return{x:e.x,y:e.y,width:e.width,height:e.height}},stringFromRect:function(e){return e?"{x:"+e.x+", y:"+e.y+", width:"+e.width+", height:"+e.height+"}":"(null)"}}),SC.MainPane=SC.Pane.extend({layout:{top:0,left:0,bottom:0,right:0,minHeight:200,minWidth:200},init:function(){var e={x:0,y:0,width:1e3,height:1e3},t=this.get("layout"),n=!1;if(document&&document.body&&this.get("enforcesBodyOverflow")){e.width=document.body.clientWidth,e.height=document.body.clientHeight;if(t.minHeight||t.minWidth)t.minHeight&&e.height=0&&(r=e.slice(0,t),i=e.slice(t+1).trim(),n[r]=i)},this),n):n}.property("status").cacheable(),header:function(e){var t=this.get("rawRequest");return t?t.getResponseHeader(e):null},encodedBody:function(){var e=this.get("rawRequest");return e?this.get("isXML")?e.responseXML:e.responseText:null}.property("status").cacheable(),cancelTransport:function(){var e=this.get("rawRequest");e&&e.abort(),this.set("rawRequest",null)},invokeTransport:function(){var e,t,n,r,i;e=this.createRequest(),this.set("rawRequest",e),r=!!this.getPath("request.isAsynchronous"),r&&(!SC.browser.msie&&!SC.browser.opera?SC.Event.add(e,"readystatechange",this,this.finishRequest,e):(t=this,n=function(){if(!t)return null;var e=t.finishRequest();return e&&(t=null),e},e.onreadystatechange=n)),e.open(this.get("type"),this.get("address"),r),i=this.getPath("request.headers");for(var s in i)e.setRequestHeader(s,i[s]);return e.send(this.getPath("request.encodedBody")),r||this.finishRequest(),e},createRequest:function(){function e(){for(var e=0;e=300){try{s=t.statusText||""}catch(o){s=""}r=SC.$error(s||"HTTP Request failed","Request",i),r.set("errorValue",this),this.set("isError",YES),this.set("errorObject",r)}this.set("status",i)},this),!SC.browser.msie&&!SC.browser.opera?SC.Event.remove(t,"readystatechange",this,this.finishRequest):t.onreadystatechange=null,YES):NO}}),SC.Request=SC.Object.extend(SC.Copyable,SC.Freezable,{isAsynchronous:YES,isJSON:NO,isXML:NO,attachIdentifyingHeaders:YES,headers:function(){var e=this._headers;return e||(e=this._headers={}),e}.property().cacheable(),responseClass:SC.XHRResponse,source:null,address:null,type:"GET",timeout:null,body:null,encodedBody:function(){var e=this.get("body");return e&&this.get("isJSON")&&(e=SC.json.encode(e)),e}.property("isJSON","isXML","body").cacheable(),willSend:function(e,t){},didSend:function(e,t){},willReceive:function(e,t){},didReceive:function(e,t){},concatenatedProperties:"COPY_KEYS",COPY_KEYS:["attachIdentifyingHeaders","isAsynchronous","isJSON","isXML","address","type","timeout","body","responseClass","willSend","didSend","willReceive","didReceive"],copy:function(){var e={},t=this.COPY_KEYS,n=t.length,r,i,s;while(--n>=0)r=t[n],this.hasOwnProperty(r)&&(e[r]=this.get(r));return this.hasOwnProperty("listeners")&&(e.listeners=SC.copy(this.get("listeners"))),this.hasOwnProperty("_headers")&&(e._headers=SC.copy(this._headers)),e.source=this.get("source")||this,this.constructor.create(e)},header:function(e,t){var n;if(SC.typeOf(e)===SC.T_STRING)return n= this._headers,arguments.length===1?n?n[e]:null:(this.propertyWillChange("headers"),n||(n=this._headers={}),n[e]=t,this.propertyDidChange("headers"),this);if(t===undefined){n=e,this.beginPropertyChanges();for(e in n){if(!n.hasOwnProperty(e))continue;this.header(e,n[e])}return this.endPropertyChanges(),this}return this},clearHeaders:function(){this.propertyWillChange("headers"),this._headers={},this.propertyDidChange("headers")},async:function(e){return e===undefined&&(e=YES),this.set("isAsynchronous",e)},timeoutAfter:function(e){return this.set("timeout",e)},json:function(e){return e===undefined&&(e=YES),e&&this.set("isXML",NO),this.set("isJSON",e)},xml:function(e){return e===undefined&&(e=YES),e&&this.set("isJSON",NO),this.set("isXML",e)},_prep:function(){var e=!!this.header("Content-Type");return this.get("attachIdentifyingHeaders")&&(this.header("X-Requested-With","XMLHttpRequest"),this.header("X-SproutCore-Version",SC.VERSION)),this.get("isJSON")&&!e?this.header("Content-Type","application/json"):this.get("isXML")&&!e&&this.header("Content-Type","text/xml"),this},send:function(e){var t=this.get("timeout");if(t&&!this.get("isAsynchronous"))throw"Timeout values cannot be used with synchronous requests";if(t===0)throw"The timeout value must either not be specified or must be greater than 0";return e&&this.set("body",e),SC.Request.manager.sendRequest(this.copy()._prep())},resend:function(){var e=this.get("source")?this:this.copy()._prep();return SC.Request.manager.sendRequest(e)},notify:function(e,t,n,r){var i=YES;SC.typeOf(e)!==SC.T_NUMBER?(r=SC.A(arguments).slice(2),n=t,t=e ,e=0,i=NO):r=SC.A(arguments).slice(3);var s=this.get("listeners");return s||this.set("listeners",s={}),s[e]||(s[e]=[]),s[e].push({target:t,action:n,params:r}),this}}),SC.Request.mixin({getUrl:function(e){return this.create().set("address",e).set("type","GET")},postUrl:function(e,t){var n=this.create().set("address",e).set("type","POST");return t&&n.set("body",t),n},deleteUrl:function(e){return this.create().set("address",e).set("type","DELETE")},putUrl:function(e,t){var n=this.create().set("address",e).set("type","PUT");return t&&n.set("body",t),n}}),SC.Request.manager=SC.Object.create({maxRequests:6,inflight:[],pending:[],sendRequest:function(e){if(!e)return null;var t=e.get("responseClass").create({request:e});return this.get("pending").pushObject(t),this.fireRequestIfNeeded(),t},cancel:function(e){var t=this.get("pending"),n=this.get("inflight"),r;return t.indexOf(e)>=0?(this.propertyWillChange("pending"),t.removeObject(e),this.propertyDidChange("pending"),YES):n.indexOf(e)>=0?(e.cancel(),n.removeObject(e),this.fireRequestIfNeeded(),YES):NO},cancelAll:function(){return this.get("pending").length||this.get("inflight").length?(this.set("pending",[]),this.get("inflight").forEach(function(e){e.cancel()}),this.set("inflight",[]),YES):NO},fireRequestIfNeeded:function(){var e=this.get("pending"),t=this.get("inflight"),n=this.get("maxRequests"),r;e.length>0&&t.length0?r:null}},SC.BRANCH_OPEN=17,SC.BRANCH_CLOSED=18,SC.LEAF_NODE=32,SC.CollectionContent={isCollectionContent:YES,contentIndexIsSelected:function(e,t,n){var r=e.get("selection");return r?r.contains(t,n):NO},contentIndexIsEnabled:function(e,t,n){return e.get("isEnabled")},contentGroupIndexes:function(e,t){return null},contentIndexIsGroup:function(e,t,n){return NO},contentIndexOutlineLevel:function(e,t,n){return-1},contentIndexDisclosureState:function(e,t,n){return SC.LEAF_NODE},contentIndexExpand:function(e,t,n){SC.Logger.log("contentIndexExpand(%@, %@, %@)".fmt(e,t,n))},contentIndexCollapse:function(e,t,n){SC.Logger.log("contentIndexCollapse(%@, %@, %@)".fmt(e,t,n))}},SC.TreeItemObserver=SC.Object.extend(SC.Array,SC.CollectionContent,{item:null,delegate:null,parentObserver:null,parentItem:function(){var e=this.get("parentObserver");return e?e.get("item"):null}.property("parentObserver").cacheable(),index:null,outlineLevel:0,children:null,disclosureState:SC.BRANCH_OPEN,branchIndexes :function(){var e=this.get("item"),t,n,r,i,s;if(!e)return SC.IndexSet.EMPTY;if(e.isTreeItemContent)return n=this.get("parentItem"),r=this.get("index"),e.treeItemBranchIndexes(n,r);i=this.get("children");if(!i)return null;s=SC.IndexSet.create(),t=i.get("length"),n=e;for(r=0;r0?s:null}.property("children").cacheable(),isHeaderVisible:function(){return!!this.get("parentObserver")}.property("parentObserver").cacheable(),length:0,objectAt:function(e,t){var n=this.get("length"),r=this.get("item"),i=this._objectAtCache,s=e,o=0,u,a;if(e>=n)return undefined;if(this.get("isHeaderVisible")){if(e===0)return r;s--}return r=null,i||(i=this._objectAtCache=[]),(r=i[e])!==undefined?r:(a=this.get("children"),a?((u=this.get("branchIndexes"))&&u.forEach(function(e){if(r||e>s)return;var n=this.branchObserverAt(e),i;if(!n)return;i=n.get("length"),e+i>s?(r=n.objectAt(s-e,t),s=-1):s-=i-1},this),s>=0&&(r=a.objectAt(s,t)),i[e]=r,r):undefined)},replace:function(e,t,n,r){var i=e,s=null,o,u,a;r===undefined&&(r=SC.DROP_BEFORE),this.get("isHeaderVisible")&&i--;if(i<0)throw"Tree Item cannot replace itself";(o=this.get("branchIndexes"))&&o.forEach(function(e){if(s||e>=i)return;if(!(s=this.branchObserverAt(e)))return;u=s.get("length"),e+u===i&&r===SC.DROP_AFTER?i-=e:e+u>i?i-=e:(i-=u-1,s=null)},this);if(s)return s.replace(i,t,n,r),this;a=i+t,t>1&&o&&o.forEachIn(i,o.get("max")-i,function(e){if(e>a)return;if(!(s=this.branchObserverAt(e)))return;u=s. get("length"),a-=u-1},this),t=a-i;var f=this.get("children");if(!f)throw"cannot replace() tree item with no children";if(t<0||a>f.get("length"))throw"replace() range must lie within a single tree item";return f.replace(i,t,n,r),this},observerContentDidChange:function(e,t,n){this.invalidateBranchObserversAt(e),this._objectAtCache=this._outlineLevelCache=null,this._disclosureStateCache=null,this._contentGroupIndexes=NO,this.notifyPropertyChange("branchIndexes");var r=this.get("length"),i=this._computeLength(),s=this.get("parentObserver"),o;r!==i&&this.set("length",i);if(!this._notifyParent)return this;if(s)o=SC.IndexSet.create(this.get("index")),s._childrenRangeDidChange(s.get("children"),null,"[]",o);else{r===i?(t=this.expandChildIndex(e+t),e=this.expandChildIndex(e),t-=e,n=0):(e=this.expandChildIndex(e),t=i-e,n=i-r);var u=t,a=n+u;this.arrayContentDidChange(e,u,a)}},expandChildIndex:function(e){var t=e;this.get("isHeaderVisible")&&e++;var n=this.get("branchIndexes");return!n||n.get("length")===0?t:(n.forEachIn(0,e,function(e){t+=this.branchObserverAt(e).get("length")-1},this),t)},_contentGroupIndexes:NO,contentGroupIndexes:function(e,t){if(t!==this)return null;var n=this._contentGroupIndexes;if(n!==NO)return n;if(this.get("parentObserver"))return null;var r=this.get("item"),i,s,o,u;return r&&r.isTreeItemContent?i=r.get("treeItemIsGrouped"):i=!!this.delegate.get("treeItemIsGrouped"),i?(n=SC.IndexSet.create(),s=this.get("branchIndexes"),s&&(o=s.min(),u=0,s.forEach(function(e){n.add(e+u,1);var t=this.branchObserverAt(e);t&&(u+=t.get("length")-1,o+=u)},this))):n=null,this._contentGroupIndexes= n,n},contentIndexIsGroup:function(e,t,n){var r=this.contentGroupIndexes(e,t);return r?r.contains(n):NO},contentIndexOutlineLevel:function(e,t,n){if(t!==this)return-1;var r=this._outlineLevelCache;if(r&&r[n]!==undefined)return r[n];r||(r=this._outlineLevelCache=[]);var i=this.get("length"),s=n,o=0,u=null,a,f,l;if(n>=i)return-1;if(this.get("isHeaderVisible")){if(n===0)return r[0]=this.get("outlineLevel")-1;s--}return(a=this.get("branchIndexes"))&&a.forEach(function(t){if(u!==null||t>s)return;var n=this.branchObserverAt(t),r;if(!n)return;r=n.get("length"),t+r>s?(u=n.contentIndexOutlineLevel(e,n,s-t),s=-1):s-=r-1},this),s>=0&&(u=this.get("outlineLevel")),r[n]=u,u},contentIndexDisclosureState:function(e,t,n){if(t!==this)return-1;var r=this._disclosureStateCache;if(r&&r[n]!==undefined)return r[n];r||(r=this._disclosureStateCache=[]);var i=this.get("length"),s=n,o=0,u=null,a,f,l;if(n>=i)return SC.LEAF_NODE;if(this.get("isHeaderVisible")){if(n===0)return r[0]=this.get("disclosureState");s--}return(a=this.get("branchIndexes"))&&a.forEach(function(t){if(u!==null||t>s)return;var n=this.branchObserverAt(t),r;if(!n)return;r=n.get("length"),t+r>s?(u=n.contentIndexDisclosureState(e,n,s-t),s=-1):s-=r-1},this),s>=0&&(u=SC.LEAF_NODE),r[n]=u,u},contentIndexExpand:function(e,t,n){var r,i=n,s,o;if(t!==this)return;if(this.get("isHeaderVisible")){if(n===0){this._expand(this.get("item"));return}i--}(r=this.get("branchIndexes"))&&r.forEach(function(t){if(t>=i)return;var n=this.branchObserverAt(t),r;if(!n)return;r=n.get("length"),t+r>i?(n.contentIndexExpand(e,n,i-t),i=-1):i-=r-1},this),i>=0&&(s=this. get("children"),o=s?s.objectAt(i):null,o&&this._expand(o,this.get("item"),i))},contentIndexCollapse:function(e,t,n){var r,i,s,o=n;if(t!==this)return;if(this.get("isHeaderVisible")){if(n===0){this._collapse(this.get("item"));return}o--}(r=this.get("branchIndexes"))&&r.forEach(function(t){if(t>=o)return;var n=this.branchObserverAt(t),r;if(!n)return;r=n.get("length"),t+r>o?(n.contentIndexCollapse(e,n,o-t),o=-1):o-=r-1},this),o>=0&&(i=this.get("children"),s=i?i.objectAt(o):null,s&&this._collapse(s,this.get("item"),o))},branchObserverAt:function(e){var t=this._branchObserversByIndex,n=this._branchObserverIndexes,r,i,s,o,u,a,f;return t||(t=this._branchObserversByIndex=[]),n||(n=this._branchObserverIndexes=SC.IndexSet.create()),(r=t[e])?r:(u=this.get("children"),o=u?u.objectAt(e):null,o?(t[e]=r=SC.TreeItemObserver.create({item:o,delegate:this.get("delegate"),parentObserver:this,index:e,outlineLevel:this.get("outlineLevel")+1}),n.add(e),r):null)},invalidateBranchObserversAt:function(e){var t=this._branchObserversByIndex,n=this._branchObserverIndexes;return!t||t.length<=e?this:(e<0&&(e=0),n.forEachIn(e,n.get("max")-e,function(e){var n=t[e];n&&n.destroy()},this),t.length=e,this)},init:function(){arguments.callee.base.apply(this,arguments);var e=this.get("item");if(!e)throw"SC.TreeItemObserver.item cannot be null";e.addObserver("*",this,this._itemPropertyDidChange),this._itemPropertyDidChange(e,"*"),this._notifyParent=YES},destroy:function(){this.invalidateBranchObserversAt(0),this._objectAtCache=null,this._notifyParent=NO;var e=this.get("item");e&&e.removeObserver("*",this,this._itemPropertyDidChange );var t=this._children,n=this._childrenRangeObserver;t&&n&&t.removeRangeObserver(n),this.set("length",0),arguments.callee.base.apply(this,arguments)},_itemPropertyDidChange:function(e,t){var n=this.get("children"),r=this.get("disclosureState"),i=this.get("item"),s;this.beginPropertyChanges(),s=this._computeDisclosureState(i),r!==s&&this.set("disclosureState",s),s=this._computeChildren(i),n!==s&&this.set("children",s),this.endPropertyChanges()},_childrenDidChange:function(){var e=this.get("disclosureState"),t=e===SC.BRANCH_OPEN?this.get("children"):null,n=this._children,r=this._childrenRangeObserver;if(n===t)return this;r&&n.removeRangeObserver(r),t?this._childrenRangeObserver=t.addRangeObserver(null,this,this._childrenRangeDidChange):this._childrenRangeObserver=null,this._children=t,this._childrenRangeDidChange(t,null,"[]",null)}.observes("children","disclosureState"),_childrenRangeDidChange:function(e,t,n,r){var i=this.get("children"),s=i?i.get("length"):0,o=r?r.get("min"):0,u=r?r.get("max"):s,a=this._childrenLen||0;this._childrenLen=s,this.observerContentDidChange(o,u-o,s-a)},_computeDisclosureState:function(e,t,n){var r,i;return!e||!this._computeChildren(e)?SC.LEAF_NODE:e.isTreeItemContent?(t===undefined&&(t=this.get("parentItem")),n===undefined&&(n=this.get("index")),e.treeItemDisclosureState(t,n)):(r=this._treeItemIsExpandedKey,r||(i=this.get("delegate"),r=i?i.get("treeItemIsExpandedKey"):"treeItemIsExpanded",this._treeItemIsExpandedKey=r),e.get(r)?SC.BRANCH_OPEN:SC.BRANCH_CLOSED)},_collapse:function(e,t,n){var r,i;return!e||!this._computeChildren(e)?this:(e.isTreeItemContent? (t===undefined&&(t=this.get("parentItem")),n===undefined&&(n=this.get("index")),e.treeItemCollapse(t,n)):(r=this._treeItemIsExpandedKey,r||(i=this.get("delegate"),r=i?i.get("treeItemIsExpandedKey"):"treeItemIsExpanded",this._treeItemIsExpandedKey=r),e.setIfChanged(r,NO)),this)},_expand:function(e,t,n){var r,i;return!e||!this._computeChildren(e)?this:(e.isTreeItemContent?(t===undefined&&(t=this.get("parentItem")),n===undefined&&(n=this.get("index")),e.treeItemExpand(t,n)):(r=this._treeItemIsExpandedKey,r||(i=this.get("delegate"),r=i?i.get("treeItemIsExpandedKey"):"treeItemIsExpanded",this._treeItemIsExpandedKey=r),e.setIfChanged(r,YES)),this)},_computeChildren:function(e){var t,n;return e?e.isTreeItemContent?e.get("treeItemChildren"):(n=this._treeItemChildrenKey,n||(t=this.get("delegate"),n=t?t.get("treeItemChildrenKey"):"treeItemChildren",this._treeItemChildrenKey=n),e.get(n)):null},_computeLength:function(){var e=this.get("isHeaderVisible")?1:0,t=this.get("disclosureState"),n=this.get("children"),r;return t===SC.BRANCH_OPEN&&n&&(e+=n.get("length"),(r=this.get("branchIndexes"))&&r.forEach(function(t){var n=this.branchObserverAt(t);e+=n.get("length")-1},this)),e}}),SC.TreeController=SC.ObjectController.extend(SC.SelectionSupport,{treeItemIsGrouped:NO,treeItemIsExpandedKey:"treeItemIsExpanded",treeItemChildrenKey:"treeItemChildren",arrangedObjects:function(){var e,t=this.get("content");return t?e=SC.TreeItemObserver.create({item:t,delegate:this}):e=null,this._sctc_arrangedObjects=e,e}.property().cacheable(),_sctc_invalidateArrangedObjects:function(){this.propertyWillChange("arrangedObjects" );var e=this._sctc_arrangedObjects;e&&e.destroy(),this._sctc_arrangedObjects=null,this.propertyDidChange("arrangedObjects")}.observes("content","treeItemIsExpandedKey","treeItemChildrenKey","treeItemIsGrouped"),_sctc_arrangedObjectsContentDidChange:function(){this.updateSelectionAfterContentChange()}.observes("*arrangedObjects.[]"),canSelectGroups:NO,firstSelectableObject:function(){var e=this.get("arrangedObjects"),t,n,r=0;if(!e)return null;if(this.get("treeItemIsGrouped")===NO||this.get("canSelectGroups"))return e.get("firstObject");t=e.contentGroupIndexes(null,e),n=e.get("length");while(t.contains(r)&&r=n?null:e.objectAt(r)}.property()}),SC.InlineTextFieldDelegate={editor:null,acquireEditor:function(e){var t=this.editor;if(t){if(t.get("isEditing")&&!t.commitEditing()&&!t.discardEditing())return null;this.releaseEditor(t)}var n=e.exampleEditor?e.exampleEditor:SC.InlineTextFieldView,r=e.get("pane");return t=this.editor=r.createChildView(n,{inlineEditorDelegate:this}),r.appendChild(t),t},releaseEditor:function(e){return e.removeFromParent(),this.editor=null,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.INFLECTION_CONSTANTS={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"]],UNCOUNTABLE:["sheep","fish","series","species","money","rice","information","info","equipment"]},SC.mixin(SC.String,{capitalizeEach:function(e){return e.replace(SC.STRING_TITLEIZE_REGEXP,function(e,t,n){return n?t+n.toUpperCase():t}).capitalize()},titleize:function(e){var t=e.replace(SC.STRING_DECAMELIZE_REGEXP,"$1_$2");return t.replace(SC.STRING_TITLEIZE_REGEXP,function(e,t,n){return n?" "+n.toUpperCase():" "}).capitalize()},classify:function(e){var t=e.replace(SC.STRING_TITLEIZE_REGEXP,function(e,t,n){return n?n.toUpperCase():""}),n=t.charAt(0),r=n.toUpperCase();return n!==r?r+t.slice(1):t},humanize:function(e){return SC.String .decamelize(e).replace(SC.STRING_HUMANIZE_REGEXP," ")},escapeForRegExp:function(e){return e.replace(SC.STRING_REGEXP_ESCAPED_REGEXP,"\\$1")},removeDiacritics:function(e){var t=SC.diacriticMappingTable;t||(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"},t=SC.diacriticMappingTable);var n,r,i="",s=e.length;for(var o=0;o<=s;++o)n=e.charAt(o),r=t[n],i+=r||n;return i},pluralize:function(e){var t,n,r=e.split(/\s/).pop(),i=e.replace(r,""),s=r.charAt(0).match(/[A-Z]/)?!0:!1;r=r.toLowerCase();for(t=0,n=SC.INFLECTION_CONSTANTS.UNCOUNTABLE.length;t=0)r=t[i],e.hasOwnProperty(r)&&n.push(r+":"+e[r]);return"{"+n.join(", ")+"}"},heightForString:function(e,t,n,r,i,s){if(s){var o=this.bestStringMetricsForMaxWidth(e,t,s,r,i);return o.height}SC.debug("Warning: Use the element reference for the heightForString method. Just using class names may result in inaccurate values.");var s,u;u=r&&SC.typeOf(r)===SC.T_ARRAY?r.join(" "):"",elem=document.createElement("div"),document.body.insertBefore(elem,null),n=n+"; width: "+t+"px; left: "+ -1*t+"px; position: absolute;";var a=SC.$(elem);a.attr("style",n),u!==""&&a.attr("class",u),elem.innerHTML=e;var o=this.bestStringMetricsForMaxWidth(e,t,elem,r,i);return elem.parentNode.removeChild(elem),elem=null,o.height},prepareStringMeasurement:function(e,t){var n=this._metricsCalculationElement,r,i,s,o;r=SC.A(t).join(" ");if(!n){var u=document.createElement("div");u.style.cssText="position:absolute; left:-10010px; top:-10px;width:10000px; height:0px; overflow:hidden;visibility:hidden;",n=this._metricsCalculationElement=document.createElement("div"),u.appendChild(n),document.body.insertBefore(u,null)}o=SC.$(n);if(SC.typeOf(e)!=SC.T_STRING){var a=null;document.defaultView&&document.defaultView.getComputedStyle?a=document .defaultView.getComputedStyle(e,null):a=e.currentStyle;var f=this._copy_computed_props;for(var l=0;lo&&(t=o),this.set("calculatedWidth",t),this.adjust("width",t)),this.get("shouldResizeHeight")&&(f&&nu&&(n=u),this.set("calculatedHeight",n),this.adjust("height",n))),this.get("shouldAutoFitText")&&this.invokeLast(this.fitTextToFrame)}.observes("shouldAutoResize","measuredSize","autoResizePadding","maxWidth","minWidth","shouldResizeWidth","shouldResizeHeight"),initMixin:function(){},batchResizeId:null,scheduleMeasurement:function(){var e=this.get("batchResizeId");if(!this.get("shouldMeasureSize")||!this.get("isVisibleInWindow")||this.get("autoResizeText")===this._lastMeasuredText&&e===this._lastMeasuredId)return;SC.AutoResizeManager.scheduleMeasurementForView(this,e)}.observes("isVisibleInWindow","shouldMeasureSize","autoResizeText","batchResizeId"),_lastMeasuredText:null,_cachedMetrics:function(e,t){if(!this.get("shouldCacheSizes"))return;var n=SC.cacheSlotFor(this.get("batchResizeId")||this),r=this.get("autoResizeText" );return t?n[r]=t:t=n[r],t}.property("shouldCacheSizes","autoResizeText","batchResizeId").cacheable(),measureSize:function(e){var t,n=this.get("autoResizeLayer"),r=this.get("autoResizeText"),i=!this.get("escapeHTML"),s=this.get("batchResizeId"),o=this.get("_cachedMetrics"),u=this.get("maxFontSize");if(!n)return;return o?t=o:SC.none(r)||r===""?t={width:0,height:0}:e?t=SC.measureString(r,i,this.get("useExactMeasurement")):(this.prepareLayerForStringMeasurement(n),t=SC.metricsForString(r,n,this.get("classNames"),i,this.get("useExactMeasurement"))),this.set("measuredSize",t),this.get("shouldCacheSizes")&&this.setIfChanged("_cachedMetrics",t),this._lastMeasuredText=r,this._lastMeasuredId=s,t},prepareLayerForStringMeasurement:function(e){var t=this.get("maxFontSize");this.get("shouldAutoFitText")&&this.get("calculatedFontSize")!==t&&(e.style.fontSize=t+"px")},viewDidResize:function(e){e(),this.fontPropertyDidChange()}.enhance(),fitTextToFrame:function(){var e=this.get("autoResizeLayer");if(!e)return;var t=this.get("maxFontSize"),n=this.get("minFontSize");this.prepareLayerForStringMeasurement(e);var r=this.get("frame"),i=this.get("autoResizePadding")||0,s=this.get("autoFitTextFramePadding"),o=s.width,u=s.height,a=r.width,f=r.height,l=a-o,c=f-u,h=this.get("measuredSize"),p=h.width,d=h.height,v;SC.typeOf(i)===SC.T_NUMBER?(l-=i,c-=i):(l-=i.width,c-=i.height);if(p<=l&&d<=c){this.set("calculatedFontSize",t),e.style.fontSize=t+"px";return}if(this.get("autoFitDiscreteFontSizes"))v=n;else{var m=l/p,g=c/d,y=Math.floor(t*Math.min(m,g)),b=this.get("classNames"),w=!this.get("escapeHTML"),E=this .get("autoResizeText"),S;y=v=Math.min(t,Math.max(n,y)),e.style.fontSize=y+"px",S=SC.metricsForString(E,e,b,w);if(S.width>l||S.height>c)for(y-=1;y>=n;y--){e.style.fontSize=y+"px",S=SC.metricsForString(E,e,b,w),v=y;if(S.width<=l&&S.height<=c)break}else if(S.width=l||S.height>=c)break}}e.style.fontSize=v+"px",this.set("calculatedFontSize",v)},applyAttributesToContext:function(e,t){e(t),this.get("shouldAutoFitText")&&t.css("font-size",this.get("calculatedFontSize")+"px")}.enhance(),didCreateLayer:function(e){e(),this.scheduleMeasurement()}.enhance()},SC.AutoResizeManager={measurementQueue:SC.CoreSet.create(),scheduleMeasurementForView:function(e){this.measurementQueue.add(e),SC.RunLoop.currentRunLoop.invokeLast(this.doBatchResize)},cancelMeasurementForView:function(e,t){this.measurementQueue.remove(e)},doBatchResize:function(){if(this!==SC.AutoResizeManager)return SC.AutoResizeManager.doBatchResize();var e,t,n,r=this.measurementQueue,i,s,o,u;while((u=r.get("length"))>0){i=NO,e=r[u-1].get("batchResizeId");for(o=u-1;o>=0;--o){t=r[o];if(t.get("batchResizeId")!==e)continue;t.get("isVisibleInWindow")&&t.get("shouldMeasureSize")&&(n=t.get("autoResizeLayer"))&&(s=t.get("autoResizeText"),!SC.none(s)&&s!==""&&!t.get("_cachedMetrics")&&!i&&(t.prepareLayerForStringMeasurement(n),SC.prepareStringMeasurement(n,t.get("classNames")),i=YES),t.measureSize(YES)),r.remove(t);if(!e)break}i&&SC.teardownStringMeasurement()}}},SC.ContentDisplay={concatenatedProperties:"contentDisplayProperties" ,displayProperties:["content"],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(e){var t=this._display_contentPropertyDidChange;SC.isArray(e)?e.invoke("addObserver","*",this,t):e.addObserver&&e.addObserver("*",this,t)},_display_stopObservingContent:function(e){var t=this._display_contentPropertyDidChange;SC.isArray(e)?e.invoke("removeObserver","*",this,t):e.removeObserver&&e.removeObserver("*",this,t)},_display_contentDidChange:function(e,t,n){if((n=this.get("content"))===this._display_content)return;var r=this._display_content;r&&this._display_stopObservingContent(r),r=this._display_content=n,r&&this._display_beginObservingContent(r),this.displayDidChange()}.observes("content","contentDisplayProperties"),_display_contentPropertyDidChange:function(e,t,n,r){if(t==="*")this.displayDidChange();else{var i=this.get("contentDisplayProperties");i&&i.indexOf(t)>=0&&this.displayDidChange()}}},SC.ContentValueSupport={hasContentValueSupport:YES,initMixin:function(){this._control_contentKeysDidChange()},value:null,content:null,contentKeys:null,_default_contentKeys:{contentValueKey:"value"},contentValueKey:null,contentPropertyDidChange:function(e,t){var n=this.get("contentKeys"),r;if(n){for(r in n)(t==="*"||t===this.getDelegateProperty(r,this,this.get("displayDelegate"),n))&&this.updatePropertyFromContent(n[r],t,r,e);return this}return this.updatePropertyFromContent("value", t,"contentValueKey",e)},updatePropertyFromContent:function(e,t,n,r){var i,s;n===undefined&&(n="content"+e.capitalize()+"Key");if(this[n])n=this.get(n);else{if(!(i=this.get("displayDelegate"))||!(s=i[n]))return this;n=i.get?i.get(n):s}if(t==="*"||t===n)r===undefined&&(r=this.get("content")),r?s=r.get?r.get(n):r[n]:s=null,this.setIfChanged(e,s);return this},updateContentWithValueObserver:function(e,t){var n=this._reverseContentKeys;if(!t||t==="*")for(t in n)this.updateContentWithValueObserver(this,t);var r=this.get(t),i=this.get("content"),s=this.getDelegateProperty(n[t],this,this.displayDelegate);if(!s||!i)return this;typeof i.setIfChanged===SC.T_FUNCTION?i.setIfChanged(s,r):i[s]!==r&&(i[s]=r)},_control_content:null,_old_contentValueKeys:null,_old_contentKeys:null,_control_contentDidChange:function(e,t){var n=this.get("content"),r=this.get("contentKeys"),i,s=this._control_content,o=this._old_contentValueKeys,u=SC.typeOf(o),a=this.contentPropertyDidChange;if(s&&s.removeObserver&&o)if(u===SC.T_STRING)s.removeObserver(o,this,a),o=null;else{var f,l=o.get("length");for(f=0;f0&& o.get("startsNewRow");if(!this.shouldIncludeChildInFlow(r,o))continue;u=this.flowSizeForChild(r,o),a=this.flowSpacingForChild(r,o),u.width+=a.left+a.right,u.height+=a.top+a.bottom,p=u[c?"height":"width"],SC.none(u.maxSpacerLength)||(d=u.maxSpacerLength+(c?a.top+a.bottom:a.left+a.right)),h=u[c?"width":"height"];if((m||v&&l+p>y)&&f.length>0)break;var b={child:o,itemLength:p,maxSpacerLength:d,itemSize:h,spacing:a,position:undefined,fillRow:c?o.get("fillWidth"):o.get("fillHeight"),isSpacer:o.get("isSpacer"),left:undefined,top:undefined,width:undefined,height:undefined};f.push(b),l+=p,g=Math.max(p,g)}n.rowLength=l;var w=v?g:n.rowLength;return n.plan.maximumCollapsedRowLength=Math.max(w,n.plan.maximumCollapsedRowLength),n.items=f,r},_scfl_positionChildrenInRows:function(e){var t=e.rows,n=t.length,r;for(r=0;r0){for(r=0;ri.maxSpacerLength?(c+=i.itemLength-i.maxSpacerLength,i.itemLength=i.maxSpacerLength):h=YES);if(!h)break;a=Math.round(c/u),c=0}s=0,u!==0||f!==SC.ALIGN_RIGHT&&f!==SC.ALIGN_BOTTOM?u===0&&(f===SC.ALIGN_CENTER||f===SC.ALIGN_MIDDLE)&&(s=e.plan.maximumRowLength/2-e.rowLength/2):s=e.plan.maximumRowLength-e.rowLength,s+=e.plan.rowStartPadding;for(r=0;r0?l:NO,e.rowLength=s-e.plan.rowStartPadding,e.rowSize=o,e.plan.totalCollapsedRowSize+=e.rowSize},_scfl_positionRows:function(e){var t=e.rows,n=t.length,r,i,s,o=0,u=0,a;for(r=0;r0&&(i.rowSize+=a/o,o--),i.position=s,s+=i.rowSize},_scfl_applyPlan:function(e){var t=e.rows,n,r,i,s=0,o=0,u,a,f,l,c,h,p=e.isVertical;r=t.length;for(n=0;n0)r=e[t],SC.typeOf(r)===SC.T_STRING&&(r=this.get(r)),n.removeObject(r),n.unshiftObject(r);return this.endPropertyChanges(),this._scfl_childViewsDidChange(),this}},SC.InlineEditable={isInlineEditable:YES,isEditable:YES,exampleEditor:SC.InlineTextFieldView,isEditing:NO,inlineEditorDelegate:SC.InlineTextFieldDelegate,_editor:null,beginEditing:function(){var e;return e=this.delegateFor("inlineEditorShouldBeginEditing",this.inlineEditorDelegate),e&&!e.inlineEditorShouldBeginEditing(this,this.get("value"))?NO:(this._editor=this.invokeDelegateMethod(this.inlineEditorDelegate,"acquireEditor",this),this._editor?this._editor.beginEditing(this):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(e,t,n){e.set("value",this.get("value"))},inlineEditorDidBeginEditing:function(e,t,n){this.set("isEditing",YES)},inlineEditorWillCommmitEditing:function(e,t,n){this.inlineEditorWillEndEditing&&this.inlineEditorWillEndEditing(e,t)},inlineEditorDidCommitEditing:function(e,t,n){n.setIfChanged("value",t),this.inlineEditorDidEndEditing&&this.inlineEditorDidEndEditing(e,t),this._endEditing()},inlineEditorWillDiscardEditing:function(e,t){this.inlineEditorWillEndEditing&&this.inlineEditorWillEndEditing(e,this.get("value"))},inlineEditorDidDiscardEditing:function(e,t){this.inlineEditorDidEndEditing&&this.inlineEditorDidEndEditing(e,this.get("value")),this._endEditing()},_endEditing:function(){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(e){if(this.get("isEditing")||!e||!e.isInlineEditable)return NO;var t,n;return n=this._target=e,t=this.delegateFor("inlineEditorWillBeginEditing",this.inlineEditorDelegate,n),t&&t.inlineEditorWillBeginEditing(this,this.get("value"),n),this.set("isEditing",YES),this.invokeLast(this._callDidBegin),this._didBeginInvoked=YES,YES},_callDidBegin:function(){if(!this.get("isEditing"))return NO;this._didBeginInvoked=NO;var e=this._target,t;t=this.delegateFor ("inlineEditorDidBeginEditing",this.inlineEditorDelegate,e),t&&t.inlineEditorDidBeginEditing(this,this.get("value"),e)},commitEditing:function(){if(!this.get("isEditing"))return NO;this._didBeginInvoked&&this._callDidBegin();var e,t=this._target;return e=this.delegateFor("inlineEditorShouldCommitEditing",this.inlineEditorDelegate,t),e&&!e.inlineEditorShouldCommitEditing(this,this.get("value"),t)?NO:(e=this.delegateFor("inlineEditorWillCommitEditing",this.inlineEditorDelegate,t),e&&e.inlineEditorWillCommitEditing(this,this.get("value"),t),this._endEditing(),e=this.delegateFor("inlineEditorDidCommitEditing",this.inlineEditorDelegate,t),e&&e.inlineEditorDidCommitEditing(this,this.get("value"),t),YES)},discardEditing:function(){if(!this.get("isEditing"))return NO;this._didBeginInvoked&&this._callDidBegin();var e,t=this._target;return e=this.delegateFor("inlineEditorShouldDiscardEditing",this.inlineEditorDelegate,t),e&&!e.inlineEditorShouldDiscardEditing(this,t)?NO:(e=this.delegateFor("inlineEditorWillDiscardEditing",this.inlineEditorDelegate,t),e&&e.inlineEditorWillDiscardEditing(this,t),this._endEditing(),e=this.delegateFor("inlineEditorDidDiscardEditing",this.inlineEditorDelegate,t),e&&e.inlineEditorDidDiscardEditing(this,t),YES)},_endEditing:function(){this.set("isEditing",NO),this._target=null}},SC.InlineEditorDelegate={acquireEditor:function(e){},releaseEditor:function(e){},inlineEditorShouldBeginEditing:function(e,t){},inlineEditorWillBeginEditing:function(e,t,n){},inlineEditorDidBeginEditing:function(e,t,n){},inlineEditorShouldCommitEditing:function(e,t,n){},inlineEditorWillCommitEditing :function(e,t,n){},inlineEditorDidCommitEditing:function(e,t,n){},inlineEditorShouldDiscardEditing:function(e,t){},inlineEditorWillDiscardEditing:function(e,t){},inlineEditorDidDiscardEditing:function(e,t){},inlineEditorWillEndEditing:function(e,t,n){},inlineEditorDidEndEditing:function(e,t,n){}},SC.SCALE_NONE="none",SC.FILL="fill",SC.FILL_PROPORTIONALLY="fillProportionally",SC.BEST_FIT="fitBest",SC.BEST_FIT_DOWN_ONLY="fitBestDown",SC.InnerFrame={align:SC.ALIGN_CENTER,innerFrameForSize:function(e,t,n,r){var i=this.get("align"),s=this.get("scale"),o,u,a;a={x:0,y:0,width:n,height:r};if(s===SC.FILL)return a;o=n/e,u=r/t;switch(s){case SC.FILL_PROPORTIONALLY:s=o>u?o:u;break;case SC.BEST_FIT:s=on||t>r?s=on.maxWidth||n.height!==undefined&&s.height!==n.height||n.minHeight!==undefined&&s.height"+n+""),s&&(s.indexOf("/")>=0?s='':s=''),s+t}}),SC.Benchmark={verbose:NO,enabled:YES,events:{},stats:{},globalStartTime:null,addEvent:function(e,t){t||(t=SC.getCurrentTimeForPerformance()),this.events[e]=t},start:function(e,t,n,r){if(!this.enabled)return;var i=n||SC.getCurrentTimeForPerformance(),s;return t?s=this._subStatFor(e,t):s=this._statFor(e),r&&s._starts.length>0?s._starts.push("ignore"):s._starts.push(i),s._times.push({start:i,_subStats:{}}),e},end:function(e,t,n){var r,i,s;if(!this.enabled)return;t?r=this._subStatFor(e,t):r=this._statFor(e),i=r._starts,i&&(s=i.pop());if(!s){SC.Logger.log('SC.Benchmark "%@" ended without a matching start. No information was saved.'.fmt(e));return}if(s=="ignore")return;var o=n||SC.getCurrentTimeForPerformance(),u=o-s;r._times[r._times.length-1].end=o,r._times[r._times.length-1].dur=u,r.amt+=u,r.runs++,this.verbose&&this.log(e)},setGlobalStartTime:function(e){this.globalStartTime=e},bench:function(e,t,n){t||(t="bench%@".fmt(this._benchCount++)),n||(n=1);var r;while(--n>=0){var i=SC.Benchmark.start(t);r=e(),SC.Benchmark.end(i)}return r},install:function(e,t,n){e["b__"+t]=e[t];var r=e["b__"+t];e[t]=function(){var e="%@(%@)".fmt(t,$A(arguments ).join(", "));SC.Benchmark.start(e,n);var i=r.apply(this,arguments);return SC.Benchmark.end(e),i}},restore:function(e,t){e[t]=e["b__"+t]},report:function(e){if(e)return this._genReport(e);var t=[];for(var n in this.stats){if(!this.stats.hasOwnProperty(n))continue;t.push(this._genReport(n))}return t.join("\n")},timelineReport:function(e){e=e?"SproutCore Application":e;var t=[e,"User-Agent: %@".fmt(navigator.userAgent),"Report Generated: %@ (%@)".fmt((new Date).toString(),Date.now()),""],n=this._compileChartData(!0);for(var r=0;r";f+="
";for(var l=0;l",f+="
"+l*200+"ms
";for(l=0;l";var c=document.createElement("div"),h=e[l][1],p=e[l][2],d=e[l][3];f+="
",f+=d+"ms (start: "+(h-n)+"ms)",f+="",f+="
"}var v=this.events,m=0;for(l in v){var g=v[l]-n;f+="
",m++}return f+="",{html:f,totalCapturedTime:r,pointsCaptured:t,width:o+u+a,height:i}},getTimelineChartView:function(){var e=SC.ScrollView.create({contentView:SC.StaticContentView.extend({}),reload:function(){var e=SC.Benchmark.getTimelineChartContent();this.contentView.set("content",e.html),this.contentView.adjust({width:e.width,height:e.height}),this.chartContent=e,SC.RunLoop.invokeLater(SC.Benchmark,function(){this.contentView.notifyPropertyChange("frame")})}});return e.reload(),e},timelineChart:function(e){SC.RunLoop.begin();var t=0;this.hideChart();var n=this.getTimelineChartView(),r=n.chartContent.pointsCaptured,i=n.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:(e?e:"SproutCore Application")+(" - Total Captured Time: "+i+" ms - Points Captured: "+r),fontWeight:"bold"})}).append(),n.set("layout",{left:20,top:60,bottom:20,right:20}),this._benchmarkChart.appendChild(n),SC.RunLoop.end()},hideChart :function(){return this._benchmarkChart&&(this._benchmarkChart.remove(),this._benchmarkChart=null),YES},tryToPerform:function(e,t){return this[e]?this[e](t):NO},log:function(e){var t=this.report(e).split("\n"),n=t.length,r;for(r=0;r1?s+1+" - "+r:r,t.push([n,o.start,o.end,o.dur,!1]);if(e){var u=o._subStats;for(var a in u){var f=u[a];for(var l=0;l1?l+1+" - "+a:a,t.push([n,c.start,c.end,c.dur,!0])}}}}}return t.sort(function(e,t){return e[1]0?Math.floor(t.amt*1e3/t.runs)/1e3:0,r=t._times[t._times.length-1];return"BENCH %@ msec: %@ (%@x); latest: %@".fmt(n,t.name||e,t.runs,r.end-r.start)},_timelineGenReport:function(e){return this.globalStartTime?"BENCH start: %@ msec, duration: %@ msec, %@".fmt(e[1]-this.globalStartTime,e[3],e[0]):"BENCH duration: %@ msec, %@".fmt(e[3],e[0])},_timelineGenSubReport:function(e){return this.globalStartTime?" CHECKPOINT BENCH start: %@ msec, duration: %@ msec, %@".fmt(e[1]-this.globalStartTime,e[3],e[0]):" CHECKPOINT BENCH duration: %@ msec, %@".fmt(e[3],e[0])},_subStatFor:function(e,t){var n=this.stats[t]._times.length;if(n===0)return;var r=this.stats[t]._times[this.stats[t]._times.length-1]._subStats,i=r[e];return i||(r[e]={runs:0,amt:0,name:e,_starts:[],_times:[]},i=r[e]),i},_statFor:function(e){var t=this.stats[e];return t||(t=this.stats[e]={runs:0,amt:0,name:e,_starts:[],_times:[]},t=this.stats[e]),t},reset:function(){this.stats={}},_bench:function(e,t){SC.Benchmark.bench(e,t,1)},_benchCount:1},SC.Benchmark=SC.Benchmark,SC.mixin(SC.$.fn,{setClass:function(e,t){if(SC.none(e))return this;var n=SC.typeOf(e)!==SC.T_STRING,r=this._fixupClass,i;return this.each(function(){if(this.nodeType!==1)return;var i=this.className.split(/\s+/),s=NO;if(n)for(var o in e)e.hasOwnProperty(o)&&(s=r(i,o,e[o])||s);else s=r(i,e,t);s&&(this.className=i.join(" "))}),this},_fixupClass:function(e,t,n){var r=e.indexOf(t);if(n){if(r<0)return e.push(t),YES}else if(r>=0)return e[r]=null,YES;return NO} }),SC.ExceptionHandler={enabled:SC.buildMode!=="debug",handleException:function(e){return this.isShowingErrorDialog?NO:(this._displayErrorDialog(e),NO)},_displayErrorDialog:function(e){var t=this._errorDialogHTMLForException(e),n=document.createElement("div");n.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;",n.innerHTML=t,document.body.appendChild(n),this.isShowingErrorDialog=YES},_errorDialogHTMLForException:function(e){var t;return t=['
',"An error has occurred which prevents the application from running:","

",e.message,'
',"Reload","
","
"],t.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(e,t,n,r){var i=SC.typeOf(t);SC.none(n)&&SC.typeOf(t)===SC.T_FUNCTION&&(t=null,n=t),SC.typeOf(n)===SC.T_STRING&&(n=t[n]),SC.none(r)&&(r=SC.none(t)&&SC.none(n));var s=this ._imageEntryFor(e);s.status===this.IMAGE_LOADED?n&&n.call(t||s.image,s.url,s.image):((t||n)&&this._addCallback(s,t,n),s.retainCount++,this._scheduleImageEntry(s,r))},releaseImage:function(e,t,n){var r=this._imageEntryFor(e,NO);if(!r)return this;if(--r.retainCount<=0)this._deleteEntry(r);else if(t||n){var i=SC.typeOf(t);SC.none(n)&&SC.typeOf(t)===SC.T_FUNCTION&&(t=null,n=t),SC.typeOf(n)===SC.T_STRING&&(n=t[n]),this._removeCallback(r,t,n)}},reloadImage:function(e){var t=this._imageEntryFor(e,NO);t&&t.status===this.IMAGE_LOADED&&(t.status=this.IMAGE_WAITING)},loadNextImage:function(){var e=null,t;if(this.get("activeRequests")>=this.get("loadLimit"))return;t=this._foregroundQueue;while(t.length>0&&!e)e=t.shift();if(!e){t=this._backgroundQueue;while(t.length>0&&!e)e=t.shift()}this.set("isLoading",!!e);if(e){var n=e.image;if(!n)return;var r=SC.$(n);r.length!==0?(r.bind("abort",this._imageDidAbort),r.bind("error",this._imageDidError),r.bind("load",this._imageDidLoad),n.src=e.url,this._loading.push(e)):e.url?SC.error("Unable to load the image for url %@".fmt(e.url)):SC.error("entry does not contain any url. Its an invalid entry"),this.incrementProperty("activeRequests"),this.loadNextImage()}},_imageEntryFor:function(e,t){t===undefined&&(t=YES);var n=this._images[e];if(!n&&t){var r=new Image;n=this._images[e]={url:e,status:this.IMAGE_WAITING,callbacks:[],retainCount:0,image:r},r.entry=n}return n},_deleteEntry:function(e){this._unscheduleImageEntry(e),delete this._images[e.url]},_addCallback:function(e,t,n){var r=e.callbacks,i=r.find(function(e){return e[0]===t&&e[1]===n},this);return i|| r.push([t,n]),r=null,this},_removeCallback:function(e,t,n){var r=e.callbacks;return r.forEach(function(e,i){e[0]===t&&e[1]===n&&(r[i]=null)},this),r=null,this},_scheduleImageEntry:function(e,t){var n=this._backgroundQueue,r=this._foregroundQueue;if(e.status===this.IMAGE_LOADED)return this;e.status===this.IMAGE_QUEUED&&!t&&e.isBackground&&(n[n.indexOf(e)]=null,e.status=this.IMAGE_WAITING);if(e.status!==this.IMAGE_QUEUED){var i=t?n:r;i.push(e),e.status=this.IMAGE_QUEUED,e.isBackground=t}return this.isLoading||this.invokeLater(this.loadNextImage,100),this.set("isLoading",YES),this},_unscheduleImageEntry:function(e){if(e.status!==this.IMAGE_QUEUED)return this;var t=e.isBackground?this._backgroundQueue:this._foregroundQueue;return t[t.indexOf(e)]=null,this._loading.indexOf(e)>=0&&(t.image&&t.image.abort(),this.imageStatusDidChange(e,this.ABORTED)),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(e,t){if(!e)return;var n=e.url,r;switch(t){case this.LOADED:r=e.image;break;case this.ABORTED:r=SC.IMAGE_ABORTED_ERROR;break;case this.ERROR:r=SC.IMAGE_FAILED_ERROR;break;default:r=SC.IMAGE_FAILED_ERROR}e.callbacks.forEach(function(e){var t=e[0],i=e[1];i.call(t,n,r)},this),e.callbacks=[],e.status=t===this.LOADED?this.IMAGE_LOADED:this.IMAGE_WAITING;var i= e.image;i&&(i.onload=i.onerror=i.onabort=null,t!==this.LOADED&&(e.image=null)),this._loading[this._loading.indexOf(e)]=null,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.Task=SC.Object.extend({run:function(e){}}),SC.LOG_MODULE_LOADING=YES,SC.Module=SC.Object.create({isModuleReady:function(e){var t=SC.MODULE_INFO[e];return t?!!t.isReady:NO},loadModule:function(e,t,n){var r=SC.MODULE_INFO[e],i,s,o=SC.A(arguments).slice(3),u=SC.LOG_MODULE_LOADING,a,f;n===undefined&&SC.typeOf(t)===SC.T_FUNCTION&&(n=t,t=null),u&&SC.debug("SC.Module: Attempting to load '%@'",e);if(!r)throw"SC.Module: could not find module '%@'".fmt(e);r.isPrefetching=NO;if(r.isLoaded&&!r.isWaitingForRunLoop)return u&&SC.debug("SC.Module: Module '%@' already loaded.",e),this._dependenciesMetForModule(e)?r.source?(u&&SC.debug("SC.Module: Evaluating JavaScript for module '%@'.",e),this._evaluateStringLoadedModule(r),this._addCallbackForModule(e,t,n,o),this.invokeLast(function(){r.isReady=YES,this._moduleDidBecomeReady(e)}),NO):(n&&(SC.isReady?SC.Module._invokeCallback(e,t,n,o):SC.ready(SC.Module,function(){SC.Module._invokeCallback(e,t,n,o)})),YES):(this._addCallbackForModule(e,t,n,o),this._loadDependenciesForModule(e),NO);if(!r.isWaitingForRunLoop)return u&&SC.debug ("SC.Module: Module '%@' is not loaded, loading now.",e),this._addCallbackForModule(e,t,n,o),r.isLoading||(this._loadDependenciesForModule(e),this._loadCSSForModule(e),this._loadJavaScriptForModule(e),r.isLoading=YES),NO;this._addCallbackForModule(e,t,n,o)},_addCallbackForModule:function(e,t,n,r){var i=SC.MODULE_INFO[e],s=i.callbacks||[];n&&s.push(function(){SC.Module._invokeCallback(e,t,n,r)}),i.callbacks=s},prefetchModule:function(e){var t=SC.MODULE_INFO[e];if(t.isLoading||t.isLoaded)return;SC.LOG_MODULE_LOADING&&SC.debug("SC.Module: Prefetching module '%@'.",e),this._loadDependenciesForModule(e),this._loadCSSForModule(e),this._loadJavaScriptForModule(e),t.isLoading=YES,t.isPrefetching=YES},_executeLazilyInstantiatedModule:function(e,t,n){var r=SC.LAZY_INSTANTIATION[e],i,s,o,u;SC.LOG_MODULE_LOADING&&SC.debug("SC.Module: Module '%@' is marked for lazy instantiation, instantiating it now…",e),u=r.length;for(o=0;o1?(n=t.css2xSource,r=t.css2xLogicalUrl,n||(n=t.cssSource,r=t.cssLogicalUrl)):(n=t.cssSource,r=t.cssLogicalUrl);var i=SC.absoluteUrl(r);return i=i.split("/"),i.pop(),i=i.join("/"),n=n.replace(/url\s*\(\s*["']?(.*?)["']\s*?\)/g,function(e,t){return t[0]==="/"?e:t.match(/https?:|file:/)?e:(t=i+"/"+t,"url("+JSON.stringify(t)+")")}),t._sc_module_postprocessed_css=n,n},_loadCSSForModule:function(e){var t=document.getElementsByTagName("head")[0],n=SC.MODULE_INFO[e],r=window.devicePixelRatio>1?n.styles2x:n.styles||[],i=r.length,s,o,u;t||(t=document.documentElement),i=r.length;for(u=0;u0&&(SC.LOG_MODULE_LOADING&&SC.debug("SC.Module: Loading CSS file in '%@' -> '%@'",e,s),o=document.createElement("link"),o.setAttribute("href",s),o.setAttribute("rel","stylesheet"),o.setAttribute("type","text/css"),t.appendChild(o));o=null},_loadJavaScriptForModule:function(e){var t=SC.MODULE_INFO[e],n,r,i=t.dependencies,s=YES;i&&i.length>0&&(s=this._dependenciesMetForModule(e)),t.isPrefetched?r=t.stringURL:s?r=t.scriptURL:r=t.stringURL;if(r.length>0){SC.LOG_MODULE_LOADING&&SC.debug("SC.Module: Loading JavaScript file in '%@' -> '%@'",e,r);if(parseFloat(SC.browser.msie)>=11){var o=new XMLHttpRequest;o.onreadystatechange=function(){if(this.readyState!==4||this.status!==200||this._done===(this._done=YES))return;window.eval.call(window,this.responseText+';SC.run(function(){SC.Module._moduleDidLoad("'+e+'")})')}, o.open("GET",r),o.send(null);return}n=document.createElement("script"),n.setAttribute("type","text/javascript"),n.setAttribute("async","true"),n.setAttribute("src",r),SC.browser.isIE?n.onreadystatechange=function(){(this.readyState=="complete"||this.readyState=="loaded")&&SC.run(function(){SC.Module._moduleDidLoad(e)})}:n.onload=function(){SC.run(function(){SC.Module._moduleDidLoad(e)})},document.body.appendChild(n)}},_dependenciesMetForModule:function(e){var t=SC.MODULE_INFO[e].dependencies||[],n,r=t.length,i,s;for(n=0;n0)return;var e=this.get("methodsForSuspend"),t=this._bufferedCalls,n,r,i,s;for(r=0;n=e[r];r++)this[n]=this["__saved_"+n+"__"];for(r=0;s=t&&t[r];r++)this[s.method].apply(this,s.arguments);t&&(t.length=0)}}),SC.ready(function(){var e=SC.MODULE_INFO,t,n,r;for(t in e)n=e[t],n.isPrefetched&&(r=SC.Module.PrefetchModuleTask.create({prefetchedModuleName:t}),SC.backgroundTaskQueue.push(r))}),SC.Module.PrefetchModuleTask=SC.Task.extend({prefetchedModuleName:null,run:function(){SC.Module.prefetchModule (this.prefetchedModuleName)}}),SC.TaskQueue=SC.Task.extend({init:function(){var e=this;this._doIdleEntry=function(){e._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(e){this._tasks.push(e),this.notifyPropertyChange("taskCount")},next:function(){if(this._tasks.length<1)return null;var e=this._tasks.shift();return this.notifyPropertyChange("taskCount"),e},suspend:function(){this._suspendCount++},resume:function(){this._suspendCount--,this._suspendCount<=0&&this._setupIdle()},_taskCountDidChange:function(){this._setupIdle()}.observes("taskCount"),_runWhenIdleDidChange:function(){this._setupIdle()}.observes("runWhenIdle"),_setupIdle:function(){!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 e=SC.RunLoop.lastRunLoopEnd;if(!this.get("runWhenIdle")&&!this._suspendCount)return;Date.now()-e>this.get("minimumIdleDuration")&&(SC.run(this.run,this),SC.RunLoop.lastRunLoopEnd=e),this._setupIdle()},run:function(e){this.set("isRunning",YES),e||(e=this.get("runLimit"));var t,n=Date.now();while(t=this.next()){t.run(this);if(Date.now()-n>e)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,length:function(){var e=this.get("start"),t=this.get("end");return e===-1||t===-1?-1:t-e}.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")})},toString:function(){var e=this.get("length");return e&&e>0?e===1?"[%@ character selected: {%@, %@}]".fmt(e,this.get("start"),this.get("end")):"[%@ characters selected: {%@, %@}]".fmt(e,this.get("start"),this.get("end")):"[no text selected; caret at %@]".fmt(this.get("start"))}}),SC.mixin({_downloadFrames:0,download:function(e){var t=document.createElement("iframe"),n="DownloadFrame_"+this._downloadFrames;SC.$(t).attr("id",n),t.style.border="10px",t.style.width="0px",t.style.height="0px",t.style.position="absolute",t.style.top="-10000px",t.style.left="-10000px",SC.browser.isSafari||SC.$(t).attr("src",e),document.getElementsByTagName("body")[0].appendChild(t),SC.browser.isSafari&&SC.$(t).attr("src",e),this._downloadFrames=this._downloadFrames+1;if(!SC.browser.isSafari){var r=function(){document.body.removeChild(document.getElementById(n)),n=null};r.invokeLater(null,2e4)}t=null},getStyle:function(e,t){var n="";return document.defaultView&&document.defaultView.getComputedStyle?n=document.defaultView.getComputedStyle(e,"").getPropertyValue(t):e.currentStyle&&(t=t.replace(/\-(\w)/g,function(e,t){return t.toUpperCase()}),n=e.currentStyle[t]),n},uniJapaneseConvert:function(e){var t,n="",r,i;for(r=0,i=e.length;r=65281&&t<=65392? t-65248:t,t=t===12540?45:t,n+=String.fromCharCode(t);return n},pointInElement:function(e,t,n,r){var i,s,o,u;return t=jQuery(t),n=n||"border",i=SC.offset(t,r),n==="padding"?(s=t.innerWidth(),o=t.innerHeight(),i.x+=window.parseInt(t.css("border-top-width").replace("px","")),i.y+=window.parseInt(t.css("border-left-width").replace("px",""))):(s=t.outerWidth(n==="margin"),o=t.outerHeight(n==="margin"),n==="margin"&&(i.x-=window.parseInt(t.css("margin-top").replace("px","")),i.y-=window.parseInt(t.css("margin-left").replace("px","")))),u={x:i.x,y:i.y,width:s,height:o},SC.pointInRect(e,u)},switchScale:function(){$("head meta[name=viewport]").remove(),window.innerWidth===window.screen.width?$("head").prepend(''):$("head").prepend('')}}),SC.mixin({bestStringMetricsForMaxWidth:function(e,t,n,r,i){if(!t)return SC.warn("When calling bestMetricsForWidth, the second argument, maxWidth, is required. There's no reason to call this without a maxWidth."),undefined;t=Math.ceil(parseFloat(t));var s=arguments.callee,o=SC.typeOf(n||(n=""))!==SC.T_STRING,u=o?n.style.maxWidth:undefined,a=!o||n.cacheableForMetrics?SC.cacheSlotFor(n,r,i,e):undefined,f=o?s._applyMaxToEl||(s._applyMaxToEl=function(e,t){return e.style.maxWidth=t+"px",e}):s._applyMaxToStr||(s._applyMaxToStr=function(e,t){return e.replace(/max-width:[^;]*;/g,"")+" max-width:"+t+"px"}),l=o?s._removeMaxFromEl|| (s._removeMaxFromEl=function(e){return e.style.maxWidth="none",e}):s._removeMaxFromStr||(s._removeMaxFromStr=function(e){return e.replace(/max-width:[^;]*;/g,"")+" max-width:none"}),c=!1;if(a){a.list||(a.list=[{width:Infinity,height:0}]);for(var h=1,p=a.list.length,d,v,m;h=d.width){if(v&&v.width||t<=d.maxWidth)return d;m=d}}}var g=f(n,t),y=SC.metricsForString(e,g,r,i),b=y.height,w=a?a.parent.height||(a.parent.height=SC.metricsForString("W",g,r).height):SC.metricsForString("W",g,r).height,E=Math.round(b/w);c&&(E--,b=E*w);if(b>w){var S=c?Math.ceil(y.width*2.5):y.width,x=c?y.width:Math.floor(y.width/2.5),T,N=new Date*1,C=0;while(S-x>1||y.height>b&&!c||y.heightb?x=T:S=T;y.width=Math.ceil(T),y.height=b,y.maxWidth=t,y.lineHeight=w,y.lines=E,y.searchPerformed=!0,y.searchTime=new Date*1-N,y.searchCount=C}else c&&(y=SC.metricsForString(e,g=l(g),r,i)),y.maxWidth=t,y.lineHeight=w,y.lines=E,y.searchPerformed=!1;y.browserCorrection=0,SC.browser.msie&&(y.browserCorrection=1),SC.browser.mozilla&&(y.browserCorrection=1),y.width=Math.min(t,y.width+y.browserCorrection);if(a){var k=a.list[E];k&&k.maxWidth0&&this.nowShowingDidChange()},nowShowingDidChange:function(){var e=this.get("nowShowing");if(e===SC.CONTENT_SET_DIRECTLY)return;var t=this._instantiatedLastView===YES?this.get("contentView"):null;this._instantiatedLastView=NO;if(SC.typeOf(e)===SC.T_STRING&&e.length>0)if(e.indexOf(".")>0) e=SC.objectForPropertyPath(e);else{var n=this.getPath(e);e=SC.kindOf(n,SC.CoreView)?n:SC.objectForPropertyPath(e,this.get("page"))}SC.typeOf(e)===SC.T_CLASS&&(e.kindOf(SC.CoreView)?(e=this.createChildView(e),this._instantiatedLastView=YES):e=null),e&&!(e instanceof SC.CoreView)&&(e=null),this.set("contentView",e),t&&t.destroy()}.observes("nowShowing"),contentViewDidChange:function(){this.replaceContent(this.get("contentView"))}.observes("contentView")}),SC.FieldView=SC.View.extend(SC.Control,SC.Validatable,{isTextArea:NO,_field_isMouseDown:NO,fieldValue:function(){var e=this.get("value");return SC.typeOf(e)===SC.T_ERROR&&(e=e.get("errorValue")),this.fieldValueForObject(e)}.property("value","validator").cacheable(),$input:function(){return this.get("isTextArea")?this.$("textarea").andSelf().filter("textarea"):this.$("input").andSelf().filter("input")},setFieldValue:function(e){SC.none(e)&&(e="");var t=this.$input();return t.val()!==e&&t.val(e),this},getFieldValue:function(){return this.$input().val()},_field_fieldValueDidChange:function(e){SC.run(function(){this.fieldValueDidChange(NO)},this)},fieldValueDidChange:function(e){var t=this.getFieldValue(),n=this.objectForFieldValue(t,e);this.setIfChanged("value",n)},_field_valueDidChange:function(){this.setFieldValue(this.get("fieldValue"))}.observes("fieldValue"),didCreateLayer:function(){this.setFieldValue(this.get("fieldValue")),SC.Event.add(this.$input(),"change",this,this._field_fieldValueDidChange)},didAppendToDocument:function(){this.get("isTextArea")&&(this.setFieldValue(this.get("fieldValue")),SC.Event.add(this.$input(),"change" ,this,this._field_fieldValueDidChange))},willDestroyLayer:function(){SC.Event.remove(this.$input(),"change",this,this._field_fieldValueDidChange)},mouseDown:function(e){return this._field_isMouseDown=YES,e.allowDefault(),YES},mouseExited:function(e){return this._field_isMouseDown&&this.set("isActive",NO),e.allowDefault(),YES},mouseEntered:function(e){return this.set("isActive",this._field_isMouseDown),e.allowDefault(),YES},mouseUp:function(e){return this._field_isMouseDown&&this.set("isActive",NO),this._field_isMouseDown=NO,e.allowDefault(),YES},keyDown:function(e){if(e.which===9||e.keyCode===9){var t=e.shiftKey?this.get("previousValidKeyView"):this.get("nextValidKeyView");return t?t.becomeFirstResponder():e.allowDefault(),YES}return this.performValidateKeyDown(e)?(this._isKeyDown=YES,e.allowDefault()):e.stop(),YES},acceptsFirstResponder:function(){return SC.FOCUS_ALL_CONTROLS?this.get("isEnabled"):NO}.property("isEnabled"),_field_setFieldValue:function(e){this.propertyWillChange("fieldValue"),this.fieldValueForObject&&(e=this.fieldValueForObject(e));var t=this.setFieldValue(e);return this.propertyDidChange("fieldValue"),t},_field_getFieldValue:function(){var e=this.getFieldValue();return this.objectForFieldValue&&(e=this.objectForFieldValue(e)),e}}),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.msie&&SC.browser.msie<8?"/system/cloudos/1812Project43/sproutcore/foundation/1812Project43/en-us/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:["frame","image","innerFrame","toolTip","imageValue","type"],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,imageValue:function(){var e=this.get("value");return e&&e.isEnumerable?e.firstObject():e}.property("value").cacheable(),innerFrame:function(){var e=this.get("image"),t=e.width,n=e.height,r=this.get("frame");return SC.none(r)?{x:0,y:0,width:0,height:0}:this.innerFrameForSize(t,n,r.width,r.height)}.property("align","image","scale","frame").cacheable(),localize:YES,status:SC.IMAGE_STATE_NONE,type:function(){var e=this.get("imageValue");return SC.ImageView.valueIsUrl(e)?SC.IMAGE_TYPE_URL:SC.none(e)?SC.IMAGE_TYPE_NONE:SC.IMAGE_TYPE_CSS_CLASS}.property("imageValue").cacheable(),useCanvas:function(){return SC.platform.supportsCanvas&&!this.get("useStaticLayout")&&this.get("type")!==SC.IMAGE_TYPE_CSS_CLASS}.property("useStaticLayout","type").cacheable(),useImageQueue:YES,value:null,viewDidResize:function(){var e=this.get("layer"),t,n;if(e){t=e.offsetWidth,n=e.offsetHeight;if(this._cachedWidth!== t||this._cachedHeight!==n)this.notifyPropertyChange("frame"),this._cachedWidth=t,this._cachedHeight=n}},init:function(){arguments.callee.base.apply(this,arguments),this._image_valueDidChange(),this.get("useImageCache")!==undefined&&(SC.Logger.warn("%@ has useImageCache set, please set useImageQueue instead".fmt(this)),this.set("useImageQueue",this.get("useImageCache")))},layerDidChange:function(){this.get("useCanvas")&&this.set("layerNeedsUpdate",YES)}.observes("layer"),_image_valueDidChange:function(){var e=this.get("imageValue"),t=this.get("type");e!==this._iv_value&&(this._iv_value=e,this.set("image",SC.BLANK_IMAGE),t!==SC.IMAGE_TYPE_CSS_CLASS&&(this.set("status",SC.IMAGE_STATE_LOADING),this._loadImageUsingCache()||this._loadImage()))}.observes("imageValue"),_loadImageUsingCache:function(){var e=this.get("imageValue"),t=this.get("type");if(t===SC.IMAGE_TYPE_URL&&this.get("useImageQueue")){var n=this.get("isVisibleInWindow")||this.get("canLoadInBackground");return SC.imageQueue.loadImage(e,this,this._loadImageUsingCacheDidComplete,n),YES}return NO},_loadImageUsingCacheDidComplete:function(e,t){var n=this.get("imageValue");n===e&&(SC.ok(t)?this.didLoad(t):this.didError(t))},_loadImage:function(){var e=this.get("imageValue"),t=this.get("type"),n=this,r,i;if(t===SC.IMAGE_TYPE_URL){r=new Image;var s=function(){SC.run(function(){n._loadImageDidComplete(e,SC.$error("SC.Image.FailedError","Image",-101))})},o=function(){SC.run(function(){n._loadImageDidComplete(e,r)})};return i=$(r),i.bind("error",s),i.bind("abort",s),i.bind("load",o),r.src=e,YES}return NO},_loadImageDidComplete:function( e,t){var n=this.get("imageValue");n===e&&(SC.ok(t)?this.didLoad(t):this.didError(t))},didLoad:function(e){this.set("status",SC.IMAGE_STATE_LOADED),e||(e=SC.BLANK_IMAGE),this.set("image",e)},didError:function(e){this.set("status",SC.IMAGE_STATE_FAILED),this.set("image",SC.BLANK_IMAGE)}}),SC.ImageView.valueIsUrl=function(e){return e&&SC.typeOf(e)===SC.T_STRING?e.indexOf("/")>=0:NO},SC.TextFieldView=SC.FieldView.extend(SC.StaticLayout,SC.Editable,{classNames:["sc-text-field-view"],isTextField:YES,escapeHTML:NO,applyImmediately:YES,commitOnBlur:YES,isPassword:NO,isTextArea:NO,hint:"",type:"text",isBrowserFocusable:YES,autoCorrect:!0,autoCapitalize:!0,formattedHint:function(){var e=this.get("hint");return typeof e=="string"&&(this.get("localize")&&(e=SC.String.loc(e)),this.get("escapeHTML")&&(e=SC.RenderContext.escapeHTML(e)),e=e.replace(/\"/g,""")),e}.property("hint","localize","escapeHTML").cacheable(),hintOnFocus:YES,localize:YES,isEditing:NO,defaultTabbingEnabled:YES,isContextMenuEnabled:YES,continuouslyUpdatesValue:null,allowsErrorAsValue:YES,leftAccessoryView:null,rightAccessoryView:null,spellCheckEnabled:YES,maxLength:5096,shouldRenderBorder:YES,shouldRenderInnerBorder:NO,supportsAutoResize:YES,autoResizeLayer:function(){return this.$input()[0]}.property("layer").cacheable(),autoResizeText:function(){return this.get("value")}.property("value").cacheable(),autoResizePadding:SC.propertyFromRenderDelegate("autoResizePadding",20),_hintON:YES,init:function(){var e=this.get("value");this._hintON=(!e||e&&e.length===0)&&!this.get("hintOnFocus")?YES:NO;var t=this.get("continouslyUpdatesValue" );return t!==null&&t!==undefined&&this.set("applyImmediately",t),arguments.callee.base.apply(this,arguments)},isEditable:YES,selection:function(e,t){var n=this.$input()[0],r,i,s;if(t===undefined){if(n){i=null,s=null;if(!n.value)i=s=0;else{try{"selectionStart"in n&&(i=n.selectionStart),"selectionEnd"in n&&(s=n.selectionEnd)}catch(o){return null}if(i===null||s===null){var u=document.selection;if(u){var a=u.type;if(a&&(a==="None"||a==="Text")){r=u.createRange();if(!this.get("isTextArea")){var f=r.text.length;i=Math.abs(r.moveStart("character",0-(n.value.length+1))),s=i+f}else{var l=r.duplicate();l.moveToElementText(n),l.setEndPoint("EndToStart",r),i=l.text.length,s=i+r.text.length}}}}}return SC.TextSelection.create({start:i,end:s})}return null}if(!t||!t.kindOf||!t.kindOf(SC.TextSelection))throw"When setting the selection, you must specify an SC.TextSelection instance.";if(n)if(n.setSelectionRange)n.setSelectionRange(t.get("start"),t.get("end"));else{r=n.createTextRange(),i=t.get("start"),r.move("character",i),r.moveEnd("character",t.get("end")-i);try{r.select()}catch(o){SC.Error("Failed selecting, this is a know bug with IE8, error 800a025e. Ignoring")}}return t}.property("fieldValue").cacheable(),displayProperties:["isBrowserFocusable","formattedHint","fieldValue","isEditing","isEditable","leftAccessoryView","rightAccessoryView","isTextArea"],createChildViews:function(){arguments.callee.base.apply(this,arguments),this.accessoryViewObserver()},acceptsFirstResponder:function(){return this.get("isEnabled")}.property("isEnabled"),accessoryViewObserver:function(){var e,t=["leftAccessoryView" ,"rightAccessoryView"],n=t.length,r,i,s,o;for(r=0;r0),r=this._getAccessoryViewWidths(),i=r.left,s=r.right,i&&(i+="px"),s&&(s+="px"),this._renderField(e,t,n,i,s)},localizedAriaLabel:function(){var e=this.get("ariaLabel");return!SC.none(e)&&typeof e===SC.T_STRING&&this.get("localize")&&(e=SC.String.loc(e)),e}.property("ariaLabel","localize").cacheable(),_forceRenderFirstTime:NO,_renderFieldLikeFirstTime:function(){this.set("_forceRenderFirstTime",YES)}.observes("isTextArea"),_renderField:function(e,t,n,r,i){var s=this.get("formattedHint"),o=this.get("localizedAriaLabel"),u=this.get("hintOnFocus"),a="",f=this.get("maxLength"),l=this.get("isTextArea"),c=this.get("isEnabled"),h=this .get("isEditable"),p=this.get("autoCorrect"),d=this.get("autoCapitalize"),v=this.get("isBrowserFocusable"),m=SC.RenderContext,g="",y="",b="",w,E,S,x,T,N,C,k,L,A;n&&(this.get("escapeHTML")&&(n=m.escapeHTML(n)),n=n.replace(/\"/g,""")),e.setClass("text-area",l),e.setClass("text-field",!l),k=SC.browser.isWebkit&&parseInt(SC.browser.webkit,0)<532,e.setClass("oldWebKitFieldPadding",k);if(SC.none(o)){var O=this.get("hint");o=this.get("localize")?SC.String.loc(O):O}if(t||this._forceRenderFirstTime){this._forceRenderFirstTime=NO,L=c?h?"":'readonly="readonly"':'disabled="disabled"',w=this.get("layerId"),g=this.get("spellCheckEnabled")?' spellcheck="true"':' spellcheck="false"',o=m.escapeAttribute(o),SC.browser.mobileSafari&&(b=p?"":' autocorrect="off"',y=d?"":' autocapitalize="off"'),v&&(A='tabindex="-1"'),SC.platform.input.placeholder&&!u&&(a=' placeholder="'+s+'"'),this.get("shouldRenderBorder")&&!this.get("shouldRenderInnerBorder")&&e.push('
'),E="";if(r||i)E='style="',r&&(E+="left: "+r+"; "),i&&(E+="right: "+i+";"),E+='"';e.push('
"),this._hintON&&!SC.platform.input.placeholder&&(!n||n&&n.length===0)&&(n=s,e.setClass("sc-hint",YES));if(u){var M='";e.push(M.fmt(n?" sc-hidden":""))}C="field",l?e.push('"):(S=this.get("type"),this.get("isPassword")&&(S="password"),e.push('")),this.get("shouldRenderInnerBorder")&&e.push('
'),e.push("
")}else{var _=this.$input(),D=_[0],P=this.get("value"),H=this.$(".hint")[0];u&&H?H.innerHTML=s:u||(D.placeholder=s);if(!P||P&&P.length===0)this.get("isPassword")&&(D.type="password"),!SC.platform.input.placeholder&&this._hintON&&(this.get("isFirstResponder")?(e.setClass("sc-hint",NO),_.val("")):(e.setClass("sc-hint",YES),_.val(s)));_.attr("aria-label",o),SC.browser.mobileSafari&&(_.attr("autoCapitalize",d?"true":"off"),_.attr("autoCorrect",p?"true":"off")),!u&&SC.platform.input.placeholder&&_.attr("placeholder",s),v?_.removeAttr("tabindex"):_.attr("tabindex","-1"),T=_[0],T&&(c?h?(T.disabled=null,T.readOnly=null):(T.disabled=null,T.readOnly="true"):(T.disabled="true",T.readOnly=null),N=T.parentNode.style,r?N.left!==r&&(N.left=r):N.left=null,i?N.right!==i&&(N.right=i):N.right=null)}},_getAccessoryViewWidths:function(){var e={},t=["left","right"],n=t.length,r,i,s,o,u,a,f,l;for(r=0;r0||e&&SC.typeOf(e)===SC.T_BOOL?this.$(".hint").addClass("sc-hidden"):this.$(".hint").removeClass("sc-hidden")}.observes("value"),_topOffsetForFirefoxCursorFix:3,_firefox_dispatch_keypress:function(e){var t=this.get("selection"),n=this.get("value"),r=n?n.length:0,i;if(!t||t.get("length")===0&&t.get("start")===0||t.get("end")===r){i=SC.RootResponder.responder;if(e.keyCode===9)return;i.keypress.call(i,e),e.stopPropagation()}},_textField_selectionDidChange:function(){this.notifyPropertyChange("selection")},didBecomeKeyResponderFrom:function(e){if(this.get("isVisibleInWindow")){var t=this.$input()[0];try{t&&t.focus()}catch(n){}this._txtFieldMouseDown|| this.invokeLast(this._selectRootElement)}},_selectRootElement:function(){var e=this.$input()[0];e?(!SC.browser.isSafari||!SC.browser.isLion||SC.buildLocale!=="ko-kr")&&e.select():this._textField_selectionDidChange()},didLoseKeyResponderTo:function(e){var t=this.$input()[0];t&&t.blur(),this.invokeLater("scrollToOriginIfNeeded",100)},scrollToOriginIfNeeded:function(){var e=this.get("pane");if(!e)return;var t=e.get("firstResponder");if(!t||!t.get("isTextField"))document.body.scrollTop=document.body.scrollLeft=0},keyDown:function(e){var t=e.which,n=e.keyCode,r=!1,i,s;if(t===SC.Event.KEY_RETURN&&!e.isIMEInput&&!this.get("isTextArea"))return NO;if(t===SC.Event.KEY_ESC)return NO;if(t!==SC.Event.KEY_TAB&&n!==SC.Event.KEY_TAB||!this.get("defaultTabbingEnabled")){if(!SC.platform.input.maxlength&&this.get("isTextArea")){var o=this.get("value");o&&(!SC.browser.mozilla&&t>47||SC.browser.mozilla&&(t>32&&t<43||t>47)&&!(n>36&&n<41))&&o.length>=this.get("maxLength")&&(r=!0)}(this.performValidateKeyDown(e)||SC.platform.touch)&&!r||SC.isFunctionOrNonPrintableKey(e)?(this._isKeyDown=YES,e.allowDefault()):e.stop();if(this.get("applyImmediately")){var u=this;setTimeout(function(){u.fieldValueDidChange()},10)}else this._field_valueHasChanged=YES;return YES}return s=e.shiftKey?this.get("previousValidKeyView"):this.get("nextValidKeyView"),s?s.becomeFirstResponder():e.allowDefault(),YES},keyUp:function(e){return SC.browser.mozilla&&e.keyCode===SC.Event.KEY_RETURN&&this.fieldValueDidChange(),this.notifyPropertyChange("selection"),this._isKeyDown=NO,e.allowDefault(),YES},mouseDown:function(e){var t=this .get("fieldValue"),n=this.$input();return n&&(n=n[0]),this._txtFieldMouseDown=YES,document.activeElement!==n&&(SC.browser.isIE8OrLower?this.invokeLater(this.becomeFirstResponder,50):this.becomeFirstResponder()),this.get("isEnabled")?e.target!==n?(e.stop(),SC.browser.isIE8OrLower&&setTimeout(function(){n.focus()},0),YES):arguments.callee.base.apply(this,arguments):(e.stop(),YES)},mouseUp:function(e){return this._txtFieldMouseDown=NO,this.notifyPropertyChange("selection"),this.get("isEnabled")?arguments.callee.base.apply(this,arguments):(e.stop(),YES)},doubleClick:function(e){return SC.browser.isIE8OrLower?this.mouseDown(e)|this.mouseUp(e):NO},touchStart:function(e){return this.mouseDown(e)},touchEnd:function(e){return this.mouseUp(e)},mouseWheel:function(e){return this.get("isTextArea")?(e.allowDefault(),YES):NO},selectStart:function(e){return YES},_valueObserver:function(){var e=this.get("value"),t;e&&e.length>0?(this._hintON=NO,t=this.get("maxLength"),!SC.platform.input.maxlength&&e.length>t&&this.set("value",e.substr(0,t))):this.get("hintOnFocus")||(this._hintON=YES)}.observes("value")}),SC.InlineTextFieldView=SC.TextFieldView.extend(SC.InlineEditor,{classNames:["inline-editor"],_topOffsetForFirefoxCursorFix:0,blurOnMouseDown:YES,_updateViewStyle:function(e){var t="",n=SC.getStyle(e,"font-size");return n&&n.length>0&&(t=t+"font-size: "+n+" !important; "),n=SC.getStyle(e,"font-family"),n&&n.length>0&&(t=t+"font-family: "+n+" !important; "),n=SC.getStyle(e,"font-weight"),n&&n.length>0&&(t=t+"font-weight: "+n+" !important; "),n=SC.getStyle(e,"z-index"),n&&n.length>0&&(t=t+"z-index: "+ n+" !important; "),n=SC.getStyle(e,"line-height"),n&&n.length>0&&(t=t+"line-height: "+n+" !important; "),n=SC.getStyle(e,"text-align"),n&&n.length>0&&(t=t+"text-align: "+n+" !important; "),n=SC.getStyle(e,"top-margin"),n&&n.length>0&&(t=t+"top-margin: "+n+" !important; "),n=SC.getStyle(e,"bottom-margin"),n&&n.length>0&&(t=t+"bottom-margin: "+n+" !important; "),n=SC.getStyle(e,"left-margin"),n&&n.length>0&&(t=t+"left-margin: "+n+" !important; "),n=SC.getStyle(e,"right-margin"),n&&n.length>0&&(t=t+"right-margin: "+n+" !important; "),t},_updateViewPaddingStyle:function(e){var t="",n=SC.getStyle(e,"padding-top");return n&&n.length>0&&(t=t+"top: "+n+" !important; "),n=SC.getStyle(e,"padding-bottom"),n&&n.length>0&&(t=t+"bottom: "+n+" !important; "),n=SC.getStyle(e,"padding-left"),n&&n.length>0&&(t=t+"left: "+n+" !important; "),n=SC.getStyle(e,"padding-right"),n&&n.length>0&&(t=t+"right: "+n+" !important; "),t},updateStyle:function(e){e.length&&(e=e[0]);var t=document.getElementById("sc-inline-text-field-style"),n=this._updateViewStyle(e),r=this._updateViewPaddingStyle(e),i=".inline-editor input{"+n+"}"+".inline-editor textarea{"+n+"}"+".inline-editor .padding{"+r+"}";if(!t){var s=document.getElementsByTagName("head")[0];t=document.createElement("style"),t.type="text/css",t.media="screen",t.id="sc-inline-text-field-style",s.appendChild(t)}t.styleSheet?t.styleSheet.cssText=i:t.innerHTML=i},positionOverTargetView:function(e,t,n,r,i){n||(n=e.get("pane")),i||(i=e.$()[0]);if(!r){var s=e.get("frame");r=SC.offset(i),r.height=s.height,r.width=s.width}var o={},u=n.$()[0],a=e.get("layout"); o.height=r.height,o.width=r.width,t&&a.left?(o.left=r.x-a.left-u.offsetLeft-1,SC.browser.msie==7&&o.left--):(o.left=r.x-u.offsetLeft-1,SC.browser.msie==7&&o.left--),t&&a.top?(o.top=r.y-a.top-u.offsetTop,SC.browser.msie==7&&(o.top=o.top-2)):(o.top=r.y-u.offsetTop,SC.browser.msie==7&&(o.top=o.top-2)),this.set("layout",o)},multiline:NO,isTextArea:function(){return this.get("multiline")}.property("multiline").cacheable(),beginEditing:function(e,t){if(!e(t))return NO;var n=t.get("pane"),r=this.get("exampleElement");return this.beginPropertyChanges(),r?r.length&&(r=r[0]):r=t.$()[0],this.updateStyle(r),this.positionOverTargetView(t,this.get("isCollection"),n,this.get("exampleFrame"),r),this._previousFirstResponder=n?n.get("firstResponder"):null,this.becomeFirstResponder(),this.endPropertyChanges(),YES}.enhance(),blurEditor:function(e){return this.get("isEditing")?this.commitOnBlur?this.commitEditing():this.discardEditing():YES},_endEditing:function(e){var t=e();if(this.get("isFirstResponder")){var n=this.get("pane");n&&this._previousFirstResponder?n.makeFirstResponder(this._previousFirstResponder):this.resignFirstResponder()}return this._previousFirstResponder=null,t}.enhance(),mouseDown:function(e){return arguments.callee.base.call(this,e),this.get("isEditing")},touchStart:function(e){this.mouseDown(e)},keyDown:function(e){if(e.isIMEInput===!0&&e.which===13)return!0;var t=this.interpretKeyEvents(e);return this.fieldValueDidChange(!0),t?t:NO},insertText:null,_scitf_blurInput:function(){var e=this.$input()[0];e&&e.blur(),e=null},willRemoveFromParent:function(){return this._scitf_blurInput ()},willLoseFirstResponder:function(e,t){if(e!==this)return;return this._previousFirstResponder=null,this._origEvent=t,this._scitf_blurInput(),this.blurEditor(t)},cancel:function(){return this.discardEditing(),YES},fieldValueDidChange:function(e){arguments.callee.base.call(this,e)},insertNewline:function(e){return this.get("isTextArea")?(e.allowDefault(),arguments.callee.base.call(this,e)):(this.get("value")!=this.$input().val()&&this.set("value",this.$input().val()),this.commitEditing(),YES)},insertTab:function(e){var t=this.target;this.resignFirstResponder(),this.commitEditing();if(t){var n=t.get("nextValidKeyView");n&&n.beginEditing&&n.beginEditing()}return YES},insertBacktab:function(e){var t=this.target;this.resignFirstResponder(),this.commitEditing();if(t){var n=t.get("previousValidKeyView");n&&n.beginEditing&&n.beginEditing()}return YES},deleteForward:function(e){return e.allowDefault(),YES},deleteBackward:function(e){return e.allowDefault(),YES}}),SC.mixin(SC.InlineTextFieldView,{inlineEditorDelegate:SC.InlineTextFieldDelegate,label:null,editor:null,beginEditing:function(e){var t,n,r,i,s;if(SC.typeOf(e)===SC.T_HASH){r=e;if(!r.delegate||!r.exampleElement||!r.frame)return SC.error("Delegate, exampleElement, and frame options are required."),NO;e=r.delegate,i=r.value}else i=e.get("value");return s=SC.beget(e),s.mixin({inlineEditorWillBeginEditing:function(){e.inlineEditorWillBeginEditing&&e.inlineEditorWillBeginEditing.apply(e,arguments)},inlineEditorDidBeginEditing:function(){e.inlineEditorDidBeginEditing&&e.inlineEditorDidBeginEditing.apply(e,arguments)},inlineEditorWillCommitEditing :function(t,n,r){e.inlineEditorWillCommitEditing&&e.inlineEditorWillCommitEditing(t,n,r),e.inlineEditorWillEndEditing&&e.inlineEditorWillEndEditing(t,n)},inlineEditorDidCommitEditing:function(t,n,r){e.inlineEditorDidCommitEditing&&e.inlineEditorDidCommitEditing(t,n,r),e.inlineEditorDidEndEditing&&e.inlineEditorDidEndEditing(t,n),SC.InlineTextFieldView._endEditing()},inlineEditorWillDiscardEditing:function(t,n){e.inlineEditorWillDiscardEditing&&e.inlineEditorWillDiscardEditing(t,n),e.inlineEditorWillEndEditing&&e.inlineEditorWillEndEditing(t,this.get("value"))},inlineEditorDidDiscardEditing:function(t,n){e.inlineEditorDidDiscardEditing&&e.inlineEditorDidDiscardEditing(t,n),e.inlineEditorDidEndEditing&&e.inlineEditorDidEndEditing(t,this.get("value")),SC.InlineTextFieldView._endEditing()}}),e.inlineEditorShouldBeginEditing&&!e.inlineEditorShouldBeginEditing(e,i)?NO:(this.editor=n=this.inlineEditorDelegate.acquireEditor(e),n.set("value",i),r&&(n.set("exampleElement",r.exampleElement),n.set("exampleFrame",r.frame),n.set("multiline",r.multiline),n.set("escapeHTML",r.escapeHTML),n.set("isCollection",r.isCollection),n.set("commitOnBLur",r.commitOnBlur),n.set("validator",r.validator)),n?n.beginEditing(s):NO)},commitEditing:function(){return this.inlineEditorDelegate.editor?this.inlineEditorDelegate.editor.commitEditing():NO},discardEditing:function(){return this.inlineEditorDelegate.editor?this.inlineEditorDelegate.editor.discardEditing():NO},_endEditing:function(){this.inlineEditorDelegate.releaseEditor(this.editor),this.editor=null}}),SC.REGULAR_WEIGHT="normal",SC.BOLD_WEIGHT="bold" ,SC.LabelView=SC.View.extend(SC.Control,SC.InlineEditable,{classNames:["sc-label-view"],displayProperties:["displayTitle","textAlign","fontWeight","icon","escapeHTML","needsEllipsis","hint"],inlineEditorDelegate:SC.InlineTextFieldDelegate,isEditable:NO,exampleEditor:SC.InlineTextFieldView,fontWeight:null,escapeHTML:YES,escapeHTMLBindingDefault:SC.Binding.oneWay().bool(),localize:NO,localizeBindingDefault:SC.Binding.oneWay().bool(),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",10),renderDelegateName:"labelRenderDelegate",displayTitle:function(){var e,t;e=this.get("value"),t=this.getDelegateProperty("formatter",this.displayDelegate);if(t){var n=SC.typeOf(t)===SC.T_FUNCTION?t(e,this):t.fieldValueForObject(e,this);SC.none(n)||(e=n)}if(SC.typeOf(e)===SC.T_ARRAY){var r=[];for(var i=0,s=e.get("length");ithis.get("innerFrame").height}.property("scrollFrame"),hasHorizontalScroller:function(){return this.get("scrollFrame").width>this.get("innerFrame").width}.property("scrollFrame"),scrollBy:function(e){var t=this.get("scrollFrame"),n=this.get("innerFrame");this.get("hasVerticalScroller")||(e.y=0),t.height<=n.height&&(e.y=0),this.get("hasHorizontalScroller")||(e.x=0),t.width<=n.width&&(e.x=0);var r={x:t.x-(e.x||0),y:t.y-(e.y||0)};return this.set("scrollFrame",r),r=this.get("scrollFrame"),{x:r.x-t.x,y:r.y-t.y}},scrollTo:function(e,t){this.set("scrollFrame",{x:0-e,y:0-t})},scrollToVisible:function(e){var t=this.get("innerFrame"),n=this.get("scrollFrame"),r=this.convertFrameFromView(e.get("frame"),e);r.x-=t.x+n.x,r.y-=t.y+n.y;var i={x:0-n.x,y:0-n.y,width:t.width,height:t.height};i.y-=Math.max(0,SC.minY(i)-SC.minY(r)),i.x-=Math.max(0,SC.minX(i)-SC.minX(r)),i.y+=Math.max(0,SC.maxY(r)-SC.maxY(i)),i.x+=Math.max(0,SC.maxX(r)-SC.maxX(i)),this.scrollTo(i.x,i.y)},scrollDownLine:function(e){return e===undefined&&(e=1),this.scrollBy({y:this.get("verticalLineScroll")*e}).y},scrollUpLine:function(e){return e===undefined&&(e=1),0-this.scrollBy({y:0-this.get("verticalLineScroll")*e}).y},scrollRightLine:function( e){return e===undefined&&(e=1),this.scrollTo({y:this.get("horizontalLineScroll")*e}).x},scrollLeftLine:function(e){return e===undefined&&(e=1),0-this.scrollTo({y:0-this.get("horizontalLineScroll")*e}).x},scrollDownPage:function(e){return e===undefined&&(e=1),this.scrollBy({y:this.get("verticalPageScroll")*e}).y},scrollUpPage:function(e){return e===undefined&&(e=1),0-this.scrollBy({y:0-this.get("verticalPageScroll")*e}).y},scrollRightPage:function(e){return e===undefined&&(e=1),this.scrollTo({y:this.get("horizontalPageScroll")*e}).x},scrollLeftPage:function(e){return e===undefined&&(e=1),0-this.scrollTo({y:0-this.get("horizontalPageScroll")*e}).x}},SC.ModalPane=SC.Pane.extend({classNames:"sc-modal",_openPaneCount:0,paneWillAppend:function(e){var t,n=SC.RootResponder.responder.panes;this._openPaneCount++,this.get("isVisibleInWindow")||this.append();for(var r=0,i=n.length;r'+e.split("\n").join('

')+"

")}.property("description").cacheable(),caption:"",displayCaption:function(){var e=this.get("caption");return!e||e.length===0?e:(e=SC.RenderContext.escapeHTML(e),'

'+e.split("\n").join('

')+"

")}.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:.3,centerX:0,width:500},contentView:SC.View.extend({useStaticLayout:YES,layout:{left:0,right:0,top:0,height:"auto"},childViews:[SC.View.extend(SC.StaticLayout,{classNames:["info"],render:function(e,t){var n=this.get("pane");n.get("icon")=="blank"&&e.addClass("plain" ),e.push(''),e.begin("h1").attr("class","header").text(n.get("message")||"").end(),e.push(n.get("displayDescription")||""),e.push(n.get("displayCaption")||""),e.push('
')}}),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(e){var t=this.delegate,n,r,i;t&&t.alertPaneDidDismiss&&t.alertPaneDidDismiss(this,e.get("actionKey"));if(r=e&&e.get("customAction"))SC.typeOf(r)===SC.T_FUNCTION?r.call(r):(n=this.getPath("pane.rootResponder"),n&&(i=e.get("target"),n.sendAction(r,i||t,this,this,null,this)));this.remove()},alertInfoDidChange:function(){var e=this.getPath("contentView.childViews.0");e&&e.displayDidChange()}.observes("icon","message","displayDescription","displayCaption")}),SC.AlertPane.mixin({show:function(e){e=SC.AlertPane._argumentsCall.apply(this,arguments) ;var t=this.create(e),n=0,r=e.buttons,i,s,o,u,a;r?r.forEach(function(r){n++;if(!r)return;i=t.get("button%@".fmt(n)),s=r.title,o=r.action,u=r.target,a=e.themeName||"capsule",i.set("title".fmt(n),s),o&&i.set("customAction".fmt(n),o),u&&i.set("target".fmt(n),u),i.set("isVisible",!!s),i.set("themeName",a)}):(i=t.get("button1"),i.set("title","OK"),i.set("isVisible",YES));var f=t.append();return t.adjust("height",t.childViews[0].$().height()),t.updateLayout(),f},warn:function(e){return e=SC.AlertPane._argumentsCall.apply(this,arguments),e.icon="sc-icon-alert-48",this.show(e)},info:function(e){return e=SC.AlertPane._argumentsCall.apply(this,arguments),e.icon="sc-icon-info-48",this.show(e)},error:function(e){return e=SC.AlertPane._argumentsCall.apply(this,arguments),e.icon="sc-icon-error-48",this.show(e)},plain:function(e){return e=SC.AlertPane._argumentsCall.apply(this,arguments),e.icon="blank",this.show(e)},_argumentsCall:function(e){var t=e;if(SC.typeOf(e)!==SC.T_HASH){var n=this._normalizeArguments(arguments);t={message:n[0],description:n[1],caption:n[2],delegate:n[7],icon:n[6]||"sc-icon-alert-48",themeName:"capsule"};if(SC.typeOf(n[3])===SC.T_STRING||SC.typeOf(n[4])===SC.T_STRING||SC.typeOf(n[5])===SC.T_STRING)t.buttons=[{title:n[3]},{title:n[4]},{title:n[5]}]}return t},_normalizeArguments:function(e){e=SC.A(e);var t=e.length,n=e[t-1];return SC.typeOf(n)!==SC.T_STRING?e[t-1]=null:n=null,e[7]=n,e}}),SC.PalettePane=SC.PanelPane.extend({classNames:["sc-palette"],isModal:NO,modalPane:SC.ModalPane,isAnchored:NO,_mouseOffsetX:null,_mouseOffsetY:null,mouseDown:function(e){var t=this.get ("frame");return this._mouseOffsetX=t?t.x-e.pageX:0,this._mouseOffsetY=t?t.y-e.pageY:0,YES},mouseDragged:function(e){return this.isAnchored||(this.set("layout",{width:this.layout.width,height:this.layout.height,left:this._mouseOffsetX+e.pageX,top:this._mouseOffsetY+e.pageY}),this.updateLayout()),YES},touchStart:function(e){return this.mouseDown(e)},touchesDragged:function(e){return this.mouseDragged(e)}}),SC.PICKER_MENU="menu",SC.PICKER_FIXED="fixed",SC.PICKER_POINTER="pointer",SC.PICKER_MENU_POINTER="menu-pointer",SC.POINTER_LAYOUT=["perfectRight","perfectLeft","perfectTop","perfectBottom"],SC.PickerPane=SC.PalettePane.extend({classNames:["sc-picker"],isAnchored:YES,isModal:YES,pointerPos:"perfectRight",pointerPosX:0,pointerPosY:0,anchorElement:null,anchorCached:null,preferType:null,preferMatrix:null,pointerOffset:null,extraRightOffset:0,removeTarget:null,removeAction:null,repositionOnWindowResize:YES,_anchorView:null,_anchorHTMLElement:null,popup:function(e,t,n,r){return e&&(e.isView?(this._anchorView=e,this._anchorHTMLElement=null,this._setupScrollObservers(e)):(this._anchorHTMLElement=e,this._anchorView=null)),this.beginPropertyChanges(),t&&this.set("preferType",t),n&&this.set("preferMatrix",n),r&&this.set("pointerOffset",r),this.endPropertyChanges(),this.positionPane(),this._hideOverflow(),this.append()},positionPane:function(e){e=e&&this.get("anchorCached");var t=e?this.get("anchorCached"):this.get("anchorElement"),n=this.get("preferType"),r=this.get("preferMatrix"),i=this.get("layout"),s;if(t){e||(t=this.computeAnchorRect(t),this.set("anchorCached",t));if(t.x===0&&t.y===0 )return;s=SC.cloneRect(t);if(n)switch(n){case SC.PICKER_MENU:case SC.PICKER_FIXED:(!r||r.length!==3)&&this.set("preferMatrix",[1,4,3]),s.x+=(this.preferMatrix[2]===0?s.width:0)+this.preferMatrix[0],s.y+=(this.preferMatrix[2]===3?s.height:0)+this.preferMatrix[1];break;default:s.y+=s.height}else s.y+=s.height;s=this.fitPositionToScreen(s,this.get("frame"),t),this.adjust({width:s.width,height:s.height,left:s.x,top:s.y})}else this.adjust({width:i.width,height:i.height,centerX:0,centerY:0});return this.updateLayout(),this},computeAnchorRect:function(e){var t,n,r,i=SC.RootResponder.responder.computeWindowSize();if(e.getBoundingClientRect){if(SC.browser.isIE)try{t=e.getBoundingClientRect()}catch(s){t={left:0,top:0,width:0,height:0}}else t=e.getBoundingClientRect();n={x:t.left,y:t.top,width:t.width,height:t.height};if(n.width===undefined||n.height===undefined)r=SC.$(e),n.width=r.outerWidth(),n.height=r.outerHeight()}else n=SC.offset(e),r=SC.$(e),n.width=r.outerWidth(),n.height=r.outerHeight();return n.height=i.height-n.y0||window.scrollY>0?(n.x+=window.scrollX,n.y+=window.scrollY):SC.browser.msie&&(document.documentElement.scrollTop>0||document.documentElement.scrollLeft>0)&&(n.x+=document.documentElement.scrollLeft,n.y+=document.documentElement.scrollTop),n},fitPositionToScreen:function(e,t,n){var r=SC.RootResponder.responder.computeWindowSize(),i={x:0,y:0,width:r.width,height:r.height},s=SC.RootResponder.responder.mainPane;if(s){var o=s.layout.minWidth,u=s.layout.minHeight;o&&i.widthe.width){var r=Math.max(SC.maxX(n),t.width);t.x=Math.min(r,e.width)-t.width}return SC.minX(t)<0&&(t.x=SC.minX(Math.max(n,0)),SC.maxX(t)>e.width&&(t.x=Math.max(0,e.width-t.width))),SC.maxY(t)>e.height&&(r=Math.max(n.y-t.height,0),r>e.height?t.y=Math.max(0,e.height-t.height):t.y=r),SC.minY(t)<0&&(r=Math.min(SC.maxY(n),e.height-n.height),t.y=Math.max(r,0)),t},fitPositionToScreenMenu:function(e,t,n){return n&&(t.x-=this.get("submenuOffsetX"),t.y-=Math.floor(this.get("menuHeightPadding")/2)),SC.Locale.getPath("currentLocale.isRTL")&&(t.x=t.x-t.width),t.x+t.width>e.width-20&&(n?t.x=t.x-t.width*2:t.x=e.width-t.width-20),t.x<7&&(t.x=7),t.y<7&&(t.height+=t.y,t.y=7),t.height+t.y+35>=e.height&&(t.height+50>=e.height?(t.y=SC.MenuPane.VERTICAL_OFFSET,t.height=e.height-SC.MenuPane.VERTICAL_OFFSET*2):t.y+=e.height-(t.height+t.y+35)),t},fitPositionToScreenMenuPointer:function(e,t,n){return t=this.fitPositionToScreenPointer(e,t,n),t.y>=0&&t.height+t.y+35>=e.height&&(t.height=e.height-t.y-SC.MenuPane.VERTICAL_OFFSET*2),t.y<0&&t.height>=e.height&&(t.y=SC. MenuPane.VERTICAL_OFFSET,t.height=e.height-SC.MenuPane.VERTICAL_OFFSET*2,this.set("pointerPosY",n.y-t.y-26)),t},fitPositionToScreenPointer:function(e,t,n){var r=[this.pointerOffset[0],this.pointerOffset[1],this.pointerOffset[2],this.pointerOffset[3]],i=[[n.x+n.width+r[0],n.y+parseInt(n.height/2,0)-40],[n.x-t.width+r[1],n.y+parseInt(n.height/2,0)-40],[n.x+parseInt(n.width/2-t.width/2,0),n.y-t.height+r[2]],[n.x+parseInt(n.width/2-t.width/2,0),n.y+n.height+r[3]]],s=[[n.x+n.width+t.width+r[0],n.y+parseInt(n.height/2,0)+t.height-24],[n.x+r[1],n.y+parseInt(n.height/2,0)+t.height-24],[n.x+parseInt(n.width/2-t.width/2,0)+t.width,n.y+r[2]],[n.x+parseInt(n.width/2-t.width/2,0)+t.width,n.y+n.height+t.height+r[3]]],o=[[i[0][1]>0?0:0-i[0][1],s[0][0]0?0:0-i[0][0]],[i[1][1]>0?0:0-i[1][1],s[1][0]0?0:0-i[1][0]],[i[2][1]>0?0:0-i[2][1],s[2][0]0?0:0-i[2][0]],[i[3][1]>0?0:0-i[3][1],s[3][0]0?0:0-i[3][0]]],u=this.preferMatrix;u[4]===-1?(t.x=n.x+parseInt(n.width/2,0),t.y=n.y+parseInt(n.height/2,0)-parseInt(t.height/2,0),this.set("pointerPos",SC.POINTER_LAYOUT[0]+" fallback"),this.set("pointerPosY",parseInt(t.height/2,0)-40)):(t.x=i[u[4]][0],t.y=i[u[4]][1],this.set("pointerPos",SC.POINTER_LAYOUT[u[4]]),this.set("pointerPosY",0)),this.set("pointerPosX",0);for(var a=0,f,l=SC.POINTER_LAYOUT.length;a=n&&i.height>=r&&SC.bodyOverflowArbitrator.requestHidden(this)},_withdrawOverflowRequest:function(){SC.bodyOverflowArbitrator.withdrawRequest(this)},_getScrollViewOfView:function(e){var t=e;while(YES){if(!t)return null;if(t.isScrollable)return t;t=t.get("parentView")}},_setupScrollObservers:function(e){var t=this._getScrollViewOfView(e);t&&(t.addObserver("horizontalScrollOffset",this,this._scrollOffsetDidChange),t.addObserver("verticalScrollOffset",this,this._scrollOffsetDidChange),this._scrollView=t)},_removeScrollObservers:function(){var e=this._scrollView;e&&(e.removeObserver("horizontalScrollOffset",this,this._scrollOffsetDidChange),e.removeObserver("verticalScrollOffset",this,this._scrollOffsetDidChange))},_scrollOffsetDidChange:function(){this.positionPane()}}),SC.PickerPane.PICKER_POINTER_OFFSET=[9,-9,-18,18],SC.PickerPane.PICKER_EXTRA_RIGHT_OFFSET=20,SC.PickerPane.TINY_PICKER_MENU_POINTER_OFFSET= [9,-9,-14,14],SC.PickerPane.TINY_PICKER_MENU_EXTRA_RIGHT_OFFSET=12,SC.PickerPane.SMALL_PICKER_MENU_POINTER_OFFSET=[9,-9,-4,4],SC.PickerPane.SMALL_PICKER_MENU_EXTRA_RIGHT_OFFSET=11,SC.PickerPane.REGULAR_PICKER_MENU_POINTER_OFFSET=[9,-9,-8,8],SC.PickerPane.REGULAR_PICKER_MENU_EXTRA_RIGHT_OFFSET=12,SC.PickerPane.LARGE_PICKER_MENU_POINTER_OFFSET=[9,-9,-12,12],SC.PickerPane.LARGE_PICKER_MENU_EXTRA_RIGHT_OFFSET=17,SC.PickerPane.HUGE_PICKER_MENU_POINTER_OFFSET=[9,-9,-14,14],SC.PickerPane.HUGE_PICKER_MENU_EXTRA_RIGHT_OFFSET=12,SC.SeparatorView=SC.View.extend({classNames:["sc-separator-view"],tagName:"span",layoutDirection:SC.LAYOUT_HORIZONTAL,render:function(e,t){t&&e.push(""),e.addClass(this.get("layoutDirection"))}}),SC.MenuItemView=SC.View.extend(SC.ContentDisplay,{classNames:["sc-menu-item"],displayProperties:["title","isEnabled","isSeparator","isChecked"],ariaRole:"menuitem",escapeHTML:YES,acceptsFirstResponder:YES,blocksIEDeactivate:YES,isContextMenuEnabled:NO,content:null,isSeparator:function(){return this.getContentProperty("itemSeparatorKey")===YES}.property("content").cacheable(),isEnabled:function(){return this.getContentProperty("itemIsEnabledKey")!==NO&&this.getContentProperty("itemSeparatorKey")!==YES}.property("content.isEnabled").cacheable(),isChecked:function(){return this.getContentProperty("itemCheckboxKey")}.property(),subMenu:function(){var e=this.get("content"),t,n;return e?(n=this.get("parentMenu"),t=e.get(n.itemSubMenuKey),t?SC.kindOf(t,SC.MenuPane)?(t.set("isModal",NO),t.set("isSubMenu",YES),t.set("parentMenu",n),t):SC.MenuPane.create({layout:{width :200},items:t,isModal:NO,isSubMenu:YES,parentMenu:n,controlSize:n.get("controlSize"),exampleView:n.get("exampleView")}):null):null}.property("content").cacheable(),hasSubMenu:function(){return!!this.get("subMenu")}.property("subMenu").cacheable(),init:function(){arguments.callee.base.apply(this,arguments),this.contentDidChange()},render:function(e,t){var n=this.get("content"),r,i,s=this.get("parentMenu"),o=this.get("itemWidth")||s.layout.width,u=this.get("itemHeight")||SC.DEFAULT_MENU_ITEM_HEIGHT;this.set("itemWidth",o),this.set("itemHeight",u),this.get("isSeparator")?e.attr("role","separator"):this.get("isChecked")&&(e.attr("role","menuitemcheckbox"),e.attr("aria-checked",!0)),e=e.begin("a").addClass("menu-item"),this.get("isSeparator")?(e.push(''),e.addClass("disabled")):(i=n.get(s.itemIconKey),i&&(this.renderImage(e,i),e.addClass("has-icon")),i=this.get("title"),SC.typeOf(i)!==SC.T_STRING&&(i=i.toString()),this.renderLabel(e,i),this.get("isChecked")&&e.push('
'),this.get("hasSubMenu")&&this.renderBranch(e),i=this.getContentProperty("itemShortCutKey"),i&&this.renderShortcut(e,i)),e=e.end()},renderImage:function(e,t){var n,r;t&&SC.ImageView.valueIsUrl(t)?(n=t,r=""):(r=t,n=SC.BLANK_IMAGE_URL),e.begin("img").addClass("image").addClass(r).attr("src",n).end()},renderLabel:function(e,t){this.get("escapeHTML")&&(t=SC.RenderContext.escapeHTML(t)),e.push(""+t+"")},renderBranch:function(e){e.push('')},renderShortcut:function(e,t){e.push(''+ t+"")},showSubMenu:function(){var e=this.get("subMenu");e&&(e.set("mouseHasEntered",NO),e.popup(this,[0,0,0])),this._subMenuTimer=null},title:function(){var e=this.getContentProperty("itemTitleKey"),t=this.getPath("parentMenu.localize");return t&&e&&(e=SC.String.loc(e)),e||""}.property("content.title").cacheable(),getContentProperty:function(e){var t=this.get("content"),n=this.get("parentMenu");if(t)return t.get(n.get(e))},mouseUp:function(e){var t;return t=this.getPath("parentMenu.rootMenu.targetMenuItem"),t&&t.performAction(),YES},performAction:function(){if(!this.get("isEnabled"))return this.getPath("parentMenu.rootMenu").remove(),YES;if(this.get("hasSubMenu"))return NO;var e=this.getContentProperty("itemDisableMenuFlashKey"),t;return e?this.sendAction():(this._flashCounter=0,t=this.getPath("parentMenu.rootMenu"),t._isFlashing=YES,this.invokeLater(this.flashHighlight,25),this.invokeLater(this.sendAction,150)),YES},sendAction:function(){var e=this.getContentProperty("itemActionKey"),t=this.getContentProperty("itemTargetKey"),n=this.getPath("parentMenu.rootMenu"),r;this.getPath("parentMenu.rootMenu").remove(),n._isFlashing=NO,e=e===undefined?n.get("action"):e,t=t===undefined?n.get("target"):t,n.set("selectedItem",this.get("content")),SC.typeOf(e)===SC.T_FUNCTION?e.apply(t,[n]):(r=this.getPath("pane.rootResponder")||SC.RootResponder.responder,r&&r.sendAction(e,t,n))},flashHighlight:function(){var e=this._flashCounter,t=this.$();e%2===0?t.addClass("focus"):t.removeClass("focus"),e<=2&&(this.invokeLater(this.flashHighlight,50),this._flashCounter++)},mouseDown:function(e ){if(!this.get("mouseHasEntered")){var t=this.get("parentMenu");t.set("mouseHasEntered",YES),this.set("mouseHasEntered",YES),t.set("currentMenuItem",this),this.get("isEnabled")&&this.becomeFirstResponder(),this.get("hasSubMenu")&&(this._subMenuTimer=this.invokeLater(this.showSubMenu,100))}return YES},mouseEntered:function(e){var t=this.get("parentMenu"),n=t.get("rootMenu");if(n._isFlashing)return;return t.set("mouseHasEntered",YES),this.set("mouseHasEntered",YES),t.set("currentMenuItem",this),this.get("isEnabled")&&this.becomeFirstResponder(),this.get("hasSubMenu")&&(this._subMenuTimer=this.invokeLater(this.showSubMenu,100)),YES},mouseExited:function(e){var t,n;return this.get("hasSubMenu")?(n=this._subMenuTimer,n?n.invalidate():this.invokeLater(this.checkMouseLocation,100)):(t=this.get("parentMenu"),t.get("currentMenuItem")===this&&t.set("currentMenuItem",null)),YES},touchStart:function(e){return this.mouseEntered(e),YES},touchEnd:function(e){return this.mouseUp(e)},touchEntered:function(e){return this.mouseEntered(e)},touchExited:function(e){return this.mouseExited(e)},checkMouseLocation:function(){var e=this.get("subMenu"),t=this.get("parentMenu"),n,r;if(!e.get("mouseHasEntered")){n=t.get("currentMenuItem");if(n===this||n===null)r=t.get("previousMenuItem"),r&&r.resignFirstResponder(),this.resignFirstResponder(),e.remove()}},moveUp:function(e,t){var n=this.get("parentMenu");return n&&n.moveUp(this),YES},moveDown:function(e,t){var n=this.get("parentMenu");return n&&n.moveDown(this),YES},moveRight:function(e,t){return this.showSubMenu(),YES},insertText:function(e,t){var n=this .get("parentMenu");n&&n.insertText(e,t)},keyDown:function(e){return this.interpretKeyEvents(e)},keyUp:function(e){return YES},cancel:function(e){return this.getPath("parentMenu.rootMenu").remove(),YES},didBecomeFirstResponder:function(e){if(e!==this)return;var t=this.get("parentMenu");t&&t.set("currentSelectedMenuItem",this)},willLoseFirstResponder:function(e){if(e!==this)return;var t=this.get("parentMenu");t&&(t.set("currentSelectedMenuItem",null),t.set("previousSelectedMenuItem",this))},insertNewline:function(e,t){this.mouseUp(t)},closeParent:function(){this.$().removeClass("focus");var e=this.get("parentMenu");e&&e.remove()},clickInside:function(e,t){return SC.pointInRect({x:t.pageX,y:t.pageY},e)},contentDidChange:function(){var e=this.get("content"),t=this._content;if(e===t)return;var n=this.contentPropertyDidChange;t&&t.removeObserver&&t.removeObserver("*",this,n),this._content=e,e&&e.addObserver&&e.addObserver("*",this,n),this.contentPropertyDidChange(e,"*")}.observes("content"),contentPropertyDidChange:function(e,t){var n=this.get("parentMenu");if(!n)return;var r=SC.MenuItemView._contentPropertyToMenuItemPropertyMapping,i=SC.keys(r),s,o,u,a;if(t==="*")for(s=0,o=i.length;s=0){if(t[i].get("isEnabled")){this.set("currentMenuItem",t[i]),t[i].becomeFirstResponder();break}i--}return YES},moveDown:function(){var e=this.get("currentMenuItem"),t=this.get("menuItemViews"),n=t.get("length"),r,i,s;if(!e)s=0;else{r=e.getPath("content.contentIndex");if(r===n)return YES;s=r+1}while(s=1?(this._complete(),this):(o=Math.floor(i.height*t),r==SC.SheetPane.SLIDE_DOWN?n.adjust("top",0-(i.height-o)):r==SC.SheetPane.SLIDE_UP&&n.adjust("top",0-o),this._timer=this.invokeLater(this.tick,20),n.updateLayout(),this)}}),SC .SheetPane.mixin({ANIMATABLE_AVAILABLE:NO,NO_VIEW:"NO_VIEW",ANIMATING:"ANIMATING",READY:"READY",SLIDE_DOWN:"SLIDEDOWN",SLIDE_UP:"SLIDEUP"}),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(e,t){this.addSizeClassName(e,t);var n,r=e.get("toolTip"),i=e.get("value"),s=e.get("isSelected")||NO,o=e.get("isActive")||NO,u=e.get("isDefault")||NO,a=e.get("isCancel")||NO,f=e.get("isToggle")||NO,l=SC.guidFor(e)+"-label",c=e.get("isBorderless")||NO;t.setClass({icon:!!e.get("icon"),def:u,cancel:a&&!u,active:o,sel:s}),r&&(t.attr("title",r),t.attr("alt",r)),c||this.includeSlices(e,t,SC.THREE_SLICE),e.get("isSegment")?t.attr("aria-selected",s.toString()):f&&t.attr("aria-pressed",o.toString()),i?t.attr("aria-labelledby",l):r?t.attr("aria-label",r):t.attr("aria-label",e.get("displayTitle")),t=t.begin("label").addClass("sc-button-label").id(l),e.get("theme").labelRenderDelegate.render(e,t),t=t.end(),e.get("supportFocusRing")&&(t=t.begin("div").addClass("focus-ring"),this.includeSlices(e,t,SC.THREE_SLICE),t=t.end())},update:function(e,t){var n=e.get("buttonBehavior")===SC.TOGGLE_BEHAVIOR;this.updateSizeClassName(e,t),e.get("isActive")&&t.addClass("active");var r=e.get("isDefault"),i=e.get("isCancel");e.get("isSegment")?t.attr("aria-selected",e.get("isSelected").toString()):n&&t.attr("aria-pressed" ,e.get("isActive").toString());var s=e.get("toolTip");t.attr("title",s),t.attr("aria-label",s),t.setClass("icon",!!e.get("icon")),t.setClass("def",!!r),t.setClass("cancel",!!i&&!r),e.get("theme").labelRenderDelegate.update(e,t.find("label"))},getRenderedAutoResizeLayer:function(e,t){return t.find(".sc-button-label")[0]}}),SC.BaseTheme.checkboxRenderDelegate=SC.RenderDelegate.create({className:"checkbox",render:function(e,t){this.addSizeClassName(e,t);var n=e.get("theme"),r,i;i=SC.guidFor(e)+"-label";var s=e.get("isSelected")||NO,o=e.get("isActive"),u=!e.get("isEnabled"),a;s===SC.MIXED_STATE?a="mixed":s?a="true":a="false",t.attr("role","checkbox"),t.attr("aria-checked",a),t.attr("aria-labelledby",i),t.setClass({sel:s,active:o,disabled:u}),t.push(''),t=t.begin("span").addClass("label").id(i),n.labelRenderDelegate.render(e,t),t=t.end()},update:function(e,t){this.updateSizeClassName(e,t);var n=e.get("theme"),r=e.get("isSelected"),i=e.get("isActive"),s=!e.get("isEnabled"),o;r===SC.MIXED_STATE?o="mixed":r?o="true":o="false",t.attr("aria-checked",o),n.labelRenderDelegate.update(e,t.find("span.label")),t.setClass({sel:r,active:i,disabled:s})},isEventWithinActiveArea:function(e,t){var n=t.target||t.srcElement,r=n===e.$(".button")[0]||n===e.$(".label")[0];return!r&&document.activeElement===e.$()[0]&&t.pageX===0&&t.pageY===0&&(r=!0),n&&r}}),SC.BaseTheme.collectionRenderDelegate=SC.RenderDelegate.create({className:"collection",render:function(e,t){t.setClass("focus",e.get("hasFirstResponder")),t.setClass("disabled",!e.get("isEnabled")),t.setClass("active",e .get("isActive"))},update:function(e,t){t.setClass("focus",e.get("hasFirstResponder")),t.setClass("disabled",!e.get("isEnabled")),t.setClass("active",e.get("isActive"))}}),SC.BaseTheme.disclosureRenderDelegate=SC.RenderDelegate.create({className:"disclosure",render:function(e,t){this.addSizeClassName(e,t);var n=e.get("theme"),r=e.get("value"),i=e.get("title"),s=SC.guidFor(e)+"-label",o=r?"true":"false";t.attr("role","disclosure checkbox"),t.attr("aria-labelledby",s),t.attr("aria-checked",o),e.get("isSelected")&&t.addClass("sel");var u="";u+=e.get("isSelected")?"open":"closed",e.get("isActive")&&(u+=" active"),t.push(''),t=t.begin("span").addClass("sc-button-label").id(s),n.labelRenderDelegate.render(e,t),t=t.end()},update:function(e,t){this.updateSizeClassName(e,t);var n=e.get("theme"),r=e.get("value"),i=e.get("title"),s=r?"true":"false";t.attr("role","disclosure checkbox"),t.attr("aria-checked",s),e.get("isSelected")&&t.addClass("sel"),t.find("img").setClass({open:e.get("isSelected"),closed:!e.get("isSelected"),active:e.get("isActive")}),n.labelRenderDelegate.update(e,t.find("span.sc-button-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,t,n){for(var r=0,i=n.length;r')}}),SC.BaseTheme.imageButtonRenderDelegate=SC.RenderDelegate.create({className:"image-button",render:function(e,t){var n=e.get("image") ,r=e.get("toolTip");this.addSizeClassName(e,t),t.addClass("no-min-width"),r&&(t.attr("title",r),t.attr("alt",r)),n?t.push("
"):t.push("
")},update:function(e,t){var n,r;this.updateSizeClassName(e,t),e.didChangeFor("imageButtonRenderDelegate","toolTip")&&(r=e.get("toolTip"),t.attr("title",r),t.attr("aria-label",r)),n=e.get("image"),n&&e.didChangeFor("imageButtonRenderDelegate","image")&&(t.children()[0].className="img "+n)}}),SC.BaseTheme.MASTER_DETAIL_DIVIDER_WIDTH=1,SC.BaseTheme.masterDetailRenderDelegate=SC.RenderDelegate.create({className:"master-detail",dividerWidth:1,render:function(e,t){t.setClass("round-toolbars",SC.platform.touch)},update:function(e,t){t.setClass("round-toolbars",SC.platform.touch)}}),SC.BaseTheme.panelRenderDelegate=SC.RenderDelegate.create({className:"panel",render:function(e,t){t=t.begin("div").addClass("panel-background"),this.includeSlices(e,t,SC.NINE_SLICE),t=t.end();var n=e.get("ariaLabel"),r=e.get("ariaLabelledBy"),i=e.get("ariaDescribedBy");n&&t.attr("aria-label",n),r&&t.attr("aria-labelledby",r),i&&t.attr("aria-describedby",i)},update:function(e,t){var n=e.get("ariaLabel"),r=e.get("ariaLabelledBy"),i=e.get("ariaDescribedBy");n&&t.attr("aria-label",n),r&&t.attr("aria-labelledby",r),i&&t.attr("aria-describedby",i)}}),SC.BaseTheme.pickerRenderDelegate=SC.RenderDelegate.create({className:"picker",render:function(e,t){var n=e.get("theme").panelRenderDelegate;n.render(e,t);var r=e.get("preferType"),i=e.get("pointerPos"),s=e.get("pointerPosY");if(r==SC.PICKER_POINTER||r==SC.PICKER_MENU_POINTER)t.push ('
'),t.addClass(i)},update:function(e,t){var n=e.get("theme").panelRenderDelegate;n.update(e,t);var r=e.get("preferType"),i=e.get("pointerPos"),s=e.get("pointerPosY");if(r==SC.PICKER_POINTER||r==SC.PICKER_MENU_POINTER){var o=t.find(".sc-pointer");o.attr("class","sc-pointer "+i),o.attr("style","margin-top: "+s+"px"),t.addClass(i)}}}),SC.BaseTheme.menuRenderDelegate=SC.BaseTheme.pickerRenderDelegate.create({className:"menu",render:function(e,t,n){this.addSizeClassName(t,n),e(t,n)}.enhance(),update:function(e,t,n){this.updateSizeClassName(t,n),e(t,n)}.enhance(),itemHeight:26,itemSeparatorHeight:9,menuHeightPadding:6,menuWidthPadding:50,minimumMenuWidth:50,submenuOffsetX:2,verticalOffset:23,"sc-tiny-size":{itemHeight:22,itemSeparatorHeight:2,menuHeightPadding:4,submenuOffsetX:0},"sc-small-size":{itemHeight:26,itemSeparatorHeight:7,menuHeightPadding:0,submenuOffsetX:4},"sc-large-size":{itemHeight:30,itemSeparatorHeight:20,menuHeightPadding:0,submenuOffsetX:4},"sc-huge-size":{itemHeight:30,itemSeparatorHeight:9,menuHeightPadding:0,submenuOffsetX:0}}),SC.BaseTheme.popupButtonRenderDelegate=SC.BaseTheme.buttonRenderDelegate.create({render:function(e,t){t.attr("aria-haspopup","true"),arguments.callee.base.apply(this,arguments)},update:function(e,t){arguments.callee.base.apply(this,arguments)}}),SC.BaseTheme.progressRenderDelegate=SC.RenderDelegate.create({className:"progress",render:function(e,t){this.addSizeClassName(e,t);var n=e.get("theme"),r=e.get("maximum"),i=e.get("minimum"),s=e.get("ariaValue"),o;e.get("isIndeterminate" )?o=120:o=e.get("value"),t.attr("aria-valuemax",r),t.attr("aria-valuemin",i),t.attr("aria-valuenow",s),t.setClass({indeterminate:e.get("isIndeterminate"),running:e.get("isRunning"),disabled:!e.get("isEnabled"),"sc-empty":o<=0,"sc-complete":o>=100}),t=t.begin("div").addClass("track"),this.includeSlices(e,t,SC.THREE_SLICE),t=t.end(),t=t.begin("div").addClass("content"),t.css("width",o*100+"%"),this.includeSlices(e,t,SC.THREE_SLICE),t=t.end()},update:function(e,t){this.updateSizeClassName(e,t);var n=e.get("theme"),r=e.get("maximum"),i=e.get("minimum"),s=e.get("ariaValue");t.attr("aria-valuemax",r),t.attr("aria-valuemin",i),t.attr("aria-valuenow",s);var o;e.get("isIndeterminate")?o=120:o=e.get("value"),t.setClass({indeterminate:e.get("isIndeterminate"),running:e.get("isRunning"),disabled:!e.get("isEnabled"),"sc-empty":o<=0,"sc-complete":o>=100}),t.find(".content").css("width",o*100+"%")}}),SC.BaseTheme.radioRenderDelegate=SC.RenderDelegate.create({className:"radio",render:function(e,t){this.addSizeClassName(e,t);var n=e.get("theme"),r=e.get("isSelected"),i=e.get("width"),s=SC.guidFor(e)+"-label";t.setClass({active:e.get("isActive"),mixed:e.get("isMixed"),sel:e.get("isSelected"),disabled:!e.get("isEnabled")}),t.attr("role","radio"),t.attr("aria-checked",r),t.attr("aria-labelledby",s),t.attr("aria-disabled",e.get("isEnabled")?"false":"true"),i&&t.css("width",i),t.push(''),t=t.begin("span").addClass("sc-button-label").id(s),n.labelRenderDelegate.render(e,t),t=t.end()},update:function(e,t){this.updateSizeClassName(e,t);var n=e.get("theme"),r=e.get("isSelected" ),i=e.get("width"),s=e.get("value");t.setClass({active:e.get("isActive"),mixed:e.get("isMixed"),sel:e.get("isSelected"),disabled:!e.get("isEnabled")}),t.attr("aria-disabled",e.get("isEnabled")?"false":"true"),t.attr("aria-checked",r),t.css("width",i?i:null),n.labelRenderDelegate.update(e,t.find(".sc-button-label"))}}),SC.BaseTheme.radioGroupRenderDelegate=SC.RenderDelegate.create({className:"radio-group",render:function(e,t){this.addSizeClassName(e,t);var n=e.get("theme"),r=SC.guidFor(this),i=e.get("items"),s,o=i.length,u;t.addClass(e.get("layoutDirection")),t.attr("role","radiogroup"),t.attr("aria-disabled",e.get("isEnabled")?"false":"true");for(s=0;s'+""),t=t.end(),e.get("renderState")._cachedHandle=null},update:function(e,t){this.updateSizeClassName(e,t);var n=e.get("maximum"),r=e.get("minimum"),i=e.get("ariaValue"),s=Math.round(i*10)/10,o=e.get("layoutDirection")===SC.LAYOUT_HORIZONTAL,u=e.didChangeFor("sliderRenderDelegate","layoutDirection");t.attr("aria-valuemax",n),t.attr("aria-valuemin",r),t.attr("aria-valuenow",s),t.attr("aria-orientation",o?"horizontal":"vertical"),t.addClass(o?"sc-horizontal":"sc-vertical");if(u||e.didChangeFor("sliderRenderDelegate","value")){var a=e.get("renderState")._cachedHandle;a||(a=e.get("renderState")._cachedHandle=t.find(".sc-handle")),e.get("isEnabled")?a.attr("tabindex",0):a.removeAttr("tabindex");var f=e.get("frame"),l=e.get("value");u&&a.css(o?"top":"left",null),o?a.css("left",l+"%"):a.css("top",100-l+"%")}}}),SC.BaseTheme.SourceList=SC.BaseTheme.subtheme("source-list"),SC.BaseTheme .toolbarRenderDelegate=SC.RenderDelegate.create({className:"toolbar",render:function(e,t){},update:function(){}}),SC.BaseTheme.wellRenderDelegate=SC.RenderDelegate.create({className:"well",render:function(e,t){},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(e){e(),this.get("isDropTarget")&&SC.Drag.addDropTarget(this),this.get("isScrollable")&&SC.Drag.addScrollableView(this)}.enhance(),destroy:function(e){return this.get("isDropTarget")&&SC.Drag.removeDropTarget(this),this.get("isScrollable")&&SC.Drag.removeScrollableView(this),e()}.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 e=this.data;if(e){var t=[];for(var n in e)e.hasOwnProperty(n)&&t.push(n);return t}var r=this.get("source");return r&&r.dragDataTypes?r.get("dragDataTypes")||[]:[]}.property().cacheable(),hasDataType:function(e){return this.get("dataTypes").indexOf(e)>=0},dataForType:function(e){if(this.dataSource)return this.dataSource.dragDataForType(this,e);if(this.data)return this.data[e];var t=this.get("source");return t&&SC.typeOf(t.dragDataForType)==SC.T_FUNCTION?t.dragDataForType(this,e):null},dataSource:null,data:null,allowedDragOperations :SC.DRAG_ANY,_dragInProgress:YES,_dragViewWasVisible:null,startDrag:function(){this.get("sourceIsDraggable")&&this._createGhostView();var e=this.event,t={x:e.pageX,y:e.pageY};this.set("location",t);if(this.get("sourceIsDraggable")){var n=this._getDragView(),r=n.get("parentView"),i=r?r.convertFrameToView(n.get("frame"),null):n.get("frame");this.get("ghost")&&(this._dragViewWasVisible=n.get("isVisible"),n.set("isVisible",NO)),this.ghostActsLikeCursor?this.ghostOffset={x:14,y:14}:this.ghostOffset={x:t.x-i.x,y:t.y-i.y},this._ghostViewHidden||this._positionGhostView(e);if(e.makeTouchResponder){var s=this;SC.Timer.schedule({target:e,action:function(){e.hasEnded||e.makeTouchResponder(s,YES)},interval:1})}else this.ghostView.rootResponder.dragDidStart(this,e)}var o=this.source;o&&o.dragDidBegin&&o.dragDidBegin(this,t);var u=this._dropTargets();for(var a=0,f=u.length;at?-1:1)}),this._cachedDropTargets=e,e},_findDropTarget:function(e){var t={x:e.pageX,y:e.pageY},n,r,i=this._dropTargets();for(var s=0,o=i.length;s=o&&t.y<=u?i=1:(o=SC.minY(l),u=o+SC.DRAG_AUTOSCROLL_ZONE_THICKNESS,t.y>=o&&t.y<=u?i=-1:i=0)),s&&(u=SC.maxX(l),o=u-SC.DRAG_AUTOSCROLL_ZONE_THICKNESS,t.x>=o&&t.x<=u?s=1:(o=SC.minX(l),u=o+SC.DRAG_AUTOSCROLL_ZONE_THICKNESS,t.x>=o&&t.x<=u?s=-1:s=0)),i||s?r=n:n=this._findNextScrollableView(n)}r&&this._lastScrollableView===r?SC.getCurrentTimeForPerformance()-this._hotzoneStartTime>100&&(this._horizontalScrollAmount*=1.05,this._verticalScrollAmount*=1.05):(this._lastScrollableView=r,this._horizontalScrollAmount=15,this._verticalScrollAmount=15,this._hotzoneStartTime=r?SC.getCurrentTimeForPerformance():null,s=i=0);if(r&&(s||i)){var c={x:s*this._horizontalScrollAmount,y:i*this._verticalScrollAmount};r.scrollBy(c)}return r?(e&&(this._lastAutoscrollEvent= {pageX:e.pageX,pageY:e.pageY}),this.invokeLater(this._autoscroll,100,null),YES):(this._lastAutoscrollEvent=null,NO)},_scrollableViews:function(){if(this._cachedScrollableView)return this._cachedScrollableView;var e=[],t=SC.Drag._scrollableViews;for(var n in t)t.hasOwnProperty(n)&&e.push(t[n]);return e=e.sort(function(e,t){var n=e;while(n=n.get("parentView"))if(t==n)return-1;return 1}),this._cachedScrollableView=e,e},_findScrollableView:function(e){var t=this._scrollableViews(),n=t?t.length:0,r,i,s;for(s=0;s'),this.renderButtons(e,this.get("hasButtons")),this.renderThumb(e,s,u,o),e.attr("aria-orientation","vertical"),e.attr("aria-valuemax",this.get("maximum")),e.attr("aria-valuemin",this.get("minimum")),e.attr("aria-valuenow",this.get("value")),e.attr("aria-controls",i.getPath("contentView.layerId"));else{if(this.get("controlsHidden"))return;f=this.$(".thumb"),this.adjustThumb(f,o,u),e.attr("aria-valuenow",this.get("value"))}},renderThumb:function(e,t,n,r){var i;t===SC.LAYOUT_HORIZONTAL?i="width: "+n+"px; left: "+r+"px;":i="height: "+n+"px; top: "+r+"px;",e.push('
'.fmt(i),'
')},renderButtons:function(e,t){t&&e.push('
')},touchScrollDidStart:function(e){this.set("_touchScrollValue",e)},touchScrollDidEnd:function(e){this.set("_touchScrollValue",NO)},touchScrollDidChange:function(e){this.set("_touchScrollValue",e)},adjustThumb:function(e,t,n){this.adjustThumbPosition(e,t),this.adjustThumbSize(e,n)},adjustThumbPosition:function(e,t){if( this._thumbPosition===t)return;switch(this.get("layoutDirection")){case SC.LAYOUT_VERTICAL:e.css("top",t);break;case SC.LAYOUT_HORIZONTAL:e.css("left",t)}this._thumbPosition=t},adjustThumbSize:function(e,t){t=Math.max(t,this.get("minimumThumbLength"));if(this._thumbSize===t)return;switch(this.get("layoutDirection")){case SC.LAYOUT_VERTICAL:e.css("height",t);break;case SC.LAYOUT_HORIZONTAL:e.css("width",t)}this._thumbSize=t},trackLength:function(){var e=this.get("scrollerLength");return e-=this.capLength-this.capOverlap,e-=this.buttonLength-this.buttonOverlap,e}.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 e;return e=Math.floor(this.get("trackLength")*this.get("proportion")),e=isNaN(e)?0:e,Math.max(e,this.get("minimumThumbLength"))}.property("trackLength","proportion").cacheable(),thumbPosition:function(){var e=this.get("displayValue"),t=this.get("maximum"),n=this.get("trackLength"),r=this.get("thumbLength"),i=this.get("capLength"),s=this.get("capOverlap"),o;return o=e/t*(n-r),o+=i-s,Math.floor(isNaN(o)?0:o)}.property("displayValue","maximum","trackLength","thumbLength").cacheable(),controlsHidden:function(){return this.get("proportion")>=1}.property("proportion").cacheable(),valueForPosition:function(e){var t=this.get("maximum"),n=this.get("trackLength"),r=this.get("thumbLength"),i=this.get("capLength"),s=this.get("capOverlap"),o;return o=e-(i- s),o/=n-r,o*=t,o},mouseDown:function(e){if(!this.get("isEnabled"))return NO;this._altIsDown=e.altKey,this._shiftIsDown=e.shiftKey;var t=e.target,n=this.get("thumbPosition"),r,i,s,o=this.get("scrollerLength");if(t.className.indexOf("thumb")>=0)i=this.convertFrameFromView({x:e.pageX,y:e.pageY}),i.x-=n,i.y-=n,this._thumbDragging=YES,this._thumbOffset=i,this._mouseDownLocation={x:e.pageX,y:e.pageY},this._thumbPositionAtDragStart=this.get("thumbPosition"),this._valueAtDragStart=this.get("value");else if(t.className.indexOf("button-top")>=0)this.decrementProperty("value",this._altIsDown?o:30),this.makeButtonActive(".button-top"),this.startMouseDownTimer("scrollUp"),this._isScrollingUp=YES;else if(t.className.indexOf("button-bottom")>=0)this.incrementProperty("value",this._altIsDown?o:30),this.makeButtonActive(".button-bottom"),this.startMouseDownTimer("scrollDown"),this._isScrollingDown=YES;else{var u=this.get("shouldScrollToClick");e.altKey&&(u=!u);var a=this.get("trackLength"),f=this.get("thumbLength"),l=this.convertFrameFromView({x:e.pageX,y:e.pageY}),c;switch(this.get("layoutDirection")){case SC.LAYOUT_VERTICAL:this._mouseDownLocation=c=l.y;break;case SC.LAYOUT_HORIZONTAL:this._mouseDownLocation=c=l.x}u?(this.set("value",this.valueForPosition(c-f/2)),n=this.get("thumbPosition"),this._thumbDragging=YES,this._thumbOffset={x:l.x-n,y:l.y-n},this._mouseDownLocation={x:e.pageX,y:e.pageY},this._thumbPositionAtDragStart=n,this._valueAtDragStart=this.get("value")):cn+r&&this.incrementProperty("value",e)}this._mouseDownTimer=SC.Timer.schedule({target:this,action:this.mouseDownTimerDidFire,interval:i})},makeButtonActive:function(e){this._scs_buttonActive=this.$(e).addClass("active")}}),SC.TouchScrollerView=SC.ScrollerView.extend({classNames:["sc-touch-scroller-view"],scrollbarThickness:12,capLength:5,capOverlap:0,hasButtons:NO,buttonOverlap:36,adjustThumb:function(e,t,n){var r=this.$(".thumb-inner"),i=this.get("scrollerLength"),s=this.get("minimum");t+n>i&&(t=Math.min(i-20,t),n=i-t),t'),this.renderButtons(e,this.get("hasButtons")),this.renderThumb(e,this.get("layoutDirection"),s);else{if(this.get("controlsHidden"))return;u=this.$(".thumb"),this.adjustThumb(u,i,s)}},renderThumb:function(e,t,n){n-=1044,t=t===SC.LAYOUT_HORIZONTAL?"X":"Y",e.push('
'+'
'.fmt(t,n)+'
'+'
')}}),SC.NORMAL_SCROLL_DECELERATION=.95,SC.FAST_SCROLL_DECELERATION=.85,SC.ScrollView=SC.View.extend({classNames:["sc-scroll-view"],isScrollable:YES,contentView:null,horizontalAlign:SC.ALIGN_LEFT,verticalAlign:SC.ALIGN_TOP,horizontalScrollOffset:function(e,t){if(t!==undefined){var n=this.minimumHorizontalScrollOffset(),r=this.get("maximumHorizontalScrollOffset");this._scroll_horizontalScrollOffset=Math.max(n,Math.min(r,t)),this.childViews&&this.horizontalScrollerView&&this.horizontalScrollerView.isObject&&this.horizontalScrollerView.set("value",this._scroll_horizontalScrollOffset||0)}return this._scroll_horizontalScrollOffset||0 }.property().cacheable(),verticalScrollOffset:function(e,t){if(t!==undefined){var n=this.get("minimumVerticalScrollOffset"),r=this.get("maximumVerticalScrollOffset");this._scroll_verticalScrollOffset=Math.max(n,Math.min(r,t)),this.childViews&&this.verticalScrollerView&&this.verticalScrollerView.isObject&&this.verticalScrollerView.set("value",this._scroll_verticalScrollOffset||0)}return this._scroll_verticalScrollOffset||0}.property().cacheable(),maximumScrollOffset:function(e,t,n){return e>=t?e-t:n===SC.ALIGN_LEFT||n===SC.ALIGN_TOP?0:n===SC.ALIGN_MIDDLE||n===SC.ALIGN_CENTER?0-Math.round((t-e)/2):0-(t-e)},minimumScrollOffset:function(e,t,n){return e>t?0:n===SC.ALIGN_LEFT||n===SC.ALIGN_TOP?0:n===SC.ALIGN_MIDDLE||n===SC.ALIGN_CENTER?0-Math.round((t-e)/2):0-(t-e)},maximumHorizontalScrollOffset:function(){var e=this.get("contentView"),t=e?e.get("frame").width:0,n=e?e.get("calculatedWidth"):0;n&&(t=e.calculatedWidth),t*=this._scale;var r=this.get("containerView").get("frame").width;return this.get("canScrollHorizontal")||(t=Math.min(t,r)),this.maximumScrollOffset(t,r,this.get("horizontalAlign"))}.property(),maximumVerticalScrollOffset:function(){var e=this.get("contentView"),t=e&&e.get("frame")?e.get("frame").height:0,n=e?e.get("calculatedHeight"):0;n&&(t=n),t*=this._scale;var r=this.get("containerView").get("frame").height;return this.get("canScrollVertical")||(t=Math.min(t,r)),this.maximumScrollOffset(t,r,this.get("verticalAlign"))}.property(),minimumHorizontalScrollOffset:function(){var e=this.get("contentView"),t=e?e.get("frame").width:0,n=e?e.get("calculatedWidth"):0;n&&(t=n) ,t*=this._scale;var r=this.get("containerView").get("frame").width;return this.get("canScrollHorizontal")||(t=Math.min(t,r)),this.minimumScrollOffset(t,r,this.get("horizontalAlign"))}.property(),minimumVerticalScrollOffset:function(){var e=this.get("contentView"),t=e&&e.get("frame")?e.get("frame").height:0,n=e?e.get("calculatedHeight"):0;n&&(t=e.calculatedHeight),t*=this._scale;var r=this.get("containerView").get("frame").height;return this.get("canScrollVertical")||(t=Math.min(t,r)),this.minimumScrollOffset(t,r,this.get("verticalAlign"))}.property(),verticalLineScroll:20,horizontalLineScroll:20,verticalPageScroll:function(){return this.get("frame").height}.property("frame"),horizontalPageScroll:function(){return this.get("frame").width}.property("frame"),hasHorizontalScroller:YES,horizontalScrollerView:SC.ScrollerView,horizontalTouchScrollerView:SC.TouchScrollerView,isHorizontalScrollerVisible:YES,canScrollHorizontal:function(){return!!(this.get("hasHorizontalScroller")&&this.get("horizontalScrollerView")&&this.get("isHorizontalScrollerVisible"))}.property("isHorizontalScrollerVisible").cacheable(),autohidesHorizontalScroller:YES,hasVerticalScroller:YES,verticalScrollerView:SC.ScrollerView,verticalTouchScrollerView:SC.TouchScrollerView,isVerticalScrollerVisible:YES,canScrollVertical:function(){return!!(this.get("hasVerticalScroller")&&this.get("verticalScrollerView")&&this.get("isVerticalScrollerVisible"))}.property("isVerticalScrollerVisible").cacheable(),autohidesVerticalScroller:YES,verticalScrollerBottom:0,verticalOverlay:function(){return SC.platform.touch?YES:NO}.property ().cacheable(),horizontalOverlay:function(){return SC.platform.touch?YES:NO}.property().cacheable(),verticalScrollerLayout:null,horizontalScrollerLayout:null,containerView:SC.ContainerView.extend({}),scrollTo:function(e,t){return t===undefined&&SC.typeOf(e)===SC.T_HASH&&(t=e.y,e=e.x),SC.none(e)||this.set("horizontalScrollOffset",e),SC.none(t)||this.set("verticalScrollOffset",t),this},scrollBy:function(e,t){return t===undefined&&SC.typeOf(e)===SC.T_HASH&&(t=e.y,e=e.x),e=e?this.get("horizontalScrollOffset")+e:null,t=t?this.get("verticalScrollOffset")+t:null,this.scrollTo(e,t)},scrollToVisible:function(e){if(arguments.length===0)return arguments.callee.base.apply(this,arguments);var t=this.get("contentView");if(!t)return NO;var n=e.get("frame");return n?(n=t.convertFrameFromView(n,e.get("parentView")),this.scrollToRect(n)):NO},scrollToRect:function(e){var t=SC.cloneRect(this.get("containerView").get("frame"));t.x=this.get("horizontalScrollOffset"),t.y=this.get("verticalScrollOffset");var n=t.x,r=t.y;return t.y-=Math.max(0,SC.minY(t)-SC.minY(e)),t.x-=Math.max(0,SC.minX(t)-SC.minX(e)),t.y+=Math.max(0,SC.maxY(e)-SC.maxY(t)),t.x+=Math.max(0,SC.maxX(e)-SC.maxX(t)),n!==t.x||r!==t.y?(this.scrollTo(t.x,t.y),YES):NO},scrollDownLine:function(e){return e===undefined&&(e=1),this.scrollBy(null,this.get("verticalLineScroll")*e)},scrollUpLine:function(e){return e===undefined&&(e=1),this.scrollBy(null,0-this.get("verticalLineScroll")*e)},scrollRightLine:function(e){return e===undefined&&(e=1),this.scrollTo(this.get("horizontalLineScroll")*e,null)},scrollLeftLine:function(e){return e===undefined&& (e=1),this.scrollTo(0-this.get("horizontalLineScroll")*e,null)},scrollDownPage:function(e){return e===undefined&&(e=1),this.scrollBy(null,this.get("verticalPageScroll")*e)},scrollUpPage:function(e){return e===undefined&&(e=1),this.scrollBy(null,0-this.get("verticalPageScroll")*e)},scrollRightPage:function(e){return e===undefined&&(e=1),this.scrollBy(this.get("horizontalPageScroll")*e,null)},scrollLeftPage:function(e){return e===undefined&&(e=1),this.scrollBy(0-this.get("horizontalPageScroll")*e,null)},tile:function(){var e=this.get("hasHorizontalScroller")?this.get("horizontalScrollerView"):null,t=e&&this.get("isHorizontalScrollerVisible"),n=this.get("hasVerticalScroller")?this.get("verticalScrollerView"):null,r=n&&this.get("isVerticalScrollerVisible"),i=this.get("containerView"),s={left:0,top:0},o,u,a,f,l,c,h=t?e.get("scrollbarThickness"):0,p=r?n.get("scrollbarThickness"):0;t?(c=this.get("horizontalScrollerLayout"),u={left:c?c.left:0,bottom:c?c.bottom:0,right:c?c.right+p-1:p-1,height:h},e.set("layout",u),f=this.get("horizontalOverlay"),s.bottom=f?0:u.bottom+h):s.bottom=0,e&&e.set("isVisible",t),r?(h+=this.get("verticalScrollerBottom"),l=this.get("verticalScrollerLayout"),u={top:l?l.top:0,bottom:l?l.bottom+h:h,right:l?l.right:0,width:p},n.set("layout",u),a=this.get("verticalOverlay"),s.right=a?0:u.right+p):s.right=0,n&&n.set("isVisible",r),i.adjust(s)},scrollerVisibilityDidChange:function(){this.tile()}.observes("isVerticalScrollerVisible","isHorizontalScrollerVisible"),_scroll_wheelDeltaX:0,_scroll_wheelDeltaY:0,mouseWheel:function(e){return this._scroll_wheelDeltaX+=e.wheelDeltaX ,this._scroll_wheelDeltaY+=e.wheelDeltaY,this.invokeLater(this._scroll_mouseWheel,10).set("isPooled",!0),this.get("canScrollHorizontal")||this.get("canScrollVertical")},_scroll_mouseWheel:function(){this.scrollBy(this._scroll_wheelDeltaX,this._scroll_wheelDeltaY),SC.WHEEL_MOMENTUM&&this._scroll_wheelDeltaY>0?(this._scroll_wheelDeltaY=Math.floor(this._scroll_wheelDeltaY*.95),this._scroll_wheelDeltaY=Math.max(this._scroll_wheelDeltaY,0),this.invokeLater(this._scroll_mouseWheel,10).set("isPooled",!0)):SC.WHEEL_MOMENTUM&&this._scroll_wheelDeltaY<0?(this._scroll_wheelDeltaY=Math.ceil(this._scroll_wheelDeltaY*.95),this._scroll_wheelDeltaY=Math.min(this._scroll_wheelDeltaY,0),this.invokeLater(this._scroll_mouseWheel,10).set("isPooled",!0)):(this._scroll_wheelDeltaY=0,this._scroll_wheelDeltaX=0)},_handleDomScrollEvent:function(e){var t=this.$(e.target);this.setIfChanged("verticalScrollOffset",t.scrollTop()),this.setIfChanged("horizontalScrollOffset",t.scrollLeft())},didCreateLayer:function(){var e=this.containerView.$()[0];SC.Event.add(e,"scroll",this,this._handleDomScrollEvent)},willDestroyLayer:function(){var e=this.containerView.$()[0];SC.Event.remove(e,"scroll",this,this._handleDomScrollEvent)},canScale:NO,_scale:1,scale:function(e,t){return t!==undefined&&(this._scale=Math.min(Math.max(this.get("minimumScale"),t),this.get("maximumScale"))),this._scale}.property().cacheable(),minimumScale:.25,maximumScale:2,autoScaleRange:NO,_scale_css:"",updateScale:function(e){var t=this.get("contentView");if(!t)return;t.isScalable?(this.get("contentView").applyScale(e),this._scale_css=""):this ._scale_css="scale3d("+e+", "+e+", 1)"},acceptsMultitouch:YES,decelerationRate:SC.NORMAL_SCROLL_DECELERATION,alwaysBounceHorizontal:NO,alwaysBounceVertical:YES,delaysContentTouches:YES,_touchScrollDidChange:function(){this.get("contentView").touchScrollDidChange&&this.get("contentView").touchScrollDidChange(this._scroll_horizontalScrollOffset,this._scroll_verticalScrollOffset),this.verticalScrollerView&&this.verticalScrollerView.touchScrollDidChange&&this.verticalScrollerView.touchScrollDidChange(this._scroll_verticalScrollOffset),this.horizontalScrollerView&&this.horizontalScrollerView.touchScrollDidChange&&this.horizontalScrollerView.touchScrollDidChange(this._scroll_horizontalScrollOffset)},_touchScrollDidStart:function(){this.get("contentView").touchScrollDidStart&&this.get("contentView").touchScrollDidStart(this._scroll_horizontalScrollOffset,this._scroll_verticalScrollOffset),this.verticalScrollerView&&this.verticalScrollerView.touchScrollDidStart&&this.verticalScrollerView.touchScrollDidStart(this._touch_verticalScrollOffset),this.horizontalScrollerView&&this.horizontalScrollerView.touchScrollDidStart&&this.horizontalScrollerView.touchScrollDidStart(this._touch_horizontalScrollOffset)},_touchScrollDidEnd:function(){this.get("contentView").touchScrollDidEnd&&this.get("contentView").touchScrollDidEnd(this._scroll_horizontalScrollOffset,this._scroll_verticalScrollOffset),this.verticalScrollerView&&this.verticalScrollerView.touchScrollDidEnd&&this.verticalScrollerView.touchScrollDidEnd(this._touch_verticalScrollOffset),this.horizontalScrollerView&&this.horizontalScrollerView .touchScrollDidEnd&&this.horizontalScrollerView.touchScrollDidEnd(this._touch_horizontalScrollOffset)},_applyCSSTransforms:function(e){var t="";this.updateScale(this._scale),t+="translate3d("+ -this._scroll_horizontalScrollOffset+"px, "+ -Math.round(this._scroll_verticalScrollOffset)+"px,0) ",t+=this._scale_css;if(e){var n=e.style;n.webkitTransform=t,n.webkitTransformOrigin="top left"}},captureTouch:function(e){return YES},touchGeneration:0,touchStart:function(e){var t=++this.touchGeneration;return!this.tracking&&this.get("delaysContentTouches")?this.invokeLater(this.beginTouchesInContent,150,t).set("isPooled",!0):this.tracking||this.invokeLater(this.beginTouchesInContent,1,t).set("isPooled",!0),this.beginTouchTracking(e,YES),YES},beginTouchesInContent:function(e){if(e!==this.touchGeneration)return;var t=this.touch,n;t&&this.tracking&&!this.dragging&&!t.touch.scrollHasEnded&&(t.touch.captureTouch(this,YES),t.touch.touchResponder?t.needsScrollEnd&&this._touchScrollDidEnd():t.touch.makeTouchResponder(this))},beginTouchTracking:function(e,t){var n=e.averagedTouchesForView(this,t),r=this._scroll_verticalScrollOffset||0,i=this._scroll_horizontalScrollOffset||0,s=i,o=r,u=NO,a=0,f=0,l,c;this.touch&&this.touch.timeout&&(clearTimeout(this.touch.timeout),this.touch.timeout=null,s=this.touch.startClipOffset.x,o=this.touch.startClipOffset.y,u=YES),c=this.get("contentView"),c&&(l=c.get("frame"),a=l.width,f=l.height),c.calculatedWidth&&c.calculatedWidth!==0&&(a=c.calculatedWidth),c.calculatedHeight&&c.calculatedHeight!==0&&(f=c.calculatedHeight);var h=this.get("containerView").get("frame" ),p=h.width,d=h.height,v=this.convertFrameToView(this.get("frame"),null),m=(i+(n.x-v.x))/this._scale,g=(r+(n.y-v.y))/this._scale;this.touch={startTime:e.timeStamp,notCalculated:YES,enableScrolling:{x:a*this._scale>p||this.get("alwaysBounceHorizontal"),y:f*this._scale>d||this.get("alwaysBounceVertical")},scrolling:{x:NO,y:NO},enableBouncing:SC.platform.bounceOnScroll,startClipOffset:{x:s,y:o},lastScrollOffset:{x:i,y:r},startTouchOffset:{x:n.x,y:n.y},scrollVelocity:{x:0,y:0},startTouchOffsetInContent:{x:m,y:g},containerSize:{width:p,height:d},contentSize:{width:a,height:f},startScale:this._scale,startDistance:n.d,canScale:this.get("canScale")&&SC.platform.pinchToZoom,minimumScale:this.get("minimumScale"),maximumScale:this.get("maximumScale"),globalFrame:v,layer:c.get("layer"),resistanceCoefficient:.998,resistanceAsymptote:320,decelerationFromEdge:.05,accelerationToEdge:.1,scrollTolerance:{x:15,y:15},scaleTolerance:5,secondaryScrollTolerance:30,scrollLock:500,decelerationRate:this.get("decelerationRate"),lastEventTime:e.timeStamp,touch:t?e:this.touch?this.touch.touch:null,needsScrollEnd:u},this.tracking||(this.tracking=YES,this.dragging=NO)},_adjustForEdgeResistance:function(e,t,n,r,i){var s;if(en))return e;s=n-e}return s=Math.pow(r,Math.abs(s))*i,ei.scrollTolerance.x&&i.enableScrolling.x&&(w=YES,p.x=YES,i.scrollTolerance.y=i.secondaryScrollTolerance,i.startTouchOffset.x=e,y=0),!p.y&&Math.abs(b)>i.scrollTolerance.y&&i.enableScrolling.y&&(w=YES,p.y=YES,i.scrollTolerance.x=i.secondaryScrollTolerance,i.startTouchOffset.y=t,b=0),w&&!i.dragging&&(i.dragging=YES,this.dragging=YES,this._touchScrollDidStart());if(!p.x&&!p.y&&!i.canScale)return;p.x&&!p.y&&y>i.scrollLock&&!p.y&&(i.enableScrolling.y=NO),p.y&&!p.x&&b>i.scrollLock&&!p.x&&(i.enableScrolling.x=NO);if(i.canScale){var E=i.startDistance,S=n-E;if(Math.abs(S)>i.scaleTolerance){p.y=YES,p.x=YES;var x=i.startScale*(n/Math.max(E,50)),T=this._adjustForEdgeResistance(x,i.minimumScale,i.maximumScale,i.resistanceCoefficient,i.resistanceAsymptote);this.dragging=YES,this._scale=T;var N=m*this._scale,C=g*this._scale}}c=this.minimumScrollOffset(i.contentSize.width*this._scale,i.containerSize.width,d),h=this.minimumScrollOffset(i.contentSize.height*this._scale,i.containerSize.height,v),l=this.maximumScrollOffset(i.contentSize.width*this._scale,i.containerSize.width,d),a=this.maximumScrollOffset(i.contentSize.height*this._scale,i.containerSize.height,v),f=i.startTouchOffsetInContent.x*this._scale-s,u=i.startTouchOffsetInContent.y*this._scale-o,i.enableBouncing?(f=this._adjustForEdgeResistance(f,c,l,i.resistanceCoefficient,i.resistanceAsymptote),u=this._adjustForEdgeResistance (u,h,a,i.resistanceCoefficient,i.resistanceAsymptote)):(f=Math.max(c,Math.min(l,f)),u=Math.max(h,Math.min(a,u))),p.x&&(this._scroll_horizontalScrollOffset=f),p.y&&(this._scroll_verticalScrollOffset=u),this._applyCSSTransforms(i.layer),this._touchScrollDidChange();if(r-i.lastEventTime>=1||i.notCalculated){i.notCalculated=NO;var k=this._scroll_horizontalScrollOffset,L=this._scroll_verticalScrollOffset;i.scrollVelocity.x=(k-i.lastScrollOffset.x)/Math.max(1,r-i.lastEventTime),i.scrollVelocity.y=(L-i.lastScrollOffset.y)/Math.max(1,r-i.lastEventTime),i.lastScrollOffset.x=k,i.lastScrollOffset.y=L,i.lastEventTime=r}},touchEnd:function(e){var t=this.touch,n=e.averagedTouchesForView(this);e.scrollHasEnded=YES,n.touchCount>0?this.beginTouchTracking(e,NO):(this.dragging?(t.dragging=NO,t.lastEventTime=e.timeStamp,this.startDecelerationAnimation()):(t.needsScrollEnd&&this._touchScrollDidEnd(),e.captureTouch(this,YES),e.touchResponder&&e.touchResponder!==this?e.end():(!e.touchResponder||e.touchResponder===this)&&e.nextTouchResponder&&e.makeTouchResponder(e.nextTouchResponder),this.touch=null),this.tracking=NO,this.dragging=NO)},touchCancelled:function(e){var t=this.touch,n=e.averagedTouchesForView(this);if(!this.touch||!this.touch.timeout)this.beginPropertyChanges(),this.set("scale",this._scale),this.set("verticalScrollOffset",this._scroll_verticalScrollOffset),this.set("horizontalScrollOffset",this._scroll_horizontalScrollOffset),this.endPropertyChanges(),this.tracking=NO,this.dragging&&this._touchScrollDidEnd(),this.dragging=NO,this.touch=null},startDecelerationAnimation:function(e){var t= this.touch;t.decelerationVelocity={x:t.scrollVelocity.x*10,y:t.scrollVelocity.y*10},this.decelerateAnimation()},bouncyBounce:function(e,t,n,r,i,s,o){return tr&&(e>0?e-=(t-r)*i:e=-Math.min((t-r)*s+o,t-r-.01)),e},decelerateAnimation:function(){var e=this.touch,t=this._scale,n=e.contentSize,r=e.containerSize,i=this.get("horizontalAlign"),s=this.get("verticalAlign"),o=this.minimumScrollOffset(n.width*this._scale,r.width,i),u=this.minimumScrollOffset(n.height*this._scale,r.height,s),a=this.maximumScrollOffset(n.width*this._scale,r.width,i),f=this.maximumScrollOffset(n.height*this._scale,r.height,s),l=SC.getCurrentTimeForPerformance(),c=Math.max(l-e.lastEventTime,1),h=this._scroll_horizontalScrollOffset+e.decelerationVelocity.x*(c/10),p=this._scroll_verticalScrollOffset+e.decelerationVelocity.y*(c/10),d=e.decelerationFromEdge,v=e.accelerationToEdge,m=!e.enableBouncing,g=!e.enableBouncing;h>=o&&h<=a&&(m=YES),p>=u&&p<=f&&(g=YES),h/=this._scale,p/=this._scale;var y=0;y=this.bouncyBounce(y,t,e.minimumScale,e.maximumScale,d,v,0),this._scale=t+=y,h*=this._scale,p*=this._scale,o=this.minimumScrollOffset(n.width*this._scale,r.width,i),u=this.minimumScrollOffset(n.height*this._scale,r.height,s),a=this.maximumScrollOffset(n.width*this._scale,r.width,i),f=this.maximumScrollOffset(n.height*this._scale,r.height,s),m&&(ha)&&(h=Math.max(o,Math.min(h,a)),e.decelerationVelocity.x=0),g&&(pf)&&(p=Math.max(u,Math.min(p,f)),e.decelerationVelocity.y=0),this._scroll_horizontalScrollOffset=h,this._scroll_verticalScrollOffset=p,this._applyCSSTransforms (e.layer),this._touchScrollDidChange();var b=e.decelerationRate,w=Math.pow(b,c/10);e.decelerationVelocity.y*=w,e.decelerationVelocity.x*=w,e.decelerationVelocity.x=this.bouncyBounce(e.decelerationVelocity.x,h,o,a,d,v,.3),e.decelerationVelocity.y=this.bouncyBounce(e.decelerationVelocity.y,p,u,f,d,v,.3);var E=Math.abs(e.decelerationVelocity.x),S=Math.abs(e.decelerationVelocity.y);if(S<.05&&E<.05&&Math.abs(y)<.05){e.timeout=null,this.touch=null,this._touchScrollDidEnd(),this.beginPropertyChanges(),this.set("scale",this._scale),this.set("verticalScrollOffset",this._scroll_verticalScrollOffset),this.set("horizontalScrollOffset",this._scroll_horizontalScrollOffset),this.endPropertyChanges();return}var x=this;e.lastEventTime=SC.getCurrentTimeForPerformance(),this.touch.timeout=setTimeout(function(){SC.run(x.decelerateAnimation(),x)},30)},createChildViews:function(){var e=[],t;SC.none(t=this.containerView)&&(t=SC.ContainerView),e.push(this.containerView=this.createChildView(t,{contentView:this.contentView,isScrollContainer:YES})),this.contentView=this.containerView.get("contentView"),t=SC.platform.touch?this.get("horizontalTouchScrollerView"):this.get("horizontalScrollerView"),t&&(this.get("hasHorizontalScroller")?(t=this.horizontalScrollerView=this.createChildView(t,{layoutDirection:SC.LAYOUT_HORIZONTAL,valueBinding:"*owner.horizontalScrollOffset"}),e.push(t)):this.horizontalScrollerView=null),t=SC.platform.touch?this.get("verticalTouchScrollerView"):this.get("verticalScrollerView"),t&&(this.get("hasVerticalScroller")?(t=this.verticalScrollerView=this.createChildView(t,{layoutDirection :SC.LAYOUT_VERTICAL,valueBinding:"*owner.verticalScrollOffset"}),e.push(t)):this.verticalScrollerView=null),this.childViews=e,this.contentViewDidChange(),this.tile()},init:function(){arguments.callee.base.apply(this,arguments),this._scroll_contentView=this.get("contentView");var e=this._scroll_contentView;e&&(e.addObserver("frame",this,this.contentViewFrameDidChange),e.addObserver("calculatedWidth",this,this.contentViewFrameDidChange),e.addObserver("calculatedHeight",this,this.contentViewFrameDidChange)),this.get("isVisibleInWindow")&&this._scsv_registerAutoscroll()},_scsv_registerAutoscroll:function(){this.get("isVisibleInWindow")?SC.Drag.addScrollableView(this):SC.Drag.removeScrollableView(this)}.observes("isVisibleInWindow"),contentViewDidChange:function(){var e=this.get("contentView"),t=this._scroll_contentView,n=this.contentViewFrameDidChange,r=this.contentViewLayerDidChange;e!==t&&(t&&(t.removeObserver("calculatedWidth",this,this.contentViewFrameDidChange),t.removeObserver("calculatedHeight",this,this.contentViewFrameDidChange),t.removeObserver("frame",this,n),t.removeObserver("layer",this,r)),this._scroll_contentView=e,e&&(e.addObserver("frame",this,n),e.addObserver("calculatedWidth",this,this.contentViewFrameDidChange),e.addObserver("calculatedHeight",this,this.contentViewFrameDidChange),e.addObserver("layer",this,r)),this.containerView.set("contentView",e),this.contentViewFrameDidChange())}.observes("contentView"),render:function(e,t){return this.invokeLast(this.adjustElementScroll),t&&e.push('
'),arguments.callee.base.apply(this,arguments)} ,oldMaxHOffset:0,oldMaxVOffset:0,contentViewFrameDidChange:function(e){var t=this.get("contentView"),n=t?t.get("frame"):null,r=this._scale,i=0,s=0,o,u,a,f,l;if(!t||!n)return;i=t.get("calculatedWidth")||n.width||0,s=t.get("calculatedHeight")||n.height||0,i*=r,s*=r;if(!e&&i===this._scroll_contentWidth&&s===this._scroll_contentHeight)return;this._scroll_contentWidth=i,this._scroll_contentHeight=s,o=this.getPath("containerView.frame"),u=o.width,a=o.height,this.get("hasHorizontalScroller")&&(t=this.get("horizontalScrollerView"))&&(this.get("autohidesHorizontalScroller")&&this.set("isHorizontalScrollerVisible",i>u),t.setIfChanged("maximum",i-u),t.setIfChanged("proportion",u/i)),this.get("hasVerticalScroller")&&(t=this.get("verticalScrollerView"))&&(this.get("autohidesVerticalScroller")&&this.set("isVerticalScrollerVisible",s>a),t.setIfChanged("maximum",s-a),t.setIfChanged("proportion",a/s)),!this.get("isVerticalScrollerVisible")&&this.get("verticalScrollOffset")!==0&&this.get("autohidesVerticalScroller")&&this.set("verticalScrollOffset",0),!this.get("isHorizontalScrollerVisible")&&this.get("horizontalScrollOffset")!==0&&this.get("autohidesHorizontalScroller")&&this.set("horizontalScrollOffset",0);var c=this.get("maximumVerticalScrollOffset"),h=this.get("verticalScrollOffset"),p=this.get("maximumHorizontalScrollOffset"),d=this.get("horizontalScrollOffset"),v=c ')}e.setClass("disabled",!this.get("isEnabled"))},didCreateLayer:function(){},willDestroyLayer:function(){var e=this._sc_scroller_scrollDidChange;SC.Event.remove(this.$(),"scroll",this,e)},mouseEntered:function(e){this.set("isMouseOver",YES),this._invokeScrollOnMouseOver()},mouseExited:function(e){this.set("isMouseOver",NO)},_sc_scroller_valueDidChange:function(){}.observes("value"),_sc_scroller_armScrollTimer:function(){if(!this._sc_scrollTimer){SC.RunLoop.begin();var e=this._sc_scroller_scrollDidChange;this._sc_scrollTimer=this.invokeLater(e,50),SC.RunLoop.end()}},_sc_scroller_scrollDidChange:function( ){var e=SC.getCurrentTimeForPerformance(),t=this._sc_lastScroll,n=this.get("layer"),r=0;if(t&&e-t<50)return this._sc_scroller_armScrollTimer();this._sc_scrollTimer=null,this._sc_lastScroll=e,SC.RunLoop.begin();if(!this.get("isEnabled"))return;this._sc_scrollValue=r=n.scrollTop,this.set("value",r),SC.RunLoop.end()},_scrollMenu:function(){var e=this.get("value"),t;return this.get("scrollDown")?(t=e+this.verticalLineScroll,t<=this.get("maximum")?this.set("value",t):this.set("value",this.get("maximum"))):(t=e-this.verticalLineScroll,t>=0?this.set("value",t):e<=this.verticalLineScroll&&e>0&&this.set("value",0)),YES},_invokeScrollOnMouseOver:function(){this._scrollMenu(),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.MenuScrollView=SC.ScrollView.extend({classNames:["sc-menu-scroll-view"],maximumHorizontalScrollOffset:0,hasHorizontalScroller:NO,horizontalScrollerView:SC.MenuScrollerView,isHorizontalScrollerVisible:NO,canScrollHorizontal:NO,autohidesHorizontalScroller:NO,hasVerticalScroller:YES,verticalScrollerView:SC.MenuScrollerView,verticalScrollerView2:SC.MenuScrollerView,isVerticalScrollerVisible:YES,canScrollVertical:YES,autohidesVerticalScroller:YES,verticalScrollerBottom:0,controlSize:SC.REGULAR_CONTROL_SIZE,containerView:SC.ContainerView,scrollToVisible:function(e){if(arguments.length===0)return arguments .callee.base.apply(this,arguments);var t=this.get("contentView");if(!t)return NO;var n=e.get("frame");if(!n)return NO;n=t.convertFrameFromView(n,e.get("parentView"));var r=this.get("verticalScrollerView2");r&&r.get("isVisible")&&(n.height+=r.get("frame").height);var i=this.get("verticalScrollerView");return i&&i.get("isVisible")&&(n.y-=i.get("frame").height),this.scrollToRect(n)},tile:function(){var e,t,n,r,i,s,o;e=this.get("hasVerticalScroller"),t=e?this.get("verticalScrollerView"):null,n=e?this.get("verticalScrollerView2"):null,r=t&&this.get("isVerticalScrollerVisible"),i=this.get("containerView"),s={left:0,top:0};if(r){o=0;var u=t.get("scrollerThickness")||n.get("scrollerThickness"),a=this.get("contentView"),f,l=a?a.get("frame"):null,c=l?l.height:0,h=this.containerView.$()[0],p=this.get("verticalScrollOffset"),d={height:0,top:0,right:0,left:0},v={height:u,top:0,right:0,left:0},m={height:u,bottom:0,right:0,left:0},g={height:0,bottom:0,right:0,left:0};h&&(o=h.offsetHeight),p===0?(s.top=0,s.bottom=u,t.set("layout",d),n.set("layout",m)):p>=c-o-u?(s.top=u,s.bottom=0,t.set("layout",v),n.set("layout",g)):(s.top=u,s.bottom=u,t.set("layout",v),n.set("layout",m))}t&&(t.set("isVisible",r),n.set("isVisible",r)),i.set("layout",s)},scrollerVisibilityDidChange:function(){this.tile()}.observes("isVerticalScrollerVisible","isHorizontalScrollerVisible","verticalScrollOffset"),createChildViews:function(){var e=[],t,n,r=this.get("controlSize");SC.none(t=this.containerView)&&(t=SC.ContainerView),e.push(this.containerView=this.createChildView(t,{contentView:this.contentView})),this.contentView= this.containerView.get("contentView"),(t=this.verticalScrollerView)&&(n=this.verticalScrollerView2)&&(this.get("hasVerticalScroller")?(t=this.verticalScrollerView=this.createChildView(t,{layout:{top:0,left:0,right:0},controlSize:r,valueBinding:"*owner.verticalScrollOffset"}),e.push(t),n=this.verticalScrollerView2=this.createChildView(n,{scrollDown:YES,layout:{bottom:0,left:0,right:0},controlSize:r,valueBinding:"*owner.verticalScrollOffset"}),e.push(n)):(this.verticalScrollerView=null,this.verticalScrollerView2=null)),this.childViews=e,this.contentViewFrameDidChange(),this.tile()},init:function(){arguments.callee.base.apply(this,arguments),this._scroll_contentView=this.get("contentView");var e=this._scroll_contentView;e&&e.addObserver("frame",this,this.contentViewFrameDidChange),this.get("isVisibleInWindow")&&this._scsv_registerAutoscroll()},_scsv_registerAutoscroll:function(){this.get("isVisibleInWindow")?SC.Drag.addScrollableView(this):SC.Drag.removeScrollableView(this)}.observes("isVisibleInWindow"),contentViewFrameDidChange:function(){var e=this.get("contentView"),t,n=e?e.get("frame"):null,r=n?n.width:0,i=n?n.height:0,s=this.get("frame"),o,u;this._scroll_contentWidth=r,this._scroll_contentHeight=i,this.get("hasVerticalScroller")&&(e=this.get("verticalScrollerView"))&&(t=this.get("verticalScrollerView2"))&&(i-=1,this.get("autohidesVerticalScroller")&&this.set("isVerticalScrollerVisible",i>s.height),i-=this.get("verticalScrollerBottom"),o=0,u=this.containerView.$()[0],u&&(o=u.offsetHeight),i-=o,e.setIfChanged("maximum",i),t.setIfChanged("maximum",i))},_scroll_horizontalScrollOffsetDidChange :function(){},_scroll_verticalScrollOffsetDidChange:function(){this.adjustElementScroll()}.observes("verticalScrollOffset")}),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(),this.get("shouldLoadInBackground")&&SC.backgroundTaskQueue.push(SC.PopupButtonMenuLoader.create({popupButton:this}))},_setupMenu:function(){var e=this.get("instantiatedMenu");this.isActiveBinding&&this.isActiveBinding.disconnect(),this.isActiveBinding=null,e&&!e.isClass&&(this.isActiveBinding=this.bind("isActive",e,"isVisibleInWindow"))},_popup_menuDidChange:function(){this._setupMenu()}.observes("menu"),isActive:NO,_instantiateMenu:function(){var e=this.get("menu");if(!e||!e.isClass)return;this.menu=e.create(),this._setupMenu()},instantiatedMenu:function(){var e=this.get("menu");return e&&e.isClass&&(this._instantiateMenu(),e=this.get("menu")),e}.property("menu").cacheable(),action:function(e){var t=this.get("instantiatedMenu");return t?(t.popup(this,this.get("preferMatrix")),YES):NO},mouseDown:function(e){if(!this.get("isEnabled"))return YES;this._isMouseDown=YES,this._action(),this._menuRenderedTimestamp=0;var t=this;return setTimeout(function(){SC.run(function(){t._menuRenderedTimestamp=SC.getCurrentTimeForPerformance()})},1),this.becomeFirstResponder(),YES},mouseUp:function(e){var t=SC.getCurrentTimeForPerformance(),n=this._menuRenderedTimestamp,r=this.get("instantiatedMenu"),i=SC.platform.touch,s;return n===0&& (n=SC.getCurrentTimeForPerformance()),r&&(s=r.getPath("rootMenu.targetMenuItem"),s?s.performAction()||r.remove():!i&&t-n>SC.ButtonView.CLICK_AND_HOLD_DELAY&&r.remove()),this._isMouseDown=NO,arguments.callee.base.apply(this,arguments),YES},mouseExited:function(e){return YES},performKeyEquivalent:function(e,t){if(!this.get("isEnabled"))return NO;var n=this.get("instantiatedMenu");return!!n&&n.performKeyEquivalent(e,t,YES)}}),SC.PopupButtonMenuLoader=SC.Task.extend({popupButton:null,run:function(){this.popupButton&&this.popupButton._instantiateMenu()}}),SC.SliderView=SC.View.extend(SC.Control,{classNames:"sc-slider-view",ariaRole:"slider",value:.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:.1,decimalPrecisionScale:10,trackMargin:0,isAdjustableByMouseWheel:YES,layoutDirection:SC.LAYOUT_HORIZONTAL,displayProperties:["displayValue","ariaValue","minimum","maximum","step","frame","layoutDirection"],acceptsFirstResponder:function(){return SC.FOCUS_ALL_CONTROLS?this.get("isEnabled"):NO}.property("isEnabled"),didBecomeFirstResponder:function(){this.$(".sc-handle").focus()},willLoseFirstResponder:function(){this.$(".sc-handle").blur()},ariaValue:function(){return this.get("value")}.property("value").cacheable(),renderDelegateName:"sliderRenderDelegate",displayValue:function(){var e=this.get("minimum"),t=this.get("maximum"),n=this.get("value"),r=this.get("step");return n=Math.min(Math.max(n,e),t),!SC.none( r)&&r!==0&&(n=Math.round(n/r)*r),n!==0&&(n=Math.floor((n-e)/(t-e)*100)),n}.property("value","minimum","maximum","step").cacheable(),_isMouseDown:NO,mouseDown:function(e){return this.get("isEnabled")?(this.set("isActive",YES),this._isMouseDown=YES,this.becomeFirstResponder(),this._triggerHandle(e,YES)):YES},mouseDragged:function(e){return this._isMouseDown?this._triggerHandle(e):YES},mouseUp:function(e){this._isMouseDown&&this.set("isActive",NO);var t=this._isMouseDown?this._triggerHandle(e):YES;return this._isMouseDown=NO,t},mouseWheel:function(e){if(!this.get("isEnabled"))return YES;var t=this.get("minimum"),n=this.get("maximum"),r=this.get("step"),i=this.get("value")+(e.wheelDeltaX+e.wheelDeltaY)*r,s=Math.round(i/r)*r;return sn?this.setIfChanged("value",n):this.setIfChanged("value",s),YES},touchStart:function(e){return this.mouseDown(e)},touchEnd:function(e){return this.mouseUp(e)},touchesDragged:function(e){return this.mouseDragged(e)},_triggerHandle:function(e,t){var n=this.get("frame"),r=n.width,i=n.height,s=this.get("minimum"),o=this.get("maximum"),u=this.get("step"),a=this.get("value"),f=this.get("trackMargin"),l=this.get("layoutDirection"),c=l===SC.LAYOUT_HORIZONTAL,h,p;c?(p=r,t?(h=this.convertFrameFromView({x:e.pageX}).x,this._evtDiff=e.pageX-h):h=e.pageX-this._evtDiff):(p=i,t?(h=this.convertFrameFromView({y:e.pageY}).y,this._evtDiff=e.pageY-h):h=e.pageY-this._evtDiff),p-=2*f,h-=f,p<=0?(p=1,h=0):h/=p,c||(h=1-h);if(t){var d=this.get("value");d=(d-s)/(o-s),Math.abs(d*p-h*p)<16?this._offset=d-h:this._offset=0}h=Math.max(0,Math.min(h+this ._offset,1)),h=s+(o-s)*h,u!==0&&(h=Math.round(h/u)*u);var v=this.get("decimalPrecisionScale");return h=Math.round(h*v)/v,Math.abs(a-h)>=.01&&this.set("value",h),YES},keyDown:function(e){if(e.which===9||e.keyCode===9){var t=e.shiftKey?this.get("previousValidKeyView"):this.get("nextValidKeyView");return t?t.becomeFirstResponder():e.allowDefault(),YES}if(e.which>=33&&e.which<=40){var n=this.get("minimum"),r=this.get("maximum"),i=this.get("step"),s=r-n,o=0,u,a=this.get("value");if(e.which===34||e.which===37||e.which===40)i===0?s<100?o=a-1:(u=Math.abs(s/100),u<2&&(u=2),o=a-u):o=Math.round((a-i)*10)/10;if(e.which===33||e.which===38||e.which===39)i===0?s<100?o=a+2:(u=Math.abs(s/100),u<2&&(u=2),o=a+u):o=Math.round((a+i)*10)/10;if(e.which===38||e.which===39)e.altKey||(o=a+i*10);if(e.which===37||e.which===40)e.altKey||(o=a-i*10);return e.which===33&&(o=a+i*100),e.which===34&&(o=a-i*100),e.which===35&&(o=r),e.which===36&&(o=n),o>=n&&o<=r?this.set("value",o):or&&this.set("value",r),YES}return e.allowDefault(),NO},contentKeys:{contentValueKey:"value",contentMinimumKey:"minimum",contentMaximumKey:"maximum",contentIsIndeterminateKey:"isIndeterminate"}}),SC.StaticContentView=SC.View.extend(SC.StaticLayout,{classNames:["sc-static-content-view"],displayProperties:["content"],content:null,contentLayoutDidChange:function(){this._viewFrameDidChange()},useStaticLayout:YES,frame:function(){var e=this.get("layer"),t;return e?e.getBoundingClientRect&&!SC.browser.isIE8OrLower?(t=e.getBoundingClientRect(),{x:0,y:0,width:t.width,height:t.height}):{x:0,y:0,width:e.clientWidth,height :e.clientHeight}:{x:0,y:0,width:0,height:0}}.property("content").cacheable(),parentViewDidResize:function(){this.contentLayoutDidChange()},didUpdateLayer:function(){this.contentLayoutDidChange()},render:function(e,t){var n=this.get("content");n&&e.push(n||"")},touchStart:function(e){return e.allowDefault(),YES},touchEnd:function(e){return e.allowDefault(),YES}}),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 e=this.get("contentView");e&&(e=this.contentView=this.createChildView(e),e.set("layout",this.contentLayout),this.childViews=[e])},contentViewDidChange:function(){var e=this.get("contentView");e.set("layout",this.contentLayout),this.replaceContent(e)}.observes("contentView")}),SC.MIXED_STATE="__MIXED__",SC.DataSource=SC.Object.extend({fetch:function(e,t){return NO},retrieveRecords:function(e,t,n){return this._handleEach(e,t,this.retrieveRecord,n)},commitRecords:function(e,t,n,r,i){var s,o,u;return t.length>0&&(u=this.createRecords.call(this,e,t,i)),n.length>0&&(s=this.updateRecords.call(this,e,n,i),u=SC.none(u)?s:u===s?u:SC.MIXED_STATE),r.length>0&&(o=this.destroyRecords.call(this,e,r,i),u=SC.none(u)?o:u===o?u:SC.MIXED_STATE),u||NO},cancel:function(e,t){return NO},updateRecords:function(e,t,n){return this._handleEach(e,t,this.updateRecord,null,n)},createRecords:function(e,t,n){return this._handleEach(e,t,this.createRecord ,null,n)},destroyRecords:function(e,t,n){return this._handleEach(e,t,this.destroyRecord,null,n)},_handleEach:function(e,t,n,r,i){var s=t.length,o,u,a,f;for(o=0;o=0)n=e[t],SC.typeOf(n)===SC.T_STRING&& (e[t]=this.get(n))},_handleResponse:function(e,t){return t===YES?YES:e===NO?t===NO?NO:SC.MIXED_STATE:SC.MIXED_STATE}}),SC.Query=SC.Object.extend(SC.Copyable,SC.Freezable,{isQuery:YES,conditions:null,orderBy:null,recordType:null,recordTypes:null,expandedRecordTypes:function(){var e=SC.CoreSet.create(),t,n;return(t=this.get("recordType"))?this._scq_expandRecordType(t,e):(t=this.get("recordTypes"))?t.forEach(function(t){this._scq_expandRecordType(t,e)},this):this._scq_expandRecordType(SC.Record,e),n=SC.Query._scq_queriesWithExpandedRecordTypes,n||(n=SC.Query._scq_queriesWithExpandedRecordTypes=SC.CoreSet.create()),n.add(this),e.freeze()}.property("recordType","recordTypes").cacheable(),_scq_expandRecordType:function(e,t){if(t.contains(e))return;t.add(e),SC.typeOf(e)===SC.T_STRING&&(e=SC.objectForPropertyPath(e)),e.subclasses.forEach(function(e){this._scq_expandRecordType(e,t)},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(e,t){var n,r=YES;if(n=this.get("recordTypes"))r=n.find(function(t){return SC.kindOf(e,t)});else if(n=this.get("recordType"))r=SC.kindOf(e,n);if(!r)return NO;var i=this.get("scope");return i&&!i.contains(e)?NO:(this._isReady||this.parse(),this._isReady?(t===undefined&&(t=this.parameters||this),this._tokenTree.evaluate(e,t)):NO)},containsRecordTypes:function(e){var t=this.get("recordType");return t?!!e.find(function(e){return SC.kindOf (e,t)}):(t=this.get("recordTypes"))?!!t.find(function(t){return!!e.find(function(e){return SC.kindOf(e,t)})}):YES},compare:function(e,t){var n=0,r,i,s,o;if(e===t)return 0;this._isReady||this.parse();if(!this._isReady)return SC.compare(e.get("id"),t.get("id"));i=this._order;if(SC.typeOf(i)===SC.T_FUNCTION)n=i.call(null,e,t);else{s=i?i.length:0;for(o=0;n===0&&o=0)r=t[n],i=this.get(r),i!==undefined&&(e[r]=i);return s=this.constructor.create(e),e=null,s},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,t){var n=this.tokenValue.split("."),r=n.length;if(r<2)return e.get(this.tokenValue );var i=e;for(var s=0;s":{reservedWord:!0,leftType:"PRIMITIVE",rightType:"PRIMITIVE",evalType:"BOOLEAN",evaluate:function(e,t){var n=this.leftSide.evaluate(e,t),r=this.rightSide.evaluate(e,t);return SC.compare(n,r)==1}},">=":{reservedWord:!0,leftType:"PRIMITIVE",rightType:"PRIMITIVE",evalType:"BOOLEAN",evaluate:function(e,t){var n=this.leftSide.evaluate(e,t),r=this.rightSide.evaluate(e,t);return SC.compare(n,r)!=-1}},BEGINS_WITH:{reservedWord:!0,leftType:"PRIMITIVE",rightType:"PRIMITIVE",evalType:"BOOLEAN",evaluate:function(e,t){var n=this.leftSide.evaluate(e,t),r=this.rightSide.evaluate(e,t);return n&&n.indexOf(r)===0}},ENDS_WITH:{reservedWord:!0,leftType:"PRIMITIVE",rightType:"PRIMITIVE",evalType:"BOOLEAN",evaluate:function(e,t){var n=this.leftSide.evaluate(e,t),r=this.rightSide.evaluate(e,t);return n&&n.indexOf(r)===n.length-r.length}},CONTAINS:{reservedWord:!0,leftType:"PRIMITIVE",rightType:"PRIMITIVE",evalType:"BOOLEAN",evaluate:function(e,t){var n=this.leftSide.evaluate(e,t)||[],r=this.rightSide.evaluate(e,t),i=SC.typeOf(n);if(i===SC.T_STRING)return n.indexOf(r)!==-1;if(i===SC.T_ARRAY||n.toArray){i!==SC.T_ARRAY&&(n=n.toArray());var s=!1,o=0;while(s===!1&&o0?!0:!1}function h(e){var t=e;return t<0?!0:a("left",t)&&!n[t].leftSide||a("right",t)&&!n[t].rightSide}function p(e,t){var n=t0?{error:o.join(",\n"),tree :n}:n},buildOrder:function(e){if(!e)return[];if(SC.typeOf(e)===SC.T_FUNCTION)return e;var t=e.split(",");for(var n=0;n=0)n[r].recordPropertyDidChange(t)}},normalize:function(e){var t=this.primaryKey,n=this.get("id"),r=this.get("store"),i=this.get("storeKey"),s={},o,u,a,f,l,c,h,p,d,v,m,g=r.readEditableDataHash(i)||{};g[t]=n,f=r.readDataHash(i);for(o in this)u=this[o],u&&(a=u.typeClass,a&&(v=u.get("key")||o,s[v]=YES,h=SC.typeOf(a.call(u))===SC.T_CLASS,p=u.isNestedRecordTransform,!h&&!p?(l=this.get(o),l===undefined||l===null&&!e?e||(s[v]= NO):(m=this[o],SC.instanceOf(m,SC.RecordAttribute)&&(l=m.fromType(this,o,l)),g[v]=l)):p?(l=this.get(o),l&&l.normalize&&l.normalize()):h&&(l=f[v],l!==undefined?g[v]=l:(d=u.get("defaultValue"),SC.typeOf(d)===SC.T_FUNCTION?g[v]=d(this,o,d):g[v]=d))));for(o in g)s[o]||(SC.debug("%@: Deleting key from underlying data hash due to normalization: %@",this,o),delete g[o]);return this},unknownProperty:function(e,t){if(t!==undefined){var n=this.get("storeKey"),r=SC.Store.recordTypeFor(n);if(r.ignoreUnknownProperties===YES)return this[e]=t,t;var i=this.get("primaryKey");this.writeAttribute(e,t),e===i&&SC.Store.replaceIdFor(n,t)}return this.readAttribute(e)},commitRecord:function(e,t,n){var r=this.get("store"),i,s,o=this.get("storeKey"),u=r.parentStoreKeyExists();return s=t||SC.none(t)&&SC.none(u),s?r.commitRecord(undefined,undefined,this.get("storeKey"),e,n):u&&(i=r.materializeRecord(u),i.commitRecord(e,t,n)),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 e=this.get("store");return e.readError(this.get("storeKey"))||SC.Record.GENERIC_ERROR}return null}.property("isError").cacheable(),set:function(e,t){var n=this[e];return n&&n.isProperty&&n.get&&!n.get("isEditable")?this:arguments.callee.base.apply(this,arguments)},toString:function(){var e=this.get("store").readDataHash(this.get("storeKey"));return"%@(%@) %@".fmt(this.constructor.toString(),SC.inspect(e),this.statusString ())},statusString:function(){var e=[],t=this.get("status");for(var n in SC.Record)n.match(/[A-Z_]$/)&&SC.Record[n]===t&&e.push(n);return e.join(" ")},registerNestedRecord:function(e,t,n){var r,i,s,o,u;return SC.none(n)&&(n=t),e&&e.get&&e.get("isRecord")?o=e:(u=this._materializeNestedRecordType(e,t),o=this.createNestedRecord(u,e)),o&&(this.isParentRecord=YES,r=this.get("store"),i=this.get("storeKey"),s=o.get("storeKey"),r.registerChildToParent(i,s,n)),o},_materializeNestedRecordType:function(e,t){var n,r,i;SC.typeOf(e)===SC.T_HASH&&(n=this.get("nestedRecordNamespace"),e.type&&!SC.none(n)&&(r=n[e.type])),!r&&t&&this[t]&&(r=this[t].get("typeClass"));if(!r||!SC.kindOf(r,SC.Record))throw"SC.Child: Error during transform: Invalid record type.";return r},createNestedRecord:function(e,t){var n,r,i,s,o=null,u=null;return SC.run(function(){t=t||{},u=t[e.prototype.primaryKey],n=this.get("store");if(SC.none(n))throw"Error: during the creation of a child record: NO STORE ON PARENT!";!r&&(s=e.prototype.primaryKey)&&(r=t[s],i=r?n.storeKeyExists(e,r):null,i?(n.writeDataHash(i,t),o=n.materializeRecord(i)):(o=n.createRecord(e,t),SC.none(r)&&(i=o.get("storeKey"),r="cr"+i,SC.Store.replaceIdFor(i,r),t=n.readEditableDataHash(i),t[s]=r))),SC.none(u)&&this.generateIdForChild&&this.generateIdForChild(o)},this),o},_nestedRecordKey:0,generateIdForChild:function(e){}}),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"),_nextChildKey:0,attr:function(e,t){return SC.RecordAttribute.attr(e,t)},fetch:function(e,t){return SC.FetchedAttribute.attr(e,t)},toMany:function(e,t){t=t||{};var n=t.nested||t.isNested,r;return n?r=SC.ChildrenAttribute.attr(e,t):r=SC.ManyAttribute.attr(e,t),r},toOne:function(e,t){t=t||{};var n=t.nested||t.isNested,r;return n?r=SC.ChildAttribute.attr(e,t):r=SC.SingleAttribute.attr(e,t),r},storeKeysById:function(){var e=SC.keyFor("storeKey",SC.guidFor(this)),t=this[e];return t||(t=this[e]={}),t},storeKeyFor:function(e){var t=this.storeKeysById(),n=t[e];return n||(n=SC.Store.generateStoreKey(),SC.Store.idsByStoreKey[n]=e,SC.Store.recordTypesByStoreKey[n]=this,t[e]=n),n},storeKeyExists:function(e){var t=this.storeKeysById(),n=t[e];return n},find:function(e,t){return e.find(this,t)},extend:function(){var e=SC.Object.extend.apply(this,arguments);return SC.Query&&SC.Query._scq_didDefineRecordType(e),e}}),SC.FixturesDataSource=SC.DataSource.extend({simulateRemoteResponse:NO,latency:50,cancel:function(e,t){return NO},fetch:function(e,t){if(t.get("location")!==SC.Query.LOCAL)throw SC.$error("SC.Fixture data source can only fetch local queries");if(!t.get("recordType")&&!t.get("recordTypes"))throw SC.$error("SC.Fixture data source can only fetch queries with one or more record types" );this.get("simulateRemoteResponse")?this.invokeLater(this._fetch,this.get("latency"),e,t):this._fetch(e,t)},_fetch:function(e,t){var n=t.get("recordType"),r=t.get("recordTypes")||[n];r.forEach(function(t){SC.typeOf(t)===SC.T_STRING&&(t=SC.objectForPropertyPath(t)),t&&this.loadFixturesFor(e,t)},this),e.dataSourceDidFetchQuery(t)},retrieveRecords:function(e,t){var n=this.get("latency"),r=this.hasFixturesFor(t);return r?(this.get("simulateRemoteResponse")?this.invokeLater(this._retrieveRecords,n,e,t):this._retrieveRecords(e,t),r):r},_retrieveRecords:function(e,t){t.forEach(function(t){var n=[],r=SC.Store.recordTypeFor(t),i=e.idFor(t),s=this.fixtureForStoreKey(e,t);n.push(t),e.dataSourceDidComplete(t,s,i)},this)},updateRecords:function(e,t,n){var r=this.get("latency"),i=this.hasFixturesFor(t);return i?(this.get("simulateRemoteResponse")?this.invokeLater(this._updateRecords,r,e,t):this._updateRecords(e,t),i):i},_updateRecords:function(e,t){t.forEach(function(t){var n=e.readDataHash(t);this.setFixtureForStoreKey(e,t,n),e.dataSourceDidComplete(t)},this)},createRecords:function(e,t,n){var r=this.get("latency");return this.get("simulateRemoteResponse")?this.invokeLater(this._createRecords,r,e,t):this._createRecords(e,t),YES},_createRecords:function(e,t){t.forEach(function(t){var n=e.idFor(t),r=e.recordTypeFor(t),i=e.readDataHash(t),s=this.fixturesFor(r);n||(n=this.generateIdFor(r,i,e,t)),this._invalidateCachesFor(r,t,n),s[n]=i,e.dataSourceDidComplete(t,null,n)},this)},destroyRecords:function(e,t,n){var r=this.get("latency"),i=this.hasFixturesFor(t);return i?(this.get("simulateRemoteResponse" )?this.invokeLater(this._destroyRecords,r,e,t):this._destroyRecords(e,t),i):i},_destroyRecords:function(e,t){t.forEach(function(t){var n=e.idFor(t),r=e.recordTypeFor(t),i=this.fixturesFor(r);this._invalidateCachesFor(r,t,n),n&&delete i[n],e.dataSourceDidDestroy(t)},this)},loadFixturesFor:function(e,t,n){var r=[],i,s,o;i=this.fixturesFor(t);for(s in i)o=t.storeKeyFor(s),e.peekStatus(o)===SC.Record.EMPTY&&r.push(i[s]),n&&n.push(o);return r&&r.length>0&&e.loadRecords(t,r),this},generateIdFor:function(e,t,n,r){return"@id%@".fmt(SC.Store.generateStoreKey())},fixtureForStoreKey:function(e,t){var n=e.idFor(t),r=e.recordTypeFor(t),i=this.fixturesFor(r);return i?i[n]:null},setFixtureForStoreKey:function(e,t,n){var r=e.idFor(t),i=e.recordTypeFor(t),s=this.fixturesFor(i);return this._invalidateCachesFor(i,t,r),s[r]=n,this},fixturesFor:function(e){this._fixtures||(this._fixtures={});var t=this._fixtures[SC.guidFor(e)];if(t)return t;var n=e?e.FIXTURES:null,r=n?n.length:0,i=e?e.prototype.primaryKey:"guid",s,o,u;this._fixtures[SC.guidFor(e)]=t={};for(s=0;s0?t===NO&&(t=YES):t===YES&&(t=SC.MIXED_STATE)}},this),t},_invalidateCachesFor:function(e,t,n){var r=this._storeKeyCache;return r&&delete r[SC.guidFor (e)],this}}),SC.Record.fixtures=SC.FixturesDataSource.create(),SC.RelationshipSupport={_srs_inverseDidRelinquishRelationships:function(e,t,n,r){t.forEach(function(t){this._srs_inverseDidRelinquishRelationship(e,t,n,r)},this)},_srs_inverseDidRelinquishRelationship:function(e,t,n,r){var i=e.storeKeyFor(t),s=this.readDataHash(i),o=n.inverse,u=e.prototype;if(!s||!o)return;SC.instanceOf(u[o],SC.SingleAttribute)?delete s[o]:SC.instanceOf(u[o],SC.ManyAttribute)&&SC.typeOf(s[o])===SC.T_ARRAY&&s[o].removeObject(r),this.pushRetrieve(e,t,s,undefined,!0)},_srs_inverseDidAddRelationships:function(e,t,n,r){t.forEach(function(t){this._srs_inverseDidAddRelationship(e,t,n,r)},this)},_srs_inverseDidAddRelationship:function(e,t,n,r){var i=e.storeKeyFor(t),s=this.readDataHash(i),o=this.peekStatus(i),u=e.prototype,a=n.inverse,f=u[a],l=u[u.primaryKey],c=!1;f=f&&f.get&&f.get("key")||f.key||a,o===SC.Record.EMPTY&&(SC.typeOf(n.lazilyInstantiate)===SC.T_FUNCTION&&n.lazilyInstantiate()||SC.typeOf(n.lazilyInstantiate)!==SC.T_FUNCTION&&n.lazilyInstantiate)&&(!SC.none(l)&&l.typeClass&&SC.typeOf(l.typeClass())===SC.T_CLASS&&(c=!0),s={},s[u.primaryKey]=t);if(!s||!a)return;SC.instanceOf(u[a],SC.SingleAttribute)?s[f]=r:SC.instanceOf(u[a],SC.ManyAttribute)&&(s[f]=s[f]||[],s[a].indexOf(r)<0&&s[f].push(r)),this.pushRetrieve(e,t,s,undefined,!c)},_srs_pushIterator:function(e,t,n,r){var i=e.prototype,s,o,u,a;typeof n=="undefined"&&(n=e.storeKeyFor(t)),o=this.readDataHash(n)||{};for(u in i){s=i[u];if(s&&s.typeClass&&s.inverse&&s.isMaster){a=s.typeClass();if(SC.typeOf(a)!==SC.T_CLASS)continue;r.apply(this,[a,o,s,s.get&& s.get("key")||u])}}},pushDestroy:function(e,t,n,r){var i;return this._srs_pushIterator(t,n,r,function(e,t,r,s){i=[t[s]||null].flatten().compact().uniq(),this._srs_inverseDidRelinquishRelationships(e,i,r,n)}),e(t,n,r)}.enhance(),pushRetrieve:function(e,t,n,r,i,s){if(!s){var o,u;this._srs_pushIterator(t,n,i,function(e,t,i,s){o=[t[s]||null].flatten().compact().uniq(),u=[r[s]||null].flatten().compact().uniq(),this._srs_inverseDidRelinquishRelationships(e,o.filter(function(e){return u.indexOf(e)===-1}),i,n),this._srs_inverseDidAddRelationships(e,u,i,n)})}return i=i||t.storeKeyFor(n),e(t,n,r,i)}.enhance()},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 e=this.get("type");return SC.typeOf(e)===SC.T_STRING&&(e=SC.requiredObjectForPropertyPath(e)),e}.property("type").cacheable(),transform:function(){var e=this.get("typeClass")||String,t=SC.RecordAttribute.transforms,n;while(e&&!(n=t[SC.guidFor(e)]))e.superclass.hasOwnProperty("create")?e=e.superclass:e=SC.T_FUNCTION;return n}.property("typeClass").cacheable(),toType:function(e,t,n){var r=this.get("transform"),i=this.get("typeClass"),s;if(r&&r.to){n=r.to(n,this,i,e,t);if(!SC.none(n)&&(s=r.observesChildren)){var o,u=s.length,a={record:e,key:t};for(o=0;o=u?undefined:(r=n.objectAt(e),r?(t[e]=i=o.registerNestedRecord(r,s,s+"."+e),i):undefined)):undefined},replace:function(e,t,n){var r=this.get("editableChildren"),i=n?n.get?n.get("length"):n.length:0,s=this.get("record"),o,u=this.get("propertyName"),a,f;return o=this._processRecordsToHashes(n),r.replace(e,t,o),o!==this._prevChildren&&(this._performRecordPropertyChange(null,!1),this.arrayContentWillChange(e,t,i),this._childrenContentDidChange(e,t,i)),s.recordDidChange(u),this},_processRecordsToHashes:function(e){var t,n;return e=e||[],e.forEach(function(r,i){r.isNestedRecord&&(t=r.get("store"),n=r.storeKey,e[i]=t.readDataHash(n))}),e},normalize:function(){this.forEach(function(e,t){e.normalize&&e.normalize()})},recordPropertyDidChange:function(e){return this._performRecordPropertyChange(e,!0),this},_performRecordPropertyChange:function(e,t){if(e&&!e.contains(this.get("propertyName")))return this;var n=this.get("readOnlyChildren"),r=0,i=0,s=this._prevChildren,o=this._childrenContentDidChange;return t=SC.none (t)?!0:t,n===s?this:(s&&(s.removeArrayObservers({target:this,willChange:this.arrayContentWillChange,didChange:o}),r=s.get("length")),n&&(n.addArrayObservers({target:this,willChange:this.arrayContentWillChange,didChange:o}),i=n.get("length")),this._prevChildren=n,t&&(this.arrayContentWillChange(0,r,i),this._childrenContentDidChange(0,r,i)),this)},_childrenContentDidChange:function(e,t,n){this._records=null,this.arrayContentDidChange(e,t,n)},init:function(){arguments.callee.base.apply(this,arguments),this.recordPropertyDidChange()}}),SC.ChildrenAttribute=SC.ChildAttribute.extend({toType:function(e,t,n){var r=this.get("key")||t,i=SC.keyFor("__kidsArray__",SC.guidFor(this)),s=e[i],o=this.get("typeClass"),u;return s||(s=SC.ChildArray.create({record:e,propertyName:r,defaultRecordType:o}),e[i]=s,u=e.get("relationships"),u||e.set("relationships",u=[]),u.push(s)),s},fromType:function(e,t,n){var r,i,s=SC.keyFor("__kidsArray__",SC.guidFor(this)),o=e[s];return e&&(e.writeAttribute(t,n),o&&(o=o.recordPropertyDidChange())),o}}),SC.FetchedAttribute=SC.RecordAttribute.extend({paramValueKey:"link",paramOwnerKey:"owner",paramRelKey:"rel",queryKey:null,isEditable:NO,toType:function(e,t,n){var r=e.get("store");if(!r)return null;var i=this.get("paramValueKey"),s=this.get("paramOwnerKey"),o=this.get("paramRelKey"),u=this.get("queryKey")||this.get("typeClass"),a={};return i&&(a[i]=n),s&&(a[s]=e),o&&(a[o]=this.get("key")||t),r.findAll(u,a)},fromType:function(e,t,n){return n}}),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(),readOnlyStoreIds:function(){return this.get("record").readAttribute(this.get("propertyName"))}.property(),editableStoreIds:function(){var e=this.get("store"),t=this.get("storeKey"),n=this.get("propertyName"),r,i;return r=e.readEditableProperty(t,n),r||(i=e.readEditableDataHash(t),r=i[n]=[]),r!==this._prevStoreIds&&this.recordPropertyDidChange(),r}.property(),isEditable:function(){var e=this.manyAttribute;return e?e.get("isEditable"):NO}.property("manyAttribute").cacheable(),inverse:function(){var e=this.manyAttribute;return e?e.get("inverse"):null}.property("manyAttribute").cacheable(),isMaster:function(){var e=this.manyAttribute;return e?e.get("isMaster"):null}.property("manyAttribute").cacheable(),orderBy:function(){var e=this.manyAttribute;return e?e.get("orderBy"):null}.property("manyAttribute").cacheable(),length:function(){var e=this.get("readOnlyStoreIds");return e?e.get("length"):0}.property("readOnlyStoreIds"),objectAt:function(e){var t=this._records,n=this.get("readOnlyStoreIds"),r=this.get("store"),i=this.get("recordType"),s,o,u;return!n||!r?undefined:t&&(o=t[e])?o:(t||(this._records=t=[]),u=n.objectAt(e),u&&(s=r.storeKeyFor(i,u),r.readStatus(s)===SC.Record.EMPTY&&r.retrieveRecord(i,null,s),t[e]=o=r.materializeRecord(s)),o)},replace:function(e,t,n){if(!this.get("isEditable"))throw"%@.%@[] is not editable".fmt(this.get("record"),this.get("propertyName"));var r=this.get("editableStoreIds"),i= n?n.get?n.get("length"):n.length:0,s=this.get("record"),o=this.get("propertyName"),u,a,f,l,c,h,p;f=[];for(u=0;u0){l=SC.ManyArray._toRemove,l?SC.ManyArray._toRemove=null:l=[];for(u=0;u=0&&(n.removeAt(r),this.get("isMaster")&&(i=this.get("record"))&&i.recordDidChange(this.get("propertyName"))),this},addInverseRecord:function(e){if(!e)return this;var t=e.get("id"),n=this.get("editableStoreIds"),r=this.get("orderBy"),i=n.get("length"),s,o;return r?s=this._findInsertionLocation(e,0,i,r):s=i,n.insertAt(s,e.get("id")),this.get("isMaster")&&(o=this.get("record"))&&o.recordDidChange(this.get("propertyName")),this},_findInsertionLocation:function(e,t,n,r){var i=t+Math.floor((n-t)/2),s=this.objectAt(i),o=this._compare(e,s,r);return o<0?i===0?i:this._findInsertionLocation(e,0,i,r):o>0?i>=n?i:this._findInsertionLocation(e,i,n,r):i},_compare:function(e,t,n){var r=SC.typeOf(n),i,s,o;if(r===SC.T_FUNCTION)i=n(e,t);else if(r===SC.T_STRING)i=SC.compare(e,t);else{o=n.get("length" ),i=0;for(s=0;i===0&&s0&&this._notifyRecordArrays(t,s),t.clear(),n.clear(),r.clear(),this.recordPropertyChanges.propertyForStoreKeys={},this},reset:function(){this.dataHashes={},this.revisions={},this.statuses={},this.chainedChanges=this.locks=this.editables=null,this.changelog=null,this.recordErrors=null,this.queryErrors=null;var e=this.get("dataSource");e&&e.reset&&e.reset();var t=this.records,n;if(t)for(n in t){if(!t.hasOwnProperty(n))continue;this._notifyRecordPropertyChange(parseInt(n,10),NO)}this.set("hasChanges",NO)},commitChangesFromNestedStore:function(e,t,n){n||this._verifyLockRevisions(t,e.locks);var r=t.length,i,s,o,u,a,f,l,c,h,p,d,v,m;f=this.revisions,o=this.dataHashes,u=this.statuses,a=this.editables,l=this.parentRecords?this.parentRecords:this.parentRecords={},c=this.childRecords?this.childRecords:this.childRecords={},a||(a=this.editables=[]),h=e.dataHashes,d=e.revisions,p=e.statuses,v=e.parentRecords||{},m=e.childRecords||{};for(i=0;i0?s=SC.RecordArray.create({store:this,storeKeys:t}):s=t,s},_TMP_REC_ATTRS:{},materializeRecord:function(e){var t=this.records,n,r,i;return t||(t=this.records={}),n=t[e],n?n:(r=SC.Store.recordTypeFor(e),r?(i=this._TMP_REC_ATTRS,i.storeKey=e,i.store=this,n=t[e]=r.create(i),n):null)},createRecord:function(e,t,n){var r,i,s,o=SC.Record,u,a,f;!n&&(r=e.prototype.primaryKey)&&(n=t[r],a=e.prototype[r]?e.prototype[r].defaultValue:null,!n&&SC.typeOf(a)===SC.T_FUNCTION&&(n=t[r]=a())),i=n?e.storeKeyFor(n):SC.Store.generateStoreKey(),s=this.readStatus(i);if(s&o.BUSY||s&o.READY||s===o.DESTROYED_DIRTY)throw n?o.RECORD_EXISTS_ERROR:o.BAD_STATE_ERROR;if(!!n||s!==SC.DESTROYED_CLEAN&&s!==SC.ERROR)return this.writeDataHash(i,t?t:{},o.READY_NEW),SC.Store.replaceRecordTypeFor(i,e),this.dataHashDidChange(i),u=this.changelog,u||(u=SC.Set.create()),u.add(i),this.changelog=u,this.get("commitRecordsAutomatically")&&this.invokeLast(this.commitRecords),f=this.materializeRecord(i),f&&f.propagateToAggregates(),f;throw o.BAD_STATE_ERROR},createRecords:function(e,t,n){var r=[],i,s,o,u=t.length,a;o=SC.typeOf(e)===SC.T_ARRAY,o||(i=e);for(a=0;a0},commitRecords:function(e,t,n,r,i){var s=this._getDataSource(),o=SC.typeOf(e)===SC.T_ARRAY,u=SC.typeOf(i)===SC.T_ARRAY,a=[],f=[],l=[],c=SC.Store.generateStoreKey(),h=SC.Record,p,d,v,m,g,y,b,w;!e&&!t&&!n&&(n=this.changelog),b=n?n.get("length"):t?t.get("length"):0;for(d=0;d0||r)&&(y=s.commitRecords.call(s,this,a,f,l,r)),y&&!e&&!t&&(n===this.changelog?this.changelog=null:this.changelog.removeEach(n)),y},commitRecord:function(e,t,n,r,i){var s=this._TMP_RETRIEVE_ARRAY,o;return t===undefined&&n===undefined?NO:(n!==undefined?(s[0]=n,n=s,t=null):(s[0]=t,t=s),o=this.commitRecords(e,t,n,r,i),s.length=0,o)},cancelRecords:function(e,t,n){var r=this._getDataSource(),i=SC.typeOf(e)===SC.T_ARRAY,s=SC.Record,o=[],u,a,f,l,c,h;a=n===undefined?t.length:n.length;for(f=0;f=0)r[i]._scstore_dataSourceDidFetchQuery(e,NO);return this},dataSourceDidCancelQuery:function(e){return this._scstore_dataSourceDidCancelQuery(e,YES)},_scstore_dataSourceDidCancelQuery:function(e,t){var n=this._findQuery(e,t,NO),r=this.get("nestedStores"),i=r?r.get("length"):0;n&&n.storeDidCancelQuery(e);while(--i>=0)r[i]._scstore_dataSourceDidCancelQuery(e,NO);return this},dataSourceDidErrorQuery:function(e,t){var n=this.queryErrors;return t&&t.isError&&(n||(n=this.queryErrors={}),n[SC.guidFor(e)]=t),this._scstore_dataSourceDidErrorQuery(e,YES)},_scstore_dataSourceDidErrorQuery:function(e,t){var n=this._findQuery(e,t,NO),r=this.get("nestedStores"),i=r?r.get("length"):0;n&&n.storeDidErrorQuery(e);while(--i>=0)r[i]._scstore_dataSourceDidErrorQuery(e,NO);return this},init:function(){arguments.callee.base.apply(this,arguments),this.reset()},toString:function(){var e=this.get("name");if(!e)return arguments.callee.base.apply(this,arguments);var t= arguments.callee.base.apply(this,arguments);return"%@ (%@)".fmt(e,t)},idFor:function(e){return SC.Store.idFor(e)},recordTypeFor:function(e){return SC.Store.recordTypeFor(e)},storeKeyFor:function(e,t){return e.storeKeyFor(t)},storeKeyExists:function(e,t){return e.storeKeyExists(t)},storeKeysFor:function(e){var t=[],n=e&&e.isEnumerable,r,i,s;if(!this.statuses)return t;for(i in SC.Store.recordTypesByStoreKey)r=SC.Store.recordTypesByStoreKey[i],n?s=e.contains(r):s=r===e,s&&this.statuses[i]&&t.push(parseInt(i,10));return t},storeKeys:function(){var e=[],t;if(!this.statuses)return e;for(t in this.statuses)this.statuses[t]!=SC.Record.EMPTY&&e.push(parseInt(t,10));return e},statusString:function(e){var t=this.materializeRecord(e);return t.statusString()}}),SC.Store.mixin({CHAIN_CONFLICT_ERROR:new Error("Nested Store Conflict"),NO_PARENT_STORE_ERROR:new Error("Parent Store Required"),NESTED_STORE_UNSUPPORTED_ERROR:new Error("Unsupported In Nested Store"),NESTED_STORE_RETRIEVE_DIRTY_ERROR:new 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(e){return this.idsByStoreKey[e]},queryFor:function(e){return this.queriesByStoreKey[e]},recordTypeFor:function(e){return this.recordTypesByStoreKey[e]},replaceIdFor:function(e,t){var n=this.idsByStoreKey[e],r,i;if(n!==t){r=this.recordTypeFor(e);if(!r)throw new Error("replaceIdFor: storeKey %@ does not exist".fmt(e));this.idsByStoreKey[e]=t, i=r.storeKeysById(),delete i[n],i[t]=e}return this},replaceRecordTypeFor:function(e,t){return this.recordTypesByStoreKey[e]=t,this}}),SC.Store.prototype.nextStoreIndex=1,SC.Store._getDefaultStore=function(){var e=this._store;return e||(this._store=e=SC.Store.create()),e},SC.Store.updateRecords=function(e,t,n,r){SC.Logger.warn("SC.Store.updateRecords() is deprecated. Use loadRecords() instead");var i=this._getDefaultStore(),s=e.length,o,u;if(!n){n=[];for(o=0;ou)&&this._notifyRecordPropertyChange(parseInt(s,10))}}return this.reset(),this.flush(),this},destroy:function(){this.discardChanges();var e=this.get("parentStore");return e&& e.willDestroyNestedStore(this),arguments.callee.base.apply(this,arguments),this},reset:function(){var e,t,n,r=this.get("parentStore");if(!r)throw SC.Store.NO_PARENT_STORE_ERROR;this.dataHashes=SC.beget(r.dataHashes),this.revisions=SC.beget(r.revisions),this.statuses=SC.beget(r.statuses),this.childRecords=r.childRecords?SC.beget(r.childRecords):{},this.parentRecords=r.parentRecords?SC.beget(r.parentRecords):{},this.chainedChanges=this.locks=this.editables=null,this.changelog=null,this.set("hasChanges",NO)},refreshQuery:function(e){var t=this.get("parentStore");return t&&t.refreshQuery(e),this},readError:function(e){var t=this.get("parentStore");return t?t.readError(e):null},readQueryError:function(e){var t=this.get("parentStore");return t?t.readQueryError(e):null},storeKeyEditState:function(e){var t=this.editables,n=this.locks;return t&&t[e]?SC.Store.EDITABLE:n&&n[e]?SC.Store.LOCKED:SC.Store.INHERITED},_lock:function(e){var t=this.locks,n,r,i,s,o,u,a,f;if(t&&t[e])return this;t||(t=this.locks=[]),r=this.editables,r&&(r[e]=0);var l=this.get("parentStore"),c;while(l&&(c=l.storeKeyEditState(e))===SC.Store.INHERITED)l=l.get("parentStore");return l&&c===SC.Store.EDITABLE?(i=this.childRecords[e],i?(this._lock(i),s=this.parentRecords[i],s&&(o=s[e],u=o?SC.tupleForPropertyPath(o,this.dataHashes[i]):null,u&&(a=u[0],f=u[1]),this.dataHashes[e]=a&&f?a[f]:null)):this.dataHashes[e]=SC.clone(l.dataHashes[e],YES),r||(r=this.editables=[]),r[e]=1):this.dataHashes[e]=l.dataHashes[e],this.statuses[e]=this.statuses[e],n=this.revisions[e]=this.revisions[e],t[e]=n||1,this},readDataHash:function(e){return this .get("lockOnRead")&&this._lock(e),this.dataHashes[e]},readEditableDataHash:function(e){return this._lock(e),arguments.callee.base.apply(this,arguments)},writeDataHash:function(e,t,n){var r=this.locks,i=NO,s;t?this.dataHashes[e]=t:(this._lock(e),i=YES),n?this.statuses[e]=n:i||(this.statuses[e]=this.statuses[e]||SC.Record.READY_NEW),i||(s=this.revisions[e]=this.revisions[e],r||(r=this.locks=[]),r[e]||(r[e]=s||1));var o=this.editables;return o||(o=this.editables=[]),o[e]=1,this},removeDataHash:function(e,t){var n=this.locks;return n||(n=this.locks=[]),n[e]||(n[e]=this.revisions[e]||1),arguments.callee.base.apply(this,arguments)},dataHashDidChange:function(e,t,n,r){t||(t=SC.Store.generateStoreKey());var i,s,o,u;i=SC.typeOf(e)===SC.T_ARRAY,i?s=e.length:(s=1,u=e);var a=this.chainedChanges;a||(a=this.chainedChanges=SC.Set.create());for(o=0;o0),this.flush(),this},queryFor:function(e,t,n){return this.get("parentStore").queryFor(e,t,n)},findAll:function(e,t,n,r,i){return i||(i=this),this.get("parentStore").findAll(e,t,n,r,i)},retrieveRecords:function(e,t,n,r){var i=this.get("parentStore" ),s,o,u,a=n?n.length:t.length,f=SC.Record,l;if(r)for(s=0;s=0},indexOf:function(e,t){if(!SC.kindOf(e,SC.Record))return SC.Logger.warn("Using indexOf on %@ with an object that is not an SC.Record".fmt(e)),-1;this.flush();var n=e.get("storeKey"),r=this.get("storeKeys");return r?r.indexOf(n,t):-1},lastIndexOf:function(e,t){if(!SC.kindOf(e,SC.Record))return SC.Logger.warn("Using lastIndexOf on %@ with an object that is not an SC.Record".fmt(e)),-1;this.flush();var n=e.get("storeKey"),r=this.get("storeKeys");return r?r.lastIndexOf(n,t) :-1},add:function(e){return SC.kindOf(e,SC.Record)?(this.indexOf(e)<0&&this.pushObject(e),this):this},remove:function(e){return SC.kindOf(e,SC.Record)?(this.removeObject(e),this):this},find:function(e,t,n){return t&&t.isQuery?this.get("store").find(t.queryWithScope(this)):e.apply(this,SC.$A(arguments).slice(1))}.enhance(),refresh:function(){return this.get("store").refreshQuery(this.get("query")),this},reload:function(){return this.flush(YES),this},destroy:function(){this.get("isDestroyed")||this.get("store").recordArrayWillDestroy(this),arguments.callee.base.apply(this,arguments)},storeWillFetchQuery:function(e){var t=this.get("status"),n=SC.Record;if(t===n.EMPTY||t===n.ERROR)t=n.BUSY_LOADING;return t&n.READY&&(t=n.BUSY_REFRESH),this.setIfChanged("status",t),this},storeDidFetchQuery:function(e){return this.setIfChanged("status",SC.Record.READY_CLEAN),this},storeDidCancelQuery:function(e){var t=this.get("status"),n=SC.Record;return t===n.BUSY_LOADING?t=n.EMPTY:t===n.BUSY_REFRESH&&(t=n.READY_CLEAN),this.setIfChanged("status",t),this},storeDidErrorQuery:function(e){return this.setIfChanged("status",SC.Record.ERROR),this},storeDidChangeStoreKeys:function(e,t){var n=this.get("query");if(n.get("location")!==SC.Query.LOCAL)return this;if(!n.containsRecordTypes(t))return this;var r=this._scq_changedStoreKeys;return r||(r=this._scq_changedStoreKeys=SC.IndexSet.create()),r.addEach(e),this.set("needsFlush",YES),this.get("storeKeys")&&this.flush(),this},flush:function(e){if(this._insideFlush)return this.set("needsFlush",YES),this;if(!this.get("needsFlush")&&!e)return this;this.set("needsFlush" ,NO);var t=this.get("query"),n=this.get("store");if(!n||!t||t.get("location")!==SC.Query.LOCAL)return this;this._insideFlush=YES;var r=this.get("storeKeys"),i=this._scq_changedStoreKeys,s=NO,o=SC.Record,u=[],a=new Date,f,l,c,h,p,d,v=r;if(r&&!e)i&&(i.forEach(function(e){if(u.length>0||new Date-a>SC.RecordArray.QUERY_MATCHING_THRESHOLD){u.push(e);return}l=n.peekStatus(e),!(l&o.EMPTY)&&!(l&o.DESTROYED||l===o.BUSY_DESTROYING)?(f=n.materializeRecord(e),d=!!f&&!!t.contains(f)):d=NO,d?r.indexOf(e)<0&&(s||(r=r.copy()),r.pushObject(e)):r.indexOf(e)>=0&&(s||(r=r.copy()),r.removeObject(e))},this),s=YES);else{if(p=t.get("scope"))h=p.flush().get("storeKeys");else if(c=t.get("expandedRecordTypes"))h=SC.IndexSet.create(),c.forEach(function(e){h.addEach(n.storeKeysFor(e))});r=[],h.forEach(function(e){if(u.length>0||new Date-a>SC.RecordArray.QUERY_MATCHING_THRESHOLD){u.push(e);return}l=n.peekStatus(e),!(l&o.EMPTY)&&!(l&o.DESTROYED||l===o.BUSY_DESTROYING)&&(f=n.materializeRecord(e),f&&t.contains(f)&&r.push(e))}),s=YES}if(u.length>0){var m=this;window.setTimeout(function(){SC.run(function(){if(!m||m.get("isDestroyed"))return;m.set("needsFlush",YES),m._scq_changedStoreKeys=SC.IndexSet.create().addEach(u),m.flush()})},1)}return i&&i.clear(),s&&(r&&r===v&&(r=r.copy()),r=SC.Query.orderStoreKeys(r,t,n),SC.compare(v,r)!==0&&this.set("storeKeys",SC.clone(r))),this._insideFlush=NO,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 e=this.get("store");return e.readQueryError(this.get("query"))||SC.Record.GENERIC_ERROR}return null}.property("isError").cacheable(),propertyWillChange:function(e,t){if(e==="storeKeys"){var n=this.get("storeKeys"),r=n?n.get("length"):0,i=t?t.get("length"):0;this.arrayContentWillChange(0,r,i)}return arguments.callee.base.apply(this,arguments)},_storeKeysDidChange:function(){var e=this.get("storeKeys"),t=this._prevStoreKeys,n,r,i=this._storeKeysContentDidChange,s=this._storeKeysStateDidChange;if(e===t)return;t?(t.removeArrayObservers({target:this,willChange:this.arrayContentWillChange,didChange:this._storeKeysContentDidChange}),n=t.get("length")):n=0,this._prevStoreKeys=e,e?(e.addArrayObservers({target:this,willChange:this.arrayContentWillChange,didChange:this._storeKeysContentDidChange}),r=e.get("length")):r=0,this._storeKeysContentDidChange(0,n,r)}.observes("storeKeys"),addArrayObservers:function(){return this.flush(),SC.Array.addArrayObservers.apply(this,arguments)},_storeKeysContentDidChange:function(e,t,n){this._scra_records&&(this._scra_records.length=0),this.arrayContentDidChange(e,t,n)},init:function(){arguments.callee.base.apply(this,arguments),this._storeKeysDidChange()}}),SC.RecordArray.mixin({NOT_EDITABLE:SC.Error.desc("SC.RecordArray is not editable"),QUERY_MATCHING_THRESHOLD:100}),Function.prototype.handleEvents=function(){return this.isEventHandler=YES,this.events=arguments,this},Function.prototype.stateObserves=function(){return this.isStateObserveHandler=YES,this.args=SC.A(arguments),this},SC.StatechartEventDelegate= {isStatechartEventDelegate:YES,tryToPerform:function(e,t,n){if(!this.respondsTo(e))return NO;if(SC.typeOf(this[e])===SC.T_FUNCTION){var r=this[e](t,n);if(r!==NO)return YES}return!!this.sendEvent(e,t,n)},sendEvent:function(e,t,n){}},SC.StatechartRoutingDelegate={isStatechartDelegate:YES,isStatechartRoutingDelegate:YES,statechartUpdateLocationForState:function(e,t,n){SC.routes.set("location",t)},statechartAcquireLocationForState:function(e,t){return SC.routes.get("location")},statechartBindStateToRoute:function(e,t,n,r){SC.routes.add(n,t,r)},statechartShouldStateHandleTriggeredRoute:function(e,t,n){return YES},statechartStateCancelledHandlingTriggeredRoute:function(e,t,n){}},SC.StatechartDelegate=SC.StatechartRoutingDelegate,SC.StatePathMatcher=SC.Object.extend({state:null,expression:null,tokens:null,init:function(){arguments.callee.base.apply(this,arguments),this._parseExpression()},_parseExpression:function(){var e=this.expression?this.expression.split("."):[],t=e.length,n=0,r,i=null,s,o=[];for(;n=0){r=r.split("~");if(r.length>2)throw"Invalid use of '~' at part %@".fmt(n);s=SC.StatePathMatcher._ExpandToken.create({start:r[0],end:r[1]})}else if(r==="this"){if(o.length>0)throw"Invalid use of 'this' at part %@".fmt(n);s=SC.StatePathMatcher._ThisToken.create()}else s=SC.StatePathMatcher._BasicToken.create({value:r});s.owner=this,o.push(s)}this.set("tokens",o);var u=SC.clone(o);this._chain=i=u.pop();while(s=u.pop())i.nextToken=s,i=s},lastPart:function(){var e=this.get("tokens"),t=e?e.length:0,n=t>0?e[t-1]:null;return n.get("lastPart")}.property("tokens" ).cacheable(),match:function(e){return this._stack=e.split("."),SC.empty(e)||SC.typeOf(e)!==SC.T_STRING?NO:this._chain.match()},_pop:function(){return this._lastPopped=this._stack.pop(),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 e=this.owner._pop(),t=this.nextToken;return this.value!==e?NO:t?t.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 e=this.start,t=this.end,n,r=this.nextToken;n=this.owner._pop();if(n!==t)return NO;while(n=this.owner._pop())if(n===e)return r?r.match():YES;return NO}}),SC.StatePathMatcher._ThisToken=SC.StatePathMatcher._Token.extend({type:"this",lastPart:"this",match:function(){var e=this.owner.state,t=e.get("substates"),n=t.length,r=0,i;i=this.owner._lastPopped;if(!i||this.owner._stack.length!==0)return NO;for(;r0&&(s=this._addEmptyInitialSubstateIfNeeded(),!s&&a&&f&&(this.set("initialSubstate",null),this.stateLogWarning("Can not use %@ as initial substate since substates are all concurrent for state %@".fmt(a,this)))),this.notifyPropertyChange("substates"),this.set("currentSubstates",[]),this.set("enteredSubstates",[]),this.set("stateIsInitialized",YES)},_setupRouteHandling:function(){var e=this.get("representRoute"),t=this.get("statechart"),n=this.get("routingDelegate");if(!e)return;if(this.get("isConcurrentState")){this.stateLogError("State %@ cannot handle route '%@' since state is concurrent".fmt(this,e));return}n.statechartBindStateToRoute(t,this,e,this.routeTriggered)},routeTriggered:function(e){if(this._isEnteringState)return;var t=this.get("statechart"),n=this.get("routingDelegate"),r=this.get("location"),i={state:this,location:r,params:e,handler:this.routeTriggered},s=this.createStateRouteHandlerContext(i);n.statechartShouldStateHandleTriggeredRoute(t,this,s)?(this.get("trace")&&r&&this.stateLogTrace("will handle route '%@'".fmt(r)),this.handleTriggeredRoute(s)):n.statechartStateCancelledHandlingTriggeredRoute(t,this,s)},createStateRouteHandlerContext :function(e){return SC.StateRouteHandlerContext.create(e)},handleTriggeredRoute:function(e){this.gotoState(this,e)},_addEmptyInitialSubstateIfNeeded:function(){var e=this.get("initialSubstate"),t=this.get("substatesAreConcurrent");if(e||t)return null;var n=this.createSubstate(SC.EmptyState);return this.set("initialSubstate",n),this.get("substates").push(n),this[n.get("name")]=n,n.initState(),this.stateLogWarning("state %@ has no initial substate defined. Will default to using an empty state as initial substate".fmt(this)),n},_addSubstate:function(e,t,n){var r=this.get("substates");return n=SC.clone(n)||{},n.name=e,t=this.createSubstate(t,n),r.push(t),this[e]=t,t.initState(),t},addSubstate:function(e,t,n){if(SC.empty(e))return this.stateLogError("Can not add substate. name required"),null;if(this[e]!==undefined)return this.stateLogError("Can not add substate '%@'. Already a defined property".fmt(e)),null;if(!this.get("stateIsInitialized"))return this.stateLogError("Can not add substate '%@'. this state is not yet initialized".fmt(e)),null;var r=arguments.length;r===1?t=SC.State:r===2&&SC.typeOf(t)===SC.T_HASH&&(n=t,t=SC.State);var i=t&&t.isClass&&SC.kindOf(t,SC.State);return i?(t=this._addSubstate(e,t,n),this._addEmptyInitialSubstateIfNeeded(),this.notifyPropertyChange("substates"),t):(this.stateLogError("Can not add substate '%@'. must provide a state class".fmt(e)),null)},createSubstate:function(e,t){return t=t||{},e.create({parentState:this,statechart:this.get("statechart")},t)},_registerEventHandler:function(e,t){var n=t.events,r=null,i=n.length,s=0;this._registeredEventHandlers [e]=t;for(;s-1?e:null;if(r!==SC.T_STRING)return this.stateLogError("Can not find matching subtype. value must be an object or string: %@".fmt(e)),null;var i=SC.StatePathMatcher.create({state:this,expression :e}),s=[],o;if(i.get("tokens").length===0)return null;var u=this._registeredSubstatePaths[i.get("lastPart")];if(!u)return this._notifySubstateNotFound(t,n,e);for(o in u)i.match(o)&&s.push(u[o]);if(s.length===1)return s[0];if(s.length>1){var a=[];for(o in u)a.push(o);if(t)return this._notifySubstateNotFound(t,n,e,a);var f="Can not find substate matching '%@' in state %@. Ambiguous with the following: %@";this.stateLogError(f.fmt(e,this.get("fullPath"),a.join(", ")))}return this._notifySubstateNotFound(t,n,e)},_notifySubstateNotFound:function(e,t,n,r){return e?e.call(t||this,this,n,r):null},getState:function(e){return e===this.get("name")?this:SC.kindOf(e,SC.State)?e:this.getSubstate(e,this._handleSubstateNotFound)},_handleSubstateNotFound:function(e,t,n){var r=this.get("parentState");if(r)return r.getState(t);if(n){var i="Can not find state matching '%@'. Ambiguous with the following: %@";this.stateLogError(i.fmt(t,n.join(", ")))}return null},gotoState:function(e,t){var n=this.getState(e);if(!n){var r="can not go to state %@ from state %@. Invalid value.";this.stateLogError(r.fmt(e,this));return}var i=this.findFirstRelativeCurrentState(n);this.get("statechart").gotoState(n,i,!1,t)},gotoHistoryState:function(e,t,n){var r=this.getState(e);if(!r){var i="can not go to history state %@ from state %@. Invalid value.";this.stateLogError(i.fmt(e,this));return}var s=this.findFirstRelativeCurrentState(r);this.get("statechart").gotoHistoryState(r,s,t,n)},resumeGotoState:function(){this.get("statechart").resumeGotoState()},stateIsCurrentSubstate:function(e){SC.typeOf(e)===SC.T_STRING&&(e= this.get("statechart").getState(e));var t=this.get("currentSubstates");return!!t&&t.indexOf(e)>=0},stateIsEnteredSubstate:function(e){SC.typeOf(e)===SC.T_STRING&&(e=this.get("statechart").getState(e));var t=this.get("enteredSubstates");return!!t&&t.indexOf(e)>=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 e=this.get("currentSubstates");return!!e&&e.get("length")>0}.property("currentSubstates").cacheable(),hasEnteredSubstates:function(){var e=this.get("enteredSubstates");return!!e&&e.get("length")>0}.property("enteredSubstates").cacheable(),findFirstRelativeCurrentState:function(e){if(this.get("isCurrentState"))return this;var t=this.get("currentSubstates")||[],n=t.get("length"),r=this.get("parentState");if(n===0)return r?r.findFirstRelativeCurrentState():null;if(n>1){e=this.getSubstate(e);if(e)return e.findFirstRelativeCurrentState()}return t[0]},reenter:function(){this.get("isEnteredState")?this.gotoState(this):SC.Logger.error("Can not re-enter state %@ since it is not an entered state in the statechart".fmt(this))},tryToHandleEvent:function(e,t,n){var r=this.get("trace"),i=this.get("statechart"),s; if(this._registeredEventHandlers[e])return this.stateLogWarning("state %@ can not handle event '%@' since it is a registered event handler".fmt(this,e)),NO;if(this._registeredStateObserveHandlers[e])return this.stateLogWarning("state %@ can not handle event '%@' since it is a registered state observe handler".fmt(this,e)),NO;if(SC.typeOf(this[e])===SC.T_FUNCTION)return r&&this.stateLogTrace("will handle event '%@'".fmt(e)),i.stateWillTryToHandleEvent(this,e,e),s=this[e](t,n)!==NO,i.stateDidTryToHandleEvent(this,e,e,s),s;var o=this._registeredStringEventHandlers[e];if(o)return r&&this.stateLogTrace("%@ will handle event '%@'".fmt(o.name,e)),i.stateWillTryToHandleEvent(this,e,o.name),s=o.handler.call(this,e,t,n)!==NO,i.stateDidTryToHandleEvent(this,e,o.name,s),s;var u=this._registeredRegExpEventHandlers.length,a=0;for(;a0?this.get("currentStates"):"---"),this.statechartLogTrace(h)),SC.none(t)||(o=this._createStateChain(t)),u=this._createStateChain(e),s=this._findPivotState(o,u);if(s){a&&this.statechartLogTrace("pivot state = %@".fmt(s));if(s.get("substatesAreConcurrent")&&s!==e){this.statechartLogError ("Can not go to state %@ from %@. Pivot state %@ has concurrent substates.".fmt(e,t,s)),this._gotoStateLocked=NO;return}}var p=[];this._traverseStatesToExit(o.shift(),o,s,p),s!==e?this._traverseStatesToEnter(u.pop(),u,s,n,p):(this._traverseStatesToExit(s,[],null,p),this._traverseStatesToEnter(s,null,null,n,p)),this._gotoStateActions=p,this._executeGotoStateActions(e,p,null,r)},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 e=this._gotoStateSuspendedPoint;this._executeGotoStateActions(e.gotoState,e.actions,e.marker,e.context)},_executeGotoStateActions:function(e,t,n,r){var i=null,s=t.length,o=null;n=SC.none(n)?0:n;for(;n=0){n=e.get("parentState");while(n)n.get("currentSubstates").removeObject(e),n=n.get("parentState")}n=e;while(n)n.get("enteredSubstates").removeObject(e),n=n.get("parentState");this.get("allowStatechartTracing")&&this.statechartLogTrace("<-- exiting state: %@".fmt(e)),e.set("currentSubstates",[]),e.stateWillBecomeExited(t);var r=this.exitState(e,t);return e.stateDidBecomeExited(t),this.get("monitorIsActive")&&this.get("monitor").pushExitedState(e),e._traverseStatesToExit_skipState=NO,r},exitState:function(e,t){return e.exitState(t)},_enterState:function(e,t,n){var r=e.get("parentState");r&&!e.get("isConcurrentState")&&r.set("historyState",e);if(t){r=e;while(r)r.get("currentSubstates").pushObject(e),r=r.get("parentState")}r=e;while(r)r.get("enteredSubstates").pushObject(e),r=r.get("parentState");this.get("allowStatechartTracing")&&this.statechartLogTrace("--> entering state: %@".fmt(e)),e.stateWillBecomeEntered(n);var i=this.enterState(e,n);return e.stateDidBecomeEntered(n),this.get("monitorIsActive")&&this.get("monitor").pushEnteredState(e),i},enterState:function(e,t){return e.enterStateByRoute&&SC.kindOf(t,SC.StateRouteHandlerContext)?e.enterStateByRoute(t):e.enterState(t)},gotoHistoryState:function(e,t,n,r){if(!this.get("statechartIsInitialized")){this.statechartLogError("can not go to state %@'s history state. Statechart has not yet been initialized" .fmt(e));return}var i=this._processGotoStateArgs(arguments);e=i.state,t=i.fromCurrentState,n=i.useHistory,r=i.context,e=this.getState(e);if(!e){this.statechartLogError("Can not to goto state %@'s history state. Not a recognized state in statechart".fmt(e));return}var s=e.get("historyState");n?this.gotoState(e,t,YES,r):s?this.gotoState(s,t,r):this.gotoState(e,t,r)},sendEvent:function(e,t,n){if(this.get("isDestroyed")){this.statechartLogError("can send event %@. statechart is destroyed".fmt(e));return}var r=NO,i=this.get("currentStates").slice(),s={},o=[],u=NO,a=0,f=0,l=null,c=this.get("allowStatechartTracing");if(this._sendEventLocked||this._goStateLocked){this._pendingSentEvents.push({event:e,arg1:t,arg2:n});return}this._sendEventLocked=YES;var h=this.get("eventDelegate");h&&(r=h.sendEvent(e,t,n),r&&c&&this.statechartLogTrace("eventDelegate handled event: '%@'".fmt(e)));if(!r){c&&this.statechartLogTrace("BEGIN sendEvent: '%@'".fmt(e)),a=i.get("length");for(;f=0)return YES});return n},_traverseStatesToExit:function(e,t,n,r){if(!e||e===n)return;var i=this.get("allowStatechartTracing");if(e.get("substatesAreConcurrent")){var s=0,o=e.get("currentSubstates"),u=o.length,a=null;for(;s0){i.push({action:SC.ENTER_STATE,state:e});var f=t.pop();this._traverseStatesToEnter(f,t,null,r,i),e .get("substatesAreConcurrent")&&this._traverseConcurrentStatesToEnter(e.get("substates"),f,r,i)}},respondsTo:function(e){var t=this.get("currentStates"),n=t.get("length"),r=0,i=null;for(;r0?t[r-1]:null,s=SC.typeOf(i)===SC.T_FUNCTION?t.pop():null,o=this.get("currentStates"),u=0,a=null,f={},l,c=undefined,h=0;r=o.get("length");for(;u=1e3&&delete a[f.shift()],f[j](u),a[u]=e[h](t,o),n?n(a[u]):a[u])}return r}function mn(){return this.x+m+this.y}function Ln(t){return function(n,r,i ,s){var o={back:t};return e.is(i,"function")?s=i:o.rot=i,n&&n.constructor==It&&(n=n.attrs.path),n&&(o.along=n),this.animate(o,r,s)}}function An(e,t,n,r,i,s){function h(e){return((a*e+u)*e+o)*e}function p(e,t){var n=d(e,t);return((c*n+l)*n+f)*n}function d(e,t){var n,r,i,s,f,l;for(i=e,l=0;l<8;l++){s=h(i)-e;if(k(s)r)return r;while(ns?n=i:r=i,i=(r-n)/2+n}return i}var o=3*t,u=3*(r-t)-o,a=1-o-u,f=3*n,l=3*(i-n)-f,c=1-f-l;return p(e,1/(200*s))}e.version="1.5.2";var t=/[, ]+/,n={circle:1,rect:1,path:1,ellipse:1,text:1,image:1},r=/\{(\d+)\}/g,i="prototype",s="hasOwnProperty",o=document,u=window,a={was:Object[i][s].call(u,"Raphael"),is:u.Raphael},f=function(){this.customAttributes={}},l,c="appendChild",h="apply",p="concat",d="createTouch"in o,v="",m=" ",g=String,y="split",b="click dblclick mousedown mousemove mouseout mouseover mouseup touchstart touchmove touchend orientationchange touchcancel gesturestart gesturechange gestureend"[y](m),w={mousedown:"touchstart",mousemove:"touchmove",mouseup:"touchend"},E="join",S="length",x=g[i].toLowerCase,T=Math,N=T.max,C=T.min,k=T.abs,L=T.pow,A=T.PI,O="number",M="string",_="array",D="toString",P="fill",H=Object[i][D],B={},j="push",F=/^url\(['"]?([^\)]+?)['"]?\)$/i,I=/^\s*((#[a-f\d]{6})|(#[a-f\d]{3})|rgba?\(\s*([\d\.]+%?\s*,\s*[\d\.]+%?\s*,\s*[\d\.]+(?:%?\s*,\s*[\d\.]+)?)%?\s*\)|hsba?\(\s*([\d\.]+(?:deg|\xb0|%)?\s*,\s*[\d\.]+%?\s*,\s*[\d\.]+(?:%?\s*,\s*[\d\.]+)?)%?\s*\)|hsla?\(\s*([\d\.]+(?:deg|\xb0|%)?\s*,\s*[\d\.]+%?\s*,\s*[\d\.]+(?:%?\s*,\s*[\d\.]+)?)%?\s*\))\s*$/i ,q={NaN:1,Infinity:1,"-Infinity":1},R=/^(?:cubic-)?bezier\(([^,]+),([^,]+),([^,]+),([^\)]+)\)/,U=T.round,z="setAttribute",W=parseFloat,X=parseInt,V=" progid:DXImageTransform.Microsoft",$=g[i].toUpperCase,J={blur:0,"clip-rect":"0 0 1e9 1e9",cursor:"default",cx:0,cy:0,fill:"#fff","fill-opacity":1,font:'10px "Arial"',"font-family":'"Arial"',"font-size":"10","font-style":"normal","font-weight":400,gradient:0,height:0,href:"http://raphaeljs.com/",opacity:1,path:"M0,0",r:0,rotation:0,rx:0,ry:0,scale:"1 1",src:"",stroke:"#000","stroke-dasharray":"","stroke-linecap":"butt","stroke-linejoin":"butt","stroke-miterlimit":0,"stroke-opacity":1,"stroke-width":1,target:"_blank","text-anchor":"middle",title:"Raphael",translation:"0 0",width:0,x:0,y:0},K={along:"along",blur:O,"clip-rect":"csv",cx:O,cy:O,fill:"colour","fill-opacity":O,"font-size":O,height:O,opacity:O,path:"path",r:O,rotation:"csv",rx:O,ry:O,scale:"csv",stroke:"colour","stroke-opacity":O,"stroke-width":O,translation:"csv",width:O,x:O,y:O},Q="replace",G=/^(from|to|\d+%?)$/,Y=/\s*,\s*/,Z={hs:1,rg:1},et=/,?([achlmqrstvxz]),?/gi,tt=/([achlmqstvz])[\s,]*((-?\d*\.?\d*(?:e[-+]?\d+)?\s*,?\s*)+)/ig,nt=/(-?\d*\.?\d*(?:e[-+]?\d+)?)\s*,?\s*/ig,rt=/^r(?:\(([^,]+?)\s*,\s*([^\)]+?)\))?/,it=function(e,t){return e.key-t.key};e.type=u.SVGAngle||o.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure","1.1")?"SVG":"VML";if(e.type=="VML"){var st=o.createElement("div"),ot;st.innerHTML='',ot=st.firstChild,ot.style.behavior="url(#default#VML)";if(!ot||typeof ot.adj!="object")return e.type=null;st=null}e.svg=!( e.vml=e.type=="VML"),f[i]=e[i],l=f[i],e._id=0,e._oid=0,e.fn={},e.is=function(e,t){return t=x.call(t),t=="finite"?!q[s](+e):t=="null"&&e===null||t==typeof e||t=="object"&&e===Object(e)||t=="array"&&Array.isArray&&Array.isArray(e)||H.call(e).slice(8,-1).toLowerCase()==t},e.angle=function(t,n,r,i,s,o){if(s==null){var u=t-r,a=n-i;return!u&&!a?0:((u<0)*180+T.atan(-a/-u)*180/A+360)%360}return e.angle(t,n,s,o)-e.angle(r,i,s,o)},e.rad=function(e){return e%360*A/180},e.deg=function(e){return e*180/A%360},e.snapTo=function(t,n,r){r=e.is(r,"finite")?r:10;if(e.is(t,_)){var i=t.length;while(i--)if(k(t[i]-n)<=r)return t[i]}else{t=+t;var s=n%t;if(st-r)return n-s+t}return n},e.setWindow=function(e){u=e,o=u.document};var at=function(t){if(e.vml){var n=/^\s+|\s+$/g,r;try{var i=new ActiveXObject("htmlfile");i.write(""),i.close(),r=i.body}catch(s){r=createPopup().document.body}var u=r.createTextRange();at=ht(function(e){try{r.style.color=g(e)[Q](n,v);var t=u.queryCommandValue("ForeColor");return t=(t&255)<<16|t&65280|(t&16711680)>>>16,"#"+("000000"+t[D](16)).slice(-6)}catch(i){return"none"}})}else{var a=o.createElement("i");a.title="Raphaël Colour Picker",a.style.display="none",o.body[c](a),at=ht(function(e){return a.style.color=e,o.defaultView.getComputedStyle(a,v).getPropertyValue("color")})}return at(t)},ft=function(){return"hsb("+[this.h,this.s,this.b]+")"},lt=function(){return"hsl("+[this.h,this.s,this.l]+")"},ct=function(){return this.hex};e.hsb2rgb=function(t,n,r,i){return e.is(t,"object")&&"h"in t&&"s"in t&&"b"in t&&(r=t.b,n=t.s,t=t.h,i=t.o),e.hsl2rgb(t,n,r/2,i) },e.hsl2rgb=function(t,n,r,i){e.is(t,"object")&&"h"in t&&"s"in t&&"l"in t&&(r=t.l,n=t.s,t=t.h);if(t>1||n>1||r>1)t/=360,n/=100,r/=100;var s={},o=["r","g","b"],u,a,f,l,c,h;if(!n)s={r:r,g:r,b:r};else{r<.5?u=r*(1+n):u=r+n-r*n,a=2*r-u;for(var p=0;p<3;p++)f=t+1/3*-(p-1),f<0&&f++,f>1&&f--,f*6<1?s[o[p]]=a+(u-a)*6*f:f*2<1?s[o[p]]=u:f*3<2?s[o[p]]=a+(u-a)*(2/3-f)*6:s[o[p]]=a}return s.r*=255,s.g*=255,s.b*=255,s.hex="#"+(16777216|s.b|s.g<<8|s.r<<16).toString(16).slice(1),e.is(i,"finite")&&(s.opacity=i),s.toString=ct,s},e.rgb2hsb=function(t,n,r){n==null&&e.is(t,"object")&&"r"in t&&"g"in t&&"b"in t&&(r=t.b,n=t.g,t=t.r);if(n==null&&e.is(t,M)){var i=e.getRGB(t);t=i.r,n=i.g,r=i.b}if(t>1||n>1||r>1)t/=255,n/=255,r/=255;var s=N(t,n,r),o=C(t,n,r),u,a,f=s;if(o==s)return{h:0,s:0,b:s,toString:ft};var l=s-o;return a=l/s,t==s?u=(n-r)/l:n==s?u=2+(r-t)/l:u=4+(t-n)/l,u/=6,u<0&&u++,u>1&&u--,{h:u,s:a,b:f,toString:ft}},e.rgb2hsl=function(t,n,r){n==null&&e.is(t,"object")&&"r"in t&&"g"in t&&"b"in t&&(r=t.b,n=t.g,t=t.r);if(n==null&&e.is(t,M)){var i=e.getRGB(t);t=i.r,n=i.g,r=i.b}if(t>1||n>1||r>1)t/=255,n/=255,r/=255;var s=N(t,n,r),o=C(t,n,r),u,a,f=(s+o)/2,l;if(o==s)l={h:0,s:0,l:f};else{var c=s-o;a=f<.5?c/(s+o):c/(2-s-o),t==s?u=(n-r)/c:n==s?u=2+(r-t)/c:u=4+(t-n)/c,u/=6,u<0&&u++,u>1&&u--,l={h:u,s:a,l:f}}return l.toString=lt,l},e._path2string=function(){return this.join(",")[Q](et,"$1")},e.getRGB=ht(function(t){if(!t||!!((t=g(t)).indexOf("-")+1))return{r:-1,g:-1,b:-1,hex:"none",error:1};if(t=="none")return{r:-1,g:-1,b:-1,hex:"none"};!Z[s](t.toLowerCase().substring(0,2))&&t.charAt()!="#"&&(t=at(t));var n,r,i,o,u,a, f,l=t.match(I);return l?(l[2]&&(o=X(l[2].substring(5),16),i=X(l[2].substring(3,5),16),r=X(l[2].substring(1,3),16)),l[3]&&(o=X((a=l[3].charAt(3))+a,16),i=X((a=l[3].charAt(2))+a,16),r=X((a=l[3].charAt(1))+a,16)),l[4]&&(f=l[4][y](Y),r=W(f[0]),f[0].slice(-1)=="%"&&(r*=2.55),i=W(f[1]),f[1].slice(-1)=="%"&&(i*=2.55),o=W(f[2]),f[2].slice(-1)=="%"&&(o*=2.55),l[1].toLowerCase().slice(0,4)=="rgba"&&(u=W(f[3])),f[3]&&f[3].slice(-1)=="%"&&(u/=100)),l[5]?(f=l[5][y](Y),r=W(f[0]),f[0].slice(-1)=="%"&&(r*=2.55),i=W(f[1]),f[1].slice(-1)=="%"&&(i*=2.55),o=W(f[2]),f[2].slice(-1)=="%"&&(o*=2.55),(f[0].slice(-3)=="deg"||f[0].slice(-1)=="°")&&(r/=360),l[1].toLowerCase().slice(0,4)=="hsba"&&(u=W(f[3])),f[3]&&f[3].slice(-1)=="%"&&(u/=100),e.hsb2rgb(r,i,o,u)):l[6]?(f=l[6][y](Y),r=W(f[0]),f[0].slice(-1)=="%"&&(r*=2.55),i=W(f[1]),f[1].slice(-1)=="%"&&(i*=2.55),o=W(f[2]),f[2].slice(-1)=="%"&&(o*=2.55),(f[0].slice(-3)=="deg"||f[0].slice(-1)=="°")&&(r/=360),l[1].toLowerCase().slice(0,4)=="hsla"&&(u=W(f[3])),f[3]&&f[3].slice(-1)=="%"&&(u/=100),e.hsl2rgb(r,i,o,u)):(l={r:r,g:i,b:o},l.hex="#"+(16777216|o|i<<8|r<<16).toString(16).slice(1),e.is(u,"finite")&&(l.opacity=u),l)):{r:-1,g:-1,b:-1,hex:"none",error:1}},e),e.getColor=function(e){var t=this.getColor.start=this.getColor.start||{h:0,s:1,b:e||.75},n=this.hsb2rgb(t.h,t.s,t.b);return t.h+=.075,t.h>1&&(t.h=0,t.s-=.2,t.s<=0&&(this.getColor.start={h:0,s:1,b:t.b})),n.hex},e.getColor.reset=function(){delete this.start},e.parsePathString=ht(function(t){if(!t)return null;var n={a:7,c:6,h:1,l:2,m:2,q:4,s:4,t:2,v:1,z:0},r=[];return e.is(t,_)&&e.is(t[0],_)&&(r=dt(t)), r[S]||g(t)[Q](tt,function(e,t,i){var s=[],o=x.call(t);i[Q](nt,function(e,t){t&&s[j](+t)}),o=="m"&&s[S]>2&&(r[j]([t][p](s.splice(0,2))),o="l",t=t=="m"?"l":"L");while(s[S]>=n[o]){r[j]([t][p](s.splice(0,n[o])));if(!n[o])break}}),r[D]=e._path2string,r}),e.findDotsAtSegment=function(e,t,n,r,i,s,o,u,a){var f=1-a,l=L(f,3)*e+L(f,2)*3*a*n+f*3*a*a*i+L(a,3)*o,c=L(f,3)*t+L(f,2)*3*a*r+f*3*a*a*s+L(a,3)*u,h=e+2*a*(n-e)+a*a*(i-2*n+e),p=t+2*a*(r-t)+a*a*(s-2*r+t),d=n+2*a*(i-n)+a*a*(o-2*i+n),v=r+2*a*(s-r)+a*a*(u-2*s+r),m=(1-a)*e+a*n,g=(1-a)*t+a*r,y=(1-a)*i+a*o,b=(1-a)*s+a*u,w=90-T.atan((h-d)/(p-v))*180/A;return(h>d||p1&&(x=T.sqrt(x),n=x*n,r=x*r);var N=n*n,C=r*r,L=(s==o?-1:1)*T.sqrt(k((N*C-N*w*w-C*b*b)/(N*w*w+C*b*b))),O=L*n*w/r+(e+u)/2,M=L*-r*b/n+(t+a)/2,_=T.asin(((t-M)/r).toFixed(9)),D=T.asin(((a-M)/r).toFixed(9));_=eD&&(_-=A*2),!o&&D>_&&(D-=A*2)}else _=f[0],D=f[1],O=f[2],M=f[3];var P=D-_;if(k(P)>l){var H=D,B=u,j=a;D=_+l*(o&&D>_?1:-1),u=O+n*T.cos(D),a=M+r*T.sin(D),h=bt(u,a,n,r,i,0,o,B,j,[D,H,O,M])}P=D-_;var F=T.cos(_),I=T.sin(_),q=T.cos(D),R=T.sin(D),U=T.tan(P/4),z=4/3*n*U,W=4/3*r*U,X=[e,t],V=[e+z*I,t-W*F],$=[u+z*R,a-W*q],J=[u,a];V[0]=2*X[0]-V[0],V[1]=2*X[1]-V[1];if(f)return[V,$,J][p](h);h=[V,$,J][p](h)[E]()[y](",");var K=[];for(var Q=0,G=h[S];Q"1e12"&&(c=.5),k(p)>"1e12"&&(p=.5),c>0&&c<1&&(m=wt(e,t,n,r,i,s,o,u,c),v[j](m.x),d[j](m.y)),p>0&&p<1&&(m=wt(e,t,n,r,i,s,o,u,p),v[j](m.x),d[j](m.y)),a=s-2*r+t-(u-2*s+r),f=2*(r-t)-2*(s-r),l=t-r,c=(-f+T.sqrt(f*f-4*a*l))/2/a,p=(-f-T.sqrt(f*f-4*a*l))/2/a,k(c)>"1e12"&&(c=.5),k(p)>"1e12"&&(p=.5),c>0&&c<1&&(m=wt(e,t,n,r,i,s,o,u,c),v[j](m.x),d[j](m.y)),p>0&&p<1&&(m=wt(e,t,n,r,i,s,o,u,p),v[j](m.x),d[j](m.y)),{min:{x:C[h](0,v),y:C[h](0,d)},max:{x:N[h](0,v),y:N[h](0,d)}}}),St=ht(function(e,t){var n=mt(e),r=t&&mt(t),i={x:0,y:0,bx:0,by :0,X:0,Y:0,qx:null,qy:null},s={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null},o=function(e,t){var n,r;if(!e)return["C",t.x,t.y,t.x,t.y,t.x,t.y];!(e[0]in{T:1,Q:1})&&(t.qx=t.qy=null);switch(e[0]){case"M":t.X=e[1],t.Y=e[2];break;case"A":e=["C"][p](bt[h](0,[t.x,t.y][p](e.slice(1))));break;case"S":n=t.x+(t.x-(t.bx||t.x)),r=t.y+(t.y-(t.by||t.y)),e=["C",n,r][p](e.slice(1));break;case"T":t.qx=t.x+(t.x-(t.qx||t.x)),t.qy=t.y+(t.y-(t.qy||t.y)),e=["C"][p](yt(t.x,t.y,t.qx,t.qy,e[1],e[2]));break;case"Q":t.qx=e[1],t.qy=e[2],e=["C"][p](yt(t.x,t.y,e[1],e[2],e[3],e[4]));break;case"L":e=["C"][p](gt(t.x,t.y,e[1],e[2]));break;case"H":e=["C"][p](gt(t.x,t.y,e[1],t.y));break;case"V":e=["C"][p](gt(t.x,t.y,t.x,e[1]));break;case"Z":e=["C"][p](gt(t.x,t.y,t.X,t.Y))}return e},u=function(e,t){if(e[t][S]>7){e[t].shift();var i=e[t];while(i[S])e.splice(t++,0,["C"][p](i.splice(0,6)));e.splice(t,1),l=N(n[S],r&&r[S]||0)}},a=function(e,t,i,s,o){e&&t&&e[o][0]=="M"&&t[o][0]!="M"&&(t.splice(o,0,["M",s.x,s.y]),i.bx=0,i.by=0,i.x=e[o][1],i.y=e[o][2],l=N(n[S],r&&r[S]||0))};for(var f=0,l=N(n[S],r&&r[S]||0);f.5)*2-1;L(i-.5,2)+L(s-.5,2)>.25&&(s=T.sqrt(.25-L(i-.5,2))*o+.5)&&s!=.5&&(s=s.toFixed(5)-1e-5*o)}return v}),t=t[y](/\s*\-\s*/);if(r=="linear"){var a=t.shift();a=-W(a);if(isNaN(a))return null;var f=[0,0,T.cos(a*A/180),T.sin(a*A/180)],l=1/(N(k(f[2]),k(f[3]))||1);f[2]*=l,f[3]*=l,f[2]<0&&(f[0]=-f[2],f[2]=0),f[3]<0&&(f[1]=-f[3],f[3]=0)}var h=xt(t);if(!h)return null;var p=e.getAttribute(P);p=p.match(/^url\(#(.*)\)$/),p&&n.defs.removeChild(o.getElementById(p[1]));var d=_t(r+"Gradient");d.id=ut(),_t(d,r=="radial"?{fx:i,fy:s}:{x1:f[0],y1:f[1],x2:f[2],y2:f[3]}),n.defs[c](d);for(var m=0,b=h[S];m=4){n.clip&&n.clip.parentNode.parentNode.removeChild(n.clip.parentNode);var N=_t("clipPath"),C=_t("rect");N.id=ut(),_t(C,{x:T[0],y:T[1],width:T[2],height:T[3],r:T[4]||0,rx:T[4]||0,ry:T[4]||0}),N[c](C),n.paper.defs[c](N),_t(u,{"clip-path":"url(#"+N.id+")"}),n.clip=C}if(!d){var k=o.getElementById(u.getAttribute("clip-path")[Q](/(^url\(#|\)$)/g,v));k&&k.parentNode.removeChild(k),_t(u,{"clip-path":v}),delete n.clip}break;case"path":n.type=="path"&&_t(u,{d:d?a.path=mt(d):"M0,0"});break;case"width":u[z](p,d);if(!a.fx)break;p="x",d=a.x;case"x":a.fx&&(d=-a.x-(a.width||0));case"rx":if(p=="rx"&&n.type=="rect")break;case"cx":h&&(p=="x"||p=="cx")&&(h[1]+=d-a[p]),u[z](p,d),n.pattern&&Ht(n);break;case"height":u[z](p,d);if(!a.fy)break;p="y",d=a.y;case"y":a.fy&&(d=-a.y-(a.height||0));case"ry":if(p=="ry"&&n.type=="rect" )break;case"cy":h&&(p=="y"||p=="cy")&&(h[2]+=d-a[p]),u[z](p,d),n.pattern&&Ht(n);break;case"r":n.type=="rect"?_t(u,{rx:d,ry:d}):u[z](p,d);break;case"src":n.type=="image"&&u.setAttributeNS(n.paper.xlink,"href",d);break;case"stroke-width":u.style.strokeWidth=d,u[z](p,d),a["stroke-dasharray"]&&l(n,a["stroke-dasharray"]);break;case"stroke-dasharray":l(n,d);break;case"translation":var L=g(d)[y](t);L[0]=+L[0]||0,L[1]=+L[1]||0,h&&(h[1]+=L[0],h[2]+=L[1]),kn.call(n,L[0],L[1]);break;case"scale":L=g(d)[y](t),n.scale(+L[0]||1,+L[1]||+L[0]||1,isNaN(W(L[2]))?null:+L[2],isNaN(W(L[3]))?null:+L[3]);break;case P:var A=g(d).match(F);if(A){N=_t("pattern");var O=_t("image");N.id=ut(),_t(N,{x:0,y:0,patternUnits:"userSpaceOnUse",height:1,width:1}),_t(O,{x:0,y:0}),O.setAttributeNS(n.paper.xlink,"href",A[1]),N[c](O);var M=o.createElement("img");M.style.cssText="position:absolute;left:-9999em;top-9999em",M.onload=function(){_t(N,{width:this.offsetWidth,height:this.offsetHeight}),_t(O,{width:this.offsetWidth,height:this.offsetHeight}),o.body.removeChild(this),n.paper.safari()},o.body[c](M),M.src=A[1],n.paper.defs[c](N),u.style.fill="url(#"+N.id+")",_t(u,{fill:"url(#"+N.id+")"}),n.pattern=N,n.pattern&&Ht(n);break}var _=e.getRGB(d);if(!_.error)delete r.gradient,delete a.gradient,!e.is(a.opacity,"undefined")&&e.is(r.opacity,"undefined")&&_t(u,{opacity:a.opacity}),!e.is(a["fill-opacity"],"undefined")&&e.is(r["fill-opacity"],"undefined")&&_t(u,{"fill-opacity":a["fill-opacity"]});else if(({circle:1,ellipse:1}[s](n.type)||g(d).charAt()!="r")&&Pt(u,d,n.paper)){a.gradient=d,a.fill="none";break}_[s]("opacity")&& _t(u,{"fill-opacity":_.opacity>1?_.opacity/100:_.opacity});case"stroke":_=e.getRGB(d),u[z](p,_.hex),p=="stroke"&&_[s]("opacity")&&_t(u,{"stroke-opacity":_.opacity>1?_.opacity/100:_.opacity});break;case"gradient":((({circle:1,ellipse:1}))[s](n.type)||g(d).charAt()!="r")&&Pt(u,d,n.paper);break;case"opacity":a.gradient&&!a[s]("stroke-opacity")&&_t(u,{"stroke-opacity":d>1?d/100:d});case"fill-opacity":if(a.gradient){var D=o.getElementById(u.getAttribute(P)[Q](/^url\(#|\)$/g,v));if(D){var H=D.getElementsByTagName("stop");H[H[S]-1][z]("stop-opacity",d)}break};default:p=="font-size"&&(d=X(d,10)+"px");var B=p[Q](/(\-.)/g,function(e){return $.call(e.substring(1))});u.style[B]=d,u[z](p,d)}}Ft(n,r),h?n.rotate(h.join(m)):W(f)&&n.rotate(f,!0)},jt=1.2,Ft=function(t,n){if(t.type!="text"||!(n[s]("text")||n[s]("font")||n[s]("font-size")||n[s]("x")||n[s]("y")))return;var r=t.attrs,i=t.node,u=i.firstChild&&i.firstChild.style["font-size"]!==""?X(o.defaultView.getComputedStyle(i.firstChild,v).getPropertyValue("font-size"),10):X(i.style["font-size"],10)||10;if(n[s]("text")){r.text=n.text;while(i.firstChild)i.removeChild(i.firstChild);var a=g(n.text)[y]("\n");for(var f=0,l=a[S];ft.height&&(t.height=s.y+s.height-t.y),s. x+s.width-t.x>t.width&&(t.width=s.x+s.width-t.x)}}catch(n){}finally{t=t||{x:t.x,y:Infinity,width:0,height:0}}return e&&this.hide(),t},It[i].attr=function(t,n){if(this.removed)return this;if(t==null){var r={};for(var i in this.attrs)this.attrs[s](i)&&(r[i]=this.attrs[i]);return this._.rt.deg&&(r.rotation=this.rotate()),(this._.sx!=1||this._.sy!=1)&&(r.scale=this.scale()),r.gradient&&r.fill=="none"&&(r.fill=r.gradient)&&delete r.gradient,r}if(n==null&&e.is(t,M))return t=="translation"?kn.call(this):t=="rotation"?this.rotate():t=="scale"?this.scale():t==P&&this.attrs.fill=="none"&&this.attrs.gradient?this.attrs.gradient:this.attrs[t];if(n==null&&e.is(t,_)){var o={};for(var u=0,a=t.length;u=4){d[2]=+d[2]+ +d[0],d[3]=+d[3]+ +d[1],d[4]||(d[4]=0);var m=i.clipRect||o.createElement("div"),b=m.style,w=i.parentNode;b.clip=e.format("rect({1}px {2}px {3}px {0}px)",d),i.clipRect||(b.position="absolute",b.top=0,b.left=0,b.width=n.paper.width+"px",b.height=n.paper .height+"px",w.parentNode.insertBefore(m,w),m[c](w),i.clipRect=m)}r["clip-rect"]||i.clipRect&&(i.clipRect.style.clip=v)}n.type=="image"&&r.src&&(i.src=r.src),n.type=="image"&&r.opacity&&(i.filterOpacity=V+".Alpha(opacity="+r.opacity*100+")",a.filter=(i.filterMatrix||v)+(i.filterOpacity||v)),r.font&&(a.font=r.font),r["font-family"]&&(a.fontFamily='"'+r["font-family"][y](",")[0][Q](/^['"]+|['"]+$/g,v)+'"'),r["font-size"]&&(a.fontSize=r["font-size"]),r["font-weight"]&&(a.fontWeight=r["font-weight"]),r["font-style"]&&(a.fontStyle=r["font-style"]);if(r.opacity!=null||r["stroke-width"]!=null||r.fill!=null||r.stroke!=null||r["stroke-width"]!=null||r["stroke-opacity"]!=null||r["fill-opacity"]!=null||r["stroke-dasharray"]!=null||r["stroke-miterlimit"]!=null||r["stroke-linejoin"]!=null||r["stroke-linecap"]!=null){i=n.shape||i;var E=i.getElementsByTagName(P)&&i.getElementsByTagName(P)[0],x=!1;!E&&(x=E=rn(P));if("fill-opacity"in r||"opacity"in r){var T=((+u["fill-opacity"]+1||2)-1)*((+u.opacity+1||2)-1)*((+e.getRGB(r.fill).o+1||2)-1);T=C(N(T,0),1),E.opacity=T}r.fill&&(E.on=!0);if(E.on==null||r.fill=="none")E.on=!1;if(E.on&&r.fill){var k=r.fill.match(F);k?(E.src=k[1],E.type="tile"):(E.color=e.getRGB(r.fill).hex,E.src=v,E.type="solid",e.getRGB(r.fill).error&&(h.type in{circle:1,ellipse:1}||g(r.fill).charAt()!="r")&&Pt(h,r.fill)&&(u.fill="none",u.gradient=r.fill))}x&&i[c](E);var L=i.getElementsByTagName("stroke")&&i.getElementsByTagName("stroke")[0],A=!1;!L&&(A=L=rn("stroke"));if(r.stroke&&r.stroke!="none"||r["stroke-width"]||r["stroke-opacity"]!=null||r["stroke-dasharray"]||r["stroke-miterlimit" ]||r["stroke-linejoin"]||r["stroke-linecap"])L.on=!0;(r.stroke=="none"||L.on==null||r.stroke==0||r["stroke-width"]==0)&&(L.on=!1);var O=e.getRGB(r.stroke);L.on&&r.stroke&&(L.color=O.hex),T=((+u["stroke-opacity"]+1||2)-1)*((+u.opacity+1||2)-1)*((+O.o+1||2)-1);var M=(W(r["stroke-width"])||1)*.75;T=C(N(T,0),1),r["stroke-width"]==null&&(M=u["stroke-width"]),r["stroke-width"]&&(L.weight=M),M&&M<1&&(T*=M)&&(L.weight=1),L.opacity=T,r["stroke-linejoin"]&&(L.joinstyle=r["stroke-linejoin"]||"miter"),L.miterlimit=r["stroke-miterlimit"]||8,r["stroke-linecap"]&&(L.endcap=r["stroke-linecap"]=="butt"?"flat":r["stroke-linecap"]=="square"?"square":"round");if(r["stroke-dasharray"]){var _={"-":"shortdash",".":"shortdot","-.":"shortdashdot","-..":"shortdashdotdot",". ":"dot","- ":"dash","--":"longdash","- .":"dashdot","--.":"longdashdot","--..":"longdashdotdot"};L.dashstyle=_[s](r["stroke-dasharray"])?_[r["stroke-dasharray"]]:v}A&&i[c](L)}if(h.type=="text"){a=h.paper.span.style,u.font&&(a.font=u.font),u["font-family"]&&(a.fontFamily=u["font-family"]),u["font-size"]&&(a.fontSize=u["font-size"]),u["font-weight"]&&(a.fontWeight=u["font-weight"]),u["font-style"]&&(a.fontStyle=u["font-style"]),h.node.string&&(h.paper.span.innerHTML=g(h.node.string)[Q](/")),h.W=u.w=h.paper.span.offsetWidth,h.H=u.h=h.paper.span.offsetHeight,h.X=u.x,h.Y=u.y+U(h.H/2);switch(u["text-anchor"]){case"start":h.node.style["v-text-align"]="left",h.bbx=U(h.W/2);break;case"end":h.node.style["v-text-align"]="right",h.bbx=-U(h.W/2);break;default:h.node.style["v-text-align"]="center"}}}, Pt=function(e,t){e.attrs=e.attrs||{};var n=e.attrs,r,i="linear",s=".5 .5";e.attrs.gradient=t,t=g(t)[Q](rt,function(e,t,n){return i="radial",t&&n&&(t=W(t),n=W(n),L(t-.5,2)+L(n-.5,2)>.25&&(n=T.sqrt(.25-L(t-.5,2))*((n>.5)*2-1)+.5),s=t+m+n),v}),t=t[y](/\s*\-\s*/);if(i=="linear"){var o=t.shift();o=-W(o);if(isNaN(o))return null}var u=xt(t);if(!u)return null;e=e.shape||e.node,r=e.getElementsByTagName(P)[0]||rn(P),!r.parentNode&&e.appendChild(r);if(u[S]){r.on=!0,r.method="none",r.color=u[0].color,r.color2=u[u[S]-1].color;var a=[];for(var f=0,l=u[S];f')}}catch(sn){rn=function(e){return o.createElement("<"+e+' xmlns="urn:schemas-microsoft.com:vml" class="rvml">')}}$t=function(){var t=Tt[h](0,arguments),n=t.container,r=t.height,i,s=t.width,u=t.x,a=t.y;if(!n)throw new Error("VML container not found.");var l=new f,p=l.canvas=o.createElement("div"),d=p.style;return u=u||0,a=a||0,s=s||512,r=r||342,s==+s&&(s+="px"),r==+r&&(r+="px"),l.width=1e3,l.height=1e3,l.coordsize=Zt*1e3+m+Zt*1e3,l.coordorigin="0 0",l.span=o.createElement("span"),l.span.style.cssText="position:absolute;left:-9999em;top:-9999em;padding:0;margin:0;line-height:1;display:inline;",p[c](l.span),d.cssText=e.format("top:0;left:0;width:{0};height:{1};display:inline-block;position:relative;clip:rect(0 {0} {1} 0);overflow:hidden",s,r),n==1?(o.body[c](p),d.left=u+"px",d.top=a+"px",d.position="absolute"):n.firstChild?n.insertBefore(p,n.firstChild):n[c](p),Nt.call(l,l,e.fn),l},l.clear=function(){this.canvas.innerHTML=v,this.span=o.createElement("span"),this.span.style.cssText="position:absolute;left:-9999em;top:-9999em;padding:0;margin:0;line-height:1;display:inline;",this.canvas[c](this.span),this.bottom=this.top=null},l.remove=function(){this.canvas.parentNode.removeChild(this.canvas);for(var e in this)this[e]=Mt(e);return!0}}var on=navigator.userAgent.match(/Version\/(.*?)\s/);navigator.vendor=="Apple Computer, Inc."&&(on&&on[1]<4||navigator.platform.slice(0,2)=="iP")?l.safari=function(){var e=this.rect(-99,-99,this.width+99,this.height+99).attr({stroke:"none"});u.setTimeout(function(){e.remove()})}:l.safari=function( ){};var un=function(){this.returnValue=!1},an=function(){return this.originalEvent.preventDefault()},fn=function(){this.cancelBubble=!0},ln=function(){return this.originalEvent.stopPropagation()},cn=function(){if(o.addEventListener)return function(e,t,n,r){var i=d&&w[t]?w[t]:t,o=function(i){if(d&&w[s](t))for(var o=0,u=i.targetTouches&&i.targetTouches.length;o1&&(e=Array[i].splice.call(arguments,0,arguments[S])),new On(e)},l.setSize=Vt,l.top= l.bottom=null,l.raphael=e,qt.resetScale=function(){if(this.removed)return this;this._.sx=1,this._.sy=1,this.attrs.scale="1 1"},qt.scale=function(e,t,n,r){if(this.removed)return this;if(e==null&&t==null)return{x:this._.sx,y:this._.sy,toString:mn};t=t||e,!+t&&(t=e);var i,s,o,u,a=this.attrs;if(e!=0){var f=this.getBBox(),l=f.x+f.width/2,c=f.y+f.height/2,h=k(e/this._.sx),d=k(t/this._.sy);n=+n||n==0?n:l,r=+r||r==0?r:c;var g=this._.sx>0,y=this._.sy>0,b=~~(e/k(e)),w=~~(t/k(t)),x=h*b,T=d*w,N=this.node.style,C=n+k(l-n)*x*(l>n==g?1:-1),L=r+k(c-r)*T*(c>r==y?1:-1),A=e*b>t*w?d:h;switch(this.type){case"rect":case"image":var O=a.width*h,M=a.height*d;this.attr({height:M,r:a.r*A,width:O,x:C-O/2,y:L-M/2});break;case"circle":case"ellipse":this.attr({rx:a.rx*h,ry:a.ry*d,r:a.r*A,cx:C,cy:L});break;case"text":this.attr({x:C,y:L});break;case"path":var _=vt(a.path),D=!0,P=g?x:h,H=y?T:d;for(var B=0,j=_[S];Bg?v=p.data[g*c]:(v=e.findDotsAtSegment(t,n,r,i,s,o,u,a,g/c),p.data[g]=v),g&&(l+=L(L(d.x-v.x,2)+L(d.y-v.y,2),.5));if(f!=null&&l>=f)return v;d=v}if(f==null)return l},bn=function(t,n){return function(r,i,s){r=St(r);var o,u,a,f,l="",c={},h,p=0;for(var d=0,v=r.length;di){if(n&&!c.start){h=yn(o,u,a[1],a[2],a[3],a[4],a[5],a[6],i-p),l+=["C",h.start.x,h.start.y,h.m.x,h.m.y,h.x,h.y];if(s)return l;c.start=l,l=["M",h.x,h.y+"C",h.n.x,h.n.y,h.end.x,h.end.y,a[5],a[6]][E](),p+=f,o=+a[5],u=+a[6];continue}if(!t&&!n)return h=yn(o,u,a[1],a[2],a[3],a[4],a[5],a[6],i-p),{x:h.x,y:h.y,alpha:h.alpha}}p+=f,o=+a[5],u=+a[6]}l+=a}return c.end=l,h=t?p:n?c:e.findDotsAtSegment(o,u,a[1],a[2],a[3],a[4],a[5],a[6],1),h.alpha&&(h={x:h. x,y:h.y,alpha:h.alpha}),h}},wn=bn(1),En=bn(),Sn=bn(0,1);qt.getTotalLength=function(){if(this.type!="path")return;return this.node.getTotalLength?this.node.getTotalLength():wn(this.attrs.path)},qt.getPointAtLength=function(e){if(this.type!="path")return;return En(this.attrs.path,e)},qt.getSubpath=function(e,t){if(this.type!="path")return;if(k(this.getTotalLength()-t)<"1e-6")return Sn(this.attrs.path,e).end;var n=Sn(this.attrs.path,t,1);return e?Sn(n,e).end:n},e.easing_formulas={linear:function(e){return e},"<":function(e){return L(e,3)},">":function(e){return L(e-1,3)+1},"<>":function(e){return e*=2,e<1?L(e,3)/2:(e-=2,(L(e,3)+2)/2)},backIn:function(e){var t=1.70158;return e*e*((t+1)*e-t)},backOut:function(e){e-=1;var t=1.70158;return e*e*((t+1)*e+t)+1},elastic:function(e){if(e==0||e==1)return e;var t=.3,n=t/4;return L(2,-10*e)*T.sin((e-n)*2*A/t)+1},bounce:function(e){var t=7.5625,n=2.75,r;return e<1/n?r=t*e*e:e<2/n?(e-=1.5/n,r=t*e*e+.75):e<2.5/n?(e-=2.25/n,r=t*e*e+.9375):(e-=2.625/n,r=t*e*e+.984375),r}};var xn=[],Tn=function(){var t=+(new Date);for(var n=0;n=0?"AD":"BC";if(t<=3)return(n+".Abbreviated").loc();if(t===4)return(n+".Full").loc();if(t===5)return(n+".Letter").loc();throw"Invalid era format: expected at most 5 digits; found "+t+"."},SC.DateFormatter.y=function(e,t){var n=e.getFullYear();t===1&&(t=n.length);var r=Math.abs(n).toString();while(r.lengthn.length&&(n="0"+n),n},SC.DateFormatter.D=function(e,t){var n=new Date(e.getFullYear(),0,1),r=n.getTime(),i=e.getTime()-r,s=Math.floor(i/864e5)+1;s=""+s;while(s.length11?"PM":"AM");return n.loc()},SC .DateFormatter._h=function(e,t,n,r){var i=e.getHours();n||(i%=12),r&&(n?i===0&&(i=24):i===0&&(i=12));var s=""+i;return s.length=e.length-1)return!1;var r=e.lastIndexOf(".",t-1);if(r<=0||r>=t-1)return!1;var i=n.list[e.slice(t+1)];return i?i.indexOf(" "+e.slice(r+1,t)+" ")>=0:!1},is:function(e){var t=e.lastIndexOf(".");if(t<=0||t>=e.length-1)return!1;var r=e.lastIndexOf(".",t-1);if( r>=0)return!1;var i=n.list[e.slice(t+1)];return i?i.indexOf(" "+e.slice(0,t)+" ")>=0:!1},get:function(e){var t=e.lastIndexOf(".");if(t<=0||t>=e.length-1)return null;var r=e.lastIndexOf(".",t-1);if(r<=0||r>=t-1)return null;var i=n.list[e.slice(t+1)];return i?i.indexOf(" "+e.slice(r+1,t)+" ")<0?null:e.slice(r+1):null},noConflict:function(){return e.SecondLevelDomains===this&&(e.SecondLevelDomains=t),this}};return n}),function(e,t){"use strict";typeof module=="object"&&module.exports?module.exports=t(require("./punycode"),require("./IPv6"),require("./SupportedSecondLevelDomains")):typeof define=="function"&&define.amd?define(["./punycode","./IPv6","./SupportedSecondLevelDomains"],t):e.URI=t(e.punycode,e.IPv6,e.SecondLevelDomains,e)}(this,function(e,t,n,r){"use strict";function s(e,t){var n=arguments.length>=1,r=arguments.length>=2;if(this instanceof s){if(e===undefined){if(n)throw new TypeError("undefined is not a valid argument for URI");typeof location!="undefined"?e=location.href+"":e=""}if(e===null&&n)throw new TypeError("null is not a valid argument for URI");return this.href(e),t!==undefined?this.absoluteTo(t):this}return n?r?new s(e,t):new s(e):new s}function o(e){return/^[0-9]+$/.test(e)}function f(e){return e.replace(/([.*+?^=!:${}()|[\]\/\\])/g,"\\$1")}function l(e){return e===undefined?"Undefined":String(Object.prototype.toString.call(e)).slice(8,-1)}function c(e){return l(e)==="Array"}function h(e,t){var n={},r,i;if(l(t)==="RegExp")n=null;else if(c(t))for(r=0,i=t.length;r]+|\(([^\s()<>]+|(\([^\s()<>]+\)))*\))+(?:\(([^\s()<>]+|(\([^\s()<>]+\)))*\)|[^\s`!()\[\]{};:'".,<>?«»“”‘’]))/ig,s.findUri={start:/\b(?:([a-z][a-z0-9.+-]*:\/\/)|www\.)/gi,end:/[\s\r\n]|$/,trim:/[`!()\[\]{};:'".,<>?«»“”„‘’]+$/,parens:/(\([^\)]*\)|\[[^\]]*\]|\{[^}]*\}|<[^>]*>)/g},s.defaultPorts={http:"80",https:"443",ftp:"21",gopher:"70",ws:"80",wss:"443"},s.hostProtocols=["http","https"],s.invalid_hostname_characters=/[^a-zA-Z0-9\.\-:_]/,s.domAttributes={a:"href",blockquote:"cite",link:"href",base:"href",script:"src",form:"action",img:"src",area:"href",iframe:"src",embed:"src",source:"src",track:"src",input:"src",audio:"src",video:"src"},s.getDomAttribute=function(e){if(!e||!e.nodeName)return undefined;var t=e.nodeName.toLowerCase();return t==="input"&&e.type!=="image"?undefined:s.domAttributes[t]},s.encode=g,s.decode=decodeURIComponent,s.iso8859=function(){s.encode=escape,s.decode=unescape},s.unicode=function(){s.encode=g,s.decode=decodeURIComponent},s.characters={pathname:{encode:{expression:/%(24|26|2B|2C|3B|3D|3A|40)/ig,map:{"%24":"$","%26":"&","%2B":"+","%2C":",","%3B":";","%3D":"=","%3A":":","%40":"@"}},decode:{expression:/[\/\?#]/g,map:{"/":"%2F","?":"%3F","#":"%23"}}},reserved:{encode:{expression:/%(21|23|24|26|27|28|29|2A|2B|2C|2F|3A|3B|3D|3F|40|5B|5D)/ig,map:{"%3A":":","%2F":"/","%3F":"?","%23":"#","%5B":"[","%5D":"]","%40":"@","%21":"!","%24":"$","%26":"&","%27":"'","%28":"(","%29":")","%2A":"*","%2B":"+","%2C":",","%3B":";","%3D":"="}}},urnpath:{encode :{expression:/%(21|24|27|28|29|2A|2B|2C|3B|3D|40)/ig,map:{"%21":"!","%24":"$","%27":"'","%28":"(","%29":")","%2A":"*","%2B":"+","%2C":",","%3B":";","%3D":"=","%40":"@"}},decode:{expression:/[\/\?#:]/g,map:{"/":"%2F","?":"%3F","#":"%23",":":"%3A"}}}},s.encodeQuery=function(e,t){var n=s.encode(e+"");return t===undefined&&(t=s.escapeQuerySpace),t?n.replace(/%20/g,"+"):n},s.decodeQuery=function(e,t){e+="",t===undefined&&(t=s.escapeQuerySpace);try{return s.decode(t?e.replace(/\+/g,"%20"):e)}catch(n){return e}};var y={encode:"encode",decode:"decode"},b,w=function(e,t){return function(n){try{return s[t](n+"").replace(s.characters[e][t].expression,function(n){return s.characters[e][t].map[n]})}catch(r){return n}}};for(b in y)s[b+"PathSegment"]=w("pathname",y[b]),s[b+"UrnPathSegment"]=w("urnpath",y[b]);var E=function(e,t,n){return function(r){var i;n?i=function(e){return s[t](s[n](e))}:i=s[t];var o=(r+"").split(e);for(var u=0,a=o.length;u-1&&(t.fragment=e.substring(n+1)||null,e=e.substring(0,n)),n=e.indexOf("?"),n>-1&&(t.query=e.substring(n+1)||null,e=e.substring(0,n)),e.substring(0,2)==="//"?(t.protocol=null,e=e.substring(2),e=s.parseAuthority(e,t)):(n=e.indexOf(":"),n>-1&&(t.protocol=e.substring(0,n)||null,t. protocol&&!t.protocol.match(s.protocol_expression)?t.protocol=undefined:e.substring(n+1,n+3)==="//"?(e=e.substring(n+3),e=s.parseAuthority(e,t)):(e=e.substring(n+1),t.urn=!0))),t.path=e,t},s.parseHost=function(e,t){e||(e=""),e=e.replace(/\\/g,"/");var n=e.indexOf("/"),r,i;n===-1&&(n=e.length);if(e.charAt(0)==="[")r=e.indexOf("]"),t.hostname=e.substring(1,r)||null,t.port=e.substring(r+2,n)||null,t.port==="/"&&(t.port=null);else{var o=e.indexOf(":"),u=e.indexOf("/"),a=e.indexOf(":",o+1);a!==-1&&(u===-1||a-1?n:e.length-1),i;return r>-1&&(n===-1||r-1?p=p.slice(0,d)+p.slice(d).replace(o,""):p=p.replace(o,"");if(p.length<=f[0].length)continue;if(n.ignore&&n.ignore.test(p))continue;h=l+p.length;var g=t(p,l,h,e);if(g===undefined){r.lastIndex=h;continue}g=String(g),e=e.slice(0,l)+g+e.slice(h),r.lastIndex=l+g.length}return r.lastIndex=0,e},s.ensureValidHostname=function(t,n){var r=!!t,i=!!n,o=!1;i&&(o=p(s.hostProtocols,n));if(o&&!r)throw new TypeError("Hostname cannot be empty, if protocol is "+n);if(t&&t.match(s.invalid_hostname_characters)){if(!e)throw new TypeError('Hostname "'+t+'" contains characters other than [A-Z0-9.-:_] and Punycode.js is not available');if(e.toASCII(t).match(s.invalid_hostname_characters ))throw new TypeError('Hostname "'+t+'" contains characters other than [A-Z0-9.-:_]')}},s.ensureValidPort=function(e){if(!e)return;var t=Number(e);if(o(t)&&t>0&&t<65536)return;throw new TypeError('Port "'+e+'" is not a valid port')},s.noConflict=function(e){if(e){var t={URI:this.noConflict()};return r.URITemplate&&typeof r.URITemplate.noConflict=="function"&&(t.URITemplate=r.URITemplate.noConflict()),r.IPv6&&typeof r.IPv6.noConflict=="function"&&(t.IPv6=r.IPv6.noConflict()),r.SecondLevelDomains&&typeof r.SecondLevelDomains.noConflict=="function"&&(t.SecondLevelDomains=r.SecondLevelDomains.noConflict()),t}return r.URI===this&&(r.URI=i),this},u.build=function(e){if(e===!0)this._deferred_build=!0;else if(e===undefined||this._deferred_build)this._string=s.build(this._parts),this._deferred_build=!1;return this},u.clone=function(){return new s(this)},u.valueOf=u.toString=function(){return this.build(!1)._string},u.protocol=S("protocol"),u.username=S("username"),u.password=S("password"),u.hostname=S("hostname"),u.port=S("port"),u.query=x("query","?"),u.fragment=x("fragment","#"),u.search=function(e,t){var n=this.query(e,t);return typeof n=="string"&&n.length?"?"+n:n},u.hash=function(e,t){var n=this.fragment(e,t);return typeof n=="string"&&n.length?"#"+n:n},u.pathname=function(e,t){if(e===undefined||e===!0){var n=this._parts.path||(this._parts.hostname?"/":"");return e?(this._parts.urn?s.decodeUrnPath:s.decodePath)(n):n}return this._parts.urn?this._parts.path=e?s.recodeUrnPath(e):"":this._parts.path=e?s.recodePath(e):"/",this.build(!t),this},u.path=u.pathname,u.href=function(e,t){var n ;if(e===undefined)return this.toString();this._string="",this._parts=s._parts();var r=e instanceof s,i=typeof e=="object"&&(e.hostname||e.path||e.pathname);if(e.nodeName){var o=s.getDomAttribute(e);e=e[o]||"",i=!1}!r&&i&&e.pathname!==undefined&&(e=e.toString());if(typeof e=="string"||e instanceof String)this._parts=s.parse(String(e),this._parts);else{if(!r&&!i)throw new TypeError("invalid input");var u=r?e._parts:e;for(n in u){if(n==="query")continue;a.call(this._parts,n)&&(this._parts[n]=u[n])}u.query&&this.query(u.query,!1)}return this.build(!t),this},u.is=function(e){var t=!1,r=!1,i=!1,o=!1,u=!1,a=!1,f=!1,l=!this._parts.urn;this._parts.hostname&&(l=!1,r=s.ip4_expression.test(this._parts.hostname),i=s.ip6_expression.test(this._parts.hostname),t=r||i,o=!t,u=o&&n&&n.has(this._parts.hostname),a=o&&s.idn_expression.test(this._parts.hostname),f=o&&s.punycode_expression.test(this._parts.hostname));switch(e.toLowerCase()){case"relative":return l;case"absolute":return!l;case"domain":case"name":return o;case"sld":return u;case"ip":return t;case"ip4":case"ipv4":case"inet4":return r;case"ip6":case"ipv6":case"inet6":return i;case"idn":return a;case"url":return!this._parts.urn;case"urn":return!!this._parts.urn;case"punycode":return f}return null};var T=u.protocol,N=u.port,C=u.hostname;u.protocol=function(e,t){if(e){e=e.replace(/:(\/\/)?$/,"");if(!e.match(s.protocol_expression))throw new TypeError('Protocol "'+e+"\" contains characters other than [A-Z0-9.+-] or doesn't start with [A-Z]")}return T.call(this,e,t)},u.scheme=u.protocol,u.port=function(e,t){return this._parts.urn?e===undefined?"" :this:(e!==undefined&&(e===0&&(e=null),e&&(e+="",e.charAt(0)===":"&&(e=e.substring(1)),s.ensureValidPort(e))),N.call(this,e,t))},u.hostname=function(e,t){if(this._parts.urn)return e===undefined?"":this;if(e!==undefined){var n={preventInvalidHostname:this._parts.preventInvalidHostname},r=s.parseHost(e,n);if(r!=="/")throw new TypeError('Hostname "'+e+'" contains characters other than [A-Z0-9.-]');e=n.hostname,this._parts.preventInvalidHostname&&s.ensureValidHostname(e,this._parts.protocol)}return C.call(this,e,t)},u.origin=function(e,t){if(this._parts.urn)return e===undefined?"":this;if(e===undefined){var n=this.protocol(),r=this.authority();return r?(n?n+"://":"")+this.authority():""}var i=s(e);return this.protocol(i.protocol()).authority(i.authority()).build(!t),this},u.host=function(e,t){if(this._parts.urn)return e===undefined?"":this;if(e===undefined)return this._parts.hostname?s.buildHost(this._parts):"";var n=s.parseHost(e,this._parts);if(n!=="/")throw new TypeError('Hostname "'+e+'" contains characters other than [A-Z0-9.-]');return this.build(!t),this},u.authority=function(e,t){if(this._parts.urn)return e===undefined?"":this;if(e===undefined)return this._parts.hostname?s.buildAuthority(this._parts):"";var n=s.parseAuthority(e,this._parts);if(n!=="/")throw new TypeError('Hostname "'+e+'" contains characters other than [A-Z0-9.-]');return this.build(!t),this},u.userinfo=function(e,t){if(this._parts.urn)return e===undefined?"":this;if(e===undefined){var n=s.buildUserinfo(this._parts);return n?n.substring(0,n.length-1):n}return e[e.length-1]!=="@"&&(e+="@"),s.parseUserinfo (e,this._parts),this.build(!t),this},u.resource=function(e,t){var n;return e===undefined?this.path()+this.search()+this.hash():(n=s.parse(e),this._parts.path=n.path,this._parts.query=n.query,this._parts.fragment=n.fragment,this.build(!t),this)},u.subdomain=function(e,t){if(this._parts.urn)return e===undefined?"":this;if(e===undefined){if(!this._parts.hostname||this.is("IP"))return"";var n=this._parts.hostname.length-this.domain().length-1;return this._parts.hostname.substring(0,n)||""}var r=this._parts.hostname.length-this.domain().length,i=this._parts.hostname.substring(0,r),o=new RegExp("^"+f(i));e&&e.charAt(e.length-1)!=="."&&(e+=".");if(e.indexOf(":")!==-1)throw new TypeError("Domains cannot contain colons");return e&&s.ensureValidHostname(e,this._parts.protocol),this._parts.hostname=this._parts.hostname.replace(o,e),this.build(!t),this},u.domain=function(e,t){if(this._parts.urn)return e===undefined?"":this;typeof e=="boolean"&&(t=e,e=undefined);if(e===undefined){if(!this._parts.hostname||this.is("IP"))return"";var n=this._parts.hostname.match(/\./g);if(n&&n.length<2)return this._parts.hostname;var r=this._parts.hostname.length-this.tld(t).length-1;return r=this._parts.hostname.lastIndexOf(".",r-1)+1,this._parts.hostname.substring(r)||""}if(!e)throw new TypeError("cannot set domain empty");if(e.indexOf(":")!==-1)throw new TypeError("Domains cannot contain colons");s.ensureValidHostname(e,this._parts.protocol);if(!this._parts.hostname||this.is("IP"))this._parts.hostname=e;else{var i=new RegExp(f(this.domain())+"$");this._parts.hostname=this._parts.hostname.replace(i,e)}return this .build(!t),this},u.tld=function(e,t){if(this._parts.urn)return e===undefined?"":this;typeof e=="boolean"&&(t=e,e=undefined);if(e===undefined){if(!this._parts.hostname||this.is("IP"))return"";var r=this._parts.hostname.lastIndexOf("."),i=this._parts.hostname.substring(r+1);return t!==!0&&n&&n.list[i.toLowerCase()]?n.get(this._parts.hostname)||i:i}var s;if(!e)throw new TypeError("cannot set TLD empty");if(e.match(/[^a-zA-Z0-9-]/)){if(!n||!n.is(e))throw new TypeError('TLD "'+e+'" contains characters other than [A-Z0-9]');s=new RegExp(f(this.tld())+"$"),this._parts.hostname=this._parts.hostname.replace(s,e)}else{if(!this._parts.hostname||this.is("IP"))throw new ReferenceError("cannot set TLD on non-domain host");s=new RegExp(f(this.tld())+"$"),this._parts.hostname=this._parts.hostname.replace(s,e)}return this.build(!t),this},u.directory=function(e,t){if(this._parts.urn)return e===undefined?"":this;if(e===undefined||e===!0){if(!this._parts.path&&!this._parts.hostname)return"";if(this._parts.path==="/")return"/";var n=this._parts.path.length-this.filename().length-1,r=this._parts.path.substring(0,n)||(this._parts.hostname?"/":"");return e?s.decodePath(r):r}var i=this._parts.path.length-this.filename().length,o=this._parts.path.substring(0,i),u=new RegExp("^"+f(o));return this.is("relative")||(e||(e="/"),e.charAt(0)!=="/"&&(e="/"+e)),e&&e.charAt(e.length-1)!=="/"&&(e+="/"),e=s.recodePath(e),this._parts.path=this._parts.path.replace(u,e),this.build(!t),this},u.filename=function(e,t){if(this._parts.urn)return e===undefined?"":this;if(typeof e!="string"){if(!this._parts.path||this._parts .path==="/")return"";var n=this._parts.path.lastIndexOf("/"),r=this._parts.path.substring(n+1);return e?s.decodePathSegment(r):r}var i=!1;e.charAt(0)==="/"&&(e=e.substring(1)),e.match(/\.?\//)&&(i=!0);var o=new RegExp(f(this.filename())+"$");return e=s.recodePath(e),this._parts.path=this._parts.path.replace(o,e),i?this.normalizePath(t):this.build(!t),this},u.suffix=function(e,t){if(this._parts.urn)return e===undefined?"":this;if(e===undefined||e===!0){if(!this._parts.path||this._parts.path==="/")return"";var n=this.filename(),r=n.lastIndexOf("."),i,o;return r===-1?"":(i=n.substring(r+1),o=/^[a-z0-9%]+$/i.test(i)?i:"",e?s.decodePathSegment(o):o)}e.charAt(0)==="."&&(e=e.substring(1));var u=this.suffix(),a;if(!u){if(!e)return this;this._parts.path+="."+s.recodePath(e)}else e?a=new RegExp(f(u)+"$"):a=new RegExp(f("."+u)+"$");return a&&(e=s.recodePath(e),this._parts.path=this._parts.path.replace(a,e)),this.build(!t),this},u.segment=function(e,t,n){var r=this._parts.urn?":":"/",i=this.path(),s=i.substring(0,1)==="/",o=i.split(r);e!==undefined&&typeof e!="number"&&(n=t,t=e,e=undefined);if(e!==undefined&&typeof e!="number")throw new Error('Bad segment "'+e+'", must be 0-based integer');s&&o.shift(),e<0&&(e=Math.max(o.length+e,0));if(t===undefined)return e===undefined?o:o[e];if(e===null||o[e]===undefined){if(c(t)){o=[];for(var u=0,a=t.length;u>4).toString(16),e[t*2]=(r[t]&15).toString(16);e[19]=n[r[9]>>6]}else{while(t<36)e[t]=(Math.random()*16|0).toString(16),t++;e[19]=n[Math.random()*4|0]}return e[8]=e[13]=e[18]=e[23]="-",e[14]="4",e.join("")},invertArray:function(e){e||CW.fatalError("invertArray(): You must specify an array to invert");var t,n,r,i={};for(t=0,n=e.length;t=0;--h){u=e[h],a=t[h];if(u!==a){f=SC.typeOf(u);if(i[f])return!1;if(!CW.valuesAreEqual(u,a,f))return!1}}return!0}CW.fatalError("Unsupported type for CW.valuesAreEqual: '%@'".fmt(n))},getSimpleTypes:function(){var e=CW._simpleTypes;return e||(e=CW._simpleTypes={},e[SC.T_STRING]=!0,e[SC.T_NUMBER]=!0,e[SC.T_BOOL]=!0,e[SC.T_UNDEFINED]=!0,e[SC.T_NULL]=!0),e},getUrlParameters:function(e){e||(e=location.search);var t=new URI.parse(e);return t.query?URI.parseQuery(t.query):{}},escapeRegexCharacters:function(e){return e.replace(/[-[\]{}()*+?.,\\^$|#]/g,"\\$&")},formatNumber:function(e,t,n){if(SC.none(e))return"";SC.none(t)&&(t=","),SC.none(n)&&(n="."),e=e.toString();var r=e.split("."),i=r[0],s=r[1],o=/(\d+?)(?=(?:\d{3})+$)/g,u="$1"+t;return i=i.replace (o,u),s?i+n+s:i},preloadTargetImages:function(e){if(SC.APP_IMAGE_ASSETS)for(var t=0,n=SC.APP_IMAGE_ASSETS.length;t0&&!CW.isPrimitive(e)?CW.guidForContents(e,t-1):'"'+SC.guidFor(e)+'"'},isArrayLike:function(e){return Array.isArray(e)?!0:e&&""+e=="[object Arguments]"},isPrimitive:function(e){return e===null||typeof e!="object"&&typeof e!="function"},fontDetector:function(e,t){var n=t.delay||50,r=t.timeout||1e3,i=t.testString||"MMMMMMMIIIa%@!",s=t.testFontFamily||'"Comic Sans MS"',o=t.testFontSize||"300px",u=t.targetFontWeight||"500",a=t.fail,f=t.success,l=t.complete,c,h,p=document.createElement("canvas"),d=p.getContext("2d");d.font=u+" "+o+" "+s;var v=d.measureText(i).width;h=window.setInterval(function(){d.font=u+" "+o+' "'+e+'", '+s,d.measureText(i).width!==v&&v!==0&&(window.clearInterval(h),window.clearTimeout(c),f&&SC.run(f()),l&&SC.run(l(!0)))},n),c=window.setTimeout(function(){window.clearInterval( h),a&&SC.run(a()),l&&SC.run(l(!1))},r)}}),SC.ready(function(){setTimeout(function(){CW.preloadTargetImages()},2e3)}),CW.mixin({fatalError:function(e,t){var n=this.recordStack(YES,YES),r;throw e instanceof Error?r=e:r=new Error(e),t&&SC.mixin(r,t),r.recordedStack=n,r},recordStack:function(e,t){if(t||!this.get("hasSymbolicated"))try{this.symbolicate()}catch(n){}var r=arguments.callee,i=r?r.caller:null,s=0,o=[],u={},a,f,l,c,h,p;i&&e&&(i=i.caller);while(i&&s<26){a=i.displayName,a||(a=i.name),a||(a=i.toString()),a.length>150&&(a=a.substring(0,150)),l={func:a},f=i.arguments;if(f){c=[];for(h=0;h<5;++h)p=f[h],p&&(p.toString?p=p.toString():p="(argument without .toString() method)"),c.push(p);l.args=c}o[s++]=l;if(u[a]){o[s++]="(Because "+a+" was called recursively, no more of the stack is available)";break}u[a]=!0,i=i.caller}return o},hasSymbolicated:NO,namespacesToSymbolicate:["SC"],symbolicate:function(){if(!SC.Object.toString()){SC.warn("Cannot yet properly symbolicate because SproutCore is not yet in a position to provide class names");return}this.hasSymbolicated||(this.hasSymbolicated=!0);if(!SC||!SC.typeOf)return;var e=SC.getCurrentTimeForPerformance();this._symbolicateClassAndSubclasses(SC.Object);var t=this.namespacesToSymbolicate,n=CW.invertArray(t),r,i,s,o,u,a,f,l,c,h;if(!t)return;for(r in window){if(n[r])continue;i=r.charAt(0);if(i.toUpperCase()===i)try{f=window[r],f&&f.isObject&&t.push(r)}catch(p){}}for(u=0,a=t.length;u0))return t.create(e);CW.fatalError("There were %@ errors with the fake reply parameters".fmt(a))}}}),CW.mixin({requestLoggingLevel:null,fakeReplyQueue:null,addFakeReply:function(e,t){SC.typeOf(e)!==SC.T_ARRAY&&(e=SC.$A(e));var n=CW.FakeReply,r=[],i,s,o,u;for(i=0,s=e.length;i Request "+n+": "+i+" to "+s+", headers: "+o+(u?", cookies: "+u:"")+", body: "+a,SC.Logger._handleMessage(t,NO,f))},_logResponseIfAppropriate:function(e){e||CW.fatalError("_logResponseIfAppropriateFor(): A response must be specified");var t=this.get("requestLoggingLevel"),n=SC.getCurrentTimeForPerformance(),r,i,s,o,u,a,f,l,c;if(t){r=e._recordingID,i=e._sentAt,s=e._receivedAtWhileSuspended,o=e.get("timedOut"),o?u=" (timed out)":s?u=i?" ("+(s-i)+"ms, suspended for "+(n-s)+"ms)":" (unknown)":u=i?" ("+(n-i)+"ms)":" (unknown)",a=e.get("status");try{f=this._sortAndStringifyHeaders(e.get("headers"))}catch(h){}e.get("bodyShouldBeLogged")?(l=e.get("encodedBody"),l||(l="(empty)")):l="(omitted)",c="<-- Response "+r+": "+a+u+", headers: "+f+" body: "+l,SC.Logger._handleMessage(t,NO,c)}},_sortAndStringifyHeaders:function(e){var t,n,r,i,s,o=[];for(t in e)o.push(t);o.sort(),r="";for(i=0,s=o.length;i>>4&15)+t.charAt(r&15);return n},rstr2b64:function(e){var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",n="",r=e.length;for(var i=0;ie.length*8?n+=b64pad:n+=t.charAt(s>>>6*(3-o)&63)}return n},str2rstr_utf8:function(e){var t="",n=-1,r,i;while(++n>>6&31,128|r&63):r<=65535?t+=String.fromCharCode(224|r>>>12&15,128|r>>>6&63,128|r&63):r<=2097151&&(t+=String.fromCharCode(240|r>>>18&7,128|r>>>12&63,128|r>>>6&63,128|r&63));return t},rstr2binb:function(e){var t,n=Array(e.length>>2);for(t=0;t>5]|=(e.charCodeAt(t/8)&255)<<24-t%32;return n},binb2rstr:function(e){var t="";for(var n=0;n>5]>>>24-n%32&255);return t},binb_sha1:function(e,t){e[t>>5]|=128<<24-t%32,e[(t+64>>9<<4)+15]=t;var n=Array(80),r=1732584193,i=-271733879,s=-1732584194,o=271733878,u=-1009589776;for(var a=0;a>16)+(t>>16)+(n>>16);return r<<16|n&65535},bit_rol:function(e,t){return e<>>32-t}}),CW.SpritePreloadEnforcement={hasSpritePreloadEnforcement:YES,extraRequiredSrcs:null,extraRequiredImages:null,didFinishWaitingForImages:function(){},initMixin:function(){this.didCreateLayer&&(this._user_didCreateLayer=this.didCreateLayer),this.didCreateLayer=function(){if(this._user_didCreateLayer)var e=this._user_didCreateLayer.apply(this,arguments);return this._preload_didCreateLayer(),e}},_preload_didCreateLayer:function(){if(this.constructor.prototype.__hasPreloadedSprites__){var e=this.constructor.prototype.__preloadedExtraRequiredImages__;e&&(this.extraRequiredImages=e),SC.debug("Creating another instance of "+this.constructor+": all sprite backgrounds are confirmed to have been downloaded. Performing no preload action."),this.hasPaneAnimationSupport&&(SC.debug("Because this is the first append, and this pane has PaneAnimationSupport, we now trigger animateShow() to perform the animation."),this._hasShownFromDidCreateLayer=!0 ,this.animateShow());return}this.hideForPreload(),this.preloadBackgroundSprites(this.getPreloadElementList(),this.showForPreload,this)},getPreloadElementList:function(){return SC.$A(this.$("*"))},hideForPreload:function(){this.set("isVisible",NO)},showForPreload:function(){this.set("isVisible",YES),this.hasPaneAnimationSupport&&(this._hasShownFromDidCreateLayer=!0,this.animateShow())},preloadBackgroundSprites:function(e,t,n){this.__elements__=e,this.__callback__=t,this.__target__=n,this.invokeLast("_preloadBackgroundSprites",e,t,n)},_preloadBackgroundSprites:function(e,t,n){e=this.__elements__,t=this.__callback__,n=this.__target__,this.__target__=this.__callback__=this.__elements__=undefined;var r=CW._backgroundImageLoadedness||(CW._backgroundImageLoadedness={}),i,s=0,o=!1,u=this,a=undefined,f=this.get("extraRequiredSrcs"),l=this.extraRequiredImages=f?{}:null,c=function(){s--,SC.debug("Finished loading "+this._src_+". images remaining before callback: "+s),r[this._src_]=!0,l&&this._extraKey_&&(l[this._extraKey_]=this),s===0&&(SC.debug("All images are downloaded. Now running callback."),h())},h=function(e){a&&clearTimeout(a);if(o){SC.debug("Performing the callback for all images having finished loading, but it has already been performed. Aborting.");return}e||(u.constructor.prototype.__hasPreloadedSprites__=!0,l&&(u.constructor.prototype.__preloadedExtraRequiredImages__=l)),u.didFinishWaitingForImages(),o=!0,SC.run(function(){t.apply(n||u)})};e=SC.$A(e);for(var p=0,d,v,m,g;d=e[p];p++){m=jQuery(d).css("background-image");if(!m)continue;if(m.indexOf("http")===-1)continue;if(m.indexOf ("url(")===-1)continue;m=m.substring(4,m.length-1);if((v=m.charAt(0))==='"'||v==="'")m=m.substring(1);if((v=m.charAt(m.length-1))==='"'||v==="'")m=m.substring(0,m.length-1);if(r[m])continue;if(i&&i[m])continue;(i||(i={}))[m]=!0,s++,g=new Image,g.onload=c,SC.debug("Preloading "+m),g.src=g._src_=m}if(f)for(p in f){if(!f.hasOwnProperty(p))continue;m=f[p],s++,g=new Image,g.onload=c,SC.debug("Preloading explicitly-specified image "+m),g.src=g._src_=m,g._extraKey_=p}if(s===0)SC.debug("Preloading background images, but every image was already loaded. Running callback immediately."),h();else{var y=SC.buildMode==="debug"?3e3:1500;a=setTimeout(function(){SC.debug("Attempted to preload background images, but the loading is taking longer than "+y/1e3+" seconds. Now running callback regardless of image loadedness."),h(!0)},y)}}},CW.TouchApproximation={isTouchApproximationEnabled:YES,distanceThreshold:50,touchStart:function(e){var t=this.convertFrameFromView({x:e.pageX,y:e.pageY}),n=t.x,r=t.y,i,s,o=this.get("touchApproximationViews")||this.get("childViews"),u=this.get("distanceThreshold"),a=null,f=Infinity,l,c,h,p,d;p=o.get("length");for(h=0;hc.x+c.width&&(i=n-(c.x+c.width)),rc.y+c.height&&(s=r-(c.y+c.height)),i!==-1&&s!==-1?i=(i+s)/2:s!==-1&&(i=s),i!==-1&&i>18&63,l=p>>12&63,c=p>>6&63,h=p&63,s[r++]=t.charAt(f)+t.charAt(l)+t.charAt(c)+t.charAt(h);while(n>4,s=(a&15)<<4|f>>2,o=(f&3)<<6|l,t+=String.fromCharCode(i),f!==64&&(t+=String.fromCharCode(s)),l!==64&&(t+=String.fromCharCode(o));t=this.decodeUTF8(t)}else CW.fatalError("Cannot decode blank input");return t},encodeUTF8:function(e){e=e.replace(/\r\n/g,"\n");var t="",n,r,i;for(n=0,r=e.length;n>6|192),t+=String.fromCharCode(i&63|128)):i<65536?(t+=String.fromCharCode(i>>12|224),t+=String.fromCharCode(i>>6&63|128),t+=String.fromCharCode(i&63|128)):(t+=String.fromCharCode(i>>18|240),t+=String.fromCharCode(i>>12&63|128),t+=String.fromCharCode(i>>6&63|128),t+=String.fromCharCode(i&63|128));return t},decodeUTF8:function(e){var t="",n=0,r,i,s,o;r=i= s=o=0;var u=String.fromCodePoint||this._fromCodePoint,a=String.fromCharCode;while(n191&&r<224?(i=e.charCodeAt(n++),t+=a((r&31)<<6|i&63)):r>=224&&r<240?(i=e.charCodeAt(n++),s=e.charCodeAt(n++),t+=a((r&15)<<12|(i&63)<<6|s&63)):r>=240&&(i=e.charCodeAt(n++),s=e.charCodeAt(n++),o=e.charCodeAt(n++),t+=u((r&7)<<18|(i&63)<<12|(s&63)<<6|o&63));return t},_fromCodePoint:function(e){if(e<65536)return String.fromCharCode(e);var t=((e-=65536)>>10)+55296,n=e%1024+56320;return String.fromCharCode(t,n)},_b64:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="}),CW.DATE_ONLY=0,CW.DATE_TIME=1,CW.DATE_TIME_TO_MIDNIGHT=3,CW.DATE_TIME_SEC=4,CW.DAY_MIN_DUR=1440,CW.DAY_MILLIS_DUR=864e5,CW.Date={value:null,dateType:CW.DATE_ONLY,timeFormat:null,fullDateFormat:null,dateFormat:null,_dateObj:null,_timezoneOffset:0,incrementSeconds:function(e){return this.seconds(this.seconds()+e),this},incrementMinutes:function(e){return this.minutes(this.minutes()+e),this},incrementHours:function(e){return this.hours(this.hours()+e),this},incrementDate:function(e){return this.date(this.date()+e),this},incrementMonth:function(e){return this.month(this.month()+e),this},incrementYear:function(e){return this.year(this.year()+e),this},now:function(){this._dateObj=new Date;var e=this._dateObj.getTime(),t=this._dateObj.getTimezoneOffset()*6e4;return this._dateObj.setTime(e-t),this._dateObj._isUsingUTC=!0,this._dateComponentDidChange(),this},dateComponent:function(){var e=this.value;return e?e[0]:null},date:function(e){return e!==undefined?(this._dateObj .setUTCDate(e),this._dateComponentDidChange()):this.value[3]},dateObject:function(){return this._dateObj},day:function(){return this._dateObj.getUTCDay()},fullYear:function(e){return e!==undefined?(this._dateObj.setUTCFullYear(e),this._dateComponentDidChange()):this.value[1]},hours:function(e){return e!==undefined?(this._dateObj.setUTCHours(e),this._dateComponentDidChange()):this.value[4]},minutes:function(e){return e!==undefined?(this._dateObj.setUTCMinutes(e),this._dateComponentDidChange()):this.value[5]},seconds:function(e){return this.dateType===CW.DATE_TIME_SEC?e!==undefined?(this._dateObj.setUTCSeconds(e),this._dateComponentDidChange()):this.value[6]:0},month:function(e){return e!==undefined?(this._dateObj.setUTCMonth(e),this._dateComponentDidChange()):this._dateObj.getUTCMonth()},time:function(e){return e!==undefined?(this._dateObj.setTime(e),this._dateComponentDidChange()):this._dateObj.getTime()},timezoneOffset:function(e){return e!==undefined?(this.set("_timezoneOffset",e),this._dateComponentDidChange()):this.get("_timezoneOffset")},year:function(e){return this.fullYear(e)},changeDateType:function(e){return e===this.dateType?this:(e===CW.DATE_ONLY||e===CW.DATE_TIME||e===CW.DATE_TIME_TO_MIDNIGHT||e===CW.DATE_TIME_SEC?(this.dateType=e,this._dateComponentDidChange()):CW.fatalError("You must provide a valid date type."),this)},weekNumber:function(e){e=e?e:this._dateObj;var t=new Date(e.getUTCFullYear(),0,1),n=1,r=t.getUTCDay()-n,i=Math.floor((e.getTime()-t.getTime())/CW.DAY_MILLIS_DUR)+1,s,o,u,a,f;return r=r>=0?r:r+7,r<4?(s=Math.floor((i+r-1)/7)+1,s>52&&(o=new Date(e.getUTCFullYear ()+1,0,1),u=o.getUTCDay()-n,u=u>=0?u:u+7,s=u<4?1:53)):(a=Math.floor((i+r-1)/7),s=a===0?53:a),f=e.getUTCFullYear(),s===53&&e.getUTCMonth()===0?f--:s===1&&e.getUTCMonth()===11&&f++,[f,s]},weekNumberToDate:function(e,t){e=parseInt(e,0),t=parseInt(t,0);var n=new Date(t,0,10,12,0,0),r=new Date(t,0,4,12,0,0),i=new Date(r.getTime()-n.getUTCDay()*CW.DAY_MILLIS_DUR),s=new Date(i.getTime()+(e-1)*6048e5),o=new Date(s.getTime()+5184e5),u=[s,o];return u},dateRangeOfWeek:function(){var e=this._dateObj,t=e.getUTCDay(),n;t===0?n=6:n=t+1;var r=new Date(e.valueOf());r.setDate(e.getUTCDate()-n);var i=new Date(e.valueOf());return i.setDate(e.getUTCDate()+(7-e.getUTCDay())),[r,i]},daysInMonth:function(){var e=this.year(),t=this.month(),n=[31,28,31,30,31,30,31,31,30,31,30,31];return t===1&&(e%4===0&&e%100!==0||e%400===0)?29:n[t]},toTimeString:function(e){return e?this.format(e):this.timeFormat?this.format(this.timeFormat):this._dateObj.toString().substr(16,5)},toString:function(e){if(e)return this.format(e);if(this.fullDateFormat)return this.format(this.fullDateFormat);var t=this._dateObj;return t?t.toString():"null"},toDateString:function(e){return e?this.format(e):this.dateFormat?this.format(this.dateFormat):this._dateObj.toString().substr(0,15)},parse:function(e){var t=this._dateObj;return SC.typeOf(e)===SC.T_ARRAY?(isNaN(e[3])||t.setUTCDate(e[3]),isNaN(e[1])||t.setUTCFullYear(e[1]),isNaN(e[2])||t.setUTCMonth(e[2]-1),!isNaN(e[3])&&e[3]!==t.getUTCDate()&&t.setUTCDate(e[3]),this.dateType===CW.DATE_ONLY?(t.setUTCHours(12),t.setUTCMinutes(0)):(isNaN(e[4])||t.setUTCHours(e[4]),isNaN(e[5])||t.setUTCMinutes (e[5]),this.dateType===CW.DATE_TIME_SEC&&(isNaN(e[6])||t.setUTCSeconds(e[6])))):e&&e.getTime&&(e._isUsingUTC?(t.setUTCFullYear(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate()),t.setUTCHours(e.getUTCHours()),t.setUTCMinutes(e.getUTCMinutes()),this.dateType===CW.DATE_TIME_SEC&&t.setUTCSeconds(e.getUTCSeconds())):(t.setUTCFullYear(e.getFullYear(),e.getMonth(),e.getDate()),t.setUTCHours(e.getHours()),t.setUTCMinutes(e.getMinutes()),this.dateType===CW.DATE_TIME_SEC&&t.setUTCSeconds(e.getSeconds()))),this.dateType!==CW.DATE_TIME_SEC&&t.setUTCSeconds(0),t.setUTCMilliseconds(0),t._isUsingUTC=!0,this._dateObj=t,this._dateComponentDidChange(),this},format:function(e,t){e+="",t&&(e=e.loc());var n=this._dateObj,r=this.value||{},i=e.length,s="",o=0,u="",a="",f=r[1]+"",l=r[2],c=r[3],h=n.getUTCDay(),p=r[4],d=r[5],v=n.getUTCSeconds(),m,g,y,b,w,E,S,x,T,N,C,k,L,A,O,M,_;f.length<3&&(f>=0&&f<=28?f=""+(f+2e3):f>=28&&f<=99&&(f=""+(f+1900))),r.y=""+f,r.yyyy=f,r.yy=f.substring(2,4),r.M=l,r.MM=LZ(l),r.MMM=MONTH_NAMES[l-1],r.NNN=MONTH_NAMES[l+11],r.d=c,r.dd=LZ(c),r.E=DAY_NAMES[h+7],r.EE=DAY_NAMES[h],r.H=p,r.HH=LZ(p),p===0?r.h=12:p>12?r.h=p-12:r.h=p,r.hh=LZ(r.h),p>11?r.K=p-12:r.K=p,r.k=p+1,r.KK=LZ(r.K),r.kk=LZ(r.k),p>11?r.a="SC.Date.Period.PM".loc():r.a="SC.Date.Period.AM".loc(),r.m=d,r.mm=LZ(d),r.s=v,r.ss=LZ(v);while(o0?(n=CW.Date._pool.pop(),n.value=null,n.dateType=CW.DATE_ONLY):n=SC.beget(CW.Date),n._dateObj=new Date,n._dateObj._isUsingUTC=!0,e&&SC.typeOf(e)===SC.T_NUMBER&&(t=e,e=null),t!==undefined&&(n.dateType=t),n.parse(e),n},createFromDateObject:function(e,t){var n;return CW .Date._pool.length>0?(n=CW.Date._pool.pop(),n.value=null,n.dateType=CW.DATE_ONLY):n=SC.beget(CW.Date),n._dateObj=e,n.dateType=t||CW.DATE_ONLY,n},createFromDateComponent:function(e){e||CW.fatalError("createFromDateComponent(): No date component was specified");var t=Math.floor(e/1e4),n=Math.floor(e/100)-t*100,r=e-t*1e4-n*100,i=[e,t,n,r],s=CW.Date.create(i,CW.DATE_ONLY);return s},areDatesInRange:function(e,t,n,r){return!e||!t?NO:t[0]===n[0]&&t[6]===1440?NO:e[0]>=n[0]&&e[0]<=r[0]||t[0]>=n[0]&&t[0]<=r[0]||e[0]<=n[0]&&t[0]>=r[0]},compareDates:function(e,t,n){if(!e||!t)return e||t;var r,i,s,o;return r=e._dateObj?e.components():e,i=t._dateObj?t.components():t,r[0]o?n?e:t:null):n?e:t},greaterThan:function(e,t){SC.typeOf(e)===SC.T_ARRAY&&(e=CW.Date.create(e)),SC.typeOf(t)===SC.T_ARRAY&&(t=CW.Date.create(t));var n=this.compareDates(e,t,YES);return n===e?YES:NO}}),CW.DateParser={parseDate:function(e,t,n,r){var i,s,o,u,a,f,l,c,h,p,d,v,m,g,y,b,w=["Sunday".loc().toLowerCase(),"Monday".loc().toLowerCase(),"Tuesday".loc().toLowerCase(),"Wednesday".loc().toLowerCase(),"Thursday".loc().toLowerCase(),"Friday".loc().toLowerCase()],E=e.toLowerCase(),S,x,T,N,C,k=SC.Locale.currentLocale.language,L;if(!isNaN(e)&&parseInt(e,10)>31)i=CW.Date.create(t),b=e.length,b===2?(n?(s=parseInt(e.charAt(1),10)-1,o=parseInt(e.charAt(0),10)):(s=parseInt(e.charAt(0),10)-1,o=parseInt(e.charAt(1),10)),u=(new Date).getFullYear()):b===3?(v=e,a=parseInt(e.charAt(0),10),c=parseInt(e.substr(0,2),10),h=parseInt(e.substr(1,2),10),l=parseInt(e.charAt(2),10), n?(s=h<=12?h-1:l-1,o=h<=12?a:c):(s=c<=12?c-1:a-1,o=c<=12?l:h),u=(new Date).getFullYear()):b===4?(m=e,a=parseInt(e.charAt(0),10),c=parseInt(e.substr(0,2),10),p=parseInt(e.substr(2,2),10),f=parseInt(e.charAt(1),10),n?(s=h<=12?h-1:l-1,o=h<=12?a:c):(s=c<=12&&p<=31?c-1:a-1,o=c<=12&&p<=31?p:f,u=c<=12&&p<=31?(new Date).getFullYear():2e3+p)):b===5?(g=parseInt(e,10).toString(),a=parseInt(e.charAt(0),10),c=parseInt(e.substr(0,2),10),h=parseInt(e.substr(1,2),10),y=parseInt(e.substr(3,2),10),l=parseInt(e.substr(2,1),10),n?(s=h<=12?h-1:l-1,o=h<=12?a:c):(s=c<=12?c-1:a-1,o=c<=12?l:h),u=2e3+y):b>=6&&b<=8&&(c=parseInt(e.substr(0,2),10),p=parseInt(e.substr(2,2),10),l=parseInt(e.charAt(2),10),y=parseInt(e.substr(3,2),10),d=parseInt(e.substr(4),10),b===6&&p===20||b===7&&y===20?b===6&&p===20?n?(s=f-1,o=a):(s=a-1,o=f):b===7&&y===20&&(n?(s=h<=12?h-1:l-1,o=h<=12?a:c):(s=c<=12?c-1:a-1,o=c<=12?l:h)):(s=c<=12?c-1:p<=12&&c>=1&&c<=31?p-1:-1,o=p>=1&&p<=31&&s===c-1?p:c>=1&&c<=31&&s===p-1?c:-1,u=b>6?d:2e3+d)),s<0||s>=12||o<1||o>31||u<0?i=null:(i._dateObj.set({month:s,day:o,year:u}),i._dateComponentDidChange());else if(!isNaN(e)&&(L=parseInt(e,10))<31){i=CW.Date.create();var A=Date.parse(e);SC.none(A)?i=null:(i._dateObj=A,i._dateComponentDidChange())}return i}},CW.Response=SC.XHRResponse.extend({bodyShouldBeLogged:function(){var e=this.get("status");return!SC.none(e)&&e!==200}.property("status"),fakeReply:null,overallTimeoutTimer:null,addedToOutgoingQueueTimestamp:null,getFullAddress:function(){return this.get("request").getFullAddress()},notify:function(){var e=arguments.callee.base.apply(this,arguments),t= CW.RequestManagement,n;return t&&(n=t.sharedInstance()),n&&n.removeOutstandingResponse(this),e},fire:function(e){var t=this.get("request"),n=t?t.get("source"):null;n&&n.willSend&&n.willSend(t,this),t.freeze(),this.get("isCancelled")||this.invokeTransport(e);var r=t.get("timeout");if(r){var i=SC.Timer.schedule({target:this,action:"timeoutReached",interval:r,repeats:NO});this.set("timeoutTimer",i)}!this.get("isCancelled")&&n&&n.didSend&&n.didSend(t,this)},timeoutReached:function(){var e=this.get("timeoutTimer");return e&&e.invalidate(),e=this.get("overallTimeoutTimer"),e&&e.invalidate(),arguments.callee.base.apply(this,arguments)},receive:function(e,t){var n=this.get("overallTimeoutTimer");return n&&n.invalidate(),arguments.callee.base.apply(this,arguments)},invokeTransport:function(){var e=this.get("fakeReply"),t;if(!e){var n=this.createRequest(),r,i,s;return this.set("rawRequest",n),s=!!this.getPath("request.isAsynchronous"),s&&(!SC.browser.msie&&!SC.browser.opera?SC.Event.add(n,"readystatechange",this,this.finishRequest,n):(r=this,i=function(){if(!r)return null;var e=r.finishRequest();return e&&(r=null),e},n.onreadystatechange=i)),n.open(this.get("type"),this.getFullAddress(),s),this.setRequestHeaders(),this.getPath("request.useCrossDomain")&&this.getPath("request.withCredentials")&&(n.withCredentials=!0),n.send(this.getPath("request.encodedBody")),s||this.finishRequest(),n}this.set("rawRequest",e),t=e.get("delay"),this.invokeLater(this._triggerFakeReply,t)},setRequestHeaders:function(){var e=this.get("rawRequest"),t=this.getPath("request.headers");for(var n in t)e.setRequestHeader (n,t[n])},cancelTransport:function(){var e=this.get("fakeReply");if(e)return;return arguments.callee.base.apply(this,arguments)},_triggerFakeReply:function(){var e=this.get("fakeReply");e&&(e.set("readyState",4),this.finishRequest(undefined))}}),CW.IFramePostMessageResponse=CW.Response.extend({isCrossDomain:YES,requestId:-1,rawResponse:null,_activeRequests:{},destinationDomain:"",headers:function(){var e=this.get("rawResponse");if(!e)return{};var t=e.headers,n={};return t?(t.split("\n").forEach(function(e){var t=e.indexOf(":"),r,i;t>=0&&(r=e.slice(0,t),i=e.slice(t+1).trim(),n[r]=i)},this),n):n}.property("status").cacheable(),header:function(e){var t=this.get("headers");return t[e]||null},encodedBody:function(){var e=this.get("rawResponse");return e?e.responseText:""}.property("status").cacheable(),invokeTransport:function(e){var t=this.get("request"),n={requestId:e,url:t.getFullAddress(),type:t.get("type"),headers:t.get("headers"),body:t.get("body"),isAsynchronous:t.get("isAsynchronous")},r=SC.Request.manager.get("crossDomainIFrames")[t.get("destinationDomain")];try{r.contentWindow.postMessage(SC.json.encode(n),this.get("destinationDomain"))}catch(i){SC.debug('CW.IFramePostMessageResponse: iFrame not properly loaded from "%@". Maybe ajax_sender.html is missing?',r.src)}},finishRequest:function(e){var t=this.get("rawResponse"),n=t?t.readyState:null,r,i,s;return n===4&&!this.get("timedOut")?(this.receive(function(e){if(!e)return;i=-1;try{i=t.status||0}catch(n){}if(i<200||i>=300){try{s=t.statusText||""}catch(o){s=""}r=SC.$error(s||"HTTP Request failed","Request",i),r.set("errorValue" ,this),this.set("isError",YES),this.set("errorObject",r)}this.set("status",i)},this),!SC.browser.msie&&!SC.browser.opera?SC.Event.remove(t,"readystatechange",this,this.finishRequest):t.onreadystatechange=null,YES):NO},cancelTransport:function(){this.set("rawRequest",null)}}),CW.ImagePreloader=SC.Object.extend({images:null,callBack:null,init:function(){this.loadImages()},loadImages:function(){this._numLoaded=0,this._numProcessed=0,this._allImages=[],this._numImages=this.get("images").length;for(var e=0;e=0;r--)if(n[r].performKeyEquivalent(e,t))return YES;return NO},installKeyResponder:function(){var e=SC.RootResponder.prototype.attemptKeyEquivalent;SC.RootResponder.reopen({attemptKeyEquivalent:function(t){var n=e.apply(this,arguments);if(n)return n;var r=t.commandCodes()[0];return r?CW.performKeyEquivalent(r,t):NO}}),SC.View.reopen(CW.ViewKeyHandlingHelpers),SC.Pane.reopen(CW.KeyResponder),SC.ButtonView.reopen(CW.ButtonKeyHandlingHelpers)}}),CW.keyResponders.push(CW.globalKeyResponder),CW.LOG_NOTIFICATIONS=NO,CW.notificationCenter=SC.Object.create({_subscriptions:{},postNotification:function(e){var t=this._subscriptions;if(!t[e]){CW.LOG_NOTIFICATIONS&&SC.info("Notification Center: Could not find any subscribers for %@, returning." .fmt(e));return}var n=t[e],r=n.length,i=SC.A(arguments).slice(1);i||(i=[]),CW.LOG_NOTIFICATIONS&&SC.info("Notification Center: Posting notification %@".fmt(e));for(var s=0;s0?(t._receivedAtWhileSuspended=SC.getCurrentTimeForPerformance(),r=n._suspendedResponses,r?r.push(t):r=n._suspendedResponses=[t],t.get("isCancelled")||(t._receivedWhenSuspended=YES,t.set("isCancelled",YES))):CW._logResponseIfAppropriate(t)},destinationDomain:function(){var e=this.getFullAddress(),t=null,n,r;if(e){if(URI(e).protocol()===""||URI(e).host()==="")return SC.error("Malformed URL: "+e),null;t=URI(e).protocol()+"://"+URI(e).host()}return t}.property("addressPrefix","address"),cycleDidChange:function(){var e=CW.RequestManagement,t=e?e.sharedInstance():null,n,r;t&&(n=this.get("cycle"),this._isPending?n!==this._cycleWhenPended&&t.cycleDidChangeForPendingRequest():(r=this._cycleWhenSent,r&&n!==r&&t.cycleDidChangeForOutstandingResponse()))}.observes("cycle"),toString:function(){var e=arguments.callee.base.apply(this,arguments),t=this.get("address");return t&&(e+=" ("+t+")"),e},_crossDomainMethod:null,_queryParameters:null,_isPending:NO,_cycleWhenPended:null,_cycleWhenSent:null,_determineResponseClassAndMethod:function(){var e=SC.kindOf,t, n;if(this.get("useCrossDomain")){t=this.get("responseClass"),t||(XMLHttpRequest&&"withCredentials"in new XMLHttpRequest?t=CW.Response:this._isAppropriateForXDomainRequest()?t=CW.XDRResponse:window.postMessage?t=CW.IFramePostMessageResponse:SC.browser.msie&&SC.browser.version<=7&&(t=CW.IFrameDocumentDomainResponse));if(!this._crossDomainMethod){if(e(t,CW.IFramePostMessageResponse))n="postMessage";else if(e(t,CW.IFrameDocumentDomainResponse))n="documentDomain";else if(e(t,CW.Response)||e(t,CW.XDRResponse))n="cors";n&&(this._crossDomainMethod=n)}}else t=CW.Response;!this.get("responseClass")&&t&&this.set("responseClass",t)},_isAppropriateForXDomainRequest:function(){var e=this.get("headers"),t=YES,n;if(e)for(n in e)if(n.toLowerCase()!=="content-type"||e[n]!=="text/plain")t=NO;return t&&SC.browser.msie&&SC.browser.version<=9&&!this.get("withCredentials")?YES:NO},_getFakeReply:function(){var e=CW.get("fakeReplyQueue"),t=e?e.length:0,n=null,r,i,s,o,u,a;if(t>0){r=this.get("isBackgroundRequest"),i=null;for(s=0;s0&&t.length=n[0]&&e<=n[1])return YES}return NO},stringIsCJK:function(e){e=e.trim();if(SC.empty(e))return NO;var t=0,n=e.length-1;while(t<=n)if(!this.characterCodeIsCJK(e.charCodeAt(t++))||!this.characterCodeIsCJK(e.charCodeAt(n--)))return NO;return YES}}),SC.time= function(e){var t=SC.beget(fn);return t.value=e,t},function(){var e=new Date;SC.mixin(SC.time,{month:function(t,n){return e.setTime(t),n===undefined?e.getMonth():(e.setMonth(n),e.getTime())},utc:function(t){return e.setTime(t),t+e.getTimezoneOffset()*60*1e3},local:function(t){return e.setTime(t),t-e.getTimezoneOffset()*60*1e3},parse:function(e){},format:function(e){}})}(),SC.time.fmt=SC.time.format,SC.time.fn={done:function(){return this.value}},"month day year".split(" ").forEach(function(e){SC.time.fn[e]=function(t){return t===undefined?SC.time[e](this.value):(this.value=SC.time[e](this.value,t),this)}});var MONTH_NAMES=["January","February","March","April","May","June","July","August","September","October","November","December","Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],DAY_NAMES=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sun","Mon","Tue","Wed","Thu","Fri","Sat"];SC.Locale.define("en",{longMonthNames:"January February March April May".split(" "),shortMonthNames:[],shortDateFormat:"dd/mm/yy",longDateFormat:""}),SC.mixin(Date,{isDate:function(e,t){var n=Date.getDateFromFormat(e,t);return n===0?!1:!0},compareDates:function(e,t,n,r){var i=Date.getDateFromFormat(e,t),s=Date.getDateFromFormat(n,r);return i===0||s===0?-1:i>s?1:0},getDateFromFormat:function(e,t){e+="",t+="";var n=0,r=0,i="",s="",o="",u,a,f=new Date,l=f.getFullYear(),c=f.getMonth()+1,h=1,p=f.getHours(),d=f.getMinutes(),v=f.getSeconds(),m="",g=SC.Locale.currentLocale;while(r70?l=1900+(l-0):l=2e3+(l-0))}else if(s==="MMM"||s==="NNN"){c=0;for(var y=0;y11){c=y+1,c>12&&(c-=12),n+=b.length;break}}if(c<1||c>12)return 0}else if(s==="EE"||s==="E")for(y=0;y12)return 0;n+=c.length}else if(s==="dd"||s==="d"){h=Date._getInt(e,n,s.length,2);if(h===null||h<1||h>31)return 0;n+=h.length}else if(s==="hh"||s==="h"){p=Date._getInt(e,n,s.length,2);if(p===null||p<1||p>12)return 0;n+=p.length}else if(s==="HH"||s==="H"){p=Date._getInt(e,n,s.length,2);if(p===null||p<0||p>23)return 0;n+=p.length}else if(s==="KK"||s==="K"){p=Date._getInt(e,n,s.length,2);if(p===null||p<0||p>11)return 0;n+=p.length}else if(s==="kk"||s==="k"){p=Date._getInt(e,n,s.length,2);if(p===null||p<1||p>24)return 0;n+=p.length,p--}else if(s==="mm"||s==="m"){d=Date._getInt(e,n,s.length,2);if(d===null||d<0||d>59)return 0;n+=d.length}else if(s==="ss"||s==="s"){v=Date._getInt(e,n,s.length,2);if(v===null||v<0||v>59)return 0;n+=v.length}else if(s==="a"){if(e.substring(n,n+2).toLowerCase()==="am")m="AM";else{if(e.substring(n,n+2).toLowerCase()!=="pm")return 0;m="PM"}n+=2}else{if(e.substring(n,n+s.length)!=s)return 0;n+= s.length}}if(n!==e.length)return 0;if(c===2)if(l%4===0&&l%100!==0||l%400===0){if(h>29)return 0}else if(h>28)return 0;if(c===4||c===6||c===9||c===11)if(h>30)return 0;p<12&&m=="PM"?p=p-0+12:p>11&&m=="AM"&&(p-=12);var E=new Date(l,c-1,h,p,d,v);return E.getTime()},parseDate:function(e){var t=arguments.length==2?arguments[1]:!1,n=["E NNN dd HH:mm:ss UTC yyyy","y-M-d","y-M-d","MMM d, y","MMM d,y","y-MMM-d","d-MMM-y","MMM d","d MMM y","d.MMM.y","y MMM d","y.MMM.d"],r=["M/d/y","M-d-y","M.d.y","MMM-d","M/d","M-d"],i=["d/M/y","d-M-y","d.M.y","d-MMM","d/M","d-M"],s=t?n.concat(i,r):n.concat(r,i),o=null;o=0;var u=(new Date).getTime();switch(e.toLowerCase()){case SC.String.loc("yesterday"):o=u-864e5;break;case SC.String.loc("today"):case SC.String.loc("now"):o=u;break;case SC.String.loc("tomorrow"):o=u+864e5}if(o>0)return new Date(o);for(var a=0;a=n;i--){var s=e.substring(t,t+i);if(s.length12?L.h=l-12:L.h=l,L.hh=LZ(L.h),l>11?L.K=l-12:L.K=l,L.k=l+1,L.KK=LZ(L.K),L.kk=LZ(L.k),l>11?L.a="PM":L.a="AM",L.m=c,L.mm=LZ(c),L.s=h,L.ss=LZ(h);while(r=0;n--){var r=e[n],i=this._fileIsAcceptableToUpload(r);if(i!==CW.UPLOADER_READY)t.push(this._errorForFile(r,i));else if(this.shouldUploadFile(r))try{this._createAndSendUploadRequest(r)}catch(s){console.warn(s.toString())}}return t},_xhrHeaders:function(){var e={"If-Modified-Since":"Mon, 26 Jul 1997 05:00:00 GMT","Cache-Control":"no-cache","X-Requested-With":"XMLHttpRequest"};return this.get("encloseFileWithinForm")||(e["Content-Type"]="text/plain"),e}.property("encloseFileWithinForm").cacheable(),_fileTooBigDescription:"Uploader.fileTooBigDescription".loc(),_wrongFileTypeDescription:"Uploader.wrongFiletypeDescription".loc(),_createAndSendUploadRequest:function(e){var t=this.get("uploadURL");if(!t)throw"%@: Can't upload file if uploadURL is not set.".fmt(this);var n=this.get("encloseFileWithinForm"), r;n?(r=new FormData,r.append(this.get("formFieldName"),e)):r=e;var i=new XMLHttpRequest;if(!i)throw this._errorForFile(e,CW.UPLOADER_MISSING_XHR);this.willUploadFile(e,i),i.open("POST",t,!0),this.setRequestHeaders(e,i),this.get("withCredentials")&&(i.withCredentials=YES),i.send(r)},_fileIsAcceptableToUpload:function(e){var t=CW.UPLOADER_READY,n=this.get("maximumFileSize"),r=this.get("allowedFileTypes"),i=e.type.split("/")[1];return e.fileSize>n&&(t=CW.UPLOADER_FILE_TOO_BIG),r.indexOf(i)===-1&&(t=CW.UPLOADER_INCOMPATIBLE_FILE_TYPE),t},_errorForFile:function(e,t){var n="",r="";switch(t){case CW.UPLOADER_INCOMPATIBLE_FILE_TYPE:n=this._wrongFileTypeDescription;break;case CW.UPLOADER_FILE_TOO_BIG:n=this._fileTooBigDescription}return SC.$error(n,r,e,t)}}),CW.XDRResponse=CW.Response.extend({createRequest:function(){var e=new XDomainRequest,t=this;return e.timeout=null,e.onerror=function(){if(!t)return null;var e=t.finishRequest();return e&&(t=null),e},e.onload=function(){if(!t)return null;var e=t.finishRequest(200);return e&&(t=null),e},e},setRequestHeaders:function(){},finishRequest:function(e){var t=this.get("rawRequest");return t.readyState=4,t.status=e,arguments.callee.base.apply(this,arguments)}}),window.CW||(window.CW={}),function(){var e=CW.Animator=CW.Anim={fps:60,fpsModifier:65/60,tasks:[],speedMultiplier:1,frameCount:0,isActive:!1,isInFrame:!1,extraStatus:{},ENABLE_OLD_IE:!0,_runningCWAguid:0,_hasSC:!!(window.SC&&SC.RunLoop&&SC.Object),_frameTimeNoiseLevelingWindowSize:30,_frameNoiseLevelerLog:[],_movingAverageFrameTime:function(){for(var t=0,n=e._frameNoiseLevelerLog,r=0 ,i=n.length;t=300&&o>=(r=Math.max(e._movingAverageFrameTime(),60))*5?(o=0,i.unshift(r/2)):i.unshift(o),i.length<=s||(i.length=s),e.frameTime=o;var f=!e._hasSC||SC.RunLoop.isRunLoopInProgress();if(!e.shouldSkipFrame||!e.shouldSkipFrame()){f||(SC.RunLoop.begin(),e._SCLoopBegan()),e.trigger("preframe");for(var l=0,c;c=e.tasks[l];l++)c.running&&c.elapse(o*e.speedMultiplier);e._canAddLastSecondTasks=!1;for(l=0;c=e.tasks[l];l++)c.running?c&&(c.fps||e.fps)>a&&(a=c.fps||e.fps):(c._inCWATasks=!1,e.tasks.splice(l--,1));e.trigger("frame"),f||(SC.RunLoop.end(),e._SCLoopEnded()),e.isActive=!!e.tasks.length,e.frameCount++}else e._canAddLastSecondTasks=!1;e.frameRate=Math.round(1e5/u)/100,e.computeTime=(new Date).valueOf()-e.now;var h=Math.round(1e3/(a*e.fpsModifier));e.timeoutWaitTime=Math.max(0,h-e.computeTime),e.clearNextTimeout(),!n&&e.isActive?e.useRAF?e._timeout=window.requestAnimationFrame(e.nextFrame,document.body):e._timeout=setTimeout(e.nextFrame,e.lock16?16:e.timeoutWaitTime):e.stop(),e.firstActiveFrame&&(e.firstActiveFrame=!1),e.isInFrame=!1,e._alreadyExpeditedNextFrame=!1 },start:function(){if(e.isActive){e._canAddLastSecondTasks||e.expediteNextFrame();return}e.firstActiveFrame=!0,e.isActive=!0,e._lastFrameTime=-1,e.frameTime=1e3/e.fps,e.frameRate=1e3/e.frameTime,e.computeTime=0,e.trigger("start"),e.nextFrame()},stop:function(){e.isActive=!1,e.frameTime=Infinity,e.frameRate=0,e.computeTime=NaN,e.timeoutWaitTime=NaN,e.clearNextTimeout(),e.trigger("stop")},clearNextTimeout:function(){if(!e._timeout)return;e.useRAF?window.cancelRequestAnimationFrame(e._timeout):clearTimeout(e._timeout),e._timeout=0},expediteNextFrame:function(){if(e._alreadyExpeditedNextFrame||!e.isActive)return;e._alreadyExpeditedNextFrame=!0,e.clearNextTimeout(),e._timeout=setTimeout(e.nextFrame,0)},handleTask:function(t){if(!t||t.isDestroyed)return;if(!t._inCWATasks){if(t.name)for(var n=0,r=e.tasks,i;i=r[n];n++)i.name===t.name&&i.stop();e.tasks.push(t)}t._inCWATasks=!0,e.start()},tellStop:function(){arguments._isArgs_=!0,this.performMethodOn("stop",arguments)},tellFinish:function(){arguments._isArgs_=!0,this.performMethodOn("finish",arguments)},performMethodOn:function(e,t){var n=1,r=arguments;t&&t._isArgs_&&(n=0,r=t);for(var i=n,s,o=r.length;i").split(" ").join("  ")},toCamel:function(e,t){for(var n=0,r=e.length;n.9999||isNaN(t)?this.removeOpacity(e):(e.cwa$opacity=t,e.style.opacity=t,t)):-1},removeOpacity:function(e){return e?(e.cwa$opacity=1,e.style.opacity="",1):-1},encodeColor:function(e,t,n){if(typeof e=="object"&&typeof e.r=="number"&&typeof e.g=="number"&&typeof e.b=="number")t=e.g,n=e.b,e=e.r;else if(typeof e=="object")t=e[1],n=e[2],e=e[0];else if(typeof e=="string"){if(e.charAt(0)=="#"&&e.length===7)return e;e=CW.Anim.decodeColor(e),t=e[1],n=e[2],e=e[0]}return e=Math.round(Math.max(0,Math.min(255,e))).toString(16),e.length==1&&(e="0"+e),t=Math.round(Math.max(0,Math.min(255,t))).toString(16),t.length==1&&(t="0"+t),n=Math.round(Math.max(0,Math.min(255,n))).toString(16),n.length==1&&(n="0"+n),("#"+e+t+n).toUpperCase()},decodeColor:function(t){e.colors&&e.colors[t]&&(t=e.colors[t]);var n,r,i,s;if((n=typeof t)=="number"||n=="object")return undefined;t=t.replace(/\s+/g,"");if(t.charAt(0)=="#")t.length==4&&(t="#"+t.charAt(1)+t.charAt(1)+t.charAt(2)+t.charAt(2)+t.charAt(3)+t.charAt(3)),r=parseInt(t.substring(1,3),16),i=parseInt(t.substring(3,5),16),s=parseInt(t.substring(5,7),16);else{var o;if(t.indexOf("rgba(")!=-1)o=5;else{if(t.indexOf("rgb(")==-1)return undefined;o=4}t=t.substring(o,t.length-1).split(","),r=parseInt(t[0],10),i=parseInt(t[1],10),s=parseInt(t[2],10)}return[r,i,s]},colors:{red:"#ff0000","orange red":"#ff4500",orange:"#ff7f00",yellow:"#ffff00",green:"#00ff00","forest green":"#228b22",cyan:"#00ffff","light sea green":"#20b2aa",blue:"#0000ff","cornflower blue":"#6495ed","medium blue":"#3232cd",purple:"#a020f0","hot pink" :"#ff69b4",magenta:"#ff00ff",white:"#ffffff","light gray":"#d3d3d3",gray:"#bebebe","dark gray":"#a9a9a9","dim gray":"#696969",black:"#000000"},initRandom:function(e,t,n){return{isInitRandom:!0,lo:e,hi:t,round:n}},_improveSCCompatibility:function(){if(!e._hasSC)return;e._runLoopedTrigger=function(){var t=SC.RunLoop.isRunLoopInProgress();t||SC.RunLoop.begin(),e._inSCLoop=!0;var n=e._coreTrigger.apply(this,arguments);return e._inSCLoop=!1,t||SC.RunLoop.end(),n},e._coreTrigger=e.trigger,e.trigger=e._runLoopedTrigger},_SCLoopBegan:function(){e._inSCLoop=!0,e.trigger=e.Object.prototype.trigger=e._coreTrigger},_SCLoopEnded:function(){e._inSCLoop=!1,e.trigger=e.Object.prototype.trigger=e._runLoopedTrigger}}}(),CW.Anim.init(),CW.Anim._improveSCCompatibility(),CW.Anim.Task=CW.Anim.Object.extend({className:"CW.Anim.Task",running:!1,speedMultiplier:1,frameCount:0,elapsedTime:0,ticked:!1,tickCount:0,start:function(){return this.running?this:(this.running=!0,this.elapsedTime=this.frameCount=this.tickCount=0,this.trigger("start"),CW.Anim.handleTask(this),this)},stop:function(){return this.running?(this.running=!1,this.trigger("stop"),this):this},elapse:function(e,t){if(this.isDestroyed)return this.running=!1,this;if(!t&&this.shouldSkipFrame&&this.shouldSkipFrame())return this;this._forcedZeroes&&(e=0,this._forcedZeroes--),e*=this.speedMultiplier,this.trigger("preframe"),this.elapsedTime+=e;if(!this.ticked)this.trigger("pretick"),this.run instanceof Function&&this.run(e),this.tickCount++,this.trigger("tick");else for(var n=this.ticked===!0?1e3/CW.Anim.fps:this.ticked,r=1+Math.floor(this.elapsedTime/ n),i=r-this.tickCount,s=0;s=(7-4*n)/11){t=r*r-Math.pow((11-6*n-11*e)/4,2);break}return 1-t},SINE_IN_OUT:function(e){return.5-.5*Math.cos(Math.PI*e)},multiSineInOut:function(e,t){var n=e%1;e=Math.floor(e);for(var r=0;rd)return((c*d+l)*d+f)*d;while(pm?p=v:d=v,v=(d-p)*.5+p}return((c*v+l)*v+f)*v},linearInterpolation:function(e,t){var n=e._length_||(e._length=e.length),r=t*n/n*(n-1),i=Math.floor(r),s=e[i],o=r-i;if(o===0)return s;var u=e[Math.ceil(r)];return s*(1-o)+u*o}},CW.Anim.Animation=CW.Animation=CW.Anim.Task.extend({className:"CW.Animation",isAnimation:!0,init:function(){arguments.callee.base.call(this),this.hasOwnProperty("animateOldIE")||(this.animateOldIE=CW.Anim.ENABLE_OLD_IE),SC.browser.isIE8OrLower&&!this.animateOldIE&&(this.disabled=!0);var e,t,n,r,i,s=this._type.prototype.freevars;typeof this.freevars=="string"&&(this.freevars=this.freevars.split(/\s+/)),this.freevars&&!this.freevars.length&&(this.freevars=[this.freevars]);if(this.freevars&&s&&this.freevars===s){i=[];for(t=0;t<(r||(r=this.freevars.length));t++)i.push(this.freevars[t]);this.freevars=i}this.freevars&&this.speed===undefined&&this.duration===undefined&&!this.signal&&(this.duration=0);for(t=-1,r=!!this.freevars&&this.freevars.length;t0&&(this.repeat--,this.reverseOnRepeat?this.reverse():this.reset(),this.start()),n},_finishNaturally:function(){this.finish(!0)},update:function( ){},toString:function(){var e=arguments.callee.base.apply(this,arguments);return e=e.substring(0,e.length-1)+(this.name?" "+this.name:"")+(this.running?" running":"")+(this.fps?" fps="+this.fps:"")+(this.freevars||this.inertia?"":" "+this.from+"-to-"+this.to+" "+this.duration+"ms "+Math.round(this.progress*100)+"%")+"]",e},destroy:function(){var e=arguments.callee.base.apply(this,arguments);return this.update=this.run=this.finish=function(){},e},recycle:function(){this.tickCount=this.frameCount=this.elapsedTime=this._forcedZeroes=0}}),CW.Animation.defaultFreevar={tween:CW.Anim.tweens.WEBKIT_EASE,discreteness:0},CW.Animation._tweenFreevar=function(){var e=function(e){for(var t in e)e.hasOwnProperty(t)&&(this[t]=e[t])};return e.prototype={from:0,to:1,duration:1e3,importants:undefined,isAlmostFinished:function(e){return Math.abs(this.to-this.current)i||s===!1&&t._untweenedCurrent=t.to||!n&&t._untweenedCurrent<=t.to)t._untweenedCurrent=t.to}return t.from!==undefined&&t.to!==undefined?(t.progress=(t._untweenedCurrent-t.from)/(t.to-t.from),t.tween instanceof Function&&t.from!=t.to&&(t.from===0&&t.to===1?t.current=t.tweenedProgress=t.tween.call(this,t._untweenedCurrent):t.current=(t.tweenedProgress=t.tween.call(this,t.progress))*(t.to-t.from)+t.from)):t.current=t._untweenedCurrent,t.discreteness&&Math.abs(t.to/t.discreteness)%1<1e-8&&(t.current=Math.round(t.current/t.discreteness)*t.discreteness),t.isFinished}},e._freevarPrototype=e,e}(),CW.Animation._inertiaFreevar=function(){var e=function(e){for(var t in e)e.hasOwnProperty(t)&&(this[t]=e[t])};return e.prototype={from:0,to:1,speed:1,inertia:3,headStart:.01,isAlmostFinished:function(e){return Math.abs(this.to-this.current)=i||!u&&r<=i)r=i;t===0?n._undampedCurrent=r:o[t-1]=r}return n.current=r,n.discreteness&&Math.abs(n.to/n.discreteness)%1<1e-8&&(n.current=Math.round(n.current/n.discreteness)*n.discreteness),n.isFinished=n.to===n.current,n.progress=NaN,n.isFinished}},e._freevarPrototype=e,e}(),CW.Animation._signalFreevar=function(){var e=function(e){for(var t in e)e.hasOwnProperty(t)&&(this[t]=e[t])};return e.prototype={speed:1,from:0,signal:function(e){return.5+.5*Math.sin(e*Math.PI*2)},persistent:!0,isAlmostFinished:function(e){return!this.persistent},reverse:function(){return this.speed=-this.speed,this},reset:function(){return this._unsignaledCurrent=this.from,this},redirectTo:function(){return this},force:function(){return this},advance:function(e){this._unsignaledCurrent+=e},zeroOutDuration:function(){return this},freevarRun:function(e){return this._unsignaledCurrent+=e/1e3*this.speed,this.current=this.signal(this ._unsignaledCurrent),this.discreteness&&(this.current=Math.round(this.current/this.discreteness)*this.discreteness),this.isFinished=!this.persistent,this.progress=NaN,this.isFinished}},e._freevarPrototype=e,e}(),CW.Anim.Fader=CW.Fader=CW.Animation.extend({className:"CW.Fader",update:function(){CW.Anim.setOpacity(this.element,this.current)},init:function(){this.from===undefined&&(this._untweenedCurrent=this.from=CW.Anim.getOpacity(this.element)),arguments.callee.base.apply(this,arguments)},_removeOnFinish:function(){if(!this.REMOVE_ON_FINISH)return;this.element.parentNode&&this.element.parentNode.removeChild(this.element)}.listens("finish"),saveSelf:function(){var e=this.element._cwaFader;e&&e.stop(),this.element._cwaFader=this}.listens("start"),killSelf:function(){this.element._cwaFader=undefined}.listens("stop")}),CW.Anim.DisplayNoneAtZero={isMixin:!0,setDisplayNone:function(){this.to===0&&(this.element.style.display="none")}.listens("finish"),removeDisplayNone:function(){this.element.style.display=""}.listens("start")},CW.Anim.ColorFader=CW.ColorFader=CW.Animation.extend({className:"CW.ColorFader",style:"color",init:function(){this.colorKey="_cwa"+this.style+"color",this.saveKey="_cwa"+this.style+"Fader";var e;if(this.sR===undefined||this.sG===undefined||this.sB===undefined)(e=CW.Anim.getStyle(this.element,this.style))?e=CW.Anim.decodeColor(e):e=this.element[this.colorKey]||(this.element[this.colorKey]=[0,0,0]),this.sR=e[0],this.sG=e[1],this.sB=e[2];arguments.callee.base.apply(this,arguments)},update:function(){if(!this.element||!this.style)return;var e=this.current,t=1-e, n,r,i,s=this.element[this.colorKey]||(this.element[this.colorKey]=[]);s[0]=n=this.tR*e+this.sR*t,s[1]=r=this.tG*e+this.sG*t,s[2]=i=this.tB*e+this.sB*t,this.element.style[this.style]=(this.cssBeforeColor||"")+CW.Anim.encodeColor(n,r,i)+(this.cssAfterColor||"")},saveSelf:function(){var e=this.element[this.saveKey];e&&e.stop(),this.element[this.saveKey]=this}.listens("start"),killSelf:function(){this.element[this.saveKey]=undefined}.listens("stop")}),CW.Anim.Mover=CW.Mover=CW.Animation.extend({className:"CW.Mover",getOmittedPositions:function(){var e,t,n,r;if(this.fromX===undefined||this.anchorX===undefined)n="left",e=parseInt(CW.Anim.getStyle(this.element,n),10),isNaN(e)&&(n="right",e=parseInt(CW.Anim.getStyle(this.element,n),10)),isNaN(e)&&(n="left"),this.anchorX!==undefined||(this.anchorX=n),this.fromX!==undefined||(this.fromX=e);if(this.fromY===undefined||this.anchorY===undefined)r="top",t=parseInt(CW.Anim.getStyle(this.element,r),10),isNaN(t)&&(r="bottom",t=parseInt(CW.Anim.getStyle(this.element,r),10)),isNaN(t)&&(n="top"),this.anchorY!==undefined||(this.anchorY=r),this.fromY!==undefined||(this.fromY=t);if(isNaN(this.fromX)||isNaN(this.fromY))this.anchorX="left",this.anchorY="top",this.fromX=this.element.offsetLeft,this.fromY=this.element.offsetTop,this.element.style.position="absolute";this.toX===undefined&&(this.toX=this.fromX),this.toY===undefined&&(this.toY=this.fromY)}.listens("start"),update:function(){var e=this.element.style,t=this.current,n=1-t;e[this.anchorX]=Math.round(t*this.toX+n*this.fromX)+"px",e[this.anchorY]=Math.round(t*this.toY+n*this.fromY)+"px"}}),CW.Animatability= {ENABLE_OLD_IE:YES,hasAnimatability:!0,mustKeepLayoutSync:YES,isAnimating:NO,isAnimatingInWindow:NO,isAnimatingWithParent:NO,recomputeIsAnimatingBooleans:function(){var e=this.get("isAnimatingInWindow"),t=!1,n=this,r=this._animCount>0,i;while(n=n.get("parentView"))if(n.hasAnimatability&&n.get("isAnimating")){t=!0;break}i=t||r,this.isAnimating!==r&&this.set("isAnimating",r),this.isAnimatingInWindow!==i&&this.set("isAnimatingInWindow",i),this.isAnimatingWithParent!==t&&this.set("isAnimatingWithParent",t),i!==e&&this._recomputeChildrenIsAnimatingBooleans()},_recomputeChildrenIsAnimatingBooleans:function(){for(var e=0,t=this.get("childViews"),n;n=t[e];e++)n.hasAnimatability?n.recomputeIsAnimatingBooleans():CW.Animatability._recomputeChildrenIsAnimatingBooleans.apply(n)},incrementAnimationCount:function(){this._animCount=(this._animCount||0)+1,this.recomputeIsAnimatingBooleans()},decrementAnimationCount:function(){this._animCount=Math.max(this._animCount-1,0),this.recomputeIsAnimatingBooleans()},animateProperty:function(e,t,n){return this.animateProperties.apply(this,arguments)},animateProperties:function(e,t){var n,r,i,s,o,u,a,f,l,c,h,p,d,v,m,g,y,b,w,E,S,x,T,N,C,k,L=SC.A(arguments),A=this._currentlyAnimatingProperties,O=this.get("mustKeepLayoutSync");if(o=typeof e=="string")(s={})[e]=t,e=s,t=L[2];if(!e){SC.warn("When using .animateProperties(, either a property name (string)or a hash, keyed by property name, full of destinations (or full freevar optionshashes) must be supplied as the first argument. Aborting the call.");return}e=SC.clone(e);if(t)for((n=o?2:1)&&(i=L.length)&&!(t= undefined);nE&&(E=h.duration),O||this.adjust(h.propertyName,h.to),h.to===h.from?(O&&this.adjust(h.propertyName,h.to),delete e[n]):T++}if(T===0)m||(k=CW.Animation.create({view:this,duration:E||u||0},t).start());else if(m&&(w=this._bestMatchAnimationForProperties(e)||this._animationFromPool())){for(n in e)w.addProperty(e[n]);for(n in t)w[n]=t[n];k=w.start()}else{v={freevars:[],properties:[]};for(n in e)v.freevars.push(n),v.properties.push(n);v.view=this,w=CW.MultiPropertyAnimation.create(v,e,t);for(n in e)A[n]=w;k=w.start()}if(S){for(n in S){if(!S.hasOwnProperty(n))continue;x=S[n];if(x.__checked__)continue;x.__checked__=!0,x.stopIfNoProperties()}for(n in S){if(!S.hasOwnProperty(n))continue;S[n].__checked__=!1}}return k},_bestMatchAnimationForProperties:function(e){var t,n,r,i,s,o,u=this._currentlyAnimatingProperties;for(t in u){if(!(i=u[t])||i.___matchCheck)continue;i.___matchCheck=!0,r=i.properties.length,s=0;for(n=0;ns&&(s=i.___matchCount,o=i),i.___matchCount=undefined}return o||this._animationFromPool()},_propertyAnimPool:null,_addAnimationToPool:function(e){if(!e)return;var t=this._propertyAnimPool;for(var n=0,r=t.length;n1||n.from>1||n.to<0||n.from<0)?1:1e-6),r.get("mustKeepLayoutSync")?r.adjust(e,n.current):r.$().css(e,n.current)):this.view[e]!==n.current&&r.set(e,n.current),r._updatingAnimatedProperty=!1},freevarForProperty:function(e){return this[e]},update:function(){for(var e=0,t,n;t=this.freevars[e];e++)this.updateToProperty(t)},releaseProperties:function(){for(var e=0,t;t=this.properties[e];e++)this.view._currentlyAnimatingProperties[t]=undefined}.listens("stop"),poolAnimation:function(){if(!this.canReuse)return;while(this.properties.length)this.removeProperty(this.properties[0],!0);this.properties.length=0;if(this.extraKeys){for(var e in this.extraKeys)delete this[e];delete this.extraKeys}this.recycle(),this.view._addAnimationToPool(this)}.listens("stop"),markView:function(){this.view.incrementAnimationCount()}.listens("start"),unmarkView:function(){this.view.decrementAnimationCount()}.listens("stop")}),CW.PaneAnimationSupport={hasPaneAnimationSupport:YES,hiddenState:{opacity:0},showingState:{opacity:1},duration:350,showDuration:null,hideDuration:null,tween:CW.Anim.tweens.WEBKIT_EASE,showTween:null,hideTween:null,firstShowDelay:0,hideDelay:0,append:function(e){(!this.hasSpritePreloadEnforcement|| this._hasShownFromDidCreateLayer)&&this.animateShow(),e()}.enhance(),animateShow:function(){if(SC.browser.isIE8OrLower){this.paneWillShow(),this.paneDidShow();return}this._hideAnim&&this._hideAnim.finish(),this._showAnim&&this._showAnim.finish(),this._showTimer&&(this._showTimer.invalidate(),this._showTimer=null),this._hideTimer&&(this._hideTimer.invalidate(),this._hideTimer=null),this._animatingShow=YES,this.paneWillShow(),this.invokeLast(function(){this._animatingShow=YES,this.adjust(this.get("hiddenState"));var e=this.get("showDuration"),t=[this.get("showingState"),{duration:typeof e=="number"?e:this.get("duration"),tween:this.get("showTween")||this.get("tween"),notifyFrame:function(){this.view.didFrame(this),this.view.showDidFrame(this)}.listens("frame"),completed:function(){this.view._showAnim=null,this.view.paneDidShow(this)}.listens("finish")}];!this._hasAppendedOnce&&this.get("firstShowDelay")!==0?(this._showTimer=this._delayedFirstShowTimer=this.invokeLater(function(){this._showTimer=this._delayedFirstShowTimer=null,this._showAnim=this.animate.apply(this,t)},this.get("firstShowDelay")),this._hasAppendedOnce=YES):this._showTimer=this.invokeLast(function(){this._showTimer=null,this._showAnim=this.animate.apply(this,t)}),this._animatingShow=NO}),this._animatingShow=NO},remove:function(e){if(SC.browser.isIE8OrLower){this.paneWillHide(),e(),this.paneDidHide();return}var t;this.get("isPanelPane")&&this._isShowingModal&&(this._isShowingModal=NO,(t=this._modalPane())&&t.paneDidRemove(this)),this._hideAnim&&this._hideAnim.finish(),this._showAnim&&this._showAnim.finish(),this ._showTimer&&(this._showTimer.invalidate(),this._showTimer=null),this._hideTimer&&(this._hideTimer.invalidate(),this._hideTimer=null),this._animatingHide=YES,this.paneWillHide(),this.invokeLast(function(){this._animatingHide=YES;var t=this.get("hideDuration"),n=[this.get("hiddenState"),{duration:typeof t=="number"?t:this.get("duration"),tween:this.get("hideTween")||this.get("tween"),notifyFrame:function(){this.view.didFrame(this),this.view.hideDidFrame(this)}.listens("frame"),enableClickThrough:function(){this.view.$().css("pointerEvents","none")}.listens("start"),removeClickThrough:function(){this.view.$().css("pointerEvents","auto")}.listens("stop"),completed:function(){this.view._hideAnim=null,e(),this.view.paneDidHide(this)}.listens("finish")}];this.get("hideDelay")!==0?this._hideTimer=this.invokeLater(function(){this._hideTimer=null,this._hideAnim=this.animate.apply(this,n)},this.get("hideDelay")):this._hideTimer=this.invokeLast(function(){this._hideTimer=null,this._hideAnim=this.animate.apply(this,n)}),this._animatingHide=NO}),this._animatingHide=NO}.enhance(),didFrame:function(e){},showDidFrame:function(e){},hideDidFrame:function(e){},paneDidHide:function(e){},paneWillHide:function(){},paneDidShow:function(e){},paneWillShow:function(){}},CW.PaneFadingSupport=SC.clone(CW.PaneAnimationSupport),SC.mixin(CW.PaneFadingSupport,{paneFadeInDuration:100,paneFadeOutDuration:350,showDuration:function(){return this.get("paneFadeInDuration")}.property("paneFadeInDuration").cacheable(),hideDuration:function(){return this.get("paneFadeOutDuration")}.property("paneFadeOutDuration").cacheable (),showingState:function(){return{opacity:this.get("paneOpacity")||1}}.property("paneOpacity").cacheable(),paneDidHide:function(){return this.paneDidFadeOut()},paneDidFadeOut:function(){}}),SC.stringsFor("en-us",{monthHeading:"%@1 %@2",year:"%@",Month:"Month",January:"January",February:"February",March:"March",April:"April",May:"May",June:"June",July:"July",August:"August",September:"September",October:"October",November:"November",December:"December",Jan:"Jan",Feb:"Feb",Mar:"Mar",Apr:"Apr",Jun:"Jun",Jul:"Jul",Aug:"Aug",Sep:"Sep",Oct:"Oct",Nov:"Nov",Dec:"Dec",Sunday:"Sunday",Monday:"Monday",Tuesday:"Tuesday",Wednesday:"Wednesday",Thursday:"Thursday",Friday:"Friday",Saturday:"Saturday",Sun:"Sun",Mon:"Mon",Tue:"Tue",Wed:"Wed",Thu:"Thu",Fri:"Fri",Sat:"Sat",Yesterday:"Yesterday",Today:"Today",Tomorrow:"Tomorrow",Midnight:"Midnight",Now:"Now",Noon:"Noon",Next:"Next",Last:"Last",English:"English",French:"French",German:"German",Japanese:"Japanese","Button.OK":"OK","Button.Cancel":"Cancel","Button.Reload":"Reload","Button.Save":"Save","Button.Accept":"Accept","Button.Decline":"Decline","Button.Maybe":"Maybe","Button.TryAgain":"Try Again","Status.Loading":"Loading…","Status.Sharing":"Sharing…","Toolbar.Message.Actions":"Actions","Dialog.Error.Details":"Details","Color.Picker.Custom.Color":"Custom color…","CW.DropTarget.SafariWindowsNotSupported.Title":"Drag and drop not supported.","CW.DropTarget.SafariWindowsNotSupported.Description":"Drag and drop of files into this browser is not currently supported."}),CW.CANVAS_BUTTON_HEIGHT=26,CW.TOOLBAR_BUTTON_HEIGHT=26,CW.SQUARE_BUTTON_REGULAR_HEIGHT=27 ,CW.IOS_BUTTON_REGULAR_HEIGHT=30,CW.IOSMINI_BUTTON_REGULAR_HEIGHT=24,CW.IOSBIG_BUTTON_REGULAR_HEIGHT=46,CW.SELECT_BUTTON_REGULAR_HEIGHT=27,CW.POPUP_BUTTON_REGULAR_HEIGHT=27,CW.SQUARE_BUTTON_REGULAR_MIN_WIDTH=68,CW.SQUARE_BUTTON_SMALL_MIN_WIDTH=56,CW.SQUARE_BUTTON_TINY_MIN_WIDTH=52,CW.HELP_BUTTON_REGULAR_MIN_WIDTH=26,CW.HELP_BUTTON_SMALL_MIN_WIDTH=22,CW.HELP_BUTTON_TINY_MIN_WIDTH=18,CW.CHECKBOX_REGULAR_HEIGHT=18,CW.PROGRESS_REGULAR_HEIGHT=20,CW.PROGRESS_CAPSULE_HEIGHT=19,CW.PROGRESS_CAPSULE_ANIMATED_BACKGROUND_MATRIX=[171,19,31],CW.PROGRESS_REGULAR_OFFSETRANGE=32,CW.PROGRESS_CAPSULE_OFFSETRANGE=20,CW.TEXT_FIELD_TINY_HEIGHT=18,CW.TEXT_FIELD_SMALL_HEIGHT=22,CW.TEXT_FIELD_REGULAR_HEIGHT=26,CW.TEXT_FIELD_LARGE_HEIGHT=30,CW.TEXT_FIELD_LARGE_TALL_HEIGHT=31,CW.TEXT_FIELD_HUGE_HEIGHT=31,CW.SLIDER_REGULAR_HEIGHT=25,CW.DOCK_HEIGHT=46,CW.SOURCE_LIST_WIDTH=171,CW.TINY_CONTROL_SIZE=SC.TINY_CONTROL_SIZE,CW.SMALL_CONTROL_SIZE=SC.SMALL_CONTROL_SIZE,CW.REGULAR_CONTROL_SIZE=SC.REGULAR_CONTROL_SIZE,CW.LARGE_CONTROL_SIZE=SC.LARGE_CONTROL_SIZE,CW.LARGE_TALL_CONTROL_SIZE="me-large-tall-size",CW.XLARGE_CONTROL_SIZE=SC.HUGE_CONTROL_SIZE,CW.DropTarget={isDropTarget:YES,acceptsFileDrags:YES,dragStarted:function(e,t){},dragEntered:function(e,t){},dragUpdated:function(e,t){},dragExited:function(e,t){},dragEnded:function(e,t){},computeDragOperations:function(e,t){return SC.DRAG_NONE},acceptDragOperation:function(e,t){return YES},performDragOperation:function(e,t){return SC.DRAG_NONE},_isCurrentlyHovered:NO,renderMixin:function(e,t){t&&SC.browser.isWebkit&&this.get("acceptsFileDrags")&&e.push('
' )},didCreateLayer:function(e){e();if(!this.get("acceptsFileDrags"))return;var t=this.$().children(".cw-drop-target-container").children()[0]||null;if(SC.browser.isWebkit&&t)SC.Event.add(t,"change",this,this._handleDrop);else if(SC.browser.mozilla){var n=this.get("layer");SC.Event.add(n,"drop",this,this._handleDrop)}}.enhance(),_changeFileElementClickability:function(e){if(SC.browser.isWebkit&&this.get("acceptsFileDrags")){var t=this.$().children(".cw-drop-target-container").children()[0]||null,n=e?"block":"none";t&&n!==t.style.display&&(t.style.display=n)}},_handleDragEnter:function(e){if(CW.DropTarget.dealWithSafariWindows())return;if(SC.browser.isWebkit&&!(e&&e.target&&e.target.className&&e.target.className.indexOf&&e.target.className.indexOf("cw-drop-target-file")>-1)){this._isCurrentlyHovered=YES;return}var t=e.dragOperation;this._isFileEvent(e)&&this._changeFileElementClickability(YES),this.computeDragOperations(t,e)&SC.DRAG_DATA&&(this.dragEntered(t,e),this._isCurrentlyHovered=YES)},_handleDragOver:function(e){var t=e.dragOperation;this._isFileEvent(e)&&this._changeFileElementClickability(YES);if(CW.DropTarget.dealWithSafariWindows())return;this.computeDragOperations(t,e)&SC.DRAG_DATA&&(this._isCurrentlyHovered?this.dragUpdated(t,e):(this.dragEntered(t,e),this._isCurrentlyHovered=YES))},_handleDrop:function(e){var t=e.dragOperation;t||(t=this._dragOperationForEvent(e)),this._changeFileElementClickability(NO);if(CW.DropTarget.dealWithSafariWindows())return;if(this.acceptDragOperation(t,SC.DRAG_DATA)){var n=e.dataTransfer.files;if(n&&n.length>0){t.data=n;for(var r=0,i=n. length;r-1))return;var t=e.dragOperation,n=e.originalEvent.target;n.type&&n.type==="file"&&this._changeFileElementClickability(NO);if(CW.DropTarget.dealWithSafariWindows())return;this.dragExited(t,e)},_isFileEvent:function(e){var t=e.dataTransfer;if(t){var n=t.types;if(SC.none(n))return YES;for(var r=0,i=n.length;rm&&(l=m),x=p.middleButton,T=p.rightButton,this.leftButtonView&&(C=this.leftButtonView.get("frame"),C&&(w=C.width)),x&&(C=x.get("frame"),C&&(w+=C.width)),T&&(C=T.get("frame"),C&&(w+=C.width)),e.adjust("height",l),N=d.BUTTONS_REGULAR_PADDING+d.BUTTONS_MIN_PADDING_MIDDLE_AND_LEFT+d.BUTTONS_SIDE_PADDING*2,w+N>e.get("frame").width&&!c&&(e.adjust("width",w+N),this.performLayout()),this._resizingExtraView=NO,e.set("readyToShow",YES);var M=this.$(".def");M&&M.length&&setTimeout(function(){M[0].focus()},500)},isAlertCompactChanged:function(){this.get("isVisibleInWindow")&&this.performLayout()}.observes("pane.isCompact")})}),CW.Alert.BUTTONS_REGULAR_PADDING=8,CW.Alert.BUTTONS_MIN_PADDING_MIDDLE_AND_LEFT=15,CW.Alert.BUTTONS_SIDE_PADDING=20,CW.Alert.BUTTONS_AND_SEPARATOR_HEIGHT=70,CW.Alert.BUTTONS_AND_SEPARATOR_COMPACT_HEIGHT=60,CW.Alert.MIN_ALERT_HEIGHT=112,CW.Alert.MessageView=SC.LabelView.extend(SC.RTLSupport,{layoutRecipe:{top:25,start:106,end:25},classNames:["title-label"],controlSize:SC.LARGE_CONTROL_SIZE,ariaRole:"heading"}),CW.Alert.DescriptionView=SC.LabelView.extend(SC.RTLSupport,{layoutRecipe:{start:106,end:25},classNames:["description"]}),CW.Alert.CaptionView=SC.LabelView.extend(SC.RTLSupport,{layoutRecipe:{start:106,end:25},classNames:["caption"]}),CW.Alert.IconView=SC.View.extend(SC.RTLSupport,{layoutRecipe:{top:19,width:68,height:68,start:25},classNames:["cw-alert-image-view"]}),CW.Alert.MainButtonsView=SC .View.extend(SC.RTLSupport,{layoutRecipe:{height:44,bottom:4,start:0,end:0},classNames:["main-buttons"],childViews:["middleButton","rightButton"],middleButtonIsVisible:YES,middleButtonTitle:"Cancel",middleButtonAction:null,middleButtonTarget:null,rightButtonTitle:"Ok",rightButtonAction:null,rightButtonTarget:null,init:function(e){e(),this.middleButton.set("title",this.middleButtonTitle),this.middleButton.set("isVisible",this.middleButtonIsVisible),this.middleButton.set("action",this.middleButtonAction),this.middleButton.set("target",this.middleButtonTarget),this.rightButton.set("title",this.rightButtonTitle),this.rightButton.set("action",this.rightButtonAction),this.rightButton.set("target",this.rightButtonTarget)}.enhance(),middleButton:SC.ButtonView.extend(SC.RTLSupport,{isCancel:YES,themeName:"borderless",classNames:["middle-button","button-in-between"],useStaticLayout:YES,layoutRecipe:{top:0,width:"auto",bottom:0,start:0}}),rightButton:SC.ButtonView.extend(SC.RTLSupport,{isDefault:YES,themeName:"borderless",classNames:["right-button"],useStaticLayout:YES,layoutRecipe:{top:0,width:"auto",bottom:0,start:0},render:function(e){return e.attr("tabindex","0"),arguments.callee.base.apply(this,arguments)}})}),CW.Alert.LeftButtonView=SC.ButtonView.extend(SC.RTLSupport,{useStaticLayout:YES,title:"Other...",themeName:"borderless",classNames:["left-button"],layoutRecipe:{height:44,bottom:4,width:"auto",start:0}}),CW.Alert.ExtraViewAutoResizingSupport={isAutoResizingExtraView:YES,computeHeight:function(){var e=this.get("autoResizeLayer")||this.get("layer"),t=this.getPath("frame.width" ),n=this.get("autoResizeText")||"",r=this.get("autoResizePadding")||0,i;return SC.none(e)||SC.empty(n)?0:(e.style.maxWidth=t+"px",i=SC.metricsForString(n,e,this.get("classNames"),!this.get("escapeHTML")),i.height+r)}},CW.Alert.show=function(e){if(SC.typeOf(e)===SC.T_HASH){var t=this.create(e);return t.append(),t}return CW.fatalError("Attempted to show a CW.Alert without options."),null},CW.ErrorPicker=SC.PickerPane.extend({layout:{left:0,top:0,height:20,right:0,minWidth:36},classNames:["error-picker"],errorText:"Please fill in required info",escapeHTML:YES,pointerOffset:[10,20,-17,19],preferType:SC.PICKER_POINTER,acceptsKeyPane:NO,acceptsFirstResponder:NO,isModal:NO,contentView:SC.LabelView.extend(SC.AutoResize,{displayProperties:["value"],layout:{bottom:0,top:0,minWidth:36,centerX:0},classNames:["error-picker-label"],valueBinding:"*parentView.errorText",escapeHTMLBinding:"*parentView.escapeHTML",textAlign:SC.ALIGN_CENTER,measuredSizeDidChange:function(e){e();var t=this.get("measuredSize"),n=this.get("calculatedWidth")||t.width,r=this.get("calculatedHeight")||t.height,i=this.get("parentView");i.adjust({width:n+20,height:r}).updateLayout(),i.positionPane()}.enhance()}),preferMatrix:[2,3,2,2,2],render:function(e,t){var n=this.get("pointerPos");if(e.needsContent)this.renderChildViews(e,t),e.push("
","
","
"),n.indexOf(SC.POINTER_LAYOUT[2])!==-1?e.push('
'):n.indexOf(SC.POINTER_LAYOUT[3])!==-1&&e.push('
');else{var r=this.$(".sc-pointer");n===SC.POINTER_LAYOUT[2]?(r.attr("class","top-middle-edge"),r.attr("style","margin-top: "+this.get("pointerPosY")+"px")):n===SC.POINTER_LAYOUT[3]&&(r.attr("class","bottom-middle-edge"),r.attr("style","margin-top: "+this.get("pointerPosY")+"px"))}e.addClass(n)}}),CW.ErrorPicker.showError=function(e,t){var n=this.create({errorText:t});return n.popup(e,SC.PICKER_POINTER),n},CW.DetailsDisclosureView=SC.View.extend(CW.Alert.ExtraViewAutoResizingSupport,SC.RTLSupport,{layoutRecipe:{start:106,end:25},contentView:SC.TextFieldView.design({layout:{height:90},isVisible:NO}),caption:null,isExpanded:NO,disclosureTitle:"Details",verticalPadding:15,classNames:["cw-details"],childViews:["contentView","disclosureButtonView"],disclosureButtonView:SC.DisclosureView.design({valueBinding:"*owner.isExpanded",titleBinding:"*owner.disclosureTitle",layout:{height:30},controlSize:SC.LARGE_CONTROL_SIZE}),init:function(e){e();var t=this.get("contentView");t&&t.set("isVisible",this.get("isExpanded"))}.enhance(),_isExpandedDidChange:function(){var e=this.get("isExpanded"),t=this.get("captionView"),n=t?t.getPath("frame.height"):undefined,r=this.get("contentView"),i=r.getPath("frame.height")+this.get("verticalPadding"),s=this.getPath("frame.height");e?(r.set("isVisible",YES),t&&t.adjust("top",n+i),this.adjust("height",s+i)):(r.set("isVisible",NO),t&&t.adjust("top",n-i),this.adjust("height",s-i))}.observes("isExpanded"),createChildViews:function(){var e=this.get("caption");return e&&(this.captionView=CW.DetailsDisclosureView.CaptionView. extend({value:e}),this.childViews.push("captionView")),arguments.callee.base.apply(this,arguments)},computeHeight:function(){var e=this.get("disclosureButtonView"),t=this.get("contentView"),n=this.get("captionView"),r=this.get("isExpanded"),i=e.getPath("frame.height"),s=this.getPath("pane.isCompact"),o,u;t.adjust("top",i),r?i+=t.getPath("frame.height")+(s?0:22):i+=5;if(n)if(!s||!r){var a=n.get("value");n.adjust("top",i),u=n.get("layer"),u.style.maxWidth=n.getPath("frame.width")+"px",o=SC.metricsForString(a,u,"",YES).height,n.adjust("height",o),i+=o,n.set("isVisible",YES)}else n.set("isVisible",NO);return this.adjust("height",i),i}}),CW.DetailsDisclosureView.CaptionView=SC.LabelView.design({escapeHTML:NO,classNames:["cw-caption"],layout:{top:0,left:0,right:0,height:0}}),CW.ScrollerView=SC.ScrollerView.extend({hasButtons:NO,capLength:0,capOverlap:-2,buttonLength:0,buttonOverlap:-2,scrollbarThickness:9,minimumThumbLength:32,hoveredScroll:!1,isBeingShown:undefined,isBeingFadedIn:undefined,isBeingFadedOut:undefined,currentThumbAnimation:undefined,mouseDown:function(){return this._MouseDown=YES,arguments.callee.base.apply(this,arguments)},mouseUp:function(){return this._MouseDown=NO,this.set("hoveredScroll",!1),arguments.callee.base.apply(this,arguments)},mouseEntered:function(){this.set("hoveredScroll",!0)},mouseExited:function(){this._MouseDown||this.set("hoveredScroll",!1)}}),SC.mixin(SC.ScrollView.prototype,{horizontalScrollerView:CW.ScrollerView,verticalScrollerView:CW.ScrollerView}),CW.FadingCaplessScrollerView=CW.ScrollerView.extend({hasButtons:NO,classNames:"sc-fading-capless-scroller-view" .w(),capLength:0,capOverlap:-2,buttonLength:0,buttonOverlap:-2,scrollbarThickness:10,minimumThumbLength:32,isVisibleDidChange:function(){if(!this.get("isVisible"))return;this.$(".sc-scroller-view").addClass("sc-fading-capless-scroller-view-invisible")}.observes("isVisible")}),CW.FadingCaplessScrollerViewSupport={_thumbHidden:NO,didCreateLayer:function(e){this.$(".sc-scroller-view").addClass("sc-fading-capless-scroller-view-invisible"),this._thumbHidden=YES,e()}.enhance(),verticalOverlay:YES,horizontalOverlay:YES,mouseExited:function(){if(this._thumbHidden)return;var e=this.get("verticalScrollerView"),t=this.get("horizontalScrollerView");if(e&&!e._thumbDragging||t&&!t._thumbDragging)this.$(".sc-scroller-view").addClass("sc-fading-capless-scroller-view-invisible"),this._thumbHidden=YES},mouseMoved:function(){if(!this._thumbHidden)return;this._thumbView||(this._thumbView=this.$(".thumb")),this.$(".sc-scroller-view").removeClass("sc-fading-capless-scroller-view-invisible"),this._thumbHidden=NO}},CW.ImageMapView=SC.View.extend({classNames:["me-image-map-view"],regions:[],regionCoordinatesKey:"coordinates",regionTargetKey:"target",regionActionKey:"action",hoveredRegion:null,selectedRegion:null,mouseDown:function(e){var t,n;return t=this.convertFrameFromView({x:e.pageX,y:e.pageY}),n=this.regionForPoint(t),n?(this._mouseDownRegion=n,YES):NO},touchStart:function(e){return this.mouseDown(e)},mouseUp:function(e){var t,n,r,i,s;return t=this.convertFrameFromView({x:e.pageX,y:e.pageY}),n=this.regionForPoint(t),n?(i=SC.get(n,"regionActionKey"),r=SC.get(n,"regionTargetKey")||null,r&&(s=this .getPath("pane.rootResponder"),s&&s.sendAction(i,r,this,this.get("pane"),{region:n,coords:t})),this.setIfChanged("selectedRegion",n),YES):NO},touchEnd:function(e){return this.set("hoveredRegion",null),this.mouseUp(e)},mouseMoved:function(e){var t=this.convertFrameFromView({x:e.pageX,y:e.pageY});this.setIfChanged("hoveredRegion",this.regionForPoint(t))},touchesDragged:function(e){this.mouseMoved(e)},mouseExited:function(e){this.set("hoveredRegion",null)},regionForPoint:function(e){var t=this.get("regions"),n=0,r=t.get("length"),i,s=this.get("regionCoordinatesKey");this._coordinatesCache=this._coordinatesCache||[];for(;n=i||t[o][1]=i)&&t[s][0]+(i-t[s][1])/(t[o][1]-t[s][1])*(t[o][0]-t[s][0])0);t?this._startSpin():this._stopSpin()}.observes("isVisibleInWindow","layout"),_renderSizeObserver:function(){this.renderSize()}.observes("size"),renderSize:function(e,t,n,r){e||(e=this.get("size")),t||(t=this.get("assetFrameCount")),n||(n=this.get("innerElement"));if(isNaN(e))return;r?r.style.width=r.style.height=e+"px":this.adjust({width:e,height:e}),n.style.width=e+"px",n.style.height=e*t+"px",r||this.renderPosition()},_startSpin:function(){if(this._interval)return;var e=this;this._interval=setInterval(function(){e._rotateStep()},1e3/this.get("frequency")/12)},_stopSpin:function(){if(!this._interval)return;clearInterval(this._interval),this._interval=null},_rotateStep:function(){this._pos=((this._pos||0)+1)%12,this.renderPosition()},renderPosition:function(e,t,n,r){e===undefined&&(e=this._pos||0),t||(t=this.get("size")||0),n||(n=this.get("assetFrameCount"));var i=(r||this.get("innerElement")).style,s=e%n,o,u,a,f,l;if(n===12){i.top=-t*s+"px";return}o=Math.floor(e/3),f=o%2!==0,l=Math.floor(o/2)===1?1:-1,u=f?t*-l*s+l*t:0,a=(f?0:t*l*s)-(o!==0?t:0)-(o===2? t:0),i[SC.platform.domCSSPrefix+"Transform"]=i.transform="translateX("+u+"px) translateY("+a+"px) rotate("+o*90+"deg)"}}),CW.SpinnerView.renderPosition=CW.SpinnerView.prototype.renderPosition,CW.SpinnerView.renderSize=CW.SpinnerView.prototype.renderSize,SC.stringsFor("en-us",{"Name.Display.FirstAndFamilyNames":"%{firstName} %{familyName}","Toolbar.Button.Action.Help":"Help and Support","Toolbar.Tooltip.App.Switcher":"Change App","Toolbar.Button.Action.UserAction":"iCloud Settings & Sign Out"}),CK=SC.Object.create({NAMESPACE:"CK",VERSION:"1.0.0",LOAD_REASON_USER_CLICK:1,LOAD_REASON_LOCATION_HASH:2,LOAD_REASON_APP_SWITCH:3,LOAD_REASON_NOTIFICATION:4,LOAD_REASON_RELOAD:5,LOAD_REASON_SHARE_ACCEPTED:6,LOAD_REASON_APP_REPLACED:7,EXIT_NON_FATAL:0,EXIT_FATAL_ERROR:1,EXIT_STARTUP_ERROR:2,EXIT_PCS_MISSING:3,EXIT_PCS_INVALID:4,RPC_RESPONSE:"RPC_RESPONSE",currentApplication:null,isLoadedByCloudOS:!!CW.getUrlParameters().isLoadedByCloudOS,isReloading:NO,currentSubDomain:function(){return URI(window.location.href).subdomain()}.property().cacheable(),isWWW:function(){return this.get("currentSubDomain")==="www"}.property("currentSubDomain").cacheable(),isBeta:function(){return this.get("currentSubDomain")==="beta"}.property("currentSubDomain").cacheable(),isFuture:function(){return this.get("currentSubDomain")==="future"}.property("currentSubDomain").cacheable(),isCarry:function(){return this.get("currentSubDomain")==="carry"}.property("currentSubDomain").cacheable(),initiatedCloudKitJSLoading:!1,init:function(){SC.ready(function(){CK.redirectToCloudOSIfNeeded()})},redirectToCloudOSIfNeeded :function(){if(!CK.currentApplication)return;var e=window.location.pathname,t;window===window.top&&SC.buildMode==="production"&&e!=="/"&&(t=e.match(/\/applications\/(.*?)\//),t&&t[1]&&(window.location="https://"+window.location.hostname+"/#"+t[1]))},queryParamsToOmitForStartupCaching:["clientId","clientBuildNumber","clientMasteringNumber"],startupUrlsAreEqual:function(e,t){return this.removeQueryParamsToOmitForStartupCaching(e)===this.removeQueryParamsToOmitForStartupCaching(t)},removeQueryParamsToOmitForStartupCaching:function(e){if(!e)return e;var t=URI(e),n=CK.queryParamsToOmitForStartupCaching,r,i;for(r=0,i=n.length;r-1 )return n;var r=n.lastIndexOf("-");if(r<0)return;r>=2&&n.charAt(r-2)=="-"&&(r-=2),n=n.substring(0,r)}},r=function(e){return e.replace(/_/g,"-").toLowerCase()},i=r(t),s=CK.SUPPLEMENTARY_LOCALE_DATA.likelySubtags;for(var o in s){var u=r(o);if(i===u){i=r(s[o]);break}}var a=CK.SUPPLEMENTARY_LOCALE_DATA.metadata.alias.languageAlias;for(var f in a){var l=r(f);i.indexOf(l)===0&&(i=a[f]._replacement+i.substr(l.length))}var c=e.map(r),h=n(c,i);if(h===undefined)return;var p=e[c.indexOf(h)];return p},displayNameFor:function(e,t,n,r,i){var s;return e&&t?CW.stringIsCJK(e)&&CW.stringIsCJK(t)?s=t+e:s="Name.Display.FirstAndFamilyNames".loc({firstName:e,familyName:t}):e?s=e:t?s=t:r?s=r:i&&(s=i),s||(s=n||""),s},matchesFormatOfAppleId:function(e){return CK.matchesFormatOfEmailAddress(e)||CK.matchesFormatOfPhoneNumberAppleId(e)},matchesFormatOfEmailAddress:function(e){return/^([A-Z0-9\.\-\_\+])*([A-Z0-9\+\-\_])+\@[A-Z0-9]+([\-][A-Z0-9]+)*([\.][A-Z0-9\-]+){1,8}$/i.test(e)},matchesFormatOfPhoneNumberAppleId:function(e){return/^\+?[0-9]{5,}$/.test(e)},matchesFormatOfPhoneNumber:function(e){var t=this._phoneNumberRegex;if(!t){var n="0-9\\uff10-\\uff19\\u0660-\\u0669\\u06F0-\\u06F9\\u0966-\\u096F\\u09E6-\\u09FF\\u0E50-\\u0E59",r="\\(\\)\\s\\-\\+\\.\\,\\#";this._phoneNumberRegexAllDigits=new RegExp("^s*\\+?(["+n+"]+)s*$","gi"),t=this._phoneNumberRegex=new RegExp("^s*([+\\(])?((["+n+"]+)(["+r+"]{1,3}|x|ext))+(["+n+"]+)s*$","gi")}var i=this._phoneNumberRegexAllDigits;return t.lastIndex=0,i.lastIndex=0,t.test(e)||i.test(e)},normalizePhoneNumber:function(e){return e&&e.replace(/[^0-9]/g,"")},redirectTo:function( e){window.location.href=e},readCookie:function(e,t){var n=document.cookie,r,i,s;if(n.length>0){t&&(s=n.match(new RegExp("("+e+")=")),s&&(e=s[1])),r=n.indexOf(e+"=");if(r!==-1)return r=r+e.length+1,i=n.indexOf(";",r),i===-1&&(i=n.length),window.unescape(n.substring(r,i))}return null},writeCookie:function(e,t,n,r,i,s){var o,u,a;if(!e)return undefined;if(t===undefined||t===null)t="",u="expires=Thu, 01-Jan-1970 00:00:01 GMT;";return i&&(a=i*1e3*60*60,u="expires="+(new Date((new Date).getTime()+a)).toGMTString()),s&&(u+=";Secure"),n||(n="/"),r||(r="."+window.location.hostname),o=document.cookie=e+"="+t+";path="+n+";domain="+r+";"+u,o||SC.info('Not able to set cookie "%@" with "%@"',e,t),o},formatNumberWithLocale:function(e){return CW.formatNumber(e,"Numbers.ThousandsSeparator".loc(),"Numbers.DecimalSeparator".loc())},getLegacyLprojNameForLocale:function(e){var t={"en-us":"English","ja-jp":"Japanese","fr-fr":"French","de-de":"German","es-es":"Spanish","zh-cn":"zh_CN","nl-nl":"Dutch","it-it":"Italian","ko-kr":"ko","zh-tw":"zh_TW","pt-pt":"pt_PT","pt-br":"pt","sv-se":"sv","pl-pl":"pl","cs-cz":"cs","da-dk":"da","hu-hu":"hu","no-no":"no","fi-fi":"fi","tr-tr":"tr","ru-ru":"ru","uk-ua":"uk"},n=t[e];return n||(n="English"),n+".lproj"},hasLocalizedStringForKey:function(e){return e&&e.loc()!==e?YES:NO},addRootDomainQueryParameterHackAsAppropriate:function(e){e||CW.fatalError("You must specify a URL");var t;window.CloudOS&&(CloudOS.isBeta&&(t="beta"),CloudOS.isCarry&&(t="carry"),CloudOS.isFuture&&(t="future"));var n;return CK.get("isBeta")&&(n="beta"),CK.get("isCarry")&&(n="carry"),CK.get("isFuture" )&&(n="future"),e instanceof URI||(e=new URI(e)),t&&t!==n&&e.addQuery("rootDomain",t),e.href()},persistAfterLogoutSuffix:".persist",getValueFromSessionStorage:function(e){return this._getValueFromStorage("sessionStorage",e)},setValueInSessionStorage:function(e,t){return this._setValueInStorage("sessionStorage",e,t)},removeValueInSessionStorage:function(e){return this._removeValueInStorage("sessionStorage",e)},getKeysInSessionStorage:function(){return this._getKeysInStorage("sessionStorage")},clearSessionStorage:function(){return this._clearStorage("sessionStorage")},getValueFromLocalStorage:function(e,t){return this._getValueFromStorage("localStorage",e,t)},setValueInLocalStorage:function(e,t,n){return this._setValueInStorage("localStorage",e,t,n)},removeValueInLocalStorage:function(e,t){return t&&(e+=this.get("persistAfterLogoutSuffix")),this._removeValueInStorage("localStorage",e)},getKeysInLocalStorage:function(){return this._getKeysInStorage("localStorage")},clearLocalStorage:function(){return this._clearStorage("localStorage",YES)},_getStorageObject:function(e){try{return window[e]}catch(t){SC.warn("Could not get storage object for %@: %@",e,t)}},_getValueFromStorage:function(e,t,n){var r=null,i=this._getStorageObject(e),s,o;if(i&&i.getItem){o=CK.currentApplication,s=o?o.get("name"):"iCloud",s&&(t=s+"."+t),n&&(t+=this.get("persistAfterLogoutSuffix"));try{r=i.getItem(t)}catch(u){SC.warn('Could not get value for key "%@" in %@: %@',t,e,u)}}return r},_setValueInStorage:function(e,t,n,r){var i=NO,s=this._getStorageObject(e),o,u;if(s&&s.setItem){u=CK.currentApplication,o=u?u .get("name"):"iCloud",o&&(t=o+"."+t),r&&(t+=this.get("persistAfterLogoutSuffix"));try{s.setItem(t,n),i=YES}catch(a){}}return i},_getKeysInStorage:function(e){var t=[],n=this._getStorageObject(e),r,i,s,o;if(n){r=CK.currentApplication,i=r?r.get("name"):"iCloud",i&&(i+="."),s=i?i.length:0;for(o in n)o.indexOf(i)===0&&t.push(o.substring(s))}return t},_removeValueInStorage:function(e,t){var n=NO,r=this._getStorageObject(e),i,s;if(r&&r.removeItem){s=CK.currentApplication,i=s?s.get("name"):"iCloud",i&&(t=i+"."+t);try{r.removeItem(t),n=YES}catch(o){}}return n},_clearStorage:function(e,t){var n=YES,r=this._getStorageObject(e),i,s,o,u,a,f,l;if(r&&t)try{i={},s=this.get("persistAfterLogoutSuffix"),o=s.length;for(u=0,a=r.length;u0){var f=r.toString().split("http")[0];a=f.replace(n,"").replace("\n","")}else i&&i.length>0&&(a=i[1].func);if(n)for(u=0;u0&&(t.exceptionInfo=g),r=e.stack,r&&(t.stack=r.toString()),r=e.recordedStack;if(r){i="";for(s=0,o=r.length;s args: ";for(l=0,f=a.length;l0&&(i+=", "),i+=h;i+="\n"}}t.mostRecentStack=i}return t},_shouldReload:function(e,t){return e&&CK.currentApplication?YES:e&&t==="cloudos"?YES:NO},_prettyValue:function(e){var t;return e===undefined?t="undefined":e===null?t="null":(e instanceof Function&&(t=e.displayName,t||(t=e.name)),t||(t=e.toString())),t}}),CK.AccountPreferences=SC.Object.extend({hasInitialized:NO,timeZone:"US/Pacific",timezoneName:"City.Cupertino - U.S." ,locale:null,secondaryLocale:null,regionFormat:null}),CK.AppInfo=SC.Object.extend({name:null,capitalizedName:function(){var e=this.get("name");return e&&(e.charAt(0)!=="i"?e=e.capitalize():e="i"+e.substring(1).capitalize()),e}.property("name").cacheable(),displayName:null,supportedFileExtensions:null,isDisabled:NO,isUnqualified:NO}),CK.AppInfo.mixin({_properties:["name","displayName","supportedFileExtensions","isDisabled","isUnqualified","supportedLocales"],serializeAsHash:function(e){var t=CK.AppInfo._properties,n={};for(var r=0;r0}.property("_appleIdEmailsLookupTable").cacheable(),_buildAppleIdLookupTable:function(e){var t={},n=this.get("appleIdEntries");if(n){for(var r=0,i=n.length;r1?arguments[1]:undefined,u=o?Number(o):0;u!=u&&(u=0);var a=Math.min(Math.max(u,0),r);if(s+a>r)return!1;var f=-1;while(++f=500)i=t.get("encodedBody"),f||(this.set("reportPath",null),f=YES);f&&(r={httpMethod:this.get("reportType")||this.get("type"),statusCode:o?o.status:999,serverHostname:s.hostname(),urlPath:this.get("reportPath")||s.path(),clientTiming:SC.getCurrentTimeForPerformance()-t.get("addedToOutgoingQueueTimestamp"),uncompressedResponseSize:u?u.length:undefined}),CloudOS.requestReceived(r,a,e.getFullAddress(),i)}return n}},CK.SUPPLEMENTARY_LOCALE_DATA={likelySubtags:{aa:"aa-Latn-ET",ab:"ab-Cyrl-GE",ace:"ace-Latn-ID",ach:"ach-Latn-UG",ady:"ady-Cyrl-RU",af:"af-Latn-ZA",agq:"agq-Latn-CM",ak:"ak-Latn-GH",alt:"alt-Cyrl-RU",am:"am-Ethi-ET",amo:"amo-Latn-NG",aoz:"aoz-Latn-ID",ar:"ar-Arab-EG",as:"as-Beng-IN",asa:"asa-Latn-TZ",ast:"ast-Latn-ES",atj:"atj-Latn-CA",av:"av-Cyrl-RU",awa:"awa-Deva-IN",ay:"ay-Latn-BO",az:"az-Latn-AZ","az-Arab":"az-Arab-IR","az-IR" :"az-Arab-IR","az-RU":"az-Cyrl-RU",ba:"ba-Cyrl-RU",bal:"bal-Arab-PK",ban:"ban-Latn-ID",bap:"bap-Deva-NP",bas:"bas-Latn-CM",bax:"bax-Bamu-CM",bbc:"bbc-Latn-ID",bbj:"bbj-Latn-CM",be:"be-Cyrl-BY",bem:"bem-Latn-ZM",bez:"bez-Latn-TZ",bfd:"bfd-Latn-CM",bfq:"bfq-Taml-IN",bft:"bft-Arab-PK",bfy:"bfy-Deva-IN",bg:"bg-Cyrl-BG",bgx:"bgx-Grek-TR",bhb:"bhb-Deva-IN",bho:"bho-Deva-IN",bi:"bi-Latn-VU",bik:"bik-Latn-PH",bin:"bin-Latn-NG",bjj:"bjj-Deva-IN",bkm:"bkm-Latn-CM",bku:"bku-Latn-PH",bm:"bm-Latn-ML",bmq:"bmq-Latn-ML",bn:"bn-Beng-BD",bo:"bo-Tibt-CN",bqv:"bqv-Latn-CI",br:"br-Latn-FR",bra:"bra-Deva-IN",brx:"brx-Deva-IN",bs:"bs-Latn-BA",bss:"bss-Latn-CM",bto:"bto-Latn-PH",btv:"btv-Deva-PK",bua:"bua-Cyrl-RU",buc:"buc-Latn-YT",bug:"bug-Latn-ID",bum:"bum-Latn-CM",bvb:"bvb-Latn-GQ",bya:"bya-Latn-ID",byn:"byn-Ethi-ER",byv:"byv-Latn-CM",bze:"bze-Latn-ML",ca:"ca-Latn-ES",cch:"cch-Latn-NG",ccp:"ccp-Beng-IN",ce:"ce-Cyrl-RU",ceb:"ceb-Latn-PH",cgg:"cgg-Latn-UG",ch:"ch-Latn-GU",chk:"chk-Latn-FM",chm:"chm-Cyrl-RU",chp:"chp-Latn-CA",chr:"chr-Cher-US",cja:"cja-Arab-KH",cjm:"cjm-Cham-VN",ckb:"ckb-Arab-IQ",co:"co-Latn-FR",cr:"cr-Cans-CA",crj:"crj-Cans-CA",crk:"crk-Cans-CA",crl:"crl-Cans-CA",crm:"crm-Cans-CA",cs:"cs-Latn-CZ",csb:"csb-Latn-PL",csw:"csw-Cans-CA",cu:"cu-Cyrl-RU",cv:"cv-Cyrl-RU",cy:"cy-Latn-GB",da:"da-Latn-DK",dar:"dar-Cyrl-RU",dav:"dav-Latn-KE",de:"de-Latn-DE",den:"den-Latn-CA",dgr:"dgr-Latn-CA",dje:"dje-Latn-NE",dnj:"dnj-Latn-CI",doi:"doi-Arab-IN",dsb:"dsb-Latn-DE",dtm:"dtm-Latn-ML",dua:"dua-Latn-CM",dv:"dv-Thaa-MV",dyo:"dyo-Latn-SN",dyu:"dyu-Latn-BF",dz:"dz-Tibt-BT",ebu:"ebu-Latn-KE",ee:"ee-Latn-GH" ,efi:"efi-Latn-NG",el:"el-Grek-GR",en:"en-Latn-US",eo:"eo-Latn-001",es:"es-Latn-ES",et:"et-Latn-EE",eu:"eu-Latn-ES",ewo:"ewo-Latn-CM",fa:"fa-Arab-IR",fan:"fan-Latn-GQ",ff:"ff-Latn-SN",fi:"fi-Latn-FI",fil:"fil-Latn-PH",fit:"fit-Latn-SE",fj:"fj-Latn-FJ",fo:"fo-Latn-FO",fon:"fon-Latn-BJ",fr:"fr-Latn-FR",fur:"fur-Latn-IT",fy:"fy-Latn-NL",ga:"ga-Latn-IE",gaa:"gaa-Latn-GH",gag:"gag-Latn-MD",gbm:"gbm-Deva-IN",gcr:"gcr-Latn-GF",gd:"gd-Latn-GB",gez:"gez-Ethi-ET",ggn:"ggn-Deva-NP",gil:"gil-Latn-KI",gjk:"gjk-Arab-PK",gju:"gju-Arab-PK",gl:"gl-Latn-ES",gn:"gn-Latn-PY",gon:"gon-Telu-IN",gor:"gor-Latn-ID",gos:"gos-Latn-NL",grt:"grt-Beng-IN",gsw:"gsw-Latn-CH",gu:"gu-Gujr-IN",gub:"gub-Latn-BR",guz:"guz-Latn-KE",gv:"gv-Latn-IM",gvr:"gvr-Deva-NP",gwi:"gwi-Latn-CA",ha:"ha-Latn-NG","ha-CM":"ha-Arab-CM","ha-SD":"ha-Arab-SD",haw:"haw-Latn-US",he:"he-Hebr-IL",hi:"hi-Deva-IN",hil:"hil-Latn-PH",hnd:"hnd-Arab-PK",hne:"hne-Deva-IN",hnn:"hnn-Latn-PH",ho:"ho-Latn-PG",hoc:"hoc-Deva-IN",hoj:"hoj-Deva-IN",hr:"hr-Latn-HR",hsb:"hsb-Latn-DE",ht:"ht-Latn-HT",hu:"hu-Latn-HU",hy:"hy-Armn-AM",ia:"ia-Latn-FR",ibb:"ibb-Latn-NG",id:"id-Latn-ID",ig:"ig-Latn-NG",ii:"ii-Yiii-CN",ik:"ik-Latn-US",ilo:"ilo-Latn-PH","in":"in-Latn-ID",inh:"inh-Cyrl-RU",is:"is-Latn-IS",it:"it-Latn-IT",iu:"iu-Cans-CA",iw:"iw-Hebr-IL",ja:"ja-Jpan-JP",jgo:"jgo-Latn-CM",ji:"ji-Hebr-UA",jmc:"jmc-Latn-TZ",jml:"jml-Deva-NP",jv:"jv-Latn-ID",jw:"jw-Latn-ID",ka:"ka-Geor-GE",kaa:"kaa-Cyrl-UZ",kab:"kab-Latn-DZ",kaj:"kaj-Latn-NG",kam:"kam-Latn-KE",kao:"kao-Latn-ML",kbd:"kbd-Cyrl-RU",kcg:"kcg-Latn-NG",kck:"kck-Latn-ZW",kde:"kde-Latn-TZ",kdt:"kdt-Thai-TH",kea :"kea-Latn-CV",ken:"ken-Latn-CM",kfo:"kfo-Latn-CI",kfr:"kfr-Deva-IN",kg:"kg-Latn-CD",kge:"kge-Latn-ID",kgp:"kgp-Latn-BR",kha:"kha-Latn-IN",khb:"khb-Talu-CN",khq:"khq-Latn-ML",kht:"kht-Mymr-IN",khw:"khw-Arab-PK",ki:"ki-Latn-KE",kj:"kj-Latn-NA",kjg:"kjg-Laoo-LA",kk:"kk-Cyrl-KZ","kk-AF":"kk-Arab-AF","kk-Arab":"kk-Arab-CN","kk-CN":"kk-Arab-CN","kk-IR":"kk-Arab-IR","kk-MN":"kk-Arab-MN",kkj:"kkj-Latn-CM",kl:"kl-Latn-GL",kln:"kln-Latn-KE",km:"km-Khmr-KH",kmb:"kmb-Latn-AO",kn:"kn-Knda-IN",ko:"ko-Kore-KR",koi:"koi-Cyrl-RU",kok:"kok-Deva-IN",kos:"kos-Latn-FM",kpe:"kpe-Latn-LR",krc:"krc-Cyrl-RU",kri:"kri-Latn-SL",krl:"krl-Latn-RU",kru:"kru-Deva-IN",ks:"ks-Arab-IN",ksb:"ksb-Latn-TZ",ksf:"ksf-Latn-CM",ksh:"ksh-Latn-DE",ku:"ku-Latn-TR","ku-Arab":"ku-Arab-IQ","ku-LB":"ku-Arab-LB",kum:"kum-Cyrl-RU",kv:"kv-Cyrl-RU",kvr:"kvr-Latn-ID",kvx:"kvx-Arab-PK",kw:"kw-Latn-GB",kxp:"kxp-Arab-PK",ky:"ky-Cyrl-KG","ky-Arab":"ky-Arab-CN","ky-CN":"ky-Arab-CN","ky-Latn":"ky-Latn-TR","ky-TR":"ky-Latn-TR",la:"la-Latn-VA",lag:"lag-Latn-TZ",lah:"lah-Arab-PK",lb:"lb-Latn-LU",lbe:"lbe-Cyrl-RU",lbw:"lbw-Latn-ID",lcp:"lcp-Thai-CN",lep:"lep-Lepc-IN",lez:"lez-Cyrl-RU",lg:"lg-Latn-UG",li:"li-Latn-NL",lif:"lif-Deva-NP",lis:"lis-Lisu-CN",lki:"lki-Arab-IR",lkt:"lkt-Latn-US",lmn:"lmn-Telu-IN",lmo:"lmo-Latn-CH",ln:"ln-Latn-CD",lo:"lo-Laoo-LA",lol:"lol-Latn-CD",loz:"loz-Latn-ZM",lt:"lt-Latn-LT",lu:"lu-Latn-CD",lua:"lua-Latn-CD",luo:"luo-Latn-KE",luy:"luy-Latn-KE",luz:"luz-Arab-IR",lv:"lv-Latn-LV",lwl:"lwl-Thai-TH",mad:"mad-Latn-ID",maf:"maf-Latn-CM",mag:"mag-Deva-IN",mai:"mai-Deva-IN",mak:"mak-Latn-ID",man:"man-Latn-GM","man-GN" :"man-Nkoo-GN","man-Nkoo":"man-Nkoo-GN",mas:"mas-Latn-KE",maz:"maz-Latn-MX",mdf:"mdf-Cyrl-RU",mdh:"mdh-Latn-PH",mdr:"mdr-Latn-ID",men:"men-Latn-SL",mer:"mer-Latn-KE",mfe:"mfe-Latn-MU",mg:"mg-Latn-MG",mgh:"mgh-Latn-MZ",mgo:"mgo-Latn-CM",mgp:"mgp-Deva-NP",mgy:"mgy-Latn-TZ",mh:"mh-Latn-MH",mi:"mi-Latn-NZ",min:"min-Latn-ID",mk:"mk-Cyrl-MK",ml:"ml-Mlym-IN",mn:"mn-Cyrl-MN","mn-CN":"mn-Mong-CN","mn-Mong":"mn-Mong-CN",mni:"mni-Beng-IN",mnw:"mnw-Mymr-MM",moe:"moe-Latn-CA",mos:"mos-Latn-BF",mr:"mr-Deva-IN",mrd:"mrd-Deva-NP",mrj:"mrj-Cyrl-RU",ms:"ms-Latn-MY","ms-CC":"ms-Arab-CC","ms-ID":"ms-Arab-ID",mt:"mt-Latn-MT",mua:"mua-Latn-CM",mvy:"mvy-Arab-PK",mwk:"mwk-Latn-ML",mwr:"mwr-Deva-IN",mxc:"mxc-Latn-ZW",my:"my-Mymr-MM",myv:"myv-Cyrl-RU",na:"na-Latn-NR",nap:"nap-Latn-IT",naq:"naq-Latn-NA",nb:"nb-Latn-NO",nch:"nch-Latn-MX",nd:"nd-Latn-ZW",nds:"nds-Latn-DE",ne:"ne-Deva-NP","new":"new-Deva-NP",ng:"ng-Latn-NA",nhe:"nhe-Latn-MX",nhw:"nhw-Latn-MX",nij:"nij-Latn-ID",niu:"niu-Latn-NU",nl:"nl-Latn-NL",nmg:"nmg-Latn-CM",nn:"nn-Latn-NO",nnh:"nnh-Latn-CM",no:"no-Latn-NO",nod:"nod-Lana-TH",nr:"nr-Latn-ZA",nsk:"nsk-Cans-CA",nso:"nso-Latn-ZA",nus:"nus-Latn-SD",nv:"nv-Latn-US",nxq:"nxq-Latn-CN",ny:"ny-Latn-MW",nym:"nym-Latn-TZ",nyn:"nyn-Latn-UG",oc:"oc-Latn-FR",om:"om-Latn-ET",or:"or-Orya-IN",os:"os-Cyrl-GE",pa:"pa-Guru-IN","pa-Arab":"pa-Arab-PK","pa-PK":"pa-Arab-PK",pag:"pag-Latn-PH",pam:"pam-Latn-PH",pap:"pap-Latn-AW",pau:"pau-Latn-PW",pcm:"pcm-Latn-NG",pko:"pko-Latn-KE",pl:"pl-Latn-PL",pon:"pon-Latn-FM",prd:"prd-Arab-IR",prg:"prg-Latn-001",ps:"ps-Arab-AF",pt:"pt-Latn-BR",puu:"puu-Latn-GA",qu:"qu-Latn-PE" ,raj:"raj-Latn-IN",rcf:"rcf-Latn-RE",rej:"rej-Latn-ID",ria:"ria-Latn-IN",rjs:"rjs-Deva-NP",rkt:"rkt-Beng-BD",rm:"rm-Latn-CH",rmf:"rmf-Latn-FI",rmo:"rmo-Latn-CH",rmt:"rmt-Arab-IR",rmu:"rmu-Latn-SE",rn:"rn-Latn-BI",rng:"rng-Latn-MZ",ro:"ro-Latn-RO",rob:"rob-Latn-ID",rof:"rof-Latn-TZ",ru:"ru-Cyrl-RU",rue:"rue-Cyrl-UA",rw:"rw-Latn-RW",rwk:"rwk-Latn-TZ",ryu:"ryu-Kana-JP",sa:"sa-Deva-IN",saf:"saf-Latn-GH",sah:"sah-Cyrl-RU",saq:"saq-Latn-KE",sas:"sas-Latn-ID",sat:"sat-Latn-IN",saz:"saz-Saur-IN",sbp:"sbp-Latn-TZ",scn:"scn-Latn-IT",sco:"sco-Latn-GB",scs:"scs-Latn-CA",sd:"sd-Arab-PK","sd-Deva":"sd-Deva-IN",sdh:"sdh-Arab-IR",se:"se-Latn-NO",sef:"sef-Latn-CI",seh:"seh-Latn-MZ",ses:"ses-Latn-ML",sg:"sg-Latn-CF",shi:"shi-Tfng-MA",shn:"shn-Mymr-MM",si:"si-Sinh-LK",sid:"sid-Latn-ET",sk:"sk-Latn-SK",sl:"sl-Latn-SI",sm:"sm-Latn-WS",sma:"sma-Latn-SE",smj:"smj-Latn-SE",smn:"smn-Latn-FI",sms:"sms-Latn-FI",sn:"sn-Latn-ZW",snk:"snk-Latn-ML",so:"so-Latn-SO",sq:"sq-Latn-AL",sr:"sr-Cyrl-RS","sr-ME":"sr-Latn-ME","sr-RO":"sr-Latn-RO","sr-RU":"sr-Latn-RU","sr-TR":"sr-Latn-TR",srn:"srn-Latn-SR",srr:"srr-Latn-SN",srx:"srx-Deva-IN",ss:"ss-Latn-ZA",ssy:"ssy-Latn-ER",st:"st-Latn-ZA",su:"su-Latn-ID",suk:"suk-Latn-TZ",sus:"sus-Latn-GN",sv:"sv-Latn-SE",sw:"sw-Latn-TZ",swb:"swb-Arab-YT",swc:"swc-Latn-CD",sxn:"sxn-Latn-ID",syl:"syl-Beng-BD",syr:"syr-Syrc-IQ",ta:"ta-Taml-IN",taj:"taj-Deva-NP",tbw:"tbw-Latn-PH",tcy:"tcy-Knda-IN",tdd:"tdd-Tale-CN",tdg:"tdg-Deva-NP",tdh:"tdh-Deva-NP",te:"te-Telu-IN",tem:"tem-Latn-SL",teo:"teo-Latn-UG",tet:"tet-Latn-TL",tg:"tg-Cyrl-TJ","tg-Arab":"tg-Arab-PK","tg-PK":"tg-Arab-PK",th:"th-Thai-TH" ,thl:"thl-Deva-NP",thq:"thq-Deva-NP",thr:"thr-Deva-NP",ti:"ti-Ethi-ET",tig:"tig-Ethi-ER",tiv:"tiv-Latn-NG",tk:"tk-Latn-TM",tkl:"tkl-Latn-TK",tkt:"tkt-Deva-NP",tl:"tl-Latn-PH",tmh:"tmh-Latn-NE",tn:"tn-Latn-ZA",to:"to-Latn-TO",tpi:"tpi-Latn-PG",tr:"tr-Latn-TR",trv:"trv-Latn-TW",ts:"ts-Latn-ZA",tsf:"tsf-Deva-NP",tsg:"tsg-Latn-PH",tsj:"tsj-Tibt-BT",tt:"tt-Cyrl-RU",ttj:"ttj-Latn-UG",tts:"tts-Thai-TH",tum:"tum-Latn-MW",tvl:"tvl-Latn-TV",twq:"twq-Latn-NE",ty:"ty-Latn-PF",tyv:"tyv-Cyrl-RU",tzm:"tzm-Latn-MA",udm:"udm-Cyrl-RU",ug:"ug-Arab-CN","ug-Cyrl":"ug-Cyrl-KZ","ug-KZ":"ug-Cyrl-KZ","ug-MN":"ug-Cyrl-MN",uk:"uk-Cyrl-UA",uli:"uli-Latn-FM",umb:"umb-Latn-AO",und:"en-Latn-US","und-002":"en-Latn-NG","und-003":"en-Latn-US","und-005":"pt-Latn-BR","und-009":"en-Latn-AU","und-011":"en-Latn-NG","und-013":"es-Latn-MX","und-014":"en-Latn-KE","und-015":"ar-Arab-EG","und-017":"sw-Latn-CD","und-018":"en-Latn-ZA","und-019":"en-Latn-US","und-021":"en-Latn-US","und-029":"es-Latn-CU","und-030":"zh-Hans-CN","und-034":"hi-Deva-IN","und-035":"id-Latn-ID","und-039":"it-Latn-IT","und-053":"en-Latn-AU","und-054":"en-Latn-PG","und-057":"en-Latn-KI","und-061":"sm-Latn-WS","und-142":"zh-Hans-CN","und-143":"uz-Latn-UZ","und-145":"ar-Arab-SA","und-150":"ru-Cyrl-RU","und-151":"ru-Cyrl-RU","und-154":"en-Latn-GB","und-155":"de-Latn-DE","und-419":"es-Latn-419","und-AD":"ca-Latn-AD","und-AE":"ar-Arab-AE","und-AF":"fa-Arab-AF","und-AL":"sq-Latn-AL","und-AM":"hy-Armn-AM","und-AO":"pt-Latn-AO","und-AQ":"und-Latn-AQ","und-AR":"es-Latn-AR","und-AS":"sm-Latn-AS","und-AT":"de-Latn-AT","und-AW":"nl-Latn-AW","und-AX":"sv-Latn-AX" ,"und-AZ":"az-Latn-AZ","und-Arab":"ar-Arab-EG","und-Arab-CC":"ms-Arab-CC","und-Arab-CN":"ug-Arab-CN","und-Arab-GB":"ks-Arab-GB","und-Arab-ID":"ms-Arab-ID","und-Arab-IN":"ur-Arab-IN","und-Arab-KH":"cja-Arab-KH","und-Arab-MN":"kk-Arab-MN","und-Arab-MU":"ur-Arab-MU","und-Arab-NG":"ha-Arab-NG","und-Arab-PK":"ur-Arab-PK","und-Arab-TJ":"fa-Arab-TJ","und-Arab-TR":"zza-Arab-TR","und-Arab-YT":"swb-Arab-YT","und-Armi":"arc-Armi-IR","und-Armn":"hy-Armn-AM","und-Avst":"ae-Avst-IR","und-BA":"bs-Latn-BA","und-BD":"bn-Beng-BD","und-BE":"nl-Latn-BE","und-BF":"fr-Latn-BF","und-BG":"bg-Cyrl-BG","und-BH":"ar-Arab-BH","und-BI":"rn-Latn-BI","und-BJ":"fr-Latn-BJ","und-BL":"fr-Latn-BL","und-BN":"ms-Latn-BN","und-BO":"es-Latn-BO","und-BQ":"pap-Latn-BQ","und-BR":"pt-Latn-BR","und-BT":"dz-Tibt-BT","und-BV":"und-Latn-BV","und-BY":"be-Cyrl-BY","und-Bali":"ban-Bali-ID","und-Bamu":"bax-Bamu-CM","und-Batk":"bbc-Batk-ID","und-Beng":"bn-Beng-BD","und-Bopo":"zh-Bopo-TW","und-Brah":"pra-Brah-IN","und-Brai":"und-Brai-FR","und-Bugi":"bug-Bugi-ID","und-Buhd":"bku-Buhd-PH","und-CD":"sw-Latn-CD","und-CF":"fr-Latn-CF","und-CG":"fr-Latn-CG","und-CH":"de-Latn-CH","und-CI":"fr-Latn-CI","und-CL":"es-Latn-CL","und-CM":"fr-Latn-CM","und-CN":"zh-Hans-CN","und-CO":"es-Latn-CO","und-CP":"und-Latn-CP","und-CR":"es-Latn-CR","und-CU":"es-Latn-CU","und-CV":"pt-Latn-CV","und-CW":"pap-Latn-CW","und-CY":"el-Grek-CY","und-CZ":"cs-Latn-CZ","und-Cakm":"ccp-Cakm-BD","und-Cans":"cr-Cans-CA","und-Cari":"xcr-Cari-TR","und-Cham":"cjm-Cham-VN","und-Cher":"chr-Cher-US","und-Copt":"cop-Copt-EG","und-Cprt":"grc-Cprt-CY","und-Cyrl":"ru-Cyrl-RU" ,"und-Cyrl-AL":"mk-Cyrl-AL","und-Cyrl-BA":"sr-Cyrl-BA","und-Cyrl-GE":"ab-Cyrl-GE","und-Cyrl-GR":"mk-Cyrl-GR","und-Cyrl-MD":"uk-Cyrl-MD","und-Cyrl-PL":"be-Cyrl-PL","und-Cyrl-RO":"bg-Cyrl-RO","und-Cyrl-SK":"uk-Cyrl-SK","und-Cyrl-TR":"kbd-Cyrl-TR","und-Cyrl-XK":"sr-Cyrl-XK","und-DE":"de-Latn-DE","und-DJ":"aa-Latn-DJ","und-DK":"da-Latn-DK","und-DO":"es-Latn-DO","und-DZ":"ar-Arab-DZ","und-Deva":"hi-Deva-IN","und-Deva-BT":"ne-Deva-BT","und-Deva-MU":"bho-Deva-MU","und-Deva-PK":"btv-Deva-PK","und-EA":"es-Latn-EA","und-EC":"es-Latn-EC","und-EE":"et-Latn-EE","und-EG":"ar-Arab-EG","und-EH":"ar-Arab-EH","und-ER":"ti-Ethi-ER","und-ES":"es-Latn-ES","und-ET":"am-Ethi-ET","und-EU":"en-Latn-GB","und-Egyp":"egy-Egyp-EG","und-Ethi":"am-Ethi-ET","und-FI":"fi-Latn-FI","und-FM":"chk-Latn-FM","und-FO":"fo-Latn-FO","und-FR":"fr-Latn-FR","und-GA":"fr-Latn-GA","und-GE":"ka-Geor-GE","und-GF":"fr-Latn-GF","und-GH":"ak-Latn-GH","und-GL":"kl-Latn-GL","und-GN":"fr-Latn-GN","und-GP":"fr-Latn-GP","und-GQ":"es-Latn-GQ","und-GR":"el-Grek-GR","und-GS":"und-Latn-GS","und-GT":"es-Latn-GT","und-GW":"pt-Latn-GW","und-Geor":"ka-Geor-GE","und-Glag":"cu-Glag-BG","und-Goth":"got-Goth-UA","und-Grek":"el-Grek-GR","und-Grek-TR":"bgx-Grek-TR","und-Gujr":"gu-Gujr-IN","und-Guru":"pa-Guru-IN","und-HK":"zh-Hant-HK","und-HM":"und-Latn-HM","und-HN":"es-Latn-HN","und-HR":"hr-Latn-HR","und-HT":"ht-Latn-HT","und-HU":"hu-Latn-HU","und-Hang":"ko-Hang-KR","und-Hani":"zh-Hani-CN","und-Hano":"hnn-Hano-PH","und-Hans":"zh-Hans-CN","und-Hant":"zh-Hant-TW","und-Hebr":"he-Hebr-IL","und-Hebr-CA":"yi-Hebr-CA","und-Hebr-GB":"yi-Hebr-GB","und-Hebr-SE" :"yi-Hebr-SE","und-Hebr-UA":"yi-Hebr-UA","und-Hebr-US":"yi-Hebr-US","und-Hira":"ja-Hira-JP","und-IC":"es-Latn-IC","und-ID":"id-Latn-ID","und-IL":"he-Hebr-IL","und-IN":"hi-Deva-IN","und-IQ":"ar-Arab-IQ","und-IR":"fa-Arab-IR","und-IS":"is-Latn-IS","und-IT":"it-Latn-IT","und-Ital":"ett-Ital-IT","und-JO":"ar-Arab-JO","und-JP":"ja-Jpan-JP","und-Java":"jv-Java-ID","und-Jpan":"ja-Jpan-JP","und-KG":"ky-Cyrl-KG","und-KH":"km-Khmr-KH","und-KM":"ar-Arab-KM","und-KP":"ko-Kore-KP","und-KR":"ko-Kore-KR","und-KW":"ar-Arab-KW","und-KZ":"ru-Cyrl-KZ","und-Kali":"eky-Kali-MM","und-Kana":"ja-Kana-JP","und-Khar":"pra-Khar-PK","und-Khmr":"km-Khmr-KH","und-Knda":"kn-Knda-IN","und-Kore":"ko-Kore-KR","und-Kthi":"bh-Kthi-IN","und-LA":"lo-Laoo-LA","und-LB":"ar-Arab-LB","und-LI":"de-Latn-LI","und-LK":"si-Sinh-LK","und-LS":"st-Latn-LS","und-LT":"lt-Latn-LT","und-LU":"fr-Latn-LU","und-LV":"lv-Latn-LV","und-LY":"ar-Arab-LY","und-Lana":"nod-Lana-TH","und-Laoo":"lo-Laoo-LA","und-Latn-AF":"tk-Latn-AF","und-Latn-AM":"az-Latn-AM","und-Latn-BG":"tr-Latn-BG","und-Latn-CN":"za-Latn-CN","und-Latn-CY":"tr-Latn-CY","und-Latn-DZ":"fr-Latn-DZ","und-Latn-ET":"en-Latn-ET","und-Latn-GE":"ku-Latn-GE","und-Latn-GR":"tr-Latn-GR","und-Latn-IL":"ro-Latn-IL","und-Latn-IR":"tk-Latn-IR","und-Latn-KM":"fr-Latn-KM","und-Latn-KZ":"de-Latn-KZ","und-Latn-LB":"fr-Latn-LB","und-Latn-MA":"fr-Latn-MA","und-Latn-MK":"sq-Latn-MK","und-Latn-MO":"pt-Latn-MO","und-Latn-MR":"fr-Latn-MR","und-Latn-RU":"krl-Latn-RU","und-Latn-SY":"fr-Latn-SY","und-Latn-TN":"fr-Latn-TN","und-Latn-TW":"trv-Latn-TW","und-Latn-UA":"pl-Latn-UA","und-Lepc":"lep-Lepc-IN" ,"und-Limb":"lif-Limb-IN","und-Linb":"grc-Linb-GR","und-Lisu":"lis-Lisu-CN","und-Lyci":"xlc-Lyci-TR","und-Lydi":"xld-Lydi-TR","und-MA":"ar-Arab-MA","und-MC":"fr-Latn-MC","und-MD":"ro-Latn-MD","und-ME":"sr-Latn-ME","und-MF":"fr-Latn-MF","und-MG":"mg-Latn-MG","und-MK":"mk-Cyrl-MK","und-ML":"bm-Latn-ML","und-MM":"my-Mymr-MM","und-MN":"mn-Cyrl-MN","und-MO":"zh-Hant-MO","und-MQ":"fr-Latn-MQ","und-MR":"ar-Arab-MR","und-MT":"mt-Latn-MT","und-MU":"mfe-Latn-MU","und-MV":"dv-Thaa-MV","und-MX":"es-Latn-MX","und-MY":"ms-Latn-MY","und-MZ":"pt-Latn-MZ","und-Mand":"myz-Mand-IR","und-Merc":"xmr-Merc-SD","und-Mero":"xmr-Mero-SD","und-Mlym":"ml-Mlym-IN","und-Mong":"mn-Mong-CN","und-Mtei":"mni-Mtei-IN","und-Mymr":"my-Mymr-MM","und-Mymr-IN":"kht-Mymr-IN","und-Mymr-TH":"mnw-Mymr-TH","und-NA":"af-Latn-NA","und-NC":"fr-Latn-NC","und-NE":"ha-Latn-NE","und-NI":"es-Latn-NI","und-NL":"nl-Latn-NL","und-NO":"nb-Latn-NO","und-NP":"ne-Deva-NP","und-Nkoo":"man-Nkoo-GN","und-OM":"ar-Arab-OM","und-Ogam":"sga-Ogam-IE","und-Olck":"sat-Olck-IN","und-Orkh":"otk-Orkh-MN","und-Orya":"or-Orya-IN","und-Osma":"so-Osma-SO","und-PA":"es-Latn-PA","und-PE":"es-Latn-PE","und-PF":"fr-Latn-PF","und-PG":"tpi-Latn-PG","und-PH":"fil-Latn-PH","und-PK":"ur-Arab-PK","und-PL":"pl-Latn-PL","und-PM":"fr-Latn-PM","und-PR":"es-Latn-PR","und-PS":"ar-Arab-PS","und-PT":"pt-Latn-PT","und-PW":"pau-Latn-PW","und-PY":"gn-Latn-PY","und-Phag":"lzh-Phag-CN","und-Phli":"pal-Phli-IR","und-Phnx":"phn-Phnx-LB","und-Plrd":"hmd-Plrd-CN","und-Prti":"xpr-Prti-IR","und-QA":"ar-Arab-QA","und-QO":"en-Latn-IO","und-RE":"fr-Latn-RE","und-RO":"ro-Latn-RO","und-RS" :"sr-Cyrl-RS","und-RU":"ru-Cyrl-RU","und-RW":"rw-Latn-RW","und-Rjng":"rej-Rjng-ID","und-Runr":"non-Runr-SE","und-SA":"ar-Arab-SA","und-SC":"fr-Latn-SC","und-SD":"ar-Arab-SD","und-SE":"sv-Latn-SE","und-SI":"sl-Latn-SI","und-SJ":"nb-Latn-SJ","und-SK":"sk-Latn-SK","und-SM":"it-Latn-SM","und-SN":"fr-Latn-SN","und-SO":"so-Latn-SO","und-SR":"nl-Latn-SR","und-ST":"pt-Latn-ST","und-SV":"es-Latn-SV","und-SY":"ar-Arab-SY","und-Samr":"smp-Samr-IL","und-Sarb":"xsa-Sarb-YE","und-Saur":"saz-Saur-IN","und-Shaw":"en-Shaw-GB","und-Shrd":"sa-Shrd-IN","und-Sinh":"si-Sinh-LK","und-Sora":"srb-Sora-IN","und-Sund":"su-Sund-ID","und-Sylo":"syl-Sylo-BD","und-Syrc":"syr-Syrc-IQ","und-TD":"fr-Latn-TD","und-TF":"fr-Latn-TF","und-TG":"fr-Latn-TG","und-TH":"th-Thai-TH","und-TJ":"tg-Cyrl-TJ","und-TK":"tkl-Latn-TK","und-TL":"pt-Latn-TL","und-TM":"tk-Latn-TM","und-TN":"ar-Arab-TN","und-TO":"to-Latn-TO","und-TR":"tr-Latn-TR","und-TV":"tvl-Latn-TV","und-TW":"zh-Hant-TW","und-TZ":"sw-Latn-TZ","und-Tagb":"tbw-Tagb-PH","und-Takr":"doi-Takr-IN","und-Tale":"tdd-Tale-CN","und-Talu":"khb-Talu-CN","und-Taml":"ta-Taml-IN","und-Tavt":"blt-Tavt-VN","und-Telu":"te-Telu-IN","und-Tfng":"zgh-Tfng-MA","und-Tglg":"fil-Tglg-PH","und-Thaa":"dv-Thaa-MV","und-Thai":"th-Thai-TH","und-Thai-CN":"lcp-Thai-CN","und-Thai-KH":"kdt-Thai-KH","und-Thai-LA":"kdt-Thai-LA","und-Tibt":"bo-Tibt-CN","und-UA":"uk-Cyrl-UA","und-UG":"sw-Latn-UG","und-UY":"es-Latn-UY","und-UZ":"uz-Latn-UZ","und-Ugar":"uga-Ugar-SY","und-VA":"la-Latn-VA","und-VE":"es-Latn-VE","und-VN":"vi-Latn-VN","und-VU":"bi-Latn-VU","und-Vaii":"vai-Vaii-LR","und-WF":"fr-Latn-WF","und-WS" :"sm-Latn-WS","und-XK":"sq-Latn-XK","und-Xpeo":"peo-Xpeo-IR","und-Xsux":"akk-Xsux-IQ","und-YE":"ar-Arab-YE","und-YT":"fr-Latn-YT","und-Yiii":"ii-Yiii-CN",unr:"unr-Beng-IN","unr-Deva":"unr-Deva-NP","unr-NP":"unr-Deva-NP",unx:"unx-Beng-IN",ur:"ur-Arab-PK",uz:"uz-Latn-UZ","uz-AF":"uz-Arab-AF","uz-Arab":"uz-Arab-AF","uz-CN":"uz-Cyrl-CN",vai:"vai-Vaii-LR",ve:"ve-Latn-ZA",vi:"vi-Latn-VN",vic:"vic-Latn-SX",vo:"vo-Latn-001",vun:"vun-Latn-TZ",wa:"wa-Latn-BE",wae:"wae-Latn-CH",wal:"wal-Ethi-ET",war:"war-Latn-PH",wo:"wo-Latn-SN",xav:"xav-Latn-BR",xh:"xh-Latn-ZA",xog:"xog-Latn-UG",xsr:"xsr-Deva-NP",yao:"yao-Latn-MZ",yap:"yap-Latn-FM",yav:"yav-Latn-CM",ybb:"ybb-Latn-CM",yi:"yi-Hebr-UA",yo:"yo-Latn-NG",yua:"yua-Latn-MX",za:"za-Latn-CN",zea:"zea-Latn-NL",zgh:"zgh-Tfng-MA",zh:"zh-Hans-CN","zh-AU":"zh-Hant-AU","zh-BN":"zh-Hant-BN","zh-CN":"zh-Hans-CN","zh-GB":"zh-Hant-GB","zh-GF":"zh-Hant-GF","zh-HK":"zh-Hant-HK","zh-Hant":"zh-Hant-TW","zh-ID":"zh-Hant-ID","zh-MO":"zh-Hant-MO","zh-MY":"zh-Hant-MY","zh-PA":"zh-Hant-PA","zh-PF":"zh-Hant-PF","zh-PH":"zh-Hant-PH","zh-SR":"zh-Hant-SR","zh-TH":"zh-Hant-TH","zh-TW":"zh-Hant-TW","zh-US":"zh-Hant-US","zh-VN":"zh-Hant-VN",zmi:"zmi-Latn-MY",zu:"zu-Latn-ZA",zza:"zza-Arab-TR"},metadata:{alias:{languageAlias:{"aa-SAAHO":{_replacement:"ssy",_reason:"deprecated"},aar:{_replacement:"aa",_reason:"overlong"},abk:{_replacement:"ab",_reason:"overlong"},afr:{_replacement:"af",_reason:"overlong"},aju:{_replacement:"jrb",_reason:"macrolanguage"},aka:{_replacement:"ak",_reason:"overlong"},als:{_replacement:"sq",_reason:"macrolanguage"},amh:{_replacement:"am",_reason :"overlong"},ara:{_replacement:"ar",_reason:"overlong"},arb:{_replacement:"ar",_reason:"macrolanguage"},arg:{_replacement:"an",_reason:"overlong"},"art-lojban":{_replacement:"jbo",_reason:"deprecated"},asm:{_replacement:"as",_reason:"overlong"},ava:{_replacement:"av",_reason:"overlong"},ave:{_replacement:"ae",_reason:"overlong"},aym:{_replacement:"ay",_reason:"overlong"},ayr:{_replacement:"ay",_reason:"macrolanguage"},aze:{_replacement:"az",_reason:"overlong"},azj:{_replacement:"az",_reason:"macrolanguage"},bak:{_replacement:"ba",_reason:"overlong"},bam:{_replacement:"bm",_reason:"overlong"},bcc:{_replacement:"bal",_reason:"macrolanguage"},bcl:{_replacement:"bik",_reason:"macrolanguage"},bel:{_replacement:"be",_reason:"overlong"},ben:{_replacement:"bn",_reason:"overlong"},bih:{_replacement:"bh",_reason:"overlong"},bis:{_replacement:"bi",_reason:"overlong"},bod:{_replacement:"bo",_reason:"overlong"},bos:{_replacement:"bs",_reason:"overlong"},bre:{_replacement:"br",_reason:"overlong"},bul:{_replacement:"bg",_reason:"overlong"},bxk:{_replacement:"luy",_reason:"macrolanguage"},bxr:{_replacement:"bua",_reason:"macrolanguage"},cat:{_replacement:"ca",_reason:"overlong"},ces:{_replacement:"cs",_reason:"overlong"},cha:{_replacement:"ch",_reason:"overlong"},che:{_replacement:"ce",_reason:"overlong"},chu:{_replacement:"cu",_reason:"overlong"},chv:{_replacement:"cv",_reason:"overlong"},cld:{_replacement:"syr",_reason:"macrolanguage"},cmn:{_replacement:"zh",_reason:"macrolanguage"},cor:{_replacement:"kw",_reason:"overlong"},cos:{_replacement:"co",_reason:"overlong"},cre:{_replacement:"cr" ,_reason:"overlong"},cwd:{_replacement:"cr",_reason:"macrolanguage"},cym:{_replacement:"cy",_reason:"overlong"},dan:{_replacement:"da",_reason:"overlong"},deu:{_replacement:"de",_reason:"overlong"},dgo:{_replacement:"doi",_reason:"macrolanguage"},dhd:{_replacement:"mwr",_reason:"macrolanguage"},dik:{_replacement:"din",_reason:"macrolanguage"},diq:{_replacement:"zza",_reason:"macrolanguage"},div:{_replacement:"dv",_reason:"overlong"},dzo:{_replacement:"dz",_reason:"overlong"},ekk:{_replacement:"et",_reason:"macrolanguage"},ell:{_replacement:"el",_reason:"overlong"},emk:{_replacement:"man",_reason:"macrolanguage"},eng:{_replacement:"en",_reason:"overlong"},epo:{_replacement:"eo",_reason:"overlong"},esk:{_replacement:"ik",_reason:"macrolanguage"},est:{_replacement:"et",_reason:"overlong"},eus:{_replacement:"eu",_reason:"overlong"},ewe:{_replacement:"ee",_reason:"overlong"},fao:{_replacement:"fo",_reason:"overlong"},fas:{_replacement:"fa",_reason:"overlong"},fat:{_replacement:"ak",_reason:"macrolanguage"},fij:{_replacement:"fj",_reason:"overlong"},fin:{_replacement:"fi",_reason:"overlong"},fra:{_replacement:"fr",_reason:"overlong"},fry:{_replacement:"fy",_reason:"overlong"},fuc:{_replacement:"ff",_reason:"macrolanguage"},ful:{_replacement:"ff",_reason:"overlong"},gaz:{_replacement:"om",_reason:"macrolanguage"},gbo:{_replacement:"grb",_reason:"macrolanguage"},gla:{_replacement:"gd",_reason:"overlong"},gle:{_replacement:"ga",_reason:"overlong"},glg:{_replacement:"gl",_reason:"overlong"},glv:{_replacement:"gv",_reason:"overlong"},gno:{_replacement:"gon",_reason:"macrolanguage"},grn :{_replacement:"gn",_reason:"overlong"},gug:{_replacement:"gn",_reason:"macrolanguage"},guj:{_replacement:"gu",_reason:"overlong"},gya:{_replacement:"gba",_reason:"macrolanguage"},hat:{_replacement:"ht",_reason:"overlong"},hau:{_replacement:"ha",_reason:"overlong"},hbs:{_replacement:"sr-Latn",_reason:"overlong"},hdn:{_replacement:"hai",_reason:"macrolanguage"},hea:{_replacement:"hmn",_reason:"macrolanguage"},heb:{_replacement:"he",_reason:"overlong"},her:{_replacement:"hz",_reason:"overlong"},him:{_replacement:"srx",_reason:"macrolanguage"},hin:{_replacement:"hi",_reason:"overlong"},hmo:{_replacement:"ho",_reason:"overlong"},hrv:{_replacement:"hr",_reason:"overlong"},hun:{_replacement:"hu",_reason:"overlong"},hye:{_replacement:"hy",_reason:"overlong"},"i-ami":{_replacement:"ami",_reason:"deprecated"},"i-bnn":{_replacement:"bnn",_reason:"deprecated"},"i-hak":{_replacement:"hak",_reason:"deprecated"},"i-klingon":{_replacement:"tlh",_reason:"deprecated"},"i-lux":{_replacement:"lb",_reason:"deprecated"},"i-navajo":{_replacement:"nv",_reason:"deprecated"},"i-pwn":{_replacement:"pwn",_reason:"deprecated"},"i-tao":{_replacement:"tao",_reason:"deprecated"},"i-tay":{_replacement:"tay",_reason:"deprecated"},"i-tsu":{_replacement:"tsu",_reason:"deprecated"},ibo:{_replacement:"ig",_reason:"overlong"},ido:{_replacement:"io",_reason:"overlong"},iii:{_replacement:"ii",_reason:"overlong"},ike:{_replacement:"iu",_reason:"macrolanguage"},iku:{_replacement:"iu",_reason:"overlong"},ile:{_replacement:"ie",_reason:"overlong"},"in":{_replacement:"id",_reason:"deprecated"},ina:{_replacement:"ia",_reason :"overlong"},ind:{_replacement:"id",_reason:"overlong"},ipk:{_replacement:"ik",_reason:"overlong"},isl:{_replacement:"is",_reason:"overlong"},ita:{_replacement:"it",_reason:"overlong"},iw:{_replacement:"he",_reason:"deprecated"},jav:{_replacement:"jv",_reason:"overlong"},ji:{_replacement:"yi",_reason:"deprecated"},jpn:{_replacement:"ja",_reason:"overlong"},jw:{_replacement:"jv",_reason:"deprecated"},kal:{_replacement:"kl",_reason:"overlong"},kan:{_replacement:"kn",_reason:"overlong"},kas:{_replacement:"ks",_reason:"overlong"},kat:{_replacement:"ka",_reason:"overlong"},kau:{_replacement:"kr",_reason:"overlong"},kaz:{_replacement:"kk",_reason:"overlong"},khk:{_replacement:"mn",_reason:"macrolanguage"},khm:{_replacement:"km",_reason:"overlong"},kik:{_replacement:"ki",_reason:"overlong"},kin:{_replacement:"rw",_reason:"overlong"},kir:{_replacement:"ky",_reason:"overlong"},kmr:{_replacement:"ku",_reason:"macrolanguage"},knc:{_replacement:"kr",_reason:"macrolanguage"},kng:{_replacement:"kg",_reason:"macrolanguage"},knn:{_replacement:"kok",_reason:"macrolanguage"},kom:{_replacement:"kv",_reason:"overlong"},kon:{_replacement:"kg",_reason:"overlong"},kor:{_replacement:"ko",_reason:"overlong"},kpv:{_replacement:"kv",_reason:"macrolanguage"},kua:{_replacement:"kj",_reason:"overlong"},kur:{_replacement:"ku",_reason:"overlong"},lao:{_replacement:"lo",_reason:"overlong"},lat:{_replacement:"la",_reason:"overlong"},lav:{_replacement:"lv",_reason:"overlong"},lbk:{_replacement:"bnc",_reason:"macrolanguage"},lim:{_replacement:"li",_reason:"overlong"},lin:{_replacement:"ln",_reason:"overlong"}, lit:{_replacement:"lt",_reason:"overlong"},ltz:{_replacement:"lb",_reason:"overlong"},lub:{_replacement:"lu",_reason:"overlong"},lug:{_replacement:"lg",_reason:"overlong"},lvs:{_replacement:"lv",_reason:"macrolanguage"},mah:{_replacement:"mh",_reason:"overlong"},mal:{_replacement:"ml",_reason:"overlong"},mar:{_replacement:"mr",_reason:"overlong"},mhr:{_replacement:"chm",_reason:"macrolanguage"},mkd:{_replacement:"mk",_reason:"overlong"},mlg:{_replacement:"mg",_reason:"overlong"},mlt:{_replacement:"mt",_reason:"overlong"},mnk:{_replacement:"man",_reason:"macrolanguage"},mo:{_replacement:"ro-MD",_reason:"deprecated"},mol:{_replacement:"ro-MD",_reason:"overlong"},mon:{_replacement:"mn",_reason:"overlong"},mri:{_replacement:"mi",_reason:"overlong"},msa:{_replacement:"ms",_reason:"overlong"},mup:{_replacement:"raj",_reason:"macrolanguage"},mya:{_replacement:"my",_reason:"overlong"},nau:{_replacement:"na",_reason:"overlong"},nav:{_replacement:"nv",_reason:"overlong"},nbl:{_replacement:"nr",_reason:"overlong"},nde:{_replacement:"nd",_reason:"overlong"},ndo:{_replacement:"ng",_reason:"overlong"},nep:{_replacement:"ne",_reason:"overlong"},nld:{_replacement:"nl",_reason:"overlong"},nno:{_replacement:"nn",_reason:"overlong"},no:{_replacement:"nb",_reason:"legacy"},"no-BOKMAL":{_replacement:"nb",_reason:"deprecated"},"no-NYNORSK":{_replacement:"nn",_reason:"deprecated"},"no-bok":{_replacement:"nb",_reason:"deprecated"},"no-nyn":{_replacement:"nn",_reason:"deprecated"},nob:{_replacement:"nb",_reason:"overlong"},nor:{_replacement:"nb",_reason:"overlong"},npi:{_replacement:"ne",_reason:"macrolanguage" },nya:{_replacement:"ny",_reason:"overlong"},oci:{_replacement:"oc",_reason:"overlong"},ojg:{_replacement:"oj",_reason:"macrolanguage"},oji:{_replacement:"oj",_reason:"overlong"},ori:{_replacement:"or",_reason:"overlong"},orm:{_replacement:"om",_reason:"overlong"},ory:{_replacement:"or",_reason:"macrolanguage"},oss:{_replacement:"os",_reason:"overlong"},pan:{_replacement:"pa",_reason:"overlong"},pbu:{_replacement:"ps",_reason:"macrolanguage"},pes:{_replacement:"fa",_reason:"macrolanguage"},pli:{_replacement:"pi",_reason:"overlong"},plt:{_replacement:"mg",_reason:"macrolanguage"},pnb:{_replacement:"lah",_reason:"macrolanguage"},pol:{_replacement:"pl",_reason:"overlong"},por:{_replacement:"pt",_reason:"overlong"},pus:{_replacement:"ps",_reason:"overlong"},que:{_replacement:"qu",_reason:"overlong"},qxp:{_replacement:"qu",_reason:"macrolanguage"},rmy:{_replacement:"rom",_reason:"macrolanguage"},roh:{_replacement:"rm",_reason:"overlong"},ron:{_replacement:"ro",_reason:"overlong"},run:{_replacement:"rn",_reason:"overlong"},rus:{_replacement:"ru",_reason:"overlong"},sag:{_replacement:"sg",_reason:"overlong"},san:{_replacement:"sa",_reason:"overlong"},"sgn-BE-FR":{_replacement:"sfb",_reason:"deprecated"},"sgn-BE-NL":{_replacement:"vgt",_reason:"deprecated"},"sgn-CH-DE":{_replacement:"sgg",_reason:"deprecated"},sh:{_replacement:"sr-Latn",_reason:"legacy"},sin:{_replacement:"si",_reason:"overlong"},slk:{_replacement:"sk",_reason:"overlong"},slv:{_replacement:"sl",_reason:"overlong"},sme:{_replacement:"se",_reason:"overlong"},smo:{_replacement:"sm",_reason:"overlong"},sna:{_replacement :"sn",_reason:"overlong"},snd:{_replacement:"sd",_reason:"overlong"},som:{_replacement:"so",_reason:"overlong"},sot:{_replacement:"st",_reason:"overlong"},spa:{_replacement:"es",_reason:"overlong"},spy:{_replacement:"kln",_reason:"macrolanguage"},sqi:{_replacement:"sq",_reason:"overlong"},src:{_replacement:"sc",_reason:"macrolanguage"},srd:{_replacement:"sc",_reason:"overlong"},srp:{_replacement:"sr",_reason:"overlong"},ssw:{_replacement:"ss",_reason:"overlong"},sun:{_replacement:"su",_reason:"overlong"},swa:{_replacement:"sw",_reason:"overlong"},swe:{_replacement:"sv",_reason:"overlong"},swh:{_replacement:"sw",_reason:"macrolanguage"},tah:{_replacement:"ty",_reason:"overlong"},tam:{_replacement:"ta",_reason:"overlong"},tat:{_replacement:"tt",_reason:"overlong"},tel:{_replacement:"te",_reason:"overlong"},tgk:{_replacement:"tg",_reason:"overlong"},tgl:{_replacement:"fil",_reason:"overlong"},tha:{_replacement:"th",_reason:"overlong"},tir:{_replacement:"ti",_reason:"overlong"},tl:{_replacement:"fil",_reason:"legacy"},ton:{_replacement:"to",_reason:"overlong"},tsn:{_replacement:"tn",_reason:"overlong"},tso:{_replacement:"ts",_reason:"overlong"},ttq:{_replacement:"tmh",_reason:"macrolanguage"},tuk:{_replacement:"tk",_reason:"overlong"},tur:{_replacement:"tr",_reason:"overlong"},tw:{_replacement:"ak",_reason:"macrolanguage"},twi:{_replacement:"ak",_reason:"overlong"},uig:{_replacement:"ug",_reason:"overlong"},ukr:{_replacement:"uk",_reason:"overlong"},umu:{_replacement:"del",_reason:"macrolanguage"},urd:{_replacement:"ur",_reason:"overlong"},uzb:{_replacement:"uz",_reason:"overlong" },uzn:{_replacement:"uz",_reason:"macrolanguage"},ven:{_replacement:"ve",_reason:"overlong"},vie:{_replacement:"vi",_reason:"overlong"},vol:{_replacement:"vo",_reason:"overlong"},wln:{_replacement:"wa",_reason:"overlong"},wol:{_replacement:"wo",_reason:"overlong"},xho:{_replacement:"xh",_reason:"overlong"},xpe:{_replacement:"kpe",_reason:"macrolanguage"},xsl:{_replacement:"den",_reason:"macrolanguage"},ydd:{_replacement:"yi",_reason:"macrolanguage"},yid:{_replacement:"yi",_reason:"overlong"},yor:{_replacement:"yo",_reason:"overlong"},zai:{_replacement:"zap",_reason:"macrolanguage"},"zh-guoyu":{_replacement:"zh",_reason:"deprecated"},"zh-hakka":{_replacement:"hak",_reason:"deprecated"},"zh-min":{_reason:"deprecated"},"zh-min-nan":{_replacement:"nan",_reason:"deprecated"},"zh-xiang":{_replacement:"hsn",_reason:"deprecated"},zha:{_replacement:"za",_reason:"overlong"},zho:{_replacement:"zh",_reason:"overlong"},zsm:{_replacement:"ms",_reason:"macrolanguage"},zul:{_replacement:"zu",_reason:"overlong"},zyb:{_replacement:"za",_reason:"macrolanguage"}}}}},CK.SUPPORTED_REGION_FORMATS=["af","af-na","af-za","agq","agq-cm","ak","ak-gh","am","am-et","ar","ar-001","ar-ae","ar-bh","ar-dj","ar-dz","ar-eg","ar-eh","ar-er","ar-il","ar-iq","ar-jo","ar-km","ar-kw","ar-lb","ar-ly","ar-ma","ar-mr","ar-om","ar-ps","ar-qa","ar-sa","ar-sd","ar-so","ar-ss","ar-sy","ar-td","ar-tn","ar-ye","as","as-in","asa","asa-tz","az","az-cyrl","az-cyrl-az","az-latn","az-latn-az","bas","bas-cm","be","be-by","bem","bem-zm","bez","bez-tz","bg","bg-bg","bm","bm-ml","bn","bn-bd","bn-in","bo","bo-cn","bo-in","br","br-fr" ,"brx","brx-in","bs","bs-cyrl","bs-cyrl-ba","bs-latn","bs-latn-ba","ca","ca-ad","ca-es","ca-fr","ca-it","cgg","cgg-ug","chr","chr-us","ckb","cs","cs-cz","cy","cy-gb","da","da-dk","da-gl","dav","dav-ke","de","de-at","de-be","de-ch","de-de","de-li","de-lu","dje","dje-ne","dua","dua-cm","dyo","dyo-sn","dz","dz-bt","ebu","ebu-ke","ee","ee-gh","ee-tg","el","el-cy","el-gr","en","en-001","en-150","en-ad","en-ag","en-ai","en-al","en-as","en-at","en-au","en-ba","en-bb","en-be","en-bm","en-bs","en-bw","en-bz","en-ca","en-cc","en-ch","en-ck","en-cm","en-cx","en-cy","en-cz","en-de","en-dg","en-dk","en-dm","en-ee","en-er","en-es","en-fi","en-fj","en-fk","en-fm","en-fr","en-gb","en-gd","en-gg","en-gh","en-gi","en-gm","en-gu","en-gy","en-hk","en-hr","en-hu","en-ie","en-im","en-in","en-io","en-is","en-it","en-je","en-jm","en-ke","en-ki","en-kn","en-ky","en-lc","en-lr","en-ls","en-lt","en-lu","en-lv","en-me","en-mg","en-mh","en-mo","en-mp","en-ms","en-mt","en-mu","en-mw","en-na","en-nf","en-ng","en-nl","en-no","en-nr","en-nu","en-nz","en-pg","en-ph","en-pk","en-pl","en-pn","en-pr","en-pt","en-pw","en-ro","en-ru","en-rw","en-sb","en-sc","en-sd","en-se","en-sg","en-sh","en-si","en-sk","en-sl","en-ss","en-sx","en-sz","en-tc","en-tk","en-to","en-tr","en-tt","en-tv","en-tz","en-ug","en-um","en-us","en-us-posix","en-vc","en-vg","en-vi","en-vu","en-ws","en-za","en-zm","en-zw","eo","es","es-419","es-ar","es-bo","es-cl","es-co","es-cr","es-cu","es-do","es-ea","es-ec","es-es","es-gq","es-gt","es-hn","es-ic","es-mx","es-ni","es-pa","es-pe","es-ph","es-pr","es-py","es-sv","es-us","es-uy","es-ve","et","et-ee" ,"eu","eu-es","ewo","ewo-cm","fa","fa-af","fa-ir","ff","ff-sn","fi","fi-fi","fil","fil-ph","fo","fo-fo","fr","fr-be","fr-bf","fr-bi","fr-bj","fr-bl","fr-ca","fr-cd","fr-cf","fr-cg","fr-ch","fr-ci","fr-cm","fr-dj","fr-dz","fr-fr","fr-ga","fr-gf","fr-gn","fr-gp","fr-gq","fr-ht","fr-km","fr-lu","fr-ma","fr-mc","fr-mf","fr-mg","fr-ml","fr-mq","fr-mr","fr-mu","fr-nc","fr-ne","fr-pf","fr-pm","fr-re","fr-rw","fr-sc","fr-sn","fr-sy","fr-td","fr-tg","fr-tn","fr-vu","fr-wf","fr-yt","ga","ga-ie","gl","gl-es","gsw","gsw-ch","gsw-li","gu","gu-in","guz","guz-ke","gv","gv-im","ha","ha-latn","ha-latn-gh","ha-latn-ne","ha-latn-ng","haw","haw-us","he","he-il","hi","hi-in","hr","hr-ba","hr-hr","hu","hu-hu","hy","hy-am","id","id-id","ig","ig-ng","ii","ii-cn","is","is-is","it","it-ch","it-it","it-sm","iu","iu-cans","iu-cans-ca","ja","ja-jp","jgo","jgo-cm","jmc","jmc-tz","ka","ka-ge","kab","kab-dz","kam","kam-ke","kde","kde-tz","kea","kea-cv","khq","khq-ml","ki","ki-ke","kk","kk-cyrl","kk-cyrl-kz","kkj","kkj-cm","kl","kl-gl","kln","kln-ke","km","km-kh","kn","kn-in","ko","ko-kp","ko-kr","kok","kok-in","ks","ks-arab","ks-arab-in","ksb","ksb-tz","ksf","ksf-cm","kw","kw-gb","ky","ky-cyrl","ky-cyrl-kg","lag","lag-tz","lg","lg-ug","lkt","lkt-us","ln","ln-ao","ln-cd","ln-cf","ln-cg","lo","lo-la","lt","lt-lt","lu","lu-cd","luo","luo-ke","luy","luy-ke","lv","lv-lv","mas","mas-ke","mas-tz","mer","mer-ke","mfe","mfe-mu","mg","mg-mg","mgh","mgh-mz","mgo","mgo-cm","mk","mk-mk","ml","ml-in","mn","mn-cyrl","mn-cyrl-mn","mr","mr-in","ms","ms-arab","ms-arab-bn","ms-arab-my","ms-latn","ms-latn-bn","ms-latn-my","ms-latn-sg" ,"mt","mt-mt","mua","mua-cm","my","my-mm","naq","naq-na","nb","nb-no","nb-sj","nd","nd-zw","ne","ne-in","ne-np","nl","nl-aw","nl-be","nl-bq","nl-cw","nl-nl","nl-sr","nl-sx","nmg","nmg-cm","nn","nn-no","nnh","nnh-cm","nus","nus-sd","nyn","nyn-ug","om","om-et","om-ke","or","or-in","pa","pa-arab","pa-arab-pk","pa-guru","pa-guru-in","pl","pl-pl","ps","ps-af","pt","pt-ao","pt-br","pt-cv","pt-gw","pt-mo","pt-mz","pt-pt","pt-st","pt-tl","rm","rm-ch","rn","rn-bi","ro","ro-md","ro-ro","rof","rof-tz","ru","ru-by","ru-kg","ru-kz","ru-md","ru-ru","ru-ua","rw","rw-rw","rwk","rwk-tz","saq","saq-ke","sbp","sbp-tz","seh","seh-mz","ses","ses-ml","sg","sg-cf","shi","shi-latn","shi-latn-ma","shi-tfng","shi-tfng-ma","si","si-lk","sk","sk-sk","sl","sl-si","sn","sn-zw","so","so-dj","so-et","so-ke","so-so","sq","sq-al","sq-mk","sq-xk","sr","sr-cyrl","sr-cyrl-ba","sr-cyrl-me","sr-cyrl-rs","sr-cyrl-xk","sr-latn","sr-latn-ba","sr-latn-me","sr-latn-rs","sr-latn-xk","sv","sv-ax","sv-fi","sv-se","sw","sw-ke","sw-tz","sw-ug","swc","swc-cd","ta","ta-in","ta-lk","ta-my","ta-sg","te","te-in","teo","teo-ke","teo-ug","tg","tg-cyrl","tg-cyrl-tj","th","th-th","ti","ti-er","ti-et","tk","tk-latn","tk-latn-tm","to","to-to","tr","tr-cy","tr-tr","twq","twq-ne","tzm","tzm-latn","tzm-latn-ma","ug","ug-arab","ug-arab-cn","uk","uk-ua","ur","ur-in","ur-pk","uz","uz-arab","uz-arab-af","uz-cyrl","uz-cyrl-uz","uz-latn","uz-latn-uz","vai","vai-latn","vai-latn-lr","vai-vaii","vai-vaii-lr","vi","vi-vn","vun","vun-tz","xog","xog-ug","yav","yav-cm","yo","yo-bj","yo-ng","zgh","zgh-ma","zh","zh-hans","zh-hans-cn","zh-hans-hk","zh-hans-mo" ,"zh-hans-sg","zh-hant","zh-hant-hk","zh-hant-mo","zh-hant-tw","zu","zu-za"],CW.INVALID_LAYOUT_QUALITY=-2,CW.BAD_LAYOUT_QUALITY=-1,CW.OKAY_LAYOUT_QUALITY=0,CW.GOOD_LAYOUT_QUALITY=1,CW.PERFECT_LAYOUT_QUALITY=2,CW.PickerLayout=SC.Object.extend({owner:null,renderDelegateName:"panelRenderDelegate",theme:null,themeBinding:SC.Binding.oneWay("*owner.renderTheme"),controlSize:null,controlSizeBinding:SC.Binding.oneWay("*owner.controlSize"),renderDelegate:function(){var e=this.get("theme");return e?e[this.get("renderDelegateName")]:null}.property("theme","renderDelegateName"),renderDelegateProxy:function(){return this}.property().cacheable(),pointAtRectangle:{left:0,top:0,width:0,height:0},pointAtRectangleBinding:SC.Binding.oneWay("*owner.pointAtRectangle"),pointAtPoint:function(){var e=this.get("pointAtRectangle");return{left:e.left+e.width/2,top:e.top+e.height/2}}.property("pointAtRectangle").cacheable(),availableSpace:{width:0,height:0},availableSpaceBinding:SC.Binding.oneWay("*owner.availableSpace"),desiredSize:{width:320,height:400},desiredSizeBinding:SC.Binding.oneWay("*owner.desiredSize"),minimumSize:{width:320,height:200},minimumSizeBinding:SC.Binding.oneWay("*owner.minimumSize"),layout:{top:0,left:0,width:100,height:100},layoutQuality:CW.INVALID_LAYOUT_QUALITY,layoutNeedsUpdate:NO,reasonsForRelayout:SC.CoreSet.create(),init:function(){arguments.callee.base.apply(this,arguments),this._reasonsForRelayout=SC.CoreSet.create()},scheduleRedraw:function(){if(!this.get("owner"))return;this.get("owner").pickerLayoutNeedsRedraw(this)},layoutDidChange:function(){var e=this.get("layout") ,t=this._previousLayout||{};(e.left!==t.left||e.top!==t.top||e.width!==t.width||e.height!==t.height)&&this.scheduleRedraw(),this._previousLayout=e}.observes("layout"),scheduleLayout:function(e){this.set("layoutNeedsUpdate",YES);if(!e)return;typeof e=="string"&&(e=[e]),this._reasonsForRelayout.addEach(e)},computeLayout:function(){this.set("reasonsForRelayout",this._reasonsForRelayout),this._reasonsForRelayout=SC.CoreSet.create(),this.set("layoutNeedsUpdate",NO)},computeLayoutIfNeeded:function(){if(!this.get("layoutNeedsUpdate"))return;this.computeLayout()},_scpl_layoutNeedsUpdateDidChange:function(){if(!this.get("layoutNeedsUpdate"))return;var e=this.get("owner");if(!e)return;e.pickerLayoutNeedsUpdate(this)}.observes("layoutNeedsUpdate"),render:function(e){var t=this.get("renderDelegate");t&&(e.addClass(t.className),e.addClass(this.get("theme").classNames),t.render(this.get("renderDelegateProxy"),e))},update:function(e){var t=this.get("renderDelegate");t&&(e.addClass(t.className),e.addClass(this.get("theme").classNames),t.update(this.get("renderDelegateProxy"),e))},isBetterThanLayout:function(e){return this.get("layoutQuality")>e.get("layoutQuality")}}),CW.LEFT_SIDE="left",CW.RIGHT_SIDE="right",CW.TOP_SIDE="top",CW.BOTTOM_SIDE="bottom",CW.RELAYOUT_FOR_WINDOW="window",CW.RELAYOUT_FOR_TARGET="target",CW.RELAYOUT_FOR_DESIRED_SIZE="desired-size",CW.RELAYOUT_FOR_MINIMUM_SIZE="minimum-size",CW.PickerLayout.OnSide=CW.PickerLayout.extend({renderDelegateName:"cwPickerBackgroundRenderDelegate",pointAtSide:CW.RIGHT_SIDE,requiresSlices:NO,pointAtPoint:function(){var e=this.get("pointAtRectangle" ),t=this.get("pointAtSide"),n,r;return t===CW.RIGHT_SIDE||t===CW.LEFT_SIDE?(r=Math.round(e.top+e.height/2),n=e.left,t===CW.RIGHT_SIDE&&(n+=e.width)):(n=Math.round(e.left+e.width/2),r=e.top,t===CW.BOTTOM_SIDE&&(r+=e.height)),{left:n,top:r}}.property("pointAtSide","pointAtRectangle"),distanceFromRectangle:SC.propertyFromRenderDelegate("pickerDistanceFromRectangle",10),distanceFromEdge:SC.propertyFromRenderDelegate("pickerDistanceFromEdge",15),pointerCanMove:SC.propertyFromRenderDelegate("pointerCanMove",YES),validPointerLayouts:SC.propertyFromRenderDelegate("validPointerLayouts",[]),pointerDistanceFromTop:function(){return this.get("pointAtPoint").top-this.get("layout").top}.property("layout").cacheable(),pointerDistanceFromBottom:function(){var e=this.get("layout");return e.top+e.height-this.get("pointAtPoint").top}.property("layout").cacheable(),pointerDistanceFromLeft:function(){return this.get("pointAtPoint").left-this.get("layout").left}.property("layout").cacheable(),pointerDistanceFromRight:function(){var e=this.get("layout");return e.left+e.width-this.get("pointAtPoint").left}.property("layout").cacheable(),pointerLayout:null,layoutPropertyDidChange:function(e,t){t==="availableSpace"?this.scheduleLayout(CW.RELAYOUT_FOR_WINDOW):t==="pointAtPoint"?this.scheduleLayout(CW.RELAYOUT_FOR_TARGET):t==="desiredSize"?this.scheduleLayout(CW.RELAYOUT_FOR_DESIRED_SIZE):t==="minimumSize"?this.scheduleLayout(CW.RELAYOUT_FOR_MINIMUM_SIZE):(t==="validPointerLayouts"||t==="pointerCanMove")&&this.scheduleLayout(CW.RELAYOUT_FOR_TARGET)}.observes("availableSpace","pointAtPoint","desiredSize" ,"minimumSize","validPointerLayouts","pointerCanMove"),pointerLayoutPropertyDidChange:function(){this.scheduleRedraw()}.observes("pointerDistanceFromLeft","pointerDistanceFromRight","pointerDistanceFromBottom","pointerDistanceFromTop"),t_pointAtPoint:function(){var e=this.get("pointAtPoint"),t=this.get("pointAtSide");return t===CW.LEFT_SIDE||t===CW.RIGHT_SIDE?e:{left:e.top,top:e.left}}.property("pointAtPoint","pointAtSide"),t_validPointerLayouts:function(){var e=this.get("validPointerLayouts"),t,n=e.length,r,i,s=this.get("pointAtSide"),o=[];for(t=0;ti&&(e.top=i-e.height),e.topt-c&&(f=t-c),h!=null&&ft+d&&(f=t+d-e.height),l=Math.abs(f-e.top);if(o==null||ln&&(e.height=n-e.top)},resizeForPointer:function(){var e=this.get("t_layout"),t=this.get("t_pointAtPoint").top,n=this.get("t_validPointerLayouts"),r=n.length,i,s,o,u,a=null,f,l;o=null;for(i=0;it+d&&(f=t+d-e.top),l=Math.abs(f-e.height);if(o==null||li&&(e.width=i-e.left);else if(e.lefta-f)e=CW.INVALID_LAYOUT_QUALITY;else if(t.top+t.heightr.height||t.left+t.width>r.width)e=CW.BAD_LAYOUT_QUALITY;else if(t.topr.height-i||t.left+t.width>r.width-i)e=CW.OKAY_LAYOUT_QUALITY;else if(t.heightn)return YES;if(t=t.x&&e.pageY>=t.y&&e.pageX<=t.x+t.width&&e.pageY<=t.y+t.height?NO:(this.dismiss(),YES)},click:function(e){return this.modalPaneDidClick(e)},displayProperties:"currentLayout".w(),pickerLayoutNeedsRedraw:function(e){if(e!==this.get("currentLayout"))return;this.displayDidChange()},render:function(e){e=e.begin("div").addClass("_scpv_background");var t=this.get("currentLayout");t&&t.render(e),this._scpp_lastRenderedLayout=t,e=e.end(),this.get("renderDelegate")&&this.get("renderDelegate").render(this.get("renderDelegateProxy"),e)},update:function(e){var t=e.find("._scpv_background"),n=t[0];if(!n)return;var r=this.get("currentLayout");if(!r)return;t.resetClassNames().addClass("_scpv_background");if(this._scpp_lastRenderedLayout!==r){var i=SC.RenderContext (n);r.render(i),i.update(),this._scpp_lastRenderedLayout=r}else r.update(t);this.get("renderDelegate")&&this.get("renderDelegate").update(this.get("renderDelegateProxy"),e)}}),CW.MenuPane=CW.PickerPane.extend({desiredSize:{width:100,height:100},minimumSize:{width:100,height:0},classNames:["cw-menu"],modalPane:SC.ModalPane,ariaRole:"menu",items:[],controlSize:SC.REGULAR_CONTROL_SIZE,minimumCroppedMenuHeight:SC.propertyFromRenderDelegate("minimumCroppedHeight"),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,localize:YES,acceptsMenuPane:YES,isContextMenuEnabled:NO,layouts:[CW.PickerLayout.ON_BOTTOM,CW.PickerLayout.ON_TOP],popup:function(e,t){this.beginPropertyChanges(),this.adjustDesiredSize("height",this.get("menuHeight"));var n=Math.min(this.get("menuHeight"),this.get("minimumCroppedMenuHeight"));this.adjustMinimumSize("height",n),arguments.callee.base.apply(this,arguments),this.set("defaultResponder",this),this.endPropertyChanges()},remove:function(){var e=this.get("parentMenu");return this.set("currentMenuItem",null),this.closeOpenMenus(),this.resignMenuPane(),e&&e.becomeMenuPane(),arguments.callee.base.apply(this,arguments)},itemTitleKey:"title",itemIsEnabledKey:"isEnabled",itemValueKey:"value",itemIconKey:"icon",itemHeightKey:"height",itemSubMenuKey:"subMenu",itemSeparatorKey :"separator",itemTargetKey:"target",itemActionKey:"action",itemCheckboxKey:"checkbox",itemShortCutKey:"shortcut",itemKeyEquivalentKey:"keyEquivalent",itemDisableMenuFlashKey:"disableMenuFlash",itemLayerIdKey:"layerId",itemExampleViewKey:"exampleView",menuItemKeys:["itemTitleKey","itemValueKey","itemIsEnabledKey","itemIconKey","itemSeparatorKey","itemActionKey","itemCheckboxKey","itemShortCutKey","itemHeightKey","itemSubMenuKey","itemKeyEquivalentKey","itemTargetKey","itemLayerIdKey"],isModal:YES,_menuView:null,init:function(){return arguments.callee.base.apply(this,arguments)},displayProperties:["controlSize"],renderStyle:"menu",renderDelegateName:"cwMenuRenderDelegate",createChildViews:function(){var e,t,n;return e=this.createChildView(SC.MenuScrollView,{borderStyle:SC.BORDER_NONE,controlSize:this.get("controlSize")}),t=this._menuView=SC.View.create({parentViewDidResize:function(){this.notifyPropertyChange("frame")},viewDidResize:function(){}}),n=this.get("menuItemViews"),t.set("layout",{top:0,left:0,height:this.get("menuHeight")}),t.replaceAllChildren(n),e.set("contentView",t),this.childViews=[e],this},paneDidAttach:function(){var e=this.rootResponder=SC.RootResponder.responder;return e.panes.add(this),this.set("currentWindowSize",e.computeWindowSize()),this.set("isPaneAttached",YES),this.parentViewDidChange(),this._notifyDidAppendToDocument(),this.becomeMenuPane(),this},becomeMenuPane:function(){return this.rootResponder&&this.rootResponder.makeMenuPane(this),this},resignMenuPane:function(){return this.rootResponder&&this.rootResponder.makeMenuPane(null),this},menuItemViews :function(){return this.createMenuItemViews()}.property("displayItems","controlSize").cacheable(),createMenuItemViews:function(){var e=[],t=this.get("displayItems"),n=this.get("exampleView"),r,i,s,o,u,a,f,l,c,h,p,d,v,m,g,y,b,w,E;if(!t)return e;u=this.get("itemHeightKey"),a=this.get("itemSeparatorKey"),v=this.get("itemExampleViewKey"),f=this.get("itemHeight"),p=this.get("itemKeyEquivalentKey"),l=this.get("itemSeparatorHeight"),b=this.get("itemLayerIdKey"),h=Math.floor(this.get("menuHeightPadding")/2),c=h,largestItemHeight=0,g=this.menuItemKeys.map(CW._menu_fetchKeys,this),E=t.get("length");for(y=0;y=0){if(t[i].get("isEnabled")){this.set("currentMenuItem",t[i]),t[i].becomeFirstResponder();break}i--}return YES},moveDown:function(){var e=this.get("currentMenuItem"),t=this.get("menuItemViews"),n=t.get("length"),r,i,s;if(!e)s=0;else{r=e.getPath("content.contentIndex");if(r===n)return YES;s=r+1}while(sr.width?n.width:r.width)+55;i=i%2?i-1:i,this.adjustDesiredSize({width:Math.max(this.get("minimumSize").width,i)})},showCalloutInContainer:function(e){this._hideOverflow(),this.appendTo(e)},valuesObserver:function(){this.recomputeDesiredSize()}.observes("detailValue","titleValue","layer"),modalPaneDidClick:function(){return NO}}),CW.ErrorCalloutPicker=CW.PickerPane.extend({themeName:"errorCallout",renderStyle:"errorCallout",minimumSize:{width:120,height:29},errorText:"Please fill in required info",layouts:["onTop","onBottom"],acceptsFirstResponder:NO,acceptsKeyPane:NO,isModal:NO,contentView:SC.LabelView.extend(SC.AutoResize,{classNames:["error-picker-label"],valueBinding:".parentView.errorText",measuredSizeDidChange:function(){var e=this.get("measuredSize");e&&e.width&&e.height&&this.parentView.set("desiredSize",{width:e.width,height:e.height})}.observes("measuredSize")})}),CW.SelectMenuLayout={Aligned:CW.PickerLayout.extend({renderDelegateName:"cwPickerBackgroundRenderDelegate",distanceFromEdge:SC.propertyFromRenderDelegate("distanceFromEdge",15),desiredPosition:{left:0,top:0 },desiredPositionBinding:SC.Binding.oneWay("*owner.desiredPosition"),layoutPropertyDidChange:function(e,t){t==="availableSpace"?this.scheduleLayout(CW.RELAYOUT_FOR_WINDOW):t==="pointAtPoint"?this.scheduleLayout(CW.RELAYOUT_FOR_TARGET):t==="desiredSize"?this.scheduleLayout(CW.RELAYOUT_FOR_DESIRED_SIZE):t==="minimumSize"&&this.scheduleLayout(CW.RELAYOUT_FOR_MINIMUM_SIZE)}.observes("availableSpace","desiredSize","minimumSize","desiredPosition"),computeLayout:function(){var e=this.get("desiredPosition"),t=this.get("desiredSize"),n=this.get("minimumSize"),r=this.get("availableSpace"),i=this.get("distanceFromEdge"),s={top:e.top,left:e.left,width:t.width,height:t.height};s.topr.height-i&&(s.height=r.height-i-s.top),s.heightr.height-i&&(s.top=r.height-i-s.height),s.leftr.width-i&&(s.left=r.width-i-s.width),s.left400&&(n&&t.get("mouseHasEntered")&&this._mouseDownTimestamp?n.performAction()||t.remove():t.remove())),this._mouseDownTimestamp=undefined,YES},keyDown:function(e){return e.which==13?(this.showMenu(),YES):arguments.callee.base.apply(this,arguments)},touchStart:function(e){return this.mouseDown(e)},touchEnd:function(e){return this.mouseUp(e)}}),CW.PopupButtonView.InstantiateMenuTask=SC.Task.extend({popupButton:null,run:function(e){this.popupButton.setupMenu()}}),CW.SelectView=CW.PopupButtonView.extend({themeName:"dropdown",renderDelegateName:"cwSelectRenderDelegate",items:null,itemsBindingDefault:SC.Binding.multiple(),itemTitleKey:"title",itemSortKey:null,itemValueKey:"value",itemIconKey:"icon",itemSeparatorKey:"separator",itemIsEnabledKey :"isEnabled",menu:CW.SelectViewMenuPane,selectedItem:null,selectedItemBinding:"*menu.rootMenu.selectedItem",supportsFocusRing:YES,init:function(){arguments.callee.base.apply(this,arguments),this._scsv_updateTitle(),this._scsv_valueDidChange()},_scsv_getValueForMenuItem:function(e){var t=this.get("itemValueKey")||"value";return SC.typeOf(e)===SC.T_STRING?e:e.get?e.get(t):e[t]},_scsv_selectedItemDidChange:function(){var e=this.get("selectedItem"),t=this._scsv_lastSelection,n=this.get("itemTitleKey")||"title",r=this.get("itemValueKey")||"value";e&&this.setIfChanged("value",this._scsv_getValueForMenuItem(e)),t&&t.addObserver&&e!==t&&(t.removeObserver(n,this,this._scsv_selectedItemPropertyDidChange),t.removeObserver(r,this,this._scsv_selectedItemPropertyDidChange)),e&&e.addObserver&&e!==t&&(e.addObserver(n,this,this._scsv_selectedItemPropertyDidChange),e.addObserver(r,this,this._scsv_selectedItemPropertyDidChange)),this._scsv_lastSelection=e}.observes("selectedItem"),_scsv_selectedItemPropertyDidChange:function(e){this._scsv_updateTitle(),this.set("value",e.get(this.get("itemValueKey")||"value"))},defaultTitle:"",_scsv_updateTitle:function(){var e=this.get("selectedItem"),t,n;e?e.get?(t=e.get(this.get("itemTitleKey")||"title"),n=e.get(this.get("itemIconKey")||"icon")):SC.typeOf(e)==SC.T_HASH?(t=e[this.get("itemTitleKey")||"title"],n=e[this.get("itemIconKey")||"icon"]):t=e:t=this.get("defaultTitle"),t&&this.set("title",t),this.set("icon",n)}.observes("selectedItem"),_scsv_valueDidChange:function(){var e=this.get("value");if(!this.get("items"))return;var t=this.get("items"),n=t.get? t.get("length"):t.length,r,i;for(r=0;r1?"/system/cloudos/1812Project43/cloudkit/foundation/1812Project43/en-us/source/resources/images/no_photo@2x.png":"/system/cloudos/1812Project43/cloudkit/foundation/1812Project43/en-us/source/resources/images/no_photo.png",photoChanged:NO,meCardUrl:function(){var e=CK.servicesController.getServiceUrlFor("contacts")+"/co/mecard/";return e}.property(),meCard:null,meCardRequirementSatisfied:NO,imgLoadError:NO,shouldCreateMeCard:NO,getMeCard:function(e){if(!CK.servicesController.getServiceInfoFor("contacts")){SC.debug("meCardController: not requesting me-card since contacts is disabled."),this.set("meCardRequirementSatisfied",YES),e instanceof Function&&e(1);return}var t=this.get("meCardUrl"),n=CK.Request.getUrl(t,null),r=this;n.set("reportRequest",YES),n.notify(200,this,function(t){var n=t.get("body");return typeof n=="string"&&(n=JSON.parse(n)),!n||!n.contacts?(SC.debug("no me-card is set"),r.set("shouldCreateMeCard",YES),r.set("meCard",{})):(SC.debug("meCardController: me-card received"),r.set("meCard",n.contacts[0])),e instanceof Function&&e(0),r.set("meCardRequirementSatisfied",YES),YES}),n.notify(0,this,function(t){SC.debug("meCardController: problem receiving me-card");if(CloudOS.getEnvironment()==="DEMO"){SC.debug("meCardController: using appleseed me-card in DEMO");var n="/system/cloudos/1812Project43/cloudkit/foundation/1812Project43/en-us/source/resources/images/appleseed_small.jpg" ;r.set("meCard",{photo:{url:n,crop:{height:165,width:165,y:22,x:11}}})}else r.set("shouldCreateMeCard",YES);return e instanceof Function&&e(1),r.set("meCardRequirementSatisfied",YES),YES}),SC.debug("Sending me card GET request to %@",t),n.send()},storeMeCard:function(e,t){var n=this.get("meCard");if(!CK.servicesController.getServiceInfoFor("contacts")){SC.debug("meCardController: not storing me-card since contacts is disabled.");return}var r=this.get("shouldCreateMeCard"),i=r?"POST":"PUT",s=this.get("meCardUrl")+"?method="+i,o=CK.Request.postUrl(s,null),u=this,a,f;o.set("isJSON",YES),o.set("reportRequest",YES),a=n?n:{};if(e)for(f in e){if(!e.hasOwnProperty(f))continue;a[f]=e[f]}o.notify(200,this,function(e){var n=e.get("body");return n.contacts?(u.set("shouldCreateMeCard",NO),SC.debug("me-card received"),this.set("meCard",n.contacts[0])):SC.debug("no me-card is set"),t instanceof Function&&t(0),YES}),o.notify(0,this,function(e){return SC.debug("problem storing me-card"),t instanceof Function&&t(1),YES});if(r){a.contactId=CW.upperCaseUUID();var l=CloudOS.authController,c=l.get("user"),h=c.get("isPrimaryAppleIdTypeEmail"),p=c.get("isPrimaryAppleIdTypePhoneNumber"),d=c.get("displayablePrimaryAppleId"),v=[{field:d}];a.firstName=c.get("firstName"),a.lastName=c.get("lastName"),h?(v[0].label="home",a.emailAddresses=v):p&&(v[0].label="mobile",a.phones=v)}var m={contacts:[a]};SC.debug("Sending me card GET request to %@",s),o.send(m)},completePhotoPicker:function(e){var t={url:e.photoUrl,crop:e.photoCrop,signature:e.photoSignature};this.set("photo",t),this.set("photoChanged",YES)},meCardPosted :function(){this.getMeCard()},photoUrl:function(e,t){if(t===undefined)return this.getPath("photo.url")||null;var n=this.get("photo");n.url=t}.property("photo"),photoCrop:function(e,t){if(t===undefined)return this.getPath("photo.crop")||null;var n=this.get("photo");n.crop=t}.property("photo"),photoSignature:function(e,t){if(t===undefined)return this.getPath("photo.signature");var n=this.get("photo");n.signature=t}.property("photo"),photo:function(e,t){if(t===undefined)return this.getPath("meCard.photo");var n=this.get("meCard");n&&(n.photo=t)}.property("meCard"),isPhotoUrlValid:function(){return!this.get("imgLoadError")&&!!this.get("photoUrl")}.property("photoUrl","imgLoadError"),deletePhoto:function(){this.set("photo",null),this.set("photoChanged",YES)},reset:function(){this.set("meCard",null),this.set("meCardRequirementSatisfied",NO)}}),CK.StatsController=SC.Object.extend({_statsQueue:[],statSessionId:null,STAT_COALESCING_WINDOW:8e3,includedParams:{},recordStat:function(e,t,n){var r,i,s=this.get("includedParams"),o=e+t,u=window.CloudOS&&!CloudOS.isCloudOSClient,a=u&&CloudOS.getClientId?CloudOS.getClientId():this.get("statSessionId");r={statName:o,statSessionId:a,hostname:window.location.hostname,buildNumber:SC.buildNumber,platform:window.CloudOSBootstrap&&CloudOSBootstrap.isOnSupportedMobile?"mobile":"desktop"};if(!n||!n.appName)r.appName=e;for(var f in s)r[f]=s[f];i=SC.merge(n,r);try{SC.json.encode(i)}catch(l){CW.fatalError("'%@' stat from '%@' cannot be encoded, possibly a circular reference.".fmt(t,e))}this._statsQueue.push(i),this.invokeOnceLater(this.sendStats,this.STAT_COALESCING_WINDOW )},_benchmarkStats:{},getStat:function(e,t){return this._getBenchmark(e,t)},beginStat:function(e,t,n){if(this.getStat(e,t)){SC.warn("%@ stat already exists for %@",t,e);return}n=n||{},n._startTime=SC.getCurrentTimeForPerformance(),this._recordBenchmark(e,t,n)},endStat:function(e,t,n,r){var i=this.getStat(e,t),s,o,u;r&&(s=r.durationKeyName,o=r.includeLocationAndLocale,u=r.includeLocationUrlDetails);if(!i){SC.warn("%@ stat does not exist for %@",t,e);return}s=s?s:"duration",i[s]=SC.getCurrentTimeForPerformance()-i._startTime,delete i._startTime;var a=SC.merge(n,i);o&&(a=this.includeLocationAndBrowserLocale(a)),u&&(a=this.includeLocationUrlDetails(a)),this.recordStat(e,t,a),this._clearBenchmark(e,t)},cancelStat:function(e,t){var n=this._getBenchmark(e,t);n&&this._clearBenchmark(e,t)},_getBenchmark:function(e,t){var n=this._benchmarkStats;if(!n[e]||!n[e][t])return;return n[e][t]},_clearBenchmark:function(e,t){var n=this._benchmarkStats;delete n[e][t]},_recordBenchmark:function(e,t,n){var r=this._benchmarkStats;r[e]||(r[e]={}),r[e][t]=n},endAllBenchmarkStats:function(e){var t=this._benchmarkStats,n,r,i;for(n in t){if(e&&n!==e)continue;for(r in t[n])i=t[n][r],this.endStat(n,r,i)}},sendStats:function(e,t){var n=this._statsQueue;if(!n||n.length===0)return;var r=CW.Request.postUrl("/reportStats");r.set("addressPrefix","https://feedbackws.%{currentDomain}".fmt({currentDomain:COS.authController.get("currentDomain")})),r.set("useCrossDomain",YES),r.set("isJSON",YES),r.set("attachIdentifyingHeaders",NO),r.set("isAsynchronous",e===undefined?YES:e),r.set("timeout",null),r.header("Content-Type" ,"text/plain"),r.notify(200,this,function(e){return SC.info("Successfully sent stats to feedbackws"),t&&t.call(undefined,e),YES}),r.notify(0,this,function(e){return SC.warn("Error sending stats to feedbackws"),t&&t.call(undefined,e),YES}),SC.debug("Sending stats to feedbackws"),r.send({stats:n}),this._statsQueue=[]},flushStats:function(){this.endAllBenchmarkStats(),this.sendStats(NO)},recordLocationStat:function(e,t,n){n||(n={}),this.recordStat(e,t,this.includeLocationAndBrowserLocale(n))},includeLocationAndBrowserLocale:function(e){var t=window.COS;if(!t)return SC.warn("includeLocationAndBrowserLocale() is only available to icloud authenticated applications."),e;var n=t.authController.get("requestInfo");n&&(e.region=n.region,e.country=n.country),e.time=(new Date).toString()+" ("+Math.floor(new Date)+")";var r=(new Date).toString().match(/.*?\((.*?)\).*/);return r&&r.length===2&&(e.timezone=r[1]),e.browserLocale=(navigator.language||navigator.browserLanguage).toLowerCase(),e},recordLocationAndWindowUrlStat:function(e,t,n){n||(n={});var r=window.CloudOSBootstrap;if(!r){SC.warn("recordLocationAndWindowUrlStat() is only available to stats originating from CloudOS app.");return}this.recordStat(e,t,this.includeLocationUrlDetails(this.includeLocationAndBrowserLocale(n)))},recordWindowUrlStat:function(e,t,n){n||(n={});var r=window.CloudOSBootstrap;if(!r){SC.warn("recordWindowUrlStat() is only available to stats originating from CloudOS app.");return}this.recordStat(e,t,this.includeLocationAndBrowserLocale(n))},includeLocationUrlDetails:function(e){if(!e)return;return window. CloudOSBootstrap&&(CloudOSBootstrap.didLoadWithShareURL&&(e.isShareUrl=!0),CloudOSBootstrap.isTermsAndConditionUrl&&(e.isTermsAndConditionUrl=!0),CloudOSBootstrap.hasPostLoginRedirectUrl&&(e.hasPostLoginRedirectUrl=!0)),e}}),CK.CloudOSGetterSupport={getUser:function(){var e=this.get("appInstance"),t=e?e._cloudOSState:null;if(!e||!t)return window.COS&&COS.authController?COS.authController.get("user"):null;var n=t.authBag;return!e._cos_user_cache&&n?(SC.debug("Creating local CK.User object"),e._cos_user_cache=CK.User.createFromAuthBag(n)):n||SC.warn("Cannot getUser() before authenticating."),e._cos_user_cache},isUserNotAuthenticated:function(){if(window.COS&&COS.authController)return COS.authController.get("isNotAuthenticated");if(CK.currentApplication){var e=this.get("appInstance");if(e&&e._cloudOSState)return e._cloudOSState.userAuthenticationState===CK.AuthenticationStateEnum.NOT_AUTHENTICATED}return undefined},isUserPartiallyAuthenticated:function(){if(window.COS&&COS.authController)return COS.authController.get("isPartiallyAuthenticated");if(CK.currentApplication){var e=this.get("appInstance");if(e&&e._cloudOSState)return e._cloudOSState.userAuthenticationState===CK.AuthenticationStateEnum.PARTIALLY_AUTHENTICATED_HSA}return undefined},isUserAuthenticated:function(){if(window.COS&&COS.authController)return COS.authController.get("isAuthenticated");if(CK.currentApplication){var e=this.get("appInstance");if(e&&e._cloudOSState)return e._cloudOSState.userAuthenticationState===CK.AuthenticationStateEnum.AUTHENTICATED}return undefined},userIsAuthenticated:function(){return this. isUserAuthenticated()},getAccountPreferences:function(){if(window.COS&&COS.authController)return COS.authController.accountPreferences();if(CK.currentApplication){var e=this.get("appInstance");if(!e._cos_account_preferences_cache){SC.debug("Creating local CK.AccountPreferences object");var t=e._cloudOSState.accountPreferences;if(!t){SC.warn("Cannot getAccountPreferences() before authenticating.");return}e._cos_account_preferences_cache=CK.AccountPreferences.create(t)}return e._cos_account_preferences_cache}return null},getAppInfo:function(e){var t=this.getAppInfoList();for(var n=0;ni?1:0}),i=r.length,s=Math.min(this._cacheSize-this._cacheSizeLowWaterMark,i),o=0;for(var u=0;uthis._cacheSizeHighWaterMark&&this._containerPurge()},containerGet:function(e){return this._cacheLRU[e]=this._cacheLRUCounter++, this._cache[e]},containerFlush:function(e){CW.fatalError("Developer must provide a containerFlush method")}},CK.MicroResourceContainer.LoadStatus={NOT_LOADED:undefined,PENDING:"pending",LOADED:"loaded",FAILED:"failed"},CK.MicroResourceContainerServerError=SC.Object.extend({message:"",failedInputs:[]}),CK.RequestDelegate={isCKRequestDelegate:YES,getUrlForServiceName:function(e){return null},didReceiveSpecialResponse:function(e,t,n){}},CK.CKJSRequest={},CK.CKJSRequest.fetch=function(e,t){var n=e.substr(0,7),r=n==="http://"||n==="https:/",i=t.method||"GET",s=t.headers||{},o=t.body||"",u=CK.CKJSRequest._createQueryParamMapForUrl(e),a,f=e.split("?");f.length>1&&(e=f[0]);var l={withCredentials:YES,type:i,headers:s,address:e,body:o,reportRequest:YES};t&&t.credentials&&t.credentials.toLowerCase()==="omit"&&(l.withCredentials=NO),r||(l.serviceName="ckdatabasews"),window.CloudOS&&CloudOS.isUserAuthenticated()?a=CK.Request.create(l):(a=CW.Request.create(l),a.set("useCrossDomain",!0),a.set("attachIdentifyingHeaders",!1),a.set("contentType","text/plain"),a.header("Content-Type","text/plain"),a.set("addressPrefix","https://ckdatabasews.%{currentDomain}:443".fmt({currentDomain:URI(window.location.href).domain()})));var c=Object.keys(u);for(var h=0;h1){var r=n[1].split("&");for(var i=0;i' ),this.get("isVisible")?e.attr("aria-hidden",NO):e.attr("aria-hidden",YES)}}),dividerView:SC.View.design(SC.RTLSupport,{classNames:["account-menu-divider"],layoutRecipe:{centerY:0,width:1,height:22,end:e}}),helpButton:SC.ImageButtonView.design(SC.RTLSupport,{layoutRecipe:{top:0,bottom:0,width:e,end:0},image:"help-icon",targetBinding:"CK.currentApplication",action:"showHelp",toolTip:"Toolbar.Button.Action.Help",localize:YES,acceptsFirstResponder:function(){return this.getPath("parentView.accountButton.acceptsFirstResponder")}.property("parentView.accountButton"),render:function(e,t){arguments.callee.base.apply(this,arguments),this.get("isVisible")?e.attr("aria-hidden",NO):e.attr("aria-hidden",YES)},click:function(e){var t=this.get("layer");if(!t)return;return SC.Event.trigger(t,"mousedown"),SC.Event.trigger(t,"mouseup"),YES},keyDown:function(e){return e.which===SC.Event.KEY_RETURN||e.which===32?this.click():NO}}),buttonWidthDidChange:function(){var e=this.get("preferredWidth");this.set("calculatedWidth",e),this.get("shouldAutoResize")&&this.adjust("width",e)}.observes("preferredWidth"),accountButtonPreferredWidth:0,accountButtonPreferredWidthBinding:".accountButton.preferredWidth",accountButtonSmallestNonTruncatedWidth:0,accountButtonSmallestNonTruncatedWidthBinding:".accountButton.smallestNonTruncatedWidth",preferredWidth:function(){var e=SC.browser.isIE||SC.browser.isEdge?1:0;return Math.min(this.get("accountButtonPreferredWidth")+t+e,n)}.property("accountButtonPreferredWidth").cacheable(),smallestNonTruncatedWidth:function(){return Math.min(this.get("accountButtonSmallestNonTruncatedWidth" )+t,n)}.property("accountButtonSmallestNonTruncatedWidth").cacheable()})}(),CK.AddDeleteButton=SC.ImageButtonView.extend({layout:{left:0,height:17,centerY:0,width:17},acceptsFirstResponder:NO,classNames:["add-delete"],action:"buttonClicked",isEmpty:YES}),function(){var e=13,t=82;CK.AppSwitcherView=SC.View.extend({calculatedWidth:0,shouldAutoResize:YES,title:null,useLightText:NO,themeName:"icloud-controls",classNames:["app-switcher"],childViews:["buttonView"],buttonWidthDidChange:function(){var n=t+e+this.getPath("buttonView.measuredSize").width;this.set("calculatedWidth",n),this.get("shouldAutoResize")&&this.adjust("width",n)}.observes("buttonView.measuredSize"),targetFrame:function(){var e=SC.clone(this.getPath("buttonView.frame"));return e=this.convertFrameToView(e,null),e.left=e.x,e.top=e.y,e}.property(),buttonView:SC.ButtonView.design(SC.AutoResize,{init:function(){arguments.callee.base.apply(this,arguments),CK.appSwitcherKeyResponder.registerAppSwitcher(this),CW.notificationCenter.subscribeToNotification("miniSpringboardDismissed",this,this.miniSpringboardDismissed),this.watchForSizeChange()},showAppSwitcherFromKeyboardShortcut:function(){if(!this.get("isVisibleInWindow")||!this.getPath("pane.isKeyPane")||SC.RootResponder.responder.get("menuPane"))return;return this.triggerActionFromKeyboardShortcut(),YES},shouldAutoResize:NO,layout:{left:e,top:-6,bottom:0},classNames:["large-display-text"],controlSize:SC.HUGE_CONTROL_SIZE,themeName:"borderless",acceptsFirstResponder:NO,watchForSizeChange:function(){if(!SC.browser.isSafari&&!SC.browser.isWindows)return;var e=SC.Timer.schedule ({interval:100,repeats:YES,target:this,action:function(){this.measureSize();var t=this.getPath("layer.clientWidth"),n=CK.getPath("currentApplication.isActive");(n||this._previousWidth&&t!==this._previousWidth)&&e.invalidate(),this._previousWidth=t}})},render:function(e,t){arguments.callee.base.apply(this,arguments);if(t){var n=this.getPath("parentView.useLightText");e.push('
'),this.get("isEnabled")&&!CloudOS.isOnSupportedMobile()&&e.push('
')}},mouseUp:function(){var e=arguments.callee.base.apply(this,arguments);return this.set("isActive",YES),e},action:function(){CloudOS.isOnSupportedMobile()||CloudOS.showAppSwitcher(this.getPath("parentView.targetFrame"))},title:function(){var e=this.getPath("owner.title");return e?e.loc():CloudOS.getAppDisplayName()}.property("owner.title").cacheable(),toolTip:"Toolbar.Tooltip.App.Switcher".loc(),miniSpringboardDismissed:function(){this.set("isActive",NO)}})})}(),CK.logoutAlert=function(e,t,n){var r=URI(window.location.href).domain().replace("icloud","iCloud");return CW.Alert.show({classNames:["logout-alert"],message:"HSA.SignoutDialog.Title".loc({currentDomain:r}),image:"icon-icloud",descriptionViewMinHeight:5,extraWide:YES,extraViewPadding:{top:0,bottom:3},hsaTrustedBrowser:n,rightButton:{title:"HSA.SignoutDialog.SignoutButton".loc(),action:function(){var t=this.get("pane");t.remove(),e&&e(t.get("hsaTrustedBrowser"))}},middleButton:{title:"Button.Cancel".loc(),action:function(){this.get("pane").remove(),t&&t()}},extraView:SC.CheckboxView.design(CW.Alert.ExtraViewAutoResizingSupport ,SC.RTLSupport,{autoResizePadding:0,controlSize:SC.CUSTOM_CONTROL_SIZE,layoutRecipe:{start:105,end:10},title:"HSA.SignoutDialog.CheckboxTitle".loc(),valueBinding:"*pane.hsaTrustedBrowser"})})},function(){var e="cloudkit/error_catcher";if(!SC.MODULE_INFO)throw"SC.MODULE_INFO is not defined!";if(SC.MODULE_INFO[e])return;SC.MODULE_INFO[e]=SC.Object.create({dependencies:[],styles:["/system/cloudos/1812Project43/cloudkit/error_catcher/1812Project43/en-us/stylesheet.css"],styles2x:["/system/cloudos/1812Project43/cloudkit/error_catcher/1812Project43/en-us/stylesheet.css"],scriptURL:"/system/cloudos/1812Project43/cloudkit/error_catcher/1812Project43/en-us/javascript.js",stringURL:"/system/cloudos/1812Project43/cloudkit/error_catcher/1812Project43/en-us/javascript-strings.js",isPrefetched:YES})}(),CW.HashAttributeCommon={isOrphan:NO,parent:null,parentKey:null,parentIsRecord:function(){var e=this.get("parent");return e?e.kindOf(SC.Record):NO}.property("parent").cacheable(),readAttribute:function(e){var t=this.peekAttributes();return t?t[e]:undefined},attributes:function(){if(this.get("isOrphan"))return SC.warn("%@: Requesting 'attributes' on orphaned instance",this),null;var e=this.get("parent"),t=this.get("parentKey"),n;return e||CW.fatalError("Cannot access 'attributes' because there is no parent",{hashAttributeOrArray:this}),SC.none(t)&&CW.fatalError("Cannot access 'attributes' because there is no parentKey",{hashAttributeOrArray:this}),this.get("parentIsRecord")?n=e.get("store").readEditableDataHash(e.get("storeKey")):n=e.get("attributes"),n?n[t]:null}.property("parent","isOrphan" ),hashAttributeDidChange:function(e,t,n){this.childHashDidChange(e,t,n)},destroy:function(){var e=this.get("parent"),t,n;e&&(t=this.get("parentKey"),t||CW.fatalError("There is a parent but no parentKey",{target:this,parent:e}),n=e.get("attributes"),n&&(delete n[t],this.hashAttributeDidChange(),this.orphan())),arguments.callee.base.apply(this,arguments)},getAncestorRecord:function(){var e=this.get("parent"),t;return e&&(this.get("parentIsRecord")?t=e:t=e.getAncestorRecord()),t},orphan:function(){this._orphan&&this._orphan(),this.beginPropertyChanges(),this.set("isOrphan",YES),this.set("parent",null),this.parentDidChange&&this.parentDidChange(),this.set("parentKey",null),this.destroy(),this.allPropertiesDidChange(),this.endPropertyChanges()},peekAttributes:function(e){var t=this.get("parent"),n=this.get("parentKey"),r;return t&&!SC.none(n)&&(r=t.readAttribute(n)),r}},CW.HashAttributeSupport={hashAttributeFor:function(e){var t=this._hashAttributes,n=null,r;return t&&(r=t[e],r&&(n=r)),n},childHashDidChange:function(e,t,n){t||(e?this.notifyPropertyChange(e):this.allPropertiesDidChange());var r=this.get("parent"),i=this.get("parentKey");this._ignoreChangePropogation=YES,r.childHashDidChange(i,YES,n),this._ignoreChangePropogation=NO},attributeIsDefault:function(e){var t=this[e],n=this.readAttribute(e),r;return!t||!t.isRecordAttribute?n===undefined:(r=t.getDefaultValue(this,e),n===r||SC.none(r)&&SC.none(n))},normalize:function(e,t){var n={},r,i,s,o,u,a,f,l,c,h,p,d=this.get("attributes");for(r in this)i=this[r],i&&(s=i.typeClass,s&&(h=i.get("key")||r,p=s.call(i),o=undefined,n[h]=YES, f=SC.typeOf(s.call(i))===SC.T_CLASS,l=i.isNestedRecordTransform||p.isHashAttribute,!f&&!l?o=d[h]:l?(u=this.get(r),u&&(u.normalize&&u.normalize(e,t),!t&&u.isEmpty&&u.isEmpty()?o=null:o=u.get("attributes"))):f&&(u=this.get(r),u&&(o=d[h])),SC.none(o)&&(o=i.getDefaultValue(this,r)),o===null&&!e&&(o=undefined),o===undefined?delete d[h]:d[h]=o,u&&(u.isHashAttribute?u.underlyingContentDidChange():u.isHashAttributeArray&&u.recordPropertyDidChange())));for(r in d)n[r]||(SC.debug("%@: Deleting key from underlying data hash due to normalization: %@",this,r),delete d[r]);return this},registerHashAttribute:function(e,t){var n=this._hashAttributes,r,i;n||(n=this._hashAttributes={}),r=t.get("parent"),i=t.get("parentKey"),this!==r&&CW.fatalError("registerChildHashAttribute(): The specified child hash attribute does not have the proper parent",{key:e,target:this,parent:r}),e!==i&&CW.fatalError("registerChildHashAttribute(): The specified child hash attribute does not have the proper parentKey",{target:this,key:e,parentKey:i}),n[e]=t},unregisterHashAttribute:function(e,t){var n=this._hashAttributes,r;n||CW.fatalError("unregisterChildHashAttribute(): There is no “child hash attributes” structure",{target:this}),r=n[e],r||CW.fatalError("unregisterChildHashAttribute(): There is no registered child hash attribute for the specified key",{target:this,key:e}),delete n[e]},_hashAttributes:null},CW.StoreCommon={delegate:null,chain:function(e,t){return t||(t=CW.NestedStore),arguments.callee.base.call(this,e,t)},storageManager:null,getCurrentCommitCycle:function(){var e=null,t=this.getPath("storageManager.currentCycle" );return t&&t.get("type")===CW.StorageCycle.COMMIT_CYCLE&&(e=t),e},commitAgentsFor:function(e){var t=this.commitAgents;return t?t[e]:null},lastCommitAgentWithParam:function(e,t){var n=this.commitAgents,r=null,i,s,o,u;if(n){n=n[e];if(n)for(s=n.length,i=s-1;i>=0;--i){o=n[i],u=o.get("params");if(u&&u.hasOwnProperty(t)){r=o;break}}}return r},notifyCommitAgents:function(e,t,n){var r=this.commitAgentsFor(e),i,s,o,u;if(r)for(i=0,s=r.length;i lock=%@, current revision=%@",m,g),SC.debug("Version in %@:",n),SC.debug("%@",n.materializeRecord(v)),SC.debug("Version in %@:",this),SC.debug("%@",this.materializeRecord(v)),w&E?b&E?SC.debug("This record was destroyed in both stores, so ignoring it in the commit…"):C=c.ERROR_NOT_FOUND:b&E?C=c.ERROR_CONFLICT:(b===S&&w!==S&&n.writeStatus(v,SC.Record.READY_DIRTY),C=c.ERROR_CONFLICT);if(C){var L=n.get("delegate");L&&(T=n.invokeDelegateMethod(L,"mergeConflictDuringCommit",this,n,v,C,x))}if(T===NO)SC.debug("Removing this commit from %@’s changelog…",this.get("name")),k=n.changelog,k&&k.remove(v),k=n.chainedChanges,k&&k.remove(v),a=this.getCurrentCommitCycle(),a&&(f=a.get("changelog"),f&&f.remove(v)),this.notifyCommitAgents(v,"commitWasUnnecessaryAtStore");else if(T!==YES)throw SC.Store.CHAIN_CONFLICT_ERROR}}return this}},CW.HashAttribute=SC.Object.extend (CW.HashAttributeCommon,CW.HashAttributeSupport,{isHashAttribute:YES,normalize:function(e,t,n){this.get("isOrphan")&&CW.fatalError("normalize(): Cannot write to an orphan hash attribute",{target:this});var r=this.get("attributes"),i,s,o;r||(this._neverHadAHash||CW.fatalError("normalize(): We once had a hash but no longer do",{target:this}),i=this.get("parent"),s=this.get("parentKey"),i?s?i.isHashAttributeArray&&CW.fatalError("normalize(): There are no attributes but the parent is a hash attribute array",{target:this,parent:i}):CW.fatalError("normalize(): There is no parentKey",{target:this,parent:i}):CW.fatalError("normalize(): There is no parent",{target:this}),r={},i.writeAttribute(s,r),this._neverHadAHash=NO),e(t,n)}.enhance(),_checkedKeys:SC.CoreSet.create(),isEmpty:function(){var e,t,n,r=this._checkedKeys.clear();for(e in this){t=this[e];if(!t||!t.isRecordAttribute)continue;n=this.get("key");if(n&&n.isEmpty&&n.isEmpty()||!this.attributeIsDefault(e))return NO;r.add(e)}var i=this.get("attributes");for(e in i)if(!r.contains(e))return NO;return YES},beginEditing:function(){return this._editLevel++,this},endEditing:function(e){return--this._editLevel<=0&&(this._editLevel=0,this.hashAttributeDidChange(e)),this},writeAttribute:function(e,t,n){if(this.get("isOrphan"))return SC.debug("writeAttribute(): Cannot write to an orphan hash attribute"),this;var r=this.get("attributes"),i,s,o;return r?t!==r[e]&&(n||this.beginEditing(),r[e]=t,n||this.endEditing(e)):(this._neverHadAHash||CW.fatalError("writeAttribute(): We once had a hash but no longer do",{target:this}),i=this.get("parent" ),s=this.get("parentKey"),i?s?i.isHashAttributeArray&&CW.fatalError("writeAttribute(): There are no attributes but the parent is a hash attribute array",{target:this,parent:i}):CW.fatalError("writeAttribute(): There is no parentKey",{target:this,parent:i}):CW.fatalError("writeAttribute(): There is no parent",{target:this}),r={},r[e]=t,i.writeAttribute(s,r),this._neverHadAHash=NO),this},storeDidChangeProperties:function(e,t){t?(this.beginPropertyChanges(),t.forEach(function(e){this.notifyPropertyChange(e)},this),this.endPropertyChanges()):this.allPropertiesDidChange();var n=this.relationships,r=n?n.length:0;while(--r>=0)n[r].recordPropertyDidChange(t)},unknownProperty:function(e,t){var n;return t!==undefined?(n=this.constructor,n.ignoreUnknownProperties===YES?this[e]=t:this.writeAttribute(e,t),t):this.readAttribute(e)},toString:function(){var e=arguments.callee.base.apply(this,arguments),t=this.peekAttributes();return e+=" "+SC.inspect(t),e},parentDidChange:function(){var e=this._previousParent,t=this.get("parent"),n=this.get("parentKey"),r;if(SC.none(n))return;e!==t&&(r=this.underlyingContentDidChange,e&&(e.unregisterHashAttribute&&e.unregisterHashAttribute(n,this),e.removeObserver(n,this,r)),t&&(t.registerHashAttribute&&t.registerHashAttribute(n,this),t.addObserver(n,this,r)),this._previousParent=t,r.call(this))}.observes("parent"),underlyingContentDidChange:function(){if(this._ignoreChangePropogation){this._ignoreChangePropogation=NO;return}if(this.get("isOrphan"))return;!this._neverHadAHash&&!this.peekAttributes()?this.orphan():this.allPropertiesDidChange()},init:function( ){arguments.callee.base.apply(this,arguments);var e=this.get("parent");e||CW.fatalError("A hash attribute must have a parent",{hashAttribute:this}),!e.isRecord&&!e.isHashAttribute&&!e.isHashAttributeArray&&CW.fatalError("A hash attribute array’s parent must either be a record, a hash attribute, or a hash attribute array",{hashAttribute:this,parent:e}),this.peekAttributes()||(this._neverHadAHash=YES),this.parentDidChange()},_editLevel:0,_neverHadAHash:NO}),CW.HashAttribute.mixin({instantiateHashAttribute:function(e,t,n){return SC.kindOf(e,CW.HashAttribute)||CW.fatalError("%@ is not a kind of CW.HashAttribute".fmt(e)),e.create({parent:t,parentKey:n})},isComplex:YES,isHashAttribute:YES}),SC.RecordAttribute.registerTransform(CW.HashAttribute,{to:function(e,t,n,r,i){var s;return r?!r.kindOf(CW.Record)&&!r.kindOf(CW.HashAttribute)?CW.fatalError("The parent must be either an instance of subclass of either CW.Record or CW.HashAttribute",{parent:r,parentKey:i}):(s=r.hashAttributeFor(i),s||(s=CW.HashAttribute.instantiateHashAttribute(n,r,i))):CW.fatalError("Error during transform: A parent must be specified"),s},from:function(e){e&&e.isHashAttribute&&CW.fatalError("You should never set a hash attribute directly",{target:this,instance:e})}}),CW.ManyHashAttribute=SC.RecordAttribute.extend({toType:function(e,t,n){var r=this.get("typeClass"),i=this.get("key")||t,s=SC.keyFor("__cw__hashAttributeArray__",SC.guidFor(this)),o=e[s],u,a;return e&&e.isRecord&&(u=e.get("store"),u&&!u.isCoreWebStore&&CW.fatalError("Hash attribute arrays require the ancestor record to belong to a CoreWeb store rather than an SC.Store" ,{target:this,parent:e,store:u})),o||(o=CW.HashAttributeArray.create({objectType:r,parent:e,parentKey:i,manyAttribute:this}),e[s]=o,a=e.get("relationships"),a?(a.push(o),a.enumerableContentDidChange()):e.set("relationships",[o])),o},fromType:function(e,t,n){var r=[],i,s;SC.isArray(n)||CW.fatalError("CW.ManyHashAttribute#fromType: The toMany attribute should be an array");for(i=0,s=n.get("length");i0&&(e=YES);if(!e){n=this.relationships;if(n)for(r=0,i=n.length;r0){var v=this.get("delegate"),m=NO;v&&(m=this.invokeDelegateMethod(v,"mergeConflictDuringNotify",this,null,r,p,d))}}else this.writeDataHash(r,n,o),this.dataHashDidChange(r)}else this.writeDataHash(r,n,o),this.dataHashDidChange(r)}return r}return NO},_savePreviousDataHashForNotify:function(e,t){var n=this.get("nestedStores");n&&n.length>0&&(this.previousDataHashesForNotify[e]||(this.previousDataHashesForNotify[e]=SC.clone(this.dataHashes [e],YES)))},reset:function(){return this.previousDataHashesForNotify={},this.commitAgents=null,arguments.callee.base.apply(this,arguments)},commitChangesFromNestedStore:function(e,t,n){var r=e.commitAgents,i,s,o,u,a,f;if(r){i=this.commitAgents,i||(i=this.commitAgents={});for(s in r)s=parseInt(s,10),t.contains(s)&&(o=i[s],u=r[s],o?o=o.concat(u):i[s]=u)}n||this._verifyLockRevisions(t,e.locks,e);var l=t.length,c,h,p,d,v,m,g,y;v=this.revisions,h=this.dataHashes,p=this.statuses,d=this.editables,d||(d=this.editables=[]),m=e.dataHashes,y=e.revisions,g=e.statuses;for(c=0;c1&&f&&l&&(f.adjust({left:-1*c}),l.adjust({left:-1*c})),s&&this._moveBarAndViewTo(s,o,e,c,0,YES),f&&this._moveBarAndViewTo(f,l,e,0,1,NO,n)},_moveBarAndViewTo:function(e,t,n,r,i,s,o){var u=this.get("navigationView"),a=1,f=e.get("frame").x;if(n){e.adjust({left:f,height:u.get("frame").height-t.get("frame").height,bottom:null}),t.adjust({left:f,opacity:a}),e.set("wantsAcceleratedLayer",YES),t.set("wantsAcceleratedLayer",YES);var l=Math.max(CW.VIEW_LEFT_DURATION,CW.BAR_LEFT_DURATION ,CW.BAR_OPACITY_DURATION),c=u.$();if(c.find(".overlay").size()===0){var h="position: absolute; top: 0px; bottom: 0px; left: 0px; right: 0px; z-index: 1000;";h+='background-image: url("%@");'.fmt("/system/cloudos/1812Project43/sproutcore/foundation/1812Project43/en-us/source/resources/blank.gif"),c.append("
".fmt(h))}var p=CW.Animation.create({view:e,bar:t,navigationView:u,tween:CW.Anim.tweens.WEBKIT_EASE_IN_OUT,viewLayer:e.get("layer"),barLayer:t.get("layer"),toLeft:r,fromLeft:f,toOpacity:i,fromOpacity:a,duration:l,name:SC.guidFor(this)+":navigationAnimation:"+SC.guidFor(e),update:function(){var e=this.current,t=Math.round(this.fromLeft+(this.toLeft-this.fromLeft)*Math.min(1,Math.max(0,e*(this.duration/CW.VIEW_LEFT_DURATION)))),n=Math.round(this.fromLeft+(this.toLeft-this.fromLeft)*Math.min(1,Math.max(0,e*(this.duration/CW.BAR_LEFT_DURATION)))),r=this.fromOpacity+(this.toOpacity-this.fromOpacity)*Math.min(1,Math.max(0,e*(this.duration/CW.BAR_OPACITY_DURATION)));if(!this.viewLayer||!this.barLayer)this.viewLayer=this.view.get("layer"),this.barLayer=this.bar.get("layer");if(this.viewLayer&&this.barLayer){var i=this.viewLayer.style,s=this.barLayer.style;SC.platform.supportsCSS3DTransforms?(i.width=this.view.get("frame").width,i.webkitTransform="translate3d("+t+"px,0,0)",s.webkitTransform="translate3d("+n+"px,0,0)"):(i.left=t+"px",s.left=n+"px")}},cleanUp:function(){s?(this.view.removeFromParent(),this.bar.removeFromParent(),this.bar.destroy()):(this.view.adjust({left:r}),this.bar.adjust({left:r,opacity:i})),this.view.adjust({height:null,bottom :0});var e=this.navigationView.$(),t=e.find(".overlay");t.remove(),o&&o()}.listens("finish")});setTimeout(function(){p.start()},100)}else e.adjust({left:r}),t.adjust({left:r,opacity:i})},_pushViewAndBarToStack:function(e,t){var n=this.get("navigationView"),r=n.createChildView(CW.NavigationBarView),i=n.get("frame").width,s=n.get("frame").height,o=(t?1:-1)*i+CW.NAVIGATABLE_VIEW_PADDING,u=n.get("navigationBarHeight"),a=e.get("hasNavigationBar");e.set("navigationController",this),e.set("layout",{top:0,bottom:0,left:o,width:i}),r.set("layout",{top:0,left:o/2,width:i,height:u}),r.set("navigationController",this),r.set("associatedView",e);if(a)n.appendChild(r);else{var f=n.childViews[0],l=f.get("layout");f.set("layout",{top:0,left:l.left,right:l.right,bottom:l.bottom})}n.get("well").appendChild(e),this.get("viewStack").push(e),this.get("barStack").push(r)}}),CW.ViewController=SC.Responder.extend({isViewController:YES,view:null}),CW.NavigatableView=SC.View.extend(CW.Animatability,{isNavigatable:YES,navigationController:null,hasNavigationBar:YES,title:"",icon:null,escapeHTML:YES,navigationBarTheme:"iOS",hasLeftBarButton:YES,leftBarButtonTitle:"Back",leftBarButtonIsEnabled:YES,leftBarButtonTheme:"borderless",leftBarButtonTarget:this,leftBarButtonAction:function(){this.getPath("parentView.parentView.navigationController").pop()},rightBarButtonTheme:"borderless",hasRightBarButton:NO,rightBarButtonTitle:"",rightBarButtonIsEnabled:YES,rightBarButtonTarget:null,rightBarButtonAction:"",toolbarView:null,_realLeftBarButtonIsEnabled:null,realLeftBarButtonIsEnabled:function(e,t){return t!==undefined&& (t===NO?this._realLeftBarButtonIsEnabled=t:this._realLeftBarButtonIsEnabled=null),SC.none(this._realLeftBarButtonIsEnabled)?this.get("leftBarButtonIsEnabled"):this._realLeftBarButtonIsEnabled}.property("leftBarButtonIsEnabled"),_realRightBarButtonIsEnabled:null,realRightBarButtonIsEnabled:function(e,t){return t!==undefined&&(t===NO?this._realRightBarButtonIsEnabled=t:this._realRightBarButtonIsEnabled=null),SC.none(this._realRightBarButtonIsEnabled)?this.get("rightBarButtonIsEnabled"):this._realRightBarButtonIsEnabled}.property("rightBarButtonIsEnabled"),_realHasLeftBarButton:null,realHasLeftBarButton:function(e,t){return t!==undefined&&(t===NO?this._realHasLeftBarButton=t:this._realHasLeftBarButton=null),SC.none(this._realHasLeftBarButton)?this.get("hasLeftBarButton"):this._realHasLeftBarButton}.property("hasLeftBarButton"),_realHasRightBarButton:null,realHasRightBarButton:function(e,t){return t!==undefined&&(t===NO?this._realHasRightBarButton=t:this._realHasRightBarButton=null),SC.none(this._realHasRightBarButton)?this.get("hasRightBarButton"):this._realHasRightBarButton}.property("hasRightBarButton")}),CW.ProxyDisplay={concatenatedProperties:"proxyDisplayProperties".w(),proxyDisplayProperties:[],displayDelegateKey:"displayDelegate",initMixin:function(){this._cwps_computedDisplayProxyProperties=[],this._cwps_computedProxyPropertyToPropertyMap={},this._cwps_contentKeys=[],this._cwps_contentKeyToComputedProxyPropertyMap={},this._cwps_computedProxyPropertyToContentKeyMap={};var e=this.get("proxyDisplayProperties");this._cwps_addContentKeyComputedDisplayProxyPropertyMapping(e), this._cwps_addComputedDisplayProxyProperties(e),this._cwps_setupContentPropertiesObserving(),this._cwps_propertiesDidChange(this,"*")},destroyMixin:function(){this._cwps_tearDownContentPropertiesObserving()},computedDisplayProxyPropertyKey:function(e){return"display%@".fmt(e.classify())},_cwps_computedContentKey:function(e){var t="content%@Key".fmt(e.classify()),n=this.get(t);if(SC.none(n)){var r=this.get("displayDelegateKey"),i=r?this.get(r):null;n=i?i.get(t):null}return SC.none(n)?e:n},contentPropertyValueForComputedDisplayProxyProperty:function(e){var t=this.get("content"),n=this._cwps_computedProxyPropertyToContentKeyMap;if(!t||!n)return undefined;var r=n[e];return t.get(r)},contentPropertyValueForProxiedProperty:function(e){var t=this.get("content");if(!t)return undefined;var n=this._cwps_computedContentKey(e);return t.get(n)},computedDisplayProxyPropertyValue:function(e){var t=this.contentPropertyValueForComputedDisplayProxyProperty(e),n=this._cwps_computedProxyPropertyToPropertyMap;if(!SC.none(t))return t;if(!n)return undefined;var r=n[e];return this.get(r)},addProxyDisplayProperty:function(e){this.addProxyDisplayProperties([e])},addProxyDisplayProperties:function(e){this._cwps_addContentKeyComputedDisplayProxyPropertyMapping(e),this._cwps_addComputedDisplayProxyProperties(e);var t=this.get("proxyDisplayProperties");this.set("proxyDisplayProperties",t.concat(e)),e.forEach(function(e){this._cwps_propertiesDidChange(this,e)},this)},_cwps_addComputedDisplayProxyProperties:function(e){var t=this._cwps_computedDisplayProxyProperties,n=this._cwps_computedProxyPropertyToPropertyMap ;e.forEach(function(e){if(e==="content")throw"Can not proxy the content property";var r=this.computedDisplayProxyPropertyKey(e),i=this[r];if(i===undefined)this[r]=null,t.push(r),n[r]=e;else{if(SC.typeOf(i)!==SC.T_FUNCTION||!i.isProperty)throw"'%@' is already defined. Can not proxy property '%@'".fmt(r,e);t.push(r)}},this);var r=this.get("displayProperties");r=r.concat(t),this.set("displayProperties",r)},_cwps_addContentKeyComputedDisplayProxyPropertyMapping:function(e){var t=this._cwps_contentKeys,n=this._cwps_contentKeyToComputedProxyPropertyMap,r=this._cwps_computedProxyPropertyToContentKeyMap;e.forEach(function(e){var i=this._cwps_computedContentKey(e),s=this.computedDisplayProxyPropertyKey(e);t.push(i),n[i]=s,r[s]=i},this)},_cwps_contentDidChange:function(){this._cwps_tearDownContentPropertiesObserving(),this._cwps_setupContentPropertiesObserving(),this._cwps_contentPropertiesDidChange(this,"*")}.observes("content"),_cwps_setupContentPropertiesObserving:function(){var e=this.get("content");this._cwps_content=e;if(!e)return;e.addObserver("*",this,"_cwps_contentPropertiesDidChange")},_cwps_tearDownContentPropertiesObserving:function(){var e=this._cwps_content;this._cwps_content=null;if(!e)return;e.removeObserver("*",this,"_cwps_contentPropertiesDidChange")},_cwps_propertiesDidChange:function(e,t){var n=this.get("proxyDisplayProperties")||[],r=null;t==="*"?r=n:n.indexOf(t)>=0&&(r=[t]);if(!r)return;this.beginPropertyChanges(),r.forEach(function(e){var t=this.computedDisplayProxyPropertyKey(e);this._cwps_notifyComputedDisplayProxyPropertyChanged(t)},this),this.endPropertyChanges (),this.displayDidChange()}.observes("*"),_cwps_contentPropertiesDidChange:function(e,t){var n=this.get("content"),r=this._cwps_contentKeys||[],i=null;t==="*"?i=r:r.indexOf(t)>=0&&(i=[t]);if(!i)return;this.beginPropertyChanges(),i.forEach(function(e){var t=this._cwps_contentKeyToComputedProxyPropertyMap[e];this._cwps_notifyComputedDisplayProxyPropertyChanged(t)},this),this.endPropertyChanges(),this.displayDidChange()},_cwps_notifyComputedDisplayProxyPropertyChanged:function(e){var t=this.get(e);if(SC.typeOf(t)===SC.T_FUNCTION&&t.isProperty)this.notifyPropertyChange(e);else{var n=this.computedDisplayProxyPropertyValue(e);this.set(e,n!==undefined?n:null)}}};var CW_ACTION_SHEET_BUTTON_HEIGHT=67,CW_ACTION_SHEET_BOTTOM_PADDING=20,CW_ACTION_SHEET_SIDE_MARGINS=10,CW_ACTION_SHEET_TEXT_WIDTH=290;CW.ActionSheet=SC.View.extend(CW.Animatability,{classNames:"cw-action-sheet",actionSheetButtons:null,actionSheetMessage:null,actionSheetMessageEscaped:YES,childViews:["sheet"],sheetHeight:0,wantsAcceleratedLayer:YES,descriptionAction:null,sheet:SC.View.design(CW.Animatability,{classNames:"cw-actions"}),init:function(){arguments.callee.base.apply(this,arguments);var e,t;for(var n=0,r=this.actionSheetButtons.length;n'),f.end()},update:function(e,t){this.updateSizeClassName(e,t);var n=e.get("theme"),r=e.get("isSelected"),i=e.get("isActive"),s=!e.get("isEnabled"),o;r?o="true":o="false",t.attr("aria-checked",o),n.labelRenderDelegate.update(e,t.find("span.label")),t.setClass({active:i,disabled:s})}}),CW.SectionedViewDataSource={isSectionedViewDataSource:YES,numberOfSectionsInSectionedView:function(e){return 0},sectionedViewSectionIsVisible :function(e,t){return YES},sectionedViewNumberOfRowsInSection:function(e,t){return 0},sectionedViewTitleForHeaderInSection:function(e,t){return undefined},sectionedViewTitleForFooterInSection:function(e,t){return undefined},sectionedViewCellForRowAtIndexPath:function(e,t){return undefined},sectionedViewContentForRowAtIndexPath:function(e,t){return undefined}},CW.SectionedViewDelegate={isSectionedViewDelegate:YES,sectionedViewHeightForRowAtIndexPath:function(e,t){return undefined},sectionedViewAccessoryButtonTappedForRowAtIndexPath:function(e,t){},sectionedViewWillSelectRowAtIndexPath:function(e,t){return t},sectionedViewDidSelectRowAtIndexPath:function(e,t){},sectionedViewWillDeselectRowAtIndexPath:function(e,t){return t},sectionedViewDidDeselectRowAtIndexPath:function(e,t){},sectionedViewViewForHeaderInSection:function(e,t){return undefined},sectionedViewViewForFooterInSection:function(e,t){return undefined},sectionedViewHeightForHeaderInSection:function(e,t){return undefined},sectionedViewHeightForFooterInSection:function(e,t){return undefined},sectionedViewShouldAutoResizeHeaderTitleInSection:function(e,t){return undefined},sectionedViewShouldAutoResizeFooterTitleInSection:function(e,t){return undefined},sectionedViewCellDisplayDelegateForRowAtIndexPath:function(e,t){return e},sectionedViewWillSetupAllCells:function(e){},sectionedViewDidSetupAllCells:function(e){},sectionedViewWillTearDownAllCells:function(e){},sectionedViewDidTearDownAllCells:function(e){}},CW.SectionedViewController=CW.ViewController.extend(CW.SectionedViewDataSource,CW.SectionedViewDelegate,{}),CW.SectionedViewAutoResizingViewSupport= {isSectionedViewAutoResizingView:YES,shouldAutoResize:YES,heightPadding:0,computeHeight:function(){var e=this.$(),t=parseInt(e.css("padding-left")||0),n=parseInt(e.css("padding-right")||0),r=parseInt(e.css("margin-left")||0),i=parseInt(e.css("margin-right")||0),s=e[0],o=this.getPath("frame.width"),u;return SC.none(s)?null:(s.style.maxWidth=o-(t+n+r+i)+"px",u=SC.metricsForString(this.get("value"),s),u.height+this.get("heightPadding"))}},CW.SVCollectionSectionDelegate={isSVCollectionSectionDelegate:YES,collectionSectionCellForContentAtIndex:function(e,t,n){return null},collectionSectionRowHeightForContentAtIndex:function(e,t,n){return null}},CW.SectionedViewDesignSupport={},SC.mixin(CW.SectionedViewDesignSupport,CW.SectionedViewDataSource,CW.SectionedViewDelegate,{isSectionedViewDesigner:YES,sections:[],initMixin:function(){this.createSections()},createSections:function(){var e=(this.get("sections")||[]).slice(),t=e.length,n=0,r,i;for(;n0&&(this._handle.removeClass("highlight"),this._handle.addClass("pressed"),this._tracksContainer.addClass("pressed")),this.get("isSelected")&&this._repositionTo(CW.HANDLE_MAX_LEFT-3),this._onCap.addClass("cw-switchview-on"),this._startingMouseOffset=this._makeValueRelativeToLeftEdgeOf( e.clientX,this._container),this._startingHandleLocation=parseInt(this._handle.css("left"),10)},touchesDragged:function(e){this.mouseDragged(e)},mouseDragged:function(e){if(!this.get("isEnabled"))return NO;this._isTracking||(this._handle.removeClass("highlight"),this._handle.addClass("pressed"),this._tracksContainer.addClass("pressed")),this._isTracking=YES;var t=parseInt(this._handle.css("left"),10)>=CW.HANDLE_MAX_LEFT/2,n=this._makeValueRelativeToLeftEdgeOf(e.clientX,this._container),r=n-this._startingMouseOffset;this.get("isSelected")&&this._repositionTo(CW.HANDLE_MAX_LEFT-3),this._repositionTo(this._startingHandleLocation+r)},mouseUp:function(e){if(!this.get("isEnabled"))return NO;var t=parseInt(this._handle.css("left"),10)>=CW.HANDLE_MAX_LEFT/2;this.set("isSelected",t),this._isTracking?(this._isTracking=NO,this._handleLocation==CW.HANDLE_BIG_OFFSET?this._animateTo(t,YES,0):this._animateTo(t)):this._animateTo(!this.get("isSelected"))},_makeValueRelativeToLeftEdgeOf:function(e,t){var n=0,r=0;if(t.offsetParent)do{if(t===document.body)break;r+=t.offsetLeft,n+=t.offsetTop}while(t=t.offsetParent);return e-r},_initReferences:function(){this._container=this.$(".cw-switchview-container")[0],this._handle=this.$(".cw-switchview-handle"),this._offTrack=this.$(".cw-switchview-off-track"),this._offText=this.$(".cw-switchview-off-text"),this._onText=this.$(".cw-switchview-on-text"),this._onCap=this.$(".cw-switchview-on-cap"),this._offCap=this.$(".cw-switchview-off-cap"),this._tracksContainer=this.$(".cw-switchview-tracks-container")}.observes("layer"),_repositionTo:function(e){e=Math.max (Math.min(e,CW.HANDLE_MAX_LEFT),0),this._isTracking&&e>=CW.HANDLE_BIG_OFFSET&&(e=CW.HANDLE_BIG_OFFSET),e>=CW.HANDLE_MAX_LEFT/2?(this._tracksContainer.addClass("selectedState"),this._handle.addClass("selectedState")):(this._tracksContainer.removeClass("selectedState"),this._handle.removeClass("selectedState")),this._handle.css("left",this._handleLocation=e),this._offTrack.css("left",e)},_animateTo:function(e,t,n){t===undefined&&(t=YES),this._handle.removeClass("pressed"),this._tracksContainer.removeClass("pressed"),e?this._onCap.addClass("cw-switchview-on"):this._handle.removeClass("highlight"),this._anim&&this._anim.stop(),n===0?this._repositionTo(e?CW.HANDLE_MAX_LEFT:0):this._anim=CW.Animation.create({name:this.toString(),that:this,updateValue:t,isSelected:e,updateValue:t,from:this._handleLocation,to:e?CW.HANDLE_MAX_LEFT:0,duration:SC.none(n)?350:n,update:function(){this.that._repositionTo(this.current)},onFinish:function(){this.updateValue&&(this.that.get("isSelected")!==this.isSelected&&this.invokeLast(function(){this.that._action()}),this.that.set("isSelected",this.isSelected)),this.isSelected||this.that._onCap.removeClass("cw-switchview-on")}}).start()}}),CW.SwitcherAccessoryViewSupport={target:null,action:null,animateOnPropertyChange:NO,animateOnPropertyChangeBindingDefault:SC.Binding.oneWay(),accessoryView:CW.SwitchView.extend({layout:{width:57,centerY:1,height:31,right:8},animateOnPropertyChangeBinding:SC.Binding.oneWay(".bindingAgent.animateOnPropertyChange"),valueBinding:".bindingAgent.value",targetBinding:SC.Binding.oneWay(".bindingAgent.target"),actionBinding:SC. Binding.oneWay(".bindingAgent.action")})},CW.SectionedViewCellAccessoryType=SC.Object.extend({concatenatedProperties:["classNames"],classNames:[],buttonHitTest:function(e,t){return NO}}),CW.SectionedViewCellAccessoryType.mixin({CLASS_NAME:"cw-accessory-type",render:function(e,t,n){n=n.begin().addClass(this.CLASS_NAME),e&&n.addClass(e.get("classNames")),n.end()},update:function(e,t,n){var r=n.find("."+this.CLASS_NAME);if(r){var i=[this.CLASS_NAME];e&&(i=i.concat(e.get("classNames"))),r.attr("class",i.join(" "))}}}),CW.SectionedViewCellAccessoryType.DETAIL_CHECKMARK=CW.SectionedViewCellAccessoryType.create({classNames:"cw-detail-checkmark".w()}),CW.SectionedViewCellAccessoryType.DISCLOSURE_INDICATOR=CW.SectionedViewCellAccessoryType.create({classNames:"cw-disclosure-indicator".w()}),CW.SectionedViewCellAccessoryType.DETAIL_DISCLOSURE_BUTTON=CW.SectionedViewCellAccessoryType.create({classNames:"cw-detail-disclosure-button".w(),buttonHitTest:function(e,t){var n=t.target,r=e.$("."+this.get("classNames")[0]);return r.size()>0&&r.within(n)}}),CW.IMAGE_ANCHOR_CLASS_NAME="cw-image-anchor",CW.SectionedViewCellImageAnchor=SC.Object.extend({concatenatedProperties:["classNames"],classNames:[CW.IMAGE_ANCHOR_CLASS_NAME]}),CW.SectionedViewCellImageAnchor.CONTENT_AREA=CW.SectionedViewCellImageAnchor.create(),CW.SectionedViewCellImageAnchor.TEXT_LEFT=CW.SectionedViewCellImageAnchor.create({classNames:["cw-image-left"]}),CW.SectionedViewCellImageAnchor.DETAIL_TEXT_LEFT=CW.SectionedViewCellImageAnchor.create({classNames:["cw-image-left"]}),CW.SectionedViewCellSelectionStyle=SC.Object.extend({classNames :[]}),CW.SectionedViewCellSelectionStyle.NONE=CW.SectionedViewCellSelectionStyle.create(),CW.SectionedViewCellSelectionStyle.BLUE=CW.SectionedViewCellSelectionStyle.create({classNames:["cw-selection-blue"]}),CW.SectionedViewCellStyle=SC.Object.extend({concatenatedProperties:"classNames".w(),classNames:[],imageAnchor:CW.SectionedViewCellImageAnchor.CONTENT_AREA}),CW.SectionedViewCellStyle.DEFAULT1=CW.SectionedViewCellStyle.create({classNames:["cw-default"],imageAnchor:CW.SectionedViewCellImageAnchor.TEXT_LEFT}),CW.SectionedViewCellStyle.DEFAULT2=CW.SectionedViewCellStyle.create({classNames:["cw-default"],imageAnchor:CW.SectionedViewCellImageAnchor.DETAIL_TEXT_LEFT}),CW.SectionedViewCellStyle.BUTTON=CW.SectionedViewCellStyle.create({classNames:["cw-button"],imageAnchor:CW.SectionedViewCellImageAnchor.TEXT_LEFT}),CW.SectionedViewCellStyle.DELETE_BUTTON=CW.SectionedViewCellStyle.create({classNames:["cw-delete-button"],imageAnchor:CW.SectionedViewCellImageAnchor.TEXT_LEFT}),CW.SectionedViewCellStyle.TEXT_FIELD=CW.SectionedViewCellStyle.create({classNames:["cw-text-field"]}),CW.SectionedViewStyle=SC.Object.extend({contentLayout:{},sectionSpacing:0,classNames:[]}),CW.SectionedViewStyle.NONE=CW.SectionedViewStyle.create(),CW.SectionedViewStyle.PLAIN=CW.SectionedViewStyle.create({classNames:["cw-plain"]}),CW.SectionedViewStyle.GROUPED=CW.SectionedViewStyle.create({_layout1:{top:15,left:0,right:0,bottom:15},_layout2:{top:20,left:0,right:0,bottom:30},contentLayout:function(){var e=SC.browser;return e.iPhone||e.iPod?this._layout1:this._layout2}.property(),sectionSpacing:34,classNames:["cw-grouped" ]}),CW.SectionedViewBlock=SC.Object.extend({sectionedView:null,views:[],height:0,top:0,hasViews:function(){var e=this.get("views");return e&&e.length>0}.property("view").cacheable(),setup:function(){},tearDown:function(){var e=this.get("views")||[];e.forEach(function(e){e.destroy()}),this.set("views",[])},reload:function(){},readjustFromTop:function(e){this.set("top",e),this.doReadjustFromTop(e)},doReadjustFromTop:function(e){},readjustViewFromTop:function(e,t){return e.adjust({top:t,bottom:null}),e.get("frame").height},updateHeightIfNeeded:function(){var e=this.get("views")||[],t=NO;e.forEach(function(e){if(e.isSectionedViewAutoResizingView&&e.shouldAutoResize){var n=e.computeHeight();n&&(e.adjust("height",n),t=YES)}}),t&&this.updateHeight()},updateHeight:function(){}}),CW.SectionedViewFooterBlock=CW.SectionedViewBlock.extend({setup:function(){var e=this.get("sectionedView"),t=e.get("styleValue"),n=t.get("contentLayout"),r=e.get("footerView"),i=e.get("footerHeight");if(!r)return;if(!r.isClass||!SC.kindOf(r,SC.View)){SC.Logger.error("%@: sectioned view footer is not a view class".fmt(e));return}r=e.get("contentView").createChildView(r,{layerId:"%@-footer".fmt(e.get("layerId")),classNames:"cw-sectioned-footer",layout:{left:0,right:0,top:0,height:i}}),this.set("views",[r]),this.set("height",i)},doReadjustFromTop:function(e){var t=this.get("views");t&&t.length>0&&this.readjustViewFromTop(t[0],e)},updateHeight:function(){this.set("height",this.get("views")[0].get("frame").height)}}),CW.SectionedViewHeaderBlock=CW.SectionedViewBlock.extend({setup:function(){var e=this.get("sectionedView" ),t=e.get("styleValue"),n=t.get("contentLayout"),r=e.get("headerView"),i=e.get("headerHeight");if(!r)return;if(!r.isClass||!SC.kindOf(r,SC.View)){SC.Logger.error("%@: sectioned view header is not a view class".fmt(e));return}r=e.get("contentView").createChildView(r,{layerId:"%@-header".fmt(e.get("layerId")),classNames:"cw-sectioned-header",layout:{left:0,right:0,top:0,height:i}}),this.set("views",[r]),this.set("height",i)},doReadjustFromTop:function(e){var t=this.get("views");t&&t.length>0&&this.readjustViewFromTop(t[0],e)},updateHeight:function(){this.set("height",this.get("views")[0].get("frame").height)}}),CW.SectionedViewSectionBlock=CW.SectionedViewBlock.extend({sectionIndex:null,headerView:null,footerView:null,rows:null,height:function(){var e=this.get("sectionedView"),t=this.get("sectionIndex"),n=e.get("sectionedViewDataSource"),r=n.numberOfSectionsInSectionedView(e),i=this.get("views")||[],s=this.rowsContainerView,o=0;i.forEach(function(e){e!=s&&(o+=e.get("frame").height)});var u=e.get("styleValue"),a=u.get("contentLayout"),f=u.get("sectionSpacing");return t0&&(o+=f),o}.property("views","sectionIndex").cacheable(),includeSectionRowsContainer:function(){return SC.browser.isIE8OrLower}.property().cacheable(),setup:function(){var e=this.get("sectionedView"),t=[];this.headerView=this._createHeaderView(),this.rows=this._createRowCells(),this.footerView=this._createFooterView(),this.rowsContainerView=this._createRowsContainer(),this.rowsContainerView&&t.push(this.rowsContainerView),this.headerView&&t.push(this.headerView),this.rows&&t.pushObjects(this.rows),this.footerView&& t.push(this.footerView),this.set("views",t)},reload:function(){this.tearDown(),this.setup()},doReadjustFromTop:function(e){var t=this.headerView,n=this.footerView,r=this.rows,i=e,s=0,o=0;t&&(e+=this.readjustViewFromTop(t,e));for(var u=0,a=r.length;u0?(r.remove(),this.didRemoveContentAreaText(e,t)):i&&r.size()>0?(s?r.text(n):r.push(n),this.didUpdateContentAreaText(e,t)):i&&(t.find(".cw-content").append('
%@
'.fmt("cw-text",n)),this.updateContentAreaImage(e,t.find(".cw-text"),CW.SectionedViewCellImageAnchor.DETAIL_TEXT_LEFT),this.didInsertContentAreaText(e,t))},didRemoveContentAreaText:function(e,t){},didUpdateContentAreaText:function(e,t){},didInsertContentAreaText:function(e,t){},updateContentAreaDetailText:function(e,t){if(!e.didChangeFor("update","detailTextValue"))return;var n=e.get("detailTextValue"),r=t.find(".cw-content .cw-detail-text span"),i=!SC.empty(n),s=e.get("escapeHTMLValue");!i&&r.size()>0?(r.remove(),this.didRemoveContentAreaDetailText(e,t)):i&&r.size()>0?(s?r.text(n):r.push(n),this.didUpdateContentAreaDetailText(e,t)):i&&(t.find(".cw-content").append('
%@
'.fmt("cw-detail-text",n)),this.updateContentAreaImage(e,t.find(".cw-detail-text"),CW.SectionedViewCellImageAnchor.DETAIL_TEXT_LEFT),this.didInsertContentAreaDetailText(e,t))},didRemoveContentAreaDetailText:function(e,t){},didUpdateContentAreaDetailText :function(e,t){},didInsertContentAreaDetailText:function(e,t){},updateContentAreaImage:function(e,t,n){if(!e.didChangeFor("update","imageValue"))return;var r=e.get("imageValue"),i=t.find("."+CW.IMAGE_ANCHOR_CLASS_NAME),s=i.find(".cw-image"),o=SC.ImageView.valueIsUrl(r),u=!SC.empty(r);if(!u&&s.size()>0)s.remove(),this.didRemoveContentAreaImage(e,t);else if(u&&s.size()>0)o?(s.attr("src",r),s.attr("class","cw-image")):(s.attr("src",SC.BLANK_IMAGE_URL),s.attr("class","cw-image %@".fmt(r))),this.didUpdateContentAreaImage(e,t);else if(u){var a=e.get("styleValue"),f=a.get("imageAnchor");i.size()===0&&n===f&&(i=t,i.addClass(f.get("classNames"))),o?i.prepend(''.fmt(r)):i.prepend(''.fmt(r,SC.BLANK_IMAGE_URL)),this.didInsertContentAreaImage(e,t)}},didRemoveContentAreaImage:function(e,t){},didUpdateContentAreaImage:function(e,t){},didInsertContentAreaImage:function(e,t){},updateAccessoryType:function(e,t){var n,r;r=e.get("accessoryTypeValue"),t.setClass("cw-has-accessory-type",!!r),e.didChangeFor("update","accessoryTypeValue")&&CW.SectionedViewCellAccessoryType.update(r,e,t),e.didChangeFor("update","accessoryTypeButtonActive")&&(r=e.get("accessoryTypeValue"),r&&(n||(n=t.find(".cw-accessory-type")),e.get("accessoryTypeButtonActive")?n.addClass("cw-active"):n.removeClass("cw-active")))}}),SC.BaseTheme.sectionedViewCellRenderDelegate=CW.SectionedViewCellRenderDelegate.create(),CW.SectionedViewCollectionItemCellRenderDelegate=CW.SectionedViewCellRenderDelegate.extend({didRenderCellBody:function(e,t){var n=e.get("isSelectedItem" );n&&t.addClass("cw-selected-collection-item")},didUpdateCellBody:function(e,t){var n=e.get("isSelectedItem");t.setClass("cw-selected-collection-item",!!n)}}),SC.BaseTheme.sectionedViewCollectionItemCellRenderDelegate=CW.SectionedViewCollectionItemCellRenderDelegate.create(),CW.SectionedViewCoreCell=SC.View.extend(CW.ProxyDisplay,{renderDelegateName:"sectionedViewCoreCellRenderDelegate",proxyDisplayProperties:"isEnabled style selectionStyle escapeHTML".w(),indexPath:null,isHighlighted:NO,isSelected:NO,isEnabled:YES,isEnabledInSectionedView:YES,escapeHTML:YES,style:null,selectionStyle:CW.SectionedViewCellSelectionStyle.BLUE,highlightStyle:CW.SectionedViewCellSelectionStyle.BLUE,owner:null,selectedTarget:null,selectedAction:null,deselectedTarget:null,deselectedAction:null,displayProperties:"isSelected isHighlighted isEnabledInSectionedView highlightStyle".w(),computedDisplayProxyPropertyKey:function(e){return e+"Value"},sectionedViewTapStartForEvent:function(e,t){return NO},sectionedViewTapEndForEvent:function(e,t){return NO},selected:function(){var e=this.get("selectedTarget"),t=this.get("selectedAction");this.handleCellAction(e,t)},deselected:function(){var e=this.get("deselectedTarget"),t=this.get("deselectedAction");this.handleCellAction(e,t)},handleCellAction:function(e,t){if(!t)return;var n=this.getPath("owner.pane"),r=n.get("rootResponder");r.sendAction(t,e,this,n)},isEnabledValue:function(){if(!this.get("isEnabledInSectionedView")||!this.get("isEnabledInPane"))return NO;var e=this.contentPropertyValueForProxiedProperty("isEnabled");return e===undefined?this.get("isEnabledInPane" ):e}.property("isEnabledInPane","isEnabledInSectionedView").cacheable()}),CW.SECTIONED_VIEW_CELL_DEFAULT_ACCESSORY_WIDTH=40,CW.SectionedViewCell=CW.SectionedViewCoreCell.extend({proxyDisplayProperties:"text detailText image accessoryType accessoryIsEnabled accessoryView indentationLevel indentationWidth".w(),content:null,text:null,detailText:null,image:null,accessoryType:null,accessoryView:null,accessoryIsEnabled:YES,style:CW.SectionedViewCellStyle.DEFAULT1,accessoryTypeButtonActive:NO,indentationLevel:0,indentationWidth:22,renderDelegateName:"sectionedViewCellRenderDelegate",displayProperties:"accessoryTypeButtonActive accessoryLayout".w(),accessoryViewValue:function(){var e;return e=this.get("accessoryView"),e?e:(e=this.contentPropertyValueForProxiedProperty("accessoryView"),e)}.property().cacheable(),accessoryValue:function(){var e=this.get("accessoryTypeValue"),t=this.get("accessoryViewValue");return t?t:e?e:null}.property("accessoryTypeValue","accessoryViewValue").cacheable(),accessoryShouldBeEnabled:function(){return!!this.get("isEnabledValue")&&!!this.get("accessoryIsEnabledValue")}.property("isEnabledValue","accessoryIsEnabledValue").cacheable(),accessoryLayout:function(){var e=this.get("accessoryValue");return this._computeAccessoryLayout(e)}.property("accessoryValue").cacheable(),destroy:function(){this.accessoryView=null,this.contentView=null,arguments.callee.base.apply(this,arguments)},createChildViews:function(){var e=[],t;return t=this.createAccessoryView(),t&&(e.pushObject(t),this.beginPropertyChanges(),this.set("accessoryView",t),this.set("childViews",e),this .endPropertyChanges()),this},_isEnabledValueDidChange:function(){}.observes("isEnabledValue"),createAccessoryView:function(){var e=this.get("accessoryViewValue"),t=this.get("content"),n=this;return!e||!SC.kindOf(e,SC.View)||!e.isClass?null:(e=this.createChildView(e,{layerId:this.get("layerId")+"-accessory",layout:this._computeAccessoryLayout(e),classNames:["cw-accessory"],isEnabledBinding:SC.Binding.oneWay(".parentView.accessoryShouldBeEnabled")}),t&&t.get("isBindingAgent")&&(n=t),e.bindingAgent=n,e)},_computeAccessoryLayout:function(e){if(!e)return null;var t={},n=null,r=SC.typeOf(e);switch(r){case SC.T_OBJECT:n=e.get("layout");break;case SC.T_CLASS:n=e.prototype.layout;break;case SC.T_HASH:n=e.layout}return n=n||{},n?n.width?t.width=n.width:n.left?t.left=n.left:t.width=CW.SECTIONED_VIEW_CELL_DEFAULT_ACCESSORY_WIDTH:t.width=CW.SECTIONED_VIEW_CELL_DEFAULT_ACCESSORY_WIDTH,SC.none(n.centerY)?(t.top=n.top||0,t.bottom=n.bottom||0):(t.centerY=n.centerY,t.height=n.height||0),t.right=n.right||0,t},sectionedViewTapStartForEvent:function(e,t){var n=this.get("accessoryTypeValue"),r=this.get("isEnabledValue");return r&&n&&n.buttonHitTest(this,t)?(this._handlingRowTap=YES,this.set("accessoryTypeButtonActive",YES),YES):NO},sectionedViewTapEndForEvent:function(e,t){var n=this.get("accessoryTypeValue");return this._handlingRowTap?(n&&n.buttonHitTest(this,t)&&e.rowAccessoryButtonTappedAtIndexPath(this.get("indexPath")),this._handlingRowTap=NO,this.set("accessoryTypeButtonActive",NO),YES):NO}}),CW.SectionedViewRow=SC.Object.extend({owner:null,section:null,indexPath:null,cell:null,height:null ,allowsSelection:YES,isEnabled:YES,isEnabledBindingDefault:SC.Binding.oneWay(),content:null,selectedTarget:null,selectedAction:null,deselectedTarget:null,deselectedAction:null,accessoryButtonTappedTarget:null,accessoryButtonTappedAction:null,isBindingAgent:YES,isContent:function(){return!this.get("content")}.property("content").cacheable(),selected:function(e){var t=this.get("selectedTarget"),n=this.get("selectedAction");this.willRespondToSelectedAction(e),this.sendAction(e,t,n),this.didRespondToSelectedAction(e)},willRespondToSelectedAction:function(e){},didRespondToSelectedAction:function(e){},deselected:function(e){var t=this.get("deselectedTarget"),n=this.get("deselectedAction");this.willRespondToDeselectedAction(e),this.sendAction(e,t,n),this.didRespondToDeselectedAction(e)},willRespondToDeselectedAction:function(e){},didRespondToDeselectedAction:function(e){},accessoryButtonTapped:function(e){var t=this.get("accessoryButtonTappedTarget"),n=this.get("accessoryButtonTappedAction");this.willRespondToAccessoryButtonTappedAction(e),this.sendAction(e,t,n),this.didRespondToAccessoryButtonTappedAction(e)},willRespondToAccessoryButtonTappedAction:function(e){},didRespondToAccessoryButtonTappedAction:function(e){},sendAction:function(e,t,n){if(!n)return;var r=e.get("pane"),i=r.get("rootResponder");i.sendAction(n,t,this,r)}}),CW.SectionedViewButtonRow=CW.SectionedViewRow.extend({title:null,titleBindingDefault:SC.Binding.oneWay(),image:null,imageBindingDefault:SC.Binding.oneWay(),isEnabled:YES,isDefault:NO,isDefaultBindingDefault:SC.Binding.oneWay().bool(),cellstyle:null,cell:CW.SectionedViewCell .extend({style:CW.SectionedViewCellStyle.BUTTON,styleBinding:SC.Binding.transform(function(e){return SC.none(e)?CW.SectionedViewCellStyle.BUTTON:e}).from("*owner.cellStyle"),contentTextKey:"title",performKeyEquivalent:function(e,t){if(!this.get("isVisibleInWindow"))return NO;if(!this.get("isEnabled"))return NO;var n=this.get("content"),r=n.get("isDefault"),i=n.get("selectedAction"),s=n.get("selectedTarget");return r&&e==="return"&&n.sendAction(this.owner,s,i),NO}}),willRespondToSelectedAction:function(e){e.deselectRowAtIndexPath(this.get("indexPath"))}}),CW.SectionedViewSelectRow=CW.SectionedViewRow.extend({title:null,value:null,items:null,itemTitleKey:"title",itemImageKey:"image",itemValueKey:"value",style:CW.SectionedViewCellStyle.DEFAULT2,cell:CW.SectionedViewCell.extend({contentTextKey:"title",accessoryType:CW.SectionedViewCellAccessoryType.DISCLOSURE_INDICATOR}),_valueDidChange:function(){var e=this.get("value"),t=this.get("items"),n=t.length,r=this.get("itemTitleKey"),i=this.get("itemValueKey"),s=this.get("itemImageKey"),o=null,u;if(!i&&SC.typeOf(e)===SC.T_NUMBER&&e>=0&&e=0?n[r]:null},selectItemRow:function(e){var t=this.get("owner"),n=this.get("target"),r=this.get("action");this.set("selection",e._svcs_originalItem),this.invokeLast(function(){e.sendAction(t,n,r)})},sectionedViewDidSetupAllCells:function(e){this._selectionDidChange()},displayDelegateForRow:function(e){return e=this.rows[e],this._itemRows.indexOf(e)>=0?this:null}}),CW.SectionedViewCollectionSection._ItemRow=CW.SectionedViewRow.extend({selected:function(e){this.get("section").selectItemRow(this)}}),CW.SectionedView=SC.ScrollView.extend(CW.SectionedViewDelegate,CW.SectionedViewDataSource,CW.SectionedViewMonitor,{classNames:"cw-sectioned-view".w(),datasource:null,delegate:null,selection:null,allowsSelection:YES,rowHeight:44,style:null,sectionHeaderHeight:25,sectionFooterHeight:25,sectionHeaderViewExample:SC .LabelView,sectionFooterViewExample:SC.LabelView,headerView:null,footerView:null,headerHeight:18,footerHeight:18,rowCellExample:CW.SectionedViewCell,anchorLastSectionToBottom:NO,monitor:null,contentView:SC.View,styleValue:function(){var e=this.get("style");return e?e:CW.SectionedViewStyle.NONE}.property("style").cacheable(),sectionedViewDelegate:function(){var e=this.get("delegate");return this.delegateFor("isSectionedViewDelegate",e)}.property("delegate").cacheable(),sectionedViewDataSource:function(){var e=this.get("dataSource");return this.delegateFor("isSectionedViewDataSource",e)}.property("dataSource").cacheable(),sectionedViewMonitor:function(){var e=this.get("monitor");return this.delegateFor("isSectionedViewMonitor",e)}.property("monitor").cacheable(),reloadData:function(){this.clearSelection(),this._updateContentView(),this.invokeLast(function(){this.refreshLayout()})},reloadSection:function(e){var t=this._allSectionBlocks;if(!t)return;var n=t[e],r=n.get("views")||[],i=r.length,s=this.get("contentView"),o=s.get("childViews")||[],u=o.length,a=null,f=i>0?i[i-1]:null,l=o.indexOf(f);l>-1&&lt.length-1?null:(i=t[n],s=i.rows,!s||r>s.length-1?null:s[r])},cellForEvent:function(e){var t=e.target,n=this.get("layer"),r=t,i,s;while(r&&r!==n&&r!==document){if((s=r.id)&&(i=SC.View.views[s])&&i.isSectionedViewCell)return i;r=r.parentNode}return null},deselectRowAtIndexPath:function(e){if(!this.get("allowsSelection")||!e)return;if(!this.validIndexPath(e))return;this.clearSelection()},selectRowAtIndexPath:function(e){if(!this.get("allowsSelection")||!e)return;this.propertyWillChange("selection");var t=this.cellForRowAtIndexPath(e);if(!t)return;this.propertyWillChange("selection"),this.clearSelection(),t.set("isSelected",YES),this.set("selection",e),this.propertyDidChange("selection")},clearSelection:function(){var e=this.get("selection"),t;if(!e)return;t=this.cellForRowAtIndexPath(e),t&&t.set("isSelected",NO),this.set("selection",null)},validIndexPath:function(e){var t,n,r,i,s,o=this.get("sectionedViewDataSource");return e?(n=o.get("sections"),t=n?n.length:0,r=e.get("section"),r<0||r>=t?NO:(i=n[r].rows,t=i?i.length:0,s=e.get("row"),s<0||s>=t?NO:YES)):NO},rowTapStartAtIndexPath:function(e){if(!this.get("allowsSelection")||!this.validIndexPath(e))return;var t=this.get("sectionedViewDelegate"),n=this.get("selection"),r,i,s;s=this.cellForRowAtIndexPath(e);if(!s||!s.get("isEnabled"))return;r=t.sectionedViewWillSelectRowAtIndexPath(this,e),n&&(i=t.sectionedViewWillDeselectRowAtIndexPath(this,n)),s=this.cellForRowAtIndexPath (r);if(!s)return;this._rowTapInfo={selectIndexPath:r,deselectIndexPath:i,cell:s},s.set("isHighlighted",YES)},rowTapEndAtIndexPath:function(e){var t=this.get("sectionedViewDelegate"),n=this._rowTapInfo||{},r=n.selectIndexPath,i=n.deselectIndexPath,s;e&&e.equals(r)&&(this._removeHighlightFromTappedRow(),this.selectRowAtIndexPath(r),t.sectionedViewDidSelectRowAtIndexPath(this,r),i&&t.sectionedViewDidDeselectRowAtIndexPath(this,i),s=this.cellForRowAtIndexPath(i),s&&s.deselected(this),s=this.cellForRowAtIndexPath(r),s&&s.selected(this)),this._cleanupRowTap()},cancelRowTap:function(){this._cleanupRowTap()},_cleanupRowTap:function(){this._removeHighlightFromTappedRow(),this._rowTapInfo=null},_removeHighlightFromTappedRow:function(){var e=this._rowTapInfo||{},t=e.cell;t&&t.set("isHighlighted",NO)},rowAccessoryButtonTappedAtIndexPath:function(e){var t=this.get("sectionedViewDelegate");t.sectionedViewAccessoryButtonTappedForRowAtIndexPath(this,e)},render:function(e,t){var n=this.get("styleValue"),r=n.get("classNames");t&&e.addClass(r)},createChildViews:function(){return arguments.callee.base.apply(this,arguments),this.invokeLast(function(){this._setupContentView()},this),this},destroy:function(){this._tearDownContentView(),arguments.callee.base.apply(this,arguments)},_updateContentView:function(){var e=this.get("sectionedViewMonitor");e.sectionedViewWillUpdateContentView(this),this._tearDownContentView(),this._setupContentView(),e.sectionedViewDidUpdateContentView(this)},_setupContentView:function(){var e=this.get("contentView"),t=this.get("sectionedViewMonitor"),n=this.get("sectionedViewDelegate" ),r=[];t.sectionedViewWillSetupContentView(this),n.sectionedViewWillSetupAllCells(this),this._headerBlock=this._createHeaderBlock(),this._footerBlock=this._createFooterBlock(),this._sectionBlocks=this._createSectionBlocks();var i=[];i.push(this._headerBlock),i.pushObjects(this._sectionBlocks),i.push(this._footerBlock),this._blocks=i,i.forEach(function(e){e.setup(),r.pushObjects(e.get("views"))}),e.beginPropertyChanges();var s=this.get("styleValue"),o=s.get("contentLayout");e.adjust({right:o.right||0,left:o.left||0}),e.set("childViews",r),e.endPropertyChanges(),this._readjustAllBlocks(),e.replaceLayer(),n.sectionedViewDidSetupAllCells(this),t.sectionedViewDidSetupContentView(this)},_frameDidChange:function(){var e=this._readjustAnchoredBottomBlocks();if(e){var t=this.get("contentView");t.adjust("height",e)}}.observes("frame"),_heightOfAllBlocksWithPadding:function(){var e=this.get("styleValue"),t=e.get("contentLayout"),n=t.top||0,r=t.bottom||0;return this._heightOfAllBlocks()+n+r},_heightOfAllBlocks:function(){var e=this._blocks,t=e?e.length:0;return this._heightOfBlocksToIndex(t-1)},_heightOfBlocksToIndex:function(e){var t=this._blocks,n=t?t.length:0,r=0;if(e>=n)throw"invalid index: "+e;for(var i=0;i<=e;i+=1)r+=t[i].get("height");return r},_heightOfBlocksFromIndex:function(e){var t=this._blocks,n=t?t.length:0,r=0;if(e>=n)throw"invalid index: "+e;for(var i=e;i=r)return;this._readjustBlockRegion(e,r-1,t)},_readjustAnchoredBottomBlocks:function(){if(!this.get("anchorLastSectionToBottom"))return;var e=this.get("sectionedViewDataSource"),t=e.numberOfSectionsInSectionedView(this),n=this.get("frame").height,r=this._blocks;if(!r)return;var i=r.length;if(t<2)return;var s=i-2;if(this._heightOfAllBlocksWithPadding()>=n){this._readjustBlockFromIndex(s);return}var o=this.get("styleValue"),u=o.get("contentLayout"),a=u.bottom||0,f=this._heightOfBlocksFromIndex(s);return top=n-f-a,this._readjustBlockRegion(s,i-1,top),n},_readjustBlockRegion:function(e,t,n){var r=this._blocks,i=r.length;if(e<0||t>=i)throw"invalid argument provided";var s=n>=0;for(var o=e;o<=t;o+=1){var u=r[o],a=o-1>=0?r[o-1]:null,f=a?a.get("top")+a.get("height"):0;s||(n=a?f:0),u.readjustFromTop(n),s=!1}},_createHeaderBlock:function(){return CW.SectionedViewHeaderBlock.create({sectionedView:this})},_createFooterBlock:function(){return CW.SectionedViewFooterBlock.create({sectionedView:this})},_createSectionBlocks:function(){var e=this.get("sectionedViewDataSource"),t=e.numberOfSectionsInSectionedView(this),n=[],r=[],i;for(var s=0;s3&&(this._touchStartInfo=null,this.cancelRowTap()),YES):YES},touchEnd:function(e){var t=e.averagedTouchesForView(this),n=this._touchStartInfo;return n&&(n.handled?this._handleTapEndForEvent(e):n.touchDragged||this.invokeLater(function(){this._handleTapStartForEvent(n.event),this.invokeLater(function(){this._handleTapEndForEvent(e)},100)},10)),this._touchStartInfo=null,arguments.callee.base.apply(this,arguments)},_handleTouchStart:function(){var e=this._touchStartInfo;if(!e)return;e.handled=YES,this._handleTapStartForEvent(e.event)},_handleTapStartForEvent:function(e){var t={};this._tapStartInfo=t;var n=this.cellForEvent(e);return n?(t.cell=n,n.tryToPerform("sectionedViewTapStartForEvent" ,this,e)?(t.cellHandlingRowTap=YES,YES):(this.rowTapStartAtIndexPath(n.get("indexPath")),YES)):(this._tapStartInfo=null,NO)},_handleTapEndForEvent:function(e){if(!this._tapStartInfo)return NO;var t=this._tapStartInfo,n=t.cell,r;return this._tapStartInfo=null,t.cellHandlingRowTap&&n.sectionedViewTapEndForEvent?n.sectionedViewTapEndForEvent(this,e):(n=this.cellForEvent(e),n&&(r=n.get("indexPath")),this.rowTapEndAtIndexPath(r),YES)},_cw_sv_isEnabledChanged:function(){var e=this._sectionBlocks||[],t=this.get("isEnabled");e.forEach(function(e){var n=e.rows||[];n.forEach(function(e){e.set("isEnabledInSectionedView",t)})})}.observes("isEnabled")}),CW.IndexPath=SC.Object.extend(SC.Copyable,{section:null,row:null,copy:function(e){return CW.IndexPath.create({section:this.get("section"),row:this.get("row")})},equals:function(e){return!e||!SC.kindOf(e,CW.IndexPath)?NO:CW.IndexPath.compare(this,e)===0},toString:function(){var e=this.get("row"),t=this.get("section");return"IndexPath(row: %@, section: %@)".fmt(e,t)}}),CW.IndexPath.mixin(SC.Comparable,{compare:function(e,t){var n=SC.kindOf(e,CW.IndexPath),r=SC.kindOf(t,CW.IndexPath);if(!n&&!r)throw"Can not compare. a and b must both be of type CW.IndexPath";return e.get("section")==t.get("section")?e.get("row")===t.get("row")?0:e.get("row")=0&&u5?this.dismiss():this.animateToTop(),this._mouseDragUpwardsCount=null):(this._icon&&(this._spinner.src=window.devicePixelRatio>1?"/system/cloudos/1812Project43/coreweb/apple_theme_v4/1812Project43/en-us/source/resources/ios/notification/images/ios_notification_spinner@2x.gif":"/system/cloudos/1812Project43/coreweb/apple_theme_v4/1812Project43/en-us/source/resources/ios/notification/images/ios_notification_spinner.gif",CW.Anim.Fader.create(CW.Anim.DisplayNoneAtZero,{element:this._icon,to:0,duration:200}).start(),CW.Anim.Fader.create(CW.Anim.DisplayNoneAtZero,{element:this._spinner,to:1,duration:200}).start()),this.get("action")(this))},mouseUp:function(e){if(!this._mask)return;this._isClicked=NO,this._prevEvt=null,this._hideMask();var t=this.get("frame"),n=this.convertFrameFromView({x:e.pageX,y:e.pageY});if(!t||n.x<0||n.y<0||n.x>t.width||n.y>t.height)return;this.dismissOrAnimateNotificationOnMouseClickAndDrag(e)},mouseMoved:function(e,t){return e(t),this.get("dismissNotificationOnMouseClickAndDrag")&&this._isClicked&&this._prevEvt?(!this._mouseDragUpwardsCount||this._mouseDragUpwardsCount>0?(this.adjust("top",this.get("frame").y+t.pageY-this._prevEvt.pageY),this._mouseDragUpwardsCount?this._mouseDragUpwardsCount-=t.pageY-this._prevEvt.pageY:this._mouseDragUpwardsCount=this._prevEvt.pageY';var r=this.get("message"),i=this._adornStringWithArrowIfNeeded(this._lastDesc=this.get("description"));this._lastMess=r,e.push(''),e.push('
'+r+"
"),e.push('
'+i+"
"),this.get("action")&&e.push('"),this.adjust("zIndex",this.get("isDismissable")?CW.iOSNotification.runningDismissableZIndex++:CW.iOSNotification.runningNonDismissableZIndex++)},displayProperties:"message description icon maxWidth".w(),update:function(){var e,t,n;this._lastMess!==(this._lastMess=e=this.get("message"))&&(this.$(".message")[0].innerHTML=e),this._lastDesc!==(this._lastDesc=t=this.get("description"))&&(this.$(".description")[0].innerHTML=this._adornStringWithArrowIfNeeded(t),n=YES),this.didChangeFor("update","maxWidth")&&(n=YES),n&&this.invokeLast("finishLayerDependentRendering")},didCreateLayer:function(){this._mask=this.$(".mask")[0],this._spinner=this.$(".spinner")[0],this._mask&&CW.Anim.setOpacity(this._mask,0),this._spinner&&CW.Anim.setOpacity(this._spinner,0),this.$(".description")[0].cacheableForMetrics=YES,this.windowResized(),this.get("automaticallyDismiss")&&this.invokeLater(function(){this.get("automaticallyDismiss")&&this.dismiss(YES)},CW.NOTIFICATION_AUTOMATICALLY_DISMISS_DELAY )},finishLayerDependentRendering:function(){var e=this.get("frame"),t=this.get("layer"),n,r=this.get("icon"),i,s,o,u,a=SC.Locale.currentLocale.get("isRTL");this._lastIconInput!==(this._lastIconInput=r)&&((n=this._icon)&&n.parentNode&&n.parentNode.removeChild(n),this._icon=null);if(!(n=this._icon))if(typeof r=="string"&&r.indexOf("/")!==-1){n=new Image,this._icon=n,n.src=r;var f="z-index:3; position:absolute; "+(a?"right":"left")+":"+this.get("iconInset")+"px; width:"+this.get("iconWidth")+"px; height:"+(o=this.get("iconHeight"))+"px; margin-top:-"+(Math.ceil(o/2)+1)+"px; top:50%;";n.style.cssText=f,n.setAttribute("aria-hidden",!0),t.appendChild(n)}else if(r){typeof r=="string"&&(n=document.createElement("div"),n.className=r,this._icon=n),i=(this._icon||(this._icon=n=r)).style,i.position="absolute";var l=this.get("iconInset")+"px";a?i.right=l:i.left=l,i.top="50%",i.zIndex="3",n.setAttribute("aria-hidden",!0),t.appendChild(n),this.invokeOnce(function(){var e,t;this.set("iconWidth",e=parseInt(jQuery(n).css("width"),0)||this.get("iconWidth")),this.set("iconHeight",t=parseInt(jQuery(n).css("height"),0)||this.get("iconHeight")),i.marginTop=-Math.ceil(t/2)+"px"})}else{this.get("iconWidth")&&this.set("iconWidth",s=0),this.get("iconHeight")&&this.set("iconHeight",o=0);if(u=this._separator)u.parentNode&&u.parentNode.removeChild(u),this._separator=undefined}this.invokeOnce("sizeToText")},sizeToText:function(){var e=this._textDistanceFromDismissButton,t,n,r,i,s=19,o=0,u=0,a=0,f=0,l=0,c=6,h=SC.Locale.currentLocale.get("isRTL");t=2*this.get("iconInset")+this.get("iconWidth")-1,textDistanceFromIconString= t+"px";if(r=this._message||(this._message=this.$(".message")[0])){var p=r.style;h?p.right=textDistanceFromIconString:p.left=textDistanceFromIconString,o=SC.bestStringMetricsForMaxWidth(r.innerHTML,this.get("maxWidth")-t-e,r,undefined,!0),u=o.height+!!SC.browser.mac*4+!!SC.browser.windows*1,r.style.height=u+"px",o=o.width}if(i=this._description||(this._description=this.$(".description")[0])){var d=i.style;h?d.right=textDistanceFromIconString:d.left=textDistanceFromIconString,a=SC.bestStringMetricsForMaxWidth(i.innerHTML,this.get("maxWidth")-t-e,i,undefined,!0),f=a.height,a=a.width,l=(u||-1)+6+2*!!SC.browser.mozilla,i.style.top=l+"px",i.style.height=f+"px"}var v=Math.max(this.MIN_HEIGHT,c+l+f);this.get("iconHeight")&&(v=Math.round(v/2)*2+(this.get("iconHeight")%2!==0)),this.adjust({width:Math.max(this.MIN_WIDTH,t+e+a,t+e+o),height:v})},animateShow:function(){var e=CW.PaneAnimationSupport.animateShow,t=arguments;this.invokeLast(function(){e.apply(this,t)})},contentView:SC.ImageButtonView.extend(SC.RTLSupport,{classNames:"dismiss".w(),init:function(e){this.set("toolTip","Button.Close".loc()),e()}.enhance(),layoutRecipe:{width:16,height:16,end:6,centerY:0},action:"dismiss"}),append:function(){return this.set("hasBeenSeen",YES),this._isAppended=YES,this.appendTo(this.get("notificationContainer"))},remove:function(){var e=arguments.callee.base.apply(this,arguments);return this._isAppended=NO,CW.iOSNotification.notificationWasRemoved(this),e},replaceWith:function(e){CW.iOSNotification.replaceNotificationWithNotification(this,e)},init:function(){this.get("isDismissable")||(this.contentView= null);var e=this.get("rightMarginForMessageText");e!==undefined&&(this._textDistanceFromDismissButton=e),arguments.callee.base.apply(this,arguments)},_adornStringWithArrowIfNeeded:function(e){return this.get("shouldAdornEndingDescriptionLinkWithArrow")?e?(e.substring(e.length-4)===""&&(e=e.substring(0,e.length-4)+''),e.substring(e.length-5)==="."&&(e=e.substring(0,e.length-5)+'.'),e):"":e}}),SC.mixin(CW.iOSNotification,{runningDismissableZIndex:2e3,runningNonDismissableZIndex:1e3,show:SC.RunLoop.wrapFunction(function(e){var t=e.isIOSNotification?e:this._simpleCreate.apply(this,arguments);return t.append(),t}),queue:[],enqueue:function(e){var t=e.isIOSNotification?e:this._simpleCreate.apply(this,arguments);return t._isInQueue=YES,this.queue.unshift(t),this.updateToQueue(),t},updateToQueue:SC.RunLoop.wrapFunction(function(){var e=this.queue;if(!e.length)return;var t=e[e.length-1];t._isAppended||t.append()}),notificationWasRemoved:function(e){if(this._ignoreRemovals)return;for(var t=0,n=this.queue;this.queue[t];t++)n[t]===e&&n.splice(t,1);this.updateToQueue()},replaceNotificationWithNotification:function(e,t){for(var n=0,r=this.queue,i;i=r[n];n++)if(i===e){r[n]=t,n===r.length-1&&(this._ignoreRemovals=YES,e.remove(),this._ignoreRemovals=NO,t.append());break}},_simpleCreate:function(e,t,n,r,i){var s;return typeof e=="object"?s=this.create.apply(this,arguments):s=this.create({message:e,description:t,icon:n,isDismissable:r!==NO,parentElement:i}),s}}),CW.TouchScrollerView=SC .TouchScrollerView.extend({touchScrollDidStart:function(){arguments.callee.base.apply(this,arguments),this.$(".thumb").css("opacity",.5)},touchScrollDidEnd:function(){arguments.callee.base.apply(this,arguments),this.$(".thumb").css("opacity",0)}}),SC.ScrollView.prototype.verticalTouchScrollerView=CW.TouchScrollerView,SC.ScrollView.prototype.horizontalTouchScrollerView=CW.TouchScrollerView,function(){var e="cloudkit/first_run";if(!SC.MODULE_INFO)throw"SC.MODULE_INFO is not defined!";if(SC.MODULE_INFO[e])return;SC.MODULE_INFO[e]=SC.Object.create({dependencies:["coreweb/timezone_picker","cloudkit/photo"],styles:["/system/cloudos/1812Project43/cloudkit/first_run/1812Project43/en-us/stylesheet.css"],styles2x:["/system/cloudos/1812Project43/cloudkit/first_run/1812Project43/en-us/stylesheet@2x.css"],scriptURL:"/system/cloudos/1812Project43/cloudkit/first_run/1812Project43/en-us/javascript.js",stringURL:"/system/cloudos/1812Project43/cloudkit/first_run/1812Project43/en-us/javascript-strings.js",isPrefetched:YES})}(),function(){var e="coreweb/timezone_picker";if(!SC.MODULE_INFO)throw"SC.MODULE_INFO is not defined!";if(SC.MODULE_INFO[e])return;SC.MODULE_INFO[e]=SC.Object.create({dependencies:[],styles:["/system/cloudos/1812Project43/coreweb/timezone_picker/1812Project43/en-us/stylesheet.css"],styles2x:["/system/cloudos/1812Project43/coreweb/timezone_picker/1812Project43/en-us/stylesheet@2x.css"],scriptURL:"/system/cloudos/1812Project43/coreweb/timezone_picker/1812Project43/en-us/javascript.js",stringURL:"/system/cloudos/1812Project43/coreweb/timezone_picker/1812Project43/en-us/javascript-strings.js" ,isPrefetched:YES})}(),function(){var e="cloudkit/photo";if(!SC.MODULE_INFO)throw"SC.MODULE_INFO is not defined!";if(SC.MODULE_INFO[e])return;SC.MODULE_INFO[e]=SC.Object.create({dependencies:[],styles:[],styles2x:[],scriptURL:"/system/cloudos/1812Project43/cloudkit/photo/1812Project43/en-us/javascript.js",stringURL:"/system/cloudos/1812Project43/cloudkit/photo/1812Project43/en-us/javascript-strings.js",isPrefetched:YES})}(),COS=SC.Object.create({NAMESPACE:"COS",VERSION:"1.0.0",init:function(){arguments.callee.base.apply(this,arguments),this.setupMinWidthAndHeight(),this.statsController=CK.StatsController.create({statSessionId:this.statSessionId,includedParams:function(){var e=COS.authController,t=e.getPath("user.isLiteAccount"),n=e.get("signupOriginApp"),r={},i=window.CloudOSBootstrap&&CloudOSBootstrap.isTermsAndConditionUrl&&URI(window.location.href).hash().split("/").lastObject()==="gc";return SC.none(t)||(r.isLiteAccount=t),SC.none(n)||(r.originApp=n),i&&(r.isGameCenterTermsUrl=!0),r}.property("COS.authController.user")}),CK.errorCatcher.exceptionCallback=function(e){COS.statsController.recordStat(e.applicationName,"ErrorReport",{errorType:e.origin})},this.scheduleStatSessionIdUpdateTimer()},CLIENT_ID:CW.upperCaseUUID(),statSessionId:CW.upperCaseUUID(),REVALIDATE_INTERVAL:1800,REFRESH_WEB_AUTH_INTERVAL:1500,STAT_SESSION_ID_UPDATE_INTERVAL:28800,PUSH_RETRY_WAIT:10,MIN_WIDTH:null,DESKTOP_MIN_WIDTH:950,MOBILE_MIN_WIDTH:320,MIN_HEIGHT:null,DESKTOP_MIN_HEIGHT:700,MOBILE_MIN_HEIGHT:460,MAX_VALIDATE_RETRIES:1,MAX_LOGIN_RETRIES:1,MAX_PREFERENCES_RETRIES:1,setupMinWidthAndHeight:function( ){window.CloudOSBootstrap&&CloudOSBootstrap.isOnSupportedMobile?(this.MIN_WIDTH=this.MOBILE_MIN_WIDTH,this.MIN_HEIGHT=this.MOBILE_MIN_HEIGHT):(this.MIN_WIDTH=this.DESKTOP_MIN_WIDTH,this.MIN_HEIGHT=this.DESKTOP_MIN_HEIGHT)},FONT_CHECK_DURATION:4,getCredentialsFromHash:function(){var e=window.location.hash.match(/:(.*?)(\/.*)?$/);if(!e)return null;var t=URI.parseQuery(e[1]),n=null,r=t.user||t.username,i=t.pass||t.password,s=!!t.extended||!!t.extendedLogin;if(r&&i){n={username:r,extendedLogin:s};if(SC.buildMode==="production"&&!CK.readCookie("ALLOW_CREDENTIALS"))return SC.warn("Ignoring credentials in URL hash"),n;n.password=i}return n},handleApplicationCrash:function(e){CK.errorCatcher._handleError(e)},cloudOSStateForApp:function(e){var t=COS.authController,n=COS.regionController,r=CK.meCardController,i=t.get("accountPreferences"),s=COS.appsController.getAppInfoFor(e),o=t.get("secureChannelInfoData"),u={authBag:t._auth_bag,meCard:r?r.get("meCard"):null,quotaData:t._quota_data,versions:window.VERSIONS,regionFormattingRules:n.regionFormattingRules,regionFormattingRulesVersion:n.localeVersion,regionFormattingRulesBaseUrl:n.localeURL,accountPreferences:i?i.prefsHash(YES):null,appPreferences:COS.prefsController.allAppPreferencesHash(),accountMenu:{items:[{title:"AccountMenu.AccountSettings".loc(),target:"CloudOS",action:"showAccountSettings",disableWhenCurrentApp:"settings"},{title:"AccountMenu.SignOut".loc(),target:"CloudOS",action:"performLogout"}],width:200},requestedStartupUrl:s?s.get("requestedStartupUrl"):null,requestedStartupInfo:s?s.get("requestedStartupInfo"):null,environment :t.get("environment"),route:function(){if(CloudOS.appManagerFor)return CloudOS.appManagerFor(e).get("route");var t=window.location.hash,n=t?t.substring(1):null;return n}(),displayName:function(){if(CloudOS.appManagerFor)return CloudOS.appManagerFor(e).get("displayName")}(),currentlyActiveApplication:e,hostname:CloudOS.get("hostname")||window.location.hostname,clientId:this.CLIENT_ID,userAuthenticationState:t.get("userAuthenticationState"),appsInfo:function(){var e=COS.apps,t=[],n,r;for(n in e){r=COS.appsController.getAppInfoFor(n);if(!r){SC.warn("No appInfo for %@",n);continue}t.push(CK.AppInfo.serializeAsHash(r))}return t}(),userStatusCode:t.getPath("user.statusCode"),isBeta:CK.get("isBeta"),isFuture:CK.get("isFuture"),isCarry:CK.get("isCarry"),isCarryUser:t.get("isCarryUser"),availableLocales:this.filterLocales(COS.get("availableLocales")),localesSupportedByAllApps:this.filterLocales(COS.get("localesSupportedByAllApps")),pushToken:COS.pushController?COS.pushController.get("pushToken"):null,mininumWindowSize:{minWidth:COS.MIN_WIDTH,minHeight:COS.MIN_HEIGHT},isOnSupportedMobile:window.CloudOSBootstrap&&CloudOSBootstrap.isOnSupportedMobile,secureChannelInfoData:o,additionalClassNamesForBody:function(){var e,t;if(CloudOS.getUser&&CloudOS.getUser().get("isChineseAccount")||COS.authController&&COS.authController.getPath("user.isChineseAccount"))e="cn";return e}(),defaultAssetHostname:t.get("defaultAssetHostname")};return u},filterLocales:function(e){if(!e)return e;var t=[];for(var n=e.length;n--;){var r=e[n];t[n]={locale:r.locale,dispName:r.dispName}}return t},lastBenchmarkDurationFor :function(e){var t=SC.Benchmark._statFor(e);if(!t||!t._times||t._times.length===0){SC.warn("Cannot find stats for %@",e);return}return t._times[t._times.length-1].dur},localeMap:[{dispName:"English (U.S.)",locale:"en-us"},{dispName:"Español",locale:"es-es"},{dispName:"Français",locale:"fr-fr"},{dispName:"Deutsch",locale:"de-de"},{dispName:"简体中文",locale:"zh-cn"},{dispName:"日本語",locale:"ja-jp"},{dispName:"Nederlands",locale:"nl-nl"},{dispName:"Italiano",locale:"it-it"},{dispName:"한국어",locale:"ko-kr"},{dispName:"繁體中文",locale:"zh-tw"},{dispName:"Português (Brasil)",locale:"pt-br"},{dispName:"Português (Portugal)",locale:"pt-pt"},{dispName:"Svenska",locale:"sv-se"},{dispName:"Polski",locale:"pl-pl"},{dispName:"Dansk",locale:"da-dk"},{dispName:"Suomi",locale:"fi-fi"},{dispName:"Norsk bokmål",locale:"no-no"},{dispName:"Русский",locale:"ru-ru"},{dispName:"العربية",locale:"ar-sa"},{dispName:"Türkçe",locale:"tr-tr"},{dispName:"ภาษาไทย",locale:"th-th"},{dispName:"Українська",locale:"uk-ua"},{dispName:"Hrvatski",locale:"hr-hr"},{dispName:"Čeština",locale:"cs-cz"},{dispName:"Ελληνικά",locale:"el-gr"},{dispName:"עברית",locale:"iw-il"},{dispName:"Română",locale:"ro-ro"},{dispName:"Slovenčina",locale:"sk-sk"},{dispName:"Magyar",locale:"hu-hu"},{dispName:"Bahasa Indonesia",locale:"id-id"},{dispName:"Bahasa Melayu",locale:"ms-my"},{dispName:"English (Australia)",locale:"en-au"},{dispName:"English (Canada)",locale:"en-ca"},{dispName:"English (New Zealand)",locale:"en-nz"},{dispName:"English (U.K.)",locale:"en-gb"},{dispName:"Català",locale:"ca-es"},{dispName:"Tiếng Việt",locale:"vi-vi"},{dispName :"हिन्दी",locale:"hi-in"},{dispName:"Français (Canada)",locale:"fr-ca"},{dispName:"Español (México)",locale:"es-mx"}],localesSupportedByAllApps:function(){var e=window.supportedLocales,t=this.get("localeMap"),n=t.getEach("locale"),r=[];return e.map(function(e){var i=n.indexOf(e);i!=-1&&r.push(SC.Object.create(t[i]))}),r}.property("localeMap"),localesSupportedByCloudOSOnly:function(){return window.supportedLocales.concat(["ar-sa","iw-il"]).uniq()}.property(),availableLocales:function(){var e=window.supportedLocales,t=this.get("localesSupportedByAllApps"),n,r,i=this.get("localeMap"),s=COS.authController.getPath("accountPreferences"),o=s?s.get("locale"):null,u=s?s.get("secondaryLocale"):null,a=COS.apps,f;for(f in COS.apps){var l=COS.appsController.getAppInfoFor(f);if(!l){SC.warn("No appInfo for %@",f);continue}var c=l.get("supportedLocales"),h=t.getEach("locale");if(c)for(n=0,r=i.length;nCK.AuthenticationStateEnum.NOT_AUTHENTICATED}.property("userAuthenticationState"),isAuthenticated:function(){return this.get("userAuthenticationState")===CK.AuthenticationStateEnum.AUTHENTICATED}.property("userAuthenticationState"),clearUserState:function(){var e=this._user_cache;e&&e.destroy(),this._auth_bag=null,this._quota_data=null,this.set("secureChannelInfoData",null),this._user_cache=null,this._quotaInfo_cache=null,this._account_preferences_cache=null,this._secure_channel_info_cache= null,this._lastDsidCookie=null,this._validateUserTimer&&(this._validateUserTimer.invalidate(),this._validateUserTimer=null),window.CloudOS&&!CloudOS.isCloudOSClient&&CK.currentApplication._clearUserState(),CK.writeCookie("X-APPLE-WEB-ID",null,null,this.get("currentDomain"),null,YES),CK.removeValueInSessionStorage("redirectedToCarry"),CK.removeValueInSessionStorage("pushToken"),CK.removeValueInSessionStorage("username"),CK.tryToPerform("clearLocalStorage"),this.set("userAuthenticationState",CK.AuthenticationStateEnum.NOT_AUTHENTICATED),this.set("isLoggingIn",NO),this.set("isLoggingOut",NO),this.set("isExtendedLogin",NO),this.set("authBagLoadedFromOpenerWindow",NO),this.set("accountTermsUpdateRequired",NO),this.set("repairPayload",null)},scheduleValidateUserTimer:function(){this._validateUserTimer||(this._validateUserTimer=SC.Timer.schedule({target:this,action:function(){var e=COS.authController;e.set("isRevalidatingUser",YES),e.validateUser(function(){e.set("isRevalidatingUser",NO)},YES)},interval:COS.REVALIDATE_INTERVAL*1e3,repeats:YES}))},validateUser:function(e,t){var n=this.get("delegate"),r=this,i=this.get("validateUrl"),s;s=COS.Request.postUrl(i,null),s.set("reportRequest",YES),s.notify(200,this,function(i){var s=i.get("body"),o=r._processReceivedBag(s),u;if(!o||!o.dsInfo||!o.webservices)return SC.debug("Missing critial information in bag: %@",s),SC.debug("COS: invoking validateDidFail"),r.invokeDelegateMethod(n,"validateDidFail",i,o),YES;if(o.termsUpdateNeeded)return SC.debug("Terms update is still required, hence marking this validate call as failure"),NO;var a=o.configBag ;a&&CW.notificationCenter.postNotification("configBagReceived",a),u=o.dsInfo,u.dsid||(u.dsid=u.dsPrsID,delete u.dsPrsID);var f=SC.clone(r._auth_bag);return r._auth_bag=o,r._user_cache=null,r.notifyPropertyChange("user"),r.set("isLoggingIn",NO),r.setUserAuthenticationStatus(o.hsaChallengeRequired,o.dsInfo.isManagedAppleID,YES),r._authCompleted(o,e,NO,i)&&(SC.debug("COS: invoking validateDidSucceed with body %@",o),r.invokeDelegateMethod(n,"validateDidSucceed",o,f,t),r.monitorForUsernameChange()),YES}),s.notify(0,this,function(i){var s=i.get("body"),o=i.get("status"),u=r._processReceivedBag(s),a=u&&u.configBag,f=u&&u.hsaChallengeRequired,l=u&&u.dsInfo&&u.dsInfo.isManagedAppleID;return u&&!u.termsUpdateNeeded&&!f&&!l&&o===200?NO:(a&&CW.notificationCenter.postNotification("configBagReceived",a),r.set("isLoggingIn",NO),r.setUserAuthenticationStatus(f,l,NO),r.set("accountTermsUpdateRequired",NO),SC.debug("COS: invoking validateDidFail"),r.invokeDelegateMethod(n,"validateDidFail",i,u,t),e instanceof Function&&e(NO,NO,s,o),r.monitorForUsernameChange(),YES)}),this.set("isLoggingIn",YES),SC.debug("COS: Sending validate POST request to %@",i),this.invokeDelegateMethod(n,"validateRequestWillBeSent"),s.send()},loginUser:function(e,t,n,r,i){var s=this.get("loginUrl"),o=COS.Request.postUrl(s,null),u=this.get("delegate"),a=this;o.set("reportRequest",YES),i||o.queryParameter("dsid",null),o.notify(200,this,this.loginUserDidSucceed,u,r,i),o.notify(0,this,this.loginUserDidFail,u,r,i),a.set("isLoggingIn",YES);var f=SC.clone(this.get("customLoginBody"));f.apple_id=e,f.password=t,SC.none(n)||(f.extended_login= n),this.set("isLoggingIn",YES),SC.debug("CloudKit: Sending login POST request to %@",s),this.invokeDelegateMethod(u,"loginRequestWillBeSent"),o.send(f)},loginUserDidSucceed:function(e,t,n,r){var i=e.get("body"),s=this._processReceivedBag(i),o;if(!s||!s.dsInfo||!s.webservices)return SC.debug("Missing critial information in bag: %@",i),SC.debug("COS: invoking loginDidFail"),this.invokeDelegateMethod(t,"loginDidFail",e,s),YES;o=s.dsInfo,o.dsid||(o.dsid=o.dsPrsID,delete o.dsPrsID);var u=SC.clone(this._auth_bag);return u&&!r&&o.dsid===u.dsInfo.dsid&&s.hsaChallengeRequired&&u.hsaChallengeRequired===s.hsaChallengeRequired?(SC.debug("Same auth bag as before completing HSA flow: %@",i),SC.debug("COS: invoking loginDidFail"),this.invokeDelegateMethod(t,"loginDidFail",e,s),YES):(this._auth_bag=s,this.notifyPropertyChange("user"),this.set("isLoggingIn",NO),this.setUserAuthenticationStatus(s.hsaChallengeRequired,s.dsInfo.isManagedAppleID,YES),this.set("repairPayload",s.isRepairNeeded&&s.repairPayload),this.set("accountTermsUpdateRequired",s.termsUpdateNeeded),this._authCompleted(s,n,YES,e)&&(SC.debug("COS: invoking loginDidSucceed"),this.invokeDelegateMethod(t,"loginDidSucceed",s),this.monitorForUsernameChange()),r&&this.set("secondaryLoginAttemptsCount",0),YES)},loginUserDidFail:function(e,t,n,r){var i=e.get("body"),s=this._processReceivedBag(i),o=s&&s.hsaChallengeRequired,u=s&&s.dsInfo&&s.dsInfo.isManagedAppleID;return this.set("isLoggingIn",NO),r?this.secondaryLoginAttemptsCount>=3?(SC.info("CloudKit: More than three invalid secondary auth attempts, make sure we log out"),this.logoutUser (function(){CK.reloadWithReason("more than 3 secondaryLoginAttemptsCount")},YES)):r&&n instanceof Function&&n(NO,YES,e):(this.setUserAuthenticationStatus(o,u,NO),this.set("accountTermsUpdateRequired",NO),SC.debug("COS: invoking loginDidFail"),this.invokeDelegateMethod(t,"loginDidFail",e,s)),YES},logoutUser:function(e,t,n){if(this.get("isLoggingOut")){SC.warn("User is already being logged out. Ignoring new logout call.");return}CK.get("isCarry")&&!e&&(e=function(){CK.reloadWithReason("Logging Out From Carry")});if(t&&COS.pushController){var r=this;COS.pushController.unInitializePush(function(){r.sendLogoutRequest(e,t,n)})}else this.sendLogoutRequest(e,t,n);CW.notificationCenter.postNotification("logoutUser")},sendLogoutRequest:function(e,t,n){var r=this.get("logoutUrl"),i=this.get("delegate"),s=this,o,u={};t||(r=URI(r).addSearch("onunload","true").toString()),n&&(u.allBrowsers=!0),this.getPath("user.hsaEnabled")&&(u.trustBrowser=this.get("hsaTrustedBrowser")),this.set("isLoggingOut",YES),o=COS.Request.postUrl(r,null),o.set("timeout",null),o.set("useCrossDomain",YES),this._shouldRetryLogout&&COS.statsController.recordStat("cloudos","LogoutRetry",{isExplicit:t}),o.notify(200,this,function(t){return s.set("isLoggingIn",NO),s.setUserAuthenticationStatus(null,null,NO),s.set("accountTermsUpdateRequired",NO),SC.debug("CloudKit: invoking logoutDidSucceed"),s.invokeDelegateMethod(i,"logoutDidSucceed"),s.clearUserState(),s.invokeDelegateMethod(s.get("delegate"),"userDidLogout",YES),e instanceof Function&&e(t),YES}),o.notify(0,this,function(r){s.set("isLoggingIn",NO),s.setUserAuthenticationStatus (null,null,NO),s.set("accountTermsUpdateRequired",NO);if(!s._shouldRetryLogout){SC.debug("CloudKit: Logging out did fail, will retry once"),s._shouldRetryLogout=YES,s.sendLogoutRequest(e,t,n);return}return SC.debug("CloudKit: invoking logoutDidFail"),s.invokeDelegateMethod(i,"logoutDidFail",r),s.clearUserState(),e instanceof Function&&e(r),YES}),SC.debug("CloudKit: Sending logout POST request to %@",r),this.invokeDelegateMethod(i,"logoutRequestWillBeSent"),o.send(u)},secondaryLoginAttemptsCount:0,secondaryLogin:function(e,t,n,r,i){this.secondaryLoginAttemptsCount++,this.loginUser(e,t,n,function(e,t,n){if(i instanceof Function){i(e,t,n);return}if(!r)return;var s=e?"secondaryAuthDidSucceed":"secondaryAuthDidFail",o,u=CK.currentApplication;u?(o=u.get("delegate"),u.invokeDelegateMethod(o||u,s)):CloudOS.appManagerFor(r).passMessage(s)},YES)},getQuotaData:function(e){var t=this.get("quotaUrl"),n=COS.Request.postUrl(t,null),r=this;n.set("reportRequest",YES),n.notify(200,this,function(t){var n=t.get("body"),i={},s,o={familyStorageUsageInfo:!0,storageUsageByMedia:!0};for(s in n){var u=n[s];if(SC.typeOf(u)===SC.T_HASH&&!o[s]){var a;for(a in u)i[a]=u[a]}else i[s]=n[s]}return r._quota_data=i,r._quotaInfo_cache=null,CW.notificationCenter.postNotification("quotaDataFetched",r.get("quotaInfo"),i),e&&e instanceof Function&&e(n),YES}),n.notify(0,this,function(e){return SC.warn("Could not get Quota Data"),YES}),n.send()},getConfigBagUrlForKey:function(e){var t=this._auth_bag,n=t.configBag,r=n.urls;return r[e]},monitorForUsernameChange:function(){var e=this,t=this.get("user"),n;SC.debug("Check if X-APPLE-WEB-ID can be created" ),t&&(!this.shouldShowFirstRun(this.get("accountPreferences"),CW.getUrlParameters())||this.get("isAuthenticated"))&&(n=SHA1.hex_sha1(t.get("dsid")+this.get("userAuthenticationState")),n!==this._lastDsidCookie&&(CK.writeCookie("X-APPLE-WEB-ID",n,null,this.get("currentDomain"),this.get("isExtendedLogin")?336:null,YES),this._lastDsidCookie=n));if(this._usernameMonitorTimer)return;SC.debug("Creating the _usernameMonitorTimer"),this._usernameMonitorTimer=SC.Timer.schedule({target:this,action:function(){if(!COS.authController._usernameMonitorTimer)return;var t=e.get("user"),n=CK.readCookie("X-APPLE-WEB-ID"),r=e.get("isAtLeastPartiallyAuthenticated"),i=e.get("isAuthenticated");r&&t&&t.get("dsid")&&e._lastDsidCookie&&!n?(e.clearUserState(),e.invokeDelegateMethod(e.get("delegate"),"userDidLogout",NO),e._lastDsidCookie=null):!i&&n&&n!==e._lastDsidCookie&&(e.validateUser(function(t){if(t){var n;e.get("isAuthenticated")&&(n="userDidAuthenticate"),e.get("isPartiallyAuthenticated")&&(n="userDidPartiallyAuthenticate"),n&&e.invokeDelegateMethod(e.get("delegate"),n,NO)}}),e._lastDsidCookie=n)},interval:1e3,repeats:YES})},clearMonitorForUsernameChange:function(){if(!this._usernameMonitorTimer)return;this._usernameMonitorTimer.invalidate(),this._usernameMonitorTimer=null},sendAccountCreateRequest:function(e,t){var n=this.get("repairPayload");this._sendAccountCreateRepairRequest(CloudOS.initializationController.get("accountCreateEndpointURL"),n?{createPayload:n}:{},e,t,YES)},sendAccountRepairRequest:function(e,t){var n=this.get("repairPayload");this._sendAccountCreateRepairRequest(CloudOS.initializationController .get("repairDoneEndpointURL"),n?{repairPayload:n}:{},e,t,NO)},_sendAccountCreateRepairRequest:function(e,t,n,r,i){COS.Request.create({type:"POST",address:e,body:SC.merge(t,CloudOS.tosController.get("acceptedVersions"))}).notify(this,function(e){var t=CloudOS.statechart,s=i?"AppleID_NewAccountCreation":"AppleID_ExistingAccountRepair",o;if(e.get("status")===200){var u={referrer:document.referrer},a;n&&(o=n),i&&(a={},a.includeLocationUrlDetails=!0),COS.statsController.endStat("cloudos",s,u,a)}else r&&(o=r);o&&t.sendAction(o)}).send()},windowWillClose:function(){this.get("isAtLeastPartiallyAuthenticated")&&COS.statsController.endStat("cloudos","Session",{isRefresh:YES},{durationKeyName:"sessionDuration"}),this.cancelAppleIdFlowStats(),COS.statsController.flushStats()},_authCompleted:function(e,t,n,r){CK.servicesController._setupFromBag(e);var i=this.get("user"),s=i.get("statusCode"),o=this.get("delegate");if(this.invokeDelegateMethod(o,"redirectPostAuthenticationIfRequired",e))return;if(s===CK.User.PAID_ACTIVE)return SC.debug("The user is a MobileMe user, %@. Invoking delegate userIsMobileMe()",s),this.invokeDelegateMethod(o,"userIsMobileMe"),this.logoutUser(),NO;if(s!==CK.User.FREE_QUALIFIED&&s!==CK.User.LITE)return SC.debug("The user is not signed up to iCloud, %@. Invoking delegate userIsNotSignedUp()",s),this.invokeDelegateMethod(o,"userIsNotSignedUp"),this.logoutUser(),NO;if(i.isLiteAccount()&&SC.browser.isIE9OrLower)return SC.debug("The user is has an iCloud Lite account but is using IE9 (or earlier)."),this.invokeDelegateMethod(o,"iCloudLiteUnsupportedBrowser"),this.logoutUser (),NO;this.set("isExtendedLogin",e.isExtendedLogin),this.set("hsaChallengeRequired",e.hsaChallengeRequired),this.set("hsaTrustedBrowser",e.hsaTrustedBrowser),this.set("pcsEnabled",e.pcsEnabled),this.set("isCarryUser",e.isCarryUser);var u=e.pcsDeleted||!!CW.getUrlParameters().deletePCSKeys;this.set("pcsDeleted",u);var a=COS.appsController,f=a._appsInfo,l=i.get("hasICloudQualifyingDevice"),c=i.get("isLiteAccount"),h=i.get("isManagedAppleId"),p=i.get("hsaEnabled"),d=NO,v=this.get("hsaChallengeRequired"),m,g=this.get("authBagApps"),y,b,w,E,S,x,T,N,C;g.photos===undefined&&!c&&(g.photos={});for(y in f){b=f[y],C=g[y];if(C)for(N in C)b.set(N,C[N]);a.setAppLockInfo(b,u,p,v),S=b.get("requiredServices");if(!S)continue;for(w=0,E=S.length;w=COS.MAX_VALIDATE_RETRIES?(SC.warn("Already exceeded the maximum number of validate request attempts. Hence marking the request as failure."),s.sendAction("authDidNotConnect","validateDidFail"),this._validateRetriesSentCount=0):(this._validateRetriesSentCount++,s.sendAction("resendLoginOrValidateRequest",n)))},loginDidSucceed:function(e){this.cloudOSAuthCompleted(e,"login")},loginDidFail:function(e,t){var n=COS.authUIState,r=t?t.error:null,i=e.status;this.userDidNotAuthenticate(YES),!t||i!==401&&i!==421? e.status===403?r===17?n.sendAction("authDidNotCompleteSetup"):r===16?n.sendAction("authPartitionLocked"):r===14?n.sendAction("authDidNotValidateExpiredPassword"):r===10?n.sendAction("authDidNotValidateAccountClosed"):r===9?n.sendAction("authDidNotValidateSupportLocked"):r===8?n.sendAction("authDidNotValidateLocked"):r===7?n.sendAction("authDidNotValidateLocked"):r===6?n.sendAction("authDidNotValidateNotICloudUser"):r===5?n.sendAction("authDidNotValidateNotICloudUser"):r===4?n.sendAction("authDidNotValidateNotICloudUser"):r===3?n.sendAction("authDidNotValidateNotICloudUser"):r===2?n.sendAction("authDidNotValidateNotICloudUser"):(SC.warn("Auth: 403 response but no recognized error code"),n.sendAction("authDidNotConnect","loginDidFail")):e.status===503?this.handle503(e.get("body")):SC.device.get("isOffline")?n.sendAction("authDidNotValidateOffline"):(SC.warn("Auth: No auth bag or recognized status code"),this._loginRetriesSentCount>=COS.MAX_LOGIN_RETRIES?(SC.warn("Already exceeded the maximum number of login request attempts. Hence marking the request as failure."),n.sendAction("authDidNotConnect","loginDidFail")):(this._loginRetriesSentCount++,n.sendAction("resendLoginOrValidateRequest"))):r===1?n.sendAction("authDidNotValidate"):r===11?(SC.info("Login id sent does not match, sending validate before re-sending login"),this.validateUser(function(){e.get("request").resend(e)},YES)):r===15?n.sendAction("authDidNotValidateAccountTypeNotSupported"):(SC.warn("Auth: 401 response but no recognized error code"),n.sendAction("authDidNotConnect","loginDidFail"))},userIsMobileMe:function( ){COS.authUIState.sendAction("authDidNotValidateNotICloudUser")},userIsNotSignedUp:function(){COS.authUIState.sendAction("authDidNotValidateNotICloudUser")},userIsNotVerified:function(){COS.authUIState.sendAction("authDidNotValidateNotVerified")},iCloudLiteUnsupportedBrowser:function(){COS.authUIState.sendAction("iCloudLiteUnsupportedBrowser")},userIsUnqualified:function(){this.set("userRequiresUnqualifiedNotification",YES)},handle503:function(e){var t,n;if(e)for(t in e)if(t.match(/^retry[ _\-]?after$/i)){n=e[t];break}n&&(n=parseInt(n,10)),COS.authUIState.sendAction("authDRLocked",{retryAfter:n})},validatePreferences:function(e,t,n,r,i){var s=COS.authUIState;if(this.get("accountRepairRequired")){SC.debug("Account requires repair, no need to check preferences");var o;return CloudOSBootstrap.isTermsAndConditionUrl&&(o=function(){var e=CloudOS.authController;e.redirectToPostLoginRedirectUrl()||e.set("userHasAcceptedTerms",!0)}),s.sendAction("accountRequiresRepair",o),YES}if(this.get("hsaChallengeRequired"))return SC.debug("HSA challenge required, no need to check preferences"),e?s.sendAction("authDidValidate"):s.sendAction("authDidNotValidate"),YES;SC.debug("Validating Preferences");if(t!==undefined&&!e)return NO;var u=this.get("statechart"),a=r===330;if(!i){var f=YES;if(r===503)this.handle503(n),f=NO;else if(n&&n.status!==0){SC.warn("responseBody status of KVS response was = ",n.status);if(this._preferencesRetriesSentCount>=COS.MAX_PREFERENCES_RETRIES)SC.warn("Already exceeded the maximum number of get preferences request attempts. Hence marking the request as failure."),s.sendAction ("authDidNotConnect","KVSFailed"),f=NO;else{if(!a){this._preferencesRetriesSentCount++,u.sendAction("resendGetPrefsRequest");return}if(!this._prefsWrongPartitionCheckDone||!a){this._prefsWrongPartitionCheckDone=a,this._preferencesRetriesSentCount=0,u.sendAction("resendLoginOrValidateRequest");return}SC.warn("The response status is %@",r),this._prefsWrongPartitionCheckDone&&SC.warn("We have already done the re-login once to get the correct partition information. Since we are still getting wrong partition information, we mark the login as failure."),s.sendAction("authDidNotConnect","KVSFailed Wrong Partition"),f=NO}}else if(!n||r!==200){SC.warn("KVS returned invalid response.");if(!(this._preferencesRetriesSentCount>=COS.MAX_PREFERENCES_RETRIES)){this._preferencesRetriesSentCount++,u.sendAction("resendGetPrefsRequest");return}SC.warn("Already exceeded the maximum number of get preferences request attempts. Hence marking the request as failure."),s.sendAction("authDidNotConnect","KVSFailed"),f=NO}if(!f)return NO}var l=this.get("accountPreferences"),c=CW.getUrlParameters();if(c.clearPrefs)return window.confirm("Are you sure you want to clear all preferences?")?COS.prefsController.clearPreferences(function(){document.location=document.location.href.replace("clearPrefs","firstrun")}):s.sendAction("authDidValidate"),YES;if(this.shouldShowFirstRun(l,c)){if(!window.CloudOSBootstrap||!CloudOSBootstrap.isOnSupportedMobile)return SC.debug("Missing account preferences; Lets show first run"),s.sendAction("showFirstRun"),NO;l.get("locale")||l.set("locale",CloudOSBootstrap.getLocale())}return SC .debug("Account preferences look good, moving on..."),s.sendAction("authDidValidate"),YES},reportAuthError:function(e,t){SC.Benchmark.end("AUTH_DURATION");var n={authDuration:COS.lastBenchmarkDurationFor("AUTH_DURATION"),silentAuth:e==="validate"?YES:NO,failureReason:t};e==="login"&&(n.loginAttempts=this.get("loginAttempts")),COS.statsController.recordStat("cloudos","AuthFailure",n)},reportAuthSuccess:function(e){e==="login"&&SC.Benchmark.end("AUTH_DURATION");var t=this.get("requestInfo"),n=CloudOS.shareController&&!!CloudOS.shareController.get("recordInfo"),r=COS.authController,i=r.get("hsaTrustedBrowser"),s=r.get("user"),o=s.get("hsaEnabled"),u=s.get("hsaVersion"),a=s.get("isManagedAppleID"),f=r.getPath("accountPreferences.secondaryLocale"),l={idmsLocale:s.get("idmsLocale"),accountLocale:String.preferredLanguage,browserLocale:(navigator.language||navigator.browserLanguage).toLowerCase(),authDuration:COS.lastBenchmarkDurationFor("AUTH_DURATION"),rememberCredentials:this.get("isExtendedLogin"),silentAuth:e==="validate"?YES:NO,referrer:document.referrer,devicePixelRatio:window.devicePixelRatio,region:t?t.region:null,country:t?t.country:null};n&&(l.shareLogin=YES),f&&(l.accountSecondaryLocale=f),o&&r.get("isAuthenticated")&&(l.hsaEnabled=YES,l.hsaVersion=u,l.hsaTrustedBrowser=i,l.isManagedAppleID=a),e==="login"&&(l.loginAttempts=this.get("loginAttempts")),COS.statsController.recordStat("cloudos","AuthSuccess",l)},appleIdsAreEqual:function(e,t,n){e=e?e.toLowerCase():"",t=t?t.toLowerCase():"",n=n?n.toLowerCase():"";var r=e===t||e===n,i;return!r&&/@(me|mac)\.com$/.test(e)&&(i=e.replace (/@.*$/,""),r=i===t.replace(/@.*$/,"")||i===n.replace(/@.*$/,"")),r},clearUserState:function(){arguments.callee.base.apply(this,arguments),CW.notificationCenter.postNotification("willClearUserState"),CK.meCardController.reset(),this.set("loginAttempts",0),this.set("_loginRetriesSentCount",0),this.set("_preferencesRetriesSentCount",0),this.set("_prefsWrongPartitionCheckDone",NO)},shouldRefreshValidateToken:function(){this.validateUser(function(){SC.debug("Successfully refreshed the validate token")})},exportAppsOrder:function(){var e=this.getPath("_auth_bag.appsOrder");e&&(this.set("appsOrder",e),CloudOS.appController.notifyPropertyChange("appIndices"))}.observes("user"),appsOrder:["mail","contacts","calendar","photos","iclouddrive","notes","notes2","reminders","pages","numbers","keynote","newspublisher","fmf","find","settings"],lockedAlertDescription:function(e,t,n){return SC.none(t)?e+="NoETA":t<=3600?e+="Hour":e+="HourOrMore",e.loc({appName:n})}}),COS.Request=CW.Request.extend(CK.RequestReporting,{isJSON:YES,useCrossDomain:YES,withCredentials:YES,attachIdentifyingHeaders:NO,contentType:undefined,queryParametersOrder:["dsid"],init:function(){var e;arguments.callee.base.apply(this,arguments),this.get("useCrossDomain")&&(e=this.get("contentType"),e===undefined&&(e="text/plain",this.set("contentType",e))),e||(e=this.get("contentType")),e&&this.header("Content-Type",e);var t=COS.authController,n=t.getPath("user.dsid"),r=this.get("address");n&&(!r||r.indexOf("dsid=")===-1)&&this.queryParameter("dsid",n),this.queryParameter("clientId",COS.CLIENT_ID),this.queryParameter("clientBuildNumber" ,SC.buildNumber),this.queryParameter("clientMasteringNumber",SC.masteringNumber)}}),COS.prefsController=SC.Object.create(SC.DelegateSupport,{delegate:null,_lastKnownAccountPrefs:{},_appsRemainingToFetch:[],_isRegionSettingsFetched:NO,_waitToRetrySavingPrefs:15e3,getRequestedApps:function(e){var t=[],n=COS.get("isCloudOSMini");if(e)t.push({"app-id":e,"registry-version":""});else{var r=COS.apps,i=this._appsRemainingToFetch,s;i.length>0&&(r=CW.invertArray(i)),t.push({"app-id":"account","registry-version":""});for(s in r)s==="iw"&&!r.gilligan&&t.push({"app-id":"gilligan","registry-version":""}),t.push({"app-id":s,"registry-version":""})}return t},getPreferences:function(e,t){var n=this.getRequestedApps(e),r=n.getEach("app-id"),i=COS.Request.create({type:"POST",address:"/json/sync",applicationName:e,COPY_KEYS:COS.Request.prototype.COPY_KEYS.concat(["applicationName"])});i.set("reportRequest",YES);var s=i.get("address"),o=CK.servicesController.getServiceUrlFor("keyvalue",YES),u={"service-id":"appleprefs",apps:n};i.set("address",o+s),i.notify(200,this,this.getPreferencesDidSucceed,t,r),i.notify(0,this,this.getPreferencesDidFail,t,r),SC.debug("COS: requesting preferences");var a=this.get("delegate");this.invokeDelegateMethod(a,"getPreferencesRequestWillBeSent"),i.send(u)},getPreferencesDidSucceed:function(e,t,n){var r=e.get("body"),i=this.get("currentPrefsResponse");if(!r||r.status!==0){this.getPreferencesDidFail(e);return}var s=[],o=COS.appsController,u=this.get("delegate"),a,f,l,c,h,p,d,v,m,g,y=r.apps,b=y.getEach("app-id"),w=b.indexOf("iw"),E=b.indexOf("gilligan"),S=w!==-1,x=S&&y[ w].keys.length>0,T=E!==-1,N=T&&y[E].keys.length>0;for(h=0,p=y.length;h0||r.length>0)&&n++,r.length>0&&this.invokeLater(function(){var e=this._getPreferencesForKeys(s,r);n<=3&&this.savePreferences(s,e,null,n)}.bind(this),this._waitToRetrySavingPrefs);if(i.length>0){var v=this._getPreferencesForKeys(s,i);n<=3&&this.savePreferences(s,v,null,n)}return u=COS.appsController.getAppInfoFor (s),u?(a=u.get("preferences"),u.set("preferencesVersion",f),this.invokeDelegateMethod(p,"passMessageToAllApps","_cloudOSStateChange",{appPreferences:function(){var e={};return e[s]=a,e}()})):s==="account"&&(a=COS.authController.get("accountPreferences"),a.set("preferencesVersion",f),this.invokeDelegateMethod(p,"passMessageToAllApps","_cloudOSStateChange",{accountPreferences:a.prefsHash(YES)})),a?(t instanceof Function&&t(),SC.debug("COS: successfully saved preferences for “%@”",s),YES):this.savePreferencesDidFail(e)},savePreferencesDidFail:function(e,t){var n=e.getPath("request.applicationName");return SC.error("COS: There was an error saving the preferences for “%@”, status %@",n,e.get("status")),t instanceof Function&&t(),this.getPreferences(),YES},hashToPrefKeys:function(e){var t=[],n,r;for(n in e)r=e[n],r!==undefined&&t.push({name:n,data:r});return t},allAppPreferencesHash:function(){var e={},t=COS.appsController,n,r;for(r in COS.apps)if(COS.apps.hasOwnProperty(r)){n=t.getAppInfoFor(r);if(!n)continue;e[r]=n.get("preferences")||{},e[r].preferencesVersion=n.get("preferencesVersion")||""}return e},notifyAccountPreferencesDidChange:function(){var e=this.get("delegate");this.invokeDelegateMethod(e,"passMessageToAllApps","accountPreferencesDidChange")},setPreferences:function(e,t,n){var r=COS.authController.get("accountPreferences"),i=COS.appsController,s=this.get("delegate"),o;if(e)for(var u in e)e.hasOwnProperty(u)&&r.set(u,e[u]);this._lastKnownAccountPrefs=SC.clone(r.prefsHash(),YES),r.set("hasInitialized",YES);if(t){for(var a in t){var f=COS.appsController.getAppInfoFor(a) ;f?(o=t[a].preferencesVersion,f.set("preferencesVersion",o),t[a].preferencesVersion&&delete t[a].preferencesVersion,f.set("preferences",t[a])):i.storePrefsForDynamicApp(a,t,o)}this.invokeDelegateMethod(s,"passMessageToAllApps","_cloudOSStateChange",{appPreferences:t})}n&&n.call&&n.call(this,YES,undefined,undefined,undefined,YES)},_getPreferencesForKeys:function(e,t){var n={},r=this._getPreferencesForApp(e);for(var i=0;i0&&this.scheduleAttempt("registerMissingTopics")}return SC.debug("Push token acquired: %@",n),this.set("pushToken",n),this.set("webCourierURL",t.webCourierURL),r&&this.set ("pushTTL",r),CK.setValueInSessionStorage("pushToken",n),s&&s.invokeDelegateMethod(s,"didInitializePush",t),this.set("registeredPushTopics",o),this._isInitiatingPushConnection=NO,this.parkConnectionIfAppropriate(),YES}),i.notify(400,this,function(e){return SC.debug("%@ received from pushws. Reverting to polling for this session.",e.get("status")),this._isInitiatingPushConnection=NO,YES}),i.notify(0,this,function(e){return SC.debug("Failed to aquire push token."),this.set("hasPushConnection",NO),this.set("pushToken",null),this._isInitiatingPushConnection=NO,this.scheduleAttempt("initializePush"),YES}),i.queryParameter("attempt",n),r={pushTopics:e?[e]:this.get("pushTopics"),pushTokenTTL:t},this._isInitiatingPushConnection=YES,i.send(r)},parkConnection:function(e){if(this.get("hasPushConnection")===YES&&!e){SC.warn("We already have an established push connection");return}var t=this.get("webCourierURL")+"?tok=%@&ttl=%@".fmt(this.get("pushToken"),this.get("pushTTL")),n=COS.Request.postUrl(t),r=this.increaseAttemptCount("parkConnection");n.set("timeout",this.get("pushTTL")*1e3),n.set("withCredentials",NO),n.willSend=null,n.willReceive=null,n.notify(200,this,function(e){var t=e.get("body"),n=this.get("delegate");return SC.debug("Received push notification: %@",t),n&&n.invokeDelegateMethod(n,"handlePushNotification",t),this.resetAttemptCount("parkConnection"),this.invokeLater(function(){COS.pushController.parkConnection(YES)},500),YES}),n.notify(408,this,function(e){return SC.debug("409: Request Time-out"),this.set("hasPushConnection",NO),this.scheduleAttempt("parkConnection"),YES}) ,n.notify(409,this,function(e){return SC.debug("409: Re-parked multiple connections with the same pushToken"),this.set("hasPushConnection",NO),this.scheduleAttempt("parkConnection"),YES}),n.notify(403,this,function(e){SC.debug("403: The pushToken has expired");var t=this;return SC.info("Unregistering the topics before trying again..."),this.unInitializePush(function(){t.scheduleAttempt("initializePush")}),COS.statsController.recordStat("cloudos","APNS_403_Response"),this.set("hasPushConnection",NO),this.set("pushToken",null),YES}),n.notify(0,this,function(e){return SC.debug("Unknown error: The park push connection closed unexpectedly"),this.set("hasPushConnection",NO),this.scheduleAttempt("parkConnection"),YES}),n.clearQueryParameters(),n.send(),this._pushConnection=n,this.set("hasPushConnection",YES)},registerMissingTopics:function(){var e=this.get("missingPushTopics"),t=this.get("pushToken");if(!e||e.length===0){SC.info("COS.pushController: No missing pushTopics found.");return}if(!t){SC.warn("COS.pushController: You need a pushToken before you can call registerMissingTopics"),this.scheduleAttempt("initializePush");return}var n=this.get("pushTTL"),r=this.increaseAttemptCount("registerMissingTopics"),i=CK.Request.postUrl("/registerTopics");i.set("serviceName","push"),i.set("isJSON",YES),i.set("reportRequest",YES),i.notify(200,this,function(e){var t=e.get("body"),n=t.errors,r=t.registeredTopics,i=this.get("missingPushTopics"),s,o,u,a,f;if(n){SC.typeOf(i)!==SC.T_ARRAY&&(i=[]);for(s=0,o=n.length;s0?this.scheduleAttempt("registerMissingTopics"):this.resetAttemptCount("registerMissingTopics"),this.set("webCourierURL",t.webCourierURL),this.parkConnectionIfAppropriate(),YES}),i.notify(400,this,function(t){return SC.debug("%@: Failed to register topics, backing off, %@",t.get("status"),e),YES}),i.notify(0,this,function(t){return SC.debug("Unknown error: Failed to register topics, %@",e),this.scheduleAttempt("registerMissingTopics"),YES}),SC.debug("Registering push topics, %@",e);var s={pushToken:t,pushTopics:e,pushTokenTTL:n};i.queryParameter("attempt",r),i.send(s)},refreshWebAuth:function(){var e=CK.Request.getUrl("/refreshWebAuth");e.set("serviceName","push"),e.set("isJSON",YES),e.set("reportRequest",YES),e.notify(0,this,function(e){return YES}),e.send()},startRefreshWebAuthTimer:function(){if(this.get("refreshWebAuthTimer"))return;var e=SC.Timer.schedule({target:this,action:"refreshWebAuth",interval:COS.REFRESH_WEB_AUTH_INTERVAL*1e3,repeats:YES});SC.debug("Started refreshWebAuthTimer"),this.set("refreshWebAuthTimer",e)},stopRefreshWebAuthTimer:function(){var e=this.get("refreshWebAuthTimer");if(!e)return;e.invalidate(),this.set("refreshWebAuthTimer",null),SC.debug("Stopped refreshWebAuthTimer")},unInitializePush:function(e){var t=this.get("pushToken"),n=this.get("pushTopics");if(this.get ("hasPushConnection")!==YES&&!t||!n||n.length===0){e instanceof Function&&e();return}var r=CK.Request.postUrl("/unregisterTopics");r.set("serviceName","push"),r.set("isJSON",YES),r.set("reportRequest",YES),r.notify(200,this,function(t){return SC.info("COS.pushController: Successfully uninitialized push"),e instanceof Function&&e(t),YES}),r.notify(0,this,function(t){return SC.debug("COS.pushController: Failed to uninitialize push."),e instanceof Function&&e(t),YES}),r.send({pushToken:t,pushTopics:n})},pushTokenDidChange:function(){var e=this.get("registeredCloudKitContainers"),t=Object.keys(e),n=t.length;for(var r=0;r2)t+="-"+this._capitalizeFirstLetter(n[1]),t+="-"+n[2].toUpperCase();else if(n.length>1){var r=n[1].length;r>2?t+="-"+this._capitalizeFirstLetter(n[1]):t+="-"+n[1].toUpperCase()}return t},_capitalizeFirstLetter:function(e){return e.charAt(0).toUpperCase()+e.slice(1)},_sendNetworkRequest:function(e){this._retries++;var t=COS.Request.create({type:"GET",address:e,isJSON:YES,withCredentials:NO});t.notify(200,this,this.getRulesDidSucceed),t.notify(0,this,this.getRulesDidFail),t.send()},getRulesDidSucceed:function(e){var t=e.get("body");return t||this.getRulesDidFail(e),this.set("regionFormattingRules",t),CW.notificationCenter.postNotification("didFetchRegionFormattingSettings"),YES},getRulesDidFail:function(e){var t=e.status,n=e.request.address;if(t===404){var r=this._regionParts.join("-");COS.statsController.recordStat("cloudOS","region formatter",{clientId:COS.CLIENT_ID,regionFormat:r,requestedRegion:this._getISOnameForRegion(r),error:"region format json not available"});if(this._regionParts.length>1){this._regionParts.pop();var i=this._regionParts.join("-"),s=this._getISOnameForRegion(i);n=this.get("localeURL")+this.get("localeVersion")+"/"+s+".json"}else n=this.get("localeURL")+this.get("localeVersion")+"/en-US.json"}return this._retries<3?this._sendNetworkRequest(n):this.useFallbackRules (),YES},useFallbackRules:function(){var e=this.get("defaultRules");this.set("regionFormattingRules",e),CW.notificationCenter.postNotification("didFetchRegionFormattingSettings")}}),COS.revalidateController=SC.Object.create({lastRevalidate:null,intervalInHours:24,revalidateInProgress:!1,callbackQueue:[],performRevalidate:function(e){var t=this.get("callbackQueue");t.push(e),this.set("callbackQueue",t);if(this.get("revalidateInProgress"))return;var n=this.get("lastRevalidate");if(!n)this.set("lastRevalidate",SC.getCurrentTimeForPerformance()),this._invokeValidateWithCallback();else{var r=this.get("intervalInHours"),i=(SC.getCurrentTimeForPerformance()-n)/36e5;i>=r?(this.set("lastRevalidate",SC.getCurrentTimeForPerformance()),this._invokeValidateWithCallback()):(SC.Logger.warn("pcsController: Cannot revalidate, please retry in: "+(r-i)+" hour(s)"),e=t.shift(),this.set("callbackQueue",t),e.call())}},_invokeValidateWithCallback:function(){this.set("revalidateInProgress",!0),CloudOS.authController.validateUser(function(){this.set("revalidateInProgress",!1);var e=this.get("callbackQueue"),t=e.length;for(var n=0;n=c.rangeBegin&&g<=c.rangeEnd&&d<=v){if(l&&v>f)continue;var N=c.format.indexOf("n")!==-1,C=c.format.indexOf("c")!==-1,k=c .areaCodeLength;l=!0,f=v,i?y=YES:y=NO;if(SC.none(b)||s&&!E&&N||y&&!w&&C||!y&&!s&&So&&(s=o);return o=s===i?-1:s,o},formatEntryforDigits:function(e,t,n,r){var i,s,o,u,a,f=this.normalizeString(t),l=f.length,c=this.normalizeString(e),h=c.length,p=c,d=NO,v=NO,m=null;l===0&&(n=""),s=this.getInternationalOrNationalAccessCode(c,r,YES),o=this.normalizeString(s).length,s&&o!==0&&l===0&&(v=YES,p=c.substr(o,h)),m=r.numericCountryCode,u=this.getIndexOfPauses(e,",;"),t&&n&&u!==1?(p=c.substr(l+m.length,h),d=YES):d=NO,i=this.getFormattedStringUsingMatchedFormat(p,s,m,r,d,v,t);if(i.length===0&&d){var g=l+m.length,y=u!==-1?e.substr(0,u):e;a=y.length=== g||isNaN(y[l])?e:t!=="+"?t+" "+m+" "+p:t+m+" "+p}return i?i.trim():a},normalizeString:function(e){var t;return t=e?e.replace(/[^a-zA-Z0-90-9०-९+,;@.*#\'\"<>\[\]]/g,""):"",t},convertFullWidthDigits:function(e){var t;return t=e.replace(/[0-9]/g,function(e){switch(e){case"0":return"0";case"1":return"1";case"2":return"2";case"3":return"3";case"4":return"4";case"5":return"5";case"6":return"6";case"7":return"7";case"8":return"8";case"9":return"9";default:return e}}),t}}),CK.PhoneNumbers.CanonicalizationController=SC.Object.extend(CK.MicroResourceContainer,{init:function(){arguments.callee.base.apply(this,arguments),this.containerInit()},getCanonicalizePhoneNumberState:function(e){return e=this.normalizePhoneNumber(e),this.containerGetStatus(e)},getCanonicalizePhoneNumberValue:function(e){return e=this.normalizePhoneNumber(e),this.containerGet(e)},canonicalizePhoneNumber:function(e,t){e=this.normalizePhoneNumber(e),this.containerLoad(e,t)},canonicalizePhoneNumbers:function(e,t){var n=this,r=e.reduce(function(e,t){return t?++e:e},0),i=[],s=[];e.forEach(function(e,o){e&&n.canonicalizePhoneNumber(e,function(e,n){i[o]=n,s[o]=e,--r<=0&&t(s,i)})})},containerFlush:function(e){var t={},n=[];e.forEach(function(e){var r=e.key;t[r]||(n.push(r),t[r]=!0)});var r=this;this.sendCanonicalizePhoneNumbersRequest(n,function(t,i){r.containerStoreResults(n,i,t,e)})},sendCanonicalizePhoneNumbersRequest:function(e,t){if(!e||!e.length){t(undefined,[]);return}var n=[],r=this;e.forEach(function(e,t){e=r.normalizePhoneNumber(e),e&&(e=e.replace(/\+/g,""),n.push({phoneNumber:e}))});var i={lookupInfos:n},s=CK.Request .postUrl("/ws/v1/autocomplete/canonicalizePhoneNumbers");return s.set("serviceName","cksharews"),s.set("withCredentials",YES),s.set("isJSON",!0),s.set("timeout",3e4),s.notify(200,null,function(n){var r=n&&n.get("body"),i=r&&r.results;if(i&&i.forEach){var s=i.map(function(e){return e.canonicalized});t(null,s)}else t(CK.MicroResourceContainerServerError.create({message:"Server response to canonicalizePhoneNumbers returned data in an invalid format.",failedKeys:e}),[]);return YES}),s.notify(0,null,function(n){return t(CK.MicroResourceContainerServerError.create({message:"Server request to canonicalizePhoneNumbers failed.",failedKeys:e}),[]),YES}),s.send(i)},normalizePhoneNumber:function(e){e=(e||"").toLowerCase();var t=this;return e=e.replace(/./g,function(e){return t.phoneDigitsToRoman[e]||e}),e&&e.replace(/[^0-9+]/g,"")},phoneDigitsToRoman:{"0":"0","1":"1","2":"2","3":"3","4":"4","5":"5","6":"6","7":"7","8":"8","9":"9","٠":"0","١":"1","٢":"2","٣":"3","٤":"4","٥":"5","٦":"6","٧":"7","٨":"8","٩":"9","۰":"0","۱":"1","۲":"2","۳":"3","۴":"4","۵":"5","۶":"6","۷":"7","۸":"8","۹":"9","०":"0","१":"1","२":"2","३":"3","४":"4","५":"5","६":"6","७":"7","८":"8","९":"9","০":"0","১":"1","২":"2","৩":"3","৪":"4","৫":"5","৬":"6","৭":"7","৮":"8","৿":"9","๐":"0","๑":"1","๒":"2","๓":"3","๔":"4","๕":"5","๖":"6","๗":"7","๘":"8","๙":"9"}}),CK.PhoneNumbers.CanonicalizationController.sharedInstance=function(){var e=CK.PhoneNumbers.CanonicalizationController;return e._sharedInstance||(e._sharedInstance=e.create())},CK.PhoneNumbers.countryDataController=SC.ObjectController.create({countryPhoneFormats:{},loadCountryData :function(e){var t=this.get("countryPhoneFormats");if(t&&SC.typeOf(t[e])===SC.T_HASH)CW.notificationCenter.postNotification("phoneFormatJSONLoaded",e);else if(SC.empty(t[e])){var n="https://"+window.location.hostname+"/phone_numbers/2/%@.json".fmt(e),r=SC.Request.getUrl(n).json();r.notify(200,this,"didFetchCountryData",{countryCode:e}),r.notify(0,this,"didReceiveErrorForCountryData",{countryCode:e}),r.send(),this.get("countryPhoneFormats")[e]=YES}},didReceiveErrorForCountryData:function(e,t){var n=t.countryCode;return this.get("countryPhoneFormats")[n]=NO,CW.notificationCenter.postNotification("phoneFormatJSONLoaded",n),YES},didFetchCountryData:function(e,t){var n=t.countryCode;return this.get("countryPhoneFormats")[n]=this._decompressV2Data(e.get("body")),CW.notificationCenter.postNotification("phoneFormatJSONLoaded",n),YES},_decompressV2PhoneFormat:function(e){var t=/^\[(\d+)](.*)$/.exec(e),n=/^\[(\d+)-(\d+)](.*)$/.exec(e);return n&&n.length===4?{rangeBegin:n[1],rangeEnd:n[2],format:n[3]}:t&&t.length===3?{rangeBegin:t[1],rangeEnd:t[1],format:t[2]}:e},_decompressV2Data:function(e){var t=e.split("|"),n=t.slice(4);for(var r=n.length;r--;)n[r]=this._decompressV2PhoneFormat(n[r]);return{countryCode:t[0],numericCountryCode:t[1],internationalAccessCode:t[2],nationalAccessCode:t[3],phoneFormats:n}}}),CK.PhoneNumbers.FormattingController=SC.Object.extend(CK.MicroResourceContainer,{init:function(e){arguments.callee.base.apply(this,arguments),this.containerInit()},getFormatPhoneNumberState:function(e){var t=CK.PhoneNumbers.CanonicalizationController.sharedInstance();return e=t.normalizePhoneNumber (e),this.containerGetStatus(e)},getFormatPhoneNumberValue:function(e){var t=CK.PhoneNumbers.CanonicalizationController.sharedInstance();return e=t.normalizePhoneNumber(e),this.containerGet(e)},formatPhoneNumber:function(e,t){var n=CK.PhoneNumbers.CanonicalizationController.sharedInstance();e=n.normalizePhoneNumber(e),this.containerLoad(e,t)},containerFlush:function(e){var t=e.map(function(e){return e.key}),n=this;this._formatPhoneNumbers(t,function(r,i){n.containerStoreResults(t,i,r,e)})},_formatPhoneNumbers:function(e,t){if(!e||!e.length)return t(undefined,[]);this._loadCountryDataForPhoneNumbers(e,function(e,n){if(e)return t(e);var r=n.map(function(e){if(!e)return e;var t=CK.PhoneNumbers.internationalPrefixForDigits(e,null),n=CK.PhoneNumbers.getCountryCodeFromInput(e,t.length),r=n&&CK.PhoneNumbers.countryDataController.countryPhoneFormats[n];if(!r)return e;var i=CK.PhoneNumbers.formatEntryforDigits(e,t,n,r);return i||e});t(undefined,r)})},_loadCountryDataForPhoneNumbers:function(e,t){function s(n){delete i[n],Object.keys(i).length||(CW.notificationCenter.unsubscribeFromNotification("phoneFormatJSONLoaded",null,s),t(null,e))}var n=CK.PhoneNumbers.countryDataController,r=n&&n.countryPhoneFormats,i={};e.forEach(function(e){var t=e&&CK.PhoneNumbers.getCountryCodeFromInput(e.replace(/^\+/,""));t&&r[t]===undefined&&(i[t]=!0)});if(!Object.keys(i).length){t(null,e);return}CW.notificationCenter.subscribeToNotification("phoneFormatJSONLoaded",null,s);for(var o in i)n.loadCountryData(o)}}),CK.PhoneNumbers.FormattingController.sharedInstance=function(){var e=CK.PhoneNumbers.FormattingController ;return e._sharedInstance||(e._sharedInstance=e.create())},CK.PhoneNumbers.PhoneFormatter={shouldFormat:YES,countryCode:function(){var e=this.get("value");if(e){var t=this.getInternationalPrefix(e);return t=CK.PhoneNumbers.normalizeString(t),t?CK.PhoneNumbers.getCountryCodeFromInput(e,t.length):this.get("defaultCountryCode")}return this.get("defaultCountryCode")}.property("value","defaultCountryCode").cacheable(),getInternationalPrefix:function(e){var t=this.get("defaultCountryCode"),n=CK.PhoneNumbers.countryDataController.get("countryPhoneFormats")[t];return CK.PhoneNumbers.internationalPrefixForDigits(e,n)},formattedValue:function(e,t){var n=this.get("shouldFormat");return t===undefined?t=this.get("value"):this.set("value",t),n&&t?this.formatPhoneNumbers(t):t}.property("value","shouldFormat","phoneFormat").cacheable(),phoneFormatJSONLoaded:function(e){e===this.get("countryCode")&&this.invokeLater(function(){CW.notificationCenter.unsubscribeFromNotification("phoneFormatJSONLoaded",this,this.phoneFormatJSONLoaded)},50),this.notifyPropertyChange("phoneFormat")},phoneFormat:function(){var e=CK.PhoneNumbers.countryDataController.get("countryPhoneFormats"),t=this.get("countryCode");return e[t]}.property("countryCode"),countryCodeObserver:function(){var e=this.get("phoneFormat"),t=this.get("countryCode"),n=CK.PhoneNumbers.countryDataController;t&&SC.typeOf(e)!==SC.T_HASH&&(CW.notificationCenter.subscribeToNotification("phoneFormatJSONLoaded",this,this.phoneFormatJSONLoaded),e!==YES&&n.loadCountryData(t))}.observes("countryCode"),formatPhoneNumbers:function(e){var t;if(e){var n=this .get("countryCode"),r=this.get("phoneFormat"),i=this.getInternationalPrefix(e);r&&SC.typeOf(r)===SC.T_HASH&&(t=CK.PhoneNumbers.formatEntryforDigits(e,i,n,r))}return t||(t=CK.PhoneNumbers.normalizeString(e)),t}},CK.PhoneNumbers.PhoneTextFieldUpdater={_deleteKeyPressed:NO,updateOnEachKeyStroke:YES,validateAction:function(){this.set("value",this.get("formattedValue"))},validateTarget:null,inputTextFieldElement:function(){var e=this.$("input:text")[0];return e?e:null}.property().cacheable(),valueObserver:function(){this.invokeLater(function(){var e=this.get("inputTextFieldElement");if(!e){SC.warn("%@ view doesn't have a text input element",this);return}var t=this.get("value"),n=this.get("updateOnEachKeyStroke"),r=this.get("validateAction"),i=this.get("validateTarget")||this,s=this.get("_deleteKeyPressed");if(!n||!r){SC.warn("Since the 2 required parameters updateOnEachKeyStroke and validateAction are not provided we cannot proceed further.");return}if(!t)return;if(!s)if(this.getPath("formattedValue")!==t){this.getCursorPosition(e);if(r&&i){var o=r;SC.typeOf(o)!==SC.T_FUNCTION&&(o=i[r]),SC.typeOf(o)===SC.T_FUNCTION&&o.call(i)}}else this.setCursorPosition(e);this.set("_deleteKeyPressed",NO)},5)}.observes("value"),getCursorPosition:function(e){if(!e)return;var t=e.selectionStart,n=this.get("value"),r;n&&(this.set("_tempCursorPos",t),t===n.length?r=null:r=n.charAt(t),this.set("_tempCharAtCursor",r))},setCursorPosition:function(e){if(!e)return;var t=this.get("_tempCursorPos"),n=this.get("_tempCharAtCursor"),r=this.get("value");if(t){while(r.charAt(t)!==n&&t=":ur&&this.moveChildProperty(s,o,r);break;default:CW.fatalError("Operator not supported by `moveUntil`: "+ n+"; only <= and >= supported.",{operator:n,propertyPath:e})}},resizeUntil:function(e,n,r){var i=t(this,e),s=i.child,o=i.property,u=s[o];switch(n){case">=":ur&&this.resizeChildProperty(s,o,r);break;default:CW.fatalError("Operator not supported by `moveUntil`: "+n+"; only <= and >= supported.",{operator:n,propertyPath:e})}},moveChildProperty:function(e,t,n){n===undefined&&CW.fatalError("No value passed to `moveChildProperty`",{child:e,property:t});switch(t){case"left":this.moveLeft(e,n);break;case"right":this.moveRight(e,n);break;case"top":this.moveTop(e,n);break;case"bottom":this.moveBottom(e,n);break;case"centerX":this.moveCenterX(e,n);break;case"centerY":this.moveCenterY(e,n);break;default:CW.fatalError("Cannot move property `"+t+"` of `"+e.name+"` in plan",{child:e,plan:this,property:t})}},resizeChildProperty:function(e,t,n){n===undefined&&CW.fatalError("No value passed to `moveChildProperty`",{child:e,property:t});switch(t){case"left":this.resizeLeft(e,n);break;case"right":this.resizeRight(e,n);break;case"width":this.resizeWidth(e,n);break;case"top":this.resizeTop(e,n);break;case"bottom":this.resizeBottom(e,n);break;case"height":this.resizeHeight(e,n);break;default:CW.fatalError("Cannot resize property `"+t+"` of `"+e.name+"` in plan",{child:e,plan:this,property:t})}},moveLeft:function(e,t){var n=e.width;e.left=t,e.right=t+n,e.centerX=t+n/2},resizeLeft:function(e,t){var n=e.right-t;e.left=t,e.width=n,e.centerX=t+n/2},resizeWidth:function(e,t){var n=e.left;e.width=t,e.right=n+t,e.centerX=n+t/2},moveRight:function(e,t){var n= e.width;e.right=t,e.left=t-n,e.centerX=t-n/2},resizeRight:function(e,t){var n=t-e.left;e.right=t,e.width=n,e.centerX=t-n/2},moveCenterX:function(e,t){e.centerX=t;var n=e.width,r=n/2;e.left=t-r,e.right=t+r},moveTop:function(e,t){var n=e.height;e.top=t,e.bottom=t+n,e.centerY=t+n/2},resizeTop:function(e,t){var n=e.bottom-t;e.top=t,e.height=n,e.centerY=t+n/2},resizeHeight:function(e,t){var n=e.top;e.height=t,e.bottom=n+t,e.centerY=n+t/2},moveBottom:function(e,t){var n=e.height;e.bottom=t,e.top=t-n,e.centerY=t-n/2},resizeBottom:function(e,t){var n=t-e.top;e.bottom=t,e.height=n,e.centerY=t-n/2},moveCenterY:function(e,t){e.centerY=t;var n=e.height,r=n/2;e.top=t-r,e.bottom=t-r}})}(),function(){var e=0;if(SC.browser.isIE||SC.browser.isMozilla)e=1;var t={x:0,y:0,width:0,height:0};CW.ChildLayoutPlanSupport={initialChildLayouts:{},childLayoutPlan:function(){return CW.ChildLayoutPlan.create()}.property().cacheable(),initializeChildLayoutPlanForViews:function(n,r){var i=r.length,s,o=this.initialChildLayouts,u=this.get("frame"),a,f,l,c,h,p;for(s=0;s0){var i=r.pop(),s=i.get("displayName");n="Dialog.UnsavedChanges.Description".loc(s)}else CloudOS._receivedBeforeUnload=YES}return n},window.onhashchange=function(){if(CloudOSBootstrap.isOnSupportedMobile)return;var e=CloudOS.workspaceController,t=CloudOS.authController,n=CloudOS.appController,r=CloudOS.statechart,i=n.getDefaultAppName (),s=CloudOS.getShareDetailsFromUrl(),o=CloudOS.getAppRouteFromHash(),u=CloudOS.appManagerFor(i),a=n.get("currentApp"),f=n.get("pendingApp"),l=a===u,c=CloudOS.shareController;if(t.get("isNotAuthenticated"))u&&s?CloudOS.handleShareDetails(s,u):r.gotoState("active.authUI");else if(t.get("isAtLeastPartiallyAuthenticated")){if(l&&o===u.get("route"))return;if(CloudOS.get("isCloudOSMini"))return;!s&&!u&&!COS.apps[i]&&window.location.hash!==""&&(i=null,e.clearHash());if(t.get("isPartiallyAuthenticatedForManagedAppleId"))u&&(u.set("loadReason",CK.LOAD_REASON_LOCATION_HASH),n.set("pendingApp",u));else if(u&&u.get("isHSALocked"))u.set("loadReason",CK.LOAD_REASON_LOCATION_HASH),n.set("pendingApp",u),r.sendAction("showHSA",CloudOS.HSASourceEnum.USER_SELECTED_APP);else if(u&&u.get("isPCSKeysDeletedLocked"))r.sendAction("showPCSDeletedMessage",u.get("displayName")),window.location.hash=a?a.get("name"):"";else if(s){if(t.shouldShowFirstRun(t.get("accountPreferences"),CW.getUrlParameters()))return;c.get("isZoneICloudApple")?c.launchApp():CloudOS.handleShareDetails(s,u)}else if(CloudOSBootstrap.willLoadMobileSupportedApp&&(!u||!u.get("isSupportedOnMobile")))if(a)window.location.hash=a.get("name");else{var h=SC.browser,p=window.location.origin;if(!p){var d=window.location;p=d.protocol+"//"+d.hostname}if(h.iPhone||h.iPod){window.location=p+"/iphone_welcome/";return}if(h.iPad){window.location=p+"/ipad_welcome/";return}}else if(SC.none(u)||u&&!u.get("isLocked")&&u!==f)u&&u.set("loadReason",CK.LOAD_REASON_LOCATION_HASH),CloudOS.openApp(i)}}},run:function(){if(this._hasRunRun===(this._hasRunRun=YES )){SC.warn("CloudOS.run() has been called, but has already been called once.");return}SC.debug("CloudOS window is %@ initially",document.hidden?"hidden":"visible"),SC.Event.add(window,"visibilitychange",SC.RunLoop.wrapFunction(function(){document.hidden?SC.debug("CloudOS window is hidden"):SC.debug("CloudOS window is visible")})),CloudOS.loadLocalizedStrings(),CloudOS.localizationController.relocalizeIfNeeded("CloudOS.run() wants the initial relocalize call"),CloudOS.appController.initializeAppManagers(),CloudOS.statechart.initStatechart();var e=SC.RootResponder.responder,t=CloudOS.workspaceController,n=COS.statsController;e.set("defaultResponder",CloudOS.statechart),e.listenFor("resize".w(),window,t),t.updateTitle(),COS.prefsController.set("delegate",CloudOS),CW.notificationCenter.subscribeToNotification("configBagReceived",CloudOS.initializationController,CloudOS.initializationController.handleConfigBag),SC.Event.add(window,"message",this,SC.RunLoop.wrapFunction(this._messageWasReceived),null,!0),n.recordStat("cloudos","DidLoad",{duration:SC.getCurrentTimeForPerformance()-SC.benchmarkPreloadEvents.headStart});var r=window.location.search;if(r&&(r.indexOf("?sc")===0||r.indexOf("&sc")!==-1)){var i=window.location,s=i.href,o=URI(s),u=CloudOS.appController.getDefaultApp();n.recordStat("cloudos","BookmarkDetection",{hostname:window.location.hostname,buildNumber:SC.buildNumber,masteringNumber:SC.masteringNumber,referrer:function(){var e=document.referrer,t;return e?(t=URI(e),t.hostname()+"/"+t.path()):""}(),defaultApp:u?u.get("name"):""});var a=function(e){i.href="https://"+o.hostname ()+"/not_found/"},f=SC.browser.msie?YES:NO;n.sendStats(f,a)}},loadAlarms:function(){var e=YES;COS.authController&&COS.authController.getPath("user.isLiteAccount")&&(e=NO),e&&CloudOS.runWhenReady(function(){SC.Module.loadModule("cloudos_foundation/alarms","CloudOS.Alarms","initializeAlarmControllers")})},_messageWasReceived:function(e){var t=e.originalEvent,n=URI(t.origin),r=this.get("supportedDomainsToReceiveMessagesFrom"),i=n.domain();if(n.protocol()!=="https"||!r.contains(i)){SC.warn("Ignoring message from invalid domain "+i);return}var s=t.data,o=SC.typeOf(s),u,a,f,l,c,h=NO,p=NO,d=COS.statsController;if(o===SC.T_STRING){var v=CloudOS.APPLE_ID_WIDGET_POST_MESSAGE_PREFIX,m=CloudOS.APPLE_AUTH_WIDGET_POST_MESSAGE_PREFIX,g=NO,y=NO;s.indexOf(v)===0&&(h=YES,s=s.substring(v.length)),s.indexOf(m)===0&&(p=YES,s=s.substring(m.length))}try{o===SC.T_STRING?(u=SC.json.decode(s),t=SC.clone(t),t.data=u):u=s}catch(b){SC.warn(b);return}if(h){CloudOS.appleCreateWidgetController?CloudOS.appleCreateWidgetController.handleMessage(u):(SC.debug("No appleCreateWidgetController to handle message with data "+s),d.recordStat("cloudos","InvalidAppleIdCreateMessage",u));return}if(p){CloudOS.appleAuthWidgetController?CloudOS.appleAuthWidgetController.handleMessage(u):(SC.debug("No appleAuthWidgetController to handle message with data "+s),d.recordStat("cloudos","InvalidAppleIdAuthMessage",u));return}if(!u||!u.isCloudOSMessage)return;if(u.isWindowApplicationMessage){f=CloudOS._applicationWithOpener,f&&f.get("contentWindow").CK.currentApplication._messageWasReceived(e);return}if(u.widgetName==="NewLogin" ){CloudOS.newLoginController.handleMessage(u);return}a=u.appName,f=CloudOS.appManagerFor(a),l=u.methodName,c=u.args||[];if(!f){SC.warn("Could not find an appManager for %@ from %@",a,t.origin);return}f.setIfChanged("buildNumber",u.buildNumber),f.setIfChanged("masteringNumber",u.masteringNumber),c.unshift(t),c.unshift(f),this.respondsTo(l)?this[l].apply(this,c):d.recordStat("cloudos","InvalidCloudOSMessage",u)},_windowMessageWasReceived:function(e){SC.RunLoop.end(),SC.run(function(){this._messageWasReceived(e)},this)},passMessageToAllApps:function(e,t,n){var r=CloudOS.appController.get("loadedApps");if(r){var i=r.length;for(var s=0;s1?e.substr(1):"",t=/v\/([^\/]+)(\/updated)?/,n=e.match(t);if(n)s={},s.vettingToken=n[1],s.isVettingTokenVetted=!!n[2];else{r=/([^\/]+)\/([a-zA-Z0-9_\-]+)/,i=e.match(r);if(i){var o=i[1],u=i[2],a=o==="share",f,l=CloudOS.authController.get("performedLoginFlow"),c=this.isUserAuthenticated();o==="notes"&&CloudOS.appManagerFor("notes2")&&(o="notes2"),f=COS.appsController.getAppInfoFor(o);if(a||f&&f.get("isCloudOSInterceptingShareUrls"))s={},u.length<=25||c&&!l&&!CK.get("isCarry")?s.shortGUID=u:s.longGUID=u,s.appNameFromUrl=a?null:o}}return s},handleShareDetails:function(e,t){if(e){var n=e.shortGUID,r=e.longGUID,i=e.appNameFromUrl,s=i==="keynote"||i==="numbers"||i==="pages",o=e.vettingToken,u=this.get("statechart"),a=this.isUserAuthenticated();if(n)t&&t.get("isLoaded")?t.passMessage("ckShortGUIDDidChange",n):u.sendAction("goToSharingState",e);else if(r&&s&&a){var f=CloudOS.appManagerFor(i).getAppDomain();window.location.href=URI(f+"/"+i+"/"+r).addSearch("redirectReason","off").toString()+"#:nooverride"}else o&&u.sendAction("goToVettingState",e)}},appManagerFor:function(e){var t=arguments.callee.apps||(arguments.callee.apps=CloudOS.appController.get("apps")),n=arguments.callee.appsList||(arguments.callee.appsList= CloudOS.appController.get("appList"));if(typeof e=="number")return n&&n[e];if(typeof e=="string")return t&&t[e];if(e&&e.isAppManager)return e;if(!e)return;return t&&t[e.get("name")]},appManagersForPushTopic:function(e){var t=CloudOS.appController.get("apps"),n,r,i=[];for(r in t)n=t[r],n.getPath("appInfo.pushTopic")===e&&i.push(n);return i},appManagersForContainerIdentifier:function(e){var t=CloudOS.appController.get("apps"),n,r,i=[];for(r in t)n=t[r],n.getPath("appInfo.containerIdentifier")===e&&i.push(n);return i},openApp:function(e){var t=CloudOS.workspaceController.get("nowShowing"),n=CloudOS.statechart,r=CloudOS.authController,i=r.get("isPartiallyAuthenticated"),s=r.get("isPartiallyAuthenticatedForManagedAppleId");if(t0;CloudOS.get("hasDialogAboveApp")!==e&&CloudOS.set("hasDialogAboveApp",e)}.observes("numberDialogsAboveApp"),runWhenReady:function(e,t){var n=this._readyQueue;return t===undefined?(t=e,e=null):SC.typeOf(t)===SC.T_STRING&&(t=e[t]),this._isReady?t.call(e):(n||(this._readyQueue=[]),this._readyQueue.push(function(){t.call(e)})),this},_executeReadyQueue:function(){if(CloudOS._outstandingRequests>0){this._invokeLaterTimer&&this._invokeLaterTimer.invalidate(),this._invokeLaterTimer=this.invokeLater(function(){CloudOS._executeReadyQueue()},1e3);return}this._isReady=YES;var e=this._readyQueue,t,n;if(e){SC.info("Executing CloudOS readyQueue");for(t=0,n=e.length;t-1&&t.set("badgeCount",e)},recordStat:function(e,t){var n,r;arguments.length>=3?(n=arguments[0],r=n.get("name"),e=arguments[2],t=arguments[3]):r=t&&t.appName?t.appName:"cloudos",SC.empty(t)?t={appName :r}:t.appName=r,COS.statsController.recordStat(r,e,t)},beginStat:function(e,t){var n=arguments[0],r=n.get("name");e=arguments[2],t=arguments[3],COS.statsController.beginStat(r,e,t)},endStat:function(e,t){var n=arguments[0],r=n.get("name");e=arguments[2],t=arguments[3],COS.statsController.endStat(r,e,t)},passMessageToOpenerApplication:function(e){},hasOpenerWithCloudOS:function(){return!!CloudOS.getOpenerWithCloudOS()},setAccountPreference:function(e,t,n,r){var i=COS.authController.get("accountPreferences"),s;if(!i)return;var o=i.get(n);if(o==r)return;if(n==="locale"||n==="secondaryLocale")s=i.get("localeForCloudOS");i.set(n,r);switch(n){case"locale":case"secondaryLocale":i.set("startupUrls",{}),CW.notificationCenter.postNotification("accountPrefsChanged",i.get("localeForCloudOS"),s);break;case"timeZone":i.set("startupUrls",{})}},logoutFromAllBrowsers:function(){COS.authController.logoutUser(function(){CK.reloadWithReason("signOutAllBrowsers")},YES,YES,YES)},requestMeCard:function(e,t){},deleteMeCardPhoto:function(e,t){var n=CK.meCardController,r=n.get("photo");n.deletePhoto(),this._updateMeCardPhoto(e,t,null,r)},storeMeCardPhoto:function(e,t,n){if(!n)return;var r=CK.meCardController,i=r.get("photo");r.set("photo",n),this._updateMeCardPhoto(e,t,n,i)},_updateMeCardPhoto:function(e,t,n,r){function i(e){e===1&&CK.meCardController.set("photo",r);var t=CloudOS.requestMeCard();CloudOS.passMessageToAllApps("receiveMeCard",t)}CK.meCardController.storeMeCard({photo:n},i)},handleApplicationCrash:function(e,t){var n=arguments[0],r=n.get("name");e=arguments[2],t=arguments[3],e=e?SC.clone (e,NO):{},e.applicationName=r,t&&(e.applicationLog=t),COS.handleApplicationCrash(e)},recordApplicationMessage:function(e,t){var n=arguments[0],r=n.get("name");e=arguments[2],t=arguments[3];var i=t?": "+JSON.stringify(t):"";SC.info('applicationMessage "%@" received from %@%@',e,r,i),COS.statsController.recordLocationStat(r,e,t),e==="OnErrorException"&&n.recordException("OnErrorException: "+i)},didReceiveSpecialResponse:function(e,t,n){SC.typeOf(e)!==SC.T_NUMBER&&(e=arguments[2],t=arguments[3],n=arguments[4]);var r;switch(e){case 330:this._suspendedCount=this._suspendedCount?++this._suspendedCount:1;if(this._suspendedCount>3){SC.warn("Have reached suspendCount max for 330 responses. Will stop retrying."),this.invokeLater(function(){CloudOS._suspendedCount=0},1e4);return}CloudOS.authController.validateUser(function(){CloudOS.appController.userDidRevalidate()});break;case 421:case 401:try{r=SC.json.decode(t)}catch(i){SC.info("Cannot decode response: "+t)}CloudOS.authController.logoutUser(function(){CK.reloadWithReason("received a "+e+" in didReceiveSpecialResponse")},YES);break;case 403:window.location.hash="#:showlogin",CK.reloadWithReason("received 403 in didReceiveSpecialResponse");break;case 503:CloudOS.statechart.sendAction("showServiceLocked",n)}},requestSent:function(){this._outstandingRequests===undefined&&(this._outstandingRequests=0),this._outstandingRequests++},requestReceived:function(e,t,n,r){this._outstandingRequests--;var i;e&&SC.typeOf(e)!==SC.T_HASH?(i=arguments[0].get("name"),e=arguments[2],t=arguments[3],n=arguments[4],r=arguments[5]):i="cloudos",e&&COS.statsController .recordLocationStat(i,"RequestInfo",e);if(t===undefined||t===null)return;var s=String(t)[0];if(s==="5"||s==="0"){var o=CK.isURLInCarryPartition(n)?"ServerErrorOrTimeoutInCarry":"ServerErrorOrTimeout",u=URI(n),a=u.hostname(),f=(a+u.path()).replace(/[0-9]{3}/g,"…");COS.statsController.recordStat(i,o,{status:t,sanitizedUrl:f,serverHostname:a,responseBody:r})}},relayKeyboardShortcut:function(e,t,n){CW.performKeyEquivalent(n)},relayMouseMove:function(e,t,n){CloudOS._lastActivityEpoch=(new Date).getTime()},meCardUpdated:function(){SC.debug("meCardUpdated(), will grab latest version..."),CK.meCardController.getMeCard()},getClientId:function(){},isReadyToTerminateDidChange:function(){var e=arguments[0],t=arguments[2];e.set("isReadyToTerminate",t)},windowApplicationHasInitialized:function(){},appWillUnload:function(e){var t=arguments[0],n=t.get("name");e=arguments[2],e&&(SC.info("appWillUnload log from %@:",n),SC.info(e));if(!CloudOS._receivedBeforeUnload){if(t.get("loadReason")===CK.LOAD_REASON_RELOAD)return;CloudOS.appController.get("currentApp")===t&&t.get("isLoaded")?(SC.info("appWillUnload: Reloading application, most likely because user chose to Reload Frame"),CloudOS.appController.reloadApplication(n)):t.teardown()}},setAppBanner:function(e,t){},currentAppName:function(){},getQuotaData:function(){},isUserOverQuota:function(){},refreshQuotaData:function(){},fetchIcon:function(e,t,n,r){var i=null,s=null;if(typeof e=="string"){n||(n=window.devicePixelRatio);if(window.CoreTypes){var o=window.CoreTypes.API.fetchIcon(e,t,n,r);return o}return{}}i=arguments[0],s=arguments[1],e=arguments [2],t=arguments[3],n=arguments[4],r=arguments[5];var u=s.data.id;n||(n=window.devicePixelRatio);if(!window.CoreTypes)SC.Module.loadModule("cloudkit/core_types",this,function(){var s=window.CoreTypes.API.fetchIcon(e,t,n,r);i.passMessage(CK.RPC_RESPONSE,u,s)}.bind(this));else{var a=window.CoreTypes.API.fetchIcon(e,t,n,r);i.passMessage(CK.RPC_RESPONSE,u,a)}},getConformingTypes:function(e,t,n){var e=arguments[0],r=t.data.id;if(!window.CoreTypes)SC.Module.loadModule("cloudkit/core_types",this,function(){var t=window.CoreTypes.API.getConformingTypes(n);e.passMessage(CK.RPC_RESPONSE,r,t)}.bind(this));else{var i=window.CoreTypes.API.getConformingTypes(n);e.passMessage(CK.RPC_RESPONSE,r,i)}},fetchAppUrl:function(e,t,n,r){var i=CloudOS.appManagerFor(r),s=i&&i.get("path");e.passMessage("didFetchAppUrl",n,s)},completeAuthentication:function(e,t,n){var r=CloudOS.appManagerFor(n)||e,i=e.get("name");if(CloudOS.authController.get("userAuthenticationState")!==CK.AuthenticationStateEnum.PARTIALLY_AUTHENTICATED_HSA){SC.info("completeAuthentication(): User is not partially authenticated, nothing to do here.");return}CloudOS.appController.exitApplication(i,CK.EXIT_NON_FATAL,null,r)},loadRulesForRegions:function(e,t,n){var r=t.data.id;COS.regionController.load(n,function(t){e.passMessage(CK.RPC_RESPONSE,r,t)}.bind(this))},resolveCKShortGUID:function(){},replaceCurrentApp:function(e){},getWindowMinimumSize:function(){},isOnSupportedMobile:function(){},getSecureChannelInfo:function(){},getDefaultAssetHostname:function(){}},CloudOS._cloudOSAPIMethodNames=function(){var e=[],t;for(t in CloudOS.API)CloudOS .API.hasOwnProperty(t)&&e.push(t);return e}(),CloudOS.mixin(CloudOS.API),CloudOS.mixin(CK.CloudOSGetterSupport),CloudOS.displayApps=[{name:"mail",notificationIcon:window.devicePixelRatio>1?"/system/cloudos/1812Project43/cloudos_foundation/1812Project43/en-us/source/resources/images/mail_icon_notification@2x.png":"/system/cloudos/1812Project43/cloudos_foundation/1812Project43/en-us/source/resources/images/mail_icon_notification.png",appIconUrl:"/system/cloudos/1812Project43/cloudos_foundation/1812Project43/en-us/source/resources/images/app_icons/mail_icon.png",appIconUrl2x:"/system/cloudos/1812Project43/cloudos_foundation/1812Project43/en-us/source/resources/images/app_icons/mail_icon@2x.png"},{name:"contacts",appIconUrl:"/system/cloudos/1812Project43/cloudos_foundation/1812Project43/en-us/source/resources/images/app_icons/contacts_icon.png",appIconUrl2x:"/system/cloudos/1812Project43/cloudos_foundation/1812Project43/en-us/source/resources/images/app_icons/contacts_icon@2x.png"},{name:"calendar",appIconType:"calendar",notificationIcon:window.devicePixelRatio>1?"/system/cloudos/1812Project43/cloudos_foundation/1812Project43/en-us/source/resources/images/calendar_icon_notification@2x.png":"/system/cloudos/1812Project43/cloudos_foundation/1812Project43/en-us/source/resources/images/calendar_icon_notification.png",appIconUrl:"/system/cloudos/1812Project43/cloudos_foundation/1812Project43/en-us/source/resources/images/app_icons/calendar_icon_background.png",appIconUrl2x:"/system/cloudos/1812Project43/cloudos_foundation/1812Project43/en-us/source/resources/images/app_icons/calendar_icon_background@2x.png" },{name:"notes",appIconUrl:"/system/cloudos/1812Project43/cloudos_foundation/1812Project43/en-us/source/resources/images/app_icons/notes_icon.png",appIconUrl2x:"/system/cloudos/1812Project43/cloudos_foundation/1812Project43/en-us/source/resources/images/app_icons/notes_icon@2x.png"},{name:"notes2",appIconUrl:"/system/cloudos/1812Project43/cloudos_foundation/1812Project43/en-us/source/resources/images/app_icons/notes_icon.png",appIconUrl2x:"/system/cloudos/1812Project43/cloudos_foundation/1812Project43/en-us/source/resources/images/app_icons/notes_icon@2x.png"},{name:"reminders",notificationIcon:window.devicePixelRatio>1?"/system/cloudos/1812Project43/cloudos_foundation/1812Project43/en-us/source/resources/images/reminders_icon_notification@2x.png":"/system/cloudos/1812Project43/cloudos_foundation/1812Project43/en-us/source/resources/images/reminders_icon_notification.png",appIconUrl:"/system/cloudos/1812Project43/cloudos_foundation/1812Project43/en-us/source/resources/images/app_icons/reminders_icon.png",appIconUrl2x:"/system/cloudos/1812Project43/cloudos_foundation/1812Project43/en-us/source/resources/images/app_icons/reminders_icon@2x.png"},{name:"find",notificationIcon:window.devicePixelRatio>1?"/system/cloudos/1812Project43/cloudos_foundation/1812Project43/en-us/source/resources/images/find_icon_notification@2x.png":"/system/cloudos/1812Project43/cloudos_foundation/1812Project43/en-us/source/resources/images/find_icon_notification.png",appIconUrl:"/system/cloudos/1812Project43/cloudos_foundation/1812Project43/en-us/source/resources/images/app_icons/find_icon.png",appIconUrl2x :"/system/cloudos/1812Project43/cloudos_foundation/1812Project43/en-us/source/resources/images/app_icons/find_icon@2x.png"},{name:"fmf",appIconUrl:"/system/cloudos/1812Project43/cloudos_foundation/1812Project43/en-us/source/resources/images/app_icons/fmf_icon.png",appIconUrl2x:"/system/cloudos/1812Project43/cloudos_foundation/1812Project43/en-us/source/resources/images/app_icons/fmf_icon@2x.png"},{name:"iclouddrive",appIconUrl:"/system/cloudos/1812Project43/cloudos_foundation/1812Project43/en-us/source/resources/images/app_icons/icloud_drive_icon.png",appIconUrl2x:"/system/cloudos/1812Project43/cloudos_foundation/1812Project43/en-us/source/resources/images/app_icons/icloud_drive_icon@2x.png"},{name:"photos",appIconUrl:"/system/cloudos/1812Project43/cloudos_foundation/1812Project43/en-us/source/resources/images/app_icons/photos_icon.png",appIconUrl2x:"/system/cloudos/1812Project43/cloudos_foundation/1812Project43/en-us/source/resources/images/app_icons/photos_icon@2x.png"},{name:"pages",appIconUrl:"/system/cloudos/1812Project43/cloudos_foundation/1812Project43/en-us/source/resources/images/app_icons/pages_icon.png",appIconUrl2x:"/system/cloudos/1812Project43/cloudos_foundation/1812Project43/en-us/source/resources/images/app_icons/pages_icon@2x.png"},{name:"numbers",appIconUrl:"/system/cloudos/1812Project43/cloudos_foundation/1812Project43/en-us/source/resources/images/app_icons/numbers_icon.png",appIconUrl2x:"/system/cloudos/1812Project43/cloudos_foundation/1812Project43/en-us/source/resources/images/app_icons/numbers_icon@2x.png"},{name:"keynote",appIconUrl:"/system/cloudos/1812Project43/cloudos_foundation/1812Project43/en-us/source/resources/images/app_icons/keynote_icon.png" ,appIconUrl2x:"/system/cloudos/1812Project43/cloudos_foundation/1812Project43/en-us/source/resources/images/app_icons/keynote_icon@2x.png"},{name:"newspublisher"},{name:"settings",notificationIcon:window.devicePixelRatio>1?"/system/cloudos/1812Project43/cloudos_foundation/1812Project43/en-us/source/resources/images/settings_icon_notification@2x.png":"/system/cloudos/1812Project43/cloudos_foundation/1812Project43/en-us/source/resources/images/settings_icon_notification.png",appIconUrl:"/system/cloudos/1812Project43/cloudos_foundation/1812Project43/en-us/source/resources/images/app_icons/settings_icon.png",appIconUrl2x:"/system/cloudos/1812Project43/cloudos_foundation/1812Project43/en-us/source/resources/images/app_icons/settings_icon@2x.png"}],function(){var e=CloudOS.displayApps,t={},n;for(var r=0;n=e[r];r++)t[n.name]=n;CloudOS.displayInfoFor=function(e){return t[e]}}(),CloudOS.AppManager=SC.Object.extend({isAppManager:YES,appInfo:null,get:function(e){var t=arguments.callee.base.apply(this,arguments);if(t===undefined){var n=this.get("appInfo");if(n){var r=n.get(e);r!==undefined&&(t=r)}}return t},set:function(e,t){var n;return this.getPath("appInfo."+e)!==undefined?n=this.get("appInfo").set(e,t):n=arguments.callee.base.apply(this,arguments),n},warningArrowAsset:window.devicePixelRatio>1?"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAAB0CAMAAAB648r2AAAAMFBMVEUAAADwsQXlqgbgiwDqnwLnlQHljwDkjwD60QkaGhr3yQjzvgeDcBFcUBU5NBeukw7thH3zAAAACHRSTlMA/u0YxZtrPo5RIdgAAAMJSURBVHjaxdvtauMwEIXhSLFiZfTh+7/bspByNs2yL64Yz/ldqBjrkY9celvJo+SUcnncYvLIzaxWs5YjlnDfmtVXrG23y7O1WpXrV1BafUsrt0uzp/ojab/2AVj9EdsuBdDqR9rjQgHZ6kcs3wN2YMw+vKf6z6R7yA5UrEQRFMWgAYhiFEFRDCIoilEENYIQgoq5UyxW/5tWogiKYhBBUYwhqDTPEYggUAwZgCgGEfQvBiJIFKMIqhgEERTFqB2o0yiAIIzAawDWzJeiCNrHnPuYzz+Z4zCg6FED+vOvzPxB0Zvg8XzLNF+KIqgBvOdw7ej75w4csABRdCBIE2CK5wniArIPRTVx2IRPO1cM1pt4/qHA5TQSwc/Y8y0D3ooOb8H5toDudF0WQXB4wFvRoQZ0QAAUzxIkBubS0UWQGEzo6C6XYUAgil5NfAICFQOnIjoAgYqBUxPvgEAUlwfADBoUVJcmnhkBUzxPUDFAoBGsEmQG3eO6LILMoNN12ecy3FEhU2SCwAAVcjFggrwA+lErLpfhxAp1GrlchkEhUMQBcCYjYIp8BrHDvvDxDs4gcAgKYQRMEBmAQqBIBDkHKASK1MQ5GRQCRRoAx0AhUESCnAkLgH1IBDkDFAJFIsjpoBBGQDWA00khFwOuAewQJgbFAM8gdlgVpniGIKfBMQAUkSAHFEJHxxrAOeYcQrA8Ah4AhykCQc8wxeI0AKYogv5JdyDoHdugBrgn7YsElXb00Y+2MIIlgta/W7Gdpsg1gGO6HQ9bocgE+RvROE1x/Qxq8KkWKK4T7PC1HDs6n0HcB5V5cgGiCAOARqwsUBRBpwUwRRH0fwSiCATdNqFGAAQpGf5kQzFRxCbOz2D8qhgAQYpN7YD2u7ciEKS07xmMtlAMlopo7mOOnisEOjoQdIxl7ybOFDWAoBGEDUC7oFgNjJWoJyCJqYYmBy/A0i1HT2AL3gPRDB/YBfxvyiXyKC7QB6/5WrIni/r9+6sRxcyg5V3/O5jaxWuwlsr9puxly+nC5O3x+vVfbQEXSDg8FDIAAAAASUVORK5CYII=" :"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAAA6CAMAAAA3Dq9LAAAAMFBMVEUAAADvsAXrogPmlQHljwDhiwDjjwD60QkaGhr4ygj0vQfOrQxQRhaehRB3ZhMuKxicpDLjAAAAB3RSTlMA/NObZRg355pkiwAAAXBJREFUeNqlldGywyAIBYumGjSJ//+37Xg7dx86loHsO/TIEvr4yZZE0vYIk0W1asvR+q3VSQtmeIrWicoz9gCtH2KPKFL/kRJokJQGmuITZI6hAESIBiCCXyEEVGYCoDKoEJWhCYJmR4BGHbTiD9DP6zo7Kr0Kz31yoNKp8Nj/6Kj0KKRBQ6Vvh65PA982cQaYASp9Cvs+uRYq7R0SGqDS9RWO2eB0fJVPAqChOw5DJgAa6EkEWyEahnEYAIU0wCIqHWegIwGkWApBkQCaTIUwkPA1RyMAHqUCEcwAeKxABFMhGkYFVJo7RAMsQsuGQjxiEVC5miA0LAJzXE4QjtGrceMJ4IAIBHCBShT6QCUKAc7juBjCUmURAnwflNHNCHlR3znrQIe8/jNmDzlJP1QmjTXQhELfE1BpKbw464sIKFxpHAf1gEoCuEAlAUK0jAIfTEHqLeR+gqw3Z1DuWSjvRRTVYHmTuYolJ4mR37//AstYPbuhXX/mAAAAAElFTkSuQmCC",lockBadgeAsset:window.devicePixelRatio>1?"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEgAAABICAYAAABV7bNHAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAABPFJREFUeNrsXE1PJEUYrplRcDdCPIgXXUjcED7cTVb3sB40BsJJk0k86ATUZOOFCGZnxwt/YjfhB3AyC4QD8eIaQ4iiF724qBk0RldCnFV3mUiYgXE+gNr3aapJz0cz3TNV3T1DPcmTMMzUW11Pv1X99lsfIeYtIsTLxKvEl4gXiReIzxKfJp4Xv8sR94lp4l/EP4gbxHvEn4mHrI3wHHGaeJeYIfImmRG2YPOFVhWlg/iuaEhRgih2hCd9TXxP1Bl4oIvERbfgHjNFvGnppoHCk8RPiA99EKaSuIaPiU8ERZzXxADKA0YM6Nf89prbxKMAimMdo26La/UUvcTvAixMJXGtfV52qXQLiWPyP+IbqsWJiiCOtyj/J76tSpzrxIMWFsck2vChbHHG20Qcq0hRWeKMEgttJI7JfdG2pvCiGNx4m3JHvDDbInTKd53E74lXlMUKvb1sYmKCjYyMsOHhYdbT08NKpRJLpVJsa2uLra2tsaWlJba5uanywfMT8VVi3m3BWVV3joThCwsL/ODggNfD4eGh8VuUUehJs43EOkoi5Gg0yjOZDHeLbDbLx8fHVQmEtr7u5hXiFxUXEo/HDY9oFEdHRzyRSKgS6VenryQ3VFxALBYzGliJjY0No9GDg4O8s7PT4NDQkPE/fFdLJNhSJFKinjjniP+qGHPQRawoFAp8enqah8Nh23L4bnJykudyuarupmhMeig0sEVcxZ2Zn5+vEmdsbMxx+dHRUaOMFYuLi6q86OZpaVLpmcC+vr6qcWdqasq1HXhb5dMNthVlJmumb2Mq7sjMzExZw5LJJI9EIq7toAzKWgHbirwoZooStgj0voooDEGgFXNzc4zuvms7KIOyp9mWiA9qTc2UVNwNiorL7jqeVo3aQlkrYFuRB5WEJif4SFWUms/nyxrV0dHRsC2UrRzsFUbXU9Yu9pZX6chisehL2QbwpilQxE2Y7RbpdFpZC7a3t1UKhPRsJCTe1tdV1UI9oTx9EAoFyl4dXIUHvcI07PAyBLqkdbDFpbDIGmrUxkUIdEG21f7+fra8vMx2d3drjiHNsBKoA3WhTgUwltf8JjN+GBgY4Ds7O9xroE7ULTkW+h0C/S3TKN1N7hdQt2SB/sEzMsuOl79JAVy+u7vblwFjb2+PdXV1yTS5HxJTyedUxT1eQ3JcVMAgXWQadshDoF2tgy2yECitdbB/3QuLNKtGbaQg0J9aB1vch0BJrYMtkhDontbBFusIGpAwwzIQKRFWG8VBe8Rn4EGYYvhWO0sVvoE2Zk76rtajCl8YHik+YIrjAZOwfL9NuhjWMD5PfGR60CPil9ppTrAiNCmbWb2jdTnBp+YfVoE+Y8cT900hk8n41iqkOyTggdCiSiC81d9q1vrq6qp//WJlRYaZW+yUDEfTC6gwf+5XyrWZeX/mcAEV0PQSPOSGkf5sZLGmW6AO1CUpH51w4mLKFnEGnI4XcQLKlgEHlK6WAZuYPUMCzTYymmMrwvoZEOdH4lONPvLO/GYWJ2jX7VA5JmE7lAm9oc4BrjO9JbMu9KZehzGS3hZeB/pgAYevJPpoCoddTh9u4sCb9PE4DnBepEv8OGAJdcZZQA9YqgT2W71D/JypP6LrK9ZCR3TVQksf8hbyWCxMc2PheuUxgT2s+phAZOC3Rde5Lx4EP7DjxRaeHRP4WIABANtHKBijf9nZAAAAAElFTkSuQmCC" :"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACQAAAAkCAYAAADhAJiYAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAjRJREFUeNrUWM1OwkAQphxAlBAS44n4e1JegXjRgMKRxPoU8DSIkVfxJEJAL3DhJxwUlQBnigghYZ1ptqZBCrOlNfVLPiid2dmv22F/RnKJ4wAYA0aAYf57i9s+gW1gA1gA3gNfXTbADbwCPgBnQEbkjLeReQxLcAasCYgwYo3HMo0N4I0FQuaZ5bGFsA0s2yBGY5n3QcIOT0pmMxu8r6Xw2Twyi0Zqc5mgO2owj8fD0uk0K5VKTFEUlXiN99AmICpnJCZKDRIKhVilUmFGQBv6CIiKLppn6tSR0cS0Wi2WTCZZIBBQidd4D1GtVpnX66UKqs/PUzL1aVKplNphs9lkwWDwlx3voQ2BvgKjJOsF5akNMU8QOBpGPmhDoK+AoLx+bSIvB5PJRO0MX5GRj9/vV33G4zETXGb28b1dACXRmXMwGBjahsOh+j2dTkVCooZLN1+1yYCkJvvCSIk+ZwQFnbicgzAK2qN4xuNxV7fb/fkNKbKUGrANtiViFz9GlKSDwMwssC0xsUcSF+RbJV3/1GYgSaT/zRe+MsVBOaSgoHcHCfpw832JU1BHQUUHCSpKfOl4WTVb/0FSYwdHbn6OKjhgdFBDW9uDZFZ593o90z31+32KW0Zog5ZIJBiIEp4UO52O2lZ0gya0hbWBsbU3+RYy96+OQY47KOqP0k82inkWOUrriw1ZG8Tcmik22FWOObeyYCWvUbC6phasJBPiDvmcdQo8XlDSe+MJ+2impPctwADNbkrjiKLsLQAAAABJRU5ErkJggg==",shadowAsset:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADMAAAAzCAYAAAA6oTAqAAABzElEQVR42u3a3Y6DIBCG4f6IUpEF3b3/a10OTD7DaKYMtc5uNXnPNuk+AdIKXCqe627t/FwVtBvittK9ohuNR8kR/D/eSOOAchSPaFJmUfvCzKKGQ0kg9wzRvjGgUqUgOiKAtKnugFqA6AhVQ/SDtiHmUAgyWyBmVAjEKoiC6OjQUckWu1VUCxAZHYIh60QVhq4fHpONykNPGB0Gs7pWHtraXjv8FOsVYuzWVOOmWK8uYAyLyaaYUwZxmGoCjMJ4DF38+jFYNx+IGbQlwVjlGCvFeC2dmAzzpaUT858xQUsnJsNELUkxnXJMV4MZFVSNccowjsGQ9xm1GPnLGV6bQ2pSUMBrMzClewBeCcZL9gCwO4OpFlLfBxYwxZiNQIKh68an4kGQOH++e2bfjJ9q+I0WU9ObEFMq4jcZN8Xw8FMNoJAaF6iflwXEmArz53lmihWfAvQroAhUqnYUgIgrkJ47BSg6n8lGyGcoVPjdgQhiwIiUnc9c2CNAgPolCrDqfIboAWGOAgvPNM0KCjA0CHJzAFCE4c40RSCgZhhwtVkAZoQUwt8DAIrAaJYPf78OAAIBgmpvaCCzQw1ibmh80N0Z/beazvtmf/Em4C+GnVIq6T5d5wAAAABJRU5ErkJggg==" ,spinnerAsset:CloudOS.SPINNER_IMAGE_SRC,spinnerAssetFrameCount:3,minWidth:1,minHeight:1,_currentAppLocale:null,_showingSlowConnectionMsg:NO,recordedExceptions:null,recordException:function(e){this.get("recordedExceptions")||this.set("recordedExceptions",[]),this.get("recordedExceptions").push((new Date).toUTCString()+": "+e)},requiresMailAndIsMissing:function(){var e=this.getPath("appInfo.requiredServices");return!e||e.indexOf("mail")===-1?NO:CK.servicesController.getServiceInfoFor("mail")?NO:YES},badgeCount:0,buildNumber:null,masteringNumber:null,path:function(){var e=this.getPath("appInfo.path"),t=this.getAppDomain(),n=this.preferredLocale(),r;return this._currentAppLocale=n,e.indexOf("/")===0||e.indexOf("https://")===0?r=e+"current/"+n+"/":(r=t+"/applications/"+e+"current/"+n+"/index.html",CK.get("isWWW")||(r+="?cache="+CW.UUID())),r=URI(r).addQuery("rootDomain",URI(window.location.href).subdomain()).toString(),r}.property("appInfo.path"),getAppDomain:function(){var e=CK.get("isBeta"),t=CK.get("isFuture"),n=CK.get("isCarry"),r;return e&&this.get("isBeta")?r="https://beta.icloud.com":t&&this.get("isFuture")?r="https://future.icloud.com":n&&this.getPath("isCarry")!==NO?r="https://carry.icloud.com":(r="https://%{defaultDomain}",r=r.fmt({defaultDomain:CloudOS.getDefaultAssetHostname()})),r},preferredLocale:function(){var e=this.get("name"),t=this.get("appInfo"),n=t.get("supportedLocales")||window.supportedLocales,r=CloudOS.authController.get("accountPreferences"),i=r?r.get("locale"):null,s=r?r.get("secondaryLocale"):null,o;n.contains(i)?o=i:n.contains(s)?o=s:n.contains(String .preferredLanguage)&&(o=String.preferredLanguage);var u=CW.getUrlParameters(),a=u.locale;return a&&n.contains(a)&&(o=a),o||(r?SC.debug("Neither Primary Locale “%@” or Secondary Locale “%@” is supported by app “%@”. Hence using “en-us” as the locale for this app.",i,s,e):SC.debug("Since there is no account prefs yet, we will set the locale of “%@” as en-us",e),o="en-us"),o},locationHash:function(){var e="",t=this.get("route");return CloudOS.get("isCloudOSMini")||(e=this.get("name")),e+=CloudOS.workspaceController.retainedHash(),t&&(e&&(e+="/"),e+="%@".fmt(t)),e}.property("route"),route:null,routeDidChange:function(){var e=this.get("route");this.passMessage("_cloudOSStateChange",{route:e}),this.passMessage("routeDidChange",e)}.observes("route"),contentWindow:function(){var e=this.get("view");return e?e.get("contentWindow"):null}.property("view"),isFailed:NO,isActive:NO,isWaiting:NO,isLoaded:NO,isIntermediateFailedToLoad:NO,startupDataHasBeenLoaded:NO,loadInBackground:NO,isReadyToTerminate:YES,title:null,view:null,loadReason:null,shareInfo:null,preDisplayAction:null,preDisplayActionArgs:null,postDisplayAction:null,postLoadAction:null,getReady:function(){if(this._view)return;var e=this.get("name"),t=YES,n=this.get("appInfo");n.preloadCoreTypes&&SC.Module.loadModule("cloudkit/core_types"),SC.debug("Beginning to load %@",e),COS.startupController.requestStartup(e);var r=CloudOS.AppFrameView.create({minWidth:this.get("minWidth"),minHeight:this.get("minHeight"),app:this});this.set("view",this._view=r),r.get("usingPrevCreatedIframe")||CloudOS.getPath("mainPage.mainPane.appsView").addAppFrame (r),this.set("isReadyToTerminate",YES),this.set("isWaiting",YES),CloudOS.get("isCloudOSMini")&&(t=NO),t&&(this._checkLoadFailureTimer=this.invokeLater("_checkLoadFailure",CloudOS.APP_LOAD_TIMEOUT*1e3),this._checkIntermediateLoadFailureTimer=this.invokeLater("_checkIntermediateLoadFailure",CloudOS.APP_LOAD_INTERMEDIATE_TIMEOUT*1e3)),this._iframeWasCreated=YES;var i=n.containerIdentifier;i&&COS.pushController.registerForCloudKitSubscriptions(i,e)},getReadyInBackground:function(){CloudOS.appController.get("loadingApp")!==this?(this.set("loadInBackground",YES),this.getReady()):SC.info("%@ is already being loaded, hence no need to load it in the background.",this.get("name"))},isLoadedObserver:function(){var e=this.get("isLoaded"),t=CloudOS.appController.get("loadedApps");t||(t=[]),e?t.push(this):t.indexOf(this)!==-1&&t.removeObject(this),CloudOS.appController.set("loadedApps",t)}.observes("isLoaded"),shouldRelocalize:function(e,t){var n=this.preferredLocale(),r=this._currentAppLocale,i=n!==r||t,s=this.get("name");return this.get("view")&&SC.debug("Language check for app '%@': "+r+" -> "+this.preferredLocale()+". We "+(i?"WILL":"WILL NOT")+" relocalize '%@.'",s,s),i},relocalize:function(e,t){this.get("appInfo").calculateAndSetLocalizedNames(String.preferredLanguage,CloudOS.authController.getPath("user.countryCode"));if(!this.shouldRelocalize(e,t))return;this.reloadInPlaceIfAppropriateWhenCanTerminate()},reloadInPlaceIfAppropriate:function(){var e=this.get("isActive"),t=this.get("view"),n=e&&t!==null,r=CloudOS.appController.get("pendingApp"),i=this._view,s=this.get("name");if(n){var o= CloudOS.authController;if(r&&!this.get("canLaunchWithOneFactor")&&COS.authController.getPath("user.hsaEnabled")&&!o.get("delayedTearDownUsed")){o.set("delayedTearDownApp",this),o.set("delayedTearDownUsed",!0);return}i.get("usingPrevCreatedIframe")&&(i.get("layer").oldIframe=YES),this.set("view",this._view=null),this.teardown(YES),this._isReloadingInPlaceFromOldView=t,this.set("loadReason",CK.LOAD_REASON_RELOAD),CloudOS.blockUserInput(10),this.invokeLater(function(){this.set("loadInBackground",NO),this.getReady()},1e3)}else this.teardown()},teardown:function(e){if(!this._iframeWasCreated)return;var t=this.get("appInfo"),n=this.get("name");SC.debug("Ensuring that %@ is torn down.",n),t&&CloudOS.appController.applicationWillClose(t);var r=this.get("view");r&&r.destroy(),this.set("view",this._view=null),this._checkLoadFailureTimer&&this._checkLoadFailureTimer.invalidate(),this.invalidateIntermediateLoadFailureTimer(),this.get("isFailed")&&this.set("hasFailedOnce",YES),this.set("isFailed",NO),this.set("isWaiting",NO),e||this.set("isActive",NO),this.set("loadReason",null),this.set("isLoaded",NO),this._messageState=this._DID_SUSPEND,this._iframeWasCreated=NO,this._currentAppLocale=null,t&&(t.set("requestedStartupUrl",null),t.set("requestedStartupInfo",null),t.set("startupResponse",null),t.set("isReady",NO)),this.set("isReady",NO),COS.statsController.endAllBenchmarkStats(n)},teardownWhenCanTerminate:function(e){this._invokeWhenCanTerminate("teardown",e)},reloadInPlaceIfAppropriateWhenCanTerminate:function(e){this._invokeWhenCanTerminate("reloadInPlaceIfAppropriate",e)},_invokeWhenCanTerminate :function(e,t){if(this.get("isReadyToTerminate"))return this[e]();CloudOS.blockUserInput(20);var n=this,r=NO,i=function(){if(r)return;r=YES,CloudOS.invokeLater("unblockUserInput",20),n[e]()};(this._canTerminateTasks||(this._canTerminateTasks=[])).push(i),this.invokeLater(i,t||1e4)},_flushCanTerminateQueue:function(){if(!this._canTerminateTasks||!this.get("isReadyToTerminate"))return;for(var e=0,t;t=this._canTerminateTasks[e];e++)t();this._canTerminateTasks.length=0}.observes("isReadyToTerminate"),_checkLoadFailure:function(){this.get("isReady")||(this.isIntermediateFailedToLoad=NO,this._didFailToBecomeReady())},_checkIntermediateLoadFailure:function(){var e=CloudOS.appController.get("pendingApp"),t=e===this;!this.get("isReady")&&t&&this._showIntermediateLoadFailureBanner()},_showIntermediateLoadFailureBanner:function(){var e=this,t=COS.statsController,n={pendingApp:this.get("name")};CloudOS.bannerManager.setAppBanner({title:"Banner.SlowConnection.Title".loc(),description:"Banner.SlowConnection.Description".loc({appName:this.get("displayName")}),optionalLink:{text:"Banner.SlowConnection.OptionalLink.Text".loc(),action:function(){t.recordLocationStat("cloudos","CancelSlowConnectionBanner",n),e.invalidateIntermediateLoadFailureTimer(YES),e._didFailToBecomeReady()}},priority:CloudOS.HIGH_PRIORITY_BANNER}),this._showingSlowConnectionMsg=YES,this.set("isIntermediateFailedToLoad",YES),t.recordLocationStat("cloudos","ShowSlowConnectionBanner",n),t.beginStat("cloudos","ShowSlowConnectionBannerDuration",n)},_removeIntermediateLoadFailureBanner:function(e){this._showingSlowConnectionMsg&& (CloudOS.bannerManager.setAppBanner(null),this._showingSlowConnectionMsg=NO,COS.statsController.endStat("cloudos","ShowSlowConnectionBannerDuration",{wasCancelled:!!e}))},invalidateIntermediateLoadFailureTimer:function(e){this._checkIntermediateLoadFailureTimer&&(this._checkIntermediateLoadFailureTimer.invalidate(),this._removeIntermediateLoadFailureBanner(e))},_didFailToBecomeReady:function(){this.set("isWaiting",NO),this.get("isActive")&&this.set("isActive",NO),this.invalidateIntermediateLoadFailureTimer(),this._isReloadingInPlaceFromOldView&&CloudOS.unblockUserInput(),this._isReloadingInPlaceFromOldView=null,CloudOS.appController.get("pendingApp")===this&&CloudOS.statechart.sendAction("applicationDidFailToBecomeReady"),CloudOS.getPath("mainPage.mainPane.appsView").removeAppFrame(this._view)},didBecomeReady:function(){this.invalidateIntermediateLoadFailureTimer();var e=SC.Benchmark,t=this.get("name");e.end("Waiting for application to become visible",t);if(!this.get("isLoaded")){SC.debug("Received didBecomeReady for "+this.get("name")+", which is no longer loaded. Ignoring call.");return}if(this.get("isFailed"))return;COS.startupController.notifyStartup(this.get("appInfo"),YES),window[t.substr(0,2)]=this.get("contentWindow");var n=function(){var e=CloudOS.appController,n=this._isReloadingInPlaceFromOldView;this._isReloadingInPlaceFromOldView=null,n&&CloudOS.unblockUserInput();if(!this.get("isLoaded")){this.get("isActive")&&!n&&this.set("isActive",NO),SC.debug("Finishing didBecomeReady for "+this.get("name")+", which was unloaded since didBecomeReady was called. Aborting."); return}this.set("isReady",YES),this.set("isWaiting",NO),e.get("pendingApp")===this&&!this.get("loadInBackground")&&CloudOS.statechart.sendAction("applicationDidBecomeReady");var r=this.get("postLoadAction");if(r){var i=[],s=this.get("shareInfo");s&&i.push(s),r.apply(this,i)}this.set("postLoadAction",null),e.set("loadingApp",null),n&&(n._shouldBeDestroyedAfterNextSwitch=YES,this.show(YES));if(CloudOS.get("isCloudOSMini")&&!CloudOS._applicationWithOpener)try{var o=CloudOS.getOpenerWithCloudOS();o&&o.CloudOS.windowApplicationIsKnown(window)&&(SC.info("main(): Found parent CloudOS application"),o.CloudOS.windowApplicationHasInitialized(window,t,YES),CloudOS._applicationWithOpener=this)}catch(u){SC.warn("didBecomeReady: There was a problem finding or communicating with the opener"),SC.warn(u)}};CloudOS.APP_POST_READY_DELAY?this.invokeLater(n,CloudOS.APP_POST_READY_DELAY):n.call(this)},startupDataDidLoad:function(){this.set("startupDataHasBeenLoaded",YES),this.get("isWaiting")||SC.Benchmark.end("Waiting for startup data",this.get("name"))},show:function(e,t){if(!this.get("isReady"))return;this.notifyPropertyChange("title");var n=CloudOS.getPath("mainPage.mainPane.appsView");n.showApp(this,e,t)},hide:function(e){if(!this.get("isReady"))return;var t=CloudOS.getPath("mainPage.mainPane.appsView");t.hideApp(this,e)},init:function(){this.get("displayName")||this.get("appInfo").set("displayName",this.getPath("appInfo.capitalizedName")),arguments.callee.base.apply(this,arguments),CW.notificationCenter.subscribeToNotification("relocalize",this,"relocalize")},benchmarks:function(){var e=SC. Benchmark._statFor(this.get("name"));return e&&e._times&&e._times[0]?e._times[0]._subStats:null},focus:function(){var e=this.get("view");if(!e)return;e.focus()},_validatePostMessageData:function(e){if(!e||typeof e!="object")return!0;if(e.isObservable&&SC.kindOf(e,SC.Object))return SC.error("_validatePostMessageData: Attempt to serialize SC.Object in:"+e.toString()),!1;for(var t in e)if(e.hasOwnProperty(t)&&!this._validatePostMessageData(e[t]))return!1;return!0},passMessage:function(e){var t=this.get("contentWindow");if(!t)return;var n=SC.$A(arguments);n.shift();var r=this.getPath("view.layer.src"),i=URI(r),s="https://"+i.hostname();this._callCloudOSMethod(t,s,e,n)},_callCloudOSMethod:function(e,t,n,r){var i={isCloudOSMessage:!0,methodName:n,args:r};this._validatePostMessageData(i)||SC.error("Attempt to serialize invalid data in: "+JSON.stringify(i));var s=this.get("name"),o=s+n;this._lastMessageSignature!==o&&(SC.info('_callCloudOSMethod: "%@" to %@',n,s),this._lastMessageSignature=o);var i=JSON.stringify(i,function(e,t){return this.hasOwnProperty(e)?t:undefined});e.postMessage(i,t)},sleep:function(){this.passMessage("_sleep")},wake:function(){this.passMessage("_wake")},ensureWillSuspend:function(){this.ensureDidBecomeActive();if(this._messageState!==this._DID_BECOME_ACTIVE)return;this._messageState=this._WILL_SUSPEND,this.passMessage("applicationWillSuspend"),CloudOS.appController.applicationWillClose(this)},ensureDidSuspend:function(){if(this._messageState!==this._WILL_SUSPEND)return;this._messageState=this._DID_SUSPEND,this.passMessage("applicationDidSuspend")},ensureWillBecomeActive :function(){this.ensureDidSuspend();if(this._messageState!==this._DID_SUSPEND)return;this._messageState=this._WILL_BECOME_ACTIVE,this.get("isReady")&&this.passMessage("applicationShouldRefresh",NO),this.passMessage("applicationWillBecomeActive"),this.sleep()},ensureDidBecomeActive:function(){if(this._messageState!==this._WILL_BECOME_ACTIVE)return;this._messageState=this._DID_BECOME_ACTIVE,this.wake(),this.passMessage("applicationDidBecomeActive",this.benchmarks());var e=this.get("postDisplayAction");this.set("postDisplayAction",undefined),e&&e.apply(this),CloudOS.appController.applicationDidOpen(this)},_DID_SUSPEND:1,_WILL_SUSPEND:2,_DID_BECOME_ACTIVE:3,_WILL_BECOME_ACTIVE:4,_messageState:1}),CloudOS.appController=SC.Object.create({apps:null,appList:null,loadedApps:null,pendingInfoJSONRequests:{},_newReplacementApps:[],_replacedAppsMapping:{},appIndices:function(){var e=CloudOS.authController.get("appsOrder")||[];if(this._lastAppsOrder===(this._lastAppsOrder=e.join(" ")))return this._cachedAppIndices;for(var t=0,n={},r=e.length;t0&&(t=n)),t}.property("loadedApps"),areAllAppReplacementsCompleted:function(){return this.get("_newReplacementApps").length===0}.property("_newReplacementApps"),showApps:function(){var e=CW.getUrlParameters (),t=e.showApps;return t?t.split(","):null}.property().cacheable(),removeInvalidIframes:function(){var e=SC.$("iframe");e.forEach(function(e){if(e.id=="auth-frame")return;COS.apps[e.name]||(e.parentNode?(SC.info("Removing iframe for invalid app %@",e.name),e.parentNode.removeChild(e)):SC.warn("Unable to remove invalid iframe for app %@",e.name))})},initializeAppManagers:function(){var e={},t=CloudOS.appController.getDefaultAppName(),n=CloudOS.getAppRouteFromHash(),r=[],i=this.get("showApps"),s,o,u,a,f,l,c,h;for(f=0,l=CloudOS.displayApps.length;f1?"icon_notification@2x.png":"icon_notification.png"));var m="AppTitle."+t,g=m.loc();if(g===m){var y={};y["AppTitle."+t]=o.displayName,y["AppTitleBar."+t]=o.titleName||o.displayName,SC.stringsFor(SC.Locale.currentLocale.language,y)}else v.set ("displayName",g);var b=o.pushTopic;COS.pushController&&b&&(SC.info("Registering pushTopic %@ for dynamic app %@",b,t),COS.pushController.registerPushTopic(b)),this.addAppManager(v),CW.notificationCenter.postNotification("receivedInfoForDynamicApp",t),this.checkIfAllDynamicAppsAreLoaded()},checkIfAllDynamicAppsAreLoaded:function(){this.get("isAllAppInfoLoaded")&&(this.set("pendingInfoJSONRequests",{}),CW.notificationCenter.postNotification("receivedInfoForAllDynamicApps"))},addAppManager:function(e){var t=this.get("apps"),n=this.get("appList");n.pushObject(e),e.set("index",n.length),t[e.get("name")]=e,this.notifyPropertyChange("appList")},iCloudLiteObserver:function(){var e=CloudOS.authController;(e.get("iCloudLiteSignUp")||e.getPath("user.isLiteAccount"))&&this.notifyPropertyChange("appList")}.observes("CloudOS.authController.iCloudLiteSignUp","CloudOS.authController.user"),removeApp:function(e,t){if(CloudOS.get("isCloudOSMini"))return;COS.appsController.removeAppInfoFor(e);var n=CloudOS.appManagerFor(e);if(!n)return;delete this.get("apps")[e];var r=COS.apps[e].alternateAppName;t||delete COS.apps[e],this.get("appList").removeObject(n),this.notifyPropertyChange("apps"),this.notifyPropertyChange("appList")},removeOmittedApps:function(e){var t=this.get("apps"),n;for(n in t){var r=t[n];if(!r)continue;!e[n]&&r.get("canBeRemoved")&&this.removeApp(n)}for(n in COS.apps)!t[n]&&!this.pendingInfoJSONRequests[n]&&delete COS.apps[n]},replaceOrAddApp:function(e,t,n){var r=COS.authController,i=r.get("appsOrder"),s=i.indexOf(t),o=this.get("showApps");e[n]={},!o||o.indexOf(t)===-1?delete e[ t]:i.push(t),i[s]=n,this.invokeLast(function(){this.notifyPropertyChange("appIndices")}),this.appReplacementDidComplete(n)},reloadApplication:function(e){var t=CloudOS.appController,n=CloudOS.appManagerFor(e),r=this,i=CloudOS.authController.get("user"),s=t.get("currentApp");if(!n){SC.warn("reloadApplication(): Application “%@” does not exist",e);return}s&&s.get("name")===e?CloudOS.statechart.sendAction("appMustReload",function(){n.teardown(),r.invokeLater(function(){t.set("pendingApp",n),n.set("loadReason",CK.LOAD_REASON_RELOAD),CloudOS.statechart.sendAction("userDidChooseApp")},500)}):n.teardown()},exitApplication:function(e,t,n,r){var i=CloudOS.appController,s=CloudOS.appManagerFor(e),o=NO;if(!s){SC.warn("application %@ does not exist".fmt(e));return}if(!s.get("isLoaded")){SC.warn("application %@ is already unloaded.".fmt(e));return}s.set("isFailed",YES),t===CK.EXIT_FATAL_ERROR&&(o=YES);var u=i.get("currentApp"),a=i.get("pendingApp");u&&u.get("name")===e||a&&a.get("name")===e?CloudOS.statechart.sendAction("appMustExit",{statusCode:t,applicationLog:n,appToLoadAfterAuthentication:r}):(s.teardown(),o&&this.showErrorReporter(s,n))},exitApplicationSilently:function(e){CloudOS.statechart.sendAction("appMustExitSilently");var t=CloudOS.appManagerFor(e);t&&t.teardown(),this.get("loadingApp")===t&&this.set("loadingApp",null)},switchToApplicationWithNotification:function(e,t,n){var r=CloudOS.appManagerFor(e);this.get("currentApp")===r&&r.get("isReady")?(SC.debug("Handing notification off to active app %@ immediately",e),r.passMessage("didReceiveNotification",t),n&&n.dismiss()):(r.set ("loadInBackground",NO),CloudOS.appController.set("pendingApp",r),n&&n.set("automaticallyDismiss",NO),r.set("postDisplayAction",function(){n&&n.dismiss(),r.passMessage("didLaunchWithNotification",t)}),CloudOS.statechart.sendAction("appCalledSwitchToApplication"))},reset:function(){var e=this.get("apps"),t,n;for(n in e)t=e[n],t.teardown()},currentApp:null,pendingApp:null,activateCurrentApp:function(e){var t=this.get("currentApp");if(!t){SC.debug("No app is ready to be activated yet, waiting for it to call back when ready");return}t.set("isActive",YES),t.show(e)},deactivateCurrentApp:function(){var e=this.get("currentApp");if(!e){SC.debug("No app is ready to be deactivated yet.");return}CK.currentApplication=null,e.set("isActive",NO),this.set("currentApp",null)},applicationDidOpen:function(e){COS.statsController.beginStat("cloudos","AppVisibleTime",{appName:e.get("name")})},applicationWillClose:function(e){var t=e?e.get("name"):this.getPath("currentApp.name");if(!t)return;e&&e.get("isReady")&&COS.statsController.endStat("cloudos","AppVisibleTime",null,{durationKeyName:"visibilityDuration"})},userDidRevalidate:function(){var e=this.get("apps"),t,n;for(t in e)n=e[t],n.passMessage("_cloudOSStateChange",{authBag:COS.authController._auth_bag}),n.passMessage("userDidRevalidate");SC.Request.manager.resumeAllServices()},getDefaultApp:function(){var e=this.getDefaultAppName();if(!e)return null;var t=CloudOS.appManagerFor(e);if(t&&!t.get("isDisabled"))return t},getDefaultAppName:function(){return CloudOS.getAppFromURL()},showErrorReporter:function(e,t,n,r){var i=e.get("name");n=n===NO?NO :YES,r||(r="server");var s=e.get("recordedExceptions");s&&r==="loadFailure"&&(r="loadFailureLikelyException"),CK.errorCatcher.report({isFatal:n,applicationName:i,type:r,statSessionId:COS.statSessionId,title:"Error.AppLoading.Title".loc("AppTitle.%@".fmt(i).loc()),message:"Error.AppLoading.Description".loc(),applicationLog:t,recordedExceptions:s?s.join("\n"):null})},showNotes2AppIfNeeded:function(e){var t=CloudOS.authController.get("appsOrder").indexOf("notes2")!==-1;if(t){this.appReplacementDidComplete("notes2");return}var n=CK.servicesController.getServiceInfoFor("ckdatabasews");if(!n){SC.info("CloudKit web service does not exist for this account"),this.removeNotes2App();return}SC.info("Account has CloudKit web service, checking the state");var r=COS.Request.getUrl(n.get("url")+"/database/1/com.apple.notes/production/private/users/current");r.set("reportRequest",YES),r.notify(200,this,function(t){var r=t.get("body");if(r&&r.userRecordName){var i=COS.Request.postUrl(n.get("url")+"/database/1/com.apple.notes/production/private/records/lookup",{records:[{recordName:r.userRecordName}]});i.notify(200,this,function(t){var n=t.get("body"),r=NO,i;return n&&n.records&&n.records[0]&&n.records[0].fields&&n.records[0].fields.DidChooseToMigrate&&n.records[0].fields.DidChooseToMigrate.value===1?(this.replaceOrAddApp(e,"notes","notes2"),SC.info("Account is notes migrated in CK, but not in iCloud Account. Setting account flag…"),i=COS.Request.postUrl("https://setup.icloud.com/setup/ws/1/updateAccount",null),i.set("reportRequest",YES),i.notify(200,this,function(e){return SC.info("Successfully marked account notesMigrated" ),COS.statsController.recordStat("cloudos","NotesMigratedStateSuccess"),YES}),i.notify(0,this,function(e){return SC.info("Error marking account notesMigrated"),COS.statsController.recordStat("cloudos","NotesMigratedStateFailure"),YES}),i.send({notesMigrated:!0})):(SC.debug("Account is not notes migrated in CK."),this.removeNotes2App()),YES}),i.notify(0,this,function(e){return SC.debug("There was a problem fetching the user record."),this.removeNotes2App(),YES}),i.send()}return YES}),r.notify(400,this,function(e){return SC.debug("Account does not have this CloudKit container."),this.removeNotes2App(),YES}),r.notify(0,this,function(e){return SC.debug("There was a problem fetching the user id."),this.removeNotes2App(),YES}),r.send()},removeNotes2App:function(){this.removeApp("notes2"),this.removeInvalidIframes(),this.appReplacementDidComplete("notes2")},setNewReplacementApps:function(e){this._newReplacementApps=e},appReplacementDidComplete:function(e){var t=this._newReplacementApps;t&&t.length>0&&t.contains(e)&&(t.removeObject(e),t.length===0&&(CW.notificationCenter.postNotification("appReplacementsCompleted"),this._newReplacementApps=[]))},addAppsReplaced:function(e,t){this._replacedAppsMapping[e]=t},replaceApps:function(e){var t=this._replacedAppsMapping,n;for(n in t)e[n]&&this.replaceOrAddApp(e,n,t[n])}}),CloudOS.AppleWidgetCommonMethods={_floworigin:null,_pane:null,_url:null,_contentViewClass:null,_messagesReceived:[],_rpcMethodHandlers:{},init:function(){arguments.callee.base.apply(this,arguments),this.addCommonRPCMethods(this._rpcMethodHandlers)},addCommonRPCMethods:function( e){var t=this.get("_rpcCommonMethodHandlers");if(t)for(var n in t)e[n]||(e[n]=t[n])},handleMessage:function(e){var t=e&&e.method,n=t&&this._rpcMethodHandlers[t],r=e&&e.params,i=this.toString();this._messageReceived(t);if(n){var s,o=SC.clone(r,!0);try{s=JSON.stringify(o,this._replacer.bind(this))}catch(u){s="(cannot stringify)"}SC.debug(i+" RPC: Received invocation for method `"+e.method+"`. (id: "+e.id+" params:"+s+")");var a=r&&SC.clone(r),f=this,l=function(t,n){f._frameMethodCallback(e,t,n)};a?(a.unshift(l),n.apply(this,a)):n.call(this,l)}else SC.warn(i+" RPC: Received invocation for non-existant method `"+e.method+"`. (id: "+e.id+")");typeof e=="object"&&(typeof e.result!="undefined"||typeof e.error!="undefined")&&SC.debug(i+" RPC: Received response. (id: "+e.id+")")},_paneContentView:function(){var e=this.__contentView,t=this.get("_contentViewClass");if(!t)return;if(!e||!e.kindOf(t))e=this.__contentView=t.create();return e}.property("_contentViewClass"),resetContentView:function(){this.__contentView=null},_removePane:function(){this._failureTimer&&this._failureTimer.invalidate()},_generateURL:function(e){var t=window.URI(e);return t.addQuery("locale",CK.getCurrentLocaleInISOFormat()),t.addQuery("font","sf"),t.toString()},_frameMethodCallback:function(e,t,n){var r={jsonrpc:"2.0",id:e.id};typeof t!="undefined"?r.result=t:typeof n!="undefined"?r.error=n:r.error="No response.",this._sendAppleIdWidgetMessage(r)},_keysNotToLog:["src","accountName","session","trustTokens"],_replacer:function(e,t){var n=SC.typeOf(t);if(n===SC.T_HASH){for(e in t)SC.typeOf(t[e])===SC.T_HASH?t[e]=this ._replacer(e,t[e]):this._keysNotToLog.contains(e)&&(t[e]="(omitted)");return t}return this._keysNotToLog.contains(e)?"(omitted)":t},_sendAppleIdWidgetMessage:function(e){var t=this.get("_paneContentView"),n=t.getFrame(),r=n&&n.contentWindow,i=this.toString();if(r){if(typeof e.result!="undefined"){var s=SC.clone(e.result,!0)||"";if(s){try{s=JSON.stringify(s,this._replacer.bind(this))}catch(o){s="(cannot stringify)"}s=" & params = %@ ".fmt(s)}SC.debug(i+" RPC: Responding with result. (id: "+e.id+s+")")}else typeof e.error!="undefined"?SC.debug(i+" RPC: Responding with error. (id: "+e.id+")"):SC.debug(i+" RPC: Calling `"+e.method+"`. (id: "+e.id+")");r.postMessage(this.get("prefix")+JSON.stringify(e),this._flowOrigin)}else SC.warn(i+" RPC: A message was not sent because the Apple widget frame could not be found. (id: "+e.id+")")},_rpcCommonMethodHandlers:{receivePingRequest:function(e,t){e(!!this._rpcMethodHandlers[t])},log:function(e){for(var t=0;t-1&&this[n].width>r.width&&(this[n].width=r.width),e.indexOf("height")>-1&& this[n].height>r.height&&(this[n].height=r.height),e.indexOf("minWidth")>-1&&this[n].minWidth>r.width&&(this[n].minWidth=r.width),e.indexOf("minHeight")>-1&&this[n].minHeight>r.height&&(this[n].minHeight=r.height)}}},CloudOS.AppleAuthWidgetFrameView=SC.View.extend(CW.Animatability,{classNames:["apple-auth-frame"],_url:null,_iframeView:null,_currentLayout:null,isFirstRunLoadedBinding:"CloudOS.authController.isFirstRunLoaded",isAuthWidgetLoadedBinding:"CloudOS.authController.isAuthWidgetLoaded",isRepairStartedBinding:"CloudOS.appleAuthWidgetController.isRepairStarted",isVisible:function(){var e=this.get("isAuthWidgetLoaded"),t=this.get("isFirstRunLoaded");return e&&!t}.property("isFirstRunLoaded","isAuthWidgetLoaded"),DEFAULT_WIDTH:640,DEFAULT_HEIGHT:480,shouldRepairFlowBeFullScreen:NO,isLoaded:!1,layout:function(e,t){var n={};if(t!==undefined)n=t;else{var r=CloudOSBootstrap.isOnSupportedMobile,i=this.get("shouldRepairFlowBeFullScreen"),s=this.get("isRepairStarted"),o=this.get("isLoaded");r&&i&&s?n={top:0,left:0,right:0,bottom:0}:n={centerY:-70,centerX:0,width:Math.min(this.DEFAULT_WIDTH,Math.max(COS.MIN_WIDTH,window.innerWidth)),height:Math.min(this.DEFAULT_HEIGHT,Math.max(COS.MIN_HEIGHT,window.innerHeight))},o||(n.opacity=0),n.zIndex=5}return n}.property("shouldRepairFlowBeFullScreen","isRepairStarted","isLoaded").cacheable(),init:function(){arguments.callee.base.apply(this,arguments),CloudOSBootstrap.isOnSupportedMobile&&this.DEFAULT_WIDTH>Math.min(window.innerWidth,window.innerHeight)&&this.set("shouldRepairFlowBeFullScreen",YES)},show:function(e){this._url=e;var t;t=this. _iframeView=this.createChildView(CloudOS.iFrameView,{src:this._url,title:"Apple Id Sign-In",toString:function(){return"CloudOS.AppleAuthWidgetFrameView"}}),this.appendChild(t),this.invokeLast(function(){var e=t.$();e.attr("id","auth-frame"),e.attr("width","100%"),e.attr("height","100%"),e.attr("frameborder","0"),e.attr("scrolling","no"),e.attr("tabindex","-1")})},resetUrl:function(e){var t=this._iframeView;t&&t.set("src",e)},hide:function(){var e=this._iframeView;e&&e.destroy()},getFrame:function(){return this.getPath("_iframeView.layer")},shakeAuthFrame:function(){this._shaker&&this._shaker.finish();var e=15;this._shaker=this.animate("centerX",{to:this.get("layout").centerX+e,importants:[1,2,3,4,5,6].map(function(t){return t*e/7}),tween:CW.Anim.tweens.make("linearInterpolation",[0,1,-1,1,-1,.7,-0.7,0]),duration:400})}}),CloudOS.APPLE_AUTH_WIDGET_READY_TIMEOUT=45e3,CloudOS.APPLE_AUTH_WIDGET_POST_MESSAGE_PREFIX="pmrpc.",CloudOS.AppleAuthWidgetController=SC.Object.extend(CloudOS.AppleWidgetCommonMethods,{_contentViewClass:CloudOS.AppleAuthWidgetFrameView,prefix:CloudOS.APPLE_AUTH_WIDGET_POST_MESSAGE_PREFIX,_isRepairStarted:NO,isShowing:YES,hideRememberMeBinding:"CloudOS.authController.hideRememberMe",isFederatedFlowUIStarted:NO,configUI:function(){return{logo:{src:"data:image/png;base64,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" ,width:"100px",height:"100px"},signInLabel:"Auth.Title.SignInToICloud".loc()}}.property(),_maxNumberOfRetries:1,_numberOfRetries:0,isRepairStarted:function(e,t){return t!==undefined&&(this._isRepairStarted=t),this._isRepairStarted}.property("_isRepairStarted"),show:function(e,t){this.set("_pane",e),this.set("_url",t),this.set("isShowing",YES),this._loadURLInFrameWithTimeout(t)},destroy:function(){this._pane.remove(),this.set("_pane",null),this.set("_url",null),this.set("isShowing",NO),this._failureTimer&&this._failureTimer.invalidate(),arguments.callee.base.apply(this,arguments)},_authLoginCompleted:function(e,t,n,r){var i=CloudOS.statechart;if(!e)i.sendAction("loginFailed"),this.get("_paneContentView").shakeAuthFrame();else if(!t)this.get("isRepairStarted")?(SC.debug("Repair Failed"),i.sendAction("repairFailed")):(SC.debug("No dsWebAuthToken found"),i.sendAction("authDidNotConnect","loginDidFail - No dsWebAuthToken"));else if(e){var s={dsWebAuthToken:t};n&&(s.trustToken=n),r&&(s.accountCountryCode=r),i.sendAction("loginCompleted",s)}this._removePane()},_loadURLInFrameWithTimeout:function(e){var t=CloudOS.APPLE_AUTH_WIDGET_READY_TIMEOUT,n;try{n=URI.parse(e)}catch(r){throw r.message="Failed to parse the Apple Auth widget URL:\n"+r.message,r}this._flowOrigin=n.protocol+"://"+n.hostname,this._frameHasCalledReady=NO;var i=this.get("_pane"),s=this.get("_paneContentView"),o=i.get("childViews"),u=COS.statsController;i.set("authWidgetFrame",s),this.clearMessagesReceived(),this.get("_numberOfRetries")===0&&u.beginStat("cloudos","AuthWidget_TotalLoadTime"),u.beginStat("cloudos","AuthWidget_Loading_Successful" ),u.beginStat("cloudos","AuthWidget_Loading_Failed"),i.insertBefore(s,o&&o.objectAt(0)),this.invokeLast(function(){s.show(this._generateURL(e))}),SC.debug("Starting timer to track time taken by auth widget to load. Attempt Number %@",this.get("_numberOfRetries")+1),this._failureTimer=this.invokeLater(this._didFailToLoad,t)},_recordAuthLoadStats:function(){var e=SC.getCurrentTimeForPerformance()-SC.benchmarkPreloadEvents.headStart,t={renderDuration:e},n=window.screen,r,i=COS.statsController;i.cancelStat("cloudos","AuthWidget_Loading_Failed"),i.endStat("cloudos","AuthWidget_Loading_Successful",{retryAttemptNumber:this.get("_numberOfRetries")},{durationKeyName:"widgetLoadDuration",includeLocationAndLocale:YES}),i.endStat("cloudos","AuthWidget_TotalLoadTime",{retryAttempts:this.get("_numberOfRetries"),loadSuccessful:YES},{durationKeyName:"widgetLoadDuration",includeLocationAndLocale:YES});for(r in n)t["screen_"+r]=n[r];t.innerHeight=window.innerHeight,t.innerWidth=window.innerWidth,t.outerHeight=window.outerHeight,t.outerWidth=window.outerWidth,i.recordLocationStat("cloudos","DisplayLogin",t)},_didLoad:function(){var e=CW.getUrlParameters().retryWidgetLoginAttempts,t=this.get("_numberOfRetries"),n=this.get("_maxNumberOfRetries");if(e&&t '%@'",n),n==="INTERSTITIAL"&&this.set("isFederatedFlowUIStarted",YES),n==="SIGNIN"&&this.set("isFederatedFlowUIStarted",NO)}e(YES)},authWidgetDidChangeFlow:function(e,t){if(t&&t.to){var n=t.to;SC.debug("Auth UI flow has changed to -> '%@'",n)}e(YES)}}}),CloudOS.AppleIDWidgetFrameView=SC.View.extend({classNames:["apple-id-frame","iframe-pane"],adjustablePane:null,show:function(e){this._url=e},getFrame:function(){return this.getPath("_iframeView.layer")},paneDidShow:function(){var e=this.get("childViews"),t;if(e.length>0)return;t=this._iframeView=this.createChildView(CloudOS .iFrameView,{src:this._url,toString:function(){return"CloudOS.AppleIDWidgetFrameView"}}),this.insertBefore(t,e&&e.objectAt(0))},paneDidHide:function(){var e=this._iframeView;e&&e.destroy()},_url:null,_iframeView:null}),CloudOS.APPLE_ID_WIDGET_READY_TIMEOUT=3e4,CloudOS.APPLE_ID_WIDGET_POST_MESSAGE_PREFIX="AppleID.",CloudOS.APPLE_ID_WIDGET_EXIT_REASON_NO_REPAIR_NEEDED=1,CloudOS.APPLE_ID_WIDGET_EXIT_REASON_TIMEOUT=2,CloudOS.APPLE_ID_WIDGET_BUTTON_INDEX_TO_PROPERTY_MAP=["rightButton","middleButton","leftButton"],CloudOS.AppleCreateWidgetController=SC.Object.extend(CloudOS.AppleWidgetCommonMethods,{_contentViewClass:CloudOS.AppleIDWidgetFrameView,prefix:CloudOS.APPLE_ID_WIDGET_POST_MESSAGE_PREFIX,minWidth:400,minHeight:200,configPayload:null,show:function(e,t,n){this.set("_pane",e),this.set("_url",t),n&&this._storeConfigPayload(n),this._loadURLInFrameWithTimeout(t)},_generateURL:function(e,t){t=e(t);var n=window.URI(t);return n.addQuery("v","2"),n.toString()}.enhance(),_loadURLInFrameWithTimeout:function(e){var t=CloudOS.APPLE_ID_WIDGET_READY_TIMEOUT,n=COS.statsController,r,i,s;try{r=URI.parse(e)}catch(o){throw o.message="Failed to parse the Apple ID widget URL:\n"+o.message,o}this._flowOrigin=r.protocol+"://"+r.hostname,this._frameHasCalledReady=NO,i=this.get("_pane"),i.set("isLoading",YES),i.set("maxWidth",i.constructor.prototype.maxWidth),i.set("maxHeight",i.constructor.prototype.maxHeight),s=this.get("_paneContentView"),s.set("adjustablePane",i),i.set("paneContentView",s),i.set("delegate",s),n.beginStat("cloudos","AppleID_CreateWidget_Loading_Successful"),n.beginStat("cloudos" ,"AppleID_CreateWidget_Loading_Failed"),i.show(this._generateURL(e)),SC.debug("Starting timer to track time taken by create widget to load."),this._failureTimer=this.invokeLater(this._didFailToLoad,t)},_didLoad:function(){var e=COS.statsController;this._frameHasCalledReady=YES,this.setPath("_pane.isLoading",NO),e.cancelStat("cloudos","AppleID_CreateWidget_Loading_Failed"),e.endStat("cloudos","AppleID_CreateWidget_Loading_Successful")},_didFailToLoad:function(){if(this._frameHasCalledReady)return;var e=COS.statsController;SC.debug("Create Widget failed to load"),CloudOS.statechart.sendAction("appleIDPaneFailedToLoad"),e.cancelStat("cloudos","AppleID_CreateWidget_Loading_Successful"),e.endStat("cloudos","AppleID_CreateWidget_Loading_Failed")},_storeConfigPayload:function(e){var t={language:CK.getCurrentLocaleInISOFormat(),customAlerts:!0};SC.mixin(t,e),this.set("configPayload",t)},_alertsByGUID:{},_createAlertForAppleIdWidget:function(e){var t={message:e.title,description:e.description},n=CloudOS.APPLE_ID_WIDGET_BUTTON_INDEX_TO_PROPERTY_MAP,r=e.buttons;for(var i=0,s=r.length;i1.1)e=YES}else SC.browser.msie&&screen.deviceXDPI/screen.logicalXDPI!==1&&(e=YES);return e},_createZoomLevelAlert:function(){return this._zoomLevelAlert?this._zoomLevelAlert:(this._zoomLevelAlert=CW.Alert.show({message:"ZoomLevel.Title".loc(),description:"ZoomLevel.Description".loc(),rightButton:"Button.OK".loc()}),this._zoomLevelAlert)},resize:function(){},environmentDidChange:function(e){this.createSash(e),this.setCurrentAppPropertyOnWindow()},createSash:function(e){var t=CloudOS.EXCLUDE_SASH_FOR_ENVS;!this._envSashPane&&CloudOS.EnvironmentSashPane&&(!t.contains(e)||CK.get("isCarry"))&&!CW.getUrlParameters().suppressEnvironmentSash&&(this._envSashPane=CloudOS.EnvironmentSashPane.create().append())},setCurrentAppPropertyOnWindow:function(){Object.defineProperty&&(CloudOS.getEnvironment()!=="PROD"||!SC.browser.isSafari)&&Object.defineProperty(window,"currentApp",{configurable:!0,get:function(){return CloudOS.appController.getPath("currentApp.contentWindow")}})},authBadgeDidHide:function(){if(!CloudOS.get("isCloudOSMini"))return;var e=CloudOS.appController.get("pendingApp");e&&(this._sleptApp=e,e.sleep() )},authBadgeDidAnimate:function(){this.invokeLater(function(){this._sleptApp&&(this._sleptApp.wake(),this._sleptApp=null)},300)},authPaneWasInitialized:function(e){e.beginPropertyChanges(),e.bind("nowShowing","CloudOS.workspaceController.nowShowing"),e.set("displayKey",CloudOS.AUTH),e.endPropertyChanges()},accountPrefsChanged:function(e,t){var n;e!==t&&(CloudOS.blockUserInput(),n=YES);var r=CloudOS.moduleLocalizer.setLocale(),i=this._envSashPane;r?(n||CloudOS.blockUserInput(),i&&i.set("isVisible",NO),CW.notificationCenter.subscribeToNotification("relocalize",this,"_showEnvSash"),SC.Module.loadModule("cloudos_foundation/language",this,"_didReloadLanguageModule")):(n&&CloudOS.unblockUserInput(),CW.notificationCenter.postNotification("relocalize","User Changed Language and maybe we need to reload certain apps."))},_didReloadLanguageModule:function(){CloudOS.localizationController.relocalizeIfNeeded("User Changed Language and Language Loaded"),CloudOS.unblockUserInput(),CloudOS.authController.get("isAuthenticated")&&CloudOS.loadAlarms()},_showEnvSash:function(){this._envSashPane&&this.invokeLater(function(){this._envSashPane.set("isVisible",null)},200)}}),CloudOS.authController=COS.AuthUIController.create({postLoginRedirectUrl:null,hsaUserAction:CloudOS.HSASourceEnum.NONE,delayedTearDownApp:null,delayedTearDownUsed:!1,iCloudLiteSignUp:NO,isAuthWidgetLoaded:NO,isFirstRunLoaded:NO,performedLoginFlow:NO,_appReplacementsCompleted:NO,init:function(){arguments.callee.base.apply(this,arguments),CW.notificationCenter.subscribeToNotification("authModuleDidLoad",this,"authModuleDidLoad"), CW.notificationCenter.subscribeToNotification("userDidCompleteFirstRun",this,"userDidCompleteFirstRun"),CW.notificationCenter.subscribeToNotification("quotaDataFetched",this,"quotaDataFetched"),CW.notificationCenter.subscribeToNotification("accountPreferencesLoaded",this,"accountPreferencesLoaded")},windowWillClose:function(){CloudOS.appController.applicationWillClose(),arguments.callee.base.apply(this,arguments)},loginDidFail:function(){CloudOS.appController.reset(),arguments.callee.base.apply(this,arguments)},customLoginBody:function(){var e={},t=CloudOS.appController.getDefaultAppName();return t&&(e.appName=t),e}.property(),accountPreferencesLoaded:function(){this.redirectToPostLoginRedirectUrl()},redirectToPostLoginRedirectUrl:function(){var e=!1;return this.shouldUsePostLoginRedirectUrl()&&!this.get("accountRepairRequired")&&(this.get("isPartiallyAuthenticated")?(CloudOS.statechart.sendAction("showHSA",CloudOS.HSASourceEnum.POST_LOGIN_REDIRECT),e=!0):!this.shouldShowFirstRun(this.get("accountPreferences"),CW.getUrlParameters())&&!this.get("isValidatingHsa")&&(CloudOSBootstrap.isTermsAndConditionUrl?this.logoutUser(this.reloadWithPostLoginRedirectUrl.bind(this)):this.reloadWithPostLoginRedirectUrl(),e=!0)),e},reloadWithPostLoginRedirectUrl:function(){CK.reloadWithReason("postLoginRedirectUrl",this.get("postLoginRedirectUrl"))},userHasLoggedIn:function(){var e=CloudOS.appController,t=CloudOS.statechart,n=this._auth_bag.apps,r,i;CloudOS.notificationsController||(CloudOS.notificationsController=CloudOS.NotificationsController.create());var s=function(){var t=this._auth_bag; this.invokeLast(function(){CW.notificationCenter.unsubscribeFromNotification("appReplacementsCompleted",this,s)});if(t){var n=t.apps;e.replaceApps(n),e.detectAndLoadAdditionalApps(n),CloudOS.appController.get("isAllAppInfoLoaded")?this.removeUnsupportedApps():CW.notificationCenter.subscribeToNotification("receivedInfoForAllDynamicApps",this,"removeUnsupportedApps")}else SC.warn("No auth bag available. We might be in logout mode")}.bind(this);CW.notificationCenter.subscribeToNotification("appReplacementsCompleted",this,s),this.get("accountRepairRequired")||(this.get("isAtLeastPartiallyAuthenticated")&&!this._appReplacementsCompleted&&(this._appReplacementsCompleted=YES,e.setNewReplacementApps(["notes2"]),e.showNotes2AppIfNeeded(n)),this.get("isAuthenticated")&&(CloudOS.appController.notifyPropertyChange("appList"),COS.PushController.initiatePushConnection(CloudOS.notificationsController),CloudOS.notificationsController.getBadgeState(),this.measureLoadPerformance()))},removeUnsupportedApps:function(){var e,t=this._auth_bag.apps,n=CloudOS.appController;for(e in t){var r=CloudOS.getAppInfo(e);r&&(this.getPath("user.isLiteAccount")&&!r.get("supportsLite")&&delete t[e],this.getPath("user.isPrimaryAppleIdTypePhoneNumber")&&!r.get("supportsPhoneNumberBasedAppleId")&&delete t[e])}n.removeOmittedApps(t),n.notifyPropertyChange("appList")},measureLoadPerformance:function(){this.invokeLater(SC.run(function(){var e=this.get("currentDomain"),t=SC.buildMode==="debug"?"/system/cloudos/1812Project43/cloudos_foundation/1812Project43/en-us/source/resources/images/blank.png":"https://%{currentDomain}/blank.png" .fmt({currentDomain:e});CloudOS.loadImageUrlAndRecordStat(t,"OriginLoad");var n=SC.buildMode==="debug"?"/system/cloudos/1812Project43/cloudos_foundation/1812Project43/en-us/source/resources/images/blank.png":"https://www.%{currentDomain}/blank.png".fmt({currentDomain:e});CloudOS.loadImageUrlAndRecordStat(n,"CDNLoadICloud");var r=SC.buildMode==="debug"?"/system/cloudos/1812Project43/cloudos_foundation/1812Project43/en-us/source/resources/images/blank.png":"https://icloud.cdn-apple.com/blank.png";CloudOS.loadImageUrlAndRecordStat(r,"CDNLoadApple"),CloudOS.reportEdgePerformance()}.bind(this)),5e3)},shouldUsePostLoginRedirectUrl:function(){var e=this.get("postLoginRedirectUrl");if(e){var t=URI(e);if(t.domain()===this.get("currentDomain")&&t.protocol()==="https")return YES}return NO},authModuleDidLoad:function(){CloudOS.workspaceController.hideCentralSpinner(function(){CloudOS.get("isCloudOSMini")?CloudOS.authPane.show():CloudOS.workspaceController.set("nowShowing",CloudOS.AUTH)}.bind(this))},_firstRunViewDidChange:function(){CloudOS.appSwitcherController.hideAppSwitcher()},languageDidLoad:function(){CloudOS.localizationController.relocalizeIfNeeded("Signin Submission Succeeded and Language Loaded"),CloudOS.appController.get("areAllAppReplacementsCompleted")?this.checkIfDefaultAppIsCreated():CW.notificationCenter.subscribeToNotification("appReplacementsCompleted",this,"checkIfDefaultAppIsCreated")},checkIfDefaultAppIsCreated:function(){var e=CloudOS.appController,t=e.getDefaultAppName(),n=e.getDefaultApp(),r=e.getPath("pendingInfoJSONRequests."+t);this.invokeLast(function(){CW.notificationCenter .unsubscribeFromNotification("appReplacementsCompleted",this,"checkIfDefaultAppIsCreated")}),!n&&t&&COS.apps[t]&&r?CW.notificationCenter.subscribeToNotification("receivedInfoForDynamicApp",this,function(e,n){if(t!==e)return;this.redirectToState()}):this.redirectToState()},redirectToState:function(){var e=CloudOS.appController,t=CloudOS.authController,n=CloudOS.getShareDetailsFromUrl(),r=e.get("currentApp"),i=e.getDefaultAppName(),s=e.getDefaultApp(),o=e.get("pendingApp"),u=e.get("isAllAppInfoLoaded"),a=this.get("hsaChallengeRequired"),f=this.get("isValidatingHsa"),l=this,c=CloudOS.statechart,h="active.springboard",p=CloudOS.isOnSupportedMobile(),d=this.shouldUsePostLoginRedirectUrl(),v=function(){c.gotoState("active.springboard.waitingForApp")};if(t.get("isPartiallyAuthenticated"))!o&&s&&e.set("pendingApp",s),!s||s.get("isLocked")?c.sendEvent("showHSA"):c.gotoState("active.authUI.waitingForApp");else if(t.get("isPartiallyAuthenticatedForManagedAppleId"))!o&&s&&e.set("pendingApp",s),c.gotoState("managedAppleId");else if(CloudOSBootstrap.isTermsAndConditionUrl&&!d)c.sendEvent("gotoShowTermsAndConditionConfirmation");else if(n)CloudOS.handleShareDetails(n);else if(o&&!o.get("isLocked"))c.gotoState(h,null,null,v);else if(!s)c.gotoState(h);else{var m=this.get("user");e.set("pendingApp",s),!m||!a||s.get("canLaunchWithOneFactor")?COS.authController.get("authBagLoadedFromOpenerWindow")?c.gotoState("active.authUI.waitingForApp"):s&&s.get("isPCSKeysDeletedLocked")?c.gotoState(h):p?CloudOS.workspaceController.showCentralSpinner(function(){c.gotoState("active.authUI.waitingForApp")}.bind (this)):c.gotoState(h,null,null,v):c.gotoState(h)}a||CloudOS.loadAlarms()},userDidCompleteFirstRun:function(){this.userDidAuthenticate()},logoutUser:function(e,t){var n=CloudOS.appController.get("appsNotReadyToTerminate"),r=this;if(!n||!t)return e&&CloudOS.blockUserInput(0),arguments.callee.base.apply(this,arguments);var i=n.pop(),s=i.get("displayName");this._unsavedDialog||(this._unsavedDialog=CW.Alert.show({message:"Dialog.UnsavedChanges.Title".loc(),description:"Dialog.UnsavedChanges.Description".loc(s),superClassMethod:arguments.callee.base,superClassMethodDelegate:this,middleButton:{title:"Dialog.UnsavedChanges.DontSignOutButton".loc(),action:"logoutCancelled"},rightButton:{title:"Dialog.UnsavedChanges.SignOutButton".loc(),action:"continueLogout"},logoutCancelled:function(){SC.info("logout is cancelled"),this.remove();return},continueLogout:function(){return this.remove(),e&&CloudOS.blockUserInput(0),this.superClassMethod.apply(this.superClassMethodDelegate,[e,t])},remove:function(){r._unsavedDialog=null,arguments.callee.base.apply(this,arguments)}}))},userDidAuthenticate:function(e){var t=CloudOS.authController,n=CloudOS.appController,r=t._auth_bag,i=t.get("hsaChallengeRequired");this.set("performedLoginFlow",YES),i||CloudOS.moduleLocalizer.setLocale(),CloudOS.authController.setDomainSpecificClassNames(),t.get("isRevalidatingUser")||SC.Module.loadModule("cloudos_foundation/language",this,"languageDidLoad");if(!CloudOS.get("isCloudOSMini"))return;var s=t.get("accountPreferences");CloudOS.passMessageToAllApps("_cloudOSStateChange",{authBag:r,accountPreferences:s?s.prefsHash ():null,appPreferences:COS.prefsController.allAppPreferencesHash()}),t.get("isRevalidatingUser")||(t.get("isAuthenticated")?(this.showTermsNotificationIfRequired(),CloudOS.passMessageToAllApps("userDidAuthenticate",e)):(t.get("isPartiallyAuthenticated")&&CloudOS.passMessageToAllApps("userDidPartiallyAuthenticate",e),this._fromCurrentWindow=e))},userDidNotAuthenticate:function(e){CloudOS.passMessageToAllApps("userDidNotAuthenticate",e)},userDidLogout:function(e){if(!CloudOS.get("isCloudOSMini")){e||(window.location.hash="#:showlogin",CK.reloadWithReason("userDidLogout, fromCurrentWindow: "+e));return}CloudOS.passMessageToAllApps("userDidLogout",e)},redirectPostAuthenticationIfRequired:function(e){var t=window.location.href,n=e.isCarryUser,r=this.shouldUsePostLoginRedirectUrl();if(!r){if(CK.get("isCarry")&&!n)return window.location.href=t.replace("carry.","www."),YES;var i=CW.getUrlParameters(),s=i.carry,o=i.skipCarryRedirect;if(!s&&e&&!e.hsaChallengeRequired&&!this.accountTermsUpdateRequired&&CK.get("isWWW")&&n&&!o)return window.location.href=t.replace("www.","carry."),YES}return NO},validateUserIfNeeded:function(){this.serviceIdentitiesAreMissing()&&(COS.statsController.recordStat("cloudos","ValidatedUserForMissingServiceIdentities"),this.validateUser())},quotaDataFetched:function(e,t){if(!t){SC.warn("No quotaData found to send _cloudOSStateChange and quotaDataDidChange messages");return}CloudOS.passMessageToAllApps("_cloudOSStateChange",{quotaData:t}),CloudOS.passMessageToAllApps("quotaDataDidChange")},showPCSDeletedErrorMessage:function(e){if(!e)return;if(this._lastPCSAlertAppDisplayName=== e){SC.debug("PCS Deleted alert for %@ is already being shown.",e);return}this._lastAlert&&this._lastAlert.remove(),this._lastPCSAlertAppDisplayName=e;var t=this;this._lastAlert=CW.Alert.show({message:"Error.AppPCSDeleted.Title".loc(e),description:"Error.AppPCSDeleted.Description".loc(),rightButton:"Button.OK".loc(),remove:function(){arguments.callee.base.apply(this,arguments),t._lastAlert=null,t._lastPCSAlertAppDisplayName=null}})},setDomainSpecificClassNames:function(){this.getPath("user.isChineseAccount")&&CloudOSBootstrap.setChinaClassName(!0)}}),CloudOS.autoUpdateController=SC.Object.create({init:function(){return this.createOrReuseAutoUpdateTimer(),arguments.callee.base.apply(this,arguments)},autoUpdateTimer:null,createOrReuseAutoUpdateTimer:function(e){var t=this.get("autoUpdateTimer");if(t){if(!e)return;t.invalidate()}else e||(e=CloudOS.AUTO_UPDATE_INTERVAL);t=SC.Timer.schedule({target:this,action:"checkVersion",interval:e*1e3,repeats:YES}),this.set("autoUpdateTimer",t)},checkVersion:function(e){var t=(new Date).getTime(),n=CW.getUrlParameters(),r=this.get("autoUpdateTimer"),i=r.get("interval"),s=t-CloudOS._lastActivityEpoch,o;if(e!==YES&&this._lastCheck+(i-1e4)>t){SC.info("autoUpdate: Already checked %@ms ago, ignoring",t-this._lastCheck);return}this._lastCheck=t,o=s>CloudOS.AUTO_UPDATE_INACTIVITY_INTERVAL*1e3?CloudOS.AUTO_UPDATE_DELAYED_INTERVAL:CloudOS.AUTO_UPDATE_INTERVAL,o*1e3!==i&&this.createOrReuseAutoUpdateTimer(o);var u=SC.Request.getUrl("https://"+window.location.hostname+"/system/cloudos/current/version.json").json();u.notify(0,this,function(e){if(n.autoUpdate )return SC.warn("autoUpdate: Will simulate response since autoUpdate flag is set."),this.handleVersionResponse("override",parseInt(n.autoUpdate,10)),YES;if(e.get("status")!==200)return SC.warn("autoUpdate: Could not fetch version.json"),YES;var t=e.get("body"),r,i;return t&&(r=t.buildNumber,i=t.autoUpdate,!SC.none(r)&&!SC.none(i)&&this.handleVersionResponse(r,parseInt(i,10))),YES}),u.send()},handleVersionResponse:function(e,t){if(t===CloudOS.UPDATE_IGNORE){SC.debug("autoUpdate: Update flag for %@ is UPDATE_IGNORE",e);return}if(SC.buildNumber===e){SC.debug("autoUpdate: Running latest build, %@",e);return}var n=CK.getValueFromLocalStorage("didReloadToBuild",YES);if(n===e){SC.warn("autoUpdate: We already reloaded the user to try an update to %@, so will not do it again!",e);return}var r=this;if(t===CloudOS.UPDATE_PROMPT){SC.debug("autoUpdate: Prompt the user to reload to %@",e);if(this._reloadPane&&this._reloadPane.get("isVisibleInWindow")){SC.info("autoUpdate: There is already an auto update alert pane showing, so ignoring request for a second one.");return}var i=CloudOS.authController.get("displayableCurrentDomain");this._reloadPane=CW.Alert.show({message:"AutoUpdate.Title".loc({currentDomain:i}),description:"AutoUpdate.Description".loc(),image:"me-icon-alert-68",rightButton:{title:"AutoUpdate.Reload".loc(),action:function(){r.reloadToBuildNumber(e)}},middleButton:{title:"AutoUpdate.Later".loc(),action:function(){this.get("pane").remove()}}})}t===CloudOS.UPDATE_FORCE&&(SC.debug("autoUpdate: Force the user to reload to %@",e),r.reloadToBuildNumber(e)),t===CloudOS.UPDATE_DELAYED_FORCE&& (SC.debug("autoUpdate: Delay force the user to reload to %@",e),this.reloadIfAppropriate(e),this.invokeLater(function(){this.reloadToBuildNumber(e)},CloudOS.AUTO_UPDATE_DELAYED_FORCE_WAIT*1e3))},reloadIfAppropriate:function(e){var t=CloudOS._lastActivityEpoch,n=(new Date).getTime()-CloudOS._lastActivityEpoch;!t||n>6e4?this.reloadToBuildNumber(e):this.invokeLater(function(){this.reloadIfAppropriate(e)},6e4)},reloadToBuildNumber:function(e){CK.setValueInLocalStorage("didReloadToBuild",e,YES),CK.reloadWithReason("reloadToBuildNumber "+e)}}),CloudOS.mixin({UPDATE_IGNORE:0,UPDATE_PROMPT:1,UPDATE_FORCE:2,UPDATE_DELAYED_FORCE:3}),CloudOS.SINGLE_LINE_BANNER_HEIGHT=38,CloudOS.MULTI_LINE_BANNER_HEIGHT=58,CloudOS.BANNER_ANIMATION_DURATION=500,CloudOS.bannerManager=SC.Object.create({_bannerHeight:CloudOS.SINGLE_LINE_BANNER_HEIGHT,_currentQuotaBannerShowingType:null,init:function(){arguments.callee.base.apply(this,arguments),CW.notificationCenter.subscribeToNotification("quotaDataFetched",this,"quotaDataFetched"),CW.notificationCenter.subscribeToNotification("relocalize",this,"relocalize")},bannerHeight:function(e,t){return t!==undefined?(this._bannerHeight=t,this._bannerHeight):this.get("isBannerVisible")?this._bannerHeight:0}.property("isBannerVisible"),isBannerVisible:function(){return!!this.get("_currentBanner")}.property("_currentBanner"),_appsBannerHash:{},_currentBanner:null,findBannerToShowForApp:function(e){var t=this._appsBannerHash[e];if(!t||t.length===0)return null;var n=t[0];for(var r=1,i=t.length;r0&&this.get("showFeedbackAfter")+e<=SC.getCurrentTimeForPerformance()&&(this._userInputWasBlockedAt=0,this.set("shouldShowFeedback",YES))}}),CloudOS.initializationController=SC.Object.create({createFrameURL:null,createFrameOrigin:null,repairFrameURL:null,repairFrameOrigin:null,accountLoginUrl:null,repairDoneEndpointURL:null,accountCreateEndpointURL:null,getICloudTermsEndpointURL:null,accountLoginEndpointURL:null,accountCreationEnabled:!1,extractOrigin:function(e){var t=URI.parse(e);return t.protocol+"://"+t.hostname+(t.port!==null?":"+t.port:"")},handleConfigBag:function(e){try{var t=e.urls,n=CW.getUrlParameters(),r=n.useUATLoginUI,i=n.useStableLoginUI;if(t){var s=t.accountLoginUI;this.set("createFrameURL",t.accountCreateUI),this.set("repairFrameURL",t.accountRepairUI),r?s=s.replace("stable","uat"):i&&(s=s.replace("uat","stable")),this.set("accountLoginUrl",s),this.set("accountLoginEndpointURL",t.accountLogin),this.set("repairDoneEndpointURL",t.repairDone),this.set("accountCreateEndpointURL",t.accountCreate),this.set("getICloudTermsEndpointURL",t.getICloudTerms)}var o=e.accountCreateEnabled;o&&!SC.browser.isIE9OrLower&&this.set("accountCreationEnabled",o)}catch(u){SC.Logger.warn("Failed to parse or extract properties from the config bag!")}}}),CloudOS.localizationController=SC.Object.create({_lastPreferredLanguage:null,relocalizeIfNeeded :function(e,t){e=e||"unknown reason"+(t?" that was forced":""),this._reasons||(this._reasons=[]),this._reasons.push(e),this.invokeOnce(t?"_forceReloc":"_relocalizeIfNeeded")},_forceReloc:function(){this._relocalizeIfNeeded(!0)},_relocalizeIfNeeded:function(e){var t=this._reasons.join(", ")||"no reasons known";this._reasons.length=0;var n=e||String.preferredLanguage!==this._lastPreferredLanguage;SC.debug("Language check for CloudOS: "+this._lastPreferredLanguage+" -> "+String.preferredLanguage+". We "+(n?"WILL":"WILL NOT")+" relocalize cloudOS."),this._lastPreferredLanguage=String.preferredLanguage,CK.setValueInLocalStorage("locale",String.preferredLanguage),CW.notificationCenter.postNotification("relocalize",(e?"FORCED: ":"")+t,e)}}),CloudOS.NotificationsController=SC.Object.extend(SC.DelegateSupport,{getBadgeState:function(){if(!CK.servicesController.getServiceInfoFor("push")){SC.debug("getBadgeState(): PushWS is not available.");return}var e=CK.Request.postUrl("/getState");e.set("serviceName","push"),e.set("isJSON",YES),e.queryParameter("pcsEnabled",COS.authController.get("pcsEnabled")),e.notify(200,this,function(e){var t=e.get("body"),n=t?t.states:null;if(!n||n.length===0){SC.warn("There was a problem reading the badge state response.");return}var r,i,s,o,u,a;for(u=0,a=n.length;u-1&&s.set("badgeCount",o)}return YES}),e.notify(0,this,function(e){return SC.warn("%@ received from pushws. Will not retry.",e.get("status")),YES}),e.send ({pushTopics:COS.pushController.get("pushTopics")})},didInitializePush:function(e){CloudOS.passMessageToAllApps("_cloudOSStateChange",{pushToken:e.pushToken})},handlePushNotification:function(e,t,n,r){var i,s,o;if(SC.typeOf(e)===SC.T_HASH)i=e;else try{i=SC.json.decode(e)}catch(u){SC.warn("handlePushNotification(): Exception parsing push notification");return}s=i.apsTopic,!s&&i.ck&&(o=i.ck.cid);if(!i||!t&&!s&&!o){SC.warn("Push notification has missing body, topic or container identifier");return}var a;t?a=[CloudOS.appManagerFor(n)]:s?a=CloudOS.appManagersForPushTopic(s):o&&(a=CloudOS.appManagersForContainerIdentifier(o)),a.forEach(function(n){this.handlePushNotificationForAppManager(i,e,n,t,r)},this),a.length===0&&SC.warn("Push notification has unknown topic or container identifier"),CW.notificationCenter.postNotification("didReceivePushNotification",a.getEach("name"),e)},handlePushNotificationForAppManager:function(e,t,n,r,i){var s=n.get("name"),o,u,a,f,l;if((!n.get("isActive")||e.omitWhenActive===NO)&&e.aps){u=e.aps.alert,a=e.aps.alertTitle,f=e.aps.badge,l=e.aps.sound;if(u||a)e.sessionID===COS.CLIENT_ID?SC.info("Not showing notification for %@ as it originated from this client session",s):this.displayNotification(n,e);SC.typeOf(f)===SC.T_NUMBER&&f>-1&&n.set("badgeCount",f)}i=i===undefined?n.get("awakesInBackgroundFromPush"):i;if(n.get("isReady"))SC.debug("Handing notification off to %@",s),n.passMessage("didReceiveNotification",t);else if(!n.get("isReady"))if(i){if(n.get("isDisabled")){SC.info("Cannot start app %@ since it's disabled",s);return}SC.debug("Starting application %@ as it might need to create a local notification" ,s),n.set("loadReason",CK.LOAD_REASON_NOTIFICATION);var c=n.get("notificationQueue")||[];c.push(t),n.set("notificationQueue",c),n.set("postDisplayAction",function(){c.forEach(function(e){n.passMessage("didReceiveNotification",t)})}),n.invokeLast("getReadyInBackground")}else SC.debug("Ignoring notification for %@ as it does not awakesInBackground",s)},shouldDisplayNotification:function(e){var t=CW.getUrlParameters();return t.suppressNotifications?NO:YES},displayNotification:function(e,t){var n=e.get("name"),r="Notification.PlaceholderDescription.",i=NO,s,o,u,a,f;if(!this.shouldDisplayNotification(n)){SC.info("Skipping visual notification for %@",n);return}u=t.aps.alert;if(SC.typeOf(u)===SC.T_HASH){o=u["loc-args"];if(!o||SC.typeOf(o)!==SC.T_ARRAY){SC.warn("loc-args array is missing or malformed: %@",o);return}s=("PushNotification."+n+"."+u["loc-key"]).loc(o[0],o[1],o[2])}else!u&&CK.hasLocalizedStringForKey(r+n)?(s=(r+n).loc(),i=YES):s=u;a=t.aps.alertTitle||e.get("displayName"),f=t.isDismissable!==undefined?!!t.isDismissable:YES;var l=CloudOS.iOSNotification.create({appDisplayName:e.get("displayName"),message:SC.RenderContext.escapeHTML(a),description:SC.RenderContext.escapeHTML(s),isDismissable:f,icon:e.get("notificationIcon"),classNames:function(){return i?["placeholder-description"]:[]}(),action:function(r){CloudOS.appController.switchToApplicationWithNotification(n,t,r),e.set("loadReason",CK.LOAD_REASON_NOTIFICATION),r.invokeLater(function(){r.dismiss()},CloudOS.MAX_NOTIFICATION_DISMISSAL_WAIT*1e3),r._wasAlreadyDismissed=YES,COS.statsController.recordStat("cloudos","Notification" ,{appName:n,dismissReason:"USER_CLICKED"})},didDismiss:function(e,t){if(e._wasAlreadyDismissed)return;COS.statsController.recordStat("cloudos","Notification",{appName:this._appName,dismissReason:t?"AUTO_DISMISSED":"USER_DISMISSED"})},_appName:n});return CW.iOSNotification.enqueue(l),l},activeAppTimer:null,inactiveAppTimer:null,hasPushConnectionBinding:"COS.pushController.hasPushConnection",isRegisteredToAllTopicsBinding:"COS.pushController.isRegisteredToAllTopics",appsMissingPushTopicBinding:"COS.pushController.appsMissingPushTopic",pushTopicsOrHasConnectionDidChange:function(){var e=this.get("hasPushConnection");e===YES&&this.get("isRegisteredToAllTopics")&&this.getPath("appsMissingPushTopic.length")===0?this.stopIdleTimers():this.startIdleTimers()}.observes("hasPushConnection","isRegisteredToAllTopics","appsMissingPushTopic"),startIdleTimers:function(){if(this.get("activeAppTimer"))return;var e=SC.Timer.schedule({target:this,action:"activeAppShouldRefresh",interval:CloudOS.ACTIVE_IDLE_INTERVAL*1e3,repeats:YES});this.set("activeAppTimer",e);var t=SC.Timer.schedule({target:this,action:"inActiveAppsShouldRefresh",interval:CloudOS.INACTIVE_IDLE_INTERVAL*1e3,repeats:YES});SC.debug("Started idle timers"),this.set("inactiveAppTimer",t)},stopIdleTimers:function(){var e=this.get("activeAppTimer"),t=this.get("inactiveAppTimer");if(!e&&!t)return;e&&(e.invalidate(),this.set("activeAppTimer",null)),t&&(t.invalidate(),this.set("inactiveAppTimer",null)),SC.debug("Stopped idle timers")},pushIsActiveForApp:function(e){var t=COS.pushController,n=t.get("registeredPushTopics"),r=t.get("registeredCloudKitContainers" );return!this.get("hasPushConnection")||!n||n.indexOf(e.get("pushTopic"))===-1&&r[e.getPath("appInfo.containerIdentifier")]===undefined?NO:YES},activeAppShouldRefresh:function(){var e=CloudOS.appController.getPath("currentApp");e&&!this.pushIsActiveForApp(e)&&e.passMessage("applicationShouldRefresh",NO)},inActiveAppsShouldRefresh:function(){var e=CloudOS.appController.get("apps"),t,n;for(t in e){n=e[t];if(n.get("isActive")||this.pushIsActiveForApp(n))continue;n.passMessage("applicationShouldRefresh",NO)}}}),CloudOS.NewLoginFrameView=CloudOS.AppleAuthWidgetFrameView.extend(CW.Animatability,{classNames:["new-login-frame","iframe-pane"],adjustablePane:null,isVisible:YES,show:function(e){this._url=e;var t;t=this._iframeView=this.createChildView(CloudOS.iFrameView,{src:this._url,toString:function(){return"CloudOS.NewLoginFrameView"}}),this.appendChild(t),this.invokeLast(function(){var e=t.$();e.attr("id","new-login-frame"),e.attr("width","100%"),e.attr("height","100%"),e.attr("frameborder","0"),e.attr("scrolling","no"),e.attr("tabindex","-1")})},getFrame:function(){return this.getPath("_iframeView.layer")},layout:function(e,t){var n,r=CW.getUrlParameters().hasOwnProperty("showFullScreen");return r?n={top:0,left:0,right:0,bottom:0}:t!==undefined?n=t:n={centerY:-70,centerX:0,width:Math.min(this.DEFAULT_WIDTH,Math.max(COS.MIN_WIDTH,window.innerWidth)),height:Math.min(this.DEFAULT_HEIGHT,Math.max(COS.MIN_HEIGHT,window.innerHeight)),opacity:0},n.zIndex=5,n}.property().cacheable(),hide:function(){var e=this._iframeView;e&&e.destroy()},_url:null,_iframeView:null}),CloudOS.NEW_LOGIN_READY_TIMEOUT=45e3 ,CloudOS.NewLoginController=SC.Object.extend(CloudOS.AppleWidgetCommonMethods,{_contentViewClass:CloudOS.NewLoginFrameView,show:function(e,t){this.set("_pane",e),this.set("_url",t),this._loadURLInFrameWithTimeout(t)},_loadURLInFrameWithTimeout:function(e){var t=CloudOS.NEW_LOGIN_READY_TIMEOUT,n;try{n=URI.parse(e)}catch(r){throw r.message="Failed to parse the new Login URL:\n"+r.message,r}this._flowOrigin=n.protocol+"://"+n.hostname,this._frameHasCalledReady=NO;var i=this.get("_pane"),s=this.get("_paneContentView"),o=i.get("childViews"),u=COS.statsController;i.set("authWidgetFrame",s),this.clearMessagesReceived(),this.get("_numberOfRetries")===0&&u.beginStat("cloudos","NewLogin_TotalLoadTime"),u.beginStat("cloudos","NewLogin_Loading_Successful"),u.beginStat("cloudos","NewLogin_Loading_Failed"),i.insertBefore(s,o&&o.objectAt(0)),this.invokeLast(function(){s.show(this._generateURL(e))}),SC.debug("Starting timer to track time taken by new Login to load. Attempt Number %@",this.get("_numberOfRetries")+1),this._failureTimer=this.invokeLater(this._didFailToLoad,t)},_didLoad:function(){this._frameHasCalledReady=YES,CloudOS.workspaceController.hideCentralSpinner(function(){this.get("_paneContentView").animate("opacity",1,350),CW.notificationCenter.postNotification("springboardMayProceed"),CloudOS.statechart.sendAction("newLoginLoaded")}.bind(this))},_didFailToLoad:function(){if(this._frameHasCalledReady)return;SC.debug("new Login failed to load"),CloudOS.statechart.sendAction("newLoginFailedToLoad")},_resetPaneContentView:function(e,t){var n=this.get("_paneContentView");e.removeChild (n),e.set("authWidgetFrame",null),this.resetContentView(),n.destroy(),this._failureTimer.invalidate(),t&&this.destroy()},_rpcMethodHandlers:{ready:function(){this._didLoad()},complete:function(e,t){if(t){t.isNewLoginLogin=YES,this._resetPaneContentView(this.get("_pane"),YES);var n=t.completionMessage,r=t.channelInfo;if(r)try{CK.isStringBase64Encoded(r)&&(r=CW.decodeBase64(r)),r=JSON.parse(r),CloudOS.authController.set("secureChannelInfoData",r)}catch(i){CW.fatalError("secureChannelInfo is not in a JSON format which can be parsed.")}if(n)try{t.completionMessage=JSON.parse(n)}catch(s){CW.fatalError("Unable to read the payload in the complete message")}CloudOS.statechart.sendAction("loginCompleted",t)}},switchOverToAuth:function(e){this._resetPaneContentView(this.get("_pane"),YES),CloudOS.statechart.sendAction("gotoAppleIdLogin")}}});var FIRST_PARTY_ICON_MAP={keynote:"key",numbers:"numbers",pages:"pages"},ICLOUD_APPLE_ZONE="com.apple.icloud.applecorporate";CloudOS.ShareController=SC.ObjectController.extend({database:null,shortGUID:null,vettingToken:null,recordInfo:null,isVettingTokenVetted:NO,appNameFromUrl:null,containerIdentifier:null,isPublicShare:NO,didShowAcceptUIPreLogin:NO,_appWasReady:null,appName:function(){var e=this.get("appNameFromUrl"),t=e;if(!t){var n=this.containerIdentifier;if(n==="com.apple.clouddocs"){var r=this.recordInfo;if(!r)return;var i=r.rootRecord,s=i.fields.extension.value;switch(s){case"key":t="keynote";break;case"numbers":t="numbers";break;case"pages":t="pages";break;default:t="iclouddrive"}}else n&&(t=this.getAppNameForContainerId(n))}return t}.property ("appNameFromUrl","containerIdentifier","recordInfo").cacheable(),fileExtensionOrUTI:function(){var e=this.get("appName");if(e in FIRST_PARTY_ICON_MAP)return FIRST_PARTY_ICON_MAP[e]}.property("appName").cacheable(),isAppSupportedOnMobile:function(){var e=this.get("appNameFromUrl");if(e){var t=CloudOS.getAppInfo(e);return t?t.get("isSupportedOnMobile"):undefined}return YES}.property("appNameFromUrl").cacheable(),hasAppUIForAcceptedSharesOnMobile:function(){var e=this.get("appNameFromUrl");if(e){var t=CloudOS.getAppInfo(e);return t?t.get("hasUIForAcceptedSharesOnMobile"):undefined}return NO}.property("appNameFromUrl").cacheable(),init:function(){CW.notificationCenter.subscribeToNotification("sharingCancelled",this,"sharingCancelled"),SC.Logger.info("Loading CloudKit JS in CloudOS"),SC.Event.add(window,"cloudkitloadfailure",SC.RunLoop.wrapFunction(function(){CW.fatalError("Error resolving share: Unable to load CloudKitJS.")}.bind(this))),CK.loadCloudKitJS();var e=this.get("vettingToken"),t=this.get("isVettingTokenVetted"),n=this.get("shortGUID");this.resolveURL()},isShareThirdParty:function(){return this.get("recordInfo")&&!this.get("appNameFromUrl")&&!this.get("isGameCenterShare")}.property("recordInfo","appNameFromUrl").cacheable(),isGameCenterShare:function(){return this.getPath("recordInfo.containerIdentifier")==="com.apple.socialgaming.sessions"}.property("recordInfo").cacheable(),updateShareDetails:function(e){var t=e.vettingToken,n=e.isVettingTokenVetted,r=e.shortGUID,i=e.appNameFromUrl;this.set("vettingToken",t||null),this.set("isVettingTokenVetted",n||null),this.set("shortGUID" ,r||null),this.set("appNameFromUrl",i||null),this.set("recordInfo",null),this.resolveURL()},resolveURL:function(){window.CloudKit?(SC.Logger.info("CloudKit JS is already loaded"),this.cloudKitJSDidLoad()):SC.Event.add(window,"cloudkitloaded",function(){SC.Logger.info("Loaded CloudKit JS in CloudOS"),this.cloudKitJSDidLoad()}.bind(this))},cloudKitJSDidLoad:function(){window.Promise||(window.Promise=CloudKit.Promise),this.get("database")||this.set("database",CloudOS.Database.create({environment:"production",containerIdentifier:"com.apple.cloudkit",databaseType:CloudOS.DatabaseType.Public,partition:"",services:{fetch:CK.CKJSRequest.fetch}})),this.get("shortGUID")?this.retrieveShare():this.get("vettingToken")&&CloudOS.statechart.sendAction("completedShareControllerSetup")},retrieveShare:function(e){var t=this.get("shortGUID");if(!t)return;this.passMessageToApp("willResolveCKShortGUID",t);var n=window.CloudKit.getDefaultContainer();n.fetchRecordInfos({value:t}).then(SC.RunLoop.wrapFunction(function(t){var n=t.errors;if(n.length>0)this.retrieveShareDidFail(t);else{if(e){e(t);return}this.retrieveShareDidSucceed(t)}}.bind(this))).catch(SC.RunLoop.wrapFunction(function(e){this.passMessageToApp("didFailToResolveCKShortGUID",t,e),CW.fatalError("Error resolving share: "+e)}.bind(this)))},retrieveShareDidSucceed:function(e){SC.Logger.info("retrieveShare succeeded");var t=e.results[0];this.set("recordInfo",t);var n=t.rootRecord,r=t.share,i=t.participantStatus,s=this.get("shortGUID"),o=CloudOS.statechart,u=CloudOSBootstrap.isOnSupportedMobile,a=this.get("appName");if(r){SC.Logger.info("Share Record found" );if(!this.get("appNameFromUrl"))CloudOS.statechart.sendAction("retrieveShareSucceeded",YES);else if(i===CloudKit.ShareParticipantAcceptanceStatus.ACCEPTED)if(u){if(this.redirectToIWorkIfRequired(a))return;this.get("hasAppUIForAcceptedSharesOnMobile")?o.sendAction("showAlreadyAcceptedState"):CK.reloadWithReason("Sharing: No UI for an already accepted share.","/")}else SC.Logger.info("Share already accepted. Launching app."),this.launchApp();else u&&!this.get("isAppSupportedOnMobile")?o.sendAction("appIsUnsupportedOnMobile"):r.publicPermission!=="NONE"?(this.set("isPublicShare",YES),this.get("isAppleCorporateZone")?o.sendAction("retrieveShareSucceeded"):this.isIWorkApp(a)?this.launchApp():o.sendAction("showPublicAcceptance")):(SC.Logger.info("Share not yet accepted. Launching acceptance flow."),o.sendAction("retrieveShareSucceeded"))}else n?(SC.Logger.info("No share record found. Launching app."),this.launchApp()):(SC.Logger.info("Invalid shortGUID or deleted share. Showing sharing error."),o.sendAction("retrieveShareFailed"));return YES},retrieveShareDidFail:function(e){SC.Logger.info("retrieveShare failed, showing sharing error.");var t=this.get("shortGUID");return this.passMessageToApp("didFailToResolveCKShortGUID",t,e.errors),CloudOS.statechart.sendAction("retrieveShareFailed"),YES},isIWorkApp:function(e){return e==="keynote"||e==="numbers"||e==="pages"},redirectToIWorkIfRequired:function(e){return this.isIWorkApp(e)?(window.location.href=URI(CloudOS.authController.get("defaultOrigin")+"/"+e+"/"+this.get("shortGUID")).addSearch("redirectReason","off").toString()+"#:nooverride" ,YES):NO},launchApp:function(){var e=this.get("appName");if(this.redirectToIWorkIfRequired(e))return;var t=CloudOS.appManagerFor(e);CloudOS.appController.set("pendingApp",t),this.set("_appWasReady",t.get("isReady")),t.set("loadReason",CK.LOAD_REASON_SHARE_ACCEPTED),t.set("route",this.get("shortGUID")),CW.notificationCenter.subscribeToNotification("App Loaded",this,"appDidLaunch"),CloudOS.statechart.sendAction("globalAppSwitchWasRequested")},appDidLaunch:function(e){var t=this.get("appName"),n=this.get("shortGUID");if(e!==t)return;this._appWasReady||this.passMessageToApp("willResolveCKShortGUID",n),this.passMessageToApp("didResolveCKShortGUID",n,this.get("recordInfo")),CW.notificationCenter.unsubscribeFromNotification("App Loaded",this,"appDidLaunch")},getAppNameForContainerId:function(e){var t;for(t in COS.apps){var n=COS.appsController.getAppInfoFor(t),r=n.get("containerIdentifier");if(r===e)return t}CW.fatalError("shareController: cannot find app for requested container name.")},passMessageToApp:function(){var e=this.get("appName"),t=CloudOS.appManagerFor(e);t&&t.get("isReady")&&(SC.debug("Passing %@ message to %@",arguments[0],e),t.passMessage.apply(t,arguments))},sharingCancelled:function(){CloudOS.statechart.sendAction("sharingCancelled")},resetProperties:function(){this.set("shortGUID",null),this.set("vettingToken",null),this.set("recordInfo",null),this.set("isVettingTokenVetted",null),this.set("appNameFromUrl",null),this.set("database",null),this.set("fileExtensionOrUTI",null),this.set("containerIdentifier",null),this.set("_appWasReady",null),this.set("isPublicShare", NO),this.set("didShowAcceptUIPreLogin",NO)},isAppleCorporateZone:function(){var e=this.get("recordInfo");return e?e.zoneID&&e.zoneID.zoneName===ICLOUD_APPLE_ZONE:!1}.property("recordInfo")}),CloudOS.SharingAppleAuthWidgetController=CloudOS.AppleAuthWidgetController.extend({configUI:function(){var e,t="Auth.Title.SignInToICloud".loc(),n="Auth.Description.Share.",r=CloudOS.shareController,i=r.get("appName"),s=r.get("recordInfo");if(!s)return{signInLabel:"Auth.Title.SignInToICloud".loc()};var o=s.share.owner.userIdentity.nameComponents,u=o.givenName,a=o.familyName,f;return o&&(u||a)?CW.stringIsCJK(u)&&CW.stringIsCJK(a)?f=a+u:f=u+" "+a:CW.fatalError("No sharer name details in share details"),i==="notes"||i==="notes2"?(n+="notes2",e=n.loc({ownerName:f})):i?(n+=i,e=n.loc({ownerName:f})):(e="Auth.Title.SignInToICloud".loc(),t=null),{appName:t,signInLabel:e}}.property()}),CloudOS.DatabaseType={Public:"Public",Private:"Private",Shared:"Shared"},CloudOS.Database=SC.Object.extend({environment:null,containerIdentifier:null,databaseType:null,partition:null,services:null,databaseInstance:function(){var e=this.get("_databaseInstance");if(e)return e;var t=this.get("containerIdentifier"),n=this.get("databaseType"),r=window.CloudKit.getContainer(t);return n===Sharing.DatabaseType.Public?e=r.publicCloudDatabase:n===Sharing.DatabaseType.Private?e=r.privateCloudDatabase:n===Sharing.DatabaseType.Shared&&(e=r.sharedCloudDatabase),this.set("_databaseInstance",e),e}.property(),bootstrapConfiguration:function(){var e=this.get("partition"),t={containerIdentifier:this.get("containerIdentifier"),environment :this.get("environment"),privateDatabasePartition:this.get("partition"),publicDatabasePartition:this.get("partition"),sharedDatabasePartition:this.get("partition")},n={containers:[t]},r=this.get("services");return r&&(n.services=r),n}.property(),init:function(e){arguments.callee.base.apply(this,arguments);var t=this.get("bootstrapConfiguration");window.CloudKit.configure(t)},_databaseInstance:null}),CloudOS.keyResponder=SC.Object.create(CW.KeyResponder,{keyboardShortcuts:{ctrl_shift_p:"refreshCurrentApplication",ctrl_shift_w:"exitCurrentApplication",ctrl_shift_1:"open1",ctrl_shift_2:"open2",ctrl_shift_3:"open3",ctrl_shift_4:"open4",ctrl_shift_5:"open5"},reloadCurrentApplication:function(){var e=CloudOS.appController.get("currentApp");return e&&CloudOS.appController.reloadApplication(e.get("name")),NO},exitCurrentApplication:function(){var e=CloudOS.appController.get("currentApp");e&&CloudOS.appController.exitApplication(e.get("name"),CK.EXIT_NON_FATAL)},refreshCurrentApplication:function(){var e=CloudOS.appController.get("currentApp");e&&e.passMessage("applicationShouldRefresh",YES)},open1:function(){CloudOS.openApp(0)},open2:function(){CloudOS.openApp(1)},open3:function(){CloudOS.openApp(2)},open4:function(){CloudOS.openApp(3)},open5:function(){CloudOS.openApp(4)}}),CloudOS.ValidatedDownload=SC.Object.extend({url:null,params:null,tokenParamKey:null,tokenCookieKey:null,downloadToken:function(){return CW.UUID()}.property().cacheable(),downloadStartCheckTimeout:3e5,start:function(){this._writeCookieAndBeginPolling(),this._startDownload()},_iframe:function(){var e=this.__iframe ;return e||(e=this.__iframe=document.createElement("iframe"),e.name=this.get("downloadToken")+"__iframe",e.style.display="none",e.src=this.get("_downloadURL")),e}.property(),_downloadURL:function(){var e=window.URI(this.get("url")),t=this.get("params");return t&&e.query(t),e.addQuery(this.get("tokenParamKey"),this.get("downloadToken")),e.toString()}.property("url","params","tokenParamKey","downloadToken"),_startDownload:function(){CloudOSBootstrap.isOnSupportedMobile?window.open(this.get("_downloadURL"),"_blank"):document.body.appendChild(this.get("_iframe"))},_writeCookieAndBeginPolling:function(){var e=".%{currentDomain}".fmt({currentDomain:CloudOS.authController.get("currentDomain")});CK.writeCookie(this.get("tokenCookieKey"),this.get("downloadToken"),null,e,1,YES),CloudOSBootstrap.isOnSupportedMobile||SC.Timer.schedule({target:this,action:"_checkDownloadStarted",interval:150,repeats:YES})},_checkDownloadStarted:function(e){if(!CK.readCookie(this.get("tokenCookieKey"))||Date.now()-e.get("startTime")>this.get("downloadStartCheckTimeout"))e.invalidate(),document.body.removeChild(this.get("_iframe")),this.__iframe=null}}),CloudOS.AdjustMaxWidthOnMobile={_windowWidth:null,initMixin:function(){if(CloudOSBootstrap.isOnSupportedMobile){var e=this._windowWidth?this._windowWidth:SC.RootResponder.responder.currentWindowSize.width,t=this.layout.maxWidth;t&&(t>e&&(this.layout.maxWidth=e),this.get("shouldAutoResize")&&(!this.maxWidth||this.maxWidth>e)&&this.set("maxWidth",e))}}},CloudOS.AdjustViewBasedOnIframe={iframe:null,distanceFromIframe:0,padding:function(){var e=SC.device.get("orientation" )===SC.LANDSCAPE_ORIENTATION;return e&&!SC.browser.isiPad?15:0},adjustPosition:function(){var e=this.getPath("iframe.frame");if(e){var t=this.get("distanceFromIframe");this.adjust("top",e.y+e.height+t+this.padding())}}.observes("*iframe.frame")},CW.Alert.reopen({init:function(e){e(),CloudOSBootstrap.isOnSupportedMobile&&(this.set("originalLayout",SC.clone(this.get("layout"))),this.updateLayoutOnOrientationChange())}.enhance(),minimumPaneMargin:10,updateLayoutOnOrientationChange:function(){if(CloudOSBootstrap.isOnSupportedMobile){var e=this.get("minimumPaneMargin"),t=Math.max(COS.MIN_WIDTH,window.innerWidth)-e*2,n=Math.max(COS.MIN_HEIGHT,window.innerHeight)-e*2;this.getPath("layout.width")>t?(this.set("isCompact",YES),this.adjust("centerY",0),this.adjust("width",t),this.adjust("maxHeight",n)):(this.set("isCompact",NO),this.set("layout",this.get("originalLayout")))}},windowSizeDidChange:function(){arguments.callee.base.apply(this,arguments),this.updateLayoutOnOrientationChange()}}),CloudOS.HorizontalCenterAlign={frameObserver:function(){var e=this.getPath("frame.width"),t=this.getPath("parentView.frame.width"),n=this.get("flowSpacing");if(e===0)return;n||(n={}),n.left=Math.round(t-e)/2,this.set("flowSpacing",n)}.observes("frame")},SC.RootResponder.reopen({focus:function(e){SC.debug("CloudOS window received focus event"),this.get("hasFocus")||(SC.$("body").addClass("sc-focus").removeClass("sc-blur"),SC.run(function(){this.set("hasFocus",YES)},this));if(CloudOS.shouldAppHaveFocus()){var t=CloudOS.appController.get("currentApp");t&&(SC.debug("Active app "+t.get("name")+" focusing" ),t.focus())}else CW.notificationCenter.postNotification("windowDidFocus");return YES},blur:function(e){return SC.debug("CloudOS window received blur event"),CW.notificationCenter.postNotification("windowDidBlur"),YES},mousemove:function(e,t){return window.CloudOS&&CloudOS.relayMouseMove(t.clientX,t.clientY),e(t)}.enhance(),click:function(e,t){var n=this.targetViewForEvent(t),r=t.target.href,i=r&&t.target.nodeName==="A"&&(r.indexOf(CloudOS.authController.get("currentDomain"))!==-1||r.indexOf(".apple.com")!==-1)&&t.target.target.indexOf("blank")!==-1,s=n&&n.click&&SC.typeOf(n.click)===SC.T_FUNCTION;return n&&n.isControl&&!n.get("ignoreVirtualCursor")&&(s?this.sendEvent("click",t,n):e(t)),n&&!n.isControl&&!i&&(t.preventDefault(),e(t)),n&&n.get("ignoreVirtualCursor")&&n.set("ignoreVirtualCursor",NO),YES}.enhance(),ignoreTouchHandle:function(e){if(SC.browser.isMobileSafari||SC.browser.android||SC.browser.silk){var t=this.targetViewForEvent(e),n=t&&t.click&&SC.typeOf(t.click)===SC.T_FUNCTION,r=t&&t.touchStart&&SC.typeOf(t.touchStart)===SC.T_FUNCTION;if(n||r)return NO;var i=e.target.tagName;return(i==="INPUT"||i==="A")&&e.allowDefault(),YES}return NO},mouseup:function(e,t){var n=this.targetViewForEvent(t);return n&&n.set("ignoreVirtualCursor",YES),e(t)}.enhance()}),CloudOS.moduleLocalizer={localizedModules:["cloudkit/first_run","cloudkit/error_catcher","cloudkit/photo","cloudkit/photo/photoPicker","coreweb/date_formatter","coreweb/timezone_picker","cloudos_foundation/springboard","cloudos_foundation/alarms","cloudos_foundation/language","cloudos_foundation/sharing"],_defaultLocale :String.preferredLanguage,_locale:"en-us",_previousLocale:null,setLocale:function(e){e||(CW.getUrlParameters().locale&&COS.get("localesSupportedByCloudOSOnly").indexOf(e)!==-1?e=String.preferredLanguage:e=CloudOS.authController.getPath("accountPreferences.localeForCloudOS"));if(this._locale===e||!e)return NO;this._previousLocale=this._locale,this._locale=e,String.preferredLanguage=e;var t=this._monkeyPatchModules();return this._replaceOldStyles(),SC.$(document.body).removeClass(this._defaultLocale).removeClass(this._previousLocale).addClass(this._locale),t},_monkeyPatchModules:function(){var e=SC.MODULE_INFO,t=this.localizedModules,n,r=t.length,i,s,o,u,a=NO;for(n=0;n0){var r=n[0];SC.LOG_MODULE_LOADING&&SC.debug("SC.Module: Removing old CSS file in '%@' -> '%@'",e,t),r.parentNode.removeChild (r)}},_replaceOldStyles:function(){var e=window.BUILD_INFO,t=e.styles,n=e.stylesDPIUsed;if(t){var r=0,i=n===2?t.x2:t.normal,s=document.getElementsByTagName("head")[0]||document.documentElement,o=this;o.pendingStylesToLoad=i.length;for(var u=0;u0){var h=l[0];c=document.createElement("link"),c.setAttribute("href",f),c.setAttribute("rel","stylesheet"),c.setAttribute("type","text/css"),c.setAttribute("oldStyle",a),c.onload=function(){var e=this.getAttribute("oldStyle"),t=this.getAttribute("href"),n=$('link[href$="%@"]'.fmt(e));o._updatePendingStylesToLoad(),n.length>0&&(SC.debug("Removing old link tag with href = '%@'.",e),s.removeChild(n[0]))},s.appendChild(c),SC.debug("Adding new link tag with href = '%@'.",f),i[u]=f}c.onerror=function(){o._updatePendingStylesToLoad(),CW.fatalError("Unable to load link tag with href = '%@'.",this.getAttribute("href"))}}}},_updatePendingStylesToLoad:function(){--this.pendingStylesToLoad,this.pendingStylesToLoad===0&&SC.Locale.createCurrentLocale()}},CloudOS.blockInputModalPane=SC.Page.design({modalPane:SC.Pane.design({layout:{zIndex:1e3},childViews:"feedback".w(),shouldShowFeedback:NO,shouldShowFeedbackBinding:"CloudOS.blockInputController.shouldShowFeedback",shouldShowFeedbackDidChange:function(){var e=this.get("shouldShowFeedback"),t=this.get("feedback"),n=e?250:0;t.animate({opacity:e?1:0,duration:n}),t.set("isVisible",e)}.observes("shouldShowFeedback"),feedback:SC.View.design(CW.Animatability,{layout:{opacity:0},isVisible:NO,classNames:"block-input-feedback" ,childViews:"spinner".w(),spinner:CW.SpinnerView.design({asset:CloudOS.SPINNER_IMAGE_SRC,assetIsAlways2x:YES,layout:{centerX:0,centerY:0}})})})}),CloudOS.WaitingForAppState=SC.State.extend({succeededState:"active.application",disabledState:"active.desiredAppDisabled",failedState:"active.appLoadFailure",abortedState:"active.springboard",shouldForceDelegateMethods:NO,enterState:function(){var e=CloudOS.appController,t=e.get("loadingApp"),n=e.get("pendingApp"),r=n.get("name"),i=this;this._app=n;if(n&&t===n){SC.info("We are already waiting for %@ to load",n.get("name"));return}t&&e.loadingApp.teardown();if(n&&n.requiresMailAndIsMissing()){CW.Alert.show({message:"Error.MailNotEnabled.%@.Title".fmt(r).loc(),description:"Error.MailNotEnabled.%@.Description".fmt(r).loc(),rightButton:{title:"Button.OK".loc(),action:function(){this.get("pane").remove(),i.gotoState(i.get("abortedState")),e.set("pendingApp",null)}}});return}if(!n||n.get("isDisabled")){this.gotoState(this.get("disabledState"));return}if(n.get("isFailed")){this.applicationDidFailToBecomeReady();return}COS.statsController.beginStat("cloudos","LoadApplication",{appName:r,previouslyLoaded:n.get("isReady")});var s=function(){CW.notificationCenter.unsubscribeFromNotification("didFetchRegionFormattingSettings",null,this),CW.notificationCenter.unsubscribeFromNotification("receivedInfoForAllDynamicApps",null,this),n.get("isReady")?i.applicationDidBecomeReady(!0):(e.set("loadingApp",n),n.invokeLast("getReady"))},o=!!COS.regionController.regionFormattingRules;r==="settings"&&!e.get("isAllAppInfoLoaded")&&o?(n.set("isWaiting",YES),CW .notificationCenter.subscribeToNotification("receivedInfoForAllDynamicApps",null,s)):o||CloudOS.authController.get("isPartiallyAuthenticated")&&!n.get("isLocked")?s():CW.notificationCenter.subscribeToNotification("didFetchRegionFormattingSettings",null,s)},abortLoad:function(){CloudOS.appController.get("loadingApp")&&CloudOS.appController.loadingApp.teardown(),this.gotoState(this.get("abortedState"))},exitState:function(){COS.statsController.cancelStat("cloudos","LoadApplication")},applicationDidFailToBecomeReady:function(){var e=CloudOS.appController;COS.statsController.cancelStat("cloudos","LoadApplication"),CW.notificationCenter.postNotification("App Loaded",this._app.get("name"),NO),this.gotoState(this.get("failedState")),e.set("loadingApp",null)},applicationDidBecomeReady:function(e){var t=CloudOS.appController,n=this._app,r=n.get("name"),i=n.get("canLaunchWithOneFactor"),s=CloudOS.authController,o=s.get("isPartiallyAuthenticated"),u=s.get("hsaEnabled"),a={loadReason:n.get("loadReason")||0,appBuildNumber:n.get("buildNumber")||"unknown",appMasteringNumber:n.get("masteringNumber")||"unknown",appName:n.get("name"),accountLocale:String.preferredLanguage,browserLocale:(navigator.language||navigator.browserLanguage).toLowerCase()};return u&&o&&(a.hsaVersion=CloudOS.authController.getPath("user.hsaVersion"),a.loadedAfterOneFactorAuthentication=YES),COS.statsController.endStat("cloudos","LoadApplication",a,{durationKeyName:"loadDuration",includeLocationAndLocale:YES}),t.set("loadingApp",null),t.set("pendingApp",null),t.beginPropertyChanges(),t.deactivateCurrentApp(),t.set("currentApp" ,this._app),t.endPropertyChanges(),i&&o&&n.set("notificationId",null),CW.notificationCenter.postNotification("App Loaded",r,YES),CloudOS.authPane&&CloudOS.authPane.hide(),t.activateCurrentApp(this.get("shouldForceDelegateMethods")),this.gotoState(this.get("succeededState"))},gotoState:function(){return this._gotoStateTimer&&this._gotoStateTimer.invalidate(),this._gotoStateTimer=null,arguments.callee.base.apply(this,arguments)},appMustExit:function(e){var t=this._app,n=e.statusCode,r=e.applicationLog;if(n===CK.EXIT_NON_FATAL){this.gotoState(this.get("abortedState")),t.teardown();return}if(t&&t.get("loadInBackground")){SC.info("Not showing error dialog since app would load in background"),t.teardown();return}var i=t.get("name"),s=t.get("displayName"),o,u;CloudOS.authController.validateUserIfNeeded();if(n===CK.EXIT_PCS_MISSING||n===CK.EXIT_PCS_INVALID){o="Error.AppPCSRequired.Title".loc(s),u="Error.AppPCSRequired.Description".loc();var a=n===CK.EXIT_PCS_MISSING?"Missing PCS":"Invalid PCS";CloudOS.recordStat("PCS Error: "+a)}else n===CK.EXIT_STARTUP_ERROR?(o="Error.AppNotLoading.Title".loc(s),u="Error.AppNotLoading.Description".loc()):(o="Error.AppCrashed.Title".loc(s),u="Error.AppCrashed.Description".loc());this.gotoState(this.get("abortedState")),CW.Alert.show({message:o,description:u,middleButton:{title:"Error.Button.Report".loc(),action:function(){this.getPath("pane.modalPane").set("paneFadeOutDuration",0),this.get("pane").remove(),CloudOS.appController.showErrorReporter(t,r),t.teardown()}},rightButton:{title:"Button.OK".loc(),action:function(){this.getPath("pane.modalPane") .set("hideDelay",10),this.get("pane").remove(),t.teardown()}}}),CloudOS.appController.set("loadingApp",null),COS.statsController.recordStat("cloudos","AppMustExitWaitingForApp",{appName:i,statusCode:n})},showServiceLocked:function(e){var t=CloudOS.appController.get("loadingApp"),n=COS.appsController.getAppInfoFor(t.get("name")),r=e.serviceName;if(!r||n.isServiceRequired(r))e.appToDisable=t,this.gotoState("serviceLocked",e)},init:function(){var e="appCalledShowAppSwitcher appCalledSwitchToApplication appMustReload appMustExit appMustExitSilently".w(),t,n,r;for(n=0;t=e[n];n++)r=function(){var e=arguments.callee.state._app;if(!e)return;e.set("preDisplayAction",arguments.callee.actionName),e.set("preDisplayActionArgs",SC.$A(arguments))},r.actionName=t,r.state=this,this[t]||(this[t]=r);arguments.callee.base.apply(this,arguments)}}),CloudOS.WaitingForDefaultAppState=CloudOS.WaitingForAppState.extend({disabledState:"active.allAppsDisabled"}),CloudOS.ApplicationState=SC.State.extend({initialSubstate:"displayingCurrentApp",isReentering:NO,enterState:function(){CW.notificationCenter.postNotification("springboardMayProceed"),CloudOS.workspaceController.hideCentralSpinner(null,!0),CloudOS.workspaceController.set("nowShowing",CloudOS.APP)},displayingCurrentApp:SC.State.design({enterState:function(){this.get("parentState").set("isReentering",NO);var e=CloudOS.appController.get("currentApp");if(!e){SC.info("currentApp is not set! Return to springboard."),this.gotoState("active.springboard");return}var t=e.get("preDisplayAction"),n=e.get("preDisplayActionArgs");e.set("preDisplayAction",undefined ),e.set("preDisplayActionArgs",undefined),t&&this[t].apply(this,n),e.focus(),CloudOS.bannerManager.selectBannerAndShow(),CloudOS._executeReadyQueue()},appCalledShowAppSwitcher:function(e){e||(this.invokeLater(function(){CloudOS.autoUpdateController.checkVersion()},1e3),e={x:8,y:8,width:37,height:29},e.left=e.x,e.top=e.y),this.gotoState("showingSpringboardMini",e)},appCalledShowSpringBoard:function(){this.gotoState("active.springboard")},appCalledSwitchToApplication:function(){this.gotoState("active.application.waitingForNewApp")},globalAppSwitchWasRequested:function(){if(CloudOS.appController.get("currentApp")===CloudOS.appController.get("pendingApp")){SC.info("The new app is same as the current app and it is already loaded.");return}this.gotoState("active.application.waitingForNewApp")},appMustReload:function(e){this.gotoState("active.springboard",e)},appMustExit:function(e){var t=e.statusCode,n=e.applicationLog,r=e.appToLoadAfterAuthentication;if(this._exitPane&&this._exitPane.get("isVisibleInWindow")){SC.warn("There is already an app exit alert pane showing, so ignoring request for a second one.");return}var i=CloudOS.authController,s=CloudOS.appController,o=s.get("currentApp"),u=s.get("pendingApp"),a=CloudOS.statechart;if(t===CK.EXIT_NON_FATAL){r?i.get("isPartiallyAuthenticated")?(o.teardown(),s.set("pendingApp",r),a.sendAction("showHSA",CloudOS.HSASourceEnum.USER_SELECTED_APP)):i.get("isAuthenticated")&&o!==r&&(o.teardown(),a.sendAction("userDidChooseApp")):(this.gotoState("active.springboard"),o.teardown());return}if(o&&o.get("loadInBackground")){SC.info("Not showing error dialog since app would load in background" ),o.teardown();return}var f=o.get("name"),l=this,c=o.get("displayName"),h,p;i.validateUserIfNeeded();if(t===CK.EXIT_PCS_MISSING||t===CK.EXIT_PCS_INVALID){h="Error.AppPCSRequired.Title".loc(c),p="Error.AppPCSRequired.Description".loc();var d=t===CK.EXIT_PCS_MISSING?"Missing PCS":"Invalid PCS";CloudOS.recordStat("PCS Error: "+d)}else t===CK.EXIT_STARTUP_ERROR?(h="Error.AppNotLoading.Title".loc(c),p="Error.AppNotLoading.Description".loc()):(h="Error.AppCrashed.Title".loc(c),p="Error.AppCrashed.Description".loc());this._exitPane=CW.Alert.show({message:h,description:p,middleButton:{title:"Error.Button.Report".loc(),action:function(){this.getPath("pane.modalPane").set("paneFadeOutDuration",0),this.get("pane").remove(),CloudOS.appController.showErrorReporter(o,n)}},rightButton:{title:"Button.OK".loc(c),action:function(){this.getPath("pane.modalPane").set("hideDelay",10),this.get("pane").remove(),l.gotoState("active.springboard"),o.teardown()}}}),COS.statsController.recordStat("cloudos","AppMustExitDisplayingCurrentApp",{appName:f,statusCode:t})},appMustExitSilently:function(){this.gotoState("active.springboard")},showServiceLocked:function(e){var t=CloudOS.appController.get("currentApp"),n=COS.appsController.getAppInfoFor(t.get("name")),r=e.serviceName;if(!r||n.isServiceRequired(r))e.appToDisable=t,this.gotoState("serviceLocked",e)},showAccountSettings:function(){CloudOS.openApp("settings")},appSelected:function(){var e=CloudOS.appController.get("pendingApp");e?(e.set("loadInBackground",NO),CloudOS.statechart.sendAction("globalAppSwitchWasRequested")):this.gotoState("active.springboard" )}.handleEvents("userDidChooseApp","globalAppSwitchWasRequested")}),showingSpringboardMini:SC.State.design({initialSubstate:"waitingForSpringBoardModule",enterState:function(e){var t=CloudOS.authController.get("delayedTearDownApp");t&&(t.teardown(),CloudOS.authController.set("delayedTearDownApp",null)),SC.Module.loadModule("cloudos_foundation/springboard",this,function(){this.gotoState("springBoardDidLoad",e)})},exitState:function(){CloudOS.authController.get("isValidatingHsa")||(CloudOS.appSwitcherController.hideAppSwitcher(),CloudOS.notifyRemovalOfDialogAboveApp())},waitingForSpringBoardModule:SC.State.design(),springBoardDidLoad:SC.State.design({enterState:function(e){var t;CloudOS.configureSpringboard(),CloudOS.notifyDialogAboveApp(),CloudOS.focus(),CloudOS.authController.get("isValidatingHsa")&&(e=CloudOS.appSwitcherController.getPath("pane.pointAtRectangle")),CloudOS.appSwitcherController.showAppSwitcher(e),this.gotoState("normal")}}),normal:SC.State.design({didDismiss:function(){this.gotoState("active.application.displayingCurrentApp")},appSelected:function(){var e=CloudOS.appController.get("pendingApp");e?(e.set("loadInBackground",NO),this.gotoState("active.application.showingSpringboardMini.waitingForApp")):this.gotoState("active.springboard")}.handleEvents("userDidChooseApp","globalAppSwitchWasRequested"),userDidBeginAnimatingHome:function(){this.gotoState("animatingHome")}}),waitingForApp:CloudOS.WaitingForAppState.design({shouldForceDelegateMethods:YES,abortedState:"active.application.displayingCurrentApp",userDidChooseApp:function(){var e=CloudOS.appController.get ("pendingApp");e?(e.set("loadInBackground",NO),this.gotoState("active.application.showingSpringboardMini.waitingForApp")):this.gotoState("active.springboard")},appCalledSwitchToApplication:function(){this.gotoState("active.application.showingSpringboardMini.waitingForApp")},globalAppSwitchWasRequested:function(){if(CloudOS.appController.get("pendingApp")===this._app){SC.info("Already waiting for app to load");return}this.gotoState("active.application.showingSpringboardMini.waitingForApp")},didDismiss:function(){this.abortLoad(),CloudOS.appController.set("pendingApp",null),CloudOS.appController.set("loadingApp",null),this.getPath("parentState.parentState").set("isReentering",YES)},userDidBeginAnimatingHome:function(){this.abortLoad(),CloudOS.appController.set("pendingApp",null),CloudOS.appController.set("loadingApp",null),this.gotoState("animatingHome")},exitState:function(){arguments.callee.base.apply(this,arguments),this.getPath("parentState.parentState").set("isReentering",YES)}}),animatingHome:SC.State.design({appSwitcherFinishedHiding:function(){CloudOS.authController.get("isPartiallyAuthenticated")?this.gotoState("active.authUI.hsa"):this.gotoState("active.springboard")}})}),waitingForNewApp:CloudOS.WaitingForAppState.design({shouldForceDelegateMethods:YES,enterState:function(){arguments.callee.base.apply(this,arguments),CloudOS.blockUserInput(0)},appCalledSwitchToApplication:function(){this.gotoState("active.application.waitingForNewApp")},globalAppSwitchWasRequested:function(){if(CloudOS.appController.get("pendingApp")===this._app){SC.info("Already waiting for app to load" );return}this.gotoState("active.application.waitingForNewApp")},appCalledShowAppSwitcher:function(){this.gotoState("active.springboard")},appCalledShowSpringBoard:function(){this.gotoState("active.springboard")},exitState:function(){arguments.callee.base.apply(this,arguments),this.get("parentState").set("isReentering",YES),CloudOS.unblockUserInput()}}),serviceLocked:SC.State.plugin("CloudOS.ServiceLockedState"),exitState:function(){var e=CloudOS.authController,t=CloudOS.appController,n=t.get("currentApp"),r=t.get("pendingApp"),i=n&&n.get("canLaunchWithOneFactor");!this.get("isReentering")&&!CloudOS.get("isCloudOSMini")&&(!i||!e.get("isValidatingHsa"))&&t.deactivateCurrentApp(),CloudOS.focus()}}),CloudOS.SharingState=SC.State.extend({initialSubstate:"setupShareController",waitingForAppState:CloudOS.WaitingForDefaultAppState.design({enterState:function(){CloudOS.workspaceController.showCentralSpinner(),arguments.callee.base.apply(this,arguments)},exitState:function(){window.Sharing&&Sharing.sharingPane?Sharing.removePane(YES):CloudOS.workspaceController.hideCentralSpinner()}}),showAccountSettings:function(){Sharing.sharingPane.showSpinner(),CloudOS.openApp("settings")},globalAppSwitchWasRequested:function(){this.gotoState("waitingForAppState")},enterState:function(){CW.notificationCenter.postNotification("springboardMayProceed")},setupShareController:SC.State.design({enterState:function(e){var t=CloudOS.shareController&&CloudOS.shareController.get("isPublicShare");e?CloudOS.setupShareController(e):this.gotoState("downloadingSharingModule")},downloadSharingModule:function(){this .gotoState("downloadingSharingModule")}.handleEvents("retrieveShareSucceeded","retrieveShareFailed","showPublicAcceptance","showAlreadyAcceptedState"),completedShareControllerSetup:function(){this.gotoState("downloadingSharingModule")},appIsUnsupportedOnMobile:function(){this.gotoState("downloadingSharingModule")}}),downloadingSharingModule:SC.State.design({enterState:function(){SC.Module.loadModule("cloudos_foundation/sharing",this,"moduleDidBecomeReady")},moduleDidBecomeReady:function(e,t){this.gotoState("displayingSharingUI")}}),displayingSharingUI:SC.State.design({enterState:function(){var e=CloudOS.shareController,t=e.get("shortGUID"),n=e.get("vettingToken"),r=e.get("isVettingTokenVetted"),i=e.get("isShareThirdParty"),s=e.get("isGameCenterShare"),o=e.get("isPublicShare"),u=CloudOS.authController.getPath("user.appleId"),a=CloudOS.isUserAuthenticated(),f=o&&a&&e.get("didShowAcceptUIPreLogin");CloudOS.workspaceController.set("nowShowing",CloudOS.SHARING),t?Sharing.showPane(t,u,i,s,o,f):n?Sharing.acceptVettingToken(n,r):CW.fatalError("Wrong State as there is no vettingToken or shortGUID")},sharingCancelled:function(){var e=CloudOS.isUserAuthenticated();if(CloudOS.shareController.get("isPublicShare")&&!e)return NO;CloudOSBootstrap.isOnSupportedMobile?CK.reloadWithReason("Sharing: Cancelled","/"):e&&this.gotoState("active.springboard")}}),exitState:function(){window.Sharing&&Sharing.sharingPane&&Sharing.removePane(YES),CloudOS.shareController.resetProperties()}}),CloudOS.TermsAndConditionConfirmationState=SC.State.extend({enterState:function(){var e=CloudOS.TermsAndConditionsAcceptanceConfirmationPane .create();CloudOS.authController.set("termsAndConditionsAcceptanceConfirmationPane",e),CloudOS.workspaceController.hideCentralSpinner(function(){e.append()}.bind(this))},signOut:function(){CloudOS.workspaceController.showCentralSpinner(function(){CloudOS.authController.logoutUser(function(){CloudOS.workspaceController.clearHash(),CK.reloadWithReason("User accepted Terms and Conditions")},YES)}.bind(this))}}),CloudOS.statechart=SC.Statechart.create({trace:YES,monitorIsActive:NO,name:"cloudos-statechart",rootState:SC.State.design({initialSubstate:"loading",resendLoginOrValidateRequest:function(e){SC.debug("sending validate request again.");var t=CloudOS.authController;t.validateUser(t.validatePreferences,e)},loading:SC.State.design({enterState:function(){var e=function(){return CK.writeCookie("COS_BOOTSTRAP_COOKIE_TEST","1"),CK.readCookie("COS_BOOTSTRAP_COOKIE_TEST")==="1"};CloudOS.workspaceController.set("nowShowing",CloudOS.PREAUTH),!navigator.cookieEnabled&&!e()?this.gotoState("cookiesDisabled"):COS.authController.get("isLoadedFromSiteURL")?!CK.getValueFromSessionStorage("userIgnoredBrowserWarning")&&!CloudOSBootstrap.isBrowserVersionAtLeast({safari:7,firefox:21,chrome:35,ie:11,edge:12,otherwise:!1})&&!CloudOS.get("isCloudOSMini")&&!CloudOSBootstrap.didLoadWithShareURL&&!CloudOSBootstrap.willLoadMobileSupportedApp&&!CloudOSBootstrap.isTermsAndConditionUrl&&!CloudOSBootstrap.hasPostLoginRedirectUrl?this.gotoState("browserWarning"):COS.checkBodyFontsAvailability(this,this.postFontCheckSetup):this.gotoState("isNotLoadedFromSiteURL")},postFontCheckSetup:function(){if(CloudOS.hasOpenerWithCloudOS&& CloudOS.hasOpenerWithCloudOS()){var e=CloudOS.getOpenerWithCloudOS(),t=!!CK.readCookie("X-APPLE-WEB-ID");t?this.gotoState("setupCloudOSWithOpener"):this.gotoState("validatingAuth")}else this.gotoState("validatingAuth")}}),cookiesDisabled:SC.State.design({enterState:function(){window.location="/enable_cookies/"}}),isNotLoadedFromSiteURL:SC.State.design({enterState:function(){window.location="https://www.icloud.com"}}),browserWarning:SC.State.design({enterState:function(){CloudOS.workspaceController.hideCentralSpinner(function(){CW.Alert.show({message:"Error.UnsupportedBrowser.Title".loc(),description:"Error.UnsupportedBrowser.Description".loc(),middleButton:{title:"Error.UnsupportedBrowser.Ignore".loc(),action:function(){this.get("pane").remove(),CK.setValueInSessionStorage("userIgnoredBrowserWarning",YES),CloudOS.statechart.gotoState("validatingAuth")}},rightButton:{title:"Error.UnsupportedBrowser.LearnMore".loc(),action:function(){this.get("pane").remove(),window.open("Error.UnsupportedBrowser.LearnMore.URL".loc()),CloudOS.statechart.gotoState("validatingAuth")}}})}.bind(this))}}),setupCloudOSWithOpener:SC.State.design({enterState:function(){var e=CloudOS.authController,t=CloudOS.hasOpenerWithCloudOS();if(t){var n=CloudOS.getOpenerWithCloudOS().CloudOS,r=n.userIsAuthenticated?n.userIsAuthenticated():NO;if(r&&n.getUser){var i=n.getUser()._auth_bag,s=i.hsaChallengeRequired,o=CloudOS.appController,u=o.getDefaultApp(),a=o.getDefaultAppName(),f=this;if(s){this.gotoState("validatingAuth");return}var l=function(){i?(e.saveAuthBag(i),e._authCompleted(i,e.validatePreferences,YES,null )&&(e.invokeDelegateMethod(e.get("delegate"),"loginDidSucceed",i),e.monitorForUsernameChange())):(SC.warn("No authbag in opener cloudos. Re validating Auth"),f.gotoState("validatingAuth"))};a&&!u?CW.notificationCenter.subscribeToNotification("receivedInfoForDynamicApp",this,function(e,t){var n=CloudOS.appController,r;if(e!==n.getDefaultAppName())return;t?l():(r=n.getDefaultApp(),r.set("loadReason",CK.LOAD_REASON_LOCATION_HASH),CloudOS.appController.set("pendingApp",r),l())}):l()}else SC.warn("Opener window is either not a CloudOS window or the user is not authenticated in the Opener window."),this.gotoState("validatingAuth")}},authDidValidate:function(){COS.authUIController.userDidAuthenticate()},showFirstRun:function(){this.gotoState("active.authUI.loadFirstRun")},goToSharingState:function(e){this.gotoState("active.sharingState",e)}}),validatingAuth:SC.State.design({initialSubstate:"gettingReply",enterState:function(e){e&&!!e.showOnlyLiteApps&&CloudOS.authController.set("iCloudLiteSignUp",YES)},goToSharingState:function(e){this.gotoState("active.sharingState",e)},goToVettingState:function(e){this.gotoState("active.vettingState",e)},gettingReply:SC.State.design({initialSubstate:"parsingReply",parsingReply:SC.State.design({enterState:function(e){e=e||{};var t=e.successCallback;this._successCallback=typeof t=="function"?t:SC.K;var n=e.failureCallback;this._failureCallback=typeof n=="function"?n:SC.K;var r=window.location.hash,i=CloudOS.authController;if(r==="#:showlogin"){window.location.hash="",CloudOS.authController.logoutUser(function(){CK.reloadWithReason("Need to show the Login Screen" )},YES);return}r=r.length>1?r.substr(1):null;if(r){var s=URI.parseQuery(r),o=s.postLoginRedirectUrl;try{o=atob(s.postLoginRedirectUrl)}catch(u){SC.Logger.info("Non-base64 postLoginRedirectUrl was specified")}var a=s.hideRememberMe;a&&JSON.parse(a)===!0&&CloudOS.authController.set("hideRememberMe",YES);var f=r.match(/(signup)\?origin=(.*)/),l,c=YES,h,p;f&&f.length===3?(h=f[1],p=f[2]):(h=s.signup,p=s.origin),h!==undefined&&(i.set("showSignup",YES),p&&i.set("signupOriginApp",p));if(o){var d=o.match(/(.*)\?origin=(.*)/);d&&d.length===3&&(o=d[1],p=d[2],i.set("signupOriginApp",p)),o=URI.decode(o),i.set("postLoginRedirectUrl",o);for(l in s){if(["postLoginRedirectUrl","signup","origin","terms","hideRememberMe"].indexOf(l)!==-1)continue;s.hasOwnProperty(l)&&(c=NO)}c&&(window.location.hash="")}}SC.Benchmark.start("AUTH_DURATION"),i.statechart=CloudOS.statechart,i.validateUser(i.validatePreferences)},authDidValidate:function(){var e=CloudOS.authController,t=e.get("isAuthenticated");this._successCallback();if(e.shouldUsePostLoginRedirectUrl())return;t&&CloudOS.moduleLocalizer.setLocale(),SC.Module.loadModule("cloudos_foundation/language",this,"languageDidLoad"),e.reportAuthSuccess("validate"),COS.statsController.beginStat("cloudos","Session")},languageDidLoad:function(){CloudOS.localizationController.relocalizeIfNeeded("Signin Submission Succeeded and Language Loaded"),CloudOS.appController.get("areAllAppReplacementsCompleted")?this.checkIfDefaultAppIsCreated():CW.notificationCenter.subscribeToNotification("appReplacementsCompleted",this,"checkIfDefaultAppIsCreated")},checkIfDefaultAppIsCreated :function(){var e=CloudOS.appController,t=e.getDefaultAppName(),n=e.getDefaultApp(),r=e.getPath("pendingInfoJSONRequests."+t);this.invokeLast(function(){CW.notificationCenter.unsubscribeFromNotification("appReplacementsCompleted",this,"checkIfDefaultAppIsCreated")}),!n&&t&&COS.apps[t]&&r?CW.notificationCenter.subscribeToNotification("receivedInfoForDynamicApp",this,function(e,n){if(t!==e)return;this.redirectToState()}):this.redirectToState()},redirectToState:function(){var e=CloudOS.appController,t=CloudOS.getShareDetailsFromUrl(),n=e.getDefaultAppName(),r=e.getDefaultApp(),i=e.get("pendingApp"),s=CloudOS.authController,o=this.statechart,u=this,a=s.get("isPartiallyAuthenticated"),f=s.get("hsaChallengeRequired"),l=s.shouldUsePostLoginRedirectUrl(),c=function(e){e.get("isPCSKeysDeletedLocked")?u.gotoState("active.springboard"):(e.set("loadReason",CK.LOAD_REASON_LOCATION_HASH),CloudOS.appController.set("pendingApp",e),u.gotoState("validatingAuth.waitingForApp"))};a?(!i&&r&&e.set("pendingApp",r),!r||r.get("isLocked")?o.sendEvent("showHSA"):o.gotoState("active.authUI.waitingForApp")):s.get("isPartiallyAuthenticatedForManagedAppleId")?o.sendEvent("gotoManagedAppleId"):CloudOSBootstrap.isTermsAndConditionUrl&&!l?o.sendEvent("gotoShowTermsAndConditionConfirmation"):CloudOS.get("isCloudOSMini")&&r?c(r):t?CloudOS.handleShareDetails(t):!r||window.location.hash==="#springboard"?this.gotoState("active.springboard"):c(r),s.get("isAuthenticated")&&CloudOS.loadAlarms()},showHSA:function(){this.gotoState("active.authUI.hsa")},gotoPreAuthSharingOrAuthUIState:function(e){var t=CloudOS.getShareDetailsFromUrl (),n=t&&t.longGUID;t&&!n?this.gotoState("preAuthSharingState"):this.gotoState("active.authUI")},authDidNotValidate:function(){var e=CloudOS.get("isCloudOSMini"),t=CloudOS.appController.getDefaultApp();e&&!t?CW.notificationCenter.subscribeToNotification("receivedInfoForDynamicApp",this,function(e,t){var n=CloudOS.appController,r;if(e!==n.getDefaultAppName())return;t?(CloudOS.authController.reportAuthError("validate","authDidNotValidate"),this._failureCallback(),this.gotoPreAuthSharingOrAuthUIState()):SC.Module.loadModule("cloudos_foundation/language",this,"languageDidLoad")}):e&&t?SC.Module.loadModule("cloudos_foundation/language",this,"languageDidLoad"):(CloudOS.authController.reportAuthError("validate","authDidNotValidate"),this._failureCallback(),this.gotoPreAuthSharingOrAuthUIState())},authDidNotValidateLocked:function(){CloudOS.authController.reportAuthError("validate","authDidNotValidateLocked"),this._failureCallback(),this.gotoPreAuthSharingOrAuthUIState()},authDidNotValidateSupportLocked:function(){CloudOS.authController.reportAuthError("validate","authDidNotValidateSupportLocked"),this._failureCallback(),this.gotoPreAuthSharingOrAuthUIState()},authDidNotValidateNotICloudUser:function(){CloudOS.authController.reportAuthError("validate","authDidNotValidateNotICloudUser"),this._failureCallback(),this.gotoPreAuthSharingOrAuthUIState()},authDidNotValidateNotVerified:function(){CloudOS.authController.reportAuthError("validate","authDidNotValidateNotVerified"),this._failureCallback(),this.gotoPreAuthSharingOrAuthUIState()},authDidNotValidateAccountClosed:function(){CloudOS. authController.reportAuthError("validate","authDidNotValidateAccountClosed"),this._failureCallback(),this.gotoPreAuthSharingOrAuthUIState()},authDidNotValidateExpiredPassword:function(){CloudOS.authController.reportAuthError("validate","authDidNotValidateExpiredPassword"),this._failureCallback(),this.gotoPreAuthSharingOrAuthUIState()},authDidNotValidateOffline:function(){CloudOS.authController.reportAuthError("validate","authDidNotValidateOffline"),this._failureCallback(),this.gotoPreAuthSharingOrAuthUIState()},authDidNotConnect:function(e){e?e="authDidNotConnect-"+e:e="authDidNotConnect",CloudOS.authController.reportAuthError("validate",e),this._failureCallback(),this.gotoState("validateFailureWithoutUsableData",e)},authDRLocked:function(){CloudOS.authController.reportAuthError("validate","authDRLocked"),this._failureCallback(),this.gotoPreAuthSharingOrAuthUIState()},authPartitionLocked:function(){CloudOS.authController.reportAuthError("validate","authPartitionLocked"),this._failureCallback(),this.gotoPreAuthSharingOrAuthUIState()},incompleteHSAFlow:function(){CloudOS.authController.logoutUser(function(){CK.reloadWithReason("Incomplete HSA flow. Need to start afresh.")},YES)},showFirstRun:function(){this.gotoState("active.authUI.loadFirstRun"),this._successCallback()},showHSA:function(){this.gotoState("active.authUI.hsa")},gotoManagedAppleId:function(){this.gotoState("active.authUI.managedAppleId")},resendGetPrefsRequest:function(){SC.debug("sending get preferences request again."),COS.prefsController.getPreferences(null,COS.authController.validatePreferences)},gotoShowTermsAndConditionConfirmation :function(){this.gotoState("active.termsAndConditionConfirmation")}}),validateFailureWithoutUsableData:SC.State.design({enterState:function(e){e||(e="No usable info in the validate call response."),CloudOS.UnableToProceedAlert.show({failureReason:e})}})}),waitingForApp:CloudOS.WaitingForDefaultAppState.design({}),gotoWaitingForAppState:function(){this.gotoState("validatingAuth.waitingForApp")},exitState:function(){CloudOS.authController.set("iCloudLiteSignUp",NO)}}),preAuthSharingState:SC.State.design({initialSubstate:"defaultState",defaultState:SC.State.design({enterState:function(){var e=CloudOS.getShareDetailsFromUrl();CloudOS.setupShareController(e),CloudOS.workspaceController.showCentralSpinner(function(){CloudOS.appleAuthWidgetController&&(CloudOS.appleAuthWidgetController.destroy(),CloudOS.appleAuthWidgetController=null)}.bind(this))},retrieveShareSucceeded:function(e){e?this.gotoState("thirdPartySharingState"):this.gotoState("active.authUI")},completedShareControllerSetup:function(){this.gotoState("active.authUI")},retrieveShareFailed:function(){CloudOSBootstrap.isOnSupportedMobile&&CK.reloadWithReason("Sharing: Invalid Share","/"),this.gotoState("active.authUI")},showPublicAcceptance:function(){this.gotoState("publicSharingState")},appIsUnsupportedOnMobile:function(){this.gotoState("active.sharingState")}}),publicSharingState:CloudOS.SharingState.design({sharingCancelled:function(){CloudOS.workspaceController.showCentralSpinner(function(){this.gotoState("active.authUI")}.bind(this))},exitState:function(){window.Sharing&&Sharing.sharingPane&&Sharing.removePane(YES),CloudOS .getShareDetailsFromUrl()?CloudOS.shareController.set("didShowAcceptUIPreLogin",YES):CloudOS.shareController.resetProperties()}}),thirdPartySharingState:CloudOS.SharingState.design()}),active:SC.State.design({initialSubstate:"authUI",authUI:COS.AuthUIState.design({waitingForApp:CloudOS.WaitingForDefaultAppState.extend({exitState:function(){var e=CloudOS.get("authPane");e&&e.hide()}})}),sharingState:CloudOS.SharingState.design(),vettingState:CloudOS.SharingState.design(),application:SC.State.plugin("CloudOS.ApplicationState"),springboard:SC.State.plugin("CloudOS.SpringboardState"),termsAndConditionConfirmation:SC.State.plugin("CloudOS.TermsAndConditionConfirmationState"),goToSharingState:function(e){CloudOS.getUser()?CloudOS.statechart.stateIsEntered("sharingState")||this.gotoState("sharingState",e):this.gotoState("preAuthSharingState")},appIsUnsupportedOnMobile:function(){this.gotoState("active.sharingState")},goToVettingState:function(e){CloudOS.getUser()?CloudOS.statechart.stateIsEntered("vettingState")||this.gotoState("vettingState",e):this.gotoState("preAuthSharingState")},showHelp:function(){CloudOS.showHelp()},showHSA:function(){this.gotoState("hsa")},showPCSDeletedMessage:function(e){CloudOS.authController.showPCSDeletedErrorMessage(e)},allAppsDisabled:SC.State.design({enterState:function(){this.gotoState("active.springboard")}}),desiredAppDisabled:SC.State.design({enterState:function(){var e=CloudOS.appController.get("pendingApp");if(e){var t=e.get("displayName");if(e.get("isUnqualified")){var n=e.get("name")==="mail"?"Error.AppUnqualified.Description.mail".loc():"Error.AppUnqualified.Description.others" .loc(t);CW.Alert.show({message:"Error.AppUnqualified.Title".loc(t),description:n,rightButton:"Button.OK".loc()})}}this.gotoState("active.springboard")}}),appLoadFailure:SC.State.design({enterState:function(){var e=CloudOS.authController,t=CloudOS.appController,n=t.get("pendingApp"),r=n.get("name"),i=n.get("displayName"),s,o;e.get("hsaChallengeRequired")?this.gotoState("active.authUI.hsa"):this.gotoState("active.springboard"),e.validateUserIfNeeded(),n.set("isWaiting",NO);var u=n.get("postDisplayAction");n.set("postDisplayAction",undefined),u&&u.apply(this);if(n.get("loadInBackground")){SC.info("Not showing error dialog since app would load in background"),n.teardown();return}if(n.get("isIntermediateFailedToLoad")){n.set("isIntermediateFailedToLoad",NO),n.teardown(),t.set("pendingApp",null);return}var a="Error.AppNotLoading.Title".loc(i);CW.stringIsCJK(i)&&(a=a.replace(/ /g,""));var f=this,l;CloudOS.get("isCloudOSMini")?l={title:"Button.TryAgain".loc(),action:function(){this.getPath("pane.modalPane").set("hideDelay",10),this.get("pane").remove(),n.teardown(),t.set("pendingApp",null),f.gotoState("active.springboard.waitingForApp")}}:l={title:"Button.OK".loc(),action:function(){this.getPath("pane.modalPane").set("hideDelay",10),this.get("pane").remove(),n.teardown(),t.set("pendingApp",null)}},CW.Alert.show({message:a,description:"Error.AppNotLoading.Description".loc(),middleButton:{title:"Error.Button.Report".loc(),action:function(){this.getPath("pane.modalPane").set("paneFadeOutDuration",0),this.get("pane").remove(),CloudOS.appController.showErrorReporter(n,null,NO,"loadFailure" ),n.teardown(),t.set("pendingApp",null)}},rightButton:l}),COS.statsController.recordStat("cloudos","AppLoadFailure",{appName:r})}}),reloadApp:function(){this.gotoState("active.springboard.waitingForApp")},authDidValidate:function(){var e=COS.authUIController;e.userDidAuthenticate(),e.reportAuthSuccess("validate")},authDidNotValidate:function(){window.location.hash="",CloudOS.authController.logoutUser(function(){CK.reloadWithReason("Intermediate validate call failed with 401/421 response")},YES)},authDidNotConnect:function(e){SC.warn('Intermediate validate call failed with failureReason as "%@"',e)}})})}),CloudOS.ServiceLockedState=SC.State.design({enterState:function(e){var t=this,n=e?e.retryAfter:null,r=CloudOS.appController,i=e.appToDisable||r.get("currentApp")||r.get("pendingApp"),s=i.get("name"),o=i.get("displayName"),u="Service.Locked.Title".loc({appName:o}),a=COS.authUIController.lockedAlertDescription("Service.Locked.Description.",n,o);CloudOS.notifyDialogAboveApp(),this.gotoState("active.springboard"),i.teardown(),CW.Alert.show({message:u,description:a,rightButton:{title:"Button.OK".loc(),action:function(){this.get("pane").remove(),CloudOS.notifyRemovalOfDialogAboveApp(),i.set("isDisabled",YES),n&&i.invokeLater(function(){this.set("isDisabled",NO)},n*1e3)}}})}}),CloudOS.SpringboardState=SC.State.extend({initialSubstate:"waitingForSpringBoardModule",enterState:function(e){SC.Module.loadModule("cloudos_foundation/springboard",this,function(){this.gotoState("springBoardDidLoad",e)})},waitingForSpringBoardModule:SC.State.design(),springBoardDidLoad:SC.State.design({enterState :function(e){CloudOS.configureSpringboard(),CloudOS.workspaceController.set("nowShowing",CloudOS.SPRINGBOARD),CW.notificationCenter.postNotification("springboardMayProceed"),CloudOS._executeReadyQueue();var t=CloudOS.appController.getDefaultApp(),n,r;t&&(n=t.get("isHSALocked"),r=t.get("isPCSKeysDeletedLocked"),n&&(t.set("loadReason",CK.LOAD_REASON_LOCATION_HASH),CloudOS.appController.set("pendingApp",t))),CloudOS.workspaceController.clearHash(),this.gotoState("displayingSpringboard",{defaultHSALockedApp:n?t:null,defaultPCSDeletedLockedApp:r?t:null,callback:e})}}),displayingSpringboard:SC.State.design({initialSubstate:"springboard",springboard:SC.State.design({enterState:function(e){var t,n,r;e&&(t=e.callback,n=e.defaultHSALockedApp,r=e.defaultPCSDeletedLockedApp),CloudOS.bannerManager.selectBannerAndShow(),t instanceof Function&&t(),r?CloudOS.statechart.sendAction("showPCSDeletedMessage",r.get("displayName")):n&&CloudOS.statechart.sendAction("showHSA",CloudOS.HSASourceEnum.USER_SELECTED_APP)},userDidChooseApp:function(){var e=CloudOS.appController.get("pendingApp");e?(e.set("loadInBackground",NO),this.gotoState("active.springboard.waitingForApp")):this.gotoState("active.springboard")},globalAppSwitchWasRequested:function(){this.gotoState("active.springboard.waitingForApp")},appCalledSwitchToApplication:function(){this.gotoState("active.springboard.waitingForApp")},showAccountSettings:function(){CloudOS.openApp("settings")},logout:function(){try{CK.clearSessionStorage(),CloudOS.authController.logoutUser(function(){var e=window.location.toString();e.indexOf("#")===e.length-1?CK .reloadWithReason("logout from springboard",e.substring(0,e.length-1)):CK.reloadWithReason("logout from springboard")},YES)}catch(e){SC.Logger.error("Error during Signout: "+e)}},showPCSDeletedMessage:function(e){CloudOS.authController.showPCSDeletedErrorMessage(e)}})}),waitingForApp:CloudOS.WaitingForAppState.design({userDidChooseApp:function(){var e=CloudOS.appController.get("pendingApp");e?(e.set("loadInBackground",NO),this.gotoState("active.springboard.waitingForApp")):this.gotoState("active.springboard")},globalAppSwitchWasRequested:function(){if(CloudOS.appController.get("pendingApp")===this._app){SC.info("Already waiting for app to load");return}this.gotoState("active.springboard.waitingForApp")},appCalledSwitchToApplication:function(){this.gotoState("active.springboard.waitingForApp")},logout:function(){this.abortLoad(),CloudOS.statechart.sendAction("logout")},showAccountSettings:function(){this.abortLoad(),CloudOS.statechart.sendAction("showAccountSettings")}}),exitState:function(){}}),window.VERSIONS={fonts:SC.buildNumber,cloudkitjs:2},CloudOS.AdjustablePane=CW.PanelPane.extend(CW.Animatability,CW.PaneAnimationSupport,COS.AnimatedPane,{classNames:["adjustable-pane"],classNameBindings:["isFullScreen:full-screen"],layout:{centerX:0,centerY:0},modalPane:COS.AnimatedPane.modalPane.extend({classNames:["adjustable-pane-modal"],showingState:{opacity:1}}),delegate:null,show:function(){var e=this.get("delegate");e&&typeof e.show=="function"&&e.show.apply(e,arguments)},paneDidShow:function(){var e=this.get("delegate"),t=this.get("layer");e&&typeof e.paneDidShow=="function"&& e.paneDidShow.apply(e,arguments),t.focus()},paneDidHide:function(){var e=this.get("delegate");e&&typeof e.paneDidHide=="function"&&e.paneDidHide.apply(e,arguments)},minContainerWidth:Math.max(COS.MIN_WIDTH,window.innerWidth),minContainerHeight:Math.max(COS.MIN_HEIGHT,window.innerHeight),maxWidth:640,maxHeight:null,horizontalMargin:50,verticalMargin:52,isLoading:NO,acceptsFirstResponder:YES,isFullScreen:NO,viewWidth:function(){var e=this.get("minContainerWidth"),t=e?Math.max(window.innerWidth,this.get("minContainerWidth")):window.innerWidth,n=t-this.get("horizontalMargin")*2,r=this.get("maxWidth");return r?Math.min(r,n):n}.property("horizontalMargin","maxWidth"),viewHeight:function(){this.get("isFullScreen")&&this.set("maxHeight",null);var e=this.get("minContainerHeight"),t=e?Math.max(window.innerHeight,this.get("minContainerHeight")):window.innerHeight,n=t-this.get("verticalMargin")*2,r=this.get("maxHeight");return r?Math.min(r,n):n}.property("verticalMargin","maxHeight"),init:function(){arguments.callee.base.apply(this,arguments),CloudOSBootstrap.isOnSupportedMobile&&this.maxWidth>Math.min(this.minContainerWidth,this.minContainerHeight)&&(this.maxWidth=null,this.maxHeight=null,this.horizontalMargin=0,this.verticalMargin=0,this.set("isFullScreen",!0))},contentView:SC.View.extend({childViews:["openingTabCatcher","loadingView","closingTabCatcher"],paneContentViewObserver:function(){var e=this._lastPaneContentView;e&&this.removeChild(e);var t=this._lastPaneContentView=this.getPath("parentView.paneContentView");t&&this.insertBefore(t,this.get("loadingView"))}.observes("parentView.paneContentView" ),openingTabCatcher:SC.View.extend({tagName:"span",classNames:"tab-catcher".w(),attributeBindings:["aria-hidden"],"aria-hidden":"true",ariaRole:"presentation",acceptsFirstResponder:YES,keyDown:function(e){e.which===SC.Event.KEY_TAB&&(e.shiftKey?this.setPath("parentView.parentView.isAtStartOfPane",YES):(e.allowDefault(),this.resignFirstResponder()))}}),closingTabCatcher:SC.View.extend({tagName:"span",classNames:"tab-catcher".w(),attributeBindings:["aria-hidden"],"aria-hidden":"true",ariaRole:"presentation",acceptsFirstResponder:YES,keyDown:function(e){e.which===SC.Event.KEY_TAB&&(e.shiftKey?(e.allowDefault(),this.resignFirstResponder()):this.setPath("parentView.parentView.isAtEndOfPane",YES))}}),loadingView:SC.View.extend({classNames:["adjustable-pane-loading-view-container"],isVisibleBinding:".parentView.parentView.isLoading",layout:{top:0,right:0,bottom:0,left:0},childViews:["spinner"],spinner:SC.View.design({classNames:["adjustable-pane-loading-view"],childViews:["icon","label"],layout:{left:.5,top:.5,height:"auto",width:"auto"},useStaticLayout:YES,icon:CW.SpinnerView.design({classNames:["cw-spinner-view"],asset:SC.platform.dpi>1?"data:image/png;base64,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" :"data:image/png;base64,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" ,useStaticLayout:YES}),label:SC.LabelView.design({layout:{height:"auto",width:"auto"},useStaticLayout:YES,localize:YES,value:"HostingContext.Loading.Label"})})})}),isAtEndOfPane:NO,isAtStartOfPane:NO,isAtEndOfPaneDidChange:function(){this.isAtEndOfPane&&(this.get("layer").focus(),this.becomeFirstResponder(),this.set("isAtEndOfPane",NO))}.observes("isAtEndOfPane"),isAtStartOfPaneDidChange:function(){this.isAtStartOfPane&&(this.getPath("contentView.closingTabCatcher.layer").focus(),this.getPath("contentView.closingTabCatcher").becomeFirstResponder(),this.set("isAtStartOfPane",NO))}.observes("isAtStartOfPane"),_windowDidResize:function(e){SC.RunLoop.begin();if(this.get("isFullScreen"))this.set("layout",{left:0,right:0,top:0,bottom:0,minWidth:COS.MIN_WIDTH,minHeight:COS.MIN_HEIGHT});else{var t=Math.max(window.innerWidth,this.get("minContainerWidth")),n=(t-window.innerWidth)/2,r=Math.max(window.innerHeight,this.get("minContainerHeight")),i=(r-window.innerHeight)/2;e===!0||!this.get("isPaneAttached")?(this.stopAnimation("width"),this.stopAnimation("height"),this.adjust("width",this.get("viewWidth")),this.adjust("height",this.get("viewHeight")),this.adjust("centerX",n),this.adjust("centerY",i)):this.animate({width:this.get("viewWidth"),height:this.get("viewHeight"),centerX:n,centerY:i},{inertia:3,speed:10,headStart:2,ticked:2,discreteness:2})}SC.RunLoop.end()}.observes("viewWidth","viewHeight"),windowSizeDidChange:function(){var e=arguments.callee.base.apply(this,arguments);return this.get("isFullScreen")?(this.maxWidth=null,this.maxHeight=null):(this.set("minContainerWidth",Math.max (COS.MIN_WIDTH,window.innerWidth)),this.set("minContainerHeight",Math.max(COS.MIN_HEIGHT,window.innerHeight))),this._windowDidResize(YES),e},didAppendToDocument:function(){this.windowSizeDidChange()}}),CloudOS.AppsContainerView=SC.View.extend(CW.Animatability,{layout:{top:0,zIndex:100},classNames:"apps-container-view overflow-visible".w(),isOnscreen:NO,isOnscreenBinding:"CloudOS.workspaceController.applicationIsOnscreen",isFullWindow:NO,isFullWindowBinding:"CloudOS.workspaceController.applicationIsFullwindow",wantsAcceleratedLayer:NO,displayProperties:["isOnscreen"],useDisplayNoneForHide:SC.browser.safari,_isViewBeingHidden:!1,update:function(){window.appsView=this;var e=this.get("isOnscreen"),t=document,n=t.body,r=t.documentElement,i=window.innerWidth||r.clientWidth||n.clientWidth,s=window.innerHeight||r.clientHeight||n.clientHeight,o,u=CloudOS.bannerManager,a=u.get("bannerHeight");e?(this.set("layout",{left:0,top:a,right:0,bottom:0,zIndex:100}),this.invokeLast(function(){this.get("layer").style.pointerEvents=""})):window.showHiddenApps?(this.set("layout",{left:0,top:a,width:i,height:s,zIndex:100,opacity:.1}),this.invokeLast(function(){this.get("layer").style.pointerEvents="none"})):this.set("layout",{left:-1e4,top:-1e4,width:i,height:s,zIndex:100}),e&&this.layoutAppForShow()},didCreateLayer:function(){this.update()},layoutAppForShow:function(e){var t,n,r="0",i="100%",s=CloudOS.bannerManager,o=s.get("bannerHeight");if(!e&&!(e=this._currentApp)||!(t=e.get("view")))return;if(!(n=t.get("layer")))return;t.get("usingPrevCreatedIframe")&&(r=o,i="calc(100% - "+o+"px)"),n.style.cssText="left:0px; top:%@px; width:100%; height:%@; z-index:10; position:absolute;" .fmt(r,i),n.setAttribute("aria-hidden","false")},bannerHeightObserver:function(){var e=CloudOS.bannerManager.get("bannerHeight");this.animate("top",{to:e,duration:CloudOS.BANNER_ANIMATION_DURATION})}.observes("CloudOS.bannerManager.bannerHeight"),layoutAppForHide:function(e){var t,n;if(!(t=e.isAppFrameView?e:e.get("view")))return;if(!(n=t.get("layer")))return;var r=document,i=r.body,s=r.documentElement,o=window.innerWidth||s.clientWidth||i.clientWidth,u=window.innerHeight||s.clientHeight||i.clientHeight;n.style.cssText="left:-10000px; top:-10000px; width:"+o+"px; height:"+u+"px; z-index:10; position:absolute;",this.useDisplayNoneForHide&&(n.style.display="none"),n.setAttribute("width",""),n.setAttribute("height",""),window.showHiddenApps&&(n.style.webkitTransform="translate3d(10000px,10000px,0px) scale3d(0.8,0.8,1)",n.style.zIndex="2000"),this.get("layer").setAttribute("aria-hidden","true"),n.setAttribute("aria-hidden","true")},addAppFrame:function(e){this.appendChild(e),this.layoutAppForHide(e)},removeAppFrame:function(e){e&&e.get("parentView")===this&&this.removeChild(e),e===this._currentView&&(this._currentApp=null,this._currentView=null)},showApp:function(e,t,n){if(!e&&!(e=this._currentApp))return;var r=this,i=this._currentApp,s=this._currentView,o=e,u=e.get("view"),a=i!==o,f=s!==u;f&&(!n&&s&&this.get("isFullWindow")?s.animate({opacity:0,duration:550},{onstart:function(){t&&i.ensureWillSuspend(),s.adjust("zIndex",1e3),s.adjust("height","100%"),s.adjust("width","100%"),a&&(r._currentApp=o),r._currentView=u,r.layoutAppForShow(),t&&r._currentApp.ensureWillBecomeActive()},onfinish :function(){s._shouldBeDestroyedAfterNextSwitch?(s.removeFromParent(),s.destroy()):(s.adjust("zIndex",1),s.adjust("opacity",1)),r.invokeLast(function(){a&&r.hideApp(i,NO),t&&(i.ensureDidSuspend(),r._currentApp&&r._currentApp.ensureDidBecomeActive()),r._currentApp.focus()})}}):(s&&s._shouldBeDestroyedAfterNextSwitch&&(s.removeFromParent(),s.destroy()),a&&(this.hideApp(undefined,t),this._currentApp=o),t&&(this._currentApp.ensureWillBecomeActive(),this._currentApp.ensureDidBecomeActive()),this._currentView=u,this.layoutAppForShow(),this._currentApp.focus())),this.get("layer").setAttribute("aria-hidden","false");var l=this.getPath("_currentView.layer");l&&l.setAttribute("aria-hidden","false")},hideApp:function(e,t){if(!e&&!(e=this._currentApp))return;t&&e.ensureWillSuspend(),this.layoutAppForHide(e),e===this._currentApp&&(this._currentApp=null,this._currentView=null),t&&e.ensureDidSuspend(),this.get("layer").setAttribute("aria-hidden","true")},zoomedOutScaleFactorForAnimation:function(){return.9}.property(),show:function(){var e={opacity:{from:0,to:1}};COS.ENABLE_TRANSFORM_ANIMATIONS&&COS.ENABLE_SCALE_ANIMATION&&(e.scale={to:1,from:this.get("zoomedOutScaleFactorForAnimation")}),this.set("isOnscreen",YES),this.invokeLast(function(){if(this._isViewBeingHidden)return;this.animate(e,this.gpuLayerFunctions,{duration:550*COS.ENABLE_APP_ANIMATION,onstart:function(){this.view.showAnimationDidBegin()},onfinish:function(){this.view.showAnimationDidComplete()}})})},hide:function(){this._isViewBeingHidden=!0;var e={opacity:0};COS.ENABLE_TRANSFORM_ANIMATIONS&&COS.ENABLE_SCALE_ANIMATION&&(e.scale= this.get("zoomedOutScaleFactorForAnimation")),this.animate(e,this.gpuLayerFunctions,{duration:550*COS.ENABLE_APP_ANIMATION,onstart:function(){this.view.hideAnimationDidBegin()},onfinish:function(){var e=this.view;e._isViewBeingHidden=!1,e.hideAnimationDidComplete(),e.set("isOnscreen",NO)}})},gpuLayerFunctions:COS.ENABLE_TRANSFORM_ANIMATIONS&&COS.ENABLE_APP_ANIMATION?{addLayer:function(){this.view.set("wantsAcceleratedLayer",YES)}.listens("start"),removeLayer:function(){this.view.set("wantsAcceleratedLayer",NO)}.listens("finish")}:{},showAnimationDidComplete:function(){this._currentApp&&(this._currentApp.ensureDidBecomeActive(),this._currentApp.focus()),this.set("isFullWindow",YES)},showAnimationDidBegin:function(){this._currentApp&&this._currentApp.ensureWillBecomeActive()},hideAnimationDidComplete:function(){this._currentApp&&this._currentApp.ensureDidSuspend(),this.hideApp()},hideAnimationDidBegin:function(){this._currentApp&&this._currentApp.ensureWillSuspend(),this.set("isFullWindow",NO)}}),function(){function c(){this.init()}function h(e){this.camera=e,this.init()}var e=window.location.href.toLowerCase(),t=e.indexOf("disablebackgroundanimation")===-1,n=e.indexOf("crazyawesome")!==-1,r=e.indexOf("double")!==-1,i=e.indexOf("triple")!==-1,s=2*Math.PI,o=new Date*1,u=!SC.browser.chrome&&!SC.browser.mozilla,a=Date.now(),f=CloudOS.sin=u?function(){var e=[],t=1e3,n;for(n=0;n10&&this.mode&&this.circles.length=t.lifespan&&(t.randomize(),t._startTime=e),t.setAge(e-t._startTime),t.update();if(this.oldMode&&this.oldMode.deadCircles){var i=YES;for(r=0;t=this.oldMode.deadCircles[r];r++)e-t._startTime-t.fadeOutStartAgethis._lastActivityTime+this.stopAnimatingAfter||e>5&&!document.hasFocus())&&this.slowlyStopAnimating(),this.timeSpeed.current<1e-4&&this.timeSpeed.to<1e-4&&this.cameraX.to===this.cameraX.current&&this.cameraY.to===this.cameraY.current&&this.cameraZ.to===this.cameraZ.current&&this.stop(),this._lastTimeSpeed!==(this._lastTimeSpeed=this.timeSpeed.current)&&(this.time.speed=this.timeSpeed.current);if(!this.hasFastFPSEvaluation){var s=Math.max(Math.abs(this.cameraX.to-this.cameraX.current),Math.abs(this.cameraY.to-this.cameraY.current),Math.abs(this.cameraZ.to-this.cameraZ.current));s<.01?this.fps=12:s<.1?this.fps=15:s<.3?this.fps=20:this.fps=30}else this.fps=60;!n&&this.wantsFPSEvaluation&&!this.isDead&&CW.Anim.tasks[0]===this&&CW.Anim.tasks.length===1&&this.circles.length===this.maxCircles&&(this.recordedDampedFPS=.97*Math.min(60,this.recordedDampedFPS||30)+.03*CW.Anim.frameRate,this.recordedDampedFPS<(this.hasFastFPSEvaluation?40:9)&&this._dieBecauseTooSlow(),this.wantsFastFPSEvaluation&&(this._lastWFFPSE||this._turnOnFastFPSEvaluation(),this.hasFastFPSEvaluation&&CW.Anim.now-this.hasFastFPSEvaluation>1e3&& this._turnOffFastFPSEvaluation(YES)))},_dieBecauseTooSlow:function(){SC.debug("Background View: Stopping background animation because the framerate has been consistently too slow"+(this.hasFastFPSEvaluation?" during the one-second fast-FPS background performance evaluation.":".")),this.slowlyStopAnimating(),this.isDead=YES,this.hasFastFPSEvaluation&&this._turnOffFastFPSEvaluation()},_turnOnFastFPSEvaluation:function(){this._lastWFFPSE=YES,this.hasFastFPSEvaluation=CW.Anim.now,this.recordedDampedFPS=this.fps=60,SC.debug("Background View: Now starting one-second fast-FPS background performance evaluation.")},_turnOffFastFPSEvaluation:function(e){this.wantsFastFPSEvaluation=this._lastWFFPSE=NO,this.hasFastFPSEvaluation=undefined,this.recordedDampedFPS=30,e&&SC.debug("Background View: Successfully completed one-second fast-FPS performance evaluation.")},selectMode:function(e){typeof e=="string"&&(e=this.modes[e]);if(this.oldMode){this.pendingModeSwitchToMode=e;return}this.pendingModeSwitchToMode=null;var t=this.mode,n=t&&t.guidForAppearance,r=e&&e.guidForAppearance;if(t===e||n===r)return;var i,s,o,u;if(t){i=[];for(s=0;o=this.circles[s];s++)u=new h(this.camera),u.owner=this,u.cloneFrom(o),this.applyModeToCircle(e,u),u._startTime=o._startTime,u.appendTo(this.container),i[s]=u,o.fadeOut(),u.fadeIn();t.deadCircles=this.circles,this.oldMode=t,this.circles=i}this.mode=e},applyModeToCircle:function(e,t){for(var n=0,r;r=e.optionKeys[n];n++)t[r]=e.options[r]},mouseMoved:function(){if(this.isDead)return;var e=SC.RootResponder.responder._lastMoveX||0,t=SC.RootResponder.responder._lastMoveY||0 ,r=this.windowWidth,i=this.windowHeight;this.cameraX.redirectTo(-(2*e/r-1)*this.cameraXMouseSensitivity),this.cameraY.redirectTo(-(2-2*t/i-1)*this.cameraYMouseSensitivity),n&&this.cameraZ.redirectTo((this.cameraX.to+this.cameraY.to)*.8-2.5),this.startDueToActivity()},startDueToActivity:function(){if(this.isDead)return;this._lastActivityTime=this.elapsedTime,this.timeSpeed.to!==1&&this.timeSpeed.redirectTo(1),this.start()},shouldStart:function(){return!matchMedia("(prefers-reduced-motion)").matches},start:function(){if(!this.shouldStart())return;if(!this.isDead)return arguments.callee.base.apply(this,arguments)},slowlyStopAnimating:function(){this.timeSpeed.redirectTo(1e-5)},onstart:function(){this.recordedDampedFPS=30}});CloudOS.BackgroundView=SC.View.extend({layout:{left:0,top:0,right:0,bottom:0,minHeight:COS.MIN_HEIGHT,minWidth:COS.MIN_WIDTH,zIndex:1},classNames:"background-view".w(),ariaHidden:YES,render:function(e){window.bgv=this},update:function(){}}),t&&CloudOS.BackgroundView.reopen({classNames:"force-webkit-acceleration".w(),allowCirclesDuringAuth:!0,displayProperties:"frame".w(),init:function(){return this._startIfAppropriate=this._startIfAppropriate.bind(this),document.addEventListener("mousemove",this._startIfAppropriate.bind(this,"mousemove")),window.addEventListener("focus",this._startIfAppropriate.bind(this,"focus")),window.addEventListener("keypress",this._startIfAppropriate.bind(this,"keypress")),matchMedia("(prefers-reduced-motion)").addListener(this.reduceMotionListener.bind(this)),arguments.callee.base.apply(this,arguments)},reduceMotionListener:function() {var e=this.circleAnim;matchMedia("(prefers-reduced-motion)").matches?e.stop():e.start()},update:function(){var e=this.get("frame");if(!e)return;this.circleAnim.setWindowSize(e.width,e.height)},didCreateLayer:function(){this._layer=this.get("layer"),this.circleAnim=p.create({container:this._layer,owner:this}),this.decideAboutGPU(),this.update()},startStopAnimationOnVisibility:function(){if(!this.circleAnim)return;this.get("isVisibleInWindow")?this.circleAnim.start():this.circleAnim.stop()}.observes("isVisibleInWindow"),_watchNowShowing:function(){this.invokeLater("watchNowShowing",200)}.observes("CloudOS.workspaceController.nowShowing"),watchNowShowing:function(){var e=CloudOS.workspaceController.get("nowShowing");this.circleAnim.selectMode(e<=CloudOS.AUTH?"blurred":"normal");var t=this._manageCameraZHasRan!==(this._manageCameraZHasRan=YES),n=e===CloudOS.APP?.8:e===CloudOS.SPRINGBOARD?1.1:e===CloudOS.AUTH?1.3:1.3,r=this.circleAnim.cameraZ;r.redirectTo(-n),(e===CloudOS.AUTH||t)&&r.force(),this.get("isVisibleInWindow")&&this.circleAnim.startDueToActivity()},decideAboutGPU:function(){if(!this.circleAnim)return;var e=CloudOS.workspaceController.get("isGPUEnabled");if(!SC.browser.safari||n)e=YES;this.circleAnim.isDead&&(e=NO);if(this._lastShouldForceGPU===(this._lastShouldForceGPU=e))return;this.circleAnim.setShouldForceGPU(e),this.circleAnim.wantsFastFPSEvaluation=YES;var t="force-webkit-acceleration",r=this.classNames;this.$().setClass(t,e),e?r.contains(t)||r.push(t):r.removeObject(t)}.observes("CloudOS.workspaceController.isGPUEnabled"),_startIfAppropriate:function(e){if(!this .circleAnim)return;var t=this.get("isVisibleInWindow");if(e==="interval"){if(!(Date.now()'+t+""),arguments.callee.base.apply(this,arguments)}}),CloudOS.iCloudTextView=SC.View.extend(SC.AutoResize,SC.RTLSupport,{supportsAutoResize:YES,classNames:["icloud-text-view"],layoutRecipe:{start:13,top:0,width:120,height:44},autoResizeLayer:function(){return this.get("layer").childNodes[0]}.property("layer" ).cacheable(),marginBetweenImageAndAppName:8,autoResizeText:function(){return CK.get("isBeta")?"Beta":CK.get("isFuture")?"Future":CK.get("isCarry")?"Carry":""}.property(),autoResizePadding:function(){var e=parseInt(window.getComputedStyle(document.querySelector(".icloud-text"),":before").width);return this.getPath("autoResizeText.length")>0?{width:e+this.get("marginBetweenImageAndAppName")}:{width:e}}.property("autoResizeText").cacheable(),render:function(e){var t="";CK.get("isBeta")&&(t=" beta"),CK.get("isFuture")&&(t=" future"),CK.get("isCarry")&&(t=" carry"),e.push(''),arguments.callee.base.apply(this,arguments)},click:function(){window.location.hash=""}}),CloudOS.iFrameView=SC.View.extend({attributeBindings:["src","title"],tagName:"iframe",title:null,src:null,init:function(){arguments.callee.base.apply(this,arguments),COS.statsController.beginStat("cloudos",this+"_load_time")},didAppendToDocument:function(){var e=this.get("layer");e?COS.statsController.endStat("cloudos",this+"_load_time",null,{durationKeyName:"duration",includeLocationAndLocale:YES}):SC.warn("Failed to Load iframe %@"+this)}}),CloudOS.UnableToProceedAlert=CW.Alert.extend({init:function(){arguments.callee.base.apply(this,arguments),this.get("failureReason")||CW.fatalError("Cannot show `UnableToProceed Alert` without value for failureReason property")}}),CloudOS.UnableToProceedAlert.mixin({show:function(e){var t={failureReason:null,message:"Error.AuthDidNotConnect.Title".loc(),description:"Error.AuthDidNotConnect.Description".loc(),middleButton:{title:"Error.AuthDidNotConnect.Support" .loc(),action:"support"},rightButton:{title:"Button.OK".loc(),action:function(){var e=this.get("pane");e.remove(),e.clearUserStateAndLogoutUser()}},leftButton:{title:"Error.Button.Report".loc(),action:function(){var e=this.get("pane"),t=e.get("failureReason");e.get("modalPane").set("paneFadeOutDuration",0),e.remove(),CK.errorCatcher.reportServerError({applicationName:"cloudos",error:t,dismissCallback:function(){e.clearUserStateAndLogoutUser()}})}},clearUserStateAndLogoutUser:function(){var e=CloudOS.authController;e.clearUserState(),e.logoutUser(function(){CK.reloadWithReason("Restart the session due to authDidNotConnect error.")},YES)},support:function(){window.open("Error.AuthDidNotConnect.Support.URL".loc())}};for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);var r=this.create(t);return r.append(),r}}),CloudOS.mainPage=SC.Page.design({mainPane:SC.MainPane.extend(CW.DropTarget,CloudOS.AdjustViewLayoutOnMobile,{layout:{left:0,right:0,top:0,bottom:0,zIndex:2,minHeight:COS.MIN_HEIGHT,minWidth:COS.MIN_WIDTH},init:function(){this.adjustLayoutOnMobile(["minWidth","minHeight"]),arguments.callee.base.apply(this,arguments),CW.notificationCenter.subscribeToNotification("activateMinimumSize",this,"activateMinimumSize"),CW.notificationCenter.subscribeToNotification("deactivateMinimumSize",this,"deactivateMinimumSize"),CW.notificationCenter.subscribeToNotification("icloudNoticeVisibilityChanged",this,"icloudNoticeVisibilityChanged")},activateMinimumSize:function(){this.set("layout",{left:0,right:0,top:0,bottom:0,zIndex:2,minHeight:COS.MIN_HEIGHT,minWidth:COS.MIN_WIDTH}),this.invokeLast(function( ){typeof this._prevScrollTop=="number"&&(document.body.scrollTop=this._prevScrollTop,this._prevScrollTop=undefined),typeof this._prevScrollLeft=="number"&&(document.body.scrollLeft=this._prevScrollLeft,this._prevScrollLeft=undefined)})},deactivateMinimumSize:function(){this._prevScrollTop=document.body.scrollTop,this._prevScrollLeft=document.body.scrollLeft,this.set("layout",{left:0,right:0,top:0,bottom:0,zIndex:2}),this.setBodyOverflowIfNeeded(!0)},icloudNoticeVisibilityChanged:function(e){this.adjust("top",e),e?this.adjust("minHeight",this.getPath("layout.minHeight")-e):this.adjust("minHeight",COS.MIN_HEIGHT)},classNames:"overflow-visible".w(),childViews:["bannerContainer","appsView","backgroundView"],bannerContainer:CloudOS.BannerContainerView.design({}),appsView:CloudOS.AppsContainerView.design(COS.IsShowingSupport,{displayKey:CloudOS.APP,nowShowingBinding:"CloudOS.workspaceController.nowShowing"}),backgroundView:CloudOS.BackgroundView.design({isVisible:NO,setIsVisible:function(){var e=CloudOS.workspaceController.get("nowShowing"),t=!CloudOS.workspaceController.get("applicationIsFullwindow")&&!!e;this.allowCirclesDuringAuth||(t=t&&e!==CloudOS.AUTH),this.get("isVisible")!==t&&this.set("isVisible",t)}.observes("CloudOS.workspaceController.applicationIsFullwindow","CloudOS.workspaceController.nowShowing")})})}),CloudOS.main=function(){var t=CloudOS.get("delegate");CloudOS.invokeDelegateMethod(t,"applicationWillStart"),CW.addKeyResponder(CloudOS.keyResponder),CloudOS.moduleLocalizer.setLocale(String.preferredLanguage),SC.Module.loadModule("cloudos_foundation/language",this,function( ){window.localeDidLoad=!0,SC.Event.add(document,"mousemove",function(e){var t=CloudOS.appController.getPath("currentApp"),n={clientX:e.clientX,clientY:e.clientY},r;if(!t||!t.get("contentWindow")||!t.get("isReady"))return YES;t.passMessage("_mouseMove",n)}),SC.Event.add(document,"mouseup",function(e){var t=CloudOS.appController.getPath("currentApp"),n={clientX:e.clientX,clientY:e.clientY},r;if(!t||!t.get("contentWindow")||!t.get("isReady"))return YES;t.passMessage("_mouseUp",n)});if(CloudOS.get("isCloudOSMini")){var e=CloudOS.appController.getDefaultAppName();CloudOS.displayApps.push({name:e,isDynamicallyLoaded:YES})}else CloudOSBootstrap.isOnSupportedMobile||SC.Module.loadModule("cloudos_foundation/springboard",this,function(){CloudOS.configureSpringboard()});CloudOS.getPath("mainPage.mainPane").append(),SC.debug("CloudOS.main() already has localized strings, proceeding to run CloudOS.run() now."),CloudOS.run(),CloudOS.invokeDelegateMethod(t,"applicationDidStart"),CloudOS.set("mainHasCompleted",YES)})},function(){var e="cloudkit/error_catcher";if(!SC.MODULE_INFO)throw"SC.MODULE_INFO is not defined!";if(SC.MODULE_INFO[e])return;SC.MODULE_INFO[e]=SC.Object.create({dependencies:[],styles:["/system/cloudos/1812Project43/cloudkit/error_catcher/1812Project43/en-us/stylesheet.css"],styles2x:["/system/cloudos/1812Project43/cloudkit/error_catcher/1812Project43/en-us/stylesheet.css"],scriptURL:"/system/cloudos/1812Project43/cloudkit/error_catcher/1812Project43/en-us/javascript.js",stringURL:"/system/cloudos/1812Project43/cloudkit/error_catcher/1812Project43/en-us/javascript-strings.js" ,isPrefetched:YES})}(),function(){var e="cloudkit/core_types";if(!SC.MODULE_INFO)throw"SC.MODULE_INFO is not defined!";if(SC.MODULE_INFO[e])return;SC.MODULE_INFO[e]=SC.Object.create({dependencies:[],styles:[],styles2x:[],scriptURL:"/system/cloudos/1812Project43/cloudkit/core_types/1812Project43/en-us/javascript.js",stringURL:"/system/cloudos/1812Project43/cloudkit/core_types/1812Project43/en-us/javascript-strings.js",isPrefetched:YES})}(),function(){var e="cloudos_foundation/language";if(!SC.MODULE_INFO)throw"SC.MODULE_INFO is not defined!";if(SC.MODULE_INFO[e])return;SC.MODULE_INFO[e]=SC.Object.create({dependencies:[],styles:["/system/cloudos/1812Project43/cloudos_foundation/language/1812Project43/en-us/stylesheet.css"],styles2x:["/system/cloudos/1812Project43/cloudos_foundation/language/1812Project43/en-us/stylesheet@2x.css"],scriptURL:"/system/cloudos/1812Project43/cloudos_foundation/language/1812Project43/en-us/javascript.js",stringURL:"/system/cloudos/1812Project43/cloudos_foundation/language/1812Project43/en-us/javascript-strings.js",isPrefetched:YES})}(),function(){var e="cloudkit/first_run";if(!SC.MODULE_INFO)throw"SC.MODULE_INFO is not defined!";if(SC.MODULE_INFO[e])return;SC.MODULE_INFO[e]=SC.Object.create({dependencies:["coreweb/timezone_picker","cloudkit/photo"],styles:["/system/cloudos/1812Project43/cloudkit/first_run/1812Project43/en-us/stylesheet.css"],styles2x:["/system/cloudos/1812Project43/cloudkit/first_run/1812Project43/en-us/stylesheet@2x.css"],scriptURL:"/system/cloudos/1812Project43/cloudkit/first_run/1812Project43/en-us/javascript.js",stringURL:"/system/cloudos/1812Project43/cloudkit/first_run/1812Project43/en-us/javascript-strings.js" ,isPrefetched:YES})}(),function(){var e="cloudkit/photo";if(!SC.MODULE_INFO)throw"SC.MODULE_INFO is not defined!";if(SC.MODULE_INFO[e])return;SC.MODULE_INFO[e]=SC.Object.create({dependencies:[],styles:[],styles2x:[],scriptURL:"/system/cloudos/1812Project43/cloudkit/photo/1812Project43/en-us/javascript.js",stringURL:"/system/cloudos/1812Project43/cloudkit/photo/1812Project43/en-us/javascript-strings.js",isPrefetched:YES})}(),function(){var e="coreweb/date_formatter";if(!SC.MODULE_INFO)throw"SC.MODULE_INFO is not defined!";if(SC.MODULE_INFO[e])return;SC.MODULE_INFO[e]=SC.Object.create({dependencies:[],styles:[],styles2x:[],scriptURL:"/system/cloudos/1812Project43/coreweb/date_formatter/1812Project43/en-us/javascript.js",stringURL:"/system/cloudos/1812Project43/coreweb/date_formatter/1812Project43/en-us/javascript-strings.js",isPrefetched:YES})}(),function(){var e="coreweb/timezone_picker";if(!SC.MODULE_INFO)throw"SC.MODULE_INFO is not defined!";if(SC.MODULE_INFO[e])return;SC.MODULE_INFO[e]=SC.Object.create({dependencies:[],styles:["/system/cloudos/1812Project43/coreweb/timezone_picker/1812Project43/en-us/stylesheet.css"],styles2x:["/system/cloudos/1812Project43/coreweb/timezone_picker/1812Project43/en-us/stylesheet@2x.css"],scriptURL:"/system/cloudos/1812Project43/coreweb/timezone_picker/1812Project43/en-us/javascript.js",stringURL:"/system/cloudos/1812Project43/coreweb/timezone_picker/1812Project43/en-us/javascript-strings.js",isPrefetched:YES})}(),function(){var e="cloudos_foundation/alarms";if(!SC.MODULE_INFO)throw"SC.MODULE_INFO is not defined!";if(SC.MODULE_INFO[e])return; SC.MODULE_INFO[e]=SC.Object.create({dependencies:["coreweb/date_formatter"],styles:["/system/cloudos/1812Project43/cloudos_foundation/alarms/1812Project43/en-us/stylesheet.css"],styles2x:["/system/cloudos/1812Project43/cloudos_foundation/alarms/1812Project43/en-us/stylesheet.css"],scriptURL:"/system/cloudos/1812Project43/cloudos_foundation/alarms/1812Project43/en-us/javascript.js",stringURL:"/system/cloudos/1812Project43/cloudos_foundation/alarms/1812Project43/en-us/javascript-strings.js",isPrefetched:YES})}(),function(){var e="cloudos_foundation/sharing";if(!SC.MODULE_INFO)throw"SC.MODULE_INFO is not defined!";if(SC.MODULE_INFO[e])return;SC.MODULE_INFO[e]=SC.Object.create({dependencies:["cloudkit/core_types"],styles:["/system/cloudos/1812Project43/cloudos_foundation/sharing/1812Project43/en-us/stylesheet.css"],styles2x:["/system/cloudos/1812Project43/cloudos_foundation/sharing/1812Project43/en-us/stylesheet@2x.css"],scriptURL:"/system/cloudos/1812Project43/cloudos_foundation/sharing/1812Project43/en-us/javascript.js",stringURL:"/system/cloudos/1812Project43/cloudos_foundation/sharing/1812Project43/en-us/javascript-strings.js",isPrefetched:YES})}(),function(){var e="cloudos_foundation/springboard";if(!SC.MODULE_INFO)throw"SC.MODULE_INFO is not defined!";if(SC.MODULE_INFO[e])return;SC.MODULE_INFO[e]=SC.Object.create({dependencies:[],styles:["/system/cloudos/1812Project43/cloudos_foundation/springboard/1812Project43/en-us/stylesheet.css"],styles2x:["/system/cloudos/1812Project43/cloudos_foundation/springboard/1812Project43/en-us/stylesheet@2x.css"],scriptURL:"/system/cloudos/1812Project43/cloudos_foundation/springboard/1812Project43/en-us/javascript.js" ,stringURL:"/system/cloudos/1812Project43/cloudos_foundation/springboard/1812Project43/en-us/javascript-strings.js",isLoaded:YES,source:'CloudOS.mixin({configureSpringboard:function(){if(this._hasConfiguredSpringBoard)return;var e={isShowingObserver:function(){CloudOS.workspaceController.get("nowShowing")<=CloudOS.AUTH?(this.$(".springboard-button-view").attr("tabindex","-1"),this.$().attr("aria-hidden","true")):(this.$(".springboard-button-view").attr("tabindex","0"),this.$().removeAttr("aria-hidden"))},springboardView:CloudOS.SpringboardView.design(COS.IsShowingSupport,{isAllowedToGenerateButtons:NO,init:function(){arguments.callee.base.apply(this,arguments);var e=CW.notificationCenter;e.subscribeToNotification("springboardMayProceed",this,"springboardMayProceed"),e.subscribeToNotification("requestedInfoForDynamicApp",this,"springboardMustWaitForDynamicApp"),e.subscribeToNotification("receivedInfoForDynamicApp",this,"springboardMayProceedFromDynamicApp"),e.subscribeToNotification("calendarIconWillRedraw",this,"springboardMustWaitForCalendarIconDrawing"),e.subscribeToNotification("calendarIconFinishedDrawing",this,"springboardMayProceedFromCalendarIconDrawing"),window.sv=this},displayKeys:[CloudOS.SPRINGBOARD,CloudOS.AUTH,CloudOS.SHARING],nowShowingBinding:"CloudOS.workspaceController.nowShowing",appIndicesBinding:"CloudOS.appController.appIndices",wantsAcceleratedLayer:!0,willShow:function(){CloudOS.workspaceController.hideCentralSpinner(null,!0)},springboardMayProceed:function(){this.set("isAllowedToGenerateButtons",YES)},springboardMustWaitForDynamicApp:function(e){this.addShowCondition("dynamic app "+e)},springboardMayProceedFromDynamicApp:function(e,t){this.metShowCondition("dynamic app "+e)},springboardMustWaitForCalendarIconDrawing\n:function(e,t){this.addShowCondition("Calendar icon must be drawn for correct language")},springboardMayProceedFromCalendarIconDrawing:function(e,t){this.metShowCondition("Calendar icon must be drawn for correct language")},childViews:CloudOS.SpringboardView.prototype.childViews.concat("accountMenu blurOverlay iCloudText".w()),blurOverlay:SC.View.extend(CW.Animatability,{classNames:"blur-overlay".w(),shouldShow:!0,shouldShowBinding:".parentView.isDecorativeDimmed",layout:{left:0,top:0,right:0,bottom:0,zIndex:2,opacity:1},shouldShowDidChange:function(){if(this.get("shouldShow"))this.animate("opacity",1,250),this.set("isVisible",!0);else{var e=this;this.animate("opacity",0,{duration:250,_updateVisibility:function(){e.set("isVisible",!1)}.listens("finish")})}}.observes("shouldShow")}),iCloudText:CloudOS.iCloudTextView.design({isEnabled:NO}),accountMenu:CloudOS.AccountMenuView.design(),isOffscreen:YES,isDecorativeDimmed:function(){var e=this.get("nowShowing");return e===CloudOS.AUTH||e===CloudOS.SHARING||!!this.get("wantsDD")}.property("nowShowing","wantsDD"),_setWantsDD:function(){var e=this.get("nowShowing")===CloudOS.AUTH;e?(this.set("wantsDD",YES),this._ddSetter&&this._ddSetter.invalidate(),this._ddSetter=null):this._ddSetter=this.invokeLater(function(){this.set("wantsDD",NO)},200)}.observes("nowShowing"),toggleChrome:function(){var e=this.get("isDecorativeDimmed");if(this.__lastToggleChromeDim__===(this.__lastToggleChromeDim__=e))return;this.accountMenu.animate("opacity",1-e,{duration:e?0:500,mustKeepLayoutSync:NO})}.observes("isDecorativeDimmed"),__lastToggleChromeDim__:NO\n,didShow:function(){this.showNotificationsIfNeeded()},didUndim:function(){this.showNotificationsIfNeeded()},showNotificationsIfNeeded:function(){this.notifyUnqualified()},notifyUnqualified:function(){var e=CloudOS.authController;if(!this._hasNotifiedUnqualified&&e.get("userRequiresUnqualifiedNotification")){var t=e.get("displayableCurrentDomain");CloudOS.iOSNotificationForSpringboard.enqueue({message:"Auth.Notification.Unqualified.Title".loc({currentDomain:t}),description:"Auth.Notification.Unqualified.Description".loc()}),this._hasNotifiedUnqualified=YES}}})},t=CloudOS.mainPage.mainPane,n={owner:t};t.appendChild(e.springboardView.create(n)),t.addObserver("CloudOS.workspaceController.nowShowing",e.isShowingObserver),this._hasConfiguredSpringBoard=YES}}),window.console&&console.log("%c\\n ********* \\n ******* ******* \\n *** *** \\n ** ** \\n ***** ** *** \\n **** ***** ** \\n ** ** \\n * * \\n ** ** ** * \\n **** ** ** ** ****** \\n ** ** ** ** **** \\n *** ** *** \\n * ** ** \\n * **** * \\n * * \\n** ** \\n* ** ** * \\n** *********** * \\n * *** ** \\n ** ** \\n *** ** \\n **** **** \\n **** **** \\n ************************************************* \\n \\n Happy to see you here! We are hiring the sharpest minds in the\\n industry who want to build the most sophisticated and delightful\\n applications on the web.\\n \\n Check out https://www.icloud.com/jobs/\\n \\n"\n,"font-family: Menlo, monospace"),CloudOS.SpringboardView=SC.View.extend(CW.Animatability,{ALL_FOUR_EDGE_SPACING:0,TOP_INSET:0,BOTTOM_INSET:0,MIN_INTER_BUTTON_SPACING:35,ANIMATE_LAYOUT:COS.ANIMATE_SPRINGBOARD_LAYOUT,FORCE_READINESS_TIME:6e3,isMiniSpringBoard:NO,buttonSizeDiscreteness:0,layout:{left:0,top:0,width:0,height:0,minHeight:COS.MIN_HEIGHT,minWidth:COS.MIN_WIDTH,zIndex:50},bannerObserver:function(){if(this.get("isMiniSpringBoard")||!this.get("isOnscreen"))return;var e=CloudOS.bannerManager,t=e.get("bannerHeight");this.animate("top",{to:t,duration:500})}.observes("CloudOS.bannerManager.bannerHeight"),classNames:["springboard-view"],wantsAcceleratedLayer:NO,displayProperties:"isOnscreen isAnimating frame".w(),isVisibleBinding:SC.Binding.oneWay("*springboardView.shouldHideForScreenReader"),isOnscreen:NO,isDecorativeDimmed:NO,isDecorativeDimmedObserver:function(){if(!this.get("isOnscreen"))return;this.get("isDecorativeDimmed")||(this.set("shouldHideForScreenReader",NO),CloudOS.workspaceController.hideCentralSpinner())}.observes("isDecorativeDimmed","isOnscreen"),attributeBindings:["aria-hidden"],shouldHideForScreenReader:YES,ariaHidden:YES,tabIndex:-1,"aria-hidden":function(){return this.get("ariaHidden")}.property("ariaHidden"),shouldHideForScreenReaderObserver:function(){this.get("shouldHideForScreenReader")?this.set({tabIndex:-1,ariaHidden:YES}):this.set({tabIndex:0,ariaHidden:NO})}.observes("shouldHideForScreenReader","isOnscreen"),appIndices:undefined,childViews:"buttonsContainer".w(),buttonsContainer:SC.View.extend(CW.Animatability,{layout:{left:0,top:0,right:0,bottom\n:0,zIndex:1},ariaRole:"main",ariaLabel:function(){return"AppTitle.backToSpringboard".loc()}.property(),focusOnButtonsContainer:function(){var e=this.get("childViews"),t=CloudOS.bannerManager;t.get("isBannerVisible")||(this.set("acceptsFirstResponder",YES),this.$().attr("tabindex",0),e&&e.length&&this.get("layer").focus())},checkForAppsAfterAnim:function(){this.owner.invokeLater("updateToAppsWhenAppropriate",100)},postAnimation:function(){this.get("isAnimating")||(this.checkForAppsAfterAnim(),this.focusOnButtonsContainer())}.observes("isAnimating")}),apps:undefined,isReadyToShow:NO,isAllowedToGenerateButtons:YES,useAnimationWhenShowing:!0,init:function(){CloudOS.SpringboardView._isAllowedToGenerateButtons&&(this.isAllowedToGenerateButtons=YES),arguments.callee.base.apply(this,arguments),this._allButtons=[],this._displayButtons=[],this._buttonsByName={},this._finalDistanceAdjustment={},this._waitingForConditions=SC.Set.create(),this._conditionsMet=SC.Set.create(),this.addShowCondition("initial set of buttons"),this.sizeToParent(!0),this.handleOnscreen(),this.appsOneWayBindingImplementedViaObserver(),CW.notificationCenter.subscribeToNotification("relocalize",this,"relocalize")},relocalize:function(){var e=this._prevCloudOSLocaleRTL,t=CloudOS.get("isCloudOSLocaleRTLOriented");e!==t&&this._decideButtonLocations(),this._prevCloudOSLocaleRTL=t},appsOneWayBindingImplementedViaObserver:function(){this.pruneAppList()}.observes("CloudOS.appController.appList","CloudOS.appController.appList.[]"),pruneAppList:function(){var e=CloudOS.appController.get("appList"),t=CloudOS.authController,\nn=t.get("user"),r=t.get("iCloudLiteSignUp")||n&&n.get("isLiteAccount"),i=[],s,o;if(!e)return;for(s=0;o=e[s];s++){if(o.get("isHidden")||!o.get("supportsLite")&&r)continue;i.push(o)}this.set("apps",i)},awaitShow:function(){this._pendingShow=YES,this.get("isAllowedToGenerateButtons")&&this.scheduleForcedReadiness()},scheduleForcedReadiness:function(){if(this._scheduledForceReadiness)return;this._scheduledForceReadiness=this.invokeLater(function(){this._scheduledForceReadiness=null,this.forceReadiness()},this.FORCE_READINESS_TIME)},show:function(){this.showForScreenReader(YES);if(this._showing)return;if(!this.get("isReadyToShow"))return this.awaitShow();this.willShow(),this.becomeFirstResponder(),this._pendingShow=NO,this._showing=YES,this._decideButtonLocations(),this.get("useAnimationWhenShowing")?this.get("isDecorativeDimmed")?this.showWithDecorativeMode():COS.ENABLE_TRANSFORM_ANIMATIONS?this.showWithIconSlide():this.showWithFade():this.showWithNoAnimation()},showWithNoAnimation:function(){this.adjust("opacity",1),this.set("isOnscreen",YES),this.didShow()},showWithDecorativeMode:function(){this.animate("opacity",{from:0,to:1,duration:1500},{onstop:function(){this.view.adjust("opacity",1),this.view.didShow()}}),this.set("isOnscreen",YES),this.set("shouldHideForScreenReader",YES)},showWithIconSlide:function(){var e=this._iconSlideAnim||(this._iconSlideAnim=this.IconSlideAnim.create({from:0,to:1,view:this}));e.duration=450,e.redirectTo(1),e.start()},showWithFade:function(){this.animate("opacity",{from:0,to:1,duration:550*COS.ENABLE_APP_ANIMATION},{doneShowing:function(){this.view\n.didShow()}.listens("stop")}),this.set("isOnscreen",YES)},willShow:function(){},didShow:function(){this.establishFocusForScreenReader()},hide:function(){this.showForScreenReader(NO),this._pendingShow=NO;if(!this._showing)return;this.willHide(),this.resignFirstResponder(),this._showing=NO;if(!this.get("useAnimationWhenShowing"))this.hideWithNoAnimation();else{if(this.get("isDecorativeDimmed"))return this.hideWithDecorativeMode();COS.ENABLE_TRANSFORM_ANIMATIONS?this.hideWithIconSlide():this.hideWithFade()}},hideWithNoAnimation:function(){this.adjust("opacity",0),this.set("isOnscreen",NO),this.didHide()},hideWithDecorativeMode:function(){this.set("isOnscreen",NO),this.didHide(),this.finishAnimation("scale")},hideWithIconSlide:function(){var e=this._iconSlideAnim||(this._iconSlideAnim=this.IconSlideAnim.create({from:1,to:0,view:this}));e.duration=550,e.redirectTo(0),e.start()},hideWithFade:function(){this.animate("opacity",{to:0,duration:550*COS.ENABLE_APP_ANIMATION},{doneHiding:function(){this.view.set("isOnscreen",NO),this.view.didHide()}.listens("stop")})},willHide:function(){},didHide:function(){},showWhenReady:function(){var e=this.get("isReadyToShow");if(this._lastIsReadyToShow===e)return;this._lastIsReadyToShow=e,e&&this._pendingShow&&this.show()}.observes("isReadyToShow"),IconSlideAnim:CW.Animation.extend({TRAVEL:1,init:function(){this.TRAVEL=1-(CloudOS.getPath("mainPage.mainPane.appsView.zoomedOutScaleFactorForAnimation")||0),this.TRAVEL=2*this.TRAVEL,arguments.callee.base.apply(this,arguments)},update:function(){var e=this.view,t=e._buttonCenters,n=e._displayButtons,r=\nthis._frame,i=this.TRAVEL*(1-this.current),s=e._layoutBounds;if(!s)return;var o=s.centerX,u=s.centerY,a,f,l,c,h,p,d;for(a=0;(d=t[a])&&(c=n[a]);a++)h=d.x,p=d.y,h===o&&p===u&&a!==0&&(h=t[a-1].x,p=t[a-1].y),f=d.x+i*(h-o),l=d.y+i*(p-u),c.setCenter(f,l);this._layer.style.opacity=this.current,this.view.adjust("opacity",this.current)},onstop:function(){this.view.decrementAnimationCount()},onfinish:function(){this.to===0&&(this.view.set("isOnscreen",NO),this.view.didHide()),this.to===1&&this.view.didShow()},onstart:function(){this.to!==0&&(this.view.handleOnscreen(),this.view.set("isOnscreen",YES),this.view.sizeToParent(!0),this.view.update()),this._frame=this.view.get("frame"),this._layer=this.view.get("layer"),this.view.incrementAnimationCount()}}),decorativeDimmedSBOpacity:0,__lastDim__:NO,handleDecorativeDimming:function(){var e=this.get("isDecorativeDimmed");if(this.__lastDim__===(this.__lastDim__=e))return;e?(this.stopAnimation("scale"),this.buttonsContainer.adjust("scale",.95),this.buttonsContainer.adjust("opacity",this.decorativeDimmedSBOpacity),this.didDim()):this.get("isShowing")?(this.buttonsContainer.animate("scale",1,{duration:550,onstop:function(){this.view.owner.didUndim()}}),this.buttonsContainer.animate("opacity",1,{duration:550})):(this.buttonsContainer.adjust("scale",1),this.buttonsContainer.adjust("opacity",1),this.didUndim())}.observes("isDecorativeDimmed"),establishFocusForScreenReader:function(){if(this.nowShowing!==CloudOS.SPRINGBOARD)return;var e=SC.$(".icloud-text");e.length&&e[0].style.display!=="none"&&e[0].focus()}.observes("isDecorativeDimmed","isShowing"\n),showForScreenReader:function(e){this.get("isMiniSpringBoard")||this.set("shouldHideForScreenReader",e?NO:YES)},didDim:function(){},didUndim:function(){},sizeToParent:function(e){var t=this.getPath("parentView.frame");if(e!==!0&&!this.get("isOnscreen"))return;if(!t)return;var n=this._lastPFWidth!==(this._lastPFWidth=t.width),r=this._lastPFHeight!==(this._lastPFHeight=t.height);if(!n&&!r&&!this.didChangeFor("sizeToParent","isOnscreen"))return;this.adjust({width:t.width,height:t.height})}.observes("*parentView.frame","isOnscreen"),handleOnscreen:function(){var e=this.get("isOnscreen"),t=e?CloudOS.bannerManager.get("bannerHeight"):0;this.adjust({left:-2e4*!e,top:-2e4*!e+t})}.observes("isOnscreen"),handleNewPermissionToGenerateButtons:function(){SC.debug("At long last, SpringboardView is now allowed to generate button instances!"),this.get("isAllowedToGenerateButtons")&&(CloudOS.SpringboardView._isAllowedToGenerateButtons=YES),this._pendingShow&&this.scheduleForcedReadiness()}.observes("isAllowedToGenerateButtons"),update:function(e){if(this._isUpdating===(this._isUpdating=YES))return;var t=this.get("frame");if(!t)return;if(this.get("isAnimating")&&this._lastFrameHash===(this._lastFrameHash=t.width+","+t.height))return this._isUpdating=NO,this._isUpdating;if(!this._displayButtons.length)return this._isUpdating=NO;if(!this.get("isOnscreen"))return this._isUpdating=NO;var n=this.didChangeFor("update","isOnscreen");e!=="animatedLayoutBounds"&&this._decideButtonLocations();var r=this._buttonCenters.hClearance,i=this._buttonCenters.vClearance,s=r,o=i*CloudOS.SpringboardButtonView.prototype\n.ASPECT_RATIO,u=s/o,a;u>1?a=Math.ceil(o):a=Math.ceil(s),a=Math.min(142,a),this.buttonSizeDiscreteness&&(a=this.buttonSizeDiscreteness*Math.round(a/this.buttonSizeDiscreteness));for(var f=0,l,c;(c=this._buttonCenters[f])&&(l=this._displayButtons[f]);f++)!this.ANIMATE_LAYOUT||n?(l.stopAnimation(),l.setCenter(c.x,c.y,a)):l.animateCenter(c.x,c.y,a);this._isUpdating=NO},updateToAppsWhenAppropriate:function(){if(!this.get("layer"))return;if(this.getPath("buttonsContainer.isAnimating"))return;if(!this.get("isAllowedToGenerateButtons")){this._decideButtonLocations(this.getPath("apps.length")||0);return}var e=this.updateButtons()?"buttons changed":!1;e&&this.update(e)}.observes("apps","layer","isAllowedToGenerateButtons"),_globalVertOffsetsByColumnQuantity:[-5,-21,-20,-16,-18,function(e,t){return-18+Math.max(0,Math.min(18,(300-t)*18/108))}],maxSpreadDimensionsByColumnQuantity:[[Infinity,Infinity],[Infinity,1500],[767,1188],[[1320,1e3],null,null,null,[1320,Infinity]],[[1320,1e3],null,[1320,1120],[1320,1220],[1320,1320],[1320,Infinity]],[1500,1200],[1600,1400],[1700,1500],[1700,Infinity],[2e3,Infinity]],_decideButtonLocations:function(e,t){var n=this.get("frame"),r=n.width-this.ALL_FOUR_EDGE_SPACING*2,i=n.height-this.ALL_FOUR_EDGE_SPACING*2-this.TOP_INSET-this.BOTTOM_INSET,s=r/i;e===undefined&&(e=this._displayButtons.length);if(e===0)return;this._gridInfo=this._gridInfo||[],this._gridInfo.length=0;var o=1,u,a,f,l;for(var c=1;c<20;c++)o=c,f=Math.ceil(e/o),l=Math.ceil(e/f),a=r/(l+1)/(i/(f+1)),this._gridInfo[c]=a/CloudOS.SpringboardButtonView.prototype.ASPECT_RATIO;var h=Infinity,p=this._gridInfo\n.length,d;o=-1;for(c=0;c=4&&(u=2,o=Math.ceil(e/u)),t===undefined&&(t=this._forcedCols),t&&(o=t,u=Math.ceil(e/o)),this._rows=u,this._cols=o;var v=this.maxSpreadDimensionsByColumnQuantity;v=v&&v[o],v&&v[0].length&&(v=v[u]||v[u>=v.length?v.length-1:0]);var m=v&&v[0]||Infinity,g=v&&v[1]||Infinity,y=r,b=i;r=Math.min(y,m),i=Math.min(b,g);var w=this._globalVertOffsetsByColumnQuantity;w=w?w[Math.min(o,w.length-1)]||0:0,w instanceof Function&&(w=w.call(this,y,b));var E=this.ALL_FOUR_EDGE_SPACING+(y-r)/2,S=this.ALL_FOUR_EDGE_SPACING+this.TOP_INSET+(b-i)/2+w,x=this._buttonCenters||(this._buttonCenters=[]),T,N,C,k,L,A=CloudOS.get("isCloudOSLocaleRTLOriented");for(c=0;c0?SC.debug("Springboard: A wait condition became satisfied. Still waiting on "+t+" conditions. Requirement was: "+e):(SC.debug("Springboard: Springboard View has become ready to show! All of its wait conditions have been satisfied."),this._showing&&SC.debug("Springboard: Readiness is moot: Springboard is already showing."),this.invokeLast("forceReadiness"))},createButtonForApp:function(e,t){return CloudOS.SpringboardButtonView.buttonTypeForAppManager(e).create({springboardView:this,app:e},t||{})},setupButtonForApp:function(e,t){if(!e.get("isReady")){var n=t.get("name"),r="Button for "+n;this.addShowCondition(r),e.addObserver("isReady",this,function(){e.get("isReady")&&this.metShowCondition(r),this.invokeOnce(function(){var e=this.updateButtons();e&&this.update("buttons changed")})})}},createButtons:function(){var e=this.get("apps"),t,n,r=this._buttonsByName,i=this._allButtons,s,o;e?n=e.length:n=0;for(t=0;t0&&e.length===0&&this.metShowCondition("initial set of buttons");if(t.length!==e.length)return!0;for(n=0,r=t.length;ni?1:r===i?0:-1)},forceReadiness:function(){this.set("isReadyToShow",YES)},keyDown:function(e){if(!this._showing)return;var t=SC.FUNCTION_KEYS,n=SC.FUNCTION_KEYS[e.which]||SC.PRINTABLE_KEYS[e.which];return n==="right"&&this.focusRight(),n==="left"&&this.focusLeft(),n==="up"&&this.focusUp(),n==="down"&&this.focusDown(),(n==="return"||n===" ")&&this.activateFocusedButton(),e.allowDefault(),NO},currentFocus:NaN,_lastCurrentFocus:NaN,focusNone:function(){this.set("currentFocus",NaN)},focusRight:function(\n){var e=this.get("currentFocus");return isNaN(e)||e>=this._displayButtons.length-1?this.set("currentFocus",0):this.set("currentFocus",e+1)},focusLeft:function(){var e=this.get("currentFocus");return isNaN(e)||e<=0?this.set("currentFocus",this._displayButtons.length-1):this.set("currentFocus",e-1)},focusUp:function(){var e=this.get("currentFocus");if(e=(this._rows-1)*this._cols||e+this._cols>=this._displayButtons.length)return;return isNaN(e)?this.set("currentFocus",0):this.set("currentFocus",(e+this._cols)%this._displayButtons.length)},currentFocusObserver:function(){var e=this.get("currentFocus"),t=this._lastCurrentFocus;if(t===(this._lastCurrentFocus=e))return;!isNaN(t)&&this._displayButtons[t]&&this._displayButtons[t].set("isFocused",NO),!isNaN(e)&&this._displayButtons[e]&&this._displayButtons[e].set("isFocused",YES)}.observes("currentFocus"),activateFocusedButton:function(){var e=this.get("currentFocus");if(isNaN(e))return;var t=this._displayButtons[e];if(!t)return;t.mouseEntered("keyboard"),t.mouseDown("keyboard"),t.invokeLater(function(){this.mouseUp("keyboard"),this.mouseExited("keyboard")},100)},currentFocusedButton:function(){var e=this.get("currentFocus");return this._allButtons[e]}}),require("views/springboard_view"),function(){var e=!SC.browser.chrome||!SC.browser.windows;CloudOS.AppSwitcherPane=CW.PickerPane.extend(CW.Animatability\n).extend(e?CW.PaneAnimationSupport:{}).extend({layouts:["onBottom"],attributeBindings:["tabindex"],tabindex:"-1",layout:{left:-10,top:-10,width:2,height:2,opacity:0},desiredSize:{width:616,height:324},minimumSize:{width:616,height:324},desiredSizeMaxApps:{width:842,height:324},alsoScale:window.location.href.indexOf("animateAppSwitcher")!==-1,wantsAcceleratedLayer:YES,showingState:{opacity:1},hiddenState:{opacity:0},showDuration:200,hideDuration:350,firstShowDelay:1e3,acceptsKeyPane:YES,init:function(){this._originalHideDuration=this.hideDuration||this.duration,this.alsoScale&&(this.showingState.scale=1,this.hiddenState.scale=.9),arguments.callee.base.apply(this,arguments)},popup:function(){arguments.callee.base.apply(this,arguments),window.asv=this.contentView,window.asp=this,this.becomeKeyPane(),this.contentView.show(),this.contentView.becomeFirstResponder(),this.set("hideDuration",this._originalHideDuration)},chooseTransformOrigin:function(){this.alsoScale&&this.invokeLast("_chooseTransformOrigin")}.observes("layout","layer"),_chooseTransformOrigin:function(){var e=this.get("layer");if(!e)return;var t=this.$(".sc-pointer"),n;if(!t||!(t=t[0])||!(n=t.className)||typeof n!="string")return;if(n.indexOf("point-up")!==-1)return this._setTransformOrigin(t.offsetLeft+t.offsetWidth/2,t.offsetTop,e);if(n.indexOf("point-left")!==-1)return this._setTransformOrigin(t.offsetLeft,t.offsetTop+t.offsetHeight/2,e)},_setTransformOrigin:function(e,t,n){n||(n=this.get("layer")),n.style[SC.platform.domCSSPrefix+"TransformOrigin"]=Math.round(e)+"px "+Math.round(t)+"px"},paneDidHide:function(){CloudOS\n.statechart.sendAction("appSwitcherFinishedHiding"),CloudOS.appSwitcherController.set("isShowing",NO)},remove:function(){return e||this.invokeLast("paneDidHide"),arguments.callee.base.apply(this,arguments)},keyDown:function(e){if(!this.get("isVisibleInWindow")||!e)return;var t=SC.FUNCTION_KEYS[e.which]||SC.PRINTABLE_KEYS[e.which];t==="escape"&&!e.shiftKey&&CloudOS.appSwitcherController.hideAppSwitcher()},contentView:CloudOS.SpringboardView.extend({classNames:"app-switcher",isMiniSpringBoard:YES,MIN_INTER_BUTTON_SPACING:18,ALL_FOUR_EDGE_SPACING:25,TOP_INSET:-40,BOTTOM_INSET:-20,ANIMATE_LAYOUT:NO,buttonSizeDiscreteness:2,layout:{left:0,width:616,height:324,top:0},_globalVertOffsetsByColumnQuantity:null,maxSpreadDimensionsByColumnQuantity:null,useAnimationWhenShowing:NO,appIndicesBinding:"CloudOS.appController.appIndices",buttonsContainer:SC.View.extend(CW.Animatability,{ariaRole:"navigation",ariaLabel:"Toolbar.Tooltip.App.Switcher".loc()}),init:function(){this.FORCE_READINESS_TIME=this.getPath("owner.firstShowDelay")||1e3,arguments.callee.base.apply(this,arguments)},killParentDelay:function(){if(!this.get("isReadyToShow")||this._hasKilledParentDelay===(this._hasKilledParentDelay=YES))return;this.invokeLater("_killParentDelay",50)}.observes("isReadyToShow"),_killParentDelay:function(){var e=this.getPath("parentView._showTimer");if(!e)return;e.fire(),e.invalidate()},_sharedBadgeMeasurementCache:{},createButtonForApp:function(e){return arguments.callee.base.call(this,e,{ASPECT_RATIO:1/1.65,TITLE_SIZE_MULTIPLE:15/74,TITLE_TOP_MULTIPLE:170/142,SPINNER_SIZE_MULTIPLE:28/74,BADGE_H_PADDING\n:6,BADGE_V_PADDING:2,BADGE_RIGHT_INSET:-5,BADGE_TOP_INSET:-1,USE_TRANSFORM_SCALING:NO,USE_BORDER_ELEMENT:YES,USE_TITLE_HIGHLIGHT:YES,IS_INTENDED_FOR_SIGNIFICANT_DOWNSAMPLING:YES,mustShowRegardlessOfDynamicApp:YES,useExternalShadow:NO,mustHitTest:NO,_badgeMeasurementCache:this._sharedBadgeMeasurementCache,titleColor:{r:51,g:51,b:51},titleShadowSettings:{x:0,y:0,blur:0,r:0,g:0,b:0,opacity:0,opacityForIntensity:!1},action:function(){var e=this.get("pane");return e&&e.set("hideDuration",this.get("isCurrentApp")?e._originalHideDuration:0),arguments.callee.base.apply(this,arguments)},_adjustBadgeInfo:function(e){SC.browser.webkit&&e.countString[0]==="1"&&e.count>1&&e.left++}})},pruneAppList:function(e){e();var t=this.get("apps");t.unshift(this.get("dummyAppSwitcherHomeAppManager"));if(t.length>10){var n=this.get("pane"),r=n.get("desiredSizeMaxApps");n.set("desiredSize",r),n.set("minimumSize",r)}}.enhance(),dummyAppSwitcherHomeAppManager:function(){return this._dummyAppSwitcherHomeAppManager=CloudOS.AppManager.create({name:"",init:function(){this.set("appInfo",COS.AppInfo.create({displayName:function(){return"AppTitle.backToSpringboard".loc()}.property().cacheable()})),arguments.callee.base.apply(this,arguments),CW.notificationCenter.subscribeToNotification("relocalize",this,"relocalize")},relocalize:function(){this.get("appInfo").notifyPropertyChange("displayName")},appIconType:"home",appIconUrl:"/system/cloudos/1812Project43/cloudos_foundation/springboard/1812Project43/en-us/source/resources/images/launchpad_icon.png",appIconUrl2x:"/system/cloudos/1812Project43/cloudos_foundation/springboard/1812Project43/en-us/source/resources/images/launchpad_icon@2x.png"\n,warningArrowAsset:"data:image/gif;base64,R0lGODlhAQABAJAAAP///wAAACH5BAUQAAAALAAAAAABAAEAAAICBAEAOw==",index:-1})}.property().cacheable(),_buttonComparator:function(e,t){var n=this._dummyAppSwitcherHomeAppManager;return e===t?0:e.get("app")===n?1:t.get("app")===n?-1:arguments.callee.base.apply(this,arguments)},computeFinalDistanceAdjustment:function(e){var t=Math.max(.95,.95+7/1440+(1440-e.width)*16/490/100),n=this._finalDistanceAdjustment;return n.x=n.y=t,n},handleOnscreen:function(){this.set("isVisible",this.get("isOnscreen"))}.observes("isOnscreen"),show:function(){arguments.callee.base.apply(this,arguments),CW.notificationCenter.postNotification("redrawCalendarIconIfNecessary"),this.invokeLast(function(){var e=this.get("currentFocus");if(e){var t=this.currentFocusedButton();t&&t.$()&&t.$().focus()}else this.$()&&this.$().focus()})}})})}(),CloudOS.appSwitcherController=SC.Object.create({pane:function(){return CloudOS.AppSwitcherPane.create({dismissTarget:this,dismissAction:"didDismiss"})}.property().cacheable(),showAppSwitcher:function(e){var t=30,n=10;e||(e={left:70,top:10,width:150,height:100});var r=CloudOS.bannerManager;r.get("isBannerVisible")&&(e.top+=r.get("bannerHeight")),e.top+e.height1?2:4},USE_TITLE_HIGHLIGHT:NO,USE_BORDER_ELEMENT:NO,IS_INTENDED_FOR_SIGNIFICANT_DOWNSAMPLING:NO,requiresDownsampleableDerivative:SC.browser.msie>=9&&(window.devicePixelRatio||1)===1,mustShow:YES,titleColor:{r:255,g:255,b:255},titleShadowSettings:{r:0,g:0,b:0,x:0,y:7,blur:15,opacityForIntensity:function(e){return(e+2)/3*.25}},isCurrentApp:NO,isControl:YES,acceptsFirstResponder\n:function(){return this.get("ariaHidden")?NO:YES}.property("ariaHidden"),attributeBindings:["tabindex"],tabindex:function(){return this.get("acceptsFirstResponder")?"0":"-1"}.property("acceptsFirstResponder"),ariaHidden:function(){return this.get("springboardIsHidden")?YES:this.get("isDisabled")||this.get("isDecorativeDimmed")||this.get("isDimmed")?YES:NO}.property("isDisabled","isDecorativeDimmed","isDimmed","springboardIsHidden"),springboardIsHiddenBinding:"*springboardView.shouldHideForScreenReader",currentAppBinding:"CloudOS.appController.currentApp",isCurrentApp:function(){return this.get("app")===CloudOS.appController.get("currentApp")}.property("currentApp","app").cacheable(),makeTitleHighlightWhenCurrent:function(){if(!this.USE_TITLE_HIGHLIGHT)return;if(!this.get("isVisibleInWindow"))return;var e=this.get("layer");if(!e)return;var t=this.get("isCurrentApp"),n=this._titleHighlight;if(!n&&!t)return;n||(n=this._titleHighlight=document.createElement("div"),n.className="sb-title-highlight",n._in=NO),t?(n._in||e.appendChild(n),n._in=YES,this._titleHighlightWasSized||this.invokeLast("sizeTitleHighlightToTitleElement")):(n._in&&e.removeChild(n),n._in=NO)}.observes("isCurrentApp","isVisibleInWindow"),sizeTitleHighlightToTitleElement:function(){var e=this._titleText,t=this._title,n=this._titleHighlight;if(!t||!e||!n||!this.get("isVisibleInWindow"))return;this._titleHighlightWasSized=YES;var r=e.offsetWidth,i=e.offsetHeight,s=e.offsetTop+t.offsetTop,o=(this.get("size")||74)/2-r/2|0,u=10,a=5;n.style.left=o-u+"px",n.style.top=s-a+"px",n.style.height=i+2*a+"px",n.style.width=r+2*u+"px"\n},_badgeMeasurementCache:{},sizeBadge:function(){this.invokeLast("_sizeBadge")}.observes("isVisibleInWindow","layer"),_sizeBadge:function(){var e=this.get("badgeCount"),t=CloudOS.get("isCloudOSLocaleRTLOriented");if(!this.get("isVisibleInWindow")||!e||!this._badgeRed||!this._badgeMask)return;var n=this._badgeInfoHash||(this._badgeInfoHash={}),r=this._badgeRed.style,i=this._badgeMask.style,s=this._badgeText,o=this._badge,u=this.BADGE_H_PADDING,a=this.BADGE_V_PADDING,f,l,c;n.count=e,n.countString=e+"",l=n.countString.length,f=this._badgeMeasurementCache[l];if(!f){c=s.offsetWidth;if(!c){this._badgeSizeFallbackTimer?this._badgeSizeFallbackTimer=null:this._badgeSizeFallbackTimer=this.invokeLater("_sizeBadge",200);return}f=this._badgeMeasurementCache[l]={},f.top=n.top=s.offsetTop-a,f.left=n.left=s.offsetLeft+(t?s.offsetWidth:0)-u,f.width=n.width=c+u*2,f.height=n.height=s.offsetHeight+a*2}else n.top=f.top,n.left=f.left,n.width=f.width,n.height=f.height;this._badgeSizeFallbackTimer&&this._badgeSizeFallbackTimer.invalidate(),this._badgeSizeFallbackTimer=null,n.height>n.width&&(n.left-=(n.height-n.width)/2|0,n.width=n.height),this._adjustBadgeInfo(n),r.top=i.top=n.top+"px",t?(r.right=i.right=n.left+"px",r.removeProperty("left"),i.removeProperty("left")):(r.left=i.left=n.left+"px",r.removeProperty("right"),i.removeProperty("right")),r.width=i.width=n.width+"px",r.height=i.height=n.height+"px";var h=o.style,p=this.BADGE_RIGHT_INSET+n.left+n.width+"px";t?(h.left=p,h.removeProperty("right")):(h.right=p,h.removeProperty("left")),h.top=this.BADGE_TOP_INSET+n.top+"px"},_adjustBadgeInfo:function(\ne){SC.browser.mozilla&&e.top++,e.countString.length>1&&e.countString[0]!=="1"&&e.countString[e.countString.length-1]==="1"&&e.left--},init:function(){this.getPath("app.isDynamicallyLoaded")&&!this.mustShowRegardlessOfDynamicApp&&(this.mustShow=NO),arguments.callee.base.apply(this,arguments),this.wantsAcceleratedLayer=this.USE_TRANSFORM_SCALING,CW.notificationCenter.subscribeToNotification("relocalize",this,"relocalize")},USE_TRANSFORM_SCALING:!!SC.browser.chrome||!!SC.browser.mozilla,useExternalShadow:SC.browser.opera,mustHitTest:SC.browser.msie||SC.browser.opera,layout:{zIndex:15},classNames:"springboard-button-view".w(),ariaRole:"button",displayProperties:"titleColor titleShadowSettings isCurrentApp isDark size displayName isFocused x y isSpinning errorText isDarkTo app isUnclickable isShowingWarning isAnimatingWithParent iconElement titleIntensity isDecorativeDimmed isDecorativeDimmedOrUndimming badgeCount".w(),action:function(){var e=this.get("app"),t=CloudOS.statechart;if(!e)return;e.set("loadReason",CK.LOAD_REASON_USER_CLICK),CloudOS.appController.set("pendingApp",e),e.get("isPCSKeysDeletedLocked")?t.sendAction("showPCSDeletedMessage",e.get("displayName")):e.get("isHSALocked")?(CloudOS.authController.get("isPartiallyAuthenticated")&&CloudOS.appSwitcherController.hideAppSwitcher(),t.sendAction("showHSA",CloudOS.HSASourceEnum.USER_SELECTED_APP)):t.sendAction("userDidChooseApp")},size:142,x:0,y:0,isWaitingBinding:"*app.isWaiting",loadInBackgroundBinding:"*app.loadInBackground",displayNameBinding:"*app.appInfo.displayName",isFocused:NO,_lastIsFocused:NO,isActive:NO,appBadgeCountBinding\n:"*app.badgeCount",badgeCount:function(){return this.get("isDecorativeDimmedOrUndimming")||this.get("isLocked")?0:this.get("appBadgeCount")}.property("isDecorativeDimmedOrUndimming","appBadgeCount","isLocked"),layoutBoundsCacher:function(){if(this._layoutBounds)return this._layoutBounds;var e=this.get("springboardView"),t=e.get("layoutBounds");return t||(e._decideButtonLocations(),t=e.get("layoutBounds")),this._layoutBounds=t,t},_defaultLayoutBounds:{top:0,centerY:1,bottom:2,left:0,centerX:1,right:2},animatedLayoutBoundsCacher:function(){if(this._animatedLayoutBounds)return this._animatedLayoutBounds;var e=this.get("springboardView"),t=e.get("animatedLayoutBounds");return t||(e._decideButtonLocations(),t=e.get("animatedLayoutBounds")),this._animatedLayoutBounds=t,t},app:null,hitTest:function(e){if(isNaN(e.clientX)||isNaN(e.clientY))return YES;if(!this.convertPointToView(e))return NO;var t=this._pt_.x,n=this._pt_.y,r=this.get("frame");return r?t>=0&&t<=r.width&&n>=0&&n<=r.height:NO},mouseDown:function(e){if(e.metaKey||e.button===2||e.which==3)return e.allowDefault(),NO;this.set("isDown",YES),this.mustHitTest?this.hitTest(e)&&this.set("isActive",YES):this.set("isActive",YES)},mouseUp:function(e){var t=this.get("isActive")&&!this.get("isUnclickable");this.set("isActive",NO),this.set("isDown",NO),this.set("ignoreVirtualCursor",YES);if(!t)return;this.action();if(e!=="keyboard"){var n=this.get("springboardView");n&&n.focusNone&&n.focusNone()}},mouseMoved:function(e){if(!this.mustHitTest)return;var t=this.hitTest(e);this._lastIsOver!==t&&(this.set("isOver",this._lastIsOver=t),t?this\n.set("isActive",this.get("isDown")):this.set("isActive",NO))},mouseEntered:function(e){if(this.mustHitTest)return;this.get("isDown")&&this.set("isActive",YES),this.set("isOver",this._lastIsOver=YES)},mouseExited:function(){this.set("isActive",NO),this.set("isOver",this._lastIsOver=NO)},click:function(e){if(this.get("ignoreVirtualCursor"))return;this.mouseDown(e),this.mouseUp(e)},touchStart:function(e){return this.mouseEntered(e),this.mouseDown(e)},touchEnd:function(e){return this.mouseUp(e),this.mouseExited(e)},touchEntered:function(e){return this.mouseEntered(e)},touchExited:function(e){return this.mouseExited(e)},isDecorativeDimmedBinding:"*springboardView.isDecorativeDimmed",isSpinning:function(){return this.get("isWaiting")&&!this.get("loadInBackground")&&!this.get("isDecorativeDimmedOrUndimming")}.property("isWaiting","loadInBackground","isDecorativeDimmedOrUndimming"),isConventionallyDark:function(){return this.get("isActive")&&this.get("isDown")||this.get("isSpinning")}.property("isActive","isDown","isOver","isSpinning","isUnclickable").cacheable(),isFailedBinding:"*app.appInfo.isFailed",isDisabled:function(){var e=this.get("app");return e&&e.requiresMailAndIsMissing()?NO:this.getPath("app.isDisabled")}.property("app"),isDisabledObserver:function(){this.notifyPropertyChange("isDisabled")}.observes("*app.appInfo.isDisabled"),isLockedBinding:"*app.appInfo.isLocked",isHSALockedBinding:"*app.appInfo.isHSALocked",isPCSKeysDeletedLockedBinding:"*app.appInfo.isPCSKeysDeletedLocked",isUnqualifiedBinding:"*app.appInfo.isUnqualified",isDimmed:function(){return this.get("isDecorativeDimmedOrUndimming"\n)?NO:this.get("isUnqualified")}.property("isUnqualified","isDecorativeDimmedOrUndimming").cacheable(),isUnclickable:function(){return this.get("isDecorativeDimmedOrUndimming")?YES:this.get("isDimmed")?NO:this.get("isDisabled")}.property("isDisabled","isDimmed","isDecorativeDimmedOrUndimming"),isShowingWarning:function(){return this.get("isDecorativeDimmedOrUndimming")?NO:this.get("isDimmed")?NO:this.get("isDisabled")}.property("isDisabled","isDimmed","isDecorativeDimmedOrUndimming"),isDarkTo:function(){if(this.get("isDecorativeDimmedOrUndimming"))return 0;var e=this.get("isConventionallyDark"),t=this.get("isUnclickable"),n=this.get("isDimmed"),r;return!e&&!t&&!n&&(r=0),e&&!t&&!n&&(r=.28),!e&&t&&!n&&(r=.5),e&&t&&!n&&(r=.5),!e&&!t&&n&&(r=.5),e&&!t&&n&&(r=.7),!e&&t&&n&&(r=.5),e&&t&&n&&(r=.5),this.get("isLocked")&&(r=1-.58*(1-r)),r}.property("isConventionallyDark","isUnclickable","isDimmed","isDecorativeDimmedOrUndimming","isLocked"),isDecorativeUndimming:function(){return this.decorativeDimmingAnimationCount>0}.property("decorativeDimmingAnimationCount"),isDecorativeDimmedOrUndimming:function(){return this.get("isDecorativeDimmed")||this.get("isDecorativeUndimming")}.property("isDecorativeDimmed","isDecorativeUndimming").cacheable(),titleIntensity:function(){var e=this.get("isDimmed");return e?.25:1}.property("isDimmed"),_forceDisableChangeObserver:function(){this.invokeLast(function(){this.get("isDarkTo")===.5&&this.update()})}.observes("isDarkTo"),errorText:function(){return this.get("isUnclickable")?this.get("isDisabled")?this.getPath("app.isDisabledForMaintenance")?"Springboard.Icon.Maintenance"\n.loc():"Springboard.Icon.Offline".loc():"":""}.property("isUnclickable","isDisabled","isFailed"),stopAnimation:function(){return CW.Anim.tellFinish(this._enterAnimation),CW.Animatability.stopAnimation.apply(this,arguments)},detectAppends:function(){if(this._lastParentView===(this._lastParentView=this.get("parentView")))return;this._hasArrivedAtCoordsSinceLastAppend=NO}.observes("parentView"),setCenter:function(e,t,n){this.beginPropertyChanges(),this._hasArrivedAtCoordsSinceLastAppend=YES;var r=this._layoutBounds||this.layoutBoundsCacher(),i=this._positionSizeAnimation;i&&!i.running&&(i=null),isNaN(e)||(i&&i.removeProperty("x"),this.set("x",(e-r.left)/(r.right-r.left))),isNaN(t)||(i&&i.removeProperty("y"),this.set("y",(t-r.top)/(r.bottom-r.top))),isNaN(n)||(i&&i.removeProperty("size"),this.set("size",n)),this.endPropertyChanges()},animateCenter:function(e,t,n){var r=this._hasArrivedAtCoordsSinceLastAppend;this._hasArrivedAtCoordsSinceLastAppend=YES;var i=this.springboardView.isOnscreen;if(!i||this.get("isAnimatingWithParent"))return this.setCenter(e,t,n);if(!r){this.setCenter(e,t,n),i&&(this._enterAnimation=this.animate({duration:700,tween:CW.Anim.tweens.make("compound",function(e){return Math.max(0,e*10/7-3/7)},CW.Anim.tweens.WEBKIT_EASE),scale:{from:0,to:this.transformedScaleForSize(n)},opacity:{from:0,to:1}},{onstop:function(){this.view._enterAnimation=null}}));return}var s=this._layoutBounds||this.layoutBoundsCacher(),o={};isNaN(e)||(o.x=(e-s.left)/s.width),isNaN(t)||(o.y=(t-s.top)/s.height),isNaN(n)||(o.size=n);if(o.x||o.y||o.size)this._positionSizeAnimation=this.animateProperties\n(o,{speed:23,headStart:.002,inertia:8,ticked:4})},transformedScaleForSize:function(e){return this.USE_TRANSFORM_SCALING?e/142:1},getPxX:function(){var e=this._animatedLayoutBounds||this.animatedLayoutBoundsCacher(),t=this._layoutBounds||this.layoutBoundsCacher();return e.left.current+this.x*e.width.current*t.fullWidth},getPxY:function(){var e=this._animatedLayoutBounds||this.animatedLayoutBoundsCacher(),t=this._layoutBounds||this.layoutBoundsCacher();return e.top.current+this.y*e.height.current*t.fullHeight},fadersToKill:"mask focus arrow errorText decorBlur badge lockBadge".w(),finishAllAnimationExceptSpinner:function(){if(!this.get("isAnimatingWithParent"))return;this.finishAnimation();for(var e=0,t,n;t=this.fadersToKill[e];e++)n="_"+t+"Fader",CW.Anim.tellFinish(this[n]),this[n]=null}.observes("isAnimatingWithParent"),render:function(e){window["sb"+this.getPath("app.name").toLowerCase().substring(0,2)]=this,e.push(\'
\'+\'
\'+\'\'+(this.USE_BORDER_ELEMENT?\'
\':"")+(this.useExternalShadow?"":\'\'));var t=\nwindow.location,n=t.search,r="/";n&&(r=""),e.attr("href","https://"+t.hostname+t.search+r+"#"+this.getPath("app.name"))},parentViewDidResize:function(){arguments.callee.base.apply(this,arguments),this.invokeLast(function(){this.update("reposition")})},handleMissingIconElement:function(){var e,t=this.get("layer");if(!t)return;var n=!this.get("iconElement")&&this.get("isReady")&&!this.get("isDecorativeDimmed");CW.Anim.tellFinish(this._missingElementFader),e=this._missingElement,n?(e||(e=this._missingElement=document.createElement("div"),e.style.cssText="position:absolute; z-index:11; left:0px; right:0px; top:0px; bottom:0px; border-radius:24%; background:white; opacity:0;"),this._missingElementFader=CW.Anim.Fader.create({element:e,to:1,duration:200}).start(),e.parentNode!==t&&e.parentNode&&e.parentNode.removeChild(e),e.parentNode===t||t.appendChild(e)):(e&&e.parentNode===t?this._missingElementFader=CW.Anim.Fader.create({element:e,to:0,duration:200,cleanup:function(){e.parentNode.removeChild(e)}.listens("stop")}).start():e&&e.parentNode&&e.parentNode.removeChild(e),this._missingElement=null)}.observes("layer","iconElement","isReady","isDecorativeDimmed"),darkenMissingIconElement:function(){if(!this._missingElement)return;var e=255-(this.get("isDarkTo")||0)*255;this._missingElement.style.backgroundColor=CW.Anim.encodeColor(e,e,e)}.observes("isDarkTo"),maintainDownsampleableDerivative:function(){if(!this.IS_INTENDED_FOR_SIGNIFICANT_DOWNSAMPLING||!this.requiresDownsampleableDerivative)return;var e=this.get("layer");if(!e)return;var t=this.get("iconElement"),n=this._iconCanvas||t,r=\nthis._downsampleableDerivative;r&&r._isForIconElement!==SC.guidFor(t)&&(t&&(t.style.visibility=""),r.parentNode&&r.parentNode.removeChild(r),r=this._downsampleableDerivative=null),t?(this._downsampleableDerivativeTimer&&this._downsampleableDerivativeTimer.invalidate(),this._downsampleableDerivativeTimer=this.invokeLater("ensurePresenceOfDownsampleableDerivative",Math.random()*15+15|0,r,t,n,e)):(r&&r.parentNode&&r.parentNode.removeChild(r),r=this._downsampleableDerivative=null,this._downsampleableDerivativeTimer&&this._downsampleableDerivativeTimer.invalidate())}.observes("layer","iconElement","size"),ensurePresenceOfDownsampleableDerivative:function(e,t,n,r){var i=142,s;if(!e){var o=new Date*1;e=this._downsampleableDerivative=document.createElement("canvas"),e._isForIconElement=SC.guidFor(t),e.className="downsampleable-derivative sb-icon sb-el",e.width=e.height=i,s=e.getContext("2d"),s.drawImage(n,0,0,i,i),CloudOS.canvasBoxBlur(e,1,1),s.globalAlpha=.5,s.drawImage(n,0,0,i,i),s.globalAlpha=1,o=new Date*1-o,SC.debug("Spent "+o+"ms creating new downsampleable derivative of "+this.getPath("app.name")+" icon.")}e.parentNode&&e.parentNode!==r&&e.parentNode.removeChild(e),e.parentNode||r.appendChild(e),e.style.left=e.style.top="0px",e.style.width=e.style.height=this.get("size")+"px",t.style.visibility="hidden",e.style.visibility="visible"},update:function(e){var t,n;e&&e.setClass?t=e:(n=e,t=this.renderContext(this.get("layer")).$());if(!this._layer)return;var r=this,i=this._layer,s=NO,o=this.get("isAnimatingWithParent"),u=this._decorBlurs?this._lastSeenDecorBlurCount!==(this._lastSeenDecorBlurCount=\nthis._decorBlurs.length):NO,a=NO,f,l,c,h,p,d,v,m,g,y,b,w,E,S,x,T,N,C,k,L,A,O,M,_,D,P,H,B,j,F,I;this.$().attr("aria-labelledby",SC.guidFor(this)+"-label"),t.setClass("current-app",this.get("isCurrentApp")),k=this.get("iconElement"),L=this._lastIconElement,k&&k.parentNode!==i&&(s=YES,L&&L!==k&&L.parentNode&&L.parentNode.removeChild(L),L=this._lastIconElement=k,jQuery(k).addClass("sb-icon").addClass("sb-el"),k.parentNode||i.appendChild(k)),!k&&L&&L.parentNode&&L.parentNode.removeChild(L),this.useExternalShadow&&!this._isExternalShadowRemovalPermanent&&((g=this._externalShadow)||(g=new Image,this._externalShadow=g,g.className="sb-external-shadow",g.setAttribute("aria-hidden","true")),!g.parentNode&&i.parentNode&&i.parentNode.appendChild(g));if((c=this.didChangeFor("update","isDecorativeDimmed"))||s){N=this.get("app"),_=this.get("isDecorativeDimmed"),this._decDimAnimTrackingOptions||(this._decDimAnimTrackingOptions={owner:this,inc:function(){isNaN(this.owner.decorativeDimmingAnimationCount)&&(this.owner.decorativeDimmingAnimationCount=0),this.owner.incrementProperty("decorativeDimmingAnimationCount")}.listens("start"),dec:function(){this.owner.decorativeDimmingAnimationCount>0&&this.owner.decrementProperty("decorativeDimmingAnimationCount")}.listens("stop")}),c&&(this._titleFader=CW.Anim.Fader.create(CW.Anim.DisplayNoneAtZero,this._decDimAnimTrackingOptions,{element:this._title,to:1-_,duration:_?0:550}).start(),this._shadowFader=CW.Anim.Fader.create(CW.Anim.DisplayNoneAtZero,this._decDimAnimTrackingOptions,{element:this._shadow||this._externalShadow,to:1-_,duration:_?0:550}).start\n());if(_&&!this._decorBlurs){this._createNextDecorBlur();if(this._decorBlurs){u=YES;for(var q=0;q.5?"none":"",r.style.display=o>.5?"":"none"):(n.style.opacity=1-Math.pow(o,1.6),r.style.opacity=1-Math.pow(1-o,1.6))},onfinish:function(){for(var e=0\n,t;t=this.blurs[e];e++)t.parentNode&&t.parentNode.removeChild(t);k.style.display="",k.style.zIndex="",k.style.opacity=""},onstop:function(){this.owner._decorBlurFader=null}}).start())}if(this.didChangeFor("update","isLocked")||this.didChangeFor("update","isDecorativeDimmedOrUndimming")){var R=this._lockBadge,U=this.get("isLocked")&&!this.get("isDecorativeDimmedOrUndimming"),z,W=NO;U&&(R||(R=this._lockBadge=document.createElement("div"),R.appendChild(z=this._lockImage=new Image),z.onload=function(){R._isLoaded=YES},z.src=this.getPath("app.lockBadgeAsset"),R.className="sb-lock-badge sb-el",R.style.opacity=0,i.appendChild(R)),W=YES),R&&(this._lockBadgeFader=CW.Anim.Fader.create(CW.Anim.DisplayNoneAtZero,{element:R,to:0+U,duration:o?0:300,shouldSkipFrame:function(){return!this.element._isLoaded}}).start())}if((A=this._lastIsDarkTo)!==(this._lastIsDarkTo=this.get("isDarkTo"))||s){var X=180;x=this.get("isDarkTo"),Math.abs((1-x)/(1-A)-.6)<1e-7&&(X=0),A===0&&x===.28&&(X=0),A===.5&&x===.7&&(X=0),o&&(X=0),CW.Anim.tellStop(this._maskFader),!!x&&!this._mask&&k&&(a=YES,this.createMaskElementFromIconElement()),this._mask&&(this._maskFader=CW.Anim.Fader.create(CW.Anim.DisplayNoneAtZero,{owner:this,element:this._mask,to:x,duration:X,renderBadgeOpacityAlso:function(){var e=this.owner._badgeMask;if(!e)return;CW.Anim.setOpacity(e,this.current)}.listens("frame")}).start())}f=this.didChangeFor("update","size"),l=this.didChangeFor("update","isSpinning");if(a||u||s||W||f||l){h=this.USE_TRANSFORM_SCALING?142:this.get("size");if(d=k&&k.style)d.width=d.height=Math.round(h)+"px";if(d=this._mask&&this.\n_mask.style)d.width=d.height=Math.round(h)+"px";if(d=this._shadow&&this._shadow.style)d.width=d.height=Math.round(y=h*this.SHADOW_SIZE_MULTIPLE)+"px",d.left=Math.round(b=Math.floor((h-y)/2))+"px",d.top=Math.round(b+h*this.SHADOW_DROP_RATIO)+"px";(d=this._warningArrow.style).width=Math.round(h*this.ARROW_WIDTH_MULTIPLE)+"px",d.height=Math.round(h*this.ARROW_HEIGHT_MULTIPLE)+"px",d.left=Math.round(h*this.ARROW_LEFT_MULTIPLE)+"px",d.top=Math.round(h*this.ARROW_TOP_MULTIPLE)+"px",(d=this._lockBadge&&this._lockBadge.style)&&(v=this._lockImage&&this._lockImage.style)&&(d.width=v.width=Math.round(h*this.LOCK_WIDTH_MULTIPLE)+"px",d.height=v.height=Math.round(h*this.LOCK_HEIGHT_MULTIPLE)+"px",d.left=Math.round(h*this.LOCK_LEFT_MULTIPLE)+"px",d.top=Math.round(h*this.LOCK_TOP_MULTIPLE)+"px"),(d=this._title.style).width=Math.round(h+60)+"px",d.height=Math.ceil(1.3*this.TITLE_SIZE_MULTIPLE*h)+"px",d.top=Math.round(this.TITLE_TOP_MULTIPLE*h)+"px",d.fontSize=Math.round(this.TITLE_SIZE_MULTIPLE*h)+"px",(d=this._errorText.style).width=Math.round(h)+"px",d.height=Math.ceil(1.3*this.ERROR_SIZE_MULTIPLE*h)+"px",d.top=Math.round(this.ERROR_TOP_MULTIPLE*h)+"px",d.fontSize=Math.round(this.ERROR_SIZE_MULTIPLE*h)+"px";if(this._decorBlurs)for(P=0;H=this._decorBlurs[P];P++)(d=H.style).width=d.height=Math.ceil(H._finalSize*h/142)+"px",d.left=d.top=Math.round(h/2-Math.ceil(H._finalSize*h/142)/2)+"px";this.get("isSpinning")&&((d=this._spinner.style).width=d.height=(this._spinnerSize=w=Math.round(this.SPINNER_SIZE_MULTIPLE*h))+"px",d.left=d.top=Math.round(h-w)/2+"px",(d=this._spinnerImage.style).width=w+"px"\n,d.height=w*(this._spinnerAssetFrameCount=this.getPath("app.spinnerAssetFrameCount"))+"px"),p=this.get("size")/142,this.USE_TRANSFORM_SCALING&&this.adjust("scale",p)}p||(p=this.get("size")/142),t.setClass("large-display-text",21*p>=20);if(n==="reposition"||f||this.didChangeFor("update","x","y")){var V=this.getPxY(),$=this.getPxX();!isNaN($)&&!isNaN(V)&&(this.adjust(m={top:Math.round(V-(T=Math.round((h=this.USE_TRANSFORM_SCALING?142:this.get("size"))/2))),left:Math.round($-T),width:Math.round(h),height:Math.round(h)}),this.useExternalShadow&&((d=this._externalShadow.style).width=d.height=(y=h*this.SHADOW_SIZE_MULTIPLE)+"px",d.left=(b=Math.floor((h-y)/2))+m.left+"px",d.top=b+h*this.SHADOW_DROP_RATIO+m.top+"px"))}this.didChangeFor("update","app")&&(N||(N=this.get("app")))&&(this._warningArrow.src=N.get("warningArrowAsset"),this._spinnerImage.src=N.get("spinnerAsset"),this._shadow&&(this._shadow.src=N.get("shadowAsset")),this._externalShadow&&(this._externalShadow.src=N.get("shadowAsset"))),this.didChangeFor("update","displayName")&&(C=this.get("displayName"))&&(this._titleText.innerHTML=C,this._titleHighlightWasSized=NO,this.invokeLast("sizeTitleHighlightToTitleElement"));if(this.didChangeFor("update","errorText")||n==="relocalization")this._errorText.innerHTML=this.get("errorText");this.didChangeFor("update","isFocused")&&this._lastIsFocused!==(this._lastIsFocused=this.get("isFocused"))&&this.$()[0].focus(),this.didChangeFor("update","isShowingWarning")&&this._lastisShowingWarning!==(this._lastisShowingWarning=this.get("isShowingWarning"))&&(this._arrowFader=CW.Anim.Fader.create\n(CW.Anim.DisplayNoneAtZero,{element:this._warningArrow,to:0+(M=this.get("isShowingWarning")),duration:o?0:M?300:300}).start(),this._errorTextFader=CW.Anim.Fader.create(CW.Anim.DisplayNoneAtZero,{element:this._errorText,to:0+(M=this.get("isShowingWarning")),duration:o?0:M?300:300}).start());if(this.didChangeFor("update","titleIntensity","titleColor","titleShadowSettings")){var J=this.get("titleIntensity"),K=this.get("titleColor"),Q=this.get("titleShadowSettings");this._title.style.color="rgba("+K.r+","+K.g+","+K.b+","+J+")",SC.browser.isIE9OrLower||(this._title.style.textShadow=Q.x+"px "+Q.y+"px "+Q.blur+"px "+"rgba("+Q.r+","+Q.g+","+Q.b+","+(Q.opacityForIntensity?Q.opacityForIntensity(J):Q.opacity)+")")}if(this.didChangeFor("update","badgeCount")||n==="relocalization")j=this.get("badgeCount"),j&&(B=j>9999?"9999+":j,this._badgeText.innerHTML=B,F=j>1?"Badge.Count.Unit.Plural":"Badge.Count.Unit.Singular",this._screenReaderText.innerHTML=", "+B+" "+F.loc(),this.invokeLast("sizeBadge")),this._badgeFader=CW.Anim.Fader.create(CW.Anim.DisplayNoneAtZero,{element:this._badge,to:j?1:0,duration:c?600:300}).start();if(l||this.didChangeFor("update","isAnimatingWithParent"))(E=this.get("isSpinning"))&&!o?(this._spinnerAnim||(this._spinnerAnim=CW.Animation.create({view:this,signal:function(e){return Math.round(e*12)%12},speed:1,name:"spinnerAnim"+this.toString(),update:function(){if(this._lastTop===(this._lastTop=this.current))return;CW.SpinnerView.renderPosition(this.current,this.view._spinnerSize,this.view._spinnerAssetFrameCount,this.view._spinnerImage)},onstart:function(){this.view._spinner\n.style.display="block",this.spinFader=CW.Fader.create({element:this.view._spinner,to:1,duration:0,name:"spinnerAnim"+this.toString()}).start()},fadeStop:function(){this.spinFader=CW.Fader.create({element:this.view._spinner,to:0,duration:500,owner:this,onfinish:function(){this.owner.stop()}}).start()},onstop:function(){this.view._spinner.style.display="none",this.spinFader&&this.spinFader.stop(),CW.Anim.setOpacity(this.view._spinner,0)}})),this._spinnerAnim.start()):this._spinnerAnim&&(!E&&!o&&this._spinnerAnim.fadeStop(),o&&this._spinnerAnim.stop());this._lastUpdateCompletion=CW.Anim.now-1},updateIfNotUpdatedLastFrame:function(e){var t=CW.Anim.frameTime;(isNaN(this._lastUpdateCompletion)||CW.Anim.now>this._lastUpdateCompletion+t)&&this.update(e)},_createNextDecorBlur:function(){if(this._decorBlurFader&&this._decorBlurs){var e=this;return}var t=this.DECOR_BLUR_DERIVATIVES[this._decorBlurs&&this._decorBlurs.length||0];if(!t)return;var n=this.generateBlurredIconDerivative(t,undefined);if(!n)return;var r=this._decorBlurs||(this._decorBlurs=[]);r.push(n),r.sort(this._sorterForDecreasingBlurRadius)},_sorterForDecreasingBlurRadius:function(e,t){return(t&&t._blurRadius||0)-(e&&e._blurRadius||0)},relocalize:function(){this.update("relocalization")},didCreateLayer:function(){if(!this.get("layer"))return;this._getPointers(),this._doInitialInlineCSS(),this.update()},_getPointers:function(){this._layer=this.get("layer"),this._spinner=this.$(".sb-spinner")[0],this._spinnerImage=this.$(".sb-spinner-image")[0],this._focus=this.$(".sb-focus")[0],this._warningArrow=this.$(".sb-arrow")[0],this\n._errorText=this.$(".sb-error-text")[0],this._title=this.$(".sb-title")[0],this._titleText=this.$(".sb-title-text")[0],this._badge=this.$(".sb-badge")[0],this._badgeText=this.$(".sb-badge .text")[0],this._badgeMask=this.$(".sb-badge .mask")[0],this._badgeRed=this.$(".sb-badge .red")[0],this._screenReaderText=this.$(".sb-ax-text")[0],this._shadow=(this._shadow=this.$(".sb-shadow"))&&this._shadow[0]},_doInitialInlineCSS:function(){this._layer.style.overflow="visible",this._spinner.style.display="none";var e="focus spinner warningArrow errorText badge badgeMask".w();for(var t=0,n;n=this["_"+e[t]];t++)CW.Anim.setOpacity(n,0)},willRemoveFromParent:function(){this.removeExternalShadow()},removeExternalShadow:function(e){this._externalShadow&&this._externalShadow.parentNode&&this._externalShadow.parentNode.removeChild(this._externalShadow),e&&(this._isExternalShadowRemovalPermanent=YES)},getLayerPositionInWindow:function(){var e=this._layerPos||(this._layerPos_={}),t=this.get("frame");return e.x=t.x,e.y=t.y,e},convertPointToView:function(e,t){var n,r;if(!this.getLayerPositionInWindow())return;return typeof e=="object"&&t===undefined&&(typeof e.clientX=="number"?(t=e.clientY,e=e.clientX):(t=e.y,e=e.x)),(n=this._pt_||(this._pt_={})).x=e-(r=this._layerPos_).x,n.y=t-r.y,n},fancyRemoveFromParent:function(){this.removeExternalShadow(YES);if(SC.browser.msie)return this.removeFromParent();if(!this.getPath("springboardView.isReadyToShow"))return this.removeFromParent();if(this._fancyRemovalAnim)return;this._fancyRemovalAnim=this.animate({opacity:0,scale:0,duration:700},{pull:function(){this\n.view._fancyRemovalAnim=null,this.view.removeFromParent(),this.view.adjust({opacity:1,scale:1})}.listens("stop")})},safeDrawImage:function(e){var t=arguments,n=t.length,r,i=this._drawImageFault=NO;if(n===4)try{e.drawImage(t[1],t[2],t[3])}catch(s){r=s}if(n===6)try{e.drawImage(t[1],t[2],t[3],t[4],t[5])}catch(s){r=s}if(n===10)try{e.drawImage(t[1],t[2],t[3],t[4],t[5],t[6],t[7],t[8],t[9])}catch(s){r=s}return r?(this._drawImageFault=i=r,SC.warn("DrawImage failed. Perhaps an image was incompletely loaded? Error text: "+r),NO):YES},createMaskElementFromIconElement:function(){var e=this.get("layer"),t=this.get("iconElement");if(!e||!t)return;var n=this._mask;n&&n.parentNode&&n.parentNode.removeChild(n),n=this._mask=this.generateMaskElement(),e.appendChild(n)},generateMaskElement:function(e){var t,n,r;e||(e=this.get("iconElement"));if(!e||e.tagName==="IMG"&&!e._complete)return this._generateFallbackMaskElement();var i=e.naturalWidth||e.width||142*(window.devicePixelRatio||1),s=e.naturalHeight||e.height||142*(window.devicePixelRatio||1),o="maskForButton"+SC.guidFor(this),u=CloudOS.SpringboardView._maskCache||(CloudOS.SpringboardView._maskCache={}),a=u[o]||(u[o]={});if(a.isReady){r=document.createElement("canvas"),r.width=i,r.height=s;if(!this.safeDrawImage(r.getContext("2d"),a.can,0,0))return this._generateFallbackMaskElement()}else{r=t=document.createElement("canvas"),t.width=i,t.height=s,n=t.getContext("2d"),n.fillStyle="black",n.fillRect(0,0,i,s),n.globalCompositeOperation="destination-in";if(!this.safeDrawImage(n,e,0,0,i,s))return this._generateFallbackMaskElement();a.can=t||n.canvas\n,a.con=n,a.isReady=YES}return r.style.display="none",r.style.opacity=0,r.className="sb-mask sb-el",r},_generateFallbackMaskElement:function(){var e="";(window.devicePixelRatio||1)>1&&(e="");var t=new Image;return t.style.cssText="display:none; opacity:0;",t.src=e,t.className="sb-mask sb-el",t},generateBlurredIconDerivative:function(e,t){var n,r,i,s=new Date*1;t||(t=this.get("iconElement"));if(!t||t.tagName==="IMG"&&!t._complete)return null;e=Math.round(e||0);var o=e<=1?1:e<=6?2:e<=12?3:4,u=this.DECOR_BLUR_MAX_DOWNSAMPLE_RATIOS[e];u&&u1?this.get("appIconUrl2x"):this.get("appIconUrl"),t=URI(e);return t&&!t.domain()&&t.protocol()!=="data"?"https://"+window.location.hostname+e:e}.property("appIconUrl","appIconUrl2x").cacheable(),iconElement:null,iconDidLoad:function(){var e=this._iconAssetVessel;this.set("iconElement",e),e&&e.width&&this.set("isReady",YES)},iconDidErr:function(){this.set("isReady",YES)},prepareIcon:function(){var e=this.get("icon");if(this._lastIcon===(this._lastIcon=e)||!e)return;var t=this,n;n=this._iconAssetVessel=new Image,n._complete=NO,n._onload=function(){t._iconAssetVessel===this&&SC.run(function(\n){t.iconDidLoad()})},n.onload=function(){this._complete=YES,this._onload()},n.onerror=function(){this._complete=NO,t._iconAssetVessel===this&&SC.run(function(){t.iconDidErr()})},setTimeout(function(){if(t.get("isReady"))return;t.set("isReady",YES)},4e3),n.src=e,n.alt=""}.observes("icon")}),CloudOS.SpringboardButtonView.BUTTON_TYPES.image=CloudOS.SpringboardImageButtonView,function(){var e=window.devicePixelRatio>1?2:1;CloudOS.SpringboardCalendarButtonView=CloudOS.SpringboardImageButtonView.extend({shouldUseStaticImage:!1,requiresDownsampleableDerivative:(SC.browser.chrome||SC.browser.mozilla)&&e===1||CloudOS.SpringboardImageButtonView.prototype.requiresDownsampleableDerivative,_appendCanvas:!SC.browser.webkit,appIconSize:function(){return 142*e}.property().cacheable(),appIconPadding:21,desiredIconTextWidth:function(){var e=this.get("appIconSize"),t=this.get("_appIconPaddingAdjustedForDPR");return e-t*2}.property("appIconSize","_appIconPaddingAdjustedForDPR").cacheable(),weekdayFontFamily:"SFNSText",monthdayFontFamily:"SFNSDisplay-Numbers",weekdayFontWeight:"400",monthdayFontWeight:"300",weekdayMaxFontSize:26,monthdayMaxFontSize:91,weekdayTextColor:"#FF3B30",monthdayTextColor:"#030303",distanceFromTopToDrawWeekday:39,distanceFromTopToDrawMonthday:83,init:function(){this.staticIcon="_Springboard.CalendarTileStatic.Asset".loc(),this.get("shouldUseStaticImage")&&(this.icon=this.staticIcon);var e=this;CW.fontDetector(this.get("monthdayFontFamily"),{success:function(){e._fontLoaded()},fail:function(){e._fontNotLoaded()},timeout:3e3,testString:"1518"}),arguments.callee.base.apply(this\n,arguments);var t=CW.notificationCenter;t.subscribeToNotification("relocalize",this,"relocalize"),t.subscribeToNotification("redrawCalendarIconIfNecessary",this,"redrawCalendarIconIfNecessary"),t.subscribeToNotification("setCalendarIconDateForDebugging",this,"setCalendarIconDateForDebugging")},setCalendarIconDateForDebugging:function(e){this.customDateForDebugging||(this.customDateForDebugging=new Date),this.customDateForDebugging.setDate(e),this.redrawCalendarIconIfNecessary()},relocalize:function(){this.set("staticIcon","_Springboard.CalendarTileStatic.Asset".loc()),this.get("shouldUseStaticImage")&&this.set("icon",this.staticIcon),this.set("_isLocDifferentSinceLastDraw",!0)},isIconLoaded:!1,isMonthdayFontLoaded:!1,iconDidLoad:function(){this.set("isIconLoaded",!0),this.drawIconIfReady()},drawIconIfReady:function(){if(this.get("isMonthdayFontLoaded")&&this.get("isIconLoaded")){if(this.get("shouldUseStaticImage"))this._revertToStaticIcon();else{var e=this._iconAssetVessel,t,n,r,i=this.get("appIconSize");if(t=this._iconCanvas)t.width=t.height=1;t=this._iconCanvas=document.createElement("canvas"),n=this._iconContext=t.getContext("2d"),t.width=t.height=i,this._appendCanvas&&this.get("iconElement")!==t&&this.set("iconElement",t),this._paintIconAndScheduleUpdate()}this.set("isReady",YES),CW.notificationCenter.postNotification("calendarIconFinishedDrawing")}},redrawCalendarIconIfNecessary:function(){var e;if(!this._iconAssetVessel)return;if(this.get("shouldUseStaticImage")){this._revertToStaticIcon();return}!this.get("_isLocDifferentSinceLastDraw")&&!this.get("isDayDifferentSinceLastDraw"\n)&&(this.set("isReady",YES),CW.notificationCenter.postNotification("calendarIconFinishedDrawing")),date=this.get("customDateForDebugging")||new Date;var t=date.getDay(),n;switch(t){case 0:n="Sunday";break;case 1:n="Monday";break;case 2:n="Tuesday";break;case 3:n="Wednesday";break;case 4:n="Thursday";break;case 5:n="Friday";break;case 6:n="Saturday"}var r=("CalendarIcon."+n).loc(),i=date.getDate(),s=this.get("_lastPaintedWeekday"),o=this.get("_lastPaintedMonthday");if(s===r&&o===i)this.set("isReady",YES),CW.notificationCenter.postNotification("calendarIconFinishedDrawing");else try{this._drawIcon(date,r,i)}catch(e){SC.warn(e),this._revertToStaticIcon()}}.observes("_isLocDifferentSinceLastDraw"),generateMaskElement:function(e){return arguments.callee.base.call(this,e||this._iconCanvas)},generateBlurredIconDerivative:function(e,t){return arguments.callee.base.call(this,e,t||this._iconCanvas)},_appIconPaddingAdjustedForDPR:function(){return this.get("appIconPadding")*e}.property("appIconPadding").cacheable(),_weekdayMaxFontSizeAdjustedForDPR:function(){return this.get("weekdayMaxFontSize")*e}.property("weekdayMaxFontSize").cacheable(),_monthdayMaxFontSizeAdjustedForDPR:function(){return this.get("monthdayMaxFontSize")*e}.property("monthdayMaxFontSize").cacheable(),_distanceFromTopToDrawWeekdayAdjustedForDPR:function(){return this.get("distanceFromTopToDrawWeekday")*e}.property("distanceFromTopToDrawWeekday").cacheable(),_distanceFromTopToDrawMonthdayAdjustedForDPR:function(){return this.get("distanceFromTopToDrawMonthday")*e}.property("distanceFromTopToDrawMonthday").cacheable()\n,_isLocDifferentSinceLastDraw:!0,_isDayDifferentSinceLastDraw:function(){var e=new Date,t=e.getDay()==this.get("_lastPaintedZeroBasedWeekdayInteger"),n=e.getDate()==this.get("_lastPaintedMonthday"),r=e.getFullYear()==this.get("_lastPaintedYear");return!t||!n||!r}.property("_lastPaintedZeroBasedWeekdayInteger","_lastPaintedMonthday","_lastPaintedYear"),_lastPaintedWeekday:"",_lastPaintedZeroBasedWeekdayInteger:null,_lastPaintedMonthday:"",_lastPaintedYear:null,_fontLoaded:function(){this.set("isMonthdayFontLoaded",!0),this.drawIconIfReady()},_fontNotLoaded:function(){SC.warn("Unable to load monthday font for Calendar icon"),CloudOS.recordStat("CalendarIconUnableToLoad",{error:"Unable to load monthday font for Calendar icon",appName:"CloudOS",isFatal:!1}),this.set("shouldUseStaticImage",!0),this.set("isMonthdayFontLoaded",!0),this.drawIconIfReady()},_paintIconAndScheduleUpdate:function(){this.redrawCalendarIconIfNecessary();var e=this.customDateForDebugging||new Date*1,t=(new Date).getTimezoneOffset()*6e4,n=Math.ceil((e-t)/864e5)*864e5-(e-t),r=this;this._daySwitchTimer&&this._daySwitchTimer.invalidate(),this._daySwitchTimer=SC.Timer.schedule({action:function(){r._paintIconAndScheduleUpdate()},interval:n+1,repeats:NO})},_revertToStaticIcon:function(){if(this.get("isIconLoaded")){var e=new Image;e.src=this.get("staticIcon"),e._complete=YES,this.set("iconElement",e),this._iconCanvas&&this._iconCanvas.parentNode&&this._iconCanvas.parentNode.removeChild(this._iconCanvas),CW.notificationCenter.postNotification("calendarIconFinishedDrawing")}},_drawIcon:function(e,t,n){CW.notificationCenter\n.postNotification("calendarIconWillRedraw");var r,i=this._iconAssetVessel,s=this._iconCanvas,o=this._iconContext;if(!i._complete||!i.width||!i.height||!s||!o)throw r="Calendar background is not downloaded. Reverting to static image.",CloudOS.recordStat("CalendarIconUnableToLoad",{error:"Unable to download background image for Calendar icon",appName:"CloudOS",isFatal:!1}),r;s.width=0+s.width,this._drawBase(),this._drawWeekday(t),this._drawMonthday(n);if(!this._appendCanvas){var u=this.get("iconElement");u||(u=new Image,u.owner=this,u.onload=function(){this.owner.set("iconElement",this)}),u.src=s.toDataURL()}this.set("_isLocDifferentSinceLastDraw",!1),this.set("_isDayDifferentSinceLastDraw",!1),this.set("_lastPaintedZeroBasedWeekdayInteger",e.getDay()),this.set("_lastPaintedWeekday",t),this.set("_lastPaintedMonthday",n),this.set("_lastPaintedYear",e.getFullYear())},_drawBase:function(){var e=0,t=0,n=this.get("appIconSize"),r=n;this._iconContext.drawImage(this._iconAssetVessel,e,t,n,r,0,0,n,r)},_drawWeekday:function(t){var n=this.get("appIconSize"),r=this.get("_distanceFromTopToDrawWeekdayAdjustedForDPR"),i=this.get("desiredIconTextWidth"),s=this.get("weekdayFontFamily"),o=this.get("weekdayFontWeight"),u=this.get("_weekdayMaxFontSizeAdjustedForDPR"),a=this._iconContext,f=u;a.font=o+" "+f+"px "+s;var l=a.measureText(t).width;if(l===0)throw error="Width of weekday string was 0, reverting to static icon",CloudOS.recordStat("CalendarIconUnableToLoad",{error:"Calendar icon weekday string was too short.",appName:"CloudOS",isFatal:!1}),error;while(l>=i)f-=1,a.font=o+" "+f+"px "+s,l=a.\nmeasureText(t).width;if(f<5*e)throw error="Weekday string is too long, reverting to static icon",CloudOS.recordStat("CalendarIconUnableToLoad",{error:"Calendar icon weekday string was too long.",appName:"CloudOS",isFatal:!1}),error;a.textAlign="center",a.fillStyle=this.get("weekdayTextColor"),a.fillText(t,n/2,r)},_drawMonthday:function(t){var n=this.get("appIconSize"),r=this.get("_distanceFromTopToDrawMonthdayAdjustedForDPR"),i=this.get("desiredIconTextWidth"),s=this.get("monthdayFontFamily"),o=this.get("monthdayFontWeight"),u=this.get("_monthdayMaxFontSizeAdjustedForDPR"),a=this._iconContext,f=u;a.font=o+" "+f+"px "+s;var l=a.measureText(t).width;if(l===0)throw error="Width of day of the month was 0, reverting to static icon",CloudOS.recordStat("CalendarIconUnableToLoad",{error:"Calendar icon monthday string was too short.",appName:"CloudOS",isFatal:!1}),error;while(l>=i)f-=1,a.font=o+" "+f+"px "+s,l=a.measureText(t).width;if(f<5*e)throw error="Monthday string is too long, reverting to static icon",CloudOS.recordStat("CalendarIconUnableToLoad",{error:"Calendar icon monthday string was too long.",appName:"CloudOS",isFatal:!1}),error;a.textAlign="center",a.textBaseline="middle",a.fillStyle=this.get("monthdayTextColor"),a.fillText(t,n/2,r)}}),CloudOS.setCalendarIconDateForDebugging=function(e){CW.notificationCenter.postNotification("setCalendarIconDateForDebugging",e)},CloudOS.SpringboardButtonView.BUTTON_TYPES.calendar=CloudOS.SpringboardCalendarButtonView}(),CloudOS.SpringboardHomeButtonView=CloudOS.SpringboardImageButtonView.extend({action:function(){var e=this.get("paneHideDuration"\n);this.set("paneHideDuration",200),CloudOS.statechart.sendAction("userDidBeginAnimatingHome"),CloudOS.appSwitcherController.hideAppSwitcher(),this.set("paneHideDuration",e)},isShowingWarning:NO,isDimmed:NO,isUnclickable:NO}),CloudOS.SpringboardButtonView.BUTTON_TYPES.home=CloudOS.SpringboardHomeButtonView,CloudOS.iOSNotificationForSpringboard=CW.iOSNotification.extend({parentElement:function(){return CloudOS.getPath("mainPage.mainPane.springboardView.layer")}.property(),minimumSideClearanceBinding:SC.Binding.transform(function(e){return e-29}).from("CloudOS.workspaceController.accountSignoutHelpProtrusion")});' ,cssSource:".sc-view .sc-view.cos-account-menu{overflow:visible}.sc-view .cos-account-menu .sc-button-view .sc-button-label{padding-left:33px}.sc-view .cos-account-menu>.cw-photo-icon{pointer-events:none}.sc-view .cos-account-menu>.cw-photo-icon>.photo-container{box-sizing:border-box;position:absolute;left:0px;top:0px;width:28px;height:28px;z-index:1;overflow:hidden;border-radius:28px}.sc-view .cos-account-menu>.cw-photo-icon.no-photo>.photo-frame{display:none}.sc-view .cos-account-menu>.cw-photo-icon.no-photo>.photo-container{background-image: url('https://icloud.cdn-apple.com/system/cloudos/1812Project43/cloudos_foundation/language/1812Project43/en-us/stylesheet-1.png');\nbackground-position: 0px 0px;\nbackground-repeat:no-repeat}.springboard-view.app-switcher .sc-button-view{color:white;color:rgba(255,255,255,0.8)}.springboard-view.app-switcher .sc-button-view:hover{color:white}.springboard-view.app-switcher .sc-button-view.active{color:white;color:rgba(255,255,255,0.8)}.springboard-view.app-switcher .main-content{background-color:white}.springboard-view.app-switcher .sb-shadow{display:none}.springboard-view.app-switcher .sb-title-highlight{position:absolute;z-index:7;margin-left:-1px;margin-top:-1px;background:#ecf7ff;border-radius:20px;border:1px solid #b6d9ff;display:none}.springboard-view.app-switcher .current-app .sb-title-highlight{display:block}.springboard-view.app-switcher .current-app .sb-title-text{color:#1573fb}.springboard-view.app-switcher .sc-view .sb-title>.sb-title-text{text-shadow:none}.springboard-view.app-switcher .sb-border{position:absolute;pointer-events:none;cursor:pointer;left:0;right:0;bottom:0;top:0;z-index:12;border-radius:23%;border:1px solid rgba(0,0,0,0.11)}.springboard-view.app-switcher .sb-badge .text{font-size:17px}.springboard-view.app-switcher .sc-view a[role=button]{outline:0}.springboard-view.app-switcher .sc-view a[role=button]:focus .sb-icon{outline:dotted #7dadd9 1px;outline:auto -webkit-focus-ring-color 1px}.springboard-view .sb-el{position:absolute}.springboard-view .sb-ax-text{position:absolute;z-index:-1;opacity:0;top:-150px;left:35px}.springboard-view .sb-badge{z-index:50;cursor:pointer;text-align:right}.springboard-view .sb-badge .text,.springboard-view .sb-badge .mask,.springboard-view .sb-badge .red{position:absolute}.springboard-view .sb-badge .text{color:white;z-index:2;font-size:25px;text-align:right}.springboard-view .sb-badge .mask,.springboard-view .sb-badge .red{position:absolute;border-radius:50px}.springboard-view .sb-badge .mask{z-index:3;background:black}.springboard-view .sb-badge .red{z-index:1;background:red}.springboard-view .sb-decor-shadow{z-index:40;cursor:default;pointer-events:none}.springboard-view .sb-spinner{z-index:30;cursor:pointer;overflow:hidden}.springboard-view .sb-arrow{z-index:25;cursor:pointer;pointer-events:none}.springboard-view .sb-mask{z-index:20;cursor:pointer}.springboard-view .sb-icon{z-index:10;cursor:pointer;image-rendering:optimizeQuality}.springboard-view .sb-shadow{z-index:5;cursor:default;pointer-events:none}.springboard-view .sb-mask,.springboard-view .sb-icon{left:0px;top:0px}.springboard-view .springboard-button-view{overflow:visible !important;cursor:default;text-decoration:none}.springboard-view .sb-external-shadow{cursor:default;position:absolute;z-index:14;pointer-events:none}.springboard-view .sb-lock-badge{z-index:27;cursor:pointer;pointer-events:none}.springboard-view .sb-lock-badge img{position:absolute;left:0px;top:0px}.springboard-view div.sc-view div.sb-title{cursor:default;z-index:8;color:white;left:-30px;text-align:center;pointer-events:none}.msie .springboard-view div.sc-view div.sb-title{pointer-events:all}.springboard-view div.sc-view div.sb-title>.sb-title-text{pointer-events:all;cursor:pointer;text-shadow:#000 0 0 25px}.windows.mozilla.tr-tr .springboard-view div.sc-view div.sb-title>.sb-title-text{font-size:19px}.springboard-view div.sc-view div.sb-error-text{cursor:default;z-index:7;color:white;left:0px;text-align:center;pointer-events:none;white-space:nowrap}.springboard-view div.custom-button{background:transparent !important;max-height:none !important}.springboard-view .sc-view a[role=button]:focus .sb-shadow{outline:dotted #7dadd9 1px;outline-style:auto;outline-color:-webkit-focus-ring-color}.springboard-view .sc-view:-moz-focusring{outline:1px dotted #9d9d9d}.springboard-view .blur-overlay{background:rgba(0,0,0,0.1)}\n" ,cssLogicalUrl:"/system/cloudos/1812Project43/cloudos_foundation/springboard/1812Project43/en-us/stylesheet.css",css2xSource:".sc-view .sc-view.cos-account-menu{overflow:visible}.sc-view .cos-account-menu .sc-button-view .sc-button-label{padding-left:33px}.sc-view .cos-account-menu>.cw-photo-icon{pointer-events:none}.sc-view .cos-account-menu>.cw-photo-icon>.photo-container{box-sizing:border-box;position:absolute;left:0px;top:0px;width:28px;height:28px;z-index:1;overflow:hidden;border-radius:28px}.sc-view .cos-account-menu>.cw-photo-icon.no-photo>.photo-frame{display:none}.sc-view .cos-account-menu>.cw-photo-icon.no-photo>.photo-container{background-size: 28px 28px;\nbackground-image: url('https://icloud.cdn-apple.com/system/cloudos/1812Project43/cloudos_foundation/language/1812Project43/en-us/stylesheet-1@2x.png');\nbackground-position: 0px 0px;\nbackground-repeat:no-repeat}.springboard-view.app-switcher .sc-button-view{color:white;color:rgba(255,255,255,0.8)}.springboard-view.app-switcher .sc-button-view:hover{color:white}.springboard-view.app-switcher .sc-button-view.active{color:white;color:rgba(255,255,255,0.8)}.springboard-view.app-switcher .main-content{background-color:white}.springboard-view.app-switcher .sb-shadow{display:none}.springboard-view.app-switcher .sb-title-highlight{position:absolute;z-index:7;margin-left:-1px;margin-top:-1px;background:#ecf7ff;border-radius:20px;border:1px solid #b6d9ff;display:none}.springboard-view.app-switcher .current-app .sb-title-highlight{display:block}.springboard-view.app-switcher .current-app .sb-title-text{color:#1573fb}.springboard-view.app-switcher .sc-view .sb-title>.sb-title-text{text-shadow:none}.springboard-view.app-switcher .sb-border{position:absolute;pointer-events:none;cursor:pointer;left:0;right:0;bottom:0;top:0;z-index:12;border-radius:23%;border:1px solid rgba(0,0,0,0.11)}.springboard-view.app-switcher .sb-badge .text{font-size:17px}.springboard-view.app-switcher .sc-view a[role=button]{outline:0}.springboard-view.app-switcher .sc-view a[role=button]:focus .sb-icon{outline:dotted #7dadd9 1px;outline:auto -webkit-focus-ring-color 1px}.springboard-view .sb-el{position:absolute}.springboard-view .sb-ax-text{position:absolute;z-index:-1;opacity:0;top:-150px;left:35px}.springboard-view .sb-badge{z-index:50;cursor:pointer;text-align:right}.springboard-view .sb-badge .text,.springboard-view .sb-badge .mask,.springboard-view .sb-badge .red{position:absolute}.springboard-view .sb-badge .text{color:white;z-index:2;font-size:25px;text-align:right}.springboard-view .sb-badge .mask,.springboard-view .sb-badge .red{position:absolute;border-radius:50px}.springboard-view .sb-badge .mask{z-index:3;background:black}.springboard-view .sb-badge .red{z-index:1;background:red}.springboard-view .sb-decor-shadow{z-index:40;cursor:default;pointer-events:none}.springboard-view .sb-spinner{z-index:30;cursor:pointer;overflow:hidden}.springboard-view .sb-arrow{z-index:25;cursor:pointer;pointer-events:none}.springboard-view .sb-mask{z-index:20;cursor:pointer}.springboard-view .sb-icon{z-index:10;cursor:pointer;image-rendering:optimizeQuality}.springboard-view .sb-shadow{z-index:5;cursor:default;pointer-events:none}.springboard-view .sb-mask,.springboard-view .sb-icon{left:0px;top:0px}.springboard-view .springboard-button-view{overflow:visible !important;cursor:default;text-decoration:none}.springboard-view .sb-external-shadow{cursor:default;position:absolute;z-index:14;pointer-events:none}.springboard-view .sb-lock-badge{z-index:27;cursor:pointer;pointer-events:none}.springboard-view .sb-lock-badge img{position:absolute;left:0px;top:0px}.springboard-view div.sc-view div.sb-title{cursor:default;z-index:8;color:white;left:-30px;text-align:center;pointer-events:none}.msie .springboard-view div.sc-view div.sb-title{pointer-events:all}.springboard-view div.sc-view div.sb-title>.sb-title-text{pointer-events:all;cursor:pointer;text-shadow:#000 0 0 25px}.windows.mozilla.tr-tr .springboard-view div.sc-view div.sb-title>.sb-title-text{font-size:19px}.springboard-view div.sc-view div.sb-error-text{cursor:default;z-index:7;color:white;left:0px;text-align:center;pointer-events:none;white-space:nowrap}.springboard-view div.custom-button{background:transparent !important;max-height:none !important}.springboard-view .sc-view a[role=button]:focus .sb-shadow{outline:dotted #7dadd9 1px;outline-style:auto;outline-color:-webkit-focus-ring-color}.springboard-view .sc-view:-moz-focusring{outline:1px dotted #9d9d9d}.springboard-view .blur-overlay{background:rgba(0,0,0,0.1)}\n" ,css2xLogicalUrl:"/system/cloudos/1812Project43/cloudos_foundation/springboard/1812Project43/en-us/stylesheet@2x.css"})}();