UNPKG

43.4 kBJavaScriptView Raw
1!function(){var b={},M={},n={},o={},C={},R={},H={},E={},U={},I={},L={},$={},_={},q={},p={},h={},c={},s={},x={},N={},m={},W={},i={},z={},g={},w={},J={};!function(){var e={},t={exports:e};Object.defineProperty(e,"__esModule",{value:!0});var r=require("atma-class");e.Class=r;var n=global,o=(e.global=n).logger||require("atma-logger");e.logger=o;function i(e){return null!=e&&"object"==typeof e&&e.constructor===Object}e.io={},i(I)&&i(t.exports)?Object.assign(I,t.exports):I=t.exports}(),function(){var t={},e={exports:t};Object.defineProperty(t,"__esModule",{value:!0});var r=require("atma-utils"),n=I,o=require("os"),i=new r.class_Uri(a(process.mainModule.filename)),s=process.platform,c=u(process.cwd());function u(e){return r.class_Uri.combine(a(e),"/")}function a(e){return e.replace(/\\/g,"/")}function l(e){return null!=e&&"object"==typeof e&&e.constructor===Object}t.Env={settings:{},cwd:c,applicationDir:new r.class_Uri(i.toDir()),currentDir:new r.class_Uri(c),tmpDir:new r.class_Uri("file:///"+o.tmpdir+"/"),newLine:o.EOL,getTmpPath:function(e){return t.Env.tmpDir.combine(Date.now()+"-"+(1e4*Math.random()|0)+"-"+e).toString()},get appdataDir(){var e;switch(s){case"win32":case"win64":e=process.env.APPDATA||process.env.HOME;break;case"darwin":default:e=process.env.HOME}return null==e?(n.logger.error("<io.env> Unknown AppData Dir"),Object.defineProperty(this,"appdataDir",{value:this.applicationDir}),this.applicationDir):(e=new r.class_Uri(u(e)),"darwin"===s&&(e=e.combine("Library/Application Support/")),e=e.combine("."+i.file+"/"),Object.defineProperty(this,"appdataDir",{value:e}),e)}},l(M)&&l(e.exports)?Object.assign(M,e.exports):M=e.exports}(),function(){var n,e={},t={exports:e},o=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),i=this&&this.__decorate||function(e,t,r,n){var o,i=arguments.length,s=i<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,r,n);else for(var c=e.length-1;0<=c;c--)(o=e[c])&&(s=(i<3?o(s):3<i?o(t,r,s):o(t,r))||s);return 3<i&&s&&Object.defineProperty(t,r,s),s};Object.defineProperty(e,"__esModule",{value:!0});var s=require("fs"),c=I,u="change",a={};e.Watcher={watch:function(e,t){a[e]?a[e].on(u,t):!1!==s.existsSync(e)?(a[e]=new r(e),a[e].on(u,t)):c.logger.error("<watcher> File not exists",e)},unwatch:function(e,t){var r=a[e];null!=r?null!=t&&(r.off(u,t),0!==r._listeners.length)||(r.close(),delete a[e]):c.logger.warn("<watcher> No exists",e)}};var r=function(r){function e(e){var t=r.call(this)||this;return t.path=e,t.fswatcher=s.watch(e,t.changed),t}return o(e,r),e.prototype.changed=function(){this.timeout&&clearTimeout(this.timeout),this.timeout=setTimeout(this.reportChange,100)},e.prototype.reportChange=function(){this.trigger(u,this.path)},e.prototype.close=function(){this.fswatcher.close(),this.off(u)},i([c.Class.deco.self],e.prototype,"changed",null),i([c.Class.deco.self],e.prototype,"reportChange",null),e}(c.Class.EventEmitter);function l(e){return null!=e&&"object"==typeof e&&e.constructor===Object}l(U)&&l(t.exports)?Object.assign(U,t.exports):U=t.exports}(),function(){var n,e={},t={exports:e},r=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)});Object.defineProperty(e,"__esModule",{value:!0});var a=I;function l(e){"/"===e[0]&&(e=e.substring(1));var t,r=e.split("/");t=-1!==e.indexOf("**")?1/0:r.length,r.pop();for(var n=0;n<r.length;n++)-1!==r[n].indexOf("*")&&r.splice(n);return[t,r.length,r.join("/").toLowerCase()]}function f(e){var t="",r=-1,n=e.length;for(e=e.replace(/(\*\*\/){2,}/g,"**/");++r<n;){var o=e[r];switch(o){case"?":t+=".";break;case"*":if("*"===e[r+1]){0===r&&/[\\\/]/.test(e[r+2])&&(t+=".+",r+=2),t+=".+",r++;break}t+="[^/]+";break;case"{":if(~(i=e.indexOf("}",r))){t+="("+e.substring(r+1,i).replace(/,/g,"|")+")",r=i;break}t+=o;break;case"[":var i;if(~(i=e.indexOf("]",r))){t=e.substring(r,i),r=i;break}t+=o;break;default:~"\\^$*+?.()|{}[]".indexOf(o)&&(t+="\\"),t+=o}}return new s(t="^"+t+"$","i")}e.glob_getCalculatedPath=function(e,t){var r=t.indexOf("*"),n=t.lastIndexOf("/",r),o=-1===n?null:t.substring(0,n);if(!n)return e;var i=e.toLowerCase().indexOf(o.toLowerCase());return-1===i?(a.logger.warn("[substring not found]",e,o),e):e.substring(i+o.length)},e.glob_matchPath=function(e,t){return"/"===t[0]&&(t=t.substring(1)),"/"===e[0]&&(e=e.substring(1)),f(e).test(t)},e.glob_parsePatterns=function t(e,r){if(null==e)return null;if(null==r&&(r=[]),Array.isArray(e))return e.forEach(function(e){t(e,r)}),r;if(e instanceof RegExp)return r.push(e),r;if("string"!=typeof e)return a.logger.error("<glob> Unsupported pattern",e),r;var n=e;"/"===n[0]&&(n=n.substring(1));var o=l(n),i=o[0],s=o[1],c=o[2],u=f(n);return u.depth=i,u.rootCount=s,u.root=c,r.push(u),r},e.glob_parseDirs=l,e.glob_toRegExp=f,e.glob_getStrictPath=function(e){var t=e.indexOf("*");return-1===t?(a.logger.error("glob.js [path is not a glob pattern]",e),null):e.substring(0,e.lastIndexOf("/",t)+1)},e.glob_getRelativePath=function(e){var t=e.indexOf("*");return-1===t?(a.logger.error("glob.js [path is not a glob pattern]",e),null):e.substring(e.lastIndexOf("/",t)+1)};var s=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return r(t,e),t}(RegExp);function o(e){return null!=e&&"object"==typeof e&&e.constructor===Object}e.GlobRegExp=s,o(m)&&o(t.exports)?Object.assign(m,t.exports):m=t.exports}(),function(){var e={},t={exports:e};Object.defineProperty(e,"__esModule",{value:!0});var n=I,o=require("atma-utils");function i(e){if(!e)return"/";var t=e.lastIndexOf("/");return-1===t?"":e.substring(t+1,-t)}function r(e){return null!=e&&"object"==typeof e&&e.constructor===Object}e.path_getProtocol=function(e){var t=e.indexOf(":");return-1===t||"/"!==e[t+1]||"/"!==e[t+2]?null:e.substring(0,t)},e.path_getUri=function(e,t){"string"!=typeof e&&(e=e.toString()),"/"===(e=function(e){e=e.replace(/\\/g,"/").replace(/^\.\//,"");for(var t=/\/{2,}/g,r=!1;;){var n=t.exec(e);if(null==n)break;0!==n.index&&(":"!==e[n.index-1]||!1!==r?e=e.substring(0,n.index)+"/"+e.substring(n.index+n[0].length):r=!0)}return e}(e))[0]&&(e=e.substring(1));var r=new o.class_Uri(e);return!1===r.isRelative()?r:t?new o.class_Uri(t).combine(r):n.io.env?n.io.env.currentDir.combine(r):new o.class_Uri("file://"+process.cwd()+"/").combine(r)},e.path_combine=function(e,t){return e?t?("/"===t[0]&&(t=t.substring(1)),"/"===e[e.length-1]?e+t:e+"/"+t):e:t},e.path_getDir=i,e.path_isSubDir=function(e,t){var r=i(e);return 0===i(t).toLowerCase().indexOf(r.toLowerCase())},e.path_resolveUri=function(e,t,r){"/"===e[0]&&(t=r,e=e.substring(1));var n=new o.class_Uri(e);return n.isRelative()?new o.class_Uri(t).combine(n):n},e.path_resolveAppUri=function(e,t){if("/"===e[0])return e;if("./"===e.substring(0,2)&&(e=e.substring(2)),!t||"file"===e.substring(0,4))return"/";var r=t.lastIndexOf("/");return(-1===r?"/":t.substring(r+1,-r))+e},e.path_ensureTrailingSlash=function(e){return"/"===e[e.length-1]?e:e+"/"},r(z)&&r(t.exports)?Object.assign(z,t.exports):z=t.exports}(),function(){var r={},e={exports:r};Object.defineProperty(r,"__esModule",{value:!0}),r.Repository={};var t=function(){function e(){}return e.register=function(e,t){r.Repository[e]=t},e.get=function(e){return r.Repository[e]},e.all=function(){return r.Repository},e.set=function(e){for(var t in e)r.Repository[t]=e[t]},e}();function n(e){return null!=e&&"object"==typeof e&&e.constructor===Object}r.CustomTransport=t,n($)&&n(e.exports)?Object.assign($,e.exports):$=e.exports}(),function(){var e={},t={exports:e};function r(e){return null!=e&&"object"==typeof e&&e.constructor===Object}Object.defineProperty(e,"__esModule",{value:!0}),e.obj_extend=function(e,t){if(null==e&&(e={}),null==t)return e;for(var r in t)e[r]=t[r];return e},r(i)&&r(t.exports)?Object.assign(i,t.exports):i=t.exports}(),function(){var e={},t={exports:e};Object.defineProperty(e,"__esModule",{value:!0});var r=require("fs");function n(e){return null!=e&&"object"==typeof e&&e.constructor===Object}e.fs_isDirectory=function(e){try{return r.statSync(e).isDirectory()}catch(e){return!1}},e.fs_getStat=function(e){try{return r.statSync(e)}catch(e){return null}},n(N)&&n(t.exports)?Object.assign(N,t.exports):N=t.exports}(),function(){var e={},t={exports:e};Object.defineProperty(e,"__esModule",{value:!0});var m=I,w=require("fs"),c=i,o=N,j=z;function r(e){return o.fs_isDirectory(e)}function u(e,r){w.stat(e,function(e,t){r(e,t&&t.isDirectory())})}function a(e){return""===e||"/"===e||/^[A-Z]:\/?$/i.test(e)}function b(e,t){for(var r=-1,n=t.length;++r<n;)if(t[r].test(e))return!0;return!1}function l(e){if(null==e)return 1/0;for(var t=0,r=e.length,n=-1;++n<r;)t<e[n].depth&&(t=e[n].depth);return t||1/0}function O(e){try{return w.lstatSync(e)}catch(e){return null}}function n(e){return null!=e&&"object"==typeof e&&e.constructor===Object}e.DirectoryFsTransport={ensure:function(e){return function e(t){"/"===t[t.length-1]&&(t=t.substring(0,t.length-1));if(!1===w.existsSync(t)){var r,n=t.substring(0,t.lastIndexOf("/"));if(!1===a(n)&&(r=e(n)),r)return r.toString();try{w.mkdirSync(t)}catch(e){return e.toString()}}if(!o.fs_isDirectory(t))return"Target exists, but is not a directory:"+t}(e)},ensureAsync:function(e,t){return function n(o,i){o=o.replace(/\/*$/,"");u(o,function(e,t){if(t)return i();var r=o.substring(0,o.lastIndexOf("/"));!1===a(r)?n(r,s):s()});function s(){w.mkdir(o,function(e){e&&("EEXIST"===e.code?e=null:47!==e.errno&&-4707!==e.errno||(e=null)),i(e)})}}(e,t)},ceateSymlink:function(e,t){!function(e,t){try{w.symlinkSync(e,t,"junction")}catch(e){m.logger.error("symlink: bold<%s>",e)}}(e,t)},exists:function(e){return r(e)},existsAsync:function(e,t){u(e,t)},readFiles:function(e,t,r,n){return o=t,i=r,s=n,function e(t,r,n){var o,i=[];try{o=w.readdirSync(t)}catch(e){return console.error("<dir walk>",e),i}null==r&&(r=""),null==n&&(n={depth:0,maxdepth:1/0,directories:!1,symlinks:!1});var s=n.depth,c=n.patterns,u=n.excludes;n.depth++;for(var a,l=0,f=o.length;l<f;l++){a=o[l];var p=O(j.path_combine(t,a)),h=j.path_combine(r,a),y=!0;if(null!=p)if(p.isDirectory()){if(p.isSymbolicLink())continue;if(n.directories&&i.push(j.path_combine(t,a)+"/"),n.depth>=n.maxdepth)continue;var g=j.path_combine(r,a);if(c){for(var d=!1,v=0,b=c.length;v<b;v++){var _=c[v].rootCount-s,x=c[v].root;if(!_||_<s){d=!0;break}if(0===x.indexOf(g)){d=!0;break}m.logger(90).warn("<glob> not matched %s | %s",g,x)}if(!1===d)continue}m.logger(90).warn("<glob> match sub-",g),i=i.concat(e(j.path_combine(t,a),g,n))}else{if(c){y=!1;for(var v=0,b=c.length;v<b;v++)if(c[v].test(h)){y=!0;break}}if(y&&u)for(var v=0,b=u.length;v<b;v++)if(u[v].test(h)){y=!1;break}y&&i.push(h)}}return n.depth=s,i}(e,"",c.obj_extend(s,{depth:0,maxdepth:l(o),patterns:o,excludes:i}));var o,i,s},readFilesAsync:function(e,t,r,n,o){!function(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];var n=t.pop();for(;null==n&&0<t.length;)n=t.pop();var o=t.shift(),i=t.shift(),s=t.shift();!function u(a,l,f,p,h,c){var y=f,g=p.maxdepth,d=p.patterns,n=p.excludes;f++;w.readdir(a,function(e,t){if(e)return c(e,h);if(0===t.length)return c(null,h);for(var r,n,o=-1,i=t.length,s=(r=i,function(e){n=n||e,0==--r&&c(n,h)});++o<i;)v(t[o],s)});function v(r,n){var e=j.path_combine(a,r);w.lstat(e,function(e,t){return e?n():t.isDirectory()?o(r,t,n):(i(r,h),void n())})}function o(e,t,r){if(t.isSymbolicLink())return r();if(p.directories&&h.push(j.path_combine(l,e)+"/"),g<=f)return r();var n=j.path_combine(l,e);if(d){for(var o=-1,i=d.length;++o<i;){var s=d[o].rootCount-y,c=d[o].root;if(!s||s<y)break;if(0===c.indexOf(n))break}if(i<=o)return r()}u(j.path_combine(a,e),n,f,p,h,r)}function i(e,t){var r=j.path_combine(l,e);d&&!1===b(r,d)||n&&!0===b(r,n)||t.push(r)}}(e,"",0,c.obj_extend(s,{maxdepth:l(o),patterns:o,excludes:i}),[],n)}(e,t,r,n,o)},remove:function(e){return function(e){if(!1===r(e))return!0;try{return function e(t){var r,n,o=w.readdirSync(t),i=o.length,s=-1;for(;++s<i;)"."!==(r=o[s])&&".."!==r&&(n=t+"/"+r,w.lstatSync(n).isDirectory()?e(n):w.unlinkSync(n));w.rmdirSync(t)}(e),!0}catch(e){return!1}}(e)},removeAsync:function(e,t){(function o(a,l){function f(r,n){w.lstat(r,function(e,t){e?n(e):t.isDirectory()?o(r,n):w.unlink(r,n)})}function p(){w.rmdir(a,l)}w.readdir(a,function(e,t){if(e)l(e);else{var r=t.length,n=-1;if(0!==r)for(var o,i,s,c,u=(i=r,s=p,function(e){c=c||e,--i<1&&s(c)});++n<r;)"."!==(o=t[n])&&".."!==o?f(j.path_combine(a,o),u):u();else p()}})})(e,t)},rename:function(e,t){w.renameSync(e,t)},renameAsync:function(e,t,r){w.rename(e,t,r)}},n(p)&&n(t.exports)?Object.assign(p,t.exports):p=t.exports}(),function(){var e={},t={exports:e},r=this&&this.__spreadArrays||function(){for(var e=0,t=0,r=arguments.length;t<r;t++)e+=arguments[t].length;var n=Array(e),o=0;for(t=0;t<r;t++)for(var i=arguments[t],s=0,c=i.length;s<c;s++,o++)n[o]=i[s];return n};Object.defineProperty(e,"__esModule",{value:!0});var n=I;e.log_error=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];i.apply(void 0,r([o.red],e))},e.log_info=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];i.apply(void 0,r([o.cyan],e))};var o="[atma-io]";function i(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];t.unshift(e),n.logger.log.apply(n.logger,t)}function s(e){return null!=e&&"object"==typeof e&&e.constructor===Object}s(W)&&s(t.exports)?Object.assign(W,t.exports):W=t.exports}(),function(){var s={},e={exports:s};Object.defineProperty(s,"__esModule",{value:!0});var c=require("fs"),u=p,n=W,a=I,l=z;s.FileFsTransport={save:function(e,t,r){if(u.DirectoryFsTransport.ensure(l.path_getDir(e)))n.log_error("file_save",e);else try{c.writeFileSync(e,t,r)}catch(e){n.log_error("file_save",e.toString())}},saveAsync:function(t,r,n,o){u.DirectoryFsTransport.ensureAsync(l.path_getDir(t),function(e){if(e)return o(e);c.writeFile(t,r,n||i,o)})},copy:function(e,t){if(!1!==c.existsSync(e))if(u.DirectoryFsTransport.ensure(l.path_getDir(t)))n.log_error("file_copy Target error",t);else try{!function(e,t){var r=new Buffer(65536),n=1,o=c.openSync(e,"r"),i=c.openSync(t,"w"),s=0;for(;0<n;)n=c.readSync(o,r,0,65536,s),c.writeSync(i,r,0,n),s+=n;c.closeSync(o),c.closeSync(i)}(e,t)}catch(e){n.log_error("file_copy",e.toString())}else n.log_error("file_copy 404",e)},copyAsync:function(n,o,i){function r(e){if(e)i(e);else{var t=c.createReadStream(n).on("error",function(e){a.logger.log("readstream error",n,e),i&&i(e),i=null}),r=c.createWriteStream(o).on("error",function(e){a.logger.log("writestream error",o,e),i&&i(e),i=null}).on("close",function(){i&&i(null),i=null});t.pipe(r)}}s.FileFsTransport.existsAsync(n,function(e,t){if(!0!==t)return i({code:404,message:n+" not exists."});u.DirectoryFsTransport.ensureAsync(l.path_getDir(o),r)})},exists:function(e){return c.existsSync(e)&&c.statSync(e).isFile()},existsAsync:function(e,n){c.stat(e,function(e,t){if(o.isNotFound(e))n(null,!1);else{var r=t&&t.isFile();n(e,r)}})},read:function(e,t){try{return c.readFileSync(e,t)}catch(e){n.log_error("file_read",e.toString())}return""},readAsync:function(e,t,r){c.readFile(e,{encoding:t},r)},remove:function(e){if(!1===s.FileFsTransport.exists(e))return!0;try{c.unlinkSync(e)}catch(e){return n.log_error("file_remove",e.toString()),!1}return!0},removeAsync:function(e,t){c.unlink(e,function(e){o.isNotFound(e)&&(e=null),t(e)})},rename:function(e,t){if(!1===s.FileFsTransport.exists(e))return n.log_error("file_rename 404",e),!1;try{c.renameSync(e,f(e)+t)}catch(e){return n.log_error("file_rename",e.toString()),!1}return!0},renameAsync:function(e,t,r){c.rename(e,f(e)+t,function(e){r(e,null==e)})}};var o,i={encoding:"utf8"};function f(e){return e.substring(0,e.lastIndexOf("/")+1)}function t(e){return null!=e&&"object"==typeof e&&e.constructor===Object}(o||(o={})).isNotFound=function(e){return null!=e&&(34===e.errno||-4058===e.errno||"ENOENT"===e.code)},t(h)&&t(e.exports)?Object.assign(h,e.exports):h=e.exports}(),function(){var e={},t={exports:e};Object.defineProperty(e,"__esModule",{value:!0});var r=h,n=p;function o(e){return null!=e&&"object"==typeof e&&e.constructor===Object}e.FsTransport={File:r.FileFsTransport,Directory:n.DirectoryFsTransport},o(c)&&o(t.exports)?Object.assign(c,t.exports):c=t.exports}(),function(){var e={},t={exports:e};Object.defineProperty(e,"__esModule",{value:!0});var n=z,o=$,i=c;function s(e){var t=n.path_getProtocol(e);if(null==t||"file"===t)return i.FsTransport.Directory;var r=o.CustomTransport.get(t);if(null==r)throw new Error("Transport '"+t+"' is not supported or not installed");return r.Directory}function r(e){return null!=e&&"object"==typeof e&&e.constructor===Object}e.dir_ensure=function(e){return s(e).ensure(e)},e.dir_ensureAsync=function(e,t){s(e).ensureAsync(e,t)},e.dir_exists=function(e){return s(e).exists(e)},e.dir_existsAsync=function(e,t){s(e).existsAsync(e,t)},e.dir_files=function(e,t,r,n){return s(e).readFiles(e,t,r,n)},e.dir_filesAsync=function(e,t,r,n,o){return s(e).readFilesAsync(e,t,r,n,o)},e.dir_symlink=function(e,t){s(e).ceateSymlink(e,t)},e.dir_remove=function(e){return s(e).remove(e)},e.dir_removeAsync=function(e,t){return s(e).removeAsync(e,t)},e.dir_rename=function(e,t){return s(e).rename(e,t)},e.dir_renameAsync=function(e,t,r){return s(e).renameAsync(e,t,r)},r(_)&&r(t.exports)?Object.assign(_,t.exports):_=t.exports}(),function(){var e={},t={exports:e};Object.defineProperty(e,"__esModule",{value:!0});var n=$,o=c,i=z;function s(e){var t=i.path_getProtocol(e);if(null==t||"file"===t)return o.FsTransport.File;var r=n.CustomTransport.get(t);if(null==r)throw new Error("Transport '"+t+"' is not supported or not installed for path '"+e+"'");return r.File}function r(e){return null!=e&&"object"==typeof e&&e.constructor===Object}e.file_save=function(e,t,r){s(e).save(e,t,r)},e.file_saveAsync=function(e,t,r,n){s(e).saveAsync(e,t,r,n)},e.file_copy=function(e,t){var r=s(e),n=s(t);if(r!==n){var o=r.read(e);n.save(t,o)}else r.copy(e,t)},e.file_copyAsync=function(e,r,n){var t=s(e),o=s(r);t!==o?t.readAsync(e,null,function(e,t){e?n(e):o.saveAsync(r,t,null,n)}):t.copyAsync(e,r,n)},e.file_exists=function(e){return s(e).exists(e)},e.file_existsAsync=function(e,t){return s(e).existsAsync(e,t)},e.file_read=function(e,t){return s(e).read(e,t)},e.file_readAsync=function(e,t,r){s(e).readAsync(e,t,r)},e.file_remove=function(e){return s(e).remove(e)},e.file_removeAsync=function(e,t){s(e).removeAsync(e,t)},e.file_rename=function(e,t){return s(e).rename(e,t)},e.file_renameAsync=function(e,t,r){s(e).renameAsync(e,t,r)},r(q)&&r(t.exports)?Object.assign(q,t.exports):q=t.exports}(),function(){var e={},t={exports:e};Object.defineProperty(e,"__esModule",{value:!0});var s=require("atma-utils"),r=function(){function e(){this.handlers=[]}return e.prototype.registerHandler=function(e,t){!function(e){var t="function"==typeof e?e.prototype:e;for(var r in t){var n=t[r];if("function"==typeof n&&-1===r.indexOf("Async")){var o=r+"Async";null==t[o]&&(t[o]=i(n,r))}}function i(o,e){return function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var r=new s.class_Dfr;try{var n=o.apply(this,e);return r.resolve(n)}catch(e){return r.reject(e)}}}}(t),this.handlers.push({handler:t,regexp:e})},e.prototype.unregisterHandler=function(e,t){for(var r,n=e.toString(),o=this.handlers.length,i=-1;++i<o;)if((r=this.handlers[i]).regexp.toString()===n)if(void 0!==t){if(t===r)return void this.handlers.splice(i,1)}else this.handlers.splice(i,1),i--,o--},e.prototype.resolveHandler=function(e){var t=e.toString(),r=function(e,t){var r,n=e.length,o=-1;for(;++o<n;)if(i((r=e[o]).regexp,t))return r;return null}(this.handlers,t);return r?r.handler:null},e}();function i(e,t){return Array.isArray(e)?e.some(function(e){return i(e,t)}):(e.lastIndex=0,e.test(t))}function n(e){return null!=e&&"object"==typeof e&&e.constructor===Object}e.FileFactory=r,n(R)&&n(t.exports)?Object.assign(R,t.exports):R=t.exports}(),function(){var e={},t={exports:e};function r(e,t){if(null==e)return e;for(var r=e.length,n=-1;++n<r&&!1!==t(e[n],n););return e}function o(e){return Array.isArray(e)}function n(e){return null!=e&&"object"==typeof e&&e.constructor===Object}Object.defineProperty(e,"__esModule",{value:!0}),e.arr_eachOrSingle=function(e,t){return!1===o(e)?(t(e),e):r(e,t)},e.arr_any=function(e,t){if(!1===o(e))return!1;for(var r=e.length,n=-1;++n<r;)if(t(e[n],n))return!0;return!1},e.arr_each=r,e.arr_find=function(e,t){if(null==e)return e;for(var r=e.length,n=-1;++n<r;)if(t(e[n],n))return e[n];return null},e.arr_isArray=o,n(s)&&n(t.exports)?Object.assign(s,t.exports):s=t.exports}(),function(){var e={},t={exports:e};function r(e){return null!=e&&"object"==typeof e&&e.constructor===Object}Object.defineProperty(e,"__esModule",{value:!0}),e.rgx_prepairString=function(e){return e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")},r(g)&&r(t.exports)?Object.assign(g,t.exports):g=t.exports}(),function(){var e={},t={exports:e};Object.defineProperty(e,"__esModule",{value:!0});var u,a=C,l=s,f=I,i=g;function y(e,t){var r=a.File.middleware[e];if(null==r)try{var n=require(e);n&&n.register&&n.register(f.io),null==(r=a.File.middleware[e])&&(r=n)}catch(e){}return null==r?(f.logger.error("Middleware is not installed",e),null):"object"==typeof r&&(null==r.name&&(r.name=e),null!=t&&null==r[t]&&null==r[t+"Async"])?(f.logger.error("Middleware not defined for action",t,e),null):r}function p(e){if("/"===e[0]){var t=e.substring(1),r=t.lastIndexOf("/"),n=t.substring(r+1);return t=t.substring(0,r),new RegExp(t,n)}var o=i.rgx_prepairString(e);return new RegExp("\\."+o+"($|\\?|#)")}function r(e){return null!=e&&"object"==typeof e&&e.constructor===Object}e.FileHookRegistration={registerMiddlewares:function(e,t,r){void 0===t&&(t=!1),void 0===r&&(r=null);var n,o,i=a.File.getHookHandler();for(var s in e){var c=e[s];!1!==l.arr_isArray(c)?(t&&(n=i,void 0,o=p(s),n.unregisterByRegexp(o)),l.arr_each(c,u.registerHookDelegate(i,s,r))):f.logger.warn("Middleware list for %s is not an array",s)}},ensureMiddleware:function(e,t){return y(e,t)}},function(e){function h(e,t,r,n,o,i){if(null!=t){if(null!=i&&null!=n&&"string"!=typeof t){var s=i[n];s&&t.setOptions&&t.setOptions(s)}"string"!=typeof t&&t.setIo&&t.setIo(f.io);var c=p(r);e.register(c,o,t)}}(u||(u={})).registerHookDelegate=function(t,r,n){return function(e){!function(e,t,r,n){if("string"==typeof r)return o=e,i=t,s=n,c=/^(.+?)(:(read|write))?$/.exec(r),u=c[1],a=c[3],l=y(u,a),h(o,l,i,u,a,s);var o,i,s,c,u,a,l;if(Array.isArray(r)){var f=r[0],p=r[1];return h(e,f,t,null,p,n)}throw Error("Invalid handler Definition in registerHook")}(t,r,e,n)}}}(),r(H)&&r(t.exports)?Object.assign(H,t.exports):H=t.exports}(),function(){var e={},t={exports:e};Object.defineProperty(e,"__esModule",{value:!0});var n=C,r=I,s=H,c=function(){function e(e,t,r,n){this.regexp=e,this.method=t,this.handler=r,this.zIndex=n}return e.prototype.run=function(e,t,r){!1!==this.canHandle(t.uri.toString(),e)&&("function"==typeof this.handler?this.handler(t,r):this.handler[e]&&this.handler[e](t,r))},e.prototype.runAsync=function(e,t,r,n){if(e===this.method)if(!1!==this.regexp.test(t.uri.toString())){var o=this.handler;if("function"==typeof o)o(t,r),n();else{if(o[e+"Async"])return void o[e+"Async"](t,r,n);if(o[e])try{o[e](t,r)}catch(e){return void n(e)}n()}}else n();else n()},e.prototype.canHandle=function(e,t){return(null==t||t===this.method)&&this.regexp.test(e)},e}();e.HookRunner=c;var o=function(){function e(){this.hooks=[]}return e.prototype.register=function(e,t,r,n){var o;if(e instanceof RegExp?o=e:(o=e.regexp,t=e.method,r=e.handler,n=e.zIndex),"string"==typeof r){var i=s.FileHookRegistration.ensureMiddleware(r,t);if(null==i)return this;r=i}return!1===this.contains(t,r,o)&&this.hooks.push(new c(o,t,r,n||0)),this},e.prototype.contains=function(e,t,r){for(var n=r&&r.toString()||null,o=this.hooks.length,i=-1;++i<o;){var s=this.hooks[i];if(s.method===e&&(s.handler===t&&(null==n||n===s.regexp.toString())))return!0}return!1},e.prototype.unregister=function(t,r){"string"==typeof r&&(r=n.File.middleware[r]),this.hooks=this.hooks.filter(function(e){return!(e.method===t&&e.handler===r)})},e.prototype.unregisterByRegexp=function(e){for(var t=e.toString(),r=this.hooks.length,n=-1;++n<r;){this.hooks[n].regexp.toString()===t&&(this.hooks.splice(n,1),n--,r--)}},e.prototype.trigger=function(t,r,n){this.getHooksForPath(r.uri.toString(),t).forEach(function(e){e.run(t,r,n)})},e.prototype.triggerAsync=function(e,t,r,n){var o=t.uri.toString(),i=this.getHooksForPath(o,e);new u(i).process(e,t,r,n)},e.prototype.clear=function(){return this.hooks=[],this},e.prototype.getHooksForPath=function(t,r){return this.hooks.filter(function(e){return e.canHandle(t,r)}).sort(function(e,t){return e.zIndex===t.zIndex?0:e.zIndex<t.zIndex?1:-1})},e}();e.FileHooks=o;var u=r.Class.Collection(c,{Base:r.Class.Serializable,index:-1,cb:null,method:null,file:null,config:null,process:function(e,t,r,n){this.index=-1,this.cb=n,this.method=e,this.file=t,this.config=r,this.next()},Self:{next:function(e){if(e)this.cb(e);else if(++this.index>=this.length)this.cb();else{var t=this[this.index];if("function"!=typeof t.handler){var r=t.handler.name;if(r)for(var n=this.index-1;-1<n;n--)if(r===this[n].handler.name)return void this.next()}t.runAsync(this.method,this.file,this.config,this.next)}}}});function i(e){return null!=e&&"object"==typeof e&&e.constructor===Object}i(E)&&i(t.exports)?Object.assign(E,t.exports):E=t.exports}(),function(){var e={},t={exports:e};Object.defineProperty(e,"__esModule",{value:!0});var n=I,o=M;function r(e){return null!=e&&"object"==typeof e&&e.constructor===Object}e.JsonMiddleware={read:function(t){if("string"==typeof t.content)try{t.content=JSON.parse(t.content)}catch(e){n.logger.error("<json:parser> "+t.uri.toString()+" "+e)}},write:function(t,e){if(null!=t.content&&"object"==typeof t.content)try{var r=e&&e.minify?null:2;t.content=JSON.stringify(t.content,null,r).replace(/\n/g,o.Env.newLine)}catch(e){n.logger.error("<json:stringify> "+t.uri.toString()+" "+e)}}},r(L)&&r(t.exports)?Object.assign(L,t.exports):L=t.exports}(),function(){var e={},t={exports:e};Object.defineProperty(e,"__esModule",{value:!0});var i=z;function r(e){return null!=e&&"object"==typeof e&&e.constructor===Object}e.uri_getFile=function(e,t){if(null==t)return e.file;var r=i.path_getUri(t),n=e.toLocalFile(),o=r.toLocalFile();if(!1===n.includes(o))throw new Error(t+" is not the base path for "+n);return e.toRelativeString(r)},r(J)&&r(t.exports)?Object.assign(J,t.exports):J=t.exports}(),function(){var e={},t={exports:e};Object.defineProperty(e,"__esModule",{value:!0});var s,c,r=require("atma-utils"),a=z,l=q,u=I,f=W,n=N,o=M,p=U,i=R,h=E,y=H,g=$,d=L,v=I,b=J,_={},x=!0,m=function(){function i(e,t){if(this.uri=a.path_getUri(e),S(e=O(this.uri),t))return _[e];if(this.__proto__===i.prototype){var r=t&&t.factory||c,n=r&&r.resolveHandler(this.uri);if(null!=n)return new n(this.uri,t)}return!1==(o=t,!1!==x&&(null==o||!1!==o.cached))?this:_[e]=this;var o}return i.prototype.read=function(e){if(null!=this.content)return this.content;var t=A(e),r=O(this.uri);return this.content=l.file_read(r,t.encoding),F("read",this,t,e),this.content},i.read=function(e,t){return new i(e).read(t)},i.prototype.readAsync=function(s){return w(this,function(r,n,e){if(null==n.content){var o=A(s);l.file_readAsync(e,o.encoding,function(e,t){if(e)return r.reject(e);n.content=t,F("read",n,o,s,i)})}else r.resolve(n.content,n);function i(e){if(e)return r.reject(e);r.resolve(n.content,n)}},function(e,t){S(t)&&delete _[t]})},i.readAsync=function(e,t){return new i(e,t).readAsync(t)},i.prototype.write=function(e,t){if(null!=e&&(this.content=e),null==this.content)return u.logger.error("io.file.write: Content is empty"),this;var r=O(this.uri),n=A(t);return F("write",this,n,t),l.file_save(r,this.content,n),this.content=null,this},i.write=function(e,t,r){return new i(e,r).write(t,r)},i.prototype.writeAsync=function(e,i){return w(this,function(t,r,n){if(r.content=e=e||r.content,null!=e){var o=A(i);F("write",r,o,i,function(){var e=r.content;r.content=null,l.file_saveAsync(n,e,o,j(t))})}else t.reject(Error("Content is undefined"))})},i.writeAsync=function(e,t,r){return new i(e).writeAsync(t,r)},i.prototype.copyTo=function(e,t){var r,n,o=O(this.uri),i=a.path_getUri(e),s=i.file?O(i):O(i.combine(b.uri_getFile(this.uri,null===(r=t)||void 0===r?void 0:r.baseSource)));if(!0!==(null===(n=t)||void 0===n?void 0:n.silent)){var c=o.substr(-25).replace(/([^\/]+)$/,"green<bold<$1>>").color,u=s.substr(-25).replace(/([^\/]+)$/,"green<bold<$1>>").color;f.log_info("copy:",c,u)}return l.file_copy(o,s),this},i.copyTo=function(e,t,r){return new i(e).copyTo(t,r)},i.prototype.copyToAsync=function(s,c){return w(this,function(e,t,r){var n,o=a.path_getUri(s),i=o.file?O(o):O(o.combine(b.uri_getFile(this.uri,null===(n=c)||void 0===n?void 0:n.baseSource)));l.file_copyAsync(r,i,j(e))})},i.copyToAsync=function(e,t,r){return new i(e).copyToAsync(t)},i.prototype.exists=function(){return l.file_exists(O(this.uri))},i.exists=function(e){return new i(e).exists()},i.prototype.existsAsync=function(){return w(this,function(e,t,r){l.file_existsAsync(r,j(e))})},i.existsAsync=function(e){return new i(e).existsAsync()},i.prototype.rename=function(e){return l.file_rename(O(this.uri),e)},i.rename=function(e,t){return new i(e).rename(t)},i.prototype.renameAsync=function(n){return w(this,function(e,t,r){l.file_renameAsync(r,n,j(e))})},i.renameAsync=function(e,t){return new i(e).renameAsync(t)},i.prototype.remove=function(){return l.file_remove(O(this.uri))},i.remove=function(e){return new i(e).remove()},i.prototype.removeAsync=function(){return w(this,function(e,t,r){l.file_removeAsync(r,j(e))})},i.removeAsync=function(e){return new i(e).removeAsync()},i.prototype.replace=function(e,t,r){var n=this.read(r);return"string"!=typeof n&&(n=n.toString()),n=n.replace(e,t),this.write(n),n},i.replace=function(e,t,r,n){return new i(e).replace(t,r,n)},i.prototype.replaceAsync=function(n,o,e){return w(this,function(t,r){r.readAsync(e).fail(t.rejectDelegate()).done(function(e){e=e.replace(n,o),r.writeAsync(e).fail(t.rejectDelegate()).done(function(){t.resolve(null,e)})})})},i.replaceAsync=function(e,t,r,n){return new i(e).replaceAsync(t,r,n)},i.prototype.watch=function(e){p.Watcher.watch(O(this.uri),e)},i.watch=function(e,t){new i(e).watch(t)},i.prototype.unwatch=function(e){p.Watcher.unwatch(O(this.uri),e)},i.unwatch=function(e,t){new i(e).unwatch(t)},i.prototype.stats=function(){return n.fs_getStat(O(this.uri))},i.stats=function(e){return new i(e).stats()},i.clearCache=function(e){var t;!1!==x&&(0!==arguments.length?null!=e&&("string"==typeof e?(t=O(a.path_getUri(e)),!1===_.hasOwnProperty(t)&&47===e.charCodeAt(0)&&(t=r.class_Uri.combine(o.Env.cwd,e))):e.uri?t=O(e.uri):e.toLocalFile&&(t=O(e)),!1!==_.hasOwnProperty(t)?delete _[t]:u.logger.log("io.File - not in cache -",t)):_={})},i.disableCache=function(){x=!(_={})},i.enableCache=function(){x=!0},i.registerFactory=function(e){c=e},i.getFactory=function(){return c},i.registerHookHandler=function(e){s=e},i.getHookHandler=function(){return s},i.registerTransport=function(e,t){g.CustomTransport.register(e,t)},i.getTransports=function(){return g.CustomTransport.all()},i.setTransports=function(e){g.CustomTransport.set(e)},Object.defineProperty(i,"Factory",{get:function(){return c},enumerable:!0,configurable:!0}),Object.defineProperty(i,"Middleware",{get:function(){return s},enumerable:!0,configurable:!0}),i.processHooks=function(e,t,r,n){F(e,t,null,r,n)},i.registerExtensions=function(e,t,r){void 0===t&&(t=!1),void 0===r&&(r=null),y.FileHookRegistration.registerMiddlewares(e,t,r)},i.setMiddlewares=function(e,t){void 0===t&&(t=null),y.FileHookRegistration.registerMiddlewares(e,!0,t)},i.middleware={},i}();function w(e,t,r){var n=new u.Class.Deferred,o=O(e.uri);return null!=r&&n.fail(function(){r(e,o)}),t(n,e,o),n}function j(n){return function(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];e?n.reject(e):n.resolve.apply(n,t)}}function O(e){return null==e.protocol||"file"===e.protocol?e.toLocalFile():e.toString()}function A(e,t){var r=t||{encoding:"utf8",skipHooks:!1,hooks:null};if(null==e)return r;switch(typeof e){case"string":r.encoding=e;break;case"object":Object.assign(r,e)}return"buffer"===r.encoding&&(r.encoding=null),r}function F(e,t,r,n,o){var i=s;null==r||null!=(i=r.hooks||i)&&!0!==r.skipHooks?o?i.triggerAsync(e,t,n,o):i.trigger(e,t,n):o&&o()}function S(e,t){return!1!==x&&((null==t||!1!==t.cached)&&(_.hasOwnProperty(e)&&null!=_[e]))}if(e.File=m,v.global.io&&v.global.io.File&&"function"==typeof v.global.io.File.getFactory){var k=v.global.io.File;m.registerFactory(k.getFactory()),m.registerHookHandler(k.getHookHandler()),m.middleware=k.middleware,k.getTransports&&m.setTransports(k.getTransports())}else{var P=new i.FileFactory,D=new h.FileHooks;m.registerFactory(P),m.registerHookHandler(D),D.register(/\.json$/,"read",d.JsonMiddleware),D.register(/\.json$/,"write",d.JsonMiddleware)}function T(e){return null!=e&&"object"==typeof e&&e.constructor===Object}T(C)&&T(t.exports)?Object.assign(C,t.exports):C=t.exports}(),function(){var n,e={},t={exports:e},r=this&&this.__extends||(n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)},function(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),o=this&&this.__decorate||function(e,t,r,n){var o,i=arguments.length,s=i<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,r,n);else for(var c=e.length-1;0<=c;c--)(o=e[c])&&(s=(i<3?o(s):3<i?o(t,r,s):o(t,r))||s);return 3<i&&s&&Object.defineProperty(t,r,s),s};Object.defineProperty(e,"__esModule",{value:!0});var i,s,c=I;e.cli_prompt=function(e,t){u.create(new a(e,t))},e.cli_confirm=function(e,t){u.create(new l(e+" (y): ",t))};var u=function(){function r(){this.collection=[],this.busy=!1}return r.create=function(e){var t;null==i&&(t=require("readline"),i=t.createInterface({input:process.stdin,output:process.stdout}),s=new r),s.collection.push(e),s.process()},r.prototype.process=function(){this.busy||0!==this.collection.length&&(this.busy=!0,this.collection.shift().process().always(this.next))},r.prototype.next=function(){this.busy=!1,this.process()},o([c.Class.deco.self],r.prototype,"process",null),o([c.Class.deco.self],r.prototype,"next",null),r}(),a=function(n){function e(e,t){void 0===e&&(e=">");var r=n.call(this)||this;return r.text=e,r.callback=t,r}return r(e,n),e.prototype.process=function(){return i.resume(),process.stdout.write("\n"),i.question(this.text,this.onInput.bind(this)),this},e.prototype.onInput=function(e){i.pause(),this.callback&&this.callback(e),this.resolve(e)},e}(c.Class.Deferred),l=function(o){function e(e,t){var r=o.call(this,e,t)||this,n=r.callback;return r.callback=function(e){n(/^y|yes$/gi.test(e))},r}return r(e,o),e.prototype.onInput=function(e){e?o.prototype.onInput.call(this,e):this.process()},e}(a);function f(e){return null!=e&&"object"==typeof e&&e.constructor===Object}f(x)&&f(t.exports)?Object.assign(x,t.exports):x=t.exports}(),function(){var e={},t={exports:e};Object.defineProperty(e,"__esModule",{value:!0});var i,n={path:null,file:null,line:null};function s(e){")"===e[e.length-1]&&(e=e.substr(e.indexOf("(")+1,e.lastIndexOf(")")-1));var t=/^(.+):(\d+):(\d)/.exec(e);if(null==t)return null;var r=n.path=t[1];return n.file=r.substring(r.search(/[\/\\][^\/\\]+$/)+1),n.line=t[2],null==i&&(i=n.file),n}function r(e){return null!=e&&"object"==typeof e&&e.constructor===Object}e.stack_formatCaller=function(e){void 0===e&&(e="P:L");for(var t,r=(new Error).stack.split("\n").splice(1),n=r.length,o=-1;++o<n&&(null==(t=s(r[o]))||null==i||t.file===i););return null==t||o===n?"":e.replace("P",t.path).replace("F",t.file).replace("L",t.line)},r(w)&&r(t.exports)?Object.assign(w,t.exports):w=t.exports}(),function(){var e={},t={exports:e},i=this&&this.__spreadArrays||function(){for(var e=0,t=0,r=arguments.length;t<r;t++)e+=arguments[t].length;var n=Array(e),o=0;for(t=0;t<r;t++)for(var i=arguments[t],s=0,c=i.length;s<c;s++,o++)n[o]=i[s];return n};Object.defineProperty(e,"__esModule",{value:!0});var p=I,s=require("atma-utils"),c=_,u=m,h=C,y=z,g=x,r=U,a=w,n=M,o=function(){function i(e){if(e instanceof i)return e;null!=e&&"/"!==e?("string"==typeof e&&"/"!==e[e.length-1]&&(p.logger.warn("@ directory path should end with slash. Adding...",e),!1===/\.\w+$/.test(e)&&(e+="/")),this.uri=y.path_getUri(e),delete this.uri.file):this.uri=n.Env.currentDir}return i.prototype.exists=function(){return c.dir_exists(d(this.uri))},i.exists=function(e){return new i(e).exists()},i.prototype.existsAsync=function(){return l(this,function(e,t,r){c.dir_existsAsync(r,f(e))})},i.existsAsync=function(e){return new i(e).existsAsync()},i.prototype.ensure=function(){return c.dir_ensure(d(this.uri)),this},i.ensure=function(e){return new i(e).ensure()},i.prototype.ensureAsync=function(){return l(this,function(e,t,r){c.dir_ensureAsync(r,f(e,t))})},i.ensureAsync=function(e){return new i(e).ensureAsync()},i.prototype.readFiles=function(e,t){var r=this,n=u.glob_parsePatterns(e),o=u.glob_parsePatterns(t),i=this.files=c.dir_files(d(this.uri),n,o).map(function(e){return new h.File(r.uri.combine(e))});return Object.defineProperty(i,"files",{get:function(){return console.log("Warn: obsolete. io.Directory::readFiles returns now the array of files"),a.stack_formatCaller(),i}}),i},i.readFiles=function(e,t,r){return new i(e).readFiles(t,r)},i.prototype.read=function(e,t){var r=this,n=u.glob_parsePatterns(e),o=u.glob_parsePatterns(t);return c.dir_files(d(this.uri),n,o,{directories:!0}).map(function(e){var t=r.uri.combine(e);return"/"===e[e.length-1]?new i(t):new h.File(t)})},i.read=function(e,t,r){return new i(e).read(t,r)},i.prototype.readFilesAsync=function(e,t){var o=u.glob_parsePatterns(e);u.glob_parsePatterns(t);return l(this,function(r,n,e){c.dir_filesAsync(e,o,t,function(e,t){e?r.reject(e):(n.files=t.map(function(e){var t=new s.class_Uri(e);return t.isRelative()&&(t=n.uri.combine(e)),new h.File(t)}),r.resolve(n.files))})})},i.readFilesAsync=function(e,t,r){return new i(e).readFilesAsync(t,r)},i.prototype.readAsync=function(e,t){var r=u.glob_parsePatterns(e);u.glob_parsePatterns(t);return l(this,function(n,o,e){c.dir_filesAsync(e,r,t,{directories:!0},function(e,t){if(e)n.reject(e);else{var r=t.map(function(e){var t=o.uri.combine(e);return"/"===e[e.length-1]?new i(t):new h.File(t)});n.resolve(r,o)}})})},i.readAsync=function(e,t,r){return new i(e).readAsync(t,r)},i.prototype.copyTo=function(e,i){void 0===i&&(i={verbose:!1});var s=new p.Class.Deferred;!1===Array.isArray(this.files)&&this.readFiles();var c=this.uri,u=y.path_getUri(e),a=this.files,l=a.length,f=-1;return function t(){if(++f>=l)s.resolve();else{var r,n=a[f],e=n.uri.toRelativeString(c);if(r=u.combine(e),!0!==i.verbose&&h.File.exists(r)){var o="File already exists: "+e+". Replace? ";g.cli_prompt(o,function(e){e&&n.copyTo(r),t()})}else n.copyTo(r),t()}}(),s},i.copyTo=function(e,t,r){return void 0===r&&(r={verbose:!1}),new i(e).copyTo(t,r)},i.prototype.copyToAsync=function(e,c){void 0===c&&(c={verbose:!1});var t=new p.Class.Deferred;if(!1===Array.isArray(this.files)){var r=this;return this.readFilesAsync().done(function(){r.copyToAsync(e,c).done(t.resolveDelegate()).fail(t.rejectDelegate())}).fail(t.rejectDelegate()),t}for(var u=this.uri,a=y.path_getUri(e),l=this.files,n=l.length,o=-1,i=new p.Class.Await;++o<n;)s(o,i.delegate(null));function s(e,t){var r,n=l[e],o=n.uri.toRelativeString(u);if(r=a.combine(o),!0!==c.verbose&&h.File.exists(r)){var i="File already exists: "+o+". Replace? ";g.cli_prompt(i,function(e){!0===e&&n.copyToAsync(r).done(s).fail(t)})}else n.copyToAsync(r).done(s).fail(t);function s(){t()}}return i.done(t.resolveDelegate()).fail(t.rejectDelegate()),t},i.copyToAsync=function(e,t,r){return void 0===r&&(r={verbose:!1}),new i(e).copyToAsync(t,r)},i.prototype.getName=function(){return/([^\/]+)\/?$/.exec(this.uri.path)[1]},i.prototype.rename=function(e){if(e){var t=this.uri.toLocalFile(),r=t.replace(/[^\/]+\/?$/g,e);p.logger.log("<dir:rename>",t,r),c.dir_rename(t,r)}else p.logger.error("<dir:rename> New Name is not defined")},i.rename=function(e,t){new i(e).rename(t)},i.prototype.renameAsync=function(o){return l(this,function(e,t,r){if(o){var n=r.replace(/[^\/]+\/?$/g,o);c.dir_renameAsync(r,n,f(e))}else e.reject("Name is undefined")})},i.renameAsync=function(e,t){return new i(e).renameAsync(t)},i.prototype.remove=function(){c.dir_remove(d(this.uri))},i.remove=function(e){new i(e).remove()},i.prototype.removeAsync=function(){return l(this,function(e,t,r){c.dir_removeAsync(r,f(e))})},i.removeAsync=function(e){return new i(e).removeAsync()},i.prototype.watch=function(e){r.Watcher.watch(this.uri.toLocalFile(),e)},i.watch=function(e,t){new i(e).watch(t)},i.prototype.unwatch=function(e){r.Watcher.unwatch(this.uri.toLocalFile(),e)},i.unwatch=function(e,t){new i(e).unwatch(t)},i.symlink=c.dir_symlink,i}();function l(e,t){var r=new p.Class.Deferred;return t(r,e,d(e.uri)),r}function f(n){for(var o=[],e=1;e<arguments.length;e++)o[e-1]=arguments[e];return function(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];e?n.reject(e):n.resolve.apply(n,i(o,t))}}function d(e){var t=null==e.protocol||"file"===e.protocol,r=t?e.toLocalDir():null;return!1===t&&((e=new s.class_Uri(e)).file=null,r=e.toString()),r}function v(e){return null!=e&&"object"==typeof e&&e.constructor===Object}e.Directory=o,v(b)&&v(t.exports)?Object.assign(b,t.exports):b=t.exports}(),function(){var e={},t={exports:e};Object.defineProperty(e,"__esModule",{value:!0});var o=m,i=b;function r(e){return null!=e&&"object"==typeof e&&e.constructor===Object}e.Glob={matchPath:o.glob_matchPath,readFiles:function(e){var t=o.glob_getStrictPath(e),r=o.glob_getRelativePath(e);return new i.Directory(t).readFiles(r)},read:function(e){var t=o.glob_getStrictPath(e),r=o.glob_getRelativePath(e);return new i.Directory(t).read(r)},readAsync:function(e,r){var t=o.glob_getStrictPath(e),n=o.glob_getRelativePath(e);return new i.Directory(t).readAsync(n).done(function(e,t){r(null,e,t)}).fail(function(e){r(e)})}},r(n)&&r(t.exports)?Object.assign(n,t.exports):n=t.exports}(),function(){var e={},t={exports:e};Object.defineProperty(e,"__esModule",{value:!0});var r=C;function n(e){return null!=e&&"object"==typeof e&&e.constructor===Object}e.setSettings=function(e){e.extensions&&r.File.registerExtensions(e.extensions,!0)},n(o)&&n(t.exports)?Object.assign(o,t.exports):o=t.exports}();var e=I,t=M,r=U,u=n,a=C,l=b,f=o,y=require("atma-utils");e.io.env=t.Env,e.io.watcher=r.Watcher,e.io.glob=u.Glob,e.io.File=a.File,e.io.Uri=y.class_Uri,e.io.Directory=l.Directory,e.io.settings=f.setSettings,null==e.global.io&&(e.global.io=e.io),module.exports=e.io}();
\No newline at end of file