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AAW,IAAM,IAAIysB,KACtCmB,GAAa5tB,IAAI,IAAkB,IAAM,IAAIyoB,KAC7CmF,GAAa5tB,IAAI,IAAU,IAAM,IAAIupB,KACrCqE,GAAa5tB,IAAI,IAAQ,IAAM,IAAI+oB,KACnC6E,GAAa5tB,IAAI,IAAM,IAAM,IAAI6qB,KACjC+C,GAAa5tB,IAAI,IAAoB,IAAM,IAAIkrB,KAC/C0C,GAAa5tB,IAAIorB,IAAW,IAAM,IAAIP,KACtC+C,GAAa5tB,IAAI,IAAqB,IAAM,IAAIisB,KAChD2B,GAAa5tB,IAAI,IAAmB,IAAM,IAAImrB,KAC9CyC,GAAa5tB,IAAI,IAAiB,IAAM,IAAIgsB,KAC5C4B,GAAa5tB,IAAI,IAAW,IAAM,IAAI8nB,KACtC8F,GAAa5tB,IAAI,IAAYoB,GAAoB,IAAIyb,GAASzb,KAC9DwsB,GAAa5tB,IAAI,IAAe,KAC5B,MAAM0J,EAAO,IAAIqjB,GAEjB,OADArjB,EAAKI,SAAS9J,IAAI,SAAS,IAAM,IAAIgtB,KAC9BtjB,KAGXkkB,GAAa5tB,IAAI,UAAU,IAAM,IAAI8Y,GAAW1X,EAAK,kBACrDwsB,GAAa5tB,IAAI,kBAAkB,IAAM,IAAIwnB,GAAmB,CAAEpmB,KAAM8mB,OACxE0F,GAAa5tB,IAAI,UAAU,IAAM,IAAI6a,GAAWzZ,EAAK,QAAQmZ,MAAOnZ,EAAK,cACzEwsB,GAAa5tB,IAAI,QAAQ,IAAM,IAAIyV,IACnCmY,GAAa5tB,IAAI,QAAQ,IAAM,IAAIoV,IACnCwY,GAAa5tB,IAAI,UAAU,IAAM,IAAIqU,IACrCuZ,GAAa5tB,IAAI,SAAS,IAAM,IAAIuK,EAAK,CAAE1B,SAAU,kBACrD+kB,GAAa5tB,IAAI,GAAc,IAAM,IAAI2V","sources":["webpack://main/webpack/bootstrap","webpack://main/webpack/runtime/define property getters","webpack://main/webpack/runtime/hasOwnProperty shorthand","webpack://main/webpack/runtime/make namespace object","webpack://main/./node_modules/@lernetz/ts-lib/src/Registry.ts","webpack://main/./node_modules/@lernetz/ts-lib/src/view/Compiler.ts","webpack://main/./node_modules/@lernetz/ts-lib/src/view/expressions/Expression.ts","webpack://main/./node_modules/@lernetz/ts-lib/src/Signal.ts","webpack://main/./node_modules/@lernetz/ts-lib/src/Observer.ts","webpack://main/./node_modules/@lernetz/ts-lib/src/view/expressions/ClosureExpression.ts","webpack://main/./node_modules/@lernetz/ts-lib/src/view/expressions/RenderExpression.ts","webpack://main/./node_modules/@lernetz/ts-lib/src/view/expressions/ViewExpression.ts","webpack://main/./node_modules/@lernetz/ts-lib/src/view/View.ts","webpack://main/./node_modules/@lernetz/ts-lib/src/components/Scope.ts","webpack://main/./node_modules/@lernetz/ts-lib/src/Lang.ts","webpack://main/./node_modules/@lernetz/ts-lib/src/Setup.ts","webpack://main/./node_modules/@lernetz/ts-lib/src/Model.ts","webpack://main/./node_modules/@lernetz/ts-lib/src/Request.ts","webpack://main/./node_modules/@lernetz/ts-lib/src/view/Template.ts","webpack://main/./node_modules/@lernetz/ts-lib/src/components/Repeat.ts","webpack://main/./node_modules/@lernetz/ts-lib/src/components/Show.ts","webpack://main/./typescript/utility/HtmlView.ts","webpack://main/./typescript/utility/DebugMessage.ts","webpack://main/./typescript/utility/DebugMessage.html","webpack://main/./typescript/aside/Aside.ts","webpack://main/./typescript/aside/Aside.html","webpack://main/./typescript/audio/Audio.ts","webpack://main/./typescript/audio/Audio.html","webpack://main/./typescript/button/Button.ts","webpack://main/./typescript/button/Button.html","webpack://main/./typescript/cartoon/Cartoon.ts","webpack://main/./typescript/cartoon/Cartoon.html","webpack://main/./typescript/collapsible-section/CollapsibleSection.ts","webpack://main/./typescript/collapsible-section/CollapsibleSection.html","webpack://main/./typescript/collapsible-section/Level3Header.html","webpack://main/./typescript/collapsible-section/Level4Header.html","webpack://main/./typescript/footer/Footer.ts","webpack://main/./typescript/footer/Footer.html","webpack://main/./typescript/image/Image.ts","webpack://main/./typescript/image/Image.html","webpack://main/./typescript/linked-video/LinkedVideo.ts","webpack://main/./typescript/linked-video/LinkedVideo.html","webpack://main/./typescript/manual-two-column-layout/ManualTwoColumnLayout.ts","webpack://main/./typescript/manual-two-column-layout/ManualTwoColumnLayout.html","webpack://main/./typescript/materials/Materials.ts","webpack://main/./typescript/materials/Materials.html","webpack://main/./typescript/utility/debounce.ts","webpack://main/./typescript/nav-bar/NavBar.ts","webpack://main/./typescript/nav-bar/NavBarOnStartPage.html","webpack://main/./typescript/nav-bar/NavBar.html","webpack://main/./typescript/page/CoverImage.ts","webpack://main/./typescript/Asset.ts","webpack://main/./typescript/page/Page.ts","webpack://main/./typescript/page/TopicPage.html","webpack://main/./typescript/page/Page.html","webpack://main/./typescript/page/TopicPageSection.ts","webpack://main/./node_modules/tabbable/dist/index.esm.js","webpack://main/./node_modules/focus-trap/dist/focus-trap.esm.js","webpack://main/./typescript/popup-container/PopupContainer.ts","webpack://main/./typescript/popup-container/PopupContainer.html","webpack://main/./typescript/popup-page-buttons/PopupPage.ts","webpack://main/./typescript/popup-page-buttons/PopupPage.html","webpack://main/./typescript/popup-page-buttons/PopupPageButtons.ts","webpack://main/./typescript/popup-page-buttons/PopupPageButtons.html","webpack://main/./typescript/popup-page-buttons/LargeButton.html","webpack://main/./typescript/popup-page-buttons/SmallButton.html","webpack://main/./typescript/quiz/Answer.ts","webpack://main/./typescript/quiz/Answer.html","webpack://main/./typescript/quiz/Slide.ts","webpack://main/./typescript/quiz/Question.ts","webpack://main/./typescript/quiz/Question.html","webpack://main/./typescript/quiz/Quiz.ts","webpack://main/./typescript/quiz/Quiz.html","webpack://main/./typescript/quiz/QuizLauncherButton.ts","webpack://main/./typescript/quiz/QuizLauncherButton.html","webpack://main/./typescript/quiz/ScoreQuizQuestion.ts","webpack://main/./typescript/quiz/ScoreQuizQuestion.html","webpack://main/./typescript/quiz/ScoreQuiz.ts","webpack://main/./typescript/quiz/ScoreQuizAnswer.ts","webpack://main/./typescript/quiz/ScoreQuizAnswer.html","webpack://main/./typescript/quiz/ScoreQuizEvaluation.ts","webpack://main/./typescript/quiz/ScoreQuizEvaluation.html","webpack://main/./typescript/quiz/ScoreQuizResult.ts","webpack://main/./typescript/heading/Heading.ts","webpack://main/./typescript/heading/Heading.html","webpack://main/./typescript/paragraph/Paragraph.ts","webpack://main/./typescript/paragraph/Paragraph.html","webpack://main/./typescript/topics-preview/TopicsPreview.ts","webpack://main/./typescript/topics-preview/TopicsPreview.html","webpack://main/./typescript/topics-preview/Topic.ts","webpack://main/./typescript/topics-preview/Topic.html","webpack://main/./typescript/register.ts","webpack://main/./typescript/Main.ts"],"sourcesContent":["// The require scope\nvar __webpack_require__ = {};\n\n","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","interface RegistryFactoryClosure {\n\t( value:FactoryIn ): FactoryOut;\n}\n\n\n/**\n * A class that handles key value mappings with sub mappings\n */\nexport class Registry {\n\n\tprotected entries:Map>;\n\n\tconstructor() {\n\t\tthis.entries = new Map();\n\t}\n\n\tadd( key:any, closure:RegistryFactoryClosure ) {\n\t\tthis.entries.set( key, closure );\n\t\treturn this;\n\t}\n\n\tget( key:any ) {\n\t\t// check for entry\n\t\tlet found = this.entries.get( key );\n\n\t\t// return entry if it has and search on constructor if available\n\t\treturn found ? found : ( key && key.constructor ) ? this.entries.get( key.constructor ) : undefined;\n\n\t}\n}\n\n","\n\nvar pass = {\n\tregex:/\\[\\[([\\s\\S]+?)\\]\\]/g,\n\tmapper: function( match, inner ) {\n\t\treturn \"function() {\\n try { with( data ) {\\n return \" + inner + \" } } catch (error) { this.log( error ) } }.call( this )\";\n\t}\n};\n\nvar cache = {};\n\n\n/**\n * Compiles a template string into a template function.\n */\nexport function compile( templateString:string, args:string[] = [ 'data' ] ):Function {\n\n\tlet key = templateString + args.join( ' ' );\n\n\t// handle caching\n\tif( cache[ key ] ) return cache[ key ]\n\n\t// check if template is one single [[ .. ]] expression\n\tlet matches = templateString.match( /\\[\\[([\\s\\S]+?)\\]\\]/ );\n\tif( matches && matches[0] == templateString ) {\n\t\tvar source = parseValue( templateString );\n\t} else {\n\t\tvar source = parseString( templateString );\n\t}\n\n\tvar render = new Function( ...args, source );\n\n\t// store for caching\n\tcache[ key ] = render;\n\n\treturn render;\n}\n\n\n/**\n* Turns the given template into a function body code.\n*/\nfunction parseString( template:string ):string {\n\n\ttemplate = template.replace( pass.regex, ( match, inner:string ) => {\n\t\treturn \"` + this.empty( \" + pass.mapper( match, inner ) + \" ) + `\";\n\t});\n\n\treturn \"return `\" + template + \"`;\";\n}\n\n/**\n* Turns the given template into a function body code.\n*/\nfunction parseValue( template:string ):string {\n\t// simply return the inner template content\n\treturn template.replace( pass.regex, ( match, inner:string ) => {\n\t\treturn \"return \" + pass.mapper( match, inner ) + \";\";\n\t});\n}\n\n/**\n * Tests if the value of the template is empty or not\n */\nexport function empty( data:any ):string {\n\treturn data || data === 0 ? data : '';\n}\n\n/**\n * Logs errors to the console\n */\nexport function log( ...params ) {\n\tif( console ) {\n\t\t( console.trace ) ? console.trace( ...params ) : console.log( ...params );\n\t}\n}\n\n/**\n * Stops the debugger\n */\nexport function debug() {\n\tdebugger;\n}\n\n/**\n * Tests if the given string has an expression\n * @param string\n */\nexport function hasExpression( string:string ):boolean {\n\tpass.regex.lastIndex = 0; // reset global regex\n\treturn pass.regex.test( string );\n}\n\n/**\n * Returns only the content of the expressions [[...]] within the given string\n */\nexport function getContent( string:string ) {\n\tlet content = '';\n\tstring.replace( pass.regex, ( match, inner ) => {\n\t\tcontent += inner;\n\t\treturn '';\n\t});\n\treturn content;\n}\n\n/**\n * Replaces the expression of the given templatee with the content of the closure\n */\nexport function replace( template:string, replacer:( match:string, inner ) => string ) {\n\treturn template.replace( pass.regex, replacer );\n}\n","import { Subscription } from \"../../Signal\";\nimport { TemplateContext } from \"../Template\";\n\n\n\n/**\n * Super class of all expressions to store the expression and its context.\n * It handles also the subscription on observables\n */\nexport abstract class Expression {\n\n\texpression:Function;\n\tcontext:TemplateContext;\n\n\tconstructor( context:TemplateContext ) {\n\t\tthis.context = context;\n\t}\n\n\tabstract destroy();\n}\n\n\nexport interface ExpressionWithInital {\n\tinital();\n}\n\n/**\n * A guard that checks whether the specified object has an inital function to invoke\n *\n * @param obj The object that should be tested.\n */\nexport function hasInital( obj:any ):obj is ExpressionWithInital {\n\treturn obj && obj[ 'inital' ];\n}\n\n\n\n\nexport function snakeToCamel( string ):string {\n\treturn string.replace( /(\\-\\w)/g, match => match[1].toUpperCase() );\n}\n\nexport function camelToSnake( string ) {\n\treturn string.split(/(?=[A-Z])/).join('-').toLowerCase();\n}\n\n","/**\n * This module contains the [[Observable]] interface and its principal implementation, [[Signal]].\n * See https://tc39.es/proposal-observable/ and https://rxjs.dev/ for more in-depth information\n * about observables.\n */\n\n\n/**\n * An [[Observer]] is a callback function that will receive `T` values from a [[Observable]]\n * after it has been [[subscribe]]d to it.\n */\nexport type Observer = (arg: T) => void;\n\n\n/**\n * A subscription gets returned to you when you [[Observable.subscribe]] an [[Observer]] to an [[Observable]].\n * It is via this object that you can [[unsubscribe]] the observer again.\n */\nexport interface Subscription {\n\n\t/**\n\t * Unsubscribes the observer from the [[Observable]] so it will no longer receive its values.\n\t */\n unsubscribe(): void;\n}\n\n\n/**\n * An [[Observable]] is a composable sequence of `T` values that will be *pushed* to observers\n * as they become available. This is the reverse of collections, which allow you to *pull* values\n * out of it via iteration.\n *\n * * `subscription = subscribe(observer)` to start receiving values.\n *\n * * `subscription.unsubscribe()` to stop receiving values.\n *\n * @example\n *\n * ```typescript\n * import {node} from '.../core/node/Node';\n *\n * const clicks = node(document.querySelector('#someElement')).clicks;\n * const subscription = clicks.subscribe(e => console.log('You clicked on ', e.target));\n * ...\n * subscription.unsubscribe();\n * ```\n *\n * @seealso https://tc39.es/proposal-observable/\n * @seealso https://rxjs.dev/\n */\nexport class Observable {\n\n private readonly subscribe_: (observer: Observer) => Subscription;\n\n\t/**\n\t * Initializes a new instance of the [[Observable]] class.\n\t *\n\t * @param subscribe The implementation of the [[subscribe]] method.\n\t */\n public constructor(subscribe: (observer: Observer) => Subscription) {\n this.subscribe_ = subscribe;\n }\n\n\t/**\n\t * Returns a new observable where all values of the original observable are delayed\n\t * as long as new values are pushed to observers. Once there hasn't been a new value for\n\t * `wait` milliseconds, the last value gets pushed.\n\t *\n\t * @param wait The number of milliseconds to wait after the last value before it is pushed.\n\t */\n public debounce(wait: number): Observable {\n return new Observable(observer => {\n let timeout;\n return this.subscribe(arg => {\n const later = () => {\n timeout = null;\n observer(arg);\n };\n clearTimeout(timeout);\n timeout = setTimeout(later, wait);\n });\n });\n }\n\n\t/**\n\t * Gets a new observable containing only the values that fulfill the given predicate `fn`.\n\t * Think [Array.prototype.filter()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/filter).\n\t *\n\t * @param fn A predicate that specifies which values from the original observable to keep.\n\t */\n public filter(fn: (arg: T) => boolean): Observable {\n return new Observable(observer => {\n return this.subscribe(arg => {\n if (fn(arg)) {\n observer(arg);\n }\n });\n });\n }\n\n\t/**\n\t * Gets a new observable where each value has been transformed by the given function `fn`.\n\t * Think [Array.prototype.map()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map).\n\t *\n\t * @param fn A function that maps a value to another value.\n\t */\n public map(fn: (arg: T) => U): Observable {\n return new Observable(observer => {\n return this.subscribe(arg => {\n observer(fn(arg));\n });\n });\n }\n\n\t/**\n\t * Subscribes the given `observer` (a callback function) to this observable which will start\n\t * receiving its values. Returns a [[Subscription]] via which you can [[unsubscribe]] the observer.\n\t *\n\t * @param observer The callback function that should receive `T` values from this observable.\n\t */\n public subscribe(observer: Observer): Subscription {\n return this.subscribe_(observer);\n }\n}\n\n\n/**\n * A kind of [[Observable]] that can dispatch `T` values via [[Signal.dispatch]].\n */\nexport class Signal extends Observable {\n\n private observers_?: Observer[];\n\n\t/**\n\t * Initializes a new instance of the [[Signal]] class.\n\t */\n public constructor() {\n super(observer => {\n if (!this.observers_) {\n this.observers_ = [observer];\n }\n else if (this.observers_.indexOf(observer) < 0) {\n this.observers_.push(observer);\n }\n const observers = this.observers_;\n return {\n unsubscribe: () => {\n const index = observers.indexOf(observer);\n if (index >= 0) {\n observers.splice(index, 1);\n }\n }\n };\n });\n this.observers_ = [];\n }\n\n\t/**\n\t * Dispatches the given value `arg` to this signal's observers.\n\t *\n\t * @param arg The value to dispatch to observers.\n\t */\n public dispatch(arg: T) {\n if (this.observers_) {\n for (const observer of [...this.observers_]) {\n observer(arg);\n }\n }\n }\n}\n\n/**\n * Listens to an event target event and creates an observable instance\n * @param el the event target tzo listen to\n * @param event the name of the event to listen to\n */\nexport function observable( event:string, el:EventTarget ):Observable {\n\treturn new Observable( observer => {\n\t\tlet handler = ( event ) => observer( event );\n\t\tel.addEventListener( event, handler );\n\t\treturn {\n\t\t\tunsubscribe:() => {\n\t\t\t\tel.removeEventListener( event, handler );\n\t\t\t}\n\t\t}\n\t});\n}\n","import { Signal } from './Signal';\n\n/**\n * Checks whether the specified object implements [[PropertyObserver]].\n * If its possible to observe its properties\n *\n * @param obj The object that should be tested.\n */\nexport function isPropertyObserver( obj:any ):obj is PropertyObserver {\n\treturn obj && obj[ 'propertyChange' ] instanceof Signal;\n}\n\n\n/**\n * Describes the payload of the [[PropertyChangedSignal.propertyChanged]] observable.\n */\nexport interface PropertyChanged {\n\tname:string\n}\n\n\n/**\n * Types that implement this interface publish all property value changes as an [[Observable]].\n *\n * @see observeProperties that turns an object into a PropertyObserver\n */\nexport interface PropertyObserver {\n\n\t/**\n\t * Raised when a property's value has changed.\n\t *\n\t * @event\n\t */\n\tpropertyChange:Signal;\n}\n\n\n\nexport function dependProperty( target:T, targetProperty:( keyof T ), source:S, sourceProperty:( keyof S ) ) {\n\n\t// make sure the properties are observed\n\tlet targetObserved = observeProperties( target, targetProperty );\n\tlet sourceObserved = observeProperties( source, sourceProperty );\n\n\tsourceObserved.propertyChange.filter( e => e.name == sourceProperty ).subscribe( () => {\n\t\ttargetObserved.propertyChange.dispatch( { name:targetProperty as string } );\n\t});\n}\n\n\n/**\n * Observes a list of properties\n * @param target The model to observe properties on\n * @param properties The list of property name to observe\n */\nexport function observeProperties(target:T, ...properties:(keyof T)[] ):T&PropertyObserver {\n\n\t// do not observe any null / undefined targets\n\tif( !target ) return;\n\n\tlet t = target as T&PropertyObserver;\n\n\t// make sure signal exists\n\tif( !t.propertyChange ) t.propertyChange = new Signal();\n\n\t// if there are no properties take all properties of the target\n\tif( properties.length == 0 ) properties = Object.keys( t ) as (keyof T)[];\n\n\t// loop over properties an check if there are accessors\n\tlet obj:any = {};\n\tfor ( const prop of properties ) {\n\n\t\t// no accessors for propertyChanged\n\t\tif( prop == 'propertyChange' ) continue;\n\n\t\t// lookup prototype chain for property descriptor\n\t\tlet c = t;\n\t\tlet desc;\n\t\twhile( c != null && desc == null ) {\n\t\t\tdesc = Object.getOwnPropertyDescriptor( c, prop );\n\t\t\tc = Object.getPrototypeOf( c );\n\t\t}\n\n\t\t// if property does not exist on target add undefined accessor\n\t\tif( !desc ) {\n\t\t\tobj[ prop ] = undefined;\n\t\t\tcontinue;\n\t\t}\n\n\t\t// check if it has already a getter/setter - do nothing\n\t\tif( desc.get || desc.set ) continue;\n\n\t\tobj[ prop ] = target[ prop ];\n\t}\n\n\t// generate accessors for all props\n\tfor( let attr in obj ) {\n\n\t\t// create dynamic property\n\t\tObject.defineProperty( t, attr, {\n\t\t\tget() {\n\t\t\t\treturn obj[ attr ];\n\t\t\t},\n\t\t\tset( value ) {\n\t\t\t\tlet old = obj[ attr ];\n\t\t\t\tif( old !== value ) {\n\t\t\t\t\tobj[ attr ] = value;\n\t\t\t\t\tt.propertyChange.dispatch( { name:attr } );\n\t\t\t\t}\n\t\t\t},\n\t\t\tenumerable: true,\n\t\t\tconfigurable: true\n\t\t});\n\t}\n\n\treturn t;\n}\n\n\n\n\n/**\n * A guard that checks whether the specified object implements [[ArrayObserver]].\n *\n * @param obj The object that should be tested.\n */\nexport function isArrayObserver( obj:any ):obj is ArrayObserver {\n\treturn obj && obj[ 'arrayChange' ] instanceof Signal;\n}\n\n\n/**\n * Arrays that implement this interface observe changes on the array itself\n *\n */\nexport interface ArrayObserver {\n\n\t/**\n\t * Raised when the items of the array have changed.\n\t *\n\t * @event\n\t */\n\tarrayChange:Signal<{}>;\n}\n\n/**\n * Observes an array on changes\n */\nexport function observeArray( a:Array ):Array&ArrayObserver {\n\n\t// do not observe other than arrays\n\tif( !Array.isArray( a ) ) return;\n\n\tlet t = a as Array&ArrayObserver;\n\n\t// check if its already observed\n\tif( t.arrayChange ) return t;\n\n\tt.arrayChange = new Signal();\n\n\tfor (const method of [ 'push', 'pop', 'shift', 'unshift', 'splice', 'sort', 'reverse' ] ) {\n\t\tconst org = t[method];\n\t\t// overwrite function to inject signal notification\n\t\tt[method] = function ( ...args ) {\n\t\t\tconst res = org.apply( this, args );\n\t\t\tt.arrayChange.dispatch({});\n\t\t\treturn res;\n\t\t}\n\t}\n\n\treturn t;\n}\n","import { Expression } from \"./Expression\";\nimport { TemplateContext } from \"../Template\";\nimport { Observable, observable, Signal, Subscription } from \"../../Signal\";\nimport { compile } from \"../Compiler\";\n\n/**\n * Super class of expressions that will invoke a closure on observable dispatch.\n */\nexport class ClosureExpression extends Expression {\n\n\tsubscription: Subscription;\n\n\n\tconstructor( context:TemplateContext, expression:string ) {\n\t\tsuper( context );\n\t\tthis.expression = compile( expression, [ 'event','data' ] );\n\t}\n\n\tsubscribe( observable:Observable ) {\n\t\tthis.unsubscribe();\n\t\tthis.subscription = observable.subscribe( this.invoke.bind( this ) );\n\t}\n\n\tunsubscribe() {\n\t\tif( this.subscription ) this.subscription.unsubscribe();\n\t}\n\n\tinvoke( event ) {\n\t\tthis.expression.call( this.context, event, this.context.data );\n\t}\n\n\tdestroy() {\n\t\tthis.unsubscribe();\n\t}\n}\n\n\n/**\n * This class subscribes node events and invokes the corresponding closure like:
\n */\nexport class NodeEventExpression extends ClosureExpression {\n\n\tevent:string;\n\tnode:Node;\n\n\tconstructor( context:TemplateContext, expression:string, event:string, node:Node ) {\n\t\tsuper( context, expression );\n\t\tthis.event = event;\n\t\tthis.node = node;\n\n\t\tthis.updateSubscription();\n\t}\n\n\tupdateSubscription() {\n\t\tthis.subscribe( observable( this.event, this.node ) );\n\t}\n}\n\n\n\n","import { Expression } from \"./Expression\";\nimport { TemplateContext } from \"../Template\";\nimport { compile, getContent, replace } from \"../Compiler\";\nimport { isPropertyObserver, PropertyChanged, observeProperties, PropertyObserver, observeArray } from \"../../Observer\";\nimport { Subscription } from \"../../Signal\";\n\n/**\n * Super class of expression that will render something into to dom\n */\nexport abstract class RenderExpression extends Expression {\n\n\n\troot:ObjectSubscriber;\n\n\n\tconstructor( context:TemplateContext, expression:string ) {\n\t\tsuper( context );\n\t\tthis.expression = compile( expression, [ 'data' ] );\n\t\tthis.trace();\n\t\tthis.subscribe();\n\t}\n\n\n\t/**\n\t * updates the dom when the data changes\n\t */\n\tabstract update();\n\n\n\t/**\n\t * The inital render call is called to render the first time\n\t */\n\tinital() {\n\t\tthis.update();\n\t}\n\n\t/**\n\t * Implements subscribe to listen on changes of context data\n\t */\n\tsubscribe() {\n\t\tthis.root.subscribeTo( this.context.data );\n\t}\n\n\n\tdestroy() {\n\t\tthis.root.destroy();\n\t}\n\n\n\t/**\n\t * Traces the expression to collect property access\n\t */\n\ttrace() {\n\n\t\tthis.root = new ObjectSubscriber( this );\n\n\t\tvar trapper = {\n\t\t\thas: () => {\n\t\t\t\treturn true;\n\t\t\t},\n\t\t\tget:( t, key, p ) => {\n\n\t\t\t\tif( key == Symbol.unscopables ) return {};\n\t\t\t\tif( key == Symbol.toPrimitive ) return ( hint ) => {\n\t\t\t\t\tif( hint == 'number' ) return 1;\n\t\t\t\t\treturn '';\n\t\t\t\t};\n\n\t\t\t\t// check blacklisted global vars\n\t\t\t\t// *this* is the access on the this context in IE Edge Legacy\n\t\t\t\tif( [ 'JSON', 'Math', '*this*' ].indexOf( key ) >= 0 ) return;\n\n\t\t\t\t// handle data access\n\t\t\t\tif( key == 'data' && t == this.root ) return t;\n\n\n\t\t\t\t// create objectobserver for property if there is not already one.\n\t\t\t\tif( !t.properties.has( key ) ) {\n\t\t\t\t\tt.properties.set( key, new ObjectSubscriber( t.expression ) );\n\t\t\t\t}\n\n\t\t\t\treturn new Proxy( t.properties.get( key ), trapper );\n\t\t\t},\n\t\t}\n\n\n\t\tthis.expression.call( this.context, new Proxy( this.root, trapper ) );\n\t}\n\n\n\t/**\n\t * Helper function that returns the value of the expression\n\t */\n\tgetExpressionValue() {\n\t\treturn this.expression.call( this.context, this.context.data );\n\t}\n}\n\n\nconst booleanAttributes = {\n\t'checked': [\n\t\tHTMLInputElement,\n\t],\n\t'disabled': [\n\t\tHTMLButtonElement,\n\t\tHTMLFieldSetElement,\n\t\tHTMLInputElement,\n\t\tHTMLOptGroupElement,\n\t\tHTMLOptionElement,\n\t\tHTMLSelectElement,\n\t\tHTMLTextAreaElement,\n\t],\n\t'selected': [\n\t\tHTMLOptionElement,\n\t],\n\t'hidden': [\n\t\tElement,\n\t],\n\t'readonly': [\n\t\tHTMLInputElement,\n\t\tHTMLTextAreaElement,\n\t],\n\t'required': [\n\t\tHTMLInputElement,\n\t\tHTMLTextAreaElement,\n\t\tHTMLSelectElement,\n\t],\n};\n\n/**\n * This class monitors expression on node attributes like:
\n */\nexport class AttributeExpression extends RenderExpression {\n\n\tnode:Element;\n\tattribute:Attr;\n\tboolean:boolean;\n\n\tconstructor( node:Element, attribute:Attr, context:TemplateContext ) {\n\t\tsuper( context, attribute.value );\n\t\tthis.node = node;\n\t\tthis.attribute = attribute;\n\t\tthis.boolean = booleanAttributes[ attribute.name ]?.some( elementType => node instanceof elementType );\n\t}\n\n\tupdate() {\n\t\t// handle input value\n\t\tif( this.node instanceof HTMLInputElement || this.node instanceof HTMLTextAreaElement ) {\n\t\t\tif( this.attribute.name == 'value' ) {\n\t\t\t\tthis.node.value = this.getExpressionValue();\n\t\t\t}\n\t\t}\n\n\t\tif( this.boolean ) {\n\t\t\tif( this.getExpressionValue() ) {\n\t\t\t\tthis.node.setAttribute( this.attribute.name, 'true' );\n\t\t\t} else {\n\t\t\t\tthis.node.removeAttribute( this.attribute.name );\n\t\t\t}\n\t\t}\n\t\telse {\n\t\t\tthis.node.setAttribute( this.attribute.name, this.getExpressionValue() );\n\t\t}\n\t}\n}\n\n\n/**\n * This class monitors expression on node class attibute like:
\n * It supports the object syntax for classes: [[ { 'demo':true } ]]\n */\nexport class CSSExpression extends AttributeExpression {\n\n\texpressionString:string;\n\n\tconstructor( node:Element, attribute:Attr, context:TemplateContext ) {\n\t\tsuper( node, attribute, context );\n\t\tthis.expressionString = attribute.value;\n\t}\n\n\tgetExpressionValue() {\n\t\t// replace all parts of the template for exp. \"static [[ exp1 ]] demo [[ exp2 ]]\"\n\t\treturn replace( this.expressionString, ( match ) => {\n\t\t\tlet value = compile( match ).call( this.context, this.context.data );\n\n\t\t\t// if its an object handle\n\t\t\tif( value && typeof value == 'object' ) return Object.keys( value ).filter( key => value[key] ).join( ' ' );\n\n\t\t\treturn value;\n\t\t});\n\t}\n}\n\n\n\n/**\n * This class monitors expression on text nodes like:
[[ my expression ]]
\n */\nexport class TextExpression extends RenderExpression {\n\n\tnode:Node;\n\n\tconstructor( node:Node, context:TemplateContext ) {\n\t\tsuper( context, node.nodeValue );\n\t\tthis.node = node;\n\t}\n\n\tupdate() {\n\t\tthis.node.nodeValue = this.context.empty( this.getExpressionValue() );\n\t}\n}\n\n\n\n/**\n * A helper class to manage subscriptions on objects with a given set of properties\n */\nclass ObjectSubscriber {\n\n\tsubscription:Subscription;\n\tproperties:Map;\n\texpression:RenderExpression;\n\n\tconstructor( exp:RenderExpression ) {\n\t\tthis.properties = new Map();\n\t\tthis.expression = exp;\n\t}\n\n\n\tsubscribeTo( obj:any ) {\n\n\t\tthis.unsubscribe();\n\n\t\t// do not subscribe on undefined\n\t\tif( !obj ) return;\n\n\t\t// do not subscribe on anythinf else than object\n\t\tif( !( obj instanceof Object) ) return;\n\n\t\t// check if we have properties to listen\n\t\tif( !this.hasProperties() ) return;\n\n\t\t// subscribe on arrays\n\t\tif( Array.isArray( obj ) ) {\n\t\t\tthis.subscription = observeArray( obj ).arrayChange.subscribe( this.onArrayChange.bind( this ) );\n\n\t\t// subscribe to object\n\t\t} else {\n\t\t\t// observe properties of expression in given obj\n\t\t\tlet props =[ ...this.properties.keys() ];\n\t\t\tprops.unshift( obj );\n\t\t\tlet obs = observeProperties.apply( null, props ) as PropertyObserver;\n\n\t\t\t// subscribe to changes on obj\n\t\t\tthis.subscription = obs.propertyChange.subscribe( this.onObjectChange.bind( this ) );\n\t\t}\n\n\n\t\t// subscribe child properties\n\t\tthis.properties.forEach( ( value, key ) => {\n\t\t\tvalue.subscribeTo( obj[ key ] );\n\t\t});\n\t}\n\n\n\tunsubscribe() {\n\t\tif( this.subscription ) this.subscription.unsubscribe();\n\t\tthis.properties.forEach( ( value, key ) => {\n\t\t\tvalue.unsubscribe();\n\t\t});\n\t}\n\n\n\tonObjectChange( e:{ name:string } ) {\n\n\t\t// check if this expression has the changed property\n\t\tlet obj = this.properties.get( e.name );\n\t\tif( obj ) {\n\n\t\t\t// update expression content\n\t\t\tthis.expression.update();\n\n\t\t\t// if the changed propery has sub properties we need to resubscribe\n\t\t\tif( obj.hasProperties() ) this.expression.subscribe();\n\t\t}\n\t}\n\n\tonArrayChange( e ) {\n\t\t// update expression content\n\t\tthis.expression.update();\n\n\t\t// resubscribe if there is an access on array indices/properties = 0,1,...\n\t\tif( this.properties.size > 0 ) {\n\t\t\tthis.expression.subscribe();\n\t\t}\n\t}\n\n\n\thasProperties() {\n\t\treturn this.properties.size > 0;\n\t}\n\n\tdestroy() {\n\n\t\tthis.unsubscribe();\n\n\t\tfor (const child of this.properties.values() ) {\n\t\t\tchild.destroy();\n\t\t}\n\n\t\tthis.properties = new Map();\n\t}\n}\n","import { isScope } from '../../components/Scope';\nimport { isPropertyObserver, observeArray, observeProperties } from '../../Observer';\nimport { Observable, Signal, Subscription } from '../../Signal';\nimport { compile } from '../Compiler';\nimport { Template } from '../Template';\nimport { create, invokeInit, View } from '../View';\nimport { ClosureExpression, NodeEventExpression } from './ClosureExpression';\nimport { Expression, hasInital, snakeToCamel } from './Expression';\nimport { AttributeExpression, RenderExpression } from './RenderExpression';\n\n\n/**\n * This class monitors expression on the node view attribute like:
\n */\nexport class ViewExpression extends AttributeExpression {\n\n\texpressions: Expression[];\n\ttemplate: Template;\n\tview: View;\n\tmergers: Array;\n\trerenderCheck: RerenderCheck;\n\tinnerTemplates: Array<{ name:string, template:string, data:string }>;\n\n\tconstructor( node: Element, template: Template ) {\n\t\tsuper( node, node.attributes.getNamedItem( 'view' ), template.context );\n\t\tthis.template = template;\n\t\tthis.expressions = [];\n\t\tthis.mergers = [];\n\n\t\tthis.parseAttributes();\n\t\tthis.parseInnerTemplates();\n\n\t\tthis.rerenderCheck = new RerenderCheck( this );\n\t}\n\n\tinital() {\n\t\tthis.renderView();\n\t}\n\n\n\tupdate() {\n\t\t// flag rerendering\n\t\tthis.rerenderCheck.flag = true;\n\t}\n\n\trenderView() {\n\n\t\t// remove render checker\n\t\tthis.rerenderCheck.unsubscribe();\n\n\t\t// restore original attribute values from mergers\n\t\tfor( const merger of this.mergers ) {\n\t\t\tmerger.reset();\n\t\t}\n\t\t// delete old mergers\n\t\tthis.mergers = [];\n\n\t\t// destroy old view if there is any\n\t\tif( this.view ) this.view.destroy();\n\n\t\tlet viewName = this.getExpressionValue();\n\n\t\t// create view baed on its context\n\t\tthis.view = create( viewName, this.context );\n\n\t\t// stop rendering if there is no valid view\n\t\tif( !this.view ) return;\n\n\n\t\t// inital execute render expression so the view data is correctly set\n\t\tthis.expressions.forEach( expr => {\n\t\t\tif( hasInital( expr ) ) expr.inital();\n\t\t} );\n\n\t\t// check for scope view that need the inner content of this node\n\t\tif( isScope( this.view ) ) this.view.prepareContent( this.node, this.template );\n\n\t\t// register inner templates\n\t\tfor (const template of this.innerTemplates ) {\n\t\t\t// if there is a template expression for the data invoke it with this context.\n\t\t\tconst data = ( template.data ) ? compile( template.data, [ 'data' ] ).call( this.context, this.context.data ) : this.context.data;\n\t\t\tthis.view.registry.add( template.name, () => new View( { template:template.template, data } ) );\n\t\t}\n\n\t\t// render the view to merge it afterwards\n\t\tthis.view.template.render();\n\n\t\t// properly set the view attribute based on the registred key\n\t\tthis.node.setAttribute( 'view', this.getViewName( viewName ) );\n\n\t\t// define what attributes should merge from outside/inside\n\t\tthis.mergeNodes();\n\n\n\t\t// subscribe on data events after render\n\t\tthis.expressions.forEach( expr => {\n\t\t\tif( expr instanceof DataEventExpression ) expr.updateSubscription();\n\t\t} );\n\n\t\t// make sure rerender check is last\n\t\tthis.rerenderCheck.subscribe();\n\n\t\t// call init after node is correctly set\n\t\tinvokeInit( this.view );\n\t}\n\n\n\n\n\t/**\n\t * Parses node attributes of this view node\n\t */\n\tparseAttributes() {\n\n\t\tlet attrs = Array.prototype.slice.call( this.node.attributes );\n\n\t\tfor( const attr of attrs ) {\n\n\n\t\t\t// check on data expression\n\t\t\tif( attr.name == 'data' ) {\n\t\t\t\tlet dataExpr = new DataExpression( this, attr.value );\n\t\t\t\tthis.node.removeAttribute( attr.name );\n\t\t\t\tthis.expressions.unshift( dataExpr ); // make sure data is set first\n\t\t\t}\n\n\t\t\t// check on data attribite expression\n\t\t\tif( attr.name.indexOf( 'data-' ) == 0 ) {\n\t\t\t\tlet expr = new DataAttributeExpression( this, attr.value, snakeToCamel( attr.name.substring( 5 ) ) );\n\t\t\t\tthis.node.removeAttribute( attr.name );\n\t\t\t\tthis.expressions.push( expr );\n\t\t\t}\n\n\t\t\t// handle propertyChanged events\n\t\t\tif( attr.name.indexOf( 'on-data-' ) == 0 ) {\n\t\t\t\tlet event = snakeToCamel( attr.name.replace( 'on-data-', '' ) );\n\t\t\t\tlet eventExpression = new AttributeEventExpression( this, attr.value, event );\n\t\t\t\tthis.node.removeAttribute( attr.name );\n\t\t\t\tthis.expressions.push( eventExpression );\n\t\t\t}\n\n\t\t\t// handle custom signal events\n\t\t\tif( attr.name.indexOf( 'on-' ) == 0 ) {\n\t\t\t\tlet event = snakeToCamel( attr.name.replace( 'on-', '' ) );\n\t\t\t\tlet expr = new SignalEventExpression( this, attr.value, event );\n\t\t\t\tthis.node.removeAttribute( attr.name );\n\t\t\t\tthis.expressions.push( expr );\n\t\t\t}\n\n\t\t}\n\t}\n\n\n\tparseInnerTemplates( ) {\n\t\tconst templateNodes = this.node.querySelectorAll( 'template' );\n\t\tthis.innerTemplates = Array.from( templateNodes ).map( node => {\n\t\t\treturn {\n\t\t\t\tname: node.getAttribute( 'name' ),\n\t\t\t\ttemplate: node.innerHTML,\n\t\t\t\tdata: node.getAttribute( 'data' )\n\t\t\t}\n\t\t});\n\t}\n\n\n\tdestroy() {\n\t\tif( this.view ) this.view.destroy();\n\t\tfor( const exp of this.expressions ) {\n\t\t\texp.destroy();\n\t\t}\n\t\tthis.rerenderCheck.unsubscribe();\n\t}\n\n\n\n\t/**\n\t * Merges inner view node with the other view node.\n\t */\n\tmergeNodes() {\n\n\t\t// get all attributes from outside and inside and make them unique\n\t\tlet attributes = Array.prototype.slice.call( this.node.attributes ).concat( Array.prototype.slice.call( this.view.node.attributes ) ).map( attr => attr.name );\n\t\tattributes = attributes.filter( ( item, i ) => attributes.indexOf( item ) === i );\n\n\t\t// merge each attribute\n\t\tattributes.forEach( attr => {\n\n\t\t\tlet merger = new AttributeMerger( this.node, attr );\n\t\t\tmerger.setupInner( this.view.template );\n\t\t\tmerger.setupOuter( this.template );\n\t\t\tmerger.update();\n\n\t\t\tthis.mergers.push( merger );\n\t\t} );\n\n\t\t// empty target node\n\t\tthis.node.innerHTML = '';\n\n\t\t// copy children\n\t\twhile( this.view.node.hasChildNodes() ) {\n\t\t\tthis.node.appendChild( this.view.node.firstChild );\n\t\t}\n\n\n\t\t// adjust event expressions to new node\n\t\tlet eventExpressions = this.view.template.filterExpressions( expr => expr instanceof NodeEventExpression && expr.node == this.view.node ) as NodeEventExpression[];\n\t\teventExpressions.forEach( expr => {\n\t\t\texpr.node = this.node;\n\t\t\texpr.updateSubscription(); // will reregister on new target\n\t\t} );\n\n\t\t// properly setup node refenrence\n\t\tthis.view.template.node = this.node;\n\n\t}\n\n\n\tgetViewName( key: any ) {\n\t\tif( typeof key == 'string' ) return key;\n\t\tif( typeof key == 'function' ) return key.toString().match( /function\\s(.*?)\\(/ )[ 1 ];\n\t\tif( typeof key == 'object' && key !== null ) {\n\t\t\t// match es6 class\n\t\t\tlet m = key.constructor.toString().match( /class\\s(.*?)\\s/ );\n\t\t\tif( m ) return m[ 1 ];\n\t\t\t// match es5 class\n\t\t\tm = key.constructor.toString().match( /function\\s(.*?)\\(/ );\n\t\t\tif( m ) return m[ 1 ];\n\t\t}\n\t\treturn '';\n\t}\n\n}\n\n\n/**\n * This class monitors expression on data attributes like:
\n */\nclass DataAttributeExpression extends RenderExpression {\n\n\tattribute: string;\n\tviewExpression: ViewExpression;\n\n\tconstructor( viewExpression: ViewExpression, expression: string, attribute: string ) {\n\t\tsuper( viewExpression.context, expression );\n\t\tthis.attribute = attribute;\n\t\tthis.viewExpression = viewExpression;\n\t}\n\n\tupdate() {\n\t\tthis.viewExpression.view.data[ this.attribute ] = this.getExpressionValue();\n\t}\n}\n\n/**\n * This class monitors expression on data the attributes like:
\n */\nclass DataExpression extends RenderExpression {\n\n\tviewExpression: ViewExpression;\n\n\tconstructor( viewExpression: ViewExpression, templateString: string ) {\n\t\tsuper( viewExpression.context, templateString );\n\t\tthis.viewExpression = viewExpression;\n\t}\n\n\tinital() {\n\t\tthis.viewExpression.view.data = this.getExpressionValue();\n\t}\n\n\tupdate() {\n\t\t// flag rerendering\n\t\tthis.viewExpression.rerenderCheck.flag = true;\n\t}\n}\n\n\n\n\n/**\n * Super\n */\nclass DataEventExpression extends ClosureExpression {\n\n\tviewExpression: ViewExpression;\n\n\tconstructor( viewExpression: ViewExpression, expression: string ) {\n\t\tsuper( viewExpression.context, expression );\n\t\tthis.viewExpression = viewExpression;\n\t}\n\n\tupdateSubscription() {\n\n\t}\n}\n/**\n * This class monitors expression of data events like:
\n */\nclass AttributeEventExpression extends DataEventExpression {\n\n\tattribute: string;\n\tarraySubscription:Subscription;\n\n\tconstructor( viewExpression: ViewExpression, expression: string, attribute: string ) {\n\t\tsuper( viewExpression, expression );\n\t\tthis.attribute = attribute;\n\t}\n\n\tupdateSubscription() {\n\n\t\tlet data = this.viewExpression.view.data as any;\n\n\t\t// register on view data\n\t\tlet d = observeProperties( data, this.attribute );\n\t\tthis.subscribe( d.propertyChange.filter( e => e.name == this.attribute ) );\n\n\t\t// register on array changes if its an array attribute\n\t\tlet value = data[ this.attribute ];\n\t\tif( Array.isArray( value ) ) this.subscribeArray( observeArray( value ).arrayChange );\n\n\t\t// inital invoke to adjust values outside\n\t\tthis.invoke();\n\t}\n\n\tinvoke() {\n\t\tsuper.invoke( { name: this.attribute, value: this.viewExpression.view.data[ this.attribute ] } );\n\t}\n\n\tsubscribeArray( observable:Observable ) {\n\t\tthis.unsubscribeArray();\n\t\tthis.arraySubscription = observable.subscribe( this.invoke.bind( this ) );\n\t}\n\n\tunsubscribeArray() {\n\t\tif( this.arraySubscription ) this.subscription.unsubscribe();\n\t}\n\n\tdestroy() {\n\t\tsuper.destroy();\n\t\tthis.unsubscribeArray();\n\t}\n}\n\n/**\n * This class subscribes model signals and invokes the corresponding closure like:
\n */\nclass SignalEventExpression extends DataEventExpression {\n\n\tsignalName: string;\n\n\tconstructor( viewExpression: ViewExpression, expression: string, signalName: string ) {\n\t\tsuper( viewExpression, expression );\n\t\tthis.signalName = signalName;\n\t}\n\n\tupdateSubscription() {\n\n\t\t// check for valid signal and subscribe\n\t\tlet signal = this.viewExpression.view.data[ this.signalName ];\n\t\tif( signal instanceof Signal ) {\n\t\t\tthis.subscribe( signal );\n\t\t}\n\t}\n}\n\n\nclass AttributeMerger {\n\n\tnode: Element;\n\tattr: string;\n\tinner: AttributeExpression;\n\touter: AttributeExpression;\n\n\tconstructor( node: Element, attr: string ) {\n\t\tthis.node = node;\n\t\tthis.attr = attr;\n\t}\n\n\tsetupInner( template: Template ) {\n\t\tthis.inner = template.filterExpressions( expr => expr instanceof AttributeExpression && expr.node == template.node && expr.attribute.name == this.attr )[ 0 ] as AttributeExpression;\n\t\tif( this.inner && !( this.inner instanceof ViewExpression ) ) {\n\t\t\t// use merge function to update\n\t\t\tthis.inner.update = this.update.bind( this );\n\t\t} else {\n\t\t\t// create dummy expression for later use\n\t\t\tthis.inner = new AttributeExpression( template.node, this.getAttrOf( template.node ), template.context );\n\t\t}\n\t}\n\n\tsetupOuter( template: Template ) {\n\t\tthis.outer = template.filterExpressions( expr => expr instanceof AttributeExpression && expr.node == this.node && expr.attribute.name == this.attr )[ 0 ] as AttributeExpression;\n\t\tif( this.outer && !( this.outer instanceof ViewExpression ) ) {\n\t\t\tthis.outer.update = this.update.bind( this );\n\t\t} else {\n\t\t\tthis.outer = new AttributeExpression( this.node, this.getAttrOf( this.node ), template.context );\n\t\t}\n\t}\n\n\n\tupdate() {\n\n\t\tlet outerContent = this.outer.getExpressionValue();\n\t\tlet innerContent = this.inner.getExpressionValue();\n\n\t\t// handle class attribute to join inner & outer classes\n\t\tif( this.attr == 'class' ) {\n\n\t\t\tlet classes = ( outerContent + ' ' + innerContent ).split( ' ' ).filter( c => c.length > 0 );\n\t\t\tlet list = this.node.classList;\n\n\t\t\tthis.node.setAttribute( 'class', '' ); // reset\n\t\t\tlist.add.apply( list, classes );\n\n\t\t\t// handle all regular attributes where inner wins\n\t\t} else {\n\t\t\tthis.node.setAttribute( this.attr, innerContent ? innerContent : outerContent );\n\t\t}\n\t}\n\n\tgetAttrOf( node: Element ) {\n\t\tlet attr = node.attributes[ this.attr ];\n\t\tif( !attr ) attr = { name: this.attr, value: '' };\n\t\treturn attr;\n\t}\n\n\treset() {\n\t\tthis.node.setAttribute( this.attr, this.outer.getExpressionValue() );\n\t}\n\n}\n\n\n\nclass RerenderCheck {\n\n\tsubscription: Subscription;\n\tflag: boolean = false;\n\tviewExpression: ViewExpression;\n\n\tconstructor( viewExpression: ViewExpression ) {\n\t\tthis.viewExpression = viewExpression;\n\t}\n\n\tupdate() {\n\t\tif( this.flag ) this.viewExpression.renderView();\n\t\tthis.flag = false;\n\t}\n\n\tsubscribe() {\n const data = this.viewExpression.context.data;\n this.subscription = isPropertyObserver( data ) ? data.propertyChange.subscribe( this.update.bind( this ) ) : null;\n\t}\n\n\tunsubscribe() {\n\t\tthis.subscription?.unsubscribe();\n\t}\n}\n","import { Registry } from '../Registry';\nimport { Template, TemplateContext } from './Template';\n\n\n\n\nexport interface ViewConfig {\n\tdata?:TData,\n\ttemplate?:string|Element,\n\tregistry?:ViewRegistry,\n}\n\n\n/**\n * A common view class that has a container to render content/template into.\n */\nexport class View {\n\n\tprivate _template:Template;\n\n\tconstructor( config:ViewConfig = {} ) {\n\n\t\tthis._template = new Template( config.template );\n\n\t\tif( config.registry ) this._template.context.registry = config.registry;\n\t\tif( config.data ) this._template.context.data = config.data;\n\n\t\tthis._template.context.view = this;\n\t}\n\n\n\t/**\n\t * Renders the view template.\n\t * If an empty target is given, the template is rendered into to given target.\n\t * If the target is not empty, the content of the target is used as the template.\n\t */\n\tpublic render() {\n\n\t\t// do rendering of template\n\t\tthis._template.render();\n\n\t\t// everything is ready now we can invoke view's init\n\t\tinvokeInit( this );\n\t}\n\n\t/**\n\t * The init function is automatically called after the render function.\n\t * So everything is rendered and the node is ready to be used.\n\t * Overwrite the init function for custom dom manipulations.\n\t */\n\tpublic init() {\n\n\t}\n\n\t/**\n\t * Destroys properly the view\n\t */\n\tdestroy() {\n\t\tthis._template.destroy();\n\t\tinvokeDeinit( this );\n\t}\n\n\t/**\n\t * The deinit function is automatically called after the view is destroyed.\n\t * Use it to unsubscribe signals etc\n\t */\n\tpublic deinit() {\n\n\t}\n\n\n\t/**\n\t * Returns the root node of the view\n\t */\n\tget node():Element {\n\t\treturn this._template.node;\n\t}\n\n\tget data():TData {\n\t\treturn this._template.context.data as TData;\n\t}\n\tset data( d:TData ) {\n\t\tthis._template.context.data = d;\n\t}\n\n\tget context() {\n\t\treturn this._template.context;\n\t}\n\tget registry() {\n\t\treturn this._template.context.registry;\n\t}\n\tget template() {\n\t\treturn this._template;\n\t}\n}\n\n\n/**\n * A registry to lookup views\n */\nexport class ViewRegistry extends Registry {}\n\n\n/**\n * A factory function that creates a view based on the given key to lookup and its context\n */\nexport function create( key:any, context:TemplateContext ) {\n\n\t/**\n\t * Lookups the viewName in the template context registry.\n\t * Furthermore it lookups in all parent template contexts\n\t */\n\tfunction lookup( key:any, context:TemplateContext ) {\n\n\t\twhile( context ) {\n\t\t\tlet found = context.registry.get( key );\n\t\t\tif( found ) return found;\n\t\t\tcontext = context.parent;\n\t\t}\n\n\t\treturn null;\n\t}\n\n\tlet factory = lookup( key, context );\n\n\t// no view found with name\n\tif( !factory ) throw new Error( \"No registered view found with name: \" + key );\n\n\tlet view = factory( key );\n\n\t/// inject parent template in context\n\tview.template.extendContext( context );\n\n\treturn view;\n}\n\n\n/**\n * Internal helper function that executes init functions on view & data\n */\nexport function invokeInit( v:View ) {\n\tif( v.data && typeof v.data[ 'init' ] == 'function' ) v.data.init();\n\tv.init();\n}\n\n/**\n * Internal helper function that executes init functions on view & data\n */\nexport function invokeDeinit( v:View ) {\n\tif( v.data && typeof v.data[ 'deinit' ] == 'function' ) v.data.deinit();\n\tv.deinit();\n}\n","import { Template } from \"../view/Template\";\n\nexport interface Scope {\n\tprepareContent( node:Element, template:Template );\n}\n\n/**\n * A guard that checks whether the specified object is a [[Scope]].\n *\n * @param obj The object that should be tested.\n */\nexport function isScope( obj:any ):obj is Scope {\n\treturn obj && obj[ 'prepareContent' ];\n}\n\n","import { compile } from './view/Compiler';\nimport { context } from './view/Template';\n\nvar _source = {};\n\nexport function source( obj:{} ) {\n\t_source = obj;\n};\n\n/**\n * translates the given key.\n */\nexport function translate( key:string, opts:{ data?:any, condition?:number } = {} ):any {\n\tif( key == undefined ) return '';\n\n\tvar def = lookup( key );\n\tif( opts.condition != undefined ) def = matchCondition( def, opts.condition );\n\tif( opts.data ) def = compile( def ).call( context, opts.data );\n\n\treturn def;\n}\n\nfunction matchCondition( value:string, num:number ) {\n\n\tvar parts = value.split( '|' );\n\n\t// check conditions\n\tvar found = parseConditions( parts, num )\n\tif( found ) return found.trim();\n\n\tif( parts.length == 1 ) return clearConditions( parts[0] );\n\n\t// check simple | split\n\treturn clearConditions( parts[ ( num == 1 ) ? 0 : 1 ] );\n}\n\n\nfunction parseConditions( parts, number:number ):string {\n\t// loop over parts\n\tfor( var i = 0; i < parts.length; i++ ) {\n\t\tvar regex = /^[\\{\\[]([^\\[\\]\\{\\}]*)[\\}\\]](.*)/;\n\t\tvar match = regex.exec( parts[i] );\n\n\t\t// no proper condition\n\t\tif( match == null || match.length != 3 ) continue;\n\n\t\tvar value = match[2];\n\t\tvar condition = match[1];\n\t\tvar num = number;\n\n\t\t// range condition\n\t\tif( condition.indexOf( ',' ) > -1 ) {\n\n\t\t\tvar [ from , to ] = condition.split( ',' );\n\n\t\t\tif ( to == '*' && num >= parseInt( from ) ) {\n\t\t\t\treturn value;\n\t\t\t} else if ( from == '*' && num <= parseInt( to ) ) {\n\t\t\t\treturn value;\n\t\t\t} else if ( num >= parseInt( from ) && num <= parseInt( to ) ) {\n\t\t\t\treturn value;\n\t\t\t}\n\n\t\t// exact condition\n\t\t} else if( parseInt( condition ) == num ) {\n\t\t\treturn value;\n\t\t}\n\t}\n}\n\nfunction clearConditions( s:string ):string {\n\treturn s.replace( /^[\\{\\[]([^\\[\\]\\{\\}]*)[\\}\\]]/, '' ).trim();\n}\n\nfunction lookup( key:string ) {\n\n\t// translate `x.y` to `data[\"x\"][\"y\"]` which is safe even when special chars are present:\n\tlet template = '[[ data' + key.split( '.' ).map( k => '[\"' + k + '\"]' ).join( '' ) + ' ]]';\n\n\t// lookup property / string in source\n\tlet result = compile( template ).call( context, _source );\n\n\t// return result only if its a valid string otherwise return key\n\treturn ( typeof result == 'string' ) ? result : key;\n}\n","import { source } from './Lang';\nimport { map, ModelRegistry } from './Model';\nimport { HttpRequest } from './Request';\nimport { compile, empty, log } from './view/Compiler';\n\n\nexport interface SetupConfig {\n\troutes?:{ [key:string]:{ url:string, method?:string, headers?:{ [key:string]:string } } },\n\tdata?:{ [key:string]:{} },\n\tassets?:{ [key:string]:{ url:string, type?:'js'|'css' } },\n\tlang?:{},\n}\n\nvar config:SetupConfig;\n\nexport function setup( c:SetupConfig, registry?:ModelRegistry ) {\n\tconfig = c;\n\n\t// setup lang translations\n\tif( config.lang ) source( config.lang );\n\n\t// map data if there is data and a registry\n\tif( config.data && registry ) {\n\t\tconfig.data = map( config.data, registry );\n\t}\n}\n\nexport function data( key:string ):any {\n\treturn lookup( key, config.data );\n}\n\nexport function asset( key ):Asset {\n\treturn new Asset( lookup( key, config.assets ) );\n}\n\n\nexport function route( key:string, urlParams:{} = {} ):HttpRequest {\n\tlet c = lookup( key, config.routes );\n\n\tif( !c ) throw new Error( \"Route: '\" + key + \"' could not be found in setup routes.\" );\n\n\tlet url = compile( c.url ).call( { empty:empty, log:log }, urlParams );\n\tlet request = new HttpRequest( url );\n\n\tif( c.method ) request.method( c.method );\n\tif( c.headers ) request.headers( c.headers );\n\n\treturn request;\n}\n\nfunction lookup( key:string, data:any ) {\n\treturn compile( '[[ ' + key + ' ]]' ).call( { empty:empty, log:log }, data );\n}\n\n\n\ninterface AssetConfig {\n\turl: string,\n\ttype?: \"js\" | \"css\",\n}\n\n\n\nclass Asset {\n\n\t// store which assets are already loaded.\n\tstatic promises:{ [index:string]: Promise } = {};\n\n\tconfig:AssetConfig;\n\n\n\tconstructor( config:AssetConfig ) {\n\t\tif( !config.type ) config.type = this.guessType( config.url );\n\t\tthis.config = config;\n\t}\n\n\n\tload():Promise {\n\n\t\t// if not loaded create promise\n\t\tif( !Asset.promises[ this.config.url ] ) {\n\t\t\t( this.config.type == \"js\" ) ? this.loadScript() : this.loadCSS();\n\t\t}\n\n\t\treturn Asset.promises[ this.config.url ];\n\t}\n\n\t/**\n\t * Loads a js file into dom\n\t */\n\tprivate loadScript() {\n\n\t\tvar url = this.config.url;\n\n\t\tAsset.promises[ url ] = new Promise( ( resolve, reject ) => {\n\t\t\tvar element = document.createElement( 'script' );\n\t\t\telement.src = url;\n\t\t\telement.addEventListener( 'load', event => resolve() );\n\t\t\telement.addEventListener( 'error', event => reject() );\n\t\t\tdocument.body.appendChild( element );\n\t\t}).then( event => {\n\t\t\tthis.finalize( url );\n\t\t});\n\t}\n\n\t/**\n\t * Loads a css file into the dom\n\t */\n\tprivate loadCSS() {\n\n\t\tvar url = this.config.url;\n\n\t\tAsset.promises[ url ] = new Promise( ( resolve, reject ) => {\n\t\t\tvar element = document.createElement( 'link' );\n\t\t\telement.type = 'text/css';\n\t\t\telement.rel = 'stylesheet';\n\t\t\telement.href = url;\n\t\t\telement.addEventListener( 'load', event => resolve() );\n\t\t\telement.addEventListener( 'error', event => reject() );\n\t\t\tdocument.head.appendChild( element );\n\t\t}).then( event => {\n\t\t\tthis.finalize( url );\n\t\t});\n\t}\n\n\tprivate finalize( url:string ) {\n\t\tAsset.promises[ url ] = new Promise( ( resolve, reject ) => resolve() );\n\t}\n\n\t/**\n\t * Guesses the type based on the given url\n\t */\n\tprivate guessType( url:string ):\"js\"|\"css\" {\n\t\treturn ( url.split('.').pop() == \"js\" ) ? 'js' : 'css';\n\t}\n}\n\n","import { Signal } from './Signal';\nimport { Registry } from './Registry';\nimport { PropertyObserver, PropertyChanged, observeProperties } from './Observer';\n\n\n\n\n/**\n * A common model class that has getters and setters\n */\nexport class Model implements PropertyObserver {\n\n\t/**\n\t * Raised when a property's value has changed.\n\t *\n\t * @event\n\t */\n\tpublic propertyChange:Signal;\n\n\n\tconstructor( dto?:object ) {\n\t\tif( dto ) {\n\t\t\tObject.assign( this, dto );\n\t\t\tobserveProperties( this );\n\t\t}\n\t}\n}\n\n\n\n\n\n\n\n/**\n * A registry for modelName to Model class mappings\n */\nexport class ModelRegistry extends Registry {}\n\n/**\n * This helper function maps objects in the given data on registered models\n * @param data The data structure to map models\n * @param registry The registry to lookup model defintions\n * @param property the object property to lookup keys\n */\nexport function map( data:any, registry:ModelRegistry, lookup?:( obj:object ) => string ) {\n\n\tif( !lookup ) lookup = ( obj:any ) => obj.modelName || 'default';\n\n\t// handle arrays\n\tif( Array.isArray( data ) ) {\n\t\tdata = data.map( item => map( item, registry, lookup ) );\n\t}\n\n\t// handle objects\n\tif( data && data.constructor == Object ) {\n\n\t\tlet factory = registry.get( lookup( data ) );\n\n\t\tObject.keys( data ).forEach( name => {\n\t\t\tdata[ name ] = map( data[ name ], registry, lookup );\n\t\t});\n\n\t\treturn ( factory ) ? factory( data ) : data;\n\t}\n\n\treturn data;\n}\n","import { Signal } from \"./Signal\";\n\n\ninterface ProgressSignal {\n\tloaded: number,\n\ttotal: number\n}\n\n/**\n * HttpRequest Class\n */\n\nexport class HttpRequest {\n\n\tprotected _method: string = 'GET';\n\tprotected _url: string;\n\tprotected _headers: { [key: string]: string } = {};\n\tprotected request: XMLHttpRequest;\n\n\t/** @event */\n\tpublic progress: Signal = new Signal();\n\n\n\t/**\n\t * Create a new instance with the given url\n\t * @param url\n\t */\n\tconstructor(url: string) {\n\t\tthis._url = url;\n\n\t\tthis.request = new XMLHttpRequest();\n\t\tthis.request.onprogress = (event) => {\n\t\t\tthis.progress.dispatch(event);\n\t\t}\n\t}\n\n\t/**\n\t * Set the method for the request\n\t * @param method\n\t */\n\tpublic method(method: string): HttpRequest {\n\t\tthis._method = method;\n\t\treturn this;\n\t}\n\n\t/**\n\t * Set the headers for the request\n\t * @param headers\n\t */\n\tpublic headers(headers: {}): HttpRequest {\n\t\tthis._headers = headers;\n\t\treturn this\n\t}\n\n\t/**\n\t * Send/Load the request without sending data\n\t */\n\tpublic load(): Promise {\n\t\treturn this.sendRequest().then(this.parseJson);\n\t}\n\n\t/**\n\t * Send the request with the given data\n\t * @param data\n\t */\n\tpublic send(data: any): Promise {\n\t\treturn this.sendRequest(data).then(this.parseJson);\n\t}\n\n\t/**\n\t * Returns the full url of the request\n\t * @returns The url of the request\n\t */\n\tpublic url(): string {\n\t\treturn this._url;\n\t}\n\n\t/**\n\t * Creates a json api request to a specific subpath.\n\t * It presets the method to POST and the headers to application/json.\n\t * It further sends the given data as json body.\n\t * @param path The relative path for the json api request\n\t * @param data The data for the json api requests\n\t */\n\tpublic jsonApi(path: string, data: object = {}): Promise {\n\t\tlet fullPath = (this._url.endsWith('/') ? this._url.slice(0, -1) : this._url) + (path.startsWith('/') ? path : '/' + path);\n\t\tlet sub = new HttpRequest(fullPath);\n\t\tsub.headers({ 'Accept': 'application/json', 'Content-Type': 'application/json', ...this._headers });\n\t\tsub.method('POST');\n\t\treturn sub.send(JSON.stringify(data)).then((reponse: { data?: object, errors?: Array; }) => {\n\t\t\tif (reponse.data) return reponse.data as unknown as Response;\n\t\t\tif (reponse.errors) {\n\t\t\t\t// TODO: Better handling of errors\n\t\t\t\tRequest.error.dispatch({ error: reponse.errors.join(',') });\n\t\t\t}\n\t\t});\n\t}\n\n\t/**\n\t * Open and send the request with the given parameters\n\t * and data\n\t * @param data\n\t */\n\tprivate sendRequest(data: any = null): Promise {\n\n\t\tvar request = this.request;\n\t\tvar promise = this.promise(request);\n\n\t\trequest.open(this._method, this._url);\n\n\t\tObject.keys(this._headers).forEach(key => {\n\t\t\trequest.setRequestHeader(key, this._headers[key]);\n\t\t});\n\n\t\trequest.send(data);\n\n\t\treturn promise;\n\t}\n\n\t/**\n\t * Create a promise with the request\n\t * The promise resolves in case of a successful request - jejects otherwise\n\t */\n\tprivate promise(request: XMLHttpRequest) {\n\t\treturn new Promise((resolve, reject) => {\n\n\t\t\tvar errorHandler = function () {\n\t\t\t\tRequest.error.dispatch({ error: request.statusText });\n\t\t\t\treject(Error(request.statusText));\n\t\t\t}\n\n\t\t\trequest.onload = function () {\n\t\t\t\tif (request.status >= 200 && request.status < 300) {\n\t\t\t\t\tresolve(request.responseText);\n\t\t\t\t} else {\n\t\t\t\t\terrorHandler();\n\t\t\t\t}\n\t\t\t};\n\n\t\t\trequest.onerror = errorHandler;\n\t\t});\n\t}\n\n\t/**\n\t * tries to parse response otherwise returns original string data\n\t */\n\tprivate parseJson(data: string): string | {} {\n\t\ttry {\n\t\t\tdata = JSON.parse(data)\n\t\t\treturn data;\n\t\t} catch (e) {\n\t\t\treturn data;\n\t\t}\n\t}\n}\n\ninterface ErrorSignal {\n\terror: string\n}\n\n/**\n * Static Request Class\n */\nexport class Request {\n\n\t/** @event */\n\tpublic static error: Signal = new Signal();\n\t/**\n\t * Creates a new post HttpRequest\n\t */\n\tpublic static post(url: string): HttpRequest {\n\t\treturn new HttpRequest(url).method('POST');\n\t}\n\n\t/**\n\t * Creates a new get HttpRequest\n\t */\n\tpublic static get(url: string): HttpRequest {\n\t\treturn new HttpRequest(url).method('GET');\n\t}\n\n\t/**\n\t * Creates a new put HttpRequest\n\t */\n\tpublic static put(url: string): HttpRequest {\n\t\treturn new HttpRequest(url).method('PUT');\n\t}\n\n\t/**\n\t * Creates a new delete HttpRequest\n\t */\n\tpublic static delete(url: string): HttpRequest {\n\t\treturn new HttpRequest(url).method('DELETE');\n\t}\n}\n","import { Subscription, observable } from '../Signal';\nimport { empty, hasExpression, log, debug } from './Compiler';\nimport { Expression, snakeToCamel } from './expressions/Expression';\nimport { ViewExpression } from './expressions/ViewExpression';\nimport { ViewRegistry } from './View';\nimport { translate } from '../Lang';\nimport { data, route, asset } from '../Setup';\nimport { isPropertyObserver } from '../Observer';\nimport { RenderExpression, TextExpression, CSSExpression, AttributeExpression } from './expressions/RenderExpression';\nimport { NodeEventExpression } from './expressions/ClosureExpression';\n\n\nexport interface TemplateContext {\n\tregistry:ViewRegistry,\n\tdata: {},\n\t[x: string]: any\n}\n\n\nexport class Template {\n\n\tpublic node:Element;\n\tpublic context:TemplateContext;\n\tpublic expressions:Array = [];\n\tpublic content:string|Element;\n\n\tprivate dataSubscription:Subscription;\n\n\tconstructor( content:string|Element ) {\n\t\tthis.content = content;\n\t\tthis.context = {\n\t\t\tdata: {},\n\t\t\tregistry: new ViewRegistry(),\n\t\t}\n\n\t\tObject.setPrototypeOf( this.context, context );\n\t}\n\n\trender() {\n\n\t\tthis.node = ( this.content instanceof Element ) ? this.content : createNode( this.content );\n\n\t\t// inject template reference\n\t\tthis.node['template'] = this;\n\n\t\t// recusive search for expression\n\t\tthis.traverse();\n\n\t\t// initial render\n\t\tthis.expressions.forEach( expr => {\n\t\t\tif( expr instanceof RenderExpression ) expr.inital();\n\t\t})\n\t}\n\n\ttraverse() {\n\n\t\t// handle children\n\t\tlet treeWalker = document.createTreeWalker( this.node, NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_TEXT, null, false );\n\n\t\tlet current:Node = this.node;\n\n\t\twhile( current ) {\n\t\t\tthis.processNode( current as Element|Text );\n\n\t\t\t// dont dig into view nodes\n\t\t\tif( current instanceof Element && current.getAttribute( 'view' ) ) {\n\t\t\t\tcurrent = treeWalker.nextSibling();\n\t\t\t\t// there is no sibling if it is the last child - goto ancestor's sibling\n\t\t\t\tif( !current ) {\n\t\t\t\t\twhile( treeWalker.parentNode() ) {\n\t\t\t\t\t\tif( current = treeWalker.nextSibling() ) break;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tcurrent = treeWalker.nextNode();\n\t\t}\n\t}\n\n\tprocessNode( node:Element|Text ) {\n\n\t\t// check on text node\n\t\tif( node instanceof Text ) {\n\n\t\t\t// only if there is an expression\n\t\t\tif( hasExpression( node.nodeValue ) ) {\n\t\t\t\tthis.expressions.push( new TextExpression( node, this.context ) );\n\t\t\t}\n\n\t\t\treturn;\n\t\t}\n\n\t\t// handle <.. view=\"...\"> nodes\n\t\tif( node.getAttribute( 'view' ) ) {\n\t\t\tthis.processAttributes( node );\n\n\t\t\tlet expr = new ViewExpression( node, this );\n\t\t\tthis.expressions.push( expr );\n\n\t\t\treturn;\n\t\t}\n\n\t\t// handle events and attribute expressions\n\t\tthis.processAttributes( node );\n\t}\n\n\n\n\tprocessAttributes( node:Element ) {\n\n\t\tArray.prototype.slice.call( node.attributes ).forEach( ( attr:Attr ) => {\n\n\t\t\t// do not create expressions for view= and data-..= attributes\n\t\t\tif( attr.name.indexOf( 'data' ) >= 0 || attr.name == 'view' ) return;\n\n\t\t\t// handle node events\n\t\t\tif( attr.name.indexOf( 'on-' ) == 0 ) {\n\t\t\t\tlet event = snakeToCamel( attr.name.replace( 'on-', '' ) );\n\n\t\t\t\t// check if its a native node event - check on \"on..\" property like \"onclick\"\n\t\t\t\tif( node[ 'on' + event ] !== undefined ) {\n\t\t\t\t\tlet expr = new NodeEventExpression( this.context, attr.value, event, node );\n\t\t\t\t\tthis.expressions.push( expr );\n\t\t\t\t\tnode.removeAttribute( attr.name );\n\t\t\t\t}\n\n\t\t\t// handle attribute expressions & ignore view data attributes & ignore\n\t\t\t} else if( hasExpression( attr.value ) ) {\n\t\t\t\tlet kind = ( attr.name == \"class\" ) ? CSSExpression : AttributeExpression;\n\t\t\t\tlet expr = new kind( node, attr, this.context );\n\t\t\t\tthis.expressions.push( expr );\n\t\t\t}\n\t\t});\n\t}\n\n\n\n\tdestroy() {\n\t\tthis.expressions.forEach( expr => expr.destroy() );\n\t}\n\n\t/**\n\t * Returns an array of expressions with the given filter\n\t * @param filter the callback for the filter\n\t */\n\tfilterExpressions( filter:( expr:Expression ) => boolean ) {\n\t\treturn this.expressions.filter( filter );\n\t}\n\n\t/**\n\t * Extends this context from the given parent context.\n\t * Injecting the parent reference and setup prototype chain\n\t * @param parent The parent context\n\t */\n\textendContext( parent:TemplateContext ) {\n\t\tthis.context.parent = parent;\n\t\tObject.setPrototypeOf( this.context, parent );\n\t}\n\n}\n\n\nfunction createNode( html:string ) {\n\n\tlet template = document.createElement( 'template' );\n\ttemplate.innerHTML = html;\n\n\t// if template has one root node, return that\n\tif( template.content.children.length == 1 ) {\n\t\treturn template.content.children[0];\n\n\t// if template has multiple root nodes wrap them into a div\n\t} else {\n\t\tlet temp = document.createElement('div' );\n\t\ttemp.appendChild( template.content );\n\t\treturn temp;\n\t}\n}\n\n\n\n\n\n/**\n * The global template context that is available as \"this...\" in all template expressions\n */\nexport var context:any = {\n\tlogging: false,\n\tempty: empty,\n\tlog: ( ...params ) => {\n\t\tif( !context.logging ) return;\n\t\tlog( ...params );\n\t},\n\t// inject translations\n\ttrans: translate,\n\t// inject setup helpers\n\tsetup: {\n\t\tdata:data,\n\t\troute:route,\n\t\tasset:asset\n\t},\n\t// inject debugger\n\tdebug: () => {\n\t\tdebugger;\n\t}\n}\n\n\n/**\n * A helper function to template scan on a node or a html string.\n * @param opts.root The root node or html string to scan for expressions\n * @param opts.registry The view registry to lookup views in view=\"..\" expressions\n * @param opts.data The data passed into the template.\n */\nexport function scan( opts:{ root:Element|string, registry?:ViewRegistry, data?:any } ) {\n\tlet template = new Template( opts.root );\n\n\t// setup registry\n\tif( opts.registry ) template.context.registry = opts.registry;\n\n\t// setup data\n\tif( opts.data ) template.context.data = opts.data;\n\n\ttemplate.render();\n\n\treturn template;\n}\n\n\n\n\n\n\n\n","import { Model } from \"../Model\";\nimport { observeArray, observeProperties } from \"../Observer\";\nimport { Subscription } from \"../Signal\";\nimport { Template } from \"../view/Template\";\nimport { View } from \"../view/View\";\nimport { Scope } from \"./Scope\";\n\n\nexport class Repeat extends View implements Scope {\n\n\tprotected itemTemplate: string;\n\tprotected arraySubscription: Subscription;\n\tprotected dataSubscription: Subscription;\n\n\tprotected cache: Map = new Map();\n\tprotected templates: Array