if(typeof bespin==="undefined")bespin={};if(typeof document!=="undefined"){var link=document.getElementById("bespin_base");if(link){var href=link.href;bespin.base=href.substring(href.length-1)!=="/"?href+"/":href}else bespin.base=""} (function(){if("undefined"===typeof y)var y=function(){function j(w,t){x.push({m:w,a:t})}var x=[],E={isBootstrap:true,queue:x,register:function(w,t){if(w.match(/^tiki/)&&this.ENV)if(this.ENV.app==="tiki"&&this.ENV.mode==="test"){if(!t.dependencies)t.dependencies={};t.dependencies.core_test="~"}j("register",arguments);return this},module:function(w,t){if(w.match(/\:tiki$/))this.tikiFactory=t;j("module",arguments);return this},start:function(){var w={};this.tikiFactory(null,w,null);w=w.Browser.start(this.ENV, this.ARGS,x);x=null;return w}};if("undefined"!==typeof ENV)E.ENV=ENV;if("undefined"!==typeof ARGV)E.ARGS=ARGV;if("undefined"!==typeof ARGS)E.ARGS=ARGS;return E}();y.register("::tiki/1.0.0",{name:"tiki",version:"1.0.0"});y.module("::tiki/1.0.0:tiki",function(j,x){var E=/^::/,w=function(a){return!!E.exec(a)},t=function(){x.debug.apply(this,arguments)};x.debug=function(){var a=Array.prototype.join.call(arguments,"");j("sys").debug(a)};var h;h=Array.isArray?Array.isArray:function(a){if("object"!==typeof a)return false; if(a instanceof Array)return true;return a.constructor&&a.constructor.name==="Array"};x.isArray=h;var o;if(Object.create)o=Object.create;else{var s=function(){},C=s.prototype;o=function(a){if(!a)a=Object.prototype;s.prototype=a;var b=new s;b.prototype=a;s.prototype=C;return b}}x.createObject=o;var v,B,F;v=function(){return function(){return this.init?this.init.apply(this,arguments):this}};B=function(){return F(this)};F=function(a){var b=v();b.prototype=o(a.prototype);b.prototype.constructor=b;b.super_= a;b.extend=B;return b};x.extend=F;var f=function(a,b){if(b&&!b.displayName)b.displayName="parallel#fn";return function(c){if(a.length===0)return c(null,[]);var d=a.length,l=d,m=false,z,D=function(H){if(!m){if(H){m=true;return c(H)}--l<=0&&c()}};D.displayName="parallel#tail";for(z=0;z=48&&d<=57},c=function(d,l){for(var m=0,z=0,D=0,H,M;;z++,D++){H=d.charAt(z);M=l.charAt(D);if(!b(H)&&!b(M))return m;else if(b(H))if(b(M)){if(HM)if(m===0)m=+1;else if(H===0&&M===0)return m}else return+1;else return-1}};return function(d,l){for(var m=0,z=0,D=0,H=0,M,O,W;;){D=H=0;M=d.charAt(m);for(O= l.charAt(z);a(M)||M=="0";){if(M=="0")D++;else D=0;M=d.charAt(++m)}for(;a(O)||O=="0";){if(O=="0")H++;else H=0;O=l.charAt(++z)}if(b(M)&&b(O))if((W=c(d.substring(m),l.substring(z)))!==0)return W;if(M===0&&O===0)return D-H;if(MO)return+1;++m;++z}}}();x.natcompare=L;var I=function(a){return new Error(""+a+" is an invalid version string")};I.displayName="invalidVers";var N=function(a,b,c,d){c=Number(c);d=Number(d);if(isNaN(c))throw I(a);if(isNaN(d))throw I(b);return c-d};N.displayName= "compareNum";var i,J={parse:function(a){a=a.match(/^(=|~)?([\d]+?)(\.([\d]+?)(\.(.+))?)?$/);if(!a)return null;return[a,a[2],a[4]||"0",a[6]||"0",a[1]]},major:function(a){return Number(i(a)[1])},minor:function(a){return Number(i(a)[2])},patch:function(a){a=i(a)[3];return isNaN(Number(a))?a:Number(a)},STRICT:"strict",NORMAL:"normal",mode:function(a){return i(a)[4]==="="?J.STRICT:J.NORMAL},comparePatch:function(a,b){var c,d;if(a===b)return 0;c=Number(a);d=Number(b);return isNaN(c)?isNaN(d)?L(a,b):-1: isNaN(d)?1:cd?1:0},compare:function(a,b){var c;if(a===b)return 0;if(a)a=i(a);if(b)b=i(b);if(!a&&!b)return 0;if(!a)return-1;if(!b)return 1;c=N(a[0],b[0],a[1],b[1]);if(c===0){c=N(a[0],b[0],a[2],b[2]);if(c===0)c=J.comparePatch(a[3],b[3])}return c<0?-1:c>0?1:0},compatible:function(a,b){if(!a)return true;if(a===b)return true;if(a&&!i(a))a=null;if(b&&!i(b))b=null;if(!a)return true;if(a===b)return true;if(J.mode(a)===J.STRICT)return b&&J.compare(a,b)===0;else{if(!b)return true;if(J.major(a)!==J.major(b))return false; return J.compare(a,b)<=0}},normalize:function(a){var b;if(!a||a.length===0)return null;a=J.parse(a);if(!a)return null;b=Number(a[3]);if(isNaN(b))b=a[3];return[Number(a[1]),Number(a[2]),b].join(".")}};x.semver=J;i=J.parse;var U=x.extend(Object);x.Factory=U;U.prototype.init=function(a,b,c){this.id=a;this.pkg=b;this.factory=c};U.prototype.call=function(a,b){var c=this.factory,d=this.__filename,l=this.__dirname;if("string"===typeof c)c=this.factory=U.compile(c,this.pkg.id+":"+this.id);a=a.createRequire(b); var m=b.exports;c.call(m,a,m,b,d,l);return b.exports};var R=["(function(require, exports, module) {",null,"\n});\n//@ sourceURL=",null,"\n"];U.compile=function(a,b){R[1]=a;R[3]=b||"(unknown module)";a=R.join("");a=eval(a);R[1]=R[3]=null;return a};x.Factory=U;var S=x.extend(Object);x.Module=S;S.prototype.init=function(a,b,c){this.id=a;this.ownerPackage=b;this.exports={};var d=this;this.resource=function(l){return c.resource(l,d.id,b)}};var Q=x.extend(Object);x.Package=Q;Q.prototype.init=function(a, b){w(a)||(a="::"+a);this.id=a;this.config=b;this.isReady=true};Q.prototype.get=function(a){return this.config?this.config[a]:undefined};Q.prototype.set=function(a,b){if(!this.config)this.config={};this.config[a]=b;return this};Q.prototype.requiredVersion=function(a){var b=this.get("dependencies");return b?b[a]:null};Q.prototype.canonicalPackageId=function(a,b){if(a===this.get("name")&&J.compatible(b,this.get("version")))return this.id;return null};Q.prototype.packageFor=function(a){if(a===this.id)return this; return null};Q.prototype.ensurePackage=function(a,b){return a===this.id?b():b(new u(a,this))};Q.prototype.catalogPackages=function(){return[this]};Q.prototype.exists=function(a){return!!(this.factories&&this.factories[a])};Q.prototype.load=function(a){return this.factories?this.factories[a]:null};var e=function(a,b){return a+":"+b},k=x.extend(Object);x.Loader=k;k.prototype.init=function(a){this.sources=a||[];this.clear()};k.prototype.clear=function(){this.factories={};this.canonicalIds={};this.packages= {};this.packageSources={};this.canonicalPackageIds={}};k.prototype.defaultPackage=new Q("default",{name:"default"});k.prototype.anonymousPackage=new Q("(anonymous)",{name:"(anonymous)"});k.prototype.canonical=function(a,b,c){var d,l,m,z;if(b&&"string"!==typeof b){c=b;b=null}if(w(a))return a;if(!c)c=this.anonymousPackage;a=this._resolve(a,b,c);if(w(a))return a;d=c?c.id:"(null)";b=this.canonicalIds;if(!b)b=this.canonicalIds={};b[d]||(b[d]={});b=b[d];if(b[a])return b[a];d=a;l=a.indexOf(":");if(l>=0){m= a.slice(0,l);a=a.slice(l+1);if(a[0]==="/")throw new Error("Absolute path not allowed with packageId");}l=null;if(m&&m.length>0){if(m=this._canonicalPackageId(m,null,c))l=e(m,a)}else{if(c&&c.exists(a))l=e(c.id,a);else{if(m=this._canonicalPackageId(a,null,c))z=this._packageFor(m,c);if(z)if(z.exists("index"))l=e(z.id,"index");else if(z.exists(a))l=e(z.id,a)}if(!l){if(this.defaultPackage)m=this.defaultPackage.id;else if(this.workingPackage)m=this.workingPackage.id;else if(this.anonymousPackage)m=this.anonymousPackage.id; else return null;if(m)l=e(m,a)}}return b[d]=l};k.prototype.load=function(a,b,c){var d,l,m;if(!b)b=this.anonymousPackage;d=this.factories;if(!d)d=this.factories={};if(d[a])return d[a];l=a.indexOf(":",2);m=a.slice(0,l);l=a.slice(l+1);(b=this._packageFor(m,b))||t("Loader#load - "+m+" not found for "+l);if(!b)return null;c=b.load(l,c);return d[a]=c};k.prototype.catalogPackages=function(a){if(!a)a=this.anonymousPackage;var b=[],c,d,l={};this.defaultPackage&&b.push(this.defaultPackage);var m=function(z){var D, H,M,O;if(z){H=z.length;for(D=0;D=0)a=a.slice(0,d);return a}if(b&&"string"!==typeof b){c=b;b=null}if(!c)c=this.anonymousPackage;d=a.indexOf(":");if(d>=0)a= a.slice(0,d);return this._canonicalPackageId(a,b,c)};k.prototype.packageFor=function(a,b){if(!b)b=this.anonymousPackage;var c=a.indexOf(":",2);if(c>=0)a=a.slice(0,c);return this._packageFor(a,b)};k.prototype.ready=function(a,b){if(!b)b=this.anonymousPackage;var c=a.indexOf(":",2),d;if(c>=0){d=a.slice(c+1);a=a.slice(0,c)}if(this._packageReady(a,b,{})){a=this._packageFor(a,b);if(!a)return false;return!!a.exists(d)}else return false};k.prototype.ensurePackage=function(a,b,c,d){if(b&&"string"!==typeof b){d= c;c=b;b=null}if(c&&"function"===typeof c){d=c;c=null}if(!c)c=this.anonymousPackage;this._ensurePackage(a,b,c,{},d)};k.prototype._ensurePackage=function(a,b,c,d,l){var m=this,z;z=this._canonicalPackageId(a,b,c);if(!z)return l(new u(a,c));if(d[z])return l();d[z]=true;a=this._sourceForCanonicalPackageId(z,c);if(!a)return l(new u(z,c));a.ensurePackage(z,function(D){var H,M,O;if(D)return l(D);H=m.packageFor(z,c);if(!H)return l(new u(z,c));D=H.get("dependencies");if(!D)return l();O=[];for(M in D)D.hasOwnProperty(M)&& O.push({packageId:M,vers:D[M]});f(O,function(W,V){m._ensurePackage(W.packageId,W.vers,H,d,V)})(l)})};k.prototype._canonicalPackageId=function(a,b,c){if(a instanceof Q)return a.id;if(w(a))return a;if(a==="default"&&this.defaultPackage)return this.defaultPackage.id;var d=this.canonicalPackageIds,l,m,z,D,H;if(!c)c=this.anonymousPackage;if(!c)throw new Error("working package is required");b||(b=c.requiredVersion(a));l=c.id;if(!d)d=this.canonicalPackageIds={};d[l]||(d[l]={});d=d[l];d[a]||(d[a]={});d=d[a]; if(d[b])return d[b];l=this.sources;m=c.canonicalPackageId(a,b);H=c;if(!m)if(m=c.canonicalPackageId(a,null))throw new Error(c.get("name")+" contains an incompatible nested package "+a+" (expected: "+b+")");if(!m&&l){D=l.length;for(z=0;!m&&z=0){z=a.slice(0, d);a=a.slice(d+1);b=[]}else if(a.match(/^\.\.?\//)){if(!b)throw new Error("id required to resolve relative id: "+a);if(b.indexOf(":")>=0)throw new Error("current moduleId cannot contain packageId");if(c)z=c.id;b=b.split("/");b.pop()}else b=[];m=a.split("/");c=m.length;for(d=0;d=0)c[l]=c[l].slice(0,m).concat(c[l].slice(m+1));c[l].push(b)}}return this};q.prototype.module=function(a,b){w(a)||(a="::"+a);this.factories[a]=b;return this};q.prototype.script=function(a){w(a)||(a="::"+a);this._resolve(this.scriptActions,a,true)};q.prototype.stylesheet= function(a){w(a)||(a="::"+a);this._resolve(this.stylesheetActions,a,true)};var P="undefined"!==typeof document&&document.createElement,X="undefined"!==typeof XMLHttpRequest;q.prototype.xhr=!P;q.prototype.autowrap=false;var Z=function(a){if(!a)return null;for(var b=a.length;--b>=0;)if(!a[b]["tiki:private"])return a[b];return null};q.prototype.canonicalPackageId=function(a,b){a=this.packageInfoByName[a];var c,d,l;if(b)b=J.normalize(b);if(!a)return null;if(a[b]&&a[b].length===1)return a[b][0].id;for(d in a)if(a.hasOwnProperty(d))if(J.compatible(b, d))if(!c||J.compare(l,d)<0)if(c=Z(a[d]))l=d;return c?c.id:null};q.prototype.packageFor=function(a){var b=this.packages[a];if(b)return b;if((b=this.packageInfoById[a])&&!b["tiki:external"]){b=new this.Package(a,b,this);return this.packages[a]=b}return null};q.prototype.ensurePackage=function(a,b){var c=this.ensureActions[a];if(c)return c(b);var d=this.packageInfoById[a];if(!d)return b(new u(a,"browser package info"));var l=this;c=n(function(m){var z=1,D=false,H,M=function(Y){if(!H){if(Y){H=true;return m(Y)}z-= 1;if(z<=0&&D)return m(null,d)}},O=d.dependencies,W=d["tiki:nested"],V,T;for(V in O)if(O.hasOwnProperty(V)){T=W[V];if(!T){T=O[V];T=l.canonicalPackageId(V,T)}if(T&&l.packageInfoById[a]){z++;l.ensurePackage(T,M)}}W=(O=d["tiki:resources"])?O.length:0;for(V=0;V=0;){var J=L[I];if(i.exec(J))g.push(J);else for(var U=N.length;--U>=0;)if(N[U].exec(J)){g.push(J);break}}g.forEach(function(R){delete A.exports[R];delete A.modules[R];delete A.usedExports[R]});g=function(){this.catalog.loadPlugin(this.name).then(function(){for(u in n)this.catalog.plugins[u].register();for(u in n)if(n[u].callPointer){var R=C(u,n[u].callPointer);(R=v(R))&&R(p)}f&&f()}.bind(this))}.bind(this);L=function(){t.error("Failed to load metadata from "+ this.reloadURL)}.bind(this);this.catalog.loadMetadataFromURL(this.reloadURL).then(g,L)}}};var B=function(f,g,n){g=g.split(".");f=f;var p=g.length-1;if(p>0)for(var u=0;u1){u.reject(new Error("For object "+f+", create a simple factory function and change the action to call because JS cannot handle this case."));return}N=new N(A[0])}else if(i==="value")N=N;else{u.reject(new Error("Create action must be call|new|value. Found"+i));return}this.instances[f]=N;u.resolve(N)}.bind(this))}.bind(this)); return u},getObject:function(f){return this.instances[f]||(this.parent?this.parent.getObject(f):undefined)},getExtensionPoint:function(f,g){if(g&&this.points[f]===undefined)this.points[f]=new j.ExtensionPoint(f,this);return this.points[f]},getExtensions:function(f){f=this.getExtensionPoint(f);if(f===undefined)return[];return f.extensions},orderExtensions:function(f){f=f||this._extensionsOrdering;for(name in this.points)this.points[name].orderExtensions(f);this._extensionsOrdering=f},getExtensionsOrdering:function(){return this._extensionsOrdering}, getExtensionByKey:function(f,g){f=this.getExtensionPoint(f);if(f!==undefined)return f.getByKey(g)},_toposort:function(f){var g=[],n={},p=function(A){if(!(A in n||!(A in f))){n[A]=true;var L=f[A].dependencies;if(!h.none(L))for(var I in L)p(I);g.push(A)}};for(var u in f)p(u);return g},registerMetadata:function(f){if(this.parent)this.parent.registerMetadata(f);else{for(var g in f){var n=f[g];if(n.errors){t.error("Plugin ",g," has errors:");n.errors.forEach(function(p){t.error(p)});delete f[g]}else{if(n.dependencies)n.depends= Object.keys(n.dependencies);n.name=g;n.version=null;s.canonicalPackageId(g)===null&&s.register("::"+g,n)}}h.mixin(this.metadata,h.clone(f,true));this.children.forEach(function(p){p._registerMetadata(h.clone(f,true))});this._registerMetadata(h.clone(f,true))}},_registerMetadata:function(f){var g,n=this.plugins;this._toposort(f).forEach(function(p){if(this.plugins[p])if(this.isPluginLoaded(p))return;else{var u=this.plugins[p];u.unregister()}var A=f[p],L=!this.deactivatedPlugins[p];if(L&&A.depends&& A.depends.length!=0)if(!A.depends.some(function(i){return!this.deactivatedPlugins[i]},this)){this.deactivatedPlugins[p]="DEPENDS";L=false}A.catalog=this;A.name=p;u=new j.Plugin(A);n[p]=u;if(A.provides){u=A.provides;for(A=0;An)p=n;u=f.slice(u,p);g=g[u];u=p+1}if(u0;)f.exec(n[p])&& delete g[n[p]]};j.getUserPlugins=function(){return j.catalog.getPlugins({onlyType:"user"})}}); bespin.tiki.module("bespin:promise",function(y,j){var x=y("bespin:console").console;y("bespin:util/stacktrace");var E=0;j._outstanding=[];j._recent=[];j.Promise=function(){this._status=0;this._value=undefined;this._onSuccessHandlers=[];this._onErrorHandlers=[];this._id=E++;j._outstanding[this._id]=this};j.Promise.prototype.isPromise=true;j.Promise.prototype.isComplete=function(){return this._status!=0};j.Promise.prototype.isResolved=function(){return this._status==1};j.Promise.prototype.isRejected= function(){return this._status==-1};j.Promise.prototype.then=function(w,t){if(typeof w==="function")if(this._status===1)w.call(null,this._value);else this._status===0&&this._onSuccessHandlers.push(w);if(typeof t==="function")if(this._status===-1)t.call(null,this._value);else this._status===0&&this._onErrorHandlers.push(t);return this};j.Promise.prototype.chainPromise=function(w){var t=new j.Promise;t._chainedFrom=this;this.then(function(h){try{t.resolve(w(h))}catch(o){t.reject(o)}},function(h){t.reject(h)}); return t};j.Promise.prototype.resolve=function(w){return this._complete(this._onSuccessHandlers,1,w,"resolve")};j.Promise.prototype.reject=function(w){return this._complete(this._onErrorHandlers,-1,w,"reject")};j.Promise.prototype._complete=function(w,t,h,o){if(this._status!=0){x.group("Promise already closed");x.error("Attempted "+o+"() with ",h);x.error("Previous status = ",this._status,", previous value = ",this._value);x.trace();if(this._completeTrace){x.error("Trace of previous completion:"); this._completeTrace.log(5)}x.groupEnd();return this}this._status=t;this._value=h;w.forEach(function(s){s.call(null,this._value)},this);this._onSuccessHandlers.length=0;this._onErrorHandlers.length=0;delete j._outstanding[this._id];for(j._recent.push(this);j._recent.length>20;)j._recent.shift();return this};j.group=function(w){w instanceof Array||(w=Array.prototype.slice.call(arguments));if(w.length===0)return(new j.Promise).resolve([]);var t=new j.Promise,h=[],o=0,s=function(C){return function(v){h[C]= v;o++;t._status!==-1&&o===w.length&&t.resolve(h)}};w.forEach(function(C,v){v=s(v);var B=t.reject.bind(t);C.then(v,B)});return t}}); bespin.tiki.module("bespin:proxy",function(y,j){y("util/util");var x=y("promise").Promise;j.xhr=function(E,w,t,h){var o=new x;if(!bespin.proxy||!bespin.proxy.xhr){var s=new XMLHttpRequest;s.onreadystatechange=function(){if(s.readyState===4){var C=s.status;if(C!==0&&C!==200){C=new Error(s.responseText+" (Status "+s.status+")");C.xhr=s;o.reject(C)}else o.resolve(s.responseText)}}.bind(this);s.open("GET",w,t);h&&h(s);s.send()}else bespin.proxy.xhr.call(this,E,w,t,h,o);return o};j.Worker=function(E){return!bespin.proxy|| !bespin.proxy.worker?new Worker(E):new bespin.proxy.worker(E)}}); bespin.tiki.module("bespin:sandbox",function(y,j){var x=y("tiki"),E=y("bespin:util/util"),w=y("bespin:plugins").catalog;if(w.parent)throw new Error("The sandbox module can't be used inside of a slave catalog!");y=function(){x.Sandbox.call(this,bespin.tiki.require.loader,{},[]);var t=this.require("bespin:plugins").catalog;t.parent=w;w.children.push(t);t.deactivatePlugin=E.clone(w.deactivatePlugin);t._extensionsOrdering=E.clone(w._extensionsOrdering);t._registerMetadata(E.clone(w.metadata,true))};y.prototype= new x.Sandbox;y.prototype.require=function(t,h,o){var s=this.loader.canonical(t,h,o).substring(2).split(":")[0];return w.plugins[s].share?bespin.tiki.sandbox.require(t,h,o):x.Sandbox.prototype.require.call(this,t,h,o)};j.Sandbox=y}); bespin.tiki.module("bespin:util/cookie",function(y,j){var x=function(E,w){return E.replace(/([\.$?*|{}\(\)\[\]\\\/\+^])/g,function(t){if(w&&w.indexOf(t)!=-1)return t;return"\\"+t})};j.get=function(E){E=new RegExp("(?:^|; )"+x(E)+"=([^;]*)");return(E=document.cookie.match(E))?decodeURIComponent(E[1]):undefined};j.set=function(E,w,t){t=t||{};if(typeof t.expires=="number"){var h=new Date;h.setTime(h.getTime()+t.expires*24*60*60*1E3);t.expires=h}if(t.expires&&t.expires.toUTCString)t.expires=t.expires.toUTCString(); w=encodeURIComponent(w);E=E+"="+w;var o;for(o in t){E+="; "+o;w=t[o];if(w!==true)E+="="+w}document.cookie=E};j.remove=function(E){j.set(E,"",{expires:-1})};j.isSupported=function(){if(!("cookieEnabled"in navigator)){j.set("__djCookieTest__","CookiesAllowed");navigator.cookieEnabled=j.get("__djCookieTest__")=="CookiesAllowed";navigator.cookieEnabled&&j.remove("__djCookieTest__")}return navigator.cookieEnabled}}); bespin.tiki.module("bespin:util/scratchcanvas",function(y,j){var x=y("bespin:util/util"),E=function(){this._canvas=document.getElementById("bespin-scratch-canvas");if(x.none(this._canvas)){this._canvas=document.createElement("canvas");this._canvas.id="bespin-scratch-canvas";this._canvas.width=400;this._canvas.height=300;this._canvas.style.position="absolute";this._canvas.style.top="-10000px";this._canvas.style.left="-10000px";document.body.appendChild(this._canvas)}};E.prototype.getContext=function(){return this._canvas.getContext("2d")}; E.prototype.measureStringWidth=function(t,h){if(x.none(h))h="M";var o=this.getContext();o.save();o.font=t;t=o.measureText(h).width;o.restore();return t};var w=null;j.get=function(){if(w===null)w=new E;return w}}); bespin.tiki.module("bespin:util/stacktrace",function(y,j){function x(v){for(var B=0;B\s*\(/gm,"{anonymous}()@").split("\n")},firefox:function(v){var B=v.stack;if(!B){t.log(v);return[]}B=B.replace(/(?:\n@:0)?\s+$/m,"");B=B.replace(/^\(/gm,"{anonymous}(");return B.split("\n")},opera:function(v){v=v.message.split("\n"); var B=/Line\s+(\d+).*?script\s+(http\S+)(?:.*?in\s+function\s+(\S+))?/i,F,f,g;F=4;f=0;for(g=v.length;F-1};j.indexOfProperty=function(h,o,s){for(var C=0;C=0;j.isWindows=w.indexOf("Win")>=0;j.isWebKit=parseFloat(y.split("WebKit/")[1])|| undefined;j.isChrome=parseFloat(y.split("Chrome/")[1])||undefined;j.isMac=w.indexOf("Macintosh")>=0;j.isMozilla=w.indexOf("Gecko/")>=0;if(y.indexOf("AdobeAIR")>=0)j.isAIR=1;var t=Math.max(w.indexOf("WebKit"),w.indexOf("Safari"),0);if(t&&!j.isChrome){j.isSafari=parseFloat(w.split("Version/")[1]);if(!j.isSafari||parseFloat(w.substr(t+7))<=419.3)j.isSafari=2}if(y.indexOf("Gecko")>=0&&!j.isWebKit)j.isMozilla=parseFloat(w);j.getOS=function(){return j.isMac?j.OS.MAC:j.isLinux?j.OS.LINUX:j.OS.WINDOWS};j.contains= typeof document!=="undefined"&&document.compareDocumentPosition?function(h,o){return h.compareDocumentPosition(o)&16}:function(h,o){return h!==o&&(h.contains?h.contains(o):true)};j.stopEvent=function(h){h.preventDefault();h.stopPropagation()};j.randomPassword=function(h){h=h||16;for(var o="",s=0;ss)return false;if(h.x!=o.x&&Math.abs(h.x-o.x)>s)return false; if(h.width!=o.width&&Math.abs(h.width-o.width)>s)return false;if(h.height!=o.height&&Math.abs(h.height-o.height)>s)return false;return true}});bespin.tiki.register("::syntax_directory",{name:"syntax_directory",dependencies:{}}); bespin.tiki.module("syntax_directory:index",function(y,j){function x(t){this.extension=t;this.name=t.name;this.fileExts=t.hasOwnProperty("fileexts")?t.fileexts:[]}function E(t){w.register(t)}y("bespin:plugins");var w={_fileExts:{},_syntaxInfo:{},get:function(t){return this._syntaxInfo[t]},hasSyntax:function(t){return this._syntaxInfo.hasOwnProperty(t)},register:function(t){var h=new x(t);this._syntaxInfo[h.name]=h;var o=this._fileExts;h.fileExts.forEach(function(s){o[s]=h.name})},syntaxForFileExt:function(t){t= t.toLowerCase();var h=this._fileExts;return h.hasOwnProperty(t)?h[t]:"plain"}};j.syntaxDirectory=w;j.discoveredNewSyntax=E});bespin.tiki.register("::underscore",{name:"underscore",dependencies:{}}); bespin.tiki.module("underscore:index",function(y,j){(function(){var x=this,E=x._,w=typeof StopIteration!=="undefined"?StopIteration:"__break__",t=function(e){return e.replace(/([.*+?^${}()|[\]\/\\])/g,"\\$1")},h=Array.prototype,o=Object.prototype,s=h.slice,C=h.unshift,v=o.toString,B=o.hasOwnProperty,F=h.forEach,f=h.map,g=h.reduce,n=h.reduceRight,p=h.filter,u=h.every,A=h.some,L=h.indexOf,I=h.lastIndexOf;o=Array.isArray;var N=Object.keys,i=function(e){return new R(e)};if(typeof j!=="undefined")j._= i;x._=i;i.VERSION="1.0.2";var J=i.forEach=function(e,k,r){try{if(F&&e.forEach===F)e.forEach(k,r);else if(i.isNumber(e.length))for(var q=0,G=e.length;q=q.computed&&(q={value:G,computed:K})});return q.value};i.min=function(e,k,r){if(!k&&i.isArray(e))return Math.min.apply(Math,e);var q={computed:Infinity};J(e,function(G,K,P){K=k?k.call(r,G,K,P):G;KG?1:0}),"value")};i.sortedIndex=function(e,k,r){r=r||i.identity;for(var q=0,G=e.length;q>1;r(e[K])=0})})};i.zip=function(){for(var e=i.toArray(arguments),k=i.max(i.pluck(e,"length")),r=new Array(k),q=0;q0?G-k:k-G)>=0)return q;q[K++]=G}};i.bind=function(e,k){var r=i.rest(arguments,2);return function(){return e.apply(k||{},r.concat(i.toArray(arguments)))}};i.bindAll=function(e){var k=i.rest(arguments);if(k.length==0)k=i.functions(e); J(k,function(r){e[r]=i.bind(e[r],e)});return e};i.delay=function(e,k){var r=i.rest(arguments,2);return setTimeout(function(){return e.apply(e,r)},k)};i.defer=function(e){return i.delay.apply(i,[e,1].concat(i.rest(arguments)))};i.wrap=function(e,k){return function(){var r=[e].concat(i.toArray(arguments));return k.apply(k,r)}};i.compose=function(){var e=i.toArray(arguments);return function(){for(var k=i.toArray(arguments),r=e.length-1;r>=0;r--)k=[e[r].apply(this,k)];return k[0]}};i.keys=N||function(e){if(i.isArray(e))return i.range(0, e.length);var k=[];for(var r in e)B.call(e,r)&&k.push(r);return k};i.values=function(e){return i.map(e,i.identity)};i.functions=function(e){return i.filter(i.keys(e),function(k){return i.isFunction(e[k])}).sort()};i.extend=function(e){J(i.rest(arguments),function(k){for(var r in k)e[r]=k[r]});return e};i.clone=function(e){if(i.isArray(e))return e.slice(0);return i.extend({},e)};i.tap=function(e,k){k(e);return e};i.isEqual=function(e,k){if(e===k)return true;var r=typeof e;if(r!=typeof k)return false; if(e==k)return true;if(!e&&k||e&&!k)return false;if(e.isEqual)return e.isEqual(k);if(i.isDate(e)&&i.isDate(k))return e.getTime()===k.getTime();if(i.isNaN(e)&&i.isNaN(k))return true;if(i.isRegExp(e)&&i.isRegExp(k))return e.source===k.source&&e.global===k.global&&e.ignoreCase===k.ignoreCase&&e.multiline===k.multiline;if(r!=="object")return false;if(e.length&&e.length!==k.length)return false;r=i.keys(e);var q=i.keys(k);if(r.length!=q.length)return false;for(var G in e)if(!(G in k)||!i.isEqual(e[G],k[G]))return false; return true};i.isEmpty=function(e){if(i.isArray(e)||i.isString(e))return e.length===0;for(var k in e)if(B.call(e,k))return false;return true};i.isElement=function(e){return!!(e&&e.nodeType==1)};i.isArray=o||function(e){return!!(e&&e.concat&&e.unshift&&!e.callee)};i.isArguments=function(e){return e&&e.callee};i.isFunction=function(e){return!!(e&&e.constructor&&e.call&&e.apply)};i.isString=function(e){return!!(e===""||e&&e.charCodeAt&&e.substr)};i.isNumber=function(e){return e===+e||v.call(e)==="[object Number]"}; i.isBoolean=function(e){return e===true||e===false};i.isDate=function(e){return!!(e&&e.getTimezoneOffset&&e.setUTCFullYear)};i.isRegExp=function(e){return!!(e&&e.test&&e.exec&&(e.ignoreCase||e.ignoreCase===false))};i.isNaN=function(e){return i.isNumber(e)&&isNaN(e)};i.isNull=function(e){return e===null};i.isUndefined=function(e){return typeof e=="undefined"};i.noConflict=function(){x._=E;return this};i.identity=function(e){return e};i.times=function(e,k,r){for(var q=0;q",interpolate:/<%=(.+?)%>/g};i.template=function(e,k){var r=i.templateSettings,q=new RegExp("'(?=[^"+r.end.substr(0,1)+"]*"+t(r.end)+")","g");e=new Function("obj","var p=[],print=function(){p.push.apply(p,arguments);};with(obj){p.push('"+e.replace(/[\r\t\n]/g," ").replace(q,"\t").split("'").join("\\'").split("\t").join("'").replace(r.interpolate, "',$1,'").split(r.start).join("');").split(r.end).join("p.push('")+"');}return p.join('');");return k?e(k):e};i.each=i.forEach;i.foldl=i.inject=i.reduce;i.foldr=i.reduceRight;i.select=i.filter;i.all=i.every;i.any=i.some;i.head=i.first;i.tail=i.rest;i.methods=i.functions;var R=function(e){this._wrapped=e},S=function(e,k){return k?i(e).chain():e},Q=function(e,k){R.prototype[e]=function(){var r=i.toArray(arguments);C.call(r,this._wrapped);return S(k.apply(i,r),this._chain)}};i.mixin(i);J(["pop","push", "reverse","shift","sort","splice","unshift"],function(e){var k=h[e];R.prototype[e]=function(){k.apply(this._wrapped,arguments);return S(this._wrapped,this._chain)}});J(["concat","join","slice"],function(e){var k=h[e];R.prototype[e]=function(){return S(k.apply(this._wrapped,arguments),this._chain)}});R.prototype.chain=function(){this._chain=true;return this};R.prototype.value=function(){return this._wrapped}})();j._.noConflict()}); bespin.tiki.require("bespin:plugins").catalog.registerMetadata({bespin:{testmodules:[],resourceURL:"resources/bespin/",name:"bespin",environments:{main:true,worker:true},type:"plugins/boot"},syntax_directory:{resourceURL:"resources/syntax_directory/",name:"syntax_directory",environments:{main:true,worker:true},dependencies:{},testmodules:[],provides:[{register:"#discoveredNewSyntax",ep:"extensionhandler",name:"syntax"}],type:"plugins/supported",description:"Catalogs the available syntax engines"}, underscore:{testmodules:[],type:"plugins/thirdparty",resourceURL:"resources/underscore/",description:"Functional Programming Aid for Javascript. Works well with jQuery.",name:"underscore"}});typeof window==="undefined"?importScripts("BespinWorker.js"):function(){var y=document.createElement("script");y.setAttribute("src",bespin.base+"BespinMain.js");document.getElementsByTagName("head")[0].appendChild(y)}();