feat: Add Be and tbd skill, also added Roadmap file

This commit is contained in:
2026-05-10 16:32:12 -04:00
parent 3500ade13f
commit 0bb8885802
29587 changed files with 10611695 additions and 0 deletions

652
Skills/@be/node_modules/resource-loader/lib/Loader.js generated vendored Normal file
View File

@@ -0,0 +1,652 @@
'use strict';
exports.__esModule = true;
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
var _createClass = 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, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
var _miniSignals = require('mini-signals');
var _miniSignals2 = _interopRequireDefault(_miniSignals);
var _parseUri = require('parse-uri');
var _parseUri2 = _interopRequireDefault(_parseUri);
var _async = require('./async');
var async = _interopRequireWildcard(_async);
var _Resource = require('./Resource');
var _Resource2 = _interopRequireDefault(_Resource);
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
// some constants
var MAX_PROGRESS = 100;
var rgxExtractUrlHash = /(#[\w-]+)?$/;
/**
* Manages the state and loading of multiple resources to load.
*
* @class
*/
var Loader = function () {
/**
* @param {string} [baseUrl=''] - The base url for all resources loaded by this loader.
* @param {number} [concurrency=10] - The number of resources to load concurrently.
*/
function Loader() {
var _this = this;
var baseUrl = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
var concurrency = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 10;
_classCallCheck(this, Loader);
/**
* The base url for all resources loaded by this loader.
*
* @member {string}
*/
this.baseUrl = baseUrl;
/**
* The progress percent of the loader going through the queue.
*
* @member {number}
*/
this.progress = 0;
/**
* Loading state of the loader, true if it is currently loading resources.
*
* @member {boolean}
*/
this.loading = false;
/**
* A querystring to append to every URL added to the loader.
*
* This should be a valid query string *without* the question-mark (`?`). The loader will
* also *not* escape values for you. Make sure to escape your parameters with
* [`encodeURIComponent`](https://mdn.io/encodeURIComponent) before assigning this property.
*
* @example
* const loader = new Loader();
*
* loader.defaultQueryString = 'user=me&password=secret';
*
* // This will request 'image.png?user=me&password=secret'
* loader.add('image.png').load();
*
* loader.reset();
*
* // This will request 'image.png?v=1&user=me&password=secret'
* loader.add('iamge.png?v=1').load();
*/
this.defaultQueryString = '';
/**
* The middleware to run before loading each resource.
*
* @member {function[]}
*/
this._beforeMiddleware = [];
/**
* The middleware to run after loading each resource.
*
* @member {function[]}
*/
this._afterMiddleware = [];
/**
* The tracks the resources we are currently completing parsing for.
*
* @member {Resource[]}
*/
this._resourcesParsing = [];
/**
* The `_loadResource` function bound with this object context.
*
* @private
* @member {function}
* @param {Resource} r - The resource to load
* @param {Function} d - The dequeue function
* @return {undefined}
*/
this._boundLoadResource = function (r, d) {
return _this._loadResource(r, d);
};
/**
* The resources waiting to be loaded.
*
* @private
* @member {Resource[]}
*/
this._queue = async.queue(this._boundLoadResource, concurrency);
this._queue.pause();
/**
* All the resources for this loader keyed by name.
*
* @member {object<string, Resource>}
*/
this.resources = {};
/**
* Dispatched once per loaded or errored resource.
*
* The callback looks like {@link Loader.OnProgressSignal}.
*
* @member {Signal}
*/
this.onProgress = new _miniSignals2.default();
/**
* Dispatched once per errored resource.
*
* The callback looks like {@link Loader.OnErrorSignal}.
*
* @member {Signal}
*/
this.onError = new _miniSignals2.default();
/**
* Dispatched once per loaded resource.
*
* The callback looks like {@link Loader.OnLoadSignal}.
*
* @member {Signal}
*/
this.onLoad = new _miniSignals2.default();
/**
* Dispatched when the loader begins to process the queue.
*
* The callback looks like {@link Loader.OnStartSignal}.
*
* @member {Signal}
*/
this.onStart = new _miniSignals2.default();
/**
* Dispatched when the queued resources all load.
*
* The callback looks like {@link Loader.OnCompleteSignal}.
*
* @member {Signal}
*/
this.onComplete = new _miniSignals2.default();
/**
* When the progress changes the loader and resource are disaptched.
*
* @memberof Loader
* @callback OnProgressSignal
* @param {Loader} loader - The loader the progress is advancing on.
* @param {Resource} resource - The resource that has completed or failed to cause the progress to advance.
*/
/**
* When an error occurrs the loader and resource are disaptched.
*
* @memberof Loader
* @callback OnErrorSignal
* @param {Loader} loader - The loader the error happened in.
* @param {Resource} resource - The resource that caused the error.
*/
/**
* When a load completes the loader and resource are disaptched.
*
* @memberof Loader
* @callback OnLoadSignal
* @param {Loader} loader - The loader that laoded the resource.
* @param {Resource} resource - The resource that has completed loading.
*/
/**
* When the loader starts loading resources it dispatches this callback.
*
* @memberof Loader
* @callback OnStartSignal
* @param {Loader} loader - The loader that has started loading resources.
*/
/**
* When the loader completes loading resources it dispatches this callback.
*
* @memberof Loader
* @callback OnCompleteSignal
* @param {Loader} loader - The loader that has finished loading resources.
*/
}
/**
* Adds a resource (or multiple resources) to the loader queue.
*
* This function can take a wide variety of different parameters. The only thing that is always
* required the url to load. All the following will work:
*
* ```js
* loader
* // normal param syntax
* .add('key', 'http://...', function () {})
* .add('http://...', function () {})
* .add('http://...')
*
* // object syntax
* .add({
* name: 'key2',
* url: 'http://...'
* }, function () {})
* .add({
* url: 'http://...'
* }, function () {})
* .add({
* name: 'key3',
* url: 'http://...'
* onComplete: function () {}
* })
* .add({
* url: 'https://...',
* onComplete: function () {},
* crossOrigin: true
* })
*
* // you can also pass an array of objects or urls or both
* .add([
* { name: 'key4', url: 'http://...', onComplete: function () {} },
* { url: 'http://...', onComplete: function () {} },
* 'http://...'
* ])
*
* // and you can use both params and options
* .add('key', 'http://...', { crossOrigin: true }, function () {})
* .add('http://...', { crossOrigin: true }, function () {});
* ```
*
* @param {string} [name] - The name of the resource to load, if not passed the url is used.
* @param {string} [url] - The url for this resource, relative to the baseUrl of this loader.
* @param {object} [options] - The options for the load.
* @param {boolean} [options.crossOrigin] - Is this request cross-origin? Default is to determine automatically.
* @param {Resource.LOAD_TYPE} [options.loadType=Resource.LOAD_TYPE.XHR] - How should this resource be loaded?
* @param {Resource.XHR_RESPONSE_TYPE} [options.xhrType=Resource.XHR_RESPONSE_TYPE.DEFAULT] - How should
* the data being loaded be interpreted when using XHR?
* @param {object} [options.metadata] - Extra configuration for middleware and the Resource object.
* @param {HTMLImageElement|HTMLAudioElement|HTMLVideoElement} [options.metadata.loadElement=null] - The
* element to use for loading, instead of creating one.
* @param {boolean} [options.metadata.skipSource=false] - Skips adding source(s) to the load element. This
* is useful if you want to pass in a `loadElement` that you already added load sources to.
* @param {function} [cb] - Function to call when this specific resource completes loading.
* @return {Loader} Returns itself.
*/
Loader.prototype.add = function add(name, url, options, cb) {
// special case of an array of objects or urls
if (Array.isArray(name)) {
for (var i = 0; i < name.length; ++i) {
this.add(name[i]);
}
return this;
}
// if an object is passed instead of params
if ((typeof name === 'undefined' ? 'undefined' : _typeof(name)) === 'object') {
cb = url || name.callback || name.onComplete;
options = name;
url = name.url;
name = name.name || name.key || name.url;
}
// case where no name is passed shift all args over by one.
if (typeof url !== 'string') {
cb = options;
options = url;
url = name;
}
// now that we shifted make sure we have a proper url.
if (typeof url !== 'string') {
throw new Error('No url passed to add resource to loader.');
}
// options are optional so people might pass a function and no options
if (typeof options === 'function') {
cb = options;
options = null;
}
// if loading already you can only add resources that have a parent.
if (this.loading && (!options || !options.parentResource)) {
throw new Error('Cannot add resources while the loader is running.');
}
// check if resource already exists.
if (this.resources[name]) {
throw new Error('Resource named "' + name + '" already exists.');
}
// add base url if this isn't an absolute url
url = this._prepareUrl(url);
// create the store the resource
this.resources[name] = new _Resource2.default(name, url, options);
if (typeof cb === 'function') {
this.resources[name].onAfterMiddleware.once(cb);
}
// if actively loading, make sure to adjust progress chunks for that parent and its children
if (this.loading) {
var parent = options.parentResource;
var incompleteChildren = [];
for (var _i = 0; _i < parent.children.length; ++_i) {
if (!parent.children[_i].isComplete) {
incompleteChildren.push(parent.children[_i]);
}
}
var fullChunk = parent.progressChunk * (incompleteChildren.length + 1); // +1 for parent
var eachChunk = fullChunk / (incompleteChildren.length + 2); // +2 for parent & new child
parent.children.push(this.resources[name]);
parent.progressChunk = eachChunk;
for (var _i2 = 0; _i2 < incompleteChildren.length; ++_i2) {
incompleteChildren[_i2].progressChunk = eachChunk;
}
this.resources[name].progressChunk = eachChunk;
}
// add the resource to the queue
this._queue.push(this.resources[name]);
return this;
};
/**
* Sets up a middleware function that will run *before* the
* resource is loaded.
*
* @method before
* @param {function} fn - The middleware function to register.
* @return {Loader} Returns itself.
*/
Loader.prototype.pre = function pre(fn) {
this._beforeMiddleware.push(fn);
return this;
};
/**
* Sets up a middleware function that will run *after* the
* resource is loaded.
*
* @alias use
* @method after
* @param {function} fn - The middleware function to register.
* @return {Loader} Returns itself.
*/
Loader.prototype.use = function use(fn) {
this._afterMiddleware.push(fn);
return this;
};
/**
* Resets the queue of the loader to prepare for a new load.
*
* @return {Loader} Returns itself.
*/
Loader.prototype.reset = function reset() {
this.progress = 0;
this.loading = false;
this._queue.kill();
this._queue.pause();
// abort all resource loads
for (var k in this.resources) {
var res = this.resources[k];
if (res._onLoadBinding) {
res._onLoadBinding.detach();
}
if (res.isLoading) {
res.abort();
}
}
this.resources = {};
return this;
};
/**
* Starts loading the queued resources.
*
* @param {function} [cb] - Optional callback that will be bound to the `complete` event.
* @return {Loader} Returns itself.
*/
Loader.prototype.load = function load(cb) {
// register complete callback if they pass one
if (typeof cb === 'function') {
this.onComplete.once(cb);
}
// if the queue has already started we are done here
if (this.loading) {
return this;
}
if (this._queue.idle()) {
this._onStart();
this._onComplete();
} else {
// distribute progress chunks
var numTasks = this._queue._tasks.length;
var chunk = 100 / numTasks;
for (var i = 0; i < this._queue._tasks.length; ++i) {
this._queue._tasks[i].data.progressChunk = chunk;
}
// notify we are starting
this._onStart();
// start loading
this._queue.resume();
}
return this;
};
/**
* The number of resources to load concurrently.
*
* @member {number}
* @default 10
*/
/**
* Prepares a url for usage based on the configuration of this object
*
* @private
* @param {string} url - The url to prepare.
* @return {string} The prepared url.
*/
Loader.prototype._prepareUrl = function _prepareUrl(url) {
var parsedUrl = (0, _parseUri2.default)(url, { strictMode: true });
var result = void 0;
// absolute url, just use it as is.
if (parsedUrl.protocol || !parsedUrl.path || url.indexOf('//') === 0) {
result = url;
}
// if baseUrl doesn't end in slash and url doesn't start with slash, then add a slash inbetween
else if (this.baseUrl.length && this.baseUrl.lastIndexOf('/') !== this.baseUrl.length - 1 && url.charAt(0) !== '/') {
result = this.baseUrl + '/' + url;
} else {
result = this.baseUrl + url;
}
// if we need to add a default querystring, there is a bit more work
if (this.defaultQueryString) {
var hash = rgxExtractUrlHash.exec(result)[0];
result = result.substr(0, result.length - hash.length);
if (result.indexOf('?') !== -1) {
result += '&' + this.defaultQueryString;
} else {
result += '?' + this.defaultQueryString;
}
result += hash;
}
return result;
};
/**
* Loads a single resource.
*
* @private
* @param {Resource} resource - The resource to load.
* @param {function} dequeue - The function to call when we need to dequeue this item.
*/
Loader.prototype._loadResource = function _loadResource(resource, dequeue) {
var _this2 = this;
resource._dequeue = dequeue;
// run before middleware
async.eachSeries(this._beforeMiddleware, function (fn, next) {
fn.call(_this2, resource, function () {
// if the before middleware marks the resource as complete,
// break and don't process any more before middleware
next(resource.isComplete ? {} : null);
});
}, function () {
if (resource.isComplete) {
_this2._onLoad(resource);
} else {
resource._onLoadBinding = resource.onComplete.once(_this2._onLoad, _this2);
resource.load();
}
}, true);
};
/**
* Called once loading has started.
*
* @private
*/
Loader.prototype._onStart = function _onStart() {
this.progress = 0;
this.loading = true;
this.onStart.dispatch(this);
};
/**
* Called once each resource has loaded.
*
* @private
*/
Loader.prototype._onComplete = function _onComplete() {
this.progress = MAX_PROGRESS;
this.loading = false;
this.onComplete.dispatch(this, this.resources);
};
/**
* Called each time a resources is loaded.
*
* @private
* @param {Resource} resource - The resource that was loaded
*/
Loader.prototype._onLoad = function _onLoad(resource) {
var _this3 = this;
resource._onLoadBinding = null;
// remove this resource from the async queue, and add it to our list of resources that are being parsed
this._resourcesParsing.push(resource);
resource._dequeue();
// run all the after middleware for this resource
async.eachSeries(this._afterMiddleware, function (fn, next) {
fn.call(_this3, resource, next);
}, function () {
resource.onAfterMiddleware.dispatch(resource);
_this3.progress += resource.progressChunk;
_this3.onProgress.dispatch(_this3, resource);
if (resource.error) {
_this3.onError.dispatch(resource.error, _this3, resource);
} else {
_this3.onLoad.dispatch(_this3, resource);
}
_this3._resourcesParsing.splice(_this3._resourcesParsing.indexOf(resource), 1);
// do completion check
if (_this3._queue.idle() && _this3._resourcesParsing.length === 0) {
_this3._onComplete();
}
}, true);
};
_createClass(Loader, [{
key: 'concurrency',
get: function get() {
return this._queue.concurrency;
}
// eslint-disable-next-line require-jsdoc
,
set: function set(concurrency) {
this._queue.concurrency = concurrency;
}
}]);
return Loader;
}();
exports.default = Loader;
//# sourceMappingURL=Loader.js.map

File diff suppressed because one or more lines are too long

1155
Skills/@be/node_modules/resource-loader/lib/Resource.js generated vendored Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

208
Skills/@be/node_modules/resource-loader/lib/async.js generated vendored Normal file
View File

@@ -0,0 +1,208 @@
'use strict';
exports.__esModule = true;
exports.eachSeries = eachSeries;
exports.queue = queue;
/**
* Smaller version of the async library constructs.
*
*/
function _noop() {} /* empty */
/**
* Iterates an array in series.
*
* @param {Array.<*>} array - Array to iterate.
* @param {function} iterator - Function to call for each element.
* @param {function} callback - Function to call when done, or on error.
* @param {boolean} [deferNext=false] - Break synchronous each loop by calling next with a setTimeout of 1.
*/
function eachSeries(array, iterator, callback, deferNext) {
var i = 0;
var len = array.length;
(function next(err) {
if (err || i === len) {
if (callback) {
callback(err);
}
return;
}
if (deferNext) {
setTimeout(function () {
iterator(array[i++], next);
}, 1);
} else {
iterator(array[i++], next);
}
})();
}
/**
* Ensures a function is only called once.
*
* @param {function} fn - The function to wrap.
* @return {function} The wrapping function.
*/
function onlyOnce(fn) {
return function onceWrapper() {
if (fn === null) {
throw new Error('Callback was already called.');
}
var callFn = fn;
fn = null;
callFn.apply(this, arguments);
};
}
/**
* Async queue implementation,
*
* @param {function} worker - The worker function to call for each task.
* @param {number} concurrency - How many workers to run in parrallel.
* @return {*} The async queue object.
*/
function queue(worker, concurrency) {
if (concurrency == null) {
// eslint-disable-line no-eq-null,eqeqeq
concurrency = 1;
} else if (concurrency === 0) {
throw new Error('Concurrency must not be zero');
}
var workers = 0;
var q = {
_tasks: [],
concurrency: concurrency,
saturated: _noop,
unsaturated: _noop,
buffer: concurrency / 4,
empty: _noop,
drain: _noop,
error: _noop,
started: false,
paused: false,
push: function push(data, callback) {
_insert(data, false, callback);
},
kill: function kill() {
workers = 0;
q.drain = _noop;
q.started = false;
q._tasks = [];
},
unshift: function unshift(data, callback) {
_insert(data, true, callback);
},
process: function process() {
while (!q.paused && workers < q.concurrency && q._tasks.length) {
var task = q._tasks.shift();
if (q._tasks.length === 0) {
q.empty();
}
workers += 1;
if (workers === q.concurrency) {
q.saturated();
}
worker(task.data, onlyOnce(_next(task)));
}
},
length: function length() {
return q._tasks.length;
},
running: function running() {
return workers;
},
idle: function idle() {
return q._tasks.length + workers === 0;
},
pause: function pause() {
if (q.paused === true) {
return;
}
q.paused = true;
},
resume: function resume() {
if (q.paused === false) {
return;
}
q.paused = false;
// Need to call q.process once per concurrent
// worker to preserve full concurrency after pause
for (var w = 1; w <= q.concurrency; w++) {
q.process();
}
}
};
function _insert(data, insertAtFront, callback) {
if (callback != null && typeof callback !== 'function') {
// eslint-disable-line no-eq-null,eqeqeq
throw new Error('task callback must be a function');
}
q.started = true;
if (data == null && q.idle()) {
// eslint-disable-line no-eq-null,eqeqeq
// call drain immediately if there are no tasks
setTimeout(function () {
return q.drain();
}, 1);
return;
}
var item = {
data: data,
callback: typeof callback === 'function' ? callback : _noop
};
if (insertAtFront) {
q._tasks.unshift(item);
} else {
q._tasks.push(item);
}
setTimeout(function () {
return q.process();
}, 1);
}
function _next(task) {
return function next() {
workers -= 1;
task.callback.apply(task, arguments);
if (arguments[0] != null) {
// eslint-disable-line no-eq-null,eqeqeq
q.error(arguments[0], task.data);
}
if (workers <= q.concurrency - q.buffer) {
q.unsaturated();
}
if (q.idle()) {
q.drain();
}
q.process();
};
}
return q;
}
//# sourceMappingURL=async.js.map

File diff suppressed because one or more lines are too long

67
Skills/@be/node_modules/resource-loader/lib/b64.js generated vendored Normal file
View File

@@ -0,0 +1,67 @@
'use strict';
exports.__esModule = true;
exports.encodeBinary = encodeBinary;
var _keyStr = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
function encodeBinary(input) {
var output = '';
var inx = 0;
while (inx < input.length) {
// Fill byte buffer array
var bytebuffer = [0, 0, 0];
var encodedCharIndexes = [0, 0, 0, 0];
for (var jnx = 0; jnx < bytebuffer.length; ++jnx) {
if (inx < input.length) {
// throw away high-order byte, as documented at:
// https://developer.mozilla.org/En/Using_XMLHttpRequest#Handling_binary_data
bytebuffer[jnx] = input.charCodeAt(inx++) & 0xff;
} else {
bytebuffer[jnx] = 0;
}
}
// Get each encoded character, 6 bits at a time
// index 1: first 6 bits
encodedCharIndexes[0] = bytebuffer[0] >> 2;
// index 2: second 6 bits (2 least significant bits from input byte 1 + 4 most significant bits from byte 2)
encodedCharIndexes[1] = (bytebuffer[0] & 0x3) << 4 | bytebuffer[1] >> 4;
// index 3: third 6 bits (4 least significant bits from input byte 2 + 2 most significant bits from byte 3)
encodedCharIndexes[2] = (bytebuffer[1] & 0x0f) << 2 | bytebuffer[2] >> 6;
// index 3: forth 6 bits (6 least significant bits from input byte 3)
encodedCharIndexes[3] = bytebuffer[2] & 0x3f;
// Determine whether padding happened, and adjust accordingly
var paddingBytes = inx - (input.length - 1);
switch (paddingBytes) {
case 2:
// Set last 2 characters to padding char
encodedCharIndexes[3] = 64;
encodedCharIndexes[2] = 64;
break;
case 1:
// Set last character to padding char
encodedCharIndexes[3] = 64;
break;
default:
break; // No padding - proceed
}
// Now we will grab each appropriate character out of our keystring
// based on our index array and append it to the output string
for (var _jnx = 0; _jnx < encodedCharIndexes.length; ++_jnx) {
output += _keyStr.charAt(encodedCharIndexes[_jnx]);
}
}
return output;
}
//# sourceMappingURL=b64.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../src/b64.js"],"names":["encodeBinary","_keyStr","input","output","inx","length","bytebuffer","encodedCharIndexes","jnx","charCodeAt","paddingBytes","charAt"],"mappings":";;;QAEgBA,Y,GAAAA,Y;AAFhB,IAAMC,UAAU,mEAAhB;;AAEO,SAASD,YAAT,CAAsBE,KAAtB,EAA6B;AAChC,QAAIC,SAAS,EAAb;AACA,QAAIC,MAAM,CAAV;;AAEA,WAAOA,MAAMF,MAAMG,MAAnB,EAA2B;AACvB;AACA,YAAMC,aAAa,CAAC,CAAD,EAAI,CAAJ,EAAO,CAAP,CAAnB;AACA,YAAMC,qBAAqB,CAAC,CAAD,EAAI,CAAJ,EAAO,CAAP,EAAU,CAAV,CAA3B;;AAEA,aAAK,IAAIC,MAAM,CAAf,EAAkBA,MAAMF,WAAWD,MAAnC,EAA2C,EAAEG,GAA7C,EAAkD;AAC9C,gBAAIJ,MAAMF,MAAMG,MAAhB,EAAwB;AACpB;AACA;AACAC,2BAAWE,GAAX,IAAkBN,MAAMO,UAAN,CAAiBL,KAAjB,IAA0B,IAA5C;AACH,aAJD,MAKK;AACDE,2BAAWE,GAAX,IAAkB,CAAlB;AACH;AACJ;;AAED;AACA;AACAD,2BAAmB,CAAnB,IAAwBD,WAAW,CAAX,KAAiB,CAAzC;;AAEA;AACAC,2BAAmB,CAAnB,IAAyB,CAACD,WAAW,CAAX,IAAgB,GAAjB,KAAyB,CAA1B,GAAgCA,WAAW,CAAX,KAAiB,CAAzE;;AAEA;AACAC,2BAAmB,CAAnB,IAAyB,CAACD,WAAW,CAAX,IAAgB,IAAjB,KAA0B,CAA3B,GAAiCA,WAAW,CAAX,KAAiB,CAA1E;;AAEA;AACAC,2BAAmB,CAAnB,IAAwBD,WAAW,CAAX,IAAgB,IAAxC;;AAEA;AACA,YAAMI,eAAeN,OAAOF,MAAMG,MAAN,GAAe,CAAtB,CAArB;;AAEA,gBAAQK,YAAR;AACI,iBAAK,CAAL;AACI;AACAH,mCAAmB,CAAnB,IAAwB,EAAxB;AACAA,mCAAmB,CAAnB,IAAwB,EAAxB;AACA;;AAEJ,iBAAK,CAAL;AACI;AACAA,mCAAmB,CAAnB,IAAwB,EAAxB;AACA;;AAEJ;AACI,sBAbR,CAae;AAbf;;AAgBA;AACA;AACA,aAAK,IAAIC,OAAM,CAAf,EAAkBA,OAAMD,mBAAmBF,MAA3C,EAAmD,EAAEG,IAArD,EAA0D;AACtDL,sBAAUF,QAAQU,MAAR,CAAeJ,mBAAmBC,IAAnB,CAAf,CAAV;AACH;AACJ;;AAED,WAAOL,MAAP;AACH","file":"b64.js","sourcesContent":["const _keyStr = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';\n\nexport function encodeBinary(input) {\n let output = '';\n let inx = 0;\n\n while (inx < input.length) {\n // Fill byte buffer array\n const bytebuffer = [0, 0, 0];\n const encodedCharIndexes = [0, 0, 0, 0];\n\n for (let jnx = 0; jnx < bytebuffer.length; ++jnx) {\n if (inx < input.length) {\n // throw away high-order byte, as documented at:\n // https://developer.mozilla.org/En/Using_XMLHttpRequest#Handling_binary_data\n bytebuffer[jnx] = input.charCodeAt(inx++) & 0xff;\n }\n else {\n bytebuffer[jnx] = 0;\n }\n }\n\n // Get each encoded character, 6 bits at a time\n // index 1: first 6 bits\n encodedCharIndexes[0] = bytebuffer[0] >> 2;\n\n // index 2: second 6 bits (2 least significant bits from input byte 1 + 4 most significant bits from byte 2)\n encodedCharIndexes[1] = ((bytebuffer[0] & 0x3) << 4) | (bytebuffer[1] >> 4);\n\n // index 3: third 6 bits (4 least significant bits from input byte 2 + 2 most significant bits from byte 3)\n encodedCharIndexes[2] = ((bytebuffer[1] & 0x0f) << 2) | (bytebuffer[2] >> 6);\n\n // index 3: forth 6 bits (6 least significant bits from input byte 3)\n encodedCharIndexes[3] = bytebuffer[2] & 0x3f;\n\n // Determine whether padding happened, and adjust accordingly\n const paddingBytes = inx - (input.length - 1);\n\n switch (paddingBytes) {\n case 2:\n // Set last 2 characters to padding char\n encodedCharIndexes[3] = 64;\n encodedCharIndexes[2] = 64;\n break;\n\n case 1:\n // Set last character to padding char\n encodedCharIndexes[3] = 64;\n break;\n\n default:\n break; // No padding - proceed\n }\n\n // Now we will grab each appropriate character out of our keystring\n // based on our index array and append it to the output string\n for (let jnx = 0; jnx < encodedCharIndexes.length; ++jnx) {\n output += _keyStr.charAt(encodedCharIndexes[jnx]);\n }\n }\n\n return output;\n}\n"]}

23
Skills/@be/node_modules/resource-loader/lib/index.js generated vendored Normal file
View File

@@ -0,0 +1,23 @@
'use strict';
// import Loader from './Loader';
// import Resource from './Resource';
// import * as async from './async';
// import * as b64 from './b64';
/* eslint-disable no-undef */
var Loader = require('./Loader').default;
var Resource = require('./Resource').default;
var async = require('./async');
var b64 = require('./b64');
Loader.Resource = Resource;
Loader.async = async;
Loader.base64 = b64;
// export manually, and also as default
module.exports = Loader;
// export default Loader;
module.exports.default = Loader;
//# sourceMappingURL=index.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../src/index.js"],"names":["Loader","require","default","Resource","async","b64","base64","module","exports"],"mappings":";;AAAA;AACA;AACA;AACA;;AAEA;;AAEA,IAAMA,SAASC,QAAQ,UAAR,EAAoBC,OAAnC;AACA,IAAMC,WAAWF,QAAQ,YAAR,EAAsBC,OAAvC;AACA,IAAME,QAAQH,QAAQ,SAAR,CAAd;AACA,IAAMI,MAAMJ,QAAQ,OAAR,CAAZ;;AAEAD,OAAOG,QAAP,GAAkBA,QAAlB;AACAH,OAAOI,KAAP,GAAeA,KAAf;AACAJ,OAAOM,MAAP,GAAgBD,GAAhB;;AAEA;AACAE,OAAOC,OAAP,GAAiBR,MAAjB;AACA;AACAO,OAAOC,OAAP,CAAeN,OAAf,GAAyBF,MAAzB","file":"index.js","sourcesContent":["// import Loader from './Loader';\n// import Resource from './Resource';\n// import * as async from './async';\n// import * as b64 from './b64';\n\n/* eslint-disable no-undef */\n\nconst Loader = require('./Loader').default;\nconst Resource = require('./Resource').default;\nconst async = require('./async');\nconst b64 = require('./b64');\n\nLoader.Resource = Resource;\nLoader.async = async;\nLoader.base64 = b64;\n\n// export manually, and also as default\nmodule.exports = Loader;\n// export default Loader;\nmodule.exports.default = Loader;\n"]}

View File

@@ -0,0 +1,27 @@
"use strict";
exports.__esModule = true;
exports.memoryMiddlewareFactory = memoryMiddlewareFactory;
// a simple in-memory cache for resources
var cache = {};
function memoryMiddlewareFactory() {
return function memoryMiddleware(resource, next) {
var _this = this;
// if cached, then set data and complete the resource
if (cache[resource.url]) {
resource.data = cache[resource.url];
resource.complete(); // marks resource load complete and stops processing before middlewares
}
// if not cached, wait for complete and store it in the cache.
else {
resource.onComplete.once(function () {
return cache[_this.url] = _this.data;
});
}
next();
};
}
//# sourceMappingURL=memory.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../src/middlewares/caching/memory.js"],"names":["memoryMiddlewareFactory","cache","memoryMiddleware","resource","next","url","data","complete","onComplete","once"],"mappings":";;;QAGgBA,uB,GAAAA,uB;AAHhB;AACA,IAAMC,QAAQ,EAAd;;AAEO,SAASD,uBAAT,GAAmC;AACtC,WAAO,SAASE,gBAAT,CAA0BC,QAA1B,EAAoCC,IAApC,EAA0C;AAAA;;AAC7C;AACA,YAAIH,MAAME,SAASE,GAAf,CAAJ,EAAyB;AACrBF,qBAASG,IAAT,GAAgBL,MAAME,SAASE,GAAf,CAAhB;AACAF,qBAASI,QAAT,GAFqB,CAEA;AACxB;AACD;AAJA,aAKK;AACDJ,yBAASK,UAAT,CAAoBC,IAApB,CAAyB;AAAA,2BAAOR,MAAM,MAAKI,GAAX,IAAkB,MAAKC,IAA9B;AAAA,iBAAzB;AACH;;AAEDF;AACH,KAZD;AAaH","file":"memory.js","sourcesContent":["// a simple in-memory cache for resources\nconst cache = {};\n\nexport function memoryMiddlewareFactory() {\n return function memoryMiddleware(resource, next) {\n // if cached, then set data and complete the resource\n if (cache[resource.url]) {\n resource.data = cache[resource.url];\n resource.complete(); // marks resource load complete and stops processing before middlewares\n }\n // if not cached, wait for complete and store it in the cache.\n else {\n resource.onComplete.once(() => (cache[this.url] = this.data));\n }\n\n next();\n };\n}\n"]}

View File

@@ -0,0 +1,87 @@
'use strict';
exports.__esModule = true;
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
exports.blobMiddlewareFactory = blobMiddlewareFactory;
var _Resource = require('../../Resource');
var _Resource2 = _interopRequireDefault(_Resource);
var _b = require('../../b64');
var _b2 = _interopRequireDefault(_b);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var Url = window.URL || window.webkitURL;
// a middleware for transforming XHR loaded Blobs into more useful objects
function blobMiddlewareFactory() {
return function blobMiddleware(resource, next) {
if (!resource.data) {
next();
return;
}
// if this was an XHR load of a blob
if (resource.xhr && resource.xhrType === _Resource2.default.XHR_RESPONSE_TYPE.BLOB) {
// if there is no blob support we probably got a binary string back
if (!window.Blob || typeof resource.data === 'string') {
var type = resource.xhr.getResponseHeader('content-type');
// this is an image, convert the binary string into a data url
if (type && type.indexOf('image') === 0) {
resource.data = new Image();
resource.data.src = 'data:' + type + ';base64,' + _b2.default.encodeBinary(resource.xhr.responseText);
resource.type = _Resource2.default.TYPE.IMAGE;
// wait until the image loads and then callback
resource.data.onload = function () {
resource.data.onload = null;
next();
};
// next will be called on load
return;
}
}
// if content type says this is an image, then we should transform the blob into an Image object
else if (resource.data.type.indexOf('image') === 0) {
var _ret = function () {
var src = Url.createObjectURL(resource.data);
resource.blob = resource.data;
resource.data = new Image();
resource.data.src = src;
resource.type = _Resource2.default.TYPE.IMAGE;
// cleanup the no longer used blob after the image loads
// TODO: Is this correct? Will the image be invalid after revoking?
resource.data.onload = function () {
Url.revokeObjectURL(src);
resource.data.onload = null;
next();
};
// next will be called on load.
return {
v: void 0
};
}();
if ((typeof _ret === 'undefined' ? 'undefined' : _typeof(_ret)) === "object") return _ret.v;
}
}
next();
};
}
//# sourceMappingURL=blob.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["../../../src/middlewares/parsing/blob.js"],"names":["blobMiddlewareFactory","Url","window","URL","webkitURL","blobMiddleware","resource","next","data","xhr","xhrType","XHR_RESPONSE_TYPE","BLOB","Blob","type","getResponseHeader","indexOf","Image","src","encodeBinary","responseText","TYPE","IMAGE","onload","createObjectURL","blob","revokeObjectURL"],"mappings":";;;;;;QAMgBA,qB,GAAAA,qB;;AANhB;;;;AACA;;;;;;AAEA,IAAMC,MAAMC,OAAOC,GAAP,IAAcD,OAAOE,SAAjC;;AAEA;AACO,SAASJ,qBAAT,GAAiC;AACpC,WAAO,SAASK,cAAT,CAAwBC,QAAxB,EAAkCC,IAAlC,EAAwC;AAC3C,YAAI,CAACD,SAASE,IAAd,EAAoB;AAChBD;;AAEA;AACH;;AAED;AACA,YAAID,SAASG,GAAT,IAAgBH,SAASI,OAAT,KAAqB,mBAASC,iBAAT,CAA2BC,IAApE,EAA0E;AACtE;AACA,gBAAI,CAACV,OAAOW,IAAR,IAAgB,OAAOP,SAASE,IAAhB,KAAyB,QAA7C,EAAuD;AACnD,oBAAMM,OAAOR,SAASG,GAAT,CAAaM,iBAAb,CAA+B,cAA/B,CAAb;;AAEA;AACA,oBAAID,QAAQA,KAAKE,OAAL,CAAa,OAAb,MAA0B,CAAtC,EAAyC;AACrCV,6BAASE,IAAT,GAAgB,IAAIS,KAAJ,EAAhB;AACAX,6BAASE,IAAT,CAAcU,GAAd,aAA4BJ,IAA5B,gBAA2C,YAAIK,YAAJ,CAAiBb,SAASG,GAAT,CAAaW,YAA9B,CAA3C;;AAEAd,6BAASQ,IAAT,GAAgB,mBAASO,IAAT,CAAcC,KAA9B;;AAEA;AACAhB,6BAASE,IAAT,CAAce,MAAd,GAAuB,YAAM;AACzBjB,iCAASE,IAAT,CAAce,MAAd,GAAuB,IAAvB;;AAEAhB;AACH,qBAJD;;AAMA;AACA;AACH;AACJ;AACD;AArBA,iBAsBK,IAAID,SAASE,IAAT,CAAcM,IAAd,CAAmBE,OAAnB,CAA2B,OAA3B,MAAwC,CAA5C,EAA+C;AAAA;AAChD,4BAAME,MAAMjB,IAAIuB,eAAJ,CAAoBlB,SAASE,IAA7B,CAAZ;;AAEAF,iCAASmB,IAAT,GAAgBnB,SAASE,IAAzB;AACAF,iCAASE,IAAT,GAAgB,IAAIS,KAAJ,EAAhB;AACAX,iCAASE,IAAT,CAAcU,GAAd,GAAoBA,GAApB;;AAEAZ,iCAASQ,IAAT,GAAgB,mBAASO,IAAT,CAAcC,KAA9B;;AAEA;AACA;AACAhB,iCAASE,IAAT,CAAce,MAAd,GAAuB,YAAM;AACzBtB,gCAAIyB,eAAJ,CAAoBR,GAApB;AACAZ,qCAASE,IAAT,CAAce,MAAd,GAAuB,IAAvB;;AAEAhB;AACH,yBALD;;AAOA;AACA;AAAA;AAAA;AAnBgD;;AAAA;AAoBnD;AACJ;;AAEDA;AACH,KAxDD;AAyDH","file":"blob.js","sourcesContent":["import Resource from '../../Resource';\nimport b64 from '../../b64';\n\nconst Url = window.URL || window.webkitURL;\n\n// a middleware for transforming XHR loaded Blobs into more useful objects\nexport function blobMiddlewareFactory() {\n return function blobMiddleware(resource, next) {\n if (!resource.data) {\n next();\n\n return;\n }\n\n // if this was an XHR load of a blob\n if (resource.xhr && resource.xhrType === Resource.XHR_RESPONSE_TYPE.BLOB) {\n // if there is no blob support we probably got a binary string back\n if (!window.Blob || typeof resource.data === 'string') {\n const type = resource.xhr.getResponseHeader('content-type');\n\n // this is an image, convert the binary string into a data url\n if (type && type.indexOf('image') === 0) {\n resource.data = new Image();\n resource.data.src = `data:${type};base64,${b64.encodeBinary(resource.xhr.responseText)}`;\n\n resource.type = Resource.TYPE.IMAGE;\n\n // wait until the image loads and then callback\n resource.data.onload = () => {\n resource.data.onload = null;\n\n next();\n };\n\n // next will be called on load\n return;\n }\n }\n // if content type says this is an image, then we should transform the blob into an Image object\n else if (resource.data.type.indexOf('image') === 0) {\n const src = Url.createObjectURL(resource.data);\n\n resource.blob = resource.data;\n resource.data = new Image();\n resource.data.src = src;\n\n resource.type = Resource.TYPE.IMAGE;\n\n // cleanup the no longer used blob after the image loads\n // TODO: Is this correct? Will the image be invalid after revoking?\n resource.data.onload = () => {\n Url.revokeObjectURL(src);\n resource.data.onload = null;\n\n next();\n };\n\n // next will be called on load.\n return;\n }\n }\n\n next();\n };\n}\n"]}