Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixed NodeList conversion to array

  • Loading branch information...
commit 1f55144d7ab617cf9b720f3dafa36585e08e6ecc 1 parent 6b0da2c
@sergeche authored
View
12 dist/cm-movie-full.js
@@ -1532,6 +1532,10 @@
* @returns {Array}
*/
function ar(obj) {
+ if (obj.length === +obj.length) {
+ return _.toArray(obj);
+ }
+
return _.isArray(obj) ? obj : [obj];
}
@@ -1586,13 +1590,9 @@
* @return {Element}
*/
removeClass: function(elem, className) {
+ var reSplit = /\s+/g;
_.each(ar(elem), function(el) {
- var elemClass = el.className || '';
- _.each(className.split(/\s+/g), function(c) {
- elemClass = elemClass.replace(new RegExp('\\b' + c + '\\b'), '');
- });
-
- el.className = this.trim(elemClass);
+ el.className = _.difference((el.className || '').split(reSplit), className.split(/\s+/g)).join(' ');
}, this);
return elem;
View
2  dist/cm-movie-full.min.js
@@ -1 +1 @@
-(function(){var e=this,t=e._,n={},r=Array.prototype,i=Object.prototype,s=Function.prototype,o=r.push,u=r.slice,a=r.concat,f=i.toString,l=i.hasOwnProperty,c=r.forEach,h=r.map,p=r.reduce,d=r.reduceRight,v=r.filter,m=r.every,g=r.some,y=r.indexOf,b=r.lastIndexOf,w=Array.isArray,E=Object.keys,S=s.bind,x=function(e){if(e instanceof x)return e;if(!(this instanceof x))return new x(e);this._wrapped=e};typeof exports!="undefined"?(typeof module!="undefined"&&module.exports&&(exports=module.exports=x),exports._=x):e._=x,x.VERSION="1.4.3";var T=x.each=x.forEach=function(e,t,r){if(e==null)return;if(c&&e.forEach===c)e.forEach(t,r);else if(e.length===+e.length){for(var i=0,s=e.length;i<s;i++)if(t.call(r,e[i],i,e)===n)return}else for(var o in e)if(x.has(e,o)&&t.call(r,e[o],o,e)===n)return};x.map=x.collect=function(e,t,n){var r=[];return e==null?r:h&&e.map===h?e.map(t,n):(T(e,function(e,i,s){r[r.length]=t.call(n,e,i,s)}),r)};var N="Reduce of empty array with no initial value";x.reduce=x.foldl=x.inject=function(e,t,n,r){var i=arguments.length>2;e==null&&(e=[]);if(p&&e.reduce===p)return r&&(t=x.bind(t,r)),i?e.reduce(t,n):e.reduce(t);T(e,function(e,s,o){i?n=t.call(r,n,e,s,o):(n=e,i=!0)});if(!i)throw new TypeError(N);return n},x.reduceRight=x.foldr=function(e,t,n,r){var i=arguments.length>2;e==null&&(e=[]);if(d&&e.reduceRight===d)return r&&(t=x.bind(t,r)),i?e.reduceRight(t,n):e.reduceRight(t);var s=e.length;if(s!==+s){var o=x.keys(e);s=o.length}T(e,function(u,a,f){a=o?o[--s]:--s,i?n=t.call(r,n,e[a],a,f):(n=e[a],i=!0)});if(!i)throw new TypeError(N);return n},x.find=x.detect=function(e,t,n){var r;return C(e,function(e,i,s){if(t.call(n,e,i,s))return r=e,!0}),r},x.filter=x.select=function(e,t,n){var r=[];return e==null?r:v&&e.filter===v?e.filter(t,n):(T(e,function(e,i,s){t.call(n,e,i,s)&&(r[r.length]=e)}),r)},x.reject=function(e,t,n){return x.filter(e,function(e,r,i){return!t.call(n,e,r,i)},n)},x.every=x.all=function(e,t,r){t||(t=x.identity);var i=!0;return e==null?i:m&&e.every===m?e.every(t,r):(T(e,function(e,s,o){if(!(i=i&&t.call(r,e,s,o)))return n}),!!i)};var C=x.some=x.any=function(e,t,r){t||(t=x.identity);var i=!1;return e==null?i:g&&e.some===g?e.some(t,r):(T(e,function(e,s,o){if(i||(i=t.call(r,e,s,o)))return n}),!!i)};x.contains=x.include=function(e,t){return e==null?!1:y&&e.indexOf===y?e.indexOf(t)!=-1:C(e,function(e){return e===t})},x.invoke=function(e,t){var n=u.call(arguments,2);return x.map(e,function(e){return(x.isFunction(t)?t:e[t]).apply(e,n)})},x.pluck=function(e,t){return x.map(e,function(e){return e[t]})},x.where=function(e,t){return x.isEmpty(t)?[]:x.filter(e,function(e){for(var n in t)if(t[n]!==e[n])return!1;return!0})},x.max=function(e,t,n){if(!t&&x.isArray(e)&&e[0]===+e[0]&&e.length<65535)return Math.max.apply(Math,e);if(!t&&x.isEmpty(e))return-Infinity;var r={computed:-Infinity,value:-Infinity};return T(e,function(e,i,s){var o=t?t.call(n,e,i,s):e;o>=r.computed&&(r={value:e,computed:o})}),r.value},x.min=function(e,t,n){if(!t&&x.isArray(e)&&e[0]===+e[0]&&e.length<65535)return Math.min.apply(Math,e);if(!t&&x.isEmpty(e))return Infinity;var r={computed:Infinity,value:Infinity};return T(e,function(e,i,s){var o=t?t.call(n,e,i,s):e;o<r.computed&&(r={value:e,computed:o})}),r.value},x.shuffle=function(e){var t,n=0,r=[];return T(e,function(e){t=x.random(n++),r[n-1]=r[t],r[t]=e}),r};var k=function(e){return x.isFunction(e)?e:function(t){return t[e]}};x.sortBy=function(e,t,n){var r=k(t);return x.pluck(x.map(e,function(e,t,i){return{value:e,index:t,criteria:r.call(n,e,t,i)}}).sort(function(e,t){var n=e.criteria,r=t.criteria;if(n!==r){if(n>r||n===void 0)return 1;if(n<r||r===void 0)return-1}return e.index<t.index?-1:1}),"value")};var L=function(e,t,n,r){var i={},s=k(t||x.identity);return T(e,function(t,o){var u=s.call(n,t,o,e);r(i,u,t)}),i};x.groupBy=function(e,t,n){return L(e,t,n,function(e,t,n){(x.has(e,t)?e[t]:e[t]=[]).push(n)})},x.countBy=function(e,t,n){return L(e,t,n,function(e,t){x.has(e,t)||(e[t]=0),e[t]++})},x.sortedIndex=function(e,t,n,r){n=n==null?x.identity:k(n);var i=n.call(r,t),s=0,o=e.length;while(s<o){var u=s+o>>>1;n.call(r,e[u])<i?s=u+1:o=u}return s},x.toArray=function(e){return e?x.isArray(e)?u.call(e):e.length===+e.length?x.map(e,x.identity):x.values(e):[]},x.size=function(e){return e==null?0:e.length===+e.length?e.length:x.keys(e).length},x.first=x.head=x.take=function(e,t,n){return e==null?void 0:t!=null&&!n?u.call(e,0,t):e[0]},x.initial=function(e,t,n){return u.call(e,0,e.length-(t==null||n?1:t))},x.last=function(e,t,n){return e==null?void 0:t!=null&&!n?u.call(e,Math.max(e.length-t,0)):e[e.length-1]},x.rest=x.tail=x.drop=function(e,t,n){return u.call(e,t==null||n?1:t)},x.compact=function(e){return x.filter(e,x.identity)};var A=function(e,t,n){return T(e,function(e){x.isArray(e)?t?o.apply(n,e):A(e,t,n):n.push(e)}),n};x.flatten=function(e,t){return A(e,t,[])},x.without=function(e){return x.difference(e,u.call(arguments,1))},x.uniq=x.unique=function(e,t,n,r){x.isFunction(t)&&(r=n,n=t,t=!1);var i=n?x.map(e,n,r):e,s=[],o=[];return T(i,function(n,r){if(t?!r||o[o.length-1]!==n:!x.contains(o,n))o.push(n),s.push(e[r])}),s},x.union=function(){return x.uniq(a.apply(r,arguments))},x.intersection=function(e){var t=u.call(arguments,1);return x.filter(x.uniq(e),function(e){return x.every(t,function(t){return x.indexOf(t,e)>=0})})},x.difference=function(e){var t=a.apply(r,u.call(arguments,1));return x.filter(e,function(e){return!x.contains(t,e)})},x.zip=function(){var e=u.call(arguments),t=x.max(x.pluck(e,"length")),n=new Array(t);for(var r=0;r<t;r++)n[r]=x.pluck(e,""+r);return n},x.object=function(e,t){if(e==null)return{};var n={};for(var r=0,i=e.length;r<i;r++)t?n[e[r]]=t[r]:n[e[r][0]]=e[r][1];return n},x.indexOf=function(e,t,n){if(e==null)return-1;var r=0,i=e.length;if(n){if(typeof n!="number")return r=x.sortedIndex(e,t),e[r]===t?r:-1;r=n<0?Math.max(0,i+n):n}if(y&&e.indexOf===y)return e.indexOf(t,n);for(;r<i;r++)if(e[r]===t)return r;return-1},x.lastIndexOf=function(e,t,n){if(e==null)return-1;var r=n!=null;if(b&&e.lastIndexOf===b)return r?e.lastIndexOf(t,n):e.lastIndexOf(t);var i=r?n:e.length;while(i--)if(e[i]===t)return i;return-1},x.range=function(e,t,n){arguments.length<=1&&(t=e||0,e=0),n=arguments[2]||1;var r=Math.max(Math.ceil((t-e)/n),0),i=0,s=new Array(r);while(i<r)s[i++]=e,e+=n;return s};var O=function(){};x.bind=function(e,t){var n,r;if(e.bind===S&&S)return S.apply(e,u.call(arguments,1));if(!x.isFunction(e))throw new TypeError;return n=u.call(arguments,2),r=function(){if(this instanceof r){O.prototype=e.prototype;var i=new O;O.prototype=null;var s=e.apply(i,n.concat(u.call(arguments)));return Object(s)===s?s:i}return e.apply(t,n.concat(u.call(arguments)))}},x.bindAll=function(e){var t=u.call(arguments,1);return t.length==0&&(t=x.functions(e)),T(t,function(t){e[t]=x.bind(e[t],e)}),e},x.memoize=function(e,t){var n={};return t||(t=x.identity),function(){var r=t.apply(this,arguments);return x.has(n,r)?n[r]:n[r]=e.apply(this,arguments)}},x.delay=function(e,t){var n=u.call(arguments,2);return setTimeout(function(){return e.apply(null,n)},t)},x.defer=function(e){return x.delay.apply(x,[e,1].concat(u.call(arguments,1)))},x.throttle=function(e,t){var n,r,i,s,o=0,u=function(){o=new Date,i=null,s=e.apply(n,r)};return function(){var a=new Date,f=t-(a-o);return n=this,r=arguments,f<=0?(clearTimeout(i),i=null,o=a,s=e.apply(n,r)):i||(i=setTimeout(u,f)),s}},x.debounce=function(e,t,n){var r,i;return function(){var s=this,o=arguments,u=function(){r=null,n||(i=e.apply(s,o))},a=n&&!r;return clearTimeout(r),r=setTimeout(u,t),a&&(i=e.apply(s,o)),i}},x.once=function(e){var t=!1,n;return function(){return t?n:(t=!0,n=e.apply(this,arguments),e=null,n)}},x.wrap=function(e,t){return function(){var n=[e];return o.apply(n,arguments),t.apply(this,n)}},x.compose=function(){var e=arguments;return function(){var t=arguments;for(var n=e.length-1;n>=0;n--)t=[e[n].apply(this,t)];return t[0]}},x.after=function(e,t){return e<=0?t():function(){if(--e<1)return t.apply(this,arguments)}},x.keys=E||function(e){if(e!==Object(e))throw new TypeError("Invalid object");var t=[];for(var n in e)x.has(e,n)&&(t[t.length]=n);return t},x.values=function(e){var t=[];for(var n in e)x.has(e,n)&&t.push(e[n]);return t},x.pairs=function(e){var t=[];for(var n in e)x.has(e,n)&&t.push([n,e[n]]);return t},x.invert=function(e){var t={};for(var n in e)x.has(e,n)&&(t[e[n]]=n);return t},x.functions=x.methods=function(e){var t=[];for(var n in e)x.isFunction(e[n])&&t.push(n);return t.sort()},x.extend=function(e){return T(u.call(arguments,1),function(t){if(t)for(var n in t)e[n]=t[n]}),e},x.pick=function(e){var t={},n=a.apply(r,u.call(arguments,1));return T(n,function(n){n in e&&(t[n]=e[n])}),t},x.omit=function(e){var t={},n=a.apply(r,u.call(arguments,1));for(var i in e)x.contains(n,i)||(t[i]=e[i]);return t},x.defaults=function(e){return T(u.call(arguments,1),function(t){if(t)for(var n in t)e[n]==null&&(e[n]=t[n])}),e},x.clone=function(e){return x.isObject(e)?x.isArray(e)?e.slice():x.extend({},e):e},x.tap=function(e,t){return t(e),e};var M=function(e,t,n,r){if(e===t)return e!==0||1/e==1/t;if(e==null||t==null)return e===t;e instanceof x&&(e=e._wrapped),t instanceof x&&(t=t._wrapped);var i=f.call(e);if(i!=f.call(t))return!1;switch(i){case"[object String]":return e==String(t);case"[object Number]":return e!=+e?t!=+t:e==0?1/e==1/t:e==+t;case"[object Date]":case"[object Boolean]":return+e==+t;case"[object RegExp]":return e.source==t.source&&e.global==t.global&&e.multiline==t.multiline&&e.ignoreCase==t.ignoreCase}if(typeof e!="object"||typeof t!="object")return!1;var s=n.length;while(s--)if(n[s]==e)return r[s]==t;n.push(e),r.push(t);var o=0,u=!0;if(i=="[object Array]"){o=e.length,u=o==t.length;if(u)while(o--)if(!(u=M(e[o],t[o],n,r)))break}else{var a=e.constructor,l=t.constructor;if(a!==l&&!(x.isFunction(a)&&a instanceof a&&x.isFunction(l)&&l instanceof l))return!1;for(var c in e)if(x.has(e,c)){o++;if(!(u=x.has(t,c)&&M(e[c],t[c],n,r)))break}if(u){for(c in t)if(x.has(t,c)&&!(o--))break;u=!o}}return n.pop(),r.pop(),u};x.isEqual=function(e,t){return M(e,t,[],[])},x.isEmpty=function(e){if(e==null)return!0;if(x.isArray(e)||x.isString(e))return e.length===0;for(var t in e)if(x.has(e,t))return!1;return!0},x.isElement=function(e){return!!e&&e.nodeType===1},x.isArray=w||function(e){return f.call(e)=="[object Array]"},x.isObject=function(e){return e===Object(e)},T(["Arguments","Function","String","Number","Date","RegExp"],function(e){x["is"+e]=function(t){return f.call(t)=="[object "+e+"]"}}),x.isArguments(arguments)||(x.isArguments=function(e){return!!e&&!!x.has(e,"callee")}),typeof /./!="function"&&(x.isFunction=function(e){return typeof e=="function"}),x.isFinite=function(e){return isFinite(e)&&!isNaN(parseFloat(e))},x.isNaN=function(e){return x.isNumber(e)&&e!=+e},x.isBoolean=function(e){return e===!0||e===!1||f.call(e)=="[object Boolean]"},x.isNull=function(e){return e===null},x.isUndefined=function(e){return e===void 0},x.has=function(e,t){return l.call(e,t)},x.noConflict=function(){return e._=t,this},x.identity=function(e){return e},x.times=function(e,t,n){var r=Array(e);for(var i=0;i<e;i++)r[i]=t.call(n,i);return r},x.random=function(e,t){return t==null&&(t=e,e=0),e+(0|Math.random()*(t-e+1))};var _={escape:{"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;","/":"&#x2F;"}};_.unescape=x.invert(_.escape);var D={escape:new RegExp("["+x.keys(_.escape).join("")+"]","g"),unescape:new RegExp("("+x.keys(_.unescape).join("|")+")","g")};x.each(["escape","unescape"],function(e){x[e]=function(t){return t==null?"":(""+t).replace(D[e],function(t){return _[e][t]})}}),x.result=function(e,t){if(e==null)return null;var n=e[t];return x.isFunction(n)?n.call(e):n},x.mixin=function(e){T(x.functions(e),function(t){var n=x[t]=e[t];x.prototype[t]=function(){var e=[this._wrapped];return o.apply(e,arguments),F.call(this,n.apply(x,e))}})};var P=0;x.uniqueId=function(e){var t=""+ ++P;return e?e+t:t},x.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var H=/(.)^/,B={"'":"'","\\":"\\","\r":"r","\n":"n"," ":"t","\u2028":"u2028","\u2029":"u2029"},j=/\\|'|\r|\n|\t|\u2028|\u2029/g;x.template=function(e,t,n){n=x.defaults({},n,x.templateSettings);var r=new RegExp([(n.escape||H).source,(n.interpolate||H).source,(n.evaluate||H).source].join("|")+"|$","g"),i=0,s="__p+='";e.replace(r,function(t,n,r,o,u){return s+=e.slice(i,u).replace(j,function(e){return"\\"+B[e]}),n&&(s+="'+\n((__t=("+n+"))==null?'':_.escape(__t))+\n'"),r&&(s+="'+\n((__t=("+r+"))==null?'':__t)+\n'"),o&&(s+="';\n"+o+"\n__p+='"),i=u+t.length,t}),s+="';\n",n.variable||(s="with(obj||{}){\n"+s+"}\n"),s="var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');};\n"+s+"return __p;\n";try{var o=new Function(n.variable||"obj","_",s)}catch(u){throw u.source=s,u}if(t)return o(t,x);var a=function(e){return o.call(this,e,x)};return a.source="function("+(n.variable||"obj")+"){\n"+s+"}",a},x.chain=function(e){return x(e).chain()};var F=function(e){return this._chain?x(e).chain():e};x.mixin(x),T(["pop","push","reverse","shift","sort","splice","unshift"],function(e){var t=r[e];x.prototype[e]=function(){var n=this._wrapped;return t.apply(n,arguments),(e=="shift"||e=="splice")&&n.length===0&&delete n[0],F.call(this,n)}}),T(["concat","join","slice"],function(e){var t=r[e];x.prototype[e]=function(){return F.call(this,t.apply(this._wrapped,arguments))}}),x.extend(x.prototype,{chain:function(){return this._chain=!0,this},value:function(){return this._wrapped}})}).call(this),function(){var e=0,t=["ms","moz","webkit","o"];for(var n=0;n<t.length&&!window.requestAnimationFrame;++n)window.requestAnimationFrame=window[t[n]+"RequestAnimationFrame"],window.cancelAnimationFrame=window[t[n]+"CancelAnimationFrame"]||window[t[n]+"CancelRequestAnimationFrame"];window.requestAnimationFrame||(window.requestAnimationFrame=function(t,n){var r=(new Date).getTime(),i=Math.max(0,16-(r-e)),s=window.setTimeout(function(){t(r+i)},i);return e=r+i,s}),window.cancelAnimationFrame||(window.cancelAnimationFrame=function(e){clearTimeout(e)})}(),function(e){function s(){if(!n.length)return;var e=+(new Date),t=[],r,i;for(var o=0;o<n.length;o++){r=n[o];var i=r.options;r.pos===1||r.endTime<=e?(i.step.call(r,r.pos=1),r.stop()):(r.pos=i.easing(e-r.startTime,0,1,i.duration),i.step.call(r,r.pos),t.push(r))}n=t,n.length&&requestAnimationFrame(s)}function o(e){_.indexOf(n,e)==-1&&(n.push(e),n.length==1&&s())}function u(e){this.options=_.extend({},r,e||{});var t=this.options.easing;if(_.isString(t)){if(!i[t])throw'Unknown "'+t+'" easing function';this.options.easing=i[t]}if(!_.isFunction(this.options.easing))throw"Easing should be a function";this._id=_.uniqueId("tw"),this.options.autostart&&this.start()}var t=function(){},n=[],r={duration:500,easing:"linear",step:t,complete:t,autostart:!0},i={linear:function(e,t,n,r){return n*e/r+t},easeInQuad:function(e,t,n,r){return n*(e/=r)*e+t},easeOutQuad:function(e,t,n,r){return-n*(e/=r)*(e-2)+t},easeInOutQuad:function(e,t,n,r){return(e/=r/2)<1?n/2*e*e+t:-n/2*(--e*(e-2)-1)+t},easeInCubic:function(e,t,n,r){return n*(e/=r)*e*e+t},easeOutCubic:function(e,t,n,r){return n*((e=e/r-1)*e*e+1)+t},easeInOutCubic:function(e,t,n,r){return(e/=r/2)<1?n/2*e*e*e+t:n/2*((e-=2)*e*e+2)+t},easeInExpo:function(e,t,n,r){return e==0?t:n*Math.pow(2,10*(e/r-1))+t-n*.001},easeOutExpo:function(e,t,n,r){return e==r?t+n:n*1.001*(-Math.pow(2,-10*e/r)+1)+t},easeInOutExpo:function(e,t,n,r){return e==0?t:e==r?t+n:(e/=r/2)<1?n/2*Math.pow(2,10*(e-1))+t-n*5e-4:n/2*1.0005*(-Math.pow(2,-10*--e)+2)+t},easeInElastic:function(e,t,n,r,i,s){var o;return e==0?t:(e/=r)==1?t+n:(s||(s=r*.3),!i||i<Math.abs(n)?(i=n,o=s/4):o=s/(2*Math.PI)*Math.asin(n/i),-(i*Math.pow(2,10*(e-=1))*Math.sin((e*r-o)*2*Math.PI/s))+t)},easeOutElastic:function(e,t,n,r,i,s){var o;return e==0?t:(e/=r)==1?t+n:(s||(s=r*.3),!i||i<Math.abs(n)?(i=n,o=s/4):o=s/(2*Math.PI)*Math.asin(n/i),i*Math.pow(2,-10*e)*Math.sin((e*r-o)*2*Math.PI/s)+n+t)},easeInOutElastic:function(e,t,n,r,i,s){var o;return e==0?t:(e/=r/2)==2?t+n:(s||(s=r*.3*1.5),!i||i<Math.abs(n)?(i=n,o=s/4):o=s/(2*Math.PI)*Math.asin(n/i),e<1?-0.5*i*Math.pow(2,10*(e-=1))*Math.sin((e*r-o)*2*Math.PI/s)+t:i*Math.pow(2,-10*(e-=1))*Math.sin((e*r-o)*2*Math.PI/s)*.5+n+t)},easeInBack:function(e,t,n,r,i){return i==undefined&&(i=1.70158),n*(e/=r)*e*((i+1)*e-i)+t},easeOutBack:function(e,t,n,r,i){return i==undefined&&(i=1.70158),n*((e=e/r-1)*e*((i+1)*e+i)+1)+t},easeInOutBack:function(e,t,n,r,i){return i==undefined&&(i=1.70158),(e/=r/2)<1?n/2*e*e*(((i*=1.525)+1)*e-i)+t:n/2*((e-=2)*e*(((i*=1.525)+1)*e+i)+2)+t},easeInBounce:function(e,t,n,r){return n-$.easing.easeOutBounce(x,r-e,0,n,r)+t},easeOutBounce:function(e,t,n,r){return(e/=r)<1/2.75?n*7.5625*e*e+t:e<2/2.75?n*(7.5625*(e-=1.5/2.75)*e+.75)+t:e<2.5/2.75?n*(7.5625*(e-=2.25/2.75)*e+.9375)+t:n*(7.5625*(e-=2.625/2.75)*e+.984375)+t},easeInOutBounce:function(e,t,n,r){return e<r/2?$.easing.easeInBounce(x,e*2,0,n,r)*.5+t:$.easing.easeOutBounce(x,e*2-r,0,n,r)*.5+n*.5+t}};u.prototype={start:function(){this.pos=0,this.startTime=+(new Date),this.endTime=this.startTime+this.options.duration,this.animating=!0,o(this)},stop:function(){this.animating=!1,this.options.complete()}},u.__getAnims=function(){return n},e.Tween=u}(this),function(e){"use strict";function n(e){return e.replace(/\-(\w)/g,function(e,t){return t.toUpperCase()})}function r(e,r){var i=/^-?\d+(?:px)?$/i,s=/^-?\d(?:\.\d+)?/,o=/\d$/,u=n(r);if(e.style[u])return e.style[u];if(t){var a=window.getComputedStyle(e,"");return a.getPropertyValue(r)}if(e.currentStyle){var f=e.currentStyle[r]||e.currentStyle[u],l=e.style||e;if(!i.test(f)&&s.test(f)){var c=l.left,h=e.runtimeStyle.left;e.runtimeStyle.left=e.currentStyle.left;var p=o.test(f)?"em":"";l.left=u==="fontSize"?"1em":f+p||0,f=l.pixelLeft+"px",l.left=c,e.runtimeStyle.left=h}return f}}function i(e,t){if(!e)return;var n={"line-height":1,"z-index":1,opacity:1},r=_.map(t,function(e,t){var r=t.replace(/([A-Z])/g,"-$1").toLowerCase();return r+":"+(!_.isNumber(e)||r in n?e:e+"px")});e.style.cssText+=";"+r.join(";")}function s(e){return _.isArray(e)?e:[e]}var t=document.defaultView&&document.defaultView.getComputedStyle;_.extend(e,{trim:function(e){return e&&"trim"in String.prototype?e.trim():e.replace(/^\s+/,"").replace(/\s+$/,"")},hasClass:function(e,t){return~(" "+e.className+" ").indexOf(" "+t+" ")},addClass:function(e,t){return _.each(s(e),function(e){var n=_.filter(t.split(/\s+/g),function(t){return t&&!this.hasClass(e,t)},this);n.length&&(e.className+=(e.className?" ":"")+n.join(" "))},this),e},removeClass:function(e,t){return _.each(s(e),function(e){var n=e.className||"";_.each(t.split(/\s+/g),function(e){n=n.replace(new RegExp("\\b"+e+"\\b"),"")}),e.className=this.trim(n)},this),e},toggleClass:function(e,t,n){return _.each(s(e),function(e){var r=n;_.isUndefined(r)&&(r=this.hasClass(e,t)),r?this.removeClass(e,t):this.addClass(e,t)},this),e},getByClass:function(e,t){return document.getElementsByClassName?(t||document).getElementsByClassName(e):_.filter((t||document).getElementsByTagName("*"),function(t){return this.hasClass(t,e)},this)},remove:function(e){return _.each(s(e),function(e){e.parentNode&&e.parentNode.removeChild(e)}),e},toDOM:function(e){var t=document.createElement("div");return t.innerHTML=e,t.firstChild},css:function(e,t,n){if(_.isString(t)&&_.isUndefined(n))return r(e,t);if(_.isString(t)){var s={};s[t]=n,t=s}i(e,t)}})}(_.dom={}),CodeMirror.scenario=function(){"use strict";function u(e){var t=["Webkit","Moz","O","ms"],n=e.charAt(0).toUpperCase()+e.slice(1),r=(e+" "+t.join(n+" ")+n).split(" "),i=document.createElement("div"),s=null;for(var o in r){s=r[o];if(i.style[s]!==undefined)return s}return s}function f(e){if(_.isString(e)){var t=e.split(":");return{name:t.shift(),options:t.join(":")}}var n=_.keys(e)[0];return{name:n,options:e[n]}}function l(e,t,n){if(_.isString(e)){var r={};r[t]=e,e=r}return _.extend(n,e||{})}function c(e,t){if(_.isString(e)){if(e==="caret")return t.getCursor(!0);if(~e.indexOf(":")){var n=e.split(":");return{line:parseInt(n[0],10),ch:parseInt(n[1],10)}}e=parseInt(e,10)}return _.isNumber(e)?t.posFromIndex(e):e}function h(e,t){if(!!t)return setTimeout(e,t);e()}function p(t,n){this._actions=t,this._actionIx=0,this._editor=null,this._state=e,this._timerQueue=[],n&&"getValue"in n&&(this._editor=n);var r=this._editor;r&&!r.__initial&&(r.__initial={content:r.getValue(),pos:r.getCursor(!0)})}var e="idle",t="play",n="pause",r=/\s+/,i=Array.prototype.slice,s={beforeDelay:1e3,afterDelay:1e3},o=function(){var e=document.createElement("div"),t=u("transform");return t?(e.style[t]="translateZ(0)",/translatez/i.test(e.style[t])):!1}(),a={type:function(e,t,n,r){e=l(e,"text",{text:"",delay:60,pos:null});if(!e.text)throw'No text provided for "type" action';e.pos!==null&&t.setCursor(c(e.pos,t));var i=e.text.split("");r(function s(){var o=i.shift();t.replaceSelection(o,"end"),i.length?r(s,e.delay):n()},e.delay)},wait:function(e,t,n,r){e=l(e,"timeout",{timeout:100}),r(n,parseInt(e.timeout,10))},moveTo:function(e,t,n,r){e=l(e,"pos",{delay:80,immediate:!1});if(!e.pos)throw'No position specified for "moveTo" action';var i=t.getCursor(!0);t.setSelection(i,i);var s=c(e.pos,t);e.immediate&&(t.setCursor(s),n());var o=s.line-i.line,u=s.ch-i.ch,a=Math.max(u,o),f=o<0?-1:1,h=u<0?-1:1;r(function p(){i=t.getCursor(!0),a>0&&(i.line!=s.line||i.ch!=s.ch)?(i.line!=s.line&&(i.line+=f),i.ch!=s.ch&&(i.ch+=h),t.setCursor(i),a--,r(p,e.delay)):(t.setCursor(s),n())},e.delay)},jumpTo:function(e,t,n,r){e=l(e,"pos",{afterDelay:200});if(!e.pos)throw'No position specified for "jumpTo" action';t.setCursor(c(e.pos,t)),r(n,e.afterDelay)},run:function(e,t,n,r){e=l(e,"command",{beforeDelay:500,times:1});var i=e.times;r(function s(){try{_.isFunction(e.command)?e.command(t,e):t.execCommand(e.command)}catch(o){}--i>0?r(s,e.beforeDelay):n()},e.beforeDelay)},select:function(e,t,n,r){e=l(e,"to",{from:"caret"});var i=c(e.from,t),s=c(e.to,t);t.setSelection(i,s),n()}};return CodeMirror.commands.revert=function(e){e.__initial&&(e.setValue(e.__initial.content),e.setCursor(e.__initial.pos))},p.prototype={_setup:function(e){return!e&&this._editor&&(e=this._editor),e.execCommand("revert"),e},play:function(e){if(this._state===t)return;if(this._state===n){e=e||this._editor,e.focus();var r=null;while(r=this._timerQueue.shift())h(r.fn,r.delay);this._state=t,this.trigger("resume");return}this._editor=e=this._setup(e),e.focus();var i=_.bind(this.requestTimer,this),o=this;this._actionIx=0;var u=function(){if(o._actionIx>=o._actions.length)return i(function(){o.stop()},s.afterDelay);o.trigger("action",o._actionIx);var t=f(o._actions[o._actionIx++]);if(!(t.name in a))throw"No such action: "+t.name;a[t.name].call(o,t.options,e,u,i)};this._state=t,this._editor.setOption("readOnly",!0),this.trigger("play"),i(u,s.beforeDelay)},pause:function(){this._state=n,this.trigger("pause")},stop:function(){this._state!==e&&(this._state=e,this._timerQueue.length=0,this._editor.setOption("readOnly",!1),this.trigger("stop"))},state:function(){return this._state},toggle:function(){this._state===t?this.pause():this.play()},requestTimer:function(e,n){if(this._state===t)return h(e,n);this._timerQueue.push({fn:e,delay:n})},on:function(e,t,n){var i,s,o,u,a;if(!t)return this;e=e.split(r),i=this._callbacks||(this._callbacks={});while(s=e.shift())a=i[s],o=a?a.tail:{},o.next=u={},o.context=n,o.callback=t,i[s]={tail:u,next:a?a.next:o};return this},off:function(e,t,n){var i,s,o,u,a,f;if(!(s=this._callbacks))return;if(!(e||t||n))return delete this._callbacks,this;e=e?e.split(r):_.keys(s);while(i=e.shift()){o=s[i],delete s[i];if(!o||!t&&!n)continue;u=o.tail;while((o=o.next)!==u)a=o.callback,f=o.context,(t&&a!==t||n&&f!==n)&&this.on(i,a,f)}return this},trigger:function(e){var t,n,s,o,u,a,f;if(!(s=this._callbacks))return this;a=s.all,e=e.split(r),f=i.call(arguments,1);while(t=e.shift()){if(n=s[t]){o=n.tail;while((n=n.next)!==o)n.callback.apply(n.context||this,f)}if(n=a){o=n.tail,u=[t].concat(f);while((n=n.next)!==o)n.callback.apply(n.context||this,u)}}return this}},_.extend(function(e,t){return new p(e,t)},{defineAction:function(e,t){a[e]=t},makeOptions:l,makePos:c,has3d:o,prefixed:u})}(),CodeMirror.scenarioTooltip=function(){"use strict";function i(){var e=document.body,t=document.documentElement,n=t.clientTop||e.clientTop||0,r=t.clientLeft||e.clientLeft||0,i=window.pageYOffset||t.scrollTop||e.scrollTop,s=window.pageXOffset||t.scrollLeft||e.scrollLeft;return{top:i-n,left:s-r,width:e.clientWidth||t.clientWidth,height:e.clientHeight||t.clientHeight}}function s(e,t){t=_.extend({},r,t||{}),_.dom.css(e,{left:0,top:0});var n=_.dom.getByClass(t.tailClass,e)[0],s=0,o=0,u=t.position,a=i(),f=e.offsetWidth,l=e.offsetHeight,c;s=Math.min(a.width-f-t.popupMargin,Math.max(t.popupMargin,u.x-a.left-f/2)),l+n.offsetHeight+t.popupMargin+a.top<u.y?(o=Math.max(0,u.y-l-n.offsetHeight),c=!0):(o=u.y+n.offsetHeight,c=!1);var h=t.tailMargin,p=f-t.tailMargin;n.style.left=Math.min(p,Math.max(h,u.x-s-a.left))+"px",_.dom.css(e,{left:s,top:o}),_.dom.toggleClass(e,t.belowClass,c)}function o(e,i){i=_.extend({},r,i||{});var s=n.prefixed("transformOrigin"),o=n.prefixed("transform"),u=e.style,a=_.dom.getByClass(i.tailClass,e)[0],f=_.dom.css(a,"left"),l=a.offsetTop;_.dom.hasClass(e,i.belowClass)&&(l-=a.offsetHeight),l+="px",u[s]=f+" "+l;var c=n.has3d?"translateZ(0) ":"";return t=new Tween({duration:800,easing:"easeOutElastic",step:function(e){u[o]=c+"scale("+e+")"},complete:function(){t=null,i.onComplete&&i.onComplete(e)}})}function u(e,t){var n=e.style;return new Tween({duration:200,easing:"linear",step:function(e){n.opacity=1-e},complete:function(){_.dom.remove(e),t.onComplete&&t.onComplete(e)}})}function a(t,r,i){f(),e=_.dom.toDOM('<div class="CodeMirror-tooltip"><div class="CodeMirror-tooltip__content">'+t+"</div>"+'<div class="CodeMirror-tooltip__tail"></div>'+"</div>"),_.dom.css(e,n.prefixed("transform"),"scale(0)"),document.body.appendChild(e),s(e,{position:r}),o(e,{onComplete:i})}function f(n){e?(t&&(t.stop(),t=null),u(e,{onComplete:n}),e=null):n&&n()}function l(e,t){return e==="caret"?t.cursorCoords(!0):e&&"x"in e&&"y"in e?e:t.charCoords(n.makePos(e))}var e=null,t=null,n=CodeMirror.scenario,r={tailClass:"CodeMirror-tooltip__tail",belowClass:"CodeMirror-tooltip_below",popupMargin:5,tailMargin:11};return n.defineAction("tooltip",function(e,t,r,i){e=n.makeOptions(e,"text",{wait:4e3,pos:"caret"});var s=l(e.pos,t);a(e.text,s,function(){i(function(){f(function(){i(r)})},e.wait)})}),n.defineAction("showTooltip",function(e,t,r,i){e=n.makeOptions(e,"text",{pos:"caret"}),a(e.text,l(e.pos,t)),r()}),n.defineAction("hideTooltip",function(e,t,n,r){f(n)}),{show:a,hide:f}}(),CodeMirror.scenarioOutline=function(){"use strict";var e={wrapperTemplate:'<ul class="CodeMirror-outline"><%= content %></ul>',itemTemplate:'<li data-action-id="<%= id %>" class="CodeMirror-outline__item"><%= title %></li>',itemClass:"CodeMirror-outline__item",selectedClass:"CodeMirror-outline__item_selected"};return function(t,n,r){r=_.extend({},e,r||{});var i=_.keys(t);i.sort(function(e,t){return parseInt(e,10)-parseInt(t,10)});var s=_.template(r.itemTemplate),o=_.map(i,function(e){return s({title:t[e],id:e})}),u=_.dom.toDOM(_.template(r.wrapperTemplate,{content:o.join("")}));return r.target&&r.target.appendChild(u),n.on("action",function(e){var t=_.dom.getByClass(r.itemClass,u),n=_.find(t,function(t){return t.getAttribute("data-action-id")==e});n&&(_.dom.removeClass(t,r.selectedClass),_.dom.addClass(n,r.selectedClass))}).on("stop",function(){_.dom.removeClass(_.dom.getByClass(r.itemClass,u),r.selectedClass)}),u}}(),CodeMirror.scenarioPrompt=function(){"use strict";function i(n,r,i){s(),e=_.dom.toDOM('<div class="CodeMirror-prompt"><div class="CodeMirror-prompt__title">'+n+"</div>"+'<input type="text" name="prompt" class="CodeMirror-prompt__input" readonly="readonly" />'+"</div>"),t=_.dom.toDOM('<div class="CodeMirror-prompt__shade"></div>'),r.appendChild(e),r.appendChild(t),o(e,t,{onComplete:i})}function s(r){e?(n&&(n.stop(),n=null),u(e,t,{onComplete:r}),e=t=null):r&&r()}function o(e,t,i){i=i||{};var s=r.prefixed("transform"),o=e.style,u=t.style,a=e.offsetHeight,f=_.template(r.has3d?"translate3d(0, <%= pos %>, 0)":"translate(0, <%= pos %>)");return u.opacity=0,new Tween({duration:200,step:function(e){u.opacity=e}}),o[s]=f({pos:-a}),n=new Tween({duration:400,easing:"easeOutCubic",step:function(e){o[s]=f({pos:-a*(1-e)+"px"})},complete:function(){n=null,i.onComplete&&i.onComplete(e,t)}})}function u(e,t,n){var i=e.style,s=t.style,o=e.offsetHeight,u=r.prefixed("transform"),a=_.template(r.has3d?"translate3d(0, <%= pos %>, 0)":"translate(0, <%= pos %>)");return new Tween({duration:200,step:function(e){i[u]=a({pos:-o*e+"px"}),s.opacity=1-e},complete:function(){_.dom.remove([e,t]),n.onComplete&&n.onComplete(e,t)}})}function a(e,t,n,r){var i=t.text.split("");n(function s(){e.value+=i.shift(),i.length?n(s,t.delay):r()},t.delay)}var e=null,t=null,n=null,r=CodeMirror.scenario;r.defineAction("prompt",function(e,t,n,o){e=r.makeOptions(e,"text",{title:"Enter something",delay:80,typeDelay:1e3,hideDelay:2e3}),i(e.title,t.getWrapperElement(),function(t){o(function(){a(_.dom.getByClass("CodeMirror-prompt__input",t)[0],e,o,function(){o(function(){s(n)},e.hideDelay)})},e.typeDelay)})})}(),function(){"use strict";function s(e,i){i=i||{};var s=/ctrl|alt|shift|cmd/i,o=t?n:r;return e.replace(/\((.+?)\)/g,function(e,n){if(s.test(n)){var r=_.map(n.toLowerCase().split(/[\-\+]/),function(e){return o[e.toLowerCase()]||e.toUpperCase()});e=r.join(t?"":"+"),i.stripParentheses||(e="("+e+")")}return e})}function o(e){try{return(new Function("return "+e))()}catch(t){return{}}}function u(e){var t="\n",n=(e||"").replace(/\r\n/g,t).replace(/\n\r/g,t).replace(/\r/g,t).split(t);return _.filter(n,function(e){return!!e})}function a(e){var t={"&lt;":"<","&gt;":">","&amp;":"&"};return e.replace(/&(lt|gt|amp);/g,function(e,n){return t[e]||e})}function f(e,t){t=_.extend({},i,t||{});var n=e.split(t.sectionSeparator),r=/^(\w+)\s*:\s*(.+)$/,f=[],l={},c={};return _.each(u(n[1]),function(e){if(e.charAt(0)=="#")return;e=e.replace(t.outlineSeparator,function(e,n){return t.prettifyKeys&&(l[f.length]=s(_.dom.trim(n))),""});var n=e.match(r);if(!n)return f.push(_.dom.trim(e));if(n[2].charAt(0)=="{"){var i={};return i[n[1]]=o(a(n[2])),f.push(i)}f.push(n[1]+":"+a(n[2]))}),n[2]&&_.each(u(n[2]),function(e){if(e.charAt(0)=="#")return;var t=e.match(r);t&&(c[t[1]]=t[2])}),{value:a(_.dom.trim(n[0])),scenario:f,outline:_.keys(l).length?l:null,editorOptions:c}}var e=/AppleWebKit/.test(navigator.userAgent)&&/Mobile\/\w+/.test(navigator.userAgent),t=e||/Mac/.test(navigator.platform),n={ctrl:"⌃",control:"⌃",cmd:"⌘",shift:"⇧",alt:"⌥",enter:"⏎",tab:"⇥",left:"←",right:"→",up:"↑",down:"↓"},r={cmd:"Ctrl",control:"Ctrl",ctrl:"Ctrl",alt:"Alt",shift:"Shift",left:"←",right:"→",up:"↑",down:"↓"},i={parse:!0,sectionSeparator:"~~~",outlineSeparator:/\s+:::\s+(.+)$/,prettifyKeys:!0,stripParentheses:!1};CodeMirror.movie=function(e,t,n){var r=null;t=_.extend({},i,t||{}),n=_.extend({theme:"espresso",mode:"text/html",indentWithTabs:!0,tabSize:4,lineNumbers:!0,onCursorActivity:function(){u.setLineClass(r,null,null),r=u.setLineClass(u.getCursor().line,null,"activeline")},onKeyEvent:function(e,t){if(e.getOption("readOnly"))return t.stop(),!0}},n||{}),_.isString(e)&&(e=document.getElementById(e));var s=n.value||e.value||"";t.parse&&(_.extend(t,f(s,t)),s=t.value,t.editorOptions&&_.extend(n,t.editorOptions)),s=s.replace(/\r?\n/g,"\n");var o=s.indexOf("|");e.value=n.value=s=s.replace(/\|/g,"");var u=CodeMirror.fromTextArea(e,n);r=u.setLineClass(0,"activeline"),o!=-1&&u.setCursor(u.posFromIndex(o)),u.__initial={content:s,pos:u.getCursor(!0)};var a=u.getWrapperElement();n.height&&(a.style.height=n.height+"px"),a.className+=" CodeMirror-movie"+(t.outline?" CodeMirror-movie_with-outline":"");var l=CodeMirror.scenario(t.scenario,u);return t.outline&&(a.className+=" CodeMirror-movie_with-outline",a.appendChild(CodeMirror.scenarioOutline(t.outline,l))),l}}();
+(function(){var e=this,t=e._,n={},r=Array.prototype,i=Object.prototype,s=Function.prototype,o=r.push,u=r.slice,a=r.concat,f=i.toString,l=i.hasOwnProperty,c=r.forEach,h=r.map,p=r.reduce,d=r.reduceRight,v=r.filter,m=r.every,g=r.some,y=r.indexOf,b=r.lastIndexOf,w=Array.isArray,E=Object.keys,S=s.bind,x=function(e){if(e instanceof x)return e;if(!(this instanceof x))return new x(e);this._wrapped=e};typeof exports!="undefined"?(typeof module!="undefined"&&module.exports&&(exports=module.exports=x),exports._=x):e._=x,x.VERSION="1.4.3";var T=x.each=x.forEach=function(e,t,r){if(e==null)return;if(c&&e.forEach===c)e.forEach(t,r);else if(e.length===+e.length){for(var i=0,s=e.length;i<s;i++)if(t.call(r,e[i],i,e)===n)return}else for(var o in e)if(x.has(e,o)&&t.call(r,e[o],o,e)===n)return};x.map=x.collect=function(e,t,n){var r=[];return e==null?r:h&&e.map===h?e.map(t,n):(T(e,function(e,i,s){r[r.length]=t.call(n,e,i,s)}),r)};var N="Reduce of empty array with no initial value";x.reduce=x.foldl=x.inject=function(e,t,n,r){var i=arguments.length>2;e==null&&(e=[]);if(p&&e.reduce===p)return r&&(t=x.bind(t,r)),i?e.reduce(t,n):e.reduce(t);T(e,function(e,s,o){i?n=t.call(r,n,e,s,o):(n=e,i=!0)});if(!i)throw new TypeError(N);return n},x.reduceRight=x.foldr=function(e,t,n,r){var i=arguments.length>2;e==null&&(e=[]);if(d&&e.reduceRight===d)return r&&(t=x.bind(t,r)),i?e.reduceRight(t,n):e.reduceRight(t);var s=e.length;if(s!==+s){var o=x.keys(e);s=o.length}T(e,function(u,a,f){a=o?o[--s]:--s,i?n=t.call(r,n,e[a],a,f):(n=e[a],i=!0)});if(!i)throw new TypeError(N);return n},x.find=x.detect=function(e,t,n){var r;return C(e,function(e,i,s){if(t.call(n,e,i,s))return r=e,!0}),r},x.filter=x.select=function(e,t,n){var r=[];return e==null?r:v&&e.filter===v?e.filter(t,n):(T(e,function(e,i,s){t.call(n,e,i,s)&&(r[r.length]=e)}),r)},x.reject=function(e,t,n){return x.filter(e,function(e,r,i){return!t.call(n,e,r,i)},n)},x.every=x.all=function(e,t,r){t||(t=x.identity);var i=!0;return e==null?i:m&&e.every===m?e.every(t,r):(T(e,function(e,s,o){if(!(i=i&&t.call(r,e,s,o)))return n}),!!i)};var C=x.some=x.any=function(e,t,r){t||(t=x.identity);var i=!1;return e==null?i:g&&e.some===g?e.some(t,r):(T(e,function(e,s,o){if(i||(i=t.call(r,e,s,o)))return n}),!!i)};x.contains=x.include=function(e,t){return e==null?!1:y&&e.indexOf===y?e.indexOf(t)!=-1:C(e,function(e){return e===t})},x.invoke=function(e,t){var n=u.call(arguments,2);return x.map(e,function(e){return(x.isFunction(t)?t:e[t]).apply(e,n)})},x.pluck=function(e,t){return x.map(e,function(e){return e[t]})},x.where=function(e,t){return x.isEmpty(t)?[]:x.filter(e,function(e){for(var n in t)if(t[n]!==e[n])return!1;return!0})},x.max=function(e,t,n){if(!t&&x.isArray(e)&&e[0]===+e[0]&&e.length<65535)return Math.max.apply(Math,e);if(!t&&x.isEmpty(e))return-Infinity;var r={computed:-Infinity,value:-Infinity};return T(e,function(e,i,s){var o=t?t.call(n,e,i,s):e;o>=r.computed&&(r={value:e,computed:o})}),r.value},x.min=function(e,t,n){if(!t&&x.isArray(e)&&e[0]===+e[0]&&e.length<65535)return Math.min.apply(Math,e);if(!t&&x.isEmpty(e))return Infinity;var r={computed:Infinity,value:Infinity};return T(e,function(e,i,s){var o=t?t.call(n,e,i,s):e;o<r.computed&&(r={value:e,computed:o})}),r.value},x.shuffle=function(e){var t,n=0,r=[];return T(e,function(e){t=x.random(n++),r[n-1]=r[t],r[t]=e}),r};var k=function(e){return x.isFunction(e)?e:function(t){return t[e]}};x.sortBy=function(e,t,n){var r=k(t);return x.pluck(x.map(e,function(e,t,i){return{value:e,index:t,criteria:r.call(n,e,t,i)}}).sort(function(e,t){var n=e.criteria,r=t.criteria;if(n!==r){if(n>r||n===void 0)return 1;if(n<r||r===void 0)return-1}return e.index<t.index?-1:1}),"value")};var L=function(e,t,n,r){var i={},s=k(t||x.identity);return T(e,function(t,o){var u=s.call(n,t,o,e);r(i,u,t)}),i};x.groupBy=function(e,t,n){return L(e,t,n,function(e,t,n){(x.has(e,t)?e[t]:e[t]=[]).push(n)})},x.countBy=function(e,t,n){return L(e,t,n,function(e,t){x.has(e,t)||(e[t]=0),e[t]++})},x.sortedIndex=function(e,t,n,r){n=n==null?x.identity:k(n);var i=n.call(r,t),s=0,o=e.length;while(s<o){var u=s+o>>>1;n.call(r,e[u])<i?s=u+1:o=u}return s},x.toArray=function(e){return e?x.isArray(e)?u.call(e):e.length===+e.length?x.map(e,x.identity):x.values(e):[]},x.size=function(e){return e==null?0:e.length===+e.length?e.length:x.keys(e).length},x.first=x.head=x.take=function(e,t,n){return e==null?void 0:t!=null&&!n?u.call(e,0,t):e[0]},x.initial=function(e,t,n){return u.call(e,0,e.length-(t==null||n?1:t))},x.last=function(e,t,n){return e==null?void 0:t!=null&&!n?u.call(e,Math.max(e.length-t,0)):e[e.length-1]},x.rest=x.tail=x.drop=function(e,t,n){return u.call(e,t==null||n?1:t)},x.compact=function(e){return x.filter(e,x.identity)};var A=function(e,t,n){return T(e,function(e){x.isArray(e)?t?o.apply(n,e):A(e,t,n):n.push(e)}),n};x.flatten=function(e,t){return A(e,t,[])},x.without=function(e){return x.difference(e,u.call(arguments,1))},x.uniq=x.unique=function(e,t,n,r){x.isFunction(t)&&(r=n,n=t,t=!1);var i=n?x.map(e,n,r):e,s=[],o=[];return T(i,function(n,r){if(t?!r||o[o.length-1]!==n:!x.contains(o,n))o.push(n),s.push(e[r])}),s},x.union=function(){return x.uniq(a.apply(r,arguments))},x.intersection=function(e){var t=u.call(arguments,1);return x.filter(x.uniq(e),function(e){return x.every(t,function(t){return x.indexOf(t,e)>=0})})},x.difference=function(e){var t=a.apply(r,u.call(arguments,1));return x.filter(e,function(e){return!x.contains(t,e)})},x.zip=function(){var e=u.call(arguments),t=x.max(x.pluck(e,"length")),n=new Array(t);for(var r=0;r<t;r++)n[r]=x.pluck(e,""+r);return n},x.object=function(e,t){if(e==null)return{};var n={};for(var r=0,i=e.length;r<i;r++)t?n[e[r]]=t[r]:n[e[r][0]]=e[r][1];return n},x.indexOf=function(e,t,n){if(e==null)return-1;var r=0,i=e.length;if(n){if(typeof n!="number")return r=x.sortedIndex(e,t),e[r]===t?r:-1;r=n<0?Math.max(0,i+n):n}if(y&&e.indexOf===y)return e.indexOf(t,n);for(;r<i;r++)if(e[r]===t)return r;return-1},x.lastIndexOf=function(e,t,n){if(e==null)return-1;var r=n!=null;if(b&&e.lastIndexOf===b)return r?e.lastIndexOf(t,n):e.lastIndexOf(t);var i=r?n:e.length;while(i--)if(e[i]===t)return i;return-1},x.range=function(e,t,n){arguments.length<=1&&(t=e||0,e=0),n=arguments[2]||1;var r=Math.max(Math.ceil((t-e)/n),0),i=0,s=new Array(r);while(i<r)s[i++]=e,e+=n;return s};var O=function(){};x.bind=function(e,t){var n,r;if(e.bind===S&&S)return S.apply(e,u.call(arguments,1));if(!x.isFunction(e))throw new TypeError;return n=u.call(arguments,2),r=function(){if(this instanceof r){O.prototype=e.prototype;var i=new O;O.prototype=null;var s=e.apply(i,n.concat(u.call(arguments)));return Object(s)===s?s:i}return e.apply(t,n.concat(u.call(arguments)))}},x.bindAll=function(e){var t=u.call(arguments,1);return t.length==0&&(t=x.functions(e)),T(t,function(t){e[t]=x.bind(e[t],e)}),e},x.memoize=function(e,t){var n={};return t||(t=x.identity),function(){var r=t.apply(this,arguments);return x.has(n,r)?n[r]:n[r]=e.apply(this,arguments)}},x.delay=function(e,t){var n=u.call(arguments,2);return setTimeout(function(){return e.apply(null,n)},t)},x.defer=function(e){return x.delay.apply(x,[e,1].concat(u.call(arguments,1)))},x.throttle=function(e,t){var n,r,i,s,o=0,u=function(){o=new Date,i=null,s=e.apply(n,r)};return function(){var a=new Date,f=t-(a-o);return n=this,r=arguments,f<=0?(clearTimeout(i),i=null,o=a,s=e.apply(n,r)):i||(i=setTimeout(u,f)),s}},x.debounce=function(e,t,n){var r,i;return function(){var s=this,o=arguments,u=function(){r=null,n||(i=e.apply(s,o))},a=n&&!r;return clearTimeout(r),r=setTimeout(u,t),a&&(i=e.apply(s,o)),i}},x.once=function(e){var t=!1,n;return function(){return t?n:(t=!0,n=e.apply(this,arguments),e=null,n)}},x.wrap=function(e,t){return function(){var n=[e];return o.apply(n,arguments),t.apply(this,n)}},x.compose=function(){var e=arguments;return function(){var t=arguments;for(var n=e.length-1;n>=0;n--)t=[e[n].apply(this,t)];return t[0]}},x.after=function(e,t){return e<=0?t():function(){if(--e<1)return t.apply(this,arguments)}},x.keys=E||function(e){if(e!==Object(e))throw new TypeError("Invalid object");var t=[];for(var n in e)x.has(e,n)&&(t[t.length]=n);return t},x.values=function(e){var t=[];for(var n in e)x.has(e,n)&&t.push(e[n]);return t},x.pairs=function(e){var t=[];for(var n in e)x.has(e,n)&&t.push([n,e[n]]);return t},x.invert=function(e){var t={};for(var n in e)x.has(e,n)&&(t[e[n]]=n);return t},x.functions=x.methods=function(e){var t=[];for(var n in e)x.isFunction(e[n])&&t.push(n);return t.sort()},x.extend=function(e){return T(u.call(arguments,1),function(t){if(t)for(var n in t)e[n]=t[n]}),e},x.pick=function(e){var t={},n=a.apply(r,u.call(arguments,1));return T(n,function(n){n in e&&(t[n]=e[n])}),t},x.omit=function(e){var t={},n=a.apply(r,u.call(arguments,1));for(var i in e)x.contains(n,i)||(t[i]=e[i]);return t},x.defaults=function(e){return T(u.call(arguments,1),function(t){if(t)for(var n in t)e[n]==null&&(e[n]=t[n])}),e},x.clone=function(e){return x.isObject(e)?x.isArray(e)?e.slice():x.extend({},e):e},x.tap=function(e,t){return t(e),e};var M=function(e,t,n,r){if(e===t)return e!==0||1/e==1/t;if(e==null||t==null)return e===t;e instanceof x&&(e=e._wrapped),t instanceof x&&(t=t._wrapped);var i=f.call(e);if(i!=f.call(t))return!1;switch(i){case"[object String]":return e==String(t);case"[object Number]":return e!=+e?t!=+t:e==0?1/e==1/t:e==+t;case"[object Date]":case"[object Boolean]":return+e==+t;case"[object RegExp]":return e.source==t.source&&e.global==t.global&&e.multiline==t.multiline&&e.ignoreCase==t.ignoreCase}if(typeof e!="object"||typeof t!="object")return!1;var s=n.length;while(s--)if(n[s]==e)return r[s]==t;n.push(e),r.push(t);var o=0,u=!0;if(i=="[object Array]"){o=e.length,u=o==t.length;if(u)while(o--)if(!(u=M(e[o],t[o],n,r)))break}else{var a=e.constructor,l=t.constructor;if(a!==l&&!(x.isFunction(a)&&a instanceof a&&x.isFunction(l)&&l instanceof l))return!1;for(var c in e)if(x.has(e,c)){o++;if(!(u=x.has(t,c)&&M(e[c],t[c],n,r)))break}if(u){for(c in t)if(x.has(t,c)&&!(o--))break;u=!o}}return n.pop(),r.pop(),u};x.isEqual=function(e,t){return M(e,t,[],[])},x.isEmpty=function(e){if(e==null)return!0;if(x.isArray(e)||x.isString(e))return e.length===0;for(var t in e)if(x.has(e,t))return!1;return!0},x.isElement=function(e){return!!e&&e.nodeType===1},x.isArray=w||function(e){return f.call(e)=="[object Array]"},x.isObject=function(e){return e===Object(e)},T(["Arguments","Function","String","Number","Date","RegExp"],function(e){x["is"+e]=function(t){return f.call(t)=="[object "+e+"]"}}),x.isArguments(arguments)||(x.isArguments=function(e){return!!e&&!!x.has(e,"callee")}),typeof /./!="function"&&(x.isFunction=function(e){return typeof e=="function"}),x.isFinite=function(e){return isFinite(e)&&!isNaN(parseFloat(e))},x.isNaN=function(e){return x.isNumber(e)&&e!=+e},x.isBoolean=function(e){return e===!0||e===!1||f.call(e)=="[object Boolean]"},x.isNull=function(e){return e===null},x.isUndefined=function(e){return e===void 0},x.has=function(e,t){return l.call(e,t)},x.noConflict=function(){return e._=t,this},x.identity=function(e){return e},x.times=function(e,t,n){var r=Array(e);for(var i=0;i<e;i++)r[i]=t.call(n,i);return r},x.random=function(e,t){return t==null&&(t=e,e=0),e+(0|Math.random()*(t-e+1))};var _={escape:{"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;","/":"&#x2F;"}};_.unescape=x.invert(_.escape);var D={escape:new RegExp("["+x.keys(_.escape).join("")+"]","g"),unescape:new RegExp("("+x.keys(_.unescape).join("|")+")","g")};x.each(["escape","unescape"],function(e){x[e]=function(t){return t==null?"":(""+t).replace(D[e],function(t){return _[e][t]})}}),x.result=function(e,t){if(e==null)return null;var n=e[t];return x.isFunction(n)?n.call(e):n},x.mixin=function(e){T(x.functions(e),function(t){var n=x[t]=e[t];x.prototype[t]=function(){var e=[this._wrapped];return o.apply(e,arguments),F.call(this,n.apply(x,e))}})};var P=0;x.uniqueId=function(e){var t=""+ ++P;return e?e+t:t},x.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var H=/(.)^/,B={"'":"'","\\":"\\","\r":"r","\n":"n"," ":"t","\u2028":"u2028","\u2029":"u2029"},j=/\\|'|\r|\n|\t|\u2028|\u2029/g;x.template=function(e,t,n){n=x.defaults({},n,x.templateSettings);var r=new RegExp([(n.escape||H).source,(n.interpolate||H).source,(n.evaluate||H).source].join("|")+"|$","g"),i=0,s="__p+='";e.replace(r,function(t,n,r,o,u){return s+=e.slice(i,u).replace(j,function(e){return"\\"+B[e]}),n&&(s+="'+\n((__t=("+n+"))==null?'':_.escape(__t))+\n'"),r&&(s+="'+\n((__t=("+r+"))==null?'':__t)+\n'"),o&&(s+="';\n"+o+"\n__p+='"),i=u+t.length,t}),s+="';\n",n.variable||(s="with(obj||{}){\n"+s+"}\n"),s="var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');};\n"+s+"return __p;\n";try{var o=new Function(n.variable||"obj","_",s)}catch(u){throw u.source=s,u}if(t)return o(t,x);var a=function(e){return o.call(this,e,x)};return a.source="function("+(n.variable||"obj")+"){\n"+s+"}",a},x.chain=function(e){return x(e).chain()};var F=function(e){return this._chain?x(e).chain():e};x.mixin(x),T(["pop","push","reverse","shift","sort","splice","unshift"],function(e){var t=r[e];x.prototype[e]=function(){var n=this._wrapped;return t.apply(n,arguments),(e=="shift"||e=="splice")&&n.length===0&&delete n[0],F.call(this,n)}}),T(["concat","join","slice"],function(e){var t=r[e];x.prototype[e]=function(){return F.call(this,t.apply(this._wrapped,arguments))}}),x.extend(x.prototype,{chain:function(){return this._chain=!0,this},value:function(){return this._wrapped}})}).call(this),function(){var e=0,t=["ms","moz","webkit","o"];for(var n=0;n<t.length&&!window.requestAnimationFrame;++n)window.requestAnimationFrame=window[t[n]+"RequestAnimationFrame"],window.cancelAnimationFrame=window[t[n]+"CancelAnimationFrame"]||window[t[n]+"CancelRequestAnimationFrame"];window.requestAnimationFrame||(window.requestAnimationFrame=function(t,n){var r=(new Date).getTime(),i=Math.max(0,16-(r-e)),s=window.setTimeout(function(){t(r+i)},i);return e=r+i,s}),window.cancelAnimationFrame||(window.cancelAnimationFrame=function(e){clearTimeout(e)})}(),function(e){function s(){if(!n.length)return;var e=+(new Date),t=[],r,i;for(var o=0;o<n.length;o++){r=n[o];var i=r.options;r.pos===1||r.endTime<=e?(i.step.call(r,r.pos=1),r.stop()):(r.pos=i.easing(e-r.startTime,0,1,i.duration),i.step.call(r,r.pos),t.push(r))}n=t,n.length&&requestAnimationFrame(s)}function o(e){_.indexOf(n,e)==-1&&(n.push(e),n.length==1&&s())}function u(e){this.options=_.extend({},r,e||{});var t=this.options.easing;if(_.isString(t)){if(!i[t])throw'Unknown "'+t+'" easing function';this.options.easing=i[t]}if(!_.isFunction(this.options.easing))throw"Easing should be a function";this._id=_.uniqueId("tw"),this.options.autostart&&this.start()}var t=function(){},n=[],r={duration:500,easing:"linear",step:t,complete:t,autostart:!0},i={linear:function(e,t,n,r){return n*e/r+t},easeInQuad:function(e,t,n,r){return n*(e/=r)*e+t},easeOutQuad:function(e,t,n,r){return-n*(e/=r)*(e-2)+t},easeInOutQuad:function(e,t,n,r){return(e/=r/2)<1?n/2*e*e+t:-n/2*(--e*(e-2)-1)+t},easeInCubic:function(e,t,n,r){return n*(e/=r)*e*e+t},easeOutCubic:function(e,t,n,r){return n*((e=e/r-1)*e*e+1)+t},easeInOutCubic:function(e,t,n,r){return(e/=r/2)<1?n/2*e*e*e+t:n/2*((e-=2)*e*e+2)+t},easeInExpo:function(e,t,n,r){return e==0?t:n*Math.pow(2,10*(e/r-1))+t-n*.001},easeOutExpo:function(e,t,n,r){return e==r?t+n:n*1.001*(-Math.pow(2,-10*e/r)+1)+t},easeInOutExpo:function(e,t,n,r){return e==0?t:e==r?t+n:(e/=r/2)<1?n/2*Math.pow(2,10*(e-1))+t-n*5e-4:n/2*1.0005*(-Math.pow(2,-10*--e)+2)+t},easeInElastic:function(e,t,n,r,i,s){var o;return e==0?t:(e/=r)==1?t+n:(s||(s=r*.3),!i||i<Math.abs(n)?(i=n,o=s/4):o=s/(2*Math.PI)*Math.asin(n/i),-(i*Math.pow(2,10*(e-=1))*Math.sin((e*r-o)*2*Math.PI/s))+t)},easeOutElastic:function(e,t,n,r,i,s){var o;return e==0?t:(e/=r)==1?t+n:(s||(s=r*.3),!i||i<Math.abs(n)?(i=n,o=s/4):o=s/(2*Math.PI)*Math.asin(n/i),i*Math.pow(2,-10*e)*Math.sin((e*r-o)*2*Math.PI/s)+n+t)},easeInOutElastic:function(e,t,n,r,i,s){var o;return e==0?t:(e/=r/2)==2?t+n:(s||(s=r*.3*1.5),!i||i<Math.abs(n)?(i=n,o=s/4):o=s/(2*Math.PI)*Math.asin(n/i),e<1?-0.5*i*Math.pow(2,10*(e-=1))*Math.sin((e*r-o)*2*Math.PI/s)+t:i*Math.pow(2,-10*(e-=1))*Math.sin((e*r-o)*2*Math.PI/s)*.5+n+t)},easeInBack:function(e,t,n,r,i){return i==undefined&&(i=1.70158),n*(e/=r)*e*((i+1)*e-i)+t},easeOutBack:function(e,t,n,r,i){return i==undefined&&(i=1.70158),n*((e=e/r-1)*e*((i+1)*e+i)+1)+t},easeInOutBack:function(e,t,n,r,i){return i==undefined&&(i=1.70158),(e/=r/2)<1?n/2*e*e*(((i*=1.525)+1)*e-i)+t:n/2*((e-=2)*e*(((i*=1.525)+1)*e+i)+2)+t},easeInBounce:function(e,t,n,r){return n-$.easing.easeOutBounce(x,r-e,0,n,r)+t},easeOutBounce:function(e,t,n,r){return(e/=r)<1/2.75?n*7.5625*e*e+t:e<2/2.75?n*(7.5625*(e-=1.5/2.75)*e+.75)+t:e<2.5/2.75?n*(7.5625*(e-=2.25/2.75)*e+.9375)+t:n*(7.5625*(e-=2.625/2.75)*e+.984375)+t},easeInOutBounce:function(e,t,n,r){return e<r/2?$.easing.easeInBounce(x,e*2,0,n,r)*.5+t:$.easing.easeOutBounce(x,e*2-r,0,n,r)*.5+n*.5+t}};u.prototype={start:function(){this.pos=0,this.startTime=+(new Date),this.endTime=this.startTime+this.options.duration,this.animating=!0,o(this)},stop:function(){this.animating=!1,this.options.complete()}},u.__getAnims=function(){return n},e.Tween=u}(this),function(e){"use strict";function n(e){return e.replace(/\-(\w)/g,function(e,t){return t.toUpperCase()})}function r(e,r){var i=/^-?\d+(?:px)?$/i,s=/^-?\d(?:\.\d+)?/,o=/\d$/,u=n(r);if(e.style[u])return e.style[u];if(t){var a=window.getComputedStyle(e,"");return a.getPropertyValue(r)}if(e.currentStyle){var f=e.currentStyle[r]||e.currentStyle[u],l=e.style||e;if(!i.test(f)&&s.test(f)){var c=l.left,h=e.runtimeStyle.left;e.runtimeStyle.left=e.currentStyle.left;var p=o.test(f)?"em":"";l.left=u==="fontSize"?"1em":f+p||0,f=l.pixelLeft+"px",l.left=c,e.runtimeStyle.left=h}return f}}function i(e,t){if(!e)return;var n={"line-height":1,"z-index":1,opacity:1},r=_.map(t,function(e,t){var r=t.replace(/([A-Z])/g,"-$1").toLowerCase();return r+":"+(!_.isNumber(e)||r in n?e:e+"px")});e.style.cssText+=";"+r.join(";")}function s(e){return e.length===+e.length?_.toArray(e):_.isArray(e)?e:[e]}var t=document.defaultView&&document.defaultView.getComputedStyle;_.extend(e,{trim:function(e){return e&&"trim"in String.prototype?e.trim():e.replace(/^\s+/,"").replace(/\s+$/,"")},hasClass:function(e,t){return~(" "+e.className+" ").indexOf(" "+t+" ")},addClass:function(e,t){return _.each(s(e),function(e){var n=_.filter(t.split(/\s+/g),function(t){return t&&!this.hasClass(e,t)},this);n.length&&(e.className+=(e.className?" ":"")+n.join(" "))},this),e},removeClass:function(e,t){var n=/\s+/g;return _.each(s(e),function(e){e.className=_.difference((e.className||"").split(n),t.split(/\s+/g)).join(" ")},this),e},toggleClass:function(e,t,n){return _.each(s(e),function(e){var r=n;_.isUndefined(r)&&(r=this.hasClass(e,t)),r?this.removeClass(e,t):this.addClass(e,t)},this),e},getByClass:function(e,t){return document.getElementsByClassName?(t||document).getElementsByClassName(e):_.filter((t||document).getElementsByTagName("*"),function(t){return this.hasClass(t,e)},this)},remove:function(e){return _.each(s(e),function(e){e.parentNode&&e.parentNode.removeChild(e)}),e},toDOM:function(e){var t=document.createElement("div");return t.innerHTML=e,t.firstChild},css:function(e,t,n){if(_.isString(t)&&_.isUndefined(n))return r(e,t);if(_.isString(t)){var s={};s[t]=n,t=s}i(e,t)}})}(_.dom={}),CodeMirror.scenario=function(){"use strict";function u(e){var t=["Webkit","Moz","O","ms"],n=e.charAt(0).toUpperCase()+e.slice(1),r=(e+" "+t.join(n+" ")+n).split(" "),i=document.createElement("div"),s=null;for(var o in r){s=r[o];if(i.style[s]!==undefined)return s}return s}function f(e){if(_.isString(e)){var t=e.split(":");return{name:t.shift(),options:t.join(":")}}var n=_.keys(e)[0];return{name:n,options:e[n]}}function l(e,t,n){if(_.isString(e)){var r={};r[t]=e,e=r}return _.extend(n,e||{})}function c(e,t){if(_.isString(e)){if(e==="caret")return t.getCursor(!0);if(~e.indexOf(":")){var n=e.split(":");return{line:parseInt(n[0],10),ch:parseInt(n[1],10)}}e=parseInt(e,10)}return _.isNumber(e)?t.posFromIndex(e):e}function h(e,t){if(!!t)return setTimeout(e,t);e()}function p(t,n){this._actions=t,this._actionIx=0,this._editor=null,this._state=e,this._timerQueue=[],n&&"getValue"in n&&(this._editor=n);var r=this._editor;r&&!r.__initial&&(r.__initial={content:r.getValue(),pos:r.getCursor(!0)})}var e="idle",t="play",n="pause",r=/\s+/,i=Array.prototype.slice,s={beforeDelay:1e3,afterDelay:1e3},o=function(){var e=document.createElement("div"),t=u("transform");return t?(e.style[t]="translateZ(0)",/translatez/i.test(e.style[t])):!1}(),a={type:function(e,t,n,r){e=l(e,"text",{text:"",delay:60,pos:null});if(!e.text)throw'No text provided for "type" action';e.pos!==null&&t.setCursor(c(e.pos,t));var i=e.text.split("");r(function s(){var o=i.shift();t.replaceSelection(o,"end"),i.length?r(s,e.delay):n()},e.delay)},wait:function(e,t,n,r){e=l(e,"timeout",{timeout:100}),r(n,parseInt(e.timeout,10))},moveTo:function(e,t,n,r){e=l(e,"pos",{delay:80,immediate:!1});if(!e.pos)throw'No position specified for "moveTo" action';var i=t.getCursor(!0);t.setSelection(i,i);var s=c(e.pos,t);e.immediate&&(t.setCursor(s),n());var o=s.line-i.line,u=s.ch-i.ch,a=Math.max(u,o),f=o<0?-1:1,h=u<0?-1:1;r(function p(){i=t.getCursor(!0),a>0&&(i.line!=s.line||i.ch!=s.ch)?(i.line!=s.line&&(i.line+=f),i.ch!=s.ch&&(i.ch+=h),t.setCursor(i),a--,r(p,e.delay)):(t.setCursor(s),n())},e.delay)},jumpTo:function(e,t,n,r){e=l(e,"pos",{afterDelay:200});if(!e.pos)throw'No position specified for "jumpTo" action';t.setCursor(c(e.pos,t)),r(n,e.afterDelay)},run:function(e,t,n,r){e=l(e,"command",{beforeDelay:500,times:1});var i=e.times;r(function s(){try{_.isFunction(e.command)?e.command(t,e):t.execCommand(e.command)}catch(o){}--i>0?r(s,e.beforeDelay):n()},e.beforeDelay)},select:function(e,t,n,r){e=l(e,"to",{from:"caret"});var i=c(e.from,t),s=c(e.to,t);t.setSelection(i,s),n()}};return CodeMirror.commands.revert=function(e){e.__initial&&(e.setValue(e.__initial.content),e.setCursor(e.__initial.pos))},p.prototype={_setup:function(e){return!e&&this._editor&&(e=this._editor),e.execCommand("revert"),e},play:function(e){if(this._state===t)return;if(this._state===n){e=e||this._editor,e.focus();var r=null;while(r=this._timerQueue.shift())h(r.fn,r.delay);this._state=t,this.trigger("resume");return}this._editor=e=this._setup(e),e.focus();var i=_.bind(this.requestTimer,this),o=this;this._actionIx=0;var u=function(){if(o._actionIx>=o._actions.length)return i(function(){o.stop()},s.afterDelay);o.trigger("action",o._actionIx);var t=f(o._actions[o._actionIx++]);if(!(t.name in a))throw"No such action: "+t.name;a[t.name].call(o,t.options,e,u,i)};this._state=t,this._editor.setOption("readOnly",!0),this.trigger("play"),i(u,s.beforeDelay)},pause:function(){this._state=n,this.trigger("pause")},stop:function(){this._state!==e&&(this._state=e,this._timerQueue.length=0,this._editor.setOption("readOnly",!1),this.trigger("stop"))},state:function(){return this._state},toggle:function(){this._state===t?this.pause():this.play()},requestTimer:function(e,n){if(this._state===t)return h(e,n);this._timerQueue.push({fn:e,delay:n})},on:function(e,t,n){var i,s,o,u,a;if(!t)return this;e=e.split(r),i=this._callbacks||(this._callbacks={});while(s=e.shift())a=i[s],o=a?a.tail:{},o.next=u={},o.context=n,o.callback=t,i[s]={tail:u,next:a?a.next:o};return this},off:function(e,t,n){var i,s,o,u,a,f;if(!(s=this._callbacks))return;if(!(e||t||n))return delete this._callbacks,this;e=e?e.split(r):_.keys(s);while(i=e.shift()){o=s[i],delete s[i];if(!o||!t&&!n)continue;u=o.tail;while((o=o.next)!==u)a=o.callback,f=o.context,(t&&a!==t||n&&f!==n)&&this.on(i,a,f)}return this},trigger:function(e){var t,n,s,o,u,a,f;if(!(s=this._callbacks))return this;a=s.all,e=e.split(r),f=i.call(arguments,1);while(t=e.shift()){if(n=s[t]){o=n.tail;while((n=n.next)!==o)n.callback.apply(n.context||this,f)}if(n=a){o=n.tail,u=[t].concat(f);while((n=n.next)!==o)n.callback.apply(n.context||this,u)}}return this}},_.extend(function(e,t){return new p(e,t)},{defineAction:function(e,t){a[e]=t},makeOptions:l,makePos:c,has3d:o,prefixed:u})}(),CodeMirror.scenarioTooltip=function(){"use strict";function i(){var e=document.body,t=document.documentElement,n=t.clientTop||e.clientTop||0,r=t.clientLeft||e.clientLeft||0,i=window.pageYOffset||t.scrollTop||e.scrollTop,s=window.pageXOffset||t.scrollLeft||e.scrollLeft;return{top:i-n,left:s-r,width:e.clientWidth||t.clientWidth,height:e.clientHeight||t.clientHeight}}function s(e,t){t=_.extend({},r,t||{}),_.dom.css(e,{left:0,top:0});var n=_.dom.getByClass(t.tailClass,e)[0],s=0,o=0,u=t.position,a=i(),f=e.offsetWidth,l=e.offsetHeight,c;s=Math.min(a.width-f-t.popupMargin,Math.max(t.popupMargin,u.x-a.left-f/2)),l+n.offsetHeight+t.popupMargin+a.top<u.y?(o=Math.max(0,u.y-l-n.offsetHeight),c=!0):(o=u.y+n.offsetHeight,c=!1);var h=t.tailMargin,p=f-t.tailMargin;n.style.left=Math.min(p,Math.max(h,u.x-s-a.left))+"px",_.dom.css(e,{left:s,top:o}),_.dom.toggleClass(e,t.belowClass,c)}function o(e,i){i=_.extend({},r,i||{});var s=n.prefixed("transformOrigin"),o=n.prefixed("transform"),u=e.style,a=_.dom.getByClass(i.tailClass,e)[0],f=_.dom.css(a,"left"),l=a.offsetTop;_.dom.hasClass(e,i.belowClass)&&(l-=a.offsetHeight),l+="px",u[s]=f+" "+l;var c=n.has3d?"translateZ(0) ":"";return t=new Tween({duration:800,easing:"easeOutElastic",step:function(e){u[o]=c+"scale("+e+")"},complete:function(){t=null,i.onComplete&&i.onComplete(e)}})}function u(e,t){var n=e.style;return new Tween({duration:200,easing:"linear",step:function(e){n.opacity=1-e},complete:function(){_.dom.remove(e),t.onComplete&&t.onComplete(e)}})}function a(t,r,i){f(),e=_.dom.toDOM('<div class="CodeMirror-tooltip"><div class="CodeMirror-tooltip__content">'+t+"</div>"+'<div class="CodeMirror-tooltip__tail"></div>'+"</div>"),_.dom.css(e,n.prefixed("transform"),"scale(0)"),document.body.appendChild(e),s(e,{position:r}),o(e,{onComplete:i})}function f(n){e?(t&&(t.stop(),t=null),u(e,{onComplete:n}),e=null):n&&n()}function l(e,t){return e==="caret"?t.cursorCoords(!0):e&&"x"in e&&"y"in e?e:t.charCoords(n.makePos(e))}var e=null,t=null,n=CodeMirror.scenario,r={tailClass:"CodeMirror-tooltip__tail",belowClass:"CodeMirror-tooltip_below",popupMargin:5,tailMargin:11};return n.defineAction("tooltip",function(e,t,r,i){e=n.makeOptions(e,"text",{wait:4e3,pos:"caret"});var s=l(e.pos,t);a(e.text,s,function(){i(function(){f(function(){i(r)})},e.wait)})}),n.defineAction("showTooltip",function(e,t,r,i){e=n.makeOptions(e,"text",{pos:"caret"}),a(e.text,l(e.pos,t)),r()}),n.defineAction("hideTooltip",function(e,t,n,r){f(n)}),{show:a,hide:f}}(),CodeMirror.scenarioOutline=function(){"use strict";var e={wrapperTemplate:'<ul class="CodeMirror-outline"><%= content %></ul>',itemTemplate:'<li data-action-id="<%= id %>" class="CodeMirror-outline__item"><%= title %></li>',itemClass:"CodeMirror-outline__item",selectedClass:"CodeMirror-outline__item_selected"};return function(t,n,r){r=_.extend({},e,r||{});var i=_.keys(t);i.sort(function(e,t){return parseInt(e,10)-parseInt(t,10)});var s=_.template(r.itemTemplate),o=_.map(i,function(e){return s({title:t[e],id:e})}),u=_.dom.toDOM(_.template(r.wrapperTemplate,{content:o.join("")}));return r.target&&r.target.appendChild(u),n.on("action",function(e){var t=_.dom.getByClass(r.itemClass,u),n=_.find(t,function(t){return t.getAttribute("data-action-id")==e});n&&(_.dom.removeClass(t,r.selectedClass),_.dom.addClass(n,r.selectedClass))}).on("stop",function(){_.dom.removeClass(_.dom.getByClass(r.itemClass,u),r.selectedClass)}),u}}(),CodeMirror.scenarioPrompt=function(){"use strict";function i(n,r,i){s(),e=_.dom.toDOM('<div class="CodeMirror-prompt"><div class="CodeMirror-prompt__title">'+n+"</div>"+'<input type="text" name="prompt" class="CodeMirror-prompt__input" readonly="readonly" />'+"</div>"),t=_.dom.toDOM('<div class="CodeMirror-prompt__shade"></div>'),r.appendChild(e),r.appendChild(t),o(e,t,{onComplete:i})}function s(r){e?(n&&(n.stop(),n=null),u(e,t,{onComplete:r}),e=t=null):r&&r()}function o(e,t,i){i=i||{};var s=r.prefixed("transform"),o=e.style,u=t.style,a=e.offsetHeight,f=_.template(r.has3d?"translate3d(0, <%= pos %>, 0)":"translate(0, <%= pos %>)");return u.opacity=0,new Tween({duration:200,step:function(e){u.opacity=e}}),o[s]=f({pos:-a}),n=new Tween({duration:400,easing:"easeOutCubic",step:function(e){o[s]=f({pos:-a*(1-e)+"px"})},complete:function(){n=null,i.onComplete&&i.onComplete(e,t)}})}function u(e,t,n){var i=e.style,s=t.style,o=e.offsetHeight,u=r.prefixed("transform"),a=_.template(r.has3d?"translate3d(0, <%= pos %>, 0)":"translate(0, <%= pos %>)");return new Tween({duration:200,step:function(e){i[u]=a({pos:-o*e+"px"}),s.opacity=1-e},complete:function(){_.dom.remove([e,t]),n.onComplete&&n.onComplete(e,t)}})}function a(e,t,n,r){var i=t.text.split("");n(function s(){e.value+=i.shift(),i.length?n(s,t.delay):r()},t.delay)}var e=null,t=null,n=null,r=CodeMirror.scenario;r.defineAction("prompt",function(e,t,n,o){e=r.makeOptions(e,"text",{title:"Enter something",delay:80,typeDelay:1e3,hideDelay:2e3}),i(e.title,t.getWrapperElement(),function(t){o(function(){a(_.dom.getByClass("CodeMirror-prompt__input",t)[0],e,o,function(){o(function(){s(n)},e.hideDelay)})},e.typeDelay)})})}(),function(){"use strict";function s(e,i){i=i||{};var s=/ctrl|alt|shift|cmd/i,o=t?n:r;return e.replace(/\((.+?)\)/g,function(e,n){if(s.test(n)){var r=_.map(n.toLowerCase().split(/[\-\+]/),function(e){return o[e.toLowerCase()]||e.toUpperCase()});e=r.join(t?"":"+"),i.stripParentheses||(e="("+e+")")}return e})}function o(e){try{return(new Function("return "+e))()}catch(t){return{}}}function u(e){var t="\n",n=(e||"").replace(/\r\n/g,t).replace(/\n\r/g,t).replace(/\r/g,t).split(t);return _.filter(n,function(e){return!!e})}function a(e){var t={"&lt;":"<","&gt;":">","&amp;":"&"};return e.replace(/&(lt|gt|amp);/g,function(e,n){return t[e]||e})}function f(e,t){t=_.extend({},i,t||{});var n=e.split(t.sectionSeparator),r=/^(\w+)\s*:\s*(.+)$/,f=[],l={},c={};return _.each(u(n[1]),function(e){if(e.charAt(0)=="#")return;e=e.replace(t.outlineSeparator,function(e,n){return t.prettifyKeys&&(l[f.length]=s(_.dom.trim(n))),""});var n=e.match(r);if(!n)return f.push(_.dom.trim(e));if(n[2].charAt(0)=="{"){var i={};return i[n[1]]=o(a(n[2])),f.push(i)}f.push(n[1]+":"+a(n[2]))}),n[2]&&_.each(u(n[2]),function(e){if(e.charAt(0)=="#")return;var t=e.match(r);t&&(c[t[1]]=t[2])}),{value:a(_.dom.trim(n[0])),scenario:f,outline:_.keys(l).length?l:null,editorOptions:c}}var e=/AppleWebKit/.test(navigator.userAgent)&&/Mobile\/\w+/.test(navigator.userAgent),t=e||/Mac/.test(navigator.platform),n={ctrl:"⌃",control:"⌃",cmd:"⌘",shift:"⇧",alt:"⌥",enter:"⏎",tab:"⇥",left:"←",right:"→",up:"↑",down:"↓"},r={cmd:"Ctrl",control:"Ctrl",ctrl:"Ctrl",alt:"Alt",shift:"Shift",left:"←",right:"→",up:"↑",down:"↓"},i={parse:!0,sectionSeparator:"~~~",outlineSeparator:/\s+:::\s+(.+)$/,prettifyKeys:!0,stripParentheses:!1};CodeMirror.movie=function(e,t,n){var r=null;t=_.extend({},i,t||{}),n=_.extend({theme:"espresso",mode:"text/html",indentWithTabs:!0,tabSize:4,lineNumbers:!0,onCursorActivity:function(){u.setLineClass(r,null,null),r=u.setLineClass(u.getCursor().line,null,"activeline")},onKeyEvent:function(e,t){if(e.getOption("readOnly"))return t.stop(),!0}},n||{}),_.isString(e)&&(e=document.getElementById(e));var s=n.value||e.value||"";t.parse&&(_.extend(t,f(s,t)),s=t.value,t.editorOptions&&_.extend(n,t.editorOptions)),s=s.replace(/\r?\n/g,"\n");var o=s.indexOf("|");e.value=n.value=s=s.replace(/\|/g,"");var u=CodeMirror.fromTextArea(e,n);r=u.setLineClass(0,"activeline"),o!=-1&&u.setCursor(u.posFromIndex(o)),u.__initial={content:s,pos:u.getCursor(!0)};var a=u.getWrapperElement();n.height&&(a.style.height=n.height+"px"),a.className+=" CodeMirror-movie"+(t.outline?" CodeMirror-movie_with-outline":"");var l=CodeMirror.scenario(t.scenario,u);return t.outline&&(a.className+=" CodeMirror-movie_with-outline",a.appendChild(CodeMirror.scenarioOutline(t.outline,l))),l}}();
View
12 dist/cm-movie.js
@@ -310,6 +310,10 @@
* @returns {Array}
*/
function ar(obj) {
+ if (obj.length === +obj.length) {
+ return _.toArray(obj);
+ }
+
return _.isArray(obj) ? obj : [obj];
}
@@ -364,13 +368,9 @@
* @return {Element}
*/
removeClass: function(elem, className) {
+ var reSplit = /\s+/g;
_.each(ar(elem), function(el) {
- var elemClass = el.className || '';
- _.each(className.split(/\s+/g), function(c) {
- elemClass = elemClass.replace(new RegExp('\\b' + c + '\\b'), '');
- });
-
- el.className = this.trim(elemClass);
+ el.className = _.difference((el.className || '').split(reSplit), className.split(/\s+/g)).join(' ');
}, this);
return elem;
View
2  dist/cm-movie.min.js
@@ -1 +1 @@
-(function(){var e=0,t=["ms","moz","webkit","o"];for(var n=0;n<t.length&&!window.requestAnimationFrame;++n)window.requestAnimationFrame=window[t[n]+"RequestAnimationFrame"],window.cancelAnimationFrame=window[t[n]+"CancelAnimationFrame"]||window[t[n]+"CancelRequestAnimationFrame"];window.requestAnimationFrame||(window.requestAnimationFrame=function(t,n){var r=(new Date).getTime(),i=Math.max(0,16-(r-e)),s=window.setTimeout(function(){t(r+i)},i);return e=r+i,s}),window.cancelAnimationFrame||(window.cancelAnimationFrame=function(e){clearTimeout(e)})})(),function(e){function s(){if(!n.length)return;var e=+(new Date),t=[],r,i;for(var o=0;o<n.length;o++){r=n[o];var i=r.options;r.pos===1||r.endTime<=e?(i.step.call(r,r.pos=1),r.stop()):(r.pos=i.easing(e-r.startTime,0,1,i.duration),i.step.call(r,r.pos),t.push(r))}n=t,n.length&&requestAnimationFrame(s)}function o(e){_.indexOf(n,e)==-1&&(n.push(e),n.length==1&&s())}function u(e){this.options=_.extend({},r,e||{});var t=this.options.easing;if(_.isString(t)){if(!i[t])throw'Unknown "'+t+'" easing function';this.options.easing=i[t]}if(!_.isFunction(this.options.easing))throw"Easing should be a function";this._id=_.uniqueId("tw"),this.options.autostart&&this.start()}var t=function(){},n=[],r={duration:500,easing:"linear",step:t,complete:t,autostart:!0},i={linear:function(e,t,n,r){return n*e/r+t},easeInQuad:function(e,t,n,r){return n*(e/=r)*e+t},easeOutQuad:function(e,t,n,r){return-n*(e/=r)*(e-2)+t},easeInOutQuad:function(e,t,n,r){return(e/=r/2)<1?n/2*e*e+t:-n/2*(--e*(e-2)-1)+t},easeInCubic:function(e,t,n,r){return n*(e/=r)*e*e+t},easeOutCubic:function(e,t,n,r){return n*((e=e/r-1)*e*e+1)+t},easeInOutCubic:function(e,t,n,r){return(e/=r/2)<1?n/2*e*e*e+t:n/2*((e-=2)*e*e+2)+t},easeInExpo:function(e,t,n,r){return e==0?t:n*Math.pow(2,10*(e/r-1))+t-n*.001},easeOutExpo:function(e,t,n,r){return e==r?t+n:n*1.001*(-Math.pow(2,-10*e/r)+1)+t},easeInOutExpo:function(e,t,n,r){return e==0?t:e==r?t+n:(e/=r/2)<1?n/2*Math.pow(2,10*(e-1))+t-n*5e-4:n/2*1.0005*(-Math.pow(2,-10*--e)+2)+t},easeInElastic:function(e,t,n,r,i,s){var o;return e==0?t:(e/=r)==1?t+n:(s||(s=r*.3),!i||i<Math.abs(n)?(i=n,o=s/4):o=s/(2*Math.PI)*Math.asin(n/i),-(i*Math.pow(2,10*(e-=1))*Math.sin((e*r-o)*2*Math.PI/s))+t)},easeOutElastic:function(e,t,n,r,i,s){var o;return e==0?t:(e/=r)==1?t+n:(s||(s=r*.3),!i||i<Math.abs(n)?(i=n,o=s/4):o=s/(2*Math.PI)*Math.asin(n/i),i*Math.pow(2,-10*e)*Math.sin((e*r-o)*2*Math.PI/s)+n+t)},easeInOutElastic:function(e,t,n,r,i,s){var o;return e==0?t:(e/=r/2)==2?t+n:(s||(s=r*.3*1.5),!i||i<Math.abs(n)?(i=n,o=s/4):o=s/(2*Math.PI)*Math.asin(n/i),e<1?-0.5*i*Math.pow(2,10*(e-=1))*Math.sin((e*r-o)*2*Math.PI/s)+t:i*Math.pow(2,-10*(e-=1))*Math.sin((e*r-o)*2*Math.PI/s)*.5+n+t)},easeInBack:function(e,t,n,r,i){return i==undefined&&(i=1.70158),n*(e/=r)*e*((i+1)*e-i)+t},easeOutBack:function(e,t,n,r,i){return i==undefined&&(i=1.70158),n*((e=e/r-1)*e*((i+1)*e+i)+1)+t},easeInOutBack:function(e,t,n,r,i){return i==undefined&&(i=1.70158),(e/=r/2)<1?n/2*e*e*(((i*=1.525)+1)*e-i)+t:n/2*((e-=2)*e*(((i*=1.525)+1)*e+i)+2)+t},easeInBounce:function(e,t,n,r){return n-$.easing.easeOutBounce(x,r-e,0,n,r)+t},easeOutBounce:function(e,t,n,r){return(e/=r)<1/2.75?n*7.5625*e*e+t:e<2/2.75?n*(7.5625*(e-=1.5/2.75)*e+.75)+t:e<2.5/2.75?n*(7.5625*(e-=2.25/2.75)*e+.9375)+t:n*(7.5625*(e-=2.625/2.75)*e+.984375)+t},easeInOutBounce:function(e,t,n,r){return e<r/2?$.easing.easeInBounce(x,e*2,0,n,r)*.5+t:$.easing.easeOutBounce(x,e*2-r,0,n,r)*.5+n*.5+t}};u.prototype={start:function(){this.pos=0,this.startTime=+(new Date),this.endTime=this.startTime+this.options.duration,this.animating=!0,o(this)},stop:function(){this.animating=!1,this.options.complete()}},u.__getAnims=function(){return n},e.Tween=u}(this),function(e){"use strict";function n(e){return e.replace(/\-(\w)/g,function(e,t){return t.toUpperCase()})}function r(e,r){var i=/^-?\d+(?:px)?$/i,s=/^-?\d(?:\.\d+)?/,o=/\d$/,u=n(r);if(e.style[u])return e.style[u];if(t){var a=window.getComputedStyle(e,"");return a.getPropertyValue(r)}if(e.currentStyle){var f=e.currentStyle[r]||e.currentStyle[u],l=e.style||e;if(!i.test(f)&&s.test(f)){var c=l.left,h=e.runtimeStyle.left;e.runtimeStyle.left=e.currentStyle.left;var p=o.test(f)?"em":"";l.left=u==="fontSize"?"1em":f+p||0,f=l.pixelLeft+"px",l.left=c,e.runtimeStyle.left=h}return f}}function i(e,t){if(!e)return;var n={"line-height":1,"z-index":1,opacity:1},r=_.map(t,function(e,t){var r=t.replace(/([A-Z])/g,"-$1").toLowerCase();return r+":"+(!_.isNumber(e)||r in n?e:e+"px")});e.style.cssText+=";"+r.join(";")}function s(e){return _.isArray(e)?e:[e]}var t=document.defaultView&&document.defaultView.getComputedStyle;_.extend(e,{trim:function(e){return e&&"trim"in String.prototype?e.trim():e.replace(/^\s+/,"").replace(/\s+$/,"")},hasClass:function(e,t){return~(" "+e.className+" ").indexOf(" "+t+" ")},addClass:function(e,t){return _.each(s(e),function(e){var n=_.filter(t.split(/\s+/g),function(t){return t&&!this.hasClass(e,t)},this);n.length&&(e.className+=(e.className?" ":"")+n.join(" "))},this),e},removeClass:function(e,t){return _.each(s(e),function(e){var n=e.className||"";_.each(t.split(/\s+/g),function(e){n=n.replace(new RegExp("\\b"+e+"\\b"),"")}),e.className=this.trim(n)},this),e},toggleClass:function(e,t,n){return _.each(s(e),function(e){var r=n;_.isUndefined(r)&&(r=this.hasClass(e,t)),r?this.removeClass(e,t):this.addClass(e,t)},this),e},getByClass:function(e,t){return document.getElementsByClassName?(t||document).getElementsByClassName(e):_.filter((t||document).getElementsByTagName("*"),function(t){return this.hasClass(t,e)},this)},remove:function(e){return _.each(s(e),function(e){e.parentNode&&e.parentNode.removeChild(e)}),e},toDOM:function(e){var t=document.createElement("div");return t.innerHTML=e,t.firstChild},css:function(e,t,n){if(_.isString(t)&&_.isUndefined(n))return r(e,t);if(_.isString(t)){var s={};s[t]=n,t=s}i(e,t)}})}(_.dom={}),CodeMirror.scenario=function(){"use strict";function u(e){var t=["Webkit","Moz","O","ms"],n=e.charAt(0).toUpperCase()+e.slice(1),r=(e+" "+t.join(n+" ")+n).split(" "),i=document.createElement("div"),s=null;for(var o in r){s=r[o];if(i.style[s]!==undefined)return s}return s}function f(e){if(_.isString(e)){var t=e.split(":");return{name:t.shift(),options:t.join(":")}}var n=_.keys(e)[0];return{name:n,options:e[n]}}function l(e,t,n){if(_.isString(e)){var r={};r[t]=e,e=r}return _.extend(n,e||{})}function c(e,t){if(_.isString(e)){if(e==="caret")return t.getCursor(!0);if(~e.indexOf(":")){var n=e.split(":");return{line:parseInt(n[0],10),ch:parseInt(n[1],10)}}e=parseInt(e,10)}return _.isNumber(e)?t.posFromIndex(e):e}function h(e,t){if(!!t)return setTimeout(e,t);e()}function p(t,n){this._actions=t,this._actionIx=0,this._editor=null,this._state=e,this._timerQueue=[],n&&"getValue"in n&&(this._editor=n);var r=this._editor;r&&!r.__initial&&(r.__initial={content:r.getValue(),pos:r.getCursor(!0)})}var e="idle",t="play",n="pause",r=/\s+/,i=Array.prototype.slice,s={beforeDelay:1e3,afterDelay:1e3},o=function(){var e=document.createElement("div"),t=u("transform");return t?(e.style[t]="translateZ(0)",/translatez/i.test(e.style[t])):!1}(),a={type:function(e,t,n,r){e=l(e,"text",{text:"",delay:60,pos:null});if(!e.text)throw'No text provided for "type" action';e.pos!==null&&t.setCursor(c(e.pos,t));var i=e.text.split("");r(function s(){var o=i.shift();t.replaceSelection(o,"end"),i.length?r(s,e.delay):n()},e.delay)},wait:function(e,t,n,r){e=l(e,"timeout",{timeout:100}),r(n,parseInt(e.timeout,10))},moveTo:function(e,t,n,r){e=l(e,"pos",{delay:80,immediate:!1});if(!e.pos)throw'No position specified for "moveTo" action';var i=t.getCursor(!0);t.setSelection(i,i);var s=c(e.pos,t);e.immediate&&(t.setCursor(s),n());var o=s.line-i.line,u=s.ch-i.ch,a=Math.max(u,o),f=o<0?-1:1,h=u<0?-1:1;r(function p(){i=t.getCursor(!0),a>0&&(i.line!=s.line||i.ch!=s.ch)?(i.line!=s.line&&(i.line+=f),i.ch!=s.ch&&(i.ch+=h),t.setCursor(i),a--,r(p,e.delay)):(t.setCursor(s),n())},e.delay)},jumpTo:function(e,t,n,r){e=l(e,"pos",{afterDelay:200});if(!e.pos)throw'No position specified for "jumpTo" action';t.setCursor(c(e.pos,t)),r(n,e.afterDelay)},run:function(e,t,n,r){e=l(e,"command",{beforeDelay:500,times:1});var i=e.times;r(function s(){try{_.isFunction(e.command)?e.command(t,e):t.execCommand(e.command)}catch(o){}--i>0?r(s,e.beforeDelay):n()},e.beforeDelay)},select:function(e,t,n,r){e=l(e,"to",{from:"caret"});var i=c(e.from,t),s=c(e.to,t);t.setSelection(i,s),n()}};return CodeMirror.commands.revert=function(e){e.__initial&&(e.setValue(e.__initial.content),e.setCursor(e.__initial.pos))},p.prototype={_setup:function(e){return!e&&this._editor&&(e=this._editor),e.execCommand("revert"),e},play:function(e){if(this._state===t)return;if(this._state===n){e=e||this._editor,e.focus();var r=null;while(r=this._timerQueue.shift())h(r.fn,r.delay);this._state=t,this.trigger("resume");return}this._editor=e=this._setup(e),e.focus();var i=_.bind(this.requestTimer,this),o=this;this._actionIx=0;var u=function(){if(o._actionIx>=o._actions.length)return i(function(){o.stop()},s.afterDelay);o.trigger("action",o._actionIx);var t=f(o._actions[o._actionIx++]);if(!(t.name in a))throw"No such action: "+t.name;a[t.name].call(o,t.options,e,u,i)};this._state=t,this._editor.setOption("readOnly",!0),this.trigger("play"),i(u,s.beforeDelay)},pause:function(){this._state=n,this.trigger("pause")},stop:function(){this._state!==e&&(this._state=e,this._timerQueue.length=0,this._editor.setOption("readOnly",!1),this.trigger("stop"))},state:function(){return this._state},toggle:function(){this._state===t?this.pause():this.play()},requestTimer:function(e,n){if(this._state===t)return h(e,n);this._timerQueue.push({fn:e,delay:n})},on:function(e,t,n){var i,s,o,u,a;if(!t)return this;e=e.split(r),i=this._callbacks||(this._callbacks={});while(s=e.shift())a=i[s],o=a?a.tail:{},o.next=u={},o.context=n,o.callback=t,i[s]={tail:u,next:a?a.next:o};return this},off:function(e,t,n){var i,s,o,u,a,f;if(!(s=this._callbacks))return;if(!(e||t||n))return delete this._callbacks,this;e=e?e.split(r):_.keys(s);while(i=e.shift()){o=s[i],delete s[i];if(!o||!t&&!n)continue;u=o.tail;while((o=o.next)!==u)a=o.callback,f=o.context,(t&&a!==t||n&&f!==n)&&this.on(i,a,f)}return this},trigger:function(e){var t,n,s,o,u,a,f;if(!(s=this._callbacks))return this;a=s.all,e=e.split(r),f=i.call(arguments,1);while(t=e.shift()){if(n=s[t]){o=n.tail;while((n=n.next)!==o)n.callback.apply(n.context||this,f)}if(n=a){o=n.tail,u=[t].concat(f);while((n=n.next)!==o)n.callback.apply(n.context||this,u)}}return this}},_.extend(function(e,t){return new p(e,t)},{defineAction:function(e,t){a[e]=t},makeOptions:l,makePos:c,has3d:o,prefixed:u})}(),CodeMirror.scenarioTooltip=function(){"use strict";function i(){var e=document.body,t=document.documentElement,n=t.clientTop||e.clientTop||0,r=t.clientLeft||e.clientLeft||0,i=window.pageYOffset||t.scrollTop||e.scrollTop,s=window.pageXOffset||t.scrollLeft||e.scrollLeft;return{top:i-n,left:s-r,width:e.clientWidth||t.clientWidth,height:e.clientHeight||t.clientHeight}}function s(e,t){t=_.extend({},r,t||{}),_.dom.css(e,{left:0,top:0});var n=_.dom.getByClass(t.tailClass,e)[0],s=0,o=0,u=t.position,a=i(),f=e.offsetWidth,l=e.offsetHeight,c;s=Math.min(a.width-f-t.popupMargin,Math.max(t.popupMargin,u.x-a.left-f/2)),l+n.offsetHeight+t.popupMargin+a.top<u.y?(o=Math.max(0,u.y-l-n.offsetHeight),c=!0):(o=u.y+n.offsetHeight,c=!1);var h=t.tailMargin,p=f-t.tailMargin;n.style.left=Math.min(p,Math.max(h,u.x-s-a.left))+"px",_.dom.css(e,{left:s,top:o}),_.dom.toggleClass(e,t.belowClass,c)}function o(e,i){i=_.extend({},r,i||{});var s=n.prefixed("transformOrigin"),o=n.prefixed("transform"),u=e.style,a=_.dom.getByClass(i.tailClass,e)[0],f=_.dom.css(a,"left"),l=a.offsetTop;_.dom.hasClass(e,i.belowClass)&&(l-=a.offsetHeight),l+="px",u[s]=f+" "+l;var c=n.has3d?"translateZ(0) ":"";return t=new Tween({duration:800,easing:"easeOutElastic",step:function(e){u[o]=c+"scale("+e+")"},complete:function(){t=null,i.onComplete&&i.onComplete(e)}})}function u(e,t){var n=e.style;return new Tween({duration:200,easing:"linear",step:function(e){n.opacity=1-e},complete:function(){_.dom.remove(e),t.onComplete&&t.onComplete(e)}})}function a(t,r,i){f(),e=_.dom.toDOM('<div class="CodeMirror-tooltip"><div class="CodeMirror-tooltip__content">'+t+"</div>"+'<div class="CodeMirror-tooltip__tail"></div>'+"</div>"),_.dom.css(e,n.prefixed("transform"),"scale(0)"),document.body.appendChild(e),s(e,{position:r}),o(e,{onComplete:i})}function f(n){e?(t&&(t.stop(),t=null),u(e,{onComplete:n}),e=null):n&&n()}function l(e,t){return e==="caret"?t.cursorCoords(!0):e&&"x"in e&&"y"in e?e:t.charCoords(n.makePos(e))}var e=null,t=null,n=CodeMirror.scenario,r={tailClass:"CodeMirror-tooltip__tail",belowClass:"CodeMirror-tooltip_below",popupMargin:5,tailMargin:11};return n.defineAction("tooltip",function(e,t,r,i){e=n.makeOptions(e,"text",{wait:4e3,pos:"caret"});var s=l(e.pos,t);a(e.text,s,function(){i(function(){f(function(){i(r)})},e.wait)})}),n.defineAction("showTooltip",function(e,t,r,i){e=n.makeOptions(e,"text",{pos:"caret"}),a(e.text,l(e.pos,t)),r()}),n.defineAction("hideTooltip",function(e,t,n,r){f(n)}),{show:a,hide:f}}(),CodeMirror.scenarioOutline=function(){"use strict";var e={wrapperTemplate:'<ul class="CodeMirror-outline"><%= content %></ul>',itemTemplate:'<li data-action-id="<%= id %>" class="CodeMirror-outline__item"><%= title %></li>',itemClass:"CodeMirror-outline__item",selectedClass:"CodeMirror-outline__item_selected"};return function(t,n,r){r=_.extend({},e,r||{});var i=_.keys(t);i.sort(function(e,t){return parseInt(e,10)-parseInt(t,10)});var s=_.template(r.itemTemplate),o=_.map(i,function(e){return s({title:t[e],id:e})}),u=_.dom.toDOM(_.template(r.wrapperTemplate,{content:o.join("")}));return r.target&&r.target.appendChild(u),n.on("action",function(e){var t=_.dom.getByClass(r.itemClass,u),n=_.find(t,function(t){return t.getAttribute("data-action-id")==e});n&&(_.dom.removeClass(t,r.selectedClass),_.dom.addClass(n,r.selectedClass))}).on("stop",function(){_.dom.removeClass(_.dom.getByClass(r.itemClass,u),r.selectedClass)}),u}}(),CodeMirror.scenarioPrompt=function(){"use strict";function i(n,r,i){s(),e=_.dom.toDOM('<div class="CodeMirror-prompt"><div class="CodeMirror-prompt__title">'+n+"</div>"+'<input type="text" name="prompt" class="CodeMirror-prompt__input" readonly="readonly" />'+"</div>"),t=_.dom.toDOM('<div class="CodeMirror-prompt__shade"></div>'),r.appendChild(e),r.appendChild(t),o(e,t,{onComplete:i})}function s(r){e?(n&&(n.stop(),n=null),u(e,t,{onComplete:r}),e=t=null):r&&r()}function o(e,t,i){i=i||{};var s=r.prefixed("transform"),o=e.style,u=t.style,a=e.offsetHeight,f=_.template(r.has3d?"translate3d(0, <%= pos %>, 0)":"translate(0, <%= pos %>)");return u.opacity=0,new Tween({duration:200,step:function(e){u.opacity=e}}),o[s]=f({pos:-a}),n=new Tween({duration:400,easing:"easeOutCubic",step:function(e){o[s]=f({pos:-a*(1-e)+"px"})},complete:function(){n=null,i.onComplete&&i.onComplete(e,t)}})}function u(e,t,n){var i=e.style,s=t.style,o=e.offsetHeight,u=r.prefixed("transform"),a=_.template(r.has3d?"translate3d(0, <%= pos %>, 0)":"translate(0, <%= pos %>)");return new Tween({duration:200,step:function(e){i[u]=a({pos:-o*e+"px"}),s.opacity=1-e},complete:function(){_.dom.remove([e,t]),n.onComplete&&n.onComplete(e,t)}})}function a(e,t,n,r){var i=t.text.split("");n(function s(){e.value+=i.shift(),i.length?n(s,t.delay):r()},t.delay)}var e=null,t=null,n=null,r=CodeMirror.scenario;r.defineAction("prompt",function(e,t,n,o){e=r.makeOptions(e,"text",{title:"Enter something",delay:80,typeDelay:1e3,hideDelay:2e3}),i(e.title,t.getWrapperElement(),function(t){o(function(){a(_.dom.getByClass("CodeMirror-prompt__input",t)[0],e,o,function(){o(function(){s(n)},e.hideDelay)})},e.typeDelay)})})}(),function(){"use strict";function s(e,i){i=i||{};var s=/ctrl|alt|shift|cmd/i,o=t?n:r;return e.replace(/\((.+?)\)/g,function(e,n){if(s.test(n)){var r=_.map(n.toLowerCase().split(/[\-\+]/),function(e){return o[e.toLowerCase()]||e.toUpperCase()});e=r.join(t?"":"+"),i.stripParentheses||(e="("+e+")")}return e})}function o(e){try{return(new Function("return "+e))()}catch(t){return{}}}function u(e){var t="\n",n=(e||"").replace(/\r\n/g,t).replace(/\n\r/g,t).replace(/\r/g,t).split(t);return _.filter(n,function(e){return!!e})}function a(e){var t={"&lt;":"<","&gt;":">","&amp;":"&"};return e.replace(/&(lt|gt|amp);/g,function(e,n){return t[e]||e})}function f(e,t){t=_.extend({},i,t||{});var n=e.split(t.sectionSeparator),r=/^(\w+)\s*:\s*(.+)$/,f=[],l={},c={};return _.each(u(n[1]),function(e){if(e.charAt(0)=="#")return;e=e.replace(t.outlineSeparator,function(e,n){return t.prettifyKeys&&(l[f.length]=s(_.dom.trim(n))),""});var n=e.match(r);if(!n)return f.push(_.dom.trim(e));if(n[2].charAt(0)=="{"){var i={};return i[n[1]]=o(a(n[2])),f.push(i)}f.push(n[1]+":"+a(n[2]))}),n[2]&&_.each(u(n[2]),function(e){if(e.charAt(0)=="#")return;var t=e.match(r);t&&(c[t[1]]=t[2])}),{value:a(_.dom.trim(n[0])),scenario:f,outline:_.keys(l).length?l:null,editorOptions:c}}var e=/AppleWebKit/.test(navigator.userAgent)&&/Mobile\/\w+/.test(navigator.userAgent),t=e||/Mac/.test(navigator.platform),n={ctrl:"⌃",control:"⌃",cmd:"⌘",shift:"⇧",alt:"⌥",enter:"⏎",tab:"⇥",left:"←",right:"→",up:"↑",down:"↓"},r={cmd:"Ctrl",control:"Ctrl",ctrl:"Ctrl",alt:"Alt",shift:"Shift",left:"←",right:"→",up:"↑",down:"↓"},i={parse:!0,sectionSeparator:"~~~",outlineSeparator:/\s+:::\s+(.+)$/,prettifyKeys:!0,stripParentheses:!1};CodeMirror.movie=function(e,t,n){var r=null;t=_.extend({},i,t||{}),n=_.extend({theme:"espresso",mode:"text/html",indentWithTabs:!0,tabSize:4,lineNumbers:!0,onCursorActivity:function(){u.setLineClass(r,null,null),r=u.setLineClass(u.getCursor().line,null,"activeline")},onKeyEvent:function(e,t){if(e.getOption("readOnly"))return t.stop(),!0}},n||{}),_.isString(e)&&(e=document.getElementById(e));var s=n.value||e.value||"";t.parse&&(_.extend(t,f(s,t)),s=t.value,t.editorOptions&&_.extend(n,t.editorOptions)),s=s.replace(/\r?\n/g,"\n");var o=s.indexOf("|");e.value=n.value=s=s.replace(/\|/g,"");var u=CodeMirror.fromTextArea(e,n);r=u.setLineClass(0,"activeline"),o!=-1&&u.setCursor(u.posFromIndex(o)),u.__initial={content:s,pos:u.getCursor(!0)};var a=u.getWrapperElement();n.height&&(a.style.height=n.height+"px"),a.className+=" CodeMirror-movie"+(t.outline?" CodeMirror-movie_with-outline":"");var l=CodeMirror.scenario(t.scenario,u);return t.outline&&(a.className+=" CodeMirror-movie_with-outline",a.appendChild(CodeMirror.scenarioOutline(t.outline,l))),l}}();
+(function(){var e=0,t=["ms","moz","webkit","o"];for(var n=0;n<t.length&&!window.requestAnimationFrame;++n)window.requestAnimationFrame=window[t[n]+"RequestAnimationFrame"],window.cancelAnimationFrame=window[t[n]+"CancelAnimationFrame"]||window[t[n]+"CancelRequestAnimationFrame"];window.requestAnimationFrame||(window.requestAnimationFrame=function(t,n){var r=(new Date).getTime(),i=Math.max(0,16-(r-e)),s=window.setTimeout(function(){t(r+i)},i);return e=r+i,s}),window.cancelAnimationFrame||(window.cancelAnimationFrame=function(e){clearTimeout(e)})})(),function(e){function s(){if(!n.length)return;var e=+(new Date),t=[],r,i;for(var o=0;o<n.length;o++){r=n[o];var i=r.options;r.pos===1||r.endTime<=e?(i.step.call(r,r.pos=1),r.stop()):(r.pos=i.easing(e-r.startTime,0,1,i.duration),i.step.call(r,r.pos),t.push(r))}n=t,n.length&&requestAnimationFrame(s)}function o(e){_.indexOf(n,e)==-1&&(n.push(e),n.length==1&&s())}function u(e){this.options=_.extend({},r,e||{});var t=this.options.easing;if(_.isString(t)){if(!i[t])throw'Unknown "'+t+'" easing function';this.options.easing=i[t]}if(!_.isFunction(this.options.easing))throw"Easing should be a function";this._id=_.uniqueId("tw"),this.options.autostart&&this.start()}var t=function(){},n=[],r={duration:500,easing:"linear",step:t,complete:t,autostart:!0},i={linear:function(e,t,n,r){return n*e/r+t},easeInQuad:function(e,t,n,r){return n*(e/=r)*e+t},easeOutQuad:function(e,t,n,r){return-n*(e/=r)*(e-2)+t},easeInOutQuad:function(e,t,n,r){return(e/=r/2)<1?n/2*e*e+t:-n/2*(--e*(e-2)-1)+t},easeInCubic:function(e,t,n,r){return n*(e/=r)*e*e+t},easeOutCubic:function(e,t,n,r){return n*((e=e/r-1)*e*e+1)+t},easeInOutCubic:function(e,t,n,r){return(e/=r/2)<1?n/2*e*e*e+t:n/2*((e-=2)*e*e+2)+t},easeInExpo:function(e,t,n,r){return e==0?t:n*Math.pow(2,10*(e/r-1))+t-n*.001},easeOutExpo:function(e,t,n,r){return e==r?t+n:n*1.001*(-Math.pow(2,-10*e/r)+1)+t},easeInOutExpo:function(e,t,n,r){return e==0?t:e==r?t+n:(e/=r/2)<1?n/2*Math.pow(2,10*(e-1))+t-n*5e-4:n/2*1.0005*(-Math.pow(2,-10*--e)+2)+t},easeInElastic:function(e,t,n,r,i,s){var o;return e==0?t:(e/=r)==1?t+n:(s||(s=r*.3),!i||i<Math.abs(n)?(i=n,o=s/4):o=s/(2*Math.PI)*Math.asin(n/i),-(i*Math.pow(2,10*(e-=1))*Math.sin((e*r-o)*2*Math.PI/s))+t)},easeOutElastic:function(e,t,n,r,i,s){var o;return e==0?t:(e/=r)==1?t+n:(s||(s=r*.3),!i||i<Math.abs(n)?(i=n,o=s/4):o=s/(2*Math.PI)*Math.asin(n/i),i*Math.pow(2,-10*e)*Math.sin((e*r-o)*2*Math.PI/s)+n+t)},easeInOutElastic:function(e,t,n,r,i,s){var o;return e==0?t:(e/=r/2)==2?t+n:(s||(s=r*.3*1.5),!i||i<Math.abs(n)?(i=n,o=s/4):o=s/(2*Math.PI)*Math.asin(n/i),e<1?-0.5*i*Math.pow(2,10*(e-=1))*Math.sin((e*r-o)*2*Math.PI/s)+t:i*Math.pow(2,-10*(e-=1))*Math.sin((e*r-o)*2*Math.PI/s)*.5+n+t)},easeInBack:function(e,t,n,r,i){return i==undefined&&(i=1.70158),n*(e/=r)*e*((i+1)*e-i)+t},easeOutBack:function(e,t,n,r,i){return i==undefined&&(i=1.70158),n*((e=e/r-1)*e*((i+1)*e+i)+1)+t},easeInOutBack:function(e,t,n,r,i){return i==undefined&&(i=1.70158),(e/=r/2)<1?n/2*e*e*(((i*=1.525)+1)*e-i)+t:n/2*((e-=2)*e*(((i*=1.525)+1)*e+i)+2)+t},easeInBounce:function(e,t,n,r){return n-$.easing.easeOutBounce(x,r-e,0,n,r)+t},easeOutBounce:function(e,t,n,r){return(e/=r)<1/2.75?n*7.5625*e*e+t:e<2/2.75?n*(7.5625*(e-=1.5/2.75)*e+.75)+t:e<2.5/2.75?n*(7.5625*(e-=2.25/2.75)*e+.9375)+t:n*(7.5625*(e-=2.625/2.75)*e+.984375)+t},easeInOutBounce:function(e,t,n,r){return e<r/2?$.easing.easeInBounce(x,e*2,0,n,r)*.5+t:$.easing.easeOutBounce(x,e*2-r,0,n,r)*.5+n*.5+t}};u.prototype={start:function(){this.pos=0,this.startTime=+(new Date),this.endTime=this.startTime+this.options.duration,this.animating=!0,o(this)},stop:function(){this.animating=!1,this.options.complete()}},u.__getAnims=function(){return n},e.Tween=u}(this),function(e){"use strict";function n(e){return e.replace(/\-(\w)/g,function(e,t){return t.toUpperCase()})}function r(e,r){var i=/^-?\d+(?:px)?$/i,s=/^-?\d(?:\.\d+)?/,o=/\d$/,u=n(r);if(e.style[u])return e.style[u];if(t){var a=window.getComputedStyle(e,"");return a.getPropertyValue(r)}if(e.currentStyle){var f=e.currentStyle[r]||e.currentStyle[u],l=e.style||e;if(!i.test(f)&&s.test(f)){var c=l.left,h=e.runtimeStyle.left;e.runtimeStyle.left=e.currentStyle.left;var p=o.test(f)?"em":"";l.left=u==="fontSize"?"1em":f+p||0,f=l.pixelLeft+"px",l.left=c,e.runtimeStyle.left=h}return f}}function i(e,t){if(!e)return;var n={"line-height":1,"z-index":1,opacity:1},r=_.map(t,function(e,t){var r=t.replace(/([A-Z])/g,"-$1").toLowerCase();return r+":"+(!_.isNumber(e)||r in n?e:e+"px")});e.style.cssText+=";"+r.join(";")}function s(e){return e.length===+e.length?_.toArray(e):_.isArray(e)?e:[e]}var t=document.defaultView&&document.defaultView.getComputedStyle;_.extend(e,{trim:function(e){return e&&"trim"in String.prototype?e.trim():e.replace(/^\s+/,"").replace(/\s+$/,"")},hasClass:function(e,t){return~(" "+e.className+" ").indexOf(" "+t+" ")},addClass:function(e,t){return _.each(s(e),function(e){var n=_.filter(t.split(/\s+/g),function(t){return t&&!this.hasClass(e,t)},this);n.length&&(e.className+=(e.className?" ":"")+n.join(" "))},this),e},removeClass:function(e,t){var n=/\s+/g;return _.each(s(e),function(e){e.className=_.difference((e.className||"").split(n),t.split(/\s+/g)).join(" ")},this),e},toggleClass:function(e,t,n){return _.each(s(e),function(e){var r=n;_.isUndefined(r)&&(r=this.hasClass(e,t)),r?this.removeClass(e,t):this.addClass(e,t)},this),e},getByClass:function(e,t){return document.getElementsByClassName?(t||document).getElementsByClassName(e):_.filter((t||document).getElementsByTagName("*"),function(t){return this.hasClass(t,e)},this)},remove:function(e){return _.each(s(e),function(e){e.parentNode&&e.parentNode.removeChild(e)}),e},toDOM:function(e){var t=document.createElement("div");return t.innerHTML=e,t.firstChild},css:function(e,t,n){if(_.isString(t)&&_.isUndefined(n))return r(e,t);if(_.isString(t)){var s={};s[t]=n,t=s}i(e,t)}})}(_.dom={}),CodeMirror.scenario=function(){"use strict";function u(e){var t=["Webkit","Moz","O","ms"],n=e.charAt(0).toUpperCase()+e.slice(1),r=(e+" "+t.join(n+" ")+n).split(" "),i=document.createElement("div"),s=null;for(var o in r){s=r[o];if(i.style[s]!==undefined)return s}return s}function f(e){if(_.isString(e)){var t=e.split(":");return{name:t.shift(),options:t.join(":")}}var n=_.keys(e)[0];return{name:n,options:e[n]}}function l(e,t,n){if(_.isString(e)){var r={};r[t]=e,e=r}return _.extend(n,e||{})}function c(e,t){if(_.isString(e)){if(e==="caret")return t.getCursor(!0);if(~e.indexOf(":")){var n=e.split(":");return{line:parseInt(n[0],10),ch:parseInt(n[1],10)}}e=parseInt(e,10)}return _.isNumber(e)?t.posFromIndex(e):e}function h(e,t){if(!!t)return setTimeout(e,t);e()}function p(t,n){this._actions=t,this._actionIx=0,this._editor=null,this._state=e,this._timerQueue=[],n&&"getValue"in n&&(this._editor=n);var r=this._editor;r&&!r.__initial&&(r.__initial={content:r.getValue(),pos:r.getCursor(!0)})}var e="idle",t="play",n="pause",r=/\s+/,i=Array.prototype.slice,s={beforeDelay:1e3,afterDelay:1e3},o=function(){var e=document.createElement("div"),t=u("transform");return t?(e.style[t]="translateZ(0)",/translatez/i.test(e.style[t])):!1}(),a={type:function(e,t,n,r){e=l(e,"text",{text:"",delay:60,pos:null});if(!e.text)throw'No text provided for "type" action';e.pos!==null&&t.setCursor(c(e.pos,t));var i=e.text.split("");r(function s(){var o=i.shift();t.replaceSelection(o,"end"),i.length?r(s,e.delay):n()},e.delay)},wait:function(e,t,n,r){e=l(e,"timeout",{timeout:100}),r(n,parseInt(e.timeout,10))},moveTo:function(e,t,n,r){e=l(e,"pos",{delay:80,immediate:!1});if(!e.pos)throw'No position specified for "moveTo" action';var i=t.getCursor(!0);t.setSelection(i,i);var s=c(e.pos,t);e.immediate&&(t.setCursor(s),n());var o=s.line-i.line,u=s.ch-i.ch,a=Math.max(u,o),f=o<0?-1:1,h=u<0?-1:1;r(function p(){i=t.getCursor(!0),a>0&&(i.line!=s.line||i.ch!=s.ch)?(i.line!=s.line&&(i.line+=f),i.ch!=s.ch&&(i.ch+=h),t.setCursor(i),a--,r(p,e.delay)):(t.setCursor(s),n())},e.delay)},jumpTo:function(e,t,n,r){e=l(e,"pos",{afterDelay:200});if(!e.pos)throw'No position specified for "jumpTo" action';t.setCursor(c(e.pos,t)),r(n,e.afterDelay)},run:function(e,t,n,r){e=l(e,"command",{beforeDelay:500,times:1});var i=e.times;r(function s(){try{_.isFunction(e.command)?e.command(t,e):t.execCommand(e.command)}catch(o){}--i>0?r(s,e.beforeDelay):n()},e.beforeDelay)},select:function(e,t,n,r){e=l(e,"to",{from:"caret"});var i=c(e.from,t),s=c(e.to,t);t.setSelection(i,s),n()}};return CodeMirror.commands.revert=function(e){e.__initial&&(e.setValue(e.__initial.content),e.setCursor(e.__initial.pos))},p.prototype={_setup:function(e){return!e&&this._editor&&(e=this._editor),e.execCommand("revert"),e},play:function(e){if(this._state===t)return;if(this._state===n){e=e||this._editor,e.focus();var r=null;while(r=this._timerQueue.shift())h(r.fn,r.delay);this._state=t,this.trigger("resume");return}this._editor=e=this._setup(e),e.focus();var i=_.bind(this.requestTimer,this),o=this;this._actionIx=0;var u=function(){if(o._actionIx>=o._actions.length)return i(function(){o.stop()},s.afterDelay);o.trigger("action",o._actionIx);var t=f(o._actions[o._actionIx++]);if(!(t.name in a))throw"No such action: "+t.name;a[t.name].call(o,t.options,e,u,i)};this._state=t,this._editor.setOption("readOnly",!0),this.trigger("play"),i(u,s.beforeDelay)},pause:function(){this._state=n,this.trigger("pause")},stop:function(){this._state!==e&&(this._state=e,this._timerQueue.length=0,this._editor.setOption("readOnly",!1),this.trigger("stop"))},state:function(){return this._state},toggle:function(){this._state===t?this.pause():this.play()},requestTimer:function(e,n){if(this._state===t)return h(e,n);this._timerQueue.push({fn:e,delay:n})},on:function(e,t,n){var i,s,o,u,a;if(!t)return this;e=e.split(r),i=this._callbacks||(this._callbacks={});while(s=e.shift())a=i[s],o=a?a.tail:{},o.next=u={},o.context=n,o.callback=t,i[s]={tail:u,next:a?a.next:o};return this},off:function(e,t,n){var i,s,o,u,a,f;if(!(s=this._callbacks))return;if(!(e||t||n))return delete this._callbacks,this;e=e?e.split(r):_.keys(s);while(i=e.shift()){o=s[i],delete s[i];if(!o||!t&&!n)continue;u=o.tail;while((o=o.next)!==u)a=o.callback,f=o.context,(t&&a!==t||n&&f!==n)&&this.on(i,a,f)}return this},trigger:function(e){var t,n,s,o,u,a,f;if(!(s=this._callbacks))return this;a=s.all,e=e.split(r),f=i.call(arguments,1);while(t=e.shift()){if(n=s[t]){o=n.tail;while((n=n.next)!==o)n.callback.apply(n.context||this,f)}if(n=a){o=n.tail,u=[t].concat(f);while((n=n.next)!==o)n.callback.apply(n.context||this,u)}}return this}},_.extend(function(e,t){return new p(e,t)},{defineAction:function(e,t){a[e]=t},makeOptions:l,makePos:c,has3d:o,prefixed:u})}(),CodeMirror.scenarioTooltip=function(){"use strict";function i(){var e=document.body,t=document.documentElement,n=t.clientTop||e.clientTop||0,r=t.clientLeft||e.clientLeft||0,i=window.pageYOffset||t.scrollTop||e.scrollTop,s=window.pageXOffset||t.scrollLeft||e.scrollLeft;return{top:i-n,left:s-r,width:e.clientWidth||t.clientWidth,height:e.clientHeight||t.clientHeight}}function s(e,t){t=_.extend({},r,t||{}),_.dom.css(e,{left:0,top:0});var n=_.dom.getByClass(t.tailClass,e)[0],s=0,o=0,u=t.position,a=i(),f=e.offsetWidth,l=e.offsetHeight,c;s=Math.min(a.width-f-t.popupMargin,Math.max(t.popupMargin,u.x-a.left-f/2)),l+n.offsetHeight+t.popupMargin+a.top<u.y?(o=Math.max(0,u.y-l-n.offsetHeight),c=!0):(o=u.y+n.offsetHeight,c=!1);var h=t.tailMargin,p=f-t.tailMargin;n.style.left=Math.min(p,Math.max(h,u.x-s-a.left))+"px",_.dom.css(e,{left:s,top:o}),_.dom.toggleClass(e,t.belowClass,c)}function o(e,i){i=_.extend({},r,i||{});var s=n.prefixed("transformOrigin"),o=n.prefixed("transform"),u=e.style,a=_.dom.getByClass(i.tailClass,e)[0],f=_.dom.css(a,"left"),l=a.offsetTop;_.dom.hasClass(e,i.belowClass)&&(l-=a.offsetHeight),l+="px",u[s]=f+" "+l;var c=n.has3d?"translateZ(0) ":"";return t=new Tween({duration:800,easing:"easeOutElastic",step:function(e){u[o]=c+"scale("+e+")"},complete:function(){t=null,i.onComplete&&i.onComplete(e)}})}function u(e,t){var n=e.style;return new Tween({duration:200,easing:"linear",step:function(e){n.opacity=1-e},complete:function(){_.dom.remove(e),t.onComplete&&t.onComplete(e)}})}function a(t,r,i){f(),e=_.dom.toDOM('<div class="CodeMirror-tooltip"><div class="CodeMirror-tooltip__content">'+t+"</div>"+'<div class="CodeMirror-tooltip__tail"></div>'+"</div>"),_.dom.css(e,n.prefixed("transform"),"scale(0)"),document.body.appendChild(e),s(e,{position:r}),o(e,{onComplete:i})}function f(n){e?(t&&(t.stop(),t=null),u(e,{onComplete:n}),e=null):n&&n()}function l(e,t){return e==="caret"?t.cursorCoords(!0):e&&"x"in e&&"y"in e?e:t.charCoords(n.makePos(e))}var e=null,t=null,n=CodeMirror.scenario,r={tailClass:"CodeMirror-tooltip__tail",belowClass:"CodeMirror-tooltip_below",popupMargin:5,tailMargin:11};return n.defineAction("tooltip",function(e,t,r,i){e=n.makeOptions(e,"text",{wait:4e3,pos:"caret"});var s=l(e.pos,t);a(e.text,s,function(){i(function(){f(function(){i(r)})},e.wait)})}),n.defineAction("showTooltip",function(e,t,r,i){e=n.makeOptions(e,"text",{pos:"caret"}),a(e.text,l(e.pos,t)),r()}),n.defineAction("hideTooltip",function(e,t,n,r){f(n)}),{show:a,hide:f}}(),CodeMirror.scenarioOutline=function(){"use strict";var e={wrapperTemplate:'<ul class="CodeMirror-outline"><%= content %></ul>',itemTemplate:'<li data-action-id="<%= id %>" class="CodeMirror-outline__item"><%= title %></li>',itemClass:"CodeMirror-outline__item",selectedClass:"CodeMirror-outline__item_selected"};return function(t,n,r){r=_.extend({},e,r||{});var i=_.keys(t);i.sort(function(e,t){return parseInt(e,10)-parseInt(t,10)});var s=_.template(r.itemTemplate),o=_.map(i,function(e){return s({title:t[e],id:e})}),u=_.dom.toDOM(_.template(r.wrapperTemplate,{content:o.join("")}));return r.target&&r.target.appendChild(u),n.on("action",function(e){var t=_.dom.getByClass(r.itemClass,u),n=_.find(t,function(t){return t.getAttribute("data-action-id")==e});n&&(_.dom.removeClass(t,r.selectedClass),_.dom.addClass(n,r.selectedClass))}).on("stop",function(){_.dom.removeClass(_.dom.getByClass(r.itemClass,u),r.selectedClass)}),u}}(),CodeMirror.scenarioPrompt=function(){"use strict";function i(n,r,i){s(),e=_.dom.toDOM('<div class="CodeMirror-prompt"><div class="CodeMirror-prompt__title">'+n+"</div>"+'<input type="text" name="prompt" class="CodeMirror-prompt__input" readonly="readonly" />'+"</div>"),t=_.dom.toDOM('<div class="CodeMirror-prompt__shade"></div>'),r.appendChild(e),r.appendChild(t),o(e,t,{onComplete:i})}function s(r){e?(n&&(n.stop(),n=null),u(e,t,{onComplete:r}),e=t=null):r&&r()}function o(e,t,i){i=i||{};var s=r.prefixed("transform"),o=e.style,u=t.style,a=e.offsetHeight,f=_.template(r.has3d?"translate3d(0, <%= pos %>, 0)":"translate(0, <%= pos %>)");return u.opacity=0,new Tween({duration:200,step:function(e){u.opacity=e}}),o[s]=f({pos:-a}),n=new Tween({duration:400,easing:"easeOutCubic",step:function(e){o[s]=f({pos:-a*(1-e)+"px"})},complete:function(){n=null,i.onComplete&&i.onComplete(e,t)}})}function u(e,t,n){var i=e.style,s=t.style,o=e.offsetHeight,u=r.prefixed("transform"),a=_.template(r.has3d?"translate3d(0, <%= pos %>, 0)":"translate(0, <%= pos %>)");return new Tween({duration:200,step:function(e){i[u]=a({pos:-o*e+"px"}),s.opacity=1-e},complete:function(){_.dom.remove([e,t]),n.onComplete&&n.onComplete(e,t)}})}function a(e,t,n,r){var i=t.text.split("");n(function s(){e.value+=i.shift(),i.length?n(s,t.delay):r()},t.delay)}var e=null,t=null,n=null,r=CodeMirror.scenario;r.defineAction("prompt",function(e,t,n,o){e=r.makeOptions(e,"text",{title:"Enter something",delay:80,typeDelay:1e3,hideDelay:2e3}),i(e.title,t.getWrapperElement(),function(t){o(function(){a(_.dom.getByClass("CodeMirror-prompt__input",t)[0],e,o,function(){o(function(){s(n)},e.hideDelay)})},e.typeDelay)})})}(),function(){"use strict";function s(e,i){i=i||{};var s=/ctrl|alt|shift|cmd/i,o=t?n:r;return e.replace(/\((.+?)\)/g,function(e,n){if(s.test(n)){var r=_.map(n.toLowerCase().split(/[\-\+]/),function(e){return o[e.toLowerCase()]||e.toUpperCase()});e=r.join(t?"":"+"),i.stripParentheses||(e="("+e+")")}return e})}function o(e){try{return(new Function("return "+e))()}catch(t){return{}}}function u(e){var t="\n",n=(e||"").replace(/\r\n/g,t).replace(/\n\r/g,t).replace(/\r/g,t).split(t);return _.filter(n,function(e){return!!e})}function a(e){var t={"&lt;":"<","&gt;":">","&amp;":"&"};return e.replace(/&(lt|gt|amp);/g,function(e,n){return t[e]||e})}function f(e,t){t=_.extend({},i,t||{});var n=e.split(t.sectionSeparator),r=/^(\w+)\s*:\s*(.+)$/,f=[],l={},c={};return _.each(u(n[1]),function(e){if(e.charAt(0)=="#")return;e=e.replace(t.outlineSeparator,function(e,n){return t.prettifyKeys&&(l[f.length]=s(_.dom.trim(n))),""});var n=e.match(r);if(!n)return f.push(_.dom.trim(e));if(n[2].charAt(0)=="{"){var i={};return i[n[1]]=o(a(n[2])),f.push(i)}f.push(n[1]+":"+a(n[2]))}),n[2]&&_.each(u(n[2]),function(e){if(e.charAt(0)=="#")return;var t=e.match(r);t&&(c[t[1]]=t[2])}),{value:a(_.dom.trim(n[0])),scenario:f,outline:_.keys(l).length?l:null,editorOptions:c}}var e=/AppleWebKit/.test(navigator.userAgent)&&/Mobile\/\w+/.test(navigator.userAgent),t=e||/Mac/.test(navigator.platform),n={ctrl:"⌃",control:"⌃",cmd:"⌘",shift:"⇧",alt:"⌥",enter:"⏎",tab:"⇥",left:"←",right:"→",up:"↑",down:"↓"},r={cmd:"Ctrl",control:"Ctrl",ctrl:"Ctrl",alt:"Alt",shift:"Shift",left:"←",right:"→",up:"↑",down:"↓"},i={parse:!0,sectionSeparator:"~~~",outlineSeparator:/\s+:::\s+(.+)$/,prettifyKeys:!0,stripParentheses:!1};CodeMirror.movie=function(e,t,n){var r=null;t=_.extend({},i,t||{}),n=_.extend({theme:"espresso",mode:"text/html",indentWithTabs:!0,tabSize:4,lineNumbers:!0,onCursorActivity:function(){u.setLineClass(r,null,null),r=u.setLineClass(u.getCursor().line,null,"activeline")},onKeyEvent:function(e,t){if(e.getOption("readOnly"))return t.stop(),!0}},n||{}),_.isString(e)&&(e=document.getElementById(e));var s=n.value||e.value||"";t.parse&&(_.extend(t,f(s,t)),s=t.value,t.editorOptions&&_.extend(n,t.editorOptions)),s=s.replace(/\r?\n/g,"\n");var o=s.indexOf("|");e.value=n.value=s=s.replace(/\|/g,"");var u=CodeMirror.fromTextArea(e,n);r=u.setLineClass(0,"activeline"),o!=-1&&u.setCursor(u.posFromIndex(o)),u.__initial={content:s,pos:u.getCursor(!0)};var a=u.getWrapperElement();n.height&&(a.style.height=n.height+"px"),a.className+=" CodeMirror-movie"+(t.outline?" CodeMirror-movie_with-outline":"");var l=CodeMirror.scenario(t.scenario,u);return t.outline&&(a.className+=" CodeMirror-movie_with-outline",a.appendChild(CodeMirror.scenarioOutline(t.outline,l))),l}}();
View
2  index.html
@@ -45,7 +45,7 @@
&lt;/html&gt;
~~~
prompt: Hello world
-type: ul>li.item$*4>a{Item $}
+type: ul>li.item$*4>a{Item $} ::: Enter Abbreviation
wait: 1000
tooltip: Run “Expand Abbreviation” action (simply press Tab key) ::: Expand Abbreviation (Cmd-E)
wait: 600
View
12 src/dom.js
@@ -87,6 +87,10 @@
* @returns {Array}
*/
function ar(obj) {
+ if (obj.length === +obj.length) {
+ return _.toArray(obj);
+ }
+
return _.isArray(obj) ? obj : [obj];
}
@@ -141,13 +145,9 @@
* @return {Element}
*/
removeClass: function(elem, className) {
+ var reSplit = /\s+/g;
_.each(ar(elem), function(el) {
- var elemClass = el.className || '';
- _.each(className.split(/\s+/g), function(c) {
- elemClass = elemClass.replace(new RegExp('\\b' + c + '\\b'), '');
- });
-
- el.className = this.trim(elemClass);
+ el.className = _.difference((el.className || '').split(reSplit), className.split(/\s+/g)).join(' ');
}, this);
return elem;
Please sign in to comment.
Something went wrong with that request. Please try again.