filer/dist/filer.min.js

6 lines
125 KiB
JavaScript
Raw Normal View History

/*! filer 2014-03-08 */
2014-03-08 21:07:19 +00:00
(function(t,e){"object"==typeof exports?module.exports=e():"function"==typeof define&&define.amd?define(e):t.Filer||(t.Filer=e())})(this,function(){var t,e,n;(function(r){function o(t,e){return w.call(t,e)}function i(t,e){var n,r,o,i,s,a,c,u,f,l,p=e&&e.split("/"),h=m.map,d=h&&h["*"]||{};if(t&&"."===t.charAt(0))if(e){for(p=p.slice(0,p.length-1),t=p.concat(t.split("/")),u=0;t.length>u;u+=1)if(l=t[u],"."===l)t.splice(u,1),u-=1;else if(".."===l){if(1===u&&(".."===t[2]||".."===t[0]))break;u>0&&(t.splice(u-1,2),u-=2)}t=t.join("/")}else 0===t.indexOf("./")&&(t=t.substring(2));if((p||d)&&h){for(n=t.split("/"),u=n.length;u>0;u-=1){if(r=n.slice(0,u).join("/"),p)for(f=p.length;f>0;f-=1)if(o=h[p.slice(0,f).join("/")],o&&(o=o[r])){i=o,s=u;break}if(i)break;!a&&d&&d[r]&&(a=d[r],c=u)}!i&&a&&(i=a,s=c),i&&(n.splice(0,s,i),t=n.join("/"))}return t}function s(t,e){return function(){return h.apply(r,b.call(arguments,0).concat([t,e]))}}function a(t){return function(e){return i(e,t)}}function c(t){return function(e){g[t]=e}}function u(t){if(o(v,t)){var e=v[t];delete v[t],E[t]=!0,p.apply(r,e)}if(!o(g,t)&&!o(E,t))throw Error("No "+t);return g[t]}function f(t){var e,n=t?t.indexOf("!"):-1;return n>-1&&(e=t.substring(0,n),t=t.substring(n+1,t.length)),[e,t]}function l(t){return function(){return m&&m.config&&m.config[t]||{}}}var p,h,d,y,g={},v={},m={},E={},w=Object.prototype.hasOwnProperty,b=[].slice;d=function(t,e){var n,r=f(t),o=r[0];return t=r[1],o&&(o=i(o,e),n=u(o)),o?t=n&&n.normalize?n.normalize(t,a(e)):i(t,e):(t=i(t,e),r=f(t),o=r[0],t=r[1],o&&(n=u(o))),{f:o?o+"!"+t:t,n:t,pr:o,p:n}},y={require:function(t){return s(t)},exports:function(t){var e=g[t];return e!==void 0?e:g[t]={}},module:function(t){return{id:t,uri:"",exports:g[t],config:l(t)}}},p=function(t,e,n,i){var a,f,l,p,h,m,w=[];if(i=i||t,"function"==typeof n){for(e=!e.length&&n.length?["require","exports","module"]:e,h=0;e.length>h;h+=1)if(p=d(e[h],i),f=p.f,"require"===f)w[h]=y.require(t);else if("exports"===f)w[h]=y.exports(t),m=!0;else if("module"===f)a=w[h]=y.module(t);else if(o(g,f)||o(v,f)||o(E,f))w[h]=u(f);else{if(!p.p)throw Error(t+" missing "+f);p.p.load(p.n,s(i,!0),c(f),{}),w[h]=g[f]}l=n.apply(g[t],w),t&&(a&&a.exports!==r&&a.exports!==g[t]?g[t]=a.exports:l===r&&m||(g[t]=l))}else t&&(g[t]=n)},t=e=h=function(t,e,n,o,i){return"string"==typeof t?y[t]?y[t](e):u(d(t,e).f):(t.splice||(m=t,e.splice?(t=e,e=n,n=null):t=r),e=e||function(){},"function"==typeof n&&(n=o,o=i),o?p(r,t,e,n):setTimeout(function(){p(r,t,e,n)},4),h)},h.config=function(t){return m=t,m.deps&&h(m.deps,m.callback),h},n=function(t,e,n){e.splice||(n=e,e=[]),o(g,t)||o(v,t)||(v[t]=[t,e,n])},n.amd={jQuery:!0}})(),n("build/almond",function(){}),n("nodash",["require"],function(){function t(t,e){return h.call(t,e)}function e(t){return null==t?0:t.length===+t.length?t.length:g(t).length}function n(t){return t}function r(t,e,n){var r,o;if(null!=t)if(u&&t.forEach===u)t.forEach(e,n);else if(t.length===+t.length){for(r=0,o=t.length;o>r;r++)if(e.call(n,t[r],r,t)===y)return}else{var i=i(t);for(r=0,o=i.length;o>r;r++)if(e.call(n,t[i[r]],i[r],t)===y)return}}function o(t,e,o){e||(e=n);var i=!1;return null==t?i:l&&t.some===l?t.some(e,o):(r(t,function(t,n,r){return i||(i=e.call(o,t,n,r))?y:void 0}),!!i)}function i(t,e){return null==t?!1:f&&t.indexOf===f?-1!=t.indexOf(e):o(t,function(t){return t===e})}function s(t){this.value=t}function a(t){return t&&"object"==typeof t&&!Array.isArray(t)&&h.call(t,"__wrapped__")?t:new s(t)}var c=Array.prototype,u=c.forEach,f=c.indexOf,l=c.some,p=Object.prototype,h=p.hasOwnProperty,d=Object.keys,y={},g=d||function(e){if(e!==Object(e))throw new TypeError("Invalid object");var n=[];for(var r in e)t(e,r)&&n.push(r);return n};return s.prototype.has=function(e){return t(this.value,e)},s.prototype.contains=function(t){return i(this.value,t)},s.prototype.size=function(){return e(this.value)},a}),function(t){t["encoding-indexes"]=t["encoding-indexes"]||[]}(this),n("encoding-indexes-shim",function(){}),function(t){function e(t,e,n){return t>=e&&n>=t}function n(t,e){return Math.floor(t/e)}function r(t){var e=0;this.get
}function Z(t){this.message=t||"too many symbolic links encountered"}function G(t){this.message=t||"cross-device link not permitted"}function Q(t){this.message=t||"directory not empty"}function $(t){this.message=t||"no space left on device"}function te(t){this.message=t||"i/o error"}function ee(t){this.message=t||"read-only file system"}function ne(t){this.message=t||"no such device"}function re(t){this.message=t||"invalid seek"}function oe(t){this.message=t||"operation canceled"}function ie(t){this.message=t||"not mounted"}function se(t){this.message=t||"missing super node"}function ae(t){this.message=t||"attribute does not exist"}return t.prototype=Error(),t.prototype.errno=-1,t.prototype.code="UNKNOWN",t.prototype.constructor=t,e.prototype=Error(),e.prototype.errno=0,e.prototype.code="OK",e.prototype.constructor=e,n.prototype=Error(),n.prototype.errno=1,n.prototype.code="EOF",n.prototype.constructor=n,r.prototype=Error(),r.prototype.errno=2,r.prototype.code="EADDRINFO",r.prototype.constructor=r,o.prototype=Error(),o.prototype.errno=3,o.prototype.code="EACCES",o.prototype.constructor=o,i.prototype=Error(),i.prototype.errno=4,i.prototype.code="EAGAIN",i.prototype.constructor=i,s.prototype=Error(),s.prototype.errno=5,s.prototype.code="EADDRINUSE",s.prototype.constructor=s,a.prototype=Error(),a.prototype.errno=6,a.prototype.code="EADDRNOTAVAIL",a.prototype.constructor=a,c.prototype=Error(),c.prototype.errno=7,c.prototype.code="EAFNOSUPPORT",c.prototype.constructor=c,u.prototype=Error(),u.prototype.errno=8,u.prototype.code="EALREADY",u.prototype.constructor=u,f.prototype=Error(),f.prototype.errno=9,f.prototype.code="EBADF",f.prototype.constructor=f,l.prototype=Error(),l.prototype.errno=10,l.prototype.code="EBUSY",l.prototype.constructor=l,p.prototype=Error(),p.prototype.errno=11,p.prototype.code="ECONNABORTED",p.prototype.constructor=p,h.prototype=Error(),h.prototype.errno=12,h.prototype.code="ECONNREFUSED",h.prototype.constructor=h,d.prototype=Error(),d.prototype.errno=13,d.prototype.code="ECONNRESET",d.prototype.constructor=d,y.prototype=Error(),y.prototype.errno=14,y.prototype.code="EDESTADDRREQ",y.prototype.constructor=y,g.prototype=Error(),g.prototype.errno=15,g.prototype.code="EFAULT",g.prototype.constructor=g,v.prototype=Error(),v.prototype.errno=16,v.prototype.code="EHOSTUNREACH",v.prototype.constructor=v,m.prototype=Error(),m.prototype.errno=17,m.prototype.code="EINTR",m.prototype.constructor=m,E.prototype=Error(),E.prototype.errno=18,E.prototype.code="EINVAL",E.prototype.constructor=E,w.prototype=Error(),w.prototype.errno=19,w.prototype.code="EISCONN",w.prototype.constructor=w,b.prototype=Error(),b.prototype.errno=20,b.prototype.code="EMFILE",b.prototype.constructor=b,_.prototype=Error(),_.prototype.errno=21,_.prototype.code="EMSGSIZE",_.prototype.constructor=_,x.prototype=Error(),x.prototype.errno=22,x.prototype.code="ENETDOWN",x.prototype.constructor=x,A.prototype=Error(),A.prototype.errno=23,A.prototype.code="ENETUNREACH",A.prototype.constructor=A,k.prototype=Error(),k.prototype.errno=24,k.prototype.code="ENFILE",k.prototype.constructor=k,O.prototype=Error(),O.prototype.errno=25,O.prototype.code="ENOBUFS",O.prototype.constructor=O,S.prototype=Error(),S.prototype.errno=26,S.prototype.code="ENOMEM",S.prototype.constructor=S,R.prototype=Error(),R.prototype.errno=27,R.prototype.code="ENOTDIR",R.prototype.constructor=R,I.prototype=Error(),I.prototype.errno=28,I.prototype.code="EISDIR",I.prototype.constructor=I,T.prototype=Error(),T.prototype.errno=29,T.prototype.code="ENONET",T.prototype.constructor=T,C.prototype=Error(),C.prototype.errno=31,C.prototype.code="ENOTCONN",C.prototype.constructor=C,D.prototype=Error(),D.prototype.errno=32,D.prototype.code="ENOTSOCK",D.prototype.constructor=D,N.prototype=Error(),N.prototype.errno=33,N.prototype.code="ENOTSUP",N.prototype.constructor=N,M.prototype=Error(),M.prototype.errno=34,M.prototype.code="ENOENT",M.prototype.constructor=M,B.prototype=Error(),B.prototype.errno=35,B.prototype.code="ENOSYS",B.prototype.constructor=B,F.prototype=Error(),F.prototype.errno=36,F.prototype
for(e=i[0],t=i[1],this.length-=2,i[0]=i[this.length],i[1]=i[this.length+1],o=0;(r=2*o+2,!(r>=this.length))&&(this.length>r+2&&i[r+2]>i[r]&&(r+=2),i[r]>i[o]);)n=i[o],i[o]=i[r],i[r]=n,n=i[o+1],i[o+1]=i[r+1],i[r+1]=n,o=r;return{index:t,value:e,length:this.length}};var T,C=2,D={NONE:0,r:1,k:C,N:3},N=[];for(T=0;288>T;T++)switch(b){case 143>=T:N.push([T+48,8]);break;case 255>=T:N.push([T-144+400,9]);break;case 279>=T:N.push([T-256+0,7]);break;case 287>=T:N.push([T-280+192,8]);break;default:t("invalid literal: "+T)}i.prototype.j=function(){var e,r,o,i,s=this.input;switch(this.h){case 0:for(o=0,i=s.length;i>o;){r=x?s.subarray(o,o+65535):s.slice(o,o+65535),o+=r.length;var c=r,f=o===i,p=w,h=w,d=w,y=w,g=w,v=this.a,m=this.b;if(x){for(v=new Uint8Array(this.a.buffer);v.length<=m+c.length+5;)v=new Uint8Array(v.length<<1);v.set(this.a)}if(p=f?1:0,v[m++]=0|p,h=c.length,d=65535&~h+65536,v[m++]=255&h,v[m++]=255&h>>>8,v[m++]=255&d,v[m++]=255&d>>>8,x)v.set(c,m),m+=c.length,v=v.subarray(0,m);else{for(y=0,g=c.length;g>y;++y)v[m++]=c[y];v.length=m}this.b=m,this.a=v}break;case 1:var E=new n(x?new Uint8Array(this.a.buffer):this.a,this.b);E.d(1,1,b),E.d(1,2,b);var _,A,k,O=a(this,s);for(_=0,A=O.length;A>_;_++)if(k=O[_],n.prototype.d.apply(E,N[k]),k>256)E.d(O[++_],O[++_],b),E.d(O[++_],5),E.d(O[++_],O[++_],b);else if(256===k)break;this.a=E.finish(),this.b=this.a.length;break;case C:var S,R,I,T,D,M,B,F,L,U,j,P,z,W,q,H=new n(x?new Uint8Array(this.a.buffer):this.a,this.b),Y=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],X=Array(19);for(S=C,H.d(1,1,b),H.d(S,2,b),R=a(this,s),M=u(this.L,15),B=l(M),F=u(this.K,7),L=l(F),I=286;I>257&&0===M[I-1];I--);for(T=30;T>1&&0===F[T-1];T--);var K,V,J,Z,G,Q,$=I,te=T,ee=new(x?Uint32Array:Array)($+te),ne=new(x?Uint32Array:Array)(316),re=new(x?Uint8Array:Array)(19);for(K=V=0;$>K;K++)ee[V++]=M[K];for(K=0;te>K;K++)ee[V++]=F[K];if(!x)for(K=0,Z=re.length;Z>K;++K)re[K]=0;for(K=G=0,Z=ee.length;Z>K;K+=V){for(V=1;Z>K+V&&ee[K+V]===ee[K];++V);if(J=V,0===ee[K])if(3>J)for(;J-->0;)ne[G++]=0,re[0]++;else for(;J>0;)Q=138>J?J:138,Q>J-3&&J>Q&&(Q=J-3),10>=Q?(ne[G++]=17,ne[G++]=Q-3,re[17]++):(ne[G++]=18,ne[G++]=Q-11,re[18]++),J-=Q;else if(ne[G++]=ee[K],re[ee[K]]++,J--,3>J)for(;J-->0;)ne[G++]=ee[K],re[ee[K]]++;else for(;J>0;)Q=6>J?J:6,Q>J-3&&J>Q&&(Q=J-3),ne[G++]=16,ne[G++]=Q-3,re[16]++,J-=Q}for(e=x?ne.subarray(0,G):ne.slice(0,G),U=u(re,7),W=0;19>W;W++)X[W]=U[Y[W]];for(D=19;D>4&&0===X[D-1];D--);for(j=l(U),H.d(I-257,5,b),H.d(T-1,5,b),H.d(D-4,4,b),W=0;D>W;W++)H.d(X[W],3,b);for(W=0,q=e.length;q>W;W++)if(P=e[W],H.d(j[P],U[P],b),P>=16){switch(W++,P){case 16:z=2;break;case 17:z=3;break;case 18:z=7;break;default:t("invalid code: "+P)}H.d(e[W],z,b)}var oe,ie,se,ae,ce,ue,fe,le,pe=[B,M],he=[L,F];for(ce=pe[0],ue=pe[1],fe=he[0],le=he[1],oe=0,ie=R.length;ie>oe;++oe)if(se=R[oe],H.d(ce[se],ue[se],b),se>256)H.d(R[++oe],R[++oe],b),ae=R[++oe],H.d(fe[ae],le[ae],b),H.d(R[++oe],R[++oe],b);else if(256===se)break;this.a=H.finish(),this.b=this.a.length;break;default:t("invalid compression type")}return this.a};var M=function(){function e(e){switch(b){case 3===e:return[257,e-3,0];case 4===e:return[258,e-4,0];case 5===e:return[259,e-5,0];case 6===e:return[260,e-6,0];case 7===e:return[261,e-7,0];case 8===e:return[262,e-8,0];case 9===e:return[263,e-9,0];case 10===e:return[264,e-10,0];case 12>=e:return[265,e-11,1];case 14>=e:return[266,e-13,1];case 16>=e:return[267,e-15,1];case 18>=e:return[268,e-17,1];case 22>=e:return[269,e-19,2];case 26>=e:return[270,e-23,2];case 30>=e:return[271,e-27,2];case 34>=e:return[272,e-31,2];case 42>=e:return[273,e-35,3];case 50>=e:return[274,e-43,3];case 58>=e:return[275,e-51,3];case 66>=e:return[276,e-59,3];case 82>=e:return[277,e-67,4];case 98>=e:return[278,e-83,4];case 114>=e:return[279,e-99,4];case 130>=e:return[280,e-115,4];case 162>=e:return[281,e-131,5];case 194>=e:return[282,e-163,5];case 226>=e:return[283,e-195,5];case 257>=e:return[284,e-227,5];case 258===e:return[285,e-258,0];default:t("invalid length: "+e)}}var n,r,o=[];for(n=3;258>=n;n++)r=e(n),o[n]=r[2]<<24|r[1]<<16|r[0];return o}(),B=x?new Uint32Array(M):M,F=0,L=1,U={D:F,C:L};
}return this},o.prototype.offAny=function(t){var e,n=0,r=0;if(t&&this._all&&this._all.length>0){for(e=this._all,n=0,r=e.length;r>n;n++)if(t===e[n])return e.splice(n,1),this}else this._all=[];return this},o.prototype.removeListener=o.prototype.off,o.prototype.removeAllListeners=function(t){if(0===arguments.length)return!this._events||e.call(this),this;if(this.wildcard)for(var n="string"==typeof t?t.split(this.delimiter):t.slice(),r=i.call(this,null,n,this.listenerTree,0),o=0;r.length>o;o++){var s=r[o];s._listeners=null}else{if(!this._events[t])return this;this._events[t]=null}return this},o.prototype.listeners=function(t){if(this.wildcard){var n=[],r="string"==typeof t?t.split(this.delimiter):t.slice();return i.call(this,n,r,this.listenerTree,0),n}return this._events||e.call(this),this._events[t]||(this._events[t]=[]),a(this._events[t])||(this._events[t]=[this._events[t]]),this._events[t]},o.prototype.listenersAny=function(){return this._all?this._all:[]},"function"==typeof n&&n.amd?n("EventEmitter",[],function(){return o}):t.EventEmitter2=o}("undefined"!=typeof process&&process.title!==void 0&&"undefined"!=typeof exports?exports:window),n("intercom",["require","EventEmitter","src/shared"],function(t){function e(t,e){var n=0;return function(){var r=Date.now();r-n>t&&(n=r,e.apply(this,arguments))}}function n(t,e){if(void 0!==t&&t||(t={}),"object"==typeof e)for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);return t}function r(){var t=this,e=Date.now();this.origin=i(),this.lastMessage=e,this.receivedIDs={},this.previousValues={};var n=function(){t._onStorageEvent.apply(t,arguments)};document.attachEvent?document.attachEvent("onstorage",n):window.addEventListener("storage",n,!1)}var o=t("EventEmitter"),i=t("src/shared").guid,s=function(t){return t.localStorage===void 0?{getItem:function(){},setItem:function(){},removeItem:function(){}}:t.localStorage}(this);r.prototype._transaction=function(t){function e(){if(!a){var l=Date.now(),p=0|s.getItem(u);if(p&&r>l-p)return c||(i._on("storage",e),c=!0),f=window.setTimeout(e,o),void 0;a=!0,s.setItem(u,l),t(),n()}}function n(){c&&i._off("storage",e),f&&window.clearTimeout(f),s.removeItem(u)}var r=1e3,o=20,i=this,a=!1,c=!1,f=null;e()},r.prototype._cleanup_emit=e(100,function(){var t=this;t._transaction(function(){var t,e=Date.now(),n=e-f,r=0;try{t=JSON.parse(s.getItem(a)||"[]")}catch(o){t=[]}for(var i=t.length-1;i>=0;i--)n>t[i].timestamp&&(t.splice(i,1),r++);r>0&&s.setItem(a,JSON.stringify(t))})}),r.prototype._cleanup_once=e(100,function(){var t=this;t._transaction(function(){var e,n;Date.now();var r=0;try{n=JSON.parse(s.getItem(c)||"{}")}catch(o){n={}}for(e in n)t._once_expired(e,n)&&(delete n[e],r++);r>0&&s.setItem(c,JSON.stringify(n))})}),r.prototype._once_expired=function(t,e){if(!e)return!0;if(!e.hasOwnProperty(t))return!0;if("object"!=typeof e[t])return!0;var n=e[t].ttl||l,r=Date.now(),o=e[t].timestamp;return r-n>o},r.prototype._localStorageChanged=function(t,e){if(t&&t.key)return t.key===e;var n=s.getItem(e);return n===this.previousValues[e]?!1:(this.previousValues[e]=n,!0)},r.prototype._onStorageEvent=function(t){t=t||window.event;var e=this;this._localStorageChanged(t,a)&&this._transaction(function(){var t,n=Date.now(),r=s.getItem(a);try{t=JSON.parse(r||"[]")}catch(o){t=[]}for(var i=0;t.length>i;i++)if(t[i].origin!==e.origin&&!(t[i].timestamp<e.lastMessage)){if(t[i].id){if(e.receivedIDs.hasOwnProperty(t[i].id))continue;e.receivedIDs[t[i].id]=!0}e.trigger(t[i].name,t[i].payload)}e.lastMessage=n}),this._trigger("storage",t)},r.prototype._emit=function(t,e,n){if(n="string"==typeof n||"number"==typeof n?n+"":null,n&&n.length){if(this.receivedIDs.hasOwnProperty(n))return;this.receivedIDs[n]=!0}var r={id:n,name:t,origin:this.origin,timestamp:Date.now(),payload:e},o=this;this._transaction(function(){var n=s.getItem(a)||"[]",i="[]"===n?"":",";n=[n.substring(0,n.length-1),i,JSON.stringify(r),"]"].join(""),s.setItem(a,n),o.trigger(t,e),window.setTimeout(function(){o._cleanup_emit()},50)})},r.prototype.emit=function(t,e){this._emit.apply(this,arguments),this._trigger("emit",t,e)},r.prototyp
return o});