@tko/provider.multi
Advanced tools
+11
-1336
@@ -1,2 +0,2 @@ | ||
| // @tko/provider.multi 🥊 4.0.0 CommonJS | ||
| // @tko/provider.multi 🥊 4.0.1 CommonJS | ||
| "use strict"; | ||
@@ -11,2 +11,3 @@ var __defProp = Object.defineProperty; | ||
| }; | ||
| var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; | ||
| var __export = (target, all) => { | ||
@@ -25,2 +26,3 @@ for (var name in all) | ||
| var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); | ||
| var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value); | ||
| var __await = function(promise, isYieldStar) { | ||
@@ -66,1340 +68,10 @@ this[0] = promise; | ||
| // ../utils/dist/array.js | ||
| var { isArray } = Array; | ||
| function arrayForEach(array, action, actionOwner) { | ||
| if (arguments.length > 2) { | ||
| action = action.bind(actionOwner); | ||
| } | ||
| for (let i = 0, j = array.length; i < j; ++i) { | ||
| action(array[i], i, array); | ||
| } | ||
| } | ||
| function arrayIndexOf(array, item) { | ||
| return (isArray(array) ? array : [...array]).indexOf(item); | ||
| } | ||
| function arrayRemoveItem(array, itemToRemove) { | ||
| const index = arrayIndexOf(array, itemToRemove); | ||
| if (index > 0) { | ||
| array.splice(index, 1); | ||
| } else if (index === 0) { | ||
| array.shift(); | ||
| } | ||
| } | ||
| function findMovesInArrayComparison(left, right, limitFailedCompares) { | ||
| if (left.length && right.length) { | ||
| let failedCompares, l, r, leftItem, rightItem; | ||
| for (failedCompares = l = 0; (!limitFailedCompares || failedCompares < limitFailedCompares) && (leftItem = left[l]); ++l) { | ||
| for (r = 0; rightItem = right[r]; ++r) { | ||
| if (leftItem.value === rightItem.value) { | ||
| leftItem.moved = rightItem.index; | ||
| rightItem.moved = leftItem.index; | ||
| right.splice(r, 1); | ||
| failedCompares = r = 0; | ||
| break; | ||
| } | ||
| } | ||
| failedCompares += r; | ||
| } | ||
| } | ||
| } | ||
| var statusNotInOld = "added"; | ||
| var statusNotInNew = "deleted"; | ||
| function compareArrays(oldArray, newArray, options2) { | ||
| options2 = typeof options2 === "boolean" ? { dontLimitMoves: options2 } : options2 || {}; | ||
| oldArray = oldArray || []; | ||
| newArray = newArray || []; | ||
| if (oldArray.length < newArray.length) { | ||
| return compareSmallArrayToBigArray(oldArray, newArray, statusNotInOld, statusNotInNew, options2); | ||
| } else { | ||
| return compareSmallArrayToBigArray(newArray, oldArray, statusNotInNew, statusNotInOld, options2); | ||
| } | ||
| } | ||
| function compareSmallArrayToBigArray(smlArray, bigArray, statusNotInSml, statusNotInBig, options2) { | ||
| let myMin = Math.min, myMax = Math.max, editDistanceMatrix = new Array(), smlIndex, smlIndexMax = smlArray.length, bigIndex, bigIndexMax = bigArray.length, compareRange = bigIndexMax - smlIndexMax || 1, maxDistance = smlIndexMax + bigIndexMax + 1, thisRow, lastRow, bigIndexMaxForRow, bigIndexMinForRow; | ||
| for (smlIndex = 0; smlIndex <= smlIndexMax; smlIndex++) { | ||
| lastRow = thisRow; | ||
| editDistanceMatrix.push(thisRow = new Array()); | ||
| bigIndexMaxForRow = myMin(bigIndexMax, smlIndex + compareRange); | ||
| bigIndexMinForRow = myMax(0, smlIndex - 1); | ||
| for (bigIndex = bigIndexMinForRow; bigIndex <= bigIndexMaxForRow; bigIndex++) { | ||
| if (!bigIndex) { | ||
| thisRow[bigIndex] = smlIndex + 1; | ||
| } else if (!smlIndex) { | ||
| thisRow[bigIndex] = bigIndex + 1; | ||
| } else if (smlArray[smlIndex - 1] === bigArray[bigIndex - 1]) { | ||
| thisRow[bigIndex] = lastRow[bigIndex - 1]; | ||
| } else { | ||
| const northDistance = lastRow[bigIndex] || maxDistance; | ||
| const westDistance = thisRow[bigIndex - 1] || maxDistance; | ||
| thisRow[bigIndex] = myMin(northDistance, westDistance) + 1; | ||
| } | ||
| } | ||
| } | ||
| let editScript = new Array(), meMinusOne, notInSml = new Array(), notInBig = new Array(); | ||
| for (smlIndex = smlIndexMax, bigIndex = bigIndexMax; smlIndex || bigIndex; ) { | ||
| meMinusOne = editDistanceMatrix[smlIndex][bigIndex] - 1; | ||
| if (bigIndex && meMinusOne === editDistanceMatrix[smlIndex][bigIndex - 1]) { | ||
| notInSml.push( | ||
| editScript[editScript.length] = { | ||
| // added | ||
| status: statusNotInSml, | ||
| value: bigArray[--bigIndex], | ||
| index: bigIndex | ||
| } | ||
| ); | ||
| } else if (smlIndex && meMinusOne === editDistanceMatrix[smlIndex - 1][bigIndex]) { | ||
| notInBig.push( | ||
| editScript[editScript.length] = { | ||
| // deleted | ||
| status: statusNotInBig, | ||
| value: smlArray[--smlIndex], | ||
| index: smlIndex | ||
| } | ||
| ); | ||
| } else { | ||
| --bigIndex; | ||
| --smlIndex; | ||
| if (!(options2 == null ? void 0 : options2.sparse)) { | ||
| editScript.push({ status: "retained", value: bigArray[bigIndex] }); | ||
| } | ||
| } | ||
| } | ||
| findMovesInArrayComparison(notInBig, notInSml, !options2.dontLimitMoves && smlIndexMax * 10); | ||
| return editScript.reverse(); | ||
| } | ||
| // ../utils/dist/options.js | ||
| var Options = class { | ||
| constructor() { | ||
| this.bindingStringPreparsers = []; | ||
| this.knockoutInstance = null; | ||
| this.deferUpdates = false; | ||
| this.useOnlyNativeEvents = true; | ||
| this.useTemplateTag = true; | ||
| this.protoProperty = "__ko_proto__"; | ||
| this.defaultBindingAttribute = "data-bind"; | ||
| this.allowVirtualElements = true; | ||
| this.bindingGlobals = /* @__PURE__ */ Object.create(null); | ||
| this.createChildContextWithAs = false; | ||
| this.disableJQueryUsage = false; | ||
| this.Promise = globalThis.Promise; | ||
| this.taskScheduler = null; | ||
| this.debug = false; | ||
| this.templateSizeLimit = 4096; | ||
| this.allowScriptTagsInTemplates = false; | ||
| this._sanitizeWarningLogged = false; | ||
| this.global = globalThis; | ||
| this.document = globalThis.document; | ||
| this.filters = {}; | ||
| this.includeDestroyed = false; | ||
| this.foreachHidesDestroyed = false; | ||
| } | ||
| get jQuery() { | ||
| var _a; | ||
| if (this.disableJQueryUsage) return; | ||
| return (_a = this._jQuery) != null ? _a : globalThis.jQuery; | ||
| } | ||
| /** | ||
| * Set jQuery manuall to be used by TKO. | ||
| * @param jQuery If jQuery set to undefined, TKO will not use jQuery and this.disableJQueryUsage to true. | ||
| */ | ||
| set jQuery(jQuery) { | ||
| if (!jQuery) { | ||
| this.disableJQueryUsage = true; | ||
| this._jQuery = void 0; | ||
| } else { | ||
| this._jQuery = jQuery; | ||
| this.disableJQueryUsage = false; | ||
| } | ||
| } | ||
| /** | ||
| * Sanitize HTML templates before parsing them. Default is a no-op. | ||
| * Please configure something like DOMPurify or validator.js for your environment. | ||
| * @param html HTML string to be sanitized | ||
| * @returns Sanitized HTML string | ||
| */ | ||
| sanitizeHtmlTemplate(html) { | ||
| if (!this._sanitizeWarningLogged) { | ||
| console.warn( | ||
| "WARNING -- You don't have a HTML sanitizer configured. Please configure options.sanitizeHtmlTemplate to avoid XSS vulnerabilities." | ||
| ); | ||
| this._sanitizeWarningLogged = true; | ||
| } | ||
| return html; | ||
| } | ||
| onError(e, throws = true) { | ||
| if (throws) throw e; | ||
| return e; | ||
| } | ||
| set(name, value) { | ||
| this[name] = value; | ||
| } | ||
| // Overload getBindingHandler to have a custom lookup function. | ||
| getBindingHandler(key) { | ||
| return null; | ||
| } | ||
| cleanExternalData(node, callback) { | ||
| } | ||
| }; | ||
| var options = new Options(); | ||
| var options_default = options; | ||
| // ../utils/dist/error.js | ||
| function catchFunctionErrors(delegate) { | ||
| if (!options_default.onError) { | ||
| return delegate; | ||
| } | ||
| return (...args) => { | ||
| try { | ||
| return delegate(...args); | ||
| } catch (err) { | ||
| options_default.onError(err); | ||
| } | ||
| }; | ||
| } | ||
| function deferError(error) { | ||
| safeSetTimeout(function() { | ||
| throw error; | ||
| }, 0); | ||
| } | ||
| function safeSetTimeout(handler, timeout) { | ||
| return setTimeout(catchFunctionErrors(handler), timeout); | ||
| } | ||
| // ../utils/dist/async.js | ||
| function throttle(callback, timeout) { | ||
| let timeoutInstance; | ||
| return function(...args) { | ||
| if (!timeoutInstance) { | ||
| timeoutInstance = safeSetTimeout(function() { | ||
| timeoutInstance = void 0; | ||
| callback(...args); | ||
| }, timeout); | ||
| } | ||
| }; | ||
| } | ||
| function debounce(callback, timeout) { | ||
| let timeoutInstance; | ||
| return function(...args) { | ||
| clearTimeout(timeoutInstance); | ||
| timeoutInstance = safeSetTimeout(() => callback(...args), timeout); | ||
| }; | ||
| } | ||
| // ../utils/dist/object.js | ||
| function hasOwnProperty(obj, propName) { | ||
| return Object.prototype.hasOwnProperty.call(obj, propName); | ||
| } | ||
| function extend(target, source) { | ||
| if (source) { | ||
| for (const prop of Object.keys(source)) { | ||
| if (hasOwnProperty(source, prop)) { | ||
| ; | ||
| target[prop] = source[prop]; | ||
| } | ||
| } | ||
| } | ||
| return target; | ||
| } | ||
| function objectForEach(obj, action) { | ||
| for (const prop in obj) { | ||
| if (hasOwnProperty(obj, prop)) { | ||
| action(prop, obj[prop]); | ||
| } | ||
| } | ||
| } | ||
| function objectMap(source, mapping, thisArg) { | ||
| if (!source) { | ||
| return source; | ||
| } | ||
| if (arguments.length > 2) { | ||
| mapping = mapping.bind(thisArg); | ||
| } | ||
| const target = {}; | ||
| for (const prop in source) { | ||
| if (hasOwnProperty(source, prop)) { | ||
| target[prop] = mapping(source[prop], prop, source); | ||
| } | ||
| } | ||
| return target; | ||
| } | ||
| // ../utils/dist/function.js | ||
| function testOverwrite() { | ||
| try { | ||
| Object.defineProperty(function x() { | ||
| }, "length", {}); | ||
| return true; | ||
| } catch (e) { | ||
| return false; | ||
| } | ||
| } | ||
| var functionSupportsLengthOverwrite = testOverwrite(); | ||
| function overwriteLengthPropertyIfSupported(fn, descriptor) { | ||
| if (functionSupportsLengthOverwrite) { | ||
| Object.defineProperty(fn, "length", descriptor); | ||
| } | ||
| } | ||
| // ../utils/dist/dom/info.js | ||
| function tagNameLower(element) { | ||
| return element && element.tagName && element.tagName.toLowerCase(); | ||
| } | ||
| // ../utils/dist/dom/event.js | ||
| var knownEvents = {}; | ||
| var knownEventTypesByEventName = {}; | ||
| knownEvents["UIEvents"] = ["keyup", "keydown", "keypress"]; | ||
| knownEvents["MouseEvents"] = [ | ||
| "click", | ||
| "dblclick", | ||
| "mousedown", | ||
| "mouseup", | ||
| "mousemove", | ||
| "mouseover", | ||
| "mouseout", | ||
| "mouseenter", | ||
| "mouseleave" | ||
| ]; | ||
| objectForEach(knownEvents, function(eventType, knownEventsForType) { | ||
| if (knownEventsForType.length) { | ||
| for (let i = 0, j = knownEventsForType.length; i < j; i++) { | ||
| knownEventTypesByEventName[knownEventsForType[i]] = eventType; | ||
| } | ||
| } | ||
| }); | ||
| // ../utils/dist/dom/data.js | ||
| var datastoreTime = (/* @__PURE__ */ new Date()).getTime(); | ||
| var dataStoreKeyExpandoPropertyName = `__ko__${datastoreTime}`; | ||
| var dataStoreSymbol = /* @__PURE__ */ Symbol("Knockout data"); | ||
| var uniqueId = 0; | ||
| function isSafeKey(key) { | ||
| return key !== "__proto__" && key !== "constructor" && key !== "prototype"; | ||
| } | ||
| function getDataForNode(node, createIfNotFound) { | ||
| let dataForNode = node[dataStoreSymbol]; | ||
| if (!dataForNode && createIfNotFound) { | ||
| dataForNode = node[dataStoreSymbol] = {}; | ||
| } | ||
| return dataForNode; | ||
| } | ||
| function nextKey() { | ||
| return uniqueId++ + dataStoreKeyExpandoPropertyName; | ||
| } | ||
| function get(node, key) { | ||
| if (!isSafeKey(key)) throw new Error("Unsafe key for DOM data: " + key); | ||
| const dataForNode = getDataForNode(node, false); | ||
| return dataForNode && dataForNode[key]; | ||
| } | ||
| function set(node, key, value) { | ||
| if (!isSafeKey(key)) throw new Error("Unsafe key for DOM data: " + key); | ||
| const dataForNode = getDataForNode( | ||
| node, | ||
| value !== void 0 | ||
| /* createIfNotFound */ | ||
| ); | ||
| if (dataForNode) { | ||
| dataForNode[key] = value; | ||
| } | ||
| } | ||
| // ../utils/dist/dom/disposal.js | ||
| var domDataKey = nextKey(); | ||
| function getDisposeCallbacksCollection(node, createIfNotFound) { | ||
| let allDisposeCallbacks = get(node, domDataKey); | ||
| if (allDisposeCallbacks === void 0 && createIfNotFound) { | ||
| allDisposeCallbacks = new Array(); | ||
| set(node, domDataKey, allDisposeCallbacks); | ||
| } | ||
| return allDisposeCallbacks; | ||
| } | ||
| function destroyCallbacksCollection(node) { | ||
| set(node, domDataKey, void 0); | ||
| } | ||
| function addDisposeCallback(node, callback) { | ||
| if (typeof callback !== "function") { | ||
| throw new Error("Callback must be a function"); | ||
| } | ||
| getDisposeCallbacksCollection(node, true).push(callback); | ||
| } | ||
| function removeDisposeCallback(node, callback) { | ||
| const callbacksCollection = getDisposeCallbacksCollection(node, false); | ||
| if (callbacksCollection) { | ||
| arrayRemoveItem(callbacksCollection, callback); | ||
| if (callbacksCollection.length === 0) { | ||
| destroyCallbacksCollection(node); | ||
| } | ||
| } | ||
| } | ||
| var otherNodeCleanerFunctions = new Array(); | ||
| function cleanjQueryData(node) { | ||
| const jQueryCleanNodeFn = options_default.jQuery ? options_default.jQuery.cleanData : null; | ||
| if (jQueryCleanNodeFn) { | ||
| jQueryCleanNodeFn([node]); | ||
| } | ||
| } | ||
| otherNodeCleanerFunctions.push(cleanjQueryData); | ||
| // ../utils/dist/dom/html.js | ||
| var supportsTemplateTag = options_default.useTemplateTag && options_default.document && "content" in options_default.document.createElement("template"); | ||
| // ../utils/dist/dom/selectExtensions.js | ||
| var hasDomDataExpandoProperty = /* @__PURE__ */ Symbol("Knockout selectExtensions hasDomDataProperty"); | ||
| var selectExtensions = { | ||
| optionValueDomDataKey: nextKey(), | ||
| readValue: function(element) { | ||
| switch (tagNameLower(element)) { | ||
| case "option": { | ||
| if (element[hasDomDataExpandoProperty] === true) { | ||
| return get(element, selectExtensions.optionValueDomDataKey); | ||
| } | ||
| return element.value; | ||
| } | ||
| case "select": { | ||
| const selectElement = element; | ||
| return selectElement.selectedIndex >= 0 ? selectExtensions.readValue(selectElement.options[selectElement.selectedIndex]) : void 0; | ||
| } | ||
| default: | ||
| return element.value; | ||
| } | ||
| }, | ||
| writeValue: function(element, value, allowUnset) { | ||
| switch (tagNameLower(element)) { | ||
| case "option": | ||
| if (typeof value === "string") { | ||
| set(element, selectExtensions.optionValueDomDataKey, void 0); | ||
| if (hasDomDataExpandoProperty in element) { | ||
| delete element[hasDomDataExpandoProperty]; | ||
| } | ||
| ; | ||
| element.value = value; | ||
| } else { | ||
| const el = element; | ||
| set(element, selectExtensions.optionValueDomDataKey, value); | ||
| el[hasDomDataExpandoProperty] = true; | ||
| el.value = typeof value === "number" ? value : ""; | ||
| } | ||
| break; | ||
| case "select": | ||
| { | ||
| if (value === "" || value === null) { | ||
| value = void 0; | ||
| } | ||
| let selection = -1; | ||
| const selectElement = element; | ||
| for (let i = 0, n = selectElement.options.length, optionValue; i < n; ++i) { | ||
| optionValue = selectExtensions.readValue(selectElement.options[i]); | ||
| const strictEqual = optionValue === value; | ||
| const blankEqual = optionValue === "" && value === void 0; | ||
| const numericEqual = typeof value === "number" && Number(optionValue) === value; | ||
| if (strictEqual || blankEqual || numericEqual) { | ||
| selection = i; | ||
| break; | ||
| } | ||
| } | ||
| if (allowUnset || selection >= 0 || value === void 0 && selectElement.size > 1) { | ||
| selectElement.selectedIndex = selection; | ||
| } | ||
| } | ||
| break; | ||
| default: | ||
| if (value === null || value === void 0) { | ||
| value = ""; | ||
| } | ||
| ; | ||
| element.value = value; | ||
| break; | ||
| } | ||
| } | ||
| }; | ||
| // ../utils/dist/tasks.js | ||
| var tasks_exports = {}; | ||
| __export(tasks_exports, { | ||
| cancel: () => cancel, | ||
| resetForTesting: () => resetForTesting, | ||
| runEarly: () => processTasks, | ||
| schedule: () => schedule | ||
| }); | ||
| var taskQueue = new Array(); | ||
| var taskQueueLength = 0; | ||
| var nextHandle = 1; | ||
| var nextIndexToProcess = 0; | ||
| var w = options_default.global; | ||
| if (w && w.MutationObserver && !(w.navigator && w.navigator.standalone)) { | ||
| options_default.taskScheduler = (function(callback) { | ||
| const div = w.document.createElement("div"); | ||
| new w.MutationObserver(callback).observe(div, { attributes: true }); | ||
| return function() { | ||
| div.classList.toggle("foo"); | ||
| }; | ||
| })(scheduledProcess); | ||
| } else { | ||
| options_default.taskScheduler = function(callback) { | ||
| setTimeout(callback, 0); | ||
| }; | ||
| } | ||
| function processTasks() { | ||
| if (taskQueueLength) { | ||
| let mark = taskQueueLength, countMarks = 0; | ||
| for (let task; nextIndexToProcess < taskQueueLength; ) { | ||
| if (task = taskQueue[nextIndexToProcess++]) { | ||
| if (nextIndexToProcess > mark) { | ||
| if (++countMarks >= 5e3) { | ||
| nextIndexToProcess = taskQueueLength; | ||
| deferError(Error("'Too much recursion' after processing " + countMarks + " task groups.")); | ||
| break; | ||
| } | ||
| mark = taskQueueLength; | ||
| } | ||
| try { | ||
| task(); | ||
| } catch (ex) { | ||
| deferError(ex); | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
| function scheduledProcess() { | ||
| processTasks(); | ||
| nextIndexToProcess = taskQueueLength = taskQueue.length = 0; | ||
| } | ||
| function scheduleTaskProcessing() { | ||
| options_default.taskScheduler(scheduledProcess); | ||
| } | ||
| function schedule(func) { | ||
| if (!taskQueueLength) { | ||
| scheduleTaskProcessing(); | ||
| } | ||
| taskQueue[taskQueueLength++] = func; | ||
| return nextHandle++; | ||
| } | ||
| function cancel(handle) { | ||
| const index = handle - (nextHandle - taskQueueLength); | ||
| if (index >= nextIndexToProcess && index < taskQueueLength) { | ||
| taskQueue[index] = null; | ||
| } | ||
| } | ||
| function resetForTesting() { | ||
| const length = taskQueueLength - nextIndexToProcess; | ||
| nextIndexToProcess = taskQueueLength = taskQueue.length = 0; | ||
| return length; | ||
| } | ||
| // ../observable/dist/dependencyDetection.js | ||
| var dependencyDetection_exports = {}; | ||
| __export(dependencyDetection_exports, { | ||
| begin: () => begin, | ||
| end: () => end, | ||
| getDependencies: () => getDependencies, | ||
| getDependenciesCount: () => getDependenciesCount, | ||
| ignore: () => ignore, | ||
| ignoreDependencies: () => ignore, | ||
| isInitial: () => isInitial, | ||
| registerDependency: () => registerDependency | ||
| }); | ||
| // ../observable/dist/subscribableSymbol.js | ||
| var SUBSCRIBABLE_SYM = /* @__PURE__ */ Symbol("Knockout Subscribable"); | ||
| function isSubscribable(instance) { | ||
| return instance && instance[SUBSCRIBABLE_SYM] || false; | ||
| } | ||
| // ../observable/dist/dependencyDetection.js | ||
| var outerFrames = new Array(); | ||
| var currentFrame; | ||
| var lastId = 0; | ||
| function getId() { | ||
| return ++lastId; | ||
| } | ||
| function begin(options2) { | ||
| outerFrames.push(currentFrame); | ||
| currentFrame = options2; | ||
| } | ||
| function end() { | ||
| currentFrame = outerFrames.pop(); | ||
| } | ||
| function registerDependency(subscribable2) { | ||
| if (currentFrame) { | ||
| if (!isSubscribable(subscribable2)) { | ||
| throw new Error("Only subscribable things can act as dependencies"); | ||
| } | ||
| currentFrame.callback.call( | ||
| currentFrame.callbackTarget, | ||
| subscribable2, | ||
| subscribable2._id || (subscribable2._id = getId()) | ||
| ); | ||
| } | ||
| } | ||
| function ignore(callback, callbackTarget, callbackArgs) { | ||
| try { | ||
| begin(); | ||
| return callback.apply(callbackTarget, callbackArgs || []); | ||
| } finally { | ||
| end(); | ||
| } | ||
| } | ||
| function getDependenciesCount() { | ||
| if (currentFrame) { | ||
| return currentFrame.computed.getDependenciesCount(); | ||
| } | ||
| return void 0; | ||
| } | ||
| function getDependencies() { | ||
| if (currentFrame) { | ||
| return currentFrame.computed.getDependencies(); | ||
| } | ||
| return void 0; | ||
| } | ||
| function isInitial() { | ||
| if (currentFrame) { | ||
| return currentFrame.isInitial; | ||
| } | ||
| return void 0; | ||
| } | ||
| // ../observable/dist/defer.js | ||
| function deferUpdates(target) { | ||
| if (target._deferUpdates) { | ||
| return; | ||
| } | ||
| target._deferUpdates = true; | ||
| target.limit(function(callback) { | ||
| let handle; | ||
| let ignoreUpdates = false; | ||
| return function() { | ||
| if (!ignoreUpdates) { | ||
| tasks_exports.cancel(handle); | ||
| handle = tasks_exports.schedule(callback); | ||
| try { | ||
| ignoreUpdates = true; | ||
| target.notifySubscribers(void 0, "dirty"); | ||
| } finally { | ||
| ignoreUpdates = false; | ||
| } | ||
| } | ||
| }; | ||
| }); | ||
| } | ||
| // ../observable/dist/Subscription.js | ||
| var Subscription = class { | ||
| constructor(target, observer, disposeCallback) { | ||
| this._target = target; | ||
| this._callback = observer.next; | ||
| this._disposeCallback = disposeCallback; | ||
| this._isDisposed = false; | ||
| this._domNodeDisposalCallback = null; | ||
| } | ||
| dispose() { | ||
| if (this._domNodeDisposalCallback) { | ||
| removeDisposeCallback(this._node, this._domNodeDisposalCallback); | ||
| } | ||
| this._isDisposed = true; | ||
| this._disposeCallback(); | ||
| } | ||
| disposeWhenNodeIsRemoved(node) { | ||
| this._node = node; | ||
| addDisposeCallback(node, this._domNodeDisposalCallback = this.dispose.bind(this)); | ||
| } | ||
| // TC39 Observable API | ||
| unsubscribe() { | ||
| this.dispose(); | ||
| } | ||
| get closed() { | ||
| return this._isDisposed; | ||
| } | ||
| }; | ||
| // ../observable/dist/extenders.js | ||
| var primitiveTypes = { undefined: 1, boolean: 1, number: 1, string: 1 }; | ||
| function valuesArePrimitiveAndEqual(a, b) { | ||
| const oldValueIsPrimitive = a === null || typeof a in primitiveTypes; | ||
| return oldValueIsPrimitive ? a === b : false; | ||
| } | ||
| function applyExtenders(requestedExtenders) { | ||
| let target = this; | ||
| if (requestedExtenders) { | ||
| objectForEach(requestedExtenders, function(key, value) { | ||
| const extenderHandler = extenders[key]; | ||
| if (typeof extenderHandler === "function") { | ||
| target = extenderHandler(target, value) || target; | ||
| } else { | ||
| options_default.onError(new Error("Extender not found: " + key)); | ||
| } | ||
| }); | ||
| } | ||
| return target; | ||
| } | ||
| function notify(target, notifyWhen) { | ||
| target.equalityComparer = notifyWhen == "always" ? null : valuesArePrimitiveAndEqual; | ||
| } | ||
| function deferred(target, option) { | ||
| if (option !== true) { | ||
| throw new Error( | ||
| "The 'deferred' extender only accepts the value 'true', because it is not supported to turn deferral off once enabled." | ||
| ); | ||
| } | ||
| deferUpdates(target); | ||
| } | ||
| function rateLimit(target, options2) { | ||
| let timeout, method, limitFunction; | ||
| if (typeof options2 === "number") { | ||
| timeout = options2; | ||
| } else { | ||
| timeout = options2.timeout; | ||
| method = options2.method; | ||
| } | ||
| target._deferUpdates = false; | ||
| limitFunction = method === "notifyWhenChangesStop" ? debounce : throttle; | ||
| target.limit(function(callback) { | ||
| return limitFunction(callback, timeout); | ||
| }); | ||
| } | ||
| var extenders = { notify, deferred, rateLimit }; | ||
| // ../observable/dist/subscribable.js | ||
| var LATEST_VALUE = /* @__PURE__ */ Symbol("Knockout latest value"); | ||
| if (!Symbol.observable) { | ||
| Symbol.observable = /* @__PURE__ */ Symbol.for("@tko/Symbol.observable"); | ||
| } | ||
| var subscribable = function subscribableFactory() { | ||
| Object.setPrototypeOf(this, ko_subscribable_fn); | ||
| ko_subscribable_fn.init(this); | ||
| }; | ||
| var defaultEvent = "change"; | ||
| var ko_subscribable_fn = { | ||
| [SUBSCRIBABLE_SYM]: true, | ||
| [Symbol.observable]() { | ||
| return this; | ||
| }, | ||
| init(instance) { | ||
| instance._subscriptions = { change: [] }; | ||
| instance._versionNumber = 1; | ||
| }, | ||
| subscribe(callback, callbackTarget, event) { | ||
| const isTC39Callback = typeof callback === "object" && callback.next; | ||
| event = event || defaultEvent; | ||
| const observer = isTC39Callback ? callback : { next: callbackTarget ? callback.bind(callbackTarget) : callback }; | ||
| const subscriptionInstance = new Subscription(this, observer, () => { | ||
| arrayRemoveItem(this._subscriptions[event], subscriptionInstance); | ||
| if (this.afterSubscriptionRemove) { | ||
| this.afterSubscriptionRemove(event); | ||
| } | ||
| }); | ||
| if (this.beforeSubscriptionAdd) { | ||
| this.beforeSubscriptionAdd(event); | ||
| } | ||
| if (!this._subscriptions[event]) { | ||
| this._subscriptions[event] = new Array(); | ||
| } | ||
| this._subscriptions[event].push(subscriptionInstance); | ||
| if (isTC39Callback && LATEST_VALUE in this) { | ||
| observer.next(this[LATEST_VALUE]); | ||
| } | ||
| return subscriptionInstance; | ||
| }, | ||
| notifySubscribers(valueToNotify, event) { | ||
| event = event || defaultEvent; | ||
| if (event === defaultEvent) { | ||
| this.updateVersion(); | ||
| } | ||
| if (this.hasSubscriptionsForEvent(event)) { | ||
| const subs = event === defaultEvent && this._changeSubscriptions || [...this._subscriptions[event]]; | ||
| try { | ||
| begin(); | ||
| for (let i = 0, subscriptionInstance; subscriptionInstance = subs[i]; ++i) { | ||
| if (!subscriptionInstance._isDisposed) { | ||
| subscriptionInstance._callback(valueToNotify); | ||
| } | ||
| } | ||
| } finally { | ||
| end(); | ||
| } | ||
| } | ||
| }, | ||
| getVersion() { | ||
| return this._versionNumber; | ||
| }, | ||
| hasChanged(versionToCheck) { | ||
| return this.getVersion() !== versionToCheck; | ||
| }, | ||
| updateVersion() { | ||
| ++this._versionNumber; | ||
| }, | ||
| hasSubscriptionsForEvent(event) { | ||
| return this._subscriptions[event] && this._subscriptions[event].length; | ||
| }, | ||
| getSubscriptionsCount(event) { | ||
| if (event) { | ||
| return this._subscriptions[event] && this._subscriptions[event].length || 0; | ||
| } else { | ||
| let total = 0; | ||
| objectForEach(this._subscriptions, function(eventName, subscriptions) { | ||
| if (eventName !== "dirty") { | ||
| total += subscriptions.length; | ||
| } | ||
| }); | ||
| return total; | ||
| } | ||
| }, | ||
| isDifferent(oldValue, newValue) { | ||
| return !this.equalityComparer || !this.equalityComparer(oldValue, newValue); | ||
| }, | ||
| once(cb) { | ||
| const subs = this.subscribe((nv) => { | ||
| subs.dispose(); | ||
| cb(nv); | ||
| }); | ||
| }, | ||
| when(test, returnValue) { | ||
| const current = this.peek(); | ||
| const givenRv = arguments.length > 1; | ||
| const testFn = typeof test === "function" ? test : (v) => v === test; | ||
| if (testFn(current)) { | ||
| return options_default.Promise.resolve(givenRv ? returnValue : current); | ||
| } | ||
| return new options_default.Promise((resolve, reject) => { | ||
| const subs = this.subscribe((newValue) => { | ||
| if (testFn(newValue)) { | ||
| subs.dispose(); | ||
| resolve(givenRv ? returnValue : newValue); | ||
| } | ||
| }); | ||
| }); | ||
| }, | ||
| yet(test, ...args) { | ||
| const testFn = typeof test === "function" ? test : (v) => v === test; | ||
| const negated = (v) => !testFn(v); | ||
| return this.when(negated, ...args); | ||
| }, | ||
| next() { | ||
| return new Promise((resolve) => this.once(resolve)); | ||
| }, | ||
| toString() { | ||
| return "[object Object]"; | ||
| }, | ||
| extend: applyExtenders | ||
| }; | ||
| Object.setPrototypeOf(ko_subscribable_fn, Function.prototype); | ||
| subscribable.fn = ko_subscribable_fn; | ||
| // ../observable/dist/observable.js | ||
| function observable(initialValue) { | ||
| function Observable() { | ||
| if (arguments.length > 0) { | ||
| if (Observable.isDifferent(Observable[LATEST_VALUE], arguments[0])) { | ||
| ; | ||
| Observable.valueWillMutate(); | ||
| Observable[LATEST_VALUE] = arguments[0]; | ||
| Observable.valueHasMutated(); | ||
| } | ||
| return this; | ||
| } else { | ||
| registerDependency(Observable); | ||
| return Observable[LATEST_VALUE]; | ||
| } | ||
| } | ||
| overwriteLengthPropertyIfSupported(Observable, { value: void 0 }); | ||
| Observable[LATEST_VALUE] = initialValue; | ||
| subscribable.fn.init(Observable); | ||
| Object.setPrototypeOf(Observable, observable.fn); | ||
| if (options_default.deferUpdates) { | ||
| deferUpdates(Observable); | ||
| } | ||
| return Observable; | ||
| } | ||
| observable.fn = { | ||
| /** | ||
| * Compares two values for equality. | ||
| * @param a The first value. | ||
| * @param b The second value. | ||
| * @returns True if the values are equal, otherwise false. | ||
| */ | ||
| equalityComparer: valuesArePrimitiveAndEqual, | ||
| /** | ||
| * Returns the current value of the observable without creating a dependency. | ||
| * @returns The current value. | ||
| */ | ||
| peek() { | ||
| return this[LATEST_VALUE]; | ||
| }, | ||
| /** | ||
| * Notifies subscribers that the value has changed. | ||
| */ | ||
| valueHasMutated() { | ||
| this.notifySubscribers(this[LATEST_VALUE], "spectate"); | ||
| this.notifySubscribers(this[LATEST_VALUE]); | ||
| }, | ||
| /** | ||
| * Notifies subscribers that the value is about to change. | ||
| */ | ||
| valueWillMutate() { | ||
| this.notifySubscribers(this[LATEST_VALUE], "beforeChange"); | ||
| }, | ||
| /** | ||
| * Modifies the value of the observable using a function. | ||
| * @param fn The function to modify the value. | ||
| * @param peek Whether to use the current value without creating a dependency. | ||
| * @returns The modified observable. | ||
| */ | ||
| modify(fn, peek2 = true) { | ||
| this(fn(peek2 ? this.peek() : this())); | ||
| }, | ||
| // Some observables may not always be writeable, notably computeds. | ||
| isWriteable: true | ||
| }; | ||
| function limitNotifySubscribers(value, event) { | ||
| if (!event || event === defaultEvent) { | ||
| this._limitChange(value); | ||
| } else if (event === "beforeChange") { | ||
| this._limitBeforeChange(value); | ||
| } else { | ||
| this._origNotifySubscribers(value, event); | ||
| } | ||
| } | ||
| subscribable.fn.limit = function limit(limitFunction) { | ||
| const self = this; | ||
| const selfIsObservable = isObservable(self); | ||
| const beforeChange = "beforeChange"; | ||
| let ignoreBeforeChange, notifyNextChange, previousValue, pendingValue, didUpdate; | ||
| if (!self._origNotifySubscribers) { | ||
| self._origNotifySubscribers = self.notifySubscribers; | ||
| self.notifySubscribers = limitNotifySubscribers; | ||
| } | ||
| const finish = limitFunction(function() { | ||
| self._notificationIsPending = false; | ||
| if (selfIsObservable && pendingValue === self) { | ||
| pendingValue = self._evalIfChanged ? self._evalIfChanged() : self(); | ||
| } | ||
| const shouldNotify = notifyNextChange || didUpdate && self.isDifferent(previousValue, pendingValue); | ||
| self._notifyNextChange = didUpdate = ignoreBeforeChange = false; | ||
| if (shouldNotify) { | ||
| self._origNotifySubscribers(previousValue = pendingValue); | ||
| } | ||
| }); | ||
| Object.assign(self, { | ||
| _limitChange(value, isDirty) { | ||
| if (!isDirty || !self._notificationIsPending) { | ||
| didUpdate = !isDirty; | ||
| } | ||
| self._changeSubscriptions = [...self._subscriptions[defaultEvent]]; | ||
| self._notificationIsPending = ignoreBeforeChange = true; | ||
| pendingValue = value; | ||
| finish(); | ||
| }, | ||
| _limitBeforeChange(value) { | ||
| if (!ignoreBeforeChange) { | ||
| previousValue = value; | ||
| self._origNotifySubscribers(value, beforeChange); | ||
| } | ||
| }, | ||
| _notifyNextChangeIfValueIsDifferent() { | ||
| if (self.isDifferent(previousValue, self.peek( | ||
| true | ||
| /* evaluate */ | ||
| ))) { | ||
| notifyNextChange = true; | ||
| } | ||
| }, | ||
| _recordUpdate() { | ||
| didUpdate = true; | ||
| } | ||
| }); | ||
| }; | ||
| Object.setPrototypeOf(observable.fn, subscribable.fn); | ||
| var protoProperty = observable.protoProperty = options_default.protoProperty; | ||
| observable.fn[protoProperty] = observable; | ||
| observable.observablePrototypes = /* @__PURE__ */ new Set([observable]); | ||
| function isObservable(instance) { | ||
| const proto = typeof instance === "function" && instance[protoProperty]; | ||
| if (proto && !observable.observablePrototypes.has(proto)) { | ||
| throw Error("Invalid object that looks like an observable; possibly from another Knockout instance"); | ||
| } | ||
| return !!proto; | ||
| } | ||
| // ../observable/dist/observableArray.changeTracking.js | ||
| var arrayChangeEventName = "arrayChange"; | ||
| function trackArrayChanges(target, options2) { | ||
| target.compareArrayOptions = {}; | ||
| if (options2 && typeof options2 === "object") { | ||
| extend(target.compareArrayOptions, options2); | ||
| } | ||
| target.compareArrayOptions.sparse = true; | ||
| if (target.cacheDiffForKnownOperation) { | ||
| return; | ||
| } | ||
| let trackingChanges = false; | ||
| let cachedDiff = null; | ||
| let arrayChangeSubscription; | ||
| let pendingNotifications = 0; | ||
| let underlyingNotifySubscribersFunction; | ||
| const underlyingBeforeSubscriptionAddFunction = target.beforeSubscriptionAdd; | ||
| const underlyingAfterSubscriptionRemoveFunction = target.afterSubscriptionRemove; | ||
| target.beforeSubscriptionAdd = function(event) { | ||
| if (underlyingBeforeSubscriptionAddFunction) { | ||
| underlyingBeforeSubscriptionAddFunction.call(target, event); | ||
| } | ||
| if (event === arrayChangeEventName) { | ||
| trackChanges(); | ||
| } | ||
| }; | ||
| target.afterSubscriptionRemove = function(event) { | ||
| if (underlyingAfterSubscriptionRemoveFunction) { | ||
| underlyingAfterSubscriptionRemoveFunction.call(target, event); | ||
| } | ||
| if (event === arrayChangeEventName && !target.hasSubscriptionsForEvent(arrayChangeEventName)) { | ||
| if (underlyingNotifySubscribersFunction) { | ||
| target.notifySubscribers = underlyingNotifySubscribersFunction; | ||
| underlyingNotifySubscribersFunction = void 0; | ||
| } | ||
| if (arrayChangeSubscription) { | ||
| arrayChangeSubscription.dispose(); | ||
| } | ||
| arrayChangeSubscription = null; | ||
| trackingChanges = false; | ||
| } | ||
| }; | ||
| function trackChanges() { | ||
| if (trackingChanges) { | ||
| return; | ||
| } | ||
| trackingChanges = true; | ||
| underlyingNotifySubscribersFunction = target["notifySubscribers"]; | ||
| target.notifySubscribers = function(valueToNotify, event) { | ||
| if (!event || event === defaultEvent) { | ||
| ++pendingNotifications; | ||
| } | ||
| return underlyingNotifySubscribersFunction.apply(this, arguments); | ||
| }; | ||
| let previousContents = new Array().concat(target.peek() === void 0 ? [] : target.peek()); | ||
| cachedDiff = null; | ||
| arrayChangeSubscription = target.subscribe(function(currentContents) { | ||
| let changes; | ||
| currentContents = new Array().concat(currentContents || []); | ||
| if (target.hasSubscriptionsForEvent(arrayChangeEventName)) { | ||
| changes = getChanges(previousContents, currentContents); | ||
| } | ||
| previousContents = currentContents; | ||
| cachedDiff = null; | ||
| pendingNotifications = 0; | ||
| if (changes && changes.length) { | ||
| target.notifySubscribers(changes, arrayChangeEventName); | ||
| } | ||
| }); | ||
| } | ||
| function getChanges(previousContents, currentContents) { | ||
| if (!cachedDiff || pendingNotifications > 1) { | ||
| cachedDiff = trackArrayChanges.compareArrays(previousContents, currentContents, target.compareArrayOptions); | ||
| } | ||
| return cachedDiff; | ||
| } | ||
| target.cacheDiffForKnownOperation = function(rawArray, operationName, args) { | ||
| if (!trackingChanges || pendingNotifications) { | ||
| return; | ||
| } | ||
| let diff = new Array(), arrayLength = rawArray.length, argsLength = args.length, offset = 0; | ||
| function pushDiff(status, value, index) { | ||
| return diff[diff.length] = { status, value, index }; | ||
| } | ||
| switch (operationName) { | ||
| case "push": | ||
| offset = arrayLength; | ||
| case "unshift": | ||
| for (let index = 0; index < argsLength; index++) { | ||
| pushDiff("added", args[index], offset + index); | ||
| } | ||
| break; | ||
| case "pop": | ||
| offset = arrayLength - 1; | ||
| case "shift": | ||
| if (arrayLength) { | ||
| pushDiff("deleted", rawArray[offset], offset); | ||
| } | ||
| break; | ||
| case "splice": | ||
| { | ||
| const startIndex = Math.min(Math.max(0, args[0] < 0 ? arrayLength + args[0] : args[0]), arrayLength), endDeleteIndex = argsLength === 1 ? arrayLength : Math.min(startIndex + (args[1] || 0), arrayLength), endAddIndex = startIndex + argsLength - 2, endIndex = Math.max(endDeleteIndex, endAddIndex), additions = new Array(), deletions = new Array(); | ||
| for (let index = startIndex, argsIndex = 2; index < endIndex; ++index, ++argsIndex) { | ||
| if (index < endDeleteIndex) { | ||
| deletions.push(pushDiff("deleted", rawArray[index], index)); | ||
| } | ||
| if (index < endAddIndex) { | ||
| additions.push(pushDiff("added", args[argsIndex], index)); | ||
| } | ||
| } | ||
| findMovesInArrayComparison(deletions, additions); | ||
| } | ||
| break; | ||
| default: | ||
| return; | ||
| } | ||
| cachedDiff = diff; | ||
| }; | ||
| } | ||
| trackArrayChanges.compareArrays = compareArrays; | ||
| extenders.trackArrayChanges = trackArrayChanges; | ||
| // ../observable/dist/observableArray.js | ||
| function observableArray(initialValues) { | ||
| initialValues = initialValues || []; | ||
| if (typeof initialValues !== "object" || !("length" in initialValues)) { | ||
| throw new Error( | ||
| "The argument passed when initializing an observable array must be an array, or null, or undefined." | ||
| ); | ||
| } | ||
| const result = Object.setPrototypeOf(observable(initialValues), observableArray.fn); | ||
| trackArrayChanges(result); | ||
| overwriteLengthPropertyIfSupported(result, { get: () => { | ||
| var _a; | ||
| return (_a = result()) == null ? void 0 : _a.length; | ||
| } }); | ||
| return result; | ||
| } | ||
| observableArray.fn = { | ||
| remove(valueOrPredicate) { | ||
| const underlyingArray = this.peek(); | ||
| const removedValues = new Array(); | ||
| const predicate = typeof valueOrPredicate === "function" && !isObservable(valueOrPredicate) ? valueOrPredicate : function(value) { | ||
| return value === valueOrPredicate; | ||
| }; | ||
| for (let i = 0; i < underlyingArray.length; i++) { | ||
| const value = underlyingArray[i]; | ||
| if (predicate(value)) { | ||
| if (removedValues.length === 0) { | ||
| this.valueWillMutate(); | ||
| } | ||
| if (underlyingArray[i] !== value) { | ||
| throw Error("Array modified during remove; cannot remove item"); | ||
| } | ||
| removedValues.push(value); | ||
| underlyingArray.splice(i, 1); | ||
| i--; | ||
| } | ||
| } | ||
| if (removedValues.length) { | ||
| this.valueHasMutated(); | ||
| } | ||
| return removedValues; | ||
| }, | ||
| removeAll(arrayOfValues) { | ||
| if (arrayOfValues === void 0) { | ||
| const underlyingArray = this.peek(); | ||
| const allValues = underlyingArray.slice(0); | ||
| this.valueWillMutate(); | ||
| underlyingArray.splice(0, underlyingArray.length); | ||
| this.valueHasMutated(); | ||
| return allValues; | ||
| } | ||
| if (!arrayOfValues) { | ||
| return []; | ||
| } | ||
| return this["remove"](function(value) { | ||
| return arrayIndexOf(arrayOfValues, value) >= 0; | ||
| }); | ||
| }, | ||
| destroy(valueOrPredicate) { | ||
| const underlyingArray = this.peek(); | ||
| const predicate = typeof valueOrPredicate === "function" && !isObservable(valueOrPredicate) ? valueOrPredicate : function(value) { | ||
| return value === valueOrPredicate; | ||
| }; | ||
| this.valueWillMutate(); | ||
| for (let i = underlyingArray.length - 1; i >= 0; i--) { | ||
| const value = underlyingArray[i]; | ||
| if (predicate(value)) { | ||
| value["_destroy"] = true; | ||
| } | ||
| } | ||
| this.valueHasMutated(); | ||
| }, | ||
| destroyAll(arrayOfValues) { | ||
| if (arrayOfValues === void 0) { | ||
| return this.destroy(function() { | ||
| return true; | ||
| }); | ||
| } | ||
| if (!arrayOfValues) { | ||
| return []; | ||
| } | ||
| return this.destroy(function(value) { | ||
| return arrayIndexOf(arrayOfValues, value) >= 0; | ||
| }); | ||
| }, | ||
| indexOf(item) { | ||
| return arrayIndexOf(this(), item); | ||
| }, | ||
| replace(oldItem, newItem) { | ||
| const index = this.indexOf(oldItem); | ||
| if (index >= 0) { | ||
| this.valueWillMutate(); | ||
| this.peek()[index] = newItem; | ||
| this.valueHasMutated(); | ||
| } | ||
| }, | ||
| sorted(compareFn) { | ||
| return [...this()].sort(compareFn); | ||
| }, | ||
| reversed() { | ||
| return [...this()].reverse(); | ||
| }, | ||
| [Symbol.iterator]: function* () { | ||
| yield* __yieldStar(this()); | ||
| } | ||
| }; | ||
| Object.setPrototypeOf(observableArray.fn, observable.fn); | ||
| arrayForEach(["pop", "push", "reverse", "shift", "sort", "splice", "unshift"], function(methodName) { | ||
| observableArray.fn[methodName] = function() { | ||
| const underlyingArray = this.peek(); | ||
| this.valueWillMutate(); | ||
| this.cacheDiffForKnownOperation(underlyingArray, methodName, arguments); | ||
| const methodCallResult = underlyingArray[methodName].apply(underlyingArray, arguments); | ||
| this.valueHasMutated(); | ||
| return methodCallResult === underlyingArray ? this : methodCallResult; | ||
| }; | ||
| }); | ||
| arrayForEach(["slice"], function(methodName) { | ||
| observableArray.fn[methodName] = function() { | ||
| const underlyingArray = this(); | ||
| return underlyingArray[methodName].apply(underlyingArray, arguments); | ||
| }; | ||
| }); | ||
| observableArray.trackArrayChanges = trackArrayChanges; | ||
| // ../provider/dist/BindingHandlerObject.js | ||
| var BindingHandlerObject = class { | ||
| set(nameOrObject, value) { | ||
| if (typeof nameOrObject === "string") { | ||
| this[nameOrObject] = value; | ||
| } else if (typeof nameOrObject === "object") { | ||
| if (value !== void 0) { | ||
| options_default.onError( | ||
| new Error( | ||
| "Given extraneous `value` parameter (first param should be a string, but it was an object)." + nameOrObject | ||
| ) | ||
| ); | ||
| } | ||
| Object.assign(this, nameOrObject); | ||
| } else { | ||
| options_default.onError(new Error("Given a bad binding handler type: " + nameOrObject)); | ||
| } | ||
| } | ||
| /** | ||
| * The handler may have a `.` in it, e.g. `attr.title`, in which case the | ||
| * handler is `attr`. Otherwise it's the name given | ||
| */ | ||
| get(nameOrDotted) { | ||
| const [name] = nameOrDotted.split("."); | ||
| return this[name]; | ||
| } | ||
| }; | ||
| // ../provider/dist/Provider.js | ||
| var Provider = class _Provider { | ||
| constructor(params) { | ||
| if (this.constructor === _Provider) { | ||
| throw new Error("Provider is an abstract base class."); | ||
| } | ||
| if (!("FOR_NODE_TYPES" in this)) { | ||
| throw new Error("Providers must have FOR_NODE_TYPES property"); | ||
| } | ||
| this.bindingHandlers = (params == null ? void 0 : params.bindingHandlers) || new BindingHandlerObject(); | ||
| this.globals = (params == null ? void 0 : params.globals) || {}; | ||
| } | ||
| get FOR_NODE_TYPES() { | ||
| throw new Error("Providers must override FOR_NODE_TYPES property"); | ||
| } | ||
| setGlobals(globals) { | ||
| this.globals = globals; | ||
| } | ||
| get preemptive() { | ||
| return false; | ||
| } | ||
| nodeHasBindings(node, context) { | ||
| return false; | ||
| } | ||
| getBindingAccessors(node, context) { | ||
| return /* @__PURE__ */ Object.create(null); | ||
| } | ||
| /** | ||
| * Preprocess a given node. | ||
| * @param {Node} node | ||
| * @returns {[Node]|null} | ||
| */ | ||
| preprocessNode(node) { | ||
| return [node]; | ||
| } | ||
| postProcess() { | ||
| } | ||
| /** For legacy binding provider assignments to | ||
| * ko.bindingProvider.instance = ... */ | ||
| get instance() { | ||
| return this._overloadInstance || this; | ||
| } | ||
| set instance(provider) { | ||
| if (!provider || provider === this) { | ||
| this._overloadInstance = void 0; | ||
| } else { | ||
| this._overloadInstance = new LegacyProvider(provider, this); | ||
| } | ||
| } | ||
| // Given a function that returns bindings, create and return a new object that contains | ||
| // binding value-accessors functions. Each accessor function calls the original function | ||
| // so that it always gets the latest value and all dependencies are captured. This is used | ||
| // by ko.applyBindingsToNode and getBindingsAndMakeAccessors. | ||
| makeAccessorsFromFunction(callback) { | ||
| return objectMap(dependencyDetection_exports.ignore(callback), (value, key) => () => callback()[key]); | ||
| } | ||
| // Returns the valueAccessor function for a binding value | ||
| makeValueAccessor(value) { | ||
| return () => value; | ||
| } | ||
| // Given a bindings function or object, create and return a new object that contains | ||
| // binding value-accessors functions. This is used by ko.applyBindingsToNode. | ||
| makeBindingAccessors(bindings, context, node) { | ||
| if (typeof bindings === "function") { | ||
| return this.makeAccessorsFromFunction(bindings.bind(null, context, node)); | ||
| } else { | ||
| return objectMap(bindings, this.makeValueAccessor); | ||
| } | ||
| } | ||
| }; | ||
| var LegacyProvider = class extends Provider { | ||
| get FOR_NODE_TYPES() { | ||
| return [Node.ELEMENT_NODE, Node.TEXT_NODE, Node.COMMENT_NODE]; | ||
| } | ||
| constructor(providerObject, parentProvider) { | ||
| super(); | ||
| Object.assign(this, { providerObject }); | ||
| this.bindingHandlers = providerObject.bindingHandlers || parentProvider.bindingHandlers; | ||
| } | ||
| // This function is used if the binding provider doesn't include a getBindingAccessors function. | ||
| // It must be called with 'this' set to the provider instance. | ||
| getBindingsAndMakeAccessors(node, context) { | ||
| const bindingsFn = this.providerObject.getBindings.bind(this.providerObject, node, context); | ||
| return this.makeAccessorsFromFunction(bindingsFn); | ||
| } | ||
| getBindingAccessors(node, context) { | ||
| return this.providerObject.getBindingAccessors ? this.providerObject.getBindingAccessors(node, context) : this.getBindingsAndMakeAccessors(node, context); | ||
| } | ||
| nodeHasBindings(node) { | ||
| return this.providerObject.nodeHasBindings(node); | ||
| } | ||
| preprocessNode(node) { | ||
| if (this.providerObject.preprocessNode) { | ||
| return this.providerObject.preprocessNode(node); | ||
| } | ||
| return null; | ||
| } | ||
| }; | ||
| // src/MultiProvider.ts | ||
| var MultiProvider = class extends Provider { | ||
| get FOR_NODE_TYPES() { | ||
| return this.nodeTypes; | ||
| } | ||
| var import_provider = require("@tko/provider"); | ||
| var MultiProvider = class extends import_provider.Provider { | ||
| constructor(params) { | ||
| super(params); | ||
| __publicField(this, "nodeTypes"); | ||
| __publicField(this, "nodeTypeMap"); | ||
| __publicField(this, "providers"); | ||
| const providers = (params == null ? void 0 : params.providers) || []; | ||
@@ -1411,2 +83,5 @@ this.nodeTypeMap = {}; | ||
| } | ||
| get FOR_NODE_TYPES() { | ||
| return this.nodeTypes; | ||
| } | ||
| setGlobals(globals) { | ||
@@ -1413,0 +88,0 @@ ; |
+2
-2
@@ -1,3 +0,3 @@ | ||
| // @tko/provider.multi 🥊 4.0.0 ESM | ||
| // @tko/provider.multi 🥊 4.0.1 ESM | ||
| "use strict"; | ||
| export { default as MultiProvider } from "./MultiProvider"; | ||
| export { default as MultiProvider } from "./MultiProvider.js"; |
+2
-2
@@ -1,3 +0,3 @@ | ||
| // @tko/provider.multi 🥊 4.0.0 MJS | ||
| // @tko/provider.multi 🥊 4.0.1 MJS | ||
| "use strict"; | ||
| export { default as MultiProvider } from "./MultiProvider"; | ||
| export { default as MultiProvider } from "./MultiProvider.js"; |
@@ -1,5 +0,8 @@ | ||
| // @tko/provider.multi 🥊 4.0.0 ESM | ||
| // @tko/provider.multi 🥊 4.0.1 ESM | ||
| "use strict"; | ||
| import { Provider } from "@tko/provider"; | ||
| export default class MultiProvider extends Provider { | ||
| nodeTypes; | ||
| nodeTypeMap; | ||
| providers; | ||
| get FOR_NODE_TYPES() { | ||
@@ -6,0 +9,0 @@ return this.nodeTypes; |
@@ -5,4 +5,4 @@ { | ||
| "sourcesContent": ["import { Provider } from '@tko/provider'\n\nimport type { ProviderParamsInput } from '@tko/provider'\n\nimport type { BindingContext } from '@tko/bind'\n\nexport default class MultiProvider extends Provider {\n nodeTypes: number[]\n nodeTypeMap: Record<string, any[]>\n providers: any[]\n\n override get FOR_NODE_TYPES() {\n return this.nodeTypes\n }\n\n constructor(params?: ProviderParamsInput | null) {\n super(params)\n const providers = params?.providers || []\n this.nodeTypeMap = {}\n this.nodeTypes = []\n this.providers = []\n providers.forEach(p => this.addProvider(p))\n }\n\n override setGlobals(globals) {\n ;[this, ...this.providers].forEach(p => (p.globals = globals))\n }\n\n addProvider(provider: Provider) {\n this.providers.push(provider)\n provider.bindingHandlers = this.bindingHandlers\n provider.globals = this.globals\n const nodeTypeMap = this.nodeTypeMap\n for (const nodeType of provider.FOR_NODE_TYPES) {\n if (!nodeTypeMap[nodeType]) {\n nodeTypeMap[nodeType] = new Array()\n }\n nodeTypeMap[nodeType].push(provider)\n }\n this.nodeTypes = Object.keys(this.nodeTypeMap).map(k => parseInt(k, 10))\n }\n\n providersFor(node: Node): any[] {\n return this.nodeTypeMap[node.nodeType] || []\n }\n\n override nodeHasBindings(node: Node, context?: BindingContext): boolean {\n return this.providersFor(node).some(p => p.nodeHasBindings(node))\n }\n\n override preprocessNode(node: Node): Node[] | null {\n for (const provider of this.providersFor(node)) {\n const newNodes = provider.preprocessNode(node)\n if (newNodes) {\n return newNodes\n }\n }\n return null\n }\n\n *enumerateProviderBindings(node: Node, context) {\n for (const provider of this.providersFor(node)) {\n const bindings = provider.getBindingAccessors(node, context)\n if (!bindings) {\n continue\n }\n yield* Object.entries(bindings || {})\n if (provider.preemptive) {\n return\n }\n }\n }\n\n override getBindingAccessors(node: Node, context?: BindingContext) {\n const bindings = {}\n for (const [key, accessor] of this.enumerateProviderBindings(node, context)) {\n if (key in bindings) {\n throw new Error(`The binding \"${key}\" is duplicated by multiple providers`)\n }\n bindings[key] = accessor\n }\n return bindings\n }\n}\n"], | ||
| "mappings": ";;AAAA,SAAS,gBAAgB;AAMzB,qBAAqB,sBAAsB,SAAS;AAAA,EAKlD,IAAa,iBAAiB;AAC5B,WAAO,KAAK;AAAA,EACd;AAAA,EAEA,YAAY,QAAqC;AAC/C,UAAM,MAAM;AACZ,UAAM,YAAY,QAAQ,aAAa,CAAC;AACxC,SAAK,cAAc,CAAC;AACpB,SAAK,YAAY,CAAC;AAClB,SAAK,YAAY,CAAC;AAClB,cAAU,QAAQ,OAAK,KAAK,YAAY,CAAC,CAAC;AAAA,EAC5C;AAAA,EAES,WAAW,SAAS;AAC3B;AAAC,KAAC,MAAM,GAAG,KAAK,SAAS,EAAE,QAAQ,OAAM,EAAE,UAAU,OAAQ;AAAA,EAC/D;AAAA,EAEA,YAAY,UAAoB;AAC9B,SAAK,UAAU,KAAK,QAAQ;AAC5B,aAAS,kBAAkB,KAAK;AAChC,aAAS,UAAU,KAAK;AACxB,UAAM,cAAc,KAAK;AACzB,eAAW,YAAY,SAAS,gBAAgB;AAC9C,UAAI,CAAC,YAAY,QAAQ,GAAG;AAC1B,oBAAY,QAAQ,IAAI,IAAI,MAAM;AAAA,MACpC;AACA,kBAAY,QAAQ,EAAE,KAAK,QAAQ;AAAA,IACrC;AACA,SAAK,YAAY,OAAO,KAAK,KAAK,WAAW,EAAE,IAAI,OAAK,SAAS,GAAG,EAAE,CAAC;AAAA,EACzE;AAAA,EAEA,aAAa,MAAmB;AAC9B,WAAO,KAAK,YAAY,KAAK,QAAQ,KAAK,CAAC;AAAA,EAC7C;AAAA,EAES,gBAAgB,MAAY,SAAmC;AACtE,WAAO,KAAK,aAAa,IAAI,EAAE,KAAK,OAAK,EAAE,gBAAgB,IAAI,CAAC;AAAA,EAClE;AAAA,EAES,eAAe,MAA2B;AACjD,eAAW,YAAY,KAAK,aAAa,IAAI,GAAG;AAC9C,YAAM,WAAW,SAAS,eAAe,IAAI;AAC7C,UAAI,UAAU;AACZ,eAAO;AAAA,MACT;AAAA,IACF;AACA,WAAO;AAAA,EACT;AAAA,EAEA,CAAC,0BAA0B,MAAY,SAAS;AAC9C,eAAW,YAAY,KAAK,aAAa,IAAI,GAAG;AAC9C,YAAM,WAAW,SAAS,oBAAoB,MAAM,OAAO;AAC3D,UAAI,CAAC,UAAU;AACb;AAAA,MACF;AACA,aAAO,OAAO,QAAQ,YAAY,CAAC,CAAC;AACpC,UAAI,SAAS,YAAY;AACvB;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAAA,EAES,oBAAoB,MAAY,SAA0B;AACjE,UAAM,WAAW,CAAC;AAClB,eAAW,CAAC,KAAK,QAAQ,KAAK,KAAK,0BAA0B,MAAM,OAAO,GAAG;AAC3E,UAAI,OAAO,UAAU;AACnB,cAAM,IAAI,MAAM,gBAAgB,GAAG,uCAAuC;AAAA,MAC5E;AACA,eAAS,GAAG,IAAI;AAAA,IAClB;AACA,WAAO;AAAA,EACT;AACF;", | ||
| "mappings": ";;AAAA,SAAS,gBAAgB;AAMzB,qBAAqB,sBAAsB,SAAS;AAAA,EAClD;AAAA,EACA;AAAA,EACA;AAAA,EAEA,IAAa,iBAAiB;AAC5B,WAAO,KAAK;AAAA,EACd;AAAA,EAEA,YAAY,QAAqC;AAC/C,UAAM,MAAM;AACZ,UAAM,YAAY,QAAQ,aAAa,CAAC;AACxC,SAAK,cAAc,CAAC;AACpB,SAAK,YAAY,CAAC;AAClB,SAAK,YAAY,CAAC;AAClB,cAAU,QAAQ,OAAK,KAAK,YAAY,CAAC,CAAC;AAAA,EAC5C;AAAA,EAES,WAAW,SAAS;AAC3B;AAAC,KAAC,MAAM,GAAG,KAAK,SAAS,EAAE,QAAQ,OAAM,EAAE,UAAU,OAAQ;AAAA,EAC/D;AAAA,EAEA,YAAY,UAAoB;AAC9B,SAAK,UAAU,KAAK,QAAQ;AAC5B,aAAS,kBAAkB,KAAK;AAChC,aAAS,UAAU,KAAK;AACxB,UAAM,cAAc,KAAK;AACzB,eAAW,YAAY,SAAS,gBAAgB;AAC9C,UAAI,CAAC,YAAY,QAAQ,GAAG;AAC1B,oBAAY,QAAQ,IAAI,IAAI,MAAM;AAAA,MACpC;AACA,kBAAY,QAAQ,EAAE,KAAK,QAAQ;AAAA,IACrC;AACA,SAAK,YAAY,OAAO,KAAK,KAAK,WAAW,EAAE,IAAI,OAAK,SAAS,GAAG,EAAE,CAAC;AAAA,EACzE;AAAA,EAEA,aAAa,MAAmB;AAC9B,WAAO,KAAK,YAAY,KAAK,QAAQ,KAAK,CAAC;AAAA,EAC7C;AAAA,EAES,gBAAgB,MAAY,SAAmC;AACtE,WAAO,KAAK,aAAa,IAAI,EAAE,KAAK,OAAK,EAAE,gBAAgB,IAAI,CAAC;AAAA,EAClE;AAAA,EAES,eAAe,MAA2B;AACjD,eAAW,YAAY,KAAK,aAAa,IAAI,GAAG;AAC9C,YAAM,WAAW,SAAS,eAAe,IAAI;AAC7C,UAAI,UAAU;AACZ,eAAO;AAAA,MACT;AAAA,IACF;AACA,WAAO;AAAA,EACT;AAAA,EAEA,CAAC,0BAA0B,MAAY,SAAS;AAC9C,eAAW,YAAY,KAAK,aAAa,IAAI,GAAG;AAC9C,YAAM,WAAW,SAAS,oBAAoB,MAAM,OAAO;AAC3D,UAAI,CAAC,UAAU;AACb;AAAA,MACF;AACA,aAAO,OAAO,QAAQ,YAAY,CAAC,CAAC;AACpC,UAAI,SAAS,YAAY;AACvB;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAAA,EAES,oBAAoB,MAAY,SAA0B;AACjE,UAAM,WAAW,CAAC;AAClB,eAAW,CAAC,KAAK,QAAQ,KAAK,KAAK,0BAA0B,MAAM,OAAO,GAAG;AAC3E,UAAI,OAAO,UAAU;AACnB,cAAM,IAAI,MAAM,gBAAgB,GAAG,uCAAuC;AAAA,MAC5E;AACA,eAAS,GAAG,IAAI;AAAA,IAClB;AACA,WAAO;AAAA,EACT;AACF;", | ||
| "names": [] | ||
| } |
+8
-13
| { | ||
| "version": "4.0.0", | ||
| "version": "4.0.1", | ||
| "name": "@tko/provider.multi", | ||
| "description": "Combine multiple other providers into one", | ||
| "module": "dist/provider.multi.js", | ||
| "module": "dist/index.js", | ||
| "files": [ | ||
| "dist/", | ||
| "helpers/" | ||
| "dist/" | ||
| ], | ||
| "license": "MIT", | ||
| "dependencies": { | ||
| "@tko/provider": "^4.0.0", | ||
| "@tko/provider": "^4.0.1", | ||
| "tslib": "^2.2.0" | ||
| }, | ||
| "karma": { | ||
| "frameworks": [ | ||
| "mocha", | ||
| "chai" | ||
| ] | ||
| }, | ||
| "homepage": "https://tko.io", | ||
@@ -32,4 +25,3 @@ "licenses": [ | ||
| "import": "./dist/index.js" | ||
| }, | ||
| "./helpers/*": "./helpers/*" | ||
| } | ||
| }, | ||
@@ -43,3 +35,6 @@ "bugs": { | ||
| "url": "git+https://github.com/knockout/tko.git" | ||
| }, | ||
| "scripts": { | ||
| "build": "bun ../../tools/build.ts" | ||
| } | ||
| } |
Sorry, the diff of this file is too big to display
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
0
-100%16405
-88.72%214
-85.86%1
Infinity%Updated