summitjs 0.2.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,8 +1,8 @@
1
- (function(){'use strict';var j,z=[],fe=0,te=new Set;function O(n,e={}){let t=pn(n,e);return e.lazy||t(),t}function pn(n,e){let t=function(){if(!t.active)return n();if(!z.includes(t)){Ge(t);try{return z.push(t),j=t,n()}finally{z.pop(),j=z[z.length-1];}}};return t.deps=[],t.active=true,t.scheduler=e.scheduler,t.onStop=e.onStop,t.raw=n,t}function Ge(n){let{deps:e}=n;for(let t of e)t.delete(n);e.length=0;}function de(n){n.active&&(Ge(n),n.onStop?.(),n.active=false);}function C(n){j&&(n.has(j)||(n.add(j),j.deps.push(n)));}function I(n){let e=[...n];for(let t of e)if(t!==j){if(fe>0){te.add(t);continue}qe(t);}}function qe(n){n.scheduler?n.scheduler():n();}function me(n){fe++;try{return n()}finally{--fe===0&&fn();}}function fn(){if(te.size===0)return;let n=[...te];te.clear();for(let e of n)e.active&&qe(e);}function he(n){let e=n,t=new Set,r=function(){return C(t),e};return r.set=s=>{let i=typeof s=="function"?s(e):s;Object.is(i,e)||(e=i,I(t));},r.peek=()=>e,r}function G(n){let e,t=true,r=new Set,s=O(n,{lazy:true,scheduler:()=>{t||(t=true,I(r));}}),i=function(){return t&&(e=s(),t=false),C(r),e};return i.peek=()=>(t&&(e=s(),t=false),e),i}var xe=Symbol("summit.raw"),ve=Symbol("summit.iterate"),ge=new WeakMap,_e=new WeakMap;function dn(n,e){let t=ge.get(n);t||ge.set(n,t=new Map);let r=t.get(e);return r||t.set(e,r=new Set),r}function ye(n,e){C(dn(n,e));}function q(n,e){let t=ge.get(n);if(!t)return;let r=t.get(e);r&&I(r);}function Je(n){return n!==null&&typeof n=="object"}function mn(n){let e=Object.getPrototypeOf(n);return e===Object.prototype||e===null}function Ye(n){return Je(n)&&(Array.isArray(n)||mn(n))}var hn={get(n,e,t){if(e===xe)return n;let r=Reflect.get(n,e,t);return typeof e=="symbol"?r:(ye(n,e),Ye(r)?E(r):r)},set(n,e,t,r){let s=Je(t)?be(t):t,i=Array.isArray(n),o=i?Number(e)<n.length:Object.prototype.hasOwnProperty.call(n,e),a=n[e],c=Reflect.set(n,e,s,r);return o?Object.is(a,s)||q(n,e):(q(n,e),q(n,i?"length":ve)),c},has(n,e){return ye(n,e),Reflect.has(n,e)},deleteProperty(n,e){let t=Object.prototype.hasOwnProperty.call(n,e),r=Reflect.deleteProperty(n,e);return t&&r&&(q(n,e),q(n,ve)),r},ownKeys(n){return ye(n,Array.isArray(n)?"length":ve),Reflect.ownKeys(n)}};function E(n){if(!Ye(n)||n[xe])return n;let e=_e.get(n);if(e)return e;let t=new Proxy(n,hn);return _e.set(n,t),t}function be(n){let e=n&&n[xe];return e?be(e):n}var we=new Set,Ee=false,ke=null,Ze=Promise.resolve();function Pe(n){we.add(n),Ee||(Ee=true,ke=Ze.then(vn));}function vn(){let n=[...we];we.clear(),Ee=false,ke=null;for(let e of n)e();}function _(n){let e=ke??Ze;return n?e.then(()=>{n();}):e.then(()=>{})}function D(n){let e;return e=O(n,{lazy:true,scheduler:()=>Pe(e)}),e(),()=>de(e)}var Se=new Map,Ae=new Map,Xe=new Map,Te=E({}),Qe=new Map,De=100;function h(n,e,t=De){Se.set(n,{handler:e,priority:t});}function ne(n){return Se.get(n)}function Ve(){return [...Se.keys()]}function g(n,e){Ae.set(n,e);}function re(n){return Ae.get(n)}function et(){return [...Ae.keys()]}function tt(n,e){Xe.set(n,e);}function Re(n){return Xe.get(n)}function Me(n,e){Te[n]=e;}function Le(n){return Te[n]}function nt(){return Te}function rt(n,e){Qe.set(n,e);}function st(n){return Qe.get(n)}function J(n){let e=E(n),t=Object.getOwnPropertyDescriptors(n);for(let r of Object.keys(t)){let s=t[r];if(typeof s.get=="function"){let i=s.get,o=s.set,a=G(()=>i.call(e));Object.defineProperty(n,r,{get:()=>a(),set:o?c=>o.call(e,c):void 0,enumerable:s.enumerable,configurable:true});}else typeof s.value=="function"&&(n[r]=s.value.bind(e));}return e}var yn=new Set(["return","typeof","void","in","instanceof","new","of","delete","do","else"]);function gn(n){if(!n)return true;switch(n.type){case "num":case "str":case "tmpl":case "regex":return false;case "ident":return yn.has(n.value);case "punc":return n.value!==")"&&n.value!=="]";default:return true}}var xn=["...","===","!==","**=","&&=","||=","??=","==","!=","<=",">=","&&","||","??","?.","=>","++","--","+=","-=","*=","/=","%=","**","(",")","[","]","{","}",".",",",";",":","?","+","-","*","/","%","<",">","=","!"],$=class extends Error{};function bn(n){return /[A-Za-z_$]/.test(n)}function wn(n){return /[A-Za-z0-9_$]/.test(n)}function Y(n){return n>="0"&&n<="9"}function it(n){let e=[],t=0,r=n.length;for(;t<r;){let s=n[t];if(s===" "||s===" "||s===`
2
- `||s==="\r"){t++;continue}if(Y(s)||s==="."&&Y(n[t+1]??"")){let o=t;if(s==="0"&&(n[t+1]==="x"||n[t+1]==="X"))for(t+=2;t<r&&/[0-9a-fA-F]/.test(n[t]);)t++;else {for(;t<r&&Y(n[t]);)t++;if(n[t]===".")for(t++;t<r&&Y(n[t]);)t++;if(n[t]==="e"||n[t]==="E")for(t++,(n[t]==="+"||n[t]==="-")&&t++;t<r&&Y(n[t]);)t++;}e.push({type:"num",value:n.slice(o,t),start:o,end:t});continue}if(s==='"'||s==="'"){let o=t,a=s;t++;let c="";for(;t<r&&n[t]!==a;)n[t]==="\\"?(c+=En(n,t),t+=2):(c+=n[t],t++);if(t>=r)throw new $(`Unterminated string in expression: ${n}`);t++,e.push({type:"str",value:c,start:o,end:t});continue}if(s==="`"){let o=t;t++;let a="",c=0;for(;t<r;){let u=n[t];if(u==="\\"){a+=n[t]+(n[t+1]??""),t+=2;continue}if(u==="`"&&c===0)break;if(u==="$"&&n[t+1]==="{"){c++,a+="${",t+=2;continue}if(u==="}"&&c>0){c--,a+="}",t++;continue}a+=u,t++;}if(t>=r)throw new $(`Unterminated template literal: ${n}`);t++,e.push({type:"tmpl",value:a,raw:a,start:o,end:t});continue}if(bn(s)){let o=t;for(t++;t<r&&wn(n[t]);)t++;e.push({type:"ident",value:n.slice(o,t),start:o,end:t});continue}if(s==="/"&&gn(e[e.length-1])){let o=t;t++;let a="",c=false;for(;t<r;){let p=n[t];if(p==="\\"){a+=p+(n[t+1]??""),t+=2;continue}if(p===`
3
- `)throw new $(`Unterminated regex in expression: ${n}`);if(p==="[")c=true;else if(p==="]")c=false;else if(p==="/"&&!c)break;a+=p,t++;}if(n[t]!=="/")throw new $(`Unterminated regex in expression: ${n}`);t++;let u="";for(;t<r&&/[a-z]/i.test(n[t]);)u+=n[t],t++;e.push({type:"regex",value:a,flags:u,start:o,end:t});continue}let i=false;for(let o of xn)if(n.startsWith(o,t)){e.push({type:"punc",value:o,start:t,end:t+o.length}),t+=o.length,i=true;break}if(!i)throw new $(`Unexpected character '${s}' in expression: ${n}`)}return e.push({type:"eof",value:"",start:r,end:r}),e}function En(n,e){let t=n[e+1];switch(t){case "n":return `
4
- `;case "t":return " ";case "r":return "\r";case "b":return "\b";case "f":return "\f";case "v":return "\v";case "0":return "\0";case "\\":return "\\";case "'":return "'";case '"':return '"';case "`":return "`";default:return t??""}}var A=class extends Error{},kn=new Set(["true","false","null","undefined","this","typeof","void","in","instanceof","if","else","return","let","const","var","for","of","while","break","continue"]),Pn={"??":1,"||":2,"&&":3,"==":7,"!=":7,"===":7,"!==":7,"<":8,">":8,"<=":8,">=":8,in:8,instanceof:8,"+":10,"-":10,"*":11,"/":11,"%":11,"**":12},Sn=new Set(["=","+=","-=","*=","/=","%=","**=","&&=","||=","??="]),je=class{constructor(e){this.pos=0;this.tokens=it(e);}peek(e=0){return this.tokens[this.pos+e]??this.tokens[this.tokens.length-1]}next(){return this.tokens[this.pos++]??this.tokens[this.tokens.length-1]}isPunc(e,t=0){let r=this.peek(t);return r.type==="punc"&&r.value===e}isKeyword(e,t=0){let r=this.peek(t);return r.type==="ident"&&r.value===e}eatPunc(e){if(!this.isPunc(e))throw new A(`Expected '${e}' but found '${this.peek().value||"end of input"}'`);this.pos++;}atEnd(){return this.peek().type==="eof"}parseProgram(){let e=[];for(;!this.atEnd();){if(this.isPunc(";")){this.pos++;continue}e.push(this.parseStatement());}return {type:"Program",body:e}}parseExpressionProgram(){let e=this.parseExpression();if(!this.atEnd())throw new A(`Unexpected trailing input '${this.peek().value}'`);return {type:"Program",body:[{type:"ExpressionStatement",expression:e}]}}parseStatement(){if(this.isPunc("{"))return this.parseBlock();if(this.isKeyword("if"))return this.parseIf();if(this.isKeyword("return"))return this.parseReturn();if(this.isKeyword("let")||this.isKeyword("const")||this.isKeyword("var")){let t=this.parseVarDecl();return this.consumeSemi(),t}if(this.isKeyword("for"))return this.parseFor();if(this.isKeyword("while"))return this.parseWhile();if(this.isKeyword("break"))return this.pos++,this.consumeSemi(),{type:"BreakStatement"};if(this.isKeyword("continue"))return this.pos++,this.consumeSemi(),{type:"ContinueStatement"};let e=this.parseExpression();return this.consumeSemi(),{type:"ExpressionStatement",expression:e}}consumeSemi(){this.isPunc(";")&&this.pos++;}parseBlock(){this.eatPunc("{");let e=[];for(;!this.isPunc("}")&&!this.atEnd();){if(this.isPunc(";")){this.pos++;continue}e.push(this.parseStatement());}return this.eatPunc("}"),{type:"BlockStatement",body:e}}parseIf(){this.pos++,this.eatPunc("(");let e=this.parseExpression();this.eatPunc(")");let t=this.parseStatement(),r=null;return this.isKeyword("else")&&(this.pos++,r=this.parseStatement()),{type:"IfStatement",test:e,consequent:t,alternate:r}}parseReturn(){this.pos++;let e=null;return !this.isPunc(";")&&!this.isPunc("}")&&!this.atEnd()&&(e=this.parseExpression()),this.consumeSemi(),{type:"ReturnStatement",argument:e}}parseVarDecl(){let e=this.next().value,t=[];do{let r=this.parsePattern(),s=null;this.isPunc("=")&&(this.pos++,s=this.parseAssignment()),t.push({id:r,init:s});}while(this.isPunc(",")&&(this.pos++,true));return {type:"VariableDeclaration",kind:e,declarations:t}}parseFor(){this.pos++,this.eatPunc("(");let e=null;if(this.isKeyword("let")||this.isKeyword("const")||this.isKeyword("var")){let i=this.next().value,o=this.parsePattern();if(this.isKeyword("of")){this.pos++;let u=this.parseExpression();this.eatPunc(")");let p=this.parseStatement();return {type:"ForOfStatement",left:{type:"VariableDeclaration",kind:i,declarations:[{id:o,init:null}]},right:u,body:p}}let a=null;this.isPunc("=")&&(this.pos++,a=this.parseAssignment());let c=[{id:o,init:a}];for(;this.isPunc(",");){this.pos++;let u=this.parsePattern(),p=null;this.isPunc("=")&&(this.pos++,p=this.parseAssignment()),c.push({id:u,init:p});}e={type:"VariableDeclaration",kind:i,declarations:c};}else this.isPunc(";")||(e=this.parseExpression());this.eatPunc(";");let t=this.isPunc(";")?null:this.parseExpression();this.eatPunc(";");let r=this.isPunc(")")?null:this.parseExpression();this.eatPunc(")");let s=this.parseStatement();return {type:"ForStatement",init:e,test:t,update:r,body:s}}parseWhile(){this.pos++,this.eatPunc("(");let e=this.parseExpression();this.eatPunc(")");let t=this.parseStatement();return {type:"WhileStatement",test:e,body:t}}parseExpression(){return this.parseAssignment()}parseAssignment(){if(this.isArrowAhead())return this.parseArrow();let e=this.parseConditional(),t=this.peek();if(t.type==="punc"&&Sn.has(t.value)){this.pos++;let r=this.parseAssignment();return {type:"AssignmentExpression",operator:t.value,left:e,right:r}}return e}parseConditional(){let e=this.parseBinary(1);if(this.isPunc("?")){this.pos++;let t=this.parseAssignment();this.eatPunc(":");let r=this.parseAssignment();return {type:"ConditionalExpression",test:e,consequent:t,alternate:r}}return e}parseBinary(e){let t=this.parseUnary();for(;;){let r=this.peek(),s=r.type==="punc"||r.type==="ident"&&(r.value==="in"||r.value==="instanceof")?r.value:null;if(s===null)break;let i=Pn[s];if(i===void 0||i<e)break;this.pos++;let o=s==="**",a=this.parseBinary(o?i:i+1);s==="&&"||s==="||"||s==="??"?t={type:"LogicalExpression",operator:s,left:t,right:a}:t={type:"BinaryExpression",operator:s,left:t,right:a};}return t}parseUnary(){let e=this.peek();return e.type==="punc"&&(e.value==="!"||e.value==="-"||e.value==="+")?(this.pos++,{type:"UnaryExpression",operator:e.value,argument:this.parseUnary()}):e.type==="ident"&&(e.value==="typeof"||e.value==="void")?(this.pos++,{type:"UnaryExpression",operator:e.value,argument:this.parseUnary()}):e.type==="punc"&&(e.value==="++"||e.value==="--")?(this.pos++,{type:"UpdateExpression",operator:e.value,prefix:true,argument:this.parseUnary()}):this.parsePostfix()}parsePostfix(){let e=this.parseCallMember(),t=this.peek();return t.type==="punc"&&(t.value==="++"||t.value==="--")&&(this.pos++,e={type:"UpdateExpression",operator:t.value,prefix:false,argument:e}),e}parseNewExpr(){this.pos++;let e=this.parsePrimary();for(;;)if(this.isPunc(".")){this.pos++;let r=this.next();e={type:"MemberExpression",object:e,property:{type:"Identifier",name:r.value},computed:false,optional:false};}else if(this.isPunc("[")){this.pos++;let r=this.parseExpression();this.eatPunc("]"),e={type:"MemberExpression",object:e,property:r,computed:true,optional:false};}else break;let t=this.isPunc("(")?this.parseArguments():[];return {type:"NewExpression",callee:e,arguments:t}}parseCallMember(){let e=this.isKeyword("new")?this.parseNewExpr():this.parsePrimary();for(;;)if(this.isPunc(".")){this.pos++;let t=this.next();e={type:"MemberExpression",object:e,property:{type:"Identifier",name:t.value},computed:false,optional:false};}else if(this.isPunc("?."))if(this.pos++,this.isPunc("("))e={type:"CallExpression",callee:e,arguments:this.parseArguments(),optional:true};else if(this.isPunc("[")){this.pos++;let t=this.parseExpression();this.eatPunc("]"),e={type:"MemberExpression",object:e,property:t,computed:true,optional:true};}else {let t=this.next();e={type:"MemberExpression",object:e,property:{type:"Identifier",name:t.value},computed:false,optional:true};}else if(this.isPunc("[")){this.pos++;let t=this.parseExpression();this.eatPunc("]"),e={type:"MemberExpression",object:e,property:t,computed:true,optional:false};}else if(this.isPunc("("))e={type:"CallExpression",callee:e,arguments:this.parseArguments(),optional:false};else break;return e}parseArguments(){this.eatPunc("(");let e=[];for(;!this.isPunc(")")&&!this.atEnd()&&(this.isPunc("...")?(this.pos++,e.push({type:"SpreadElement",argument:this.parseAssignment()})):e.push(this.parseAssignment()),this.isPunc(","));)this.pos++;return this.eatPunc(")"),e}parsePrimary(){let e=this.peek();if(e.type==="num")return this.pos++,{type:"NumberLiteral",value:e.value.startsWith("0x")||e.value.startsWith("0X")?parseInt(e.value,16):Number(e.value)};if(e.type==="str")return this.pos++,{type:"StringLiteral",value:e.value};if(e.type==="tmpl")return this.pos++,this.parseTemplate(e.raw??"");if(e.type==="regex")return this.pos++,{type:"RegexLiteral",pattern:e.value,flags:e.flags??""};if(e.type==="ident")return e.value==="true"||e.value==="false"?(this.pos++,{type:"BooleanLiteral",value:e.value==="true"}):e.value==="null"?(this.pos++,{type:"NullLiteral"}):e.value==="undefined"?(this.pos++,{type:"UndefinedLiteral"}):e.value==="this"?(this.pos++,{type:"ThisExpression"}):(this.pos++,{type:"Identifier",name:e.value});if(this.isPunc("(")){this.pos++;let t=this.parseAssignment();if(this.isPunc(",")){let r=[t];for(;this.isPunc(",");)this.pos++,r.push(this.parseAssignment());return this.eatPunc(")"),{type:"SequenceExpression",expressions:r}}return this.eatPunc(")"),t}if(this.isPunc("["))return this.parseArray();if(this.isPunc("{"))return this.parseObject();throw new A(`Unexpected token '${e.value||"end of input"}' in expression`)}parseArray(){this.eatPunc("[");let e=[];for(;!this.isPunc("]")&&!this.atEnd();){if(this.isPunc(",")){e.push(null),this.pos++;continue}if(this.isPunc("...")?(this.pos++,e.push({type:"SpreadElement",argument:this.parseAssignment()})):e.push(this.parseAssignment()),this.isPunc(","))this.pos++;else break}return this.eatPunc("]"),{type:"ArrayExpression",elements:e}}parseObject(){this.eatPunc("{");let e=[];for(;!this.isPunc("}")&&!this.atEnd()&&(this.isPunc("...")?(this.pos++,e.push({type:"SpreadElement",argument:this.parseAssignment()})):e.push(this.parseObjectProperty()),this.isPunc(","));)this.pos++;return this.eatPunc("}"),{type:"ObjectExpression",properties:e}}parseObjectProperty(){if(this.isKeyword("async")&&this.peek(1).type==="ident")throw new A("async methods are not supported in Summit expressions. Use a regular method that returns a Promise and chain .then().");if((this.isKeyword("get")||this.isKeyword("set"))&&!this.isPunc(":",1)&&!this.isPunc(",",1)&&!this.isPunc("(",1)&&!this.isPunc("}",1)){let s=this.next().value,{key:i,computed:o}=this.parsePropertyKey(),a=this.parseMethodTail();return {key:i,computed:o,value:a,kind:s,shorthand:false}}let{key:e,computed:t,keyName:r}=this.parsePropertyKey();if(this.isPunc("(")){let s=this.parseMethodTail();return {key:e,computed:t,value:s,kind:"method",shorthand:false}}if(this.isPunc(":")){this.pos++;let s=this.parseAssignment();return {key:e,computed:t,value:s,kind:"init",shorthand:false}}if(r!==null&&!t)return {key:e,computed:t,value:{type:"Identifier",name:r},kind:"init",shorthand:true};throw new A(`Invalid object property near '${this.peek().value}'`)}parsePropertyKey(){if(this.isPunc("[")){this.pos++;let t=this.parseAssignment();return this.eatPunc("]"),{key:t,computed:true,keyName:null}}let e=this.next();if(e.type==="str")return {key:{type:"StringLiteral",value:e.value},computed:false,keyName:e.value};if(e.type==="num")return {key:{type:"StringLiteral",value:String(Number(e.value))},computed:false,keyName:null};if(e.type==="ident")return {key:{type:"StringLiteral",value:e.value},computed:false,keyName:e.value};throw new A(`Invalid property key '${e.value}'`)}parseMethodTail(){let e=this.parseParamList(),t=this.parseBlock();return {type:"ArrowFunction",params:e,body:t,expression:false}}isArrowAhead(){let e=this.peek();if(e.type==="ident"&&!kn.has(e.value)&&this.isPunc("=>",1))return true;if(this.isPunc("(")){let t=0,r=this.pos;for(;r<this.tokens.length;r++){let i=this.tokens[r];if(i.type==="punc"&&i.value==="(")t++;else if(i.type==="punc"&&i.value===")"){if(t--,t===0)break}else if(i.type==="eof")return false}let s=this.tokens[r+1];return !!s&&s.type==="punc"&&s.value==="=>"}return false}parseArrow(){let e;if(this.peek().type==="ident"?e=[{type:"Identifier",name:this.next().value}]:e=this.parseParamList(),this.eatPunc("=>"),this.isPunc("{")){let r=this.parseBlock();return {type:"ArrowFunction",params:e,body:r,expression:false}}let t=this.parseAssignment();return {type:"ArrowFunction",params:e,body:t,expression:true}}parseParamList(){this.eatPunc("(");let e=[];for(;!this.isPunc(")")&&!this.atEnd()&&(e.push(this.parsePattern()),this.isPunc(","));)this.pos++;return this.eatPunc(")"),e}parsePattern(){let e;if(this.isPunc("..."))return this.pos++,{type:"RestElement",argument:this.parsePattern()};if(this.isPunc("{"))e=this.parseObjectPattern();else if(this.isPunc("["))e=this.parseArrayPattern();else {let t=this.next();if(t.type!=="ident")throw new A(`Invalid binding target '${t.value}'`);e={type:"Identifier",name:t.value};}if(this.isPunc("=")){this.pos++;let t=this.parseAssignment();return {type:"AssignmentPattern",left:e,right:t}}return e}parseObjectPattern(){this.eatPunc("{");let e=[],t=null;for(;!this.isPunc("}")&&!this.atEnd();){if(this.isPunc("...")){this.pos++,t={type:"Identifier",name:this.next().value};break}let{key:r,computed:s,keyName:i}=this.parsePropertyKey(),o;if(this.isPunc(":")?(this.pos++,o=this.parsePattern()):(o={type:"Identifier",name:i??""},this.isPunc("=")&&(this.pos++,o={type:"AssignmentPattern",left:o,right:this.parseAssignment()})),e.push({key:r,value:o,computed:s}),this.isPunc(","))this.pos++;else break}return this.eatPunc("}"),{type:"ObjectPattern",properties:e,rest:t}}parseArrayPattern(){this.eatPunc("[");let e=[],t=null;for(;!this.isPunc("]")&&!this.atEnd();){if(this.isPunc(",")){e.push(null),this.pos++;continue}if(this.isPunc("...")){this.pos++,t=this.parsePattern();break}if(e.push(this.parsePattern()),this.isPunc(","))this.pos++;else break}return this.eatPunc("]"),{type:"ArrayPattern",elements:e,rest:t}}parseTemplate(e){let t=[],r=[],s="",i=0;for(;i<e.length;)if(e[i]==="$"&&e[i+1]==="{"){t.push(s),s="",i+=2;let o=1,a="";for(;i<e.length&&o>0;){let u=e[i];if(u==="{")o++;else if(u==="}"&&(o--,o===0))break;a+=u,i++;}i++;let c=se(a,"expression").body[0];r.push(c&&c.type==="ExpressionStatement"?c.expression:{type:"UndefinedLiteral"});}else s+=e[i],i++;return t.push(s),{type:"TemplateLiteral",quasis:t,expressions:r}}},ot=new Map;function se(n,e){let t=e+"\0"+n,r=ot.get(t);if(r)return r;let s=new je(n),i=e==="expression"?s.parseExpressionProgram():s.parseProgram();return ot.set(t,i),i}var Z=class{constructor(e){this.value=e;}},N=class{},F=class{},k=class{constructor(e){this.parent=e;this.vars=new Map;}declare(e,t,r){this.vars.set(e,{value:t,constant:r});}find(e){let t=this;for(;t;){if(t.vars.has(e))return t;t=t.parent;}return null}has(e){return this.find(e)!==null}get(e){return this.find(e)?.vars.get(e)?.value}set(e,t){let r=this.find(e);if(!r)return false;let s=r.vars.get(e);if(s.constant)throw new TypeError(`Assignment to constant '${e}'`);return s.value=t,true}},ct=new Set(["Math","JSON","Date","Object","Array","Number","String","Boolean","parseInt","parseFloat","isNaN","isFinite","RegExp","Map","Set","WeakMap","WeakSet","Promise","Intl","console","window","document","location","navigator","history","localStorage","sessionStorage","setTimeout","clearTimeout","setInterval","clearInterval","requestAnimationFrame","cancelAnimationFrame","fetch","alert","confirm","prompt","structuredClone","URL","URLSearchParams","encodeURIComponent","decodeURIComponent","NaN","Infinity"]);function Oe(n){for(let e of n)ct.add(e);}function at(n,e){if(n!=null)return n[e]}var X=class{constructor(e){this.root=e;}run(e,t){let r=new k(null),s;try{for(let i of e.body)i.type==="ExpressionStatement"?s=this.evalExpr(i.expression,r,t):this.execStmt(i,r,t);}catch(i){if(i instanceof Z)return i.value;throw i}return s}execBlock(e,t,r){for(let s of e)this.execStmt(s,t,r);}execStmt(e,t,r){switch(e.type){case "ExpressionStatement":this.evalExpr(e.expression,t,r);return;case "BlockStatement":this.execBlock(e.body,new k(t),r);return;case "IfStatement":this.evalExpr(e.test,t,r)?this.execStmt(e.consequent,t,r):e.alternate&&this.execStmt(e.alternate,t,r);return;case "ReturnStatement":throw new Z(e.argument?this.evalExpr(e.argument,t,r):void 0);case "VariableDeclaration":for(let s of e.declarations){let i=s.init?this.evalExpr(s.init,t,r):void 0;this.bindPattern(s.id,i,t,e.kind==="const");}return;case "WhileStatement":for(;this.evalExpr(e.test,t,r);)try{this.execStmt(e.body,new k(t),r);}catch(s){if(s instanceof N)break;if(s instanceof F)continue;throw s}return;case "ForOfStatement":{let s=this.evalExpr(e.right,t,r);for(let i of s??[]){let o=new k(t);e.left.type==="VariableDeclaration"?this.bindPattern(e.left.declarations[0].id,i,o,e.left.kind==="const"):this.assignPattern(e.left,i,o,r);try{this.execStmt(e.body,o,r);}catch(a){if(a instanceof N)break;if(a instanceof F)continue;throw a}}return}case "ForStatement":{let s=new k(t);for(e.init&&(e.init.type==="VariableDeclaration"?this.execStmt(e.init,s,r):this.evalExpr(e.init,s,r));!e.test||this.evalExpr(e.test,s,r);){try{this.execStmt(e.body,new k(s),r);}catch(i){if(i instanceof N)break;if(!(i instanceof F))throw i}e.update&&this.evalExpr(e.update,s,r);}return}case "BreakStatement":throw new N;case "ContinueStatement":throw new F}}evalExpr(e,t,r){switch(e.type){case "NumberLiteral":case "StringLiteral":case "BooleanLiteral":return e.value;case "NullLiteral":return null;case "UndefinedLiteral":return;case "RegexLiteral":return new RegExp(e.pattern,e.flags);case "ThisExpression":return r;case "Identifier":return this.resolve(e.name,t);case "TemplateLiteral":{let s=e.quasis[0]??"";for(let i=0;i<e.expressions.length;i++)s+=String(this.evalExpr(e.expressions[i],t,r)??""),s+=e.quasis[i+1]??"";return s}case "ArrayExpression":{let s=[];for(let i of e.elements)i===null?s.push(void 0):i.type==="SpreadElement"?s.push(...this.evalExpr(i.argument,t,r)):s.push(this.evalExpr(i,t,r));return s}case "ObjectExpression":return this.evalObject(e,t,r);case "UnaryExpression":{let s=this.evalExpr(e.argument,t,r);switch(e.operator){case "!":return !s;case "-":return -s;case "+":return +s;case "typeof":return typeof s;case "void":return}return}case "UpdateExpression":{let s=Number(this.evalTarget(e.argument,t,r)),i=e.operator==="++"?s+1:s-1;return this.assign(e.argument,i,t,r),e.prefix?i:s}case "BinaryExpression":return this.evalBinary(e.operator,this.evalExpr(e.left,t,r),this.evalExpr(e.right,t,r));case "LogicalExpression":{let s=this.evalExpr(e.left,t,r);return e.operator==="&&"?s&&this.evalExpr(e.right,t,r):e.operator==="||"?s||this.evalExpr(e.right,t,r):s??this.evalExpr(e.right,t,r)}case "ConditionalExpression":return this.evalExpr(e.test,t,r)?this.evalExpr(e.consequent,t,r):this.evalExpr(e.alternate,t,r);case "AssignmentExpression":return this.evalAssignment(e,t,r);case "MemberExpression":{let s=this.evalExpr(e.object,t,r);if(e.optional&&s==null)return;let i=e.computed?this.evalExpr(e.property,t,r):e.property.name;return at(s,i)}case "CallExpression":return this.evalCall(e,t,r);case "NewExpression":{let s=this.evalExpr(e.callee,t,r),i=this.evalArguments(e.arguments,t,r);if(typeof s!="function")throw new TypeError("Expression value is not a constructor");return Reflect.construct(s,i)}case "ArrowFunction":return this.makeFunction(e,t,r,false);case "SequenceExpression":{let s;for(let i of e.expressions)s=this.evalExpr(i,t,r);return s}case "SpreadElement":return this.evalExpr(e.argument,t,r)}}evalObject(e,t,r){let s={};for(let i of e.properties){if(i.type==="SpreadElement"){Object.assign(s,this.evalExpr(i.argument,t,r));continue}let o=i,a=o.computed?String(this.evalExpr(o.key,t,r)):o.key.value;if(o.kind==="get"){let c=this.makeFunction(o.value,t,r,true);Object.defineProperty(s,a,{get:c,enumerable:true,configurable:true});}else if(o.kind==="set"){let c=this.makeFunction(o.value,t,r,true);Object.defineProperty(s,a,{set:c,enumerable:true,configurable:true});}else o.kind==="method"?s[a]=this.makeFunction(o.value,t,r,true):s[a]=this.evalExpr(o.value,t,r);}return s}evalCall(e,t,r){let s,i;if(e.callee.type==="MemberExpression"){let a=e.callee,c=this.evalExpr(a.object,t,r);if(a.optional&&c==null)return;i=c;let u=a.computed?this.evalExpr(a.property,t,r):a.property.name;s=at(c,u);}else s=this.evalExpr(e.callee,t,r);if(e.optional&&s==null)return;let o=this.evalArguments(e.arguments,t,r);if(typeof s!="function"){if(s==null)return;throw new TypeError("Expression value is not a function")}return s.apply(i,o)}evalArguments(e,t,r){let s=[];for(let i of e)i.type==="SpreadElement"?s.push(...this.evalExpr(i.argument,t,r)):s.push(this.evalExpr(i,t,r));return s}evalBinary(e,t,r){switch(e){case "+":return t+r;case "-":return t-r;case "*":return t*r;case "/":return t/r;case "%":return t%r;case "**":return t**r;case "==":return t==r;case "!=":return t!=r;case "===":return t===r;case "!==":return t!==r;case "<":return t<r;case ">":return t>r;case "<=":return t<=r;case ">=":return t>=r;case "in":return t in r;case "instanceof":return t instanceof r}}evalAssignment(e,t,r){let s=e.operator;if(s==="="){let a=this.evalExpr(e.right,t,r);return this.assign(e.left,a,t,r),a}let i=this.evalTarget(e.left,t,r),o;if(s==="&&="){if(!i)return i;o=this.evalExpr(e.right,t,r);}else if(s==="||="){if(i)return i;o=this.evalExpr(e.right,t,r);}else if(s==="??="){if(i!=null)return i;o=this.evalExpr(e.right,t,r);}else {let a=this.evalExpr(e.right,t,r);o=this.evalBinary(s.slice(0,-1),i,a);}return this.assign(e.left,o,t,r),o}evalTarget(e,t,r){return this.evalExpr(e,t,r)}assign(e,t,r,s){if(e.type==="Identifier"){r.set(e.name,t)||this.root.set(e.name,t);return}if(e.type==="MemberExpression"){let i=this.evalExpr(e.object,r,s);if(i==null)throw new TypeError("Cannot assign to a property of null or undefined");let o=e.computed?this.evalExpr(e.property,r,s):e.property.name;i[o]=t;return}throw new TypeError("Invalid assignment target")}resolve(e,t){if(t.has(e))return t.get(e);if(this.root.has(e))return this.root.get(e);if(ct.has(e))return globalThis[e]}makeFunction(e,t,r,s){let i=this;return function(...o){let a=new k(t);i.bindParams(e.params,o,a);let c=s?this:r;if(e.expression)return i.evalExpr(e.body,a,c);try{i.execBlock(e.body.body,new k(a),c);}catch(u){if(u instanceof Z)return u.value;throw u}}}bindParams(e,t,r){for(let s=0;s<e.length;s++){let i=e[s];if(i.type==="RestElement"){this.bindPattern(i.argument,t.slice(s),r,false);break}this.bindPattern(i,t[s],r,false);}}bindPattern(e,t,r,s){switch(e.type){case "Identifier":r.declare(e.name,t,s);return;case "AssignmentPattern":this.bindPattern(e.left,t===void 0?this.evalExpr(e.right,r,void 0):t,r,s);return;case "RestElement":this.bindPattern(e.argument,t,r,s);return;case "ObjectPattern":{let i=t??{},o=new Set;for(let a of e.properties){let c=a.computed?String(this.evalExpr(a.key,r,void 0)):a.key.value;o.add(c),this.bindPattern(a.value,i[c],r,s);}if(e.rest){let a={};for(let c of Object.keys(i))o.has(c)||(a[c]=i[c]);r.declare(e.rest.name,a,s);}return}case "ArrayPattern":{let i=t??[];for(let o=0;o<e.elements.length;o++){let a=e.elements[o];a&&this.bindPattern(a,i[o],r,s);}e.rest&&this.bindPattern(e.rest,i.slice(e.elements.length),r,s);return}}}assignPattern(e,t,r,s){if(e.type==="Identifier"){r.set(e.name,t)||this.root.set(e.name,t);return}this.bindPattern(e,t,r,false);}};function B(n,e,t){let r=se(n,"expression");return new X(e).run(r,t)}function Ce(n,e,t){let r=se(n,"program");return new X(e).run(r,t)}var An="https://velofy.github.io/summit";function Tn(n,e){let t=n.length,r=e.length;if(!t)return r;if(!r)return t;let s=Array.from({length:r+1},(i,o)=>o);for(let i=1;i<=t;i++){let o=[i];for(let a=1;a<=r;a++){let c=n[i-1]===e[a-1]?0:1;o[a]=Math.min(s[a]+1,o[a-1]+1,s[a-1]+c);}s=o;}return s[r]}function lt(n,e){let t=null,r=1/0;for(let i of e){let o=Tn(n,i);o<r&&(r=o,t=i);}let s=n.length<=4?1:2;return t!==null&&r<=s?t:null}function Dn(n){let e=n.tagName.toLowerCase(),t=n.id?`#${n.id}`:"",r=n.classList.length?"."+Array.from(n.classList).slice(0,2).join("."):"";return `<${e}${t}${r}>`}function ie(n,e,t){let r=[`[summit] ${n}: ${e}`];return t.hint&&r.push(` ${t.hint}`),t.expression&&r.push(` expression: ${t.expression.trim()}`),t.el&&r.push(` element: ${Dn(t.el)}`),r.push(` docs: ${An}/${t.doc?t.doc+"/":""}`),r.join(`
5
- `)}function H(n,e,t={}){t.cause!==void 0?console.warn(ie(n,e,t),`
6
- `,t.cause):console.warn(ie(n,e,t));}function b(n,e,t={}){t.cause!==void 0?console.error(ie(n,e,t),`
7
- `,t.cause):console.error(ie(n,e,t));}var ut=new Set;function pt(n,e,t,r={}){ut.has(n)||(ut.add(n),H(e,t,r));}var U=new WeakMap;function R(n){let e=U.get(n);return e||U.set(n,e={}),e}var Rn=0;function ft(){return ++Rn}function P(n,e){let t=R(n);(t.cleanups??(t.cleanups=[])).push(e);}function dt(n){let e=U.get(n);if(e){if(e.cleanups){for(let t of e.cleanups)try{t();}catch(r){b("E601","a cleanup callback threw during teardown.",{doc:"lifecycle",cause:r});}e.cleanups=[];}if(e.destroyCallbacks){for(let t of e.destroyCallbacks)try{t();}catch(r){b("E602","a destroy() callback threw during teardown.",{doc:"lifecycle",cause:r});}e.destroyCallbacks=[];}}}function oe(n){let e=U.get(n)?.scopes;if(e)return e;let t=n.parentElement;for(;t;){let r=U.get(t)?.scopes;if(r)return r;t=t.parentElement;}return []}function Ie(n){let e=n;for(;e;){if(U.get(e)?.isRoot)return e;e=e.parentElement;}return null}function ae(n){let e=Ie(n)??n,t=R(e);return t.refs??(t.refs={})}var mt=36;function M(n,e){let t=oe(n),r=t.length?t[t.length-1]:void 0,s={el:n,scopes:t,evaluate:o=>B(o,i,r),effect:o=>{let a=D(o);P(n,a);},cleanup:o=>P(n,o)},i={has(o){if(e&&o in e)return true;for(let a=t.length-1;a>=0;a--)if(o in t[a])return true;return !!(o.charCodeAt(0)===mt&&re(o.slice(1)))},get(o){if(e&&o in e)return e[o];for(let a=t.length-1;a>=0;a--)if(o in t[a])return t[a][o];if(o.charCodeAt(0)===mt){let a=re(o.slice(1));if(a)return a(s)}},set(o,a){for(let c=t.length-1;c>=0;c--)if(o in t[c]){t[c][o]=a;return}t.length&&(t[t.length-1][o]=a);}};return {env:i,thisVal:r,evaluate:o=>B(o,i,r),evaluateAction:(o,a)=>a?Ce(o,{has:u=>u in a?true:i.has(u),get:u=>u in a?a[u]:i.get(u),set:(u,p)=>i.set(u,p)},r):Ce(o,i,r)}}function $e(n,e,t){let r={el:e,scopes:t,evaluate:s=>B(s,M(e).env,t.length?t[t.length-1]:void 0),effect:s=>P(e,D(s)),cleanup:s=>P(e,s)};for(let s of et())Object.defineProperty(n,"$"+s,{get:()=>re(s)(r),enumerable:false,configurable:true});}function ht(n,e){let t=n;if(t[0]==="@")t="on:"+t.slice(1);else if(t[0]===":")t="bind:"+t.slice(1);else if(t.startsWith("s-"))t=t.slice(2);else return null;let r=t.split("."),s=r[0],i=r.slice(1),o=s.indexOf(":"),a,c;return o===-1?(a=s,c=null):(a=s.slice(0,o),c=s.slice(o+1)),{name:a,value:c,modifiers:i,expression:e,raw:n}}var vt="__summitPersist";function yt(n){return {[vt]:true,initial:n,key:null,as(e){return this.key=String(e),this}}}function gt(n){return !!n&&typeof n=="object"&&n[vt]===true}var Mn=new Set(["if","for","teleport"]),xt=new Set(["data","ignore"]),Et;function He(n){Et=n;}function Ln(n){let e=[];for(let t of Array.from(n.attributes)){let r=ht(t.name,t.value);if(r)if(xt.has(r.name)||ne(r.name))e.push(r);else {let s=lt(r.name,[...Ve(),...xt]);pt(`dir:${r.name}`,"E201",`unknown directive "${t.name}".`,{el:n,doc:s?`s-${s}`:"start",hint:s?`Did you mean "s-${s}"?`:"See the directive reference."});}}return e}function bt(n){return ne(n)?.priority??De}function jn(n,e){let t=M(n);return {evaluate:r=>t.evaluate(r),evaluateAction:(r,s)=>t.evaluateAction(r,s),effect:r=>{let s=D(r);P(n,s);},cleanup:r=>P(n,r),initTree:L,destroyTree:K,scopes:e,makeEnv:(r,s)=>M(r,s).env,Summit:Et}}function wt(n,e,t){let r=ne(e.name);if(r)try{r.handler(n,e,jn(n,t));}catch(s){b("E301",`s-${e.name} failed while evaluating its expression.`,{el:n,expression:e.expression,doc:`s-${e.name}`,hint:"Every name in the expression must be state from an enclosing s-data, or an allowed global.",cause:s});}}var On=/^([A-Za-z_$][\w$]*)\s*(\(([\s\S]*)\))?$/;function Cn(n,e){let t=typeof localStorage<"u";for(let r of Object.keys(n)){let s=n[r];if(!gt(s))continue;let i=s.key??r,o=s.initial;if(t)try{let a=localStorage.getItem(i);a!=null&&(o=JSON.parse(a));}catch{}if(n[r]=o,t){let a=D(()=>{try{localStorage.setItem(i,JSON.stringify(n[r]));}catch{}});P(e,a);}}}function In(n,e,t){let r=M(n),s=e.expression.trim(),i;try{let l=s.match(On);if(l&&Re(l[1])){let d=Re(l[1]),m=l[2]?r.evaluate("["+(l[3]??"")+"]"):[];i=d(...m);}else s===""?i={}:i=r.evaluate("("+s+")");}catch(l){b("E104","s-data could not be evaluated; the component starts with empty state.",{el:n,expression:s,doc:"s-data",hint:"Check the object for unsupported syntax, e.g. an async method.",cause:l}),i={};}(i===null||typeof i!="object")&&(i={});let o=J(i);Cn(o,n);let a=[...t,o],c=R(n);c.scopes=a,c.isRoot=true,c.refs={},$e(i,n,a);let u=o.init;if(typeof u=="function")try{u();}catch(l){b("E101","s-data init() threw.",{el:n,doc:"s-data",cause:l});}let p=o.destroy;return typeof p=="function"&&P(n,()=>{try{p();}catch(l){b("E102","s-data destroy() threw.",{el:n,doc:"s-data",cause:l});}}),a}function L(n,e){let t=R(n);if(t.initialized||t.ignore)return;if(n.hasAttribute("s-ignore")){t.ignore=true,t.initialized=true;return}let r=e??oe(n);t.scopes=r,t.marker=ft();let s=Ln(n),i=s.find(c=>c.name==="data");i&&(r=In(n,i,r));let o=s.find(c=>Mn.has(c.name));if(o){t.initialized=true,wt(n,o,r);return}let a=s.filter(c=>c.name!=="data").sort((c,u)=>bt(c.name)-bt(u.name));for(let c of a)wt(n,c,r);t.initialized=true;for(let c of Array.from(n.children))L(c,r);}function K(n){dt(n);for(let e of Array.from(n.children))K(e);R(n).initialized=false;}var Ke=null;function Ne(n){Ke||(Ke=new MutationObserver($n),Ke.observe(n,{childList:true,subtree:true}));}function $n(n){let e=[],t=[];for(let r of n)r.type==="childList"&&(r.removedNodes.forEach(s=>{s.nodeType===1&&e.push(s);}),r.addedNodes.forEach(s=>{s.nodeType===1&&t.push(s);}));for(let r of e)r.isConnected||K(r);for(let r of t)r.isConnected&&!R(r).initialized&&L(r);}function kt(n){return n==null?"":String(n)}var Pt=(n,e,t)=>{t.effect(()=>{n.textContent=kt(t.evaluate(e.expression));});},St=(n,e,t)=>{t.effect(()=>{n.innerHTML=kt(t.evaluate(e.expression));let r=n.firstElementChild;for(;r;)t.initTree(r,t.scopes),r=r.nextElementSibling;});};var Hn=new Set(["disabled","checked","required","readonly","hidden","selected","open","multiple","autofocus","novalidate","autoplay","controls","loop","muted","playsinline","default","ismap","reversed","async","defer","inert"]),Kn=new Set(["value","checked","selected","indeterminate","muted","volume"]);function ce(n){return n.replace(/-([a-z])/g,(e,t)=>t.toUpperCase())}function Fe(n){return n.replace(/[A-Z]/g,e=>"-"+e.toLowerCase())}function At(n){return n?typeof n=="string"?n.split(/\s+/).filter(Boolean):Array.isArray(n)?n.flatMap(e=>At(e)):typeof n=="object"?Object.entries(n).filter(([,e])=>e).map(([e])=>e):[]:[]}function Tt(n,e){let t=new Set;for(let r of n.split(/\s+/))r&&t.add(r);for(let r of At(e))t.add(r);return [...t].join(" ")}function Dt(n,e){let t=[];if(n&&t.push(n.trim().replace(/;?\s*$/,"")),typeof e=="string")t.push(e.trim().replace(/;?\s*$/,""));else if(e&&typeof e=="object")for(let[r,s]of Object.entries(e))s==null||s===false||t.push(`${Fe(r)}: ${String(s)}`);return t.filter(Boolean).join("; ")}function ue(n,e,t){if(Hn.has(e)){t?n.setAttribute(e,""):n.removeAttribute(e),e in n&&(n[e]=!!t);return}if(Kn.has(e)&&e in n){n[e]=t;return}t===false||t==null?n.removeAttribute(e):n.setAttribute(e,String(t));}var Rt=(n,e,t)=>{if(e.value===null){Nn(n,e.expression,t);return}let r=e.modifiers.includes("camel")?ce(e.value):e.value;if(r==="class"){let s=n.getAttribute("class")??"";t.effect(()=>{n.setAttribute("class",Tt(s,t.evaluate(e.expression)));});return}if(r==="style"){let s=n.getAttribute("style")??"";t.effect(()=>{let i=Dt(s,t.evaluate(e.expression));i?n.setAttribute("style",i):n.removeAttribute("style");});return}t.effect(()=>{ue(n,r,t.evaluate(e.expression));});};function Nn(n,e,t){let r=t.evaluate(e);if(!(!r||typeof r!="object"))for(let[s,i]of Object.entries(r))if(s[0]==="@"){let o=s.slice(1),a=i;n.addEventListener(o,a),t.cleanup(()=>n.removeEventListener(o,a));}else if(s[0]===":"){let o=s.slice(1),a=i;t.effect(()=>ue(n,o,typeof a=="function"?a():a));}else ue(n,s,i);}var Fn=new Set(["shift","ctrl","alt","cmd","meta"]),Bn=new Set(["prevent","stop","self","outside","once","capture","passive","window","document","camel","dot","debounce","throttle"]),Un={enter:"Enter",tab:"Tab",space:" ",esc:"Escape",escape:"Escape",up:"ArrowUp",down:"ArrowDown",left:"ArrowLeft",right:"ArrowRight","arrow-up":"ArrowUp","arrow-down":"ArrowDown","arrow-left":"ArrowLeft","arrow-right":"ArrowRight","page-up":"PageUp","page-down":"PageDown",home:"Home",end:"End",delete:"Delete",backspace:"Backspace"};function Lt(n){return /^\d+(ms|s)?$/.test(n)}function Wn(n){return n.endsWith("ms")?parseInt(n,10):n.endsWith("s")?parseInt(n,10)*1e3:parseInt(n,10)}function Mt(n,e){let t=n.indexOf(e);if(t===-1)return null;let r=n[t+1];return r&&Lt(r)?Wn(r):250}function zn(n,e){let t=n.key;if(!t)return false;let r=Un[e];return r?t===r:Fe(t).toLowerCase()===e.toLowerCase()||t.toLowerCase()===e.toLowerCase()}function Gn(n,e){let t=n;return !(e.includes("shift")&&!t.shiftKey||e.includes("ctrl")&&!t.ctrlKey||e.includes("alt")&&!t.altKey||(e.includes("cmd")||e.includes("meta"))&&!t.metaKey)}function qn(n,e){let t;return r=>{clearTimeout(t),t=setTimeout(()=>n(r),e);}}function _n(n,e){let t=0,r;return s=>{let i=Date.now(),o=e-(i-t);o<=0?(t=i,n(s)):r||(r=setTimeout(()=>{t=Date.now(),r=void 0,n(s);},o));}}var jt=(n,e,t)=>{let r=e.modifiers,s=e.value??"";r.includes("camel")&&(s=ce(s)),r.includes("dot")&&(s=s.replace(/-/g,"."));let i=r.filter(d=>!Fn.has(d)&&!Bn.has(d)&&!Lt(d)),o=r.includes("window")?window:r.includes("document")||r.includes("outside")?document:n,a={};r.includes("capture")&&(a.capture=true),r.includes("passive")&&(a.passive=true),r.includes("once")&&(a.once=true);let c=d=>{if(!(r.includes("self")&&d.target!==n)){if(r.includes("outside")){let m=d.target;if(n===m||n.contains(m)||!document.documentElement.contains(m))return}if(!(i.length&&!i.some(m=>zn(d,m)))&&Gn(d,r)){r.includes("prevent")&&d.preventDefault(),r.includes("stop")&&d.stopPropagation();try{let m=t.evaluateAction(e.expression,{$event:d});typeof m=="function"&&m(d);}catch(m){b("E301",`@${s} handler failed while evaluating its expression.`,{el:n,expression:e.expression,doc:"s-on",hint:"Names must be state from an enclosing s-data, a $magic, or an allowed global.",cause:m});}}}},u=Mt(r,"debounce"),p=Mt(r,"throttle"),l=c;u!=null?l=qn(c,u):p!=null&&(l=_n(c,p)),o.addEventListener(s,l,a),t.cleanup(()=>o.removeEventListener(s,l,a));};function Be(n,e){if(e.includes("number")){let t=parseFloat(n);return isNaN(t)?n:t}return e.includes("boolean")?n==="true"?true:n==="false"?false:!!n:n}function Jn(n,e){let t;return ()=>{clearTimeout(t),t=setTimeout(n,e);}}function Yn(n,e){let t=n.indexOf(e);if(t===-1)return null;let r=n[t+1];return r&&/^\d+(ms|s)?$/.test(r)?r.endsWith("s")&&!r.endsWith("ms")?parseInt(r,10)*1e3:parseInt(r,10):250}var Ot=(n,e,t)=>{let r=n,s=n,i=e.modifiers,o=e.expression,a=r.type,c=n.tagName,u=()=>t.evaluate(o),p=f=>{t.evaluateAction(o+" = $model",{$model:f});};if(i.includes("fill")){let f=u();(f==null||f==="")&&p(Be(r.value??r.getAttribute("value")??"",i));}let l=()=>{if(a==="checkbox"){let f=u();if(Array.isArray(f)){let y=new Set(f);return r.checked?y.add(r.value):y.delete(r.value),[...y]}return r.checked}return a==="radio"?Be(r.value,i):c==="SELECT"&&s.multiple?Array.from(s.selectedOptions).map(f=>f.value):Be(r.value,i)},d=f=>{if(a==="checkbox"){r.checked=Array.isArray(f)?f.map(String).includes(r.value):!!f;return}if(a==="radio"){r.checked=String(f)===r.value;return}if(c==="SELECT"&&s.multiple){let x=new Set(f?.map(String)??[]);for(let T of Array.from(s.options))T.selected=x.has(T.value);return}let y=f==null?"":String(f);r.value!==y&&(r.value=y);};t.effect(()=>d(u()));let m="input";(c==="SELECT"||a==="checkbox"||a==="radio")&&(m="change"),(i.includes("lazy")||i.includes("change"))&&(m="change"),i.includes("blur")&&(m="blur");let S=()=>p(l()),v=Yn(i,"debounce");v!=null&&(S=Jn(S,v)),n.addEventListener(m,S),t.cleanup(()=>n.removeEventListener(m,S)),n._summitModel={get:u,set:p};};var Q=new WeakMap;function Zn(n){let e=Q.get(n);return e||Q.set(n,e={classMode:false}),e}function It(n){return Q.has(n)}function w(n){return n?n.split(/\s+/).filter(Boolean):[]}function Ct(n,e){let t=n.indexOf(e);if(t===-1)return;let r=n[t+1];if(r)return r.endsWith("ms")?parseInt(r,10):r.endsWith("s")?parseInt(r,10)*1e3:parseInt(r,10)}var $t=(n,e)=>{let t=Zn(n),r=e.modifiers;if(e.value){t.classMode=true;let s=e.value,i={enter:"enter","enter-start":"enterStart","enter-end":"enterEnd",leave:"leave","leave-start":"leaveStart","leave-end":"leaveEnd"};t[i[s]]=e.expression;return}if(t.duration=Ct(r,"duration")??t.duration,t.delay=Ct(r,"delay")??t.delay,r.includes("opacity")&&(t.opacity=true),r.includes("scale")){let s=r.indexOf("scale"),i=r[s+1];t.scale=i&&/^\d+$/.test(i)?parseInt(i,10)/100:.95;}!r.includes("opacity")&&t.scale===void 0&&(t.opacity=true,t.scale=.95);};function Ht(n,e,t){let r=getComputedStyle(n).transitionDuration,s=r&&r!=="0s"?parseFloat(r)*1e3:e;s<=0?requestAnimationFrame(()=>t()):setTimeout(t,s);}function Kt(n,e){let t=Q.get(n);if(!t){return}if(t.classMode){n.classList.add(...w(t.enter),...w(t.enterStart)),requestAnimationFrame(()=>{n.classList.remove(...w(t.enterStart)),n.classList.add(...w(t.enterEnd)),Ht(n,t.duration??150,()=>{n.classList.remove(...w(t.enter),...w(t.enterEnd));});});return}let r=t.duration??150;n.style.transition="none",t.opacity&&(n.style.opacity="0"),t.scale!==void 0&&(n.style.transform=`scale(${t.scale})`),requestAnimationFrame(()=>{n.style.transition=`all ${r}ms ease-out ${t.delay??0}ms`,t.opacity&&(n.style.opacity="1"),t.scale!==void 0&&(n.style.transform="scale(1)"),setTimeout(()=>{n.style.removeProperty("transition"),n.style.removeProperty("opacity"),n.style.removeProperty("transform");},r+(t.delay??0));});}function Nt(n,e){let t=Q.get(n);if(!t){e();return}if(t.classMode){n.classList.add(...w(t.leave),...w(t.leaveStart)),requestAnimationFrame(()=>{n.classList.remove(...w(t.leaveStart)),n.classList.add(...w(t.leaveEnd)),Ht(n,t.duration??150,()=>{n.classList.remove(...w(t.leave),...w(t.leaveEnd)),e();});});return}let r=t.duration??150;n.style.transition=`all ${r}ms ease-in ${t.delay??0}ms`,requestAnimationFrame(()=>{t.opacity&&(n.style.opacity="0"),t.scale!==void 0&&(n.style.transform=`scale(${t.scale})`),setTimeout(()=>{n.style.removeProperty("transition"),n.style.removeProperty("opacity"),n.style.removeProperty("transform"),e();},r+(t.delay??0));});}var Ft=(n,e,t)=>{let r=n,s=e.modifiers.includes("important"),i=r.style.display==="none"?"":r.style.display,o=()=>{i?r.style.display=i:r.style.removeProperty("display");},a=()=>{s?r.style.setProperty("display","none","important"):r.style.setProperty("display","none");},c=true;t.effect(()=>{let u=!!t.evaluate(e.expression),p=It(n)&&!c;if(c=false,!p){u?o():a();return}u?(o(),Kt(r)):Nt(r,a);});};var Bt=(n,e,t)=>{let r=n.parentNode;if(!r)return;let s=document.createComment("s-if");r.insertBefore(s,n);let i;if(n.tagName==="TEMPLATE")i=Array.from(n.content.children).map(u=>u.cloneNode(true));else {let u=n.cloneNode(true);u.removeAttribute(e.raw),i=[u];}if(n.remove(),!i.length)return;let o=t.scopes,a=[],c=()=>{for(let u of a)t.destroyTree(u),u.remove();a=[];};t.effect(()=>{let u=!!t.evaluate(e.expression);if(u&&!a.length){let p=i.map(d=>d.cloneNode(true)),l=document.createDocumentFragment();for(let d of p)l.appendChild(d);s.parentNode?.insertBefore(l,s.nextSibling);for(let d of p)t.initTree(d,o);a=p;}else !u&&a.length&&c();}),t.cleanup(c);};var Ut=/^\s*(.+?)\s+(?:in|of)\s+([\s\S]+)$/;function Xn(n){let e=n.trim();if(e.startsWith("(")){let r=e.slice(1,-1).split(",").map(s=>s.trim());return {item:r[0],index:r[1]??null}}return {item:e,index:null}}function Qn(n){return typeof n=="number"?Array.from({length:n},(e,t)=>({value:t+1,index:t})):Array.isArray(n)?n.map((e,t)=>({value:e,index:t})):n&&typeof n=="object"?Object.entries(n).map(([e,t],r)=>({value:t,index:r,objectKey:e})):[]}var Wt=(n,e,t)=>{if(n.tagName!=="TEMPLATE"){H("E401","s-for must be used on a <template> element.",{el:n,doc:"s-for",hint:`Wrap the repeated markup: <template s-for="${e.expression}"><li>...</li></template>`});return}let r=n.parentNode;if(!r)return;let s=n.content.firstElementChild;if(!s){H("E402","s-for <template> needs exactly one root element.",{el:n,doc:"s-for"});return}let{item:i,index:o}=Xn(e.expression.replace(Ut,"$1")),a=e.expression.replace(Ut,"$2"),c=n.getAttribute(":key")??n.getAttribute("s-bind:key"),u=document.createComment("s-for");r.insertBefore(u,n),n.remove();let p=t.scopes,l=new Map,d=(v,f)=>{if(!c)return v.objectKey??v.index;let y=M(n,f).env;try{return B(c,y)}catch{return v.index}},m=v=>{let f={[i]:v.value};return o&&(f[o]=v.objectKey??v.index),E(f)},S=()=>{for(let v of l.values())t.destroyTree(v.node),v.node.remove();l.clear();};t.effect(()=>{let v=Qn(t.evaluate(a)),f=new Map,y=[];for(let x of v){let T=m(x),W=d(x,T);y.push(W);let ee=l.get(W);if(ee)ee.scope[i]=x.value,o&&(ee.scope[o]=x.objectKey??x.index),f.set(W,ee),l.delete(W);else {let pe=s.cloneNode(true);r.insertBefore(pe,u),t.initTree(pe,[...p,T]),f.set(W,{node:pe,scope:T});}}for(let x of l.values())t.destroyTree(x.node),x.node.remove();for(let x of y){let T=f.get(x);r.insertBefore(T.node,u);}l=f;}),t.cleanup(S);};var zt=(n,e,t)=>{if(n.tagName!=="TEMPLATE"){H("E501","s-teleport must be used on a <template> element.",{el:n,doc:"s-teleport"});return}let r=e.expression||e.value||"",s=r?document.querySelector(r):null;if(!s){H("E502",`s-teleport target not found: "${r}".`,{el:n,doc:"s-teleport",hint:"The target must be a CSS selector that already exists in the DOM, e.g. body."});return}let i=n.content,o=Array.from(i.children).map(c=>c.cloneNode(true)),a=document.createDocumentFragment();for(let c of o)a.appendChild(c);e.modifiers.includes("prepend")?s.parentNode?.insertBefore(a,s):e.modifiers.includes("append")?s.parentNode?.insertBefore(a,s.nextSibling):s.appendChild(a);for(let c of o)t.initTree(c,t.scopes);t.cleanup(()=>{for(let c of o)t.destroyTree(c),c.remove();});};var Gt=0,Ue=new WeakMap;function qt(n,e){let t=Ue.get(n);t||Ue.set(n,t=new Map);for(let r of e)t.set(r,++Gt);}function _t(n,e,t){let r=n;for(;r;){let i=Ue.get(r);if(i&&i.has(e)){let o=`${e}-${i.get(e)}`;return t!=null?`${o}-${t}`:o}r=r.parentElement;}let s=`${e}-${++Gt}`;return t!=null?`${s}-${t}`:s}var Jt=(n,e,t)=>{t.evaluateAction(e.expression);},Yt=(n,e,t)=>{t.effect(()=>{t.evaluateAction(e.expression);});},Zt=(n,e,t)=>{let r=t.evaluate(e.expression),s=typeof r=="string"&&r?r:e.expression.trim(),i=ae(n);i[s]=n,t.cleanup(()=>{i[s]===n&&delete i[s];});},Xt=(n,e,t)=>{let r=t.evaluate(e.expression);Array.isArray(r)&&qt(n,r.map(String));},Qt=n=>{n.removeAttribute("s-cloak");};var Vt=(n,e,t)=>{if(typeof IntersectionObserver>"u")return;let r=e.value==="leave",s=e.modifiers.includes("full")?.99:e.modifiers.includes("half")?.5:0,i=e.modifiers.includes("once"),o=new IntersectionObserver(a=>{for(let c of a)(r?!c.isIntersecting:c.isIntersecting)&&(t.evaluateAction(e.expression),i&&o.disconnect());},{threshold:s});o.observe(n),t.cleanup(()=>o.disconnect());},en=(n,e,t)=>{if(typeof ResizeObserver>"u")return;let r=new ResizeObserver(s=>{let i=s[0]?.contentRect;t.evaluateAction(e.expression,{$width:i?.width??0,$height:i?.height??0});});r.observe(n),t.cleanup(()=>r.disconnect());};var Vn=["a[href]","button:not([disabled])","input:not([disabled]):not([type=hidden])","select:not([disabled])","textarea:not([disabled])","[tabindex]:not([tabindex='-1'])","[contenteditable]"].join(",");function er(n){let e=n.getBoundingClientRect();return e.width===0&&e.height===0?n.offsetParent!==null||typeof n.offsetParent>"u":true}function V(n){return Array.from(n.querySelectorAll(Vn)).filter(er)}var tn=(n,e,t)=>{let r=false,s=null,i=c=>{if(c.key!=="Tab")return;let u=V(n);if(!u.length){c.preventDefault();return}let p=u[0],l=u[u.length-1],d=document.activeElement;c.shiftKey&&(d===p||!n.contains(d))?(c.preventDefault(),l.focus()):!c.shiftKey&&d===l&&(c.preventDefault(),p.focus());},o=()=>{if(r)return;r=true,s=document.activeElement,document.addEventListener("keydown",i,true);let c=()=>{(V(n)[0]??n).focus?.();};typeof requestAnimationFrame=="function"?requestAnimationFrame(c):c();},a=()=>{r&&(r=false,document.removeEventListener("keydown",i,true),s?.focus?.());};t.effect(()=>{t.evaluate(e.expression)?o():a();}),t.cleanup(a);};var nn=(n,e,t)=>{let r=e.modifiers,s=r.includes("top")?"top":"bottom",i=r.includes("end")?"end":r.includes("center")?"center":"start",o=r.indexOf("offset"),a=o>=0&&/^\d+$/.test(r[o+1]??"")?Number(r[o+1]):8,c=n;c.style.position="fixed",c.style.zIndex||(c.style.zIndex="50"),c.style.margin="0";let u=null,p=()=>{if(!u||typeof window>"u")return;let l=u.getBoundingClientRect(),d=c.offsetWidth,m=c.offsetHeight,S=window.innerHeight,v=window.innerWidth,f=s==="top"?l.top-m-a:l.bottom+a;s==="bottom"&&f+m>S&&l.top-m-a>=0&&(f=l.top-m-a),s==="top"&&f<0&&l.bottom+a+m<=S&&(f=l.bottom+a);let y=i==="end"?l.right-d:i==="center"?l.left+l.width/2-d/2:l.left;y=Math.max(8,Math.min(y,v-d-8)),c.style.top=`${Math.round(f)}px`,c.style.left=`${Math.round(y)}px`;};if(t.effect(()=>{let l=t.evaluate(e.expression);u=l&&typeof l.getBoundingClientRect=="function"?l:null,u&&p();}),typeof window<"u"){let l=()=>p();window.addEventListener("scroll",l,true),window.addEventListener("resize",l),t.cleanup(()=>{window.removeEventListener("scroll",l,true),window.removeEventListener("resize",l);});}};var rn=(n,e,t)=>{let r=n;r.style.overflow="hidden";let s=true;t.effect(()=>{let i=!!t.evaluate(e.expression);if(s){s=false,r.style.height=i?"auto":"0px",i||r.setAttribute("hidden","until-found");return}r.removeAttribute("hidden");let o=r.getBoundingClientRect().height;r.style.height=`${o}px`;let a=i?r.scrollHeight:0,c=()=>{r.style.transition="height 250ms ease",r.style.height=`${a}px`;};typeof requestAnimationFrame=="function"?requestAnimationFrame(c):c();let u=()=>{r.style.transition="",i&&(r.style.height="auto"),r.removeEventListener("transitionend",u);};r.addEventListener("transitionend",u);});};function tr(n,e){return n==="9"?/\d/.test(e):n==="a"?/[a-zA-Z]/.test(e):n==="*"?/[a-zA-Z0-9]/.test(e):false}function nr(n,e){let t="",r=0;for(let s of e){if(r>=n.length)break;if(s==="9"||s==="a"||s==="*")for(;r<n.length;){let i=n[r++];if(tr(s,i)){t+=i;break}}else t+=s,n[r]===s&&r++;}return t}var sn=(n,e,t)=>{let r=n,s=String(t.evaluate(e.expression)??e.expression),i=()=>{r.value=nr(r.value,s);};r.addEventListener("input",i),r.value&&i(),t.cleanup(()=>r.removeEventListener("input",i));};function on(){h("ref",Zt,10),h("id",Xt,15),h("if",Bt,20),h("for",Wt,20),h("teleport",zt,20),h("bind",Rt,50),h("mask",sn,55),h("model",Ot,60),h("on",jt,70),h("text",Pt,80),h("html",St,80),h("transition",$t,85),h("anchor",nn,88),h("collapse",rn,89),h("show",Ft,90),h("trap",tn,95),h("effect",Yt,100),h("intersect",Vt,100),h("resize",en,100),h("init",Jt,200),h("cloak",Qt,1e3);}function We(n){let e=()=>V(n),t=r=>{let s=e();if(!s.length)return;let i=s.indexOf(document.activeElement),o=i===-1?0:(i+r+s.length)%s.length;s[o]?.focus();};return {focus(r){r?.focus?.();},first(){e()[0]?.focus();},last(){let r=e();r[r.length-1]?.focus();},next(){t(1);},previous(){t(-1);},within(r){return We(r)}}}function an(){g("el",n=>n.el),g("refs",n=>ae(n.el)),g("root",n=>Ie(n.el)),g("data",n=>n.scopes.length?n.scopes[n.scopes.length-1]:{}),g("store",()=>nt()),g("watch",n=>(e,t)=>{let r,s=true,i=D(()=>{let o=n.evaluate(e);if(s){r=o,s=false;return}if(Object.is(o,r))return;let a=r;r=o,t(o,a);});return n.cleanup(i),i}),g("dispatch",n=>(e,t,r={})=>{let s=new CustomEvent(e,{detail:t,bubbles:true,composed:true,cancelable:true,...r});return n.el.dispatchEvent(s)}),g("nextTick",()=>n=>_(n)),g("id",n=>(e,t)=>_t(n.el,e,t)),g("persist",()=>n=>yt(n)),g("focus",n=>We(n.el));}var rr="0.1.0",ze=false;function cn(n){typeof document<"u"&&document.dispatchEvent(new CustomEvent(n));}function sr(n){if(ze)return;ze=true;let e=n??(typeof document<"u"?document.body:void 0);e&&(cn("summit:init"),L(e),Ne(e.ownerDocument?.body??e),cn("summit:initialized"));}var un={version:rr,started:()=>ze,start:sr,data(n,e){return tt(n,e),this},directive(n,e,t){return h(n,e,t),this},magic(n,e){return g(n,e),this},bind(n,e){return rt(n,e),this},store(n,e){if(e===void 0)return Le(n);if(e!==null&&typeof e=="object"){let t=J(e);Me(n,t);let r=t.init;if(typeof r=="function")try{r();}catch(s){b("E103",`store "${n}" init() threw.`,{doc:"globals-store",cause:s});}return t}return Me(n,e),Le(n)},plugin(n){return n(this),this},addGlobals(n){return Oe(n),this},getBind:st,signal:he,computed:G,effect:O,reactive:E,batch:me,nextTick:_,initTree:L,destroyTree:K};on();an();He(un);var le=un;window.Summit=le;function ln(){le.start();}document.readyState==="loading"?document.addEventListener("DOMContentLoaded",ln,{once:true}):ln();var ki=le;return ki;})();//# sourceMappingURL=summit.min.js.map
1
+ (function(){'use strict';var L,G=[],de=0,ne=new Set;function j(n,e={}){let t=mn(n,e);return e.lazy||t(),t}function mn(n,e){let t=function(){if(!t.active)return n();if(!G.includes(t)){_e(t);try{return G.push(t),L=t,n()}finally{G.pop(),L=G[G.length-1];}}};return t.deps=[],t.active=true,t.scheduler=e.scheduler,t.onStop=e.onStop,t.raw=n,t}function _e(n){let{deps:e}=n;for(let t of e)t.delete(n);e.length=0;}function me(n){n.active&&(_e(n),n.onStop?.(),n.active=false);}function O(n){L&&(n.has(L)||(n.add(L),L.deps.push(n)));}function C(n){let e=[...n];for(let t of e)if(t!==L){if(de>0){ne.add(t);continue}Je(t);}}function Je(n){n.scheduler?n.scheduler():n();}function he(n){de++;try{return n()}finally{--de===0&&hn();}}function hn(){if(ne.size===0)return;let n=[...ne];ne.clear();for(let e of n)e.active&&Je(e);}function ve(n){let e=n,t=new Set,r=function(){return O(t),e};return r.set=s=>{let i=typeof s=="function"?s(e):s;Object.is(i,e)||(e=i,C(t));},r.peek=()=>e,r}function q(n){let e,t=true,r=new Set,s=j(n,{lazy:true,scheduler:()=>{t||(t=true,C(r));}}),i=function(){return t&&(e=s(),t=false),O(r),e};return i.peek=()=>(t&&(e=s(),t=false),e),i}var be=Symbol("summit.raw"),ye=Symbol("summit.iterate"),xe=new WeakMap,Ye=new WeakMap;function vn(n,e){let t=xe.get(n);t||xe.set(n,t=new Map);let r=t.get(e);return r||t.set(e,r=new Set),r}function ge(n,e){O(vn(n,e));}function _(n,e){let t=xe.get(n);if(!t)return;let r=t.get(e);r&&C(r);}function Ze(n){return n!==null&&typeof n=="object"}function yn(n){let e=Object.getPrototypeOf(n);return e===Object.prototype||e===null}function Xe(n){return Ze(n)&&(Array.isArray(n)||yn(n))}var gn={get(n,e,t){if(e===be)return n;let r=Reflect.get(n,e,t);return typeof e=="symbol"?r:(ge(n,e),Xe(r)?w(r):r)},set(n,e,t,r){let s=Ze(t)?we(t):t,i=Array.isArray(n),o=i?Number(e)<n.length:Object.prototype.hasOwnProperty.call(n,e),a=n[e],c=Reflect.set(n,e,s,r);return o?Object.is(a,s)||_(n,e):(_(n,e),_(n,i?"length":ye)),c},has(n,e){return ge(n,e),Reflect.has(n,e)},deleteProperty(n,e){let t=Object.prototype.hasOwnProperty.call(n,e),r=Reflect.deleteProperty(n,e);return t&&r&&(_(n,e),_(n,ye)),r},ownKeys(n){return ge(n,Array.isArray(n)?"length":ye),Reflect.ownKeys(n)}};function w(n){if(!Xe(n)||n[be])return n;let e=Ye.get(n);if(e)return e;let t=new Proxy(n,gn);return Ye.set(n,t),t}function we(n){let e=n&&n[be];return e?we(e):n}var Ee=new Set,ke=false,Pe=null,Qe=Promise.resolve();function Se(n){Ee.add(n),ke||(ke=true,Pe=Qe.then(xn));}function xn(){let n=[...Ee];Ee.clear(),ke=false,Pe=null;for(let e of n)e();}function J(n){let e=Pe??Qe;return n?e.then(()=>{n();}):e.then(()=>{})}function T(n){let e;return e=j(n,{lazy:true,scheduler:()=>Se(e)}),e(),()=>me(e)}var Ae=new Map,Te=new Map,Ve=new Map,Re=w({}),et=new Map,De=100;function h(n,e,t=De){Ae.set(n,{handler:e,priority:t});}function re(n){return Ae.get(n)}function tt(){return [...Ae.keys()]}function y(n,e){Te.set(n,e);}function se(n){return Te.get(n)}function nt(){return [...Te.keys()]}function rt(n,e){Ve.set(n,e);}function Me(n){return Ve.get(n)}function Le(n,e){Re[n]=e;}function je(n){return Re[n]}function st(){return Re}function it(n,e){et.set(n,e);}function ot(n){return et.get(n)}function Y(n){let e=w(n),t=Object.getOwnPropertyDescriptors(n);for(let r of Object.keys(t)){let s=t[r];if(typeof s.get=="function"){let i=s.get,o=s.set,a=q(()=>i.call(e));Object.defineProperty(n,r,{get:()=>a(),set:o?c=>o.call(e,c):void 0,enumerable:s.enumerable,configurable:true});}else typeof s.value=="function"&&(n[r]=s.value.bind(e));}return e}var bn=new Set(["return","typeof","void","in","instanceof","new","of","delete","do","else"]);function wn(n){if(!n)return true;switch(n.type){case "num":case "str":case "tmpl":case "regex":return false;case "ident":return bn.has(n.value);case "punc":return n.value!==")"&&n.value!=="]";default:return true}}var En=["...","===","!==","**=","&&=","||=","??=","==","!=","<=",">=","&&","||","??","?.","=>","++","--","+=","-=","*=","/=","%=","**","(",")","[","]","{","}",".",",",";",":","?","+","-","*","/","%","<",">","=","!"],I=class extends Error{};function kn(n){return /[A-Za-z_$]/.test(n)}function Pn(n){return /[A-Za-z0-9_$]/.test(n)}function Z(n){return n>="0"&&n<="9"}function at(n){let e=[],t=0,r=n.length;for(;t<r;){let s=n[t];if(s===" "||s===" "||s===`
2
+ `||s==="\r"){t++;continue}if(Z(s)||s==="."&&Z(n[t+1]??"")){let o=t;if(s==="0"&&(n[t+1]==="x"||n[t+1]==="X"))for(t+=2;t<r&&/[0-9a-fA-F]/.test(n[t]);)t++;else {for(;t<r&&Z(n[t]);)t++;if(n[t]===".")for(t++;t<r&&Z(n[t]);)t++;if(n[t]==="e"||n[t]==="E")for(t++,(n[t]==="+"||n[t]==="-")&&t++;t<r&&Z(n[t]);)t++;}e.push({type:"num",value:n.slice(o,t),start:o,end:t});continue}if(s==='"'||s==="'"){let o=t,a=s;t++;let c="";for(;t<r&&n[t]!==a;)n[t]==="\\"?(c+=Sn(n,t),t+=2):(c+=n[t],t++);if(t>=r)throw new I(`Unterminated string in expression: ${n}`);t++,e.push({type:"str",value:c,start:o,end:t});continue}if(s==="`"){let o=t;t++;let a="",c=0;for(;t<r;){let u=n[t];if(u==="\\"){a+=n[t]+(n[t+1]??""),t+=2;continue}if(u==="`"&&c===0)break;if(u==="$"&&n[t+1]==="{"){c++,a+="${",t+=2;continue}if(u==="}"&&c>0){c--,a+="}",t++;continue}a+=u,t++;}if(t>=r)throw new I(`Unterminated template literal: ${n}`);t++,e.push({type:"tmpl",value:a,raw:a,start:o,end:t});continue}if(kn(s)){let o=t;for(t++;t<r&&Pn(n[t]);)t++;e.push({type:"ident",value:n.slice(o,t),start:o,end:t});continue}if(s==="/"&&wn(e[e.length-1])){let o=t;t++;let a="",c=false;for(;t<r;){let f=n[t];if(f==="\\"){a+=f+(n[t+1]??""),t+=2;continue}if(f===`
3
+ `)throw new I(`Unterminated regex in expression: ${n}`);if(f==="[")c=true;else if(f==="]")c=false;else if(f==="/"&&!c)break;a+=f,t++;}if(n[t]!=="/")throw new I(`Unterminated regex in expression: ${n}`);t++;let u="";for(;t<r&&/[a-z]/i.test(n[t]);)u+=n[t],t++;e.push({type:"regex",value:a,flags:u,start:o,end:t});continue}let i=false;for(let o of En)if(n.startsWith(o,t)){e.push({type:"punc",value:o,start:t,end:t+o.length}),t+=o.length,i=true;break}if(!i)throw new I(`Unexpected character '${s}' in expression: ${n}`)}return e.push({type:"eof",value:"",start:r,end:r}),e}function Sn(n,e){let t=n[e+1];switch(t){case "n":return `
4
+ `;case "t":return " ";case "r":return "\r";case "b":return "\b";case "f":return "\f";case "v":return "\v";case "0":return "\0";case "\\":return "\\";case "'":return "'";case '"':return '"';case "`":return "`";default:return t??""}}var A=class extends Error{},An=new Set(["true","false","null","undefined","this","typeof","void","in","instanceof","if","else","return","let","const","var","for","of","while","break","continue"]),Tn={"??":1,"||":2,"&&":3,"==":7,"!=":7,"===":7,"!==":7,"<":8,">":8,"<=":8,">=":8,in:8,instanceof:8,"+":10,"-":10,"*":11,"/":11,"%":11,"**":12},Rn=new Set(["=","+=","-=","*=","/=","%=","**=","&&=","||=","??="]),Oe=class{constructor(e){this.pos=0;this.tokens=at(e);}peek(e=0){return this.tokens[this.pos+e]??this.tokens[this.tokens.length-1]}next(){return this.tokens[this.pos++]??this.tokens[this.tokens.length-1]}isPunc(e,t=0){let r=this.peek(t);return r.type==="punc"&&r.value===e}isKeyword(e,t=0){let r=this.peek(t);return r.type==="ident"&&r.value===e}eatPunc(e){if(!this.isPunc(e))throw new A(`Expected '${e}' but found '${this.peek().value||"end of input"}'`);this.pos++;}atEnd(){return this.peek().type==="eof"}parseProgram(){let e=[];for(;!this.atEnd();){if(this.isPunc(";")){this.pos++;continue}e.push(this.parseStatement());}return {type:"Program",body:e}}parseExpressionProgram(){let e=this.parseExpression();if(!this.atEnd())throw new A(`Unexpected trailing input '${this.peek().value}'`);return {type:"Program",body:[{type:"ExpressionStatement",expression:e}]}}parseStatement(){if(this.isPunc("{"))return this.parseBlock();if(this.isKeyword("if"))return this.parseIf();if(this.isKeyword("return"))return this.parseReturn();if(this.isKeyword("let")||this.isKeyword("const")||this.isKeyword("var")){let t=this.parseVarDecl();return this.consumeSemi(),t}if(this.isKeyword("for"))return this.parseFor();if(this.isKeyword("while"))return this.parseWhile();if(this.isKeyword("break"))return this.pos++,this.consumeSemi(),{type:"BreakStatement"};if(this.isKeyword("continue"))return this.pos++,this.consumeSemi(),{type:"ContinueStatement"};let e=this.parseExpression();return this.consumeSemi(),{type:"ExpressionStatement",expression:e}}consumeSemi(){this.isPunc(";")&&this.pos++;}parseBlock(){this.eatPunc("{");let e=[];for(;!this.isPunc("}")&&!this.atEnd();){if(this.isPunc(";")){this.pos++;continue}e.push(this.parseStatement());}return this.eatPunc("}"),{type:"BlockStatement",body:e}}parseIf(){this.pos++,this.eatPunc("(");let e=this.parseExpression();this.eatPunc(")");let t=this.parseStatement(),r=null;return this.isKeyword("else")&&(this.pos++,r=this.parseStatement()),{type:"IfStatement",test:e,consequent:t,alternate:r}}parseReturn(){this.pos++;let e=null;return !this.isPunc(";")&&!this.isPunc("}")&&!this.atEnd()&&(e=this.parseExpression()),this.consumeSemi(),{type:"ReturnStatement",argument:e}}parseVarDecl(){let e=this.next().value,t=[];do{let r=this.parsePattern(),s=null;this.isPunc("=")&&(this.pos++,s=this.parseAssignment()),t.push({id:r,init:s});}while(this.isPunc(",")&&(this.pos++,true));return {type:"VariableDeclaration",kind:e,declarations:t}}parseFor(){this.pos++,this.eatPunc("(");let e=null;if(this.isKeyword("let")||this.isKeyword("const")||this.isKeyword("var")){let i=this.next().value,o=this.parsePattern();if(this.isKeyword("of")){this.pos++;let u=this.parseExpression();this.eatPunc(")");let f=this.parseStatement();return {type:"ForOfStatement",left:{type:"VariableDeclaration",kind:i,declarations:[{id:o,init:null}]},right:u,body:f}}let a=null;this.isPunc("=")&&(this.pos++,a=this.parseAssignment());let c=[{id:o,init:a}];for(;this.isPunc(",");){this.pos++;let u=this.parsePattern(),f=null;this.isPunc("=")&&(this.pos++,f=this.parseAssignment()),c.push({id:u,init:f});}e={type:"VariableDeclaration",kind:i,declarations:c};}else this.isPunc(";")||(e=this.parseExpression());this.eatPunc(";");let t=this.isPunc(";")?null:this.parseExpression();this.eatPunc(";");let r=this.isPunc(")")?null:this.parseExpression();this.eatPunc(")");let s=this.parseStatement();return {type:"ForStatement",init:e,test:t,update:r,body:s}}parseWhile(){this.pos++,this.eatPunc("(");let e=this.parseExpression();this.eatPunc(")");let t=this.parseStatement();return {type:"WhileStatement",test:e,body:t}}parseExpression(){return this.parseAssignment()}parseAssignment(){if(this.isArrowAhead())return this.parseArrow();let e=this.parseConditional(),t=this.peek();if(t.type==="punc"&&Rn.has(t.value)){this.pos++;let r=this.parseAssignment();return {type:"AssignmentExpression",operator:t.value,left:e,right:r}}return e}parseConditional(){let e=this.parseBinary(1);if(this.isPunc("?")){this.pos++;let t=this.parseAssignment();this.eatPunc(":");let r=this.parseAssignment();return {type:"ConditionalExpression",test:e,consequent:t,alternate:r}}return e}parseBinary(e){let t=this.parseUnary();for(;;){let r=this.peek(),s=r.type==="punc"||r.type==="ident"&&(r.value==="in"||r.value==="instanceof")?r.value:null;if(s===null)break;let i=Tn[s];if(i===void 0||i<e)break;this.pos++;let o=s==="**",a=this.parseBinary(o?i:i+1);s==="&&"||s==="||"||s==="??"?t={type:"LogicalExpression",operator:s,left:t,right:a}:t={type:"BinaryExpression",operator:s,left:t,right:a};}return t}parseUnary(){let e=this.peek();return e.type==="punc"&&(e.value==="!"||e.value==="-"||e.value==="+")?(this.pos++,{type:"UnaryExpression",operator:e.value,argument:this.parseUnary()}):e.type==="ident"&&(e.value==="typeof"||e.value==="void")?(this.pos++,{type:"UnaryExpression",operator:e.value,argument:this.parseUnary()}):e.type==="punc"&&(e.value==="++"||e.value==="--")?(this.pos++,{type:"UpdateExpression",operator:e.value,prefix:true,argument:this.parseUnary()}):this.parsePostfix()}parsePostfix(){let e=this.parseCallMember(),t=this.peek();return t.type==="punc"&&(t.value==="++"||t.value==="--")&&(this.pos++,e={type:"UpdateExpression",operator:t.value,prefix:false,argument:e}),e}parseNewExpr(){this.pos++;let e=this.parsePrimary();for(;;)if(this.isPunc(".")){this.pos++;let r=this.next();e={type:"MemberExpression",object:e,property:{type:"Identifier",name:r.value},computed:false,optional:false};}else if(this.isPunc("[")){this.pos++;let r=this.parseExpression();this.eatPunc("]"),e={type:"MemberExpression",object:e,property:r,computed:true,optional:false};}else break;let t=this.isPunc("(")?this.parseArguments():[];return {type:"NewExpression",callee:e,arguments:t}}parseCallMember(){let e=this.isKeyword("new")?this.parseNewExpr():this.parsePrimary();for(;;)if(this.isPunc(".")){this.pos++;let t=this.next();e={type:"MemberExpression",object:e,property:{type:"Identifier",name:t.value},computed:false,optional:false};}else if(this.isPunc("?."))if(this.pos++,this.isPunc("("))e={type:"CallExpression",callee:e,arguments:this.parseArguments(),optional:true};else if(this.isPunc("[")){this.pos++;let t=this.parseExpression();this.eatPunc("]"),e={type:"MemberExpression",object:e,property:t,computed:true,optional:true};}else {let t=this.next();e={type:"MemberExpression",object:e,property:{type:"Identifier",name:t.value},computed:false,optional:true};}else if(this.isPunc("[")){this.pos++;let t=this.parseExpression();this.eatPunc("]"),e={type:"MemberExpression",object:e,property:t,computed:true,optional:false};}else if(this.isPunc("("))e={type:"CallExpression",callee:e,arguments:this.parseArguments(),optional:false};else break;return e}parseArguments(){this.eatPunc("(");let e=[];for(;!this.isPunc(")")&&!this.atEnd()&&(this.isPunc("...")?(this.pos++,e.push({type:"SpreadElement",argument:this.parseAssignment()})):e.push(this.parseAssignment()),this.isPunc(","));)this.pos++;return this.eatPunc(")"),e}parsePrimary(){let e=this.peek();if(e.type==="num")return this.pos++,{type:"NumberLiteral",value:e.value.startsWith("0x")||e.value.startsWith("0X")?parseInt(e.value,16):Number(e.value)};if(e.type==="str")return this.pos++,{type:"StringLiteral",value:e.value};if(e.type==="tmpl")return this.pos++,this.parseTemplate(e.raw??"");if(e.type==="regex")return this.pos++,{type:"RegexLiteral",pattern:e.value,flags:e.flags??""};if(e.type==="ident")return e.value==="true"||e.value==="false"?(this.pos++,{type:"BooleanLiteral",value:e.value==="true"}):e.value==="null"?(this.pos++,{type:"NullLiteral"}):e.value==="undefined"?(this.pos++,{type:"UndefinedLiteral"}):e.value==="this"?(this.pos++,{type:"ThisExpression"}):(this.pos++,{type:"Identifier",name:e.value});if(this.isPunc("(")){this.pos++;let t=this.parseAssignment();if(this.isPunc(",")){let r=[t];for(;this.isPunc(",");)this.pos++,r.push(this.parseAssignment());return this.eatPunc(")"),{type:"SequenceExpression",expressions:r}}return this.eatPunc(")"),t}if(this.isPunc("["))return this.parseArray();if(this.isPunc("{"))return this.parseObject();throw new A(`Unexpected token '${e.value||"end of input"}' in expression`)}parseArray(){this.eatPunc("[");let e=[];for(;!this.isPunc("]")&&!this.atEnd();){if(this.isPunc(",")){e.push(null),this.pos++;continue}if(this.isPunc("...")?(this.pos++,e.push({type:"SpreadElement",argument:this.parseAssignment()})):e.push(this.parseAssignment()),this.isPunc(","))this.pos++;else break}return this.eatPunc("]"),{type:"ArrayExpression",elements:e}}parseObject(){this.eatPunc("{");let e=[];for(;!this.isPunc("}")&&!this.atEnd()&&(this.isPunc("...")?(this.pos++,e.push({type:"SpreadElement",argument:this.parseAssignment()})):e.push(this.parseObjectProperty()),this.isPunc(","));)this.pos++;return this.eatPunc("}"),{type:"ObjectExpression",properties:e}}parseObjectProperty(){if(this.isKeyword("async")&&this.peek(1).type==="ident")throw new A("async methods are not supported in Summit expressions. Use a regular method that returns a Promise and chain .then().");if((this.isKeyword("get")||this.isKeyword("set"))&&!this.isPunc(":",1)&&!this.isPunc(",",1)&&!this.isPunc("(",1)&&!this.isPunc("}",1)){let s=this.next().value,{key:i,computed:o}=this.parsePropertyKey(),a=this.parseMethodTail();return {key:i,computed:o,value:a,kind:s,shorthand:false}}let{key:e,computed:t,keyName:r}=this.parsePropertyKey();if(this.isPunc("(")){let s=this.parseMethodTail();return {key:e,computed:t,value:s,kind:"method",shorthand:false}}if(this.isPunc(":")){this.pos++;let s=this.parseAssignment();return {key:e,computed:t,value:s,kind:"init",shorthand:false}}if(r!==null&&!t)return {key:e,computed:t,value:{type:"Identifier",name:r},kind:"init",shorthand:true};throw new A(`Invalid object property near '${this.peek().value}'`)}parsePropertyKey(){if(this.isPunc("[")){this.pos++;let t=this.parseAssignment();return this.eatPunc("]"),{key:t,computed:true,keyName:null}}let e=this.next();if(e.type==="str")return {key:{type:"StringLiteral",value:e.value},computed:false,keyName:e.value};if(e.type==="num")return {key:{type:"StringLiteral",value:String(Number(e.value))},computed:false,keyName:null};if(e.type==="ident")return {key:{type:"StringLiteral",value:e.value},computed:false,keyName:e.value};throw new A(`Invalid property key '${e.value}'`)}parseMethodTail(){let e=this.parseParamList(),t=this.parseBlock();return {type:"ArrowFunction",params:e,body:t,expression:false}}isArrowAhead(){let e=this.peek();if(e.type==="ident"&&!An.has(e.value)&&this.isPunc("=>",1))return true;if(this.isPunc("(")){let t=0,r=this.pos;for(;r<this.tokens.length;r++){let i=this.tokens[r];if(i.type==="punc"&&i.value==="(")t++;else if(i.type==="punc"&&i.value===")"){if(t--,t===0)break}else if(i.type==="eof")return false}let s=this.tokens[r+1];return !!s&&s.type==="punc"&&s.value==="=>"}return false}parseArrow(){let e;if(this.peek().type==="ident"?e=[{type:"Identifier",name:this.next().value}]:e=this.parseParamList(),this.eatPunc("=>"),this.isPunc("{")){let r=this.parseBlock();return {type:"ArrowFunction",params:e,body:r,expression:false}}let t=this.parseAssignment();return {type:"ArrowFunction",params:e,body:t,expression:true}}parseParamList(){this.eatPunc("(");let e=[];for(;!this.isPunc(")")&&!this.atEnd()&&(e.push(this.parsePattern()),this.isPunc(","));)this.pos++;return this.eatPunc(")"),e}parsePattern(){let e;if(this.isPunc("..."))return this.pos++,{type:"RestElement",argument:this.parsePattern()};if(this.isPunc("{"))e=this.parseObjectPattern();else if(this.isPunc("["))e=this.parseArrayPattern();else {let t=this.next();if(t.type!=="ident")throw new A(`Invalid binding target '${t.value}'`);e={type:"Identifier",name:t.value};}if(this.isPunc("=")){this.pos++;let t=this.parseAssignment();return {type:"AssignmentPattern",left:e,right:t}}return e}parseObjectPattern(){this.eatPunc("{");let e=[],t=null;for(;!this.isPunc("}")&&!this.atEnd();){if(this.isPunc("...")){this.pos++,t={type:"Identifier",name:this.next().value};break}let{key:r,computed:s,keyName:i}=this.parsePropertyKey(),o;if(this.isPunc(":")?(this.pos++,o=this.parsePattern()):(o={type:"Identifier",name:i??""},this.isPunc("=")&&(this.pos++,o={type:"AssignmentPattern",left:o,right:this.parseAssignment()})),e.push({key:r,value:o,computed:s}),this.isPunc(","))this.pos++;else break}return this.eatPunc("}"),{type:"ObjectPattern",properties:e,rest:t}}parseArrayPattern(){this.eatPunc("[");let e=[],t=null;for(;!this.isPunc("]")&&!this.atEnd();){if(this.isPunc(",")){e.push(null),this.pos++;continue}if(this.isPunc("...")){this.pos++,t=this.parsePattern();break}if(e.push(this.parsePattern()),this.isPunc(","))this.pos++;else break}return this.eatPunc("]"),{type:"ArrayPattern",elements:e,rest:t}}parseTemplate(e){let t=[],r=[],s="",i=0;for(;i<e.length;)if(e[i]==="$"&&e[i+1]==="{"){t.push(s),s="",i+=2;let o=1,a="";for(;i<e.length&&o>0;){let u=e[i];if(u==="{")o++;else if(u==="}"&&(o--,o===0))break;a+=u,i++;}i++;let c=X(a,"expression").body[0];r.push(c&&c.type==="ExpressionStatement"?c.expression:{type:"UndefinedLiteral"});}else s+=e[i],i++;return t.push(s),{type:"TemplateLiteral",quasis:t,expressions:r}}},ct=new Map;function X(n,e){let t=e+"\0"+n,r=ct.get(t);if(r)return r;let s=new Oe(n),i=e==="expression"?s.parseExpressionProgram():s.parseProgram();return ct.set(t,i),i}var Q=class{constructor(e){this.value=e;}},F=class{},B=class{},E=class{constructor(e){this.parent=e;this.vars=new Map;}declare(e,t,r){this.vars.set(e,{value:t,constant:r});}find(e){let t=this;for(;t;){if(t.vars.has(e))return t;t=t.parent;}return null}has(e){return this.find(e)!==null}get(e){return this.find(e)?.vars.get(e)?.value}set(e,t){let r=this.find(e);if(!r)return false;let s=r.vars.get(e);if(s.constant)throw new TypeError(`Assignment to constant '${e}'`);return s.value=t,true}},lt=new Set(["Math","JSON","Date","Object","Array","Number","String","Boolean","parseInt","parseFloat","isNaN","isFinite","RegExp","Map","Set","WeakMap","WeakSet","Promise","Intl","console","window","document","location","navigator","history","localStorage","sessionStorage","setTimeout","clearTimeout","setInterval","clearInterval","requestAnimationFrame","cancelAnimationFrame","fetch","AbortController","Headers","Request","Response","alert","confirm","prompt","structuredClone","URL","URLSearchParams","encodeURIComponent","decodeURIComponent","NaN","Infinity"]);function Ce(n){for(let e of n)lt.add(e);}function ut(n,e){if(n!=null)return n[e]}var U=class{constructor(e){this.root=e;}run(e,t){let r=new E(null),s;try{for(let i of e.body)i.type==="ExpressionStatement"?s=this.evalExpr(i.expression,r,t):this.execStmt(i,r,t);}catch(i){if(i instanceof Q)return i.value;throw i}return s}execBlock(e,t,r){for(let s of e)this.execStmt(s,t,r);}execStmt(e,t,r){switch(e.type){case "ExpressionStatement":this.evalExpr(e.expression,t,r);return;case "BlockStatement":this.execBlock(e.body,new E(t),r);return;case "IfStatement":this.evalExpr(e.test,t,r)?this.execStmt(e.consequent,t,r):e.alternate&&this.execStmt(e.alternate,t,r);return;case "ReturnStatement":throw new Q(e.argument?this.evalExpr(e.argument,t,r):void 0);case "VariableDeclaration":for(let s of e.declarations){let i=s.init?this.evalExpr(s.init,t,r):void 0;this.bindPattern(s.id,i,t,e.kind==="const");}return;case "WhileStatement":for(;this.evalExpr(e.test,t,r);)try{this.execStmt(e.body,new E(t),r);}catch(s){if(s instanceof F)break;if(s instanceof B)continue;throw s}return;case "ForOfStatement":{let s=this.evalExpr(e.right,t,r);for(let i of s??[]){let o=new E(t);e.left.type==="VariableDeclaration"?this.bindPattern(e.left.declarations[0].id,i,o,e.left.kind==="const"):this.assignPattern(e.left,i,o,r);try{this.execStmt(e.body,o,r);}catch(a){if(a instanceof F)break;if(a instanceof B)continue;throw a}}return}case "ForStatement":{let s=new E(t);for(e.init&&(e.init.type==="VariableDeclaration"?this.execStmt(e.init,s,r):this.evalExpr(e.init,s,r));!e.test||this.evalExpr(e.test,s,r);){try{this.execStmt(e.body,new E(s),r);}catch(i){if(i instanceof F)break;if(!(i instanceof B))throw i}e.update&&this.evalExpr(e.update,s,r);}return}case "BreakStatement":throw new F;case "ContinueStatement":throw new B}}evalExpr(e,t,r){switch(e.type){case "NumberLiteral":case "StringLiteral":case "BooleanLiteral":return e.value;case "NullLiteral":return null;case "UndefinedLiteral":return;case "RegexLiteral":return new RegExp(e.pattern,e.flags);case "ThisExpression":return r;case "Identifier":return this.resolve(e.name,t);case "TemplateLiteral":{let s=e.quasis[0]??"";for(let i=0;i<e.expressions.length;i++)s+=String(this.evalExpr(e.expressions[i],t,r)??""),s+=e.quasis[i+1]??"";return s}case "ArrayExpression":{let s=[];for(let i of e.elements)i===null?s.push(void 0):i.type==="SpreadElement"?s.push(...this.evalExpr(i.argument,t,r)):s.push(this.evalExpr(i,t,r));return s}case "ObjectExpression":return this.evalObject(e,t,r);case "UnaryExpression":{let s=this.evalExpr(e.argument,t,r);switch(e.operator){case "!":return !s;case "-":return -s;case "+":return +s;case "typeof":return typeof s;case "void":return}return}case "UpdateExpression":{let s=Number(this.evalTarget(e.argument,t,r)),i=e.operator==="++"?s+1:s-1;return this.assign(e.argument,i,t,r),e.prefix?i:s}case "BinaryExpression":return this.evalBinary(e.operator,this.evalExpr(e.left,t,r),this.evalExpr(e.right,t,r));case "LogicalExpression":{let s=this.evalExpr(e.left,t,r);return e.operator==="&&"?s&&this.evalExpr(e.right,t,r):e.operator==="||"?s||this.evalExpr(e.right,t,r):s??this.evalExpr(e.right,t,r)}case "ConditionalExpression":return this.evalExpr(e.test,t,r)?this.evalExpr(e.consequent,t,r):this.evalExpr(e.alternate,t,r);case "AssignmentExpression":return this.evalAssignment(e,t,r);case "MemberExpression":{let s=this.evalExpr(e.object,t,r);if(e.optional&&s==null)return;let i=e.computed?this.evalExpr(e.property,t,r):e.property.name;return ut(s,i)}case "CallExpression":return this.evalCall(e,t,r);case "NewExpression":{let s=this.evalExpr(e.callee,t,r),i=this.evalArguments(e.arguments,t,r);if(typeof s!="function")throw new TypeError("Expression value is not a constructor");return Reflect.construct(s,i)}case "ArrowFunction":return this.makeFunction(e,t,r,false);case "SequenceExpression":{let s;for(let i of e.expressions)s=this.evalExpr(i,t,r);return s}case "SpreadElement":return this.evalExpr(e.argument,t,r)}}evalObject(e,t,r){let s={};for(let i of e.properties){if(i.type==="SpreadElement"){Object.assign(s,this.evalExpr(i.argument,t,r));continue}let o=i,a=o.computed?String(this.evalExpr(o.key,t,r)):o.key.value;if(o.kind==="get"){let c=this.makeFunction(o.value,t,r,true);Object.defineProperty(s,a,{get:c,enumerable:true,configurable:true});}else if(o.kind==="set"){let c=this.makeFunction(o.value,t,r,true);Object.defineProperty(s,a,{set:c,enumerable:true,configurable:true});}else o.kind==="method"?s[a]=this.makeFunction(o.value,t,r,true):s[a]=this.evalExpr(o.value,t,r);}return s}evalCall(e,t,r){let s,i;if(e.callee.type==="MemberExpression"){let a=e.callee,c=this.evalExpr(a.object,t,r);if(a.optional&&c==null)return;i=c;let u=a.computed?this.evalExpr(a.property,t,r):a.property.name;s=ut(c,u);}else s=this.evalExpr(e.callee,t,r);if(e.optional&&s==null)return;let o=this.evalArguments(e.arguments,t,r);if(typeof s!="function"){if(s==null)return;throw new TypeError("Expression value is not a function")}return s.apply(i,o)}evalArguments(e,t,r){let s=[];for(let i of e)i.type==="SpreadElement"?s.push(...this.evalExpr(i.argument,t,r)):s.push(this.evalExpr(i,t,r));return s}evalBinary(e,t,r){switch(e){case "+":return t+r;case "-":return t-r;case "*":return t*r;case "/":return t/r;case "%":return t%r;case "**":return t**r;case "==":return t==r;case "!=":return t!=r;case "===":return t===r;case "!==":return t!==r;case "<":return t<r;case ">":return t>r;case "<=":return t<=r;case ">=":return t>=r;case "in":return t in r;case "instanceof":return t instanceof r}}evalAssignment(e,t,r){let s=e.operator;if(s==="="){let a=this.evalExpr(e.right,t,r);return this.assign(e.left,a,t,r),a}let i=this.evalTarget(e.left,t,r),o;if(s==="&&="){if(!i)return i;o=this.evalExpr(e.right,t,r);}else if(s==="||="){if(i)return i;o=this.evalExpr(e.right,t,r);}else if(s==="??="){if(i!=null)return i;o=this.evalExpr(e.right,t,r);}else {let a=this.evalExpr(e.right,t,r);o=this.evalBinary(s.slice(0,-1),i,a);}return this.assign(e.left,o,t,r),o}evalTarget(e,t,r){return this.evalExpr(e,t,r)}assign(e,t,r,s){if(e.type==="Identifier"){r.set(e.name,t)||this.root.set(e.name,t);return}if(e.type==="MemberExpression"){let i=this.evalExpr(e.object,r,s);if(i==null)throw new TypeError("Cannot assign to a property of null or undefined");let o=e.computed?this.evalExpr(e.property,r,s):e.property.name;i[o]=t;return}throw new TypeError("Invalid assignment target")}resolve(e,t){if(t.has(e))return t.get(e);if(this.root.has(e))return this.root.get(e);if(lt.has(e))return globalThis[e]}makeFunction(e,t,r,s){let i=this;return function(...o){let a=new E(t);i.bindParams(e.params,o,a);let c=s?this:r;if(e.expression)return i.evalExpr(e.body,a,c);try{i.execBlock(e.body.body,new E(a),c);}catch(u){if(u instanceof Q)return u.value;throw u}}}bindParams(e,t,r){for(let s=0;s<e.length;s++){let i=e[s];if(i.type==="RestElement"){this.bindPattern(i.argument,t.slice(s),r,false);break}this.bindPattern(i,t[s],r,false);}}bindPattern(e,t,r,s){switch(e.type){case "Identifier":r.declare(e.name,t,s);return;case "AssignmentPattern":this.bindPattern(e.left,t===void 0?this.evalExpr(e.right,r,void 0):t,r,s);return;case "RestElement":this.bindPattern(e.argument,t,r,s);return;case "ObjectPattern":{let i=t??{},o=new Set;for(let a of e.properties){let c=a.computed?String(this.evalExpr(a.key,r,void 0)):a.key.value;o.add(c),this.bindPattern(a.value,i[c],r,s);}if(e.rest){let a={};for(let c of Object.keys(i))o.has(c)||(a[c]=i[c]);r.declare(e.rest.name,a,s);}return}case "ArrayPattern":{let i=t??[];for(let o=0;o<e.elements.length;o++){let a=e.elements[o];a&&this.bindPattern(a,i[o],r,s);}e.rest&&this.bindPattern(e.rest,i.slice(e.elements.length),r,s);return}}}assignPattern(e,t,r,s){if(e.type==="Identifier"){r.set(e.name,t)||this.root.set(e.name,t);return}this.bindPattern(e,t,r,false);}};function ie(n,e,t){let r=X(n,"expression");return new U(e).run(r,t)}function Ie(n,e,t){let r=X(n,"program");return new U(e).run(r,t)}function pt(n){let e=X(n,"expression");return (t,r)=>new U(t).run(e,r)}var Dn="https://velofy.github.io/summit";function Mn(n,e){let t=n.length,r=e.length;if(!t)return r;if(!r)return t;let s=Array.from({length:r+1},(i,o)=>o);for(let i=1;i<=t;i++){let o=[i];for(let a=1;a<=r;a++){let c=n[i-1]===e[a-1]?0:1;o[a]=Math.min(s[a]+1,o[a-1]+1,s[a-1]+c);}s=o;}return s[r]}function dt(n,e){let t=null,r=1/0;for(let i of e){let o=Mn(n,i);o<r&&(r=o,t=i);}let s=n.length<=4?1:2;return t!==null&&r<=s?t:null}function Ln(n){let e=n.tagName.toLowerCase(),t=n.id?`#${n.id}`:"",r=n.classList.length?"."+Array.from(n.classList).slice(0,2).join("."):"";return `<${e}${t}${r}>`}function oe(n,e,t){let r=[`[summit] ${n}: ${e}`];return t.hint&&r.push(` ${t.hint}`),t.expression&&r.push(` expression: ${t.expression.trim()}`),t.el&&r.push(` element: ${Ln(t.el)}`),r.push(` docs: ${Dn}/${t.doc?t.doc+"/":""}`),r.join(`
5
+ `)}function $(n,e,t={}){t.cause!==void 0?console.warn(oe(n,e,t),`
6
+ `,t.cause):console.warn(oe(n,e,t));}function x(n,e,t={}){t.cause!==void 0?console.error(oe(n,e,t),`
7
+ `,t.cause):console.error(oe(n,e,t));}var ft=new Set;function mt(n,e,t,r={}){ft.has(n)||(ft.add(n),$(e,t,r));}var W=new WeakMap;function R(n){let e=W.get(n);return e||W.set(n,e={}),e}var jn=0;function ht(){return ++jn}function k(n,e){let t=R(n);(t.cleanups??(t.cleanups=[])).push(e);}function vt(n){let e=W.get(n);if(e){if(e.cleanups){for(let t of e.cleanups)try{t();}catch(r){x("E601","a cleanup callback threw during teardown.",{doc:"lifecycle",cause:r});}e.cleanups=[];}if(e.destroyCallbacks){for(let t of e.destroyCallbacks)try{t();}catch(r){x("E602","a destroy() callback threw during teardown.",{doc:"lifecycle",cause:r});}e.destroyCallbacks=[];}}}function ae(n){let e=W.get(n)?.scopes;if(e)return e;let t=n.parentElement;for(;t;){let r=W.get(t)?.scopes;if(r)return r;t=t.parentElement;}return []}function $e(n){let e=n;for(;e;){if(W.get(e)?.isRoot)return e;e=e.parentElement;}return null}function ce(n){let e=$e(n)??n,t=R(e);return t.refs??(t.refs={})}var yt=36;function D(n,e){let t=ae(n),r=t.length?t[t.length-1]:void 0,s={el:n,scopes:t,evaluate:o=>ie(o,i,r),effect:o=>{let a=T(o);k(n,a);},cleanup:o=>k(n,o)},i={has(o){if(e&&o in e)return true;for(let a=t.length-1;a>=0;a--)if(o in t[a])return true;return !!(o.charCodeAt(0)===yt&&se(o.slice(1)))},get(o){if(e&&o in e)return e[o];for(let a=t.length-1;a>=0;a--)if(o in t[a])return t[a][o];if(o.charCodeAt(0)===yt){let a=se(o.slice(1));if(a)return a(s)}},set(o,a){for(let c=t.length-1;c>=0;c--)if(o in t[c]){t[c][o]=a;return}t.length&&(t[t.length-1][o]=a);}};return {env:i,thisVal:r,evaluate:o=>ie(o,i,r),evaluateAction:(o,a)=>a?Ie(o,{has:u=>u in a?true:i.has(u),get:u=>u in a?a[u]:i.get(u),set:(u,f)=>i.set(u,f)},r):Ie(o,i,r)}}function He(n,e,t){let r={el:e,scopes:t,evaluate:s=>ie(s,D(e).env,t.length?t[t.length-1]:void 0),effect:s=>k(e,T(s)),cleanup:s=>k(e,s)};for(let s of nt())Object.defineProperty(n,"$"+s,{get:()=>se(s)(r),enumerable:false,configurable:true});}function gt(n,e){let t=n;if(t[0]==="@")t="on:"+t.slice(1);else if(t[0]===":")t="bind:"+t.slice(1);else if(t.startsWith("s-"))t=t.slice(2);else return null;let r=t.split("."),s=r[0],i=r.slice(1),o=s.indexOf(":"),a,c;return o===-1?(a=s,c=null):(a=s.slice(0,o),c=s.slice(o+1)),{name:a,value:c,modifiers:i,expression:e,raw:n}}var xt="__summitPersist";function bt(n){return {[xt]:true,initial:n,key:null,as(e){return this.key=String(e),this}}}function wt(n){return !!n&&typeof n=="object"&&n[xt]===true}var On=new Set(["if","for","teleport"]),Et=new Set(["data","ignore"]),St;function Ke(n){St=n;}function Cn(n){let e=[];for(let t of Array.from(n.attributes)){let r=gt(t.name,t.value);if(r)if(Et.has(r.name)||re(r.name))e.push(r);else {let s=dt(r.name,[...tt(),...Et]);mt(`dir:${r.name}`,"E201",`unknown directive "${t.name}".`,{el:n,doc:s?`s-${s}`:"start",hint:s?`Did you mean "s-${s}"?`:"See the directive reference."});}}return e}function kt(n){return re(n)?.priority??De}function In(n,e){let t=D(n);return {evaluate:r=>t.evaluate(r),evaluateAction:(r,s)=>t.evaluateAction(r,s),effect:r=>{let s=T(r);k(n,s);},cleanup:r=>k(n,r),initTree:M,destroyTree:H,scopes:e,makeEnv:(r,s)=>D(r,s).env,Summit:St}}function Pt(n,e,t){let r=re(e.name);if(r)try{r.handler(n,e,In(n,t));}catch(s){x("E301",`s-${e.name} failed while evaluating its expression.`,{el:n,expression:e.expression,doc:`s-${e.name}`,hint:"Every name in the expression must be state from an enclosing s-data, or an allowed global.",cause:s});}}var $n=/^([A-Za-z_$][\w$]*)\s*(\(([\s\S]*)\))?$/;function Hn(n,e){let t=typeof localStorage<"u";for(let r of Object.keys(n)){let s=n[r];if(!wt(s))continue;let i=s.key??r,o=s.initial;if(t)try{let a=localStorage.getItem(i);a!=null&&(o=JSON.parse(a));}catch{}if(n[r]=o,t){let a=T(()=>{try{localStorage.setItem(i,JSON.stringify(n[r]));}catch{}});k(e,a);}}}function Kn(n,e,t){let r=D(n),s=e.expression.trim(),i;try{let l=s.match($n);if(l&&Me(l[1])){let d=Me(l[1]),m=l[2]?r.evaluate("["+(l[3]??"")+"]"):[];i=d(...m);}else s===""?i={}:i=r.evaluate("("+s+")");}catch(l){x("E104","s-data could not be evaluated; the component starts with empty state.",{el:n,expression:s,doc:"s-data",hint:"Check the object for unsupported syntax, e.g. an async method.",cause:l}),i={};}(i===null||typeof i!="object")&&(i={});let o=Y(i);Hn(o,n);let a=[...t,o],c=R(n);c.scopes=a,c.isRoot=true,c.refs={},He(i,n,a);let u=o.init;if(typeof u=="function")try{u();}catch(l){x("E101","s-data init() threw.",{el:n,doc:"s-data",cause:l});}let f=o.destroy;return typeof f=="function"&&k(n,()=>{try{f();}catch(l){x("E102","s-data destroy() threw.",{el:n,doc:"s-data",cause:l});}}),a}function M(n,e){let t=R(n);if(t.initialized||t.ignore)return;if(n.hasAttribute("s-ignore")){t.ignore=true,t.initialized=true;return}let r=e??ae(n);t.scopes=r,t.marker=ht();let s=Cn(n),i=s.find(c=>c.name==="data");i&&(r=Kn(n,i,r));let o=s.find(c=>On.has(c.name));if(o){t.initialized=true,Pt(n,o,r);return}let a=s.filter(c=>c.name!=="data").sort((c,u)=>kt(c.name)-kt(u.name));for(let c of a)Pt(n,c,r);t.initialized=true;for(let c of Array.from(n.children))M(c,r);}function H(n){vt(n);for(let e of Array.from(n.children))H(e);R(n).initialized=false;}var Ne=null;function Fe(n){Ne||(Ne=new MutationObserver(Nn),Ne.observe(n,{childList:true,subtree:true}));}function Nn(n){let e=[],t=[];for(let r of n)r.type==="childList"&&(r.removedNodes.forEach(s=>{s.nodeType===1&&e.push(s);}),r.addedNodes.forEach(s=>{s.nodeType===1&&t.push(s);}));for(let r of e)r.isConnected||H(r);for(let r of t)r.isConnected&&!R(r).initialized&&M(r);}function At(n){return n==null?"":String(n)}var Tt=(n,e,t)=>{t.effect(()=>{n.textContent=At(t.evaluate(e.expression));});},Rt=(n,e,t)=>{t.effect(()=>{n.innerHTML=At(t.evaluate(e.expression));let r=n.firstElementChild;for(;r;)t.initTree(r,t.scopes),r=r.nextElementSibling;});};var Fn=new Set(["disabled","checked","required","readonly","hidden","selected","open","multiple","autofocus","novalidate","autoplay","controls","loop","muted","playsinline","default","ismap","reversed","async","defer","inert"]),Bn=new Set(["value","checked","selected","indeterminate","muted","volume"]);function ue(n){return n.replace(/-([a-z])/g,(e,t)=>t.toUpperCase())}function Be(n){return n.replace(/[A-Z]/g,e=>"-"+e.toLowerCase())}function Dt(n){return n?typeof n=="string"?n.split(/\s+/).filter(Boolean):Array.isArray(n)?n.flatMap(e=>Dt(e)):typeof n=="object"?Object.entries(n).filter(([,e])=>e).map(([e])=>e):[]:[]}function Mt(n,e){let t=new Set;for(let r of n.split(/\s+/))r&&t.add(r);for(let r of Dt(e))t.add(r);return [...t].join(" ")}function Lt(n,e){let t=[];if(n&&t.push(n.trim().replace(/;?\s*$/,"")),typeof e=="string")t.push(e.trim().replace(/;?\s*$/,""));else if(e&&typeof e=="object")for(let[r,s]of Object.entries(e))s==null||s===false||t.push(`${Be(r)}: ${String(s)}`);return t.filter(Boolean).join("; ")}function le(n,e,t){if(Fn.has(e)){t?n.setAttribute(e,""):n.removeAttribute(e),e in n&&(n[e]=!!t);return}if(Bn.has(e)&&e in n){n[e]=t;return}t===false||t==null?n.removeAttribute(e):n.setAttribute(e,String(t));}var jt=(n,e,t)=>{if(e.value===null){Un(n,e.expression,t);return}let r=e.modifiers.includes("camel")?ue(e.value):e.value;if(r==="class"){let s=n.getAttribute("class")??"";t.effect(()=>{n.setAttribute("class",Mt(s,t.evaluate(e.expression)));});return}if(r==="style"){let s=n.getAttribute("style")??"";t.effect(()=>{let i=Lt(s,t.evaluate(e.expression));i?n.setAttribute("style",i):n.removeAttribute("style");});return}t.effect(()=>{le(n,r,t.evaluate(e.expression));});};function Un(n,e,t){let r=t.evaluate(e);if(!(!r||typeof r!="object"))for(let[s,i]of Object.entries(r))if(s[0]==="@"){let o=s.slice(1),a=i;n.addEventListener(o,a),t.cleanup(()=>n.removeEventListener(o,a));}else if(s[0]===":"){let o=s.slice(1),a=i;t.effect(()=>le(n,o,typeof a=="function"?a():a));}else le(n,s,i);}var Wn=new Set(["shift","ctrl","alt","cmd","meta"]),zn=new Set(["prevent","stop","self","outside","once","capture","passive","window","document","camel","dot","debounce","throttle"]),Gn={enter:"Enter",tab:"Tab",space:" ",esc:"Escape",escape:"Escape",up:"ArrowUp",down:"ArrowDown",left:"ArrowLeft",right:"ArrowRight","arrow-up":"ArrowUp","arrow-down":"ArrowDown","arrow-left":"ArrowLeft","arrow-right":"ArrowRight","page-up":"PageUp","page-down":"PageDown",home:"Home",end:"End",delete:"Delete",backspace:"Backspace"};function Ct(n){return /^\d+(ms|s)?$/.test(n)}function qn(n){return n.endsWith("ms")?parseInt(n,10):n.endsWith("s")?parseInt(n,10)*1e3:parseInt(n,10)}function Ot(n,e){let t=n.indexOf(e);if(t===-1)return null;let r=n[t+1];return r&&Ct(r)?qn(r):250}function _n(n,e){let t=n.key;if(!t)return false;let r=Gn[e];return r?t===r:Be(t).toLowerCase()===e.toLowerCase()||t.toLowerCase()===e.toLowerCase()}function Jn(n,e){let t=n;return !(e.includes("shift")&&!t.shiftKey||e.includes("ctrl")&&!t.ctrlKey||e.includes("alt")&&!t.altKey||(e.includes("cmd")||e.includes("meta"))&&!t.metaKey)}function Yn(n,e){let t;return r=>{clearTimeout(t),t=setTimeout(()=>n(r),e);}}function Zn(n,e){let t=0,r;return s=>{let i=Date.now(),o=e-(i-t);o<=0?(t=i,n(s)):r||(r=setTimeout(()=>{t=Date.now(),r=void 0,n(s);},o));}}var It=(n,e,t)=>{let r=e.modifiers,s=e.value??"";r.includes("camel")&&(s=ue(s)),r.includes("dot")&&(s=s.replace(/-/g,"."));let i=r.filter(d=>!Wn.has(d)&&!zn.has(d)&&!Ct(d)),o=r.includes("window")?window:r.includes("document")||r.includes("outside")?document:n,a={};r.includes("capture")&&(a.capture=true),r.includes("passive")&&(a.passive=true),r.includes("once")&&(a.once=true);let c=d=>{if(!(r.includes("self")&&d.target!==n)){if(r.includes("outside")){let m=d.target;if(n===m||n.contains(m)||!document.documentElement.contains(m))return}if(!(i.length&&!i.some(m=>_n(d,m)))&&Jn(d,r)){r.includes("prevent")&&d.preventDefault(),r.includes("stop")&&d.stopPropagation();try{let m=t.evaluateAction(e.expression,{$event:d});typeof m=="function"&&m(d);}catch(m){x("E301",`@${s} handler failed while evaluating its expression.`,{el:n,expression:e.expression,doc:"s-on",hint:"Names must be state from an enclosing s-data, a $magic, or an allowed global.",cause:m});}}}},u=Ot(r,"debounce"),f=Ot(r,"throttle"),l=c;u!=null?l=Yn(c,u):f!=null&&(l=Zn(c,f)),o.addEventListener(s,l,a),t.cleanup(()=>o.removeEventListener(s,l,a));};function Ue(n,e){if(e.includes("number")){let t=parseFloat(n);return isNaN(t)?n:t}return e.includes("boolean")?n==="true"?true:n==="false"?false:!!n:n}function Xn(n,e){let t;return ()=>{clearTimeout(t),t=setTimeout(n,e);}}function Qn(n,e){let t=n.indexOf(e);if(t===-1)return null;let r=n[t+1];return r&&/^\d+(ms|s)?$/.test(r)?r.endsWith("s")&&!r.endsWith("ms")?parseInt(r,10)*1e3:parseInt(r,10):250}var $t=(n,e,t)=>{let r=n,s=n,i=e.modifiers,o=e.expression,a=r.type,c=n.tagName,u=()=>t.evaluate(o),f=p=>{t.evaluateAction(o+" = $model",{$model:p});};if(i.includes("fill")){let p=u();(p==null||p==="")&&f(Ue(r.value??r.getAttribute("value")??"",i));}let l=()=>{if(a==="checkbox"){let p=u();if(Array.isArray(p)){let v=new Set(p);return r.checked?v.add(r.value):v.delete(r.value),[...v]}return r.checked}return a==="radio"?Ue(r.value,i):c==="SELECT"&&s.multiple?Array.from(s.selectedOptions).map(p=>p.value):Ue(r.value,i)},d=p=>{if(a==="checkbox"){r.checked=Array.isArray(p)?p.map(String).includes(r.value):!!p;return}if(a==="radio"){r.checked=String(p)===r.value;return}if(c==="SELECT"&&s.multiple){let z=new Set(p?.map(String)??[]);for(let N of Array.from(s.options))N.selected=z.has(N.value);return}let v=p==null?"":String(p);r.value!==v&&(r.value=v);};t.effect(()=>d(u()));let m="input";(c==="SELECT"||a==="checkbox"||a==="radio")&&(m="change"),(i.includes("lazy")||i.includes("change"))&&(m="change"),i.includes("blur")&&(m="blur");let P=()=>f(l()),K=Qn(i,"debounce");K!=null&&(P=Xn(P,K)),n.addEventListener(m,P),t.cleanup(()=>n.removeEventListener(m,P)),n._summitModel={get:u,set:f};};var V=new WeakMap;function Vn(n){let e=V.get(n);return e||V.set(n,e={classMode:false}),e}function Kt(n){return V.has(n)}function b(n){return n?n.split(/\s+/).filter(Boolean):[]}function Ht(n,e){let t=n.indexOf(e);if(t===-1)return;let r=n[t+1];if(r)return r.endsWith("ms")?parseInt(r,10):r.endsWith("s")?parseInt(r,10)*1e3:parseInt(r,10)}var Nt=(n,e)=>{let t=Vn(n),r=e.modifiers;if(e.value){t.classMode=true;let s=e.value,i={enter:"enter","enter-start":"enterStart","enter-end":"enterEnd",leave:"leave","leave-start":"leaveStart","leave-end":"leaveEnd"};t[i[s]]=e.expression;return}if(t.duration=Ht(r,"duration")??t.duration,t.delay=Ht(r,"delay")??t.delay,r.includes("opacity")&&(t.opacity=true),r.includes("scale")){let s=r.indexOf("scale"),i=r[s+1];t.scale=i&&/^\d+$/.test(i)?parseInt(i,10)/100:.95;}!r.includes("opacity")&&t.scale===void 0&&(t.opacity=true,t.scale=.95);};function Ft(n,e,t){let r=getComputedStyle(n).transitionDuration,s=r&&r!=="0s"?parseFloat(r)*1e3:e;s<=0?requestAnimationFrame(()=>t()):setTimeout(t,s);}function Bt(n,e){let t=V.get(n);if(!t){return}if(t.classMode){n.classList.add(...b(t.enter),...b(t.enterStart)),requestAnimationFrame(()=>{n.classList.remove(...b(t.enterStart)),n.classList.add(...b(t.enterEnd)),Ft(n,t.duration??150,()=>{n.classList.remove(...b(t.enter),...b(t.enterEnd));});});return}let r=t.duration??150;n.style.transition="none",t.opacity&&(n.style.opacity="0"),t.scale!==void 0&&(n.style.transform=`scale(${t.scale})`),requestAnimationFrame(()=>{n.style.transition=`all ${r}ms ease-out ${t.delay??0}ms`,t.opacity&&(n.style.opacity="1"),t.scale!==void 0&&(n.style.transform="scale(1)"),setTimeout(()=>{n.style.removeProperty("transition"),n.style.removeProperty("opacity"),n.style.removeProperty("transform");},r+(t.delay??0));});}function Ut(n,e){let t=V.get(n);if(!t){e();return}if(t.classMode){n.classList.add(...b(t.leave),...b(t.leaveStart)),requestAnimationFrame(()=>{n.classList.remove(...b(t.leaveStart)),n.classList.add(...b(t.leaveEnd)),Ft(n,t.duration??150,()=>{n.classList.remove(...b(t.leave),...b(t.leaveEnd)),e();});});return}let r=t.duration??150;n.style.transition=`all ${r}ms ease-in ${t.delay??0}ms`,requestAnimationFrame(()=>{t.opacity&&(n.style.opacity="0"),t.scale!==void 0&&(n.style.transform=`scale(${t.scale})`),setTimeout(()=>{n.style.removeProperty("transition"),n.style.removeProperty("opacity"),n.style.removeProperty("transform"),e();},r+(t.delay??0));});}var Wt=(n,e,t)=>{let r=n,s=e.modifiers.includes("important"),i=r.style.display==="none"?"":r.style.display,o=()=>{i?r.style.display=i:r.style.removeProperty("display");},a=()=>{s?r.style.setProperty("display","none","important"):r.style.setProperty("display","none");},c=true;t.effect(()=>{let u=!!t.evaluate(e.expression),f=Kt(n)&&!c;if(c=false,!f){u?o():a();return}u?(o(),Bt(r)):Ut(r,a);});};var zt=(n,e,t)=>{let r=n.parentNode;if(!r)return;let s=document.createComment("s-if");r.insertBefore(s,n);let i;if(n.tagName==="TEMPLATE")i=Array.from(n.content.children).map(u=>u.cloneNode(true));else {let u=n.cloneNode(true);u.removeAttribute(e.raw),i=[u];}if(n.remove(),!i.length)return;let o=t.scopes,a=[],c=()=>{for(let u of a)t.destroyTree(u),u.remove();a=[];};t.effect(()=>{let u=!!t.evaluate(e.expression);if(u&&!a.length){let f=i.map(d=>d.cloneNode(true)),l=document.createDocumentFragment();for(let d of f)l.appendChild(d);s.parentNode?.insertBefore(l,s.nextSibling);for(let d of f)t.initTree(d,o);a=f;}else !u&&a.length&&c();}),t.cleanup(c);};var Gt=/^\s*(.+?)\s+(?:in|of)\s+([\s\S]+)$/;function er(n){let e=n.trim();if(e.startsWith("(")){let r=e.slice(1,-1).split(",").map(s=>s.trim());return {item:r[0],index:r[1]??null}}return {item:e,index:null}}function tr(n){return typeof n=="number"?Array.from({length:n},(e,t)=>({value:t+1,index:t})):Array.isArray(n)?n.map((e,t)=>({value:e,index:t})):n&&typeof n=="object"?Object.entries(n).map(([e,t],r)=>({value:t,index:r,objectKey:e})):[]}var qt=(n,e,t)=>{if(n.tagName!=="TEMPLATE"){$("E401","s-for must be used on a <template> element.",{el:n,doc:"s-for",hint:`Wrap the repeated markup: <template s-for="${e.expression}"><li>...</li></template>`});return}let r=n.parentNode;if(!r)return;let s=n.content.firstElementChild;if(!s){$("E402","s-for <template> needs exactly one root element.",{el:n,doc:"s-for"});return}let{item:i,index:o}=er(e.expression.replace(Gt,"$1")),a=e.expression.replace(Gt,"$2"),c=n.getAttribute(":key")??n.getAttribute("s-bind:key"),u=document.createComment("s-for");r.insertBefore(u,n),n.remove();let f=t.scopes,l=new Map,d=c?pt(c):null,m=p=>{if(!d)return p.objectKey??p.index;let v={[i]:p.value};o&&(v[o]=p.objectKey??p.index);try{return d(D(n,v).env)}catch{return p.index}},P=p=>{let v={[i]:p.value};return o&&(v[o]=p.objectKey??p.index),w(v)},K=()=>{for(let p of l.values())t.destroyTree(p.node),p.node.remove();l.clear();};t.effect(()=>{let p=tr(t.evaluate(a)),v=new Map,z=[];for(let g of p){let S=m(g);z.push(S);let te=l.get(S);if(te)te.scope[i]=g.value,o&&(te.scope[o]=g.objectKey??g.index),v.set(S,te),l.delete(S);else {let qe=P(g),fe=s.cloneNode(true);r.insertBefore(fe,u),t.initTree(fe,[...f,qe]),v.set(S,{node:fe,scope:qe});}}for(let g of l.values())t.destroyTree(g.node),g.node.remove();let N=u;for(let g=z.length-1;g>=0;g--){let S=v.get(z[g]).node;S.nextSibling!==N&&r.insertBefore(S,N),N=S;}l=v;}),t.cleanup(K);};var _t=(n,e,t)=>{if(n.tagName!=="TEMPLATE"){$("E501","s-teleport must be used on a <template> element.",{el:n,doc:"s-teleport"});return}let r=e.expression||e.value||"",s=r?document.querySelector(r):null;if(!s){$("E502",`s-teleport target not found: "${r}".`,{el:n,doc:"s-teleport",hint:"The target must be a CSS selector that already exists in the DOM, e.g. body."});return}let i=n.content,o=Array.from(i.children).map(c=>c.cloneNode(true)),a=document.createDocumentFragment();for(let c of o)a.appendChild(c);e.modifiers.includes("prepend")?s.parentNode?.insertBefore(a,s):e.modifiers.includes("append")?s.parentNode?.insertBefore(a,s.nextSibling):s.appendChild(a);for(let c of o)t.initTree(c,t.scopes);t.cleanup(()=>{for(let c of o)t.destroyTree(c),c.remove();});};var Jt=0,We=new WeakMap;function Yt(n,e){let t=We.get(n);t||We.set(n,t=new Map);for(let r of e)t.set(r,++Jt);}function Zt(n,e,t){let r=n;for(;r;){let i=We.get(r);if(i&&i.has(e)){let o=`${e}-${i.get(e)}`;return t!=null?`${o}-${t}`:o}r=r.parentElement;}let s=`${e}-${++Jt}`;return t!=null?`${s}-${t}`:s}var Xt=(n,e,t)=>{t.evaluateAction(e.expression);},Qt=(n,e,t)=>{t.effect(()=>{t.evaluateAction(e.expression);});},Vt=(n,e,t)=>{let r=t.evaluate(e.expression),s=typeof r=="string"&&r?r:e.expression.trim(),i=ce(n);i[s]=n,t.cleanup(()=>{i[s]===n&&delete i[s];});},en=(n,e,t)=>{let r=t.evaluate(e.expression);Array.isArray(r)&&Yt(n,r.map(String));},tn=n=>{n.removeAttribute("s-cloak");};var nn=(n,e,t)=>{if(typeof IntersectionObserver>"u")return;let r=e.value==="leave",s=e.modifiers.includes("full")?.99:e.modifiers.includes("half")?.5:0,i=e.modifiers.includes("once"),o=new IntersectionObserver(a=>{for(let c of a)(r?!c.isIntersecting:c.isIntersecting)&&(t.evaluateAction(e.expression),i&&o.disconnect());},{threshold:s});o.observe(n),t.cleanup(()=>o.disconnect());},rn=(n,e,t)=>{if(typeof ResizeObserver>"u")return;let r=new ResizeObserver(s=>{let i=s[0]?.contentRect;t.evaluateAction(e.expression,{$width:i?.width??0,$height:i?.height??0});});r.observe(n),t.cleanup(()=>r.disconnect());};var nr=["a[href]","button:not([disabled])","input:not([disabled]):not([type=hidden])","select:not([disabled])","textarea:not([disabled])","[tabindex]:not([tabindex='-1'])","[contenteditable]"].join(",");function rr(n){let e=n.getBoundingClientRect();return e.width===0&&e.height===0?n.offsetParent!==null||typeof n.offsetParent>"u":true}function ee(n){return Array.from(n.querySelectorAll(nr)).filter(rr)}var sn=(n,e,t)=>{let r=false,s=null,i=c=>{if(c.key!=="Tab")return;let u=ee(n);if(!u.length){c.preventDefault();return}let f=u[0],l=u[u.length-1],d=document.activeElement;c.shiftKey&&(d===f||!n.contains(d))?(c.preventDefault(),l.focus()):!c.shiftKey&&d===l&&(c.preventDefault(),f.focus());},o=()=>{if(r)return;r=true,s=document.activeElement,document.addEventListener("keydown",i,true);let c=()=>{(ee(n)[0]??n).focus?.();};typeof requestAnimationFrame=="function"?requestAnimationFrame(c):c();},a=()=>{r&&(r=false,document.removeEventListener("keydown",i,true),s?.focus?.());};t.effect(()=>{t.evaluate(e.expression)?o():a();}),t.cleanup(a);};var on=(n,e,t)=>{let r=e.modifiers,s=r.includes("top")?"top":"bottom",i=r.includes("end")?"end":r.includes("center")?"center":"start",o=r.indexOf("offset"),a=o>=0&&/^\d+$/.test(r[o+1]??"")?Number(r[o+1]):8,c=n;c.style.position="fixed",c.style.zIndex||(c.style.zIndex="50"),c.style.margin="0";let u=null,f=()=>{if(!u||typeof window>"u")return;let l=u.getBoundingClientRect(),d=c.offsetWidth,m=c.offsetHeight,P=window.innerHeight,K=window.innerWidth,p=s==="top"?l.top-m-a:l.bottom+a;s==="bottom"&&p+m>P&&l.top-m-a>=0&&(p=l.top-m-a),s==="top"&&p<0&&l.bottom+a+m<=P&&(p=l.bottom+a);let v=i==="end"?l.right-d:i==="center"?l.left+l.width/2-d/2:l.left;v=Math.max(8,Math.min(v,K-d-8)),c.style.top=`${Math.round(p)}px`,c.style.left=`${Math.round(v)}px`;};if(t.effect(()=>{let l=t.evaluate(e.expression);u=l&&typeof l.getBoundingClientRect=="function"?l:null,u&&f();}),typeof window<"u"){let l=()=>f();window.addEventListener("scroll",l,true),window.addEventListener("resize",l),t.cleanup(()=>{window.removeEventListener("scroll",l,true),window.removeEventListener("resize",l);});}};var an=(n,e,t)=>{let r=n;r.style.overflow="hidden";let s=true;t.effect(()=>{let i=!!t.evaluate(e.expression);if(s){s=false,r.style.height=i?"auto":"0px",i||r.setAttribute("hidden","until-found");return}r.removeAttribute("hidden");let o=r.getBoundingClientRect().height;r.style.height=`${o}px`;let a=i?r.scrollHeight:0,c=()=>{r.style.transition="height 250ms ease",r.style.height=`${a}px`;};typeof requestAnimationFrame=="function"?requestAnimationFrame(c):c();let u=()=>{r.style.transition="",i&&(r.style.height="auto"),r.removeEventListener("transitionend",u);};r.addEventListener("transitionend",u);});};function sr(n,e){return n==="9"?/\d/.test(e):n==="a"?/[a-zA-Z]/.test(e):n==="*"?/[a-zA-Z0-9]/.test(e):false}function ir(n,e){let t="",r=0;for(let s of e){if(r>=n.length)break;if(s==="9"||s==="a"||s==="*")for(;r<n.length;){let i=n[r++];if(sr(s,i)){t+=i;break}}else t+=s,n[r]===s&&r++;}return t}var cn=(n,e,t)=>{let r=n,s=String(t.evaluate(e.expression)??e.expression),i=()=>{r.value=ir(r.value,s);};r.addEventListener("input",i),r.value&&i(),t.cleanup(()=>r.removeEventListener("input",i));};function un(){h("ref",Vt,10),h("id",en,15),h("if",zt,20),h("for",qt,20),h("teleport",_t,20),h("bind",jt,50),h("mask",cn,55),h("model",$t,60),h("on",It,70),h("text",Tt,80),h("html",Rt,80),h("transition",Nt,85),h("anchor",on,88),h("collapse",an,89),h("show",Wt,90),h("trap",sn,95),h("effect",Qt,100),h("intersect",nn,100),h("resize",rn,100),h("init",Xt,200),h("cloak",tn,1e3);}function ze(n){let e=()=>ee(n),t=r=>{let s=e();if(!s.length)return;let i=s.indexOf(document.activeElement),o=i===-1?0:(i+r+s.length)%s.length;s[o]?.focus();};return {focus(r){r?.focus?.();},first(){e()[0]?.focus();},last(){let r=e();r[r.length-1]?.focus();},next(){t(1);},previous(){t(-1);},within(r){return ze(r)}}}function ln(){y("el",n=>n.el),y("refs",n=>ce(n.el)),y("root",n=>$e(n.el)),y("data",n=>n.scopes.length?n.scopes[n.scopes.length-1]:{}),y("store",()=>st()),y("watch",n=>(e,t)=>{let r,s=true,i=T(()=>{let o=n.evaluate(e);if(s){r=o,s=false;return}if(Object.is(o,r))return;let a=r;r=o,t(o,a);});return n.cleanup(i),i}),y("dispatch",n=>(e,t,r={})=>{let s=new CustomEvent(e,{detail:t,bubbles:true,composed:true,cancelable:true,...r});return n.el.dispatchEvent(s)}),y("nextTick",()=>n=>J(n)),y("id",n=>(e,t)=>Zt(n.el,e,t)),y("persist",()=>n=>bt(n)),y("focus",n=>ze(n.el));}var or="0.1.0",Ge=false;function pn(n){typeof document<"u"&&document.dispatchEvent(new CustomEvent(n));}function ar(n){if(Ge)return;Ge=true;let e=n??(typeof document<"u"?document.body:void 0);e&&(pn("summit:init"),M(e),Fe(e.ownerDocument?.body??e),pn("summit:initialized"));}var fn={version:or,started:()=>Ge,start:ar,data(n,e){return rt(n,e),this},directive(n,e,t){return h(n,e,t),this},magic(n,e){return y(n,e),this},bind(n,e){return it(n,e),this},store(n,e){if(e===void 0)return je(n);if(e!==null&&typeof e=="object"){let t=Y(e);Le(n,t);let r=t.init;if(typeof r=="function")try{r();}catch(s){x("E103",`store "${n}" init() threw.`,{doc:"globals-store",cause:s});}return t}return Le(n,e),je(n)},plugin(n){return n(this),this},addGlobals(n){return Ce(n),this},getBind:ot,signal:ve,computed:q,effect:j,reactive:w,batch:he,nextTick:J,initTree:M,destroyTree:H};un();ln();Ke(fn);var pe=fn;window.Summit=pe;function dn(){pe.start();}document.readyState==="loading"?document.addEventListener("DOMContentLoaded",dn,{once:true}):dn();var Ai=pe;return Ai;})();//# sourceMappingURL=summit.min.js.map
8
8
  //# sourceMappingURL=summit.min.global.js.map