peachy/assets/static/js/_hyperscript.min.js

2 lines
98 KiB
JavaScript
Raw Normal View History

(function(e,t){const r=t(e);if(typeof exports==="object"&&typeof exports["nodeName"]!=="string"){module.exports=r}else{e["_hyperscript"]=r;if("document"in e)e["_hyperscript"].browserInit()}})(typeof self!=="undefined"?self:this,(e=>{"use strict";const t={dynamicResolvers:[function(e,t){if(e==="Fixed"){return Number(t).toFixed()}else if(e.indexOf("Fixed:")===0){let r=e.split(":")[1];return Number(t).toFixed(parseInt(r))}}],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){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(e){if(e instanceof String){e=e.toString()}if(typeof e==="string"){return JSON.parse(e)}else{return Object.assign({},e)}}};const r={attributes:"_, script, data-script",defaultTransition:"all 500ms ease-in",disableSelector:"[disable-scripting], [data-disable-scripting]",hideShowStrategies:{},conversions:t};class n{static OP_TABLE={"+":"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"};static isValidCSSClassChar(e){return n.isAlpha(e)||n.isNumeric(e)||e==="-"||e==="_"||e===":"}static isValidCSSIDChar(e){return n.isAlpha(e)||n.isNumeric(e)||e==="-"||e==="_"||e===":"}static isWhitespace(e){return e===" "||e==="\t"||n.isNewline(e)}static positionString(e){return"[Line: "+e.line+", Column: "+e.column+"]"}static isNewline(e){return e==="\r"||e==="\n"}static isNumeric(e){return e>="0"&&e<="9"}static isAlpha(e){return e>="a"&&e<="z"||e>="A"&&e<="Z"}static isIdentifierChar(e,t){return e==="_"||e==="$"}static isReservedChar(e){return e==="`"||e==="^"}static isValidSingleQuoteStringStart(e){if(e.length>0){var t=e[e.length-1];if(t.type==="IDENTIFIER"||t.type==="CLASS_REF"||t.type==="ID_REF"){return false}if(t.op&&(t.value===">"||t.value===")")){return false}}return true}static tokenize(e,t){var r=[];var a=e;var o=0;var s=0;var u=1;var l="<START>";var c=0;function f(){return t&&c===0}while(o<a.length){if(q()==="-"&&N()==="-"&&(n.isWhitespace(I(2))||I(2)===""||I(2)==="-")||q()==="/"&&N()==="/"&&(n.isWhitespace(I(2))||I(2)===""||I(2)==="/")){h()}else if(q()==="/"&&N()==="*"&&(n.isWhitespace(I(2))||I(2)===""||I(2)==="*")){v()}else{if(n.isWhitespace(q())){r.push(A())}else if(!R()&&q()==="."&&(n.isAlpha(N())||N()==="{"||N()==="-")){r.push(d())}else if(!R()&&q()==="#"&&(n.isAlpha(N())||N()==="{")){r.push(k())}else if(q()==="["&&N()==="@"){r.push(E())}else if(q()==="@"){r.push(T())}else if(q()==="*"&&n.isAlpha(N())){r.push(y())}else if(n.isAlpha(q())||!f()&&n.isIdentifierChar(q())){r.push(x())}else if(n.isNumeric(q())){r.push(g())}else if(!f()&&(q()==='"'||q()==="`")){r.push(w())}else if(!f()&&q()==="'"){if(n.isValidSingleQuoteStringStart(r)){r.push(w())}else{r.push(b())}}else if(n.OP_TABLE[q()]){if(l==="$"&&q()==="{"){c++}if(q()==="}"){c--}r.push(b())}else if(f()||n.isReservedChar(q())){r.push(p("RESERVED",C()))}else{if(o<a.length){throw Error("Unknown token: "+q()+" ")}}}}return new i(r,[],a);function m(e,t){var r=p(e,t);r.op=true;return r}function p(e,t){return{type:e,value:t||"",start:o,end:o+1,column:s,line:u}}function h(){while(q()&&!n.isNewline(q())){C()}C()}function v(){while(q()&&!(q()==="*"&&N()==="/")){C()}C();C()}function d(){var e=p("CLASS_REF");var t=C();if(q()==="{"){e.template=true;t+=C();while(q()&&q()!=="}"){t+=C()}if(q()!=="}"){throw Error("Unterminated class reference")}else{t+=C()}}else{while(n.isValidCSSClassChar(q())){t+=C()}}e.value=t;e.end=o;return e}function E(){var e=p("ATTRIBUTE_REF");var t=C();while(o<a.length&&q()!=="]"){t+=C()}if(q()==="]"){t+=C()}e.value=t;e.end=o;return e}function T(){var e=p("ATTRIBUTE_REF"