File Manager

Current Directory: /home/astoriaah/www/old15/plugins/editors/rokpad/assets/js
Viewing File: /home/astoriaah/www/old15/plugins/editors/rokpad/assets/js/rokpad.js
/* * @author RocketTheme http://www.rockettheme.com * @copyright Copyright (C) 2007 - 2014 RocketTheme, LLC * @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 only */ (function(c){var a={},b=function(f){var e=a[f];if(!e){e=a[f]={};var d=e.exports={};c[f].call(d,b,e,d,window);}return e.exports;};window.moofx=b("0");})({"0":function(c,e,b,f){var a=c("1"),g=c("2"); var d=typeof document!=="undefined"?c("7"):c("b");d.requestFrame=function(h){g.request(h);return this;};d.cancelFrame=function(h){g.cancel(h);return this; };d.color=a;e.exports=d;},"1":function(k,e,y,s){var m={maroon:"#800000",red:"#ff0000",orange:"#ffA500",yellow:"#ffff00",olive:"#808000",purple:"#800080",fuchsia:"#ff00ff",white:"#ffffff",lime:"#00ff00",green:"#008000",navy:"#000080",blue:"#0000ff",aqua:"#00ffff",teal:"#008080",black:"#000000",silver:"#c0c0c0",gray:"#808080",transparent:"#0000"}; var d=function(B,A,c,z){if(z==null||z===""){z=1;}B=parseFloat(B);A=parseFloat(A);c=parseFloat(c);z=parseFloat(z);if(!(B<=255&&B>=0&&A<=255&&A>=0&&c<=255&&c>=0&&z<=1&&z>=0)){return null; }return[Math.round(B),Math.round(A),Math.round(c),z];};var x=function(F){if(F.length===3){F+="f";}if(F.length===4){var E=F.charAt(0),D=F.charAt(1),B=F.charAt(2),z=F.charAt(3); F=E+E+D+D+B+B+z+z;}if(F.length===6){F+="ff";}var A=[];for(var C=0,c=F.length;C<c;C+=2){A.push(parseInt(F.substr(C,2),16)/(C===6?255:1));}return A;};var n=function(A,z,c){if(c<0){c+=1; }if(c>1){c-=1;}if(c<1/6){return A+(z-A)*6*c;}if(c<1/2){return z;}if(c<2/3){return A+(z-A)*(2/3-c)*6;}return A;};var a=function(C,G,B,F){var c,E,D;if(F==null||F===""){F=1; }C=parseFloat(C)/360;G=parseFloat(G)/100;B=parseFloat(B)/100;F=parseFloat(F)/1;if(C>1||C<0||G>1||G<0||B>1||B<0||F>1||F<0){return null;}if(G===0){c=E=D=B; }else{var z=B<0.5?B*(1+G):B+G-B*G;var A=2*B-z;c=n(A,z,C+1/3);D=n(A,z,C);E=n(A,z,C-1/3);}return[c*255,D*255,E*255,F];};var r=[];for(var v in m){r.push(v); }var o="(?:#([a-f0-9]{3,8}))",f="\\s*([.\\d%]+)\\s*",b="(?:,\\s*([.\\d]+)\\s*)?",u="\\("+[f,f,f]+b+"\\)",g="(?:rgb)a?",q="(?:hsl)a?",p="("+r.join("|")+")"; var h=RegExp(o,"i"),w=RegExp(g+u,"i"),j=RegExp(q+u,"i");var t=function(c,A){if(c==null){return null;}c=(c+"").replace(/\s+/,"");var z=m[c];if(z){return t(z,A); }else{if(z=c.match(h)){c=x(z[1]);}else{if(z=c.match(w)){c=z.slice(1);}else{if(z=c.match(j)){c=a.apply(null,z.slice(1));}else{return null;}}}}if(!(c&&(c=d.apply(null,c)))){return null; }if(A){return c;}if(c[3]===1){c.splice(3,1);}return"rgb"+(c.length===4?"a":"")+"("+c+")";};t.x=RegExp([p,o,g+u,q+u].join("|"),"gi");e.exports=t;},"2":function(c,b,f,a){var h=c("3"); var d=a.requestAnimationFrame||a.webkitRequestAnimationFrame||a.mozRequestAnimationFrame||a.oRequestAnimationFrame||a.msRequestAnimationFrame||function(m){return setTimeout(m,1000/60); };var j=[];var g=function(p){var o=j.splice(0,j.length);for(var n=0,m=o.length;n<m;n++){o[n](p||(p=+new Date()));}};var k=function(n){var m=h.indexOf(j,n); if(m>-1){j.splice(m,1);}};var e=function(n){var m=j.push(n);if(m===1){d(g);}return function(){k(n);};};f.request=e;f.cancel=k;},"3":function(f,e,h,c){var k=f("4")["array"]; var m=("pop,push,reverse,shift,sort,splice,unshift,concat,join,slice,toString,indexOf,lastIndexOf,forEach,every,some,filter,map,reduce,reduceRight").split(","); for(var g={},j=0,b,a;b=m[j++];){if(a=Array.prototype[b]){g[b]=a;}}if(!g.filter){g.filter=function(r,q){var p=[];for(var o=0,n=this.length>>>0;o<n;o++){if(o in this){var s=this[o]; if(r.call(q,s,o,this)){p.push(s);}}}return p;};}if(!g.indexOf){g.indexOf=function(p,q){for(var n=this.length>>>0,o=q<0?Math.max(0,n+q):q||0;o<n;o++){if(o in this&&this[o]===p){return o; }}return -1;};}if(!g.map){g.map=function(r,q){var s=this.length>>>0,p=Array(s);for(var o=0,n=s;o<n;o++){if(o in this){p[o]=r.call(q,this[o],o,this);}}return p; };}if(!g.every){g.every=function(q,p){for(var o=0,n=this.length>>>0;o<n;o++){if(o in this&&!q.call(p,this[o],o,this)){return false;}}return true;};}if(!g.some){g.some=function(q,p){for(var o=0,n=this.length>>>0; o<n;o++){if(o in this&&q.call(p,this[o],o,this)){return true;}}return false;};}if(!g.forEach){g.forEach=function(q,p){for(var o=0,n=this.length>>>0;o<n; o++){if(o in this){q.call(p,this[o],o,this);}}};}var d=Object.prototype.toString;k.isArray=Array.isArray||function(n){return d.call(n)==="[object Array]"; };e.exports=k.implement(g);},"4":function(d,c,e,b){var a=d("5"),j=d("6");var k=Array.prototype.slice;var n=a({constructor:function n(o){this.valueOf=function(){return o; };this.toString=function(){return o+"";};this.is=function(p){return o===p;};}});var h=function(o){if(o==null||o instanceof n){return o;}var p=h[j(o)];return p?new p(o):o; };var m=function(){var o=a({inherits:n});return a({constructor:function(p){return new o(p);},define:function(p,q){var r=q.value;this[p]=function(s){return arguments.length>1?r.apply(s,k.call(arguments,1)):r.call(s); };o.prototype[p]=function(){return h(r.apply(this.valueOf(),arguments));};a.define(this.prototype,p,q);return this;}});};for(var g="string,number,array,object,date,function,regexp".split(","),f=g.length; f--;){h[g[f]]=m();}c.exports=h;},"5":function(g,d,h,c){var r=function(e,s){return Object.hasOwnProperty.call(e,s);};var p=function(e,u,t){for(var s in e){if(u.call(t,e[s],s,e)===false){break; }}return e;};if(!{valueOf:0}.propertyIsEnumerable("valueOf")){var f="constructor,toString,valueOf,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString".split(","); var n=Object.prototype;p=function(e,w,u){for(var t in e){if(w.call(u,e[t],t,e)===false){return e;}}for(var s=0;t=f[s];s++){var v=e[t];if((v!==n[t]||r(e,t))&&w.call(u,v,t,e)===false){break; }}return e;};}var m=Object.create||function(e){var s=function(){};s.prototype=e;return new s();};var q=Object.getOwnPropertyDescriptor;var k=Object.defineProperty; try{var j={a:1};q(j,"a");k(j,"a",{value:2});}catch(o){q=function(e,s){return{value:e[s]};};k=function(e,s,t){e[s]=t.value;return e;};}var b=function(e){p(e,function(t,s){if(s!=="constructor"&&s!=="define"&&s!=="inherits"){this.define(s,q(e,s)||{writable:true,enumerable:true,configurable:true,value:t}); }},this);return this;};var a=function(s){var t=s.inherits;var e=r(s,"constructor")?s.constructor:t?function(){return t.apply(this,arguments);}:function(){}; if(t){var v=t.prototype;var u=e.prototype=m(v);e.parent=v;u.constructor=e;}e.define=s.define||t&&t.define||function(w,x){k(this.prototype,w,x);return this; };e.implement=b;return e.implement(s);};a.has=r;a.each=p;a.create=m;a.define=k;d.exports=a;},"6":function(b,d,a,f){var g=Object.prototype.toString,c=/number|object|array|string|function|date|regexp|boolean/; var e=function(j){if(j==null){return"null";}var h=g.call(j).slice(8,-1).toLowerCase();if(h==="number"&&isNaN(j)){return"null";}if(c.test(h)){return h;}return"object"; };d.exports=e;},"7":function(m,h,ag,d){var Q=m("1"),b=m("2");var af=b.cancel,Z=b.request;var G=m("5"),q=m("3"),B=m("8");var al=B.camelize,ac=B.clean,R=B.capitalize; var P=q.map,c=q.forEach,H=q.indexOf;var o=m("a");var J=m("b");var T={};var n=function(e){return T[e]||(T[e]=B.hyphenate(e));};var ai=function(e){return Math.round(e*1000)/1000; };var y=d.getComputedStyle?function(au){var e=getComputedStyle(au);return function(av){return e?e.getPropertyValue(n(av)):"";};}:function(au){var e=au.currentStyle; return function(av){return e?e[al(av)]:"";};};var u=document.createElement("div");var N="border:none;margin:none;padding:none;visibility:hidden;position:absolute;height:0;"; var aj=function(au,e){var aw=au.parentNode,av=1;if(aw){u.style.cssText=N+("width:100"+e+";");aw.appendChild(u);av=u.offsetWidth/100;aw.removeChild(u);}return av; };var K=function(e){var au=e.length;if(au===1){e.push(e[0],e[0],e[0]);}else{if(au===2){e.push(e[0],e[1]);}else{if(au===3){e.push(e[1]);}}}return e;};var s="([-.\\d]+)(%|cm|mm|in|px|pt|pc|em|ex|ch|rem|vw|vh|vm)",v=s+"?",am="none|hidden|dotted|dashed|solid|double|groove|ridge|inset|outset|inherit"; var f=RegExp(s,"g"),aq=RegExp(v),L=RegExp(v,"g"),E=RegExp(am);var X=function(e){return e==null?"":e+"";};var k=function(au,e){if(au==null||au===""){return e?"1":""; }return isFinite(au=+au)?au<0?"0":au+"":"1";};try{u.style.color="rgba(0,0,0,0.5)";}catch(ao){}var ah=/^rgba/.test(u.style.color);var x=function(au,e){var ax="rgba(0,0,0,1)",aw; if(!au||!(aw=Q(au,true))){return e?ax:"";}if(e){return"rgba("+aw+")";}var av=aw[3];if(av===0){return"transparent";}return !ah||av===1?"rgb("+aw.slice(0,3)+")":"rgba("+aw+")"; };var ab=function(av,e){if(av==null||av===""){return e?"0px":"";}var au=B.match(av,aq);return au?au[1]+(au[2]||"px"):av;};var j=function(av,e){if(av==null||av===""){return e?"none":""; }var au=av.match(E);return au?av:e?"none":"";};var W=function(aw,au){var ax="0px none rgba(0,0,0,1)";if(aw==null||aw===""){return au?ax:"";}if(aw===0||aw==="none"){return au?ax:aw+""; }var ay;aw=aw.replace(Q.x,function(az){ay=az;return"";});var av=aw.match(E),e=aw.match(L);return ac([ab(e?e[0]:"",au),j(av?av[0]:"",au),x(ay,au)].join(" ")); };var w=function(au,e){if(au==null||au===""){return e?"0px 0px 0px 0px":"";}return ac(K(P(ac(au).split(" "),function(av){return ab(av,e);})).join(" ")); };var a=function(aw,av,e){var ay="rgba(0,0,0,0)",ax=e===3?ay+" 0px 0px 0px":ay+" 0px 0px 0px 0px";if(aw==null||aw===""){return av?ax:"";}if(aw==="none"){return av?ax:aw; }var au=[],aw=ac(aw).replace(Q.x,function(az){au.push(az);return"";});return P(aw.split(","),function(aE,aB){var aD=x(au[aB],av),az=/inset/.test(aE),aC=aE.match(L)||["0px"]; aC=P(aC,function(aF){return ab(aF,av);});while(aC.length<e){aC.push("0px");}var aA=az?["inset",aD]:[aD];return aA.concat(aC).join(" ");}).join(", ");}; var I=function(au,e){if(au==null||au===""){return"";}return au.replace(Q.x,function(av){return x(av,e);}).replace(f,function(av){return ab(av,e);});};var r={},t={},A={},U={}; var O=function(e){return r[e]||(r[e]=function(){var au=U[e]||e,av=A[e]||I;return function(){return av(y(this)(au),true);};}());};var aa=function(e){return t[e]||(t[e]=function(){var au=U[e]||e,av=A[e]||I; return function(aw){this.style[au]=av(aw,false);};}());};var C=["Top","Right","Bottom","Left"],at=["TopLeft","TopRight","BottomRight","BottomLeft"];c(C,function(au){var e="border"+au; c(["margin"+au,"padding"+au,e+"Width",au.toLowerCase()],function(av){A[av]=ab;});A[e+"Color"]=x;A[e+"Style"]=j;A[e]=W;r[e]=function(){return[O(e+"Width").call(this),O(e+"Style").call(this),O(e+"Color").call(this)].join(" "); };});c(at,function(e){A["border"+e+"Radius"]=ab;});A.color=A.backgroundColor=x;A.width=A.height=A.minWidth=A.minHeight=A.maxWidth=A.maxHeight=A.fontSize=A.backgroundSize=ab; c(["margin","padding"],function(e){A[e]=w;r[e]=function(){return P(C,function(au){return O(e+au).call(this);},this).join(" ");};});A.borderWidth=w;A.borderStyle=function(au,e){if(au==null||au===""){return e?K(["none"]).join(" "):""; }au=ac(au).split(" ");return ac(K(P(au,function(av){j(av,e);})).join(" "));};A.borderColor=function(au,e){if(!au||!(au=B.match(au,Q.x))){return e?K(["rgba(0,0,0,1)"]).join(" "):""; }return ac(K(P(au,function(av){return x(av,e);})).join(" "));};c(["Width","Style","Color"],function(e){r["border"+e]=function(){return P(C,function(au){return O("border"+au+e).call(this); },this).join(" ");};});A.borderRadius=w;r.borderRadius=function(){return P(at,function(e){return O("border"+e+"Radius").call(this);},this).join(" ");}; A.border=W;r.border=function(){var av;for(var e=0;e<C.length;e++){var au=O("border"+C[e]).call(this);if(av&&au!==av){return null;}av=au;}return av;};A.zIndex=X; A.opacity=k;var ad=u.style.MsFilter!=null&&"MsFilter"||u.style.filter!=null&&"filter";if(ad&&u.style.opacity==null){var z=/alpha\(opacity=([\d.]+)\)/i; t.opacity=function(au){au=(au=k(au))==="1"?"":"alpha(opacity="+Math.round(au*100)+")";var e=y(this)(ad);return this.style[ad]=z.test(e)?e.replace(z,au):e+" "+au; };r.opacity=function(){var e=y(this)(ad).match(z);return(!e?1:e[1]/100)+"";};}var S=A.boxShadow=function(au,e){return a(au,e,4);};var M=A.textShadow=function(au,e){return a(au,e,3); };c(["Webkit","Moz","ms","O",null],function(e){c(["transition","transform","transformOrigin","transformStyle","perspective","perspectiveOrigin","backfaceVisibility"],function(au){var av=e?e+R(au):au; if(e==="ms"){T[av]="-ms-"+n(au);}if(u.style[av]!=null){U[au]=av;}});});var p=U.transition,F=U.transform;if(p==="OTransition"){p=null;}var ae,Y;if(!p&&F){(function(){var ax=m("d"); var au="\\s*([-\\d\\w.]+)\\s*";var aw=RegExp("matrix\\("+[au,au,au,au,au,au]+"\\)");var az=function(aB){var aC=ax.apply(null,aB.match(aw).slice(1))||[[0,0],0,0,[0,0]]; return["translate("+P(aC[0],function(aD){return ai(aD)+"px";})+")","rotate("+ai(aC[1]*180/Math.PI)+"deg)","skewX("+ai(aC[2]*180/Math.PI)+"deg)","scale("+P(aC[3],ai)+")"].join(" "); };var av=function(aB){return aB||"0px";},e=function(aB){return aB||"1";},aA=function(aB){return aB||"0deg";};var ay={translate:function(aC){if(!aC){aC="0px,0px"; }var aB=aC.split(",");if(!aB[1]){aB[1]="0px";}return P(aB,ac)+"";},translateX:av,translateY:av,scale:function(aC){if(!aC){aC="1,1";}var aB=aC.split(","); if(!aB[1]){aB[1]=aB[0];}return P(aB,ac)+"";},scaleX:e,scaleY:e,rotate:aA,skewX:aA,skewY:aA};Y=G({constructor:function(aC){var aD=this.names=[];var aB=this.values=[]; aC.replace(/(\w+)\(([-.\d\s\w,]+)\)/g,function(aF,aE,aG){aD.push(aE);aB.push(aG);});},identity:function(){var aB=[];c(this.names,function(aC){var aD=ay[aC]; if(aD){aB.push(aC+"("+aD()+")");}});return aB.join(" ");},sameType:function(aB){return this.names.toString()===aB.names.toString();},decompose:function(){var aC=this.toString(); u.style.cssText=N+n(F)+":"+aC+";";document.body.appendChild(u);var aB=y(u)(F);if(!aB||aB==="none"){aB="matrix(1, 0, 0, 1, 0, 0)";}document.body.removeChild(u); return az(aB);}});Y.prototype.toString=function(aC){var aB=this.values,aD=[];c(this.names,function(aE,aF){var aG=ay[aE];if(!aG){return;}var aH=aG(aB[aF]); if(!aC||aH!==aG()){aD.push(aE+"("+aH+")");}});return aD.length?aD.join(" "):"none";};Y.union=function(aE,aD){if(aE===aD){return;}var aB,aC;if(aE==="none"){aC=new Y(aD); aD=aC.toString();aE=aC.identity();aB=new Y(aE);}else{if(aD==="none"){aB=new Y(aE);aE=aB.toString();aD=aB.identity();aC=new Y(aD);}else{aB=new Y(aE);aE=aB.toString(); aC=new Y(aD);aD=aC.toString();}}if(aE===aD){return;}if(!aB.sameType(aC)){aE=aB.decompose();aD=aC.decompose();}if(aE===aD){return;}return[aE,aD];};ae=A.transform=function(aB){if(!aB||aB==="none"){return"none"; }return new Y(aw.test(aB)?az(aB):aB).toString(true);};r.transform=function(){var aB=this.style;return aB[F]||(aB[F]=ae(y(this)(F)));};})();}var ap=function(av,aw,az){var ay=A[aw]||I,ax=O(aw).call(av),az=ay(az,true); if(ax===az){return;}if(ay===ab||ay===W||ay===w){var e=az.match(f),au=0;if(e){ax=ax.replace(f,function(aD,aG,aE){var aA=e[au++],aF=aA.match(aq),aC=aF[2]; if(aE!==aC){var aB=aE==="px"?aG:aj(av,aE)*aG;return ai(aB/aj(av,aC))+aC;}return aD;});}if(au>0){aa(aw).call(av,ax);}}else{if(ay===ae){return Y.union(ax,az); }}return ax!==az?[ax,az]:null;};var V=G({inherits:J,constructor:function V(av,aw){var au=O(aw),e=aa(aw);this.get=function(){return au.call(av);};this.set=function(ax){return e.call(av,ax); };V.parent.constructor.call(this,this.set);this.node=av;this.property=aw;}});var ak;ak=G({inherits:V,constructor:function ak(){return ak.parent.constructor.apply(this,arguments); },start:function(av){this.stop();if(this.duration===0){this.cancel(av);return this;}var e=ap(this.node,this.property,av);if(!e){this.cancel(av);return this; }ak.parent.start.apply(this,e);if(!this.cancelStep){return this;}var au=A[this.property]||I;if((au===S||au===M||au===I)&&this.templateFrom!==this.templateTo){this.cancelStep(); delete this.cancelStep;this.cancel(av);}return this;},parseEquation:function(e){if(typeof e==="string"){return ak.parent.parseEquation.call(this,e);}}}); var ar=function(aw,au,e,ax){var av=H(au,aw);if(av!==-1){au.splice(av,1);e.splice(av,1);ax.splice(av,1);}};var an=G({inherits:V,constructor:function an(au,av){an.parent.constructor.call(this,au,av); this.hproperty=n(U[av]||av);var e=this;this.bSetTransitionCSS=function(aw){e.setTransitionCSS(aw);};this.bSetStyleCSS=function(aw){e.setStyleCSS(aw);}; this.bComplete=function(){e.complete();};},start:function(au){this.stop();if(this.duration===0){this.cancel(au);return this;}var e=ap(this.node,this.property,au); if(!e){this.cancel(au);return this;}this.to=e[1];this.cancelSetTransitionCSS=Z(this.bSetTransitionCSS);return this;},setTransitionCSS:function(e){delete this.cancelSetTransitionCSS; this.resetCSS(true);this.cancelSetStyleCSS=Z(this.bSetStyleCSS);},setStyleCSS:function(au){delete this.cancelSetStyleCSS;var e=this.duration;this.cancelComplete=setTimeout(this.bComplete,e); this.endTime=au+e;this.set(this.to);},complete:function(){delete this.cancelComplete;this.resetCSS();this.callback(this.endTime);},stop:function(e){if(this.cancelExit){this.cancelExit(); delete this.cancelExit;}else{if(this.cancelSetTransitionCSS){this.cancelSetTransitionCSS();delete this.cancelSetTransitionCSS;}else{if(this.cancelSetStyleCSS){this.cancelSetStyleCSS(); delete this.cancelSetStyleCSS;if(e){this.resetCSS();}}else{if(this.cancelComplete){clearTimeout(this.cancelComplete);delete this.cancelComplete;if(e){this.resetCSS(); this.set(this.get());}}}}}return this;},resetCSS:function(au){var ay=y(this.node),ax=(ay(p+"Property").replace(/\s+/g,"")||"all").split(","),aw=(ay(p+"Duration").replace(/\s+/g,"")||"0s").split(","),e=(ay(p+"TimingFunction").replace(/\s+/g,"")||"ease").match(/cubic-bezier\([\d-.,]+\)|([a-z-]+)/g); ar("all",ax,aw,e);ar(this.hproperty,ax,aw,e);if(au){ax.push(this.hproperty);aw.push(this.duration+"ms");e.push("cubic-bezier("+this.equation+")");}var av=this.node.style; av[p+"Property"]=ax;av[p+"Duration"]=aw;av[p+"TimingFunction"]=e;},parseEquation:function(e){if(typeof e==="string"){return an.parent.parseEquation.call(this,e,true); }}});var g=p?an:ak;var D=function(e,au){return typeof e==="function"?J(e):o(e,au);};o.implement({animate:function(aw,au,e){var aC=aw,aD=au;if(typeof aw==="string"){aC={}; aC[aw]=au;aD=e;}if(aD==null){aD={};}var ay=typeof aD;aD=ay==="function"?{callback:aD}:ay==="string"||ay==="number"?{duration:aD}:aD;var aB=aD.callback||function(){},ax=0,av=0; aD.callback=function(aE){if(++ax===av){aB(aE);}};for(var aA in aC){var az=aC[aA],aA=al(aA);this.forEach(function(aG){av++;var aF=o(aG),aE=aF._animations||(aF._animations={}); var aH=aE[aA]||(aE[aA]=new g(aG,aA));aH.setOptions(aD).start(az);});}return this;},style:function(e,ay){var au=e;if(typeof e==="string"){au={};au[e]=ay; }for(var aw in au){var av=au[aw],ax=aa(aw=al(aw));this.forEach(function(aB){var aA=o(aB),az=aA._animations,aC;if(az&&(aC=az[aw])){aC.stop(true);}ax.call(aB,av); });}return this;},compute:function(av){av=al(av);var e=this[0];if(av==="transform"&&ae){return y(e)(F);}var au=O(av).call(e);return au!=null?au.replace(f,function(aw,ay,ax){return ax==="px"?aw:aj(e,ax)*ay+"px"; }):"";}});D.parse=function(av,au,e){return(A[al(av)]||I)(au,e);};h.exports=D;},"8":function(c,d,a,e){var b=c("9");b.implement({clean:function(){return b.trim((this+"").replace(/\s+/g," ")); },camelize:function(){return(this+"").replace(/-\D/g,function(f){return f.charAt(1).toUpperCase();});},hyphenate:function(){return(this+"").replace(/[A-Z]/g,function(f){return"-"+f.toLowerCase(); });},capitalize:function(){return(this+"").replace(/\b[a-z]/g,function(f){return f.toUpperCase();});},escape:function(){return(this+"").replace(/([-.*+?^${}()|[\]\/\\])/g,"\\$1"); },number:function(){return parseFloat(this);}});if(typeof JSON!=="undefined"){b.implement({decode:function(){return JSON.parse(this);}});}d.exports=b;},"9":function(e,d,g,c){var j=e("4")["string"]; var k=("charAt,charCodeAt,concat,contains,endsWith,indexOf,lastIndexOf,localeCompare,match,replace,search,slice,split,startsWith,substr,substring,toLocaleLowerCase,toLocaleUpperCase,toLowerCase,toString,toUpperCase,trim,valueOf").split(","); for(var f={},h=0,b,a;b=k[h++];){if(a=String.prototype[b]){f[b]=a;}}if(!f.trim){f.trim=function(){return(this+"").replace(/^\s+|\s+$/g,"");};}d.exports=j.implement(f); },a:function(g,f,h,e){var d=g("5"),k=g("3").prototype;var m=0;var c=function(o){return o===e?"global":o.uniqueNumber||(o.uniqueNumber="n:"+(m++).toString(36)); };var b={};var j=d({constructor:function j(q,p){if(q==null){return this&&this.constructor===j?new a():null;}var y=q;if(q.constructor!==a){y=new a();var w; if(typeof q==="string"){if(!y.search){return null;}y[y.length++]=p||document;return y.search(q);}if(q.nodeType||q===e){y[y.length++]=q;}else{if(q.length){var x={}; for(var v=0,s=q.length;v<s;v++){var o=j(q[v],p);if(o&&o.length){for(var u=0,t=o.length;u<t;u++){var r=o[u];w=c(r);if(!x[w]){y[y.length++]=r;x[w]=true;}}}}}}}if(!y.length){return null; }if(y.length===1){w=c(y[0]);return b[w]||(b[w]=y);}return y;}});var a=d({inherits:j,constructor:function a(){this.length=0;},unlink:function(){return this.map(function(o,n){delete b[c(o)]; return o;});},forEach:k.forEach,map:k.map,filter:k.filter,every:k.every,some:k.some});f.exports=j;},b:function(h,b,t,p){var c=h("5"),a=h("2").request,m=h("c"); var s=h("3").map;var g="([\\d.]+)(s|ms)?",k="cubic-bezier\\(([-.\\d]+),([-.\\d]+),([-.\\d]+),([-.\\d]+)\\)";var r=RegExp(g),e=RegExp(k),o=RegExp(k,"g"); var j={"default":"cubic-bezier(0.25, 0.1, 0.25, 1.0)",linear:"cubic-bezier(0, 0, 1, 1)","ease-in":"cubic-bezier(0.42, 0, 1.0, 1.0)","ease-out":"cubic-bezier(0, 0, 0.58, 1.0)","ease-in-out":"cubic-bezier(0.42, 0, 0.58, 1.0)"}; j.ease=j["default"];var q=function(w,v,u){return(v-w)*u+w;};var n=function(v){var u=[];var w=(v+"").replace(/[-.\d]+/g,function(x){u.push(+x);return"@"; });return[u,w];};var f=c({constructor:function f(w,v){this.setOptions(v);this.render=w||function(){};var u=this;this.bStep=function(x){return u.step(x); };this.bExit=function(x){u.exit(x);};},setOptions:function(u){if(u==null){u={};}if(!(this.duration=this.parseDuration(u.duration||"500ms"))){throw new Error("invalid duration"); }if(!(this.equation=this.parseEquation(u.equation||"default"))){throw new Error("invalid equation");}this.callback=u.callback||function(){};return this; },parseDuration:function(w){if(w=(w+"").match(r)){var v=+w[1],u=w[2]||"ms";if(u==="s"){return v*1000;}if(u==="ms"){return v;}}},parseEquation:function(v,x){var w=typeof v; if(w==="function"){return v;}else{if(w==="string"){v=j[v]||v;var u=v.replace(/\s+/g,"").match(e);if(u){v=s(u.slice(1),function(y){return +y;});if(x){return v; }if(v.toString()==="0,0,1,1"){return function(y){return y;};}w="object";}}}if(w==="object"){return m(v[0],v[1],v[2],v[3],1000/60/this.duration/4);}},cancel:function(u){this.to=u; this.cancelExit=a(this.bExit);},exit:function(u){this.render(this.to);delete this.cancelExit;this.callback(u);},start:function(z,y){this.stop();if(this.duration===0){this.cancel(y); return this;}this.isArray=false;this.isNumber=false;var x=typeof z,w=typeof y;if(x==="object"&&w==="object"){this.isArray=true;}else{if(x==="number"&&w==="number"){this.isNumber=true; }}var v=n(z),u=n(y);this.from=v[0];this.to=u[0];this.templateFrom=v[1];this.templateTo=u[1];if(this.from.length!==this.to.length||this.from.toString()===this.to.toString()){this.cancel(y); return this;}delete this.time;this.length=this.from.length;this.cancelStep=a(this.bStep);return this;},stop:function(){if(this.cancelExit){this.cancelExit(); delete this.cancelExit;}else{if(this.cancelStep){this.cancelStep();delete this.cancelStep;}}return this;},step:function(u){this.time||(this.time=u);var z=(u-this.time)/this.duration; if(z>1){z=1;}var C=this.equation(z),A=this.from,B=this.to,y=this.templateTo;for(var w=0,v=this.length;w<v;w++){var x=A[w],D=B[w];y=y.replace("@",D!==x?q(x,D,C):D); }this.render(this.isArray?y.split(","):this.isNumber?+y:y,z);if(z!==1){this.cancelStep=a(this.bStep);}else{delete this.cancelStep;this.callback(u);}}}); var d=function(v){var u=new f(v);return{start:function(z,y,w){var x=typeof w;u.setOptions(x==="function"?{callback:w}:x==="string"||x==="number"?{duration:w}:w).start(z,y); return this;},stop:function(){u.stop();return this;}};};d.prototype=f.prototype;b.exports=d;},c:function(b,c,a,d){c.exports=function(h,k,f,j,n){var g=function(p){var o=1-p; return 3*o*o*p*h+3*o*p*p*f+p*p*p;};var e=function(p){var o=1-p;return 3*o*o*p*k+3*o*p*p*j+p*p*p;};var m=function(p){var o=1-p;return 3*(2*(p-1)*p+o*o)*h+3*(-p*p*p+2*o*p)*f; };return function(r){var o=r,w,v,s,p,u,q;for(s=o,q=0;q<8;q++){p=g(s)-o;if(Math.abs(p)<n){return e(s);}u=m(s);if(Math.abs(u)<0.000001){break;}s=s-p/u;}w=0,v=1,s=o; if(s<w){return e(w);}if(s>v){return e(v);}while(w<v){p=g(s);if(Math.abs(p-o)<n){return e(s);}if(o>p){w=s;}else{v=s;}s=(v-w)*0.5+w;}return e(s);};};},d:function(e,d,f,b){var c=function(k){return Math.sqrt(k[0]*k[0]+k[1]*k[1]); };var g=function(m){var k=c(m);return k?[m[0]/k,m[1]/k]:[0,0];};var a=function(m,k){return m[0]*k[0]+m[1]*k[1];};var j=Math.atan2;var h=function(m,k,o,n){return[o*m[0]+n*k[0],o*m[1]+n*k[1]]; };d.exports=function(v,u,t,s,r,q){if(v*s-u*t===0){return false;}var k=[r,q];var n=[[v,u],[t,s]];var o=[c(n[0])];n[0]=g(n[0]);var w=a(n[0],n[1]);n[1]=h(n[1],n[0],1,-w); o[1]=c(n[1]);w/=o[1];var p=j(n[0][1],n[0][0]);return[k,p,w,o];};}}); /* matchMedia() polyfill - Test a CSS media type/query in JS. Authors & copyright (c) 2012: Scott Jehl, Paul Irish, Nicholas Zakas. Dual MIT/BSD license */ /* NOTE: If you're already including a window.matchMedia polyfill via Modernizr or otherwise, you don't need this part */ window.matchMedia=window.matchMedia||(function(n,m){var p,j=n.documentElement,h=j.firstElementChild||j.firstChild,o=n.createElement("body"),k=n.createElement("div"); k.id="mq-test-1";k.style.cssText="position:absolute;top:-100em";o.style.background="none";o.appendChild(k);return function(a){k.innerHTML='&shy;<style media="'+a+'"> #mq-test-1 { width: 42px; }</style>'; j.insertBefore(o,h);p=k.offsetWidth==42;j.removeChild(o);return{matches:p,media:a};};})(document); /* Respond.js v1.1.0: min/max-width media query polyfill. (c) Scott Jehl. MIT/GPLv2 Lic. j.mp/respondjs */ (function(P){P.respond={}; respond.update=function(){};respond.mediaQueriesSupported=P.matchMedia&&P.matchMedia("only all").matches;if(respond.mediaQueriesSupported){return;}var x=P.document,B=x.documentElement,L=[],J=[],D=[],F={},M=30,O=x.getElementsByTagName("head")[0]||B,N=x.getElementsByTagName("base")[0],S=O.getElementsByTagName("link"),Q=[],T=function(){var c=S,g=c.length,f=0,b,e,d,a; for(;f<g;f++){b=c[f],e=b.href,d=b.media,a=b.rel&&b.rel.toLowerCase()==="stylesheet";if(!!e&&a&&!F[e]){if(b.styleSheet&&b.styleSheet.rawCssText){H(b.styleSheet.rawCssText,e,d); F[e]=true;}else{if((!/^([a-zA-Z:]*\/\/)/.test(e)&&!N)||e.replace(RegExp.$1,"").split("/")[0]===P.location.host){Q.push({href:e,media:d});}}}}z();},z=function(){if(Q.length){var a=Q.shift(); G(a.href,function(b){H(b,a.href,a.media);F[a.href]=true;z();});}},H=function(j,h,e){var m=j.match(/@media[^\{]+\{([^\{\}]*\{[^\}\{]*\})+/gi),g=m&&m.length||0,h=h.substring(0,h.lastIndexOf("/")),f=function(p){return p.replace(/(url\()['"]?([^\/\)'"][^:\)'"]+)['"]?(\))/g,"$1"+h+"$2$3"); },d=!g&&e,a=0,b,o,n,c,k;if(h.length){h+="/";}if(d){g=1;}for(;a<g;a++){b=0;if(d){o=e;J.push(f(j));}else{o=m[a].match(/@media *([^\{]+)\{([\S\s]+?)$/)&&RegExp.$1; J.push(RegExp.$2&&f(RegExp.$2));}c=o.split(",");k=c.length;for(;b<k;b++){n=c[b];L.push({media:n.split("(")[0].match(/(only\s+)?([a-zA-Z]+)\s?/)&&RegExp.$2||"all",rules:J.length-1,hasquery:n.indexOf("(")>-1,minw:n.match(/\(min\-width:[\s]*([\s]*[0-9\.]+)(px|em)[\s]*\)/)&&parseFloat(RegExp.$1)+(RegExp.$2||""),maxw:n.match(/\(max\-width:[\s]*([\s]*[0-9\.]+)(px|em)[\s]*\)/)&&parseFloat(RegExp.$1)+(RegExp.$2||"")}); }}K();},I,C,y=function(){var c,b=x.createElement("div"),a=x.body,d=false;b.style.cssText="position:absolute;font-size:1em;width:1em";if(!a){a=d=x.createElement("body"); a.style.background="none";}a.appendChild(b);B.insertBefore(a,B.firstChild);c=b.offsetWidth;if(d){B.removeChild(a);}else{a.removeChild(b);}c=E=parseFloat(c); return c;},E,K=function(n){var m="clientWidth",c=B[m],o=x.compatMode==="CSS1Compat"&&c||x.body[m]||c,a={},p=S[S.length-1],g=(new Date()).getTime();if(n&&I&&g-I<M){clearTimeout(C); C=setTimeout(K,M);return;}else{I=g;}for(var r in L){var j=L[r],b=j.minw,k=j.maxw,d=b===null,f=k===null,h="em";if(!!b){b=parseFloat(b)*(b.indexOf(h)>-1?(E||y()):1); }if(!!k){k=parseFloat(k)*(k.indexOf(h)>-1?(E||y()):1);}if(!j.hasquery||(!d||!f)&&(d||o>=b)&&(f||o<=k)){if(!a[j.media]){a[j.media]=[];}a[j.media].push(J[j.rules]); }}for(var r in D){if(D[r]&&D[r].parentNode===O){O.removeChild(D[r]);}}for(var r in a){var e=x.createElement("style"),q=a[r].join("\n");e.type="text/css"; e.media=r;O.insertBefore(e,p.nextSibling);if(e.styleSheet){e.styleSheet.cssText=q;}else{e.appendChild(x.createTextNode(q));}D.push(e);}},G=function(a,b){var c=R(); if(!c){return;}c.open("GET",a,true);c.onreadystatechange=function(){if(c.readyState!=4||c.status!=200&&c.status!=304){return;}b(c.responseText);};if(c.readyState==4){return; }c.send(null);},R=(function(){var a=false;try{a=new XMLHttpRequest();}catch(b){a=new ActiveXObject("Microsoft.XMLHTTP");}return function(){return a;};})(); T();respond.update=T;function A(){K(true);}if(P.addEventListener){P.addEventListener("resize",A,false);}else{if(P.attachEvent){P.attachEvent("onresize",A); }}})(this);(function(g){if(!g||!(g.toJSON||Object.toJSON||window.JSON)){throw new Error("jQuery, MooTools or Prototype needs to be loaded before jStorage!"); }var h={},e={jStorage:"{}"},j=null,m=0,p=g.toJSON||Object.toJSON||(window.JSON&&(JSON.encode||JSON.stringify)),f=g.evalJSON||(window.JSON&&(JSON.decode||JSON.parse))||function(r){return String(r).evalJSON(); },k=false,o,d={isXML:function(s){var r=(s?s.ownerDocument||s:0).documentElement;return r?r.nodeName!=="HTML":false;},encode:function(s){if(!this.isXML(s)){return false; }try{return new XMLSerializer().serializeToString(s);}catch(r){try{return s.xml;}catch(t){}}return false;},decode:function(s){var r=("DOMParser" in window&&(new DOMParser()).parseFromString)||(window.ActiveXObject&&function(u){var v=new ActiveXObject("Microsoft.XMLDOM"); v.async="false";v.loadXML(u);return v;}),t;if(!r){return false;}t=r.call("DOMParser" in window&&(new DOMParser())||window,s,"text/xml");return this.isXML(t)?t:false; }};function n(){var r=false;if("localStorage" in window){try{window.localStorage.setItem("_tmptest","tmpval");r=true;window.localStorage.removeItem("_tmptest"); }catch(s){}}if(r){try{if(window.localStorage){e=window.localStorage;k="localStorage";}}catch(w){}}else{if("globalStorage" in window){try{if(window.globalStorage){e=window.globalStorage[window.location.hostname]; k="globalStorage";}}catch(v){}}else{j=document.createElement("link");if(j.addBehavior){j.style.behavior="url(#default#userData)";document.getElementsByTagName("head")[0].appendChild(j); j.load("jStorage");var u="{}";try{u=j.getAttribute("jStorage");}catch(t){}e.jStorage=u;k="userDataBehavior";}else{j=null;return;}}}b();q();}function b(){if(e.jStorage){try{h=f(String(e.jStorage)); }catch(r){e.jStorage="{}";}}else{e.jStorage="{}";}m=e.jStorage?String(e.jStorage).length:0;}function c(){try{e.jStorage=p(h);if(j){j.setAttribute("jStorage",e.jStorage); j.save("jStorage");}m=e.jStorage?String(e.jStorage).length:0;}catch(r){}}function a(r){if(!r||(typeof r!="string"&&typeof r!="number")){throw new TypeError("Key name must be string or numeric"); }if(r=="__jstorage_meta"){throw new TypeError("Reserved key name");}return true;}function q(){var v,r,t,s=Infinity,u=false;clearTimeout(o);if(!h.__jstorage_meta||typeof h.__jstorage_meta.TTL!="object"){return; }v=+new Date();t=h.__jstorage_meta.TTL;for(r in t){if(t.hasOwnProperty(r)){if(t[r]<=v){delete t[r];delete h[r];u=true;}else{if(t[r]<s){s=t[r];}}}}if(s!=Infinity){o=setTimeout(q,s-v); }if(u){c();}}g.jStorage={version:"0.1.6.1",set:function(r,s){a(r);if(d.isXML(s)){s={_is_xml:true,xml:d.encode(s)};}else{if(typeof s=="function"){s=null; }else{if(s&&typeof s=="object"){s=f(p(s));}}}h[r]=s;c();return s;},get:function(r,s){a(r);if(r in h){if(h[r]&&typeof h[r]=="object"&&h[r]._is_xml&&h[r]._is_xml){return d.decode(h[r].xml); }else{return h[r];}}return typeof(s)=="undefined"?null:s;},deleteKey:function(r){a(r);if(r in h){delete h[r];if(h.__jstorage_meta&&typeof h.__jstorage_meta.TTL=="object"&&r in h.__jstorage_meta.TTL){delete h.__jstorage_meta.TTL[r]; }c();return true;}return false;},setTTL:function(s,r){var t=+new Date();a(s);r=Number(r)||0;if(s in h){if(!h.__jstorage_meta){h.__jstorage_meta={};}if(!h.__jstorage_meta.TTL){h.__jstorage_meta.TTL={}; }if(r>0){h.__jstorage_meta.TTL[s]=t+r;}else{delete h.__jstorage_meta.TTL[s];}c();q();return true;}return false;},flush:function(){h={};c();return true; },storageObj:function(){function r(){}r.prototype=h;return new r();},index:function(){var r=[],s;for(s in h){if(h.hasOwnProperty(s)&&s!="__jstorage_meta"){r.push(s); }}return r;},storageSize:function(){return m;},currentBackend:function(){return k;},storageAvailable:function(){return !!k;},reInit:function(){var r,t; if(j&&j.addBehavior){r=document.createElement("link");j.parentNode.replaceChild(r,j);j=r;j.style.behavior="url(#default#userData)";document.getElementsByTagName("head")[0].appendChild(j); j.load("jStorage");t="{}";try{t=j.getAttribute("jStorage");}catch(s){}e.jStorage=t;k="userDataBehavior";}b();}};n();})(!window.MooTools?window.jQuery:window.$); function style_html(q,c){var u,n,m,e,f;c=c||{};n=c.indent_size||4;m=c.indent_char||" ";f=c.brace_style||"collapse";e=c.max_char===0?Infinity:c.max_char||70; unformatted=c.unformatted||["a"];function b(){this.pos=0;this.token="";this.current_mode="CONTENT";this.tags={parent:"parent1",parentcount:1,parent1:""}; this.tag_type="";this.token_text=this.last_token=this.last_text=this.token_type="";this.Utils={whitespace:"\n\r\t ".split(""),single_token:"br,input,link,meta,!doctype,basefont,base,area,hr,wbr,param,img,isindex,?xml,embed".split(","),extra_liners:"head,body,/html".split(","),in_array:function(w,t){for(var v=0; v<t.length;v++){if(w===t[v]){return true;}}return false;}};this.get_content=function(){var t="";var w=[];var x=false;while(this.input.charAt(this.pos)!=="<"){if(this.pos>=this.input.length){return w.length?w.join(""):["","TK_EOF"]; }t=this.input.charAt(this.pos);this.pos++;this.line_char_count++;if(this.Utils.in_array(t,this.Utils.whitespace)){if(w.length){x=true;}this.line_char_count--; continue;}else{if(x){if(this.line_char_count>=this.max_char){w.push("\n");for(var v=0;v<this.indent_level;v++){w.push(this.indent_string);}this.line_char_count=0; }else{w.push(" ");this.line_char_count++;}x=false;}}w.push(t);}return w.length?w.join(""):"";};this.get_contents_to=function(w){if(this.pos==this.input.length){return["","TK_EOF"]; }var t="";var x="";var y=new RegExp("</"+w+"\\s*>","igm");y.lastIndex=this.pos;var v=y.exec(this.input);var z=v?v.index:this.input.length;if(this.pos<z){x=this.input.substring(this.pos,z); this.pos=z;}return x;};this.record_tag=function(t){if(this.tags[t+"count"]){this.tags[t+"count"]++;this.tags[t+this.tags[t+"count"]]=this.indent_level; }else{this.tags[t+"count"]=1;this.tags[t+this.tags[t+"count"]]=this.indent_level;}this.tags[t+this.tags[t+"count"]+"parent"]=this.tags.parent;this.tags.parent=t+this.tags[t+"count"]; };this.retrieve_tag=function(t){if(this.tags[t+"count"]){var v=this.tags.parent;while(v){if(t+this.tags[t+"count"]===v){break;}v=this.tags[v+"parent"]; }if(v){this.indent_level=this.tags[t+this.tags[t+"count"]];this.tags.parent=this.tags[v+"parent"];}delete this.tags[t+this.tags[t+"count"]+"parent"];delete this.tags[t+this.tags[t+"count"]]; if(this.tags[t+"count"]==1){delete this.tags[t+"count"];}else{this.tags[t+"count"]--;}}};this.get_tag=function(){var t="";var w=[];var y=false;do{if(this.pos>=this.input.length){return w.length?w.join(""):["","TK_EOF"]; }t=this.input.charAt(this.pos);this.pos++;this.line_char_count++;if(this.Utils.in_array(t,this.Utils.whitespace)){y=true;this.line_char_count--;continue; }if(t==="'"||t==='"'){if(!w[1]||w[1]!=="!"){t+=this.get_unformatted(t);y=true;}}if(t==="="){y=false;}if(w.length&&w[w.length-1]!=="="&&t!==">"&&y){if(this.line_char_count>=this.max_char){this.print_newline(false,w); this.line_char_count=0;}else{w.push(" ");this.line_char_count++;}y=false;}w.push(t);}while(t!==">");var z=w.join("");var x;if(z.indexOf(" ")!=-1){x=z.indexOf(" "); }else{x=z.indexOf(">");}var v=z.substring(1,x).toLowerCase();if(z.charAt(z.length-2)==="/"||this.Utils.in_array(v,this.Utils.single_token)){this.tag_type="SINGLE"; }else{if(v==="script"){this.record_tag(v);this.tag_type="SCRIPT";}else{if(v==="style"){this.record_tag(v);this.tag_type="STYLE";}else{if(this.Utils.in_array(v,unformatted)){var A=this.get_unformatted("</"+v+">",z); w.push(A);this.tag_type="SINGLE";}else{if(v.charAt(0)==="!"){if(v.indexOf("[if")!=-1){if(z.indexOf("!IE")!=-1){var A=this.get_unformatted("-->",z);w.push(A); }this.tag_type="START";}else{if(v.indexOf("[endif")!=-1){this.tag_type="END";this.unindent();}else{if(v.indexOf("[cdata[")!=-1){var A=this.get_unformatted("]]>",z); w.push(A);this.tag_type="SINGLE";}else{var A=this.get_unformatted("-->",z);w.push(A);this.tag_type="SINGLE";}}}}else{if(v.charAt(0)==="/"){this.retrieve_tag(v.substring(1)); this.tag_type="END";}else{this.record_tag(v);this.tag_type="START";}if(this.Utils.in_array(v,this.Utils.extra_liners)){this.print_newline(true,this.output); }}}}}}return w.join("");};this.get_unformatted=function(v,w){if(w&&w.indexOf(v)!=-1){return"";}var t="";var x="";var y=true;do{if(this.pos>=this.input.length){return x; }t=this.input.charAt(this.pos);this.pos++;if(this.Utils.in_array(t,this.Utils.whitespace)){if(!y){this.line_char_count--;continue;}if(t==="\n"||t==="\r"){x+="\n"; this.line_char_count=0;continue;}}x+=t;this.line_char_count++;y=true;}while(x.indexOf(v)==-1);return x;};this.get_token=function(){var t;if(this.last_token==="TK_TAG_SCRIPT"||this.last_token==="TK_TAG_STYLE"){var v=this.last_token.substr(7); t=this.get_contents_to(v);if(typeof t!=="string"){return t;}return[t,"TK_"+v];}if(this.current_mode==="CONTENT"){t=this.get_content();if(typeof t!=="string"){return t; }else{return[t,"TK_CONTENT"];}}if(this.current_mode==="TAG"){t=this.get_tag();if(typeof t!=="string"){return t;}else{var w="TK_TAG_"+this.tag_type;return[t,w]; }}};this.get_full_indent=function(t){t=this.indent_level+t||0;if(t<1){return"";}return Array(t+1).join(this.indent_string);};this.printer=function(x,w,t,z,y){this.input=x||""; this.output=[];this.indent_character=w;this.indent_string="";this.indent_size=t;this.brace_style=y;this.indent_level=0;this.max_char=z;this.line_char_count=0; for(var v=0;v<this.indent_size;v++){this.indent_string+=this.indent_character;}this.print_newline=function(C,A){this.line_char_count=0;if(!A||!A.length){return; }if(!C){while(this.Utils.in_array(A[A.length-1],this.Utils.whitespace)){A.pop();}}A.push("\n");for(var B=0;B<this.indent_level;B++){A.push(this.indent_string); }};this.print_token=function(A){this.output.push(A);};this.indent=function(){this.indent_level++;};this.unindent=function(){if(this.indent_level>0){this.indent_level--; }};};return this;}u=new b();u.printer(q,m,n,e,f);while(true){var g=u.get_token();u.token_text=g[0];u.token_type=g[1];if(u.token_type==="TK_EOF"){break; }switch(u.token_type){case"TK_TAG_START":u.print_newline(false,u.output);u.print_token(u.token_text);u.indent();u.current_mode="CONTENT";break;case"TK_TAG_STYLE":case"TK_TAG_SCRIPT":u.print_newline(false,u.output); u.print_token(u.token_text);u.current_mode="CONTENT";break;case"TK_TAG_END":if(u.last_token==="TK_CONTENT"&&u.last_text===""){var s=u.token_text.match(/\w+/)[0]; var j=u.output[u.output.length-1].match(/<\s*(\w+)/);if(j===null||j[1]!==s){u.print_newline(true,u.output);}}u.print_token(u.token_text);u.current_mode="CONTENT"; break;case"TK_TAG_SINGLE":u.print_newline(false,u.output);u.print_token(u.token_text);u.current_mode="CONTENT";break;case"TK_CONTENT":if(u.token_text!==""){u.print_token(u.token_text); }u.current_mode="TAG";break;case"TK_STYLE":case"TK_SCRIPT":if(u.token_text!==""){u.output.push("\n");var h=u.token_text;if(u.token_type=="TK_SCRIPT"){var p=typeof js_beautify=="function"&&js_beautify; }else{if(u.token_type=="TK_STYLE"){var p=typeof css_beautify=="function"&&css_beautify;}}if(c.indent_scripts=="keep"){var k=0;}else{if(c.indent_scripts=="separate"){var k=-u.indent_level; }else{var k=1;}}var a=u.get_full_indent(k);if(p){h=p(h.replace(/^\s*/,a),c);}else{var d=h.match(/^\s*/)[0];var o=d.match(/[^\n\r]*$/)[0].split(u.indent_string).length-1; var r=u.get_full_indent(k-o);h=h.replace(/^\s*/,a).replace(/\r\n|\r|\n/g,"\n"+r).replace(/\s*$/,"");}if(h){u.print_token(h);u.print_newline(true,u.output); }}u.current_mode="TAG";break;}u.last_token=u.token_type;u.last_text=u.token_text;}return u.output.join("");}(function(j,g,h){var c=function(k){return j[k]||j.getElementsByTagName(k)[0]; },a=function(n,k,m){return typeof n=="function"?n.apply(k,m):n;},e=null,b=false,f=function(){if(!b){b=true;var m=".twipsy { display: block; position: absolute; visibility: visible; padding: 5px; font-size: 12px; z-index: 11000;} .twipsy.above .twipsy-arrow { bottom: 0; left: 50%; margin-left: -5px; border-left: 5px solid transparent; border-right: 5px solid transparent; border-top: 5px solid #000000;} .twipsy.above-left .twipsy-arrow { bottom: 0; left: 18px; margin-left: -5px; border-left: 5px solid transparent; border-right: 5px solid transparent; border-top: 5px solid #000000;} .twipsy.above-right .twipsy-arrow { bottom: 0; right: 18px; margin-left: -5px; border-left: 5px solid transparent; border-right: 5px solid transparent; border-top: 5px solid #000000;} .twipsy.left .twipsy-arrow { top: 50%; right: 0; margin-top: -5px; border-top: 5px solid transparent; border-bottom: 5px solid transparent; border-left: 5px solid #000000;} .twipsy.below .twipsy-arrow { top: 0; left: 50%; margin-left: -5px; border-left: 5px solid transparent; border-right: 5px solid transparent; border-bottom: 5px solid #000000;} .twipsy.below-left .twipsy-arrow { top: 0; left: 18px; margin-left: -5px; border-left: 5px solid transparent; border-right: 5px solid transparent; border-bottom: 5px solid #000000;} .twipsy.below-right .twipsy-arrow { top: 0; right: 18px; margin-left: -5px; border-left: 5px solid transparent; border-right: 5px solid transparent; border-bottom: 5px solid #000000;} .twipsy.right .twipsy-arrow { top: 50%; left: 0; margin-top: -5px; border-top: 5px solid transparent; border-bottom: 5px solid transparent; border-right: 5px solid #000000;} .twipsy-inner { padding: 3px 8px; background-color: #000000; color: white; text-align: center; max-width: 200px; text-decoration: none; -webkit-border-radius: 4px; -moz-border-radius: 4px; border-radius: 4px;} .twipsy-arrow { position: absolute; width: 0; height: 0;}",k=new Element("style",{type:"text/css"}).inject(c("head"),"bottom"); k.styleSheet?k.styleSheet.cssText=m:k.innerHTML=m;}};if(typeOf(Browser.Features.transition)!="boolean"){Browser.Features.transition=(function(){var k=(j.body||j.documentElement).style; if(k.transition!==h||k.MsTransition!==h){e="TransitionEnd";}else{if(k.WebkitTransition!==h){e="webkitTransitionEnd";}else{if(k.MozTransition!==h){e="transitionend"; }else{if(k.OTransition!==h){e="oTransitionEnd";}}}}return e!=null;})();}var d=new Class({initialize:function(m,k){this.options=Object.merge({},d.defaults,k); this.element=j.id(m);this.enabled=true;if(k.injectStyles){f();}this.fixTitle();},show:function(){var t,k,s,p,n,r,o,u,m,q;if(this.hasContent()&&this.enabled){n=this.setContent().getTip(); if(this.options.animate){moofx(n).animate({opacity:0.8},{duration:"150ms",equation:"ease-in",callback:function(){this.isShown=true;}.bind(this)});}n.setStyles({top:0,left:0,display:"block"}).inject(document.body,"top"); o=this.element.getPosition();u=this.element.getSize();t={left:o.x,top:o.y,width:u.x,height:u.y};m=n.getSize();k=m.x;s=m.y;p=a(this.options.placement,this,[n,this.element]); q=t.left-k-this.options.offset;if(q<0&&p=="left"){p="right";}switch(p){case"below":r={top:t.top+t.height+this.options.offset,left:t.left+t.width/2-k/2}; break;case"below-left":r={top:t.top+t.height+this.options.offset,left:t.left-this.options.offset};break;case"below-right":r={top:t.top+t.height+this.options.offset,left:t.left+t.width-k+this.options.offset}; break;case"above":r={top:t.top-s-this.options.offset,left:t.left+t.width/2-k/2};break;case"above-left":r={top:t.top-s-this.options.offset,left:t.left-this.options.offset}; break;case"above-right":r={top:t.top-s-this.options.offset,left:t.left+t.width-k+this.options.offset};break;case"left":r={top:t.top+t.height/2-s/2,left:q}; break;case"right":r={top:t.top+t.height/2-s/2,left:t.left+t.width+this.options.offset};break;}n.setStyles(r).addClass(p);}return this;},hide:function(){var m=this.getTip(),k=function(){this.isShown=false; m.dispose();}.bind(this);if(!this.hasContent()){k();return this;}moofx(m).animate({opacity:0},{duration:"150ms",equation:"ease-in",callback:k});return this; },setContent:function(){this.getTip().getElement(".twipsy-inner").set(this.options.html?"html":"text",this.getTitle());return this;},hasContent:function(){return this.getTitle().replace(/\s+/g,"")!==""; },getTitle:function(){var n,k=this.element,m=this.options;this.fixTitle();if(typeof m.title=="string"){n=k.getProperty(m.title=="title"?"data-original-title":m.title); }else{if(typeof m.title=="function"){n=m.title.call(k);}}n=(""+n).clean();return n||m.fallback;},getTip:function(){if(!this.tip){this.tip=new Element("div.twipsy",{html:this.options.template}); }return this.tip;},validate:function(){if(!this.element.parentNode){this.hide();this.element=null;this.options=null;return false;}return true;},enable:function(){this.enabled=true; return this;},disable:function(){this.enabled=false;return this;},toggleEnabled:function(){this.enabled=!this.enabled;return this;},toggle:function(){this[this.getTip().hasClass("in")?"hide":"show"](); return this;},fixTitle:function(){var k=this.element;if(k.getProperty("title")||!k.getProperty("data-original-title")){k.setProperty("data-original-title",k.getProperty("title")||"").removeProperty("title"); }return this;}});d.defaults={placement:"above",animate:true,delayIn:0,delayOut:0,html:false,live:false,offset:0,title:"title",trigger:"hover",injectStyles:true,fallback:"",template:'<div class="twipsy-inner"></div><div class="twipsy-arrow"></div>'}; d.rejectAttrOptions=["title"];d.elementOptions=function(o,m){var p={},k=d.rejectAttrOptions,n=k.length;["placement","animate","delay-in","delay-out","html","offset","title","trigger","template","inject-styles"].each(function(s){var r=null,q; if(o.dataset){r=o.dataset[s.camelCase()];}else{r=o.getProperty("data-"+s);}if(r){q=r.toLowerCase().clean();if(q==="true"){r=true;}else{if(q==="false"){r=false; }else{if(/^[0-9]+$/.test(q)){q=parseInt(q,10);}}}p[s.camelCase()]=r;}});while(n--){delete p[k[n]];}return Object.merge({},m,p);};Element.implement({twipsy:function(t){var s,r,o,n,k="twipsy"; if(t===true){return this.retrieve(k);}else{if(typeof t=="string"){s=this.retrieve(k);if(s){s[t]();}return this;}}t=Object.merge({},d.defaults,t);function m(v){var u=v.retrieve(k); if(!u){u=new d(v,d.elementOptions(v,t));v.store(k,u);}return u;}function p(){var u=m(this);u.hoverState="in";if(t.delayIn==0){u.show();}else{u.fixTitle(); setTimeout(function(){if(u.hoverState=="in"){u.show();}},t.delayIn);}}function q(){var u=m(this);u.hoverState="out";if(t.delayOut==0){u.hide();}else{setTimeout(function(){if(u.hoverState=="out"){u.hide(); }},t.delayOut);}}if(t.trigger!="manual"){o=t.trigger=="hover"?"mouseenter":"focus";n=t.trigger=="hover"?"mouseleave":"blur";m(this);document.id(this).addEvent(o,p).addEvent(n,q); }return this;}});Elements.implement({twipsy:function(k){this.each(function(m){m.twipsy(k);});return this;}});g.Twipsy=d;})(document,self,undefined);((function(){if(typeof this.RokPadData=="undefined"){this.RokPadData={}; }var a={theme:{Ambiance:"ambiance",Chaos:"chaos",Chrome:"chrome",Clouds:"clouds","Clouds Midnight":"clouds_midnight",Cobalt:"cobalt","Crimson Editor":"crimson_editor",Dawn:"dawn",Dreamweaver:"dreamweaver",Eclipse:"eclipse",Fluidvision:"fluidvision",GitHub:"github",idleFingers:"idle_fingers",krTheme:"kr",Merbivore:"merbivore","Merbivore Soft":"merbivore_soft","Mono Industrial":"mono_industrial",Monokai:"monokai","Pastel on dark":"pastel_on_dark","Solarized Dark":"solarized_dark","Solarized Light":"solarized_light",Terminal:"terminal",TextMate:"textmate",Tomorrow:"tomorrow","Tomorrow Night":"tomorrow_night","Tomorrow Night Blue":"tomorrow_night_blue","Tomorrow Night Bright":"tomorrow_night_bright","Tomorrow Night 80s":"tomorrow_night_eighties",Twilight:"twilight","Vibrant Ink":"vibrant_ink",Xcode:"xcode"},"font-size":["7px","8px","9px","10px","11px","12px","13px","14px","15px","16px","20px","24px"]}; this.RokPadClass=new Class({Implements:[Options,Events],initialize:function(){this.elements=document.getElements("[data-rokpad-editor]");this.editors={}; if(window.ace){window.ace.config.set("workerPath",RokPadAcePath);window.ace.config.set("modePath",RokPadAcePath);window.ace.config.set("themePath",RokPadAcePath); }this.attach();this._startAutoSave();return this;},attach:function(){this.elements.each(function(d){var e=d.retrieve("rokpad:attached",false),c=d.retrieve("rokpad:options",false); if(!e){d.store("rokpad:attached",true);var g=d.get("data-rokpad-editor"),b=d.getElement("[data-rokpad-container]");this.editors[g]=this._getACE(d);if(!c){this._populateOptions(g,d); d.store("rokpad:options",true);}this._restoreSettings(g);this._restoreOptions(g);this._extrasFixes(g,d);b.makeResizable({handle:d.getElement(".rokpad-statusbar"),modifiers:{x:false,y:"height"},limit:{x:false,y:[b.getStyle("min-height").toInt(),false]},onStart:function(){document.removeEvent("click",f.document); }.bind(this),onDrag:function(){this.editors[g].getEditor().resize();}.bind(this),onComplete:function(){document.addEvent("click",f.document);this._store("height",b.getStyle("height").toInt()); }.bind(this)});var f={undo:d.retrieve("rokpad:events:undo",function(h,j){this.undo.call(this,h,g,d,j);}.bind(this)),redo:d.retrieve("rokpad:events:redo",function(h,j){this.redo.call(this,h,g,d,j); }.bind(this)),fullscreen:d.retrieve("rokpad:events:fullscreen",function(h,j){this.fullscreen.call(this,h,g,d,j);}.bind(this)),shortcode:d.retrieve("rokpad:events:shortcode",function(h,j){this.insertShortCode.call(this,h,g,d,j); }.bind(this)),softtabs:d.retrieve("rokpad:events:softtabs",function(h,j){h.preventDefault();this.setUseSoftTabs.call(this,g,j,d);}.bind(this)),tabsize:d.retrieve("rokpad:events:tabsize",function(h,j){h.preventDefault(); this.setTabSize.call(this,g,j,d);}.bind(this)),mode:d.retrieve("rokpad:events:mode",function(h,j){h.preventDefault();this.setMode.call(this,g,j,d);}.bind(this)),dropdownToggle:d.retrieve("rokpad:events:dropdownToggle",function(h,k){var m=k.get("data-rokpad-toggle"),j=d.getElement("[data-rokpad-dropdown="+m+"]")||d.getElement("[data-rokpad-popover="+m+"]"); d.getElements("[data-rokpad-dropdown], [data-rokpad-popover]").setStyle("display","none");j.setStyle("display","block");}.bind(this)),toggleActionSettings:d.retrieve("rokpad:events:actionSettings",function(h,j){h.preventDefault(); this.toggleActionSettings.call(this,g,j.get("data-rokpad-action-setting"));}.bind(this)),saveButton:d.retrieve("rokpad:events:saveAction",function(h,j){h.preventDefault(); this.save.call(this);}.bind(this)),findButton:d.retrieve("rokpad:events:find",function(j,k){j.preventDefault();var h=d.getElement("[data-rokpad-action-method=find] input"); this._showActionbar.call(this,g);this._setActionbar.call(this,g,(j.shift?"replace":"find"));h.select();h.focus();}.bind(this)),findReplaceButton:d.retrieve("rokpad:events:findreplace",function(j,k){j.preventDefault(); var h=d.getElement("[data-rokpad-action-method=find] input");this._showActionbar.call(this,g);this._setActionbar.call(this,g,"replace");h.select();h.focus(); this._hideDropDowns();}.bind(this)),beautifyHTML:d.retrieve("rokpad:events:beautifyhtml",function(h,j){h.preventDefault();this.editors[g].setValue(style_html(this.editors[g].getValue(),{indent_size:this.editors[g].getEditor().getSession().getTabSize(),indent_char:" ",max_char:0,unformatted:["a","sub","sup","b","i","u"]})); this._hideDropDowns();}.bind(this)),splitVertical:d.retrieve("rokpad:events:splitvertical",function(h,j){h.preventDefault();}.bind(this)),gotoButton:d.retrieve("rokpad:events:goto",function(j,k){j.preventDefault(); var h=d.getElement("[data-rokpad-action-method=goto] input");this._showActionbar.call(this,g);this._setActionbar.call(this,g,"goto");h.select();h.focus(); this._hideDropDowns.call(this);}.bind(this)),showFindOrReplace:d.retrieve("rokpad:events:showfind",function(k,m){var h;if(k.key=="esc"){this._hideActionbar.call(this,g); return true;}if(k.key=="enter"){var j=this._getRange.call(this,g,this._retrieve("actionSettings"));if(m.getParent("[data-rokpad-action-method]").get("data-rokpad-action-method")=="goto"){h=d.getElement("[data-rokpad-action-method=goto] input"); this.editors[g].getEditor().gotoLine(h.get("value"),0,true);}else{this.editors[g].getEditor().find(j.needle,j,true);}k.preventDefault();return true;}if(k.key=="l"&&k[Browser.Platform.mac?"meta":"control"]){h=d.getElement("[data-rokpad-action-method=goto] input"); k.preventDefault();this._showActionbar.call(this,g);this._setActionbar.call(this,g,"goto");h.select();h.focus();k.preventDefault();return true;}if(k.key=="g"&&k[Browser.Platform.mac?"meta":"control"]){k.preventDefault(); this.editors[g].getEditor()[k.shift?"findPrevious":"findNext"](this._getRange(g,this._retrieve("actionSettings")));this.editors[g].getEditor().focus(); k.preventDefault();return true;}if(k.key!="f"||!k[Browser.Platform.mac?"meta":"control"]){return true;}h=d.getElement("[data-rokpad-action-method=find] input"); k.preventDefault();this._showActionbar.call(this,g);this._setActionbar.call(this,g,(k.shift?"replace":"find"));h.select();h.focus();}.bind(this)),actionInput:d.retrieve("rokpad:events:actioninput",function(h,j){this.performAction.call(this,g,j,d); }.bind(this)),document:function(h,j){this._hideDropDowns.call(this,h,j);}.bind(this),inputWrapper:function(h,j){j.getElement("input").focus();},changeOptions:function(h,j){this.changeOptions.call(this,g,j,"store"); }.bind(this),enableAutoSave:function(h,j){if(j.get("checked")){this._startAutoSave();}else{this._stopAutoSave();}}.bind(this),dragover:function(h,j){this.dragOver.call(this,h,g,j); }.bind(this),drop:function(h,j){this.drop.call(this,h,g,j);}.bind(this)};d.addEvents({"click:relay([data-rokpad-undo])":f.undo,"click:relay([data-rokpad-redo])":f.redo,"click:relay([data-rokpad-fullscreen])":f.fullscreen,"click:relay([data-rokpad-shortcode])":f.shortcode,"click:relay([data-rokpad-toggle])":f.dropdownToggle,"click:relay([data-rokpad-softtabs])":f.softtabs,"click:relay([data-rokpad-tabsize])":f.tabsize,"click:relay([data-rokpad-mode])":f.mode,"click:relay([data-rokpad-action-setting])":f.toggleActionSettings,"click:relay([data-rokpad-save])":f.saveButton,"click:relay([data-rokpad-find])":f.findButton,"click:relay([data-rokpad-find-replace])":f.findReplaceButton,"click:relay([data-rokpad-beautify])":f.beautifyHTML,"click:relay([data-rokpad-split])":f.splitVertical,"click:relay([data-rokpad-goto])":f.gotoButton,"keyup:relay([class*=rok-input-row-] input)":f.actionInput,"click:relay([data-rokpad-action])":f.actionInput,"keydown:relay([class*=rok-input-row-] input)":f.showFindOrReplace,"click:relay(.rok-input-wrapper)":f.inputWrapper,"click:relay(input[data-rokpad-options])":f.changeOptions,"change:relay(select[data-rokpad-options])":f.changeOptions,"keyup:relay(input[type=text][data-rokpad-options])":f.changeOptions,"click:relay(input[data-rokpad-options=autosave-enabled])":f.enableAutoSave}); document.id(document.body).addEvents({dragover:f.dragover,drop:f.drop});if(!document.retrieve("rokpad:events:document",false)){document.store("rokpad:events:document",true); document.addEvent("click",f.document);}}},this);},attachResize:function(d,c){var b=window.retrieve("rokpad:events:resize",function(){var g=document.getElement(".btn-toolbar"),e=this._calculateHeight(c),f=g?(g.getSize().y+18)||0:0; c.getElement(".rokpad-editor-container").setStyle("height",window.getSize().y-e-f);this.editors[d].getEditor().resize.delay(1,this.editors[d].getEditor()); }.bind(this));window.addEvent("resize",b);},detachResize:function(){window.removeEvent("resize",window.retrieve("rokpad:events:resize"));},dragOver:function(b,d,c){},drop:function(e,g,f){var c; try{c=e.event.dataTransfer.files[0];if(window.FileReader){var b=new FileReader();b.onload=function(){var h=this._getModeFromPath(c.name);this.editors[g].setValue(b.result); this.setMode(g,this.editors[g].wrapper.getElement("[data-rokpad-mode="+h+"]"),this.editors[g].wrapper,true);}.bind(this);b.readAsText(c);}return e.preventDefault(e); }catch(d){return e.preventDefault(e);}},_getModeFromPath:function(b){var d="text",c;Object.each(RokPadData.modesList,function(f,e){c=new RegExp("^.*\\.("+f[1]+")$","g"); if(b.match(c)){d=f[2];}});return d;},undo:function(c,e,b,d){if(d.hasClass("rok-button-disabled")){return true;}this.editors[e].getEditor().undo(true);},redo:function(c,e,b,d){if(d.hasClass("rok-button-disabled")){return true; }this.editors[e].getEditor().redo(true);},setMode:function(g,e,c,b){c=c||this.editors[g].wrapper;e=e||"text";e=typeOf(e)=="element"?e:c.getElement("[data-rokpad-mode="+e+"]"); var d=e.get("data-rokpad-mode"),f=e.getSiblings("[data-rokpad-mode]");if(!d){return true;}f.removeClass("rokpad-checked");e.addClass("rokpad-checked"); c.getElement("[data-rokpad-toggle=mode] span").set("text",e.get("text"));this.editors[g].getEditor().getSession().clearAnnotations();this.editors[g].getEditor().getSession().setMode("ace/mode/"+d); this._hideDropDowns();if(!b){this._store("mode",d);}return this;},getMode:function(b){return this.editors[b].getEditor().getSession().getMode().$id.replace(/^ace\/mode\//g,""); },setTabSize:function(f,d,b){b=b||this.editors[f].wrapper;d=typeOf(d)=="element"?d:b.getElement("[data-rokpad-tabsize="+d+"]");var c=d.get("data-rokpad-tabsize"),e=d.getSiblings("[data-rokpad-tabsize]"); if(!c){return true;}e.removeClass("rokpad-checked");d.addClass("rokpad-checked");b.getElement("[data-rokpad-toggle=tabs] span").set("text",c);c=c.toInt()||0; if(!c){return;}this.editors[f].getEditor().getSession().setTabSize(c);this._hideDropDowns();this._store("tabSize",c);return this;},getTabSize:function(b){return this.editors[b].getEditor().getSession().getTabSize(); },setUseSoftTabs:function(f,e,b){b=b||this.editors[f].wrapper;var c=typeOf(e)=="string"||typeOf(e)=="number"?e:null;e=typeOf(e)=="element"?e:b.getElement("[data-rokpad-softtabs]"); var d=c!==null?c:e.get("data-rokpad-softtabs");d=(!d||d=="0"?1:0);e[!d?"removeClass":"addClass"]("rokpad-checked").set("data-rokpad-softtabs",d);this.editors[f].getEditor().getSession().setUseSoftTabs(!d?1:0); this._hideDropDowns();this._store("useSoftTabs",!d?1:0);return this;},getUseSoftTabs:function(b){return this.editors[b].getEditor().getSession().getUseSoftTabs(); },toggleActionSettings:function(g,c,e){var d=this.editors[g].wrapper.getElement("[data-rokpad-action-setting="+c+"]"),b=this._getRange(g,this._retrieve("actionSettings"))||{},f=b[c]; if(typeof f=="undefined"){d[c=="wrap"?"removeClass":"addClass"]("rok-button-unchecked");b[c]=(c=="wrap")?true:false;}else{if(typeof e=="undefined"){e=!!d.hasClass("rok-button-unchecked"); }d[e===false?"addClass":"removeClass"]("rok-button-unchecked");b[c]=e;}this._store("actionSettings",b);this.editors[g].getEditor().$search.set(b);},performAction:function(c,j,g){var e=this._getRange(c,this._retrieve("actionSettings")),h=this.editors[c].getEditor(),d=null; var b=j.getParent("[data-rokpad-action-method]");if(b){b=b.get("data-rokpad-action-method");switch(b){case"goto":break;case"find":e.needle=j.get("value"); this._store("actionSettings",e);break;case"replace":e.replacement=j.get("value");this._store("actionSettings",e);}}var f=j.get("data-rokpad-action");if(f){var k=h.$search.getOptions().needle; if(k!=e.needle&&(f=="findNext"||f=="findPrevious")){f="find";}switch(f){case"goto":d=this.editors[c].wrapper.getElement("[data-rokpad-action-method="+f+"] input").get("value").toInt(); if(!isNaN(d)){h.gotoLine(d,0,true);}break;case"find":h.find(e.needle,e,true);break;case"findAll":h.findAll(e.needle,e);break;case"findNext":h.findNext(e,true); break;case"findPrevious":h.findPrevious(e,true);break;case"replace":h.replace(e.replacement,e);break;case"replaceAll":h.replaceAll(e.replacement,e);break; }h.focus();}},changeOptions:function(b,d,h){var g=d.get("tag")=="select"||d.get("type")=="text"?d.get("value"):d.checked,j=d.get("data-rokpad-options"),k="set"+j.camelCase().capitalize(),c=this.editors[b].getEditor(); switch(j){case"theme":case"font-size":this.editors[b][k](g);break;case"highlight-active-line":case"show-invisibles":case"highlight-selected-word":case"fade-fold-widgets":c[k](g); break;case"show-gutter":case"show-print-margin":c.renderer[k](g);break;case"fold-style":c.getSession()[k](g);c.setShowFoldWidgets(g!=="manual");break;case"selection-style":c[k](g?"line":"text"); break;case"use-wrap-mode":var f=c.getSession(),e=c.renderer;switch(g){case"off":f[k](false);e.setPrintMarginColumn(80);break;case"40":f[k](true);f.setWrapLimitRange(40,40); e.setPrintMarginColumn(40);break;case"80":f[k](true);f.setWrapLimitRange(80,80);e.setPrintMarginColumn(80);break;case"free":f[k](true);f.setWrapLimitRange(null,null); e.setPrintMarginColumn(80);break;}break;}if(h){this._store(j,g);}},fullscreen:function(b,d,f,g){var o,j;if(f.retrieve("rokpad:states:fullscreen",false)){var q=f.retrieve("rokpad:states:styles"),k=f.retrieve("rokpad:states:containerheight"),n=f.retrieve("rokpad:states:location"),m=f.retrieve("rokpad:states:document"),e=f.retrieve("rokpad:states:documentscroll"),c=document.getElement("#editor-xtd-buttons"); j=document.getElement(".btn-toolbar.rokpad-fullscreen");f.setStyles(q).inject(n.element,n.position);if(j){j.removeClass("rokpad-fullscreen").inject(c); }f.getElement(".rokpad-editor-container").setStyles(k);if(m.html["overflow-y"]=="scroll"||m.html.overflow=="auto"){document.id(document.html).setStyle("overflow",m.html.overflow); }document.id(document.body).setStyle("overflow",m.body);window.scrollTo(e.x,e.y);this.editors[d].getEditor().resize.delay(1,this.editors[d].getEditor()); this.detachResize();f.removeClass("rokpad-cantresize");o=f.getElement("[data-rokpad-container]").retrieve("resizer");o.attach();g.getElement("i").className="rokpad-icon-fullscreen"; f.store("rokpad:states:fullscreen",false);}else{j=f.getNext("#editor-xtd-buttons .btn-toolbar");f.store("rokpad:states:location",this._getLocation(f)); f.store("rokpad:states:styles",f.getStyles("position","left","top","right","bottom","z-index","height"));f.store("rokpad:states:containerheight",f.getElement(".rokpad-editor-container").getStyles("height","min-height")); f.store("rokpad:states:document",{html:document.id(document.html).getStyles("overflow","overflow-y","overflow-x"),body:document.id(document.body).getStyle("overflow")}); f.store("rokpad:states:documentscroll",window.getScroll());f.inject(document.id(document.body));if(j){j.inject(f,"after");}var p=this._calculateHeight(f),h=j?(j.getSize().y+13)||0:0; f.setStyles({position:"fixed",left:0,top:0,right:0,bottom:h,"z-index":10000,height:"auto"});if(j){j.addClass("rokpad-fullscreen");}f.getElement(".rokpad-editor-container").setStyles({height:window.getSize().y-p-h,"min-height":"0"}); if(document.id(document.html).getStyle("overflow-y")=="scroll"||document.id(document.html).getStyle("overflow")=="auto"){document.id(document.html).setStyle("overflow","hidden"); }document.id(document.body).setStyle("overflow","hidden");this.editors[d].getEditor().resize.delay(5,this.editors[d].getEditor());this.attachResize(d,f); f.addClass("rokpad-cantresize");o=f.getElement("[data-rokpad-container]").retrieve("resizer");o.detach();g.getElement("i").className="rokpad-icon-windowed"; f.store("rokpad:states:fullscreen",true);}g.retrieve("twipsy").hide();this.editors[d].getEditor().focus();},insertShortCode:function(c,d,h,n){var g=n.get("data-rokpad-shortcode").replace(/'/g,'"'),m=this.editors[d].getEditor(),o=m.getSession(),p,j,e=[],b=[]; if(!g){return;}if(RokPadDevice=="portable"){g=g.substitute({cur:"",data:"",n:"\n",t:"\t"});insertAtCursor(document.id(d),g);document.id(d).focus();return; }ranges=Array.from(m.getSelection()[m.getSelection().inMultiSelectMode?"getAllRanges":"getRange"]());m.clearSelection();ranges.each(function(q,s){p=o.getTextRange(q); j=g.substitute({cur:"{cur}",data:p,n:"\n",t:"\t"});b=[];(j.split("\n")).each(function(t,v){var u=t.indexOfAll("{cur}");if(u.length){u.each(function(x,w){b.push({row:q.start.row+v,column:(!v?q.start.column:0)+(x-(5*w))}); });}},this);j=j.substitute({cur:""});o.replace(q,j);var r=m.getSelection();b.each(function(t,u){var v=q.clone();v.setStart(t);v.setEnd(t);v.cursor=t;if(r.inMultiSelectMode||b.length>1){r.addRange(v); }else{m.moveCursorToPosition(t);}});},this);var f=m.getSelection().getAllRanges(),k=b.length*ranges.length;for(i=b.length,l=f.length;i<l;i+=b.length+1){m.getSelection().substractPoint(f[i].cursor); }m.focus();},save:function(){if(!this._canSave()){return false;}if(!document.retrieve("rokpad:ajax:save",false)){var d=new Request({url:document.getElement("form[name=adminForm]").get("action"),onRequest:this.saveRequest,onSuccess:this.saveSuccess}); document.store("rokpad:ajax:save",d);}var b=this._getTask(),c=document.getElement("form[name=adminForm]"),e=document.retrieve("rokpad:ajax:save");c.task.value=b; e.cancel().post(c.toQueryString());},saveRequest:function(){document.getElements("[data-rokpad-save] i").addClass("spinner");},saveSuccess:function(e){var c=new Element("div").set("html",e),b=document.getElement("form[name=adminForm"),h=c.getElements("form[name=adminForm] input, form[name=adminForm] select, form[name=adminForm] textarea"),k,j,d,f; for(var g=h.length-1;g>=0;g--){j=h[g].get("type");k=document.id(h[g].get("id"))||document.getElement(h[g].get("tag")+"[name="+h[g].get("name")+"]");if(k){k.set("value",h[g].get("value")); }else{if(h[g].get("name")){b.adopt(h[g].setStyle("display","none"));}}}d=c.getElement("form[name=adminForm]");d=d?d.get("action"):false;if(d){b.set("action",d!="index.php"?d:location.href); f=document.retrieve("rokpad:ajax:save");f.setOptions({url:b.get("action")});}document.getElements("[data-rokpad-savedate]").set("text",(new Date()).format("%d %b, %T")); document.getElements("[data-rokpad-save] i").removeClass("spinner");},_getACE:function(d){var e=d.get("data-rokpad-editor"),c=document.id(e+"-rokpad-editor"),b=d.getElement("[data-rokpad-original]"); d.setStyle("height","auto");return new RokPadACE(e,{wrapper:d,container:c,id:e});},_populateOptions:function(d,b){var c;Object.each(a,function(g,e){c=b.getElement("[data-rokpad-options="+e+"]"); var f=typeOf(g);(f=="object"?Object:Array).each(g,function(j,h){c.adopt(new Element("option[value="+j+"]").set("text",(f=="object"?h:j)));});});},_restoreSettings:function(c){this.setMode(c,(this._retrieve("mode")||"html")); this.setUseSoftTabs(c,this._retrieve("useSoftTabs"));this.setTabSize(c,this._retrieve("tabSize")||4);this[this._retrieve("showActionbar",false)?"_showActionbar":"_hideActionbar"](c); this._setActionbar(c,this._retrieve("actionbarMode","find"),false);var b=this._getRange(c,this._retrieve("actionSettings"));if(!b){this._store("actionSettings",{}); b={};}["regExp","caseSensitive","wholeWord","backwards","wrap","scope"].each(function(d){var e=(d=="wrap")?true:false;this.toggleActionSettings(c,d,b[d]?b[d]:e); },this);},_restoreOptions:function(f){var d=RokPadDefaultSettings,e=this.editors[f].wrapper,b,c;Object.each(d,function(h,g){b=e.getElement("[data-rokpad-options="+g+"]"); if(b){h=(h=="0"||h=="1"||b.get("type")=="text")?h.toInt():h;c=this._retrieve(g);b.set((b.get("type")=="checkbox"?"checked":"value"),typeof c!="undefined"?c:h); this.changeOptions(f,b);}},this);},_extrasFixes:function(h,c){var b=c.getParent(".repeatable-list .repeatable-element.hidden"),g=c.getElement("! > .repeatable-list ~ p.add a"),f=c.getElements("! > .repeatable-list .repeatable-element > .delete"); if(b&&g){if(!g.retrieve("rokpad:zoo:add",false)){g.store("rokpad:zoo:add",true);g.addEvent("click",function(){var m=c.getParent(".repeatable-list").getElements(".repeatable-element:not(.hidden)").getLast(),k=m.getElement("[data-rokpad-editor]"),j=k.get("data-rokpad-editor"); if(!this.editors[j].textarea.get("name")){this.editors[j].textarea.set("name",this.editors[j].textarea.get("id"));}this.editors[j].getEditor().resize(); this.editors[j].getEditor().focus.delay(10,this.editors[j].getEditor());}.bind(this));}}if(b&&f.length){f.addEvent("click",function(){var m=c.getParent(".repeatable-list").getElements(".repeatable-element:not(.hidden)").getLast(),k=m.getElement("[data-rokpad-editor]"),j=k.get("data-rokpad-editor"); this.editors[j].textarea.set("name",null);}.bind(this));}var e=document.getElement(".jevconfig"),d=(e)?e.getElements("#configs.tabs > dt"):[];if(e&&d.length){d.addEvent("click",function(){this.editors[h].getEditor().resize.delay(5,this.editors[h].getEditor()); }.bind(this));}if(window.parent&&typeof saveText!="undefined"&&!document.getElement("form")){this.save=function(){saveText();window.parent.SqueezeBox.close(); };this._stopAutoSave();this._startAutoSave=function(){return this._stopAutoSave();};}},_rearrangeHeight:function(g,e){var f=this.editors[g].wrapper,c=f.getElement("[data-rokpad-container]"),d=f.getElement("[data-rokpad-actionbar]"),b=d.getSize().y-Math.abs(e||0); c.setStyle("height",Math.max(250,(c.getSize().y||c.getStyle("height"))-2-b));this.editors[g].getEditor().resize();},_showActionbar:function(h,e){var g=this.editors[h].wrapper,b=g.getElement("[data-rokpad-container]"),d=g.getElement("[data-rokpad-actionbar]"),c=g.getElement("[data-rokpad-action-method=find] input"),f=g.getElement("[data-rokpad-action-method=replace] input"); inputGoto=g.getElement("[data-rokpad-action-method=goto] input");if(!d.retrieve("rokpad:actionbar:shown",false)||e){d.setStyle("display","block");b.setStyle("height",this._retrieve("height")||b.getStyle("min-height").toInt()); this._store("showActionbar",true);c.set("value",this._retrieve("actionSettings").needle);f.set("value",this._retrieve("actionSettings").replacement);inputGoto.set("value",""); this._rearrangeHeight(h);d.store("rokpad:actionbar:shown",true);}},_hideActionbar:function(f){var e=this.editors[f].wrapper,c=e.getElement("[data-rokpad-container]"),d=e.getElement("[data-rokpad-actionbar]"),b=0; if(d.retrieve("rokpad:actionbar:shown",true)){b=d.getSize().y;c.setStyle("height",c.getSize().y+b-2);this.editors[f].getEditor().resize();d.setStyle("display","none"); this._store("showActionbar",false);d.store("rokpad:actionbar:shown",false);}},_setActionbar:function(j,g,c){var h=this.editors[j].wrapper,b=h.getElement("[data-rokpad-actionbar]"),e=b.getElement(".rok-input-row-2"),f=0,d=0; switch(g){case"goto":f=b.getSize().y;e.setStyle("display","none");d=b.getSize().y;h.getElement(".rokpad-column-1").setStyle("display","none");h.getElement("[data-rokpad-action-method=goto]").setStyle("display","block"); h.getElement("[data-rokpad-action=goto]").setStyle("display","inline-block");h.getElement("[data-rokpad-action-method=find]").setStyle("display","none"); h.getElement(".rokpad-column-3 .rok-input-row-2").setStyle("display","none");h.getElement("[data-rokpad-action=find]").setStyle("width","auto");h.getElements("[data-rokpad-action=findNext]").getParent(".rok-buttons-group").setStyle("display","none"); h.getElements("[data-rokpad-action=find], [data-rokpad-action=findNext], [data-rokpad-action=findPrevious], [data-rokpad-action=findAll]").setStyle("display","none"); this._store("actionbarMode","goto");break;case"find":f=b.getSize().y;e.setStyle("display","none");d=b.getSize().y;h.getElement(".rokpad-column-1").setStyle("display","table-cell"); h.getElements("[data-rokpad-action-method=goto], [data-rokpad-action=goto]").setStyle("display","none");h.getElement("[data-rokpad-action-method=find]").setStyle("display","block"); h.getElement(".rokpad-column-3 .rok-input-row-2").setStyle("display","none");h.getElement("[data-rokpad-action=find]").setStyle("width","auto");h.getElements("[data-rokpad-action=findNext]").getParent(".rok-buttons-group").setStyle("display","inline-block"); h.getElements("[data-rokpad-action=find], [data-rokpad-action=findNext], [data-rokpad-action=findPrevious], [data-rokpad-action=findAll]").setStyle("display","inline-block"); this._store("actionbarMode","find");break;case"replace":f=b.getSize().y;e.setStyle("display","block");d=b.getSize().y;h.getElement(".rokpad-column-1").setStyle("display","table-cell"); h.getElements("[data-rokpad-action-method=goto], [data-rokpad-action=goto]").setStyle("display","none");h.getElement("[data-rokpad-action-method=find]").setStyle("display","block"); h.getElement(".rokpad-column-3 .rok-input-row-2").setStyle("display","block");h.getElement("[data-rokpad-action=find], [data-rokpad-action=findAll]").setStyle("display","inline-block"); h.getElements("[data-rokpad-action=findNext], [data-rokpad-action=findPrevious]").setStyle("display","none");h.getElement("[data-rokpad-action=find]").setStyle("width",h.getElement("[data-rokpad-action=replace]").getComputedSize().width||47); this._store("actionbarMode","replace");}if(c!==false){this._rearrangeHeight(j,f);}if(h.retrieve("rokpad:states:fullscreen")){window.fireEvent("resize",null,1); }},_store:function(b,c){if(!$.jStorage.get("rokpad")){$.jStorage.set("rokpad",{});}$.jStorage.setTTL("rokpad",0);var d=$.jStorage.get("rokpad");d[b]=c; return $.jStorage.set("rokpad",d);},_retrieve:function(b){if(!$.jStorage.get("rokpad")){$.jStorage.set("rokpad",{});}$.jStorage.setTTL("rokpad",0);return $.jStorage.get("rokpad")[b]; },_getRange:function(e,c){if(!c){return c;}var d=this.editors[e].getEditor().getSelectionRange(),b=this.editors[e].getEditor().getSelection();if(b.isEmpty()){c.range=null; }if(c.scope&&!b.isEmpty()){if(d.start.row==d.end.row&&Math.abs(d.start.column-d.end.column)==c.needle.length){return c;}c.range=d;}return c;},_getLocation:function(c){var b={}; if(!c.getSiblings().length){b={element:c.getParent(),position:"inside"};}else{if(c.getPrevious()){b={element:c.getPrevious(),position:"after"};}else{if(c.getNext()){b={element:c.getNext(),position:"before"}; }}}return b;},_calculateHeight:function(c){var b=0;c.getElements("> :not(.rokpad-editor-container)").each(function(d){if(d.getStyle("display")!="none"){b+=d.getSize().y; }});return b;},_hideDropDowns:function(b,c){c=c||(b&&b.target)||null;if(!c||typeOf(c)=="document"){return document.getElements("[data-rokpad-dropdown], [data-rokpad-popover]").setStyle("display","none"); }else{if(c&&(c.get("data-rokpad-dropdown")||c.getParent("[data-rokpad-dropdown]")||c.get("data-rokpad-popover")||c.getParent("[data-rokpad-popover]")||c.get("data-rokpad-toggle")||c.getParent("[data-rokpad-toggle]"))){return true; }document.getElements("[data-rokpad-dropdown], [data-rokpad-popover]").setStyle("display","none");}},_canSave:function(){if(!document.retrieve("rokpad:document:submitform",false)){document.store("rokpad:document:submitform",Joomla.submitform); }var h=true,b=document.retrieve("rokpad:document:submitform"),d=this._getTask();submitform=Joomla.submitform=function(j){return false;};var g=document.getElements("form input.required, form select.required, .message-name !~ input, .message-name !~ select, #k2AdminContainer #title, #k2AdminContainer #catid, #k2AdminContainer #name"); if(document.getElement("[data-zooversion]")&&g.length){var f=new Elements(g.getSiblings(".message-name").flatten()),e=document.getElement('input[name="name"]'); if(e&&e.get("value")===""){h=false;}if(!h){e.focus();f.setStyle("display","block");}}if(typeof $K2!=="undefined"&&g.length){var c=g.get("value");if(c.contains("0")||c.contains("")){h=false; }}if(document.formvalidator){h=document.formvalidator.isValid(document.getElement("[name=adminForm]"));}Joomla.submitbutton(d);Joomla.submitform=b;submitform=b; return h;},_getTask:function(){var c=document.getElement("#toolbar-apply a")||document.getElement("#toolbar-apply button")||document.getElement("[name=adminForm] .btn-toolbar .btn-primary")||document.getElement("form[name=adminForm] .formelm-buttons > button"),b=(c&&c.get("onclick")||"").toString().replace(/.*submitbutton\(['|"](.*)['|"]\).*/g,"$1"); return b||"apply";},_startAutoSave:function(){var b=this._retrieve("autosave-enabled"),c=this._retrieve("autosave-time")||5;c=(isNaN(c)?5:c.toInt())*60*1000; this._stopAutoSave();if(b){this.autosaveTimer=function(){if(this._retrieve("autosave-enabled")){this.save();this._startAutoSave();}}.delay(c,this);}},_stopAutoSave:function(){clearTimeout(this.autosaveTimer); }});})());((function(){var a=new Class({Implements:[Options,Events],options:{wrapper:null,container:null,id:null,onChange:function(b){var c=this.editor.getSession().getUndoManager(); ["undo","redo"].each(function(d){var f="[data-rokpad-"+d+"]",g="[class*=rok-button-disabled]",e=":not("+g+")";if(c["has"+d.capitalize()]()){this.wrapper.getElements(f+g).removeClass("rok-button-disabled"); }else{this.wrapper.getElements(f+e).addClass("rok-button-disabled");}},this);}},initialize:function(c,b){this.setOptions(b);this.wrapper=b.wrapper?document.id(b.wrapper)||document.getElement(b.wrapper)||null:null; this.container=b.container?document.id(b.container)||document.getElement(b.container)||null:null;this.textarea=document.id(c)||document.getElement(c)||null; if(!this.container){throw new Error('Container for injecting ACE "'+b.container+'" not found in the DOM.');}if(!this.wrapper){throw new Error('Wrapper "'+b.wrapper+'" not found in the DOM.'); }if(!this.textarea){throw new Error('Original textarea "'+b.textarea+'" not found in the DOM.');}if(this.textarea.getParent("form")){this.textarea.inject(this.textarea.getParent("form")); }if(!matchMedia("(max-device-width: 1024px)").matches){this.textarea.setStyle("display","none");}this.editor=ace.edit(this.container);this.insert(this.textarea.get("value")); var d=this.editor.getSession().getUndoManager();d.reset.delay(1,d);this.attachEvents();this.container.getElement(".ace_layer.ace_text-layer").set("contenteditable",""); return this;},getEditor:function(){return this.editor;},attachEvents:function(){var b=this.options;this.textarea.addEvent("blur",function(){this.setValue(this.textarea.get("value")); }.bind(this));this.editor.on("blur",function(){this.textarea.set("value",this.getValue());}.bind(this));this.editor.on("change",function(c){this.fireEvent("change",c,1); }.bind(this));document.id(this.editor.renderer.scroller).addEvents({click:function(){this.editor.blur();this.editor.focus();}.bind(this),scroll:function(){var d=this.editor.renderer,e=d.$gutter,c=d.scroller,f=c.scrollLeft; document.id(e)[f<5?"removeClass":"addClass"]("horscroll");}.bind(this)});this.editor.commands.addCommand({name:"find",bindKey:{win:"Ctrl-F",mac:"Command-F|Command-Alt-F"},exec:function(d){var c=this.wrapper.getElement("[data-rokpad-action-method=find] input"); RokPad._setActionbar(b.id,"find");RokPad._showActionbar(b.id);c.select();c.focus();}.bind(this)});this.editor.commands.addCommand({name:"findreplace",bindKey:{win:"Ctrl-Shift-F",mac:"Command-Shift-F"},exec:function(d){var c=this.wrapper.getElement("[data-rokpad-action-method=find] input"); RokPad._setActionbar(b.id,"replace");RokPad._showActionbar(b.id);c.select();c.focus();}.bind(this)});this.editor.commands.addCommand({name:"gotoline",bindKey:{win:"Ctrl-L",mac:"Command-L"},exec:function(d){var c=this.wrapper.getElement("[data-rokpad-action-method=goto] input"); RokPad._setActionbar(b.id,"goto");RokPad._showActionbar(b.id);c.select();c.focus();}.bind(this)});this.editor.commands.addCommand({name:"findnext",bindKey:{win:"Ctrl-K",mac:"Command-G"},exec:function(d){var c=RokPad._getRange(b.id,RokPad._retrieve("actionSettings")); d.findNext(c);}.bind(this)});this.editor.commands.addCommand({name:"findprevious",bindKey:{win:"Ctrl-Shift-K",mac:"Command-Shift-G"},exec:function(d){var c=RokPad._getRange(b.id,RokPad._retrieve("actionSettings")); d.findPrevious(c);}.bind(this)});this.editor.commands.addCommand({name:"escape",bindKey:{win:"Esc",mac:"Esc"},exec:function(c){RokPad._hideActionbar(b.id); }});this.editor.commands.addCommand({name:"save",bindKey:{win:"Ctrl-S",mac:"Command-S"},exec:function(c){RokPad.save();}});this.editor.commands.addCommand({name:"findselection",bindKey:{win:"Ctrl-E",mac:"Command-E"},exec:function(f){var c=this.wrapper.getElement("[data-rokpad-action-method=find] input"),g=this.wrapper.getElement("[data-rokpad-action=find]"),e,d=RokPad._retrieve("actionSettings"); f.selection.selectWord();e=RokPad.editors[b.id].getSelection();RokPad._setActionbar(b.id,"find");RokPad._showActionbar(b.id);c.set("value",e);d.needle=e; RokPad._store("actionSettings",d);c.select();c.focus();g.fireEvent("click");}.bind(this)});},insert:function(b){this.editor.insert(b);return this;},getValue:function(){return this.editor.getSession().getValue(); },setValue:function(b){this.editor.getSession().setValue(b);return this;},getSelection:function(){return this.editor.getSession().getTextRange(this.editor.getSelectionRange()); },setTheme:function(c){var b=this.editor;if(!c){c="github";}if(!c.match(/^ace\/theme/)){c="ace/theme/"+c;}b.setTheme(c);return this;},setFontSize:function(c){var b=this.editor; if(!c){throw new Error('Second argument "fontsize" of ACE::setFontSize must be passed in.');}if(typeof c=="number"){c+="px";}b.setFontSize(c);return this; },setMode:function(c){var b=this.editor;if(!c){throw new Error('Second argument "mode" of ACE::setMode must be passed in.');}b.getSession().setMode(c); return this;},setUseSoftTabs:function(c){var b=this.editor;b.getSession().setUseSoftTabs(c);return this;},replaceSelection:function(j){var g=this.editor,h=g.getSession(),f,c,e,d=[],b=[]; c=Array.from(g.getSelection()[g.getSelection().inMultiSelectMode?"getAllRanges":"getRange"]());c.each(function(k,m){f=h.getTextRange(k);e=f?j.replace(/\{text\}/g,f):j; h.replace(k,e);},this);}});this.RokPadACE=a;})());((function(){if(typeof this.RokPadData=="undefined"){this.RokPadData={};}this.RokPadData.insertion={}; var d=function(e){if(e.matches){RokPadDevice="portable";}else{RokPadDevice="desktop";}RokPadData.insertion={onSave:function(f){if(e.matches){return;}document.id(f).set("value",RokPad.editors[f].getValue()); },onGetContent:function(f){if(e.matches){return document.id(f).get("value");}else{return RokPad.editors[f].getValue();}},onSetContent:function(g,f){if(e.matches){document.id(g).set("value",f); }else{RokPad.editors[g].setValue(f);}},onGetInsertMethod:function(g,f){if(e.matches){insertAtCursor(document.id(f),g);}else{RokPad.editors[f].replaceSelection(g); RokPad.editors[f].getEditor().focus();}}};};if(respond.mediaQueriesSupported&&!Browser.ie8){var b=window.matchMedia("only screen and (max-device-width: 1024px)"); if(b.addListener){b.addListener(d);}else{window.addEvent("resize",function(){if(this.getSize().x<=1024){b={matches:true};}else{b={matches:false};}d(b); });}d(b);}else{if(Browser.ie8){d({matches:true});}else{d({});}}if(typeof insertAtCursor!=="function"){this.insertAtCursor=function(h,g){if(document.selection){h.focus(); sel=document.selection.createRange();sel.text=g;}else{if(h.selectionStart||h.selectionStart=="0"){var f=h.selectionStart;var e=h.selectionEnd;h.value=h.value.substring(0,f)+g+h.value.substring(e,h.value.length); }else{h.value+=g;}}};}Function.implement({bind:function(j){var e=this,f=arguments.length>1?Array.slice(arguments,1):null,h=function(){};var g=function(){var m=j,n=arguments.length; if(this instanceof g){h.prototype=e.prototype;m=new h();}var k=(!f&&!n)?e.call(m):e.apply(m,f&&n?f.concat(Array.slice(arguments)):f||arguments);return m==j?k:m; };return g;}});String.implement({indexOfAll:function(f){var h=new RegExp(f,"g");var e,g=[];while((e=h.exec(this))!==null){g.push(e.index);}return g;}}); Object.merge(Element.NativeEvents,{dragstart:2,drag:2,dragenter:2,dragleave:2,dragover:2,drop:2,dragend:2});String.implement({substitute:function(e,f){return String(this).replace(f||(/\\?\{([^{}]+)\}/g),function(h,g){if(h.charAt(0)=="\\"){return h.slice(1); }return(e[g]!=null)?e[g]:h;});}});RokPadData.modesList=[];RokPadData.modesByName={c9search:["C9Search","c9search_results"],coffee:["CoffeeScript","coffee|^Cakefile"],coldfusion:["ColdFusion","cfm"],csharp:["C#","cs"],css:["CSS","css"],diff:["Diff","diff|patch"],golang:["Go","go"],groovy:["Groovy","groovy"],haxe:["haXe","hx"],html:["HTML","htm|html|xhtml"],c_cpp:["C/C++","c|cc|cpp|cxx|h|hh|hpp"],clojure:["Clojure","clj"],java:["Java","java"],javascript:["JavaScript","js"],json:["JSON","json"],jsx:["JSX","jsx"],latex:["LaTeX","latex|tex|ltx|bib"],less:["LESS","less"],liquid:["Liquid","liquid"],lua:["Lua","lua"],luapage:["LuaPage","lp"],markdown:["Markdown","md|markdown"],ocaml:["OCaml","ml|mli"],perl:["Perl","pl|pm"],pgsql:["pgSQL","pgsql"],php:["PHP","php|phtml"],powershell:["Powershell","ps1"],python:["Python","py"],ruby:["Ruby","ru|gemspec|rake|rb"],scad:["OpenSCAD","scad"],scala:["Scala","scala"],scss:["SCSS","scss|sass"],sh:["SH","sh|bash|bat"],sql:["SQL","sql"],svg:["SVG","svg"],text:["Text","txt"],textile:["Textile","textile"],xml:["XML","xml|rdf|rss|wsdl|xslt|atom|mathml|mml|xul|xbl"],xquery:["XQuery","xq"],yaml:["YAML","yaml"]}; for(var a in RokPadData.modesByName){var c=RokPadData.modesByName[a];c.push(a);RokPadData.modesList.push(c);}window.addEvent("domready",function(){document.getElements(".rokpad-tip").twipsy({placement:"left",offset:5}); var e=Browser.Platform.mac?"mac":"win";document.getElements(".rokpad-keyboard-"+e).setStyle("display","block");document.getElements(".rokpad-kbd-"+e).setStyle("display","inline-block"); this.RokPad=new RokPadClass();if(Browser.ie8){document.getElements(".rokpad-editor-wrapper").addClass("rokpad-ie8");}}.bind(this));})());