
(function(){kit={};if(!window.opus){opus={};}
opus.nop=function(){};opus.nob={};opus.registry={add:opus.nop};var extraNames,empty={};for(var i in{toString:1}){extraNames=[];break;}
kit._extraNames=extraNames=extraNames||["hasOwnProperty","valueOf","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","constructor"];kit._mixin=function(target,source){var name,s,i;for(name in source){s=source[name];if(!(name in target)||(target[name]!==s&&(!(name in empty)||empty[name]!==s))){target[name]=s;}}
if(source){for(i=0;(names=extraNames[i]);i++){s=source[name];if(!(name in target)||(target[name]!==s&&(!(name in empty)||empty[name]!==s))){target[name]=s;}}}
return target;};kit.mixin=function(obj,props){if(!obj){obj={};}
for(var i=1,l=arguments.length;i<l;i++){kit._mixin(obj,arguments[i]);}
return obj;};kit.extend=function(ctor,props){for(var i=1,l=arguments.length;i<l;i++){kit.mixin(ctor.prototype,arguments[i]);}
return ctor;}
kit.global=window;kit._getProp=function(parts,create,context){var obj=context||kit.global;for(var i=0,p;obj&&(p=parts[i]);i++){obj=(p in obj?obj[p]:(create?obj[p]={}:undefined));}
return obj;};kit.setObject=function(name,value,context){var parts=name.split("."),p=parts.pop(),obj=kit._getProp(parts,true,context);return obj&&p?(obj[p]=value):undefined;};kit.getObject=function(name,create,context){return kit._getProp(name.split("."),create,context);};kit.forEach=function(arr,callback,context){if(arr){context=context||this;for(var i=0,l=arr.length;i<l;i++){callback.call(context,arr[i],i,arr);}}};kit.cap=function(inString){return inString.slice(0,1).toUpperCase()+inString.slice(1);};kit.isString=function(it){return(typeof it=="string"||it instanceof String);};kit.isFunction=function(it){return Object.prototype.toString.call(it)==="[object Function]";};kit.isArray=function(it){return it&&(it instanceof Array||typeof it=="array");};kit.isObject=function(it){return it!==undefined&&(it===null||typeof it=="object"||kit.isArray(it)||kit.isFunction(it));};kit.cloneArray=kit._toArray=function(obj,offset,startWith){var arr=startWith||[];for(var i=offset||0,l=obj.length;i<l;i++){arr.push(obj[i]);}
return arr;};kit.clone=function(obj){return kit.isArray(obj)?kit.cloneArray(obj):kit.mixin({},obj);};kit._hitchArgs=function(scope,method){var pre=kit._toArray(arguments,2);var named=kit.isString(method);return function(){var args=kit._toArray(arguments);var fn=named?(scope||kit.global)[method]:method;return fn&&fn.apply(scope||this,pre.concat(args));}};kit.hitch=function(scope,method){if(arguments.length>2){return kit._hitchArgs.apply(kit,arguments);}
if(!method){method=scope;scope=null;}
if(kit.isString(method)){scope=scope||kit.global;if(!scope[method]){throw(['kit.hitch: scope["',method,'"] is null (scope="',scope,'")'].join(''));}
return function(){return scope[method].apply(scope,arguments||[]);};}
return!scope?method:function(){return method.apply(scope,arguments||[]);};};kit.nop=function(){};kit.delegate=function(obj,props){kit.nop.prototype=obj;var neo=new kit.nop();if(props){kit.mixin(neo,props);}
return neo;};kit.byId=function(id,doc){return(typeof id=="string")?(doc||document).getElementById(id):id;};kit.time=function(inName){kit.time.timers[inName]=new Date().getTime();kit.lastTimer=inName;};kit.time.timers={};kit.timeEnd=function(inName){var n=inName||kit.lastTimer;var dt=new Date().getTime()-kit.time.timers[n];console.log(n+": "+dt+"ms");return dt;};kit.macroize=function(inText,inMap,inPattern){var working,result=inText,pattern=inPattern||kit.macroize.pattern;var fn=function(macro,name){working=true;return inMap[name]||"";};do{prevent=0;working=false;result=result.replace(pattern,fn);}while(working&&(prevent++<100));return result;};kit.macroize.pattern=/{\$([^}]*)}/g;opus.easing={cubicIn:function(n){return Math.pow(n,3);},cubicOut:function(n){return Math.pow(n-1,3)+1;},expoOut:function(n){return(n==1)?1:(-1*Math.pow(2,-10*n)+1);},quadInOut:function(n){n=n*2;if(n<1){return Math.pow(n,2)/2;}
return-1*((--n)*(n-2)-1)/2;}};kit.fixEvent=function(e){e=e||window.event;if(e.srcElement){e.target=e.srcElement;}
return e;};kit.stopEvent=function(e){e.preventDefault();e.stopPropagation();};kit.connect=function(obj,event,context,method){var f=obj[event];obj[event]=function(){var args=kit._toArray(arguments);f.apply(obj,args);return context[method].apply(context,args);}
return{obj:obj,event:event,original:f};}
kit.disconnect=function(h){if(h&&h.obj){h.obj[h.event]=h.original;delete h.obj;delete h.original;}};kit.objectToQuery=function(map){var enc=encodeURIComponent;var pairs=[];var backstop={};for(var name in map){var value=map[name];if(value!=backstop[name]){var assign=enc(name)+"=";if(kit.isArray(value)){for(var i=0;i<value.length;i++){pairs.push(assign+enc(value[i]));}}else{pairs.push(assign+enc(value));}}}
return pairs.join("&");};})();
opus.splitUnits=function(inValue){if(inValue===undefined||inValue===null||inValue===""||inValue=="auto"){return null;}else{var m=String(inValue).match(/([\+\-\.0-9]*)(\D*)/);var v={value:Number(m[1]||0),units:m[2]||"px"};return v;}};opus.clamp=function(v,mn,mx){if(mn){v=Math.max(mn,v);}
if(mx){v=Math.min(mx,v);}
return v;};opus.round=function(v){return Math.round(v*1000)/1000;};opus.reindex=function(inObject,inPropMap){var x;for(var n in inObject){x=inPropMap[n];if(x){inObject[x]=inObject[n];delete inObject[n];}}};opus.isNativeKeyTarget=function(e){var tagName=e.target.tagName;for(var i in opus.isNativeKeyTarget.tags){if(tagName==i){return true;}}}
opus.isNativeKeyTarget.tags={"INPUT":1,"TEXTAREA":1,"SELECT":1,"OBJECT":1,"CANVAS":1};opus.argify=function(inSearch){var args=inSearch.slice(1).split("&");for(var i=0,a,nv;a=args[i];i++){nv=args[i]=a.split("=");args[nv[0]]=nv.length>1?nv[1]:true;}
return args;};opus.job=function(inJobName,inJob,inWait){opus.job.stop(inJobName);opus.job._jobs[inJobName]=setTimeout(function(){opus.job.stop(inJobName);inJob();},inWait);};opus.job.stop=function(inJobName){if(opus.job._jobs[inJobName]){clearTimeout(opus.job._jobs[inJobName]);delete opus.job._jobs[inJobName];}};opus.job._jobs={};opus.path={pattern:/\$([^\/\\]*)(\/)?/g,rewrite:function(inPath){var working,result=inPath;do{working=false;result=result.replace(this.pattern,function(macro,name){working=true;var path=opus.paths[name];return path?(path.charAt(path.length-1)=="/"?path:path+"/"):"";});}while(working);return result;},getExtension:function(inPath){var n=inPath;var i=n.lastIndexOf(".");if((i>=0)&&(i>=n.lastIndexOf("/"))){return n.slice(i-n.length);}
return"";},getName:function(inPath){var n=inPath;var i=n.lastIndexOf("/")+1;if(i){n=n.slice(i-n.length);}
var i=n.lastIndexOf(".");if(i>=0){n=n.slice(0,i-n.length);}
return n;},getFolder:function(inPath){var n=inPath;var i=n.lastIndexOf("/")+1;if(i){return n.slice(0,i-n.length);}
return"";},isRelative:function(inPath){return((inPath[0]!="/")&&(inPath[0]!="$")&&(inPath.slice(0,4)!="http"));}};opus.findScript=function(inName){var l=inName.length;var scripts=document.getElementsByTagName("script");for(var i=0,s,src;(s=scripts[i]);i++){src=s.getAttribute("src");if(src&&src.slice(-l)==inName){return src.slice(0,-l);}}};opus.escapeXml=function(inXml){return inXml.replace(/&/gm,"&amp;").replace(/</gm,"&lt;").replace(/>/gm,"&gt;").replace(/"/gm,"&quot;").replace(/'/gm,"&#39;");};opus.isJavaEnabled=function(){return navigator.javaEnabled()&&(navigator.mimeTypes["application/x-java-applet"]!=null);};if(!opus.paths){opus.paths={};}
if(!opus.paths.opus){opus.args=opus.argify(location.search);opus.paths.opus=opus.findScript("opus-m.js");}
opus.xhr={getXMLHttpRequest:function(){try{return new XMLHttpRequest();}catch(e){}
try{return new ActiveXObject('Msxml2.XMLHTTP');}catch(e){}
try{return new ActiveXObject('Microsoft.XMLHTTP');}catch(e){}
return null;},request:function(inParams){var xhr=this.getXMLHttpRequest();var method=inParams.method||"GET";xhr.open(method,inParams.url,true);this.makeReadyStateHandler(xhr,inParams.callback);if(inParams.headers){for(var key in inParams.headers){xhr.setRequestHeader(key,inParams.headers[key]);}}
xhr.send(inParams.body||null);},makeReadyStateHandler:function(inXhr,inCallback){inXhr.onreadystatechange=function(){if(inXhr.readyState==4){inCallback&&inCallback.apply(null,[inXhr.responseText,inXhr]);}}}};
opus.declare=function(className,props){var dd=arguments.callee;var superclass=props.isa;var mixins=props.mixins;delete props.mixins;if(mixins){kit.forEach(mixins,function(m,i){if(!m){throw(className+": mixin #"+i+" is null");}
superclass=dd._delegate(superclass,m);});}
var ctor=dd._delegate(superclass);props=props||{};ctor.extend(props);var init=props.hasOwnProperty("constructor")?props.constructor:null;kit.extend(ctor,{declaredClass:className,_constructor:init});ctor.prototype.constructor=ctor;return kit.setObject(className,ctor);};kit.mixin(opus.declare,{_delegate:function(base,mixin){var dd=opus.declare,bp=(base||0).prototype,mp=mixin?mixin.prototype:null;var ctor=dd._makeCtor();kit.mixin(ctor,{superclass:bp,mixin:mp,extend:dd._extend});if(base){ctor.prototype=kit.delegate(bp);}
kit.extend(ctor,dd._core,mp,{_constructor:null,preamble:null});ctor.prototype.constructor=ctor;ctor.prototype.declaredClass=(bp||0).declaredClass+'_'+(mp?mp.declaredClass:"Object");return ctor;},_extend:function(props){var i,fn;for(i in props){if((typeof props[i]=='function')&&!0[i]){fn=props[i];fn.nom=i;fn.ctor=this;}}
kit.extend(this,props);},_makeCtor:function(){return function(){this._construct(arguments);};},_core:{_construct:function(args){var c=args.callee,s=c.superclass,ct=s&&s.constructor,m=c.mixin,mct=m&&m.constructor,a=args,ii,fn;if(ct&&ct.apply){ct.apply(this,a);}
if(mct&&mct.apply){mct.apply(this,a);}
if((ii=c.prototype._constructor)){ii.apply(this,args);}
if(this.constructor.prototype==c.prototype&&(ct=this.postscript)){ct.apply(this,args);}},_findMixin:function(mixin){var c=this.constructor,p,m;while(c){p=c.superclass;m=c.mixin;if(m==mixin||(m instanceof mixin.constructor)){return p;}
if(m&&m._findMixin&&(m=m._findMixin(mixin))){return m;}
c=p&&p.constructor;}},_findMethod:function(name,method,ptype,has){var p=ptype,c,m,f;do{c=p.constructor;m=c.mixin;if(m&&(m=this._findMethod(name,method,m,has))){return m;}
if((f=p[name])&&(has==(f==method))){return p;}
p=c.superclass;}while(p);return!has&&(p=this._findMixin(ptype))&&this._findMethod(name,method,p,has);},inherited:function(name,args,newArgs){var a=arguments;if(typeof a[0]!="string"){newArgs=args;args=name;name=args.callee.nom;}
a=newArgs||args;var c=args.callee,p=this.constructor.prototype,fn,mp;if(this[name]!=c||p[name]==c){mp=(c.ctor||0).superclass||this._findMethod(name,c,p,true);if(!mp){throw(this.declaredClass+': inherited method "'+name+'" mismatch');}
p=this._findMethod(name,c,mp,false);}
fn=p&&p[name];if(!fn){throw(mp.declaredClass+': inherited method "'+name+'" not found');}
return fn.apply(this,a);}}});
opus.Class=function(inName,inProperties){var ctor=opus.declare(inName,inProperties);var statics=inProperties.statics;delete inProperties.statics;kit.mixin(ctor,statics);var isa=inProperties.isa;if(isa&&isa.subclass){isa.subclass(ctor,inProperties);}
return ctor;};opus.hasProperties=function(inObject){for(var n in inObject){return true;}};opus.apply=function(inObject,inMethod,inArgs){if(inObject){if(kit.isString(inMethod)){inMethod=inObject[inMethod];}
if(inMethod){return inMethod.apply(inObject,inArgs||[]);}}};opus.difference=function(inObjectA,inObjectB){var p$={};for(var n in inObjectA){if(inObjectA[n]!=inObjectB[n]){p$[n]=inObjectA[n];}}
return p$;};opus.combine=function(inObjectA,inObjectB){var aValue,bValue;for(var name in inObjectB){bValue=inObjectB[name];if(kit.isFunction(aValue)||kit.isFunction(bValue)||!kit.isObject(bValue)){inObjectA[name]=bValue;}else{aValue=inObjectA[name];if(kit.isObject(aValue)){opus.combine(aValue,bValue);}else{inObjectA[name]=kit.clone(bValue);}}}};opus.Class("opus.Object",{published:{},setProperty:function(inName,inValue){var fn='set'+inName.charAt(0).toUpperCase()+inName.slice(1);if(this[fn]){this[fn](inValue);}},getProperty:function(inName){var fn='get'+inName.charAt(0).toUpperCase()+inName.slice(1);if(this[fn]){return this[fn]();}},propertyChanged:function(inName,inValue){},getPublishedProperties:function(){return this.constructor.getPublishedProperties();},publishProperty:function(inName,inInfo){this.published[inName]=inInfo;opus.Object.publishProperty(this,inName,inInfo);},__console:function(inMethod,inArgs){if(console.firebug){console[inMethod].apply(console,inArgs);}else{console.log.call(console,inArgs.join(" "));}},_console:function(inMethod,inArgs){this.__console(inMethod,[inArgs.callee.caller.ctor.prototype.declaredClass+"."+inArgs.callee.caller.nom+"(): "].concat(kit._toArray(inArgs)));},log:function(){this._console("log",arguments);},warn:function(){this._console("warn",arguments);},error:function(){this._console("error",arguments);}});kit.mixin(opus.Object,{_makeSetter:function(inName,icf,ocf){return function(inValue){this[inName]=inValue;if(this[icf]){this[icf](inName,inValue);}
if(this[ocf]){this[ocf](inName,this[inName]);}
this.propertyChanged(inName,this[inName]);};},_makeGetter:function(inName){return function(){return this[inName];};},_makeHandler:function(inName){return function(){if(this.dispatch){var cbn=this[inName];if(cbn){return this.dispatch(cbn,arguments);}}};},publishProperty:function(inObject,inName,inInfo){if(kit.isString(inInfo)||(typeof inInfo=="number")||(typeof inInfo=="boolean")){inInfo={value:inInfo};}
var o=inObject;if(inInfo.event){var h=this._makeHandler(inName);h.nom=inInfo.event;o[inInfo.event]=h;}{var cap=inName.charAt(0).toUpperCase()+inName.slice(1);var ocf=inName+"Changed";var icf=inInfo.onchange;var fn="set"+cap;if(!o[fn]||o[fn].auto){o[fn]=this._makeSetter(inName,icf,ocf);o[fn].auto=true;}
fn="get"+cap;if(!o[fn]){o[fn]=this._makeGetter(inName);}
if("value"in inInfo){o[inName]=inInfo.value;}}
return inInfo;},publishProperties:function(inCtor,inProperties){for(var n in inProperties){inProperties[n]=this.publishProperty(inCtor.prototype,n,inProperties[n]);}},statics:{subclass:function(inCtor,inProperties){kit.mixin(inCtor,opus.Object.statics);opus.Object.publishProperties(inCtor,inProperties.published||inProperties.publish);},getPublishedProperties:function(){var published={},p=this.prototype;var stack=[];while(p){if(p.published){stack.push(p.published);}
p=p.constructor.superclass;}
while(stack.length){opus.combine(published,stack.pop());}
return published;}}});kit.mixin(opus.Object,opus.Object.statics);
opus.$={};opus.findConstructorForType=function(inTypeName){var type=inTypeName||"Component";return kit.getObject("opus."+type)||kit.getObject(type);};opus._notifiedMissing={};opus.createComponent=function(inComponentProps){var ctor=opus.findConstructorForType(inComponentProps.type);if(!ctor){if(!opus._notifiedMissing[inComponentProps.type]){opus._notifiedMissing[inComponentProps.type]=true;console.log('opus.createComponent: "'+inComponentProps.type+'" not found.');}
ctor=opus.Control;}
return new ctor(inComponentProps);};opus.Class("opus.Updateable",{beginUpdate:function(){this._updating=true;},isUpdating:function(){return this._updating;},endUpdate:function(){this._updating=false;}});opus.Class("opus.Component",{isa:opus.Object,mixins:[opus.Updateable],toString:function(){return(this.name||"(anon)")+": "+this.type;},published:{name:{value:"",group:"Common"}},owner:null,components:null,constructor:function(inConfiguration){this.$={};},postscript:function(inConfig){this.importProperties(inConfig||opus.nob);this.create();this.postCreate();},importProperties:function(inConfig){if(inConfig){for(var n in inConfig){this[n]=inConfig[n];}}
if(!this.type){this.type=this.declaredClass.replace(/opus\./g,'');}},create:function(){this.createComponents(this.components,{owner:this});this.components=this.$;},postCreate:function(){this.ownerChanged();if(!this.owner||this.owner.readied){this.ready();}},ready:function(){if(!this.name){this.nameComponent(this);}
this.generateGlobalId();this.registerGlobalId();for(var n in this.$){this.$[n].ready();}
this.readied=true;},destructor:function(){opus.destroying=true;this.unregisterGlobalId();this.destructComponents();if(this.owner){this.owner.removeComponent(this);}
this.destroyed=true;opus.destroying=false;},destructComponents:function(){do{var n=null;for(n in this.$){this.$[n].destructor();break;}}while(n);this.components=this.$={};},destroy:function(){this.markForDestroy();this.destructor();this.notifyUpdate("destroy");},destroyComponents:function(){this.markForDestroy();this.destructComponents();this.unMarkForDestroy();},markForDestroy:function(){if(!this._destroying){this._destroying=true;this.markComponentsForDestroy();}},markComponentsForDestroy:function(){for(var n in this.$){this.$[n].markForDestroy();}},unMarkForDestroy:function(){this._destroying=false;}});opus.Component.extend({ownerChanged:function(){if(this.owner){this.owner.addComponent(this);}},setName:function(inName){if(this.owner&&!this.owner.renameComponent(this,inName)){return;}
this.name=inName;this.nameChanged(inName);},nameChanged:function(){this.notifyUpdate("nameChanged");},findDispatchTarget:function(inName){if(this.owner[inName]){return this.owner;}else return this.owner.dispatchProxy||this.owner;},dispatch:function(inName,inArguments){var target=this.findDispatchTarget(inName);if(target){var fn=target[inName];if(fn){return fn.apply(target,[this].concat(kit._toArray(inArguments)));}}},addComponent:function(inComponent){if(!inComponent.name){this.nameComponent(inComponent);}
this.$[inComponent.name]=inComponent;},removeComponent:function(inComponent){delete this.$[inComponent.name];},renameComponent:function(inComponent,inName){if(this.$[inName]){return false;}
delete this.$[inComponent.name];this.$[inName]=inComponent;return true;},nameComponent:function(inComponent){var prefix=(inComponent.type||"notype").split(".").pop();prefix=prefix.charAt(0).toLowerCase()+prefix.slice(1);this._componentNameMap=this._componentNameMap||{};var i=this._componentNameMap[prefix]||1;for(var name;Boolean(this.$[name=prefix+String(i)]);i++){}
this._componentNameMap[prefix]=Number(i)+1;inComponent.name=name;},getRootComponent:function(){return this.owner?this.owner.getRootComponent():this;},findComponent:function(inName){var c=this.$[inName];return(c||!this.owner)?c:this.owner.findComponent(inName);},findProperty:function(inName){var p=this[inName];return(p||!this.owner)?p:this.owner.findProperty(inName);},rewritePath:function(inPath){return opus.path.rewrite(inPath);},isDesigning:function(){return false;}});opus.Component.extend({generateGlobalId:function(){this.globalId=!this.owner?"":((this.owner.globalId?this.owner.globalId+"-":"")+this.name);},registerGlobalId:function(){if(this.globalId&&!this.noEvents){opus.$[this.globalId]=this;}},unregisterGlobalId:function(){if(this.globalId){delete opus.$[this.globalId];}}});opus.Component.extend({adjustSubcomponentProps:function(inProps){if(!inProps.type){inProps.type=this.defaultType;}
inProps.owner=inProps.owner||this.childOwner||this.owner||this;},installComponent:function(inComponent,inChildProps){},createComponent:function(inConfiguration,inDefault){var props={};if(inDefault){props=kit.mixin(props,inDefault);}
kit.mixin(props,inConfiguration);this.adjustSubcomponentProps(props);return opus.createComponent(props);},createComponents:function(inComponents,inChildProps){for(var i=0,c;inComponents&&(c=inComponents[i]);i++){if(c instanceof opus.Component){this.installComponent(c,inChildProps);}else{this.createComponent(c,inChildProps);}}},notifyUpdate:function(inUpdateInfo){if(this.owner&&this.readied&&(!this._destroying||this.destroyed)){this.owner.componentUpdated(this,inUpdateInfo);}},componentUpdated:function(inComponent,inUpdateInfo){}});opus.Component.extend({exportProperties:function(){var props={},v,p,p$=this.getPublishedProperties();for(var n in p$){p=p$[n];if(!p.noExport){v=this.getProperty(n);if(v!==this.constructor.prototype[n]){props[n]=v;}}}
props.type=this.type||this.declaredClass.split(".").pop();return props;},exportComponents:function(inRoot){var comps=[],c;if(this==inRoot){for(var i in this.$){c=this.$[i];if(this.shouldExportComponent(c,inRoot)){comps.push(c.exportComponent(inRoot));}}}
return comps;},shouldExportComponent:function(inComponent,inRoot){return(inComponent.owner==inRoot)&&(!(inComponent instanceof opus.Control))&&!inComponent.noExport;},exportComponent:function(inRoot){var props=this.exportProperties();var comps=this.exportComponents(inRoot||this);if(comps.length){props.components=comps;}
return props;},write:function(inRoot){return this.exportComponent(inRoot);},serialize:function(inRoot){return dojo.toJson(this.write(inRoot),true);}});
opus.Class("opus.DomNode",{node:null,_append:function(){if(this.node){var pn=this.parentNode&&kit.byId(this.parentNode);if(pn){pn.appendChild(this.node);}}},_remove:function(){if(this.node&&this.node.parentNode){this.node.parentNode.removeChild(this.node);}},setNode:function(inNode){var n=kit.byId(inNode);if(n!=this.node){this._remove();this.node=n;this._append();}},setParentNode:function(inParentNode){if(!inParentNode){this._remove();}
this.parentNode=inParentNode;this._append();},addChildNode:function(inNode){this.node.appendChild(inNode);},insertNodeAt:function(inNode,inAt){var sib=this.node.childNodes[inAt];this.node.insertBefore(inNode,sib);},show:function(){this.node.style.display="";},hide:function(){this.node.style.display="none";},attributesToNode:function(inAttributes){for(var n in inAttributes){var v=inAttributes[n];if(n=="className"){n="class";}
if(v===null){this.node.removeAttribute(n);}else{this.node.setAttribute(n,v);}}},stylesToNode:function(inStyles){this.node.style.cssText=opus.stylesToHtml(inStyles);},boxToNode:function(inBox){var s=this.node.style,u="px";if(("w"in inBox)&&inBox.w>=0){s.width=inBox.w+u;}
if(("h"in inBox)&&inBox.h>=0){s.height=inBox.h+u;}
if(inBox.l!==undefined){s.left=inBox.l+u;}
if(inBox.t!==undefined){s.top=inBox.t+u;}}});opus.Class("opus.AbstractDomNodeBuilder",{isa:opus.DomNode,content:"",nodeTag:"div",getContent:function(){return this.content;},getDomStyles:function(){},getDomAttributes:function(){},generateHtml:function(){var c=this.getContent();var h='<'
+this.nodeTag
+opus.attributesToHtml(this.getDomAttributes())
+' style="'+opus.stylesToHtml(this.getDomStyles())+'"';if(this.nodeTag=="img"){h+='/>';}else{h+='>'
+c
+'</'+this.nodeTag+'>';}
return h;},renderDomAttributes:function(){this.attributesToNode(this.getDomAttributes());},renderDomStyles:function(){this.stylesToNode(this.getDomStyles());},renderDomContent:function(){this.node.innerHTML=this.getContent();},renderDom:function(){this.renderDomAttributes();this.renderDomStyles();this.renderDomContent();},renderNode:function(){this.setNode(document.createElement(this.nodeTag));this.renderDom();},render:function(){if(this.node){this.renderDom();}else{this.renderNode();}}});opus.Class("opus.DomNodeBuilder",{isa:opus.AbstractDomNodeBuilder,constructor:function(){this.domStyles={};this.domAttributes={};},getDomStyles:function(){return this.domStyles;},getDomAttributes:function(){return this.domAttributes;}});opus.stylesToHtml=function(inStyles){var n,v,h='';for(n in inStyles){v=inStyles[n];if(v!==null&&v!==undefined&&v!==""){if(kit.isIE&&n=='opacity'){if(v>=0.99){continue;}
n='filter';v="progid:DXImageTransform.Microsoft.Alpha(opacity="+Math.floor(v*100)+")";}
h+=n+':'+v+';';}}
return h;};opus.attributesToHtml=function(inAttributes){var n,v,h='';for(n in inAttributes){v=inAttributes[n];if(n=="className"){n="class";}
if(v!==null){h+=' '+n+'="'+v+'"';}}
return h;};
opus.Class("opus.Style",{defaultStyles:{padding:"",margin:"",border:"",bold:false,italic:false,underline:false,position:"absolute"},nullClient:{styleChanged:function(){}},constructor:function(inClient){this.styles=kit.clone(this.defaultStyles);this.runtimeStyles={};this.client=inClient||this.nullClient;},getComputedStyle:function(){var cs=kit.mixin({},this.styles);kit.mixin(cs,this.runtimeStyles);return cs;},_combineStyles:function(inStyles,inNew){for(var n in inNew){var v=inNew[n];if(v===null){delete inStyles[n];}else{inStyles[n]=v;}}},_addStyles:function(inStyles){this._combineStyles(this.styles,inStyles);},addStyles:function(inStyles){this._addStyles(inStyles);this.stylesChanged();},_addRuntimeStyles:function(inStyles){this._combineStyles(this.runtimeStyles,inStyles);},addRuntimeStyles:function(inStyles){this._addRuntimeStyles(inStyles);this.stylesChanged();},stylesChanged:function(){this.client.styleChanged();},exportProperties:function(){return opus.difference(this.styles,this.defaultStyles);}});
opus.Box={add:function(ioBoxA,inBoxB){ioBoxA.l+=("l"in inBoxB)?inBoxB.l:0;ioBoxA.t+=("t"in inBoxB)?inBoxB.t:0;ioBoxA.w+=("w"in inBoxB)?inBoxB.w:0;ioBoxA.h+=("h"in inBoxB)?inBoxB.h:0;return ioBoxA;},grow:function(inBox,inAmount){return{l:inBox.l-inAmount,t:inBox.t-inAmount,w:inBox.w+inAmount+inAmount,h:inBox.h+inAmount+inAmount};},inside:function(inX,inY,inBox,inMargin){var m=inMargin||0;return(inX>inBox.l+m&&inX<inBox.r-m&&inY>inBox.t+m&&inY<inBox.b-m);}};opus.Class("opus.Bounds",{isa:opus.Object,boundsDirty:true,sizeDirty:true,constructor:function(inClient){this.client=inClient;},dirty:function(){this.boundsDirty=this.sizeDirty=true;},boundsChanged:function(){this.client.boundsChanged();},doSetBounds:function(inL,inT,inW,inH){if(!isNaN(inL)&&this.l!=inL){this.l=inL;this.boundsDirty=true;}
if(!isNaN(inT)&&this.t!=inT){this.t=inT;this.boundsDirty=true;}
if(inW>=0&&this.w!=inW){this.w=inW;this.boundsDirty=this.sizeDirty=true;}
if(inH>=0&&this.h!=inH){this.h=inH;this.boundsDirty=this.sizeDirty=true;}
this.b=this.t+this.h;this.r=this.l+this.w;this.boundsChanged();},setBounds:function(inL,inT,inW,inH){if(arguments.length==1){this.doSetBounds(inL.l,inL.t,inL.w,inL.h);}else{this.doSetBounds(inL,inT,inW,inH);}},getBounds:function(){return{l:this.l,t:this.t,w:this.w,h:this.h,r:this.r,b:this.b};}});opus.Class("opus.StyledBounds",{isa:opus.Bounds,constructor:function(){this.paddingExtents={l:0,t:0,r:0,b:0};this.borderExtents={l:0,t:0,r:0,b:0};this.marginExtents={l:0,t:0,r:0,b:0};this.superMarginExtents={l:0,t:0,r:0,b:0};this.nonClientExtents={w:0,h:0};this.scrollbarExtents={w:0,h:0};},_sides:{Left:"l",Top:"t",Right:"r",Bottom:"b"},setExtents:function(inStyle,inName){var v=Number(inStyle[inName]);var ex=this[inName+"Extents"]={l:v,t:v,r:v,b:v};var ss=this._sides;for(var s in ss){var ns=inName+s;if(ns in inStyle){ex[ss[s]]=inStyle[ns];}}
ex.w=ex.l+ex.r;ex.h=ex.t+ex.b;},updateMetrics:function(inStyle){this.setExtents(inStyle,"border");this.setExtents(inStyle,"padding");this.setExtents(inStyle,"margin");this._updateMetrics();},_updateMetrics:function(){var sme=this.superMarginExtents;sme.w=sme.l+sme.r;sme.h=sme.t+sme.b;var me=this.marginExtents;me.w=me.l+me.r;me.h=me.t+me.b;var pe=this.paddingExtents;var be=this.borderExtents;var nce=this.nonClientExtents;nce.w=sme.w+me.w+pe.w+be.w;nce.h=sme.h+me.h+pe.h+be.h;},getClientBounds:function(){return{l:this.paddingExtents.l,t:this.paddingExtents.t,w:this.w-this.nonClientExtents.w-this.scrollbarExtents.w,h:this.h-this.nonClientExtents.h-this.scrollbarExtents.h};},setClientSize:function(inSize){inSize.w+=this.nonClientExtents.w+this.scrollbarExtents.w;inSize.h+=this.nonClientExtents.h+this.scrollbarExtents.h;this.setBounds(inSize);},clientToMarginSize:function(inSize){inSize.w+=this.nonClientExtents.w+this.scrollbarExtents.w;inSize.h+=this.nonClientExtents.h+this.scrollbarExtents.h;return inSize;},getStrictBounds:function(){return{l:this.l,t:this.t,w:this.w-this.nonClientExtents.w,h:this.h-this.nonClientExtents.h};},getNonClientEdges:function(){var ex={};for(var i=0,n;(n=['l','t','r','b'][i]);i++){ex[n]=this.marginExtents[n]+this.borderExtents[n]+this.paddingExtents[n];}
return ex;},addDomOffset:function(ioBox){ioBox.l+=this.marginExtents.l+this.borderExtents.l;ioBox.t+=this.marginExtents.t+this.borderExtents.t;}});
opus._importPropMap={l:"left",t:"top",r:"right",b:"bottom",w:"width",h:"height",style:"styles",vAlign:"verticalAlign",hAlign:"horizontalAlign"};opus._exportPropMap={left:"l",top:"t",right:"r",bottom:"b",width:"w",height:"h",verticalAlign:"vAlign",horizontalAlign:"hAlign"};opus.Class("opus.Control",{isa:opus.Component,mixins:[opus.AbstractDomNodeBuilder],published:{hint:{value:null,group:"Common"},showing:{value:true,group:"Common"},content:{value:"",noInspect:true,group:"Common"},textSelection:{value:"",options:["","none","text"],noInspect:true},left:{value:null,onchange:"geometryChanged",group:"Geometry"},right:{value:null,onchange:"geometryChanged",group:"Geometry"},width:{value:null,onchange:"geometryChanged",group:"Geometry"},top:{value:null,onchange:"geometryChanged",group:"Geometry"},bottom:{value:null,onchange:"geometryChanged",group:"Geometry"},height:{value:null,onchange:"geometryChanged",group:"Geometry"},plane:{value:0,onchange:"styleChanged",group:"Geometry"},horizontalAlign:{value:"",onchange:"alignmentChanged",options:["","left","center","right"],group:"Geometry"},verticalAlign:{value:"",onchange:"alignmentChanged",options:["","top","center","bottom"],group:"Geometry"},style:{noExport:true,editor:{type:"StyleEditor"}},inFlow:{value:true,noInspect:true},_struts:{noExport:true,editor:{type:"SpringStrutEditor"},group:"Resize Behavior"},_size_ops:{noExport:true,editor:{type:"SizeOperations"},group:"Sizing Tools"},onclick:{event:"clickHandler"},ondblclick:{event:"dblclickHandler"},onmouseover:{event:"mouseoverHandler"},onmouseout:{event:"mouseoutHandler"},onmousedown:{event:"mousedownHandler"},onmouseup:{event:"mouseupHandler"},oncontextmenu:{event:"contextmenuHandler"},onshowingchanged:{event:"doShowingChanged"}},defaultStyles:{borderColor:"lightblue"},constructor:function(){this.style=new opus.Style(this);this.bounds=new opus.StyledBounds(this);this._neverFlowed=true;},importProperties:function(inProps){opus.reindex(inProps,opus._importPropMap);this.style._addStyles(this.defaultStyles);this.style._addStyles(this.styles);if(inProps.styles){this.style._addStyles(inProps.styles);delete inProps.styles;}
this.styleChanged();this.inherited(arguments);},create:function(){this.inherited(arguments);},postCreate:function(){this.managerChanged();this.parseGeometry();this.inherited(arguments);},destructor:function(){var selfDestroy=!this.isAncestorDestroying();if(selfDestroy){this.setNode(null);}
var p=this.parent;this.setManager(null);if(selfDestroy&&p){p.reflow();}
this.inherited(arguments);},isAncestorDestroying:function(){return this.parent&&(this.parent._destroying||this.parent.isAncestorDestroying());},isDesigning:function(){if("_designing"in this){return this._designing;}
var d=false;var p=this.manager;if(p&&p.isDesigning()){d=true;}else{if(opus["Designer"]){while(p&&!d){d=p instanceof opus.Designer;p=p.manager;}}}
this._designing=d;return d;},show:function(){this.setShowing(true);},hide:function(){this.setShowing(false);},showingChanged:function(){this.doShowingChanged();this.styleChanged();this.reflowParent();},textSelectionChanged:function(){this.attributesChanged();this.styleChanged();}});opus.Control.extend({setManager:function(inManager){if(this.manager){this.manager.removeControl(this);}
this.manager=inManager;this.managerChanged();},managerChanged:function(){if(this.manager){this.manager.addControl(this);}},reflowParent:function(){if(!this.isUpdating()){if(this.parent){this.parent.reflow();}else{this.renderBounds();}}}});opus.Control.extend({setParent:function(inParent){if(this.parent){this.parent.removeChild(this);}
this.parent=inParent;if(this.parent){this.parent.addChild(this);}},getRootControl:function(){return this.parent?this.parent.getRootControl():this;},isDescendantOf:function(inAncestor){var p=this;while(p&&p!=inAncestor){p=p.parent;}
return inAncestor&&(p==inAncestor);},findProperty:function(inName){var p=this[inName];return p?p:this.parent?this.parent.findProperty(inName):this.owner?this.owner.findProperty(inName):null;}});opus.Control.extend({parseGeometry:function(){this._left=opus.splitUnits(this.left);this._top=opus.splitUnits(this.top);this._width=opus.splitUnits(this.width);this._height=opus.splitUnits(this.height);this._right=opus.splitUnits(this.right);this._bottom=opus.splitUnits(this.bottom);},setGeometry:function(inGeometry){this.left=inGeometry.l;this.top=inGeometry.t;this.right=inGeometry.r;this.bottom=inGeometry.b;this.width=inGeometry.w;this.height=inGeometry.h;this.geometryChanged();},geometryChanged:function(){this.parseGeometry();this.reflowParent();},alignmentChanged:function(){this.bounds.sizeDirty=true;this.reflowParent();}});opus.Control.extend({setBounds:function(){this.bounds.setBounds.apply(this.bounds,arguments);if(this.bounds.boundsDirty){this.renderBounds();}},getBounds:function(){var b=this.bounds.getBounds();if(this.node){if(isNaN(b.l)){b.l=this.node.offsetLeft;}
if(isNaN(b.t)){b.t=this.node.offsetTop;}
if(!(b.w>0)){b.w=this.node.offsetWidth;}
if(!(b.h>0)){b.h=this.node.offsetHeight;}
b.r=b.l+b.w;b.b=b.t+b.h;}
return b;},getClientBounds:function(){return this.bounds.getClientBounds();},addDomOffset:function(ioBox){this.bounds.addDomOffset(ioBox);},addScrollOffset:function(ioBox){ioBox.l-=this.node.scrollLeft;ioBox.t-=this.node.scrollTop;},calcFrameOffset:function(inAncestor,inInside){var p=this;var off={l:0,t:0};if(!this.node){return off;}
if(inInside){p.addDomOffset(off);}
while(p&&p!=inAncestor){if(!("l"in p.bounds)){if(p.node){off.l+=p.node.offsetLeft;}}else{off.l+=p.bounds.l;}
if(!("t"in p.bounds)){if(p.node){off.t+=p.node.offsetTop;}}else{off.t+=p.bounds.t;}
p=p.parent;if(p){p.addScrollOffset(off);}
if(p&&p!=inAncestor){p.addDomOffset(off);}}
return off;}});opus.Control.extend({boundsChanged:function(){},contentChanged:function(){this.renderContent();},styleChanged:function(){var s=this.style.getComputedStyle();this.bounds.updateMetrics(s);this.boundsChanged();this.renderStyles();},attributesChanged:function(){this.renderAttributes();},canRender:function(){return!this.isUpdating()&&Boolean(this.node);},renderNode:function(){if(this.parent){this.parent.doFlow();this.setParentNode(this.parent.node);}
this.inherited(arguments);this.nodeRendered();},renderDom:function(){this.renderAttributes();this.renderStyles();this.renderContent();},renderAttributes:function(){if(this.canRender()){this.renderDomAttributes();}},renderStyles:function(){if(this.canRender()){this.renderDomStyles();this.stylesRendered();}},renderContent:function(){if(this.canRender()){this.renderDomContent();this.contentRendered();}},getDomAttributes:function(){var a$={id:this.globalId,ctype:this.declaredClass,onfocus:"opus.bubble(arguments[0])",onblur:"opus.bubble(arguments[0])",onscroll:"opus.bubble(arguments[0])",title:this.hint};if(kit.isIE&&this.textSelection){a$.onSelectStart=this.textSelection=="none"?"return false;":"return true;";}
kit.mixin(a$,this.attributes);this.modifyDomAttributes(a$);return a$;},modifyDomAttributes:function(inAttributes){},_expandStyleValue:function(inValues,inName,inDefault,inUnits){var r=[],v;for(var p in{Top:1,Right:1,Bottom:1,Left:1}){v=inValues[inName+p];r.push((v===undefined?inDefault:v)+inUnits);}
return r.join(" ");},getDomStyles:function(){var s=this.style.getComputedStyle();var s$={position:s.position,"float":s.float,overflow:s.overflow||(s.clip&&"hidden"),"overflow-x":s.overflowX,"overflow-y":s.overflowY,display:this.showing?s.display:"none",opacity:s.opacity,cursor:s.cursor,"z-index":(s.zIndex||this.plane)?this.plane*100+(s.zIndex||0):null,"background-color":s.bgColor,"background-image":s.bgImage?'url('+this.rewritePath(s.bgImage)+')':null,"background-repeat":s.bgRepeat||null,"background-position":s.bgPosition||null,"border-style":s.borderStyle||"solid","color":s.textColor||s.color,"text-align":s.textAlign,"text-decoration":s.underline?"underline":"","font-weight":s.bold?"bold":"","font-style":s.italic?"italic":"","font-family":s.fontFamily,"font-size":s.fontSize,"white-space":s.oneLine?"nowrap":s.whiteSpace,"vertical-align":s.verticalAlign};this.getBoundsStyles(s$,s);s$["-moz-user-select"]=s$["-webkit-user-select"]=this.textSelection;var fn=this._expandStyleValue;s$.padding=fn(s,"padding",s.padding||0,"px");s$["border-width"]=fn(s,"border",s.border||0,"px");s$["border-color"]=fn(s,"borderColor",s.borderColor||"inherit","");s$.margin=fn(s,"margin",s.margin||0,"px");var ns$=this.modifyDomStyles(s$,s);return ns$||s$;},getBoundsStyles:function(inStyles,inComputedStyles){var b=this.bounds.getStrictBounds();kit.mixin(inStyles,{left:isNaN(b.l)?null:b.l+"px",top:isNaN(b.t)?null:b.t+"px",width:b.w>=0?b.w+"px":null,height:b.h>=0?b.h+"px":null,right:inComputedStyles.right,bottom:inComputedStyles.bottom,"line-height":inComputedStyles.oneLine&&b.h>=0?b.h+"px":null});},modifyDomStyles:function(inStyles,inComputedStyles){},renderBounds:function(){if(this.canRender()){var b=this.bounds.getStrictBounds();this.boxToNode(b);var s=this.style.getComputedStyle();if(s.position){this.node.style.position=s.position;}
if(s["float"]){this.node.style.cssFloat=this.node.style.styleFloat=s["float"];}
if(s.oneLine&&b.h>=0){this.node.style.lineHeight=b.h+"px";}
this.boundsRendered();}},boundsRendered:function(){this.bounds.boundsDirty=false;},stylesRendered:function(){this.boundsRendered();},contentRendered:function(){},nodeRendered:function(){if(this.globalId){this.setNode(this.globalId);}},getNode:function(){if(!this.node){this.setNode(this.globalId);}
return this.node;}});opus.Control.extend({exportProperties:function(){var props=this.inherited(arguments);opus.reindex(props,opus._exportPropMap);if(this.parent&&props.type==this.parent.defaultControlType){delete props.type;}
var styles=opus.difference(this.style.exportProperties(),this.defaultStyles);if(opus.hasProperties(styles)){props.styles=styles;}
return props;}});
opus.layoutRegistry={layoutMap:{},register:function(inName,inCtor){this.layoutMap[inName]=new inCtor();},fetch:function(inName){return this.layoutMap[inName]||(this._def=(this._def||new opus.Layout()));}};opus.extentToPx=function extentToPx(inExtent,inSpan){return(!inExtent)?0:(inExtent.units!="%")?inExtent.value:inExtent.value*inSpan*0.01;};opus.pxToExtent=function pxToExtent(inPx,inSpan,inExtent){return(!inExtent||inExtent.units!="%")?Math.round(inPx):opus.round(inPx/inSpan*100)+"%";};opus.Class("opus.Layout",{isa:opus.Object,styles:{position:"static"},setup:function(inChild){inChild.style._addRuntimeStyles(this.styles);},flow:function(inC$,inB,inContainer){inContainer.flowing=true;try{this._flow(inC$,inB,inContainer);}finally{inContainer.flowing=false;}},_flow:function(inC$,inB,inContainer){for(var i=0,c,b;(c=inC$[i]);i++){b=this.geometryToBounds(c,inB,inContainer);c.bounds.setBounds(b);if(c.flow){c.flow();}}},geometryToBounds:function(c,cb,p){var b={};if(c._width){b.w=opus.extentToPx(c._width,cb.w);}
if(c._height){b.h=opus.extentToPx(c._height,cb.h);}
b.l=opus.extentToPx(c._left,cb.w)+cb.l;b.t=opus.extentToPx(c._top,cb.h)+cb.t;if(c._right){var rpx=opus.extentToPx(c._right,cb.w);if(c._left){var lpx=b.l-cb.l;if(c._width){b.l+=((cb.w-lpx-rpx)-b.w)/2;}else{b.w=cb.w-lpx-rpx;}}else{b.l=cb.w-rpx-b.w+cb.l;}}
switch(c.horizontalAlign){case'left':b.l=cb.l;break;case'right':b.l=cb.w-b.w;break;case'center':b.l=Math.max(cb.l,(cb.w-b.w)/2);break;}
if(c._bottom){var bpx=opus.extentToPx(c._bottom,cb.h);if(c._top){var tpx=b.t-cb.t;if(c._height){b.t+=((cb.h-tpx-bpx)-b.h)/2;}else{b.h=cb.h-tpx-bpx;}}else{b.t=cb.h-bpx-b.h+cb.t;}}
switch(c.verticalAlign){case'top':b.t=cb.t;break;case'bottom':b.t=cb.h-b.h;break;case'center':b.t=Math.max(cb.t,(cb.h-b.h)/2);break;}
return b;}});opus.Class("opus.layout.Relative",{isa:opus.Layout,styles:{position:"relative"},geometryToBounds:function(c,cb,p){c.top=null;var b=this.inherited(arguments);b.l-=cb.l;delete b.t;if(c.node){c.node.style.top="";}
return b;}});opus.layoutRegistry.register("relative",opus.layout.Relative);opus.Class("opus.layout.None",{isa:opus.Layout,_flow:function(inC$,inB,inContainer){for(var i=0,c;(c=inC$[i]);i++){if(c.flow){c.flow();}}}});opus.layoutRegistry.register("none",opus.layout.None);opus.Class("opus.layout.Inline",{isa:opus.layout.None,styles:{position:"static",display:"inline"}});opus.layoutRegistry.register("inline",opus.layout.Inline);
opus.Class("opus.layout.Absolute",{isa:opus.Layout,styles:{position:"absolute"},constructor:function(){this.hints=[];},_flow:function(inC$,inB,inContainer){this.maxw=0;this.inherited(arguments);},geometryToBounds:function(c,cb,p){var b=this.inherited(arguments);this.maxR=Math.max(this.maxR,b.l+b.w);return b;}});opus.layoutRegistry.register("absolute",opus.layout.Absolute);
opus.Class("opus.layout.HBox",{isa:opus.Layout,styles:{position:"absolute"},_try_flow:function(inC$,inContainer){var b={};var cb=inContainer.getClientBounds();var ex=this.calcExtents(inC$,cb,inContainer);cb.w=Math.round(ex.free*ex.elastic);var maxh=0,l=cb.l;for(var i=0,c;c=inC$[i];i++){b=this.geometryToBounds(c,cb,inContainer);b.l=l;c.bounds.setBounds(b);if(c.flow){c.flow();}
l+=c.bounds.w;maxh=Math.max(maxh,c.bounds.h);}
b.maxh=maxh;return b;},_flow:function(inC$,inB,inContainer){var c=inContainer;c.bounds.scrollbarExtents={h:c._overflowed?17:0,w:0};var b=this._try_flow(inC$,c);if(c.scroll!==false){var overflow=((c.horizontalAlign!="fit"||c.width!="auto")&&b.l>inB.w+inB.l+8)?"auto":null;if(Boolean(overflow)!=Boolean(c._overflowed)){c._overflowed=!c._overflowed;c.bounds.scrollbarExtents={h:c._overflowed?17:0,w:0};b=this._try_flow(inC$,c);}
var ox=c.style.styles.overflowX;if(!(ox==overflow)){c.style.addRuntimeStyles({overflowX:overflow});c.bounds.dirty();}}
if(c.horizontalAlign=="fit"||c.width=="auto"){c.bounds.setClientSize({w:b.l-inB.l});}
if(c.verticalAlign=="fit"||c.height=="auto"){c.bounds.setClientSize({h:b.maxh});}},calcExtents:function(inC$,inB,inContainer){var fixed=0,elastic=0;for(var i=0,c;c=inC$[i];i++){if(c._width){if(c._width.units=="%"){elastic+=c._width.value;}else{fixed+=c._width.value}}}
return{fixed:fixed,free:inB.w-fixed,elastic:(elastic>100)?100.0/elastic:1.0}},suggest:function(inHit,ioSuggest,inB,inDrag){kit.mixin(ioSuggest,{i:0,l:0,t:inB.t,h:inB.h,w:2});for(var i=0,c;c=this.dropList[i];i++){if(inHit.l<(c.bounds.l+c.bounds.w/2)){ioSuggest.i=i;ioSuggest.l=Math.max(0,c.bounds.l-1);return;}
ioSuggest.i=i+1;ioSuggest.l=c.bounds.l+c.bounds.w;}}});opus.layoutRegistry.register("hbox",opus.layout.HBox);opus.layoutRegistry.register("columns",opus.layout.HBox);opus.Class("opus.layout.VBox",{isa:opus.Layout,styles:{position:"absolute"},_try_flow:function(inC$,inContainer){var cb=inContainer.getClientBounds();var b={l:cb.l,t:cb.t};for(var i=0,c,gb;c=inC$[i];i++){if(c.height=="auto"){gb=this.geometryToBounds(c,cb,inContainer);c.bounds.setBounds({w:gb.w});if(c.flow){c.flow();}}}
var ex=this.calcExtents(inC$,cb,inContainer);cb.h=ex.free*ex.elastic;var maxw=0,t=b.t;for(var i=0,c;c=inC$[i];i++){b=this.geometryToBounds(c,cb,inContainer);b.h=b.h||0;b.t=t;c.bounds.setBounds(b);if(c.flow){c.flow();}
t+=c.bounds.h;maxw=Math.max(maxw,c.bounds.w);}
b.t=t;b.maxw=maxw;return b;},_flow:function(inC$,inB,inContainer){var c=inContainer;c.bounds.scrollbarExtents={w:c._overflowed?17:0,h:0};var b=this._try_flow(inC$,c);if(c.scroll!==false){var overflow=((c.verticalAlign!="fit"&&c.height!="auto")&&b.t>inB.h+inB.t+8)?"auto":null;if(Boolean(overflow)!=Boolean(c._overflowed)){c._overflowed=!c._overflowed;c.bounds.scrollbarExtents={w:c._overflowed?17:0,h:0};b=this._try_flow(inC$,c);}
var oy=c.style.styles.overflowY;if(!(oy==overflow)){c.style.addRuntimeStyles({overflowY:overflow});c.bounds.dirty();}}
if(c.verticalAlign=="fit"||c.height=="auto"){var h=b.t-inB.t;if(h<=0){if(c.isDesigning()){h=null;}}
c.bounds.setClientSize({h:h});}
if(c.horizontalAlign=="fit"||c.width=="auto"){c.bounds.setClientSize({w:b.maxw});}
if(c.parent&&(c.width=="auto"||c.height=="auto")&&!c.parent.flowing&&c.bounds.sizeDirty){c.bounds.sizeDirty=false;c.parent.reflow();}},calcExtents:function(inC$,inB,inContainer){var fixed=0,elastic=0;for(var i=0,c;c=inC$[i];i++){if(c.height=="auto"){fixed+=c.bounds.h;}else if(c._height){if(c._height.units=="%"){elastic+=c._height.value;}else{fixed+=c._height.value}}}
return{fixed:fixed,free:inB.h-fixed,elastic:(elastic>100)?100.0/elastic:1.0}},suggest:function(inHit,ioSuggest,inB,inDrag){kit.mixin(ioSuggest,{i:0,t:inB.t,l:inB.l,w:inB.w,h:2});for(var i=0,c;c=this.dropList[i];i++){if(inHit.t<(c.bounds.t+c.bounds.h/2)){ioSuggest.i=i;ioSuggest.t=Math.max(0,c.bounds.t-1);return;}
ioSuggest.i=i+1;ioSuggest.t=c.bounds.t+c.bounds.h;}}});opus.layoutRegistry.register("vbox",opus.layout.VBox);opus.layoutRegistry.register("rows",opus.layout.VBox);
opus.Class("opus.layout.Float",{isa:opus.layout.Relative,styles:{float:"left",position:"relative"},geometryToBounds:function(c,cb,p){var b=this.inherited(arguments);delete b.l;return b;}});opus.layoutRegistry.register("float",opus.layout.Float);
opus.Class("opus.layout.Grid",{isa:opus.Layout,styles:{},published:{layoutCellWidth:{value:100},layoutCellHeight:{value:100}},getLayoutCellWidth:function(inContainer){return inContainer.layoutCellWidth||this.layoutCellWidth;},getLayoutCellHeight:function(inContainer){return inContainer.layoutCellHeight||this.layoutCellHeight;},_flow:function(inC$,inB,inContainer){var cr=inContainer;var ex=this.calcExtents(inC$,inB,cr);cr.bounds.scrollbarExtents={w:ex.overflow?17:0,h:0};if(cr.height=="auto"){cr.bounds.setClientSize({h:ex.h});}else if(cr.scroll){if(cr.style.styles.overflowY!=ex.overflow){cr.style.addStyles({overflowY:ex.overflow});cr.bounds.boundsDirty=cr.bounds.sizeDirty=true;}}
var cb=cr.getClientBounds();var cw=this.getLayoutCellWidth(cr);var ch=this.getLayoutCellHeight(cr);var ew=0;if(cr.layoutStretchColumns||this.layoutStretchColumns){cw=cb.w/ex.columns;}else{ew=(cb.w-ex.columns*cw)/2;}
var b={t:cb.t,l:cb.l+ew,w:cw,h:ch};for(var i=0,c;c=inC$[i];i++){c.bounds.setBounds(b);if(c.flow){c.flow();}
b.l+=cw;if(i%ex.columns==ex.columns-1){b.l=cb.l+ew;b.t+=ch;}}},calcHeight:function(inC$,inContainer,inCols){var rows=Math.ceil(inC$.length/inCols);return rows*this.getLayoutCellHeight(inContainer);},calcExtents:function(inC$,inB,inContainer){var w=inB.w+inContainer.bounds.scrollbarExtents.w;var cw=this.getLayoutCellWidth(inContainer);var ch=this.getLayoutCellHeight(inContainer);var columns=Math.max(Math.floor(w/cw),1);var h=this.calcHeight(inC$,inContainer,columns);var overflow=(h>inB.h);if(overflow&&inContainer.height!="auto"){columns=Math.max(Math.floor((w-17)/cw),1);}
return{columns:columns,h:h,overflow:overflow?"auto":null};}});opus.layoutRegistry.register("grid",opus.layout.Grid);
opus.Class("opus.ContainerBase",{isa:opus.Control,defaultControlType:"Control",defaultContainerType:"Container",constructor:function(inProps){this.c$=[];},create:function(){this.inherited(arguments);this.createChrome(this.chrome);this.createControls(this.controls);},importProperties:function(inProps){opus.reindex(inProps,{layout:"layoutKind"});this.inherited(arguments);},installComponent:function(inComponent,inChildProps){this.inherited(arguments);if(inComponent instanceof opus.Control){inComponent.setManager(this);}},createChrome:function(inChrome){if(inChrome){this.createComponents(inChrome,{owner:this});}},createControls:function(inControls){if(inControls){this.createComponents(inControls);}},destructor:function(){this.destructControls();this.inherited(arguments);this.c$=null;},destructControls:function(){var c$=[].concat(this.getControls());for(var i=0,c;(c=c$[i]);i++){c.destructor();}},destroyControls:function(){this.markForDestroy();this.destructControls();this.unMarkForDestroy();this.reflow();this.renderContent();},markForDestroy:function(){if(!this._destroying){this.markControlsForDestroy();}
this.inherited(arguments);},markControlsForDestroy:function(inList){var m$=this.getControls();for(var i=0,c;(c=m$[i]);i++){c.markForDestroy();}}});opus.ContainerBase.extend({getControlParent:function(){return this.controlParent||this.$.client||this;},isContainerClient:function(){return this.owner&&this.owner.getControlParent&&(this.owner.getControlParent()==this);},addControl:function(inControl){var p=(inControl.owner==this)?this:this.getControlParent();inControl.setParent(p);},removeControl:function(inControl){inControl.setParent(null);},getControls:function(){var c$;if(this.$.client){c$=this.$.client.c$;if(!c$){console.error("Container.getControls: tried to get c$ on a non-container 'client' object (which has no controls)");c$=[];}
return c$;}else{if(!this.c$){console.error("Container.getControls: tried to get c$ on a container that has been destroyed");return[];}
c$=[];for(var i=0,c;(c=this.c$[i]);i++){if(c.owner!=this){c$.push(c);}}
return c$;}},indexOf:function(inControl){var c$=this.getControls();for(var i=0,c;(c=c$[i]);i++){if(c==inControl){return i;}}
return-1;},controlAtIndex:function(inIndex){return(this.getControls())[inIndex];}});opus.ContainerBase.extend({adjustSubcomponentProps:function(inProps){if(!inProps.type){inProps.type=inProps.controls?this.defaultContainerType:this.defaultControlType;}
if(!inProps.manager){inProps.manager=this;}
this.inherited(arguments);},addChild:function(inChild){this.c$.push(inChild);},removeChild:function(inChild){var i=this.indexOfChild(inChild);if(i>=0){this.c$.splice(i,1);return i;}},indexOfChild:function(inChild){for(var i=0,c;(c=this.c$[i]);i++){if(c==inChild){return i;}}
return-1;},moveChild:function(inChild,inBeforeIndex){var i=this.removeChild(inChild);var delta=(i>=0&&i<inBeforeIndex)?1:0;var before=inBeforeIndex-delta;this.c$.splice(before,0,inChild);}});opus.ContainerBase.extend({getContent:function(){var h='';for(var i=0,c;(c=this.c$[i]);i++){h+=c.generateHtml();}
return h;},contentRendered:function(){this.inherited(arguments);this.nodesRendered();},nodesRendered:function(){for(var i=0,c;(c=this.c$[i]);i++){c.nodeRendered();c.contentRendered();c.stylesRendered();}}});opus.ContainerBase.extend({exportProperties:function(){var props=this.inherited(arguments);return props;},shouldExportComponent:function(inComponent,inRoot){return this.inherited(arguments)&&!((inComponent instanceof opus.Control)&&inComponent.parent);},shouldExportChild:function(inChild,inRoot){return(inChild.owner==inRoot)&&!inChild.noExport;},exportControls:function(inRoot){var children=[];var c$=this.getControls();for(var i=0,c;(c=c$[i]);i++){if(this.shouldExportChild(c,inRoot)){children.push(c.exportComponent(inRoot));}}
return children;},exportComponent:function(inRoot){var props=this.inherited(arguments);var controls=this.exportControls(inRoot||this);if(controls.length){props.controls=controls;}
return props;}});opus.Class("opus.Container",{isa:opus.ContainerBase,published:{content:{noExport:true},layoutKind:{value:"absolute"},dropTarget:{value:false,noInspect:true},scroll:{value:false}},defaultStyles:{overflow:"hidden",borderColor:"lightblue"},create:function(){this.inherited(arguments);this.layout=this.layout||opus.layoutRegistry.fetch(this.layoutKind);},layoutKindChanged:function(){this.layout=opus.layoutRegistry.fetch(this.layoutKind);this.childrenSetupFlow();this.reflow();},geometryChanged:function(){if(this.width=="auto"||this.height=="auto"){this.invalidateFlow();}
this.inherited(arguments);},validateFlow:function(){this.bounds.sizeDirty=false;},invalidateFlow:function(){this.bounds.sizeDirty=true;},isFlowInvalid:function(){return this.bounds.sizeDirty;},doFlow:function(){if(this.layout&&!this.isUpdating()){this.validateFlow();var f$=this.buildFlowList();this.layout.flow(f$,this.getClientBounds(),this);}},flow:function(){if(this.isFlowInvalid()){this.doFlow();}},reflow:function(){if(!this.readied){return;}
opus.reflowing=true;try{this.doFlow();this.updateFlowBounds();}finally{opus.reflowing=false;}},updateFlowBounds:function(){if(this.bounds.boundsDirty){this.renderBounds();}
for(var i=0,c;(c=this.c$[i]);i++){if(c.bounds.boundsDirty){c.renderBounds();if(c.updateFlowBounds){c.updateFlowBounds();}}}},buildFlowList:function(){var fl=[];for(var i=0,c;(c=this.c$[i]);i++){if(c.inFlow!==false){if(c.showing!==false){fl.push(c);}else if(c._neverFlowed){if(c.childrenSetupFlow){c.childrenSetupFlow();}}
if(c._neverFlowed){this.setupFlow(c);}}}
return fl;},setupFlow:function(inC){inC._neverFlowed=false;this.layout.setup(inC,this);},childrenSetupFlow:function(){for(var i=0,c;(c=this.c$[i]);i++){if(c.inFlow!==false){this.setupFlow(c);if(c.childrenSetupFlow){c.childrenSetupFlow();}}}},setBounds:function(){this.bounds.setBounds.apply(this.bounds,arguments);if(this.bounds.sizeDirty){this.doFlow();this.updateFlowBounds();}
if(this.bounds.boundsDirty){this.renderBounds();}}});opus.Container.extend({dropTarget:false,canDrag:function(inDrag){},canDrop:function(inDrag){return true;},dragEnter:function(inDrag){this.layout.dragEnter(inDrag);},dragOver:function(inDrag){this.layout.dragOver(inDrag);},dragLeave:function(inDrag){this.layout.dragLeave(inDrag);},dragDrop:function(inDrag){this.layout.dragDrop(inDrag);},dropControl:function(inChild,inDropInfo,inOwner){var c=inChild,p=null;if(c instanceof opus.Control){if(c.manager!=this){p=c.parent;c.setManager(this);if(p){p.reflow();}}}else{c=this.createComponent(c,{owner:inOwner});if(c.setCaption){c.setCaption(c.name);}}
if(c instanceof opus.Control){c=this.controlDropped(c,inDropInfo);}
c.notifyUpdate("componentDropped");return c;},controlDropped:function(inChild,inDropInfo){inChild.parent.dropChild(inChild,inDropInfo);return inChild;},dropChild:function(inChild,inDropInfo){this.moveChild(inChild,inDropInfo.i);if(!inChild.node){inChild.renderNode();inChild.parentNode=null;}
this.insertNodeAt(inChild.node,inDropInfo.i);this.layout.dragBoundsToGeometry(inChild,{l:inDropInfo.l,t:inDropInfo.t});this.reflow();}});
opus.Class("opus.View",{isa:opus.Container,defaultStyles:{position:"relative"},minWidth:0,minHeight:0,constructor:function(){document.body.style.overflow="hidden";document.body.style.minHeight="64px";},destructor:function(){dojo.disconnect(this._resizeConnect);this.inherited(arguments);},create:function(){this._resizeConnect=dojo.connect(window,"resize",this,"resize");this.inherited(arguments);},ready:function(){this.inherited(arguments);this.render();},render:function(){opus.viewRender=true;try{if(!this.parentNode){this.setParentNode(document.body);}else{this.parentNode=kit.byId(this.parentNode);}
this.adjustSize();this.inherited(arguments);}finally{opus.viewRender=false;}},getSizeNode:function(){return this.parentNode;},adjustSize:function(){var n=this.getSizeNode();if(n){if(n.clientWidth==0||n.clientHeight==0){return;}
this.setBounds({w:Math.max(n.clientWidth,this.minWidth),h:Math.max(n.clientHeight,this.minHeight)});}},resize:function(){if(kit.isWebKit){setTimeout(kit.hitch(this,"adjustSize"),100);}else{this.adjustSize();}}});
opus.json={_block:function(p,inDent){p=p.join(",\n");var j=(p?"\n"+p+"\n"+inDent:"");return j;},obj:function(inObj,inDent){var p=[],pp,v;for(var n in inObj){v=inObj[n];if(n=="isa"){v=v.prototype.declaredClass;}else{v=this.value(v,inDent+"\t");}
pp=inDent+"\t"+n+': '+v;p.push(pp);}
return"{"+this._block(p,inDent)+"}";},array:function(inObj,inDent){var p=[],pp;for(var i=0,v;v=inObj[i];i++){pp=inDent+"\t"+this.value(v,inDent+"\t");p.push(pp);}
return"["+this._block(p,inDent)+"]";},value:function(v,inDent){var t=(v===null||v===undefined)?"":typeof v;switch(t){case"string":v=v.replace(/\\/g,"\\\\").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\"/g,"\\\"");return'"'+v+'"';case"function":var lines=v.toString();lines=lines.replace(/\n*\r/g,"\n");lines=lines.replace(/(^\.\.\.\.)|[\.\t]+(\.\.\.\.)/g,"\t");lines=lines.split("\n");return lines.join("\n"+inDent);case"object":return(v.constructor==Array)?this.array(v,inDent):this.obj(v,inDent);default:return v;}},to:function(inValue){return this.value(inValue,"");},from:function(inJson){return eval('('+inJson+')');}};
opus.Gizmo=function(inConfig){var factory=kit.getObject(inConfig.name);if(factory){kit.mixin(factory.config,inConfig);}else{factory=kit.setObject(inConfig.name,opus._createGizmoFactory(inConfig));}
return factory;};opus._createGizmoClass=function(inConfig){var isa=opus.findConstructorForType(inConfig.type||inConfig.isa);if(isa.isFactory){isa=opus._createGizmoClass(isa.config);}
inConfig.isa=isa;opus.reindex(inConfig,opus._importPropMap);var name=inConfig.name;delete inConfig.name;return opus.Class(name,inConfig);};opus._gizmoFactory=function(inProps){var ctor=opus._createGizmoClass(inConfig);var obj=new ctor(inProps);return obj;};opus._createGizmoFactory=function(inConfig){var factory=function(inProps){var ctor=opus._createGizmoClass(inConfig);var obj=new ctor(inProps);return obj;};factory.config=inConfig;factory.isFactory=true;return factory;};
opus.Class("opus.Image",{isa:opus.Control,published:{src:{value:"",onchange:"attributesChanged"},alt:{value:"",onchange:"attributesChanged"}},nodeTag:"img",renderDomContent:function(){},modifyDomAttributes:function(ioAttributes){kit.mixin(ioAttributes,{src:this.rewritePath(this.src),alt:this.alt,onload:"opus.bubble(event)"});},reset:function(inSrc,inW,inH,inAlt){this.hide();this.setSrc(inSrc);this.setWidth(inH);this.setHeight(inH);this.setAlt(inAlt);}});opus.Class("opus.Picture",{isa:opus.Container,published:{src:{value:"$opus-controls/images/tatami.png",editor:{editorKind:"ImagePathEditor"}},alt:"",autoSize:true},loadingImg:"ajax-loader.gif",defaultControlType:"Image",chrome:[{name:"image",verticalAlign:"center",horizontalAlign:"center",alt:""}],create:function(){this.image=new Image();this.image.onload=kit.hitch(this,"imageLoaded");this.image.onerror=kit.hitch(this,"imageError");this.inherited(arguments);this.altChanged();this.srcChanged();},destructor:function(){clearTimeout(this._loadTimeout);this.inherited(arguments);},adjustSize:function(){var w=this.image.width;var h=this.image.height;if(this.autoSize){var ar=w/h;var cb=this.getClientBounds();w=cb.w;h=cb.h;if(h*ar>w){h=w/ar;}else{w=h*ar;}}
this.$.image.setWidth(w);this.$.image.setHeight(h);},boundsChanged:function(){if(this.$.image&&this.$.image.node){this.adjustSize();}},altChanged:function(){this.$.image.setAlt(this.alt);},srcChanged:function(){this.image.src=this.rewritePath(this.src);if(!this.src){this.imageLoaded();}},imageLoaded:function(e){if(!this.$.image||!this.$.image.canRender()){this._loadTimeout=setTimeout(kit.hitch(this,"imageLoaded"),1);return;}
this._loadTimeout=null;this.$.image.setSrc(this.image.src);this.adjustSize();this.$.image.show();},imageError:function(e){}});
Ares={setupStage:function(){if(!this.viewOwner){this.viewOwner=new opus.Component();}},setupSceneAssistant:function(inSceneAssistant,inName){this.setupStage();var sc=inSceneAssistant.controller;Ares.mojoSceneController=sc;if(!inSceneAssistant.view){this.setupView(inSceneAssistant,inName);}
this.installControllerGet(sc);},setupView:function(inSceneAssistant,inName){var sc=inSceneAssistant.controller;with(sc.sceneElement){if(!sc.scrollingEnabled){parentNode.style.height="100%";parentNode.parentNode.style.height="100%";}
style.height="100%";}
var n=this.fetchSceneNode(sc.sceneElement);var name=inName||n.getAttribute("kind")||sc.sceneName;this.makeViewForAssistant(name,inSceneAssistant,n);},setupDialog:function(inSceneAssistant,inDialog,inName){inSceneAssistant.controller=inDialog._mojoController.scene;inSceneAssistant.dialog=inDialog;if(!inSceneAssistant.view){var n=this.fetchDialogNode();if(n){this.makeViewForAssistant(inName,inSceneAssistant,n,{type:"Palm.Mojo.DialogView"});}}},makeViewForAssistant:function(inName,inAssistant,inNode,inProps){var props={type:"View",owner:this.viewOwner,parentNode:inNode,chrome:[{name:inName,type:inName,modelProxy:inAssistant,sceneController:inAssistant.controller,dispatchProxy:inAssistant}],layoutKind:"vbox",scroll:false,h:"100%",w:"100%"};if(inProps){props=kit.mixin(props,inProps);}
var view=opus.createComponent(props);this.attachViewToAssistant(inAssistant,view);return view;},attachViewToAssistant:function(inAssistant,inView){inAssistant.view=inView;inAssistant.doc=inAssistant.view.c$[0];inAssistant.$=inAssistant.doc.$;},installControllerGet:function(inSceneController){inSceneController._get=inSceneController.get;inSceneController.get=this._controllerGet;},_controllerGet:function(inId){var n=this._get(inId);if(n){return n;}else{var c=this.assistant.view.$[inId]||this.assistant.$[inId];if(c){return c.fetchMojoNode?c.fetchMojoNode():(c.getNode?c.getNode():c);}}},fetchSceneNode:function(inNode){var nodes=inNode.querySelectorAll(".ares");return nodes.length?nodes[0]:inNode;},fetchDialogNode:function(){var nodes=document.body.querySelectorAll("div[x-mojo-dialog] > .palm-dialog-wrapper");return nodes.length&&nodes[0];},cleanupSceneAssistant:function(inSceneAssistant){var n=inSceneAssistant.view.node;if(n){Mojo.removeAllEventListenersRecursive(n);}
inSceneAssistant.view.destroy();inSceneAssistant.view=inSceneAssistant.$=inSceneAssistant.doc=null;}};
Palm=window["Palm"]||{};Palm.fetchTypedValue=function(inValue){if(inValue=="false"){inValue=false;}else if(inValue=="true"){inValue=true;}else if(String(Number(inValue))==String(inValue)){inValue=Number(inValue);}
return inValue;}
Palm.fetchJsonValue=function(inValue,inDefault){var v=inValue;if(kit.isString(v)){try{v=opus.json.from(v);}catch(x){console.log("Malformed JSON",x);v=null;}}
return v||inDefault;}
opus.Class("Palm.Mojo.WidgetMixin",{scroll:false,constructor:function(){this.attributes={};this.mojoAttributes={};this._mojoConnections=[];},destructor:function(){this.destroyWidget();this.inherited(arguments);},destroyWidget:function(){if(this.mwc){Mojo.Controller.WidgetController.prototype.aresCleanup.call(this.mwc);this.mwc=null;var node=this.fetchMojoNode();if(node){node._mojoController=undefined;}
kit.forEach(this._mojoConnections,kit.disconnect);this._mojoConnections=[];if(this.isDesigning()&&!this.isModelInUse()){this.deleteModel();}}},ready:function(){this.inherited(arguments);if(this.owner.mojoRendering){this.applyMojoClassAttribute();this.setupWidget(this.fetchMojoControl().globalId);}},generateHtml:function(){this.destroyWidget();return this.inherited(arguments);},fetchMojoControl:function(){return this;},applyMojoClassAttribute:function(){this.fetchMojoControl().attributes["x-mojo-element"]=this.mojoClass;},renderWidget:function(){if(this.isRendering()||this.owner.mojoRendering){return;}
this._rendering=true;if(this.mojoClass){this.createWidget();}
this._rendering=false;},setupWidget:function(inId){this.fetchSceneController().setupWidget(inId,this.mojoAttributes,this.fetchModel());},createWidget:function(){this.populateModel();var node=this.fetchMojoNode();node.setAttribute("x-mojo-element",this.mojoClass);this.setupWidget(node.id);try{this.mwc=new Mojo.Controller.WidgetController(node,this.fetchSceneController());}catch(e){console.log("Error creating widget",e);}
if(this.mwc){this.postCreateWidget();}},postCreateWidget:function(){this.mwc.cleanup=opus.nop;this.mwc.element.removeEventListener('DOMNodeRemovedFromDocument',this.mwc.cleanupHandler,false);this._mojoConnections.push(kit.connect(this.mwc,"setModel",this,"mojoModelReplaced"));this.generateModelReference();},isRendering:function(){return this._rendering;},reRenderWidget:function(){if(this.canRender()){this.destroyWidget();this.renderWidget();}},fetchSceneController:function(){return this.owner.sceneController||Ares.mojoSceneController;},fetchModelProxy:function(){return this.owner.modelProxy||Ares.mojoSceneController.assistant;},fetchMojoNode:function(){return this.getNode();},mojoModelReplaced:function(){this.generateModelReference();},generateModelReference:function(){var modelProxy=this.fetchModelProxy();modelProxy.widgetModels=modelProxy.widgetModels||{};modelProxy.widgetModels[this.name]=this.fetchModel();},populateModel:function(){var props=this.published;var model=this.fetchModel();var p,v,mp;for(var i in props){p=props[i];if(p.isModelData){mp=p.modelPropertyName?this[p.modelPropertyName]:(p.modelProperty?p.modelProperty:i);v=model[mp];if(v===undefined){this.setProperty(i,this[i]);}}}},fetchModel:function(){if(this.mwc){return this.mwc.model;}else{var modelProxy=this.fetchModelProxy();var model;if(modelProxy.fetchWidgetModel){model=modelProxy.fetchWidgetModel(this);}else if(this.modelName){model=modelProxy[this.modelName]||(modelProxy[this.modelName]={});}else{model=this.model||(this.model={});}
return model;}},isModelInUse:function(){var m=this.fetchModel();var c=this.fetchSceneController();for(var i=0,w;w=c._modelWatchers[i];i++){if(m===w.model){return true;}}},deleteModel:function(){if(this.modelName){var modelProxy=this.fetchModelProxy();delete modelProxy[this.modelName];}
this.model={};},modelNameChanged:function(){this.reRenderWidget();},fetchModelProperty:function(inProperty,inDefault){var model=this.fetchModel();var v=model&&model[inProperty];return v===undefined?inDefault||this[inProperty]:v;},modelChanged:function(){var mojoController=this.fetchSceneController();if(this.mwc&&mojoController){mojoController.modelChanged(this.fetchModel());}},modelPropertyChanged:function(inModelProperty,inValue){var model=this.fetchModel();model[inModelProperty]=arguments.length<2?this[inModelProperty]:inValue;this.modelChanged();},deleteModelProperty:function(inModelProperty){var model=this.fetchModel();delete model[inModelProperty];this.modelChanged();},mojoAttributeChanged:function(inMojoAttribute,inValue){this.mojoAttributes[inMojoAttribute]=arguments.length<2?this[inMojoAttribute]:inValue;this.reRenderWidget();},deleteMojoAttribute:function(inMojoAttribute){delete this.mojoAttributes[inMojoAttribute];this.reRenderWidget();}});opus.Class("Palm.Mojo.ControlMixin",{isa:opus.Object,published:{onclick:{noInspect:true},ondblclick:{noInspect:true},onmouseover:{noInspect:true},onmouseout:{noInspect:true},onmousedown:{noInspect:true},onmouseup:{noInspect:true},oncontextmenu:{noInspect:true},onshowingchanged:{noInspect:true},ontap:{event:Mojo.Event.tap+"Handler"},onhold:{event:Mojo.Event.hold+"Handler"},onholdEnd:{event:Mojo.Event.holdEnd+"Handler"},hint:{noInspect:true},className:""},constructor:function(){this.attributes={};},create:function(){this.inherited(arguments);this.classNameChanged();},classNameChanged:function(){if(this.className){this.attributes.className=this.className;this.attributesChanged();}}});opus.Class("Palm.Mojo.Widget",{isa:opus.Control,mixins:[Palm.Mojo.WidgetMixin,Palm.Mojo.ControlMixin],defaultStyles:{},published:{modelName:{value:"",model:true,group:"Model"},content:{noInspect:true}},nodeRendered:function(){this.inherited(arguments);this.reRenderWidget();}});Mojo.Controller.WidgetController.prototype.aresCleanup=function(){if(Number(Mojo.Version.use)<311){this._cleanupWithoutDelay();}else{Mojo.Controller.WidgetController.prototype.cleanup.call(this);}}
Mojo.Controller.WidgetController.prototype._cleanupWithoutDelay=function(){if(this.reparenting){return;}
this.scene.removeWatcher(this.assistant);if(this.assistant.remeasure||this.assistant.subtreeShown){this.stopListening(this.scene.sceneElement,Mojo.Event.subtreeShown,this._maybeSubtreeShown);}
if(this.assistant.remeasure||this.assistant.orientationChange){this.stopListening(this.scene.sceneElement,Mojo.Event.orientationChange,this._maybeOrientationChange);}
if(this.assistant.subtreeHidden){this.stopListening(this.scene.sceneElement,Mojo.Event.subtreeHidden,this._maybeSubtreeHidden);}
if(this.assistant.cleanup){this.assistant.cleanup();}
if(this.element){Mojo.removeAllEventListenersRecursive(this.element);}
delete this.element;}
opus.View.extend({create:function(){this._resizeListener=kit.hitch(this,"resize");window.addEventListener("resize",this._resizeListener,false);this.inherited(arguments);},destructor:function(){window.removeEventListener("resize",this._resizeListener,false);this.inherited(arguments);}});opus.Class("Palm.Mojo.DialogView",{isa:opus.View,minHeight:50,create:function(){this.inherited(arguments);this.setHeight("auto");},adjustSize:function(){var n=this.getSizeNode();if(n){if(n.clientWidth==0){return;}
var gcs=document.defaultView.getComputedStyle(n,null);var pw=parseFloat(gcs.paddingLeft)+parseFloat(gcs.paddingRight);this.setBounds({w:Math.max(n.clientWidth-pw,this.minWidth),h:Math.max(this.bounds.h||0,this.minHeight)});}},});
opus.bubble=function(e){if(e){opus.dispatcher.dispatch(kit.fixEvent(e));}};opus.Class("opus.Dispatcher",{isa:opus.Object,constructor:function(){this.captures=[];this.connect();},events:["click","dblclick","contextmenu","mousedown","mouseup","mouseover","mouseout","mousemove","keypress","keyup","keydown","focus","blur","paste","change","load","error","scroll",Mojo.Event.tap,Mojo.Event.flick,Mojo.Event.keypress,Mojo.Event.hold,Mojo.Event.holdEnd,Mojo.Event.propertyChange,Mojo.Event.filter,Mojo.Event.filterImmediate,Mojo.Event.imageViewChanged,Mojo.Event.scrollStarting,Mojo.Event.progressComplete,Mojo.Event.listChange,Mojo.Event.listTap,Mojo.Event.listAdd,Mojo.Event.listDelete,Mojo.Event.listReorder,Mojo.Event.progressIconTap,Mojo.Event.progressComplete,"mousewheel","DOMMouseScroll"],connect:function(){this.connects=[];this.node=document;this.hitchedDispatch=kit.hitch(this,"dispatch");for(var i=0,n;(n=this.events[i]);i++){this.node.addEventListener(n,this.hitchedDispatch,false);}
this.node._dispatcher=true;},disconnect:function(){for(var i=0,n;(n=this.events[i]);i++){this.node.removeEventListener(n,this.hitchedDispatch,false);}},findDispatchTarget:function(inNode){var t,n=inNode;try{while(n&&!t){t=opus.$[n.id];n=n.parentNode;}}catch(x){}
return t;},dispatchBubble:function(e,c){while(c){if(this.dispatchToTarget(e,c,"")===true){return true;}
c=c.parent;}
return false;},dispatchToTarget:function(e,c,suffix){var isMouseOverOut=(e.type=="mouseover"||e.type=="mouseout");if(isMouseOverOut){if(this.shouldIgnoreMouseOverOut(e,c)){return true;}
var synth={type:"child"+e.type,dispatchTarget:e.dispatchTarget};this.dispatchBubble(synth,c.parent);}
var type=e.type;if(e.type=="DOMMouseScroll"){type="mousewheel";}
var fn=type+"Handler"+suffix;if(c[fn]&&!c.noEvents){var args=[e];if(!(c instanceof Palm.Mojo.Widget||c instanceof Palm.Mojo.WidgetContainer)){args.push(e.dispatchTarget);}
if(c[fn].apply(c,args)!==true){return false;}
return true;}},shouldIgnoreMouseOverOut:function(e,c){var rdt=this.findDispatchTarget(e.relatedTarget);return rdt&&rdt.isDescendantOf(c);},dispatch:function(e){e.cap=e.type.charAt(0).toUpperCase()+e.type.slice(1);var c=this.findDispatchTarget(e.target);e.dispatchTarget=c;var captured=false;if(this.captureTarget&&(e.type!="load")&&(e.type!="error")){if(!c||!c.isDescendantOf(this.captureTarget)){c=this.captureTarget;captured=true;}}
if(c){var handled=this.dispatchBubble(e,c);if(captured&&(e.type=="mouseout"||this.forwardEvents)){handled=this.forward(e);}}},forward:function(e){var c=e.dispatchTarget;return c&&this.dispatchBubble(e,c);},capture:function(inTarget,inShouldForward){if(this.captureTarget){this.captures.push(this.captureTarget);}
this.forwardEvents=inShouldForward;this.captureTarget=inTarget;},release:function(){this.captureTarget=this.captures.pop();}});if(opus.dispatcher){console.warn("Mojo/source/Dispatcher.js: Mojo replacement dispatcher detects an existing Dispatcher: you should not load opus-depends and Palm-Mojo packages at the same time (use opus-Ares instead of opus)");opus.dispatcher.connect=function(){};}
opus.dispatcher=new opus.Dispatcher();
opus.Class("Palm.Mojo.Container",{isa:opus.Container,mixins:[Palm.Mojo.ControlMixin],published:{scroll:{value:false,noInspect:true}},defaultStyles:{border:"",borderColor:null},width:"100%",height:100,layoutKind:"vbox"});
opus.Class("Palm.Mojo.Panel",{isa:Palm.Mojo.Container,published:{focusHighlight:true,layoutKind:{options:["absolute","vbox","hbox"],group:"Common",noInspect:false}},create:function(){this.inherited(arguments);this.focusHighlightChanged();},focusHighlightChanged:function(){this.attributes["x-mojo-focus-highlight"]=this.focusHighlight;this.attributesChanged();}});
opus.Class("Palm.Mojo.WidgetContainer",{isa:Palm.Mojo.Container,mixins:[Palm.Mojo.WidgetMixin],layoutKind:"vbox",width:"100%",height:"300",published:{modelName:{value:"",model:true,group:"Model"},content:{noInspect:true}},fetchMojoControl:function(){return this.$.client;},fetchMojoNode:function(){var c=this.fetchMojoControl();return c?c.getNode():this.getNode();},contentRendered:function(){this.reRenderWidget();this.inherited(arguments);},createWidget:function(){var c=this.fetchMojoControl();if(c!=this){c.setNode(c.globalId);}
this.inherited(arguments);}});
opus.declare("Mojo.Widget.OpusHtml",{setup:function(){this.initializeDefaultValues();this.renderWidget();this.updateDisabledState();},updateDisabledState:function(){this.disabled=this.controller.model[this.disabledProperty];var n=this.controller.element;if(this.disabled){n.removeAttribute('x-mojo-tap-highlight');n.addClassName('disabled');}else{n.setAttribute('x-mojo-tap-highlight','momentary');n.removeClassName('disabled');}},initializeDefaultValues:function(){this.disabledProperty=this.controller.attributes.disabledProperty||Mojo.Widget.defaultDisabledProperty;this.renderCallback=this.controller.attributes.renderCallback;},renderWidget:function(){var templateFile=this.controller.attributes.templateFile;this.controller.element.innerHTML=Mojo.View.render({object:this.controller.model,formatters:this.controller.attributes.formatters||{},inline:templateFile?"":this.controller.attributes.inlineTemplate||" ",template:templateFile});if(this.renderCallback){this.renderCallback();}},handleModelChanged:function(){this.renderWidget();this.updateDisabledState();}});opus.Class("Palm.Mojo.Html",{isa:Palm.Mojo.Widget,mojoClass:"OpusHtml",width:"100%",height:60,published:{onformat:{event:"doFormat"},content:{noInspect:false,editor:{editorKind:"Palm.Ares.CodePropertyEditor"}},templateFile:{value:"",onchange:"mojoAttributeChanged"}},create:function(){this.inherited(arguments);this.mojoAttributeChanged("templateFile");this.contentChanged();},createWidget:function(){this.mojoAttributes.formatters=this.doFormat();this.inherited(arguments);},fetchInlineTemplate:function(){return this.content;},updateInlineTemplate:function(){this.mojoAttributeChanged("inlineTemplate",this.fetchInlineTemplate());},contentChanged:function(){this.updateInlineTemplate();}});
opus.Class("Palm.Mojo.Button",{isa:Palm.Mojo.Widget,published:{disabled:{value:false,isModelData:true},buttonClass:{value:"primary",group:"Common",editorKind:"Combo",editor:{editorKind:"Combo"},options:["primary","secondary","dismissal","affirmative","negative"],isModelData:true,modelProperty:"buttonClass"},label:{value:"Button",isModelData:true,modelPropertyName:"labelPropertyName"},labelPropertyName:{value:"label",model:true,group:"Model"}},width:"100%",height:60,minHeight:60,maxHeight:60,mojoClass:"Button",create:function(){this.inherited(arguments);this.labelPropertyNameChanged();},labelChanged:function(){this.modelPropertyChanged(this.labelPropertyName,this.label);},getLabel:function(){return this.fetchModelProperty(this.labelPropertyName,this.label);},labelPropertyNameChanged:function(){this.mojoAttributeChanged("labelProperty",this.labelPropertyName);},getDisabled:function(){return this.fetchModelProperty(this.disabledPropertyName,this.disabled);},disabledChanged:function(){this.modelPropertyChanged("disabled");},buttonClassChanged:function(){this.modelPropertyChanged("buttonClass",this.buttonClass);}});opus.Class("Palm.Mojo.ActivityButton",{isa:Palm.Mojo.Button,published:{active:false,disabled:{value:false,isModelData:true},buttonClass:{value:"primary",group:"Common",editorKind:"Combo",editor:{editorKind:"Combo"},options:["primary","secondary","dismissal","affirmative","negative"],isModelData:true,modelProperty:"buttonClass"},label:{value:"Button",isModelData:true,modelPropertyName:"labelPropertyName"}},create:function(){this.inherited(arguments);this.mojoAttributes.type=Mojo.Widget.activityButton;},renderWidget:function(){this.inherited(arguments);this.activeChanged();},activeChanged:function(){this.node.mojo[this.active?"activate":"deactivate"]();}});
opus.Class("Palm.Mojo.CheckBox",{isa:Palm.Mojo.Widget,published:{value:{value:true,isModelData:true,modelPropertyName:"valuePropertyName"},valuePropertyName:{value:"value",model:true,group:"Model"},disabled:{value:false,isModelData:true,modelPropertyName:"disabledPropertyName"},disabledPropertyName:{value:"disabled",model:true,group:"Model"},trueValue:"true",falseValue:"false",onchange:{event:Mojo.Event.propertyChange+"Handler"}},defaultStyles:{margin:4},width:40,height:34,minHeight:34,maxHeight:34,mojoClass:"CheckBox",create:function(){this.inherited(arguments);this.valuePropertyNameChanged();this.disabledPropertyNameChanged();this.trueValueChanged();this.falseValueChanged();},getValue:function(){return this.fetchModelProperty(this.valuePropertyName,this.value);},getDisabled:function(){return this.fetchModelProperty(this.disabledPropertyName,this.disabled);},disabledChanged:function(){this.modelPropertyChanged(this.disabledPropertyName,this.disabled);},valueChanged:function(){this.modelPropertyChanged(this.valuePropertyName,this.value);},valuePropertyNameChanged:function(){this.mojoAttributeChanged("modelProperty",this.valuePropertyName);},disabledPropertyNameChanged:function(){this.mojoAttributeChanged("disabledProperty",this.disabledPropertyName);},trueValueChanged:function(){this.trueValue=Palm.fetchTypedValue(this.trueValue);this.mojoAttributeChanged("trueValue");},falseValueChanged:function(){this.falseValue=Palm.fetchTypedValue(this.falseValue);this.mojoAttributeChanged("falseValue");}});
opus.Class("Palm.Mojo.DatePicker",{isa:Palm.Mojo.Widget,mojoClass:"DatePicker",width:"100%",height:60,minHeight:60,maxHeight:60,published:{date:{value:"",isModelData:true,modelPropertyName:"datePropertyName"},datePropertyName:{value:"date",model:true,group:"Model"},label:{value:"Date"},labelPlacement:{value:Mojo.Widget.labelPlacementLeft,options:[Mojo.Widget.labelPlacementLeft,Mojo.Widget.labelPlacementRight],onchange:"mojoAttributeChanged"},month:{value:true,onchange:"mojoAttributeChanged"},day:{value:true,onchange:"mojoAttributeChanged"},year:{value:true,onchange:"mojoAttributeChanged"},maxYear:{value:2099,onchange:"mojoAttributeChanged"},minYear:{value:1900,onchange:"mojoAttributeChanged"},onchange:{event:Mojo.Event.propertyChange+"Handler"}},create:function(){this.inherited(arguments);this.datePropertyNameChanged();this.labelChanged();this.mojoAttributeChanged("labelPlacement");this.mojoAttributeChanged("month");this.mojoAttributeChanged("day");this.mojoAttributeChanged("year");this.mojoAttributeChanged("maxYear");this.mojoAttributeChanged("minYear");},labelChanged:function(){this.mojoAttributeChanged("label",this.label?this.label:" ");},getDate:function(){var d=this.fetchModelProperty(this.datePropertyName,this.date);return d instanceof Date?d.toString():d;},dateChanged:function(){this.modelPropertyChanged(this.datePropertyName,this.date?new Date(this.date):new Date());},datePropertyNameChanged:function(){this.mojoAttributeChanged("modelProperty",this.datePropertyName);}});
opus.fetchNodeHeight=function(inNode){var h=0;for(var i=0,cn=inNode.childNodes,c;c=cn[i];i++){if(c.nodeType==1){h+=c.offsetHeight;}}
return h;}
opus.Class("Palm.Mojo.List",{isa:Palm.Mojo.WidgetContainer,scroll:false,mojoClass:"List",width:"100%",height:250,preventScrollerWatch:true,published:{ontap:{noInspect:true},items:{editor:{editorKind:"Palm.Ares.CodePropertyEditor",isJson:true},isModelData:true,modelPropertyName:"itemsPropertyName",group:"Data"},useSampleData:{value:true,group:"Data"},itemsPropertyName:{value:"items",model:true,group:"Model"},title:{value:"",isModelData:true,modelProperty:"listTitle"},itemDesigner:{value:"Show",noExport:true,group:"Items",editor:{type:"opus.DefaultInspectorField",onValue:"Hide",offValue:"Show",editorKind:"Palm.Ares.EditorToggleButton"}},itemTemplateFile:{value:"",group:"Items"},itemHtml:{value:'<div class="palm-row">\n\t#{label}\n</div>',group:"Items",editor:{editorKind:"Palm.Ares.CodePropertyEditor"}},listTemplateFile:{value:""},nullItemTemplateFile:{value:""},emptyTemplateFile:{value:""},dividerTemplateFile:{value:""},onlistchange:{event:Mojo.Event.listChange+"Handler"},onlisttap:{event:Mojo.Event.listTap+"Handler"},onlistadd:{event:Mojo.Event.listAdd+"Handler"},onlistdelete:{event:Mojo.Event.listDelete+"Handler"},onlistreorder:{event:Mojo.Event.listReorder+"Handler"},onitemrendered:{event:"doItemRendered"},onfetchitems:{event:"doItemsCallback"},onformat:{event:"doFormat"},ondividerfunction:{event:"doDividerFunction"},renderLimit:20,lookAhead:15,addItemLabel:{value:"",onchange:"mojoAttributeChanged",group:"Items"},swipeToDelete:{value:true,onchange:"mojoAttributeChanged",group:"Items"},reorderable:{value:true,onchange:"mojoAttributeChanged",group:"Items"},rowTapHighlight:true,rowFocusHighlight:true,rowIsTextField:false,layoutKind:{noInspect:true}},chrome:[{name:"client",h:"100%",w:"100%",showing:false,type:"Palm.Mojo.Container",layoutKind:"vbox",scroll:false},{name:"list",h:"100%",w:"100%",type:"Palm.Mojo.Container",scroll:false}],create:function(){if(!this.isDesigning()){this.template=this.controls;this.controls=[];}
this.inherited(arguments);this.itemContent=this.createComponent({name:"itemContent",type:"Component",owner:this});},postCreate:function(){this.inherited(arguments);this.itemsPropertyNameChanged();this.useSampleDataChanged();this.onformatChanged();this.mojoAttributeChanged("addItemLabel");this.mojoAttributeChanged("swipeToDelete");this.mojoAttributeChanged("reorderable");this.renderLimitChanged();this.lookAheadChanged();this.dividerTemplateFileChanged();this.itemTemplateFileChanged();this.listTemplateFileChanged();this.nullItemTemplateFileChanged();this.emptyTemplateFileChanged();this.onfetchitemsChanged();this.ondividerfunctionChanged();this.onitemrenderedChanged();},fetchMojoControl:function(){return this.$.list;},destroyWidget:function(){this.inherited(arguments);this.itemContent.destroyComponents();this.invalidateListTemplates();},createWidget:function(){if(this.isDesigning()){this.updateTemplate();}
this.updateMojoInlineTemplate();this.inherited(arguments);},postCreateWidget:function(){var bg=this.mwc.assistant.bigItemsList;if(bg){this._mojoConnections.push(kit.connect(bg,"noticeAddedItems",this,"deferFitHeightToContent"));this._mojoConnections.push(kit.connect(bg,"noticeRemovedItems",this,"deferFitHeightToContent"));}
if(this.mwc.assistant){this._mojoConnections.push(kit.connect(this.mwc.assistant,"renderItemsBefore",this,"deferFitHeightToContent"));}
this.deferFitHeightToContent();if(!this.isNativeRendering()){this.mwc.assistant.orientationChange=kit.hitch(this,"deferOrientationChange");}
this.mwc.assistant.maybeVisible=true;},invalidateListTemplates:function(){var templates=[this.dividerTemplateFile,this.listTemplateFile,this.itemTemplateFile,this.nullItemTemplateFile,this.emptyTemplateFile];for(var i=0,c=templates.length;i<c;i++){this.invalidateMojoTemplate(templates[i]);}},invalidateMojoTemplate:function(inTemplate){var n=Mojo.View._calculateTemplateFileName(inTemplate);delete Mojo.View.templates[n];},isNativeRendering:function(){return this.itemTemplateFile!="";},deferFitHeightToContent:function(){opus.job(this.globalId+"fit",kit.hitch(this,this.fitHeightToContent),250);},fitHeightToContent:function(){var ch=opus.fetchNodeHeight(this.fetchMojoNode());ch=this.isDesigning()?Math.max(100,ch):ch;if(ch!=this._contentHeight){this._contentHeight=ch;this.setHeight(ch);}},updateTemplate:function(){var t=this.$.client;var serial=kit.mixin(t.exportComponent(this.owner),{showing:true,t:0});this.template=serial.controls;},updateMojoInlineTemplate:function(){this.mojoAttributes.inlineItemTemplate=this.isNativeRendering()?"":(this.generateDesignedItemHtml()||this.itemHtml);},generateDesignedItemHtml:function(){this.itemContent.destroyComponents();if(this.template){var client=this.itemClient=this.itemContent.createComponent({type:"Palm.Mojo.Row",styles:{position:"relative"},layoutKind:"relative",tapHighlight:this.rowTapHighlight,focusHighlight:this.rowFocusHighlight,isTextField:this.rowIsTextField,dispatchProxy:this.owner.dispatchProxy,mojoRendering:true,rowType:"",autoRowType:false,parent:null,chrome:[{name:"client",type:"Palm.Mojo.Container",w:"100%",layoutKind:"relative",controls:this.template}]},{owner:this.itemContent,sceneController:this.fetchSceneController()});this.reflowItem(client,this.getClientBounds().w);client.parent=this.$.list;var html=client.getContent();return html;}},onitemrenderedChanged:function(inListNode,inModel,inNode){var attr="onItemRendered";if(this.onitemrendered){this.mojoAttributeChanged(attr,kit.hitch(this,"doItemRendered"));}else{this.deleteMojoAttribute(attr);}},onfetchitemsChanged:function(){var attr="itemsCallback";if(this.onfetchitems){this.mojoAttributeChanged(attr,kit.hitch(this,"doItemsCallback"));}else{this.deleteMojoAttribute(attr);}},itemsPropertyNameChanged:function(){this.mojoAttributeChanged("itemsProperty",this.itemsPropertyName);},getItems:function(){return this.fetchModelProperty(this.itemsPropertyName,this.items);},itemsChanged:function(){this.useSampleData=(this.items==Palm.Mojo.List.sampleData);this.items=Palm.fetchJsonValue(this.items,[]);this.modelPropertyChanged(this.itemsPropertyName,this.items);if(this.readied&&this.isDesigning()){opus.ide.reinspect();}},getTitle:function(){return this.fetchModelProperty("listTitle",this.title);},titleChanged:function(){this.modelPropertyChanged("listTitle",this.title);},useSampleDataChanged:function(){if(this.useSampleData){this.setItems(Palm.Mojo.List.sampleData);}},dividerTemplateFileChanged:function(){this.mojoAttributeChanged("dividerTemplate",this.dividerTemplateFile);},itemTemplateFileChanged:function(){this.mojoAttributeChanged("itemTemplate",this.itemTemplateFile);},listTemplateFileChanged:function(){this.mojoAttributeChanged("listTemplate",this.listTemplateFile);},nullItemTemplateFileChanged:function(){this.mojoAttributeChanged("nullItemTemplate",this.nullItemTemplateFile);},emptyTemplateFileChanged:function(){this.mojoAttributeChanged("emptyTemplate",this.emptyTemplateFile);},ondividerfunctionChanged:function(){this.mojoAttributeChanged("dividerFunction",this.ondividerfunction?this.doDividerFunction.bind(this):null);},onformatChanged:function(){this.mojoAttributeChanged("formatters",this.onformat?this.doFormat():null);},reflowItem:function(inItem,inWidth){inItem.bounds.w=inWidth;inItem.renderBounds();inItem.reflow();},deferOrientationChange:function(){opus.job(this.globalId+"orientation",kit.hitch(this,this.orientationChange),250);},orientationChange:function(){this.updateMojoInlineTemplate();this.mwc.assistant.renderFromModel();},itemDesignerChanged:function(){if(this.itemDesigner=="Hide"){this.$.client.show();this.$.list.hide();}else{this.$.client.hide();this.$.list.show();this.reRenderWidget();}},itemHeightChanged:function(){this.$.client.setHeight(this.itemHeight);if(this.mwc){this.reRenderWidget();}},renderLimitChanged:function(){this.mojoAttributeChanged("renderLimit",Number(this.renderLimit));},lookAheadChanged:function(){this.mojoAttributeChanged("lookAhead",Number(this.lookAhead));},itemHtmlChanged:function(){this.reRenderWidget();}});Palm.Mojo.List.sampleData='[{"item":0,"label":"Zero","value":"0"},\n{"item":1,"label":"One","value":"1"},\n{"item":2,"label":"Two","value":"2"},\n{"item":3,"label":"Three","value":"3"}]'
Mojo.Widget.List.prototype.orientationChange=function(){};Mojo.Widget.List.prototype.renderItemsBefore=function renderItemsBefore(itemModels,beforeNode){var attrs=this.controller.attributes;var divFunc=attrs.dividerFunction;var content,nullContent;var i,formattedObj;var itemTemplate=attrs.itemTemplate;var renderedItems,itemContent,itemNode,itemModel,modelIndex,formattedModels;var confirmedDeletes;var hasWidgets=(this.hasWidgets===undefined)||this.hasWidgets;var secondaryTemplate=this.controller.attributes.secondaryItemTemplate;var avgItemHeight=this.averageItemHeight;var nullItemTemplate=this.nullItemTemplate;var itemModelsLength=itemModels.length;var preventDeleteProperty=this.preventDeleteProperty;var listItemsParent=this.listItemsParent;var onItemRendered=this.onItemRendered;var controllerElement=this.controller.element;var swipeToDelete=this.controller.attributes.swipeToDelete;var autoconfirmDelete=this.controller.attributes.autoconfirmDelete;var contentLength;var secondRunFunc;var allModels;var initPageSize=this._initialPageSize;var splitInitialRender=this.splitInitialRender;if(splitInitialRender&&this.isFirstRequest&&itemModelsLength>initPageSize){allModels=itemModels;itemModels=allModels.slice(0,initPageSize);itemModelsLength=itemModels.length;this.isFirstRequest=undefined;secondRunFunc=this.renderItemsBefore.bind(this,allModels.slice(initPageSize),beforeNode);}
this.log("renderItemsBefore");renderedItems=[];formattedModels=[];for(i=0;i<itemModelsLength;i++){itemModel=itemModels[i];if(itemModel===null){nullContent=nullContent||Mojo.View.render({object:{averageItemHeight:avgItemHeight},template:nullItemTemplate});itemContent=nullContent;formattedObj=null;}else{formattedObj=Mojo.Model.format(itemModel,attrs.formatters);itemContent=Mojo.View.render({object:formattedObj,template:itemTemplate,inline:attrs.inlineItemTemplate});}
if(secondaryTemplate&&itemModel){formattedObj.secondaryContent=itemContent;itemContent=Mojo.View.render({object:formattedObj,template:secondaryTemplate});}
formattedModels.push(formattedObj);renderedItems.push(itemContent);}
content=renderedItems.join('');content=$A(Mojo.View.convertToNodeList(content,this.controller.document));modelIndex=0;contentLength=content.length;for(i=0;i<contentLength;i++){itemNode=content[i];if(itemNode&&itemNode.nodeType===itemNode.ELEMENT_NODE){itemNode._mojoListIndex=-1;itemModel=itemModels[modelIndex];formattedObj=formattedModels[modelIndex];modelIndex++;if(divFunc&&formattedObj){itemNode._mojoListDividerLabel=divFunc(formattedObj);}
listItemsParent.insertBefore(itemNode,beforeNode);if(itemModel){itemNode._mojoListItemModel=itemModel;if(preventDeleteProperty){itemNode._ignoreSwipeToDelete=!!itemModel[preventDeleteProperty];}
if(hasWidgets){this.controller.instantiateChildWidgets(itemNode,itemModel);}}
if(itemModel&&onItemRendered){onItemRendered(controllerElement,itemModel,itemNode);}
if(swipeToDelete&&itemModel&&this.isModelDeleted(itemModel)){this.replaceWithDeleteSpacer(itemNode);if(this.isModelDeleteConfirmed(itemModel)||autoconfirmDelete){itemNode._mojoDeleteSpacer.style.height="0px";confirmedDeletes=confirmedDeletes||[];confirmedDeletes.push(itemNode._mojoDeleteSpacer);}}}}
this.renumberListItems();this.updateDividers();this.updateListClasses();this._maybeRemeasureChildWidgets();if(confirmedDeletes){for(i=0;i<confirmedDeletes.length;i++){this.deleteDraggedItemWithEvent(confirmedDeletes[i]);}}
if(secondRunFunc){if(this.secondRun){this.controller.window.clearTimeout(this.secondRun);}
this.secondRun=this.controller.window.setTimeout(secondRunFunc,0);}
return;}
opus.Class("Palm.Mojo.ProgressPill",{isa:Palm.Mojo.Widget,published:{progress:{value:0.5,isModelData:true,modelPropertyName:"progressPropertyName"},progressPropertyName:{value:"progress",model:true,group:"Model"},startValue:{value:0,isModelData:true,modelPropertyName:"startValuePropertyName"},startValuePropertyName:{value:"startValue",model:true,group:"Model"},title:{value:"Progress",isModelData:true,onchange:"modelPropertyChanged"},titleRight:{value:"",isModelData:true,onchange:"modelPropertyChanged"},image:{value:"",isModelData:true,onchange:"modelPropertyChanged"},icon:{value:"",onchange:"mojoAttributeChanged"},iconPath:{value:"",onchange:"mojoAttributeChanged"},onprogressicontap:{event:Mojo.Event.progressIconTap+"Handler"},onprogresscomplete:{event:Mojo.Event.progressComplete+"Handler"}},width:"100%",height:50,minHeight:50,maxHeight:50,mojoClass:"ProgressPill",create:function(){this.inherited(arguments);this.progressPropertyNameChanged();this.startValuePropertyNameChanged();this.mojoAttributeChanged("icon");this.mojoAttributeChanged("iconPath");},getTitle:function(){return this.fetchModelProperty("title");},getProgress:function(){return this.fetchModelProperty(this.progressPropertyName,this.progress);},getImage:function(){return this.fetchModelProperty("image");},getStartValue:function(){return this.fetchModelProperty(this.startValuePropertyName,this.startValue);},progressChanged:function(){this.modelPropertyChanged(this.progressPropertyName,this.progress);},progressPropertyNameChanged:function(){this.mojoAttributeChanged("modelProperty",this.progressPropertyName);},startValuePropertyNameChanged:function(){this.mojoAttributeChanged("modelStartProperty",this.startValuePropertyName);}});
opus.Class("Palm.Mojo.RadioButton",{isa:Palm.Mojo.Widget,published:{value:{value:1,isModelData:true,modelPropertyName:"valuePropertyName"},valuePropertyName:{value:"value",model:true,group:"Model"},disabled:{value:false,isModelData:true,modelPropertyName:"disabledPropertyName"},disabledPropertyName:{value:"disabled",model:true,group:"Model"},choices:{value:"[\n\t{label: 'One', value: 1},\n\t{label: 'Two', value: 2},\n\t{label: 'Three', value: 3}\n]",editor:{editorKind:"Palm.Ares.CodePropertyEditor",isJson:true}},onchange:{event:Mojo.Event.propertyChange+"Handler"}},width:"100%",height:70,minHeight:70,maxHeight:70,mojoClass:"RadioButton",create:function(){this.inherited(arguments);this.choicesChanged();this.valuePropertyNameChanged();this.disabledPropertyNameChanged();},getValue:function(){return this.fetchModelProperty(this.valuePropertyName,this.value);},valueChanged:function(){this.value=Palm.fetchTypedValue(this.value);if(this.value===""){this.deleteModelProperty(this.valuePropertyName);}else{this.modelPropertyChanged(this.valuePropertyName,this.value);}},valuePropertyNameChanged:function(){this.mojoAttributeChanged("modelProperty",this.valuePropertyName);},getDisabled:function(){return this.fetchModelProperty(this.disabledPropertyName,this.disabled);},disabledChanged:function(){this.modelPropertyChanged(this.disabledPropertyName,this.disabled);},disabledPropertyNameChanged:function(){this.mojoAttributeChanged("disabledProperty",this.disabledPropertyName);},choicesChanged:function(){this.choices=Palm.fetchJsonValue(this.choices,[]);this.mojoAttributeChanged("choices");}});
opus.Class("Palm.Mojo.Slider",{isa:Palm.Mojo.Widget,defaultStyles:{marginTop:8,marginBottom:8,overflow:"visible"},published:{value:{value:30,isModelData:true,modelPropertyName:"valuePropertyName"},valuePropertyName:{value:"value",model:true,group:"Model"},minValue:{value:1},maxValue:{value:100},round:{value:false,onchange:"mojoAttributeChanged"},updateInterval:{value:0},onchange:{event:Mojo.Event.propertyChange+"Handler"}},width:"100%",height:34,minHeight:34,maxHeight:34,mojoClass:"Slider",create:function(){this.inherited(arguments);this.minValueChanged();this.maxValueChanged();this.updateIntervalChanged();this.mojoAttributeChanged("round");this.valuePropertyNameChanged();},getValue:function(){return this.fetchModelProperty(this.valuePropertyName,Number(this.value));},valueChanged:function(){this.modelPropertyChanged(this.valuePropertyName,Number(this.value));},valuePropertyNameChanged:function(){this.mojoAttributeChanged("modelProperty",this.valuePropertyName);},minValueChanged:function(){this.minValue=Number(this.minValue);this.mojoAttributeChanged("minValue",this.minValue);},maxValueChanged:function(){this.maxValue=Number(this.maxValue);this.mojoAttributeChanged("maxValue");},updateIntervalChanged:function(){this.updateInterval=Number(this.updateInterval);this.mojoAttributeChanged("updateInterval");}});
opus.Class("Palm.Mojo.Spinner",{isa:Palm.Mojo.Widget,published:{spinning:{value:true,isModelData:true,modelPropertyName:"spinningPropertyName"},spinningPropertyName:{value:"spinning",model:true,group:"Model"}},spinnerSize:Mojo.Widget.spinnerSmall,mojoClass:"Spinner",width:32,minWidth:32,maxWidth:32,height:32,minHeight:32,maxHeight:32,create:function(){this.inherited(arguments);this.mojoAttributeChanged("spinnerSize");this.spinningPropertyNameChanged();},destroyWidget:function(){var node=this.fetchMojoNode();if(node){node.className="";}
this.inherited(arguments);},renderWidget:function(){this.inherited(arguments);this.spinningChanged();},getSpinning:function(){return this.fetchModelProperty(this.spinningPropertyName,this.spinning);},spinningChanged:function(){if(!this.isDesigning()){this.modelPropertyChanged(this.spinningPropertyName,this.spinning);}else{this.styleChanged();}},spinningPropertyNameChanged:function(){this.mojoAttributeChanged("modelProperty",this.spinningPropertyName);},modifyDomStyles:function($s){if(this.isDesigning()&&!this.spinning){$s.opacity=0;}}});opus.Class("Palm.Mojo.LargeSpinner",{isa:Palm.Mojo.Spinner,published:{spinning:{value:true,isModelData:true,modelPropertyName:"spinningPropertyName"}},spinnerSize:Mojo.Widget.spinnerLarge,width:128,minWidth:128,maxWidth:128,height:128,minHeight:128,maxHeight:128});opus.Class("Palm.Mojo.CustomSpinner",{isa:Palm.Mojo.Spinner,published:{spinnerSize:{noInspect:true},superClass:{value:"",onchange:"mojoAttributeChanged"},startFrameCount:{value:0,onchange:"mojoAttributeChanged"},mainFrameCount:{value:"",onchange:"mojoAttributeChanged"},finalFrameCount:{value:0,onchange:"mojoAttributeChanged"},frameHeight:{value:0,onchange:"mojoAttributeChanged"},fps:{value:10,onchange:"mojoAttributeChanged"}},create:function(){this.inherited(arguments);this.mojoAttributeChanged("superClass");this.mojoAttributeChanged("startFrameCount");this.mojoAttributeChanged("mainFrameCount");this.mojoAttributeChanged("finalFrameCount");this.mojoAttributeChanged("finalFrameCount");this.mojoAttributeChanged("frameHeight");this.mojoAttributeChanged("fps");}});
opus.Class("Palm.Mojo.TextField",{isa:Palm.Mojo.Widget,published:{value:{value:"",isModelData:true,modelPropertyName:"valuePropertyName"},valuePropertyName:{value:"value",model:true,group:"Model"},disabled:{value:false,isModelData:true,modelPropertyName:"disabledPropertyName"},disabledPropertyName:{value:"disabled",model:true,group:"Model"},multiline:false,maxLength:"",inputName:{value:"",onchange:"mojoAttributeChanged"},autoHeight:true,autoFocus:{value:false,onchange:"mojoAttributeChanged"},modifierState:{value:"",options:["",Mojo.Widget.numLock,Mojo.Widget.capsLock],onchange:"mojoAttributeChanged"},growWidth:{value:false,onchange:"mojoAttributeChanged"},autoResizeMax:{value:"",onchange:"mojoAttributeChanged"},limitResize:{value:false,onchange:"mojoAttributeChanged"},hintText:{value:"hint",onchange:"mojoAttributeChanged"},preventResize:{value:false,onchange:"mojoAttributeChanged"},holdToEnable:{value:false,onchange:"mojoAttributeChanged"},focusMode:{value:"",options:["",Mojo.Widget.focusSelectMode,Mojo.Widget.focusInsertMode,Mojo.Widget.focusAppendMode],onchange:"mojoAttributeChanged"},enterSubmits:{value:false,onchange:"mojoAttributeChanged"},changeOnKeyPress:{value:false,onchange:"mojoAttributeChanged"},requiresEnterKey:{value:false,onchange:"mojoAttributeChanged"},holdToEdit:{value:false,onchange:"mojoAttributeChanged"},emoticons:{value:false,onchange:"mojoAttributeChanged"},autoReplace:{value:true,onchange:"mojoAttributeChanged"},textCase:{value:Mojo.Widget.steModeSentenceCase,options:[Mojo.Widget.steModeSentenceCase,Mojo.Widget.steModeTitleCase,Mojo.Widget.steModeLowerCase],onchange:"mojoAttributeChanged"},oncharsallowed:{event:"doCharsAllowed"},onchange:{event:Mojo.Event.propertyChange+"Handler"}},width:"100%",height:52,minHeight:52,maxHeight:52,mojoClass:"TextField",create:function(){this.inherited(arguments);this.mojoAttributeChanged("inputName");this.mojoAttributeChanged("autoFocus");this.mojoAttributeChanged("modifierState");this.mojoAttributeChanged("growWidth");this.mojoAttributeChanged("autoResizeMax");this.mojoAttributeChanged("limitResize");this.mojoAttributeChanged("preventResize");this.mojoAttributeChanged("holdToEnable");this.mojoAttributeChanged("focusMode");this.mojoAttributeChanged("enterSubmits");this.mojoAttributeChanged("changeOnKeyPress");this.mojoAttributeChanged("requiresEnterKey");this.mojoAttributeChanged("holdToEdit");this.mojoAttributeChanged("emoticons");this.mojoAttributeChanged("autoReplace");this.mojoAttributeChanged("textCase");this.mojoAttributeChanged("hintText");this.oncharsallowedChanged();this.multilineChanged();this.autoHeightChanged();this.valuePropertyNameChanged();this.disabledPropertyNameChanged();this.maxLengthChanged();},postCreateWidget:function(){this.inherited(arguments);this.fitToDivSize();},destructor:function(){this.stopMonitoringSize();this.inherited(arguments);},getValue:function(){return this.fetchModelProperty(this.valuePropertyName,this.value);},valueChanged:function(){this.modelPropertyChanged(this.valuePropertyName,String(this.value));this.fitToDivSize();},valuePropertyNameChanged:function(){this.mojoAttributeChanged("modelProperty",this.valuePropertyName);},getDisabled:function(){return this.fetchModelProperty(this.disabledPropertyName,this.disabled);},disabledChanged:function(){this.modelPropertyChanged(this.disabledPropertyName,this.disabled);},disabledPropertyNameChanged:function(){this.mojoAttributeChanged("disabledProperty",this.disabledPropertyName);},oncharsallowedChanged:function(){this.mojoAttributeChanged("charsAllow",this.oncharsallowed?this.doCharsAllowed.bind(this):null);},multilineChanged:function(){this.mojoAttributeChanged("multiline");this.updateSizeMonitoring();},autoHeightChanged:function(){this.updateSizeMonitoring();},fitToInputSize:function(){if(this.mwc&&this.mwc.assistant.inputArea.style.display!="none"){var h=this.mwc.assistant.inputArea.offsetHeight+28;if(h!=this.getHeight()){this.setHeight(h);}}},fitToDivSize:function(){if(this.mwc&&this.autoHeight&&this.multiline){var h=this.mwc.assistant.inputAreaDiv.offsetHeight-1;if(h!=this.getHeight()&&h>0){this.setHeight(h);}}},updateSizeMonitoring:function(){if(this.multiline&&this.autoHeight&&!this.isDesigning()){this.startMonitoringSize();}else{this.stopMonitoringSize();}},startMonitoringSize:function(){this._sizeMonitor=setInterval(kit.hitch(this,"fitToInputSize"),250);},stopMonitoringSize:function(){clearInterval(this._sizeMonitor);},maxLengthChanged:function(){this.mojoAttributeChanged("maxLength",this.maxLength!=""?Number(this.maxLength):undefined);}});
opus.Class("Palm.Mojo.PasswordField",{isa:Palm.Mojo.TextField,published:{value:{value:"",isModelData:true,modelPropertyName:"valuePropertyName"},disabled:{value:false,isModelData:true,modelPropertyName:"disabledPropertyName"}},mojoClass:"PasswordField"});
opus.Class("Palm.Mojo.TimePicker",{isa:Palm.Mojo.Widget,width:"100%",height:60,minHeight:60,maxHeight:60,mojoClass:"TimePicker",published:{time:{value:"",isModelData:true,modelPropertyName:"timePropertyName"},timePropertyName:{value:"time",model:true,group:"Model"},label:{value:"Time"},labelPlacement:{value:Mojo.Widget.labelPlacementLeft,options:[Mojo.Widget.labelPlacementLeft,Mojo.Widget.labelPlacementRight],onchange:"mojoAttributeChanged"},minuteInterval:5,onchange:{event:Mojo.Event.propertyChange+"Handler"}},create:function(){this.inherited(arguments);this.timePropertyNameChanged();this.labelChanged();this.mojoAttributeChanged("labelPlacement");this.minuteIntervalChanged();},labelChanged:function(){this.mojoAttributeChanged("label",this.label?this.label:" ");},getTime:function(){var d=this.fetchModelProperty(this.timePropertyName,this.time);return d instanceof Date?d.toString():d;},timeChanged:function(){this.modelPropertyChanged(this.timePropertyName,this.makeJsDateFromTime(this.time));},timePropertyNameChanged:function(){this.mojoAttributeChanged("modelProperty",this.timePropertyName);},makeJsDateFromTime:function(inTimeString){var bad="Invalid Date";var d=new Date(inTimeString);if(d==bad){var now=new Date();d=new Date(now.toLocaleDateString()+" "+this.time);}
if(d==bad){d=new Date();}
return d;},minuteIntervalChanged:function(){this.mojoAttributeChanged("minuteInterval",Number(this.minuteInterval));}});
opus.Class("Palm.Mojo.ToggleButton",{isa:Palm.Mojo.Widget,width:96,height:50,minHeight:50,maxHeight:50,mojoClass:"ToggleButton",published:{value:{value:false,isModelData:true,modelPropertyName:"valuePropertyName"},valuePropertyName:{value:"value",model:true,group:"Model"},disabled:{value:false,isModelData:true,modelPropertyName:"disabledPropertyName"},disabledPropertyName:{value:"disabled",model:true,group:"Model"},trueValue:"true",falseValue:"false",trueLabel:{value:"On",onchange:"mojoAttributeChanged"},falseLabel:{value:"Off",onchange:"mojoAttributeChanged"},onchange:{event:Mojo.Event.propertyChange+"Handler"}},create:function(){this.inherited(arguments);this.valuePropertyNameChanged();this.disabledPropertyNameChanged();this.trueValueChanged();this.falseValueChanged();this.mojoAttributeChanged("trueLabel");this.mojoAttributeChanged("falseLabel");},getValue:function(){return this.fetchModelProperty(this.valuePropertyName,this.value);},valueChanged:function(){this.value=Palm.fetchTypedValue(this.value);this.modelPropertyChanged(this.valuePropertyName,this.value);},valuePropertyNameChanged:function(){this.mojoAttributeChanged("modelProperty",this.valuePropertyName);},getDisabled:function(){return this.fetchModelProperty(this.disabledPropertyName,this.disabled);},disabledChanged:function(){this.modelPropertyChanged(this.disabledPropertyName,this.disabled);},disabledPropertyNameChanged:function(){this.mojoAttributeChanged("disabledProperty",this.disabledPropertyName);},trueValueChanged:function(){this.trueValue=Palm.fetchTypedValue(this.trueValue);this.mojoAttributeChanged("falseValue");},falseValueChanged:function(){this.falseValue=Palm.fetchTypedValue(this.falseValue);this.mojoAttributeChanged("falseValue");}});
opus.Class("Palm.Mojo.IntegerPicker",{isa:Palm.Mojo.Widget,published:{value:{value:0,isModelData:true,modelPropertyName:"valuePropertyName"},valuePropertyName:{value:"value",model:true,group:"Model"},label:{value:"Integer"},labelPlacement:{value:Mojo.Widget.labelPlacementLeft,options:[Mojo.Widget.labelPlacementLeft,Mojo.Widget.labelPlacementRight],onchange:"mojoAttributeChanged"},min:{value:0},max:{value:10},padNumbers:{value:false,onchange:"mojoAttributeChanged"},onchange:{event:Mojo.Event.propertyChange+"Handler"}},mojoClass:"IntegerPicker",width:"100%",height:60,minHeight:60,maxHeight:60,create:function(){this.inherited(arguments);this.valuePropertyNameChanged();this.labelChanged();this.mojoAttributeChanged("labelPlacement");this.minChanged();this.maxChanged();this.mojoAttributeChanged("padNumbers");},labelChanged:function(){this.mojoAttributeChanged("label",this.label?this.label:" ");},getValue:function(){return this.fetchModelProperty(this.valuePropertyName,this.value);},valueChanged:function(){this.modelPropertyChanged(this.valuePropertyName,Number(this.value)||0);},valuePropertyNameChanged:function(){this.mojoAttributeChanged("modelProperty",this.valuePropertyName);},maxChanged:function(){this.mojoAttributeChanged("max",Number(this.max));},minChanged:function(){this.mojoAttributeChanged("min",Number(this.min));}});
opus.Class("Palm.Mojo.ListSelector",{isa:Palm.Mojo.Widget,published:{value:{value:"",isModelData:true,modelPropertyName:"valuePropertyName"},valuePropertyName:{value:"value",model:true,group:"Model"},disabled:{value:false,isModelData:true,modelPropertyName:"disabledPropertyName"},disabledPropertyName:{value:"disabled",model:true,group:"Model"},choices:{value:"[{label: 'One', value: '1'},{label: 'Two', value: '2'},{label: 'Three', value: '3'}]",isModelData:true,editor:{editorKind:"Palm.Ares.CodePropertyEditor",isJson:true}},label:{value:"Pick One",onchange:"mojoAttributeChanged"},labelPlacement:{options:[Mojo.Widget.labelPlacementRight,Mojo.Widget.labelPlacementLeft],onchange:"mojoAttributeChanged"},multiline:{value:false,onchange:"mojoAttributeChanged"},onchange:{event:Mojo.Event.propertyChange+"Handler"}},mojoClass:"ListSelector",width:"100%",height:60,minHeight:60,maxHeight:60,create:function(){this.inherited(arguments);this.mojoAttributeChanged("label");this.mojoAttributeChanged("labelPlacement");this.mojoAttributeChanged("multiline");},renderWidget:function(){this.inherited(arguments);if(this.isDesigning()){this.mwc.assistant.openSelector=opus.nop;}},getValue:function(){return this.fetchModelProperty(this.valuePropertyName,this.value);},getDisabled:function(){return this.fetchModelProperty(this.disabledPropertyName,this.disabled);},getChoices:function(){return this.fetchModelProperty("choices");},valueChanged:function(){this.value=Palm.fetchTypedValue(this.value);if(this.value===""){this.deleteModelProperty(this.valuePropertyName);}else{this.modelPropertyChanged(this.valuePropertyName,this.value);}},valuePropertyNameChanged:function(){this.mojoAttributeChanged("modelProperty",this.valuePropertyName);},disabledChanged:function(){this.modelPropertyChanged(this.disabledPropertyName,this.disabled);},disabledPropertyNameChanged:function(){this.mojoAttributeChanged("disabledProperty",this.disabledPropertyName);},choicesChanged:function(){this.choices=Palm.fetchJsonValue(this.choices,[]);this.modelPropertyChanged("choices");}});
opus.Class("Palm.Mojo.Label",{isa:Palm.Mojo.Html,width:"100%",height:50,published:{content:{noExport:true,noInspect:true},templateFile:{noInspect:true},className:"",kind:{value:"label",options:["label","title"],onchange:"classNameChanged"},label:{value:"Label",isModelData:true,modelPropertyName:"labelPropertyName"},labelPropertyName:{value:"label",model:true,group:"Model"}},create:function(){this.attributes={};this.classNameChanged();this.labelPropertyNameChanged();this.inherited(arguments);},classNameChanged:function(){this.attributes.className=this.className?this.className:this.kind;this.attributesChanged();},fetchInlineTemplate:function(){return"#{"+this.labelPropertyName+"}";},getLabel:function(){return this.fetchModelProperty(this.labelPropertyName,this.label);},labelChanged:function(){this.modelPropertyChanged(this.labelPropertyName,this.label);if(!this.isRendering()){this.updateInlineTemplate();}},labelPropertyNameChanged:function(){this.updateInlineTemplate();}});
opus.Class("Palm.Mojo.ImageView",{isa:Palm.Mojo.Widget,width:"100%",height:"100%",mojoClass:"ImageView",published:{highResolutionLoadTimeout:{value:1.2,onchange:"mojoAttributeChanged"},extractfsParams:{value:"",onchange:"mojoAttributeChanged"},lowResExtractFSParams:{value:"",onchange:"mojoAttributeChanged"},noExtractFS:{value:true,onchange:"mojoAttributeChanged"},limitZoom:{value:false,onchange:"mojoAttributeChanged"},panInsetX:{value:0,onchange:"mojoAttributeChanged"},panInsetY:{value:0,onchange:"mojoAttributeChanged"},onLeftFunction:{event:"navigateLeft",isModelData:true},onRightFunction:{event:"navigateRight",isModelData:true},onImageViewChanged:{event:Mojo.Event.imageViewChanged+"Handler"},centerUrl:{value:"",noInspect:true},rightUrl:{value:"",noInspect:true},leftUrl:{value:"",noInspect:true},images:{value:[],editor:{editorKind:"Palm.Ares.CodePropertyEditor",isJson:true}},index:0,wrap:true},postCreate:function(){this.inherited(arguments);this.mojoAttributeChanged("highResolutionLoadTimeout");this.mojoAttributeChanged("extractfsParams");this.mojoAttributeChanged("lowResExtractFSParams");this.mojoAttributeChanged("noExtractFS");this.mojoAttributeChanged("limitZoom");this.mojoAttributeChanged("panInsetX");this.mojoAttributeChanged("panInsetY");},resize:function(){if(this.mwc){var n=this.fetchMojoNode();this.mwc.assistant.manualSize(n.clientWidth,n.clientHeight);}},renderWidget:function(){this.inherited(arguments);if(this.hasImages()){this.setIndex(this.index);}},onLeftFunctionChanged:function(){this.modelPropertyChanged("onLeftFunction",kit.hitch(this,"doNavigateLeft"));},onRightFunctionChanged:function(){this.modelPropertyChanged("onRightFunction",kit.hitch(this,"doNavigateRight"));},doNavigateLeft:function(){if(this.hasImages()){this.prevIndex();}
this.navigateLeft();},doNavigateRight:function(){if(this.hasImages()){this.nextIndex();}
this.navigateRight();},imagesChanged:function(){this.indexChanged();},hasImages:function(){return this.images.length;},isValidIndex:function(inIndex){return(inIndex>=0&&inIndex<=this.images.length-1);},calcIndex:function(inDelta){var i=this.index+inDelta;if(!this.isValidIndex(i)){i=!this.wrap?-1:inDelta>0?0:this.images.length-1;}
return i;},indexChanged:function(){this.index=Number(this.index);this.index=this.isValidIndex(this.index)?this.index:0;var left=this.images[this.calcIndex(-1)];var center=this.images[this.index];var right=this.images[this.calcIndex(1)];this.setCenterUrl(center);if(left){this.setLeftUrl(left);}
if(right){this.setRightUrl(right);}},nextIndex:function(){var i=this.calcIndex(1);if(this.isValidIndex(i)){this.setIndex(i);}},prevIndex:function(){var i=this.calcIndex(-1);if(this.isValidIndex(i)){this.setIndex(i);}},centerUrlChanged:function(){if(this.mwc){var p=this.centerUrl?this.rewritePath(this.centerUrl):"";this.fetchMojoNode().mojo.centerUrlProvided(p);}},leftUrlChanged:function(){if(this.mwc){var p=this.leftUrl?this.rewritePath(this.leftUrl):"";this.fetchMojoNode().mojo.leftUrlProvided(p);}},rightUrlChanged:function(){if(this.mwc){var p=this.rightUrl?this.rewritePath(this.rightUrl):"";this.fetchMojoNode().mojo.rightUrlProvided(p);}}});
opus.Class("Palm.Mojo.WebView",{isa:Palm.Mojo.Widget,published:{virtualpageheight:"",virtualpagewidth:"",url:"",minFontSize:"",topMargin:"",cacheAdapter:true,interrogateClicks:true,showClickedLink:true},width:"100%",height:300,mojoClass:"WebView",create:function(){this.inherited(arguments);this.virtualpageheightChanged();this.virtualpagewidthChanged();this.urlChanged();this.minFontSizeChanged();this.topMarginChanged();this.cacheAdapterChanged();this.interrogateClicksChanged();this.showClickedLinkChanged();},virtualpageheightChanged:function(){this.mojoAttributeChanged("virtualpageheight",Number(this.virtualpageheight)||undefined);},virtualpagewidthChanged:function(){this.mojoAttributeChanged("virtualpagewidth",Number(this.virtualpagewidth)||undefined);},urlChanged:function(){if(this.mwc){this.mwc.assistant.openURL(this.url||undefined);}else{this.mojoAttributeChanged("url",this.url||undefined);}},pageIdentifierChanged:function(){this.mojoAttributeChanged("pageIdentifier",this.pageIdentifier||undefined);},minFontSizeChanged:function(){this.mojoAttributeChanged("minFontSize",Number(this.minFontSize)||undefined);},topMarginChanged:function(){this.mojoAttributeChanged("topMargin",Number(this.topMargin)||"");},cacheAdapterChanged:function(){this.mojoAttributeChanged("cacheAdapter");},interrogateClicksChanged:function(){this.mojoAttributeChanged("interrogateClicks");},showClickedLinkChanged:function(){this.mojoAttributeChanged("showClickedLink",this.showClickedLink||undefined);}});
opus.Class("Palm.Mojo.Scroller",{isa:Palm.Mojo.WidgetContainer,mojoClass:"Scroller",published:{mode:{value:"vertical",options:["free","horizontal","vertical","dominant","horizontal-snap","vertical-snap"],onchange:"mojoAttributeChanged"},snapElements:{value:"",isModelData:true},onchange:{event:Mojo.Event.propertyChange+"Handler"},onscrollstarting:{event:"doScrollStarting"},onflick:{noInspect:true},snapIndex:{value:0,isModelData:true},scrollPosition:{value:{},noInspect:true},scrolleeSuspended:{value:false,noInspect:true},layoutKind:{options:["absolute","vbox","hbox"],group:"Common",noInspect:false}},attributes:{"x-mojo-element":"Scroller"},scroll:false,dropTarget:true,styles:{cursor:"move",overflow:"hidden"},chrome:[{name:"client",type:"Palm.Mojo.Container",w:"100%",h:"100%",layoutKind:"vbox",scroll:false,styles:{overflow:"visible"}}],create:function(){this.inherited(arguments);this.layoutKindChanged();this.mojoAttributeChanged("mode");},destructor:function(){this.disconnectScrollee();this.inherited(arguments);},destroyWidget:function(){this.disconnectScrollListener();if(this.mwc){this.mwc.stopListening(this.mwc.element,Mojo.Event.dragStart,this.mwc.assistant.dragStartHandler);this.mwc.stopListening(this.mwc.element,Mojo.Event.flick,this.mwc.assistant.flickHandler);}
this.inherited(arguments);},layoutKindChanged:function(){this.layout=opus.layoutRegistry.fetch("vbox");this.$.client.setLayoutKind(this.layoutKind);this.reflow();},fetchMojoControl:function(){return this;},disconnectScrollListener:function(){if(this.scrollListener){var c=this.fetchSceneController();var n=this.fetchMojoNode();if(n){c.stopListening(n,Mojo.Event.scrollStarting,this.scrollListener);}}},disconnectScrollee:function(){kit.forEach(this._resizeConnects,kit.disconnect);},contentRendered:function(){this.inherited(arguments);this.watchScrollee();},postCreateWidget:function(){this.inherited(arguments);this.onscrollstartingChanged();},mousewheelHandler:function(e){if(this.mwc){var delta=(e.axis==e.VERTICAL_AXIS&&-e.detail*10)||e.wheelDeltaY;if(delta){var p=this.getScrollPosition();p.top=p.top+delta;this.setScrollPosition(p);}}},watchScrollee:function(){this.disconnectScrollee();for(var i=0,c;(c=this.$.client.c$[i])&&!c.showing;i++);if(c&&!c.preventScrollerWatch){this._resizeConnects=[kit.connect(c,"contentRendered",this,"reset"),kit.connect(c,"boundsRendered",this,"validate")];if(c.nodeSizeChanged){this._resizeConnects.push(kit.connect(c,"nodeSizeChanged",this,"validate"));}}
this.reset();},reset:function(){if(this.mwc&&!this.scrolleeSuspended){var mojo=this.fetchMojoNode().mojo;mojo.scrollTo(0,0);this.validate();}},validate:function(){if(this.mwc&&!this.scrolleeSuspended){var mojo=this.fetchMojoNode().mojo;mojo.validateScrollPosition();}},getSnapElements:function(){return this.isDesigning()?this.snapElements:this.fetchModelProperty("snapElements");},snapElementsChanged:function(){var snaps=kit.isString(this.snapElements)?this.makeSnapElements(this.snapElements):this.snapElements;if(snaps){this.modelPropertyChanged("snapElements",snaps);}},makeSnapElements:function(inSnapString){var component=this.getSnapComponent();if(component){var nodes=this.fetchNodeList(inSnapString);if(nodes.length){snaps={};snaps[component]=nodes;return snaps;}}},fetchNodeList:function(inList){var list=kit.isString(inList)?inList.split(','):inList||"";var r=[];var controller=this.fetchSceneController();for(var i=0,n,c;n=list[i];i++){n=n.replace(/ /g,"");c=this.owner.$[n];n=controller.get(n)||(c&&(c.fetchMojoNode?c.fetchMojoNode():(c.getNode?c.getNode():null)));if(n){r.push(n);}}
return r;},getSnapComponent:function(){if(this.mode=="horizontal-snap"){return"x";}
if(this.mode=="vertical-snap"){return"y";}},getSnapIndex:function(){return this.isDesigning()?this.snapIndex:this.fetchModelProperty("snapIndex");},snapIndexChanged:function(){this.modelPropertyChanged("snapIndex");},onscrollstartingChanged:function(){this.disconnectScrollListener();if(this.onscrollstarting){var c=this.fetchSceneController();this.scrollListener=kit.hitch(this,"doScrollStarting");c.listen(this.fetchMojoNode(),Mojo.Event.scrollStarting,this.scrollListener);}},getScrollPosition:function(){if(this.mwc){this.scrollPosition=this.fetchMojoNode().mojo.getState();}
return this.scrollPosition;},scrollPositionChanged:function(){if(this.mwc){this.fetchMojoNode().mojo.setState(this.scrollPosition);}}});opus.Class("Palm.Mojo.FadeScroller",{isa:Palm.Mojo.Container,dropTarget:true,published:{mode:{value:"vertical",options:["free","horizontal","vertical","dominant","horizontal-snap","vertical-snap"],onchange:"mojoAttributeChanged"},scrollPosition:{value:{},noInspect:true},scrolleeSuspended:{value:false,noInspect:true},},layoutKind:"absolute",chrome:[{w:"100%",h:27,attributes:{"x-mojo-scroll-fade":"top"},styles:{bgImage:"$Palm-Mojo/images/top-fade-dark.png",zIndex:10},layoutKind:"vbox",controls:[{type:"Image",hAlign:"center",w:24,h:24,src:"$Palm-Mojo/images/arrow-up.png"}]},{name:"scroller",type:"Palm.Mojo.Scroller",w:"100%",h:"100%"},{w:"100%",h:27,b:0,attributes:{"x-mojo-scroll-fade":"bottom"},styles:{bgImage:"$Palm-Mojo/images/bottom-fade-dark.png",zIndex:10},layoutKind:"vbox",controls:[{type:"Image",hAlign:"center",w:24,h:24,src:"$Palm-Mojo/images/arrow-down.png"}]}],create:function(){this.inherited(arguments);this.modeChanged();},modeChanged:function(){this.$.scroller.setMode(this.mode);},getControlParent:function(){return this.$.scroller.$.client;},watchScrollee:function(){this.$.scroller.watchScrollee();},disconnectScrollee:function(){this.$.scroller.disconnectScrollee();},getScrollPosition:function(){return this.$.scroller.getScrollPosition();},scrollPositionChanged:function(){this.$.scroller.scrollPositionChanged();},getControls:function(){return this.$.scroller.getControls();},scrolleeSuspendedChanged:function(){this.$.scroller.setScrolleeSuspended(this.scrolleeSuspended);}});
opus.Class("Palm.Mojo.Drawer",{isa:Palm.Mojo.WidgetContainer,mojoClass:"Drawer",h:300,published:{open:{value:true,isModelData:true,modelPropertyName:"openPropertyName"},openPropertyName:{value:"open",model:true,group:"Model"},unstyled:{value:false,onchange:"mojoAttributeChanged"},titleToggleOpen:true,titleShowing:false,titleLabel:"",onchange:{event:Mojo.Event.propertyChange+"Handler"},openHeight:{value:300,noInspect:true},layoutKind:{options:["absolute","vbox","hbox"],group:"Common",noInspect:false}},styles:{overflow:"hidden"},chrome:[{name:"titleContainer",type:"Container",attributes:{className:"palm-row drawer-button"},h:50,w:"100%",showing:false,onclick:"titleClicked",styles:{marginBottom:-1},controls:[{name:"titleLabel",styles:{paddingLeft:10,paddingRight:10,oneLine:true},h:"100%",w:"100%"}]},{name:"clientContainer",type:"Palm.Mojo.Container",w:"100%",h:"100%",layoutKind:"vbox",scroll:false,controls:[{name:"client",type:"Palm.Mojo.Container",w:"100%",layoutKind:"vbox",scroll:false}]}],create:function(){this.inherited(arguments);this.$.client.scrollHandler=kit.hitch(this,"clientScrollHandler");if(!this.getOpen()){this.height=this.getClosedHeight();}
this.layoutKindChanged();this.openPropertyNameChanged();this.mojoAttributeChanged("unstyled");this.titleShowingChanged();this.titleLabelChanged();this.openHeightChanged();},scrollHandler:function(e){if(!this.isDesigning()){this.node.scrollTop=0;kit.stopEvent(e);}},clientScrollHandler:function(e){return true;},layoutKindChanged:function(){this.layout=opus.layoutRegistry.fetch("vbox");this.$.client.setLayoutKind(this.layoutKind);this.reflow();},fetchMojoControl:function(){return this.$.clientContainer;},destroyWidget:function(){var n=this.fetchMojoNode();if(n&&this.mwc){n.appendChild(this.$.client.node);n.removeChild(this.mwc.assistant.wrapper);}
this.inherited(arguments);},setHeight:function(){if(this.getOpen()||this._animating){this.inherited(arguments);}},getClosedHeight:function(){return this.titleShowing?this.$.titleContainer.getHeight():0;},heightChanged:function(){if(!this._animating&&this.getOpen()){this.setOpenHeight(this.height=="auto"?"auto":this.getBounds().h);}},openHeightChanged:function(){this.$.clientContainer.setHeight(this.openHeight=="auto"?"auto":this.openHeight-this.getClosedHeight());this.$.client.setHeight(this.openHeight=="auto"?"auto":"100%");this.updateInternalHeight();},renderBounds:function(){this.inherited(arguments);this.updateInternalHeight();},updateInternalHeight:function(){if(this.mwc){var b=this.$.client.getBounds();var a=this.mwc.assistant;a.wrapper.style.height=a.contentDiv.style.height=b.h+"px";}},postCreateWidget:function(){this.animationQueue=Mojo.Animation.queueForElement(this.fetchMojoNode());this.mwc.assistant.updateFromModel=kit.hitch(this,"mojoUpdateFromModel");this.updateInternalHeight();},mojoUpdateFromModel:function(){var a=this.mwc.assistant;if(a.wasOpen!==a.controller.model[a.propName]){if(this._animation){this._animation.complete();}
var newHeight=this.getClosedHeight()+(a.wasOpen?0:this.$.client.getBounds().h);this.doAnimation(newHeight);a.wasOpen=a.controller.model[a.propName];}},doAnimation:function(inHeight){this._animating=true;this._animation=Mojo.Animation.animateValue(this.animationQueue,'bezier',kit.hitch(this,"updateAnimationHeight"),{onComplete:kit.hitch(this,"finishAnimation"),from:this.bounds.h,to:inHeight,duration:0.3,curve:Mojo.Animation.easeOut});},updateAnimationHeight:function(inHeight){inHeight=Math.round(inHeight);this.setHeight(inHeight);},finishAnimation:function(){this.setHeight(this.getOpen()?this.openHeight:this.getClosedHeight());this._animating=false;this._animation=null;},openPropertyNameChanged:function(){this.mojoAttributeChanged("property",this.openPropertyName);},openChanged:function(){this.modelPropertyChanged(this.openPropertyName,this.open);},getOpen:function(){return this.fetchModelProperty(this.openPropertyName,this.open);},openDrawer:function(){this.setOpen(true);},closeDrawer:function(){this.setOpen(false);},toggleOpen:function(){this.setOpen(!this.getOpen());},titleClicked:function(e){if(this.titleToggleOpen){opus.job("toggle",kit.hitch(this,"toggleOpen"),10);}},titleShowingChanged:function(){this.$.titleContainer.setShowing(this.titleShowing);},titleLabelChanged:function(){this.$.titleLabel.setContent(this.titleLabel);}});
opus.Class("Palm.Mojo.Collapsible",{isa:Palm.Mojo.Drawer,published:{open:{value:true,isModelData:true,modelPropertyName:"openPropertyName"},unstyled:{value:true,onchange:"mojoAttributeChanged",noInspect:true},titleToggleOpen:{value:true,noInspect:true},titleShowing:{value:true,noInspect:true},titleLabel:"Collapsible"},chrome:[{name:"titleContainer",type:"Palm.Mojo.Container",h:40,w:"100%",showing:true,onclick:"titleClicked",controls:[{name:"titleLabel",h:"100%",w:"100%"}]},{name:"clientContainer",type:"Palm.Mojo.Container",w:"100%",h:"100%",layoutKind:"vbox",scroll:false,controls:[{name:"client",type:"Container",w:"100%",layoutKind:"vbox",scroll:false}]}],ready:function(){this.inherited(arguments);this.titleLabelChanged();},titleLabelChanged:function(){var c=this.titleLabel;var es=(this.getOpen()?"expanded":"closed");var content='<table class="palm-divider collapsible" x-mojo-touch-feedback="delayed">'+'<tbody><tr>'+'<td class="left"></td>'+'<td class="label">'+c+'</td>'+'<td class="line" width="100%"></td>'+'<td><div id="'+this.globalId+'-arrow" class="palm-arrow-'+es+'"></div></td>'+'<td class="right"></td>'+'</tr>'+'</tbody></table>';this.$.titleLabel.setContent(content);this.arrowNode=kit.byId(this.globalId+"-arrow");},nodesRendered:function(){this.inherited(arguments);this.arrowNode=kit.byId(this.globalId+"-arrow");},doAnimation:function(inHeight){if(this.arrowNode){this.arrowNode.className="palm-arrow-"+(this.getOpen()?"expanded":"closed");}
this.inherited(arguments);}});
opus.Class("Palm.Mojo.RichTextEdit",{isa:Palm.Mojo.Widget,published:{value:{value:"Rich!",isModelData:true,onchange:"modelPropertyChanged"}},width:"100%",height:200,mojoClass:"RichTextEdit",getValue:function(){return this.fetchModelProperty("value");}});
opus.Class("Palm.Mojo.Header",{isa:opus.Control,mixins:[Palm.Mojo.ControlMixin],width:"100%",height:50,defaultStyles:{border:null},plane:2000,published:{content:{noExport:true,noInspect:true},label:{value:""}},create:function(){this.inherited(arguments);this.label=this.label||this.content;this.labelChanged();},classNameChanged:function(){var cn="palm-header";if(this.className){cn+=" "+this.className;}
this.attributes.className=cn;this.attributesChanged();},modifyDomStyles:function(inStyles,inComputedStyles){inStyles.position=this.isDesigning()?inStyles.position:"fixed";inStyles["border-width"]=null;},labelChanged:function(){this.setContent(this.label);}});
opus.Class("Palm.Mojo.Group",{isa:Palm.Mojo.Panel,width:"100%",height:95,autoRows:true,published:{label:{value:"Label"}},chrome:[{name:"client",type:"Palm.Mojo.Container",layoutKind:"vbox",styles:{overflow:"hidden"},h:"100%",w:"100%",scroll:false}],create:function(){this.inherited(arguments);this.layoutKindChanged();this.heightChanged();},layoutKindChanged:function(){this.layout=opus.layoutRegistry.fetch("vbox");this.$.client.setLayoutKind(this.layoutKind);this.reflow();},getContent:function(){var id=this.globalId;var c=this.inherited(arguments);return'<div id="'+id+'-group" class="palm-group'+(this.label?'':' unlabeled')+'">'+
(this.label?'<div id="'+id+'-label" class="palm-group-title">'+this.label+'</div>':'')+'<div class="palm-list" id="'+id+'-content" style="height: '+this.fetchInternalHeight()+'px;">'+c+'</div>'+'</div>';},contentRendered:function(){this.inherited(arguments);this.contentNode=kit.byId(this.globalId+"-content");this.groupNode=kit.byId(this.globalId+"-group");this.labelNode=kit.byId(this.globalId+"-label");this.updateInternalHeight();},fetchInternalHeight:function(){return Math.max(0,this.$.client.getBounds().h-2);},updateInternalHeight:function(){if(this.contentNode){this.contentNode.style.height=this.fetchInternalHeight()+"px";}},heightChanged:function(){this.$.client.setHeight(this.getHeight()=="auto"?"auto":"100%")},labelChanged:function(){this.contentChanged();this.reflow();},getClientBounds:function(){var b=this.inherited(arguments);var th=this.label?24:0;b.t+=9+th;b.h-=th+19;b.l+=9;b.w-=18;return b;},boundsChanged:function(){if(this.getHeight()=="auto"){var th=this.label?24:0;this.bounds.h=Math.max(30,this.bounds.h);this.bounds.h+=19+th;}else{this.inherited(arguments);}},boundsRendered:function(){this.bounds.boundsDirty=false;this.updateInternalHeight();},controlDropped:function(inChild,inDropInfo){var c=inChild;if(this.autoRows&&!(c instanceof Palm.Mojo.Container)){c=this.fetchAutoRow(c);c.parent.dropChild(c,inDropInfo);this.updateRows();}else{this.inherited(arguments);}
return inChild;},fetchAutoRow:function(inControl){var isTextField=(inControl instanceof Palm.Mojo.TextField);var r=this.createComponent({type:"Palm.Mojo.Row",isTextField:isTextField,height:"auto",dropTarget:true});r.renderNode();r.parentNode=null;inControl.setManager(r);inControl.reflowParent();if(inControl.node){r.$.client.insertNodeAt(inControl.node,0);}else{inControl.renderNode();inControl.parentNode=null;}
return r;},updateRows:function(){var c$=this.getControls();for(var i=0,c;c=c$[i];i++){if(c.getControls&&!c.getControls().length&&c instanceof Palm.Mojo.Row&&c.getHeight()=="auto"){c.destructor();}}}});
opus.Class("Palm.Mojo.Row",{isa:Palm.Mojo.Panel,scroll:false,defaultStyles:{overflow:"hidden"},width:"100%",height:52,published:{tapHighlight:{value:true,onchange:"contentChanged"},focusHighlight:{value:true,onchange:"contentChanged"},autoRowType:true,rowType:{value:"single",options:["single","first","middle","last"]},isTextField:false},chrome:[{name:"client",type:"Palm.Mojo.Container",h:"100%",w:"100%",styles:{overflow:"hidden"},layoutKind:"vbox",scroll:false}],create:function(){this.inherited(arguments);this.isTextFieldChanged();this.layoutKindChanged();this.heightChanged();},layoutKindChanged:function(){this.layout=opus.layoutRegistry.fetch(this.layoutKind=="relative"?"relative":"vbox");this.$.client.setLayoutKind(this.layoutKind);this.reflow();},isTextFieldChanged:function(){this.style.addRuntimeStyles({marginTop:0});this.style.addRuntimeStyles({paddingTop:this.isTextField?1:0});var cp=this.isTextField?10:0;this.$.client.style.addRuntimeStyles({paddingLeft:cp,paddingRight:cp});this.contentChanged();},getContent:function(){var c=this.inherited(arguments);var focusHighlight=this.focusHighlight?' x-mojo-focus-highlight="true"':'';var tapHighlight=this.tapHighlight?' x-mojo-touch-feedback="delayed"':'';var highlights=focusHighlight+tapHighlight;var h=this.fetchInternalHeight();var sizeStyle=h?'style="height: '+h+'px;"':"";var sizeInfo=' id="'+this.globalId+'-sizeNode"'+sizeStyle;if(this.isTextField){return'<div id="'+this.globalId+'-typeNode" class="palm-row '+this.rowType+'">'+'<div class="palm-row-wrapper textfield-group"'+highlights+'>'+'<div'+sizeInfo+' class="title">'+
c+'</div>'+'</div>'+'</div>';}else{return'<div id="'+this.globalId+'-typeNode" class="palm-row '+this.rowType+'"'+highlights+'>'+'<div'+sizeInfo+' class="palm-row-wrapper">'+
c+'</div>'+'</div>';}},contentRendered:function(){this.inherited(arguments);this.sizeNode=kit.byId(this.globalId+"-sizeNode");this.typeNode=kit.byId(this.globalId+"-typeNode");this.updateInternalHeight();},boundsRendered:function(){this.inherited(arguments);if(this.autoRowType&&this.parent){this.doAutoRowType();}
this.updateInternalHeight();},doAutoRowType:function(){var c$=this.parent.getControls();var type=c$.length==1?"single":(this==c$[0]?"first":(this==c$[c$.length-1]?"last":"middle"));this.setRowType(type);},rowTypeChanged:function(){if(this.typeNode){this.typeNode.className="palm-row "+this.rowType;}},fetchInternalHeight:function(){if(this.$.client.layoutKind!="relative"){return this.$.client.getBounds().h;}},updateInternalHeight:function(){if((this.layoutKind!="relative")&&this.sizeNode){this.sizeNode.style.height=this.fetchInternalHeight()+"px";}},heightChanged:function(){this.$.client.setHeight(this.getHeight()=="auto"?"auto":(this.layoutKind=="relative"?null:"100%"));this.updateInternalHeight();}});
opus.Class("Palm.Mojo.PageHeader",{isa:opus.Control,mixins:[Palm.Mojo.ControlMixin],width:"100%",height:52,defaultStyles:{borderStyle:"none",overflow:"hidden"},published:{content:{noInspect:true,noExport:true},title:{value:"Title",onchange:"contentChanged"},subtitle:{value:"Subtitle",onchange:"contentChanged"},multiline:{value:false,onchange:"contentChanged"},icon:{value:"",onchange:"contentChanged",editor:{editorKind:"ImagePathEditor"}},html:{value:"",onchange:"contentChanged"}},iconSize:32,getContent:function(){return'<div class="palm-page-header '+(this.multiline?"multi-line":"")+'">'+'<div class="palm-page-header-wrapper">'+
this.generateHeaderContent()+'</div>'+'</div>';},generateHeaderContent:function(){if(this.html){return this.html;}else{var tbm=Math.max(Math.floor((52-this.iconSize)/2),0);var rlm=Math.max(Math.floor((56-this.iconSize)/2),0);var iconStyle='margin: '+tbm+'px '+rlm+'px; height: '+this.iconSize+'px; width: '+this.iconSize+'px;';var icon=this.icon?'<div class="icon" style="background: none;"><img style="'+iconStyle+'" src="'
+this.rewritePath(this.icon)+'"></div>':"";return icon+'<div class="title'+(this.icon?"":" left")+'">'+this.title+'</div>'+
(this.subtitle&&this.multiline?'<div class="subtitle">'+this.subtitle+'</div>':"");}}});
opus.Class("Palm.Mojo.ProgressBar",{isa:Palm.Mojo.Widget,published:{progress:{value:0.5,isModelData:true,modelPropertyName:"progressPropertyName"},progressPropertyName:{value:"progress",model:true,group:"Model"},title:{value:"Progress",isModelData:true,onchange:"modelPropertyChanged"},image:{value:"",isModelData:true,onchange:"modelPropertyChanged"},icon:{value:"",onchange:"mojoAttributeChanged"},iconPath:{value:"",onchange:"mojoAttributeChanged"},onprogressicontap:{event:Mojo.Event.progressIconTap+"Handler"},onprogresscomplete:{event:Mojo.Event.progressComplete+"Handler"}},width:"100%",height:34,minHeight:34,maxHeight:34,defaultStyles:{margin:12},mojoClass:"ProgressBar",create:function(){this.inherited(arguments);this.progressPropertyNameChanged();this.mojoAttributeChanged("icon");this.mojoAttributeChanged("iconPath");},getTitle:function(){return this.fetchModelProperty("title");},getProgress:function(){return this.fetchModelProperty(this.progressPropertyName,this.progress);},getImage:function(){return this.fetchModelProperty("image");},progressChanged:function(){this.modelPropertyChanged(this.progressPropertyName,this.progress);},progressPropertyNameChanged:function(){this.mojoAttributeChanged("modelProperty",this.progressPropertyName);}});
opus.Class("Palm.Mojo.ProgressSlider",{isa:Palm.Mojo.Widget,published:{slider:{value:30,isModelData:true,modelPropertyName:"sliderPropertyName"},sliderPropertyName:{value:"slider",model:true,group:"Model"},progress:{value:0.5,isModelData:true,modelPropertyName:"progressPropertyName"},progressPropertyName:{value:"progress",model:true,group:"Model"},progressStartValue:{value:0,isModelData:true,modelPropertyName:"progressStartValuePropertyName"},progressStartValuePropertyName:{value:"progressStart",model:true,group:"Model"},minValue:{value:0,isModelData:true,onchange:"modelPropertyChanged"},maxValue:{value:100,isModelData:true,onchange:"modelPropertyChanged"},round:{value:true,onchange:"mojoAttributeChanged"},updateInterval:{value:0,onchange:"mojoAttributeChanged"},cancellable:{value:false,onchange:"mojoAttributeChanged"},onchange:{event:Mojo.Event.propertyChange+"Handler"},onprogressComplete:{event:Mojo.Event.progressComplete+"Handler"},},defaultStyles:{margin:12,overflow:"visible"},width:"100%",height:34,minHeight:34,maxHeight:34,mojoClass:"ProgressSlider",create:function(){this.inherited(arguments);this.sliderPropertyNameChanged();this.progressPropertyNameChanged();this.progressStartValuePropertyNameChanged();this.mojoAttributeChanged("cancellable");this.mojoAttributeChanged("round");this.mojoAttributeChanged("updateInterval");},classNameChanged:function(){var cn="stream-buffer-bar";if(this.className){cn+=" "+this.className;}
this.attributes.className=cn;this.attributesChanged();},getSlider:function(){return this.fetchModelProperty(this.sliderPropertyName,this.slider);},sliderChanged:function(){this.modelPropertyChanged(this.sliderPropertyName,this.slider);},sliderPropertyNameChanged:function(){this.mojoAttributeChanged("sliderProperty",this.sliderPropertyName);},getProgress:function(){return this.fetchModelProperty(this.progressPropertyName,this.progress);},progressChanged:function(){this.modelPropertyChanged(this.progressPropertyName,this.progress);},progressPropertyNameChanged:function(){this.mojoAttributeChanged("progressProperty",this.progressPropertyName);},getProgressStartValue:function(){return this.fetchModelProperty(this.progressStartValuePropertyName,this.progressStartValue);},progressStartValueChanged:function(){this.modelPropertyChanged(this.progressStartValuePropertyName,this.progressStartValue);},progressStartValuePropertyNameChanged:function(){this.mojoAttributeChanged("progressStartProperty",this.progressStartValuePropertyName);},getMinValue:function(){return this.fetchModelProperty("minValue");},getMaxValue:function(){return this.fetchModelProperty("maxValue");}});
opus.Class("Palm.Mojo.FilterField",{isa:Palm.Mojo.Widget,published:{disabled:{value:false,isModelData:true,modelPropertyName:"disabledPropertyName"},disabledPropertyName:{value:"disabled",model:true,group:"Model"},delay:{value:300,onchange:"mojoAttributeChanged"},onfilter:{event:Mojo.Event.filter+"Handler"},onfilterImmediate:{event:Mojo.Event.filterImmediate+"Handler"}},width:"100%",mojoClass:"FilterField",height:0,minHeight:0,maxHeight:0,create:function(){this.inherited(arguments);this.content="";this.mojoAttributeChanged("delay");this.disabledPropertyNameChanged();},nodeRendered:function(){if(this.isDesigning()){opus.Control.prototype.nodeRendered.call(this);}else{this.inherited(arguments);}},disabledPropertyNameChanged:function(){this.mojoAttributeChanged("disabledProperty",this.disabledPropertyName);},disabledChanged:function(){this.modelPropertyChanged(this.disabledPropertyName,this.disabled);},boundsChanged:function(){this.bounds.h=0;this.inherited(arguments);}});
opus.Class("Palm.Mojo.StatusIndicator",{isa:opus.Control,mixins:[Palm.Mojo.ControlMixin],width:36,height:36,published:{statusType:{value:"status-available",onchange:"attributesChanged",options:["status-available","status-available partial","status-away","status-busy","status-busy partial","status-idle","status-offline"]}},modifyDomAttributes:function(inAttributes){inAttributes.className="icon "+this.statusType;}});
opus.Class("Palm.Mojo.AccountIcon",{isa:opus.Control,mixins:[Palm.Mojo.ControlMixin],width:60,height:60,published:{accountType:{value:"aim",onchange:"attributesChanged",options:["aim","aol","eas","facebook","favorites","generic","google","googletalk","linkedin","local","msn","photobucket","sim","youtube","yahoo"]},size:{value:"small",onchange:"attributesChanged",options:["small","medium"]}},modifyDomAttributes:function(inAttributes){inAttributes.className="icon palm-account-icon "+this.accountType+(this.size=="medium"?" medium":"");}});
opus.Class("Palm.Picture",{isa:opus.Picture,src:"",mixins:[Palm.Mojo.ControlMixin]});
opus.Class("Palm.Mojo.Divider",{isa:Palm.Mojo.Html,width:"100%",height:34,published:{content:{noExport:true,noInspect:true},templateFile:{noInspect:true},label:{value:"Label",isModelData:true,modelPropertyName:"labelPropertyName"},labelPropertyName:{value:"label",model:true,group:"Model"},kind:{value:"text",options:["text","blank","alpha"],onchange:"contentChanged"}},getLabel:function(){return this.fetchModelProperty(this.labelPropertyName,this.label);},labelChanged:function(){this.modelPropertyChanged(this.labelPropertyName,this.label);if(!this.isRendering()){this.updateInlineTemplate();}},labelPropertyNameChanged:function(){this.updateInlineTemplate();},fetchInlineTemplate:function(){var c="#{"+this.labelPropertyName+"}";switch(this.kind){case"text":return'<table class="palm-divider labeled"><tbody>'+'<tr><td class="left"></td>'+'<td class="label">'+c+'</td>'+'<td class="right"></td>'+'</tr></tbody></table>';case"blank":return'<div class="palm-divider solid"></div>';case"alpha":return'<div class="palm-divider alpha" style="overflow: hidden;">'+'<div>'+c+'</div>'+'</div>';}}});
opus.Class("Palm.Mojo.Service",{isa:opus.Component,published:{onSuccess:{event:"doSuccess"},onFailure:{event:"doFailure"}},url:"",method:"",constructor:function(){this.parameters={};},fetchSceneController:function(){return this.owner.sceneController||Ares.mojoSceneController;},isReady:function(){return!Boolean(this.handle);},execute:function(inMethod,inParams,inCallbackMethod,inErrbackMethod){if(this.isReady()){this.handle=this.fetchSceneController().serviceRequest(this.url,{method:inMethod||this.method,parameters:inParams||this.parameters,onSuccess:kit.hitch(this,inCallbackMethod||"success"),onFailure:kit.hitch(this,inErrbackMethod||"failure")});}else{this.failure();}},cancel:function(){if(this.handle&&this.handle.cancel){this.handle.cancel();this.finish();}},finish:function(){if(!this.subscribe||(this.handle&&this.handle.cancelled)){this.handle=null;}},success:function(){this.finish();this.doSuccess.apply(this,arguments);},failure:function(inResponse){Mojo.Log.warn("Service Error "+(inResponse||""));this.finish();this.doFailure.apply(this,arguments);},makeServiceData:function(){var data={},p$=this.published,p;for(var i in p$){p=p$[i];if(p.isServiceData){data[p.servicePropertyName||i]=this[i];}}
return data;},populate:function(inData){if(inData){var p$=this.published,p,sp;for(var i in p$){p=p$[i];sp=p.servicePropertyName||i;if(p.isServiceData&&(sp in inData)){this["set"+kit.cap(i)](inData[sp]);}}}}});
opus.Class("Palm.Mojo.ServiceCall",{isa:Palm.Mojo.Service,published:{url:"",method:"",parameters:{value:{},editor:{editorKind:"Palm.Ares.CodePropertyEditor",isJson:true}}}});
opus.Class("Palm.Mojo.Gps",{isa:Palm.Mojo.Service,url:"palm://com.palm.location",published:{accuracy:1,maximumAge:0,responseTime:1,subscribe:true},getCurrentPosition:function(){this.execute("getCurrentPosition",{accuracy:Number(this.accuracy),maximumAge:Number(this.maximumAge),responseTime:Number(this.responseTime)});},startTracking:function(){this.execute("startTracking",{subscribe:this.subscribe});}});
opus.Class("Palm.Mojo.Location",{isa:Palm.Mojo.Service,url:"palm://com.palm.location",published:{latitude:38.898748,longitude:-77.037684},getReverseLocation:function(){this.execute("getReverseLocation",{latitude:Number(this.latitude),longitude:Number(this.longitude)});}});
opus.Class("Palm.Mojo.SystemSound",{isa:Palm.Mojo.Service,url:"palm://com.palm.audio/systemsounds",method:"playFeedback",published:{sound:{value:"shuffling_01",options:["appclose","back_01","browser_01","card_01","card_02","card_03","card_04","card_05","default_425hz","delete_01","discardingapp_01","down2","dtmf_0","dtmf_1","dtmf_2","dtmf_3","dtmf_4","dtmf_5","dtmf_6","dtmf_7","dtmf_8","dtmf_9","dtmf_asterisk","dtmf_pound","error_01","error_02","error_03","focusing","launch_01","launch_02","launch_03","pagebackwards","pageforward_01","shuffle_02","shuffle_03","shuffle_04","shuffle_05","shuffle_06","shuffle_07","shuffle_08","shuffling_01","shutter","switchingapps_01","switchingapps_02","switchingapps_03","tones_3beeps_otasp_done","unassigned","up2"]}},execute:function(){this.parameters.name=this.sound;this.inherited(arguments);},playSound:function(){this.execute();}});
opus.Class("Palm.Mojo.ViewFile",{isa:Palm.Mojo.Service,published:{fileUrl:{value:""}},url:"palm://com.palm.applicationManager",method:"open",execute:function(){this.parameters.target=this.fileUrl;this.inherited(arguments);},viewFile:function(){this.execute();}});
opus.Class("Palm.Mojo.Download",{isa:Palm.Mojo.Service,published:{fileUrl:{value:"",servicePropertyName:"target",isServiceData:true},mime:{value:"",isServiceData:true},targetDir:{value:"/media/internal/downloads",isServiceData:true},targetFilename:{value:"",isServiceData:true},keepFilenameOnRedirect:{value:true,isServiceData:true},subscribe:{value:true,isServiceData:true}},url:"palm://com.palm.downloadmanager/",success:function(response){if(response&&response.ticket){this.ticket=response.ticket;}
this.inherited(arguments);if(response&&response.completed){this.cancel();}},failure:function(response){if(response&&response.ticket){this.ticket=response.ticket;}
this.inherited(arguments);if(response&&response.completed){this.cancel();}},download:function(){var d=this.makeServiceData();this.execute("download",d);},deleteDownload:function(){this.callTicketMethod("deleteDownloadedFile");},cancelDownload:function(){this.callTicketMethod("cancelDownload");},downloadStatusQuery:function(){this.callTicketMethod("downloadStatusQuery");},callTicketMethod:function(inMethod){if(this.ticket){this.execute(inMethod,{ticket:this.ticket});}else{this.failure("No download ticket");}}});
opus.Class("Palm.Mojo.Downloads",{isa:Palm.Mojo.Service,published:{},url:"palm://com.palm.downloadmanager/",method:"listPending",listPending:function(){this.execute();}});
opus.Class("Palm.Mojo.Upload",{isa:Palm.Mojo.Service,published:{fileName:{value:"",isServiceData:true},uploadUrl:{value:"",servicePropertyName:"url",isServiceData:true},fileLabel:{value:"",isServiceData:true},contentType:{value:"",isServiceData:true},postParameters:{value:{},isServiceData:true,editor:{editorKind:"Palm.Ares.CodePropertyEditor",isJson:true}},cookies:{value:{},isServiceData:true,editor:{editorKind:"Palm.Ares.CodePropertyEditor",isJson:true}},customHttpHeaders:{value:[],isServiceData:true,editor:{editorKind:"Palm.Ares.CodePropertyEditor",isJson:true}},subscribe:{value:true,isServiceData:true}},url:"palm://com.palm.downloadmanager/",method:"upload",execute:function(){this.parameters=this.makeServiceData();this.inherited(arguments);},upload:function(){this.execute();}});
opus.Class("Palm.Mojo.Camera",{isa:Palm.Mojo.Service,published:{filename:""},create:function(){this.successHandler=kit.hitch(this,"success");this.inherited(arguments);},destructor:function(){this.stopListening();this.inherited(arguments);},execute:function(){this.listen();this.fetchSceneController().stageController.pushScene({appId:'com.palm.app.camera',name:'capture'},{sublaunch:true,filename:this.filename});},launch:function(){this.execute();},listen:function(){var controller=this.fetchSceneController();controller.listen(controller.sceneElement,Mojo.Event.activate,this.successHandler,false);},stopListening:function(){var controller=this.fetchSceneController();controller.stopListening(controller.sceneElement,Mojo.Event.activate,this.successHandler,false);},success:function(response){this.stopListening();this.inherited(arguments);}});
opus.Class("Palm.Mojo.PeoplePicker",{isa:Palm.Mojo.Service,published:{exclusions:{value:[],editor:{editorKind:"Palm.Ares.CodePropertyEditor",isJson:true}},message:""},create:function(){this.successHandler=kit.hitch(this,"success");this.inherited(arguments);},destructor:function(){this.stopListening();this.inherited(arguments);},execute:function(){this.listen();this.fetchSceneController().stageController.pushScene({appId:"com.palm.app.contacts",name:"list"},{mode:"picker",exclusions:this.exclusions,message:this.message});},launch:function(){this.execute();},listen:function(){var controller=this.fetchSceneController();controller.listen(controller.sceneElement,Mojo.Event.activate,this.successHandler,false);},stopListening:function(){var controller=this.fetchSceneController();controller.stopListening(controller.sceneElement,Mojo.Event.activate,this.successHandler,false);},success:function(response){this.stopListening();this.inherited(arguments);}});
opus.Class("Palm.Mojo.Connection",{isa:Palm.Mojo.Service,url:"palm://com.palm.connectionmanager",method:"getstatus",getStatus:function(){this.execute();}});
opus.Class("Palm.Mojo.Alarm",{isa:Palm.Mojo.Service,published:{alarmAt:"",alarmIn:"","key":"",uri:"palm://com.palm.applicationManager/open",params:{value:{},editor:{editorKind:"Palm.Ares.CodePropertyEditor",isJson:true}},wakeup:true},url:"palm://com.palm.power/timeout",set:function(){var data={key:this.key,uri:this.uri,params:this.params,wakeup:this.wakeup}
if(this.alarmAt){data.at=this.alarmAt;}else if(this.alarmIn){data["in"]=this.alarmIn;}
this.execute("set",data);},clear:function(){this.execute("clear",{key:this.key});}});
opus.Class("Palm.Mojo.Account",{isa:Palm.Mojo.Service,published:{accountId:{value:"",isServiceData:true},displayName:{value:"",isServiceData:true},dataTypes:{value:'["CONTACTS", "CALENDAR"]',isServiceData:true,editor:{editorKind:"Palm.Ares.CodePropertyEditor",isJson:true}},domain:{value:"com.palmdts",isServiceData:true},icons:{vallue:"",isServiceData:true,editor:{editorKind:"Palm.Ares.CodePropertyEditor",isJson:true}},isDataReadOnly:{value:false,isServiceData:true},username:{value:"",isServiceData:true}},url:"palm://com.palm.accounts/crud",create:function(){this.inherited(arguments);this.dataTypesChanged();this.iconsChanged();},getAccount:function(){this.execute("getAccount",this.makeServiceData(),"processGet");},createAccount:function(){this.execute("createAccount",this.makeServiceData(),"processCommit");},updateAccount:function(){this.execute("updateAccount",this.makeServiceData(),"processCommit");},deleteAccount:function(){this.execute("deleteAccount",this.makeServiceData(),"processDelete");},processGet:function(inResponse){this.populate(inResponse);this.success.apply(this,kit._toArray(arguments));},processCommit:function(inResponse){this.setAccountId(inResponse.accountId);this.success.apply(this,kit._toArray(arguments));},processDelete:function(inResponse){this.success.apply(this,kit._toArray(arguments));},dataTypesChanged:function(){this.dataTypes=Palm.fetchJsonValue(this.dataTypes,[]);},iconsChanged:function(){this.icons=Palm.fetchJsonValue(this.icons,{});}});
opus.Class("Palm.Mojo.Accounts",{isa:Palm.Mojo.Service,url:"palm://com.palm.accounts/crud",method:"listAccounts",listAccounts:function(){this.execute();}});
opus.Class("Palm.Mojo.Keys",{isa:Palm.Mojo.Service,published:{keyType:{value:"audio",options:["audio","switches","media","headset"]},subscribe:true},method:"status",execute:function(){this.url="palm://com.palm.keys/"+this.keyType;this.parameters={subscribe:this.subscribe};this.inherited(arguments);},getKeys:function(){this.execute();}});
opus.Class("Palm.Mojo.Launch",{isa:Palm.Mojo.Service,published:{applicationId:{value:"",isServiceData:true,servicePropertyName:"id"},params:{value:{},isServiceData:true,editor:{editorKind:"Palm.Ares.CodePropertyEditor",isJson:true}}},url:"palm://com.palm.applicationManager",method:"launch",execute:function(){this.parameters=this.makeServiceData();this.inherited(arguments);},launch:function(){this.execute();}});
opus.Class("Palm.Mojo.LaunchEmail",{isa:Palm.Mojo.Launch,published:{applicationId:{value:"com.palm.app.email",noInspect:true,isServiceData:true,servicePropertyName:"id"},params:{noInspect:true,isServiceData:true},accountId:"",attachements:{value:[],editor:{editorKind:"Palm.Ares.CodePropertyEditor",isJson:true}},recipients:{value:[],editor:{editorKind:"Palm.Ares.CodePropertyEditor",isJson:true}},subject:"",message:""},method:"open",execute:function(){this.params=this.makeParams();this.inherited(arguments);},launch:function(){this.inherited(arguments);},makeParams:function(){return{account:this.accountId,attachments:this.attachments,recipients:this.recipients,summary:this.subject,text:this.message};}});
opus.Class("Palm.Mojo.LaunchContacts",{isa:Palm.Mojo.Launch,published:{applicationId:{value:"com.palm.app.contacts",noInspect:true,isServiceData:true,servicePropertyName:"id"},params:{noInspect:true,isServiceData:true},launchType:{value:"newContact",options:["newContact","addToExisting"]},addresses:{value:[],isContactData:true,editor:{editorKind:"Palm.Ares.CodePropertyEditor",isJson:true}},anniversary:{value:"",isContactData:true},birthday:{value:"",isContactData:true},children:{value:"",isContactData:true},companyName:{value:"",isContactData:true},customFields:{value:[],isContactData:true,editor:{editorKind:"Palm.Ares.CodePropertyEditor",isJson:true}},displayText:{value:"",isContactData:true},emailAddresses:{value:[],isContactData:true,editor:{editorKind:"Palm.Ares.CodePropertyEditor",isJson:true}},externalId:{value:"",isContactData:true},extraDetails:{value:"",isContactData:true},firstName:{value:"",isContactData:true},id:{value:"",isContactData:true},imAvatarLoc:{value:"",isContactData:true},imNames:{value:[],isContactData:true,editor:{editorKind:"Palm.Ares.CodePropertyEditor",isJson:true}},incomingPic:{value:"",isContactData:true},jobTitle:{value:"",isContactData:true},lastName:{value:"",isContactData:true},listPic:{value:"",isContactData:true},middleName:{value:"",isContactData:true},nickname:{value:"",isContactData:true},notes:{value:"",isContactData:true},phoneNumbers:{value:[],isContactData:true,editor:{editorKind:"Palm.Ares.CodePropertyEditor",isJson:true}},pictureLoc:{value:"",isContactData:true},pictureLocBig:{value:"",isContactData:true},pictureLocSquare:{value:"",isContactData:true},prefix:{value:"",isContactData:true},spouse:{value:"",isContactData:true},suffix:{value:"",isContactData:true},contactUrl:{value:"",isContactData:true},urls:{value:[],isContactData:true,editor:{editorKind:"Palm.Ares.CodePropertyEditor",isJson:true}}},method:"open",execute:function(){this.params={launchType:this.launchType,contact:this.makeContactData()};this.inherited(arguments);},launch:function(){this.inherited(arguments);},makeContactData:function(){var data={},p$=this.published,p;for(var i in p$){p=p$[i];if(p.isContactData){data[i]=this[i];}}
return data;}});
opus.Class("Palm.Mojo.LaunchMaps",{isa:Palm.Mojo.Launch,published:{applicationId:{value:"com.palm.app.maps",noInspect:true,isServiceData:true,servicePropertyName:"id"},params:{noInspect:true,isServiceData:true},location:{value:{},editor:{editorKind:"Palm.Ares.CodePropertyEditor",isJson:true}},layer:"",query:"",mapType:"",zoom:""},method:"open",execute:function(){this.params=this.makeParams();this.inherited(arguments);},launch:function(){this.inherited(arguments);},makeParams:function(){return{location:this.location,layer:this.layer,query:this.query,type:this.mapType,zoom:this.zoom}}});
opus.Class("Palm.Mojo.LaunchMessaging",{isa:Palm.Mojo.Launch,published:{applicationId:{value:"com.palm.app.messaging",noInspect:true,isServiceData:true,servicePropertyName:"id"},params:{noInspect:true,isServiceData:true},attachment:"",composeRecipients:{value:[],editor:{editorKind:"Palm.Ares.CodePropertyEditor",isJson:true}},contactPointId:{value:[],editor:{editorKind:"Palm.Ares.CodePropertyEditor",isJson:true}},messageText:"",personId:""},method:"launch",execute:function(){this.params=this.makeParams();this.inherited(arguments);},launch:function(){this.inherited(arguments);},makeParams:function(){return{attachment:this.attachment,composeRecipients:this.composeRecipients,contactPointId:this.contactPointId,messageText:this.messageText,personId:this.personId};}});
opus.Class("Palm.Mojo.Display",{isa:Palm.Mojo.Service,published:{subscribe:{value:true,isServiceData:true}},url:"palm://com.palm.display",method:"status",execute:function(){this.parameters=this.makeServiceData();this.inherited(arguments);},status:function(){this.execute();}});
opus.Class("Palm.Mojo.Power",{isa:Palm.Mojo.Service,published:{id:"",duration:""},url:"palm://com.palm.power/com/palm/power",execute:function(){this.parameters={id:this.id,duration_ms:Number(this.duration)};this.inherited(arguments);},startActivity:function(){this.execute("activityStart");},endActivity:function(){this.execute("activityEnd");}});
opus.Class("Palm.Mojo.Preferences",{isa:Palm.Mojo.Service,published:{preferenceData:{value:{},editor:{editorKind:"Palm.Ares.CodePropertyEditor",isJson:true}},subscribe:false},url:"palm://com.palm.systemservice",getPreferences:function(){var keys=[];for(var i in this.preferenceData){keys.push(i);}
this.execute("getPreferences",{keys:keys},"processGet");},processGet:function(inResponse,inRequest){this.populate(inResponse);this.success(inResponse,inRequest);},populate:function(inPreferences){for(var i in inPreferences){if(i in this.preferenceData){this.preferenceData[i]=inPreferences[i];}}},setPreferences:function(){this.execute("setPreferences",this.preferenceData);}});
opus.Class("Palm.Mojo.PreferenceValues",{isa:Palm.Mojo.Service,published:{key:""},url:"palm://com.palm.systemservice",method:"getPreferenceValues",execute:function(){this.parameters={key:this.key};this.inherited(arguments);},getPreferenceValues:function(){this.execute();}});
opus.Class("Palm.Mojo.Time",{isa:Palm.Mojo.Service,published:{subscribe:false},url:"palm://com.palm.systemservice/time",method:"getSystemTime",execute:function(){this.parameters={subscribe:this.subscribe};this.inherited(arguments);},getSystemTime:function(){this.execute();}});
opus.Class("Palm.Mojo.TrackChanges",{isa:Palm.Mojo.Service,published:{accountId:{value:"",isServiceData:true},trackerId:{value:"",isServiceData:true},token:{value:"",isServiceData:true},changeType:{value:"contacts",options:["contacts","calendar"]}},execute:function(){this.url="palm://com.palm."+this.changeType+"/crud";this.parameters=this.makeServiceData();this.inherited(arguments);},startTracking:function(){this.execute("startTracking");},getChanges:function(){this.execute("getChanges");},doneWithChanges:function(){this.execute("doneWithChanges");},sucess:function(inResponse){if(inResponse.token){this.token=inResponse.token;}
this.inherited(arguments);}});
opus.Class("Palm.Mojo.Contact",{isa:Palm.Mojo.Service,published:{accountId:{value:"",isServiceData:true},externalId:{value:"",isServiceData:true},trackChange:{value:false,isServiceData:true},id:{value:"",isContactData:true},addresses:{value:[],isContactData:true,editor:{editorKind:"Palm.Ares.CodePropertyEditor",isJson:true}},anniversary:{value:"",isContactData:true},birthday:{value:"",isContactData:true},children:{value:"",isContactData:true},companyName:{value:"",isContactData:true},customFields:{value:[],isContactData:true,editor:{editorKind:"Palm.Ares.CodePropertyEditor",isJson:true}},displayText:{value:"",isContactData:true},emailAddresses:{value:[],isContactData:true,editor:{editorKind:"Palm.Ares.CodePropertyEditor",isJson:true}},externalId:{value:"",isContactData:true},extraDetails:{value:"",isContactData:true},firstName:{value:"",isContactData:true},id:{value:"",isContactData:true},imAvatarLoc:{value:"",isContactData:true},imNames:{value:[],isContactData:true,editor:{editorKind:"Palm.Ares.CodePropertyEditor",isJson:true}},incomingPic:{value:"",isContactData:true},jobTitle:{value:"",isContactData:true},lastName:{value:"",isContactData:true},listPic:{value:"",isContactData:true},middleName:{value:"",isContactData:true},nickname:{value:"",isContactData:true},notes:{value:"",isContactData:true},phoneNumbers:{value:[],isContactData:true,editor:{editorKind:"Palm.Ares.CodePropertyEditor",isJson:true}},pictureLoc:{value:"",isContactData:true},pictureLocBig:{value:"",isContactData:true},pictureLocSquare:{value:"",isContactData:true},prefix:{value:"",isContactData:true},spouse:{value:"",isContactData:true},suffix:{value:"",isContactData:true},contactUrl:{value:"",isContactData:true,servicePropertyName:"url"},urls:{value:[],isContactData:true,editor:{editorKind:"Palm.Ares.CodePropertyEditor",isJson:true}}},url:"palm://com.palm.contacts/crud",getContact:function(){var data=this.makeServiceData();data.id=this.getId();this.execute("getContact",data,"processGet");},createContact:function(){var data=this.makeServiceData();data.contact=this.makeContactData();this.execute("createContact",data,"processCommit");},updateContact:function(){var data=this.makeServiceData();data.contact=this.makeContactData();data.id=this.getId();this.execute("updateContact",data,"processCommit");},deleteContact:function(){var data=this.makeServiceData();data.id=this.getId();this.execute("deleteContact",data,"processDelete");},processGet:function(inResponse){this.populate(inResponse);this.success.apply(this,kit._toArray(arguments));},processCommit:function(inResponse){if(inResponse.id){this.setId(inResponse.id);}
this.success.apply(this,kit._toArray(arguments));},processDelete:function(inResponse){this.success.apply(this,kit._toArray(arguments));},makeContactData:function(){var data={},p$=this.published,p;for(var i in p$){p=p$[i];if(p.isContactData){data[p.servicePropertyName||i]=this[i];}}
return data;},populate:function(inResponse){this.inherited(arguments);var p$=this.published,p,sp;for(var i in p$){p=p$[i];sp=p.servicePropertyName||i;if(p.isContactData&&(sp in inResponse)){this["set"+kit.cap(i)](inResponse[sp]);}}}});
opus.Class("Palm.Mojo.Contacts",{isa:Palm.Mojo.Service,published:{accountId:"",filter:"",limit:100,offset:0},url:"palm://com.palm.contacts/crud",method:"listContacts",execute:function(){this.parameters={accountId:this.accountId,filter:this.filter,limit:Number(this.limit),offset:Number(this.offset)};this.inherited(arguments);},listContacts:function(){this.execute();}});
opus.Class("Palm.Mojo.Calendars",{isa:Palm.Mojo.Service,published:{accountId:""},url:"palm://com.palm.calendar/crud",method:"listCalendars",execute:function(){this.parameters={accountId:this.accountId};this.inherited(arguments);},listCalendars:function(){this.execute();}});
opus.Class("Palm.Mojo.Calendar",{isa:Palm.Mojo.Service,published:{accountId:"",calendarId:{value:"",isServiceData:true},externalId:{value:"",isServiceData:true},calendarName:{value:"",isServiceData:true,servicePropertyName:"name"},trackChange:{value:true,isServiceData:true}},url:"palm://com.palm.calendar/crud",getCalendar:function(){var p={accountId:this.accountId,calendarId:this.calendarId,externalId:this.externalId};this.execute("getCalendar",p,"processGet");},createCalendar:function(){var p={accountId:this.accountId,calendar:this.makeServiceData()}
this.execute("createCalendar",p,"processCommit");},updateCalendar:function(){var p={calendar:this.makeServiceData()};this.execute("updateCalendar",p,"processCommit");},deleteCalendar:function(){var p={calendarId:this.calendarId,trackChange:this.trackChange};this.execute("deleteCalendar",p,"processDelete");},processGet:function(inResponse){this.populate(inResponse);this.success.apply(this,kit._toArray(arguments));},processCommit:function(inResponse){if(inResponse.calendarId){this.setCalendarId(inResponse.calendarId);}
this.success.apply(this,kit._toArray(arguments));},processDelete:function(inResponse){this.success.apply(this,kit._toArray(arguments));}});
opus.Class("Palm.Mojo.Events",{isa:Palm.Mojo.Service,url:"palm://com.palm.calendar/crud",method:"listEvents",published:{calendarId:"",endTimestamp:0,limit:100,offset:0,startTimestamp:0,tzFormqt:""},execute:function(){this.parameters={calendarId:this.calendarId,endTimestamp:Number(this.endTimestamp),limit:Number(this.limit),offset:Number(this.offset),startTimestamp:Number(this.startTimestamp),tzFormqt:this.tzFormqt};this.inherited(arguments);},listEvents:function(){this.execute();}});
opus.Class("Palm.Mojo.Event",{isa:Palm.Mojo.Service,published:{accountId:"",calendarId:"",externalId:"",eventId:{value:"",isServiceData:true},alarm:{value:"",isServiceData:true},allDay:{value:false,isServiceData:true},attendees:{value:"",isServiceData:true,editor:{editorKind:"Palm.Ares.CodePropertyEditor",isJson:true}},endTimestamp:{value:0,isServiceData:true},endValidity:{value:"",isServiceData:true},externalId:{value:"",isServiceData:true},location:{value:"",isServiceData:true},note:{value:"",isServiceData:true},originalStartTimestamp:{value:0,isServiceData:true},parentId:{value:"",isServiceData:true},rrule:{value:"",isServiceData:true},rruleTZ:{value:"",isServiceData:true},subject:{value:"",isServiceData:true},startTimestamp:{value:"",isServiceData:true},trackChange:{value:true,isServiceData:true}},url:"palm://com.palm.calendar/crud",startTimestampChanged:function(){this.startTimestamp=Number(this.startTimestamp);},endTimestampChanged:function(){this.endTimestamp=Number(this.endTimestamp);},originalStartTimestampChanged:function(){this.originalStartTimestamp=Number(this.originalStartTimestamp);},getEvent:function(){var p={accountId:this.accountId,eventId:this.eventId,externalId:this.externalId,tzFormat:"id"};this.execute("getEvent",p,"processGet");},createEvent:function(){var p={calendarId:this.calendarId,event:this.makeServiceData(),trackChange:this.trackChange}
this.execute("createEvent",p,"processCommit");},updateEvent:function(){var p=this.makeServiceData();this.execute("updateEvent",p,"processCommit");},deleteEvent:function(){var p={eventId:this.eventId,trackChange:this.trackChange};this.execute("deleteEvent",p,"processDelete");},processGet:function(inResponse){this.populate(inResponse);this.success.apply(this,kit._toArray(arguments));},processCommit:function(inResponse){if(inResponse.eventId){this.setEventId(inResponse.eventId);}
this.success.apply(this,kit._toArray(arguments));},processDelete:function(inResponse){this.setEventId("");this.success.apply(this,kit._toArray(arguments));}});
opus.Class("Palm.Mojo.WebService",{isa:Palm.Mojo.Service,published:{url:{value:""},method:{value:"GET",options:["GET","POST","PUT","DELETE"]},parametersString:{value:""},parameters:{value:{},editor:{editorKind:"Palm.Ares.CodePropertyEditor",isJson:true}},handleAs:{value:"text",options:["text","json","xml"]},contentType:"application/x-www-form-urlencoded",headers:{value:{},editor:{editorKind:"Palm.Ares.CodePropertyEditor",isJson:true}}},create:function(){this.inherited(arguments);this.srvReady=true;},destroy:function(){this.cancel();this.inherited(arguments);},isReady:function(){return this.srvReady;},cancel:function(){this.cancelled=true;},finish:function(){this.srvReady=true;},execute:function(inMethod,inParams,inCallbackMethod,inErrbackMethod){if(!this.isReady()){return;}
this.srvReady=false;this.cancelled=false;var success=kit.hitch(this,inCallbackMethod||"success");var failure=kit.hitch(this,inErrbackMethod||"failure");var url=this.url;var method=inMethod||this.method;var params=inParams||this.parameters;params=kit.isObject(params)?kit.objectToQuery(params):params;if(this.parametersString){params=params+(params?"&":"")+this.parametersString;}
if(method=="GET"&&params){url+=(url.include('?')?'&':'?')+params;params=null;}
var headers={};headers["Content-Type"]=this.contentType;kit.mixin(headers,this.headers);opus.xhr.request({url:url,method:method,callback:kit.hitch(this,"requestCompleted",this.handleAs,success,failure),body:params,headers:headers});},requestCompleted:function(inHandleAs,inSuccess,inFailure,inResponseText,inXhr){if(this.cancelled){console.log("skip processing callback due to cancel() was called.");this.finish();}else{if(inXhr.status&&inXhr.status!=0&&(inXhr.status>=200&&inXhr.status<300)){response=this.processResponse(inXhr,inHandleAs);inSuccess&&inSuccess.apply(null,[response,inXhr]);}else{inFailure&&inFailure.apply(null,[inXhr]);}}},processResponse:function(inXhr,inHandleAs){switch(inHandleAs){case"json":try{var resp=inXhr.responseText;return resp&&eval("("+resp+")");}catch(e){console.log("responseText is not in JSON format");return resp;}
case"xml":return inXhr.responseXML;default:return inXhr.responseText;}}});
opus.Class("Palm.Mojo.FeedService",{isa:Palm.Mojo.WebService,published:{method:{value:"GET",noInspect:true},parametersString:{noInspect:true},parameters:{noInspect:true},handleAs:{value:"xml",noInspect:true},contentType:{value:"application/x-www-form-urlencoded",noInspect:true},headers:{noInspect:true}},processResponse:function(inXhr,inHandleAs){var response=this.inherited(arguments);if(response){return this.processFeedResponse(response);}else{return{};}},processFeedResponse:function(inXmlDoc){if(inXmlDoc.getElementsByTagName("channel").length>0){var propNames={"title":"title","link":"link","description":"description","language":"language"};var itemPropNames={"title":"title","link":"link","description":"description","pubDate":"date","guid":"id"};return this.parseFeed(inXmlDoc,"channel",propNames,"item",itemPropNames);}else if(inXmlDoc.getElementsByTagName("feed").length>0){var propNames={"title":"title","link:href":"link","subtitle":"description","language":"language"};var itemPropNames={"title":"title","link:href":"link","content":"description","updated":"date","id":"id"};return this.parseFeed(inXmlDoc,"feed",propNames,"entry",itemPropNames);}},parseFeed:function(inXmlDoc,inFeedNodeName,inFeedPropNames,inFeedItemNodeName,inFeedItemPropNames){var feedData={};var feedNode=inXmlDoc.getElementsByTagName(inFeedNodeName)[0];this.populateFeedProps(feedNode,feedData,inFeedPropNames);var items=inXmlDoc.getElementsByTagName(inFeedItemNodeName);this.populateFeedItems(items,feedData,inFeedItemPropNames);return feedData;},populateFeedProps:function(inChannel,ioFeedData,inNames){for(n in inNames){for(var i=0,node;node=inChannel.childNodes[i];i++){var v=this.findPropValue(node,n);if(v){ioFeedData[inNames[n]]=v;break;}}}},populateFeedItems:function(inItems,ioFeedData,inNames){var feedItems=[];for(var i=0,item;item=inItems[i];i++){var d={};for(n in inNames){d[inNames[n]]=this.getItemPropValue(item,n);}
feedItems.push(d);}
ioFeedData["items"]=feedItems;},getItemPropValue:function(inItem,inName){for(var i=0,node;node=inItem.childNodes[i];i++){var v=this.findPropValue(node,inName);if(v){return v;}}},findPropValue:function(inNode,inName){var names=inName.split(":");if(inNode.nodeName==names[0]){if(names.length==1){return inNode.firstChild&&inNode.firstChild.nodeValue;}else if(names.length==2){for(var i=0,attr;attr=inNode.attributes[i];i++){if(attr.name==names[1]){return attr.value;}}}}}});
opus.Class("Palm.Mojo.FeedList",{isa:Palm.Mojo.List,published:{itemHtml:'<div class="palm-row">\n\t<div style="position: absolute; height: 73px; left: 10px; right: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;">\n\t\t<a style="font-size: 17px; color: #2d6c94; text-decoration: none;" href="#{link}">#{-title}</a>\n\t\t<div style="font-size: 14px;">#{-description}</div>\n\t</div>\n</div>',feedUrl:"http://feeds2.feedburner.com/pdnblog",autoPopulate:true,onFeedSuccess:{event:"doFeedSuccess"},onFeedFailure:{event:"doFeedFailure"}},create:function(){this.inherited(arguments);this.feedService=this.createComponent({type:"Palm.Mojo.FeedService",owner:this,onSuccess:"feedSuccess",onFailure:"feedFailure"});this.feedUrlChanged();},populateFeed:function(){this.feedService.execute();},feedSuccess:function(inSender,inResponse,inRequest){this.setItems(inResponse.items);this.doFeedSuccess.apply(this,arguments);},feedFailure:function(inSender,inError){this.doFeedFailure.apply(this,arguments);},feedUrlChanged:function(){this.feedService.setUrl(this.feedUrl);if(!this.isDesigning()&&this.autoPopulate){this.populateFeed();}}});
opus.Class("Palm.Mojo.Wallpaper",{isa:Palm.Mojo.Service,published:{importUrl:"",focusX:"",focusY:"",scale:"",wallpaperFile:"",wallpaperName:"",wallpaperThumbFile:{vale:"",noInspect:true}},url:"palm://com.palm.systemservice/wallpaper",focusXChanged:function(){this.focusX=this.focusX?Number(this.focusX):"";},focusYChanged:function(){this.focusY=this.focusY?Number(this.focusY):"";},scaleChanged:function(){this.scale=this.scale?Number(this.scale):"";},importWallpaper:function(){var p={target:this.importUrl};if(this.focusX){p.focusX=this.focusX;}
if(this.focusY){p.focusY=this.focusY;}
if(this.scale){p.scale=this.scale;}
this.execute("importWallpaper",p,"processInfo");},updateWallpaperInfo:function(){var p={wallpaperName:this.wallpaperName,wallpaperFile:this.wallpaperFile};this.execute("info",p,"processInfo");},processInfo:function(inResponse,inRequest){var w=inResponse.wallpaper;if(w){this.setWallpaperFile(w.wallpaperFile);this.setWallpaperName(w.wallpaperName);this.setWallpaperThumbFile(w.wallpaperThumbFile);}
this.finish();this.setSystemWallpaper();},deleteWallpaper:function(){this.execute("deleteWallpaper",{wallpaperName:this.wallpaperName});},setSystemWallpaper:function(){var url=this.url;this.url="palm://com.palm.systemservice";var w={wallpaperName:this.wallpaperName,wallpaperFile:this.wallpaperFile,wallpaperThumbFile:this.wallpaperThumbFile};this.execute("setPreferences",{wallpaper:w});this.url=url;},getSystemWallpaper:function(){var url=this.url;this.url="palm://com.palm.systemservice";this.execute("getPreferences",{keys:["wallpaper"]},"processInfo");this.url=url;}});
opus.Class("Palm.Mojo.Audio",{isa:opus.Component,published:{url:{value:""},progress:{value:0,noInspect:true},autoPlay:false,loop:false,audioClass:{value:"media",options:["media","defaultapp"]},onPlay:{event:"doPlay"},onPause:{event:"doPause"},onEnded:{event:"doEnded"},onError:{event:"doError"},onTimeUpdate:{event:"doTimeUpdate"}},constructor:function(){},create:function(){this.inherited(arguments);this.createPlayer();this.audioClassChanged();this.urlChanged();},destroy:function(){this.disconnectEvents();delete this.player;this.inherited(arguments);},createPlayer:function(){this.player=new Audio();this.connectEvents();},connectEvents:function(){this.connectEvent('play',kit.hitch(this,"doPlay"),false);this.connectEvent('pause',kit.hitch(this,"doPause"),false);this.connectEvent('timeupdate',kit.hitch(this,"processTimeUpdate"),false);this.connectEvent('error',kit.hitch(this,"doError"),false);},getProgress:function(){var d=this.player.duration;return d?this.player.currentTime/d:0;},progressChanged:function(){this.player.currentTime=this.progress*this.player.duration},currentTimeChanged:function(){this.player.currentTime=this.currentTime;},processTimeUpdate:function(e){if(this.player.currentTime==this.player.duration){this.processEnded(e);}
this.doTimeUpdate(e);},processEnded:function(e){this.doEnded();if(this.loop){this.play();}},connectEvent:function(){var args=kit._toArray(arguments);this._connections=this._connections||[];this._connections.push(args);this.player.addEventListener.apply(this.player,args);},disconnectEvents:function(){for(var i=0,c;c=this._connections[i];i++){this.player.removeEventListener.apply(this.player,c);}
this._connections=[];},urlChanged:function(){this.player.src=this.url;if(this.autoPlay){this.play();}},audioClassChanged:function(){if(this.player.mojo){this.player.mojo.audioClass=this.audioClass}else{this.player.mojo={audioClass:this.audioClass};}},play:function(){this.player.play();},pause:function(){this.player.pause();},stop:function(){this.player.stop();}});Palm.Mojo.Audio.pool=[];
opus.Class("Palm.Mojo.Map",{isa:opus.Control,mixins:[Palm.Mojo.ControlMixin],published:{latitude:37.393056,longitude:-122.040532,zoom:14,mapOptions:{value:{},editor:{editorKind:"Palm.Ares.CodePropertyEditor",isJson:true}},mapTypeId:{value:"ROADMAP",options:["ROADMAP","SATELLITE","HYBRID","TERRAIN"]},showMarker:true},width:"100%",height:300,nodeRendered:function(){this.inherited(arguments);Palm.Map.loadGoogleScript(kit.hitch(this,"renderMap"));},constructor:function(){this._connections=[];},createMap:function(){var center=new google.maps.LatLng(this.latitude,this.longitude);var options={zoom:this.zoom,center:center,mapTypeId:google.maps.MapTypeId[this.mapTypeId]}
kit.mixin(options,this.mapOptions);this.map=new google.maps.Map(this.node,options);this.showMarkerChanged();this.connectEvent("gesturestart",kit.hitch(this,"handleGestureStart"),false);this.connectEvent("gesturechange",kit.hitch(this,"handleGestureChange"),false);this.connectEvent("gestureend",kit.hitch(this,"handleGestureEnd"),false);},destroyMap:function(){this.disconnectEvents();this.map=null;},renderMap:function(){this.destroyMap();this.createMap();},handleGestureStart:function(e){this.map.setOptions({draggable:false});this.previousScale=e.scale;},handleGestureChange:function(e){e.stop();var d=this.previousScale-e.scale;if(Math.abs(d)>0.25){var z=this.map.getZoom()+(d>0?-1:+1);this.map.setZoom(z);this.previousScale=e.scale;}},handleGestureEnd:function(e){e.stop();this.map.setOptions({draggable:true});},latitudeChanged:function(){this.latitude=Number(this.latitude);this.updateCenter();},longitudeChanged:function(){this.longitude=Number(this.longitude);this.updateCenter();},zoomChanged:function(){this.zoom=Number(this.zoom);if(this.map){this.map.setZoom(this.zoom);}},updateCenter:function(){if(this.map){this.map.setCenter(new google.maps.LatLng(this.latitude,this.longitude));this.showMarkerChanged();}},mapOptionsChanged:function(){if(this.map){this.map.setOptions(this.mapOptions);}},mapTypeIdChanged:function(){this.map.setMapTypeId(google.maps.MapTypeId[this.mapTypeId]);},showMarkerChanged:function(){if(this.centerMarker){this.clearMarker(this.centerMarker);}
this.centerMarker=(this.showMarker?this.setMarker(this.map.getCenter()):null);},setMarker:function(inLatLng){if(this.map){return new google.maps.Marker({position:inLatLng,map:this.map});}},clearMarker:function(inMarker){inMarker.setMap(null);},connectEvent:function(){var args=kit._toArray(arguments);this._connections=this._connections||[];this._connections.push(args);this.node.addEventListener.apply(this.node,args);},disconnectEvents:function(){for(var i=0,c;c=this._connections[i];i++){this.node.removeEventListener.apply(this.node,c);}
this._connections=[];}});Palm.Map={scriptLoadedCbs:[],alreadyCalled:false,loadGoogleScript:function(inCallback){if(window["google"]&&window["google"]["maps"]){inCallback&&inCallback();}else{this.scriptLoadedCbs.push(inCallback);if(!this.alreadyCalled){this.alreadyCalled=true;var script=document.createElement("script");script.type="text/javascript";script.src="http://maps.google.com/maps/api/js?sensor=true&callback=Palm.Map.scriptLoaded";document.body.appendChild(script);}}},scriptLoaded:function(){for(var i=0,c;c=this.scriptLoadedCbs[i];i++){c();}
this.scriptLoadedCbs=[];}};