UNPKG

@lifeart/gxt

Version:

<img align="right" width="95" height="95" alt="Philosopher’s stone, logo of PostCSS" src="./public/logo.png">

1,607 lines (1,577 loc) • 56 kB
import { a8 as CHILD, a9 as COMPONENT_ID_PROPERTY, aa as TREE, ab as IfCondition, ac as isArray$1, $ as $nodes, ad as getBounds, ae as RENDERED_NODES_PROPERTY, af as NS_HTML, ag as AsyncListComponent, ah as SyncListComponent, ai as Cell, aj as MergedCell, ak as getCells, al as getMergedCells, am as $context, an as $_debug_args, j as $args, F as getRoot } from './reactive-CVZF9xBs.js'; var backburner = {}; Object.defineProperty(backburner, '__esModule', { value: true }); var SET_TIMEOUT = setTimeout; var NOOP = function () { }; function buildNext(flush) { // Using "promises first" here to: // // 1) Ensure more consistent experience on browsers that // have differently queued microtasks (separate queues for // MutationObserver vs Promises). // 2) Ensure better debugging experiences (it shows up in Chrome // call stack as "Promise.then (async)") which is more consistent // with user expectations // // When Promise is unavailable use MutationObserver (mostly so that we // still get microtasks on IE11), and when neither MutationObserver and // Promise are present use a plain old setTimeout. if (typeof Promise === 'function') { var autorunPromise = Promise.resolve(); return function () { return autorunPromise.then(flush); }; } else if (typeof MutationObserver === 'function') { var iterations = 0; var observer = new MutationObserver(flush); var node = document.createTextNode(''); observer.observe(node, { characterData: true }); return function () { iterations = ++iterations % 2; node.data = '' + iterations; return iterations; }; } else { return function () { return SET_TIMEOUT(flush, 0); }; } } function buildPlatform(flush) { var clearNext = NOOP; return { setTimeout: function setTimeout$1(fn, ms) { return setTimeout(fn, ms); }, clearTimeout: function clearTimeout$1(timerId) { return clearTimeout(timerId); }, now: function now() { return Date.now(); }, next: buildNext(flush), clearNext: clearNext, }; } var NUMBER = /\d+/; var TIMERS_OFFSET = 6; function isCoercableNumber(suspect) { var type = typeof suspect; return type === 'number' && suspect === suspect || type === 'string' && NUMBER.test(suspect); } function getOnError(options) { return options.onError || (options.onErrorTarget && options.onErrorTarget[options.onErrorMethod]); } function findItem(target, method, collection) { var index = -1; for (var i = 0, l = collection.length; i < l; i += 4) { if (collection[i] === target && collection[i + 1] === method) { index = i; break; } } return index; } function findTimerItem(target, method, collection) { var index = -1; for (var i = 2, l = collection.length; i < l; i += 6) { if (collection[i] === target && collection[i + 1] === method) { index = i - 2; break; } } return index; } function getQueueItems(items, queueItemLength, queueItemPositionOffset) { if ( queueItemPositionOffset === void 0 ) queueItemPositionOffset = 0; var queueItems = []; for (var i = 0; i < items.length; i += queueItemLength) { var maybeError = items[i + 3 /* stack */ + queueItemPositionOffset]; var queueItem = { target: items[i + 0 /* target */ + queueItemPositionOffset], method: items[i + 1 /* method */ + queueItemPositionOffset], args: items[i + 2 /* args */ + queueItemPositionOffset], stack: maybeError !== undefined && 'stack' in maybeError ? maybeError.stack : '' }; queueItems.push(queueItem); } return queueItems; } function binarySearch(time, timers) { var start = 0; var end = timers.length - TIMERS_OFFSET; var middle; var l; while (start < end) { // since timers is an array of pairs 'l' will always // be an integer l = (end - start) / TIMERS_OFFSET; // compensate for the index in case even number // of pairs inside timers middle = start + l - (l % TIMERS_OFFSET); if (time >= timers[middle]) { start = middle + TIMERS_OFFSET; } else { end = middle; } } return (time >= timers[start]) ? start + TIMERS_OFFSET : start; } var QUEUE_ITEM_LENGTH = 4; var Queue = function Queue(name, options, globalOptions) { if ( options === void 0 ) options = {}; if ( globalOptions === void 0 ) globalOptions = {}; this._queueBeingFlushed = []; this.targetQueues = new Map(); this.index = 0; this._queue = []; this.name = name; this.options = options; this.globalOptions = globalOptions; }; Queue.prototype.stackFor = function stackFor (index) { if (index < this._queue.length) { var entry = this._queue[index * 3 + QUEUE_ITEM_LENGTH]; if (entry) { return entry.stack; } else { return null; } } }; Queue.prototype.flush = function flush (sync) { var ref = this.options; var before = ref.before; var after = ref.after; var target; var method; var args; var errorRecordedForStack; this.targetQueues.clear(); if (this._queueBeingFlushed.length === 0) { this._queueBeingFlushed = this._queue; this._queue = []; } if (before !== undefined) { before(); } var invoke; var queueItems = this._queueBeingFlushed; if (queueItems.length > 0) { var onError = getOnError(this.globalOptions); invoke = onError ? this.invokeWithOnError : this.invoke; for (var i = this.index; i < queueItems.length; i += QUEUE_ITEM_LENGTH) { this.index += QUEUE_ITEM_LENGTH; method = queueItems[i + 1]; // method could have been nullified / canceled during flush if (method !== null) { // //** Attention intrepid developer ** // //To find out the stack of this task when it was scheduled onto //the run loop, add the following to your app.js: // //Ember.run.backburner.DEBUG = true; // NOTE: This slows your app, don't leave it on in production. // //Once that is in place, when you are at a breakpoint and navigate //here in the stack explorer, you can look at `errorRecordedForStack.stack`, //which will be the captured stack when this job was scheduled. // //One possible long-term solution is the following Chrome issue: // https://bugs.chromium.org/p/chromium/issues/detail?id=332624 // target = queueItems[i]; args = queueItems[i + 2]; errorRecordedForStack = queueItems[i + 3]; // Debugging assistance invoke(target, method, args, onError, errorRecordedForStack); } if (this.index !== this._queueBeingFlushed.length && this.globalOptions.mustYield && this.globalOptions.mustYield()) { return 1 /* Pause */; } } } if (after !== undefined) { after(); } this._queueBeingFlushed.length = 0; this.index = 0; if (sync !== false && this._queue.length > 0) { // check if new items have been added this.flush(true); } }; Queue.prototype.hasWork = function hasWork () { return this._queueBeingFlushed.length > 0 || this._queue.length > 0; }; Queue.prototype.cancel = function cancel (ref) { var target = ref.target; var method = ref.method; var queue = this._queue; var targetQueueMap = this.targetQueues.get(target); if (targetQueueMap !== undefined) { targetQueueMap.delete(method); } var index = findItem(target, method, queue); if (index > -1) { queue[index + 1] = null; return true; } // if not found in current queue // could be in the queue that is being flushed queue = this._queueBeingFlushed; index = findItem(target, method, queue); if (index > -1) { queue[index + 1] = null; return true; } return false; }; Queue.prototype.push = function push (target, method, args, stack) { this._queue.push(target, method, args, stack); return { queue: this, target: target, method: method }; }; Queue.prototype.pushUnique = function pushUnique (target, method, args, stack) { var localQueueMap = this.targetQueues.get(target); if (localQueueMap === undefined) { localQueueMap = new Map(); this.targetQueues.set(target, localQueueMap); } var index = localQueueMap.get(method); if (index === undefined) { var queueIndex = this._queue.push(target, method, args, stack) - QUEUE_ITEM_LENGTH; localQueueMap.set(method, queueIndex); } else { var queue = this._queue; queue[index + 2] = args; // replace args queue[index + 3] = stack; // replace stack } return { queue: this, target: target, method: method }; }; Queue.prototype._getDebugInfo = function _getDebugInfo (debugEnabled) { if (debugEnabled) { var debugInfo = getQueueItems(this._queue, QUEUE_ITEM_LENGTH); return debugInfo; } return undefined; }; Queue.prototype.invoke = function invoke (target, method, args /*, onError, errorRecordedForStack */) { if (args === undefined) { method.call(target); } else { method.apply(target, args); } }; Queue.prototype.invokeWithOnError = function invokeWithOnError (target, method, args, onError, errorRecordedForStack) { try { if (args === undefined) { method.call(target); } else { method.apply(target, args); } } catch (error) { onError(error, errorRecordedForStack); } }; var DeferredActionQueues = function DeferredActionQueues(queueNames, options) { if ( queueNames === void 0 ) queueNames = []; this.queues = {}; this.queueNameIndex = 0; this.queueNames = queueNames; queueNames.reduce(function (queues, queueName) { queues[queueName] = new Queue(queueName, options[queueName], options); return queues; }, this.queues); }; /** * @method schedule * @param {String} queueName * @param {Any} target * @param {Any} method * @param {Any} args * @param {Boolean} onceFlag * @param {Any} stack * @return queue */ DeferredActionQueues.prototype.schedule = function schedule (queueName, target, method, args, onceFlag, stack) { var queues = this.queues; var queue = queues[queueName]; if (queue === undefined) { throw new Error(("You attempted to schedule an action in a queue (" + queueName + ") that doesn't exist")); } if (method === undefined || method === null) { throw new Error(("You attempted to schedule an action in a queue (" + queueName + ") for a method that doesn't exist")); } this.queueNameIndex = 0; if (onceFlag) { return queue.pushUnique(target, method, args, stack); } else { return queue.push(target, method, args, stack); } }; /** * DeferredActionQueues.flush() calls Queue.flush() * * @method flush * @param {Boolean} fromAutorun */ DeferredActionQueues.prototype.flush = function flush (fromAutorun) { if ( fromAutorun === void 0 ) fromAutorun = false; var queue; var queueName; var numberOfQueues = this.queueNames.length; while (this.queueNameIndex < numberOfQueues) { queueName = this.queueNames[this.queueNameIndex]; queue = this.queues[queueName]; if (queue.hasWork() === false) { this.queueNameIndex++; if (fromAutorun && this.queueNameIndex < numberOfQueues) { return 1 /* Pause */; } } else { if (queue.flush(false /* async */) === 1 /* Pause */) { return 1 /* Pause */; } } } }; /** * Returns debug information for the current queues. * * @method _getDebugInfo * @param {Boolean} debugEnabled * @returns {IDebugInfo | undefined} */ DeferredActionQueues.prototype._getDebugInfo = function _getDebugInfo (debugEnabled) { if (debugEnabled) { var debugInfo = {}; var queue; var queueName; var numberOfQueues = this.queueNames.length; var i = 0; while (i < numberOfQueues) { queueName = this.queueNames[i]; queue = this.queues[queueName]; debugInfo[queueName] = queue._getDebugInfo(debugEnabled); i++; } return debugInfo; } return; }; function iteratorDrain (fn) { var iterator = fn(); var result = iterator.next(); while (result.done === false) { result.value(); result = iterator.next(); } } var noop = function () { }; var DISABLE_SCHEDULE = Object.freeze([]); function parseArgs() { var arguments$1 = arguments; var length = arguments.length; var args; var method; var target; if (length === 0) ; else if (length === 1) { target = null; method = arguments[0]; } else { var argsIndex = 2; var methodOrTarget = arguments[0]; var methodOrArgs = arguments[1]; var type = typeof methodOrArgs; if (type === 'function') { target = methodOrTarget; method = methodOrArgs; } else if (methodOrTarget !== null && type === 'string' && methodOrArgs in methodOrTarget) { target = methodOrTarget; method = target[methodOrArgs]; } else if (typeof methodOrTarget === 'function') { argsIndex = 1; target = null; method = methodOrTarget; } if (length > argsIndex) { var len = length - argsIndex; args = new Array(len); for (var i = 0; i < len; i++) { args[i] = arguments$1[i + argsIndex]; } } } return [target, method, args]; } function parseTimerArgs() { var ref = parseArgs.apply(void 0, arguments); var target = ref[0]; var method = ref[1]; var args = ref[2]; var wait = 0; var length = args !== undefined ? args.length : 0; if (length > 0) { var last = args[length - 1]; if (isCoercableNumber(last)) { wait = parseInt(args.pop(), 10); } } return [target, method, args, wait]; } function parseDebounceArgs() { var assign; var target; var method; var isImmediate; var args; var wait; if (arguments.length === 2) { method = arguments[0]; wait = arguments[1]; target = null; } else { (assign = parseArgs.apply(void 0, arguments), target = assign[0], method = assign[1], args = assign[2]); if (args === undefined) { wait = 0; } else { wait = args.pop(); if (!isCoercableNumber(wait)) { isImmediate = wait === true; wait = args.pop(); } } } wait = parseInt(wait, 10); return [target, method, args, wait, isImmediate]; } var UUID = 0; var beginCount = 0; var endCount = 0; var beginEventCount = 0; var endEventCount = 0; var runCount = 0; var joinCount = 0; var deferCount = 0; var scheduleCount = 0; var scheduleIterableCount = 0; var deferOnceCount = 0; var scheduleOnceCount = 0; var setTimeoutCount = 0; var laterCount = 0; var throttleCount = 0; var debounceCount = 0; var cancelTimersCount = 0; var cancelCount = 0; var autorunsCreatedCount = 0; var autorunsCompletedCount = 0; var deferredActionQueuesCreatedCount = 0; var nestedDeferredActionQueuesCreated = 0; var Backburner = function Backburner(queueNames, options) { var this$1$1 = this; this.DEBUG = false; this.currentInstance = null; this.instanceStack = []; this._eventCallbacks = { end: [], begin: [] }; this._timerTimeoutId = null; this._timers = []; this._autorun = false; this._autorunStack = null; this.queueNames = queueNames; this.options = options || {}; if (typeof this.options.defaultQueue === 'string') { this._defaultQueue = this.options.defaultQueue; } else { this._defaultQueue = this.queueNames[0]; } this._onBegin = this.options.onBegin || noop; this._onEnd = this.options.onEnd || noop; this._boundRunExpiredTimers = this._runExpiredTimers.bind(this); this._boundAutorunEnd = function () { autorunsCompletedCount++; // if the autorun was already flushed, do nothing if (this$1$1._autorun === false) { return; } this$1$1._autorun = false; this$1$1._autorunStack = null; this$1$1._end(true /* fromAutorun */); }; var builder = this.options._buildPlatform || buildPlatform; this._platform = builder(this._boundAutorunEnd); }; var prototypeAccessors = { counters: { configurable: true },defaultQueue: { configurable: true } }; prototypeAccessors.counters.get = function () { return { begin: beginCount, end: endCount, events: { begin: beginEventCount, end: endEventCount, }, autoruns: { created: autorunsCreatedCount, completed: autorunsCompletedCount, }, run: runCount, join: joinCount, defer: deferCount, schedule: scheduleCount, scheduleIterable: scheduleIterableCount, deferOnce: deferOnceCount, scheduleOnce: scheduleOnceCount, setTimeout: setTimeoutCount, later: laterCount, throttle: throttleCount, debounce: debounceCount, cancelTimers: cancelTimersCount, cancel: cancelCount, loops: { total: deferredActionQueuesCreatedCount, nested: nestedDeferredActionQueuesCreated, }, }; }; prototypeAccessors.defaultQueue.get = function () { return this._defaultQueue; }; /* @method begin @return instantiated class DeferredActionQueues */ Backburner.prototype.begin = function begin () { beginCount++; var options = this.options; var previousInstance = this.currentInstance; var current; if (this._autorun !== false) { current = previousInstance; this._cancelAutorun(); } else { if (previousInstance !== null) { nestedDeferredActionQueuesCreated++; this.instanceStack.push(previousInstance); } deferredActionQueuesCreatedCount++; current = this.currentInstance = new DeferredActionQueues(this.queueNames, options); beginEventCount++; this._trigger('begin', current, previousInstance); } this._onBegin(current, previousInstance); return current; }; Backburner.prototype.end = function end () { endCount++; this._end(false); }; Backburner.prototype.on = function on (eventName, callback) { if (typeof callback !== 'function') { throw new TypeError("Callback must be a function"); } var callbacks = this._eventCallbacks[eventName]; if (callbacks !== undefined) { callbacks.push(callback); } else { throw new TypeError(("Cannot on() event " + eventName + " because it does not exist")); } }; Backburner.prototype.off = function off (eventName, callback) { var callbacks = this._eventCallbacks[eventName]; if (!eventName || callbacks === undefined) { throw new TypeError(("Cannot off() event " + eventName + " because it does not exist")); } var callbackFound = false; if (callback) { for (var i = 0; i < callbacks.length; i++) { if (callbacks[i] === callback) { callbackFound = true; callbacks.splice(i, 1); i--; } } } if (!callbackFound) { throw new TypeError("Cannot off() callback that does not exist"); } }; Backburner.prototype.run = function run () { runCount++; var ref = parseArgs.apply(void 0, arguments); var target = ref[0]; var method = ref[1]; var args = ref[2]; return this._run(target, method, args); }; Backburner.prototype.join = function join () { joinCount++; var ref = parseArgs.apply(void 0, arguments); var target = ref[0]; var method = ref[1]; var args = ref[2]; return this._join(target, method, args); }; /** * @deprecated please use schedule instead. */ Backburner.prototype.defer = function defer (queueName, target, method) { var ref; var args = [], len = arguments.length - 3; while ( len-- > 0 ) args[ len ] = arguments[ len + 3 ]; deferCount++; return (ref = this).schedule.apply(ref, [ queueName, target, method ].concat( args )); }; Backburner.prototype.schedule = function schedule (queueName) { var _args = [], len = arguments.length - 1; while ( len-- > 0 ) _args[ len ] = arguments[ len + 1 ]; scheduleCount++; var ref = parseArgs.apply(void 0, _args); var target = ref[0]; var method = ref[1]; var args = ref[2]; var stack = this.DEBUG ? new Error() : undefined; return this._ensureInstance().schedule(queueName, target, method, args, false, stack); }; /* Defer the passed iterable of functions to run inside the specified queue. @method scheduleIterable @param {String} queueName @param {Iterable} an iterable of functions to execute @return method result */ Backburner.prototype.scheduleIterable = function scheduleIterable (queueName, iterable) { scheduleIterableCount++; var stack = this.DEBUG ? new Error() : undefined; return this._ensureInstance().schedule(queueName, null, iteratorDrain, [iterable], false, stack); }; /** * @deprecated please use scheduleOnce instead. */ Backburner.prototype.deferOnce = function deferOnce (queueName, target, method) { var ref; var args = [], len = arguments.length - 3; while ( len-- > 0 ) args[ len ] = arguments[ len + 3 ]; deferOnceCount++; return (ref = this).scheduleOnce.apply(ref, [ queueName, target, method ].concat( args )); }; Backburner.prototype.scheduleOnce = function scheduleOnce (queueName) { var _args = [], len = arguments.length - 1; while ( len-- > 0 ) _args[ len ] = arguments[ len + 1 ]; scheduleOnceCount++; var ref = parseArgs.apply(void 0, _args); var target = ref[0]; var method = ref[1]; var args = ref[2]; var stack = this.DEBUG ? new Error() : undefined; return this._ensureInstance().schedule(queueName, target, method, args, true, stack); }; Backburner.prototype.setTimeout = function setTimeout () { var ref; setTimeoutCount++; return (ref = this).later.apply(ref, arguments); }; Backburner.prototype.later = function later () { laterCount++; var ref = parseTimerArgs.apply(void 0, arguments); var target = ref[0]; var method = ref[1]; var args = ref[2]; var wait = ref[3]; return this._later(target, method, args, wait); }; Backburner.prototype.throttle = function throttle () { throttleCount++; var ref = parseDebounceArgs.apply(void 0, arguments); var target = ref[0]; var method = ref[1]; var args = ref[2]; var wait = ref[3]; var isImmediate = ref[4]; if ( isImmediate === void 0 ) isImmediate = true; var index = findTimerItem(target, method, this._timers); var timerId; if (index === -1) { timerId = this._later(target, method, isImmediate ? DISABLE_SCHEDULE : args, wait); if (isImmediate) { this._join(target, method, args); } } else { timerId = this._timers[index + 1]; var argIndex = index + 4; if (this._timers[argIndex] !== DISABLE_SCHEDULE) { this._timers[argIndex] = args; } } return timerId; }; Backburner.prototype.debounce = function debounce () { debounceCount++; var ref = parseDebounceArgs.apply(void 0, arguments); var target = ref[0]; var method = ref[1]; var args = ref[2]; var wait = ref[3]; var isImmediate = ref[4]; if ( isImmediate === void 0 ) isImmediate = false; var _timers = this._timers; var index = findTimerItem(target, method, _timers); var timerId; if (index === -1) { timerId = this._later(target, method, isImmediate ? DISABLE_SCHEDULE : args, wait); if (isImmediate) { this._join(target, method, args); } } else { var executeAt = this._platform.now() + wait; var argIndex = index + 4; if (_timers[argIndex] === DISABLE_SCHEDULE) { args = DISABLE_SCHEDULE; } timerId = _timers[index + 1]; var i = binarySearch(executeAt, _timers); if ((index + TIMERS_OFFSET) === i) { _timers[index] = executeAt; _timers[argIndex] = args; } else { var stack = this._timers[index + 5]; this._timers.splice(i, 0, executeAt, timerId, target, method, args, stack); this._timers.splice(index, TIMERS_OFFSET); } if (index === 0) { this._reinstallTimerTimeout(); } } return timerId; }; Backburner.prototype.cancelTimers = function cancelTimers () { cancelTimersCount++; this._clearTimerTimeout(); this._timers = []; this._cancelAutorun(); }; Backburner.prototype.hasTimers = function hasTimers () { return this._timers.length > 0 || this._autorun; }; Backburner.prototype.cancel = function cancel (timer) { cancelCount++; if (timer === null || timer === undefined) { return false; } var timerType = typeof timer; if (timerType === 'number') { // we're cancelling a setTimeout or throttle or debounce return this._cancelLaterTimer(timer); } else if (timerType === 'object' && timer.queue && timer.method) { // we're cancelling a deferOnce return timer.queue.cancel(timer); } return false; }; Backburner.prototype.ensureInstance = function ensureInstance () { this._ensureInstance(); }; /** * Returns debug information related to the current instance of Backburner * * @method getDebugInfo * @returns {Object | undefined} Will return and Object containing debug information if * the DEBUG flag is set to true on the current instance of Backburner, else undefined. */ Backburner.prototype.getDebugInfo = function getDebugInfo () { var this$1$1 = this; if (this.DEBUG) { return { autorun: this._autorunStack, counters: this.counters, timers: getQueueItems(this._timers, TIMERS_OFFSET, 2), instanceStack: [this.currentInstance ].concat( this.instanceStack) .map(function (deferredActionQueue) { return deferredActionQueue && deferredActionQueue._getDebugInfo(this$1$1.DEBUG); }) }; } return undefined; }; Backburner.prototype._end = function _end (fromAutorun) { var currentInstance = this.currentInstance; var nextInstance = null; if (currentInstance === null) { throw new Error("end called without begin"); } // Prevent double-finally bug in Safari 6.0.2 and iOS 6 // This bug appears to be resolved in Safari 6.0.5 and iOS 7 var finallyAlreadyCalled = false; var result; try { result = currentInstance.flush(fromAutorun); } finally { if (!finallyAlreadyCalled) { finallyAlreadyCalled = true; if (result === 1 /* Pause */) { var plannedNextQueue = this.queueNames[currentInstance.queueNameIndex]; this._scheduleAutorun(plannedNextQueue); } else { this.currentInstance = null; if (this.instanceStack.length > 0) { nextInstance = this.instanceStack.pop(); this.currentInstance = nextInstance; } this._trigger('end', currentInstance, nextInstance); this._onEnd(currentInstance, nextInstance); } } } }; Backburner.prototype._join = function _join (target, method, args) { if (this.currentInstance === null) { return this._run(target, method, args); } if (target === undefined && args === undefined) { return method(); } else { return method.apply(target, args); } }; Backburner.prototype._run = function _run (target, method, args) { var onError = getOnError(this.options); this.begin(); if (onError) { try { return method.apply(target, args); } catch (error) { onError(error); } finally { this.end(); } } else { try { return method.apply(target, args); } finally { this.end(); } } }; Backburner.prototype._cancelAutorun = function _cancelAutorun () { if (this._autorun) { this._platform.clearNext(); this._autorun = false; this._autorunStack = null; } }; Backburner.prototype._later = function _later (target, method, args, wait) { var stack = this.DEBUG ? new Error() : undefined; var executeAt = this._platform.now() + wait; var id = UUID++; if (this._timers.length === 0) { this._timers.push(executeAt, id, target, method, args, stack); this._installTimerTimeout(); } else { // find position to insert var i = binarySearch(executeAt, this._timers); this._timers.splice(i, 0, executeAt, id, target, method, args, stack); // always reinstall since it could be out of sync this._reinstallTimerTimeout(); } return id; }; Backburner.prototype._cancelLaterTimer = function _cancelLaterTimer (timer) { for (var i = 1; i < this._timers.length; i += TIMERS_OFFSET) { if (this._timers[i] === timer) { this._timers.splice(i - 1, TIMERS_OFFSET); if (i === 1) { this._reinstallTimerTimeout(); } return true; } } return false; }; /** Trigger an event. Supports up to two arguments. Designed around triggering transition events from one run loop instance to the next, which requires an argument for theinstance and then an argument for the next instance. @private @method _trigger @param {String} eventName @param {any} arg1 @param {any} arg2 */ Backburner.prototype._trigger = function _trigger (eventName, arg1, arg2) { var callbacks = this._eventCallbacks[eventName]; if (callbacks !== undefined) { for (var i = 0; i < callbacks.length; i++) { callbacks[i](arg1, arg2); } } }; Backburner.prototype._runExpiredTimers = function _runExpiredTimers () { this._timerTimeoutId = null; if (this._timers.length > 0) { this.begin(); this._scheduleExpiredTimers(); this.end(); } }; Backburner.prototype._scheduleExpiredTimers = function _scheduleExpiredTimers () { var timers = this._timers; var i = 0; var l = timers.length; var defaultQueue = this._defaultQueue; var n = this._platform.now(); for (; i < l; i += TIMERS_OFFSET) { var executeAt = timers[i]; if (executeAt > n) { break; } var args = timers[i + 4]; if (args !== DISABLE_SCHEDULE) { var target = timers[i + 2]; var method = timers[i + 3]; var stack = timers[i + 5]; this.currentInstance.schedule(defaultQueue, target, method, args, false, stack); } } timers.splice(0, i); this._installTimerTimeout(); }; Backburner.prototype._reinstallTimerTimeout = function _reinstallTimerTimeout () { this._clearTimerTimeout(); this._installTimerTimeout(); }; Backburner.prototype._clearTimerTimeout = function _clearTimerTimeout () { if (this._timerTimeoutId === null) { return; } this._platform.clearTimeout(this._timerTimeoutId); this._timerTimeoutId = null; }; Backburner.prototype._installTimerTimeout = function _installTimerTimeout () { if (this._timers.length === 0) { return; } var minExpiresAt = this._timers[0]; var n = this._platform.now(); var wait = Math.max(0, minExpiresAt - n); this._timerTimeoutId = this._platform.setTimeout(this._boundRunExpiredTimers, wait); }; Backburner.prototype._ensureInstance = function _ensureInstance () { var currentInstance = this.currentInstance; if (currentInstance === null) { this._autorunStack = this.DEBUG ? new Error() : undefined; currentInstance = this.begin(); this._scheduleAutorun(this.queueNames[0]); } return currentInstance; }; Backburner.prototype._scheduleAutorun = function _scheduleAutorun (plannedNextQueue) { autorunsCreatedCount++; var next = this._platform.next; var flush = this.options.flush; if (flush) { flush(plannedNextQueue, next); } else { next(); } this._autorun = true; }; Object.defineProperties( Backburner.prototype, prototypeAccessors ); Backburner.Queue = Queue; Backburner.buildPlatform = buildPlatform; Backburner.buildNext = buildNext; backburner.buildPlatform = buildPlatform; var _default = backburner.default = Backburner; const { toString: objectToString } = Object.prototype; const { toString: functionToString } = Function.prototype; const { isArray } = Array; const { keys: objectKeys } = Object; const { stringify } = JSON; const LIST_LIMIT = 100; const DEPTH_LIMIT = 4; const SAFE_KEY = /^[\w$]+$/; function inspect(obj) { if (typeof obj === "number" && arguments.length === 2) { return this; } return inspectValue(obj, 0); } function inspectValue(value, depth, seen) { let valueIsArray = false; switch (typeof value) { case "undefined": return "undefined"; case "object": if (value === null) return "null"; if (isArray(value)) { valueIsArray = true; break; } if (value.toString === objectToString || value.toString === void 0) { break; } return value.toString(); case "function": return value.toString === functionToString ? value.name ? `[Function:${value.name}]` : `[Function]` : value.toString(); case "string": return stringify(value); case "symbol": case "boolean": case "number": default: return value.toString(); } if (seen === void 0) { seen = /* @__PURE__ */ new WeakSet(); } else { if (seen.has(value)) return `[Circular]`; } seen.add(value); return valueIsArray ? inspectArray(value, depth + 1, seen) : inspectObject(value, depth + 1, seen); } function inspectKey(key) { return SAFE_KEY.test(key) ? key : stringify(key); } function inspectObject(obj, depth, seen) { if (depth > DEPTH_LIMIT) { return "[Object]"; } let s = "{"; let keys = objectKeys(obj); for (let i = 0; i < keys.length; i++) { s += i === 0 ? " " : ", "; if (i >= LIST_LIMIT) { s += `... ${keys.length - LIST_LIMIT} more keys`; break; } let key = keys[i]; s += `${inspectKey(String(key))}: ${inspectValue(obj[key], depth, seen)}`; } s += " }"; return s; } function inspectArray(arr, depth, seen) { if (depth > DEPTH_LIMIT) { return "[Array]"; } let s = "["; for (let i = 0; i < arr.length; i++) { s += i === 0 ? " " : ", "; if (i >= LIST_LIMIT) { s += `... ${arr.length - LIST_LIMIT} more items`; break; } s += inspectValue(arr[i], depth, seen); } s += " ]"; return s; } const genericProxy = new Proxy({}, { get(_, key) { console.log("genericProxy", key); return new Proxy({}, { get(_2, key1) { console.log("genericProxy", key, key1); } }); } }); const dataAdapter = { watchModelTypes(typesAdded, typesUpdated) { typesAdded([{ columns: this.columnsForType("cell"), count: 1, name: "Cell", object: Cell }, { columns: this.columnsForType("merged-cell"), count: 1, name: "MergedCell", object: MergedCell }]); console.log("watchModelTypes", arguments, typesUpdated); }, columnsForType(item) { if (item === "cell") { let columns = [{ name: "id", desc: "Id" }, { name: "value", desc: "Value" }, { name: "name", desc: "Name" }]; return columns; } else { let columns = [{ name: "id", desc: "Id" }, { name: "isConst", desc: "Is Const" }, { name: "isRemoved", desc: "Is Destroyed" }, { name: "name", desc: "Name" }, { name: "value", desc: "Value" }]; return columns; } }, acceptsModelName: true, // @ts-expect-error getRecordFilterValues(item) { return { isNew: true, isModified: true, isClean: true }; }, getRecordColor(item) { if (item instanceof Cell) { return "red"; } else { if (item.isConst) { return "yellow"; } else if (item.isDestroyed) { return "gray"; } else { return "green"; } } }, getRecordColumnValues(item) { if (item instanceof Cell) { return { id: guidFor(item), value: item.value, name: item._debugName ?? "" }; } return { id: guidFor(item), isConst: item.isConst, isRemoved: item.isDestroyed, name: item._debugName ?? "", value: item.value }; }, getRecordSearchKeywords(item) { if (item instanceof Cell) { return [item.value, item._debugName ?? "", "cell"]; } else { return [item.value, item._debugName ?? "", "merged-cell"]; } }, toRecord(item) { const result = { object: item, columnValues: this.getRecordColumnValues(item), searchKeywords: this.getRecordSearchKeywords(item), filterValues: this.getRecordFilterValues(item), color: this.getRecordColor(item) }; return result; }, watchRecords(modelName, recordsAdded, recordsUpdated, recordsRemoved) { if (modelName === "Cell") { recordsAdded(getCells().map((c) => this.toRecord(c))); } else if (modelName === "MergedCell") { recordsAdded(getMergedCells().filter((c) => { return !c.isDestroyed; }).map((c) => this.toRecord(c))); } console.log("watchRecords", recordsUpdated, recordsRemoved); }, getFilters() { return [{ name: "isNew", desc: "New" }, { name: "isModified", desc: "Modified" }, { name: "isClean", desc: "Clean" }]; } }; let guid = 0; let guidObjects = /* @__PURE__ */ new WeakMap(); function guidFor(obj) { if (guidObjects.has(obj)) { return guidObjects.get(obj); } const id = String(++guid); guidObjects.set(obj, id); return id; } const router = { location: { formatURL(url) { return url; } }, router: { // _routerMicrolib getRoute(routeName) { return { controllerName: routeName }; }, recognizer: { names: { application: { segments: [{ type: 4, value: "" }, { type: 4, value: "" }], handlers: [{ handler: "application", names: [], shouldDecodes: [] }, { handler: "index", names: [], shouldDecodes: [] }] } } } }, get currentUrl() { return window.location.href; }, get currentPath() { return window.location.pathname; } }; function proxyFor(parentKeyName) { return new Proxy({}, { get(_, key) { console.log(parentKeyName, key); return proxyFor(`${parentKeyName}.${key}`); } }); } class EmberApplication { __registry__; application; constructor() { EmberApplication.apps.push(this); this.application = this; this.__registry__ = { resolver: { lookupDescription(name) { console.log("lookupDescription", name); return true; }, describe(name) { console.log("describe", name); } } }; } name = "GlimmerNext"; static apps = []; _super() { console.log("_super"); } static initializer(obj) { setTimeout(() => { obj.initialize(this.apps[0]); }, 100); } instanceInitializer(obj) { setTimeout(() => { obj.initialize({ // @ts-expect-error _lookupFactory(name) { return proxyFor(name); }, resolveRegistration(key) { return proxyFor(key); }, application: this, router, lookup(key) { if (key === "router:main") { return router; } else if (key === "data-adapter:main") { return dataAdapter; } console.log("lookup", key); return proxyFor(key); }, reopen(obj2) { Object.keys(obj2).forEach((key) => { this[key] = obj2[key]; }); } }); }, 10); } reopen(obj) { Object.keys(obj).forEach((key) => { this[key] = obj[key]; }); } didBecomeReady() { console.log("didBecomeReady"); } } class CoreObject { } class EmberObject { } class ObjectProxy { } class ArrayProxy { } class Service { } class EmberComponent { } class ComputedProperty { } const objectMeta = /* @__PURE__ */ new WeakMap(); const EmberProxy = new Proxy({}, { get(_, key) { if (key === "get") { return function() { debugger; }; } else if (key === "set") { return function() { debugger; }; } else if (key === "computed") { return proxyFor("Ember.computed"); } else if (key === "cacheFor") { return function(obj, key2) { return obj[key2]; }; } else if (key === "Debug") { return { // @ts-expect-error registerDeprecationHandler(fn) { }, isComputed: false // (0, _loader.emberSafeRequire)('@ember/-internals/metal') // descriptorForDecorator, // descriptorForProperty }; } else if (key === "inspect") { return inspect; } else if (key === "meta") { return function(obj) { if (objectMeta.has(obj)) { return objectMeta.get(obj); } objectMeta.set(obj, { _debugReferences: 0, peekDescriptors() { return false; }, forEachMixins() { }, forEachDescriptors() { } }); return objectMeta.get(obj); }; } else if (key === "ComputedProperty") { return ComputedProperty; } if (key === "Component") { return EmberComponent; } else if (key === "Service") { return Service; } else if (key === "ObjectProxy") { return ObjectProxy; } else if (key === "Object") { return EmberObject; } else if (key === "ArrayProxy") { return ArrayProxy; } else if (key === "PromiseProxyMixin") { return proxyFor("Ember.PromiseProxyMixin"); } else if (key === "Evented") { return proxyFor("Ember.Evented"); } else if (key === "Observable") { return proxyFor("Ember.Observable"); } else if (key === "Component") { return proxyFor("Ember.Component"); } else if (key === "NativeArray") { return proxyFor("Ember.NativeArray"); } else if (key === "MutableEnumerable") { return proxyFor("Ember.MutableEnumerable"); } else if (key === "MutableArray") { return proxyFor("Ember.MutableArray"); } else if (key === "CoreObject") { return CoreObject; } else if (key === "ControllerMixin") { return proxyFor("Ember.ControllerMixin"); } else if (key === "ActionHandler") { return proxyFor("Ember.ActionHandler"); } else if (key === "ENV") { return { ENABLE_OPTIONAL_FEATURES: false, EXTEND_PROTOTYPES: { Array: false, Function: false, String: false }, LOG_STACKTRACE_ON_DEPRECATION: true, LOG_VERSION: true, RAISE_ON_DEPRECATION: false, STRUCTURED_PROFILE: false, _APPLICATION_TEMPLATE_WRAPPER: false, _TEMPLATE_ONLY_GLIMMER_COMPONENTS: true, _DEBUG_RENDER_TREE: true, _JQUERY_INTEGRATION: false, _DEFAULT_ASYNC_OBSERVERS: true, _RERENDER_LOOP_LIMIT: 1e3, _DISABLE_PROPERTY_FALLBACK_DEPRECATION: false, EMBER_LOAD_HOOKS: {}, FEATURES: {} }; } else if (key === "_captureRenderTree") { let componentToRenderTree = function(component) { let childs = Array.from(CHILD.get(component[COMPONENT_ID_PROPERTY]) ?? /* @__PURE__ */ new Set()).map((el) => TREE.get(el)); if (childs.length === 0) { if (component instanceof IfCondition) { if (isArray$1(component.prevComponent)) { component.prevComponent.forEach((c) => { if (!c) { return; } if ($nodes in c) { childs.push(c.ctx); } }); } else { if (component.prevComponent && $nodes in component.prevComponent) { childs.push(component.prevComponent.ctx); } } } } let componentName = component.debugName || component.constructor.name || "(unknown)"; const hasArgs = component && $args in component; const hasDebugArgs = component && $_debug_args in component; const hasArgsOrDebugArgs = hasArgs || hasDebugArgs; const argsToHide = [$context]; const argsToAdd = []; const possibleBounds = component ? getBounds(component) : []; let bounds = null; if (possibleBounds.length === 1) { bounds = { firstNode: possibleBounds[0], lastNode: possibleBounds[0], parentElement: possibleBounds[0].parentNode }; } else if (possibleBounds.length > 1) { bounds = { firstNode: possibleBounds[0], lastNode: possibleBounds[possibleBounds.length - 1], parentElement: possibleBounds[0].parentNode }; } const children = (childs?.map((child) => componentToRenderTree(child)) ?? []).filter((el) => el !== null); component[RENDERED_NODES_PROPERTY].forEach((node, index) => { if ("attributes" in node && node.namespaceURI === NS_HTML) ; }); if (componentName.startsWith("UnstableChildWrapper") && children.length === 1) { return children[0]; } let allArgs = function() { if ($_debug_args in component) { return component[$_debug_args] ?? {}; } else { return component[$args] ?? {}; } }; const positional = []; if (componentName.startsWith("IfCondition")) { componentName = "if"; argsToHide.push("if"); positional.push(allArgs()["if"]); } else if (componentName.startsWith("AsyncListComponent")) { componentName = "each"; argsToAdd.push(["async", true]); argsToHide.push("list"); positional.push(allArgs()["list"].value); if (component instanceof AsyncListComponent) { const items = Array.from(component.keyMap.values()); items.forEach((el) => { if (Array.isArray(el)) { el.forEach((e) => { if (!("nodeType" in e)) { children.push(componentToRenderTree(e.ctx)); } }); } else { if (!("nodeType" in el)) { children.push(componentToRenderTree(el.ctx)); } } }); } } else if (componentName.startsWith("ListComponent")) { componentName = "each"; argsToHide.push("list"); positional.push(allArgs()["list"].value); if (component instanceof SyncListComponent) { const items = Array.from(component.keyM