diff --git a/.eslintrc b/.eslintrc index e2f79b4..d31e3e9 100644 --- a/.eslintrc +++ b/.eslintrc @@ -1,5 +1,8 @@ { - "extends": "standard", + "extends": "prettier", + "parserOptions": { + "ecmaVersion": 6 + }, "globals": { "goog": true, "Silica": true, diff --git a/Readme.md b/Readme.md index c0f976b..53f96ef 100644 --- a/Readme.md +++ b/Readme.md @@ -9,6 +9,10 @@ Install Silica js library & save to package.json yarn add silica ``` +## CDN Provided by JSDELIVR + +[![](https://data.jsdelivr.com/v1/package/npm/silica/badge)](https://www.jsdelivr.com/package/npm/silica) + Documentation can be found in the Wiki https://github.com/BakedSoftware/silica/wiki/ diff --git a/build.js b/build.js index 735b0fd..aed3196 100644 --- a/build.js +++ b/build.js @@ -13,14 +13,12 @@ childProcess.execSync('rm -rf build_cache/src/externs.js') // childProcess.execSync("cp ./node_modules/xxhashjs/build/xxhash.min.js dist/silica.js"); // childProcess.execSync("cp ./node_modules/xxhashjs/build/xxhash.min.js dist/silica.min.js"); -childProcess.execSync('cat libs/md5.min.js >> dist/silica.js') -childProcess.execSync('cat libs/md5.min.js >> dist/silica.min.js') var flags = { js: 'build_cache/**/*.js', language_in: 'ECMASCRIPT6', - language_out: 'ECMASCRIPT5', - compilation_level: 'ADVANCED', + language_out: 'ECMASCRIPT6', + compilation_level: 'SIMPLE', externs: 'src/externs.js', generate_exports: 'true' } @@ -31,7 +29,7 @@ closureCompiler.run(function (exitCode, stdOut, stdErr) { if (stdErr.length) { console.error(stdErr) } - fs.appendFileSync('dist/silica.min.js', '!function(){\n"use strict";\n' + stdOut + '}.call(window);') + fs.appendFileSync('dist/silica.min.js', '!function(){\n' + stdOut + '}.call(window);') let compress = spawnSync('gzip', ['-k', 'dist/silica.min.js'], { stdio: [0, 1, 2], cwd: process.cwd() @@ -42,6 +40,16 @@ closureCompiler.run(function (exitCode, stdOut, stdErr) { } else { console.log('Compression finished') } + compress = spawnSync('brotli', ['-Z', 'dist/silica.min.js'], { + stdio: [0, 1, 2], + cwd: process.cwd() + }) + if (compress.error) { + console.log('An error occurred during brotli compression') + console.error(compress.error) + } else { + console.log('Brotli Compression finished') + } }) // Build debug version @@ -55,7 +63,7 @@ closureCompiler.run(function (exitCode, stdOut, stdErr) { if (stdErr.length) { console.error(stdErr) } - fs.appendFileSync('dist/silica.js', '!function(){\n"use strict";\n' + stdOut + '}.call(window);') + fs.appendFileSync('dist/silica.js', '!function(){\n' + stdOut + '}.call(window);') console.log('Compressing results') let compress = spawnSync('gzip', ['-k', 'dist/silica.js'], { stdio: [0, 1, 2], @@ -67,4 +75,14 @@ closureCompiler.run(function (exitCode, stdOut, stdErr) { } else { console.log('Compression finished') } + compress = spawnSync('brotli', ['-Z', 'dist/silica.js'], { + stdio: [0, 1, 2], + cwd: process.cwd() + }) + if (compress.error) { + console.log('An error occurred during brotli compression') + console.error(compress.error) + } else { + console.log('Brotli Compression finished') + } }) diff --git a/dist/silica.js b/dist/silica.js index dfd3f16..806a6d1 100644 --- a/dist/silica.js +++ b/dist/silica.js @@ -1,570 +1,232 @@ -/** - * [js-md5]{@link https://github.com/emn178/js-md5} - * - * @namespace md5 - * @version 0.4.1 - * @author Chen, Yi-Cyuan [emn178@gmail.com] - * @copyright Chen, Yi-Cyuan 2014-2016 - * @license MIT - */ -!function(t){"use strict";function r(t){if(t)c[0]=c[16]=c[1]=c[2]=c[3]=c[4]=c[5]=c[6]=c[7]=c[8]=c[9]=c[10]=c[11]=c[12]=c[13]=c[14]=c[15]=0,this.blocks=c,this.buffer8=i;else if(n){var r=new ArrayBuffer(68);this.buffer8=new Uint8Array(r),this.blocks=new Uint32Array(r)}else this.blocks=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];this.h0=this.h1=this.h2=this.h3=this.start=this.bytes=0,this.finalized=this.hashed=!1,this.first=!0}var e="object"==typeof process&&process.versions&&process.versions.node;e&&(t=global);var i,h=!t.JS_MD5_TEST&&"object"==typeof module&&module.exports,s="function"==typeof define&&define.amd,n=!t.JS_MD5_TEST&&"undefined"!=typeof ArrayBuffer,f="0123456789abcdef".split(""),a=[128,32768,8388608,-2147483648],o=[0,8,16,24],u=["hex","array","digest","buffer","arrayBuffer"],c=[];if(n){var p=new ArrayBuffer(68);i=new Uint8Array(p),c=new Uint32Array(p)}var y=function(t){return function(e){return new r(!0).update(e)[t]()}},d=function(){var t=y("hex");e&&(t=l(t)),t.create=function(){return new r},t.update=function(r){return t.create().update(r)};for(var i=0;is;){if(this.hashed&&(this.hashed=!1,a[0]=a[16],a[16]=a[1]=a[2]=a[3]=a[4]=a[5]=a[6]=a[7]=a[8]=a[9]=a[10]=a[11]=a[12]=a[13]=a[14]=a[15]=0),e)if(n)for(h=this.start;f>s&&64>h;++s)u[h++]=r[s];else for(h=this.start;f>s&&64>h;++s)a[h>>2]|=r[s]<s&&64>h;++s)i=r.charCodeAt(s),128>i?u[h++]=i:2048>i?(u[h++]=192|i>>6,u[h++]=128|63&i):55296>i||i>=57344?(u[h++]=224|i>>12,u[h++]=128|i>>6&63,u[h++]=128|63&i):(i=65536+((1023&i)<<10|1023&r.charCodeAt(++s)),u[h++]=240|i>>18,u[h++]=128|i>>12&63,u[h++]=128|i>>6&63,u[h++]=128|63&i);else for(h=this.start;f>s&&64>h;++s)i=r.charCodeAt(s),128>i?a[h>>2]|=i<i?(a[h>>2]|=(192|i>>6)<>2]|=(128|63&i)<i||i>=57344?(a[h>>2]|=(224|i>>12)<>2]|=(128|i>>6&63)<>2]|=(128|63&i)<>2]|=(240|i>>18)<>2]|=(128|i>>12&63)<>2]|=(128|i>>6&63)<>2]|=(128|63&i)<=64?(this.start=h-64,this.hash(),this.hashed=!0):this.start=h}return this}},r.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var t=this.blocks,r=this.lastByteIndex;t[r>>2]|=a[3&r],r>=56&&(this.hashed||this.hash(),t[0]=t[16],t[16]=t[1]=t[2]=t[3]=t[4]=t[5]=t[6]=t[7]=t[8]=t[9]=t[10]=t[11]=t[12]=t[13]=t[14]=t[15]=0),t[14]=this.bytes<<3,this.hash()}},r.prototype.hash=function(){var t,r,e,i,h,s,n=this.blocks;this.first?(t=n[0]-680876937,t=(t<<7|t>>>25)-271733879<<0,i=(-1732584194^2004318071&t)+n[1]-117830708,i=(i<<12|i>>>20)+t<<0,e=(-271733879^i&(-271733879^t))+n[2]-1126478375,e=(e<<17|e>>>15)+i<<0,r=(t^e&(i^t))+n[3]-1316259209,r=(r<<22|r>>>10)+e<<0):(t=this.h0,r=this.h1,e=this.h2,i=this.h3,t+=(i^r&(e^i))+n[0]-680876936,t=(t<<7|t>>>25)+r<<0,i+=(e^t&(r^e))+n[1]-389564586,i=(i<<12|i>>>20)+t<<0,e+=(r^i&(t^r))+n[2]+606105819,e=(e<<17|e>>>15)+i<<0,r+=(t^e&(i^t))+n[3]-1044525330,r=(r<<22|r>>>10)+e<<0),t+=(i^r&(e^i))+n[4]-176418897,t=(t<<7|t>>>25)+r<<0,i+=(e^t&(r^e))+n[5]+1200080426,i=(i<<12|i>>>20)+t<<0,e+=(r^i&(t^r))+n[6]-1473231341,e=(e<<17|e>>>15)+i<<0,r+=(t^e&(i^t))+n[7]-45705983,r=(r<<22|r>>>10)+e<<0,t+=(i^r&(e^i))+n[8]+1770035416,t=(t<<7|t>>>25)+r<<0,i+=(e^t&(r^e))+n[9]-1958414417,i=(i<<12|i>>>20)+t<<0,e+=(r^i&(t^r))+n[10]-42063,e=(e<<17|e>>>15)+i<<0,r+=(t^e&(i^t))+n[11]-1990404162,r=(r<<22|r>>>10)+e<<0,t+=(i^r&(e^i))+n[12]+1804603682,t=(t<<7|t>>>25)+r<<0,i+=(e^t&(r^e))+n[13]-40341101,i=(i<<12|i>>>20)+t<<0,e+=(r^i&(t^r))+n[14]-1502002290,e=(e<<17|e>>>15)+i<<0,r+=(t^e&(i^t))+n[15]+1236535329,r=(r<<22|r>>>10)+e<<0,t+=(e^i&(r^e))+n[1]-165796510,t=(t<<5|t>>>27)+r<<0,i+=(r^e&(t^r))+n[6]-1069501632,i=(i<<9|i>>>23)+t<<0,e+=(t^r&(i^t))+n[11]+643717713,e=(e<<14|e>>>18)+i<<0,r+=(i^t&(e^i))+n[0]-373897302,r=(r<<20|r>>>12)+e<<0,t+=(e^i&(r^e))+n[5]-701558691,t=(t<<5|t>>>27)+r<<0,i+=(r^e&(t^r))+n[10]+38016083,i=(i<<9|i>>>23)+t<<0,e+=(t^r&(i^t))+n[15]-660478335,e=(e<<14|e>>>18)+i<<0,r+=(i^t&(e^i))+n[4]-405537848,r=(r<<20|r>>>12)+e<<0,t+=(e^i&(r^e))+n[9]+568446438,t=(t<<5|t>>>27)+r<<0,i+=(r^e&(t^r))+n[14]-1019803690,i=(i<<9|i>>>23)+t<<0,e+=(t^r&(i^t))+n[3]-187363961,e=(e<<14|e>>>18)+i<<0,r+=(i^t&(e^i))+n[8]+1163531501,r=(r<<20|r>>>12)+e<<0,t+=(e^i&(r^e))+n[13]-1444681467,t=(t<<5|t>>>27)+r<<0,i+=(r^e&(t^r))+n[2]-51403784,i=(i<<9|i>>>23)+t<<0,e+=(t^r&(i^t))+n[7]+1735328473,e=(e<<14|e>>>18)+i<<0,r+=(i^t&(e^i))+n[12]-1926607734,r=(r<<20|r>>>12)+e<<0,h=r^e,t+=(h^i)+n[5]-378558,t=(t<<4|t>>>28)+r<<0,i+=(h^t)+n[8]-2022574463,i=(i<<11|i>>>21)+t<<0,s=i^t,e+=(s^r)+n[11]+1839030562,e=(e<<16|e>>>16)+i<<0,r+=(s^e)+n[14]-35309556,r=(r<<23|r>>>9)+e<<0,h=r^e,t+=(h^i)+n[1]-1530992060,t=(t<<4|t>>>28)+r<<0,i+=(h^t)+n[4]+1272893353,i=(i<<11|i>>>21)+t<<0,s=i^t,e+=(s^r)+n[7]-155497632,e=(e<<16|e>>>16)+i<<0,r+=(s^e)+n[10]-1094730640,r=(r<<23|r>>>9)+e<<0,h=r^e,t+=(h^i)+n[13]+681279174,t=(t<<4|t>>>28)+r<<0,i+=(h^t)+n[0]-358537222,i=(i<<11|i>>>21)+t<<0,s=i^t,e+=(s^r)+n[3]-722521979,e=(e<<16|e>>>16)+i<<0,r+=(s^e)+n[6]+76029189,r=(r<<23|r>>>9)+e<<0,h=r^e,t+=(h^i)+n[9]-640364487,t=(t<<4|t>>>28)+r<<0,i+=(h^t)+n[12]-421815835,i=(i<<11|i>>>21)+t<<0,s=i^t,e+=(s^r)+n[15]+530742520,e=(e<<16|e>>>16)+i<<0,r+=(s^e)+n[2]-995338651,r=(r<<23|r>>>9)+e<<0,t+=(e^(r|~i))+n[0]-198630844,t=(t<<6|t>>>26)+r<<0,i+=(r^(t|~e))+n[7]+1126891415,i=(i<<10|i>>>22)+t<<0,e+=(t^(i|~r))+n[14]-1416354905,e=(e<<15|e>>>17)+i<<0,r+=(i^(e|~t))+n[5]-57434055,r=(r<<21|r>>>11)+e<<0,t+=(e^(r|~i))+n[12]+1700485571,t=(t<<6|t>>>26)+r<<0,i+=(r^(t|~e))+n[3]-1894986606,i=(i<<10|i>>>22)+t<<0,e+=(t^(i|~r))+n[10]-1051523,e=(e<<15|e>>>17)+i<<0,r+=(i^(e|~t))+n[1]-2054922799,r=(r<<21|r>>>11)+e<<0,t+=(e^(r|~i))+n[8]+1873313359,t=(t<<6|t>>>26)+r<<0,i+=(r^(t|~e))+n[15]-30611744,i=(i<<10|i>>>22)+t<<0,e+=(t^(i|~r))+n[6]-1560198380,e=(e<<15|e>>>17)+i<<0,r+=(i^(e|~t))+n[13]+1309151649,r=(r<<21|r>>>11)+e<<0,t+=(e^(r|~i))+n[4]-145523070,t=(t<<6|t>>>26)+r<<0,i+=(r^(t|~e))+n[11]-1120210379,i=(i<<10|i>>>22)+t<<0,e+=(t^(i|~r))+n[2]+718787259,e=(e<<15|e>>>17)+i<<0,r+=(i^(e|~t))+n[9]-343485551,r=(r<<21|r>>>11)+e<<0,this.first?(this.h0=t+1732584193<<0,this.h1=r-271733879<<0,this.h2=e-1732584194<<0,this.h3=i+271733878<<0,this.first=!1):(this.h0=this.h0+t<<0,this.h1=this.h1+r<<0,this.h2=this.h2+e<<0,this.h3=this.h3+i<<0)},r.prototype.hex=function(){this.finalize();var t=this.h0,r=this.h1,e=this.h2,i=this.h3;return f[t>>4&15]+f[15&t]+f[t>>12&15]+f[t>>8&15]+f[t>>20&15]+f[t>>16&15]+f[t>>28&15]+f[t>>24&15]+f[r>>4&15]+f[15&r]+f[r>>12&15]+f[r>>8&15]+f[r>>20&15]+f[r>>16&15]+f[r>>28&15]+f[r>>24&15]+f[e>>4&15]+f[15&e]+f[e>>12&15]+f[e>>8&15]+f[e>>20&15]+f[e>>16&15]+f[e>>28&15]+f[e>>24&15]+f[i>>4&15]+f[15&i]+f[i>>12&15]+f[i>>8&15]+f[i>>20&15]+f[i>>16&15]+f[i>>28&15]+f[i>>24&15]},r.prototype.toString=r.prototype.hex,r.prototype.digest=function(){this.finalize();var t=this.h0,r=this.h1,e=this.h2,i=this.h3;return[255&t,t>>8&255,t>>16&255,t>>24&255,255&r,r>>8&255,r>>16&255,r>>24&255,255&e,e>>8&255,e>>16&255,e>>24&255,255&i,i>>8&255,i>>16&255,i>>24&255]},r.prototype.array=r.prototype.digest,r.prototype.arrayBuffer=function(){this.finalize();var t=new ArrayBuffer(16),r=new Uint32Array(t);return r[0]=this.h0,r[1]=this.h1,r[2]=this.h2,r[3]=this.h3,t},r.prototype.buffer=r.prototype.arrayBuffer;var v=d();(t.md5=v,s&&define(function(){return v}))}(this); !function(){ -"use strict"; +'use strict'; var $jscomp = $jscomp || {}; $jscomp.scope = {}; $jscomp.ASSUME_ES5 = !1; $jscomp.ASSUME_NO_NATIVE_MAP = !1; $jscomp.ASSUME_NO_NATIVE_SET = !1; +$jscomp.SIMPLE_FROUND_POLYFILL = !1; +$jscomp.ISOLATE_POLYFILLS = !1; +$jscomp.FORCE_POLYFILL_PROMISE = !1; +$jscomp.FORCE_POLYFILL_PROMISE_WHEN_NO_UNHANDLED_REJECTION = !1; $jscomp.defineProperty = $jscomp.ASSUME_ES5 || "function" == typeof Object.defineProperties ? Object.defineProperty : function($target$$, $property$$, $descriptor$$) { - $target$$ != Array.prototype && $target$$ != Object.prototype && ($target$$[$property$$] = $descriptor$$.value); + if ($target$$ == Array.prototype || $target$$ == Object.prototype) { + return $target$$; + } + $target$$[$property$$] = $descriptor$$.value; + return $target$$; }; -$jscomp.getGlobal = function $$jscomp$getGlobal$($maybeGlobal$$) { - return "undefined" != typeof window && window === $maybeGlobal$$ ? $maybeGlobal$$ : "undefined" != typeof global && null != global ? global : $maybeGlobal$$; +$jscomp.getGlobal = function($passedInThis_possibleGlobals$$) { + $passedInThis_possibleGlobals$$ = ["object" == typeof globalThis && globalThis, $passedInThis_possibleGlobals$$, "object" == typeof window && window, "object" == typeof self && self, "object" == typeof global && global, ]; + for (var $i$$ = 0; $i$$ < $passedInThis_possibleGlobals$$.length; ++$i$$) { + var $maybeGlobal$$ = $passedInThis_possibleGlobals$$[$i$$]; + if ($maybeGlobal$$ && $maybeGlobal$$.Math == Math) { + return $maybeGlobal$$; + } + } + throw Error("Cannot find global object"); }; $jscomp.global = $jscomp.getGlobal(this); -$jscomp.SYMBOL_PREFIX = "jscomp_symbol_"; -$jscomp.initSymbol = function $$jscomp$initSymbol$() { - $jscomp.initSymbol = function $$jscomp$initSymbol$() { - }; - $jscomp.global.Symbol || ($jscomp.global.Symbol = $jscomp.Symbol); -}; -$jscomp.Symbol = function() { - var $counter$$ = 0; - return function Symbol($opt_description$$) { - return $jscomp.SYMBOL_PREFIX + ($opt_description$$ || "") + $counter$$++; - }; -}(); -$jscomp.initSymbolIterator = function $$jscomp$initSymbolIterator$() { - $jscomp.initSymbol(); - var $symbolIterator$$ = $jscomp.global.Symbol.iterator; - $symbolIterator$$ || ($symbolIterator$$ = $jscomp.global.Symbol.iterator = $jscomp.global.Symbol("iterator")); - "function" != typeof Array.prototype[$symbolIterator$$] && $jscomp.defineProperty(Array.prototype, $symbolIterator$$, {configurable:!0, writable:!0, value:function() { - return $jscomp.arrayIterator(this); - }}); - $jscomp.initSymbolIterator = function $$jscomp$initSymbolIterator$() { - }; -}; -$jscomp.arrayIterator = function $$jscomp$arrayIterator$($array$$) { - var $index$$ = 0; - return $jscomp.iteratorPrototype(function() { - return $index$$ < $array$$.length ? {done:!1, value:$array$$[$index$$++]} : {done:!0}; - }); -}; -$jscomp.iteratorPrototype = function $$jscomp$iteratorPrototype$($iterator$$) { - $jscomp.initSymbolIterator(); - $iterator$$ = {next:$iterator$$}; - $iterator$$[$jscomp.global.Symbol.iterator] = function $$iterator$$$$jscomp$global$Symbol$iterator$() { - return this; - }; - return $iterator$$; +$jscomp.IS_SYMBOL_NATIVE = "function" === typeof Symbol && "symbol" === typeof Symbol("x"); +$jscomp.TRUST_ES6_POLYFILLS = !$jscomp.ISOLATE_POLYFILLS || $jscomp.IS_SYMBOL_NATIVE; +$jscomp.polyfills = {}; +$jscomp.propertyToPolyfillSymbol = {}; +$jscomp.POLYFILL_PREFIX = "$jscp$"; +var $jscomp$lookupPolyfilledValue = function($target$$, $key$$) { + var $polyfill_polyfilledKey$$ = $jscomp.propertyToPolyfillSymbol[$key$$]; + if (null == $polyfill_polyfilledKey$$) { + return $target$$[$key$$]; + } + $polyfill_polyfilledKey$$ = $target$$[$polyfill_polyfilledKey$$]; + return void 0 !== $polyfill_polyfilledKey$$ ? $polyfill_polyfilledKey$$ : $target$$[$key$$]; }; -$jscomp.makeIterator = function $$jscomp$makeIterator$($iterable$$) { - $jscomp.initSymbolIterator(); - $jscomp.initSymbol(); - $jscomp.initSymbolIterator(); - var $iteratorFunction$$ = $iterable$$[Symbol.iterator]; - return $iteratorFunction$$ ? $iteratorFunction$$.call($iterable$$) : $jscomp.arrayIterator($iterable$$); +$jscomp.polyfill = function($target$$, $polyfill$$, $fromLang$$, $toLang$$) { + $polyfill$$ && ($jscomp.ISOLATE_POLYFILLS ? $jscomp.polyfillIsolated($target$$, $polyfill$$, $fromLang$$, $toLang$$) : $jscomp.polyfillUnisolated($target$$, $polyfill$$, $fromLang$$, $toLang$$)); }; -$jscomp.objectCreate = $jscomp.ASSUME_ES5 || "function" == typeof Object.create ? Object.create : function($prototype$$) { - var $ctor$$ = function $$ctor$$$() { - }; - $ctor$$.prototype = $prototype$$; - return new $ctor$$; -}; -$jscomp.underscoreProtoCanBeSet = function $$jscomp$underscoreProtoCanBeSet$() { - var $x$$ = {a:!0}, $y$$ = {}; - try { - return $y$$.__proto__ = $x$$, $y$$.a; - } catch ($e$$) { +$jscomp.polyfillUnisolated = function($property$jscomp$6_split_target$$, $impl_polyfill$$, $fromLang$jscomp$1_obj$$, $i$jscomp$4_orig_toLang$$) { + $fromLang$jscomp$1_obj$$ = $jscomp.global; + $property$jscomp$6_split_target$$ = $property$jscomp$6_split_target$$.split("."); + for ($i$jscomp$4_orig_toLang$$ = 0; $i$jscomp$4_orig_toLang$$ < $property$jscomp$6_split_target$$.length - 1; $i$jscomp$4_orig_toLang$$++) { + var $key$$ = $property$jscomp$6_split_target$$[$i$jscomp$4_orig_toLang$$]; + if (!($key$$ in $fromLang$jscomp$1_obj$$)) { + return; + } + $fromLang$jscomp$1_obj$$ = $fromLang$jscomp$1_obj$$[$key$$]; } - return !1; + $property$jscomp$6_split_target$$ = $property$jscomp$6_split_target$$[$property$jscomp$6_split_target$$.length - 1]; + $i$jscomp$4_orig_toLang$$ = $fromLang$jscomp$1_obj$$[$property$jscomp$6_split_target$$]; + $impl_polyfill$$ = $impl_polyfill$$($i$jscomp$4_orig_toLang$$); + $impl_polyfill$$ != $i$jscomp$4_orig_toLang$$ && null != $impl_polyfill$$ && $jscomp.defineProperty($fromLang$jscomp$1_obj$$, $property$jscomp$6_split_target$$, {configurable:!0, writable:!0, value:$impl_polyfill$$}); }; -$jscomp.setPrototypeOf = "function" == typeof Object.setPrototypeOf ? Object.setPrototypeOf : $jscomp.underscoreProtoCanBeSet() ? function($target$$, $proto$$) { - $target$$.__proto__ = $proto$$; - if ($target$$.__proto__ !== $proto$$) { - throw new TypeError($target$$ + " is not extensible"); +$jscomp.polyfillIsolated = function($isSimpleName_target$$, $impl$jscomp$1_polyfill$$, $fromLang$$, $ownerObject_root$jscomp$3_toLang$$) { + var $property$jscomp$7_split$$ = $isSimpleName_target$$.split("."); + $isSimpleName_target$$ = 1 === $property$jscomp$7_split$$.length; + $ownerObject_root$jscomp$3_toLang$$ = $property$jscomp$7_split$$[0]; + $ownerObject_root$jscomp$3_toLang$$ = !$isSimpleName_target$$ && $ownerObject_root$jscomp$3_toLang$$ in $jscomp.polyfills ? $jscomp.polyfills : $jscomp.global; + for (var $i$$ = 0; $i$$ < $property$jscomp$7_split$$.length - 1; $i$$++) { + var $key$$ = $property$jscomp$7_split$$[$i$$]; + if (!($key$$ in $ownerObject_root$jscomp$3_toLang$$)) { + return; + } + $ownerObject_root$jscomp$3_toLang$$ = $ownerObject_root$jscomp$3_toLang$$[$key$$]; } - return $target$$; -} : null; -$jscomp.inherits = function $$jscomp$inherits$($childCtor$$, $parentCtor$$) { - $childCtor$$.prototype = $jscomp.objectCreate($parentCtor$$.prototype); - $childCtor$$.prototype.constructor = $childCtor$$; - if ($jscomp.setPrototypeOf) { - var $p_setPrototypeOf$$ = $jscomp.setPrototypeOf; - $p_setPrototypeOf$$($childCtor$$, $parentCtor$$); - } else { - for ($p_setPrototypeOf$$ in $parentCtor$$) { - if ("prototype" != $p_setPrototypeOf$$) { - if (Object.defineProperties) { - var $descriptor$$ = Object.getOwnPropertyDescriptor($parentCtor$$, $p_setPrototypeOf$$); - $descriptor$$ && Object.defineProperty($childCtor$$, $p_setPrototypeOf$$, $descriptor$$); - } else { - $childCtor$$[$p_setPrototypeOf$$] = $parentCtor$$[$p_setPrototypeOf$$]; - } + $property$jscomp$7_split$$ = $property$jscomp$7_split$$[$property$jscomp$7_split$$.length - 1]; + $fromLang$$ = $jscomp.IS_SYMBOL_NATIVE && "es6" === $fromLang$$ ? $ownerObject_root$jscomp$3_toLang$$[$property$jscomp$7_split$$] : null; + $impl$jscomp$1_polyfill$$ = $impl$jscomp$1_polyfill$$($fromLang$$); + null != $impl$jscomp$1_polyfill$$ && ($isSimpleName_target$$ ? $jscomp.defineProperty($jscomp.polyfills, $property$jscomp$7_split$$, {configurable:!0, writable:!0, value:$impl$jscomp$1_polyfill$$}) : $impl$jscomp$1_polyfill$$ !== $fromLang$$ && (void 0 === $jscomp.propertyToPolyfillSymbol[$property$jscomp$7_split$$] && ($jscomp.propertyToPolyfillSymbol[$property$jscomp$7_split$$] = $jscomp.IS_SYMBOL_NATIVE ? $jscomp.global.Symbol($property$jscomp$7_split$$) : $jscomp.POLYFILL_PREFIX + $property$jscomp$7_split$$), + $property$jscomp$7_split$$ = $jscomp.propertyToPolyfillSymbol[$property$jscomp$7_split$$], $jscomp.defineProperty($ownerObject_root$jscomp$3_toLang$$, $property$jscomp$7_split$$, {configurable:!0, writable:!0, value:$impl$jscomp$1_polyfill$$}))); +}; +$jscomp.polyfill("Array.prototype.includes", function($orig$$) { + return $orig$$ ? $orig$$ : function($searchElement$$, $i$jscomp$6_opt_fromIndex$$) { + var $array$$ = this; + $array$$ instanceof String && ($array$$ = String($array$$)); + var $len$$ = $array$$.length; + $i$jscomp$6_opt_fromIndex$$ = $i$jscomp$6_opt_fromIndex$$ || 0; + for (0 > $i$jscomp$6_opt_fromIndex$$ && ($i$jscomp$6_opt_fromIndex$$ = Math.max($i$jscomp$6_opt_fromIndex$$ + $len$$, 0)); $i$jscomp$6_opt_fromIndex$$ < $len$$; $i$jscomp$6_opt_fromIndex$$++) { + var $element$$ = $array$$[$i$jscomp$6_opt_fromIndex$$]; + if ($element$$ === $searchElement$$ || Object.is($element$$, $searchElement$$)) { + return !0; } } - } - $childCtor$$.superClass_ = $parentCtor$$.prototype; + return !1; + }; +}, "es7", "es3"); +$jscomp.arrayIteratorImpl = function($array$$) { + var $index$$ = 0; + return function() { + return $index$$ < $array$$.length ? {done:!1, value:$array$$[$index$$++], } : {done:!0}; + }; }; -$jscomp.arrayFromIterator = function $$jscomp$arrayFromIterator$($iterator$$) { - for (var $i$$, $arr$$ = []; !($i$$ = $iterator$$.next()).done;) { - $arr$$.push($i$$.value); - } - return $arr$$; +$jscomp.arrayIterator = function($array$$) { + return {next:$jscomp.arrayIteratorImpl($array$$)}; +}; +$jscomp.initSymbol = function() { }; -$jscomp.arrayFromIterable = function $$jscomp$arrayFromIterable$($iterable$$) { - return $iterable$$ instanceof Array ? $iterable$$ : $jscomp.arrayFromIterator($jscomp.makeIterator($iterable$$)); +$jscomp.iteratorPrototype = function($iterator$$) { + $iterator$$ = {next:$iterator$$}; + $iterator$$[Symbol.iterator] = function() { + return this; + }; + return $iterator$$; }; -$jscomp.iteratorFromArray = function $$jscomp$iteratorFromArray$($array$$, $transform$$) { - $jscomp.initSymbolIterator(); +$jscomp.iteratorFromArray = function($array$$, $transform$$) { $array$$ instanceof String && ($array$$ += ""); - var $i$$ = 0, $iter$$ = {next:function() { - if ($i$$ < $array$$.length) { + var $i$$ = 0, $done$$ = !1, $iter$$ = {next:function() { + if (!$done$$ && $i$$ < $array$$.length) { var $index$$ = $i$$++; return {value:$transform$$($index$$, $array$$[$index$$]), done:!1}; } - $iter$$.next = function $$iter$$$next$() { - return {done:!0, value:void 0}; - }; - return $iter$$.next(); + $done$$ = !0; + return {done:!0, value:void 0}; }}; - $iter$$[Symbol.iterator] = function $$iter$$$Symbol$iterator$() { + $iter$$[Symbol.iterator] = function() { return $iter$$; }; return $iter$$; }; -$jscomp.polyfill = function $$jscomp$polyfill$($property$jscomp$5_split_target$$, $impl_polyfill$$, $fromLang_obj$$, $i$$) { - if ($impl_polyfill$$) { - $fromLang_obj$$ = $jscomp.global; - $property$jscomp$5_split_target$$ = $property$jscomp$5_split_target$$.split("."); - for ($i$$ = 0; $i$$ < $property$jscomp$5_split_target$$.length - 1; $i$$++) { - var $key$$ = $property$jscomp$5_split_target$$[$i$$]; - $key$$ in $fromLang_obj$$ || ($fromLang_obj$$[$key$$] = {}); - $fromLang_obj$$ = $fromLang_obj$$[$key$$]; - } - $property$jscomp$5_split_target$$ = $property$jscomp$5_split_target$$[$property$jscomp$5_split_target$$.length - 1]; - $i$$ = $fromLang_obj$$[$property$jscomp$5_split_target$$]; - $impl_polyfill$$ = $impl_polyfill$$($i$$); - $impl_polyfill$$ != $i$$ && null != $impl_polyfill$$ && $jscomp.defineProperty($fromLang_obj$$, $property$jscomp$5_split_target$$, {configurable:!0, writable:!0, value:$impl_polyfill$$}); - } -}; -$jscomp.polyfill("Array.prototype.keys", function($orig$$) { +$jscomp.polyfill("Array.prototype.values", function($orig$$) { return $orig$$ ? $orig$$ : function() { - return $jscomp.iteratorFromArray(this, function($i$$) { - return $i$$; + return $jscomp.iteratorFromArray(this, function($k$$, $v$$) { + return $v$$; }); }; -}, "es6", "es3"); -$jscomp.polyfill("Reflect.getOwnPropertyDescriptor", function($orig$$) { - return $orig$$ || Object.getOwnPropertyDescriptor; -}, "es6", "es5"); -$jscomp.polyfill("Reflect.getPrototypeOf", function($orig$$) { - return $orig$$ || Object.getPrototypeOf; -}, "es6", "es5"); -$jscomp.findDescriptor = function $$jscomp$findDescriptor$($obj$jscomp$26_target$$, $propertyKey$$) { - for (; $obj$jscomp$26_target$$;) { - var $property$$ = Reflect.getOwnPropertyDescriptor($obj$jscomp$26_target$$, $propertyKey$$); - if ($property$$) { - return $property$$; - } - $obj$jscomp$26_target$$ = Reflect.getPrototypeOf($obj$jscomp$26_target$$); - } -}; -$jscomp.polyfill("Reflect.get", function($orig$$) { - return $orig$$ ? $orig$$ : function($target$$, $propertyKey$$, $opt_receiver$$) { - if (2 >= arguments.length) { - return $target$$[$propertyKey$$]; - } - var $property$$ = $jscomp.findDescriptor($target$$, $propertyKey$$); - if ($property$$) { - return $property$$.get ? $property$$.get.call($opt_receiver$$) : $property$$.value; - } - }; -}, "es6", "es5"); -$jscomp.polyfill("Object.getOwnPropertySymbols", function($orig$$) { - return $orig$$ ? $orig$$ : function() { - return []; - }; -}, "es6", "es5"); -$jscomp.polyfill("Reflect.ownKeys", function($orig$$) { - return $orig$$ ? $orig$$ : function($symbols_target$$) { - var $keys$$ = [], $names$$ = Object.getOwnPropertyNames($symbols_target$$); - $symbols_target$$ = Object.getOwnPropertySymbols($symbols_target$$); - for (var $i$$ = 0; $i$$ < $names$$.length; $i$$++) { - ("jscomp_symbol_" == $names$$[$i$$].substring(0, 14) ? $symbols_target$$ : $keys$$).push($names$$[$i$$]); - } - return $keys$$.concat($symbols_target$$); - }; -}, "es6", "es5"); -$jscomp.checkEs6ConformanceViaProxy = function $$jscomp$checkEs6ConformanceViaProxy$() { - try { - var $proxied$$ = {}, $proxy$$ = Object.create(new $jscomp.global.Proxy($proxied$$, {get:function($target$$, $key$$, $receiver$$) { - return $target$$ == $proxied$$ && "q" == $key$$ && $receiver$$ == $proxy$$; - }})); - return !0 === $proxy$$.q; - } catch ($err$$) { - return !1; - } -}; -$jscomp.USE_PROXY_FOR_ES6_CONFORMANCE_CHECKS = !1; -$jscomp.ES6_CONFORMANCE = $jscomp.USE_PROXY_FOR_ES6_CONFORMANCE_CHECKS && $jscomp.checkEs6ConformanceViaProxy(); -$jscomp.owns = function $$jscomp$owns$($obj$$, $prop$$) { - return Object.prototype.hasOwnProperty.call($obj$$, $prop$$); +}, "es8", "es3"); +var module$contents$compilers$class_getClassList = null; +module$contents$compilers$class_getClassList = DOMTokenList && DOMTokenList.prototype.values ? function($e$$) { + return $e$$.classList.values(); +} : function($e$$) { + return $e$$.className.split(" "); }; -$jscomp.polyfill("WeakMap", function($NativeWeakMap$$) { - function $isConformant$$() { - if (!$NativeWeakMap$$ || !Object.seal) { - return !1; - } - try { - var $x$$ = Object.seal({}), $y$$ = Object.seal({}), $map$$ = new $NativeWeakMap$$([[$x$$, 2], [$y$$, 3]]); - if (2 != $map$$.get($x$$) || 3 != $map$$.get($y$$)) { - return !1; - } - $map$$.delete($x$$); - $map$$.set($y$$, 4); - return !$map$$.has($x$$) && 4 == $map$$.get($y$$); - } catch ($err$$) { - return !1; - } - } - function $insert$$($target$$) { - $jscomp.owns($target$$, $prop$$) || $jscomp.defineProperty($target$$, $prop$$, {value:{}}); - } - function $patch$$($name$$) { - var $prev$$ = Object[$name$$]; - $prev$$ && (Object[$name$$] = function $Object$$name$$$($target$$) { - $insert$$($target$$); - return $prev$$($target$$); - }); - } - if ($jscomp.USE_PROXY_FOR_ES6_CONFORMANCE_CHECKS) { - if ($NativeWeakMap$$ && $jscomp.ES6_CONFORMANCE) { - return $NativeWeakMap$$; - } +function module$contents$compilers$class_updater($element$$, $klass$jscomp$1_value$$) { + var $hardClass$$ = $element$$.dataset.siO2HardClass || ""; + $klass$jscomp$1_value$$ instanceof Array || ($klass$jscomp$1_value$$ = "" === $klass$jscomp$1_value$$ ? [] : [$klass$jscomp$1_value$$]); + null != $element$$.dataset.show && $element$$.classList.contains("hidden") && $klass$jscomp$1_value$$.push("hidden"); + if ($element$$.classList.length !== $klass$jscomp$1_value$$.length) { + $element$$.className = $hardClass$$, $element$$.classList.add.apply($element$$.classList, $klass$jscomp$1_value$$); } else { - if ($isConformant$$()) { - return $NativeWeakMap$$; - } - } - var $prop$$ = "$jscomp_hidden_" + Math.random(); - $patch$$("freeze"); - $patch$$("preventExtensions"); - $patch$$("seal"); - var $index$$ = 0, $PolyfillWeakMap$$ = function $$PolyfillWeakMap$$$($iter$jscomp$1_opt_iterable$$) { - this.id_ = ($index$$ += Math.random() + 1).toString(); - if ($iter$jscomp$1_opt_iterable$$) { - $jscomp.initSymbol(); - $jscomp.initSymbolIterator(); - $iter$jscomp$1_opt_iterable$$ = $jscomp.makeIterator($iter$jscomp$1_opt_iterable$$); - for (var $entry_item$$; !($entry_item$$ = $iter$jscomp$1_opt_iterable$$.next()).done;) { - $entry_item$$ = $entry_item$$.value, this.set($entry_item$$[0], $entry_item$$[1]); + let $applied$$ = !1; + for (let $k$$ of $klass$jscomp$1_value$$) { + if (!$element$$.classList.contains($k$$)) { + $element$$.className = $hardClass$$; + $element$$.classList.add.apply($element$$.classList, $klass$jscomp$1_value$$); + $applied$$ = !0; + break; } } - }; - $PolyfillWeakMap$$.prototype.set = function $$PolyfillWeakMap$$$$set$($key$$, $value$$) { - $insert$$($key$$); - if (!$jscomp.owns($key$$, $prop$$)) { - throw Error("WeakMap key fail: " + $key$$); - } - $key$$[$prop$$][this.id_] = $value$$; - return this; - }; - $PolyfillWeakMap$$.prototype.get = function $$PolyfillWeakMap$$$$get$($key$$) { - return $jscomp.owns($key$$, $prop$$) ? $key$$[$prop$$][this.id_] : void 0; - }; - $PolyfillWeakMap$$.prototype.has = function $$PolyfillWeakMap$$$$has$($key$$) { - return $jscomp.owns($key$$, $prop$$) && $jscomp.owns($key$$[$prop$$], this.id_); - }; - $PolyfillWeakMap$$.prototype.delete = function $$PolyfillWeakMap$$$$delete$($key$$) { - return $jscomp.owns($key$$, $prop$$) && $jscomp.owns($key$$[$prop$$], this.id_) ? delete $key$$[$prop$$][this.id_] : !1; - }; - return $PolyfillWeakMap$$; -}, "es6", "es3"); -$jscomp.MapEntry = function $$jscomp$MapEntry$() { -}; -$jscomp.polyfill("Map", function($NativeMap$$) { - function $isConformant$$() { - if ($jscomp.ASSUME_NO_NATIVE_MAP || !$NativeMap$$ || "function" != typeof $NativeMap$$ || !$NativeMap$$.prototype.entries || "function" != typeof Object.seal) { - return !1; - } - try { - var $key$$ = Object.seal({x:4}), $map$$ = new $NativeMap$$($jscomp.makeIterator([[$key$$, "s"]])); - if ("s" != $map$$.get($key$$) || 1 != $map$$.size || $map$$.get({x:4}) || $map$$.set({x:4}, "t") != $map$$ || 2 != $map$$.size) { - return !1; - } - var $iter$$ = $map$$.entries(), $item$$ = $iter$$.next(); - if ($item$$.done || $item$$.value[0] != $key$$ || "s" != $item$$.value[1]) { - return !1; - } - $item$$ = $iter$$.next(); - return $item$$.done || 4 != $item$$.value[0].x || "t" != $item$$.value[1] || !$iter$$.next().done ? !1 : !0; - } catch ($err$$) { - return !1; - } - } - if ($jscomp.USE_PROXY_FOR_ES6_CONFORMANCE_CHECKS) { - if ($NativeMap$$ && $jscomp.ES6_CONFORMANCE) { - return $NativeMap$$; - } - } else { - if ($isConformant$$()) { - return $NativeMap$$; - } - } - $jscomp.initSymbol(); - $jscomp.initSymbolIterator(); - var $idMap$$ = new WeakMap, $PolyfillMap$$ = function $$PolyfillMap$$$($iter$jscomp$3_opt_iterable$$) { - this.data_ = {}; - this.head_ = $createHead$$(); - this.size = 0; - if ($iter$jscomp$3_opt_iterable$$) { - $iter$jscomp$3_opt_iterable$$ = $jscomp.makeIterator($iter$jscomp$3_opt_iterable$$); - for (var $entry$jscomp$1_item$$; !($entry$jscomp$1_item$$ = $iter$jscomp$3_opt_iterable$$.next()).done;) { - $entry$jscomp$1_item$$ = $entry$jscomp$1_item$$.value, this.set($entry$jscomp$1_item$$[0], $entry$jscomp$1_item$$[1]); - } - } - }; - $PolyfillMap$$.prototype.set = function $$PolyfillMap$$$$set$($key$$, $value$$) { - var $r$$ = $maybeGetEntry$$(this, $key$$); - $r$$.list || ($r$$.list = this.data_[$r$$.id] = []); - $r$$.entry ? $r$$.entry.value = $value$$ : ($r$$.entry = {next:this.head_, previous:this.head_.previous, head:this.head_, key:$key$$, value:$value$$}, $r$$.list.push($r$$.entry), this.head_.previous.next = $r$$.entry, this.head_.previous = $r$$.entry, this.size++); - return this; - }; - $PolyfillMap$$.prototype.delete = function $$PolyfillMap$$$$delete$($key$jscomp$44_r$$) { - $key$jscomp$44_r$$ = $maybeGetEntry$$(this, $key$jscomp$44_r$$); - return $key$jscomp$44_r$$.entry && $key$jscomp$44_r$$.list ? ($key$jscomp$44_r$$.list.splice($key$jscomp$44_r$$.index, 1), $key$jscomp$44_r$$.list.length || delete this.data_[$key$jscomp$44_r$$.id], $key$jscomp$44_r$$.entry.previous.next = $key$jscomp$44_r$$.entry.next, $key$jscomp$44_r$$.entry.next.previous = $key$jscomp$44_r$$.entry.previous, $key$jscomp$44_r$$.entry.head = null, this.size--, !0) : !1; - }; - $PolyfillMap$$.prototype.clear = function $$PolyfillMap$$$$clear$() { - this.data_ = {}; - this.head_ = this.head_.previous = $createHead$$(); - this.size = 0; - }; - $PolyfillMap$$.prototype.has = function $$PolyfillMap$$$$has$($key$$) { - return !!$maybeGetEntry$$(this, $key$$).entry; - }; - $PolyfillMap$$.prototype.get = function $$PolyfillMap$$$$get$($entry$jscomp$2_key$$) { - return ($entry$jscomp$2_key$$ = $maybeGetEntry$$(this, $entry$jscomp$2_key$$).entry) && $entry$jscomp$2_key$$.value; - }; - $PolyfillMap$$.prototype.entries = function $$PolyfillMap$$$$entries$() { - return $makeIterator$$(this, function($entry$$) { - return [$entry$$.key, $entry$$.value]; - }); - }; - $PolyfillMap$$.prototype.keys = function $$PolyfillMap$$$$keys$() { - return $makeIterator$$(this, function($entry$$) { - return $entry$$.key; - }); - }; - $PolyfillMap$$.prototype.values = function $$PolyfillMap$$$$values$() { - return $makeIterator$$(this, function($entry$$) { - return $entry$$.value; - }); - }; - $PolyfillMap$$.prototype.forEach = function $$PolyfillMap$$$$forEach$($callback$$, $opt_thisArg$$) { - for (var $iter$$ = this.entries(), $entry$jscomp$6_item$$; !($entry$jscomp$6_item$$ = $iter$$.next()).done;) { - $entry$jscomp$6_item$$ = $entry$jscomp$6_item$$.value, $callback$$.call($opt_thisArg$$, $entry$jscomp$6_item$$[1], $entry$jscomp$6_item$$[0], this); - } - }; - $PolyfillMap$$.prototype[Symbol.iterator] = $PolyfillMap$$.prototype.entries; - var $maybeGetEntry$$ = function $$maybeGetEntry$$$($index$jscomp$57_map$$, $key$$) { - var $id$jscomp$5_id$jscomp$inline_40_type$$ = $key$$ && typeof $key$$; - "object" == $id$jscomp$5_id$jscomp$inline_40_type$$ || "function" == $id$jscomp$5_id$jscomp$inline_40_type$$ ? $idMap$$.has($key$$) ? $id$jscomp$5_id$jscomp$inline_40_type$$ = $idMap$$.get($key$$) : ($id$jscomp$5_id$jscomp$inline_40_type$$ = "" + ++$mapIndex$$, $idMap$$.set($key$$, $id$jscomp$5_id$jscomp$inline_40_type$$)) : $id$jscomp$5_id$jscomp$inline_40_type$$ = "p_" + $key$$; - var $list$$ = $index$jscomp$57_map$$.data_[$id$jscomp$5_id$jscomp$inline_40_type$$]; - if ($list$$ && $jscomp.owns($index$jscomp$57_map$$.data_, $id$jscomp$5_id$jscomp$inline_40_type$$)) { - for ($index$jscomp$57_map$$ = 0; $index$jscomp$57_map$$ < $list$$.length; $index$jscomp$57_map$$++) { - var $entry$$ = $list$$[$index$jscomp$57_map$$]; - if ($key$$ !== $key$$ && $entry$$.key !== $entry$$.key || $key$$ === $entry$$.key) { - return {id:$id$jscomp$5_id$jscomp$inline_40_type$$, list:$list$$, index:$index$jscomp$57_map$$, entry:$entry$$}; - } - } - } - return {id:$id$jscomp$5_id$jscomp$inline_40_type$$, list:$list$$, index:-1, entry:void 0}; - }, $makeIterator$$ = function $$makeIterator$$$($map$$, $func$$) { - var $entry$$ = $map$$.head_; - return $jscomp.iteratorPrototype(function() { - if ($entry$$) { - for (; $entry$$.head != $map$$.head_;) { - $entry$$ = $entry$$.previous; - } - for (; $entry$$.next != $entry$$.head;) { - return $entry$$ = $entry$$.next, {done:!1, value:$func$$($entry$$)}; + if (!$applied$$) { + for (let $k$$ of module$contents$compilers$class_getClassList($element$$)) { + if (!$klass$jscomp$1_value$$.includes($k$$)) { + $element$$.className = $hardClass$$; + $element$$.classList.add.apply($element$$.classList, $klass$jscomp$1_value$$); + break; } - $entry$$ = null; - } - return {done:!0, value:void 0}; - }); - }, $createHead$$ = function $$createHead$$$() { - var $head$$ = {}; - return $head$$.previous = $head$$.next = $head$$.head = $head$$; - }, $mapIndex$$ = 0; - return $PolyfillMap$$; -}, "es6", "es3"); -$jscomp.polyfill("Object.is", function($orig$$) { - return $orig$$ ? $orig$$ : function($left$$, $right$$) { - return $left$$ === $right$$ ? 0 !== $left$$ || 1 / $left$$ === 1 / $right$$ : $left$$ !== $left$$ && $right$$ !== $right$$; - }; -}, "es6", "es3"); -$jscomp.polyfill("Array.prototype.includes", function($orig$$) { - return $orig$$ ? $orig$$ : function($searchElement$$, $i$jscomp$8_opt_fromIndex$$) { - var $array$$ = this; - $array$$ instanceof String && ($array$$ = String($array$$)); - var $len$$ = $array$$.length; - $i$jscomp$8_opt_fromIndex$$ = $i$jscomp$8_opt_fromIndex$$ || 0; - for (0 > $i$jscomp$8_opt_fromIndex$$ && ($i$jscomp$8_opt_fromIndex$$ = Math.max($i$jscomp$8_opt_fromIndex$$ + $len$$, 0)); $i$jscomp$8_opt_fromIndex$$ < $len$$; $i$jscomp$8_opt_fromIndex$$++) { - var $element$$ = $array$$[$i$jscomp$8_opt_fromIndex$$]; - if ($element$$ === $searchElement$$ || Object.is($element$$, $searchElement$$)) { - return !0; } } - return !1; - }; -}, "es7", "es3"); -$jscomp.checkStringArgs = function $$jscomp$checkStringArgs$($thisArg$$, $arg$$, $func$$) { - if (null == $thisArg$$) { - throw new TypeError("The 'this' value for String.prototype." + $func$$ + " must not be null or undefined"); - } - if ($arg$$ instanceof RegExp) { - throw new TypeError("First argument to String.prototype." + $func$$ + " must not be a regular expression"); } - return $thisArg$$ + ""; -}; -$jscomp.polyfill("String.prototype.includes", function($orig$$) { - return $orig$$ ? $orig$$ : function($searchString$$, $opt_position$$) { - return -1 !== $jscomp.checkStringArgs(this, $searchString$$, "includes").indexOf($searchString$$, $opt_position$$ || 0); - }; -}, "es6", "es3"); -$jscomp.polyfill("Set", function($NativeSet$$) { - function $isConformant$$() { - if ($jscomp.ASSUME_NO_NATIVE_SET || !$NativeSet$$ || "function" != typeof $NativeSet$$ || !$NativeSet$$.prototype.entries || "function" != typeof Object.seal) { - return !1; - } - try { - var $value$$ = Object.seal({x:4}), $set$$ = new $NativeSet$$($jscomp.makeIterator([$value$$])); - if (!$set$$.has($value$$) || 1 != $set$$.size || $set$$.add($value$$) != $set$$ || 1 != $set$$.size || $set$$.add({x:4}) != $set$$ || 2 != $set$$.size) { - return !1; - } - var $iter$$ = $set$$.entries(), $item$$ = $iter$$.next(); - if ($item$$.done || $item$$.value[0] != $value$$ || $item$$.value[1] != $value$$) { - return !1; - } - $item$$ = $iter$$.next(); - return $item$$.done || $item$$.value[0] == $value$$ || 4 != $item$$.value[0].x || $item$$.value[1] != $item$$.value[0] ? !1 : $iter$$.next().done; - } catch ($err$$) { - return !1; - } - } - if ($jscomp.USE_PROXY_FOR_ES6_CONFORMANCE_CHECKS) { - if ($NativeSet$$ && $jscomp.ES6_CONFORMANCE) { - return $NativeSet$$; - } +} +function module$contents$compilers$class_Class($ctx_nodes$$, $node$jscomp$5_value$$) { + if (void 0 !== $node$jscomp$5_value$$) { + module$contents$compilers$class_updater(this, $node$jscomp$5_value$$); } else { - if ($isConformant$$()) { - return $NativeSet$$; + $ctx_nodes$$ = Silica.query(this, "[data-class]"); + if (9 !== this.nodeType && this.dataset["class"]) { + null == this.dataset.siO2HardClass && (this.dataset.siO2HardClass = this.className.split("hidden").join(" ").trim()); + let $property$$ = this.dataset["class"]; + Silica.observer.register(this, $property$$, module$contents$compilers$class_Class); + this.onremove = function() { + Silica.observer.deregister(this, $property$$, module$contents$compilers$class_Class); + }; } - } - $jscomp.initSymbol(); - $jscomp.initSymbolIterator(); - var $PolyfillSet$$ = function $$PolyfillSet$$$($iter$jscomp$6_opt_iterable$$) { - this.map_ = new Map; - if ($iter$jscomp$6_opt_iterable$$) { - $iter$jscomp$6_opt_iterable$$ = $jscomp.makeIterator($iter$jscomp$6_opt_iterable$$); - for (var $entry$$; !($entry$$ = $iter$jscomp$6_opt_iterable$$.next()).done;) { - this.add($entry$$.value); - } + for (let $i$$ = $ctx_nodes$$.length - 1; 0 <= $i$$; --$i$$) { + $node$jscomp$5_value$$ = $ctx_nodes$$[$i$$]; + null == $node$jscomp$5_value$$.dataset.siO2HardClass && ($node$jscomp$5_value$$.dataset.siO2HardClass = $node$jscomp$5_value$$.className.split("hidden").join(" ").trim()); + let $property$$ = $node$jscomp$5_value$$.dataset["class"]; + Silica.observer.register($node$jscomp$5_value$$, $property$$, module$contents$compilers$class_Class); + $node$jscomp$5_value$$.onremove = function() { + Silica.observer.deregister(this, $property$$, module$contents$compilers$class_Class); + }; } - this.size = this.map_.size; - }; - $PolyfillSet$$.prototype.add = function $$PolyfillSet$$$$add$($value$$) { - this.map_.set($value$$, $value$$); - this.size = this.map_.size; - return this; - }; - $PolyfillSet$$.prototype.delete = function $$PolyfillSet$$$$delete$($result_value$$) { - $result_value$$ = this.map_.delete($result_value$$); - this.size = this.map_.size; - return $result_value$$; - }; - $PolyfillSet$$.prototype.clear = function $$PolyfillSet$$$$clear$() { - this.map_.clear(); - this.size = 0; - }; - $PolyfillSet$$.prototype.has = function $$PolyfillSet$$$$has$($value$$) { - return this.map_.has($value$$); - }; - $PolyfillSet$$.prototype.entries = function $$PolyfillSet$$$$entries$() { - return this.map_.entries(); - }; - $PolyfillSet$$.prototype.values = function $$PolyfillSet$$$$values$() { - return this.map_.values(); - }; - $PolyfillSet$$.prototype.keys = $PolyfillSet$$.prototype.values; - $PolyfillSet$$.prototype[Symbol.iterator] = $PolyfillSet$$.prototype.values; - $PolyfillSet$$.prototype.forEach = function $$PolyfillSet$$$$forEach$($callback$$, $opt_thisArg$$) { - var $set$$ = this; - this.map_.forEach(function($value$$) { - return $callback$$.call($opt_thisArg$$, $value$$, $value$$, $set$$); - }); - }; - return $PolyfillSet$$; -}, "es6", "es3"); -function module$exports$compilers$blur() { - for (var $nodes$$ = Silica.query(this, "[data-blur]"), $node$$, $i$$ = $nodes$$.length - 1; 0 <= $i$$; --$i$$) { - $node$$ = $nodes$$[$i$$], $node$$._rt_live = !0, $node$$.onblur = function $$node$$$onblur$($evt$$) { - Silica._call(this, $evt$$, "blur"); - }; - } -} -;function module$exports$compilers$class() { - var $nodes$$ = Silica.query(this, "[data-class]"), $klass$$; - 9 !== this.nodeType && this.dataset["class"] && (null == this.dataset._rt_hard_klass && (this.dataset._rt_hard_klass = this.className), ($klass$$ = Silica.getValue(this, this.dataset["class"], null, null)) && this.classList.add($klass$$)); - for (var $i$$ = $nodes$$.length - 1; 0 <= $i$$; --$i$$) { - var $node$$ = $nodes$$[$i$$]; - null == $node$$.dataset._rt_hard_klass && ($node$$.dataset._rt_hard_klass = $node$$.className.split("hidden").join(" ").trim()); - ($klass$$ = Silica.getValue($node$$, $node$$.dataset["class"], null, [$node$$, $node$$.dataset.parameter])) && $node$$.classList.add($klass$$); } } -;function module$exports$compilers$click() { - for (var $nodes$$ = Silica.query(this, "[data-click]"), $node$$, $i$$ = $nodes$$.length - 1; 0 <= $i$$; --$i$$) { - $node$$ = $nodes$$[$i$$], $node$$._rt_live = !0, $node$$.addEventListener("click", function($evt$$) { - ($node$$ === $evt$$.target || "SELECT" !== $evt$$.target.nodeName && "INPUT" !== $evt$$.target.nodeName) && Silica._call(this, $evt$$, "click"); - }); - } -} -;function module$contents$compilers$clickoutside_handleClick($evt$$) { - for (var $$jscomp$iter$0$$ = $jscomp.makeIterator(Silica._clickOutElements), $$jscomp$key$node_node$$ = $$jscomp$iter$0$$.next(); !$$jscomp$key$node_node$$.done; $$jscomp$key$node_node$$ = $$jscomp$iter$0$$.next()) { - if ($$jscomp$key$node_node$$ = $$jscomp$key$node_node$$.value, 0 < $$jscomp$key$node_node$$.offsetWidth || 0 < $$jscomp$key$node_node$$.offsetHeight) { - $evt$$.target === $$jscomp$key$node_node$$ || Silica.isDescendent($$jscomp$key$node_node$$, $evt$$.target) || Silica._call($$jscomp$key$node_node$$, $evt$$, "clickOutside"); +var module$exports$compilers$class = module$contents$compilers$class_Class; +function module$contents$compilers$clickoutside_handleClick($evt$$) { + for (let $node$$ of Silica._clickOutElements) { + if (0 < $node$$.offsetWidth || 0 < $node$$.offsetHeight) { + $evt$$.target === $node$$ || Silica.isDescendent($node$$, $evt$$.target) || Silica._call($node$$, $evt$$, "onClickOutside"); } } } -function module$exports$compilers$clickoutside() { - for (var $nodes$$ = Silica.query(this, "[data-click-outside]"), $i$$ = $nodes$$.length - 1; 0 <= $i$$; $i$$--) { +function module$contents$compilers$clickoutside_ClickOutside() { + for (var $nodes$$ = Silica.query(this, "[data-on-click-outside]"), $i$$ = $nodes$$.length - 1; 0 <= $i$$; $i$$--) { Silica._clickOutElements.add($nodes$$[$i$$]); } 0 < Silica._clickOutElements.size ? window.addEventListener("click", module$contents$compilers$clickoutside_handleClick) : window.removeEventListener("click", module$contents$compilers$clickoutside_handleClick); } -;function module$exports$compilers$directives() { - for (var $k$$ in Silica.directives) { - for (var $obj$$ = Silica.directives[$k$$], $nodes$$ = Silica.queryOfType(this, $k$$), $wrapper$$ = document.createElement("div"), $i$$ = $nodes$$.length - 1; 0 <= $i$$; --$i$$) { +var module$exports$compilers$clickoutside = module$contents$compilers$clickoutside_ClickOutside; +function module$contents$compilers$directives_directives() { + for (let $k$$ in Silica.directives) { + let $obj$$ = Silica.directives[$k$$], $nodes$$ = Silica.queryOfType(this, $k$$), $wrapper$$ = document.createElement("div"); + for (let $i$$ = $nodes$$.length - 1; 0 <= $i$$; --$i$$) { $wrapper$$.innerHTML = $obj$$.template; - var $newChild$$ = $wrapper$$.firstChild, $node$$ = $nodes$$[$i$$]; + let $newChild$$ = $wrapper$$.firstChild; + var $node$$ = $nodes$$[$i$$]; if ($node$$.hasAttributes()) { - for (var $attrs_v$$ = $node$$.attributes, $j$$ = $attrs_v$$.length - 1; 0 <= $j$$; $j$$--) { + $attrs_v$$ = $node$$.attributes; + for (let $j$$ = $attrs_v$$.length - 1; 0 <= $j$$; $j$$--) { $newChild$$.setAttribute($attrs_v$$[$j$$].name, $attrs_v$$[$j$$].value); } } - for (var $j$6$$ in $node$$.dataset) { - $newChild$$.dataset[$j$6$$] = $node$$.dataset[$j$6$$]; + for (let $j$$ in $node$$.dataset) { + $newChild$$.dataset[$j$$] = $node$$.dataset[$j$$]; } $newChild$$._rt_ctrl = new $obj$$.controller($newChild$$); $newChild$$._rt_ctrl.$ctrl = Silica.getContext($node$$.parentElement); $newChild$$.dataset.sio2Directive = !0; Silica.cacheTemplates($newChild$$); - Silica.interpolate($newChild$$, $newChild$$._rt_ctrl, !1); $node$$.parentNode.replaceChild($newChild$$, $node$$); $node$$ = $obj$$.controller.watchers; - for (var $w$$ in $node$$) { + var $attrs_v$$ = void 0; + for (let $w$$ in $node$$) { $attrs_v$$ = $node$$[$w$$], Silica._watch[$w$$] || (Silica._watch[$w$$] = []), Silica._watch[$w$$].push([$newChild$$._rt_ctrl, $attrs_v$$]); } if ("function" === typeof $newChild$$._rt_ctrl.onLoad) { @@ -573,35 +235,43 @@ function module$exports$compilers$clickoutside() { } } } -;function module$exports$compilers$if() { - for (var $nodes$$ = Silica.queryWithComments(this, "[data-if]"), $comment_isVisible_live_negate_subNodes$$, $raw$$, $list$$, $node$$, $_ref$$, $temp$$ = document.createElement("div"), $$jscomp$loop$26$$ = {}, $i$$ = $nodes$$.length - 1; 0 <= $i$$; $$jscomp$loop$26$$ = {subNode:$$jscomp$loop$26$$.subNode}, --$i$$) { - if ($node$$ = $nodes$$[$i$$], 8 === $node$$.nodeType ? ($temp$$.innerHTML = $node$$.nodeValue, $raw$$ = $list$$ = $temp$$.firstElementChild.dataset["if"]) : $raw$$ = $list$$ = $node$$.dataset["if"], ($comment_isVisible_live_negate_subNodes$$ = "!" === $list$$[0]) && ($list$$ = $list$$.substr(1)), Silica._ifs[$raw$$] || (Silica._ifs[$raw$$] = []), $comment_isVisible_live_negate_subNodes$$ = Silica._show($node$$, $list$$, $comment_isVisible_live_negate_subNodes$$)) { +var module$exports$compilers$directives = module$contents$compilers$directives_directives; +function module$contents$compilers$if__if() { + var $nodes$$ = Silica.queryWithComments(this, "[data-if]"), $comment_isVisible_live_negate_subNodes$$, $j$jscomp$0$$, $_ref$$, $temp$$ = document.createElement("div"); + for (let $i$$ = $nodes$$.length - 1; 0 <= $i$$; --$i$$) { + var $node$$ = $nodes$$[$i$$]; + if (8 === $node$$.nodeType) { + $temp$$.innerHTML = $node$$.nodeValue; + var $raw$$ = $j$jscomp$0$$ = $temp$$.firstElementChild.dataset["if"]; + } else { + $raw$$ = $j$jscomp$0$$ = $node$$.dataset["if"]; + } + ($comment_isVisible_live_negate_subNodes$$ = "!" === $j$jscomp$0$$[0]) && ($j$jscomp$0$$ = $j$jscomp$0$$.substr(1)); + Silica._ifs[$raw$$] || (Silica._ifs[$raw$$] = []); + if ($comment_isVisible_live_negate_subNodes$$ = Silica._show($node$$, $j$jscomp$0$$, $comment_isVisible_live_negate_subNodes$$)) { if (8 !== $node$$.nodeType ? Silica._ifs[$raw$$].push($node$$) : ($comment_isVisible_live_negate_subNodes$$ = $temp$$.firstElementChild, Silica._ifs[$raw$$].push($comment_isVisible_live_negate_subNodes$$), $node$$.parentElement.insertBefore($comment_isVisible_live_negate_subNodes$$, $node$$), $node$$.remove(), $node$$ = $comment_isVisible_live_negate_subNodes$$), null != ($_ref$$ = Silica.getContext($node$$)) && "function" === typeof $_ref$$.onLoad && $_ref$$.el === $node$$) { $_ref$$.onLoad(); } } else { if (8 !== $node$$.nodeType) { $comment_isVisible_live_negate_subNodes$$ = Silica.queryWithComments($node$$, "[data-if]"); - $$jscomp$loop$26$$.subNode = void 0; - for (var $$jscomp$loop$27_prop$$, $j$7_j$$ = $comment_isVisible_live_negate_subNodes$$.length - 1; 0 <= $j$7_j$$; --$j$7_j$$) { - $$jscomp$loop$26$$.subNode = $comment_isVisible_live_negate_subNodes$$[$j$7_j$$], $$jscomp$loop$27_prop$$ = $$jscomp$loop$26$$.subNode.dataset["if"], $list$$ = Silica._shws[$$jscomp$loop$27_prop$$], Silica._shws[$$jscomp$loop$27_prop$$] = null != $list$$ ? $list$$.filter(function($$jscomp$loop$26$$) { - return function($obj$$) { - return $obj$$ !== $$jscomp$loop$26$$.subNode; - }; - }($$jscomp$loop$26$$)) : []; + let $subNode$$; + for (let $j$$ = $comment_isVisible_live_negate_subNodes$$.length - 1; 0 <= $j$$; --$j$$) { + $subNode$$ = $comment_isVisible_live_negate_subNodes$$[$j$$]; + var $list$jscomp$1_prop$$ = $subNode$$.dataset["if"]; + $j$jscomp$0$$ = Silica._shws[$list$jscomp$1_prop$$]; + Silica._shws[$list$jscomp$1_prop$$] = null != $j$jscomp$0$$ ? $j$jscomp$0$$.filter(function($obj$$) { + return $obj$$ !== $subNode$$; + }) : []; } $comment_isVisible_live_negate_subNodes$$ = Silica.query(this, "[data-controller]"); - $$jscomp$loop$27_prop$$ = {}; - for ($j$7_j$$ = $comment_isVisible_live_negate_subNodes$$.length - 1; 0 <= $j$7_j$$; $$jscomp$loop$27_prop$$ = {ctrl:$$jscomp$loop$27_prop$$.ctrl}, --$j$7_j$$) { - $$jscomp$loop$26$$.subNode = $comment_isVisible_live_negate_subNodes$$[$j$7_j$$]; - $$jscomp$loop$27_prop$$.ctrl = this._rt_ctrl; - var $k$$ = void 0; - for ($k$$ in null != $$jscomp$loop$27_prop$$.ctrl ? $$jscomp$loop$27_prop$$.ctrl.watchers : void 0) { - $list$$ = Silica._watch[$k$$], Silica._watch[$k$$] = null != $list$$ ? $list$$.filter(function($$jscomp$loop$27$$) { - return function($obj$$) { - return $obj$$[0] !== $$jscomp$loop$27$$.ctrl; - }; - }($$jscomp$loop$27_prop$$)) : []; + for ($j$jscomp$0$$ = $comment_isVisible_live_negate_subNodes$$.length - 1; 0 <= $j$jscomp$0$$; --$j$jscomp$0$$) { + $subNode$$ = $comment_isVisible_live_negate_subNodes$$[$j$jscomp$0$$]; + let $ctrl$$ = this._rt_ctrl, $k$$; + for ($k$$ in null != $ctrl$$ ? $ctrl$$.watchers : void 0) { + $list$jscomp$1_prop$$ = Silica._watch[$k$$], Silica._watch[$k$$] = null != $list$jscomp$1_prop$$ ? $list$jscomp$1_prop$$.filter(function($obj$$) { + return $obj$$[0] !== $ctrl$$; + }) : []; } } $comment_isVisible_live_negate_subNodes$$ = document.createComment($node$$.outerHTML); @@ -611,35 +281,67 @@ function module$exports$compilers$clickoutside() { } } } -;function module$exports$compilers$show() { - for (var $nodes$$ = Silica.query(this, "[data-show]"), $node$$, $isVisible$jscomp$1_negate$$, $raw$$, $val$$, $i$$ = $nodes$$.length - 1; 0 <= $i$$; --$i$$) { - $node$$ = $nodes$$[$i$$], $raw$$ = $val$$ = $node$$.dataset.show, ($isVisible$jscomp$1_negate$$ = "!" === $val$$[0]) && ($val$$ = $val$$.substr(1)), Silica._shws[$raw$$] || (Silica._shws[$raw$$] = []), Silica._shws[$raw$$].some(function($obj$$) { - return $obj$$ === $node$$; - }) || ($node$$.onremove = function $$node$$$onremove$() { - var $list$$ = Silica._shws[$raw$$]; - Silica._shws[$raw$$] = void 0 !== $list$$ && null !== $list$$ ? $list$$.filter(function($obj$$) { - return $obj$$ !== $node$$; - }) : []; - }, $isVisible$jscomp$1_negate$$ = Silica._show($node$$, $val$$, $isVisible$jscomp$1_negate$$), Silica._shws[$raw$$].push($node$$), $isVisible$jscomp$1_negate$$ ? $node$$.classList.remove("hidden") : $node$$.classList.add("hidden")); - } -} -;function module$exports$compilers$disabled() { - for (var $nodes$$ = Silica.query(this, "[data-disabled]"), $node$$, $property$$, $negate$$, $i$$ = $nodes$$.length - 1; 0 <= $i$$; --$i$$) { - $node$$ = $nodes$$[$i$$], $property$$ = $node$$.dataset.disabled, ($negate$$ = "!" === $property$$[0]) && ($property$$ = $property$$.substr(1)), Silica._show($node$$, $property$$, $negate$$) ? $node$$.setAttribute("disabled", !0) : $node$$.removeAttribute("disabled"); - } -} -;function module$exports$compilers$href() { - for (var $nodes$$ = Silica.query(this, "[data-href]"), $node$$, $i$$ = $nodes$$.length - 1; 0 <= $i$$; --$i$$) { - $node$$ = $nodes$$[$i$$], $node$$.setAttribute("href", Silica.getValue($node$$, $node$$.dataset.href)); +var module$exports$compilers$if = module$contents$compilers$if__if; +function module$contents$compilers$show_Show($ctx$jscomp$1_nodes$$, $i$jscomp$12_value$$) { + if (void 0 !== $i$jscomp$12_value$$) { + $i$jscomp$12_value$$ ? this.classList.remove("hidden") : this.classList.add("hidden"); + } else { + for ($ctx$jscomp$1_nodes$$ = Silica.query(this, "[data-show]"), $i$jscomp$12_value$$ = $ctx$jscomp$1_nodes$$.length - 1; 0 <= $i$jscomp$12_value$$; --$i$jscomp$12_value$$) { + let $node$$ = $ctx$jscomp$1_nodes$$[$i$jscomp$12_value$$], $property$$ = $node$$.dataset.show; + $node$$.onremove = function() { + Silica.observer.deregister($node$$, $property$$, module$contents$compilers$show_Show); + }; + Silica.observer.register($node$$, $property$$, module$contents$compilers$show_Show); + } } - Silica._capture_links(this); } -;function module$exports$compilers$style() { - for (var $nodes$$ = Silica.query(this, "[data-style]"), $node$$, $i$$ = $nodes$$.length - 1; 0 <= $i$$; --$i$$) { - $node$$ = $nodes$$[$i$$], $node$$.setAttribute("style", Silica.getValue($node$$, $node$$.dataset.style)); +var module$exports$compilers$show = module$contents$compilers$show_Show; +function module$contents$compilers$controller_ControllerCompiler($ctx$jscomp$2_nodes$$, $force$$ = !1, $storeWatchers$$ = !0) { + var $k$$; + $ctx$jscomp$2_nodes$$ = Silica.query(this, "[data-controller]"); + for (let $i$$ = $ctx$jscomp$2_nodes$$.length - 1; 0 <= $i$$; --$i$$) { + var $node$$ = $ctx$jscomp$2_nodes$$[$i$$]; + if ($force$$ || void 0 === $node$$._rt_ctrl) { + var $lastCtrl_v$$ = $node$$._rt_ctrl; + delete $node$$._rt_ctrl; + var $_ref$jscomp$1_constructorName_ctrl$$ = $node$$.dataset.controller; + if ("undefined" !== typeof($_ref$jscomp$1_constructorName_ctrl$$ = $_ref$jscomp$1_constructorName_ctrl$$.match(/((?:\w|\.)+)(?:\(([\w\.]+)\))*/))[2]) { + var $model_parent$$ = ($model_parent$$ = $node$$.parentNode) ? Silica.getValue($model_parent$$, $_ref$jscomp$1_constructorName_ctrl$$[2]) : Silica.getValue($node$$, $_ref$jscomp$1_constructorName_ctrl$$[2], $node$$._rt_ctx); + null == $model_parent$$ && ($storeWatchers$$ = !1); + } + $_ref$jscomp$1_constructorName_ctrl$$ = $_ref$jscomp$1_constructorName_ctrl$$[1]; + var $constructor_watchers$$ = eval($_ref$jscomp$1_constructorName_ctrl$$); + if (!$constructor_watchers$$) { + return console.error("Unknown Controller: " + $node$$.dataset.controller); + } + $_ref$jscomp$1_constructorName_ctrl$$ = "undefined" !== typeof $model_parent$$ ? new $constructor_watchers$$($node$$, $model_parent$$) : new $constructor_watchers$$($node$$); + $constructor_watchers$$ = $constructor_watchers$$.watchers; + if ($lastCtrl_v$$ && $constructor_watchers$$ && 0 < Object.keys($constructor_watchers$$).length) { + for ($k$$ in $constructor_watchers$$) { + let $stored$$ = Silica._watch[$k$$]; + if ($stored$$) { + for (let $pairIdx$$ = $stored$$.length - 1; 0 <= $pairIdx$$; --$pairIdx$$) { + $lastCtrl_v$$ === $stored$$[$pairIdx$$][0] && $stored$$.splice($pairIdx$$, 1); + } + } + } + } + $node$$._rt_live = !0; + $node$$._rt_ctrl = $_ref$jscomp$1_constructorName_ctrl$$; + if ($storeWatchers$$) { + for ($k$$ in $constructor_watchers$$) { + $lastCtrl_v$$ = $constructor_watchers$$[$k$$], Silica._watch[$k$$] || (Silica._watch[$k$$] = []), Silica._watch[$k$$].push([$_ref$jscomp$1_constructorName_ctrl$$, $lastCtrl_v$$]); + } + } + if ("function" === typeof $_ref$jscomp$1_constructorName_ctrl$$.onLoad) { + $_ref$jscomp$1_constructorName_ctrl$$.onLoad(); + } + } } } -;function module$contents$compilers$include_loadCallback($element$$) { +var module$exports$compilers$controller = module$contents$compilers$controller_ControllerCompiler; +let module$contents$compilers$include_stackDepth = 0; +function module$contents$compilers$include_loadCallback($element$$) { var $ctx$$ = Silica.getContext($element$$); if ($ctx$$.onLoad && "function" === typeof $ctx$$.onLoad) { $ctx$$.onLoad($element$$); @@ -651,102 +353,87 @@ function module$contents$compilers$include_clearContent($element$$) { } } function module$contents$compilers$include_processInclude($element$$, $html$$) { - var $fragment$$ = document.createElement("div"); + let $fragment$$ = document.createElement("div"); $fragment$$.innerHTML = $html$$; for (module$contents$compilers$include_clearContent($element$$); $fragment$$.children.length;) { $element$$.appendChild($fragment$$.children[0]); } - Silica.compile($element$$); + module$contents$compilers$include_stackDepth++; + module$contents$compilers$include_Include.apply($element$$); + module$contents$compilers$include_stackDepth--; + 0 === module$contents$compilers$include_stackDepth && Silica.compile($element$$); Silica.apply(function() { module$contents$compilers$include_loadCallback($element$$); }, Silica.getContext($element$$).el); } function module$contents$compilers$include_loadPartial($url$$, $element$$) { - if ($element$$.dataset.sio2IncludedUrl !== $url$$) { - $element$$.dataset.sio2IncludedUrl = $url$$; + if ($element$$.dataset.siO2IncludedUrl !== $url$$) { + $element$$.dataset.siO2IncludedUrl = $url$$; module$contents$compilers$include_clearContent($element$$); var $cached$$ = Silica._includeCache[$url$$]; if ($cached$$) { module$contents$compilers$include_processInclude($element$$, $cached$$); } else { var $xhr$$ = new XMLHttpRequest; - $xhr$$.onreadystatechange = function $$xhr$$$onreadystatechange$() { - 4 === $xhr$$.readyState && (Silica._includeCache[$url$$] = $xhr$$.responseText, $element$$.dataset.sio2IncludedUrl === $url$$ && module$contents$compilers$include_processInclude($element$$, $xhr$$.responseText)); + $xhr$$.onreadystatechange = function() { + 4 === $xhr$$.readyState && (Silica._includeCache[$url$$] = $xhr$$.responseText, $element$$.dataset.siO2IncludedUrl === $url$$ && module$contents$compilers$include_processInclude($element$$, $xhr$$.responseText)); }; $xhr$$.open("GET", $url$$, !0); $xhr$$.send(null); } } } -function module$exports$compilers$include() { - for (var $nodes$$ = Silica.query(this, "[data-include]"), $node$$, $url$$, $i$$ = $nodes$$.length - 1; 0 <= $i$$; --$i$$) { - $node$$ = $nodes$$[$i$$], ($url$$ = Silica.getValue($node$$, $node$$.dataset.include)) && "" !== $url$$ ? module$contents$compilers$include_loadPartial($url$$, $node$$) : ($node$$.removeAttribute("data-sio2-included-url"), module$contents$compilers$include_clearContent($node$$)); +function module$contents$compilers$include_IncludeUpdater($_$$, $url$$) { + $url$$ && "" !== $url$$ ? module$contents$compilers$include_loadPartial($url$$, this) : (this.dataset.siO2IncludedUrl = "", module$contents$compilers$include_clearContent(this)); +} +function module$contents$compilers$include_Include($ctx$jscomp$4_nodes$$, $node$jscomp$11_value$$) { + $ctx$jscomp$4_nodes$$ = Silica.query(this, "[data-include]"); + for (let $i$$ = $ctx$jscomp$4_nodes$$.length - 1; 0 <= $i$$; --$i$$) { + $node$jscomp$11_value$$ = $ctx$jscomp$4_nodes$$[$i$$], Silica.observer.register($node$jscomp$11_value$$, $node$jscomp$11_value$$.dataset.include, module$contents$compilers$include_IncludeUpdater); } } -;function module$exports$compilers$controller($ctx$jscomp$1_nodes$$, $force$$, $storeWatchers$$) { - $force$$ = void 0 === $force$$ ? !1 : $force$$; - $storeWatchers$$ = void 0 === $storeWatchers$$ ? !0 : $storeWatchers$$; - var $k$$; - $ctx$jscomp$1_nodes$$ = Silica.query(this, "[data-controller]"); - for (var $i$$ = $ctx$jscomp$1_nodes$$.length - 1; 0 <= $i$$; --$i$$) { - var $node$$ = $ctx$jscomp$1_nodes$$[$i$$]; - if ($force$$ || void 0 === $node$$._rt_ctrl) { - var $lastCtrl_v$$ = $node$$._rt_ctrl; - delete $node$$._rt_ctrl; - var $_ref$$ = $node$$.dataset.controller; - if ("undefined" !== typeof($_ref$$ = $_ref$$.match(/((?:\w|\.)+)(?:\(([\w\.]+)\))*/))[2]) { - var $model_parent$$ = ($model_parent$$ = $node$$.parentNode) ? Silica.getValue($model_parent$$, $_ref$$[2]) : Silica.getValue($node$$, $_ref$$[2], $node$$._rt_ctx); - null == $model_parent$$ && ($storeWatchers$$ = !1); - } - $_ref$$ = $_ref$$[1]; - var $constructor_watchers$$ = eval($_ref$$); - if (!$constructor_watchers$$) { - return console.error("Unknown Controller: " + $node$$.dataset.controller); - } - $_ref$$ = "undefined" !== typeof $model_parent$$ ? new $constructor_watchers$$($node$$, $model_parent$$) : new $constructor_watchers$$($node$$); - $constructor_watchers$$ = $constructor_watchers$$.watchers; - if ($lastCtrl_v$$ && $constructor_watchers$$ && 0 < Object.keys($constructor_watchers$$).length) { - for ($k$$ in $constructor_watchers$$) { - var $stored$$ = Silica._watch[$k$$]; - if ($stored$$) { - for (var $pairIdx$$ = $stored$$.length - 1; 0 <= $pairIdx$$; --$pairIdx$$) { - $lastCtrl_v$$ === $stored$$[$pairIdx$$][0] && $stored$$.splice($pairIdx$$, 1); +var module$exports$compilers$include = module$contents$compilers$include_Include; +var module$exports$compilers$model = {}; +function module$contents$compilers$model_setValue($activeElement_type$$, $element$$, $value$$) { + if ($element$$ !== $activeElement_type$$ || "radio" === $element$$.type || "checkbox" === $element$$.type) { + if ($activeElement_type$$ = $element$$.type, "radio" === $activeElement_type$$) { + var $option_val$$ = $element$$.value; + -1 !== $option_val$$.search(/[0-9]/) && ($option_val$$ = parseInt($option_val$$, 10)); + $element$$.checked = $value$$ === $option_val$$; + } else { + if ("checkbox" === $activeElement_type$$) { + $element$$.checked = Silica.getValue($element$$, $element$$.dataset.model); + } else { + if ("OPTION" === $element$$.nodeName) { + $element$$.value = $value$$; + } else { + if ("INPUT" === $element$$.nodeName || "TEXTAREA" === $element$$.nodeName) { + $element$$.value = $value$$; + } else { + if ("SELECT" === $element$$.nodeName) { + for ($option_val$$ of $element$$.querySelectorAll("option")) { + $option_val$$.selected = $option_val$$.value == $value$$; + } + } else { + null !== $value$$ ? $value$$.nodeName ? ($element$$.innerHTML = "", $element$$.appendChild($value$$)) : $element$$.innerHTML !== $value$$ && ($element$$.innerHTML = $value$$) : "" !== $element$$.innerHTML && ($element$$.innerHTML = ""); } } } } - $node$$._rt_live = !0; - $node$$._rt_ctrl = $_ref$$; - if ($storeWatchers$$) { - for ($k$$ in $constructor_watchers$$) { - $lastCtrl_v$$ = $constructor_watchers$$[$k$$], Silica._watch[$k$$] || (Silica._watch[$k$$] = []), Silica._watch[$k$$].push([$_ref$$, $lastCtrl_v$$]); - } - } - if ("function" === typeof $_ref$$.onLoad) { - $_ref$$.onLoad(); - } } } } -;function module$exports$compilers$double_click() { - for (var $nodes$$ = Silica.query(this, "[data-dblclick]"), $node$$, $i$$ = $nodes$$.length - 1; 0 <= $i$$; --$i$$) { - $node$$ = $nodes$$[$i$$], $node$$._rt_live = !0, $node$$.ondblclick = function $$node$$$ondblclick$($evt$$) { - Silica._call(this, $evt$$, "dblclick"); - }; - } +function module$contents$compilers$model_ModelUpdater($activeElement$jscomp$1_context$$, $value$$) { + $activeElement$jscomp$1_context$$ = document.activeElement || Silica.__activeElement; + this === $activeElement$jscomp$1_context$$ && "radio" !== this.type && "checkbox" !== this.type || module$contents$compilers$model_setValue($activeElement$jscomp$1_context$$, this, $value$$); } -;function module$exports$compilers$focus() { - for (var $nodes$$ = Silica.query(this, "[data-focus]"), $node$$, $i$$ = $nodes$$.length - 1; 0 <= $i$$; --$i$$) { - $node$$ = $nodes$$[$i$$], $node$$._rt_live = !0, $node$$.onfocus = function $$node$$$onfocus$($evt$$) { - Silica._call(this, $evt$$, "focus"); - }; +function module$contents$compilers$model_Model($context$$) { + $context$$ = Silica.query(this, "[data-model]"); + for (var $elm_i$$ of $context$$) { + Silica.observer.register($elm_i$$, $elm_i$$.dataset.model, module$contents$compilers$model_ModelUpdater); } -} -;var module$contents$compilers$model_inputTypes = "text file number email password tel search url range date month week time datetime datetime-local color textarea select select-one".split(" "); -function module$exports$compilers$model($context_elm$$) { - for (var $change_ctx$$, $model$jscomp$0$$, $type$jscomp$118_val$$, $elements$$ = Silica.query(this, "input[data-model]", "select[data-model]", "textarea[data-model]", "option[data-model]"), $i$$ = $elements$$.length - 1; 0 <= $i$$; $i$$--) { - $context_elm$$ = $elements$$[$i$$], $change_ctx$$ = Silica.getContext($context_elm$$), $model$jscomp$0$$ = $context_elm$$.dataset.model, $type$jscomp$118_val$$ = $context_elm$$.type, -1 !== module$contents$compilers$model_inputTypes.indexOf($type$jscomp$118_val$$) ? $context_elm$$.value = Silica.getValue($context_elm$$, $model$jscomp$0$$, $change_ctx$$) : "radio" === $type$jscomp$118_val$$ ? ($type$jscomp$118_val$$ = $context_elm$$.value, $type$jscomp$118_val$$.match(/[0-9]/) && ($type$jscomp$118_val$$ = - parseInt($type$jscomp$118_val$$, 10)), $context_elm$$.checked = Silica.getValue($context_elm$$, $model$jscomp$0$$, $change_ctx$$) === $type$jscomp$118_val$$) : "checkbox" === $type$jscomp$118_val$$ ? $context_elm$$.checked = Silica.getValue($context_elm$$, $model$jscomp$0$$, $change_ctx$$) : "OPTION" === $context_elm$$.nodeName && ($context_elm$$.value = Silica.getValue($context_elm$$, $model$jscomp$0$$, $change_ctx$$)), $change_ctx$$ = function $$change_ctx$$$() { + for ($elm_i$$ = $context$$.length - 1; 0 <= $elm_i$$; $elm_i$$--) { + let $elm$$ = $context$$[$elm_i$$], $change$$ = function() { var $_ref$$, $_ref1$$, $val$$ = this.value, $ctx$$ = Silica.getContext(this), $model$$ = this.dataset.model; "radio" === this.type ? $val$$.match(/[0-9]/) && ($val$$ = parseInt($val$$, 10)) : "checkbox" === this.type && ($val$$ = this.checked); if (Silica.isInApply) { @@ -774,22 +461,22 @@ function module$exports$compilers$model($context_elm$$) { }); } } - }, $context_elm$$.onchange = $change_ctx$$, $context_elm$$.onkeyup = $change_ctx$$, $context_elm$$.onsearch = $change_ctx$$, $context_elm$$.hasAttribute("x-webkit-speech") && ($context_elm$$.onwebkitspeechchange = $change_ctx$$), $context_elm$$.addEventListener("focus", function() { + }; + $elm$$.onchange = Silica.debounce($change$$, 16); + $elm$$.onkeyup = Silica.debounce($change$$, 16); + $elm$$.onsearch = Silica.debounce($change$$, 16); + $elm$$.hasAttribute("x-webkit-speech") && ($elm$$.onwebkitspeechchange = $change$$); + $elm$$.addEventListener("focus", function() { Silica.__activeElement = this; - }), $context_elm$$.addEventListener("blur", function() { + }); + $elm$$.addEventListener("blur", function() { Silica.__activeElement === this && (Silica.__activeElement = null); }); } } -;function module$exports$compilers$submit() { - for (var $nodes$$ = Silica.query(this, "[data-submit]"), $node$$, $handler$$ = function $$handler$$$($evt$$) { - Silica._call(this, $evt$$, "submit"); - return !1; - }, $i$$ = $nodes$$.length - 1; 0 <= $i$$; --$i$$) { - $node$$ = $nodes$$[$i$$], $node$$.onsubmit = $handler$$, $node$$._rt_live = !0; - } -} -;function module$contents$compilers$src_defaultSrcForNode($node$$) { +module$exports$compilers$model.Compiler = module$contents$compilers$model_Model; +module$exports$compilers$model.Updater = module$contents$compilers$model_ModelUpdater; +function module$contents$compilers$src_defaultSrcForNode($node$$) { switch($node$$.nodeName) { case "IMG": return "data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=="; @@ -797,244 +484,179 @@ function module$exports$compilers$model($context_elm$$) { return ""; } } -function module$exports$compilers$src() { - for (var $nodes$$ = Silica.query(this, "[data-src]"), $node$$, $i$$ = $nodes$$.length - 1; 0 <= $i$$; --$i$$) { - $node$$ = $nodes$$[$i$$]; - var $target$$ = Silica.getValue($node$$, $node$$.dataset.src) || module$contents$compilers$src_defaultSrcForNode($node$$); - $node$$.src !== $target$$ && ($node$$.src = $target$$); - } -} -;function module$exports$compilers$scroll() { - for (var $nodes$$ = Silica.query(this, "[data-scroll]"), $node$$, $i$$ = $nodes$$.length - 1; 0 <= $i$$; --$i$$) { - $node$$ = $nodes$$[$i$$], $node$$._rt_live = !0, $node$$.onscroll = function $$node$$$onscroll$($evt$$) { - Silica._call(this, $evt$$, "scroll"); - }; - } +function module$contents$compilers$src_SrcUpdater($_$$, $value$$) { + $value$$ !== this.src && ($value$$ ? this.setAttribute("src", $value$$) : this.removeAttribute("src")); } -;function module$exports$compilers$scroll_finished() { - for (var $nodes$$ = Silica.query(this, "[data-scroll-finished]"), $node$$, $$jscomp$loop$28$$ = {}, $i$$ = $nodes$$.length - 1; 0 <= $i$$; $$jscomp$loop$28$$ = {element:$$jscomp$loop$28$$.element}, --$i$$) { - $node$$ = $nodes$$[$i$$]; - $node$$._rt_live = !0; - $$jscomp$loop$28$$.element = this; - var $onscrollfinished$$ = Silica.debounce(function($element$$, $evt$$) { - Silica._call($element$$, $evt$$, "scroll-finished"); - }, 50); - $node$$.onscroll = function($$jscomp$loop$28$$) { - return function($evt$$) { - this.dataset.scroll && Silica._call(this, $evt$$, "scroll"); - $onscrollfinished$$($$jscomp$loop$28$$.element, $evt$$); - }; - }($$jscomp$loop$28$$); +function module$contents$compilers$src_Src($ctx$jscomp$6_nodes$$, $node$jscomp$13_value$$) { + $ctx$jscomp$6_nodes$$ = Silica.query(this, "[data-src]"); + for (let $i$$ = $ctx$jscomp$6_nodes$$.length - 1; 0 <= $i$$; --$i$$) { + $node$jscomp$13_value$$ = $ctx$jscomp$6_nodes$$[$i$$], Silica.observer.register($node$jscomp$13_value$$, $node$jscomp$13_value$$.dataset.src, module$contents$compilers$src_SrcUpdater); } } -;function module$exports$compilers$value() { - for (var $nodes$$ = Silica.query(this, "[data-value]"), $node$$, $property$$, $i$$ = $nodes$$.length - 1; 0 <= $i$$; --$i$$) { - $node$$ = $nodes$$[$i$$], $property$$ = $node$$.dataset.value, $node$$.setAttribute("value", Silica.getValue($node$$, $property$$)); - } -} -;function module$exports$compilers$generic() { - for (var $nodeList$$ = Silica.query(this, "[data-silica]"), $node$$, $entries$$, $comps_valueKey$$, $attribute$$, $params$$, $paramsKeys$$, $i$$ = $nodeList$$.length - 1; 0 <= $i$$; --$i$$) { - $node$$ = $nodeList$$[$i$$]; - $node$$._silica_generic ? $entries$$ = $node$$._silica_generic : ($entries$$ = $node$$.dataset.silica, $entries$$ = "[" === $entries$$.charAt(0) ? JSON.parse($entries$$) : [$entries$$], $node$$._silica_generic = $entries$$); - for (var $j$$ = $entries$$.length - 1; 0 <= $j$$; --$j$$) { - $comps_valueKey$$ = $entries$$[$j$$].split("="); - if (2 !== $comps_valueKey$$.length) { - console.error("Invalid generic binding", $node$$.dataset.silica, "for node", $node$$); - return; - } - $attribute$$ = $comps_valueKey$$[0]; - $comps_valueKey$$ = $comps_valueKey$$[1]; - $paramsKeys$$ = $comps_valueKey$$.match("\\((.*)\\)"); - if (null !== $paramsKeys$$) { - $paramsKeys$$.shift(); - $params$$ = []; - for (var $j$8$$ = 0, $length$$ = $paramsKeys$$.length; $j$8$$ < $length$$; $j$8$$++) { - $params$$.push(Silica.getValue($node$$, $paramsKeys$$[$j$8$$])); - } - $comps_valueKey$$ = $comps_valueKey$$.substr(0, $comps_valueKey$$.indexOf("(")); - } - "innerHTML" !== $attribute$$ ? $node$$.setAttribute($attribute$$, Silica.getValue($node$$, $comps_valueKey$$, null, $params$$)) : $node$$.innerHTML = Silica.getValue($node$$, $comps_valueKey$$, null, $params$$); - } - } - Silica._capture_links(this); -} -;function module$exports$compilers$load() { - for (var $nodes$$ = Silica.query(this, "[data-load]"), $node$$ = null, $i$$ = $nodes$$.length - 1; 0 <= $i$$; --$i$$) { - $node$$ = $nodes$$[$i$$], $node$$._rt_live = !0, $node$$.onload = function $$node$$$onload$($evt$$) { - Silica._call(this, $evt$$, "load"); - }; +var module$exports$compilers$src = module$contents$compilers$src_Src; +function module$contents$compilers$srcset_defaultSrcSetForNode($node$$) { + switch($node$$.nodeName) { + case "IMG": + return "data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=="; + default: + return ""; } } -;function module$exports$compilers$mousedown() { - for (var $nodes$$ = Silica.query(this, "[data-mousedown]"), $node$$, $i$$ = $nodes$$.length - 1; 0 <= $i$$; --$i$$) { - $node$$ = $nodes$$[$i$$], $node$$._rt_live = !0, $node$$.onmousedown = function $$node$$$onmousedown$($evt$$) { - Silica._call(this, $evt$$, "mousedown"); - }; - } +function module$contents$compilers$srcset_SrcSetUpdater($_$$, $value$$) { + $value$$ !== this.srcset && this.setAttribute("srcset", $value$$ || ""); } -;function module$exports$compilers$mouseenter() { - for (var $nodes$$ = Silica.query(this, "[data-mouseenter]"), $node$$, $i$$ = $nodes$$.length - 1; 0 <= $i$$; --$i$$) { - $node$$ = $nodes$$[$i$$], $node$$._rt_live = !0, $node$$.onmouseenter = function $$node$$$onmouseenter$($evt$$) { - Silica._call(this, $evt$$, "mouseenter"); - }; +function module$contents$compilers$srcset_SrcSet($ctx$jscomp$7_nodes$$, $node$jscomp$15_value$$) { + $ctx$jscomp$7_nodes$$ = Silica.query(this, "[data-srcset]"); + for (let $i$$ = $ctx$jscomp$7_nodes$$.length - 1; 0 <= $i$$; --$i$$) { + $node$jscomp$15_value$$ = $ctx$jscomp$7_nodes$$[$i$$], Silica.observer.register($node$jscomp$15_value$$, $node$jscomp$15_value$$.dataset.srcset, module$contents$compilers$srcset_SrcSetUpdater, !1); } } -;function module$exports$compilers$mouseleave() { - for (var $nodes$$ = Silica.query(this, "[data-mouseleave]"), $node$$, $i$$ = $nodes$$.length - 1; 0 <= $i$$; --$i$$) { - $node$$ = $nodes$$[$i$$], $node$$._rt_live = !0, $node$$.onmouseleave = function $$node$$$onmouseleave$($evt$$) { - Silica._call(this, $evt$$, "mouseleave"); - }; - } +var module$exports$compilers$srcset = module$contents$compilers$srcset_SrcSet; +let module$contents$compilers$generic_attributeMappings = {innerhtml:"innerHTML", innerHtml:"innerHTML", innerText:"innerText", disabled:"disabled", }; +function module$contents$compilers$generic_AttributeFilter() { } -;function module$exports$compilers$mousemove() { - for (var $nodes$$ = Silica.query(this, "[data-mousemove]"), $node$$, $i$$ = $nodes$$.length - 1; 0 <= $i$$; --$i$$) { - $node$$ = $nodes$$[$i$$], $node$$._rt_live = !0, $node$$.onmousemove = function $$node$$$onmousemove$($evt$$) { - Silica._call(this, $evt$$, "mousemove"); - }; +module$contents$compilers$generic_AttributeFilter.prototype.acceptNode = function($node$$) { + for (let $key$$ in $node$$.dataset) { + if (!Silica.ignoredAttributes.has($key$$) && !$key$$.startsWith("on")) { + return NodeFilter.FILTER_ACCEPT; + } } + return NodeFilter.FILTER_REJECT; +}; +function module$contents$compilers$generic_createUpdater($attribute$$) { + return function($_$$, $value$$) { + ($_$$ = module$contents$compilers$generic_attributeMappings[$attribute$$]) ? this[$_$$] = $value$$ : this.setAttribute($attribute$$, $value$$); + }; } -;function module$exports$compilers$mouseout() { - for (var $nodes$$ = Silica.query(this, "[data-mouseout]"), $node$$, $i$$ = $nodes$$.length - 1; 0 <= $i$$; --$i$$) { - $node$$ = $nodes$$[$i$$], $node$$._rt_live = !0, $node$$.onmouseout = function $$node$$$onmouseout$($evt$$) { - Silica._call(this, $evt$$, "mouseout"); - }; +function module$contents$compilers$generic_Generic() { + for (var $nodes$$ = document.createNodeIterator(this, NodeFilter.SHOW_ELEMENT, new module$contents$compilers$generic_AttributeFilter), $node$$; $node$$ = $nodes$$.nextNode();) { + for (let $key$$ in $node$$.dataset) { + Silica.ignoredAttributes.has($key$$) || (!$key$$.startsWith("on") || 2 < $key$$.length && (90 < $key$$.charCodeAt(2) || 65 > $key$$.charCodeAt(2))) && Silica.observer.register($node$$, $node$$.dataset[$key$$], module$contents$compilers$generic_createUpdater($key$$)); + } } } -;function module$exports$compilers$mouseover() { - for (var $nodes$$ = Silica.query(this, "[data-mouseover]"), $node$$, $i$$ = $nodes$$.length - 1; 0 <= $i$$; --$i$$) { - $node$$ = $nodes$$[$i$$], $node$$._rt_live = !0, $node$$.onmouseover = function $$node$$$onmouseover$($evt$$) { - Silica._call(this, $evt$$, "mouseover"); +var module$exports$compilers$generic = module$contents$compilers$generic_Generic; +function module$contents$compilers$scroll_finished_ScrollFinished() { + var $nodes$$ = Silica.query(this, "[data-on-scroll-finished]"); + for (let $i$$ = $nodes$$.length - 1; 0 <= $i$$; --$i$$) { + var $node$$ = $nodes$$[$i$$]; + $node$$._rt_live = !0; + var $onScrollFinished$$ = Silica.debounce(function($element$$, $evt$$) { + Silica._call($element$$, $evt$$, "onScrollFinished"); + }, 50); + $node$$.onscroll = function($evt$$) { + this.dataset.scroll && Silica._call(this, $evt$$, "scroll"); + $onScrollFinished$$(this, $evt$$); }; } } -;function module$exports$compilers$mouseup() { - for (var $nodes$$ = Silica.query(this, "[data-mouseup]"), $node$$, $i$$ = $nodes$$.length - 1; 0 <= $i$$; --$i$$) { - $node$$ = $nodes$$[$i$$], $node$$._rt_live = !0, $node$$.onmouseup = function $$node$$$onmouseup$($evt$$) { - Silica._call(this, $evt$$, "mouseup"); - }; - } +var module$exports$compilers$scroll_finished = module$contents$compilers$scroll_finished_ScrollFinished; +function module$contents$compilers$with_createUpdater($target$$) { + return function($_$$, $value$$) { + Silica.setPropByString(Silica.getContext(this), $target$$, $value$$); + }; } -;function module$exports$compilers$mousewheel() { - for (var $nodes$$ = Silica.query(this, "[data-mousewheel]"), $node$$, $i$$ = $nodes$$.length - 1; 0 <= $i$$; --$i$$) { - $node$$ = $nodes$$[$i$$], $node$$._rt_live = !0, $node$$.onmousewheel = function $$node$$$onmousewheel$($evt$$) { - Silica._call(this, $evt$$, "mousewheel"); +function module$contents$compilers$with_With($ctx$jscomp$8_nodes$$) { + $ctx$jscomp$8_nodes$$ = Silica.query(this, "[data-with]"); + for (var $i$$ = $ctx$jscomp$8_nodes$$.length - 1; 0 <= $i$$; --$i$$) { + let $node$$ = $ctx$jscomp$8_nodes$$[$i$$]; + var $components_target$$ = $node$$.dataset["with"].split(" as "); + if (2 != $components_target$$.length) { + throw Error(`With used with invalid property: ${$node$$.dataset["with"]}`); + } + let $source$$ = $components_target$$[0].trim(); + $components_target$$ = $components_target$$[1].trim(); + let $context$$ = {}; + $context$$.$ctrl = Silica.getContext($node$$); + $node$$._rt_ctx = $context$$; + $context$$[$components_target$$] = null; + let $updater$$ = module$contents$compilers$with_createUpdater($components_target$$); + $node$$.onremove = function() { + Silica.observer.deregister($node$$, $source$$, $updater$$); }; + Silica.observer.register($node$$, $source$$, $updater$$); } } -;function module$exports$compilers$keydown($context$jscomp$1_elements$$) { - $context$jscomp$1_elements$$ = Silica.query(this, "[data-keydown]"); - for (var $i$$ = $context$jscomp$1_elements$$.length - 1; 0 <= $i$$; $i$$--) { - $context$jscomp$1_elements$$[$i$$].addEventListener("keydown", function($evt$$) { - Silica._call(this, $evt$$, "keydown"); - }); - } +var module$exports$compilers$with = module$contents$compilers$with_With; +function module$contents$compilers$event_EventFilter() { } -;function module$exports$compilers$keyup($context$jscomp$2_elements$$) { - $context$jscomp$2_elements$$ = Silica.query(this, "[data-keyup]"); - for (var $i$$ = $context$jscomp$2_elements$$.length - 1; 0 <= $i$$; $i$$--) { - $context$jscomp$2_elements$$[$i$$].addEventListener("keyup", function($evt$$) { - Silica._call(this, $evt$$, "keyup"); - }); +module$contents$compilers$event_EventFilter.prototype.acceptNode = function($node$$) { + return Object.keys($node$$.dataset).some(function($key$$) { + return 3 <= $key$$.length && $key$$.startsWith("on") && 90 >= $key$$.charCodeAt(2) && 65 <= $key$$.charCodeAt(2); + }) ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_REJECT; +}; +function module$contents$compilers$event_Event() { + for (var $nodes$$ = document.createNodeIterator(this, NodeFilter.SHOW_ELEMENT, new module$contents$compilers$event_EventFilter), $node$$; $node$$ = $nodes$$.nextNode();) { + $node$$._rt_live = !0; + for (let $key$$ of Object.keys($node$$.dataset)) { + if (3 <= $key$$.length && $key$$.startsWith("on") && 90 >= $key$$.charCodeAt(2) && 65 <= $key$$.charCodeAt(2)) { + let $eventName$$ = $key$$.substr(2).toLowerCase(); + $node$$.addEventListener($eventName$$, function($evt$$) { + Silica._call(this, $evt$$, $key$$); + }); + } + } } } -;function module$exports$compilers$touch$start() { - for (var $nodes$$ = Silica.query(this, "[data-touchstart]"), $node$$, $i$$ = $nodes$$.length - 1; 0 <= $i$$; --$i$$) { - $node$$ = $nodes$$[$i$$], $node$$._rt_live = !0, $node$$.ontouchstart = function $$node$$$ontouchstart$($evt$$) { - Silica._call(this, $evt$$, "touchstart"); - }; +var module$exports$compilers$event = module$contents$compilers$event_Event; +var module$exports$compilers = {"1_Directive":module$contents$compilers$directives_directives, _if:module$contents$compilers$if__if, Show:module$contents$compilers$show_Show, Class:module$contents$compilers$class_Class, Include:module$contents$compilers$include_Include, Controller:module$contents$compilers$controller_ControllerCompiler, ClickOutside:module$contents$compilers$clickoutside_ClickOutside, Src:module$contents$compilers$src_Src, SrcSet:module$contents$compilers$srcset_SrcSet, ScrollFinished:module$contents$compilers$scroll_finished_ScrollFinished, +Generic:module$contents$compilers$generic_Generic, Model:module$contents$compilers$model_Model, Event:module$contents$compilers$event_Event, With:module$contents$compilers$with_With, }; +class module$exports$controllers$Base { + constructor($el$$) { + this.el = $el$$; + $el$$.parentElement && (this.$ctrl = Silica.getContext($el$$.parentElement)); } -} -;function module$exports$compilers$touch$cancel() { - for (var $nodes$$ = Silica.query(this, "[data-touchcancel]"), $node$$, $i$$ = $nodes$$.length - 1; 0 <= $i$$; --$i$$) { - $node$$ = $nodes$$[$i$$], $node$$._rt_live = !0, $node$$.ontouchcancel = function $$node$$$ontouchcancel$($evt$$) { - Silica._call(this, $evt$$, "touchcancel"); - }; + $($selector$$) { + return this.el.querySelectorAll($selector$$); } } -;function module$exports$compilers$touch$end() { - for (var $nodes$$ = Silica.query(this, "[data-touchend]"), $node$$, $i$$ = $nodes$$.length - 1; 0 <= $i$$; --$i$$) { - $node$$ = $nodes$$[$i$$], $node$$._rt_live = !0, $node$$.ontouchend = function $$node$$$ontouchend$($evt$$) { - Silica._call(this, $evt$$, "touchend"); - }; +module$exports$controllers$Base.watchers = {}; +module$exports$controllers$Base.prototype.$ = module$exports$controllers$Base.prototype.$; +var module$exports$controllers$FSM = {}; +class module$contents$controllers$FSM_State { + onEnter($ctrl$$) { } -} -;function module$exports$compilers$touch$move() { - for (var $nodes$$ = Silica.query(this, "[data-touchmove]"), $node$$, $i$$ = $nodes$$.length - 1; 0 <= $i$$; --$i$$) { - $node$$ = $nodes$$[$i$$], $node$$._rt_live = !0, $node$$.ontouchmove = function $$node$$$ontouchmove$($evt$$) { - Silica._call(this, $evt$$, "touchmove"); - }; + onExit($ctrl$$) { } } -;var module$exports$compilers = {"1_Directive":module$exports$compilers$directives, _if:module$exports$compilers$if, "2_Value":module$exports$compilers$value, Show:module$exports$compilers$show, Class:module$exports$compilers$class, Disabled:module$exports$compilers$disabled, Href:module$exports$compilers$href, Style:module$exports$compilers$style, Include:module$exports$compilers$include, Controller:module$exports$compilers$controller, Click:module$exports$compilers$click, ClickOutside:module$exports$compilers$clickoutside, -DoubleClick:module$exports$compilers$double_click, Blur:module$exports$compilers$blur, Focus:module$exports$compilers$focus, Submit:module$exports$compilers$submit, Src:module$exports$compilers$src, Scroll:module$exports$compilers$scroll, ScrollFinished:module$exports$compilers$scroll_finished, Generic:module$exports$compilers$generic, Model:module$exports$compilers$model, Load:module$exports$compilers$load, MouseDown:module$exports$compilers$mousedown, MouseUp:module$exports$compilers$mouseup, MouseOut:module$exports$compilers$mouseout, -MouseMove:module$exports$compilers$mousemove, MouseWheel:module$exports$compilers$mousewheel, MouseLeave:module$exports$compilers$mouseleave, MouseEnter:module$exports$compilers$mouseenter, MouseOver:module$exports$compilers$mouseover, KeyDown:module$exports$compilers$keydown, KeyUp:module$exports$compilers$keyup, TouchStart:module$exports$compilers$touch$start, TouchCancel:module$exports$compilers$touch$cancel, TouchEnd:module$exports$compilers$touch$end, TouchMove:module$exports$compilers$touch$move}; -var module$exports$controllers$Base = function $module$exports$controllers$Base$($el$$) { - this.el = $el$$; - $el$$.parentElement && (this.$ctrl = Silica.getContext($el$$.parentElement)); -}; -module$exports$controllers$Base.prototype.$ = function $module$exports$controllers$Base$$$$($selector$$) { - return this.el.querySelectorAll($selector$$); -}; -module$exports$controllers$Base.watchers = {}; -module$exports$controllers$Base.prototype.$ = module$exports$controllers$Base.prototype.$; -var module$exports$controllers$FSM = {}, module$contents$controllers$FSM_State = function $module$contents$controllers$FSM_State$() { -}; -module$contents$controllers$FSM_State.prototype.onEnter = function $module$contents$controllers$FSM_State$$onEnter$($ctrl$$) { -}; -module$contents$controllers$FSM_State.prototype.onExit = function $module$contents$controllers$FSM_State$$onExit$($ctrl$$) { -}; module$contents$controllers$FSM_State.prototype.onEnter = module$contents$controllers$FSM_State.prototype.onEnter; module$contents$controllers$FSM_State.prototype.onExit = module$contents$controllers$FSM_State.prototype.onExit; -var module$contents$controllers$FSM_Controller = function $module$contents$controllers$FSM_Controller$($el$$) { - module$exports$controllers$Base.call(this, $el$$); - var $$jscomp$this$$ = this; - $el$$ = this.constructor.states; - this._states = {}; - for (var $stateName$$ in $el$$) { - this._states[$stateName$$] = new $el$$[$stateName$$]; - } - this.handle = this.handle; - this.transition = this.transition; - this._currentState = new module$contents$controllers$FSM_State; - this._previousStateName = ""; - this.initialState && (this._currentStateName = this.initialState(), this._currentState = this._getStateWithName(this._currentStateName), Silica.defer(function() { - $$jscomp$this$$._currentState.onEnter($$jscomp$this$$); - })); -}; -$jscomp.inherits(module$contents$controllers$FSM_Controller, module$exports$controllers$Base); -module$contents$controllers$FSM_Controller.prototype._getStateWithName = function $module$contents$controllers$FSM_Controller$$_getStateWithName$($stateName$$) { - var $target$$ = this._states[$stateName$$]; - if (!$target$$) { - throw Error("Unknown state " + $stateName$$ + " in " + this.constructor.name); +class module$contents$controllers$FSM_Controller extends module$exports$controllers$Base { + constructor($el$$) { + super($el$$); + $el$$ = this.constructor.states; + this._states = {}; + for (const $stateName$$ in $el$$) { + this._states[$stateName$$] = new $el$$[$stateName$$]; + } + this.handle = this.handle; + this.transition = this.transition; + this._currentState = new module$contents$controllers$FSM_State; + this._previousStateName = ""; + this.initialState && (this._currentStateName = this.initialState(), this._currentState = this._getStateWithName(this._currentStateName), Silica.defer(() => { + this._currentState.onEnter(this); + })); } - return $target$$; -}; -module$contents$controllers$FSM_Controller.prototype.transition = function $module$contents$controllers$FSM_Controller$$transition$($stateName$$, $args$$) { - for (var $$jscomp$restParams$$ = [], $$jscomp$restIndex$$ = 1; $$jscomp$restIndex$$ < arguments.length; ++$$jscomp$restIndex$$) { - $$jscomp$restParams$$[$$jscomp$restIndex$$ - 1] = arguments[$$jscomp$restIndex$$]; - } - var $$jscomp$this$$ = this, $target$$ = this._getStateWithName($stateName$$); - $target$$ !== this._currentState && Silica.defer(function() { - $$jscomp$this$$._previousStateName = $$jscomp$this$$._currentStateName; - $$jscomp$this$$._currentState.onExit($$jscomp$this$$); - $$jscomp$this$$._currentState = $target$$; - $$jscomp$this$$._currentStateName = $stateName$$; - Silica.defer(function() { - $$jscomp$this$$._currentState.onEnter.apply(null, [$$jscomp$this$$].concat($jscomp.arrayFromIterable($$jscomp$restParams$$))); - }); - }); -}; -module$contents$controllers$FSM_Controller.prototype.handle = function $module$contents$controllers$FSM_Controller$$handle$($functionName$$, $args$$) { - for (var $$jscomp$restParams$$ = [], $$jscomp$restIndex$jscomp$1_func$$ = 1; $$jscomp$restIndex$jscomp$1_func$$ < arguments.length; ++$$jscomp$restIndex$jscomp$1_func$$) { - $$jscomp$restParams$$[$$jscomp$restIndex$jscomp$1_func$$ - 1] = arguments[$$jscomp$restIndex$jscomp$1_func$$]; + static get states() { + return {base:module$contents$controllers$FSM_State}; } - if (this._currentState && ($$jscomp$restIndex$jscomp$1_func$$ = this._currentState[$functionName$$])) { - return "function" === typeof $$jscomp$restIndex$jscomp$1_func$$ ? $$jscomp$restIndex$jscomp$1_func$$.apply(this._currentState, [this].concat($jscomp.arrayFromIterable($$jscomp$restParams$$))) : $$jscomp$restIndex$jscomp$1_func$$; + _getStateWithName($stateName$$) { + let $target$$ = this._states[$stateName$$]; + if (!$target$$) { + throw Error(`Unknown state ${$stateName$$} in ${this.constructor.name}`); + } + return $target$$; } -}; -$jscomp.global.Object.defineProperties(module$contents$controllers$FSM_Controller, {states:{configurable:!0, enumerable:!0, get:function() { - return {base:module$contents$controllers$FSM_State}; -}}}); + transition($stateName$$, ...$args$$) { + let $target$$ = this._getStateWithName($stateName$$); + $target$$ !== this._currentState && (this._previousStateName = this._currentStateName, this._currentState.onExit(this), this._currentState = $target$$, this._currentStateName = $stateName$$, this._currentState.onEnter(this, ...$args$$)); + } + handle($func$$, ...$args$$) { + if (this._currentState && ($func$$ = this._currentState[$func$$])) { + return "function" === typeof $func$$ ? $func$$.apply(this._currentState, [this, ...$args$$]) : $func$$; + } + } +} Object.defineProperties(module$contents$controllers$FSM_Controller.prototype, {currentState:{configurable:0, enumerable:0, get:function() { return this._currentStateName; }}, previousState:{configurable:0, enumerable:0, get:function() { @@ -1043,33 +665,16 @@ Object.defineProperties(module$contents$controllers$FSM_Controller.prototype, {c module$exports$controllers$FSM.Controller = module$contents$controllers$FSM_Controller; module$exports$controllers$FSM.State = module$contents$controllers$FSM_State; var module$exports$controllers = {Base:module$exports$controllers$Base, FSM:module$exports$controllers$FSM}; -var module$exports$hax$safari = {getDatasetProperty:function($element$$, $propName$$) { - if ($element$$.dataset && "undefined" !== typeof $element$$.dataset && $element$$.dataset[$propName$$]) { - return $element$$.dataset[$propName$$]; - } - if ("undefined" !== typeof Reflect) { - var $dataset_value$$ = Reflect.get($element$$, "dataset"); - if ($dataset_value$$ && ($dataset_value$$ = Reflect.get(Object($dataset_value$$), $propName$$))) { - return $dataset_value$$; - } - } - return $element$$.getAttribute("data-" + $propName$$); -}, hasDatasetProperty:function($element$$, $propName$$) { - return !!(0,module$exports$hax$safari.getDatasetProperty)($element$$, $propName$$); -}}; -var module$exports$hax = {}, module$contents$hax_reduce = Function.bind.call(Function.call, Array.prototype.reduce), module$contents$hax_isEnumerable = Function.bind.call(Function.call, Object.prototype.propertyIsEnumerable), module$contents$hax_concat = Function.bind.call(Function.call, Array.prototype.concat), module$contents$hax_keys = Reflect.ownKeys; -module$exports$hax.init = function $module$exports$hax$init$() { - Object.values || (Object.values = function values($O$$) { - return module$contents$hax_reduce(module$contents$hax_keys($O$$), function($v$$, $k$$) { - return module$contents$hax_concat($v$$, "string" === typeof $k$$ && module$contents$hax_isEnumerable($O$$, $k$$) ? [$O$$[$k$$]] : []); - }, []); +var module$exports$hax = {}; +const module$contents$hax_reduce = Function.bind.call(Function.call, Array.prototype.reduce), module$contents$hax_isEnumerable = Function.bind.call(Function.call, Object.prototype.propertyIsEnumerable), module$contents$hax_concat = Function.bind.call(Function.call, Array.prototype.concat), module$contents$hax_keys = Reflect.ownKeys; +module$exports$hax.init = function() { + Object.values || (Object.values = function($O$$) { + return module$contents$hax_reduce(module$contents$hax_keys($O$$), ($v$$, $k$$) => module$contents$hax_concat($v$$, "string" === typeof $k$$ && module$contents$hax_isEnumerable($O$$, $k$$) ? [$O$$[$k$$]] : []), []); }); - Object.entries || (Object.entries = function entries($O$$) { - return module$contents$hax_reduce(module$contents$hax_keys($O$$), function($e$$, $k$$) { - return module$contents$hax_concat($e$$, "string" === typeof $k$$ && module$contents$hax_isEnumerable($O$$, $k$$) ? [[$k$$, $O$$[$k$$]]] : []); - }, []); + Object.entries || (Object.entries = function($O$$) { + return module$contents$hax_reduce(module$contents$hax_keys($O$$), ($e$$, $k$$) => module$contents$hax_concat($e$$, "string" === typeof $k$$ && module$contents$hax_isEnumerable($O$$, $k$$) ? [[$k$$, $O$$[$k$$]]] : []), []); }); - Array.prototype.includes || Object.defineProperty(Array.prototype, "includes", {value:function($searchElement$$, $fromIndex_k$jscomp$5_n$$) { + Array.prototype.includes || Object.defineProperty(Array.prototype, "includes", {value:function($searchElement$$, $fromIndex_k$jscomp$8_n$$) { if (null == this) { throw new TypeError('"this" is null or not defined'); } @@ -1077,278 +682,264 @@ module$exports$hax.init = function $module$exports$hax$init$() { if (0 === $len$$) { return !1; } - $fromIndex_k$jscomp$5_n$$ |= 0; - for ($fromIndex_k$jscomp$5_n$$ = Math.max(0 <= $fromIndex_k$jscomp$5_n$$ ? $fromIndex_k$jscomp$5_n$$ : $len$$ - Math.abs($fromIndex_k$jscomp$5_n$$), 0); $fromIndex_k$jscomp$5_n$$ < $len$$;) { - var $x$$ = $o$$[$fromIndex_k$jscomp$5_n$$], $y$$ = $searchElement$$; + $fromIndex_k$jscomp$8_n$$ |= 0; + for ($fromIndex_k$jscomp$8_n$$ = Math.max(0 <= $fromIndex_k$jscomp$8_n$$ ? $fromIndex_k$jscomp$8_n$$ : $len$$ - Math.abs($fromIndex_k$jscomp$8_n$$), 0); $fromIndex_k$jscomp$8_n$$ < $len$$;) { + var $x$$ = $o$$[$fromIndex_k$jscomp$8_n$$], $y$$ = $searchElement$$; if ($x$$ === $y$$ || "number" === typeof $x$$ && "number" === typeof $y$$ && isNaN($x$$) && isNaN($y$$)) { return !0; } - $fromIndex_k$jscomp$5_n$$++; + $fromIndex_k$jscomp$8_n$$++; } return !1; }}); }; -module$exports$hax.getDatasetProperty = module$exports$hax$safari.getDatasetProperty; -module$exports$hax.hasDatasetProperty = module$exports$hax$safari.hasDatasetProperty; var module$exports$silica$pubsub = {}, module$contents$silica$pubsub_subscriptions = new Map, module$contents$silica$pubsub_subscriptionID = 1, module$contents$silica$pubsub_subscriptionSeparator = "[--+--]"; function module$contents$silica$pubsub_nextSubscriptionID() { return module$contents$silica$pubsub_subscriptionID++; } -module$exports$silica$pubsub.Sub = function $module$exports$silica$pubsub$Sub$($channel$$, $handler$$, $context$$) { - $context$$ = void 0 === $context$$ ? document : $context$$; - var $subs$$ = module$contents$silica$pubsub_subscriptions.get($channel$$); +function module$contents$silica$pubsub_sub($channel$$, $handler$$, $context$$ = document) { + let $subs$$ = module$contents$silica$pubsub_subscriptions.get($channel$$); $subs$$ || ($subs$$ = new Map, module$contents$silica$pubsub_subscriptions.set($channel$$, $subs$$)); - var $id$$ = module$contents$silica$pubsub_nextSubscriptionID(); + let $id$$ = module$contents$silica$pubsub_nextSubscriptionID(); $subs$$.set($id$$, [$handler$$, $context$$]); - return "" + $channel$$ + module$contents$silica$pubsub_subscriptionSeparator + $id$$; -}; -module$exports$silica$pubsub.Pub = function $module$exports$silica$pubsub$Pub$($channel$$, $args$$) { - for (var $$jscomp$restParams$$ = [], $$jscomp$restIndex$$ = 1; $$jscomp$restIndex$$ < arguments.length; ++$$jscomp$restIndex$$) { - $$jscomp$restParams$$[$$jscomp$restIndex$$ - 1] = arguments[$$jscomp$restIndex$$]; - } - var $subs$$ = module$contents$silica$pubsub_subscriptions.get($channel$$); - $subs$$ && setTimeout(function() { - for (var $$jscomp$loop$29$$ = {}, $$jscomp$iter$1$$ = $jscomp.makeIterator($subs$$), $$jscomp$destructuring$var1_$jscomp$key$$$ = $$jscomp$iter$1$$.next(); !$$jscomp$destructuring$var1_$jscomp$key$$$.done; $$jscomp$loop$29$$ = {value:$$jscomp$loop$29$$.value}, $$jscomp$destructuring$var1_$jscomp$key$$$ = $$jscomp$iter$1$$.next()) { - $$jscomp$destructuring$var1_$jscomp$key$$$ = $jscomp.makeIterator($$jscomp$destructuring$var1_$jscomp$key$$$.value), $$jscomp$destructuring$var1_$jscomp$key$$$.next(), $$jscomp$loop$29$$.value = $$jscomp$destructuring$var1_$jscomp$key$$$.next().value, Silica.enqueue(function($$jscomp$loop$29$$) { - return function() { - $$jscomp$loop$29$$.value[0].apply(null, $jscomp.arrayFromIterable($$jscomp$restParams$$)); - }; - }($$jscomp$loop$29$$), $$jscomp$loop$29$$.value[1]); + return `${$channel$$}${module$contents$silica$pubsub_subscriptionSeparator}${$id$$}`; +} +function module$contents$silica$pubsub_pub($channel$$, ...$args$$) { + let $subs$$ = module$contents$silica$pubsub_subscriptions.get($channel$$); + $subs$$ && window.requestAnimationFrame(function() { + for (let [, $value$$] of $subs$$) { + Silica.apply(function() { + $value$$[0](...$args$$); + }, $value$$[1]); } - }, 0); -}; -module$exports$silica$pubsub.Unsub = function $module$exports$silica$pubsub$Unsub$($channel$$) { - var $$jscomp$destructuring$var2_id$$ = $jscomp.makeIterator($channel$$.split(module$contents$silica$pubsub_subscriptionSeparator)); - $channel$$ = $$jscomp$destructuring$var2_id$$.next().value; - $$jscomp$destructuring$var2_id$$ = $$jscomp$destructuring$var2_id$$.next().value; - var $subs$$ = module$contents$silica$pubsub_subscriptions.get($channel$$); - $subs$$ && ($subs$$.delete(parseInt($$jscomp$destructuring$var2_id$$, 10)), 0 === $subs$$.size && module$contents$silica$pubsub_subscriptions.delete($channel$$)); -}; -function module$exports$watchers$if() { - var $comment$jscomp$1_compiled_isVisible$jscomp$2_subNodes$jscomp$1_temp$$, $k$$, $negate$$, $_len$$, $wrapper$$ = document.createElement("div"); - var $_ref$$ = Silica._ifs; - for ($k$$ in $_ref$$) { - var $elements$$ = $_ref$$[$k$$]; + }); +} +function module$contents$silica$pubsub_unsub($subs$$) { + let [$channel$$, $id$$] = $subs$$.split(module$contents$silica$pubsub_subscriptionSeparator); + if ($subs$$ = module$contents$silica$pubsub_subscriptions.get($channel$$)) { + $subs$$.delete(parseInt($id$$, 10)), 0 === $subs$$.size && module$contents$silica$pubsub_subscriptions.delete($channel$$); + } +} +module$exports$silica$pubsub.Pub = module$contents$silica$pubsub_pub; +module$exports$silica$pubsub.Sub = module$contents$silica$pubsub_sub; +module$exports$silica$pubsub.Unsub = module$contents$silica$pubsub_unsub; +function module$contents$watchers$if__If() { + var $comment$jscomp$1_compiled_isVisible$jscomp$1_subNodes$jscomp$1_temp$$, $k$$, $negate$$, $_len$$, $wrapper$$ = document.createElement("div"); + var $_ref$jscomp$0$$ = Silica._ifs; + for ($k$$ in $_ref$jscomp$0$$) { + var $elements$$ = $_ref$jscomp$0$$[$k$$]; var $raw$$ = $k$$; ($negate$$ = "!" === $k$$[0]) && ($k$$ = $k$$.substr(1)); - var $$jscomp$loop$30$$ = {}; var $i$$ = 0; - for ($_len$$ = $elements$$.length; $i$$ < $_len$$; $$jscomp$loop$30$$ = {subNode:$$jscomp$loop$30$$.subNode}, ++$i$$) { - var $_ref$12_element$$ = $elements$$[$i$$]; - if ($_ref$12_element$$ === this || Silica.isDescendent(this, $_ref$12_element$$)) { - if ($comment$jscomp$1_compiled_isVisible$jscomp$2_subNodes$jscomp$1_temp$$ = Silica._show($_ref$12_element$$, $k$$, $negate$$)) { - if (8 === $_ref$12_element$$.nodeType && ($comment$jscomp$1_compiled_isVisible$jscomp$2_subNodes$jscomp$1_temp$$ = document.createElement("div"), $comment$jscomp$1_compiled_isVisible$jscomp$2_subNodes$jscomp$1_temp$$.innerHTML = $_ref$12_element$$.nodeValue, $comment$jscomp$1_compiled_isVisible$jscomp$2_subNodes$jscomp$1_temp$$ = Silica.compile($comment$jscomp$1_compiled_isVisible$jscomp$2_subNodes$jscomp$1_temp$$.firstElementChild, !1, Silica.getContext($_ref$12_element$$.parentElement)), - $_ref$12_element$$.parentNode.replaceChild($comment$jscomp$1_compiled_isVisible$jscomp$2_subNodes$jscomp$1_temp$$, $_ref$12_element$$), Silica._ifs[$raw$$][$i$$] = $comment$jscomp$1_compiled_isVisible$jscomp$2_subNodes$jscomp$1_temp$$, $_ref$12_element$$ = void 0, null != ($_ref$12_element$$ = Silica.getContext($comment$jscomp$1_compiled_isVisible$jscomp$2_subNodes$jscomp$1_temp$$)) && "function" === typeof $_ref$12_element$$.onLoad && $_ref$12_element$$.el === $comment$jscomp$1_compiled_isVisible$jscomp$2_subNodes$jscomp$1_temp$$)) { - $_ref$12_element$$.onLoad(); + for ($_len$$ = $elements$$.length; $i$$ < $_len$$; ++$i$$) { + let $element$$ = $elements$$[$i$$]; + if ($element$$ === this || Silica.isDescendent(this, $element$$)) { + if ($comment$jscomp$1_compiled_isVisible$jscomp$1_subNodes$jscomp$1_temp$$ = Silica._show($element$$, $k$$, $negate$$)) { + if (8 === $element$$.nodeType) { + $comment$jscomp$1_compiled_isVisible$jscomp$1_subNodes$jscomp$1_temp$$ = document.createElement("div"); + $comment$jscomp$1_compiled_isVisible$jscomp$1_subNodes$jscomp$1_temp$$.innerHTML = $element$$.nodeValue; + $comment$jscomp$1_compiled_isVisible$jscomp$1_subNodes$jscomp$1_temp$$ = Silica.compile($comment$jscomp$1_compiled_isVisible$jscomp$1_subNodes$jscomp$1_temp$$.firstElementChild, !1, Silica.getContext($element$$.parentElement)); + $element$$.parentNode.replaceChild($comment$jscomp$1_compiled_isVisible$jscomp$1_subNodes$jscomp$1_temp$$, $element$$); + Silica._ifs[$raw$$][$i$$] = $comment$jscomp$1_compiled_isVisible$jscomp$1_subNodes$jscomp$1_temp$$; + let $_ref$$; + if (null != ($_ref$$ = Silica.getContext($comment$jscomp$1_compiled_isVisible$jscomp$1_subNodes$jscomp$1_temp$$)) && "function" === typeof $_ref$$.onLoad && $_ref$$.el === $comment$jscomp$1_compiled_isVisible$jscomp$1_subNodes$jscomp$1_temp$$) { + $_ref$$.onLoad(); + } } } else { - if (8 !== $_ref$12_element$$.nodeType) { - $comment$jscomp$1_compiled_isVisible$jscomp$2_subNodes$jscomp$1_temp$$ = Silica.queryWithComments($_ref$12_element$$, "[data-if]"); - $$jscomp$loop$30$$.subNode = void 0; - for (var $$jscomp$loop$31_j$$ = $comment$jscomp$1_compiled_isVisible$jscomp$2_subNodes$jscomp$1_temp$$.length - 1; 0 <= $$jscomp$loop$31_j$$; --$$jscomp$loop$31_j$$) { - var $list$$ = void 0, $_ref1$$; - $$jscomp$loop$30$$.subNode = $comment$jscomp$1_compiled_isVisible$jscomp$2_subNodes$jscomp$1_temp$$[$$jscomp$loop$31_j$$]; - if (8 !== $$jscomp$loop$30$$.subNode.nodeType || $$jscomp$loop$30$$.subNode.dataset) { - var $j$13_prop$$ = $$jscomp$loop$30$$.subNode.dataset["if"]; - } else { - $wrapper$$.innerHTML = $$jscomp$loop$30$$.subNode.data, $j$13_prop$$ = $wrapper$$.firstChild.dataset["if"]; - } - $list$$ = Silica._shws[$j$13_prop$$]; - Silica._shws[$j$13_prop$$] = null != ($_ref1$$ = null != $list$$ ? $list$$.filter(function($$jscomp$loop$30$$) { - return function($obj$$) { - return !$obj$$ === $$jscomp$loop$30$$.subNode; - }; - }($$jscomp$loop$30$$)) : void 0) ? $_ref1$$ : []; + if (8 !== $element$$.nodeType) { + $comment$jscomp$1_compiled_isVisible$jscomp$1_subNodes$jscomp$1_temp$$ = Silica.queryWithComments($element$$, "[data-if]"); + let $subNode$$; + for (var $j$jscomp$4_j$$ = $comment$jscomp$1_compiled_isVisible$jscomp$1_subNodes$jscomp$1_temp$$.length - 1; 0 <= $j$jscomp$4_j$$; --$j$jscomp$4_j$$) { + var $list$jscomp$2_list$$ = void 0; + let $prop$$, $_ref1$$; + $subNode$$ = $comment$jscomp$1_compiled_isVisible$jscomp$1_subNodes$jscomp$1_temp$$[$j$jscomp$4_j$$]; + 8 !== $subNode$$.nodeType || $subNode$$.dataset ? $prop$$ = $subNode$$.dataset["if"] : ($wrapper$$.innerHTML = $subNode$$.data, $prop$$ = $wrapper$$.firstChild.dataset["if"]); + $list$jscomp$2_list$$ = Silica._shws[$prop$$]; + Silica._shws[$prop$$] = null != ($_ref1$$ = null != $list$jscomp$2_list$$ ? $list$jscomp$2_list$$.filter(function($obj$$) { + return !$obj$$ === $subNode$$; + }) : void 0) ? $_ref1$$ : []; } - $comment$jscomp$1_compiled_isVisible$jscomp$2_subNodes$jscomp$1_temp$$ = Silica.query($_ref$12_element$$, "[data-controller]"); - $$jscomp$loop$31_j$$ = {}; - for ($j$13_prop$$ = $comment$jscomp$1_compiled_isVisible$jscomp$2_subNodes$jscomp$1_temp$$.length - 1; 0 <= $j$13_prop$$; $$jscomp$loop$31_j$$ = {ctrl:$$jscomp$loop$31_j$$.ctrl}, --$j$13_prop$$) { - for ($k$$ in $$jscomp$loop$31_j$$.ctrl = void 0, $$jscomp$loop$30$$.subNode = $comment$jscomp$1_compiled_isVisible$jscomp$2_subNodes$jscomp$1_temp$$[$j$13_prop$$], $$jscomp$loop$31_j$$.ctrl = $$jscomp$loop$30$$.subNode._rt_ctrl, null != $$jscomp$loop$31_j$$.ctrl ? $$jscomp$loop$31_j$$.ctrl.constructor.watchers : void 0) { - $list$$ = Silica._watch[$k$$], Silica._watch[$k$$] = null != $list$$ ? $list$$.filter(function($$jscomp$loop$31$$) { - return function($obj$$) { - return $obj$$[0] !== $$jscomp$loop$31$$.ctrl; - }; - }($$jscomp$loop$31_j$$)) : []; + $comment$jscomp$1_compiled_isVisible$jscomp$1_subNodes$jscomp$1_temp$$ = Silica.query($element$$, "[data-controller]"); + for ($j$jscomp$4_j$$ = $comment$jscomp$1_compiled_isVisible$jscomp$1_subNodes$jscomp$1_temp$$.length - 1; 0 <= $j$jscomp$4_j$$; --$j$jscomp$4_j$$) { + let $ctrl$$; + $subNode$$ = $comment$jscomp$1_compiled_isVisible$jscomp$1_subNodes$jscomp$1_temp$$[$j$jscomp$4_j$$]; + $ctrl$$ = $subNode$$._rt_ctrl; + for ($k$$ in null != $ctrl$$ ? $ctrl$$.constructor.watchers : void 0) { + $list$jscomp$2_list$$ = Silica._watch[$k$$], Silica._watch[$k$$] = null != $list$jscomp$2_list$$ ? $list$jscomp$2_list$$.filter(function($obj$$) { + return $obj$$[0] !== $ctrl$$; + }) : []; } } - $comment$jscomp$1_compiled_isVisible$jscomp$2_subNodes$jscomp$1_temp$$ = document.createComment($_ref$12_element$$.outerHTML); - $_ref$12_element$$.parentNode.replaceChild($comment$jscomp$1_compiled_isVisible$jscomp$2_subNodes$jscomp$1_temp$$, $_ref$12_element$$); - Silica._ifs[$raw$$][$i$$] = $comment$jscomp$1_compiled_isVisible$jscomp$2_subNodes$jscomp$1_temp$$; + $comment$jscomp$1_compiled_isVisible$jscomp$1_subNodes$jscomp$1_temp$$ = document.createComment($element$$.outerHTML); + $element$$.parentNode.replaceChild($comment$jscomp$1_compiled_isVisible$jscomp$1_subNodes$jscomp$1_temp$$, $element$$); + Silica._ifs[$raw$$][$i$$] = $comment$jscomp$1_compiled_isVisible$jscomp$1_subNodes$jscomp$1_temp$$; } } } } } } -;function module$exports$watchers$repeat() { - for (var $changed_obj$jscomp$38_oldList_template$$, $child_node$$, $context$jscomp$4_keys$$, $ctx$$, $list$jscomp$4_newList_param$$, $model$$, $_i_countDiff_j$$, $_len$jscomp$1_fragment$jscomp$1_len$$, $_ref$$, $raw$$, $elements$$ = Silica.querySorted(this, "[data-repeat]"), $i$$ = 0, $length$$ = $elements$$.length; $i$$ < $length$$; ++$i$$) { - if ($raw$$ = $elements$$[$i$$], $ctx$$ = $raw$$.dataset.repeat.split(/\s+in\s+/), $list$jscomp$4_newList_param$$ = $ctx$$[1], $model$$ = $ctx$$[0], $ctx$$ = Silica.getContext($raw$$), "undefined" !== typeof($_ref$$ = $list$jscomp$4_newList_param$$.match(/((?:\w|\.)+)(?:\(([\w\.]+)\))*/))[2] ? ($list$jscomp$4_newList_param$$ = $_ref$$[2], $list$jscomp$4_newList_param$$ = Silica.getValue($raw$$.parentNode, $list$jscomp$4_newList_param$$), $list$jscomp$4_newList_param$$ = Silica.getValue($raw$$, - $_ref$$[1], null, $list$jscomp$4_newList_param$$)) : $list$jscomp$4_newList_param$$ = Silica.getValue($raw$$, $list$jscomp$4_newList_param$$), $context$jscomp$4_keys$$ = Silica.hasher(JSON.stringify($list$jscomp$4_newList_param$$, function($key$$, $value$$) { - if ($key$$.constructor !== String || "__elm" !== $key$$ && "$ctrl" !== $key$$ && 95 !== $key$$.charCodeAt(0)) { - return $value$$; - } - })), $_ref$$ = $raw$$.childNodes, $changed_obj$jscomp$38_oldList_template$$ = ($changed_obj$jscomp$38_oldList_template$$ = $raw$$._rt_repeat_list) && $list$jscomp$4_newList_param$$ ? $changed_obj$jscomp$38_oldList_template$$ !== $context$jscomp$4_keys$$ : !0) { - if ($raw$$._rt_repeat_list = $list$jscomp$4_newList_param$$ ? $context$jscomp$4_keys$$ : null, $list$jscomp$4_newList_param$$) { - $list$jscomp$4_newList_param$$.constructor === Number && ($list$jscomp$4_newList_param$$ = Array($list$jscomp$4_newList_param$$)); - $changed_obj$jscomp$38_oldList_template$$ = Silica._repeat_templates[module$exports$hax$safari.getDatasetProperty($raw$$, "_rt_repeat_template")]; - if ($list$jscomp$4_newList_param$$.constructor === Object) { - $context$jscomp$4_keys$$ = Object.keys($list$jscomp$4_newList_param$$); - $child_node$$ = $list$jscomp$4_newList_param$$; - $list$jscomp$4_newList_param$$ = []; - $_i_countDiff_j$$ = 0; - $_len$jscomp$1_fragment$jscomp$1_len$$ = $context$jscomp$4_keys$$.length; - for (var $key$jscomp$0$$ = $context$jscomp$4_keys$$[$_i_countDiff_j$$]; $_i_countDiff_j$$ < $_len$jscomp$1_fragment$jscomp$1_len$$; $_i_countDiff_j$$++) { - $key$jscomp$0$$ = $context$jscomp$4_keys$$[$_i_countDiff_j$$], $list$jscomp$4_newList_param$$[$_i_countDiff_j$$] = {key:$key$jscomp$0$$, value:$child_node$$[$key$jscomp$0$$]}; - } +var module$exports$watchers$if = module$contents$watchers$if__If; +function module$contents$watchers$repeat_Repeat() { + var $_ref$$, $elements$$ = Silica.querySorted(this, "[data-repeat]"); + for (let $i$$ = 0, $length$$ = $elements$$.length; $i$$ < $length$$; ++$i$$) { + var $raw$$ = $elements$$[$i$$]; + var $ctx$$ = $raw$$.dataset.repeat.split(/\s+in\s+/); + var $list$jscomp$4_newList_param$$ = $ctx$$[1]; + var $model$$ = $ctx$$[0]; + $ctx$$ = Silica.getContext($raw$$); + let $possiblyNested$$ = !$raw$$.dataset.repeatNotNested; + "undefined" !== typeof($_ref$$ = $list$jscomp$4_newList_param$$.match(/((?:\w|\.)+)(?:\(([\w\.]+)\))*/))[2] ? ($list$jscomp$4_newList_param$$ = $_ref$$[2], $list$jscomp$4_newList_param$$ = Silica.getValue($raw$$.parentNode, $list$jscomp$4_newList_param$$), $list$jscomp$4_newList_param$$ = Silica.getValue($raw$$, $_ref$$[1], null, $list$jscomp$4_newList_param$$)) : $list$jscomp$4_newList_param$$ = Silica.getValue($raw$$, $list$jscomp$4_newList_param$$); + $_ref$$ = $raw$$.childNodes; + if ($list$jscomp$4_newList_param$$) { + $list$jscomp$4_newList_param$$.constructor === Number && ($list$jscomp$4_newList_param$$ = Array($list$jscomp$4_newList_param$$)); + var $obj$jscomp$33_template$$ = Silica._repeat_templates[$raw$$.dataset.siO2TemplateId]; + if ($list$jscomp$4_newList_param$$.constructor === Object) { + var $context$jscomp$6_keys$$ = Object.keys($list$jscomp$4_newList_param$$); + var $_i_child_obj$$ = $list$jscomp$4_newList_param$$; + $list$jscomp$4_newList_param$$ = []; + for (let $j$$ = 0, $len$$ = $context$jscomp$6_keys$$.length, $key$$ = $context$jscomp$6_keys$$[$j$$]; $j$$ < $len$$; $j$$++) { + $key$$ = $context$jscomp$6_keys$$[$j$$], $list$jscomp$4_newList_param$$[$j$$] = {key:$key$$, value:$_i_child_obj$$[$key$$]}; } - $_i_countDiff_j$$ = $raw$$.childElementCount - $list$jscomp$4_newList_param$$.length; - for ($child_node$$ = void 0; 0 < $_i_countDiff_j$$;) { - Silica.removeFromDOM($_ref$$[$_i_countDiff_j$$ - 1]), --$_i_countDiff_j$$; - } - for ($_len$jscomp$1_fragment$jscomp$1_len$$ = document.createDocumentFragment(); 0 > $_i_countDiff_j$$;) { - $context$jscomp$4_keys$$ = {}; - $context$jscomp$4_keys$$[$model$$] = $list$jscomp$4_newList_param$$[$list$jscomp$4_newList_param$$.length + $_i_countDiff_j$$]; - $context$jscomp$4_keys$$.$ctrl = $ctx$$; - $child_node$$ = $changed_obj$jscomp$38_oldList_template$$.cloneNode(!0); - $child_node$$._rt_ctx = $context$jscomp$4_keys$$; - for ($key$jscomp$0$$ in Silica.compilers) { - Silica.compilers[$key$jscomp$0$$].call($child_node$$); - } - $_len$jscomp$1_fragment$jscomp$1_len$$.appendChild($child_node$$); - ++$_i_countDiff_j$$; - } - $_len$jscomp$1_fragment$jscomp$1_len$$.hasChildNodes() && $raw$$.appendChild($_len$jscomp$1_fragment$jscomp$1_len$$); - $_i_countDiff_j$$ = 0; - for ($_len$jscomp$1_fragment$jscomp$1_len$$ = $list$jscomp$4_newList_param$$.length; $_i_countDiff_j$$ < $_len$jscomp$1_fragment$jscomp$1_len$$; $_i_countDiff_j$$++) { - $changed_obj$jscomp$38_oldList_template$$ = $list$jscomp$4_newList_param$$[$_i_countDiff_j$$]; - $child_node$$ = $_ref$$[$_i_countDiff_j$$]; - var $modelChanged$$ = $model$$ !== $changed_obj$jscomp$38_oldList_template$$; - $child_node$$._rt_ctx ? $child_node$$._rt_ctx[$model$$] = $changed_obj$jscomp$38_oldList_template$$ : ($context$jscomp$4_keys$$ = {}, $context$jscomp$4_keys$$[$model$$] = $changed_obj$jscomp$38_oldList_template$$, $context$jscomp$4_keys$$.$ctrl = $ctx$$, $child_node$$._rt_ctx = $context$jscomp$4_keys$$); - $modelChanged$$ && module$exports$compilers$controller.call($child_node$$, $child_node$$._rt_ctx, !0); - $child_node$$._rt_ctx.index = $_i_countDiff_j$$; - Silica.flush($child_node$$, !1, {}, !0); - } - $ctx$$.renderedRepeat ? $ctx$$.renderedRepeat($raw$$) : $ctx$$.$ctrl && $ctx$$.$ctrl.renderedRepeat && $ctx$$.$ctrl.renderedRepeat($raw$$); - } else { - for (; 0 < $raw$$.childNodes.length;) { - Silica.removeFromDOM($raw$$.childNodes[0]); + } + var $_len$$ = $raw$$.childElementCount - $list$jscomp$4_newList_param$$.length; + for (var $fragment$jscomp$1_node$$ = void 0; 0 < $_len$$;) { + Silica.removeFromDOM($_ref$$[$_len$$ - 1]), --$_len$$; + } + for ($fragment$jscomp$1_node$$ = document.createDocumentFragment(); 0 > $_len$$;) { + $context$jscomp$6_keys$$ = {}; + var $index$$ = $list$jscomp$4_newList_param$$.length + $_len$$; + $context$jscomp$6_keys$$[$model$$] = $list$jscomp$4_newList_param$$[$index$$]; + $context$jscomp$6_keys$$.$ctrl = $ctx$$; + $_i_child_obj$$ = $obj$jscomp$33_template$$.cloneNode(!0); + $_i_child_obj$$._rt_ctx = $context$jscomp$6_keys$$; + $_i_child_obj$$._rt_ctx.index = $index$$; + for (let $key$$ in Silica.compilers) { + Silica.compilers[$key$$].call($_i_child_obj$$); } + $fragment$jscomp$1_node$$.appendChild($_i_child_obj$$); + ++$_len$$; } - } - } -} -;function module$exports$watchers$show() { - var $i$$, $negate$$; - var $elements$$ = Silica.query(this, "[data-show]"); - if (this.dataset.show) { - if (0 === $elements$$.length) { - $elements$$ = [this]; + $fragment$jscomp$1_node$$.hasChildNodes() && $raw$$.appendChild($fragment$jscomp$1_node$$); + $_i_child_obj$$ = 0; + for ($_len$$ = $list$jscomp$4_newList_param$$.length; $_i_child_obj$$ < $_len$$; $_i_child_obj$$++) { + $obj$jscomp$33_template$$ = $list$jscomp$4_newList_param$$[$_i_child_obj$$], $fragment$jscomp$1_node$$ = $_ref$$[$_i_child_obj$$], $index$$ = $model$$ !== $obj$jscomp$33_template$$, $fragment$jscomp$1_node$$._rt_ctx ? $fragment$jscomp$1_node$$._rt_ctx[$model$$] = $obj$jscomp$33_template$$ : ($context$jscomp$6_keys$$ = {}, $context$jscomp$6_keys$$[$model$$] = $obj$jscomp$33_template$$, $context$jscomp$6_keys$$.$ctrl = $ctx$$, $fragment$jscomp$1_node$$._rt_ctx = $context$jscomp$6_keys$$), $index$$ && + module$contents$compilers$controller_ControllerCompiler.call($fragment$jscomp$1_node$$, $fragment$jscomp$1_node$$._rt_ctx, !0), $fragment$jscomp$1_node$$._rt_ctx.index = $_i_child_obj$$, $possiblyNested$$ && module$contents$watchers$repeat_Repeat.call($fragment$jscomp$1_node$$); + } + "SELECT" === $raw$$.nodeName && $raw$$.dataset.model && module$contents$compilers$model_ModelUpdater.call($raw$$, $ctx$$, Silica.getValue($raw$$, $raw$$.dataset.model)); + Silica._capture_links($raw$$); + $ctx$$.renderedRepeat ? $ctx$$.renderedRepeat($raw$$) : $ctx$$.$ctrl && $ctx$$.$ctrl.renderedRepeat && $ctx$$.$ctrl.renderedRepeat($raw$$); } else { - var $a_element$$ = []; - for ($i$$ = $elements$$.length - 1; 0 <= $i$$; $i$$--) { - $a_element$$[$i$$] = $elements$$[$i$$]; + for (; 0 < $raw$$.childNodes.length;) { + Silica.removeFromDOM($raw$$.childNodes[0]); } - $elements$$ = $a_element$$; - } - } - for ($i$$ = $elements$$.length - 1; 0 <= $i$$; $i$$--) { - if ($a_element$$ = $elements$$[$i$$], Silica.isInDOM($a_element$$)) { - var $isVisible$jscomp$3_k$$ = $a_element$$.dataset.show; - ($negate$$ = "!" === $isVisible$jscomp$3_k$$[0]) && ($isVisible$jscomp$3_k$$ = $isVisible$jscomp$3_k$$.substr(1)); - ($isVisible$jscomp$3_k$$ = Silica._show($a_element$$, $isVisible$jscomp$3_k$$, $negate$$)) && $a_element$$.classList.contains("hidden") ? $a_element$$.classList.remove("hidden") : $isVisible$jscomp$3_k$$ || $a_element$$.classList.contains("hidden") || $a_element$$.classList.add("hidden"); } } } -;var module$contents$watchers$class_getClassList = null; -module$contents$watchers$class_getClassList = DOMTokenList && DOMTokenList.prototype.values ? function($e$$) { - return $e$$.classList.values(); -} : function($e$$) { - return $e$$.className.split(" "); -}; -function module$contents$watchers$class_updater($element$$) { - var $hardClass_isVisible$jscomp$4_key$$ = $element$$.dataset._rt_hard_klass || "", $klass$$ = Silica.getValue($element$$, $element$$.dataset["class"], null, [$element$$, $element$$.dataset.parameter]) || ""; - if ("" === $klass$$) { - if ($element$$.className === $hardClass_isVisible$jscomp$4_key$$) { - return; +var module$exports$watchers$repeat = module$contents$watchers$repeat_Repeat; +var module$exports$watchers = {}; +module$exports$watchers._If = module$contents$watchers$if__If; +module$exports$watchers.Repeat = module$contents$watchers$repeat_Repeat; +let module$contents$watchers$observer_IO = null; +module$contents$watchers$observer_IO = "undefined" === typeof window.IntersectionObserver ? class { + constructor($callback$$) { + this.callback = $callback$$; + } + observe($node$$) { + this.callback([{target:$node$$, isIntersecting:!0}]); + } + unobserve($node$$) { + } +} : window.IntersectionObserver; +class module$exports$watchers$observer { + constructor() { + this.mapping = new Map; + this.liveNodes = new Set; + this.hiddenNodes = new Set; + this.visibilityObserver = new module$contents$watchers$observer_IO($entries$$ => { + $entries$$.forEach($entry$$ => { + $entry$$.isIntersecting ? (this.liveNodes.add($entry$$.target), this.hiddenNodes.delete($entry$$.target)) : (this.liveNodes.delete($entry$$.target), $entry$$.target.classList.contains("hidden") && this.hiddenNodes.add($entry$$.target)); + }); + this.applyChanges(); + }); + } + clone($obj$$) { + if (null === $obj$$ || void 0 === $obj$$) { + return null; } - $element$$.className = $hardClass_isVisible$jscomp$4_key$$; - } else { - if ($klass$$ instanceof Array || ($klass$$ = [$klass$$]), $element$$.classList.length !== $klass$$.length) { - $element$$.className = $hardClass_isVisible$jscomp$4_key$$, $element$$.classList.add.apply($element$$.classList, $klass$$); - } else { - for (var $$jscomp$iter$3_applied$$ = !1, $$jscomp$iter$2$$ = $jscomp.makeIterator($klass$$), $$jscomp$key$k$$ = $$jscomp$iter$2$$.next(); !$$jscomp$key$k$$.done; $$jscomp$key$k$$ = $$jscomp$iter$2$$.next()) { - if (!$element$$.classList.contains($$jscomp$key$k$$.value)) { - $element$$.className = $hardClass_isVisible$jscomp$4_key$$; - $element$$.classList.add.apply($element$$.classList, $klass$$); - $$jscomp$iter$3_applied$$ = !0; - break; - } + if ("object" !== typeof $obj$$ || $obj$$ instanceof Date) { + return $obj$$; + } + var $clone$$ = new $obj$$.constructor, $key$$; + for ($key$$ in $obj$$) { + $key$$.startsWith("_") || ($clone$$[$key$$] = null != $obj$$[$key$$] && "object" === typeof $obj$$[$key$$] ? this.clone($obj$$[$key$$]) : $obj$$[$key$$]); + } + return $clone$$; + } + removeSubTree($tree$$) { + this.hiddenNodes.forEach($node$$ => { + Silica.isChildOf($node$$, $tree$$) && this.deregister($node$$); + }); + this.liveNodes.forEach($node$$ => { + Silica.isChildOf($node$$, $tree$$) && this.deregister($node$$); + }); + this.deregister($tree$$); + } + deregister($node$$, $property$$ = null, $actor$$ = null) { + $node$$ instanceof Element && this.visibilityObserver.unobserve($node$$); + let $map$$ = this.mapping.get($node$$); + $map$$ && ($property$$ || $actor$$ || (this.liveNodes.delete($node$$), this.hiddenNodes.delete($node$$), this.mapping.delete($node$$)), ($node$$ = $map$$.get($property$$)) && $node$$.actors.delete($actor$$)); + } + register($node$$, $property$$, $actor$$, $set$$ = !0) { + let [$filtered$$, $raw$$, $paramKeys$$] = Silica.getFilteredValue($node$$, $property$$), $value$$ = this.clone($raw$$), $map$$ = this.mapping.get($node$$); + $map$$ || ($map$$ = new Map, this.mapping.set($node$$, $map$$), "OPTION" === $node$$.nodeName ? this.liveNodes.add($node$$) : this.visibilityObserver.observe($node$$)); + let $packet$$ = $map$$.get($property$$); + $packet$$ ? $packet$$.actors.add($actor$$) : ($packet$$ = {value:$set$$ ? $value$$ : null, actors:new Set([$actor$$]), params:$paramKeys$$, }, $map$$.set($property$$, $packet$$)); + $actor$$.call($node$$, null, $set$$ ? $filtered$$ : null); + return $filtered$$; + } + applyChanges($scope$$ = null) { + this.hiddenNodes.forEach($node$$ => { + if (!$scope$$ || $node$$ === $scope$$ || Silica.isChildOf($node$$, $scope$$)) { + let $mapping$$ = this.mapping.get($node$$); + $mapping$$ && $mapping$$.forEach(($packet$$, $property$jscomp$17_result$$) => { + $packet$$.actors.has(module$contents$compilers$show_Show) && ($property$jscomp$17_result$$ = Silica.getFilteredValue($node$$, $property$jscomp$17_result$$, $packet$$.value, $packet$$.params)) && !Object.is($packet$$.value, $property$jscomp$17_result$$[1]) && (module$contents$compilers$show_Show.call($node$$, null, $property$jscomp$17_result$$[0]), this.liveNodes.add($node$$)); + }); } - if (!$$jscomp$iter$3_applied$$) { - for ($$jscomp$iter$3_applied$$ = $jscomp.makeIterator(module$contents$watchers$class_getClassList($element$$)), $$jscomp$key$k$$ = $$jscomp$iter$3_applied$$.next(); !$$jscomp$key$k$$.done; $$jscomp$key$k$$ = $$jscomp$iter$3_applied$$.next()) { - if (!$klass$$.includes($$jscomp$key$k$$.value)) { - $element$$.className = $hardClass_isVisible$jscomp$4_key$$; - $element$$.classList.add.apply($element$$.classList, $klass$$); - break; + }); + this.liveNodes.forEach($node$$ => { + if (!$scope$$ || $node$$ === $scope$$ || Silica.isChildOf($node$$, $scope$$)) { + let $mapping$$ = this.mapping.get($node$$); + $mapping$$ && $mapping$$.forEach(($packet$$, $property$jscomp$18_result$$) => { + if (($property$jscomp$18_result$$ = Silica.getFilteredValue($node$$, $property$jscomp$18_result$$, $packet$$.value, $packet$$.params)) && !Object.is($packet$$.value, $property$jscomp$18_result$$[1])) { + $packet$$.value = this.clone($property$jscomp$18_result$$[1]); + for (let $actor$$ of $packet$$.actors.values()) { + $actor$$.call($node$$, null, $property$jscomp$18_result$$[0]); + } } - } + }); } - } - } - null != $element$$.dataset.show && ($hardClass_isVisible$jscomp$4_key$$ = $element$$.dataset.show, ($hardClass_isVisible$jscomp$4_key$$ = Silica._show($element$$, $hardClass_isVisible$jscomp$4_key$$, "!" === $hardClass_isVisible$jscomp$4_key$$[0])) && $element$$.classList.contains("hidden") ? $element$$.classList.remove("hidden") : $hardClass_isVisible$jscomp$4_key$$ || $element$$.classList.contains("hidden") || $element$$.classList.add("hidden")); -} -function module$exports$watchers$class() { - var $elements$$ = Silica.query(this, "[data-class]"); - this.dataset["class"] && module$contents$watchers$class_updater(this); - for (var $i$$ = $elements$$.length - 1; 0 <= $i$$; --$i$$) { - module$contents$watchers$class_updater($elements$$[$i$$]); - } -} -;var module$contents$watchers$model_inputTypes = "text file number email password tel search url range date month week time datetime datetime-local color textarea select select-one".split(" "); -function module$exports$watchers$model() { - var $elements$$ = Silica.query(this, "[data-model]"), $i$$, $activeElement$$ = document.activeElement || Silica.__activeElement; - for ($i$$ = $elements$$.length - 1; 0 <= $i$$; --$i$$) { - var $element$$ = $elements$$[$i$$]; - if ($element$$ !== $activeElement$$ || "radio" === $element$$.type || "checkbox" === $element$$.type) { - var $type$jscomp$119_val$$ = $element$$.type; - -1 !== module$contents$watchers$model_inputTypes.indexOf($type$jscomp$119_val$$) ? $element$$.value = Silica._model_get_val($element$$) : "radio" === $type$jscomp$119_val$$ ? ($type$jscomp$119_val$$ = $element$$.value, -1 !== $type$jscomp$119_val$$.search(/[0-9]/) && ($type$jscomp$119_val$$ = parseInt($type$jscomp$119_val$$, 10)), $element$$.checked = Silica.getValue($element$$, $element$$.dataset.model) === $type$jscomp$119_val$$) : "checkbox" === $type$jscomp$119_val$$ ? $element$$.checked = - Silica.getValue($element$$, $element$$.dataset.model) : "SPAN" === $element$$.nodeName || "PRE" === $element$$.nodeName || "DIV" === $element$$.nodeName || "P" === $element$$.nodeName ? ($type$jscomp$119_val$$ = Silica._model_get_val($element$$)) ? $type$jscomp$119_val$$.nodeName ? ($element$$.innerHTML = "", $element$$.appendChild($type$jscomp$119_val$$)) : $element$$.innerHTML !== $type$jscomp$119_val$$ && ($element$$.innerHTML = $type$jscomp$119_val$$) : "" !== $element$$.innerHTML && ($element$$.innerHTML = - "") : "OPTION" === $element$$.nodeName && ($element$$.value = Silica._model_get_val($element$$)); - } + }); } } -;var module$exports$watchers = {}; -module$exports$watchers._If = module$exports$watchers$if; -module$exports$watchers.Repeat = module$exports$watchers$repeat; -module$exports$watchers.Show = module$exports$watchers$show; -module$exports$watchers.Class = module$exports$watchers$class; -module$exports$watchers.Model = module$exports$watchers$model; -module$exports$watchers.Disabled = module$exports$compilers$disabled; -module$exports$watchers.Href = module$exports$compilers$href; -module$exports$watchers.Style = module$exports$compilers$style; -module$exports$watchers.Src = module$exports$compilers$src; -module$exports$watchers.Generic = module$exports$compilers$generic; -module$exports$watchers.Include = module$exports$compilers$include; -module$exports$watchers.Value = module$exports$compilers$value; -var module$exports$silica = {}; -module$exports$hax.init(); -window.Silica = {context:window, contextName:"", directives:{}, components:{}, filters:{}, hasher:md5, router:null, _ifs:{}, _shws:{}, _klass:{}, _watch:{}, _repeat_templates:{}, _isReady:!1, _appRoot:null, _defers:[], _includeCache:{}, _clickOutElements:new Set, _queue:[], interpolationPattern:/\{\{(.*?)\}\}/, usePushState:!0, version:"0.52.0", setContext:function $window$Silica$setContext$($contextName$$) { +;var module$exports$silica = {}; +(0,module$exports$hax.init)(); +window.Silica = {context:window, contextName:"", directives:{}, components:{}, filters:{}, router:null, _ifs:{}, _shws:{}, _watch:{}, _repeat_templates:{}, _template_id:1, _isReady:!1, _appRoot:null, _defers:[], _includeCache:{}, _clickOutElements:new Set, _queue:[], usePushState:!0, observer:new module$exports$watchers$observer, ignoredAttributes:new Set("filter class show if model include controller parameter repeat trap repeatNotNested onClickOutside onScrollFinished siO2IncludedUrl src srcset siO2HardClass noStopPropagation noPreventDefault noAnimationFrame siO2TemplateId siO2Directive with".split(" ")), +version:"0.65.2", setContext($contextName$$) { this.contextName = $contextName$$; this.context = window[$contextName$$]; -}, setRouter:function $window$Silica$setRouter$($router$$) { - var $$jscomp$this$$ = this; +}, ignore($keys$$) { + Silica.ignoredAttributes = new Set([...Silica.ignoredAttributes].concat($keys$$)); +}, setRouter($router$$) { Silica.router = $router$$; - window.onhashchange = function $window$onhashchange$() { - $$jscomp$this$$.apply(function() { - return Silica.router.route(window.location.hash); - }); + window.onhashchange = () => { + this.apply(() => Silica.router.route(window.location.hash)); }; - Silica.usePushState && (window.onpopstate = function $window$onpopstate$() { - $$jscomp$this$$.apply(function() { - return Silica.router.route(Silica.usePushState ? window.location.pathname : window.location.hash); - }); + Silica.usePushState && (window.onpopstate = () => { + this.apply(() => Silica.router.route(Silica.usePushState ? window.location.pathname : window.location.hash)); }); -}, goTo:function $window$Silica$goTo$($pathname$$) { +}, goTo($pathname$$) { if (Silica.usePushState) { history.pushState(null, "", $pathname$$); var $route$$ = $pathname$$; @@ -1358,31 +949,41 @@ window.Silica = {context:window, contextName:"", directives:{}, components:{}, f Silica.router && Silica.apply(function() { Silica.router.route($route$$); }); -}, compile:function $window$Silica$compile$($element$$, $flush$$, $context$$, $onlySafe$$, $storeWatchers$$) { - $flush$$ = void 0 === $flush$$ ? !0 : $flush$$; - $context$$ = void 0 === $context$$ ? null : $context$$; - $onlySafe$$ = void 0 === $onlySafe$$ ? !1 : $onlySafe$$; - $storeWatchers$$ = void 0 === $storeWatchers$$ ? !0 : $storeWatchers$$; +}, compile($element$$, $flush$$ = !0, $context$$ = null, $onlySafe$$ = !1, $storeWatchers$$ = !0) { null === Silica._appRoot && (Silica._appRoot = $element$$); - if (8 != $element$$.nodeType) { - $element$$ == document ? ($element$$ = document.documentElement, $context$$ = $context$$ || {}) : $context$$ = $context$$ || Silica.getContext($element$$); + if (8 !== $element$$.nodeType) { + $element$$ === document ? ($element$$ = document.documentElement, $context$$ = $context$$ || {}) : $context$$ = $context$$ || Silica.getContext($element$$); Silica.cacheTemplates($element$$); - Silica.interpolate($element$$, $context$$, $flush$$); - for (var $key$$ in Silica.compilers) { - $onlySafe$$ & "_" === $key$$[0] || ("Controller" == $key$$ ? Silica.compilers[$key$$].apply($element$$, [$context$$, !1, $storeWatchers$$]) : Silica.compilers[$key$$].apply($element$$, [$context$$])); + for (let $key$$ in Silica.compilers) { + $onlySafe$$ & "_" === $key$$[0] || ("Controller" === $key$$ ? Silica.compilers[$key$$].apply($element$$, [$context$$, !1, $storeWatchers$$]) : Silica.compilers[$key$$].apply($element$$, [$context$$])); } $flush$$ && Silica.flush($element$$, !0); Silica._capture_links($element$$); $element$$ === Silica._appRoot && (Silica._isReady = !0); return $element$$; } -}, cacheTemplates:function $window$Silica$cacheTemplates$($element$jscomp$20_nodes$$) { - $element$jscomp$20_nodes$$ = $element$jscomp$20_nodes$$.querySelectorAll("[data-repeat]"); - for (var $node$$, $hash$$, $context$$, $i$$ = $element$jscomp$20_nodes$$.length - 1; 0 <= $i$$; --$i$$) { - $node$$ = $element$jscomp$20_nodes$$[$i$$], module$exports$hax$safari.hasDatasetProperty($node$$, "_rt_repeat_template") || ($hash$$ = Silica.hasher($node$$.innerHTML), 1 === $node$$.children.length ? Silica._repeat_templates[$hash$$] = $node$$.removeChild($node$$.firstElementChild) : (console.warn("Repeat has multiple children, wrapping with div", $node$$), $context$$ = document.createElement("div"), $context$$.innerHTML = $node$$.innerHTML, Silica._repeat_templates[$hash$$] = $context$$), $node$$.dataset._rt_repeat_template = - $hash$$, $context$$ = {}, $context$$.$ctrl = Silica.getContext($node$$), Silica._repeat_templates[$hash$$] = Silica.compile(Silica._repeat_templates[$hash$$], !1, $context$$, !0, !1), $node$$.innerHTML = ""); +}, cacheTemplates($element$jscomp$18_nodes$$) { + $element$jscomp$18_nodes$$ = $element$jscomp$18_nodes$$.querySelectorAll("[data-repeat]"); + for (let $i$$ = $element$jscomp$18_nodes$$.length - 1; 0 <= $i$$; --$i$$) { + var $node$$ = $element$jscomp$18_nodes$$[$i$$]; + if (!$node$$.dataset.siO2TemplateId) { + let $nextTemplateId$$ = Silica._template_id++; + if (1 === $node$$.children.length) { + Silica._repeat_templates[$nextTemplateId$$] = $node$$.removeChild($node$$.firstElementChild); + } else { + console.warn("Repeat has multiple children, wrapping with div", $node$$); + var $context$$ = document.createElement("div"); + $context$$.innerHTML = $node$$.innerHTML; + Silica._repeat_templates[$nextTemplateId$$] = $context$$; + } + $node$$.dataset.siO2TemplateId = $nextTemplateId$$; + $context$$ = {}; + $context$$.$ctrl = Silica.getContext($node$$); + Silica._repeat_templates[$nextTemplateId$$] = Silica.compile(Silica._repeat_templates[$nextTemplateId$$], !1, $context$$, !0, !1); + $node$$.innerHTML = ""; + } } -}, debounce:function $window$Silica$debounce$($func$$, $wait$$, $immediate$$) { +}, debounce($func$$, $wait$$, $immediate$$) { var $timeout$$; return function() { var $context$$ = this, $args$$ = arguments, $callNow$$ = $immediate$$ && !$timeout$$; @@ -1393,59 +994,25 @@ window.Silica = {context:window, contextName:"", directives:{}, components:{}, f }, $wait$$); $callNow$$ && $func$$.apply($context$$, $args$$); }; -}, defer:function $window$Silica$defer$($func$$) { +}, defer($func$$) { Silica._defers.push($func$$); -}, findCommonAncestor:function $window$Silica$findCommonAncestor$($$jscomp$key$a_a$$, $$jscomp$key$b_b$$) { - if (Silica.isChildOf($$jscomp$key$a_a$$, $$jscomp$key$b_b$$)) { - return $$jscomp$key$b_b$$; - } - if (Silica.isChildOf($$jscomp$key$b_b$$, $$jscomp$key$a_a$$)) { - return $$jscomp$key$a_a$$; - } - var $$jscomp$iter$5_a_parents$$ = []; - for ($$jscomp$key$a_a$$ = $$jscomp$key$a_a$$.parentElement; $$jscomp$key$a_a$$;) { - $$jscomp$iter$5_a_parents$$.push($$jscomp$key$a_a$$), $$jscomp$key$a_a$$ = $$jscomp$key$a_a$$.parentElement; - } - var $b_parents$$ = []; - for ($$jscomp$key$b_b$$ = $$jscomp$key$b_b$$.parentElement; $$jscomp$key$b_b$$;) { - $b_parents$$.push($$jscomp$key$b_b$$), $$jscomp$key$b_b$$ = $$jscomp$key$b_b$$.parentElement; - } - $$jscomp$iter$5_a_parents$$ = $jscomp.makeIterator($$jscomp$iter$5_a_parents$$); - for ($$jscomp$key$a_a$$ = $$jscomp$iter$5_a_parents$$.next(); !$$jscomp$key$a_a$$.done; $$jscomp$key$a_a$$ = $$jscomp$iter$5_a_parents$$.next()) { - $$jscomp$key$a_a$$ = $$jscomp$key$a_a$$.value; - var $$jscomp$iter$4$$ = $jscomp.makeIterator($b_parents$$); - for ($$jscomp$key$b_b$$ = $$jscomp$iter$4$$.next(); !$$jscomp$key$b_b$$.done; $$jscomp$key$b_b$$ = $$jscomp$iter$4$$.next()) { - if ($$jscomp$key$b_b$$ = $$jscomp$key$b_b$$.value, $$jscomp$key$a_a$$ === $$jscomp$key$b_b$$) { - return $$jscomp$key$a_a$$; - } +}, processQueue() { + Silica.apply(function() { + for (let $item$$ of Silica._queue) { + $item$$[0](); } - } - return document; -}, processQueue:function $window$Silica$processQueue$() { - for (var $$jscomp$loop$32$$ = {}, $i$$ = 0, $len$$ = Silica._queue.length; $i$$ < $len$$; $$jscomp$loop$32$$ = {item:$$jscomp$loop$32$$.item}, $i$$++) { - $$jscomp$loop$32$$.item = Silica._queue[$i$$], Silica.apply(function($$jscomp$loop$32$$) { - return function() { - $$jscomp$loop$32$$.item[0](); - }; - }($$jscomp$loop$32$$), $$jscomp$loop$32$$.item[1]); - } - Silica._queue = []; -}, enqueue:function $window$Silica$enqueue$($func$$, $scope$$) { + Silica._queue = []; + }); +}, enqueue($func$$, $scope$$) { Silica._queue.push([$func$$, $scope$$]); Silica.processQueue(); -}, updateDOM:function $window$Silica$updateDOM$($element$$, $onlySafe$$) { - var $watchers$$ = Silica.watchers, $k$$; - for ($k$$ in $watchers$$) { - if (!$onlySafe$$ || "_" !== $k$$[0]) { - var $func$$ = $watchers$$[$k$$]; - $func$$.apply($element$$); - } +}, updateDOM($element$$, $onlySafe$$) { + let $watchers$$ = Silica.watchers, $func$$; + for (let $k$$ in $watchers$$) { + $onlySafe$$ && "_" === $k$$[0] || ($func$$ = $watchers$$[$k$$], $func$$.apply($element$$ || document)); } -}, flush:function $window$Silica$flush$($element$$, $onlySafe$$, $changed$$, $skipSchedule$$) { - $element$$ = void 0 === $element$$ ? document.documentElement : $element$$; - $onlySafe$$ = void 0 === $onlySafe$$ ? !1 : $onlySafe$$; - $changed$$ = void 0 === $changed$$ ? null : $changed$$; - $skipSchedule$$ = void 0 === $skipSchedule$$ ? !1 : $skipSchedule$$; + Silica.observer.applyChanges($element$$); +}, flush($element$$ = document.documentElement, $onlySafe$$ = !1, $changed$$ = null, $skipSchedule$$ = !1) { if (Silica.isInFlush && !$skipSchedule$$) { if (Silica._scheduledFlush) { return; @@ -1455,23 +1022,24 @@ window.Silica = {context:window, contextName:"", directives:{}, components:{}, f $element$$ === document && ($element$$ = document.documentElement); Silica.isInFlush = !$skipSchedule$$; if (null === $changed$$ && Silica._isReady) { - for ($i$jscomp$52_key$$ in Silica._watch) { - var $funcs$$ = Silica._watch[$i$jscomp$52_key$$]; - for ($changed$$ = $funcs$$.length - 1; 0 <= $changed$$; --$changed$$) { - var $func$$ = $funcs$$[$changed$$]; - $func$$[1].apply($func$$[0], [$func$$[2], $func$$[3]]); + for ($i$jscomp$23_key$$ in Silica._watch) { + $changed$$ = Silica._watch[$i$jscomp$23_key$$]; + for (var $funcs$jscomp$1_i$$ = $changed$$.length - 1; 0 <= $funcs$jscomp$1_i$$; --$funcs$jscomp$1_i$$) { + var $func$jscomp$8_k$$ = $changed$$[$funcs$jscomp$1_i$$]; + $func$jscomp$8_k$$[1].apply($func$jscomp$8_k$$[0], [$func$jscomp$8_k$$[2], $func$jscomp$8_k$$[3]]); } } } else { - for (var $k$$ in $changed$$) { - $funcs$$ = $changed$$[$k$$]; - if (!0 !== $funcs$$) { - var $i$jscomp$52_key$$ = $funcs$$.length - 1; + let $func$$; + for ($func$jscomp$8_k$$ in $changed$$) { + $funcs$jscomp$1_i$$ = $changed$$[$func$jscomp$8_k$$]; + if (!0 !== $funcs$jscomp$1_i$$) { + var $i$jscomp$23_key$$ = $funcs$jscomp$1_i$$.length - 1; } else { - $funcs$$ = Silica._watch[$k$$], $i$jscomp$52_key$$ = $funcs$$.length - 1; + $funcs$jscomp$1_i$$ = Silica._watch[$func$jscomp$8_k$$], $i$jscomp$23_key$$ = $funcs$jscomp$1_i$$.length - 1; } - for (; 0 <= $i$jscomp$52_key$$; --$i$jscomp$52_key$$) { - $func$$ = $funcs$$[$i$jscomp$52_key$$], $func$$[1].apply($func$$[0], [$func$$[2], $func$$[3]]); + for (; 0 <= $i$jscomp$23_key$$; --$i$jscomp$23_key$$) { + $func$$ = $funcs$jscomp$1_i$$[$i$jscomp$23_key$$], $func$$[1].apply($func$$[0], [$func$$[2], $func$$[3]]); } } } @@ -1481,13 +1049,12 @@ window.Silica = {context:window, contextName:"", directives:{}, components:{}, f Silica.flush(document, !1, {}); }, 20)); return Silica; -}, apply:function $window$Silica$apply$($func$$, $element$$) { - $element$$ = void 0 === $element$$ ? document : $element$$; +}, apply($func$$, $element$$ = document, $waitForAnimationFrame$$ = !0) { if (Silica.isInApply) { return $func$$.call(), Silica; } - window.requestAnimationFrame(function() { - var $k$$, $additional_oldVal$$, $val$$, $_len1_watcher$18$$; + let $mutation$$ = () => { + var $k$$, $additional_oldVal$$, $val$$, $_len1_watcher$$; Silica.isInApply = !0; try { $func$$.call(); @@ -1495,91 +1062,86 @@ window.Silica = {context:window, contextName:"", directives:{}, components:{}, f return Silica.isInApply = !1, console.error($err$$), Silica; } var $changes$$ = {}; - for ($k$17_v$$ in Silica._watch) { - var $watchers$$ = Silica._watch[$k$17_v$$]; - $changes$$[$k$17_v$$] = []; - if (97 <= $k$17_v$$.charCodeAt(0)) { + for ($k$jscomp$13_v$$ in Silica._watch) { + let $watchers$$ = Silica._watch[$k$jscomp$13_v$$]; + $changes$$[$k$jscomp$13_v$$] = []; + if (97 <= $k$jscomp$13_v$$.charCodeAt(0)) { var $_j_finalChanges$$ = 0; - for ($_len1_watcher$18$$ = $watchers$$.length; $_j_finalChanges$$ < $_len1_watcher$18$$; $_j_finalChanges$$++) { - var $watcher$$ = $watchers$$[$_j_finalChanges$$]; - if ($k$17_v$$.match(/\.\*$/)) { - $changes$$[$k$17_v$$].push($watcher$$); + for ($_len1_watcher$$ = $watchers$$.length; $_j_finalChanges$$ < $_len1_watcher$$; $_j_finalChanges$$++) { + let $watcher$$ = $watchers$$[$_j_finalChanges$$]; + if ($k$jscomp$13_v$$.match(/\.\*$/)) { + $changes$$[$k$jscomp$13_v$$].push($watcher$$); } else { $watcher$$[3] = $additional_oldVal$$ = $watcher$$[2]; - $watcher$$[2] = $val$$ = Silica.getPropByString($watcher$$[0], $k$17_v$$); + $watcher$$[2] = $val$$ = Silica.getPropByString($watcher$$[0], $k$jscomp$13_v$$); var $_len$jscomp$2_changed$$ = $additional_oldVal$$ !== $val$$; !$_len$jscomp$2_changed$$ && Array.isArray($val$$) && Array.isArray($additional_oldVal$$) && (($_len$jscomp$2_changed$$ = $additional_oldVal$$ && $val$$ ? $additional_oldVal$$.length !== $val$$.length : !0) || ($_len$jscomp$2_changed$$ = $additional_oldVal$$.some(function($e$$, $idx$$) { return $val$$[$idx$$] !== $e$$; }))); - $_len$jscomp$2_changed$$ && $changes$$[$k$17_v$$].push($watcher$$); + $_len$jscomp$2_changed$$ && $changes$$[$k$jscomp$13_v$$].push($watcher$$); } } } else { - if ($_len1_watcher$18$$ = $watchers$$[0], $_len1_watcher$18$$[3] = $additional_oldVal$$ = $_len1_watcher$18$$[2], $_len1_watcher$18$$[2] = $val$$ = Silica.getPropByString(window, $k$17_v$$), $_len$jscomp$2_changed$$ = $val$$ !== $additional_oldVal$$, !$_len$jscomp$2_changed$$ && Array.isArray($val$$) && Array.isArray($additional_oldVal$$) && (($_len$jscomp$2_changed$$ = $additional_oldVal$$ && $val$$ ? $additional_oldVal$$.length !== $val$$.length : !0) || ($_len$jscomp$2_changed$$ = $additional_oldVal$$.some(function($e$$, + if ($_len1_watcher$$ = $watchers$$[0], $_len1_watcher$$[3] = $additional_oldVal$$ = $_len1_watcher$$[2], $_len1_watcher$$[2] = $val$$ = Silica.getPropByString(window, $k$jscomp$13_v$$), $_len$jscomp$2_changed$$ = $val$$ !== $additional_oldVal$$, !$_len$jscomp$2_changed$$ && Array.isArray($val$$) && Array.isArray($additional_oldVal$$) && (($_len$jscomp$2_changed$$ = $additional_oldVal$$ && $val$$ ? $additional_oldVal$$.length !== $val$$.length : !0) || ($_len$jscomp$2_changed$$ = $additional_oldVal$$.some(function($e$$, $idx$$) { return $val$$[$idx$$] !== $e$$; }))), $_len$jscomp$2_changed$$) { - for ($changes$$[$k$17_v$$].push($_len1_watcher$18$$), $_j_finalChanges$$ = 1, $_len$jscomp$2_changed$$ = $watchers$$.length; $_j_finalChanges$$ < $_len$jscomp$2_changed$$; $_j_finalChanges$$++) { - $additional_oldVal$$ = $watchers$$[$_j_finalChanges$$], $additional_oldVal$$[2] = $_len1_watcher$18$$[2], $additional_oldVal$$[3] = $_len1_watcher$18$$[3], $changes$$[$k$17_v$$].push($additional_oldVal$$); + for ($changes$$[$k$jscomp$13_v$$].push($_len1_watcher$$), $_j_finalChanges$$ = 1, $_len$jscomp$2_changed$$ = $watchers$$.length; $_j_finalChanges$$ < $_len$jscomp$2_changed$$; $_j_finalChanges$$++) { + $additional_oldVal$$ = $watchers$$[$_j_finalChanges$$], $additional_oldVal$$[2] = $_len1_watcher$$[2], $additional_oldVal$$[3] = $_len1_watcher$$[3], $changes$$[$k$jscomp$13_v$$].push($additional_oldVal$$); } } } } $_j_finalChanges$$ = {}; for ($k$$ in $changes$$) { - var $k$17_v$$ = $changes$$[$k$$]; - Array.isArray($k$17_v$$) && $k$17_v$$.length && ($_j_finalChanges$$[$k$$] = $k$17_v$$); + var $k$jscomp$13_v$$ = $changes$$[$k$$]; + Array.isArray($k$jscomp$13_v$$) && $k$jscomp$13_v$$.length && ($_j_finalChanges$$[$k$$] = $k$jscomp$13_v$$); } Silica.flush($element$$, !1, $_j_finalChanges$$); Silica.isInApply = !1; - var $defers$$ = Silica._defers; + let $defers$$ = Silica._defers; Silica._defers = []; - $defers$$.length && Silica.apply(function() { - for (var $i$$ = $defers$$.length - 1; 0 <= $i$$; $i$$--) { + $defers$$.length && Silica.apply(() => { + for (let $i$$ = $defers$$.length - 1; 0 <= $i$$; $i$$--) { $defers$$[$i$$].call(); } }); - }); + }; + $waitForAnimationFrame$$ ? window.requestAnimationFrame($mutation$$) : $mutation$$(); return Silica; -}, getPropByString:function $window$Silica$getPropByString$($obj$$, $context$jscomp$8_descriptor$$, $params$$) { - if (!$context$jscomp$8_descriptor$$ || 0 === $context$jscomp$8_descriptor$$.length) { +}, getPropByString($obj$$, $context$jscomp$10_descriptor$$, $params$$) { + if (!$context$jscomp$10_descriptor$$ || 0 === $context$jscomp$10_descriptor$$.length) { return $obj$$; } void 0 === $obj$$.__property_map && ($obj$$.__property_map = {}); - if ($obj$$.__property_map.hasOwnProperty($context$jscomp$8_descriptor$$)) { - var $propertyPath$$ = $obj$$.__property_map[$context$jscomp$8_descriptor$$]; - } else { - $propertyPath$$ = $context$jscomp$8_descriptor$$.split("."), $obj$$.__property_map[$context$jscomp$8_descriptor$$] = $propertyPath$$; - } - $context$jscomp$8_descriptor$$ = Object.getOwnPropertyDescriptor($obj$$, $propertyPath$$[0]); - if (!$context$jscomp$8_descriptor$$ || !$context$jscomp$8_descriptor$$.get) { + let $negate$$ = "!" === $context$jscomp$10_descriptor$$[0]; + $negate$$ && ($context$jscomp$10_descriptor$$ = $context$jscomp$10_descriptor$$.substr(1)); + let $propertyPath$$; + $obj$$.__property_map.hasOwnProperty($context$jscomp$10_descriptor$$) ? $propertyPath$$ = $obj$$.__property_map[$context$jscomp$10_descriptor$$] : ($propertyPath$$ = $context$jscomp$10_descriptor$$.split("."), $obj$$.__property_map[$context$jscomp$10_descriptor$$] = $propertyPath$$); + $context$jscomp$10_descriptor$$ = Object.getOwnPropertyDescriptor($obj$$, $propertyPath$$[0]); + if (!$context$jscomp$10_descriptor$$ || !$context$jscomp$10_descriptor$$.get) { for (; "undefined" === typeof $obj$$[$propertyPath$$[0]];) { if ($obj$$.$ctrl) { $obj$$ = $obj$$.$ctrl; } else { - return null; + return $negate$$ ? !0 : null; } } } - for (var $pathLength$$ = $propertyPath$$.length, $i$$ = 0; $i$$ < $pathLength$$; ++$i$$) { - if ($context$jscomp$8_descriptor$$ = $obj$$, $obj$$ = $obj$$[$propertyPath$$[$i$$]], "function" === typeof $obj$$ && ($obj$$ = $obj$$.apply($context$jscomp$8_descriptor$$, $params$$)), null === $obj$$ || void 0 === $obj$$) { - return null; + let $pathLength$$ = $propertyPath$$.length; + for (let $i$$ = 0; $i$$ < $pathLength$$; ++$i$$) { + if ($context$jscomp$10_descriptor$$ = $obj$$, $obj$$ = $obj$$[$propertyPath$$[$i$$]], "function" === typeof $obj$$ && ($obj$$ = $obj$$.apply($context$jscomp$10_descriptor$$, $params$$)), null === $obj$$ || void 0 === $obj$$) { + return $negate$$ ? !0 : null; } } - return $obj$$; -}, getValue:function $window$Silica$getValue$($param$jscomp$4_raw$$, $propString$$, $context$jscomp$9_ctx$$, $params$$) { - $params$$ = void 0 === $params$$ ? [] : $params$$; - $context$jscomp$9_ctx$$ = (void 0 === $context$jscomp$9_ctx$$ ? null : $context$jscomp$9_ctx$$) || (90 >= $propString$$.charCodeAt(0) ? window : Silica.getContext($param$jscomp$4_raw$$)); - if (8 !== $param$jscomp$4_raw$$.nodeType) { - $param$jscomp$4_raw$$ = $param$jscomp$4_raw$$.dataset.parameter; - } else { - var $temp$$ = document.createElement("div"); - $temp$$.innerHTML = $param$jscomp$4_raw$$.data; - $param$jscomp$4_raw$$ = module$exports$hax$safari.getDatasetProperty($temp$$.firstElementChild || $temp$$, "parameter"); - } - $param$jscomp$4_raw$$ && $params$$.push($param$jscomp$4_raw$$); - return Silica.getPropByString($context$jscomp$9_ctx$$, $propString$$, $params$$); -}, isChildOf:function $window$Silica$isChildOf$($child$$, $parent$$) { + return $negate$$ ? !$obj$$ : $obj$$; +}, getValue($param$jscomp$7_raw$$, $propString$$, $context$jscomp$11_ctx$$ = null, $params$$ = []) { + var $idx$jscomp$2_temp$$ = "!" === $propString$$[0] ? 1 : 0; + $context$jscomp$11_ctx$$ = $context$jscomp$11_ctx$$ || (90 >= $propString$$.charCodeAt($idx$jscomp$2_temp$$) ? window : Silica.getContext($param$jscomp$7_raw$$)); + 8 !== $param$jscomp$7_raw$$.nodeType ? $param$jscomp$7_raw$$ = $param$jscomp$7_raw$$.dataset.parameter : ($idx$jscomp$2_temp$$ = document.createElement("div"), $idx$jscomp$2_temp$$.innerHTML = $param$jscomp$7_raw$$.data, $param$jscomp$7_raw$$ = ($idx$jscomp$2_temp$$.firstElementChild || $idx$jscomp$2_temp$$).dataset.parameter); + $param$jscomp$7_raw$$ && $params$$.push($param$jscomp$7_raw$$); + return Silica.getPropByString($context$jscomp$11_ctx$$, $propString$$, $params$$); +}, isChildOf($child$$, $parent$$) { for (; $child$$;) { if ($child$$.parentElement === $parent$$) { return !0; @@ -1587,7 +1149,7 @@ window.Silica = {context:window, contextName:"", directives:{}, components:{}, f $child$$ = $child$$.parentElement; } return !1; -}, isInDOM:function $window$Silica$isInDOM$($element$$) { +}, isInDOM($element$$) { for (; null != $element$$.parentElement && !$element$$._deleted;) { if ($element$$.parentElement == document.documentElement) { return !0; @@ -1595,88 +1157,55 @@ window.Silica = {context:window, contextName:"", directives:{}, components:{}, f $element$$ = $element$$.parentElement; } return !1; -}, setPropByString:function $window$Silica$setPropByString$($ctx$jscomp$6_obj$$, $_i$jscomp$1_propString$$, $value$$) { +}, setPropByString($ctx$jscomp$11_obj$$, $_i$jscomp$1_propString$$, $value$$) { var $_len$$; if (!$_i$jscomp$1_propString$$) { - return $ctx$jscomp$6_obj$$; + return $ctx$jscomp$11_obj$$; } var $paths$$ = $_i$jscomp$1_propString$$.split("."); var $key$$ = $paths$$[$paths$$.length - 1]; - $ctx$jscomp$6_obj$$ = 90 >= $_i$jscomp$1_propString$$.charCodeAt(0) ? window : !$ctx$jscomp$6_obj$$.hasOwnProperty($paths$$[0]) && "function" !== typeof $ctx$jscomp$6_obj$$[$paths$$[0]] && $ctx$jscomp$6_obj$$.$ctrl ? $ctx$jscomp$6_obj$$.$ctrl : $ctx$jscomp$6_obj$$; + $ctx$jscomp$11_obj$$ = 90 >= $_i$jscomp$1_propString$$.charCodeAt(0) ? window : !$ctx$jscomp$11_obj$$.hasOwnProperty($paths$$[0]) && "function" !== typeof $ctx$jscomp$11_obj$$[$paths$$[0]] && $ctx$jscomp$11_obj$$.$ctrl ? $ctx$jscomp$11_obj$$.$ctrl : $ctx$jscomp$11_obj$$; $_i$jscomp$1_propString$$ = 0; for ($_len$$ = $paths$$.length; $_i$jscomp$1_propString$$ < $_len$$; $_i$jscomp$1_propString$$++) { var $hook_prop$$ = $paths$$[$_i$jscomp$1_propString$$]; - $hook_prop$$ !== $key$$ && ($ctx$jscomp$6_obj$$ = "function" === typeof $ctx$jscomp$6_obj$$[$hook_prop$$] ? $ctx$jscomp$6_obj$$[$hook_prop$$].call($ctx$jscomp$6_obj$$) : $ctx$jscomp$6_obj$$[$hook_prop$$]); - } - $key$$ = $ctx$jscomp$6_obj$$[$hook_prop$$]; - $ctx$jscomp$6_obj$$[$hook_prop$$] = $value$$; - ($hook_prop$$ = $ctx$jscomp$6_obj$$[$hook_prop$$ + "_changed"]) && $hook_prop$$.call($ctx$jscomp$6_obj$$, $key$$, $value$$); -}, evaluateExpression:function $window$Silica$evaluateExpression$($expr$$, $elm$$, $ctx$$) { - $ctx$$ = void 0 === $ctx$$ ? {} : $ctx$$; - if ($expr$$) { - var $filter$$ = null; - -1 !== $expr$$.indexOf("|") && ($expr$$ = $expr$$.split("|"), $filter$$ = $expr$$[1].trim(), $expr$$ = $expr$$[0].trim()); - $ctx$$.$ctrl || $elm$$ === document.documentElement || $ctx$$ === Silica.context || (($elm$$ = Silica.getContext($elm$$), $elm$$ !== $ctx$$ && $elm$$.el) ? $elm$$.el && Silica.isChildOf($ctx$$.el, $elm$$.el) && ($ctx$$.$ctrl = $elm$$) : $ctx$$.$ctrl = Silica.context); - 90 >= $expr$$.charCodeAt(0) && ($ctx$$ = window); - var $value$$ = Silica.getPropByString($ctx$$, $expr$$); - $filter$$ && ($expr$$ = ($filter$$ = $filter$$.split(/:(.+)/)) ? $filter$$[0] : null, $elm$$ = $filter$$ && 1 < $filter$$.length ? eval($filter$$[1]) : null, $value$$ = ($filter$$ = $expr$$ ? Silica.filters[$expr$$] : null) ? $filter$$($value$$, $elm$$, $ctx$$) : $value$$); - return $value$$; - } -}, interpolate:function $window$Silica$interpolate$($element$$, $context$$, $flush$$) { - $context$$ = void 0 === $context$$ ? null : $context$$; - $flush$$ = void 0 === $flush$$ ? !0 : $flush$$; - var $parentNode$jscomp$1_text$$, $expr$$; - $element$$ = document.createNodeIterator($element$$, NodeFilter.SHOW_TEXT, function($node$$) { - if (Silica.interpolationPattern.test($node$$.data)) { - return NodeFilter.FILTER_ACCEPT; - } - }, !1); - for (var $node$jscomp$0$$; $node$jscomp$0$$ = $element$$.nextNode();) { - for ($parentNode$jscomp$1_text$$ = $node$jscomp$0$$.data; null !== ($expr$$ = $parentNode$jscomp$1_text$$.match(Silica.interpolationPattern));) { - $expr$$ = $expr$$[1]; - var $comps$jscomp$1_filter$$ = $expr$$.split("|"); - var $evald_fmt_property$$ = $comps$jscomp$1_filter$$[0].trim(); - 1 === $comps$jscomp$1_filter$$.length ? $evald_fmt_property$$ = "{{val}}" : ($comps$jscomp$1_filter$$ = $comps$jscomp$1_filter$$[1].trim(), $evald_fmt_property$$ = "{{val}}"); - $evald_fmt_property$$ = $evald_fmt_property$$.replace("{{val}}", Silica.evaluateExpression($expr$$, $node$jscomp$0$$, $context$$)); - $parentNode$jscomp$1_text$$ = $parentNode$jscomp$1_text$$.replace("{{" + $expr$$ + "}}", $evald_fmt_property$$); - } - $expr$$ = document.createElement("span"); - $expr$$.innerHTML = $parentNode$jscomp$1_text$$; - for ($parentNode$jscomp$1_text$$ = $node$jscomp$0$$.parentNode; 0 < $expr$$.childNodes.length;) { - $parentNode$jscomp$1_text$$.insertBefore($expr$$.firstChild, $node$jscomp$0$$); - } - $parentNode$jscomp$1_text$$.removeChild($node$jscomp$0$$); - Silica.compile($expr$$, $flush$$, $context$$); + $hook_prop$$ !== $key$$ && ($ctx$jscomp$11_obj$$ = "function" === typeof $ctx$jscomp$11_obj$$[$hook_prop$$] ? $ctx$jscomp$11_obj$$[$hook_prop$$].call($ctx$jscomp$11_obj$$) : $ctx$jscomp$11_obj$$[$hook_prop$$]); } -}, addFilter:function $window$Silica$addFilter$($key$$, $func$$) { + $key$$ = $ctx$jscomp$11_obj$$[$hook_prop$$]; + $ctx$jscomp$11_obj$$[$hook_prop$$] = $value$$; + ($hook_prop$$ = $ctx$jscomp$11_obj$$[$hook_prop$$ + "_changed"]) && $hook_prop$$.call($ctx$jscomp$11_obj$$, $key$$, $value$$); +}, addFilter($key$$, $func$$) { Silica.filters[$key$$] = $func$$; -}, addDirective:function $window$Silica$addDirective$($key$$, $obj$$) { +}, addDirective($key$$, $obj$$) { Silica.directives[$key$$] = $obj$$; -}, getContext:function $window$Silica$getContext$($raw$jscomp$5_v$$) { - for (var $constructorName$jscomp$1_ctrl$$, $k$$, $_ref$jscomp$7_constructor$$, $model$jscomp$4_stored$jscomp$1_watchers$$, $needsModel_pairIdx$$;;) { +}, getContext($raw$jscomp$5_v$$) { + var $constructorName$jscomp$1_ctrl$$, $k$$, $_ref$jscomp$7_constructor$$; + for ($constructorName$jscomp$1_ctrl$$ = $raw$jscomp$5_v$$;;) { if ($raw$jscomp$5_v$$._rt_ctx) { return $raw$jscomp$5_v$$._rt_ctx; } if ($raw$jscomp$5_v$$._rt_ctrl) { return $raw$jscomp$5_v$$._rt_ctrl; } - if (9 !== $raw$jscomp$5_v$$.nodeType && 3 !== $raw$jscomp$5_v$$.nodeType && 8 !== $raw$jscomp$5_v$$.nodeType && module$exports$hax$safari.hasDatasetProperty($raw$jscomp$5_v$$, "controller")) { - $constructorName$jscomp$1_ctrl$$ = module$exports$hax$safari.getDatasetProperty($raw$jscomp$5_v$$, "controller"); - "undefined" !== typeof($_ref$jscomp$7_constructor$$ = $constructorName$jscomp$1_ctrl$$.match(/((?:\w|\.)+)(?:\(([\w\.]+)\))*/))[2] && ($needsModel_pairIdx$$ = !0, $model$jscomp$4_stored$jscomp$1_watchers$$ = Silica.getValue($raw$jscomp$5_v$$.parentNode, $_ref$jscomp$7_constructor$$[2])); + if (9 !== $raw$jscomp$5_v$$.nodeType && 3 !== $raw$jscomp$5_v$$.nodeType && 8 !== $raw$jscomp$5_v$$.nodeType && $raw$jscomp$5_v$$.dataset.controller) { + $constructorName$jscomp$1_ctrl$$ = $raw$jscomp$5_v$$.dataset.controller; + if ("undefined" !== typeof($_ref$jscomp$7_constructor$$ = $constructorName$jscomp$1_ctrl$$.match(/((?:\w|\.)+)(?:\(([\w\.]+)\))*/))[2]) { + var $needsModel_pairIdx$$ = !0; + var $model$jscomp$3_stored$jscomp$1_watchers$$ = Silica.getValue($raw$jscomp$5_v$$.parentNode, $_ref$jscomp$7_constructor$$[2]); + } $constructorName$jscomp$1_ctrl$$ = $_ref$jscomp$7_constructor$$[1]; $_ref$jscomp$7_constructor$$ = eval($constructorName$jscomp$1_ctrl$$); if (!$_ref$jscomp$7_constructor$$) { return console.error("Unknown Controller: " + $raw$jscomp$5_v$$.dataset.controller); } - $constructorName$jscomp$1_ctrl$$ = "undefined" !== typeof $model$jscomp$4_stored$jscomp$1_watchers$$ ? new $_ref$jscomp$7_constructor$$($raw$jscomp$5_v$$, $model$jscomp$4_stored$jscomp$1_watchers$$) : new $_ref$jscomp$7_constructor$$($raw$jscomp$5_v$$); - if (!$needsModel_pairIdx$$ ^ null != $model$jscomp$4_stored$jscomp$1_watchers$$) { - $model$jscomp$4_stored$jscomp$1_watchers$$ = $_ref$jscomp$7_constructor$$.watchers; - if ($raw$jscomp$5_v$$._rt_ctrl && $model$jscomp$4_stored$jscomp$1_watchers$$ && 0 < Object.keys($model$jscomp$4_stored$jscomp$1_watchers$$).length) { - for ($k$$ in $model$jscomp$4_stored$jscomp$1_watchers$$) { - if ($model$jscomp$4_stored$jscomp$1_watchers$$ = Silica._watch[$k$$]) { - for ($needsModel_pairIdx$$ = $model$jscomp$4_stored$jscomp$1_watchers$$.length - 1; 0 <= $needsModel_pairIdx$$; --$needsModel_pairIdx$$) { - if ($raw$jscomp$5_v$$._rt_ctrl == $model$jscomp$4_stored$jscomp$1_watchers$$[$needsModel_pairIdx$$][0]) { - $model$jscomp$4_stored$jscomp$1_watchers$$.splice($needsModel_pairIdx$$, 1); + $constructorName$jscomp$1_ctrl$$ = "undefined" !== typeof $model$jscomp$3_stored$jscomp$1_watchers$$ ? new $_ref$jscomp$7_constructor$$($raw$jscomp$5_v$$, $model$jscomp$3_stored$jscomp$1_watchers$$) : new $_ref$jscomp$7_constructor$$($raw$jscomp$5_v$$); + if (!$needsModel_pairIdx$$ ^ null != $model$jscomp$3_stored$jscomp$1_watchers$$) { + $model$jscomp$3_stored$jscomp$1_watchers$$ = $_ref$jscomp$7_constructor$$.watchers; + if ($raw$jscomp$5_v$$._rt_ctrl && $model$jscomp$3_stored$jscomp$1_watchers$$ && 0 < Object.keys($model$jscomp$3_stored$jscomp$1_watchers$$).length) { + for ($k$$ in $model$jscomp$3_stored$jscomp$1_watchers$$) { + if ($model$jscomp$3_stored$jscomp$1_watchers$$ = Silica._watch[$k$$]) { + for ($needsModel_pairIdx$$ = $model$jscomp$3_stored$jscomp$1_watchers$$.length - 1; 0 <= $needsModel_pairIdx$$; --$needsModel_pairIdx$$) { + if ($raw$jscomp$5_v$$._rt_ctrl == $model$jscomp$3_stored$jscomp$1_watchers$$[$needsModel_pairIdx$$][0]) { + $model$jscomp$3_stored$jscomp$1_watchers$$.splice($needsModel_pairIdx$$, 1); break; } } @@ -1696,35 +1225,36 @@ window.Silica = {context:window, contextName:"", directives:{}, components:{}, f return $constructorName$jscomp$1_ctrl$$; } if ($raw$jscomp$5_v$$.parentElement) { - $raw$jscomp$5_v$$ = $raw$jscomp$5_v$$.parentElement; + $constructorName$jscomp$1_ctrl$$._rt_ctx = $raw$jscomp$5_v$$.parentElement._rt_ctx, $raw$jscomp$5_v$$ = $raw$jscomp$5_v$$.parentElement; } else { - return Silica.context; + return $constructorName$jscomp$1_ctrl$$._rt_ctx = Silica.context; } } -}, _handle_href:function $window$Silica$_handle_href$($evt$$) { +}, _handle_href($evt$$) { var $path$$ = this.getAttribute("href"); if (null == /[a-zA-Z]+:+/g.exec($path$$) && "#" !== $path$$ && "" !== $path$$) { var $defaultPrevented$$ = !1; - this.dataset.nopreventdefault || ($defaultPrevented$$ = !0, $evt$$.preventDefault()); - this.dataset.nostoppropagation || $evt$$.stopPropagation(); - Silica.pub("SiO2-HREF", $evt$$); + this.dataset.noPreventDefault || ($defaultPrevented$$ = !0, $evt$$.preventDefault()); + this.dataset.noStopPropagation || $evt$$.stopPropagation(); + module$contents$silica$pubsub_pub("SiO2-HREF", $evt$$, $evt$$.currentTarget); Silica.goTo($path$$); return !$defaultPrevented$$; } -}, _capture_links:function $window$Silica$_capture_links$($element$jscomp$26_nodes$$) { - $element$jscomp$26_nodes$$ = Silica.queryOfType($element$jscomp$26_nodes$$, "a", "[href]", "[data-href]"); - for (var $node$$, $i$$ = $element$jscomp$26_nodes$$.length - 1; 0 <= $i$$; --$i$$) { - $node$$ = $element$jscomp$26_nodes$$[$i$$], $node$$.hostname === window.location.hostname && "_blank" !== $node$$.target && ($node$$.removeEventListener("click", Silica._handle_href, !0), $node$$.addEventListener("click", Silica._handle_href, !0)); - } -}, _show:function $window$Silica$_show$($element$jscomp$27_isVisible$$, $expr$$, $negate$$) { - $element$jscomp$27_isVisible$$ = Silica.getValue($element$jscomp$27_isVisible$$, $expr$$, null, [$element$jscomp$27_isVisible$$]); - $negate$$ && ($element$jscomp$27_isVisible$$ = !$element$jscomp$27_isVisible$$); - return $element$jscomp$27_isVisible$$; -}, _call:function $window$Silica$_call$($element$$, $evnt$$, $act$$) { - if (Silica.isInDOM($element$$)) { - $element$$.dataset.nopreventdefault || $evnt$$.preventDefault(); - $element$$.dataset.nostoppropagation || $evnt$$.stopPropagation(); - var $scope$$ = document, $trap_to$$, $trapped_scope$$; +}, _capture_links($element$jscomp$23_nodes$$) { + $element$jscomp$23_nodes$$ = Silica.queryOfType($element$jscomp$23_nodes$$, "a", "[href]", "[data-href]"); + let $node$$; + for (let $i$$ = $element$jscomp$23_nodes$$.length - 1; 0 <= $i$$; --$i$$) { + $node$$ = $element$jscomp$23_nodes$$[$i$$], $node$$.hostname === window.location.hostname && "_blank" !== $node$$.target && ($node$$.removeEventListener("click", Silica._handle_href, !0), $node$$.addEventListener("click", Silica._handle_href, !0)); + } +}, _show($element$jscomp$24_isVisible$$, $expr$$, $negate$$) { + $element$jscomp$24_isVisible$$ = Silica.getValue($element$jscomp$24_isVisible$$, $expr$$, null, [$element$jscomp$24_isVisible$$]); + $negate$$ && ($element$jscomp$24_isVisible$$ = !$element$jscomp$24_isVisible$$); + return $element$jscomp$24_isVisible$$; +}, _call($element$$, $evnt$$, $act$$) { + if (Silica.isInDOM($element$$) && ($element$$ === $evnt$$.target || "click" !== $act$$ || "SELECT" !== $evnt$$.target.nodeName && "INPUT" !== $evnt$$.target.nodeName)) { + $element$$.dataset.noPreventDefault || $evnt$$.preventDefault(); + $element$$.dataset.noStopPropagation || $evnt$$.stopPropagation(); + var $scope$$ = null, $trap_to$$, $trapped_scope$$, $waitForAnimationFrame$$ = !$element$$.dataset.noAnimationFrame; if (null != ($trap_to$$ = $element$$.dataset.trap)) { if ("true" === $trap_to$$.toLowerCase()) { $scope$$ = $element$$; @@ -1737,7 +1267,7 @@ window.Silica = {context:window, contextName:"", directives:{}, components:{}, f } } } - Silica.enqueue(function() { + Silica.apply(function() { var $parameter$$, $models$$ = []; var $ctx$$ = Silica.getContext($element$$); var $action_i$$ = $element$$.dataset[$act$$]; @@ -1757,25 +1287,36 @@ window.Silica = {context:window, contextName:"", directives:{}, components:{}, f $ctx$$ = $ctx$$.$ctrl; } $element$$.dataset.parameter && ($parameter$$ = $element$$.dataset.parameter); - return "undefined" !== typeof $ctx$$[$actionName_idx$$] ? $ctx$$[$actionName_idx$$].apply($ctx$$, [$element$$].concat($jscomp.arrayFromIterable($models$$), [$parameter$$, $evnt$$])) : null != Silica.context[$actionName_idx$$] ? Silica.context[$actionName_idx$$].apply(Silica.ctx, [$element$$].concat($jscomp.arrayFromIterable($models$$), [$parameter$$, $evnt$$])) : console.error("Unknown action '" + $actionName_idx$$ + "' for " + $element$$.outerHTML + " in " + $ctx$$.constructor.name); - }, $scope$$); - } -}, _model_get_val:function $window$Silica$_model_get_val$($raw$jscomp$6_value$$) { - var $filter$$, $filterKey$$; - if (($filterKey$$ = ($filter$$ = ($filter$$ = $raw$jscomp$6_value$$.attributes["data-filter"]) ? $filter$$.value.split(/:(.+)/) : null) ? $filter$$[0] : null) && !Silica.filters[$filterKey$$]) { - throw Error("Unknown filter: '" + $filterKey$$ + "' for element: " + $raw$jscomp$6_value$$.outerHTML); - } - var $filterOptions$$ = $filter$$ && 1 < $filter$$.length ? eval($filter$$[1]) : null; - $filter$$ = $filterKey$$ ? Silica.filters[$filterKey$$] : null; - $raw$jscomp$6_value$$ = Silica.getValue($raw$jscomp$6_value$$, $raw$jscomp$6_value$$.dataset.model); - return $filter$$ && null != $raw$jscomp$6_value$$ ? $filter$$($raw$jscomp$6_value$$, $filterOptions$$) : $raw$jscomp$6_value$$; -}, findComments:function $window$Silica$findComments$($raw$$) { + return "undefined" !== typeof $ctx$$[$actionName_idx$$] ? $ctx$$[$actionName_idx$$].apply($ctx$$, [$element$$, ...$models$$, $parameter$$, $evnt$$, ]) : null != Silica.context[$actionName_idx$$] ? Silica.context[$actionName_idx$$].apply(Silica.ctx, [$element$$, ...$models$$, $parameter$$, $evnt$$, ]) : console.error("Unknown action '" + $actionName_idx$$ + "' for " + $element$$.outerHTML + " in " + $ctx$$.constructor.name); + }, $scope$$, $waitForAnimationFrame$$); + } +}, getFilteredValue($filterOptions_raw$$, $propString$jscomp$3_value$$, $elideFilterIf_filter$$, $paramsKeys$$ = null) { + var $filterKey_needsShift$$; + [$paramsKeys$$, $filterKey_needsShift$$] = $paramsKeys$$ ? [$paramsKeys$$, !1] : [$propString$jscomp$3_value$$.match("\\((.*)\\)"), !0]; + let $params$$ = []; + if (null !== $paramsKeys$$) { + $filterKey_needsShift$$ && $paramsKeys$$.shift(); + for (let $j$$ = 0, $length$$ = $paramsKeys$$.length; $j$$ < $length$$; $j$$++) { + $params$$.push(Silica.getValue($filterOptions_raw$$, $paramsKeys$$[$j$$])); + } + $propString$jscomp$3_value$$ = $propString$jscomp$3_value$$.substr(0, $propString$jscomp$3_value$$.indexOf("(")); + } + $propString$jscomp$3_value$$ = Silica.getValue($filterOptions_raw$$, $propString$jscomp$3_value$$, null, $params$$); + if ($elideFilterIf_filter$$ && $propString$jscomp$3_value$$ === $elideFilterIf_filter$$) { + return null; + } + if (($filterKey_needsShift$$ = ($elideFilterIf_filter$$ = ($elideFilterIf_filter$$ = $filterOptions_raw$$.attributes["data-filter"]) ? $elideFilterIf_filter$$.value.split(/:(.+)/) : null) ? $elideFilterIf_filter$$[0] : null) && !Silica.filters[$filterKey_needsShift$$]) { + throw Error("Unknown filter: '" + $filterKey_needsShift$$ + "' for element: " + $filterOptions_raw$$.outerHTML); + } + $filterOptions_raw$$ = $elideFilterIf_filter$$ && 1 < $elideFilterIf_filter$$.length ? eval($elideFilterIf_filter$$[1]) : null; + return ($elideFilterIf_filter$$ = $filterKey_needsShift$$ ? Silica.filters[$filterKey_needsShift$$] : null) && null != $propString$jscomp$3_value$$ ? [$elideFilterIf_filter$$($propString$jscomp$3_value$$, $filterOptions_raw$$), $propString$jscomp$3_value$$, $paramsKeys$$] : [$propString$jscomp$3_value$$, $propString$jscomp$3_value$$, $paramsKeys$$]; +}, findComments($raw$$) { for (var $arr$$ = [], $i$$ = $raw$$.childNodes.length - 1; 0 <= $i$$; --$i$$) { var $node$$ = $raw$$.childNodes[$i$$]; 8 === $node$$.nodeType ? $arr$$.push($node$$) : $arr$$.push.apply($arr$$, Silica.findComments($node$$)); } return $arr$$; -}, isInRepeat:function $window$Silica$isInRepeat$($root$$, $node$$) { +}, isInRepeat($root$$, $node$$) { for (; $node$$.parentElement && $node$$.parentElement !== $root$$;) { if ($node$$.parentElement.hasAttribute("data-repeat")) { return !0; @@ -1783,115 +1324,104 @@ window.Silica = {context:window, contextName:"", directives:{}, components:{}, f $node$$ = $node$$.parentElement; } return !1; -}, isDescendent:function $window$Silica$isDescendent$($ancestor$$, $child$$) { +}, isDescendent($ancestor$$, $child$$) { for (; ($child$$ = $child$$.parentNode) && $child$$ !== $ancestor$$;) { } return !!$child$$; -}, query:function $window$Silica$query$($raw$$, $attributes$$) { - for (var $$jscomp$restParams$$ = [], $$jscomp$restIndex$$ = 1; $$jscomp$restIndex$$ < arguments.length; ++$$jscomp$restIndex$$) { - $$jscomp$restParams$$[$$jscomp$restIndex$$ - 1] = arguments[$$jscomp$restIndex$$]; - } +}, query($raw$$, ...$attributes$$) { $raw$$ == document && ($raw$$ = document.documentElement); - var $attribute$jscomp$1_nodes$$ = $raw$$.querySelectorAll($$jscomp$restParams$$.join(",")); - $$jscomp$restIndex$$ = []; - for (var $i$20_i$$ = $attribute$jscomp$1_nodes$$.length - 1; 0 <= $i$20_i$$; --$i$20_i$$) { - var $node$$ = $attribute$jscomp$1_nodes$$.item($i$20_i$$); - Silica.isInRepeat($raw$$, $node$$) || $$jscomp$restIndex$$.push($node$$); - } - for ($i$20_i$$ = $$jscomp$restParams$$.length - 1; 0 <= $i$20_i$$; --$i$20_i$$) { - if ($attribute$jscomp$1_nodes$$ = $$jscomp$restParams$$[$i$20_i$$], $raw$$.hasAttribute($attribute$jscomp$1_nodes$$.substring(1, $attribute$jscomp$1_nodes$$.length - 1))) { - $$jscomp$restIndex$$.push($raw$$); + var $attribute$jscomp$2_nodes$$ = $raw$$.querySelectorAll($attributes$$.join(",")), $filtered$$ = []; + for (var $i$jscomp$30_i$$ = $attribute$jscomp$2_nodes$$.length - 1; 0 <= $i$jscomp$30_i$$; --$i$jscomp$30_i$$) { + let $node$$ = $attribute$jscomp$2_nodes$$.item($i$jscomp$30_i$$); + Silica.isInRepeat($raw$$, $node$$) || $filtered$$.push($node$$); + } + for ($i$jscomp$30_i$$ = $attributes$$.length - 1; 0 <= $i$jscomp$30_i$$; --$i$jscomp$30_i$$) { + if ($attribute$jscomp$2_nodes$$ = $attributes$$[$i$jscomp$30_i$$], $raw$$.hasAttribute($attribute$jscomp$2_nodes$$.substring(1, $attribute$jscomp$2_nodes$$.length - 1))) { + $filtered$$.push($raw$$); break; } } - return $$jscomp$restIndex$$; -}, queryWithComments:function $window$Silica$queryWithComments$($root$$, $attributes$$) { - for (var $$jscomp$restParams$$ = [], $$jscomp$restIndex$jscomp$4_filtered$$ = 1; $$jscomp$restIndex$jscomp$4_filtered$$ < arguments.length; ++$$jscomp$restIndex$jscomp$4_filtered$$) { - $$jscomp$restParams$$[$$jscomp$restIndex$jscomp$4_filtered$$ - 1] = arguments[$$jscomp$restIndex$jscomp$4_filtered$$]; - } - $$jscomp$restIndex$jscomp$4_filtered$$ = Silica.query.apply(Silica, [$root$$].concat($jscomp.arrayFromIterable($$jscomp$restParams$$))); - for (var $comments$$ = Silica.findComments($root$$), $temp$$ = document.createElement("div"), $i$$ = $comments$$.length - 1; 0 <= $i$$; --$i$$) { - var $node$$ = $comments$$[$i$$]; + return $filtered$$; +}, queryWithComments($comments_root$$, ...$attributes$$) { + var $filtered$$ = Silica.query($comments_root$$, ...$attributes$$); + $comments_root$$ = Silica.findComments($comments_root$$); + for (var $temp$$ = document.createElement("div"), $i$$ = $comments_root$$.length - 1; 0 <= $i$$; --$i$$) { + var $node$$ = $comments_root$$[$i$$]; if ("<" === $node$$.nodeValue.charAt(0)) { $temp$$.innerHTML = $node$$.nodeValue; - for (var $j$$ = $$jscomp$restParams$$.length - 1, $attr$$ = $$jscomp$restParams$$[$j$$]; 0 <= $j$$; $attr$$ = $$jscomp$restParams$$[--$j$$]) { + for (var $j$$ = $attributes$$.length - 1, $attr$$ = $attributes$$[$j$$]; 0 <= $j$$; $attr$$ = $attributes$$[--$j$$]) { if ($temp$$.firstElementChild.hasAttribute($attr$$)) { - $$jscomp$restIndex$jscomp$4_filtered$$.push($node$$); + $filtered$$.push($node$$); break; } } } } - return $$jscomp$restIndex$jscomp$4_filtered$$; -}, querySorted:function $window$Silica$querySorted$($root$$, $attributes$$) { - for (var $$jscomp$restParams$jscomp$5_filtered$$ = [], $$jscomp$restIndex$jscomp$5_i$$ = 1; $$jscomp$restIndex$jscomp$5_i$$ < arguments.length; ++$$jscomp$restIndex$jscomp$5_i$$) { - $$jscomp$restParams$jscomp$5_filtered$$[$$jscomp$restIndex$jscomp$5_i$$ - 1] = arguments[$$jscomp$restIndex$jscomp$5_i$$]; - } - $$jscomp$restParams$jscomp$5_filtered$$ = Silica.query.apply(Silica, [$root$$].concat($jscomp.arrayFromIterable($$jscomp$restParams$jscomp$5_filtered$$))); - $$jscomp$restIndex$jscomp$5_i$$ = 0; - for (var $list_length$$ = $$jscomp$restParams$jscomp$5_filtered$$.length; $$jscomp$restIndex$jscomp$5_i$$ < $list_length$$; $$jscomp$restIndex$jscomp$5_i$$++) { - for (var $node$$ = $$jscomp$restParams$jscomp$5_filtered$$[$$jscomp$restIndex$jscomp$5_i$$], $j$$ = $$jscomp$restIndex$jscomp$5_i$$ + 1; $j$$ < $list_length$$; $j$$++) { - var $other$$ = $$jscomp$restParams$jscomp$5_filtered$$[$j$$]; - $other$$.contains($node$$) && ($$jscomp$restParams$jscomp$5_filtered$$[$$jscomp$restIndex$jscomp$5_i$$] = $other$$, $$jscomp$restParams$jscomp$5_filtered$$[$j$$] = $node$$); + return $filtered$$; +}, querySorted($filtered$jscomp$3_root$$, ...$attributes$jscomp$3_i$$) { + $filtered$jscomp$3_root$$ = Silica.query($filtered$jscomp$3_root$$, ...$attributes$jscomp$3_i$$); + $attributes$jscomp$3_i$$ = 0; + for (var $list_length$$ = $filtered$jscomp$3_root$$.length; $attributes$jscomp$3_i$$ < $list_length$$; $attributes$jscomp$3_i$$++) { + for (var $node$$ = $filtered$jscomp$3_root$$[$attributes$jscomp$3_i$$], $j$$ = $attributes$jscomp$3_i$$ + 1; $j$$ < $list_length$$; $j$$++) { + var $other$$ = $filtered$jscomp$3_root$$[$j$$]; + $other$$.contains($node$$) && ($filtered$jscomp$3_root$$[$attributes$jscomp$3_i$$] = $other$$, $filtered$jscomp$3_root$$[$j$$] = $node$$); } } - return $$jscomp$restParams$jscomp$5_filtered$$; -}, queryOfType:function $window$Silica$queryOfType$($raw$$, $type$$, $attributes$$) { - for (var $$jscomp$restParams$$ = [], $$jscomp$restIndex$jscomp$6_filtered$$ = 2; $$jscomp$restIndex$jscomp$6_filtered$$ < arguments.length; ++$$jscomp$restIndex$jscomp$6_filtered$$) { - $$jscomp$restParams$$[$$jscomp$restIndex$jscomp$6_filtered$$ - 2] = arguments[$$jscomp$restIndex$jscomp$6_filtered$$]; - } + return $filtered$jscomp$3_root$$; +}, queryOfType($raw$$, $attribute$jscomp$3_type$$, ...$attributes$$) { $raw$$ == document && ($raw$$ = document.documentElement); - var $attribute$jscomp$2_nodes$$ = $raw$$.getElementsByTagName($type$$); - $$jscomp$restIndex$jscomp$6_filtered$$ = []; - if (0 < $$jscomp$restParams$$.length) { - for (var $i$24_i$$ = $attribute$jscomp$2_nodes$$.length - 1; 0 <= $i$24_i$$; --$i$24_i$$) { - for (var $node$$ = $attribute$jscomp$2_nodes$$.item($i$24_i$$), $j$$ = $$jscomp$restParams$$.length - 1; 0 <= $j$$; --$j$$) { - if ($node$$.hasAttribute($$jscomp$restParams$$[$j$$].replace(/\[|\]/g, ""))) { - $$jscomp$restIndex$jscomp$6_filtered$$.push($node$$); + var $i$jscomp$35_nodes$$ = $raw$$.getElementsByTagName($attribute$jscomp$3_type$$), $filtered$$ = []; + if (0 < $attributes$$.length) { + for (let $i$$ = $i$jscomp$35_nodes$$.length - 1; 0 <= $i$$; --$i$$) { + let $node$$ = $i$jscomp$35_nodes$$.item($i$$); + for (let $j$$ = $attributes$$.length - 1; 0 <= $j$$; --$j$$) { + if ($node$$.hasAttribute($attributes$$[$j$$].replace(/\[|\]/g, ""))) { + $filtered$$.push($node$$); break; } } } - if ($raw$$.nodeName === $type$$.toUpperCase()) { - for ($i$24_i$$ = $$jscomp$restParams$$.length - 1; 0 <= $i$24_i$$; --$i$24_i$$) { - if ($attribute$jscomp$2_nodes$$ = $$jscomp$restParams$$[$i$24_i$$], $raw$$.hasAttribute($attribute$jscomp$2_nodes$$.substring(1, $attribute$jscomp$2_nodes$$.length - 1))) { - $$jscomp$restIndex$jscomp$6_filtered$$.push($raw$$); + if ($raw$$.nodeName === $attribute$jscomp$3_type$$.toUpperCase()) { + for ($i$jscomp$35_nodes$$ = $attributes$$.length - 1; 0 <= $i$jscomp$35_nodes$$; --$i$jscomp$35_nodes$$) { + if ($attribute$jscomp$3_type$$ = $attributes$$[$i$jscomp$35_nodes$$], $raw$$.hasAttribute($attribute$jscomp$3_type$$.substring(1, $attribute$jscomp$3_type$$.length - 1))) { + $filtered$$.push($raw$$); break; } } } } else { - $$jscomp$restIndex$jscomp$6_filtered$$ = $attribute$jscomp$2_nodes$$, $raw$$.tagName === $type$$ && $$jscomp$restIndex$jscomp$6_filtered$$.push($raw$$); + $filtered$$ = $i$jscomp$35_nodes$$, $raw$$.tagName === $attribute$jscomp$3_type$$ && $filtered$$.push($raw$$); } - return $$jscomp$restIndex$jscomp$6_filtered$$; -}, removeFromDOM:function $window$Silica$removeFromDOM$($e$$) { - for (var $removeWatchers$$ = function $$removeWatchers$$$($nodes$$) { - for (var $$jscomp$loop$33$$ = {}, $i$25$$ = $nodes$$.length - 1; 0 <= $i$25$$; $$jscomp$loop$33$$ = {ctrl:$$jscomp$loop$33$$.ctrl}, --$i$25$$) { - var $list$jscomp$5_node$$ = $nodes$$[$i$25$$]; + return $filtered$$; +}, removeFromDOM($e$$) { + for (var $removeWatchers$$ = function($nodes$$) { + for (let $i$$ = $nodes$$.length - 1; 0 <= $i$$; --$i$$) { + var $list$jscomp$5_node$$ = $nodes$$[$i$$]; if ($list$jscomp$5_node$$._rt_ctrl) { - $$jscomp$loop$33$$.ctrl = $list$jscomp$5_node$$._rt_ctrl; - for (var $k$$ in $$jscomp$loop$33$$.ctrl.constructor.watchers) { - $list$jscomp$5_node$$ = Silica._watch[$k$$], Silica._watch[$k$$] = null != $list$jscomp$5_node$$ ? $list$jscomp$5_node$$.filter(function($$jscomp$loop$33$$) { - return function($obj$$) { - return $obj$$[0] !== $$jscomp$loop$33$$.ctrl; - }; - }($$jscomp$loop$33$$)) : [], 0 === Silica._watch[$k$$].length && delete Silica._watch[$k$$]; + let $ctrl$$ = $list$jscomp$5_node$$._rt_ctrl; + for (let $k$$ in $ctrl$$.constructor.watchers) { + $list$jscomp$5_node$$ = Silica._watch[$k$$], Silica._watch[$k$$] = null != $list$jscomp$5_node$$ ? $list$jscomp$5_node$$.filter(function($obj$$) { + return $obj$$[0] !== $ctrl$$; + }) : [], 0 === Silica._watch[$k$$].length && delete Silica._watch[$k$$]; } - if ("function" === typeof $$jscomp$loop$33$$.ctrl.onDestroy) { - $$jscomp$loop$33$$.ctrl.onDestroy(); + if ("function" === typeof $ctrl$$.onDestroy) { + $ctrl$$.onDestroy(); } } } - }, $i$$ = $e$$.childNodes.length - 1; 0 <= $i$$; --$i$$) { - var $child$$ = $e$$.childNodes[$i$$]; + }, $i$jscomp$0$$ = $e$$.childNodes.length - 1; 0 <= $i$jscomp$0$$; --$i$jscomp$0$$) { + var $child$$ = $e$$.childNodes[$i$jscomp$0$$]; if ("function" === typeof $child$$.onremove) { $child$$.onremove(); } } 3 !== $e$$.nodeType && 8 !== $e$$.nodeType && ($removeWatchers$$($e$$.querySelectorAll("[data-controller]")), $removeWatchers$$($e$$.querySelectorAll("[data-sio2-directive]")), $removeWatchers$$([$e$$])); $e$$._deleted = !0; + Silica.observer.removeSubTree($e$$); $e$$.remove(); -}, compilers:module$exports$compilers, watchers:module$exports$watchers}; +}, compilers:module$exports$compilers, watchers:module$exports$watchers, }; +let module$contents$silica_pq = Silica.processQueue; +Silica.processQueue = Silica.debounce(module$contents$silica_pq, 16); window.Silica.Controllers = module$exports$controllers; window.Silica.addDirective = Silica.addDirective; window.Silica.addFilter = Silica.addFilter; @@ -1900,9 +1430,9 @@ window.Silica.compile = Silica.compile; window.Silica.debounce = Silica.debounce; window.Silica.defer = Silica.defer; window.Silica.flush = Silica.flush; -window.Silica.findCommonAncestor = Silica.findCommonAncestor; window.Silica.getPropByString = Silica.getPropByString; window.Silica.getValue = Silica.getValue; +window.Silica.getFilteredValue = Silica.getFilteredValue; window.Silica.goTo = Silica.goTo; window.Silica.query = Silica.query; window.Silica.queryOfType = Silica.queryOfType; @@ -1913,12 +1443,12 @@ window.Silica.setContext = Silica.setContext; window.Silica.setPropByString = Silica.setPropByString; window.Silica.setRouter = Silica.setRouter; window.Silica.usePushState = Silica.usePushState; -window.Silica.processQueue = Silica.debounce(Silica.processQueue, 0); window.Silica.enqueue = Silica.enqueue; -window.Silica.pub = module$exports$silica$pubsub.Pub; -window.Silica.sub = module$exports$silica$pubsub.Sub; -window.Silica.unsub = module$exports$silica$pubsub.Unsub; +window.Silica.processQueue = Silica.processQueue; +window.Silica.pub = module$contents$silica$pubsub_pub; +window.Silica.sub = module$contents$silica$pubsub_sub; +window.Silica.unsub = module$contents$silica$pubsub_unsub; window.Silica.isInDOM = Silica.isInDOM; -window.Silica.hasher = Silica.hasher; +window.Silica.ignore = Silica.ignore; }.call(window); \ No newline at end of file diff --git a/dist/silica.js.br b/dist/silica.js.br new file mode 100644 index 0000000..282945c Binary files /dev/null and b/dist/silica.js.br differ diff --git a/dist/silica.js.gz b/dist/silica.js.gz index 6719c32..1fbe066 100644 Binary files a/dist/silica.js.gz and b/dist/silica.js.gz differ diff --git a/dist/silica.min.js b/dist/silica.min.js index 58fec38..b52a944 100644 --- a/dist/silica.min.js +++ b/dist/silica.min.js @@ -1,88 +1,78 @@ -/** - * [js-md5]{@link https://github.com/emn178/js-md5} - * - * @namespace md5 - * @version 0.4.1 - * @author Chen, Yi-Cyuan [emn178@gmail.com] - * @copyright Chen, Yi-Cyuan 2014-2016 - * @license MIT - */ -!function(t){"use strict";function r(t){if(t)c[0]=c[16]=c[1]=c[2]=c[3]=c[4]=c[5]=c[6]=c[7]=c[8]=c[9]=c[10]=c[11]=c[12]=c[13]=c[14]=c[15]=0,this.blocks=c,this.buffer8=i;else if(n){var r=new ArrayBuffer(68);this.buffer8=new Uint8Array(r),this.blocks=new Uint32Array(r)}else this.blocks=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];this.h0=this.h1=this.h2=this.h3=this.start=this.bytes=0,this.finalized=this.hashed=!1,this.first=!0}var e="object"==typeof process&&process.versions&&process.versions.node;e&&(t=global);var i,h=!t.JS_MD5_TEST&&"object"==typeof module&&module.exports,s="function"==typeof define&&define.amd,n=!t.JS_MD5_TEST&&"undefined"!=typeof ArrayBuffer,f="0123456789abcdef".split(""),a=[128,32768,8388608,-2147483648],o=[0,8,16,24],u=["hex","array","digest","buffer","arrayBuffer"],c=[];if(n){var p=new ArrayBuffer(68);i=new Uint8Array(p),c=new Uint32Array(p)}var y=function(t){return function(e){return new r(!0).update(e)[t]()}},d=function(){var t=y("hex");e&&(t=l(t)),t.create=function(){return new r},t.update=function(r){return t.create().update(r)};for(var i=0;is;){if(this.hashed&&(this.hashed=!1,a[0]=a[16],a[16]=a[1]=a[2]=a[3]=a[4]=a[5]=a[6]=a[7]=a[8]=a[9]=a[10]=a[11]=a[12]=a[13]=a[14]=a[15]=0),e)if(n)for(h=this.start;f>s&&64>h;++s)u[h++]=r[s];else for(h=this.start;f>s&&64>h;++s)a[h>>2]|=r[s]<s&&64>h;++s)i=r.charCodeAt(s),128>i?u[h++]=i:2048>i?(u[h++]=192|i>>6,u[h++]=128|63&i):55296>i||i>=57344?(u[h++]=224|i>>12,u[h++]=128|i>>6&63,u[h++]=128|63&i):(i=65536+((1023&i)<<10|1023&r.charCodeAt(++s)),u[h++]=240|i>>18,u[h++]=128|i>>12&63,u[h++]=128|i>>6&63,u[h++]=128|63&i);else for(h=this.start;f>s&&64>h;++s)i=r.charCodeAt(s),128>i?a[h>>2]|=i<i?(a[h>>2]|=(192|i>>6)<>2]|=(128|63&i)<i||i>=57344?(a[h>>2]|=(224|i>>12)<>2]|=(128|i>>6&63)<>2]|=(128|63&i)<>2]|=(240|i>>18)<>2]|=(128|i>>12&63)<>2]|=(128|i>>6&63)<>2]|=(128|63&i)<=64?(this.start=h-64,this.hash(),this.hashed=!0):this.start=h}return this}},r.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var t=this.blocks,r=this.lastByteIndex;t[r>>2]|=a[3&r],r>=56&&(this.hashed||this.hash(),t[0]=t[16],t[16]=t[1]=t[2]=t[3]=t[4]=t[5]=t[6]=t[7]=t[8]=t[9]=t[10]=t[11]=t[12]=t[13]=t[14]=t[15]=0),t[14]=this.bytes<<3,this.hash()}},r.prototype.hash=function(){var t,r,e,i,h,s,n=this.blocks;this.first?(t=n[0]-680876937,t=(t<<7|t>>>25)-271733879<<0,i=(-1732584194^2004318071&t)+n[1]-117830708,i=(i<<12|i>>>20)+t<<0,e=(-271733879^i&(-271733879^t))+n[2]-1126478375,e=(e<<17|e>>>15)+i<<0,r=(t^e&(i^t))+n[3]-1316259209,r=(r<<22|r>>>10)+e<<0):(t=this.h0,r=this.h1,e=this.h2,i=this.h3,t+=(i^r&(e^i))+n[0]-680876936,t=(t<<7|t>>>25)+r<<0,i+=(e^t&(r^e))+n[1]-389564586,i=(i<<12|i>>>20)+t<<0,e+=(r^i&(t^r))+n[2]+606105819,e=(e<<17|e>>>15)+i<<0,r+=(t^e&(i^t))+n[3]-1044525330,r=(r<<22|r>>>10)+e<<0),t+=(i^r&(e^i))+n[4]-176418897,t=(t<<7|t>>>25)+r<<0,i+=(e^t&(r^e))+n[5]+1200080426,i=(i<<12|i>>>20)+t<<0,e+=(r^i&(t^r))+n[6]-1473231341,e=(e<<17|e>>>15)+i<<0,r+=(t^e&(i^t))+n[7]-45705983,r=(r<<22|r>>>10)+e<<0,t+=(i^r&(e^i))+n[8]+1770035416,t=(t<<7|t>>>25)+r<<0,i+=(e^t&(r^e))+n[9]-1958414417,i=(i<<12|i>>>20)+t<<0,e+=(r^i&(t^r))+n[10]-42063,e=(e<<17|e>>>15)+i<<0,r+=(t^e&(i^t))+n[11]-1990404162,r=(r<<22|r>>>10)+e<<0,t+=(i^r&(e^i))+n[12]+1804603682,t=(t<<7|t>>>25)+r<<0,i+=(e^t&(r^e))+n[13]-40341101,i=(i<<12|i>>>20)+t<<0,e+=(r^i&(t^r))+n[14]-1502002290,e=(e<<17|e>>>15)+i<<0,r+=(t^e&(i^t))+n[15]+1236535329,r=(r<<22|r>>>10)+e<<0,t+=(e^i&(r^e))+n[1]-165796510,t=(t<<5|t>>>27)+r<<0,i+=(r^e&(t^r))+n[6]-1069501632,i=(i<<9|i>>>23)+t<<0,e+=(t^r&(i^t))+n[11]+643717713,e=(e<<14|e>>>18)+i<<0,r+=(i^t&(e^i))+n[0]-373897302,r=(r<<20|r>>>12)+e<<0,t+=(e^i&(r^e))+n[5]-701558691,t=(t<<5|t>>>27)+r<<0,i+=(r^e&(t^r))+n[10]+38016083,i=(i<<9|i>>>23)+t<<0,e+=(t^r&(i^t))+n[15]-660478335,e=(e<<14|e>>>18)+i<<0,r+=(i^t&(e^i))+n[4]-405537848,r=(r<<20|r>>>12)+e<<0,t+=(e^i&(r^e))+n[9]+568446438,t=(t<<5|t>>>27)+r<<0,i+=(r^e&(t^r))+n[14]-1019803690,i=(i<<9|i>>>23)+t<<0,e+=(t^r&(i^t))+n[3]-187363961,e=(e<<14|e>>>18)+i<<0,r+=(i^t&(e^i))+n[8]+1163531501,r=(r<<20|r>>>12)+e<<0,t+=(e^i&(r^e))+n[13]-1444681467,t=(t<<5|t>>>27)+r<<0,i+=(r^e&(t^r))+n[2]-51403784,i=(i<<9|i>>>23)+t<<0,e+=(t^r&(i^t))+n[7]+1735328473,e=(e<<14|e>>>18)+i<<0,r+=(i^t&(e^i))+n[12]-1926607734,r=(r<<20|r>>>12)+e<<0,h=r^e,t+=(h^i)+n[5]-378558,t=(t<<4|t>>>28)+r<<0,i+=(h^t)+n[8]-2022574463,i=(i<<11|i>>>21)+t<<0,s=i^t,e+=(s^r)+n[11]+1839030562,e=(e<<16|e>>>16)+i<<0,r+=(s^e)+n[14]-35309556,r=(r<<23|r>>>9)+e<<0,h=r^e,t+=(h^i)+n[1]-1530992060,t=(t<<4|t>>>28)+r<<0,i+=(h^t)+n[4]+1272893353,i=(i<<11|i>>>21)+t<<0,s=i^t,e+=(s^r)+n[7]-155497632,e=(e<<16|e>>>16)+i<<0,r+=(s^e)+n[10]-1094730640,r=(r<<23|r>>>9)+e<<0,h=r^e,t+=(h^i)+n[13]+681279174,t=(t<<4|t>>>28)+r<<0,i+=(h^t)+n[0]-358537222,i=(i<<11|i>>>21)+t<<0,s=i^t,e+=(s^r)+n[3]-722521979,e=(e<<16|e>>>16)+i<<0,r+=(s^e)+n[6]+76029189,r=(r<<23|r>>>9)+e<<0,h=r^e,t+=(h^i)+n[9]-640364487,t=(t<<4|t>>>28)+r<<0,i+=(h^t)+n[12]-421815835,i=(i<<11|i>>>21)+t<<0,s=i^t,e+=(s^r)+n[15]+530742520,e=(e<<16|e>>>16)+i<<0,r+=(s^e)+n[2]-995338651,r=(r<<23|r>>>9)+e<<0,t+=(e^(r|~i))+n[0]-198630844,t=(t<<6|t>>>26)+r<<0,i+=(r^(t|~e))+n[7]+1126891415,i=(i<<10|i>>>22)+t<<0,e+=(t^(i|~r))+n[14]-1416354905,e=(e<<15|e>>>17)+i<<0,r+=(i^(e|~t))+n[5]-57434055,r=(r<<21|r>>>11)+e<<0,t+=(e^(r|~i))+n[12]+1700485571,t=(t<<6|t>>>26)+r<<0,i+=(r^(t|~e))+n[3]-1894986606,i=(i<<10|i>>>22)+t<<0,e+=(t^(i|~r))+n[10]-1051523,e=(e<<15|e>>>17)+i<<0,r+=(i^(e|~t))+n[1]-2054922799,r=(r<<21|r>>>11)+e<<0,t+=(e^(r|~i))+n[8]+1873313359,t=(t<<6|t>>>26)+r<<0,i+=(r^(t|~e))+n[15]-30611744,i=(i<<10|i>>>22)+t<<0,e+=(t^(i|~r))+n[6]-1560198380,e=(e<<15|e>>>17)+i<<0,r+=(i^(e|~t))+n[13]+1309151649,r=(r<<21|r>>>11)+e<<0,t+=(e^(r|~i))+n[4]-145523070,t=(t<<6|t>>>26)+r<<0,i+=(r^(t|~e))+n[11]-1120210379,i=(i<<10|i>>>22)+t<<0,e+=(t^(i|~r))+n[2]+718787259,e=(e<<15|e>>>17)+i<<0,r+=(i^(e|~t))+n[9]-343485551,r=(r<<21|r>>>11)+e<<0,this.first?(this.h0=t+1732584193<<0,this.h1=r-271733879<<0,this.h2=e-1732584194<<0,this.h3=i+271733878<<0,this.first=!1):(this.h0=this.h0+t<<0,this.h1=this.h1+r<<0,this.h2=this.h2+e<<0,this.h3=this.h3+i<<0)},r.prototype.hex=function(){this.finalize();var t=this.h0,r=this.h1,e=this.h2,i=this.h3;return f[t>>4&15]+f[15&t]+f[t>>12&15]+f[t>>8&15]+f[t>>20&15]+f[t>>16&15]+f[t>>28&15]+f[t>>24&15]+f[r>>4&15]+f[15&r]+f[r>>12&15]+f[r>>8&15]+f[r>>20&15]+f[r>>16&15]+f[r>>28&15]+f[r>>24&15]+f[e>>4&15]+f[15&e]+f[e>>12&15]+f[e>>8&15]+f[e>>20&15]+f[e>>16&15]+f[e>>28&15]+f[e>>24&15]+f[i>>4&15]+f[15&i]+f[i>>12&15]+f[i>>8&15]+f[i>>20&15]+f[i>>16&15]+f[i>>28&15]+f[i>>24&15]},r.prototype.toString=r.prototype.hex,r.prototype.digest=function(){this.finalize();var t=this.h0,r=this.h1,e=this.h2,i=this.h3;return[255&t,t>>8&255,t>>16&255,t>>24&255,255&r,r>>8&255,r>>16&255,r>>24&255,255&e,e>>8&255,e>>16&255,e>>24&255,255&i,i>>8&255,i>>16&255,i>>24&255]},r.prototype.array=r.prototype.digest,r.prototype.arrayBuffer=function(){this.finalize();var t=new ArrayBuffer(16),r=new Uint32Array(t);return r[0]=this.h0,r[1]=this.h1,r[2]=this.h2,r[3]=this.h3,t},r.prototype.buffer=r.prototype.arrayBuffer;var v=d();(t.md5=v,s&&define(function(){return v}))}(this); !function(){ -"use strict"; -var q="function"==typeof Object.defineProperties?Object.defineProperty:function(a,b,c){a!=Array.prototype&&a!=Object.prototype&&(a[b]=c.value)},r="undefined"!=typeof window&&window===this?this:"undefined"!=typeof global&&null!=global?global:this;function t(){t=function(){};r.Symbol||(r.Symbol=aa)}var aa=function(){var a=0;return function(b){return"jscomp_symbol_"+(b||"")+a++}}(); -function u(){t();var a=r.Symbol.iterator;a||(a=r.Symbol.iterator=r.Symbol("iterator"));"function"!=typeof Array.prototype[a]&&q(Array.prototype,a,{configurable:!0,writable:!0,value:function(){return x(this)}});u=function(){}}function x(a){var b=0;return y(function(){return b=arguments.length)return a[c];var b;a:{for(b=a;b;){var f=Reflect.getOwnPropertyDescriptor(b,c);if(f){b=f;break a}b=Reflect.getPrototypeOf(b)}b=void 0}if(b)return b.get?b.get.call(d):b.value}});F("Object.getOwnPropertySymbols",function(a){return a?a:function(){return[]}}); -F("Reflect.ownKeys",function(a){return a?a:function(a){var b=[],d=Object.getOwnPropertyNames(a);a=Object.getOwnPropertySymbols(a);for(var e=0;ec&&(c=Math.max(c+e,0));cg;){c={};c[f]=e[e.length+g];c.m=d;b=a.cloneNode(!0);b.o=c;for(v in Silica.D)Silica.D[v].call(b);h.appendChild(b);++g}h.hasChildNodes()&&k.appendChild(h);g=0;for(h=e.length;g>>0;if(0===d)return!1;b|=0;for(b=Math.max(0<=b?b:d-Math.abs(b),0);b=b.charCodeAt(0)?window:Silica.getContext(a));if(8!==a.nodeType)a=a.dataset.parameter;else{var e=document.createElement("div");e.innerHTML=a.data;a=X(e.firstElementChild||e,"parameter")}a&&d.push(a);return Silica.B(c,b,d)},Y:function(a,b){for(;a;){if(a.parentElement===b)return!0;a=a.parentElement}return!1},Z:function(a){for(;null!=a.parentElement&&!a.Ca;){if(a.parentElement==document.documentElement)return!0;a=a.parentElement}return!1}, -M:function(a,b,c){var d;if(!b)return a;var e=b.split(".");var f=e[e.length-1];90>=b.charCodeAt(0)?d=window:!a.hasOwnProperty(e[0])&&"function"!==typeof a[e[0]]&&a.m?d=a.m:d=a;a=0;for(b=e.length;a=a.charCodeAt(0)&&(c=window);var e=Silica.B(c,a);d&&(a=(d=d.split(/:(.+)/))?d[0]:null,b=d&&1{{val}}":(g=g[1].trim(),h="{{val}}");h=h.replace("{{val}}",Silica.Ha(e,f,b));d=d.replace("{{"+e+"}}",h)}e=document.createElement("span");e.innerHTML=d;for(d=f.parentNode;0c&&(c=Math.max(c+e,0));cc.charCodeAt(2)))&&Silica.observer.register(b,b.dataset[c],module$contents$compilers$generic_createUpdater(c))}var module$exports$compilers$generic=module$contents$compilers$generic_Generic;function module$contents$compilers$scroll_finished_ScrollFinished(){var a=Silica.query(this,"[data-on-scroll-finished]");for(let d=a.length-1;0<=d;--d){var b=a[d];b._rt_live=!0;var c=Silica.debounce(function(e,f){Silica._call(e,f,"onScrollFinished")},50);b.onscroll=function(e){this.dataset.scroll&&Silica._call(this,e,"scroll");c(this,e)}}}var module$exports$compilers$scroll_finished=module$contents$compilers$scroll_finished_ScrollFinished;function module$contents$compilers$with_createUpdater(a){return function(b,c){Silica.setPropByString(Silica.getContext(this),a,c)}} +function module$contents$compilers$with_With(a){a=Silica.query(this,"[data-with]");for(var b=a.length-1;0<=b;--b){let d=a[b];var c=d.dataset["with"].split(" as ");if(2!=c.length)throw Error(`With used with invalid property: ${d.dataset["with"]}`);let e=c[0].trim();c=c[1].trim();let f={};f.$ctrl=Silica.getContext(d);d._rt_ctx=f;f[c]=null;let g=module$contents$compilers$with_createUpdater(c);d.onremove=function(){Silica.observer.deregister(d,e,g)};Silica.observer.register(d,e,g)}} +var module$exports$compilers$with=module$contents$compilers$with_With;function module$contents$compilers$event_EventFilter(){}module$contents$compilers$event_EventFilter.prototype.acceptNode=function(a){return Object.keys(a.dataset).some(function(b){return 3<=b.length&&b.startsWith("on")&&90>=b.charCodeAt(2)&&65<=b.charCodeAt(2)})?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_REJECT}; +function module$contents$compilers$event_Event(){for(var a=document.createNodeIterator(this,NodeFilter.SHOW_ELEMENT,new module$contents$compilers$event_EventFilter),b;b=a.nextNode();){b._rt_live=!0;for(let c of Object.keys(b.dataset))if(3<=c.length&&c.startsWith("on")&&90>=c.charCodeAt(2)&&65<=c.charCodeAt(2)){let d=c.substr(2).toLowerCase();b.addEventListener(d,function(e){Silica._call(this,e,c)})}}}var module$exports$compilers$event=module$contents$compilers$event_Event;var module$exports$compilers={"1_Directive":module$contents$compilers$directives_directives,_if:module$contents$compilers$if__if,Show:module$contents$compilers$show_Show,Class:module$contents$compilers$class_Class,Include:module$contents$compilers$include_Include,Controller:module$contents$compilers$controller_ControllerCompiler,ClickOutside:module$contents$compilers$clickoutside_ClickOutside,Src:module$contents$compilers$src_Src,SrcSet:module$contents$compilers$srcset_SrcSet,ScrollFinished:module$contents$compilers$scroll_finished_ScrollFinished, +Generic:module$contents$compilers$generic_Generic,Model:module$contents$compilers$model_Model,Event:module$contents$compilers$event_Event,With:module$contents$compilers$with_With};class module$exports$controllers$Base{constructor(a){this.el=a;a.parentElement&&(this.$ctrl=Silica.getContext(a.parentElement))}$(a){return this.el.querySelectorAll(a)}}module$exports$controllers$Base.watchers={};module$exports$controllers$Base.prototype.$=module$exports$controllers$Base.prototype.$;var module$exports$controllers$FSM={};class module$contents$controllers$FSM_State{onEnter(a){}onExit(a){}}module$contents$controllers$FSM_State.prototype.onEnter=module$contents$controllers$FSM_State.prototype.onEnter;module$contents$controllers$FSM_State.prototype.onExit=module$contents$controllers$FSM_State.prototype.onExit; +class module$contents$controllers$FSM_Controller extends module$exports$controllers$Base{constructor(a){super(a);a=this.constructor.states;this._states={};for(const b in a)this._states[b]=new a[b];this.handle=this.handle;this.transition=this.transition;this._currentState=new module$contents$controllers$FSM_State;this._previousStateName="";this.initialState&&(this._currentStateName=this.initialState(),this._currentState=this._getStateWithName(this._currentStateName),Silica.defer(()=>{this._currentState.onEnter(this)}))}static get states(){return{base:module$contents$controllers$FSM_State}}_getStateWithName(a){let b= +this._states[a];if(!b)throw Error(`Unknown state ${a} in ${this.constructor.name}`);return b}transition(a,...b){let c=this._getStateWithName(a);c!==this._currentState&&(this._previousStateName=this._currentStateName,this._currentState.onExit(this),this._currentState=c,this._currentStateName=a,this._currentState.onEnter(this,...b))}handle(a,...b){if(this._currentState&&(a=this._currentState[a]))return"function"===typeof a?a.apply(this._currentState,[this,...b]):a}} +Object.defineProperties(module$contents$controllers$FSM_Controller.prototype,{currentState:{configurable:0,enumerable:0,get:function(){return this._currentStateName}},previousState:{configurable:0,enumerable:0,get:function(){return this._previousStateName}}});module$exports$controllers$FSM.Controller=module$contents$controllers$FSM_Controller;module$exports$controllers$FSM.State=module$contents$controllers$FSM_State;var module$exports$controllers={Base:module$exports$controllers$Base,FSM:module$exports$controllers$FSM};var module$exports$hax={};const module$contents$hax_reduce=Function.bind.call(Function.call,Array.prototype.reduce),module$contents$hax_isEnumerable=Function.bind.call(Function.call,Object.prototype.propertyIsEnumerable),module$contents$hax_concat=Function.bind.call(Function.call,Array.prototype.concat),module$contents$hax_keys=Reflect.ownKeys; +module$exports$hax.init=function(){Object.values||(Object.values=function(a){return module$contents$hax_reduce(module$contents$hax_keys(a),(b,c)=>module$contents$hax_concat(b,"string"===typeof c&&module$contents$hax_isEnumerable(a,c)?[a[c]]:[]),[])});Object.entries||(Object.entries=function(a){return module$contents$hax_reduce(module$contents$hax_keys(a),(b,c)=>module$contents$hax_concat(b,"string"===typeof c&&module$contents$hax_isEnumerable(a,c)?[[c,a[c]]]:[]),[])});Array.prototype.includes||Object.defineProperty(Array.prototype, +"includes",{value:function(a,b){if(null==this)throw new TypeError('"this" is null or not defined');var c=Object(this),d=c.length>>>0;if(0===d)return!1;b|=0;for(b=Math.max(0<=b?b:d-Math.abs(b),0);bm;){h={};var n=e.length+m;h[f]=e[n];h.$ctrl=d;k=g.cloneNode(!0);k._rt_ctx=h;k._rt_ctx.index=n;for(let t in Silica.compilers)Silica.compilers[t].call(k);l.appendChild(k);++m}l.hasChildNodes()&&c.appendChild(l);k=0;for(m=e.length;k{a.forEach(b=>{b.isIntersecting?(this.liveNodes.add(b.target),this.hiddenNodes.delete(b.target)):(this.liveNodes.delete(b.target),b.target.classList.contains("hidden")&&this.hiddenNodes.add(b.target))});this.applyChanges()})}clone(a){if(null===a||void 0===a)return null;if("object"!==typeof a||a instanceof Date)return a; +var b=new a.constructor,c;for(c in a)c.startsWith("_")||(b[c]=null!=a[c]&&"object"===typeof a[c]?this.clone(a[c]):a[c]);return b}removeSubTree(a){this.hiddenNodes.forEach(b=>{Silica.isChildOf(b,a)&&this.deregister(b)});this.liveNodes.forEach(b=>{Silica.isChildOf(b,a)&&this.deregister(b)});this.deregister(a)}deregister(a,b=null,c=null){a instanceof Element&&this.visibilityObserver.unobserve(a);let d=this.mapping.get(a);d&&(b||c||(this.liveNodes.delete(a),this.hiddenNodes.delete(a),this.mapping.delete(a)), +(a=d.get(b))&&a.actors.delete(c))}register(a,b,c,d=!0){let [e,f,g]=Silica.getFilteredValue(a,b),h=this.clone(f),k=this.mapping.get(a);k||(k=new Map,this.mapping.set(a,k),"OPTION"===a.nodeName?this.liveNodes.add(a):this.visibilityObserver.observe(a));let m=k.get(b);m?m.actors.add(c):(m={value:d?h:null,actors:new Set([c]),params:g},k.set(b,m));c.call(a,null,d?e:null);return e}applyChanges(a=null){this.hiddenNodes.forEach(b=>{if(!a||b===a||Silica.isChildOf(b,a)){let c=this.mapping.get(b);c&&c.forEach((d, +e)=>{d.actors.has(module$contents$compilers$show_Show)&&(e=Silica.getFilteredValue(b,e,d.value,d.params))&&!Object.is(d.value,e[1])&&(module$contents$compilers$show_Show.call(b,null,e[0]),this.liveNodes.add(b))})}});this.liveNodes.forEach(b=>{if(!a||b===a||Silica.isChildOf(b,a)){let c=this.mapping.get(b);c&&c.forEach((d,e)=>{if((e=Silica.getFilteredValue(b,e,d.value,d.params))&&!Object.is(d.value,e[1])){d.value=this.clone(e[1]);for(let f of d.actors.values())f.call(b,null,e[0])}})}})}};var module$exports$silica={};(0,module$exports$hax.init)(); +window.Silica={context:window,contextName:"",directives:{},components:{},filters:{},router:null,_ifs:{},_shws:{},_watch:{},_repeat_templates:{},_template_id:1,_isReady:!1,_appRoot:null,_defers:[],_includeCache:{},_clickOutElements:new Set,_queue:[],usePushState:!0,observer:new module$exports$watchers$observer,ignoredAttributes:new Set("filter class show if model include controller parameter repeat trap repeatNotNested onClickOutside onScrollFinished siO2IncludedUrl src srcset siO2HardClass noStopPropagation noPreventDefault noAnimationFrame siO2TemplateId siO2Directive with".split(" ")),version:"0.65.2", +setContext(a){this.contextName=a;this.context=window[a]},ignore(a){Silica.ignoredAttributes=new Set([...Silica.ignoredAttributes].concat(a))},setRouter(a){Silica.router=a;window.onhashchange=()=>{this.apply(()=>Silica.router.route(window.location.hash))};Silica.usePushState&&(window.onpopstate=()=>{this.apply(()=>Silica.router.route(Silica.usePushState?window.location.pathname:window.location.hash))})},goTo(a){if(Silica.usePushState){history.pushState(null,"",a);var b=a}else window.window.location.hash= +"#"+a,b=window.window.location.hash;Silica.router&&Silica.apply(function(){Silica.router.route(b)})},compile(a,b=!0,c=null,d=!1,e=!0){null===Silica._appRoot&&(Silica._appRoot=a);if(8!==a.nodeType){a===document?(a=document.documentElement,c=c||{}):c=c||Silica.getContext(a);Silica.cacheTemplates(a);for(let f in Silica.compilers)d&"_"===f[0]||("Controller"===f?Silica.compilers[f].apply(a,[c,!1,e]):Silica.compilers[f].apply(a,[c]));b&&Silica.flush(a,!0);Silica._capture_links(a);a===Silica._appRoot&&(Silica._isReady= +!0);return a}},cacheTemplates(a){a=a.querySelectorAll("[data-repeat]");for(let d=a.length-1;0<=d;--d){var b=a[d];if(!b.dataset.siO2TemplateId){let e=Silica._template_id++;if(1===b.children.length)Silica._repeat_templates[e]=b.removeChild(b.firstElementChild);else{console.warn("Repeat has multiple children, wrapping with div",b);var c=document.createElement("div");c.innerHTML=b.innerHTML;Silica._repeat_templates[e]=c}b.dataset.siO2TemplateId=e;c={};c.$ctrl=Silica.getContext(b);Silica._repeat_templates[e]= +Silica.compile(Silica._repeat_templates[e],!1,c,!0,!1);b.innerHTML=""}}},debounce(a,b,c){var d;return function(){var e=this,f=arguments,g=c&&!d;clearTimeout(d);d=setTimeout(function(){d=null;c||a.apply(e,f)},b);g&&a.apply(e,f)}},defer(a){Silica._defers.push(a)},processQueue(){Silica.apply(function(){for(let a of Silica._queue)a[0]();Silica._queue=[]})},enqueue(a,b){Silica._queue.push([a,b]);Silica.processQueue()},updateDOM(a,b){let c=Silica.watchers,d;for(let e in c)b&&"_"===e[0]||(d=c[e],d.apply(a|| +document));Silica.observer.applyChanges(a)},flush(a=document.documentElement,b=!1,c=null,d=!1){if(Silica.isInFlush&&!d){if(Silica._scheduledFlush)return;Silica._scheduledFlush=!0}a===document&&(a=document.documentElement);Silica.isInFlush=!d;if(null===c&&Silica._isReady)for(var e in Silica._watch){c=Silica._watch[e];for(var f=c.length-1;0<=f;--f){var g=c[f];g[1].apply(g[0],[g[2],g[3]])}}else{let h;for(g in c)for(f=c[g],!0!==f?e=f.length-1:(f=Silica._watch[g],e=f.length-1);0<=e;--e)h=f[e],h[1].apply(h[0], +[h[2],h[3]])}Silica.updateDOM(a,b);Silica.isInFlush=d;!0!==Silica._scheduledFlush||d||(Silica._scheduledFlush=!1,window.setTimeout(function(){Silica.flush(document,!1,{})},20));return Silica},apply(a,b=document,c=!0){if(Silica.isInApply)return a.call(),Silica;let d=()=>{var e,f,g,h;Silica.isInApply=!0;try{a.call()}catch(q){return Silica.isInApply=!1,console.error(q),Silica}var k={};for(n in Silica._watch){let q=Silica._watch[n];k[n]=[];if(97<=n.charCodeAt(0)){var m=0;for(h=q.length;m{for(let q=p.length-1;0<=q;q--)p[q].call()})};c?window.requestAnimationFrame(d):d();return Silica},getPropByString(a,b,c){if(!b||0===b.length)return a;void 0===a.__property_map&&(a.__property_map={});let d="!"===b[0];d&&(b=b.substr(1));let e;a.__property_map.hasOwnProperty(b)?e=a.__property_map[b]:(e=b.split("."),a.__property_map[b]= +e);b=Object.getOwnPropertyDescriptor(a,e[0]);if(!b||!b.get)for(;"undefined"===typeof a[e[0]];)if(a.$ctrl)a=a.$ctrl;else return d?!0:null;let f=e.length;for(let g=0;g=b.charCodeAt(e)?window:Silica.getContext(a));8!==a.nodeType?a=a.dataset.parameter:(e=document.createElement("div"),e.innerHTML=a.data,a=(e.firstElementChild||e).dataset.parameter); +a&&d.push(a);return Silica.getPropByString(c,b,d)},isChildOf(a,b){for(;a;){if(a.parentElement===b)return!0;a=a.parentElement}return!1},isInDOM(a){for(;null!=a.parentElement&&!a._deleted;){if(a.parentElement==document.documentElement)return!0;a=a.parentElement}return!1},setPropByString(a,b,c){var d;if(!b)return a;var e=b.split(".");var f=e[e.length-1];a=90>=b.charCodeAt(0)?window:!a.hasOwnProperty(e[0])&&"function"!==typeof a[e[0]]&&a.$ctrl?a.$ctrl:a;b=0;for(d=e.length;b {{selectedFont}} - Show Other Page + Show Other Page diff --git a/example/include2.html b/example/include2.html index e6281b5..6f4df24 100644 --- a/example/include2.html +++ b/example/include2.html @@ -1,5 +1,5 @@
This is another included page
- Show First Page + Show First Page
diff --git a/example/index.html b/example/index.html index 107bc77..3062a36 100644 --- a/example/index.html +++ b/example/index.html @@ -6,11 +6,25 @@ Silica Example +

{{greeting}}

+ Send Email -
+
+

{{counter}}

+ + +
  • {{user.name}}

    @@ -29,8 +47,12 @@

    {{grade.name}}

    {{klass.name}}
      -
    1. {{grade}}
    2. +
    3. + + {{grade}} + +
    @@ -46,11 +68,25 @@

    {{grade.name}}

    Embedded Page: {{embeddedPage}}

    + + +
      +
    • {{item.value|duration}}
    • +
- +