{"version":3,"file":"index.mjs","sources":["../../src/constants.ts","../../src/debug.ts","../../src/internal-state.ts","../../src/utils/is-function.ts","../../src/types/futures.ts","../../src/sources/observer-source.ts","../../src/types/internal.ts","../../src/utils/auto-value.ts","../../src/sources/object-source.ts","../../src/sources/event-listener-object-source.ts","../../src/utils/to-listener.ts","../../src/lib/drain.ts","../../src/sinks/termination-sink.ts","../../src/lib/lifts/arrayse.ts","../../src/lib/observature.ts","../../src/lib/addListener.ts","../../src/lifecycle/data-binding.ts","../../src/types/dom.ts","../../src/types/event-listener.ts","../../src/types/sink.ts","../../src/types/source.ts","../../src/definitions/boolean-attributes.ts","../../src/utils/input-pipe.ts","../../src/utils/curry.ts","../../src/sources/modifiers/active.ts","../../src/sources/modifiers/captive.ts","../../src/sources/modifiers/passive.ts","../../src/sources/all-source.ts","../../src/sources/autoform-source.ts","../../src/sources/checked-source.ts","../../src/sources/cut-source.ts","../../src/sources/dataset-source.ts","../../src/sources/numberset-source.ts","../../src/sources/event-data.ts","../../src/sources/event-target.ts","../../src/sources/form-data-source.ts","../../src/sources/keyboard-source.ts","../../src/sources/client-xy-source.ts","../../src/sources/offset-xy-source.ts","../../src/sources/last-touch-xy-source.ts","../../src/sources/swap-source.ts","../../src/sources/as-latest-from.ts","../../src/sources/value-source.ts","../../src/sinks/content-sink.ts","../../src/utils/camelCase.ts","../../src/sinks/dataset-sink.ts","../../src/sinks/append-html-sink.ts","../../src/sinks/blur-sink.ts","../../src/sinks/checked-sink.ts","../../src/lib/object-map.ts","../../src/sinks/classlist.sink.ts","../../src/sinks/class-sink.ts","../../src/sinks/closed-sink.ts","../../src/sinks/disabled-sink.ts","../../src/sinks/focus-sink.ts","../../src/sinks/hidden-sink.ts","../../src/sinks/inner-html-sink.ts","../../src/sinks/inner-text-sink.ts","../../src/sinks/readonly-sink.ts","../../src/sinks/removed-sink.ts","../../src/sinks/subtree-sink.ts","../../src/sinks/style-sink.ts","../../src/sinks/text-content-sink.ts","../../src/sinks/value-sink.ts","../../src/parser/sink-map.ts","../../src/sinks/attribute-sink.ts","../../src/sinks/error-sink.ts","../../src/sinks/mixin-sink.ts","../../src/sinks/json-dump-sink.ts","../../src/sinks/prepend-html-sink.ts","../../src/sinks/sanitize-html-sink.ts","../../src/sinks/suspense-sink.ts","../../src/custom-element.ts","../../src/lib/current-value.ts","../../src/sinks/index.ts","../../src/utils/chronolyze.ts","../../src/parser/parser.ts","../../src/index.ts"],"sourcesContent":["import type { RenderingScheduler } from './types/schedulers';\n\ndeclare global {\n  interface Window {\n    RMLREF: string;\n  }\n}\n\n// FIXME: Deprecate! This should not be stored/exposed this way!\nself.RMLREF='';\n\nexport const REF_TAG: string = 'RMLREF+';\nexport const REF_REGEXP: RegExp = /^RMLREF+\\d+$/;\n\n// custom attribute and corresponding selector to find just-mounted elements\n// that need any data binding\nexport const RESOLVE_ATTRIBUTE: string = 'resolve'; // keep lowercase for SVG\nexport const RESOLVE_SELECTOR: string = `[${RESOLVE_ATTRIBUTE}]`;\n\n// An equivalent of the \"debugger;\" JavaScript expression, for templates\nexport const RML_DEBUG: string = 'rml:debugger';\n\n// Special, non-printable Unicode characters to wrap interactive text nodes\n// letting Rimmel know they'll need to be rendered as Text Nodes in the DOM, for updates\nexport const INTERACTIVE_NODE_START = '\\u200B';\nexport const INTERACTIVE_NODE_END   = '\\u200C'; // FIXME: can't use this\n\nexport const SOURCE_TAG: string = 'source';\nexport const SINK_TAG: string = 'sink';\n\n// Use the new native Web Platform Observables instead of addEventListener when available\nexport var USE_DOM_OBSERVABLES: boolean = false;\nexport const set_USE_DOM_OBSERVABLES = ((x: boolean) => USE_DOM_OBSERVABLES = x);\n\nexport const SymbolObservature = Symbol.for('observature');\n\n// export var renderingScheduler = '../schedulers/ema-animation-frame';\nexport var renderingScheduler: RenderingScheduler | null = null;\nexport const setRenderingScheduler = (scheduler: RenderingScheduler) => renderingScheduler = scheduler; \n\n// export const configure = () => {\n// \treturn rml\n// }\n","// @ts-nocheck\nexport const ENABLE_RML_DEBUGGER: boolean =\n\t// If Vite (or another bundler) replaced the macro, this becomes a literal true/false.\n  (typeof __ENABLE_RML_DEBUGGER__ !== 'undefined'\n    ? __ENABLE_RML_DEBUGGER__\n    : true\n\t)\n;","import type { BindingConfiguration, SourceBindingConfiguration } from \"./types/internal\";\nimport type { RMLEventName } from \"./types/dom\";\nimport type { Subscription } from \"./types/futures\";\n\nimport { REF_TAG } from './constants';\n\nexport const waitingElementHandlers = <Map<string, BindingConfiguration[]>>new Map();\n// TODO: Test and verify with WeakRef/FinalizationRegistry\nexport const delegatedEventHandlers: WeakMap<Element, SourceBindingConfiguration<RMLEventName>[]> = new WeakMap();\nexport const subscriptions: Map<Node, Subscription[]> = new Map();\n// #REF49993849837451\n// export const listeners: WeakMap<Node, EventListener[]> = new WeakMap();\nexport const delegatedEvents = new Set();\n\n// FIXME: add a unique prefix to prevent collisions with different dupes of the library running in the same context/app\nexport const state = {\n\trefCount: 0,\n}\n\nexport const newRef = () => REF_TAG +state.refCount++;\n\n","export const isFunction = (fn: unknown): fn is Function =>\n    fn instanceof Function;\n","// import type { BehaviorSubject, Observable, Observer, Subject, Subscription } from 'rxjs';\n// export type { BehaviorSubject, Observable, Observer, OperatorFunction, Subject, Subscription } from 'rxjs';\nimport type { OperatorFunction } from 'rxjs';\n\nimport { SymbolObservature } from \"../constants\";\nimport { isFunction } from '../utils/is-function';\n\nexport type Subject<T> = {\n\tsubscribe: (observer: ObserverFunction<T>) => Subscription;\n\tpipe: (value: T) => void;\n\tnext: (value: T) => void;\n\terror?: (error: unknown) => void;\n\tcomplete?: () => void;\n\t// impl. detaiils\n\tsource: Observable<T>;\n\tdestination: Observable<T>;\n};\n\nexport type BehaviorSubject<T> = Subject<T> & {\n\tgetValue: () => T;\n\tvalue: T;\n};\n\ntype UnaryOperator<I, O> = OperatorFunction<I, O>;\n\nexport type OperatorPipeline<I, O, _Ops extends OperatorFunction<any, any>[] = OperatorFunction<any, any>[]> =\n\tUnaryOperator<any, any>[];\n\n// export type OperatorPipeline<I, O> = \n//   [] |\n//   [OperatorFunction<I, infer M>, ...OperatorPipeline<M, O>] |\n//   [OperatorFunction<I, O>]\n// ;\n// export type OperatorFunction<T, R> = (source: Observable<T>) => Observable<R>;\n// export type OperatorPipeline<I, O, N = O> = [OperatorFunction<I, N>, ...(OperatorPipeline<N, O>[])];\n// export type OperatorPipeline<T> = T extends [infer FIRST, ...infer REST] ? [FIRST, ...OperatorPipeline<REST>] : [];\n// export type OperatorPipeline<I, M, O> = I extends [infer FIRST, ...infer REST] ? [OperatorFunction<I, N>, ...OperatorPipeline<N, REST>] : [];\n// export type OperatorPipeline<I, O> = I extends OperatorFunction<I, infer M> && O extends [...infer REST] ? [OperatorFunction<I, M>, ...OperatorPipeline<M, REST>] : [];\n\n// export type OperatorPipeline<I, M, O> = I extends [infer FIRST, ...infer REST]\n//   ? [OperatorFunction<FIRST, M>, ...OperatorPipeline<REST, M, O>]\n//   : [];\n\n////////////////////////////////////////////////////////\n// import { map, type OperatorFunction } from 'rxjs';\n// export type OperatorPipeline<I, O=I> =\n//   I extends OperatorFunction<I, infer M>\n//     ? [OperatorFunction<I, M>, ...OperatorPipeline<M, O>]\n//     : [OperatorFunction<I, O>];\n\n\n// const p: OperatorPipeline<Event, number> = [\n//     map((e: Event)=>(<HTMLInputElement>e.target).value),\n//     map((s: string)=>s.toUpperCase()),\n//     map((s: string)=>s.length),\n// ];\n\n\n\n// type OperatorPipeline<I, O=I> =\n//   [] |\n//   [OperatorFunction<I, O>] |\n//   [I, O] extends [infer FIRST, ...infer REST] \n//     ? FIRST extends OperatorFunction<I, infer M>\n//       ? REST extends OperatorFunction<M, O>\n//         ? [OperatorFunction<I, M>, ...OperatorPipeline<M, O>]\n//         : never\n//       : never\n//     : never\n\n//////////////////////////// \n// import { map, type OperatorFunction } from 'rxjs';\n// \n// // GPT 4o1\n// type OperatorPipeline<I, O = I> =\n//   [] |\n//   [OperatorFunction<I, O>] |\n//   (\n//     // Introduce a temporary tuple type T to match against\n//     // rather than trying to match <I, O> directly\n//     (<T extends OperatorFunction<any, any>[]>() => T extends [OperatorFunction<I, infer M>, ...infer REST]\n//       ? REST extends OperatorFunction<M, O>[]\n//         ? [OperatorFunction<I, M>, ...OperatorPipeline<M, O>]\n//         : never\n//       : never\n//     ) extends infer R ? R : never\n//   );\n// \n// \n// \n// \n\n// const p = [\n//     map((e: Event)=>(<HTMLInputElement>e.target).value),\n//     map((s: string)=>s.toUpperCase()),\n//     map((s: string)=>s.length),\n// ] as OperatorPipeline<Event, number>;\n// const x = new Subject().pipe(...p).subscribe(console.log);\n////////////////////////////////////////////////////////\n\nexport type ObserverFunction<T> = (value: T) => void;\nexport type ObserverErrorFunction = (e: unknown) => void;\nexport type ObserverCompleteFunction = () => void;\n\nexport type Observer<I> = Partial<{\n\tnext?: ObserverFunction<I>;\n\terror?: ObserverErrorFunction;\n\tcomplete?: ObserverCompleteFunction;\n}>;\n\n/**\n * Anything that can consume data from an Observable,\n * which can be either an Observer, or a plain function.\n */\nexport type Consumer<T> = ObserverFunction<T> | Observer<T>;\nexport type Drain<T> = ObserverFunction<T> | Observer<T>;\n\nexport interface Observature<I, O=I> {\n\t[SymbolObservature]: any,\n\taddSource: <I>(source: Observable<I>) => void,\n}\n\nexport type Subscription = {\n\tunsubscribe: () => void;\n};\n\nexport type Observable<T> = {\n\tsubscribe: (observer: Observer<T> | ObserverFunction<T>, error?: ObserverErrorFunction, complete?: ObserverCompleteFunction) =>\n\t\tSubscription;\n};\n\nexport const isObserver = (x: any): x is Observer<any> =>\n\t// FIXME: it should actually be x?.next || x?.error || x?.complete\n\t!!x?.next || isFunction(x);\n\n// export type Subscription = {\n// \tdestination: any; // FIXME HACK: an internal RxJS property, not to be relied upon\n//     unsubscribe: () => void;\n// };\n\n/**\n * An in-out stream, also known as an Observable Subject\n * that's both an Observable and an Observer\n * @template I the input type\n * @template O the output type\n */\n// TODO: migrate to using rzjs-provided Streams\nexport type Stream<I, O=I> = Observer<I> & Observable<O>;\n\n// A whole pass-through pipeline\nexport type Transformer<I, O> = Observer<I> & {\n    subscribe: (observer: ObserverFunction<O>) => Subscription;\n};\n\nexport const isObservable = (x: any): x is Observable<any> =>\n\t!!x?.subscribe\n;\n\nexport const isPromise = (x: any): x is Promise<any> =>\n\t!!x?.then\n;\n\nexport const isFuture = (x: any): x is Future<any> =>\n\tisPromise(x) || isObservable(x)\n;\n\nexport type MaybePromise<T> = Partial<Promise<T>>;\nexport type MaybeObserver<I> = Partial<Observer<I>>;\nexport type MaybeSubscription = Partial<Subscription>;\nexport type MaybeObservable<T> = Partial<Observable<T>>;\nexport type MaybeSubject<T> = Partial<Subject<T>>;\nexport type MaybeBehaviorSubject<T> = Partial<BehaviorSubject<T>>;\nexport type MaybeTransformer<I, O> = Partial<Transformer<I, O>>;\n\n/**\n * A future type such as a  Promise or an Observable\n **/\nexport type Future<T> = Promise<T> | Observable<T>;\n\n/**\n * Any type that's not a Future (e.g.: not a Promise and not an Observable)\n **/\nexport type Present<T> = T extends Future<any> ? never : T;\n\nexport type MaybeFuture<T> = Present<T> | Future<T>;\n","import type { Observature, Observer } from \"../types/futures\";\nimport type { RMLTemplateExpression } from \"../types/internal\";\nimport { isFunction } from \"../utils/is-function\";\n\nimport { SymbolObservature } from \"../constants\";\n\nexport interface ObserverSourceHandler {\n    next: (value: unknown) => void;\n};\n\nexport interface ObservatureSourceHandler extends ObserverSourceHandler {\n};\n\n/**\n * Checks whether the provided template expression is an Observer (Rx Subscribable)\n * @param expression a template expression to check\n * @returns is ObserverSourceHandler\n */\nexport const isObserverSource = (expression: RMLTemplateExpression): expression is ObserverSourceHandler =>\n    isFunction((<Observer<unknown>>expression)?.next);\n\n/**\n * A data source that connects to and feeds an Observer stream or RxJS Subject\n * \n * @param handler an Observer stream or RxJS Subject\n * @returns \n */\nexport const ObserverSource = (handler: ObserverSourceHandler) => handler.next.bind(handler);\n// TODO: we used to just chain handler.next?.bind(handler) ?? .... rather than these type guards. Can we still, somehow?\n\nexport const isObservatureSource = (expression: RMLTemplateExpression): expression is ObservatureSourceHandler =>\n    /* @ts-ignore */\n    expression?.Observature || (<Observature<any>>expression)[SymbolObservature]\n;\n\nexport const ObservatureSource = (handler: ObservatureSourceHandler) => handler;\n","import type { BooleanAttribute } from \"../definitions/boolean-attributes\";\nimport type { CSSClassName, CSSObject, CSSValue } from \"./style\";\nimport type { CSSString, EventListenerOrEventListenerObject, EventType, HTMLString } from \"./dom\";\nimport { isFuture, ObserverFunction, type Future, type MaybeFuture, type Observable, type Observer, type Subject } from \"./futures\";\nimport type { RenderingScheduler } from \"./schedulers\";\nimport type { RMLEventName, RMLEventAttributeName } from \"./dom\";\nimport type { Sink } from \"./sink\";\n\nimport { ObjectSourceExpression, TargetObject } from \"../sources/object-source\";\nimport { isFunction } from \"../utils/is-function\";\nimport { isObserverSource } from \"../sources/observer-source\";\n\nexport type ErrorHandler = (e: Error) => void;\n\n/**\n * Data binding configuration for event sources or data sinks\n *\n * @remarks Used to describe a binding between a source and a sink when mounting a template\n * effectively telling Rimmel where to bind what on mount\n */\nexport interface BindingConfiguration {\n\ttype: 'source' | 'sink';\n};\n\n/**\n * An object that specifies how to bind an EventTarget to an event handler.\n *\n * Objects of this type are normally created by Source functions or\n * by the Rimmel parser based on the context\n */\nexport interface SourceBindingConfiguration<T extends RMLEventName> {\n\ttype: 'source';\n\tlistener: EventListenerOrEventListenerObject<EventType<T>> | Observer<EventType<T>>;\n\toptions?: AddEventListenerOptions;\n\teventName: RMLEventName;\n\t// error?: EventListener;\n\t// termination?: EventListener;\n};\n\n/**\n * This tells Rimmel how to sink a Promise or an Observable to the DOM.\n * Objects of this type are normally returned by Sink functions, or chosen\n * automatically by the Rimmel parser based on the context\n * ## Examples\n *\n * ### Set the value of a textbox from a Promise\n *\n * Here when the Promise resolves, the value of the text box will be set\n *\n * ```ts\n * const p = new Promise(resolve => setTimeout(() =>resolve('hello'), 2000));\n * const template = rml`\n *   <input value=\"${p}\">\n * `;\n */\nexport interface SinkBindingConfiguration<E extends Element = Element> extends BindingConfiguration {\n\t// FIXME: use symbols to avoid potential conflicts with certain objects\n\t// TODO: also make use of transferable symbols that can traverse a server|client boundary\n\ttype: 'sink';\n\tt: string;\n\tsource: Future<unknown>;\n\tsink: Sink<E>;\n\ttextNodeOnly?: boolean;\n\tscheduler?: RenderingScheduler;\n\tparams?: any;\n\terror?: ErrorHandler;\n\ttermination?: () => void;\n};\n\n// export type Empty = MaybeFuture<undefined | null | ''>;\n// export type BindingConfigurationType<T> = T extends SinkBindingConfiguration<infer Q> ? SinkBindingConfiguration<Q> : SourceBindingConfiguration<infer Z>;\nexport const isSinkBindingConfiguration = (b: unknown): b is SinkBindingConfiguration<any> => (b as SinkBindingConfiguration<any>)?.type == 'sink';\nexport const isSourceBindingConfiguration = (b: unknown): b is SourceBindingConfiguration<any> => (b as SourceBindingConfiguration<any>)?.type == 'source';\n\nexport const isSourceExpression = <T>(e: unknown): e is RMLTemplateExpressions.SourceExpression<T> => isFunction(e) || isObserverSource(e);\n/**\n * An Object's property or an Array's index\n */\nexport type property = string | number | symbol;\nexport type QuerySelectorString = string;\nexport type SourceAttributeName = RMLEventAttributeName;\nexport type SinkAttributeName<T = string> = T extends RMLEventAttributeName ? never : string;\nexport type AttributeName = SourceAttributeName | SinkAttributeName;\n\nexport type _SinkAttributeValue = boolean | string | number | null | undefined | Function | { [key: string]: _SinkAttributeValue };\nexport type PresentSinkAttributeValue = _SinkAttributeValue;\nexport const isPresentSinkAttributeValue = (value: any): value is PresentSinkAttributeValue => !isFuture(value)\nexport type FutureSinkAttributeValue = Future<_SinkAttributeValue>;\nexport const isFutureSinkAttributeValue = (value: any): value is FutureSinkAttributeValue => isFuture(value)\n// TODO: Rename... e.g.: DiachronicAttributeValue?\nexport type SinkAttributeValue = PresentSinkAttributeValue | FutureSinkAttributeValue;\n\nexport type SourceAttributeValue = Observer<any> | Function;\n\nexport type AttributeValue = SinkAttributeValue | SourceAttributeValue;\n\nexport type AttributeObject = {\n\t[K in string]: K extends SourceAttributeName ? SourceAttributeValue : SinkAttributeValue;\n};\n\nexport type DOMSubtreeObject = {\n\t[K in QuerySelectorString]: AttributeObject;\n};\n\nexport namespace RMLTemplateExpressions {\n\t/**\n\t * An HTML Subtree\n\t */\n\texport type Node = MaybeFuture<HTMLString>;\n\t/**\n\t * The value of an HTML attribute\n\t */\n\texport type AttributeValue = MaybeFuture<number | string | boolean>;\n\t/**\n\t * The value of a boolean HTML attribute\n\t */\n\t// export type BooleanAttributeValue = MaybeFuture<boolean | 'true' | (typeof BOOLEAN_ATTRIBUTES extends Set<infer T> ? T : never)>;\n\t// export type BooleanAttributeValue<T extends keyof typeof BOOLEAN_ATTRIBUTES> = MaybeFuture<boolean | T | 'true'>;\n\t// export type BooleanAttributeValue<T extends keyof typeof BOOLEAN_ATTRIBUTES> = MaybeFuture<boolean | T | 'true'>;\n\t// export type BooleanAttributeValue = BooleanAttribute;\n\texport type BooleanAttributeValue<T extends BooleanAttribute> = MaybeFuture<boolean | T | 'true'>;\n\n\texport type EnumAttributeValue<T extends 'hidden'> = MaybeFuture<T | boolean | 'true' | 'false' | 'until-found'>;\n\n\n\t/**\n\t * One or more class names\n\t */\n\texport type ClassName = MaybeFuture<CSSClassName | CSSClassName[]>;\n\t/**\n\t * A Record of class names to set or clear\n\t */\n\texport type ClassObject = MaybeFuture<Record<CSSClassName, boolean>>;\n\n\t/**\n\t * A simple HTML string or a Future resolving to it\n\t */\n\texport type HTMLText = MaybeFuture<HTMLString>;\n\texport type TextString = MaybeFuture<string | number>;\n\texport type StringLike = MaybeFuture<string | number | Array<string | number>>;\n\n\texport type POJO = ObjectSourceExpression<TargetObject>;\n\t/**\n\t * A CSS declaration \"property: value;\" string\n\t */\n\texport type CSSStyleDeclaration = MaybeFuture<CSSString | CSSObject>;\n\texport type CSSStyleValue<T extends keyof CSSStyleDeclaration> = MaybeFuture<CSSValue<T>>;\n\texport type Mixin<E extends Element = Element> = MaybeFuture<AttributeObject>;\n\texport type EventHandler<T extends RMLEventName = any> = EventListenerOrEventListenerObject<EventType<T>> | Observer<EventType<T>>;\n\texport type GenericHandler = BindingConfiguration;\n\n\t// Implicit Source\n\texport type SourceExpression<T> = Observer<T> | ((t: T) => void) | undefined;\n\n\texport type SinkExpression = Sink<Element | Text>;\n\t// export type Empty = MaybeFuture<undefined | null | ''>;\n\n\texport type TargetEventHandler<T> =\n\t\t| ((data: T) => void)\n\t\t| ObserverFunction<T>\n\t\t| Observer<T>\n\t\t| undefined\n\t\t;\n\n\t/**\n\t * A valid RML template expression which can be:\n\t * - a static value, when no data binding is required (e.g.: a string)\n\t * - an event handler function\n\t * - an event handler object\n\t * - an event handler stream (e.g.: an Observer)\n\t * - a custom event source\n\t * - a data sink\n\t**/\n\texport type Any =\n\t\t| Node\n\t\t| AttributeValue\n\t\t| BooleanAttributeValue<any>\n\t\t| ClassName\n\t\t| ClassObject\n\t\t| CSSStyleDeclaration\n\t\t// | CSSStyleValue\n\t\t| Mixin\n\t\t| EventHandler\n\t\t| POJO\n\t;\n};\n\nexport type RMLTemplateExpression =\n\t| RMLTemplateExpressions.AttributeValue\n\t| RMLTemplateExpressions.BooleanAttributeValue<any>\n\t| RMLTemplateExpressions.ClassName\n\t| RMLTemplateExpressions.ClassObject\n\t| RMLTemplateExpressions.CSSStyleDeclaration\n\t// | RMLTemplateExpressions.CSSStyleValue<T extends keyof CSSStyleDeclaration>\n\t| RMLTemplateExpressions.EventHandler\n\t| RMLTemplateExpressions.HTMLText\n\t| RMLTemplateExpressions.HTMLText[]\n\t| RMLTemplateExpressions.TextString\n\t| RMLTemplateExpressions.TextString[]\n\t| RMLTemplateExpressions.Mixin\n\t| RMLTemplateExpressions.Node\n\t| RMLTemplateExpressions.POJO\n\t| BindingConfiguration\n;\n\n/**\n * A RML template expression\n *\n * This includes anything that can be passed in RML templates, such as\n * - static values (strings, numbers, booleans)\n * - event handlers (functions, Observers, Subjects, Behaviors)\n * - CSS class names (strings, objects)\n * - CSS style declarations (strings, objects)\n * - HTML text (strings, arrays of strings, Promises, Observables)\n * - Attribute Mixins (Objects, Promises, Observables)\n * - Custom sources (e.g. ObjectSourceExpression)\n * - Custom sinks (e.g. SinkBindingConfiguration)\n * - and more\n */\n\nexport type Handler<E extends Element, T extends RMLEventName = any> =\n\t| undefined\n\t| number\n\t| string\n\t| boolean\n\t// | ObjectSourceExpression\n\t| Record<AttributeName, AttributeValue>\n\t| CSSClassName\n\t| Function\n\t| Sink<E>\n\t| Subject<EventType<T>>\n\t| Observable<unknown>\n\t| Promise<unknown>\n\t| Observer<unknown>\n\t| BindingConfiguration\n;\n\nexport type Inputs = Record<string, RMLTemplateExpression>;\nexport type Effects = Record<string, any>;\n/**\n * A Rimmel Component\n *\n * A plain function that takes an object of named input parameters and returns a present or future HTML string\n * @param inputs also referred to as \"Props\" in other frameworks, a simple object containing all parameters of the Component. Those can be static values, Promises, Observables, Event Handlers, literally anything the Component wants to use\n **/\nexport type RimmelComponent = (...inputs: Inputs[]) => HTMLString | Future<HTMLString>;\n\n","import { HTMLFieldElement } from \"../types/dom\";\n\nconst DataMappers = {\n\t  'text' : (x: string) => x,\n\t'number' : (x: string) => Number(x),\n\t  'date' : (x: string) => new Date(x),\n} as const;\n\nconst ElementMappers = {\n\t           'text' : (e: HTMLInputElement)  => e.value ?? e.innerText,\n\t         'number' : (e: HTMLInputElement)  => e.valueAsNumber,\n\t          'range' : (e: HTMLInputElement)  => e.valueAsNumber,\n\t           'date' : (e: HTMLInputElement)  => e.valueAsDate,\n\t 'datetime-local' : (e: HTMLInputElement)  => new Date(e.value),\n\t       'checkbox' : (e: HTMLInputElement)  => e.checked,\n\t          'radio' : (e: HTMLInputElement)  => e.checked && (DataMappers[e.dataset.type as keyof typeof DataMappers]?.(e.value) ?? e.value) || undefined,\n\t     'select-one' : (e: HTMLSelectElement) => DataMappers[(e.options[e.selectedIndex].dataset.type ?? e.dataset.type) as keyof typeof DataMappers]?.(e.value) ?? e.value,\n\t'select-multiple' : (e: HTMLSelectElement) => [...e.options].filter(o => o.selected).map(o => (DataMappers[o.dataset.type as keyof typeof DataMappers ?? e.dataset.type as keyof typeof DataMappers] ?? DataMappers.text)(o.value)),\n} as const;\n\n/**\n * Get the value of an <input> element matching its type:\n * boolean, number, date or string,\n * or innerText if it's any other (e.g.: [contenteditable]) element\n **/\nexport const autoValue = (e: HTMLFieldElement) =>\n\t(ElementMappers[(e.type ?? (e as HTMLFieldElement).dataset?.type) as keyof typeof ElementMappers] ?? ElementMappers.text)\n\t\t(e as HTMLInputElement & HTMLSelectElement)\n;\n\n","import type { EventListenerFunction } from \"../types/dom\";\nimport type { RMLTemplateExpression } from \"../types/internal\";\nimport type { Source } from '../types/source';\n\nimport { autoValue } from '../utils/auto-value';\n\nexport type ObjectKey = string | number;\nexport type TargetObject = object | Array<any>; // Record<string, unknown>;\nexport type ObjectSourceExpression<T extends TargetObject> = [key: keyof T, target: T];\n\n/**\n * @deprecated don't use\n **/\nexport const isObjectSource =\n\t<T extends TargetObject>\n\t(expression: RMLTemplateExpression): expression is ObjectSourceExpression<T> =>\n\t\tArray.isArray(expression) && expression.length == 2\n;\n\n/**\n * A data source that updates an object's property from an &lt;input&gt; element when \n * a certain event occurs\n * @param key an ['property', object] or [index, array] pair to update\n * @returns A data source\n * @example <input oninput=\"${[obj, 'property']}\">\n * @example <input oninput=\"${ObjectSource('property', obj)}\">\n * @example <input oninput=\"${ObjectSource(4, arr)}\">\n */\nexport const ObjectSource =\n\t<E extends Event, T extends TargetObject>\n\t(key: keyof T, targetObject?: T) => {\n\t\tconst handler = ((targetObject: T, e: E) => {\n\t\t\ttargetObject[key] = autoValue(e.target as HTMLInputElement) as T[keyof T];\n\t\t});\n\n\t\treturn (targetObject\n\t\t\t? handler.bind(null, targetObject) as EventListenerFunction<E>\n\t\t\t: (t2: T)=>(handler.bind(null, t2) as EventListenerFunction<E>)\n\t\t);\n\t}\n;\n\n/**\n * An Event Adapter that uses an event's underlying &lt;input&gt; element\n * to updates an object's property or an array item.\n * @param property A property to update in the given object or an index to update in the given array\n * @param object The object or array to update\n * @returns An event handler\n */\nexport const Update =\n\t<E extends Element, T extends TargetObject, I extends Event, O extends never>\n\t(property: keyof T, object?: T): ((t2: T) => EventListenerFunction<I>) | EventListenerFunction<I> | Source<I, O> =>\n\t\tObjectSource<I, T>(property, object)\n;\n\nexport const asObjectSource = ObjectSource;\nexport const AsObjectSource = ObjectSource;\n","import type { Observature, Observer } from \"../types/futures\";\nimport type { RMLTemplateExpression } from \"../types/internal\";\nimport { isFunction } from \"../utils/is-function\";\n\nexport interface EventListenerObject {\n\thandleEvent: (value: unknown) => void;\n};\n\n/**\n * Checks whether the provided template expression is an EventListenerObject\n * @param expression a template expression to check\n * @returns is EventListenerObject\n */\nexport const isEventListenerObjectSource = (expression: RMLTemplateExpression): expression is EventListenerObject =>\n\texpression?.handleEvent\n;\n\n/**\n * A data source that connects to and feeds an EventListenerObject via its handleEvent method\n * @param handler an Observer stream or RxJS Subject\n * @returns \n */\nexport const EventListenerObjectSource = (handler: EventListenerObject) => handler.handleEvent.bind(handler);\n// TODO: we used to just chain handler.handleEvent?.bind(handler) ?? .... rather than these type guards. Can we still, somehow?\n\n","import { isObjectSource, ObjectSource, ObjectSourceExpression } from \"../sources/object-source\";\nimport { isObserverSource, ObserverSource } from \"../sources/observer-source\";\nimport { isEventListenerObjectSource, EventListenerObjectSource } from \"../sources/event-listener-object-source\";\nimport { EventListenerFunction } from \"../types/dom\";\nimport { RMLTemplateExpression } from \"../types/internal\";\nimport { isFunction } from \"./is-function\";\n\n/**\n * Convert a function, Observer or Observature to a listener function.\n * @param expression RMLTemplateExpression\n * @returns function | null a callable event listener function\n */\nexport const toListener = (expression: RMLTemplateExpression): EventListenerFunction | null =>\n    // FIXME: too similar to callable. Merge them\n    isObserverSource(expression) ? ObserverSource(expression)\n    : isFunction(expression) ? expression\n    : isEventListenerObjectSource(expression) ? EventListenerObjectSource(expression)\n    : isObjectSource(expression) ? ObjectSource(...(expression as ObjectSourceExpression<typeof expression[1]>))\n    : null // We allow it to be empty. If so, ignore, and don't connect any source. Perhaps add a warning in debug mode?\n;\n","import type { SinkFunction } from \"../types/sink\";\nimport type { EventListenerObject, EventListener, EventListenerFunction } from \"../types/dom\";\nimport type { Consumer, MaybeFuture, Observable, Observer, ObserverErrorFunction, ObserverFunction } from \"../types/futures\";\nimport type { RenderingScheduler } from \"../types/schedulers\";\n\nimport { isObservable, isPromise } from \"../types/futures\";\nimport { subscriptions } from \"../internal-state\";\n// import renderingScheduler from '../schedulers/ema-animation-frame';\nimport { toListener } from \"../utils/to-listener\";\n\n// TODO: what if we have a promise resolving to an observable or the other way around?\n// Those atypical combinations may not be automatically flattened...\n\n/**\n * Return the \"callable\" part of an entity:\n * - the next method of an Observer\n * - the handleEvent method of an EventListenerObject\n * - the function itself, if it's a function\n */\nexport const callable = <T>(x: (Observer<T> | EventListenerObject<T> | ObserverFunction<T>)) =>\n\t(x as Observer<T>).next ? (x as Observer<T>).next.bind(x) :\n\t(x as EventListenerObject<T>).handleEvent ? (x as EventListenerObject<T>).handleEvent.bind(x) :\n\t(x as (t: T)=>any)\n;\n\nexport const asap = <T>(target: Consumer<T>, source: MaybeFuture<unknown>) => {\n\t(<Observable<T>>source)?.subscribe?.(target) ??\n\t(<Promise<T>>source)?.then?.(((target as Observer<T>).next as ObserverFunction<T>)?.bind(target) ?? target) ??\n\t(target as ObserverFunction<T>)(source as T);\n};\n\n/**\n * Connect an event source to a sink through any compatible interface on any optionally specified scheduler\n * @param node The node on which the binding is set\n * @param source A Promise, Observable or EventEmitter\n * @param next A \"next\" or \"then\" handler on the sink side\n * @param error? An error handler on the sink side\n * @param complete? a finalisation function\n */\nexport const subscribe = // TODO: rename to bindEvent or something that implies this is for element events\n\t<T extends Event>\n\t(node: Node, source: MaybeFuture<T>, next: EventListener<T>, error?: ObserverErrorFunction, complete?: () => void, scheduler?: RenderingScheduler) => {\n\t\t// TODO: make this a plugin, in case people don't use handleEvent...\n\t\tconst flattenedNext = toListener(next);\n\t\tconst task = scheduler?.(node, <SinkFunction>flattenedNext) ?? flattenedNext;\n\n\t\tif (isObservable(source)) {\n\t\t\t// TODO: should we handle promise cancellations (cancellable promises?) too?\n\t\t\tconst subscription = source.subscribe({\n\t\t\t\tnext: <EventListenerFunction>task,\n\t\t\t\terror,\n\t\t\t\tcomplete,\n\t\t\t});\n\n\t\t\tsubscriptions.get(node)?.push(subscription) ?? subscriptions.set(node, [subscription]);\n\n\t\t\treturn subscription;\n\t\t} else if (isPromise(source)) {\n\t\t\tsource.then(<EventListenerFunction>task, error).finally(complete);\n\t\t} else {\n\t\t\t// TODO: should we handle function cancellations (removeEventListener) too?\n\t\t\t(<EventListenerFunction>task)(source);\n\t\t}\n\t}\n;\n","// TODO: what should happen (if anything at all?) when an observable terminates?\n// Remove the node?\n// Emit empty?\n//const terminationSink = (node)   => node.remove();\n\n\n// FIXME: This might not even be a Sink...\n\n/**\n * Experimental sink for terminating observables\n */\nexport const terminationHandler = () => {\n\t// console.debug('Rimmel: NOOP termination sink called', data);\n};\n","/**\n * Lift any MaybeValue or MaybeArray to an Array, skipping SoftNull (null/undefined)\n * @param x Maybe value (a value, or null/undefined)\n * @returns Array of values.\n * If x is null/undefined, returns an empty array.\n * If x is an array, returns x.\n * If x is a value, returns an array containing x\n */\nexport const arrayse = <T>(...x: (T | T[] | null | undefined)[]): T[] =>\n\t([] as T[]).concat(...x.map(x=>x ?? []))\n;\n","// @ts-nocheck\n\nimport type { Observable as Observable1, Observer } from '../types/futures';\nimport type { MonkeyPatchedObservable as Observable2 } from '../types/monkey-patched-observable';\nimport { SymbolObservature } from '../constants';\nimport { arrayse } from './lifts/arrayse';\n\ntype Observable<T> = Observable1<T> | Observable2<T>;\ntype OperatorPreload = [string, unknown[]];\n\nexport interface IObservature<I, O=I> {\n\tvalue: O;\n\tObservature: true;\n\t[SymbolObservature]: true;\n\taddSource: (source: Observable<I>) => void;\n\tnext: (value: O) => void;\n\terror: (error: unknown) => void;\n\tcomplete: () => void;\n\tsubscribe: (observer: Observer<O>) => void;\n}\n\nexport const CreateObservature = <I, O>(initial?: O) => {\n\tlet sources: Observable<I>[] = [];\n\tlet subscribers: Observer<O>[] = [];\n\n\tconst operators = <OperatorPreload[]>[];\n\tconst output = new Observable<O>((observer: Observer<O>) => {\n\t\tsubscribers.push(observer);\n\t\treturn {\n\t\t\tunsubscribe: () => {\n\t\t\t\tsubscribers = subscribers.filter(sub => sub !== observer);\n\t\t\t}\n\t\t};\n\t});\n\n\tconst applyPipeline = (source: Observable<any>) => {\n\t\tconst pipeline = operators.reduce((obs, [prop, args]: OperatorPreload) => obs[prop](...args), source);\n\t\treturn pipeline.subscribe({\n\t\t\tnext: (val: O) => subscribers.forEach(sub => sub.next?.(val) ?? sub(val)),\n\t\t\terror: (error: unknown) => subscribers.forEach(sub => sub.error?.(error) ?? sub(error)),\n\t\t\tcomplete: () => subscribers.forEach(sub => sub.complete?.())\n\t\t});\n\t};\n\n\treturn new Proxy(output, {\n\t\tget(target, prop) {\n\t\t\tswitch(prop) {\n\t\t\t\tcase 'value':\n\t\t\t\t\treturn initial;\n\n\t\t\t\tcase Symbol.for('observable'):\n\t\t\t\tcase '@@observable':\n\t\t\t\t\treturn function() { return this };\n\n\t\t\t\tcase '@@Observature':\n\t\t\t\tcase 'Observature':\n\t\t\t\tcase SymbolObservature:\n\t\t\t\t\treturn true;\n\n\t\t\t\tcase 'addSource':\n\t\t\t\t\treturn (_source: Observable<I>) => {\n\t\t\t\t\t\tsources.push(_source);\n\t\t\t\t\t\treturn target;\n\t\t\t\t\t}\n\n\t\t\t\tcase 'type':\n\t\t\t\t\treturn undefined;\n\n\t\t\t\tcase 'next':\n\t\t\t\t\treturn (value: O) => applyPipeline(Observable.from([value]));\n\n\t\t\t\tcase 'error':\n\t\t\t\t\treturn (error: unknown) => subscribers.forEach(sub => sub.error?.(error) ?? sub(error));\n\n\t\t\t\tcase 'complete':\n\t\t\t\t\treturn () => subscribers.forEach(sub => sub.complete?.());\n\n\t\t\t\tcase 'subscribe':\n\t\t\t\t\treturn (_observer: Observer<O>) => {\n\t\t\t\t\t\tsubscribers.push(_observer);\n\t\t\t\t\t\tconst starter = Observable.merge(...(<Observable<I>[]>[]).concat(sources, initial ? Observable.from(arrayse(initial)) : <Observable<I>[]>[]));\n\t\t\t\t\t\tconst subscription = applyPipeline(starter);\n\t\t\t\t\t\tif(initial !== undefined) {\n\t\t\t\t\t\t\tsubscribers.forEach(sub => sub.next?.(initial));\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn subscription;\n\t\t\t\t\t}\n\n\t\t\t\tdefault:\n\t\t\t\t\tif(Observable.prototype.hasOwnProperty(prop)) {\n\t\t\t\t\t\treturn function(...args: (keyof Observable<I>)[]) {\n\t\t\t\t\t\t\t// FIXME: this should return a new Observature\n\t\t\t\t\t\t\t// (or a separate pipeline rather than modifying the original?)\n\t\t\t\t\t\t\t// we still want to keep the same sources\n\t\t\t\t\t\t\toperators.push(<OperatorPreload>[prop, args]);\n\t\t\t\t\t\t\treturn this;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\treturn (target as any)[prop];\n\t\t\t}\n\t\t}\n\t}) as unknown as IObservature<I, O>;\n};\n\nexport class Observature<I, O>{\n\tconstructor(initial: O) {\n\t\treturn CreateObservature(initial);\n\t}\n};\n\nexport const isObservature = <I, O>(x: any): x is IObservature<I, O> =>\n\tx?.Observature || x[SymbolObservature]\n;\n","import { RMLEventName } from \"../types\";\nimport { IObservature, isObservature } from \"./observature\";\nimport { USE_DOM_OBSERVABLES } from \"../constants\";\nimport { MonkeyPatchedObservable } from \"../types/monkey-patched-observable\";\nimport { RMLEventListener } from \"../types/event-listener\";\nimport { toListener } from \"../utils/to-listener\";\n\nconst isEventListenerObject = (l: any): l is EventListenerObject => !!l?.handleEvent;\n\nexport const addListener = (node: EventTarget, eventName: RMLEventName, listener: RMLEventListener, options?: AddEventListenerOptions | boolean) => {\n\t// We also force-add an event listener if we're inside a ShadowRoot (do we really need to?), as events inside web components don't seem to fire otherwise\n\tif (USE_DOM_OBSERVABLES && (node as any).when) {\n\t\t// Explicitly excluding the isEventListenerObject as Domenic doesn't want .when() to support it\n\t\tif (!isEventListenerObject(listener)) {\n\t\t\tconst source = (node as any).when(eventName, <ObservableEventListenerOptions | undefined>options);\n\t\t\tif (isObservature(listener)) {\n\t\t\t\t(<IObservature<Event>>listener).addSource(source as MonkeyPatchedObservable<Event>);\n\t\t\t} else {\n\t\t\t\t// TODO: Add AbortController\n\t\t\t\tsource.subscribe(listener);\n\t\t\t}\n\t\t}\n\t} else {\n\t\tnode.addEventListener(eventName, toListener(listener), <EventListenerOptions | undefined>options);\n\t\t// #REF49993849837451\n\t\t// const listenerRef = [eventName, sourceBindingConfiguration.listener, sourceBindingConfiguration.options];\n\t\t// node.addEventListener(...listenerRef);\n\t\t// listeners.get(node)?.push?.(listenerRef) ?? listeners.set(node, [listenerRef]);\n\t}\n\n\tif (/^(?:rml:)?mount/.test(eventName)) {\n\t\t// Will this need to bubble up? (probably no)\n\t\tsetTimeout(() => node.dispatchEvent(new Event(eventName)));\n\t}\n};\n","import type { RMLEventName } from \"../types/dom\";\nimport type { SourceBindingConfiguration } from \"../types/internal\";\n\nimport { INTERACTIVE_NODE_START, INTERACTIVE_NODE_END, RESOLVE_ATTRIBUTE, RESOLVE_SELECTOR, RML_DEBUG, USE_DOM_OBSERVABLES } from \"../constants\";\nimport { ENABLE_RML_DEBUGGER } from \"../debug\";\n\nimport { subscriptions, waitingElementHandlers } from \"../internal-state\";\nimport { isSinkBindingConfiguration } from \"../types/internal\";\nimport { subscribe } from \"../lib/drain\";\nimport { terminationHandler } from \"../sinks/termination-sink\";\nimport { SinkFunction } from \"../types\";\nimport { addListener } from \"../lib/addListener\";\n\n// let bindCount = 0;\n\nconst AUTOREMOVE_LISTENERS_DELAY = 100; // Cleanup event listeners after this much time\nconst elementNodes = (n: Node): n is Element => n.nodeType == 1;\n\nconst errorHandler = console.error;\n\nexport const Rimmel_Bind_Subtree = (node: Element): void => {\n\t// Data-to-be-bound text nodes in an element (<div>${thing1} ${thing2}</div>);\n\tconst intermediateInteractiveNodes: Node[] = [];\n\n\tconst hasInteractiveTextNodes = [...node.childNodes]\n\t\t.some(n => n.nodeType == 3 && n.nodeValue?.includes(INTERACTIVE_NODE_START))\n\t;\n\n\tif(hasInteractiveTextNodes) {\n\t\t// Bind interactive \"text nodes\"\n\t\t// TODO: shall we use some ad-hoc container elements, instead? <text-wrapper>\n\t\tconst nodes = <(Node | string)[]>[];\n\t\tfor (const n of node.childNodes) {\n\t\t\tif(n.nodeType == 3) {\n\t\t\t\tconst nodeValue: string = n.nodeValue!;\n\t\t\t\tconst interactiveRE = new RegExp(`[${INTERACTIVE_NODE_START}${INTERACTIVE_NODE_END}]`);\n\t\t\t\tconst interleaved = nodeValue.split(interactiveRE);\n\t\t\t\tconst il = interleaved.length;\n\t\t\t\tfor(var i=0; i<il; i+=2) {\n\t\t\t\t\tconst txt = interleaved[i];\n\t\t\t\t\tnodes.push(txt);\n\n\t\t\t\t\tconst value = interleaved[i +1];\n\t\t\t\t\tif(value != undefined) {\n\t\t\t\t\t\tconst tn = document.createTextNode(value); // or \"value\"?\n\t\t\t\t\t\tintermediateInteractiveNodes.push(tn); // do we have an initial value we can add straight away?\n\t\t\t\t\t\tnodes.push(tn);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tnodes.push(n);\n\t\t\t}\n\t\t}\n\t\tnode.innerHTML = '';\n\t\tnode.append(...nodes);\n\t}\n\n\tconst bindingRef = <string>node.getAttribute(RESOLVE_ATTRIBUTE);\n\t(waitingElementHandlers.get(bindingRef) ?? []).forEach(function Rimmel_Bind_Element(bindingConfiguration) {\n\t\tconst debugThisNode = node.hasAttribute(RML_DEBUG);\n\n\t\tif(ENABLE_RML_DEBUGGER) {\n\t\t\tif(debugThisNode) {\n\t\t\t\t/* Stopped at data binding phase */\n\n\t\t\t\tnode;\t// The node binding will be applied to\n\t\t\t\tnode.attributes; // And its attributes\n\t\t\t\tnode.classList; // And its classes\n\n\t\t\t\tdebugger;\n\t\t\t}\n\t\t}\n\n\t\tif (isSinkBindingConfiguration(bindingConfiguration)) {\n\t\t\t// It's a data sink\n\n\t\t\t// TODO: bindingConfiguration.sinkParams may itself be a promise or an observable, so need to subscribe to it\n\t\t\tconst targetNode =  bindingConfiguration.textNodeOnly ? (intermediateInteractiveNodes.shift() ?? node) : node;\n\t\t\tconst { sink, t } = bindingConfiguration;\n\t\t\tconst sinkFn = sink(targetNode, bindingConfiguration.params);\n\n\t\t\t// This is the actual sink that will be bound to a source\n\t\t\tlet sinkFn2 = sinkFn;\n\n\t\t\tif(ENABLE_RML_DEBUGGER) {\n\t\t\t\t// A pre-sink step that can show the above sinkFn in a stack trace for debugging\n\t\t\t\tconst loggingSinkFn: SinkFunction = (...data: any) => {\n\t\t\t\t\tconsole.groupCollapsed('RML: Sinking', t, data);\n\t\t\t\t\tconsole.log(bindingConfiguration);\n\t\t\t\t\tconsole.trace('Stack Trace (from Source to Sink), data=', data);\n\t\t\t\t\tsinkFn(...data)\n\t\t\t\t\tconsole.groupEnd();\n\t\t\t\t};\n\n\t\t\t\tif(debugThisNode) {\n\t\t\t\t\tsinkFn2 = loggingSinkFn;\n\n\t\t\t\t\tconsole.groupCollapsed('RML: Binding', t, targetNode);\n\t\t\t\t\tconsole.dir(targetNode);\n\t\t\t\t\tconsole.debug('Node: %o', targetNode);\n\t\t\t\t\tconsole.debug('Conf: %o', bindingConfiguration);\n\t\t\t\t\tconsole.debug('Sink: %o', sinkFn2);\n\t\t\t\t\tconsole.groupEnd();\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst sourceStream = bindingConfiguration.source;\n\n\t\t\t// console.log('>>> BIND', ++bindCount, targetNode, bindingConfiguration);\n\t\t\tsubscribe(targetNode, sourceStream, sinkFn2, bindingConfiguration.error ?? errorHandler, bindingConfiguration.termination ?? terminationHandler, bindingConfiguration.scheduler);\n\t\t} else {\n\t\t\t// It's an event source\n\n\t\t\tconst sourceBindingConfiguration = <SourceBindingConfiguration<RMLEventName>>bindingConfiguration;\n\t\t\tconst { eventName } = sourceBindingConfiguration;\n\n\t\t\taddListener(node, eventName, sourceBindingConfiguration.listener, sourceBindingConfiguration.options);\n\t\t}\n\n\t});\n\n\tnode.removeAttribute(RESOLVE_ATTRIBUTE);\n\twaitingElementHandlers.delete(bindingRef);\n};\n\nexport const removeListeners = (node: Element) => {\n\tif(document.contains(node)) {\n\t\t// Don't remove listeners if the node has just been moved across (so it's back in the DOM)\n\t\treturn;\n\t}\n\n\t[...node.children as unknown as Element[]]\n\t\t.forEach(node => removeListeners(node))\n\t;\n\n\t// TODO: add AbortController support for cancellable promises?\n\tsubscriptions.get(node)?.forEach(l => {\n\t\t// HACK: — destination is not a supported API for Subscription...\n\t\t// l?.destination?.complete(); // do we need this, BTW?\n\n\t\t// console.debug('Rimmel: Unsubscribing', node, l);\n\t\t// FIXME: DOM Observables don't have unsubscribe => Use an AbortController in addListener.ts\n\t\t// N.B.: unsubscribe is RxJS-specific, but the below still works.\n\t\tl?.unsubscribe?.();\n\t});\n\tsubscriptions.delete(node);\n\n\t// #REF49993849837451 Just leaving this around, but there's no need to manually\n\t// remove listeners.\n\t// DevTools might suggest otherwise, but if you see unreleased instances of\n\t// EventListener, then HE is holding on to them (Heisenbug), not Rimmel.\n\t// listeners.get(node)?.forEach(ref => node.removeEventListener(...ref));\n\t// listeners.delete(node);\n};\n\n/**\n * Main callback triggered when an element is added to the DOM\n * Here is where we start the data binding process\n */\nexport const Rimmel_Mount: MutationCallback = (mutationsList, observer) => {\n\tconst childList = mutationsList\n\t\t.filter(m => m.type === 'childList')\n\t;\n\n\t// TODO: performance - use document.createTreeWalker\n\tconst addedNodes = childList\n\t\t.flatMap(m => ([...m.addedNodes])) // .values() for an iterator, according to TS\n\t\t.filter(elementNodes)\n\t;\n\n\taddedNodes\n\t\t.flatMap(node => [node].concat(...(node.querySelectorAll(RESOLVE_SELECTOR))))\n\t\t.forEach(Rimmel_Bind_Subtree)\n\t;\n\n\t// TODO: performance - use document.createTreeWalker\n\tconst removedNodes = childList\n\t\t.flatMap(m => ([...m.removedNodes])) // .values() for an iterator, according to TS\n\t\t.filter(elementNodes)\n\t;\n\n\t// TODO: switch when ready\n\t// requestIdleCallback(() => removedNodes.forEach(removeListeners));\n\tsetTimeout(() => removedNodes.forEach(removeListeners), AUTOREMOVE_LISTENERS_DELAY)\n};\n","import { ClassAttribute } from \"./class\";\nimport { DatasetObject } from \"./dataset\";\nimport { EventObject } from \"./event-listener\";\nimport { GenericAttribute } from \"./attribute\";\nimport { StyleObject } from \"./style\";\nimport { ValueAttribute } from \"./value\";\nimport { ContentAttribute } from \"./content\";\nimport { MaybeFuture, Observer } from \"./futures\";\nimport { RMLTemplateExpressions } from \"./internal\";\nimport { BOOLEAN_ATTRIBUTES, BooleanAttribute } from \"../definitions/boolean-attributes\";\n\nexport type RemovePrefix<TPrefix extends string, TString extends string> = TString extends `${TPrefix}${infer T}` ? T : TString extends `rml:${TPrefix}${infer T}` ? `rml:${T}` : never;\n\n// TODO: use GlobalEventHandlersEventMap instead\n\n/**\n * A CSS selector string\n */\nexport type CSSSelector = string;\n\n/**\n * An HTML attribute name\n */\nexport type HTMLAttributeName = string; \n\n/**\n * An HTML event name prefixed by 'on'\n */\nexport type HTMLEventAttributeName = keyof HTMLElement & `on${string}`;\n\n/**\n * An HTML event name without the 'on' prefix\n */\nexport type HTMLEventName = RemovePrefix<'on', HTMLEventAttributeName>;\n\n/**\n * The Name of an HTML element\n */\nexport type HTMLElementName = string;\n\n/**\n * A RML event name prefixed by 'on', which includes all HTML events and RML events (currently only 'onmount').\n */\nexport type RMLEventAttributeName =\n  | HTMLEventAttributeName\n  | \"rml:onmount\"\n;\n\n/**\n * A RML event name without the 'on' prefix, which includes all HTML events and RML events.\n */\nexport type RMLEventName = RemovePrefix<'on', RMLEventAttributeName>;\n\n/**\n * An element lifecycle event, such as mount, onmount, etc\n */\nexport interface LifecycleEvent extends CustomEvent {\n};\n\n/**\n * Any RML event, which includes all HTML Events and RML events.\n */\nexport type RMLEventMap = HTMLElementEventMap & {\n    mount: LifecycleEvent; // Assuming 'mount' events use the base Event class\n    unmount: LifecycleEvent; // Assuming 'mount' events use the base Event class\n    'rml:mount': LifecycleEvent; // Assuming 'mount' events use the base Event class\n    'rml:unmount': LifecycleEvent; // Assuming 'mount' events use the base Event class\n};\n\n/**\n * Utility function that returns the type of Event that a corresponding listener will receive\n */\nexport type EventType<N extends string> = N extends keyof RMLEventMap ? RMLEventMap[N] : never;\n\n/**\n * A string representing HTML code\n * @example const str = '<div>Hello</div>' as HTMLString;\n */\nexport type HTMLString = string & { _HTMLStringBrand: never };\n// export interface JSONArray extends Array<JSON> {};\n\n/**\n * A string representing CSS \"key: value;\" code\n */\nexport type CSSString = string & { _CSSStringBrand: never };\n\n/**\n * Any HTML Element that can have child elements\n */\nexport type HTMLContainerElement = HTMLElementTagNameMap[keyof HTMLElementTagNameMap];\n\n/**\n * Any HTML Element that has a \"value\" attribute\n */\nexport type HTMLFieldElement = HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement;\n\n/**\n * Any HTML Element meant to handle numbers, even if the DOM exposes them as strings\n */\nexport type HTMLNumericFieldElement = HTMLInputElement & { type: 'number' | 'range' };\n\nexport const isNumericFieldElement = (e: Element): e is HTMLNumericFieldElement => e instanceof HTMLInputElement && (e.type === 'number' || e.type === 'range');\n\n// TODO use EventListenerOrEventListenerObject (or not, because it's not a generic in the DOM, but we want it to be?)\nexport type EventListenerFunction<E extends Event = Event> = (event: E) => void;\nexport interface EventListenerObject<E extends Event | any> {\n    handleEvent(e: E): void;\n};\n\nexport type EventListenerStream<E extends Event = Event> = Observer<E>;\n\nexport type EventListener<E extends Event = Event> = EventListenerFunction<E> | EventListenerObject<E> | EventListenerStream<E>;\n\n// /**\n//  * A generic equivalent of the DOM's EventListenerOrEventListenerObject\n//  */\nexport type EventListenerOrEventListenerObject<E extends Event = Event> = EventListener<E>;\n\nexport type BooleanAttributeValue<T extends BooleanAttribute> = MaybeFuture<boolean | T | 'true'>;\n\ntype DisabledType = 'disabled';\n\n// export type DocumentObject<E extends HTMLElement> = EventObject & ClassAttribute & DatasetObject & StyleObject & ValueAttribute<E> & ContentAttribute & GenericAttribute;\n\n/**\n * A Document Object, or DOM Object that represents changes to apply to existing elements\n * \n * - properties of this object will be applied to the element\n * - properties starting with on will be treated as event listeners\n * - properties starting with data- will be treated as data attributes\n * - the style property will be used to set the element's style\n * - the class property will be used to set or clear class names\n * - the value property will be treated as value\n * - innerHTML, innerText, textContent and appendHTML properties will trigger corresponding functionality\n * - all other properties will be treated as generic attributes \n */\nexport interface BaseDocumentObject {\n    class?: ClassAttribute;\n    dataset?: DatasetObject;\n    style?: StyleObject;\n\n    // disabled?: RMLTemplateExpressions.BooleanAttributeValue<'disabled'>;\n    // readonly?: RMLTemplateExpressions.BooleanAttributeValue<'readonly'>;\n    // open?: RMLTemplateExpressions.BooleanAttributeValue<'open'>;\n\n    innerHTML?: MaybeFuture<HTMLString>;\n    appendHTML?: MaybeFuture<HTMLString>;\n    innerText?: MaybeFuture<HTMLString>;\n    textContent?: MaybeFuture<HTMLString>;\n\n    value?: string | MaybeFuture<string>;\n};\n\nexport type BooleanAttributesMap = {\n    [K in BooleanAttribute]: RMLTemplateExpressions.BooleanAttributeValue<K>;\n};\n\n/**\n * Attribuend, or DOM Object, or Document Object\n * A simple record of valid DOM attributes including class or style, plus event handlers or anything that can be set as an attribute of an element\n **/\nexport type DocumentObject = BaseDocumentObject & EventObject & BooleanAttributesMap & GenericAttribute;\n","import type { BehaviorSubject, Subject } from 'rxjs';\nimport type { EventListener, EventListenerOrEventListenerObject, RMLEventMap } from './dom';\nimport { Observer } from './futures';\n\n/**\n * A map of all HTML events\n */\nexport type HTMLEventMap = HTMLElementEventMap & {\n\t'onmount': Event; // deprecated, don't use\n\t'onunmount': Event; // deprecated, don't use\n};\n\n/**\n * An event source mapper that transforms a DOM event into a convenience type\n */\nexport type EventListenerOrEventListenerAdapter<E extends Event, T> = (e: E) => T;\nexport type EventSubject<T> = Subject<T> | BehaviorSubject<T>;\n\n/**\n * A record of event listener attributes and their corresponding typed event handlers\n * @example onmousemove: <Handler<MouseEvent>>\n */\nexport type EventObject = {\n\t[K in keyof HTMLEventMap as `on${string & K}`]?: EventListenerOrEventListenerObject<HTMLEventMap[K]> | EventSubject<HTMLEventMap[K]>;\n} & {\n\t[K in keyof RMLEventMap]?: EventListenerOrEventListenerObject<RMLEventMap[K]> | EventSubject<RMLEventMap[K]>;\n};\n\nexport type RMLEventListener<E extends Event = Event> =\n\t| EventListener<E>\n\t| Observer<E>\n;\n\nexport const isRMLEventListener = (name: string, arg: unknown): arg is RMLEventListener =>\n\t/^(?:rml:)?on/.test(name);\n;\n\n","import type { CSSClassName } from \"./style\";\nimport type { MaybeFuture } from \"./futures\";\nimport type { HTMLContainerElement, HTMLString } from './dom';\nimport type { FocusableElement } from './rml';\nimport { AttributeObject, DOMSubtreeObject, SinkBindingConfiguration } from \"./internal\";\n\n/**\n * The mounted part of a Sink who performs the actual work, e.g.: DOM updates, console.logs, etc.\n * This is always created by a Sink first.\n */\nexport type SinkFunction = (values?: any) => void;\n\nexport interface HTMLSinkable {\n\tinnerHTML: string;\n};\n\n/**\n * Allowed types of DOM nodes that sinks can work on\n */\nexport type SinkableNode =\n  | Element\n  // | HTMLElement\n  // | HTMLInputElement\n  // | HTMLTextAreaElement\n  // | HTMLSelectElement\n  // | HTMLButtonElement\n  | MathMLElement\n  | SVGElement\n  | Text\n\t| HTMLSinkable\n;\n\n/**\n * A module responsible to render data coming from a source\n * @param T The type of HTML element the sink can be applied to\n */\nexport interface Sink<T extends SinkableNode> extends Function {\n  // FIXME: move node as last parameter to facilitate currying\n  (node: T, ...args: any[]): SinkFunction;\n  // [Symbol.sink]?: string;\n}\n\n// TODO: use a Symbol instead of .sink?\nexport const isSink = (x: any): x is Sink<any> =>\n  !!(x?.sink);\n\nexport type HTML = MaybeFuture<HTMLString>;\n\nexport type TextString = MaybeFuture<string>;\n\n/**\n * A list of possible Sink types, the elements they can be used on and the type of data they can receive\n */\nexport type SinkElementTypes = {\n  'attribute': {\n    elements: HTMLElement | SVGElement | MathMLElement;\n    types: number | string;\n  };\n  'checked': {\n    elements: HTMLInputElement;\n    types: boolean | 'true' | 'checked';\n  };\n  'class': {\n    elements: HTMLElement | SVGElement;\n    types: CSSClassName;\n  };\n  'closed': {\n    elements: HTMLDialogElement;\n    types: boolean | 'true' | 'closed';\n  };\n  'content': {\n    elements: HTMLContainerElement;\n    types: HTMLString;\n  };\n  'hidden': {\n    elements: HTMLElement;\n    types: boolean | 'true' | 'false' | 'until-found';\n  };\n  'textcontent': {\n    elements: HTMLElement;\n    types: HTMLString;\n  };\n  'rml:focus': {\n    elements: FocusableElement;\n    types: boolean ;\n  };\n  'rml:blur': {\n    elements: FocusableElement;\n    types: any ;\n  };\n  'disabled': {\n    elements: HTMLButtonElement | HTMLFieldSetElement | HTMLOptGroupElement | HTMLOptionElement | HTMLSelectElement | HTMLTextAreaElement | HTMLInputElement;\n    types: boolean | 'true' | 'disabled';\n  };\n  'mixin': {\n    elements: HTMLElement | SVGElement | MathMLElement;\n    types: AttributeObject;\n  };\n  'object': {\n    elements: HTMLElement | SVGElement | MathMLElement;\n    types: Object;\n  };\n  'readonly': {\n    elements: HTMLInputElement | HTMLTextAreaElement | HTMLSelectElement;\n    types: boolean | 'true' | 'readonly';\n  };\n  'removed': {\n    elements: HTMLElement | SVGElement | MathMLElement;\n    types: boolean | 'true' | 'removed';\n  };\n  'subtree': {\n    elements: HTMLContainerElement | SVGElement | MathMLElement;\n    types: DOMSubtreeObject;\n  };\n  'text': {\n    elements: HTMLElement;\n    types: string | number;\n  };\n  'value': {\n    elements: HTMLInputElement | HTMLTextAreaElement | HTMLSelectElement;\n    types: number | string;\n  };\n};\n\n/**\n * A Sink Specifier that can be used to force a certain type of sink or provide a custom one\n * @param T The type of HTML element the sink can work on\n */\nexport type ExplicitSink<T extends keyof SinkElementTypes> =\n  (source: MaybeFuture<SinkElementTypes[T]['types']>, ...data: any[]) =>\n    SinkBindingConfiguration<T extends keyof SinkElementTypes ? SinkElementTypes[T]['elements'] : Element>\n;\n","import type { BindingConfiguration } from \"./internal\";\nimport type { EventListenerFunction } from \"./dom\";\nimport type { EventListenerOrEventListenerAdapter } from \"./event-listener\";\nimport type { Observer } from \"./futures\";\n\n/**\n * A module responsible to get data events (e.g.: DOM events, network calls, etc)\n */\nexport interface SourceDescriptor<E extends Event, R> {\n    bubbles?: boolean;\n    defaultPrevented?: boolean;\n    source?: EventListenerOrEventListenerAdapter<E, R>;\n    handler: Observer<R> | ((data: R) => boolean);\n}\n\n/**\n * An event adapter, responsible to get raw events\n * (e.g.: DOM events, network calls, etc) and transform them into\n * something suitable for a UI-agnostic stream (typically a view-model)\n * @param target The Observer to send events to\n * @returns A Subject that will receive the actual DOM events\n * @example SourceStream(target)\n */\nexport type Source<I extends Event, O> = (target: Observer<O>) => (Observer<I> | EventListenerFunction<I>);\n\nexport const isSource = (x: BindingConfiguration) => x.type == 'source'\n","// List of HTML boolean attributes\n// https://developer.mozilla.org/en-US/docs/Glossary/Boolean/HTML\n// These enable a certain functionality by their mere presence in a tag.\n// E.G.: <input disabled=\"false\"> is still disabled, which is unintuitive.\n// <input disabled=\"${stream}\"> should really set or unset the disabled state depending on the stream's last emitted value!\n// If you don't like this behaviour, we have a \"rml\" prefixed set of such attributes, that actually behave like booleans\n\n// TODO: review, see if we can convert to a type... don't want all these in the bundles\nexport const BOOLEAN_ATTRIBUTES = new Set<string>([\n\t'async',\n\t'autofocus',\n\t'autoplay',\n\t'checked',\n\t'controls',\n\t'default',\n\t'defer',\n\t'disabled',\n\t'formnovalidate',\n\t'hidden',\n\t'inert',\n\t'ismap',\n\t'loop',\n\t'multiple',\n\t'muted',\n\t'nomodule',\n\t'novalidate',\n\t'open',\n\t'readonly',\n\t'required',\n\t'reversed',\n\t'selected'\n] as const);\n\nexport type BooleanAttribute = (typeof BOOLEAN_ATTRIBUTES)['values'] extends () => Iterator<infer T> ? T : never;\n\n","import type { Observer, OperatorPipeline } from '../types/futures';\nimport type { RMLTemplateExpressions } from '../types/internal';\n\nimport { Observable, OperatorFunction, Subject } from 'rxjs';\n\ntype Target<O> = RMLTemplateExpressions.TargetEventHandler<O>;\ntype InputObserver<I> = Observer<I> & { next: (value: I) => void };\n\nconst pipeInFromArray = <I, O>(target: Target<O>, pipeline: OperatorFunction<any, any>[]): InputObserver<I> => {\n\tconst source = new Subject<I>();\n\tconst stream = pipeline.reduce(\n\t\t(input, operator) => operator(input),\n\t\tsource as Observable<any>,\n\t) as Observable<O>;\n\n\tstream\n\t\t.subscribe(target as Observer<O>)\n\t;\n\n\t// FIXME: will we need to unsubscribe? Then store a reference for unsubscription\n\t// TODO: can we/should we delay subscription until mounted? Could miss the first events otherwise\n\t// TODO: check if a Subject is needed, or if we can connect directly to the target (e.g. w/ Observature.addSource)\n\n\treturn source;\n};\n\nconst sinkFromArray = <I, O>(source: Observable<I>, pipeline: OperatorFunction<any, any>[]) =>\n\tpipeline.reduce(\n\t\t(input, operator) => operator(input),\n\t\tsource as Observable<any>,\n\t) as Observable<O>;\n\n/**\n * Create an \"input pipe\" by prepending operators to the input of an Observer, Subject, BehaviorSubject, or plain subscriber function.\n * This works the opposite of RxJS's pipe(), which works on the output of an Observable.\n**/\nexport function pipeIn<I>(target: Target<I>): InputObserver<I>;\nexport function pipeIn<I, A>(target: Target<A>, op1: OperatorFunction<I, A>): InputObserver<I>;\nexport function pipeIn<I, A, B>(target: Target<B>, op1: OperatorFunction<I, A>, op2: OperatorFunction<A, B>): InputObserver<I>;\nexport function pipeIn<I, A, B, C>(target: Target<C>, op1: OperatorFunction<I, A>, op2: OperatorFunction<A, B>, op3: OperatorFunction<B, C>): InputObserver<I>;\nexport function pipeIn<I, A, B, C, D>(target: Target<D>, op1: OperatorFunction<I, A>, op2: OperatorFunction<A, B>, op3: OperatorFunction<B, C>, op4: OperatorFunction<C, D>): InputObserver<I>;\nexport function pipeIn<I, A, B, C, D, E>(target: Target<E>, op1: OperatorFunction<I, A>, op2: OperatorFunction<A, B>, op3: OperatorFunction<B, C>, op4: OperatorFunction<C, D>, op5: OperatorFunction<D, E>): InputObserver<I>;\nexport function pipeIn<I, A, B, C, D, E, F>(target: Target<F>, op1: OperatorFunction<I, A>, op2: OperatorFunction<A, B>, op3: OperatorFunction<B, C>, op4: OperatorFunction<C, D>, op5: OperatorFunction<D, E>, op6: OperatorFunction<E, F>): InputObserver<I>;\nexport function pipeIn<I, A, B, C, D, E, F, G>(target: Target<G>, op1: OperatorFunction<I, A>, op2: OperatorFunction<A, B>, op3: OperatorFunction<B, C>, op4: OperatorFunction<C, D>, op5: OperatorFunction<D, E>, op6: OperatorFunction<E, F>, op7: OperatorFunction<F, G>): InputObserver<I>;\nexport function pipeIn<I, A, B, C, D, E, F, G, H>(target: Target<H>, op1: OperatorFunction<I, A>, op2: OperatorFunction<A, B>, op3: OperatorFunction<B, C>, op4: OperatorFunction<C, D>, op5: OperatorFunction<D, E>, op6: OperatorFunction<E, F>, op7: OperatorFunction<F, G>, op8: OperatorFunction<G, H>): InputObserver<I>;\nexport function pipeIn<I, A, B, C, D, E, F, G, H, J>(target: Target<J>, op1: OperatorFunction<I, A>, op2: OperatorFunction<A, B>, op3: OperatorFunction<B, C>, op4: OperatorFunction<C, D>, op5: OperatorFunction<D, E>, op6: OperatorFunction<E, F>, op7: OperatorFunction<F, G>, op8: OperatorFunction<G, H>, op9: OperatorFunction<H, J>): InputObserver<I>;\nexport function pipeIn<I, O = I>(target: Target<O>, ...pipeline: OperatorPipeline<I, O>): InputObserver<I>;\nexport function pipeIn<I, O = I>(target: Target<O>, ...pipeline: OperatorPipeline<I, O>): InputObserver<I> {\n\treturn pipeInFromArray<I, O>(target, pipeline as OperatorFunction<any, any>[]);\n}\n\n/**\n * Create an \"input pipeline\" by prepending operators to the input of an Observer\n *\n * @remarks This works the opposite of the `pipe()` function in RxJS, which\n * attaches operators to the output of an Observable.\n *\n * You normally use an input pipe to create Event Adapters.\n * \n * @template I the input type of the returned stream (the event adapter)\n * @template O the output type of the returned stream (= the input type of the actual target stream)\n * @example const MyUsefulEventAdapter = inputPipe(...pipeline);\n * const template = rml`\n *   <input onkeypress=\"${MyUsefulEventAdapter(targetObserver)}\">\n * `;\n**/\nexport function inputPipe<I>(): (target: Target<I>) => InputObserver<I>;\nexport function inputPipe<I, A>(op1: OperatorFunction<I, A>): (target: Target<A>) => InputObserver<I>;\nexport function inputPipe<I, A, B>(op1: OperatorFunction<I, A>, op2: OperatorFunction<A, B>): (target: Target<B>) => InputObserver<I>;\nexport function inputPipe<I, A, B, C>(op1: OperatorFunction<I, A>, op2: OperatorFunction<A, B>, op3: OperatorFunction<B, C>): (target: Target<C>) => InputObserver<I>;\nexport function inputPipe<I, A, B, C, D>(op1: OperatorFunction<I, A>, op2: OperatorFunction<A, B>, op3: OperatorFunction<B, C>, op4: OperatorFunction<C, D>): (target: Target<D>) => InputObserver<I>;\nexport function inputPipe<I, A, B, C, D, E>(op1: OperatorFunction<I, A>, op2: OperatorFunction<A, B>, op3: OperatorFunction<B, C>, op4: OperatorFunction<C, D>, op5: OperatorFunction<D, E>): (target: Target<E>) => InputObserver<I>;\nexport function inputPipe<I, A, B, C, D, E, F>(op1: OperatorFunction<I, A>, op2: OperatorFunction<A, B>, op3: OperatorFunction<B, C>, op4: OperatorFunction<C, D>, op5: OperatorFunction<D, E>, op6: OperatorFunction<E, F>): (target: Target<F>) => InputObserver<I>;\nexport function inputPipe<I, A, B, C, D, E, F, G>(op1: OperatorFunction<I, A>, op2: OperatorFunction<A, B>, op3: OperatorFunction<B, C>, op4: OperatorFunction<C, D>, op5: OperatorFunction<D, E>, op6: OperatorFunction<E, F>, op7: OperatorFunction<F, G>): (target: Target<G>) => InputObserver<I>;\nexport function inputPipe<I, A, B, C, D, E, F, G, H>(op1: OperatorFunction<I, A>, op2: OperatorFunction<A, B>, op3: OperatorFunction<B, C>, op4: OperatorFunction<C, D>, op5: OperatorFunction<D, E>, op6: OperatorFunction<E, F>, op7: OperatorFunction<F, G>, op8: OperatorFunction<G, H>): (target: Target<H>) => InputObserver<I>;\nexport function inputPipe<I, A, B, C, D, E, F, G, H, J>(op1: OperatorFunction<I, A>, op2: OperatorFunction<A, B>, op3: OperatorFunction<B, C>, op4: OperatorFunction<C, D>, op5: OperatorFunction<D, E>, op6: OperatorFunction<E, F>, op7: OperatorFunction<F, G>, op8: OperatorFunction<G, H>, op9: OperatorFunction<H, J>): (target: Target<J>) => InputObserver<I>;\nexport function inputPipe<I, O>(...pipeline: OperatorPipeline<I, O>): (target: Target<O>) => InputObserver<I>;\nexport function inputPipe<I extends any, O extends any>(...pipeline: OperatorPipeline<I, O>) {\n\treturn (target: Target<O>) =>\n\t\tpipeInFromArray<I, O>(target, pipeline as OperatorFunction<any, any>[]);\n}\n\nexport const feed = pipeIn;\nexport const feedIn = pipeIn;\n\nexport const reversePipe = inputPipe;\n\n// TBC\nexport const source = <I, O = I>(...reversePipeline: [...OperatorPipeline<I, O>, Target<O>]) => {\n\tconst destination = reversePipeline.pop() as RMLTemplateExpressions.TargetEventHandler<O>;\n\treturn pipeInFromArray<I, O>(destination, reversePipeline as OperatorFunction<any, any>[]);\n};\n\nexport function sink<I>(source: Observable<I>): Observable<I>;\nexport function sink<I, A>(source: Observable<I>, op1: OperatorFunction<I, A>): Observable<A>;\nexport function sink<I, A, B>(source: Observable<I>, op1: OperatorFunction<I, A>, op2: OperatorFunction<A, B>): Observable<B>;\nexport function sink<I, A, B, C>(source: Observable<I>, op1: OperatorFunction<I, A>, op2: OperatorFunction<A, B>, op3: OperatorFunction<B, C>): Observable<C>;\nexport function sink<I, A, B, C, D>(source: Observable<I>, op1: OperatorFunction<I, A>, op2: OperatorFunction<A, B>, op3: OperatorFunction<B, C>, op4: OperatorFunction<C, D>): Observable<D>;\nexport function sink<I, A, B, C, D, E>(source: Observable<I>, op1: OperatorFunction<I, A>, op2: OperatorFunction<A, B>, op3: OperatorFunction<B, C>, op4: OperatorFunction<C, D>, op5: OperatorFunction<D, E>): Observable<E>;\nexport function sink<I, A, B, C, D, E, F>(source: Observable<I>, op1: OperatorFunction<I, A>, op2: OperatorFunction<A, B>, op3: OperatorFunction<B, C>, op4: OperatorFunction<C, D>, op5: OperatorFunction<D, E>, op6: OperatorFunction<E, F>): Observable<F>;\nexport function sink<I, A, B, C, D, E, F, G>(source: Observable<I>, op1: OperatorFunction<I, A>, op2: OperatorFunction<A, B>, op3: OperatorFunction<B, C>, op4: OperatorFunction<C, D>, op5: OperatorFunction<D, E>, op6: OperatorFunction<E, F>, op7: OperatorFunction<F, G>): Observable<G>;\nexport function sink<I, A, B, C, D, E, F, G, H>(source: Observable<I>, op1: OperatorFunction<I, A>, op2: OperatorFunction<A, B>, op3: OperatorFunction<B, C>, op4: OperatorFunction<C, D>, op5: OperatorFunction<D, E>, op6: OperatorFunction<E, F>, op7: OperatorFunction<F, G>, op8: OperatorFunction<G, H>): Observable<H>;\nexport function sink<I, A, B, C, D, E, F, G, H, J>(source: Observable<I>, op1: OperatorFunction<I, A>, op2: OperatorFunction<A, B>, op3: OperatorFunction<B, C>, op4: OperatorFunction<C, D>, op5: OperatorFunction<D, E>, op6: OperatorFunction<E, F>, op7: OperatorFunction<F, G>, op8: OperatorFunction<G, H>, op9: OperatorFunction<H, J>): Observable<J>;\nexport function sink<I, O>(source: Observable<I>, ...pipeline: OperatorPipeline<I, O>): Observable<O>;\nexport function sink<I, O>(source: Observable<I>, ...pipeline: OperatorPipeline<I, O>) {\n\treturn sinkFromArray<I, O>(source, pipeline as OperatorFunction<any, any>[]);\n}\n\nexport const EventAdapter = inputPipe;\n","import type { NextObserver, OperatorFunction } from 'rxjs';\nimport type { OperatorPipeline } from '../types';\nimport type { Consumer } from '../types/futures';\n\nimport { inputPipe, pipeIn } from '../utils/input-pipe';\n\n/**\n * Create a reverse-curried observable for a target stream\n * by applying an input pipeline in front of it\n * @param pipeline an array of RxJS operators\n * @param destination the target stream to feed\n * @returns An Observer if both pipeline and destination are supplied\n *   or a curried function that takes a stream to return the above.\n * @example\n * ```ts\n * const target = new Subject<number>;\n * \n * // an event adapter that feeds the value of an HTML input\n * // this will return a function that takes a target stream\n * // as a parameter\n * const Value = korma([\n *   map(e => e.target.value),\n * ]);\n * \n * rml`<input onchange=\"${Value(target)}\">`\n * ```\n * \n * * @example\n * ```ts\n * const target = new Subject<number>;\n * \n * // an event adapter that feeds the value of an HTML input\n * const ValueFeeder = korma([\n *   map(e => e.target.value),\n * ], target);\n * \n * rml`<input onchange=\"${valueFeeder}\">`\n **/\nexport function korma<I, O = I>(pipeline: []): (destination: Consumer<O>) => NextObserver<I>;\n\nexport function korma<I, A>(pipeline: [OperatorFunction<I, A>]): (destination?: Consumer<A>) => NextObserver<I>;\nexport function korma<I, A, B>(pipeline: [OperatorFunction<I, A>, OperatorFunction<A, B>]): (destination?: Consumer<B>) => NextObserver<I>;\nexport function korma<I, A, B, C>(pipeline: [OperatorFunction<I, A>, OperatorFunction<A, B>, OperatorFunction<B, C>]): (destination?: Consumer<C>) => NextObserver<I>;\nexport function korma<I, A, B, C, D>(pipeline: [OperatorFunction<I, A>, OperatorFunction<A, B>, OperatorFunction<B, C>, OperatorFunction<C, D>]): (destination?: Consumer<D>) => NextObserver<I>;\nexport function korma<I, A, B, C, D, E>(pipeline: [OperatorFunction<I, A>, OperatorFunction<A, B>, OperatorFunction<B, C>, OperatorFunction<C, D>, OperatorFunction<D, E>]): (destination?: Consumer<E>) => NextObserver<I>;\nexport function korma<I, A, B, C, D, E, F>(pipeline: [OperatorFunction<I, A>, OperatorFunction<A, B>, OperatorFunction<B, C>, OperatorFunction<C, D>, OperatorFunction<D, E>, OperatorFunction<E, F>]): (destination?: Consumer<F>) => NextObserver<I>;\nexport function korma<I, A, B, C, D, E, F, G>(pipeline: [OperatorFunction<I, A>, OperatorFunction<A, B>, OperatorFunction<B, C>, OperatorFunction<C, D>, OperatorFunction<D, E>, OperatorFunction<E, F>, OperatorFunction<F, G>]): (destination?: Consumer<G>) => NextObserver<I>;\nexport function korma<I, A, B, C, D, E, F, G, H>(pipeline: [OperatorFunction<I, A>, OperatorFunction<A, B>, OperatorFunction<B, C>, OperatorFunction<C, D>, OperatorFunction<D, E>, OperatorFunction<E, F>, OperatorFunction<F, G>, OperatorFunction<G, H>]): (destination?: Consumer<H>) => NextObserver<I>;\nexport function korma<I, A, B, C, D, E, F, G, H, J>(pipeline: [OperatorFunction<I, A>, OperatorFunction<A, B>, OperatorFunction<B, C>, OperatorFunction<C, D>, OperatorFunction<D, E>, OperatorFunction<E, F>, OperatorFunction<F, G>, OperatorFunction<G, H>, OperatorFunction<H, J>]): (destination?: Consumer<J>) => NextObserver<I>;\nexport function korma<I, O = I>(pipeline: OperatorPipeline<I, O>): (destination?: Consumer<O>) => NextObserver<I>;\n\nexport function korma<I, O = I>(pipeline: [], destination?: Consumer<O>): NextObserver<I>;\nexport function korma<I, A>(pipeline: [OperatorFunction<I, A>], destination?: Consumer<A>): NextObserver<I>;\nexport function korma<I, A, B>(pipeline: [OperatorFunction<I, A>, OperatorFunction<A, B>], destination?: Consumer<B>): NextObserver<I>;\nexport function korma<I, A, B, C>(pipeline: [OperatorFunction<I, A>, OperatorFunction<A, B>, OperatorFunction<B, C>], destination?: Consumer<C>): NextObserver<I>;\nexport function korma<I, A, B, C, D>(pipeline: [OperatorFunction<I, A>, OperatorFunction<A, B>, OperatorFunction<B, C>, OperatorFunction<C, D>], destination?: Consumer<D>): NextObserver<I>;\nexport function korma<I, A, B, C, D, E>(pipeline: [OperatorFunction<I, A>, OperatorFunction<A, B>, OperatorFunction<B, C>, OperatorFunction<C, D>, OperatorFunction<D, E>], destination?: Consumer<E>): NextObserver<I>;\nexport function korma<I, A, B, C, D, E, F>(pipeline: [OperatorFunction<I, A>, OperatorFunction<A, B>, OperatorFunction<B, C>, OperatorFunction<C, D>, OperatorFunction<D, E>, OperatorFunction<E, F>], destination?: Consumer<F>): NextObserver<I>;\nexport function korma<I, A, B, C, D, E, F, G>(pipeline: [OperatorFunction<I, A>, OperatorFunction<A, B>, OperatorFunction<B, C>, OperatorFunction<C, D>, OperatorFunction<D, E>, OperatorFunction<E, F>, OperatorFunction<F, G>], destination?: Consumer<G>): NextObserver<I>;\nexport function korma<I, A, B, C, D, E, F, G, H>(pipeline: [OperatorFunction<I, A>, OperatorFunction<A, B>, OperatorFunction<B, C>, OperatorFunction<C, D>, OperatorFunction<D, E>, OperatorFunction<E, F>, OperatorFunction<F, G>, OperatorFunction<G, H>], destination?: Consumer<H>): NextObserver<I>;\nexport function korma<I, A, B, C, D, E, F, G, H, J>(pipeline: [OperatorFunction<I, A>, OperatorFunction<A, B>, OperatorFunction<B, C>, OperatorFunction<C, D>, OperatorFunction<D, E>, OperatorFunction<E, F>, OperatorFunction<F, G>, OperatorFunction<G, H>, OperatorFunction<H, J>], destination?: Consumer<J>): NextObserver<I>;\nexport function korma<I, O = I>(pipeline: OperatorPipeline<I, O>, destination?: Consumer<O>): NextObserver<I>;\n\nexport function korma<I, O = I>(pipeline: OperatorPipeline<I, O>, destination?: Consumer<O>) {\n\treturn destination === undefined\n\t\t? (inputPipe as any)(...pipeline)\n\t\t: (pipeIn as any)(destination, ...pipeline);\n};\n","import { RMLEventName } from \"../../types/dom\";\nimport { SourceBindingConfiguration, RMLTemplateExpressions } from '../../types/internal';\nimport { callable } from '../../lib/drain';\n\n/**\n * Forces an event listener to be active (e.g.: scroll, touchstart)\n *\n * @experimental\n * @example target.innerHTML = rml`\n *   <div onmouseover=\"${Active( handler )}\">...</div>\n * `;\n */\nexport const Active =\n  <E extends RMLEventName, T>\n  (listener: RMLTemplateExpressions.SourceExpression<T>) =>\n    ({ type: 'source', listener: callable(listener), options: { passive: false } }) as SourceBindingConfiguration<E>;\n;\n\n","import { RMLEventName } from \"../../types/dom\";\nimport { SourceBindingConfiguration, RMLTemplateExpressions } from '../../types/internal';\nimport { callable } from '../../lib/drain';\n\n/**\n * Forces an event listener to be captive (able to capture events bubbling up from child elements before their own event listeners are called)\n *\n * @experimental\n * @example target.innerHTML = rml`\n * <ul onclick=\"${Captive( handler )}\">\n *   <li onclick=\"${specificHandler}\">item</li>\n * </ul>\n * `;\n */\nexport const Captive =\n  <E extends RMLEventName, T>\n  (listener: RMLTemplateExpressions.SourceExpression<T>) =>\n    ({ type: 'source', listener: callable(listener), options: { capture: true } }) as SourceBindingConfiguration<E>;\n;\n\n","import { RMLEventName } from \"../../types/dom\";\nimport { SourceBindingConfiguration, RMLTemplateExpressions } from '../../types/internal';\nimport { callable } from '../../lib/drain';\nimport { Consumer } from \"../../types/futures\";\n\n/**\n * Forces an event listener to be passive\n *\n * @experimental\n * @example target.innerHTML = rml`\n *   <div onmouseover=\"${Passive( handler )}\">...</div>\n * `;\n */\nexport const Passive =\n  <E extends RMLEventName, T>\n  (listener: Consumer<T>) =>\n    ({ type: 'source', listener: callable(listener), options: { passive: true } }) as SourceBindingConfiguration<E>;\n;\n","import type { CSSSelector } from '../types/dom';\nimport type { RMLTemplateExpressions } from '../types/internal';\nimport { map } from 'rxjs';\nimport { pipeIn } from '../utils/input-pipe';\n\n/**\n * An Event Source emitting the \"[event.clientX, event.clientY]\" mouse coordinates\n * @param querySelector A query selector to select nodes from the underlying element's subtree\n * @param target A handler function or observer to send events to\n */\nexport const All =\n\t<T>\n\t(querySelector: CSSSelector | CSSSelector[], target: RMLTemplateExpressions.TargetEventHandler<Element[]>) =>\n\t\tpipeIn<Event, Element[]>(target,\n\t\t\tmap((e: Event) => (<CSSSelector[]>[]).concat(querySelector)\n\t\t\t\t\t.flatMap(querySelector=>[...(e.currentTarget as Element).querySelectorAll(querySelector)])\n\t\t\t),\n\t\t)\n;\n\nexport const qsa = (qs: CSSSelector | CSSSelector[]) =>\n\tmap((e: Event) => {\n\t\tconst t = <Element>e.currentTarget;\n\t\treturn (<CSSSelector[]>[]).concat(qs).flatMap(qs=>[...t.querySelectorAll(qs)])\n\t})\n;\n","import type { HTMLElementName, HTMLFieldElement } from '../types/dom';\n\nimport { map } from 'rxjs';\n\nimport { inputPipe } from '../utils/input-pipe';\nimport { autoValue } from '../utils/auto-value';\n\n/**\n * An Event Operator emitting a typed FormData object from the underlying &lt;form&gt; element instead of a regular DOM Event object\n * Field types are taken from their respective data-type attribute or string if unset\n * @returns OperatorFunction<Event, FormData>\n * @example <form onsubmit=\"${source(isValid, form, stream)}\"> ... </form>\n**/\nexport const autoForm = () =>\n\tmap((e: Event) => Object.fromEntries(\n\t\t[...(<HTMLFormElement>e.currentTarget).elements]\n\t\t\t// FIXME: doesn't emit unchecked radio buttons. Should emit null, instead?\n\t\t\t.map((e: Element) => [(e as HTMLFieldElement).name ?? e.id, autoValue(e as HTMLFieldElement)])\n\t\t\t.filter(([k, v]) => k!=='' && v!==undefined)\n\t))\n;\n\n/**\n * An Event Adapter emitting a FormData object from the underlying form element instead of a regular DOM Event object\n * @returns EventSource<string>\n * @example <form action=\"dialog\" onsubmit=\"${AsTypedForm(stream)}\"> ... </form>\n * @example <form action=\"dialog\" onsubmit=\"${AsTypedForm(handlerFn)}\"> ... </form>\n**/\nexport const AutoForm = inputPipe<SubmitEvent | Event, Record<HTMLElementName, any>>(\n\tautoForm(),\n);\n\nexport const asTypedFormData = autoForm;\nexport const AsTypedFormData = AutoForm;\n","import { map } from \"rxjs\";\nimport { inputPipe } from '../utils/input-pipe';\n\n/**\n * An Event Source Operator emitting the checked state of the underlying checkbox element instead of a regular DOM Event object\n * @returns OperatorFunction<Event, boolean>\n */\nexport const checkedState =\n\tmap((e: Event) => (<HTMLInputElement>e.target).checked)\n;\n\n\n/**\n * An Event Source emitting the checked state of the underlying checkbox element instead of a regular DOM Event object\n * @returns EventSource<boolean>\n */\nexport const CheckedState = inputPipe<Event, string>(\n\tcheckedState\n);\n","import { map } from \"rxjs\";\nimport { autoValue } from '../utils/auto-value';\nimport { inputPipe } from '../utils/input-pipe';\n\n/**\n * An Event Operator that \"cuts\" and emits the value of the underlying &lt;input&gt; element into a target observer\n *\n * This operator has side effects, as it will directly modify the underlying element\n * @category Event Adapter Operators\n * @template T the type of the target element\n * @template I the type of Event sourced from the underlying element\n * @template O the data type emitted into the target stream\n * @returns OperatorFunction<Event, string>\n *\n * For simple, one-step input pipelines, see the {@link Cut | Cut (uppercase)} Event Adapter\n *\n * ## Examples\n *\n * ### UpperCut\n *\n * Create a custom Event Operator that feeds a stream with the uppercase content of a textbox, when hitting Enter on it\n *\n * ```ts\n * import { Subject,  filter, map } from 'rxjs';\n * import { rml, inputPipe, cut } from 'rimmel';\n *\n * const onEnter = filter((e: KeyboardEvent) => e.key == 'Enter');\n * const toUpperCase = map((s: string) => s.toUpperCase());\n * const UpperCut = inputPipe(onEnter, cut, toUpperCase);\n *\n * const Component = () => {\n *   const stream = new Subject<string>();\n *\n *   return rml`\n *     <input type=\"text\" onkeypress=\"${UpperCut(stream)}\" autofocus>\n *     [ <span>${stream}</span> ]\n *   `;\n * };\n * ```\n */\nexport const cut =\n\tmap(<T extends (HTMLInputElement | HTMLElement), I extends Event, O extends string | number | Date | null>(e: I): O => {\n\t\tconst t = (<T>e.target);\n\t\tconst v = <O>autoValue(t);\n\t\t(t as HTMLInputElement).value = '';\n\t\t// TODO: t.innerText = '' for contenteditable items?\n\t\treturn v\n\t})\n;\n\n/**\n * An Event Adapter that \"cuts\" and emits the value of the underlying &lt;input&gt; element into a target observer\n *\n * @category Event Adapter Functions\n * @param target A handler function or Observer to feed events into\n * @returns EventSource<string>\n *\n * For advanced, multi-step input pipelines, see the {@link cut | cut (lowercase)} Operator\n *\n * ## Examples\n *\n * ### Feed a List\n *\n * Feed an [observable list](https://github.com/reactivehtml/observable-types\n ) with the uppercase content of a textbox, when hitting Enter on it\n *\n * ```ts\n * import { Collection } from 'observable-types';\n * import { Subject,  filter, map } from 'rxjs';\n * import { rml, Cut } from 'rimmel';\n *\n * const Component = () => {\n *   const list = Collection(['item1', 'item2', 'item3']);\n *\n *   return rml`\n *     <ul>${list}</ul>\n *     Add new: <input type=\"text\" onkeypress=\"${Cut(stream.push)}\" autofocus>\n *   `;\n * };\n * ```\n */\nexport const Cut =\n\tinputPipe<Event, string | number | Date | null>(\n\t\tcut\n\t)\n;\n","import type { RMLTemplateExpressions } from \"../types/internal\";\n\nimport { map } from 'rxjs';\nimport { korma } from \"../utils/curry\";\n\n/**\n * An Event Adapter Operator emitting any dataset value from the underlying element instead of a regular DOM Event object\n * @category Event Adapter Operators\n * @returns OperatorFunction<Event, string>\n * @example <button data-foo=\"bar\" onclick=\"${source(dataset('foo'), stream)}\"> ... </button>\n**/\nexport const dataset = <E extends Event>(key: string) =>\n\tmap((e: E) => ((<HTMLElement>e.target).dataset[key]));\n\n/**\n * An Event Source emitting any dataset value from the underlying element instead of a regular DOM Event object\n * @category Event Adapter Functions\n * @param key The key of the dataset item to retrieve\n * @param source A handler function or Observer to feed events into\n * @returns EventSource<string>\n * @example <button data-foo=\"bar\" onclick=\"${Dataset('foo', stream)}\"> ... </button>\n * @example <button data-foo=\"bar\" onclick=\"${Dataset('foo', handlerFn)}\"> ... </button>\n**/\nexport const Dataset =\n\t<I extends Event>\n\t(key: string, source?: RMLTemplateExpressions.SourceExpression<string | undefined>) =>\n\t\tkorma<I, string | undefined>([dataset(key)], source)\n;\n\n/**\n * An Event Source Operator emitting the full dataset object from the underlying element instead of a regular DOM Event object\n * @returns OperatorFunction<Event, DOMStringMap>\n * @example <button data-foo=\"bar\" data-baz=\"bat\" onclick=\"${source(datasetObject, stream)}\"> ... </button>\n**/\nexport const datasetObject =\n\tmap((e: Event) => ((<HTMLElement>e.target).dataset))\n;\n\n/**\n * An Event Source emitting the full dataset object from the underlying element instead of a regular DOM Event object\n * @category Event Adapter Functions\n * @param source A handler function or Observer to feed events into\n * @returns EventSource<string>\n * @example <button data-foo=\"bar\" data-baz=\"bat\" onclick=\"${DatasetObject(stream)}\"> ... </button>\n * @example <button data-foo=\"bar\" data-baz=\"bat\" onclick=\"${DatasetObject(handlerFn)}\"> ... </button>\n**/\nexport const DatasetObject =\n\t<I extends Event>\n\t(source?: RMLTemplateExpressions.SourceExpression<DOMStringMap>) =>\n\t\tkorma<I, DOMStringMap>([datasetObject], source)\n;\n\nexport const asDatasetOf = dataset;\nexport const AsDatasetOf = Dataset;\nexport const asDatasetObject = dataset;\nexport const AsDatasetObject = Dataset;\n","import { map } from 'rxjs';\nimport { inputPipe } from '../utils/input-pipe';\nimport { Source } from \"../types/source\";\n\n/**\n * An Event Operator emitting a numerical dataset value from the underlying element instead of a regular DOM Event object\n * @returns OperatorFunction<Event, number>\n * @example <button data-foo=\"123\" onclick=\"${source(numberset('foo'), isEven, stream)}\"> ... </button>\n**/\nexport const numberset = (key: string) => map((e: Event) => Number((<HTMLElement>e.target).dataset[key]));\n\n/**\n * An Event Source emitting a numerical dataset value from the underlying element instead of a regular DOM Event object\n * @returns EventSource<number>\n * @example <button data-foo=\"123\" onclick=\"${Numberset('foo', stream)}\"> ... </button>\n * @example <button data-foo=\"123\" onclick=\"${Numberset('foo', handlerFn)}\"> ... </button>\n**/\nexport const Numberset = <T extends HTMLElement, I extends Event, O extends number>(key: string): Source<I, O> =>\n\tinputPipe<I, O>(\n\t\tnumberset(key)\n\t)\n;\n\nexport const asNumberset = numberset;\nexport const AsNumberset = Numberset;\n","import { inputPipe } from '../utils/input-pipe';\nimport { map } from 'rxjs';\n\n/**\n * An Event Operator that emits the value of the underlying &lt;input&gt; element\n * @returns EventSource<string>\n **/\nexport const eventData =\n\tmap((e: InputEvent) => e.data);\n\n/**\n * An Event Adapter that emits the value of the underlying &lt;input&gt; element\n * @returns EventSource<string>\n **/\nexport const EventData =\n\tinputPipe<InputEvent, string | null>(\n\t\teventData\n\t)\n;\n","import { inputPipe } from '../utils/input-pipe';\nimport { map } from 'rxjs';\n\nexport const EventTarget = inputPipe<Event, Node>(\n\tmap(e => <Node>e.target)\n);\n\n","import { inputPipe } from '../utils/input-pipe';\nimport { map } from 'rxjs';\n\n/**\n * An Event Operator emitting a FormData object from the underlying form element instead of a regular DOM Event object\n * @returns OperatorFunction<Event, FormData>\n * @example <form onsubmit=\"${source(isValid, form, stream)}\"> ... </form>\n**/\nexport const form =\n\tmap((e: Event) => {\n\t\tif (e.type == 'submit' && (e.target as HTMLFormElement).method != 'dialog') {\n\t\t\t// This is contentious. Should we or sohuld we not call preventDefault() on the event here?\n\t\t\t// If we're using this in a dialog, we probably want it to close\n\t\t\t// On the other hand, if we're using this in a regular form, we probably want to submit it later\n\t\t\te.preventDefault();\n\t\t}\n\n\t\treturn Object.fromEntries(new FormData(<HTMLFormElement>e.currentTarget)\n\t\t\t// Checkboxes unintuitively emit \"on\" vs \"null\"\n\t\t\t// FIXME: this should become a pipeline plugin, so people can choose their preferred behaviour?\n\t\t\t// .map(([k, v]) => [k, v == 'on' ? true : v == 'null' ? false])\n\t)})\n;\n\n/**\n * An Event Adapter emitting the underlying form's key-values\n * @effect calls preventDefault() on the event\n * @unstable might need to review the preventDefault() behaviour\n * @unstable might need to review the checkbox behaviour (on/off vs true/false)\n * @returns EventSource<string>\n * @example `<form action=\"dialog\" onsubmit=\"${Form(stream)}\"> ... </form>`\n * @example `<form action=\"dialog\" onsubmit=\"${Form(handlerFn)}\"> ... </form>`\n *\n * ## Examples\n * ### Submit a form into a stream\n * \n * No need to call preventDefault() on the event, as this is done automatically\n * ```ts\n * import { rml } from 'rimmel';\n *\n * const Component = () => {\n *   const stream = new Subject<FormData>();\n *\n *   return rml`\n *     <form onsubmit=\"${stream}\">\n *\t     <input type=\"text\" name=\"name\">\n *\t     <input type=\"email\" name=\"email\">\n *     </form>\n *   `;\n * }\n * ```\n * \n * ### Submit a dialog form into a stream\n * ```ts\n * import { rml } from 'rimmel';\n *\n * const Component = () => {\n *   const stream = new Subject<FormData>();\n *\n *   return rml`\n *     <form onsubmit=\"${stream}\">\n *\t     <input type=\"text\" name=\"name\">\n *\t     <input type=\"email\" name=\"email\">\n *     </form>\n *   `;\n * }\n * ```\n\n**/\nexport const Form = inputPipe<SubmitEvent | Event, Object>(\n\tform,\n);\n\nexport const asFormData = form;\nexport const AsFormData = Form;\n","// import type { char } from '../types/basic';\nimport { map } from 'rxjs';\nimport { inputPipe } from '../utils/input-pipe';\n\n/**\n * An Event Operator emitting event.key instead of any KeyboardEvent object\n * @returns OperatorFunction<KeyboardEvent, string>\n *\n * For one-step input pipelines, see the {@link Key | Key (uppercase)} Event Adapter\n *\n * ## Examples\n *\n * ### Collect distinct vowels typed in a text box\n *\n * The following illustrates how to get any key presses from the text box\n * and only pass the actual character through to the main stream\n *\n * ```ts\n * import { Subject, distinct, filter, scan } from 'rxjs';\n * import { rml, source, key } from 'rimmel';\n *\n * const isVowel = filter(c => 'aeiou'.includes(c));\n *\n * const Component = () => {\n *   const vowels = new Subject<string>().pipe(\n *   distinct(),\n *   scan((a, b) => a.concat(b)),\n * );\n *\n *   return rml`\n *     Unique vowels pressed: \"<span>${vowels}\"</span>\"\n *\n *     <input onkeypress=\"${source(key, isVowel, vowels)}>\n *   `;\n * }\n * ```\n */\nexport const key =\n\tmap((e: KeyboardEvent) => e.key)\n;\n\n/**\n * An Event Adapter emitting event.key instead of any KeyboardEvent object\n * @returns EventSource<string>\n *\n * For multi-step input pipelines, see {@link key | key (lowercase)}\n *\n * ## Examples\n *\n * ### Display the last key pressed in a text box\n *\n * The following illustrates how to get any key presses from the text box\n * and only pass the actual character through to the main stream\n *\n * ```ts\n * import { Subject } from 'rxjs';\n * import { rml, Key } from 'rimmel';\n *\n * const Component = () => {\n *   const stream = new Subject<string>();\n *\n *   return rml`\n *     Last character pressed: \"<span>${stream}\"</span>\"\n *\n *     <input onkeypress=\"${Key(stream)}>\n *   `;\n * }\n * ```\n *\n * ### Collect distinct characters typed in a text box\n *\n * The following illustrates how to get any key presses from the text box\n * and only pass the actual character through to the main stream\n *\n * ```ts\n * import { Subject, distinct, scan } from 'rxjs';\n * import { rml, Key } from 'rimmel';\n *\n * const Component = () => {\n *   const stream = new Subject<string>().pipe(\n *   distinct(),\n *   scan((a, b) => a.concat(b)),\n * );\n *\n *   return rml`\n *     Unique characters pressed: \"<span>${stream}\"</span>\"\n *\n *     <input onkeypress=\"${Key(stream)}>\n *   `;\n * }\n * ```\n */\nexport const Key = inputPipe<KeyboardEvent, string>(\n\tkey\n);\n\nexport const asKey = key;\nexport const AsKey = Key;\n","import type { Coords } from '../types/coords';\n\nimport { map } from \"rxjs\";\nimport { inputPipe } from \"../utils/input-pipe\";\n\n/**\n * An Event Source Operator emitting the \"[event.clientX, event.clientY]\" coordinates\n * @returns OperatorFunction<Coords>\n */\nexport const clientXY =\n\tmap((e: PointerEvent) => <Coords>[e.clientX, e.clientY])\n;\n\n/**\n * An Event Source emitting the \"[event.clientX, event.clientY]\" coordinates\n * @returns EventSource<Coords>\n */\nexport const ClientXY = inputPipe<PointerEvent, Coords>(\n\tclientXY\n);\n\nexport const asClientXY = clientXY;\nexport const AsClientXY = ClientXY;\n","import type { Coords } from '../types/coords';\n\nimport { map } from \"rxjs\";\nimport { inputPipe } from \"../utils/input-pipe\";\n\n/**\n * An Event Source Operator emitting the \"[event.offsetX, event.offsetY]\" coordinates\n * @returns OperatorFunction<PointerEvent, <Coords>\n*/\nexport const offsetXY = map((e: PointerEvent) => <Coords>[e.offsetX, e.offsetY]);\n\n/**\n * An Event Adapter emitting the \"[event.offsetX, event.offsetY]\" coordinates\n * @returns EventSource<Coords>\n*/\nexport const OffsetXY = inputPipe<PointerEvent, Coords>(\n\toffsetXY\n);\n\nexport const asOffsetXY = offsetXY;\nexport const AsOffsetXY = OffsetXY;\n","import type { Coords } from '../types/coords';\n\nimport { map } from \"rxjs\";\nimport { inputPipe } from \"../utils/input-pipe\";\n\n/**\n * An Event Operator emitting the \"[x, y]\" coordinates of the last touch event\n * @returns OperatorFunction<TouchEvent, Coords>\n*/\nexport const lastTouchXY =\n\tmap((e: TouchEvent) => {\n\t\tconst t = [...e.touches].at(-1);\n\t\treturn <Coords>[t?.clientX, t?.clientY];\n\t})\n;\n\n/**\n * An Event Source emitting the \"[x, y]\" coordinates of the last touch event\n * @returns EventSource<Coords>\n*/\nexport const LastTouchXY = inputPipe<TouchEvent, Coords>(\n\tlastTouchXY\n);\n\nexport const asLastTouchXY = lastTouchXY;\nexport const AsLastTouchXY = LastTouchXY;","import type { RMLTemplateExpressions } from '../types/internal';\n\nimport { map } from \"rxjs\";\nimport { korma } from '../utils/curry';\n\ntype StringFunction = (s: string) => string;\ntype Replacement = string | StringFunction;\n\n/**\n * An Event Operator that swaps the value of the underlying <input> element\n * with the provided replacement (or empty string by default) and emits the previous value.\n * This operator mutates the element's value as a side effect.\n * @param replacement A string or function used to compute the new value\n * @returns OperatorFunction<Event, string>\n */\nexport const swap =\t<E extends Event>(replacement: Replacement = '') =>\n\tmap((e: E) => {\n\t\tconst t = (<HTMLInputElement>e.target);\n\t\tconst v = t.value;\n\t\tt.value = typeof replacement == 'function' ? replacement(v) : replacement;\n\t\treturn v\n\t})\n;\n\n/**\n * An Event Adapter that swaps the value of the underlying &lt;input&gt; element\n * with the provided replacement (or empty string by default) and emits the previous value to the given target.\n * @param replacement A new value or function to compute the element's next value\n * @param source A handler function or observer to send emitted values to\n * @returns EventSource<string>\n */\nexport const Swap =\n\t<I extends Event>\n\t(replacement?: Replacement, source?: RMLTemplateExpressions.SourceExpression<string>) =>\n\t\tkorma<I, string>([swap<I>(replacement)], source)\n;\n","import type { Observable } from \"rxjs\";\nimport type { MaybeFuture, Observer, Present } from \"../types/futures\";\n\nimport { withLatestFrom, map, of, from } from \"rxjs\";\n\nimport { korma } from \"../utils/curry\";\n\nconst maybeLift = <T>(v: MaybeFuture<T>): Observable<T> =>\n\t(v as Observable<T>).subscribe ? v as Observable<T> :\n\t(v as Promise<T>).then ? from(v as Promise<T>) :\n\tof(v as Present<T>)\n;\n\n/**\n * WIP, experimental, don't use yet\n * Emits the latest value coming from the supplied observable\n */\nexport const AsLatestFrom = <I>(source: MaybeFuture<I>, target?: Observer<I>) => {\n\tconst pipeline = [\n\t\twithLatestFrom(maybeLift(source)),\n\t\tmap(([_, latest]) => latest),\n\t];\n\n\treturn korma(pipeline, target);\n};\n","import { map } from \"rxjs\";\nimport { inputPipe } from '../utils/input-pipe';\nimport { autoValue } from \"../utils/auto-value\";\n\n/**\n * An Event Operator that emits the value of the underlying &lt;input&gt; element into a target observer\n *\n * @category Event Adapter Operators\n * @returns OperatorFunction<Event, string | number | date | null>\n *\n * For simple, one-step input pipelines, see the {@link Cut | Cut (uppercase)} Event Adapter\n *\n * ## Examples\n *\n * ### ValidInfo\n *\n * Create a custom Event Operator that feeds a stream with validated data, once a custom validator passes\n *\n * ```ts\n * import { Subject, filter } from 'rxjs';\n * import { rml, inputPipe, value } from 'rimmel';\n *\n * const isValid = filter((s: string) => IS_VALID_IMPL(s) );\n * const ValidInfo = inputPipe(value, isValid);\n *\n * const Component = () => {\n *   const stream = new Subject<string>();\n *\n *   return rml`\n *     <input type=\"text\" onchange=\"${ValidInfo(stream)}\" autofocus>\n *     [ <span>${stream}</span> ]\n *   `;\n * };\n * ```\n */\nexport const value = map((e: Event) => autoValue(<HTMLInputElement>e.target));\n\n/**\n * An Event Adapter emitting the value of the underlying &lt;input> element instead of a regular DOM Event object\n *\n * ## Example\n * Copy the value of a text box on change\n *\n * ```ts\n * import { Subject } from 'rxjs';\n * import { rml, Value } from 'rimmel';\n *\n * const Component = () => {\n *   const stream = new Subject<string>();\n *\n *   return rml`\n *     <input type=\"text\" onchange=\"${Value(stream)}\" autofocus>\n *     [ <span>${stream}</span> ]\n *   `;\n * };\n * ```\n */\nexport const Value = inputPipe<Event, string>(\n\tvalue\n);\n\n/**\n * An Event Adapter emitting the type-detected value of the underlying &lt;input> element instead of a regular DOM Event object\n *\n * ## Example\n * Copy the value of a text box on change\n *\n * ```ts\n * import { Subject } from 'rxjs';\n * import { rml, AutoValue } from 'rimmel';\n *\n * const Component = () => {\n *   const stream = new Subject<number>;\n *\n *   return rml`\n *     <input type=\"number\" onchange=\"${AutoValue(stream)}\" autofocus>\n *     [ <span>${stream}</span> ]\n *   `;\n * };\n * ```\n */\nexport const AutoValue = Value;\n\n/**\n * An Event Source Operator emitting the value of the underlying &lt;input> element instead of a regular DOM Event object\n * @returns OperatorFunction<Event, string>\n */\nexport const valueAsString = map((e: Event) => (<HTMLInputElement>e.target).value);\n\n/**\n * An Event Adapter emitting the value of the underlying &lt;input> element instead of a regular DOM Event object\n * @param handler A handler function or observer to send events to\n * @returns EventSource<string>\n */\nexport const ValueAsString = inputPipe<Event, string>(\n\tvalueAsString\n);\n\n/**\n * An Event Source Operator for valueAsNumber\n * Emits the numeric value of the underlying &lt;input type=\"number\"> or &lt;input type=\"range\"> instead of a regular DOM Event object\n * @returns OperatorFunction<Event, number | null>\n */\nexport const valueAsNumber = map((e: Event) => (<HTMLInputElement>e.target).valueAsNumber);\n\n/**\n * An Event Source for valueAsNumber\n * Emits the numeric value of the underlying &lt;input type=\"number\"> or &lt;input type=\"range\"> instead of a regular DOM Event object\n * @returns EventSource<number>\n */\nexport const ValueAsNumber = inputPipe<Event, number>(\n\tvalueAsNumber,\n);\n\n/**\n * An Event Source Operator for valueAsDate\n * Emits the numeric value of the underlying `<input type=\"date\">` instead of a regular DOM Event object\n * @returns OperatorFunction<Event, Date | null>\n */\nexport const valueAsDate = map((e: Event) => (<HTMLInputElement>e.target).valueAsDate);\n\n/**\n * An Event Adapter for valueAsDate\n * Emits the numeric value of the underlying `<input type=\"date\">` instead of a regular DOM Event object\n * @returns EventSource<Date | null>\n */\nexport const ValueAsDate = inputPipe<Event, Date | null>(\n\tvalueAsDate\n);\n\nexport const asValue = value;\nexport const AsValue = Value;\nexport const asStringValue = valueAsString;\nexport const AsStringValue = ValueAsString;\nexport const asNumericValue = valueAsNumber;\nexport const AsNumericValue = ValueAsNumber;\nexport const asDateValue = valueAsDate;\nexport const AsDateValue = ValueAsDate;\n","import type { ExplicitSink, Sink } from \"../types/sink\";\nimport type { RMLTemplateExpressions, SinkBindingConfiguration } from \"../types/internal\";\nimport type { MaybeFuture } from \"../types/futures\";\n\nimport { SINK_TAG } from \"../constants\";\nimport { asap } from \"../lib/drain\";\n\nexport const AnyContentSink: Sink<Element> = (node: Element) =>\n    (htmlSource: MaybeFuture<string>) => {\n        asap((html: string) => node.innerHTML = html, htmlSource)\n    }\n;\n\nexport const NodeValueSink: Sink<Element | Text> = (node: Node) =>\n    (str: string) => {\n        node.nodeValue = str\n    }\n;\n\n/**\n * A specialised sink to set the nodeValue on a node\n * @param source A present or future string\n * @returns RMLTemplateExpression A text-node RML template expression\n * @example <div>${NodeValue(stream)}</div>\n */\nexport const NodeValue: ExplicitSink<'text'> = (source: RMLTemplateExpressions.StringLike) =>\n    <SinkBindingConfiguration<Element>>({\n        type: SINK_TAG,\n        t: 'NodeValue',\n        source,\n        sink: NodeValueSink,\n    })\n;\n\n","export const camelCase = (s: string) =>\n    s.split('-').map((s, i) => i ? s[0].toLocaleUpperCase() + s.slice(1) : s).join('')\n;\n\n","import type { Sink } from \"../types/sink\";\n\nimport { BOOLEAN_ATTRIBUTES } from \"../definitions/boolean-attributes\";\nimport { asap } from \"../lib/drain\";\nimport { camelCase } from \"../utils/camelCase\";\n\ntype DatasetKey = string;\n\nexport const DatasetSink: Sink<HTMLElement> = (node: HTMLElement, key: DatasetKey) => {\n\tconst { dataset } = node;\n\treturn (str: string) => {\n\t\tdataset[camelCase(key)] = str;\n\t};\n};\n\nexport const DatasetItemPreSink = (key: DatasetKey): Sink<HTMLElement> =>\n\t(node: HTMLElement) => {\n\t\tconst { dataset } = node;\n\t\treturn (str: string) => {\n\t\t\tdataset[camelCase(key)] = str;\n\t\t};\n\t}\n;\n\nexport const DatasetObjectSink: Sink<HTMLElement | SVGElement | MathMLElement> = (node: HTMLElement | SVGElement | MathMLElement) => {\n\tconst { dataset } = node;\n\treturn (data: Record<DatasetKey, string | null | undefined>) => {\n\t\tfor (const [key, str] of Object.entries(data ?? {})) {\n\t\t\tconst camelKey = camelCase(key);\n\t\t\t([undefined, null, false].includes(str as any) || (str == 'false' && BOOLEAN_ATTRIBUTES.has(key)))\n\t\t\t//(str === undefined || str == null || (str == false || str == 'false') && BOOLEAN_ATTRIBUTES.has(key))\n\t\t\t\t? delete dataset[camelKey]\n\t\t\t\t: asap((str: string) => dataset[camelKey] = str, str);\n\t\t}\n\t};\n};\n","import type { ExplicitSink, Sink } from \"../types/sink\";\nimport type { RMLTemplateExpressions, SinkBindingConfiguration } from \"../types/internal\";\n\nimport { SINK_TAG } from \"../constants\";\n\nexport const APPEND_HTML_SINK_TAG = 'appendHTML';\n\nexport const AppendHTMLSink: Sink<Element> =\n\t(node: Element) =>\n\t\tnode.insertAdjacentHTML.bind(node, 'beforeend')\n;\n\n/**\n * A specialised sink to append HTML to the end of an element\n * @param source A present or future HTML string\n * @returns RMLTemplateExpression An HTML-subtree or RML template expression\n * @example <div>${AppendHTML(stream)}</div>\n */\nexport const AppendHTML: ExplicitSink<'content'> = (source: RMLTemplateExpressions.HTMLText, pos: InsertPosition = 'beforeend') =>\n\t<SinkBindingConfiguration<Element>>({\n\t\ttype: SINK_TAG,\n\t\tt: APPEND_HTML_SINK_TAG,\n\t\tsource,\n\t\tsink: AppendHTMLSink,\n\t\tparams: pos,\n\t})\n;\n\n","import type { ExplicitSink, Sink, SinkElementTypes } from \"../types/sink\";\nimport type { RMLTemplateExpressions, SinkBindingConfiguration } from \"../types/internal\";\nimport type { FocusableElement } from '../types/rml';\n\nimport { SINK_TAG } from \"../constants\";\n\nexport const BLUR_SINK_TAG = 'blur';\n\nexport const BlurSink: Sink<FocusableElement> = (node: FocusableElement) =>\n\tnode.blur.bind(node)\n;\n\n/**\n * A specialised sink for the \"rml:blur\" RML attribute\n * @param source A present or future boolean value\n * @returns RMLTemplateExpression A template expression for the \"rml:blur\" attribute\n * @example <input type=\"text\" rml:blur=\"${booleanValue}\">\n * @example <input type=\"text\" rml:blur=\"${booleanPromise}\">\n * @example <input type=\"text\" rml:blur=\"${booleanObservable}\">\n * @example <input type=\"text\" rml:blur=\"${Blur(booleanObservable)}\">\n */\nexport const Blur: ExplicitSink<'rml:blur'> = (source: RMLTemplateExpressions.BooleanAttributeValue<'rml:blur'>) =>\n  <SinkBindingConfiguration<FocusableElement>>({\n    type: SINK_TAG,\n    t: BLUR_SINK_TAG,\n    source,\n    sink: BlurSink,\n  })\n;\n\n","import type { RMLTemplateExpressions, SinkBindingConfiguration } from \"../types/internal\";\nimport type { Sink, ExplicitSink } from \"../types/sink\";\n\nimport { SINK_TAG } from \"../constants\";\n\nexport const CHECKED_SINK_TAG = 'checked';\n\nexport const CheckedSink: Sink<HTMLInputElement> = (node: HTMLInputElement) =>\n  (checked: boolean) => {\n    node.checked = checked\n  };\n\n/**\n * A specialised sink for the \"checked\" HTML attribute\n * @param source A present or future boolean value\n * @returns RMLTemplateExpression A template expression for the \"checked\" DOM attribute\n * @example <input type=\"checkbox\" checked=\"${booleanValue}\">\n * @example <input type=\"checkbox\" checked=\"${booleanPromise}\">\n * @example <input type=\"checkbox\" checked=\"${booleanObservable}\">\n * @example <input type=\"checkbox\" checked=\"${Checked(booleanPromise)}\">\n */\nexport const Checked: ExplicitSink<'checked'> = (source: RMLTemplateExpressions.BooleanAttributeValue<'checked'>) =>\n  <SinkBindingConfiguration<HTMLInputElement>>({\n    type: SINK_TAG,\n    t: CHECKED_SINK_TAG,\n    source,\n    sink: CheckedSink,\n  })\n;\n","/**\n * Create a secure object to be used as a small dictionary.\n * By secure we mean one with an empty prototype, immune to\n * prototype pollution attacks.\n * Consider using a Map() instead when the number of keys is expected\n * to be large or when used with polymorphic/megamorphic shapes\n */\nexport const ObjectMap = <T extends Record<string, any>>(obj: T) =>\n\tObject.assign(Object.create(null), obj)\n;\n","import type { MaybeFuture } from \"../types\";\nimport type { RMLTemplateExpressions, SinkBindingConfiguration } from \"../types/internal\";\nimport type { Sink, ExplicitSink } from \"../types/sink\";\n\nimport { SINK_TAG } from \"../constants\";\nimport { asap } from \"../lib/drain\";\nimport { ObjectMap } from \"../lib/object-map\";\n\nexport const CLASSLIST_SINK_TAG = 'classlist';\n\nexport interface ClassListObject {\n\tset?: MaybeFuture<ClassName | ClassName[]>;\n\tadd?: MaybeFuture<ClassName | ClassName[]>;\n\tremove?: MaybeFuture<ClassName | ClassName[]>;\n\ttoggle?: MaybeFuture<ClassName | ClassName[]>;\n};\n\nexport type ClassName = string;\n\nexport const ClassListSink: Sink<Element> = (node: Element) => {\n\tconst tokenList = node.classList;\n\tconst tokenAccessors = ObjectMap({\n\t\tset: (str: string) => node.className = str,\n\t\tadd: tokenList.add.bind(tokenList),\n\t\tremove: tokenList.remove.bind(tokenList),\n\t\ttoggle: tokenList.toggle.bind(tokenList),\n\t});\n\n\treturn (data: ClassListObject) => {\n\t\tObject.entries(data)\n\t\t\t.forEach(([k, v]) => {\n\t\t\t\ttokenAccessors[k] && asap(tokenAccessors[k], v);\n\t\t\t})\n\t\t;\n\t};\n};\n\n/**\n * A specialised sink for the various methods of the \"classList\" DOM interface.\n * You will use this from Mixins\n * @example\n * ```\n * const mix = {\n *   classList: {\n *     add: from(['cls1', 'cls2', 'cls3']),\n *     remove: Promise.resolve('cls4'),\n *     toggle: 'cls5',\n *   }\n * };\n * \n * const template = rml`\n *   <div ${mix}>Set classes here</div>\n * `;\n * ```\n**/\nexport const ClassList: ExplicitSink<'class'> = (source: RMLTemplateExpressions.ClassName) =>\n\t<SinkBindingConfiguration<HTMLElement | SVGElement>>({\n\t\ttype: SINK_TAG,\n\t\tt: 'ClassList',\n\t\tsource,\n\t\tsink: ClassListSink,\n\t})\n;\n","import type { CSSClassName } from \"../types/style\";\nimport type { RMLTemplateExpressions, SinkBindingConfiguration } from \"../types/internal\";\nimport type { Sink, ExplicitSink } from \"../types/sink\";\n\nimport { SINK_TAG } from \"../constants\";\nimport { asap } from \"../lib/drain\";\nimport { ObjectMap } from \"../lib/object-map\";\n\nexport const TOGGLE_CLASS_SINK_TAG = 'ToggleClass';\nexport const CLASS_SINK_TAG = 'class'; // Keeping it same as 'class\" attribute for now. Don't change yet...\n\nexport type ClassRecord = Record<string, string>;\nexport type ClassName = string;\nexport type ElementsSupportingClass = Record<string, string>;\n\nexport const ToggleClassSink = (className: ClassName): Sink<HTMLElement | SVGElement> =>\n\t(node: HTMLElement | SVGElement) =>\n\t\tnode.classList.toggle.bind(node.classList, className)\n;\n\nexport const ClassNameSink: Sink<HTMLElement | SVGElement> = (node: HTMLElement | SVGElement) =>\n\t(str: CSSClassName) =>\n\t\t//@ts-ignore\n\t\tnode.className = str\n;\n\nexport const ClassObjectSink: Sink<Element> = (node: Element) => {\n\tconst cl = node.classList;\n\tconst set = (str: string) => node.className = str;\n\tconst add = cl.add.bind(cl);\n\tconst remove = cl.remove.bind(cl);\n\tconst toggle = cl.toggle.bind(cl);\n\n\treturn (name: ClassName | ClassRecord | ((ClassName | ClassRecord)[])) => {\n\t\t// Do we really want to check for strings here??\n\t\ttypeof name == 'string'\n\t\t\t? add(name)\n\t\t\t// FIXME: is it safe to assume it's an object, at this point?\n\t\t\t: (<(ClassName | ClassRecord)[]>[]).concat(name).forEach(obj => Object.entries(obj ?? {})\n\t\t\t\t\t// TODO: support 3-state with toggle\n\t\t\t\t\t.forEach(([k, v]) => {\n\t\t\t\t\t\t// Use asap to handle both present and future values\n\t\t\t\t\t\t// For futures (Promise/Observable), it will wait for resolution\n\t\t\t\t\t\t// For present values, it will execute immediately\n\t\t\t\t\t\tasap((resolvedValue: any) => resolvedValue ? add(k) : remove(k), v);\n\t\t\t\t\t})\n\t\t\t\t)\n\t};\n};\n\n//////////////////////////\nexport const ExperimentalClassObjectSink: Sink<Element> = (node: Element) => {\n\tconst cl = node.classList;\n\tconst add = cl.add.bind(cl);\n\tconst remove = cl.remove.bind(cl);\n\tconst toggle = cl.toggle.bind(cl);\n\n\t// const actions = Record<string | number | boolean | undefined, (name: ClassName) => void>([\n\tconst actions = ObjectMap({\n\t\ttrue: add,\n\t\tfalse: remove,\n\t\tundefined: remove,\n\t\t[-1]: remove,\n\t\t[0]: toggle,\n\t\tnull: toggle,\n\t\tNaN: toggle,\n\t\t[1]: add,\n\t});\n\n\treturn (name: ClassName | ClassRecord) => {\n\t\ttypeof name == 'string'\n\t\t\t? add(name)\n\t\t\t// FIXME: is it safe to assume it's an object, at this point?\n\t\t\t\t: Object.entries(name ?? {})\n\t\t\t\t.forEach(([k, v]) => actions[v]?.(k));\n\t};\n};\n\n/**\n * A specialised sink to toggle individual classes on a given element\n * Will toggle the specified class name on the specified element, whenever the source emits. The actual value of the source will be ignored, as it's the emissions which will cause the class toggling.\n * @param source A present or future string\n * @param className The class name to toggle\n * @returns RMLTemplateExpression A template expression for the \"className\" attribute\n * @example <div class=\"${ToggleClassName('class1', stringPromise)}\">\n * @example <div class=\"${ToggleClassName('class2', stringObservable)}\">\n**/\nexport const ToggleClass: ExplicitSink<'class'> =\n\t(source: RMLTemplateExpressions.Any, className: CSSClassName) =>\n\t\t<SinkBindingConfiguration<HTMLElement | SVGElement>>({\n\t\t\ttype: SINK_TAG,\n\t\t\tt: TOGGLE_CLASS_SINK_TAG,\n\t\t\tsource,\n\t\t\tsink: ToggleClassSink(className),\n\t\t})\n;\n\n/**\n * A specialised sink for the \"class\" HTML attribute\n * Will set the whole className of an element to the string emitted by the source\n * @param source A present or future string\n * @returns RMLTemplateExpression A template expression for the \"className\" attribute\n * @example <div class=\"${stringPromise}\">\n * @example <div class=\"${stringObservable}\">\n * @example <div class=\"${ClassName(stringObservable)}\">\n**/\nexport const ClassName: ExplicitSink<'class'> = (source: RMLTemplateExpressions.ClassName) =>\n\t<SinkBindingConfiguration<HTMLElement | SVGElement>>({\n\t\ttype: SINK_TAG,\n\t\tt: 'ClassName',\n\t\tsource,\n\t\tsink: ClassNameSink,\n\t})\n;\n","import type { RMLTemplateExpressions, SinkBindingConfiguration } from \"../types/internal\";\nimport type { ExplicitSink, Sink } from \"../types/sink\";\n\nimport { SINK_TAG } from \"../constants\";\n\nexport const CLOSED_SINK_TAG = 'closed';\n\n/**\n * A sink that closes a &lt;dialog&gt; element when a source streams emits\n * @param dialogBox an HTMLDialogElement\n * @returns \n */\nexport const ClosedSink: Sink<HTMLDialogElement> = (dialogBox: HTMLDialogElement) =>\n\tdialogBox.close.bind(dialogBox)\n;\n\n/**\n * An explicit sink that closes a &lt;dialog&gt; element when a source streams emits a non falsey value\n *\n * You can call this sink in the following ways:\n * - implicitly, by assigning it to the `rml:closed` attribute of a `<dialog>` element\n * - explicitly, by using the `Closed` sink\n * - via a {@link Mixin}, by emitting a `rml:closed` key-value pair\n *\n * @returns Sink\n *\n * ## Examples\n *\n * ### Close a &lt;dialog&gt; box when a button is clicked\n *\n * ```ts\n * import { Subject } from 'rxjs';\n * import { rml } from 'rimmel';\n *\n * const Component = () => {\n *   const close = new Subject();\n *\n *   return rml`\n *     <dialog rml:closed=\"${close}\">\n *       <button onclick=\"${close}\">Close</button>\n *     </dialog>\n *   `;\n * }\n * ```\n *\n * ### Close a &lt;dialog&gt; box in 10s or when a button is clicked\n *\n * ```ts\n * import { Subject, merge } from 'rxjs';\n * import { rml } from 'rimmel';\n *\n * const Component = () => {\n *   const close = new Subject();\n *   const timeout = new Promise(resolve => setTimeout(resolve, 10000));\n *\n *   return rml`\n *     <dialog rml:closed=\"${merge(close, timeout)}\">\n *       <button onclick=\"${close}\">Close</button>\n *     </dialog>\n *   `;\n * }\n * ```\n * ### Close a &lt;dialog&gt; box from a {@link Mixin}\n *\n * ```ts\n * import { Subject } from 'rxjs';\n * import { rml } from 'rimmel';\n *\n * const Autoclose = () => {\n *   const timeout = new Promise(resolve => setTimeout(resolve, 10000));\n *\n *   return {\n *     'rml:closed': timeout,\n *   };\n * };\n *\n * const Component = () => rml`\n *     <dialog ...${Autoclose}>\n *       this box will close in 10s\n *     </dialog>\n *   `;\n * }\n * ```\n */\nexport const Closed: ExplicitSink<'closed'> = (source: RMLTemplateExpressions.BooleanAttributeValue<'closed'>) =>\n\t<SinkBindingConfiguration<HTMLDialogElement>>({\n\t\ttype: SINK_TAG,\n\t\tt: CLOSED_SINK_TAG,\n\t\tsource,\n\t\tsink: ClosedSink,\n\t})\n;\n","import type { ExplicitSink, Sink, SinkElementTypes } from \"../types/sink\";\nimport type { RMLTemplateExpressions, SinkBindingConfiguration } from \"../types/internal\";\n\nimport { SINK_TAG } from \"../constants\";\n\nexport const DISABLED_SINK_TAG = 'disabled';\n\n/**\n * An Element supporting the \"disabled\" HTML attribute (i.e.: that can be disabled)\n */\ntype Disableable = SinkElementTypes[\"disabled\"][\"elements\"];\n\nexport const DisabledSink: Sink<Disableable> = (node: Disableable) =>\n\t(value: boolean) => {\n\t\tnode.disabled = value;\n\t};\n;\n\n/**\n * A specialised sink for the \"disabled\" HTML attribute\n * @param source A present or future boolean value\n * @returns RMLTemplateExpression A template expression for the \"disabled\" attribute\n * @example <input type=\"button\" disabled=\"${booleanValue}\">\n * @example <input type=\"button\" disabled=\"${booleanPromise}\">\n * @example <input type=\"button\" disabled=\"${booleanObservable}\">\n * @example <input type=\"button\" disabled=\"${Disabled(booleanObservable)}\">\n */\nexport const Disabled: ExplicitSink<'disabled'> = (source: RMLTemplateExpressions.BooleanAttributeValue<'disabled'>) =>\n\t<SinkBindingConfiguration<Disableable>>({\n\t\ttype: SINK_TAG,\n\t\tt: DISABLED_SINK_TAG,\n\t\tsource,\n\t\tsink: DisabledSink,\n\t})\n;\n\n","import type { ExplicitSink, Sink } from \"../types/sink\";\nimport type { RMLTemplateExpressions, SinkBindingConfiguration } from \"../types/internal\";\nimport type { FocusableElement } from '../types/rml';\n\nimport { SINK_TAG } from \"../constants\";\n\nexport const FOCUS_SINK_TAG = 'focus';\n\nexport const FocusSink: Sink<FocusableElement> = (node: FocusableElement) =>\n\t(state: boolean) => {\n\t\tstate ? node.focus?.() : node.blur?.();\n\t};\n;\n\n/**\n * A specialised sink for the \"rml:focus\" RML attribute\n * @param source A present or future boolean value\n * @returns RMLTemplateExpression A template expression for the \"rml:focus\" RML attribute\n * @example <input type=\"text\" rml:focus=\"${booleanValue}\">\n * @example <input type=\"text\" rml:focus=\"${booleanPromise}\">\n * @example <input type=\"text\" rml:focus=\"${booleanObservable}\">\n * @example <input type=\"text\" rml:focus=\"${Focus(booleanPromise)}\">\n */\nexport const Focus: ExplicitSink<'rml:focus'> = (source: RMLTemplateExpressions.BooleanAttributeValue<'rml:focus'>) =>\n\t<SinkBindingConfiguration<FocusableElement>>({\n\t\ttype: SINK_TAG,\n\t\tt: FOCUS_SINK_TAG,\n\t\tsource,\n\t\tsink: FocusSink,\n\t})\n;\n","import type { RMLTemplateExpressions, SinkBindingConfiguration } from \"../types/internal\";\nimport type { Sink, ExplicitSink } from \"../types/sink\";\n\nimport { SINK_TAG } from \"../constants\";\n\nexport const HIDDEN_SINK_TAG = 'hidden';\n\nexport const HiddenSink: Sink<HTMLElement> = (node: HTMLElement) =>\n  (hidden: boolean) => {\n    node.hidden = hidden\n  };\n\n/**\n * A specialised sink for the \"hidden\" HTML attribute\n * @param source A present or future boolean value\n * @returns RMLTemplateExpression A template expression for the \"hidden\" DOM attribute\n * @example <div hidden=\"${booleanValue}\">\n * @example <div hidden=\"${booleanPromise}\">\n * @example <div hidden=\"${booleanObservable}\">\n * @example <div hidden=\"${Hidden(booleanPromise)}\">\n */\nexport const Hidden: ExplicitSink<'hidden'> = (source: RMLTemplateExpressions.EnumAttributeValue<'hidden'>) =>\n  <SinkBindingConfiguration<HTMLElement>>({\n    type: SINK_TAG,\n    t: HIDDEN_SINK_TAG,\n    source,\n    sink: HiddenSink,\n  })\n;\n\n","import type { ExplicitSink, HTMLSinkable, Sink } from \"../types/sink\";\nimport type { RMLTemplateExpressions, SinkBindingConfiguration } from \"../types/internal\";\n\nimport { SINK_TAG } from \"../constants\";\nimport { HTMLString } from \"../types\";\n\nexport const INNER_HTML_SINK_TAG = 'innerHTML';\n\n// consider declarative partial updates\n// https://developer.chrome.com/blog/declarative-partial-updates\nexport const InnerHTMLSink: Sink<HTMLSinkable> = (node: HTMLSinkable) =>\n\t(html: HTMLString) => {\n\t\tnode.innerHTML = html\n\t}\n;\n\n/**\n * A specialised sink to set the innerHTML of an element\n * @param source A present or future HTML string\n * @returns RMLTemplateExpression An HTML-subtree RML template expression\n * @example <div>${InnerHTML(stream)}</div>\n */\nexport const InnerHTML: ExplicitSink<'content'> = (source: RMLTemplateExpressions.HTMLText) =>\n\t<SinkBindingConfiguration<Element>>({\n\t\ttype: SINK_TAG,\n\t\tt: INNER_HTML_SINK_TAG,\n\t\tsource,\n\t\tsink: InnerHTMLSink,\n\t})\n;\n","import type { ExplicitSink, Sink } from \"../types/sink\";\nimport type { RMLTemplateExpressions, SinkBindingConfiguration } from \"../types/internal\";\n\nimport { SINK_TAG } from \"../constants\";\n\nexport const INNER_TEXT_SINK_TAG = 'innerText';\n\nexport const InnerTextSink: Sink<HTMLElement> = (node: HTMLElement) =>\n\t(html: string) => {\n\t\tnode.innerText = html\n\t}\n;\n\n/**\n * A specialised sink to set the innerText on an element\n * @param source A present or future string\n * @returns RMLTemplateExpression A text-node RML template expression\n * @example <div>${InnerText(stream)}</div>\n */\nexport const InnerText: ExplicitSink<'text'> = (source: RMLTemplateExpressions.StringLike) =>\n\t<SinkBindingConfiguration<HTMLElement>>({\n\t\ttype: SINK_TAG,\n\t\tt: INNER_TEXT_SINK_TAG,\n\t\tsource,\n\t\tsink: InnerTextSink,\n\t});\n\n","import type { Sink } from \"../types/sink\";\n\nexport const READ_ONLY_SINK_TAG = 'readonly';\n\n/**\n * A specialised sink for the \"readonly\" HTML attribute\n * @param source A present or future boolean value\n * @returns RMLTemplateExpression A template expression for the \"readonly\" attribute\n * @example <input type=\"button\" readonly=\"${booleanValue}\">\n * @example <input type=\"button\" readonly=\"${booleanPromise}\">\n * @example <input type=\"button\" readonly=\"${booleanObservable}\">\n */\nexport const ReadonlySink: Sink<HTMLInputElement> = (node: HTMLInputElement) =>\n\t(value: boolean) => {\n\t\tnode.readOnly = value;\n\t};\n;\n\n","import type { ExplicitSink, Sink } from \"../types/sink\";\nimport type { RMLTemplateExpressions, SinkBindingConfiguration } from \"../types/internal\";\n\nimport { SINK_TAG } from \"../constants\";\n\nexport const REMOVED_SINK_TAG = 'removed';\n\n/**\n * A sink that removes the given element from the DOM when the source emits\n * @param e A DOM element\n * @returns A sink that removes the element when called\n */\nexport const RemovedSink: Sink<Element> = (e: Element) =>\n\te.remove.bind(e)\n;\n\n/**\n * Removed Sink\n *\n * A specialised sink to remove an element from the DOM when its source emits\n * Once removed the underlying element can't be restored. Most useful with <dialog> boxes and other ephemeral containers\n *\n * @param source A present or future boolean value\n * @returns RMLTemplateExpression A template expression for the \"rml:close\" attribute\n *\n * ## Examples\n *\n * ### Remove an Element\n *\n * Remove an element after 5s\n *\n * ```ts\n * import { rml } from 'rimmel';\n *\n * const Component = () => {\n *   const delay = new Promise(resolve => setTimeout(resove, 5000));\n *\n *   return rml`\n *     <div rml:removed=\"${delay}\">\n *       removing in 5s\n *     </div>\n *   `;\n * }\n * ```\n *\n * ### Remove an Element on click\n *\n * Remove an element after 5s\n *\n * ```ts\n * import { Subject } from 'rxjs';\n * import { rml } from 'rimmel';\n *\n * const Component = () => {\n *   const remove = new Subject();\n *\n *   return rml`\n *     <div rml:removed=\"${remove}\">\n *       <button onclick=\"${remove}\">click to remove</button>\n *     </div>\n *   `;\n * }\n * ```\n *\n * ### Specifying the sink explicitly\n *\n * Remove an element after 5s, making the sink type explicit\n *\n * ```ts\n * import { rml } from 'rimmel';\n *\n * const Component = () => {\n *   const delay = new Promise(resolve => setTimeout(resove, 5000));\n *\n *   return rml`\n *     <div ...${Removed(delay)}>\n *       removing in 5s\n *     </div>\n *   `;\n * }\n * ```\n *\n * ### Specifying the sink from a mixin\n *\n * Remove an element after 5s, using a {@link Mixin | Mixin}\n *\n * ```ts\n * import { rml } from 'rimmel';\n *\n * const Autoremove = () => {\n *   const delay = new Promise(resolve => setTimeout(resove, 5000));\n *\n *   return {\n *     'rml:removed': delay,\n *   };\n * };\n *\n * const Component = () => rml`\n *   <div ...${Autoremove()}>\n *     will be removed when the mixin decides...\n *   </div>\n * `;\n * \n * ```\n */\nexport const Removed: ExplicitSink<'mixin' | 'removed'> = (source: RMLTemplateExpressions.Any) =>\n\t<SinkBindingConfiguration<Element>>({\n\t\ttype: SINK_TAG,\n\t\tt: REMOVED_SINK_TAG,\n\t\tsource,\n\t\tsink: RemovedSink,\n\t})\n;\n","import type { DOMSubtreeObject, RMLTemplateExpressions, SinkBindingConfiguration } from \"../types/internal\";\nimport type { HTMLContainerElement } from \"../types/dom\";\nimport type { Sink, ExplicitSink } from \"../types/sink\";\n\nimport { AttributeObjectSink } from \"./attribute-sink\";\n\nimport { SINK_TAG } from \"../constants\";\n\nexport const SubtreeSink: Sink<HTMLInputElement> =\n\t(node: HTMLContainerElement) =>\n\t\t(subtreeData: DOMSubtreeObject) => {\n\t\t\tObject.entries(subtreeData)\n\t\t\t\t.forEach(([k, v]) =>\n\t\t\t\t\t[...node.querySelectorAll(k)].forEach((e: Element) =>\n\t\t\t\t\t\tAttributeObjectSink(e as HTMLContainerElement)(v)\n\t\t\t\t\t)\n\t\t\t\t);\n\t\t};\n\n/**\n * A specialised sink to deep-merge a DOM subtree into the target element\n * @param source A present or future DOM Subtree Object\n * @returns RMLTemplateExpression A template expression for the \"checked\" attribute\n * @remarks Most useful in a mixin\n * @example <div>${Subtree(subtreeObject)}</div>\n */\nexport const Subtree: ExplicitSink<'subtree'> =\n\t(source: RMLTemplateExpressions.Any) => ({\n\t\ttype: SINK_TAG,\n\t\tt: 'subtree',\n\t\tsource,\n\t\tsink: SubtreeSink,\n\t}) as SinkBindingConfiguration<HTMLContainerElement | SVGElement | MathMLElement>\n;\n","import type { CSSDeclaration, CSSValue, CSSWritableProperty } from \"../types/style\";\nimport type { Sink } from \"../types/sink\";\n\nimport { asap } from \"../lib/drain\";\nimport { camelCase } from \"../utils/camelCase\";\n\nexport const STYLE_OBJECT_SINK_TAG = 'StyleObject';\n\nconst getCSSPropertySetter = <K extends keyof CSSDeclaration>(style: CSSStyleDeclaration, key: K) =>\n\t/^--/.test(key as string)\n\t\t? (value: CSSValue<K>) => { value == null ? style.removeProperty(key as string) : style.setProperty(key as string, value as string); }\n\t\t: (value: CSSValue<K>) => { style[key] = value; }\n;\n\n/**\n * Applies a given CSS value to a specified CSS property of an Element.\n *\n * @param Element node - The HTML element to which the CSS property will be applied.\n * @param CSSProperty key - The CSS property that will be set on the element.\n * @returns Function A function that takes a CSS value (specific to the CSS property)\n *                     and applies it to the element's style.\n * @example // Applies a background color to a div element\n * const divElement = document.getElementById('myDiv');\n * const setBackgroundColor = styleSink(divElement, 'backgroundColor');\n * setBackgroundColor('red'); // Sets the div's background color to red\n**/\nexport const StyleSink: Sink<HTMLElement | SVGElement> =\n\t<K extends keyof CSSDeclaration>\n\t(node: HTMLElement | SVGElement, key: K) =>\n\t\tgetCSSPropertySetter(node.style, key as keyof CSSStyleDeclaration);\n;\n\nexport const StylePreSink = (key: keyof CSSWritableProperty) =>\n\t(node: HTMLElement | SVGElement) =>\n\t\tStyleSink(node, camelCase(key as string))\n;\n\nexport const StyleObjectSink: Sink<HTMLElement | SVGElement> = (node: HTMLElement | SVGElement) =>\n\t(kvp: CSSDeclaration) =>\n\t\tObject.entries(kvp ?? {})\n\t\t\t.forEach(([k, v]) =>\n\t\t\t\tasap(getCSSPropertySetter(node.style, k as keyof CSSDeclaration), v)\n\t\t\t)\n;\n\n","import type { ExplicitSink, Sink } from \"../types/sink\";\nimport type { RMLTemplateExpressions, SinkBindingConfiguration } from \"../types/internal\";\n\nimport { SINK_TAG } from \"../constants\";\n\nexport const TEXT_CONTENT_SINK_TAG = 'TextContent';\n\nexport const TextContentSink: Sink<Element> = (node: Node) =>\n\t(str: string) => {\n\t\tnode.textContent = str\n\t}\n;\n\n/**\n * A specialised sink to set the textContent on a node\n * @param source A present or future string\n * @textNodeOnly A flag to only apply the sink to text child nodes of a node, not its whole text content\n * @returns RMLTemplateExpression A text-node RML template expression\n * @example <div>${TextContent(stream)}</div>\n */\nexport const TextContent: ExplicitSink<'text'> = (source: RMLTemplateExpressions.StringLike, textNodeOnly=false) =>\n\t<SinkBindingConfiguration<Element>>({\n\t\ttype: SINK_TAG,\n\t\tt: TEXT_CONTENT_SINK_TAG,\n\t\tsource: source,\n\t\tsink: TextContentSink,\n\t\ttextNodeOnly,\n\t})\n;\n","import { Sink } from \"../types/sink\";\n\n/**\n * An explicit sink that sets the .value of an HTML input element\n *\n * @param Element node - The HTML Input element to change the value for\n * @returns Function A function that takes a value and sets it as the element's .value\n **/\nexport const ValueSink: Sink<HTMLInputElement> =\n\t(node: HTMLInputElement) =>\n\t\t(str: string) => {\n\t\t\tnode.value = str;\n\t\t}\n;\n","import type { RMLTemplateExpressions, SinkBindingConfiguration } from \"../types/internal\";\nimport type { Sink } from \"../types/sink\";\n\nimport { AppendHTMLSink } from \"../sinks/append-html-sink\";\nimport { BlurSink } from \"../sinks/blur-sink\";\nimport { CheckedSink } from \"../sinks/checked-sink\";\nimport { ClassListSink } from \"../sinks/classlist.sink\";\nimport { ClassObjectSink } from \"../sinks/class-sink\";\nimport { ClosedSink } from \"../sinks/closed-sink\";\nimport { DatasetSink, DatasetObjectSink } from \"../sinks/dataset-sink\";\nimport { DisabledSink } from \"../sinks/disabled-sink\";\nimport { FocusSink } from \"../sinks/focus-sink\";\nimport { HiddenSink } from \"../sinks/hidden-sink\";\nimport { InnerHTMLSink } from \"../sinks/inner-html-sink\";\nimport { InnerTextSink } from \"../sinks/inner-text-sink\";\nimport { ReadonlySink } from \"../sinks/readonly-sink\";\nimport { RemovedSink } from \"../sinks/removed-sink\";\nimport { SubtreeSink } from \"../sinks/subtree-sink\";\nimport { StyleObjectSink } from \"../sinks/style-sink\";\nimport { TextContentSink } from \"../sinks/text-content-sink\";\nimport { ToggleAttributePreSink } from \"../sinks/attribute-sink\";\nimport { ValueSink } from \"../sinks/value-sink\";\n\nexport const sinkByAttributeName = new Map(<Iterable<readonly [string, Sink<any>]>>[\n\t['appendHTML',      AppendHTMLSink],\n\t['checked',         CheckedSink],\n\t['class',           ClassObjectSink],\n\t['classList',       ClassListSink],\n\t//['contenteditable', ToggleAttributePreSink('contenteditable')],\n\t['data-',           DatasetSink],\n\t['dataset',         DatasetObjectSink], // Shall we include this, too?\n\t['disabled',        DisabledSink],\n\t['hidden',          HiddenSink],\n\t['innerHTML',       InnerHTMLSink],\n\t['innerText',       InnerTextSink],\n\t['readonly',        ReadonlySink],\n\t['style',           StyleObjectSink],\n\t// ['termination',  terminationSink], // a sink that runs when an observable completes... will we ever need this?\n\t['textContent',     TextContentSink],\n\t['value',           ValueSink],\n\t['rml:blur',        BlurSink],\n//  ['rml:checked',     DisabledSink], // Can make this one act as an enumerated attribute that understands \"false\" and other values...\n\t['rml:closed',      ClosedSink],\n\t['rml:dataset',     DatasetObjectSink],\n//  ['rml:disabled',    DisabledSink], // Can make this one act as an enumerated attribute that understands \"false\" and other values...\n\t['rml:focus',       FocusSink],\n//  ['rml:readonly',    ReadonlySink], // Can make this one act as an enumerated attribute that understands \"false\" and other values...\n\t['rml:removed',     RemovedSink],\n\t['rml:subtree',     SubtreeSink],\n\t['removed',         RemovedSink],\n\t['subtree',         SubtreeSink],\n]);\n\n\n","import type { Sink } from '../types/sink';\nimport type { AttributeObject } from '../types/internal';\nimport type { MaybeFuture, Observer } from '../types/futures';\nimport type { RMLEventAttributeName, RMLEventName } from '../types/dom';\n\nimport { BOOLEAN_ATTRIBUTES } from \"../definitions/boolean-attributes\";\nimport { addListener } from '../lib/addListener';\nimport { asap } from '../lib/drain';\nimport { DatasetItemPreSink, DatasetObjectSink } from './dataset-sink';\nimport { isFunction } from '../utils/is-function';\nimport { isRMLEventListener, RMLEventListener } from '../types/event-listener';\nimport { sinkByAttributeName } from '../parser/sink-map';\n\ntype EventListenerDeclarationWithOptions = [Function, EventListenerOptions];\n\nexport type ElementAttribute =\n\t| 'className'\n\t| 'id'\n\t| 'nodeName'\n\t| 'nodeValue'\n\t| 'textContent'\n\t| 'innerHTML'\n\t| 'outerHTML'\n\t| 'namespaceURI'\n\t| 'localName'\n\t| 'tagName'\n\t| 'attributes'\n\t| 'childNodes'\n\t| 'firstChild'\n\t| 'lastChild'\n\t| 'nextSibling'\n\t| 'previousSibling'\n\t| 'parentNode'\n\t| 'parentElement'\n\t| 'baseURI'\n\t| 'isConnected'\n\t| 'ownerDocument'\n\t| 'style'\n\t| 'dataset'\n\t| 'classList'\n\t| 'scrollTop'\n\t| 'scrollLeft'\n\t| 'scrollWidth'\n\t| 'scrollHeight'\n\t| 'clientTop'\n\t| 'clientLeft'\n\t| 'clientWidth'\n\t| 'clientHeight'\n\t| 'offsetParent'\n\t| 'offsetTop'\n\t| 'offsetLeft'\n\t| 'offsetWidth'\n\t| 'offsetHeight'\n\t| 'onclick'\n\t| 'ondblclick'\n\t| 'onmousedown'\n\t| 'onmouseup'\n\t| 'onmouseover'\n\t| 'onmousemove'\n\t| 'onmouseout'\n\t| 'onmouseenter'\n\t| 'onmouseleave'\n\t| 'onkeydown'\n\t| 'onkeypress'\n\t| 'onkeyup'\n\t| 'onabort'\n\t| 'onbeforeinput'\n\t| 'oninput'\n\t| 'onchange'\n\t| 'onreset'\n\t| 'onsubmit'\n\t| 'onfocus'\n\t| 'onblur'\n\t| 'onfocusin'\n\t| 'onfocusout'\n\t| 'onload'\n\t| 'onloadeddata'\n\t| 'onloadedmetadata'\n\t| 'onloadstart'\n\t| 'onprogress'\n\t| 'onerror'\n\t| 'onresize'\n\t| 'onscroll'\n\t| 'onscrollend'\n\t| 'onselect'\n\t| 'onwheel'\n;\n\nexport type WritableElementAttribute =\n\t| 'className'\n\t| 'id'\n\t| 'innerHTML'\n\t| 'outerHTML'\n\t| 'scrollLeft'\n\t| 'scrollTop'\n\t| 'slot'\n\t| 'nodeValue'\n\t| 'textContent'\n;\n\nexport type WritableHTMLElementAttribute =\n\t| 'accessKey'\n\t| 'contentEditable'\n\t| 'dir'\n\t| 'draggable'\n\t| 'hidden'\n\t| 'innerText'\n\t| 'lang'\n\t| 'spellcheck'\n\t| 'tabIndex'\n\t| 'title'\n\t| 'translate'\n;\n\nconst isSource = (k: RMLEventAttributeName, v: MaybeFuture<unknown> | EventListenerObject | EventListenerDeclarationWithOptions) =>\n\tk.substring(0, 2) == 'on' && (isFunction((<Observer<unknown>>v).next ?? v) || isFunction((<EventListenerDeclarationWithOptions>v)[0]));\n\nexport const FixedAttributeSink: Sink<Element> = (node: Element, attributeName: string) =>\n\t// data => node.setAttribute(attributeName, data)\n\tnode.setAttribute.bind(node, attributeName)\n;\n\nexport const FixedAttributePreSink = (attributeName: string): Sink<Element> =>\n\t(node: Element) =>\n\t\t// data => node.setAttribute(attributeName, data)\n\t\tnode.setAttribute.bind(node, attributeName)\n;\n\nexport const ToggleAttributePreSink = (attributeName: string): Sink<Element> =>\n\t(node: Element) =>\n\t\tnode.toggleAttribute.bind(node, attributeName)\n;\n\n/**\n * Set a boolean attribute via direct DOM property\n **/\nexport const BooleanAttributeSink: Sink<Element> =\n\t(node: Element, attributeName: WritableElementAttribute) =>\n\t\t(value: boolean) => (node[attributeName] as unknown) = value\n;\n\n/**\n * Set an attribute via direct DOM property, rather than setAttribute\n **/\nexport const DOMAttributeSink: Sink<Element> =\n\t(node: Element, attributeName: WritableElementAttribute) =>\n\t\t// node.setAttribute.bind(node, attributeName)\n\t\t(value: unknown) => (node[attributeName] as unknown) = value\n;\n\n/**\n * Set the value of a form's element, given its name\n **/\nexport const FormElementSink: Sink<HTMLFormElement> =\n\t(node: HTMLFormElement, elementName: string) =>\n\t\t(value: any) => {\n\t\t\tconst e = (node.elements.namedItem(elementName));\n\t\t\t// TODO: add checkbox and radio...\n\t\t\tif(e) {\n\t\t\t\tif((e as HTMLInputElement).type == 'checkbox') {\n\t\t\t\t\t(e as HTMLInputElement).checked = value;\n\t\t\t\t} else if((e as HTMLInputElement).type == 'radio') {\n\t\t\t\t\t(e as HTMLInputElement).checked = (e as HTMLInputElement).value == value;\n\t\t\t\t} else {\n\t\t\t\t\t(e as HTMLInputElement | HTMLTextAreaElement).value = value;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n;\n\n/**\n * An implicit sink for any DOM Attributes (the ones that can be set via node[attr] = value)\n * @example <div contenteditable=\"${stream}\">...</div>\n **/\nexport const DOMAttributePreSink = (attributeName: WritableElementAttribute): Sink<Element> =>\n\t(node: Element) =>\n\t\t(value: unknown) => (node[attributeName] as unknown) = value\n;\n\nconst datasetAttributePrefix = 'data-';\n\nexport const AttributeObjectSink = <T extends HTMLElement | SVGElement | MathMLElement>(node: T) =>\n\t(attributeobject: AttributeObject) => {\n\t\t(Object.entries(attributeobject) ?? [])\n\t\t\t.forEach(([k, v]) => {\n\t\t\t\t// TODO: toggle/remove event listener, if matches /^on/ (or /^off/ maybe?)\n\t\t\t\t// N.B.: keep v === false || v == 'false' for transpilers changing it to v == '0' || v == 0\n\t\t\t\t// which is no good, because 0 is no special value for non-boolean attributess. value=\"0\"\n\t\t\t\tif(isRMLEventListener(k, v)) { //if(k.startsWith('on') /* && isFunction((<Observer<any>><unknown>v).next ?? (<Promise<any>>v).then ?? v) */) {\n\t\t\t\t\t// addListener(node, <RMLEventName>k.substring(2), v);\n\t\t\t\t\tconst e = k.replace(/^(rml:)?on/, '$1') as RMLEventName;\n\t\t\t\t\taddListener(node, e, v);\n\t\t\t\t} else {\n\n\t\t\t\t\tif(v === 'false' && BOOLEAN_ATTRIBUTES.has(k)) {\n\t\t\t\t\t\tv = false;\n\t\t\t\t\t}\n\n\t\t\t\t\tconst sink: Sink<any> =\n\t\t\t\t\t\tk == 'dataset'\n\t\t\t\t\t\t\t? DatasetObjectSink :\n\t\t\t\t\t\tk.startsWith(datasetAttributePrefix)\n\t\t\t\t\t\t\t? <Sink<T>>DatasetItemPreSink(k.substring(5)) :\n\t\t\t\t\t\tnode.tagName == 'FORM'\n\t\t\t\t\t\t\t? FormElementSink :\n\t\t\t\t\t\tsinkByAttributeName.get(k)\n\t\t\t\t\t\t?? FixedAttributeSink;\n\t\t\t\t\t\t//?? DOMAttributeSink;\n\n\t\t\t\t\tasap(sink(node, k), v); // TODO: use drain()\n\t\t\t\t}\n\t\t\t});\n\t}\n;\n","import { catchError, of } from 'rxjs';\nimport type { HTMLString } from '../types/dom';\nimport { MaybeFuture } from '../types/futures';\n\n/**\n * An error-catcher sink that displays a custom message when the underlying stream errors\n * @param stream The original data or source stream\n * @param handler A function that takes an error and returns a message\n * @returns RMLTemplateExpression A template expression for the \"innerHTML\" attribute\n * @example <div>${Catch(contentStream)}\">\n * @example <input value=\"${Catch(valueStream)}\">\n */\nexport const Catch = (stream: MaybeFuture<any>, handler: (e: Error) => HTMLString | string | number) =>\n\t(stream.pipe?.(catchError((err: Error) => of(handler(err)))))\n\t?? (stream.catch?.((err: Error) => handler(err)))\n\t?? stream\n\t// ?? handler(stream)\n;\n","import { RMLTemplateExpressions, SinkBindingConfiguration } from \"../types/internal\";\nimport { ExplicitSink } from \"../types/sink\";\nimport { AttributeObjectSink } from \"./attribute-sink\";\n\nimport { SINK_TAG } from \"../constants\";\n\nexport const MIXIN_SINK_TAG = 'mixin';\n\n/**\n * A specialised sink to merge all properties of an object into a target element.\n * If you pass a plain object it will be merged immediately. You can also merge event listeners on mount.\n * If you pass a future, it will be merged whenever it emits any data.\n * @param source A present or future Attribuend Object (a plain object of key-values to merge) that will be merged into the target element\n * @returns SinkBindingConfiguration an object that tells Rimmel what to mount where and how\n * You can specify this sink in the following ways:\n * - implicitly, by passing it into a tag: `<div ...${source}\">`\n * - explicitly, with the `<div ...${Mixin(source)}\">` sink\n *\n * ## Examples\n *\n * ### Add an event listener to a button after 5s\n *\n * ```ts\n * import { rml } from 'rimmel';\n *\n * const delay = (ms: number) => new Promise(resolve => setTimeout(resolve), ms);\n *\n * const ClickMixin = async () => {\n *   const listener = (e: Event) => {\n *     debugger;\n *   }\n *\n *   await delay(5000);\n *\n *   return {\n *     onclick: listener,\n *   };\n *  }\n *\n *  // Using the mixin:\n *  target.innerHTML = rml`\n *    <button ...${ClickMixin()}\">\n *      click me\n *    </button>\n *  `;\n * };\n * ```\n *\n * ### Drag'n'drop with a mixin\n *\n * ```ts\n * import { Subject, fromEvent, map, switchMap, takeUntil, tap } from 'rxjs';\n * \n * const currentXY = (str: string) => /translate\\((?<x0>[-.\\d]+)px, (?<y0>[-.\\d]+)px\\)/.exec(str)?.groups ?? {x0: '0', y0: '0'};\n * \n * export const Draggable = () => {\n *   const toCSSTransform = () => map(([Δx, Δy]) => ({\n *     transform: `translate(${Δx}px, ${Δy}px)`\n *   }));\n * \n *   const dnd = new Subject().pipe(\n *     tap((e: PointerEvent) => e.preventDefault()),\n *     switchMap((e: PointerEvent) => {\n *       const mousemove = fromEvent(document, 'mousemove')\n *       const mouseup = fromEvent(document, 'mouseup');\n * \n *       const {x0, y0} = currentXY((<HTMLElement>e.currentTarget).style.transform);\n *       const [eX, eY] = [e.clientX -parseFloat(x0), e.clientY -parseFloat(y0)];\n * \n *       return mousemove.pipe(\n *         map((e: PointerEvent) => [e.clientX -eX, e.clientY -eY]),\n *         toCSSTransform(),\n *         takeUntil(mouseup),\n *       );\n *     }),\n *   );\n * \n *   return {\n *     class: 'draggable',\n *     onmousedown: dnd,\n *     style: dnd,\n *   };\n * };\n * ```\n */\nexport const Mixin: ExplicitSink<'mixin'> = (source: RMLTemplateExpressions.Mixin) => {\n\treturn <SinkBindingConfiguration<Element>>{\n\t\ttype: SINK_TAG,\n\t\tt: MIXIN_SINK_TAG,\n\t\tsource,\n\t\tsink: AttributeObjectSink,\n\t};\n};\n","import type { ExplicitSink, Sink } from \"../types/sink\";\nimport type { SinkBindingConfiguration } from \"../types/internal\";\nimport type { MaybeFuture } from \"../types/futures\";\n\nimport { SINK_TAG } from \"../constants\";\n\nexport const JSON_DUMP_SINK_TAG = 'jsonDump';\n\nexport const JSONDumpSink: Sink<Element> = (node: Element) =>\n\t(data: object) => {\n\t\tnode.innerHTML = `<pre>${JSON.stringify(data, null, 2)}</pre>`\n\t}\n;\n\n/**\n * A specialised sink to print source data as JSON strings\n * @param source A present or future JavaScript Object\n * @returns RMLTemplateExpression An HTML-subtree RML template expression\n * @example <div>${JSONDump(objectStream)}</div>\n */\nexport const JSONDump: ExplicitSink<'object'> = (source: MaybeFuture<Object>) =>\n\t<SinkBindingConfiguration<Element>>({\n\t\ttype: SINK_TAG,\n\t\tt: JSON_DUMP_SINK_TAG,\n\t\tsource,\n\t\tsink: JSONDumpSink,\n\t})\n;\n","import type { ExplicitSink, Sink } from \"../types/sink\";\nimport type { RMLTemplateExpressions, SinkBindingConfiguration } from \"../types/internal\";\n\nimport { SINK_TAG } from \"../constants\";\n\nexport const PREPEND_HTML_SINK_TAG = 'prependHTML';\n\nexport const PrependHTMLSink: Sink<Element> =\n\t(node: Element) =>\n\t\tnode.insertAdjacentHTML.bind(node, 'afterbegin')\n;\n\n/**\n * A specialised sink to prepend HTML at the beginning of an element\n * @param source A present or future HTML string\n * @returns RMLTemplateExpression An HTML-subtree RML template expression\n * @example <div>${PrependHTML(stream)}</div>\n */\nexport const PrependHTML: ExplicitSink<'content'> = (source: RMLTemplateExpressions.HTMLText, pos: InsertPosition = 'afterbegin') => <SinkBindingConfiguration<Element>>({\n\ttype: SINK_TAG,\n\tt: PREPEND_HTML_SINK_TAG,\n\tsource,\n\tsink: PrependHTMLSink,\n\tparams: pos,\n});\n","import type { HTMLString } from '../types/dom';\nimport type { ExplicitSink, Sink } from \"../types/sink\";\nimport type { SinkBindingConfiguration, RMLTemplateExpressions } from \"../types/internal\";\n\nimport { SINK_TAG } from \"../constants\";\n\nconst isElement = (node: Element | DocumentFragment): node is Element => node.nodeType == Node.ELEMENT_NODE;\n\nconst sanitizeNode = (node: Element | DocumentFragment) => {\n\tif(isElement(node)) {\n\t\tconst forbiddenTags = ['script', 'style', 'iframe', 'object', 'embed'];\n\t\tif (forbiddenTags.includes(node.tagName.toLowerCase())) {\n\t\t\tnode.remove();\n\t\t\treturn;\n\t\t}\n\n\t\tconst forbiddenAttributes = ['onerror', 'onload', 'onclick', 'onmouseover', 'onfocus', 'onblur', 'onkeydown', 'onkeypress', 'onkeyup'];\n\t\tArray.from(node.attributes).forEach(attr => {\n\t\t\tif (forbiddenAttributes.includes(attr.name.toLowerCase()) || attr.name.toLowerCase().startsWith('on')) {\n\t\t\t\tnode.removeAttribute(attr.name);\n\t\t\t}\n\t\t});\n\t}\n\n\tArray.from(node.children).forEach(child => sanitizeNode(child));\n};\n\nfunction sanitizeInput(target: Element, input: HTMLString) {\n\tconst tempElement = document.createElement('div');\n\t// tempElement.textContent = input;\n\ttempElement.innerHTML = input;\n\n\tconst fragment = document.createDocumentFragment();\n\tfragment.append(...tempElement.childNodes);\n\n\tsanitizeNode(fragment);\n\n\ttarget.innerHTML = '';\n\ttarget.appendChild(fragment);\n}\n\nexport const SanitizeSink: Sink<HTMLElement> =\n\t(e: Element) =>\n\t\tsanitizeInput.bind(null, e)\n;\n\n\t//(html: HTMLString) => sanitizeInput(html, node)\n\nexport const Sanitize: ExplicitSink<'textcontent'> =\n\t(source: RMLTemplateExpressions.HTMLText) =>\n\t\t<SinkBindingConfiguration<HTMLElement>>({\n\t\t\ttype: SINK_TAG,\n\t\t\tt: 'Sanitize',\n\t\t\tsource,\n\t\t\tsink: SanitizeSink,\n\t\t})\n;\n","import type { Future } from '../types/futures';\nimport { BehaviorSubject } from 'rxjs';\nimport { asap } from \"../lib/drain\";\n\n/**\n * Display a temporary value until an async stream starts emitting\n **/\nexport const Suspend = <T>(initial: T, source: Future<T>) => {\n\tconst interim = new BehaviorSubject<T>(initial);\n\t// source.subscribe?.(interim) ?? source.then?.(data=>interim.next(data));\n\tasap(interim, source);\n\treturn interim;\n};\n\nexport const Suspender = <T>(initial: T, source?: Future<T>) =>\n\tsource\n\t\t? Suspend(initial, source)\n\t\t: (source: Future<T>) => Suspend(initial, source);\n;\n","import type { Inputs, RimmelComponent, SourceBindingConfiguration, SinkBindingConfiguration } from './types/internal';\nimport type { Sink } from './types/sink';\n\nimport { RESOLVE_SELECTOR } from \"./constants\";\nimport { isSinkBindingConfiguration, isSourceBindingConfiguration } from './types/internal';\nimport { Rimmel_Bind_Subtree, Rimmel_Mount } from \"./lifecycle/data-binding\";\nimport { asap, subscribe } from \"./lib/drain\";\nimport { waitingElementHandlers } from \"./internal-state\";\n\nimport { BehaviorSubject, Subject } from \"rxjs\";\nimport { camelCase } from './utils/camelCase';\nimport { InnerHTMLSink } from './sinks/inner-html-sink';\n\nexport type CustomElementDefinition = {\n\tobservedAttributes?: string[]\n\trender?: (this: HTMLElement, props: Record<string, any>) => void;\n\tconnectedCallback?: (this: HTMLElement) => void;\n\tdisconnectedCallback?: (this: HTMLElement) => void;\n\tattributeChangedCallback?: (this: HTMLElement, name: string, oldValue: string, newValue: string) => void;\n}\n\ninterface RMLNamedNodeMap extends NamedNodeMap {\n\tresolve: Attr;\n}\n\nconst SubjectProxy = (defaults: Record<string | symbol, any> = {}) => {\n\tconst subjects = <Record<string | symbol, BehaviorSubject<unknown> | Subject<unknown>>>{};\n\treturn new Proxy({}, {\n\t\tget(_target, prop) {\n\t\t\treturn subjects[prop] ?? (subjects[prop] = prop in defaults ? new BehaviorSubject(defaults[prop]) : new Subject());\n\t\t}\n\t});\n};\n\nclass RimmelElement extends HTMLElement {\n\tcomponent: RimmelComponent | null | undefined;\n\tattrs: Inputs;\n\t#externalMutationObserver?: MutationObserver;\n\t#lightMutationObserver?: MutationObserver;\n\t#shadowMutationObserver?: MutationObserver;\n\textSinks?: Record<string | symbol, any>;\n\t/**\n\t * Attributes on the external HTML element\n\t */\n\texternalSourceAttributes?: Record<string, Sink<any>>;\n\tbindings?: {};\n\n\tconstructor(component: RimmelComponent | null | undefined, initFn?: Function) {\n\t\tsuper();\n\n\t\tif(component) {\n\t\t\tthis.component = component;\n\t\t\tthis.attachShadow({ mode: 'open' });\n\t\t}\n\n\t\tconst [attrs, events] = [...(<RMLNamedNodeMap>this.attributes)].reduce((acc, b) => {\n\t\t\t// FIXME: REF0000266279391633 this is an awful way to look up leftover event handlers from the parser.\n\t\t\tconst isEvent = <0 | 1>+/^_?on/.test(b.nodeName);\n\t\t\tconst t = acc[isEvent];\n\t\t\tt[isEvent ? b.nodeName : camelCase(b.nodeName)] = b.nodeValue!;\n\t\t\treturn acc;\n\t\t}, [{}, {}] as [Record<string, string>, Record<string, string>]);\n\n\t\tconst bindingRef = (this.attributes as RMLNamedNodeMap).resolve?.nodeValue ?? '';\n\t\tconst refs = waitingElementHandlers.get(bindingRef) ?? [];\n\t\tconst sinkBindingConfigurations = refs.filter(isSinkBindingConfiguration);\n\n\t\tsinkBindingConfigurations\n\t\t\t.map((s: SinkBindingConfiguration<any>) => camelCase(s.t))\n\t\t\t.forEach(name => delete attrs[name])\n\t\t;\n\n\t\tthis.attrs = SubjectProxy(attrs);\n\n\t\t// This condition holds for non-virtual custom elements. Won't be needed anymore if we split web components from virtual web components\n\t\tif(refs.length) {\n\t\t\t// Connect/Bind Outbound Events\n\t\t\tObject.keys(events)\n\t\t\t\t.map(name => (<SourceBindingConfiguration<any>[]>refs).find(x => isSourceBindingConfiguration(x)))\n\t\t\t\t.filter(f=>!!f)\n\t\t\t\t.forEach(f => {\n\t\t\t\t\t// TODO: store subscription for later removal\n\t\t\t\t\tconst subscription = subscribe(this, this.attrs[`on${f.eventName}`], f.listener)\n\t\t\t\t})\n\t\t\t;\n\n\t\t\tthis.extSinks = Object.fromEntries(\n\t\t\t\tsinkBindingConfigurations\n\t\t\t\t// .map(s => {[s.t]: s.sink = hijack?...\n\t\t\t\t.map((s: SinkBindingConfiguration<any>) => [camelCase(s.t), s.source])\n\t\t\t);\n\n\t\t\t// Inbound Attributes\n\t\t\tObject.entries(this.extSinks).forEach(([name, source]) => {\n\t\t\t\tsubscribe(this, source, this.attrs[name]);\n\t\t\t});\n\n\t\t\tthis.externalSourceAttributes = Object.fromEntries(\n\t\t\t\tsinkBindingConfigurations\n\t\t\t\t// .map(s => {[s.t]: s.sink = hijack?...\n\t\t\t\t.map((s: SinkBindingConfiguration<any>) => [s.t, s.sink])\n\t\t\t);\n\n\t\t\t// Outbound Events\n\t\t\tthis.bindings = Object.fromEntries(\n\t\t\t\trefs.map(s =>\n\t\t\t\t\tisSinkBindingConfiguration(s)\n\t\t\t\t\t\t? [s.t, s.source ]\n\t\t\t\t\t\t: [(s as SourceBindingConfiguration<any>).eventName, (s as SourceBindingConfiguration<any>).listener ]\n\t\t\t\t)\n\t\t\t);\n\n\t\t\tconst sourceBindingConfigurations = refs.filter(isSourceBindingConfiguration);\n\t\t\tif(sourceBindingConfigurations.length) {\n\t\t\t\twaitingElementHandlers.set(bindingRef, sourceBindingConfigurations);\n\t\t\t} else {\n\t\t\t\twaitingElementHandlers.delete(bindingRef);\n\t\t\t}\n\n\t\t}\n\n\t\tinitFn?.(this, this.attrs);\n\t}\n\n\trender() {\n\t\t// this.shadowRoot!.innerHTML = this.component!(this.attrs);\n\t\tif(this.shadowRoot) {\n\t\t\tconst sink = InnerHTMLSink(this.shadowRoot);\n\t\t\tasap(sink, this.component!(this.attrs));\n\t\t}\n\t}\n\n\tconnectedCallback() {\n\t\t// Monitor attribute changes on the custom element\n\t\tthis.#externalMutationObserver = new MutationObserver((mutations) => {\n\t\t\tmutations.forEach(mutation => {\n\t\t\t\tconst attrName = <string>mutation.attributeName;\n\t\t\t\tconst key = camelCase(attrName);\n\t\t\t\tconst v = this.getAttribute(attrName);\n\t\t\t\tthis.attrs[key].next(v);\n\t\t\t});\n\t\t});\n\t\tthis.#externalMutationObserver.observe(this, { attributes: true, childList: false, subtree: false });\n\n\t\t// Monitor all other (RML) changes within the custom element, for data binding\n\t\tthis.#lightMutationObserver = new MutationObserver(Rimmel_Mount);\n\t\tthis.#lightMutationObserver.observe(this, { attributes: false, childList: true, subtree: true });\n\n\t\tif(this.shadowRoot) {\n\t\t\tthis.#shadowMutationObserver = new MutationObserver(Rimmel_Mount);\n\t\t\tthis.#shadowMutationObserver.observe(this.shadowRoot, { attributes: false, childList: true, subtree: true });\n\t\t}\n\n\t\tif(this.component) {\n\t\t\tthis.render();\n\t\t\t[...this.shadowRoot?.children ?? [], ...this.shadowRoot!.querySelectorAll(RESOLVE_SELECTOR)]\n\t\t\t\t.forEach(s => {\n\t\t\t\t\tRimmel_Bind_Subtree(s)\n\t\t\t\t})\n\t\t\t;\n\t\t}\n\t}\n\n\tdisconnectedCallback() {\n\t\t// AKA: unmount\n\t\tthis.#externalMutationObserver?.disconnect();\n\t\tthis.#lightMutationObserver?.disconnect();\n\t\tthis.#shadowMutationObserver?.disconnect();\n\t}\n};\n\n/**\n * Register a Rimmel Component as a Custom Element in the DOM\n *\n * ## Examples\n *\n * ### Create a simple \"Hello, World\" web component\n * ```ts\n * import { rml, RegisterElement } from 'rimmel';\n *\n * RegisterElement('custom-element', () => {\n *   return rml`\n *     <h1>Hello, world</h1>\n *   `;\n * }\n * ```\n **/\nexport const RegisterElement = (tagName: string, component: RimmelComponent | null | undefined, initFn?: Function) => {\n\t// FIXME: prevent redefinition...\n\t// TODO: UnregisterElement?\n\tcustomElements.define(tagName, class extends RimmelElement {\n\t\tconstructor() {\n\t\t\tsuper(component, initFn);\n\t\t}\n\t});\n};\n","import type { BehaviorSubject } from \"../types/futures\";\n\n/**\n * Get the current value from the given object if it's a BehaviorSubject, otherwise undefined\n */\nexport const currentValue = <T>(stream: BehaviorSubject<T> | unknown): T | undefined =>\n\t// FIXME: this relies on a piped BehaviorSubject exposing source and destination, which might not be supported in future releases\n\t// FIXME: this only walks up one level into .source, so it won't catch a double-piped stream.\n\t(stream as BehaviorSubject<T>)?.value ?? ((stream as BehaviorSubject<T>)?.destination ? currentValue((stream as BehaviorSubject<T>)?.destination) : undefined);\n;\n","import { Sink } from \"../types/sink\";\nimport { RMLTemplateExpressions, SinkBindingConfiguration } from \"../types/internal\";\n\n// /**\n//  * Force a custom Sink through to a template\n//  * @param sink \n//  * @param data \n//  * @returns Sink\n//  */\n// export const SinkSpecifier = (source: MaybeFuture<unknown>, sink: Sink<any>, data: unknown) => ({\n// \ttype: 'custom',\n// \tpattern: (string, resultPlusString, result) => /custom-stuff=/.test(string), // ..................\n// \tsink,\n// \tdata,\n// });\n\nexport const PreSink = <T extends Element>\n\t(tag: string, sink: Sink<T>, source: RMLTemplateExpressions.Any, args: any) => ({\n\t\ttype: 'sink',\n\t\tt: tag,\n\t\tsource,\n\t\tsink,\n\t}) as SinkBindingConfiguration<T>\n;\n\n//export { AnyContentSink } from \"./content-sink\";\n//export { AppendHTML } from \"./append-html-sink\";\n//export { AttributeObjectSink } from \"./attribute-sink\";\n//export { Blur } from \"./blur-sink\";\n//export { ClassName, ToggleClass } from './class-sink';\n//export { Disabled } from \"./disabled-sink\";\n//export { Focus } from \"./focus-sink\";\n//export { InnerHTML } from \"./inner-html-sink\";\n//export { InnerText } from \"./inner-text-sink\";\n//export { JSONDump } from \"./json-dump-sink\";\n//export { PrependHTML } from \"./prepend-html-sink\";\n//export { Removed } from \"./removed-sink\";\n//export { Sanitize } from './sanitize-html-sink';\n//export { Signal } from './signal-sink'; // Experimental\n//export { Suspend } from './suspense'; // Experimental\n//export { TextContent } from \"./text-content-sink\";\n//\n","import type { Future, Present } from \"../types/futures\";\nimport type { KVP } from \"../types/key-value-pair\";\nimport type { Entries } from \"../types/object-entries\";\n\n/**\n * An object containing both present and future (Promise or Observable) values.\n * @example\n * const c = {\n *  key1: 'present',\n *  key2: Promise.resolve('future'),\n *  key3: Observable.from(['many', 'futures']),\n * }\n */\nexport interface Chronosympton {\n\t[key: string]: Present<any> | Future<any> | Chronosympton;\n}\n/**\n * A function used to tell \"collapse\" a present from a future value, in relation\n * to whether it's to be baked in static HTML code or bound after mounting\n */\nexport type Collapser = (kv: KVP) => kv is [string, Future<any>];\n\nconst isRecord = (value: unknown): value is Record<string, unknown> =>\n\tvalue !== null &&\n\ttypeof value === \"object\" &&\n\t!Array.isArray(value)\n;\n\n/**\n * Split a {@link Chronosympton} into separate present and future object entries\n * @param obj the Chronosympton to split\n * @param collapse a function that returns true for future entries, false for present ones\n * @returns a tuple of two arrays: the first with present entries, the second with future entries\n * @example\n * const collapse = ([, v]: KVP) => v instanceof Promise || (typeof v === 'object' && 'subscribe' in v && typeof v.subscribe === 'function');\n * const [presentEntries, futureEntries] = chronolyze(obj, collapse)\n */\nexport const chronolyze = (obj: Chronosympton, collapse: Collapser): [Entries<Present<any>>, Entries<Future<any>>] => {\n\tconst presents: Entries<Present<any>> = [];\n\tconst futures: Entries<Future<any>> = [];\n\n\tfor(const key in obj) {\n\t\tif(!Object.prototype.hasOwnProperty.call(obj, key))\n\t\t\tcontinue;\n\n\t\tconst value = obj[key];\n\t\tconst kv: KVP = [key, value];\n\n\t\tif(collapse(kv)) {\n\t\t\tfutures.push([key, value] as Entries<Future<typeof value>>[0]);\n\t\t\tcontinue;\n\t\t}\n\n\t\tif(isRecord(value)) {\n\t\t\tconst [nestedPresent, nestedFuture] = chronolyze(value as Chronosympton, collapse);\n\n\t\t\tif (nestedPresent.length) {\n\t\t\t\tpresents.push([key, Object.fromEntries(nestedPresent)] as Entries<Present<any>>[0]);\n\t\t\t}\n\n\t\t\tif(nestedFuture.length) {\n\t\t\t\tfutures.push([key, Object.fromEntries(nestedFuture)] as Entries<Future<any>>[0]);\n\t\t\t}\n\n\t\t\tcontinue;\n\t\t}\n\n\t\tpresents.push([key, value as Present<any>]);\n\t}\n\n\treturn [presents, futures];\n};\n","import type { AttributeObject, BindingConfiguration, RMLTemplateExpression, RMLTemplateExpressions, SinkBindingConfiguration, SourceBindingConfiguration } from \"../types/internal\";\nimport type { CSSWritableProperty } from \"../types/style\";\nimport type { Future, MaybeFuture } from \"../types/futures\";\nimport type { Collapser } from \"../utils/chronolyze\";\nimport type { KVP } from \"../types/key-value-pair\";\nimport type { Sink } from \"../types/sink\";\nimport type { HTMLString, RMLEventAttributeName, RMLEventName } from \"../types/dom\";\n\nimport { isFutureSinkAttributeValue, isSinkBindingConfiguration, isSourceBindingConfiguration } from \"../types/internal\";\n\nimport { currentValue } from \"../lib/current-value\";\nimport { state, waitingElementHandlers } from \"../internal-state\";\nimport { BOOLEAN_ATTRIBUTES } from \"../definitions/boolean-attributes\";\nimport { INTERACTIVE_NODE_START, INTERACTIVE_NODE_END, REF_TAG, RESOLVE_ATTRIBUTE, RML_DEBUG } from \"../constants\";\n\nimport { PreSink } from \"../sinks/index\";\nimport { sinkByAttributeName } from '../parser/sink-map';\nimport { DOMAttributePreSink, FixedAttributePreSink, WritableElementAttribute } from \"../sinks/attribute-sink\";\nimport { Mixin } from \"../sinks/mixin-sink\";\n\nimport { InnerHTML } from \"../sinks/inner-html-sink\";\nimport { TextContent } from \"../sinks/text-content-sink\";\nimport { StyleObjectSink, StylePreSink, STYLE_OBJECT_SINK_TAG } from \"../sinks/style-sink\";\nimport { isFuture } from \"../types/futures\"\nimport { isRMLEventListener } from \"../types/event-listener\";\nimport { DatasetItemPreSink } from \"../sinks/dataset-sink\";\nimport { ClassObjectSink } from \"../sinks/class-sink\";\nimport { chronolyze } from \"../utils/chronolyze\";\nimport { ENABLE_RML_DEBUGGER } from \"../debug\";\nimport { arrayse } from \"../lib/lifts/arrayse\";\n\n/**\n * Store some data binding information to be used at mount time\n */\nexport const addRef = (ref: string, ...data: BindingConfiguration[]) => {\n\twaitingElementHandlers.get(ref)?.push(...data) ?? waitingElementHandlers.set(ref, data);\n};\n\nconst getEventName = (eventAttributeString: RMLEventAttributeName): [RMLEventName, RMLEventAttributeName] | [] => {\n\tconst x = /\\s+(?<attr>(?<prefix>rml:)?on(?<event>\\w+))=['\"]?$/.exec(eventAttributeString)?.groups;\n\treturn x ? [<RMLEventName>`${x.prefix??''}${x?.event}`, <RMLEventAttributeName>x.attr] : []\n};\n\n/**\n * rml — the main entry point for Rimmel.js\n *\n * rml is a tag function. You call it by tagging it with an ES6 template literal\n * of HTML text interleaved with references to any JavaScript entity that's in scope.\n * \n * Any JavaScript expression inside the template literal will be evaluated and the\n * resulting value will be inserted into the HTML template literal. Async expressions\n * such as Promises and Observables will be rendered as they resolve/emit.\n *\n * ## Example\n *\n * ```ts\n * import { rml } from 'rimmel';\n *\n * const Component = () => {\n *   const content = 'hello world';\n *\n *   return rml`\n *     <div>${content}</div>\n *   `;\n * };\n * ```\n * \n * ## Example\n *\n * ```ts\n * import { rml } from 'rimmel';\n *\n * const Component = () => {\n *   const num = 123;\n *\n *   return rml`\n *     <input type=\"number\" value=\"${number}\">\n *   `;\n * };\n * ```\n * \n * ## Example\n *\n * ```ts\n * import { rml } from 'rimmel';\n *\n * const Component = () => {\n *   const data = fetch('/api').then(res => res.text());\n *\n *   return rml`\n *     <div>${data}</div>\n *   `;\n * };\n * ```\n **/\nexport function rml(_strings: TemplateStringsArray, ..._expressions: RMLTemplateExpression[]): HTMLString {\n\tconst strings = [..._strings];\n\tconst expressions = [..._expressions];\n\n\tlet acc = '';\n\tlet strlen = strings.length -1;\n\n\tfor(let i=0; i<strlen; i++) {\n\t\tconst string = strings[i];\n\t\tconst accPlusString = acc +string;\n\t\tconst expression = expressions[i];\n\n\t\t// TODO: Determine in which template context is any given expression appearing\n\t\t// Then, depending on the context, call matching parser modules and (yet-to-be-created) registered parser plugins\n\t\t//const context =\n\t\t//\t/>\\s*$/.test(string) && /^\\s*<\\s*/.test(nextString) ? 'child/subtree'\n\t\t//\t: /(?<attribute>[a-z0-9\\-_]+)\\=(?<quote>['\"]?)(?<otherValues>[^\"]*)$/.exec(resultPlusString) ? 'attribute'\n\n\t\t// We treat and render any null or undefined values as empty strings\n\t\t// as a graceful handling of non-values (should this be configurable for a better QA?)\n\t\t// const printableExpressionType = typeof expression ?? 'undefined';\n\t\tconst printableExpressionType = typeof (expression ?? '');\n\n\t\tif(ENABLE_RML_DEBUGGER) {\n\t\t\tif(string.includes(RML_DEBUG)) {\n\t\t\t\tconst nl = (str: string) => str.replace(/\\t/g, '  ');\n\t\t\t\tconst reducer = (str: string[], next: string, j: number) => str.concat(\n\t\t\t\t\t(j>0?'}':'') +nl(j==i ? next.replace(RML_DEBUG, `%c${RML_DEBUG}%c`) : next),\n\t\t\t\t\tj==i && next.includes(RML_DEBUG)\n\t\t\t\t\t\t? ['color: red', '']\n\t\t\t\t\t\t: [],\n\t\t\t\t\t(j<=strlen-1?'${':'') +(j<strlen ? expressions[j] : [])\n\t\t\t\t);\n\t\t\t\tconst template = strings.join('${...}');\n\t\t\t\tconst currentTemplate = strings.reduce(reducer, <string[]>[]);\n\t\t\t\tconsole.log(...currentTemplate);\n\n\t\t\t\t/* Stopped parsing a RML template */\n\n\t\t\t\t// The current template being processed, except its parameters\n\t\t\t\ttemplate;\n\n\t\t\t\tdebugger;\n\t\t\t}\n\t\t}\n\n\t\t// if(['string', 'number', 'boolean'].includes(printableExpressionType)) {\n\t\tif(printableExpressionType == 'string' || printableExpressionType == 'number' || printableExpressionType == 'boolean') {\n\t\t\t// Static expressions, no data binding. Just concatenate and move on\n\t\t\tacc = accPlusString +(expression ?? '');\n\t\t} else {\n\n\t\t\tconst lastTag = accPlusString.lastIndexOf('<');\n\t\t\tconst [ eventName, eventAttributeName ] = getEventName(string as RMLEventAttributeName);\n\t\t\tconst r = (accPlusString).match(/<\\w[\\w-]*\\s+[^>]*resolve=\"(?<existingRef>[^\"]+)\"\\s*[^>]*(?:>\\s*[^<]*|[^>]*)$/);\n\t\t\tconst existingRef = r?.groups?.existingRef;\n\t\t\tconst ref = existingRef ?? `${REF_TAG}${state.refCount++}`;\n\n\t\t\tif(eventName) {\n\t\t\t\t// Event Source\n\t\t\t\t// so feed it to an Rx Subject | Observer | Handler Function | POJO | Array\n\n\t\t\t\t// TODO: support EventListenerObject?\n\t\t\t\t// Use Cases:\n\t\t\t\t// <a onclick=\"${subject}\">\n\t\t\t\t// <a onclick=\"${()=>doSomething}\">\n\t\t\t\t// TODO: do we want the following?\n\t\t\t\t// <input type=\"text\" onchange=\"${[object, 'attributeToSet']}\">   will feed it the .value of the input field\n\t\t\t\t// <input type=\"text\" onchange=\"${[array,  pos]}\">    will feed it the .value of the input field\n\n\t\t\t\t// TODO: Shall we support arrays of streams to feed multiple subscriptions at once? (may conflict with the array syntax above?\n\t\t\t\t// <button onclick=\"${[stream1, stream2, stream3]}\">    will feed each of the supplied streams?\n\t\t\t\t// or explicitly:\n\t\t\t\t// <button onclick=\"${Multi(stream1, stream2, stream3)}\"> with \"multi source\"\n\n\t\t\t\tlet listener;\n\t\t\t\tif(isSourceBindingConfiguration(expression)) {\n\t\t\t\t\tlistener = expression.listener;\n\t\t\t\t\taddRef(ref, <SourceBindingConfiguration<typeof eventName>>{ ...expression, eventName });\n\t\t\t\t} else {\n\t\t\t\t\tlistener = expression;\n\t\t\t\t\tif(listener) {\n\t\t\t\t\t\taddRef(ref, <SourceBindingConfiguration<typeof eventName>>{ type: 'source', listener, eventName });\n\t\t\t\t\t} // TODO: shall we add some notifications, otherwise, rather than silently ignore?\n\t\t\t\t}\n\n\t\t\t\tacc = accPlusString\n\t\t\t\t\t.replace(/\\s((?:rml:)?on\\w+=['\"]?)$/, ' _$1')\n\t\t\t\t\t+(!listener || existingRef ? '' : `${ref}\" ${RESOLVE_ATTRIBUTE}=\"${ref}`);\n\t\t\t} else {\n\t\t\t\t// Data Sink.\n\n\t\t\t\tif(Array.isArray(expression) && />\\s*$/.test(accPlusString)) {\n\t\t\t\t\t// If sinking an array, we're likely just mapping it\n\t\t\t\t\tacc = accPlusString +expression.join('');\n\t\t\t\t} else {\n\t\t\t\t\t// expression is a future or an object\n\n\t\t\t\t\tconst nextString = strings[i+1];\n\t\t\t\t\t// if it's a BehaviorSubject or any other sync stream (e.g.: startWith operator), pick its initial/current value to render it synchronously\n\t\t\t\t\tlet initialValue = currentValue(expression.source ?? expression) ?? '';\n\n\t\t\t\t\tconst isAttribute = /(?<attribute>[:a-z0-9\\-_]+)\\=(?<quote>['\"]?)(?<otherValues>[^\"]*)$/.exec(accPlusString);\n\t\t\t\t\tif(isAttribute) {\n\n\t\t\t\t\t\tconst quotationMarks = isAttribute.groups!.quote;\n\t\t\t\t\t\tif(new RegExp(`^(?:[^>${quotationMarks}]*)${quotationMarks}?`).test(nextString)) {\n\n\t\t\t\t\t\t\t// Attribute Sink\n\t\t\t\t\t\t\t// Use Cases:\n\t\t\t\t\t\t\t// <some-tag some-attributes another-attribute=\"${observable}\" other-stuff></some-tag>\n\t\t\t\t\t\t\t// <some-tag some-attributes class=\"some classes ${observable} and more\" other-stuff></some-tag>\n\t\t\t\t\t\t\t// <some-tag some-attributes data-xxx=\"123\" data-yyy=\"${observable}\" other-stuff></some-tag>\n\n\t\t\t\t\t\t\tlet sink: Sink<HTMLElement | SVGElement>;\n\t\t\t\t\t\t\tlet isBooleanAttribute;\n\t\t\t\t\t\t\tlet handler: SinkBindingConfiguration<HTMLElement | SVGElement>;\n\t\t\t\t\t\t\tconst attributeName = isAttribute.groups!.attribute;\n\t\t\t\t\t\t\tif(attributeName == 'style') {\n\t\t\t\t\t\t\t\tconst CSSAttribute = /;?(?<key>[a-z\\-][a-z0-9\\-_]*)\\s*:\\s*$/.exec(string)?.groups?.key as keyof CSSWritableProperty;\n\t\t\t\t\t\t\t\t// Are we setting any specific CSS properties or the whole style attribute?\n\t\t\t\t\t\t\t\t// TODO: what if both?\n\t\t\t\t\t\t\t\tsink = CSSAttribute ? StylePreSink(CSSAttribute) : StyleObjectSink;\n\t\t\t\t\t\t\t\thandler = PreSink<HTMLElement | SVGElement>(STYLE_OBJECT_SINK_TAG, sink, expression, CSSAttribute);\n\t\t\t\t\t\t\t\t// TODO: should remove deferred CSS rules from the HTML to handle <x style=\"color: ;\"> cases\n\t\t\t\t\t\t\t} else if(attributeName == 'class') {\n\t\t\t\t\t\t\t\tsink = ClassObjectSink;\n\t\t\t\t\t\t\t\tif(isFutureSinkAttributeValue(expression)) {\n\t\t\t\t\t\t\t\t\t// it's a Future<class>\n\t\t\t\t\t\t\t\t\thandler = PreSink(attributeName, sink, expression, attributeName);\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t// it's either a plain ClassObject or a Chronosympton<ClassObject>\n\t\t\t\t\t\t\t\t\t// Merge present properties of the object inline in the HTML and the rest in a future sink\n\t\t\t\t\t\t\t\t\tconst splitter = ([k, v]: KVP) => isFutureSinkAttributeValue(v); // || isSourceBindingConfiguration(v) || (typeof v != 'string' && isRMLEventListener(k, v));\n\t\t\t\t\t\t\t\t\tconst [statics, deferreds] = chronolyze(expression as AttributeObject || {}, splitter);\n\n\t\t\t\t\t\t\t\t\tif(deferreds.length) {\n\t\t\t\t\t\t\t\t\t\thandler = PreSink(attributeName, sink, Object.fromEntries(deferreds), attributeName);\n\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\tinitialValue = statics.filter(([k, v]) => v).map(([k, v]) => k).join(' ');\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tisBooleanAttribute = BOOLEAN_ATTRIBUTES.has(attributeName);\n\t\t\t\t\t\t\t\tconst isDatasetAttribute = attributeName.startsWith('data-');\n\t\t\t\t\t\t\t\tsink = (\n\t\t\t\t\t\t\t\t\tsinkByAttributeName.get(attributeName)\n\t\t\t\t\t\t\t\t\t?? (isBooleanAttribute && DOMAttributePreSink(<WritableElementAttribute>attributeName))\n\t\t\t\t\t\t\t\t\t?? (isDatasetAttribute && DatasetItemPreSink(attributeName))\n\t\t\t\t\t\t\t\t) || FixedAttributePreSink(attributeName);\n\n\t\t\t\t\t\t\t\t// TODO: hard-match attributeName with a corresponding SINK_TAG...\n\t\t\t\t\t\t\t\thandler = PreSink(attributeName, sink, expression, attributeName);\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tif(handler!) {\n\t\t\t\t\t\t\t\taddRef(ref, handler);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t// TODO: remove boolean attributes if they are bound to streams: disabled=\"${stream}\"\n\t\t\t\t\t\t\t// should not be disabled by its mere presence, but depending on the value emitted by the stream.\n\n\t\t\t\t\t\t\tconst prefix = isBooleanAttribute && (!initialValue || !expression)\n\t\t\t\t\t\t\t\t// REF0000266279391633\n\t\t\t\t\t\t\t\t? accPlusString.replace(new RegExp(`${attributeName}=['\"]+$`), `_${attributeName}=\"`) // TODO: or maybe clean it up completely?\n\t\t\t\t\t\t\t\t: accPlusString\n\t\t\t\t\t\t\t;\n\t\t\t\t\t\t\tconst h = prefix +initialValue;\n\t\t\t\t\t\t\tacc = (handler!)\n\t\t\t\t\t\t\t\t? h.replace(/<(\\w[\\w-]*)\\s+([^>]+)$/, `<$1 ${existingRef?'':`${RESOLVE_ATTRIBUTE}=\"${ref}\" `}$2`)\n\t\t\t\t\t\t\t\t: h\n\t\t\t\t\t\t\t;\n\t\t\t\t\t\t}\n\t\t\t\t\t} else if(/<[a-z_][a-z0-9_-]*[^>]*(?:\\s+\\.\\.\\.)?$/ig.test(accPlusString.substring(lastTag))) {\n\n\t\t\t\t\t\t// Mixin Sink\n\t\t\t\t\t\t// Use Cases:\n\t\t\t\t\t\t// <some-tag some-attribute=\"some-value\" ${mixin}></some-tag>\n\t\t\t\t\t\t// <some-tag some-attribute=\"some-value\" ...${mixin}></some-tag>\n\t\t\t\t\t\t// <some-tag some-attributes ...${mixin} other-stuff>...</some-tag>\n\t\t\t\t\t\t// <some-tag some-attribute=\"some-value\" ...${[mixin1, mixin2, ...mixinN]}></some-tag>\n\t\t\t\t\t\t// will bind multiple attributes and values\n\t\t\t\t\t\tacc += string.replace(/\\.\\.\\.$/, '');\n\n\t\t\t\t\t\tarrayse(expression).forEach((expression, edx) => {\n\t\t\t\t\t\t\tlet sinks: SinkBindingConfiguration<HTMLElement | SVGElement | MathMLElement>[];\n\t\t\t\t\t\t\tif(isSinkBindingConfiguration(expression)) {\n\t\t\t\t\t\t\t\t// acc = accPlusString;\n\t\t\t\t\t\t\t\tsinks = [expression];\n\t\t\t\t\t\t\t} else if(isFuture(expression)) {\n\t\t\t\t\t\t\t\t// If we have a Promise, we wait for it to resolve and then render the mixin}\n\t\t\t\t\t\t\t\tsinks = [Mixin(expression as Future<AttributeObject>)];\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t// Merge static (string, number) properties of the mixin as inline attributes into the HTML template\n\t\t\t\t\t\t\t\t// then bind the rest after mounting\n\t\t\t\t\t\t\t\tconst splitter = ([k, v]: KVP) => isFutureSinkAttributeValue(v) || isSourceBindingConfiguration(v) || (typeof v != 'string' && isRMLEventListener(k, v));\n\t\t\t\t\t\t\t\tconst [staticAttributes, deferredAttributes] = chronolyze(expression as AttributeObject || {}, splitter);\n\n\t\t\t\t\t\t\t\tstaticAttributes.forEach(([k, v], idx) => {\n\t\t\t\t\t\t\t\t\tlet cake = [];\n\t\t\t\t\t\t\t\t\tswitch(k) {\n\t\t\t\t\t\t\t\t\t\tcase 'class':\n\t\t\t\t\t\t\t\t\t\t\tacc = acc\n\t\t\t\t\t\t\t\t\t\t\t\t.replace(/(<\\w+.*)class=\"([^\"]*)\"([^>]*)$/, '')\n\t\t\t\t\t\t\t\t\t\t\t\t+`${RegExp.$1} class=\"${arrayse(RegExp.$2, Object.entries(typeof v == 'string' ? {[v]: true} : v).filter(([k, v]) => v).map(([k, v])=>k)).filter(x=>x).join(' ')}\" ${RegExp.$3}`\n\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\tcase 'style':\n\t\t\t\t\t\t\t\t\t\t\tacc = acc\n\t\t\t\t\t\t\t\t\t\t\t\t.replace(/(<\\w+.*)style=\"([^\"]*);?\\s*\"([^>]*)$/, '')\n\t\t\t\t\t\t\t\t\t\t\t\t+`${RegExp.$1} style=\"${arrayse(RegExp.$2, typeof v == 'string' ? v : Object.entries(v).filter(([k, v]) => v).map(([k, v])=>`${k}: ${v};`)).filter(x=>x).join(' ')}\" ${RegExp.$3}`\n\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\tcase 'innerText':\n\t\t\t\t\t\t\t\t\t\tcase 'innerHTML':\n\t\t\t\t\t\t\t\t\t\tcase 'prependHTML':\n\t\t\t\t\t\t\t\t\t\t\t// case 'appendHTML':\n\t\t\t\t\t\t\t\t\t\t\tconst [a, b] = nextString.split('>');\n\t\t\t\t\t\t\t\t\t\t\tstrings[i]+='>';\n\t\t\t\t\t\t\t\t\t\t\tstrings.splice(i+1, 1, a, b);\n\t\t\t\t\t\t\t\t\t\t\texpressions.splice(i+1, 0, '>'+v);\n\t\t\t\t\t\t\t\t\t\t\t// i--;\n\t\t\t\t\t\t\t\t\t\t\tstrlen++;\n\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\t\t\t\tcake.push(`${k}=\"${v}\"`);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tacc += ' ' +cake.join(' ');\n\t\t\t\t\t\t\t\t\tcake = [];\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\tif(deferredAttributes.length) {\n\t\t\t\t\t\t\t\t\tconst [attribuends, sources] = deferredAttributes.reduce((acc, [k, v]) => {\n\t\t\t\t\t\t\t\t\t\tisSourceBindingConfiguration(v)\n\t\t\t\t\t\t\t\t\t\t\t? acc[1].push({...v, eventName: k.replace(/^(rml:)?on/, '$1') as RMLEventName})\n\t\t\t\t\t\t\t\t\t\t\t: acc[0].push([k, v])\n\t\t\t\t\t\t\t\t\t\t;\n\t\t\t\t\t\t\t\t\t\treturn acc;\n\t\t\t\t\t\t\t\t\t}, [[], []] as [SourceBindingConfiguration<RMLEventName>[], KVP[]]);\n\t\t\t\t\t\t\t\t\tsinks = arrayse(attribuends.length ? Mixin(Object.fromEntries(attribuends)) : [], ...sources);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tif(sinks!?.length) {\n\t\t\t\t\t\t\t\taddRef(ref, ...sinks);\n\t\t\t\t\t\t\t\tacc = acc.replace(/<(\\w[\\w-]*)\\s+([^<]*)$/, `<$1 ${existingRef?'data-x=\"1\" ':`${RESOLVE_ATTRIBUTE}=\"${ref}\" `}$2`);\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t// FIXME: quick dirty hack to prevent empty refs from being created unnecessarily\n\t\t\t\t\t\t\t\tstate.refCount--;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\n\t\t\t\t\t} else if(/>\\s*$/.test(string) && /^\\s*</.test(nextString)) {\n\t\t\t\t\t\t// Content Sink\n\t\t\t\t\t\t// Use Cases:\n\t\t\t\t\t\t// <some-tag>${observable}</some-tag>\n\t\t\t\t\t\t// <some-tag>${BehaviorSubject}</some-tag> // will synchronously set the initial value of the BehaviorSubject, then update the element on subsequent emissions (good for SSR and to reduce repaints)\n\n\t\t\t\t\t\tconst sinkExpression = <RMLTemplateExpressions.SinkExpression | RMLTemplateExpressions.HTMLText | RMLTemplateExpressions.TextString>expression;\n\n\t\t\t\t\t\t// If we have an initialValue, we treat it as a BehaviorSubject,\n\t\t\t\t\t\t// take its current .value, render is synchronously to avoid reflows\n\t\t\t\t\t\t// and then subscribe to subsequent emissions\n\t\t\t\t\t\t// FIXME: any chance an expression could be mistaken for a BehaviorSubject here? A Generator, or other stuff??? May want to have a better isBehaviorSubject check here...\n\t\t\t\t\t\t// const _source = <MaybeFuture<HTMLString>>(initialValue\n\t\t\t\t\t\t// \t? (expression?.source ?? expression)?.pipe?.( skip(1) )\n\t\t\t\t\t\t// \t: sinkExpression\n\t\t\t\t\t\t// );\n\t\t\t\t\t\tconst _source = <MaybeFuture<HTMLString>>sinkExpression;\n\n\t\t\t\t\t\t// addRef(ref, <RMLTemplateExpressions.GenericHandler>{ handler, type: sinkType, error: errorHandler, ...sinkType == 'collection' && {attribute: expression} || {} /*, termination: terminationHandler */ });\n\t\t\t\t\t\taddRef(ref, isSinkBindingConfiguration(_source) ? _source : InnerHTML(_source));\n\t\t\t\t\t\tacc = acc\n\t\t\t\t\t\t\t+(existingRef ? string : string.replace(/\\s*>\\s*$/, ` ${RESOLVE_ATTRIBUTE}=\"${ref}\">`))\n\t\t\t\t\t\t\t+initialValue\n\t\t\t\t\t\t;\n\n\t\t\t\t\t} else if(/>?\\s*[^<]*$/m.test(string) && /^\\s*[^<]*\\s*<?/m.test(nextString)) {\n\n\t\t\t\t\t\t// will set the textContent of the given textNode\n\t\t\t\t\t\taddRef(ref, TextContent(expression, true));\n\t\t\t\t\t\t// FIXME: are we adding #REF multiple times?\n\t\t\t\t\t\t//acc = existingRef?accPlusString:acc +string.replace(/\\s*>/, ` ${RESOLVE_ATTRIBUTE}=\"${ref}\">`) +ref;\n\t\t\t\t\t\tacc += (existingRef?string:string.replace(/\\s*>(?=[^<]*$)/, ` ${RESOLVE_ATTRIBUTE}=\"${ref}\">`)) +INTERACTIVE_NODE_START +initialValue +INTERACTIVE_NODE_END;\n\n\t\t\t\t\t} else {\n\t\t\t\t\t\tacc = accPlusString;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t}\n\t\t}\n\t}\n\tacc += strings[strlen];\n\n\treturn <HTMLString>acc;\n}\n","import { Rimmel_Mount } from './lifecycle/data-binding';\n// import { rml } from './parser/parser';\n\nexport const init = (root = document.documentElement) => {\n\tconst mo = new MutationObserver(Rimmel_Mount);\n\tmo.observe(root, { attributes: false, childList: true, subtree: true });\n};\n\n// import { Rimmel_Bind_Subtree } from './lifecycle/data-binding';\n// export const activate = Rimmel_Bind_Subtree;\n\n/*\nexport const setRoot = (e: Element): RML => {\n\tconst root = e;\n\tinit(root);\n\treturn rml;\n}\n*/\n\ninit();\n\n// Types\nexport * from './types/attribute';\nexport * from './types/coords';\nexport * from './types/dom';\nexport * from './types/event-listener';\nexport * from './types/futures';\nexport * from './types/internal';\nexport * from './types/rml';\nexport * from './types/sink';\nexport * from './types/source';\nexport * from './types/style';\nexport * from './definitions/boolean-attributes';\nexport * from './utils/input-pipe';\nexport * from './sources/object-source';\n\n// Event Mapping Functions\nexport { feed, feedIn, inputPipe, pipeIn } from './utils/input-pipe';\nexport { korma } from './utils/curry';\n\n// Event Source Modifiers\nexport { Active } from './sources/modifiers/active';\nexport { Captive } from './sources/modifiers/captive';\nexport { Passive } from './sources/modifiers/passive';\n\n// Event Sources\nexport { All, qsa } from './sources/all-source';\nexport { AsTypedFormData, AutoForm, autoForm } from './sources/autoform-source';\nexport { autoValue } from './utils/auto-value';\nexport { CheckedState } from './sources/checked-source';\nexport { Cut, cut } from './sources/cut-source';\nexport { Dataset, DatasetObject, datasetObject } from './sources/dataset-source';\nexport { Numberset } from './sources/numberset-source';\nexport { EventData, eventData } from './sources/event-data';\nexport { EventTarget } from './sources/event-target';\nexport { Form, form, AsFormData, asFormData } from './sources/form-data-source';\nexport { Key, key } from './sources/keyboard-source';\nexport { Update } from './sources/object-source';\nexport { ClientXY } from './sources/client-xy-source';\nexport { OffsetXY } from './sources/offset-xy-source';\nexport { LastTouchXY } from './sources/last-touch-xy-source';\nexport { Swap } from './sources/swap-source';\nexport { AsLatestFrom } from './sources/as-latest-from';\nexport { AutoValue, Value, ValueAsDate, ValueAsNumber, value, valueAsString, valueAsDate, valueAsNumber } from './sources/value-source';\n\n// Data Sinks\nexport { AnyContentSink } from \"./sinks/content-sink\";\nexport { AttributeObjectSink } from \"./sinks/attribute-sink\";\n// Data Sinks\nexport { AppendHTML } from './sinks/append-html-sink';\nexport { Blur } from './sinks/blur-sink';\nexport { Checked } from './sinks/checked-sink';\nexport { ClassName, ToggleClass } from './sinks/class-sink';\nexport { Closed } from './sinks/closed-sink';\nexport { Disabled, DisabledSink } from './sinks/disabled-sink';\nexport { Catch } from './sinks/error-sink';\nexport { Focus } from './sinks/focus-sink';\nexport { Hidden } from './sinks/hidden-sink';\nexport { InnerHTML } from './sinks/inner-html-sink';\nexport { InnerText } from './sinks/inner-text-sink';\nexport { Mixin } from './sinks/mixin-sink';\nexport { JSONDump } from './sinks/json-dump-sink';\nexport { PrependHTML } from './sinks/prepend-html-sink';\n//export { Readonly } from './sinks/readonly-sink';\nexport { Removed } from './sinks/removed-sink';\nexport { Sanitize } from './sinks/sanitize-html-sink';\nexport { Suspend, Suspender } from './sinks/suspense-sink';\nexport { TextContent } from './sinks/text-content-sink';\n\n// Plumbing\nexport { asap } from './lib/drain';\n\n// Experimental Web Component support\nexport { RegisterElement } from './custom-element';\n\n// Utilities (Will take them out to the framework)\nexport type { Component } from './types/constructs';\nexport type { RimmelComponent, RMLTemplateExpressions } from './types/internal';\n\nexport { EventAdapter, source, sink } from './utils/input-pipe';\n\n// Other Low-Level Utilities\nexport { Rimmel_Bind_Subtree, Rimmel_Mount } from './lifecycle/data-binding';\nexport { RESOLVE_SELECTOR, RML_DEBUG, SINK_TAG } from './constants';\nexport { set_USE_DOM_OBSERVABLES } from './constants';\n\nexport { callable } from './lib/drain';\n\n// Main entries\nexport { rml } from './parser/parser';\nexport { rml as html } from './parser/parser'; // Shall we?\n\n// Experimental stuff\n// export { rml } from 'rml/scandal';\nexport { Observature } from './lib/observature';\n\n"],"names":["Subject","map","from","of","withLatestFrom","catchError","BehaviorSubject"],"mappings":";;;IAQA;IACA,IAAI,CAAC,MAAM,GAAC,EAAE;IAEP,MAAM,OAAO,GAAW,SAAS;IAGxC;IACA;IACO,MAAM,iBAAiB,GAAW,SAAS,CAAC;AAC5C,UAAM,gBAAgB,GAAW,CAAA,CAAA,EAAI,iBAAiB;IAE7D;AACO,UAAM,SAAS,GAAW;IAEjC;IACA;IACO,MAAM,sBAAsB,GAAG,QAAQ;IACvC,MAAM,oBAAoB,GAAK,QAAQ,CAAC;AAGxC,UAAM,QAAQ,GAAW;IAEhC;IACO,IAAI,mBAAmB,GAAY,KAAK;AACxC,UAAM,uBAAuB,IAAI,CAAC,CAAU,KAAK,mBAAmB,GAAG,CAAC;IAExE,MAAM,iBAAiB,GAAG,MAAM,CAAC,GAAG,CAAC,aAAa,CAAC;IAM1D;IACA;IACA;;IC1CA;IACO,MAAM,mBAAmB;IAC/B;IACC,CAAC,OAAO,uBAAuB,KAAK;IAClC,MAAE;UACA,IAAI,CACR;;ICAK,MAAM,sBAAsB,GAAwC,IAAI,GAAG,EAAE;IAG7E,MAAM,aAAa,GAA8B,IAAI,GAAG,EAAE;IAKjE;IACO,MAAM,KAAK,GAAG;IACpB,IA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