text: (function(e,r){if(typeof module!="undefined"){module.exports=r()}else if(typeof this.define==="function"&&this.define.amd){this.define([],r)}else{e._hyperscript=r()}})(typeof self!=="undefined"?self:this,(function(){"use strict";function e(e,r){for(var t in r){if(r.hasOwnProperty(t)){e[t]=r[t]}}return e}function r(e,r){var t=e[r];if(t){return t}else{var n={};e[r]=n;return n}}function t(e){try{return JSON.parse(e)}catch(e){n(e);return null}}function n(e){if(console.error){console.error(e)}else if(console.log){console.log("ERROR: ",e)}}function a(e,r){return new(e.bind.apply(e,[e].concat(r)))}var i=(1,eval)("this");class o{constructor(e,r){this._css=e;this.relativeToElement=r}get css(){return c.escapeSelector(this._css)}get className(){return this._css.substr(1)}get id(){return this.className()}[Symbol.iterator](){return c.getRootNode(this.relativeToElement).querySelectorAll(this.css)[Symbol.iterator]()}}var u=function(){var e={"+":"PLUS","-":"MINUS","*":"MULTIPLY","/":"DIVIDE",".":"PERIOD","..":"ELLIPSIS","\\":"BACKSLASH",":":"COLON","%":"PERCENT","|":"PIPE","!":"EXCLAMATION","?":"QUESTION","#":"POUND","&":"AMPERSAND",$:"DOLLAR",";":"SEMI",",":"COMMA","(":"L_PAREN",")":"R_PAREN","<":"L_ANG",">":"R_ANG","<=":"LTE_ANG",">=":"GTE_ANG","==":"EQ","===":"EQQ","!=":"NEQ","!==":"NEQQ","{":"L_BRACE","}":"R_BRACE","[":"L_BRACKET","]":"R_BRACKET","=":"EQUALS"};function r(e){return u(e)||o(e)||e==="-"||e==="_"||e===":"}function t(e){return u(e)||o(e)||e==="-"||e==="_"||e===":"}function n(e){return e===" "||e==="\t"||i(e)}function a(e){return"[Line: "+e.line+", Column: "+e.column+"]"}function i(e){return e==="\r"||e==="\n"}function o(e){return e>="0"&&e<="9"}function u(e){return e>="a"&&e<="z"||e>="A"&&e<="Z"}function l(e,r){return e==="_"||e==="$"}function c(e){return e==="`"||e==="^"}function f(e,r,t){a();var n=null;function a(){while(k(0,true).type==="WHITESPACE"){r.push(e.shift())}}function i(e,r){s.raiseParseError(e,r)}function o(e){var r=c(e);if(r){return r}else{i(this,"Expected '"+e+"' but found '"+x().value+"'")}}function u(e,r,t){for(var n=0;n<arguments.length;n++){var a=arguments[n];var i=c(a);if(i){return i}}}function l(e,r,t){for(var n=0;n<arguments.length;n++){var a=arguments[n];var i=v(a);if(i){return i}}}function c(e){if(x()&&x().op&&x().value===e){return h()}}function f(e,r,t,n){var a=m(e,r,t,n);if(a){return a}else{i(this,"Expected one of "+JSON.stringify([e,r,t]))}}function m(e,r,t,n){if(x()&&x().type&&[e,r,t,n].indexOf(x().type)>=0){return h()}}function p(e,r){var t=v(e,r);if(t){return t}else{i(this,"Expected '"+e+"' but found '"+x().value+"'")}}function v(e,r){if(q.indexOf(e)!==-1){return}var r=r||"IDENTIFIER";if(x()&&x().value===e&&x().type===r){return h()}}function h(){var t=e.shift();r.push(t);n=t;a();return t}function d(t,n){var i=[];var o=k(0,true);while((n==null||o.type!==n)&&(t==null||o.value!==t)&&o.type!=="EOF"){var u=e.shift();r.push(u);i.push(o);o=k(0,true)}a();return i}function E(){if(r[r.length-1]&&r[r.length-1].type==="WHITESPACE"){return r[r.length-1].value}else{return""}}function T(){return d(null,"WHITESPACE")}function y(){return e.length>0}function k(r,t){var n;var a=0;do{if(!t){while(e[a]&&e[a].type==="WHITESPACE"){a++}}n=e[a];r--;a++}while(r>-1);if(n){return n}else{return{type:"EOF",value:"<<<EOF>>>"}}}function x(){return k(0)}function g(){return n}function b(){return t.substring(this.startToken.start,this.endToken.end)}function w(){return t.split("\n")[this.startToken.line-1]}var q=[];function S(e){q.push(e)}function N(){q.pop()}function O(){var e=q;q=[];return e}function I(e){q=e}return{pushFollow:S,popFollow:N,clearFollow:O,restoreFollow:I,matchAnyToken:l,matchAnyOpToken:u,matchOpToken:c,requireOpToken:o,matchTokenType:m,requireTokenType:f,consumeToken:h,matchToken:v,requireToken:p,list:e,consumed:r,source:t,hasMore:y,currentToken:x,lastMatch:g,token:k,consumeUntil:d,consumeUntilWhitespace:T,lastWhitespace:E,sourceFor:b,lineFor:w}}function m(e){if(e.length>0){var r=e[e.length-1];if(r.type==="IDENTIFIER"||r.type==="CLASS_REF"||r.type==="ID_REF"){return false}if(r.op&&(r.value===">"||r.value===")")){return false}}return true}function p(s,p){var v=[];var h=s;var d=0;var E=0;var T=1;var y="<START>";var k=0;function x(){return p&&k===0}while(d<h.length){if(A()==="-"&&F()==="-"){w()}else{if(n(A())){v.push(D())}else if(!M()&&A()==="."&&(u(F())||F()==="{")){v.push(q())}else if(!M()&&A()==="#"&&(u(F())||F()==="{")){v.push(O())}else if(A()==="["&&F()==="@"){v.push(S())}else if(A()==="@"){v.push(N())}else if(u(A())||!x()&&l(A())){v.push(I())}else if(o(A())){v.push(L())}else if(!x()&&(A()==='"'||A()==="`")){v.push(C())}else if(!x()&&A()==="'"){if(m(v)){v.push(C())}else{v.push(R())}}else if(e[A()]){if(y==="$"&&A()==="{"){k++}if(A()==="}"){k--}v.push(R())}else if(x()||c(A())){v.push(b("RESERVED",P()))}else{if(d<h.length){throw Error("Unknown token: "+A()+" ")}}}}return f(v,[],h);function g(e,r){var t=b(e,r);t.op=true;return t}function b(e,r){return{type:e,value:r,start:d,end:d+1,column:E,line:T}}function w(){while(A()&&!i(A())){P()}P()}function q(){var e=b("CLASS_REF");var t=P();if(A()==="{"){e.template=true;t+=P();while(A()&&A()!=="}"){t+=P()}if(A()!=="}"){throw Error("Unterminated class reference")}else{t+=P()}}else{while(r(A())){t+=P()}}e.value=t;e.end=d;return e}function S(){var e=b("ATTRIBUTE_REF");var r=P();while(d<h.length&&A()!=="]"){r+=P()}if(A()==="]"){r+=P()}e.value=r;e.end=d;return e}function N(){var e=b("ATTRIBUTE_REF");var r=P();while(t(A())){r+=P()}e.value=r;e.end=d;return e}function O(){var e=b("ID_REF");var r=P();if(A()==="{"){e.template=true;r+=P();while(A()&&A()!=="}"){r+=P()}if(A()!=="}"){throw Error("Unterminated id reference")}else{P()}}else{while(t(A())){r+=P()}}e.value=r;e.end=d;return e}function I(){var e=b("IDENTIFIER");var r=P();while(u(A())||l(A())){r+=P()}e.value=r;e.end=d;return e}function L(){var e=b("NUMBER");var r=P();while(o(A())){r+=P()}if(A()==="."&&o(F())){r+=P()}while(o(A())){r+=P()}e.value=r;e.end=d;return e}function R(){var r=g();var t=P();while(A()&&e[t+A()]){t+=P()}r.type=e[t];r.value=t;r.end=d;return r}function C(){var e=b("STRING");var r=P();var t="";while(A()&&A()!==r){if(A()==="\\"){P()}t+=P()}if(A()!==r){throw Error("Unterminated string at "+a(e))}else{P()}e.value=t;e.end=d;e.template=r==="`";return e}function A(){return h.charAt(d)}function F(){return h.charAt(d+1)}function P(){y=A();d++;E++;return y}function M(){return u(y)||o(y)||y===")"||y==="}"||y==="]"}function D(){var e=b("WHITESPACE");var r="";while(A()&&n(A())){if(i(A())){E=0;T++}r+=P()}e.value=r;e.end=d;return e}}return{tokenize:p,makeTokensObject:f}}();var s=function(){var e={};var r={};var t={};var n=[];var a=[];function i(e,r,t){e.startToken=r;e.sourceFor=t.sourceFor;e.lineFor=t.lineFor;e.programSource=t.source}function o(r,t,n=undefined){var a=e[r];if(a){var o=t.currentToken();var u=a(s,c,t,n);if(u){i(u,o,t);u.endToken=u.endToken||t.lastMatch();var n=u.root;while(n!=null){i(n,o,t);n=n.root}}return u}}function u(e,r,t,n){var a=o(e,r,n);if(!a)E(r,t||"Expected "+e);return a}function l(e,r){for(var t=0;t<e.length;t++){var n=e[t];var a=o(n,r);if(a){return a}}}function f(r,t){e[r]=t}function m(t,n){var a=t+"Command";var i=function(e,r,t){const i=n(e,r,t);if(i){i.type=a;i.execute=function(e){e.meta.command=i;return r.unifiedExec(this,e)};return i}};e[a]=i;r[t]=i}function p(r,n){var a=r+"Feature";var i=function(e,t,i){var o=n(e,t,i);if(o){o.keyword=r;o.type=a;return o}};e[a]=i;t[r]=i}function v(e,r){n.push(e);f(e,r)}function h(e,r){a.push(e);f(e,r)}f("feature",(function(e,r,n){if(n.matchOpToken("(")){var a=e.requireElement("feature",n);n.requireOpToken(")");return a}var i=t[n.currentToken().value];if(i){return i(e,r,n)}}));f("command",(function(e,t,n){if(n.matchOpToken("(")){const r=e.requireElement("command",n);n.requireOpToken(")");return r}var a=r[n.currentToken().value];let i;if(a){i=a(e,t,n)}else if(n.currentToken().type==="IDENTIFIER"&&n.token(1).value==="("){i=e.requireElement("pseudoCommand",n)}if(i){return e.parseElement("indirectStatement",n,i)}return i}));f("commandList",(function(e,r,t){var n=e.parseElement("command",t);if(n){t.matchToken("then");const r=e.parseElement("commandList",t);if(r)n.next=r;return n}}));f("leaf",(function(e,r,t){var a=l(n,t);if(a==null){return o("symbol",t)}return a}));f("indirectExpression",(function(e,r,t,n){for(var i=0;i<a.length;i++){var o=a[i];n.endToken=t.lastMatch();var u=e.parseElement(o,t,n);if(u){return u}}return n}));f("indirectStatement",(function(e,r,t,n){if(t.matchToken("unless")){n.endToken=t.lastMatch();var a=e.requireElement("expression",t);var i={type:"unlessStatementModifier",args:[a],op:function(e,r){if(r){return this.next}else{return n}},execute:function(e){return r.unifiedExec(this,e)}};n.parent=i;return i}return n}));f("primaryExpression",(function(e,r,t){var n=e.parseElement("leaf",t);if(n){return e.parseElement("indirectExpression",t,n)}e.raiseParseError(t,"Unexpected value: "+t.currentToken().value)}));function d(e){var r=e.currentToken();var t=e.source;var n=t.split("\n");var a=r&&r.line?r.line-1:n.length-1;var i=n[a];var o=r&&r.line?r.column:i.length-1;return i+"\n"+" ".repeat(o)+"^^\n\n"}function E(e,r){r=(r||"Unexpected Token : "+e.currentToken().value)+"\n\n"+d(e);var t=new Error(r);t["tokens"]=e;throw t}function T(e){var r=o("hyperscript",e);if(e.hasMore())E(e);if(r)return r}function y(e,r){if(e){e.parent=r;y(e.next,r)}}function k(e){return r[e.value]}function x(e){return t[e.value]}function g(e){if(e.value=="end"||e.value=="then"||e.value=="else"||e.value==")"||k(e)||x(e)||e.type=="EOF"){return true}return false}function b(e){var r=[""];do{r.push(e.lastWhitespace());if(e.currentToken().value==="$"){e.consumeToken();var t=e.matchOpToken("{");r.push(u("expression",e));if(t){e.requireOpToken("}")}r.push("")}else if(e.currentToken().value==="\\"){e.consumeToken();e.consumeToken()}else{var n=e.consumeToken();r[r.length-1]+=n?n.value:""}}while(e.hasMore());r.push(e.lastWhitespace());return r}return{setParent:y,requireElement:u,parseElement:o,featureStart:x,commandStart:k,commandBoundary:g,parseAnyOf:l,parseHyperScript:T,raiseParseError:E,addGrammarElement:f,addCommand:m,addFeature:p,addLeafExpression:v,addIndirectExpression:h,parseStringTemplate:b}}();var l={dynamicResolvers:[],String:function(e){if(e.toString){return e.toString()}else{return""+e}},Int:function(e){return parseInt(e)},Float:function(e){return parseFloat(e)},Number:function(e){console.log(e);return Number(e)},Date:function(e){return new Date(e)},Array:function(e){return Array.from(e)},JSON:function(e){return JSON.stringify(e)},Object:function(r){if(r instanceof String){r=r.toString()}if(typeof r==="string"){return JSON.parse(r)}else{return e({},r)}}};var c=function(){function t(e,r){var t=e.matches||e.matchesSelector||e.msMatchesSelector||e.mozMatchesSelector||e.webkitMatchesSelector||e.oMatchesSelector;return t&&t.call(e,r)}function n(e,r){var t;if(window.CustomEvent&&typeof window.CustomEvent==="function"){t=new CustomEvent(e,{bubbles:true,cancelable:true,detail:r})}else{t=document.createEvent("CustomEvent");t.initCustomEvent(e,true,true,r)}return t}function a(e,r,t){t=t||{};t["sentBy"]=e;var a=n(r,t);var i=e.dispatchEvent(a);return i}function f(e){return Array.isArray(e)||e instanceof NodeList}function m(e){return typeof e==="object"&&Symbol.iterator in e&&typeof e[Symbol.iterator]==="function"}function p(e){return e instanceof o||f(e)}function v(e,r){if(e==null){}else if(m(e)){for(const t of e){r(t)}}else if(f(e)){for(var t=0;t<e.length;t++){r(e[t])}}else{r(e)}}function h(e,r){if(p(e)){for(const t of e)r(t)}else{r(e)}}var d={array_sentinel:true};function E(e){var r=[];for(var t=0;t<e.length;t++){var n=e[t];if(Array.isArray(n)){r.push(d);for(var a=0;a<n.length;a++){r.push(n[a])}r.push(d)}else{r.push(n)}}return r}function T(e){var r=[];for(var t=0;t<e.length;t++){var n=e[t];if(n===d){n=e[++t];var a=[];r.push(a);while(n!==d){a.push(n);n=e[++t]}}else{r.push(n)}}return r}function y(e){for(var r=0;r<e.length;r++){var t=e[r];if(t.asyncWrapper){e[r]=t.value}if(Array.isArray(t)){for(var n=0;n<t.length;n++){var a=t[n];if(a.asyncWrapper){t[n]=a.value}}}}}var k={};function x(e,r){while(true){try{var t=g(e,r)}catch(n){c.registerHyperTrace(r,n);if(r.meta.errorHandler&&!r.meta.handlingError){r.meta.handlingError=true;r[r.meta.errorSymmbol]=n;e=r.meta.errorHandler;continue}else if(r.meta.reject){r.meta.reject(n);t=k}else{throw n}}if(t==null){console.error(e," did not return a next element to execute! context: ",r);return}else if(t.then){t.then((function(e){x(e,r)})).catch((function(e){c.registerHyperTrace(r,e);if(r.meta.errorHandler&&!r.meta.handlingError){r.meta.handlingError=true;r[r.meta.errorSymmbol]=e;x(r.meta.errorHandler,r)}else if(r.meta.reject){r.meta.reject(e)}else{throw e}}));return}else if(t===k){return}else{e=t}}}function g(e,r){var t=[r];var n=false;var a=false;if(e.args){for(var i=0;i<e.args.length;i++){var o=e.args[i];if(o==null){t.push(null)}else if(Array.isArray(o)){var u=[];for(var s=0;s<o.length;s++){var l=o[s];var c=l?l.evaluate(r):null;if(c){if(c.then){n=true}else if(c.asyncWrapper){a=true}}u.push(c)}t.push(u)}else if(o.evaluate){var c=o.evaluate(r);if(c){if(c.then){n=true}else if(c.asyncWrapper){a=true}}t.push(c)}else{t.push(o)}}}if(n){return new Promise((function(n,i){var o=E(t);Promise.all(o).then((function(r){r=T(r);if(a){y(r)}try{var t=e.op.apply(e,r);n(t)}catch(e){i(e)}})).catch((function(e){if(r.meta.errorHandler&&!r.meta.handlingError){r.meta.handlingError=true;r[r.meta.errorSymmbol]=e;x(r.meta.errorHandler,r)}else if(r.meta.reject){r.meta.reject(e)}else{}}))}))}else{if(a){y(t)}return e.op.apply(e,t)}}var b=null;function w(){if(b==null){b=_hyperscript.config.attributes.replace(/ /g,"").split(",")}return b}function q(e){for(var r=0;r<w().length;r++){var t=w()[r];if(e.hasAttribute&&e.hasAttribute(t)){return e.getAttribute(t)}}if(e instanceof HTMLScriptElement&&e.type==="text/hyperscript"){return e.innerText}return null}var S=new WeakMap;function N(e){var r=S.get(e);if(typeof r==="undefined"){S.set(e,r={})}return r}function O(r,t){if(r){e(t,N(r));O(r.parentElement,t)}}function I(e,r,t,n){var a={meta:{parser:s,lexer:u,runtime:c,owner:e,feature:r,iterators:{}},me:t,event:n,target:n?n.target:null,detail:n?n.detail:null,body:"document"in i?document.body:null};a.meta.ctx=a;O(e,a);return a}function L(){return w().map((function(e){return"["+e+"]"})).join(", ")}function R(e,r){var t=l.dynamicResolvers;for(var n=0;n<t.length;n++){var a=t[n];var i=a(r,e);if(i!==undefined){return i}}if(e==null){return null}var o=l[r];if(o){return o(e)}throw"Unknown conversion : "+r}function C(e,r){return Object.prototype.toString.call(e)==="[object "+r+"]"}function A(e){var r=u.tokenize(e);if(s.commandStart(r.currentToken())){var t=s.requireElement("commandList",r);var n=t;while(n.next){n=n.next}n.next={op:function(){return k}};return t}else if(s.featureStart(r.currentToken())){var a=s.requireElement("hyperscript",r);return a}else{var i=s.requireElement("expression",r);return i}}function F(r,t){var n="document"in i?i.document.body:o();t=e(I(n,null,n,null),t||{});var a=A(r);if(a.execute){return a.execute(t)}else if(a.apply){a.apply(n,null);return N(n)}else{return a.evaluate(t)}function o(){return{}}}function P(e){var r=c.getScriptSelector();if(t(e,r)){M(e,e)}if(e instanceof HTMLScriptElement&&e.type==="text/hyperscript"){M(e,document.body)}if(e.querySelectorAll){v(e.querySelectorAll(r+", [type='text/hyperscript']"),(function(e){M(e,e instanceof HTMLScriptElement&&e.type==="text/hyperscript"?document.body:e)}))}}function M(e,r){if(e.closest&&e.closest(_hyperscript.config.disableSelector)){return}var t=_(e);if(!t.initialized){var n=q(e);if(n){try{t.initialized=true;t.script=n;var i=u.tokenize(n);var o=s.parseHyperScript(i);if(!o)return;o.apply(r||e,e);setTimeout((function(){a(r||e,"load",{hyperscript:true})}),1)}catch(r){c.triggerEvent(e,"exception",{error:r});console.error("hyperscript errors were found on the following element:",e,"\n\n",r.message,r.stack)}}}}var D=new WeakMap;function _(e){var r=D.get(e);if(typeof r==="undefined"){D.set(e,r={})}return r}function j(e,r,t){if(e==null&&t){return true}var n=Object.prototype.toString.call(e).slice(8,-1);return n===r}function H(e){var t=e.meta&&e.meta.owner;if(t){var n=_(t);var a="elementScope";if(e.meta.feature&&e.meta.feature.behavior){a=e.meta.feature.behavior+"Scope"}var i=r(n,a);return i}else{return{}}}function G(e,r,t){if(e==="me"||e==="my"||e==="I"){return r["me"]}if(e==="it"||e==="its"){return r["result"]}if(e==="you"||e==="your"||e==="yourself"){return r["beingTold"]}else{if(t==="global"){return i[e]}else if(t==="element"){var n=H(r);return n[e]}else if(t==="local"){return r[e]}else{if(r.meta&&r.meta.context){var a=r.meta.context[e];if(typeof a!=="undefined"){return a}}var o=r[e];if(typeof o!=="undefined"){return o}else{var n=H(r);o=n[e];if(typeof o!=="undefined"){return o}else{return i[e]}}}}}function U(e,r,t,n){if(t==="global"){i[e]=n}else if(t==="element"){var a=H(r);a[e]=n}else if(t==="local"){r[e]=n}else{var o=r[e];if(typeof o!=="undefined"){r[e]=n}else{var a=H(r);o=a[e];if(typeof o!=="undefined"){a[e]=n}else{o=i[e];if(typeof o!=="undefined"){i[e]=n}else{r[e]=n}}}}}function B(e,r){if(e){if(e.resolveNext){return e.resolveNext(r)}else if(e.next){return e.next}else{return B(e.parent,r)}}}function W(e,r,t){if(e!=null){var n=t&&e.getAttribute?e.getAttribute(r):e[r];if(typeof n!=="undefined"){return n}if(p(e)){var a=[];for(var i of e){var o=t?i.getAttribute(r):i[r];if(o){a.push(o)}}return a}}}function z(e,r,t,n){if(typeof document==="undefined"||e===document.body){var a=i}else{var a=N(e)}while(r.length>0){var o=r.shift();var u=a[o];if(u==null){u={};a[o]=u}a=u}a[t]=n}function V(e,r){var t=[];var n=e;while(n.meta.caller){n=n.meta.caller}if(n.meta.traceMap){return n.meta.traceMap.get(r,t)}}function J(e,r){var t=[];var n=null;while(e!=null){t.push(e);n=e;e=e.meta.caller}if(n.meta.traceMap==null){n.meta.traceMap=new Map}if(!n.meta.traceMap.get(r)){var a={trace:t,print:function(e){e=e||console.error;e("hypertrace /// ");var r=0;for(var n=0;n<t.length;n++){r=Math.max(r,t[n].meta.feature.displayName.length)}for(var n=0;n<t.length;n++){var a=t[n];e("  ->",a.meta.feature.displayName.padEnd(r+2),"-",a.meta.owner)}}};n.meta.traceMap.set(r,a)}}function $(e){return e.replace(/:/g,(function(e){return"\\"+e}))}function K(e,r){if(e==null){throw new Error(r.sourceFor()+" is null")}}function Q(e){return e==undefined||e.length===0}function Y(e){var r=e.getRootNode();if(r instanceof Document||r instanceof ShadowRoot)return r;else return document}var X="document"in i?document.currentScript.src:null;return{typeCheck:j,forEach:v,implicitLoop:h,triggerEvent:a,matchesSelector:t,getScript:q,processNode:P,evaluate:F,parse:A,getScriptSelector:L,resolveSymbol:G,setSymbol:U,makeContext:I,findNext:B,unifiedEval:g,convertValue:R,unifiedExec:x,resolveProperty:W,assignToNamespace:z,registerHyperTrace:J,getHyperTrace:V,getInternalData:_,escapeSelector:$,nullCheck:K,isEmpty:Q,getRootNode:Y,hyperscriptUrl:X,HALT:k}}();{s.addLeafExpression("parenthesized",(function(e,r,t){if(t.matchOpToken("(")){var n=t.clearFollow();try{var a=e.requireElement("expression",t)}finally{t.restoreFollow(n)}t.requireOpToken(")");return a}}));s.addLeafExpression("string",(function(e,r,t){var n=t.matchTokenType("STRING");if(!n)return;var a=n.value;var i;if(n.template){var o=u.tokenize(a,true);i=e.parseStringTemplate(o)}else{i=[]}return{type:"string",token:n,args:i,op:function(e){var r="";for(var t=1;t<arguments.length;t++){var n=arguments[t];if(n!==undefined){r+=n}}return r},evaluate:function(e){if(i.length===0){return a}else{return r.unifiedEval(this,e)}}}}));s.addGrammarElement("nakedString",(function(e,r,t){if(t.hasMore()){var n=t.consumeUntilWhitespace();t.matchTokenType("WHITESPACE");return{type:"nakedString",tokens:n,evaluate:function(e){return n.map((function(e){return e.value})).join("")}}}}));s.addLeafExpression("number",(function(e,r,t){var n=t.matchTokenType("NUMBER");if(!n)return;var a=n;var i=parseFloat(n.value);return{type:"number",value:i,numberToken:a,evaluate:function(){return i}}}));s.addLeafExpression("idRef",(function(e,r,t){var n=t.matchTokenType("ID_REF");if(!n)return;if(n.template){var a=n.value.substr(2,n.value.length-2);var i=u.tokenize(a);var o=e.requireElement("expression",i);return{type:"idRefTemplate",args:[o],op:function(e,t){return r.getRootNode(e.me).getElementById(t)},evaluate:function(e){return r.unifiedEval(this,e)}}}else{const e=n.value.substr(1);return{type:"idRef",css:n.value,value:e,evaluate:function(t){return r.getRootNode(t.me).getElementById(e)}}}}));s.addLeafExpression("classRef",(function(e,r,t){var n=t.matchTokenType("CLASS_REF");if(!n)return;if(n.template){var a=n.value.substr(2,n.value.length-2);var i=u.tokenize(a);var s=e.requireElement("expression",i);return{type:"classRefTemplate",args:[s],op:function(e,r){return new o("."+r,e.me)},evaluate:function(e){return r.unifiedEval(this,e)}}}else{const e=n.value;return{type:"classRef",css:e,evaluate:function(r){return new o(e,r.me)}}}}));class t extends o{constructor(e,r,t){super(e,r);this.templateParts=t;this.elements=t.filter((e=>e instanceof Element))}get css(){let e="",r=0;for(const t of this.templateParts){if(t instanceof Element){e+="[data-hs-query-id='"+r+++"']"}else e+=t}return e}[Symbol.iterator](){this.elements.forEach(((e,r)=>e.dataset.hsQueryId=r));const e=super[Symbol.iterator]();this.elements.forEach((e=>e.removeAttribute("data-hs-query-id")));return e}}s.addLeafExpression("queryRef",(function(e,r,n){var a=n.matchOpToken("<");if(!a)return;var i=n.consumeUntil("/");n.requireOpToken("/");n.requireOpToken(">");var s=i.map((function(e){if(e.type==="STRING"){return'"'+e.value+'"'}else{return e.value}})).join("");if(s.indexOf("$")>=0){var l=true;var c=u.tokenize(s,true);var f=e.parseStringTemplate(c)}return{type:"queryRef",css:s,args:f,op:function(e,...r){if(l){return new t(s,e.me,r)}else{return new o(s,e.me)}},evaluate:function(e){return r.unifiedEval(this,e)}}}));s.addLeafExpression("attributeRef",(function(e,r,t){var n=t.matchTokenType("ATTRIBUTE_REF");if(!n)return;var a=n.value;if(a.indexOf("[")===0){var i=a.substring(2,a.length-1)}else{var i=a.substring(1)}var o="["+i+"]";var u=i.split("=");var s=u[0];var l=u[1];if(l){if(l.indexOf('"')===0){l=l.substring(1,l.length-1)}}return{type:"attributeRef",name:s,css:o,value:l,op:function(e){var r=e.beingTold||e.me;if(r){return r.getAttribute(s)}},evaluate:function(e){return r.unifiedEval(this,e)}}}));s.addGrammarElement("objectKey",(function(e,r,t){var n;if(n=t.matchTokenType("STRING")){return{type:"objectKey",key:n.value,evaluate:function(){return n.value}}}else if(t.matchOpToken("[")){var a=e.parseElement("expression",t);t.requireOpToken("]");return{type:"objectKey",expr:a,args:[a],op:function(e,r){return r},evaluate:function(e){return r.unifiedEval(this,e)}}}else{var i="";do{n=t.matchTokenType("IDENTIFIER")||t.matchOpToken("-");if(n)i+=n.value}while(n);return{type:"objectKey",key:i,evaluate:function(){return i}}}}));s.addLeafExpression("objectLiteral",(function(e,r,t){if(!t.matchOpToken("{"))return;var n=[];var a=[];if(!t.matchOpToken("}")){do{var i=e.requireElement("objectKey",t);t.requireOpToken(":");var o=e.requireElement("expression",t);a.push(o);n.push(i)}while(t.matchOpToken(","));t.requireOpToken("}")}return{type:"objectLiteral",args:[n,a],op:function(e,r,t){var n={};for(var a=0;a<r.length;a++){n[r[a]]=t[a]}return n},evaluate:function(e){return r.unifiedEval(this,e)}}}));s.addGrammarElement("namedArgumentList",(function(e,r,t){if(!t.matchOpToken("("))return;var n=[];var a=[];if(!t.matchOpToken(")")){do{var i=t.requireTokenType("IDENTIFIER");t.requireOpToken(":");var o=e.requireElement("expression",t);a.push(o);n.push({name:i,value:o})}while(t.matchOpToken(","));t.requireOpToken(")")}return{type:"namedArgumentList",fields:n,args:[a],op:function(e,r){var t={_namedArgList_:true};for(var a=0;a<r.length;a++){var i=n[a];t[i.name.value]=r[a]}return t},evaluate:function(e){return r.unifiedEval(this,e)}}}));s.addGrammarElement("symbol",(function(e,r,t){var n="default";if(t.matchToken("global")){n="global"}else if(t.matchToken("element")||t.matchToken("module")){n="element";if(t.matchOpToken("'")){t.requireToken("s")}}else if(t.matchToken("local")){n="local"}var a=t.matchTokenType("IDENTIFIER");if(a){const e=a.value;return{type:"symbol",symbolType:n,token:a,name:e,evaluate:function(t){return r.resolveSymbol(e,t,n)}}}}));s.addGrammarElement("implicitMeTarget",(function(e,r,t){return{type:"implicitMeTarget",evaluate:function(e){return e.beingTold||e.me}}}));s.addLeafExpression("boolean",(function(e,r,t){var n=t.matchToken("true")||t.matchToken("false");if(!n)return;const a=n.value==="true";return{type:"boolean",evaluate:function(e){return a}}}));s.addLeafExpression("null",(function(e,r,t){if(t.matchToken("null")){return{type:"null",evaluate:function(e){return null}}}}));s.addLeafExpression("arrayLiteral",(function(e,r,t){if(!t.matchOpToken("["))return;var n=[];if(!t.matchOpToken("]")){do{var a=e.requireElement("expression",t);n.push(a)}while(t.matchOpToken(","));t.requireOpToken("]")}return{type:"arrayLiteral",values:n,args:[n],op:function(e,r){return r},evaluate:function(e){return r.unifiedEval(this,e)}}}));s.addLeafExpression("blockLiteral",(function(e,r,t){if(!t.matchOpToken("\\"))return;var n=[];var a=t.matchTokenType("IDENTIFIER");if(a){n.push(a);while(t.matchOpToken(",")){n.push(t.requireTokenType("IDENTIFIER"))}}t.requireOpToken("-");t.requireOpToken(">");var i=e.requireElement("expression",t);return{type:"blockLiteral",args:n,expr:i,evaluate:function(e){var r=function(){for(var r=0;r<n.length;r++){e[n[r].value]=arguments[r]}return i.evaluate(e)};return r}}}));s.addGrammarElement("timeExpression",(function(e,r,t){var n=e.requireElement("expression",t);var a=1;if(t.matchToken("s")||t.matchToken("seconds")){a=1e3}else if(t.matchToken("ms")||t.matchToken("milliseconds")){}return{type:"timeExpression",time:n,factor:a,args:[n],op:function(e,r){return r*a},evaluate:function(e){return r.unifiedEval(this,e)}}}));s.addIndirectExpression("propertyAccess",(function(e,r,t,n){if(!t.matchOpToken("."))return;var a=t.requireTokenType("IDENTIFIER");var i={type:"propertyAccess",root:n,prop:a,args:[n],op:function(e,t){var n=r.resolveProperty(t,a.value,false);return n},evaluate:function(e){return r.unifiedEval(this,e)}};return e.parseElement("indirectExpression",t,i)}));s.addIndirectExpression("of",(function(e,r,t,n){if(!t.matchToken("of"))return;var a=e.requireElement("expression",t);var i=null;var o=n;while(o.root){i=o;o=o.root}if(o.type!=="symbol"&&o.type!=="attributeRef"){e.raiseParseError(t,"Cannot take a property of a non-symbol: "+o.type)}var u=o.type==="attributeRef";var s=o.name;var l={type:"ofExpression",prop:o.token,root:a,attribute:u,expression:n,args:[a],op:function(e,t){return r.resolveProperty(t,s,u)},evaluate:function(e){return r.unifiedEval(this,e)}};if(o.type==="attributeRef"){l.attribute=o}if(i){i.root=l;i.args=[l]}else{n=l}return e.parseElement("indirectExpression",t,n)}));s.addIndirectExpression("possessive",(function(e,r,t,n){if(e.possessivesDisabled){return}var a=t.matchOpToken("'");if(a||n.type==="symbol"&&(n.name==="my"||n.name==="its"||n.name==="your")&&t.currentToken().type==="IDENTIFIER"){if(a){t.requireToken("s")}var i=e.parseElement("attributeRef",t);if(i==null){var o=t.requireTokenType("IDENTIFIER")}var u={type:"possessive",root:n,attribute:i,prop:o,args:[n],op:function(e,t){if(i){var n=r.resolveProperty(t,i.name,true)}else{var n=r.resolveProperty(t,o.value,false)}return n},evaluate:function(e){return r.unifiedEval(this,e)}};return e.parseElement("indirectExpression",t,u)}}));s.addIndirectExpression("inExpression",(function(e,r,t,n){if(!t.matchToken("in"))return;if(n.type!=="idRef"&&n.type==="queryRef"||n.type==="classRef"){var a=true}var i=e.requireElement("expression",t);var o={type:"inExpression",root:n,args:[a?null:n,i],op:function(e,t,i){var o=[];if(a){r.forEach(i,(function(e){var r=e.querySelectorAll(n.css);for(var t=0;t<r.length;t++){o.push(r[t])}}))}else{r.forEach(t,(function(e){r.forEach(i,(function(r){if(e===r){o.push(e)}}))}))}if(o.length>0){return o}else{return null}},evaluate:function(e){return r.unifiedEval(this,e)}};return e.parseElement("indirectExpression",t,o)}));s.addIndirectExpression("asExpression",(function(e,r,t,n){if(!t.matchToken("as"))return;t.matchToken("a")||t.matchToken("an");var a=e.requireElement("dotOrColonPath",t).evaluate();var i={type:"asExpression",root:n,args:[n],op:function(e,t){return r.convertValue(t,a)},evaluate:function(e){return r.unifiedEval(this,e)}};return e.parseElement("indirectExpression",t,i)}));s.addIndirectExpression("functionCall",(function(e,r,t,n){if(!t.matchOpToken("("))return;var a=[];if(!t.matchOpToken(")")){do{a.push(e.requireElement("expression",t))}while(t.matchOpToken(","));t.requireOpToken(")")}if(n.root){var i={type:"functionCall",root:n,argExressions:a,args:[n.root,a],op:function(e,t,a){r.nullCheck(t,n.root);var i=t[n.prop.value];r.nullCheck(i,n);if(i.hyperfunc){a.push(e)}return i.apply(t,a)},evaluate:function(e){return r.unifiedEval(this,e)}}}else{var i={type:"functionCall",root:n,argExressions:a,args:[n,a],op:function(e,t,a){r.nullCheck(t,n);if(t.hyperfunc){a.push(e)}var i=t.apply(null,a);return i},evaluate:function(e){return r.unifiedEval(this,e)}}}return e.parseElement("indirectExpression",t,i)}));s.addIndirectExpression("attributeRefAccess",(function(e,r,t,n){var a=e.parseElement("attributeRef",t);if(!a)return;var i={type:"attributeRefAccess",root:n,attribute:a,args:[n],op:function(e,t){var n=r.resolveProperty(t,a.name,true);return n},evaluate:function(e){return c.unifiedEval(this,e)}};return i}));s.addIndirectExpression("arrayIndex",(function(e,r,t,n){if(!t.matchOpToken("["))return;var a=false;var i=false;var o=null;var u=null;if(t.matchOpToken("..")){a=true;o=e.requireElement("expression",t)}else{o=e.requireElement("expression",t);if(t.matchOpToken("..")){i=true;var l=t.currentToken();if(l.type!=="R_BRACKET"){u=e.parseElement("expression",t)}}}t.requireOpToken("]");var f={type:"arrayIndex",root:n,firstIndex:o,secondIndex:u,args:[n,o,u],op:function(e,r,t,n){if(a){return r.slice(0,t+1)}else if(i){if(n!=null){return r.slice(t,n+1)}else{return r.slice(t)}}else{return r[t]}},evaluate:function(e){return c.unifiedEval(this,e)}};return s.parseElement("indirectExpression",t,f)}));s.addGrammarElement("postfixExpression",(function(e,r,t){var n=e.parseElement("primaryExpression",t);if(t.matchOpToken(":")){var a=t.requireTokenType("IDENTIFIER");var i=!t.matchOpToken("!");return{type:"typeCheck",typeName:a,nullOk:i,args:[n],op:function(e,t){var n=r.typeCheck(t,a.value,i);if(n){return t}else{throw new Error("Typecheck failed!  Expected: "+a.value)}},evaluate:function(e){return r.unifiedEval(this,e)}}}else{return n}}));s.addGrammarElement("logicalNot",(function(e,r,t){if(!t.matchToken("not"))return;var n=e.requireElement("unaryExpression",t);return{type:"logicalNot",root:n,args:[n],op:function(e,r){return!r},evaluate:function(e){return r.unifiedEval(this,e)}}}));s.addGrammarElement("noExpression",(function(e,r,t){if(!t.matchToken("no"))return;var n=e.requireElement("unaryExpression",t);return{type:"noExpression",root:n,args:[n],op:function(e,t){return r.isEmpty(t)},evaluate:function(e){return r.unifiedEval(this,e)}}}));s.addGrammarElement("negativeNumber",(function(e,r,t){if(!t.matchOpToken("-"))return;var n=e.requireElement("unaryExpression",t);return{type:"negativeNumber",root:n,args:[n],op:function(e,r){return-1*r},evaluate:function(e){return r.unifiedEval(this,e)}}}));s.addGrammarElement("unaryExpression",(function(e,r,t){return e.parseAnyOf(["logicalNot","relativePositionalExpression","positionalExpression","noExpression","negativeNumber","postfixExpression"],t)}));var f=function(e,r,t,n){var a=r.querySelectorAll(t);for(var i=0;i<a.length;i++){var o=a[i];if(o.compareDocumentPosition(e)===Node.DOCUMENT_POSITION_PRECEDING){return o}}if(n){return a[0]}};var m=function(e,r,t,n){var a=r.querySelectorAll(t);for(var i=a.length-1;i>=0;i--){var o=a[i];if(o.compareDocumentPosition(e)===Node.DOCUMENT_POSITION_FOLLOWING){return o}}if(n){return a[a.length-1]}};var p=function(e,r,t,n){var a=[];c.forEach(r,(function(r){if(r.matches(t)||r===e){a.push(r)}}));for(var i=0;i<a.length-1;i++){var o=a[i];if(o===e){return a[i+1]}}if(n){var u=a[0];if(u&&u.matches(t)){return u}}};var v=function(e,r,t,n){return p(e,Array.from(r).reverse(),t,n)};s.addGrammarElement("relativePositionalExpression",(function(e,r,t){var n=t.matchAnyToken("next","previous");if(!n)return;if(n.value==="next"){var a=true}var i=e.parseElement("expression",t);if(t.matchToken("from")){t.pushFollow("in");try{var o=e.requireElement("expression",t)}finally{t.popFollow()}}else{var o=e.requireElement("implicitMeTarget",t)}var u=false;var s;if(t.matchToken("in")){u=true;var l=e.requireElement("expression",t)}else if(t.matchToken("within")){s=e.requireElement("expression",t)}else{s=document.body}var c=false;if(t.matchToken("with")){t.requireToken("wrapping");c=true}return{type:"relativePositionalExpression",from:o,forwardSearch:a,inSearch:u,wrapping:c,inElt:l,withinElt:s,operator:n.value,args:[i,o,l,s],op:function(e,r,t,n,i){var o=r.css;if(o==null){throw"Expected a CSS value"}if(u){if(n){if(a){return p(t,n,o,c)}else{return v(t,n,o,c)}}}else{if(i){if(a){return f(t,i,o,c)}else{return m(t,i,o,c)}}}},evaluate:function(e){return r.unifiedEval(this,e)}}}));s.addGrammarElement("positionalExpression",(function(e,r,t){var n=t.matchAnyToken("first","last","random");if(!n)return;t.matchAnyToken("in","from","of");var a=e.requireElement("unaryExpression",t);const i=n.value;return{type:"positionalExpression",rhs:a,operator:n.value,args:[a],op:function(e,r){if(r&&!Array.isArray(r)){if(r.children){r=r.children}else{r=Array.from(r)}}if(r){if(i==="first"){return r[0]}else if(i==="last"){return r[r.length-1]}else if(i==="random"){return r[Math.floor(Math.random()*r.length)]}}},evaluate:function(e){return r.unifiedEval(this,e)}}}));s.addGrammarElement("mathOperator",(function(e,r,t){var n=e.parseElement("unaryExpression",t);var a,i=null;a=t.matchAnyOpToken("+","-","*","/","%");while(a){i=i||a;var o=a.value;if(i.value!==o){e.raiseParseError(t,"You must parenthesize math operations with different operators")}var u=e.parseElement("unaryExpression",t);n={type:"mathOperator",lhs:n,rhs:u,operator:o,args:[n,u],op:function(e,r,t){if(o==="+"){return r+t}else if(o==="-"){return r-t}else if(o==="*"){return r*t}else if(o==="/"){return r/t}else if(o==="%"){return r%t}},evaluate:function(e){return r.unifiedEval(this,e)}};a=t.matchAnyOpToken("+","-","*","/","%")}return n}));s.addGrammarElement("mathExpression",(function(e,r,t){return e.parseAnyOf(["mathOperator","unaryExpression"],t)}));s.addGrammarElement("comparisonOperator",(function(e,r,t){var n=e.parseElement("mathExpression",t);var a=t.matchAnyOpToken("<",">","<=",">=","==","===","!=","!==");var i=a?a.value:null;var o=true;var u=false;if(i==null){if(t.matchToken("is")||t.matchToken("am")){if(t.matchToken("not")){if(t.matchToken("in")){i="not in"}else if(t.matchToken("a")){i="not a";u=true}else if(t.matchToken("empty")){i="not empty";o=false}else{i="!="}}else if(t.matchToken("in")){i="in"}else if(t.matchToken("a")){i="a";u=true}else if(t.matchToken("empty")){i="empty";o=false}else{i="=="}}else if(t.matchToken("matches")||t.matchToken("match")){i="match"}else if(t.matchToken("contains")||t.matchToken("contain")){i="contain"}else if(t.matchToken("do")||t.matchToken("does")){t.requireToken("not");if(t.matchToken("matches")||t.matchToken("match")){i="not match"}else if(t.matchToken("contains")||t.matchToken("contain")){i="not contain"}else{e.raiseParseError(t,"Expected matches or contains")}}}if(i){if(u){var s=t.requireTokenType("IDENTIFIER");var l=!t.matchOpToken("!")}else if(o){var c=e.requireElement("mathExpression",t);if(i==="match"||i==="not match"){c=c.css?c.css:c}}n={type:"comparisonOperator",operator:i,typeName:s,nullOk:l,lhs:n,rhs:c,args:[n,c],op:function(e,t,n){if(i==="=="){return t==n}else if(i==="!="){return t!=n}if(i==="in"){return n!=null&&Array.from(n).indexOf(t)>=0}if(i==="not in"){return n==null||Array.from(n).indexOf(t)<0}if(i==="match"){return t!=null&&t.matches(n)}if(i==="not match"){return t==null||!t.matches(n)}if(i==="contain"){return t!=null&&t.contains(n)}if(i==="not contain"){return t==null||!t.contains(n)}if(i==="==="){return t===n}else if(i==="!=="){return t!==n}else if(i==="<"){return t<n}else if(i===">"){return t>n}else if(i==="<="){return t<=n}else if(i===">="){return t>=n}else if(i==="empty"){return r.isEmpty(t)}else if(i==="not empty"){return!r.isEmpty(t)}else if(i==="a"){return r.typeCheck(t,s.value,l)}else if(i==="not a"){return!r.typeCheck(t,s.value,l)}else{throw"Unknown comparison : "+i}},evaluate:function(e){return r.unifiedEval(this,e)}}}return n}));s.addGrammarElement("comparisonExpression",(function(e,r,t){return e.parseAnyOf(["comparisonOperator","mathExpression"],t)}));s.addGrammarElement("logicalOperator",(function(e,r,t){var n=e.parseElement("comparisonExpression",t);var a,i=null;a=t.matchToken("and")||t.matchToken("or");while(a){i=i||a;if(i.value!==a.value){e.raiseParseError(t,"You must parenthesize logical operations with different operators")}var o=e.requireElement("comparisonExpression",t);const u=a.value;n={type:"logicalOperator",operator:u,lhs:n,rhs:o,args:[n,o],op:function(e,r,t){if(u==="and"){return r&&t}else{return r||t}},evaluate:function(e){return r.unifiedEval(this,e)}};a=t.matchToken("and")||t.matchToken("or")}return n}));s.addGrammarElement("logicalExpression",(function(e,r,t){return e.parseAnyOf(["logicalOperator","mathExpression"],t)}));s.addGrammarElement("asyncExpression",(function(e,r,t){if(t.matchToken("async")){var n=e.requireElement("logicalExpression",t);var a={type:"asyncExpression",value:n,evaluate:function(e){return{asyncWrapper:true,value:this.value.evaluate(e)}}};return a}else{return e.parseElement("logicalExpression",t)}}));s.addGrammarElement("expression",(function(e,r,t){t.matchToken("the");return e.parseElement("asyncExpression",t)}));s.addGrammarElement("assignableExpression",(function(e,r,t){t.matchToken("the");var n=e.parseElement("primaryExpression",t);if(n&&(n.type==="symbol"||n.type==="ofExpression"||n.type==="propertyAccess"||n.type==="attributeRefAccess"||n.type==="attributeRef"||n.type==="possessive")){return n}else{s.raiseParseError(t,"A target expression must be writable.  The expression type '"+(n&&n.type)+"' is not.")}return n}));s.addGrammarElement("hyperscript",(function(e,r,t){var n=[];if(t.hasMore()){while(e.featureStart(t.currentToken())||t.currentToken().value==="("){var a=e.requireElement("feature",t);n.push(a);t.matchToken("end")}}return{type:"hyperscript",features:n,apply:function(e,r,t){for(const a of n){a.install(e,r,t)}}}}));var h=function(e){var r=[];if(e.token(0).value==="("&&(e.token(1).value===")"||e.token(2).value===","||e.token(2).value===")")){e.matchOpToken("(");do{r.push(e.requireTokenType("IDENTIFIER"))}while(e.matchOpToken(","));e.requireOpToken(")")}return r};s.addFeature("on",(function(r,t,n){if(!n.matchToken("on"))return;var a=false;if(n.matchToken("every")){a=true}var i=[];var o=null;do{var u=r.requireElement("eventName",n,"Expected event name");var s=u.evaluate();if(o){o=o+" or "+s}else{o="on "+s}var l=h(n);var f=null;if(n.matchOpToken("[")){f=r.requireElement("expression",n);n.requireOpToken("]")}if(n.currentToken().type==="NUMBER"){var m=n.consumeToken();var p=parseInt(m.value);if(n.matchToken("to")){var v=n.consumeToken();var d=parseInt(v.value)}else if(n.matchToken("and")){var E=true;n.requireToken("on")}}if(s==="intersection"){var T={};if(n.matchToken("with")){T["with"]=r.requireElement("expression",n).evaluate()}if(n.matchToken("having")){do{if(n.matchToken("margin")){T["rootMargin"]=r.requireElement("stringLike",n).evaluate()}else if(n.matchToken("threshold")){T["threshold"]=r.requireElement("expression",n).evaluate()}else{r.raiseParseError(n,"Unknown intersection config specification")}}while(n.matchToken("and"))}}else if(s==="mutation"){var y={};if(n.matchToken("of")){do{if(n.matchToken("anything")){y["attributes"]=true;y["subtree"]=true;y["characterData"]=true;y["childList"]=true}else if(n.matchToken("childList")){y["childList"]=true}else if(n.matchToken("attributes")){y["attributes"]=true;y["attributeOldValue"]=true}else if(n.matchToken("subtree")){y["subtree"]=true}else if(n.matchToken("characterData")){y["characterData"]=true;y["characterDataOldValue"]=true}else if(n.currentToken().type==="ATTRIBUTE_REF"){var k=n.consumeToken();if(y["attributeFilter"]==null){y["attributeFilter"]=[]}if(k.value.indexOf("@")==0){y["attributeFilter"].push(k.value.substring(1))}else{r.raiseParseError(n,"Only shorthand attribute references are allowed here")}}else{r.raiseParseError(n,"Unknown mutation config specification")}}while(n.matchToken("or"))}else{y["attributes"]=true;y["characterData"]=true;y["childList"]=true}}var x=null;var g=false;if(n.matchToken("from")){if(n.matchToken("elsewhere")){g=true}else{x=r.parseElement("expression",n);if(!x){r.raiseParseError(n,'Expected either target value or "elsewhere".')}}}if(x===null&&g===false&&n.matchToken("elsewhere")){g=true}if(n.matchToken("in")){var b=r.parseAnyOf(["idRef","queryRef","classRef"],n)}if(n.matchToken("debounced")){n.requireToken("at");var w=r.requireElement("timeExpression",n);var q=w.evaluate({})}else if(n.matchToken("throttled")){n.requireToken("at");var w=r.requireElement("timeExpression",n);var S=w.evaluate({})}i.push({execCount:0,every:a,on:s,args:l,filter:f,from:x,inExpr:b,elsewhere:g,startCount:p,endCount:d,unbounded:E,debounceTime:q,throttleTime:S,mutationSpec:y,intersectionSpec:T})}while(n.matchToken("or"));var N=[];var O=true;if(!a){if(n.matchToken("queue")){if(n.matchToken("all")){var I=true;var O=false}else if(n.matchToken("first")){var L=true}else if(n.matchToken("none")){var R=true}else{n.requireToken("last")}}}var C=r.parseElement("commandList",n);var A={type:"implicitReturn",op:function(e){e.meta.resolve();return t.HALT},execute:function(e){}};if(C){var F=C;var P=F;while(P.next){P=P.next}P.next=A}else{F=A}var M={displayName:o,events:i,start:F,every:a,executing:false,execCount:0,queue:N,execute:function(e){if(this.executing&&a===false){if(R||L&&N.length>0){return}if(O){M.queue.length=0}M.queue.push(e);return}M.execCount++;this.executing=true;e.meta.resolve=function(){M.executing=false;var e=M.queue.shift();if(e){setTimeout((function(){M.execute(e)}),1)}};e.meta.reject=function(r){console.error(r.message?r.message:r);var n=t.getHyperTrace(e,r);if(n){n.print()}t.triggerEvent(e.me,"exception",{error:r});M.executing=false;var a=M.queue.shift();if(a){setTimeout((function(){M.execute(a)}),1)}};F.execute(e)},install:function(r,n){for(const n of M.events){var a;if(n.elsewhere){a=[document]}else if(n.from){a=n.from.evaluate(t.makeContext(r,M,r,null))}else{a=[r]}t.forEach(a,(function(a){var i=n.on;if(n.mutationSpec){i="hyperscript:mutation";const e=new MutationObserver((function(e,r){console.log(a,e);if(!M.executing){c.triggerEvent(a,i,{mutationList:e,observer:r})}}));e.observe(a,n.mutationSpec)}if(n.intersectionSpec){i="hyperscript:insersection";const r=new IntersectionObserver((function(t){for(const o of t){var n={observer:r};n=e(n,o);n["intersecting"]=o.isIntersecting;c.triggerEvent(a,i,n)}}),n.intersectionSpec);r.observe(a)}a.addEventListener(i,(function e(o){if(r instanceof Node&&a!==r&&!r.isConnected){a.removeEventListener(i,e);return}var u=t.makeContext(r,M,r,o);if(n.elsewhere&&r.contains(o.target)){return}if(n.from){u.result=a}for(const e of n.args){u[e.value]=u.event[e.value]||("detail"in u.event?u.event["detail"][e.value]:null)}if(n.filter){var s=u.meta.context;u.meta.context=u.event;try{var l=n.filter.evaluate(u);if(l){}else{return}}finally{u.meta.context=s}}if(n.inExpr){var c=o.target;while(true){if(c.matches&&c.matches(n.inExpr.css)){u.result=c;break}else{c=c.parentElement;if(c==null){return}}}}n.execCount++;if(n.startCount){if(n.endCount){if(n.execCount<n.startCount||n.execCount>n.endCount){return}}else if(n.unbounded){if(n.execCount<n.startCount){return}}else if(n.execCount!==n.startCount){return}}if(n.debounceTime){if(n.debounced){clearTimeout(n.debounced)}n.debounced=setTimeout((function(){M.execute(u)}),n.debounceTime);return}if(n.throttleTime){if(n.lastExec&&Date.now()<n.lastExec+n.throttleTime){return}else{n.lastExec=Date.now()}}M.execute(u)}))}))}}};r.setParent(F,M);return M}));s.addFeature("def",(function(e,r,t){if(!t.matchToken("def"))return;var n=e.requireElement("dotOrColonPath",t);var a=n.evaluate();var i=a.split(".");var o=i.pop();var u=[];if(t.matchOpToken("(")){if(t.matchOpToken(")")){}else{do{u.push(t.requireTokenType("IDENTIFIER"))}while(t.matchOpToken(","));t.requireOpToken(")")}}var s=e.requireElement("commandList",t);if(t.matchToken("catch")){var l=t.requireTokenType("IDENTIFIER").value;var c=e.parseElement("commandList",t)}var f={displayName:o+"("+u.map((function(e){return e.value})).join(", ")+")",name:o,args:u,start:s,errorHandler:c,errorSymbol:l,install:function(e,t){var n=function(){var n=r.makeContext(t,f,e,null);n.meta.errorHandler=c;n.meta.errorSymmbol=l;for(var a=0;a<u.length;a++){var i=u[a];var o=arguments[a];if(i){n[i.value]=o}}n.meta.caller=arguments[u.length];if(n.meta.caller){n.meta.callingCommand=n.meta.caller.meta.command}var m,p=null;var v=new Promise((function(e,r){m=e;p=r}));s.execute(n);if(n.meta.returned){return n.meta.returnValue}else{n.meta.resolve=m;n.meta.reject=p;return v}};n.hyperfunc=true;n.hypername=a;r.assignToNamespace(e,i,o,n)}};var m={type:"implicitReturn",op:function(e){e.meta.returned=true;if(e.meta.resolve){e.meta.resolve()}return r.HALT},execute:function(e){}};if(s){var p=s;while(p.next){p=p.next}p.next=m}else{f.start=m}if(c){var p=c;while(p.next){p=p.next}p.next=m}e.setParent(s,f);return f}));s.addFeature("init",(function(e,r,t){if(!t.matchToken("init"))return;var n=e.parseElement("commandList",t);var a={start:n,install:function(e,t){setTimeout((function(){n&&n.execute(r.makeContext(e,a,e,null))}),0)}};var i={type:"implicitReturn",op:function(e){return r.HALT},execute:function(e){}};if(n){var o=n;while(o.next){o=o.next}o.next=i}else{a.start=i}e.setParent(n,a);return a}));s.addFeature("worker",(function(e,r,t){if(t.matchToken("worker")){e.raiseParseError(t,"In order to use the 'worker' feature, include "+"the _hyperscript worker plugin. See "+"https://hyperscript.org/features/worker/ for "+"more info.")}}));s.addFeature("behavior",(function(e,t,n){if(!n.matchToken("behavior"))return;var a=e.requireElement("dotOrColonPath",n).evaluate();var o=a.split(".");var u=o.pop();var s=[];if(n.matchOpToken("(")&&!n.matchOpToken(")")){do{s.push(n.requireTokenType("IDENTIFIER").value)}while(n.matchOpToken(","));n.requireOpToken(")")}var l=e.requireElement("hyperscript",n);for(var c=0;c<l.features.length;c++){var f=l.features[c];f.behavior=a}return{install:function(e,n){t.assignToNamespace(i.document&&i.document.body,o,u,(function(e,n,i){var o=t.getInternalData(e);var u=r(o,a+"Scope");for(var c=0;c<s.length;c++){u[s[c]]=i[s[c]]}l.apply(e,n)}))}}}));s.addFeature("install",(function(e,r,t){if(!t.matchToken("install"))return;var n=e.requireElement("dotOrColonPath",t).evaluate();var a=n.split(".");var o=e.parseElement("namedArgumentList",t);var u;return u={install:function(e,t){r.unifiedEval({args:[o],op:function(r,o){var u=i;for(var s=0;s<a.length;s++){u=u[a[s]];if(typeof u!=="object"&&typeof u!=="function")throw new Error("No such behavior defined as "+n)}if(!(u instanceof Function))throw new Error(n+" is not a behavior");u(e,t,o)}},r.makeContext(e,u,e))}}}));s.addGrammarElement("jsBody",(function(e,r,t){var n=t.currentToken().start;var a=t.currentToken();var i=[];var o="";var u=false;while(t.hasMore()){a=t.consumeToken();var s=t.token(0,true);if(s.type==="IDENTIFIER"&&s.value==="end"){break}if(u){if(a.type==="IDENTIFIER"||a.type==="NUMBER"){o+=a.value}else{if(o!=="")i.push(o);o="";u=false}}else if(a.type==="IDENTIFIER"&&a.value==="function"){u=true}}var l=a.end+1;return{type:"jsBody",exposedFunctionNames:i,jsSource:t.source.substring(n,l)}}));s.addFeature("js",(function(r,t,n){if(!n.matchToken("js"))return;var a=r.requireElement("jsBody",n);var o=a.jsSource+"\nreturn { "+a.exposedFunctionNames.map((function(e){return e+":"+e})).join(",")+" } ";var u=new Function(o);return{jsSource:o,function:u,exposedFunctionNames:a.exposedFunctionNames,install:function(){e(i,u())}}}));s.addCommand("js",(function(e,r,t){if(!t.matchToken("js"))return;var n=[];if(t.matchOpToken("(")){if(t.matchOpToken(")")){}else{do{var o=t.requireTokenType("IDENTIFIER");n.push(o.value)}while(t.matchOpToken(","));t.requireOpToken(")")}}var u=e.requireElement("jsBody",t);t.matchToken("end");var s=a(Function,n.concat([u.jsSource]));var l={jsSource:u.jsSource,function:s,inputs:n,op:function(e){var t=[];n.forEach((function(n){t.push(r.resolveSymbol(n,e,"default"))}));var a=s.apply(i,t);if(a&&typeof a.then==="function"){return new Promise((function(t){a.then((function(n){e.result=n;t(r.findNext(this,e))}))}))}else{e.result=a;return r.findNext(this,e)}}};return l}));s.addCommand("async",(function(e,r,t){if(!t.matchToken("async"))return;if(t.matchToken("do")){var n=e.requireElement("commandList",t);var a=n;while(a.next)a=a.next;a.next=r.HALT;t.requireToken("end")}else{var n=e.requireElement("command",t)}var i={body:n,op:function(e){setTimeout((function(){n.execute(e)}));return r.findNext(this,e)}};return i}));s.addCommand("tell",(function(e,r,t){var n=t.currentToken();if(!t.matchToken("tell"))return;var a=e.requireElement("expression",t);var i=e.requireElement("commandList",t);if(t.hasMore()){t.requireToken("end")}var o="tell_"+n.start;var u={value:a,body:i,args:[a],resolveNext:function(e){var t=e.meta.iterators[o];if(t.index<t.value.length){e.beingTold=t.value[t.index++];return i}else{e.beingTold=t.originalBeingTold;if(this.next){return this.next}else{return r.findNext(this.parent,e)}}},op:function(e,r){if(r==null){r=[]}else if(!(Array.isArray(r)||r instanceof NodeList)){r=[r]}e.meta.iterators[o]={originalBeingTold:e.beingTold,index:0,value:r};return this.resolveNext(e)}};e.setParent(i,u);return u}));s.addCommand("wait",(function(e,r,t){if(!t.matchToken("wait"))return;var n;if(t.matchToken("for")){t.matchToken("a");var a=[];do{var i=t.token(0);if(i.type==="NUMBER"||i.type==="L_PAREN"){a.push({time:e.requireElement("timeExpression",t).evaluate()})}else{a.push({name:s.requireElement("dotOrColonPath",t,"Expected event name").evaluate(),args:h(t)})}}while(t.matchToken("or"));if(t.matchToken("from")){var o=e.requireElement("expression",t)}n={event:a,on:o,args:[o],op:function(e,t){var n=t?t:e.me;if(!(n instanceof EventTarget))throw new Error("Not a valid event target: "+this.on.sourceFor());return new Promise((t=>{var i=false;for(const u of a){var o=n=>{e.result=n;for(const r of u.args){e[r.value]=n[r.value]||(n.detail?n.detail[r.value]:null)}if(!i){i=true;t(r.findNext(this,e))}};if(u.name)n.addEventListener(u.name,o,{once:true});else if(u.time)setTimeout(o,u.time,u.time)}}))}};return n}else{var u;if(t.matchToken("a")){t.requireToken("tick");u=0}else{u=s.requireElement("timeExpression",t)}n={type:"waitCmd",time:u,args:[u],op:function(e,t){return new Promise((n=>{setTimeout((()=>{n(r.findNext(this,e))}),t)}))},execute:function(e){return r.unifiedExec(this,e)}};return n}}));s.addGrammarElement("dotOrColonPath",(function(e,r,t){var n=t.matchTokenType("IDENTIFIER");if(n){var a=[n.value];var i=t.matchOpToken(".")||t.matchOpToken(":");if(i){do{a.push(t.requireTokenType("IDENTIFIER").value)}while(t.matchOpToken(i.value))}return{type:"dotOrColonPath",path:a,evaluate:function(){return a.join(i?i.value:"")}}}}));s.addGrammarElement("eventName",(function(e,r,t){var n;if(n=t.matchTokenType("STRING")){return{evaluate:function(){return n.value}}}return e.parseElement("dotOrColonPath",t)}));s.addCommand("send",(function(e,r,t){if(!t.matchToken("send"))return;var n=e.requireElement("eventName",t);var a=e.parseElement("namedArgumentList",t);if(t.matchToken("to")){var i=e.requireElement("expression",t)}else{var i=e.requireElement("implicitMeTarget",t)}var o={eventName:n,details:a,to:i,args:[i,n,a],op:function(e,t,n,a){r.forEach(t,(function(e){r.triggerEvent(e,n,a?a:{})}));return r.findNext(o,e)}};return o}));var d=function(e,r,t,n){if(n){var a=e.requireElement("expression",t)}var i={value:a,args:[a],op:function(e,t){var n=e.meta.resolve;e.meta.returned=true;if(n){if(t){n(t)}else{n()}}else{e.meta.returned=true;e.meta.returnValue=t}return r.HALT}};return i};s.addCommand("return",(function(e,r,t){if(t.matchToken("return")){return d(e,r,t,true)}}));s.addCommand("exit",(function(e,r,t){if(t.matchToken("exit")){return d(e,r,t,false)}}));s.addCommand("halt",(function(e,r,t){if(t.matchToken("halt")){if(t.matchToken("the")){t.requireToken("event");if(t.matchOpToken("'")){t.requireToken("s")}var n=true}if(t.matchToken("bubbling")){var a=true}else if(t.matchToken("default")){var i=true}var o=d(e,r,t,false);var u={keepExecuting:true,bubbling:a,haltDefault:i,exit:o,op:function(e){if(e.event){if(a){e.event.stopPropagation()}else if(i){e.event.preventDefault()}else{e.event.stopPropagation();e.event.preventDefault()}if(n){return r.findNext(this,e)}else{return o}}}};return u}}));s.addCommand("log",(function(e,r,t){if(!t.matchToken("log"))return;var n=[e.parseElement("expression",t)];while(t.matchOpToken(",")){n.push(e.requireElement("expression",t))}if(t.matchToken("with")){var a=e.requireElement("expression",t)}var i={exprs:n,withExpr:a,args:[a,n],op:function(e,t,n){if(t){t.apply(null,n)}else{console.log.apply(null,n)}return r.findNext(this,e)}};return i}));s.addCommand("throw",(function(e,r,t){if(!t.matchToken("throw"))return;var n=e.requireElement("expression",t);var a={expr:n,args:[n],op:function(e,t){r.registerHyperTrace(e,t);var n=e.meta&&e.meta.reject;if(n){n(t);return r.HALT}else{throw t}}};return a}));var E=function(e,r,t){var n=e.requireElement("expression",t);var a={expr:n,args:[n],op:function(e,t){e.result=t;return r.findNext(a,e)}};return a};s.addCommand("call",(function(e,r,t){if(!t.matchToken("call"))return;var n=E(e,r,t);if(n.expr&&n.expr.type!=="functionCall"){e.raiseParseError(t,"Must be a function invocation")}return n}));s.addCommand("get",(function(e,r,t){if(t.matchToken("get")){return E(e,r,t)}}));s.addCommand("make",(function(e,r,t){if(!t.matchToken("make"))return;t.matchToken("a")||t.matchToken("an");var n=e.requireElement("expression",t);var i=[];if(n.type!=="queryRef"&&t.matchToken("from")){do{i.push(e.requireElement("expression",t))}while(t.matchOpToken(","))}if(t.matchToken("called")){var o=t.requireTokenType("IDENTIFIER").value}var u;if(n.type==="queryRef"){u={op:function(e){var t,a="div",i,u=[];var s=/(?:(^|#|\.)([^#\. ]+))/g;while(t=s.exec(n.css)){if(t[1]==="")a=t[2].trim();else if(t[1]==="#")i=t[2].trim();else u.push(t[2].trim())}var l=document.createElement(a);if(i!==undefined)l.id=i;for(var c=0;c<u.length;c++){var f=u[c];l.classList.add(f)}e.result=l;if(o)e[o]=l;return r.findNext(this,e)}};return u}else{u={args:[n,i],op:function(e,t,n){e.result=a(t,n);if(o)e[o]=e.result;return r.findNext(this,e)}};return u}}));s.addGrammarElement("pseudoCommand",(function(e,r,t){try{var n=e.requireElement("primaryExpression",t)}finally{t.popFollow()}if(n.type!=="functionCall"&&n.root.type!=="symbol"&&n.root.root!=null){e.raiseParseError(t,"Implicit function calls must start with a simple function")}var a=n.root.name;if(t.matchAnyToken("the","to","on","with","into","from","at")){var i=e.requireElement("expression",t)}else if(t.matchToken("me")){var i=e.requireElement("implicitMeTarget",t)}var o=n.argExressions;var u={type:"pseudoCommand",expr:n,args:[i,o],op:function(e,t,n){if(t){var i=t[a]}else{var i=r.resolveSymbol(a,e)}if(i.hyperfunc){n.push(e)}var o=i.apply(t,n);e.result=o;return r.findNext(u,e)},execute:function(e){return r.unifiedExec(this,e)}};return u}));var T=function(e,r,t,n,a){var i=n.type==="symbol";var o=n.type==="attributeRef";if(!o&&!i&&n.root==null){e.raiseParseError(t,"Can only put directly into symbols, not references")}var u=null;var s=null;if(i){}else if(o){u=e.requireElement("implicitMeTarget",t);var l=n}else{s=n.prop?n.prop.value:null;var l=n.attribute;u=n.root}var c={target:n,symbolWrite:i,value:a,args:[u,a],op:function(e,t,a){if(i){r.setSymbol(n.name,e,n.symbolType,a)}else{r.implicitLoop(t,(function(e){if(l){if(a==null){e.removeAttribute(l.name)}else{e.setAttribute(l.name,a)}}else{e[s]=a}}))}return r.findNext(this,e)}};return c};s.addCommand("default",(function(e,r,t){if(!t.matchToken("default"))return;var n=e.requireElement("assignableExpression",t);t.requireToken("to");var a=e.requireElement("expression",t);var i=T(e,r,t,n,a);var o={target:n,value:a,setter:i,args:[n],op:function(e,t){if(t){return r.findNext(this,e)}else{return i}}};i.parent=o;return o}));s.addCommand("set",(function(r,t,n){if(!n.matchToken("set"))return;if(n.currentToken().type==="L_BRACE"){var a=r.requireElement("objectLiteral",n);n.requireToken("on");var i=r.requireElement("expression",n);var o={objectLiteral:a,target:i,args:[a,i],op:function(r,n,a){e(a,n);return t.findNext(this,r)}};return o}try{n.pushFollow("to");var i=r.requireElement("assignableExpression",n)}finally{n.popFollow()}n.requireToken("to");var u=r.requireElement("expression",n);return T(r,t,n,i,u)}));s.addCommand("if",(function(e,r,t){if(!t.matchToken("if"))return;var n=e.requireElement("expression",t);t.matchToken("then");var a=e.parseElement("commandList",t);if(t.matchToken("else")){var i=e.parseElement("commandList",t)}if(t.hasMore()){t.requireToken("end")}var o={expr:n,trueBranch:a,falseBranch:i,args:[n],op:function(e,t){if(t){return a}else if(i){return i}else{return r.findNext(this,e)}}};e.setParent(a,o);e.setParent(i,o);return o}));var y=function(e,r,t,n){var a=r.currentToken();var i;if(r.matchToken("for")||n){var o=r.requireTokenType("IDENTIFIER");i=o.value;r.requireToken("in");var u=e.requireElement("expression",r)}else if(r.matchToken("in")){i="it";var u=e.requireElement("expression",r)}else if(r.matchToken("while")){var l=e.requireElement("expression",r)}else if(r.matchToken("until")){var c=true;if(r.matchToken("event")){var f=s.requireElement("dotOrColonPath",r,"Expected event name");if(r.matchToken("from")){var m=e.requireElement("expression",r)}}else{var l=e.requireElement("expression",r)}}else if(r.matchTokenType("NUMBER")){var p=parseFloat(a.value);r.requireToken("times")}else{r.matchToken("forever");var v=true}if(r.matchToken("index")){var o=r.requireTokenType("IDENTIFIER");var h=o.value}var d=e.parseElement("commandList",r);if(d&&f){var E=d;while(E.next){E=E.next}var T={type:"waitATick",op:function(){return new Promise((function(e){setTimeout((function(){e(t.findNext(T))}),0)}))}};E.next=T}if(r.hasMore()){r.requireToken("end")}if(i==null){i="_implicit_repeat_"+a.start;var y=i}else{var y=i+"_"+a.start}var k={identifier:i,indexIdentifier:h,slot:y,expression:u,forever:v,times:p,until:c,event:f,on:m,whileExpr:l,resolveNext:function(){return this},loop:d,args:[l],op:function(e,r){var n=e.meta.iterators[y];var a=false;var o=null;if(this.forever){a=true}else if(this.until){if(f){a=e.meta.iterators[y].eventFired===false}else{a=r!==true}}else if(l){a=r}else if(p){a=n.index<this.times}else{var u=n.iterator.next();a=!u.done;o=u.value}if(a){if(n.value){e.result=e[i]=o}else{e.result=n.index}if(h){e[h]=n.index}n.index++;return d}else{e.meta.iterators[y]=null;return t.findNext(this.parent,e)}}};e.setParent(d,k);var x={name:"repeatInit",args:[u,f,m],op:function(e,r,t,n){var a={index:0,value:r,eventFired:false};e.meta.iterators[y]=a;if(r&&r[Symbol.iterator]){a.iterator=r[Symbol.iterator]()}if(f){var i=n||e.me;i.addEventListener(t,(function(r){e.meta.iterators[y].eventFired=true}),{once:true})}return k},execute:function(e){return t.unifiedExec(this,e)}};e.setParent(k,x);return x};s.addCommand("repeat",(function(e,r,t){if(t.matchToken("repeat")){return y(e,t,r,false)}}));s.addCommand("for",(function(e,r,t){if(t.matchToken("for")){return y(e,t,r,true)}}));s.addGrammarElement("stringLike",(function(e,r,t){return s.parseAnyOf(["string","nakedString"],t)}));s.addCommand("append",(function(e,r,t){if(!t.matchToken("append"))return;var n=null;var a=null;var i=e.requireElement("expression",t);if(t.matchToken("to")){n=e.requireElement("expression",t)}if(n==null){a="result"}else if(n.type==="symbol"){a=n.name}else if(n.type==="propertyAccess"){a=n.prop.value}else{throw"Unable to append to "+n.type}var o={value:i,target:n,args:[i],op:function(e,t){if(Array.isArray(e[a])){e[a].push(t)}else if(e[a]instanceof Element){if(typeof t=="string"){e[a].innerHTML+=t}else{throw"Don't know how to append non-strings to an HTML Element yet."}}else{e[a]+=t}return r.findNext(this,e)},execute:function(e){return r.unifiedExec(this,e)}};return o}));s.addCommand("increment",(function(e,r,t){if(!t.matchToken("increment"))return;var n;var a=e.parseElement("assignableExpression",t);if(t.matchToken("by")){n=e.requireElement("expression",t)}var i={target:a,args:[a,n],op:function(n,i,o){i=i?parseFloat(i):0;o=o?parseFloat(o):1;var u=i+o;var s=T(e,r,t,a,u);n.result=u;s.parent=this;return s},execute:function(e){return r.unifiedExec(this,e)}};return i}));s.addCommand("decrement",(function(e,r,t){if(!t.matchToken("decrement"))return;var n;var a=e.parseElement("assignableExpression",t);if(t.matchToken("by")){n=e.requireElement("expression",t)}var i={target:a,args:[a,n],op:function(n,i,o){i=i?parseFloat(i):0;o=o?parseFloat(o):1;var u=i-o;var s=T(e,r,t,a,u);n.result=u;s.parent=this;return s},execute:function(e){return r.unifiedExec(this,e)}};return i}));s.addCommand("fetch",(function(e,r,t){if(!t.matchToken("fetch"))return;var n=e.requireElement("stringLike",t);var a=e.parseElement("objectLiteral",t);var i="text";var o;if(t.matchToken("as")){t.matchToken("a")||t.matchToken("an");if(t.matchToken("json")||t.matchToken("Object")){i="json"}else if(t.matchToken("response")){i="response"}else if(t.matchToken("html")){i="html"}else if(t.matchToken("text")){}else{o=e.requireElement("dotOrColonPath",t).evaluate()}}var u={url:n,argExpressions:a,args:[n,a],op:function(e,t,n){var a=n||{};a["sentBy"]=e.me;r.triggerEvent(e.me,"hyperscript:beforeFetch",a);n=a;return fetch(t,n).then((function(t){if(i==="response"){e.result=t;return r.findNext(u,e)}if(i==="json"){return t.json().then((function(t){e.result=t;return r.findNext(u,e)}))}return t.text().then((function(t){if(o)t=r.convertValue(t,o);if(i==="html")t=r.convertValue(t,"Fragment");e.result=t;return r.findNext(u,e)}))})).catch((function(t){r.triggerEvent(e.me,"fetch:error",{reason:t});throw t}))}};return u}))}function k(e){if(document.readyState!=="loading"){setTimeout(e)}else{document.addEventListener("DOMContentLoaded",e)}}function x(){var e=document.querySelector('meta[name="htmx-config"]');if(e){return t(e.content)}else{return null}}function g(){var r=x();if(r){_hyperscript.config=e(_hyperscript.config,r)}}if("document"in i){var b=Array.from(document.querySelectorAll("script[type='text/hyperscript'][src]"));Promise.all(b.map((function(e){return fetch(e.src).then((function(e){return e.text()})).then((function(e){return c.evaluate(e)}))}))).then((function(){k((function(){g();c.processNode(document.documentElement);document.addEventListener("htmx:load",(function(e){c.processNode(e.detail.elt)}))}))}))}return e((function(e,r){return c.evaluate(e,r)}),{internals:{lexer:u,parser:s,runtime:c},ElementCollection:o,addFeature:function(e,r){s.addFeature(e,r)},addCommand:function(e,r){s.addCommand(e,r)},addLeafExpression:function(e,r){s.addLeafExpression(e,r)},addIndirectExpression:function(e,r){s.addIndirectExpression(e,r)},evaluate:function(e,r){return c.evaluate(e,r)},parse:function(e){return c.parse(e)},processNode:function(e){c.processNode(e)},config:{attributes:"_, script, data-script",defaultTransition:"all 500ms ease-in",disableSelector:"[disable-scripting], [data-disable-scripting]",conversions:l}})}));(function(){function e(e,r){for(var t in r){if(r.hasOwnProperty(t)){e[t]=r[t]}}return e}var r=this._hyperscript;r.addCommand("settle",(function(e,r,t){if(t.matchToken("settle")){if(!e.commandBoundary(t.currentToken())){var n=e.requireElement("expression",t)}else{var n=e.requireElement("implicitMeTarget",t)}var a={type:"settleCmd",args:[n],op:function(e,t){var n=null;var i=false;var o=false;var u=new Promise((function(e){n=e}));t.addEventListener("transitionstart",(function(){o=true}),{once:true});setTimeout((function(){if(!o&&!i){n(r.findNext(a,e))}}),500);t.addEventListener("transitionend",(function(){if(!i){n(r.findNext(a,e))}}),{once:true});return u},execute:function(e){return r.unifiedExec(this,e)}};return a}}));r.addCommand("add",(function(e,r,t){if(t.matchToken("add")){var n=e.parseElement("classRef",t);var a=null;var i=null;if(n==null){a=e.parseElement("attributeRef",t);if(a==null){i=e.parseElement("styleLiteral",t);if(i==null){e.raiseParseError(t,"Expected either a class reference or attribute expression")}}}else{var o=[n];while(n=e.parseElement("classRef",t)){o.push(n)}}if(t.matchToken("to")){var u=e.requireElement("expression",t)}else{var u=e.parseElement("implicitMeTarget",t)}if(o){return{classRefs:o,to:u,args:[u,o],op:function(e,t,n){r.forEach(n,(function(e){r.forEach(t,(function(r){if(r instanceof Element)r.classList.add(e.className)}))}));return r.findNext(this,e)}}}else if(a){return{type:"addCmd",attributeRef:a,to:u,args:[u],op:function(e,t,n){r.forEach(t,(function(e){e.setAttribute(a.name,a.value)}));return r.findNext(this,e)},execute:function(e){return r.unifiedExec(this,e)}}}else{return{type:"addCmd",cssDeclaration:i,to:u,args:[u,i],op:function(e,t,n){r.forEach(t,(function(e){e.style.cssText+=n}));return r.findNext(this,e)},execute:function(e){return r.unifiedExec(this,e)}}}}}));r.internals.parser.addGrammarElement("styleLiteral",(function(e,r,t){if(!t.matchOpToken("{"))return;var n=[""];var a=[];while(t.hasMore()){if(t.matchOpToken("\\")){t.consumeToken()}else if(t.matchOpToken("}")){break}else if(t.matchToken("$")){var i=t.matchOpToken("{");var o=e.parseElement("expression",t);if(i)t.requireOpToken("}");a.push(o);n.push("")}else{var u=t.consumeToken();n[n.length-1]+=t.source.substring(u.start,u.end)}n[n.length-1]+=t.lastWhitespace()}return{type:"styleLiteral",args:[a],op:function(e,r){var t="";n.forEach((function(e,n){t+=e;if(n in r)t+=r[n]}));return t},evaluate:function(e){return r.unifiedEval(this,e)}}}));r.addCommand("remove",(function(e,r,t){if(t.matchToken("remove")){var n=e.parseElement("classRef",t);var a=null;var i=null;if(n==null){a=e.parseElement("attributeRef",t);if(a==null){i=e.parseElement("expression",t);if(i==null){e.raiseParseError(t,"Expected either a class reference, attribute expression or value expression")}}}else{var o=[n];while(n=e.parseElement("classRef",t)){o.push(n)}}if(t.matchToken("from")){var u=e.requireElement("expression",t)}else{var u=e.requireElement("implicitMeTarget",t)}if(i){return{elementExpr:i,from:u,args:[i],op:function(e,t){r.forEach(t,(function(e){if(e.parentElement){e.parentElement.removeChild(e)}}));return r.findNext(this,e)}}}else{return{classRefs:o,attributeRef:a,elementExpr:i,from:u,args:[o,u],op:function(e,t,n){if(t){r.forEach(t,(function(e){r.implicitLoop(n,(function(r){r.classList.remove(e.className)}))}))}else{r.forEach(n,(function(e){e.removeAttribute(a.name)}))}return r.findNext(this,e)}}}}}));r.addCommand("toggle",(function(e,r,t){if(t.matchToken("toggle")){if(t.matchToken("between")){var n=true;var a=e.parseElement("classRef",t);t.requireToken("and");var i=e.requireElement("classRef",t)}else{var a=e.parseElement("classRef",t);var o=null;if(a==null){o=e.parseElement("attributeRef",t);if(o==null){e.raiseParseError(t,"Expected either a class reference or attribute expression")}}else{var u=[a];while(a=e.parseElement("classRef",t)){u.push(a)}}}if(t.matchToken("on")){var s=e.requireElement("expression",t)}else{var s=e.requireElement("implicitMeTarget",t)}if(t.matchToken("for")){var l=e.requireElement("timeExpression",t)}else if(t.matchToken("until")){var c=e.requireElement("dotOrColonPath",t,"Expected event name");if(t.matchToken("from")){var f=e.requireElement("expression",t)}}var m={classRef:a,classRef2:i,classRefs:u,attributeRef:o,on:s,time:l,evt:c,from:f,toggle:function(e,t,a,i){if(n){r.forEach(e,(function(e){if(e.classList.contains(t.className)){e.classList.remove(t.className);e.classList.add(a.className)}else{e.classList.add(t.className);e.classList.remove(a.className)}}))}else if(i){r.forEach(i,(function(t){r.forEach(e,(function(e){e.classList.toggle(t.className)}))}))}else{r.forEach(e,(function(e){if(e.hasAttribute(o.name)){e.removeAttribute(o.name)}else{e.setAttribute(o.name,o.value)}}))}},args:[s,l,c,f,a,i,u],op:function(e,t,n,a,i,o,u,s){if(n){return new Promise((function(a){m.toggle(t,o,u,s);setTimeout((function(){m.toggle(t,o,u,s);a(r.findNext(m,e))}),n)}))}else if(a){return new Promise((function(n){var l=i||e.me;l.addEventListener(a,(function(){m.toggle(t,o,u,s);n(r.findNext(m,e))}),{once:true});m.toggle(t,o,u,s)}))}else{this.toggle(t,o,u,s);return r.findNext(m,e)}}};return m}}));var t={display:function(e,r,t){if(t){r.style.display=t}else if(e==="hide"){r.style.display="none"}else{r.style.display="block"}},visibility:function(e,r,t){if(t){r.style.visibility=t}else if(e==="hide"){r.style.visibility="hidden"}else{r.style.visibility="visible"}},opacity:function(e,r,t){if(t){r.style.opacity=t}else if(e==="hide"){r.style.opacity="0"}else{r.style.opacity="1"}}};var n=function(e,r,t){var n;var a=t.currentToken();if(a.value==="with"||e.commandBoundary(a)){n=e.parseElement("implicitMeTarget",t)}else{n=e.parseElement("expression",t)}return n};var a=function(n,a,i){var o=r.config.defaultHideShowStrategy;var u=t;if(r.config.hideShowStrategies){u=e(u,r.config.hideShowStrategies)}i=i||o||"display";var s=u[i];if(s==null){n.raiseParseError(a,"Unknown show/hide strategy : "+i)}return s};r.addCommand("hide",(function(e,r,t){if(t.matchToken("hide")){var i=n(e,r,t);var o=null;if(t.matchToken("with")){o=t.requireTokenType("IDENTIFIER").value}var u=a(e,t,o);return{target:i,args:[i],op:function(e,t){r.forEach(t,(function(e){u("hide",e)}));return r.findNext(this,e)}}}}));r.addCommand("show",(function(e,r,t){if(t.matchToken("show")){var i=n(e,r,t);var o=null;if(t.matchToken("with")){o=t.requireTokenType("IDENTIFIER").value}var u=null;if(t.matchOpToken(":")){var s=t.consumeUntilWhitespace();t.matchTokenType("WHITESPACE");u=s.map((function(e){return e.value})).join("")}var l=a(e,t,o);return{target:i,args:[i],op:function(e,t){r.forEach(t,(function(e){l("show",e,u)}));return r.findNext(this,e)}}}}));r.addCommand("trigger",(function(e,r,t){if(t.matchToken("trigger")){var n=e.requireElement("eventName",t);var a=e.parseElement("namedArgumentList",t);var i={eventName:n,details:a,args:[n,a],op:function(e,t,n){r.triggerEvent(e.me,t,n?n:{});return r.findNext(i,e)}};return i}}));r.addCommand("take",(function(e,r,t){if(t.matchToken("take")){var n=e.parseElement("classRef",t);if(t.matchToken("from")){var a=e.requireElement("expression",t)}else{var a=n}if(t.matchToken("for")){var i=e.requireElement("expression",t)}else{var i=e.requireElement("implicitMeTarget",t)}var o={classRef:n,from:a,forElt:i,args:[n,a,i],op:function(e,t,n,a){var i=t.className;r.forEach(n,(function(e){e.classList.remove(i)}));r.forEach(a,(function(e){e.classList.add(i)}));return r.findNext(this,e)}};return o}}));function i(e,t,n,a){if(n){var i=e.resolveSymbol(n,t)}else{var i=t}if(i instanceof Element||i instanceof HTMLDocument){while(i.firstChild)i.removeChild(i.firstChild);i.append(r.internals.runtime.convertValue(a,"Fragment"))}else{if(n){e.setSymbol(n,t,null,a)}else{throw"Don't know how to put a value into "+typeof t}}}r.addCommand("put",(function(e,r,t){if(t.matchToken("put")){var n=e.requireElement("expression",t);var a=t.matchAnyToken("into","before","after");if(a==null&&t.matchToken("at")){t.matchToken("the");a=t.matchAnyToken("start","end");t.requireToken("of")}if(a==null){e.raiseParseError(t,"Expected one of 'into', 'before', 'at start of', 'at end of', 'after'")}var o=e.requireElement("expression",t);var u=a.value;var s=false;var l=null;var c=null;if(o.prop&&o.root&&u==="into"){c=o.prop.value;l=o.root}else if(o.type==="symbol"&&u==="into"){s=true;c=o.name}else if(o.type==="attributeRef"&&u==="into"){var f=true;c=o.name;l=e.requireElement("implicitMeTarget",t)}else if(o.type==="attributeRefAccess"&&u==="into"){var f=true;c=o.attribute.name;l=o.root}else{l=o}var m={target:o,operation:u,symbolWrite:s,value:n,args:[l,n],op:function(e,t,n){if(s){i(r,e,c,n)}else{if(u==="into"){if(f){r.implicitLoop(t,(function(e){e.setAttribute(c,n)}))}else{r.implicitLoop(t,(function(e){i(r,e,c,n)}))}}else{var a=u==="before"?Element.prototype.before:u==="after"?Element.prototype.after:u==="start"?Element.prototype.prepend:u==="end"?Element.prototype.append:Element.prototype.append;r.implicitLoop(t,(function(e){a.call(e,n instanceof Node?n:r.convertValue(n,"Fragment"))}))}}return r.findNext(this,e)}};return m}}));function o(e,r,t){var n;if(t.matchToken("the")||t.matchToken("element")||t.matchToken("elements")||t.currentToken().type==="CLASS_REF"||t.currentToken().type==="ID_REF"||t.currentToken().op&&t.currentToken().value==="<"){e.possessivesDisabled=true;try{n=e.parseElement("expression",t)}finally{delete e.possessivesDisabled}if(t.matchOpToken("'")){t.requireToken("s")}}else if(t.currentToken().type==="IDENTIFIER"&&t.currentToken().value==="its"){var a=t.matchToken("its");n={type:"pseudopossessiveIts",token:a,name:a.value,evaluate:function(e){return r.resolveSymbol("it",e)}}}else{t.matchToken("my")||t.matchToken("me");n=e.parseElement("implicitMeTarget",t)}return n}r.addCommand("transition",(function(e,t,n){if(n.matchToken("transition")){var a=o(e,t,n);var i=[];var u=[];var s=[];var l=n.currentToken();while(!e.commandBoundary(l)&&l.value!=="over"&&l.value!=="using"){i.push(e.requireElement("stringLike",n));if(n.matchToken("from")){u.push(e.requireElement("stringLike",n))}else{u.push(null)}n.requireToken("to");s.push(e.requireElement("stringLike",n));l=n.currentToken()}if(n.matchToken("over")){var c=e.requireElement("timeExpression",n)}else if(n.matchToken("using")){var f=e.requireElement("expression",n)}var m={to:s,args:[a,i,u,s,f,c],op:function(e,n,a,i,o,u,s){var l=[];t.forEach(n,(function(e){var n=new Promise((function(n,l){var c=e.style.transition;if(s){e.style.transition="all "+s+"ms ease-in"}else if(u){e.style.transition=u}else{e.style.transition=r.config.defaultTransition}var f=t.getInternalData(e);var m=getComputedStyle(e);var p={};for(var v=0;v<m.length;v++){var h=m[v];var d=m[h];p[h]=d}if(!f.initalStyles){f.initalStyles=p}for(var v=0;v<a.length;v++){var E=a[v];var T=i[v];if(T=="computed"||T==null){e.style[E]=p[E]}else{e.style[E]=T}}setTimeout((function(){var r=[];for(var t=0;t<a.length;t++){var i=a[t];var u=o[t];if(u=="initial"){var s=f.initalStyles[i];e.style[i]=s}else{e.style[i]=u}}e.addEventListener("transitionend",(function(){e.style.transition=c;n()}),{once:true})}),5)}));l.push(n)}));return Promise.all(l).then((function(){return t.findNext(m,e)}))}};return m}}));r.addCommand("measure",(function(e,r,t){if(!t.matchToken("measure"))return;var n=o(e,r,t);var a=[];if(!e.commandBoundary(t.currentToken()))do{a.push(t.matchTokenType("IDENTIFIER").value)}while(t.matchOpToken(","));return{properties:a,args:[n],op:function(e,t){if(0 in t)t=t[0];var n=t.getBoundingClientRect();var i={top:t.scrollTop,left:t.scrollLeft,topMax:t.scrollTopMax,leftMax:t.scrollLeftMax,height:t.scrollHeight,width:t.scrollWidth};e.result={x:n.x,y:n.y,left:n.left,top:n.top,right:n.right,bottom:n.bottom,width:n.width,height:n.height,bounds:n,scrollLeft:i.left,scrollTop:i.top,scrollLeftMax:i.leftMax,scrollTopMax:i.topMax,scrollWidth:i.width,scrollHeight:i.height,scroll:i};r.forEach(a,(function(r){if(r in e.result)e[r]=e.result[r];else throw"No such measurement as "+r}));return r.findNext(this,e)}}}));r.addLeafExpression("closestExpr",(function(e,r,t){if(t.matchToken("closest")){if(t.matchToken("parent")){var n=true}var a=null;if(t.currentToken().type==="ATTRIBUTE_REF"){var i=e.parseElement("attributeRefAccess",t,null);a="["+i.attribute.name+"]"}if(a==null){var o=e.parseElement("expression",t);if(o.css==null){e.raiseParseError(t,"Expected a CSS expression")}else{a=o.css}}if(t.matchToken("to")){var u=e.parseElement("expression",t)}else{var u=e.parseElement("implicitMeTarget",t)}var s={type:"closestExpr",parentSearch:n,expr:o,css:a,to:u,args:[u],op:function(e,r){if(r==null||!(r instanceof Element)){return null}else{if(n){var t=r.parentElement?r.parentElement.closest(a):null}else{var t=r.closest(a)}return t}},evaluate:function(e){return r.unifiedEval(this,e)}};if(i){i.root=s;i.args=[s];return i}else{return s}}}));r.addCommand("go",(function(e,r,t){if(t.matchToken("go")){if(t.matchToken("back")){var n=true}else{t.matchToken("to");if(t.matchToken("url")){var a=e.requireElement("stringLike",t);var i=true;if(t.matchToken("in")){t.requireToken("new");t.requireToken("window");var o=true}}else{t.matchToken("the");var u=t.matchAnyToken("top","bottom","middle");var s=t.matchAnyToken("left","center","right");if(u||s){t.requireToken("of")}var a=e.requireElement("expression",t);var l=t.matchAnyToken("smoothly","instantly");var c={};if(u){if(u.value==="top"){c.block="start"}else if(u.value==="bottom"){c.block="end"}else if(u.value==="middle"){c.block="center"}}if(s){if(s.value==="left"){c.inline="start"}else if(s.value==="center"){c.inline="center"}else if(s.value==="right"){c.inline="end"}}if(l){if(l.value==="smoothly"){c.behavior="smooth"}else if(l.value==="instantly"){c.behavior="instant"}}}}var f={target:a,args:[a],op:function(e,t){if(n){window.history.back()}else if(i){if(t){if(t.indexOf("#")===0&&!o){window.location.href=t}else{window.open(t,o?"_blank":null)}}}else{r.forEach(t,(function(e){e.scrollIntoView(c)}))}return r.findNext(f)}};return f}}));r.config.conversions["Values"]=function(e){var t={};var n=r.internals.runtime.implicitLoop;n(e,(function(e){var r=i(e);if(r!==undefined){t[r.name]=r.value;return}if(e.querySelectorAll!=undefined){var n=e.querySelectorAll("input,select,textarea");n.forEach(a)}}));return t;function a(e){var r=i(e);if(r==undefined){return}if(t[r.name]==undefined){t[r.name]=r.value;return}if(Array.isArray(t[r.name])&&Array.isArray(r.value)){t[r.name]=[].concat(t[r.name],r.value);return}}function i(e){try{var r={name:e.name,value:e.value};if(r.name==undefined||r.value==undefined){return undefined}if(e.type=="radio"&&e.checked==false){return undefined}if(e.type=="checkbox"){if(e.checked==false){r.value=undefined}else if(typeof r.value==="string"){r.value=[r.value]}}if(e.type=="select-multiple"){var t=e.querySelectorAll("option[selected]");r.value=[];for(var n=0;n<t.length;n++){r.value.push(t[n].value)}}return r}catch(e){return undefined}}};r.config.conversions["HTML"]=function(e){var r=function(e){if(e instanceof Array){return e.map((function(e){return r(e)})).join("")}if(e instanceof HTMLElement){return e.outerHTML}if(e instanceof NodeList){var t="";for(var n=0;n<e.length;n++){var a=e[n];if(a instanceof HTMLElement){t+=a.outerHTML}}return t}if(e.toString){return e.toString()}return""};return r(e)};r.config.conversions["Fragment"]=function(e){var t=document.createDocumentFragment();r.internals.runtime.implicitLoop(e,(function(e){if(e instanceof Node)t.append(e);else{var r=document.createElement("template");r.innerHTML=e;t.append(r.content)}}));return t}})();(function(){var e=typeof module!=="undefined"?module.exports:this._hyperscript;var r=0;var t=function(){self.onmessage=function(r){switch(r.data.type){case"init":importScripts(r.data._hyperscript);importScripts.apply(self,r.data.extraScripts);var t=e.internals.lexer.makeTokensObject(r.data.tokens,[],r.data.source);var n=e.internals.parser.parseElement("hyperscript",t);n.apply(self);postMessage({type:"didInit"});break;case"call":try{var a=self[r.data.function].apply(self,r.data.args);Promise.resolve(a).then((function(e){postMessage({type:"resolve",id:r.data.id,value:e})})).catch((function(e){postMessage({type:"reject",id:r.data.id,error:e.toString()})}))}catch(e){postMessage({type:"reject",id:r.data.id,error:e.toString()})}break}}};var n="("+t.toString()+")()";var a=new Blob([n],{type:"text/javascript"});var i=URL.createObjectURL(a);e.addFeature("worker",(function(e,t,n){if(n.matchToken("worker")){var a=e.requireElement("dotOrColonPath",n);var o=a.evaluate();var u=o.split(".");var s=u.pop();var l=[];if(n.matchOpToken("(")){if(n.matchOpToken(")")){}else{do{var c=n.requireTokenType("STRING").value;var f=new URL(c,location.href).href;l.push(f)}while(n.matchOpToken(","));n.requireOpToken(")")}}var m=[];var p=n.consumed.length;var v=n.consumed.length;do{var h=e.parseAnyOf(["defFeature","jsFeature"],n);if(h){if(h.type==="defFeature"){m.push(h.name);v=n.consumed.length}else{if(n.hasMore())continue}}else break}while(n.matchToken("end")&&n.hasMore());var d=n.consumed.slice(p,v+1);var E=new Worker(i);E.postMessage({type:"init",_hyperscript:t.hyperscriptUrl,extraScripts:l,tokens:d,source:n.source});var T=new Promise((function(e,r){E.addEventListener("message",(function(r){if(r.data.type==="didInit")e()}),{once:true})}));var y={};m.forEach((function(e){y[e]=function(){var t=arguments;return new Promise((function(n,a){var i=r++;E.addEventListener("message",(function e(r){if(r.data.id!==i)return;E.removeEventListener("message",e);if(r.data.type==="resolve")n(r.data.value);else a(r.data.error)}));T.then((function(){E.postMessage({type:"call",function:e,args:Array.from(t),id:i})}))}))}}));return{name:s,worker:E,install:function(e){t.assignToNamespace(e,u,s,y)}}}}))})();"use strict";(function(e){function r(e){return e.replace(/(?:^|\n)([^@]*)@?/gm,(function(e,r){var t=(" "+r).replace(/([^\\])\$\{/g,"$1$${escape html ").substring(1);return"\ncall __ht_template_result.push(`"+t+"`)\n"}))}function t(r,t){var n=[];e(r,Object.assign({__ht_template_result:n},t));return n.join("")}var e=typeof module!=="undefined"?module.exports:this._hyperscript;e.addCommand("render",(function(e,n,a){if(!a.matchToken("render"))return;var i=e.requireElement("expression",a);var o={};if(a.matchToken("with")){o=e.parseElement("namedArgumentList",a)}return{args:[i,o],op:function(e,a,o){if(!(a instanceof Element))throw new Error(i.sourceFor()+" is not an element");console.log(r(a.innerHTML));e.result=t(r(a.innerHTML),o);return n.findNext(this,e)}}}));function n(e){return String(e).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/\x22/g,"&quot;").replace(/\x27/g,"&#039;")}e.addLeafExpression("escape",(function(e,r,t){if(!t.matchToken("escape"))return;var a=t.matchTokenType("IDENTIFIER").value;var i=t.matchToken("unescaped");var o=e.requireElement("expression",t);return{args:[o],op:function(e,r){if(i)return r;if(r===undefined)return"";switch(a){case"html":return n(r);default:throw new Error("Unknown escape: "+a)}},evaluate:function(e){return r.unifiedEval(this,e)}}}))})(_hyperscript);(function(){function e(e,r){for(var t in r){if(r.hasOwnProperty(t)){e[t]=r[t]}}return e}function r(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(e){var r=Math.random()*16|0,t=e=="x"?r:r&3|8;return t.toString(16)}))}function t(e){return new WebSocket(e.evaluate())}var n=["then","catch","length","asyncWrapper","toJSON"];var a=typeof module!=="undefined"?module.exports:this._hyperscript;a.addFeature("socket",(function(a,i,o){function u(e){return new Proxy({},{get:function(a,i){if(n.indexOf(i)>=0){return null}else if(i==="noTimeout"){return u(-1)}else if(i==="timeout"){return function(e){return u(parseInt(e))}}else{return function(){var n=r();var a=[];for(var o=0;o<arguments.length;o++){a.push(arguments[o])}var u={iid:n,function:i,args:a};y=y?y:t(p);y.send(JSON.stringify(u));var s=new Promise((function(e,r){m[n]={resolve:e,reject:r}}));if(e>=0){setTimeout((function(){if(m[n]){m[n].reject("Timed out")}delete m[n]}),e)}return s}}}})}if(o.matchToken("socket")){var s=a.requireElement("dotOrColonPath",o);var l=s.evaluate();var c=l.split(".");var f=c.pop();var m={};var p=a.requireElement("stringLike",o);var v=1e4;if(o.matchToken("with")){o.requireToken("timeout");v=a.requireElement("timeExpression",o).evaluate()}if(o.matchToken("on")){o.requireToken("message");if(o.matchToken("as")){o.requireToken("json");var h=true}var d=a.requireElement("commandList",o);var E={type:"implicitReturn",op:function(e){return i.HALT},execute:function(e){}};var T=d;while(T.next){T=T.next}T.next=E}var y=t(p);var k=u(v);var x={raw:y,dispatchEvent:function(r){var t=r.detail;delete t.sentBy;delete t._namedArgList_;y.send(JSON.stringify(e({type:r.type},t)))},rpc:k};var g={name:f,socket:x,install:function(e){i.assignToNamespace(e,c,f,x)}};y.onmessage=function(e){var r=e.data;try{var t=JSON.parse(r)}catch(e){}if(t&&t.iid){if(t.throw){m[t.iid].reject(t.throw)}else{m[t.iid].resolve(t.return)}delete m[t.iid]}if(d){var n=i.makeContext(x,g,x);if(h){if(t){n.message=t;n.result=t}else{throw"Received non-JSON message from socket: "+r}}else{n.message=r;n.result=r}d.execute(n)}};y.addEventListener("close",(function(e){y=null}));return g}}))})();(function(){var e=typeof module!=="undefined"?module.exports:this._hyperscript;e.addFeature("eventsource",(function(e,r,t){if(t.matchToken("eventsource")){var n;var a=false;var i=e.requireElement("dotOrColonPath",t).evaluate();var o=i.split(".");var u=o.pop();if(t.matchToken("from")){n=e.requireElement("stringLike",t)}if(t.matchToken("with")){if(t.matchToken("credentials")){a=true}}var s={eventSource:null,listeners:[],retryCount:0,open:function(e){if(e==undefined){if(s.eventSource!=null&&s.eventSource.url!=undefined){e=s.eventSource.url}else{throw"no url defined for EventSource."}}if(s.eventSource!=null){if(e!=s.eventSource.url){s.eventSource.close()}else if(s.eventSource.readyState!=EventSource.CLOSED){return}}s.eventSource=new EventSource(e,{withCredentials:a});s.eventSource.addEventListener("open",(function(e){s.retryCount=0}));s.eventSource.addEventListener("error",(function(e){if(s.eventSource.readyState==EventSource.CLOSED){s.retryCount=Math.min(7,s.retryCount+1);var r=Math.random()*(2^s.retryCount)*500;window.setTimeout(s.open,r)}}));for(var r=0;r<s.listeners.length;r++){var t=s.listeners[r];s.eventSource.addEventListener(t.type,t.handler,t.options)}},close:function(){if(s.eventSource!=undefined){s.eventSource.close()}s.retryCount=0},addEventListener:function(e,r,t){s.listeners.push({type:e,handler:r,options:t});if(s.eventSource!=null){s.eventSource.addEventListener(e,r,t)}}};var l={name:u,object:s,install:function(e){r.assignToNamespace(e,o,u,s)}};while(t.matchToken("on")){var c=e.requireElement("stringLike",t,"Expected event name").evaluate();var f="";if(t.matchToken("as")){f=e.requireElement("stringLike",t,"Expected encoding type").evaluate()}var m=e.requireElement("commandList",t);h(m);t.requireToken("end");s.listeners.push({type:c,handler:p(f,m)})}t.requireToken("end");if(n!=undefined){s.open(n.evaluate())}return l;function p(e,t){return function(n){var a=v(n["data"],e);var i=r.makeContext(s,l,s);i.event=n;i.result=a;t.execute(i)}}function v(e,r){if(r=="json"){return JSON.parse(e)}return e}function h(e){if(e.next){return h(e.next)}e.next={type:"implicitReturn",op:function(e){return r.HALT},execute:function(e){}}}}}))})();