oj
Version:
A unified templating language for the people. Thirsty people.
2 lines • 39.9 kB
JavaScript
// oj.min.js v0.3.4 | Copyright 2013 Evan Moran | ojjs.org/license
(function(e,t){if(typeof module=="object"&&module.exports){try{$=require("jquery")}catch(n){}module.exports=t(e,$)}else typeof define=="function"&&define.amd?define(["jquery"],function(n){return t(e,n)}):e.oj=t(e,e.jQuery||e.Zepto||e.ender||e.$)})(this,function(e,n){function c(){return c.tag.apply(this,["oj"].concat(o.call(arguments)).concat([{__quiet__:1}]))}function v(e){return!!e.match(/[A-Z]/)}function m(e,t){return s.hasOwnProperty.call(e,t)}function g(e){var t=p(e),n=t.length,r=new Array(n),i=0;for(;i<n;i++)r[i]=e[t[i]];return r}function y(e){return e?c.isArray(e)?o.call(e):c.isArguments(e)?o.call(e):e.toArray&&c.isFunction(e.toArray)?e.toArray():g(e):[]}function b(e){if(c.isArray(e))return e.length===0;for(var t in e)if(m(e,t))return!1;return!0}function w(e){return!c.isArray(e)&&!c.isPlainObject(e)?e:c.isArray(e)?e.slice():d({},e)}function E(e){var t=arguments,n=e,r=t.length,i=3<=r?o.call(t,1,r-=1):(r=1,[]),s=t[r++],u,a;for(u=0;u<i.length;u++)a=i[u],typeof n[a]!="object"&&(n[a]={}),u===i.length-1?n[a]=s:n=n[a];return e}function S(e,t){t==null&&(t=!1),t||e.sort();var n=[],r,i;for(r=0;r<e.length;r++){i=e[r];if(r>0&&e[r-1]===e[r])continue;n.push(i)}return n}function x(){for(var e=0;e<arguments.length;e++)if(arguments[e]!=null)return arguments[e];return null}function T(e,t){t=x(t,e,""),e=x(e,0);var n="oj: ";throw e&&(n="oj."+e+": "),new Error(n+t)}function N(e,t,n){e||T(t,n)}function C(e,t,n,r){t={1:"first",2:"second",3:"third",4:"fourth"}[t],N(!r||typeof n===r,e,""+r+" expected for "+t+" argument")}function k(e,t,n){return e.split(t,n).map(function(e){return e.trim()})}function L(e){return e.replace(/([a-z])([A-Z])/g,"$1_$2").toLowerCase()}function A(e){return L(e).replace(/[ _]/g,"-")}function M(e,t){e!=null&&(e.tagName=t)}function _(e){return e.tagName}function D(e){return"_"+e}function P(e,t){e!=null&&(e.oj=t)}function H(e){return(e!=null?e.oj:0)!=null?e.oj:null}function U(e,t){t=d({inline:!0,indent:""},t),t.semi=!t.inline;var n="",r=p(e).sort(),i=t.indent!=null?t.indent:"",s=t.inline?"":"\n",o,u,a,f;for(o=0;o<r.length;o++)a=r[o],f=t.semi||o!==r.length-1?";":"",u=A(a),n+=""+i+u+":"+e[a]+f+s;return n}function z(e){if(!c.isPlainObject(e))return e;var t,n,r,i="",s="",o=p(e).sort();for(r=0;r<o.length;r++)t=o[r],n=e[t],n===!0?i+=""+s+t:i+=""+s+t+'="'+n+'"',s=" ";return i}function W(e){var t={},n,r;for(n in e)r=e[n],X(r,t,[""],[""],n);return t}function X(e,t,n,r,i){var s,o,u,a,f,l,c,h,p,d,v,m,g,y,b,w={widescreen:"only screen and (min-width: 1200px)",monitor:"",tablet:"only screen and (min-width: 768px) and (max-width: 959px)",phone:"only screen and (max-width: 767px)"};for(v in e){d=e[v];if(typeof d!="object")m=n.sort().join(","),f=r.sort().join(","),f!==""&&(f="@media "+f),E(t,i,f,m,v,d);else{v.indexOf("@media")===0?(a=!0,l=c=[],g=n,v=v.slice("@media".length).trim(),s=r):(a=!1,g=c=[],l=r,s=n),p=k(v,","),a&&(p=p.map(function(e){return x(w[e],e)}));for(y=0;y<s.length;y++){h=s[y];for(b=0;b<p.length;b++)u=p[b],o=u,u.indexOf("&")===-1&&h!==""&&(o=(a?"& and ":"& ")+o),c.push(o.replace(/&/g,h))}X(d,t,g,l,i)}}}function V(e){return""+e+"-style"}function $(e,t){t=x(t,{});var n,r,i,s,o,u,a,f,l=t.minify!=null?t.minify:0,h=t.tags!=null?t.tags:0,p=l?"":"\n",a=l?"":" ",d=l,v="";for(i in e){u=e[i],i&&(i=i.replace(/,/g,","+a),v+=""+i+a+"{"+p);for(o in u)f=u[o],n=!l&&i?" ":"",o=o.replace(/,/g,","+p),v+=""+n+o+a+"{"+p,r=l?n:n+" ",s=U(f,{inline:d,indent:r}),v+=s+n+"}"+p;i!==""&&(v+="}"+p)}try{v=c._minifyCSS(v,t)}catch(m){throw new Error("css minification error: "+m.message+"\nCould not minify:\n"+v)}return v}function J(e,t){t=x(t,{});var n,r,i=t.minify!=null?t.minify:0,s=t.tags!=null?t.tags:0,o=i?"":"\n",u=i?"":" ",a=i,f="";for(r in e)n=e[r],s&&(f+='<style class="'+r+'-style">'+o),f+=$(n,t),s&&(f+=""+o+"</style>"+o);return f}function K(e,t,n){var r=n.indent;n.indent+=" ",e(t,n),n.indent=r}function Q(e,t){if(c.isArray(e))G(e,t);else if(c.isString(e)){t.html!=null&&t.html.push(e);if(e.length>0&&e[0]==="<"){var n=document.createElement("div");n.innerHTML=e,t.dom!=null&&t.dom.appendChild(n)}else t.dom!=null&&t.dom.appendChild(document.createTextNode(e))}else if(c.isBoolean(e)||c.isNumber(e))t.html!=null&&t.html.push(""+e),t.dom!=null&&t.dom.appendChild(document.createTextNode(""+e));else if(c.isFunction(e)){var r=t.data||{};Q(c(function(){e.call(r,r)}),t)}else c.isDate(e)?(t.html!=null&&t.html.push(""+e.toLocaleString()),t.dom!=null&&t.dom.appendChild(document.createTextNode(""+e.toLocaleString()))):c.isOJ(e)&&(t.types!=null&&t.types.push(e),t.html!=null&&t.html.push(e.toHTML(t)),t.dom!=null&&t.dom.appendChild(e.toDOM(t)),t.css!=null&&d(t.css,e.toCSSMap(t)))}function G(e,t){if(e.length===0)return;var n=e[0],r=typeof n,i=c.unionArguments(e.slice(1)),s=i.options,o=i.args,u,a;if(r==="function"||r==="object")n=x(_(n),n);c.isString(n)&&n.length>0||T("compile","tag name is missing"),t.tags[n]=!0;if(v(n[0]))return K(Q,new c[n](e.slice(1)),t);if(t.css&&n==="css")for(a in s)u=s[a],t.css.oj=x(t.css.oj,{}),t.css.oj[a]=x(t.css.oj[a],{}),d(t.css.oj[a],u);if(n==="!DOCTYPE"){C("compile",1,e[1],"string"),t.ignore[n]||t.html&&t.html.push("<"+n+" "+e[1]+">");return}if(!t.ignore[n]){var f=Y(s),h;if(t.dom&&typeof document!==l&&document!==null){h=document.createElement(n),c.isDOMElement(t.dom)&&t.dom.appendChild(h),t.dom=h;if(c.isPlainObject(s)){var m=p(s).sort(),g,y,b;for(g=0;g<m.length;g++)y=m[g],b=s[y],b===!0?h.setAttributeNode(document.createAttribute(y)):h.setAttribute(y,b)}Z(f,h,t.inserts)}if(t.html){var w=x(z(s),""),E=w===""?"":" ";t.html.push("<"+n+E+w+">")}}if(t.ignore[n]!=="deep")for(g=0;g<o.length;g++){var S=o[g];t.html!=null&&!t.minify&&o.length>1&&t.html.push("\n "+t.indent),K(Q,S,t)}t.html!=null&&!t.minify&&o.length>1&&t.html.push("\n"+t.indent),t.ignore[n]||(t.html!=null&&(o.length>0||c.tag.isClosed(n))&&t.html.push("</"+n+">"),t.dom&&(t.dom=t.dom.parentNode))}function Y(e){var t={bind:1,on:1,off:1,live:1,blur:1,change:1,click:1,dblclick:1,focus:1,focusin:1,focusout:1,hover:1,keydown:1,keypress:1,keyup:1,mousedown:1,mouseenter:1,mouseleave:1,mousemove:1,mouseout:1,mouseup:1,ready:1,resize:1,scroll:1,select:1,insert:1},n,r,i;c.isArray(e!=null?e.c:void 0)&&(e.c=e.c.join(" ")),c.isArray(e!=null?e["class"]:void 0)&&(e["class"]=e["class"].join(" ")),(e!=null?e.c:void 0)!=null&&((e!=null?e["class"]:void 0)!=null?e["class"]+=" "+e.c:e["class"]=e.c,delete e.c),c.isPlainObject(e!=null?e.style:void 0)&&(e.style=U(e.style,{inline:!0}));if(c.isPlainObject(e))for(r in e)i=e[r],(i===null||i===void 0||i===!1)&&delete e[r];n={};if(c.isPlainObject(e))for(r in e)i=e[r],t[r]!=null&&(n[r]=i,delete e[r]);return n}function Z(e,t,n){var r,i,s=[],o=function(e,t){return function(){e.call(t,t)}};for(r in e)i=e[r],N(c.$!=null,"jquery is missing when binding a '"+r+"' event"),r=="insert"&&n?n.push(o(i,t)):c.isArray(i)?s.push(c.$(t)[r].apply(this,i)):s.push(c.$(t)[r](i));return s}function et(e,t){var n,r;for(r in t)c.copyProperty(e,t,r);n=function(){},n.prototype=t.prototype,e.prototype=new n,e.base=e.__super__=t.prototype}function tt(e){return new(i.bind.apply(e,arguments))}function yt(e){return e==null&&(e={}),e=d({get:f,set:f,first:!1},e),function(){var t,n,r,i,s=y(arguments),o=jQuery(this);if(c.isFunction(e.get)&&s.length===0){n=[];for(i=0;i<o.length;i++){t=o[i],n.push(e.get(c.$(t)));if(e.first)return n[0]}return n}if(c.isFunction(e.set)){n=o;for(i=0;i<o.length;i++){t=o[i],r=e.set(c.$(t),s);if(r!=null)return r}return o}}}function bt(e,t){var n=0;for(;n<e.length;n++)e[n].inserted();if(t)for(n=0;n<t.length;n++)t[n]()}function wt(e,t){var n,r;for(r in e){n=e[r];if(r==="oj-style"&&(t!=null?!t.global:!0))continue;c.$("."+V(r)).length===0&&c.$("head").append(c._styleTagFromMediaObject(r,n))}}function Et(e,t){var n=e[0],r=n.firstChild;if(c.isOJInstance(H(n)))return H(n);if(c.isDOMText(r))return c.parse(r.nodeValue);if(c.isDOMElement(r))return x(H(r),r)}function Ct(e){var t=Nt.exec(e);return[t[1]||"",t[2]||"",t[3]||"",t[4]||""]}function kt(e,t){var n=0,r=e.length-1,i;while(r>=0)i=e[r],i==="."?e.splice(r,1):i===".."?(e.splice(r,1),n++):n&&(e.splice(r,1),n--),r--;if(t)while(n--)e.unshift("..");return e}var r=Array.prototype,i=Function.prototype,s=Object.prototype,o=r.slice,u=r.unshift,a=r.concat,f=function(e){return e},l="undefined";c.version="0.3.4",c.settings={defaultThemes:null},c.isClient=!(typeof process!==l&&process!==null?process.versions!=null?process.versions.node:0:0),typeof n!=l&&(c.$=n),c.oj=c,c.load=function(e,t){return c.$(function(){var n=function(){require(e).call(t,t)};return c.$.ojBody(n),c.onload()})};var h={queue:[],loaded:!1};c.onload=function(e){if(c.isUndefined(e)){h.loaded=!0;while(e=h.queue.shift())e()}else h.loaded?e():h.queue.push(e)},c.emit=function(){return c.tag.apply(c,["oj"].concat(o.call(arguments)))},c.isDefined=function(e){return typeof e!==l},c.isOJ=function(e){return e!=null?!!e.isOJ:!!void 0},c.isOJType=function(e){return c.isOJ(e)&&e.type===e},c.isOJInstance=function(e){return c.isOJ(e)&&!c.isOJType(e)},c.isEvented=function(e){return!!(e&&e.on&&e.off&&e.trigger)},c.isDOM=function(e){return!!e&&e.nodeType!=null},c.isDOMElement=function(e){return!!e&&e.nodeType===1},c.isDOMAttribute=function(e){return!!e&&e.nodeType===2},c.isDOMText=function(e){return!!e&&e.nodeType===3},c.isjQuery=function(e){return!!e&&!!e.jquery},c.isUndefined=function(e){return e===void 0},c.isBoolean=function(e){return e===!0||e===!1||s.toString.call(e)==="[object Boolean]"},c.isNumber=function(e){return!!(e===0||e&&e.toExponential&&e.toFixed)},c.isString=function(e){return!!(e===""||e&&e.charCodeAt&&e.substr)},c.isDate=function(e){return!!(e&&e.getTimezoneOffset&&e.setUTCFullYear)},c.isPlainObject=function(e){return c.$.isPlainObject(e)&&!c.isOJ(e)},c.isFunction=c.$.isFunction,c.isArray=c.$.isArray,c.isRegEx=function(e){return s.toString.call(e)==="[object RegExp]"},c.isArguments=function(e){return s.toString.call(e)==="[object Arguments]"},c.parse=function(e){var t,n=e;return e===l?n=void 0:e==="null"?n=null:e==="true"?n=!0:e==="false"?n=!1:isNaN(t=parseFloat(e))||(n=t),n},c.unionArguments=function(e){var t={},n=[],r,i=0;for(;i<e.length;i++)r=e[i],c.isPlainObject(r)?t=d(t,r):n.push(r);return{options:t,args:n}},c.argumentShift=function(e,t){var n;return c.isPlainObject(e)&&t!=null&&e[t]!=null&&(n=e[t],delete e[t]),n};var p=Object.keys,d=c.$.extend;c.addMethods=function(e,t){for(var n in t)c.addMethod(e,n,t[n])},c.addMethod=function(e,t,n){C("addMethod",2,t,"string"),C("addMethod",3,n,"function"),Object.defineProperty(e,t,{value:n,enumerable:!1,writable:!1,configurable:!0})},c.removeMethod=function(e,t){C("removeMethod",2,t,"string"),delete e[t]},c.addProperties=function(e,t){var n,r;for(r in t)n=t[r],(n!=null?n.get:void 0)==null&&(n!=null?n.value:void 0)==null&&(n={value:n,writable:!0}),c.addProperty(e,r,n)},c.addProperty=function(e,t,n){C("addProperty",2,t,"string"),C("addProperty",3,n,"object"),n=d({enumerable:!0,configurable:!0},n),Object.getOwnPropertyDescriptor(e,t)!=null&&c.removeProperty(e,t),Object.defineProperty(e,t,n)},c.removeProperty=function(e,t){C("removeProperty",2,t,"string"),delete e[t]},c.isProperty=function(e,t){return C("isProperty",2,t,"string"),Object.getOwnPropertyDescriptor(e,t).get!=null},c.copyProperty=function(e,t,n){var r=Object.getOwnPropertyDescriptor(t,n);return r=x(r,{value:[],enumerable:!1,writable:!0,configurable:!0}),r.value!=null&&(r.value=w(r.value)),Object.defineProperty(e,n,r)};var O=[];c._argsTop=function(){return O.length?O[O.length-1]:null},c._argsPush=function(e){O.push(x(e,[]))},c._argsPop=function(){return O.length?O.pop():null},c._argsAppend=function(e){var t=c._argsTop();t!=null&&t.push(e)},c.tag=function(e){C("tag",1,e,"string");var t=2<=arguments.length?o.call(arguments,1):[],n=c.unionArguments(t),r=n.args,i=n.options,s=i.__quiet__,u,a,f,l,h=[e];s&&delete i.__quiet__,b(i)||h.push(i),c._argsPush(h);for(l=0;l<r.length;l++){u=r[l];if(c.isPlainObject(u))continue;c.isFunction(u)?(a=c._argsTop().length,f=u(),a===c._argsTop().length&&f!=null&&c._argsAppend(f)):c._argsAppend(u)}return c._argsPop(),s||c._argsAppend(h),h},c.tag.elements={closed:"a abbr acronym address applet article aside audio b bdo big blockquote body button canvas caption center cite code colgroup command datalist dd del details dfn dir div dl dt em embed fieldset figcaption figure font footer form frameset h1 h2 h3 h4 h5 h6 head header hgroup html i iframe ins keygen kbd label legend li map mark menu meter nav noframes noscript object ol optgroup option output p pre progress q rp rt ruby s samp script section select small source span strike strong style sub summary sup table tbody td textarea tfoot th thead time title tr tt u ul var video wbr xmp".split(" "),open:"area base br col command css !DOCTYPE embed hr img input keygen link meta param source track wbr".split(" ")},c.tag.elements.all=c.tag.elements.closed.concat(c.tag.elements.open).sort(),c.tag.isClosed=function(e){return c.tag.elements.open.indexOf(e)===-1};for(var B=0;B<c.tag.elements.all.length;B++)t=c.tag.elements.all[B],function(e){c[e]=function(){return c.tag.apply(c,[e].concat(o.call(arguments)))};var t=D(e);c[t]=function(){return c.tag.apply(c,[e,{__quiet__:1}].concat(o.call(arguments)))},M(c[e],e),M(c[t],e)}(t);var j='HTML PUBLIC "-//W3C//DTD HTML 4.01',F='"http://www.w3.org/TR/html4/',I="html",q=j+'//EN" '+F+'strict.dtd"',R={5:I,"HTML 5":I,4:q,"HTML 4.01 Strict":q,"HTML 4.01 Frameset":j+' Frameset//EN" '+F+'frameset.dtd"',"HTML 4.01 Transitional":j+' Transitional//EN" '+F+'loose.dtd"'};c.doctype=function(e){return e=x(e,"5"),c["!DOCTYPE"](x(R[e],e))},c.useGlobally=c.extendInto=function(t){t=x(t,e);var n={},r,i,s;for(r in c)s=c[r],r[0]!=="_"&&r!=="extendInto"&&r!=="useGlobally"&&(n[r]=s,i=D(r),c[i]&&(n[i]=c[i]));d(t,n)},c.compile=function(e,t){t=x(t,e);var n,r,i,s,e=d({html:1,dom:0,css:0,cssMap:0,minify:0,ignore:{}},e),o=w(e);return o.html=e.html?[]:null,o.dom=e.dom&&typeof document!="undefined"&&document!==null?document.createElement("OJ"):null,o.css=e.css||e.cssMap?{}:null,o.indent="",o.data=e.data,o.inserts=[],e.dom&&(o.types=[]),o.tags={},d(e.ignore,{oj:1,css:1}),Q(t,o),o.css!=null&&(r=W(o.css)),e.css&&(n=J(r,{minify:e.minify,tags:0})),e.cssMap||(r=undefined),e.html&&(s=o.html.join("")),e.dom&&(i=o.dom.childNodes,i.length!=null&&(i=y(i),i=i.filter(function(e){return c.isDOM(e)})),i.length===0?i=null:i.length===1&&(i=i[0])),{html:s,dom:i,css:n,cssMap:r,types:o.types,tags:o.tags,inserts:o.inserts}},c._styleTagFromMediaObject=function(e,t,n){var r=(n!=null?n.minify:void 0)?"":"\n",i=$(t,n);return'<style class="'+V(e)+'">'+r+i+"</style>"},c.toHTML=function(e,t){return c.isPlainObject(e)||(t=e,e={}),d(e,{dom:0,js:0,html:1,css:0}),c.compile(e,t).html},c.toCSS=function(e,t){return c.isPlainObject(e)||(t=e,e={}),d(e,{dom:0,js:0,html:0,css:1}),c.compile(e,t).css},c.createType=function(e,t){t=x(t,{}),t.methods=x(t.methods,{}),t.properties=x(t.properties,{}),C("createType",1,e,"string"),C("createType",2,t,"object");var n,r,i,s="__DELAYED__",o=(new Function("return function "+e+"(){\n var _t = this;\n if ( !(this instanceof "+e+") ){\n _t = new "+e+"('"+s+"');\n _t.__autonew__ = true;\n }\n\n if (arguments && arguments[0] != '"+s+"')\n "+e+".prototype.constructor.apply(_t, arguments);\n\n return _t;\n}"))();return t.base!=null&&(t.constructor==null||!t.hasOwnProperty("constructor"))&&(t.constructor=function(){return o.base!=null?o.base.constructor.apply(this,arguments):void 0}),t.base!=null&&et(o,t.base),c.addMethod(o.prototype,"constructor",t.constructor),i={type:{value:o,writable:!1,enumerable:!1},typeName:{value:e,writable:!1,enumerable:!1},isOJ:{value:!0,writable:!1,enumerable:!1}},c.addProperties(o,i),c.addProperties(o.prototype,i),r=p(t.properties).sort(),o.prototype.properties!=null&&(r=S(o.prototype.properties.concat(r))),c.addProperty(o.prototype,"properties",{value:r,writable:!1,enumerable:!1}),n=p(t.methods).sort(),o.prototype.methods!=null&&(n=S(o.prototype.methods.concat(n))),c.addProperty(o.prototype,"methods",{value:n,writable:!1,enumerable:!1}),d(t.methods,{get:function(e){if(!c.isString(e)){var t={},n,r;for(n=0;n<this.properties.length;n++)r=this.properties[n],t[r]=this[r];return t}if(this.has(e))return this[e]},set:function(e,t){var n,r=e,i;c.isPlainObject(e)||(r={},r[e]=t);for(n in r)i=r[n],this.has(n)&&(this[n]=i)},has:function(e){return this.properties.some(function(t){return t===e})},can:function(e){return this.methods.some(function(t){return t===e})},toJSON:function(){var e={},t,n=0;for(;n<this.properties.length;n++)t=this.properties[n],e[t]=this[t];return e}}),c.addMethods(o.prototype,t.methods),c.addProperties(o.prototype,t.properties),o},_createQuietType=function(e){return c[D(e)]=function(){return tt.apply(null,[c[e]].concat(o.call(arguments),[{__quiet__:1}]))}},c.createEnum=function(e,t){T("createEnum","NYI")};var nt=c.createType("View",{constructor:function(){N(c.isDOM(this.el),this.typeName,"constructor did not set this.el"),P(this.el,this);var e=c.unionArguments(arguments),t=e.options,n=e.args;return this.__autonew__&&!t.__quiet__&&this.emit(),t.__quiet__!=null&&delete t.__quiet__,this.$el.addClass("oj-"+this.typeName),c.settings.defaultThemes&&(this.themes=c.settings.defaultThemes),this.set(t),t=w(t),this.properties.forEach(function(e){return delete t[e]}),this.addAttributes(t),this._isConstructed=!0},properties:{el:{get:function(){return this._el},set:function(e){c.isDOMElement(e)?(this._el=e,this._$el=null):this._el=c.compile({dom:1,css:0,cssMap:0,html:0},e).dom}},$el:{get:function(){return this._$el!=null?this._$el:this._$el=c.$(this.el)}},id:{get:function(){return this.$el.attr("id")},set:function(e){return this.$el.attr("id",e)}},attributes:{get:function(){var e={};return o.call(this.el.attributes).forEach(function(t){return e[t.name]=t.value}),e}},classes:{get:function(){return this.$el.attr("class").split(/\s+/)},set:function(e){this.$el.attr("class",e.join(" "))}},themes:{get:function(){var e=[],t="theme-",n=0,r;for(;n<this.classes.length;n++)r=this.classes[n],r.indexOf(t)===0&&e.push(r.slice(t.length));return e},set:function(e){c.isArray(e)||(e=[e]),this.clearThemes();var t,n=0;for(;n<e.length;n++)t=e[n],this.addTheme(t)}},theme:{get:function(){return this.themes},set:function(e){this.themes=e}},isConstructed:{get:function(){return x(this._isConstructed,!1)}},isInserted:{get:function(){return x(this._isInserted,!1)}}},methods:{$:function(){return this.$el.find.apply(this.$el,arguments)},addAttribute:function(e,t){var n={};n[e]=t,this.addAttributes(n)},addAttributes:function(e){var t=w(e),n=Y(t),r,i;if(c.isPlainObject(t))for(r in t)i=t[r],r==="class"?this.addClass(i):i===!0?this.el.setAttributeNode(document.createAttribute(r)):this.$el.attr(r,i);n!=null&&Z(n,this.el)},removeAttribute:function(e){this.$el.removeAttr(e)},removeAttributes:function(e){var t=this;e.forEach(function(e){t.removeAttribute(e)})},addClass:function(e){this.$el.addClass(e)},removeClass:function(e){this.$el.removeClass(e)},hasClass:function(e){return this.$el.hasClass(e)},addTheme:function(e){this.addClass("theme-"+e)},removeTheme:function(e){this.removeClass("theme-"+e)},hasTheme:function(e){return this.hasClass("theme-"+e)},clearThemes:function(){var e=this;this.themes.forEach(function(t){e.removeTheme(t)})},emit:function(){c._argsAppend(this)},toHTML:function(e){return this.el.outerHTML+((e!=null?e.minify:void 0)?"":"\n")},toDOM:function(){return this.el},toCSS:function(e){return J(W(this.cssMap),d({},{minify:e.minify,tags:0}))},toCSSMap:function(){return this.type.cssMap},toString:function(){return this.toHTML()},inserted:function(){return this._isInserted=!0}}});nt.cssMap={},nt.css=function(e){N(c.isString(e)||c.isPlainObject(e),this.typeName,"object or string expected for first argument");var t,n,r,i,s,o,u;c.isString(e)?((o=(n=this.cssMap)[i="oj-"+this.typeName])==null&&(n[i]=""),this.cssMap["oj-"+this.typeName]+=e):((u=(r=this.cssMap)[s="oj-"+this.typeName])==null&&(r[s]={}),t=E({},".oj-"+this.typeName,e),d(this.cssMap["oj-"+this.typeName],t))},nt.themes=[],nt.theme=function(e,t){C(this.typeName,1,e,"string"),C(this.typeName,2,t,"object");var n=A(e),r="oj-"+this.typeName,i=E({},".oj-"+this.typeName+".theme-"+n,t);this.cssMap[r]=x(this.cssMap[r],{}),d(this.cssMap["oj-"+this.typeName],i),this.themes.push(n),this.themes=S(this.themes)};var rt=c.createType("CollectionView",{base:nt,constructor:function(e){return(e!=null?e.each:void 0)!=null&&(this.each=c.argumentShift(e,"each")),(e!=null?e.models:void 0)!=null&&(this.models=c.argumentShift(e,"models")),rt.base.constructor.apply(this,arguments),this.make()},properties:{each:{get:function(){return this._each},set:function(e){this._each=e,this.isConstructed&&this.make()}},collection:{get:function(){return this.models},set:function(e){return this.models=e}},models:{get:function(){return this._models},set:function(e){c.isFunction(this._models!=null?this._models.off:void 0)&&this._models.off("add remove change reset destroy",null,this),this._models=e,c.isFunction(this._models!=null?this._models.on:void 0)&&(this._models.on("add",this.collectionModelAdded,this),this._models.on("remove",this.collectionModelRemoved,this),this._models.on("change",this.collectionModelChanged,this),this._models.on("destroy",this.collectionModelDestroyed,this),this._models.on("reset",this.collectionReset,this)),this.isConstructed&&this.make()}}},methods:{make:function(){T(this.typeName,"`make` method not implemented by custom view")},collectionModelAdded:function(e,t){return this.make()},collectionModelRemoved:function(e,t,n){return this.make()},collectionModelChanged:function(e,t,n){},collectionModelDestroyed:function(e,t){return this.make()},collectionReset:function(e,t){return this.make()}}}),it=c.createType("ModelView",{base:nt,constructor:function(e){return(e!=null?e.value:void 0)!=null&&(this.value=c.argumentShift(e,"value")),(e!=null?e.model:void 0)!=null&&(this.model=c.argumentShift(e,"model")),it.base.constructor.apply(this,arguments)},properties:{model:{get:function(){return this._model},set:function(e){c.isEvented(this._model)&&this._model.off("change",null,this),this._model=e,c.isEvented(this._model)&&this._model.on("change",this.modelChanged,this),this.modelChanged()}}},methods:{modelChanged:function(){var e=this;return this.$el.oj(function(){return e.make(e.mode)})},make:function(e){return T(this.typeName,"`make` method not implemented by custom view")}}}),st=c.createType("ModelKeyView",{base:it,constructor:function(e){return(e!=null?e.key:void 0)!=null&&(this.key=c.argumentShift(e,"key")),st.base.constructor.apply(this,arguments)},properties:{key:null,value:{get:function(){T(this.typeName,"value getter not implemented")},set:function(e){T(this.typeName,"value setter not implemented")}}},methods:{modelChanged:function(){this.model!=null&&this.key!=null&&(this._viewUpdatedModel||(this.value=this.model.get(this.key)))},viewChanged:function(){var e=this;setTimeout(function(){e.model!=null&&e.key!=null&&(e._viewUpdatedModel=!0,e.model.set(e.key,e.value),e._viewUpdatedModel=!1)},10)}}}),ot=c.createType("TextBox",{base:st,constructor:function(){var e=this,t=c.unionArguments(arguments),n=t.options,r=t.args;return this.el=c(function(){c.input({type:"text"},{keydown:function(){e.live&&setTimeout(function(){return e.$el.change()},10)},keyup:function(){e.live&&setTimeout(function(){return e.$el.change()},10)},change:function(){e.viewChanged()}})}),r.length>0&&(this.value=r[0]),(n!=null?n.live:void 0)!=null&&(this.live=c.argumentShift(n,"live")),ot.base.constructor.apply(this,[n])},properties:{value:{get:function(){var e=this.el.value;if(e==null||e===l)e="";return e},set:function(e){this.el.value=e}},live:!0}}),ut=c.createType("CheckBox",{base:st,constructor:function(){var e=this,t=c.unionArguments(arguments),n=t.options,r=t.args;return this.el=c(function(){c.input({type:"checkbox"},{change:function(){e.viewChanged()}})}),r.length>0&&(this.value=r[0]),ut.base.constructor.call(this,n)},properties:{value:{get:function(){return this.el.checked},set:function(e){this.el.checked=e=!!e,e?this.$el.attr("checked","checked"):this.$el.removeAttr("checked")}}}}),at=c.createType("Text",{base:st,constructor:function(){var e=this,t=c.unionArguments(arguments),n=t.options,r=t.args;return this._tagName=c.argumentShift(n,"tagName"),this.el=c(function(){return c[e.tagName]()}),r.length>0&&(this.value=r[0]),at.base.constructor.call(this,n)},properties:{value:{get:function(){return this.$el.ojValue()},set:function(e){this.$el.oj(e)}},tagName:{get:function(){return x(this._tagName,"div")}}}}),ft=c.createType("TextArea",{base:st,constructor:function(){var e=this,t=c.unionArguments(arguments),n=t.options,r=t.args;return this.el=c(function(){return c.textarea({keydown:function(){e.live&&setTimeout(function(){return e.$el.change()},10)},keyup:function(){e.live&&setTimeout(function(){return e.$el.change()},10)},change:function(){e.viewChanged()}})}),this.value=c.argumentShift(n,"value")||r.join("\n"),ft.base.constructor.call(this,n)},properties:{value:{get:function(){return this.el.value},set:function(e){this.el.value=e}},live:!0}}),lt=c.createType("ListBox",{base:st,constructor:function(){var e=this,t=c.unionArguments(arguments),n=t.options,r=t.args;return this.el=c(function(){return c.select({change:function(){e.viewChanged()}})}),this.options=c.argumentShift(n,"options"),r.length>0&&(this.value=r[0]),lt.base.constructor.apply(this,[n])},properties:{value:{get:function(){return this.$el.val()},set:function(e){this.$el.val(e)}},options:{get:function(){return this._options},set:function(e){if(!c.isArray(e))throw new Error("oj."+this.typeName+".options array is missing");this._options=e,this.$el.oj(function(){var t,n,r;for(n=0,r=e.length;n<r;n++)t=e[n],c.option(t)})}}}}),ct=c.createType("Button",{base:nt,constructor:function(){var e=this,t=c.unionArguments(arguments),n=t.options,r=t.args,i="";r.length>0&&(i=r[0]),n.title!=null&&(i=c.argumentShift(n,"title")),this.el=c(function(){c.button(i)}),ct.base.constructor.apply(this,[n]),this.title=i},properties:{title:{get:function(){return x(this._title,"")},set:function(e){this.$el.oj(this._title=e)}}},methods:{click:function(){return arguments.length>0?this.$el.click.apply(this.$el,arguments):this.$el.click()}}}),ht=c.createType("Image",{base:nt,constructor:function(){this.el=c(function(){c.img()}),ht.base.constructor.apply(this,arguments)},properties:{height:{get:function(){return this._height},set:function(e){this._height=e,this.$el.attr("height",e)}},width:{get:function(){return this._width},set:function(e){this._width=e,this.$el.attr("width",e)}},alt:{get:function(){return this._alt},set:function(e){this._alt=e,this.$el.attr("alt",e)}},src:{get:function(){return this._src},set:function(e){this._src=e,this.$el.attr("src",e)}}},methods:{}}),pt=c.createType("List",{base:rt,constructor:function(){var e=this,t=c.unionArguments(arguments),n=t.options,r=t.args,i;return this._tagName=c.argumentShift(n,"tagName"),this.itemTagName=c.argumentShift(n,"itemTagName"),this.el=c(function(){return c[e.tagName]()}),n.el!=null&&(this.el=c.argumentShift(n,"el")),n.each==null&&(n.each=function(e){return c.isString(e)||c.isNumber(e)||c.isBoolean(e)?e:JSON.stringify(e)}),pt.base.constructor.apply(this,[n]),i=r.length>0?r:null,this.items=n.items!=null?c.argumentShift(n,"items"):i},properties:{items:{get:function(){return this._items!=null?this._items:this.$items.ojValues()},set:function(e){this._items=e,this.make()}},count:{get:function(){return this.$items.length}},tagName:{get:function(){return x(this._tagName,"div")}},itemTagName:{get:function(){return x(this._itemTagName,"div")},set:function(e){this._itemTagName=e,this.make()}},$items:{get:function(){return this._$items!=null?this._$items:this._$items=this.$el.children()}}},methods:{item:function(e,t){e=this._bound(e,this.count,".item: index");if(t==null)return this.$item(e).ojValue();typeof t=="object"&&t.isListItem?this.$item(e).ojReplaceWith(t):this.$item(e).oj(t),this.itemsChanged()},$item:function(e){return this.$items.eq(this._bound(e,this.count,".$item: index"))},make:function(){if(!this.isConstructed)return;var e=this,t,n,r,i,s;this.models!=null&&this.each!=null?(r=c.isEvented(this.models)?this.models.models:this.models,i=r.map(function(t){return e._itemFromModel(t)})):this.items!=null&&(i=this.items),this.$el.oj(function(){return i.map(function(t){e._itemElFromItem(t)})}),this.itemsChanged()},collectionModelAdded:function(e,t){this.add(t.indexOf(e),this._itemFromModel(e))},collectionModelRemoved:function(e,t,n){this.remove(n.index)},collectionReset:function(){this.make()},_itemFromModel:function(e){var t=this;return c.isOJType(t.each)?new t.each(e):c(function(){return t.each(e)})},_itemElFromItem:function(e){if(!e||typeof e.isListItem!="boolean")return c[this.itemTagName](e);e.emit()},_bound:function(e,t,n){var r=e<0?e+t:e;return 0<=r&&r<t||T(this.typeName,n+" is out of bounds ("+e+" in [0,"+(t-1)+"])"),r},itemsChanged:function(){this._items=null,this._$items=null},add:function(e,t){t==null&&(t=e,e=-1),e=this._bound(e,this.count+1,".add: index");var n=this,r=this.itemTagName;this.count===0?this.$el.oj(function(){n._itemElFromItem(t)}):e===this.count?this.$item(e-1).ojAfter(function(){return n._itemElFromItem(t)}):this.$item(e).ojBefore(function(){return n._itemElFromItem(t)}),this.itemsChanged()},remove:function(e){e=x(e,-1),e=this._bound(e,this.count,".remove: index");var t=this.item(e);return this.$item(e).remove(),this.itemsChanged(),t},move:function(e,t){t=x(t,-1);if(e===t)return;e=this._bound(e,this.count,".move: fromIndex"),t=this._bound(t,this.count,".move: toIndex"),t>e?this.$item(e).insertAfter(this.$item(t)):this.$item(e).insertBefore(this.$item(t)),this.itemsChanged()},swap:function(e,t){if(e===t)return;e=this._bound(e,this.count,".swap: firstIndex"),t=this._bound(t,this.count,".swap: secondIndex");if(Math.abs(e-t)===1)this.move(e,t);else{var n=Math.min(e,t),r=Math.max(e,t);this.move(r,n),this.move(n+1,r)}this.itemsChanged()},unshift:function(e){this.add(0,e)},shift:function(){return this.remove(0)},push:function(e){this.add(this.count,e)},pop:function(){return this.remove(-1)},clear:function(){this.$items.remove(),this.itemsChanged()}}}),dt=c.createType("NumberList",{base:pt,constructor:function(){var e=[{tagName:"ol",itemTagName:"li"}].concat(o.call(arguments));return dt.base.constructor.apply(this,e)}}),vt=c.createType("BulletList",{base:pt,constructor:function(){var e=[{tagName:"ul",itemTagName:"li"}].concat(o.call(arguments));return vt.base.constructor.apply(this,e)}}),mt=c.createType("Table",{base:rt,constructor:function(){var e=this,t=c.unionArguments(arguments),n=t.options,r=t.args,i,s;this.el=c(function(){return c.table()}),n.el!=null&&(this.el=c.argumentShift(n,"el")),n.each==null&&(n.each=function(e,t){var n=c.isString(e)||c.isNumber(e)||c.isBoolean(e)?[e]:c.isEvented(e)&&typeof e.attributes=="object"?g(e.attributes):g(e);return n.map(function(e){t(e)})}),mt.base.constructor.apply(this,[n]);for(s=0;s<r.length;s++)N(c.isArray(r[s]),"Table","array expected for row arguments");i=x(c.argumentShift(n,"rows"),r);if(i.length>0)return this.rows=i},properties:{rowCount:{get:function(){return this.$trs.length}},columnCount:{get:function(){var e,t,n;return(n=this.$tr(0).find("> td").length)>0?n:(t=this.$theadTR.find("> th").length)>0?t:(e=this.$tfootTR.find("> td").length)>0?e:0}},rows:{get:function(){if(this._rows!=null)return this._rows;var e,t=0;this._rows=[];for(;t<this.rowCount;t++)e=this.$tdsRow(t).toArray().map(function(e){return n(e).ojValue()}),this._rows.push(e);return this._rows},set:function(e){if(!(e!=null&&e.length>0))return this.clearBody();this._rows=e,this.make()}},header:{get:function(){return this.$theadTR.find("> th").ojValues()},set:function(e){return N(c.isArray(e),this.typeName+".header","array expected for first argument"),e!=null&&e.length>0?this.$theadTRMake.oj(function(){return e.map(function(e){c.th(e)})}):this.clearHeader()}},footer:{get:function(){return this.$tfootTR.find("> td").ojValues()},set:function(e){var t=this;if(!c.isArray(e))throw new Error("oj.Table.footer: array expected for first argument");return e!=null&&e.length>0?this.$tfootTRMake.oj(function(){var t,n,r,i;i=[];for(n=0,r=e.length;n<r;n++)t=e[n],i.push(c.td(t));return i}):this.clearFooter()}},caption:{get:function(){return this.$caption.ojValue()},set:function(e){this.$captionMake.oj(e)}},$table:{get:function(){return this.$el}},$caption:{get:function(){return this.$("> caption")}},$colgroup:{get:function(){return this.$("> colgroup")}},$thead:{get:function(){return this.$("> thead")}},$tfoot:{get:function(){return this.$("> tfoot")}},$tbody:{get:function(){return this.$("> tbody")}},$theadTR:{get:function(){return this.$thead.find("> tr")}},$tfootTR:{get:function(){return this.$tfoot.find("> tr")}},$ths:{get:function(){return this.$theadTR.find("> th")}},$trs:{get:function(){return this._$trs!=null?this._$trs:this._$trs=this.$("> tbody > tr")}},$colgroupMake:{get:function(){return this.$colgroup.length>0?this.$colgroup:(t="<colgroup></colgroup>",this.$caption.length>0?this.$caption.insertAfter(t):this.$table.append(t),this.$tbody)}},$captionMake:{get:function(){return this.$caption.length>0?this.$caption:(this.$table.prepend("<caption></caption>"),this.$caption)}},$tfootMake:{get:function(){return this.$tfoot.length>0?this.$tfoot:(t="<tfoot></tfoot>",this.$tfoot.length>0?this.$tfoot.insertBefore(t):this.$table.append(t),this.$tfoot)}},$theadMake:{get:function(){return this.$thead.length>0?this.$thead:(t="<thead></thead>",this.$colgroup.length>0?this.$colgroup.insertAfter(t):this.$caption.length>0?this.$caption.insertAfter(t):this.$table.prepend(t),this.$thead)}},$tbodyMake:{get:function(){return this.$tbody.length>0?this.$tbody:(this.$table.append("<tbody></tbody>"),this.$tbody)}},$theadTRMake:{get:function(){return this.$theadTR.length>0?this.$theadTR:(this.$theadMake.html("<tr></tr>"),this.$theadTR)}},$tfootTRMake:{get:function(){return this.$tfootTR.length>0?this.$tfootTR:(this.$tfootMake.html("<tr></tr>"),this.$tfootTR)}}},methods:{make:function(){if(!this.isConstructed)return;var e=this,t,n=[];this.models!=null&&this.each!=null?(t=c.isEvented(this.models)?this.models.models:this._models,n=t.map(function(t){return e._rowFromModel(t)})):this.rows!=null&&(n=this.rows.map(function(e){return c(function(){e.forEach(function(e){c.td(e)})})})),n.length>0&&this.$tbodyMake.oj(function(){n.forEach(function(e){c.tr(e)})}),this.bodyChanged()},collectionModelAdded:function(e,t){var n=t.indexOf(e),r=this._rowFromModel(e);this._addRowTR(n,c(function(){return c.tr(r)}))},collectionModelRemoved:function(e,t,n){this.removeRow(n.index)},collectionReset:function(){this.make()},$tr:function(e){return e=e<0?e+count:e,this.$trs.eq(e)},$tdsRow:function(e){return e=e<0?e+count:e,this.$tr(e).find("> td")},$td:function(e,t){return e=e<0?e+this.rowCount:e,t=t<0?t+this.columnCount:t,this.$tdsRow(e).eq(t)},row:function(e,t){e=this._bound(e,this.rowCount,".row: rx");if(t==null)return this.$tdsRow(e).ojValues();N(t.length===cellCount(e),this.typeName,"array expected for second argument with length ("+e+")"),t.forEach(function(t,n){this.$td(e,n).oj(t)})},cell:function(e,t,n){return n!=null?this.$td(e,t).oj(n):this.$td(e,t).ojValue()},addRow:function(e,t){t==null&&(t=e,e=-1),e=this._bound(e,this.rowCount+1,".addRow: rx"),N(c.isArray(t),"addRow","expected array for row content"),this._addRowTR(e,function(){c.tr(function(){t.forEach(function(e){c.td(e)})})})},_addRowTR:function(e,t){this.rowCount===0?this.$el.oj(t):e===this.rowCount?this.$tr(e-1).ojAfter(t):this.$tr(e).ojBefore(t),this.bodyChanged()},removeRow:function(e){e==null&&(e=-1),e=this._bound(e,this.rowCount,".removeRow: index");var t=this.row(e);return this.$tr(e).remove(),this.bodyChanged(),t},moveRow:function(e,t){if(e===t)return;e=this._bound(e,this.rowCount,".moveRow: fromIndex"),t=this._bound(t,this.rowCount,".moveRow: toIndex");var n=t>e?"insertAfter":"insertBefore";this.$tr(e)[n](this.$tr(t)),this.bodyChanged()},swapRow:function(e,t){if(e===t)return;e=this._bound(e,this.rowCount,".swap: firstIndex"),t=this._bound(t,this.rowCount,".swap: secondIndex");if(Math.abs(e-t)===1)this.moveRow(e,t);else{var n=Math.min(e,t),r=Math.max(e,t);this.moveRow(r,n),this.moveRow(n+1,r)}this.bodyChanged()},unshiftRow:function(e){this.addRow(0,e)},shiftRow:function(){return this.removeRow(0)},pushRow:function(e){this.addRow(this.rowCount,e)},popRow:function(){return this.removeRow(-1)},clearColgroup:function(){this.$colgroup.remove()},clearBody:function(){this.$tbody.remove(),this.bodyChanged()},clearHeader:function(){this.$thead.remove(),this.headerChanged()},clearFooter:function(){this.$tfoot.remove(),this.footerChanged()},clearCaption:function(){this.$caption.remove()},clear:function(){return this.clearBody(),this.clearHeader(),this.clearFooter(),this.$caption.remove()},bodyChanged:function(){this._rows=null,this._columns=null,this._$trs=null},headerChanged:function(){this._header=null},footerChanged:function(){this._footer=null},_rowFromModel:function(e){var t=this;return c(function(){return t.each(e,c.td)})},_bound:function(e,t,n){var r=e<0?e+t:e;if(0<=r&&r<t)return r;throw new Error("oj."+this.typeName+n+" is out of bounds ("+e+" in [0,"+(t-1)+"])")}}});d(c,{View:nt,ModelView:it,ModelKeyView:st,CollectionView:rt,Button:ct,CheckBox:ut,Text:at,TextBox:ot,TextArea:ft,ListBox:lt,List:pt,NumberList:dt,BulletList:vt,Table:mt});for(var gt in c)v(gt[0])&>.slice(gt.length-4)!=="View"&&(c[D(gt)]=_createQuietType(gt));c.sandbox={},p(c).forEach(function(e){(e.length>0&&e[0]!=="_"||e.length>0&&e[0]==="_"&&c[e.slice(1)]!=null)&&c.addProperty(c.sandbox,e,{value:c[e],writable:!1})}),c.use=function(e,t){t=x(t,{}),C("use",1,e,"function"),C("use",2,t,"object");var n=e(c,t),r=w(n),i,s;for(i in n)s=n[i],c.isOJType(s)&&(r[D(i)]=_createQuietType(s.typeName));for(i in r)s=r[i],c[i]=s,c.addProperty(c.sandbox,i,{value:s,writable:!1})},c.$.fn.oj=yt({get:function(e){return e[0].oj},set:function(e,t){if(t.length===0)return e[0].oj;var n=c.compile.apply(c,[{dom:1,html:0,cssMap:1}].concat(o.call(t)));wt(n.cssMap,{global:0}),e.html(""),c.isArray(n.dom)||(n.dom=[n.dom]);for(var r=0;r<n.dom.length;r++)e.append(n.dom[r]);bt(n.types,n.inserts)}}),c.$.ojBody=function(e){var t={html:1,"!DOCTYPE":1,body:1,head:"deep",meta:1,title:"deep",link:"deep",script:"deep"};try{var n=c.compile({dom:1,html:0,css:0,cssMap:1,ignore:t},e)}catch(r){throw new Error("oj.compile: "+r.message)}n.dom!=null&&c.$("body").html(n.dom),wt(n.cssMap,{global:1}),bt(n.types,n.inserts)},c.$.fn.ojValue=yt({first:!0,set:null,get:Et}),c.$.fn.ojValues=yt({first:!1,set:null,get:Et});var St={ojAfter:"after",ojBefore:"before",ojAppend:"append",ojPrepend:"prepend",ojReplaceWith:"replaceWith",ojWrap:"wrap",ojWrapInner:"wrapInner"};for(var xt in St){var Tt=St[xt];(function(e,t){c.$.fn[e]=yt({set:function(e,n){var r={dom:1,html:0,css:0,cssMap:1},i=c.compile.apply(c,[r].concat(o.call(n)));wt(i.cssMap,{global:0}),e[t](i.dom),bt(i.types,i.inserts)},get:null})})(xt,Tt)}c._minifyJS=f,c._minifyCSS=f;var Nt=/^(\/?)([\s\S]+\/(?!$)|\/)?((?:\.{1,2}$|[\s\S]+?)?(\.[^.\/]*)?)$/;return c._pathResolve=function(){var e="",t=!1,n=arguments.length-1,r;while(n>=-1&&!t){r=n>=0?arguments[n]:process.cwd();if(typeof r!="string"||!r)continue;e=r+"/"+e,t=r.charAt(0)==="/",n--}return e=kt(e.split("/").filter(function(e){return!!e}),!t).join("/"),(t?"/":"")+e||"."},c._pathNormalize=function(e){var t=e.charAt(0)==="/",n=e.substr(-1)==="/";return e=kt(e.split("/").filter(function(e){return!!e}),!t).join("/"),!e&&!t&&(e="."),e&&n&&(e+="/"),(t?"/":"")+e},c._pathJoin=function(){var e=o.call(arguments,0);return c._pathNormalize(e.filter(function(e,t){return e&&typeof e=="string"}).join("/"))},c._pathDirname=function(e){var t=Ct(e),n=t[0],r=t[1];return!n&&!r?".":(r&&(r=r.substr(0,r.length-1)),n+r)},c})