fable 2.0.5 → 3.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/fable.min.js CHANGED
@@ -1,58 +1,106 @@
1
- !function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).Fable=e()}}((function(){return function e(t,o,r){function n(s,a){if(!o[s]){if(!t[s]){var l="function"==typeof require&&require;if(!a&&l)return l(s,!0);if(i)return i(s,!0);var u=new Error("Cannot find module '"+s+"'");throw u.code="MODULE_NOT_FOUND",u}var g=o[s]={exports:{}};t[s][0].call(g.exports,(function(e){return n(t[s][1][e]||e)}),g,g.exports,e,t,o,r)}return o[s].exports}for(var i="function"==typeof require&&require,s=0;s<r.length;s++)n(r[s]);return n}({1:[function(e,t,o){
2
- /**
3
- * Base Logger Class
4
- *
5
- * @license MIT
6
- *
7
- * @author Steven Velozo <steven@velozo.com>
8
- */
9
- const r=new(e("fable-uuid").FableUUID);t.exports=class{constructor(e,t){this._Settings=e,this.loggerUUID=r.getUUID()}initialize(){}trace(e,t){this.write("trace",e,t)}debug(e,t){this.write("debug",e,t)}info(e,t){this.write("info",e,t)}warn(e,t){this.write("warn",e,t)}error(e,t){this.write("error",e,t)}fatal(e,t){this.write("fatal",e,t)}write(e,t,o){return!0}}},{"fable-uuid":9}],2:[function(e,t,o){
10
- /**
11
- * Default Logger Provider Function --- Browser
12
- *
13
- * @license MIT
14
- *
15
- * @author Steven Velozo <steven@velozo.com>
16
- */
17
- getDefaultProviders=()=>{let t={};return t.console=e("./Fable-Log-Logger-Console.js"),t.default=t.console,t},t.exports=getDefaultProviders()},{"./Fable-Log-Logger-Console.js":4}],3:[function(e,t,o){t.exports=[{loggertype:"console",streamtype:"console",level:"trace"}]},{}],4:[function(e,t,o){let r=e("./Fable-Log-BaseLogger.js");t.exports=class extends r{constructor(e,t){super(e),this._ShowTimeStamps=!!e.hasOwnProperty("ShowTimeStamps")&&1==e.ShowTimeStamps,this._FormattedTimeStamps=!!e.hasOwnProperty("FormattedTimeStamps")&&1==e.FormattedTimeStamps,this._ContextMessage=e.hasOwnProperty("Context")?` (${e.Context})`:t._Settings.hasOwnProperty("Product")?` (${t._Settings.Product})`:""}write(e,t,o){if(this._ShowTimeStamps&&this._FormattedTimeStamps){let o=(new Date).toISOString();console.log(`${o} [${e}]${this._ContextMessage} ${t}`)}else if(this._ShowTimeStamps){let o=+new Date;console.log(`${o} [${e}]${this._ContextMessage} ${t}`)}else console.log(`[${e}]${this._ContextMessage} ${t}`);void 0!==o&&console.log(JSON.stringify(o,null,4))}}},{"./Fable-Log-BaseLogger.js":1}],5:[function(e,t,o){
18
- /**
19
- * Fable Logging Add-on
20
- *
21
- * @license MIT
22
- *
23
- * @author Steven Velozo <steven@velozo.com>
24
- * @module Fable Logger
25
- */
26
- class r{constructor(t,o){let r="object"==typeof t?t:{};this._Settings=r,this._Providers=e("./Fable-Log-DefaultProviders.js"),this._StreamDefinitions=r.hasOwnProperty("LogStreams")?r.LogStreams:e("./Fable-Log-DefaultStreams.json"),this.logStreams=[],this.logProviders={},this.activeLogStreams={},this.logStreamsTrace=[],this.logStreamsDebug=[],this.logStreamsInfo=[],this.logStreamsWarn=[],this.logStreamsError=[],this.logStreamsFatal=[],this.datumDecorator=e=>e,this.uuid="string"==typeof r.Product?r.Product:"Default"}addLogger(e,t){if(this.activeLogStreams.hasOwnProperty(e.loggerUUID))return!1;switch(this.logStreams.push(e),this.activeLogStreams[e.loggerUUID]=!0,t){case"trace":this.logStreamsTrace.push(e);case"debug":this.logStreamsDebug.push(e);case"info":this.logStreamsInfo.push(e);case"warn":this.logStreamsWarn.push(e);case"error":this.logStreamsError.push(e);case"fatal":this.logStreamsFatal.push(e)}return!0}setDatumDecorator(e){this.datumDecorator="function"==typeof e?e:e=>e}trace(e,t){const o=this.datumDecorator(t);for(let t=0;t<this.logStreamsTrace.length;t++)this.logStreamsTrace[t].trace(e,o)}debug(e,t){const o=this.datumDecorator(t);for(let t=0;t<this.logStreamsDebug.length;t++)this.logStreamsDebug[t].debug(e,o)}info(e,t){const o=this.datumDecorator(t);for(let t=0;t<this.logStreamsInfo.length;t++)this.logStreamsInfo[t].info(e,o)}warn(e,t){const o=this.datumDecorator(t);for(let t=0;t<this.logStreamsWarn.length;t++)this.logStreamsWarn[t].warn(e,o)}error(e,t){const o=this.datumDecorator(t);for(let t=0;t<this.logStreamsError.length;t++)this.logStreamsError[t].error(e,o)}fatal(e,t){const o=this.datumDecorator(t);for(let t=0;t<this.logStreamsFatal.length;t++)this.logStreamsFatal[t].fatal(e,o)}initialize(){for(let e=0;e<this._StreamDefinitions.length;e++){let t=Object.assign({loggertype:"default",streamtype:"console",level:"info"},this._StreamDefinitions[e]);this._Providers.hasOwnProperty(t.loggertype)?this.addLogger(new this._Providers[t.loggertype](t,this),t.level):console.log(`Error initializing log stream: bad loggertype in stream definition ${JSON.stringify(t)}`)}for(let e=0;e<this.logStreams.length;e++)this.logStreams[e].initialize()}logTime(e,t){let o=void 0!==e?e:"Time",r=new Date;this.info(`${o} ${r} (epoch ${+r})`,t)}getTimeStamp(){return+new Date}getTimeDelta(e){return+new Date-e}logTimeDelta(e,t,o){let r=void 0!==t?t:"Time Measurement",n=+new Date;this.info(`${r} logged at (epoch ${+n}) took (${e}ms)`,o)}logTimeDeltaHuman(e,t,o){let r=void 0!==t?t:"Time Measurement",n=+new Date,i=parseInt(e%1e3),s=parseInt(e/1e3%60),a=parseInt(e/6e4%60),l=parseInt(e/36e5);i=i<10?"00"+i:i<100?"0"+i:i,s=s<10?"0"+s:s,a=a<10?"0"+a:a,l=l<10?"0"+l:l,this.info(`${r} logged at (epoch ${+n}) took (${e}ms) or (${l}:${a}:${s}.${i})`,o)}logTimeDeltaRelative(e,t,o){this.logTimeDelta(this.getTimeDelta(e),t,o)}logTimeDeltaRelativeHuman(e,t,o){this.logTimeDeltaHuman(this.getTimeDelta(e),t,o)}}t.exports={new:function(e){return new r(e)},FableLog:r}},{"./Fable-Log-DefaultProviders.js":2,"./Fable-Log-DefaultStreams.json":3}],6:[function(e,t,o){t.exports={Product:"ApplicationNameHere",ProductVersion:"0.0.0",ConfigFile:!1,LogStreams:[{level:"trace"}]}},{}],7:[function(e,t,o){(function(o){(function(){
27
- /**
28
- * Fable Settings Add-on
29
- *
30
- * @license MIT
31
- *
32
- * @author Steven Velozo <steven@velozo.com>
33
- * @module Fable Settings
34
- */
35
- const r=e("match-all");class n{constructor(t){this.default=this.buildDefaultSettings();let o=this.merge(t,this.buildDefaultSettings());if(this._PerformEnvTemplating=!o||!0!==o.NoEnvReplacement,this.base=JSON.parse(JSON.stringify(o)),o.DefaultConfigFile)try{o=this.merge(e(o.DefaultConfigFile),o)}catch(e){console.log("Fable-Settings Warning: Default configuration file specified but there was a problem loading it. Falling back to base."),console.log(" Loading Exception: "+e)}if(o.ConfigFile)try{o=this.merge(e(o.ConfigFile),o)}catch(e){console.log("Fable-Settings Warning: Configuration file specified but there was a problem loading it. Falling back to base."),console.log(" Loading Exception: "+e)}this.settings=o}buildDefaultSettings(){return JSON.parse(JSON.stringify(e("./Fable-Settings-Default")))}_resolveEnv(e){for(const t in e){const n=e[t];if("object"==typeof n)this._resolveEnv(n);else if("string"==typeof n&&n.indexOf("${")>=0){r(n,/\$\{(.*?)\}/g).toArray().forEach((r=>{const n=r.split("|");let i=o.env[n[0]]||"";!i&&n.length>1&&(i=n[1]),e[t]=e[t].replace("${"+r+"}",i)}))}}}_isObject(e){return"object"==typeof e&&!Array.isArray(e)}_deepMergeObjects(e,t){if(t&&this._isObject(t))return Object.keys(t).forEach((o=>{const r=t[o];if(this._isObject(r)){const t=e[o];if(t&&this._isObject(t))return void this._deepMergeObjects(t,r)}e[o]=r})),e}merge(e,t){let o="object"==typeof e?e:{},r="object"==typeof t?t:this.settings,n=JSON.parse(JSON.stringify(o));return r=this._deepMergeObjects(r,n),this._PerformEnvTemplating&&this._resolveEnv(r),r}fill(e){let t="object"==typeof e?e:{},o=JSON.parse(JSON.stringify(t));return this.settings=this._deepMergeObjects(o,this.settings),this.settings}}t.exports={new:function(e){return new n(e)},FableSettings:n}}).call(this)}).call(this,e("_process"))},{"./Fable-Settings-Default":6,_process:11,"match-all":10}],8:[function(e,t,o){t.exports=
36
- /**
37
- * Random Byte Generator - Browser version
38
- *
39
- * @license MIT
40
- *
41
- * @author Steven Velozo <steven@velozo.com>
42
- */
43
- class{constructor(){this.getRandomValues="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof window.msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto)}generateWhatWGBytes(){let e=new Uint8Array(16);return this.getRandomValues(e),e}generateRandomBytes(){let e=new Uint8Array(16);for(let t,o=0;o<16;o++)0==(3&o)&&(t=4294967296*Math.random()),e[o]=t>>>((3&o)<<3)&255;return e}generate(){return this.getRandomValues?this.generateWhatWGBytes():this.generateRandomBytes()}}},{}],9:[function(e,t,o){
44
- /**
45
- * Fable UUID Generator
46
- *
47
- * @license MIT
48
- *
49
- * @author Steven Velozo <steven@velozo.com>
50
- * @module Fable UUID
51
- */
52
- var r=e("./Fable-UUID-Random.js");class n{constructor(e){this._UUIDModeRandom=!("object"!=typeof e||!e.hasOwnProperty("UUIDModeRandom"))&&1==e.UUIDModeRandom,this._UUIDLength="object"==typeof e&&e.hasOwnProperty("UUIDLength")?e.UUIDLength+0:8,this._UUIDRandomDictionary="object"==typeof e&&e.hasOwnProperty("UUIDDictionary")?e.UUIDDictionary+0:"0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ",this.randomByteGenerator=new r,this._HexLookup=[];for(let e=0;e<256;++e)this._HexLookup[e]=(e+256).toString(16).substr(1)}bytesToUUID(e){let t=0;return[this._HexLookup[e[t++]],this._HexLookup[e[t++]],this._HexLookup[e[t++]],this._HexLookup[e[t++]],"-",this._HexLookup[e[t++]],this._HexLookup[e[t++]],"-",this._HexLookup[e[t++]],this._HexLookup[e[t++]],"-",this._HexLookup[e[t++]],this._HexLookup[e[t++]],"-",this._HexLookup[e[t++]],this._HexLookup[e[t++]],this._HexLookup[e[t++]],this._HexLookup[e[t++]],this._HexLookup[e[t++]],this._HexLookup[e[t++]]].join("")}generateUUIDv4(){new Array(16);var e=this.randomByteGenerator.generate();return e[6]=15&e[6]|64,e[8]=63&e[8]|128,this.bytesToUUID(e)}generateRandom(){let e="";for(let t=0;t<this._UUIDLength;t++)e+=this._UUIDRandomDictionary.charAt(Math.floor(Math.random()*(this._UUIDRandomDictionary.length-1)));return e}getUUID(){return this._UUIDModeRandom?this.generateRandom():this.generateUUIDv4()}}t.exports={new:function(e){return new n(e)},FableUUID:n}},{"./Fable-UUID-Random.js":8}],10:[function(e,t,o){"use strict";t.exports=function(e,t){return{input:e,regex:t,next:function(){var e=this.nextRaw();if(e)for(var t=1;t<e.length;t++)if(e[t])return e[t];return null},nextRaw:function(){return this.regex.exec(this.input)},toArray:function(){for(var e=[],t=null;t=this.next();)e.push(t);return e},reset:function(e){return this.regex.lastIndex=e||0}}}},{}],11:[function(e,t,o){var r,n,i=t.exports={};function s(){throw new Error("setTimeout has not been defined")}function a(){throw new Error("clearTimeout has not been defined")}function l(e){if(r===setTimeout)return setTimeout(e,0);if((r===s||!r)&&setTimeout)return r=setTimeout,setTimeout(e,0);try{return r(e,0)}catch(t){try{return r.call(null,e,0)}catch(t){return r.call(this,e,0)}}}!function(){try{r="function"==typeof setTimeout?setTimeout:s}catch(e){r=s}try{n="function"==typeof clearTimeout?clearTimeout:a}catch(e){n=a}}();var u,g=[],h=!1,c=-1;function f(){h&&u&&(h=!1,u.length?g=u.concat(g):c=-1,g.length&&m())}function m(){if(!h){var e=l(f);h=!0;for(var t=g.length;t;){for(u=g,g=[];++c<t;)u&&u[c].run();c=-1,t=g.length}u=null,h=!1,function(e){if(n===clearTimeout)return clearTimeout(e);if((n===a||!n)&&clearTimeout)return n=clearTimeout,clearTimeout(e);try{n(e)}catch(t){try{return n.call(null,e)}catch(t){return n.call(this,e)}}}(e)}}function p(e,t){this.fun=e,this.array=t}function d(){}i.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var o=1;o<arguments.length;o++)t[o-1]=arguments[o];g.push(new p(e,t)),1!==g.length||h||l(m)},p.prototype.run=function(){this.fun.apply(null,this.array)},i.title="browser",i.browser=!0,i.env={},i.argv=[],i.version="",i.versions={},i.on=d,i.addListener=d,i.once=d,i.off=d,i.removeListener=d,i.removeAllListeners=d,i.emit=d,i.prependListener=d,i.prependOnceListener=d,i.listeners=function(e){return[]},i.binding=function(e){throw new Error("process.binding is not supported")},i.cwd=function(){return"/"},i.chdir=function(e){throw new Error("process.chdir is not supported")},i.umask=function(){return 0}},{}],12:[function(e,t,o){
53
- /**
54
- * @license MIT
55
- * @author <steven@velozo.com>
56
- */
57
- const r=e("fable-settings").FableSettings,n=e("fable-uuid").FableUUID,i=e("fable-log").FableLog;class s{constructor(e){let t=new r(e);this.settingsManager=t,this.libUUID=new n(this.settingsManager.settings),this.log=new i(this.settingsManager.settings),this.log.initialize()}get settings(){return this.settingsManager.settings}get fable(){return this}getUUID(){return this.libUUID.getUUID()}}t.exports={new:function(e){return new s(e)},Fable:s}},{"fable-log":5,"fable-settings":7,"fable-uuid":9}]},{},[12])(12)}));
1
+ !function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).Fable=t()}}((function(){return function t(e,r,n){function s(i,a){if(!r[i]){if(!e[i]){var l="function"==typeof require&&require;if(!a&&l)return l(i,!0);if(o)return o(i,!0);var u=new Error("Cannot find module '"+i+"'");throw u.code="MODULE_NOT_FOUND",u}var h=r[i]={exports:{}};e[i][0].call(h.exports,(function(t){return s(e[i][1][t]||t)}),h,h.exports,t,e,r,n)}return r[i].exports}for(var o="function"==typeof require&&require,i=0;i<n.length;i++)s(n[i]);return s}({1:[function(t,e,r){e.exports=
2
+ /**
3
+ * Base Logger Class
4
+ *
5
+ * @license MIT
6
+ *
7
+ * @author Steven Velozo <steven@velozo.com>
8
+ */
9
+ class{constructor(t,e){this._Settings=t,this.loggerUUID=this.generateInsecureUUID()}generateInsecureUUID(){let t=(new Date).getTime();return"LOGSTREAM-xxxxxx-yxxxxx".replace(/[xy]/g,(e=>{let r=(t+16*Math.random())%16|0;return t=Math.floor(t/16),("x"==e?r:3&r|8).toString(16)}))}initialize(){}trace(t,e){this.write("trace",t,e)}debug(t,e){this.write("debug",t,e)}info(t,e){this.write("info",t,e)}warn(t,e){this.write("warn",t,e)}error(t,e){this.write("error",t,e)}fatal(t,e){this.write("fatal",t,e)}write(t,e,r){return!0}}},{}],2:[function(t,e,r){
10
+ /**
11
+ * Default Logger Provider Function
12
+ *
13
+ * @license MIT
14
+ *
15
+ * @author Steven Velozo <steven@velozo.com>
16
+ */
17
+ getDefaultProviders=()=>{let e={};return e.console=t("./Fable-Log-Logger-Console.js"),e.default=e.console,e},e.exports=getDefaultProviders()},{"./Fable-Log-Logger-Console.js":4}],3:[function(t,e,r){e.exports=[{loggertype:"console",streamtype:"console",level:"trace"}]},{}],4:[function(t,e,r){let n=t("./Fable-Log-BaseLogger.js");e.exports=class extends n{constructor(t,e){super(t),this._ShowTimeStamps=!!t.hasOwnProperty("ShowTimeStamps")&&1==t.ShowTimeStamps,this._FormattedTimeStamps=!!t.hasOwnProperty("FormattedTimeStamps")&&1==t.FormattedTimeStamps,this._ContextMessage=t.hasOwnProperty("Context")?` (${t.Context})`:e._Settings.hasOwnProperty("Product")?` (${e._Settings.Product})`:""}write(t,e,r){if(this._ShowTimeStamps&&this._FormattedTimeStamps){let r=(new Date).toISOString();console.log(`${r} [${t}]${this._ContextMessage} ${e}`)}else if(this._ShowTimeStamps){let r=+new Date;console.log(`${r} [${t}]${this._ContextMessage} ${e}`)}else console.log(`[${t}]${this._ContextMessage} ${e}`);void 0!==r&&console.log(JSON.stringify(r,null,4))}}},{"./Fable-Log-BaseLogger.js":1}],5:[function(t,e,r){
18
+ /**
19
+ * Fable Logging Add-on
20
+ *
21
+ * @license MIT
22
+ *
23
+ * @author Steven Velozo <steven@velozo.com>
24
+ * @module Fable Logger
25
+ */
26
+ class n{constructor(e,r){let n="object"==typeof e?e:{};this._Settings=n,this._Providers=t("./Fable-Log-DefaultProviders.js"),this._StreamDefinitions=n.hasOwnProperty("LogStreams")?n.LogStreams:t("./Fable-Log-DefaultStreams.json"),this.logStreams=[],this.logProviders={},this.activeLogStreams={},this.logStreamsTrace=[],this.logStreamsDebug=[],this.logStreamsInfo=[],this.logStreamsWarn=[],this.logStreamsError=[],this.logStreamsFatal=[],this.datumDecorator=t=>t,this.uuid="string"==typeof n.Product?n.Product:"Default"}addLogger(t,e){if(this.activeLogStreams.hasOwnProperty(t.loggerUUID))return!1;switch(this.logStreams.push(t),this.activeLogStreams[t.loggerUUID]=!0,e){case"trace":this.logStreamsTrace.push(t);case"debug":this.logStreamsDebug.push(t);case"info":this.logStreamsInfo.push(t);case"warn":this.logStreamsWarn.push(t);case"error":this.logStreamsError.push(t);case"fatal":this.logStreamsFatal.push(t)}return!0}setDatumDecorator(t){this.datumDecorator="function"==typeof t?t:t=>t}trace(t,e){const r=this.datumDecorator(e);for(let e=0;e<this.logStreamsTrace.length;e++)this.logStreamsTrace[e].trace(t,r)}debug(t,e){const r=this.datumDecorator(e);for(let e=0;e<this.logStreamsDebug.length;e++)this.logStreamsDebug[e].debug(t,r)}info(t,e){const r=this.datumDecorator(e);for(let e=0;e<this.logStreamsInfo.length;e++)this.logStreamsInfo[e].info(t,r)}warn(t,e){const r=this.datumDecorator(e);for(let e=0;e<this.logStreamsWarn.length;e++)this.logStreamsWarn[e].warn(t,r)}error(t,e){const r=this.datumDecorator(e);for(let e=0;e<this.logStreamsError.length;e++)this.logStreamsError[e].error(t,r)}fatal(t,e){const r=this.datumDecorator(e);for(let e=0;e<this.logStreamsFatal.length;e++)this.logStreamsFatal[e].fatal(t,r)}initialize(){for(let t=0;t<this._StreamDefinitions.length;t++){let e=Object.assign({loggertype:"default",streamtype:"console",level:"info"},this._StreamDefinitions[t]);this._Providers.hasOwnProperty(e.loggertype)?this.addLogger(new this._Providers[e.loggertype](e,this),e.level):console.log(`Error initializing log stream: bad loggertype in stream definition ${JSON.stringify(e)}`)}for(let t=0;t<this.logStreams.length;t++)this.logStreams[t].initialize()}logTime(t,e){let r=void 0!==t?t:"Time",n=new Date;this.info(`${r} ${n} (epoch ${+n})`,e)}getTimeStamp(){return+new Date}getTimeDelta(t){return+new Date-t}logTimeDelta(t,e,r){let n=void 0!==e?e:"Time Measurement",s=+new Date;this.info(`${n} logged at (epoch ${+s}) took (${t}ms)`,r)}logTimeDeltaHuman(t,e,r){let n=void 0!==e?e:"Time Measurement",s=+new Date,o=parseInt(t%1e3),i=parseInt(t/1e3%60),a=parseInt(t/6e4%60),l=parseInt(t/36e5);o=o<10?"00"+o:o<100?"0"+o:o,i=i<10?"0"+i:i,a=a<10?"0"+a:a,l=l<10?"0"+l:l,this.info(`${n} logged at (epoch ${+s}) took (${t}ms) or (${l}:${a}:${i}.${o})`,r)}logTimeDeltaRelative(t,e,r){this.logTimeDelta(this.getTimeDelta(t),e,r)}logTimeDeltaRelativeHuman(t,e,r){this.logTimeDeltaHuman(this.getTimeDelta(t),e,r)}}e.exports={new:function(t){return new n(t)},FableLog:n}},{"./Fable-Log-DefaultProviders.js":2,"./Fable-Log-DefaultStreams.json":3}],6:[function(t,e,r){e.exports={Product:"ApplicationNameHere",ProductVersion:"0.0.0",ConfigFile:!1,LogStreams:[{level:"trace"}]}},{}],7:[function(t,e,r){(function(t){(function(){e.exports=
27
+ /**
28
+ * Fable Settings Template Processor
29
+ *
30
+ * This class allows environment variables to come in via templated expressions, and defaults to be set.
31
+ *
32
+ * @license MIT
33
+ *
34
+ * @author Steven Velozo <steven@velozo.com>
35
+ * @module Fable Settings
36
+ */
37
+ class{constructor(e){this.templateProcessor=new e.precedent,this.templateProcessor.addPattern("${","}",(e=>{let r=e.trim(),n=r.indexOf("|"),s=r.substring(n+1),o=n>-1?r.substring(0,n):r;return t.env.hasOwnProperty(o)?t.env[o]:s}))}parseSetting(t){return this.templateProcessor.parseString(t)}}}).call(this)}).call(this,t("_process"))},{_process:14}],8:[function(t,e,r){
38
+ /**
39
+ * Fable Settings Add-on
40
+ *
41
+ * @license MIT
42
+ *
43
+ * @author Steven Velozo <steven@velozo.com>
44
+ * @module Fable Settings
45
+ */
46
+ const n=t("precedent"),s=t("./Fable-Settings-TemplateProcessor.js");class o{constructor(e){this.dependencies={precedent:n},this.settingsTemplateProcessor=new s(this.dependencies),this._configureEnvTemplating(e),this.default=this.buildDefaultSettings();let r=this.merge(e,this.buildDefaultSettings());if(this.base=JSON.parse(JSON.stringify(r)),r.DefaultConfigFile)try{r=this.merge(t(r.DefaultConfigFile),r)}catch(t){console.log("Fable-Settings Warning: Default configuration file specified but there was a problem loading it. Falling back to base."),console.log(" Loading Exception: "+t)}if(r.ConfigFile)try{r=this.merge(t(r.ConfigFile),r)}catch(t){console.log("Fable-Settings Warning: Configuration file specified but there was a problem loading it. Falling back to base."),console.log(" Loading Exception: "+t)}this.settings=r}buildDefaultSettings(){return JSON.parse(JSON.stringify(t("./Fable-Settings-Default")))}_configureEnvTemplating(t){this._PerformEnvTemplating=!t||!0!==t.NoEnvReplacement}_resolveEnv(t){for(const e in t)"object"==typeof t[e]?this._resolveEnv(t[e]):"string"==typeof t[e]&&(t[e]=this.settingsTemplateProcessor.parseSetting(t[e]))}_isObject(t){return"object"==typeof t&&!Array.isArray(t)}_deepMergeObjects(t,e){if(e&&this._isObject(e))return Object.keys(e).forEach((r=>{const n=e[r];if(this._isObject(n)){const e=t[r];if(e&&this._isObject(e))return void this._deepMergeObjects(e,n)}t[r]=n})),t}merge(t,e){let r="object"==typeof t?t:{},n="object"==typeof e?e:this.settings,s=JSON.parse(JSON.stringify(r));return n=this._deepMergeObjects(n,s),this._PerformEnvTemplating&&this._resolveEnv(n),this._configureEnvTemplating(n),n}fill(t){let e="object"==typeof t?t:{},r=JSON.parse(JSON.stringify(e));return this.settings=this._deepMergeObjects(r,this.settings),this.settings}}e.exports={new:function(t){return new o(t)},FableSettings:o}},{"./Fable-Settings-Default":6,"./Fable-Settings-TemplateProcessor.js":7,precedent:11}],9:[function(t,e,r){e.exports=
47
+ /**
48
+ * Random Byte Generator - Browser version
49
+ *
50
+ * @license MIT
51
+ *
52
+ * @author Steven Velozo <steven@velozo.com>
53
+ */
54
+ class{constructor(){this.getRandomValues="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof window.msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto)}generateWhatWGBytes(){let t=new Uint8Array(16);return this.getRandomValues(t),t}generateRandomBytes(){let t=new Uint8Array(16);for(let e,r=0;r<16;r++)0==(3&r)&&(e=4294967296*Math.random()),t[r]=e>>>((3&r)<<3)&255;return t}generate(){return this.getRandomValues?this.generateWhatWGBytes():this.generateRandomBytes()}}},{}],10:[function(t,e,r){
55
+ /**
56
+ * Fable UUID Generator
57
+ *
58
+ * @license MIT
59
+ *
60
+ * @author Steven Velozo <steven@velozo.com>
61
+ * @module Fable UUID
62
+ */
63
+ var n=t("./Fable-UUID-Random.js");class s{constructor(t){this._UUIDModeRandom=!("object"!=typeof t||!t.hasOwnProperty("UUIDModeRandom"))&&1==t.UUIDModeRandom,this._UUIDLength="object"==typeof t&&t.hasOwnProperty("UUIDLength")?t.UUIDLength+0:8,this._UUIDRandomDictionary="object"==typeof t&&t.hasOwnProperty("UUIDDictionary")?t.UUIDDictionary+0:"0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ",this.randomByteGenerator=new n,this._HexLookup=[];for(let t=0;t<256;++t)this._HexLookup[t]=(t+256).toString(16).substr(1)}bytesToUUID(t){let e=0;return[this._HexLookup[t[e++]],this._HexLookup[t[e++]],this._HexLookup[t[e++]],this._HexLookup[t[e++]],"-",this._HexLookup[t[e++]],this._HexLookup[t[e++]],"-",this._HexLookup[t[e++]],this._HexLookup[t[e++]],"-",this._HexLookup[t[e++]],this._HexLookup[t[e++]],"-",this._HexLookup[t[e++]],this._HexLookup[t[e++]],this._HexLookup[t[e++]],this._HexLookup[t[e++]],this._HexLookup[t[e++]],this._HexLookup[t[e++]]].join("")}generateUUIDv4(){new Array(16);var t=this.randomByteGenerator.generate();return t[6]=15&t[6]|64,t[8]=63&t[8]|128,this.bytesToUUID(t)}generateRandom(){let t="";for(let e=0;e<this._UUIDLength;e++)t+=this._UUIDRandomDictionary.charAt(Math.floor(Math.random()*(this._UUIDRandomDictionary.length-1)));return t}getUUID(){return this._UUIDModeRandom?this.generateRandom():this.generateUUIDv4()}}e.exports={new:function(t){return new s(t)},FableUUID:s}},{"./Fable-UUID-Random.js":9}],11:[function(t,e,r){
64
+ /**
65
+ * Precedent Meta-Templating
66
+ *
67
+ * @license MIT
68
+ *
69
+ * @author Steven Velozo <steven@velozo.com>
70
+ *
71
+ * @description Process text streams, parsing out meta-template expressions.
72
+ */
73
+ var n=t("./WordTree.js"),s=t("./StringParser.js");e.exports=class{constructor(){this.WordTree=new n,this.StringParser=new s,this.ParseTree=this.WordTree.ParseTree}addPattern(t,e,r){return this.WordTree.addPattern(t,e,r)}parseString(t){return this.StringParser.parseString(t,this.ParseTree)}}},{"./StringParser.js":12,"./WordTree.js":13}],12:[function(t,e,r){e.exports=
74
+ /**
75
+ * String Parser
76
+ *
77
+ * @license MIT
78
+ *
79
+ * @author Steven Velozo <steven@velozo.com>
80
+ *
81
+ * @description Parse a string, properly processing each matched token in the word tree.
82
+ */
83
+ class{constructor(){}newParserState(t){return{ParseTree:t,Output:"",OutputBuffer:"",Pattern:!1,PatternMatch:!1,PatternMatchOutputBuffer:""}}assignNode(t,e){e.PatternMatch=t,e.PatternMatch.hasOwnProperty("PatternEnd")&&(e.Pattern=e.PatternMatch)}appendOutputBuffer(t,e){e.OutputBuffer+=t}flushOutputBuffer(t){t.Output+=t.OutputBuffer,t.OutputBuffer=""}checkPatternEnd(t){t.OutputBuffer.length>=t.Pattern.PatternEnd.length+t.Pattern.PatternStart.length&&t.OutputBuffer.substr(-t.Pattern.PatternEnd.length)===t.Pattern.PatternEnd&&(t.OutputBuffer=t.Pattern.Parse(t.OutputBuffer.substr(t.Pattern.PatternStart.length,t.OutputBuffer.length-(t.Pattern.PatternStart.length+t.Pattern.PatternEnd.length))),this.flushOutputBuffer(t),t.Pattern=!1,t.PatternMatch=!1)}parseCharacter(t,e){!e.PatternMatch&&e.ParseTree.hasOwnProperty(t)?(this.assignNode(e.ParseTree[t],e),this.appendOutputBuffer(t,e)):e.PatternMatch?(e.PatternMatch.hasOwnProperty(t)&&this.assignNode(e.PatternMatch[t],e),this.appendOutputBuffer(t,e),e.Pattern&&this.checkPatternEnd(e)):e.Output+=t}parseString(t,e){let r=this.newParserState(e);for(var n=0;n<t.length;n++)this.parseCharacter(t[n],r);return this.flushOutputBuffer(r),r.Output}}},{}],13:[function(t,e,r){e.exports=
84
+ /**
85
+ * Word Tree
86
+ *
87
+ * @license MIT
88
+ *
89
+ * @author Steven Velozo <steven@velozo.com>
90
+ *
91
+ * @description Create a tree (directed graph) of Javascript objects, one character per object.
92
+ */
93
+ class{constructor(){this.ParseTree={}}addChild(t,e,r){return t.hasOwnProperty(e[r])||(t[e[r]]={}),t[e[r]]}addPattern(t,e,r){if(t.length<1)return!1;if("string"==typeof e&&e.length<1)return!1;let n=this.ParseTree;for(var s=0;s<t.length;s++)n=this.addChild(n,t,s);return n.PatternStart=t,n.PatternEnd="string"==typeof e&&e.length>0?e:t,n.Parse="function"==typeof r?r:"string"==typeof r?()=>r:t=>t,!0}}},{}],14:[function(t,e,r){var n,s,o=e.exports={};function i(){throw new Error("setTimeout has not been defined")}function a(){throw new Error("clearTimeout has not been defined")}function l(t){if(n===setTimeout)return setTimeout(t,0);if((n===i||!n)&&setTimeout)return n=setTimeout,setTimeout(t,0);try{return n(t,0)}catch(e){try{return n.call(null,t,0)}catch(e){return n.call(this,t,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:i}catch(t){n=i}try{s="function"==typeof clearTimeout?clearTimeout:a}catch(t){s=a}}();var u,h=[],g=!1,c=-1;function f(){g&&u&&(g=!1,u.length?h=u.concat(h):c=-1,h.length&&p())}function p(){if(!g){var t=l(f);g=!0;for(var e=h.length;e;){for(u=h,h=[];++c<e;)u&&u[c].run();c=-1,e=h.length}u=null,g=!1,function(t){if(s===clearTimeout)return clearTimeout(t);if((s===a||!s)&&clearTimeout)return s=clearTimeout,clearTimeout(t);try{return s(t)}catch(e){try{return s.call(null,t)}catch(e){return s.call(this,t)}}}(t)}}function d(t,e){this.fun=t,this.array=e}function m(){}o.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)e[r-1]=arguments[r];h.push(new d(t,e)),1!==h.length||g||l(p)},d.prototype.run=function(){this.fun.apply(null,this.array)},o.title="browser",o.browser=!0,o.env={},o.argv=[],o.version="",o.versions={},o.on=m,o.addListener=m,o.once=m,o.off=m,o.removeListener=m,o.removeAllListeners=m,o.emit=m,o.prependListener=m,o.prependOnceListener=m,o.listeners=function(t){return[]},o.binding=function(t){throw new Error("process.binding is not supported")},o.cwd=function(){return"/"},o.chdir=function(t){throw new Error("process.chdir is not supported")},o.umask=function(){return 0}},{}],15:[function(t,e,r){
94
+ /**
95
+ * Simple browser shim loader - assign the npm module to a window global automatically
96
+ *
97
+ * @license MIT
98
+ * @author <steven@velozo.com>
99
+ */
100
+ var n=t("./Fable.js");"object"!=typeof window||window.hasOwnProperty("Fable")||(window.Fable=n),e.exports=n},{"./Fable.js":16}],16:[function(t,e,r){
101
+ /**
102
+ * @license MIT
103
+ * @author <steven@velozo.com>
104
+ */
105
+ const n=t("fable-settings").FableSettings,s=t("fable-uuid").FableUUID,o=t("fable-log").FableLog;class i{constructor(t){let e=new n(t);this.settingsManager=e,this.libUUID=new s(this.settingsManager.settings),this.log=new o(this.settingsManager.settings),this.log.initialize()}get settings(){return this.settingsManager.settings}get fable(){return this}getUUID(){return this.libUUID.getUUID()}}e.exports=i},{"fable-log":5,"fable-settings":8,"fable-uuid":10}]},{},[15])(15)}));
58
106
  //# sourceMappingURL=fable.min.js.map