pict 1.0.81 → 1.0.83

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.
@@ -1,6 +1,6 @@
1
1
  "use strict";function _toConsumableArray(arr){return _arrayWithoutHoles(arr)||_iterableToArray(arr)||_unsupportedIterableToArray(arr)||_nonIterableSpread();}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}function _unsupportedIterableToArray(o,minLen){if(!o)return;if(typeof o==="string")return _arrayLikeToArray(o,minLen);var n=Object.prototype.toString.call(o).slice(8,-1);if(n==="Object"&&o.constructor)n=o.constructor.name;if(n==="Map"||n==="Set")return Array.from(o);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return _arrayLikeToArray(o,minLen);}function _iterableToArray(iter){if(typeof Symbol!=="undefined"&&iter[Symbol.iterator]!=null||iter["@@iterator"]!=null)return Array.from(iter);}function _arrayWithoutHoles(arr){if(Array.isArray(arr))return _arrayLikeToArray(arr);}function _arrayLikeToArray(arr,len){if(len==null||len>arr.length)len=arr.length;for(var i=0,arr2=new Array(len);i<len;i++)arr2[i]=arr[i];return arr2;}function _defineProperty2(obj,key,value){key=_toPropertyKey2(key);if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true});}else{obj[key]=value;}return obj;}function _get(){if(typeof Reflect!=="undefined"&&Reflect.get){_get=Reflect.get.bind();}else{_get=function _get(target,property,receiver){var base=_superPropBase(target,property);if(!base)return;var desc=Object.getOwnPropertyDescriptor(base,property);if(desc.get){return desc.get.call(arguments.length<3?target:receiver);}return desc.value;};}return _get.apply(this,arguments);}function _superPropBase(object,property){while(!Object.prototype.hasOwnProperty.call(object,property)){object=_getPrototypeOf(object);if(object===null)break;}return object;}function _classCallCheck2(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,_toPropertyKey2(descriptor.key),descriptor);}}function _createClass2(Constructor,protoProps,staticProps){if(protoProps)_defineProperties(Constructor.prototype,protoProps);if(staticProps)_defineProperties(Constructor,staticProps);Object.defineProperty(Constructor,"prototype",{writable:false});return Constructor;}function _toPropertyKey2(arg){var key=_toPrimitive2(arg,"string");return _typeof(key)==="symbol"?key:String(key);}function _toPrimitive2(input,hint){if(_typeof(input)!=="object"||input===null)return input;var prim=input[Symbol.toPrimitive];if(prim!==undefined){var res=prim.call(input,hint||"default");if(_typeof(res)!=="object")return res;throw new TypeError("@@toPrimitive must return a primitive value.");}return(hint==="string"?String:Number)(input);}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function");}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:true,configurable:true}});Object.defineProperty(subClass,"prototype",{writable:false});if(superClass)_setPrototypeOf(subClass,superClass);}function _setPrototypeOf(o,p){_setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function _setPrototypeOf(o,p){o.__proto__=p;return o;};return _setPrototypeOf(o,p);}function _createSuper(Derived){var hasNativeReflectConstruct=_isNativeReflectConstruct();return function _createSuperInternal(){var Super=_getPrototypeOf(Derived),result;if(hasNativeReflectConstruct){var NewTarget=_getPrototypeOf(this).constructor;result=Reflect.construct(Super,arguments,NewTarget);}else{result=Super.apply(this,arguments);}return _possibleConstructorReturn(this,result);};}function _possibleConstructorReturn(self,call){if(call&&(_typeof(call)==="object"||typeof call==="function")){return call;}else if(call!==void 0){throw new TypeError("Derived constructors may only return object or undefined");}return _assertThisInitialized(self);}function _assertThisInitialized(self){if(self===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called");}return self;}function _isNativeReflectConstruct(){if(typeof Reflect==="undefined"||!Reflect.construct)return false;if(Reflect.construct.sham)return false;if(typeof Proxy==="function")return true;try{Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}));return true;}catch(e){return false;}}function _getPrototypeOf(o){_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function _getPrototypeOf(o){return o.__proto__||Object.getPrototypeOf(o);};return _getPrototypeOf(o);}function _typeof(obj){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj;}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj;},_typeof(obj);}(function(f){if((typeof exports==="undefined"?"undefined":_typeof(exports))==="object"&&typeof module!=="undefined"){module.exports=f();}else if(typeof define==="function"&&define.amd){define([],f);}else{var g;if(typeof window!=="undefined"){g=window;}else if(typeof global!=="undefined"){g=global;}else if(typeof self!=="undefined"){g=self;}else{g=this;}g.Pict=f();}})(function(){var define,module,exports;return function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a;}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r);},p,p.exports,r,e,n,t);}return n[i].exports;}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o;}return r;}()({1:[function(require,module,exports){'use strict';var eachOfLimit=require('async.util.eachoflimit');var withoutIndex=require('async.util.withoutindex');module.exports=function eachLimit(arr,limit,iterator,cb){return eachOfLimit(limit)(arr,withoutIndex(iterator),cb);};},{"async.util.eachoflimit":3,"async.util.withoutindex":14}],2:[function(require,module,exports){'use strict';module.exports=function(tasks){function makeCallback(index){function fn(){if(tasks.length){tasks[index].apply(null,arguments);}return fn.next();}fn.next=function(){return index<tasks.length-1?makeCallback(index+1):null;};return fn;}return makeCallback(0);};},{}],3:[function(require,module,exports){var once=require('async.util.once');var noop=require('async.util.noop');var onlyOnce=require('async.util.onlyonce');var keyIterator=require('async.util.keyiterator');module.exports=function eachOfLimit(limit){return function(obj,iterator,cb){cb=once(cb||noop);obj=obj||[];var nextKey=keyIterator(obj);if(limit<=0){return cb(null);}var done=false;var running=0;var errored=false;(function replenish(){if(done&&running<=0){return cb(null);}while(running<limit&&!errored){var key=nextKey();if(key===null){done=true;if(running<=0){cb(null);}return;}running+=1;iterator(obj[key],key,onlyOnce(function(err){running-=1;if(err){cb(err);errored=true;}else{replenish();}}));}})();};};},{"async.util.keyiterator":7,"async.util.noop":9,"async.util.once":10,"async.util.onlyonce":11}],4:[function(require,module,exports){'use strict';var setImmediate=require('async.util.setimmediate');var restParam=require('async.util.restparam');module.exports=function(fn){return restParam(function(args){var callback=args.pop();args.push(function(){var innerArgs=arguments;if(sync){setImmediate(function(){callback.apply(null,innerArgs);});}else{callback.apply(null,innerArgs);}});var sync=true;fn.apply(this,args);sync=false;});};},{"async.util.restparam":12,"async.util.setimmediate":13}],5:[function(require,module,exports){'use strict';module.exports=Array.isArray||function isArray(obj){return Object.prototype.toString.call(obj)==='[object Array]';};},{}],6:[function(require,module,exports){'use strict';var isArray=require('async.util.isarray');module.exports=function isArrayLike(arr){return isArray(arr)||// has a positive integer length property
2
2
  typeof arr.length==='number'&&arr.length>=0&&arr.length%1===0;};},{"async.util.isarray":5}],7:[function(require,module,exports){'use strict';var _keys=require('async.util.keys');var isArrayLike=require('async.util.isarraylike');module.exports=function keyIterator(coll){var i=-1;var len;var keys;if(isArrayLike(coll)){len=coll.length;return function next(){i++;return i<len?i:null;};}else{keys=_keys(coll);len=keys.length;return function next(){i++;return i<len?keys[i]:null;};}};},{"async.util.isarraylike":6,"async.util.keys":8}],8:[function(require,module,exports){'use strict';module.exports=Object.keys||function keys(obj){var _keys=[];for(var k in obj){if(obj.hasOwnProperty(k)){_keys.push(k);}}return _keys;};},{}],9:[function(require,module,exports){'use strict';module.exports=function noop(){};},{}],10:[function(require,module,exports){'use strict';module.exports=function once(fn){return function(){if(fn===null)return;fn.apply(this,arguments);fn=null;};};},{}],11:[function(require,module,exports){'use strict';module.exports=function only_once(fn){return function(){if(fn===null)throw new Error('Callback was already called.');fn.apply(this,arguments);fn=null;};};},{}],12:[function(require,module,exports){'use strict';module.exports=function restParam(func,startIndex){startIndex=startIndex==null?func.length-1:+startIndex;return function(){var length=Math.max(arguments.length-startIndex,0);var rest=new Array(length);for(var index=0;index<length;index++){rest[index]=arguments[index+startIndex];}switch(startIndex){case 0:return func.call(this,rest);case 1:return func.call(this,arguments[0],rest);}};};},{}],13:[function(require,module,exports){(function(setImmediate){(function(){'use strict';var _setImmediate=typeof setImmediate==='function'&&setImmediate;var fallback=function fallback(fn){setTimeout(fn,0);};module.exports=function setImmediate(fn){// not a direct alias for IE10 compatibility
3
- return(_setImmediate||fallback)(fn);};}).call(this);}).call(this,require("timers").setImmediate);},{"timers":103}],14:[function(require,module,exports){'use strict';module.exports=function withoutIndex(iterator){return function(value,index,callback){return iterator(value,callback);};};},{}],15:[function(require,module,exports){'use strict';var once=require('async.util.once');var noop=require('async.util.noop');var isArray=require('async.util.isarray');var restParam=require('async.util.restparam');var ensureAsync=require('async.util.ensureasync');var iterator=require('async.iterator');module.exports=function(tasks,cb){cb=once(cb||noop);if(!isArray(tasks))return cb(new Error('First argument to waterfall must be an array of functions'));if(!tasks.length)return cb();function wrapIterator(iterator){return restParam(function(err,args){if(err){cb.apply(null,[err].concat(args));}else{var next=iterator.next();if(next){args.push(wrapIterator(next));}else{args.push(cb);}ensureAsync(iterator).apply(null,args);}});}wrapIterator(iterator(tasks))();};},{"async.iterator":2,"async.util.ensureasync":4,"async.util.isarray":5,"async.util.noop":9,"async.util.once":10,"async.util.restparam":12}],16:[function(require,module,exports){'use strict';exports.byteLength=byteLength;exports.toByteArray=toByteArray;exports.fromByteArray=fromByteArray;var lookup=[];var revLookup=[];var Arr=typeof Uint8Array!=='undefined'?Uint8Array:Array;var code='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';for(var i=0,len=code.length;i<len;++i){lookup[i]=code[i];revLookup[code.charCodeAt(i)]=i;}// Support decoding URL-safe base64 strings, as Node.js does.
3
+ return(_setImmediate||fallback)(fn);};}).call(this);}).call(this,require("timers").setImmediate);},{"timers":105}],14:[function(require,module,exports){'use strict';module.exports=function withoutIndex(iterator){return function(value,index,callback){return iterator(value,callback);};};},{}],15:[function(require,module,exports){'use strict';var once=require('async.util.once');var noop=require('async.util.noop');var isArray=require('async.util.isarray');var restParam=require('async.util.restparam');var ensureAsync=require('async.util.ensureasync');var iterator=require('async.iterator');module.exports=function(tasks,cb){cb=once(cb||noop);if(!isArray(tasks))return cb(new Error('First argument to waterfall must be an array of functions'));if(!tasks.length)return cb();function wrapIterator(iterator){return restParam(function(err,args){if(err){cb.apply(null,[err].concat(args));}else{var next=iterator.next();if(next){args.push(wrapIterator(next));}else{args.push(cb);}ensureAsync(iterator).apply(null,args);}});}wrapIterator(iterator(tasks))();};},{"async.iterator":2,"async.util.ensureasync":4,"async.util.isarray":5,"async.util.noop":9,"async.util.once":10,"async.util.restparam":12}],16:[function(require,module,exports){'use strict';exports.byteLength=byteLength;exports.toByteArray=toByteArray;exports.fromByteArray=fromByteArray;var lookup=[];var revLookup=[];var Arr=typeof Uint8Array!=='undefined'?Uint8Array:Array;var code='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';for(var i=0,len=code.length;i<len;++i){lookup[i]=code[i];revLookup[code.charCodeAt(i)]=i;}// Support decoding URL-safe base64 strings, as Node.js does.
4
4
  // See: https://en.wikipedia.org/wiki/Base64#URL_applications
5
5
  revLookup['-'.charCodeAt(0)]=62;revLookup['_'.charCodeAt(0)]=63;function getLens(b64){var len=b64.length;if(len%4>0){throw new Error('Invalid string. Length must be a multiple of 4');}// Trim off extra bytes after placeholder bytes are found
6
6
  // See: https://github.com/beatgammit/base64-js/issues/42
@@ -438,7 +438,7 @@ this.log=this.fable.log;this.services=this.fable.services;this.defaultServices=t
438
438
  */var libPrecedent=require('precedent');var FableSettingsTemplateProcessor=/*#__PURE__*/function(){function FableSettingsTemplateProcessor(pDependencies){_classCallCheck2(this,FableSettingsTemplateProcessor);// Use a no-dependencies templating engine to parse out environment variables
439
439
  this.templateProcessor=new libPrecedent();// TODO: Make the environment variable wrap expression demarcation characters configurable?
440
440
  this.templateProcessor.addPattern('${','}',function(pTemplateValue){var tmpTemplateValue=pTemplateValue.trim();var tmpSeparatorIndex=tmpTemplateValue.indexOf('|');// If there is no pipe, the default value will end up being whatever the variable name is.
441
- var tmpDefaultValue=tmpTemplateValue.substring(tmpSeparatorIndex+1);var tmpEnvironmentVariableName=tmpSeparatorIndex>-1?tmpTemplateValue.substring(0,tmpSeparatorIndex):tmpTemplateValue;if(process.env.hasOwnProperty(tmpEnvironmentVariableName)){return process.env[tmpEnvironmentVariableName];}else{return tmpDefaultValue;}});}_createClass2(FableSettingsTemplateProcessor,[{key:"parseSetting",value:function parseSetting(pString){return this.templateProcessor.parseString(pString);}}]);return FableSettingsTemplateProcessor;}();module.exports=FableSettingsTemplateProcessor;}).call(this);}).call(this,require('_process'));},{"_process":75,"precedent":72}],36:[function(require,module,exports){/**
441
+ var tmpDefaultValue=tmpTemplateValue.substring(tmpSeparatorIndex+1);var tmpEnvironmentVariableName=tmpSeparatorIndex>-1?tmpTemplateValue.substring(0,tmpSeparatorIndex):tmpTemplateValue;if(process.env.hasOwnProperty(tmpEnvironmentVariableName)){return process.env[tmpEnvironmentVariableName];}else{return tmpDefaultValue;}});}_createClass2(FableSettingsTemplateProcessor,[{key:"parseSetting",value:function parseSetting(pString){return this.templateProcessor.parseString(pString);}}]);return FableSettingsTemplateProcessor;}();module.exports=FableSettingsTemplateProcessor;}).call(this);}).call(this,require('_process'));},{"_process":77,"precedent":74}],36:[function(require,module,exports){/**
442
442
  * Fable Settings Add-on
443
443
  *
444
444
  *
@@ -790,7 +790,7 @@ if(tmpParameters.CurrentPath==libPath.sep){tmpParameters.CurrentPath=tmpParamete
790
790
  tmpParameters.CurrentPathIndex++;}// Check if the path is fully complete
791
791
  if(tmpParameters.CurrentPathIndex>=tmpParameters.ActualPathParts.length){fCallback(null);return true;}// Check if the path exists (and is a folder)
792
792
  libFS.open(tmpParameters.CurrentPath+libPath.sep+tmpParameters.ActualPathParts[tmpParameters.CurrentPathIndex],'r',function(pError,pFileDescriptor){if(pFileDescriptor){libFS.closeSync(pFileDescriptor);}if(pError&&pError.code=='ENOENT'){/* Path doesn't exist, create it */libFS.mkdir(tmpParameters.CurrentPath+libPath.sep+tmpParameters.ActualPathParts[tmpParameters.CurrentPathIndex],tmpParameters.Mode,function(pCreateError){if(!pCreateError){// We have now created our folder and there was no error -- continue.
793
- return _this19.makeFolderRecursive(tmpParameters,fCallback);}else{fCallback(pCreateError);return false;}});}else{return _this19.makeFolderRecursive(tmpParameters,fCallback);}});}}]);return FableServiceFilePersistence;}(libFableServiceBase);module.exports=FableServiceFilePersistence;}).call(this);}).call(this,require('_process'));},{"../Fable-ServiceManager.js":39,"_process":75,"fs":18,"path":71}],48:[function(require,module,exports){var libFableServiceBase=require('../Fable-ServiceManager.js').ServiceProviderBase;/**
793
+ return _this19.makeFolderRecursive(tmpParameters,fCallback);}else{fCallback(pCreateError);return false;}});}else{return _this19.makeFolderRecursive(tmpParameters,fCallback);}});}}]);return FableServiceFilePersistence;}(libFableServiceBase);module.exports=FableServiceFilePersistence;}).call(this);}).call(this,require('_process'));},{"../Fable-ServiceManager.js":39,"_process":77,"fs":18,"path":71}],48:[function(require,module,exports){var libFableServiceBase=require('../Fable-ServiceManager.js').ServiceProviderBase;/**
794
794
  * Precedent Meta-Templating
795
795
  * @author Steven Velozo <steven@velozo.com>
796
796
  * @description Process text stream trie and postfix tree, parsing out meta-template expression functions.
@@ -935,7 +935,7 @@ if(_this25.TraceLog){var tmpChunkTime=_this25.fable.log.getTimeStamp();_this25.f
935
935
  {
936
936
  tmpOptions.headers['Content-Type'] = 'application/json';
937
937
  }
938
- */tmpOptions.RequestStartTime=this.fable.log.getTimeStamp();if(this.TraceLog){this.fable.log.debug("Beginning ".concat(tmpOptions.method," JSON request to ").concat(tmpOptions.url," at ").concat(tmpOptions.RequestStartTime));}return libSimpleGet(tmpOptions,function(pError,pResponse){if(pError){return fCallback(pError,pResponse);}if(_this26.TraceLog){var tmpConnectTime=_this26.fable.log.getTimeStamp();_this26.fable.log.debug("--> JSON ".concat(tmpOptions.method," connected in ").concat(_this26.dataFormat.formatTimeDelta(tmpOptions.RequestStartTime,tmpConnectTime),"ms code ").concat(pResponse.statusCode));}var tmpJSONData='';pResponse.on('data',function(pChunk){if(_this26.TraceLog){var tmpChunkTime=_this26.fable.log.getTimeStamp();_this26.fable.log.debug("--> JSON ".concat(tmpOptions.method," data chunk size ").concat(pChunk.length,"b received in ").concat(_this26.dataFormat.formatTimeDelta(tmpOptions.RequestStartTime,tmpChunkTime),"ms"));}tmpJSONData+=pChunk;});pResponse.on('end',function(){if(_this26.TraceLog){var tmpCompletionTime=_this26.fable.log.getTimeStamp();_this26.fable.log.debug("==> JSON ".concat(tmpOptions.method," completed - received in ").concat(_this26.dataFormat.formatTimeDelta(tmpOptions.RequestStartTime,tmpCompletionTime),"ms"));}return fCallback(pError,pResponse,JSON.parse(tmpJSONData));});});}},{key:"getJSON",value:function getJSON(pOptionsOrURL,fCallback){var tmpRequestOptions=_typeof(pOptionsOrURL)=='object'?pOptionsOrURL:{};if(typeof pOptionsOrURL=='string'){tmpRequestOptions.url=pOptionsOrURL;}tmpRequestOptions.method='GET';return this.executeJSONRequest(tmpRequestOptions,fCallback);}},{key:"putJSON",value:function putJSON(pOptions,fCallback){if(_typeof(pOptions.body)!='object'){return fCallback(new Error("PUT JSON Error Invalid options object"));}pOptions.method='PUT';return this.executeJSONRequest(pOptions,fCallback);}},{key:"postJSON",value:function postJSON(pOptions,fCallback){if(_typeof(pOptions.body)!='object'){return fCallback(new Error("POST JSON Error Invalid options object"));}pOptions.method='POST';return this.executeJSONRequest(pOptions,fCallback);}},{key:"patchJSON",value:function patchJSON(pOptions,fCallback){if(_typeof(pOptions.body)!='object'){return fCallback(new Error("PATCH JSON Error Invalid options object"));}pOptions.method='PATCH';return this.executeJSONRequest(pOptions,fCallback);}},{key:"headJSON",value:function headJSON(pOptions,fCallback){if(_typeof(pOptions.body)!='object'){return fCallback(new Error("HEAD JSON Error Invalid options object"));}pOptions.method='HEAD';return this.executeJSONRequest(pOptions,fCallback);}},{key:"delJSON",value:function delJSON(pOptions,fCallback){pOptions.method='DELETE';return this.executeJSONRequest(pOptions,fCallback);}},{key:"getRawText",value:function getRawText(pOptionsOrURL,fCallback){var tmpRequestOptions=_typeof(pOptionsOrURL)=='object'?pOptionsOrURL:{};if(typeof pOptionsOrURL=='string'){tmpRequestOptions.url=pOptionsOrURL;}tmpRequestOptions.method='GET';return this.executeChunkedRequest(tmpRequestOptions,fCallback);}}]);return FableServiceRestClient;}(libFableServiceBase);module.exports=FableServiceRestClient;},{"../Fable-ServiceManager.js":39,"cookie":24,"simple-get":82}],54:[function(require,module,exports){var libFableServiceBase=require('../Fable-ServiceManager.js').ServiceProviderBase;var FableServiceTemplate=/*#__PURE__*/function(_libFableServiceBase8){_inherits(FableServiceTemplate,_libFableServiceBase8);var _super17=_createSuper(FableServiceTemplate);// Underscore and lodash have a behavior, _.template, which compiles a
938
+ */tmpOptions.RequestStartTime=this.fable.log.getTimeStamp();if(this.TraceLog){this.fable.log.debug("Beginning ".concat(tmpOptions.method," JSON request to ").concat(tmpOptions.url," at ").concat(tmpOptions.RequestStartTime));}return libSimpleGet(tmpOptions,function(pError,pResponse){if(pError){return fCallback(pError,pResponse);}if(_this26.TraceLog){var tmpConnectTime=_this26.fable.log.getTimeStamp();_this26.fable.log.debug("--> JSON ".concat(tmpOptions.method," connected in ").concat(_this26.dataFormat.formatTimeDelta(tmpOptions.RequestStartTime,tmpConnectTime),"ms code ").concat(pResponse.statusCode));}var tmpJSONData='';pResponse.on('data',function(pChunk){if(_this26.TraceLog){var tmpChunkTime=_this26.fable.log.getTimeStamp();_this26.fable.log.debug("--> JSON ".concat(tmpOptions.method," data chunk size ").concat(pChunk.length,"b received in ").concat(_this26.dataFormat.formatTimeDelta(tmpOptions.RequestStartTime,tmpChunkTime),"ms"));}tmpJSONData+=pChunk;});pResponse.on('end',function(){if(_this26.TraceLog){var tmpCompletionTime=_this26.fable.log.getTimeStamp();_this26.fable.log.debug("==> JSON ".concat(tmpOptions.method," completed - received in ").concat(_this26.dataFormat.formatTimeDelta(tmpOptions.RequestStartTime,tmpCompletionTime),"ms"));}return fCallback(pError,pResponse,JSON.parse(tmpJSONData));});});}},{key:"getJSON",value:function getJSON(pOptionsOrURL,fCallback){var tmpRequestOptions=_typeof(pOptionsOrURL)=='object'?pOptionsOrURL:{};if(typeof pOptionsOrURL=='string'){tmpRequestOptions.url=pOptionsOrURL;}tmpRequestOptions.method='GET';return this.executeJSONRequest(tmpRequestOptions,fCallback);}},{key:"putJSON",value:function putJSON(pOptions,fCallback){if(_typeof(pOptions.body)!='object'){return fCallback(new Error("PUT JSON Error Invalid options object"));}pOptions.method='PUT';return this.executeJSONRequest(pOptions,fCallback);}},{key:"postJSON",value:function postJSON(pOptions,fCallback){if(_typeof(pOptions.body)!='object'){return fCallback(new Error("POST JSON Error Invalid options object"));}pOptions.method='POST';return this.executeJSONRequest(pOptions,fCallback);}},{key:"patchJSON",value:function patchJSON(pOptions,fCallback){if(_typeof(pOptions.body)!='object'){return fCallback(new Error("PATCH JSON Error Invalid options object"));}pOptions.method='PATCH';return this.executeJSONRequest(pOptions,fCallback);}},{key:"headJSON",value:function headJSON(pOptions,fCallback){if(_typeof(pOptions.body)!='object'){return fCallback(new Error("HEAD JSON Error Invalid options object"));}pOptions.method='HEAD';return this.executeJSONRequest(pOptions,fCallback);}},{key:"delJSON",value:function delJSON(pOptions,fCallback){pOptions.method='DELETE';return this.executeJSONRequest(pOptions,fCallback);}},{key:"getRawText",value:function getRawText(pOptionsOrURL,fCallback){var tmpRequestOptions=_typeof(pOptionsOrURL)=='object'?pOptionsOrURL:{};if(typeof pOptionsOrURL=='string'){tmpRequestOptions.url=pOptionsOrURL;}tmpRequestOptions.method='GET';return this.executeChunkedRequest(tmpRequestOptions,fCallback);}}]);return FableServiceRestClient;}(libFableServiceBase);module.exports=FableServiceRestClient;},{"../Fable-ServiceManager.js":39,"cookie":24,"simple-get":84}],54:[function(require,module,exports){var libFableServiceBase=require('../Fable-ServiceManager.js').ServiceProviderBase;var FableServiceTemplate=/*#__PURE__*/function(_libFableServiceBase8){_inherits(FableServiceTemplate,_libFableServiceBase8);var _super17=_createSuper(FableServiceTemplate);// Underscore and lodash have a behavior, _.template, which compiles a
939
939
  // string-based template with code snippets into simple executable pieces,
940
940
  // with the added twist of returning a precompiled function ready to go.
941
941
  //
@@ -1009,7 +1009,7 @@ tmpTimeZoneOffsetInHours=parseInt(tmpDateParts[7])+tmpTimeZoneOffsetInMinutes;//
1009
1009
  if(pISOString.substr(-6,1)=="+"){// Make the offset negative since the hours will need to be subtracted from the date.
1010
1010
  tmpTimeZoneOffsetInHours*=-1;}}// Get the current hours for the date and add the offset to get the correct time adjusted for timezone.
1011
1011
  tmpReturnDate.setHours(tmpReturnDate.getHours()+tmpTimeZoneOffsetInHours);// Return the Date object calculated from the string.
1012
- return tmpReturnDate;}}]);return FableServiceUtility;}(libFableServiceBase);module.exports=FableServiceUtility;},{"../Fable-ServiceManager.js":39,"async.eachlimit":1,"async.waterfall":15}],56:[function(require,module,exports){var http=require('http');var url=require('url');var https=module.exports;for(var key in http){if(http.hasOwnProperty(key))https[key]=http[key];}https.request=function(params,cb){params=validateParams(params);return http.request.call(this,params,cb);};https.get=function(params,cb){params=validateParams(params);return http.get.call(this,params,cb);};function validateParams(params){if(typeof params==='string'){params=url.parse(params);}if(!params.protocol){params.protocol='https:';}if(params.protocol!=='https:'){throw new Error('Protocol "'+params.protocol+'" not supported. Expected "https:"');}return params;}},{"http":83,"url":104}],57:[function(require,module,exports){/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */exports.read=function(buffer,offset,isLE,mLen,nBytes){var e,m;var eLen=nBytes*8-mLen-1;var eMax=(1<<eLen)-1;var eBias=eMax>>1;var nBits=-7;var i=isLE?nBytes-1:0;var d=isLE?-1:1;var s=buffer[offset+i];i+=d;e=s&(1<<-nBits)-1;s>>=-nBits;nBits+=eLen;for(;nBits>0;e=e*256+buffer[offset+i],i+=d,nBits-=8){}m=e&(1<<-nBits)-1;e>>=-nBits;nBits+=mLen;for(;nBits>0;m=m*256+buffer[offset+i],i+=d,nBits-=8){}if(e===0){e=1-eBias;}else if(e===eMax){return m?NaN:(s?-1:1)*Infinity;}else{m=m+Math.pow(2,mLen);e=e-eBias;}return(s?-1:1)*m*Math.pow(2,e-mLen);};exports.write=function(buffer,value,offset,isLE,mLen,nBytes){var e,m,c;var eLen=nBytes*8-mLen-1;var eMax=(1<<eLen)-1;var eBias=eMax>>1;var rt=mLen===23?Math.pow(2,-24)-Math.pow(2,-77):0;var i=isLE?0:nBytes-1;var d=isLE?1:-1;var s=value<0||value===0&&1/value<0?1:0;value=Math.abs(value);if(isNaN(value)||value===Infinity){m=isNaN(value)?1:0;e=eMax;}else{e=Math.floor(Math.log(value)/Math.LN2);if(value*(c=Math.pow(2,-e))<1){e--;c*=2;}if(e+eBias>=1){value+=rt/c;}else{value+=rt*Math.pow(2,1-eBias);}if(value*c>=2){e++;c/=2;}if(e+eBias>=eMax){m=0;e=eMax;}else if(e+eBias>=1){m=(value*c-1)*Math.pow(2,mLen);e=e+eBias;}else{m=value*Math.pow(2,eBias-1)*Math.pow(2,mLen);e=0;}}for(;mLen>=8;buffer[offset+i]=m&0xff,i+=d,m/=256,mLen-=8){}e=e<<mLen|m;eLen+=mLen;for(;eLen>0;buffer[offset+i]=e&0xff,i+=d,e/=256,eLen-=8){}buffer[offset+i-d]|=s*128;};},{}],58:[function(require,module,exports){if(typeof Object.create==='function'){// implementation from standard node.js 'util' module
1012
+ return tmpReturnDate;}}]);return FableServiceUtility;}(libFableServiceBase);module.exports=FableServiceUtility;},{"../Fable-ServiceManager.js":39,"async.eachlimit":1,"async.waterfall":15}],56:[function(require,module,exports){var http=require('http');var url=require('url');var https=module.exports;for(var key in http){if(http.hasOwnProperty(key))https[key]=http[key];}https.request=function(params,cb){params=validateParams(params);return http.request.call(this,params,cb);};https.get=function(params,cb){params=validateParams(params);return http.get.call(this,params,cb);};function validateParams(params){if(typeof params==='string'){params=url.parse(params);}if(!params.protocol){params.protocol='https:';}if(params.protocol!=='https:'){throw new Error('Protocol "'+params.protocol+'" not supported. Expected "https:"');}return params;}},{"http":85,"url":106}],57:[function(require,module,exports){/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */exports.read=function(buffer,offset,isLE,mLen,nBytes){var e,m;var eLen=nBytes*8-mLen-1;var eMax=(1<<eLen)-1;var eBias=eMax>>1;var nBits=-7;var i=isLE?nBytes-1:0;var d=isLE?-1:1;var s=buffer[offset+i];i+=d;e=s&(1<<-nBits)-1;s>>=-nBits;nBits+=eLen;for(;nBits>0;e=e*256+buffer[offset+i],i+=d,nBits-=8){}m=e&(1<<-nBits)-1;e>>=-nBits;nBits+=mLen;for(;nBits>0;m=m*256+buffer[offset+i],i+=d,nBits-=8){}if(e===0){e=1-eBias;}else if(e===eMax){return m?NaN:(s?-1:1)*Infinity;}else{m=m+Math.pow(2,mLen);e=e-eBias;}return(s?-1:1)*m*Math.pow(2,e-mLen);};exports.write=function(buffer,value,offset,isLE,mLen,nBytes){var e,m,c;var eLen=nBytes*8-mLen-1;var eMax=(1<<eLen)-1;var eBias=eMax>>1;var rt=mLen===23?Math.pow(2,-24)-Math.pow(2,-77):0;var i=isLE?0:nBytes-1;var d=isLE?1:-1;var s=value<0||value===0&&1/value<0?1:0;value=Math.abs(value);if(isNaN(value)||value===Infinity){m=isNaN(value)?1:0;e=eMax;}else{e=Math.floor(Math.log(value)/Math.LN2);if(value*(c=Math.pow(2,-e))<1){e--;c*=2;}if(e+eBias>=1){value+=rt/c;}else{value+=rt*Math.pow(2,1-eBias);}if(value*c>=2){e++;c/=2;}if(e+eBias>=eMax){m=0;e=eMax;}else if(e+eBias>=1){m=(value*c-1)*Math.pow(2,mLen);e=e+eBias;}else{m=value*Math.pow(2,eBias-1)*Math.pow(2,mLen);e=0;}}for(;mLen>=8;buffer[offset+i]=m&0xff,i+=d,m/=256,mLen-=8){}e=e<<mLen|m;eLen+=mLen;for(;eLen>0;buffer[offset+i]=e&0xff,i+=d,e/=256,eLen-=8){}buffer[offset+i-d]|=s*128;};},{}],58:[function(require,module,exports){if(typeof Object.create==='function'){// implementation from standard node.js 'util' module
1013
1013
  module.exports=function inherits(ctor,superCtor){if(superCtor){ctor.super_=superCtor;ctor.prototype=Object.create(superCtor.prototype,{constructor:{value:ctor,enumerable:false,writable:true,configurable:true}});}};}else{// old school shim for old browsers
1014
1014
  module.exports=function inherits(ctor,superCtor){if(superCtor){ctor.super_=superCtor;var TempCtor=function TempCtor(){};TempCtor.prototype=superCtor.prototype;ctor.prototype=new TempCtor();ctor.prototype.constructor=ctor;}};}},{}],59:[function(require,module,exports){// When a boxed property is passed in, it should have quotes of some
1015
1015
  // kind around it.
@@ -1657,7 +1657,7 @@ var tmpOverwriteProperties=typeof pOverwriteProperties=='undefined'?false:pOverw
1657
1657
  // The default filter function just returns true, populating everything.
1658
1658
  var tmpFilterFunction=typeof fFilter=='function'?fFilter:function(pDescriptor){return true;};this.elementAddresses.forEach(function(pAddress){var tmpDescriptor=_this33.getDescriptor(pAddress);// Check the filter function to see if this is an address we want to set the value for.
1659
1659
  if(tmpFilterFunction(tmpDescriptor)){// If we are overwriting properties OR the property does not exist
1660
- if(tmpOverwriteProperties||!_this33.checkAddressExists(tmpObject,pAddress)){_this33.setValueAtAddress(tmpObject,pAddress,_this33.getDefaultValue(tmpDescriptor));}}});return tmpObject;}}]);return Manyfest;}(libFableServiceProviderBase);;module.exports=Manyfest;},{"./Manyfest-HashTranslation.js":60,"./Manyfest-LogToConsole.js":61,"./Manyfest-ObjectAddress-CheckAddressExists.js":62,"./Manyfest-ObjectAddress-DeleteValue.js":63,"./Manyfest-ObjectAddress-GetValue.js":64,"./Manyfest-ObjectAddress-SetValue.js":65,"./Manyfest-ObjectAddressGeneration.js":66,"./Manyfest-SchemaManipulation.js":68,"fable-serviceproviderbase":33}],70:[function(require,module,exports){var wrappy=require('wrappy');module.exports=wrappy(once);module.exports.strict=wrappy(onceStrict);once.proto=once(function(){Object.defineProperty(Function.prototype,'once',{value:function value(){return once(this);},configurable:true});Object.defineProperty(Function.prototype,'onceStrict',{value:function value(){return onceStrict(this);},configurable:true});});function once(fn){var f=function f(){if(f.called)return f.value;f.called=true;return f.value=fn.apply(this,arguments);};f.called=false;return f;}function onceStrict(fn){var f=function f(){if(f.called)throw new Error(f.onceError);f.called=true;return f.value=fn.apply(this,arguments);};var name=fn.name||'Function wrapped with `once`';f.onceError=name+" shouldn't be called more than once";f.called=false;return f;}},{"wrappy":107}],71:[function(require,module,exports){(function(process){(function(){// 'path' module extracted from Node.js v8.11.1 (only the posix part)
1660
+ if(tmpOverwriteProperties||!_this33.checkAddressExists(tmpObject,pAddress)){_this33.setValueAtAddress(tmpObject,pAddress,_this33.getDefaultValue(tmpDescriptor));}}});return tmpObject;}}]);return Manyfest;}(libFableServiceProviderBase);;module.exports=Manyfest;},{"./Manyfest-HashTranslation.js":60,"./Manyfest-LogToConsole.js":61,"./Manyfest-ObjectAddress-CheckAddressExists.js":62,"./Manyfest-ObjectAddress-DeleteValue.js":63,"./Manyfest-ObjectAddress-GetValue.js":64,"./Manyfest-ObjectAddress-SetValue.js":65,"./Manyfest-ObjectAddressGeneration.js":66,"./Manyfest-SchemaManipulation.js":68,"fable-serviceproviderbase":33}],70:[function(require,module,exports){var wrappy=require('wrappy');module.exports=wrappy(once);module.exports.strict=wrappy(onceStrict);once.proto=once(function(){Object.defineProperty(Function.prototype,'once',{value:function value(){return once(this);},configurable:true});Object.defineProperty(Function.prototype,'onceStrict',{value:function value(){return onceStrict(this);},configurable:true});});function once(fn){var f=function f(){if(f.called)return f.value;f.called=true;return f.value=fn.apply(this,arguments);};f.called=false;return f;}function onceStrict(fn){var f=function f(){if(f.called)throw new Error(f.onceError);f.called=true;return f.value=fn.apply(this,arguments);};var name=fn.name||'Function wrapped with `once`';f.onceError=name+" shouldn't be called more than once";f.called=false;return f;}},{"wrappy":109}],71:[function(require,module,exports){(function(process){(function(){// 'path' module extracted from Node.js v8.11.1 (only the posix part)
1661
1661
  // transplited with Babel
1662
1662
  // Copyright Joyent, Inc. and other Node contributors.
1663
1663
  //
@@ -1739,7 +1739,22 @@ if(startDot===-1)startDot=i;else if(preDotState!==1)preDotState=1;}else if(start
1739
1739
  // have a good chance at having a non-empty extension
1740
1740
  preDotState=-1;}}if(startDot===-1||end===-1||// We saw a non-dot character immediately before the dot
1741
1741
  preDotState===0||// The (right-most) trimmed path component is exactly '..'
1742
- preDotState===1&&startDot===end-1&&startDot===startPart+1){if(end!==-1){if(startPart===0&&isAbsolute)ret.base=ret.name=path.slice(1,end);else ret.base=ret.name=path.slice(startPart,end);}}else{if(startPart===0&&isAbsolute){ret.name=path.slice(1,startDot);ret.base=path.slice(1,end);}else{ret.name=path.slice(startPart,startDot);ret.base=path.slice(startPart,end);}ret.ext=path.slice(startDot,end);}if(startPart>0)ret.dir=path.slice(0,startPart-1);else if(isAbsolute)ret.dir='/';return ret;},sep:'/',delimiter:':',win32:null,posix:null};posix.posix=posix;module.exports=posix;}).call(this);}).call(this,require('_process'));},{"_process":75}],72:[function(require,module,exports){/**
1742
+ preDotState===1&&startDot===end-1&&startDot===startPart+1){if(end!==-1){if(startPart===0&&isAbsolute)ret.base=ret.name=path.slice(1,end);else ret.base=ret.name=path.slice(startPart,end);}}else{if(startPart===0&&isAbsolute){ret.name=path.slice(1,startDot);ret.base=path.slice(1,end);}else{ret.name=path.slice(startPart,startDot);ret.base=path.slice(startPart,end);}ret.ext=path.slice(startDot,end);}if(startPart>0)ret.dir=path.slice(0,startPart-1);else if(isAbsolute)ret.dir='/';return ret;},sep:'/',delimiter:':',win32:null,posix:null};posix.posix=posix;module.exports=posix;}).call(this);}).call(this,require('_process'));},{"_process":77}],72:[function(require,module,exports){var libFableServiceBase=require('fable-serviceproviderbase');var defaultPictSettings={Name:'DefaultPictApplication',InitializeOnLoad:true,// The main "viewport" is the view that is used to host our application
1743
+ MainViewportView:'Default-View',MainViewportRenderable:'Application-Default-View-Renderable',MainViewportDestinationAddress:'Application-Destination-Address',MainViewportDefaultDataAddress:'',// Whether or not we should automatically render the main viewport when appropriate
1744
+ AutoRenderMainViewportView:false,Manifests:{},// The prefix to prepend on all template destination hashes
1745
+ IdentifierAddressPrefix:'PICT-'};var PictApplication=/*#__PURE__*/function(_libFableServiceBase10){_inherits(PictApplication,_libFableServiceBase10);var _super20=_createSuper(PictApplication);function PictApplication(pFable,pOptions,pServiceHash){var _this34;_classCallCheck2(this,PictApplication);var tmpOptions=Object.assign({},JSON.parse(JSON.stringify(defaultPictSettings)),pOptions);_this34=_super20.call(this,pFable,tmpOptions,pServiceHash);_this34.serviceType='PictApplication';_this34.AppData=_this34.fable.AppData;_this34.initializationFunctionSet=[];var tmpManifestKeys=Object.keys(_this34.options.Manifests);if(tmpManifestKeys.length>0){for(var i=0;i<tmpManifestKeys.length;i++){// Load each manifest
1746
+ var tmpManifestKey=tmpManifestKeys[i];_this34.fable.serviceManager.instantiateServiceProvider('Manifest',_this34.options.Manifests[tmpManifestKey],tmpManifestKey);}}if(_this34.options.InitializeOnLoad){return _possibleConstructorReturn(_this34,_this34.initialize());}if(_this34.options.AutoRenderMainViewportView){_this34.log.info("Pict Application ".concat(_this34.options.Name,"[").concat(_this34.UUID,"]::[").concat(_this34.Hash,"] beginning auto render of [").concat(_this34.options.MainViewportView,"::").concat(_this34.options.MainViewportRenderable,"]."));_this34.renderAsync(_this34.options.MainViewportView,_this34.options.MainViewportRenderable,_this34.options.MainViewportDestinationAddress,_this34.options.MainViewportDefaultDataAddress,function(){});}return _this34;}// TODO: do we need an asynchronous version of this?
1747
+ _createClass2(PictApplication,[{key:"solve",value:function solve(){this.log.info("Pict Application ".concat(this.options.Name,"[").concat(this.UUID,"]::[").concat(this.Hash,"] executing solve() function..."));return true;}},{key:"internalInitialize",value:function internalInitialize(){return true;}},{key:"initialize",value:function initialize(){this.log.info("Pict Application ".concat(this.options.Name,"[").concat(this.UUID,"]::[").concat(this.Hash,"] beginning initialization..."));this.internalInitialize();this.log.info("Pict Application ".concat(this.options.Name,"[").concat(this.UUID,"]::[").concat(this.Hash,"] initialization complete."));}},{key:"render",value:function render(pViewHash,pRenderableHash,pRenderDestinationAddress,pTemplateDataAddress){var tmpView=typeof pViewHash==='string'?this.services.PictView[pViewHash]:false;if(!tmpView){this.log.error("PictApplication [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.Name," could not render from View ").concat(pViewHash," because it is not a valid view."));return false;}return tmpView.render(pRenderableHash,pRenderDestinationAddress,pTemplateDataAddress);}},{key:"renderAsync",value:function renderAsync(pViewHash,pRenderableHash,pRenderDestinationAddress,pTemplateDataAddress,fCallback){var tmpView=typeof pViewHash==='string'?this.services.PictView[pViewHash]:false;if(!tmpView){this.log.error("PictApplication [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.Name," could not render from View ").concat(pViewHash," because it is not a valid view."));return false;}return tmpView.renderAsync(pRenderableHash,pRenderDestinationAddress,pTemplateDataAddress,fCallback);}}]);return PictApplication;}(libFableServiceBase);module.exports=PictApplication;},{"fable-serviceproviderbase":33}],73:[function(require,module,exports){var libFableServiceBase=require('fable-serviceproviderbase');var defaultPictViewSettings={DefaultRenderable:false,DefaultDestinationAddress:false,DefaultTemplateRecordAddress:false,ViewIdentifier:'DEFAULT',InitializeOnLoad:true,RenderOnLoad:false,Templates:[],DefaultTemplates:[],Renderables:[],Manifests:{}};var PictView=/*#__PURE__*/function(_libFableServiceBase11){_inherits(PictView,_libFableServiceBase11);var _super21=_createSuper(PictView);function PictView(pFable,pOptions,pServiceHash){var _this35;_classCallCheck2(this,PictView);var tmpOptions=Object.assign({},JSON.parse(JSON.stringify(defaultPictViewSettings)),pOptions);_this35=_super21.call(this,pFable,tmpOptions,pServiceHash);_this35.serviceType='PictView';// Wire in the essential Pict service
1748
+ _this35.AppData=_this35.fable.AppData;// Load all templates from the array in the options
1749
+ // Templates are in the form of {Hash:'Some-Template-Hash',Template:'Template content',Source:'TemplateSource'}
1750
+ for(var i=0;i<_this35.options.Templates.length;i++){var tmpTemplate=_this35.options.Templates[i];if(!tmpTemplate.hasOwnProperty('Hash')||!tmpTemplate.hasOwnProperty('Template')){_this35.log.error("PictView [".concat(_this35.UUID,"]::[").concat(_this35.Hash,"] ").concat(_this35.options.ViewIdentifier," could not load Template ").concat(i," in the options array."),tmpTemplate);}else{if(!tmpTemplate.Source){tmpTemplate.Source="PictView [".concat(_this35.UUID,"]::[").concat(_this35.Hash,"] ").concat(_this35.options.ViewIdentifier," options object.");}_this35.fable.TemplateProvider.addTemplate(tmpTemplate.Hash,tmpTemplate.Template,tmpTemplate.Source);}}// Load all default templates from the array in the options
1751
+ // Templates are in the form of {Prefix:'',Postfix:'-List-Row',Template:'Template content',Source:'TemplateSourceString'}
1752
+ for(var _i11=0;_i11<_this35.options.DefaultTemplates.length;_i11++){var tmpDefaultTemplate=_this35.options.DefaultTemplates[_i11];if(!tmpDefaultTemplate.hasOwnProperty('Postfix')||!tmpDefaultTemplate.hasOwnProperty('Template')){_this35.log.error("PictView [".concat(_this35.UUID,"]::[").concat(_this35.Hash,"] ").concat(_this35.options.ViewIdentifier," could not load Default Template ").concat(_i11," in the options array."),tmpDefaultTemplate);}else{if(!tmpDefaultTemplate.Source){tmpDefaultTemplate.Source="PictView [".concat(_this35.UUID,"]::[").concat(_this35.Hash,"] ").concat(_this35.options.ViewIdentifier," options object.");}_this35.fable.TemplateProvider.addDefaultTemplate(tmpDefaultTemplate.Prefix,tmpDefaultTemplate.Postfix,tmpDefaultTemplate.Template,tmpDefaultTemplate.Source);}}// Load all renderables
1753
+ // Renderables are launchable renderable instructions with templates
1754
+ // They look as such: {Identifier:'ContentEntry', TemplateHash:'Content-Entry-Section-Main', ContentDestinationAddress:'#ContentSection', RecordAddress:'AppData.Content.DefaultText', ManifestTransformation:'ManyfestHash', ManifestDestinationAddress:'AppData.Content.DataToTransformContent'}
1755
+ // The only parts that are necessary are Identifier and Template
1756
+ // A developer can then do render('ContentEntry') and it just kinda works. Or they can override the ContentDestinationAddress
1757
+ _this35.renderables={};for(var _i12=0;_i12<_this35.options.Renderables.length;_i12++){var tmpRenderable=_this35.options.Renderables[_i12];if(!tmpRenderable.hasOwnProperty('RenderableHash')||!tmpRenderable.hasOwnProperty('TemplateHash')){_this35.log.error("PictView [".concat(_this35.UUID,"]::[").concat(_this35.Hash,"] ").concat(_this35.options.ViewIdentifier," could not load Renderable ").concat(_i12," in the options array."),tmpRenderable);}else{_this35.renderables[tmpRenderable.RenderableHash]=tmpRenderable;}}if(_this35.options.InitializeOnLoad){_this35.initialize();}if(_this35.options.RenderOnLoad){_this35.render(_this35.options.DefaultRenderable,_this35.options.DefaultDestinationAddress,_this35.options.DefaultTemplateRecordAddress);_this35.postInitialRenderInitialize();}return _this35;}_createClass2(PictView,[{key:"internalInitialize",value:function internalInitialize(){return true;}},{key:"postInitialRenderInitialize",value:function postInitialRenderInitialize(){return true;}},{key:"initialize",value:function initialize(){this.log.info("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," beginning initialization..."));this.internalInitialize();this.log.info("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," initialization complete."));}},{key:"render",value:function render(pRenderable,pRenderDestinationAddress,pTemplateDataAddress){var tmpRenderableHash=typeof pRenderable==='string'?pRenderable:typeof this.options.DefaultRenderable=='string'?this.options.DefaultRenderable:false;if(!tmpRenderableHash){this.log.error("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," could not render ").concat(tmpRenderableHash," (param ").concat(pRenderable,") because it is not a valid renderable."));return false;}var tmpRenderable=this.renderables[tmpRenderableHash];if(!tmpRenderable){this.log.error("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," could not render ").concat(tmpRenderableHash," (param ").concat(pRenderable,") because it does not exist."));return false;}var tmpRenderDestinationAddress=typeof pRenderDestinationAddress==='string'?pRenderDestinationAddress:typeof tmpRenderable.ContentDestinationAddress==='string'?tmpRenderable.ContentDestinationAddress:typeof this.options.DefaultDestinationAddress==='string'?this.options.DefaultDestinationAddress:false;if(!tmpRenderDestinationAddress){this.log.error("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," could not render ").concat(tmpRenderableHash," (param ").concat(pRenderable,") because it does not have a valid destination address."));return false;}var tmpDataAddress=typeof pTemplateDataAddress==='string'?pTemplateDataAddress:typeof tmpRenderable.RecordAddress==='string'?tmpRenderable.RecordAddress:typeof this.options.DefaultTemplateRecordAddress==='string'?this.options.DefaultTemplateRecordAddress:false;var tmpData=typeof tmpDataAddress==='string'?this.fable.DataProvider.getDataByAddress(tmpDataAddress):undefined;var tmpContent=this.fable.parseTemplateByHash(tmpRenderable.TemplateHash,tmpData);return this.fable.ContentAssignment.assignContent(tmpRenderDestinationAddress,tmpContent);}},{key:"renderAsync",value:function renderAsync(pRenderable,pRenderDestinationAddress,pTemplateDataAddress,fCallback){var _this36=this;var tmpRenderableHash=typeof pRenderable==='string'?pRenderable:false;if(!tmpRenderableHash){this.log.error("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," could not asynchronously render ").concat(tmpRenderableHash," (param ").concat(pRenderable,"because it is not a valid renderable."));return fCallback(Error("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," could not asynchronously render ").concat(tmpRenderableHash," (param ").concat(pRenderable,"because it is not a valid renderable.")));}var tmpRenderable=this.renderables[tmpRenderableHash];if(!tmpRenderable){this.log.error("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," could not render ").concat(tmpRenderableHash," (param ").concat(pRenderable,") because it does not exist."));return fCallback(Error("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," could not render ").concat(tmpRenderableHash," (param ").concat(pRenderable,") because it does not exist.")));}var tmpRenderDestinationAddress=typeof pRenderDestinationAddress==='string'?pRenderDestinationAddress:typeof tmpRenderable.ContentDestinationAddress==='string'?tmpRenderable.ContentDestinationAddress:typeof this.options.DefaultDestinationAddress==='string'?this.options.DefaultDestinationAddress:false;if(!tmpRenderDestinationAddress){this.log.error("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," could not render ").concat(tmpRenderableHash," (param ").concat(pRenderable,") because it does not have a valid destination address."));return fCallback(Error("Could not render ".concat(tmpRenderableHash)));}var tmpDataAddress=typeof pTemplateDataAddress==='string'?pTemplateDataAddress:typeof tmpRenderable.RecordAddress==='string'?tmpRenderable.RecordAddress:typeof this.options.DefaultTemplateRecordAddress==='string'?this.options.DefaultTemplateRecordAddress:false;var tmpData=typeof tmpDataAddress==='string'?this.fable.DataProvider.getDataByAddress(tmpDataAddress):undefined;this.fable.parseTemplateByHash(tmpRenderable.TemplateHash,tmpData,function(pError,pContent){if(pError){_this36.log.error("PictView [".concat(_this36.UUID,"]::[").concat(_this36.Hash,"] ").concat(_this36.options.ViewIdentifier," could not render (asynchronously) ").concat(tmpRenderableHash," (param ").concat(pRenderable,") because it did not parse the template."),pError);return fCallback(pError);}_this36.fable.ContentAssignment.assignContent(tmpRenderDestinationAddress,pContent);return fCallback(null,pContent);});}}]);return PictView;}(libFableServiceBase);module.exports=PictView;},{"fable-serviceproviderbase":33}],74:[function(require,module,exports){/**
1743
1758
  * Precedent Meta-Templating
1744
1759
  *
1745
1760
  * @license MIT
@@ -1762,7 +1777,7 @@ preDotState===1&&startDot===end-1&&startDot===startPart+1){if(end!==-1){if(start
1762
1777
  * @param {string} pString - The string to parse
1763
1778
  * @param {object} pData - Data to pass in as the second argument
1764
1779
  * @return {string} The result from the parser
1765
- */},{key:"parseString",value:function parseString(pString,pData){return this.StringParser.parseString(pString,this.ParseTree,pData);}}]);return Precedent;}();module.exports=Precedent;},{"./StringParser.js":73,"./WordTree.js":74}],73:[function(require,module,exports){/**
1780
+ */},{key:"parseString",value:function parseString(pString,pData){return this.StringParser.parseString(pString,this.ParseTree,pData);}}]);return Precedent;}();module.exports=Precedent;},{"./StringParser.js":75,"./WordTree.js":76}],75:[function(require,module,exports){/**
1766
1781
  * String Parser
1767
1782
  * @author Steven Velozo <steven@velozo.com>
1768
1783
  * @description Parse a string, properly processing each matched token in the word tree.
@@ -1823,7 +1838,7 @@ else{pParserState.Output+=pCharacter;}}/**
1823
1838
  * @param {string} pString - The string to parse.
1824
1839
  * @param {Object} pParseTree - The parse tree to begin parsing from (usually root)
1825
1840
  * @param {Object} pData - The data to pass to the function as a second parameter
1826
- */},{key:"parseString",value:function parseString(pString,pParseTree,pData){var tmpParserState=this.newParserState(pParseTree);for(var i=0;i<pString.length;i++){this.parseCharacter(pString[i],tmpParserState,pData);}this.flushOutputBuffer(tmpParserState);return tmpParserState.Output;}}]);return StringParser;}();module.exports=StringParser;},{}],74:[function(require,module,exports){/**
1841
+ */},{key:"parseString",value:function parseString(pString,pParseTree,pData){var tmpParserState=this.newParserState(pParseTree);for(var i=0;i<pString.length;i++){this.parseCharacter(pString[i],tmpParserState,pData);}this.flushOutputBuffer(tmpParserState);return tmpParserState.Output;}}]);return StringParser;}();module.exports=StringParser;},{}],76:[function(require,module,exports){/**
1827
1842
  * Word Tree
1828
1843
  * @author Steven Velozo <steven@velozo.com>
1829
1844
  * @description Create a tree (directed graph) of Javascript objects, one character per object.
@@ -1844,7 +1859,7 @@ else{pParserState.Output+=pCharacter;}}/**
1844
1859
  * @param {number} pParser - The function to parse if this is the matched pattern, once the Pattern End is met. If this is a string, a simple replacement occurs.
1845
1860
  * @return {bool} True if adding the pattern was successful
1846
1861
  */},{key:"addPattern",value:function addPattern(pPatternStart,pPatternEnd,pParser){if(pPatternStart.length<1)return false;if(typeof pPatternEnd==='string'&&pPatternEnd.length<1)return false;var tmpLeaf=this.ParseTree;// Add the tree of leaves iteratively
1847
- for(var i=0;i<pPatternStart.length;i++)tmpLeaf=this.addChild(tmpLeaf,pPatternStart,i);tmpLeaf.PatternStart=pPatternStart;tmpLeaf.PatternEnd=typeof pPatternEnd==='string'&&pPatternEnd.length>0?pPatternEnd:pPatternStart;tmpLeaf.Parse=typeof pParser==='function'?pParser:typeof pParser==='string'?function(){return pParser;}:function(pData){return pData;};return true;}}]);return WordTree;}();module.exports=WordTree;},{}],75:[function(require,module,exports){// shim for using process in browser
1862
+ for(var i=0;i<pPatternStart.length;i++)tmpLeaf=this.addChild(tmpLeaf,pPatternStart,i);tmpLeaf.PatternStart=pPatternStart;tmpLeaf.PatternEnd=typeof pPatternEnd==='string'&&pPatternEnd.length>0?pPatternEnd:pPatternStart;tmpLeaf.Parse=typeof pParser==='function'?pParser:typeof pParser==='string'?function(){return pParser;}:function(pData){return pData;};return true;}}]);return WordTree;}();module.exports=WordTree;},{}],77:[function(require,module,exports){// shim for using process in browser
1848
1863
  var process=module.exports={};// cached from whatever global is present so that test runners that stub it
1849
1864
  // don't break things. But we need to wrap it in a try catch in case it is
1850
1865
  // wrapped in strict mode code which doesn't define any globals. It's inside a
@@ -1862,7 +1877,7 @@ return cachedClearTimeout.call(null,marker);}catch(e){// same as above but when
1862
1877
  // Some versions of I.E. have different rules for clearTimeout vs setTimeout
1863
1878
  return cachedClearTimeout.call(this,marker);}}}var queue=[];var draining=false;var currentQueue;var queueIndex=-1;function cleanUpNextTick(){if(!draining||!currentQueue){return;}draining=false;if(currentQueue.length){queue=currentQueue.concat(queue);}else{queueIndex=-1;}if(queue.length){drainQueue();}}function drainQueue(){if(draining){return;}var timeout=runTimeout(cleanUpNextTick);draining=true;var len=queue.length;while(len){currentQueue=queue;queue=[];while(++queueIndex<len){if(currentQueue){currentQueue[queueIndex].run();}}queueIndex=-1;len=queue.length;}currentQueue=null;draining=false;runClearTimeout(timeout);}process.nextTick=function(fun){var args=new Array(arguments.length-1);if(arguments.length>1){for(var i=1;i<arguments.length;i++){args[i-1]=arguments[i];}}queue.push(new Item(fun,args));if(queue.length===1&&!draining){runTimeout(drainQueue);}};// v8 likes predictible objects
1864
1879
  function Item(fun,array){this.fun=fun;this.array=array;}Item.prototype.run=function(){this.fun.apply(null,this.array);};process.title='browser';process.browser=true;process.env={};process.argv=[];process.version='';// empty string to avoid regexp issues
1865
- process.versions={};function noop(){}process.on=noop;process.addListener=noop;process.once=noop;process.off=noop;process.removeListener=noop;process.removeAllListeners=noop;process.emit=noop;process.prependListener=noop;process.prependOnceListener=noop;process.listeners=function(name){return[];};process.binding=function(name){throw new Error('process.binding is not supported');};process.cwd=function(){return'/';};process.chdir=function(dir){throw new Error('process.chdir is not supported');};process.umask=function(){return 0;};},{}],76:[function(require,module,exports){(function(global){(function(){/*! https://mths.be/punycode v1.4.1 by @mathias */;(function(root){/** Detect free variables */var freeExports=_typeof(exports)=='object'&&exports&&!exports.nodeType&&exports;var freeModule=_typeof(module)=='object'&&module&&!module.nodeType&&module;var freeGlobal=_typeof(global)=='object'&&global;if(freeGlobal.global===freeGlobal||freeGlobal.window===freeGlobal||freeGlobal.self===freeGlobal){root=freeGlobal;}/**
1880
+ process.versions={};function noop(){}process.on=noop;process.addListener=noop;process.once=noop;process.off=noop;process.removeListener=noop;process.removeAllListeners=noop;process.emit=noop;process.prependListener=noop;process.prependOnceListener=noop;process.listeners=function(name){return[];};process.binding=function(name){throw new Error('process.binding is not supported');};process.cwd=function(){return'/';};process.chdir=function(dir){throw new Error('process.chdir is not supported');};process.umask=function(){return 0;};},{}],78:[function(require,module,exports){(function(global){(function(){/*! https://mths.be/punycode v1.4.1 by @mathias */;(function(root){/** Detect free variables */var freeExports=_typeof(exports)=='object'&&exports&&!exports.nodeType&&exports;var freeModule=_typeof(module)=='object'&&module&&!module.nodeType&&module;var freeGlobal=_typeof(global)=='object'&&global;if(freeGlobal.global===freeGlobal||freeGlobal.window===freeGlobal||freeGlobal.self===freeGlobal){root=freeGlobal;}/**
1866
1881
  * The `punycode` object.
1867
1882
  * @name punycode
1868
1883
  * @type Object
@@ -2017,7 +2032,7 @@ for/* no condition */(q=delta,k=base;;k+=base){t=k<=bias?tMin:k>=bias+tMax?tMax:
2017
2032
  if(typeof define=='function'&&_typeof(define.amd)=='object'&&define.amd){define('punycode',function(){return punycode;});}else if(freeExports&&freeModule){if(module.exports==freeExports){// in Node.js, io.js, or RingoJS v0.8.0+
2018
2033
  freeModule.exports=punycode;}else{// in Narwhal or RingoJS v0.7.0-
2019
2034
  for(key in punycode){punycode.hasOwnProperty(key)&&(freeExports[key]=punycode[key]);}}}else{// in Rhino or a web browser
2020
- root.punycode=punycode;}})(this);}).call(this);}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{});},{}],77:[function(require,module,exports){// Copyright Joyent, Inc. and other Node contributors.
2035
+ root.punycode=punycode;}})(this);}).call(this);}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{});},{}],79:[function(require,module,exports){// Copyright Joyent, Inc. and other Node contributors.
2021
2036
  //
2022
2037
  // Permission is hereby granted, free of charge, to any person obtaining a
2023
2038
  // copy of this software and associated documentation files (the
@@ -2041,7 +2056,7 @@ root.punycode=punycode;}})(this);}).call(this);}).call(this,typeof global!=="und
2041
2056
  // obj.hasOwnProperty(prop) will break.
2042
2057
  // See: https://github.com/joyent/node/issues/1707
2043
2058
  function hasOwnProperty(obj,prop){return Object.prototype.hasOwnProperty.call(obj,prop);}module.exports=function(qs,sep,eq,options){sep=sep||'&';eq=eq||'=';var obj={};if(typeof qs!=='string'||qs.length===0){return obj;}var regexp=/\+/g;qs=qs.split(sep);var maxKeys=1000;if(options&&typeof options.maxKeys==='number'){maxKeys=options.maxKeys;}var len=qs.length;// maxKeys <= 0 means that we should not limit keys count
2044
- if(maxKeys>0&&len>maxKeys){len=maxKeys;}for(var i=0;i<len;++i){var x=qs[i].replace(regexp,'%20'),idx=x.indexOf(eq),kstr,vstr,k,v;if(idx>=0){kstr=x.substr(0,idx);vstr=x.substr(idx+1);}else{kstr=x;vstr='';}k=decodeURIComponent(kstr);v=decodeURIComponent(vstr);if(!hasOwnProperty(obj,k)){obj[k]=v;}else if(isArray(obj[k])){obj[k].push(v);}else{obj[k]=[obj[k],v];}}return obj;};var isArray=Array.isArray||function(xs){return Object.prototype.toString.call(xs)==='[object Array]';};},{}],78:[function(require,module,exports){// Copyright Joyent, Inc. and other Node contributors.
2059
+ if(maxKeys>0&&len>maxKeys){len=maxKeys;}for(var i=0;i<len;++i){var x=qs[i].replace(regexp,'%20'),idx=x.indexOf(eq),kstr,vstr,k,v;if(idx>=0){kstr=x.substr(0,idx);vstr=x.substr(idx+1);}else{kstr=x;vstr='';}k=decodeURIComponent(kstr);v=decodeURIComponent(vstr);if(!hasOwnProperty(obj,k)){obj[k]=v;}else if(isArray(obj[k])){obj[k].push(v);}else{obj[k]=[obj[k],v];}}return obj;};var isArray=Array.isArray||function(xs){return Object.prototype.toString.call(xs)==='[object Array]';};},{}],80:[function(require,module,exports){// Copyright Joyent, Inc. and other Node contributors.
2045
2060
  //
2046
2061
  // Permission is hereby granted, free of charge, to any person obtaining a
2047
2062
  // copy of this software and associated documentation files (the
@@ -2061,10 +2076,10 @@ if(maxKeys>0&&len>maxKeys){len=maxKeys;}for(var i=0;i<len;++i){var x=qs[i].repla
2061
2076
  // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
2062
2077
  // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
2063
2078
  // USE OR OTHER DEALINGS IN THE SOFTWARE.
2064
- 'use strict';var stringifyPrimitive=function stringifyPrimitive(v){switch(_typeof(v)){case'string':return v;case'boolean':return v?'true':'false';case'number':return isFinite(v)?v:'';default:return'';}};module.exports=function(obj,sep,eq,name){sep=sep||'&';eq=eq||'=';if(obj===null){obj=undefined;}if(_typeof(obj)==='object'){return map(objectKeys(obj),function(k){var ks=encodeURIComponent(stringifyPrimitive(k))+eq;if(isArray(obj[k])){return map(obj[k],function(v){return ks+encodeURIComponent(stringifyPrimitive(v));}).join(sep);}else{return ks+encodeURIComponent(stringifyPrimitive(obj[k]));}}).join(sep);}if(!name)return'';return encodeURIComponent(stringifyPrimitive(name))+eq+encodeURIComponent(stringifyPrimitive(obj));};var isArray=Array.isArray||function(xs){return Object.prototype.toString.call(xs)==='[object Array]';};function map(xs,f){if(xs.map)return xs.map(f);var res=[];for(var i=0;i<xs.length;i++){res.push(f(xs[i],i));}return res;}var objectKeys=Object.keys||function(obj){var res=[];for(var key in obj){if(Object.prototype.hasOwnProperty.call(obj,key))res.push(key);}return res;};},{}],79:[function(require,module,exports){'use strict';exports.decode=exports.parse=require('./decode');exports.encode=exports.stringify=require('./encode');},{"./decode":77,"./encode":78}],80:[function(require,module,exports){/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */ /* eslint-disable node/no-deprecated-api */var buffer=require('buffer');var Buffer=buffer.Buffer;// alternative to using Object.keys for old browsers
2079
+ 'use strict';var stringifyPrimitive=function stringifyPrimitive(v){switch(_typeof(v)){case'string':return v;case'boolean':return v?'true':'false';case'number':return isFinite(v)?v:'';default:return'';}};module.exports=function(obj,sep,eq,name){sep=sep||'&';eq=eq||'=';if(obj===null){obj=undefined;}if(_typeof(obj)==='object'){return map(objectKeys(obj),function(k){var ks=encodeURIComponent(stringifyPrimitive(k))+eq;if(isArray(obj[k])){return map(obj[k],function(v){return ks+encodeURIComponent(stringifyPrimitive(v));}).join(sep);}else{return ks+encodeURIComponent(stringifyPrimitive(obj[k]));}}).join(sep);}if(!name)return'';return encodeURIComponent(stringifyPrimitive(name))+eq+encodeURIComponent(stringifyPrimitive(obj));};var isArray=Array.isArray||function(xs){return Object.prototype.toString.call(xs)==='[object Array]';};function map(xs,f){if(xs.map)return xs.map(f);var res=[];for(var i=0;i<xs.length;i++){res.push(f(xs[i],i));}return res;}var objectKeys=Object.keys||function(obj){var res=[];for(var key in obj){if(Object.prototype.hasOwnProperty.call(obj,key))res.push(key);}return res;};},{}],81:[function(require,module,exports){'use strict';exports.decode=exports.parse=require('./decode');exports.encode=exports.stringify=require('./encode');},{"./decode":79,"./encode":80}],82:[function(require,module,exports){/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */ /* eslint-disable node/no-deprecated-api */var buffer=require('buffer');var Buffer=buffer.Buffer;// alternative to using Object.keys for old browsers
2065
2080
  function copyProps(src,dst){for(var key in src){dst[key]=src[key];}}if(Buffer.from&&Buffer.alloc&&Buffer.allocUnsafe&&Buffer.allocUnsafeSlow){module.exports=buffer;}else{// Copy properties from require('buffer')
2066
2081
  copyProps(buffer,exports);exports.Buffer=SafeBuffer;}function SafeBuffer(arg,encodingOrOffset,length){return Buffer(arg,encodingOrOffset,length);}SafeBuffer.prototype=Object.create(Buffer.prototype);// Copy static methods from Buffer
2067
- copyProps(Buffer,SafeBuffer);SafeBuffer.from=function(arg,encodingOrOffset,length){if(typeof arg==='number'){throw new TypeError('Argument must not be a number');}return Buffer(arg,encodingOrOffset,length);};SafeBuffer.alloc=function(size,fill,encoding){if(typeof size!=='number'){throw new TypeError('Argument must be a number');}var buf=Buffer(size);if(fill!==undefined){if(typeof encoding==='string'){buf.fill(fill,encoding);}else{buf.fill(fill);}}else{buf.fill(0);}return buf;};SafeBuffer.allocUnsafe=function(size){if(typeof size!=='number'){throw new TypeError('Argument must be a number');}return Buffer(size);};SafeBuffer.allocUnsafeSlow=function(size){if(typeof size!=='number'){throw new TypeError('Argument must be a number');}return buffer.SlowBuffer(size);};},{"buffer":19}],81:[function(require,module,exports){(function(Buffer){(function(){/*! simple-concat. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */module.exports=function(stream,cb){var chunks=[];stream.on('data',function(chunk){chunks.push(chunk);});stream.once('end',function(){if(cb)cb(null,Buffer.concat(chunks));cb=null;});stream.once('error',function(err){if(cb)cb(err);cb=null;});};}).call(this);}).call(this,require("buffer").Buffer);},{"buffer":19}],82:[function(require,module,exports){(function(Buffer){(function(){/*! simple-get. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */module.exports=simpleGet;var concat=require('simple-concat');var decompressResponse=require('decompress-response');// excluded from browser build
2082
+ copyProps(Buffer,SafeBuffer);SafeBuffer.from=function(arg,encodingOrOffset,length){if(typeof arg==='number'){throw new TypeError('Argument must not be a number');}return Buffer(arg,encodingOrOffset,length);};SafeBuffer.alloc=function(size,fill,encoding){if(typeof size!=='number'){throw new TypeError('Argument must be a number');}var buf=Buffer(size);if(fill!==undefined){if(typeof encoding==='string'){buf.fill(fill,encoding);}else{buf.fill(fill);}}else{buf.fill(0);}return buf;};SafeBuffer.allocUnsafe=function(size){if(typeof size!=='number'){throw new TypeError('Argument must be a number');}return Buffer(size);};SafeBuffer.allocUnsafeSlow=function(size){if(typeof size!=='number'){throw new TypeError('Argument must be a number');}return buffer.SlowBuffer(size);};},{"buffer":19}],83:[function(require,module,exports){(function(Buffer){(function(){/*! simple-concat. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */module.exports=function(stream,cb){var chunks=[];stream.on('data',function(chunk){chunks.push(chunk);});stream.once('end',function(){if(cb)cb(null,Buffer.concat(chunks));cb=null;});stream.once('error',function(err){if(cb)cb(err);cb=null;});};}).call(this);}).call(this,require("buffer").Buffer);},{"buffer":19}],84:[function(require,module,exports){(function(Buffer){(function(){/*! simple-get. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */module.exports=simpleGet;var concat=require('simple-concat');var decompressResponse=require('decompress-response');// excluded from browser build
2068
2083
  var http=require('http');var https=require('https');var once=require('once');var querystring=require('querystring');var url=require('url');var isStream=function isStream(o){return o!==null&&_typeof(o)==='object'&&typeof o.pipe==='function';};function simpleGet(opts,cb){opts=Object.assign({maxRedirects:10},typeof opts==='string'?{url:opts}:opts);cb=once(cb);if(opts.url){var _url$parse=url.parse(opts.url),hostname=_url$parse.hostname,port=_url$parse.port,_protocol=_url$parse.protocol,auth=_url$parse.auth,path=_url$parse.path;// eslint-disable-line node/no-deprecated-api
2069
2084
  delete opts.url;if(!hostname&&!port&&!_protocol&&!auth)opts.path=path;// Relative redirect
2070
2085
  else Object.assign(opts,{hostname:hostname,port:port,protocol:_protocol,auth:auth,path:path});// Absolute redirect
@@ -2076,13 +2091,13 @@ res.resume();// Discard response
2076
2091
  var redirectHost=url.parse(opts.url).hostname;// eslint-disable-line node/no-deprecated-api
2077
2092
  // If redirected host is different than original host, drop headers to prevent cookie leak (#73)
2078
2093
  if(redirectHost!==null&&redirectHost!==originalHost){delete opts.headers.cookie;delete opts.headers.authorization;}if(opts.method==='POST'&&[301,302].includes(res.statusCode)){opts.method='GET';// On 301/302 redirect, change POST to GET (see #35)
2079
- delete opts.headers['content-length'];delete opts.headers['content-type'];}if(opts.maxRedirects--===0)return cb(new Error('too many redirects'));else return simpleGet(opts,cb);}var tryUnzip=typeof decompressResponse==='function'&&opts.method!=='HEAD';cb(null,tryUnzip?decompressResponse(res):res);});req.on('timeout',function(){req.abort();cb(new Error('Request timed out'));});req.on('error',cb);if(isStream(body))body.on('error',cb).pipe(req);else req.end(body);return req;}simpleGet.concat=function(opts,cb){return simpleGet(opts,function(err,res){if(err)return cb(err);concat(res,function(err,data){if(err)return cb(err);if(opts.json){try{data=JSON.parse(data.toString());}catch(err){return cb(err,res,data);}}cb(null,res,data);});});};['get','post','put','patch','head','delete'].forEach(function(method){simpleGet[method]=function(opts,cb){if(typeof opts==='string')opts={url:opts};return simpleGet(Object.assign({method:method.toUpperCase()},opts),cb);};});}).call(this);}).call(this,require("buffer").Buffer);},{"buffer":19,"decompress-response":17,"http":83,"https":56,"once":70,"querystring":79,"simple-concat":81,"url":104}],83:[function(require,module,exports){(function(global){(function(){var ClientRequest=require('./lib/request');var response=require('./lib/response');var extend=require('xtend');var statusCodes=require('builtin-status-codes');var url=require('url');var http=exports;http.request=function(opts,cb){if(typeof opts==='string')opts=url.parse(opts);else opts=extend(opts);// Normally, the page is loaded from http or https, so not specifying a protocol
2094
+ delete opts.headers['content-length'];delete opts.headers['content-type'];}if(opts.maxRedirects--===0)return cb(new Error('too many redirects'));else return simpleGet(opts,cb);}var tryUnzip=typeof decompressResponse==='function'&&opts.method!=='HEAD';cb(null,tryUnzip?decompressResponse(res):res);});req.on('timeout',function(){req.abort();cb(new Error('Request timed out'));});req.on('error',cb);if(isStream(body))body.on('error',cb).pipe(req);else req.end(body);return req;}simpleGet.concat=function(opts,cb){return simpleGet(opts,function(err,res){if(err)return cb(err);concat(res,function(err,data){if(err)return cb(err);if(opts.json){try{data=JSON.parse(data.toString());}catch(err){return cb(err,res,data);}}cb(null,res,data);});});};['get','post','put','patch','head','delete'].forEach(function(method){simpleGet[method]=function(opts,cb){if(typeof opts==='string')opts={url:opts};return simpleGet(Object.assign({method:method.toUpperCase()},opts),cb);};});}).call(this);}).call(this,require("buffer").Buffer);},{"buffer":19,"decompress-response":17,"http":85,"https":56,"once":70,"querystring":81,"simple-concat":83,"url":106}],85:[function(require,module,exports){(function(global){(function(){var ClientRequest=require('./lib/request');var response=require('./lib/response');var extend=require('xtend');var statusCodes=require('builtin-status-codes');var url=require('url');var http=exports;http.request=function(opts,cb){if(typeof opts==='string')opts=url.parse(opts);else opts=extend(opts);// Normally, the page is loaded from http or https, so not specifying a protocol
2080
2095
  // will result in a (valid) protocol-relative url. However, this won't work if
2081
2096
  // the protocol is something else, like 'file:'
2082
2097
  var defaultProtocol=global.location.protocol.search(/^https?:$/)===-1?'http:':'';var protocol=opts.protocol||defaultProtocol;var host=opts.hostname||opts.host;var port=opts.port;var path=opts.path||'/';// Necessary for IPv6 addresses
2083
2098
  if(host&&host.indexOf(':')!==-1)host='['+host+']';// This may be a relative url. The browser should always be able to interpret it correctly.
2084
2099
  opts.url=(host?protocol+'//'+host:'')+(port?':'+port:'')+path;opts.method=(opts.method||'GET').toUpperCase();opts.headers=opts.headers||{};// Also valid opts.auth, opts.mode
2085
- var req=new ClientRequest(opts);if(cb)req.on('response',cb);return req;};http.get=function get(opts,cb){var req=http.request(opts,cb);req.end();return req;};http.ClientRequest=ClientRequest;http.IncomingMessage=response.IncomingMessage;http.Agent=function(){};http.Agent.defaultMaxSockets=4;http.globalAgent=new http.Agent();http.STATUS_CODES=statusCodes;http.METHODS=['CHECKOUT','CONNECT','COPY','DELETE','GET','HEAD','LOCK','M-SEARCH','MERGE','MKACTIVITY','MKCOL','MOVE','NOTIFY','OPTIONS','PATCH','POST','PROPFIND','PROPPATCH','PURGE','PUT','REPORT','SEARCH','SUBSCRIBE','TRACE','UNLOCK','UNSUBSCRIBE'];}).call(this);}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{});},{"./lib/request":85,"./lib/response":86,"builtin-status-codes":20,"url":104,"xtend":108}],84:[function(require,module,exports){(function(global){(function(){exports.fetch=isFunction(global.fetch)&&isFunction(global.ReadableStream);exports.writableStream=isFunction(global.WritableStream);exports.abortController=isFunction(global.AbortController);// The xhr request to example.com may violate some restrictive CSP configurations,
2100
+ var req=new ClientRequest(opts);if(cb)req.on('response',cb);return req;};http.get=function get(opts,cb){var req=http.request(opts,cb);req.end();return req;};http.ClientRequest=ClientRequest;http.IncomingMessage=response.IncomingMessage;http.Agent=function(){};http.Agent.defaultMaxSockets=4;http.globalAgent=new http.Agent();http.STATUS_CODES=statusCodes;http.METHODS=['CHECKOUT','CONNECT','COPY','DELETE','GET','HEAD','LOCK','M-SEARCH','MERGE','MKACTIVITY','MKCOL','MOVE','NOTIFY','OPTIONS','PATCH','POST','PROPFIND','PROPPATCH','PURGE','PUT','REPORT','SEARCH','SUBSCRIBE','TRACE','UNLOCK','UNSUBSCRIBE'];}).call(this);}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{});},{"./lib/request":87,"./lib/response":88,"builtin-status-codes":20,"url":106,"xtend":110}],86:[function(require,module,exports){(function(global){(function(){exports.fetch=isFunction(global.fetch)&&isFunction(global.ReadableStream);exports.writableStream=isFunction(global.WritableStream);exports.abortController=isFunction(global.AbortController);// The xhr request to example.com may violate some restrictive CSP configurations,
2086
2101
  // so if we're running in a browser that supports `fetch`, avoid calling getXHR()
2087
2102
  // and assume support for certain features below.
2088
2103
  var xhr;function getXHR(){// Cache the xhr value
@@ -2097,7 +2112,7 @@ exports.arraybuffer=exports.fetch||checkTypeSupport('arraybuffer');// These next
2097
2112
  exports.msstream=!exports.fetch&&checkTypeSupport('ms-stream');exports.mozchunkedarraybuffer=!exports.fetch&&checkTypeSupport('moz-chunked-arraybuffer');// If fetch is supported, then overrideMimeType will be supported too. Skip calling
2098
2113
  // getXHR().
2099
2114
  exports.overrideMimeType=exports.fetch||(getXHR()?isFunction(getXHR().overrideMimeType):false);function isFunction(value){return typeof value==='function';}xhr=null;// Help gc
2100
- }).call(this);}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{});},{}],85:[function(require,module,exports){(function(process,global,Buffer){(function(){var capability=require('./capability');var inherits=require('inherits');var response=require('./response');var stream=require('readable-stream');var IncomingMessage=response.IncomingMessage;var rStates=response.readyStates;function decideMode(preferBinary,useFetch){if(capability.fetch&&useFetch){return'fetch';}else if(capability.mozchunkedarraybuffer){return'moz-chunked-arraybuffer';}else if(capability.msstream){return'ms-stream';}else if(capability.arraybuffer&&preferBinary){return'arraybuffer';}else{return'text';}}var ClientRequest=module.exports=function(opts){var self=this;stream.Writable.call(self);self._opts=opts;self._body=[];self._headers={};if(opts.auth)self.setHeader('Authorization','Basic '+Buffer.from(opts.auth).toString('base64'));Object.keys(opts.headers).forEach(function(name){self.setHeader(name,opts.headers[name]);});var preferBinary;var useFetch=true;if(opts.mode==='disable-fetch'||'requestTimeout'in opts&&!capability.abortController){// If the use of XHR should be preferred. Not typically needed.
2115
+ }).call(this);}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{});},{}],87:[function(require,module,exports){(function(process,global,Buffer){(function(){var capability=require('./capability');var inherits=require('inherits');var response=require('./response');var stream=require('readable-stream');var IncomingMessage=response.IncomingMessage;var rStates=response.readyStates;function decideMode(preferBinary,useFetch){if(capability.fetch&&useFetch){return'fetch';}else if(capability.mozchunkedarraybuffer){return'moz-chunked-arraybuffer';}else if(capability.msstream){return'ms-stream';}else if(capability.arraybuffer&&preferBinary){return'arraybuffer';}else{return'text';}}var ClientRequest=module.exports=function(opts){var self=this;stream.Writable.call(self);self._opts=opts;self._body=[];self._headers={};if(opts.auth)self.setHeader('Authorization','Basic '+Buffer.from(opts.auth).toString('base64'));Object.keys(opts.headers).forEach(function(name){self.setHeader(name,opts.headers[name]);});var preferBinary;var useFetch=true;if(opts.mode==='disable-fetch'||'requestTimeout'in opts&&!capability.abortController){// If the use of XHR should be preferred. Not typically needed.
2101
2116
  useFetch=false;preferBinary=true;}else if(opts.mode==='prefer-streaming'){// If streaming is a high priority but binary compatibility and
2102
2117
  // the accuracy of the 'content-type' header aren't
2103
2118
  preferBinary=false;}else if(opts.mode==='allow-wrong-content-type'){// If streaming is more important than preserving the 'content-type' header
@@ -2114,7 +2129,7 @@ if(self._mode==='moz-chunked-arraybuffer'){xhr.onprogress=function(){self._onXHR
2114
2129
  * Even though the spec says it should be available in readyState 3,
2115
2130
  * accessing it throws an exception in IE8
2116
2131
  */function statusValid(xhr){try{var status=xhr.status;return status!==null&&status!==0;}catch(e){return false;}}ClientRequest.prototype._onXHRProgress=function(){var self=this;self._resetTimers(false);if(!statusValid(self._xhr)||self._destroyed)return;if(!self._response)self._connect();self._response._onXHRProgress(self._resetTimers.bind(self));};ClientRequest.prototype._connect=function(){var self=this;if(self._destroyed)return;self._response=new IncomingMessage(self._xhr,self._fetchResponse,self._mode,self._resetTimers.bind(self));self._response.on('error',function(err){self.emit('error',err);});self.emit('response',self._response);};ClientRequest.prototype._write=function(chunk,encoding,cb){var self=this;self._body.push(chunk);cb();};ClientRequest.prototype._resetTimers=function(done){var self=this;global.clearTimeout(self._socketTimer);self._socketTimer=null;if(done){global.clearTimeout(self._fetchTimer);self._fetchTimer=null;}else if(self._socketTimeout){self._socketTimer=global.setTimeout(function(){self.emit('timeout');},self._socketTimeout);}};ClientRequest.prototype.abort=ClientRequest.prototype.destroy=function(err){var self=this;self._destroyed=true;self._resetTimers(true);if(self._response)self._response._destroyed=true;if(self._xhr)self._xhr.abort();else if(self._fetchAbortController)self._fetchAbortController.abort();if(err)self.emit('error',err);};ClientRequest.prototype.end=function(data,encoding,cb){var self=this;if(typeof data==='function'){cb=data;data=undefined;}stream.Writable.prototype.end.call(self,data,encoding,cb);};ClientRequest.prototype.setTimeout=function(timeout,cb){var self=this;if(cb)self.once('timeout',cb);self._socketTimeout=timeout;self._resetTimers(false);};ClientRequest.prototype.flushHeaders=function(){};ClientRequest.prototype.setNoDelay=function(){};ClientRequest.prototype.setSocketKeepAlive=function(){};// Taken from http://www.w3.org/TR/XMLHttpRequest/#the-setrequestheader%28%29-method
2117
- var unsafeHeaders=['accept-charset','accept-encoding','access-control-request-headers','access-control-request-method','connection','content-length','cookie','cookie2','date','dnt','expect','host','keep-alive','origin','referer','te','trailer','transfer-encoding','upgrade','via'];}).call(this);}).call(this,require('_process'),typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{},require("buffer").Buffer);},{"./capability":84,"./response":86,"_process":75,"buffer":19,"inherits":58,"readable-stream":101}],86:[function(require,module,exports){(function(process,global,Buffer){(function(){var capability=require('./capability');var inherits=require('inherits');var stream=require('readable-stream');var rStates=exports.readyStates={UNSENT:0,OPENED:1,HEADERS_RECEIVED:2,LOADING:3,DONE:4};var IncomingMessage=exports.IncomingMessage=function(xhr,response,mode,resetTimers){var self=this;stream.Readable.call(self);self._mode=mode;self.headers={};self.rawHeaders=[];self.trailers={};self.rawTrailers=[];// Fake the 'close' event, but only once 'end' fires
2132
+ var unsafeHeaders=['accept-charset','accept-encoding','access-control-request-headers','access-control-request-method','connection','content-length','cookie','cookie2','date','dnt','expect','host','keep-alive','origin','referer','te','trailer','transfer-encoding','upgrade','via'];}).call(this);}).call(this,require('_process'),typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{},require("buffer").Buffer);},{"./capability":86,"./response":88,"_process":77,"buffer":19,"inherits":58,"readable-stream":103}],88:[function(require,module,exports){(function(process,global,Buffer){(function(){var capability=require('./capability');var inherits=require('inherits');var stream=require('readable-stream');var rStates=exports.readyStates={UNSENT:0,OPENED:1,HEADERS_RECEIVED:2,LOADING:3,DONE:4};var IncomingMessage=exports.IncomingMessage=function(xhr,response,mode,resetTimers){var self=this;stream.Readable.call(self);self._mode=mode;self.headers={};self.rawHeaders=[];self.trailers={};self.rawTrailers=[];// Fake the 'close' event, but only once 'end' fires
2118
2133
  self.on('end',function(){// The nextTick is necessary to prevent the 'request' module from causing an infinite loop
2119
2134
  process.nextTick(function(){self.emit('close');});});if(mode==='fetch'){var read=function read(){reader.read().then(function(result){if(self._destroyed)return;resetTimers(result.done);if(result.done){self.push(null);return;}self.push(Buffer.from(result.value));read();})["catch"](function(err){resetTimers(true);if(!self._destroyed)self.emit('error',err);});};self._fetchResponse=response;self.url=response.url;self.statusCode=response.status;self.statusMessage=response.statusText;response.headers.forEach(function(header,key){self.headers[key.toLowerCase()]=header;self.rawHeaders.push(key,header);});if(capability.writableStream){var writable=new WritableStream({write:function write(chunk){resetTimers(false);return new Promise(function(resolve,reject){if(self._destroyed){reject();}else if(self.push(Buffer.from(chunk))){resolve();}else{self._resumeFetch=resolve;}});},close:function close(){resetTimers(true);if(!self._destroyed)self.push(null);},abort:function abort(err){resetTimers(true);if(!self._destroyed)self.emit('error',err);}});try{response.body.pipeTo(writable)["catch"](function(err){resetTimers(true);if(!self._destroyed)self.emit('error',err);});return;}catch(e){}// pipeTo method isn't defined. Can't find a better way to feature test this
2120
2135
  }// fallback for when writableStream or pipeTo aren't available
@@ -2122,13 +2137,13 @@ var reader=response.body.getReader();read();}else{self._xhr=xhr;self._pos=0;self
2122
2137
  }}};inherits(IncomingMessage,stream.Readable);IncomingMessage.prototype._read=function(){var self=this;var resolve=self._resumeFetch;if(resolve){self._resumeFetch=null;resolve();}};IncomingMessage.prototype._onXHRProgress=function(resetTimers){var self=this;var xhr=self._xhr;var response=null;switch(self._mode){case'text':response=xhr.responseText;if(response.length>self._pos){var newData=response.substr(self._pos);if(self._charset==='x-user-defined'){var buffer=Buffer.alloc(newData.length);for(var i=0;i<newData.length;i++)buffer[i]=newData.charCodeAt(i)&0xff;self.push(buffer);}else{self.push(newData,self._charset);}self._pos=response.length;}break;case'arraybuffer':if(xhr.readyState!==rStates.DONE||!xhr.response)break;response=xhr.response;self.push(Buffer.from(new Uint8Array(response)));break;case'moz-chunked-arraybuffer':// take whole
2123
2138
  response=xhr.response;if(xhr.readyState!==rStates.LOADING||!response)break;self.push(Buffer.from(new Uint8Array(response)));break;case'ms-stream':response=xhr.response;if(xhr.readyState!==rStates.LOADING)break;var reader=new global.MSStreamReader();reader.onprogress=function(){if(reader.result.byteLength>self._pos){self.push(Buffer.from(new Uint8Array(reader.result.slice(self._pos))));self._pos=reader.result.byteLength;}};reader.onload=function(){resetTimers(true);self.push(null);};// reader.onerror = ??? // TODO: this
2124
2139
  reader.readAsArrayBuffer(response);break;}// The ms-stream case handles end separately in reader.onload()
2125
- if(self._xhr.readyState===rStates.DONE&&self._mode!=='ms-stream'){resetTimers(true);self.push(null);}};}).call(this);}).call(this,require('_process'),typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{},require("buffer").Buffer);},{"./capability":84,"_process":75,"buffer":19,"inherits":58,"readable-stream":101}],87:[function(require,module,exports){'use strict';function _inheritsLoose(subClass,superClass){subClass.prototype=Object.create(superClass.prototype);subClass.prototype.constructor=subClass;subClass.__proto__=superClass;}var codes={};function createErrorType(code,message,Base){if(!Base){Base=Error;}function getMessage(arg1,arg2,arg3){if(typeof message==='string'){return message;}else{return message(arg1,arg2,arg3);}}var NodeError=/*#__PURE__*/function(_Base){_inheritsLoose(NodeError,_Base);function NodeError(arg1,arg2,arg3){return _Base.call(this,getMessage(arg1,arg2,arg3))||this;}return NodeError;}(Base);NodeError.prototype.name=Base.name;NodeError.prototype.code=code;codes[code]=NodeError;}// https://github.com/nodejs/node/blob/v10.8.0/lib/internal/errors.js
2140
+ if(self._xhr.readyState===rStates.DONE&&self._mode!=='ms-stream'){resetTimers(true);self.push(null);}};}).call(this);}).call(this,require('_process'),typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{},require("buffer").Buffer);},{"./capability":86,"_process":77,"buffer":19,"inherits":58,"readable-stream":103}],89:[function(require,module,exports){'use strict';function _inheritsLoose(subClass,superClass){subClass.prototype=Object.create(superClass.prototype);subClass.prototype.constructor=subClass;subClass.__proto__=superClass;}var codes={};function createErrorType(code,message,Base){if(!Base){Base=Error;}function getMessage(arg1,arg2,arg3){if(typeof message==='string'){return message;}else{return message(arg1,arg2,arg3);}}var NodeError=/*#__PURE__*/function(_Base){_inheritsLoose(NodeError,_Base);function NodeError(arg1,arg2,arg3){return _Base.call(this,getMessage(arg1,arg2,arg3))||this;}return NodeError;}(Base);NodeError.prototype.name=Base.name;NodeError.prototype.code=code;codes[code]=NodeError;}// https://github.com/nodejs/node/blob/v10.8.0/lib/internal/errors.js
2126
2141
  function oneOf(expected,thing){if(Array.isArray(expected)){var len=expected.length;expected=expected.map(function(i){return String(i);});if(len>2){return"one of ".concat(thing," ").concat(expected.slice(0,len-1).join(', '),", or ")+expected[len-1];}else if(len===2){return"one of ".concat(thing," ").concat(expected[0]," or ").concat(expected[1]);}else{return"of ".concat(thing," ").concat(expected[0]);}}else{return"of ".concat(thing," ").concat(String(expected));}}// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/startsWith
2127
2142
  function startsWith(str,search,pos){return str.substr(!pos||pos<0?0:+pos,search.length)===search;}// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/endsWith
2128
2143
  function endsWith(str,search,this_len){if(this_len===undefined||this_len>str.length){this_len=str.length;}return str.substring(this_len-search.length,this_len)===search;}// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/includes
2129
2144
  function includes(str,search,start){if(typeof start!=='number'){start=0;}if(start+search.length>str.length){return false;}else{return str.indexOf(search,start)!==-1;}}createErrorType('ERR_INVALID_OPT_VALUE',function(name,value){return'The value "'+value+'" is invalid for option "'+name+'"';},TypeError);createErrorType('ERR_INVALID_ARG_TYPE',function(name,expected,actual){// determiner: 'must be' or 'must not be'
2130
2145
  var determiner;if(typeof expected==='string'&&startsWith(expected,'not ')){determiner='must not be';expected=expected.replace(/^not /,'');}else{determiner='must be';}var msg;if(endsWith(name,' argument')){// For cases like 'first argument'
2131
- msg="The ".concat(name," ").concat(determiner," ").concat(oneOf(expected,'type'));}else{var type=includes(name,'.')?'property':'argument';msg="The \"".concat(name,"\" ").concat(type," ").concat(determiner," ").concat(oneOf(expected,'type'));}msg+=". Received type ".concat(_typeof(actual));return msg;},TypeError);createErrorType('ERR_STREAM_PUSH_AFTER_EOF','stream.push() after EOF');createErrorType('ERR_METHOD_NOT_IMPLEMENTED',function(name){return'The '+name+' method is not implemented';});createErrorType('ERR_STREAM_PREMATURE_CLOSE','Premature close');createErrorType('ERR_STREAM_DESTROYED',function(name){return'Cannot call '+name+' after a stream was destroyed';});createErrorType('ERR_MULTIPLE_CALLBACK','Callback called multiple times');createErrorType('ERR_STREAM_CANNOT_PIPE','Cannot pipe, not readable');createErrorType('ERR_STREAM_WRITE_AFTER_END','write after end');createErrorType('ERR_STREAM_NULL_VALUES','May not write null values to stream',TypeError);createErrorType('ERR_UNKNOWN_ENCODING',function(arg){return'Unknown encoding: '+arg;},TypeError);createErrorType('ERR_STREAM_UNSHIFT_AFTER_END_EVENT','stream.unshift() after end event');module.exports.codes=codes;},{}],88:[function(require,module,exports){(function(process){(function(){// Copyright Joyent, Inc. and other Node contributors.
2146
+ msg="The ".concat(name," ").concat(determiner," ").concat(oneOf(expected,'type'));}else{var type=includes(name,'.')?'property':'argument';msg="The \"".concat(name,"\" ").concat(type," ").concat(determiner," ").concat(oneOf(expected,'type'));}msg+=". Received type ".concat(_typeof(actual));return msg;},TypeError);createErrorType('ERR_STREAM_PUSH_AFTER_EOF','stream.push() after EOF');createErrorType('ERR_METHOD_NOT_IMPLEMENTED',function(name){return'The '+name+' method is not implemented';});createErrorType('ERR_STREAM_PREMATURE_CLOSE','Premature close');createErrorType('ERR_STREAM_DESTROYED',function(name){return'Cannot call '+name+' after a stream was destroyed';});createErrorType('ERR_MULTIPLE_CALLBACK','Callback called multiple times');createErrorType('ERR_STREAM_CANNOT_PIPE','Cannot pipe, not readable');createErrorType('ERR_STREAM_WRITE_AFTER_END','write after end');createErrorType('ERR_STREAM_NULL_VALUES','May not write null values to stream',TypeError);createErrorType('ERR_UNKNOWN_ENCODING',function(arg){return'Unknown encoding: '+arg;},TypeError);createErrorType('ERR_STREAM_UNSHIFT_AFTER_END_EVENT','stream.unshift() after end event');module.exports.codes=codes;},{}],90:[function(require,module,exports){(function(process){(function(){// Copyright Joyent, Inc. and other Node contributors.
2132
2147
  //
2133
2148
  // Permission is hereby granted, free of charge, to any person obtaining a
2134
2149
  // copy of this software and associated documentation files (the
@@ -2173,7 +2188,7 @@ enumerable:false,get:function get(){if(this._readableState===undefined||this._wr
2173
2188
  // has not been initialized yet
2174
2189
  if(this._readableState===undefined||this._writableState===undefined){return;}// backward compatibility, the user is explicitly
2175
2190
  // managing destroyed
2176
- this._readableState.destroyed=value;this._writableState.destroyed=value;}});}).call(this);}).call(this,require('_process'));},{"./_stream_readable":90,"./_stream_writable":92,"_process":75,"inherits":58}],89:[function(require,module,exports){// Copyright Joyent, Inc. and other Node contributors.
2191
+ this._readableState.destroyed=value;this._writableState.destroyed=value;}});}).call(this);}).call(this,require('_process'));},{"./_stream_readable":92,"./_stream_writable":94,"_process":77,"inherits":58}],91:[function(require,module,exports){// Copyright Joyent, Inc. and other Node contributors.
2177
2192
  //
2178
2193
  // Permission is hereby granted, free of charge, to any person obtaining a
2179
2194
  // copy of this software and associated documentation files (the
@@ -2196,7 +2211,7 @@ this._readableState.destroyed=value;this._writableState.destroyed=value;}});}).c
2196
2211
  // a passthrough stream.
2197
2212
  // basically just the most minimal sort of Transform stream.
2198
2213
  // Every written chunk gets output as-is.
2199
- 'use strict';module.exports=PassThrough;var Transform=require('./_stream_transform');require('inherits')(PassThrough,Transform);function PassThrough(options){if(!(this instanceof PassThrough))return new PassThrough(options);Transform.call(this,options);}PassThrough.prototype._transform=function(chunk,encoding,cb){cb(null,chunk);};},{"./_stream_transform":91,"inherits":58}],90:[function(require,module,exports){(function(process,global){(function(){// Copyright Joyent, Inc. and other Node contributors.
2214
+ 'use strict';module.exports=PassThrough;var Transform=require('./_stream_transform');require('inherits')(PassThrough,Transform);function PassThrough(options){if(!(this instanceof PassThrough))return new PassThrough(options);Transform.call(this,options);}PassThrough.prototype._transform=function(chunk,encoding,cb){cb(null,chunk);};},{"./_stream_transform":93,"inherits":58}],92:[function(require,module,exports){(function(process,global){(function(){// Copyright Joyent, Inc. and other Node contributors.
2200
2215
  //
2201
2216
  // Permission is hereby granted, free of charge, to any person obtaining a
2202
2217
  // copy of this software and associated documentation files (the
@@ -2448,7 +2463,7 @@ if(state.decoder)ret=state.buffer.join('');else if(state.buffer.length===1)ret=s
2448
2463
  ret=state.buffer.consume(n,state.decoder);}return ret;}function endReadable(stream){var state=stream._readableState;debug('endReadable',state.endEmitted);if(!state.endEmitted){state.ended=true;process.nextTick(endReadableNT,state,stream);}}function endReadableNT(state,stream){debug('endReadableNT',state.endEmitted,state.length);// Check that we didn't get one last unshift.
2449
2464
  if(!state.endEmitted&&state.length===0){state.endEmitted=true;stream.readable=false;stream.emit('end');if(state.autoDestroy){// In case of duplex streams we need a way to detect
2450
2465
  // if the writable side is ready for autoDestroy as well
2451
- var wState=stream._writableState;if(!wState||wState.autoDestroy&&wState.finished){stream.destroy();}}}}if(typeof Symbol==='function'){Readable.from=function(iterable,opts){if(from===undefined){from=require('./internal/streams/from');}return from(Readable,iterable,opts);};}function indexOf(xs,x){for(var i=0,l=xs.length;i<l;i++){if(xs[i]===x)return i;}return-1;}}).call(this);}).call(this,require('_process'),typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{});},{"../errors":87,"./_stream_duplex":88,"./internal/streams/async_iterator":93,"./internal/streams/buffer_list":94,"./internal/streams/destroy":95,"./internal/streams/from":97,"./internal/streams/state":99,"./internal/streams/stream":100,"_process":75,"buffer":19,"events":25,"inherits":58,"string_decoder/":102,"util":17}],91:[function(require,module,exports){// Copyright Joyent, Inc. and other Node contributors.
2466
+ var wState=stream._writableState;if(!wState||wState.autoDestroy&&wState.finished){stream.destroy();}}}}if(typeof Symbol==='function'){Readable.from=function(iterable,opts){if(from===undefined){from=require('./internal/streams/from');}return from(Readable,iterable,opts);};}function indexOf(xs,x){for(var i=0,l=xs.length;i<l;i++){if(xs[i]===x)return i;}return-1;}}).call(this);}).call(this,require('_process'),typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{});},{"../errors":89,"./_stream_duplex":90,"./internal/streams/async_iterator":95,"./internal/streams/buffer_list":96,"./internal/streams/destroy":97,"./internal/streams/from":99,"./internal/streams/state":101,"./internal/streams/stream":102,"_process":77,"buffer":19,"events":25,"inherits":58,"string_decoder/":104,"util":17}],93:[function(require,module,exports){// Copyright Joyent, Inc. and other Node contributors.
2452
2467
  //
2453
2468
  // Permission is hereby granted, free of charge, to any person obtaining a
2454
2469
  // copy of this software and associated documentation files (the
@@ -2534,7 +2549,7 @@ ts.needTransform=true;}};Transform.prototype._destroy=function(err,cb){Duplex.pr
2534
2549
  stream.push(data);// TODO(BridgeAR): Write a test for these two error cases
2535
2550
  // if there's nothing in the write buffer, then that means
2536
2551
  // that nothing more will ever be provided
2537
- if(stream._writableState.length)throw new ERR_TRANSFORM_WITH_LENGTH_0();if(stream._transformState.transforming)throw new ERR_TRANSFORM_ALREADY_TRANSFORMING();return stream.push(null);}},{"../errors":87,"./_stream_duplex":88,"inherits":58}],92:[function(require,module,exports){(function(process,global){(function(){// Copyright Joyent, Inc. and other Node contributors.
2552
+ if(stream._writableState.length)throw new ERR_TRANSFORM_WITH_LENGTH_0();if(stream._transformState.transforming)throw new ERR_TRANSFORM_ALREADY_TRANSFORMING();return stream.push(null);}},{"../errors":89,"./_stream_duplex":90,"inherits":58}],94:[function(require,module,exports){(function(process,global){(function(){// Copyright Joyent, Inc. and other Node contributors.
2538
2553
  //
2539
2554
  // Permission is hereby granted, free of charge, to any person obtaining a
2540
2555
  // copy of this software and associated documentation files (the
@@ -2669,7 +2684,7 @@ enumerable:false,get:function get(){if(this._writableState===undefined){return f
2669
2684
  // has not been initialized yet
2670
2685
  if(!this._writableState){return;}// backward compatibility, the user is explicitly
2671
2686
  // managing destroyed
2672
- this._writableState.destroyed=value;}});Writable.prototype.destroy=destroyImpl.destroy;Writable.prototype._undestroy=destroyImpl.undestroy;Writable.prototype._destroy=function(err,cb){cb(err);};}).call(this);}).call(this,require('_process'),typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{});},{"../errors":87,"./_stream_duplex":88,"./internal/streams/destroy":95,"./internal/streams/state":99,"./internal/streams/stream":100,"_process":75,"buffer":19,"inherits":58,"util-deprecate":106}],93:[function(require,module,exports){(function(process){(function(){'use strict';var _Object$setPrototypeO;function _defineProperty(obj,key,value){key=_toPropertyKey(key);if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true});}else{obj[key]=value;}return obj;}function _toPropertyKey(arg){var key=_toPrimitive(arg,"string");return _typeof(key)==="symbol"?key:String(key);}function _toPrimitive(input,hint){if(_typeof(input)!=="object"||input===null)return input;var prim=input[Symbol.toPrimitive];if(prim!==undefined){var res=prim.call(input,hint||"default");if(_typeof(res)!=="object")return res;throw new TypeError("@@toPrimitive must return a primitive value.");}return(hint==="string"?String:Number)(input);}var finished=require('./end-of-stream');var kLastResolve=Symbol('lastResolve');var kLastReject=Symbol('lastReject');var kError=Symbol('error');var kEnded=Symbol('ended');var kLastPromise=Symbol('lastPromise');var kHandlePromise=Symbol('handlePromise');var kStream=Symbol('stream');function createIterResult(value,done){return{value:value,done:done};}function readAndResolve(iter){var resolve=iter[kLastResolve];if(resolve!==null){var data=iter[kStream].read();// we defer if data is null
2687
+ this._writableState.destroyed=value;}});Writable.prototype.destroy=destroyImpl.destroy;Writable.prototype._undestroy=destroyImpl.undestroy;Writable.prototype._destroy=function(err,cb){cb(err);};}).call(this);}).call(this,require('_process'),typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{});},{"../errors":89,"./_stream_duplex":90,"./internal/streams/destroy":97,"./internal/streams/state":101,"./internal/streams/stream":102,"_process":77,"buffer":19,"inherits":58,"util-deprecate":108}],95:[function(require,module,exports){(function(process){(function(){'use strict';var _Object$setPrototypeO;function _defineProperty(obj,key,value){key=_toPropertyKey(key);if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true});}else{obj[key]=value;}return obj;}function _toPropertyKey(arg){var key=_toPrimitive(arg,"string");return _typeof(key)==="symbol"?key:String(key);}function _toPrimitive(input,hint){if(_typeof(input)!=="object"||input===null)return input;var prim=input[Symbol.toPrimitive];if(prim!==undefined){var res=prim.call(input,hint||"default");if(_typeof(res)!=="object")return res;throw new TypeError("@@toPrimitive must return a primitive value.");}return(hint==="string"?String:Number)(input);}var finished=require('./end-of-stream');var kLastResolve=Symbol('lastResolve');var kLastReject=Symbol('lastReject');var kError=Symbol('error');var kEnded=Symbol('ended');var kLastPromise=Symbol('lastPromise');var kHandlePromise=Symbol('handlePromise');var kStream=Symbol('stream');function createIterResult(value,done){return{value:value,done:done};}function readAndResolve(iter){var resolve=iter[kLastResolve];if(resolve!==null){var data=iter[kStream].read();// we defer if data is null
2673
2688
  // we can be expecting either 'end' or
2674
2689
  // 'error'
2675
2690
  if(data!==null){iter[kLastPromise]=null;iter[kLastResolve]=null;iter[kLastReject]=null;resolve(createIterResult(data,false));}}}function onReadable(iter){// we wait for the next tick, because it might
@@ -2691,7 +2706,7 @@ var data=this[kStream].read();if(data!==null){return Promise.resolve(createIterR
2691
2706
  // Readable class this is attached to
2692
2707
  return new Promise(function(resolve,reject){_this2[kStream].destroy(null,function(err){if(err){reject(err);return;}resolve(createIterResult(undefined,true));});});}),_Object$setPrototypeO),AsyncIteratorPrototype);var createReadableStreamAsyncIterator=function createReadableStreamAsyncIterator(stream){var _Object$create;var iterator=Object.create(ReadableStreamAsyncIteratorPrototype,(_Object$create={},_defineProperty(_Object$create,kStream,{value:stream,writable:true}),_defineProperty(_Object$create,kLastResolve,{value:null,writable:true}),_defineProperty(_Object$create,kLastReject,{value:null,writable:true}),_defineProperty(_Object$create,kError,{value:null,writable:true}),_defineProperty(_Object$create,kEnded,{value:stream._readableState.endEmitted,writable:true}),_defineProperty(_Object$create,kHandlePromise,{value:function value(resolve,reject){var data=iterator[kStream].read();if(data){iterator[kLastPromise]=null;iterator[kLastResolve]=null;iterator[kLastReject]=null;resolve(createIterResult(data,false));}else{iterator[kLastResolve]=resolve;iterator[kLastReject]=reject;}},writable:true}),_Object$create));iterator[kLastPromise]=null;finished(stream,function(err){if(err&&err.code!=='ERR_STREAM_PREMATURE_CLOSE'){var reject=iterator[kLastReject];// reject if we are waiting for data in the Promise
2693
2708
  // returned by next() and store the error
2694
- if(reject!==null){iterator[kLastPromise]=null;iterator[kLastResolve]=null;iterator[kLastReject]=null;reject(err);}iterator[kError]=err;return;}var resolve=iterator[kLastResolve];if(resolve!==null){iterator[kLastPromise]=null;iterator[kLastResolve]=null;iterator[kLastReject]=null;resolve(createIterResult(undefined,true));}iterator[kEnded]=true;});stream.on('readable',onReadable.bind(null,iterator));return iterator;};module.exports=createReadableStreamAsyncIterator;}).call(this);}).call(this,require('_process'));},{"./end-of-stream":96,"_process":75}],94:[function(require,module,exports){'use strict';function ownKeys(object,enumerableOnly){var keys=Object.keys(object);if(Object.getOwnPropertySymbols){var symbols=Object.getOwnPropertySymbols(object);enumerableOnly&&(symbols=symbols.filter(function(sym){return Object.getOwnPropertyDescriptor(object,sym).enumerable;})),keys.push.apply(keys,symbols);}return keys;}function _objectSpread(target){for(var i=1;i<arguments.length;i++){var source=null!=arguments[i]?arguments[i]:{};i%2?ownKeys(Object(source),!0).forEach(function(key){_defineProperty(target,key,source[key]);}):Object.getOwnPropertyDescriptors?Object.defineProperties(target,Object.getOwnPropertyDescriptors(source)):ownKeys(Object(source)).forEach(function(key){Object.defineProperty(target,key,Object.getOwnPropertyDescriptor(source,key));});}return target;}function _defineProperty(obj,key,value){key=_toPropertyKey(key);if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true});}else{obj[key]=value;}return obj;}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,_toPropertyKey(descriptor.key),descriptor);}}function _createClass(Constructor,protoProps,staticProps){if(protoProps)_defineProperties(Constructor.prototype,protoProps);if(staticProps)_defineProperties(Constructor,staticProps);Object.defineProperty(Constructor,"prototype",{writable:false});return Constructor;}function _toPropertyKey(arg){var key=_toPrimitive(arg,"string");return _typeof(key)==="symbol"?key:String(key);}function _toPrimitive(input,hint){if(_typeof(input)!=="object"||input===null)return input;var prim=input[Symbol.toPrimitive];if(prim!==undefined){var res=prim.call(input,hint||"default");if(_typeof(res)!=="object")return res;throw new TypeError("@@toPrimitive must return a primitive value.");}return(hint==="string"?String:Number)(input);}var _require=require('buffer'),Buffer=_require.Buffer;var _require2=require('util'),inspect=_require2.inspect;var custom=inspect&&inspect.custom||'inspect';function copyBuffer(src,target,offset){Buffer.prototype.copy.call(src,target,offset);}module.exports=/*#__PURE__*/function(){function BufferList(){_classCallCheck(this,BufferList);this.head=null;this.tail=null;this.length=0;}_createClass(BufferList,[{key:"push",value:function push(v){var entry={data:v,next:null};if(this.length>0)this.tail.next=entry;else this.head=entry;this.tail=entry;++this.length;}},{key:"unshift",value:function unshift(v){var entry={data:v,next:this.head};if(this.length===0)this.tail=entry;this.head=entry;++this.length;}},{key:"shift",value:function shift(){if(this.length===0)return;var ret=this.head.data;if(this.length===1)this.head=this.tail=null;else this.head=this.head.next;--this.length;return ret;}},{key:"clear",value:function clear(){this.head=this.tail=null;this.length=0;}},{key:"join",value:function join(s){if(this.length===0)return'';var p=this.head;var ret=''+p.data;while(p=p.next)ret+=s+p.data;return ret;}},{key:"concat",value:function concat(n){if(this.length===0)return Buffer.alloc(0);var ret=Buffer.allocUnsafe(n>>>0);var p=this.head;var i=0;while(p){copyBuffer(p.data,ret,i);i+=p.data.length;p=p.next;}return ret;}// Consumes a specified amount of bytes or characters from the buffered data.
2709
+ if(reject!==null){iterator[kLastPromise]=null;iterator[kLastResolve]=null;iterator[kLastReject]=null;reject(err);}iterator[kError]=err;return;}var resolve=iterator[kLastResolve];if(resolve!==null){iterator[kLastPromise]=null;iterator[kLastResolve]=null;iterator[kLastReject]=null;resolve(createIterResult(undefined,true));}iterator[kEnded]=true;});stream.on('readable',onReadable.bind(null,iterator));return iterator;};module.exports=createReadableStreamAsyncIterator;}).call(this);}).call(this,require('_process'));},{"./end-of-stream":98,"_process":77}],96:[function(require,module,exports){'use strict';function ownKeys(object,enumerableOnly){var keys=Object.keys(object);if(Object.getOwnPropertySymbols){var symbols=Object.getOwnPropertySymbols(object);enumerableOnly&&(symbols=symbols.filter(function(sym){return Object.getOwnPropertyDescriptor(object,sym).enumerable;})),keys.push.apply(keys,symbols);}return keys;}function _objectSpread(target){for(var i=1;i<arguments.length;i++){var source=null!=arguments[i]?arguments[i]:{};i%2?ownKeys(Object(source),!0).forEach(function(key){_defineProperty(target,key,source[key]);}):Object.getOwnPropertyDescriptors?Object.defineProperties(target,Object.getOwnPropertyDescriptors(source)):ownKeys(Object(source)).forEach(function(key){Object.defineProperty(target,key,Object.getOwnPropertyDescriptor(source,key));});}return target;}function _defineProperty(obj,key,value){key=_toPropertyKey(key);if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true});}else{obj[key]=value;}return obj;}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,_toPropertyKey(descriptor.key),descriptor);}}function _createClass(Constructor,protoProps,staticProps){if(protoProps)_defineProperties(Constructor.prototype,protoProps);if(staticProps)_defineProperties(Constructor,staticProps);Object.defineProperty(Constructor,"prototype",{writable:false});return Constructor;}function _toPropertyKey(arg){var key=_toPrimitive(arg,"string");return _typeof(key)==="symbol"?key:String(key);}function _toPrimitive(input,hint){if(_typeof(input)!=="object"||input===null)return input;var prim=input[Symbol.toPrimitive];if(prim!==undefined){var res=prim.call(input,hint||"default");if(_typeof(res)!=="object")return res;throw new TypeError("@@toPrimitive must return a primitive value.");}return(hint==="string"?String:Number)(input);}var _require=require('buffer'),Buffer=_require.Buffer;var _require2=require('util'),inspect=_require2.inspect;var custom=inspect&&inspect.custom||'inspect';function copyBuffer(src,target,offset){Buffer.prototype.copy.call(src,target,offset);}module.exports=/*#__PURE__*/function(){function BufferList(){_classCallCheck(this,BufferList);this.head=null;this.tail=null;this.length=0;}_createClass(BufferList,[{key:"push",value:function push(v){var entry={data:v,next:null};if(this.length>0)this.tail.next=entry;else this.head=entry;this.tail=entry;++this.length;}},{key:"unshift",value:function unshift(v){var entry={data:v,next:this.head};if(this.length===0)this.tail=entry;this.head=entry;++this.length;}},{key:"shift",value:function shift(){if(this.length===0)return;var ret=this.head.data;if(this.length===1)this.head=this.tail=null;else this.head=this.head.next;--this.length;return ret;}},{key:"clear",value:function clear(){this.head=this.tail=null;this.length=0;}},{key:"join",value:function join(s){if(this.length===0)return'';var p=this.head;var ret=''+p.data;while(p=p.next)ret+=s+p.data;return ret;}},{key:"concat",value:function concat(n){if(this.length===0)return Buffer.alloc(0);var ret=Buffer.allocUnsafe(n>>>0);var p=this.head;var i=0;while(p){copyBuffer(p.data,ret,i);i+=p.data.length;p=p.next;}return ret;}// Consumes a specified amount of bytes or characters from the buffered data.
2695
2710
  },{key:"consume",value:function consume(n,hasStrings){var ret;if(n<this.head.data.length){// `slice` is the same for buffers and strings.
2696
2711
  ret=this.head.data.slice(0,n);this.head.data=this.head.data.slice(n);}else if(n===this.head.data.length){// First chunk is a perfect match.
2697
2712
  ret=this.shift();}else{// Result spans more than one buffer.
@@ -2700,7 +2715,7 @@ ret=hasStrings?this._getString(n):this._getBuffer(n);}return ret;}},{key:"first"
2700
2715
  },{key:"_getBuffer",value:function _getBuffer(n){var ret=Buffer.allocUnsafe(n);var p=this.head;var c=1;p.data.copy(ret);n-=p.data.length;while(p=p.next){var buf=p.data;var nb=n>buf.length?buf.length:n;buf.copy(ret,ret.length-n,0,nb);n-=nb;if(n===0){if(nb===buf.length){++c;if(p.next)this.head=p.next;else this.head=this.tail=null;}else{this.head=p;p.data=buf.slice(nb);}break;}++c;}this.length-=c;return ret;}// Make sure the linked list only shows the minimal necessary information.
2701
2716
  },{key:custom,value:function value(_,options){return inspect(this,_objectSpread(_objectSpread({},options),{},{// Only inspect one level.
2702
2717
  depth:0,// It should not recurse.
2703
- customInspect:false}));}}]);return BufferList;}();},{"buffer":19,"util":17}],95:[function(require,module,exports){(function(process){(function(){'use strict';// undocumented cb() API, needed for core, not for public API
2718
+ customInspect:false}));}}]);return BufferList;}();},{"buffer":19,"util":17}],97:[function(require,module,exports){(function(process){(function(){'use strict';// undocumented cb() API, needed for core, not for public API
2704
2719
  function destroy(err,cb){var _this=this;var readableDestroyed=this._readableState&&this._readableState.destroyed;var writableDestroyed=this._writableState&&this._writableState.destroyed;if(readableDestroyed||writableDestroyed){if(cb){cb(err);}else if(err){if(!this._writableState){process.nextTick(emitErrorNT,this,err);}else if(!this._writableState.errorEmitted){this._writableState.errorEmitted=true;process.nextTick(emitErrorNT,this,err);}}return this;}// we set destroyed to true before firing error callbacks in order
2705
2720
  // to make it re-entrance safe in case destroy() is called within callbacks
2706
2721
  if(this._readableState){this._readableState.destroyed=true;}// if this is a duplex stream mark the writable part as destroyed as well
@@ -2709,15 +2724,15 @@ if(this._writableState){this._writableState.destroyed=true;}this._destroy(err||n
2709
2724
  // For now when you opt-in to autoDestroy we allow
2710
2725
  // the error to be emitted nextTick. In a future
2711
2726
  // semver major update we should change the default to this.
2712
- var rState=stream._readableState;var wState=stream._writableState;if(rState&&rState.autoDestroy||wState&&wState.autoDestroy)stream.destroy(err);else stream.emit('error',err);}module.exports={destroy:destroy,undestroy:undestroy,errorOrDestroy:errorOrDestroy};}).call(this);}).call(this,require('_process'));},{"_process":75}],96:[function(require,module,exports){// Ported from https://github.com/mafintosh/end-of-stream with
2727
+ var rState=stream._readableState;var wState=stream._writableState;if(rState&&rState.autoDestroy||wState&&wState.autoDestroy)stream.destroy(err);else stream.emit('error',err);}module.exports={destroy:destroy,undestroy:undestroy,errorOrDestroy:errorOrDestroy};}).call(this);}).call(this,require('_process'));},{"_process":77}],98:[function(require,module,exports){// Ported from https://github.com/mafintosh/end-of-stream with
2713
2728
  // permission from the author, Mathias Buus (@mafintosh).
2714
2729
  'use strict';var ERR_STREAM_PREMATURE_CLOSE=require('../../../errors').codes.ERR_STREAM_PREMATURE_CLOSE;function once(callback){var called=false;return function(){if(called)return;called=true;for(var _len=arguments.length,args=new Array(_len),_key=0;_key<_len;_key++){args[_key]=arguments[_key];}callback.apply(this,args);};}function noop(){}function isRequest(stream){return stream.setHeader&&typeof stream.abort==='function';}function eos(stream,opts,callback){if(typeof opts==='function')return eos(stream,null,opts);if(!opts)opts={};callback=once(callback||noop);var readable=opts.readable||opts.readable!==false&&stream.readable;var writable=opts.writable||opts.writable!==false&&stream.writable;var onlegacyfinish=function onlegacyfinish(){if(!stream.writable)onfinish();};var writableEnded=stream._writableState&&stream._writableState.finished;var onfinish=function onfinish(){writable=false;writableEnded=true;if(!readable)callback.call(stream);};var readableEnded=stream._readableState&&stream._readableState.endEmitted;var onend=function onend(){readable=false;readableEnded=true;if(!writable)callback.call(stream);};var onerror=function onerror(err){callback.call(stream,err);};var onclose=function onclose(){var err;if(readable&&!readableEnded){if(!stream._readableState||!stream._readableState.ended)err=new ERR_STREAM_PREMATURE_CLOSE();return callback.call(stream,err);}if(writable&&!writableEnded){if(!stream._writableState||!stream._writableState.ended)err=new ERR_STREAM_PREMATURE_CLOSE();return callback.call(stream,err);}};var onrequest=function onrequest(){stream.req.on('finish',onfinish);};if(isRequest(stream)){stream.on('complete',onfinish);stream.on('abort',onclose);if(stream.req)onrequest();else stream.on('request',onrequest);}else if(writable&&!stream._writableState){// legacy streams
2715
- stream.on('end',onlegacyfinish);stream.on('close',onlegacyfinish);}stream.on('end',onend);stream.on('finish',onfinish);if(opts.error!==false)stream.on('error',onerror);stream.on('close',onclose);return function(){stream.removeListener('complete',onfinish);stream.removeListener('abort',onclose);stream.removeListener('request',onrequest);if(stream.req)stream.req.removeListener('finish',onfinish);stream.removeListener('end',onlegacyfinish);stream.removeListener('close',onlegacyfinish);stream.removeListener('finish',onfinish);stream.removeListener('end',onend);stream.removeListener('error',onerror);stream.removeListener('close',onclose);};}module.exports=eos;},{"../../../errors":87}],97:[function(require,module,exports){module.exports=function(){throw new Error('Readable.from is not available in the browser');};},{}],98:[function(require,module,exports){// Ported from https://github.com/mafintosh/pump with
2730
+ stream.on('end',onlegacyfinish);stream.on('close',onlegacyfinish);}stream.on('end',onend);stream.on('finish',onfinish);if(opts.error!==false)stream.on('error',onerror);stream.on('close',onclose);return function(){stream.removeListener('complete',onfinish);stream.removeListener('abort',onclose);stream.removeListener('request',onrequest);if(stream.req)stream.req.removeListener('finish',onfinish);stream.removeListener('end',onlegacyfinish);stream.removeListener('close',onlegacyfinish);stream.removeListener('finish',onfinish);stream.removeListener('end',onend);stream.removeListener('error',onerror);stream.removeListener('close',onclose);};}module.exports=eos;},{"../../../errors":89}],99:[function(require,module,exports){module.exports=function(){throw new Error('Readable.from is not available in the browser');};},{}],100:[function(require,module,exports){// Ported from https://github.com/mafintosh/pump with
2716
2731
  // permission from the author, Mathias Buus (@mafintosh).
2717
2732
  'use strict';var eos;function once(callback){var called=false;return function(){if(called)return;called=true;callback.apply(void 0,arguments);};}var _require$codes=require('../../../errors').codes,ERR_MISSING_ARGS=_require$codes.ERR_MISSING_ARGS,ERR_STREAM_DESTROYED=_require$codes.ERR_STREAM_DESTROYED;function noop(err){// Rethrow the error if it exists to avoid swallowing it
2718
2733
  if(err)throw err;}function isRequest(stream){return stream.setHeader&&typeof stream.abort==='function';}function destroyer(stream,reading,writing,callback){callback=once(callback);var closed=false;stream.on('close',function(){closed=true;});if(eos===undefined)eos=require('./end-of-stream');eos(stream,{readable:reading,writable:writing},function(err){if(err)return callback(err);closed=true;callback();});var destroyed=false;return function(err){if(closed)return;if(destroyed)return;destroyed=true;// request.destroy just do .end - .abort is what we want
2719
- if(isRequest(stream))return stream.abort();if(typeof stream.destroy==='function')return stream.destroy();callback(err||new ERR_STREAM_DESTROYED('pipe'));};}function call(fn){fn();}function pipe(from,to){return from.pipe(to);}function popCallback(streams){if(!streams.length)return noop;if(typeof streams[streams.length-1]!=='function')return noop;return streams.pop();}function pipeline(){for(var _len=arguments.length,streams=new Array(_len),_key=0;_key<_len;_key++){streams[_key]=arguments[_key];}var callback=popCallback(streams);if(Array.isArray(streams[0]))streams=streams[0];if(streams.length<2){throw new ERR_MISSING_ARGS('streams');}var error;var destroys=streams.map(function(stream,i){var reading=i<streams.length-1;var writing=i>0;return destroyer(stream,reading,writing,function(err){if(!error)error=err;if(err)destroys.forEach(call);if(reading)return;destroys.forEach(call);callback(error);});});return streams.reduce(pipe);}module.exports=pipeline;},{"../../../errors":87,"./end-of-stream":96}],99:[function(require,module,exports){'use strict';var ERR_INVALID_OPT_VALUE=require('../../../errors').codes.ERR_INVALID_OPT_VALUE;function highWaterMarkFrom(options,isDuplex,duplexKey){return options.highWaterMark!=null?options.highWaterMark:isDuplex?options[duplexKey]:null;}function getHighWaterMark(state,options,duplexKey,isDuplex){var hwm=highWaterMarkFrom(options,isDuplex,duplexKey);if(hwm!=null){if(!(isFinite(hwm)&&Math.floor(hwm)===hwm)||hwm<0){var name=isDuplex?duplexKey:'highWaterMark';throw new ERR_INVALID_OPT_VALUE(name,hwm);}return Math.floor(hwm);}// Default value
2720
- return state.objectMode?16:16*1024;}module.exports={getHighWaterMark:getHighWaterMark};},{"../../../errors":87}],100:[function(require,module,exports){module.exports=require('events').EventEmitter;},{"events":25}],101:[function(require,module,exports){exports=module.exports=require('./lib/_stream_readable.js');exports.Stream=exports;exports.Readable=exports;exports.Writable=require('./lib/_stream_writable.js');exports.Duplex=require('./lib/_stream_duplex.js');exports.Transform=require('./lib/_stream_transform.js');exports.PassThrough=require('./lib/_stream_passthrough.js');exports.finished=require('./lib/internal/streams/end-of-stream.js');exports.pipeline=require('./lib/internal/streams/pipeline.js');},{"./lib/_stream_duplex.js":88,"./lib/_stream_passthrough.js":89,"./lib/_stream_readable.js":90,"./lib/_stream_transform.js":91,"./lib/_stream_writable.js":92,"./lib/internal/streams/end-of-stream.js":96,"./lib/internal/streams/pipeline.js":98}],102:[function(require,module,exports){// Copyright Joyent, Inc. and other Node contributors.
2734
+ if(isRequest(stream))return stream.abort();if(typeof stream.destroy==='function')return stream.destroy();callback(err||new ERR_STREAM_DESTROYED('pipe'));};}function call(fn){fn();}function pipe(from,to){return from.pipe(to);}function popCallback(streams){if(!streams.length)return noop;if(typeof streams[streams.length-1]!=='function')return noop;return streams.pop();}function pipeline(){for(var _len=arguments.length,streams=new Array(_len),_key=0;_key<_len;_key++){streams[_key]=arguments[_key];}var callback=popCallback(streams);if(Array.isArray(streams[0]))streams=streams[0];if(streams.length<2){throw new ERR_MISSING_ARGS('streams');}var error;var destroys=streams.map(function(stream,i){var reading=i<streams.length-1;var writing=i>0;return destroyer(stream,reading,writing,function(err){if(!error)error=err;if(err)destroys.forEach(call);if(reading)return;destroys.forEach(call);callback(error);});});return streams.reduce(pipe);}module.exports=pipeline;},{"../../../errors":89,"./end-of-stream":98}],101:[function(require,module,exports){'use strict';var ERR_INVALID_OPT_VALUE=require('../../../errors').codes.ERR_INVALID_OPT_VALUE;function highWaterMarkFrom(options,isDuplex,duplexKey){return options.highWaterMark!=null?options.highWaterMark:isDuplex?options[duplexKey]:null;}function getHighWaterMark(state,options,duplexKey,isDuplex){var hwm=highWaterMarkFrom(options,isDuplex,duplexKey);if(hwm!=null){if(!(isFinite(hwm)&&Math.floor(hwm)===hwm)||hwm<0){var name=isDuplex?duplexKey:'highWaterMark';throw new ERR_INVALID_OPT_VALUE(name,hwm);}return Math.floor(hwm);}// Default value
2735
+ return state.objectMode?16:16*1024;}module.exports={getHighWaterMark:getHighWaterMark};},{"../../../errors":89}],102:[function(require,module,exports){module.exports=require('events').EventEmitter;},{"events":25}],103:[function(require,module,exports){exports=module.exports=require('./lib/_stream_readable.js');exports.Stream=exports;exports.Readable=exports;exports.Writable=require('./lib/_stream_writable.js');exports.Duplex=require('./lib/_stream_duplex.js');exports.Transform=require('./lib/_stream_transform.js');exports.PassThrough=require('./lib/_stream_passthrough.js');exports.finished=require('./lib/internal/streams/end-of-stream.js');exports.pipeline=require('./lib/internal/streams/pipeline.js');},{"./lib/_stream_duplex.js":90,"./lib/_stream_passthrough.js":91,"./lib/_stream_readable.js":92,"./lib/_stream_transform.js":93,"./lib/_stream_writable.js":94,"./lib/internal/streams/end-of-stream.js":98,"./lib/internal/streams/pipeline.js":100}],104:[function(require,module,exports){// Copyright Joyent, Inc. and other Node contributors.
2721
2736
  //
2722
2737
  // Permission is hereby granted, free of charge, to any person obtaining a
2723
2738
  // copy of this software and associated documentation files (the
@@ -2771,13 +2786,13 @@ function utf8End(buf){var r=buf&&buf.length?this.write(buf):'';if(this.lastNeed)
2771
2786
  function utf16Text(buf,i){if((buf.length-i)%2===0){var r=buf.toString('utf16le',i);if(r){var c=r.charCodeAt(r.length-1);if(c>=0xD800&&c<=0xDBFF){this.lastNeed=2;this.lastTotal=4;this.lastChar[0]=buf[buf.length-2];this.lastChar[1]=buf[buf.length-1];return r.slice(0,-1);}}return r;}this.lastNeed=1;this.lastTotal=2;this.lastChar[0]=buf[buf.length-1];return buf.toString('utf16le',i,buf.length-1);}// For UTF-16LE we do not explicitly append special replacement characters if we
2772
2787
  // end on a partial character, we simply let v8 handle that.
2773
2788
  function utf16End(buf){var r=buf&&buf.length?this.write(buf):'';if(this.lastNeed){var end=this.lastTotal-this.lastNeed;return r+this.lastChar.toString('utf16le',0,end);}return r;}function base64Text(buf,i){var n=(buf.length-i)%3;if(n===0)return buf.toString('base64',i);this.lastNeed=3-n;this.lastTotal=3;if(n===1){this.lastChar[0]=buf[buf.length-1];}else{this.lastChar[0]=buf[buf.length-2];this.lastChar[1]=buf[buf.length-1];}return buf.toString('base64',i,buf.length-n);}function base64End(buf){var r=buf&&buf.length?this.write(buf):'';if(this.lastNeed)return r+this.lastChar.toString('base64',0,3-this.lastNeed);return r;}// Pass bytes on through for single-byte encodings (e.g. ascii, latin1, hex)
2774
- function simpleWrite(buf){return buf.toString(this.encoding);}function simpleEnd(buf){return buf&&buf.length?this.write(buf):'';}},{"safe-buffer":80}],103:[function(require,module,exports){(function(setImmediate,clearImmediate){(function(){var nextTick=require('process/browser.js').nextTick;var apply=Function.prototype.apply;var slice=Array.prototype.slice;var immediateIds={};var nextImmediateId=0;// DOM APIs, for completeness
2789
+ function simpleWrite(buf){return buf.toString(this.encoding);}function simpleEnd(buf){return buf&&buf.length?this.write(buf):'';}},{"safe-buffer":82}],105:[function(require,module,exports){(function(setImmediate,clearImmediate){(function(){var nextTick=require('process/browser.js').nextTick;var apply=Function.prototype.apply;var slice=Array.prototype.slice;var immediateIds={};var nextImmediateId=0;// DOM APIs, for completeness
2775
2790
  exports.setTimeout=function(){return new Timeout(apply.call(setTimeout,window,arguments),clearTimeout);};exports.setInterval=function(){return new Timeout(apply.call(setInterval,window,arguments),clearInterval);};exports.clearTimeout=exports.clearInterval=function(timeout){timeout.close();};function Timeout(id,clearFn){this._id=id;this._clearFn=clearFn;}Timeout.prototype.unref=Timeout.prototype.ref=function(){};Timeout.prototype.close=function(){this._clearFn.call(window,this._id);};// Does not start the time, just sets up the members needed.
2776
2791
  exports.enroll=function(item,msecs){clearTimeout(item._idleTimeoutId);item._idleTimeout=msecs;};exports.unenroll=function(item){clearTimeout(item._idleTimeoutId);item._idleTimeout=-1;};exports._unrefActive=exports.active=function(item){clearTimeout(item._idleTimeoutId);var msecs=item._idleTimeout;if(msecs>=0){item._idleTimeoutId=setTimeout(function onTimeout(){if(item._onTimeout)item._onTimeout();},msecs);}};// That's not how node.js implements it but the exposed api is the same.
2777
2792
  exports.setImmediate=typeof setImmediate==="function"?setImmediate:function(fn){var id=nextImmediateId++;var args=arguments.length<2?false:slice.call(arguments,1);immediateIds[id]=true;nextTick(function onNextTick(){if(immediateIds[id]){// fn.call() is faster so we optimize for the common use-case
2778
2793
  // @see http://jsperf.com/call-apply-segu
2779
2794
  if(args){fn.apply(null,args);}else{fn.call(null);}// Prevent ids from leaking
2780
- exports.clearImmediate(id);}});return id;};exports.clearImmediate=typeof clearImmediate==="function"?clearImmediate:function(id){delete immediateIds[id];};}).call(this);}).call(this,require("timers").setImmediate,require("timers").clearImmediate);},{"process/browser.js":75,"timers":103}],104:[function(require,module,exports){// Copyright Joyent, Inc. and other Node contributors.
2795
+ exports.clearImmediate(id);}});return id;};exports.clearImmediate=typeof clearImmediate==="function"?clearImmediate:function(id){delete immediateIds[id];};}).call(this);}).call(this,require("timers").setImmediate,require("timers").clearImmediate);},{"process/browser.js":77,"timers":105}],106:[function(require,module,exports){// Copyright Joyent, Inc. and other Node contributors.
2781
2796
  //
2782
2797
  // Permission is hereby granted, free of charge, to any person obtaining a
2783
2798
  // copy of this software and associated documentation files (the
@@ -2924,7 +2939,7 @@ if(psychotic){result.hostname=result.host=isAbsolute?'':srcPath.length?srcPath.s
2924
2939
  //this especially happens in cases like
2925
2940
  //url.resolveObject('mailto:local1@domain1', 'local2@domain2')
2926
2941
  var authInHost=result.host&&result.host.indexOf('@')>0?result.host.split('@'):false;if(authInHost){result.auth=authInHost.shift();result.host=result.hostname=authInHost.shift();}}mustEndAbs=mustEndAbs||result.host&&srcPath.length;if(mustEndAbs&&!isAbsolute){srcPath.unshift('');}if(!srcPath.length){result.pathname=null;result.path=null;}else{result.pathname=srcPath.join('/');}//to support request.http
2927
- if(!util.isNull(result.pathname)||!util.isNull(result.search)){result.path=(result.pathname?result.pathname:'')+(result.search?result.search:'');}result.auth=relative.auth||result.auth;result.slashes=result.slashes||relative.slashes;result.href=result.format();return result;};Url.prototype.parseHost=function(){var host=this.host;var port=portPattern.exec(host);if(port){port=port[0];if(port!==':'){this.port=port.substr(1);}host=host.substr(0,host.length-port.length);}if(host)this.hostname=host;};},{"./util":105,"punycode":76,"querystring":79}],105:[function(require,module,exports){'use strict';module.exports={isString:function isString(arg){return typeof arg==='string';},isObject:function isObject(arg){return _typeof(arg)==='object'&&arg!==null;},isNull:function isNull(arg){return arg===null;},isNullOrUndefined:function isNullOrUndefined(arg){return arg==null;}};},{}],106:[function(require,module,exports){(function(global){(function(){/**
2942
+ if(!util.isNull(result.pathname)||!util.isNull(result.search)){result.path=(result.pathname?result.pathname:'')+(result.search?result.search:'');}result.auth=relative.auth||result.auth;result.slashes=result.slashes||relative.slashes;result.href=result.format();return result;};Url.prototype.parseHost=function(){var host=this.host;var port=portPattern.exec(host);if(port){port=port[0];if(port!==':'){this.port=port.substr(1);}host=host.substr(0,host.length-port.length);}if(host)this.hostname=host;};},{"./util":107,"punycode":78,"querystring":81}],107:[function(require,module,exports){'use strict';module.exports={isString:function isString(arg){return typeof arg==='string';},isObject:function isObject(arg){return _typeof(arg)==='object'&&arg!==null;},isNull:function isNull(arg){return arg===null;},isNullOrUndefined:function isNullOrUndefined(arg){return arg==null;}};},{}],108:[function(require,module,exports){(function(global){(function(){/**
2928
2943
  * Module exports.
2929
2944
  */module.exports=deprecate;/**
2930
2945
  * Mark that a method should not be used.
@@ -2949,24 +2964,19 @@ if(!util.isNull(result.pathname)||!util.isNull(result.search)){result.path=(resu
2949
2964
  * @returns {Boolean}
2950
2965
  * @api private
2951
2966
  */function config(name){// accessing global.localStorage can trigger a DOMException in sandboxed iframes
2952
- try{if(!global.localStorage)return false;}catch(_){return false;}var val=global.localStorage[name];if(null==val)return false;return String(val).toLowerCase()==='true';}}).call(this);}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{});},{}],107:[function(require,module,exports){// Returns a wrapper function that returns a wrapped callback
2967
+ try{if(!global.localStorage)return false;}catch(_){return false;}var val=global.localStorage[name];if(null==val)return false;return String(val).toLowerCase()==='true';}}).call(this);}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{});},{}],109:[function(require,module,exports){// Returns a wrapper function that returns a wrapped callback
2953
2968
  // The wrapper function should do some stuff, and return a
2954
2969
  // presumably different callback function.
2955
2970
  // This makes sure that own properties are retained, so that
2956
2971
  // decorations and such are not lost along the way.
2957
- module.exports=wrappy;function wrappy(fn,cb){if(fn&&cb)return wrappy(fn)(cb);if(typeof fn!=='function')throw new TypeError('need wrapper function');Object.keys(fn).forEach(function(k){wrapper[k]=fn[k];});return wrapper;function wrapper(){var args=new Array(arguments.length);for(var i=0;i<args.length;i++){args[i]=arguments[i];}var ret=fn.apply(this,args);var cb=args[args.length-1];if(typeof ret==='function'&&ret!==cb){Object.keys(cb).forEach(function(k){ret[k]=cb[k];});}return ret;}}},{}],108:[function(require,module,exports){module.exports=extend;var hasOwnProperty=Object.prototype.hasOwnProperty;function extend(){var target={};for(var i=0;i<arguments.length;i++){var source=arguments[i];for(var key in source){if(hasOwnProperty.call(source,key)){target[key]=source[key];}}}return target;}},{}],109:[function(require,module,exports){var libFableServiceBase=require('fable').ServiceProviderBase;var defaultPictSettings={Name:'DefaultPictApplication',InitializeOnLoad:true,// The main "viewport" is the view that is used to host our application
2958
- MainViewportView:'Default-View',MainViewportRenderable:'Application-Default-View-Renderable',MainViewportDestinationAddress:'Application-Destination-Address',MainViewportDefaultDataAddress:'',// Whether or not we should automatically render the main viewport when appropriate
2959
- AutoRenderMainViewportView:false,Manifests:{},// The prefix to prepend on all template destination hashes
2960
- IdentifierAddressPrefix:'PICT-'};var PictApplication=/*#__PURE__*/function(_libFableServiceBase10){_inherits(PictApplication,_libFableServiceBase10);var _super20=_createSuper(PictApplication);function PictApplication(pFable,pOptions,pServiceHash){var _this34;_classCallCheck2(this,PictApplication);var tmpOptions=Object.assign({},defaultPictSettings,pOptions);_this34=_super20.call(this,pFable,tmpOptions,pServiceHash);_this34.serviceType='PictApplication';_this34.AppData=_this34.fable.AppData;_this34.initializationFunctionSet=[];var tmpManifestKeys=Object.keys(_this34.options.Manifests);if(tmpManifestKeys.length>0){for(var i=0;i<tmpManifestKeys.length;i++){// Load each manifest
2961
- var tmpManifestKey=tmpManifestKeys[i];_this34.fable.serviceManager.instantiateServiceProvider('Manifest',_this34.options.Manifests[tmpManifestKey],tmpManifestKey);}}if(_this34.options.InitializeOnLoad){return _possibleConstructorReturn(_this34,_this34.initialize());}if(_this34.options.AutoRenderMainViewportView){_this34.log.info("Pict Application ".concat(_this34.options.Name,"[").concat(_this34.UUID,"]::[").concat(_this34.Hash,"] beginning auto render of [").concat(_this34.options.MainViewportView,"::").concat(_this34.options.MainViewportRenderable,"]."));_this34.renderAsync(_this34.options.MainViewportView,_this34.options.MainViewportRenderable,_this34.options.MainViewportDestinationAddress,_this34.options.MainViewportDefaultDataAddress,function(){});}return _this34;}// TODO: do we need an asynchronous version of this?
2962
- _createClass2(PictApplication,[{key:"solve",value:function solve(){this.log.info("Pict Application ".concat(this.options.Name,"[").concat(this.UUID,"]::[").concat(this.Hash,"] executing solve() function..."));return true;}},{key:"internalInitialize",value:function internalInitialize(){return true;}},{key:"initialize",value:function initialize(){this.log.info("Pict Application ".concat(this.options.Name,"[").concat(this.UUID,"]::[").concat(this.Hash,"] beginning initialization..."));this.internalInitialize();this.log.info("Pict Application ".concat(this.options.Name,"[").concat(this.UUID,"]::[").concat(this.Hash,"] initialization complete."));}},{key:"render",value:function render(pViewHash,pRenderableHash,pRenderDestinationAddress,pTemplateDataAddress){var tmpView=typeof pViewHash==='string'?this.services.PictView[pViewHash]:false;if(!tmpView){this.log.error("PictApplication [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.Name," could not render from View ").concat(pViewHash," because it is not a valid view."));return false;}return tmpView.render(pRenderableHash,pRenderDestinationAddress,pTemplateDataAddress);}},{key:"renderAsync",value:function renderAsync(pViewHash,pRenderableHash,pRenderDestinationAddress,pTemplateDataAddress,fCallback){var tmpView=typeof pViewHash==='string'?this.services.PictView[pViewHash]:false;if(!tmpView){this.log.error("PictApplication [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.Name," could not render from View ").concat(pViewHash," because it is not a valid view."));return false;}return tmpView.renderAsync(pRenderableHash,pRenderDestinationAddress,pTemplateDataAddress,fCallback);}}]);return PictApplication;}(libFableServiceBase);module.exports=PictApplication;},{"fable":40}],110:[function(require,module,exports){var libFableServiceBase=require('fable').ServiceProviderBase;var PictContentAssignment=/*#__PURE__*/function(_libFableServiceBase11){_inherits(PictContentAssignment,_libFableServiceBase11);var _super21=_createSuper(PictContentAssignment);function PictContentAssignment(pFable,pOptions,pServiceHash){var _this35;_classCallCheck2(this,PictContentAssignment);_this35=_super21.call(this,pFable,pOptions,pServiceHash);_this35.serviceType='PictContentAssignment';// Check to see if we are running in a browser
2963
- _this35.inBrowser=false;_this35.hasDocument=false;if((typeof window==="undefined"?"undefined":_typeof(window))=='object'){_this35.inBrowser=true;// Now check that the browser has a document object
2964
- if(typeof window.document!='undefined'&&typeof window.document.querySelectorAll=='function'){_this35.hasDocument=true;}}// If we're in a browser, check to see if jQuery is available.
2965
- _this35.hasJquery=false;_this35.jQuery=false;if(_this35.inBrowser&&typeof window.jQuery!=='undefined'){_this35.hasJquery=true;}// API Consumers can also craft their own assign function
2966
- _this35.customAssignFunction=false;// API Consumers can also craft their own append function
2967
- _this35.customAppendFunction=false;// API Consumers can also craft their own read function
2968
- _this35.customReadFunction=false;// API Consumers can even craft their own get element function.
2969
- _this35.customGetElementFunction=false;return _this35;}_createClass2(PictContentAssignment,[{key:"getElement",value:function getElement(pAddress){if(this.customGetElementFunction){return this.customGetElementFunction(pAddress);}else if(this.hasJquery){var tmpElements=window.jQuery(pAddress);if(tmpElements.length==0){return false;}else if(tmpElements.length==1){return tmpElements[0];}else{// TODO: This isn't the most efficient method, but it is the most compatible.
2972
+ module.exports=wrappy;function wrappy(fn,cb){if(fn&&cb)return wrappy(fn)(cb);if(typeof fn!=='function')throw new TypeError('need wrapper function');Object.keys(fn).forEach(function(k){wrapper[k]=fn[k];});return wrapper;function wrapper(){var args=new Array(arguments.length);for(var i=0;i<args.length;i++){args[i]=arguments[i];}var ret=fn.apply(this,args);var cb=args[args.length-1];if(typeof ret==='function'&&ret!==cb){Object.keys(cb).forEach(function(k){ret[k]=cb[k];});}return ret;}}},{}],110:[function(require,module,exports){module.exports=extend;var hasOwnProperty=Object.prototype.hasOwnProperty;function extend(){var target={};for(var i=0;i<arguments.length;i++){var source=arguments[i];for(var key in source){if(hasOwnProperty.call(source,key)){target[key]=source[key];}}}return target;}},{}],111:[function(require,module,exports){module.exports=require('pict-application');},{"pict-application":72}],112:[function(require,module,exports){var libFableServiceBase=require('fable').ServiceProviderBase;var PictContentAssignment=/*#__PURE__*/function(_libFableServiceBase12){_inherits(PictContentAssignment,_libFableServiceBase12);var _super22=_createSuper(PictContentAssignment);function PictContentAssignment(pFable,pOptions,pServiceHash){var _this37;_classCallCheck2(this,PictContentAssignment);_this37=_super22.call(this,pFable,pOptions,pServiceHash);_this37.serviceType='PictContentAssignment';// Check to see if we are running in a browser
2973
+ _this37.inBrowser=false;_this37.hasDocument=false;if((typeof window==="undefined"?"undefined":_typeof(window))=='object'){_this37.inBrowser=true;// Now check that the browser has a document object
2974
+ if(typeof window.document!='undefined'&&typeof window.document.querySelectorAll=='function'){_this37.hasDocument=true;}}// If we're in a browser, check to see if jQuery is available.
2975
+ _this37.hasJquery=false;_this37.jQuery=false;if(_this37.inBrowser&&typeof window.jQuery!=='undefined'){_this37.hasJquery=true;}// API Consumers can also craft their own assign function
2976
+ _this37.customAssignFunction=false;// API Consumers can also craft their own append function
2977
+ _this37.customAppendFunction=false;// API Consumers can also craft their own read function
2978
+ _this37.customReadFunction=false;// API Consumers can even craft their own get element function.
2979
+ _this37.customGetElementFunction=false;return _this37;}_createClass2(PictContentAssignment,[{key:"getElement",value:function getElement(pAddress){if(this.customGetElementFunction){return this.customGetElementFunction(pAddress);}else if(this.hasJquery){var tmpElements=window.jQuery(pAddress);if(tmpElements.length==0){return false;}else if(tmpElements.length==1){return tmpElements[0];}else{// TODO: This isn't the most efficient method, but it is the most compatible.
2970
2980
  var tmpElementSet=[];for(var i=0;i<tmpElements.length;i++){tmpElementSet.push(tmpElements[i]);}return tmpElementSet;}}else if(this.inBrowser&&this.hasDocument){return window.document.querySelectorAll(pAddress);}else{// Just log it out for now
2971
2981
  this.log.trace("PICT Content GET ELEMENT for [".concat(pAddress,"]"));return false;}}},{key:"assignContent",value:function assignContent(pAddress,pContent){if(this.customAssignFunction){return this.customAssignFunction(pAddress,pContent);}else if(this.hasJquery){// Get the element
2972
2982
  var tmpTargetElement=window.jQuery(pAddress);// Should we ensure we matched 1 and exactly 1 element?
@@ -2977,21 +2987,21 @@ tmpTargetElement.html(pContent);//}
2977
2987
  }else if(this.inBrowser&&this.hasDocument){var tmpTargetElementSet=window.document.querySelectorAll(pAddress);for(var i=0;i<tmpTargetElementSet.length;i++){tmpTargetElementSet[i].innerHTML=pContent;}}else{// Just log it out for now
2978
2988
  this.log.trace("PICT Content ASSIGN to [".concat(pAddress,"]:"),pContent);}}},{key:"appendContent",value:function appendContent(pAddress,pContent){if(this.customAppendFunction){return this.customAppendFunction(pAddress,pContent);}else if(this.hasJquery){var tmpTargetElement=window.jQuery(pAddress);tmpTargetElement.append(pContent);}else if(this.inBrowser&&this.hasDocument){var tmpTargetElementSet=window.document.querySelectorAll(pAddress);for(var i=0;i<tmpTargetElementSet.length;i++){tmpTargetElementSet[i].insertAdjacentHTML("beforeend",pContent);}}else{// Just log it out for now -- nothing browser in our mix.
2979
2989
  this.log.trace("PICT Content APPEND to [".concat(pAddress,"]:"),pContent);}}},{key:"readContent",value:function readContent(pAddress,pContentType){var tmpContentType=typeof pContentType=='string'?pContentType:'value';if(this.customReadFunction){return this.customReadFunction(pAddress,pContentType);}else if(this.hasJquery){var tmpTargetElement=window.jQuery(pAddress);return tmpTargetElement.html();}else if(this.inBrowser&&this.hasDocument){var tmpTargetElementSet=window.document.querySelectorAll(pAddress);if(tmpTargetElementSet.length<1){return'';}else if(tmpTargetElementSet.length==1){return tmpTargetElementSet[0].innerHTML;}}else{// Just log it out for now -- nothing browser in our mix.
2980
- this.log.trace("PICT Content READ from [".concat(pAddress,"] type [").concat(tmpContentType,"]..."));return'';}}}]);return PictContentAssignment;}(libFableServiceBase);module.exports=PictContentAssignment;},{"fable":40}],111:[function(require,module,exports){var libFableServiceBase=require('fable').ServiceProviderBase;var PictDataProvider=/*#__PURE__*/function(_libFableServiceBase12){_inherits(PictDataProvider,_libFableServiceBase12);var _super22=_createSuper(PictDataProvider);function PictDataProvider(pFable,pOptions,pServiceHash){var _this36;_classCallCheck2(this,PictDataProvider);_this36=_super22.call(this,pFable,pOptions,pServiceHash);_this36.serviceType='PictDataProvider';return _this36;}_createClass2(PictDataProvider,[{key:"getDataByAddress",value:function getDataByAddress(pAddress,pData){var tmpData=typeof pData==='undefined'?{}:pData;return this.fable.manifest.getValueByHash({AppData:this.AppData,Bundle:this.Bundle,Record:tmpData},pAddress);}}]);return PictDataProvider;}(libFableServiceBase);module.exports=PictDataProvider;},{"fable":40}],112:[function(require,module,exports){var libFableServiceBase=require('fable').ServiceProviderBase;var PictMeadowEntityProvider=/*#__PURE__*/function(_libFableServiceBase13){_inherits(PictMeadowEntityProvider,_libFableServiceBase13);var _super23=_createSuper(PictMeadowEntityProvider);function PictMeadowEntityProvider(pFable,pOptions,pServiceHash){var _this37;_classCallCheck2(this,PictMeadowEntityProvider);_this37=_super23.call(this,pFable,pOptions,pServiceHash);_defineProperty2(_assertThisInitialized(_this37),"getEntitySet",function(pEntity,pMeadowFilterExpression,fCallback){var _this38=this;this.initializeCache(pEntity);// TODO: Should we test for too many record IDs here by string length?
2990
+ this.log.trace("PICT Content READ from [".concat(pAddress,"] type [").concat(tmpContentType,"]..."));return'';}}}]);return PictContentAssignment;}(libFableServiceBase);module.exports=PictContentAssignment;},{"fable":40}],113:[function(require,module,exports){var libFableServiceBase=require('fable').ServiceProviderBase;var PictDataProvider=/*#__PURE__*/function(_libFableServiceBase13){_inherits(PictDataProvider,_libFableServiceBase13);var _super23=_createSuper(PictDataProvider);function PictDataProvider(pFable,pOptions,pServiceHash){var _this38;_classCallCheck2(this,PictDataProvider);_this38=_super23.call(this,pFable,pOptions,pServiceHash);_this38.serviceType='PictDataProvider';return _this38;}_createClass2(PictDataProvider,[{key:"getDataByAddress",value:function getDataByAddress(pAddress,pData){var tmpData=typeof pData==='undefined'?{}:pData;return this.fable.manifest.getValueByHash({AppData:this.AppData,Bundle:this.Bundle,Record:tmpData},pAddress);}}]);return PictDataProvider;}(libFableServiceBase);module.exports=PictDataProvider;},{"fable":40}],114:[function(require,module,exports){var libFableServiceBase=require('fable').ServiceProviderBase;var PictMeadowEntityProvider=/*#__PURE__*/function(_libFableServiceBase14){_inherits(PictMeadowEntityProvider,_libFableServiceBase14);var _super24=_createSuper(PictMeadowEntityProvider);function PictMeadowEntityProvider(pFable,pOptions,pServiceHash){var _this39;_classCallCheck2(this,PictMeadowEntityProvider);_this39=_super24.call(this,pFable,pOptions,pServiceHash);_defineProperty2(_assertThisInitialized(_this39),"getEntitySet",function(pEntity,pMeadowFilterExpression,fCallback){var _this40=this;this.initializeCache(pEntity);// TODO: Should we test for too many record IDs here by string length?
2981
2991
  // FBL~ID${pDestinationEntity}~INN~${tmpIDRecordsCommaSeparated}
2982
2992
  // Discard anything from the cache that has expired or is over size.
2983
- this.cache[pEntity].prune(function(){var tmpCountOptions={url:"".concat(_this38.options.urlPrefix).concat(pEntity,"s/Count/FilteredTo/").concat(pMeadowFilterExpression)};tmpCountOptions=_this38.prepareRequestOptions(tmpCountOptions);return _this38.restClient.getJSON(tmpCountOptions,function(pError,pResponse,pBody){if(pError){_this38.log.error("Error getting bulk entity count of [".concat(pEntity,"] filtered to [").concat(pMeadowFilterExpression,"] from server [").concat(tmpCountOptions.url,"]: ").concat(pError));return fCallback(pError);}var tmpRecordCount=0;if(pBody.Count){tmpRecordCount=pBody.Count;}var tmpDownloadURIFragments=[];var tmpDownloadBatchSize=_this38.options.downloadBatchSize;for(var i=0;i<tmpRecordCount/tmpDownloadBatchSize;i++){// Generate each of the URI fragments to download
2984
- tmpDownloadURIFragments.push("".concat(_this38.options.urlPrefix).concat(pEntity,"s/FilteredTo/").concat(pMeadowFilterExpression,"/").concat(i*tmpDownloadBatchSize,"/").concat(tmpDownloadBatchSize));}var tmpEntitySet=[];// Now run these in series (it's possible to parallelize but no reason to)
2985
- _this38.fable.Utility.eachLimit(tmpDownloadURIFragments,1,function(pURIFragment,fDownloadCallback){var tmpOptions={url:"".concat(_this38.options.urlPrefix).concat(pURIFragment)};tmpOptions=_this38.prepareRequestOptions(tmpOptions);_this38.restClient.getJSON(pURIFragment,function(pDownloadError,pDownloadResponse,pDownloadBody){tmpEntitySet=tmpEntitySet.concat(pDownloadBody);// Should we be caching each record?
2986
- return fDownloadCallback(pDownloadError);});},function(pFullDownloadError){return fCallback(pFullDownloadError,tmpEntitySet);});});});});_this37.serviceType='PictMeadowProvider';if(_this37.fable.settings.PictDefaultURLPrefix){_this37.options.urlPrefix=_this37.fable.settings.PictDefaultURLPrefix;}else if(!_this37.options.urlPrefix){_this37.options.urlPrefix='/1.0/';}if(_this37.fable.settings.PictDefaultDownloadBatchSize){_this37.options.downloadBatchSize=_this37.fable.settings.PictDefaultDownloadBatchSize;}else if(!_this37.options.downloadBatchSize){_this37.options.downloadBatchSize=100;}_this37.restClient=_this37.fable.serviceManager.instantiateServiceProviderWithoutRegistration('RestClient');_this37.cache={};_this37.prepareRequestOptions=function(pOptions){return pOptions;};return _this37;}_createClass2(PictMeadowEntityProvider,[{key:"initializeCache",value:function initializeCache(pEntity){// This should not be happening as often as it's happening.
2993
+ this.cache[pEntity].prune(function(){var tmpCountOptions={url:"".concat(_this40.options.urlPrefix).concat(pEntity,"s/Count/FilteredTo/").concat(pMeadowFilterExpression)};tmpCountOptions=_this40.prepareRequestOptions(tmpCountOptions);return _this40.restClient.getJSON(tmpCountOptions,function(pError,pResponse,pBody){if(pError){_this40.log.error("Error getting bulk entity count of [".concat(pEntity,"] filtered to [").concat(pMeadowFilterExpression,"] from server [").concat(tmpCountOptions.url,"]: ").concat(pError));return fCallback(pError);}var tmpRecordCount=0;if(pBody.Count){tmpRecordCount=pBody.Count;}var tmpDownloadURIFragments=[];var tmpDownloadBatchSize=_this40.options.downloadBatchSize;for(var i=0;i<tmpRecordCount/tmpDownloadBatchSize;i++){// Generate each of the URI fragments to download
2994
+ tmpDownloadURIFragments.push("".concat(_this40.options.urlPrefix).concat(pEntity,"s/FilteredTo/").concat(pMeadowFilterExpression,"/").concat(i*tmpDownloadBatchSize,"/").concat(tmpDownloadBatchSize));}var tmpEntitySet=[];// Now run these in series (it's possible to parallelize but no reason to)
2995
+ _this40.fable.Utility.eachLimit(tmpDownloadURIFragments,1,function(pURIFragment,fDownloadCallback){var tmpOptions={url:"".concat(_this40.options.urlPrefix).concat(pURIFragment)};tmpOptions=_this40.prepareRequestOptions(tmpOptions);_this40.restClient.getJSON(pURIFragment,function(pDownloadError,pDownloadResponse,pDownloadBody){tmpEntitySet=tmpEntitySet.concat(pDownloadBody);// Should we be caching each record?
2996
+ return fDownloadCallback(pDownloadError);});},function(pFullDownloadError){return fCallback(pFullDownloadError,tmpEntitySet);});});});});_this39.serviceType='PictMeadowProvider';if(_this39.fable.settings.PictDefaultURLPrefix){_this39.options.urlPrefix=_this39.fable.settings.PictDefaultURLPrefix;}else if(!_this39.options.urlPrefix){_this39.options.urlPrefix='/1.0/';}if(_this39.fable.settings.PictDefaultDownloadBatchSize){_this39.options.downloadBatchSize=_this39.fable.settings.PictDefaultDownloadBatchSize;}else if(!_this39.options.downloadBatchSize){_this39.options.downloadBatchSize=100;}_this39.restClient=_this39.fable.serviceManager.instantiateServiceProviderWithoutRegistration('RestClient');_this39.cache={};_this39.prepareRequestOptions=function(pOptions){return pOptions;};return _this39;}_createClass2(PictMeadowEntityProvider,[{key:"initializeCache",value:function initializeCache(pEntity){// This should not be happening as often as it's happening.
2987
2997
  if(!this.cache.hasOwnProperty(pEntity)){this.cache[pEntity]=this.fable.serviceManager.instantiateServiceProviderWithoutRegistration('ObjectCache');// TODO: Make this a configuration?
2988
2998
  // For now cache for 30 seconds.
2989
- this.cache[pEntity].maxAge=30000;this.cache[pEntity].maxLength=10000;this.fable.Bundle[pEntity]=this.cache[pEntity].RecordMap;}}},{key:"getEntity",value:function getEntity(pEntity,pIDRecord,fCallback){var _this39=this;this.initializeCache(pEntity);// Discard anything from the cache that has expired or is over size.
2990
- this.cache[pEntity].prune(function(){var tmpPossibleRecord=_this39.cache[pEntity].read(pIDRecord);if(tmpPossibleRecord){return tmpPossibleRecord;}var tmpOptions={url:"".concat(_this39.options.urlPrefix).concat(pEntity,"/").concat(pIDRecord)};tmpOptions=_this39.prepareRequestOptions(tmpOptions);return _this39.restClient.getJSON(tmpOptions,function(pError,pResponse,pBody){if(pBody){_this39.cache[pEntity].put(pBody,pIDRecord);}return fCallback(pError,pBody);});});}}]);return PictMeadowEntityProvider;}(libFableServiceBase);module.exports=PictMeadowEntityProvider;},{"fable":40}],113:[function(require,module,exports){var libFableServiceBase=require('fable').ServiceProviderBase;var PictTemplateProvider=/*#__PURE__*/function(_libFableServiceBase14){_inherits(PictTemplateProvider,_libFableServiceBase14);var _super24=_createSuper(PictTemplateProvider);function PictTemplateProvider(pFable,pOptions,pServiceHash){var _this40;_classCallCheck2(this,PictTemplateProvider);_this40=_super24.call(this,pFable,pOptions,pServiceHash);_this40.serviceType='PictTemplateProvider';_this40.templates={};_this40.templateSources={};// Default templates are stored by prefix.
2999
+ this.cache[pEntity].maxAge=30000;this.cache[pEntity].maxLength=10000;this.fable.Bundle[pEntity]=this.cache[pEntity].RecordMap;}}},{key:"getEntity",value:function getEntity(pEntity,pIDRecord,fCallback){var _this41=this;this.initializeCache(pEntity);// Discard anything from the cache that has expired or is over size.
3000
+ this.cache[pEntity].prune(function(){var tmpPossibleRecord=_this41.cache[pEntity].read(pIDRecord);if(tmpPossibleRecord){return tmpPossibleRecord;}var tmpOptions={url:"".concat(_this41.options.urlPrefix).concat(pEntity,"/").concat(pIDRecord)};tmpOptions=_this41.prepareRequestOptions(tmpOptions);return _this41.restClient.getJSON(tmpOptions,function(pError,pResponse,pBody){if(pBody){_this41.cache[pEntity].put(pBody,pIDRecord);}return fCallback(pError,pBody);});});}}]);return PictMeadowEntityProvider;}(libFableServiceBase);module.exports=PictMeadowEntityProvider;},{"fable":40}],115:[function(require,module,exports){var libFableServiceBase=require('fable').ServiceProviderBase;var PictTemplateProvider=/*#__PURE__*/function(_libFableServiceBase15){_inherits(PictTemplateProvider,_libFableServiceBase15);var _super25=_createSuper(PictTemplateProvider);function PictTemplateProvider(pFable,pOptions,pServiceHash){var _this42;_classCallCheck2(this,PictTemplateProvider);_this42=_super25.call(this,pFable,pOptions,pServiceHash);_this42.serviceType='PictTemplateProvider';_this42.templates={};_this42.templateSources={};// Default templates are stored by prefix.
2991
3001
  // The longest prefix match is used.
2992
3002
  // Case sensitive.
2993
- _this40.defaultTemplates=[];// This function can be overloaded to load templates from a database, in a page or other source.
2994
- _this40.loadTemplateFunction=function(pTemplateHash){return false;};return _this40;}_createClass2(PictTemplateProvider,[{key:"addTemplate",value:function addTemplate(pTemplateHash,pTemplate,pTemplateSource){this.templates[pTemplateHash]=pTemplate;if(typeof pTemplateSource=='string'){this.templateSources[pTemplateHash]=pTemplateSource;}else{this.templateSources[pTemplateHash]="Direct addTemplate('".concat(pTemplateHash,"') function load into PictTemplateProvider [").concat(this.UUID,"]::[").concat(this.Hash,"]");}}},{key:"addDefaultTemplate",value:function addDefaultTemplate(pPrefix,pPostfix,pTemplate,pSource){var tmpSource=typeof pSource=='string'?pSource:"Direct addDefaultTemplate('".concat(pPrefix,"','").concat(pPostfix,"',..) function load into PictTemplateProvider [").concat(this.UUID,"]::[").concat(this.Hash,"]");var tmpDefaultTemplate={prefix:pPrefix,postfix:pPostfix,template:pTemplate,source:tmpSource};if(typeof pTemplate!='string'){this.log.error('PictTemplateProvider.addDefaultTemplate: pTemplate is not a string.');}this.defaultTemplates.push(tmpDefaultTemplate);}},{key:"checkDefaultTemplateHash",value:function checkDefaultTemplateHash(pTemplateHash){/*
3003
+ _this42.defaultTemplates=[];// This function can be overloaded to load templates from a database, in a page or other source.
3004
+ _this42.loadTemplateFunction=function(pTemplateHash){return false;};return _this42;}_createClass2(PictTemplateProvider,[{key:"addTemplate",value:function addTemplate(pTemplateHash,pTemplate,pTemplateSource){this.templates[pTemplateHash]=pTemplate;if(typeof pTemplateSource=='string'){this.templateSources[pTemplateHash]=pTemplateSource;}else{this.templateSources[pTemplateHash]="Direct addTemplate('".concat(pTemplateHash,"') function load into PictTemplateProvider [").concat(this.UUID,"]::[").concat(this.Hash,"]");}}},{key:"addDefaultTemplate",value:function addDefaultTemplate(pPrefix,pPostfix,pTemplate,pSource){var tmpSource=typeof pSource=='string'?pSource:"Direct addDefaultTemplate('".concat(pPrefix,"','").concat(pPostfix,"',..) function load into PictTemplateProvider [").concat(this.UUID,"]::[").concat(this.Hash,"]");var tmpDefaultTemplate={prefix:pPrefix,postfix:pPostfix,template:pTemplate,source:tmpSource};if(typeof pTemplate!='string'){this.log.error('PictTemplateProvider.addDefaultTemplate: pTemplate is not a string.');}this.defaultTemplates.push(tmpDefaultTemplate);}},{key:"checkDefaultTemplateHash",value:function checkDefaultTemplateHash(pTemplateHash){/*
2995
3005
  * Default templates are managed by postfix and prefix. The use case is things like titles, headers, list
2996
3006
  * wrappers, rows, etc.
2997
3007
  *
@@ -3003,24 +3013,14 @@ _this40.loadTemplateFunction=function(pTemplateHash){return false;};return _this
3003
3013
  */for(var i=0;i<this.defaultTemplates.length;i++){if(pTemplateHash.indexOf(this.defaultTemplates[i].postfix)==pTemplateHash.length-this.defaultTemplates[i].postfix.length&&pTemplateHash.indexOf(this.defaultTemplates[i].prefix)==0){this.templates[pTemplateHash]=this.defaultTemplates[i].template;this.templateSources[pTemplateHash]="Auto created in checkDefaultTemplateHash('".concat(pTemplateHash,"') function by PictTemplateProvider [").concat(this.UUID,"]::[").concat(this.Hash,"] from [").concat(this.defaultTemplates[i].prefix,"]...[").concat(this.defaultTemplates[i].postfix,"]");return this.templates[pTemplateHash];}}return false;}},{key:"getTemplate",value:function getTemplate(pTemplateHash){// TODO: Optimize this.
3004
3014
  // If the template doesn't exist, try to load it with the loading function
3005
3015
  if(!this.templates.hasOwnProperty(pTemplateHash)){this.loadTemplate(pTemplateHash);}// If the loading function fails, try to load it from the default templates
3006
- if(!this.templates.hasOwnProperty(pTemplateHash)){this.checkDefaultTemplateHash(pTemplateHash);}if(this.templates.hasOwnProperty(pTemplateHash)){return this.templates[pTemplateHash];}else{return false;}}},{key:"loadTemplate",value:function loadTemplate(pTemplateHash){var tmpTemplate=this.loadTemplateFunction(pTemplateHash);if(tmpTemplate){this.templates[pTemplateHash]=tmpTemplate.template;this.templateSources[pTemplateHash]="Loaded in loadTemplate('".concat(pTemplateHash,"') function by PictTemplateProvider [").concat(this.UUID,"]::[").concat(this.Hash,"] from [").concat(tmpTemplate.source,"]");}return tmpTemplate;}}]);return PictTemplateProvider;}(libFableServiceBase);module.exports=PictTemplateProvider;},{"fable":40}],114:[function(require,module,exports){var libFableServiceBase=require('fable').ServiceProviderBase;var defaultPictViewSettings={DefaultRenderable:false,DefaultDestinationAddress:false,DefaultTemplateRecordAddress:false,ViewIdentifier:'DEFAULT',InitializeOnLoad:true,RenderOnLoad:false,Templates:[],DefaultTemplates:[],Renderables:[],Manifests:{}};var PictView=/*#__PURE__*/function(_libFableServiceBase15){_inherits(PictView,_libFableServiceBase15);var _super25=_createSuper(PictView);function PictView(pFable,pOptions,pServiceHash){var _this41;_classCallCheck2(this,PictView);var tmpOptions=Object.assign({},defaultPictViewSettings,pOptions);_this41=_super25.call(this,pFable,tmpOptions,pServiceHash);_this41.serviceType='PictView';// Wire in the essential Pict service
3007
- _this41.AppData=_this41.fable.AppData;// Load all templates from the array in the options
3008
- // Templates are in the form of {Hash:'Some-Template-Hash',Template:'Template content',Source:'TemplateSource'}
3009
- for(var i=0;i<_this41.options.Templates.length;i++){var tmpTemplate=_this41.options.Templates[i];if(!tmpTemplate.hasOwnProperty('Hash')||!tmpTemplate.hasOwnProperty('Template')){_this41.log.error("PictView [".concat(_this41.UUID,"]::[").concat(_this41.Hash,"] ").concat(_this41.options.ViewIdentifier," could not load Template ").concat(i," in the options array."),tmpTemplate);}else{if(!tmpTemplate.Source){tmpTemplate.Source="PictView [".concat(_this41.UUID,"]::[").concat(_this41.Hash,"] ").concat(_this41.options.ViewIdentifier," options object.");}_this41.fable.TemplateProvider.addTemplate(tmpTemplate.Hash,tmpTemplate.Template,tmpTemplate.Source);}}// Load all default templates from the array in the options
3010
- // Templates are in the form of {Prefix:'',Postfix:'-List-Row',Template:'Template content',Source:'TemplateSourceString'}
3011
- for(var _i11=0;_i11<_this41.options.DefaultTemplates.length;_i11++){var tmpDefaultTemplate=_this41.options.DefaultTemplates[_i11];if(!tmpDefaultTemplate.hasOwnProperty('Postfix')||!tmpDefaultTemplate.hasOwnProperty('Template')){_this41.log.error("PictView [".concat(_this41.UUID,"]::[").concat(_this41.Hash,"] ").concat(_this41.options.ViewIdentifier," could not load Default Template ").concat(_i11," in the options array."),tmpDefaultTemplate);}else{if(!tmpDefaultTemplate.Source){tmpDefaultTemplate.Source="PictView [".concat(_this41.UUID,"]::[").concat(_this41.Hash,"] ").concat(_this41.options.ViewIdentifier," options object.");}_this41.fable.TemplateProvider.addDefaultTemplate(tmpDefaultTemplate.Prefix,tmpDefaultTemplate.Postfix,tmpDefaultTemplate.Template,tmpDefaultTemplate.Source);}}// Load all renderables
3012
- // Renderables are launchable renderable instructions with templates
3013
- // They look as such: {Identifier:'ContentEntry', TemplateHash:'Content-Entry-Section-Main', ContentDestinationAddress:'#ContentSection', RecordAddress:'AppData.Content.DefaultText', ManifestTransformation:'ManyfestHash', ManifestDestinationAddress:'AppData.Content.DataToTransformContent'}
3014
- // The only parts that are necessary are Identifier and Template
3015
- // A developer can then do render('ContentEntry') and it just kinda works. Or they can override the ContentDestinationAddress
3016
- _this41.renderables={};for(var _i12=0;_i12<_this41.options.Renderables.length;_i12++){var tmpRenderable=_this41.options.Renderables[_i12];if(!tmpRenderable.hasOwnProperty('RenderableHash')||!tmpRenderable.hasOwnProperty('TemplateHash')){_this41.log.error("PictView [".concat(_this41.UUID,"]::[").concat(_this41.Hash,"] ").concat(_this41.options.ViewIdentifier," could not load Renderable ").concat(_i12," in the options array."),tmpRenderable);}else{_this41.renderables[tmpRenderable.RenderableHash]=tmpRenderable;}}if(_this41.options.InitializeOnLoad){_this41.initialize();}if(_this41.options.RenderOnLoad){_this41.render(_this41.options.DefaultRenderable,_this41.options.DefaultDestinationAddress,_this41.options.DefaultTemplateRecordAddress);_this41.postInitialRenderInitialize();}return _this41;}_createClass2(PictView,[{key:"internalInitialize",value:function internalInitialize(){return true;}},{key:"postInitialRenderInitialize",value:function postInitialRenderInitialize(){return true;}},{key:"initialize",value:function initialize(){this.log.info("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," beginning initialization..."));this.internalInitialize();this.log.info("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," initialization complete."));}},{key:"render",value:function render(pRenderable,pRenderDestinationAddress,pTemplateDataAddress){var tmpRenderableHash=typeof pRenderable==='string'?pRenderable:typeof this.options.DefaultRenderable=='string'?this.options.DefaultRenderable:false;if(!tmpRenderableHash){this.log.error("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," could not render ").concat(tmpRenderableHash," (param ").concat(pRenderable,") because it is not a valid renderable."));return false;}var tmpRenderable=this.renderables[tmpRenderableHash];if(!tmpRenderable){this.log.error("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," could not render ").concat(tmpRenderableHash," (param ").concat(pRenderable,") because it does not exist."));return false;}var tmpRenderDestinationAddress=typeof pRenderDestinationAddress==='string'?pRenderDestinationAddress:typeof tmpRenderable.ContentDestinationAddress==='string'?tmpRenderable.ContentDestinationAddress:typeof this.options.DefaultDestinationAddress==='string'?this.options.DefaultDestinationAddress:false;if(!tmpRenderDestinationAddress){this.log.error("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," could not render ").concat(tmpRenderableHash," (param ").concat(pRenderable,") because it does not have a valid destination address."));return false;}var tmpDataAddress=typeof pTemplateDataAddress==='string'?pTemplateDataAddress:typeof tmpRenderable.RecordAddress==='string'?tmpRenderable.RecordAddress:typeof this.options.DefaultTemplateRecordAddress==='string'?this.options.DefaultTemplateRecordAddress:false;var tmpData=typeof tmpDataAddress==='string'?this.fable.DataProvider.getDataByAddress(tmpDataAddress):undefined;var tmpContent=this.fable.parseTemplateByHash(tmpRenderable.TemplateHash,tmpData);return this.fable.ContentAssignment.assignContent(tmpRenderDestinationAddress,tmpContent);}},{key:"renderAsync",value:function renderAsync(pRenderable,pRenderDestinationAddress,pTemplateDataAddress,fCallback){var _this42=this;var tmpRenderableHash=typeof pRenderable==='string'?pRenderable:false;if(!tmpRenderableHash){this.log.error("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," could not asynchronously render ").concat(tmpRenderableHash," (param ").concat(pRenderable,"because it is not a valid renderable."));return fCallback(Error("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," could not asynchronously render ").concat(tmpRenderableHash," (param ").concat(pRenderable,"because it is not a valid renderable.")));}var tmpRenderable=this.renderables[tmpRenderableHash];if(!tmpRenderable){this.log.error("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," could not render ").concat(tmpRenderableHash," (param ").concat(pRenderable,") because it does not exist."));return fCallback(Error("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," could not render ").concat(tmpRenderableHash," (param ").concat(pRenderable,") because it does not exist.")));}var tmpRenderDestinationAddress=typeof pRenderDestinationAddress==='string'?pRenderDestinationAddress:typeof tmpRenderable.ContentDestinationAddress==='string'?tmpRenderable.ContentDestinationAddress:typeof this.options.DefaultDestinationAddress==='string'?this.options.DefaultDestinationAddress:false;if(!tmpRenderDestinationAddress){this.log.error("PictView [".concat(this.UUID,"]::[").concat(this.Hash,"] ").concat(this.options.ViewIdentifier," could not render ").concat(tmpRenderableHash," (param ").concat(pRenderable,") because it does not have a valid destination address."));return fCallback(Error("Could not render ".concat(tmpRenderableHash)));}var tmpDataAddress=typeof pTemplateDataAddress==='string'?pTemplateDataAddress:typeof tmpRenderable.RecordAddress==='string'?tmpRenderable.RecordAddress:typeof this.options.DefaultTemplateRecordAddress==='string'?this.options.DefaultTemplateRecordAddress:false;var tmpData=typeof tmpDataAddress==='string'?this.fable.DataProvider.getDataByAddress(tmpDataAddress):undefined;this.fable.parseTemplateByHash(tmpRenderable.TemplateHash,tmpData,function(pError,pContent){if(pError){_this42.log.error("PictView [".concat(_this42.UUID,"]::[").concat(_this42.Hash,"] ").concat(_this42.options.ViewIdentifier," could not render (asynchronously) ").concat(tmpRenderableHash," (param ").concat(pRenderable,") because it did not parse the template."),pError);return fCallback(pError);}_this42.fable.ContentAssignment.assignContent(tmpRenderDestinationAddress,pContent);return fCallback(null,pContent);});}}]);return PictView;}(libFableServiceBase);module.exports=PictView;},{"fable":40}],115:[function(require,module,exports){/**
3016
+ if(!this.templates.hasOwnProperty(pTemplateHash)){this.checkDefaultTemplateHash(pTemplateHash);}if(this.templates.hasOwnProperty(pTemplateHash)){return this.templates[pTemplateHash];}else{return false;}}},{key:"loadTemplate",value:function loadTemplate(pTemplateHash){var tmpTemplate=this.loadTemplateFunction(pTemplateHash);if(tmpTemplate){this.templates[pTemplateHash]=tmpTemplate.template;this.templateSources[pTemplateHash]="Loaded in loadTemplate('".concat(pTemplateHash,"') function by PictTemplateProvider [").concat(this.UUID,"]::[").concat(this.Hash,"] from [").concat(tmpTemplate.source,"]");}return tmpTemplate;}}]);return PictTemplateProvider;}(libFableServiceBase);module.exports=PictTemplateProvider;},{"fable":40}],116:[function(require,module,exports){module.exports=require('pict-view');},{"pict-view":73}],117:[function(require,module,exports){/**
3017
3017
  * @author <steven@velozo.com>
3018
3018
  */var libFable=require('fable');var Pict=/*#__PURE__*/function(_libFable){_inherits(Pict,_libFable);var _super26=_createSuper(Pict);function Pict(pSettings){var _this43;_classCallCheck2(this,Pict);_this43=_super26.call(this,pSettings);_this43.isBrowser=new Function("try {return (this===window);} catch(pError) {return false;}");// The templateProvider provides a basic key->template mapping with default fallback capabilities
3019
3019
  _this43.serviceManager.addAndInstantiateServiceType('TemplateProvider',require('./Pict-Template-Provider.js'));_this43.serviceManager.addAndInstantiateServiceType('EntityProvider',require('./Pict-Meadow-EntityProvider.js'));_this43.serviceManager.addAndInstantiateServiceType('DataProvider',require('./Pict-DataProvider.js'));_this43.serviceManager.addAndInstantiateServiceType('ContentAssignment',require('./Pict-Content-Assignment.js'));_this43.serviceManager.instantiateServiceProvider('MetaTemplate');_this43.serviceManager.instantiateServiceProvider('DataGeneration');_this43.manifest=_this43.serviceManager.instantiateServiceProvider('Manifest');_this43.AppData={};_this43.Bundle={};_this43.serviceManager.extraServiceInitialization=function(pService){// Decorate services with pict so we can use that instead of fable to eliminate confusion
3020
3020
  pService.pict=_assertThisInitialized(_this43);return pService;};// Log noisness goes from 0 - 5, where 5 is show me everything.
3021
3021
  _this43.LogNoisiness=0;// Load manifest sets
3022
3022
  if(_this43.settings.Manifests){_this43.loadManifestSet(_this43.settings.Manifests);}_this43._DefaultPictTemplatesInitialized=false;_this43.initializePictTemplates();_this43.serviceManager.addServiceType('PictView',require('./Pict-View.js'));_this43.serviceManager.addServiceType('PictApplication',require('./Pict-Application.js'));return _this43;}// Load manifests in as Hashed services
3023
- _createClass2(Pict,[{key:"loadManifestSet",value:function loadManifestSet(pManifestSet){if(_typeof(pManifestSet)!='object'){this.log.warn("PICT [".concat(this.UUID,"] could not load Manifest Set; pManifestSet was not an object."));return false;}var tmpManifestKeys=Object.keys(pManifestSet.Manifests);if(tmpManifestKeys.length>0){for(var i=0;i<tmpManifestKeys.length;i++){// Load each manifest
3023
+ _createClass2(Pict,[{key:"loadManifestSet",value:function loadManifestSet(pManifestSet){if(_typeof(pManifestSet)!='object'){this.log.warn("PICT [".concat(this.UUID,"] could not load Manifest Set; pManifestSet was not an object."));return false;}var tmpManifestKeys=Object.keys(pManifestSet);if(tmpManifestKeys.length>0){for(var i=0;i<tmpManifestKeys.length;i++){// Load each manifest
3024
3024
  var tmpManifestKey=tmpManifestKeys[i];this.serviceManager.instantiateServiceProvider('Manifest',pManifestSet[tmpManifestKey],tmpManifestKey);}}}// Just passing an options will construct one for us.
3025
3025
  // Passing a hash will set the hash.
3026
3026
  // Passing a prototype will use that!
@@ -3062,4 +3062,4 @@ var fDataRender=function fDataRender(pHash,pData){var tmpHash=pHash.trim();var t
3062
3062
  if(!tmpTemplateString){return'';}return this.parseTemplate(tmpTemplateString,pData,fCallback);}},{key:"parseTemplateSet",value:function parseTemplateSet(pTemplateString,pDataSet,fCallback){var _this45=this;// TODO: This will need streaming -- for now janky old string append does the trick
3063
3063
  var tmpValue='';if(typeof fCallback=='function'){if(Array.isArray(pDataSet)||_typeof(pDataSet)=='object'){this.defaultServices.Utility.eachLimit(pDataSet,1,function(pRecord,fRecordTemplateCallback){return _this45.parseTemplate(pTemplateString,pRecord,function(pError,pTemplateResult){tmpValue+=pTemplateResult;return fRecordTemplateCallback();});},function(pError){return fCallback(pError,tmpValue);});}else{return fCallback(Error('Pict: Template Set: pDataSet is not an array or object.'),'');}}else{if(Array.isArray(pDataSet)||_typeof(pDataSet)=='object'){if(Array.isArray(pDataSet)){for(var i=0;i<pDataSet.length;i++){tmpValue+=this.parseTemplate(pTemplateString,pDataSet[i]);}}else{var tmpKeys=Object.keys(pDataSet);for(var _i13=0;_i13<tmpKeys.length;_i13++){tmpValue+=this.parseTemplate(pTemplateString,pDataSet[tmpKeys[_i13]]);}}return tmpValue;}else{return'';}}}},{key:"parseTemplateSetByHash",value:function parseTemplateSetByHash(pTemplateHash,pDataSet,fCallback){var tmpTemplateString=this.defaultServices.TemplateProvider.getTemplate(pTemplateHash);// TODO: Unsure if returning empty is always the right behavior -- if it isn't we will use config to set the behavior
3064
3064
  if(!tmpTemplateString){return'';}return this.parseTemplateSet(tmpTemplateString,pDataSet,fCallback);}}]);return Pict;}(libFable);;module.exports=Pict;module.exports.PictApplicationClass=require('./Pict-Application.js');module.exports.PictViewClass=require('./Pict-View.js');// This is to help understand the type of enivironement we're executing in
3065
- module.exports.isBrowser=new Function("try {return (this===window);} catch(pError) {return false;}");},{"./Pict-Application.js":109,"./Pict-Content-Assignment.js":110,"./Pict-DataProvider.js":111,"./Pict-Meadow-EntityProvider.js":112,"./Pict-Template-Provider.js":113,"./Pict-View.js":114,"fable":40}]},{},[115])(115);});
3065
+ module.exports.isBrowser=new Function("try {return (this===window);} catch(pError) {return false;}");},{"./Pict-Application.js":111,"./Pict-Content-Assignment.js":112,"./Pict-DataProvider.js":113,"./Pict-Meadow-EntityProvider.js":114,"./Pict-Template-Provider.js":115,"./Pict-View.js":116,"fable":40}]},{},[117])(117);});