Comparing version 0.3.18 to 0.3.19
@@ -46,3 +46,3 @@ import { ArrayDataSource, DataSource } from '../../stream/data_source'; | ||
} | ||
export declare function buildRenderableFromModel(model: any): Renderable; | ||
export declare function prerender(model: any): Renderable; | ||
export declare type Renderable = AurumElement | string | Promise<Renderable> | DataSource<string> | DataSource<AurumElement> | DataSource<AurumElement[]> | ArrayDataSource<AurumElement> | ChildNode[]; | ||
@@ -49,0 +49,0 @@ export declare type ChildNode = AurumElementModel | string | Promise<ChildNode> | DataSource<string> | DataSource<AurumElementModel> | DataSource<AurumElementModel[]> | ArrayDataSource<AurumElementModel> | ChildNode[]; |
@@ -5,2 +5,3 @@ import { ArrayDataSource, DataSource } from '../../stream/data_source'; | ||
import { EventEmitter } from '../../utilities/event_emitter'; | ||
import { DuplexDataSource } from '../../stream/duplex_data_source'; | ||
export const aurumElementModelIdentitiy = Symbol('AurumElementModel'); | ||
@@ -32,6 +33,6 @@ const defaultEvents = { | ||
const defaultProps = ['id', 'name', 'draggable', 'tabindex', 'style', 'role', 'contentEditable']; | ||
export function buildRenderableFromModel(model) { | ||
export function prerender(model) { | ||
if (model && model[aurumElementModelIdentitiy]) { | ||
const result = model.constructor(model.props, model.innerNodes); | ||
return buildRenderableFromModel(result); | ||
return prerender(result); | ||
} | ||
@@ -88,2 +89,5 @@ else { | ||
} | ||
else if (props[events[key]] instanceof DuplexDataSource) { | ||
this.node.addEventListener(key, (e) => props[events[key]].updateDownstream(e)); | ||
} | ||
else if (typeof props[events[key]] === 'function') { | ||
@@ -346,3 +350,3 @@ this.node.addEventListener(key, (e) => props[events[key]](e)); | ||
if (child[aurumElementModelIdentitiy]) { | ||
child = buildRenderableFromModel(child); | ||
child = prerender(child); | ||
if (child === undefined) { | ||
@@ -418,3 +422,3 @@ return; | ||
if (child[aurumElementModelIdentitiy]) { | ||
renderable = buildRenderableFromModel(child); | ||
renderable = prerender(child); | ||
} | ||
@@ -472,3 +476,3 @@ else { | ||
if (newValue[aurumElementModelIdentitiy]) { | ||
newValue = buildRenderableFromModel(newValue); | ||
newValue = prerender(newValue); | ||
} | ||
@@ -547,3 +551,3 @@ if (typeof newValue === 'string' || typeof newValue === 'bigint' || typeof newValue === 'number' || typeof newValue === 'boolean') { | ||
case 'replace': | ||
this.children[change.index] = buildRenderableFromModel(change.items[0]); | ||
this.children[change.index] = prerender(change.items[0]); | ||
break; | ||
@@ -557,6 +561,6 @@ case 'swap': | ||
case 'append': | ||
this.children = this.children.concat(change.items.map(buildRenderableFromModel)); | ||
this.children = this.children.concat(change.items.map(prerender)); | ||
break; | ||
case 'prepend': | ||
this.children.unshift(...change.items.map(buildRenderableFromModel)); | ||
this.children.unshift(...change.items.map(prerender)); | ||
break; | ||
@@ -563,0 +567,0 @@ case 'remove': |
import { DataSource } from '../../stream/data_source'; | ||
import { buildRenderableFromModel } from './aurum_element'; | ||
import { prerender } from './aurum_element'; | ||
const routeIdentity = Symbol('route'); | ||
export function AurumRouter(props, children) { | ||
children = children.map(buildRenderableFromModel); | ||
children = children.map(prerender); | ||
if (children.some((c) => !c[routeIdentity])) { | ||
@@ -7,0 +7,0 @@ throw new Error('Aurum Router only accepts Route and DefaultRoute instances as children'); |
import { DataSource } from '../../stream/data_source'; | ||
import { buildRenderableFromModel } from './aurum_element'; | ||
import { prerender } from './aurum_element'; | ||
export function Suspense(props, children) { | ||
const data = new DataSource(props.fallback); | ||
Promise.all(children.map(buildRenderableFromModel)).then((res) => { | ||
Promise.all(children.map(prerender)).then((res) => { | ||
data.update(res); | ||
@@ -7,0 +7,0 @@ }); |
@@ -1,5 +0,5 @@ | ||
import { buildRenderableFromModel } from './aurum_element'; | ||
import { prerender } from './aurum_element'; | ||
const switchCaseIdentity = Symbol('switchCase'); | ||
export function Switch(props, children) { | ||
children = children.map(buildRenderableFromModel); | ||
children = children.map(prerender); | ||
if (children.some((c) => !c[switchCaseIdentity])) { | ||
@@ -6,0 +6,0 @@ throw new Error('Switch only accepts SwitchCase as children'); |
import { CancellationToken } from '../utilities/cancellation_token'; | ||
import { Callback, Predicate } from '../utilities/common'; | ||
import { Callback, ThenArg, Predicate } from '../utilities/common'; | ||
export declare class DataSource<T> { | ||
@@ -9,19 +9,19 @@ value: T; | ||
update(newValue: T): void; | ||
protected backPropagate(sender: Callback<T>, newValue: T): void; | ||
listenAndRepeat(callback: Callback<T>, cancellationToken?: CancellationToken): Callback<void>; | ||
listen(callback: Callback<T>, cancellationToken?: CancellationToken): Callback<void>; | ||
filter(callback: (value: T) => boolean, cancellationToken?: CancellationToken): DataSource<T>; | ||
filterDuplex(callback: (value: T) => boolean, cancellationToken?: CancellationToken): DataSource<T>; | ||
filter(callback: (newValue: T, oldValue: T) => boolean, cancellationToken?: CancellationToken): DataSource<T>; | ||
max(cancellationToken?: CancellationToken): DataSource<T>; | ||
min(cancellationToken?: CancellationToken): DataSource<T>; | ||
pipe(targetDataSource: DataSource<T>, cancellationToken?: CancellationToken): void; | ||
pipeDuplex(targetDataSource: DataSource<T>, cancellationToken?: CancellationToken): void; | ||
map<D>(callback: (value: T) => D, cancellationToken?: CancellationToken): DataSource<D>; | ||
mapDuplex<D>(callback: (value: T) => D, reverseMap: (value: D) => T, cancellationToken?: CancellationToken): DataSource<D>; | ||
await<R extends ThenArg<T>>(cancellationToken?: CancellationToken): DataSource<R>; | ||
unique(cancellationToken?: CancellationToken): DataSource<T>; | ||
uniqueDuplex(cancellationToken?: CancellationToken): DataSource<T>; | ||
reduce(reducer: (p: T, c: T) => T, initialValue: T, cancellationToken?: CancellationToken): DataSource<T>; | ||
aggregate<D, E>(otherSource: DataSource<D>, combinator: (self: T, other: D) => E, cancellationToken?: CancellationToken): DataSource<E>; | ||
stringJoin(seperator: string, cancellationToken?: CancellationToken): DataSource<string>; | ||
combine(otherSource: DataSource<T>, cancellationToken?: CancellationToken): DataSource<T>; | ||
debounce(time: number, cancellationToken?: CancellationToken): DataSource<T>; | ||
throttle(time: number, cancellationToken?: CancellationToken): DataSource<T>; | ||
buffer(time: number, cancellationToken?: CancellationToken): DataSource<T[]>; | ||
queue(cancellationToken?: CancellationToken): ArrayDataSource<T>; | ||
accumulate(cancellationToken?: CancellationToken): ArrayDataSource<T>; | ||
pick(key: keyof T, cancellationToken?: CancellationToken): DataSource<T[typeof key]>; | ||
@@ -68,3 +68,2 @@ cancelAll(): void; | ||
forEach(callbackfn: (value: T, index: number, array: T[]) => void): void; | ||
toDataSource(): DataSource<T[]>; | ||
private update; | ||
@@ -71,0 +70,0 @@ } |
@@ -16,8 +16,2 @@ import { EventEmitter } from '../utilities/event_emitter'; | ||
} | ||
backPropagate(sender, newValue) { | ||
this.value = newValue; | ||
this.updating = true; | ||
this.updateEvent.fireFiltered(newValue, sender); | ||
this.updating = false; | ||
} | ||
listenAndRepeat(callback, cancellationToken) { | ||
@@ -33,3 +27,3 @@ callback(this.value); | ||
this.listen((value) => { | ||
if (callback(value)) { | ||
if (callback(value, filteredSource.value)) { | ||
filteredSource.update(value); | ||
@@ -40,27 +34,25 @@ } | ||
} | ||
filterDuplex(callback, cancellationToken) { | ||
const filteredSource = new DataSource(); | ||
const cb = (value) => { | ||
if (callback(value)) { | ||
filteredSource.backPropagate(cb2, value); | ||
max(cancellationToken) { | ||
return this.filter((newValue, oldValue) => { | ||
if (typeof newValue === 'string' && typeof oldValue === 'string') { | ||
return newValue.localeCompare(oldValue) > 0; | ||
} | ||
}; | ||
const cb2 = (value) => { | ||
if (callback(value)) { | ||
this.backPropagate(cb, value); | ||
else { | ||
return newValue > oldValue; | ||
} | ||
}; | ||
this.listen(cb, cancellationToken); | ||
filteredSource.listen(cb2, cancellationToken); | ||
return filteredSource; | ||
}); | ||
} | ||
min(cancellationToken) { | ||
return this.filter((newValue, oldValue) => { | ||
if (typeof newValue === 'string' && typeof oldValue === 'string') { | ||
return newValue.localeCompare(oldValue) < 0; | ||
} | ||
else { | ||
return newValue < oldValue; | ||
} | ||
}); | ||
} | ||
pipe(targetDataSource, cancellationToken) { | ||
this.listen((v) => targetDataSource.update(v), cancellationToken); | ||
} | ||
pipeDuplex(targetDataSource, cancellationToken) { | ||
const cb = (v) => targetDataSource.backPropagate(cb2, v); | ||
const cb2 = (v) => this.backPropagate(cb, v); | ||
this.listen(cb, cancellationToken); | ||
targetDataSource.listen(cb2, cancellationToken); | ||
} | ||
map(callback, cancellationToken) { | ||
@@ -73,8 +65,7 @@ const mappedSource = new DataSource(callback(this.value)); | ||
} | ||
mapDuplex(callback, reverseMap, cancellationToken) { | ||
const mappedSource = new DataSource(callback(this.value)); | ||
const cb = (value) => mappedSource.backPropagate(cb2, callback(value)); | ||
const cb2 = (value) => this.backPropagate(cb, reverseMap(value)); | ||
this.listen(cb, cancellationToken); | ||
mappedSource.listen(cb2, cancellationToken); | ||
await(cancellationToken) { | ||
const mappedSource = new DataSource(); | ||
this.listen(async (value) => { | ||
mappedSource.update(await value); | ||
}, cancellationToken); | ||
return mappedSource; | ||
@@ -91,18 +82,2 @@ } | ||
} | ||
uniqueDuplex(cancellationToken) { | ||
const uniqueSource = new DataSource(this.value); | ||
const cb = (value) => { | ||
if (value !== uniqueSource.value) { | ||
uniqueSource.backPropagate(cb2, value); | ||
} | ||
}; | ||
const cb2 = (value) => { | ||
if (value !== this.value) { | ||
this.backPropagate(cb, value); | ||
} | ||
}; | ||
this.listen(cb, cancellationToken); | ||
uniqueSource.listen(cb2, cancellationToken); | ||
return uniqueSource; | ||
} | ||
reduce(reducer, initialValue, cancellationToken) { | ||
@@ -119,2 +94,7 @@ const reduceSource = new DataSource(initialValue); | ||
} | ||
stringJoin(seperator, cancellationToken) { | ||
const joinSource = new DataSource(''); | ||
this.listen((v) => joinSource.update(joinSource.value + seperator + v.toString()), cancellationToken); | ||
return joinSource; | ||
} | ||
combine(otherSource, cancellationToken) { | ||
@@ -137,2 +117,16 @@ const combinedDataSource = new DataSource(); | ||
} | ||
throttle(time, cancellationToken) { | ||
const throttledDataSource = new DataSource(this.value); | ||
let cooldown = false; | ||
this.listen((v) => { | ||
if (!cooldown) { | ||
throttledDataSource.update(v); | ||
cooldown = true; | ||
setTimeout(() => { | ||
cooldown = false; | ||
}, time); | ||
} | ||
}, cancellationToken); | ||
return throttledDataSource; | ||
} | ||
buffer(time, cancellationToken) { | ||
@@ -154,3 +148,3 @@ const bufferedDataSource = new DataSource(); | ||
} | ||
queue(cancellationToken) { | ||
accumulate(cancellationToken) { | ||
const queueDataSource = new ArrayDataSource(); | ||
@@ -361,9 +355,2 @@ this.listen((v) => { | ||
} | ||
toDataSource() { | ||
const stream = new DataSource(this.data); | ||
this.listen((s) => { | ||
stream.update(s.newState); | ||
}); | ||
return stream; | ||
} | ||
update(change) { | ||
@@ -370,0 +357,0 @@ this.updateEvent.fire(change); |
@@ -1,2 +0,2 @@ | ||
import { AurumElement, buildRenderableFromModel, aurumElementModelIdentitiy } from '../nodes/special/aurum_element'; | ||
import { AurumElement, prerender, aurumElementModelIdentitiy } from '../nodes/special/aurum_element'; | ||
import { ownerSymbol } from './owner_symbol'; | ||
@@ -129,3 +129,3 @@ import { Div } from '../nodes/div'; | ||
static attach(aurumElementModel, dom) { | ||
const aurumElement = buildRenderableFromModel(aurumElementModel); | ||
const aurumElement = prerender(aurumElementModel); | ||
if (dom[ownerSymbol]) { | ||
@@ -132,0 +132,0 @@ throw new Error('This node is already managed by aurum and cannot be used'); |
import { DataSource } from '../stream/data_source'; | ||
import { DuplexDataSource } from '../stream/duplex_data_source'; | ||
export declare type AttributeValue = string | DataSource<string> | DataSource<boolean> | boolean; | ||
@@ -14,3 +15,4 @@ export declare type StringSource = string | DataSource<string>; | ||
}; | ||
export declare type DataDrain<T> = Callback<T> | DataSource<T>; | ||
export declare type DataDrain<T> = Callback<T> | DataSource<T> | DuplexDataSource<T>; | ||
export declare type ThenArg<T> = T extends PromiseLike<infer U> ? U : T; | ||
//# sourceMappingURL=common.d.ts.map |
{ | ||
"name": "aurumjs", | ||
"version": "0.3.18", | ||
"version": "0.3.19", | ||
"description": "Fast and concise declarative DOM rendering library for javascript", | ||
@@ -5,0 +5,0 @@ "main": "dist/aurum.js", |
@@ -1,2 +0,2 @@ | ||
var t=function(){this.subscribeChannel=[],this.onAfterFire=[]},e={subscriptions:{configurable:!0}};e.subscriptions.get=function(){return this.subscribeChannel.length},t.prototype.subscribe=function(t,e){return this.createSubscription(t,this.subscribeChannel,e).facade},t.prototype.hasSubscriptions=function(){return this.subscriptions>0},t.prototype.cancelAll=function(){var t=this;this.isFiring?this.onAfterFire.push(function(){return t.subscribeChannel.length=0}):this.subscribeChannel.length=0},t.prototype.fireFiltered=function(t,e){this.isFiring=!0;for(var n=this.subscribeChannel.length,o=0;o<n;o++)this.subscribeChannel[o].callback!==e&&this.subscribeChannel[o].callback(t);this.isFiring=!1,this.afterFire()},t.prototype.afterFire=function(){this.onAfterFire.length>0&&(this.onAfterFire.forEach(function(t){return t()}),this.onAfterFire.length=0)},t.prototype.fire=function(t){this.isFiring=!0;for(var e=this.subscribeChannel.length,n=0;n<e;n++)this.subscribeChannel[n].callback(t);this.isFiring=!1,this.afterFire()},t.prototype.createSubscription=function(t,e,n){var o=this,r={callback:t},i={cancel:function(){o.cancel(r,e)}};return void 0!==n&&n.addCancelable(function(){return o.cancel(r,e)}),e.push(r),{subscription:r,facade:i}},t.prototype.cancel=function(t,e){var n=this,o=e.indexOf(t);o>=0&&(this.isFiring?this.onAfterFire.push(function(){return n.cancel(t,e)}):e.splice(o,1))},Object.defineProperties(t.prototype,e);var n=function(e){this.value=e,this.updateEvent=new t};n.prototype.update=function(t){if(this.updating)throw new Error("Problem in datas source: Unstable value propagation, when updating a value the stream was updated back as a direct response. This can lead to infinite loops and is therefore not allowed");this.updating=!0,this.value=t,this.updateEvent.fire(t),this.updating=!1},n.prototype.backPropagate=function(t,e){this.value=e,this.updating=!0,this.updateEvent.fireFiltered(e,t),this.updating=!1},n.prototype.listenAndRepeat=function(t,e){return t(this.value),this.listen(t,e)},n.prototype.listen=function(t,e){return this.updateEvent.subscribe(t,e).cancel},n.prototype.filter=function(t,e){var o=new n;return this.listen(function(e){t(e)&&o.update(e)},e),o},n.prototype.filterDuplex=function(t,e){var o=this,r=new n,i=function(e){t(e)&&r.backPropagate(a,e)},a=function(e){t(e)&&o.backPropagate(i,e)};return this.listen(i,e),r.listen(a,e),r},n.prototype.pipe=function(t,e){this.listen(function(e){return t.update(e)},e)},n.prototype.pipeDuplex=function(t,e){var n=this,o=function(e){return t.backPropagate(r,e)},r=function(t){return n.backPropagate(o,t)};this.listen(o,e),t.listen(r,e)},n.prototype.map=function(t,e){var o=new n(t(this.value));return this.listen(function(e){o.update(t(e))},e),o},n.prototype.mapDuplex=function(t,e,o){var r=this,i=new n(t(this.value)),a=function(e){return i.backPropagate(c,t(e))},c=function(t){return r.backPropagate(a,e(t))};return this.listen(a,o),i.listen(c,o),i},n.prototype.unique=function(t){var e=new n(this.value);return this.listen(function(t){t!==e.value&&e.update(t)},t),e},n.prototype.uniqueDuplex=function(t){var e=this,o=new n(this.value),r=function(t){t!==o.value&&o.backPropagate(i,t)},i=function(t){t!==e.value&&e.backPropagate(r,t)};return this.listen(r,t),o.listen(i,t),o},n.prototype.reduce=function(t,e,o){var r=new n(e);return this.listen(function(e){return r.update(t(r.value,e))},o),r},n.prototype.aggregate=function(t,e,o){var r=this,i=new n(e(this.value,t.value));return this.listen(function(){return i.update(e(r.value,t.value))},o),t.listen(function(){return i.update(e(r.value,t.value))},o),i},n.prototype.combine=function(t,e){var o=new n;return this.pipe(o,e),t.pipe(o,e),o},n.prototype.debounce=function(t,e){var o,r=new n(this.value);return this.listen(function(e){clearTimeout(o),o=setTimeout(function(){r.update(e)},t)},e),r},n.prototype.buffer=function(t,e){var o,r=new n,i=[];return this.listen(function(e){i.push(e),o||(o=setTimeout(function(){o=void 0,r.update(i),i=[]},t))},e),r},n.prototype.queue=function(t){var e=new o;return this.listen(function(t){e.push(t)},t),e},n.prototype.pick=function(t,e){var o,r=new n(null===(o=this.value)||void 0===o?void 0:o[t]);return this.listen(function(e){r.update(null!=e?e[t]:e)},e),r},n.prototype.cancelAll=function(){this.updateEvent.cancelAll()};var o=function(e){this.data=e?e.slice():[],this.lengthSource=new n(this.data.length).unique(),this.updateEvent=new t},r={length:{configurable:!0}};o.prototype.listenAndRepeat=function(t,e){return t({operation:"add",operationDetailed:"append",index:0,items:this.data,newState:this.data,count:this.data.length}),this.listen(t,e)},o.prototype.listen=function(t,e){return this.updateEvent.subscribe(t,e).cancel},r.length.get=function(){return this.lengthSource},o.prototype.getData=function(){return this.data.slice()},o.prototype.get=function(t){return this.data[t]},o.prototype.set=function(t,e){var n=this.data[t];n!==e&&(this.data[t]=e,this.update({operation:"replace",operationDetailed:"replace",target:n,count:1,index:t,items:[e],newState:this.data}),this.lengthSource.update(this.data.length))},o.prototype.swap=function(t,e){if(t!==e){var n=this.data[t],o=this.data[e];this.data[e]=n,this.data[t]=o,this.update({operation:"swap",operationDetailed:"swap",index:t,index2:e,items:[n,o],newState:this.data}),this.lengthSource.update(this.data.length)}},o.prototype.swapItems=function(t,e){if(t!==e){var n=this.data.indexOf(t),o=this.data.indexOf(e);-1!==n&&-1!==o&&(this.data[o]=t,this.data[n]=e),this.update({operation:"swap",operationDetailed:"swap",index:n,index2:o,items:[t,e],newState:this.data}),this.lengthSource.update(this.data.length)}},o.prototype.appendArray=function(t){var e=this.data;this.data=new Array(e.length);var n=0;for(n=0;n<e.length;n++)this.data[n]=e[n];for(var o=0;o<t.length;o++)this.data[n+o]=t[o];this.update({operation:"add",operationDetailed:"append",count:t.length,index:this.data.length-t.length,items:t,newState:this.data}),this.lengthSource.update(this.data.length)},o.prototype.push=function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];this.appendArray(t),this.lengthSource.update(this.data.length)},o.prototype.unshift=function(){for(var t,e=[],n=arguments.length;n--;)e[n]=arguments[n];(t=this.data).unshift.apply(t,e),this.update({operation:"add",operationDetailed:"prepend",count:e.length,items:e,index:0,newState:this.data}),this.lengthSource.update(this.data.length)},o.prototype.pop=function(){var t=this.data.pop();return this.update({operation:"remove",operationDetailed:"removeRight",count:1,index:this.data.length,items:[t],newState:this.data}),this.lengthSource.update(this.data.length),t},o.prototype.merge=function(t){for(var e=0;e<t.length;e++)this.data[e]!==t[e]&&(this.data.length>e?this.set(e,t[e]):this.push(t[e]));this.data.length>t.length&&this.removeRight(this.data.length-t.length),this.lengthSource.update(this.data.length)},o.prototype.removeRight=function(t){var e=this.data.length,n=this.data.splice(e-t,t);this.update({operation:"remove",operationDetailed:"removeRight",count:t,index:e-t,items:n,newState:this.data}),this.lengthSource.update(this.data.length)},o.prototype.removeLeft=function(t){var e=this.data.splice(0,t);this.update({operation:"remove",operationDetailed:"removeLeft",count:t,index:0,items:e,newState:this.data}),this.lengthSource.update(this.data.length)},o.prototype.remove=function(t){var e=this.data.indexOf(t);-1!==e&&(this.data.splice(e,1),this.update({operation:"remove",operationDetailed:"remove",count:1,index:e,items:[t],newState:this.data}),this.lengthSource.update(this.data.length))},o.prototype.clear=function(){var t=this.data;this.data=[],this.update({operation:"remove",operationDetailed:"clear",count:t.length,index:0,items:t,newState:this.data}),this.lengthSource.update(this.data.length)},o.prototype.shift=function(){var t=this.data.shift();return this.update({operation:"remove",operationDetailed:"removeLeft",items:[t],count:1,index:0,newState:this.data}),this.lengthSource.update(this.data.length),t},o.prototype.toArray=function(){return this.data.slice()},o.prototype.sort=function(t,e){return new a(this,t,e)},o.prototype.map=function(t,e){return new i(this,t,e)},o.prototype.filter=function(t,e,n){void 0===e&&(e=[]);var o=new c(this,t,n);return e.forEach(function(t){t.unique().listen(function(){return o.refresh()})}),o},o.prototype.forEach=function(t){return this.data.forEach(t)},o.prototype.toDataSource=function(){var t=new n(this.data);return this.listen(function(e){t.update(e.newState)}),t},o.prototype.update=function(t){this.updateEvent.fire(t)},Object.defineProperties(o.prototype,r);var i=function(t){function e(e,n,o){var r=this,i=e.getData().map(n);t.call(this,i),this.mapper=n,e.listen(function(t){var e;switch(t.operationDetailed){case"removeLeft":r.removeLeft(t.count);break;case"removeRight":r.removeRight(t.count);break;case"remove":r.remove(r.data[t.index]);break;case"clear":r.clear();break;case"prepend":(e=r).unshift.apply(e,t.items.map(r.mapper));break;case"append":r.appendArray(t.items.map(r.mapper));break;case"swap":r.swap(t.index,t.index2);break;case"replace":r.set(t.index,r.mapper(t.items[0]))}},o)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(o),a=function(t){function e(e,n,o){var r=this,i=e.getData().sort(n);t.call(this,i),this.comparator=n,e.listen(function(t){var e,n;switch(t.operationDetailed){case"removeLeft":r.removeLeft(t.count);break;case"removeRight":r.removeRight(t.count);break;case"remove":r.remove(t.items[0]);break;case"clear":r.data.length=0;break;case"prepend":(e=r).unshift.apply(e,t.items),r.data.sort(r.comparator);break;case"append":(n=r).push.apply(n,t.items),r.data.sort(r.comparator);break;case"swap":break;case"replace":r.set(t.index,t.items[0]),r.data.sort(r.comparator)}},o)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(o),c=function(t){function e(e,n,o){var r=this;Array.isArray(e)&&(e=new t(e));var i=e.data.filter(n=null!=n?n:function(){return!0});t.call(this,i),this.parent=e,this.viewFilter=n,e.listen(function(t){var e,n,o;switch(t.operationDetailed){case"clear":r.clear();break;case"removeLeft":case"removeRight":case"remove":for(var i=0,a=t.items;i<a.length;i+=1)r.remove(a[i]);break;case"prepend":o=t.items.filter(r.viewFilter),(e=r).unshift.apply(e,o);break;case"append":o=t.items.filter(r.viewFilter),(n=r).push.apply(n,o);break;case"swap":var c=r.data.indexOf(t.items[0]),s=r.data.indexOf(t.items[1]);-1!==c&&-1!==s&&r.swap(c,s);break;case"replace":var u=r.data.indexOf(t.target);-1!==u&&(r.viewFilter(t.items[0])?r.set(u,t.items[0]):r.remove(t.target))}},o)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.updateFilter=function(t){if(this.viewFilter!==t)return this.viewFilter=t,this.refresh(),this.data.length},e.prototype.refresh=function(){var t;this.clear();var e=this.parent.data.filter(this.viewFilter);(t=this).push.apply(t,e)},e}(o),s=function(e){e&&(this.data=e),this.updateEvent=new t,this.updateEventOnKey=new Map};s.prototype.pick=function(t,e){var o,r=new n(null===(o=this.data)||void 0===o?void 0:o[t]);return this.listenOnKey(t,function(t){r.update(t.newValue)},e),r},s.prototype.listen=function(t,e){return this.updateEvent.subscribe(t,e).cancel},s.prototype.listenOnKeyAndRepeat=function(t,e,n){return e({key:t,newValue:this.data[t],oldValue:void 0}),this.listenOnKey(t,e,n)},s.prototype.listenOnKey=function(e,n,o){return this.updateEventOnKey.has(e)||this.updateEventOnKey.set(e,new t),this.updateEventOnKey.get(e).subscribe(n,o).cancel},s.prototype.get=function(t){return this.data[t]},s.prototype.set=function(t,e){if(this.data[t]!==e){var n=this.data[t];this.data[t]=e,this.updateEvent.fire({oldValue:n,key:t,newValue:this.data[t]}),this.updateEventOnKey.has(t)&&this.updateEventOnKey.get(t).fire({oldValue:n,key:t,newValue:this.data[t]})}},s.prototype.assign=function(t){for(var e=0,n=Object.keys(t);e<n.length;e+=1){var o=n[e];this.set(o,t[o])}},s.prototype.toObject=function(){return Object.assign({},this.data)},s.prototype.toDataSource=function(){var t=this,e=new n(this.data);return this.listen(function(n){e.update(t.data)}),e};var u=Symbol("owner"),p=function(t){var e=this;this.node=this.create(t),t instanceof n&&t.listen(function(t){e.node&&(e.node.textContent=t)})};p.prototype.resolveStringSource=function(t){return"string"==typeof t?t:t.value},p.prototype.create=function(t){var e=document.createTextNode(this.resolveStringSource(t));return e[u]=this,e},p.prototype.remove=function(){this.hasParent()&&this.node.parentElement[u].removeChild(this.node)},p.prototype.hasParent=function(){return!!this.node.parentElement};var l=Symbol("AurumElementModel"),h={drag:"onDrag",dragstart:"onDragStart",dragend:"onDragEnd",dragexit:"onDragExit",dragover:"onDragOver",dragenter:"onDragEnter",dragleave:"onDragLeave",blur:"onBlur",focus:"onFocus",click:"onClick",dblclick:"onDblClick",keydown:"onKeyDown",keyhit:"onKeyHit",keyup:"onKeyUp",mousedown:"onMouseDown",mouseup:"onMouseUp",mousemove:"onMouseMove",mouseenter:"onMouseEnter",mouseleave:"onMouseLeave",mousewheel:"onMouseWheel",load:"onLoad",error:"onError"},d=["id","name","draggable","tabindex","style","role","contentEditable"];function f(t){return t&&t[l]?f(t.constructor(t.props,t.innerNodes)):t}var v=function(t,e,n){var o,r;this.node=this.create(n),this.children=[],null!=t&&(t.onAttach&&(this.onAttach=t.onAttach,this.needAttach=!0),this.onDetach=t.onDetach,this.initialize(t),null===(r=(o=t).onCreate)||void 0===r||r.call(o,this.node)),e&&this.addChildren(e)};v.prototype.initialize=function(t){this.createEventHandlers(h,t);var e=Object.keys(t).filter(function(t){return t.includes("-")});this.bindProps(d,t,e),t.class&&this.handleClass(t.class)},v.prototype.bindProps=function(t,e,n){for(var o=0,r=t;o<r.length;o+=1){var i=r[o];e[i]&&this.assignStringSourceToAttribute(e[i],i)}if(n)for(var a=0,c=n;a<c.length;a+=1){var s=c[a];e[s]&&this.assignStringSourceToAttribute(e[s],s)}},v.prototype.createEventHandlers=function(t,e){var o=this,r=function(r){e[t[r]]&&(e[t[r]]instanceof n?o.node.addEventListener(r,function(n){return e[t[r]].update(n)}):"function"==typeof e[t[r]]&&o.node.addEventListener(r,function(n){return e[t[r]](n)}))};for(var i in t)r(i)},v.prototype.render=function(){for(var t=0,e=0;e<this.children.length;e++,t++)this.children[e]instanceof y?t=this.renderFragment(this.children[e],t):this.renderChild(this.children[e],t);for(;this.node.childNodes.length>t;)this.node.removeChild(this.node.childNodes[this.node.childNodes.length-1])},v.prototype.renderFragment=function(t,e){for(var n=0;n<t.children.length;n++,e++)t.children[n]instanceof y?e=this.renderFragment(t.children[n],e):this.renderChild(t.children[n],e);return--e},v.prototype.renderChild=function(t,e){if(this.node.childNodes.length<=e)return this.addChildDom(t);if(this.node.childNodes[e][u]!==t){var n=this.getChildIndex(t.node);-1!==n?this.swapChildrenDom(e,n):this.addDomNodeAt(t.node,e)}},v.prototype.assignStringSourceToAttribute=function(t,e){var n=this;"string"==typeof t||"boolean"==typeof t?"boolean"==typeof t?t?this.node.setAttribute(e,""):this.node.removeAttribute(e):this.node.setAttribute(e,t):t.unique().listenAndRepeat(function(t){"boolean"==typeof t?t?n.node.setAttribute(e,""):n.node.removeAttribute(e):n.node.setAttribute(e,t)})},v.prototype.handleAttach=function(t){var e,n,o,r;if(this.needAttach)if(t.isConnected()){null===(e=this.onAttach)||void 0===e||e.call(this,this.node);for(var i=0,a=this.node.childNodes;i<a.length;i+=1)null===(r=null===(n=a[i][u])||void 0===n?void 0:(o=n).handleAttach)||void 0===r||r.call(o,this)}else t.needAttach=!0},v.prototype.handleDetach=function(){var t,e,n;if(!this.node.isConnected){null===(t=this.onDetach)||void 0===t||t.call(this,this.node);for(var o=0,r=this.node.childNodes;o<r.length;o+=1){var i=r[o];i[u]&&(null===(n=(e=i[u]).handleDetach)||void 0===n||n.call(e))}}},v.prototype.handleClass=function(t){var e=this;if("string"==typeof t)this.node.className=t;else if(t instanceof n)t.value&&(Array.isArray(t.value)?(this.node.className=t.value.join(" "),t.unique().listen(function(){e.node.className=t.value.join(" ")})):(this.node.className=t.value,t.unique().listen(function(){e.node.className=t.value}))),t.unique().listen(function(t){return e.node.className=t});else{var o=t.reduce(function(t,e){return"string"==typeof e?t+" "+e:e.value?t+" "+e.value:t},"");this.node.className=o;for(var r=0,i=t;r<i.length;r+=1){var a=i[r];a instanceof n&&a.unique().listen(function(n){var o=t.reduce(function(t,e){return"string"==typeof e?t+" "+e:e.value?t+" "+e.value:t},"");e.node.className=o})}}},v.prototype.create=function(t){var e=document.createElement(t);return e[u]=this,e},v.prototype.getChildIndex=function(t){for(var e=0,n=0,o=this.node.childNodes;n<o.length;n+=1){if(o[n]===t)return e;e++}return-1},v.prototype.hasChild=function(t){for(var e=0,n=t.children;e<n.length;e+=1)if(n[e]===t)return!0;return!1},v.prototype.addChildDom=function(t){var e,n;this.node.appendChild(t.node),null===(n=(e=t).handleAttach)||void 0===n||n.call(e,this)},v.prototype.swapChildrenDom=function(t,e){if(t!==e){var n=this.node.children[t],o=this.node.children[e];n.remove(),o.remove(),t<e?(this.addDomNodeAt(o,t),this.addDomNodeAt(n,e)):(this.addDomNodeAt(n,e),this.addDomNodeAt(o,t))}},v.prototype.addDomNodeAt=function(t,e){var n,o,r,i;e>=this.node.childElementCount?(this.node.appendChild(t),null===(o=(n=t[u]).handleAttach)||void 0===o||o.call(n,this)):(this.node.insertBefore(t,this.node.children[e]),null===(i=(r=t[u]).handleAttach)||void 0===i||i.call(r,this))},v.prototype.remove=function(){this.hasParent()&&this.node.parentElement[u].removeChild(this.node)},v.prototype.hasParent=function(){return!!this.node.parentElement},v.prototype.isConnected=function(){return this.node.isConnected},v.prototype.removeChild=function(t){var e=this.children.indexOf(t);-1!==e&&this.children.splice(e,1),this.render()},v.prototype.removeChildAt=function(t){this.children.splice(t,1),this.render()},v.prototype.swapChildren=function(t,e){if(t!==e){var n=this.children[t];this.children[t]=this.children[e],this.children[e]=n,this.render()}},v.prototype.clearChildren=function(){this.children.length=0,this.render()},v.prototype.addChild=function(t){if(null!=t&&(!t[l]||void 0!==(t=f(t))))if(Array.isArray(t))for(var e=0,n=t;e<n.length;e+=1)this.addChild(n[e]);else this.children.push(this.childNodeToAurum(t)),this.render()},v.prototype.childNodeToAurum=function(t){var e=this;if(t instanceof v)return t;if(t instanceof Promise){var r=new y({});return t.then(function(t){r.addChildren([t]),e.render()}),r}if(t instanceof o){var i=new y({repeatModel:t});return i.onChange.subscribe(function(){return e.render()}),i}if("string"==typeof t||"number"==typeof t||"boolean"==typeof t||"bigint"==typeof t)return new p(t.toString());if(t instanceof n){var a=new y({},[t]);return a.onChange.subscribe(function(){return e.render()}),a}throw new Error("Unsupported child type")},v.prototype.addChildAt=function(t,e){this.children.splice(e,0,this.childNodeToAurum(t)),this.render()},v.prototype.addChildren=function(t){if(0!==t.length)for(var e=0,n=t;e<n.length;e+=1)this.addChild(n[e])};var y=function(e,n){this.onChange=new t,this.children=[],e.repeatModel?this.handleRepeat(e.repeatModel):n&&this.addChildren(n)};y.prototype.addChildren=function(t){for(var e=this,o=function(){var t=i[r],o=void 0;if((o=t[l]?f(t):t)instanceof v)e.children.push(o);else{if(!(o instanceof n))throw new Error("case not yet implemented");var a=void 0,c=void 0,s={ts:void 0};o.unique().listenAndRepeat(function(t){if(s.ts=Date.now(),null==t&&c)return e.children.length=0,e.onChange.fire(),void(c=!1);if(!Array.isArray(t)&&c&&(e.children.length=0,e.onChange.fire(),c=!1),Array.isArray(t)){c=!0,e.children.length=0,e.onChange.fire();for(var n=0,r=t;n<r.length;n+=1)e.handleSourceChild(r[n],void 0,void 0,s,s.ts)}else a=e.handleSourceChild(t,a,o,s,s.ts)})}},r=0,i=t;r<i.length;r+=1)o()},y.prototype.handleSourceChild=function(t,e,r,i,a){var c=this;if(null!=t){if(t[l]&&(t=f(t)),"string"==typeof t||"bigint"==typeof t||"number"==typeof t||"boolean"==typeof t)if(e){if(e instanceof v){var s=new p(null!=r?r:t);this.children.splice(this.children.indexOf(e),1,s),e=s,this.onChange.fire()}}else{var u=new p(null!=r?r:t);this.children.push(u),e=u,this.onChange.fire()}else if(t instanceof v)t!==e&&(e?this.children.splice(this.children.indexOf(e),1,t):this.children.push(t),e=t,this.onChange.fire());else if(t instanceof Promise)t.then(function(t){i.ts===a&&(c.addChildren([t]),c.onChange.fire())});else if(t instanceof n)if(e){if(e!==t){var h=new y({},[t]);h.onChange.subscribe(function(){return c.onChange.fire()}),this.children.splice(this.children.indexOf(e),1,h),e=h,this.onChange.fire()}}else{var d=new y({},[t]);e=d,this.children.push(d),d.onChange.subscribe(function(){return c.onChange.fire()}),this.onChange.fire()}else if(t instanceof o)if(e){if(e!==t){var b=new y({repeatModel:t});b.onChange.subscribe(function(){return c.onChange.fire()}),this.children.splice(this.children.indexOf(e),1,b),e=b,this.onChange.fire()}}else{var _=new y({repeatModel:t});e=_,this.children.push(_),_.onChange.subscribe(function(){return c.onChange.fire()}),this.onChange.fire()}return e}e&&(this.children.splice(this.children.indexOf(e),1),e=void 0,this.onChange.fire())},y.prototype.handleRepeat=function(t){var e=this;t.listenAndRepeat(function(t){var n;switch(t.operationDetailed){case"replace":e.children[t.index]=f(t.items[0]);break;case"swap":var o=e.children[t.index2];e.children[t.index2]=e.children[t.index],e.children[t.index]=o;break;case"append":e.children=e.children.concat(t.items.map(f));break;case"prepend":(n=e.children).unshift.apply(n,t.items.map(f));break;case"remove":case"removeLeft":case"removeRight":e.children.splice(t.index,t.count);break;case"clear":e.children=[];break;default:throw new Error("unhandled operation")}e.onChange.fire()})};var b=function(t){function e(e,n){t.call(this,e,n,"div")}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(v),_=function(t){function e(e,n){t.call(this,e,n,"button"),null!==e&&this.bindProps(["disabled"],e)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(v),g={input:"onInput",change:"onChange"},m=["placeholder","readonly","disabled","accept","alt","autocomplete","autofocus","checked","defaultChecked","formAction","formEnctype","formMethod","formNoValidate","formTarget","max","maxLength","min","minLength","pattern","multiple","required","type"],w=function(t){function e(e,n){var o,r=this;t.call(this,e,n,"input"),null!==e&&(e.inputValueSource?e.inputValueSource.unique().listenAndRepeat(function(t){return r.node.value=t}):this.node.value=null!=(o=e.initialValue)?o:"",this.bindProps(m,e),this.createEventHandlers(g,e),e.inputValueSource&&this.node.addEventListener("input",function(){e.inputValueSource.update(r.node.value)}))}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(v),x=function(t){function e(e,n){t.call(this,e,n,"li")}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(v),C=function(t){function e(e,n){t.call(this,e,n,"span")}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(v),O=function(t){function e(e,n){t.call(this,e,n,"style"),null!==e&&this.bindProps(["media"],e)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(v),A=function(t){function e(e,n){t.call(this,e,n,"audio"),null!==e&&this.bindProps(["controls","autoplay","loop","muted","preload","src"],e)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(v),S=function(t){function e(e,n){t.call(this,e,n,"ul")}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(v),j=function(t){function e(e,n){t.call(this,e,n,"p")}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(v),E=function(t){function e(e,n){t.call(this,e,n,"img"),null!==e&&this.bindProps(["src","alt","width","height","referrerPolicy","sizes","srcset","useMap"],e)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(v),k=function(t){function e(e,n){t.call(this,e,n,"link"),null!==e&&this.bindProps(["href","rel","media","as","disabled","type"],e)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(v),N=function(t){function e(e,n){t.call(this,e,n,"canvas"),null!==e&&this.bindProps(["width","height"],e)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(v),D=function(t){function e(e,n){t.call(this,e,n,"a"),null!==e&&this.bindProps(["href","target"],e)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(v),P=function(t){function e(e,n){t.call(this,e,n,"article")}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(v),F=function(t){function e(e,n){t.call(this,e,n,"br")}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(v),R=function(t){function e(e,n){t.call(this,e,n,"form")}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(v),I=function(t){function e(e,n){t.call(this,e,n,"label"),null!==e&&this.bindProps(["for"],e)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(v),q=function(t){function e(e,n){t.call(this,e,n,"ol")}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(v),L=function(t){function e(e,n){t.call(this,e,n,"pre")}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(v),V=function(t){function e(e,n){t.call(this,e,n,"progress"),null!==e&&this.bindProps(["max","value"],e)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(v),M=function(t){function e(e,n){t.call(this,e,n,"table")}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(v),T=function(t){function e(e,n){t.call(this,e,n,"td")}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(v),K=function(t){function e(e,n){t.call(this,e,n,"tr")}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(v),H=function(t){function e(e,n){t.call(this,e,n,"th")}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(v),z={input:"onInput",change:"onChange"},U=["placeholder","readonly","disabled","rows","wrap","autocomplete","autofocus","max","maxLength","min","minLength","required","type"],B=function(t){function e(e,n){var o,r,i,a=this;t.call(this,e,n,"textArea"),null!==e&&(e.inputValueSource?(this.node.value=null!=(r=null!=(o=e.initialValue)?o:e.inputValueSource.value)?r:"",e.inputValueSource.unique().listen(function(t){return a.node.value=t})):this.node.value=null!=(i=e.initialValue)?i:"",this.bindProps(U,e),this.createEventHandlers(z,e),e.inputValueSource&&this.node.addEventListener("input",function(){e.inputValueSource.update(a.node.value)}))}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(v),W=function(t){function e(e,n){t.call(this,e,n,"h1")}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(v),G=function(t){function e(e,n){t.call(this,e,n,"h2")}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(v),J=function(t){function e(e,n){t.call(this,e,n,"h3")}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(v),Q=function(t){function e(e,n){t.call(this,e,n,"h4")}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(v),X=function(t){function e(e,n){t.call(this,e,n,"h5")}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(v),Y=function(t){function e(e,n){t.call(this,e,n,"h6")}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(v),Z=function(t){function e(e,n){t.call(this,e,n,"header")}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(v),$=function(t){function e(e,n){t.call(this,e,n,"footer")}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(v),tt=function(t){function e(e,n){t.call(this,e,n,"nav")}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(v),et=function(t){function e(e,n){t.call(this,e,n,"b")}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(v),nt=function(t){function e(e,n){t.call(this,e,n,"i")}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(v),ot=function(t){function e(e,n){t.call(this,e,n,"script"),null!==e&&this.bindProps(["src","async","defer","integrity","noModule","type"],e)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(v),rt=function(t){function e(e,n){t.call(this,e,n,"abbr")}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(v),it=function(t){function e(e,n){t.call(this,e,n,"area")}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(v),at=function(t){function e(e,n){t.call(this,e,n,"aside")}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(v),ct=function(t){function e(e,n){t.call(this,e,n,"em")}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(v),st=function(t){function e(e,n){t.call(this,e,n,"heading")}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(v),ut=function(t){function e(e,n){t.call(this,e,n,"iframe"),null!==e&&this.bindProps(["src","srcdoc","width","height","allow","allowFullscreen","allowPaymentRequest"],e)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(v),pt=function(t){function e(e,n){t.call(this,e,n,"noscript")}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(v),lt=function(t){function e(e,n){t.call(this,e,n,"q")}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(v),ht={change:"onChange"},dt=function(t){function e(e,n){var o,r=this;t.call(this,e,n,"select"),null!==e&&(this.createEventHandlers(ht,e),this.initialSelection=e.initialSelection,e.selectedIndexSource?(this.selectedIndexSource=e.selectedIndexSource,e.selectedIndexSource.unique().listenAndRepeat(function(t){return r.node.selectedIndex=t})):this.node.selectedIndex=null!=(o=e.initialSelection)?o:-1,e.selectedIndexSource&&(this.needAttach=!0,this.node.addEventListener("change",function(){e.selectedIndexSource.update(r.node.selectedIndex)})))}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.handleAttach=function(e){t.prototype.handleAttach.call(this,e),this.node.isConnected&&(this.selectedIndexSource?this.node.selectedIndex=this.selectedIndexSource.value:void 0!==this.initialSelection&&(this.node.selectedIndex=this.initialSelection))},e}(v),ft=function(t){function e(e,n){t.call(this,e,n,"source"),null!==e&&this.bindProps(["src","srcSet","media","sizes","type"],e)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(v),vt=function(t){function e(e,n){t.call(this,e,n,"title")}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(v),yt=function(t){function e(e,n){t.call(this,e,n,"video"),null!==e&&this.bindProps(["controls","autoplay","loop","muted","preload","src","poster","width","height"],e)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(v),bt=function(t){function e(e,n){t.call(this,e,n,"tbody")}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(v),_t=function(t){function e(e,n){t.call(this,e,n,"tfoot")}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(v),gt=function(t){function e(e,n){t.call(this,e,n,"thead")}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(v),mt=function(t){function e(e,n){t.call(this,e,n,"summary")}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(v),wt=function(t){function e(e,n){t.call(this,e,n,"details")}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(v),xt=function(t){function e(e,n){t.call(this,e,n,"sub")}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(v),Ct=function(t){function e(e,n){t.call(this,e,n,"sup")}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(v),Ot=function(t){function e(e,n){t.call(this,e,n,"svg"),null!==e&&this.bindProps(["width","height"],e)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(v),At=function(t){function e(e,n){t.call(this,e,n,"data"),null!==e&&this.bindProps(["datalue"],e)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(v),St=function(t){function e(e,n){t.call(this,e,n,"time"),null!==e&&this.bindProps(["datetime"],e)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(v),jt={button:_,div:b,input:w,li:x,span:C,style:O,ul:S,p:j,img:E,link:k,canvas:N,a:D,article:P,br:F,form:R,label:I,ol:q,pre:L,progress:V,table:M,td:T,tr:K,th:H,textarea:B,h1:W,h2:G,h3:J,h4:Q,h5:X,h6:Y,header:Z,footer:$,nav:tt,b:et,i:nt,script:ot,abbr:rt,area:it,aside:at,audio:A,em:ct,heading:st,iframe:ut,noscript:pt,option:function(t){function e(e,n){t.call(this,e,n,"option")}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(v),q:lt,select:dt,source:ft,title:vt,video:yt,tbody:bt,tfoot:_t,thead:gt,summary:mt,details:wt,sub:xt,sup:Ct,svg:Ot,data:At,time:St,template:function(t){function e(e,n){t.call(this,e,n,"template")}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(v)},Et=function(){};Et.attach=function(t,e){var n=f(t);if(e[u])throw new Error("This node is already managed by aurum and cannot be used");if(!(n instanceof v))throw new Error("Root node of aurum application must be a single dom node");e.appendChild(n.node),n.handleAttach(n),e[u]=n},Et.isAttached=function(t){return void 0!==t[u]},Et.detach=function(t){t[u]&&(t[u].node.remove(),t[u].handleDetach(),t[u]=void 0)},Et.factory=function(t,e){for(var n,o,r=[],i=arguments.length-2;i-- >0;)r[i]=arguments[i+2];if("string"==typeof t){var a=t;if(void 0===(t=jt[t]))throw new Error("Node "+a+" does not exist or is not supported")}return Object.getPrototypeOf(t)===v?((n={})[l]=!0,n.constructor=function(e,n){return new t(e,n)},n.props=e,n.innerNodes=r,n):((o={})[l]=!0,o.constructor=t,o.props=e,o.innerNodes=r,o)};var kt=function(t){this.data=t};kt.prototype.deleteNext=function(){if(this.next){var t=this.next.next;this.next.next=void 0,this.next.previous=void 0,this.next=t,this.next&&(this.next.previous=this)}},kt.prototype.deletePrevious=function(){if(this.previous){var t=this.previous.previous;this.previous.next=void 0,this.previous.previous=void 0,this.previous=t,this.previous&&(this.previous.next=this)}};var Nt=function(t){var e=this;void 0===t&&(t=[]),this.length=0,t.forEach(function(t){return e.append(t)})};Nt.prototype.find=function(t){for(var e=this.rootNode;e&&!t(e);)e=e.next;return e},Nt.prototype.append=function(t){return this.rootNode||this.lastNode?(this.lastNode.next=new kt(t),this.lastNode.next.previous=this.lastNode,this.lastNode=this.lastNode.next):this.rootNode=this.lastNode=new kt(t),this.length++,t},Nt.prototype.forEach=function(t){this.find(function(e){return t(e.data),!1})},Nt.prototype.prepend=function(t){return this.rootNode||this.lastNode?(this.rootNode.previous=new kt(t),this.rootNode.previous.next=this.rootNode,this.rootNode=this.rootNode.previous):this.rootNode=this.lastNode=new kt(t),this.length++,t},Nt.prototype.remove=function(t){if(t===this.rootNode.data)this.rootNode=this.rootNode===this.lastNode?this.lastNode=void 0:this.rootNode.next,this.length--;else{var e=this.find(function(e){return e.next&&e.next.data===t});e&&(e.next===this.lastNode&&(this.lastNode=e),e.deleteNext(),this.length--)}};var Dt=function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];this.cancelables=new Nt(t),this._isCancelled=!1},Pt={isCanceled:{configurable:!0}};Pt.isCanceled.get=function(){return this._isCancelled},Dt.prototype.addCancelable=function(t){return this.throwIfCancelled("attempting to add cancellable to token that is already cancelled"),this.cancelables.append(t),this.cancelables.length>200&&console.log("potential memory leak: cancellation token has over 200 clean up calls"),this},Dt.prototype.removeCancelable=function(t){return this.throwIfCancelled("attempting to remove cancellable from token that is already cancelled"),this.cancelables.remove(t),this},Dt.prototype.addDisposable=function(t){return this.addCancelable(function(){return t.dispose()}),this},Dt.prototype.callIfNotCancelled=function(t){this.isCanceled||t()},Dt.prototype.setTimeout=function(t,e){var n=this;void 0===e&&(e=0);var o=setTimeout(function(){n.removeCancelable(r),t()},e),r=function(){return clearTimeout(o)};this.addCancelable(r)},Dt.prototype.setInterval=function(t,e){var n=setInterval(t,e);this.addCancelable(function(){return clearInterval(n)})},Dt.prototype.requestAnimationFrame=function(t){var e=requestAnimationFrame(t);this.addCancelable(function(){return cancelAnimationFrame(e)})},Dt.prototype.animationLoop=function(t){var e=requestAnimationFrame(function n(o){t(o),e=requestAnimationFrame(n)});this.addCancelable(function(){return cancelAnimationFrame(e)})},Dt.prototype.throwIfCancelled=function(t){if(this.isCanceled)throw new Error(t||"cancellation token is cancelled")},Dt.prototype.chain=function(t,e){return void 0===e&&(e=!1),e&&t.chain(this,!1),this.addCancelable(function(){return t.cancel()}),this},Dt.prototype.registerDomEvent=function(t,e,n){return t.addEventListener(e,n),this.addCancelable(function(){return t.removeEventListener(e,n)}),this},Dt.prototype.cancel=function(){this.isCanceled||(this._isCancelled=!0,this.cancelables.forEach(function(t){return t()}),this.cancelables=void 0)},Object.defineProperties(Dt.prototype,Pt);var Ft=function(t){function e(e,n){t.call(this,e,n,e.tag),e.attributes&&null!==e&&this.bindProps(Object.keys(e.attributes),e.attributes)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(v),Rt=Symbol("route");function It(){var t=location.hash.substring(1);return t.includes("?")?t.substring(0,t.indexOf("?")):t.includes("#")?t.substring(0,t.indexOf("#")):t}var qt=Symbol("switchCase");exports.DataSource=n,exports.ArrayDataSource=o,exports.MappedArrayView=i,exports.SortedArrayView=a,exports.FilteredArrayView=c,exports.ObjectDataSource=s,exports.Aurum=Et,exports.CancellationToken=Dt,exports.Custom=Ft,exports.AurumRouter=function(t,e){if((e=e.map(f)).some(function(t){return!t[Rt]}))throw new Error("Aurum Router only accepts Route and DefaultRoute instances as children");if(e.filter(function(t){return t.default}).length>1)throw new Error("Too many default routes only 0 or 1 allowed");var o=new n(It());return window.addEventListener("hashchange",function(){o.update(It())}),o.unique().map(function(t){return function(t,e){var n,o;if(null==t)return null===(n=e.find(function(t){return t.default}))||void 0===n?void 0:n.content;if(e.find(function(e){return e.href===t}))return e.find(function(e){return e.href===t}).content;var r=t.split("/");r.pop();for(var i=function(){var t=r.join("/");if(e.find(function(e){return e.href===t}))return{v:e.find(function(e){return e.href===t}).content};r.pop()};r.length;){var a=i();if(a)return a.v}return null===(o=e.find(function(t){return t.default}))||void 0===o?void 0:o.content}(t,e)})},exports.Route=function(t,e){var n;return(n={})[Rt]=!0,n.content=e,n.default=!1,n.href=t.href,n},exports.DefaultRoute=function(t,e){var n;return(n={})[Rt]=!0,n.content=e,n.default=!0,n.href=void 0,n},exports.Suspense=function(t,e){var o=new n(t.fallback);return Promise.all(e.map(f)).then(function(t){o.update(t)}),o},exports.Switch=function(t,e){if((e=e.map(f)).some(function(t){return!t[qt]}))throw new Error("Switch only accepts SwitchCase as children");if(e.filter(function(t){return t.default}).length>1)throw new Error("Too many default switch cases only 0 or 1 allowed");return t.state.unique().map(function(t){return function(t,e){var n,o,r;return null!==(o=null===(n=e.find(function(e){return e.value===t}))||void 0===n?void 0:n.content)&&void 0!==o?o:null===(r=e.find(function(t){return t.default}))||void 0===r?void 0:r.content}(t,e)})},exports.SwitchCase=function(t,e){var n;return(n={})[qt]=!0,n.content=e,n.default=!1,n.value=t.when,n},exports.DefaultSwitchCase=function(t,e){var n;return(n={})[qt]=!0,n.content=e,n.default=!0,n.value=void 0,n},exports.aurumElementModelIdentitiy=l,exports.buildRenderableFromModel=f,exports.AurumElement=v,exports.AurumFragment=y; | ||
var t=function(){this.subscribeChannel=[],this.onAfterFire=[]},e={subscriptions:{configurable:!0}};e.subscriptions.get=function(){return this.subscribeChannel.length},t.prototype.subscribe=function(t,e){return this.createSubscription(t,this.subscribeChannel,e).facade},t.prototype.hasSubscriptions=function(){return this.subscriptions>0},t.prototype.cancelAll=function(){var t=this;this.isFiring?this.onAfterFire.push(function(){return t.subscribeChannel.length=0}):this.subscribeChannel.length=0},t.prototype.fireFiltered=function(t,e){this.isFiring=!0;for(var n=this.subscribeChannel.length,o=0;o<n;o++)this.subscribeChannel[o].callback!==e&&this.subscribeChannel[o].callback(t);this.isFiring=!1,this.afterFire()},t.prototype.afterFire=function(){this.onAfterFire.length>0&&(this.onAfterFire.forEach(function(t){return t()}),this.onAfterFire.length=0)},t.prototype.fire=function(t){this.isFiring=!0;for(var e=this.subscribeChannel.length,n=0;n<e;n++)this.subscribeChannel[n].callback(t);this.isFiring=!1,this.afterFire()},t.prototype.createSubscription=function(t,e,n){var o=this,r={callback:t},i={cancel:function(){o.cancel(r,e)}};return void 0!==n&&n.addCancelable(function(){return o.cancel(r,e)}),e.push(r),{subscription:r,facade:i}},t.prototype.cancel=function(t,e){var n=this,o=e.indexOf(t);o>=0&&(this.isFiring?this.onAfterFire.push(function(){return n.cancel(t,e)}):e.splice(o,1))},Object.defineProperties(t.prototype,e);var n=function(e){this.value=e,this.updateEvent=new t};n.prototype.update=function(t){if(this.updating)throw new Error("Problem in datas source: Unstable value propagation, when updating a value the stream was updated back as a direct response. This can lead to infinite loops and is therefore not allowed");this.updating=!0,this.value=t,this.updateEvent.fire(t),this.updating=!1},n.prototype.listenAndRepeat=function(t,e){return t(this.value),this.listen(t,e)},n.prototype.listen=function(t,e){return this.updateEvent.subscribe(t,e).cancel},n.prototype.filter=function(t,e){var o=new n;return this.listen(function(e){t(e,o.value)&&o.update(e)},e),o},n.prototype.max=function(t){return this.filter(function(t,e){return"string"==typeof t&&"string"==typeof e?t.localeCompare(e)>0:t>e})},n.prototype.min=function(t){return this.filter(function(t,e){return"string"==typeof t&&"string"==typeof e?t.localeCompare(e)<0:t<e})},n.prototype.pipe=function(t,e){this.listen(function(e){return t.update(e)},e)},n.prototype.map=function(t,e){var o=new n(t(this.value));return this.listen(function(e){o.update(t(e))},e),o},n.prototype.await=function(t){var e=new n;return this.listen(function(t){try{var n=e.update;return Promise.resolve(t).then(function(t){n.call(e,t)})}catch(t){return Promise.reject(t)}},t),e},n.prototype.unique=function(t){var e=new n(this.value);return this.listen(function(t){t!==e.value&&e.update(t)},t),e},n.prototype.reduce=function(t,e,o){var r=new n(e);return this.listen(function(e){return r.update(t(r.value,e))},o),r},n.prototype.aggregate=function(t,e,o){var r=this,i=new n(e(this.value,t.value));return this.listen(function(){return i.update(e(r.value,t.value))},o),t.listen(function(){return i.update(e(r.value,t.value))},o),i},n.prototype.stringJoin=function(t,e){var o=new n("");return this.listen(function(e){return o.update(o.value+t+e.toString())},e),o},n.prototype.combine=function(t,e){var o=new n;return this.pipe(o,e),t.pipe(o,e),o},n.prototype.debounce=function(t,e){var o,r=new n(this.value);return this.listen(function(e){clearTimeout(o),o=setTimeout(function(){r.update(e)},t)},e),r},n.prototype.throttle=function(t,e){var o=new n(this.value),r=!1;return this.listen(function(e){r||(o.update(e),r=!0,setTimeout(function(){r=!1},t))},e),o},n.prototype.buffer=function(t,e){var o,r=new n,i=[];return this.listen(function(e){i.push(e),o||(o=setTimeout(function(){o=void 0,r.update(i),i=[]},t))},e),r},n.prototype.accumulate=function(t){var e=new o;return this.listen(function(t){e.push(t)},t),e},n.prototype.pick=function(t,e){var o,r=new n(null===(o=this.value)||void 0===o?void 0:o[t]);return this.listen(function(e){r.update(null!=e?e[t]:e)},e),r},n.prototype.cancelAll=function(){this.updateEvent.cancelAll()};var o=function(e){this.data=e?e.slice():[],this.lengthSource=new n(this.data.length).unique(),this.updateEvent=new t},r={length:{configurable:!0}};o.prototype.listenAndRepeat=function(t,e){return t({operation:"add",operationDetailed:"append",index:0,items:this.data,newState:this.data,count:this.data.length}),this.listen(t,e)},o.prototype.listen=function(t,e){return this.updateEvent.subscribe(t,e).cancel},r.length.get=function(){return this.lengthSource},o.prototype.getData=function(){return this.data.slice()},o.prototype.get=function(t){return this.data[t]},o.prototype.set=function(t,e){var n=this.data[t];n!==e&&(this.data[t]=e,this.update({operation:"replace",operationDetailed:"replace",target:n,count:1,index:t,items:[e],newState:this.data}),this.lengthSource.update(this.data.length))},o.prototype.swap=function(t,e){if(t!==e){var n=this.data[t],o=this.data[e];this.data[e]=n,this.data[t]=o,this.update({operation:"swap",operationDetailed:"swap",index:t,index2:e,items:[n,o],newState:this.data}),this.lengthSource.update(this.data.length)}},o.prototype.swapItems=function(t,e){if(t!==e){var n=this.data.indexOf(t),o=this.data.indexOf(e);-1!==n&&-1!==o&&(this.data[o]=t,this.data[n]=e),this.update({operation:"swap",operationDetailed:"swap",index:n,index2:o,items:[t,e],newState:this.data}),this.lengthSource.update(this.data.length)}},o.prototype.appendArray=function(t){var e=this.data;this.data=new Array(e.length);var n=0;for(n=0;n<e.length;n++)this.data[n]=e[n];for(var o=0;o<t.length;o++)this.data[n+o]=t[o];this.update({operation:"add",operationDetailed:"append",count:t.length,index:this.data.length-t.length,items:t,newState:this.data}),this.lengthSource.update(this.data.length)},o.prototype.push=function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];this.appendArray(t),this.lengthSource.update(this.data.length)},o.prototype.unshift=function(){for(var t,e=[],n=arguments.length;n--;)e[n]=arguments[n];(t=this.data).unshift.apply(t,e),this.update({operation:"add",operationDetailed:"prepend",count:e.length,items:e,index:0,newState:this.data}),this.lengthSource.update(this.data.length)},o.prototype.pop=function(){var t=this.data.pop();return this.update({operation:"remove",operationDetailed:"removeRight",count:1,index:this.data.length,items:[t],newState:this.data}),this.lengthSource.update(this.data.length),t},o.prototype.merge=function(t){for(var e=0;e<t.length;e++)this.data[e]!==t[e]&&(this.data.length>e?this.set(e,t[e]):this.push(t[e]));this.data.length>t.length&&this.removeRight(this.data.length-t.length),this.lengthSource.update(this.data.length)},o.prototype.removeRight=function(t){var e=this.data.length,n=this.data.splice(e-t,t);this.update({operation:"remove",operationDetailed:"removeRight",count:t,index:e-t,items:n,newState:this.data}),this.lengthSource.update(this.data.length)},o.prototype.removeLeft=function(t){var e=this.data.splice(0,t);this.update({operation:"remove",operationDetailed:"removeLeft",count:t,index:0,items:e,newState:this.data}),this.lengthSource.update(this.data.length)},o.prototype.remove=function(t){var e=this.data.indexOf(t);-1!==e&&(this.data.splice(e,1),this.update({operation:"remove",operationDetailed:"remove",count:1,index:e,items:[t],newState:this.data}),this.lengthSource.update(this.data.length))},o.prototype.clear=function(){var t=this.data;this.data=[],this.update({operation:"remove",operationDetailed:"clear",count:t.length,index:0,items:t,newState:this.data}),this.lengthSource.update(this.data.length)},o.prototype.shift=function(){var t=this.data.shift();return this.update({operation:"remove",operationDetailed:"removeLeft",items:[t],count:1,index:0,newState:this.data}),this.lengthSource.update(this.data.length),t},o.prototype.toArray=function(){return this.data.slice()},o.prototype.sort=function(t,e){return new a(this,t,e)},o.prototype.map=function(t,e){return new i(this,t,e)},o.prototype.filter=function(t,e,n){void 0===e&&(e=[]);var o=new s(this,t,n);return e.forEach(function(t){t.unique().listen(function(){return o.refresh()})}),o},o.prototype.forEach=function(t){return this.data.forEach(t)},o.prototype.update=function(t){this.updateEvent.fire(t)},Object.defineProperties(o.prototype,r);var i=function(t){function e(e,n,o){var r=this,i=e.getData().map(n);t.call(this,i),this.mapper=n,e.listen(function(t){var e;switch(t.operationDetailed){case"removeLeft":r.removeLeft(t.count);break;case"removeRight":r.removeRight(t.count);break;case"remove":r.remove(r.data[t.index]);break;case"clear":r.clear();break;case"prepend":(e=r).unshift.apply(e,t.items.map(r.mapper));break;case"append":r.appendArray(t.items.map(r.mapper));break;case"swap":r.swap(t.index,t.index2);break;case"replace":r.set(t.index,r.mapper(t.items[0]))}},o)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(o),a=function(t){function e(e,n,o){var r=this,i=e.getData().sort(n);t.call(this,i),this.comparator=n,e.listen(function(t){var e,n;switch(t.operationDetailed){case"removeLeft":r.removeLeft(t.count);break;case"removeRight":r.removeRight(t.count);break;case"remove":r.remove(t.items[0]);break;case"clear":r.data.length=0;break;case"prepend":(e=r).unshift.apply(e,t.items),r.data.sort(r.comparator);break;case"append":(n=r).push.apply(n,t.items),r.data.sort(r.comparator);break;case"swap":break;case"replace":r.set(t.index,t.items[0]),r.data.sort(r.comparator)}},o)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(o),s=function(t){function e(e,n,o){var r=this;Array.isArray(e)&&(e=new t(e));var i=e.data.filter(n=null!=n?n:function(){return!0});t.call(this,i),this.parent=e,this.viewFilter=n,e.listen(function(t){var e,n,o;switch(t.operationDetailed){case"clear":r.clear();break;case"removeLeft":case"removeRight":case"remove":for(var i=0,a=t.items;i<a.length;i+=1)r.remove(a[i]);break;case"prepend":o=t.items.filter(r.viewFilter),(e=r).unshift.apply(e,o);break;case"append":o=t.items.filter(r.viewFilter),(n=r).push.apply(n,o);break;case"swap":var s=r.data.indexOf(t.items[0]),c=r.data.indexOf(t.items[1]);-1!==s&&-1!==c&&r.swap(s,c);break;case"replace":var u=r.data.indexOf(t.target);-1!==u&&(r.viewFilter(t.items[0])?r.set(u,t.items[0]):r.remove(t.target))}},o)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.updateFilter=function(t){if(this.viewFilter!==t)return this.viewFilter=t,this.refresh(),this.data.length},e.prototype.refresh=function(){var t;this.clear();var e=this.parent.data.filter(this.viewFilter);(t=this).push.apply(t,e)},e}(o),c=function(e){e&&(this.data=e),this.updateEvent=new t,this.updateEventOnKey=new Map};c.prototype.pick=function(t,e){var o,r=new n(null===(o=this.data)||void 0===o?void 0:o[t]);return this.listenOnKey(t,function(t){r.update(t.newValue)},e),r},c.prototype.listen=function(t,e){return this.updateEvent.subscribe(t,e).cancel},c.prototype.listenOnKeyAndRepeat=function(t,e,n){return e({key:t,newValue:this.data[t],oldValue:void 0}),this.listenOnKey(t,e,n)},c.prototype.listenOnKey=function(e,n,o){return this.updateEventOnKey.has(e)||this.updateEventOnKey.set(e,new t),this.updateEventOnKey.get(e).subscribe(n,o).cancel},c.prototype.get=function(t){return this.data[t]},c.prototype.set=function(t,e){if(this.data[t]!==e){var n=this.data[t];this.data[t]=e,this.updateEvent.fire({oldValue:n,key:t,newValue:this.data[t]}),this.updateEventOnKey.has(t)&&this.updateEventOnKey.get(t).fire({oldValue:n,key:t,newValue:this.data[t]})}},c.prototype.assign=function(t){for(var e=0,n=Object.keys(t);e<n.length;e+=1){var o=n[e];this.set(o,t[o])}},c.prototype.toObject=function(){return Object.assign({},this.data)},c.prototype.toDataSource=function(){var t=this,e=new n(this.data);return this.listen(function(n){e.update(t.data)}),e};var u,p=Symbol("owner"),l=function(t){var e=this;this.node=this.create(t),t instanceof n&&t.listen(function(t){e.node&&(e.node.textContent=t)})};l.prototype.resolveStringSource=function(t){return"string"==typeof t?t:t.value},l.prototype.create=function(t){var e=document.createTextNode(this.resolveStringSource(t));return e[p]=this,e},l.prototype.remove=function(){this.hasParent()&&this.node.parentElement[p].removeChild(this.node)},l.prototype.hasParent=function(){return!!this.node.parentElement},function(t){t[t.UPSTREAM=0]="UPSTREAM",t[t.DOWNSTREAM=1]="DOWNSTREAM"}(u||(u={}));var h=function(e){this.value=e,this.updateDownstreamEvent=new t,this.updateUpstreamEvent=new t};h.prototype.updateDownstream=function(t){if(this.updating)throw new Error("Problem in datas source: Unstable value propagation, when updating a value the stream was updated back as a direct response. This can lead to infinite loops and is therefore not allowed");this.updating=!0,this.value=t,this.updateDownstreamEvent.fire(t),this.updating=!1},h.prototype.updateUpstream=function(t){if(this.updating)throw new Error("Problem in datas source: Unstable value propagation, when updating a value the stream was updated back as a direct response. This can lead to infinite loops and is therefore not allowed");this.updating=!0,this.value=t,this.updateUpstreamEvent.fire(t),this.updating=!1},h.prototype.listenAndRepeat=function(t,e){return t(this.value),this.listen(t,e)},h.prototype.listen=function(t,e){return this.updateDownstreamEvent.subscribe(t,e),this.updateUpstreamEvent.subscribe(t,e).cancel},h.prototype.listenUpstream=function(t,e){return this.updateUpstreamEvent.subscribe(t,e).cancel},h.prototype.listenDownstream=function(t,e){return this.updateDownstreamEvent.subscribe(t,e).cancel},h.prototype.filter=function(t,e,n){var o=this;e||(e=t);var r=new h;return this.listenDownstream(function(e){t(e)&&r.updateDownstream(e)},n),r.listenUpstream(function(n){(null!=e?e:t)(n)&&o.updateUpstream(n)},n),r},h.prototype.pipe=function(t,e){var n=this;this.listenDownstream(function(e){return t.updateDownstream(e)},e),t.listenUpstream(function(t){return n.updateUpstream(t)},e)},h.prototype.map=function(t,e,n){var o=this,r=new h(t(this.value));return this.listenDownstream(function(e){return r.updateDownstream(t(e))},n),r.listenUpstream(function(t){return o.updateUpstream(e(t))},n),r},h.prototype.unique=function(t){var e=this,n=new h(this.value);return this.listenDownstream(function(t){n.value!==t&&n.updateDownstream(t)},t),n.listenUpstream(function(t){e.value!==t&&e.updateUpstream(t)},t),n},h.prototype.oneWayFlow=function(t,e){var n=this;void 0===t&&(t=u.DOWNSTREAM);var o=new h(this.value);return t===u.DOWNSTREAM?(this.listenDownstream(function(t){return o.updateDownstream(t)},e),o.updateUpstream=function(){}):(o.listenUpstream(function(t){return n.updateUpstream(t)}),o.updateDownstream=function(){}),o},h.prototype.cancelAll=function(){this.updateDownstreamEvent.cancelAll(),this.updateUpstreamEvent.cancelAll()};var d=Symbol("AurumElementModel"),f={drag:"onDrag",dragstart:"onDragStart",dragend:"onDragEnd",dragexit:"onDragExit",dragover:"onDragOver",dragenter:"onDragEnter",dragleave:"onDragLeave",blur:"onBlur",focus:"onFocus",click:"onClick",dblclick:"onDblClick",keydown:"onKeyDown",keyhit:"onKeyHit",keyup:"onKeyUp",mousedown:"onMouseDown",mouseup:"onMouseUp",mousemove:"onMouseMove",mouseenter:"onMouseEnter",mouseleave:"onMouseLeave",mousewheel:"onMouseWheel",load:"onLoad",error:"onError"},v=["id","name","draggable","tabindex","style","role","contentEditable"];function y(t){return t&&t[d]?y(t.constructor(t.props,t.innerNodes)):t}var m=function(t,e,n){var o,r;this.node=this.create(n),this.children=[],null!=t&&(t.onAttach&&(this.onAttach=t.onAttach,this.needAttach=!0),this.onDetach=t.onDetach,this.initialize(t),null===(r=(o=t).onCreate)||void 0===r||r.call(o,this.node)),e&&this.addChildren(e)};m.prototype.initialize=function(t){this.createEventHandlers(f,t);var e=Object.keys(t).filter(function(t){return t.includes("-")});this.bindProps(v,t,e),t.class&&this.handleClass(t.class)},m.prototype.bindProps=function(t,e,n){for(var o=0,r=t;o<r.length;o+=1){var i=r[o];e[i]&&this.assignStringSourceToAttribute(e[i],i)}if(n)for(var a=0,s=n;a<s.length;a+=1){var c=s[a];e[c]&&this.assignStringSourceToAttribute(e[c],c)}},m.prototype.createEventHandlers=function(t,e){var o=this,r=function(r){e[t[r]]&&(e[t[r]]instanceof n?o.node.addEventListener(r,function(n){return e[t[r]].update(n)}):e[t[r]]instanceof h?o.node.addEventListener(r,function(n){return e[t[r]].updateDownstream(n)}):"function"==typeof e[t[r]]&&o.node.addEventListener(r,function(n){return e[t[r]](n)}))};for(var i in t)r(i)},m.prototype.render=function(){for(var t=0,e=0;e<this.children.length;e++,t++)this.children[e]instanceof b?t=this.renderFragment(this.children[e],t):this.renderChild(this.children[e],t);for(;this.node.childNodes.length>t;)this.node.removeChild(this.node.childNodes[this.node.childNodes.length-1])},m.prototype.renderFragment=function(t,e){for(var n=0;n<t.children.length;n++,e++)t.children[n]instanceof b?e=this.renderFragment(t.children[n],e):this.renderChild(t.children[n],e);return--e},m.prototype.renderChild=function(t,e){if(this.node.childNodes.length<=e)return this.addChildDom(t);if(this.node.childNodes[e][p]!==t){var n=this.getChildIndex(t.node);-1!==n?this.swapChildrenDom(e,n):this.addDomNodeAt(t.node,e)}},m.prototype.assignStringSourceToAttribute=function(t,e){var n=this;"string"==typeof t||"boolean"==typeof t?"boolean"==typeof t?t?this.node.setAttribute(e,""):this.node.removeAttribute(e):this.node.setAttribute(e,t):t.unique().listenAndRepeat(function(t){"boolean"==typeof t?t?n.node.setAttribute(e,""):n.node.removeAttribute(e):n.node.setAttribute(e,t)})},m.prototype.handleAttach=function(t){var e,n,o,r;if(this.needAttach)if(t.isConnected()){null===(e=this.onAttach)||void 0===e||e.call(this,this.node);for(var i=0,a=this.node.childNodes;i<a.length;i+=1)null===(r=null===(n=a[i][p])||void 0===n?void 0:(o=n).handleAttach)||void 0===r||r.call(o,this)}else t.needAttach=!0},m.prototype.handleDetach=function(){var t,e,n;if(!this.node.isConnected){null===(t=this.onDetach)||void 0===t||t.call(this,this.node);for(var o=0,r=this.node.childNodes;o<r.length;o+=1){var i=r[o];i[p]&&(null===(n=(e=i[p]).handleDetach)||void 0===n||n.call(e))}}},m.prototype.handleClass=function(t){var e=this;if("string"==typeof t)this.node.className=t;else if(t instanceof n)t.value&&(Array.isArray(t.value)?(this.node.className=t.value.join(" "),t.unique().listen(function(){e.node.className=t.value.join(" ")})):(this.node.className=t.value,t.unique().listen(function(){e.node.className=t.value}))),t.unique().listen(function(t){return e.node.className=t});else{var o=t.reduce(function(t,e){return"string"==typeof e?t+" "+e:e.value?t+" "+e.value:t},"");this.node.className=o;for(var r=0,i=t;r<i.length;r+=1){var a=i[r];a instanceof n&&a.unique().listen(function(n){var o=t.reduce(function(t,e){return"string"==typeof e?t+" "+e:e.value?t+" "+e.value:t},"");e.node.className=o})}}},m.prototype.create=function(t){var e=document.createElement(t);return e[p]=this,e},m.prototype.getChildIndex=function(t){for(var e=0,n=0,o=this.node.childNodes;n<o.length;n+=1){if(o[n]===t)return e;e++}return-1},m.prototype.hasChild=function(t){for(var e=0,n=t.children;e<n.length;e+=1)if(n[e]===t)return!0;return!1},m.prototype.addChildDom=function(t){var e,n;this.node.appendChild(t.node),null===(n=(e=t).handleAttach)||void 0===n||n.call(e,this)},m.prototype.swapChildrenDom=function(t,e){if(t!==e){var n=this.node.children[t],o=this.node.children[e];n.remove(),o.remove(),t<e?(this.addDomNodeAt(o,t),this.addDomNodeAt(n,e)):(this.addDomNodeAt(n,e),this.addDomNodeAt(o,t))}},m.prototype.addDomNodeAt=function(t,e){var n,o,r,i;e>=this.node.childElementCount?(this.node.appendChild(t),null===(o=(n=t[p]).handleAttach)||void 0===o||o.call(n,this)):(this.node.insertBefore(t,this.node.children[e]),null===(i=(r=t[p]).handleAttach)||void 0===i||i.call(r,this))},m.prototype.remove=function(){this.hasParent()&&this.node.parentElement[p].removeChild(this.node)},m.prototype.hasParent=function(){return!!this.node.parentElement},m.prototype.isConnected=function(){return this.node.isConnected},m.prototype.removeChild=function(t){var e=this.children.indexOf(t);-1!==e&&this.children.splice(e,1),this.render()},m.prototype.removeChildAt=function(t){this.children.splice(t,1),this.render()},m.prototype.swapChildren=function(t,e){if(t!==e){var n=this.children[t];this.children[t]=this.children[e],this.children[e]=n,this.render()}},m.prototype.clearChildren=function(){this.children.length=0,this.render()},m.prototype.addChild=function(t){if(null!=t&&(!t[d]||void 0!==(t=y(t))))if(Array.isArray(t))for(var e=0,n=t;e<n.length;e+=1)this.addChild(n[e]);else this.children.push(this.childNodeToAurum(t)),this.render()},m.prototype.childNodeToAurum=function(t){var e=this;if(t instanceof m)return t;if(t instanceof Promise){var r=new b({});return t.then(function(t){r.addChildren([t]),e.render()}),r}if(t instanceof o){var i=new b({repeatModel:t});return i.onChange.subscribe(function(){return e.render()}),i}if("string"==typeof t||"number"==typeof t||"boolean"==typeof t||"bigint"==typeof t)return new l(t.toString());if(t instanceof n){var a=new b({},[t]);return a.onChange.subscribe(function(){return e.render()}),a}throw new Error("Unsupported child type")},m.prototype.addChildAt=function(t,e){this.children.splice(e,0,this.childNodeToAurum(t)),this.render()},m.prototype.addChildren=function(t){if(0!==t.length)for(var e=0,n=t;e<n.length;e+=1)this.addChild(n[e])};var b=function(e,n){this.onChange=new t,this.children=[],e.repeatModel?this.handleRepeat(e.repeatModel):n&&this.addChildren(n)};b.prototype.addChildren=function(t){for(var e=this,o=function(){var t=i[r],o=void 0;if((o=t[d]?y(t):t)instanceof m)e.children.push(o);else{if(!(o instanceof n))throw new Error("case not yet implemented");var a=void 0,s=void 0,c={ts:void 0};o.unique().listenAndRepeat(function(t){if(c.ts=Date.now(),null==t&&s)return e.children.length=0,e.onChange.fire(),void(s=!1);if(!Array.isArray(t)&&s&&(e.children.length=0,e.onChange.fire(),s=!1),Array.isArray(t)){s=!0,e.children.length=0,e.onChange.fire();for(var n=0,r=t;n<r.length;n+=1)e.handleSourceChild(r[n],void 0,void 0,c,c.ts)}else a=e.handleSourceChild(t,a,o,c,c.ts)})}},r=0,i=t;r<i.length;r+=1)o()},b.prototype.handleSourceChild=function(t,e,r,i,a){var s=this;if(null!=t){if(t[d]&&(t=y(t)),"string"==typeof t||"bigint"==typeof t||"number"==typeof t||"boolean"==typeof t)if(e){if(e instanceof m){var c=new l(null!=r?r:t);this.children.splice(this.children.indexOf(e),1,c),e=c,this.onChange.fire()}}else{var u=new l(null!=r?r:t);this.children.push(u),e=u,this.onChange.fire()}else if(t instanceof m)t!==e&&(e?this.children.splice(this.children.indexOf(e),1,t):this.children.push(t),e=t,this.onChange.fire());else if(t instanceof Promise)t.then(function(t){i.ts===a&&(s.addChildren([t]),s.onChange.fire())});else if(t instanceof n)if(e){if(e!==t){var p=new b({},[t]);p.onChange.subscribe(function(){return s.onChange.fire()}),this.children.splice(this.children.indexOf(e),1,p),e=p,this.onChange.fire()}}else{var h=new b({},[t]);e=h,this.children.push(h),h.onChange.subscribe(function(){return s.onChange.fire()}),this.onChange.fire()}else if(t instanceof o)if(e){if(e!==t){var f=new b({repeatModel:t});f.onChange.subscribe(function(){return s.onChange.fire()}),this.children.splice(this.children.indexOf(e),1,f),e=f,this.onChange.fire()}}else{var v=new b({repeatModel:t});e=v,this.children.push(v),v.onChange.subscribe(function(){return s.onChange.fire()}),this.onChange.fire()}return e}e&&(this.children.splice(this.children.indexOf(e),1),e=void 0,this.onChange.fire())},b.prototype.handleRepeat=function(t){var e=this;t.listenAndRepeat(function(t){var n;switch(t.operationDetailed){case"replace":e.children[t.index]=y(t.items[0]);break;case"swap":var o=e.children[t.index2];e.children[t.index2]=e.children[t.index],e.children[t.index]=o;break;case"append":e.children=e.children.concat(t.items.map(y));break;case"prepend":(n=e.children).unshift.apply(n,t.items.map(y));break;case"remove":case"removeLeft":case"removeRight":e.children.splice(t.index,t.count);break;case"clear":e.children=[];break;default:throw new Error("unhandled operation")}e.onChange.fire()})};var _=function(t){function e(e,n){t.call(this,e,n,"div")}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(m),g=function(t){function e(e,n){t.call(this,e,n,"button"),null!==e&&this.bindProps(["disabled"],e)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(m),w={input:"onInput",change:"onChange"},C=["placeholder","readonly","disabled","accept","alt","autocomplete","autofocus","checked","defaultChecked","formAction","formEnctype","formMethod","formNoValidate","formTarget","max","maxLength","min","minLength","pattern","multiple","required","type"],x=function(t){function e(e,n){var o,r=this;t.call(this,e,n,"input"),null!==e&&(e.inputValueSource?e.inputValueSource.unique().listenAndRepeat(function(t){return r.node.value=t}):this.node.value=null!=(o=e.initialValue)?o:"",this.bindProps(C,e),this.createEventHandlers(w,e),e.inputValueSource&&this.node.addEventListener("input",function(){e.inputValueSource.update(r.node.value)}))}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(m),O=function(t){function e(e,n){t.call(this,e,n,"li")}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(m),A=function(t){function e(e,n){t.call(this,e,n,"span")}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(m),S=function(t){function e(e,n){t.call(this,e,n,"style"),null!==e&&this.bindProps(["media"],e)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(m),E=function(t){function e(e,n){t.call(this,e,n,"audio"),null!==e&&this.bindProps(["controls","autoplay","loop","muted","preload","src"],e)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(m),j=function(t){function e(e,n){t.call(this,e,n,"ul")}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(m),D=function(t){function e(e,n){t.call(this,e,n,"p")}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(m),N=function(t){function e(e,n){t.call(this,e,n,"img"),null!==e&&this.bindProps(["src","alt","width","height","referrerPolicy","sizes","srcset","useMap"],e)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(m),k=function(t){function e(e,n){t.call(this,e,n,"link"),null!==e&&this.bindProps(["href","rel","media","as","disabled","type"],e)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(m),P=function(t){function e(e,n){t.call(this,e,n,"canvas"),null!==e&&this.bindProps(["width","height"],e)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(m),F=function(t){function e(e,n){t.call(this,e,n,"a"),null!==e&&this.bindProps(["href","target"],e)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(m),R=function(t){function e(e,n){t.call(this,e,n,"article")}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(m),T=function(t){function e(e,n){t.call(this,e,n,"br")}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(m),I=function(t){function e(e,n){t.call(this,e,n,"form")}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(m),L=function(t){function e(e,n){t.call(this,e,n,"label"),null!==e&&this.bindProps(["for"],e)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(m),M=function(t){function e(e,n){t.call(this,e,n,"ol")}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(m),U=function(t){function e(e,n){t.call(this,e,n,"pre")}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(m),q=function(t){function e(e,n){t.call(this,e,n,"progress"),null!==e&&this.bindProps(["max","value"],e)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(m),V=function(t){function e(e,n){t.call(this,e,n,"table")}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(m),K=function(t){function e(e,n){t.call(this,e,n,"td")}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(m),H=function(t){function e(e,n){t.call(this,e,n,"tr")}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(m),W=function(t){function e(e,n){t.call(this,e,n,"th")}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(m),z={input:"onInput",change:"onChange"},B=["placeholder","readonly","disabled","rows","wrap","autocomplete","autofocus","max","maxLength","min","minLength","required","type"],J=function(t){function e(e,n){var o,r,i,a=this;t.call(this,e,n,"textArea"),null!==e&&(e.inputValueSource?(this.node.value=null!=(r=null!=(o=e.initialValue)?o:e.inputValueSource.value)?r:"",e.inputValueSource.unique().listen(function(t){return a.node.value=t})):this.node.value=null!=(i=e.initialValue)?i:"",this.bindProps(B,e),this.createEventHandlers(z,e),e.inputValueSource&&this.node.addEventListener("input",function(){e.inputValueSource.update(a.node.value)}))}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(m),G=function(t){function e(e,n){t.call(this,e,n,"h1")}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(m),Q=function(t){function e(e,n){t.call(this,e,n,"h2")}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(m),X=function(t){function e(e,n){t.call(this,e,n,"h3")}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(m),Y=function(t){function e(e,n){t.call(this,e,n,"h4")}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(m),Z=function(t){function e(e,n){t.call(this,e,n,"h5")}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(m),$=function(t){function e(e,n){t.call(this,e,n,"h6")}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(m),tt=function(t){function e(e,n){t.call(this,e,n,"header")}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(m),et=function(t){function e(e,n){t.call(this,e,n,"footer")}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(m),nt=function(t){function e(e,n){t.call(this,e,n,"nav")}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(m),ot=function(t){function e(e,n){t.call(this,e,n,"b")}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(m),rt=function(t){function e(e,n){t.call(this,e,n,"i")}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(m),it=function(t){function e(e,n){t.call(this,e,n,"script"),null!==e&&this.bindProps(["src","async","defer","integrity","noModule","type"],e)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(m),at=function(t){function e(e,n){t.call(this,e,n,"abbr")}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(m),st=function(t){function e(e,n){t.call(this,e,n,"area")}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(m),ct=function(t){function e(e,n){t.call(this,e,n,"aside")}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(m),ut=function(t){function e(e,n){t.call(this,e,n,"em")}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(m),pt=function(t){function e(e,n){t.call(this,e,n,"heading")}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(m),lt=function(t){function e(e,n){t.call(this,e,n,"iframe"),null!==e&&this.bindProps(["src","srcdoc","width","height","allow","allowFullscreen","allowPaymentRequest"],e)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(m),ht=function(t){function e(e,n){t.call(this,e,n,"noscript")}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(m),dt=function(t){function e(e,n){t.call(this,e,n,"q")}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(m),ft={change:"onChange"},vt=function(t){function e(e,n){var o,r=this;t.call(this,e,n,"select"),null!==e&&(this.createEventHandlers(ft,e),this.initialSelection=e.initialSelection,e.selectedIndexSource?(this.selectedIndexSource=e.selectedIndexSource,e.selectedIndexSource.unique().listenAndRepeat(function(t){return r.node.selectedIndex=t})):this.node.selectedIndex=null!=(o=e.initialSelection)?o:-1,e.selectedIndexSource&&(this.needAttach=!0,this.node.addEventListener("change",function(){e.selectedIndexSource.update(r.node.selectedIndex)})))}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.handleAttach=function(e){t.prototype.handleAttach.call(this,e),this.node.isConnected&&(this.selectedIndexSource?this.node.selectedIndex=this.selectedIndexSource.value:void 0!==this.initialSelection&&(this.node.selectedIndex=this.initialSelection))},e}(m),yt=function(t){function e(e,n){t.call(this,e,n,"source"),null!==e&&this.bindProps(["src","srcSet","media","sizes","type"],e)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(m),mt=function(t){function e(e,n){t.call(this,e,n,"title")}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(m),bt=function(t){function e(e,n){t.call(this,e,n,"video"),null!==e&&this.bindProps(["controls","autoplay","loop","muted","preload","src","poster","width","height"],e)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(m),_t=function(t){function e(e,n){t.call(this,e,n,"tbody")}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(m),gt=function(t){function e(e,n){t.call(this,e,n,"tfoot")}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(m),wt=function(t){function e(e,n){t.call(this,e,n,"thead")}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(m),Ct=function(t){function e(e,n){t.call(this,e,n,"summary")}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(m),xt=function(t){function e(e,n){t.call(this,e,n,"details")}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(m),Ot=function(t){function e(e,n){t.call(this,e,n,"sub")}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(m),At=function(t){function e(e,n){t.call(this,e,n,"sup")}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(m),St=function(t){function e(e,n){t.call(this,e,n,"svg"),null!==e&&this.bindProps(["width","height"],e)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(m),Et=function(t){function e(e,n){t.call(this,e,n,"data"),null!==e&&this.bindProps(["datalue"],e)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(m),jt=function(t){function e(e,n){t.call(this,e,n,"time"),null!==e&&this.bindProps(["datetime"],e)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(m),Dt={button:g,div:_,input:x,li:O,span:A,style:S,ul:j,p:D,img:N,link:k,canvas:P,a:F,article:R,br:T,form:I,label:L,ol:M,pre:U,progress:q,table:V,td:K,tr:H,th:W,textarea:J,h1:G,h2:Q,h3:X,h4:Y,h5:Z,h6:$,header:tt,footer:et,nav:nt,b:ot,i:rt,script:it,abbr:at,area:st,aside:ct,audio:E,em:ut,heading:pt,iframe:lt,noscript:ht,option:function(t){function e(e,n){t.call(this,e,n,"option")}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(m),q:dt,select:vt,source:yt,title:mt,video:bt,tbody:_t,tfoot:gt,thead:wt,summary:Ct,details:xt,sub:Ot,sup:At,svg:St,data:Et,time:jt,template:function(t){function e(e,n){t.call(this,e,n,"template")}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(m)},Nt=function(){};Nt.attach=function(t,e){var n=y(t);if(e[p])throw new Error("This node is already managed by aurum and cannot be used");if(!(n instanceof m))throw new Error("Root node of aurum application must be a single dom node");e.appendChild(n.node),n.handleAttach(n),e[p]=n},Nt.isAttached=function(t){return void 0!==t[p]},Nt.detach=function(t){t[p]&&(t[p].node.remove(),t[p].handleDetach(),t[p]=void 0)},Nt.factory=function(t,e){for(var n,o,r=[],i=arguments.length-2;i-- >0;)r[i]=arguments[i+2];if("string"==typeof t){var a=t;if(void 0===(t=Dt[t]))throw new Error("Node "+a+" does not exist or is not supported")}return Object.getPrototypeOf(t)===m?((n={})[d]=!0,n.constructor=function(e,n){return new t(e,n)},n.props=e,n.innerNodes=r,n):((o={})[d]=!0,o.constructor=t,o.props=e,o.innerNodes=r,o)};var kt=function(t){this.data=t};kt.prototype.deleteNext=function(){if(this.next){var t=this.next.next;this.next.next=void 0,this.next.previous=void 0,this.next=t,this.next&&(this.next.previous=this)}},kt.prototype.deletePrevious=function(){if(this.previous){var t=this.previous.previous;this.previous.next=void 0,this.previous.previous=void 0,this.previous=t,this.previous&&(this.previous.next=this)}};var Pt=function(t){var e=this;void 0===t&&(t=[]),this.length=0,t.forEach(function(t){return e.append(t)})};Pt.prototype.find=function(t){for(var e=this.rootNode;e&&!t(e);)e=e.next;return e},Pt.prototype.append=function(t){return this.rootNode||this.lastNode?(this.lastNode.next=new kt(t),this.lastNode.next.previous=this.lastNode,this.lastNode=this.lastNode.next):this.rootNode=this.lastNode=new kt(t),this.length++,t},Pt.prototype.forEach=function(t){this.find(function(e){return t(e.data),!1})},Pt.prototype.prepend=function(t){return this.rootNode||this.lastNode?(this.rootNode.previous=new kt(t),this.rootNode.previous.next=this.rootNode,this.rootNode=this.rootNode.previous):this.rootNode=this.lastNode=new kt(t),this.length++,t},Pt.prototype.remove=function(t){if(t===this.rootNode.data)this.rootNode=this.rootNode===this.lastNode?this.lastNode=void 0:this.rootNode.next,this.length--;else{var e=this.find(function(e){return e.next&&e.next.data===t});e&&(e.next===this.lastNode&&(this.lastNode=e),e.deleteNext(),this.length--)}};var Ft=function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];this.cancelables=new Pt(t),this._isCancelled=!1},Rt={isCanceled:{configurable:!0}};Rt.isCanceled.get=function(){return this._isCancelled},Ft.prototype.addCancelable=function(t){return this.throwIfCancelled("attempting to add cancellable to token that is already cancelled"),this.cancelables.append(t),this.cancelables.length>200&&console.log("potential memory leak: cancellation token has over 200 clean up calls"),this},Ft.prototype.removeCancelable=function(t){return this.throwIfCancelled("attempting to remove cancellable from token that is already cancelled"),this.cancelables.remove(t),this},Ft.prototype.addDisposable=function(t){return this.addCancelable(function(){return t.dispose()}),this},Ft.prototype.callIfNotCancelled=function(t){this.isCanceled||t()},Ft.prototype.setTimeout=function(t,e){var n=this;void 0===e&&(e=0);var o=setTimeout(function(){n.removeCancelable(r),t()},e),r=function(){return clearTimeout(o)};this.addCancelable(r)},Ft.prototype.setInterval=function(t,e){var n=setInterval(t,e);this.addCancelable(function(){return clearInterval(n)})},Ft.prototype.requestAnimationFrame=function(t){var e=requestAnimationFrame(t);this.addCancelable(function(){return cancelAnimationFrame(e)})},Ft.prototype.animationLoop=function(t){var e=requestAnimationFrame(function n(o){t(o),e=requestAnimationFrame(n)});this.addCancelable(function(){return cancelAnimationFrame(e)})},Ft.prototype.throwIfCancelled=function(t){if(this.isCanceled)throw new Error(t||"cancellation token is cancelled")},Ft.prototype.chain=function(t,e){return void 0===e&&(e=!1),e&&t.chain(this,!1),this.addCancelable(function(){return t.cancel()}),this},Ft.prototype.registerDomEvent=function(t,e,n){return t.addEventListener(e,n),this.addCancelable(function(){return t.removeEventListener(e,n)}),this},Ft.prototype.cancel=function(){this.isCanceled||(this._isCancelled=!0,this.cancelables.forEach(function(t){return t()}),this.cancelables=void 0)},Object.defineProperties(Ft.prototype,Rt);var Tt=function(t){function e(e,n){t.call(this,e,n,e.tag),e.attributes&&null!==e&&this.bindProps(Object.keys(e.attributes),e.attributes)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(m),It=Symbol("route");function Lt(){var t=location.hash.substring(1);return t.includes("?")?t.substring(0,t.indexOf("?")):t.includes("#")?t.substring(0,t.indexOf("#")):t}var Mt=Symbol("switchCase");exports.DataSource=n,exports.ArrayDataSource=o,exports.MappedArrayView=i,exports.SortedArrayView=a,exports.FilteredArrayView=s,exports.ObjectDataSource=c,exports.Aurum=Nt,exports.CancellationToken=Ft,exports.Custom=Tt,exports.AurumRouter=function(t,e){if((e=e.map(y)).some(function(t){return!t[It]}))throw new Error("Aurum Router only accepts Route and DefaultRoute instances as children");if(e.filter(function(t){return t.default}).length>1)throw new Error("Too many default routes only 0 or 1 allowed");var o=new n(Lt());return window.addEventListener("hashchange",function(){o.update(Lt())}),o.unique().map(function(t){return function(t,e){var n,o;if(null==t)return null===(n=e.find(function(t){return t.default}))||void 0===n?void 0:n.content;if(e.find(function(e){return e.href===t}))return e.find(function(e){return e.href===t}).content;var r=t.split("/");r.pop();for(var i=function(){var t=r.join("/");if(e.find(function(e){return e.href===t}))return{v:e.find(function(e){return e.href===t}).content};r.pop()};r.length;){var a=i();if(a)return a.v}return null===(o=e.find(function(t){return t.default}))||void 0===o?void 0:o.content}(t,e)})},exports.Route=function(t,e){var n;return(n={})[It]=!0,n.content=e,n.default=!1,n.href=t.href,n},exports.DefaultRoute=function(t,e){var n;return(n={})[It]=!0,n.content=e,n.default=!0,n.href=void 0,n},exports.Suspense=function(t,e){var o=new n(t.fallback);return Promise.all(e.map(y)).then(function(t){o.update(t)}),o},exports.Switch=function(t,e){if((e=e.map(y)).some(function(t){return!t[Mt]}))throw new Error("Switch only accepts SwitchCase as children");if(e.filter(function(t){return t.default}).length>1)throw new Error("Too many default switch cases only 0 or 1 allowed");return t.state.unique().map(function(t){return function(t,e){var n,o,r;return null!==(o=null===(n=e.find(function(e){return e.value===t}))||void 0===n?void 0:n.content)&&void 0!==o?o:null===(r=e.find(function(t){return t.default}))||void 0===r?void 0:r.content}(t,e)})},exports.SwitchCase=function(t,e){var n;return(n={})[Mt]=!0,n.content=e,n.default=!1,n.value=t.when,n},exports.DefaultSwitchCase=function(t,e){var n;return(n={})[Mt]=!0,n.content=e,n.default=!0,n.value=void 0,n},exports.aurumElementModelIdentitiy=d,exports.buildRenderableFromModel=y,exports.AurumElement=m,exports.AurumFragment=b; | ||
//# sourceMappingURL=aurumjs.js.map |
@@ -1,2 +0,2 @@ | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e(t.aurum={})}(this,function(t){var e=function(){this.subscribeChannel=[],this.onAfterFire=[]},n={subscriptions:{configurable:!0}};n.subscriptions.get=function(){return this.subscribeChannel.length},e.prototype.subscribe=function(t,e){return this.createSubscription(t,this.subscribeChannel,e).facade},e.prototype.hasSubscriptions=function(){return this.subscriptions>0},e.prototype.cancelAll=function(){var t=this;this.isFiring?this.onAfterFire.push(function(){return t.subscribeChannel.length=0}):this.subscribeChannel.length=0},e.prototype.fireFiltered=function(t,e){this.isFiring=!0;for(var n=this.subscribeChannel.length,o=0;o<n;o++)this.subscribeChannel[o].callback!==e&&this.subscribeChannel[o].callback(t);this.isFiring=!1,this.afterFire()},e.prototype.afterFire=function(){this.onAfterFire.length>0&&(this.onAfterFire.forEach(function(t){return t()}),this.onAfterFire.length=0)},e.prototype.fire=function(t){this.isFiring=!0;for(var e=this.subscribeChannel.length,n=0;n<e;n++)this.subscribeChannel[n].callback(t);this.isFiring=!1,this.afterFire()},e.prototype.createSubscription=function(t,e,n){var o=this,r={callback:t},i={cancel:function(){o.cancel(r,e)}};return void 0!==n&&n.addCancelable(function(){return o.cancel(r,e)}),e.push(r),{subscription:r,facade:i}},e.prototype.cancel=function(t,e){var n=this,o=e.indexOf(t);o>=0&&(this.isFiring?this.onAfterFire.push(function(){return n.cancel(t,e)}):e.splice(o,1))},Object.defineProperties(e.prototype,n);var o=function(t){this.value=t,this.updateEvent=new e};o.prototype.update=function(t){if(this.updating)throw new Error("Problem in datas source: Unstable value propagation, when updating a value the stream was updated back as a direct response. This can lead to infinite loops and is therefore not allowed");this.updating=!0,this.value=t,this.updateEvent.fire(t),this.updating=!1},o.prototype.backPropagate=function(t,e){this.value=e,this.updating=!0,this.updateEvent.fireFiltered(e,t),this.updating=!1},o.prototype.listenAndRepeat=function(t,e){return t(this.value),this.listen(t,e)},o.prototype.listen=function(t,e){return this.updateEvent.subscribe(t,e).cancel},o.prototype.filter=function(t,e){var n=new o;return this.listen(function(e){t(e)&&n.update(e)},e),n},o.prototype.filterDuplex=function(t,e){var n=this,r=new o,i=function(e){t(e)&&r.backPropagate(a,e)},a=function(e){t(e)&&n.backPropagate(i,e)};return this.listen(i,e),r.listen(a,e),r},o.prototype.pipe=function(t,e){this.listen(function(e){return t.update(e)},e)},o.prototype.pipeDuplex=function(t,e){var n=this,o=function(e){return t.backPropagate(r,e)},r=function(t){return n.backPropagate(o,t)};this.listen(o,e),t.listen(r,e)},o.prototype.map=function(t,e){var n=new o(t(this.value));return this.listen(function(e){n.update(t(e))},e),n},o.prototype.mapDuplex=function(t,e,n){var r=this,i=new o(t(this.value)),a=function(e){return i.backPropagate(c,t(e))},c=function(t){return r.backPropagate(a,e(t))};return this.listen(a,n),i.listen(c,n),i},o.prototype.unique=function(t){var e=new o(this.value);return this.listen(function(t){t!==e.value&&e.update(t)},t),e},o.prototype.uniqueDuplex=function(t){var e=this,n=new o(this.value),r=function(t){t!==n.value&&n.backPropagate(i,t)},i=function(t){t!==e.value&&e.backPropagate(r,t)};return this.listen(r,t),n.listen(i,t),n},o.prototype.reduce=function(t,e,n){var r=new o(e);return this.listen(function(e){return r.update(t(r.value,e))},n),r},o.prototype.aggregate=function(t,e,n){var r=this,i=new o(e(this.value,t.value));return this.listen(function(){return i.update(e(r.value,t.value))},n),t.listen(function(){return i.update(e(r.value,t.value))},n),i},o.prototype.combine=function(t,e){var n=new o;return this.pipe(n,e),t.pipe(n,e),n},o.prototype.debounce=function(t,e){var n,r=new o(this.value);return this.listen(function(e){clearTimeout(n),n=setTimeout(function(){r.update(e)},t)},e),r},o.prototype.buffer=function(t,e){var n,r=new o,i=[];return this.listen(function(e){i.push(e),n||(n=setTimeout(function(){n=void 0,r.update(i),i=[]},t))},e),r},o.prototype.queue=function(t){var e=new r;return this.listen(function(t){e.push(t)},t),e},o.prototype.pick=function(t,e){var n,r=new o(null===(n=this.value)||void 0===n?void 0:n[t]);return this.listen(function(e){r.update(null!=e?e[t]:e)},e),r},o.prototype.cancelAll=function(){this.updateEvent.cancelAll()};var r=function(t){this.data=t?t.slice():[],this.lengthSource=new o(this.data.length).unique(),this.updateEvent=new e},i={length:{configurable:!0}};r.prototype.listenAndRepeat=function(t,e){return t({operation:"add",operationDetailed:"append",index:0,items:this.data,newState:this.data,count:this.data.length}),this.listen(t,e)},r.prototype.listen=function(t,e){return this.updateEvent.subscribe(t,e).cancel},i.length.get=function(){return this.lengthSource},r.prototype.getData=function(){return this.data.slice()},r.prototype.get=function(t){return this.data[t]},r.prototype.set=function(t,e){var n=this.data[t];n!==e&&(this.data[t]=e,this.update({operation:"replace",operationDetailed:"replace",target:n,count:1,index:t,items:[e],newState:this.data}),this.lengthSource.update(this.data.length))},r.prototype.swap=function(t,e){if(t!==e){var n=this.data[t],o=this.data[e];this.data[e]=n,this.data[t]=o,this.update({operation:"swap",operationDetailed:"swap",index:t,index2:e,items:[n,o],newState:this.data}),this.lengthSource.update(this.data.length)}},r.prototype.swapItems=function(t,e){if(t!==e){var n=this.data.indexOf(t),o=this.data.indexOf(e);-1!==n&&-1!==o&&(this.data[o]=t,this.data[n]=e),this.update({operation:"swap",operationDetailed:"swap",index:n,index2:o,items:[t,e],newState:this.data}),this.lengthSource.update(this.data.length)}},r.prototype.appendArray=function(t){var e=this.data;this.data=new Array(e.length);var n=0;for(n=0;n<e.length;n++)this.data[n]=e[n];for(var o=0;o<t.length;o++)this.data[n+o]=t[o];this.update({operation:"add",operationDetailed:"append",count:t.length,index:this.data.length-t.length,items:t,newState:this.data}),this.lengthSource.update(this.data.length)},r.prototype.push=function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];this.appendArray(t),this.lengthSource.update(this.data.length)},r.prototype.unshift=function(){for(var t,e=[],n=arguments.length;n--;)e[n]=arguments[n];(t=this.data).unshift.apply(t,e),this.update({operation:"add",operationDetailed:"prepend",count:e.length,items:e,index:0,newState:this.data}),this.lengthSource.update(this.data.length)},r.prototype.pop=function(){var t=this.data.pop();return this.update({operation:"remove",operationDetailed:"removeRight",count:1,index:this.data.length,items:[t],newState:this.data}),this.lengthSource.update(this.data.length),t},r.prototype.merge=function(t){for(var e=0;e<t.length;e++)this.data[e]!==t[e]&&(this.data.length>e?this.set(e,t[e]):this.push(t[e]));this.data.length>t.length&&this.removeRight(this.data.length-t.length),this.lengthSource.update(this.data.length)},r.prototype.removeRight=function(t){var e=this.data.length,n=this.data.splice(e-t,t);this.update({operation:"remove",operationDetailed:"removeRight",count:t,index:e-t,items:n,newState:this.data}),this.lengthSource.update(this.data.length)},r.prototype.removeLeft=function(t){var e=this.data.splice(0,t);this.update({operation:"remove",operationDetailed:"removeLeft",count:t,index:0,items:e,newState:this.data}),this.lengthSource.update(this.data.length)},r.prototype.remove=function(t){var e=this.data.indexOf(t);-1!==e&&(this.data.splice(e,1),this.update({operation:"remove",operationDetailed:"remove",count:1,index:e,items:[t],newState:this.data}),this.lengthSource.update(this.data.length))},r.prototype.clear=function(){var t=this.data;this.data=[],this.update({operation:"remove",operationDetailed:"clear",count:t.length,index:0,items:t,newState:this.data}),this.lengthSource.update(this.data.length)},r.prototype.shift=function(){var t=this.data.shift();return this.update({operation:"remove",operationDetailed:"removeLeft",items:[t],count:1,index:0,newState:this.data}),this.lengthSource.update(this.data.length),t},r.prototype.toArray=function(){return this.data.slice()},r.prototype.sort=function(t,e){return new c(this,t,e)},r.prototype.map=function(t,e){return new a(this,t,e)},r.prototype.filter=function(t,e,n){void 0===e&&(e=[]);var o=new s(this,t,n);return e.forEach(function(t){t.unique().listen(function(){return o.refresh()})}),o},r.prototype.forEach=function(t){return this.data.forEach(t)},r.prototype.toDataSource=function(){var t=new o(this.data);return this.listen(function(e){t.update(e.newState)}),t},r.prototype.update=function(t){this.updateEvent.fire(t)},Object.defineProperties(r.prototype,i);var a=function(t){function e(e,n,o){var r=this,i=e.getData().map(n);t.call(this,i),this.mapper=n,e.listen(function(t){var e;switch(t.operationDetailed){case"removeLeft":r.removeLeft(t.count);break;case"removeRight":r.removeRight(t.count);break;case"remove":r.remove(r.data[t.index]);break;case"clear":r.clear();break;case"prepend":(e=r).unshift.apply(e,t.items.map(r.mapper));break;case"append":r.appendArray(t.items.map(r.mapper));break;case"swap":r.swap(t.index,t.index2);break;case"replace":r.set(t.index,r.mapper(t.items[0]))}},o)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(r),c=function(t){function e(e,n,o){var r=this,i=e.getData().sort(n);t.call(this,i),this.comparator=n,e.listen(function(t){var e,n;switch(t.operationDetailed){case"removeLeft":r.removeLeft(t.count);break;case"removeRight":r.removeRight(t.count);break;case"remove":r.remove(t.items[0]);break;case"clear":r.data.length=0;break;case"prepend":(e=r).unshift.apply(e,t.items),r.data.sort(r.comparator);break;case"append":(n=r).push.apply(n,t.items),r.data.sort(r.comparator);break;case"swap":break;case"replace":r.set(t.index,t.items[0]),r.data.sort(r.comparator)}},o)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(r),s=function(t){function e(e,n,o){var r=this;Array.isArray(e)&&(e=new t(e));var i=e.data.filter(n=null!=n?n:function(){return!0});t.call(this,i),this.parent=e,this.viewFilter=n,e.listen(function(t){var e,n,o;switch(t.operationDetailed){case"clear":r.clear();break;case"removeLeft":case"removeRight":case"remove":for(var i=0,a=t.items;i<a.length;i+=1)r.remove(a[i]);break;case"prepend":o=t.items.filter(r.viewFilter),(e=r).unshift.apply(e,o);break;case"append":o=t.items.filter(r.viewFilter),(n=r).push.apply(n,o);break;case"swap":var c=r.data.indexOf(t.items[0]),s=r.data.indexOf(t.items[1]);-1!==c&&-1!==s&&r.swap(c,s);break;case"replace":var u=r.data.indexOf(t.target);-1!==u&&(r.viewFilter(t.items[0])?r.set(u,t.items[0]):r.remove(t.target))}},o)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.updateFilter=function(t){if(this.viewFilter!==t)return this.viewFilter=t,this.refresh(),this.data.length},e.prototype.refresh=function(){var t;this.clear();var e=this.parent.data.filter(this.viewFilter);(t=this).push.apply(t,e)},e}(r),u=function(t){t&&(this.data=t),this.updateEvent=new e,this.updateEventOnKey=new Map};u.prototype.pick=function(t,e){var n,r=new o(null===(n=this.data)||void 0===n?void 0:n[t]);return this.listenOnKey(t,function(t){r.update(t.newValue)},e),r},u.prototype.listen=function(t,e){return this.updateEvent.subscribe(t,e).cancel},u.prototype.listenOnKeyAndRepeat=function(t,e,n){return e({key:t,newValue:this.data[t],oldValue:void 0}),this.listenOnKey(t,e,n)},u.prototype.listenOnKey=function(t,n,o){return this.updateEventOnKey.has(t)||this.updateEventOnKey.set(t,new e),this.updateEventOnKey.get(t).subscribe(n,o).cancel},u.prototype.get=function(t){return this.data[t]},u.prototype.set=function(t,e){if(this.data[t]!==e){var n=this.data[t];this.data[t]=e,this.updateEvent.fire({oldValue:n,key:t,newValue:this.data[t]}),this.updateEventOnKey.has(t)&&this.updateEventOnKey.get(t).fire({oldValue:n,key:t,newValue:this.data[t]})}},u.prototype.assign=function(t){for(var e=0,n=Object.keys(t);e<n.length;e+=1){var o=n[e];this.set(o,t[o])}},u.prototype.toObject=function(){return Object.assign({},this.data)},u.prototype.toDataSource=function(){var t=this,e=new o(this.data);return this.listen(function(n){e.update(t.data)}),e};var l=Symbol("owner"),p=function(t){var e=this;this.node=this.create(t),t instanceof o&&t.listen(function(t){e.node&&(e.node.textContent=t)})};p.prototype.resolveStringSource=function(t){return"string"==typeof t?t:t.value},p.prototype.create=function(t){var e=document.createTextNode(this.resolveStringSource(t));return e[l]=this,e},p.prototype.remove=function(){this.hasParent()&&this.node.parentElement[l].removeChild(this.node)},p.prototype.hasParent=function(){return!!this.node.parentElement};var h=Symbol("AurumElementModel"),d={drag:"onDrag",dragstart:"onDragStart",dragend:"onDragEnd",dragexit:"onDragExit",dragover:"onDragOver",dragenter:"onDragEnter",dragleave:"onDragLeave",blur:"onBlur",focus:"onFocus",click:"onClick",dblclick:"onDblClick",keydown:"onKeyDown",keyhit:"onKeyHit",keyup:"onKeyUp",mousedown:"onMouseDown",mouseup:"onMouseUp",mousemove:"onMouseMove",mouseenter:"onMouseEnter",mouseleave:"onMouseLeave",mousewheel:"onMouseWheel",load:"onLoad",error:"onError"},f=["id","name","draggable","tabindex","style","role","contentEditable"];function v(t){return t&&t[h]?v(t.constructor(t.props,t.innerNodes)):t}var y=function(t,e,n){var o,r;this.node=this.create(n),this.children=[],null!=t&&(t.onAttach&&(this.onAttach=t.onAttach,this.needAttach=!0),this.onDetach=t.onDetach,this.initialize(t),null===(r=(o=t).onCreate)||void 0===r||r.call(o,this.node)),e&&this.addChildren(e)};y.prototype.initialize=function(t){this.createEventHandlers(d,t);var e=Object.keys(t).filter(function(t){return t.includes("-")});this.bindProps(f,t,e),t.class&&this.handleClass(t.class)},y.prototype.bindProps=function(t,e,n){for(var o=0,r=t;o<r.length;o+=1){var i=r[o];e[i]&&this.assignStringSourceToAttribute(e[i],i)}if(n)for(var a=0,c=n;a<c.length;a+=1){var s=c[a];e[s]&&this.assignStringSourceToAttribute(e[s],s)}},y.prototype.createEventHandlers=function(t,e){var n=this,r=function(r){e[t[r]]&&(e[t[r]]instanceof o?n.node.addEventListener(r,function(n){return e[t[r]].update(n)}):"function"==typeof e[t[r]]&&n.node.addEventListener(r,function(n){return e[t[r]](n)}))};for(var i in t)r(i)},y.prototype.render=function(){for(var t=0,e=0;e<this.children.length;e++,t++)this.children[e]instanceof b?t=this.renderFragment(this.children[e],t):this.renderChild(this.children[e],t);for(;this.node.childNodes.length>t;)this.node.removeChild(this.node.childNodes[this.node.childNodes.length-1])},y.prototype.renderFragment=function(t,e){for(var n=0;n<t.children.length;n++,e++)t.children[n]instanceof b?e=this.renderFragment(t.children[n],e):this.renderChild(t.children[n],e);return--e},y.prototype.renderChild=function(t,e){if(this.node.childNodes.length<=e)return this.addChildDom(t);if(this.node.childNodes[e][l]!==t){var n=this.getChildIndex(t.node);-1!==n?this.swapChildrenDom(e,n):this.addDomNodeAt(t.node,e)}},y.prototype.assignStringSourceToAttribute=function(t,e){var n=this;"string"==typeof t||"boolean"==typeof t?"boolean"==typeof t?t?this.node.setAttribute(e,""):this.node.removeAttribute(e):this.node.setAttribute(e,t):t.unique().listenAndRepeat(function(t){"boolean"==typeof t?t?n.node.setAttribute(e,""):n.node.removeAttribute(e):n.node.setAttribute(e,t)})},y.prototype.handleAttach=function(t){var e,n,o,r;if(this.needAttach)if(t.isConnected()){null===(e=this.onAttach)||void 0===e||e.call(this,this.node);for(var i=0,a=this.node.childNodes;i<a.length;i+=1)null===(r=null===(n=a[i][l])||void 0===n?void 0:(o=n).handleAttach)||void 0===r||r.call(o,this)}else t.needAttach=!0},y.prototype.handleDetach=function(){var t,e,n;if(!this.node.isConnected){null===(t=this.onDetach)||void 0===t||t.call(this,this.node);for(var o=0,r=this.node.childNodes;o<r.length;o+=1){var i=r[o];i[l]&&(null===(n=(e=i[l]).handleDetach)||void 0===n||n.call(e))}}},y.prototype.handleClass=function(t){var e=this;if("string"==typeof t)this.node.className=t;else if(t instanceof o)t.value&&(Array.isArray(t.value)?(this.node.className=t.value.join(" "),t.unique().listen(function(){e.node.className=t.value.join(" ")})):(this.node.className=t.value,t.unique().listen(function(){e.node.className=t.value}))),t.unique().listen(function(t){return e.node.className=t});else{var n=t.reduce(function(t,e){return"string"==typeof e?t+" "+e:e.value?t+" "+e.value:t},"");this.node.className=n;for(var r=0,i=t;r<i.length;r+=1){var a=i[r];a instanceof o&&a.unique().listen(function(n){var o=t.reduce(function(t,e){return"string"==typeof e?t+" "+e:e.value?t+" "+e.value:t},"");e.node.className=o})}}},y.prototype.create=function(t){var e=document.createElement(t);return e[l]=this,e},y.prototype.getChildIndex=function(t){for(var e=0,n=0,o=this.node.childNodes;n<o.length;n+=1){if(o[n]===t)return e;e++}return-1},y.prototype.hasChild=function(t){for(var e=0,n=t.children;e<n.length;e+=1)if(n[e]===t)return!0;return!1},y.prototype.addChildDom=function(t){var e,n;this.node.appendChild(t.node),null===(n=(e=t).handleAttach)||void 0===n||n.call(e,this)},y.prototype.swapChildrenDom=function(t,e){if(t!==e){var n=this.node.children[t],o=this.node.children[e];n.remove(),o.remove(),t<e?(this.addDomNodeAt(o,t),this.addDomNodeAt(n,e)):(this.addDomNodeAt(n,e),this.addDomNodeAt(o,t))}},y.prototype.addDomNodeAt=function(t,e){var n,o,r,i;e>=this.node.childElementCount?(this.node.appendChild(t),null===(o=(n=t[l]).handleAttach)||void 0===o||o.call(n,this)):(this.node.insertBefore(t,this.node.children[e]),null===(i=(r=t[l]).handleAttach)||void 0===i||i.call(r,this))},y.prototype.remove=function(){this.hasParent()&&this.node.parentElement[l].removeChild(this.node)},y.prototype.hasParent=function(){return!!this.node.parentElement},y.prototype.isConnected=function(){return this.node.isConnected},y.prototype.removeChild=function(t){var e=this.children.indexOf(t);-1!==e&&this.children.splice(e,1),this.render()},y.prototype.removeChildAt=function(t){this.children.splice(t,1),this.render()},y.prototype.swapChildren=function(t,e){if(t!==e){var n=this.children[t];this.children[t]=this.children[e],this.children[e]=n,this.render()}},y.prototype.clearChildren=function(){this.children.length=0,this.render()},y.prototype.addChild=function(t){if(null!=t&&(!t[h]||void 0!==(t=v(t))))if(Array.isArray(t))for(var e=0,n=t;e<n.length;e+=1)this.addChild(n[e]);else this.children.push(this.childNodeToAurum(t)),this.render()},y.prototype.childNodeToAurum=function(t){var e=this;if(t instanceof y)return t;if(t instanceof Promise){var n=new b({});return t.then(function(t){n.addChildren([t]),e.render()}),n}if(t instanceof r){var i=new b({repeatModel:t});return i.onChange.subscribe(function(){return e.render()}),i}if("string"==typeof t||"number"==typeof t||"boolean"==typeof t||"bigint"==typeof t)return new p(t.toString());if(t instanceof o){var a=new b({},[t]);return a.onChange.subscribe(function(){return e.render()}),a}throw new Error("Unsupported child type")},y.prototype.addChildAt=function(t,e){this.children.splice(e,0,this.childNodeToAurum(t)),this.render()},y.prototype.addChildren=function(t){if(0!==t.length)for(var e=0,n=t;e<n.length;e+=1)this.addChild(n[e])};var b=function(t,n){this.onChange=new e,this.children=[],t.repeatModel?this.handleRepeat(t.repeatModel):n&&this.addChildren(n)};b.prototype.addChildren=function(t){for(var e=this,n=function(){var t=i[r],n=void 0;if((n=t[h]?v(t):t)instanceof y)e.children.push(n);else{if(!(n instanceof o))throw new Error("case not yet implemented");var a=void 0,c=void 0,s={ts:void 0};n.unique().listenAndRepeat(function(t){if(s.ts=Date.now(),null==t&&c)return e.children.length=0,e.onChange.fire(),void(c=!1);if(!Array.isArray(t)&&c&&(e.children.length=0,e.onChange.fire(),c=!1),Array.isArray(t)){c=!0,e.children.length=0,e.onChange.fire();for(var o=0,r=t;o<r.length;o+=1)e.handleSourceChild(r[o],void 0,void 0,s,s.ts)}else a=e.handleSourceChild(t,a,n,s,s.ts)})}},r=0,i=t;r<i.length;r+=1)n()},b.prototype.handleSourceChild=function(t,e,n,i,a){var c=this;if(null!=t){if(t[h]&&(t=v(t)),"string"==typeof t||"bigint"==typeof t||"number"==typeof t||"boolean"==typeof t)if(e){if(e instanceof y){var s=new p(null!=n?n:t);this.children.splice(this.children.indexOf(e),1,s),e=s,this.onChange.fire()}}else{var u=new p(null!=n?n:t);this.children.push(u),e=u,this.onChange.fire()}else if(t instanceof y)t!==e&&(e?this.children.splice(this.children.indexOf(e),1,t):this.children.push(t),e=t,this.onChange.fire());else if(t instanceof Promise)t.then(function(t){i.ts===a&&(c.addChildren([t]),c.onChange.fire())});else if(t instanceof o)if(e){if(e!==t){var l=new b({},[t]);l.onChange.subscribe(function(){return c.onChange.fire()}),this.children.splice(this.children.indexOf(e),1,l),e=l,this.onChange.fire()}}else{var d=new b({},[t]);e=d,this.children.push(d),d.onChange.subscribe(function(){return c.onChange.fire()}),this.onChange.fire()}else if(t instanceof r)if(e){if(e!==t){var f=new b({repeatModel:t});f.onChange.subscribe(function(){return c.onChange.fire()}),this.children.splice(this.children.indexOf(e),1,f),e=f,this.onChange.fire()}}else{var _=new b({repeatModel:t});e=_,this.children.push(_),_.onChange.subscribe(function(){return c.onChange.fire()}),this.onChange.fire()}return e}e&&(this.children.splice(this.children.indexOf(e),1),e=void 0,this.onChange.fire())},b.prototype.handleRepeat=function(t){var e=this;t.listenAndRepeat(function(t){var n;switch(t.operationDetailed){case"replace":e.children[t.index]=v(t.items[0]);break;case"swap":var o=e.children[t.index2];e.children[t.index2]=e.children[t.index],e.children[t.index]=o;break;case"append":e.children=e.children.concat(t.items.map(v));break;case"prepend":(n=e.children).unshift.apply(n,t.items.map(v));break;case"remove":case"removeLeft":case"removeRight":e.children.splice(t.index,t.count);break;case"clear":e.children=[];break;default:throw new Error("unhandled operation")}e.onChange.fire()})};var _=function(t){function e(e,n){t.call(this,e,n,"div")}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(y),g=function(t){function e(e,n){t.call(this,e,n,"button"),null!==e&&this.bindProps(["disabled"],e)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(y),m={input:"onInput",change:"onChange"},w=["placeholder","readonly","disabled","accept","alt","autocomplete","autofocus","checked","defaultChecked","formAction","formEnctype","formMethod","formNoValidate","formTarget","max","maxLength","min","minLength","pattern","multiple","required","type"],C=function(t){function e(e,n){var o,r=this;t.call(this,e,n,"input"),null!==e&&(e.inputValueSource?e.inputValueSource.unique().listenAndRepeat(function(t){return r.node.value=t}):this.node.value=null!=(o=e.initialValue)?o:"",this.bindProps(w,e),this.createEventHandlers(m,e),e.inputValueSource&&this.node.addEventListener("input",function(){e.inputValueSource.update(r.node.value)}))}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(y),O=function(t){function e(e,n){t.call(this,e,n,"li")}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(y),x=function(t){function e(e,n){t.call(this,e,n,"span")}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(y),A=function(t){function e(e,n){t.call(this,e,n,"style"),null!==e&&this.bindProps(["media"],e)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(y),S=function(t){function e(e,n){t.call(this,e,n,"audio"),null!==e&&this.bindProps(["controls","autoplay","loop","muted","preload","src"],e)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(y),j=function(t){function e(e,n){t.call(this,e,n,"ul")}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(y),E=function(t){function e(e,n){t.call(this,e,n,"p")}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(y),k=function(t){function e(e,n){t.call(this,e,n,"img"),null!==e&&this.bindProps(["src","alt","width","height","referrerPolicy","sizes","srcset","useMap"],e)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(y),N=function(t){function e(e,n){t.call(this,e,n,"link"),null!==e&&this.bindProps(["href","rel","media","as","disabled","type"],e)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(y),D=function(t){function e(e,n){t.call(this,e,n,"canvas"),null!==e&&this.bindProps(["width","height"],e)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(y),P=function(t){function e(e,n){t.call(this,e,n,"a"),null!==e&&this.bindProps(["href","target"],e)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(y),F=function(t){function e(e,n){t.call(this,e,n,"article")}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(y),R=function(t){function e(e,n){t.call(this,e,n,"br")}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(y),I=function(t){function e(e,n){t.call(this,e,n,"form")}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(y),q=function(t){function e(e,n){t.call(this,e,n,"label"),null!==e&&this.bindProps(["for"],e)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(y),L=function(t){function e(e,n){t.call(this,e,n,"ol")}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(y),V=function(t){function e(e,n){t.call(this,e,n,"pre")}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(y),M=function(t){function e(e,n){t.call(this,e,n,"progress"),null!==e&&this.bindProps(["max","value"],e)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(y),T=function(t){function e(e,n){t.call(this,e,n,"table")}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(y),K=function(t){function e(e,n){t.call(this,e,n,"td")}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(y),H=function(t){function e(e,n){t.call(this,e,n,"tr")}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(y),z=function(t){function e(e,n){t.call(this,e,n,"th")}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(y),U={input:"onInput",change:"onChange"},B=["placeholder","readonly","disabled","rows","wrap","autocomplete","autofocus","max","maxLength","min","minLength","required","type"],W=function(t){function e(e,n){var o,r,i,a=this;t.call(this,e,n,"textArea"),null!==e&&(e.inputValueSource?(this.node.value=null!=(r=null!=(o=e.initialValue)?o:e.inputValueSource.value)?r:"",e.inputValueSource.unique().listen(function(t){return a.node.value=t})):this.node.value=null!=(i=e.initialValue)?i:"",this.bindProps(B,e),this.createEventHandlers(U,e),e.inputValueSource&&this.node.addEventListener("input",function(){e.inputValueSource.update(a.node.value)}))}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(y),G=function(t){function e(e,n){t.call(this,e,n,"h1")}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(y),J=function(t){function e(e,n){t.call(this,e,n,"h2")}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(y),Q=function(t){function e(e,n){t.call(this,e,n,"h3")}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(y),X=function(t){function e(e,n){t.call(this,e,n,"h4")}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(y),Y=function(t){function e(e,n){t.call(this,e,n,"h5")}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(y),Z=function(t){function e(e,n){t.call(this,e,n,"h6")}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(y),$=function(t){function e(e,n){t.call(this,e,n,"header")}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(y),tt=function(t){function e(e,n){t.call(this,e,n,"footer")}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(y),et=function(t){function e(e,n){t.call(this,e,n,"nav")}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(y),nt=function(t){function e(e,n){t.call(this,e,n,"b")}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(y),ot=function(t){function e(e,n){t.call(this,e,n,"i")}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(y),rt=function(t){function e(e,n){t.call(this,e,n,"script"),null!==e&&this.bindProps(["src","async","defer","integrity","noModule","type"],e)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(y),it=function(t){function e(e,n){t.call(this,e,n,"abbr")}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(y),at=function(t){function e(e,n){t.call(this,e,n,"area")}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(y),ct=function(t){function e(e,n){t.call(this,e,n,"aside")}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(y),st=function(t){function e(e,n){t.call(this,e,n,"em")}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(y),ut=function(t){function e(e,n){t.call(this,e,n,"heading")}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(y),lt=function(t){function e(e,n){t.call(this,e,n,"iframe"),null!==e&&this.bindProps(["src","srcdoc","width","height","allow","allowFullscreen","allowPaymentRequest"],e)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(y),pt=function(t){function e(e,n){t.call(this,e,n,"noscript")}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(y),ht=function(t){function e(e,n){t.call(this,e,n,"q")}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(y),dt={change:"onChange"},ft=function(t){function e(e,n){var o,r=this;t.call(this,e,n,"select"),null!==e&&(this.createEventHandlers(dt,e),this.initialSelection=e.initialSelection,e.selectedIndexSource?(this.selectedIndexSource=e.selectedIndexSource,e.selectedIndexSource.unique().listenAndRepeat(function(t){return r.node.selectedIndex=t})):this.node.selectedIndex=null!=(o=e.initialSelection)?o:-1,e.selectedIndexSource&&(this.needAttach=!0,this.node.addEventListener("change",function(){e.selectedIndexSource.update(r.node.selectedIndex)})))}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.handleAttach=function(e){t.prototype.handleAttach.call(this,e),this.node.isConnected&&(this.selectedIndexSource?this.node.selectedIndex=this.selectedIndexSource.value:void 0!==this.initialSelection&&(this.node.selectedIndex=this.initialSelection))},e}(y),vt=function(t){function e(e,n){t.call(this,e,n,"source"),null!==e&&this.bindProps(["src","srcSet","media","sizes","type"],e)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(y),yt=function(t){function e(e,n){t.call(this,e,n,"title")}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(y),bt=function(t){function e(e,n){t.call(this,e,n,"video"),null!==e&&this.bindProps(["controls","autoplay","loop","muted","preload","src","poster","width","height"],e)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(y),_t=function(t){function e(e,n){t.call(this,e,n,"tbody")}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(y),gt=function(t){function e(e,n){t.call(this,e,n,"tfoot")}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(y),mt=function(t){function e(e,n){t.call(this,e,n,"thead")}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(y),wt=function(t){function e(e,n){t.call(this,e,n,"summary")}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(y),Ct=function(t){function e(e,n){t.call(this,e,n,"details")}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(y),Ot=function(t){function e(e,n){t.call(this,e,n,"sub")}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(y),xt=function(t){function e(e,n){t.call(this,e,n,"sup")}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(y),At=function(t){function e(e,n){t.call(this,e,n,"svg"),null!==e&&this.bindProps(["width","height"],e)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(y),St=function(t){function e(e,n){t.call(this,e,n,"data"),null!==e&&this.bindProps(["datalue"],e)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(y),jt=function(t){function e(e,n){t.call(this,e,n,"time"),null!==e&&this.bindProps(["datetime"],e)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(y),Et={button:g,div:_,input:C,li:O,span:x,style:A,ul:j,p:E,img:k,link:N,canvas:D,a:P,article:F,br:R,form:I,label:q,ol:L,pre:V,progress:M,table:T,td:K,tr:H,th:z,textarea:W,h1:G,h2:J,h3:Q,h4:X,h5:Y,h6:Z,header:$,footer:tt,nav:et,b:nt,i:ot,script:rt,abbr:it,area:at,aside:ct,audio:S,em:st,heading:ut,iframe:lt,noscript:pt,option:function(t){function e(e,n){t.call(this,e,n,"option")}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(y),q:ht,select:ft,source:vt,title:yt,video:bt,tbody:_t,tfoot:gt,thead:mt,summary:wt,details:Ct,sub:Ot,sup:xt,svg:At,data:St,time:jt,template:function(t){function e(e,n){t.call(this,e,n,"template")}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(y)},kt=function(){};kt.attach=function(t,e){var n=v(t);if(e[l])throw new Error("This node is already managed by aurum and cannot be used");if(!(n instanceof y))throw new Error("Root node of aurum application must be a single dom node");e.appendChild(n.node),n.handleAttach(n),e[l]=n},kt.isAttached=function(t){return void 0!==t[l]},kt.detach=function(t){t[l]&&(t[l].node.remove(),t[l].handleDetach(),t[l]=void 0)},kt.factory=function(t,e){for(var n,o,r=[],i=arguments.length-2;i-- >0;)r[i]=arguments[i+2];if("string"==typeof t){var a=t;if(void 0===(t=Et[t]))throw new Error("Node "+a+" does not exist or is not supported")}return Object.getPrototypeOf(t)===y?((n={})[h]=!0,n.constructor=function(e,n){return new t(e,n)},n.props=e,n.innerNodes=r,n):((o={})[h]=!0,o.constructor=t,o.props=e,o.innerNodes=r,o)};var Nt=function(t){this.data=t};Nt.prototype.deleteNext=function(){if(this.next){var t=this.next.next;this.next.next=void 0,this.next.previous=void 0,this.next=t,this.next&&(this.next.previous=this)}},Nt.prototype.deletePrevious=function(){if(this.previous){var t=this.previous.previous;this.previous.next=void 0,this.previous.previous=void 0,this.previous=t,this.previous&&(this.previous.next=this)}};var Dt=function(t){var e=this;void 0===t&&(t=[]),this.length=0,t.forEach(function(t){return e.append(t)})};Dt.prototype.find=function(t){for(var e=this.rootNode;e&&!t(e);)e=e.next;return e},Dt.prototype.append=function(t){return this.rootNode||this.lastNode?(this.lastNode.next=new Nt(t),this.lastNode.next.previous=this.lastNode,this.lastNode=this.lastNode.next):this.rootNode=this.lastNode=new Nt(t),this.length++,t},Dt.prototype.forEach=function(t){this.find(function(e){return t(e.data),!1})},Dt.prototype.prepend=function(t){return this.rootNode||this.lastNode?(this.rootNode.previous=new Nt(t),this.rootNode.previous.next=this.rootNode,this.rootNode=this.rootNode.previous):this.rootNode=this.lastNode=new Nt(t),this.length++,t},Dt.prototype.remove=function(t){if(t===this.rootNode.data)this.rootNode=this.rootNode===this.lastNode?this.lastNode=void 0:this.rootNode.next,this.length--;else{var e=this.find(function(e){return e.next&&e.next.data===t});e&&(e.next===this.lastNode&&(this.lastNode=e),e.deleteNext(),this.length--)}};var Pt=function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];this.cancelables=new Dt(t),this._isCancelled=!1},Ft={isCanceled:{configurable:!0}};Ft.isCanceled.get=function(){return this._isCancelled},Pt.prototype.addCancelable=function(t){return this.throwIfCancelled("attempting to add cancellable to token that is already cancelled"),this.cancelables.append(t),this.cancelables.length>200&&console.log("potential memory leak: cancellation token has over 200 clean up calls"),this},Pt.prototype.removeCancelable=function(t){return this.throwIfCancelled("attempting to remove cancellable from token that is already cancelled"),this.cancelables.remove(t),this},Pt.prototype.addDisposable=function(t){return this.addCancelable(function(){return t.dispose()}),this},Pt.prototype.callIfNotCancelled=function(t){this.isCanceled||t()},Pt.prototype.setTimeout=function(t,e){var n=this;void 0===e&&(e=0);var o=setTimeout(function(){n.removeCancelable(r),t()},e),r=function(){return clearTimeout(o)};this.addCancelable(r)},Pt.prototype.setInterval=function(t,e){var n=setInterval(t,e);this.addCancelable(function(){return clearInterval(n)})},Pt.prototype.requestAnimationFrame=function(t){var e=requestAnimationFrame(t);this.addCancelable(function(){return cancelAnimationFrame(e)})},Pt.prototype.animationLoop=function(t){var e=requestAnimationFrame(function n(o){t(o),e=requestAnimationFrame(n)});this.addCancelable(function(){return cancelAnimationFrame(e)})},Pt.prototype.throwIfCancelled=function(t){if(this.isCanceled)throw new Error(t||"cancellation token is cancelled")},Pt.prototype.chain=function(t,e){return void 0===e&&(e=!1),e&&t.chain(this,!1),this.addCancelable(function(){return t.cancel()}),this},Pt.prototype.registerDomEvent=function(t,e,n){return t.addEventListener(e,n),this.addCancelable(function(){return t.removeEventListener(e,n)}),this},Pt.prototype.cancel=function(){this.isCanceled||(this._isCancelled=!0,this.cancelables.forEach(function(t){return t()}),this.cancelables=void 0)},Object.defineProperties(Pt.prototype,Ft);var Rt=function(t){function e(e,n){t.call(this,e,n,e.tag),e.attributes&&null!==e&&this.bindProps(Object.keys(e.attributes),e.attributes)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(y),It=Symbol("route");function qt(){var t=location.hash.substring(1);return t.includes("?")?t.substring(0,t.indexOf("?")):t.includes("#")?t.substring(0,t.indexOf("#")):t}var Lt=Symbol("switchCase");t.DataSource=o,t.ArrayDataSource=r,t.MappedArrayView=a,t.SortedArrayView=c,t.FilteredArrayView=s,t.ObjectDataSource=u,t.Aurum=kt,t.CancellationToken=Pt,t.Custom=Rt,t.AurumRouter=function(t,e){if((e=e.map(v)).some(function(t){return!t[It]}))throw new Error("Aurum Router only accepts Route and DefaultRoute instances as children");if(e.filter(function(t){return t.default}).length>1)throw new Error("Too many default routes only 0 or 1 allowed");var n=new o(qt());return window.addEventListener("hashchange",function(){n.update(qt())}),n.unique().map(function(t){return function(t,e){var n,o;if(null==t)return null===(n=e.find(function(t){return t.default}))||void 0===n?void 0:n.content;if(e.find(function(e){return e.href===t}))return e.find(function(e){return e.href===t}).content;var r=t.split("/");r.pop();for(var i=function(){var t=r.join("/");if(e.find(function(e){return e.href===t}))return{v:e.find(function(e){return e.href===t}).content};r.pop()};r.length;){var a=i();if(a)return a.v}return null===(o=e.find(function(t){return t.default}))||void 0===o?void 0:o.content}(t,e)})},t.Route=function(t,e){var n;return(n={})[It]=!0,n.content=e,n.default=!1,n.href=t.href,n},t.DefaultRoute=function(t,e){var n;return(n={})[It]=!0,n.content=e,n.default=!0,n.href=void 0,n},t.Suspense=function(t,e){var n=new o(t.fallback);return Promise.all(e.map(v)).then(function(t){n.update(t)}),n},t.Switch=function(t,e){if((e=e.map(v)).some(function(t){return!t[Lt]}))throw new Error("Switch only accepts SwitchCase as children");if(e.filter(function(t){return t.default}).length>1)throw new Error("Too many default switch cases only 0 or 1 allowed");return t.state.unique().map(function(t){return function(t,e){var n,o,r;return null!==(o=null===(n=e.find(function(e){return e.value===t}))||void 0===n?void 0:n.content)&&void 0!==o?o:null===(r=e.find(function(t){return t.default}))||void 0===r?void 0:r.content}(t,e)})},t.SwitchCase=function(t,e){var n;return(n={})[Lt]=!0,n.content=e,n.default=!1,n.value=t.when,n},t.DefaultSwitchCase=function(t,e){var n;return(n={})[Lt]=!0,n.content=e,n.default=!0,n.value=void 0,n},t.aurumElementModelIdentitiy=h,t.buildRenderableFromModel=v,t.AurumElement=y,t.AurumFragment=b}); | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e(t.aurum={})}(this,function(t){var e=function(){this.subscribeChannel=[],this.onAfterFire=[]},n={subscriptions:{configurable:!0}};n.subscriptions.get=function(){return this.subscribeChannel.length},e.prototype.subscribe=function(t,e){return this.createSubscription(t,this.subscribeChannel,e).facade},e.prototype.hasSubscriptions=function(){return this.subscriptions>0},e.prototype.cancelAll=function(){var t=this;this.isFiring?this.onAfterFire.push(function(){return t.subscribeChannel.length=0}):this.subscribeChannel.length=0},e.prototype.fireFiltered=function(t,e){this.isFiring=!0;for(var n=this.subscribeChannel.length,o=0;o<n;o++)this.subscribeChannel[o].callback!==e&&this.subscribeChannel[o].callback(t);this.isFiring=!1,this.afterFire()},e.prototype.afterFire=function(){this.onAfterFire.length>0&&(this.onAfterFire.forEach(function(t){return t()}),this.onAfterFire.length=0)},e.prototype.fire=function(t){this.isFiring=!0;for(var e=this.subscribeChannel.length,n=0;n<e;n++)this.subscribeChannel[n].callback(t);this.isFiring=!1,this.afterFire()},e.prototype.createSubscription=function(t,e,n){var o=this,r={callback:t},i={cancel:function(){o.cancel(r,e)}};return void 0!==n&&n.addCancelable(function(){return o.cancel(r,e)}),e.push(r),{subscription:r,facade:i}},e.prototype.cancel=function(t,e){var n=this,o=e.indexOf(t);o>=0&&(this.isFiring?this.onAfterFire.push(function(){return n.cancel(t,e)}):e.splice(o,1))},Object.defineProperties(e.prototype,n);var o=function(t){this.value=t,this.updateEvent=new e};o.prototype.update=function(t){if(this.updating)throw new Error("Problem in datas source: Unstable value propagation, when updating a value the stream was updated back as a direct response. This can lead to infinite loops and is therefore not allowed");this.updating=!0,this.value=t,this.updateEvent.fire(t),this.updating=!1},o.prototype.listenAndRepeat=function(t,e){return t(this.value),this.listen(t,e)},o.prototype.listen=function(t,e){return this.updateEvent.subscribe(t,e).cancel},o.prototype.filter=function(t,e){var n=new o;return this.listen(function(e){t(e,n.value)&&n.update(e)},e),n},o.prototype.max=function(t){return this.filter(function(t,e){return"string"==typeof t&&"string"==typeof e?t.localeCompare(e)>0:t>e})},o.prototype.min=function(t){return this.filter(function(t,e){return"string"==typeof t&&"string"==typeof e?t.localeCompare(e)<0:t<e})},o.prototype.pipe=function(t,e){this.listen(function(e){return t.update(e)},e)},o.prototype.map=function(t,e){var n=new o(t(this.value));return this.listen(function(e){n.update(t(e))},e),n},o.prototype.await=function(t){var e=new o;return this.listen(function(t){try{var n=e.update;return Promise.resolve(t).then(function(t){n.call(e,t)})}catch(t){return Promise.reject(t)}},t),e},o.prototype.unique=function(t){var e=new o(this.value);return this.listen(function(t){t!==e.value&&e.update(t)},t),e},o.prototype.reduce=function(t,e,n){var r=new o(e);return this.listen(function(e){return r.update(t(r.value,e))},n),r},o.prototype.aggregate=function(t,e,n){var r=this,i=new o(e(this.value,t.value));return this.listen(function(){return i.update(e(r.value,t.value))},n),t.listen(function(){return i.update(e(r.value,t.value))},n),i},o.prototype.stringJoin=function(t,e){var n=new o("");return this.listen(function(e){return n.update(n.value+t+e.toString())},e),n},o.prototype.combine=function(t,e){var n=new o;return this.pipe(n,e),t.pipe(n,e),n},o.prototype.debounce=function(t,e){var n,r=new o(this.value);return this.listen(function(e){clearTimeout(n),n=setTimeout(function(){r.update(e)},t)},e),r},o.prototype.throttle=function(t,e){var n=new o(this.value),r=!1;return this.listen(function(e){r||(n.update(e),r=!0,setTimeout(function(){r=!1},t))},e),n},o.prototype.buffer=function(t,e){var n,r=new o,i=[];return this.listen(function(e){i.push(e),n||(n=setTimeout(function(){n=void 0,r.update(i),i=[]},t))},e),r},o.prototype.accumulate=function(t){var e=new r;return this.listen(function(t){e.push(t)},t),e},o.prototype.pick=function(t,e){var n,r=new o(null===(n=this.value)||void 0===n?void 0:n[t]);return this.listen(function(e){r.update(null!=e?e[t]:e)},e),r},o.prototype.cancelAll=function(){this.updateEvent.cancelAll()};var r=function(t){this.data=t?t.slice():[],this.lengthSource=new o(this.data.length).unique(),this.updateEvent=new e},i={length:{configurable:!0}};r.prototype.listenAndRepeat=function(t,e){return t({operation:"add",operationDetailed:"append",index:0,items:this.data,newState:this.data,count:this.data.length}),this.listen(t,e)},r.prototype.listen=function(t,e){return this.updateEvent.subscribe(t,e).cancel},i.length.get=function(){return this.lengthSource},r.prototype.getData=function(){return this.data.slice()},r.prototype.get=function(t){return this.data[t]},r.prototype.set=function(t,e){var n=this.data[t];n!==e&&(this.data[t]=e,this.update({operation:"replace",operationDetailed:"replace",target:n,count:1,index:t,items:[e],newState:this.data}),this.lengthSource.update(this.data.length))},r.prototype.swap=function(t,e){if(t!==e){var n=this.data[t],o=this.data[e];this.data[e]=n,this.data[t]=o,this.update({operation:"swap",operationDetailed:"swap",index:t,index2:e,items:[n,o],newState:this.data}),this.lengthSource.update(this.data.length)}},r.prototype.swapItems=function(t,e){if(t!==e){var n=this.data.indexOf(t),o=this.data.indexOf(e);-1!==n&&-1!==o&&(this.data[o]=t,this.data[n]=e),this.update({operation:"swap",operationDetailed:"swap",index:n,index2:o,items:[t,e],newState:this.data}),this.lengthSource.update(this.data.length)}},r.prototype.appendArray=function(t){var e=this.data;this.data=new Array(e.length);var n=0;for(n=0;n<e.length;n++)this.data[n]=e[n];for(var o=0;o<t.length;o++)this.data[n+o]=t[o];this.update({operation:"add",operationDetailed:"append",count:t.length,index:this.data.length-t.length,items:t,newState:this.data}),this.lengthSource.update(this.data.length)},r.prototype.push=function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];this.appendArray(t),this.lengthSource.update(this.data.length)},r.prototype.unshift=function(){for(var t,e=[],n=arguments.length;n--;)e[n]=arguments[n];(t=this.data).unshift.apply(t,e),this.update({operation:"add",operationDetailed:"prepend",count:e.length,items:e,index:0,newState:this.data}),this.lengthSource.update(this.data.length)},r.prototype.pop=function(){var t=this.data.pop();return this.update({operation:"remove",operationDetailed:"removeRight",count:1,index:this.data.length,items:[t],newState:this.data}),this.lengthSource.update(this.data.length),t},r.prototype.merge=function(t){for(var e=0;e<t.length;e++)this.data[e]!==t[e]&&(this.data.length>e?this.set(e,t[e]):this.push(t[e]));this.data.length>t.length&&this.removeRight(this.data.length-t.length),this.lengthSource.update(this.data.length)},r.prototype.removeRight=function(t){var e=this.data.length,n=this.data.splice(e-t,t);this.update({operation:"remove",operationDetailed:"removeRight",count:t,index:e-t,items:n,newState:this.data}),this.lengthSource.update(this.data.length)},r.prototype.removeLeft=function(t){var e=this.data.splice(0,t);this.update({operation:"remove",operationDetailed:"removeLeft",count:t,index:0,items:e,newState:this.data}),this.lengthSource.update(this.data.length)},r.prototype.remove=function(t){var e=this.data.indexOf(t);-1!==e&&(this.data.splice(e,1),this.update({operation:"remove",operationDetailed:"remove",count:1,index:e,items:[t],newState:this.data}),this.lengthSource.update(this.data.length))},r.prototype.clear=function(){var t=this.data;this.data=[],this.update({operation:"remove",operationDetailed:"clear",count:t.length,index:0,items:t,newState:this.data}),this.lengthSource.update(this.data.length)},r.prototype.shift=function(){var t=this.data.shift();return this.update({operation:"remove",operationDetailed:"removeLeft",items:[t],count:1,index:0,newState:this.data}),this.lengthSource.update(this.data.length),t},r.prototype.toArray=function(){return this.data.slice()},r.prototype.sort=function(t,e){return new s(this,t,e)},r.prototype.map=function(t,e){return new a(this,t,e)},r.prototype.filter=function(t,e,n){void 0===e&&(e=[]);var o=new c(this,t,n);return e.forEach(function(t){t.unique().listen(function(){return o.refresh()})}),o},r.prototype.forEach=function(t){return this.data.forEach(t)},r.prototype.update=function(t){this.updateEvent.fire(t)},Object.defineProperties(r.prototype,i);var a=function(t){function e(e,n,o){var r=this,i=e.getData().map(n);t.call(this,i),this.mapper=n,e.listen(function(t){var e;switch(t.operationDetailed){case"removeLeft":r.removeLeft(t.count);break;case"removeRight":r.removeRight(t.count);break;case"remove":r.remove(r.data[t.index]);break;case"clear":r.clear();break;case"prepend":(e=r).unshift.apply(e,t.items.map(r.mapper));break;case"append":r.appendArray(t.items.map(r.mapper));break;case"swap":r.swap(t.index,t.index2);break;case"replace":r.set(t.index,r.mapper(t.items[0]))}},o)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(r),s=function(t){function e(e,n,o){var r=this,i=e.getData().sort(n);t.call(this,i),this.comparator=n,e.listen(function(t){var e,n;switch(t.operationDetailed){case"removeLeft":r.removeLeft(t.count);break;case"removeRight":r.removeRight(t.count);break;case"remove":r.remove(t.items[0]);break;case"clear":r.data.length=0;break;case"prepend":(e=r).unshift.apply(e,t.items),r.data.sort(r.comparator);break;case"append":(n=r).push.apply(n,t.items),r.data.sort(r.comparator);break;case"swap":break;case"replace":r.set(t.index,t.items[0]),r.data.sort(r.comparator)}},o)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(r),c=function(t){function e(e,n,o){var r=this;Array.isArray(e)&&(e=new t(e));var i=e.data.filter(n=null!=n?n:function(){return!0});t.call(this,i),this.parent=e,this.viewFilter=n,e.listen(function(t){var e,n,o;switch(t.operationDetailed){case"clear":r.clear();break;case"removeLeft":case"removeRight":case"remove":for(var i=0,a=t.items;i<a.length;i+=1)r.remove(a[i]);break;case"prepend":o=t.items.filter(r.viewFilter),(e=r).unshift.apply(e,o);break;case"append":o=t.items.filter(r.viewFilter),(n=r).push.apply(n,o);break;case"swap":var s=r.data.indexOf(t.items[0]),c=r.data.indexOf(t.items[1]);-1!==s&&-1!==c&&r.swap(s,c);break;case"replace":var u=r.data.indexOf(t.target);-1!==u&&(r.viewFilter(t.items[0])?r.set(u,t.items[0]):r.remove(t.target))}},o)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.updateFilter=function(t){if(this.viewFilter!==t)return this.viewFilter=t,this.refresh(),this.data.length},e.prototype.refresh=function(){var t;this.clear();var e=this.parent.data.filter(this.viewFilter);(t=this).push.apply(t,e)},e}(r),u=function(t){t&&(this.data=t),this.updateEvent=new e,this.updateEventOnKey=new Map};u.prototype.pick=function(t,e){var n,r=new o(null===(n=this.data)||void 0===n?void 0:n[t]);return this.listenOnKey(t,function(t){r.update(t.newValue)},e),r},u.prototype.listen=function(t,e){return this.updateEvent.subscribe(t,e).cancel},u.prototype.listenOnKeyAndRepeat=function(t,e,n){return e({key:t,newValue:this.data[t],oldValue:void 0}),this.listenOnKey(t,e,n)},u.prototype.listenOnKey=function(t,n,o){return this.updateEventOnKey.has(t)||this.updateEventOnKey.set(t,new e),this.updateEventOnKey.get(t).subscribe(n,o).cancel},u.prototype.get=function(t){return this.data[t]},u.prototype.set=function(t,e){if(this.data[t]!==e){var n=this.data[t];this.data[t]=e,this.updateEvent.fire({oldValue:n,key:t,newValue:this.data[t]}),this.updateEventOnKey.has(t)&&this.updateEventOnKey.get(t).fire({oldValue:n,key:t,newValue:this.data[t]})}},u.prototype.assign=function(t){for(var e=0,n=Object.keys(t);e<n.length;e+=1){var o=n[e];this.set(o,t[o])}},u.prototype.toObject=function(){return Object.assign({},this.data)},u.prototype.toDataSource=function(){var t=this,e=new o(this.data);return this.listen(function(n){e.update(t.data)}),e};var p,l=Symbol("owner"),h=function(t){var e=this;this.node=this.create(t),t instanceof o&&t.listen(function(t){e.node&&(e.node.textContent=t)})};h.prototype.resolveStringSource=function(t){return"string"==typeof t?t:t.value},h.prototype.create=function(t){var e=document.createTextNode(this.resolveStringSource(t));return e[l]=this,e},h.prototype.remove=function(){this.hasParent()&&this.node.parentElement[l].removeChild(this.node)},h.prototype.hasParent=function(){return!!this.node.parentElement},function(t){t[t.UPSTREAM=0]="UPSTREAM",t[t.DOWNSTREAM=1]="DOWNSTREAM"}(p||(p={}));var d=function(t){this.value=t,this.updateDownstreamEvent=new e,this.updateUpstreamEvent=new e};d.prototype.updateDownstream=function(t){if(this.updating)throw new Error("Problem in datas source: Unstable value propagation, when updating a value the stream was updated back as a direct response. This can lead to infinite loops and is therefore not allowed");this.updating=!0,this.value=t,this.updateDownstreamEvent.fire(t),this.updating=!1},d.prototype.updateUpstream=function(t){if(this.updating)throw new Error("Problem in datas source: Unstable value propagation, when updating a value the stream was updated back as a direct response. This can lead to infinite loops and is therefore not allowed");this.updating=!0,this.value=t,this.updateUpstreamEvent.fire(t),this.updating=!1},d.prototype.listenAndRepeat=function(t,e){return t(this.value),this.listen(t,e)},d.prototype.listen=function(t,e){return this.updateDownstreamEvent.subscribe(t,e),this.updateUpstreamEvent.subscribe(t,e).cancel},d.prototype.listenUpstream=function(t,e){return this.updateUpstreamEvent.subscribe(t,e).cancel},d.prototype.listenDownstream=function(t,e){return this.updateDownstreamEvent.subscribe(t,e).cancel},d.prototype.filter=function(t,e,n){var o=this;e||(e=t);var r=new d;return this.listenDownstream(function(e){t(e)&&r.updateDownstream(e)},n),r.listenUpstream(function(n){(null!=e?e:t)(n)&&o.updateUpstream(n)},n),r},d.prototype.pipe=function(t,e){var n=this;this.listenDownstream(function(e){return t.updateDownstream(e)},e),t.listenUpstream(function(t){return n.updateUpstream(t)},e)},d.prototype.map=function(t,e,n){var o=this,r=new d(t(this.value));return this.listenDownstream(function(e){return r.updateDownstream(t(e))},n),r.listenUpstream(function(t){return o.updateUpstream(e(t))},n),r},d.prototype.unique=function(t){var e=this,n=new d(this.value);return this.listenDownstream(function(t){n.value!==t&&n.updateDownstream(t)},t),n.listenUpstream(function(t){e.value!==t&&e.updateUpstream(t)},t),n},d.prototype.oneWayFlow=function(t,e){var n=this;void 0===t&&(t=p.DOWNSTREAM);var o=new d(this.value);return t===p.DOWNSTREAM?(this.listenDownstream(function(t){return o.updateDownstream(t)},e),o.updateUpstream=function(){}):(o.listenUpstream(function(t){return n.updateUpstream(t)}),o.updateDownstream=function(){}),o},d.prototype.cancelAll=function(){this.updateDownstreamEvent.cancelAll(),this.updateUpstreamEvent.cancelAll()};var f=Symbol("AurumElementModel"),v={drag:"onDrag",dragstart:"onDragStart",dragend:"onDragEnd",dragexit:"onDragExit",dragover:"onDragOver",dragenter:"onDragEnter",dragleave:"onDragLeave",blur:"onBlur",focus:"onFocus",click:"onClick",dblclick:"onDblClick",keydown:"onKeyDown",keyhit:"onKeyHit",keyup:"onKeyUp",mousedown:"onMouseDown",mouseup:"onMouseUp",mousemove:"onMouseMove",mouseenter:"onMouseEnter",mouseleave:"onMouseLeave",mousewheel:"onMouseWheel",load:"onLoad",error:"onError"},y=["id","name","draggable","tabindex","style","role","contentEditable"];function m(t){return t&&t[f]?m(t.constructor(t.props,t.innerNodes)):t}var b=function(t,e,n){var o,r;this.node=this.create(n),this.children=[],null!=t&&(t.onAttach&&(this.onAttach=t.onAttach,this.needAttach=!0),this.onDetach=t.onDetach,this.initialize(t),null===(r=(o=t).onCreate)||void 0===r||r.call(o,this.node)),e&&this.addChildren(e)};b.prototype.initialize=function(t){this.createEventHandlers(v,t);var e=Object.keys(t).filter(function(t){return t.includes("-")});this.bindProps(y,t,e),t.class&&this.handleClass(t.class)},b.prototype.bindProps=function(t,e,n){for(var o=0,r=t;o<r.length;o+=1){var i=r[o];e[i]&&this.assignStringSourceToAttribute(e[i],i)}if(n)for(var a=0,s=n;a<s.length;a+=1){var c=s[a];e[c]&&this.assignStringSourceToAttribute(e[c],c)}},b.prototype.createEventHandlers=function(t,e){var n=this,r=function(r){e[t[r]]&&(e[t[r]]instanceof o?n.node.addEventListener(r,function(n){return e[t[r]].update(n)}):e[t[r]]instanceof d?n.node.addEventListener(r,function(n){return e[t[r]].updateDownstream(n)}):"function"==typeof e[t[r]]&&n.node.addEventListener(r,function(n){return e[t[r]](n)}))};for(var i in t)r(i)},b.prototype.render=function(){for(var t=0,e=0;e<this.children.length;e++,t++)this.children[e]instanceof _?t=this.renderFragment(this.children[e],t):this.renderChild(this.children[e],t);for(;this.node.childNodes.length>t;)this.node.removeChild(this.node.childNodes[this.node.childNodes.length-1])},b.prototype.renderFragment=function(t,e){for(var n=0;n<t.children.length;n++,e++)t.children[n]instanceof _?e=this.renderFragment(t.children[n],e):this.renderChild(t.children[n],e);return--e},b.prototype.renderChild=function(t,e){if(this.node.childNodes.length<=e)return this.addChildDom(t);if(this.node.childNodes[e][l]!==t){var n=this.getChildIndex(t.node);-1!==n?this.swapChildrenDom(e,n):this.addDomNodeAt(t.node,e)}},b.prototype.assignStringSourceToAttribute=function(t,e){var n=this;"string"==typeof t||"boolean"==typeof t?"boolean"==typeof t?t?this.node.setAttribute(e,""):this.node.removeAttribute(e):this.node.setAttribute(e,t):t.unique().listenAndRepeat(function(t){"boolean"==typeof t?t?n.node.setAttribute(e,""):n.node.removeAttribute(e):n.node.setAttribute(e,t)})},b.prototype.handleAttach=function(t){var e,n,o,r;if(this.needAttach)if(t.isConnected()){null===(e=this.onAttach)||void 0===e||e.call(this,this.node);for(var i=0,a=this.node.childNodes;i<a.length;i+=1)null===(r=null===(n=a[i][l])||void 0===n?void 0:(o=n).handleAttach)||void 0===r||r.call(o,this)}else t.needAttach=!0},b.prototype.handleDetach=function(){var t,e,n;if(!this.node.isConnected){null===(t=this.onDetach)||void 0===t||t.call(this,this.node);for(var o=0,r=this.node.childNodes;o<r.length;o+=1){var i=r[o];i[l]&&(null===(n=(e=i[l]).handleDetach)||void 0===n||n.call(e))}}},b.prototype.handleClass=function(t){var e=this;if("string"==typeof t)this.node.className=t;else if(t instanceof o)t.value&&(Array.isArray(t.value)?(this.node.className=t.value.join(" "),t.unique().listen(function(){e.node.className=t.value.join(" ")})):(this.node.className=t.value,t.unique().listen(function(){e.node.className=t.value}))),t.unique().listen(function(t){return e.node.className=t});else{var n=t.reduce(function(t,e){return"string"==typeof e?t+" "+e:e.value?t+" "+e.value:t},"");this.node.className=n;for(var r=0,i=t;r<i.length;r+=1){var a=i[r];a instanceof o&&a.unique().listen(function(n){var o=t.reduce(function(t,e){return"string"==typeof e?t+" "+e:e.value?t+" "+e.value:t},"");e.node.className=o})}}},b.prototype.create=function(t){var e=document.createElement(t);return e[l]=this,e},b.prototype.getChildIndex=function(t){for(var e=0,n=0,o=this.node.childNodes;n<o.length;n+=1){if(o[n]===t)return e;e++}return-1},b.prototype.hasChild=function(t){for(var e=0,n=t.children;e<n.length;e+=1)if(n[e]===t)return!0;return!1},b.prototype.addChildDom=function(t){var e,n;this.node.appendChild(t.node),null===(n=(e=t).handleAttach)||void 0===n||n.call(e,this)},b.prototype.swapChildrenDom=function(t,e){if(t!==e){var n=this.node.children[t],o=this.node.children[e];n.remove(),o.remove(),t<e?(this.addDomNodeAt(o,t),this.addDomNodeAt(n,e)):(this.addDomNodeAt(n,e),this.addDomNodeAt(o,t))}},b.prototype.addDomNodeAt=function(t,e){var n,o,r,i;e>=this.node.childElementCount?(this.node.appendChild(t),null===(o=(n=t[l]).handleAttach)||void 0===o||o.call(n,this)):(this.node.insertBefore(t,this.node.children[e]),null===(i=(r=t[l]).handleAttach)||void 0===i||i.call(r,this))},b.prototype.remove=function(){this.hasParent()&&this.node.parentElement[l].removeChild(this.node)},b.prototype.hasParent=function(){return!!this.node.parentElement},b.prototype.isConnected=function(){return this.node.isConnected},b.prototype.removeChild=function(t){var e=this.children.indexOf(t);-1!==e&&this.children.splice(e,1),this.render()},b.prototype.removeChildAt=function(t){this.children.splice(t,1),this.render()},b.prototype.swapChildren=function(t,e){if(t!==e){var n=this.children[t];this.children[t]=this.children[e],this.children[e]=n,this.render()}},b.prototype.clearChildren=function(){this.children.length=0,this.render()},b.prototype.addChild=function(t){if(null!=t&&(!t[f]||void 0!==(t=m(t))))if(Array.isArray(t))for(var e=0,n=t;e<n.length;e+=1)this.addChild(n[e]);else this.children.push(this.childNodeToAurum(t)),this.render()},b.prototype.childNodeToAurum=function(t){var e=this;if(t instanceof b)return t;if(t instanceof Promise){var n=new _({});return t.then(function(t){n.addChildren([t]),e.render()}),n}if(t instanceof r){var i=new _({repeatModel:t});return i.onChange.subscribe(function(){return e.render()}),i}if("string"==typeof t||"number"==typeof t||"boolean"==typeof t||"bigint"==typeof t)return new h(t.toString());if(t instanceof o){var a=new _({},[t]);return a.onChange.subscribe(function(){return e.render()}),a}throw new Error("Unsupported child type")},b.prototype.addChildAt=function(t,e){this.children.splice(e,0,this.childNodeToAurum(t)),this.render()},b.prototype.addChildren=function(t){if(0!==t.length)for(var e=0,n=t;e<n.length;e+=1)this.addChild(n[e])};var _=function(t,n){this.onChange=new e,this.children=[],t.repeatModel?this.handleRepeat(t.repeatModel):n&&this.addChildren(n)};_.prototype.addChildren=function(t){for(var e=this,n=function(){var t=i[r],n=void 0;if((n=t[f]?m(t):t)instanceof b)e.children.push(n);else{if(!(n instanceof o))throw new Error("case not yet implemented");var a=void 0,s=void 0,c={ts:void 0};n.unique().listenAndRepeat(function(t){if(c.ts=Date.now(),null==t&&s)return e.children.length=0,e.onChange.fire(),void(s=!1);if(!Array.isArray(t)&&s&&(e.children.length=0,e.onChange.fire(),s=!1),Array.isArray(t)){s=!0,e.children.length=0,e.onChange.fire();for(var o=0,r=t;o<r.length;o+=1)e.handleSourceChild(r[o],void 0,void 0,c,c.ts)}else a=e.handleSourceChild(t,a,n,c,c.ts)})}},r=0,i=t;r<i.length;r+=1)n()},_.prototype.handleSourceChild=function(t,e,n,i,a){var s=this;if(null!=t){if(t[f]&&(t=m(t)),"string"==typeof t||"bigint"==typeof t||"number"==typeof t||"boolean"==typeof t)if(e){if(e instanceof b){var c=new h(null!=n?n:t);this.children.splice(this.children.indexOf(e),1,c),e=c,this.onChange.fire()}}else{var u=new h(null!=n?n:t);this.children.push(u),e=u,this.onChange.fire()}else if(t instanceof b)t!==e&&(e?this.children.splice(this.children.indexOf(e),1,t):this.children.push(t),e=t,this.onChange.fire());else if(t instanceof Promise)t.then(function(t){i.ts===a&&(s.addChildren([t]),s.onChange.fire())});else if(t instanceof o)if(e){if(e!==t){var p=new _({},[t]);p.onChange.subscribe(function(){return s.onChange.fire()}),this.children.splice(this.children.indexOf(e),1,p),e=p,this.onChange.fire()}}else{var l=new _({},[t]);e=l,this.children.push(l),l.onChange.subscribe(function(){return s.onChange.fire()}),this.onChange.fire()}else if(t instanceof r)if(e){if(e!==t){var d=new _({repeatModel:t});d.onChange.subscribe(function(){return s.onChange.fire()}),this.children.splice(this.children.indexOf(e),1,d),e=d,this.onChange.fire()}}else{var v=new _({repeatModel:t});e=v,this.children.push(v),v.onChange.subscribe(function(){return s.onChange.fire()}),this.onChange.fire()}return e}e&&(this.children.splice(this.children.indexOf(e),1),e=void 0,this.onChange.fire())},_.prototype.handleRepeat=function(t){var e=this;t.listenAndRepeat(function(t){var n;switch(t.operationDetailed){case"replace":e.children[t.index]=m(t.items[0]);break;case"swap":var o=e.children[t.index2];e.children[t.index2]=e.children[t.index],e.children[t.index]=o;break;case"append":e.children=e.children.concat(t.items.map(m));break;case"prepend":(n=e.children).unshift.apply(n,t.items.map(m));break;case"remove":case"removeLeft":case"removeRight":e.children.splice(t.index,t.count);break;case"clear":e.children=[];break;default:throw new Error("unhandled operation")}e.onChange.fire()})};var g=function(t){function e(e,n){t.call(this,e,n,"div")}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(b),w=function(t){function e(e,n){t.call(this,e,n,"button"),null!==e&&this.bindProps(["disabled"],e)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(b),C={input:"onInput",change:"onChange"},O=["placeholder","readonly","disabled","accept","alt","autocomplete","autofocus","checked","defaultChecked","formAction","formEnctype","formMethod","formNoValidate","formTarget","max","maxLength","min","minLength","pattern","multiple","required","type"],A=function(t){function e(e,n){var o,r=this;t.call(this,e,n,"input"),null!==e&&(e.inputValueSource?e.inputValueSource.unique().listenAndRepeat(function(t){return r.node.value=t}):this.node.value=null!=(o=e.initialValue)?o:"",this.bindProps(O,e),this.createEventHandlers(C,e),e.inputValueSource&&this.node.addEventListener("input",function(){e.inputValueSource.update(r.node.value)}))}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(b),x=function(t){function e(e,n){t.call(this,e,n,"li")}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(b),S=function(t){function e(e,n){t.call(this,e,n,"span")}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(b),E=function(t){function e(e,n){t.call(this,e,n,"style"),null!==e&&this.bindProps(["media"],e)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(b),j=function(t){function e(e,n){t.call(this,e,n,"audio"),null!==e&&this.bindProps(["controls","autoplay","loop","muted","preload","src"],e)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(b),D=function(t){function e(e,n){t.call(this,e,n,"ul")}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(b),N=function(t){function e(e,n){t.call(this,e,n,"p")}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(b),k=function(t){function e(e,n){t.call(this,e,n,"img"),null!==e&&this.bindProps(["src","alt","width","height","referrerPolicy","sizes","srcset","useMap"],e)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(b),P=function(t){function e(e,n){t.call(this,e,n,"link"),null!==e&&this.bindProps(["href","rel","media","as","disabled","type"],e)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(b),F=function(t){function e(e,n){t.call(this,e,n,"canvas"),null!==e&&this.bindProps(["width","height"],e)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(b),R=function(t){function e(e,n){t.call(this,e,n,"a"),null!==e&&this.bindProps(["href","target"],e)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(b),T=function(t){function e(e,n){t.call(this,e,n,"article")}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(b),I=function(t){function e(e,n){t.call(this,e,n,"br")}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(b),L=function(t){function e(e,n){t.call(this,e,n,"form")}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(b),M=function(t){function e(e,n){t.call(this,e,n,"label"),null!==e&&this.bindProps(["for"],e)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(b),U=function(t){function e(e,n){t.call(this,e,n,"ol")}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(b),q=function(t){function e(e,n){t.call(this,e,n,"pre")}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(b),V=function(t){function e(e,n){t.call(this,e,n,"progress"),null!==e&&this.bindProps(["max","value"],e)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(b),K=function(t){function e(e,n){t.call(this,e,n,"table")}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(b),H=function(t){function e(e,n){t.call(this,e,n,"td")}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(b),W=function(t){function e(e,n){t.call(this,e,n,"tr")}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(b),z=function(t){function e(e,n){t.call(this,e,n,"th")}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(b),B={input:"onInput",change:"onChange"},J=["placeholder","readonly","disabled","rows","wrap","autocomplete","autofocus","max","maxLength","min","minLength","required","type"],G=function(t){function e(e,n){var o,r,i,a=this;t.call(this,e,n,"textArea"),null!==e&&(e.inputValueSource?(this.node.value=null!=(r=null!=(o=e.initialValue)?o:e.inputValueSource.value)?r:"",e.inputValueSource.unique().listen(function(t){return a.node.value=t})):this.node.value=null!=(i=e.initialValue)?i:"",this.bindProps(J,e),this.createEventHandlers(B,e),e.inputValueSource&&this.node.addEventListener("input",function(){e.inputValueSource.update(a.node.value)}))}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(b),Q=function(t){function e(e,n){t.call(this,e,n,"h1")}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(b),X=function(t){function e(e,n){t.call(this,e,n,"h2")}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(b),Y=function(t){function e(e,n){t.call(this,e,n,"h3")}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(b),Z=function(t){function e(e,n){t.call(this,e,n,"h4")}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(b),$=function(t){function e(e,n){t.call(this,e,n,"h5")}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(b),tt=function(t){function e(e,n){t.call(this,e,n,"h6")}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(b),et=function(t){function e(e,n){t.call(this,e,n,"header")}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(b),nt=function(t){function e(e,n){t.call(this,e,n,"footer")}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(b),ot=function(t){function e(e,n){t.call(this,e,n,"nav")}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(b),rt=function(t){function e(e,n){t.call(this,e,n,"b")}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(b),it=function(t){function e(e,n){t.call(this,e,n,"i")}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(b),at=function(t){function e(e,n){t.call(this,e,n,"script"),null!==e&&this.bindProps(["src","async","defer","integrity","noModule","type"],e)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(b),st=function(t){function e(e,n){t.call(this,e,n,"abbr")}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(b),ct=function(t){function e(e,n){t.call(this,e,n,"area")}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(b),ut=function(t){function e(e,n){t.call(this,e,n,"aside")}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(b),pt=function(t){function e(e,n){t.call(this,e,n,"em")}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(b),lt=function(t){function e(e,n){t.call(this,e,n,"heading")}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(b),ht=function(t){function e(e,n){t.call(this,e,n,"iframe"),null!==e&&this.bindProps(["src","srcdoc","width","height","allow","allowFullscreen","allowPaymentRequest"],e)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(b),dt=function(t){function e(e,n){t.call(this,e,n,"noscript")}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(b),ft=function(t){function e(e,n){t.call(this,e,n,"q")}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(b),vt={change:"onChange"},yt=function(t){function e(e,n){var o,r=this;t.call(this,e,n,"select"),null!==e&&(this.createEventHandlers(vt,e),this.initialSelection=e.initialSelection,e.selectedIndexSource?(this.selectedIndexSource=e.selectedIndexSource,e.selectedIndexSource.unique().listenAndRepeat(function(t){return r.node.selectedIndex=t})):this.node.selectedIndex=null!=(o=e.initialSelection)?o:-1,e.selectedIndexSource&&(this.needAttach=!0,this.node.addEventListener("change",function(){e.selectedIndexSource.update(r.node.selectedIndex)})))}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e.prototype.handleAttach=function(e){t.prototype.handleAttach.call(this,e),this.node.isConnected&&(this.selectedIndexSource?this.node.selectedIndex=this.selectedIndexSource.value:void 0!==this.initialSelection&&(this.node.selectedIndex=this.initialSelection))},e}(b),mt=function(t){function e(e,n){t.call(this,e,n,"source"),null!==e&&this.bindProps(["src","srcSet","media","sizes","type"],e)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(b),bt=function(t){function e(e,n){t.call(this,e,n,"title")}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(b),_t=function(t){function e(e,n){t.call(this,e,n,"video"),null!==e&&this.bindProps(["controls","autoplay","loop","muted","preload","src","poster","width","height"],e)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(b),gt=function(t){function e(e,n){t.call(this,e,n,"tbody")}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(b),wt=function(t){function e(e,n){t.call(this,e,n,"tfoot")}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(b),Ct=function(t){function e(e,n){t.call(this,e,n,"thead")}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(b),Ot=function(t){function e(e,n){t.call(this,e,n,"summary")}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(b),At=function(t){function e(e,n){t.call(this,e,n,"details")}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(b),xt=function(t){function e(e,n){t.call(this,e,n,"sub")}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(b),St=function(t){function e(e,n){t.call(this,e,n,"sup")}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(b),Et=function(t){function e(e,n){t.call(this,e,n,"svg"),null!==e&&this.bindProps(["width","height"],e)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(b),jt=function(t){function e(e,n){t.call(this,e,n,"data"),null!==e&&this.bindProps(["datalue"],e)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(b),Dt=function(t){function e(e,n){t.call(this,e,n,"time"),null!==e&&this.bindProps(["datetime"],e)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(b),Nt={button:w,div:g,input:A,li:x,span:S,style:E,ul:D,p:N,img:k,link:P,canvas:F,a:R,article:T,br:I,form:L,label:M,ol:U,pre:q,progress:V,table:K,td:H,tr:W,th:z,textarea:G,h1:Q,h2:X,h3:Y,h4:Z,h5:$,h6:tt,header:et,footer:nt,nav:ot,b:rt,i:it,script:at,abbr:st,area:ct,aside:ut,audio:j,em:pt,heading:lt,iframe:ht,noscript:dt,option:function(t){function e(e,n){t.call(this,e,n,"option")}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(b),q:ft,select:yt,source:mt,title:bt,video:_t,tbody:gt,tfoot:wt,thead:Ct,summary:Ot,details:At,sub:xt,sup:St,svg:Et,data:jt,time:Dt,template:function(t){function e(e,n){t.call(this,e,n,"template")}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(b)},kt=function(){};kt.attach=function(t,e){var n=m(t);if(e[l])throw new Error("This node is already managed by aurum and cannot be used");if(!(n instanceof b))throw new Error("Root node of aurum application must be a single dom node");e.appendChild(n.node),n.handleAttach(n),e[l]=n},kt.isAttached=function(t){return void 0!==t[l]},kt.detach=function(t){t[l]&&(t[l].node.remove(),t[l].handleDetach(),t[l]=void 0)},kt.factory=function(t,e){for(var n,o,r=[],i=arguments.length-2;i-- >0;)r[i]=arguments[i+2];if("string"==typeof t){var a=t;if(void 0===(t=Nt[t]))throw new Error("Node "+a+" does not exist or is not supported")}return Object.getPrototypeOf(t)===b?((n={})[f]=!0,n.constructor=function(e,n){return new t(e,n)},n.props=e,n.innerNodes=r,n):((o={})[f]=!0,o.constructor=t,o.props=e,o.innerNodes=r,o)};var Pt=function(t){this.data=t};Pt.prototype.deleteNext=function(){if(this.next){var t=this.next.next;this.next.next=void 0,this.next.previous=void 0,this.next=t,this.next&&(this.next.previous=this)}},Pt.prototype.deletePrevious=function(){if(this.previous){var t=this.previous.previous;this.previous.next=void 0,this.previous.previous=void 0,this.previous=t,this.previous&&(this.previous.next=this)}};var Ft=function(t){var e=this;void 0===t&&(t=[]),this.length=0,t.forEach(function(t){return e.append(t)})};Ft.prototype.find=function(t){for(var e=this.rootNode;e&&!t(e);)e=e.next;return e},Ft.prototype.append=function(t){return this.rootNode||this.lastNode?(this.lastNode.next=new Pt(t),this.lastNode.next.previous=this.lastNode,this.lastNode=this.lastNode.next):this.rootNode=this.lastNode=new Pt(t),this.length++,t},Ft.prototype.forEach=function(t){this.find(function(e){return t(e.data),!1})},Ft.prototype.prepend=function(t){return this.rootNode||this.lastNode?(this.rootNode.previous=new Pt(t),this.rootNode.previous.next=this.rootNode,this.rootNode=this.rootNode.previous):this.rootNode=this.lastNode=new Pt(t),this.length++,t},Ft.prototype.remove=function(t){if(t===this.rootNode.data)this.rootNode=this.rootNode===this.lastNode?this.lastNode=void 0:this.rootNode.next,this.length--;else{var e=this.find(function(e){return e.next&&e.next.data===t});e&&(e.next===this.lastNode&&(this.lastNode=e),e.deleteNext(),this.length--)}};var Rt=function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];this.cancelables=new Ft(t),this._isCancelled=!1},Tt={isCanceled:{configurable:!0}};Tt.isCanceled.get=function(){return this._isCancelled},Rt.prototype.addCancelable=function(t){return this.throwIfCancelled("attempting to add cancellable to token that is already cancelled"),this.cancelables.append(t),this.cancelables.length>200&&console.log("potential memory leak: cancellation token has over 200 clean up calls"),this},Rt.prototype.removeCancelable=function(t){return this.throwIfCancelled("attempting to remove cancellable from token that is already cancelled"),this.cancelables.remove(t),this},Rt.prototype.addDisposable=function(t){return this.addCancelable(function(){return t.dispose()}),this},Rt.prototype.callIfNotCancelled=function(t){this.isCanceled||t()},Rt.prototype.setTimeout=function(t,e){var n=this;void 0===e&&(e=0);var o=setTimeout(function(){n.removeCancelable(r),t()},e),r=function(){return clearTimeout(o)};this.addCancelable(r)},Rt.prototype.setInterval=function(t,e){var n=setInterval(t,e);this.addCancelable(function(){return clearInterval(n)})},Rt.prototype.requestAnimationFrame=function(t){var e=requestAnimationFrame(t);this.addCancelable(function(){return cancelAnimationFrame(e)})},Rt.prototype.animationLoop=function(t){var e=requestAnimationFrame(function n(o){t(o),e=requestAnimationFrame(n)});this.addCancelable(function(){return cancelAnimationFrame(e)})},Rt.prototype.throwIfCancelled=function(t){if(this.isCanceled)throw new Error(t||"cancellation token is cancelled")},Rt.prototype.chain=function(t,e){return void 0===e&&(e=!1),e&&t.chain(this,!1),this.addCancelable(function(){return t.cancel()}),this},Rt.prototype.registerDomEvent=function(t,e,n){return t.addEventListener(e,n),this.addCancelable(function(){return t.removeEventListener(e,n)}),this},Rt.prototype.cancel=function(){this.isCanceled||(this._isCancelled=!0,this.cancelables.forEach(function(t){return t()}),this.cancelables=void 0)},Object.defineProperties(Rt.prototype,Tt);var It=function(t){function e(e,n){t.call(this,e,n,e.tag),e.attributes&&null!==e&&this.bindProps(Object.keys(e.attributes),e.attributes)}return t&&(e.__proto__=t),(e.prototype=Object.create(t&&t.prototype)).constructor=e,e}(b),Lt=Symbol("route");function Mt(){var t=location.hash.substring(1);return t.includes("?")?t.substring(0,t.indexOf("?")):t.includes("#")?t.substring(0,t.indexOf("#")):t}var Ut=Symbol("switchCase");t.DataSource=o,t.ArrayDataSource=r,t.MappedArrayView=a,t.SortedArrayView=s,t.FilteredArrayView=c,t.ObjectDataSource=u,t.Aurum=kt,t.CancellationToken=Rt,t.Custom=It,t.AurumRouter=function(t,e){if((e=e.map(m)).some(function(t){return!t[Lt]}))throw new Error("Aurum Router only accepts Route and DefaultRoute instances as children");if(e.filter(function(t){return t.default}).length>1)throw new Error("Too many default routes only 0 or 1 allowed");var n=new o(Mt());return window.addEventListener("hashchange",function(){n.update(Mt())}),n.unique().map(function(t){return function(t,e){var n,o;if(null==t)return null===(n=e.find(function(t){return t.default}))||void 0===n?void 0:n.content;if(e.find(function(e){return e.href===t}))return e.find(function(e){return e.href===t}).content;var r=t.split("/");r.pop();for(var i=function(){var t=r.join("/");if(e.find(function(e){return e.href===t}))return{v:e.find(function(e){return e.href===t}).content};r.pop()};r.length;){var a=i();if(a)return a.v}return null===(o=e.find(function(t){return t.default}))||void 0===o?void 0:o.content}(t,e)})},t.Route=function(t,e){var n;return(n={})[Lt]=!0,n.content=e,n.default=!1,n.href=t.href,n},t.DefaultRoute=function(t,e){var n;return(n={})[Lt]=!0,n.content=e,n.default=!0,n.href=void 0,n},t.Suspense=function(t,e){var n=new o(t.fallback);return Promise.all(e.map(m)).then(function(t){n.update(t)}),n},t.Switch=function(t,e){if((e=e.map(m)).some(function(t){return!t[Ut]}))throw new Error("Switch only accepts SwitchCase as children");if(e.filter(function(t){return t.default}).length>1)throw new Error("Too many default switch cases only 0 or 1 allowed");return t.state.unique().map(function(t){return function(t,e){var n,o,r;return null!==(o=null===(n=e.find(function(e){return e.value===t}))||void 0===n?void 0:n.content)&&void 0!==o?o:null===(r=e.find(function(t){return t.default}))||void 0===r?void 0:r.content}(t,e)})},t.SwitchCase=function(t,e){var n;return(n={})[Ut]=!0,n.content=e,n.default=!1,n.value=t.when,n},t.DefaultSwitchCase=function(t,e){var n;return(n={})[Ut]=!0,n.content=e,n.default=!0,n.value=void 0,n},t.aurumElementModelIdentitiy=f,t.buildRenderableFromModel=m,t.AurumElement=b,t.AurumFragment=_}); | ||
//# sourceMappingURL=aurumjs.umd.js.map |
import { assert } from 'chai'; | ||
import { DataSource, CancellationToken } from '../src/aurum'; | ||
import { DuplexDataSource } from '../src/stream/duplex_data_source'; | ||
@@ -165,6 +166,6 @@ describe('Datasource', () => { | ||
let asserts = [4, 0, 100, 200]; | ||
let ds = new DataSource(0); | ||
let ds = new DuplexDataSource(0); | ||
let validated = true; | ||
const ud = ds.uniqueDuplex(); | ||
const ud = ds.unique(); | ||
const token = new CancellationToken(); | ||
@@ -178,11 +179,7 @@ ud.listen((value) => { | ||
token.cancel(); | ||
ds.update(0); | ||
ds.update(4); | ||
ds.update(4); | ||
ds.update(0); | ||
ds.update(0); | ||
ds.update(100); | ||
ds.update(100); | ||
ds.update(200); | ||
ds.updateDownstream(0); | ||
ds.updateDownstream(4); | ||
ds.updateDownstream(0); | ||
ds.updateDownstream(100); | ||
ds.updateDownstream(200); | ||
assert(validated); | ||
@@ -196,10 +193,10 @@ i = 0; | ||
}); | ||
ud.update(200); | ||
ud.update(4); | ||
ud.update(4); | ||
ud.update(0); | ||
ud.update(0); | ||
ud.update(100); | ||
ud.update(100); | ||
ud.update(200); | ||
ud.updateUpstream(200); | ||
ud.updateUpstream(4); | ||
ud.updateUpstream(4); | ||
ud.updateUpstream(0); | ||
ud.updateUpstream(0); | ||
ud.updateUpstream(100); | ||
ud.updateUpstream(100); | ||
ud.updateUpstream(200); | ||
}); | ||
@@ -209,4 +206,4 @@ }); | ||
it('should map updates both ways', () => { | ||
let ds = new DataSource(123); | ||
let mapped = ds.mapDuplex( | ||
let ds = new DuplexDataSource(123); | ||
let mapped = ds.map( | ||
(v) => v + 10, | ||
@@ -216,14 +213,14 @@ (v) => v - 10 | ||
assert(mapped.value === 133); | ||
ds.update(100); | ||
ds.updateDownstream(100); | ||
assert(mapped.value === 110); | ||
ds.update(200); | ||
ds.updateDownstream(200); | ||
assert(mapped.value === 210); | ||
ds.update(300); | ||
ds.updateDownstream(300); | ||
assert(mapped.value === 310); | ||
mapped.update(100); | ||
mapped.updateUpstream(100); | ||
assert(ds.value === 90); | ||
mapped.update(200); | ||
mapped.updateUpstream(200); | ||
assert(ds.value === 190); | ||
mapped.update(300); | ||
mapped.updateUpstream(300); | ||
assert(ds.value === 290); | ||
@@ -233,20 +230,20 @@ }); | ||
it('should filter updates both ways', () => { | ||
let ds = new DataSource(123); | ||
let filtered = ds.filterDuplex((v) => v > 200); | ||
let ds = new DuplexDataSource(123); | ||
let filtered = ds.filter((v) => v > 200); | ||
assert(filtered.value === undefined); | ||
ds.update(100); | ||
ds.updateDownstream(100); | ||
assert(filtered.value === undefined); | ||
ds.update(200); | ||
ds.updateDownstream(200); | ||
assert(filtered.value === undefined); | ||
ds.update(300); | ||
ds.updateDownstream(300); | ||
assert(filtered.value === 300); | ||
filtered.update(100); | ||
filtered.updateUpstream(100); | ||
assert(ds.value === 300); | ||
filtered.update(200); | ||
filtered.updateUpstream(200); | ||
assert(ds.value === 300); | ||
filtered.update(350); | ||
filtered.updateUpstream(350); | ||
assert(ds.value === 350); | ||
}); | ||
}); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
3441240
349
122916