diff --git a/module/dist/ai-ui.cjs b/module/dist/ai-ui.cjs index 90e2a0b..cc23f28 100644 --- a/module/dist/ai-ui.cjs +++ b/module/dist/ai-ui.cjs @@ -119,11 +119,10 @@ var asyncExtras = { } }; var extraKeys = [...Object.getOwnPropertySymbols(asyncExtras), ...Object.keys(asyncExtras)]; -function assignHidden(d, ...srcs) { - for (const s of srcs) { - for (const [k, pd] of Object.entries(Object.getOwnPropertyDescriptors(s))) { - Object.defineProperty(d, k, { ...pd, enumerable: false }); - } +function assignHidden(d, s) { + const keys = [...Object.getOwnPropertyNames(s), ...Object.getOwnPropertySymbols(s)]; + for (const k of keys) { + Object.defineProperty(d, k, { ...Object.getOwnPropertyDescriptor(s, k), enumerable: false }); } return d; } @@ -1523,4 +1522,4 @@ function getElementIdMap(node, ids) { } return ids; } -//# sourceMappingURL=data:application/json;base64,ewogICJ2ZXJzaW9uIjogMywKICAic291cmNlcyI6IFsiLi4vc3JjL2FpLXVpLnRzIiwgIi4uL3NyYy9kZWJ1Zy50cyIsICIuLi9zcmMvZGVmZXJyZWQudHMiLCAiLi4vc3JjL2l0ZXJhdG9ycy50cyIsICIuLi9zcmMvd2hlbi50cyJdLAogICJzb3VyY2VzQ29udGVudCI6IFsiaW1wb3J0IHsgaXNQcm9taXNlTGlrZSB9IGZyb20gJy4vZGVmZXJyZWQuanMnO1xuaW1wb3J0IHsgSWdub3JlLCBhc3luY0l0ZXJhdG9yLCBkZWZpbmVJdGVyYWJsZVByb3BlcnR5LCBpc0FzeW5jSXRlciwgaXNBc3luY0l0ZXJhdG9yIH0gZnJvbSAnLi9pdGVyYXRvcnMuanMnO1xuaW1wb3J0IHsgV2hlblBhcmFtZXRlcnMsIFdoZW5SZXR1cm4sIHdoZW4gfSBmcm9tICcuL3doZW4uanMnO1xuaW1wb3J0IHsgQ2hpbGRUYWdzLCBDb25zdHJ1Y3RlZCwgSW5zdGFuY2UsIE92ZXJyaWRlcywgVGFnQ3JlYXRvciwgVGFnQ3JlYXRvck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gICAgICAgdHJ5IHtcbiAgICAgICAgICAgICAgLy8gQ2hpbGROb2RlW10sIHNpbmNlIHdlIHRlc3RlZCAucGFyZW50Tm9kZVxuICAgICAgICAgICAgICBjb25zdCBtb3VudGVkID0gdC5maWx0ZXIoZSA9PiBlPy5wYXJlbnROb2RlICYmIGUuaXNDb25uZWN0ZWQpO1xuICAgICAgICAgICAgICBjb25zdCBuID0gbm90WWV0TW91bnRlZCA/IHQgOiBtb3VudGVkO1xuICAgICAgICAgICAgICBpZiAobW91bnRlZC5sZW5ndGgpIG5vdFlldE1vdW50ZWQgPSBmYWxzZTtcblxuICAgICAgICAgICAgICBpZiAoIW4ubGVuZ3RoIHx8IHQuZXZlcnkoZSA9PiByZW1vdmVkTm9kZXMoZSkpKSB7XG4gICAgICAgICAgICAgICAgLy8gV2UncmUgZG9uZSAtIHRlcm1pbmF0ZSB0aGUgc291cmNlIHF1aWV0bHkgKGllIHRoaXMgaXMgbm90IGFuIGV4Y2VwdGlvbiBhcyBpdCdzIGV4cGVjdGVkLCBidXQgd2UncmUgZG9uZSlcbiAgICAgICAgICAgICAgICB0ID0gW107XG4gICAgICAgICAgICAgICAgY29uc3QgbXNnID0gXCJFbGVtZW50KHMpIGhhdmUgYmVlbiByZW1vdmVkIGZyb20gdGhlIGRvY3VtZW50OiBcIiArIGluc2VydGlvblN0YWNrO1xuICAgICAgICAgICAgICAgIGFwLnJldHVybj8uKG5ldyBFcnJvcihtc2cpKTtcbiAgICAgICAgICAgICAgICByZXR1cm47XG4gICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgICBpZiAoREVCVUcgJiYgbm90WWV0TW91bnRlZCAmJiBjcmVhdGVkQXQgJiYgY3JlYXRlZEF0IDwgRGF0ZS5ub3coKSkge1xuICAgICAgICAgICAgICAgIGNyZWF0ZWRBdCA9IE51bWJlci5NQVhfU0FGRV9JTlRFR0VSO1xuICAgICAgICAgICAgICAgIGNvbnNvbGUud2FybihgQXN5bmMgZWxlbWVudCBub3Qgb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pZWRcbiAgICAgICAgICAgICAgICBpZiAoZGVjbGFyYXRpb24pIHtcbiAgICAgICAgICAgICAgICAgIGlmIChPYmplY3QuZ2V0UHJvdG90eXBlT2YodmFsdWUpID09PSBwbGFpbk9iamVjdFByb3RvdHlwZSB8fCAhT2JqZWN0LmdldFByb3RvdHlwZU9mKHZhbHVlKSkge1xuICAgICAgICAgICAgICAgICAgICAvLyBBIHBsYWluIG9iamVjdCBjYW4gYmUgZGVlcC1jb3BpZWQgYnkgZmllbGRcbiAgICAgICAgICAgICAgICAgICAgZGVlcERlZmluZShzcmNEZXNjLnZhbHVlID0ge30sIHZhbHVlKTtcbiAgICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAoQXJyYXkuaXNBcnJheSh2YWx1ZSkpIHtcbiAgICAgICAgICAgICAgICAgICAgLy8gQW4gYXJyYXkgY2FuIGJlIGRlZXAgY29waWVkIGJ5IGluZGV4XG4gICAgICAgICAgICAgICAgICAgIGRlZXBEZWZpbmUoc3JjRGVzYy52YWx1ZSA9IFtdLCB2YWx1ZSk7XG4gICAgICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICAvLyBPdGhlciBvYmplY3QgbGlrZSB0aGluZ3MgKHJlZ2V4cHMsIGRhdGVzLCBjbGFzc2VzLCBldGMpIGNhbid0IGJlIGRlZXAtY29waWVkIHJlbGlhYmx5XG4gICAgICAgICAgICAgICAgICAgIGNvbnNvbGUud2FybihgRGVjbGFyZWQgcHJvcGV0eSAnJHtrfScgaXMgbm90IGEgcGxhaW4gb2JqZWN0IGFuZCBtdXN0IGJlIGFzc2lnbmVkIGJ5IHJlZmVyZW5jZSwgcG9zc2libHkgcG9sbHV0aW5nIG90aGVyIGluc3RhbmNlcyBvZiB0aGlzIHRhZ2AsIGQsIHZhbHVlKTtcbiAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KGQsIGssIHNyY0Rlc2MpO1xuICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgIGlmICh2YWx1ZSBpbnN0YW5jZW9mIE5vZGUpIHtcbiAgICAgICAgICAgICAgICAgIGNvbnNvbGUuaW5mbyhcIkhhdmluZyBET00gTm9kZXMgYXMgcHJvcGVydGllcyBvZiBvdGhlciBET00gTm9kZXMgaXMgYSBiYWQgaWRlYSBhcyBpdCBtYWtlcyB0aGUgRE9NIHRyZWUgaW50byBhIGN5Y2xpYyBncmFwaC4gWW91IHNob3VsZCByZWZlcmVuY2Ugbm9kZXMgYnkgSUQgb3IgYXMgYSBjaGlsZFwiLCBrLCBsb2dOb2RlKHZhbHVlKSk7XG4gICAgICAgICAgICAgICAgICBkW2tdID0gdmFsdWU7XG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgIGlmIChkW2tdICE9PSB2YWx1ZSkge1xuICAgICAgICAgICAgICAgICAgICAvLyBOb3RlIC0gaWYgd2UncmUgY29weWluZyB0byBhbiBhcnJheSBvZiBkaWZmZXJlbnQgbGVuZ3RoXG4gICAgICAgICAgICAgICAgICAgIC8vIHdlJ3JlIGRlY291cGxpbmcgY29tbW9uIG9iamVjdCByZWZlcmVuY2VzLCBzbyB3ZSBuZWVkIGEgY2xlYW4gb2JqZWN0IHRvXG4gICAgICAgICAgICAgICAgICAgIC8vIGFzc2lnbiBpbnRvXG4gICAgICAgICAgICAgICAgICAgIGlmIChBcnJheS5pc0FycmF5KGRba10pICYmIGRba10ubGVuZ3RoICE9PSB2YWx1ZS5sZW5ndGgpIHtcbiAgICAgICAgICAgICAgICAgICAgICBpZiAodmFsdWUuY29uc3RydWN0b3IgPT09IE9iamVjdCB8fCB2YWx1ZS5jb25zdHJ1Y3RvciA9PT0gQXJyYXkpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGRlZXBEZWZpbmUoZFtrXSA9IG5ldyAodmFsdWUuY29uc3RydWN0b3IpLCB2YWx1ZSk7XG4gICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIC8vIFRoaXMgaXMgc29tZSBzb3J0IG9mIGNvbnN0cnVjdGVkIG9iamVjdCwgd2hpY2ggd2UgY2FuJ3QgY2xvbmUsIHNvIHdlIGhhdmUgdG8gY29weSBieSByZWZlcmVuY2VcbiAgICAgICAgICAgICAgICAgICAgICAgIGRba10gPSB2YWx1ZTtcbiAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgICAgLy8gVGhpcyBpcyBqdXN0IGEgcmVndWxhciBvYmplY3QsIHNvIHdlIGRlZXBEZWZpbmUgcmVjdXJzaXZlbHlcbiAgICAgICAgICAgICAgICAgICAgICBkZWVwRGVmaW5lKGRba10sIHZhbHVlKTtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgLy8gVGhpcyBpcyBqdXN0IGEgcHJpbWl0aXZlIHZhbHVlLCBvciBhIFByb21pc2VcbiAgICAgICAgICAgICAgaWYgKHNba10gIT09IHVuZGVmaW5lZClcbiAgICAgICAgICAgICAgICBkW2tdID0gc1trXTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICB9XG4gICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgLy8gQ29weSB0aGUgZGVmaW5pdGlvbiBvZiB0aGUgZ2V0dGVyL3NldHRlclxuICAgICAgICAgIE9iamVjdC5kZWZpbmVQcm9wZXJ0eShkLCBrLCBzcmNEZXNjKTtcbiAgICAgICAgfVxuICAgICAgfSBjYXRjaCAoZXg6IHVua25vd24pIHtcbiAgICAgICAgY29uc29sZS53YXJuKCBcImRlZXBBc3NpZ25cIiwgaywgc1trXSwgZXgpO1x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iAoJ3ZhbHVlJyBpbiBkZXNjKSByZXR1cm4gLTE7XG4gICAgICAgICAgICAgIGlmICgnc2V0JyBpbiBkZXNjKSByZXR1cm4gMTtcbiAgICAgICAgICAgICAgaWYgKCdnZXQnIGluIGRlc2MpIHJldHVybiAwLjU7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICByZXR1cm4gMDtcbiAgICAgICAgICB9KTtcbiAgICAgICAgfVxuICAgICAgICBmb3IgKGNvbnN0IFtrLCBzcmNEZXNjXSBvZiBzb3VyY2VFbnRyaWVzKSB7XG4gICAgICAgICAgdHJ5IHtcbiAgICAgICAgICAgIGlmICgndmFsdWUnIGluIHNyY0Rlc2MpIHtcbiAgICAgICAgICAgICAgY29uc3QgdmFsdWUgPSBzcmNEZXNjLnZhbHVlO1xuICAgICAgICAgICAgICBpZiAoaXNBc3luY0l0ZXI8dW5rbm93bj4odmFsdWUpKSB7XG4gICAgICAgICAgICAgICAgYXNzaWduSXRlcmFibGUodmFsdWUsIGspO1xuICAgICAgICAgICAgICB9IGVsc2UgaWYgKGlzUHJvbWlzZUxpa2UodmFsdWUpKSB7XG4gICAgICAgICAgICAgICAgdmFsdWUudGhlbih2ID0+IHtcbiAgICAgICAgICAgICAgICAgIGlmICh2ICYmIHR5cGVvZiB2ID09PSAnb2JqZWN0Jykge1xuICAgICAgICAgICAgICAgICAgICAvLyBTcGVjaWFsIGNhc2U6IHRoaXMgcHJvbWlzZSByZXNvbHZlZCB0byBhbiBhc3luYyBpdGVyYXRvclxuICAgICAgICAgICAgICAgICAgICBpZiAoaXNBc3luY0l0ZXI8dW5rbm93bj4odikpIHtcbiAgICAgICAgICAgICAgICAgICAgICBhc3NpZ25JdGVyYWJsZSh2LCBrKTtcbiAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgICBhc3NpZ25PYmplY3Qodiwgayk7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgIGlmIChzW2tdICE9PSB1bmRlZmluZWQpXG4gICAgICAgICAgICAgICAgICAgICAgZFtrXSA9IHY7XG4gICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfSwgZXJyb3IgPT4gY29uc29sZS5sb2coXCJGYWlsZWQgdG8gc2V0IGF0dHJpYnV0ZVwiLCBlcnJvcikpO1xuICAgICAgICAgICAgICB9IGVsc2UgaWYgKCFpc0FzeW5jSXRlcjx1bmtub3duPih2YWx1ZSkpIHtcbiAgICAgICAgICAgICAgICAvLyBUaGlzIGhhcyBhIHJlYWwgdmFsdWUsIHdoaWNoIG1pZ2h0IGJlIGFuIG9iamVjdFxuICAgICAgICAgICAgICAgIGlmICh2YWx1ZSAmJiB0eXBlb2YgdmFsdWUgPT09ICdvYmplY3QnICYmICFpc1Byb21pc2VMaWtlKHZhbHVlKSlcbiAgICAgICAgICAgICAgICAgIGFzc2lnbk9iamVjdCh2YWx1ZSwgayk7XG4gICAgICAgICAgICAgICAgZWxzZSB7XG4gICAgICAgICAgICAgICAgICBpZiAoc1trXSAhPT0gdW5kZWZpbmVkKVxuICAgICAgICAgICAgICAgICAgICBkW2tdID0gc1trXTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgIC8vIENvcHkgdGhlIGRlZmluaXRpb24gb2YgdGhlIGdldHRlci9zZXR0ZXJcbiAgICAgICAgICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KGQsIGssIHNyY0Rlc2MpO1xuICAgICAgICAgICAgfVxuICAgICAgICAgIH0gY2F0Y2ggKGV4OiB1bmtub3duKSB7XG4gICAgICAgICAgICBjb25zb2xlLndhcm4oIFwiYXNzaWduUHJvcHNcIiwgaywgc1trXSwgZXgpO1xuICAgICAgICAgICAgdGhyb3cgZXg7XG4gICAgICAgICAgfVxuICAgICAgICB9XG5cbiAgICAgICA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5sZXNzIGl0J3MgdW5kZWZpbmVkXG4gICAgICAgICAgICAgICAgaWYgKHZhbHVlICE9PSB1bmRlZmluZWQpXG4gICAgICAgICAgICAgICAgICBkW2tdID0gdmFsdWU7XG4gICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgY29uc3QgbW91bnRlZCA9IGJhc2UuaXNDb25uZWN0ZWQ7XG4gICAgICAgICAgICAgIC8vIElmIHdlIGhhdmUgYmVlbiBtb3VudGVkIGJlZm9yZSwgYml0IGFyZW4ndCBub3csIHJlbW92ZSB0aGUgY29uc3VtZXJcbiAgICAgICAgICAgICAgaWYgKHJlbW92ZWROb2RlcyhiYXNlKSB8fCAoIW5vdFlldE1vdW50ZWQgJiYgIW1vdW50ZWQpKSB7XG4gICAgICAgICAgICAgICAgY29uc29sZS5pbmZvKGBFbGVtZW50IGRvZXMgbm90IGV4aXN0IGluIGRvY3VtZW50IHdoZW4gc2V0dGluZyBhc3luYyBhdHRyaWJ1dGUgJyR7a30nIHRvOlxcbiR7bG9nTm9kZShiYXNlKX1gKTtcbiAgICAgICAgICAgICAgICBhcC5yZXR1cm4/LigpO1xuICAgICAgICAgICAgICAgIHJldHVybjtcbiAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICBpZiAobW91bnRlZCkgbm90WWV0TW91bnRlZCA9IGZhbHNlO1xuICAgICAgICAgICAgICBpZiAobm90WWV0TW91bnRlZCAmJiBjcmVhdGVkQXQgJiYgY3JlYXRlZEF0IDwgRGF0ZS5ub3coKSkge1xuICAgICAgICAgICAgICAgIGNyZWF0ZWRBdCA9IE51bWJlci5NQVhfU0FGRV9JTlRFR0VSO1xuICAgICAgICAgICAgICAgIGNvbnNvbGUud2FybihgRWxlbWVudCB3aXRoIGFzeW5jIGF0dHJpYnV0ZSAnJHtrfScgbm90IG1vdW50ZWQgYWZ0ZXIgNSBzZWNvbmRzLiBJZiBpdCBpcyBuZXZlciBtb3VudGVkLCBpdCB3aWxsIGxlYWsuXFxuRWxlbWVudCB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U7XG4gICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgIC8vIE5vdGUgLSBpZiB3ZSdyZSBjb3B5aW5nIHRvIG91cnNlbGYgKG9yIGFuIGFycmF5IG9mIGRpZmZlcmVudCBsZW5ndGgpLFxuICAgICAgICAgICAgLy8gd2UncmUgZGVjb3VwbGluZyBjb21tb24gb2JqZWN0IHJlZmVyZW5jZXMsIHNvIHdlIG5lZWQgYSBjbGVhbiBvYmplY3QgdG9cbiAgICAgICAgICAgIC8vIGFzc2lnbiBpbnRvXG4gICAgICAgICAgICBpZiAoIShrIGluIGQpIHx8IGRba10gPT09IHZhbHVlIHx8IChBcnJheS5pc0FycmF5KGRba10pICYmIGRba10ubGVuZ3RoICE9PSB2YWx1ZS5sZW5ndGgpKSB7XG4gICAgICAgICAgICAgIGlmICh2YWx1ZS5jb25zdHJ1Y3RvciA9PT0gT2JqZWN0IHx8IHZhbHVlLmNvbnN0cnVjdG9yID09PSBBcnJheSkge1xuICAgICAgICAgICAgICAgIGNvbnN0IGNvcHkgPSBuZXcgKHZhbHVlLmNvbnN0cnVjdG9yKTtcbiAgICAgICAgICAgICAgICBhc3NpZ24oY29weSwgdmFsdWUpO1xuICAgICAgICAgICAgICAgIGRba10gPSBjb3B5O1xuICAgICAgICAgICAgICAgIC8vYXNzaWduKGRba10sIHZhbHVlKTtcbiAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAvLyBUaGlzIGlzIHNvbWUgc29ydCBvZiBjb25zdHJ1Y3RlZCBvYmplY3QsIHdoaWNoIHdlIGNhbid0IGNsb25lLCBzbyB3ZSBoYXZlIHRvIGNvcHkgYnkgcmVmZXJlbmNlXG4gICAgICAgICAgICAgICAgZFtrXSA9IHZhbHVlO1xuICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICBpZiAoT2JqZWN0LmdldE93blByb3BlcnR5RGVzY3JpcHRvcihkLCBrKT8uc2V0KVxu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ZXJ0aWVzKGJveGVkT2JqZWN0LCBwZHMpO1xuICAgICAgICAgICAgcmV0dXJuIGJveGVkT2JqZWN0O1xuICAgICAgICAgIH1cblxuICAgICAgICAgIC8vIFByb3h5IHRoZSByZXN1bHQgc28gd2UgY2FuIHRyYWNrIG1lbWJlcnMgb2YgdGhlIGl0ZXJhYmxlIG9iamVjdFxuICAgICAgICAgIGNvbnN0IGV4dHJhQm94ZWQ6IHR5cGVvZiBib3hlZE9iamVjdCA9IG5ldyBQcm94eShib3hlZE9iamVjdCwge1xuICAgICAgICAgICAgZGVsZXRlUHJvcGVydHkodGFyZ2V0LCBrZXkpIHtcbiAgICAgICAgICAgICAgaWYgKFJlZmxlY3QuZGVsZXRlUHJvcGVydHkodGFyZ2V0LCBrZXkpKSB7XG4gICAgICAgICAgICAgICAgLy8gQHRzLWlnbm9yZSAtIEZpeFxuICAgICAgICAgICAgICAgIHB1c2gob2JqW25hbWVdKTtcbiAgICAgICAgICAgICAgICByZXR1cm4gdHJ1ZTtcbiAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICByZXR1cm4gZmFsc2U7XG4gICAgICAgICAgICB9LFxuICAgICAgICAgICAgLy8gSW1wbGVtZW50IHRoZSBsb2dpYyB0aGF0IGZpcmVzIHRoZSBpdGVyYXRvciBieSByZS1hc3NpZ25pbmcgdGhlIGl0ZXJhYmxlIHZpYSBpdCdzIHNldHRlclxuICAgICAgICAgICAgc2V0KHRhcmdldCwga2V5LCB2YWx1ZSwgcmVjZWl2ZXIpIHtcbiAgICAgICAgICAgICAgaWYgKFJlZmxlY3Quc2V0KHRhcmdldCwga2V5LCB2YWx1ZSwgcmVjZWl2ZXIpKSB7XG4gICAgICAgICAgICAgICAgLy8gQHRzLWlnbm9yZSAtIEZpeFxuICAgICAgICAgICAgICAgIHB1c2gob2JqW25hbWVdKTtcbiAgICAgICAgICAgICAgICByZXR1cm4gdHJ1ZTtcbiAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICByZXR1cm4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RlZmluZWQpIHtcbiAgICAgICAgICAgICAgICAgIC8vIEB0cy1pZ25vcmUgLSBGaXg6IHRoaXMgXCJyZWRlZmluZXNcIiBWIGFzIGhhdmluZyBhbiBvcHRpb25hbCBtZW1iZXIgY2FsbGVkIGBrZXlgXG4gICAgICAgICAgICAgICAgICB0YXJnZXRba2V5XSA9IHVuZGVmaW5lZDtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgY29uc3QgcmVhbFZhbHVlID0gUmVmbGVjdC5nZXQoYm94ZWRPYmplY3QgYXMgRXhjbHVkZTx0eXBlb2YgYm94ZWRPYmplY3QsIHR5cGVvZiBJZ25vcmU+LCBrZXksIHJlY2VpdmVyKTtcbiAgICAgICAgICAgICAgICBjb25zdCBwcm9wcyA9IE9iamVjdC5nZXRPd25Qcm9wZXJ0eURlc2NyaXB0b3JzKFxuICAgICAgICAgICAgICAgICAgICBib3hlZE9iamVjdC5tYXAoKG8scCkgPT4ge1xuICAgICAgICAgICAgICAgICAgICBjb25zdCBvdiA9IG8/LltrZXkgYXMga2V5b2YgdHlwZW9mIG9dPy52YWx1ZU9mKCk7XG4gICAgICAgICAgICAgICAgICAgIGNvbnN0IHB2ID0gcD8udmFsdWVPZigpO1xuICAgICAgICAgICAgICAgICAgICBpZiAodHlwZW9mIG92ID09PSB0eXBlb2YgcHYgJiYgb3YgPT0gcHYpXG4gICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIElnbm9yZTtcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG92O1xuICAgICAgICAgICAgICAgICAgfSlcbiAgICAgICAgICAgICAgICApO1xuICAgICAgICAgICAgICAgIChSZWZsZWN0Lm93bktleXMocHJvcHMpIGFzIChrZXlvZiB0eXBlb2YgcHJvcHMpW10pLmZvckVhY2goayA9PiBwcm9wc1trXS5lbnVtZXJhYmxlID0gZmFsc2UpO1xuICAgICAgICAgICAgICAgIGNvbnN0IGFpYiA9IGJveChyZWFsVmFsdWUsIHByb3BzK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AgIGlmIChzZWxlY3Rvcikge1xuICAgICAgICAgICAgICBjb25zdCBub2RlcyA9IGNvbnRhaW5lci5xdWVyeVNlbGVjdG9yQWxsKHNlbGVjdG9yKTtcbiAgICAgICAgICAgICAgZm9yIChjb25zdCBuIG9mIG5vZGVzKSB7XG4gICAgICAgICAgICAgICAgaWYgKChldi50YXJnZXQgPT09IG4gfHwgbi5jb250YWlucyhldi50YXJnZXQpKSAmJiBjb250YWluZXIuY29udGFpbnMobikpXG4gICAgICAgICAgICAgICAgICBwdXNoKGV2KVxuICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICBpZiAoKGV2LnRhcmdldCA9PT0gY29udGFpbmVyIHx8IGNvbnRhaW5lci5jb250YWlucyhldi50YXJnZXQpKSlcbiAgICAgICAgICAgICAgICBwdXNoKGV2KVxuICAgICAgICAgICAgfVxuICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgfSBjYXRjaCAoZXgpIHtcbiAgICAgICAgY29uc29sZS53YXJuKCdkb2NFdmVudEhhbmRsZXInLCBleCk7XG4gICAgICB9XG4gICAgfVxuICB9XG59XG5cbmZ1bmN0aW9uIGlzQ1NTU2VsZWN0b3Ioczogc3RyaW5nKTogcyBpcyBDU1NJZGVudGlmaWVyIHtcbiAgcmV0dXJuIEJvb2xlYW4ocyAmJiAocy5zdGFydHNXaXRoKCcjJykgfHwgcy5zdGFydHNXaXRoKCcuJykgfHwgKHMuc3RhcnRzV2l0aCgnWycpICYmIHMuZW5kc1dpdGgoJ10nKSkpKTtcbn1cblxuZnVuY3Rpb24gcGFyc2VXaGVuU2VsZWN0b3I8RXZlbnROYW1lIGV4dGVuZHMgc3RyaW5nPih3aGF0OiBJc1ZhbGlkV2hlblNlbGVjdG9yPEV2ZW50TmFtZT4pOiB1bmRlZmluZWQgfCBbQ1NTSWRlbnRpZmllciB8IG51bGwsIGtleW9mIEdsb2JhbEV2ZW50SGFuZGxlcnNFdmVudE1hc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RUYWdzPikgPT4ge1xuICAgICAgICAgIGlmICghZXMuZG9uZSkge1xuICAgICAgICAgICAgdHJ5IHtcbiAgICAgICAgICAgICAgLy8gQ2hpbGROb2RlW10sIHNpbmNlIHdlIHRlc3RlZCAucGFyZW50Tm9kZVxuICAgICAgICAgICAgICBjb25zdCBtb3VudGVkID0gdC5maWx0ZXIoZSA9PiBlPy5wYXJlbnROb2RlICYmIGUuaXNDb25uZWN0ZWQpO1xuICAgICAgICAgICAgICBjb25zdCBuID0gbm90WWV0TW91bnRlZCA/IHQgOiBtb3VudGVkO1xuICAgICAgICAgICAgICBpZiAobW91bnRlZC5sZW5ndGgpIG5vdFlldE1vdW50ZWQgPSBmYWxzZTtcblxuICAgICAgICAgICAgICBpZiAoIW4ubGVuZ3RoIHx8IHQuZXZlcnkoZSA9PiByZW1vdmVkTm9kZXMoZSkpKSB7XG4gICAgICAgICAgICAgICAgLy8gV2UncmUgZG9uZSAtIHRlcm1pbmF0ZSB0aGUgc291cmNlIHF1aWV0bHkgKGllIHRoaXMgaXMgbm90IGFuIGV4Y2VwdGlvbiBhcyBpdCdzIGV4cGVjdGVkLCBidXQgd2UncmUgZG9uZSlcbiAgICAgICAgICAgICAgICB0ID0gW107XG4gICAgICAgICAgICAgICAgY29uc3QgbXNnID0gXCJFbGVtZW50KHMpIGhhdmUgYmVlbiByZW1vdmVkIGZyb20gdGhlIGRvY3VtZW50OiBcIiArIGluc2VydGlvblN0YWNrO1xuICAgICAgICAgICAgICAgIGFwLnJldHVybj8uKG5ldyBFcnJvcihtc2cpKTtcbiAgICAgICAgICAgICAgICByZXR1cm47XG4gICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgICBpZiAoREVCVUcgJiYgbm90WWV0TW91bnRlZCAmJiBjcmVhdGVkQXQgJiYgY3JlYXRlZEF0IDwgRGF0ZS5ub3coKSkge1xuICAgICAgICAgICAgICAgIGNyZWF0ZWRBdCA9IE51bWJlci5NQVhfU0FGRV9JTlRFR0VSO1xuICAg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HR5cGVcbiAgICAgICAgICAgICAgICAvLyB3aGljaCBjYW4ndCBiZSBjb3BpZWRcbiAgICAgICAgICAgICAgICBpZiAoZGVjbGFyYXRpb24pIHtcbiAgICAgICAgICAgICAgICAgIGlmIChPYmplY3QuZ2V0UHJvdG90eXBlT2YodmFsdWUpID09PSBwbGFpbk9iamVjdFByb3RvdHlwZSB8fCAhT2JqZWN0LmdldFByb3RvdHlwZU9mKHZhbHVlKSkge1xuICAgICAgICAgICAgICAgICAgICAvLyBBIHBsYWluIG9iamVjdCBjYW4gYmUgZGVlcC1jb3BpZWQgYnkgZmllbGRcbiAgICAgICAgICAgICAgICAgICAgZGVlcERlZmluZShzcmNEZXNjLnZhbHVlID0ge30sIHZhbHVlKTtcbiAgICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAoQXJyYXkuaXNBcnJheSh2YWx1ZSkpIHtcbiAgICAgICAgICAgICAgICAgICAgLy8gQW4gYXJyYXkgY2FuIGJlIGRlZXAgY29waWVkIGJ5IGluZGV4XG4gICAgICAgICAgICAgICAgICAgIGRlZXBEZWZpbmUoc3JjRGVzYy52YWx1ZSA9IFtdLCB2YWx1ZSk7XG4gICAgICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICAvLyBPdGhlciBvYmplY3QgbGlrZSB0aGluZ3MgKHJlZ2V4cHMsIGRhdGVzLCBjbGFzc2VzLCBldGMpIGNhbid0IGJlIGRlZXAtY29waWVkIHJlbGlhYmx5XG4gICAgICAgICAgICAgICAgICAgIGNvbnNvbGUud2FybihgRGVjbGFyZWQgcHJvcGV0eSAnJHtrfScgaXMgbm90IGEgcGxhaW4gb2JqZWN0IGFuZCBtdXN0IGJlIGFzc2lnbmVkIGJ5IHJlZmVyZW5jZSwgcG9zc2libHkgcG9sbHV0aW5nIG90aGVyIGluc3RhbmNlcyBvZiB0aGlzIHRhZ2AsIGQsIHZhbHVlKTtcbiAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KGQsIGssIHNyY0Rlc2MpO1xuICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgIGlmICh2YWx1ZSBpbnN0YW5jZW9mIE5vZGUpIHtcbiAgICAgICAgICAgICAgICAgIGNvbnNvbGUuaW5mbyhcIkhhdmluZyBET00gTm9kZXMgYXMgcHJvcGVydGllcyBvZiBvdGhlciBET00gTm9kZXMgaXMgYSBiYWQgaWRlYSBhcyBpdCBtYWtlcyB0aGUgRE9NIHRyZWUgaW50byBhIGN5Y2xpYyBncmFwaC4gWW91IHNob3VsZCByZWZlcmVuY2Ugbm9kZXMgYnkgSUQgb3IgYXMgYSBjaGlsZFwiLCBrLCBsb2dOb2RlKHZhbHVlKSk7XG4gICAgICAgICAgICAgICAgICBkW2tdID0gdmFsdWU7XG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgIGlmIChkW2tdICE9PSB2YWx1ZSkge1xuICAgICAgICAgICAgICAgICAgICAvLyBOb3RlIC0gaWYgd2UncmUgY29weWluZyB0byBhbiBhcnJheSBvZiBkaWZmZXJlbnQgbGVuZ3RoXG4gICAgICAgICAgICAgICAgICAgIC8vIHdlJ3JlIGRlY291cGxpbmcgY29tbW9uIG9iamVjdCByZWZlcmVuY2VzLCBzbyB3ZSBuZWVkIGEgY2xlYW4gb2JqZWN0IHRvXG4gICAgICAgICAgICAgICAgICAgIC8vIGFzc2lnbiBpbnRvXG4gICAgICAgICAgICAgICAgICAgIGlmIChBcnJheS5pc0FycmF5KGRba10pICYmIGRba10ubGVuZ3RoICE9PSB2YWx1ZS5sZW5ndGgpIHtcbiAgICAgICAgICAgICAgICAgICAgICBpZiAodmFsdWUuY29uc3RydWN0b3IgPT09IE9iamVjdCB8fCB2YWx1ZS5jb25zdHJ1Y3RvciA9PT0gQXJyYXkpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGRlZXBEZWZpbmUoZFtrXSA9IG5ldyAodmFsdWUuY29uc3RydWN0b3IpLCB2YWx1ZSk7XG4gICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIC8vIFRoaXMgaXMgc29tZSBzb3J0IG9mIGNvbnN0cnVjdGVkIG9iamVjdCwgd2hpY2ggd2UgY2FuJ3QgY2xvbmUsIHNvIHdlIGhhdmUgdG8gY29weSBieSByZWZlcmVuY2VcbiAgICAgICAgICAgICAgICAgICAgICAgIGRba10gPSB2YWx1ZTtcbiAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgICAgLy8gVGhpcyBpcyBqdXN0IGEgcmVndWxhciBvYmplY3QsIHNvIHdlIGRlZXBEZWZpbmUgcmVjdXJzaXZlbHlcbiAgICAgICAgICAgICAgICAgICAgICBkZWVwRGVmaW5lKGRba10sIHZhbHVlKTtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgLy8gVGhpcyBpcyBqdXN0IGEgcHJpbWl0aXZlIHZhbHVlLCBvciBhIFByb21pc2VcbiAgICAgICAgICAgICAgaWYgKHNba10gIT09IHVuZGVmaW5lZClcbiAgICAgICAgICAgICAgICBkW2tdID0gc1trXTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICB9XG4gICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgLy8gQ29weSB0aGUgZGVmaW5pdGlvbiBvZiB0aGUgZ2V0dGVyL3NldHRlclxuICAgICAgICAgIE9iamVjdC5kZWZpbmVQcm9wZXJ0eShkLCBrLCBzcmNEZXNjKTtcbiAgICAgICAgfVxuICAgICAgfSBjYXRjaCAoZXg6IHVua25vd24pIHtcbiAgICAgICAgY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VswXSk7XG4gICAgICAgICAgICBpZiAoZGVzYykge1xuICAgICAgICAgICAgICBpZiAoJ3ZhbHVlJyBpbiBkZXNjKSByZXR1cm4gLTE7XG4gICAgICAgICAgICAgIGlmICgnc2V0JyBpbiBkZXNjKSByZXR1cm4gMTtcbiAgICAgICAgICAgICAgaWYgKCdnZXQnIGluIGRlc2MpIHJldHVybiAwLjU7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICByZXR1cm4gMDtcbiAgICAgICAgICB9KTtcbiAgICAgICAgfVxuICAgICAgICBmb3IgKGNvbnN0IFtrLCBzcmNEZXNjXSBvZiBzb3VyY2VFbnRyaWVzKSB7XG4gICAgICAgICAgdHJ5IHtcbiAgICAgICAgICAgIGlmICgndmFsdWUnIGluIHNyY0Rlc2MpIHtcbiAgICAgICAgICAgICAgY29uc3QgdmFsdWUgPSBzcmNEZXNjLnZhbHVlO1xuICAgICAgICAgICAgICBpZiAoaXNBc3luY0l0ZXI8dW5rbm93bj4odmFsdWUpKSB7XG4gICAgICAgICAgICAgICAgYXNzaWduSXRlcmFibGUodmFsdWUsIGspO1xuICAgICAgICAgICAgICB9IGVsc2UgaWYgKGlzUHJvbWlzZUxpa2UodmFsdWUpKSB7XG4gICAgICAgICAgICAgICAgdmFsdWUudGhlbih2ID0+IHtcbiAgICAgICAgICAgICAgICAgIGlmICh2ICYmIHR5cGVvZiB2ID09PSAnb2JqZWN0Jykge1xuICAgICAgICAgICAgICAgICAgICAvLyBTcGVjaWFsIGNhc2U6IHRoaXMgcHJvbWlzZSByZXNvbHZlZCB0byBhbiBhc3luYyBpdGVyYXRvclxuICAgICAgICAgICAgICAgICAgICBpZiAoaXNBc3luY0l0ZXI8dW5rbm93bj4odikpIHtcbiAgICAgICAgICAgICAgICAgICAgICBhc3NpZ25JdGVyYWJsZSh2LCBrKTtcbiAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgICBhc3NpZ25PYmplY3Qodiwgayk7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgIGlmIChzW2tdICE9PSB1bmRlZmluZWQpXG4gICAgICAgICAgICAgICAgICAgICAgZFtrXSA9IHY7XG4gICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfSwgZXJyb3IgPT4gY29uc29sZS5sb2coXCJGYWlsZWQgdG8gc2V0IGF0dHJpYnV0ZVwiLCBlcnJvcikpO1xuICAgICAgICAgICAgICB9IGVsc2UgaWYgKCFpc0FzeW5jSXRlcjx1bmtub3duPih2YWx1ZSkpIHtcbiAgICAgICAgICAgICAgICAvLyBUaGlzIGhhcyBhIHJlYWwgdmFsdWUsIHdoaWNoIG1pZ2h0IGJlIGFuIG9iamVjdFxuICAgICAgICAgICAgICAgIGlmICh2YWx1ZSAmJiB0eXBlb2YgdmFsdWUgPT09ICdvYmplY3QnICYmICFpc1Byb21pc2VMaWtlKHZhbHVlKSlcbiAgICAgICAgICAgICAgICAgIGFzc2lnbk9iamVjdCh2YWx1ZSwgayk7XG4gICAgICAgICAgICAgICAgZWxzZSB7XG4gICAgICAgICAgICAgICAgICBpZiAoc1trXSAhPT0gdW5kZWZpbmVkKVxuICAgICAgICAgICAgICAgICAgICBkW2tdID0gc1trXTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgIC8vIENvcHkgdGhlIGRlZmluaXRpb24gb2YgdGhlIGdldHRlci9zZXR0ZXJcbiAgICAgICAgICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KGQsIGssIHNyY0Rlc2MpO1xuICAgICAgICAgICAgfVxuICAgICAgICAgIH0gY2F0Y2ggKGV4OiB1bmtub3duKSB7XG4gICAgICAgICAgICBjb25zb2xlLndhcm4oIFwiYXNzaWduUHJvcHNcIiwgaywgc1trXSwgZXgpO1xuICAgICAgICAgICAgdGhyb3cgZXg7XG4gICAgICAgICAgfVxuICAgICAgICB9XG5cbiAgICAgICAgZnVuY3Rpb24gYXNzaWduSXRlcmFibGUodmFsdWU6IEFzeW5jSXRlcmFibGU8dW5rbm93bj4gfCBBc3luY0l0ZXJhdG9yPHVua25vd24sIGFueSwgdW5kZWZpbmVkPiwgazogc3RyaW5nKSB7XG4gICAgICAgICAgY29uc3QgYXAgPSBhc3luY0l0ZXJhdG9yKHZhbHVlKTtcbiAgICAgICAgICBsZXQgbm90WWV0TW91bnRlZCA9IHRydWU7XG4gICAgICAgICAgLy8gREVCVUcgc3VwcG9ydFxuICAgICAgICAgIGxldCBjcmVhdGVkQXQgPSBEYXRlLm5vdygpICsgdGltZU91dFdhcm47XG4gICAgICAgICAgY29uc3QgY3JlYXRlZEJ5ID0gREVCVUcgJiYgbmV3IEVycm9yKFwiQ3JlYXRlZCBieVwiKS5zdGFjaztcbiAgICAgICAgICBjb25zdCB1cGRhdGUgPSAoZXM6IEl0ZXJhdG9yUmVzdWx0PHVua25vd24+KSA9PiB7XG4gICAgICAgICAgICBpZiAoIWVzLmRvbmUpIHtcbiAgICAgICAgICAgICAgY29uc3QgdmFsdWUgPSB1bmJveChlcy52YWx1ZSk7XG4gICAgICAgICAgICAgIGlmICh0eXBlb2YgdmFsdWUgPT09ICdvYmplY3QnICYmIHZhbHVlICE9PSBudWxsKSB7XG4gICAgICAgICAgICAgICAgICAvKlxuICAgICAgICAgICAgICAgIFRISVMgSVMgSlVTVCBBIEhBQ0s6IGBzdHlsZWAgaGFzIHRvIGJlIHNldCBtZW1iZXIgYnkgbWVtYmVyLCBlZzpcbiAgICAgICAgICAgICAgICAgIGUuc3R5bGUuY29sb3IgPSAnYmx1ZScgICAgICAgIC0tLSB3b3Jrc1xuICAgICAgICAgICAgICAgICAgZS5zdHlsZSA9IHsgY29sb3I6ICdibHVlJyB9ICAgLS0tIGRvZXNuJ3Qgd29ya1xuICAgICAgICAgICAgICAgIHdoZXJlYXMgaW4gZ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IG9iamVjdCAob3IgaXMgbnVsbCkgLSBqdXN0IGFzc2lnbiBpdCwgdW5sZXNzIGl0J3MgdW5kZWZpbmVkXG4gICAgICAgICAgICAgICAgaWYgKHZhbHVlICE9PSB1bmRlZmluZWQpXG4gICAgICAgICAgICAgICAgICBkW2tdID0gdmFsdWU7XG4gICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgY29uc3QgbW91bnRlZCA9IGJhc2UuaXNDb25uZWN0ZWQ7XG4gICAgICAgICAgICAgIC8vIElmIHdlIGhhdmUgYmVlbiBtb3VudGVkIGJlZm9yZSwgYml0IGFyZW4ndCBub3csIHJlbW92ZSB0aGUgY29uc3VtZXJcbiAgICAgICAgICAgICAgaWYgKHJlbW92ZWROb2RlcyhiYXNlKSB8fCAoIW5vdFlldE1vdW50ZWQgJiYgIW1vdW50ZWQpKSB7XG4gICAgICAgICAgICAgICAgY29uc29sZS5pbmZvKGBFbGVtZW50IGRvZXMgbm90IGV4aXN0IGluIGRvY3VtZW50IHdoZW4gc2V0dGluZyBhc3luYyBhdHRyaWJ1dGUgJyR7a30nIHRvOlxcbiR7bG9nTm9kZShiYXNlKX1gKTtcbiAgICAgICAgICAgICAgICBhcC5yZXR1cm4/LigpO1xuICAgICAgICAgICAgICAgIHJldHVybjtcbiAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICBpZiAobW91bnRlZCkgbm90WWV0TW91bnRlZCA9IGZhbHNlO1xuICAgICAgICAgICAgICBpZiAobm90WWV0TW91bnRlZCAmJiBjcmVhdGVkQXQgJiYgY3JlYXRlZEF0IDwgRGF0ZS5ub3coKSkge1xuICAgICAgICAgICAgICAgIGNyZWF0ZWRBdCA9IE51bWJlci5NQVhfU0FGRV9JTlRFR0VSO1xuICAgICAgICAgICAgICAgIGNvbnNvbGUud2FybihgRWxlbWVudCB3aXRoIGFzeW5jIGF0dHJpYnV0ZSAnJHtrfScgbm90IG1vdW50ZWQgYWZ0ZXIgNSBzZWNvbmRzLiBJZiBpdCBp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CBsb2dOb2RlKHZhbHVlKSk7XG4gICAgICAgICAgICBkW2tdID0gdmFsdWU7XG4gICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgIC8vIE5vdGUgLSBpZiB3ZSdyZSBjb3B5aW5nIHRvIG91cnNlbGYgKG9yIGFuIGFycmF5IG9mIGRpZmZlcmVudCBsZW5ndGgpLFxuICAgICAgICAgICAgLy8gd2UncmUgZGVjb3VwbGluZyBjb21tb24gb2JqZWN0IHJlZmVyZW5jZXMsIHNvIHdlIG5lZWQgYSBjbGVhbiBvYmplY3QgdG9cbiAgICAgICAgICAgIC8vIGFzc2lnbiBpbnRvXG4gICAgICAgICAgICBpZiAoIShrIGluIGQpIHx8IGRba10gPT09IHZhbHVlIHx8IChBcnJheS5pc0FycmF5KGRba10pICYmIGRba10ubGVuZ3RoICE9PSB2YWx1ZS5sZW5ndGgpKSB7XG4gICAgICAgICAgICAgIGlmICh2YWx1ZS5jb25zdHJ1Y3RvciA9PT0gT2JqZWN0IHx8IHZhbHVlLmNvbnN0cnVjdG9yID09PSBBcnJheSkge1xuICAgICAgICAgICAgICAgIGNvbnN0IGNvcHkgPSBuZXcgKHZhbHVlLmNvbnN0cnVjdG9yKTtcbiAgICAgICAgICAgICAgICBhc3NpZ24oY29weSwgdmFsdWUpO1xuICAgICAgICAgICAgICAgIGRba10gPSBjb3B5O1xuICAgICAgICAgICAgICAgIC8vYXNzaWduKGRba10sIHZhbHVlKTtcbiAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAvLyBUaGlzIGlzIHNvbWUgc29ydCBvZiBjb25zdHJ1Y3RlZCBvYmplY3QsIHdoaWNoIHdlIGNhbid0IGNsb25lLCBzbyB3ZSBoYXZlIHRvIGNvcHkgYnkgcmVmZXJlbmNlXG4gICAgICAgICAgICAgICAgZFtrXSA9IHZhbHVlO1xuICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICBpZiAoT2J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bGRcbiAgICAgICAgICAqIC4uLmNhdXNlcyB0aGUgaXRlcmF0b3IgZm9yIHRoZSBiYXNlIG9iamVjdCB0byBiZSBtYXBwZWQsIGxpa2VcbiAgICAgICAgICAqICAgICB0aGlzLml0ZXJhYmxlT2JqZWN0Lm1hcChvID0+IG9bZmllbGRdKVxuICAgICAgICAqL1xuICAgICAgICBpZiAoIShTeW1ib2wuYXN5bmNJdGVyYXRvciBpbiBhKSkge1xuICAgICAgICAgIC8vIEB0cy1leHBlY3QtZXJyb3IgLSBJZ25vcmUgaXMgdGhlIElOSVRJQUwgdmFsdWVcbiAgICAgICAgICBpZiAoYm94ZWRPYmplY3QgPT09IElnbm9yZSkge1xuICAgICAgICAgICAgaWYgKERFQlVHKVxuICAgICAgICAgICAgICBjb25zb2xlLmluZm8oYFRoZSBpdGVyYWJsZSBwcm9wZXJ0eSAnJHtuYW1lLnRvU3RyaW5nKCl9JyBvZiB0eXBlIFwib2JqZWN0XCIgd2lsbCBiZSBzcHJlYWQgdG8gcHJldmVudCByZS1pbml0aWFsaXNhdGlvbi5cXG4ke25ldyBFcnJvcigpLnN0YWNrPy5zbGljZSg2KX1gKTtcbiAgICAgICAgICAgIGlmIChBcnJheS5pc0FycmF5KGEpKVxuICAgICAgICAgICAgICBib3hlZE9iamVjdCA9IE9iamVjdC5kZWZpbmVQcm9wZXJ0aWVzKFsuLi5hXSBhcyBWLCBwZHMpO1xuICAgICAgICAgICAgZWxzZVxuICAgICAgICAgICAgICBib3hlZE9iamVjdCA9IE9iamVjdC5kZWZpbmVQcm9wZXJ0aWVzKHsgLi4uKGEgYXMgVikgfSwgcGRzKTtcbiAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgT2JqZWN0LmFzc2lnbihib3hlZE9iamVjdCwgYSk7XG4gICAgICAgICAgfVxuICAgICAgICAgIGlmIChib3hlZE9iamVjdFtJdGVyYWJpbGl0eV0gPT09ICdzaGFsbG93Jykge1xuICAgICAgICAgICAgYm94ZWRPYmplY3QgPSBPYmplY3QuZGVmaW5lUHJvcGVydGllcyhib3hlZE9iamVjdCwgcGRzKTtcbiAgICAgICAgICAgIHJldHVybiBib3hlZE9iamVjdDtcbiAgICAgICAgICB9XG5cbiAgICAgICAgICAvLyBQcm94eSB0aGUgcmVzdWx0IHNvIHdlIGNhbiB0cmFjayBtZW1iZXJzIG9mIHRoZSBpdGVyYWJsZSBvYmplY3RcbiAgICAgICAgICBjb25zdCBleHRyYUJveGVkOiB0eXBlb2YgYm94ZWRPYmplY3QgPSBuZXcgUHJveHkoYm94ZWRPYmplY3QsIHtcbiAgICAgICAgICAgIGRlbGV0ZVByb3BlcnR5KHRhcmdldCwga2V5KSB7XG4gICAgICAgICAgICAgIGlmIChSZWZsZWN0LmRlbGV0ZVByb3BlcnR5KHRhcmdldCwga2V5KSkge1xuICAgICAgICAgICAgICAgIC8vIEB0cy1pZ25vcmUgLSBGaXhcbiAgICAgICAgICAgICAgICBwdXNoKG9ialtuYW1lXSk7XG4gICAgICAgICAgICAgICAgcmV0dXJuIHRydWU7XG4gICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgcmV0dXJuIGZhbHNlO1xuICAgICAgICAgICAgfSxcbiAgICAgICAgICAgIC8vIEltcGxlbWVudCB0aGUgbG9naWMgdGhhdCBmaXJlcyB0aGUgaXRlcmF0b3IgYnkgcmUtYXNzaWduaW5nIHRoZSBpdGVyYWJsZSB2aWEgaXQncyBzZXR0ZXJcbiAgICAgICAgICAgIHNldCh0YXJnZXQsIGtleSwgdmFsdWUsIHJlY2VpdmVyKSB7XG4gICAgICAgICAgICAgIGlmIChSZWZsZWN0LnNldCh0YXJnZXQsIGtleSwgdmFsdWUsIHJlY2VpdmVyKSkge1xuICAgICAgICAgICAgICAgIC8vIEB0cy1pZ25vcmUgLSBGaXhcbiAgICAgICAgICAgICAgICBwdXNoKG9ialtuYW1lXSk7XG4gICAgICAgICAgICAgICAgcmV0dXJuIHRydWU7XG4gICAgICAgICAgICAgIH1cbiAgIC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5kZWZpbmVkKSB7XG4gICAgICAgICAgICAgICAgICAvLyBAdHMtaWdub3JlIC0gRml4OiB0aGlzIFwicmVkZWZpbmVzXCIgViBhcyBoYXZpbmcgYW4gb3B0aW9uYWwgbWVtYmVyIGNhbGxlZCBga2V5YFxuICAgICAgICAgICAgICAgICAgdGFyZ2V0W2tleV0gPSB1bmRlZmluZWQ7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGNvbnN0IHJlYWxWYWx1ZSA9IFJlZmxlY3QuZ2V0KGJveGVkT2JqZWN0IGFzIEV4Y2x1ZGU8dHlwZW9mIGJveGVkT2JqZWN0LCB0eXBlb2YgSWdub3JlPiwga2V5LCByZWNlaXZlcik7XG4gICAgICAgICAgICAgICAgY29uc3QgcHJvcHMgPSBPYmplY3QuZ2V0T3duUHJvcGVydHlEZXNjcmlwdG9ycyhcbiAgICAgICAgICAgICAgICAgICAgYm94ZWRPYmplY3QubWFwKChvLHApID0+IHtcbiAgICAgICAgICAgICAgICAgICAgY29uc3Qgb3YgPSBvPy5ba2V5IGFzIGtleW9mIHR5cGVvZiBvXT8udmFsdWVPZigpO1xuICAgICAgICAgICAgICAgICAgICBjb25zdCBwdiA9IHA/LnZhbHVlT2YoKTtcbiAgICAgICAgICAgICAgICAgICAgaWYgKHR5cGVvZiBvdiA9PT0gdHlwZW9mIHB2ICYmIG92ID09IHB2KVxuICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBJZ25vcmU7XG4gICAgICAgICAgICAgICAgICAgIHJldHVybiBvdjtcbiAgICAgICAgICAgICAgICAgIH0pXG4gICAgICAgICAgICAgICAgKTtcbiAgICAgICAgICAgICAgICAoUmVmbGVjdC5vd25LZXlzKHByb3BzKSBhcyAoa2V5b2YgdHlwZW9mIHByb3BzKVtdKS5mb3JFYWNoKGsgPT4gcHJvcHNba10uZW51bWVyYWJsZSA9IGZhbHNlKTtcbiAgICAgICAgICAgICAgICBjb25zdCBhaWIgPSBib3gocmVhbFZhbHVlL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AxO1xuICAgICAgICAgIHNpW2lkeF0gPSBzaXRbU3ltYm9sLmFzeW5jSXRlcmF0b3JdISgpO1xuICAgICAgICAgIHJldHVybiBzaVtpZHhdLm5leHQoKS50aGVuKGlyID0+ICh7c2ksaWR4LGssaXJ9KSk7XG4gICAgICAgIH0pO1xuICAgICAgfVxuXG4gICAgICByZXR1cm4gKGZ1bmN0aW9uIHN0ZXAoKTogUHJvbWlzZTxJdGVyYXRvclJlc3VsdDxDb21iaW5lZEl0ZXJhYmxlVHlwZTxTPj4+IHtcbiAgICAgICAgcmV0dXJuIFByb21pc2UucmFjZShwYykudGhlbigoeyBpZHgsIGssIGlyIH0pID0+IHtcbiAgICAgICAgICBpZiAoaXIuZG9uZSkge1xuICAgICAgICAgICAgcGNbaWR4XSA9IGZvcmV2ZXI7XG4gICAgICAgICAgICBhY3RpdmUgLT0gMTtcbiAgICAgICAgICAgIGlmICghYWN0aXZlKVxuICAgICAgICAgICAgICByZXR1cm4geyBkb25lOiB0cnVlLCB2YWx1ZTogdW5kZWZpbmVkIH07XG4gICAgICAgICAgICByZXR1cm4gc3RlcCgpO1xuICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAvLyBAdHMtaWdub3JlXG4gICAgICAgICAgICBhY2N1bXVsYXRlZFtrXSA9IGlyLnZhbHVlO1xuICAgICAgICAgICAgcGNbaWR4XSA9IHNpW2lkeF0ubmV4dCgpLnRoZW4oaXIgPT4gKHsgaWR4LCBrLCBpciB9KSk7XG4gICAgICAgICAgfVxuICAgICAgICAgIGlmIChvcHRzLmlnbm9yZVBhcnRpYWwpIHtcbiAgICAgICAgICAgIGlmIChPYmplY3Qua2V5cyhhY2N1bXVsYXRlZCkubGVuZ3RoIDwgT2JqZWN0LmtleXMoc3JjKS5sZW5ndGgpXG4gICAgICAgICAgICAgIHJldHVybiBzdGVwKCk7XG4gICAgICAgICAgfVxuICAgICAgICAgIHJldHVybiB7IGRvbmU6IGZhbHNlLCB2YWx1ZTogYWNjdW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8SGVscGVyQXN5bmNJdGVyYWJsZTxVPj47XG4gIGxldCBwcmV2OiBSIHwgdHlwZW9mIElnbm9yZSA9IElnbm9yZTtcbiAgY29uc3QgZmFpOiBBc3luY0l0ZXJhYmxlSXRlcmF0b3I8Uj4gPSB7XG4gICAgW1N5bWJvbC5hc3luY0l0ZXJhdG9yXSgpIHtcbiAgICAgIHJldHVybiBmYWk7XG4gICAgfSxcblxuICAgIG5leHQoLi4uYXJnczogW10gfCBbdW5kZWZpbmVkXSkge1xuICAgICAgaWYgKGluaXRpYWxWYWx1ZSAhPT0gSWdub3JlKSB7XG4gICAgICAgIGNvbnN0IGluaXQgPSBQcm9taXNlLnJlc29sdmUoeyBkb25lOiBmYWxzZSwgdmFsdWU6IGluaXRpYWxWYWx1ZSB9KTtcbiAgICAgICAgaW5pdGlhbFZhbHVlID0gSWdub3JlO1xuICAgICAgICByZXR1cm4gaW5pdDtcbiAgICAgIH1cblxuICAgICAgcmV0dXJuIG5ldyBQcm9taXNlPEl0ZXJhdG9yUmVzdWx0PFI+PihmdW5jdGlvbiBzdGVwKHJlc29sdmUsIHJlamVjdCkge1xuICAgICAgICBpZiAoIWFpKVxuICAgICAgICAgIGFpID0gc291cmNlW1N5bWJvbC5hc3luY0l0ZXJhdG9yXSEoKTtcbiAgICAgICAgYWkubmV4dCguLi5hcmdzKS50aGVuKFxuICAgICAgICAgIHAgPT4gcC5kb25lXG4gICAgICAgICAgICA/IHJlc29sdmUocClcbiAgICAgICAgICAgIDogcmVzb2x2ZVN5bmMoZm4ocC52YWx1ZSwgcHJldiksXG4gICAgICAgICAgICAgIGYgPT4gZiA9PT0gSWdub3JlXG4gICAgICAgICAgICAgICAgPyBzdGVwKHJlc29sdmUsIHJlamVjdClcbiAgICAgICAgICAgICAgICA6IHJlc29sdmUoeyBkb25lOiBmYWxzZSwgdmFsdWU6IHByZXYgPSBmIH0pLFxuICAgICAgICAgICAgICBleCA9PiB7XG4gICAgICAgICAgICAgICAgLy8gVGhlIGZ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ICAgICAgY29uc3Qgbm9kZXMgPSBjb250YWluZXIucXVlcnlTZWxlY3RvckFsbChzZWxlY3Rvcik7XG4gICAgICAgICAgICAgIGZvciAoY29uc3QgbiBvZiBub2Rlcykge1xuICAgICAgICAgICAgICAgIGlmICgoZXYudGFyZ2V0ID09PSBuIHx8IG4uY29udGFpbnMoZXYudGFyZ2V0KSkgJiYgY29udGFpbmVyLmNvbnRhaW5zKG4pKVxuICAgICAgICAgICAgICAgICAgcHVzaChldilcbiAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgaWYgKChldi50YXJnZXQgPT09IGNvbnRhaW5lciB8fCBjb250YWluZXIuY29udGFpbnMoZXYudGFyZ2V0KSkpXG4gICAgICAgICAgICAgICAgcHVzaChldilcbiAgICAgICAgICAgIH1cbiAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgIH0gY2F0Y2ggKGV4KSB7XG4gICAgICAgIGNvbnNvbGUud2FybignZG9jRXZlbnRIYW5kbGVyJywgZXgpO1xuICAgICAgfVxuICAgIH1cbiAgfVxufVxuXG5mdW5jdGlvbiBpc0NTU1NlbGVjdG9yKHM6IHN0cmluZyk6IHMgaXMgQ1NTSWRlbnRpZmllciB7XG4gIHJldHVybiBCb29sZWFuKHMgJiYgKHMuc3RhcnRzV2l0aCgnIycpIHx8IHMuc3RhcnRzV2l0aCgnLicpIHx8IChzLnN0YXJ0c1dpdGgoJ1snKSAmJiBzLmVuZHNXaXRoKCddJykpKSk7XG59XG5cbmZ1bmN0aW9uIHBhcnNlV2hlblNlbGVjdG9yPEV2ZW50TmFtZSBleHRlbmRzIHN0cmluZz4od2hhdDogSXNWYWxpZFdoZW5TZWxlY3RvcjxFdmVudE5hbWU+KTogdW5kZWZpbmVkIHwgW0NTU0lkZW50aWZpZXIgfCBudWxsLCBrZXlvZiBHbG9iYWxFdmVudEhhbmRsZXJzRXZlbnRNYXBdIHtcbiAgY29uc3QgcGFydHMgPSB3aG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aUJBQ1IsT0FBTztBQUNkLGNBQUksQ0FBQyxPQUFPLElBQUksSUFBSSxFQUFFLEdBQUc7QUFDdkIsbUJBQU8sSUFBSSxJQUFJLEVBQUU7QUFDakIscUJBQVE7QUFBQSxjQUFLO0FBQUEsY0FBaUMsSUFBSTtBQUFBO0FBQUEsWUFBMEI7QUFBQSxVQUM5RTtBQUFBLFFBQ0Y7QUFBQSxNQUNGO0FBQUEsSUFDRixDQUFDO0FBQUEsRUFDSDtBQUNBLFNBQU87QUFDVDsiLAogICJuYW1lcyI6IFsidiIsICJhIiwgInJlc3VsdCIsICJleCIsICJpciIsICJpc01pc3NpbmciLCAibWVyZ2VkIiwgImMiLCAibiIsICJ2YWx1ZSIsICJpc0FuY2VzdHJhbCIsICJjaGlsZHJlbiJdCn0K diff --git a/module/dist/ai-ui.js b/module/dist/ai-ui.js index 10ceaf2..7d33ac3 100644 --- a/module/dist/ai-ui.js +++ b/module/dist/ai-ui.js @@ -119,11 +119,10 @@ var AIUI = (() => { } }; var extraKeys = [...Object.getOwnPropertySymbols(asyncExtras), ...Object.keys(asyncExtras)]; - function assignHidden(d, ...srcs) { - for (const s of srcs) { - for (const [k, pd] of Object.entries(Object.getOwnPropertyDescriptors(s))) { - Object.defineProperty(d, k, { ...pd, enumerable: false }); - } + function assignHidden(d, s) { + const keys = [...Object.getOwnPropertyNames(s), ...Object.getOwnPropertySymbols(s)]; + for (const k of keys) { + Object.defineProperty(d, k, { ...Object.getOwnPropertyDescriptor(s, k), enumerable: false }); } return d; } @@ -1525,4 +1524,4 @@ ${createdBy}`); } return __toCommonJS(ai_ui_exports); })(); -//# sourceMappingURL=data:application/json;base64,ewogICJ2ZXJzaW9uIjogMywKICAic291cmNlcyI6IFsiLi4vc3JjL2FpLXVpLnRzIiwgIi4uL3NyYy9kZWJ1Zy50cyIsICIuLi9zcmMvZGVmZXJyZWQudHMiLCAiLi4vc3JjL2l0ZXJhdG9ycy50cyIsICIuLi9zcmMvd2hlbi50cyJdLAog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gXCJFbGVtZW50KHMpIGhhdmUgYmVlbiByZW1vdmVkIGZyb20gdGhlIGRvY3VtZW50OiBcIiArIGluc2VydGlvblN0YWNrO1xuICAgICAgICAgICAgICAgIGFwLnJldHVybj8uKG5ldyBFcnJvcihtc2cpKTtcbiAgICAgICAgICAgICAgICByZXR1cm47XG4gICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgICBpZiAoREVCVUcgJiYgbm90WWV0TW91bnRlZCAmJiBjcmVhdGVkQXQgJiYgY3JlYXRlZEF0IDwgRGF0ZS5ub3coKSkge1xuICAgICAgICAgICAgICAgIGNyZWF0ZWRBdCA9IE51bWJlci5NQVhfU0FGRV9JTlRFR0VSO1xuICAgICAgICAgICAgICAgIGNvbnNvbGUud2FybihgQXN5bmMgZWxlbWVudCBub3QgbW91bnRlZCBhZnRlciA1IHNlY29uZHMuIElmIGl0IGlzIG5ldmVyIG1vdW50ZWQsIGl0IHdpbGwgbGVhay5gLGNyZWF0ZWRCeSwgdC5tYXAobG9nTm9kZSkpO1xuICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgIHQgPSBub2Rlcyh1bmJveChlcy52YWx1ZSkgYXMgQ2hpbGRUYWdzKTtcbiAgICAgICAgICAgICAgLy8gSWYgdGhlIGl0ZXJhdGVkIGV4cHJlc3Npb24geWllbGRzIG5vIG5vZGVzLCBzdHVmZiBpbiBhIERvbVByb21pc2VDb250YWluZXIgZm9yIHRoZSBuZXh0IGl0ZXJhdGlvblxuICAgICAgICAgICAgICBpZiAoIXQubGVuZ3RoKSB0LnB1c2goRG9tUHJvbWlzZUNvbnRhaW5lcigpKTtcbiAgICAgICAgICAgICAgKG5bMF0gYXMgQ2hpbGROb2RlKS5yZXBsYWNlV2l0aCguLi50KTtcbiAgICAgICAgICAgICAgbi5zbGljZSgxKS5mb3JFYWNoKGUgPT4gIXQuaW5jbHVkZXMoZSkgJiYgZS5wYXJlbnROb2RlPy5yZW1vdmVDaGlsZChlKSk7XG4gICAgICAgICAgICA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3JlIGRlY291cGxpbmcgY29tbW9uIG9iamVjdCByZWZlcmVuY2VzLCBzbyB3ZSBuZWVkIGEgY2xlYW4gb2JqZWN0IHRvXG4gICAgICAgICAgICAgICAgICAgIC8vIGFzc2lnbiBpbnRvXG4gICAgICAgICAgICAgICAgICAgIGlmIChBcnJheS5pc0FycmF5KGRba10pICYmIGRba10ubGVuZ3RoICE9PSB2YWx1ZS5sZW5ndGgpIHtcbiAgICAgICAgICAgICAgICAgICAgICBpZiAodmFsdWUuY29uc3RydWN0b3IgPT09IE9iamVjdCB8fCB2YWx1ZS5jb25zdHJ1Y3RvciA9PT0gQXJyYXkpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGRlZXBEZWZpbmUoZFtrXSA9IG5ldyAodmFsdWUuY29uc3RydWN0b3IpLCB2YWx1ZSk7XG4gICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIC8vIFRoaXMgaXMgc29tZSBzb3J0IG9mIGNvbnN0cnVjdGVkIG9iamVjdCwgd2hpY2ggd2UgY2FuJ3QgY2xvbmUsIHNvIHdlIGhhdmUgdG8gY29weSBieSByZWZlcmVuY2VcbiAgICAgICAgICAgICAgICAgICAgICAgIGRba10gPSB2YWx1ZTtcbiAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgICAgLy8gVGhpcyBpcyBqdXN0IGEgcmVndWxhciBvYmplY3QsIHNvIHdlIGRlZXBEZWZpbmUgcmVjdXJzaXZlbHlcbiAgICAgICAgICAgICAgICAgICAgICBkZWVwRGVmaW5lKGRba10sIHZhbHVlKTtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgLy8gVGhpcyBpcyBqdXN0IGEgcHJpbWl0aXZlIHZhbHVlLCBvciBhIFByb21pc2VcbiAgICAgICAgICAgICAgaWYgKHNba10gIT09IHVuZGVmaW5lZClcbiAgICAgICAgICAgICAgICBkW2tdID0gc1trXTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICB9XG4gICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgLy8gQ29weSB0aGUgZGVmaW5pdGlvbiBvZiB0aGUgZ2V0dGVyL3NldHRlclxuICAgICAgICAgIE9iamVjdC5kZWZpbmVQcm9wZXJ0eShkLCBrLCBzcmNEZXNjKTtcbiAgICAgICAgfVxuICAgICAgfSBjYXRjaCAoZXg6IHVua25vd24pIHtcbiAgICAgICAgY29uc29sZS53YXJuKCBcImRlZXBBc3NpZ25cIiwgaywgc1trXSwgZXgpO1xuICAgICAgICB0aHJvdyBleDtcbiAgICAgIH1cbiAgICB9XG4gIH1cblxuICBmdW5jdGlvbiB1bmJveChhOiB1bmtub3duKTogdW5rbm93biB7XG4gICAgY29uc3QgdiA9IGE/LnZhbHVlT2YoKTtcbiAgICByZXR1cm4gQXJyYXkuaXNBcnJheSh2KSA/IEFycmF5LnByb3RvdHlwZS5tYXAuY2FsbCh2LHVuYm94KSA6IHY7XG4gIH1cblxuICBmdW5jdGlvbiBhc3NpZ25Qcm9wcyhiYXNlOiBOb2RlLCBwcm9wczogUmVjb3JkPHN0cmluZywgYW55Pikge1xuICAgIC8vIENvcHkgcHJvcCBoaWVyYXJjaHkgb250byB0aGUgZWxlbWVudCB2aWEgdGhlIGFzc3NpZ25tZW50IG9wZXJhdG9yIGluIG9yZGVyIHRvIHJ1biBzZXR0ZXJzXG4gICAgaWYgKCEoY2FsbFN0YWNrU3ltYm9sIGluIHByb3BzKSkge1xuICAgICAgKGZ1bmN0aW9uIGFzc2lnbihkOiBhbnksIHM6IGFueSk6IHZvaWQge1xuICAgICAgICBpZiAocyA9PT0gbnVsbCB8fCBzID09PSB1bmRlZmluZWQgfHwgdHlwZW9mIHMgIT09ICdvYmplY3QnKVxuICAgICAgICAgIHJldHVybjtcbiAgICAgICAgLy8gc3RhdGljIHByb3BzIGJlZm9yZSBnZXR0ZXJzL3NldHRlcnNcbiAgICAgICAgY29uc3Qgc291cmNlRW50cmllcyA9IE9iamVjdC5lbnRyaWVzKE9iamVjdC5nZXRPd25Qcm9wZXJ0eURlc2NyaXB0b3JzKHMpKTtcbiAgICAgICAgaWYgKCFBcnJheS5pc0FycmF5KHMpKSB7XG4gICAgICAgICAgc291cmNlRW50cmllcy5zb3J0KChhLGIpID0+IHtcbiAgICAgICAgICAgIGNvbnN0IGRlc2MgPSBPYmplY3QuZ2V0T3duUHJvcGVydHlEZXNjcmlwdG9yKGQsYVswXSk7XG4gICAgICAgICAgICBpZiAoZGVzYykge1xuICAgICAgICAgICAgICBpZiAoJ3ZhbHVlJyBpbiBkZXNjKSByZXR1cm4gLTE7XG4gICAgICAgICAgICAgIGlmICgnc2V0JyBpbiBkZXNjKSByZXR1cm4gMTtcbiAgICAgICAgICAgICAgaWYgKCdnZXQnIGluIGRlc2MpIHJldHVybiAwLjU7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICByZXR1cm4gMDtcbiAgICAgICAgICB9KTtcbiAgICAgICAgfVxuICAgICAgICBmb3IgKGNvbnN0IFtrLCBzcmNEZXNjXSBvZiBzb3VyY2VFbnRyaWVzKSB7XG4gICAgICAgICAgdHJ5IHtcbiAgICAgICAgICAgIGlmICgndmFsdWUnIGluIHNyY0Rlc2MpIHtcbiAgICAgICAgICAgICAgY29uc3QgdmFsdWUgPSBzcmNEZXNjLnZhbHVlO1xuICAgICAgICAgICAgICBpZiAoaXNBc3luY0l0ZXI8dW5rbm93bj4odmFsdWUpKSB7XG4gICAgICAgICAgICAgICAgYXNzaWduSXRlcmFibGUodmFsdWUsIGspO1xuICAgICAgICAgICAgICB9IGVsc2UgaWYgKGlzUHJvbWlzZUxpa2UodmFsdWUpKSB7XG4gICAgICAgICAgICAgICAgdmFsdWUudGhlbih2ID0+IHtcbiAgICAgICAgICAgICAgICAgIGlmICh2ICYmIHR5cGVvZiB2ID09PSAnb2JqZWN0Jykge1xuICAgICAgICAgICAgICAgICAgICAvLyBTcGVjaWFsIGNhc2U6IHRoaXMgcHJvbWlzZSByZXNvbHZlZCB0byBhbiBhc3luYyBpdGVyYXRvclxuICAgICAgICAgICAgICAgICAgICBpZiAoaXNBc3luY0l0ZXI8dW5rbm93bj4odikpIHtcbiAgICAgICAgICAgICAgICAgICAgICBhc3NpZ25JdGVyYWJsZSh2LCBrKTtcbiAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgICBhc3NpZ25PYmplY3Qodiwgayk7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgIGlmIChzW2tdICE9PSB1bmRlZmluZWQpXG4gICAgICAgICAgICAgICAgICAgICAgZFtrXSA9IHY7XG4gICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfSwgZXJyb3IgPT4gY29uc29sZS5sb2coXCJGYWlsZWQgdG8gc2V0IGF0dHJpYnV0ZVwiLCBlcnJvcikpO1xuICAgICAgICAgICAgICB9IGVsc2UgaWYgKCFpc0FzeW5jSXRlcjx1bmtub3duPih2YWx1ZSkpIHtcbiAgICAgICAgICAgICAgICAvLyBUaGlzIGhhcyBhIHJlYWwgdmFsdWUsIHdoaWNoIG1pZ2h0IGJlIGFuIG9iamVjdFxuICAgICAgICAgICAgICAgIGlmICh2YWx1ZSAmJiB0eXBlb2YgdmFsdWUgPT09ICdvYmplY3QnICYmICFpc1Byb21pc2VMaWtlKHZhbHVlKSlcbiAgICAgICAgICAgICAgICAgIGFzc2lnbk9iamVjdCh2YWx1ZSwgayk7XG4gICAgICAgICAgICAgICAgZWxzZSB7XG4gICAgICAgICAgICAgICAgICBpZiAoc1trXSAhPT0gdW5kZWZpbmVkKVxuICAgICAgICAgICAgICAgICAgICBkW2tdID0gc1trXTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgIC8vIENvcHkgdGhlIGRlZmluaXRpb24gb2YgdGhlIGdldHRlci9zZXR0ZXJcbiAgICAgICAgICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KGQsIGssIHNyY0Rlc2MpO1xuICAgICAgICAgICAgfVxuICAgICAgICAgIH0gY2F0Y2ggKGV4OiB1bmtub3duKSB7XG4gICAgICAgICAgICBjb25zb2xlLndhcm4oIFwiYXNzaWduUHJvcHNcIiwgaywgc1trXSwgZXgpO1xuICAgICAgICAgICAgdGhyb3cgZXg7XG4gICAgICAgICAgfVxuICAgICAgICB9XG5cbiAgICAgICAgZnVuY3Rpb24gYXNzaWduSXRlcmFibGUodmFsdWU6IEFzeW5jSXRlcmFibGU8dW5rbm93bj4gfCBBc3luY0l0ZXJhdG9yPHVua25vd24sIGFueSwgdW5kZWZpbmVkPiwgazogc3RyaW5nKSB7XG4gICAgICAgICAgY29uc3QgYXAgPSBhc3luY0l0ZXJhdG9yKHZhbHVlKTtcbiAgICAgICAgICBsZXQgbm90WWV0TW91bnRlZCA9IHRydWU7XG4gICAgICAgICAgLy8gREVCVUcgc3VwcG9ydFxuICAgICAgICAgIGxldCBjcmVhdGVkQXQgPSBEYXRlLm5vdygpICsgdGltZU91dFdhcm47XG4gICAgICAgICAgY29uc3QgY3JlYXRlZEJ5ID0gREVCVUcgJiYgbmV3IEVycm9yKFwiQ3JlYXRlZCBieVwiKS5zdGFjaztcbiAgICAgICAgICBjb25zdCB1cGRhdGUgPSAoZXM6IEl0ZXJhdG9yUmVzdWx0PHVua25vd24+KSA9PiB7XG4gICAgICAgICAgICBpZiAoIWVzLmRvbmUpIHtcbiAgICAgICAgICAgICAgY29uc3QgdmFsdWUgPSB1bmJveChlcy52YWx1ZSk7XG4gICAgICAgICAgICAgIGlmICh0eXBlb2Yg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pbWl0aXZlXG4gICAgICAgICAgICAgICAgKi9cbiAgICAgICAgICAgICAgICBjb25zdCBkZXN0RGVzYyA9IE9iamVjdC5nZXRPd25Qcm9wZXJ0eURlc2NyaXB0b3IoZCwgayk7XG4gICAgICAgICAgICAgICAgaWYgKGsgPT09ICdzdHlsZScgfHwgIWRlc3REZXNjPy5zZXQpXG4gICAgICAgICAgICAgICAgICBhc3NpZ24oZFtrXSwgdmFsdWUpO1xuICAgICAgICAgICAgICAgIGVsc2VcbiAgICAgICAgICAgICAgICAgIGRba10gPSB2YWx1ZTtcbiAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAvLyBTcmMgaXMgbm90IGFuIG9iamVjdCAob3IgaXMgbnVsbCkgLSBqdXN0IGFzc2lnbiBpdCwgdW5sZXNzIGl0J3MgdW5kZWZpbmVkXG4gICAgICAgICAgICAgICAgaWYgKHZhbHVlICE9PSB1bmRlZmluZWQpXG4gICAgICAgICAgICAgICAgICBkW2tdID0gdmFsdWU7XG4gICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgY29uc3QgbW91bnRlZCA9IGJhc2UuaXNDb25uZWN0ZWQ7XG4gICAgICAgICAgICAgIC8vIElmIHdlIGhhdmUgYmVlbiBtb3VudGVkIGJlZm9yZSwgYml0IGFyZW4ndCBub3csIHJlbW92ZSB0aGUgY29uc3VtZXJcbiAgICAgICAgICAgICAgaWYgKHJlbW92ZWROb2RlcyhiYXNlKSB8fCAoIW5vdFlldE1vdW50ZWQgJiYgIW1vdW50ZWQpKSB7XG4gICAgICAgICAgICAgICAgY29uc29sZS5pbmZvKGBFbGVtZW50IGRvZXMgbm90IGV4aXN0IGluIGRvY3VtZW50IHdoZW4gc2V0dGluZyBhc3luYyBhdHRyaWJ1dGUgJyR7a30nIHRvOlxcbiR7bG9nTm9kZShiYXNlKX1gKTtcbiAgICAgICAgICAgICAgICBhcC5yZXR1cm4/LigpO1xuICAgICAgICAgICAgICAgIHJldHVybjtcbiAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICBpZiAobW91bnRlZCkgbm90WWV0TW91bnRlZCA9IGZhbHNlO1xuICAgICAgICAgICAgICBpZiAobm90WWV0TW91bnRlZCAmJiBjcmVhdGVkQXQgJiYgY3JlYXRlZEF0IDwgRGF0ZS5ub3coKSkge1xuICAgICAgICAgICAgICAgIGNyZWF0ZWRBdCA9IE51bWJlci5NQVhfU0FGRV9JTlRFR0VSO1xuICAgICAgICAgICAgICAgIGNvbnNvbGUud2FybihgRWxlbWVudCB3aXRoIGFzeW5jIGF0dHJpYnV0ZSAnJHtrfScgbm90IG1vdW50ZWQgYWZ0ZXIgNSBzZWNvbmRzLiBJZiBpdCBpcyBuZXZlciBtb3VudGVkLCBpdCB3aWxsIGxlYWsuXFxuRWxlbWVudCBjb250YWluczogJHtsb2dOb2RlKGJhc2UpfVxcbiR7Y3JlYXRlZEJ5fWApO1xuICAgICAgICAgICAgICB9XG5cbiAgICAgICAgICAgICAgYXAubmV4dCgpLnRoZW4odXBkYXRlKS5jYXRjaChlcnJvcik7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgfVxuICAgICAgICAgIGNvbnN0IGVycm9yID0gKGVycm9yVmFsdWU6IGFueSkgPT4ge1xuICAgICAgICAgICAgY29uc29sZS53YXJuKCBcIkR5bmFtaWMgYXR0cmlidXRlIGVycm9yXCIsIGVycm9yVmFsdWUsIGssIGQsIGNyZWF0ZWRCeSwgbG9nTm9kZShiYXNlKSk7XG4gICAgICAgICAgICBhcC5yZXR1cm4/LihlcnJvclZhbHVlKTtcbiAgICAgICAgICAgIGJhc2UuYXBwZW5kQ2hpbGQoRHlhbWljRWxlbWVudEVycm9yKHsgZXJyb3I6IGVycm9yVmFsdWUgfSkpO1xuICAgICAgICAgIH1cbiAgICAgICAgICBhcC5uZXh0KCkudGhlbih1cGRhdGUpLmNhdGNoKGVycm9yKTtcbiAgICAgICAgfVxuXG4gICAgICAgIGZ1bmN0aW9uIGFzc2lnbk9iamVjd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WUpO1xuICAgICAgICAgICAgICAgIGRba10gPSBjb3B5O1xuICAgICAgICAgICAgICAgIC8vYXNzaWduKGRba10sIHZhbHVlKTtcbiAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAvLyBUaGlzIGlzIHNvbWUgc29ydCBvZiBjb25zdHJ1Y3RlZCBvYmplY3QsIHdoaWNoIHdlIGNhbid0IGNsb25lLCBzbyB3ZSBoYXZlIHRvIGNvcHkgYnkgcmVmZXJlbmNlXG4gICAgICAgICAgICAgICAgZFtrXSA9IHZhbHVlO1xuICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICBpZiAoT2JqZWN0LmdldE93blByb3BlcnR5RGVzY3JpcHRvcihkLCBrKT8uc2V0KVxuICAgICAgICAgICAgICAgIGRba10gPSB2YWx1ZTtcblxuICAgICAgICAgICAgICBlbHNlXG4gICAgICAgICAgICAgICAgYXNzaWduKGRba10sIHZhbHVlKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgIH0pKGJhc2UsIHByb3BzKTtcbiAgICB9XG4gIH1cblxuICAvKlxuICBFeHRlbmQgYSBjb21wb25lbnQgY2xhc3Mgd2l0aCBjcmVhdGUgYSBuZXcgY29tcG9uZW50IGNsYXNzIGZhY3Rvcnk6XG4gICAgICBjb25zdCBOZXdEaXYgPSBEaXYuZXh0ZW5kZWQoeyBvdmVycmlkZXMgfSlcbiAgICAgICAgICAuLi5vci4uLlxuICAgICAgY29uc3QgTmV3RGljID0gRGl2LmV4dGVuZGVkKChpbnN0YW5jZTp7IGFyYml0cmFyeS10eXBlIH0pID0+ICh7IG92ZXJyaWRlcyB9KSlcbiAgICAgICAgIC4uLmxhdGVyLi4uXG4gICAgICBjb25zdCBlbHROZXdEaXYgPSBOZXdEaXYoe2F0dHJzfSwuLi5jaGlsZHJlbilcbiAgKi9cblxuICB0eXBlIEV4dGVuZFRhZ0Z1bm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ICAgICAgICAgIGJveGVkT2JqZWN0ID0gT2JqZWN0LmRlZmluZVByb3BlcnRpZXMoWy4uLmFdIGFzIFYsIHBkcyk7XG4gICAgICAgICAgICBlbHNlXG4gICAgICAgICAgICAgIGJveGVkT2JqZWN0ID0gT2JqZWN0LmRlZmluZVByb3BlcnRpZXMoeyAuLi4oYSBhcyBWKSB9LCBwZHMpO1xuICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICBPYmplY3QuYXNzaWduKGJveGVkT2JqZWN0LCBhKTtcbiAgICAgICAgICB9XG4gICAgICAgICAgaWYgKGJveGVkT2JqZWN0W0l0ZXJhYmlsaXR5XSA9PT0gJ3NoYWxsb3cnKSB7XG4gICAgICAgICAgICBib3hlZE9iamVjdCA9IE9iamVjdC5kZWZpbmVQcm9wZXJ0aWVzKGJveGVkT2JqZWN0LCBwZHMpO1xuICAgICAgICAgICAgcmV0dXJuIGJveGVkT2JqZWN0O1xuICAgICAgICAgIH1cblxuICAgICAgICAgIC8vIFByb3h5IHRoZSByZXN1bHQgc28gd2UgY2FuIHRyYWNrIG1lbWJlcnMgb2YgdGhlIGl0ZXJhYmxlIG9iamVjdFxuICAgICAgICAgIGNvbnN0IGV4dHJhQm94ZWQ6IHR5cGVvZiBib3hlZE9iamVjdCA9IG5ldyBQcm94eShib3hlZE9iamVjdCwge1xuICAgICAgICAgICAgZGVsZXRlUHJvcGVydHkodGFyZ2V0LCBrZXkpIHtcbiAgICAgICAgICAgICAgaWYgKFJlZmxlY3QuZGVsZXRlUHJvcGVydHkodGFyZ2V0LCBrZXkpKSB7XG4gICAgICAgICAgICAgICAgLy8gQHRzLWlnbm9yZSAtIEZpeFxuICAgICAgICAgICAgICAgIHB1c2gob2JqW25hbWVdKTtcbiAgICAgICAgICAgICAgICByZXR1cm4gdHJ1ZTtcbiAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICByZXR1cm4gZmFsc2U7XG4gICAgICAgICAgICB9LFxuICAgICAgICAgICAgLy8gSW1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nN0IHB2ID0gcD8udmFsdWVPZigpO1xuICAgICAgICAgICAgICAgICAgICBpZiAodHlwZW9mIG92ID09PSB0eXBlb2YgcHYgJiYgb3YgPT0gcHYpXG4gICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIElnbm9yZTtcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG92O1xuICAgICAgICAgICAgICAgICAgfSlcbiAgICAgICAgICAgICAgICApO1xuICAgICAgICAgICAgICAgIChSZWZsZWN0Lm93bktleXMocHJvcHMpIGFzIChrZXlvZiB0eXBlb2YgcHJvcHMpW10pLmZvckVhY2goayA9PiBwcm9wc1trXS5lbnVtZXJhYmxlID0gZmFsc2UpO1xuICAgICAgICAgICAgICAgIGNvbnN0IGFpYiA9IGJveChyZWFsVmFsdWUsIHByb3BzKTtcbiAgICAgICAgICAgICAgICBSZWZsZWN0LnNldCh0YXJnZXQsIGtleSwgYWliKTtcbiAgICAgICAgICAgICAgICByZXR1cm4gYWliO1xuICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgIHJldHVybiBSZWZsZWN0LmdldCh0YXJnZXQsIGtleSwgcmVjZWl2ZXIpO1xuICAgICAgICAgICAgfSxcbiAgICAgICAgICB9KTtcbiAgICAgICAgICByZXR1cm4gZXh0cmFCb3hlZDtcbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gYSBhcyAoViAmIEFzeW5jRXh0cmFJdGVyYWJsZTxWPik7XG4gICAgICBjYXNlICdiaWdpbnQnOlxuICAgICAgY2FzZSAnYm9vbGVhbic6XG4gICAgICBjYXNlICdudW1iZXInOlxuICAgICAgY2FzZSAnc3RyaW5nJzpcbiAgICAgICAgLy8gQm94ZXMgdHlwZXMsIGluY2x1ZGluZyBCaWdJbnRcbiAgICAgICAgcmV0dXJuIE9iamVjdC5kZWZpbmVQcm9wZXJ0aWVzKE9iamVjdChhKSwge1xuICAgICAgICAgIC4uLnBkcyxcbiAgICAgICAgICB0b0pTT046IHsgdmFsdWUoKSB7IHJldHVyb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IEB0cy1pZ25vcmVcbiAgICAgICAgICAgIGFjY3VtdWxhdGVkW2tdID0gaXIudmFsdWU7XG4gICAgICAgICAgICBwY1tpZHhdID0gc2lbaWR4XS5uZXh0KCkudGhlbihpciA9PiAoeyBpZHgsIGssIGlyIH0pKTtcbiAgICAgICAgICB9XG4gICAgICAgICAgaWYgKG9wdHMuaWdub3JlUGFydGlhbCkge1xuICAgICAgICAgICAgaWYgKE9iamVjdC5rZXlzKGFjY3VtdWxhdGVkKS5sZW5ndGggPCBPYmplY3Qua2V5cyhzcmMpLmxlbmd0aClcbiAgICAgICAgICAgICAgcmV0dXJuIHN0ZXAoKTtcbiAgICAgICAgICB9XG4gICAgICAgICAgcmV0dXJuIHsgZG9uZTogZmFsc2UsIHZhbHVlOiBhY2N1bXVsYXRlZCB9O1xuICAgICAgICB9KVxuICAgICAgfSkoKTtcbiAgICB9LFxuICAgIHJldHVybih2PzogYW55KXtcbiAgICAgIHBjLmZvckVhY2goKHAsaWR4KSA9PiB7XG4gICAgICAgIGlmIChwICE9PSBmb3JldmVyKSB7XG4gICAgICAgICAgc2lbaWR4XS5yZXR1cm4/Lih2KVxuICAgICAgICB9XG4gICAgICB9KTtcbiAgICAgIHJldHVybiBQcm9taXNlLnJlc29sdmUoeyBkb25lOiB0cnVlLCB2YWx1ZTogdiB9KTtcbiAgICB9LFxuICAgIHRocm93KGV4OiBhbnkpe1xuICAgICAgcGMuZm9yRWFjaCgocCxpZHgpID0+IHtcbiAgICAgICAgaWYgKHAgIT09IGZvcmV2ZXIpIHtcbiAgICAgICAgICBzaVtpZHhdLnRocm93Py4oZXgpXG4gICAgICAgIH1cbiAgICAgIH0pO1xuICAgICAgcmV0dXJuIFByb21pc2UucmVqZWN0KHsgZG9uZTogdHJ1ZSwgdmFsdWU6IGV4IH0pO1xuICAgIH1cbiAgfVxuICByZXR1cm4gaXRlcmFibGVIZWxwZXJzKGNpKTtcbn1cblxuXG5mdW5jdGlvbiBpc0V4dHJhSXRlcmFibGU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ICAgIGlmICghYWkpXG4gICAgICAgICAgYWkgPSBzb3VyY2VbU3ltYm9sLmFzeW5jSXRlcmF0b3JdISgpO1xuICAgICAgICBhaS5uZXh0KC4uLmFyZ3MpLnRoZW4oXG4gICAgICAgICAgcCA9PiBwLmRvbmVcbiAgICAgICAgICAgID8gcmVzb2x2ZShwKVxuICAgICAgICAgICAgOiByZXNvbHZlU3luYyhmbihwLnZhbHVlLCBwcmV2KSxcbiAgICAgICAgICAgICAgZiA9PiBmID09PSBJZ25vcmVcbiAgICAgICAgICAgICAgICA/IHN0ZXAocmVzb2x2ZSwgcmVqZWN0KVxuICAgICAgICAgICAgICAgIDogcmVzb2x2ZSh7IGRvbmU6IGZhbHNlLCB2YWx1ZTogcHJldiA9IGYgfSksXG4gICAgICAgICAgICAgIGV4ID0+IHtcbiAgICAgICAgICAgICAgICAvLyBUaGUgZmlsdGVyIGZ1bmN0aW9uIGZhaWxlZC4uLlxuICAgICAgICAgICAgICAgIGFpLnRocm93ID8gYWkudGhyb3coZXgpIDogYWkucmV0dXJuPy4oZXgpIC8vIFRlcm1pbmF0ZSB0aGUgc291cmNlIC0gZm9yIG5vdyB3ZSBpZ25vcmUgdGhlIHJlc3VsdCBvZiB0aGUgdGVybWluYXRpb25cbiAgICAgICAgICAgICAgICByZWplY3QoeyBkb25lOiB0cnVlLCB2YWx1ZTogZXggfSk7IC8vIFRlcm1pbmF0ZSB0aGUgY29uc3VtZXJcbiAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgKSxcblxuICAgICAgICAgIGV4ID0+XG4gICAgICAgICAgICAvLyBUaGUgc291cmNlIHRocmV3LiBUZWxsIHRoZSBjb25zdW1lclxuICAgICAgICAgICAgcmVqZWN0KHsgZG9uZTogdHJ1ZSwgdmFsdWU6IGV4IH0pXG4gICAgICAgICkuY2F0Y2goZXggPT4ge1xuICAgICAgICAgIC8vIFRoZSBjYWxsYmFjayB0aHJld1xuICAgICAgICAgIGFpLnRocm93ID8gYWkudGhyb3coZXg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bnRhaW5lciwgc2VsZWN0b3IgfSA9IG87XG4gICAgICAgIGlmICghY29udGFpbmVyLmlzQ29ubmVjdGVkKSB7XG4gICAgICAgICAgY29uc3QgbXNnID0gXCJDb250YWluZXIgYCNcIiArIGNvbnRhaW5lci5pZCArIFwiPlwiICsgKHNlbGVjdG9yIHx8ICcnKSArIFwiYCByZW1vdmVkIGZyb20gRE9NLiBSZW1vdmluZyBzdWJzY3JpcHRpb25cIjtcbiAgICAgICAgICBvYnNlcnZhdGlvbnMuZGVsZXRlKG8pO1xuICAgICAgICAgIHRlcm1pbmF0ZShuZXcgRXJyb3IobXNnKSk7XG4gICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgaWYgKGV2LnRhcmdldCBpbnN0YW5jZW9mIE5vZGUpIHtcbiAgICAgICAgICAgIGlmIChzZWxlY3Rvcikge1xuICAgICAgICAgICAgICBjb25zdCBub2RlcyA9IGNvbnRhaW5lci5xdWVyeVNlbGVjdG9yQWxsKHNlbGVjdG9yKTtcbiAgICAgICAgICAgICAgZm9yIChjb25zdCBuIG9mIG5vZGVzKSB7XG4gICAgICAgICAgICAgICAgaWYgKChldi50YXJnZXQgPT09IG4gfHwgbi5jb250YWlucyhldi50YXJnZXQpKSAmJiBjb250YWluZXIuY29udGFpbnMobikpXG4gICAgICAgICAgICAgICAgICBwdXNoKGV2KVxuICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICBpZiAoKGV2LnRhcmdldCA9PT0gY29udGFpbmVyIHx8IGNvbnRhaW5lci5jb250YWlucyhldi50YXJnZXQpKSlcbiAgICAgICAgICAgICAgICBwdXNoKGV2KVxuICAgICAgICAgICAgfVxuICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgfSBjYXRjaCAoZXgpIHtcbiAgICAgICAgY29uc29sZS53YXJuKCdkb2NFdmVudEhhbmRsZXInLCBleCk7XG4gICAgICB9XG4gICAgfVxuICB9XG59XG5cbmZ1bmN0aW9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tb3VudGVkID0gdC5maWx0ZXIoZSA9PiBlPy5wYXJlbnROb2RlICYmIGUuaXNDb25uZWN0ZWQpO1xuICAgICAgICAgICAgICBjb25zdCBuID0gbm90WWV0TW91bnRlZCA/IHQgOiBtb3VudGVkO1xuICAgICAgICAgICAgICBpZiAobW91bnRlZC5sZW5ndGgpIG5vdFlldE1vdW50ZWQgPSBmYWxzZTtcblxuICAgICAgICAgICAgICBpZiAoIW4ubGVuZ3RoIHx8IHQuZXZlcnkoZSA9PiByZW1vdmVkTm9kZXMoZSkpKSB7XG4gICAgICAgICAgICAgICAgLy8gV2UncmUgZG9uZSAtIHRlcm1pbmF0ZSB0aGUgc291cmNlIHF1aWV0bHkgKGllIHRoaXMgaXMgbm90IGFuIGV4Y2VwdGlvbiBhcyBpdCdzIGV4cGVjdGVkLCBidXQgd2UncmUgZG9uZSlcbiAgICAgICAgICAgICAgICB0ID0gW107XG4gICAgICAgICAgICAgICAgY29uc3QgbXNnID0gXCJFbGVtZW50KHMpIGhhdmUgYmVlbiByZW1vdmVkIGZyb20gdGhlIGRvY3VtZW50OiBcIiArIGluc2VydGlvblN0YWNrO1xuICAgICAgICAgICAgICAgIGFwLnJldHVybj8uKG5ldyBFcnJvcihtc2cpKTtcbiAgICAgICAgICAgICAgICByZXR1cm47XG4gICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgICBpZiAoREVCVUcgJiYgbm90WWV0TW91bnRlZCAmJiBjcmVhdGVkQXQgJiYgY3JlYXRlZEF0IDwgRGF0ZS5ub3coKSkge1xuICAgICAgICAgICAgICAgIGNyZWF0ZWRBdCA9IE51bWJlci5NQVhfU0FGRV9JTlRFR0VSO1xuICAgICAgICAgICAgICAgIGNvbnNvbGUud2FybihgQXN5bmMgZWxlbWVudCBub3QgbW91bnRlZCBhZnRlciA1IHNlY29uZHMuIElmIGl0IGlzIG5ldmVyIG1vdW50ZWQsIGl0IHdpbGwgbGVhay5gLGNyZWF0ZWRCeSwgdC5tYXAobG9nTm9kZ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BwbGFpbk9iamVjdFByb3RvdHlwZSB8fCAhT2JqZWN0LmdldFByb3RvdHlwZU9mKHZhbHVlKSkge1xuICAgICAgICAgICAgICAgICAgICAvLyBBIHBsYWluIG9iamVjdCBjYW4gYmUgZGVlcC1jb3BpZWQgYnkgZmllbGRcbiAgICAgICAgICAgICAgICAgICAgZGVlcERlZmluZShzcmNEZXNjLnZhbHVlID0ge30sIHZhbHVlKTtcbiAgICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAoQXJyYXkuaXNBcnJheSh2YWx1ZSkpIHtcbiAgICAgICAgICAgICAgICAgICAgLy8gQW4gYXJyYXkgY2FuIGJlIGRlZXAgY29waWVkIGJ5IGluZGV4XG4gICAgICAgICAgICAgICAgICAgIGRlZXBEZWZpbmUoc3JjRGVzYy52YWx1ZSA9IFtdLCB2YWx1ZSk7XG4gICAgICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICAvLyBPdGhlciBvYmplY3QgbGlrZSB0aGluZ3MgKHJlZ2V4cHMsIGRhdGVzLCBjbGFzc2VzLCBldGMpIGNhbid0IGJlIGRlZXAtY29waWVkIHJlbGlhYmx5XG4gICAgICAgICAgICAgICAgICAgIGNvbnNvbGUud2FybihgRGVjbGFyZWQgcHJvcGV0eSAnJHtrfScgaXMgbm90IGEgcGxhaW4gb2JqZWN0IGFuZCBtdXN0IGJlIGFzc2lnbmVkIGJ5IHJlZmVyZW5jZSwgcG9zc2libHkgcG9sbHV0aW5nIG90aGVyIGluc3RhbmNlcyBvZiB0aGlzIHRhZ2AsIGQsIHZhbHVlKTtcbiAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KGQsIGssIHNyY0Rlc2MpO1xuICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgIGlmICh2YWx1ZSBpbnN0YW5jZW9mIE5vZGUpIHtcbiAgICAgICAgICAgICAgICAgIGNvbnNvbGUuaW5mbyhcIkhhdmluZyBET00gTm9kZXMgYXMgcHJvcGVydGllcyBvZiBvdGhlciBET00gTm9kZXMgaXMgYSBiYWQgaWRlYSBhcyBpdCBtYWtlcyB0aGUgRE9NIHRyZWUgaW50byBhIGN5Y2xpYyBncmFwaC4gWW91IHNob3VsZCByZWZlcmVuY2Ugbm9kZXMgYnkgSUQgb3IgYXMgYSBjaGlsZFwiLCBrLCBsb2dOb2RlKHZhbHVlKSk7XG4gICAgICAgICAgICAgICAgICBkW2tdID0gdmFsdWU7XG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgIGlmIChkW2tdICE9PSB2YWx1ZSkge1xuICAgICAgICAgICAgICAgICAgICAvLyBOb3RlIC0gaWYgd2UncmUgY29weWluZyB0byBhbiBhcnJheSBvZiBkaWZmZXJlbnQgbGVuZ3RoXG4gICAgICAgICAgICAgICAgICAgIC8vIHdlJ3JlIGRlY291cGxpbmcgY29tbW9uIG9iamVjdCByZWZlcmVuY2VzLCBzbyB3ZSBuZWVkIGEgY2xlYW4gb2JqZWN0IHRvXG4gICAgICAgICAgICAgICAgICAgIC8vIGFzc2lnbiBpbnRvXG4gICAgICAgICAgICAgICAgICAgIGlmIChBcnJheS5pc0FycmF5KGRba10pICYmIGRba10ubGVuZ3RoICE9PSB2YWx1ZS5sZW5ndGgpIHtcbiAgICAgICAgICAgICAgICAgICAgICBpZiAodmFsdWUuY29uc3RydWN0b3IgPT09IE9iamVjdCB8fCB2YWx1ZS5jb25zdHJ1Y3RvciA9PT0gQXJyYXkpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGRlZXBEZWZpbmUoZFtrXSA9IG5ldyAodmFsdWUuY29uc3RydWN0b3IpLCB2YWx1ZSk7XG4gICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIC8vIFRoaXMgaXMgc29tZSBzb3J0IG9mIGNvbnN0cnVjdGVkIG9iamVjdCwgd2hpY2ggd2UgY2FuJ3QgY2xvbmUsIHNvIHdlIGhhdmUgdG8gY29weSBieSByZWZlcmVuY2VcbiAgICAgICAgICAgICAgICAgICAgICAgIGRba10gPSB2YWx1ZTtcbiAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgICAgLy8gVGhpcyBpcyBqdXN0IGEgcmVndWxhciBvYmplY3QsIHNvIHdlIGRlZXBEZWZpbmUgcmVjdXJzaXZlbHlcbiAgICAgICAgICAgICAgICAgICAgICBkZWVwRGVmaW5lKGRba10sIHZhbHVlKTtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgLy8gVGhpcyBpcyBqdXN0IGEgcHJpbWl0aXZlIHZhbHVlLCBvciBhIFByb21pc2VcbiAgICAgICAgICAgICAgaWYgKHNba10gIT09IHVuZGVmaW5lZClcbiAgICAgICAgICAgICAgICBkW2tdID0gc1trXTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICB9XG4gICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgLy8gQ29weSB0aGUgZGVmaW5pdGlvbiBvZiB0aGUgZ2V0dGVyL3NldHRlclxuICAgICAgICAgIE9iamVjdC5kZWZpbmVQcm9wZXJ0eShkLCBrLCBzcmNEZXNjKTtcbiAgICAgICAgfVxuICAgICAgfSBjYXRjaCAoZXg6IHVua25vd24pIHtcbiAgICAgICAgY29uc29sZS53YXJuKCBcImRlZXBBc3NpZ25cIiwgaywgc1trXSwgZXgpO1xuICAgICAgICB0aHJvdyBleDtcbiAgICAgIH1cbiAgICB9XG4gIH1cblxuICBmdW5jdGlvbiB1bmJveChhOiB1bmtub3duKTogdW5rbm93biB7XG4gICAgY29uc3QgdiA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WYgKCdnZXQnIGluIGRlc2MpIHJldHVybiAwLjU7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICByZXR1cm4gMDtcbiAgICAgICAgICB9KTtcbiAgICAgICAgfVxuICAgICAgICBmb3IgKGNvbnN0IFtrLCBzcmNEZXNjXSBvZiBzb3VyY2VFbnRyaWVzKSB7XG4gICAgICAgICAgdHJ5IHtcbiAgICAgICAgICAgIGlmICgndmFsdWUnIGluIHNyY0Rlc2MpIHtcbiAgICAgICAgICAgICAgY29uc3QgdmFsdWUgPSBzcmNEZXNjLnZhbHVlO1xuICAgICAgICAgICAgICBpZiAoaXNBc3luY0l0ZXI8dW5rbm93bj4odmFsdWUpKSB7XG4gICAgICAgICAgICAgICAgYXNzaWduSXRlcmFibGUodmFsdWUsIGspO1xuICAgICAgICAgICAgICB9IGVsc2UgaWYgKGlzUHJvbWlzZUxpa2UodmFsdWUpKSB7XG4gICAgICAgICAgICAgICAgdmFsdWUudGhlbih2ID0+IHtcbiAgICAgICAgICAgICAgICAgIGlmICh2ICYmIHR5cGVvZiB2ID09PSAnb2JqZWN0Jykge1xuICAgICAgICAgICAgICAgICAgICAvLyBTcGVjaWFsIGNhc2U6IHRoaXMgcHJvbWlzZSByZXNvbHZlZCB0byBhbiBhc3luYyBpdGVyYXRvclxuICAgICAgICAgICAgICAgICAgICBpZiAoaXNBc3luY0l0ZXI8dW5rbm93bj4odikpIHtcbiAgICAgICAgICAgICAgICAgICAgICBhc3NpZ25JdGVyYWJsZSh2LCBrKTtcbiAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgICBhc3NpZ25PYmplY3Qodiwgayk7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgIGlmIChzW2tdICE9PSB1bmRlZmluZWQpXG4gICAgICAgICAgICAgICAgICAgICAgZFtrXSA9IHY7XG4gICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfSwgZXJyb3IgPT4gY29uc29sZS5sb2coXCJGYWlsZWQgdG8gc2V0IGF0dHJpYnV0ZVwiLCBlcnJvcikpO1xuICAgICAgICAgICAgICB9IGVsc2UgaWYgKCFpc0FzeW5jSXRlcjx1bmtub3duPih2YWx1ZSkpIHtcbiAgICAgICAgICAgICAgICAvLyBUaGlzIGhhcyBhIHJlYWwgdmFsdWUsIHdoaWNoIG1pZ2h0IGJlIGFuIG9iamVjdFxuICAgICAgICAgICAgICAgIGlmICh2YWx1ZSAmJiB0eXBlb2YgdmFsdWUgPT09ICdvYmplY3QnICYmICFpc1Byb21pc2VMaWtlKHZhbHVlKSlcbiAgICAgICAgICAgICAgICAgIGFzc2lnbk9iamVjdCh2YWx1ZSwgayk7XG4gICAgICAgICAgICAgICAgZWxzZSB7XG4gICAgICAgICAgICAgICAgICBpZiAoc1trXSAhPT0gdW5kZWZpbmVkKVxuICAgICAgICAgICAgICAgICAgICBkW2tdID0gc1trXTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgIC8vIENvcHkgdGhlIGRlZmluaXRpb24gb2YgdGhlIGdldHRlci9zZXR0ZXJcbiAgICAgICAgICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KGQsIGssIHNyY0Rlc2MpO1xuICAgICAgICAgICAgfVxuICAgICAgICAgIH0gY2F0Y2ggKGV4OiB1bmtub3duKSB7XG4gICAgICAgICAgICBjb25zb2xlLndhcm4oIFwiYXNzaWduUHJvcHNcIiwgaywgc1trXSwgZXgpO1xuICAgICAgICAgICAgdGhyb3cgZXg7XG4gICAgICAgICAgfVxuICAgICAgICB9XG5cbiAgICAgICAgZnVuY3Rpb24gYXNzaWduSXRlcmFibGUodmFsdWU6IEFzeW5jSXRlcmFibGU8dW5rbm93bj4gfCBBc3luY0l0ZXJhdG9yPHVua25vd24sIGFueSwgdW5kZWZ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7XG4gICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgY29uc3QgbW91bnRlZCA9IGJhc2UuaXNDb25uZWN0ZWQ7XG4gICAgICAgICAgICAgIC8vIElmIHdlIGhhdmUgYmVlbiBtb3VudGVkIGJlZm9yZSwgYml0IGFyZW4ndCBub3csIHJlbW92ZSB0aGUgY29uc3VtZXJcbiAgICAgICAgICAgICAgaWYgKHJlbW92ZWROb2RlcyhiYXNlKSB8fCAoIW5vdFlldE1vdW50ZWQgJiYgIW1vdW50ZWQpKSB7XG4gICAgICAgICAgICAgICAgY29uc29sZS5pbmZvKGBFbGVtZW50IGRvZXMgbm90IGV4aXN0IGluIGRvY3VtZW50IHdoZW4gc2V0dGluZyBhc3luYyBhdHRyaWJ1dGUgJyR7a30nIHRvOlxcbiR7bG9nTm9kZShiYXNlKX1gKTtcbiAgICAgICAgICAgICAgICBhcC5yZXR1cm4/LigpO1xuICAgICAgICAgICAgICAgIHJldHVybjtcbiAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICBpZiAobW91bnRlZCkgbm90WWV0TW91bnRlZCA9IGZhbHNlO1xuICAgICAgICAgICAgICBpZiAobm90WWV0TW91bnRlZCAmJiBjcmVhdGVkQXQgJiYgY3JlYXRlZEF0IDwgRGF0ZS5ub3coKSkge1xuICAgICAgICAgICAgICAgIGNyZWF0ZWRBdCA9IE51bWJlci5NQVhfU0FGRV9JTlRFR0VSO1xuICAgICAgICAgICAgICAgIGNvbnNvbGUud2FybihgRWxlbWVudCB3aXRoIGFzeW5jIGF0dHJpYnV0ZSAnJHtrfScgbm90IG1vdW50ZWQgYWZ0ZXIgNSBzZWNvbmRzLiBJZiBpdCBpcyBuZXZlciBtb3VudGVkLCBpdCB3aWxsIGxlYWsuXFxuRWxlbWVudCBjb250YWluczogJHtsb2dOb2RlKGJhc2UpfVxcbiR7Y3JlYXRlZEJ5fWApO1xuICAgICAgICAgICAgICB9XG5cbiAgICAgICAgICAgICAgYXAubmV4dCgpLnRoZW4od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IGRpZmZlcmVudCBsZW5ndGgpLFxuICAgICAgICAgICAgLy8gd2UncmUgZGVjb3VwbGluZyBjb21tb24gb2JqZWN0IHJlZmVyZW5jZXMsIHNvIHdlIG5lZWQgYSBjbGVhbiBvYmplY3QgdG9cbiAgICAgICAgICAgIC8vIGFzc2lnbiBpbnRvXG4gICAgICAgICAgICBpZiAoIShrIGluIGQpIHx8IGRba10gPT09IHZhbHVlIHx8IChBcnJheS5pc0FycmF5KGRba10pICYmIGRba10ubGVuZ3RoICE9PSB2YWx1ZS5sZW5ndGgpKSB7XG4gICAgICAgICAgICAgIGlmICh2YWx1ZS5jb25zdHJ1Y3RvciA9PT0gT2JqZWN0IHx8IHZhbHVlLmNvbnN0cnVjdG9yID09PSBBcnJheSkge1xuICAgICAgICAgICAgICAgIGNvbnN0IGNvcHkgPSBuZXcgKHZhbHVlLmNvbnN0cnVjdG9yKTtcbiAgICAgICAgICAgICAgICBhc3NpZ24oY29weSwgdmFsdWUpO1xuICAgICAgICAgICAgICAgIGRba10gPSBjb3B5O1xuICAgICAgICAgICAgICAgIC8vYXNzaWduKGRba10sIHZhbHVlKTtcbiAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAvLyBUaGlzIGlzIHNvbWUgc29ydCBvZiBjb25zdHJ1Y3RlZCBvYmplY3QsIHdoaWNoIHdlIGNhbid0IGNsb25lLCBzbyB3ZSBoYXZlIHRvIGNvcHkgYnkgcmVmZXJlbmNlXG4gICAgICAgICAgICAgICAgZFtrXSA9IHZhbHVlO1xuICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICBpZiAoT2JqZWN0LmdldE93blByb3BlcnR5RGVzY3JpcHRvcihkLCBrKT8uc2V0KVxuICAgICAgICAgICAgICAgIGRba10gPSB2YWx1ZTtcblxuICAgICAgICAgICAgICBlbHNlXG4gICAgICAgICAgICAgICAgYXNzaWduKGRba10sIHZhbHVlKTtcbiAgICAgICAgIC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GJlZW4gcmVhc3NpZ25lZCB3aXRoIG5vIGNoYW5nZSwganVzdCBpZ25vcmUgaXQsIGFzIHdlJ3JlIGFscmVhZHkgY29uc3VtaW5nIGl0XG4gICAgICAgICAgaWYgKHBpcGVkID09PSB2KVxuICAgICAgICAgICAgcmV0dXJuO1xuXG4gICAgICAgICAgcGlwZWQgPSB2O1xuICAgICAgICAgIGxldCBzdGFjayA9IERFQlVHID8gbmV3IEVycm9yKCkgOiB1bmRlZmluZWQ7XG4gICAgICAgICAgaWYgKERFQlVHKVxuICAgICAgICAgICAgY29uc29sZS5pbmZvKG5ldyBFcnJvcihgSXRlcmFibGUgXCIke25hbWUudG9TdHJpbmcoKX1cIiBoYXMgYmVlbiBhc3NpZ25lZCB0byBjb25zdW1lIGFub3RoZXIgaXRlcmF0b3IuIERpZCB5b3UgbWVhbiB0byBkZWNsYXJlIGl0P2ApKTtcbiAgICAgICAgICBjb25zdW1lLmNhbGwodix5ID0+IHtcbiAgICAgICAgICAgIGlmICh2ICE9PSBwaXBlZCkge1xuICAgICAgICAgICAgICAvLyBXZSdyZSBiZWluZyBwaXBlZCBmcm9tIHNvbWV0aGluZyBlbHNlLiBXZSB3YW50IHRvIHN0b3AgdGhhdCBvbmUgYW5kIGdldCBwaXBlZCBmcm9tIHRoaXMgb25lXG4gICAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcihgUGlwZWQgaXRlcmFibGUgXCIke25hbWUudG9TdHJpbmcoKX1cIiBoYXMgYmVlbiByZXBsYWNlZCBieSBhbm90aGVyIGl0ZXJhdG9yYCx7IGNhdXNlOiBzdGFjayB9KTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHB1c2goeT8udmFsdWVPZigpIGFzIFYpXG4gICAgICAgICAgfSlcbiAgICAgICAgICAuY2F0Y2goZXggPT4gY29uc29sZS5pbmZvKGV4KSlcbiAgICAgICAgICAuZmluYWxseSgoKSA9PiAodiA9PT0gcGlwZWQpICYmIChwaXBlZCA9IHVuZGVma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dKVxuICAgICAgICAqL1xuICAgICAgICBpZiAoIShTeW1ib2wuYXN5bmNJdGVyYXRvciBpbiBhKSkge1xuICAgICAgICAgIC8vIEB0cy1leHBlY3QtZXJyb3IgLSBJZ25vcmUgaXMgdGhlIElOSVRJQUwgdmFsdWVcbiAgICAgICAgICBpZiAoYm94ZWRPYmplY3QgPT09IElnbm9yZSkge1xuICAgICAgICAgICAgaWYgKERFQlVHKVxuICAgICAgICAgICAgICBjb25zb2xlLmluZm8oYFRoZSBpdGVyYWJsZSBwcm9wZXJ0eSAnJHtuYW1lLnRvU3RyaW5nKCl9JyBvZiB0eXBlIFwib2JqZWN0XCIgd2lsbCBiZSBzcHJlYWQgdG8gcHJldmVudCByZS1pbml0aWFsaXNhdGlvbi5cXG4ke25ldyBFcnJvcigpLnN0YWNrPy5zbGljZSg2KX1gKTtcbiAgICAgICAgICAgIGlmIChBcnJheS5pc0FycmF5KGEpKVxuICAgICAgICAgICAgICBib3hlZE9iamVjdCA9IE9iamVjdC5kZWZpbmVQcm9wZXJ0aWVzKFsuLi5hXSBhcyBWLCBwZHMpO1xuICAgICAgICAgICAgZWxzZVxuICAgICAgICAgICAgICBib3hlZE9iamVjdCA9IE9iamVjdC5kZWZpbmVQcm9wZXJ0aWVzKHsgLi4uKGEgYXMgVikgfSwgcGRzKTtcbiAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgT2JqZWN0LmFzc2lnbihib3hlZE9iamVjdCwgYSk7XG4gICAgICAgICAgfVxuICAgICAgICAgIGlmIChib3hlZE9iamVjdFtJdGVyYWJpbGl0eV0gPT09ICdzaGFsbG93Jykge1xuICAgICAgICAgICAgYm94ZWRPYmplY3QgPSBPYmplY3QuZGVmaW5lUHJvcGVydGllcyhib3hlZE9iamVjdCwgcGRzKTtcbiAgICAgICAgICAgIHJldHVybiBib3hlZE9iamVjdDtcbiAgICAgICAgICB9XG5cbiAgICAgICAgICAvLyBQcm94eSB0aGUgcmVzdWx0IHNvIHdlIGNhbiB0cmFjayBtZW1iZXJzIG9mIHRoZSBpdGVyYWJsZSBvYmplY3RcbiAgICAgICAgICBjb25zdCBleHRyYUJveGVkOiB0eXBlb2YgYm94ZWRPYmplY3QgPSBuZXcgUHJveHkoYm94ZWRPYmplY3QsIHtcbiAgICAgICAgICAgIGRlbGV0ZVByb3BlcnR5KHRhcmdldCwga2V5KSB7XG4gICAgICAgICAgICAgIGlmIChSZWZsZWN0LmRlbGV0ZVByb3BlcnR5KHRhcmdldCwga2V5KSkge1xuICAgICAgICAgICAgICAgIC8vIEB0cy1pZ25vcmUgLSBGaXhcbiAgICAgICAgICAgICAgICBwdXNoKG9ialtuYW1lXSk7XG4gICAgICAgICAgICAgICAgcmV0dXJuIHRydWU7XG4gICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgcmV0dXJuIGZhbHNlO1xuICAgICAgICAgICAgfSxcbiAgICAgICAgICAgIC8vIEltcGxlbWVudCB0aGUgbG9naWMgdGhhdCBmaXJlcyB0aGUgaXRlcmF0b3IgYnkgcmUtYXNzaWduaW5nIHRoZSBpdGVyYWJsZSB2aWEgaXQncyBzZXR0ZXJcbiAgICAgICAgICAgIHNldCh0YXJnZXQsIGtleSwgdmFsdWUsIHJlY2VpdmVyKSB7XG4gICAgICAgICAgICAgIGlmIChSZWZsZWN0LnNldCh0YXJnZXQsIGtleSwgdmFsdWUsIHJlY2VpdmVyKSkge1xuICAgICAgICAgICAgICAgIC8vIEB0cy1pZ25vcmUgLSBGaXhcbiAgICAgICAgICAgICAgICBwdXNoKG9ialtuYW1lXSk7XG4gICAgICAgICAgICAgICAgcmV0dXJuIHRydWU7XG4gICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgcmV0dXJuIGZhbHNlO1xuICAgICAgICAgICAgfSxcbiAgICAgICAgICAgIC8vIEltcGxlbWVudCB0aGUgbG9naWMgdGhhdCByZXR1cm5zIGEgbWFwcGVkIGl0ZXJhdG9yIGZvciB0aGUgc3BlY2lmaWVkIGZpZWxkXG4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FyZ2V0W2tleV0gPSB1bmRlZmluZWQ7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIGNvbnN0IHJlYWxWYWx1ZSA9IFJlZmxlY3QuZ2V0KGJveGVkT2JqZWN0IGFzIEV4Y2x1ZGU8dHlwZW9mIGJveGVkT2JqZWN0LCB0eXBlb2YgSWdub3JlPiwga2V5LCByZWNlaXZlcik7XG4gICAgICAgICAgICAgICAgY29uc3QgcHJvcHMgPSBPYmplY3QuZ2V0T3duUHJvcGVydHlEZXNjcmlwdG9ycyhcbiAgICAgICAgICAgICAgICAgICAgYm94ZWRPYmplY3QubWFwKChvLHApID0+IHtcbiAgICAgICAgICAgICAgICAgICAgY29uc3Qgb3YgPSBvPy5ba2V5IGFzIGtleW9mIHR5cGVvZiBvXT8udmFsdWVPZigpO1xuICAgICAgICAgICAgICAgICAgICBjb25zdCBwdiA9IHA/LnZhbHVlT2YoKTtcbiAgICAgICAgICAgICAgICAgICAgaWYgKHR5cGVvZiBvdiA9PT0gdHlwZW9mIHB2ICYmIG92ID09IHB2KVxuICAgICAgICAgICAgICAgICAgICAgIHJldHVybiBJZ25vcmU7XG4gICAgICAgICAgICAgICAgICAgIHJldHVybiBvdjtcbiAgICAgICAgICAgICAgICAgIH0pXG4gICAgICAgICAgICAgICAgKTtcbiAgICAgICAgICAgICAgICAoUmVmbGVjdC5vd25LZXlzKHByb3BzKSBhcyAoa2V5b2YgdHlwZW9mIHByb3BzKVtdKS5mb3JFYWNoKGsgPT4gcHJvcHNba10uZW51bWVyYWJsZSA9IGZhbHNlKTtcbiAgICAgICAgICAgICAgICBjb25zdCBhaWIgPSBib3gocmVhbFZhbHVlLCBwcm9wcyk7XG4gICAgICAgICAgICAgICAgUmVmbGVjdC5zZXQodGFyZ2V0LCBrZXksIGFpYik7XG4gICAgICAgICAgICAgICAgcmV0dXJuIGFpYjtcbiAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICByZXR1cm4gUmVmbGVjdC5nZXQodGF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ICAgfVxuXG4gICAgICByZXR1cm4gKGZ1bmN0aW9uIHN0ZXAoKTogUHJvbWlzZTxJdGVyYXRvclJlc3VsdDxDb21iaW5lZEl0ZXJhYmxlVHlwZTxTPj4+IHtcbiAgICAgICAgcmV0dXJuIFByb21pc2UucmFjZShwYykudGhlbigoeyBpZHgsIGssIGlyIH0pID0+IHtcbiAgICAgICAgICBpZiAoaXIuZG9uZSkge1xuICAgICAgICAgICAgcGNbaWR4XSA9IGZvcmV2ZXI7XG4gICAgICAgICAgICBhY3RpdmUgLT0gMTtcbiAgICAgICAgICAgIGlmICghYWN0aXZlKVxuICAgICAgICAgICAgICByZXR1cm4geyBkb25lOiB0cnVlLCB2YWx1ZTogdW5kZWZpbmVkIH07XG4gICAgICAgICAgICByZXR1cm4gc3RlcCgpO1xuICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAvLyBAdHMtaWdub3JlXG4gICAgICAgICAgICBhY2N1bXVsYXRlZFtrXSA9IGlyLnZhbHVlO1xuICAgICAgICAgICAgcGNbaWR4XSA9IHNpW2lkeF0ubmV4dCgpLnRoZW4oaXIgPT4gKHsgaWR4LCBrLCBpciB9KSk7XG4gICAgICAgICAgfVxuICAgICAgICAgIGlmIChvcHRzLmlnbm9yZVBhcnRpYWwpIHtcbiAgICAgICAgICAgIGlmIChPYmplY3Qua2V5cyhhY2N1bXVsYXRlZCkubGVuZ3RoIDwgT2JqZWN0LmtleXMoc3JjKS5sZW5ndGgpXG4gICAgICAgICAgICAgIHJldHVybiBzdGVwKCk7XG4gICAgICAgICAgfVxuICAgICAgICAgIHJldHVybiB7IGRvbmU6IGZhbHNlLCB2YWx1ZTogYWNjdW11bGF0ZWQgfTtcbiAgICAgICAgfSlcbiAgICAgIH0pKCk7XG4gICAgfSxcbiAgICByZXR1cm4odj86IGFueSl7XG4gICAgICBwYy5mb3JFYWNoKChwLGlkeCkgPT4ge1xuICAgICAgICBpZiAocCAhPT0gZm9yZXZlcikge1xuICAgICAgICAgIH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0l0ZXJhdG9yXSgpIHtcbiAgICAgIHJldHVybiBmYWk7XG4gICAgfSxcblxuICAgIG5leHQoLi4uYXJnczogW10gfCBbdW5kZWZpbmVkXSkge1xuICAgICAgaWYgKGluaXRpYWxWYWx1ZSAhPT0gSWdub3JlKSB7XG4gICAgICAgIGNvbnN0IGluaXQgPSBQcm9taXNlLnJlc29sdmUoeyBkb25lOiBmYWxzZSwgdmFsdWU6IGluaXRpYWxWYWx1ZSB9KTtcbiAgICAgICAgaW5pdGlhbFZhbHVlID0gSWdub3JlO1xuICAgICAgICByZXR1cm4gaW5pdDtcbiAgICAgIH1cblxuICAgICAgcmV0dXJuIG5ldyBQcm9taXNlPEl0ZXJhdG9yUmVzdWx0PFI+PihmdW5jdGlvbiBzdGVwKHJlc29sdmUsIHJlamVjdCkge1xuICAgICAgICBpZiAoIWFpKVxuICAgICAgICAgIGFpID0gc291cmNlW1N5bWJvbC5hc3luY0l0ZXJhdG9yXSEoKTtcbiAgICAgICAgYWkubmV4dCguLi5hcmdzKS50aGVuKFxuICAgICAgICAgIHAgPT4gcC5kb25lXG4gICAgICAgICAgICA/IHJlc29sdmUocClcbiAgICAgICAgICAgIDogcmVzb2x2ZVN5bmMoZm4ocC52YWx1ZSwgcHJldiksXG4gICAgICAgICAgICAgIGYgPT4gZiA9PT0gSWdub3JlXG4gICAgICAgICAgICAgICAgPyBzdGVwKHJlc29sdmUsIHJlamVjdClcbiAgICAgICAgICAgICAgICA6IHJlc29sdmUoeyBkb25lOiBmYWxzZSwgdmFsdWU6IHByZXYgPSBmIH0pLFxuICAgICAgICAgICAgICBleCA9PiB7XG4gICAgICAgICAgICAgICAgLy8gVGhlIGZpbHRlciBmdW5jdGlvbiBmYWlsZWQuLi5cbiAgICAgICAgICAgICAgICBhaS50aHJvdyA/IGFpLnRocm93KGV4KSA6IGFpLnJldHVybj8uKGV4KSAvLyBUZXJtaW5hdGUgdGhlIHNvdXJjZSAtIGZvciBub3cgd2UgaWdub3JlIHRoZSByZ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3pCO0FBQUEsRUFDRjtBQUVBLE1BQU0sU0FBUyxvQkFBSSxJQUFZO0FBQ3hCLFdBQVMsZ0JBQWdCLE1BQTJCLEtBQStCO0FBQ3hGLFdBQU8sUUFBUTtBQUNmLFVBQU0sT0FBTyx1QkFBTyxPQUFPLElBQUk7QUFDL0IsUUFBSSxLQUFLLGtCQUFrQjtBQUN6QixXQUFLLGlCQUFpQixNQUFNLEVBQUUsUUFBUSxTQUFVLEtBQUs7QUFDbkQsWUFBSSxJQUFJLElBQUk7QUFDVixjQUFJLENBQUMsSUFBSyxJQUFJLEVBQUU7QUFDZCxnQkFBSyxJQUFJLEVBQUUsSUFBSTtBQUFBLG1CQUNSLE9BQU87QUFDZCxnQkFBSSxDQUFDLE9BQU8sSUFBSSxJQUFJLEVBQUUsR0FBRztBQUN2QixxQkFBTyxJQUFJLElBQUksRUFBRTtBQUNqQix1QkFBUTtBQUFBLGdCQUFLO0FBQUEsZ0JBQWlDLElBQUk7QUFBQTtBQUFBLGNBQTBCO0FBQUEsWUFDOUU7QUFBQSxVQUNGO0FBQUEsUUFDRjtBQUFBLE1BQ0YsQ0FBQztBQUFBLElBQ0g7QUFDQSxXQUFPO0FBQUEsRUFDVDsiLAogICJuYW1lcyI6IFsidiIsICJhIiwgInJlc3VsdCIsICJleCIsICJpciIsICJpc01pc3NpbmciLCAibWVyZ2VkIiwgImMiLCAibiIsICJ2YWx1ZSIsICJpc0FuY2VzdHJhbCIsICJjaGlsZHJlbiJdCn0K diff --git a/module/dist/ai-ui.min.cjs b/module/dist/ai-ui.min.cjs index cf0cb7b..ebab268 100644 --- a/module/dist/ai-ui.min.cjs +++ b/module/dist/ai-ui.min.cjs @@ -1,12 +1,12 @@ -"use strict";var ce=Object.defineProperty;var Re=Object.getOwnPropertyDescriptor;var He=Object.getOwnPropertyNames;var Le=Object.prototype.hasOwnProperty;var ve=(e,t)=>{for(var n in t)ce(e,n,{get:t[n],enumerable:!0})},Ue=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let u of He(t))!Le.call(e,u)&&u!==n&&ce(e,u,{get:()=>t[u],enumerable:!(r=Re(t,u))||r.enumerable});return e};var We=e=>Ue(ce({},"__esModule",{value:!0}),e);var it={};ve(it,{Iterators:()=>me,UniqueID:()=>ne,enableOnRemovedFromDOM:()=>De,getElementIdMap:()=>je,tag:()=>Ne,when:()=>ae});module.exports=We(it);var O=globalThis.DEBUG=="*"||globalThis.DEBUG==!0||globalThis.DEBUG?.match(/(^|\W)AI-UI(\W|$)/)||!1;var J=5e3,E={log(...e){O&&console.log("(AI-UI) LOG:",...e)},warn(...e){O&&console.warn("(AI-UI) WARN:",...e)},info(...e){O&&console.debug("(AI-UI) INFO:",...e)}};var xe=e=>{};function ue(){let e=xe,t=xe,n=new Promise((...r)=>[e,t]=r);if(n.resolve=e,n.reject=t,O){let r=new Error().stack;n.catch(u=>u instanceof Error||u?.value instanceof Error?E.log("Deferred rejection",u,"allocated at ",r):void 0)}return n}function de(e){return e&&typeof e=="object"||typeof e=="function"}function $(e){return de(e)&&"then"in e&&typeof e.then=="function"}var me={};ve(me,{Ignore:()=>N,Iterability:()=>X,asyncIterator:()=>ye,augmentGlobalAsyncGenerators:()=>Xe,combine:()=>Ae,debounceQueueIteratableIterator:()=>we,defineIterableProperty:()=>be,filterMap:()=>V,generatorHelpers:()=>Qe,isAsyncIter:()=>G,isAsyncIterable:()=>_,isAsyncIterator:()=>Y,iterableHelpers:()=>W,merge:()=>z,queueIteratableIterator:()=>pe});var X=Symbol("Iterability");function Y(e){return typeof e?.next=="function"}function _(e){return de(e)&&Symbol.asyncIterator in e&&typeof e[Symbol.asyncIterator]=="function"}function G(e){return _(e)||Y(e)}function ye(e){if(_(e))return e[Symbol.asyncIterator]();if(Y(e))return e;throw new Error("Not as async provider")}var oe={filterMap(e,t=N){return V(this,e,t)},map:qe,filter:Ke,unique:Be,waitFor:Ze,multi:Je,initially:Ye,consume:Se,merge(...e){return z(this,...e)},combine(e){return Ae(Object.assign({_this:this},e))}},fe=[...Object.getOwnPropertySymbols(oe),...Object.keys(oe)];function $e(e,...t){for(let n of t)for(let[r,u]of Object.entries(Object.getOwnPropertyDescriptors(n)))Object.defineProperty(e,r,{...u,enumerable:!1});return e}var C=Symbol("pending"),U=Symbol("items");function Pe(e=()=>{}){let t={[C]:[],[U]:[],[Symbol.asyncIterator](){return t},next(){if(t[U]?.length)return Promise.resolve({done:!1,value:t[U].shift()});let n=ue();return n.catch(r=>{}),t[C].unshift(n),n},return(n){let r={done:!0,value:void 0};if(t[C]){try{e()}catch{}for(;t[C].length;)t[C].pop().resolve(r);t[U]=t[C]=null}return Promise.resolve(r)},throw(...n){let r={done:!0,value:n[0]};if(t[C]){try{e()}catch{}for(;t[C].length;)t[C].pop().reject(r);t[U]=t[C]=null}return Promise.reject(r)},get length(){return t[U]?t[U].length:-1},push(n){return t[C]?(t[C].length?t[C].pop().resolve({done:!1,value:n}):t[U]?t[U].push(n):E.log("Discarding queue push as there are no consumers"),!0):!1}};return W(t)}var re=Symbol("inflight");function Fe(e=()=>{}){let t=Pe(e);return t[re]=new Set,t.push=function(n){if(!t[C])return!1;if(t[re].has(n))return!0;if(t[re].add(n),t[C].length){let r=t[C].pop();r.finally(()=>t[re].delete(n)),r.resolve({done:!1,value:n})}else t[U]?t[U].find(r=>r===n)||t[U].push(n):E.log("Discarding queue push as there are no consumers");return!0},t}var pe=Pe,we=Fe;function be(e,t,n){let r=()=>{r=()=>v;let a=we(),g=a.multi(),v=g[Symbol.asyncIterator]();return s[Symbol.asyncIterator]={value:g[Symbol.asyncIterator],enumerable:!1,writable:!1},f=a.push,fe.forEach(Q=>s[Q]={value:v[Q],enumerable:!1,writable:!1}),Object.defineProperties(m,s),v};function u(a){return{[a]:function(...g){return r(),m[a].apply(this,g)}}[a]}let s={[Symbol.asyncIterator]:{enumerable:!1,writable:!0,value:r}};fe.forEach(a=>s[a]={enumerable:!1,writable:!0,value:u(a)});let f=a=>(r(),f(a));typeof n=="object"&&n&&X in n&&(s[X]=Object.getOwnPropertyDescriptor(n,X));let m=d(n,s),i;return Object.defineProperty(e,t,{get(){return m},set(a){if(a!==m)if(_(a)){if(i===a)return;i=a;let g=O?new Error:void 0;O&&E.info(new Error(`Iterable "${t.toString()}" has been assigned to consume another iterator. Did you mean to declare it?`)),Se.call(a,v=>{if(a!==i)throw new Error(`Piped iterable "${t.toString()}" has been replaced by another iterator`,{cause:g});f(v?.valueOf())}).catch(v=>E.info(v)).finally(()=>a===i&&(i=void 0));return}else{if(i)throw new Error(`Iterable "${t.toString()}" is already piped from another iterator`);m=d(a,s)}f(a?.valueOf())},enumerable:!0}),e;function d(a,g){let v=N;if(a==null)return Object.create(null,{...g,valueOf:{value(){return a},writable:!0},toJSON:{value(){return a},writable:!0}});switch(typeof a){case"object":return Symbol.asyncIterator in a?a:(v===N?(O&&E.info(`The iterable property '${t.toString()}' of type "object" will be spread to prevent re-initialisation. -${new Error().stack?.slice(6)}`),Array.isArray(a)?v=Object.defineProperties([...a],g):v=Object.defineProperties({...a},g)):Object.assign(v,a),v[X]==="shallow"?(v=Object.defineProperties(v,g),v):new Proxy(v,{deleteProperty(H,D){return Reflect.deleteProperty(H,D)?(f(e[t]),!0):!1},set(H,D,L,K){return Reflect.set(H,D,L,K)?(f(e[t]),!0):!1},get(H,D,L){if(D==="valueOf")return()=>v;let K=Reflect.getOwnPropertyDescriptor(H,D);if(K===void 0&&!(D in H)||K?.enumerable){K===void 0&&(H[D]=void 0);let l=Reflect.get(v,D,L),b=Object.getOwnPropertyDescriptors(v.map((o,I)=>{let c=o?.[D]?.valueOf(),x=I?.valueOf();return typeof c==typeof x&&c==x?N:c}));Reflect.ownKeys(b).forEach(o=>b[o].enumerable=!1);let P=d(l,b);return Reflect.set(H,D,P),P}return Reflect.get(H,D,L)}}));case"bigint":case"boolean":case"number":case"string":return Object.defineProperties(Object(a),{...g,toJSON:{value(){return a.valueOf()},writable:!0}})}throw new TypeError('Iterable properties cannot be of type "'+typeof a+'"')}}var z=(...e)=>{let t=new Array(e.length),n=new Array(e.length),r=()=>{r=()=>{};for(let i=0;i({idx:i,result:a}))}},u=[],s=new Promise(()=>{}),f=n.length,m={[Symbol.asyncIterator](){return m},next(){return r(),f?Promise.race(n).then(({idx:i,result:d})=>d.done?(f--,n[i]=s,u[i]=d.value,m.next()):(n[i]=t[i]?t[i].next().then(a=>({idx:i,result:a})).catch(a=>({idx:i,result:{done:!0,value:a}})):Promise.resolve({idx:i,result:{done:!0,value:void 0}}),d)).catch(i=>m.throw?.(i)??Promise.reject({done:!0,value:new Error("Iterator merge exception")})):Promise.resolve({done:!0,value:u})},async return(i){for(let d=0;da.value,a=>a));return{done:!0,value:u}},async throw(i){for(let d=0;da.value,a=>a));return{done:!0,value:u}}};return W(m)},Ae=(e,t={})=>{let n={},r,u=[],s=0,f=new Promise(()=>{}),m={[Symbol.asyncIterator](){return m},next(){return r===void 0&&(r=Object.entries(e).map(([i,d],a)=>(s+=1,u[a]=d[Symbol.asyncIterator](),u[a].next().then(g=>({si:u,idx:a,k:i,ir:g}))))),function i(){return Promise.race(r).then(({idx:d,k:a,ir:g})=>g.done?(r[d]=f,s-=1,s?i():{done:!0,value:void 0}):(n[a]=g.value,r[d]=u[d].next().then(v=>({idx:d,k:a,ir:v})),t.ignorePartial&&Object.keys(n).length{d!==f&&u[a].return?.(i)}),Promise.resolve({done:!0,value:i})},throw(i){return r.forEach((d,a)=>{d!==f&&u[a].throw?.(i)}),Promise.reject({done:!0,value:i})}};return W(m)};function Ge(e){return _(e)&&fe.every(t=>t in e&&e[t]===oe[t])}function W(e){return Ge(e)||$e(e,oe),e}function Qe(e){return function(...t){let n=e(...t);return W(n)}}async function Se(e){let t;for await(let n of this)t=e?.(n);await t}var N=Symbol("Ignore");function Ve(e,t,n){if($(e))return e.then(t,n);try{return t(e)}catch(r){return n(r)}}function V(e,t,n=N){let r,u=N,s={[Symbol.asyncIterator](){return s},next(...f){if(n!==N){let m=Promise.resolve({done:!1,value:n});return n=N,m}return new Promise(function m(i,d){r||(r=e[Symbol.asyncIterator]()),r.next(...f).then(a=>a.done?i(a):Ve(t(a.value,u),g=>g===N?m(i,d):i({done:!1,value:u=g}),g=>{r.throw?r.throw(g):r.return?.(g),d({done:!0,value:g})}),a=>d({done:!0,value:a})).catch(a=>{r.throw?r.throw(a):r.return?.(a),d({done:!0,value:a})})})},throw(f){return Promise.resolve(r?.throw?r.throw(f):r?.return?.(f)).then(m=>({done:!0,value:m?.value}))},return(f){return Promise.resolve(r?.return?.(f)).then(m=>({done:!0,value:m?.value}))}};return W(s)}function qe(e){return V(this,e)}function Ke(e){return V(this,async t=>await e(t)?t:N)}function Be(e){return e?V(this,async(t,n)=>n===N||await e(t,n)?t:N):V(this,(t,n)=>t===n?N:t)}function Ye(e){return V(this,t=>t,e)}function Ze(e){return V(this,t=>new Promise(n=>(e(()=>n(t)),t)))}function Je(){let e=this,t=0,n,r;function u(f){f&&n.resolve(f),f?.done||(n=ue(),r.next().then(u).catch(m=>n.reject({done:!0,value:m})))}let s={[Symbol.asyncIterator](){return t+=1,s},next(){return r||(r=e[Symbol.asyncIterator](),u()),n},throw(f){if(t<1)throw new Error("AsyncIterator protocol error");return t-=1,t?Promise.resolve({done:!0,value:f}):Promise.resolve(r?.throw?r.throw(f):r?.return?.(f)).then(m=>({done:!0,value:m?.value}))},return(f){if(t<1)throw new Error("AsyncIterator protocol error");return t-=1,t?Promise.resolve({done:!0,value:f}):Promise.resolve(r?.return?.(f)).then(m=>({done:!0,value:m?.value}))}};return W(s)}function Xe(){let e=async function*(){}();for(;e;){if(Object.getOwnPropertyDescriptor(e,Symbol.asyncIterator)){W(e);break}e=Object.getPrototypeOf(e)}e||E.warn("Failed to augment the prototype of `(async function*())()`")}var ee=new Map;function _e(e){let t=ee.get(e.type);if(t)for(let n of t)try{let{push:r,terminate:u,container:s,selector:f}=n;if(s.isConnected){if(e.target instanceof Node)if(f){let m=s.querySelectorAll(f);for(let i of m)(e.target===i||i.contains(e.target))&&s.contains(i)&&r(e)}else(e.target===s||s.contains(e.target))&&r(e)}else{let m="Container `#"+s.id+">"+(f||"")+"` removed from DOM. Removing subscription";t.delete(n),u(new Error(m))}}catch(r){E.warn("docEventHandler",r)}}function he(e){return!!(e&&(e.startsWith("#")||e.startsWith(".")||e.startsWith("[")&&e.endsWith("]")))}function Te(e){let t=e.split(":");if(t.length===1)return he(t[0])?[t[0],"change"]:[null,t[0]];if(t.length===2&&he(t[1])&&!he(t[0]))return[t[1],t[0]]}function ze(e){throw new Error(e)}function ge(e,t){let[n,r]=Te(t)??ze("Invalid WhenSelector: "+t);ee.has(r)||(document.addEventListener(r,_e,{passive:!0,capture:!0}),ee.set(r,new Set));let u=pe(()=>ee.get(r)?.delete(s)),s={push:u.push,terminate(f){u.return?.(f)},container:e,selector:n||null};return Me(e,n?[n]:void 0).then(f=>ee.get(r).add(s)),u.multi()}async function*Oe(){await new Promise(()=>{}),yield void 0}function Ie(e){function t(n){return e.map(n)}return Object.assign(W(t),{[Symbol.asyncIterator]:()=>e[Symbol.asyncIterator]()})}function et(e){if(!e)throw new Error(`Falsy async source will never be ready +"use strict";var ce=Object.defineProperty;var Re=Object.getOwnPropertyDescriptor;var He=Object.getOwnPropertyNames;var Le=Object.prototype.hasOwnProperty;var ve=(e,t)=>{for(var n in t)ce(e,n,{get:t[n],enumerable:!0})},Ue=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let u of He(t))!Le.call(e,u)&&u!==n&&ce(e,u,{get:()=>t[u],enumerable:!(r=Re(t,u))||r.enumerable});return e};var We=e=>Ue(ce({},"__esModule",{value:!0}),e);var it={};ve(it,{Iterators:()=>me,UniqueID:()=>ne,enableOnRemovedFromDOM:()=>je,getElementIdMap:()=>De,tag:()=>Ne,when:()=>ae});module.exports=We(it);var O=globalThis.DEBUG=="*"||globalThis.DEBUG==!0||globalThis.DEBUG?.match(/(^|\W)AI-UI(\W|$)/)||!1;var J=5e3,E={log(...e){O&&console.log("(AI-UI) LOG:",...e)},warn(...e){O&&console.warn("(AI-UI) WARN:",...e)},info(...e){O&&console.debug("(AI-UI) INFO:",...e)}};var xe=e=>{};function ue(){let e=xe,t=xe,n=new Promise((...r)=>[e,t]=r);if(n.resolve=e,n.reject=t,O){let r=new Error().stack;n.catch(u=>u instanceof Error||u?.value instanceof Error?E.log("Deferred rejection",u,"allocated at ",r):void 0)}return n}function de(e){return e&&typeof e=="object"||typeof e=="function"}function $(e){return de(e)&&"then"in e&&typeof e.then=="function"}var me={};ve(me,{Ignore:()=>N,Iterability:()=>X,asyncIterator:()=>ye,augmentGlobalAsyncGenerators:()=>Xe,combine:()=>Ae,debounceQueueIteratableIterator:()=>we,defineIterableProperty:()=>be,filterMap:()=>V,generatorHelpers:()=>Qe,isAsyncIter:()=>G,isAsyncIterable:()=>_,isAsyncIterator:()=>Y,iterableHelpers:()=>W,merge:()=>z,queueIteratableIterator:()=>pe});var X=Symbol("Iterability");function Y(e){return typeof e?.next=="function"}function _(e){return de(e)&&Symbol.asyncIterator in e&&typeof e[Symbol.asyncIterator]=="function"}function G(e){return _(e)||Y(e)}function ye(e){if(_(e))return e[Symbol.asyncIterator]();if(Y(e))return e;throw new Error("Not as async provider")}var oe={filterMap(e,t=N){return V(this,e,t)},map:qe,filter:Ke,unique:Be,waitFor:Ze,multi:Je,initially:Ye,consume:Se,merge(...e){return z(this,...e)},combine(e){return Ae(Object.assign({_this:this},e))}},fe=[...Object.getOwnPropertySymbols(oe),...Object.keys(oe)];function $e(e,t){let n=[...Object.getOwnPropertyNames(t),...Object.getOwnPropertySymbols(t)];for(let r of n)Object.defineProperty(e,r,{...Object.getOwnPropertyDescriptor(t,r),enumerable:!1});return e}var C=Symbol("pending"),U=Symbol("items");function Pe(e=()=>{}){let t={[C]:[],[U]:[],[Symbol.asyncIterator](){return t},next(){if(t[U]?.length)return Promise.resolve({done:!1,value:t[U].shift()});let n=ue();return n.catch(r=>{}),t[C].unshift(n),n},return(n){let r={done:!0,value:void 0};if(t[C]){try{e()}catch{}for(;t[C].length;)t[C].pop().resolve(r);t[U]=t[C]=null}return Promise.resolve(r)},throw(...n){let r={done:!0,value:n[0]};if(t[C]){try{e()}catch{}for(;t[C].length;)t[C].pop().reject(r);t[U]=t[C]=null}return Promise.reject(r)},get length(){return t[U]?t[U].length:-1},push(n){return t[C]?(t[C].length?t[C].pop().resolve({done:!1,value:n}):t[U]?t[U].push(n):E.log("Discarding queue push as there are no consumers"),!0):!1}};return W(t)}var re=Symbol("inflight");function Fe(e=()=>{}){let t=Pe(e);return t[re]=new Set,t.push=function(n){if(!t[C])return!1;if(t[re].has(n))return!0;if(t[re].add(n),t[C].length){let r=t[C].pop();r.finally(()=>t[re].delete(n)),r.resolve({done:!1,value:n})}else t[U]?t[U].find(r=>r===n)||t[U].push(n):E.log("Discarding queue push as there are no consumers");return!0},t}var pe=Pe,we=Fe;function be(e,t,n){let r=()=>{r=()=>v;let a=we(),g=a.multi(),v=g[Symbol.asyncIterator]();return s[Symbol.asyncIterator]={value:g[Symbol.asyncIterator],enumerable:!1,writable:!1},f=a.push,fe.forEach(Q=>s[Q]={value:v[Q],enumerable:!1,writable:!1}),Object.defineProperties(m,s),v};function u(a){return{[a]:function(...g){return r(),m[a].apply(this,g)}}[a]}let s={[Symbol.asyncIterator]:{enumerable:!1,writable:!0,value:r}};fe.forEach(a=>s[a]={enumerable:!1,writable:!0,value:u(a)});let f=a=>(r(),f(a));typeof n=="object"&&n&&X in n&&(s[X]=Object.getOwnPropertyDescriptor(n,X));let m=d(n,s),i;return Object.defineProperty(e,t,{get(){return m},set(a){if(a!==m)if(_(a)){if(i===a)return;i=a;let g=O?new Error:void 0;O&&E.info(new Error(`Iterable "${t.toString()}" has been assigned to consume another iterator. Did you mean to declare it?`)),Se.call(a,v=>{if(a!==i)throw new Error(`Piped iterable "${t.toString()}" has been replaced by another iterator`,{cause:g});f(v?.valueOf())}).catch(v=>E.info(v)).finally(()=>a===i&&(i=void 0));return}else{if(i)throw new Error(`Iterable "${t.toString()}" is already piped from another iterator`);m=d(a,s)}f(a?.valueOf())},enumerable:!0}),e;function d(a,g){let v=N;if(a==null)return Object.create(null,{...g,valueOf:{value(){return a},writable:!0},toJSON:{value(){return a},writable:!0}});switch(typeof a){case"object":return Symbol.asyncIterator in a?a:(v===N?(O&&E.info(`The iterable property '${t.toString()}' of type "object" will be spread to prevent re-initialisation. +${new Error().stack?.slice(6)}`),Array.isArray(a)?v=Object.defineProperties([...a],g):v=Object.defineProperties({...a},g)):Object.assign(v,a),v[X]==="shallow"?(v=Object.defineProperties(v,g),v):new Proxy(v,{deleteProperty(H,j){return Reflect.deleteProperty(H,j)?(f(e[t]),!0):!1},set(H,j,L,K){return Reflect.set(H,j,L,K)?(f(e[t]),!0):!1},get(H,j,L){if(j==="valueOf")return()=>v;let K=Reflect.getOwnPropertyDescriptor(H,j);if(K===void 0&&!(j in H)||K?.enumerable){K===void 0&&(H[j]=void 0);let l=Reflect.get(v,j,L),b=Object.getOwnPropertyDescriptors(v.map((o,I)=>{let c=o?.[j]?.valueOf(),x=I?.valueOf();return typeof c==typeof x&&c==x?N:c}));Reflect.ownKeys(b).forEach(o=>b[o].enumerable=!1);let P=d(l,b);return Reflect.set(H,j,P),P}return Reflect.get(H,j,L)}}));case"bigint":case"boolean":case"number":case"string":return Object.defineProperties(Object(a),{...g,toJSON:{value(){return a.valueOf()},writable:!0}})}throw new TypeError('Iterable properties cannot be of type "'+typeof a+'"')}}var z=(...e)=>{let t=new Array(e.length),n=new Array(e.length),r=()=>{r=()=>{};for(let i=0;i({idx:i,result:a}))}},u=[],s=new Promise(()=>{}),f=n.length,m={[Symbol.asyncIterator](){return m},next(){return r(),f?Promise.race(n).then(({idx:i,result:d})=>d.done?(f--,n[i]=s,u[i]=d.value,m.next()):(n[i]=t[i]?t[i].next().then(a=>({idx:i,result:a})).catch(a=>({idx:i,result:{done:!0,value:a}})):Promise.resolve({idx:i,result:{done:!0,value:void 0}}),d)).catch(i=>m.throw?.(i)??Promise.reject({done:!0,value:new Error("Iterator merge exception")})):Promise.resolve({done:!0,value:u})},async return(i){for(let d=0;da.value,a=>a));return{done:!0,value:u}},async throw(i){for(let d=0;da.value,a=>a));return{done:!0,value:u}}};return W(m)},Ae=(e,t={})=>{let n={},r,u=[],s=0,f=new Promise(()=>{}),m={[Symbol.asyncIterator](){return m},next(){return r===void 0&&(r=Object.entries(e).map(([i,d],a)=>(s+=1,u[a]=d[Symbol.asyncIterator](),u[a].next().then(g=>({si:u,idx:a,k:i,ir:g}))))),function i(){return Promise.race(r).then(({idx:d,k:a,ir:g})=>g.done?(r[d]=f,s-=1,s?i():{done:!0,value:void 0}):(n[a]=g.value,r[d]=u[d].next().then(v=>({idx:d,k:a,ir:v})),t.ignorePartial&&Object.keys(n).length{d!==f&&u[a].return?.(i)}),Promise.resolve({done:!0,value:i})},throw(i){return r.forEach((d,a)=>{d!==f&&u[a].throw?.(i)}),Promise.reject({done:!0,value:i})}};return W(m)};function Ge(e){return _(e)&&fe.every(t=>t in e&&e[t]===oe[t])}function W(e){return Ge(e)||$e(e,oe),e}function Qe(e){return function(...t){let n=e(...t);return W(n)}}async function Se(e){let t;for await(let n of this)t=e?.(n);await t}var N=Symbol("Ignore");function Ve(e,t,n){if($(e))return e.then(t,n);try{return t(e)}catch(r){return n(r)}}function V(e,t,n=N){let r,u=N,s={[Symbol.asyncIterator](){return s},next(...f){if(n!==N){let m=Promise.resolve({done:!1,value:n});return n=N,m}return new Promise(function m(i,d){r||(r=e[Symbol.asyncIterator]()),r.next(...f).then(a=>a.done?i(a):Ve(t(a.value,u),g=>g===N?m(i,d):i({done:!1,value:u=g}),g=>{r.throw?r.throw(g):r.return?.(g),d({done:!0,value:g})}),a=>d({done:!0,value:a})).catch(a=>{r.throw?r.throw(a):r.return?.(a),d({done:!0,value:a})})})},throw(f){return Promise.resolve(r?.throw?r.throw(f):r?.return?.(f)).then(m=>({done:!0,value:m?.value}))},return(f){return Promise.resolve(r?.return?.(f)).then(m=>({done:!0,value:m?.value}))}};return W(s)}function qe(e){return V(this,e)}function Ke(e){return V(this,async t=>await e(t)?t:N)}function Be(e){return e?V(this,async(t,n)=>n===N||await e(t,n)?t:N):V(this,(t,n)=>t===n?N:t)}function Ye(e){return V(this,t=>t,e)}function Ze(e){return V(this,t=>new Promise(n=>(e(()=>n(t)),t)))}function Je(){let e=this,t=0,n,r;function u(f){f&&n.resolve(f),f?.done||(n=ue(),r.next().then(u).catch(m=>n.reject({done:!0,value:m})))}let s={[Symbol.asyncIterator](){return t+=1,s},next(){return r||(r=e[Symbol.asyncIterator](),u()),n},throw(f){if(t<1)throw new Error("AsyncIterator protocol error");return t-=1,t?Promise.resolve({done:!0,value:f}):Promise.resolve(r?.throw?r.throw(f):r?.return?.(f)).then(m=>({done:!0,value:m?.value}))},return(f){if(t<1)throw new Error("AsyncIterator protocol error");return t-=1,t?Promise.resolve({done:!0,value:f}):Promise.resolve(r?.return?.(f)).then(m=>({done:!0,value:m?.value}))}};return W(s)}function Xe(){let e=async function*(){}();for(;e;){if(Object.getOwnPropertyDescriptor(e,Symbol.asyncIterator)){W(e);break}e=Object.getPrototypeOf(e)}e||E.warn("Failed to augment the prototype of `(async function*())()`")}var ee=new Map;function _e(e){let t=ee.get(e.type);if(t)for(let n of t)try{let{push:r,terminate:u,container:s,selector:f}=n;if(s.isConnected){if(e.target instanceof Node)if(f){let m=s.querySelectorAll(f);for(let i of m)(e.target===i||i.contains(e.target))&&s.contains(i)&&r(e)}else(e.target===s||s.contains(e.target))&&r(e)}else{let m="Container `#"+s.id+">"+(f||"")+"` removed from DOM. Removing subscription";t.delete(n),u(new Error(m))}}catch(r){E.warn("docEventHandler",r)}}function he(e){return!!(e&&(e.startsWith("#")||e.startsWith(".")||e.startsWith("[")&&e.endsWith("]")))}function Te(e){let t=e.split(":");if(t.length===1)return he(t[0])?[t[0],"change"]:[null,t[0]];if(t.length===2&&he(t[1])&&!he(t[0]))return[t[1],t[0]]}function ze(e){throw new Error(e)}function ge(e,t){let[n,r]=Te(t)??ze("Invalid WhenSelector: "+t);ee.has(r)||(document.addEventListener(r,_e,{passive:!0,capture:!0}),ee.set(r,new Set));let u=pe(()=>ee.get(r)?.delete(s)),s={push:u.push,terminate(f){u.return?.(f)},container:e,selector:n||null};return Me(e,n?[n]:void 0).then(f=>ee.get(r).add(s)),u.multi()}async function*Oe(){await new Promise(()=>{}),yield void 0}function Ie(e){function t(n){return e.map(n)}return Object.assign(W(t),{[Symbol.asyncIterator]:()=>e[Symbol.asyncIterator]()})}function et(e){if(!e)throw new Error(`Falsy async source will never be ready -`+JSON.stringify(e));return typeof e=="string"&&e[0]!=="@"&&!!Te(e)}async function*tt(e){yield e}function ae(e,...t){if(!t||t.length===0)return Ie(ge(e,"change"));let n=t.filter(s=>typeof s!="string"||s[0]!=="@").map(s=>typeof s=="string"?ge(e,s):s instanceof Element?ge(s,"change"):$(s)?tt(s):s);if(t.includes("@start")){let s={[Symbol.asyncIterator]:()=>s,next(){return s.next=()=>Promise.resolve({done:!0,value:void 0}),Promise.resolve({done:!1,value:{}})}};n.push(s)}if(t.includes("@ready")){let f=function(a){return typeof a=="string"&&!e.querySelector(a)};var u=f;let m=t.filter(et).map(a=>Te(a)?.[0]).filter(f),i,d={[Symbol.asyncIterator](){return d},throw(a){return i?.throw?i.throw(a):Promise.resolve({done:!0,value:a})},return(a){return i?.return?i.return(a):Promise.resolve({done:!0,value:a})},next(){return i?i.next():Me(e,m).then(()=>(i=(n.length>1?z(...n):n.length===1?n[0]:Oe())[Symbol.asyncIterator](),i?{done:!1,value:{}}:{done:!0,value:void 0}))}};return Ie(W(d))}let r=n.length>1?z(...n):n.length===1?n[0]:Oe();return Ie(W(r))}function ke(e){return e.isConnected?Promise.resolve():new Promise(t=>new MutationObserver((n,r)=>{n.some(u=>u.addedNodes?.length)&&e.isConnected&&(r.disconnect(),t())}).observe(document.body,{subtree:!0,childList:!0}))}function Me(e,t){return t?.length?Promise.all([nt(e,t),ke(e)]):ke(e)}function nt(e,t){if(t=t.filter(r=>!e.querySelector(r)),!t.length)return Promise.resolve();let n=new Promise(r=>new MutationObserver((u,s)=>{u.some(f=>f.addedNodes?.length)&&t.every(f=>e.querySelector(f))&&(s.disconnect(),r())}).observe(e,{subtree:!0,childList:!0}));if(O){let r=new Error().stack?.replace(/^Error/,"Missing selectors after 5 seconds:"),u=setTimeout(()=>{E.warn(r,t)},J);n.finally(()=>clearTimeout(u))}return n}var ne=Symbol("Unique ID"),q=O?e=>`"${"innerHTML"in e?e.innerHTML:e.textContent}"`:e=>{},rt=0,ot=["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","link","main","map","mark","menu","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","script","search","section","select","slot","small","source","span","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr"],at=Object.getOwnPropertyDescriptors({get ids(){return je(this)},set ids(e){throw new Error("Cannot set ids on "+this.valueOf())},when:function(...e){return ae(this,...e)}}),le=document.createElement("STYLE");le.id="--ai-ui-extended-tag-styles-";function se(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"||e instanceof Node||e instanceof NodeList||e instanceof HTMLCollection||e===null||e===void 0||Array.isArray(e)||$(e)||G(e)||typeof e=="object"&&Symbol.iterator in e&&typeof e[Symbol.iterator]=="function"}var te=Symbol("callStack"),Ne=function(e,t,n){let[r,u,s]=typeof e=="string"||e===null?[e,t,n]:Array.isArray(e)?[null,e,t]:[null,ot,e],f=st(document,"removedNodes"),m=s?.commonProperties,i=Object.create(null,at);Object.defineProperty(i,"attributes",{...Object.getOwnPropertyDescriptor(Element.prototype,"attributes"),set(l){if(G(l)){let b=Y(l)?l:l[Symbol.asyncIterator](),P=()=>b.next().then(({done:o,value:I})=>{Q(this,I),o||P()},o=>E.warn(o));P()}else Q(this,l)}}),m&&g(i,m);function d(...l){let b=[];return function P(o){if(!(o==null||o===N)){if($(o)){let I=Ee();b.push(I),o.then(c=>I.replaceWith(...d(c)),c=>{E.warn(c,q(I)),I.replaceWith(ie({error:c}))});return}if(o instanceof Node){b.push(o);return}if(o&&typeof o=="object"&&Symbol.iterator in o&&!(Symbol.asyncIterator in o)&&o[Symbol.iterator]){for(let I of o)P(I);return}if(G(o)){let I=O?` -`+new Error().stack?.replace(/^Error: /,"Insertion :"):"",c=Y(o)?o:o[Symbol.asyncIterator](),x=o.valueOf(),B=x===void 0||x===o?[Ee()]:d(x);b.push(...B);let y=B,p=!0,h=Date.now()+J,w=O&&new Error("Created by").stack,j=A=>{let S=y.filter(M=>!!M?.parentNode);S.length?(y=[ie({error:A})],S[0].replaceWith(...y),S.slice(1).forEach(M=>M?.parentNode.removeChild(M))):E.warn("Can't report error",A,w,y.map(q)),y=[],c.return?.(j)},F=A=>{if(!A.done)try{let S=y.filter(T=>T?.parentNode&&T.isConnected),M=p?y:S;if(S.length&&(p=!1),!M.length||y.every(T=>f(T))){y=[];let T="Element(s) have been removed from the document: "+I;c.return?.(new Error(T));return}O&&p&&h&&h!y.includes(T)&&T.parentNode?.removeChild(T)),c.next().then(F).catch(j)}catch(S){y=[],c.return?.(S)}};c.next().then(F).catch(j);return}b.push(document.createTextNode(o.toString()))}}(l),b}r||Object.assign(Ne,{nodes:d,UniqueID:ne});let a=Object.getPrototypeOf({});function g(l,b,P){if(!(b==null||typeof b!="object"||b===l))for(let[o,I]of Object.entries(Object.getOwnPropertyDescriptors(b)))try{if("value"in I){let c=I.value;c&&G(c)?Object.defineProperty(l,o,I):c&&typeof c=="object"&&!$(c)?o in l?c instanceof Node?(E.info("Having DOM Nodes as properties of other DOM Nodes is a bad idea as it makes the DOM tree into a cyclic graph. You should reference nodes by ID or as a child",o,q(c)),l[o]=c):l[o]!==c&&(Array.isArray(l[o])&&l[o].length!==c.length?c.constructor===Object||c.constructor===Array?g(l[o]=new c.constructor,c):l[o]=c:g(l[o],c)):(P&&(Object.getPrototypeOf(c)===a||!Object.getPrototypeOf(c)?g(I.value={},c):Array.isArray(c)?g(I.value=[],c):E.warn(`Declared propety '${o}' is not a plain object and must be assigned by reference, possibly polluting other instances of this tag`,l,c)),Object.defineProperty(l,o,I)):b[o]!==void 0&&(l[o]=b[o])}else Object.defineProperty(l,o,I)}catch(c){throw E.warn("deepAssign",o,b[o],c),c}}function v(l){let b=l?.valueOf();return Array.isArray(b)?Array.prototype.map.call(b,v):b}function Q(l,b){te in b||function P(o,I){if(I==null||typeof I!="object")return;let c=Object.entries(Object.getOwnPropertyDescriptors(I));Array.isArray(I)||c.sort((y,p)=>{let h=Object.getOwnPropertyDescriptor(o,y[0]);if(h){if("value"in h)return-1;if("set"in h)return 1;if("get"in h)return .5}return 0});for(let[y,p]of c)try{if("value"in p){let h=p.value;G(h)?x(h,y):$(h)?h.then(w=>{w&&typeof w=="object"?G(w)?x(w,y):B(w,y):I[y]!==void 0&&(o[y]=w)},w=>E.log("Failed to set attribute",w)):G(h)||(h&&typeof h=="object"&&!$(h)?B(h,y):I[y]!==void 0&&(o[y]=I[y]))}else Object.defineProperty(o,y,p)}catch(h){throw E.warn("assignProps",y,I[y],h),h}function x(y,p){let h=ye(y),w=!0,j=Date.now()+J,F=O&&new Error("Created by").stack,A=M=>{if(!M.done){let T=v(M.value);if(typeof T=="object"&&T!==null){let R=Object.getOwnPropertyDescriptor(o,p);p==="style"||!R?.set?P(o[p],T):o[p]=T}else T!==void 0&&(o[p]=T);let k=l.isConnected;if(f(l)||!w&&!k){E.info(`Element does not exist in document when setting async attribute '${p}' to: -${q(l)}`),h.return?.();return}k&&(w=!1),w&&j&&jtypeof s!="string"||s[0]!=="@").map(s=>typeof s=="string"?ge(e,s):s instanceof Element?ge(s,"change"):$(s)?tt(s):s);if(t.includes("@start")){let s={[Symbol.asyncIterator]:()=>s,next(){return s.next=()=>Promise.resolve({done:!0,value:void 0}),Promise.resolve({done:!1,value:{}})}};n.push(s)}if(t.includes("@ready")){let f=function(a){return typeof a=="string"&&!e.querySelector(a)};var u=f;let m=t.filter(et).map(a=>Te(a)?.[0]).filter(f),i,d={[Symbol.asyncIterator](){return d},throw(a){return i?.throw?i.throw(a):Promise.resolve({done:!0,value:a})},return(a){return i?.return?i.return(a):Promise.resolve({done:!0,value:a})},next(){return i?i.next():Me(e,m).then(()=>(i=(n.length>1?z(...n):n.length===1?n[0]:Oe())[Symbol.asyncIterator](),i?{done:!1,value:{}}:{done:!0,value:void 0}))}};return Ie(W(d))}let r=n.length>1?z(...n):n.length===1?n[0]:Oe();return Ie(W(r))}function ke(e){return e.isConnected?Promise.resolve():new Promise(t=>new MutationObserver((n,r)=>{n.some(u=>u.addedNodes?.length)&&e.isConnected&&(r.disconnect(),t())}).observe(document.body,{subtree:!0,childList:!0}))}function Me(e,t){return t?.length?Promise.all([nt(e,t),ke(e)]):ke(e)}function nt(e,t){if(t=t.filter(r=>!e.querySelector(r)),!t.length)return Promise.resolve();let n=new Promise(r=>new MutationObserver((u,s)=>{u.some(f=>f.addedNodes?.length)&&t.every(f=>e.querySelector(f))&&(s.disconnect(),r())}).observe(e,{subtree:!0,childList:!0}));if(O){let r=new Error().stack?.replace(/^Error/,"Missing selectors after 5 seconds:"),u=setTimeout(()=>{E.warn(r,t)},J);n.finally(()=>clearTimeout(u))}return n}var ne=Symbol("Unique ID"),q=O?e=>`"${"innerHTML"in e?e.innerHTML:e.textContent}"`:e=>{},rt=0,ot=["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","link","main","map","mark","menu","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","script","search","section","select","slot","small","source","span","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr"],at=Object.getOwnPropertyDescriptors({get ids(){return De(this)},set ids(e){throw new Error("Cannot set ids on "+this.valueOf())},when:function(...e){return ae(this,...e)}}),le=document.createElement("STYLE");le.id="--ai-ui-extended-tag-styles-";function se(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"||e instanceof Node||e instanceof NodeList||e instanceof HTMLCollection||e===null||e===void 0||Array.isArray(e)||$(e)||G(e)||typeof e=="object"&&Symbol.iterator in e&&typeof e[Symbol.iterator]=="function"}var te=Symbol("callStack"),Ne=function(e,t,n){let[r,u,s]=typeof e=="string"||e===null?[e,t,n]:Array.isArray(e)?[null,e,t]:[null,ot,e],f=st(document,"removedNodes"),m=s?.commonProperties,i=Object.create(null,at);Object.defineProperty(i,"attributes",{...Object.getOwnPropertyDescriptor(Element.prototype,"attributes"),set(l){if(G(l)){let b=Y(l)?l:l[Symbol.asyncIterator](),P=()=>b.next().then(({done:o,value:I})=>{Q(this,I),o||P()},o=>E.warn(o));P()}else Q(this,l)}}),m&&g(i,m);function d(...l){let b=[];return function P(o){if(!(o==null||o===N)){if($(o)){let I=Ee();b.push(I),o.then(c=>I.replaceWith(...d(c)),c=>{E.warn(c,q(I)),I.replaceWith(ie({error:c}))});return}if(o instanceof Node){b.push(o);return}if(o&&typeof o=="object"&&Symbol.iterator in o&&!(Symbol.asyncIterator in o)&&o[Symbol.iterator]){for(let I of o)P(I);return}if(G(o)){let I=O?` +`+new Error().stack?.replace(/^Error: /,"Insertion :"):"",c=Y(o)?o:o[Symbol.asyncIterator](),x=o.valueOf(),B=x===void 0||x===o?[Ee()]:d(x);b.push(...B);let y=B,p=!0,h=Date.now()+J,w=O&&new Error("Created by").stack,D=A=>{let S=y.filter(M=>!!M?.parentNode);S.length?(y=[ie({error:A})],S[0].replaceWith(...y),S.slice(1).forEach(M=>M?.parentNode.removeChild(M))):E.warn("Can't report error",A,w,y.map(q)),y=[],c.return?.(D)},F=A=>{if(!A.done)try{let S=y.filter(T=>T?.parentNode&&T.isConnected),M=p?y:S;if(S.length&&(p=!1),!M.length||y.every(T=>f(T))){y=[];let T="Element(s) have been removed from the document: "+I;c.return?.(new Error(T));return}O&&p&&h&&h!y.includes(T)&&T.parentNode?.removeChild(T)),c.next().then(F).catch(D)}catch(S){y=[],c.return?.(S)}};c.next().then(F).catch(D);return}b.push(document.createTextNode(o.toString()))}}(l),b}r||Object.assign(Ne,{nodes:d,UniqueID:ne});let a=Object.getPrototypeOf({});function g(l,b,P){if(!(b==null||typeof b!="object"||b===l))for(let[o,I]of Object.entries(Object.getOwnPropertyDescriptors(b)))try{if("value"in I){let c=I.value;c&&G(c)?Object.defineProperty(l,o,I):c&&typeof c=="object"&&!$(c)?o in l?c instanceof Node?(E.info("Having DOM Nodes as properties of other DOM Nodes is a bad idea as it makes the DOM tree into a cyclic graph. You should reference nodes by ID or as a child",o,q(c)),l[o]=c):l[o]!==c&&(Array.isArray(l[o])&&l[o].length!==c.length?c.constructor===Object||c.constructor===Array?g(l[o]=new c.constructor,c):l[o]=c:g(l[o],c)):(P&&(Object.getPrototypeOf(c)===a||!Object.getPrototypeOf(c)?g(I.value={},c):Array.isArray(c)?g(I.value=[],c):E.warn(`Declared propety '${o}' is not a plain object and must be assigned by reference, possibly polluting other instances of this tag`,l,c)),Object.defineProperty(l,o,I)):b[o]!==void 0&&(l[o]=b[o])}else Object.defineProperty(l,o,I)}catch(c){throw E.warn("deepAssign",o,b[o],c),c}}function v(l){let b=l?.valueOf();return Array.isArray(b)?Array.prototype.map.call(b,v):b}function Q(l,b){te in b||function P(o,I){if(I==null||typeof I!="object")return;let c=Object.entries(Object.getOwnPropertyDescriptors(I));Array.isArray(I)||c.sort((y,p)=>{let h=Object.getOwnPropertyDescriptor(o,y[0]);if(h){if("value"in h)return-1;if("set"in h)return 1;if("get"in h)return .5}return 0});for(let[y,p]of c)try{if("value"in p){let h=p.value;G(h)?x(h,y):$(h)?h.then(w=>{w&&typeof w=="object"?G(w)?x(w,y):B(w,y):I[y]!==void 0&&(o[y]=w)},w=>E.log("Failed to set attribute",w)):G(h)||(h&&typeof h=="object"&&!$(h)?B(h,y):I[y]!==void 0&&(o[y]=I[y]))}else Object.defineProperty(o,y,p)}catch(h){throw E.warn("assignProps",y,I[y],h),h}function x(y,p){let h=ye(y),w=!0,D=Date.now()+J,F=O&&new Error("Created by").stack,A=M=>{if(!M.done){let T=v(M.value);if(typeof T=="object"&&T!==null){let R=Object.getOwnPropertyDescriptor(o,p);p==="style"||!R?.set?P(o[p],T):o[p]=T}else T!==void 0&&(o[p]=T);let k=l.isConnected;if(f(l)||!w&&!k){E.info(`Element does not exist in document when setting async attribute '${p}' to: +${q(l)}`),h.return?.();return}k&&(w=!1),w&&D&&D{E.warn("Dynamic attribute error",M,p,o,F,q(l)),h.return?.(M),l.appendChild(ie({error:M}))};h.next().then(A).catch(S)}function B(y,p){if(y instanceof Node)E.info("Having DOM Nodes as properties of other DOM Nodes is a bad idea as it makes the DOM tree into a cyclic graph. You should reference nodes by ID or via a collection such as .childNodes",p,q(y)),o[p]=y;else if(!(p in o)||o[p]===y||Array.isArray(o[p])&&o[p].length!==y.length)if(y.constructor===Object||y.constructor===Array){let h=new y.constructor;P(h,y),o[p]=h}else o[p]=y;else Object.getOwnPropertyDescriptor(o,p)?.set?o[p]=y:P(o[p],y)}}(l,b)}function H(l){for(let b=l.constructor;b;b=b.super)if(b===this)return!0;return!1}function D(l){let b=typeof l!="function"?p=>Object.assign({},l,p):l,P=Date.now().toString(36)+(rt++).toString(36)+Math.random().toString(36).slice(2),o=b({[ne]:P});o.styles&&(le.appendChild(document.createTextNode(o.styles+` -`)),document.head.contains(le)||document.head.appendChild(le));let c=Object.assign((p,...h)=>{let w=se(p),j=[],F={[te]:(w?j:p[te])??j},A=w?this(F,p,...h):this(F,...h);A.constructor=c;let S=b({[ne]:P});if(F[te].push(S),O){let T=function(k,R){for(let Z=k;Z;Z=Z.super)if(Z.definition?.declare&&R in Z.definition.declare)return!0;return!1};var M=T;if(S.declare){let k=Object.keys(S.declare).filter(R=>R in A||T(this,R));k.length&&E.log(`Declared keys '${k}' in ${c.name} already exist in base '${this.valueOf()}'`)}if(S.override){let k=Object.keys(S.override).filter(R=>!(R in A)&&!(m&&R in m)&&!T(this,R));k.length&&E.log(`Overridden keys '${k}' in ${c.name} do not exist in base '${this.valueOf()}'`)}}if(g(A,S.declare,!0),g(A,S.override),S.iterable&&Object.keys(S.iterable).forEach(T=>{T in A?E.log(`Ignoring attempt to re-define iterable property "${T}" as it could already have consumers`):be(A,T,S.iterable[T])}),F[te]===j){w||Q(A,p);for(let T of j){let k=T?.constructed?.call(A);se(k)&&A.append(...d(k))}for(let T of j)if(T.iterable){for(let k of Object.keys(T.iterable))if(!(!w&&k in p&&(!$(p[k])||!G(p[k])))){let R=A[k];R?.valueOf()!==void 0&&(A[k]=R)}}}return A},{super:this,definition:Object.assign(o,{[ne]:P}),extended:D,valueOf:()=>{let p=[...Object.keys(o.declare||{}),...Object.keys(o.iterable||{})];return`${c.name}: {${p.join(", ")}} +${F}`)),h.next().then(A).catch(S)}},S=M=>{E.warn("Dynamic attribute error",M,p,o,F,q(l)),h.return?.(M),l.appendChild(ie({error:M}))};h.next().then(A).catch(S)}function B(y,p){if(y instanceof Node)E.info("Having DOM Nodes as properties of other DOM Nodes is a bad idea as it makes the DOM tree into a cyclic graph. You should reference nodes by ID or via a collection such as .childNodes",p,q(y)),o[p]=y;else if(!(p in o)||o[p]===y||Array.isArray(o[p])&&o[p].length!==y.length)if(y.constructor===Object||y.constructor===Array){let h=new y.constructor;P(h,y),o[p]=h}else o[p]=y;else Object.getOwnPropertyDescriptor(o,p)?.set?o[p]=y:P(o[p],y)}}(l,b)}function H(l){for(let b=l.constructor;b;b=b.super)if(b===this)return!0;return!1}function j(l){let b=typeof l!="function"?p=>Object.assign({},l,p):l,P=Date.now().toString(36)+(rt++).toString(36)+Math.random().toString(36).slice(2),o=b({[ne]:P});o.styles&&(le.appendChild(document.createTextNode(o.styles+` +`)),document.head.contains(le)||document.head.appendChild(le));let c=Object.assign((p,...h)=>{let w=se(p),D=[],F={[te]:(w?D:p[te])??D},A=w?this(F,p,...h):this(F,...h);A.constructor=c;let S=b({[ne]:P});if(F[te].push(S),O){let T=function(k,R){for(let Z=k;Z;Z=Z.super)if(Z.definition?.declare&&R in Z.definition.declare)return!0;return!1};var M=T;if(S.declare){let k=Object.keys(S.declare).filter(R=>R in A||T(this,R));k.length&&E.log(`Declared keys '${k}' in ${c.name} already exist in base '${this.valueOf()}'`)}if(S.override){let k=Object.keys(S.override).filter(R=>!(R in A)&&!(m&&R in m)&&!T(this,R));k.length&&E.log(`Overridden keys '${k}' in ${c.name} do not exist in base '${this.valueOf()}'`)}}if(g(A,S.declare,!0),g(A,S.override),S.iterable&&Object.keys(S.iterable).forEach(T=>{T in A?E.log(`Ignoring attempt to re-define iterable property "${T}" as it could already have consumers`):be(A,T,S.iterable[T])}),F[te]===D){w||Q(A,p);for(let T of D){let k=T?.constructed?.call(A);se(k)&&A.append(...d(k))}for(let T of D)if(T.iterable){for(let k of Object.keys(T.iterable))if(!(!w&&k in p&&(!$(p[k])||!G(p[k])))){let R=A[k];R?.valueOf()!==void 0&&(A[k]=R)}}}return A},{super:this,definition:Object.assign(o,{[ne]:P}),extended:j,valueOf:()=>{let p=[...Object.keys(o.declare||{}),...Object.keys(o.iterable||{})];return`${c.name}: {${p.join(", ")}} \u21AA ${this.valueOf()}`}});Object.defineProperty(c,Symbol.hasInstance,{value:H,writable:!0,configurable:!0});let x={};(function p(h){h?.super&&p(h.super);let w=h.definition;w&&(g(x,w?.override),g(x,w?.declare))})(this),g(x,o.override),g(x,o.declare),Object.defineProperties(c,Object.getOwnPropertyDescriptors(x));let B=x&&"className"in x&&typeof x.className=="string"?x.className:P,y=O?new Error().stack?.split(` -`)[2]??"":"";if(Object.defineProperty(c,"name",{value:""}),O){let p=Object.keys(o).filter(h=>!["styles","ids","constructed","declare","override","iterable"].includes(h));p.length&&E.log(`${c.name} defines extraneous keys '${p}', which are unknown`)}return c}let L={createElement(l,b,...P){return l===L.createElement?d(...P):typeof l=="function"?l(b,P):typeof l=="string"&&l in L?L[l](b,P):l instanceof Node?l:ie({error:new Error("Illegal type in createElement:"+l)})}};function K(l){if(L[l])return L[l];let b=(o,...I)=>{let c=document;if(se(o)&&(I.unshift(o),o={}),!se(o)){if(o.debugger){debugger;delete o.debugger}o.document&&(c=o.document,delete o.document);let x=r?c.createElementNS(r,l.toLowerCase()):c.createElement(l);return x.constructor=b,g(x,i),Q(x,o),x.append(...d(...I)),x}},P=Object.assign(b,{super:()=>{throw new Error("Can't invoke native elemenet constructors directly. Use document.createElement().")},extended:D,valueOf(){return`TagCreator: <${r||""}${r?"::":""}${l}>`}});return Object.defineProperty(b,Symbol.hasInstance,{value:H,writable:!0,configurable:!0}),Object.defineProperty(b,"name",{value:"<"+l+">"}),L[l]=P}return u.forEach(K),L};function Ee(){return document.createComment(O&&new Error("promise").stack?.replace(/^Error: /,"")||"promise")}function ie({error:e}){return document.createComment(e instanceof Error?e.toString():`Error: -`+JSON.stringify(e,null,2))}var De=function(){De=function(){},new MutationObserver(e=>{e.forEach(function(t){t.type==="childList"&&t.removedNodes.forEach(n=>n&&n instanceof Element&&[...n.getElementsByTagName("*"),n].filter(r=>!r.isConnected).forEach(r=>{"onRemovedFromDOM"in r&&typeof r.onRemovedFromDOM=="function"&&r.onRemovedFromDOM()}))})}).observe(document.body,{subtree:!0,childList:!0})};function st(e,t){let n=new WeakSet;function r(u){for(let s of u)t==="addedNodes"===s.isConnected&&(r(s.childNodes),n.add(s))}return new MutationObserver(u=>{u.forEach(function(s){s.type==="childList"&&s.removedNodes.length&&r(s[t])})}).observe(e,{subtree:!0,childList:!0}),function(u){return n.has(u)}}var Ce=new Set;function je(e,t){return e=e||document,t=t||Object.create(null),e.querySelectorAll&&e.querySelectorAll("[id]").forEach(function(n){n.id&&(t[n.id]?O&&(Ce.has(n.id)||(Ce.add(n.id),E.info("Shadowed multiple element IDs",n.id))):t[n.id]=n)}),t} +`)[2]??"":"";if(Object.defineProperty(c,"name",{value:""}),O){let p=Object.keys(o).filter(h=>!["styles","ids","constructed","declare","override","iterable"].includes(h));p.length&&E.log(`${c.name} defines extraneous keys '${p}', which are unknown`)}return c}let L={createElement(l,b,...P){return l===L.createElement?d(...P):typeof l=="function"?l(b,P):typeof l=="string"&&l in L?L[l](b,P):l instanceof Node?l:ie({error:new Error("Illegal type in createElement:"+l)})}};function K(l){if(L[l])return L[l];let b=(o,...I)=>{let c=document;if(se(o)&&(I.unshift(o),o={}),!se(o)){if(o.debugger){debugger;delete o.debugger}o.document&&(c=o.document,delete o.document);let x=r?c.createElementNS(r,l.toLowerCase()):c.createElement(l);return x.constructor=b,g(x,i),Q(x,o),x.append(...d(...I)),x}},P=Object.assign(b,{super:()=>{throw new Error("Can't invoke native elemenet constructors directly. Use document.createElement().")},extended:j,valueOf(){return`TagCreator: <${r||""}${r?"::":""}${l}>`}});return Object.defineProperty(b,Symbol.hasInstance,{value:H,writable:!0,configurable:!0}),Object.defineProperty(b,"name",{value:"<"+l+">"}),L[l]=P}return u.forEach(K),L};function Ee(){return document.createComment(O&&new Error("promise").stack?.replace(/^Error: /,"")||"promise")}function ie({error:e}){return document.createComment(e instanceof Error?e.toString():`Error: +`+JSON.stringify(e,null,2))}var je=function(){je=function(){},new MutationObserver(e=>{e.forEach(function(t){t.type==="childList"&&t.removedNodes.forEach(n=>n&&n instanceof Element&&[...n.getElementsByTagName("*"),n].filter(r=>!r.isConnected).forEach(r=>{"onRemovedFromDOM"in r&&typeof r.onRemovedFromDOM=="function"&&r.onRemovedFromDOM()}))})}).observe(document.body,{subtree:!0,childList:!0})};function st(e,t){let n=new WeakSet;function r(u){for(let s of u)t==="addedNodes"===s.isConnected&&(r(s.childNodes),n.add(s))}return new MutationObserver(u=>{u.forEach(function(s){s.type==="childList"&&s.removedNodes.length&&r(s[t])})}).observe(e,{subtree:!0,childList:!0}),function(u){return n.has(u)}}var Ce=new Set;function De(e,t){return e=e||document,t=t||Object.create(null),e.querySelectorAll&&e.querySelectorAll("[id]").forEach(function(n){n.id&&(t[n.id]?O&&(Ce.has(n.id)||(Ce.add(n.id),E.info("Shadowed multiple element IDs",n.id))):t[n.id]=n)}),t} diff --git a/module/dist/ai-ui.min.js b/module/dist/ai-ui.min.js index 1195b73..7b9898e 100644 --- a/module/dist/ai-ui.min.js +++ b/module/dist/ai-ui.min.js @@ -1,12 +1,12 @@ -"use strict";var AIUI=(()=>{var ce=Object.defineProperty;var Re=Object.getOwnPropertyDescriptor;var He=Object.getOwnPropertyNames;var Le=Object.prototype.hasOwnProperty;var ve=(e,t)=>{for(var n in t)ce(e,n,{get:t[n],enumerable:!0})},Ue=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let u of He(t))!Le.call(e,u)&&u!==n&&ce(e,u,{get:()=>t[u],enumerable:!(r=Re(t,u))||r.enumerable});return e};var We=e=>Ue(ce({},"__esModule",{value:!0}),e);var it={};ve(it,{Iterators:()=>me,UniqueID:()=>ne,enableOnRemovedFromDOM:()=>De,getElementIdMap:()=>je,tag:()=>Ne,when:()=>ae});var O=globalThis.DEBUG=="*"||globalThis.DEBUG==!0||globalThis.DEBUG?.match(/(^|\W)AI-UI(\W|$)/)||!1;var J=5e3,E={log(...e){O&&console.log("(AI-UI) LOG:",...e)},warn(...e){O&&console.warn("(AI-UI) WARN:",...e)},info(...e){O&&console.debug("(AI-UI) INFO:",...e)}};var xe=e=>{};function ue(){let e=xe,t=xe,n=new Promise((...r)=>[e,t]=r);if(n.resolve=e,n.reject=t,O){let r=new Error().stack;n.catch(u=>u instanceof Error||u?.value instanceof Error?E.log("Deferred rejection",u,"allocated at ",r):void 0)}return n}function de(e){return e&&typeof e=="object"||typeof e=="function"}function $(e){return de(e)&&"then"in e&&typeof e.then=="function"}var me={};ve(me,{Ignore:()=>N,Iterability:()=>X,asyncIterator:()=>ye,augmentGlobalAsyncGenerators:()=>Xe,combine:()=>Ae,debounceQueueIteratableIterator:()=>we,defineIterableProperty:()=>be,filterMap:()=>V,generatorHelpers:()=>Qe,isAsyncIter:()=>G,isAsyncIterable:()=>_,isAsyncIterator:()=>Y,iterableHelpers:()=>W,merge:()=>z,queueIteratableIterator:()=>pe});var X=Symbol("Iterability");function Y(e){return typeof e?.next=="function"}function _(e){return de(e)&&Symbol.asyncIterator in e&&typeof e[Symbol.asyncIterator]=="function"}function G(e){return _(e)||Y(e)}function ye(e){if(_(e))return e[Symbol.asyncIterator]();if(Y(e))return e;throw new Error("Not as async provider")}var oe={filterMap(e,t=N){return V(this,e,t)},map:qe,filter:Ke,unique:Be,waitFor:Ze,multi:Je,initially:Ye,consume:Se,merge(...e){return z(this,...e)},combine(e){return Ae(Object.assign({_this:this},e))}},fe=[...Object.getOwnPropertySymbols(oe),...Object.keys(oe)];function $e(e,...t){for(let n of t)for(let[r,u]of Object.entries(Object.getOwnPropertyDescriptors(n)))Object.defineProperty(e,r,{...u,enumerable:!1});return e}var C=Symbol("pending"),U=Symbol("items");function Pe(e=()=>{}){let t={[C]:[],[U]:[],[Symbol.asyncIterator](){return t},next(){if(t[U]?.length)return Promise.resolve({done:!1,value:t[U].shift()});let n=ue();return n.catch(r=>{}),t[C].unshift(n),n},return(n){let r={done:!0,value:void 0};if(t[C]){try{e()}catch{}for(;t[C].length;)t[C].pop().resolve(r);t[U]=t[C]=null}return Promise.resolve(r)},throw(...n){let r={done:!0,value:n[0]};if(t[C]){try{e()}catch{}for(;t[C].length;)t[C].pop().reject(r);t[U]=t[C]=null}return Promise.reject(r)},get length(){return t[U]?t[U].length:-1},push(n){return t[C]?(t[C].length?t[C].pop().resolve({done:!1,value:n}):t[U]?t[U].push(n):E.log("Discarding queue push as there are no consumers"),!0):!1}};return W(t)}var re=Symbol("inflight");function Fe(e=()=>{}){let t=Pe(e);return t[re]=new Set,t.push=function(n){if(!t[C])return!1;if(t[re].has(n))return!0;if(t[re].add(n),t[C].length){let r=t[C].pop();r.finally(()=>t[re].delete(n)),r.resolve({done:!1,value:n})}else t[U]?t[U].find(r=>r===n)||t[U].push(n):E.log("Discarding queue push as there are no consumers");return!0},t}var pe=Pe,we=Fe;function be(e,t,n){let r=()=>{r=()=>v;let a=we(),g=a.multi(),v=g[Symbol.asyncIterator]();return s[Symbol.asyncIterator]={value:g[Symbol.asyncIterator],enumerable:!1,writable:!1},f=a.push,fe.forEach(Q=>s[Q]={value:v[Q],enumerable:!1,writable:!1}),Object.defineProperties(m,s),v};function u(a){return{[a]:function(...g){return r(),m[a].apply(this,g)}}[a]}let s={[Symbol.asyncIterator]:{enumerable:!1,writable:!0,value:r}};fe.forEach(a=>s[a]={enumerable:!1,writable:!0,value:u(a)});let f=a=>(r(),f(a));typeof n=="object"&&n&&X in n&&(s[X]=Object.getOwnPropertyDescriptor(n,X));let m=d(n,s),i;return Object.defineProperty(e,t,{get(){return m},set(a){if(a!==m)if(_(a)){if(i===a)return;i=a;let g=O?new Error:void 0;O&&E.info(new Error(`Iterable "${t.toString()}" has been assigned to consume another iterator. Did you mean to declare it?`)),Se.call(a,v=>{if(a!==i)throw new Error(`Piped iterable "${t.toString()}" has been replaced by another iterator`,{cause:g});f(v?.valueOf())}).catch(v=>E.info(v)).finally(()=>a===i&&(i=void 0));return}else{if(i)throw new Error(`Iterable "${t.toString()}" is already piped from another iterator`);m=d(a,s)}f(a?.valueOf())},enumerable:!0}),e;function d(a,g){let v=N;if(a==null)return Object.create(null,{...g,valueOf:{value(){return a},writable:!0},toJSON:{value(){return a},writable:!0}});switch(typeof a){case"object":return Symbol.asyncIterator in a?a:(v===N?(O&&E.info(`The iterable property '${t.toString()}' of type "object" will be spread to prevent re-initialisation. -${new Error().stack?.slice(6)}`),Array.isArray(a)?v=Object.defineProperties([...a],g):v=Object.defineProperties({...a},g)):Object.assign(v,a),v[X]==="shallow"?(v=Object.defineProperties(v,g),v):new Proxy(v,{deleteProperty(H,D){return Reflect.deleteProperty(H,D)?(f(e[t]),!0):!1},set(H,D,L,K){return Reflect.set(H,D,L,K)?(f(e[t]),!0):!1},get(H,D,L){if(D==="valueOf")return()=>v;let K=Reflect.getOwnPropertyDescriptor(H,D);if(K===void 0&&!(D in H)||K?.enumerable){K===void 0&&(H[D]=void 0);let l=Reflect.get(v,D,L),b=Object.getOwnPropertyDescriptors(v.map((o,I)=>{let c=o?.[D]?.valueOf(),x=I?.valueOf();return typeof c==typeof x&&c==x?N:c}));Reflect.ownKeys(b).forEach(o=>b[o].enumerable=!1);let P=d(l,b);return Reflect.set(H,D,P),P}return Reflect.get(H,D,L)}}));case"bigint":case"boolean":case"number":case"string":return Object.defineProperties(Object(a),{...g,toJSON:{value(){return a.valueOf()},writable:!0}})}throw new TypeError('Iterable properties cannot be of type "'+typeof a+'"')}}var z=(...e)=>{let t=new Array(e.length),n=new Array(e.length),r=()=>{r=()=>{};for(let i=0;i({idx:i,result:a}))}},u=[],s=new Promise(()=>{}),f=n.length,m={[Symbol.asyncIterator](){return m},next(){return r(),f?Promise.race(n).then(({idx:i,result:d})=>d.done?(f--,n[i]=s,u[i]=d.value,m.next()):(n[i]=t[i]?t[i].next().then(a=>({idx:i,result:a})).catch(a=>({idx:i,result:{done:!0,value:a}})):Promise.resolve({idx:i,result:{done:!0,value:void 0}}),d)).catch(i=>m.throw?.(i)??Promise.reject({done:!0,value:new Error("Iterator merge exception")})):Promise.resolve({done:!0,value:u})},async return(i){for(let d=0;da.value,a=>a));return{done:!0,value:u}},async throw(i){for(let d=0;da.value,a=>a));return{done:!0,value:u}}};return W(m)},Ae=(e,t={})=>{let n={},r,u=[],s=0,f=new Promise(()=>{}),m={[Symbol.asyncIterator](){return m},next(){return r===void 0&&(r=Object.entries(e).map(([i,d],a)=>(s+=1,u[a]=d[Symbol.asyncIterator](),u[a].next().then(g=>({si:u,idx:a,k:i,ir:g}))))),function i(){return Promise.race(r).then(({idx:d,k:a,ir:g})=>g.done?(r[d]=f,s-=1,s?i():{done:!0,value:void 0}):(n[a]=g.value,r[d]=u[d].next().then(v=>({idx:d,k:a,ir:v})),t.ignorePartial&&Object.keys(n).length{d!==f&&u[a].return?.(i)}),Promise.resolve({done:!0,value:i})},throw(i){return r.forEach((d,a)=>{d!==f&&u[a].throw?.(i)}),Promise.reject({done:!0,value:i})}};return W(m)};function Ge(e){return _(e)&&fe.every(t=>t in e&&e[t]===oe[t])}function W(e){return Ge(e)||$e(e,oe),e}function Qe(e){return function(...t){let n=e(...t);return W(n)}}async function Se(e){let t;for await(let n of this)t=e?.(n);await t}var N=Symbol("Ignore");function Ve(e,t,n){if($(e))return e.then(t,n);try{return t(e)}catch(r){return n(r)}}function V(e,t,n=N){let r,u=N,s={[Symbol.asyncIterator](){return s},next(...f){if(n!==N){let m=Promise.resolve({done:!1,value:n});return n=N,m}return new Promise(function m(i,d){r||(r=e[Symbol.asyncIterator]()),r.next(...f).then(a=>a.done?i(a):Ve(t(a.value,u),g=>g===N?m(i,d):i({done:!1,value:u=g}),g=>{r.throw?r.throw(g):r.return?.(g),d({done:!0,value:g})}),a=>d({done:!0,value:a})).catch(a=>{r.throw?r.throw(a):r.return?.(a),d({done:!0,value:a})})})},throw(f){return Promise.resolve(r?.throw?r.throw(f):r?.return?.(f)).then(m=>({done:!0,value:m?.value}))},return(f){return Promise.resolve(r?.return?.(f)).then(m=>({done:!0,value:m?.value}))}};return W(s)}function qe(e){return V(this,e)}function Ke(e){return V(this,async t=>await e(t)?t:N)}function Be(e){return e?V(this,async(t,n)=>n===N||await e(t,n)?t:N):V(this,(t,n)=>t===n?N:t)}function Ye(e){return V(this,t=>t,e)}function Ze(e){return V(this,t=>new Promise(n=>(e(()=>n(t)),t)))}function Je(){let e=this,t=0,n,r;function u(f){f&&n.resolve(f),f?.done||(n=ue(),r.next().then(u).catch(m=>n.reject({done:!0,value:m})))}let s={[Symbol.asyncIterator](){return t+=1,s},next(){return r||(r=e[Symbol.asyncIterator](),u()),n},throw(f){if(t<1)throw new Error("AsyncIterator protocol error");return t-=1,t?Promise.resolve({done:!0,value:f}):Promise.resolve(r?.throw?r.throw(f):r?.return?.(f)).then(m=>({done:!0,value:m?.value}))},return(f){if(t<1)throw new Error("AsyncIterator protocol error");return t-=1,t?Promise.resolve({done:!0,value:f}):Promise.resolve(r?.return?.(f)).then(m=>({done:!0,value:m?.value}))}};return W(s)}function Xe(){let e=async function*(){}();for(;e;){if(Object.getOwnPropertyDescriptor(e,Symbol.asyncIterator)){W(e);break}e=Object.getPrototypeOf(e)}e||E.warn("Failed to augment the prototype of `(async function*())()`")}var ee=new Map;function _e(e){let t=ee.get(e.type);if(t)for(let n of t)try{let{push:r,terminate:u,container:s,selector:f}=n;if(s.isConnected){if(e.target instanceof Node)if(f){let m=s.querySelectorAll(f);for(let i of m)(e.target===i||i.contains(e.target))&&s.contains(i)&&r(e)}else(e.target===s||s.contains(e.target))&&r(e)}else{let m="Container `#"+s.id+">"+(f||"")+"` removed from DOM. Removing subscription";t.delete(n),u(new Error(m))}}catch(r){E.warn("docEventHandler",r)}}function he(e){return!!(e&&(e.startsWith("#")||e.startsWith(".")||e.startsWith("[")&&e.endsWith("]")))}function Te(e){let t=e.split(":");if(t.length===1)return he(t[0])?[t[0],"change"]:[null,t[0]];if(t.length===2&&he(t[1])&&!he(t[0]))return[t[1],t[0]]}function ze(e){throw new Error(e)}function ge(e,t){let[n,r]=Te(t)??ze("Invalid WhenSelector: "+t);ee.has(r)||(document.addEventListener(r,_e,{passive:!0,capture:!0}),ee.set(r,new Set));let u=pe(()=>ee.get(r)?.delete(s)),s={push:u.push,terminate(f){u.return?.(f)},container:e,selector:n||null};return Me(e,n?[n]:void 0).then(f=>ee.get(r).add(s)),u.multi()}async function*Oe(){await new Promise(()=>{}),yield void 0}function Ie(e){function t(n){return e.map(n)}return Object.assign(W(t),{[Symbol.asyncIterator]:()=>e[Symbol.asyncIterator]()})}function et(e){if(!e)throw new Error(`Falsy async source will never be ready +"use strict";var AIUI=(()=>{var ce=Object.defineProperty;var Re=Object.getOwnPropertyDescriptor;var He=Object.getOwnPropertyNames;var Le=Object.prototype.hasOwnProperty;var ve=(e,t)=>{for(var n in t)ce(e,n,{get:t[n],enumerable:!0})},Ue=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let u of He(t))!Le.call(e,u)&&u!==n&&ce(e,u,{get:()=>t[u],enumerable:!(r=Re(t,u))||r.enumerable});return e};var We=e=>Ue(ce({},"__esModule",{value:!0}),e);var it={};ve(it,{Iterators:()=>me,UniqueID:()=>ne,enableOnRemovedFromDOM:()=>je,getElementIdMap:()=>De,tag:()=>Ne,when:()=>ae});var O=globalThis.DEBUG=="*"||globalThis.DEBUG==!0||globalThis.DEBUG?.match(/(^|\W)AI-UI(\W|$)/)||!1;var J=5e3,E={log(...e){O&&console.log("(AI-UI) LOG:",...e)},warn(...e){O&&console.warn("(AI-UI) WARN:",...e)},info(...e){O&&console.debug("(AI-UI) INFO:",...e)}};var xe=e=>{};function ue(){let e=xe,t=xe,n=new Promise((...r)=>[e,t]=r);if(n.resolve=e,n.reject=t,O){let r=new Error().stack;n.catch(u=>u instanceof Error||u?.value instanceof Error?E.log("Deferred rejection",u,"allocated at ",r):void 0)}return n}function de(e){return e&&typeof e=="object"||typeof e=="function"}function $(e){return de(e)&&"then"in e&&typeof e.then=="function"}var me={};ve(me,{Ignore:()=>N,Iterability:()=>X,asyncIterator:()=>ye,augmentGlobalAsyncGenerators:()=>Xe,combine:()=>Ae,debounceQueueIteratableIterator:()=>we,defineIterableProperty:()=>be,filterMap:()=>V,generatorHelpers:()=>Qe,isAsyncIter:()=>G,isAsyncIterable:()=>_,isAsyncIterator:()=>Y,iterableHelpers:()=>W,merge:()=>z,queueIteratableIterator:()=>pe});var X=Symbol("Iterability");function Y(e){return typeof e?.next=="function"}function _(e){return de(e)&&Symbol.asyncIterator in e&&typeof e[Symbol.asyncIterator]=="function"}function G(e){return _(e)||Y(e)}function ye(e){if(_(e))return e[Symbol.asyncIterator]();if(Y(e))return e;throw new Error("Not as async provider")}var oe={filterMap(e,t=N){return V(this,e,t)},map:qe,filter:Ke,unique:Be,waitFor:Ze,multi:Je,initially:Ye,consume:Se,merge(...e){return z(this,...e)},combine(e){return Ae(Object.assign({_this:this},e))}},fe=[...Object.getOwnPropertySymbols(oe),...Object.keys(oe)];function $e(e,t){let n=[...Object.getOwnPropertyNames(t),...Object.getOwnPropertySymbols(t)];for(let r of n)Object.defineProperty(e,r,{...Object.getOwnPropertyDescriptor(t,r),enumerable:!1});return e}var C=Symbol("pending"),U=Symbol("items");function Pe(e=()=>{}){let t={[C]:[],[U]:[],[Symbol.asyncIterator](){return t},next(){if(t[U]?.length)return Promise.resolve({done:!1,value:t[U].shift()});let n=ue();return n.catch(r=>{}),t[C].unshift(n),n},return(n){let r={done:!0,value:void 0};if(t[C]){try{e()}catch{}for(;t[C].length;)t[C].pop().resolve(r);t[U]=t[C]=null}return Promise.resolve(r)},throw(...n){let r={done:!0,value:n[0]};if(t[C]){try{e()}catch{}for(;t[C].length;)t[C].pop().reject(r);t[U]=t[C]=null}return Promise.reject(r)},get length(){return t[U]?t[U].length:-1},push(n){return t[C]?(t[C].length?t[C].pop().resolve({done:!1,value:n}):t[U]?t[U].push(n):E.log("Discarding queue push as there are no consumers"),!0):!1}};return W(t)}var re=Symbol("inflight");function Fe(e=()=>{}){let t=Pe(e);return t[re]=new Set,t.push=function(n){if(!t[C])return!1;if(t[re].has(n))return!0;if(t[re].add(n),t[C].length){let r=t[C].pop();r.finally(()=>t[re].delete(n)),r.resolve({done:!1,value:n})}else t[U]?t[U].find(r=>r===n)||t[U].push(n):E.log("Discarding queue push as there are no consumers");return!0},t}var pe=Pe,we=Fe;function be(e,t,n){let r=()=>{r=()=>v;let a=we(),g=a.multi(),v=g[Symbol.asyncIterator]();return s[Symbol.asyncIterator]={value:g[Symbol.asyncIterator],enumerable:!1,writable:!1},f=a.push,fe.forEach(Q=>s[Q]={value:v[Q],enumerable:!1,writable:!1}),Object.defineProperties(m,s),v};function u(a){return{[a]:function(...g){return r(),m[a].apply(this,g)}}[a]}let s={[Symbol.asyncIterator]:{enumerable:!1,writable:!0,value:r}};fe.forEach(a=>s[a]={enumerable:!1,writable:!0,value:u(a)});let f=a=>(r(),f(a));typeof n=="object"&&n&&X in n&&(s[X]=Object.getOwnPropertyDescriptor(n,X));let m=d(n,s),i;return Object.defineProperty(e,t,{get(){return m},set(a){if(a!==m)if(_(a)){if(i===a)return;i=a;let g=O?new Error:void 0;O&&E.info(new Error(`Iterable "${t.toString()}" has been assigned to consume another iterator. Did you mean to declare it?`)),Se.call(a,v=>{if(a!==i)throw new Error(`Piped iterable "${t.toString()}" has been replaced by another iterator`,{cause:g});f(v?.valueOf())}).catch(v=>E.info(v)).finally(()=>a===i&&(i=void 0));return}else{if(i)throw new Error(`Iterable "${t.toString()}" is already piped from another iterator`);m=d(a,s)}f(a?.valueOf())},enumerable:!0}),e;function d(a,g){let v=N;if(a==null)return Object.create(null,{...g,valueOf:{value(){return a},writable:!0},toJSON:{value(){return a},writable:!0}});switch(typeof a){case"object":return Symbol.asyncIterator in a?a:(v===N?(O&&E.info(`The iterable property '${t.toString()}' of type "object" will be spread to prevent re-initialisation. +${new Error().stack?.slice(6)}`),Array.isArray(a)?v=Object.defineProperties([...a],g):v=Object.defineProperties({...a},g)):Object.assign(v,a),v[X]==="shallow"?(v=Object.defineProperties(v,g),v):new Proxy(v,{deleteProperty(H,j){return Reflect.deleteProperty(H,j)?(f(e[t]),!0):!1},set(H,j,L,K){return Reflect.set(H,j,L,K)?(f(e[t]),!0):!1},get(H,j,L){if(j==="valueOf")return()=>v;let K=Reflect.getOwnPropertyDescriptor(H,j);if(K===void 0&&!(j in H)||K?.enumerable){K===void 0&&(H[j]=void 0);let l=Reflect.get(v,j,L),b=Object.getOwnPropertyDescriptors(v.map((o,I)=>{let c=o?.[j]?.valueOf(),x=I?.valueOf();return typeof c==typeof x&&c==x?N:c}));Reflect.ownKeys(b).forEach(o=>b[o].enumerable=!1);let P=d(l,b);return Reflect.set(H,j,P),P}return Reflect.get(H,j,L)}}));case"bigint":case"boolean":case"number":case"string":return Object.defineProperties(Object(a),{...g,toJSON:{value(){return a.valueOf()},writable:!0}})}throw new TypeError('Iterable properties cannot be of type "'+typeof a+'"')}}var z=(...e)=>{let t=new Array(e.length),n=new Array(e.length),r=()=>{r=()=>{};for(let i=0;i({idx:i,result:a}))}},u=[],s=new Promise(()=>{}),f=n.length,m={[Symbol.asyncIterator](){return m},next(){return r(),f?Promise.race(n).then(({idx:i,result:d})=>d.done?(f--,n[i]=s,u[i]=d.value,m.next()):(n[i]=t[i]?t[i].next().then(a=>({idx:i,result:a})).catch(a=>({idx:i,result:{done:!0,value:a}})):Promise.resolve({idx:i,result:{done:!0,value:void 0}}),d)).catch(i=>m.throw?.(i)??Promise.reject({done:!0,value:new Error("Iterator merge exception")})):Promise.resolve({done:!0,value:u})},async return(i){for(let d=0;da.value,a=>a));return{done:!0,value:u}},async throw(i){for(let d=0;da.value,a=>a));return{done:!0,value:u}}};return W(m)},Ae=(e,t={})=>{let n={},r,u=[],s=0,f=new Promise(()=>{}),m={[Symbol.asyncIterator](){return m},next(){return r===void 0&&(r=Object.entries(e).map(([i,d],a)=>(s+=1,u[a]=d[Symbol.asyncIterator](),u[a].next().then(g=>({si:u,idx:a,k:i,ir:g}))))),function i(){return Promise.race(r).then(({idx:d,k:a,ir:g})=>g.done?(r[d]=f,s-=1,s?i():{done:!0,value:void 0}):(n[a]=g.value,r[d]=u[d].next().then(v=>({idx:d,k:a,ir:v})),t.ignorePartial&&Object.keys(n).length{d!==f&&u[a].return?.(i)}),Promise.resolve({done:!0,value:i})},throw(i){return r.forEach((d,a)=>{d!==f&&u[a].throw?.(i)}),Promise.reject({done:!0,value:i})}};return W(m)};function Ge(e){return _(e)&&fe.every(t=>t in e&&e[t]===oe[t])}function W(e){return Ge(e)||$e(e,oe),e}function Qe(e){return function(...t){let n=e(...t);return W(n)}}async function Se(e){let t;for await(let n of this)t=e?.(n);await t}var N=Symbol("Ignore");function Ve(e,t,n){if($(e))return e.then(t,n);try{return t(e)}catch(r){return n(r)}}function V(e,t,n=N){let r,u=N,s={[Symbol.asyncIterator](){return s},next(...f){if(n!==N){let m=Promise.resolve({done:!1,value:n});return n=N,m}return new Promise(function m(i,d){r||(r=e[Symbol.asyncIterator]()),r.next(...f).then(a=>a.done?i(a):Ve(t(a.value,u),g=>g===N?m(i,d):i({done:!1,value:u=g}),g=>{r.throw?r.throw(g):r.return?.(g),d({done:!0,value:g})}),a=>d({done:!0,value:a})).catch(a=>{r.throw?r.throw(a):r.return?.(a),d({done:!0,value:a})})})},throw(f){return Promise.resolve(r?.throw?r.throw(f):r?.return?.(f)).then(m=>({done:!0,value:m?.value}))},return(f){return Promise.resolve(r?.return?.(f)).then(m=>({done:!0,value:m?.value}))}};return W(s)}function qe(e){return V(this,e)}function Ke(e){return V(this,async t=>await e(t)?t:N)}function Be(e){return e?V(this,async(t,n)=>n===N||await e(t,n)?t:N):V(this,(t,n)=>t===n?N:t)}function Ye(e){return V(this,t=>t,e)}function Ze(e){return V(this,t=>new Promise(n=>(e(()=>n(t)),t)))}function Je(){let e=this,t=0,n,r;function u(f){f&&n.resolve(f),f?.done||(n=ue(),r.next().then(u).catch(m=>n.reject({done:!0,value:m})))}let s={[Symbol.asyncIterator](){return t+=1,s},next(){return r||(r=e[Symbol.asyncIterator](),u()),n},throw(f){if(t<1)throw new Error("AsyncIterator protocol error");return t-=1,t?Promise.resolve({done:!0,value:f}):Promise.resolve(r?.throw?r.throw(f):r?.return?.(f)).then(m=>({done:!0,value:m?.value}))},return(f){if(t<1)throw new Error("AsyncIterator protocol error");return t-=1,t?Promise.resolve({done:!0,value:f}):Promise.resolve(r?.return?.(f)).then(m=>({done:!0,value:m?.value}))}};return W(s)}function Xe(){let e=async function*(){}();for(;e;){if(Object.getOwnPropertyDescriptor(e,Symbol.asyncIterator)){W(e);break}e=Object.getPrototypeOf(e)}e||E.warn("Failed to augment the prototype of `(async function*())()`")}var ee=new Map;function _e(e){let t=ee.get(e.type);if(t)for(let n of t)try{let{push:r,terminate:u,container:s,selector:f}=n;if(s.isConnected){if(e.target instanceof Node)if(f){let m=s.querySelectorAll(f);for(let i of m)(e.target===i||i.contains(e.target))&&s.contains(i)&&r(e)}else(e.target===s||s.contains(e.target))&&r(e)}else{let m="Container `#"+s.id+">"+(f||"")+"` removed from DOM. Removing subscription";t.delete(n),u(new Error(m))}}catch(r){E.warn("docEventHandler",r)}}function he(e){return!!(e&&(e.startsWith("#")||e.startsWith(".")||e.startsWith("[")&&e.endsWith("]")))}function Te(e){let t=e.split(":");if(t.length===1)return he(t[0])?[t[0],"change"]:[null,t[0]];if(t.length===2&&he(t[1])&&!he(t[0]))return[t[1],t[0]]}function ze(e){throw new Error(e)}function ge(e,t){let[n,r]=Te(t)??ze("Invalid WhenSelector: "+t);ee.has(r)||(document.addEventListener(r,_e,{passive:!0,capture:!0}),ee.set(r,new Set));let u=pe(()=>ee.get(r)?.delete(s)),s={push:u.push,terminate(f){u.return?.(f)},container:e,selector:n||null};return Me(e,n?[n]:void 0).then(f=>ee.get(r).add(s)),u.multi()}async function*Oe(){await new Promise(()=>{}),yield void 0}function Ie(e){function t(n){return e.map(n)}return Object.assign(W(t),{[Symbol.asyncIterator]:()=>e[Symbol.asyncIterator]()})}function et(e){if(!e)throw new Error(`Falsy async source will never be ready -`+JSON.stringify(e));return typeof e=="string"&&e[0]!=="@"&&!!Te(e)}async function*tt(e){yield e}function ae(e,...t){if(!t||t.length===0)return Ie(ge(e,"change"));let n=t.filter(s=>typeof s!="string"||s[0]!=="@").map(s=>typeof s=="string"?ge(e,s):s instanceof Element?ge(s,"change"):$(s)?tt(s):s);if(t.includes("@start")){let s={[Symbol.asyncIterator]:()=>s,next(){return s.next=()=>Promise.resolve({done:!0,value:void 0}),Promise.resolve({done:!1,value:{}})}};n.push(s)}if(t.includes("@ready")){let f=function(a){return typeof a=="string"&&!e.querySelector(a)};var u=f;let m=t.filter(et).map(a=>Te(a)?.[0]).filter(f),i,d={[Symbol.asyncIterator](){return d},throw(a){return i?.throw?i.throw(a):Promise.resolve({done:!0,value:a})},return(a){return i?.return?i.return(a):Promise.resolve({done:!0,value:a})},next(){return i?i.next():Me(e,m).then(()=>(i=(n.length>1?z(...n):n.length===1?n[0]:Oe())[Symbol.asyncIterator](),i?{done:!1,value:{}}:{done:!0,value:void 0}))}};return Ie(W(d))}let r=n.length>1?z(...n):n.length===1?n[0]:Oe();return Ie(W(r))}function ke(e){return e.isConnected?Promise.resolve():new Promise(t=>new MutationObserver((n,r)=>{n.some(u=>u.addedNodes?.length)&&e.isConnected&&(r.disconnect(),t())}).observe(document.body,{subtree:!0,childList:!0}))}function Me(e,t){return t?.length?Promise.all([nt(e,t),ke(e)]):ke(e)}function nt(e,t){if(t=t.filter(r=>!e.querySelector(r)),!t.length)return Promise.resolve();let n=new Promise(r=>new MutationObserver((u,s)=>{u.some(f=>f.addedNodes?.length)&&t.every(f=>e.querySelector(f))&&(s.disconnect(),r())}).observe(e,{subtree:!0,childList:!0}));if(O){let r=new Error().stack?.replace(/^Error/,"Missing selectors after 5 seconds:"),u=setTimeout(()=>{E.warn(r,t)},J);n.finally(()=>clearTimeout(u))}return n}var ne=Symbol("Unique ID"),q=O?e=>`"${"innerHTML"in e?e.innerHTML:e.textContent}"`:e=>{},rt=0,ot=["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","link","main","map","mark","menu","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","script","search","section","select","slot","small","source","span","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr"],at=Object.getOwnPropertyDescriptors({get ids(){return je(this)},set ids(e){throw new Error("Cannot set ids on "+this.valueOf())},when:function(...e){return ae(this,...e)}}),le=document.createElement("STYLE");le.id="--ai-ui-extended-tag-styles-";function se(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"||e instanceof Node||e instanceof NodeList||e instanceof HTMLCollection||e===null||e===void 0||Array.isArray(e)||$(e)||G(e)||typeof e=="object"&&Symbol.iterator in e&&typeof e[Symbol.iterator]=="function"}var te=Symbol("callStack"),Ne=function(e,t,n){let[r,u,s]=typeof e=="string"||e===null?[e,t,n]:Array.isArray(e)?[null,e,t]:[null,ot,e],f=st(document,"removedNodes"),m=s?.commonProperties,i=Object.create(null,at);Object.defineProperty(i,"attributes",{...Object.getOwnPropertyDescriptor(Element.prototype,"attributes"),set(l){if(G(l)){let b=Y(l)?l:l[Symbol.asyncIterator](),P=()=>b.next().then(({done:o,value:I})=>{Q(this,I),o||P()},o=>E.warn(o));P()}else Q(this,l)}}),m&&g(i,m);function d(...l){let b=[];return function P(o){if(!(o==null||o===N)){if($(o)){let I=Ee();b.push(I),o.then(c=>I.replaceWith(...d(c)),c=>{E.warn(c,q(I)),I.replaceWith(ie({error:c}))});return}if(o instanceof Node){b.push(o);return}if(o&&typeof o=="object"&&Symbol.iterator in o&&!(Symbol.asyncIterator in o)&&o[Symbol.iterator]){for(let I of o)P(I);return}if(G(o)){let I=O?` -`+new Error().stack?.replace(/^Error: /,"Insertion :"):"",c=Y(o)?o:o[Symbol.asyncIterator](),x=o.valueOf(),B=x===void 0||x===o?[Ee()]:d(x);b.push(...B);let y=B,p=!0,h=Date.now()+J,w=O&&new Error("Created by").stack,j=A=>{let S=y.filter(M=>!!M?.parentNode);S.length?(y=[ie({error:A})],S[0].replaceWith(...y),S.slice(1).forEach(M=>M?.parentNode.removeChild(M))):E.warn("Can't report error",A,w,y.map(q)),y=[],c.return?.(j)},F=A=>{if(!A.done)try{let S=y.filter(T=>T?.parentNode&&T.isConnected),M=p?y:S;if(S.length&&(p=!1),!M.length||y.every(T=>f(T))){y=[];let T="Element(s) have been removed from the document: "+I;c.return?.(new Error(T));return}O&&p&&h&&h!y.includes(T)&&T.parentNode?.removeChild(T)),c.next().then(F).catch(j)}catch(S){y=[],c.return?.(S)}};c.next().then(F).catch(j);return}b.push(document.createTextNode(o.toString()))}}(l),b}r||Object.assign(Ne,{nodes:d,UniqueID:ne});let a=Object.getPrototypeOf({});function g(l,b,P){if(!(b==null||typeof b!="object"||b===l))for(let[o,I]of Object.entries(Object.getOwnPropertyDescriptors(b)))try{if("value"in I){let c=I.value;c&&G(c)?Object.defineProperty(l,o,I):c&&typeof c=="object"&&!$(c)?o in l?c instanceof Node?(E.info("Having DOM Nodes as properties of other DOM Nodes is a bad idea as it makes the DOM tree into a cyclic graph. You should reference nodes by ID or as a child",o,q(c)),l[o]=c):l[o]!==c&&(Array.isArray(l[o])&&l[o].length!==c.length?c.constructor===Object||c.constructor===Array?g(l[o]=new c.constructor,c):l[o]=c:g(l[o],c)):(P&&(Object.getPrototypeOf(c)===a||!Object.getPrototypeOf(c)?g(I.value={},c):Array.isArray(c)?g(I.value=[],c):E.warn(`Declared propety '${o}' is not a plain object and must be assigned by reference, possibly polluting other instances of this tag`,l,c)),Object.defineProperty(l,o,I)):b[o]!==void 0&&(l[o]=b[o])}else Object.defineProperty(l,o,I)}catch(c){throw E.warn("deepAssign",o,b[o],c),c}}function v(l){let b=l?.valueOf();return Array.isArray(b)?Array.prototype.map.call(b,v):b}function Q(l,b){te in b||function P(o,I){if(I==null||typeof I!="object")return;let c=Object.entries(Object.getOwnPropertyDescriptors(I));Array.isArray(I)||c.sort((y,p)=>{let h=Object.getOwnPropertyDescriptor(o,y[0]);if(h){if("value"in h)return-1;if("set"in h)return 1;if("get"in h)return .5}return 0});for(let[y,p]of c)try{if("value"in p){let h=p.value;G(h)?x(h,y):$(h)?h.then(w=>{w&&typeof w=="object"?G(w)?x(w,y):B(w,y):I[y]!==void 0&&(o[y]=w)},w=>E.log("Failed to set attribute",w)):G(h)||(h&&typeof h=="object"&&!$(h)?B(h,y):I[y]!==void 0&&(o[y]=I[y]))}else Object.defineProperty(o,y,p)}catch(h){throw E.warn("assignProps",y,I[y],h),h}function x(y,p){let h=ye(y),w=!0,j=Date.now()+J,F=O&&new Error("Created by").stack,A=M=>{if(!M.done){let T=v(M.value);if(typeof T=="object"&&T!==null){let R=Object.getOwnPropertyDescriptor(o,p);p==="style"||!R?.set?P(o[p],T):o[p]=T}else T!==void 0&&(o[p]=T);let k=l.isConnected;if(f(l)||!w&&!k){E.info(`Element does not exist in document when setting async attribute '${p}' to: -${q(l)}`),h.return?.();return}k&&(w=!1),w&&j&&jtypeof s!="string"||s[0]!=="@").map(s=>typeof s=="string"?ge(e,s):s instanceof Element?ge(s,"change"):$(s)?tt(s):s);if(t.includes("@start")){let s={[Symbol.asyncIterator]:()=>s,next(){return s.next=()=>Promise.resolve({done:!0,value:void 0}),Promise.resolve({done:!1,value:{}})}};n.push(s)}if(t.includes("@ready")){let f=function(a){return typeof a=="string"&&!e.querySelector(a)};var u=f;let m=t.filter(et).map(a=>Te(a)?.[0]).filter(f),i,d={[Symbol.asyncIterator](){return d},throw(a){return i?.throw?i.throw(a):Promise.resolve({done:!0,value:a})},return(a){return i?.return?i.return(a):Promise.resolve({done:!0,value:a})},next(){return i?i.next():Me(e,m).then(()=>(i=(n.length>1?z(...n):n.length===1?n[0]:Oe())[Symbol.asyncIterator](),i?{done:!1,value:{}}:{done:!0,value:void 0}))}};return Ie(W(d))}let r=n.length>1?z(...n):n.length===1?n[0]:Oe();return Ie(W(r))}function ke(e){return e.isConnected?Promise.resolve():new Promise(t=>new MutationObserver((n,r)=>{n.some(u=>u.addedNodes?.length)&&e.isConnected&&(r.disconnect(),t())}).observe(document.body,{subtree:!0,childList:!0}))}function Me(e,t){return t?.length?Promise.all([nt(e,t),ke(e)]):ke(e)}function nt(e,t){if(t=t.filter(r=>!e.querySelector(r)),!t.length)return Promise.resolve();let n=new Promise(r=>new MutationObserver((u,s)=>{u.some(f=>f.addedNodes?.length)&&t.every(f=>e.querySelector(f))&&(s.disconnect(),r())}).observe(e,{subtree:!0,childList:!0}));if(O){let r=new Error().stack?.replace(/^Error/,"Missing selectors after 5 seconds:"),u=setTimeout(()=>{E.warn(r,t)},J);n.finally(()=>clearTimeout(u))}return n}var ne=Symbol("Unique ID"),q=O?e=>`"${"innerHTML"in e?e.innerHTML:e.textContent}"`:e=>{},rt=0,ot=["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","link","main","map","mark","menu","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","script","search","section","select","slot","small","source","span","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr"],at=Object.getOwnPropertyDescriptors({get ids(){return De(this)},set ids(e){throw new Error("Cannot set ids on "+this.valueOf())},when:function(...e){return ae(this,...e)}}),le=document.createElement("STYLE");le.id="--ai-ui-extended-tag-styles-";function se(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"||e instanceof Node||e instanceof NodeList||e instanceof HTMLCollection||e===null||e===void 0||Array.isArray(e)||$(e)||G(e)||typeof e=="object"&&Symbol.iterator in e&&typeof e[Symbol.iterator]=="function"}var te=Symbol("callStack"),Ne=function(e,t,n){let[r,u,s]=typeof e=="string"||e===null?[e,t,n]:Array.isArray(e)?[null,e,t]:[null,ot,e],f=st(document,"removedNodes"),m=s?.commonProperties,i=Object.create(null,at);Object.defineProperty(i,"attributes",{...Object.getOwnPropertyDescriptor(Element.prototype,"attributes"),set(l){if(G(l)){let b=Y(l)?l:l[Symbol.asyncIterator](),P=()=>b.next().then(({done:o,value:I})=>{Q(this,I),o||P()},o=>E.warn(o));P()}else Q(this,l)}}),m&&g(i,m);function d(...l){let b=[];return function P(o){if(!(o==null||o===N)){if($(o)){let I=Ee();b.push(I),o.then(c=>I.replaceWith(...d(c)),c=>{E.warn(c,q(I)),I.replaceWith(ie({error:c}))});return}if(o instanceof Node){b.push(o);return}if(o&&typeof o=="object"&&Symbol.iterator in o&&!(Symbol.asyncIterator in o)&&o[Symbol.iterator]){for(let I of o)P(I);return}if(G(o)){let I=O?` +`+new Error().stack?.replace(/^Error: /,"Insertion :"):"",c=Y(o)?o:o[Symbol.asyncIterator](),x=o.valueOf(),B=x===void 0||x===o?[Ee()]:d(x);b.push(...B);let y=B,p=!0,h=Date.now()+J,w=O&&new Error("Created by").stack,D=A=>{let S=y.filter(M=>!!M?.parentNode);S.length?(y=[ie({error:A})],S[0].replaceWith(...y),S.slice(1).forEach(M=>M?.parentNode.removeChild(M))):E.warn("Can't report error",A,w,y.map(q)),y=[],c.return?.(D)},F=A=>{if(!A.done)try{let S=y.filter(T=>T?.parentNode&&T.isConnected),M=p?y:S;if(S.length&&(p=!1),!M.length||y.every(T=>f(T))){y=[];let T="Element(s) have been removed from the document: "+I;c.return?.(new Error(T));return}O&&p&&h&&h!y.includes(T)&&T.parentNode?.removeChild(T)),c.next().then(F).catch(D)}catch(S){y=[],c.return?.(S)}};c.next().then(F).catch(D);return}b.push(document.createTextNode(o.toString()))}}(l),b}r||Object.assign(Ne,{nodes:d,UniqueID:ne});let a=Object.getPrototypeOf({});function g(l,b,P){if(!(b==null||typeof b!="object"||b===l))for(let[o,I]of Object.entries(Object.getOwnPropertyDescriptors(b)))try{if("value"in I){let c=I.value;c&&G(c)?Object.defineProperty(l,o,I):c&&typeof c=="object"&&!$(c)?o in l?c instanceof Node?(E.info("Having DOM Nodes as properties of other DOM Nodes is a bad idea as it makes the DOM tree into a cyclic graph. You should reference nodes by ID or as a child",o,q(c)),l[o]=c):l[o]!==c&&(Array.isArray(l[o])&&l[o].length!==c.length?c.constructor===Object||c.constructor===Array?g(l[o]=new c.constructor,c):l[o]=c:g(l[o],c)):(P&&(Object.getPrototypeOf(c)===a||!Object.getPrototypeOf(c)?g(I.value={},c):Array.isArray(c)?g(I.value=[],c):E.warn(`Declared propety '${o}' is not a plain object and must be assigned by reference, possibly polluting other instances of this tag`,l,c)),Object.defineProperty(l,o,I)):b[o]!==void 0&&(l[o]=b[o])}else Object.defineProperty(l,o,I)}catch(c){throw E.warn("deepAssign",o,b[o],c),c}}function v(l){let b=l?.valueOf();return Array.isArray(b)?Array.prototype.map.call(b,v):b}function Q(l,b){te in b||function P(o,I){if(I==null||typeof I!="object")return;let c=Object.entries(Object.getOwnPropertyDescriptors(I));Array.isArray(I)||c.sort((y,p)=>{let h=Object.getOwnPropertyDescriptor(o,y[0]);if(h){if("value"in h)return-1;if("set"in h)return 1;if("get"in h)return .5}return 0});for(let[y,p]of c)try{if("value"in p){let h=p.value;G(h)?x(h,y):$(h)?h.then(w=>{w&&typeof w=="object"?G(w)?x(w,y):B(w,y):I[y]!==void 0&&(o[y]=w)},w=>E.log("Failed to set attribute",w)):G(h)||(h&&typeof h=="object"&&!$(h)?B(h,y):I[y]!==void 0&&(o[y]=I[y]))}else Object.defineProperty(o,y,p)}catch(h){throw E.warn("assignProps",y,I[y],h),h}function x(y,p){let h=ye(y),w=!0,D=Date.now()+J,F=O&&new Error("Created by").stack,A=M=>{if(!M.done){let T=v(M.value);if(typeof T=="object"&&T!==null){let R=Object.getOwnPropertyDescriptor(o,p);p==="style"||!R?.set?P(o[p],T):o[p]=T}else T!==void 0&&(o[p]=T);let k=l.isConnected;if(f(l)||!w&&!k){E.info(`Element does not exist in document when setting async attribute '${p}' to: +${q(l)}`),h.return?.();return}k&&(w=!1),w&&D&&D{E.warn("Dynamic attribute error",M,p,o,F,q(l)),h.return?.(M),l.appendChild(ie({error:M}))};h.next().then(A).catch(S)}function B(y,p){if(y instanceof Node)E.info("Having DOM Nodes as properties of other DOM Nodes is a bad idea as it makes the DOM tree into a cyclic graph. You should reference nodes by ID or via a collection such as .childNodes",p,q(y)),o[p]=y;else if(!(p in o)||o[p]===y||Array.isArray(o[p])&&o[p].length!==y.length)if(y.constructor===Object||y.constructor===Array){let h=new y.constructor;P(h,y),o[p]=h}else o[p]=y;else Object.getOwnPropertyDescriptor(o,p)?.set?o[p]=y:P(o[p],y)}}(l,b)}function H(l){for(let b=l.constructor;b;b=b.super)if(b===this)return!0;return!1}function D(l){let b=typeof l!="function"?p=>Object.assign({},l,p):l,P=Date.now().toString(36)+(rt++).toString(36)+Math.random().toString(36).slice(2),o=b({[ne]:P});o.styles&&(le.appendChild(document.createTextNode(o.styles+` -`)),document.head.contains(le)||document.head.appendChild(le));let c=Object.assign((p,...h)=>{let w=se(p),j=[],F={[te]:(w?j:p[te])??j},A=w?this(F,p,...h):this(F,...h);A.constructor=c;let S=b({[ne]:P});if(F[te].push(S),O){let T=function(k,R){for(let Z=k;Z;Z=Z.super)if(Z.definition?.declare&&R in Z.definition.declare)return!0;return!1};var M=T;if(S.declare){let k=Object.keys(S.declare).filter(R=>R in A||T(this,R));k.length&&E.log(`Declared keys '${k}' in ${c.name} already exist in base '${this.valueOf()}'`)}if(S.override){let k=Object.keys(S.override).filter(R=>!(R in A)&&!(m&&R in m)&&!T(this,R));k.length&&E.log(`Overridden keys '${k}' in ${c.name} do not exist in base '${this.valueOf()}'`)}}if(g(A,S.declare,!0),g(A,S.override),S.iterable&&Object.keys(S.iterable).forEach(T=>{T in A?E.log(`Ignoring attempt to re-define iterable property "${T}" as it could already have consumers`):be(A,T,S.iterable[T])}),F[te]===j){w||Q(A,p);for(let T of j){let k=T?.constructed?.call(A);se(k)&&A.append(...d(k))}for(let T of j)if(T.iterable){for(let k of Object.keys(T.iterable))if(!(!w&&k in p&&(!$(p[k])||!G(p[k])))){let R=A[k];R?.valueOf()!==void 0&&(A[k]=R)}}}return A},{super:this,definition:Object.assign(o,{[ne]:P}),extended:D,valueOf:()=>{let p=[...Object.keys(o.declare||{}),...Object.keys(o.iterable||{})];return`${c.name}: {${p.join(", ")}} +${F}`)),h.next().then(A).catch(S)}},S=M=>{E.warn("Dynamic attribute error",M,p,o,F,q(l)),h.return?.(M),l.appendChild(ie({error:M}))};h.next().then(A).catch(S)}function B(y,p){if(y instanceof Node)E.info("Having DOM Nodes as properties of other DOM Nodes is a bad idea as it makes the DOM tree into a cyclic graph. You should reference nodes by ID or via a collection such as .childNodes",p,q(y)),o[p]=y;else if(!(p in o)||o[p]===y||Array.isArray(o[p])&&o[p].length!==y.length)if(y.constructor===Object||y.constructor===Array){let h=new y.constructor;P(h,y),o[p]=h}else o[p]=y;else Object.getOwnPropertyDescriptor(o,p)?.set?o[p]=y:P(o[p],y)}}(l,b)}function H(l){for(let b=l.constructor;b;b=b.super)if(b===this)return!0;return!1}function j(l){let b=typeof l!="function"?p=>Object.assign({},l,p):l,P=Date.now().toString(36)+(rt++).toString(36)+Math.random().toString(36).slice(2),o=b({[ne]:P});o.styles&&(le.appendChild(document.createTextNode(o.styles+` +`)),document.head.contains(le)||document.head.appendChild(le));let c=Object.assign((p,...h)=>{let w=se(p),D=[],F={[te]:(w?D:p[te])??D},A=w?this(F,p,...h):this(F,...h);A.constructor=c;let S=b({[ne]:P});if(F[te].push(S),O){let T=function(k,R){for(let Z=k;Z;Z=Z.super)if(Z.definition?.declare&&R in Z.definition.declare)return!0;return!1};var M=T;if(S.declare){let k=Object.keys(S.declare).filter(R=>R in A||T(this,R));k.length&&E.log(`Declared keys '${k}' in ${c.name} already exist in base '${this.valueOf()}'`)}if(S.override){let k=Object.keys(S.override).filter(R=>!(R in A)&&!(m&&R in m)&&!T(this,R));k.length&&E.log(`Overridden keys '${k}' in ${c.name} do not exist in base '${this.valueOf()}'`)}}if(g(A,S.declare,!0),g(A,S.override),S.iterable&&Object.keys(S.iterable).forEach(T=>{T in A?E.log(`Ignoring attempt to re-define iterable property "${T}" as it could already have consumers`):be(A,T,S.iterable[T])}),F[te]===D){w||Q(A,p);for(let T of D){let k=T?.constructed?.call(A);se(k)&&A.append(...d(k))}for(let T of D)if(T.iterable){for(let k of Object.keys(T.iterable))if(!(!w&&k in p&&(!$(p[k])||!G(p[k])))){let R=A[k];R?.valueOf()!==void 0&&(A[k]=R)}}}return A},{super:this,definition:Object.assign(o,{[ne]:P}),extended:j,valueOf:()=>{let p=[...Object.keys(o.declare||{}),...Object.keys(o.iterable||{})];return`${c.name}: {${p.join(", ")}} \u21AA ${this.valueOf()}`}});Object.defineProperty(c,Symbol.hasInstance,{value:H,writable:!0,configurable:!0});let x={};(function p(h){h?.super&&p(h.super);let w=h.definition;w&&(g(x,w?.override),g(x,w?.declare))})(this),g(x,o.override),g(x,o.declare),Object.defineProperties(c,Object.getOwnPropertyDescriptors(x));let B=x&&"className"in x&&typeof x.className=="string"?x.className:P,y=O?new Error().stack?.split(` -`)[2]??"":"";if(Object.defineProperty(c,"name",{value:""}),O){let p=Object.keys(o).filter(h=>!["styles","ids","constructed","declare","override","iterable"].includes(h));p.length&&E.log(`${c.name} defines extraneous keys '${p}', which are unknown`)}return c}let L={createElement(l,b,...P){return l===L.createElement?d(...P):typeof l=="function"?l(b,P):typeof l=="string"&&l in L?L[l](b,P):l instanceof Node?l:ie({error:new Error("Illegal type in createElement:"+l)})}};function K(l){if(L[l])return L[l];let b=(o,...I)=>{let c=document;if(se(o)&&(I.unshift(o),o={}),!se(o)){if(o.debugger){debugger;delete o.debugger}o.document&&(c=o.document,delete o.document);let x=r?c.createElementNS(r,l.toLowerCase()):c.createElement(l);return x.constructor=b,g(x,i),Q(x,o),x.append(...d(...I)),x}},P=Object.assign(b,{super:()=>{throw new Error("Can't invoke native elemenet constructors directly. Use document.createElement().")},extended:D,valueOf(){return`TagCreator: <${r||""}${r?"::":""}${l}>`}});return Object.defineProperty(b,Symbol.hasInstance,{value:H,writable:!0,configurable:!0}),Object.defineProperty(b,"name",{value:"<"+l+">"}),L[l]=P}return u.forEach(K),L};function Ee(){return document.createComment(O&&new Error("promise").stack?.replace(/^Error: /,"")||"promise")}function ie({error:e}){return document.createComment(e instanceof Error?e.toString():`Error: -`+JSON.stringify(e,null,2))}var De=function(){De=function(){},new MutationObserver(e=>{e.forEach(function(t){t.type==="childList"&&t.removedNodes.forEach(n=>n&&n instanceof Element&&[...n.getElementsByTagName("*"),n].filter(r=>!r.isConnected).forEach(r=>{"onRemovedFromDOM"in r&&typeof r.onRemovedFromDOM=="function"&&r.onRemovedFromDOM()}))})}).observe(document.body,{subtree:!0,childList:!0})};function st(e,t){let n=new WeakSet;function r(u){for(let s of u)t==="addedNodes"===s.isConnected&&(r(s.childNodes),n.add(s))}return new MutationObserver(u=>{u.forEach(function(s){s.type==="childList"&&s.removedNodes.length&&r(s[t])})}).observe(e,{subtree:!0,childList:!0}),function(u){return n.has(u)}}var Ce=new Set;function je(e,t){return e=e||document,t=t||Object.create(null),e.querySelectorAll&&e.querySelectorAll("[id]").forEach(function(n){n.id&&(t[n.id]?O&&(Ce.has(n.id)||(Ce.add(n.id),E.info("Shadowed multiple element IDs",n.id))):t[n.id]=n)}),t}return We(it);})(); +`)[2]??"":"";if(Object.defineProperty(c,"name",{value:""}),O){let p=Object.keys(o).filter(h=>!["styles","ids","constructed","declare","override","iterable"].includes(h));p.length&&E.log(`${c.name} defines extraneous keys '${p}', which are unknown`)}return c}let L={createElement(l,b,...P){return l===L.createElement?d(...P):typeof l=="function"?l(b,P):typeof l=="string"&&l in L?L[l](b,P):l instanceof Node?l:ie({error:new Error("Illegal type in createElement:"+l)})}};function K(l){if(L[l])return L[l];let b=(o,...I)=>{let c=document;if(se(o)&&(I.unshift(o),o={}),!se(o)){if(o.debugger){debugger;delete o.debugger}o.document&&(c=o.document,delete o.document);let x=r?c.createElementNS(r,l.toLowerCase()):c.createElement(l);return x.constructor=b,g(x,i),Q(x,o),x.append(...d(...I)),x}},P=Object.assign(b,{super:()=>{throw new Error("Can't invoke native elemenet constructors directly. Use document.createElement().")},extended:j,valueOf(){return`TagCreator: <${r||""}${r?"::":""}${l}>`}});return Object.defineProperty(b,Symbol.hasInstance,{value:H,writable:!0,configurable:!0}),Object.defineProperty(b,"name",{value:"<"+l+">"}),L[l]=P}return u.forEach(K),L};function Ee(){return document.createComment(O&&new Error("promise").stack?.replace(/^Error: /,"")||"promise")}function ie({error:e}){return document.createComment(e instanceof Error?e.toString():`Error: +`+JSON.stringify(e,null,2))}var je=function(){je=function(){},new MutationObserver(e=>{e.forEach(function(t){t.type==="childList"&&t.removedNodes.forEach(n=>n&&n instanceof Element&&[...n.getElementsByTagName("*"),n].filter(r=>!r.isConnected).forEach(r=>{"onRemovedFromDOM"in r&&typeof r.onRemovedFromDOM=="function"&&r.onRemovedFromDOM()}))})}).observe(document.body,{subtree:!0,childList:!0})};function st(e,t){let n=new WeakSet;function r(u){for(let s of u)t==="addedNodes"===s.isConnected&&(r(s.childNodes),n.add(s))}return new MutationObserver(u=>{u.forEach(function(s){s.type==="childList"&&s.removedNodes.length&&r(s[t])})}).observe(e,{subtree:!0,childList:!0}),function(u){return n.has(u)}}var Ce=new Set;function De(e,t){return e=e||document,t=t||Object.create(null),e.querySelectorAll&&e.querySelectorAll("[id]").forEach(function(n){n.id&&(t[n.id]?O&&(Ce.has(n.id)||(Ce.add(n.id),E.info("Shadowed multiple element IDs",n.id))):t[n.id]=n)}),t}return We(it);})(); diff --git a/module/dist/ai-ui.min.mjs b/module/dist/ai-ui.min.mjs index a3464ac..c4de833 100644 --- a/module/dist/ai-ui.min.mjs +++ b/module/dist/ai-ui.min.mjs @@ -1,12 +1,12 @@ -var Me=Object.defineProperty;var Ce=(e,t)=>{for(var n in t)Me(e,n,{get:t[n],enumerable:!0})};var O=globalThis.DEBUG=="*"||globalThis.DEBUG==!0||globalThis.DEBUG?.match(/(^|\W)AI-UI(\W|$)/)||!1;var J=5e3,E={log(...e){O&&console.log("(AI-UI) LOG:",...e)},warn(...e){O&&console.warn("(AI-UI) WARN:",...e)},info(...e){O&&console.debug("(AI-UI) INFO:",...e)}};var Te=e=>{};function le(){let e=Te,t=Te,n=new Promise((...r)=>[e,t]=r);if(n.resolve=e,n.reject=t,O){let r=new Error().stack;n.catch(d=>d instanceof Error||d?.value instanceof Error?E.log("Deferred rejection",d,"allocated at ",r):void 0)}return n}function ce(e){return e&&typeof e=="object"||typeof e=="function"}function $(e){return ce(e)&&"then"in e&&typeof e.then=="function"}var we={};Ce(we,{Ignore:()=>N,Iterability:()=>X,asyncIterator:()=>de,augmentGlobalAsyncGenerators:()=>Qe,combine:()=>xe,debounceQueueIteratableIterator:()=>ve,defineIterableProperty:()=>ye,filterMap:()=>V,generatorHelpers:()=>Re,isAsyncIter:()=>G,isAsyncIterable:()=>_,isAsyncIterator:()=>Y,iterableHelpers:()=>W,merge:()=>z,queueIteratableIterator:()=>fe});var X=Symbol("Iterability");function Y(e){return typeof e?.next=="function"}function _(e){return ce(e)&&Symbol.asyncIterator in e&&typeof e[Symbol.asyncIterator]=="function"}function G(e){return _(e)||Y(e)}function de(e){if(_(e))return e[Symbol.asyncIterator]();if(Y(e))return e;throw new Error("Not as async provider")}var re={filterMap(e,t=N){return V(this,e,t)},map:Le,filter:Ue,unique:We,waitFor:Fe,multi:Ge,initially:$e,consume:Pe,merge(...e){return z(this,...e)},combine(e){return xe(Object.assign({_this:this},e))}},ue=[...Object.getOwnPropertySymbols(re),...Object.keys(re)];function Ne(e,...t){for(let n of t)for(let[r,d]of Object.entries(Object.getOwnPropertyDescriptors(n)))Object.defineProperty(e,r,{...d,enumerable:!1});return e}var C=Symbol("pending"),U=Symbol("items");function Ee(e=()=>{}){let t={[C]:[],[U]:[],[Symbol.asyncIterator](){return t},next(){if(t[U]?.length)return Promise.resolve({done:!1,value:t[U].shift()});let n=le();return n.catch(r=>{}),t[C].unshift(n),n},return(n){let r={done:!0,value:void 0};if(t[C]){try{e()}catch{}for(;t[C].length;)t[C].pop().resolve(r);t[U]=t[C]=null}return Promise.resolve(r)},throw(...n){let r={done:!0,value:n[0]};if(t[C]){try{e()}catch{}for(;t[C].length;)t[C].pop().reject(r);t[U]=t[C]=null}return Promise.reject(r)},get length(){return t[U]?t[U].length:-1},push(n){return t[C]?(t[C].length?t[C].pop().resolve({done:!1,value:n}):t[U]?t[U].push(n):E.log("Discarding queue push as there are no consumers"),!0):!1}};return W(t)}var ne=Symbol("inflight");function De(e=()=>{}){let t=Ee(e);return t[ne]=new Set,t.push=function(n){if(!t[C])return!1;if(t[ne].has(n))return!0;if(t[ne].add(n),t[C].length){let r=t[C].pop();r.finally(()=>t[ne].delete(n)),r.resolve({done:!1,value:n})}else t[U]?t[U].find(r=>r===n)||t[U].push(n):E.log("Discarding queue push as there are no consumers");return!0},t}var fe=Ee,ve=De;function ye(e,t,n){let r=()=>{r=()=>v;let a=ve(),g=a.multi(),v=g[Symbol.asyncIterator]();return s[Symbol.asyncIterator]={value:g[Symbol.asyncIterator],enumerable:!1,writable:!1},f=a.push,ue.forEach(Q=>s[Q]={value:v[Q],enumerable:!1,writable:!1}),Object.defineProperties(m,s),v};function d(a){return{[a]:function(...g){return r(),m[a].apply(this,g)}}[a]}let s={[Symbol.asyncIterator]:{enumerable:!1,writable:!0,value:r}};ue.forEach(a=>s[a]={enumerable:!1,writable:!0,value:d(a)});let f=a=>(r(),f(a));typeof n=="object"&&n&&X in n&&(s[X]=Object.getOwnPropertyDescriptor(n,X));let m=u(n,s),i;return Object.defineProperty(e,t,{get(){return m},set(a){if(a!==m)if(_(a)){if(i===a)return;i=a;let g=O?new Error:void 0;O&&E.info(new Error(`Iterable "${t.toString()}" has been assigned to consume another iterator. Did you mean to declare it?`)),Pe.call(a,v=>{if(a!==i)throw new Error(`Piped iterable "${t.toString()}" has been replaced by another iterator`,{cause:g});f(v?.valueOf())}).catch(v=>E.info(v)).finally(()=>a===i&&(i=void 0));return}else{if(i)throw new Error(`Iterable "${t.toString()}" is already piped from another iterator`);m=u(a,s)}f(a?.valueOf())},enumerable:!0}),e;function u(a,g){let v=N;if(a==null)return Object.create(null,{...g,valueOf:{value(){return a},writable:!0},toJSON:{value(){return a},writable:!0}});switch(typeof a){case"object":return Symbol.asyncIterator in a?a:(v===N?(O&&E.info(`The iterable property '${t.toString()}' of type "object" will be spread to prevent re-initialisation. -${new Error().stack?.slice(6)}`),Array.isArray(a)?v=Object.defineProperties([...a],g):v=Object.defineProperties({...a},g)):Object.assign(v,a),v[X]==="shallow"?(v=Object.defineProperties(v,g),v):new Proxy(v,{deleteProperty(H,D){return Reflect.deleteProperty(H,D)?(f(e[t]),!0):!1},set(H,D,L,K){return Reflect.set(H,D,L,K)?(f(e[t]),!0):!1},get(H,D,L){if(D==="valueOf")return()=>v;let K=Reflect.getOwnPropertyDescriptor(H,D);if(K===void 0&&!(D in H)||K?.enumerable){K===void 0&&(H[D]=void 0);let l=Reflect.get(v,D,L),b=Object.getOwnPropertyDescriptors(v.map((o,I)=>{let c=o?.[D]?.valueOf(),x=I?.valueOf();return typeof c==typeof x&&c==x?N:c}));Reflect.ownKeys(b).forEach(o=>b[o].enumerable=!1);let P=u(l,b);return Reflect.set(H,D,P),P}return Reflect.get(H,D,L)}}));case"bigint":case"boolean":case"number":case"string":return Object.defineProperties(Object(a),{...g,toJSON:{value(){return a.valueOf()},writable:!0}})}throw new TypeError('Iterable properties cannot be of type "'+typeof a+'"')}}var z=(...e)=>{let t=new Array(e.length),n=new Array(e.length),r=()=>{r=()=>{};for(let i=0;i({idx:i,result:a}))}},d=[],s=new Promise(()=>{}),f=n.length,m={[Symbol.asyncIterator](){return m},next(){return r(),f?Promise.race(n).then(({idx:i,result:u})=>u.done?(f--,n[i]=s,d[i]=u.value,m.next()):(n[i]=t[i]?t[i].next().then(a=>({idx:i,result:a})).catch(a=>({idx:i,result:{done:!0,value:a}})):Promise.resolve({idx:i,result:{done:!0,value:void 0}}),u)).catch(i=>m.throw?.(i)??Promise.reject({done:!0,value:new Error("Iterator merge exception")})):Promise.resolve({done:!0,value:d})},async return(i){for(let u=0;ua.value,a=>a));return{done:!0,value:d}},async throw(i){for(let u=0;ua.value,a=>a));return{done:!0,value:d}}};return W(m)},xe=(e,t={})=>{let n={},r,d=[],s=0,f=new Promise(()=>{}),m={[Symbol.asyncIterator](){return m},next(){return r===void 0&&(r=Object.entries(e).map(([i,u],a)=>(s+=1,d[a]=u[Symbol.asyncIterator](),d[a].next().then(g=>({si:d,idx:a,k:i,ir:g}))))),function i(){return Promise.race(r).then(({idx:u,k:a,ir:g})=>g.done?(r[u]=f,s-=1,s?i():{done:!0,value:void 0}):(n[a]=g.value,r[u]=d[u].next().then(v=>({idx:u,k:a,ir:v})),t.ignorePartial&&Object.keys(n).length{u!==f&&d[a].return?.(i)}),Promise.resolve({done:!0,value:i})},throw(i){return r.forEach((u,a)=>{u!==f&&d[a].throw?.(i)}),Promise.reject({done:!0,value:i})}};return W(m)};function je(e){return _(e)&&ue.every(t=>t in e&&e[t]===re[t])}function W(e){return je(e)||Ne(e,re),e}function Re(e){return function(...t){let n=e(...t);return W(n)}}async function Pe(e){let t;for await(let n of this)t=e?.(n);await t}var N=Symbol("Ignore");function He(e,t,n){if($(e))return e.then(t,n);try{return t(e)}catch(r){return n(r)}}function V(e,t,n=N){let r,d=N,s={[Symbol.asyncIterator](){return s},next(...f){if(n!==N){let m=Promise.resolve({done:!1,value:n});return n=N,m}return new Promise(function m(i,u){r||(r=e[Symbol.asyncIterator]()),r.next(...f).then(a=>a.done?i(a):He(t(a.value,d),g=>g===N?m(i,u):i({done:!1,value:d=g}),g=>{r.throw?r.throw(g):r.return?.(g),u({done:!0,value:g})}),a=>u({done:!0,value:a})).catch(a=>{r.throw?r.throw(a):r.return?.(a),u({done:!0,value:a})})})},throw(f){return Promise.resolve(r?.throw?r.throw(f):r?.return?.(f)).then(m=>({done:!0,value:m?.value}))},return(f){return Promise.resolve(r?.return?.(f)).then(m=>({done:!0,value:m?.value}))}};return W(s)}function Le(e){return V(this,e)}function Ue(e){return V(this,async t=>await e(t)?t:N)}function We(e){return e?V(this,async(t,n)=>n===N||await e(t,n)?t:N):V(this,(t,n)=>t===n?N:t)}function $e(e){return V(this,t=>t,e)}function Fe(e){return V(this,t=>new Promise(n=>(e(()=>n(t)),t)))}function Ge(){let e=this,t=0,n,r;function d(f){f&&n.resolve(f),f?.done||(n=le(),r.next().then(d).catch(m=>n.reject({done:!0,value:m})))}let s={[Symbol.asyncIterator](){return t+=1,s},next(){return r||(r=e[Symbol.asyncIterator](),d()),n},throw(f){if(t<1)throw new Error("AsyncIterator protocol error");return t-=1,t?Promise.resolve({done:!0,value:f}):Promise.resolve(r?.throw?r.throw(f):r?.return?.(f)).then(m=>({done:!0,value:m?.value}))},return(f){if(t<1)throw new Error("AsyncIterator protocol error");return t-=1,t?Promise.resolve({done:!0,value:f}):Promise.resolve(r?.return?.(f)).then(m=>({done:!0,value:m?.value}))}};return W(s)}function Qe(){let e=async function*(){}();for(;e;){if(Object.getOwnPropertyDescriptor(e,Symbol.asyncIterator)){W(e);break}e=Object.getPrototypeOf(e)}e||E.warn("Failed to augment the prototype of `(async function*())()`")}var ee=new Map;function Ve(e){let t=ee.get(e.type);if(t)for(let n of t)try{let{push:r,terminate:d,container:s,selector:f}=n;if(s.isConnected){if(e.target instanceof Node)if(f){let m=s.querySelectorAll(f);for(let i of m)(e.target===i||i.contains(e.target))&&s.contains(i)&&r(e)}else(e.target===s||s.contains(e.target))&&r(e)}else{let m="Container `#"+s.id+">"+(f||"")+"` removed from DOM. Removing subscription";t.delete(n),d(new Error(m))}}catch(r){E.warn("docEventHandler",r)}}function pe(e){return!!(e&&(e.startsWith("#")||e.startsWith(".")||e.startsWith("[")&&e.endsWith("]")))}function he(e){let t=e.split(":");if(t.length===1)return pe(t[0])?[t[0],"change"]:[null,t[0]];if(t.length===2&&pe(t[1])&&!pe(t[0]))return[t[1],t[0]]}function qe(e){throw new Error(e)}function be(e,t){let[n,r]=he(t)??qe("Invalid WhenSelector: "+t);ee.has(r)||(document.addEventListener(r,Ve,{passive:!0,capture:!0}),ee.set(r,new Set));let d=fe(()=>ee.get(r)?.delete(s)),s={push:d.push,terminate(f){d.return?.(f)},container:e,selector:n||null};return Oe(e,n?[n]:void 0).then(f=>ee.get(r).add(s)),d.multi()}async function*Ae(){await new Promise(()=>{}),yield void 0}function me(e){function t(n){return e.map(n)}return Object.assign(W(t),{[Symbol.asyncIterator]:()=>e[Symbol.asyncIterator]()})}function Ke(e){if(!e)throw new Error(`Falsy async source will never be ready +var Me=Object.defineProperty;var Ce=(e,t)=>{for(var n in t)Me(e,n,{get:t[n],enumerable:!0})};var O=globalThis.DEBUG=="*"||globalThis.DEBUG==!0||globalThis.DEBUG?.match(/(^|\W)AI-UI(\W|$)/)||!1;var J=5e3,E={log(...e){O&&console.log("(AI-UI) LOG:",...e)},warn(...e){O&&console.warn("(AI-UI) WARN:",...e)},info(...e){O&&console.debug("(AI-UI) INFO:",...e)}};var Te=e=>{};function le(){let e=Te,t=Te,n=new Promise((...r)=>[e,t]=r);if(n.resolve=e,n.reject=t,O){let r=new Error().stack;n.catch(d=>d instanceof Error||d?.value instanceof Error?E.log("Deferred rejection",d,"allocated at ",r):void 0)}return n}function ce(e){return e&&typeof e=="object"||typeof e=="function"}function $(e){return ce(e)&&"then"in e&&typeof e.then=="function"}var we={};Ce(we,{Ignore:()=>N,Iterability:()=>X,asyncIterator:()=>de,augmentGlobalAsyncGenerators:()=>Qe,combine:()=>xe,debounceQueueIteratableIterator:()=>ve,defineIterableProperty:()=>ye,filterMap:()=>V,generatorHelpers:()=>Re,isAsyncIter:()=>G,isAsyncIterable:()=>_,isAsyncIterator:()=>Y,iterableHelpers:()=>W,merge:()=>z,queueIteratableIterator:()=>fe});var X=Symbol("Iterability");function Y(e){return typeof e?.next=="function"}function _(e){return ce(e)&&Symbol.asyncIterator in e&&typeof e[Symbol.asyncIterator]=="function"}function G(e){return _(e)||Y(e)}function de(e){if(_(e))return e[Symbol.asyncIterator]();if(Y(e))return e;throw new Error("Not as async provider")}var re={filterMap(e,t=N){return V(this,e,t)},map:Le,filter:Ue,unique:We,waitFor:Fe,multi:Ge,initially:$e,consume:Pe,merge(...e){return z(this,...e)},combine(e){return xe(Object.assign({_this:this},e))}},ue=[...Object.getOwnPropertySymbols(re),...Object.keys(re)];function Ne(e,t){let n=[...Object.getOwnPropertyNames(t),...Object.getOwnPropertySymbols(t)];for(let r of n)Object.defineProperty(e,r,{...Object.getOwnPropertyDescriptor(t,r),enumerable:!1});return e}var C=Symbol("pending"),U=Symbol("items");function Ee(e=()=>{}){let t={[C]:[],[U]:[],[Symbol.asyncIterator](){return t},next(){if(t[U]?.length)return Promise.resolve({done:!1,value:t[U].shift()});let n=le();return n.catch(r=>{}),t[C].unshift(n),n},return(n){let r={done:!0,value:void 0};if(t[C]){try{e()}catch{}for(;t[C].length;)t[C].pop().resolve(r);t[U]=t[C]=null}return Promise.resolve(r)},throw(...n){let r={done:!0,value:n[0]};if(t[C]){try{e()}catch{}for(;t[C].length;)t[C].pop().reject(r);t[U]=t[C]=null}return Promise.reject(r)},get length(){return t[U]?t[U].length:-1},push(n){return t[C]?(t[C].length?t[C].pop().resolve({done:!1,value:n}):t[U]?t[U].push(n):E.log("Discarding queue push as there are no consumers"),!0):!1}};return W(t)}var ne=Symbol("inflight");function je(e=()=>{}){let t=Ee(e);return t[ne]=new Set,t.push=function(n){if(!t[C])return!1;if(t[ne].has(n))return!0;if(t[ne].add(n),t[C].length){let r=t[C].pop();r.finally(()=>t[ne].delete(n)),r.resolve({done:!1,value:n})}else t[U]?t[U].find(r=>r===n)||t[U].push(n):E.log("Discarding queue push as there are no consumers");return!0},t}var fe=Ee,ve=je;function ye(e,t,n){let r=()=>{r=()=>v;let a=ve(),g=a.multi(),v=g[Symbol.asyncIterator]();return s[Symbol.asyncIterator]={value:g[Symbol.asyncIterator],enumerable:!1,writable:!1},f=a.push,ue.forEach(Q=>s[Q]={value:v[Q],enumerable:!1,writable:!1}),Object.defineProperties(m,s),v};function d(a){return{[a]:function(...g){return r(),m[a].apply(this,g)}}[a]}let s={[Symbol.asyncIterator]:{enumerable:!1,writable:!0,value:r}};ue.forEach(a=>s[a]={enumerable:!1,writable:!0,value:d(a)});let f=a=>(r(),f(a));typeof n=="object"&&n&&X in n&&(s[X]=Object.getOwnPropertyDescriptor(n,X));let m=u(n,s),i;return Object.defineProperty(e,t,{get(){return m},set(a){if(a!==m)if(_(a)){if(i===a)return;i=a;let g=O?new Error:void 0;O&&E.info(new Error(`Iterable "${t.toString()}" has been assigned to consume another iterator. Did you mean to declare it?`)),Pe.call(a,v=>{if(a!==i)throw new Error(`Piped iterable "${t.toString()}" has been replaced by another iterator`,{cause:g});f(v?.valueOf())}).catch(v=>E.info(v)).finally(()=>a===i&&(i=void 0));return}else{if(i)throw new Error(`Iterable "${t.toString()}" is already piped from another iterator`);m=u(a,s)}f(a?.valueOf())},enumerable:!0}),e;function u(a,g){let v=N;if(a==null)return Object.create(null,{...g,valueOf:{value(){return a},writable:!0},toJSON:{value(){return a},writable:!0}});switch(typeof a){case"object":return Symbol.asyncIterator in a?a:(v===N?(O&&E.info(`The iterable property '${t.toString()}' of type "object" will be spread to prevent re-initialisation. +${new Error().stack?.slice(6)}`),Array.isArray(a)?v=Object.defineProperties([...a],g):v=Object.defineProperties({...a},g)):Object.assign(v,a),v[X]==="shallow"?(v=Object.defineProperties(v,g),v):new Proxy(v,{deleteProperty(H,j){return Reflect.deleteProperty(H,j)?(f(e[t]),!0):!1},set(H,j,L,K){return Reflect.set(H,j,L,K)?(f(e[t]),!0):!1},get(H,j,L){if(j==="valueOf")return()=>v;let K=Reflect.getOwnPropertyDescriptor(H,j);if(K===void 0&&!(j in H)||K?.enumerable){K===void 0&&(H[j]=void 0);let l=Reflect.get(v,j,L),b=Object.getOwnPropertyDescriptors(v.map((o,I)=>{let c=o?.[j]?.valueOf(),x=I?.valueOf();return typeof c==typeof x&&c==x?N:c}));Reflect.ownKeys(b).forEach(o=>b[o].enumerable=!1);let P=u(l,b);return Reflect.set(H,j,P),P}return Reflect.get(H,j,L)}}));case"bigint":case"boolean":case"number":case"string":return Object.defineProperties(Object(a),{...g,toJSON:{value(){return a.valueOf()},writable:!0}})}throw new TypeError('Iterable properties cannot be of type "'+typeof a+'"')}}var z=(...e)=>{let t=new Array(e.length),n=new Array(e.length),r=()=>{r=()=>{};for(let i=0;i({idx:i,result:a}))}},d=[],s=new Promise(()=>{}),f=n.length,m={[Symbol.asyncIterator](){return m},next(){return r(),f?Promise.race(n).then(({idx:i,result:u})=>u.done?(f--,n[i]=s,d[i]=u.value,m.next()):(n[i]=t[i]?t[i].next().then(a=>({idx:i,result:a})).catch(a=>({idx:i,result:{done:!0,value:a}})):Promise.resolve({idx:i,result:{done:!0,value:void 0}}),u)).catch(i=>m.throw?.(i)??Promise.reject({done:!0,value:new Error("Iterator merge exception")})):Promise.resolve({done:!0,value:d})},async return(i){for(let u=0;ua.value,a=>a));return{done:!0,value:d}},async throw(i){for(let u=0;ua.value,a=>a));return{done:!0,value:d}}};return W(m)},xe=(e,t={})=>{let n={},r,d=[],s=0,f=new Promise(()=>{}),m={[Symbol.asyncIterator](){return m},next(){return r===void 0&&(r=Object.entries(e).map(([i,u],a)=>(s+=1,d[a]=u[Symbol.asyncIterator](),d[a].next().then(g=>({si:d,idx:a,k:i,ir:g}))))),function i(){return Promise.race(r).then(({idx:u,k:a,ir:g})=>g.done?(r[u]=f,s-=1,s?i():{done:!0,value:void 0}):(n[a]=g.value,r[u]=d[u].next().then(v=>({idx:u,k:a,ir:v})),t.ignorePartial&&Object.keys(n).length{u!==f&&d[a].return?.(i)}),Promise.resolve({done:!0,value:i})},throw(i){return r.forEach((u,a)=>{u!==f&&d[a].throw?.(i)}),Promise.reject({done:!0,value:i})}};return W(m)};function De(e){return _(e)&&ue.every(t=>t in e&&e[t]===re[t])}function W(e){return De(e)||Ne(e,re),e}function Re(e){return function(...t){let n=e(...t);return W(n)}}async function Pe(e){let t;for await(let n of this)t=e?.(n);await t}var N=Symbol("Ignore");function He(e,t,n){if($(e))return e.then(t,n);try{return t(e)}catch(r){return n(r)}}function V(e,t,n=N){let r,d=N,s={[Symbol.asyncIterator](){return s},next(...f){if(n!==N){let m=Promise.resolve({done:!1,value:n});return n=N,m}return new Promise(function m(i,u){r||(r=e[Symbol.asyncIterator]()),r.next(...f).then(a=>a.done?i(a):He(t(a.value,d),g=>g===N?m(i,u):i({done:!1,value:d=g}),g=>{r.throw?r.throw(g):r.return?.(g),u({done:!0,value:g})}),a=>u({done:!0,value:a})).catch(a=>{r.throw?r.throw(a):r.return?.(a),u({done:!0,value:a})})})},throw(f){return Promise.resolve(r?.throw?r.throw(f):r?.return?.(f)).then(m=>({done:!0,value:m?.value}))},return(f){return Promise.resolve(r?.return?.(f)).then(m=>({done:!0,value:m?.value}))}};return W(s)}function Le(e){return V(this,e)}function Ue(e){return V(this,async t=>await e(t)?t:N)}function We(e){return e?V(this,async(t,n)=>n===N||await e(t,n)?t:N):V(this,(t,n)=>t===n?N:t)}function $e(e){return V(this,t=>t,e)}function Fe(e){return V(this,t=>new Promise(n=>(e(()=>n(t)),t)))}function Ge(){let e=this,t=0,n,r;function d(f){f&&n.resolve(f),f?.done||(n=le(),r.next().then(d).catch(m=>n.reject({done:!0,value:m})))}let s={[Symbol.asyncIterator](){return t+=1,s},next(){return r||(r=e[Symbol.asyncIterator](),d()),n},throw(f){if(t<1)throw new Error("AsyncIterator protocol error");return t-=1,t?Promise.resolve({done:!0,value:f}):Promise.resolve(r?.throw?r.throw(f):r?.return?.(f)).then(m=>({done:!0,value:m?.value}))},return(f){if(t<1)throw new Error("AsyncIterator protocol error");return t-=1,t?Promise.resolve({done:!0,value:f}):Promise.resolve(r?.return?.(f)).then(m=>({done:!0,value:m?.value}))}};return W(s)}function Qe(){let e=async function*(){}();for(;e;){if(Object.getOwnPropertyDescriptor(e,Symbol.asyncIterator)){W(e);break}e=Object.getPrototypeOf(e)}e||E.warn("Failed to augment the prototype of `(async function*())()`")}var ee=new Map;function Ve(e){let t=ee.get(e.type);if(t)for(let n of t)try{let{push:r,terminate:d,container:s,selector:f}=n;if(s.isConnected){if(e.target instanceof Node)if(f){let m=s.querySelectorAll(f);for(let i of m)(e.target===i||i.contains(e.target))&&s.contains(i)&&r(e)}else(e.target===s||s.contains(e.target))&&r(e)}else{let m="Container `#"+s.id+">"+(f||"")+"` removed from DOM. Removing subscription";t.delete(n),d(new Error(m))}}catch(r){E.warn("docEventHandler",r)}}function pe(e){return!!(e&&(e.startsWith("#")||e.startsWith(".")||e.startsWith("[")&&e.endsWith("]")))}function he(e){let t=e.split(":");if(t.length===1)return pe(t[0])?[t[0],"change"]:[null,t[0]];if(t.length===2&&pe(t[1])&&!pe(t[0]))return[t[1],t[0]]}function qe(e){throw new Error(e)}function be(e,t){let[n,r]=he(t)??qe("Invalid WhenSelector: "+t);ee.has(r)||(document.addEventListener(r,Ve,{passive:!0,capture:!0}),ee.set(r,new Set));let d=fe(()=>ee.get(r)?.delete(s)),s={push:d.push,terminate(f){d.return?.(f)},container:e,selector:n||null};return Oe(e,n?[n]:void 0).then(f=>ee.get(r).add(s)),d.multi()}async function*Ae(){await new Promise(()=>{}),yield void 0}function me(e){function t(n){return e.map(n)}return Object.assign(W(t),{[Symbol.asyncIterator]:()=>e[Symbol.asyncIterator]()})}function Ke(e){if(!e)throw new Error(`Falsy async source will never be ready `+JSON.stringify(e));return typeof e=="string"&&e[0]!=="@"&&!!he(e)}async function*Be(e){yield e}function ge(e,...t){if(!t||t.length===0)return me(be(e,"change"));let n=t.filter(s=>typeof s!="string"||s[0]!=="@").map(s=>typeof s=="string"?be(e,s):s instanceof Element?be(s,"change"):$(s)?Be(s):s);if(t.includes("@start")){let s={[Symbol.asyncIterator]:()=>s,next(){return s.next=()=>Promise.resolve({done:!0,value:void 0}),Promise.resolve({done:!1,value:{}})}};n.push(s)}if(t.includes("@ready")){let f=function(a){return typeof a=="string"&&!e.querySelector(a)};var d=f;let m=t.filter(Ke).map(a=>he(a)?.[0]).filter(f),i,u={[Symbol.asyncIterator](){return u},throw(a){return i?.throw?i.throw(a):Promise.resolve({done:!0,value:a})},return(a){return i?.return?i.return(a):Promise.resolve({done:!0,value:a})},next(){return i?i.next():Oe(e,m).then(()=>(i=(n.length>1?z(...n):n.length===1?n[0]:Ae())[Symbol.asyncIterator](),i?{done:!1,value:{}}:{done:!0,value:void 0}))}};return me(W(u))}let r=n.length>1?z(...n):n.length===1?n[0]:Ae();return me(W(r))}function Se(e){return e.isConnected?Promise.resolve():new Promise(t=>new MutationObserver((n,r)=>{n.some(d=>d.addedNodes?.length)&&e.isConnected&&(r.disconnect(),t())}).observe(document.body,{subtree:!0,childList:!0}))}function Oe(e,t){return t?.length?Promise.all([Ye(e,t),Se(e)]):Se(e)}function Ye(e,t){if(t=t.filter(r=>!e.querySelector(r)),!t.length)return Promise.resolve();let n=new Promise(r=>new MutationObserver((d,s)=>{d.some(f=>f.addedNodes?.length)&&t.every(f=>e.querySelector(f))&&(s.disconnect(),r())}).observe(e,{subtree:!0,childList:!0}));if(O){let r=new Error().stack?.replace(/^Error/,"Missing selectors after 5 seconds:"),d=setTimeout(()=>{E.warn(r,t)},J);n.finally(()=>clearTimeout(d))}return n}var oe=Symbol("Unique ID"),q=O?e=>`"${"innerHTML"in e?e.innerHTML:e.textContent}"`:e=>{},Ze=0,Je=["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","link","main","map","mark","menu","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","script","search","section","select","slot","small","source","span","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr"],Xe=Object.getOwnPropertyDescriptors({get ids(){return tt(this)},set ids(e){throw new Error("Cannot set ids on "+this.valueOf())},when:function(...e){return ge(this,...e)}}),ie=document.createElement("STYLE");ie.id="--ai-ui-extended-tag-styles-";function ae(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"||e instanceof Node||e instanceof NodeList||e instanceof HTMLCollection||e===null||e===void 0||Array.isArray(e)||$(e)||G(e)||typeof e=="object"&&Symbol.iterator in e&&typeof e[Symbol.iterator]=="function"}var te=Symbol("callStack"),_e=function(e,t,n){let[r,d,s]=typeof e=="string"||e===null?[e,t,n]:Array.isArray(e)?[null,e,t]:[null,Je,e],f=et(document,"removedNodes"),m=s?.commonProperties,i=Object.create(null,Xe);Object.defineProperty(i,"attributes",{...Object.getOwnPropertyDescriptor(Element.prototype,"attributes"),set(l){if(G(l)){let b=Y(l)?l:l[Symbol.asyncIterator](),P=()=>b.next().then(({done:o,value:I})=>{Q(this,I),o||P()},o=>E.warn(o));P()}else Q(this,l)}}),m&&g(i,m);function u(...l){let b=[];return function P(o){if(!(o==null||o===N)){if($(o)){let I=Ie();b.push(I),o.then(c=>I.replaceWith(...u(c)),c=>{E.warn(c,q(I)),I.replaceWith(se({error:c}))});return}if(o instanceof Node){b.push(o);return}if(o&&typeof o=="object"&&Symbol.iterator in o&&!(Symbol.asyncIterator in o)&&o[Symbol.iterator]){for(let I of o)P(I);return}if(G(o)){let I=O?` -`+new Error().stack?.replace(/^Error: /,"Insertion :"):"",c=Y(o)?o:o[Symbol.asyncIterator](),x=o.valueOf(),B=x===void 0||x===o?[Ie()]:u(x);b.push(...B);let y=B,p=!0,h=Date.now()+J,w=O&&new Error("Created by").stack,j=A=>{let S=y.filter(M=>!!M?.parentNode);S.length?(y=[se({error:A})],S[0].replaceWith(...y),S.slice(1).forEach(M=>M?.parentNode.removeChild(M))):E.warn("Can't report error",A,w,y.map(q)),y=[],c.return?.(j)},F=A=>{if(!A.done)try{let S=y.filter(T=>T?.parentNode&&T.isConnected),M=p?y:S;if(S.length&&(p=!1),!M.length||y.every(T=>f(T))){y=[];let T="Element(s) have been removed from the document: "+I;c.return?.(new Error(T));return}O&&p&&h&&h!y.includes(T)&&T.parentNode?.removeChild(T)),c.next().then(F).catch(j)}catch(S){y=[],c.return?.(S)}};c.next().then(F).catch(j);return}b.push(document.createTextNode(o.toString()))}}(l),b}r||Object.assign(_e,{nodes:u,UniqueID:oe});let a=Object.getPrototypeOf({});function g(l,b,P){if(!(b==null||typeof b!="object"||b===l))for(let[o,I]of Object.entries(Object.getOwnPropertyDescriptors(b)))try{if("value"in I){let c=I.value;c&&G(c)?Object.defineProperty(l,o,I):c&&typeof c=="object"&&!$(c)?o in l?c instanceof Node?(E.info("Having DOM Nodes as properties of other DOM Nodes is a bad idea as it makes the DOM tree into a cyclic graph. You should reference nodes by ID or as a child",o,q(c)),l[o]=c):l[o]!==c&&(Array.isArray(l[o])&&l[o].length!==c.length?c.constructor===Object||c.constructor===Array?g(l[o]=new c.constructor,c):l[o]=c:g(l[o],c)):(P&&(Object.getPrototypeOf(c)===a||!Object.getPrototypeOf(c)?g(I.value={},c):Array.isArray(c)?g(I.value=[],c):E.warn(`Declared propety '${o}' is not a plain object and must be assigned by reference, possibly polluting other instances of this tag`,l,c)),Object.defineProperty(l,o,I)):b[o]!==void 0&&(l[o]=b[o])}else Object.defineProperty(l,o,I)}catch(c){throw E.warn("deepAssign",o,b[o],c),c}}function v(l){let b=l?.valueOf();return Array.isArray(b)?Array.prototype.map.call(b,v):b}function Q(l,b){te in b||function P(o,I){if(I==null||typeof I!="object")return;let c=Object.entries(Object.getOwnPropertyDescriptors(I));Array.isArray(I)||c.sort((y,p)=>{let h=Object.getOwnPropertyDescriptor(o,y[0]);if(h){if("value"in h)return-1;if("set"in h)return 1;if("get"in h)return .5}return 0});for(let[y,p]of c)try{if("value"in p){let h=p.value;G(h)?x(h,y):$(h)?h.then(w=>{w&&typeof w=="object"?G(w)?x(w,y):B(w,y):I[y]!==void 0&&(o[y]=w)},w=>E.log("Failed to set attribute",w)):G(h)||(h&&typeof h=="object"&&!$(h)?B(h,y):I[y]!==void 0&&(o[y]=I[y]))}else Object.defineProperty(o,y,p)}catch(h){throw E.warn("assignProps",y,I[y],h),h}function x(y,p){let h=de(y),w=!0,j=Date.now()+J,F=O&&new Error("Created by").stack,A=M=>{if(!M.done){let T=v(M.value);if(typeof T=="object"&&T!==null){let R=Object.getOwnPropertyDescriptor(o,p);p==="style"||!R?.set?P(o[p],T):o[p]=T}else T!==void 0&&(o[p]=T);let k=l.isConnected;if(f(l)||!w&&!k){E.info(`Element does not exist in document when setting async attribute '${p}' to: -${q(l)}`),h.return?.();return}k&&(w=!1),w&&j&&j{let S=y.filter(M=>!!M?.parentNode);S.length?(y=[se({error:A})],S[0].replaceWith(...y),S.slice(1).forEach(M=>M?.parentNode.removeChild(M))):E.warn("Can't report error",A,w,y.map(q)),y=[],c.return?.(D)},F=A=>{if(!A.done)try{let S=y.filter(T=>T?.parentNode&&T.isConnected),M=p?y:S;if(S.length&&(p=!1),!M.length||y.every(T=>f(T))){y=[];let T="Element(s) have been removed from the document: "+I;c.return?.(new Error(T));return}O&&p&&h&&h!y.includes(T)&&T.parentNode?.removeChild(T)),c.next().then(F).catch(D)}catch(S){y=[],c.return?.(S)}};c.next().then(F).catch(D);return}b.push(document.createTextNode(o.toString()))}}(l),b}r||Object.assign(_e,{nodes:u,UniqueID:oe});let a=Object.getPrototypeOf({});function g(l,b,P){if(!(b==null||typeof b!="object"||b===l))for(let[o,I]of Object.entries(Object.getOwnPropertyDescriptors(b)))try{if("value"in I){let c=I.value;c&&G(c)?Object.defineProperty(l,o,I):c&&typeof c=="object"&&!$(c)?o in l?c instanceof Node?(E.info("Having DOM Nodes as properties of other DOM Nodes is a bad idea as it makes the DOM tree into a cyclic graph. You should reference nodes by ID or as a child",o,q(c)),l[o]=c):l[o]!==c&&(Array.isArray(l[o])&&l[o].length!==c.length?c.constructor===Object||c.constructor===Array?g(l[o]=new c.constructor,c):l[o]=c:g(l[o],c)):(P&&(Object.getPrototypeOf(c)===a||!Object.getPrototypeOf(c)?g(I.value={},c):Array.isArray(c)?g(I.value=[],c):E.warn(`Declared propety '${o}' is not a plain object and must be assigned by reference, possibly polluting other instances of this tag`,l,c)),Object.defineProperty(l,o,I)):b[o]!==void 0&&(l[o]=b[o])}else Object.defineProperty(l,o,I)}catch(c){throw E.warn("deepAssign",o,b[o],c),c}}function v(l){let b=l?.valueOf();return Array.isArray(b)?Array.prototype.map.call(b,v):b}function Q(l,b){te in b||function P(o,I){if(I==null||typeof I!="object")return;let c=Object.entries(Object.getOwnPropertyDescriptors(I));Array.isArray(I)||c.sort((y,p)=>{let h=Object.getOwnPropertyDescriptor(o,y[0]);if(h){if("value"in h)return-1;if("set"in h)return 1;if("get"in h)return .5}return 0});for(let[y,p]of c)try{if("value"in p){let h=p.value;G(h)?x(h,y):$(h)?h.then(w=>{w&&typeof w=="object"?G(w)?x(w,y):B(w,y):I[y]!==void 0&&(o[y]=w)},w=>E.log("Failed to set attribute",w)):G(h)||(h&&typeof h=="object"&&!$(h)?B(h,y):I[y]!==void 0&&(o[y]=I[y]))}else Object.defineProperty(o,y,p)}catch(h){throw E.warn("assignProps",y,I[y],h),h}function x(y,p){let h=de(y),w=!0,D=Date.now()+J,F=O&&new Error("Created by").stack,A=M=>{if(!M.done){let T=v(M.value);if(typeof T=="object"&&T!==null){let R=Object.getOwnPropertyDescriptor(o,p);p==="style"||!R?.set?P(o[p],T):o[p]=T}else T!==void 0&&(o[p]=T);let k=l.isConnected;if(f(l)||!w&&!k){E.info(`Element does not exist in document when setting async attribute '${p}' to: +${q(l)}`),h.return?.();return}k&&(w=!1),w&&D&&D{E.warn("Dynamic attribute error",M,p,o,F,q(l)),h.return?.(M),l.appendChild(se({error:M}))};h.next().then(A).catch(S)}function B(y,p){if(y instanceof Node)E.info("Having DOM Nodes as properties of other DOM Nodes is a bad idea as it makes the DOM tree into a cyclic graph. You should reference nodes by ID or via a collection such as .childNodes",p,q(y)),o[p]=y;else if(!(p in o)||o[p]===y||Array.isArray(o[p])&&o[p].length!==y.length)if(y.constructor===Object||y.constructor===Array){let h=new y.constructor;P(h,y),o[p]=h}else o[p]=y;else Object.getOwnPropertyDescriptor(o,p)?.set?o[p]=y:P(o[p],y)}}(l,b)}function H(l){for(let b=l.constructor;b;b=b.super)if(b===this)return!0;return!1}function D(l){let b=typeof l!="function"?p=>Object.assign({},l,p):l,P=Date.now().toString(36)+(Ze++).toString(36)+Math.random().toString(36).slice(2),o=b({[oe]:P});o.styles&&(ie.appendChild(document.createTextNode(o.styles+` -`)),document.head.contains(ie)||document.head.appendChild(ie));let c=Object.assign((p,...h)=>{let w=ae(p),j=[],F={[te]:(w?j:p[te])??j},A=w?this(F,p,...h):this(F,...h);A.constructor=c;let S=b({[oe]:P});if(F[te].push(S),O){let T=function(k,R){for(let Z=k;Z;Z=Z.super)if(Z.definition?.declare&&R in Z.definition.declare)return!0;return!1};var M=T;if(S.declare){let k=Object.keys(S.declare).filter(R=>R in A||T(this,R));k.length&&E.log(`Declared keys '${k}' in ${c.name} already exist in base '${this.valueOf()}'`)}if(S.override){let k=Object.keys(S.override).filter(R=>!(R in A)&&!(m&&R in m)&&!T(this,R));k.length&&E.log(`Overridden keys '${k}' in ${c.name} do not exist in base '${this.valueOf()}'`)}}if(g(A,S.declare,!0),g(A,S.override),S.iterable&&Object.keys(S.iterable).forEach(T=>{T in A?E.log(`Ignoring attempt to re-define iterable property "${T}" as it could already have consumers`):ye(A,T,S.iterable[T])}),F[te]===j){w||Q(A,p);for(let T of j){let k=T?.constructed?.call(A);ae(k)&&A.append(...u(k))}for(let T of j)if(T.iterable){for(let k of Object.keys(T.iterable))if(!(!w&&k in p&&(!$(p[k])||!G(p[k])))){let R=A[k];R?.valueOf()!==void 0&&(A[k]=R)}}}return A},{super:this,definition:Object.assign(o,{[oe]:P}),extended:D,valueOf:()=>{let p=[...Object.keys(o.declare||{}),...Object.keys(o.iterable||{})];return`${c.name}: {${p.join(", ")}} +${F}`)),h.next().then(A).catch(S)}},S=M=>{E.warn("Dynamic attribute error",M,p,o,F,q(l)),h.return?.(M),l.appendChild(se({error:M}))};h.next().then(A).catch(S)}function B(y,p){if(y instanceof Node)E.info("Having DOM Nodes as properties of other DOM Nodes is a bad idea as it makes the DOM tree into a cyclic graph. You should reference nodes by ID or via a collection such as .childNodes",p,q(y)),o[p]=y;else if(!(p in o)||o[p]===y||Array.isArray(o[p])&&o[p].length!==y.length)if(y.constructor===Object||y.constructor===Array){let h=new y.constructor;P(h,y),o[p]=h}else o[p]=y;else Object.getOwnPropertyDescriptor(o,p)?.set?o[p]=y:P(o[p],y)}}(l,b)}function H(l){for(let b=l.constructor;b;b=b.super)if(b===this)return!0;return!1}function j(l){let b=typeof l!="function"?p=>Object.assign({},l,p):l,P=Date.now().toString(36)+(Ze++).toString(36)+Math.random().toString(36).slice(2),o=b({[oe]:P});o.styles&&(ie.appendChild(document.createTextNode(o.styles+` +`)),document.head.contains(ie)||document.head.appendChild(ie));let c=Object.assign((p,...h)=>{let w=ae(p),D=[],F={[te]:(w?D:p[te])??D},A=w?this(F,p,...h):this(F,...h);A.constructor=c;let S=b({[oe]:P});if(F[te].push(S),O){let T=function(k,R){for(let Z=k;Z;Z=Z.super)if(Z.definition?.declare&&R in Z.definition.declare)return!0;return!1};var M=T;if(S.declare){let k=Object.keys(S.declare).filter(R=>R in A||T(this,R));k.length&&E.log(`Declared keys '${k}' in ${c.name} already exist in base '${this.valueOf()}'`)}if(S.override){let k=Object.keys(S.override).filter(R=>!(R in A)&&!(m&&R in m)&&!T(this,R));k.length&&E.log(`Overridden keys '${k}' in ${c.name} do not exist in base '${this.valueOf()}'`)}}if(g(A,S.declare,!0),g(A,S.override),S.iterable&&Object.keys(S.iterable).forEach(T=>{T in A?E.log(`Ignoring attempt to re-define iterable property "${T}" as it could already have consumers`):ye(A,T,S.iterable[T])}),F[te]===D){w||Q(A,p);for(let T of D){let k=T?.constructed?.call(A);ae(k)&&A.append(...u(k))}for(let T of D)if(T.iterable){for(let k of Object.keys(T.iterable))if(!(!w&&k in p&&(!$(p[k])||!G(p[k])))){let R=A[k];R?.valueOf()!==void 0&&(A[k]=R)}}}return A},{super:this,definition:Object.assign(o,{[oe]:P}),extended:j,valueOf:()=>{let p=[...Object.keys(o.declare||{}),...Object.keys(o.iterable||{})];return`${c.name}: {${p.join(", ")}} \u21AA ${this.valueOf()}`}});Object.defineProperty(c,Symbol.hasInstance,{value:H,writable:!0,configurable:!0});let x={};(function p(h){h?.super&&p(h.super);let w=h.definition;w&&(g(x,w?.override),g(x,w?.declare))})(this),g(x,o.override),g(x,o.declare),Object.defineProperties(c,Object.getOwnPropertyDescriptors(x));let B=x&&"className"in x&&typeof x.className=="string"?x.className:P,y=O?new Error().stack?.split(` -`)[2]??"":"";if(Object.defineProperty(c,"name",{value:""}),O){let p=Object.keys(o).filter(h=>!["styles","ids","constructed","declare","override","iterable"].includes(h));p.length&&E.log(`${c.name} defines extraneous keys '${p}', which are unknown`)}return c}let L={createElement(l,b,...P){return l===L.createElement?u(...P):typeof l=="function"?l(b,P):typeof l=="string"&&l in L?L[l](b,P):l instanceof Node?l:se({error:new Error("Illegal type in createElement:"+l)})}};function K(l){if(L[l])return L[l];let b=(o,...I)=>{let c=document;if(ae(o)&&(I.unshift(o),o={}),!ae(o)){if(o.debugger){debugger;delete o.debugger}o.document&&(c=o.document,delete o.document);let x=r?c.createElementNS(r,l.toLowerCase()):c.createElement(l);return x.constructor=b,g(x,i),Q(x,o),x.append(...u(...I)),x}},P=Object.assign(b,{super:()=>{throw new Error("Can't invoke native elemenet constructors directly. Use document.createElement().")},extended:D,valueOf(){return`TagCreator: <${r||""}${r?"::":""}${l}>`}});return Object.defineProperty(b,Symbol.hasInstance,{value:H,writable:!0,configurable:!0}),Object.defineProperty(b,"name",{value:"<"+l+">"}),L[l]=P}return d.forEach(K),L};function Ie(){return document.createComment(O&&new Error("promise").stack?.replace(/^Error: /,"")||"promise")}function se({error:e}){return document.createComment(e instanceof Error?e.toString():`Error: +`)[2]??"":"";if(Object.defineProperty(c,"name",{value:""}),O){let p=Object.keys(o).filter(h=>!["styles","ids","constructed","declare","override","iterable"].includes(h));p.length&&E.log(`${c.name} defines extraneous keys '${p}', which are unknown`)}return c}let L={createElement(l,b,...P){return l===L.createElement?u(...P):typeof l=="function"?l(b,P):typeof l=="string"&&l in L?L[l](b,P):l instanceof Node?l:se({error:new Error("Illegal type in createElement:"+l)})}};function K(l){if(L[l])return L[l];let b=(o,...I)=>{let c=document;if(ae(o)&&(I.unshift(o),o={}),!ae(o)){if(o.debugger){debugger;delete o.debugger}o.document&&(c=o.document,delete o.document);let x=r?c.createElementNS(r,l.toLowerCase()):c.createElement(l);return x.constructor=b,g(x,i),Q(x,o),x.append(...u(...I)),x}},P=Object.assign(b,{super:()=>{throw new Error("Can't invoke native elemenet constructors directly. Use document.createElement().")},extended:j,valueOf(){return`TagCreator: <${r||""}${r?"::":""}${l}>`}});return Object.defineProperty(b,Symbol.hasInstance,{value:H,writable:!0,configurable:!0}),Object.defineProperty(b,"name",{value:"<"+l+">"}),L[l]=P}return d.forEach(K),L};function Ie(){return document.createComment(O&&new Error("promise").stack?.replace(/^Error: /,"")||"promise")}function se({error:e}){return document.createComment(e instanceof Error?e.toString():`Error: `+JSON.stringify(e,null,2))}var ze=function(){ze=function(){},new MutationObserver(e=>{e.forEach(function(t){t.type==="childList"&&t.removedNodes.forEach(n=>n&&n instanceof Element&&[...n.getElementsByTagName("*"),n].filter(r=>!r.isConnected).forEach(r=>{"onRemovedFromDOM"in r&&typeof r.onRemovedFromDOM=="function"&&r.onRemovedFromDOM()}))})}).observe(document.body,{subtree:!0,childList:!0})};function et(e,t){let n=new WeakSet;function r(d){for(let s of d)t==="addedNodes"===s.isConnected&&(r(s.childNodes),n.add(s))}return new MutationObserver(d=>{d.forEach(function(s){s.type==="childList"&&s.removedNodes.length&&r(s[t])})}).observe(e,{subtree:!0,childList:!0}),function(d){return n.has(d)}}var ke=new Set;function tt(e,t){return e=e||document,t=t||Object.create(null),e.querySelectorAll&&e.querySelectorAll("[id]").forEach(function(n){n.id&&(t[n.id]?O&&(ke.has(n.id)||(ke.add(n.id),E.info("Shadowed multiple element IDs",n.id))):t[n.id]=n)}),t}export{we as Iterators,oe as UniqueID,ze as enableOnRemovedFromDOM,tt as getElementIdMap,_e as tag,ge as when}; diff --git a/module/dist/ai-ui.mjs b/module/dist/ai-ui.mjs index 8626135..883def9 100644 --- a/module/dist/ai-ui.mjs +++ b/module/dist/ai-ui.mjs @@ -94,11 +94,10 @@ var asyncExtras = { } }; var extraKeys = [...Object.getOwnPropertySymbols(asyncExtras), ...Object.keys(asyncExtras)]; -function assignHidden(d, ...srcs) { - for (const s of srcs) { - for (const [k, pd] of Object.entries(Object.getOwnPropertyDescriptors(s))) { - Object.defineProperty(d, k, { ...pd, enumerable: false }); - } +function assignHidden(d, s) { + const keys = [...Object.getOwnPropertyNames(s), ...Object.getOwnPropertySymbols(s)]; + for (const k of keys) { + Object.defineProperty(d, k, { ...Object.getOwnPropertyDescriptor(s, k), enumerable: false }); } return d; } @@ -1506,4 +1505,4 @@ export { tag, when }; -//# sourceMappingURL=data:application/json;base64,ewogICJ2ZXJzaW9uIjogMywKICAic291cmNlcyI6IFsiLi4vc3JjL2RlYnVnLnRzIiwgIi4uL3NyYy9kZWZlcnJlZC50cyIsICIuLi9zcmMvaXRlcmF0b3JzLnRzIiwgIi4uL3NyYy93aGVuLnRzIiwgIi4uL3NyYy9haS11aS50cyJdLAogICJzb3VyY2VzQ29udGVudCI6IFsiLy8gQHRzLWlnbm9yZVxuZXhwb3J0IGNvbnN0IERFQlVHID0gZ2xvYmFsVGhpcy5ERUJVRyA9PSAnKicgfHwgZ2xvYmFsVGhpcy5ERUJVRyA9PSB0cnVlIHx8IGdsb2JhbFRoaXMuREVCVUc/Lm1hdGNoKC8oXnxcXFcpQUktVUkoXFxXfCQpLykgfHwgZmFsc2U7XG5leHBvcnQgeyBfY29uc29sZSBhcyBjb25zb2xlIH07XG5leHBvcnQgY29uc3QgdGltZ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sIGtleSkpIHtcbiAgICAgICAgICAgICAgICAvLyBAdHMtaWdub3JlIC0gRml4XG4gICAgICAgICAgICAgICAgcHVzaChvYmpbbmFtZV0pO1xuICAgICAgICAgICAgICAgIHJldHVybiB0cnVlO1xuICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgIHJldHVybiBmYWxzZTtcbiAgICAgICAgICAgIH0sXG4gICAgICAgICAgICAvLyBJbXBsZW1lbnQgdGhlIGxvZ2ljIHRoYXQgZmlyZXMgdGhlIGl0ZXJhdG9yIGJ5IHJlLWFzc2lnbmluZyB0aGUgaXRlcmFibGUgdmlhIGl0J3Mgc2V0dGVyXG4gICAgICAgICAgICBzZXQodGFyZ2V0LCBrZXksIHZhbHVlLCByZWNlaXZlcikge1xuICAgICAgICAgICAgICBpZiAoUmVmbGVjdC5zZXQodGFyZ2V0LCBrZXksIHZhbHVlLCByZWNlaXZlcikpIHtcbiAgICAgICAgICAgICAgICAvLyBAdHMtaWdub3JlIC0gRml4XG4gICAgICAgICAgICAgICAgcHVzaChvYmpbbmFtZV0pO1xuICAgICAgICAgICAgICAgIHJldHVybiB0cnVlO1xuICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgIHJldHVybiBmYWxzZTtcbiAgICAgICAgICAgIH0sXG4gICAgICAgICAgICAvLyBJbXBsZW1lbnQgdGhlIGxvZ2ljIHRoYXQgcmV0dXJucyBhIG1hcHBlZCBpdGVyYXRvciBmb3IgdGhlIHNwZWNpZmllZCBmaWVsZFxuICAgICAgICAgICAgZ2V0KHRhcmdldCwga2V5LCByZWNlaXZlcikge1xuICAgICAgICAgICAgICBpZiAoa2V5ID09PSAndmFsdWVPZicpXG4gICAgICAgICAgICAgICAgcmV0dXJuICgpPT5ib3hlZE9iamVjdDtcblxuICAgICAgICAgICAgICBjb25zdCB0YXJnZXRQcm9wID0gUmVmbGVjdC5nZXRPd25Qcm9wZXJ0eURlc2NyaXB0b3IodGFyZ2V0LGtleSk7XG4gICAgICAgICAgICAgIC8v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RGVzY3JpcHRvcnMoXG4gICAgICAgICAgICAgICAgICAgIGJveGVkT2JqZWN0Lm1hcCgobyxwKSA9PiB7XG4gICAgICAgICAgICAgICAgICAgIGNvbnN0IG92ID0gbz8uW2tleSBhcyBrZXlvZiB0eXBlb2Ygb10/LnZhbHVlT2YoKTtcbiAgICAgICAgICAgICAgICAgICAgY29uc3QgcHYgPSBwPy52YWx1ZU9mKCk7XG4gICAgICAgICAgICAgICAgICAgIGlmICh0eXBlb2Ygb3YgPT09IHR5cGVvZiBwdiAmJiBvdiA9PSBwdilcbiAgICAgICAgICAgICAgICAgICAgICByZXR1cm4gSWdub3JlO1xuICAgICAgICAgICAgICAgICAgICByZXR1cm4gb3Y7XG4gICAgICAgICAgICAgICAgICB9KVxuICAgICAgICAgICAgICAgICk7XG4gICAgICAgICAgICAgICAgKFJlZmxlY3Qub3duS2V5cyhwcm9wcykgYXMgKGtleW9mIHR5cGVvZiBwcm9wcylbXSkuZm9yRWFjaChrID0+IHByb3BzW2tdLmVudW1lcmFibGUgPSBmYWxzZSk7XG4gICAgICAgICAgICAgICAgY29uc3QgYWliID0gYm94KHJlYWxWYWx1ZSwgcHJvcHMpO1xuICAgICAgICAgICAgICAgIFJlZmxlY3Quc2V0KHRhcmdldCwga2V5LCBhaWIpO1xuICAgICAgICAgICAgICAgIHJldHVybiBhaWI7XG4gICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgcmV0dXJuIFJlZmxlY3QuZ2V0KHRhcmdldCwga2V5LCByZWNlaXZlcik7XG4gICAgICAgICAgICB9LFxuICAgICAgICAgIH0pO1xuICAgICAgICAgIHJldHVybiBleHRyYUJveGVkO1xuICAgICAgICB9XG4gICAgICAgIHJldHVybiBhIGFzIChWICYgQXN5bmNFeHRyYUl0ZXJhYmxlPFY+KTtcbiAgICAgIGNhc2UgJ2JpZ2ludCc6XG4gICAgICBjYXNlICdib29sZWFuJzpcbiAgICAgIGNhc2UgJ251bWJlcic6XG4gICAgICBjYXNlICdzdH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IDE7XG4gICAgICAgICAgICBpZiAoIWFjdGl2ZSlcbiAgICAgICAgICAgICAgcmV0dXJuIHsgZG9uZTogdHJ1ZSwgdmFsdWU6IHVuZGVmaW5lZCB9O1xuICAgICAgICAgICAgcmV0dXJuIHN0ZXAoKTtcbiAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgLy8gQHRzLWlnbm9yZVxuICAgICAgICAgICAgYWNjdW11bGF0ZWRba10gPSBpci52YWx1ZTtcbiAgICAgICAgICAgIHBjW2lkeF0gPSBzaVtpZHhdLm5leHQoKS50aGVuKGlyID0+ICh7IGlkeCwgaywgaXIgfSkpO1xuICAgICAgICAgIH1cbiAgICAgICAgICBpZiAob3B0cy5pZ25vcmVQYXJ0aWFsKSB7XG4gICAgICAgICAgICBpZiAoT2JqZWN0LmtleXMoYWNjdW11bGF0ZWQpLmxlbmd0aCA8IE9iamVjdC5rZXlzKHNyYykubGVuZ3RoKVxuICAgICAgICAgICAgICByZXR1cm4gc3RlcCgpO1xuICAgICAgICAgIH1cbiAgICAgICAgICByZXR1cm4geyBkb25lOiBmYWxzZSwgdmFsdWU6IGFjY3VtdWxhdGVkIH07XG4gICAgICAgIH0pXG4gICAgICB9KSgpO1xuICAgIH0sXG4gICAgcmV0dXJuKHY/OiBhbnkpe1xuICAgICAgcGMuZm9yRWFjaCgocCxpZHgpID0+IHtcbiAgICAgICAgaWYgKHAgIT09IGZvcmV2ZXIpIHtcbiAgICAgICAgICBzaVtpZHhdLnJldHVybj8uKHYpXG4gICAgICAgIH1cbiAgICAgIH0pO1xuICAgICAgcmV0dXJuIFByb21pc2UucmVzb2x2ZSh7IGRvbmU6IHRydWUsIHZhbHVlOiB2IH0pO1xuICAgIH0sXG4gICAgdGhyb3coZXg6IGFueSl7XG4gICAgICBwYy5mb3JFYWNoKChwLGlkeCkgPT4ge1xuICAgICAgICBpZiAocCAhPT0gZm9yZXZlcikge1xuICAgICAgICAgIHNpW2lkeF0udGhyb3c/LihleClcbiAgICAgIC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AgICAgIGluaXRpYWxWYWx1ZSA9IElnbm9yZTtcbiAgICAgICAgcmV0dXJuIGluaXQ7XG4gICAgICB9XG5cbiAgICAgIHJldHVybiBuZXcgUHJvbWlzZTxJdGVyYXRvclJlc3VsdDxSPj4oZnVuY3Rpb24gc3RlcChyZXNvbHZlLCByZWplY3QpIHtcbiAgICAgICAgaWYgKCFhaSlcbiAgICAgICAgICBhaSA9IHNvdXJjZVtTeW1ib2wuYXN5bmNJdGVyYXRvcl0hKCk7XG4gICAgICAgIGFpLm5leHQoLi4uYXJncykudGhlbihcbiAgICAgICAgICBwID0+IHAuZG9uZVxuICAgICAgICAgICAgPyByZXNvbHZlKHApXG4gICAgICAgICAgICA6IHJlc29sdmVTeW5jKGZuKHAudmFsdWUsIHByZXYpLFxuICAgICAgICAgICAgICBmID0+IGYgPT09IElnbm9yZVxuICAgICAgICAgICAgICAgID8gc3RlcChyZXNvbHZlLCByZWplY3QpXG4gICAgICAgICAgICAgICAgOiByZXNvbHZlKHsgZG9uZTogZmFsc2UsIHZhbHVlOiBwcmV2ID0gZiB9KSxcbiAgICAgICAgICAgICAgZXggPT4ge1xuICAgICAgICAgICAgICAgIC8vIFRoZSBmaWx0ZXIgZnVuY3Rpb24gZmFpbGVkLi4uXG4gICAgICAgICAgICAgICAgYWkudGhyb3cgPyBhaS50aHJvdyhleCkgOiBhaS5yZXR1cm4/LihleCkgLy8gVGVybWluYXRlIHRoZSBzb3VyY2UgLSBmb3Igbm93IHdlIGlnbm9yZSB0aGUgcmVzdWx0IG9mIHRoZSB0ZXJtaW5hdGlvblxuICAgICAgICAgICAgICAgIHJlamVjdCh7IGRvbmU6IHRydWUsIHZhbHVlOiBleCB9KTsgLy8gVGVybWluYXRlIHRoZSBjb25zdW1lclxuICAgICAgICAgICAgICB9XG4gICAgICAgICAgICApLFxuXG4gICAgICAgICAgZXggPT5cbiAgICAgICAgICAgIC8vIFRoZSBzb3VyY2UgdGhyZXcuIFRlbGwgdGhlIGNvbnN1bWV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2JhbEV2ZW50SGFuZGxlcnNFdmVudE1hcCk7XG4gIGlmIChvYnNlcnZhdGlvbnMpIHtcbiAgICBmb3IgKGNvbnN0IG8gb2Ygb2JzZXJ2YXRpb25zKSB7XG4gICAgICB0cnkge1xuICAgICAgICBjb25zdCB7IHB1c2gsIHRlcm1pbmF0ZSwgY29udGFpbmVyLCBzZWxlY3RvciB9ID0gbztcbiAgICAgICAgaWYgKCFjb250YWluZXIuaXNDb25uZWN0ZWQpIHtcbiAgICAgICAgICBjb25zdCBtc2cgPSBcIkNvbnRhaW5lciBgI1wiICsgY29udGFpbmVyLmlkICsgXCI+XCIgKyAoc2VsZWN0b3IgfHwgJycpICsgXCJgIHJlbW92ZWQgZnJvbSBET00uIFJlbW92aW5nIHN1YnNjcmlwdGlvblwiO1xuICAgICAgICAgIG9ic2VydmF0aW9ucy5kZWxldGUobyk7XG4gICAgICAgICAgdGVybWluYXRlKG5ldyBFcnJvcihtc2cpKTtcbiAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICBpZiAoZXYudGFyZ2V0IGluc3RhbmNlb2YgTm9kZSkge1xuICAgICAgICAgICAgaWYgKHNlbGVjdG9yKSB7XG4gICAgICAgICAgICAgIGNvbnN0IG5vZGVzID0gY29udGFpbmVyLnF1ZXJ5U2VsZWN0b3JBbGwoc2VsZWN0b3IpO1xuICAgICAgICAgICAgICBmb3IgKGNvbnN0IG4gb2Ygbm9kZXMpIHtcbiAgICAgICAgICAgICAgICBpZiAoKGV2LnRhcmdldCA9PT0gbiB8fCBuLmNvbnRhaW5zKGV2LnRhcmdldCkpICYmIGNvbnRhaW5lci5jb250YWlucyhuKSlcbiAgICAgICAgICAgICAgICAgIHB1c2goZXYpXG4gICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgIGlmICgoZXYudGFyZ2V0ID09PSBjb250YWluZXIgfHwgY29udGFpbmVyLmNvbnRhaW5zKGV2LnRhcmdldCkpKVxuICAgICAg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XQncyBleHBlY3RlZCwgYnV0IHdlJ3JlIGRvbmUpXG4gICAgICAgICAgICAgICAgdCA9IFtdO1xuICAgICAgICAgICAgICAgIGNvbnN0IG1zZyA9IFwiRWxlbWVudChzKSBoYXZlIGJlZW4gcmVtb3ZlZCBmcm9tIHRoZSBkb2N1bWVudDogXCIgKyBpbnNlcnRpb25TdGFjaztcbiAgICAgICAgICAgICAgICBhcC5yZXR1cm4/LihuZXcgRXJyb3IobXNnKSk7XG4gICAgICAgICAgICAgICAgcmV0dXJuO1xuICAgICAgICAgICAgICB9XG5cbiAgICAgICAgICAgICAgaWYgKERFQlVHICYmIG5vdFlldE1vdW50ZWQgJiYgY3JlYXRlZEF0ICYmIGNyZWF0ZWRBdCA8IERhdGUubm93KCkpIHtcbiAgICAgICAgICAgICAgICBjcmVhdGVkQXQgPSBOdW1iZXIuTUFYX1NBRkVfSU5URUdFUjtcbiAgICAgICAgICAgICAgICBjb25zb2xlLndhcm4oYEFzeW5jIGVsZW1lbnQgbm90IG1vdW50ZWQgYWZ0ZXIgNSBzZWNvbmRzLiBJZiBpdCBpcyBuZXZlciBtb3VudGVkLCBpdCB3aWxsIGxlYWsuYCxjcmVhdGVkQnksIHQubWFwKGxvZ05vZGUpKTtcbiAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICB0ID0gbm9kZXModW5ib3goZXMudmFsdWUpIGFzIENoaWxkVGFncyk7XG4gICAgICAgICAgICAgIC8vIElmIHRoZSBpdGVyYXRlZCBleHByZXNzaW9uIHlpZWxkcyBubyBub2Rlcywgc3R1ZmYgaW4gYSBEb21Qcm9taXNlQ29udGFpbmVyIGZvciB0aGUgbmV4dCBpdGVyYXRpb25cbiAgICAgICAgICAgICAgaWYgKCF0Lmxlbmd0aCkgdC5wdXNoKERvbVByb21pc2VDb250YWluZXIoKSk7XG4gICAgICAgICAgICAgIChuWzBdIGFzIENoaWxkTm9kZSkucmVwbGFjZVdpdGgoLi4udCk7XG4gICAgICAgICAgICAgIG4uc2x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AgLy8gTm90ZSAtIGlmIHdlJ3JlIGNvcHlpbmcgdG8gYW4gYXJyYXkgb2YgZGlmZmVyZW50IGxlbmd0aFxuICAgICAgICAgICAgICAgICAgICAvLyB3ZSdyZSBkZWNvdXBsaW5nIGNvbW1vbiBvYmplY3QgcmVmZXJlbmNlcywgc28gd2UgbmVlZCBhIGNsZWFuIG9iamVjdCB0b1xuICAgICAgICAgICAgICAgICAgICAvLyBhc3NpZ24gaW50b1xuICAgICAgICAgICAgICAgICAgICBpZiAoQXJyYXkuaXNBcnJheShkW2tdKSAmJiBkW2tdLmxlbmd0aCAhPT0gdmFsdWUubGVuZ3RoKSB7XG4gICAgICAgICAgICAgICAgICAgICAgaWYgKHZhbHVlLmNvbnN0cnVjdG9yID09PSBPYmplY3QgfHwgdmFsdWUuY29uc3RydWN0b3IgPT09IEFycmF5KSB7XG4gICAgICAgICAgICAgICAgICAgICAgICBkZWVwRGVmaW5lKGRba10gPSBuZXcgKHZhbHVlLmNvbnN0cnVjdG9yKSwgdmFsdWUpO1xuICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAvLyBUaGlzIGlzIHNvbWUgc29ydCBvZiBjb25zdHJ1Y3RlZCBvYmplY3QsIHdoaWNoIHdlIGNhbid0IGNsb25lLCBzbyB3ZSBoYXZlIHRvIGNvcHkgYnkgcmVmZXJlbmNlXG4gICAgICAgICAgICAgICAgICAgICAgICBkW2tdID0gdmFsdWU7XG4gICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICAgIC8vIFRoaXMgaXMganVzdCBhIHJlZ3VsYXIgb2JqZWN0LCBzbyB3ZSBkZWVwRGVmaW5lIHJlY3Vyc2l2ZWx5XG4gICAgICAgICAgICAgICAgICAgICAgZGVlcERlZmluZShkW2tdLCB2YWx1ZSk7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgIC8vIFRoaXMgaXMganVzdCBhIHByaW1pdGl2ZSB2YWx1ZSwgb3IgYSBQcm9taXNlXG4gICAgICAgICAgICAgIGlmIChzW2tdICE9PSB1bmRlZmluZWQpXG4gICAgICAgICAgICAgICAgZFtrXSA9IHNba107XG4gICAgICAgICAgICB9XG4gICAgICAgICAgfVxuICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgIC8vIENvcHkgdGhlIGRlZmluaXRpb24gb2YgdGhlIGdldHRlci9zZXR0ZXJcbiAgICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkoZCwgaywgc3JjRGVzYyk7XG4gICAgICAgIH1cbiAgICAgIH0gY2F0Y2ggKGV4OiB1bmtub3duKSB7XG4gICAgICAgIGNvbnNvbGUud2FybiggXCJkZWVwQXNzaWduXCIsIGssIHNba10sIGV4KTtcbiAgICAgICAgdGhyb3cgZXg7XG4gICAgICB9XG4gICAgfVxuICB9XG5cbiAgZnVuY3Rpb24gdW5ib3goYTogdW5rbm93bik6IHVua25vd24ge1xuICAgIGNvbnN0IHYgPSBhPy52YWx1ZU9mKCk7XG4gICAgcmV0dXJuIEFycmF5LmlzQXJyYXkodikgPyBBcnJheS5wcm90b3R5cGUubWFwLmNhbGwodix1bmJveCkgOiB2O1xuICB9XG5cbiAgZnVuY3Rpb24gYXNzaWduUHJvcHMoYmFzZTogTm9kZSwgcHJvcHM6IFJlY29yZDxzdHJpbmcsIGFueT4pIHtcbiAgICAvLyBDb3B5IHByb3AgaGllcmFyY2h5IG9udG8gdGhlIGVsZW1lbnQgdmlhIHRoZSBhc3NzaWdubWVudCBvcGVyYXRvciBpbiBvcmRlciB0byBydW4gc2V0dGVyc1xuICAgIGlmICghKGNhbGxTdGFja1N5bWJvbCBpbiBwcm9wcykpIHtcbiAgICAgIChmdW5jdGlvbiBhc3NpZ24oZDogYW55LCBzOiBhbnkpOiB2b2lkIHtcbiAgICAgICAgaWYgKHMgPT09IG51bGwgfHwgcyA9PT0gdW5kZWZpbmVkIHx8IHR5cGVvZiBzICE9PSAnb2JqZWN0JylcbiAgICAgICAgICByZXR1cm47XG4gICAgICAgIC8vIHN0YXRpYyBwcm9wcyBiZWZvcmUgZ2V0dGVycy9zZXR0ZXJzXG4gICAgICAgIGNvbnN0IHNvdXJjZUVudHJpZXMgPSBPYmplY3QuZW50cmllcyhPYmplY3QuZ2V0T3duUHJvcGVydHlEZXNjcmlwdG9ycyhzKSk7XG4gICAgICAgIGlmICghQXJyYXkuaXNBcnJheShzKSkge1xuICAgICAgICAgIHNvdXJjZUVudHJpZXMuc29ydCgoYSxiKSA9PiB7XG4gICAgICAgICAgICBjb25zdCBkZXNjID0gT2JqZWN0LmdldE93blByb3BlcnR5RGVzY3JpcHRvcihkLGFbMF0pO1xuICAgICAgICAgICAgaWYgKGRlc2MpIHtcbiAgICAgICAgICAgICAgaWYgKCd2YWx1ZScgaW4gZGVzYykgcmV0dXJuIC0xO1xuICAgICAgICAgICAgICBpZiAoJ3NldCcgaW4gZGVzYykgcmV0dXJuIDE7XG4gICAgICAgICAgICAgIGlmICgnZ2V0JyBpbiBkZXNjKSByZXR1cm4gMC41O1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgcmV0dXJuIDA7XG4gICAgICAgICAgfSk7XG4gICAgICAgIH1cbiAgICAgICAgZm9yIChjb25zdCBbaywgc3JjRGVzY10gb2Ygc291cmNlRW50cmllcykge1xuICAgICAgICAgIHRyeSB7XG4gICAgICAgICAgICBpZiAoJ3ZhbHVlJyBpbiBzcmNEZXNjKSB7XG4gICAgICAgICAgICAgIGNvbnN0IHZhbHVlID0gc3JjRGVzYy52YWx1ZTtcbiAgICAgICAgICAgICAgaWYgKGlzQXN5bmNJdGVyPHVua25vd24+KHZhbHVlKSkge1xuICAgICAgICAgICAgICAgIGFzc2lnbkl0ZXJhYmxlKHZhbHVlLCBrKTtcbiAgICAgICAgICAgICAgfSBlbHNlIGlmIChpc1Byb21pc2VMaWtlKHZhbHVlKSkge1xuICAgICAgICAgICAgICAgIHZhbHVlLnRoZW4odiA9PiB7XG4gICAgICAgICAgICAgICAgICBpZiAodiAmJiB0eXBlb2YgdiA9PT0gJ29iamVjdCcpIHtcbiAgICAgICAgICAgICAgICAgICAgLy8gU3BlY2lhbCBjYXNlOiB0aGlzIHByb21pc2UgcmVzb2x2ZWQgdG8gYW4gYXN5bmMgaXRlcmF0b3JcbiAgICAgICAgICAgICAgICAgICAgaWYgKGlzQXN5bmNJdGVyPHVua25vd24+KHYpKSB7XG4gICAgICAgICAgICAgICAgICAgICAgYXNzaWduSXRlcmFibGUodiwgayk7XG4gICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgICAgYXNzaWduT2JqZWN0KHYsIGspO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICBpZiAoc1trXSAhPT0gdW5kZWZpbmVkKVxuICAgICAgICAgICAgICAgICAgICAgIGRba10gPSB2O1xuICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH0sIGVycm9yID0+IGNvbnNvbGUubG9nKFwiRmFpbGVkIHRvIHNldCBhdHRyaWJ1dGVcIiwgZXJyb3IpKTtcbiAgICAgICAgICAgICAgfSBlbHNlIGlmICghaXNBc3luY0l0ZXI8dW5rbm93bj4odmFsdWUpKSB7XG4gICAgICAgICAgICAgICAgLy8gVGhpcyBoYXMgYSByZWFsIHZhbHVlLCB3aGljaCBtaWdodCBiZSBhbiBvYmplY3RcbiAgICAgICAgICAgICAgICBpZiAodmFsdWUgJiYgdHlwZW9mIHZhbHVlID09PSAnb2JqZWN0JyAmJiAhaXNQcm9taXNlTGlrZSh2YWx1ZSkpXG4gICAgICAgICAgICAgICAgICBhc3NpZ25PYmplY3QodmFsdWUsIGspO1xuICAgICAgICAgICAgICAgIGVsc2Uge1xuICAgICAgICAgICAgICAgICAgaWYgKHNba10gIT09IHVuZGVmaW5lZClcbiAgICAgICAgICAgICAgICAgICAgZFtrXSA9IHNba107XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAvLyBDb3B5IHRoZSBkZWZpbml0aW9uIG9mIHRoZSBnZXR0ZXIvc2V0dGVyXG4gICAgICAgICAgICAgIE9iamVjdC5kZWZpbmVQcm9wZXJ0eShkLCBrLCBzcmNEZXNjKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICB9IGNhdGNoIChleDogdW5rbm93bikge1xuICAgICAgICAgICAgY29uc29sZS53YXJuKCBcImFzc2lnblByb3BzXCIsIGssIHNba10sIGV4KTtcbiAgICAgICAgICAgIHRocm93IGV4O1xuICAgICAgICAgIH1cbiAgICAgICAgfVxuXG4gICAgICAgIGZ1bmN0aW9uIGFzc2lnbkl0ZXJhYmxlKHZhbHVlOiBBc3luY0l0ZXJhYmxlPHVua25vd24+IHwgQXN5bmNJdGVyYXRvcjx1bmtub3duLCBhbnksIHVuZGVmaW5lZD4sIGs6IHN0cmluZykge1xuICAgICAgICAgIGNvbnN0IGFwID0gYXN5bmNJdGVyYXRvcih2YWx1ZSk7XG4gICAgICAgICAgbGV0IG5vdFlldE1vdW50ZWQgPSB0cnVlO1xuICAgICAgICAgIC8vIERFQlVHIHN1cHBvcnRcbiAgICAgICAgICBsZXQgY3JlYXRlZEF0ID0gRGF0ZS5ub3coKSArIHRpbWVPdXRXYXJuO1xuICAgICAgICAgIGNvbnN0IGNyZWF0ZWRCeSA9IERFQlVHICYmIG5ldyBFcnJvcihcIkNyZWF0ZWQgYnlcIikuc3RhY2s7XG4gICAgICAgICAgY29uc3QgdXBkYXRlID0gKGVzOiBJdGVyYXRvclJlc3VsdDx1bmtub3duPikgPT4ge1xuICAgICAgICAgICAg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RvdHlwZSBjaGFpbiBhbmQgYXNzdW1pbmcgYW55dGhpbmcgYmVsb3cgXCJQT1wiIG11c3QgYmVcbiAgICAgICAgICAgICAgICBhIHByaW1pdGl2ZVxuICAgICAgICAgICAgICAgICovXG4gICAgICAgICAgICAgICAgY29uc3QgZGVzdERlc2MgPSBPYmplY3QuZ2V0T3duUHJvcGVydHlEZXNjcmlwdG9yKGQsIGspO1xuICAgICAgICAgICAgICAgIGlmIChrID09PSAnc3R5bGUnIHx8ICFkZXN0RGVzYz8uc2V0KVxuICAgICAgICAgICAgICAgICAgYXNzaWduKGRba10sIHZhbHVlKTtcbiAgICAgICAgICAgICAgICBlbHNlXG4gICAgICAgICAgICAgICAgICBkW2tdID0gdmFsdWU7XG4gICAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgLy8gU3JjIGlzIG5vdCBhbiBvYmplY3QgKG9yIGlzIG51bGwpIC0ganVzdCBhc3NpZ24gaXQsIHVubGVzcyBpdCdzIHVuZGVmaW5lZFxuICAgICAgICAgICAgICAgIGlmICh2YWx1ZSAhPT0gdW5kZWZpbmVkKVxuICAgICAgICAgICAgICAgICAgZFtrXSA9IHZhbHVlO1xuICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgIGNvbnN0IG1vdW50ZWQgPSBiYXNlLmlzQ29ubmVjdGVkO1xuICAgICAgICAgICAgICAvLyBJZiB3ZSBoYXZlIGJlZW4gbW91bnRlZCBiZWZvcmUsIGJpdCBhcmVuJ3Qgbm93LCByZW1vdmUgdGhlIGNvbnN1bWVyXG4gICAgICAgICAgICAgIGlmIChyZW1vdmVkTm9kZXMoYmFzZSkgfHwgKCFub3RZZXRNb3VudGVkICYmICFtb3VudGVkKSkge1xuICAgICAgICAgICAgICAgIGNvbnNvbGUuaW5mbyhgRWxlbWVudCBkb2VzIG5vdCBleGlzdCBpbiBkb2N1bWVudCB3aGVuIHNldHRpbmcgYXN5bmMgYXR0cmlidXRlICcke2t9JyB0bzpcXG4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1xuICAgICAgICAgICAgICAgICAgICBjb25zdCBvdiA9IG8/LltrZXkgYXMga2V5b2YgdHlwZW9mIG9dPy52YWx1ZU9mKCk7XG4gICAgICAgICAgICAgICAgICAgIGNvbnN0IHB2ID0gcD8udmFsdWVPZigpO1xuICAgICAgICAgICAgICAgICAgICBpZiAodHlwZW9mIG92ID09PSB0eXBlb2YgcHYgJiYgb3YgPT0gcHYpXG4gICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIElnbm9yZTtcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIG92O1xuICAgICAgICAgICAgICAgICAgfSlcbiAgICAgICAgICAgICAgICApO1xuICAgICAgICAgICAgICAgIChSZWZsZWN0Lm93bktleXMocHJvcHMpIGFzIChrZXlvZiB0eXBlb2YgcHJvcHMpW10pLmZvckVhY2goayA9PiBwcm9wc1trXS5lbnVtZXJhYmxlID0gZmFsc2UpO1xuICAgICAgICAgICAgICAgIGNvbnN0IGFpYiA9IGJveChyZWFsVmFsdWUsIHByb3BzKTtcbiAgICAgICAgICAgICAgICBSZWZsZWN0LnNldCh0YXJnZXQsIGtleSwgYWliKTtcbiAgICAgICAgICAgICAgICByZXR1cm4gYWliO1xuICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgIHJldHVybiBSZWZsZWN0LmdldCh0YXJnZXQsIGtleSwgcmVjZWl2ZXIpO1xuICAgICAgICAgICAgfSxcbiAgICAgICAgICB9KTtcbiAgICAgICAgICByZXR1cm4gZXh0cmFCb3hlZDtcbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gYSBhcyAoViAmIEFzeW5jRXh0cmFJdGVyYWJsZTxWPik7XG4gICAgICBjYXNlICdiaWdpbnQnOlxuICAgICAgY2FzZSAnYm9vbGVhbic6XG4gICAgICBjYXNlICdudW1iZXInOlxuICAgICAgY2FzZSAnc3RyaW5nJzpcbiAgICAgICAgLy8gQm94ZXMgdHlwZXMsIGluY2x1ZGluZyBCaWdJbnRcbiAgICAgICAgcmV0dXJu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vbmU6IHRydWUsIHZhbHVlOiB1bmRlZmluZWQgfTtcbiAgICAgICAgICAgIHJldHVybiBzdGVwKCk7XG4gICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgIC8vIEB0cy1pZ25vcmVcbiAgICAgICAgICAgIGFjY3VtdWxhdGVkW2tdID0gaXIudmFsdWU7XG4gICAgICAgICAgICBwY1tpZHhdID0gc2lbaWR4XS5uZXh0KCkudGhlbihpciA9PiAoeyBpZHgsIGssIGlyIH0pKTtcbiAgICAgICAgICB9XG4gICAgICAgICAgaWYgKG9wdHMuaWdub3JlUGFydGlhbCkge1xuICAgICAgICAgICAgaWYgKE9iamVjdC5rZXlzKGFjY3VtdWxhdGVkKS5sZW5ndGggPCBPYmplY3Qua2V5cyhzcmMpLmxlbmd0aClcbiAgICAgICAgICAgICAgcmV0dXJuIHN0ZXAoKTtcbiAgICAgICAgICB9XG4gICAgICAgICAgcmV0dXJuIHsgZG9uZTogZmFsc2UsIHZhbHVlOiBhY2N1bXVsYXRlZCB9O1xuICAgICAgICB9KVxuICAgICAgfSkoKTtcbiAgICB9LFxuICAgIHJldHVybih2PzogYW55KXtcbiAgICAgIHBjLmZvckVhY2goKHAsaWR4KSA9PiB7XG4gICAgICAgIGlmIChwICE9PSBmb3JldmVyKSB7XG4gICAgICAgICAgc2lbaWR4XS5yZXR1cm4/Lih2KVxuICAgICAgICB9XG4gICAgICB9KTtcbiAgICAgIHJldHVybiBQcm9taXNlLnJlc29sdmUoeyBkb25lOiB0cnVlLCB2YWx1ZTogdiB9KTtcbiAgICB9LFxuICAgIHRocm93KGV4OiBhbnkpe1xuICAgICAgcGMuZm9yRWFjaCgocCxpZHgpID0+IHtcbiAgICAgICAgaWYgKHAgIT09IGZvcmV2ZXIpIHtcbiAgICAgICAgICBzaVtpZHhdLnRocm93Py4oZXgpXG4gICAgICAgIH1cbiAgICAgIH0pO1xuICAgICAgcmV0dXJuIFByb21pc2UucmVqZWN0KHsgZG9uZTogdHJ1ZSwgd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zKSB7XG4gICAgZm9yIChjb25zdCBvIG9mIG9ic2VydmF0aW9ucykge1xuICAgICAgdHJ5IHtcbiAgICAgICAgY29uc3QgeyBwdXNoLCB0ZXJtaW5hdGUsIGNvbnRhaW5lciwgc2VsZWN0b3IgfSA9IG87XG4gICAgICAgIGlmICghY29udGFpbmVyLmlzQ29ubmVjdGVkKSB7XG4gICAgICAgICAgY29uc3QgbXNnID0gXCJDb250YWluZXIgYCNcIiArIGNvbnRhaW5lci5pZCArIFwiPlwiICsgKHNlbGVjdG9yIHx8ICcnKSArIFwiYCByZW1vdmVkIGZyb20gRE9NLiBSZW1vdmluZyBzdWJzY3JpcHRpb25cIjtcbiAgICAgICAgICBvYnNlcnZhdGlvbnMuZGVsZXRlKG8pO1xuICAgICAgICAgIHRlcm1pbmF0ZShuZXcgRXJyb3IobXNnKSk7XG4gICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgaWYgKGV2LnRhcmdldCBpbnN0YW5jZW9mIE5vZGUpIHtcbiAgICAgICAgICAgIGlmIChzZWxlY3Rvcikge1xuICAgICAgICAgICAgICBjb25zdCBub2RlcyA9IGNvbnRhaW5lci5xdWVyeVNlbGVjdG9yQWxsKHNlbGVjdG9yKTtcbiAgICAgICAgICAgICAgZm9yIChjb25zdCBuIG9mIG5vZGVzKSB7XG4gICAgICAgICAgICAgICAgaWYgKChldi50YXJnZXQgPT09IG4gfHwgbi5jb250YWlucyhldi50YXJnZXQpKSAmJiBjb250YWluZXIuY29udGFpbnMobikpXG4gICAgICAgICAgICAgICAgICBwdXNoKGV2KVxuICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICBpZiAoKGV2LnRhcmdldCA9PT0gY29udGFpbmVyIHx8IGNvbnRhaW5lci5jb250YWlucyhldi50YXJnZXQpKSlcbiAgICAgICAgICAgICAgICBwdXNoKGV2KVxuICAgICAgICAgICAgfVxuICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgfSB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vbnN0IHN0ZXAgPSAoKT0+IGFpLm5leHQoKS50aGVuKFxuICAgICAgICAgICh7IGRvbmUsIHZhbHVlIH0pID0+IHsgYXNzaWduUHJvcHModGhpcywgdmFsdWUpOyBkb25lIHx8IHN0ZXAoKSB9LFxuICAgICAgICAgIGV4ID0+IGNvbnNvbGUud2FybihleCkpO1xuICAgICAgICBzdGVwKCk7XG4gICAgICB9XG4gICAgICBlbHNlIGFzc2lnblByb3BzKHRoaXMsIGEpO1xuICAgIH1cbiAgfSk7XG5cbiAgaWYgKGNvbW1vblByb3BlcnRpZXMpXG4gICAgZGVlcERlZmluZSh0YWdQcm90b3R5cGVzLCBjb21tb25Qcm9wZXJ0aWVzKTtcblxuICBmdW5jdGlvbiBub2RlcyguLi5jOiBDaGlsZFRhZ3NbXSkge1xuICAgIGNvbnN0IGFwcGVuZGVkOiBOb2RlW10gPSBbXTtcbiAgICAoZnVuY3Rpb24gY2hpbGRyZW4oYzogQ2hpbGRUYWdzKTogdm9pZCB7XG4gICAgICBpZiAoYyA9PT0gdW5kZWZpbmVkIHx8IGMgPT09IG51bGwgfHwgYyA9PT0gSWdub3JlKVxuICAgICAgICByZXR1cm47XG4gICAgICBpZiAoaXNQcm9taXNlTGlrZShjKSkge1xuICAgICAgICBjb25zdCBnOiBDaGlsZE5vZGUgPSBEb21Qcm9taXNlQ29udGFpbmVyKCk7XG4gICAgICAgIGFwcGVuZGVkLnB1c2goZyk7XG4gICAgICAgIGMudGhlbihyID0+IGcucmVwbGFjZVdpdGgoLi4ubm9kZXMocikpLFxuICAgICAgICAgICh4OmFueSkgPT4ge1xuICAgICAgICAgICAgY29uc29sZS53YXJuKHgsbG9nTm9kZShnKSk7XG4gICAgICAgICAgICBnLnJlcGxhY2VXaXRoKER5YW1pY0VsZW1lbnRFcnJvcih7ZXJyb3I6IHh9KSk7XG4gICAgICAgICAgfVxuICAgICAgICApO1xuICAgICAgICByZXR1cm47XG4gICAgICB9XG4gICAgICBpZiAoYyBpbnN0YW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IFtEeWFtaWNFbGVtZW50RXJyb3Ioe2Vycm9yOiBlcnJvclZhbHVlfSldO1xuICAgICAgICAgICAgblswXS5yZXBsYWNlV2l0aCguLi50KTsgLy9hcHBlbmRCZWZvcmUoblswXSwgLi4udCk7XG4gICAgICAgICAgICBuLnNsaWNlKDEpLmZvckVhY2goZSA9PiBlPy5wYXJlbnROb2RlIS5yZW1vdmVDaGlsZChlKSk7XG4gICAgICAgICAgfVxuICAgICAgICAgIGVsc2UgY29uc29sZS53YXJuKCBcIkNhbid0IHJlcG9ydCBlcnJvclwiLCBlcnJvclZhbHVlLCBjcmVhdGVkQnksIHQubWFwKGxvZ05vZGUpKTtcbiAgICAgICAgICB0ID0gW107XG4gICAgICAgICAgYXAucmV0dXJuPy4oZXJyb3IpO1xuICAgICAgICB9XG5cbiAgICAgICAgY29uc3QgdXBkYXRlID0gKGVzOiBJdGVyYXRvclJlc3VsdDxDaGlsZFRhZ3M+KSA9PiB7XG4gICAgICAgICAgaWYgKCFlcy5kb25lKSB7XG4gICAgICAgICAgICB0cnkge1xuICAgICAgICAgICAgICAvLyBDaGlsZE5vZGVbXSwgc2luY2Ugd2UgdGVzdGVkIC5wYXJlbnROb2RlXG4gICAgICAgICAgICAgIGNvbnN0IG1vdW50ZWQgPSB0LmZpbHRlcihlID0+IGU/LnBhcmVudE5vZGUgJiYgZS5pc0Nvbm5lY3RlZCk7XG4gICAgICAgICAgICAgIGNvbnN0IG4gPSBub3RZZXRNb3VudGVkID8gdCA6IG1vdW50ZWQ7XG4gICAgICAgICAgICAgIGlmIChtb3VudGVkLmxlbmd0aCkgbm90WWV0TW91bnRlZCA9IGZhbHNlO1xuXG4gICAgICAgICAgICAgIGlmICghbi5sZW5ndGggfHwgdC5ldmVyeShlID0+IHJlbW92ZWROb2RlcyhlKSkpIHtcbiAgICAgICAgICAgICAgICAvLyBXZSdyZSBkb25lIC0gdGVybWluYXRlIHRoZSBzb3VyY2UgcXVpZXRseSAoaWUgdGhpcyBpcyBub3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ICAgZGVlcERlZmluZShzcmNEZXNjLnZhbHVlID0gW10sIHZhbHVlKTtcbiAgICAgICAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgIC8vIE90aGVyIG9iamVjdCBsaWtlIHRoaW5ncyAocmVnZXhwcywgZGF0ZXMsIGNsYXNzZXMsIGV0YykgY2FuJ3QgYmUgZGVlcC1jb3BpZWQgcmVsaWFibHlcbiAgICAgICAgICAgICAgICAgICAgY29uc29sZS53YXJuKGBEZWNsYXJlZCBwcm9wZXR5ICcke2t9JyBpcyBub3QgYSBwbGFpbiBvYmplY3QgYW5kIG11c3QgYmUgYXNzaWduZWQgYnkgcmVmZXJlbmNlLCBwb3NzaWJseSBwb2xsdXRpbmcgb3RoZXIgaW5zdGFuY2VzIG9mIHRoaXMgdGFnYCwgZCwgdmFsdWUpO1xuICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkoZCwgaywgc3JjRGVzYyk7XG4gICAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgaWYgKHZhbHVlIGluc3RhbmNlb2YgTm9kZSkge1xuICAgICAgICAgICAgICAgICAgY29uc29sZS5pbmZvKFwiSGF2aW5nIERPTSBOb2RlcyBhcyBwcm9wZXJ0aWVzIG9mIG90aGVyIERPTSBOb2RlcyBpcyBhIGJhZCBpZGVhIGFzIGl0IG1ha2VzIHRoZSBET00gdHJlZSBpbnRvIGEgY3ljbGljIGdyYXBoLiBZb3Ugc2hvdWxkIHJlZmVyZW5jZSBub2RlcyBieSBJRCBvciBhcyBhIGNoaWxkXCIsIGssIGxvZ05vZGUodmFsdWUpKTtcbiAgICAgICAgICAgICAgICAgIGRba10gPSB2YWx1ZTtcbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgICAgaWYgKGRba10gIT09IHZhbHVlKSB7XG4gICAgICAgICAgICAgICAgICAgIC8vIE5vdGUgLSBpZiB3ZSdyZSBjb3B5aW5nIHRvIGFuIGFycmF5IG9mIGRpZmZlcmVudCBsZW5ndGhcbiAgICAgICAgICAgICAgICAgICAgLy8gd2UncmUgZGVjb3VwbGluZyBjb21tb24gb2JqZWN0IHJlZmVyZW5jZXMsIHNvIHdlIG5lZWQgYSBjbGVhbiBvYmplY3QgdG9cbiAgICAgICAgICAgICAgICAgICAgLy8gYXNzaWduIGludG9cbiAgICAgICAgICAgICAgICAgICAgaWYgKEFycmF5LmlzQXJyYXkoZFtrXSkgJiYgZFtrXS5sZW5ndGggIT09IHZhbHVlLmxlbmd0aCkge1xuICAgICAgICAgICAgICAgICAgICAgIGlmICh2YWx1ZS5jb25zdHJ1Y3RvciA9PT0gT2JqZWN0IHx8IHZhbHVlLmNvbnN0cnVjdG9yID09PSBBcnJheSkge1xuICAgICAgICAgICAgICAgICAgICAgICAgZGVlcERlZmluZShkW2tdID0gbmV3ICh2YWx1ZS5jb25zdHJ1Y3RvciksIHZhbHVlKTtcbiAgICAgICAgICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICAgICAgLy8gVGhpcyBpcyBzb21lIHNvcnQgb2YgY29uc3RydWN0ZWQgb2JqZWN0LCB3aGljaCB3ZSBjYW4ndCBjbG9uZSwgc28gd2UgaGF2ZSB0byBjb3B5IGJ5IHJlZmVyZW5jZVxuICAgICAgICAgICAgICAgICAgICAgICAgZFtrXSA9IHZhbHVlO1xuICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgICAvLyBUaGlzIGlzIGp1c3QgYSByZWd1bGFyIG9iamVjdCwgc28gd2UgZGVlcERlZmluZSByZWN1cnNpdmVseVxuICAgICAgICAgICAgICAgICAgICAgIGRlZXBEZWZpbmUoZFtrXSwgdmFsdWUpO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAvLyBUaGlzIGlzIGp1c3QgYSBwcmltaXRpdmUgdmFsdWUsIG9yIGEgUHJvbWlzZVxuICAgICAgICAgICAgICBpZiAoc1trXSAhPT0gdW5kZWZpbmVkKVxuICAgICAgICAgICAgICAgIGRba10gPSBzW2tdO1xuICAgICAgICAgICAgfVxuICAgICAgICAgIH1cbiAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAvLyBDb3B5IHRoZSBkZWZpbml0aW9uIG9mIHRoZSBnZXR0ZXIvc2V0dGVyXG4gICAgICAgICAgT2JqZWN0LmRlZmluZVByb3BlcnR5KGQsIGssIHNyY0Rlc2MpO1xuICAgICAgICB9XG4gICAgICB9IGNhdGNoIChleDogdW5rbm93bikge1xuICAgICAgICBjb25zb2xlLndhcm4oIFwiZGVlcEFzc2lnblwiLCBrLCBzW2tdLCBleCk7XG4gICAgICAgIHRocm93IGV4O1xuICAgICAgfVxuICAgIH1cbiAgfVxuXG4gIGZ1bmN0aW9uIHVuYm94KGE6IHVua25vd24pOiB1bmtub3duIHtcbiAgICBjb25zdCB2ID0gYT8udmFsdWVPZigpO1xuICAgIHJldHVybiBBcnJheS5pc0FycmF5KHYpID8gQXJyYXkucHJvdG90eXBlLm1hcC5jYWxsKHYsdW5ib3gpIDogdjtcbiAgfVxuXG4gIGZ1bmN0aW9uIGFzc2lnblByb3BzKGJhc2U6IE5vZGUsIHByb3BzOiBSZWNvcmQ8c3RyaW5nLCBhbnk+KSB7XG4gICAgLy8gQ29weSBwcm9wIGhpZXJhcmNoeSBvbnRvIHRoZSBlbGVtZW50IHZpYSB0aGUgYXNzc2lnbm1lbnQgb3BlcmF0b3IgaW4gb3JkZXIgdG8gcnVuIHNldHRlcnNcbiAgICBpZiAoIShjYWxsU3RhY2tTeW1ib2wgaW4gcHJvcHMpKSB7XG4gICAgICAoZnVuY3Rpb24gYXNzaWduKGQ6IGFueSwgczogYW55KTogdm9pZCB7XG4gICAgICAgIGlmIChzID09PSBudWxsIHx8IHMgPT09IHVuZGVmaW5lZCB8fCB0eXBlb2YgcyAhPT0gJ29iamVjdCcpXG4gICAgICAgICAgcmV0dXJuO1xuICAgICAgICAvLyBzdGF0aWMgcHJvcHMgYmVmb3JlIGdldHRlcnMvc2V0dGVyc1xuICAgICAgICBjb25zdCBzb3VyY2VFbnRyaWVzID0gT2JqZWN0LmVudHJpZXMoT2JqZWN0LmdldE93blByb3BlcnR5RGVzY3JpcHRvcnMocykpO1xuICAgICAgICBpZiAoIUFycmF5LmlzQXJyYXkocykpIHtcbiAgICAgICAgICBzb3VyY2VFbnRyaWVzLnNvcnQoKGEsYikgPT4ge1xuICAgICAgICAgICAgY29uc3QgZGVzYyA9IE9iamVjdC5nZXRPd25Qcm9wZXJ0eURlc2NyaXB0b3IoZCxhWzBdKTtcbiAgICAgICAgICAgIGlmIChkZXNjKSB7XG4gICAgICAgICAgICAgIGlmICgndmFsdWUnIGluIGRlc2MpIHJldHVybiAtMTtcbiAgICAgICAgICAgICAgaWYgKCdzZXQnIGluIGRlc2MpIHJldHVybiAxO1xuICAgICAgICAgICAgICBpZiAoJ2dldCcgaW4gZGVzYykgcmV0dXJuIDAuNTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHJldHVybiAwO1xuICAgICAgICAgIH0pO1xuICAgICAgICB9XG4gICAgICAgIGZvciAoY29uc3QgW2ssIHNyY0Rlc2NdIG9mIHNvdXJjZUVudHJpZXMpIHtcbiAgICAgICAgICB0cnkge1xuICAgICAgICAgICAgaWYgKCd2YWx1ZScgaW4gc3JjRGVzYykge1xuICAgICAgICAgICAgICBjb25zdCB2YWx1ZSA9IHNyY0Rlc2MudmFsdWU7XG4gICAgICAgICAgICAgIGlmIChpc0FzeW5jSXRlcjx1bmtub3duPih2YWx1ZSkpIHtcbiAgICAgICAgICAgICAgICBhc3NpZ25JdGVyYWJsZSh2YWx1ZSwgayk7XG4gICAgICAgICAgICAgIH0gZWxzZSBpZiAoaXNQcm9taXNlTGlrZSh2YWx1ZSkpIHtcbiAgICAgICAgICAgICAgICB2YWx1ZS50aGVuKHYgPT4ge1xuICAgICAgICAgICAgICAgICAgaWYgKHYgJiYgdHlwZW9mIHYgPT09ICdvYmplY3QnKSB7XG4gICAgICAgICAgICAgICAgICAgIC8vIFNwZWNpYWwgY2FzZTogdGhpcyBwcm9taXNlIHJlc29sdmVkIHRvIGFuIGFzeW5jIGl0ZXJhdG9yXG4gICAgICAgICAgICAgICAgICAgIGlmIChpc0FzeW5jSXRlcjx1bmtub3duPih2KSkge1xuICAgICAgICAgICAgICAgICAgICAgIGFzc2lnbkl0ZXJhYmxlKHYsIGspO1xuICAgICAgICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICAgIGFzc2lnbk9iamVjdCh2LCBrKTtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgaWYgKHNba10gIT09IHVuZGVmaW5lZClcbiAgICAgICAgICAgICAgICAgICAgICBkW2tdID0gdjtcbiAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICB9LCBlcnJvciA9PiBjb25zb2xlLmxvZyhcIkZhaWxlZCB0byBzZXQgYXR0cmlidXRlXCIsIGVycm9yKSk7XG4gICAgICAgICAgICAgIH0gZWxzZSBpZiAoIWlzQXN5bmNJdGVyPHVua25vd24+KHZhbHVlKSkge1xuICAgICAgICAgICAgICAgIC8vIFRoaXMgaGFzIGEgcmVhbCB2YWx1ZSwgd2hpY2ggbWlnaHQgYmUgYW4gb2JqZWN0XG4gICAgICAgICAgICAgICAgaWYgKHZhbHVlICYmIHR5cGVvZiB2YWx1ZSA9PT0gJ29iamVjdCcgJiYgIWlzUHJvbWlzZUxpa2UodmFsdWUpKVxuICAgICAgICAgICAgICAgICAgYXNzaWduT2JqZWN0KHZhbHVlLCBrKTtcbiAgICAgICAgICAgICAgICBlbHNlIHtcbiAgICAgICAgICAgICAgICAgIGlmIChzW2tdICE9PSB1bmRlZmluZWQpXG4gICAgICAgICAgICAgICAgICAgIGRba10gPSBzW2tdO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgLy8gQ29weSB0aGUgZGVmaW5pdGlvbiBvZiB0aGUgZ2V0dGVyL3NldHRlclxuICAgICAgICAgICAgICBPYmplY3QuZGVmaW5lUHJvcGVydHkoZCwgaywgc3JjRGVzYyk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgfSBjYXRjaCAoZXg6IHVua25vd24pIHtcbiAgICAgICAgICAgIGNvbnNvbGUud2FybiggXCJhc3NpZ25Qcm9wc1wiLCBrLCBzW2tdLCBleCk7XG4gICAgICAgICAgICB0aHJvdyBleDtcbiAgICAgICAgICB9XG4gICAgICAgIH1cblxuICAgICAgICBmdW5jdGlvbiBhc3NpZ25JdGVyYWJsZSh2YWx1ZTogQXN5bmNJdGVyYWJsZTx1bmtub3duPiB8IEFzeW5jSXRlcmF0b3I8dW5rbm93biwgYW55LCB1bmRlZmluZWQ+LCBrOiBzdHJpbmcpIHtcbiAgICAgICAgICBjb25zdCBhcCA9IGFzeW5jSXRlcmF0b3IodmFsdWUpO1xuICAgICAgICAgIGxldCBub3RZZXRNb3VudGVkID0gdHJ1ZTtcbiAgICAgICAgICAvLyBERUJVRyBzdXBwb3J0XG4gICAgICAgICAgbGV0IGNyZWF0ZWRBdCA9IERhdGUubm93KCkgKyB0aW1lT3V0V2FybjtcbiAgICAgICAgICBjb25zdCBjcmVhdGVkQnkgPSBERUJVRyAmJiBuZXcgRXJyb3IoXCJDcmVhdGVkIGJ5XCIpLnN0YWNrO1xuICAgICAgICAgIGNvbnN0IHVwZGF0ZSA9IChlczogSXRlcmF0b3JSZXN1bHQ8dW5rbm93b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BlcnR5IGluIHRoZSBwcm90b3R5cGUgY2hhaW4gYW5kIGFzc3VtaW5nIGFueXRoaW5nIGJlbG93IFwiUE9cIiBtdXN0IGJlXG4gICAgICAgICAgICAgICAgYSBwcmltaXRpdmVcbiAgICAgICAgICAgICAgICAqL1xuICAgICAgICAgICAgICAgIGNvbnN0IGRlc3REZXNjID0gT2JqZWN0LmdldE93blByb3BlcnR5RGVzY3JpcHRvcihkLCBrKTtcbiAgICAgICAgICAgICAgICBpZiAoayA9PT0gJ3N0eWxlJyB8fCAhZGVzdERlc2M/LnNldClcbiAgICAgICAgICAgICAgICAgIGFzc2lnbihkW2tdLCB2YWx1ZSk7XG4gICAgICAgICAgICAgICAgZWxzZVxuICAgICAgICAgICAgICAgICAgZFtrXSA9IHZhbHVlO1xuICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgIC8vIFNyYyBpcyBub3QgYW4gb2JqZWN0IChvciBpcyBudWxsKSAtIGp1c3QgYXNzaWduIGl0LCB1bmxlc3MgaXQncyB1bmRlZmluZWRcbiAgICAgICAgICAgICAgICBpZiAodmFsdWUgIT09IHVuZGVmaW5lZClcbiAgICAgICAgICAgICAgICAgIGRba10gPSB2YWx1ZTtcbiAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICBjb25zdCBtb3VudGVkID0gYmFzZS5pc0Nvbm5lY3RlZDtcbiAgICAgICAgICAgICAgLy8gSWYgd2UgaGF2ZSBiZWVuIG1vdW50ZWQgYmVmb3JlLCBiaXQgYXJlbid0IG5vdywgcmVtb3ZlIHRoZSBjb25zdW1lclxuICAgICAgICAgICAgICBpZiAocmVtb3ZlZE5vZGVzKGJhc2UpIHx8ICghbm90WWV0TW91bnRlZCAmJiAhbW91bnRlZCkpIHtcbiAgICAgICAgICAgICAgICBjb25zb2xlLmluZm8oYEVsZW1lbnQgZG9lcyBub3QgZXhpc3QgaW4gZG9jdW1lbnQgd2hlbiBzZXR0aW5nIGFzeW5jIGF0dHJpYnV0ZSAnJHtrfScgdG86XFxuJHtsb2dOb2RlKGJhc2UpfWApO1xuICAgICAgICAgICAgICAgIGFwLnJldHVybj8uKCk7XG4gICAgICAgICAgICAgICAgcmV0dXJuO1xuICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgIGlmIChtb3VudGVkKSBub3RZZXRNb3VudGVkID0gZmFsc2U7XG4gICAgICAgICAgICAgIGlmIChub3RZZXRNb3VudGVkICYmIGNyZWF0ZWRBdCAmJiBjcmVhdGVkQXQgPCBEYXRlLm5vdygpKSB7XG4gICAgICAgICAgICAgICAgY3JlYXRlZEF0ID0gTnVtYmVyLk1BWF9TQUZFX0lOVEVHRVI7XG4gICAgICAgICAgICAgICAgY29uc29sZS53YXJuKGBFbGVtZW50IHdpdGggYXN5bmMgYXR0cmlidXRlICcke2t9JyBub3QgbW91bnRlZCBhZnRlciA1IHNlY29uZHMuIElmIGl0IGlzIG5ldmVyIG1vdW50ZWQsIGl0IHdpbGwgbGVhay5cXG5FbGVtZW50IGNvbnRhaW5zOiAke2xvZ05vZGUoYmFzZSl9XFxuJHtjcmVhdGVkQnl9YCk7XG4gICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgICBhcC5uZXh0KCkudGhlbih1cGRhdGUpLmNhdGNoKGVycm9yKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICB9XG4gICAgICAgICAgY29uc3QgZXJyb3IgPSAoZXJyb3JWYWx1ZTogYW55KSA9PiB7XG4gICAgICAgICAgICBjb25zb2xlLndhcm4oIFwiRHluYW1pYyBhdHRyaWJ1dGUgZXJyb3JcIiwgZXJyb3JWYWx1ZSwgaywgZCwgY3JlYXRlZEJ5LCBsb2dOb2RlKGJhc2UpKTtcbiAgICAgICAgICAgIGFwLnJldHVybj8uKGVycm9yVmFsdWUpO1xuICAgICAgICAgICAgYmFzZS5hcHBlbmRDaGlsZChEeWFtaWNFbGVtZW50RXJyb3IoeyBlcnJvcjogZXJyb3JWYWx1ZSB9KSk7XG4gICAgICAgICAg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sSUFBSTtBQUFBLGlCQUNSLE9BQU87QUFDZCxjQUFJLENBQUMsT0FBTyxJQUFJLElBQUksRUFBRSxHQUFHO0FBQ3ZCLG1CQUFPLElBQUksSUFBSSxFQUFFO0FBQ2pCLHFCQUFRO0FBQUEsY0FBSztBQUFBLGNBQWlDLElBQUk7QUFBQTtBQUFBLFlBQTBCO0FBQUEsVUFDOUU7QUFBQSxRQUNGO0FBQUEsTUFDRjtBQUFBLElBQ0YsQ0FBQztBQUFBLEVBQ0g7QUFDQSxTQUFPO0FBQ1Q7IiwKICAibmFtZXMiOiBbInYiLCAiYSIsICJyZXN1bHQiLCAiZXgiLCAiaXIiLCAiaXNNaXNzaW5nIiwgIm1lcmdlZCIsICJjIiwgIm4iLCAidmFsdWUiLCAiaXNBbmNlc3RyYWwiLCAiY2hpbGRyZW4iXQp9Cg== diff --git a/module/esm/iterators.js b/module/esm/iterators.js index acece30..ce982bd 100644 --- a/module/esm/iterators.js +++ b/module/esm/iterators.js @@ -38,11 +38,10 @@ const asyncExtras = { }; const extraKeys = [...Object.getOwnPropertySymbols(asyncExtras), ...Object.keys(asyncExtras)]; // Like Object.assign, but the assigned properties are not enumerable -function assignHidden(d, ...srcs) { - for (const s of srcs) { - for (const [k, pd] of Object.entries(Object.getOwnPropertyDescriptors(s))) { - Object.defineProperty(d, k, { ...pd, enumerable: false }); - } +function assignHidden(d, s) { + const keys = [...Object.getOwnPropertyNames(s), ...Object.getOwnPropertySymbols(s)]; + for (const k of keys) { + Object.defineProperty(d, k, { ...Object.getOwnPropertyDescriptor(s, k), enumerable: false }); } return d; } diff --git a/module/src/iterators.ts b/module/src/iterators.ts index 9de9ee2..6b98a67 100644 --- a/module/src/iterators.ts +++ b/module/src/iterators.ts @@ -95,13 +95,12 @@ const asyncExtras = { const extraKeys = [...Object.getOwnPropertySymbols(asyncExtras), ...Object.keys(asyncExtras)] as (keyof typeof asyncExtras)[]; // Like Object.assign, but the assigned properties are not enumerable -function assignHidden(d: D, ...srcs: S[]) { - for (const s of srcs) { - for (const [k,pd] of Object.entries(Object.getOwnPropertyDescriptors(s))) { - Object.defineProperty(d, k, {...pd, enumerable: false}); - } +function assignHidden(d: D, s: S) { + const keys = [...Object.getOwnPropertyNames(s), ...Object.getOwnPropertySymbols(s)]; + for (const k of keys) { + Object.defineProperty(d, k, { ...Object.getOwnPropertyDescriptor(s, k), enumerable: false}); } - return d as D & S; + return d as D & S; } const queue_pending = Symbol('pending');