@lokascript/hyperscript-adapter 2.0.0 → 2.2.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.
- package/README.md +46 -3
- package/dist/hyperscript-i18n-ar.global.js +4 -4
- package/dist/hyperscript-i18n-bn.global.js +4 -4
- package/dist/hyperscript-i18n-de.global.js +4 -4
- package/dist/hyperscript-i18n-east-asian.global.js +4 -4
- package/dist/hyperscript-i18n-en.global.js +6 -6
- package/dist/hyperscript-i18n-es.global.js +4 -4
- package/dist/hyperscript-i18n-fr.global.js +4 -4
- package/dist/hyperscript-i18n-he.global.js +4 -4
- package/dist/hyperscript-i18n-hi.global.js +4 -4
- package/dist/hyperscript-i18n-id.global.js +4 -4
- package/dist/hyperscript-i18n-it.global.js +4 -4
- package/dist/hyperscript-i18n-ja.global.js +4 -4
- package/dist/hyperscript-i18n-ko.global.js +4 -4
- package/dist/hyperscript-i18n-ms.global.js +4 -4
- package/dist/hyperscript-i18n-pl.global.js +4 -4
- package/dist/hyperscript-i18n-pt.global.js +4 -4
- package/dist/hyperscript-i18n-qu.global.js +4 -4
- package/dist/hyperscript-i18n-ru.global.js +4 -4
- package/dist/hyperscript-i18n-slavic.global.js +4 -4
- package/dist/hyperscript-i18n-south-asian.global.js +4 -4
- package/dist/hyperscript-i18n-southeast-asian.global.js +4 -4
- package/dist/hyperscript-i18n-sw.global.js +4 -4
- package/dist/hyperscript-i18n-th.global.js +4 -4
- package/dist/hyperscript-i18n-tl.global.js +4 -4
- package/dist/hyperscript-i18n-tr.global.js +4 -4
- package/dist/hyperscript-i18n-uk.global.js +4 -4
- package/dist/hyperscript-i18n-vi.global.js +4 -4
- package/dist/hyperscript-i18n-western.global.js +4 -4
- package/dist/hyperscript-i18n-zh.global.js +4 -4
- package/dist/hyperscript-i18n.global.js +73 -7
- package/dist/hyperscript-i18n.global.js.map +1 -1
- package/package.json +1 -1
- package/src/hyperscript-renderer.ts +3 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var HyperscriptI18n=(function(exports){'use strict';var tr=new Map,rr=new Map,nr=new Map;function ir(t,e,n){tr.set(t,e),rr.set(t,n),nr.delete(t);}var or=class{constructor(t,e){this.pos=0,this.tokens=t,this.language=e;}peek(t=0){let e=this.pos+t;return e<0||e>=this.tokens.length?null:this.tokens[e]}advance(){if(this.isAtEnd())throw new Error("Unexpected end of token stream");return this.tokens[this.pos++]}isAtEnd(){return this.pos>=this.tokens.length}mark(){return {position:this.pos}}reset(t){this.pos=t.position;}position(){return this.pos}remaining(){return this.tokens.slice(this.pos)}takeWhile(t){let e=[];for(;!this.isAtEnd()&&t(this.peek());)e.push(this.advance());return e}skipWhile(t){for(;!this.isAtEnd()&&t(this.peek());)this.advance();}};function g(t,e){return {start:t,end:e}}function w(t,e,n,r){if(typeof r=="string")return {value:t,kind:e,position:n,normalized:r};if(r){let{normalized:i,stem:o,stemConfidence:s}=r;return {value:t,kind:e,position:n,...i!==void 0&&{normalized:i},...o!==void 0&&{stem:o},...s!==void 0&&{stemConfidence:s}}}return {value:t,kind:e,position:n}}function K(t){return /\s/.test(t)}function qe(t){return t==="#"||t==="."||t==="["||t==="@"||t==="*"||t==="<"}function $e(t){return t==='"'||t==="'"||t==="`"||t==="\u300C"||t==="\u300D"}function L(t){return /\d/.test(t)}function sr(t){return /[a-zA-Z]/.test(t)}function R(t){return /[a-zA-Z0-9_-]/.test(t)}function ar(t){let e=r=>t.test(r);return {isLetter:e,isIdentifierChar:r=>e(r)||/[0-9_-]/.test(r)}}function lr(t,e){if(e>=t.length)return null;let n=t[e];if(!qe(n))return null;let r=e,i="";if(n==="#"||n==="."){for(i+=t[r++];r<t.length&&R(t[r]);)i+=t[r++];if(i.length<=1)return null;if(r<t.length&&t[r]==="."&&n==="#"){let s=r+1;for(;s<t.length&&R(t[s]);)s++;if(s<t.length&&t[s]==="(")return i}}else if(n==="["){let o=1,s=false,a=null,l=false;for(i+=t[r++];r<t.length&&o>0;){let u=t[r];i+=u,l?l=false:u==="\\"?l=true:s?u===a&&(s=false,a=null):u==='"'||u==="'"||u==="`"?(s=true,a=u):u==="["?o++:u==="]"&&o--,r++;}if(o!==0)return null}else if(n==="@"){for(i+=t[r++];r<t.length&&R(t[r]);)i+=t[r++];if(i.length<=1)return null}else if(n==="*"){for(i+=t[r++];r<t.length&&R(t[r]);)i+=t[r++];if(i.length<=1)return null}else if(n==="<"){if(i+=t[r++],r>=t.length||!sr(t[r]))return null;for(;r<t.length&&R(t[r]);)i+=t[r++];for(;r<t.length;){let o=t[r];if(o==="."){if(i+=t[r++],r>=t.length||!R(t[r]))return null;for(;r<t.length&&R(t[r]);)i+=t[r++];}else if(o==="#"){if(i+=t[r++],r>=t.length||!R(t[r]))return null;for(;r<t.length&&R(t[r]);)i+=t[r++];}else if(o==="["){let s=1,a=false,l=null,u=false;for(i+=t[r++];r<t.length&&s>0;){let c=t[r];i+=c,u?u=false:c==="\\"?u=true:a?c===l&&(a=false,l=null):c==='"'||c==="'"||c==="`"?(a=true,l=c):c==="["?s++:c==="]"&&s--,r++;}if(s!==0)return null}else break}for(;r<t.length&&K(t[r]);)i+=t[r++];if(r<t.length&&t[r]==="/")for(i+=t[r++];r<t.length&&K(t[r]);)i+=t[r++];if(r>=t.length||t[r]!==">")return null;i+=t[r++];}return i||null}function cr(t,e){if(e>=t.length||t[e]!=="'"||e+1>=t.length||t[e+1].toLowerCase()!=="s")return false;if(e+2>=t.length)return true;let r=t[e+2];return K(r)||r==="*"||!R(r)}function ur(t,e){if(e>=t.length)return null;let n=t[e];if(!$e(n)||n==="'"&&cr(t,e))return null;let i={'"':'"',"'":"'","`":"`","\u300C":"\u300D"}[n];if(!i)return null;let o=e+1,s=n,a=false;for(;o<t.length;){let l=t[o];if(s+=l,a)a=false;else if(l==="\\")a=true;else if(l===i)return s;o++;}return s}function je(t,e){if(e>=t.length)return false;let n=t[e],r=t[e+1]||"",i=t[e+2]||"";if(n==="/"&&r!=="/"&&/[a-zA-Z0-9._-]/.test(r)||n==="/"&&r==="/"&&/[a-zA-Z]/.test(i)||n==="."&&(r==="/"||r==="."&&i==="/"))return true;let o=t.slice(e,e+8).toLowerCase();return !!(o.startsWith("http://")||o.startsWith("https://"))}function dr(t,e){if(!je(t,e))return null;let n=e,r="",i=/[a-zA-Z0-9/:._\-?&=%@+~!$'()*,;[\]]/;for(;n<t.length;){let o=t[n];if(o==="#"){if(r.length>0&&/[a-zA-Z0-9/.]$/.test(r))for(r+=o,n++;n<t.length&&/[a-zA-Z0-9_-]/.test(t[n]);)r+=t[n++];break}if(i.test(o))r+=o,n++;else break}return r.length<2?null:r}function mr(t,e){if(e>=t.length)return null;let n=t[e];if(!L(n)&&n!=="-"&&n!=="+")return null;let r=e,i="";if((t[r]==="-"||t[r]==="+")&&(i+=t[r++]),r>=t.length||!L(t[r]))return null;for(;r<t.length&&L(t[r]);)i+=t[r++];if(r<t.length&&t[r]===".")for(i+=t[r++];r<t.length&&L(t[r]);)i+=t[r++];return r<t.length&&(t.slice(r,r+2)==="ms"?i+="ms":(t[r]==="s"||t[r]==="m"||t[r]==="h")&&(i+=t[r])),i}var Ve=class Ue{constructor(){this.profileKeywords=[],this.profileKeywordMap=new Map;}tryPropertyAccess(e,n,r){if(e[n]!==".")return false;let i=r[r.length-1],o=i&&i.position.end<n;if(i&&!o&&(i.kind==="identifier"||i.kind==="keyword"||i.kind==="selector"))return r.push(w(".","operator",g(n,n+1))),true;let l=n+1;for(;l<e.length&&R(e[l]);)l++;return l<e.length&&e[l]==="("?(r.push(w(".","operator",g(n,n+1))),true):false}initializeKeywordsFromProfile(e,n=[]){let r=new Map;if(e.keywords){for(let[i,o]of Object.entries(e.keywords))if(r.set(o.primary,{native:o.primary,normalized:o.normalized||i}),o.alternatives)for(let s of o.alternatives)r.set(s,{native:s,normalized:o.normalized||i});}if(e.references){for(let[i,o]of Object.entries(e.references))r.set(o,{native:o,normalized:i});for(let i of Object.keys(e.references))r.has(i)||r.set(i,{native:i,normalized:i});}if(e.roleMarkers){for(let[i,o]of Object.entries(e.roleMarkers))if(o.primary&&r.set(o.primary,{native:o.primary,normalized:i}),o.alternatives)for(let s of o.alternatives)r.set(s,{native:s,normalized:i});}for(let i of n)r.set(i.native,i);this.profileKeywords=Array.from(r.values()).sort((i,o)=>o.native.length-i.native.length),this.profileKeywordMap=new Map;for(let i of this.profileKeywords){this.profileKeywordMap.set(i.native.toLowerCase(),i);let o=this.removeDiacritics(i.native);o!==i.native&&!this.profileKeywordMap.has(o.toLowerCase())&&this.profileKeywordMap.set(o.toLowerCase(),i);}}removeDiacritics(e){return e.replace(/[\u064B-\u0652\u0670]/g,"")}tryProfileKeyword(e,n){for(let r of this.profileKeywords)if(e.slice(n).startsWith(r.native))return w(r.native,"keyword",g(n,n+r.native.length),r.normalized);return null}isKeywordStart(e,n){let r=e.slice(n);return this.profileKeywords.some(i=>r.startsWith(i.native))}lookupKeyword(e){return this.profileKeywordMap.get(e.toLowerCase())}isKeyword(e){return this.profileKeywordMap.has(e.toLowerCase())}setNormalizer(e){this.normalizer=e;}tryNormalize(e){if(!this.normalizer)return null;let n=this.normalizer.normalize(e);return n.stem!==e&&n.confidence>=.7?n:null}tryMorphKeywordMatch(e,n,r){let i=this.tryNormalize(e);if(!i)return null;let o=this.lookupKeyword(i.stem);if(!o)return null;let s={normalized:o.normalized,stem:i.stem,stemConfidence:i.confidence};return w(e,"keyword",g(n,r),s)}trySelector(e,n){let r=lr(e,n);return r?w(r,"selector",g(n,n+r.length)):null}tryEventModifier(e,n){if(e[n]!==".")return null;let r=e.slice(n).match(/^\.(?:once|debounce|throttle|queue)(?:\(([^)]+)\))?(?:\s|$|\.)/);if(!r)return null;let i=r[0].replace(/(\s|\.)$/,""),o=i.slice(1).split("(")[0],s=r[1];return {...w(i,"event-modifier",g(n,n+i.length)),metadata:{modifierName:o,value:s?o==="queue"?s:parseInt(s,10):void 0}}}tryString(e,n){let r=ur(e,n);return r?w(r,"literal",g(n,n+r.length)):null}tryNumber(e,n){let r=mr(e,n);return r?w(r,"literal",g(n,n+r.length)):null}tryMatchTimeUnit(e,n,r,i=false){let o=n;if(i)for(;o<e.length&&K(e[o]);)o++;let s=e.slice(o);for(let a of r){let l=s.slice(0,a.length);if(a.caseInsensitive?l.toLowerCase()===a.pattern.toLowerCase():l===a.pattern){if(a.notFollowedBy&&(s[a.length]||"")===a.notFollowedBy)continue;if(a.checkBoundary){let c=s[a.length]||"";if(R(c))continue}return {suffix:a.suffix,endPos:o+a.length}}}return null}parseBaseNumber(e,n,r=true){let i=n,o="";if(r&&(e[i]==="-"||e[i]==="+")&&(o+=e[i++]),i>=e.length||!L(e[i]))return null;for(;i<e.length&&L(e[i]);)o+=e[i++];if(i<e.length&&e[i]===".")for(o+=e[i++];i<e.length&&L(e[i]);)o+=e[i++];return !o||o==="-"||o==="+"?null:{number:o,endPos:i}}tryNumberWithTimeUnits(e,n,r,i={}){let{allowSign:o=true,skipWhitespace:s=false}=i,a=this.parseBaseNumber(e,n,o);if(!a)return null;let{number:l,endPos:u}=a,c=[...r,...Ue.STANDARD_TIME_UNITS],d=this.tryMatchTimeUnit(e,u,c,s);return d&&(l+=d.suffix,u=d.endPos),w(l,"literal",g(n,u))}tryUrl(e,n){let r=dr(e,n);return r?w(r,"url",g(n,n+r.length)):null}tryVariableRef(e,n){if(e[n]!==":"||n+1>=e.length||!R(e[n+1]))return null;let r=n+1;for(;r<e.length&&R(e[r]);)r++;let i=e.slice(n,r);return w(i,"identifier",g(n,r))}tryOperator(e,n){let r=e.slice(n,n+2);if(["==","!=","<=",">=","&&","||","->"].includes(r))return w(r,"operator",g(n,n+2));let i=e[n];return ["<",">","!","+","-","*","/","="].includes(i)?w(i,"operator",g(n,n+1)):["(",")","{","}",",",";",":"].includes(i)?w(i,"punctuation",g(n,n+1)):null}tryMultiCharParticle(e,n,r){for(let i of r)if(e.slice(n,n+i.length)===i)return w(i,"particle",g(n,n+i.length));return null}};Ve.STANDARD_TIME_UNITS=[{pattern:"ms",suffix:"ms",length:2},{pattern:"s",suffix:"s",length:1,checkBoundary:true},{pattern:"m",suffix:"m",length:1,checkBoundary:true,notFollowedBy:"s"},{pattern:"h",suffix:"h",length:1,checkBoundary:true}];var pr=Ve;function De(t){return {stem:t,confidence:1}}function we(t,e,n){return n?{stem:t,confidence:e,metadata:n}:{stem:t,confidence:e}}function fr(t){return /[áéíóúüñÁÉÍÓÚÜÑ]/.test(t)}function hr(t){let e=t.toLowerCase();if(e.endsWith("ar")||e.endsWith("er")||e.endsWith("ir")||e.endsWith("ando")||e.endsWith("iendo")||e.endsWith("ado")||e.endsWith("ido")||e.endsWith("arse")||e.endsWith("erse")||e.endsWith("irse"))return true;for(let n of t)if(fr(n))return true;return false}var Be=["se","me","te","nos","os"],vr=[{ending:"ando",stem:"ar",confidence:.88,type:"gerund"},{ending:"ado",stem:"ar",confidence:.88,type:"participle"},{ending:"ada",stem:"ar",confidence:.88,type:"participle"},{ending:"ados",stem:"ar",confidence:.88,type:"participle"},{ending:"adas",stem:"ar",confidence:.88,type:"participle"},{ending:"o",stem:"ar",confidence:.75,type:"present"},{ending:"as",stem:"ar",confidence:.82,type:"present"},{ending:"a",stem:"ar",confidence:.75,type:"present"},{ending:"amos",stem:"ar",confidence:.85,type:"present"},{ending:"\xE1is",stem:"ar",confidence:.85,type:"present"},{ending:"ais",stem:"ar",confidence:.82,type:"present"},{ending:"an",stem:"ar",confidence:.8,type:"present"},{ending:"\xE9",stem:"ar",confidence:.85,type:"past"},{ending:"aste",stem:"ar",confidence:.88,type:"past"},{ending:"\xF3",stem:"ar",confidence:.82,type:"past"},{ending:"amos",stem:"ar",confidence:.85,type:"past"},{ending:"asteis",stem:"ar",confidence:.88,type:"past"},{ending:"aron",stem:"ar",confidence:.88,type:"past"},{ending:"aba",stem:"ar",confidence:.88,type:"past"},{ending:"abas",stem:"ar",confidence:.88,type:"past"},{ending:"\xE1bamos",stem:"ar",confidence:.88,type:"past"},{ending:"abamos",stem:"ar",confidence:.85,type:"past"},{ending:"abais",stem:"ar",confidence:.88,type:"past"},{ending:"aban",stem:"ar",confidence:.88,type:"past"},{ending:"e",stem:"ar",confidence:.72,type:"subjunctive"},{ending:"es",stem:"ar",confidence:.78,type:"subjunctive"},{ending:"emos",stem:"ar",confidence:.82,type:"subjunctive"},{ending:"\xE9is",stem:"ar",confidence:.85,type:"subjunctive"},{ending:"eis",stem:"ar",confidence:.82,type:"subjunctive"},{ending:"en",stem:"ar",confidence:.78,type:"subjunctive"},{ending:"a",stem:"ar",confidence:.75,type:"imperative"},{ending:"ad",stem:"ar",confidence:.85,type:"imperative"},{ending:"ar",stem:"ar",confidence:.92,type:"dictionary"}],yr=[{ending:"iendo",stem:"er",confidence:.88,type:"gerund"},{ending:"ido",stem:"er",confidence:.85,type:"participle"},{ending:"ida",stem:"er",confidence:.85,type:"participle"},{ending:"idos",stem:"er",confidence:.85,type:"participle"},{ending:"idas",stem:"er",confidence:.85,type:"participle"},{ending:"o",stem:"er",confidence:.72,type:"present"},{ending:"es",stem:"er",confidence:.78,type:"present"},{ending:"e",stem:"er",confidence:.72,type:"present"},{ending:"emos",stem:"er",confidence:.85,type:"present"},{ending:"\xE9is",stem:"er",confidence:.85,type:"present"},{ending:"eis",stem:"er",confidence:.82,type:"present"},{ending:"en",stem:"er",confidence:.78,type:"present"},{ending:"\xED",stem:"er",confidence:.85,type:"past"},{ending:"iste",stem:"er",confidence:.88,type:"past"},{ending:"i\xF3",stem:"er",confidence:.85,type:"past"},{ending:"io",stem:"er",confidence:.82,type:"past"},{ending:"imos",stem:"er",confidence:.85,type:"past"},{ending:"isteis",stem:"er",confidence:.88,type:"past"},{ending:"ieron",stem:"er",confidence:.88,type:"past"},{ending:"\xEDa",stem:"er",confidence:.88,type:"past"},{ending:"ia",stem:"er",confidence:.85,type:"past"},{ending:"\xEDas",stem:"er",confidence:.88,type:"past"},{ending:"ias",stem:"er",confidence:.85,type:"past"},{ending:"\xEDamos",stem:"er",confidence:.88,type:"past"},{ending:"iamos",stem:"er",confidence:.85,type:"past"},{ending:"\xEDais",stem:"er",confidence:.88,type:"past"},{ending:"iais",stem:"er",confidence:.85,type:"past"},{ending:"\xEDan",stem:"er",confidence:.88,type:"past"},{ending:"ian",stem:"er",confidence:.85,type:"past"},{ending:"er",stem:"er",confidence:.92,type:"dictionary"}],gr=[{ending:"iendo",stem:"ir",confidence:.88,type:"gerund"},{ending:"ido",stem:"ir",confidence:.85,type:"participle"},{ending:"ida",stem:"ir",confidence:.85,type:"participle"},{ending:"idos",stem:"ir",confidence:.85,type:"participle"},{ending:"idas",stem:"ir",confidence:.85,type:"participle"},{ending:"o",stem:"ir",confidence:.72,type:"present"},{ending:"es",stem:"ir",confidence:.78,type:"present"},{ending:"e",stem:"ir",confidence:.72,type:"present"},{ending:"imos",stem:"ir",confidence:.85,type:"present"},{ending:"\xEDs",stem:"ir",confidence:.85,type:"present"},{ending:"is",stem:"ir",confidence:.82,type:"present"},{ending:"en",stem:"ir",confidence:.78,type:"present"},{ending:"\xED",stem:"ir",confidence:.85,type:"past"},{ending:"iste",stem:"ir",confidence:.88,type:"past"},{ending:"i\xF3",stem:"ir",confidence:.85,type:"past"},{ending:"io",stem:"ir",confidence:.82,type:"past"},{ending:"imos",stem:"ir",confidence:.85,type:"past"},{ending:"isteis",stem:"ir",confidence:.88,type:"past"},{ending:"ieron",stem:"ir",confidence:.88,type:"past"},{ending:"\xEDa",stem:"ir",confidence:.88,type:"past"},{ending:"ia",stem:"ir",confidence:.85,type:"past"},{ending:"\xEDas",stem:"ir",confidence:.88,type:"past"},{ending:"ias",stem:"ir",confidence:.85,type:"past"},{ending:"\xEDamos",stem:"ir",confidence:.88,type:"past"},{ending:"iamos",stem:"ir",confidence:.85,type:"past"},{ending:"\xEDais",stem:"ir",confidence:.88,type:"past"},{ending:"iais",stem:"ir",confidence:.85,type:"past"},{ending:"\xEDan",stem:"ir",confidence:.88,type:"past"},{ending:"ian",stem:"ir",confidence:.85,type:"past"},{ending:"ir",stem:"ir",confidence:.92,type:"dictionary"}],wr=[...vr,...yr,...gr].sort((t,e)=>e.ending.length-t.ending.length),Ke=class{constructor(){this.language="es";}isNormalizable(t){return t.length<3?false:hr(t)}normalize(t){let e=t.toLowerCase();if((e.endsWith("ar")||e.endsWith("er")||e.endsWith("ir"))&&!Be.some(i=>e.endsWith(i+"ar")||e.endsWith(i+"er")||e.endsWith(i+"ir")))return De(t);let n=this.tryReflexiveNormalization(e);if(n)return n;let r=this.tryConjugationNormalization(e);return r||De(t)}tryReflexiveNormalization(t){for(let e of Be)if(t.endsWith(e)){let n=t.slice(0,-e.length);if(n.endsWith("ar")||n.endsWith("er")||n.endsWith("ir"))return we(n,.88,{removedSuffixes:[e],conjugationType:"reflexive"});let r=this.tryConjugationNormalization(n);if(r&&r.stem!==n)return we(r.stem,r.confidence*.95,{removedSuffixes:[e,...r.metadata?.removedSuffixes||[]],conjugationType:"reflexive"})}return null}tryConjugationNormalization(t){for(let e of wr)if(t.endsWith(e.ending)){let n=t.slice(0,-e.ending.length);if(n.length<2)continue;let r=n+e.stem;return we(r,e.confidence,{removedSuffixes:[e.ending],conjugationType:e.type})}return null}},Ge={code:"es",name:"Spanish",nativeName:"Espa\xF1ol",direction:"ltr",wordOrder:"SVO",markingStrategy:"preposition",usesSpaces:true,defaultVerbForm:"infinitive",verb:{position:"start",subjectDrop:true},references:{me:"yo",it:"ello",you:"t\xFA",result:"resultado",event:"evento",target:"objetivo",body:"cuerpo"},possessive:{marker:"de",markerPosition:"before-property",usePossessiveAdjectives:true,specialForms:{me:"mi",it:"su",you:"tu"},keywords:{mi:"me",tu:"you",su:"it"}},roleMarkers:{destination:{primary:"en",alternatives:["sobre","a"],position:"before"},source:{primary:"de",alternatives:["desde"],position:"before"},patient:{primary:"",position:"before"},style:{primary:"con",position:"before"}},keywords:{toggle:{primary:"alternar",alternatives:["cambiar","conmutar"],normalized:"toggle"},add:{primary:"agregar",alternatives:["a\xF1adir"],normalized:"add"},remove:{primary:"quitar",alternatives:["eliminar","remover","sacar"],normalized:"remove"},put:{primary:"poner",alternatives:["colocar"],normalized:"put"},append:{primary:"a\xF1adir",normalized:"append"},prepend:{primary:"anteponer",normalized:"prepend"},take:{primary:"tomar",normalized:"take"},make:{primary:"hacer",alternatives:["crear"],normalized:"make"},clone:{primary:"clonar",alternatives:["copiar"],normalized:"clone"},swap:{primary:"intercambiar",alternatives:["cambiar"],normalized:"swap"},morph:{primary:"transformar",alternatives:["convertir"],normalized:"morph"},set:{primary:"establecer",alternatives:["fijar","definir"],normalized:"set"},get:{primary:"obtener",alternatives:["conseguir"],normalized:"get"},increment:{primary:"incrementar",alternatives:["aumentar"],normalized:"increment"},decrement:{primary:"decrementar",alternatives:["disminuir"],normalized:"decrement"},log:{primary:"registrar",alternatives:["imprimir"],normalized:"log"},show:{primary:"mostrar",alternatives:["ense\xF1ar"],normalized:"show"},hide:{primary:"ocultar",alternatives:["esconder"],normalized:"hide"},transition:{primary:"transici\xF3n",alternatives:["animar"],normalized:"transition"},on:{primary:"en",alternatives:["cuando","al"],normalized:"on"},trigger:{primary:"disparar",alternatives:["activar"],normalized:"trigger"},send:{primary:"enviar",normalized:"send"},focus:{primary:"enfocar",normalized:"focus"},blur:{primary:"desenfocar",normalized:"blur"},click:{primary:"clic",alternatives:["hacer clic"],normalized:"click"},hover:{primary:"sobrevolar",alternatives:["pasar por encima"],normalized:"hover"},submit:{primary:"env\xEDo",alternatives:["enviar"],normalized:"submit"},input:{primary:"entrada",alternatives:["introducir"],normalized:"input"},change:{primary:"cambio",alternatives:["cambiar"],normalized:"change"},go:{primary:"ir",alternatives:["navegar"],normalized:"go"},wait:{primary:"esperar",normalized:"wait"},fetch:{primary:"buscar",alternatives:["obtener"],normalized:"fetch"},settle:{primary:"estabilizar",normalized:"settle"},if:{primary:"si",normalized:"if"},when:{primary:"cuando",normalized:"when"},where:{primary:"donde",normalized:"where"},else:{primary:"sino",alternatives:["de lo contrario"],normalized:"else"},repeat:{primary:"repetir",normalized:"repeat"},for:{primary:"para",normalized:"for"},while:{primary:"mientras",normalized:"while"},continue:{primary:"continuar",normalized:"continue"},halt:{primary:"detener",alternatives:["parar"],normalized:"halt"},throw:{primary:"lanzar",alternatives:["arrojar"],normalized:"throw"},call:{primary:"llamar",normalized:"call"},return:{primary:"retornar",alternatives:["devolver"],normalized:"return"},then:{primary:"entonces",alternatives:["luego","despu\xE9s"],normalized:"then"},and:{primary:"y",alternatives:["adem\xE1s","tambi\xE9n"],normalized:"and"},end:{primary:"fin",alternatives:["final","terminar"],normalized:"end"},js:{primary:"js",normalized:"js"},async:{primary:"as\xEDncrono",normalized:"async"},tell:{primary:"decir",normalized:"tell"},default:{primary:"predeterminar",alternatives:["por defecto"],normalized:"default"},init:{primary:"iniciar",alternatives:["inicializar"],normalized:"init"},behavior:{primary:"comportamiento",normalized:"behavior"},install:{primary:"instalar",normalized:"install"},measure:{primary:"medir",normalized:"measure"},beep:{primary:"pitido",normalized:"beep"},break:{primary:"romper",normalized:"break"},copy:{primary:"copiar",normalized:"copy"},exit:{primary:"salir",normalized:"exit"},pick:{primary:"escoger",normalized:"pick"},render:{primary:"renderizar",normalized:"render"},into:{primary:"en",alternatives:["dentro de"],normalized:"into"},before:{primary:"antes",normalized:"before"},after:{primary:"despu\xE9s",normalized:"after"},until:{primary:"hasta",normalized:"until"},event:{primary:"evento",normalized:"event"},from:{primary:"de",alternatives:["desde"],normalized:"from"}},eventHandler:{keyword:{primary:"al",alternatives:["cuando","en"],normalized:"on"},sourceMarker:{primary:"de",alternatives:["desde"],position:"before"},eventMarker:{primary:"al",alternatives:["cuando"],position:"before"},temporalMarkers:["cuando","al"]}},{isLetter:We,isIdentifierChar:Er}=ar(/[a-zA-ZáéíóúüñÁÉÍÓÚÜÑ]/),kr=[{pattern:"milisegundos",suffix:"ms",length:12,caseInsensitive:true},{pattern:"milisegundo",suffix:"ms",length:11,caseInsensitive:true},{pattern:"segundos",suffix:"s",length:8,caseInsensitive:true},{pattern:"segundo",suffix:"s",length:7,caseInsensitive:true},{pattern:"minutos",suffix:"m",length:7,caseInsensitive:true},{pattern:"minuto",suffix:"m",length:6,caseInsensitive:true},{pattern:"horas",suffix:"h",length:5,caseInsensitive:true},{pattern:"hora",suffix:"h",length:4,caseInsensitive:true}],Fe=new Set(["en","a","de","desde","hasta","con","sin","por","para","sobre","entre","antes","despu\xE9s","despues","dentro","fuera","al","del"]),br=[{native:"verdadero",normalized:"true"},{native:"falso",normalized:"false"},{native:"nulo",normalized:"null"},{native:"indefinido",normalized:"undefined"},{native:"primero",normalized:"first"},{native:"primera",normalized:"first"},{native:"\xFAltimo",normalized:"last"},{native:"ultima",normalized:"last"},{native:"siguiente",normalized:"next"},{native:"anterior",normalized:"previous"},{native:"cercano",normalized:"closest"},{native:"padre",normalized:"parent"},{native:"clic",normalized:"click"},{native:"click",normalized:"click"},{native:"hacer clic",normalized:"click"},{native:"entrada",normalized:"input"},{native:"cambio",normalized:"change"},{native:"env\xEDo",normalized:"submit"},{native:"envio",normalized:"submit"},{native:"tecla abajo",normalized:"keydown"},{native:"tecla arriba",normalized:"keyup"},{native:"rat\xF3n encima",normalized:"mouseover"},{native:"raton encima",normalized:"mouseover"},{native:"rat\xF3n fuera",normalized:"mouseout"},{native:"raton fuera",normalized:"mouseout"},{native:"enfoque",normalized:"focus"},{native:"desenfoque",normalized:"blur"},{native:"carga",normalized:"load"},{native:"desplazamiento",normalized:"scroll"},{native:"yo",normalized:"me"},{native:"m\xED",normalized:"me"},{native:"mi",normalized:"me"},{native:"ello",normalized:"it"},{native:"resultado",normalized:"result"},{native:"objetivo",normalized:"target"},{native:"destino",normalized:"target"},{native:"segundo",normalized:"s"},{native:"segundos",normalized:"s"},{native:"milisegundo",normalized:"ms"},{native:"milisegundos",normalized:"ms"},{native:"minuto",normalized:"m"},{native:"minutos",normalized:"m"},{native:"hora",normalized:"h"},{native:"horas",normalized:"h"},{native:"de lo contrario",normalized:"else"},{native:"hasta que",normalized:"until"},{native:"antes de",normalized:"before"},{native:"despu\xE9s de",normalized:"after"},{native:"despues de",normalized:"after"},{native:"dentro de",normalized:"into"},{native:"fuera de",normalized:"out"},{native:"asincrono",normalized:"async"},{native:"despues",normalized:"after"},{native:"a\xF1adir",normalized:"add"},{native:"toggle",normalized:"toggle"},{native:"borrar",normalized:"remove"},{native:"pon",normalized:"put"},{native:"crear",normalized:"make"},{native:"y",normalized:"and"},{native:"o",normalized:"or"},{native:"no",normalized:"not"},{native:"es",normalized:"is"},{native:"existe",normalized:"exists"},{native:"vac\xEDo",normalized:"empty"},{native:"vacio",normalized:"empty"}],zr=class extends pr{constructor(){super(),this.language="es",this.direction="ltr",this.initializeKeywordsFromProfile(Ge,br),this.normalizer=new Ke;}tokenize(t){let e=[],n=0;for(;n<t.length;){if(K(t[n])){n++;continue}if(qe(t[n])){let s=this.tryEventModifier(t,n);if(s){e.push(s),n=s.position.end;continue}if(this.tryPropertyAccess(t,n,e)){n++;continue}let a=this.trySelector(t,n);if(a){e.push(a),n=a.position.end;continue}}if($e(t[n])){let s=this.tryString(t,n);if(s){e.push(s),n=s.position.end;continue}}if(je(t,n)){let s=this.tryUrl(t,n);if(s){e.push(s),n=s.position.end;continue}}if(L(t[n])||t[n]==="-"&&n+1<t.length&&L(t[n+1])){let s=this.extractSpanishNumber(t,n);if(s){e.push(s),n=s.position.end;continue}}let r=this.tryVariableRef(t,n);if(r){e.push(r),n=r.position.end;continue}let i=this.tryMultiWordPhrase(t,n);if(i){e.push(i),n=i.position.end;continue}if(We(t[n])){let s=this.extractSpanishWord(t,n);if(s){e.push(s),n=s.position.end;continue}}let o=this.tryOperator(t,n);if(o){e.push(o),n=o.position.end;continue}n++;}return new or(e,"es")}classifyToken(t){let e=t.toLowerCase();return Fe.has(e)?"particle":this.isKeyword(e)?"keyword":t.startsWith("#")||t.startsWith(".")||t.startsWith("[")||t.startsWith("*")||t.startsWith("<")?"selector":t.startsWith('"')||t.startsWith("'")||/^\d/.test(t)?"literal":["==","!=","<=",">=","<",">","&&","||","!"].includes(t)?"operator":"identifier"}tryMultiWordPhrase(t,e){for(let n of this.profileKeywords){if(!n.native.includes(" "))continue;let r=n.native;if(t.slice(e,e+r.length).toLowerCase()===r.toLowerCase()){let o=e+r.length;if(o>=t.length||K(t[o])||!We(t[o]))return w(t.slice(e,e+r.length),"keyword",g(e,o),n.normalized)}}return null}extractSpanishWord(t,e){let n=e,r="";for(;n<t.length&&Er(t[n]);)r+=t[n++];if(!r)return null;let i=r.toLowerCase();if(Fe.has(i))return w(r,"particle",g(e,n));let o=this.lookupKeyword(i);if(o)return w(r,"keyword",g(e,n),o.normalized);let s=this.tryMorphKeywordMatch(i,e,n);return s||w(r,"identifier",g(e,n))}extractSpanishNumber(t,e){return this.tryNumberWithTimeUnits(t,e,kr,{allowSign:true,skipWhitespace:true})}},Tr=new zr;ir("es",Tr,Ge);var Sr=new Map,xr=new Map,Cr=new Map;function Ar(t,e,n){Sr.set(t,e),xr.set(t,n),Cr.delete(t);}var Nr=class{constructor(t,e){this.pos=0,this.tokens=t,this.language=e;}peek(t=0){let e=this.pos+t;return e<0||e>=this.tokens.length?null:this.tokens[e]}advance(){if(this.isAtEnd())throw new Error("Unexpected end of token stream");return this.tokens[this.pos++]}isAtEnd(){return this.pos>=this.tokens.length}mark(){return {position:this.pos}}reset(t){this.pos=t.position;}position(){return this.pos}remaining(){return this.tokens.slice(this.pos)}takeWhile(t){let e=[];for(;!this.isAtEnd()&&t(this.peek());)e.push(this.advance());return e}skipWhile(t){for(;!this.isAtEnd()&&t(this.peek());)this.advance();}};function E(t,e){return {start:t,end:e}}function k(t,e,n,r){if(typeof r=="string")return {value:t,kind:e,position:n,normalized:r};if(r){let{normalized:i,stem:o,stemConfidence:s}=r;return {value:t,kind:e,position:n,...i!==void 0&&{normalized:i},...o!==void 0&&{stem:o},...s!==void 0&&{stemConfidence:s}}}return {value:t,kind:e,position:n}}function te(t){return /\s/.test(t)}function Ze(t){return t==="#"||t==="."||t==="["||t==="@"||t==="*"||t==="<"}function Ye(t){return t==='"'||t==="'"||t==="`"||t==="\u300C"||t==="\u300D"}function D(t){return /\d/.test(t)}function Rr(t){return /[a-zA-Z]/.test(t)}function P(t){return /[a-zA-Z0-9_-]/.test(t)}function Pr(t){let e=r=>t.test(r);return {isLetter:e,isIdentifierChar:r=>e(r)||/[0-9_-]/.test(r)}}function Ir(t,e){if(e>=t.length)return null;let n=t[e];if(!Ze(n))return null;let r=e,i="";if(n==="#"||n==="."){for(i+=t[r++];r<t.length&&P(t[r]);)i+=t[r++];if(i.length<=1)return null;if(r<t.length&&t[r]==="."&&n==="#"){let s=r+1;for(;s<t.length&&P(t[s]);)s++;if(s<t.length&&t[s]==="(")return i}}else if(n==="["){let o=1,s=false,a=null,l=false;for(i+=t[r++];r<t.length&&o>0;){let u=t[r];i+=u,l?l=false:u==="\\"?l=true:s?u===a&&(s=false,a=null):u==='"'||u==="'"||u==="`"?(s=true,a=u):u==="["?o++:u==="]"&&o--,r++;}if(o!==0)return null}else if(n==="@"){for(i+=t[r++];r<t.length&&P(t[r]);)i+=t[r++];if(i.length<=1)return null}else if(n==="*"){for(i+=t[r++];r<t.length&&P(t[r]);)i+=t[r++];if(i.length<=1)return null}else if(n==="<"){if(i+=t[r++],r>=t.length||!Rr(t[r]))return null;for(;r<t.length&&P(t[r]);)i+=t[r++];for(;r<t.length;){let o=t[r];if(o==="."){if(i+=t[r++],r>=t.length||!P(t[r]))return null;for(;r<t.length&&P(t[r]);)i+=t[r++];}else if(o==="#"){if(i+=t[r++],r>=t.length||!P(t[r]))return null;for(;r<t.length&&P(t[r]);)i+=t[r++];}else if(o==="["){let s=1,a=false,l=null,u=false;for(i+=t[r++];r<t.length&&s>0;){let c=t[r];i+=c,u?u=false:c==="\\"?u=true:a?c===l&&(a=false,l=null):c==='"'||c==="'"||c==="`"?(a=true,l=c):c==="["?s++:c==="]"&&s--,r++;}if(s!==0)return null}else break}for(;r<t.length&&te(t[r]);)i+=t[r++];if(r<t.length&&t[r]==="/")for(i+=t[r++];r<t.length&&te(t[r]);)i+=t[r++];if(r>=t.length||t[r]!==">")return null;i+=t[r++];}return i||null}function _r(t,e){if(e>=t.length||t[e]!=="'"||e+1>=t.length||t[e+1].toLowerCase()!=="s")return false;if(e+2>=t.length)return true;let r=t[e+2];return te(r)||r==="*"||!P(r)}function Mr(t,e){if(e>=t.length)return null;let n=t[e];if(!Ye(n)||n==="'"&&_r(t,e))return null;let i={'"':'"',"'":"'","`":"`","\u300C":"\u300D"}[n];if(!i)return null;let o=e+1,s=n,a=false;for(;o<t.length;){let l=t[o];if(s+=l,a)a=false;else if(l==="\\")a=true;else if(l===i)return s;o++;}return s}function Je(t,e){if(e>=t.length)return false;let n=t[e],r=t[e+1]||"",i=t[e+2]||"";if(n==="/"&&r!=="/"&&/[a-zA-Z0-9._-]/.test(r)||n==="/"&&r==="/"&&/[a-zA-Z]/.test(i)||n==="."&&(r==="/"||r==="."&&i==="/"))return true;let o=t.slice(e,e+8).toLowerCase();return !!(o.startsWith("http://")||o.startsWith("https://"))}function Or(t,e){if(!Je(t,e))return null;let n=e,r="",i=/[a-zA-Z0-9/:._\-?&=%@+~!$'()*,;[\]]/;for(;n<t.length;){let o=t[n];if(o==="#"){if(r.length>0&&/[a-zA-Z0-9/.]$/.test(r))for(r+=o,n++;n<t.length&&/[a-zA-Z0-9_-]/.test(t[n]);)r+=t[n++];break}if(i.test(o))r+=o,n++;else break}return r.length<2?null:r}function Lr(t,e){if(e>=t.length)return null;let n=t[e];if(!D(n)&&n!=="-"&&n!=="+")return null;let r=e,i="";if((t[r]==="-"||t[r]==="+")&&(i+=t[r++]),r>=t.length||!D(t[r]))return null;for(;r<t.length&&D(t[r]);)i+=t[r++];if(r<t.length&&t[r]===".")for(i+=t[r++];r<t.length&&D(t[r]);)i+=t[r++];return r<t.length&&(t.slice(r,r+2)==="ms"?i+="ms":(t[r]==="s"||t[r]==="m"||t[r]==="h")&&(i+=t[r])),i}var et=class tt{constructor(){this.profileKeywords=[],this.profileKeywordMap=new Map;}tryPropertyAccess(e,n,r){if(e[n]!==".")return false;let i=r[r.length-1],o=i&&i.position.end<n;if(i&&!o&&(i.kind==="identifier"||i.kind==="keyword"||i.kind==="selector"))return r.push(k(".","operator",E(n,n+1))),true;let l=n+1;for(;l<e.length&&P(e[l]);)l++;return l<e.length&&e[l]==="("?(r.push(k(".","operator",E(n,n+1))),true):false}initializeKeywordsFromProfile(e,n=[]){let r=new Map;if(e.keywords){for(let[i,o]of Object.entries(e.keywords))if(r.set(o.primary,{native:o.primary,normalized:o.normalized||i}),o.alternatives)for(let s of o.alternatives)r.set(s,{native:s,normalized:o.normalized||i});}if(e.references){for(let[i,o]of Object.entries(e.references))r.set(o,{native:o,normalized:i});for(let i of Object.keys(e.references))r.has(i)||r.set(i,{native:i,normalized:i});}if(e.roleMarkers){for(let[i,o]of Object.entries(e.roleMarkers))if(o.primary&&r.set(o.primary,{native:o.primary,normalized:i}),o.alternatives)for(let s of o.alternatives)r.set(s,{native:s,normalized:i});}for(let i of n)r.set(i.native,i);this.profileKeywords=Array.from(r.values()).sort((i,o)=>o.native.length-i.native.length),this.profileKeywordMap=new Map;for(let i of this.profileKeywords){this.profileKeywordMap.set(i.native.toLowerCase(),i);let o=this.removeDiacritics(i.native);o!==i.native&&!this.profileKeywordMap.has(o.toLowerCase())&&this.profileKeywordMap.set(o.toLowerCase(),i);}}removeDiacritics(e){return e.replace(/[\u064B-\u0652\u0670]/g,"")}tryProfileKeyword(e,n){for(let r of this.profileKeywords)if(e.slice(n).startsWith(r.native))return k(r.native,"keyword",E(n,n+r.native.length),r.normalized);return null}isKeywordStart(e,n){let r=e.slice(n);return this.profileKeywords.some(i=>r.startsWith(i.native))}lookupKeyword(e){return this.profileKeywordMap.get(e.toLowerCase())}isKeyword(e){return this.profileKeywordMap.has(e.toLowerCase())}setNormalizer(e){this.normalizer=e;}tryNormalize(e){if(!this.normalizer)return null;let n=this.normalizer.normalize(e);return n.stem!==e&&n.confidence>=.7?n:null}tryMorphKeywordMatch(e,n,r){let i=this.tryNormalize(e);if(!i)return null;let o=this.lookupKeyword(i.stem);if(!o)return null;let s={normalized:o.normalized,stem:i.stem,stemConfidence:i.confidence};return k(e,"keyword",E(n,r),s)}trySelector(e,n){let r=Ir(e,n);return r?k(r,"selector",E(n,n+r.length)):null}tryEventModifier(e,n){if(e[n]!==".")return null;let r=e.slice(n).match(/^\.(?:once|debounce|throttle|queue)(?:\(([^)]+)\))?(?:\s|$|\.)/);if(!r)return null;let i=r[0].replace(/(\s|\.)$/,""),o=i.slice(1).split("(")[0],s=r[1];return {...k(i,"event-modifier",E(n,n+i.length)),metadata:{modifierName:o,value:s?o==="queue"?s:parseInt(s,10):void 0}}}tryString(e,n){let r=Mr(e,n);return r?k(r,"literal",E(n,n+r.length)):null}tryNumber(e,n){let r=Lr(e,n);return r?k(r,"literal",E(n,n+r.length)):null}tryMatchTimeUnit(e,n,r,i=false){let o=n;if(i)for(;o<e.length&&te(e[o]);)o++;let s=e.slice(o);for(let a of r){let l=s.slice(0,a.length);if(a.caseInsensitive?l.toLowerCase()===a.pattern.toLowerCase():l===a.pattern){if(a.notFollowedBy&&(s[a.length]||"")===a.notFollowedBy)continue;if(a.checkBoundary){let c=s[a.length]||"";if(P(c))continue}return {suffix:a.suffix,endPos:o+a.length}}}return null}parseBaseNumber(e,n,r=true){let i=n,o="";if(r&&(e[i]==="-"||e[i]==="+")&&(o+=e[i++]),i>=e.length||!D(e[i]))return null;for(;i<e.length&&D(e[i]);)o+=e[i++];if(i<e.length&&e[i]===".")for(o+=e[i++];i<e.length&&D(e[i]);)o+=e[i++];return !o||o==="-"||o==="+"?null:{number:o,endPos:i}}tryNumberWithTimeUnits(e,n,r,i={}){let{allowSign:o=true,skipWhitespace:s=false}=i,a=this.parseBaseNumber(e,n,o);if(!a)return null;let{number:l,endPos:u}=a,c=[...r,...tt.STANDARD_TIME_UNITS],d=this.tryMatchTimeUnit(e,u,c,s);return d&&(l+=d.suffix,u=d.endPos),k(l,"literal",E(n,u))}tryUrl(e,n){let r=Or(e,n);return r?k(r,"url",E(n,n+r.length)):null}tryVariableRef(e,n){if(e[n]!==":"||n+1>=e.length||!P(e[n+1]))return null;let r=n+1;for(;r<e.length&&P(e[r]);)r++;let i=e.slice(n,r);return k(i,"identifier",E(n,r))}tryOperator(e,n){let r=e.slice(n,n+2);if(["==","!=","<=",">=","&&","||","->"].includes(r))return k(r,"operator",E(n,n+2));let i=e[n];return ["<",">","!","+","-","*","/","="].includes(i)?k(i,"operator",E(n,n+1)):["(",")","{","}",",",";",":"].includes(i)?k(i,"punctuation",E(n,n+1)):null}tryMultiCharParticle(e,n,r){for(let i of r)if(e.slice(n,n+i.length)===i)return k(i,"particle",E(n,n+i.length));return null}};et.STANDARD_TIME_UNITS=[{pattern:"ms",suffix:"ms",length:2},{pattern:"s",suffix:"s",length:1,checkBoundary:true},{pattern:"m",suffix:"m",length:1,checkBoundary:true,notFollowedBy:"s"},{pattern:"h",suffix:"h",length:1,checkBoundary:true}];var Dr=et,rt={code:"pt",name:"Portuguese",nativeName:"Portugu\xEAs",direction:"ltr",wordOrder:"SVO",markingStrategy:"preposition",usesSpaces:true,verb:{position:"start",subjectDrop:true},references:{me:"eu",it:"ele",you:"voc\xEA",result:"resultado",event:"evento",target:"alvo",body:"corpo"},possessive:{marker:"de",markerPosition:"before-property",usePossessiveAdjectives:true,specialForms:{me:"meu",it:"seu",you:"teu"},keywords:{meu:"me",minha:"me",teu:"you",tua:"you",seu:"it",sua:"it"}},roleMarkers:{destination:{primary:"em",alternatives:["para","a"],position:"before"},source:{primary:"de",alternatives:["desde"],position:"before"},patient:{primary:"",position:"before"},style:{primary:"com",position:"before"}},keywords:{toggle:{primary:"alternar",alternatives:["trocar"],normalized:"toggle"},add:{primary:"adicionar",alternatives:["acrescentar"],normalized:"add"},remove:{primary:"remover",alternatives:["eliminar","apagar"],normalized:"remove"},put:{primary:"colocar",alternatives:["p\xF4r","por"],normalized:"put"},append:{primary:"anexar",normalized:"append"},prepend:{primary:"preceder",normalized:"prepend"},take:{primary:"pegar",normalized:"take"},make:{primary:"fazer",alternatives:["criar"],normalized:"make"},clone:{primary:"clonar",alternatives:["copiar"],normalized:"clone"},swap:{primary:"trocar",alternatives:["substituir"],normalized:"swap"},morph:{primary:"transformar",alternatives:["converter"],normalized:"morph"},set:{primary:"definir",alternatives:["configurar"],normalized:"set"},get:{primary:"obter",normalized:"get"},increment:{primary:"incrementar",alternatives:["aumentar"],normalized:"increment"},decrement:{primary:"decrementar",alternatives:["diminuir"],normalized:"decrement"},log:{primary:"registrar",alternatives:["imprimir"],normalized:"log"},show:{primary:"mostrar",alternatives:["exibir"],normalized:"show"},hide:{primary:"ocultar",alternatives:["esconder"],normalized:"hide"},transition:{primary:"transi\xE7\xE3o",alternatives:["animar"],normalized:"transition"},on:{primary:"em",alternatives:["quando","ao"],normalized:"on"},trigger:{primary:"disparar",alternatives:["ativar"],normalized:"trigger"},send:{primary:"enviar",normalized:"send"},focus:{primary:"focar",normalized:"focus"},blur:{primary:"desfocar",normalized:"blur"},go:{primary:"ir",alternatives:["navegar"],normalized:"go"},wait:{primary:"esperar",alternatives:["aguardar"],normalized:"wait"},fetch:{primary:"buscar",normalized:"fetch"},settle:{primary:"estabilizar",normalized:"settle"},if:{primary:"se",normalized:"if"},when:{primary:"quando",normalized:"when"},where:{primary:"onde",normalized:"where"},else:{primary:"sen\xE3o",normalized:"else"},repeat:{primary:"repetir",normalized:"repeat"},for:{primary:"para",normalized:"for"},while:{primary:"enquanto",normalized:"while"},continue:{primary:"continuar",normalized:"continue"},halt:{primary:"parar",normalized:"halt"},throw:{primary:"lan\xE7ar",normalized:"throw"},call:{primary:"chamar",normalized:"call"},return:{primary:"retornar",alternatives:["devolver"],normalized:"return"},then:{primary:"ent\xE3o",alternatives:["depois","logo"],normalized:"then"},and:{primary:"e",alternatives:["tamb\xE9m","al\xE9m disso"],normalized:"and"},end:{primary:"fim",alternatives:["final","t\xE9rmino"],normalized:"end"},js:{primary:"js",normalized:"js"},async:{primary:"ass\xEDncrono",normalized:"async"},tell:{primary:"dizer",normalized:"tell"},default:{primary:"padr\xE3o",normalized:"default"},init:{primary:"iniciar",alternatives:["inicializar"],normalized:"init"},behavior:{primary:"comportamento",normalized:"behavior"},install:{primary:"instalar",normalized:"install"},measure:{primary:"medir",normalized:"measure"},beep:{primary:"apitar",normalized:"beep"},break:{primary:"parar",normalized:"break"},copy:{primary:"copiar",normalized:"copy"},exit:{primary:"sair",normalized:"exit"},pick:{primary:"escolher",normalized:"pick"},render:{primary:"renderizar",normalized:"render"},into:{primary:"em",alternatives:["dentro de"],normalized:"into"},before:{primary:"antes",normalized:"before"},after:{primary:"depois",normalized:"after"},click:{primary:"clique",alternatives:["clicar"],normalized:"click"},hover:{primary:"sobrevoar",alternatives:["passar"],normalized:"hover"},submit:{primary:"envio",alternatives:["submeter"],normalized:"submit"},input:{primary:"entrada",alternatives:["inser\xE7\xE3o"],normalized:"input"},change:{primary:"altera\xE7\xE3o",alternatives:["mudan\xE7a"],normalized:"change"},until:{primary:"at\xE9",normalized:"until"},event:{primary:"evento",normalized:"event"},from:{primary:"de",alternatives:["desde"],normalized:"from"}},eventHandler:{keyword:{primary:"em",alternatives:["ao","quando"],normalized:"on"},sourceMarker:{primary:"de",alternatives:["desde"],position:"before"},conditionalKeyword:{primary:"quando",alternatives:["se"]},eventMarker:{primary:"ao",alternatives:["no"],position:"before"},temporalMarkers:["quando","ao"]}};function He(t){return {stem:t,confidence:1}}function Ee(t,e,n){return n?{stem:t,confidence:e,metadata:n}:{stem:t,confidence:e}}function Br(t){return /[áàâãéêíóôõúüçÁÀÂÃÉÊÍÓÔÕÚÜÇ]/.test(t)}function Wr(t){let e=t.toLowerCase();if(e.endsWith("ar")||e.endsWith("er")||e.endsWith("ir")||e.endsWith("ando")||e.endsWith("endo")||e.endsWith("indo")||e.endsWith("ado")||e.endsWith("ido")||e.endsWith("ar-se")||e.endsWith("er-se")||e.endsWith("ir-se"))return true;for(let n of t)if(Br(n))return true;return false}var Qe=["-se","-me","-te","-nos","-vos"],Fr=[{ending:"ando",stem:"ar",confidence:.88,type:"gerund"},{ending:"ado",stem:"ar",confidence:.88,type:"participle"},{ending:"ada",stem:"ar",confidence:.88,type:"participle"},{ending:"ados",stem:"ar",confidence:.88,type:"participle"},{ending:"adas",stem:"ar",confidence:.88,type:"participle"},{ending:"o",stem:"ar",confidence:.75,type:"present"},{ending:"as",stem:"ar",confidence:.82,type:"present"},{ending:"a",stem:"ar",confidence:.75,type:"present"},{ending:"amos",stem:"ar",confidence:.85,type:"present"},{ending:"ais",stem:"ar",confidence:.85,type:"present"},{ending:"am",stem:"ar",confidence:.8,type:"present"},{ending:"ei",stem:"ar",confidence:.88,type:"past"},{ending:"aste",stem:"ar",confidence:.88,type:"past"},{ending:"ou",stem:"ar",confidence:.88,type:"past"},{ending:"\xE1mos",stem:"ar",confidence:.88,type:"past"},{ending:"amos",stem:"ar",confidence:.85,type:"past"},{ending:"astes",stem:"ar",confidence:.88,type:"past"},{ending:"aram",stem:"ar",confidence:.88,type:"past"},{ending:"ava",stem:"ar",confidence:.88,type:"past"},{ending:"avas",stem:"ar",confidence:.88,type:"past"},{ending:"\xE1vamos",stem:"ar",confidence:.88,type:"past"},{ending:"avamos",stem:"ar",confidence:.85,type:"past"},{ending:"\xE1veis",stem:"ar",confidence:.88,type:"past"},{ending:"aveis",stem:"ar",confidence:.85,type:"past"},{ending:"avam",stem:"ar",confidence:.88,type:"past"},{ending:"e",stem:"ar",confidence:.72,type:"subjunctive"},{ending:"es",stem:"ar",confidence:.78,type:"subjunctive"},{ending:"emos",stem:"ar",confidence:.82,type:"subjunctive"},{ending:"eis",stem:"ar",confidence:.82,type:"subjunctive"},{ending:"em",stem:"ar",confidence:.78,type:"subjunctive"},{ending:"a",stem:"ar",confidence:.75,type:"imperative"},{ending:"ai",stem:"ar",confidence:.85,type:"imperative"},{ending:"ar",stem:"ar",confidence:.92,type:"dictionary"}],qr=[{ending:"endo",stem:"er",confidence:.88,type:"gerund"},{ending:"ido",stem:"er",confidence:.85,type:"participle"},{ending:"ida",stem:"er",confidence:.85,type:"participle"},{ending:"idos",stem:"er",confidence:.85,type:"participle"},{ending:"idas",stem:"er",confidence:.85,type:"participle"},{ending:"o",stem:"er",confidence:.72,type:"present"},{ending:"es",stem:"er",confidence:.78,type:"present"},{ending:"e",stem:"er",confidence:.72,type:"present"},{ending:"emos",stem:"er",confidence:.85,type:"present"},{ending:"eis",stem:"er",confidence:.82,type:"present"},{ending:"em",stem:"er",confidence:.78,type:"present"},{ending:"i",stem:"er",confidence:.85,type:"past"},{ending:"este",stem:"er",confidence:.88,type:"past"},{ending:"eu",stem:"er",confidence:.88,type:"past"},{ending:"emos",stem:"er",confidence:.85,type:"past"},{ending:"estes",stem:"er",confidence:.88,type:"past"},{ending:"eram",stem:"er",confidence:.88,type:"past"},{ending:"ia",stem:"er",confidence:.85,type:"past"},{ending:"ias",stem:"er",confidence:.85,type:"past"},{ending:"\xEDamos",stem:"er",confidence:.88,type:"past"},{ending:"iamos",stem:"er",confidence:.85,type:"past"},{ending:"\xEDeis",stem:"er",confidence:.88,type:"past"},{ending:"ieis",stem:"er",confidence:.85,type:"past"},{ending:"iam",stem:"er",confidence:.85,type:"past"},{ending:"er",stem:"er",confidence:.92,type:"dictionary"}],$r=[{ending:"indo",stem:"ir",confidence:.88,type:"gerund"},{ending:"ido",stem:"ir",confidence:.85,type:"participle"},{ending:"ida",stem:"ir",confidence:.85,type:"participle"},{ending:"idos",stem:"ir",confidence:.85,type:"participle"},{ending:"idas",stem:"ir",confidence:.85,type:"participle"},{ending:"o",stem:"ir",confidence:.72,type:"present"},{ending:"es",stem:"ir",confidence:.78,type:"present"},{ending:"e",stem:"ir",confidence:.72,type:"present"},{ending:"imos",stem:"ir",confidence:.85,type:"present"},{ending:"is",stem:"ir",confidence:.82,type:"present"},{ending:"em",stem:"ir",confidence:.78,type:"present"},{ending:"i",stem:"ir",confidence:.85,type:"past"},{ending:"iste",stem:"ir",confidence:.88,type:"past"},{ending:"iu",stem:"ir",confidence:.88,type:"past"},{ending:"imos",stem:"ir",confidence:.85,type:"past"},{ending:"istes",stem:"ir",confidence:.88,type:"past"},{ending:"iram",stem:"ir",confidence:.88,type:"past"},{ending:"ia",stem:"ir",confidence:.85,type:"past"},{ending:"ias",stem:"ir",confidence:.85,type:"past"},{ending:"\xEDamos",stem:"ir",confidence:.88,type:"past"},{ending:"iamos",stem:"ir",confidence:.85,type:"past"},{ending:"\xEDeis",stem:"ir",confidence:.88,type:"past"},{ending:"ieis",stem:"ir",confidence:.85,type:"past"},{ending:"iam",stem:"ir",confidence:.85,type:"past"},{ending:"ir",stem:"ir",confidence:.92,type:"dictionary"}],jr=[...Fr,...qr,...$r].sort((t,e)=>e.ending.length-t.ending.length),nt=class{constructor(){this.language="pt";}isNormalizable(t){return t.length<3?false:Wr(t)}normalize(t){let e=t.toLowerCase();if((e.endsWith("ar")||e.endsWith("er")||e.endsWith("ir"))&&!Qe.some(i=>e.endsWith(i)))return He(t);let n=this.tryReflexiveNormalization(e);if(n)return n;let r=this.tryConjugationNormalization(e);return r||He(t)}tryReflexiveNormalization(t){for(let e of Qe)if(t.endsWith(e)){let n=t.slice(0,-e.length);if(n.endsWith("ar")||n.endsWith("er")||n.endsWith("ir"))return Ee(n,.88,{removedSuffixes:[e],conjugationType:"reflexive"});let r=this.tryConjugationNormalization(n);if(r&&r.stem!==n)return Ee(r.stem,r.confidence*.95,{removedSuffixes:[e,...r.metadata?.removedSuffixes||[]],conjugationType:"reflexive"})}return null}tryConjugationNormalization(t){for(let e of jr)if(t.endsWith(e.ending)){let n=t.slice(0,-e.ending.length);if(n.length<2)continue;let r=n+e.stem;return Ee(r,e.confidence,{removedSuffixes:[e.ending],conjugationType:e.type})}return null}},{isLetter:Vr,isIdentifierChar:Ur}=Pr(/[a-zA-ZáàâãéêíóôõúüçÁÀÂÃÉÊÍÓÔÕÚÜÇ]/),Xe=new Set(["em","a","de","desde","at\xE9","ate","com","sem","por","para","sobre","entre","antes","depois","dentro","fora","ao","do","no","na"]),Kr=[{native:"verdadeiro",normalized:"true"},{native:"falso",normalized:"false"},{native:"nulo",normalized:"null"},{native:"indefinido",normalized:"undefined"},{native:"primeiro",normalized:"first"},{native:"primeira",normalized:"first"},{native:"\xFAltimo",normalized:"last"},{native:"ultima",normalized:"last"},{native:"pr\xF3ximo",normalized:"next"},{native:"proximo",normalized:"next"},{native:"anterior",normalized:"previous"},{native:"mais pr\xF3ximo",normalized:"closest"},{native:"mais proximo",normalized:"closest"},{native:"pai",normalized:"parent"},{native:"clique",normalized:"click"},{native:"click",normalized:"click"},{native:"entrada",normalized:"input"},{native:"mudan\xE7a",normalized:"change"},{native:"mudanca",normalized:"change"},{native:"envio",normalized:"submit"},{native:"tecla baixo",normalized:"keydown"},{native:"tecla cima",normalized:"keyup"},{native:"mouse sobre",normalized:"mouseover"},{native:"mouse fora",normalized:"mouseout"},{native:"foco",normalized:"focus"},{native:"desfoque",normalized:"blur"},{native:"carregar",normalized:"load"},{native:"rolagem",normalized:"scroll"},{native:"meu",normalized:"my"},{native:"minha",normalized:"my"},{native:"isso",normalized:"it"},{native:"segundo",normalized:"s"},{native:"segundos",normalized:"s"},{native:"milissegundo",normalized:"ms"},{native:"milissegundos",normalized:"ms"},{native:"minuto",normalized:"m"},{native:"minutos",normalized:"m"},{native:"hora",normalized:"h"},{native:"horas",normalized:"h"},{native:"senao",normalized:"else"},{native:"transicao",normalized:"transition"},{native:"ate",normalized:"until"},{native:"entao",normalized:"then"},{native:"lancar",normalized:"throw"},{native:"assincrono",normalized:"async"},{native:"padrao",normalized:"default"},{native:"at\xE9 que",normalized:"until"},{native:"dentro de",normalized:"into"}],Gr=[{pattern:"milissegundos",suffix:"ms",length:13,caseInsensitive:true},{pattern:"milissegundo",suffix:"ms",length:12,caseInsensitive:true},{pattern:"segundos",suffix:"s",length:8,caseInsensitive:true},{pattern:"segundo",suffix:"s",length:7,caseInsensitive:true},{pattern:"minutos",suffix:"m",length:7,caseInsensitive:true},{pattern:"minuto",suffix:"m",length:6,caseInsensitive:true},{pattern:"horas",suffix:"h",length:5,caseInsensitive:true},{pattern:"hora",suffix:"h",length:4,caseInsensitive:true}],Hr=class extends Dr{constructor(){super(),this.language="pt",this.direction="ltr",this.initializeKeywordsFromProfile(rt,Kr),this.normalizer=new nt;}tokenize(t){let e=[],n=0;for(;n<t.length;){if(te(t[n])){n++;continue}if(Ze(t[n])){let o=this.tryEventModifier(t,n);if(o){e.push(o),n=o.position.end;continue}if(this.tryPropertyAccess(t,n,e)){n++;continue}let s=this.trySelector(t,n);if(s){e.push(s),n=s.position.end;continue}}if(Ye(t[n])){let o=this.tryString(t,n);if(o){e.push(o),n=o.position.end;continue}}if(Je(t,n)){let o=this.tryUrl(t,n);if(o){e.push(o),n=o.position.end;continue}}if(D(t[n])||t[n]==="-"&&n+1<t.length&&D(t[n+1])){let o=this.extractNumber(t,n);if(o){e.push(o),n=o.position.end;continue}}let r=this.tryVariableRef(t,n);if(r){e.push(r),n=r.position.end;continue}if(Vr(t[n])){let o=this.extractWord(t,n);if(o){e.push(o),n=o.position.end;continue}}let i=this.tryOperator(t,n);if(i){e.push(i),n=i.position.end;continue}n++;}return new Nr(e,"pt")}classifyToken(t){let e=t.toLowerCase();return Xe.has(e)?"particle":this.isKeyword(e)?"keyword":t.startsWith("#")||t.startsWith(".")||t.startsWith("[")||t.startsWith("*")||t.startsWith("<")?"selector":t.startsWith('"')||t.startsWith("'")||/^\d/.test(t)?"literal":"identifier"}extractWord(t,e){let n=e,r="";for(;n<t.length&&Ur(t[n]);)r+=t[n++];if(!r)return null;let i=r.toLowerCase(),o=this.lookupKeyword(i);return o?k(r,"keyword",E(e,n),o.normalized):Xe.has(i)?k(r,"particle",E(e,n)):k(r,"identifier",E(e,n))}extractNumber(t,e){return this.tryNumberWithTimeUnits(t,e,Gr,{allowSign:true,skipWhitespace:true})}},Qr=new Hr;Ar("pt",Qr,rt);var Xr=new Map,Zr=new Map,Yr=new Map;function Jr(t,e,n){Xr.set(t,e),Zr.set(t,n),Yr.delete(t);}var en=class{constructor(t,e){this.pos=0,this.tokens=t,this.language=e;}peek(t=0){let e=this.pos+t;return e<0||e>=this.tokens.length?null:this.tokens[e]}advance(){if(this.isAtEnd())throw new Error("Unexpected end of token stream");return this.tokens[this.pos++]}isAtEnd(){return this.pos>=this.tokens.length}mark(){return {position:this.pos}}reset(t){this.pos=t.position;}position(){return this.pos}remaining(){return this.tokens.slice(this.pos)}takeWhile(t){let e=[];for(;!this.isAtEnd()&&t(this.peek());)e.push(this.advance());return e}skipWhile(t){for(;!this.isAtEnd()&&t(this.peek());)this.advance();}};function b(t,e){return {start:t,end:e}}function z(t,e,n,r){if(typeof r=="string")return {value:t,kind:e,position:n,normalized:r};if(r){let{normalized:i,stem:o,stemConfidence:s}=r;return {value:t,kind:e,position:n,...i!==void 0&&{normalized:i},...o!==void 0&&{stem:o},...s!==void 0&&{stemConfidence:s}}}return {value:t,kind:e,position:n}}function re(t){return /\s/.test(t)}function at(t){return t==="#"||t==="."||t==="["||t==="@"||t==="*"||t==="<"}function lt(t){return t==='"'||t==="'"||t==="`"||t==="\u300C"||t==="\u300D"}function B(t){return /\d/.test(t)}function tn(t){return /[a-zA-Z]/.test(t)}function I(t){return /[a-zA-Z0-9_-]/.test(t)}function rn(t){let e=r=>t.test(r);return {isLetter:e,isIdentifierChar:r=>e(r)||/[0-9_-]/.test(r)}}function nn(t,e){if(e>=t.length)return null;let n=t[e];if(!at(n))return null;let r=e,i="";if(n==="#"||n==="."){for(i+=t[r++];r<t.length&&I(t[r]);)i+=t[r++];if(i.length<=1)return null;if(r<t.length&&t[r]==="."&&n==="#"){let s=r+1;for(;s<t.length&&I(t[s]);)s++;if(s<t.length&&t[s]==="(")return i}}else if(n==="["){let o=1,s=false,a=null,l=false;for(i+=t[r++];r<t.length&&o>0;){let u=t[r];i+=u,l?l=false:u==="\\"?l=true:s?u===a&&(s=false,a=null):u==='"'||u==="'"||u==="`"?(s=true,a=u):u==="["?o++:u==="]"&&o--,r++;}if(o!==0)return null}else if(n==="@"){for(i+=t[r++];r<t.length&&I(t[r]);)i+=t[r++];if(i.length<=1)return null}else if(n==="*"){for(i+=t[r++];r<t.length&&I(t[r]);)i+=t[r++];if(i.length<=1)return null}else if(n==="<"){if(i+=t[r++],r>=t.length||!tn(t[r]))return null;for(;r<t.length&&I(t[r]);)i+=t[r++];for(;r<t.length;){let o=t[r];if(o==="."){if(i+=t[r++],r>=t.length||!I(t[r]))return null;for(;r<t.length&&I(t[r]);)i+=t[r++];}else if(o==="#"){if(i+=t[r++],r>=t.length||!I(t[r]))return null;for(;r<t.length&&I(t[r]);)i+=t[r++];}else if(o==="["){let s=1,a=false,l=null,u=false;for(i+=t[r++];r<t.length&&s>0;){let c=t[r];i+=c,u?u=false:c==="\\"?u=true:a?c===l&&(a=false,l=null):c==='"'||c==="'"||c==="`"?(a=true,l=c):c==="["?s++:c==="]"&&s--,r++;}if(s!==0)return null}else break}for(;r<t.length&&re(t[r]);)i+=t[r++];if(r<t.length&&t[r]==="/")for(i+=t[r++];r<t.length&&re(t[r]);)i+=t[r++];if(r>=t.length||t[r]!==">")return null;i+=t[r++];}return i||null}function on(t,e){if(e>=t.length||t[e]!=="'"||e+1>=t.length||t[e+1].toLowerCase()!=="s")return false;if(e+2>=t.length)return true;let r=t[e+2];return re(r)||r==="*"||!I(r)}function sn(t,e){if(e>=t.length)return null;let n=t[e];if(!lt(n)||n==="'"&&on(t,e))return null;let i={'"':'"',"'":"'","`":"`","\u300C":"\u300D"}[n];if(!i)return null;let o=e+1,s=n,a=false;for(;o<t.length;){let l=t[o];if(s+=l,a)a=false;else if(l==="\\")a=true;else if(l===i)return s;o++;}return s}function ct(t,e){if(e>=t.length)return false;let n=t[e],r=t[e+1]||"",i=t[e+2]||"";if(n==="/"&&r!=="/"&&/[a-zA-Z0-9._-]/.test(r)||n==="/"&&r==="/"&&/[a-zA-Z]/.test(i)||n==="."&&(r==="/"||r==="."&&i==="/"))return true;let o=t.slice(e,e+8).toLowerCase();return !!(o.startsWith("http://")||o.startsWith("https://"))}function an(t,e){if(!ct(t,e))return null;let n=e,r="",i=/[a-zA-Z0-9/:._\-?&=%@+~!$'()*,;[\]]/;for(;n<t.length;){let o=t[n];if(o==="#"){if(r.length>0&&/[a-zA-Z0-9/.]$/.test(r))for(r+=o,n++;n<t.length&&/[a-zA-Z0-9_-]/.test(t[n]);)r+=t[n++];break}if(i.test(o))r+=o,n++;else break}return r.length<2?null:r}function ln(t,e){if(e>=t.length)return null;let n=t[e];if(!B(n)&&n!=="-"&&n!=="+")return null;let r=e,i="";if((t[r]==="-"||t[r]==="+")&&(i+=t[r++]),r>=t.length||!B(t[r]))return null;for(;r<t.length&&B(t[r]);)i+=t[r++];if(r<t.length&&t[r]===".")for(i+=t[r++];r<t.length&&B(t[r]);)i+=t[r++];return r<t.length&&(t.slice(r,r+2)==="ms"?i+="ms":(t[r]==="s"||t[r]==="m"||t[r]==="h")&&(i+=t[r])),i}var ut=class dt{constructor(){this.profileKeywords=[],this.profileKeywordMap=new Map;}tryPropertyAccess(e,n,r){if(e[n]!==".")return false;let i=r[r.length-1],o=i&&i.position.end<n;if(i&&!o&&(i.kind==="identifier"||i.kind==="keyword"||i.kind==="selector"))return r.push(z(".","operator",b(n,n+1))),true;let l=n+1;for(;l<e.length&&I(e[l]);)l++;return l<e.length&&e[l]==="("?(r.push(z(".","operator",b(n,n+1))),true):false}initializeKeywordsFromProfile(e,n=[]){let r=new Map;if(e.keywords){for(let[i,o]of Object.entries(e.keywords))if(r.set(o.primary,{native:o.primary,normalized:o.normalized||i}),o.alternatives)for(let s of o.alternatives)r.set(s,{native:s,normalized:o.normalized||i});}if(e.references){for(let[i,o]of Object.entries(e.references))r.set(o,{native:o,normalized:i});for(let i of Object.keys(e.references))r.has(i)||r.set(i,{native:i,normalized:i});}if(e.roleMarkers){for(let[i,o]of Object.entries(e.roleMarkers))if(o.primary&&r.set(o.primary,{native:o.primary,normalized:i}),o.alternatives)for(let s of o.alternatives)r.set(s,{native:s,normalized:i});}for(let i of n)r.set(i.native,i);this.profileKeywords=Array.from(r.values()).sort((i,o)=>o.native.length-i.native.length),this.profileKeywordMap=new Map;for(let i of this.profileKeywords){this.profileKeywordMap.set(i.native.toLowerCase(),i);let o=this.removeDiacritics(i.native);o!==i.native&&!this.profileKeywordMap.has(o.toLowerCase())&&this.profileKeywordMap.set(o.toLowerCase(),i);}}removeDiacritics(e){return e.replace(/[\u064B-\u0652\u0670]/g,"")}tryProfileKeyword(e,n){for(let r of this.profileKeywords)if(e.slice(n).startsWith(r.native))return z(r.native,"keyword",b(n,n+r.native.length),r.normalized);return null}isKeywordStart(e,n){let r=e.slice(n);return this.profileKeywords.some(i=>r.startsWith(i.native))}lookupKeyword(e){return this.profileKeywordMap.get(e.toLowerCase())}isKeyword(e){return this.profileKeywordMap.has(e.toLowerCase())}setNormalizer(e){this.normalizer=e;}tryNormalize(e){if(!this.normalizer)return null;let n=this.normalizer.normalize(e);return n.stem!==e&&n.confidence>=.7?n:null}tryMorphKeywordMatch(e,n,r){let i=this.tryNormalize(e);if(!i)return null;let o=this.lookupKeyword(i.stem);if(!o)return null;let s={normalized:o.normalized,stem:i.stem,stemConfidence:i.confidence};return z(e,"keyword",b(n,r),s)}trySelector(e,n){let r=nn(e,n);return r?z(r,"selector",b(n,n+r.length)):null}tryEventModifier(e,n){if(e[n]!==".")return null;let r=e.slice(n).match(/^\.(?:once|debounce|throttle|queue)(?:\(([^)]+)\))?(?:\s|$|\.)/);if(!r)return null;let i=r[0].replace(/(\s|\.)$/,""),o=i.slice(1).split("(")[0],s=r[1];return {...z(i,"event-modifier",b(n,n+i.length)),metadata:{modifierName:o,value:s?o==="queue"?s:parseInt(s,10):void 0}}}tryString(e,n){let r=sn(e,n);return r?z(r,"literal",b(n,n+r.length)):null}tryNumber(e,n){let r=ln(e,n);return r?z(r,"literal",b(n,n+r.length)):null}tryMatchTimeUnit(e,n,r,i=false){let o=n;if(i)for(;o<e.length&&re(e[o]);)o++;let s=e.slice(o);for(let a of r){let l=s.slice(0,a.length);if(a.caseInsensitive?l.toLowerCase()===a.pattern.toLowerCase():l===a.pattern){if(a.notFollowedBy&&(s[a.length]||"")===a.notFollowedBy)continue;if(a.checkBoundary){let c=s[a.length]||"";if(I(c))continue}return {suffix:a.suffix,endPos:o+a.length}}}return null}parseBaseNumber(e,n,r=true){let i=n,o="";if(r&&(e[i]==="-"||e[i]==="+")&&(o+=e[i++]),i>=e.length||!B(e[i]))return null;for(;i<e.length&&B(e[i]);)o+=e[i++];if(i<e.length&&e[i]===".")for(o+=e[i++];i<e.length&&B(e[i]);)o+=e[i++];return !o||o==="-"||o==="+"?null:{number:o,endPos:i}}tryNumberWithTimeUnits(e,n,r,i={}){let{allowSign:o=true,skipWhitespace:s=false}=i,a=this.parseBaseNumber(e,n,o);if(!a)return null;let{number:l,endPos:u}=a,c=[...r,...dt.STANDARD_TIME_UNITS],d=this.tryMatchTimeUnit(e,u,c,s);return d&&(l+=d.suffix,u=d.endPos),z(l,"literal",b(n,u))}tryUrl(e,n){let r=an(e,n);return r?z(r,"url",b(n,n+r.length)):null}tryVariableRef(e,n){if(e[n]!==":"||n+1>=e.length||!I(e[n+1]))return null;let r=n+1;for(;r<e.length&&I(e[r]);)r++;let i=e.slice(n,r);return z(i,"identifier",b(n,r))}tryOperator(e,n){let r=e.slice(n,n+2);if(["==","!=","<=",">=","&&","||","->"].includes(r))return z(r,"operator",b(n,n+2));let i=e[n];return ["<",">","!","+","-","*","/","="].includes(i)?z(i,"operator",b(n,n+1)):["(",")","{","}",",",";",":"].includes(i)?z(i,"punctuation",b(n,n+1)):null}tryMultiCharParticle(e,n,r){for(let i of r)if(e.slice(n,n+i.length)===i)return z(i,"particle",b(n,n+i.length));return null}};ut.STANDARD_TIME_UNITS=[{pattern:"ms",suffix:"ms",length:2},{pattern:"s",suffix:"s",length:1,checkBoundary:true},{pattern:"m",suffix:"m",length:1,checkBoundary:true,notFollowedBy:"s"},{pattern:"h",suffix:"h",length:1,checkBoundary:true}];var cn=ut,mt={code:"fr",name:"French",nativeName:"Fran\xE7ais",direction:"ltr",wordOrder:"SVO",markingStrategy:"preposition",usesSpaces:true,defaultVerbForm:"infinitive",verb:{position:"start",subjectDrop:false},references:{me:"moi",it:"il",you:"toi",result:"r\xE9sultat",event:"\xE9v\xE9nement",target:"cible",body:"corps"},possessive:{marker:"de",markerPosition:"before-property",usePossessiveAdjectives:true,specialForms:{me:"ma",it:"sa",you:"ta"},keywords:{mon:"me",ma:"me",mes:"me",ton:"you",ta:"you",tes:"you",son:"it",sa:"it",ses:"it"}},roleMarkers:{destination:{primary:"sur",alternatives:["\xE0","dans"],position:"before"},source:{primary:"de",alternatives:["depuis"],position:"before"},patient:{primary:"",position:"before"},style:{primary:"avec",position:"before"}},keywords:{toggle:{primary:"basculer",alternatives:["permuter","alterner"],normalized:"toggle"},add:{primary:"ajouter",normalized:"add"},remove:{primary:"supprimer",alternatives:["enlever","retirer"],normalized:"remove"},put:{primary:"mettre",alternatives:["placer"],normalized:"put"},append:{primary:"annexer",normalized:"append"},prepend:{primary:"pr\xE9fixer",normalized:"prepend"},take:{primary:"prendre",normalized:"take"},make:{primary:"faire",alternatives:["cr\xE9er"],normalized:"make"},clone:{primary:"cloner",alternatives:["copier"],normalized:"clone"},swap:{primary:"\xE9changer",alternatives:["permuter"],normalized:"swap"},morph:{primary:"transformer",alternatives:["m\xE9tamorphoser"],normalized:"morph"},set:{primary:"d\xE9finir",alternatives:["\xE9tablir"],normalized:"set"},get:{primary:"obtenir",normalized:"get"},increment:{primary:"incr\xE9menter",alternatives:["augmenter"],normalized:"increment"},decrement:{primary:"d\xE9cr\xE9menter",alternatives:["diminuer"],normalized:"decrement"},log:{primary:"enregistrer",alternatives:["afficher"],normalized:"log"},show:{primary:"montrer",alternatives:["afficher"],normalized:"show"},hide:{primary:"cacher",alternatives:["masquer"],normalized:"hide"},transition:{primary:"transition",alternatives:["animer"],normalized:"transition"},on:{primary:"sur",alternatives:["quand","lors"],normalized:"on"},trigger:{primary:"d\xE9clencher",normalized:"trigger"},send:{primary:"envoyer",normalized:"send"},focus:{primary:"focaliser",alternatives:["concentrer"],normalized:"focus"},blur:{primary:"d\xE9focaliser",normalized:"blur"},go:{primary:"aller",alternatives:["naviguer"],normalized:"go"},wait:{primary:"attendre",normalized:"wait"},fetch:{primary:"chercher",alternatives:["r\xE9cup\xE9rer"],normalized:"fetch"},settle:{primary:"stabiliser",normalized:"settle"},if:{primary:"si",normalized:"if"},when:{primary:"quand",normalized:"when"},where:{primary:"o\xF9",normalized:"where"},else:{primary:"sinon",normalized:"else"},repeat:{primary:"r\xE9p\xE9ter",normalized:"repeat"},for:{primary:"pour",normalized:"for"},while:{primary:"pendant",normalized:"while"},continue:{primary:"continuer",normalized:"continue"},halt:{primary:"arr\xEAter",alternatives:["stopper"],normalized:"halt"},throw:{primary:"lancer",normalized:"throw"},call:{primary:"appeler",normalized:"call"},return:{primary:"retourner",alternatives:["renvoyer"],normalized:"return"},then:{primary:"puis",alternatives:["ensuite","alors"],normalized:"then"},and:{primary:"et",alternatives:["aussi","\xE9galement"],normalized:"and"},end:{primary:"fin",alternatives:["terminer","finir"],normalized:"end"},js:{primary:"js",normalized:"js"},async:{primary:"asynchrone",normalized:"async"},tell:{primary:"dire",normalized:"tell"},default:{primary:"d\xE9faut",normalized:"default"},init:{primary:"initialiser",normalized:"init"},behavior:{primary:"comportement",normalized:"behavior"},install:{primary:"installer",normalized:"install"},measure:{primary:"mesurer",normalized:"measure"},beep:{primary:"bip",normalized:"beep"},break:{primary:"arr\xEAter",normalized:"break"},copy:{primary:"copier",normalized:"copy"},exit:{primary:"sortir",normalized:"exit"},pick:{primary:"choisir",normalized:"pick"},render:{primary:"rendu",normalized:"render"},into:{primary:"dans",normalized:"into"},before:{primary:"avant",normalized:"before"},after:{primary:"apr\xE8s",normalized:"after"},click:{primary:"clic",alternatives:["clique"],normalized:"click"},hover:{primary:"survol",alternatives:["survoler"],normalized:"hover"},submit:{primary:"soumission",alternatives:["soumettre"],normalized:"submit"},input:{primary:"saisie",alternatives:["entr\xE9e"],normalized:"input"},change:{primary:"changement",alternatives:["modifier"],normalized:"change"},until:{primary:"jusqu'\xE0",alternatives:["jusque"],normalized:"until"},event:{primary:"\xE9v\xE9nement",normalized:"event"},from:{primary:"de",alternatives:["depuis"],normalized:"from"}},eventHandler:{keyword:{primary:"sur",alternatives:["lors"],normalized:"on"},sourceMarker:{primary:"de",alternatives:["depuis"],position:"before"},conditionalKeyword:{primary:"quand",alternatives:["lorsque"]},eventMarker:{primary:"au",alternatives:["lors du","lors de"],position:"before"},temporalMarkers:["quand","lorsque"]}};function it(t){return {stem:t,confidence:1}}function ot(t,e,n){return n?{stem:t,confidence:e,metadata:n}:{stem:t,confidence:e}}function un(t){let e=t.toLowerCase();return !!(e.endsWith("er")||e.endsWith("ir")||e.endsWith("re")||e.endsWith("ant")||e.endsWith("\xE9")||e.endsWith("i")||e.endsWith("u")||/[àâäéèêëïîôùûüÿçœæ]/i.test(t))}var dn=["toi","vous","nous"],mn=[{ending:"ant",stem:"er",confidence:.88,type:"gerund"},{ending:"\xE9",stem:"er",confidence:.88,type:"participle"},{ending:"\xE9e",stem:"er",confidence:.88,type:"participle"},{ending:"\xE9s",stem:"er",confidence:.88,type:"participle"},{ending:"\xE9es",stem:"er",confidence:.88,type:"participle"},{ending:"e",stem:"er",confidence:.75,type:"present"},{ending:"es",stem:"er",confidence:.78,type:"present"},{ending:"ons",stem:"er",confidence:.85,type:"present"},{ending:"ez",stem:"er",confidence:.85,type:"present"},{ending:"ent",stem:"er",confidence:.82,type:"present"},{ending:"ais",stem:"er",confidence:.82,type:"past"},{ending:"ait",stem:"er",confidence:.82,type:"past"},{ending:"ions",stem:"er",confidence:.85,type:"past"},{ending:"iez",stem:"er",confidence:.85,type:"past"},{ending:"aient",stem:"er",confidence:.85,type:"past"},{ending:"ai",stem:"er",confidence:.8,type:"past"},{ending:"as",stem:"er",confidence:.78,type:"past"},{ending:"a",stem:"er",confidence:.75,type:"past"},{ending:"\xE2mes",stem:"er",confidence:.88,type:"past"},{ending:"\xE2tes",stem:"er",confidence:.88,type:"past"},{ending:"\xE8rent",stem:"er",confidence:.88,type:"past"},{ending:"erai",stem:"er",confidence:.85,type:"future"},{ending:"eras",stem:"er",confidence:.85,type:"future"},{ending:"era",stem:"er",confidence:.82,type:"future"},{ending:"erons",stem:"er",confidence:.88,type:"future"},{ending:"erez",stem:"er",confidence:.88,type:"future"},{ending:"eront",stem:"er",confidence:.88,type:"future"},{ending:"erais",stem:"er",confidence:.85,type:"conditional"},{ending:"erait",stem:"er",confidence:.85,type:"conditional"},{ending:"erions",stem:"er",confidence:.88,type:"conditional"},{ending:"eriez",stem:"er",confidence:.88,type:"conditional"},{ending:"eraient",stem:"er",confidence:.88,type:"conditional"},{ending:"ions",stem:"er",confidence:.8,type:"subjunctive"},{ending:"iez",stem:"er",confidence:.8,type:"subjunctive"},{ending:"ons",stem:"er",confidence:.82,type:"imperative"},{ending:"ez",stem:"er",confidence:.82,type:"imperative"},{ending:"er",stem:"er",confidence:.92,type:"dictionary"}],pn=[{ending:"issant",stem:"ir",confidence:.88,type:"gerund"},{ending:"i",stem:"ir",confidence:.8,type:"participle"},{ending:"ie",stem:"ir",confidence:.82,type:"participle"},{ending:"is",stem:"ir",confidence:.78,type:"participle"},{ending:"ies",stem:"ir",confidence:.82,type:"participle"},{ending:"is",stem:"ir",confidence:.78,type:"present"},{ending:"it",stem:"ir",confidence:.78,type:"present"},{ending:"issons",stem:"ir",confidence:.88,type:"present"},{ending:"issez",stem:"ir",confidence:.88,type:"present"},{ending:"issent",stem:"ir",confidence:.88,type:"present"},{ending:"issais",stem:"ir",confidence:.85,type:"past"},{ending:"issait",stem:"ir",confidence:.85,type:"past"},{ending:"issions",stem:"ir",confidence:.88,type:"past"},{ending:"issiez",stem:"ir",confidence:.88,type:"past"},{ending:"issaient",stem:"ir",confidence:.88,type:"past"},{ending:"irai",stem:"ir",confidence:.85,type:"future"},{ending:"iras",stem:"ir",confidence:.85,type:"future"},{ending:"ira",stem:"ir",confidence:.82,type:"future"},{ending:"irons",stem:"ir",confidence:.88,type:"future"},{ending:"irez",stem:"ir",confidence:.88,type:"future"},{ending:"iront",stem:"ir",confidence:.88,type:"future"},{ending:"ir",stem:"ir",confidence:.9,type:"dictionary"}],fn=[{ending:"ant",stem:"re",confidence:.82,type:"gerund"},{ending:"u",stem:"re",confidence:.8,type:"participle"},{ending:"ue",stem:"re",confidence:.82,type:"participle"},{ending:"us",stem:"re",confidence:.82,type:"participle"},{ending:"ues",stem:"re",confidence:.82,type:"participle"},{ending:"s",stem:"re",confidence:.72,type:"present"},{ending:"d",stem:"re",confidence:.75,type:"present"},{ending:"ons",stem:"re",confidence:.82,type:"present"},{ending:"ez",stem:"re",confidence:.82,type:"present"},{ending:"ent",stem:"re",confidence:.8,type:"present"},{ending:"re",stem:"re",confidence:.9,type:"dictionary"}],hn=[...mn,...pn,...fn].sort((t,e)=>e.ending.length-t.ending.length),pt=class{constructor(){this.language="fr";}isNormalizable(t){return t.length<3?false:un(t)}normalize(t){let e=t.toLowerCase();if((e.endsWith("er")||e.endsWith("ir")||e.endsWith("re"))&&e.length>=4)return it(t);let n=this.tryReflexiveNormalization(e);if(n)return n;let r=this.tryConjugationNormalization(e);return r||it(t)}tryReflexiveNormalization(t){for(let e of dn){let n="-"+e;if(t.endsWith(n)){let r=t.slice(0,-n.length),i=this.tryConjugationNormalization(r);if(i&&i.stem!==r)return ot(i.stem,i.confidence*.95,{removedSuffixes:[n,...i.metadata?.removedSuffixes||[]],conjugationType:"reflexive"})}}return null}tryConjugationNormalization(t){for(let e of hn)if(t.endsWith(e.ending)){let n=t.slice(0,-e.ending.length);if(n.length<2)continue;let r=n+e.stem;return ot(r,e.confidence,{removedSuffixes:[e.ending],conjugationType:e.type})}return null}},{isLetter:vn,isIdentifierChar:yn}=rn(/[a-zA-ZàâäéèêëîïôùûüçœæÀÂÄÉÈÊËÎÏÔÙÛÜÇŒÆ]/),st=new Set(["\xE0","a","de","du","des","dans","sur","sous","avec","sans","par","pour","entre","avant","apr\xE8s","apres","depuis","vers","chez","contre","au","aux"]),gn=[{native:"vrai",normalized:"true"},{native:"faux",normalized:"false"},{native:"nul",normalized:"null"},{native:"ind\xE9fini",normalized:"undefined"},{native:"indefini",normalized:"undefined"},{native:"premier",normalized:"first"},{native:"premi\xE8re",normalized:"first"},{native:"premiere",normalized:"first"},{native:"dernier",normalized:"last"},{native:"derni\xE8re",normalized:"last"},{native:"derniere",normalized:"last"},{native:"suivant",normalized:"next"},{native:"pr\xE9c\xE9dent",normalized:"previous"},{native:"precedent",normalized:"previous"},{native:"plus proche",normalized:"closest"},{native:"parent",normalized:"parent"},{native:"clic",normalized:"click"},{native:"click",normalized:"click"},{native:"entr\xE9e",normalized:"input"},{native:"entree",normalized:"input"},{native:"changement",normalized:"change"},{native:"soumission",normalized:"submit"},{native:"touche bas",normalized:"keydown"},{native:"touche haut",normalized:"keyup"},{native:"souris dessus",normalized:"mouseover"},{native:"souris dehors",normalized:"mouseout"},{native:"focus",normalized:"focus"},{native:"flou",normalized:"blur"},{native:"chargement",normalized:"load"},{native:"d\xE9filement",normalized:"scroll"},{native:"defilement",normalized:"scroll"},{native:"je",normalized:"me"},{native:"mon",normalized:"my"},{native:"ma",normalized:"my"},{native:"mes",normalized:"my"},{native:"\xE7a",normalized:"it"},{native:"ca",normalized:"it"},{native:"resultat",normalized:"result"},{native:"evenement",normalized:"event"},{native:"seconde",normalized:"s"},{native:"secondes",normalized:"s"},{native:"milliseconde",normalized:"ms"},{native:"millisecondes",normalized:"ms"},{native:"minute",normalized:"m"},{native:"minutes",normalized:"m"},{native:"heure",normalized:"h"},{native:"heures",normalized:"h"},{native:"prefixer",normalized:"prepend"},{native:"creer",normalized:"make"},{native:"definir",normalized:"set"},{native:"etablir",normalized:"set"},{native:"incrementer",normalized:"increment"},{native:"decrementer",normalized:"decrement"},{native:"declencher",normalized:"trigger"},{native:"defocaliser",normalized:"blur"},{native:"recuperer",normalized:"fetch"},{native:"repeter",normalized:"repeat"},{native:"arreter",normalized:"halt"},{native:"defaut",normalized:"default"},{native:"jusqua",normalized:"until"},{native:"apres",normalized:"after"},{native:"journaliser",normalized:"log"},{native:"transmuter",normalized:"morph"},{native:"tant que",normalized:"while"}],wn=[{pattern:"millisecondes",suffix:"ms",length:13,caseInsensitive:true},{pattern:"milliseconde",suffix:"ms",length:12,caseInsensitive:true},{pattern:"secondes",suffix:"s",length:8,caseInsensitive:true},{pattern:"seconde",suffix:"s",length:7,caseInsensitive:true},{pattern:"minutes",suffix:"m",length:7,caseInsensitive:true},{pattern:"minute",suffix:"m",length:6,caseInsensitive:true},{pattern:"heures",suffix:"h",length:6,caseInsensitive:true},{pattern:"heure",suffix:"h",length:5,caseInsensitive:true}],En=class extends cn{constructor(){super(),this.language="fr",this.direction="ltr",this.initializeKeywordsFromProfile(mt,gn),this.normalizer=new pt;}tokenize(t){let e=[],n=0;for(;n<t.length;){if(re(t[n])){n++;continue}if(at(t[n])){let o=this.tryEventModifier(t,n);if(o){e.push(o),n=o.position.end;continue}if(this.tryPropertyAccess(t,n,e)){n++;continue}let s=this.trySelector(t,n);if(s){e.push(s),n=s.position.end;continue}}if(lt(t[n])){let o=this.tryString(t,n);if(o){e.push(o),n=o.position.end;continue}}if(ct(t,n)){let o=this.tryUrl(t,n);if(o){e.push(o),n=o.position.end;continue}}if(B(t[n])||t[n]==="-"&&n+1<t.length&&B(t[n+1])){let o=this.extractNumber(t,n);if(o){e.push(o),n=o.position.end;continue}}let r=this.tryVariableRef(t,n);if(r){e.push(r),n=r.position.end;continue}if(vn(t[n])){let o=this.extractWord(t,n);if(o){e.push(o),n=o.position.end;continue}}let i=this.tryOperator(t,n);if(i){e.push(i),n=i.position.end;continue}n++;}return new en(e,"fr")}classifyToken(t){let e=t.toLowerCase();return st.has(e)?"particle":this.isKeyword(e)?"keyword":t.startsWith("#")||t.startsWith(".")||t.startsWith("[")||t.startsWith("*")||t.startsWith("<")?"selector":t.startsWith('"')||t.startsWith("'")||/^\d/.test(t)?"literal":"identifier"}extractWord(t,e){let n=e,r="";for(;n<t.length&&yn(t[n]);)r+=t[n++];if(!r)return null;let i=r.toLowerCase(),o=this.lookupKeyword(i);return o?z(r,"keyword",b(e,n),o.normalized):st.has(i)?z(r,"particle",b(e,n)):z(r,"identifier",b(e,n))}extractNumber(t,e){return this.tryNumberWithTimeUnits(t,e,wn,{allowSign:true,skipWhitespace:true})}},kn=new En;Jr("fr",kn,mt);var bn=new Map,zn=new Map,Tn=new Map;function Sn(t,e,n){bn.set(t,e),zn.set(t,n),Tn.delete(t);}var xn=class{constructor(t,e){this.pos=0,this.tokens=t,this.language=e;}peek(t=0){let e=this.pos+t;return e<0||e>=this.tokens.length?null:this.tokens[e]}advance(){if(this.isAtEnd())throw new Error("Unexpected end of token stream");return this.tokens[this.pos++]}isAtEnd(){return this.pos>=this.tokens.length}mark(){return {position:this.pos}}reset(t){this.pos=t.position;}position(){return this.pos}remaining(){return this.tokens.slice(this.pos)}takeWhile(t){let e=[];for(;!this.isAtEnd()&&t(this.peek());)e.push(this.advance());return e}skipWhile(t){for(;!this.isAtEnd()&&t(this.peek());)this.advance();}};function T(t,e){return {start:t,end:e}}function S(t,e,n,r){if(typeof r=="string")return {value:t,kind:e,position:n,normalized:r};if(r){let{normalized:i,stem:o,stemConfidence:s}=r;return {value:t,kind:e,position:n,...i!==void 0&&{normalized:i},...o!==void 0&&{stem:o},...s!==void 0&&{stemConfidence:s}}}return {value:t,kind:e,position:n}}function ne(t){return /\s/.test(t)}function ht(t){return t==="#"||t==="."||t==="["||t==="@"||t==="*"||t==="<"}function vt(t){return t==='"'||t==="'"||t==="`"||t==="\u300C"||t==="\u300D"}function W(t){return /\d/.test(t)}function Cn(t){return /[a-zA-Z]/.test(t)}function _(t){return /[a-zA-Z0-9_-]/.test(t)}function An(t){let e=r=>t.test(r);return {isLetter:e,isIdentifierChar:r=>e(r)||/[0-9_-]/.test(r)}}function Nn(t,e){if(e>=t.length)return null;let n=t[e];if(!ht(n))return null;let r=e,i="";if(n==="#"||n==="."){for(i+=t[r++];r<t.length&&_(t[r]);)i+=t[r++];if(i.length<=1)return null;if(r<t.length&&t[r]==="."&&n==="#"){let s=r+1;for(;s<t.length&&_(t[s]);)s++;if(s<t.length&&t[s]==="(")return i}}else if(n==="["){let o=1,s=false,a=null,l=false;for(i+=t[r++];r<t.length&&o>0;){let u=t[r];i+=u,l?l=false:u==="\\"?l=true:s?u===a&&(s=false,a=null):u==='"'||u==="'"||u==="`"?(s=true,a=u):u==="["?o++:u==="]"&&o--,r++;}if(o!==0)return null}else if(n==="@"){for(i+=t[r++];r<t.length&&_(t[r]);)i+=t[r++];if(i.length<=1)return null}else if(n==="*"){for(i+=t[r++];r<t.length&&_(t[r]);)i+=t[r++];if(i.length<=1)return null}else if(n==="<"){if(i+=t[r++],r>=t.length||!Cn(t[r]))return null;for(;r<t.length&&_(t[r]);)i+=t[r++];for(;r<t.length;){let o=t[r];if(o==="."){if(i+=t[r++],r>=t.length||!_(t[r]))return null;for(;r<t.length&&_(t[r]);)i+=t[r++];}else if(o==="#"){if(i+=t[r++],r>=t.length||!_(t[r]))return null;for(;r<t.length&&_(t[r]);)i+=t[r++];}else if(o==="["){let s=1,a=false,l=null,u=false;for(i+=t[r++];r<t.length&&s>0;){let c=t[r];i+=c,u?u=false:c==="\\"?u=true:a?c===l&&(a=false,l=null):c==='"'||c==="'"||c==="`"?(a=true,l=c):c==="["?s++:c==="]"&&s--,r++;}if(s!==0)return null}else break}for(;r<t.length&&ne(t[r]);)i+=t[r++];if(r<t.length&&t[r]==="/")for(i+=t[r++];r<t.length&&ne(t[r]);)i+=t[r++];if(r>=t.length||t[r]!==">")return null;i+=t[r++];}return i||null}function Rn(t,e){if(e>=t.length||t[e]!=="'"||e+1>=t.length||t[e+1].toLowerCase()!=="s")return false;if(e+2>=t.length)return true;let r=t[e+2];return ne(r)||r==="*"||!_(r)}function Pn(t,e){if(e>=t.length)return null;let n=t[e];if(!vt(n)||n==="'"&&Rn(t,e))return null;let i={'"':'"',"'":"'","`":"`","\u300C":"\u300D"}[n];if(!i)return null;let o=e+1,s=n,a=false;for(;o<t.length;){let l=t[o];if(s+=l,a)a=false;else if(l==="\\")a=true;else if(l===i)return s;o++;}return s}function yt(t,e){if(e>=t.length)return false;let n=t[e],r=t[e+1]||"",i=t[e+2]||"";if(n==="/"&&r!=="/"&&/[a-zA-Z0-9._-]/.test(r)||n==="/"&&r==="/"&&/[a-zA-Z]/.test(i)||n==="."&&(r==="/"||r==="."&&i==="/"))return true;let o=t.slice(e,e+8).toLowerCase();return !!(o.startsWith("http://")||o.startsWith("https://"))}function In(t,e){if(!yt(t,e))return null;let n=e,r="",i=/[a-zA-Z0-9/:._\-?&=%@+~!$'()*,;[\]]/;for(;n<t.length;){let o=t[n];if(o==="#"){if(r.length>0&&/[a-zA-Z0-9/.]$/.test(r))for(r+=o,n++;n<t.length&&/[a-zA-Z0-9_-]/.test(t[n]);)r+=t[n++];break}if(i.test(o))r+=o,n++;else break}return r.length<2?null:r}function _n(t,e){if(e>=t.length)return null;let n=t[e];if(!W(n)&&n!=="-"&&n!=="+")return null;let r=e,i="";if((t[r]==="-"||t[r]==="+")&&(i+=t[r++]),r>=t.length||!W(t[r]))return null;for(;r<t.length&&W(t[r]);)i+=t[r++];if(r<t.length&&t[r]===".")for(i+=t[r++];r<t.length&&W(t[r]);)i+=t[r++];return r<t.length&&(t.slice(r,r+2)==="ms"?i+="ms":(t[r]==="s"||t[r]==="m"||t[r]==="h")&&(i+=t[r])),i}var gt=class wt{constructor(){this.profileKeywords=[],this.profileKeywordMap=new Map;}tryPropertyAccess(e,n,r){if(e[n]!==".")return false;let i=r[r.length-1],o=i&&i.position.end<n;if(i&&!o&&(i.kind==="identifier"||i.kind==="keyword"||i.kind==="selector"))return r.push(S(".","operator",T(n,n+1))),true;let l=n+1;for(;l<e.length&&_(e[l]);)l++;return l<e.length&&e[l]==="("?(r.push(S(".","operator",T(n,n+1))),true):false}initializeKeywordsFromProfile(e,n=[]){let r=new Map;if(e.keywords){for(let[i,o]of Object.entries(e.keywords))if(r.set(o.primary,{native:o.primary,normalized:o.normalized||i}),o.alternatives)for(let s of o.alternatives)r.set(s,{native:s,normalized:o.normalized||i});}if(e.references){for(let[i,o]of Object.entries(e.references))r.set(o,{native:o,normalized:i});for(let i of Object.keys(e.references))r.has(i)||r.set(i,{native:i,normalized:i});}if(e.roleMarkers){for(let[i,o]of Object.entries(e.roleMarkers))if(o.primary&&r.set(o.primary,{native:o.primary,normalized:i}),o.alternatives)for(let s of o.alternatives)r.set(s,{native:s,normalized:i});}for(let i of n)r.set(i.native,i);this.profileKeywords=Array.from(r.values()).sort((i,o)=>o.native.length-i.native.length),this.profileKeywordMap=new Map;for(let i of this.profileKeywords){this.profileKeywordMap.set(i.native.toLowerCase(),i);let o=this.removeDiacritics(i.native);o!==i.native&&!this.profileKeywordMap.has(o.toLowerCase())&&this.profileKeywordMap.set(o.toLowerCase(),i);}}removeDiacritics(e){return e.replace(/[\u064B-\u0652\u0670]/g,"")}tryProfileKeyword(e,n){for(let r of this.profileKeywords)if(e.slice(n).startsWith(r.native))return S(r.native,"keyword",T(n,n+r.native.length),r.normalized);return null}isKeywordStart(e,n){let r=e.slice(n);return this.profileKeywords.some(i=>r.startsWith(i.native))}lookupKeyword(e){return this.profileKeywordMap.get(e.toLowerCase())}isKeyword(e){return this.profileKeywordMap.has(e.toLowerCase())}setNormalizer(e){this.normalizer=e;}tryNormalize(e){if(!this.normalizer)return null;let n=this.normalizer.normalize(e);return n.stem!==e&&n.confidence>=.7?n:null}tryMorphKeywordMatch(e,n,r){let i=this.tryNormalize(e);if(!i)return null;let o=this.lookupKeyword(i.stem);if(!o)return null;let s={normalized:o.normalized,stem:i.stem,stemConfidence:i.confidence};return S(e,"keyword",T(n,r),s)}trySelector(e,n){let r=Nn(e,n);return r?S(r,"selector",T(n,n+r.length)):null}tryEventModifier(e,n){if(e[n]!==".")return null;let r=e.slice(n).match(/^\.(?:once|debounce|throttle|queue)(?:\(([^)]+)\))?(?:\s|$|\.)/);if(!r)return null;let i=r[0].replace(/(\s|\.)$/,""),o=i.slice(1).split("(")[0],s=r[1];return {...S(i,"event-modifier",T(n,n+i.length)),metadata:{modifierName:o,value:s?o==="queue"?s:parseInt(s,10):void 0}}}tryString(e,n){let r=Pn(e,n);return r?S(r,"literal",T(n,n+r.length)):null}tryNumber(e,n){let r=_n(e,n);return r?S(r,"literal",T(n,n+r.length)):null}tryMatchTimeUnit(e,n,r,i=false){let o=n;if(i)for(;o<e.length&&ne(e[o]);)o++;let s=e.slice(o);for(let a of r){let l=s.slice(0,a.length);if(a.caseInsensitive?l.toLowerCase()===a.pattern.toLowerCase():l===a.pattern){if(a.notFollowedBy&&(s[a.length]||"")===a.notFollowedBy)continue;if(a.checkBoundary){let c=s[a.length]||"";if(_(c))continue}return {suffix:a.suffix,endPos:o+a.length}}}return null}parseBaseNumber(e,n,r=true){let i=n,o="";if(r&&(e[i]==="-"||e[i]==="+")&&(o+=e[i++]),i>=e.length||!W(e[i]))return null;for(;i<e.length&&W(e[i]);)o+=e[i++];if(i<e.length&&e[i]===".")for(o+=e[i++];i<e.length&&W(e[i]);)o+=e[i++];return !o||o==="-"||o==="+"?null:{number:o,endPos:i}}tryNumberWithTimeUnits(e,n,r,i={}){let{allowSign:o=true,skipWhitespace:s=false}=i,a=this.parseBaseNumber(e,n,o);if(!a)return null;let{number:l,endPos:u}=a,c=[...r,...wt.STANDARD_TIME_UNITS],d=this.tryMatchTimeUnit(e,u,c,s);return d&&(l+=d.suffix,u=d.endPos),S(l,"literal",T(n,u))}tryUrl(e,n){let r=In(e,n);return r?S(r,"url",T(n,n+r.length)):null}tryVariableRef(e,n){if(e[n]!==":"||n+1>=e.length||!_(e[n+1]))return null;let r=n+1;for(;r<e.length&&_(e[r]);)r++;let i=e.slice(n,r);return S(i,"identifier",T(n,r))}tryOperator(e,n){let r=e.slice(n,n+2);if(["==","!=","<=",">=","&&","||","->"].includes(r))return S(r,"operator",T(n,n+2));let i=e[n];return ["<",">","!","+","-","*","/","="].includes(i)?S(i,"operator",T(n,n+1)):["(",")","{","}",",",";",":"].includes(i)?S(i,"punctuation",T(n,n+1)):null}tryMultiCharParticle(e,n,r){for(let i of r)if(e.slice(n,n+i.length)===i)return S(i,"particle",T(n,n+i.length));return null}};gt.STANDARD_TIME_UNITS=[{pattern:"ms",suffix:"ms",length:2},{pattern:"s",suffix:"s",length:1,checkBoundary:true},{pattern:"m",suffix:"m",length:1,checkBoundary:true,notFollowedBy:"s"},{pattern:"h",suffix:"h",length:1,checkBoundary:true}];var Mn=gt,Et={code:"de",name:"German",nativeName:"Deutsch",direction:"ltr",wordOrder:"SVO",markingStrategy:"preposition",usesSpaces:true,defaultVerbForm:"infinitive",verb:{position:"start",subjectDrop:false},references:{me:"ich",it:"es",you:"du",result:"Ergebnis",event:"Ereignis",target:"Ziel",body:"K\xF6rper"},possessive:{marker:"",markerPosition:"before-property",usePossessiveAdjectives:true,specialForms:{me:"mein",it:"sein",you:"dein"},keywords:{mein:"me",meine:"me",meinen:"me",dein:"you",deine:"you",deinen:"you",sein:"it",seine:"it",seinen:"it"}},roleMarkers:{destination:{primary:"auf",alternatives:["zu","in"],position:"before"},source:{primary:"von",alternatives:["aus"],position:"before"},patient:{primary:"",position:"before"},style:{primary:"mit",position:"before"}},keywords:{toggle:{primary:"umschalten",alternatives:["wechseln"],normalized:"toggle"},add:{primary:"hinzuf\xFCgen",normalized:"add"},remove:{primary:"entfernen",alternatives:["l\xF6schen"],normalized:"remove"},put:{primary:"setzen",alternatives:["stellen","platzieren"],normalized:"put"},append:{primary:"anh\xE4ngen",normalized:"append"},prepend:{primary:"voranstellen",normalized:"prepend"},take:{primary:"nehmen",normalized:"take"},make:{primary:"machen",alternatives:["erstellen","erzeugen"],normalized:"make"},clone:{primary:"klonen",alternatives:["kopieren"],normalized:"clone"},swap:{primary:"austauschen",alternatives:["tauschen","wechseln"],normalized:"swap"},morph:{primary:"verwandeln",alternatives:["transformieren"],normalized:"morph"},set:{primary:"festlegen",alternatives:["definieren"],normalized:"set"},get:{primary:"holen",alternatives:["bekommen"],normalized:"get"},increment:{primary:"erh\xF6hen",normalized:"increment"},decrement:{primary:"verringern",alternatives:["vermindern"],normalized:"decrement"},log:{primary:"protokollieren",alternatives:["ausgeben"],normalized:"log"},show:{primary:"zeigen",alternatives:["anzeigen"],normalized:"show"},hide:{primary:"verbergen",alternatives:["verstecken"],normalized:"hide"},transition:{primary:"\xFCbergang",alternatives:["animieren"],normalized:"transition"},on:{primary:"bei",alternatives:["wenn","auf"],normalized:"on"},trigger:{primary:"ausl\xF6sen",normalized:"trigger"},send:{primary:"senden",alternatives:["schicken"],normalized:"send"},focus:{primary:"fokussieren",normalized:"focus"},blur:{primary:"defokussieren",alternatives:["entfokussieren"],normalized:"blur"},go:{primary:"gehen",alternatives:["navigieren"],normalized:"go"},wait:{primary:"warten",normalized:"wait"},fetch:{primary:"abrufen",alternatives:["laden"],normalized:"fetch"},settle:{primary:"stabilisieren",normalized:"settle"},if:{primary:"wenn",alternatives:["falls"],normalized:"if"},when:{primary:"wenn",normalized:"when"},where:{primary:"wo",normalized:"where"},else:{primary:"sonst",alternatives:["ansonsten"],normalized:"else"},repeat:{primary:"wiederholen",normalized:"repeat"},for:{primary:"f\xFCr",normalized:"for"},while:{primary:"solange",alternatives:["w\xE4hrend"],normalized:"while"},continue:{primary:"fortfahren",alternatives:["weiter"],normalized:"continue"},halt:{primary:"anhalten",alternatives:["stoppen"],normalized:"halt"},throw:{primary:"werfen",normalized:"throw"},call:{primary:"aufrufen",normalized:"call"},return:{primary:"zur\xFCckgeben",normalized:"return"},then:{primary:"dann",alternatives:["danach","anschlie\xDFend"],normalized:"then"},and:{primary:"und",alternatives:["sowie","auch"],normalized:"and"},end:{primary:"ende",alternatives:["beenden","fertig"],normalized:"end"},js:{primary:"js",alternatives:["javascript"],normalized:"js"},async:{primary:"asynchron",normalized:"async"},tell:{primary:"sagen",normalized:"tell"},default:{primary:"standard",normalized:"default"},init:{primary:"initialisieren",normalized:"init"},behavior:{primary:"verhalten",normalized:"behavior"},install:{primary:"installieren",normalized:"install"},measure:{primary:"messen",normalized:"measure"},beep:{primary:"piepton",normalized:"beep"},break:{primary:"unterbrechen",normalized:"break"},copy:{primary:"kopieren",normalized:"copy"},exit:{primary:"beenden",normalized:"exit"},pick:{primary:"ausw\xE4hlen",normalized:"pick"},render:{primary:"rendern",normalized:"render"},into:{primary:"hinein",normalized:"into"},before:{primary:"vor",normalized:"before"},after:{primary:"nach",normalized:"after"},click:{primary:"Klick",alternatives:["Klicken"],normalized:"click"},hover:{primary:"Hover",alternatives:["Schweben"],normalized:"hover"},submit:{primary:"Absenden",alternatives:["Senden"],normalized:"submit"},input:{primary:"Eingabe",normalized:"input"},change:{primary:"\xC4nderung",alternatives:["\xC4ndern"],normalized:"change"},until:{primary:"bis",normalized:"until"},event:{primary:"Ereignis",alternatives:["Event"],normalized:"event"},from:{primary:"von",alternatives:["aus"],normalized:"from"}},eventHandler:{keyword:{primary:"bei",alternatives:["auf"],normalized:"on"},sourceMarker:{primary:"von",alternatives:["aus"],position:"before"},conditionalKeyword:{primary:"wenn",alternatives:["falls"]},eventMarker:{primary:"bei",alternatives:["beim"],position:"before"},temporalMarkers:["wenn","bei"]}};function ke(t){return {stem:t,confidence:1}}function de(t,e,n){return n?{stem:t,confidence:e,metadata:n}:{stem:t,confidence:e}}var On=["an","auf","aus","ein","mit","vor","zu","ab","bei","nach","weg","um","her","hin"];function Ln(t){let e=t.toLowerCase();return !!(e.endsWith("en")||e.endsWith("eln")||e.endsWith("ern")||e.startsWith("ge")&&e.endsWith("t")||e.startsWith("ge")&&e.endsWith("en")||/[äöüß]/i.test(t))}var Dn=[{ending:"end",stem:"en",confidence:.88,type:"gerund"},{ending:"e",stem:"en",confidence:.75,type:"present"},{ending:"st",stem:"en",confidence:.8,type:"present"},{ending:"t",stem:"en",confidence:.78,type:"present"},{ending:"en",stem:"en",confidence:.85,type:"dictionary"},{ending:"test",stem:"en",confidence:.85,type:"past"},{ending:"ten",stem:"en",confidence:.82,type:"past"},{ending:"tet",stem:"en",confidence:.85,type:"past"},{ending:"te",stem:"en",confidence:.82,type:"past"},{ending:"test",stem:"en",confidence:.8,type:"subjunctive"},{ending:"ten",stem:"en",confidence:.78,type:"subjunctive"},{ending:"tet",stem:"en",confidence:.8,type:"subjunctive"},{ending:"te",stem:"en",confidence:.78,type:"subjunctive"},{ending:"e",stem:"en",confidence:.72,type:"imperative"},{ending:"t",stem:"en",confidence:.72,type:"imperative"},{ending:"en",stem:"en",confidence:.75,type:"imperative"}],Bn=[{ending:"le",stem:"eln",confidence:.82,type:"present"},{ending:"elst",stem:"eln",confidence:.85,type:"present"},{ending:"elt",stem:"eln",confidence:.85,type:"present"},{ending:"eln",stem:"eln",confidence:.88,type:"dictionary"},{ending:"re",stem:"ern",confidence:.82,type:"present"},{ending:"erst",stem:"ern",confidence:.85,type:"present"},{ending:"ert",stem:"ern",confidence:.85,type:"present"},{ending:"ern",stem:"ern",confidence:.88,type:"dictionary"}],Wn=[...Dn,...Bn].sort((t,e)=>e.ending.length-t.ending.length),kt=class{constructor(){this.language="de";}isNormalizable(t){return t.length<3?false:Ln(t)}normalize(t){let e=t.toLowerCase();if(e.endsWith("en")&&e.length>=4||(e.endsWith("eln")||e.endsWith("ern"))&&e.length>=5)return ke(t);let n=this.tryParticipleNormalization(e);if(n)return n;let r=this.tryConjugationNormalization(e);return r||ke(t)}tryParticipleNormalization(t){for(let e of On)if(t.startsWith(e+"ge")){let n=t.slice(e.length),r=this.trySimpleParticipleNormalization(n);if(r){let i={removedPrefixes:["ge"],conjugationType:"participle"};return r.metadata?.removedSuffixes&&(i.removedSuffixes=r.metadata.removedSuffixes),de(e+r.stem,r.confidence*.95,i)}}return this.trySimpleParticipleNormalization(t)}trySimpleParticipleNormalization(t){if(!t.startsWith("ge"))return null;let e=t.slice(2);if(e.endsWith("t")&&e.length>=3){let n=e.slice(0,-1);return de(n+"en",.85,{removedPrefixes:["ge"],removedSuffixes:["t"],conjugationType:"participle"})}return e.endsWith("en")&&e.length>=4?de(e,.82,{removedPrefixes:["ge"],conjugationType:"participle"}):null}tryConjugationNormalization(t){for(let e of Wn)if(t.endsWith(e.ending)){let n=t.slice(0,-e.ending.length);if(n.length<2)continue;let r=n+e.stem;return de(r,e.confidence,{removedSuffixes:[e.ending],conjugationType:e.type})}return null}},{isLetter:Fn,isIdentifierChar:qn}=An(/[a-zA-ZäöüÄÖÜß]/),ft=new Set(["an","auf","aus","bei","durch","f\xFCr","fur","gegen","in","mit","nach","ohne","seit","\xFCber","uber","um","unter","von","vor","zu","zwischen","bis","gegen\xFCber","gegenuber","w\xE4hrend","wahrend","wegen","trotz","statt","innerhalb","au\xDFerhalb","ausserhalb"]),$n=[{native:"wahr",normalized:"true"},{native:"falsch",normalized:"false"},{native:"null",normalized:"null"},{native:"undefiniert",normalized:"undefined"},{native:"erste",normalized:"first"},{native:"erster",normalized:"first"},{native:"erstes",normalized:"first"},{native:"letzte",normalized:"last"},{native:"letzter",normalized:"last"},{native:"letztes",normalized:"last"},{native:"n\xE4chste",normalized:"next"},{native:"nachste",normalized:"next"},{native:"vorherige",normalized:"previous"},{native:"n\xE4chste",normalized:"closest"},{native:"eltern",normalized:"parent"},{native:"klick",normalized:"click"},{native:"click",normalized:"click"},{native:"eingabe",normalized:"input"},{native:"\xE4nderung",normalized:"change"},{native:"anderung",normalized:"change"},{native:"absenden",normalized:"submit"},{native:"taste unten",normalized:"keydown"},{native:"taste oben",normalized:"keyup"},{native:"maus dr\xFCber",normalized:"mouseover"},{native:"maus druber",normalized:"mouseover"},{native:"maus weg",normalized:"mouseout"},{native:"fokus",normalized:"focus"},{native:"unsch\xE4rfe",normalized:"blur"},{native:"unscharfe",normalized:"blur"},{native:"scrollen",normalized:"scroll"},{native:"meine",normalized:"my"},{native:"meinen",normalized:"my"},{native:"ergebnis",normalized:"result"},{native:"ziel",normalized:"target"},{native:"sekunde",normalized:"s"},{native:"sekunden",normalized:"s"},{native:"millisekunde",normalized:"ms"},{native:"millisekunden",normalized:"ms"},{native:"minute",normalized:"m"},{native:"minuten",normalized:"m"},{native:"stunde",normalized:"h"},{native:"stunden",normalized:"h"},{native:"hinzufugen",normalized:"add"},{native:"hinzufgen",normalized:"add"},{native:"loschen",normalized:"remove"},{native:"anhangen",normalized:"append"},{native:"erhohen",normalized:"increment"},{native:"ubergang",normalized:"transition"},{native:"auslosen",normalized:"trigger"},{native:"zuruckgeben",normalized:"return"},{native:"anschliessend",normalized:"then"},{native:"erh\xF6he",normalized:"increment"},{native:"erhohe",normalized:"increment"},{native:"verringere",normalized:"decrement"}],jn=[{pattern:"millisekunden",suffix:"ms",length:13,caseInsensitive:true},{pattern:"millisekunde",suffix:"ms",length:12,caseInsensitive:true},{pattern:"sekunden",suffix:"s",length:8,caseInsensitive:true},{pattern:"sekunde",suffix:"s",length:7,caseInsensitive:true},{pattern:"minuten",suffix:"m",length:7,caseInsensitive:true},{pattern:"minute",suffix:"m",length:6,caseInsensitive:true},{pattern:"stunden",suffix:"h",length:7,caseInsensitive:true},{pattern:"stunde",suffix:"h",length:6,caseInsensitive:true}],Vn=class extends Mn{constructor(){super(),this.language="de",this.direction="ltr",this.initializeKeywordsFromProfile(Et,$n),this.normalizer=new kt;}tokenize(t){let e=[],n=0;for(;n<t.length;){if(ne(t[n])){n++;continue}if(ht(t[n])){let o=this.tryEventModifier(t,n);if(o){e.push(o),n=o.position.end;continue}if(this.tryPropertyAccess(t,n,e)){n++;continue}let s=this.trySelector(t,n);if(s){e.push(s),n=s.position.end;continue}}if(vt(t[n])){let o=this.tryString(t,n);if(o){e.push(o),n=o.position.end;continue}}if(yt(t,n)){let o=this.tryUrl(t,n);if(o){e.push(o),n=o.position.end;continue}}if(W(t[n])||t[n]==="-"&&n+1<t.length&&W(t[n+1])){let o=this.extractNumber(t,n);if(o){e.push(o),n=o.position.end;continue}}let r=this.tryVariableRef(t,n);if(r){e.push(r),n=r.position.end;continue}if(Fn(t[n])){let o=this.extractWord(t,n);if(o){e.push(o),n=o.position.end;continue}}let i=this.tryOperator(t,n);if(i){e.push(i),n=i.position.end;continue}n++;}return new xn(e,"de")}classifyToken(t){let e=t.toLowerCase();return ft.has(e)?"particle":this.isKeyword(e)?"keyword":t.startsWith("#")||t.startsWith(".")||t.startsWith("[")||t.startsWith("*")||t.startsWith("<")?"selector":t.startsWith('"')||t.startsWith("'")||/^\d/.test(t)?"literal":"identifier"}extractWord(t,e){let n=e,r="";for(;n<t.length&&qn(t[n]);)r+=t[n++];if(!r)return null;let i=r.toLowerCase(),o=this.lookupKeyword(i);return o?S(r,"keyword",T(e,n),o.normalized):ft.has(i)?S(r,"particle",T(e,n)):S(r,"identifier",T(e,n))}extractNumber(t,e){return this.tryNumberWithTimeUnits(t,e,jn,{allowSign:true,skipWhitespace:true})}},Un=new Vn;Sn("de",Un,Et);var Kn=Object.defineProperty,Gn=Object.getOwnPropertyNames,Rt=(t,e)=>function(){return t&&(e=(0, t[Gn(t)[0]])(t=0)),e},Hn=(t,e)=>{for(var n in e)Kn(t,n,{get:e[n],enumerable:true});};function bt(t,e){return t.replace(/\{(\w+)\}/g,(n,r)=>String(e[r]??`{${r}}`))}function M(t,e,n={},r){let i=Pt[t],o=bt(i,n),s=It[t],a=s?bt(s,n):void 0;return {code:t,message:o,severity:e,...r&&{role:r},...a&&{suggestion:a}}}var h,Pt,It,Qn=Rt({"src/generators/schema-error-codes.ts"(){h={AMBIGUOUS_TYPE_LITERAL_SELECTOR:"SCHEMA_AMBIGUOUS_TYPE_LITERAL_SELECTOR",TOO_MANY_EXPECTED_TYPES:"SCHEMA_TOO_MANY_EXPECTED_TYPES",MULTI_TYPE_PATIENT_EXPECTED:"SCHEMA_MULTI_TYPE_PATIENT_EXPECTED",NO_REQUIRED_ROLES:"SCHEMA_NO_REQUIRED_ROLES",NO_REQUIRED_ROLES_EXPECTED:"SCHEMA_NO_REQUIRED_ROLES_EXPECTED",TRANSITION_PATIENT_ACCEPTS_SELECTOR:"SCHEMA_TRANSITION_PATIENT_ACCEPTS_SELECTOR",TRANSITION_MISSING_GOAL:"SCHEMA_TRANSITION_MISSING_GOAL",EVENT_HANDLER_MISSING_EVENT:"SCHEMA_EVENT_HANDLER_MISSING_EVENT",EVENT_HANDLER_EVENT_NOT_REQUIRED:"SCHEMA_EVENT_HANDLER_EVENT_NOT_REQUIRED",CONDITIONAL_MISSING_CONDITION:"SCHEMA_CONDITIONAL_MISSING_CONDITION",CONDITIONAL_CONDITION_NOT_REQUIRED:"SCHEMA_CONDITIONAL_CONDITION_NOT_REQUIRED",FOR_LOOP_MISSING_SOURCE:"SCHEMA_FOR_LOOP_MISSING_SOURCE",WHILE_LOOP_MISSING_CONDITION:"SCHEMA_WHILE_LOOP_MISSING_CONDITION"},Pt={[h.AMBIGUOUS_TYPE_LITERAL_SELECTOR]:"Role '{role}' accepts both 'literal' and 'selector'. This may cause ambiguous type inference for values starting with special characters (* . # etc.).",[h.TOO_MANY_EXPECTED_TYPES]:"Role '{role}' accepts {count} different types. This may make type inference unreliable.",[h.MULTI_TYPE_PATIENT_EXPECTED]:"Role '{role}' accepts multiple types (expected for {command} command).",[h.NO_REQUIRED_ROLES]:"Command has no required roles. Is this intentional?",[h.NO_REQUIRED_ROLES_EXPECTED]:"Command has no required roles (expected for {command}).",[h.TRANSITION_PATIENT_ACCEPTS_SELECTOR]:"Transition command 'patient' role (CSS property name) should only accept 'literal', not 'selector'. CSS property names like 'background-color' are strings, not CSS selectors.",[h.TRANSITION_MISSING_GOAL]:"Transition command requires a 'goal' role for the target value (to <value>). Without it, there's no way to specify what value to transition to.",[h.EVENT_HANDLER_MISSING_EVENT]:"Event handler command should have an 'event' role to specify which event to listen for.",[h.EVENT_HANDLER_EVENT_NOT_REQUIRED]:"Event role should be required - every event handler needs an event to listen for.",[h.CONDITIONAL_MISSING_CONDITION]:"Conditional command should have a 'condition' role for the boolean expression.",[h.CONDITIONAL_CONDITION_NOT_REQUIRED]:"Condition role should be required - conditionals need a condition to evaluate.",[h.FOR_LOOP_MISSING_SOURCE]:"For-loop should have a 'source' role for the collection to iterate over.",[h.WHILE_LOOP_MISSING_CONDITION]:"While-loop should have a 'condition' role for the loop condition."},It={[h.AMBIGUOUS_TYPE_LITERAL_SELECTOR]:"Consider being more specific about which type is expected, or use explicit type markers.",[h.TOO_MANY_EXPECTED_TYPES]:"Consider narrowing the accepted types to improve type inference reliability.",[h.TRANSITION_PATIENT_ACCEPTS_SELECTOR]:"Remove 'selector' from expectedTypes and only accept 'literal'.",[h.TRANSITION_MISSING_GOAL]:"Add a 'goal' role with expectedTypes ['literal', 'variable'].",[h.EVENT_HANDLER_MISSING_EVENT]:"Add an 'event' role with expectedTypes ['literal'].",[h.EVENT_HANDLER_EVENT_NOT_REQUIRED]:"Set required: true on the 'event' role.",[h.CONDITIONAL_MISSING_CONDITION]:"Add a 'condition' role with expectedTypes ['expression'].",[h.CONDITIONAL_CONDITION_NOT_REQUIRED]:"Set required: true on the 'condition' role.",[h.FOR_LOOP_MISSING_SOURCE]:"Add a 'source' role for the collection to iterate over.",[h.WHILE_LOOP_MISSING_CONDITION]:"Add a 'condition' role for the loop continuation condition."};}}),_t={};Hn(_t,{SchemaErrorCodes:()=>h,formatValidationResults:()=>ri,getValidationStats:()=>ni,validateAllSchemas:()=>ti,validateCommandSchema:()=>Mt});function Xn(t,e){return {action:t,items:e,get notes(){return e.filter(n=>n.severity==="note").map(n=>n.message)},get warnings(){return e.filter(n=>n.severity==="warning").map(n=>n.message)},get errors(){return e.filter(n=>n.severity==="error").map(n=>n.message)}}}function Mt(t){let e=[];for(let r of t.roles)r.expectedTypes.includes("literal")&&r.expectedTypes.includes("selector")&&(r.role==="patient"&&Se.has(t.action)?e.push(M(h.MULTI_TYPE_PATIENT_EXPECTED,"note",{role:r.role,command:t.action},r.role)):e.push(M(h.AMBIGUOUS_TYPE_LITERAL_SELECTOR,"warning",{role:r.role},r.role))),r.expectedTypes.length>3&&!Se.has(t.action)&&e.push(M(h.TOO_MANY_EXPECTED_TYPES,"warning",{role:r.role,count:r.expectedTypes.length},r.role));switch(t.action){case "transition":Zn(t,e);break;case "on":Yn(t,e);break;case "if":case "unless":Jn(t,e);break;case "repeat":case "for":case "while":ei(t,e);break}return t.roles.filter(r=>r.required).length===0&&(Ot.has(t.action)?e.push(M(h.NO_REQUIRED_ROLES_EXPECTED,"note",{command:t.action})):e.push(M(h.NO_REQUIRED_ROLES,"warning",{}))),Xn(t.action,e)}function Zn(t,e){let n=t.roles.find(i=>i.role==="patient"),r=t.roles.find(i=>i.role==="goal");n&&n.expectedTypes.includes("selector")&&e.push(M(h.TRANSITION_PATIENT_ACCEPTS_SELECTOR,"warning",{},"patient")),n&&!r&&e.push(M(h.TRANSITION_MISSING_GOAL,"error",{}));}function Yn(t,e){let n=t.roles.find(r=>r.role==="event");n||e.push(M(h.EVENT_HANDLER_MISSING_EVENT,"warning",{})),n&&!n.required&&e.push(M(h.EVENT_HANDLER_EVENT_NOT_REQUIRED,"warning",{}));}function Jn(t,e){let n=t.roles.find(r=>r.role==="condition");n||e.push(M(h.CONDITIONAL_MISSING_CONDITION,"warning",{})),n&&!n.required&&e.push(M(h.CONDITIONAL_CONDITION_NOT_REQUIRED,"warning",{}));}function ei(t,e){t.action==="for"?t.roles.find(r=>r.role==="source")||e.push(M(h.FOR_LOOP_MISSING_SOURCE,"warning",{})):t.action==="while"&&(t.roles.find(r=>r.role==="condition")||e.push(M(h.WHILE_LOOP_MISSING_CONDITION,"warning",{})));}function ti(t,e={}){let n=new Map,{includeNotes:r=false}=e;for(let[i,o]of Object.entries(t)){let s=Mt(o),a=s.items.some(u=>u.severity==="warning"||u.severity==="error"),l=r&&s.items.some(u=>u.severity==="note");(a||l)&&n.set(i,s);}return n}function ri(t,e={}){let n=[],{showNotes:r=false,showCodes:i=true}=e;for(let[o,s]of t){let a=s.items.filter(c=>c.severity==="error"),l=s.items.filter(c=>c.severity==="warning"),u=s.items.filter(c=>c.severity==="note");if(a.length>0){n.push(` \u274C ${o}:`);for(let c of a){let d=i?` [${c.code}]`:"";n.push(` ERROR${d}: ${c.message}`),c.suggestion&&n.push(` \u{1F4A1} Suggestion: ${c.suggestion}`);}}if(l.length>0){n.push(` \u26A0\uFE0F ${o}:`);for(let c of l){let d=i?` [${c.code}]`:"";n.push(` ${d?`${c.code}: `:""}${c.message}`),c.suggestion&&n.push(` \u{1F4A1} ${c.suggestion}`);}}if(r&&u.length>0){n.push(` \u2139\uFE0F ${o}:`);for(let c of u){let d=i?` [${c.code}]`:"";n.push(` ${d?`${c.code}: `:""}${c.message}`);}}}return n.join(`
|
|
2
|
-
`)}function ni(t){let e=0,n=0,r=0,i={};for(let o of t.values())for(let s of o.items)s.severity==="error"?e++:s.severity==="warning"?n++:s.severity==="note"&&r++,i[s.code]=(i[s.code]||0)+1;return {totalCommands:t.size,errors:e,warnings:n,notes:r,byCode:i}}var Se,Ot,ii=Rt({"src/generators/schema-validator.ts"(){Qn(),Se=new Set(["put","append","prepend","log","throw","make","measure","return","swap","morph","beep","copy"]),Ot=new Set(["compound","else","halt","continue","async","init","settle","focus","blur","return","js","measure","break","exit","beep"]);}});function oe(t){let e="complex";return t.startsWith("#")&&!t.includes(" ")?e="id":t.startsWith(".")&&!t.includes(" ")?e="class":t.startsWith("[")&&t.endsWith("]")?e="attribute":/^[a-z][a-z0-9]*$/i.test(t)&&(e="element"),{type:"selector",value:t,selectorKind:e}}function C(t,e){let n={type:"literal",value:t};return e!==void 0?{type:"literal",value:t,dataType:e}:n}var oi=new Set(["me","you","it","result","event","target","body"]);function zt(t){return oi.has(t)}function j(t){return {type:"reference",value:t}}function be(t,e){return {type:"property-path",object:t,property:e}}function me(t,e,n){let r={kind:"command",action:t,roles:new Map(Object.entries(e))};return n!==void 0?{...r,metadata:n}:r}function Tt(t,e,n,r,i,o){let s=new Map;s.set("event",t);let a={kind:"event-handler",action:"on",roles:s,body:e};return n!==void 0&&(a.eventModifiers=n),r!==void 0&&(a.metadata=r),a}function St(t,e="then",n){let r={kind:"compound",action:"compound",roles:new Map,statements:t,chainType:e};return n!==void 0&&(r.metadata=n),r}function xt(t,e){return !e||e.length===0||e.includes(t)||e.includes("expression")?true:t==="property-path"?e.some(n=>["selector","reference","expression"].includes(n)):false}function si(t,e){return t.possessive?.keywords?.[e]}var Q=new Map,X=new Map,pe=new Map,xe=null;function Lt(t,e){let n={...t};for(let r of Object.keys(e)){let i=e[r],o=t[r];i!==void 0&&(typeof i=="object"&&i!==null&&!Array.isArray(i)&&typeof o=="object"&&o!==null&&!Array.isArray(o)?n[r]=Lt(o,i):n[r]=i);}return n}function ai(t,e){return Lt(t,e)}function Ae(t){if(!t.extends)return t;let e=X.get(t.extends);if(!e)return console.warn(`[Registry] Profile '${t.code}' extends '${t.extends}' but base is not registered. Make sure to import the base language before the variant.`),t;let n=Ae(e);return ai(n,t)}function Dt(t){xe=t;}var Ct=new Map;function Z(t){return t.split("-")[0]}function Y(t){return t.includes("-")}function li(t){let e=Q.get(t);if(!e&&Y(t)){let n=Z(t);e=Q.get(n);}if(!e){let n=Array.from(Q.keys()).join(", ");throw new Error(`Language '${t}' is not registered. Registered languages: ${n||"none"}. Import the language module first: import '@lokascript/semantic/languages/${t}';`)}return e}function ci(t){let e=X.get(t);if(!e&&Y(t)){let n=Z(t);e=X.get(n);}if(!e){let n=Array.from(X.keys()).join(", ");throw new Error(`Language profile '${t}' is not registered. Registered languages: ${n||"none"}. Import the language module first: import '@lokascript/semantic/languages/${t}';`)}return Ae(e)}function ui(t){let e=Q.get(t);return !e&&Y(t)&&(e=Q.get(Z(t))),e}function V(t){let e=X.get(t);return !e&&Y(t)&&(e=X.get(Z(t))),e?Ae(e):void 0}function Bt(){return Array.from(Q.keys())}function di(t,e){return li(e).tokenize(t)}function H(t){let e=pe.get(t);if(!e&&Y(t)&&(e=pe.get(Z(t))),e)return e;let n=Ct.get(t);if(!n&&Y(t)&&(n=Ct.get(Z(t))),n)return pe.set(t,n),n;if(!xe)throw new Error(`No patterns registered for language '${t}'. Either import the language module or set a pattern generator.`);let r=ci(t),i=xe(r);return pe.set(t,i),i}var fe=class ie{constructor(){this.stemMatchCount=0,this.totalKeywordMatches=0;}matchPattern(e,n){let r=e.mark(),i=new Map;if(this.currentProfile=V(n.language),this.stemMatchCount=0,this.totalKeywordMatches=0,!this.matchTokenSequence(e,n.template.tokens,i))return e.reset(r),null;let s=this.calculateConfidence(n,i);return this.applyExtractionRules(n,i),{pattern:n,captured:i,consumedTokens:e.position()-r.position,confidence:s}}matchBest(e,n){let r=[];for(let o of n){let s=e.mark(),a=this.matchPattern(e,o);a&&r.push(a),e.reset(s);}if(r.length===0)return null;r.sort((o,s)=>{let a=s.pattern.priority-o.pattern.priority;return a!==0?a:s.confidence-o.confidence});let i=r[0];return this.matchPattern(e,i.pattern),i}matchTokenSequence(e,n,r){let i=n[0],o=i?.type==="literal"&&(i.value==="and"||i.value==="then"||i.alternatives?.includes("and")||i.alternatives?.includes("then"));if(this.currentProfile?.code==="ar"&&!o)for(;e.peek()?.kind==="conjunction";)e.advance();for(let s of n)if(!this.matchPatternToken(e,s,r)){if(this.isOptional(s))continue;return false}return true}matchPatternToken(e,n,r){switch(n.type){case "literal":return this.matchLiteralToken(e,n);case "role":return this.matchRoleToken(e,n,r);case "group":return this.matchGroupToken(e,n,r);default:return false}}matchLiteralToken(e,n){let r=e.peek();if(!r)return false;let i=this.getMatchType(r,n.value);if(i!=="none")return this.totalKeywordMatches++,i==="stem"&&this.stemMatchCount++,e.advance(),true;if(n.alternatives)for(let o of n.alternatives){let s=this.getMatchType(r,o);if(s!=="none")return this.totalKeywordMatches++,s==="stem"&&this.stemMatchCount++,e.advance(),true}return false}matchRoleToken(e,n,r){this.skipNoiseWords(e);let i=e.peek();if(!i)return n.optional||false;let o=this.tryMatchPossessiveExpression(e);if(o)return n.expectedTypes&&n.expectedTypes.length>0&&!n.expectedTypes.includes(o.type)&&!n.expectedTypes.includes("expression")?n.optional||false:(r.set(n.role,o),true);let s=this.tryMatchMethodCallExpression(e);if(s)return n.expectedTypes&&n.expectedTypes.length>0&&!n.expectedTypes.includes(s.type)&&!n.expectedTypes.includes("expression")?n.optional||false:(r.set(n.role,s),true);let a=this.tryMatchPossessiveSelectorExpression(e);if(a)return n.expectedTypes&&n.expectedTypes.length>0&&!xt(a.type,n.expectedTypes)?n.optional||false:(r.set(n.role,a),true);let l=this.tryMatchPropertyAccessExpression(e);if(l)return n.expectedTypes&&n.expectedTypes.length>0&&!n.expectedTypes.includes(l.type)&&!n.expectedTypes.includes("expression")?n.optional||false:(r.set(n.role,l),true);let u=this.tryMatchSelectorPropertyExpression(e);if(u)return n.expectedTypes&&n.expectedTypes.length>0&&!xt(u.type,n.expectedTypes)?n.optional||false:(r.set(n.role,u),true);let c=this.tokenToSemanticValue(i);return !c||n.expectedTypes&&n.expectedTypes.length>0&&!n.expectedTypes.includes(c.type)?n.optional||false:(r.set(n.role,c),e.advance(),true)}tryMatchPossessiveExpression(e){let n=e.peek();if(!n||!this.currentProfile)return null;let r=(n.normalized||n.value).toLowerCase(),i=si(this.currentProfile,r);if(!i)return null;let o=e.mark();e.advance();let s=e.peek();if(!s)return e.reset(o),null;if(s.kind==="identifier"||s.kind==="keyword"&&!this.isStructuralKeyword(s.value)||s.kind==="selector"&&s.value.startsWith("*")||s.kind==="selector"&&s.value.startsWith("@")||s.kind==="selector"&&s.value.startsWith(".")&&/^\.[a-zA-Z_]\w*/.test(s.value)){e.advance();let a=s.value;s.kind==="selector"&&a.startsWith(".")&&/^\.[a-zA-Z_]\w*/.test(a)&&(a=a.substring(1));let l=a;for(;e.peek()?.kind==="selector"&&e.peek().value.startsWith(".")&&/^\.[a-zA-Z_]\w*/.test(e.peek().value);)l+=e.peek().value,e.advance();let u=e.peek();return u?.kind==="literal"&&u.value.startsWith("(")&&(l+=u.value,e.advance()),be(j(i),l)}return e.reset(o),null}isStructuralKeyword(e){return new Set(["into","in","to","from","at","by","with","without","before","after","of","as","on","then","end","else","if","repeat","while","for","toggle","add","remove","put","set","show","hide","increment","decrement","send","trigger","call"]).has(e.toLowerCase())}tryMatchMethodCallExpression(e){let n=e.peek();if(!n||n.kind!=="selector")return null;let r=e.mark();e.advance();let i=e.peek();if(!i||i.kind!=="operator"||i.value!==".")return e.reset(r),null;e.advance();let o=e.peek();if(!o||o.kind!=="identifier")return e.reset(r),null;e.advance();let s=e.peek();if(!s||s.kind!=="punctuation"||s.value!=="(")return e.reset(r),null;e.advance();let a=[];for(;!e.isAtEnd()&&a.length<ie.MAX_METHOD_ARGS;){let u=e.peek();if(!u)break;if(u.kind==="punctuation"&&u.value===")"){e.advance();break}if(u.kind==="punctuation"&&u.value===","){e.advance();continue}a.push(u.value),e.advance();}return {type:"expression",raw:`${n.value}.${o.value}(${a.join(", ")})`}}tryMatchPropertyAccessExpression(e){let n=e.peek();if(!n||n.kind!=="identifier"&&n.kind!=="keyword")return null;let r=e.mark();e.advance();let i=e.peek();if(!i||i.kind!=="operator"||i.value!==".")return e.reset(r),null;e.advance();let o=e.peek();if(!o||o.kind!=="identifier")return e.reset(r),null;e.advance();let s=`${n.value}.${o.value}`,a=1;for(;!e.isAtEnd()&&a<ie.MAX_PROPERTY_DEPTH;){let u=e.peek();if(!u||u.kind!=="operator"||u.value!==".")break;e.advance();let c=e.peek();if(!c||c.kind!=="identifier")break;e.advance(),s+=`.${c.value}`,a++;}let l=e.peek();if(l&&l.kind==="punctuation"&&l.value==="("){e.advance();let u=[],c=0;for(;!e.isAtEnd()&&u.length<ie.MAX_METHOD_ARGS;){let m=e.peek();if(!m)break;if(m.kind==="punctuation"&&m.value===")"){if(c===0){e.advance();break}c--;}if(m.kind==="punctuation"&&m.value==="("&&c++,m.kind==="punctuation"&&m.value===","){e.advance();continue}u.push(m.value),e.advance();}return {type:"expression",raw:`${s}(${u.join(", ")})`}}return {type:"expression",raw:s}}tryMatchPossessiveSelectorExpression(e){let n=e.peek();if(!n||n.kind!=="selector")return null;let r=e.mark();e.advance();let i=e.peek();if(!i||i.kind!=="punctuation"||i.value!=="'s")return e.reset(r),null;e.advance();let o=e.peek();return !o||o.kind!=="selector"&&o.kind!=="identifier"?(e.reset(r),null):(e.advance(),be(oe(n.value),o.value))}tryMatchSelectorPropertyExpression(e){let n=e.peek();if(!n||n.kind!=="selector"||!n.value.startsWith("#"))return null;let r=e.mark();e.advance();let i=e.peek();if(!i||i.kind!=="selector"||!i.value.startsWith("."))return e.reset(r),null;let o=e.peek(1);o&&o.kind,e.advance();let s=i.value.slice(1);return be(oe(n.value),s)}matchGroupToken(e,n,r){let i=e.mark(),o=new Set(r.keys());if(!this.matchTokenSequence(e,n.tokens,r)){e.reset(i);for(let a of r.keys())o.has(a)||r.delete(a);return n.optional||false}return true}getMatchType(e,n){return e.value===n?"exact":e.normalized===n?"normalized":e.stem===n&&e.stemConfidence!==void 0&&e.stemConfidence>=.7?"stem":e.kind==="keyword"&&e.value.toLowerCase()===n.toLowerCase()?"case-insensitive":"none"}tokenToSemanticValue(e){switch(e.kind){case "selector":return oe(e.value);case "literal":return this.parseLiteralValue(e.value);case "keyword":let n=(e.normalized||e.value).toLowerCase();return zt(n)?j(n):C(e.normalized||e.value);case "identifier":if(e.value.startsWith(":"))return j(e.value);let r=e.value.toLowerCase();return zt(r)?j(r):{type:"expression",raw:e.value};case "url":return C(e.value,"string");default:return null}}parseLiteralValue(e){if(e.startsWith('"')||e.startsWith("'")||e.startsWith("`")||e.startsWith("\u300C")){let i=e.slice(1,-1);return C(i,"string")}if(e==="true")return C(true,"boolean");if(e==="false")return C(false,"boolean");let n=e.match(/^(\d+(?:\.\d+)?)(ms|s|m|h)?$/);if(n){let i=parseFloat(n[1]);return n[2]?C(e,"duration"):C(i,"number")}let r=parseFloat(e);return isNaN(r)?C(e,"string"):C(r,"number")}applyExtractionRules(e,n){for(let[r,i]of Object.entries(e.extraction))n.has(r)||(i.value!==void 0?n.set(r,{type:"literal",value:i.value}):i.default&&n.set(r,i.default));}isOptional(e){return e.type!=="literal"&&e.optional===true}calculateConfidence(e,n){let r=0,i=0,o=u=>e.extraction?.[u]?.default!==void 0;for(let u of e.template.tokens)if(u.type==="role")i+=1,n.has(u.role)&&(r+=1);else if(u.type==="group"){for(let c of u.tokens)if(c.type==="role"){let d=o(c.role),m=.8;i+=m,n.has(c.role)?r+=m:d&&(r+=m*.6);}}let s=i>0?r/i:1;if(this.stemMatchCount>0&&this.totalKeywordMatches>0){let u=this.stemMatchCount/this.totalKeywordMatches*.15;s=Math.max(.5,s-u);}let a=this.calculateVSOConfidenceBoost(e);s=Math.min(1,s+a);let l=this.arabicPrepositionDisambiguation(e,n);return s=Math.max(0,Math.min(1,s+l)),s}calculateVSOConfidenceBoost(e){if(e.language!=="ar")return 0;let n=e.template.tokens[0];if(!n||n.type!=="literal")return 0;let r=new Set(["\u0628\u062F\u0644","\u063A\u064A\u0631","\u0623\u0636\u0641","\u0623\u0632\u0644","\u0636\u0639","\u0627\u062C\u0639\u0644","\u0639\u064A\u0646","\u0632\u062F","\u0627\u0646\u0642\u0635","\u0633\u062C\u0644","\u0623\u0638\u0647\u0631","\u0623\u062E\u0641","\u0634\u063A\u0644","\u0623\u0631\u0633\u0644","\u0631\u0643\u0632","\u0634\u0648\u0634","\u062A\u0648\u0642\u0641","\u0627\u0646\u0633\u062E","\u0627\u062D\u0630\u0641","\u0627\u0635\u0646\u0639","\u0627\u0646\u062A\u0638\u0631","\u0627\u0646\u062A\u0642\u0627\u0644","\u0623\u0648"]);if(r.has(n.value))return .15;if(n.alternatives){for(let i of n.alternatives)if(r.has(i))return .15}return 0}arabicPrepositionDisambiguation(e,n){if(e.language!=="ar")return 0;let r=0,i={patient:["\u0639\u0644\u0649"],destination:["\u0625\u0644\u0649","\u0627\u0644\u0649"],source:["\u0645\u0646"],agent:["\u0645\u0646"],manner:["\u0628"],style:["\u0628"],goal:["\u0625\u0644\u0649","\u0627\u0644\u0649"],method:["\u0628"]};for(let[o,s]of n.entries()){let a=i[o];if(!a||a.length===0)continue;let l="metadata"in s?s.metadata:void 0;if(l&&typeof l.prepositionValue=="string"){let u=l.prepositionValue;a.includes(u)?r+=.1:r-=.1;}}return Math.max(-0.1,Math.min(.1,r))}skipNoiseWords(e){let n=e.peek();if(!n)return;let r=n.value.toLowerCase();if(ie.ENGLISH_NOISE_WORDS.has(r)){let i=e.mark();e.advance();let o=e.peek();if(o&&o.kind==="selector")return;e.reset(i);}r==="class"&&e.advance();}extractEventModifiers(e){let n={},r=false;for(;!e.isAtEnd();){let i=e.peek();if(!i||i.kind!=="event-modifier")break;let o=i.metadata;if(!o)break;switch(r=true,o.modifierName){case "once":n.once=true;break;case "debounce":typeof o.value=="number"&&(n.debounce=o.value);break;case "throttle":typeof o.value=="number"&&(n.throttle=o.value);break;case "queue":(o.value==="first"||o.value==="last"||o.value==="all"||o.value==="none")&&(n.queue=o.value);break}e.advance();}return r?n:void 0}};fe.MAX_PROPERTY_DEPTH=10;fe.MAX_METHOD_ARGS=20;fe.ENGLISH_NOISE_WORDS=new Set(["the","a","an"]);var Wt=fe,G=new Wt,ze=class{constructor(t,e){this.pos=0,this.tokens=t,this.language=e;}peek(t=0){let e=this.pos+t;return e<0||e>=this.tokens.length?null:this.tokens[e]}advance(){if(this.isAtEnd())throw new Error("Unexpected end of token stream");return this.tokens[this.pos++]}isAtEnd(){return this.pos>=this.tokens.length}mark(){return {position:this.pos}}reset(t){this.pos=t.position;}position(){return this.pos}remaining(){return this.tokens.slice(this.pos)}takeWhile(t){let e=[];for(;!this.isAtEnd()&&t(this.peek());)e.push(this.advance());return e}skipWhile(t){for(;!this.isAtEnd()&&t(this.peek());)this.advance();}};function pi(t){return ui(t)}function Te(t,e){return di(t,e)}function Ft(){return Bt()}var fi={ko:{\uD074\uB9AD:"click",\uC785\uB825:"input",\uBCC0\uACBD:"change",\uC81C\uCD9C:"submit",\uD0A4\uB2E4\uC6B4:"keydown",\uD0A4\uC5C5:"keyup",\uB9C8\uC6B0\uC2A4\uC624\uBC84:"mouseover",\uB9C8\uC6B0\uC2A4\uC544\uC6C3:"mouseout",\uB9C8\uC6B0\uC2A4\uB2E4\uC6B4:"mousedown",\uB9C8\uC6B0\uC2A4\uC5C5:"mouseup",\uD3EC\uCEE4\uC2A4:"focus",\uBE14\uB7EC:"blur",\uB85C\uB4DC:"load",\uB9AC\uC0AC\uC774\uC988:"resize",\uC2A4\uD06C\uB864:"scroll"},ja:{\u30AF\u30EA\u30C3\u30AF:"click",\u5165\u529B:"input",\u5909\u66F4:"change",\u9001\u4FE1:"submit",\u30AD\u30FC\u30C0\u30A6\u30F3:"keydown",\u30AD\u30FC\u30A2\u30C3\u30D7:"keyup",\u30AD\u30FC\u30D7\u30EC\u30B9:"keypress",\u30DE\u30A6\u30B9\u30AA\u30FC\u30D0\u30FC:"mouseover",\u30DE\u30A6\u30B9\u30A2\u30A6\u30C8:"mouseout",\u30DE\u30A6\u30B9\u62BC\u4E0B:"mousedown",\u30DE\u30A6\u30B9\u89E3\u653E:"mouseup",\u30D5\u30A9\u30FC\u30AB\u30B9:"focus",\u30D6\u30E9\u30FC:"blur",\u30ED\u30FC\u30C9:"load",\u8AAD\u307F\u8FBC\u307F:"load",\u30B5\u30A4\u30BA\u5909\u66F4:"resize",\u30B9\u30AF\u30ED\u30FC\u30EB:"scroll"},ar:{\u0627\u0644\u0646\u0642\u0631:"click",\u0646\u0642\u0631:"click",\u0627\u0644\u0625\u062F\u062E\u0627\u0644:"input",\u0625\u062F\u062E\u0627\u0644:"input",\u0627\u0644\u062A\u063A\u064A\u064A\u0631:"change",\u062A\u063A\u064A\u064A\u0631:"change",\u0627\u0644\u0625\u0631\u0633\u0627\u0644:"submit",\u0625\u0631\u0633\u0627\u0644:"submit","\u0636\u063A\u0637 \u0627\u0644\u0645\u0641\u062A\u0627\u062D":"keydown","\u0631\u0641\u0639 \u0627\u0644\u0645\u0641\u062A\u0627\u062D":"keyup","\u062A\u0645\u0631\u064A\u0631 \u0627\u0644\u0645\u0627\u0648\u0633":"mouseover",\u0627\u0644\u062A\u0631\u0643\u064A\u0632:"focus",\u062A\u062D\u0645\u064A\u0644:"load",\u062A\u0645\u0631\u064A\u0631:"scroll"},es:{clic:"click",click:"click",entrada:"input",cambio:"change",env\u00EDo:"submit",enviar:"submit","tecla abajo":"keydown","tecla arriba":"keyup","rat\xF3n encima":"mouseover","rat\xF3n fuera":"mouseout",enfoque:"focus",desenfoque:"blur",carga:"load",desplazamiento:"scroll"},tr:{t\u0131klama:"click",t\u0131kla:"click",t\u0131k:"click",giri\u015F:"input",girdi:"input",de\u011Fi\u015Fiklik:"change",de\u011Fi\u015Fim:"change",g\u00F6nderme:"submit",g\u00F6nder:"submit",tu\u015Fbasma:"keydown",tu\u015Fb\u0131rakma:"keyup",fare_bas:"mousedown",fare_b\u0131rak:"mouseup",farei\u00E7inde:"mouseover",fared\u0131\u015F\u0131nda:"mouseout",odaklanma:"focus",odak:"focus",bulan\u0131kl\u0131k:"blur",y\u00FCkleme:"load",y\u00FCkle:"load",boyut_de\u011Fi\u015Ftir:"resize",kayd\u0131rma:"scroll"},pt:{clique:"click",clicar:"click",click:"click",entrada:"input",inserir:"input",mudan\u00E7a:"change",mudanca:"change",alterar:"change",envio:"submit",enviar:"submit","tecla baixo":"keydown","tecla cima":"keyup","pressionar tecla":"keydown","soltar tecla":"keyup","mouse sobre":"mouseover","mouse fora":"mouseout",foco:"focus",focar:"focus",desfoque:"blur",desfocar:"blur",carregar:"load",carregamento:"load",rolagem:"scroll",rolar:"scroll"},zh:{\u70B9\u51FB:"click",\u5355\u51FB:"click",\u53CC\u51FB:"dblclick",\u8F93\u5165:"input",\u6539\u53D8:"change",\u53D8\u5316:"change",\u53D8\u66F4:"change",\u63D0\u4EA4:"submit",\u53D1\u9001:"submit",\u6309\u952E:"keydown",\u952E\u5165:"keydown",\u677E\u952E:"keyup",\u9F20\u6807\u8FDB\u5165:"mouseover",\u9F20\u6807\u79FB\u5165:"mouseover",\u9F20\u6807\u79BB\u5F00:"mouseout",\u9F20\u6807\u79FB\u51FA:"mouseout",\u7126\u70B9:"focus",\u805A\u7126:"focus",\u5931\u7126:"blur",\u6A21\u7CCA:"blur",\u52A0\u8F7D:"load",\u8F7D\u5165:"load",\u6EDA\u52A8:"scroll"},fr:{clic:"click",cliquer:"click",click:"click",saisie:"input",entr\u00E9e:"input",changement:"change",changer:"change",soumettre:"submit",soumission:"submit",envoi:"submit","touche bas":"keydown","touche haut":"keyup","souris dessus":"mouseover","souris dehors":"mouseout",focus:"focus",focaliser:"focus",d\u00E9focus:"blur",d\u00E9focaliser:"blur",chargement:"load",charger:"load",d\u00E9filement:"scroll",d\u00E9filer:"scroll"},de:{klick:"click",klicken:"click",click:"click",eingabe:"input",eingeben:"input",\u00E4nderung:"change",\u00E4ndern:"change",absenden:"submit",einreichen:"submit","taste runter":"keydown","taste hoch":"keyup","maus \xFCber":"mouseover","maus raus":"mouseout",fokus:"focus",fokussieren:"focus",defokussieren:"blur",unsch\u00E4rfe:"blur",laden:"load",ladung:"load",scrollen:"scroll",bl\u00E4ttern:"scroll"},id:{klik:"click",click:"click",masukan:"input",input:"input",ubah:"change",perubahan:"change",kirim:"submit","tekan tombol":"keydown","lepas tombol":"keyup","mouse masuk":"mouseover","mouse keluar":"mouseout",fokus:"focus",blur:"blur",muat:"load",memuat:"load",gulir:"scroll",menggulir:"scroll"},bn:{\u0995\u09CD\u09B2\u09BF\u0995:"click",\u0987\u09A8\u09AA\u09C1\u099F:"input",\u099C\u09AE\u09BE:"submit",\u09B2\u09CB\u09A1:"load",\u09B8\u09CD\u0995\u09CD\u09B0\u09CB\u09B2:"scroll",\u09B0\u09BF\u09B8\u09BE\u0987\u099C:"resize",\u099D\u09BE\u09AA\u09B8\u09BE:"blur",\u09AB\u09CB\u0995\u09BE\u09B8:"focus",\u09AA\u09B0\u09BF\u09AC\u09B0\u09CD\u09A4\u09A8:"change"},qu:{click:"click","\xF1it'iy":"click",\u00F1itiy:"click",yaykuchiy:"input",yaykuy:"input",tikray:"change","t'ikray":"change",apachiy:"submit",kachay:"submit","llave uray":"keydown","llave hawa":"keyup","q'away":"focus",qhaway:"focus",paqariy:"blur","mana q'away":"blur",cargay:"load",apakuy:"load",apamuy:"load",kunray:"scroll",muyuy:"scroll",hatun_kay:"resize"},sw:{bofya:"click",click:"click",kubofya:"click",ingiza:"input",kubadilisha:"change",mabadiliko:"change",tuma:"submit",kutuma:"submit","bonyeza chini":"keydown","bonyeza juu":"keyup","panya juu":"mouseover","panya nje":"mouseout",lenga:"focus",kulenga:"focus",blur:"blur",pakia:"load",kupakia:"load",sogeza:"scroll",kusogeza:"scroll"}};var J=class F{parse(e,n){let{modifiers:r,remainingInput:i}=this.extractStandaloneModifiers(e,n),o=i||e,s=Te(o,n),a=H(n);if(a.length===0)throw new Error(`No patterns available for language: ${n}`);let l=[...a].sort((v,A)=>A.priority-v.priority),u=l.filter(v=>v.command==="on"),c=G.matchBest(s,u);if(c){let v=this.buildEventHandler(c,s,n);return r?this.applyModifiers(v,r):v}let d=l.filter(v=>v.command!=="on"),m=G.matchBest(s,d);if(m)return this.buildCommand(m,n);let p=this.trySOVEventExtraction(o,n,l);if(p)return r?this.applyModifiers(p,r):p;let f=this.tryCompoundCommandParsing(s,d,n);if(f)return f;throw new Error(`Could not parse input in ${n}: ${o}`)}canParse(e,n){try{return this.parse(e,n),!0}catch{return false}}supportedLanguages(){return Ft()}buildCommand(e,n){if(!e)throw new Error("No match to build command from");let r={};for(let[i,o]of e.captured)r[i]=o;return me(e.pattern.command,r,{sourceLanguage:n,patternId:e.pattern.id,confidence:e.confidence})}buildEventHandler(e,n,r){if(!e)throw new Error("No match to build event handler from");let i=e.captured.get("event");if(!i)throw new Error("Event handler pattern matched but no event captured");let o=G.extractEventModifiers(n),s=this.extractOrConjunctionEvents(n,r),a=i;s.length>0&&i.type==="literal"&&(a={type:"literal",value:[String(i.value),...s.map(d=>String("value"in d?d.value:""))].join(" or ")});let l,u=e.captured.get("action");if(u&&u.type==="literal"){let c=u.value,d={};for(let[f,v]of e.captured)f!=="event"&&f!=="action"&&f!=="continues"&&(d[f]=v);let m=me(c,d,{sourceLanguage:r,patternId:e.pattern.id,confidence:e.confidence}),p=e.captured.get("continues");if(p&&p.type==="literal"&&p.value==="then"){let f=H(r).filter(x=>x.command!=="on").sort((x,O)=>O.priority-x.priority),v=H(r).filter(x=>x.id.startsWith("grammar-")&&x.id.includes("-continuation")).sort((x,O)=>O.priority-x.priority),A=this.parseBodyWithGrammarPatterns(n,f,v,r);A.length>0?l=[m,...A]:l=[m];}else l=[m];}else {let c=H(r).filter(d=>d.command!=="on").sort((d,m)=>m.priority-d.priority);l=this.parseBodyWithClauses(n,c,r);}return Tt(a,l,o,{sourceLanguage:r,patternId:e.pattern.id,confidence:e.confidence})}parseBodyWithClauses(e,n,r){let i=[],o=[];for(;!e.isAtEnd();){let s=e.peek();if(!s)break;let a=s.kind==="conjunction"||s.kind==="keyword"&&this.isThenKeyword(s.value,r),l=s.kind==="keyword"&&this.isEndKeyword(s.value,r);if(a){if(o.length>0){let u=this.parseClause(o,n,r);i.push(...u),o.length=0;}e.advance();continue}if(l){if(o.length>0){let u=this.parseClause(o,n,r);i.push(...u);}e.advance();break}o.push(s),e.advance();}if(o.length>0){let s=this.parseClause(o,n,r);i.push(...s);}return i.length>1?[St(i,"then",{sourceLanguage:r})]:i}parseClause(e,n,r){if(e.length===0)return [];let i=new ze(e,r),o=[];for(;!i.isAtEnd();){let s=G.matchBest(i,n);s?o.push(this.buildCommand(s,r)):i.advance();}if(o.length===0){let s=this.parseSOVClauseByVerbAnchoring(e,r);if(s.length>0)return s}return o}static buildVerbLookup(e){let n=new Map;for(let[r,i]of Object.entries(e.keywords))if(!["on","if","else","when","where","while","for","end","then","and"].includes(r)&&(n.set(i.primary.toLowerCase(),r),i.alternatives))for(let o of i.alternatives)n.set(o.toLowerCase(),r);return n}static buildMarkerToRoleLookup(e){let n=new Map;for(let[r,i]of Object.entries(e.roleMarkers))if(i&&(n.set(i.primary,r),i.alternatives))for(let o of i.alternatives)n.has(o)||n.set(o,r);return n}parseSOVClauseByVerbAnchoring(e,n){let r=V(n);if(!r||r.wordOrder!=="SOV")return [];let i=F.buildVerbLookup(r),o=F.buildMarkerToRoleLookup(r),s=[],a=0;for(;a<e.length;){let l=-1,u="";for(let f=a;f<e.length;f++){let v=e[f],A=i.get(v.value.toLowerCase()),x=v.normalized?i.get(v.normalized.toLowerCase()):void 0,O=A||x;if(O){l=f,u=O;break}}if(l===-1)break;let c=e.slice(a,l),d=e.length;for(let f=l+1;f<e.length;f++){let v=e[f];if(v.kind==="conjunction"||this.isThenKeyword(v.value,n)){d=f;break}if(f>l+1&&(i.get(v.value.toLowerCase())||(v.normalized?i.get(v.normalized.toLowerCase()):void 0))){d=f;break}}let m=e.slice(l+1,d),p=this.extractRolesFromMarkedTokens(c,m,o,u,n);if(s.push(me(u,p,{sourceLanguage:n,confidence:.7})),a=d,a<e.length){let f=e[a];(f.kind==="conjunction"||this.isThenKeyword(f.value,n))&&a++;}}return s}extractRolesFromMarkedTokens(e,n,r,i,o){let s={},a=l=>{let u=[];for(let c of l){let d=r.get(c.value);if(d&&c.kind==="particle"&&u.length>0){let m=this.tokensToSemanticValue(u);if(m){let p=this.mapRoleForCommand(d,i,s);p&&(s[p]=m);}u=[];}else u.push(c);}if(u.length>0){let c=this.tokensToSemanticValue(u);c&&(s.patient?s.destination||(s.destination=c):s.patient=c);}};return a(e),a(n),s}mapRoleForCommand(e,n,r){return r[e]?e==="patient"&&!r.destination?"destination":e==="destination"&&!r.patient?"patient":e==="source"&&!r.source?"source":null:e}tokensToSemanticValue(e){if(e.length===0)return null;let n=e.filter(o=>o.kind!=="whitespace");if(n.length===0)return null;if(n.length===1)return this.tokenToSemanticValue(n[0]);let r=n.map(o=>o.value).join(""),i=n[0];return i.kind==="selector"||i.value.startsWith("#")||i.value.startsWith(".")||i.value.startsWith("@")||i.value.startsWith("*")?oe(r):i.kind==="literal"||i.value.startsWith('"')||i.value.startsWith("'")?C(r):i.kind==="reference"?j(r):C(r)}tokenToSemanticValue(e){let n=e.value;if(e.kind==="selector"||n.startsWith("#")||n.startsWith(".")||n.startsWith("@")||n.startsWith("*"))return oe(n);if(n.startsWith('"')||n.startsWith("'"))return C(n);if(/^-?\d+(\.\d+)?$/.test(n))return C(parseFloat(n));if(n==="true"||n==="\u771F"||n==="\uCC38"||n==="do\u011Fru")return C(true);if(n==="false"||n==="\u507D"||n==="\uAC70\uC9D3"||n==="yanl\u0131\u015F")return C(false);let r=e.normalized?.toLowerCase();return r==="me"||r==="it"||r==="you"||r==="result"||r==="body"?j(r):e.kind==="reference"?j(e.normalized||"me"):C(n)}parseBodyWithGrammarPatterns(e,n,r,i){let o=[];for(;!e.isAtEnd();){let s=e.peek();if(s&&this.isThenKeyword(s.value,i)){e.advance();continue}if(s&&this.isEndKeyword(s.value,i)){e.advance();break}let a=false;if(r.length>0){let l=G.matchBest(e,r);if(l){let u=l.pattern.command,c={};for(let[p,f]of l.captured)p!=="event"&&p!=="action"&&p!=="continues"&&(c[p]=f);let d=me(u,c,{sourceLanguage:i,patternId:l.pattern.id});o.push(d),a=true;let m=l.captured.get("continues");if(m&&m.type==="literal"&&m.value==="then")continue}}if(!a){let l=G.matchBest(e,n);l&&(o.push(this.buildCommand(l,i)),a=true);}a||e.advance();}return o}tryCompoundCommandParsing(e,n,r){let i=e.tokens;if(!i.some(l=>l.kind==="conjunction"||l.kind==="keyword"&&this.isThenKeyword(l.value,r)))return null;let s=new ze(i,r),a=this.parseBodyWithClauses(s,n,r);return a.length===0?null:a.length===1?a[0]:St(a,"then",{sourceLanguage:r,confidence:.65})}trySOVEventExtraction(e,n,r){let i=F.SOV_EVENT_MARKERS[n];if(!i)return null;let s=Te(e,n).tokens,a=fi[n],l=new Set;if(a)for(let y of Object.keys(a))l.add(y.toLowerCase());let u=F.SOV_SOURCE_MARKERS[n],c=-1,d="",m="",p=1;for(let y=0;y<s.length;y++){let N=s[y],q=N.value.toLowerCase(),$=q,U="",ve=q.indexOf("[");ve>0&&($=q.slice(0,ve),U=N.value.slice(ve));let ye=N.normalized?.toLowerCase(),Oe=ye&&F.KNOWN_EVENTS.has(ye),Le=l.has(q)||l.has($),er=F.KNOWN_EVENTS.has($);if(Oe||Le||er){let ee;if(Oe?ee=ye:Le?ee=a?.[q]??a?.[$]??$:ee=$,i.size>0){let ce=1,ge=s[y+1];ge&&ge.kind==="selector"&&ge.value.startsWith("[")&&(ce=2);let ue=s[y+ce];if(ue&&(ue.kind==="particle"||ue.kind==="keyword")&&i.has(ue.value)){c=y,d=ee,m=U||(ce===2?s[y+1].value:""),p=ce+1;break}}else {c=y,d=ee,m=U,p=1;break}}}if(c===-1)return null;let f=new Set;for(let y=c;y<c+p;y++)f.add(y);if(u){let y=c+p;if(y<s.length){let N=s[y];(N.kind==="particle"||N.kind==="keyword")&&u.markers.has(N.value)&&f.add(y);}for(let N=0;N<c;N++){let q=s[N],$=q.value.toLowerCase(),U=q.normalized?.toLowerCase();if(u.windowTokens.has($)||U&&u.windowTokens.has(U)){f.add(N);break}}}let v=s.filter((y,N)=>!f.has(N));if(v.length===0)return null;let A=r.filter(y=>y.command!=="on"),x=new ze(v,n),O=this.parseBodyWithClauses(x,A,n);if(O.length===0)return null;let Me={sourceLanguage:n,confidence:.75};return m&&(Me.keyFilter=m),Tt({type:"literal",value:d},O,void 0,Me)}isThenKeyword(e,n){let r={en:new Set(["then"]),ja:new Set(["\u305D\u308C\u304B\u3089","\u6B21\u306B","\u305D\u3057\u3066"]),ar:new Set(["\u062B\u0645","\u0628\u0639\u062F\u0647\u0627","\u062B\u0645\u0651"]),es:new Set(["entonces","luego","despu\xE9s"]),ko:new Set(["\uADF8\uB2E4\uC74C","\uADF8\uB9AC\uACE0","\uADF8\uB7F0\uD6C4","\uADF8\uB7EC\uBA74"]),zh:new Set(["\u7136\u540E","\u63A5\u7740","\u4E4B\u540E"]),tr:new Set(["sonra","ard\u0131ndan","daha sonra"]),pt:new Set(["ent\xE3o","depois","logo"]),fr:new Set(["puis","ensuite","alors"]),de:new Set(["dann","danach","anschlie\xDFend"]),id:new Set(["lalu","kemudian","setelah itu"]),tl:new Set(["pagkatapos","tapos"]),bn:new Set(["\u09A4\u09BE\u09B0\u09AA\u09B0","\u09AA\u09B0\u09C7"]),qu:new Set(["chaymantataq","hinaspa","chaymanta","chayqa"]),sw:new Set(["kisha","halafu","baadaye"])};return (r[n]||r.en).has(e.toLowerCase())}isEndKeyword(e,n){let r={en:new Set(["end"]),ja:new Set(["\u7D42\u308F\u308A","\u7D42\u4E86","\u304A\u308F\u308A"]),ar:new Set(["\u0646\u0647\u0627\u064A\u0629","\u0627\u0646\u062A\u0647\u0649","\u0622\u062E\u0631"]),es:new Set(["fin","final","terminar"]),ko:new Set(["\uB05D","\uC885\uB8CC","\uB9C8\uCE68"]),zh:new Set(["\u7ED3\u675F","\u7EC8\u6B62","\u5B8C"]),tr:new Set(["son","biti\u015F","bitti"]),pt:new Set(["fim","final","t\xE9rmino"]),fr:new Set(["fin","terminer","finir"]),de:new Set(["ende","beenden","fertig"]),id:new Set(["selesai","akhir","tamat"]),tl:new Set(["wakas","tapos"]),bn:new Set(["\u09B8\u09AE\u09BE\u09AA\u09CD\u09A4"]),qu:new Set(["tukukuy","tukuy","puchukay"]),sw:new Set(["mwisho","maliza","tamati"])};return (r[n]||r.en).has(e.toLowerCase())}extractStandaloneModifiers(e,n){let i=Te(e,n).tokens;if(i.length===0)return {modifiers:null,remainingInput:null};let s=i[0].value.toLowerCase(),a=F.STANDALONE_MODIFIERS[s];if(!a)return {modifiers:null,remainingInput:null};let l={},u=1;if(a==="once")l.once=true;else {let p=1;if(p<i.length){let f=i[p];(f.kind==="keyword"||f.kind==="particle")&&(p++,u++);}if(p<i.length){let f=i[p];if(f.kind==="literal"){let v=f.value.match(/^(\d+)(ms|s|m)?$/);if(v){let A=parseInt(v[1],10),x=v[2]||"ms";x==="s"?A*=1e3:x==="m"&&(A*=6e4),l[a]=A,u=p+1;}}}l[a]||(l[a]=a==="debounce"?300:100);}let c=i.slice(u);if(c.length===0)return {modifiers:null,remainingInput:null};let d=c[0].position.start,m=e.slice(d);return {modifiers:l,remainingInput:m}}applyModifiers(e,n){return {...e,eventModifiers:{...e.eventModifiers,...n}}}extractOrConjunctionEvents(e,n){let r=[];for(;;){let i=e.mark(),o=e.peek();if(!o)break;let s=(o.normalized||o.value).toLowerCase();if(!F.OR_KEYWORDS.has(s)){e.reset(i);break}e.advance();let a=e.peek();if(!a){e.reset(i);break}let l=(a.normalized||a.value).toLowerCase();e.advance(),r.push({type:"literal",value:l});}return r}};J.KNOWN_EVENTS=new Set(["click","dblclick","input","change","submit","keydown","keyup","keypress","mouseover","mouseout","mousedown","mouseup","focus","blur","load","scroll","resize","contextmenu"]);J.SOV_EVENT_MARKERS={ja:new Set(["\u3067"]),ko:new Set,tr:new Set(["de","da","te","ta"]),bn:new Set(["\u098F"]),qu:new Set(["pi"])};J.SOV_SOURCE_MARKERS={ja:{markers:new Set(["\u304B\u3089"]),windowTokens:new Set(["\u30A6\u30A3\u30F3\u30C9\u30A6","\u30C9\u30AD\u30E5\u30E1\u30F3\u30C8","window","document"])},ko:{markers:new Set(["\uC5D0\uC11C"]),windowTokens:new Set(["\uCC3D","\uC708\uB3C4\uC6B0","\uBB38\uC11C","window","document"])},tr:{markers:new Set(["den","dan","ten","tan"]),windowTokens:new Set(["pencere","belge","window","document"])},bn:{markers:new Set(["\u09A5\u09C7\u0995\u09C7","\u09AE\u09A7\u09CD\u09AF\u09C7"]),windowTokens:new Set(["\u0989\u0987\u09A8\u09CD\u09A1\u09CB","\u09A1\u0995\u09C1\u09AE\u09C7\u09A8\u09CD\u099F","window","document"])},qu:{markers:new Set(["manta"]),windowTokens:new Set(["k_iri","ventana","window","document"])}};J.STANDALONE_MODIFIERS={once:"once",debounced:"debounce",debounce:"debounce",throttled:"throttle",throttle:"throttle"};J.OR_KEYWORDS=new Set(["or","\u0623\u0648","o","ou","oder","atau","atau","\u6216","\u307E\u305F\u306F","\uB610\uB294","veya","\u0985\u09A5\u09AC\u09BE","utaq","au","\u0430\u0431\u043E","\u0438\u043B\u0438","ho\u1EB7c","lub","\u05D0\u05D5","\u0E2B\u0E23\u0E37\u0E2D","o"]);var vi=J,yi=new vi;function Ne(t,e){return yi.parse(t,e)}var Ce=class{constructor(t={}){this.cache=new Map,this.config={maxSize:t.maxSize??1e3,ttlMs:t.ttlMs??0,enabled:t.enabled??true},this.stats={hits:0,misses:0,evictions:0,expirations:0};}makeKey(t,e){return `${e}:${t}`}isExpired(t){return this.config.ttlMs===0?false:Date.now()-t.createdAt>this.config.ttlMs}evictLRU(){let t=this.cache.keys().next().value;t!==void 0&&(this.cache.delete(t),this.stats.evictions++);}get(t,e){if(!this.config.enabled){this.stats.misses++;return}let n=this.makeKey(t,e),r=this.cache.get(n);if(!r){this.stats.misses++;return}if(this.isExpired(r)){this.cache.delete(n),this.stats.expirations++,this.stats.misses++;return}return this.cache.delete(n),r.lastAccessed=Date.now(),this.cache.set(n,r),this.stats.hits++,r.result}set(t,e,n){if(!this.config.enabled||n.confidence===0)return;let r=this.makeKey(t,e),i=Date.now();for(;this.cache.size>=this.config.maxSize;)this.evictLRU();this.cache.set(r,{result:n,createdAt:i,lastAccessed:i});}has(t,e){if(!this.config.enabled)return false;let n=this.makeKey(t,e),r=this.cache.get(n);return r?this.isExpired(r)?(this.cache.delete(n),this.stats.expirations++,false):true:false}delete(t,e){let n=this.makeKey(t,e);return this.cache.delete(n)}clear(){this.cache.clear();}resetStats(){this.stats={hits:0,misses:0,evictions:0,expirations:0};}getStats(){let t=this.stats.hits+this.stats.misses;return {hits:this.stats.hits,misses:this.stats.misses,size:this.cache.size,maxSize:this.config.maxSize,hitRate:t>0?this.stats.hits/t:0,evictions:this.stats.evictions,expirations:this.stats.expirations,enabled:this.config.enabled}}configure(t){if(t.maxSize!==void 0)for(this.config.maxSize=t.maxSize;this.cache.size>this.config.maxSize;)this.evictLRU();t.ttlMs!==void 0&&(this.config.ttlMs=t.ttlMs),t.enabled!==void 0&&(this.config.enabled=t.enabled);}enable(){this.config.enabled=true;}disable(){this.config.enabled=false;}getConfig(){return {...this.config}}},gi=new Ce;var wi=class{constructor(t={}){this.patternMatcher=new Wt,this.languages=new Set(Bt()),t.cache===false?this.cache=new Ce({enabled:false}):this.cache=t.cache?new Ce(t.cache):gi;}analyze(t,e){if(!this.supportsLanguage(e))return {confidence:0,errors:[`Language '${e}' is not supported for semantic parsing`]};let n=this.cache.get(t,e);if(n)return n;let r=this.analyzeUncached(t,e);return this.cache.set(t,e,r),r}analyzeUncached(t,e){try{try{let s=Ne(t,e),a={confidence:s.metadata?.confidence??.8,node:s};return s.kind==="command"?{...a,command:{name:s.action,roles:s.roles}}:a}catch{}let n=pi(e);if(!n)return {confidence:0,errors:[`No tokenizer available for language '${e}'`]};let r=n.tokenize(t),i=H(e);if(i.length===0)return {confidence:0,errors:[`No patterns available for language '${e}'`]};let o=this.patternMatcher.matchBest(r,i);if(o){let s=this.buildSemanticNode(o);return {confidence:o.confidence,command:{name:o.pattern.command,roles:o.captured},node:s,tokensConsumed:o.consumedTokens}}return {confidence:0,errors:["No pattern matched the input"]}}catch(n){return {confidence:0,errors:[n instanceof Error?n.message:String(n)]}}}supportsLanguage(t){return this.languages.has(t)}supportedLanguages(){return Array.from(this.languages)}getCacheStats(){return this.cache.getStats()}clearCache(){this.cache.clear();}configureCache(t){this.cache.configure(t);}buildSemanticNode(t){return {kind:"command",action:t.pattern.command,roles:t.captured,metadata:{patternId:t.pattern.id}}}};function qt(t){return new wi(t)}var Ei=.5;function $t(t,e=Ei){return t.confidence>=e&&t.command!==void 0}var ki={action:"toggle",description:"Toggle a class or attribute on/off",category:"dom-class",primaryRole:"patient",roles:[{role:"patient",description:"The class or attribute to toggle",required:true,expectedTypes:["selector"],svoPosition:1,sovPosition:2},{role:"destination",description:"The target element (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:2,sovPosition:1}],errorCodes:["MISSING_ARGUMENT","NO_VALID_CLASS_NAMES","INVALID_CSS_PROPERTY"],preconditions:[{condition:"Command has at least one argument",errorCode:"MISSING_ARGUMENT",message:"toggle command requires an argument"},{condition:"Class names are valid CSS identifiers",errorCode:"NO_VALID_CLASS_NAMES",message:"toggle command: no valid class names found"}],recoveryHints:{MISSING_ARGUMENT:"Add a class selector (.classname) or attribute to toggle",NO_VALID_CLASS_NAMES:"Ensure class names start with a dot (.) and are valid CSS identifiers",INVALID_CSS_PROPERTY:"Check CSS property name syntax (use kebab-case)"}},bi={action:"add",description:"Add a class or attribute to an element",category:"dom-class",primaryRole:"patient",roles:[{role:"patient",description:"The class or attribute to add",required:true,expectedTypes:["selector"],svoPosition:1,sovPosition:2},{role:"destination",description:"The target element (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:2,sovPosition:1,markerOverride:{en:"to"}}],errorCodes:["MISSING_ARGUMENT","NO_VALID_CLASS_NAMES","PROPERTY_REQUIRES_VALUE"],preconditions:[{condition:"Command has at least one argument",errorCode:"MISSING_ARGUMENT",message:"add command requires an argument"}],recoveryHints:{MISSING_ARGUMENT:"Add a class selector (.classname) or attribute to add",NO_VALID_CLASS_NAMES:"Ensure class names start with a dot (.) and are valid CSS identifiers",PROPERTY_REQUIRES_VALUE:"When adding a property (*prop), provide a value argument"}},zi={action:"remove",description:"Remove a class or attribute from an element",category:"dom-class",primaryRole:"patient",roles:[{role:"patient",description:"The class or attribute to remove",required:true,expectedTypes:["selector"],svoPosition:1,sovPosition:2},{role:"source",description:"The element to remove from (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:2,sovPosition:1}],errorCodes:["MISSING_ARGUMENT","NO_VALID_CLASS_NAMES"],preconditions:[{condition:"Command has at least one argument",errorCode:"MISSING_ARGUMENT",message:"remove command requires an argument"}],recoveryHints:{MISSING_ARGUMENT:"Add a class selector (.classname) or attribute to remove",NO_VALID_CLASS_NAMES:"Ensure class names start with a dot (.) and are valid CSS identifiers"}},Ti={action:"put",description:"Put content into a target element or variable",category:"dom-content",primaryRole:"patient",roles:[{role:"patient",description:"The content to put",required:true,expectedTypes:["literal","selector","reference","expression"],svoPosition:1,sovPosition:1},{role:"destination",description:"Where to put the content",required:true,expectedTypes:["selector","reference"],svoPosition:2,sovPosition:2,markerOverride:{en:"into"}}],errorCodes:["MISSING_ARGUMENTS","MISSING_CONTENT","MISSING_POSITION","INVALID_POSITION","NO_TARGET","NO_ELEMENTS"],preconditions:[{condition:"Command has content and position arguments",errorCode:"MISSING_ARGUMENTS",message:"put requires arguments"},{condition:"Content to put is specified",errorCode:"MISSING_CONTENT",message:"put requires content"},{condition:"Position keyword is specified (into, before, after, etc.)",errorCode:"MISSING_POSITION",message:"put requires position keyword"}],recoveryHints:{MISSING_ARGUMENTS:"Use syntax: put <content> into/before/after <target>",MISSING_CONTENT:"Add content to put (string, element, or expression)",MISSING_POSITION:"Add position keyword: into, before, after, at start of, at end of",INVALID_POSITION:"Valid positions: into, before, after, at start of, at end of",NO_TARGET:'Ensure target element exists or use "me" reference',NO_ELEMENTS:"Check that the selector matches existing elements"}},Si={action:"set",description:"Set a property or variable to a value",category:"variable",primaryRole:"destination",roles:[{role:"destination",description:"The property or variable to set",required:true,expectedTypes:["selector","reference","expression"],svoPosition:1,sovPosition:1,markerOverride:{en:"",ja:"\u3092",ko:"\uB97C",tr:"i",ar:"",sw:"",tl:"",bn:"\u0995\u09C7",qu:"ta"}},{role:"patient",description:"The value to set",required:true,expectedTypes:["literal","expression","reference"],svoPosition:2,sovPosition:2,markerOverride:{en:"to",es:"a",pt:"para",fr:"\xE0",de:"auf",id:"ke",ja:"\u306B",ko:"\uC73C\uB85C",tr:"e",ar:"\u0625\u0644\u0649",sw:"kwenye",tl:"sa",bn:"\u09A4\u09C7",qu:"man"}}],errorCodes:["MISSING_TARGET","INVALID_TARGET","MISSING_VALUE","INVALID_SYNTAX"],preconditions:[{condition:"Command has a target variable or property",errorCode:"MISSING_TARGET",message:"set command requires a target"},{condition:"Target is a valid variable or property reference",errorCode:"INVALID_TARGET",message:"set command target must be a string or object literal"},{condition:'Value is specified with "to" keyword',errorCode:"MISSING_VALUE",message:'set command requires a value (use "to" keyword)'}],recoveryHints:{MISSING_TARGET:"Add a target: set :variable to value OR set element.property to value",INVALID_TARGET:'Use local variable (:name), element property (el.prop), or "the X of Y" syntax',MISSING_VALUE:'Add "to <value>" to specify what to set',INVALID_SYNTAX:"Use syntax: set <target> to <value>"}},xi={action:"show",description:"Make an element visible",category:"dom-visibility",primaryRole:"patient",roles:[{role:"patient",description:"The element to show",required:true,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:1,sovPosition:1},{role:"style",description:"Animation style (fade, slide, etc.)",required:false,expectedTypes:["literal"],svoPosition:2,sovPosition:2}]},Ci={action:"hide",description:"Make an element invisible",category:"dom-visibility",primaryRole:"patient",roles:[{role:"patient",description:"The element to hide",required:true,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:1,sovPosition:1},{role:"style",description:"Animation style (fade, slide, etc.)",required:false,expectedTypes:["literal"],svoPosition:2,sovPosition:2}]},Ai={action:"on",description:"Handle an event",category:"event",primaryRole:"event",hasBody:true,roles:[{role:"event",description:"The event to handle",required:true,expectedTypes:["literal"],svoPosition:1,sovPosition:2},{role:"source",description:"The element to listen on (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:2,sovPosition:1}]},Ni={action:"trigger",description:"Trigger/dispatch an event",category:"event",primaryRole:"event",roles:[{role:"event",description:"The event to trigger (supports namespaced events like draggable:start)",required:true,expectedTypes:["literal","expression"],svoPosition:1,sovPosition:2},{role:"destination",description:"The target element (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:2,sovPosition:1}]},Ri={action:"wait",description:"Wait for a duration or event",category:"async",primaryRole:"patient",roles:[{role:"patient",description:"Duration or event to wait for",required:true,expectedTypes:["literal","expression"],svoPosition:1,sovPosition:1}]},Pi={action:"fetch",description:"Fetch data from a URL",category:"async",primaryRole:"source",roles:[{role:"source",description:"The URL to fetch from",required:true,expectedTypes:["literal","expression"],svoPosition:1,sovPosition:1,renderOverride:{en:""}},{role:"responseType",description:"Response format (json, text, html, blob, etc.)",required:false,expectedTypes:["literal","expression"],svoPosition:2,sovPosition:2},{role:"method",description:"HTTP method (GET, POST, etc.)",required:false,expectedTypes:["literal"],svoPosition:3,sovPosition:3},{role:"destination",description:"Where to store the result",required:false,expectedTypes:["selector","reference"],svoPosition:4,sovPosition:4}]},Ii={action:"increment",description:"Increment a numeric value",category:"variable",primaryRole:"patient",roles:[{role:"patient",description:"The value to increment",required:true,expectedTypes:["selector","reference","expression"],svoPosition:1,sovPosition:1},{role:"quantity",description:"Amount to increment by (defaults to 1)",required:false,expectedTypes:["literal"],default:{type:"literal",value:1,dataType:"number"},svoPosition:2,sovPosition:2,markerOverride:{en:"by"}}]},_i={action:"decrement",description:"Decrement a numeric value",category:"variable",primaryRole:"patient",roles:[{role:"patient",description:"The value to decrement",required:true,expectedTypes:["selector","reference","expression"],svoPosition:1,sovPosition:1},{role:"quantity",description:"Amount to decrement by (defaults to 1)",required:false,expectedTypes:["literal"],default:{type:"literal",value:1,dataType:"number"},svoPosition:2,sovPosition:2,markerOverride:{en:"by"}}]},Mi={action:"append",description:"Append content to an element",category:"dom-content",primaryRole:"patient",roles:[{role:"patient",description:"The content to append",required:true,expectedTypes:["literal","selector","expression"],svoPosition:1,sovPosition:2},{role:"destination",description:"The element to append to",required:true,expectedTypes:["selector","reference"],svoPosition:2,sovPosition:1,markerOverride:{en:"to"}}]},Oi={action:"prepend",description:"Prepend content to an element",category:"dom-content",primaryRole:"patient",roles:[{role:"patient",description:"The content to prepend",required:true,expectedTypes:["literal","selector","expression"],svoPosition:1,sovPosition:2},{role:"destination",description:"The element to prepend to",required:true,expectedTypes:["selector","reference"],svoPosition:2,sovPosition:1,markerOverride:{en:"to"}}]},Li={action:"log",description:"Log a value to the console",category:"variable",primaryRole:"patient",roles:[{role:"patient",description:"The value to log",required:true,expectedTypes:["literal","selector","reference","expression"],svoPosition:1,sovPosition:1}]},Di={action:"get",description:"Get a value from a source",category:"variable",primaryRole:"source",roles:[{role:"source",description:"The source to get from",required:true,expectedTypes:["selector","reference","expression"],svoPosition:1,sovPosition:2,markerOverride:{en:"",es:"",pt:"",fr:"",de:"",ja:"\u3092",zh:"",ko:"\uB97C",ar:"\u0639\u0644\u0649",tr:"i",id:"",sw:"",tl:"",bn:"\u0995\u09C7",qu:"ta"}},{role:"destination",description:"Where to store the result (optional)",required:false,expectedTypes:["reference"],svoPosition:2,sovPosition:1}]},Bi={action:"take",description:"Take content from a source element",category:"dom-content",primaryRole:"patient",roles:[{role:"patient",description:"The class or element to take",required:true,expectedTypes:["selector"],svoPosition:1,sovPosition:2},{role:"source",description:"The element to take from (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:2,sovPosition:1}]},Wi={action:"make",description:"Create a new element",category:"dom-content",primaryRole:"patient",roles:[{role:"patient",description:"The element type or selector to create",required:true,expectedTypes:["literal","selector"],svoPosition:1,sovPosition:1}]},Fi={action:"halt",description:"Halt/stop execution or event propagation",category:"control-flow",primaryRole:"patient",roles:[{role:"patient",description:"What to halt (event, default, bubbling, etc.)",required:false,expectedTypes:["literal","reference","expression"],svoPosition:1,sovPosition:1}]},qi={action:"settle",description:"Wait for animations/transitions to settle",category:"async",primaryRole:"patient",roles:[{role:"patient",description:"The element to settle (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:1,sovPosition:1}]},$i={action:"throw",description:"Throw an error",category:"control-flow",primaryRole:"patient",roles:[{role:"patient",description:"The error message or object to throw",required:true,expectedTypes:["literal","expression"],svoPosition:1,sovPosition:1}]},ji={action:"send",description:"Send an event to an element",category:"event",primaryRole:"event",roles:[{role:"event",description:"The event to send",required:true,expectedTypes:["literal","expression"],svoPosition:1,sovPosition:2},{role:"destination",description:"The target element (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:2,sovPosition:1,markerOverride:{en:"to",ja:"\u306B",ar:"\u0625\u0644\u0649",es:"a",ko:"\uC5D0\uAC8C",zh:"\u5230",tr:"-e",pt:"para",fr:"\xE0",de:"an",id:"ke",qu:"-man",sw:"kwa"}}]},Vi={action:"if",description:"Conditional execution",category:"control-flow",primaryRole:"condition",hasBody:true,roles:[{role:"condition",description:"The condition to evaluate",required:true,expectedTypes:["expression"],svoPosition:1,sovPosition:1}]},Ui={action:"unless",description:"Negated conditional execution (executes when condition is false)",category:"control-flow",primaryRole:"condition",hasBody:true,roles:[{role:"condition",description:"The condition to evaluate (body executes when false)",required:true,expectedTypes:["expression"],svoPosition:1,sovPosition:1}]},Ki={action:"else",description:"Else branch of conditional",category:"control-flow",primaryRole:"patient",hasBody:true,roles:[]},Gi={action:"repeat",description:"Repeat a block of commands",category:"control-flow",primaryRole:"loopType",hasBody:true,roles:[{role:"loopType",description:"Loop variant: forever, times, for, while, until, until-event",required:true,expectedTypes:["literal"],svoPosition:0,sovPosition:0},{role:"quantity",description:"Number of times to repeat",required:false,expectedTypes:["literal","expression"],svoPosition:1,sovPosition:1},{role:"event",description:"Event to wait for (terminates loop)",required:false,expectedTypes:["literal","expression"],svoPosition:2,sovPosition:2},{role:"source",description:"Element to listen for event on",required:false,expectedTypes:["selector","reference"],svoPosition:3,sovPosition:3}],notes:'Can also use "repeat forever", "repeat until condition", or "repeat until event X from Y"'},Hi={action:"for",description:"Iterate over a collection",category:"control-flow",primaryRole:"patient",hasBody:true,roles:[{role:"patient",description:"The iteration variable",required:true,expectedTypes:["reference"],svoPosition:1,sovPosition:2},{role:"source",description:"The collection to iterate over",required:true,expectedTypes:["selector","reference","expression"],svoPosition:2,sovPosition:1,markerOverride:{en:"in"}}]},Qi={action:"while",description:"Loop while condition is true",category:"control-flow",primaryRole:"condition",hasBody:true,roles:[{role:"condition",description:"The condition to check",required:true,expectedTypes:["expression"],svoPosition:1,sovPosition:1}]},Xi={action:"continue",description:"Continue to next loop iteration",category:"control-flow",primaryRole:"patient",roles:[]},Zi={action:"go",description:"Navigate to a URL",category:"navigation",primaryRole:"destination",roles:[{role:"destination",description:"The URL to navigate to",required:true,expectedTypes:["literal","expression"],svoPosition:1,sovPosition:1,markerOverride:{en:"to"},renderOverride:{en:""}}]},Yi={action:"transition",description:"Transition an element with animation",category:"dom-visibility",primaryRole:"patient",roles:[{role:"patient",description:"The property to transition (opacity, *background-color, etc.)",required:true,expectedTypes:["literal"],svoPosition:1,sovPosition:2,markerOverride:{en:"",ar:"",tl:"",sw:""}},{role:"goal",description:"The target value to transition to",required:true,expectedTypes:["literal","expression"],svoPosition:2,sovPosition:3,markerOverride:{en:"to",ar:"\u0625\u0644\u0649",tl:"sa",sw:"kwenye",bn:"\u09A4\u09C7",qu:"man",es:"a",pt:"para",fr:"\xE0",de:"auf",ja:"\u306B",ko:"\uC73C\uB85C",tr:"e",id:"ke"}},{role:"destination",description:"The target element (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:3,sovPosition:1},{role:"duration",description:"Transition duration (over 500ms, for 2 seconds)",required:false,expectedTypes:["literal"],svoPosition:4,sovPosition:4,markerOverride:{en:"over"}},{role:"style",description:"Easing function (ease-in, linear, etc.)",required:false,expectedTypes:["literal"],svoPosition:5,sovPosition:5}]},Ji={action:"clone",description:"Clone an element",category:"dom-content",primaryRole:"patient",roles:[{role:"patient",description:"The element to clone",required:true,expectedTypes:["selector","reference"],svoPosition:1,sovPosition:2},{role:"destination",description:"Where to put the clone",required:false,expectedTypes:["selector","reference"],svoPosition:2,sovPosition:1,markerOverride:{en:"into"}}]},eo={action:"focus",description:"Focus an element",category:"dom-content",primaryRole:"patient",roles:[{role:"patient",description:"The element to focus (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:1,sovPosition:1}]},to={action:"blur",description:"Remove focus from an element",category:"dom-content",primaryRole:"patient",roles:[{role:"patient",description:"The element to blur (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:1,sovPosition:1}]},ro={action:"call",description:"Call a function",category:"control-flow",primaryRole:"patient",roles:[{role:"patient",description:"The function to call",required:true,expectedTypes:["expression","reference"],svoPosition:1,sovPosition:1}]},no={action:"return",description:"Return a value from a function",category:"control-flow",primaryRole:"patient",roles:[{role:"patient",description:"The value to return",required:false,expectedTypes:["literal","expression","reference"],svoPosition:1,sovPosition:1}]},io={action:"js",description:"Execute raw JavaScript code",category:"control-flow",primaryRole:"patient",hasBody:true,roles:[{role:"patient",description:"The JavaScript code to execute",required:false,expectedTypes:["expression"],svoPosition:1,sovPosition:1}]},oo={action:"async",description:"Execute commands asynchronously",category:"async",primaryRole:"patient",hasBody:true,roles:[]},so={action:"tell",description:"Execute commands in context of another element",category:"control-flow",primaryRole:"destination",hasBody:true,roles:[{role:"destination",description:"The element to tell",required:true,expectedTypes:["selector","reference"],svoPosition:1,sovPosition:1,markerOverride:{en:""}}]},ao={action:"default",description:"Set a default value for a variable",category:"variable",primaryRole:"destination",roles:[{role:"destination",description:"The variable to set default for",required:true,expectedTypes:["reference"],svoPosition:1,sovPosition:1,markerOverride:{en:"",ar:"",tl:"",sw:"",bn:"\u0995\u09C7",qu:"ta"}},{role:"patient",description:"The default value",required:true,expectedTypes:["literal","expression"],svoPosition:2,sovPosition:2,markerOverride:{en:"to",ar:"\u0625\u0644\u0649",tl:"sa",sw:"kwenye",bn:"\u09A4\u09C7",qu:"man"}}]},lo={action:"init",description:"Initialization block that runs once",category:"control-flow",primaryRole:"patient",hasBody:true,roles:[]},co={action:"behavior",description:"Define a reusable behavior",category:"control-flow",primaryRole:"patient",hasBody:true,roles:[{role:"patient",description:"The behavior name (PascalCase identifier)",required:true,expectedTypes:["literal","reference","expression"],svoPosition:1,sovPosition:1}]},uo={action:"install",description:"Install a behavior on an element",category:"control-flow",primaryRole:"patient",roles:[{role:"patient",description:"The behavior name to install",required:true,expectedTypes:["literal","reference","expression"],svoPosition:1,sovPosition:2},{role:"destination",description:"Element to install on (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:2,sovPosition:1}]},mo={action:"measure",description:"Measure element dimensions (x, y, width, height, etc.)",category:"dom-content",primaryRole:"patient",roles:[{role:"patient",description:"Property to measure (x, y, width, height, top, left, etc.)",required:false,expectedTypes:["literal","expression"],svoPosition:1,sovPosition:1},{role:"source",description:"Element to measure (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:2,sovPosition:2,markerOverride:{en:"of"}}]},po={action:"swap",description:"Swap DOM content using various strategies (innerHTML, outerHTML, delete, etc.)",category:"dom-content",primaryRole:"destination",roles:[{role:"method",description:"The swap strategy (innerHTML, outerHTML, beforebegin, afterend, delete)",required:false,expectedTypes:["literal"],svoPosition:1,sovPosition:3,markerOverride:{en:""}},{role:"destination",description:"The element to swap content in/for",required:true,expectedTypes:["selector","reference"],svoPosition:2,sovPosition:1,markerOverride:{en:"of"}},{role:"patient",description:"The content to swap in (optional for delete)",required:false,expectedTypes:["literal","expression","selector"],svoPosition:3,sovPosition:2,markerOverride:{en:"with"}}]},fo={action:"morph",description:"Morph an element into another using DOM diffing",category:"dom-content",primaryRole:"destination",roles:[{role:"destination",description:"The element to morph",required:true,expectedTypes:["selector","reference"],svoPosition:1,sovPosition:1,markerOverride:{en:""}},{role:"patient",description:"The target content/element to morph into",required:true,expectedTypes:["literal","expression","selector"],svoPosition:2,sovPosition:2,markerOverride:{en:"to"}}]},ho={action:"beep",description:"Debug output for expressions with type information",category:"variable",primaryRole:"patient",roles:[{role:"patient",description:"The expression(s) to debug",required:false,expectedTypes:["literal","selector","reference","expression"],svoPosition:1,sovPosition:1}]},vo={action:"break",description:"Exit from the current loop",category:"control-flow",primaryRole:"patient",roles:[]},yo={action:"copy",description:"Copy text or element content to the clipboard",category:"dom-content",primaryRole:"patient",roles:[{role:"patient",description:"The text or element to copy",required:true,expectedTypes:["literal","selector","reference","expression"],svoPosition:1,sovPosition:1}]},go={action:"exit",description:"Exit from the current event handler",category:"control-flow",primaryRole:"patient",roles:[]},wo={action:"pick",description:"Select a random element from a collection",category:"variable",primaryRole:"patient",roles:[{role:"patient",description:"The items to pick from",required:true,expectedTypes:["literal","expression","reference"],svoPosition:1,sovPosition:1},{role:"source",description:'The array to pick from (with "from" keyword)',required:false,expectedTypes:["reference","expression"],svoPosition:2,sovPosition:2}]},Eo={action:"render",description:"Render a template with optional variables",category:"dom-content",primaryRole:"patient",roles:[{role:"patient",description:"The template to render",required:true,expectedTypes:["selector","reference","expression"],svoPosition:1,sovPosition:2},{role:"style",description:"Variables to pass to the template (with keyword)",required:false,expectedTypes:["expression","reference"],svoPosition:2,sovPosition:1}]},jt={toggle:ki,add:bi,remove:zi,put:Ti,set:Si,show:xi,hide:Ci,on:Ai,trigger:Ni,wait:Ri,fetch:Pi,increment:Ii,decrement:_i,append:Mi,prepend:Oi,log:Li,get:Di,take:Bi,make:Wi,halt:Fi,settle:qi,throw:$i,send:ji,if:Vi,unless:Ui,else:Ki,repeat:Gi,for:Hi,while:Qi,continue:Xi,go:Zi,transition:Yi,clone:Ji,focus:eo,blur:to,call:ro,return:no,js:io,async:oo,tell:so,default:ao,init:lo,behavior:co,install:uo,measure:mo,swap:po,morph:fo,beep:ho,break:vo,copy:yo,exit:go,pick:wo,render:Eo,compound:{action:"compound",description:"A compound node representing chained statements",primaryRole:"patient",category:"control-flow",hasBody:true,roles:[]}};function ko(){return Object.values(jt).filter(t=>t.roles.length>0)}typeof process<"u"&&process.env.NODE_ENV!=="production"&&Promise.resolve().then(()=>(ii(),_t)).then(({validateAllSchemas:t,formatValidationResults:e})=>{let n=t(jt);n.size>0&&(console.warn("[SCHEMA VALIDATION] Found issues in command schemas:"),console.warn(e(n)),console.warn(`
|
|
3
|
-
These warnings help identify potential schema design issues.`),console.warn("Fix them to improve type inference and avoid runtime bugs."));}).catch(t=>{console.debug("Schema validation skipped:",t);});function Vt(t,e){let n=e==="SOV"?"sovPosition":"svoPosition";return [...t].sort((r,i)=>{let o=r[n]??99,s=i[n]??99;return o-s})}function bo(t,e){let n=t.markerOverride?.[e.code],r=e.roleMarkers[t.role];if(n!==void 0)return {primary:n,position:r?.position??"before",isOverride:true};if(r&&r.primary){let i={primary:r.primary,position:r.position,isOverride:false};return r.alternatives&&(i.alternatives=r.alternatives),i}return null}function zo(t,e,n,r,i){let o=[];if(o.push({type:"role",role:"event",optional:false}),r.position==="after"){let u=r.primary.split(/\s+/);if(u.length>1)for(let c of u)o.push({type:"literal",value:c});else {let c=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};o.push(c);}}let s=e.roleMarkers.destination;s&&o.push({type:"group",optional:true,tokens:[{type:"role",role:"destination",optional:true},s.alternatives?{type:"literal",value:s.primary,alternatives:s.alternatives}:{type:"literal",value:s.primary}]}),o.push({type:"role",role:"patient",optional:false});let a=e.roleMarkers.patient;if(a){let u=a.alternatives?{type:"literal",value:a.primary,alternatives:a.alternatives}:{type:"literal",value:a.primary};o.push(u);}let l=n.alternatives?{type:"literal",value:n.primary,alternatives:n.alternatives}:{type:"literal",value:n.primary};return o.push(l),{id:`${t.action}-event-${e.code}-sov`,language:e.code,command:"on",priority:(i.basePriority??100)+50,template:{format:`{event} ${r.primary} {destination?} {patient} ${a?.primary||""} ${n.primary}`,tokens:o},extraction:{action:{value:t.action},event:{fromRole:"event"},patient:{fromRole:"patient"},destination:{fromRole:"destination",default:{type:"reference",value:"me"}}}}}function To(t,e,n,r,i){let o=[];o.push({type:"role",role:"patient",optional:false});let s=e.roleMarkers.patient;if(s){let l=s.alternatives?{type:"literal",value:s.primary,alternatives:s.alternatives}:{type:"literal",value:s.primary};o.push(l);}if(o.push({type:"role",role:"event",optional:false}),r.position==="after"){let l=r.primary.split(/\s+/);if(l.length>1)for(let u of l)o.push({type:"literal",value:u});else {let u=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};o.push(u);}}let a=n.alternatives?{type:"literal",value:n.primary,alternatives:n.alternatives}:{type:"literal",value:n.primary};return o.push(a),{id:`${t.action}-event-${e.code}-sov-patient-first`,language:e.code,command:"on",priority:(i.basePriority??100)+45,template:{format:`{patient} ${s?.primary||""} {event} ${r.primary} ${n.primary}`,tokens:o},extraction:{action:{value:t.action},event:{fromRole:"event"},patient:{fromRole:"patient"},destination:{fromRole:"destination",default:{type:"reference",value:"me"}}}}}function So(t,e,n,r,i){let o=[];o.push({type:"role",role:"patient",optional:false});let s=e.roleMarkers.patient;if(s){let u=s.alternatives?{type:"literal",value:s.primary,alternatives:s.alternatives}:{type:"literal",value:s.primary};o.push(u);}let a=e.roleMarkers.destination;if(a&&(o.push({type:"role",role:"destination",optional:false}),o.push(a.alternatives?{type:"literal",value:a.primary,alternatives:a.alternatives}:{type:"literal",value:a.primary})),o.push({type:"role",role:"event",optional:false}),r.position==="after"){let u=r.primary.split(/\s+/);if(u.length>1)for(let c of u)o.push({type:"literal",value:c});else {let c=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};o.push(c);}}let l=n.alternatives?{type:"literal",value:n.primary,alternatives:n.alternatives}:{type:"literal",value:n.primary};return o.push(l),{id:`${t.action}-event-${e.code}-sov-patient-first-dest`,language:e.code,command:"on",priority:(i.basePriority??100)+40,template:{format:`{patient} ${s?.primary||""} {destination} ${a?.primary||""} {event} ${r.primary} ${n.primary}`,tokens:o},extraction:{action:{value:t.action},event:{fromRole:"event"},patient:{fromRole:"patient"},destination:{fromRole:"destination"}}}}function xo(t,e,n,r,i){let o=[];o.push({type:"role",role:"event",optional:false});let s=r.alternatives?.filter(c=>!c.includes(" ")&&c.length>1)||[];s.length>0&&o.push({type:"literal",value:s[0],alternatives:s.slice(1)});let a=e.roleMarkers.destination;a&&o.push({type:"group",optional:true,tokens:[{type:"role",role:"destination",optional:true},a.alternatives?{type:"literal",value:a.primary,alternatives:a.alternatives}:{type:"literal",value:a.primary}]}),o.push({type:"role",role:"patient",optional:false});let l=e.roleMarkers.patient;if(l){let c=l.alternatives?{type:"literal",value:l.primary,alternatives:l.alternatives}:{type:"literal",value:l.primary};o.push(c);}let u=n.alternatives?{type:"literal",value:n.primary,alternatives:n.alternatives}:{type:"literal",value:n.primary};return o.push(u),{id:`${t.action}-event-${e.code}-sov-compact`,language:e.code,command:"on",priority:(i.basePriority??100)+52,template:{format:`{event}${s[0]||""} {patient} ${n.primary}`,tokens:o},extraction:{action:{value:t.action},event:{fromRole:"event"},patient:{fromRole:"patient"},destination:{fromRole:"destination",default:{type:"reference",value:"me"}}}}}function Co(t,e,n,r,i){let o=[];if(o.push({type:"role",role:"event",optional:false}),r.position==="after"){let a=r.primary.split(/\s+/);if(a.length>1)for(let l of a)o.push({type:"literal",value:l});else {let l=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};o.push(l);}}let s=n.alternatives?{type:"literal",value:n.primary,alternatives:n.alternatives}:{type:"literal",value:n.primary};return o.push(s),{id:`${t.action}-event-${e.code}-sov-simple`,language:e.code,command:"on",priority:(i.basePriority??100)+48,template:{format:`{event} ${r.primary} ${n.primary}`,tokens:o},extraction:{action:{value:t.action},event:{fromRole:"event"},patient:{default:{type:"reference",value:"me"}}}}}function Ao(t,e,n,r){let i=e.eventHandler?.temporalMarkers;if(!i||i.length===0)return null;let o=[];o.push({type:"role",role:"event",optional:false}),e.possessive?.marker&&o.push({type:"group",optional:true,tokens:[{type:"literal",value:e.possessive.marker}]}),o.push({type:"literal",value:i[0],alternatives:i.slice(1)}),o.push({type:"role",role:"patient",optional:false});let s=e.roleMarkers.patient;if(s?.primary){let l=s.alternatives?{type:"literal",value:s.primary,alternatives:s.alternatives}:{type:"literal",value:s.primary};o.push(l);}let a=n.alternatives?{type:"literal",value:n.primary,alternatives:n.alternatives}:{type:"literal",value:n.primary};return o.push(a),{id:`${t.action}-event-${e.code}-sov-temporal`,language:e.code,command:"on",priority:(r.basePriority??100)+49,template:{format:`{event} ${i[0]} {patient} ${n.primary}`,tokens:o},extraction:{action:{value:t.action},event:{fromRole:"event"},patient:{fromRole:"patient"}}}}function No(t,e,n,r,i){let o=[];if(o.push({type:"role",role:"event",optional:false}),r.position==="after"){let c=r.primary.split(/\s+/);if(c.length>1)for(let d of c)o.push({type:"literal",value:d});else {let d=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};o.push(d);}}let a=[...t.roles.filter(c=>c.required)].sort((c,d)=>{let m=c.sovPosition??999,p=d.sovPosition??999;return m-p});for(let c of a){o.push({type:"role",role:c.role,optional:false});let d,m;if(c.markerOverride&&c.markerOverride[e.code]!==void 0)d=c.markerOverride[e.code];else {let p=e.roleMarkers[c.role];p&&(d=p.primary,m=p.alternatives);}if(d){let p=m?{type:"literal",value:d,alternatives:m}:{type:"literal",value:d};o.push(p);}}let l=n.alternatives?{type:"literal",value:n.primary,alternatives:n.alternatives}:{type:"literal",value:n.primary};o.push(l);let u=a.map(c=>`{${c.role}}`).join(" ");return {id:`${t.action}-event-${e.code}-sov-2role`,language:e.code,command:"on",priority:(i.basePriority??100)+55,template:{format:`{event} ${r.primary} ${u} ${n.primary}`,tokens:o},extraction:{action:{value:t.action},event:{fromRole:"event"},...Object.fromEntries(a.map(c=>[c.role,{fromRole:c.role}]))}}}function Ro(t,e,n,r,i){let o=[],a=[...t.roles.filter(f=>f.required)].sort((f,v)=>{let A=f.sovPosition??999,x=v.sovPosition??999;return A-x}),l=a[0];o.push({type:"role",role:l.role,optional:false});let u;if(l.markerOverride&&l.markerOverride[e.code]!==void 0)u=l.markerOverride[e.code];else {let f=e.roleMarkers[l.role];f&&(u=f.primary);}if(u&&o.push({type:"literal",value:u}),o.push({type:"role",role:"event",optional:false}),r.position==="after"){let f=r.primary.split(/\s+/);if(f.length>1)for(let v of f)o.push({type:"literal",value:v});else {let v=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};o.push(v);}}let c=n.alternatives?{type:"literal",value:n.primary,alternatives:n.alternatives}:{type:"literal",value:n.primary};o.push(c);let d=a[1];o.push({type:"role",role:d.role,optional:false});let m,p;if(d.markerOverride&&d.markerOverride[e.code]!==void 0)m=d.markerOverride[e.code];else {let f=e.roleMarkers[d.role];f&&(m=f.primary,p=f.alternatives);}if(m){let f=p?{type:"literal",value:m,alternatives:p}:{type:"literal",value:m};o.push(f);}return {id:`${t.action}-event-${e.code}-sov-2role-dest-first`,language:e.code,command:"on",priority:(i.basePriority??100)+48,template:{format:`{${l.role}} {event} ${r.primary} ${n.primary} {${d.role}}`,tokens:o},extraction:{action:{value:t.action},event:{fromRole:"event"},[l.role]:{fromRole:l.role},[d.role]:{fromRole:d.role}}}}function At(t,e,n,r,i){let o=[];if(r.position==="before"){let l=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};o.push(l);}o.push({type:"role",role:"event",optional:false});let s=n.alternatives?{type:"literal",value:n.primary,alternatives:n.alternatives}:{type:"literal",value:n.primary};o.push(s),o.push({type:"role",role:"patient",optional:false});let a=e.roleMarkers.destination;return a&&o.push({type:"group",optional:true,tokens:[a.alternatives?{type:"literal",value:a.primary,alternatives:a.alternatives}:{type:"literal",value:a.primary},{type:"role",role:"destination",optional:true}]}),{id:`${t.action}-event-${e.code}-vso`,language:e.code,command:"on",priority:(i.basePriority??100)+50,template:{format:`${r.primary} {event} ${n.primary} {patient} ${a?.primary||""} {destination?}`,tokens:o},extraction:{action:{value:t.action},event:{fromRole:"event"},patient:{fromRole:"patient"},destination:{fromRole:"destination",default:{type:"reference",value:"me"}}}}}function Po(t,e,n,r,i){let o=[],s=n.alternatives?{type:"literal",value:n.primary,alternatives:n.alternatives}:{type:"literal",value:n.primary};o.push(s),o.push({type:"role",role:"patient",optional:false});let a=e.roleMarkers.destination;if(a&&o.push({type:"group",optional:true,tokens:[a.alternatives?{type:"literal",value:a.primary,alternatives:a.alternatives}:{type:"literal",value:a.primary},{type:"role",role:"destination",optional:true}]}),r.position==="before"){let l=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};o.push(l);}return o.push({type:"role",role:"event",optional:false}),{id:`${t.action}-event-${e.code}-vso-verb-first`,language:e.code,command:"on",priority:(i.basePriority??100)+45,template:{format:`${n.primary} {patient} ${a?.primary||""} {destination?} ${r.primary} {event}`,tokens:o},extraction:{action:{value:t.action},event:{fromRole:"event"},patient:{fromRole:"patient"},destination:{fromRole:"destination",default:{type:"reference",value:"me"}}}}}function Io(t,e,n,r,i){let o=[],s=n.alternatives?{type:"literal",value:n.primary,alternatives:n.alternatives}:{type:"literal",value:n.primary};o.push(s);let l=[...t.roles.filter(c=>c.required)].sort((c,d)=>{let m=c.svoPosition??999,p=d.svoPosition??999;return m-p});for(let c of l){let d,m;if(c.markerOverride&&c.markerOverride[e.code]!==void 0)d=c.markerOverride[e.code];else {let p=e.roleMarkers[c.role];p&&(d=p.primary,m=p.alternatives);}if(d){let p=m?{type:"literal",value:d,alternatives:m}:{type:"literal",value:d};o.push(p);}o.push({type:"role",role:c.role,optional:false});}if(r.position==="before"){let c=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};o.push(c);}o.push({type:"role",role:"event",optional:false});let u=l.map(c=>`{${c.role}}`).join(" ");return {id:`${t.action}-event-${e.code}-vso-verb-first-2role`,language:e.code,command:"on",priority:(i.basePriority??100)+48,template:{format:`${n.primary} ${u} ${r.primary} {event}`,tokens:o},extraction:{action:{value:t.action},event:{fromRole:"event"},...Object.fromEntries(l.map(c=>[c.role,{fromRole:c.role}]))}}}function Nt(t,e,n,r,i){let o=[];if(r.position==="before"){let c=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};o.push(c);}o.push({type:"role",role:"event",optional:false});let s=n.alternatives?{type:"literal",value:n.primary,alternatives:n.alternatives}:{type:"literal",value:n.primary};o.push(s);let l=[...t.roles.filter(c=>c.required)].sort((c,d)=>{let m=c.svoPosition??999,p=d.svoPosition??999;return m-p});for(let c of l){let d,m;if(c.markerOverride&&c.markerOverride[e.code]!==void 0)d=c.markerOverride[e.code];else {let p=e.roleMarkers[c.role];p&&(d=p.primary,m=p.alternatives);}if(d){let p=m?{type:"literal",value:d,alternatives:m}:{type:"literal",value:d};o.push(p);}o.push({type:"role",role:c.role,optional:false});}let u=l.map(c=>`{${c.role}}`).join(" ");return {id:`${t.action}-event-${e.code}-vso-2role`,language:e.code,command:"on",priority:(i.basePriority??100)+55,template:{format:`${r.primary} {event} ${n.primary} ${u}`,tokens:o},extraction:{action:{value:t.action},event:{fromRole:"event"},...Object.fromEntries(l.map(c=>[c.role,{fromRole:c.role}]))}}}function _o(t,e,n,r,i){let o=[],s=e.eventHandler?.negationMarker;if(r.position==="before"){let u=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};o.push(u);}if(s){let u=s.alternatives?{type:"literal",value:s.primary,alternatives:s.alternatives}:{type:"literal",value:s.primary};o.push(u);}o.push({type:"role",role:"event",optional:false});let a=n.alternatives?{type:"literal",value:n.primary,alternatives:n.alternatives}:{type:"literal",value:n.primary};o.push(a),o.push({type:"role",role:"patient",optional:false});let l=e.roleMarkers.destination;return l&&o.push({type:"group",optional:true,tokens:[l.alternatives?{type:"literal",value:l.primary,alternatives:l.alternatives}:{type:"literal",value:l.primary},{type:"role",role:"destination",optional:true}]}),{id:`${t.action}-event-${e.code}-vso-negated`,language:e.code,command:"on",priority:(i.basePriority??100)+48,template:{format:`${r.primary} ${s?.primary||""} {event} ${n.primary} {patient} ${l?.primary||""} {destination?}`,tokens:o},extraction:{action:{value:t.action},event:{fromRole:"event"},patient:{fromRole:"patient"},destination:{fromRole:"destination",default:{type:"reference",value:"me"}}}}}function Mo(t,e,n,r){let i=[];i.push({type:"literal",value:"and",alternatives:["then"]}),i.push({type:"role",role:"event",optional:false});let o=n.alternatives?{type:"literal",value:n.primary,alternatives:n.alternatives}:{type:"literal",value:n.primary};i.push(o),i.push({type:"role",role:"patient",optional:false});let s=e.roleMarkers.destination;return s&&i.push({type:"group",optional:true,tokens:[s.alternatives?{type:"literal",value:s.primary,alternatives:s.alternatives}:{type:"literal",value:s.primary},{type:"role",role:"destination",optional:true}]}),{id:`${t.action}-event-${e.code}-vso-proclitic`,language:e.code,command:"on",priority:(r.basePriority??100)+45,template:{format:`[proclitic?] {event} ${n.primary} {patient} ${s?.primary||""} {destination?}`,tokens:i},extraction:{action:{value:t.action},event:{fromRole:"event"},patient:{fromRole:"patient"},destination:{fromRole:"destination",default:{type:"reference",value:"me"}}}}}var se={basePriority:100,generateSimpleVariants:true,generateAlternatives:true};function Ut(t,e,n=se){let r=`${t.action}-${e.code}-generated`,i=n.basePriority??100,o=e.keywords[t.action];if(!o)throw new Error(`No keyword translation for '${t.action}' in ${e.code}`);let s=Bo(t,e,o),a=Gt(t,e),l=$o(t,e,o);return {id:r,language:e.code,command:t.action,priority:i,template:{format:l,tokens:s},extraction:a}}function Oo(t,e,n=se){if(t.roles.filter(a=>!a.required).length===0)return null;let i=t.roles.filter(a=>a.required),o={...t,roles:i};return {...Ut(o,e,n),id:`${t.action}-${e.code}-simple`,priority:(n.basePriority??100)-5,extraction:Gt(t,e)}}function Lo(t,e,n=se){let r=[];if(r.push(Ut(t,e,n)),n.generateSimpleVariants){let i=Oo(t,e,n);i&&r.push(i);}return r}function Kt(t,e=se){let n=[],r=ko();for(let i of r){if(!t.keywords[i.action])continue;let o=Lo(i,t,e);if(n.push(...o),t.eventHandler?.eventMarker){let s=Do(i,t,e);n.push(...s);}}return n}function Do(t,e,n=se){if(!e.eventHandler||!e.eventHandler.eventMarker)return [];let r=[],i=e.eventHandler.eventMarker,o=e.keywords[t.action];if(!o)return [];let a=t.roles.filter(l=>l.required).length===2;if(e.wordOrder==="SOV")if(a)r.push(No(t,e,o,i,n)),r.push(Ro(t,e,o,i,n));else {r.push(zo(t,e,o,i,n)),r.push(To(t,e,o,i,n));let l=e.roleMarkers.destination;l&&l.primary!==i.primary&&r.push(So(t,e,o,i,n));let u=i.primary.split(/\s+/),c=i.alternatives?.some(m=>!m.includes(" ")&&m.length>1);u.length>1&&c&&r.push(xo(t,e,o,i,n)),r.push(Co(t,e,o,i,n));let d=Ao(t,e,o,n);d&&r.push(d);}else e.wordOrder==="VSO"?a?(r.push(Nt(t,e,o,i,n)),r.push(Io(t,e,o,i,n))):(r.push(At(t,e,o,i,n)),r.push(Po(t,e,o,i,n)),e.eventHandler?.negationMarker&&r.push(_o(t,e,o,i,n)),e.tokenization?.prefixes&&r.push(Mo(t,e,o,n))):a?r.push(Nt(t,e,o,i,n)):r.push(At(t,e,o,i,n));return r}function Bo(t,e,n){let r=[],i=n.alternatives?{type:"literal",value:n.primary,alternatives:n.alternatives}:{type:"literal",value:n.primary},o=Wo(t,e);switch(e.wordOrder){case "SVO":r.push(i),r.push(...o);break;case "SOV":r.push(...o),r.push(i);break;case "VSO":r.push(i),r.push(...o);break;default:r.push(i),r.push(...o);}return r}function Wo(t,e){let n=[],r=Vt(t.roles,e.wordOrder);for(let i of r){let o=Fo(i,e);i.required?n.push(...o):n.push({type:"group",optional:true,tokens:o});}return n}function Fo(t,e){let n=[],r=t.markerOverride?.[e.code],i=e.roleMarkers[t.role],o={type:"role",role:t.role,optional:!t.required,expectedTypes:t.expectedTypes};if(r!==void 0)(i?.position??"before")==="before"?(r&&n.push({type:"literal",value:r}),n.push(o)):(n.push(o),r&&n.push({type:"literal",value:r}));else if(i)if(i.position==="before"){if(i.primary){let s=i.alternatives?{type:"literal",value:i.primary,alternatives:i.alternatives}:{type:"literal",value:i.primary};n.push(s);}n.push(o);}else {n.push(o);let s=i.alternatives?{type:"literal",value:i.primary,alternatives:i.alternatives}:{type:"literal",value:i.primary};n.push(s);}else n.push(o);return n}function qo(t,e){let n={};for(let r of t.roles){let i=r.markerOverride?.[e.code],o=e.roleMarkers[r.role];i!==void 0?n[r.role]=i?{marker:i}:{}:o&&o.primary?n[r.role]=o.alternatives?{marker:o.primary,markerAlternatives:o.alternatives}:{marker:o.primary}:n[r.role]={};}return n}function Gt(t,e){let n=qo(t,e),r={};for(let i of t.roles){let o=n[i.role]||{};!i.required&&i.default?r[i.role]={...o,default:i.default}:r[i.role]=o;}return r}function $o(t,e,n){let r=[],o=Vt(t.roles,e.wordOrder).map(s=>{let a=bo(s,e),l="";return a&&a.primary?a.position==="before"?l=`${a.primary} {${s.role}}`:l=`{${s.role}} ${a.primary}`:l=`{${s.role}}`,s.required?l:`[${l}]`});switch(e.wordOrder){case "SVO":case "VSO":r.push(n.primary,...o);break;case "SOV":r.push(...o,n.primary);break;default:r.push(n.primary,...o);}return r.join(" ")}function he(t){let e=t.getAttribute("data-lang");if(e)return Re(e);let n=t.getAttribute("data-hyperscript-lang")??t.closest?.("[data-hyperscript-lang]")?.getAttribute("data-hyperscript-lang");if(n)return Re(n);let r=typeof document<"u"?document.documentElement?.lang:null;return r&&r!=="en"?Re(r):null}function Re(t){return t.split("-")[0].toLowerCase()}var Ht={add:[["patient",""],["destination","to"]],append:[["patient",""],["destination","to"]],async:[],beep:[["patient",""]],behavior:[["patient",""]],blur:[["patient",""]],break:[],call:[["patient",""]],clone:[["patient",""],["destination","into"]],compound:[],continue:[],copy:[["patient",""]],decrement:[["patient",""],["quantity","by"]],default:[["destination",""],["patient","to"]],else:[],exit:[],fetch:[["source",""],["responseType","as"],["method","via"],["destination","on"]],focus:[["patient",""]],for:[["patient",""],["source","in"]],get:[["source",""],["destination","on"]],go:[["destination",""]],halt:[["patient",""]],hide:[["patient",""],["style","with"]],if:[["condition",""]],increment:[["patient",""],["quantity","by"]],init:[],install:[["patient",""],["destination","on"]],js:[["patient",""]],log:[["patient",""]],make:[["patient",""]],measure:[["patient",""],["source","of"]],morph:[["destination",""],["patient","to"]],on:[["event",""],["source","from"]],pick:[["patient",""],["source","from"]],prepend:[["patient",""],["destination","to"]],put:[["patient",""],["destination","into"]],remove:[["patient",""],["source","from"]],render:[["patient",""],["style","with"]],repeat:[["quantity",""],["condition","until"]],return:[["patient",""]],send:[["event",""],["destination","to"]],set:[["destination",""],["patient","to"]],settle:[["patient",""]],show:[["patient",""],["style","with"]],swap:[["method",""],["destination","of"],["patient","with"]],take:[["patient",""],["source","from"]],tell:[["destination",""]],throw:[["patient",""]],toggle:[["patient",""],["destination","on"]],transition:[["patient",""],["goal","to"],["destination","on"],["duration","over"],["style","with"]],trigger:[["event",""],["destination","on"]],unless:[["condition",""]],wait:[["patient",""]],while:[["condition",""]]};function le(t){switch(t.kind){case "event-handler":return jo(t);case "compound":return Vo(t);default:return Uo(t)}}function jo(t){let e=["on"],n=t.roles.get("event");n&&e.push(ae(n));let r=t.roles.get("source");if(r&&e.push("from",ae(r)),t.body&&t.body.length>0){let i=t.body.map(le);e.push(i.join(" then "));}return e.join(" ")}function Vo(t){let e=t.chainType==="async"?"async":t.chainType;return t.statements.map(le).join(` ${e} `)}function Uo(t){let e=Ht[t.action];if(e){let r=[t.action];for(let[i,o]of e){let s=t.roles.get(i);s&&(i==="destination"&&s.type==="reference"&&s.value==="me"||(o&&r.push(o),r.push(ae(s))));}return r.join(" ")}let n=[t.action];for(let[,r]of t.roles)n.push(ae(r));return n.join(" ")}function ae(t){switch(t.type){case "literal":return typeof t.value=="string"&&t.dataType==="string"?`"${t.value}"`:String(t.value);case "selector":return t.value;case "reference":return t.value;case "property-path":return Ko(t);case "expression":return t.raw}}function Ko(t){let e=ae(t.object),n=t.property;if(t.object.type==="reference")switch(t.object.value){case "me":return `my ${n}`;case "it":return `its ${n}`;case "you":return `your ${n}`}return `${e}'s ${n}`}var Xt=.5,Go={confidenceThreshold:Xt,strategy:"semantic",fallbackToOriginal:true};function Ho(t,e){return typeof t=="number"?t:t[e]??t["*"]??Xt}var Pe=null;function Qo(){return Pe||(Pe=qt()),Pe}function Ie(t,e,n={}){let r={...Go,...n},i=Qt(t,e,r);if(i!==null)return i;let o=Zo(t);if(o){let s=Qt(o.commands,e,r);if(s!==null)return o.prefix+s}return t}function Qt(t,e,n){if(n.strategy==="semantic"||n.strategy==="auto"){let r=Ho(n.confidenceThreshold,e),i=Zt(t,e,r);if(i!==null)return i}if((n.strategy==="auto"||n.strategy==="i18n")&&n.i18nToEnglish){let r=Yo(t,e,n.i18nToEnglish);if(r!==null)return r}return null}var Xo=/^(on\s+(?:every\s+)?[\w-]+(?:\[.*?\])?(?:\.[\w-]+(?:\([^)]*\))?)*(?:\s+from\s+\S+)?(?:\s+queue\s+\w+)?\s+)/;function Zo(t){let e=t.match(Xo);if(!e)return null;let n=e[1],r=t.slice(n.length);return r?{prefix:n,commands:r}:null}function Zt(t,e,n){try{let r=es(t,e);if(r.length>1)return ts(r,e,n);let i=Qo();if(!i.supportsLanguage(e))return null;let o=i.analyze(t,e);if(!$t(o,n))return null;if(o.node)return le(o.node);let s=Ne(t,e);return le(s)}catch{return null}}function Yo(t,e,n){try{let r=n(t,e);return r!==t?r:null}catch{return null}}function Jo(t){let e=["then"],n=V(t);if(n?.keywords?.then){let r=n.keywords.then;if(r.primary&&r.primary!=="then"&&e.push(r.primary),r.alternatives)for(let i of r.alternatives)e.includes(i)||e.push(i);}return e}function es(t,e){let r=Jo(e).map(a=>a.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")),i=new RegExp(`\\s+(?:${r.join("|")})\\s+`,"i"),o=t.split(`
|
|
4
|
-
`).map(a=>a.trim()).filter(a=>a.length>0),s=[];for(let a of o){let
|
|
1
|
+
var HyperscriptI18n=(function(exports){'use strict';function P(r,e){return e?{type:"literal",value:r,dataType:e}:{type:"literal",value:r}}function ve(r,e){return e?{type:"selector",value:r,selectorKind:e}:{type:"selector",value:r}}function ce(r){return {type:"reference",value:r}}function ge(r,e){return {type:"property-path",object:r,property:e}}var It=class{constructor(r){this.namespace=r,this.enabled=this.checkEnabled();}checkEnabled(){if(typeof process<"u"&&process.env){let r=process.env.DEBUG||"";return r==="*"||r.includes("framework:*")||r.includes(`framework:${this.namespace}`)}return false}log(r,e,...t){if(!this.enabled)return;let n=`[framework:${this.namespace}]`,i=new Date().toISOString();switch(r){case "debug":console.debug(`${i} ${n} DEBUG:`,e,...t);break;case "info":console.info(`${i} ${n} INFO:`,e,...t);break;case "warn":console.warn(`${i} ${n} WARN:`,e,...t);break;case "error":console.error(`${i} ${n} ERROR:`,e,...t);break}}debug(r,...e){this.log("debug",r,...e);}info(r,...e){this.log("info",r,...e);}warn(r,...e){this.log("warn",r,...e);}error(r,...e){this.log("error",r,...e);}isEnabled(){return this.enabled}enable(){this.enabled=true;}disable(){this.enabled=false;}};function Lt(r){return new It(r)}function j(r,e){return !e||e.length===0||e.includes(r)||e.includes("expression")?true:r==="property-path"?e.some(t=>["selector","reference","expression"].includes(t)):false}function Mt(r,e){return r?.possessive?.keywords?.[e]}var J=class F{constructor(){this.logger=Lt("pattern-matcher"),this.stemMatchCount=0,this.totalKeywordMatches=0;}safeToLowerCase(e){return typeof e=="string"?e.toLowerCase():e==null?"":String(e).toLowerCase()}matchPattern(e,t,n){let i=e.mark(),o=new Map;if(this.logger.debug("========================================"),this.logger.debug("matchPattern ENTRY"),this.logger.debug("Pattern ID:",t.id),this.logger.debug("Pattern command:",t.command),this.logger.debug("Pattern language:",t.language),this.logger.debug("Pattern template:",JSON.stringify(t.template,null,2)),this.logger.isEnabled()){let c=[];for(let l=0;l<10;l++){let u=e.peek(l);if(u)c.push({type:u.type,value:u.value,kind:u.kind});else break}this.logger.debug("Input tokens (first 10):",c),this.logger.debug("Profile code:",n?.code);}this.currentProfile=n,this.stemMatchCount=0,this.totalKeywordMatches=0,this.logger.debug("--- Calling matchTokenSequence ---"),this.logger.debug("Pattern tokens to match:",JSON.stringify(t.template.tokens,null,2));let s=this.matchTokenSequence(e,t.template.tokens,o);if(this.logger.debug("matchTokenSequence returned:",s),this.logger.debug("Captured roles:",Array.from(o.entries()).map(([c,l])=>[c,JSON.stringify(l)])),!s)return this.logger.debug(">>> MATCH FAILED - resetting token position"),e.reset(i),null;let a=this.calculateConfidence(t,o);return this.applyExtractionRules(t,o),{pattern:t,captured:o,consumedTokens:e.position()-i.position,confidence:a}}matchBest(e,t,n){let i=[];for(let s of t){let a=e.mark(),c=this.matchPattern(e,s,n);c&&i.push(c),e.reset(a);}if(i.length===0)return null;i.sort((s,a)=>{let c=a.pattern.priority-s.pattern.priority;if(c!==0)return c;let l=a.confidence-s.confidence;return Math.abs(l)>.001?l:a.consumedTokens-s.consumedTokens});let o=i[0];return this.matchPattern(e,o.pattern),o}matchTokenSequence(e,t,n,i){let o=t[0],s=o?.type==="literal"&&(o.value==="and"||o.value==="then"||o.alternatives?.includes("and")||o.alternatives?.includes("then"));if(this.currentProfile?.code==="ar"&&!s)for(;e.peek()?.kind==="conjunction";)e.advance();let a=null,c=null;for(let l=0;l<t.length;l++){let u=t[l];this.logger.debug(" >> Matching pattern token:",JSON.stringify(u,null,2));let d=e.peek();if(this.logger.debug(" >> Current input token:",d?JSON.stringify({type:d.type,value:d.value,kind:d.kind}):"EOF"),u.type==="role"&&u.greedy){let y=this.collectStopMarkers(t,l+1);if(i)for(let E of i)y.add(E);let g=[];for(;!e.isAtEnd();){let E=e.peek();if(!E||this.isStopMarker(E,y))break;g.push(E.value),e.advance();}if(g.length>0){n.set(u.role,{type:"expression",raw:g.join(" ")}),a=null,c=null;continue}else {if(u.optional)continue;return false}}if(u.type==="group"){let y=this.collectStopMarkers(t,l+1);if(i)for(let E of i)y.add(E);if(this.matchGroupToken(e,u,n,y)){a=null,c=null;continue}if(this.isOptional(u))continue;return false}let p=u.type==="role"&&u.optional===true,m=p?e.mark():null;if(u.type==="role"&&!p){let y=l+1<t.length?t[l+1]:null;if(y?.type==="literal"){let g=e.peek();if(g&&this.getMatchType(g,y.value)!=="none"){if(this.logger.debug(" >> MARKER-STEAL GUARD: current token matches next literal, skipping role"),this.logger.debug(" >> Token match FAILED"),this.isOptional(u))continue;if(a&&c){this.logger.debug(" >> BACKTRACKING: undoing optional role",c),e.reset(a),n.delete(c),a=null,c=null;let E=this.matchPatternToken(e,u,n);if(this.logger.debug(" >> Backtrack retry result:",E),E)continue}return false}}}let v=this.matchPatternToken(e,u,n);if(this.logger.debug(" >> Match result:",v),v){p?(a=m,c=u.role):(a=null,c=null);continue}if(this.logger.debug(" >> Token match FAILED"),!this.isOptional(u)){if(a&&c){this.logger.debug(" >> BACKTRACKING: undoing optional role",c),e.reset(a),n.delete(c),a=null,c=null;let y=this.matchPatternToken(e,u,n);if(this.logger.debug(" >> Backtrack retry result:",y),y)continue}return false}}return true}matchPatternToken(e,t,n){switch(t.type){case "literal":return this.matchLiteralToken(e,t);case "role":return this.matchRoleToken(e,t,n);case "group":return this.matchGroupToken(e,t,n);default:return false}}matchLiteralToken(e,t){let n=e.peek();if(this.logger.debug(" >>> matchLiteralToken: expecting",t.value),this.logger.debug(" >>> matchLiteralToken: got token",n?JSON.stringify({type:n.type,value:n.value,kind:n.kind}):"null"),!n)return this.logger.debug(" >>> matchLiteralToken: FAIL - no token"),false;let i=this.getMatchType(n,t.value);if(this.logger.debug(" >>> matchType for",n.value,"vs",t.value,":",i),i!=="none")return this.totalKeywordMatches++,i==="stem"&&this.stemMatchCount++,e.advance(),true;if(t.alternatives)for(let o of t.alternatives){let s=this.getMatchType(n,o);if(s!=="none")return this.totalKeywordMatches++,s==="stem"&&this.stemMatchCount++,e.advance(),true}return false}matchRoleToken(e,t,n){this.logger.debug(" >>> matchRoleToken ENTRY: capturing role",t.role),this.logger.debug(" >>> matchRoleToken: expected types",t.expectedTypes),this.logger.debug(" >>> matchRoleToken: optional?",t.optional),this.skipNoiseWords(e);let i=e.peek();if(this.logger.debug(" >>> After skipNoiseWords, current token:",i?JSON.stringify({value:i.value,kind:i.kind}):"null"),!i)return t.optional||false;let o=this.tryMatchPossessiveExpression(e);if(o)return t.expectedTypes&&t.expectedTypes.length>0&&!j(o.type,t.expectedTypes)?t.optional||false:(n.set(t.role,o),true);let s=this.tryMatchMethodCallExpression(e);if(s)return t.expectedTypes&&t.expectedTypes.length>0&&!j(s.type,t.expectedTypes)?t.optional||false:(n.set(t.role,s),true);let a=this.tryMatchPossessiveSelectorExpression(e);if(a)return t.expectedTypes&&t.expectedTypes.length>0&&!j(a.type,t.expectedTypes)?t.optional||false:(n.set(t.role,a),true);let c=this.tryMatchPropertyAccessExpression(e);if(c)return t.expectedTypes&&t.expectedTypes.length>0&&!j(c.type,t.expectedTypes)?t.optional||false:(n.set(t.role,c),true);let l=this.tryMatchSelectorPropertyExpression(e);if(l)return t.expectedTypes&&t.expectedTypes.length>0&&!j(l.type,t.expectedTypes)?t.optional||false:(n.set(t.role,l),true);this.logger.debug(" >>> Trying tokenToSemanticValue for token:",i?JSON.stringify({value:i.value,kind:i.kind}):"null");let u=this.tokenToSemanticValue(i);return this.logger.debug(" >>> tokenToSemanticValue returned:",u?JSON.stringify(u):"null"),u?(this.logger.debug(" >>> Validating type:",u.type,"against expected:",t.expectedTypes),t.expectedTypes&&t.expectedTypes.length>0&&!j(u.type,t.expectedTypes)?(this.logger.debug(" >>> TYPE MISMATCH - returning",t.optional||false),t.optional||false):(this.logger.debug(" >>> Type validation PASSED"),n.set(t.role,u),e.advance(),true)):t.optional||false}tryMatchPossessiveExpression(e){let t=e.peek();if(!t||!this.currentProfile)return null;let n=t.normalized||t.value,i=this.safeToLowerCase(n),o=Mt(this.currentProfile,i);if(!o)return null;let s=e.mark();e.advance();let a=e.peek();if(!a)return e.reset(s),null;if(a.kind==="identifier"||a.kind==="keyword"&&!this.isStructuralKeyword(a.value)||a.kind==="selector"&&a.value.startsWith("*")||a.kind==="selector"&&a.value.startsWith("@")||a.kind==="selector"&&a.value.startsWith(".")&&/^\.[a-zA-Z_]\w*/.test(a.value)){e.advance();let c=a.value;a.kind==="selector"&&c.startsWith(".")&&/^\.[a-zA-Z_]\w*/.test(c)&&(c=c.substring(1));let l=c;for(;e.peek()?.kind==="selector"&&e.peek().value.startsWith(".")&&/^\.[a-zA-Z_]\w*/.test(e.peek().value);)l+=e.peek().value,e.advance();let u=e.peek();return u?.kind==="literal"&&u.value.startsWith("(")&&(l+=u.value,e.advance()),ge(ce(o),l)}return e.reset(s),null}isStructuralKeyword(e){return new Set(["into","in","to","from","at","by","with","without","before","after","of","as","on","then","end","else","if","repeat","while","for","toggle","add","remove","put","set","show","hide","increment","decrement","send","trigger","call"]).has(e.toLowerCase())}tryMatchMethodCallExpression(e){let t=e.peek();if(!t||t.kind!=="selector")return null;let n=e.mark();e.advance();let i=e.peek();if(!i||i.kind!=="operator"||i.value!==".")return e.reset(n),null;e.advance();let o=e.peek();if(!o||o.kind!=="identifier")return e.reset(n),null;e.advance();let s=e.peek();if(!s||s.kind!=="punctuation"||s.value!=="(")return e.reset(n),null;e.advance();let a=[];for(;!e.isAtEnd()&&a.length<F.MAX_METHOD_ARGS;){let l=e.peek();if(!l)break;if(l.kind==="punctuation"&&l.value===")"){e.advance();break}if(l.kind==="punctuation"&&l.value===","){e.advance();continue}a.push(l.value),e.advance();}return {type:"expression",raw:`${t.value}.${o.value}(${a.join(", ")})`}}tryMatchPropertyAccessExpression(e){let t=e.peek();if(!t||t.kind!=="identifier"&&t.kind!=="keyword")return null;let n=e.mark();e.advance();let i=e.peek();if(!i||i.kind!=="operator"||i.value!==".")return e.reset(n),null;e.advance();let o=e.peek();if(!o||o.kind!=="identifier")return e.reset(n),null;e.advance();let s=`${t.value}.${o.value}`,a=1;for(;!e.isAtEnd()&&a<F.MAX_PROPERTY_DEPTH;){let l=e.peek();if(!l||l.kind!=="operator"||l.value!==".")break;e.advance();let u=e.peek();if(!u||u.kind!=="identifier")break;e.advance(),s+=`.${u.value}`,a++;}let c=e.peek();if(c&&c.kind==="punctuation"&&c.value==="("){e.advance();let l=[],u=0;for(;!e.isAtEnd()&&l.length<F.MAX_METHOD_ARGS;){let p=e.peek();if(!p)break;if(p.kind==="punctuation"&&p.value===")"){if(u===0){e.advance();break}u--;}if(p.kind==="punctuation"&&p.value==="("&&u++,p.kind==="punctuation"&&p.value===","){e.advance();continue}l.push(p.value),e.advance();}return {type:"expression",raw:`${s}(${l.join(", ")})`}}return {type:"expression",raw:s}}tryMatchPossessiveSelectorExpression(e){let t=e.peek();if(!t||t.kind!=="selector")return null;let n=e.mark();e.advance();let i=e.peek();if(!i||i.kind!=="punctuation"||i.value!=="'s")return e.reset(n),null;e.advance();let o=e.peek();return !o||o.kind!=="selector"&&o.kind!=="identifier"?(e.reset(n),null):(e.advance(),ge(ve(t.value),o.value))}tryMatchSelectorPropertyExpression(e){let t=e.peek();if(!t||t.kind!=="selector"||typeof t.value!="string"||!t.value.startsWith("#"))return null;let n=e.mark();e.advance();let i=e.peek();if(!i||i.kind!=="selector"||!i.value.startsWith("."))return e.reset(n),null;let o=e.peek(1);o&&o.kind,e.advance();let s=i.value.slice(1);return ge(ve(t.value),s)}matchGroupToken(e,t,n,i){let o=e.mark(),s=new Set(n.keys());if(this.matchTokenSequence(e,t.tokens,n,i))return true;e.reset(o);for(let l of n.keys())s.has(l)||n.delete(l);if(!t.optional)return false;let c=this.getGroupLeadingMarker(t);if(c)for(let l=1;l<=F.MAX_MARKER_SCAN;l++){let u=e.peek(l);if(!u)break;if((u.normalized||u.value).toLowerCase()===c){this.logger.debug(" >> MARKER SCAN: found",c,"at offset",l,"- skipping intervening tokens");for(let m=0;m<l;m++)e.advance();if(this.matchTokenSequence(e,t.tokens,n,i))return true;e.reset(o);for(let m of n.keys())s.has(m)||n.delete(m);break}}return true}getGroupLeadingMarker(e){let t=e.tokens[0];return t?.type==="literal"?t.value.toLowerCase():null}getMatchType(e,t){return e.value===t?"exact":e.normalized===t?"normalized":e.stem===t&&e.stemConfidence!==void 0&&e.stemConfidence>=.7?"stem":e.kind==="keyword"&&this.safeToLowerCase(e.value)===t.toLowerCase()?"case-insensitive":"none"}collectStopMarkers(e,t){let n=new Set;for(let i=t;i<e.length;i++){let o=e[i];if(o.type==="literal"){if(n.add(o.value.toLowerCase()),o.alternatives)for(let s of o.alternatives)n.add(s.toLowerCase());break}if(o.type==="group"){for(let s of o.tokens)if(s.type==="literal"){if(n.add(s.value.toLowerCase()),s.alternatives)for(let a of s.alternatives)n.add(a.toLowerCase());break}if(!o.optional)break}}return n}isStopMarker(e,t){return t.size===0?false:!!(t.has(e.value.toLowerCase())||e.normalized&&t.has(e.normalized.toLowerCase()))}tokenToSemanticValue(e){switch(e.kind){case "selector":return ve(e.value);case "literal":return this.parseLiteralValue(e.value);case "keyword":let t=e.normalized||e.value;this.safeToLowerCase(t);return P(e.normalized||e.value);case "identifier":if(typeof e.value=="string"&&e.value.startsWith(":"))return ce(e.value);this.safeToLowerCase(e.value);return {type:"expression",raw:e.value};case "url":return P(e.value,"string");default:return null}}parseLiteralValue(e){if(e.startsWith('"')||e.startsWith("'")||e.startsWith("`")||e.startsWith("\u300C")){let i=e.slice(1,-1);return P(i,"string")}if(e==="true")return P(true,"boolean");if(e==="false")return P(false,"boolean");let t=e.match(/^(\d+(?:\.\d+)?)(ms|s|m|h)?$/);if(t){let i=parseFloat(t[1]);return t[2]?P(e,"duration"):P(i,"number")}let n=parseFloat(e);return isNaN(n)?P(e,"string"):P(n,"number")}applyExtractionRules(e,t){for(let[n,i]of Object.entries(e.extraction))t.has(n)||(i.value!==void 0?t.set(n,{type:"literal",value:i.value}):i.default&&t.set(n,i.default));}isOptional(e){return e.type!=="literal"&&e.optional===true}calculateConfidence(e,t){let n=0,i=0,o=l=>e.extraction?.[l]?.default!==void 0;for(let l of e.template.tokens)if(l.type==="role")i+=1,t.has(l.role)&&(n+=1);else if(l.type==="group"){for(let u of l.tokens)if(u.type==="role"){let d=o(u.role),p=.8;i+=p,t.has(u.role)?n+=p:d&&(n+=p*.6);}}let s=i>0?n/i:1;if(this.stemMatchCount>0&&this.totalKeywordMatches>0){let l=this.stemMatchCount/this.totalKeywordMatches*.15;s=Math.max(.5,s-l);}let a=this.calculateVSOConfidenceBoost(e);s=Math.min(1,s+a);let c=this.arabicPrepositionDisambiguation(e,t);return s=Math.max(0,Math.min(1,s+c)),s}calculateVSOConfidenceBoost(e){if(e.language!=="ar")return 0;let t=e.template.tokens[0];if(!t||t.type!=="literal")return 0;let n=new Set(["\u0628\u062F\u0644","\u063A\u064A\u0631","\u0623\u0636\u0641","\u0623\u0632\u0644","\u0636\u0639","\u0627\u062C\u0639\u0644","\u0639\u064A\u0646","\u0632\u062F","\u0627\u0646\u0642\u0635","\u0633\u062C\u0644","\u0623\u0638\u0647\u0631","\u0623\u062E\u0641","\u0634\u063A\u0644","\u0623\u0631\u0633\u0644","\u0631\u0643\u0632","\u0634\u0648\u0634","\u062A\u0648\u0642\u0641","\u0627\u0646\u0633\u062E","\u0627\u062D\u0630\u0641","\u0627\u0635\u0646\u0639","\u0627\u0646\u062A\u0638\u0631","\u0627\u0646\u062A\u0642\u0627\u0644","\u0623\u0648"]);if(n.has(t.value))return .15;if(t.alternatives){for(let i of t.alternatives)if(n.has(i))return .15}return 0}arabicPrepositionDisambiguation(e,t){if(e.language!=="ar")return 0;let n=0,i={patient:["\u0639\u0644\u0649"],destination:["\u0625\u0644\u0649","\u0627\u0644\u0649"],source:["\u0645\u0646"],agent:["\u0645\u0646"],manner:["\u0628"],style:["\u0628"],goal:["\u0625\u0644\u0649","\u0627\u0644\u0649"],method:["\u0628"]};for(let[o,s]of t.entries()){let a=i[o];if(!a||a.length===0)continue;let c="metadata"in s?s.metadata:void 0;if(c&&typeof c.prepositionValue=="string"){let l=c.prepositionValue;a.includes(l)?n+=.1:n-=.1;}}return Math.max(-0.1,Math.min(.1,n))}skipNoiseWords(e){let t=e.peek();if(!t)return;let n=this.safeToLowerCase(t.value);if(F.ENGLISH_NOISE_WORDS.has(n)){let i=e.mark();e.advance();let o=e.peek();if(o&&o.kind==="selector")return;e.reset(i);}n==="class"&&e.advance();}extractEventModifiers(e){let t={},n=false;for(;!e.isAtEnd();){let i=e.peek();if(!i||i.kind!=="event-modifier")break;let o=i.metadata;if(!o)break;switch(n=true,o.modifierName){case "once":t.once=true;break;case "debounce":typeof o.value=="number"&&(t.debounce=o.value);break;case "throttle":typeof o.value=="number"&&(t.throttle=o.value);break;case "queue":(o.value==="first"||o.value==="last"||o.value==="all"||o.value==="none")&&(t.queue=o.value);break}e.advance();}return n?t:void 0}};J.MAX_MARKER_SCAN=3;J.MAX_PROPERTY_DEPTH=10;J.MAX_METHOD_ARGS=20;J.ENGLISH_NOISE_WORDS=new Set(["the","a","an"]);var Dt=J;new Dt;var L=class{constructor(){this.name="string-literal";}canExtract(r,e){let t=r[e];return t==='"'||t==="'"||t==="`"||t==="\u201C"||t==="\u2018"}extract(r,e){let t=r[e];if(t==="\u201C"){let o=1;for(;e+o<r.length;){if(r[e+o]==="\u201D")return o++,{value:r.substring(e,e+o),length:o};o++;}return null}if(t==="\u2018"){let o=1;for(;e+o<r.length;){if(r[e+o]==="\u2019")return o++,{value:r.substring(e,e+o),length:o};o++;}return null}let n=1,i=false;for(;e+n<r.length;){let o=r[e+n];if(i){i=false,n++;continue}if(o==="\\"){i=true,n++;continue}if(o===t)return n++,{value:r.substring(e,e+n),length:n};n++;}return null}},M=class{constructor(){this.name="number";}canExtract(r,e){return /\d/.test(r[e])}extract(r,e){let t=0,n=false;for(;e+t<r.length;){let s=r[e+t];if(/\d/.test(s))t++;else if(s==="."&&!n)n=true,t++;else break}if(t===0)return null;let i=r.substring(e,e+t),o=e+t;if(o<r.length){let s=r.slice(o),a=[{pattern:"\u6BEB\u79D2",suffix:"ms"},{pattern:"\u5206\u949F",suffix:"m"},{pattern:"\u5C0F\u65F6",suffix:"h"},{pattern:"\u30DF\u30EA\u79D2",suffix:"ms"},{pattern:"\u6642\u9593",suffix:"h"}];for(let l of a)if(s.startsWith(l.pattern))return {value:i+l.suffix,length:t+l.pattern.length,metadata:{hasTimeUnit:true}};if(s.startsWith("ms"))return {value:i+"ms",length:t+2,metadata:{hasTimeUnit:true}};let c=[{pattern:"\u79D2",suffix:"s"},{pattern:"\u5206",suffix:"m"}];for(let l of c)if(s.startsWith(l.pattern))return {value:i+l.suffix,length:t+1,metadata:{hasTimeUnit:true}};if(/^[smh](?![a-zA-Z])/.test(s))return {value:i+s[0],length:t+1,metadata:{hasTimeUnit:true}}}return {value:i,length:t}}};function $t(r){return "setContext"in r&&typeof r.setContext=="function"}function Vt(r){let e={language:r.language,direction:r.direction,lookupKeyword:r.lookupKeyword.bind(r),isKeyword:r.isKeyword.bind(r),isKeywordStart:r.isKeywordStart.bind(r)};return r.normalizer?{...e,normalizer:r.normalizer}:e}var Wt=new Set(["me","you","it","result","event","target","body"]);function Le(r,e=Wt){return e.has(r)}var ee=class{constructor(r,e){this.pos=0,this.tokens=r,this.language=e;}peek(r=0){let e=this.pos+r;return e<0||e>=this.tokens.length?null:this.tokens[e]}advance(){if(this.isAtEnd())throw new Error("Unexpected end of token stream");return this.tokens[this.pos++]}isAtEnd(){return this.pos>=this.tokens.length}mark(){return {position:this.pos}}reset(r){this.pos=r.position;}position(){return this.pos}remaining(){return this.tokens.slice(this.pos)}takeWhile(r){let e=[];for(;!this.isAtEnd()&&r(this.peek());)e.push(this.advance());return e}skipWhile(r){for(;!this.isAtEnd()&&r(this.peek());)this.advance();}};function w(r,e){return {start:r,end:e}}function x(r,e,t,n){if(typeof r=="object"){let{value:o,kind:s,position:a,normalized:c,stem:l,stemConfidence:u,metadata:d}=r;return {value:o,kind:s,position:a,...c!==void 0&&{normalized:c},...l!==void 0&&{stem:l},...u!==void 0&&{stemConfidence:u},...d!==void 0&&{metadata:d}}}let i=r;if(!e||!t)throw new Error("createToken requires kind and position parameters");if(typeof n=="string")return {value:i,kind:e,position:t,normalized:n};if(n){let{normalized:o,stem:s,stemConfidence:a,metadata:c}=n;return {value:i,kind:e,position:t,...o!==void 0&&{normalized:o},...s!==void 0&&{stem:s},...a!==void 0&&{stemConfidence:a},...c!==void 0&&{metadata:c}}}return {value:i,kind:e,position:t}}function V(r){return /\s/.test(r)}function qt(r){return r==="#"||r==="."||r==="["||r==="@"||r==="*"||r==="<"}function jt(r){return r==='"'||r==="'"||r==="`"||r==="\u300C"||r==="\u300D"}function $(r){return /\d/.test(r)}function Ft(r){return /[a-zA-Z]/.test(r)}function C(r){return /[a-zA-Z0-9_-]/.test(r)}function Gt(r,e){if(e>=r.length)return null;let t=r[e];if(!qt(t))return null;let n=e,i="";if(t==="#"||t==="."){for(i+=r[n++];n<r.length&&C(r[n]);)i+=r[n++];if(i.length<=1)return null;if(n<r.length&&r[n]==="."&&t==="#"){let s=n+1;for(;s<r.length&&C(r[s]);)s++;if(s<r.length&&r[s]==="(")return i}}else if(t==="["){let o=1,s=false,a=null,c=false;for(i+=r[n++];n<r.length&&o>0;){let l=r[n];i+=l,c?c=false:l==="\\"?c=true:s?l===a&&(s=false,a=null):l==='"'||l==="'"||l==="`"?(s=true,a=l):l==="["?o++:l==="]"&&o--,n++;}if(o!==0)return null}else if(t==="@"){for(i+=r[n++];n<r.length&&C(r[n]);)i+=r[n++];if(i.length<=1)return null}else if(t==="*"){for(i+=r[n++];n<r.length&&C(r[n]);)i+=r[n++];if(i.length<=1)return null}else if(t==="<"){if(i+=r[n++],n>=r.length||!Ft(r[n]))return null;for(;n<r.length&&C(r[n]);)i+=r[n++];for(;n<r.length;){let o=r[n];if(o==="."){if(i+=r[n++],n>=r.length||!C(r[n]))return null;for(;n<r.length&&C(r[n]);)i+=r[n++];}else if(o==="#"){if(i+=r[n++],n>=r.length||!C(r[n]))return null;for(;n<r.length&&C(r[n]);)i+=r[n++];}else if(o==="["){let s=1,a=false,c=null,l=false;for(i+=r[n++];n<r.length&&s>0;){let u=r[n];i+=u,l?l=false:u==="\\"?l=true:a?u===c&&(a=false,c=null):u==='"'||u==="'"||u==="`"?(a=true,c=u):u==="["?s++:u==="]"&&s--,n++;}if(s!==0)return null}else break}for(;n<r.length&&V(r[n]);)i+=r[n++];if(n<r.length&&r[n]==="/")for(i+=r[n++];n<r.length&&V(r[n]);)i+=r[n++];if(n>=r.length||r[n]!==">")return null;i+=r[n++];}return i||null}function Ut(r,e){if(e>=r.length||r[e]!=="'"||e+1>=r.length||r[e+1].toLowerCase()!=="s")return false;if(e+2>=r.length)return true;let n=r[e+2];return V(n)||n==="*"||!C(n)}function Kt(r,e){if(e>=r.length)return null;let t=r[e];if(!jt(t)||t==="'"&&Ut(r,e))return null;let i={'"':'"',"'":"'","`":"`","\u300C":"\u300D"}[t];if(!i)return null;let o=e+1,s=t,a=false;for(;o<r.length;){let c=r[o];if(s+=c,a)a=false;else if(c==="\\")a=true;else if(c===i)return s;o++;}return s}function Ht(r,e){if(e>=r.length)return false;let t=r[e],n=r[e+1]||"",i=r[e+2]||"";if(t==="/"&&n!=="/"&&/[a-zA-Z0-9._-]/.test(n)||t==="/"&&n==="/"&&/[a-zA-Z]/.test(i)||t==="."&&(n==="/"||n==="."&&i==="/"))return true;let o=r.slice(e,e+8).toLowerCase();return !!(o.startsWith("http://")||o.startsWith("https://"))}function Yt(r,e){if(!Ht(r,e))return null;let t=e,n="",i=/[a-zA-Z0-9/:._\-?&=%@+~!$'()*,;[\]]/;for(;t<r.length;){let o=r[t];if(o==="#"){if(n.length>0&&/[a-zA-Z0-9/.]$/.test(n))for(n+=o,t++;t<r.length&&/[a-zA-Z0-9_-]/.test(r[t]);)n+=r[t++];break}if(i.test(o))n+=o,t++;else break}return n.length<2?null:n}function Xt(r,e){if(e>=r.length)return null;let t=r[e];if(!$(t)&&t!=="-"&&t!=="+")return null;let n=e,i="";if((r[n]==="-"||r[n]==="+")&&(i+=r[n++]),n>=r.length||!$(r[n]))return null;for(;n<r.length&&$(r[n]);)i+=r[n++];if(n<r.length&&r[n]===".")for(i+=r[n++];n<r.length&&$(r[n]);)i+=r[n++];return n<r.length&&(r.slice(n,n+2)==="ms"?i+="ms":(r[n]==="s"||r[n]==="m"||r[n]==="h")&&(i+=r[n])),i}var Zt=["===","!==","->","==","!=","<=",">=","&&","||","**","+=","-=","*=","/=","+","-","*","/","=",">","<","!","&","|","%","^","~"];new Set(Zt);var De=class $e{constructor(){this.profileKeywords=[],this.profileKeywordMap=new Map,this.extractors=[];}tokenize(e){if(this.isUsingExtractors())return this.tokenizeWithExtractors(e);throw new Error(`${this.constructor.name}: tokenize() not implemented and no extractors registered. Either register extractors or override tokenize() method.`)}registerExtractor(e){$t(e)&&e.setContext(Vt(this)),this.extractors.push(e);}registerExtractors(e){for(let t of e)this.registerExtractor(t);}clearExtractors(){this.extractors=[];}isUsingExtractors(){return this.extractors.length>0}tokenizeWithExtractors(e){let t=[],n=0;for(;n<e.length;){for(;n<e.length&&V(e[n]);)n++;if(n>=e.length)break;let i=false;for(let o of this.extractors)if(o.canExtract(e,n)){let s=o.extract(e,n);if(s){let a=s.metadata?.normalized,c=s.metadata?.stem,l=s.metadata?.stemConfidence,u={};if(s.metadata)for(let[p,m]of Object.entries(s.metadata))p!=="normalized"&&p!=="stem"&&p!=="stemConfidence"&&(u[p]=m);let d={};a&&(d.normalized=a),c&&(d.stem=c),l!==void 0&&(d.stemConfidence=l),Object.keys(u).length>0&&(d.metadata=u),t.push(x(s.value,this.classifyToken(s.value),w(n,n+s.length),Object.keys(d).length>0?d:void 0)),n+=s.length,i=true;break}}if(!i){let o=e[n],s=this.classifyUnknownChar(o);t.push(x(o,s,w(n,n+1))),n++;}}return new ee(t,this.language)}classifyUnknownChar(e){return "()[]{},:;".includes(e)?"punctuation":"+-*/<>=!&|".includes(e)?"operator":"identifier"}tryPropertyAccess(e,t,n){if(e[t]!==".")return false;let i=n[n.length-1],o=i&&i.position.end<t;if(i&&!o&&(i.kind==="identifier"||i.kind==="keyword"||i.kind==="selector"))return n.push(x(".","operator",w(t,t+1))),true;let c=t+1;for(;c<e.length&&C(e[c]);)c++;return c<e.length&&e[c]==="("?(n.push(x(".","operator",w(t,t+1))),true):false}initializeKeywordsFromProfile(e,t=[]){let n=new Map;if(e.keywords){for(let[i,o]of Object.entries(e.keywords))if(n.set(o.primary,{native:o.primary,normalized:o.normalized||i}),o.alternatives)for(let s of o.alternatives)n.set(s,{native:s,normalized:o.normalized||i});}if(e.references){for(let[i,o]of Object.entries(e.references))n.set(o,{native:o,normalized:i});for(let i of Object.keys(e.references))n.has(i)||n.set(i,{native:i,normalized:i});}if(e.roleMarkers){for(let[i,o]of Object.entries(e.roleMarkers))if(o.primary&&n.set(o.primary,{native:o.primary,normalized:i}),o.alternatives)for(let s of o.alternatives)n.set(s,{native:s,normalized:i});}if(e.possessive?.keywords)for(let[i,o]of Object.entries(e.possessive.keywords))n.set(i,{native:i,normalized:o});for(let i of t)n.set(i.native,i);this.profileKeywords=Array.from(n.values()).sort((i,o)=>o.native.length-i.native.length),this.profileKeywordMap=new Map;for(let i of this.profileKeywords){this.profileKeywordMap.set(i.native.toLowerCase(),i);let o=this.removeDiacritics(i.native);o!==i.native&&!this.profileKeywordMap.has(o.toLowerCase())&&this.profileKeywordMap.set(o.toLowerCase(),i);}}removeDiacritics(e){return e.replace(/[\u064B-\u0652\u0670]/g,"")}tryProfileKeyword(e,t){for(let n of this.profileKeywords)if(e.slice(t).startsWith(n.native))return x(n.native,"keyword",w(t,t+n.native.length),n.normalized);return null}isKeywordStart(e,t){let n=e.slice(t);return this.profileKeywords.some(i=>n.startsWith(i.native))}lookupKeyword(e){return this.profileKeywordMap.get(e.toLowerCase())}isKeyword(e){return this.profileKeywordMap.has(e.toLowerCase())}setNormalizer(e){this.normalizer=e;}tryNormalize(e){if(!this.normalizer)return null;let t=this.normalizer.normalize(e);return t.stem!==e&&t.confidence>=.7?t:null}tryMorphKeywordMatch(e,t,n){let i=this.tryNormalize(e);if(!i)return null;let o=this.lookupKeyword(i.stem);if(!o)return null;let s={normalized:o.normalized,stem:i.stem,stemConfidence:i.confidence};return x(e,"keyword",w(t,n),s)}trySelector(e,t){let n=Gt(e,t);return n?x(n,"selector",w(t,t+n.length)):null}tryEventModifier(e,t){if(e[t]!==".")return null;let n=e.slice(t).match(/^\.(?:once|debounce|throttle|queue)(?:\(([^)]+)\))?(?:\s|$|\.)/);if(!n)return null;let i=n[0].replace(/(\s|\.)$/,""),o=i.slice(1).split("(")[0],s=n[1];return {...x(i,"event-modifier",w(t,t+i.length)),metadata:{modifierName:o,value:s?o==="queue"?s:parseInt(s,10):void 0}}}tryString(e,t){let n=Kt(e,t);return n?x(n,"literal",w(t,t+n.length)):null}tryNumber(e,t){let n=Xt(e,t);return n?x(n,"literal",w(t,t+n.length)):null}tryMatchTimeUnit(e,t,n,i=false){let o=t;if(i)for(;o<e.length&&V(e[o]);)o++;let s=e.slice(o);for(let a of n){let c=s.slice(0,a.length);if(a.caseInsensitive?c.toLowerCase()===a.pattern.toLowerCase():c===a.pattern){if(a.notFollowedBy&&(s[a.length]||"")===a.notFollowedBy)continue;if(a.checkBoundary){let u=s[a.length]||"";if(C(u))continue}return {suffix:a.suffix,endPos:o+a.length}}}return null}parseBaseNumber(e,t,n=true){let i=t,o="";if(n&&(e[i]==="-"||e[i]==="+")&&(o+=e[i++]),i>=e.length||!$(e[i]))return null;for(;i<e.length&&$(e[i]);)o+=e[i++];if(i<e.length&&e[i]===".")for(o+=e[i++];i<e.length&&$(e[i]);)o+=e[i++];return !o||o==="-"||o==="+"?null:{number:o,endPos:i}}tryNumberWithTimeUnits(e,t,n,i={}){let{allowSign:o=true,skipWhitespace:s=false}=i,a=this.parseBaseNumber(e,t,o);if(!a)return null;let{number:c,endPos:l}=a,u=[...n,...$e.STANDARD_TIME_UNITS],d=this.tryMatchTimeUnit(e,l,u,s);return d&&(c+=d.suffix,l=d.endPos),x(c,"literal",w(t,l))}tryUrl(e,t){let n=Yt(e,t);return n?x(n,"url",w(t,t+n.length)):null}tryVariableRef(e,t){if(e[t]!==":"||t+1>=e.length||!C(e[t+1]))return null;let n=t+1;for(;n<e.length&&C(e[n]);)n++;let i=e.slice(t,n);return x(i,"identifier",w(t,n))}tryOperator(e,t){let n=e.slice(t,t+2);if(["==","!=","<=",">=","&&","||","->"].includes(n))return x(n,"operator",w(t,t+2));let i=e[t];return ["<",">","!","+","-","*","/","="].includes(i)?x(i,"operator",w(t,t+1)):["(",")","{","}",",",";",":"].includes(i)?x(i,"punctuation",w(t,t+1)):null}tryMultiCharParticle(e,t,n){for(let i of n)if(e.slice(t,t+i.length)===i)return x(i,"particle",w(t,t+i.length));return null}};De.STANDARD_TIME_UNITS=[{pattern:"ms",suffix:"ms",length:2},{pattern:"s",suffix:"s",length:1,checkBoundary:true},{pattern:"m",suffix:"m",length:1,checkBoundary:true,notFollowedBy:"s"},{pattern:"h",suffix:"h",length:1,checkBoundary:true}];var D=De;function z(r){return {stem:r,confidence:1}}function S(r,e,t){return t?{stem:r,confidence:e,metadata:t}:{stem:r,confidence:e}}var Ve=class{constructor(r){this.language=r.language,this.config={minWordLength:3,minStemLength:2,...r};}normalize(r){let e=r.toLowerCase();if(this.isAlreadyNormalized(e))return z(r);if(this.config.reflexiveSuffixes){let t=this.tryReflexiveNormalization(e);if(t)return t}if(this.config.endings){let t=this.tryConjugationEndings(e);if(t)return t}if(this.config.suffixRules){let t=this.trySuffixRules(e);if(t)return t}if(this.config.prefixRules){let t=this.tryPrefixRules(e);if(t)return t}return z(r)}isAlreadyNormalized(r){return this.config.infinitiveEndings?this.config.infinitiveEndings.some(e=>r.endsWith(e)):false}tryReflexiveNormalization(r){let e=this.config.reflexiveSuffixes;if(!e)return null;for(let t of e){if(!r.endsWith(t))continue;let n=r.slice(0,-t.length);if(this.isAlreadyNormalized(n))return S(n,.88,{removedSuffixes:[t],conjugationType:"reflexive"});let i=this.tryConjugationEndings(n)||this.trySuffixRules(n);if(i&&i.stem!==n)return S(i.stem,i.confidence*.95,{removedSuffixes:[t,...i.metadata?.removedSuffixes||[]],conjugationType:"reflexive"})}return null}tryConjugationEndings(r){let e=this.config.endings;if(!e)return null;let t=this.config.minStemLength??2;for(let n of e){if(!r.endsWith(n.ending))continue;let i=r.slice(0,-n.ending.length);if(i.length<t)continue;let o=i+n.stem;return S(o,n.confidence,{removedSuffixes:[n.ending],conjugationType:n.type})}return null}trySuffixRules(r){let e=this.config.suffixRules;if(!e)return null;let t=this.config.minStemLength??2;for(let n of e){if(!r.endsWith(n.pattern))continue;let i=r.slice(0,-n.pattern.length),o=n.minStemLength??t;if(i.length<o)continue;let s=i+(n.replacement||"");return S(s,n.confidence,{removedSuffixes:[n.pattern],...n.conjugationType&&{conjugationType:n.conjugationType}})}return null}tryPrefixRules(r){let e=this.config.prefixRules;if(!e)return null;for(let t of e){if(!r.startsWith(t.pattern))continue;let n=r.slice(t.pattern.length),i=t.minRemaining??this.config.minStemLength??2;if(!(n.length<i))return S(n,1-t.confidencePenalty,{removedPrefixes:[t.pattern]})}return null}};var Qt=new Map,Jt=new Map,er=new Map;function tr(r,e,t){Qt.set(r,e),Jt.set(r,t),er.delete(r);}function rr(r){return /[áéíóúüñÁÉÍÓÚÜÑ]/.test(r)}var nr=[{ending:"ando",stem:"ar",confidence:.88,type:"gerund"},{ending:"ado",stem:"ar",confidence:.88,type:"participle"},{ending:"ada",stem:"ar",confidence:.88,type:"participle"},{ending:"ados",stem:"ar",confidence:.88,type:"participle"},{ending:"adas",stem:"ar",confidence:.88,type:"participle"},{ending:"o",stem:"ar",confidence:.75,type:"present"},{ending:"as",stem:"ar",confidence:.82,type:"present"},{ending:"a",stem:"ar",confidence:.75,type:"present"},{ending:"amos",stem:"ar",confidence:.85,type:"present"},{ending:"\xE1is",stem:"ar",confidence:.85,type:"present"},{ending:"ais",stem:"ar",confidence:.82,type:"present"},{ending:"an",stem:"ar",confidence:.8,type:"present"},{ending:"\xE9",stem:"ar",confidence:.85,type:"past"},{ending:"aste",stem:"ar",confidence:.88,type:"past"},{ending:"\xF3",stem:"ar",confidence:.82,type:"past"},{ending:"amos",stem:"ar",confidence:.85,type:"past"},{ending:"asteis",stem:"ar",confidence:.88,type:"past"},{ending:"aron",stem:"ar",confidence:.88,type:"past"},{ending:"aba",stem:"ar",confidence:.88,type:"past"},{ending:"abas",stem:"ar",confidence:.88,type:"past"},{ending:"\xE1bamos",stem:"ar",confidence:.88,type:"past"},{ending:"abamos",stem:"ar",confidence:.85,type:"past"},{ending:"abais",stem:"ar",confidence:.88,type:"past"},{ending:"aban",stem:"ar",confidence:.88,type:"past"},{ending:"e",stem:"ar",confidence:.72,type:"subjunctive"},{ending:"es",stem:"ar",confidence:.78,type:"subjunctive"},{ending:"emos",stem:"ar",confidence:.82,type:"subjunctive"},{ending:"\xE9is",stem:"ar",confidence:.85,type:"subjunctive"},{ending:"eis",stem:"ar",confidence:.82,type:"subjunctive"},{ending:"en",stem:"ar",confidence:.78,type:"subjunctive"},{ending:"a",stem:"ar",confidence:.75,type:"imperative"},{ending:"ad",stem:"ar",confidence:.85,type:"imperative"},{ending:"ar",stem:"ar",confidence:.92,type:"dictionary"}],ir=[{ending:"iendo",stem:"er",confidence:.88,type:"gerund"},{ending:"ido",stem:"er",confidence:.85,type:"participle"},{ending:"ida",stem:"er",confidence:.85,type:"participle"},{ending:"idos",stem:"er",confidence:.85,type:"participle"},{ending:"idas",stem:"er",confidence:.85,type:"participle"},{ending:"o",stem:"er",confidence:.72,type:"present"},{ending:"es",stem:"er",confidence:.78,type:"present"},{ending:"e",stem:"er",confidence:.72,type:"present"},{ending:"emos",stem:"er",confidence:.85,type:"present"},{ending:"\xE9is",stem:"er",confidence:.85,type:"present"},{ending:"eis",stem:"er",confidence:.82,type:"present"},{ending:"en",stem:"er",confidence:.78,type:"present"},{ending:"\xED",stem:"er",confidence:.85,type:"past"},{ending:"iste",stem:"er",confidence:.88,type:"past"},{ending:"i\xF3",stem:"er",confidence:.85,type:"past"},{ending:"io",stem:"er",confidence:.82,type:"past"},{ending:"imos",stem:"er",confidence:.85,type:"past"},{ending:"isteis",stem:"er",confidence:.88,type:"past"},{ending:"ieron",stem:"er",confidence:.88,type:"past"},{ending:"\xEDa",stem:"er",confidence:.88,type:"past"},{ending:"ia",stem:"er",confidence:.85,type:"past"},{ending:"\xEDas",stem:"er",confidence:.88,type:"past"},{ending:"ias",stem:"er",confidence:.85,type:"past"},{ending:"\xEDamos",stem:"er",confidence:.88,type:"past"},{ending:"iamos",stem:"er",confidence:.85,type:"past"},{ending:"\xEDais",stem:"er",confidence:.88,type:"past"},{ending:"iais",stem:"er",confidence:.85,type:"past"},{ending:"\xEDan",stem:"er",confidence:.88,type:"past"},{ending:"ian",stem:"er",confidence:.85,type:"past"},{ending:"er",stem:"er",confidence:.92,type:"dictionary"}],or=[{ending:"iendo",stem:"ir",confidence:.88,type:"gerund"},{ending:"ido",stem:"ir",confidence:.85,type:"participle"},{ending:"ida",stem:"ir",confidence:.85,type:"participle"},{ending:"idos",stem:"ir",confidence:.85,type:"participle"},{ending:"idas",stem:"ir",confidence:.85,type:"participle"},{ending:"o",stem:"ir",confidence:.72,type:"present"},{ending:"es",stem:"ir",confidence:.78,type:"present"},{ending:"e",stem:"ir",confidence:.72,type:"present"},{ending:"imos",stem:"ir",confidence:.85,type:"present"},{ending:"\xEDs",stem:"ir",confidence:.85,type:"present"},{ending:"is",stem:"ir",confidence:.82,type:"present"},{ending:"en",stem:"ir",confidence:.78,type:"present"},{ending:"\xED",stem:"ir",confidence:.85,type:"past"},{ending:"iste",stem:"ir",confidence:.88,type:"past"},{ending:"i\xF3",stem:"ir",confidence:.85,type:"past"},{ending:"io",stem:"ir",confidence:.82,type:"past"},{ending:"imos",stem:"ir",confidence:.85,type:"past"},{ending:"isteis",stem:"ir",confidence:.88,type:"past"},{ending:"ieron",stem:"ir",confidence:.88,type:"past"},{ending:"\xEDa",stem:"ir",confidence:.88,type:"past"},{ending:"ia",stem:"ir",confidence:.85,type:"past"},{ending:"\xEDas",stem:"ir",confidence:.88,type:"past"},{ending:"ias",stem:"ir",confidence:.85,type:"past"},{ending:"\xEDamos",stem:"ir",confidence:.88,type:"past"},{ending:"iamos",stem:"ir",confidence:.85,type:"past"},{ending:"\xEDais",stem:"ir",confidence:.88,type:"past"},{ending:"iais",stem:"ir",confidence:.85,type:"past"},{ending:"\xEDan",stem:"ir",confidence:.88,type:"past"},{ending:"ian",stem:"ir",confidence:.85,type:"past"},{ending:"ir",stem:"ir",confidence:.92,type:"dictionary"}],sr=[...nr,...ir,...or].sort((r,e)=>e.ending.length-r.ending.length),Be=class extends Ve{constructor(){super({language:"es",minWordLength:3,minStemLength:2,endings:sr,reflexiveSuffixes:["se","me","te","nos","os"],infinitiveEndings:["ar","er","ir"]});}isNormalizable(r){if(r.length<3)return false;let e=r.toLowerCase();if(e.endsWith("ar")||e.endsWith("er")||e.endsWith("ir")||e.endsWith("ando")||e.endsWith("iendo")||e.endsWith("ado")||e.endsWith("ido")||e.endsWith("arse")||e.endsWith("erse")||e.endsWith("irse"))return true;for(let t of r)if(rr(t))return true;return false}};new Be;var qe={code:"es",name:"Spanish",nativeName:"Espa\xF1ol",regions:["western","priority"],direction:"ltr",script:"latin",wordOrder:"SVO",markingStrategy:"preposition",usesSpaces:true,defaultVerbForm:"infinitive",verb:{position:"start",subjectDrop:true},references:{me:"yo",it:"ello",you:"t\xFA",result:"resultado",event:"evento",target:"objetivo",body:"cuerpo"},possessive:{marker:"de",markerPosition:"before-property",usePossessiveAdjectives:true,specialForms:{me:"mi",it:"su",you:"tu"},keywords:{mi:"me",tu:"you",su:"it"}},roleMarkers:{destination:{primary:"en",alternatives:["sobre","a"],position:"before"},source:{primary:"de",alternatives:["desde"],position:"before"},patient:{primary:"",position:"before"},style:{primary:"con",position:"before"}},keywords:{toggle:{primary:"alternar",alternatives:["conmutar","toggle"],normalized:"toggle"},add:{primary:"agregar",alternatives:["a\xF1adir"],normalized:"add"},remove:{primary:"quitar",alternatives:["eliminar","remover","sacar","borrar"],normalized:"remove"},put:{primary:"poner",alternatives:["colocar","pon"],normalized:"put"},append:{primary:"anexar",normalized:"append"},prepend:{primary:"anteponer",normalized:"prepend"},take:{primary:"tomar",normalized:"take"},make:{primary:"hacer",alternatives:["crear"],normalized:"make"},clone:{primary:"clonar",alternatives:["duplicar"],normalized:"clone"},swap:{primary:"intercambiar",alternatives:["permutar"],normalized:"swap"},morph:{primary:"transformar",alternatives:["convertir"],normalized:"morph"},set:{primary:"establecer",alternatives:["fijar","definir"],normalized:"set"},get:{primary:"obtener",alternatives:["conseguir"],normalized:"get"},increment:{primary:"incrementar",alternatives:["aumentar"],normalized:"increment"},decrement:{primary:"decrementar",alternatives:["disminuir"],normalized:"decrement"},log:{primary:"registrar",alternatives:["imprimir"],normalized:"log"},show:{primary:"mostrar",alternatives:["ense\xF1ar"],normalized:"show"},hide:{primary:"ocultar",alternatives:["esconder"],normalized:"hide"},transition:{primary:"transici\xF3n",alternatives:["animar"],normalized:"transition"},on:{primary:"en",alternatives:["al"],normalized:"on"},trigger:{primary:"disparar",alternatives:["activar"],normalized:"trigger"},send:{primary:"enviar",normalized:"send"},focus:{primary:"enfocar",alternatives:["enfoque"],normalized:"focus"},blur:{primary:"desenfocar",alternatives:["desenfoque"],normalized:"blur"},click:{primary:"clic",alternatives:["hacer clic","click"],normalized:"click"},hover:{primary:"sobrevolar",alternatives:["pasar por encima"],normalized:"hover"},submit:{primary:"env\xEDo",alternatives:["envio","someter"],normalized:"submit"},input:{primary:"entrada",alternatives:["introducir"],normalized:"input"},change:{primary:"cambio",alternatives:["cambiar"],normalized:"change"},load:{primary:"carga",normalized:"load"},scroll:{primary:"desplazamiento",normalized:"scroll"},keydown:{primary:"tecla abajo",normalized:"keydown"},keyup:{primary:"tecla arriba",normalized:"keyup"},mouseover:{primary:"rat\xF3n encima",alternatives:["raton encima"],normalized:"mouseover"},mouseout:{primary:"rat\xF3n fuera",alternatives:["raton fuera"],normalized:"mouseout"},go:{primary:"ir",alternatives:["navegar"],normalized:"go"},wait:{primary:"esperar",normalized:"wait"},fetch:{primary:"buscar",alternatives:["recuperar"],normalized:"fetch"},settle:{primary:"estabilizar",normalized:"settle"},if:{primary:"si",normalized:"if"},when:{primary:"cuando",normalized:"when"},where:{primary:"donde",normalized:"where"},else:{primary:"sino",alternatives:["de lo contrario"],normalized:"else"},repeat:{primary:"repetir",normalized:"repeat"},for:{primary:"para",normalized:"for"},while:{primary:"mientras",normalized:"while"},continue:{primary:"continuar",normalized:"continue"},halt:{primary:"detener",alternatives:["parar"],normalized:"halt"},throw:{primary:"lanzar",alternatives:["arrojar"],normalized:"throw"},call:{primary:"llamar",normalized:"call"},return:{primary:"retornar",alternatives:["devolver"],normalized:"return"},then:{primary:"entonces",alternatives:["luego"],normalized:"then"},and:{primary:"y",alternatives:["adem\xE1s","tambi\xE9n"],normalized:"and"},or:{primary:"o",normalized:"or"},not:{primary:"no",normalized:"not"},is:{primary:"es",normalized:"is"},exists:{primary:"existe",normalized:"exists"},empty:{primary:"vac\xEDo",alternatives:["vacio"],normalized:"empty"},end:{primary:"fin",alternatives:["final","terminar"],normalized:"end"},js:{primary:"js",normalized:"js"},async:{primary:"as\xEDncrono",alternatives:["asincrono"],normalized:"async"},tell:{primary:"decir",normalized:"tell"},default:{primary:"predeterminar",alternatives:["por defecto"],normalized:"default"},init:{primary:"iniciar",alternatives:["inicializar"],normalized:"init"},behavior:{primary:"comportamiento",normalized:"behavior"},install:{primary:"instalar",normalized:"install"},measure:{primary:"medir",normalized:"measure"},beep:{primary:"pitido",normalized:"beep"},break:{primary:"romper",normalized:"break"},copy:{primary:"copiar",normalized:"copy"},exit:{primary:"salir",normalized:"exit"},pick:{primary:"escoger",normalized:"pick"},render:{primary:"renderizar",normalized:"render"},first:{primary:"primero",alternatives:["primera"],normalized:"first"},last:{primary:"\xFAltimo",alternatives:["ultima"],normalized:"last"},next:{primary:"siguiente",normalized:"next"},previous:{primary:"anterior",normalized:"previous"},closest:{primary:"cercano",normalized:"closest"},parent:{primary:"padre",normalized:"parent"},into:{primary:"dentro",alternatives:["adentro","dentro de"],normalized:"into"},before:{primary:"antes",alternatives:["antes de"],normalized:"before"},after:{primary:"despu\xE9s",alternatives:["despues","despu\xE9s de","despues de"],normalized:"after"},out:{primary:"fuera",alternatives:["fuera de"],normalized:"out"},until:{primary:"hasta",alternatives:["hasta que"],normalized:"until"},event:{primary:"evento",normalized:"event"},from:{primary:"de",alternatives:["desde"],normalized:"from"}},eventHandler:{keyword:{primary:"al",alternatives:["cuando","en"],normalized:"on"},sourceMarker:{primary:"de",alternatives:["desde"],position:"before"},eventMarker:{primary:"al",alternatives:["cuando"],position:"before"},temporalMarkers:["cuando","al"]}},ar=["===","!==","->","==","!=","<=",">=","&&","||","**","+=","-=","*=","/=","+","-","*","/","=",">","<","!","&","|","%","^","~"],cr=class{constructor(r=ar){this.name="operator",this.operators=[...r].sort((e,t)=>t.length-e.length);}canExtract(r,e){return this.operators.some(t=>r.startsWith(t,e))}extract(r,e){for(let t of this.operators)if(r.startsWith(t,e))return {value:t,length:t.length};return null}},lr="()[]{},:;",ur=class{constructor(r=lr){this.punctuation=r,this.name="punctuation";}canExtract(r,e){return this.punctuation.includes(r[e])}extract(r,e){let t=r[e];return this.punctuation.includes(t)?{value:t,length:1}:null}};function dr(r,e){let t=r[e];if(t==="#"){let n=r.slice(e).match(/^#[a-zA-Z_][\w-]*/);return n?n[0]:null}if(t==="."){let n=r.slice(e).match(/^\.[a-zA-Z_][\w-]*/);return n?n[0]:null}if(t==="["){let n=0,i=e;for(;i<r.length;){if(r[i]==="["&&n++,r[i]==="]"&&(n--,n===0))return r.slice(e,i+1);i++;}return null}if(t==="<"){let n=r.slice(e).match(/^<[\w-]+(?:[#.][\w-]+|\[[^\]]+\])*\s*\/>/);return n?n[0]:null}return null}var pr=class{constructor(){this.name="css-selector";}canExtract(r,e){let t=r[e];return t==="#"||t==="."||t==="["||t==="<"}extract(r,e){let t=dr(r,e);return t?{value:t,length:t.length,metadata:{type:"css-selector"}}:null}},mr=class{constructor(){this.name="event-modifier";}canExtract(r,e){if(r[e]!==".")return false;let t=r.slice(e);return /^\.(once|prevent|stop|debounce|throttle|queue)/.test(t)}extract(r,e){let t=r.slice(e).match(/^\.(?:once|prevent|stop|debounce|throttle|queue)(?:\(([^)]+)\))?/);if(!t)return null;let n=t[0],i=n.slice(1).split("(")[0],o=t[1];return {value:n,length:n.length,metadata:{modifierName:i,value:o?i==="queue"?o:parseInt(o,10):void 0}}}};function fr(r,e){let t=r.slice(e);if(t.startsWith("http://")||t.startsWith("https://")){let n=t.match(/^https?:\/\/[^\s]*/);return n?n[0]:null}if(t.startsWith("//")){let n=t.match(/^\/\/[^\s]*/);return n?n[0]:null}if(t.startsWith("./")||t.startsWith("../")){let n=t.match(/^\.\.?\/[^\s]*/);return n?n[0]:null}if(t.startsWith("/")){let n=t.match(/^\/[^\s]*/);return n?n[0]:null}return null}var hr=class{constructor(){this.name="url";}canExtract(r,e){let t=r.slice(e);return t.startsWith("http://")||t.startsWith("https://")||t.startsWith("//")||t.startsWith("./")||t.startsWith("../")||t.startsWith("/")}extract(r,e){let t=fr(r,e);return t?{value:t,length:t.length,metadata:{type:"url"}}:null}},yr=class{constructor(){this.name="variable-ref";}canExtract(r,e){return r[e]===":"&&e+1<r.length&&/[a-zA-Z_]/.test(r[e+1])}extract(r,e){if(!this.canExtract(r,e))return null;let t=1;for(;e+t<r.length&&/[a-zA-Z0-9_]/.test(r[e+t]);)t++;return {value:r.substring(e,e+t),length:t,metadata:{type:"variable-reference"}}}};function vr(){return [new hr,new mr,new yr,new pr]}function gr(r){return {isLetter:n=>r.test(n),isIdentifierChar:n=>/[0-9]/.test(n)||r.test(n)}}var{isLetter:We,isIdentifierChar:br}=gr(/[a-zA-ZáéíóúüñÁÉÍÓÚÜÑ]/),Er=new Set(["en","a","de","desde","hasta","con","sin","por","para","sobre","entre","antes","despu\xE9s","despues","dentro","fuera","al","del"]),wr=class{constructor(){this.name="spanish-keyword";}setContext(r){this.context=r;}canExtract(r,e){return We(r[e])}extract(r,e){if(!this.context)throw new Error("SpanishKeywordExtractor: context not set");let t=this.tryMultiWordPhrase(r,e);return t||this.extractSpanishWord(r,e)}tryMultiWordPhrase(r,e){if(!this.context)return null;let t=["de lo contrario","de lo normal","por defecto","de nuevo","de otra manera"];for(let n of t)if(r.slice(e,e+n.length).toLowerCase()===n.toLowerCase()){let o=e+n.length;if(o>=r.length||V(r[o])||!We(r[o])){let s=this.context.lookupKeyword(n);return {value:r.slice(e,o),length:n.length,metadata:{normalized:s?.normalized,multiWord:true}}}}return null}extractSpanishWord(r,e){if(!this.context)return null;let t=e,n="";for(;t<r.length&&br(r[t]);)n+=r[t++];if(!n)return null;let i=n.toLowerCase(),o=Er.has(i),s=this.context.lookupKeyword(n),a=s&&s.normalized!==s.native?s.normalized:void 0,c;if(!s&&this.context.normalizer){let l=this.context.normalizer.normalize(n);if(l.stem!==n&&l.confidence>=.7){let u=this.context.lookupKeyword(l.stem);u&&(c=u.normalized);}}return {value:n,length:t-e,metadata:{normalized:a||c,isPreposition:o}}}};function xr(){return [new wr]}var Sr=new Set(["en","a","de","desde","hasta","con","sin","por","para","sobre","entre","antes","despu\xE9s","despues","dentro","fuera","al","del"]),kr=[{native:"verdadero",normalized:"true"},{native:"falso",normalized:"false"},{native:"nulo",normalized:"null"},{native:"indefinido",normalized:"undefined"},{native:"segundo",normalized:"s"},{native:"segundos",normalized:"s"},{native:"milisegundo",normalized:"ms"},{native:"milisegundos",normalized:"ms"},{native:"minuto",normalized:"m"},{native:"minutos",normalized:"m"},{native:"hora",normalized:"h"},{native:"horas",normalized:"h"},{native:"m\xED",normalized:"me"},{native:"destino",normalized:"target"}],Tr=class extends D{constructor(){super(),this.language="es",this.direction="ltr",this.initializeKeywordsFromProfile(qe,kr),this.setNormalizer(new Be),this.registerExtractors(vr()),this.registerExtractor(new L),this.registerExtractor(new M),this.registerExtractors(xr()),this.registerExtractor(new cr),this.registerExtractor(new ur);}classifyToken(r){let e=r.toLowerCase();return Sr.has(e)?"particle":this.isKeyword(e)?"keyword":/^\.(once|prevent|stop|debounce|throttle|queue)(\(.*\))?$/.test(r)?"event-modifier":r.startsWith("#")||r.startsWith(".")||r.startsWith("[")||r.startsWith("*")||r.startsWith("<")?"selector":r.startsWith('"')||r.startsWith("'")||/^\d/.test(r)?"literal":["==","!=","<=",">=","<",">","&&","||","!"].includes(r)?"operator":"identifier"}},Cr=new Tr;tr("es",Cr,qe);var Ar=new Map,zr=new Map,Rr=new Map;function Nr(r,e,t){Ar.set(r,e),zr.set(r,t),Rr.delete(r);}var Fe={code:"pt",name:"Portuguese",nativeName:"Portugu\xEAs",regions:["western","priority"],direction:"ltr",script:"latin",wordOrder:"SVO",markingStrategy:"preposition",usesSpaces:true,verb:{position:"start",subjectDrop:true},references:{me:"eu",it:"ele",you:"voc\xEA",result:"resultado",event:"evento",target:"alvo",body:"corpo"},possessive:{marker:"de",markerPosition:"before-property",usePossessiveAdjectives:true,specialForms:{me:"meu",it:"seu",you:"teu"},keywords:{meu:"me",minha:"me",teu:"you",tua:"you",seu:"it",sua:"it"}},roleMarkers:{destination:{primary:"em",alternatives:["para","a"],position:"before"},source:{primary:"de",alternatives:["desde"],position:"before"},patient:{primary:"",position:"before"},style:{primary:"com",position:"before"}},keywords:{toggle:{primary:"alternar",alternatives:[],normalized:"toggle"},add:{primary:"adicionar",alternatives:["acrescentar"],normalized:"add"},remove:{primary:"remover",alternatives:["eliminar","apagar"],normalized:"remove"},put:{primary:"colocar",alternatives:["p\xF4r","por"],normalized:"put"},append:{primary:"anexar",normalized:"append"},prepend:{primary:"preceder",normalized:"prepend"},take:{primary:"pegar",normalized:"take"},make:{primary:"fazer",alternatives:["criar"],normalized:"make"},clone:{primary:"clonar",alternatives:[],normalized:"clone"},swap:{primary:"trocar",alternatives:["substituir"],normalized:"swap"},morph:{primary:"transformar",alternatives:["converter"],normalized:"morph"},set:{primary:"definir",alternatives:["configurar"],normalized:"set"},get:{primary:"obter",normalized:"get"},increment:{primary:"incrementar",alternatives:["aumentar"],normalized:"increment"},decrement:{primary:"decrementar",alternatives:["diminuir"],normalized:"decrement"},log:{primary:"registrar",alternatives:["imprimir"],normalized:"log"},show:{primary:"mostrar",alternatives:["exibir"],normalized:"show"},hide:{primary:"ocultar",alternatives:["esconder"],normalized:"hide"},transition:{primary:"transi\xE7\xE3o",alternatives:["animar"],normalized:"transition"},on:{primary:"em",alternatives:["ao"],normalized:"on"},trigger:{primary:"disparar",alternatives:["ativar"],normalized:"trigger"},send:{primary:"enviar",normalized:"send"},focus:{primary:"focar",normalized:"focus"},blur:{primary:"desfocar",normalized:"blur"},go:{primary:"ir",alternatives:["navegar"],normalized:"go"},wait:{primary:"esperar",alternatives:["aguardar"],normalized:"wait"},fetch:{primary:"buscar",normalized:"fetch"},settle:{primary:"estabilizar",normalized:"settle"},if:{primary:"se",normalized:"if"},when:{primary:"quando",normalized:"when"},where:{primary:"onde",normalized:"where"},else:{primary:"sen\xE3o",normalized:"else"},repeat:{primary:"repetir",normalized:"repeat"},for:{primary:"para",normalized:"for"},while:{primary:"enquanto",normalized:"while"},continue:{primary:"continuar",normalized:"continue"},halt:{primary:"parar",normalized:"halt"},throw:{primary:"lan\xE7ar",normalized:"throw"},call:{primary:"chamar",normalized:"call"},return:{primary:"retornar",alternatives:["devolver"],normalized:"return"},then:{primary:"ent\xE3o",alternatives:["logo"],normalized:"then"},and:{primary:"e",alternatives:["tamb\xE9m","al\xE9m disso"],normalized:"and"},end:{primary:"fim",alternatives:["final","t\xE9rmino"],normalized:"end"},js:{primary:"js",normalized:"js"},async:{primary:"ass\xEDncrono",normalized:"async"},tell:{primary:"dizer",normalized:"tell"},default:{primary:"padr\xE3o",normalized:"default"},init:{primary:"iniciar",alternatives:["inicializar"],normalized:"init"},behavior:{primary:"comportamento",normalized:"behavior"},install:{primary:"instalar",normalized:"install"},measure:{primary:"medir",normalized:"measure"},beep:{primary:"apitar",normalized:"beep"},break:{primary:"interromper",normalized:"break"},copy:{primary:"copiar",normalized:"copy"},exit:{primary:"sair",normalized:"exit"},pick:{primary:"escolher",normalized:"pick"},render:{primary:"renderizar",normalized:"render"},into:{primary:"dentro",alternatives:["dentro de"],normalized:"into"},before:{primary:"antes",normalized:"before"},after:{primary:"depois",normalized:"after"},click:{primary:"clique",alternatives:["clicar"],normalized:"click"},hover:{primary:"sobrevoar",alternatives:["passar"],normalized:"hover"},submit:{primary:"envio",alternatives:["submeter"],normalized:"submit"},input:{primary:"entrada",alternatives:["inser\xE7\xE3o"],normalized:"input"},change:{primary:"altera\xE7\xE3o",alternatives:["mudan\xE7a"],normalized:"change"},until:{primary:"at\xE9",normalized:"until"},event:{primary:"evento",normalized:"event"},from:{primary:"de",alternatives:["desde"],normalized:"from"}},eventHandler:{keyword:{primary:"em",alternatives:["ao"],normalized:"on"},sourceMarker:{primary:"de",alternatives:["desde"],position:"before"},conditionalKeyword:{primary:"quando",alternatives:["se"]},eventMarker:{primary:"ao",alternatives:["no"],position:"before"},temporalMarkers:["quando","ao"]}};function Pr(r){return /[áàâãéêíóôõúüçÁÀÂÃÉÊÍÓÔÕÚÜÇ]/.test(r)}function Or(r){let e=r.toLowerCase();if(e.endsWith("ar")||e.endsWith("er")||e.endsWith("ir")||e.endsWith("ando")||e.endsWith("endo")||e.endsWith("indo")||e.endsWith("ado")||e.endsWith("ido")||e.endsWith("ar-se")||e.endsWith("er-se")||e.endsWith("ir-se"))return true;for(let t of r)if(Pr(t))return true;return false}var je=["-se","-me","-te","-nos","-vos"],_r=[{ending:"ando",stem:"ar",confidence:.88,type:"gerund"},{ending:"ado",stem:"ar",confidence:.88,type:"participle"},{ending:"ada",stem:"ar",confidence:.88,type:"participle"},{ending:"ados",stem:"ar",confidence:.88,type:"participle"},{ending:"adas",stem:"ar",confidence:.88,type:"participle"},{ending:"o",stem:"ar",confidence:.75,type:"present"},{ending:"as",stem:"ar",confidence:.82,type:"present"},{ending:"a",stem:"ar",confidence:.75,type:"present"},{ending:"amos",stem:"ar",confidence:.85,type:"present"},{ending:"ais",stem:"ar",confidence:.85,type:"present"},{ending:"am",stem:"ar",confidence:.8,type:"present"},{ending:"ei",stem:"ar",confidence:.88,type:"past"},{ending:"aste",stem:"ar",confidence:.88,type:"past"},{ending:"ou",stem:"ar",confidence:.88,type:"past"},{ending:"\xE1mos",stem:"ar",confidence:.88,type:"past"},{ending:"amos",stem:"ar",confidence:.85,type:"past"},{ending:"astes",stem:"ar",confidence:.88,type:"past"},{ending:"aram",stem:"ar",confidence:.88,type:"past"},{ending:"ava",stem:"ar",confidence:.88,type:"past"},{ending:"avas",stem:"ar",confidence:.88,type:"past"},{ending:"\xE1vamos",stem:"ar",confidence:.88,type:"past"},{ending:"avamos",stem:"ar",confidence:.85,type:"past"},{ending:"\xE1veis",stem:"ar",confidence:.88,type:"past"},{ending:"aveis",stem:"ar",confidence:.85,type:"past"},{ending:"avam",stem:"ar",confidence:.88,type:"past"},{ending:"e",stem:"ar",confidence:.72,type:"subjunctive"},{ending:"es",stem:"ar",confidence:.78,type:"subjunctive"},{ending:"emos",stem:"ar",confidence:.82,type:"subjunctive"},{ending:"eis",stem:"ar",confidence:.82,type:"subjunctive"},{ending:"em",stem:"ar",confidence:.78,type:"subjunctive"},{ending:"a",stem:"ar",confidence:.75,type:"imperative"},{ending:"ai",stem:"ar",confidence:.85,type:"imperative"},{ending:"ar",stem:"ar",confidence:.92,type:"dictionary"}],Ir=[{ending:"endo",stem:"er",confidence:.88,type:"gerund"},{ending:"ido",stem:"er",confidence:.85,type:"participle"},{ending:"ida",stem:"er",confidence:.85,type:"participle"},{ending:"idos",stem:"er",confidence:.85,type:"participle"},{ending:"idas",stem:"er",confidence:.85,type:"participle"},{ending:"o",stem:"er",confidence:.72,type:"present"},{ending:"es",stem:"er",confidence:.78,type:"present"},{ending:"e",stem:"er",confidence:.72,type:"present"},{ending:"emos",stem:"er",confidence:.85,type:"present"},{ending:"eis",stem:"er",confidence:.82,type:"present"},{ending:"em",stem:"er",confidence:.78,type:"present"},{ending:"i",stem:"er",confidence:.85,type:"past"},{ending:"este",stem:"er",confidence:.88,type:"past"},{ending:"eu",stem:"er",confidence:.88,type:"past"},{ending:"emos",stem:"er",confidence:.85,type:"past"},{ending:"estes",stem:"er",confidence:.88,type:"past"},{ending:"eram",stem:"er",confidence:.88,type:"past"},{ending:"ia",stem:"er",confidence:.85,type:"past"},{ending:"ias",stem:"er",confidence:.85,type:"past"},{ending:"\xEDamos",stem:"er",confidence:.88,type:"past"},{ending:"iamos",stem:"er",confidence:.85,type:"past"},{ending:"\xEDeis",stem:"er",confidence:.88,type:"past"},{ending:"ieis",stem:"er",confidence:.85,type:"past"},{ending:"iam",stem:"er",confidence:.85,type:"past"},{ending:"er",stem:"er",confidence:.92,type:"dictionary"}],Lr=[{ending:"indo",stem:"ir",confidence:.88,type:"gerund"},{ending:"ido",stem:"ir",confidence:.85,type:"participle"},{ending:"ida",stem:"ir",confidence:.85,type:"participle"},{ending:"idos",stem:"ir",confidence:.85,type:"participle"},{ending:"idas",stem:"ir",confidence:.85,type:"participle"},{ending:"o",stem:"ir",confidence:.72,type:"present"},{ending:"es",stem:"ir",confidence:.78,type:"present"},{ending:"e",stem:"ir",confidence:.72,type:"present"},{ending:"imos",stem:"ir",confidence:.85,type:"present"},{ending:"is",stem:"ir",confidence:.82,type:"present"},{ending:"em",stem:"ir",confidence:.78,type:"present"},{ending:"i",stem:"ir",confidence:.85,type:"past"},{ending:"iste",stem:"ir",confidence:.88,type:"past"},{ending:"iu",stem:"ir",confidence:.88,type:"past"},{ending:"imos",stem:"ir",confidence:.85,type:"past"},{ending:"istes",stem:"ir",confidence:.88,type:"past"},{ending:"iram",stem:"ir",confidence:.88,type:"past"},{ending:"ia",stem:"ir",confidence:.85,type:"past"},{ending:"ias",stem:"ir",confidence:.85,type:"past"},{ending:"\xEDamos",stem:"ir",confidence:.88,type:"past"},{ending:"iamos",stem:"ir",confidence:.85,type:"past"},{ending:"\xEDeis",stem:"ir",confidence:.88,type:"past"},{ending:"ieis",stem:"ir",confidence:.85,type:"past"},{ending:"iam",stem:"ir",confidence:.85,type:"past"},{ending:"ir",stem:"ir",confidence:.92,type:"dictionary"}],Mr=[..._r,...Ir,...Lr].sort((r,e)=>e.ending.length-r.ending.length),Ge=class{constructor(){this.language="pt";}isNormalizable(r){return r.length<3?false:Or(r)}normalize(r){let e=r.toLowerCase();if((e.endsWith("ar")||e.endsWith("er")||e.endsWith("ir"))&&!je.some(i=>e.endsWith(i)))return z(r);let t=this.tryReflexiveNormalization(e);if(t)return t;let n=this.tryConjugationNormalization(e);return n||z(r)}tryReflexiveNormalization(r){for(let e of je)if(r.endsWith(e)){let t=r.slice(0,-e.length);if(t.endsWith("ar")||t.endsWith("er")||t.endsWith("ir"))return S(t,.88,{removedSuffixes:[e],conjugationType:"reflexive"});let n=this.tryConjugationNormalization(t);if(n&&n.stem!==t)return S(n.stem,n.confidence*.95,{removedSuffixes:[e,...n.metadata?.removedSuffixes||[]],conjugationType:"reflexive"})}return null}tryConjugationNormalization(r){for(let e of Mr)if(r.endsWith(e.ending)){let t=r.slice(0,-e.ending.length);if(t.length<2)continue;let n=t+e.stem;return S(n,e.confidence,{removedSuffixes:[e.ending],conjugationType:e.type})}return null}},Dr=["===","!==","->","==","!=","<=",">=","&&","||","**","+=","-=","*=","/=","+","-","*","/","=",">","<","!","&","|","%","^","~"],$r=class{constructor(r=Dr){this.name="operator",this.operators=[...r].sort((e,t)=>t.length-e.length);}canExtract(r,e){return this.operators.some(t=>r.startsWith(t,e))}extract(r,e){for(let t of this.operators)if(r.startsWith(t,e))return {value:t,length:t.length};return null}},Vr="()[]{},:;",Wr=class{constructor(r=Vr){this.punctuation=r,this.name="punctuation";}canExtract(r,e){return this.punctuation.includes(r[e])}extract(r,e){let t=r[e];return this.punctuation.includes(t)?{value:t,length:1}:null}};function Br(r,e){let t=r[e];if(t==="#"){let n=r.slice(e).match(/^#[a-zA-Z_][\w-]*/);return n?n[0]:null}if(t==="."){let n=r.slice(e).match(/^\.[a-zA-Z_][\w-]*/);return n?n[0]:null}if(t==="["){let n=0,i=e;for(;i<r.length;){if(r[i]==="["&&n++,r[i]==="]"&&(n--,n===0))return r.slice(e,i+1);i++;}return null}if(t==="<"){let n=r.slice(e).match(/^<[\w-]+(?:[#.][\w-]+|\[[^\]]+\])*\s*\/>/);return n?n[0]:null}return null}var qr=class{constructor(){this.name="css-selector";}canExtract(r,e){let t=r[e];return t==="#"||t==="."||t==="["||t==="<"}extract(r,e){let t=Br(r,e);return t?{value:t,length:t.length,metadata:{type:"css-selector"}}:null}},jr=class{constructor(){this.name="event-modifier";}canExtract(r,e){if(r[e]!==".")return false;let t=r.slice(e);return /^\.(once|prevent|stop|debounce|throttle|queue)/.test(t)}extract(r,e){let t=r.slice(e).match(/^\.(?:once|prevent|stop|debounce|throttle|queue)(?:\(([^)]+)\))?/);if(!t)return null;let n=t[0],i=n.slice(1).split("(")[0],o=t[1];return {value:n,length:n.length,metadata:{modifierName:i,value:o?i==="queue"?o:parseInt(o,10):void 0}}}};function Fr(r,e){let t=r.slice(e);if(t.startsWith("http://")||t.startsWith("https://")){let n=t.match(/^https?:\/\/[^\s]*/);return n?n[0]:null}if(t.startsWith("//")){let n=t.match(/^\/\/[^\s]*/);return n?n[0]:null}if(t.startsWith("./")||t.startsWith("../")){let n=t.match(/^\.\.?\/[^\s]*/);return n?n[0]:null}if(t.startsWith("/")){let n=t.match(/^\/[^\s]*/);return n?n[0]:null}return null}var Gr=class{constructor(){this.name="url";}canExtract(r,e){let t=r.slice(e);return t.startsWith("http://")||t.startsWith("https://")||t.startsWith("//")||t.startsWith("./")||t.startsWith("../")||t.startsWith("/")}extract(r,e){let t=Fr(r,e);return t?{value:t,length:t.length,metadata:{type:"url"}}:null}},Ur=class{constructor(){this.name="variable-ref";}canExtract(r,e){return r[e]===":"&&e+1<r.length&&/[a-zA-Z_]/.test(r[e+1])}extract(r,e){if(!this.canExtract(r,e))return null;let t=1;for(;e+t<r.length&&/[a-zA-Z0-9_]/.test(r[e+t]);)t++;return {value:r.substring(e,e+t),length:t,metadata:{type:"variable-reference"}}}};function Kr(){return [new Gr,new jr,new Ur,new qr]}function Hr(r){return {isLetter:n=>r.test(n),isIdentifierChar:n=>/[0-9]/.test(n)||r.test(n)}}var{isLetter:Yr,isIdentifierChar:Xr}=Hr(/[a-zA-ZáâãéêíóôõúçÁÂÃÉÊÍÓÔÕÚÇ]/),Zr=new Set(["em","a","de","para","com","sem","por","sobre","entre","antes","depois","dentro","fora","ao","do","da","no","na"]),Qr=class{constructor(){this.name="portuguese-keyword";}setContext(r){this.context=r;}canExtract(r,e){return Yr(r[e])}extract(r,e){if(!this.context)throw new Error("PortugueseKeywordExtractor: context not set");let t=e,n="";for(;t<r.length&&Xr(r[t]);)n+=r[t++];if(!n)return null;let i=n.toLowerCase(),o=Zr.has(i),s=this.context.lookupKeyword(i),a=s&&s.normalized!==s.native?s.normalized:void 0,c;if(!s&&this.context.normalizer){let l=this.context.normalizer.normalize(n);if(l.stem!==n&&l.confidence>=.7){let u=this.context.lookupKeyword(l.stem);u&&(c=u.normalized);}}return {value:n,length:t-e,metadata:{normalized:a||c,isPreposition:o}}}};function Jr(){return [new Qr]}var en=new Set(["em","a","de","desde","at\xE9","ate","com","sem","por","para","sobre","entre","antes","depois","dentro","fora","ao","do","no","na"]),tn=[{native:"verdadeiro",normalized:"true"},{native:"falso",normalized:"false"},{native:"nulo",normalized:"null"},{native:"indefinido",normalized:"undefined"},{native:"primeiro",normalized:"first"},{native:"primeira",normalized:"first"},{native:"\xFAltimo",normalized:"last"},{native:"ultima",normalized:"last"},{native:"pr\xF3ximo",normalized:"next"},{native:"proximo",normalized:"next"},{native:"anterior",normalized:"previous"},{native:"mais pr\xF3ximo",normalized:"closest"},{native:"mais proximo",normalized:"closest"},{native:"pai",normalized:"parent"},{native:"clique",normalized:"click"},{native:"click",normalized:"click"},{native:"entrada",normalized:"input"},{native:"mudan\xE7a",normalized:"change"},{native:"mudanca",normalized:"change"},{native:"envio",normalized:"submit"},{native:"tecla baixo",normalized:"keydown"},{native:"tecla cima",normalized:"keyup"},{native:"mouse sobre",normalized:"mouseover"},{native:"mouse fora",normalized:"mouseout"},{native:"foco",normalized:"focus"},{native:"desfoque",normalized:"blur"},{native:"carregar",normalized:"load"},{native:"rolagem",normalized:"scroll"},{native:"meu",normalized:"my"},{native:"minha",normalized:"my"},{native:"isso",normalized:"it"},{native:"segundo",normalized:"s"},{native:"segundos",normalized:"s"},{native:"milissegundo",normalized:"ms"},{native:"milissegundos",normalized:"ms"},{native:"minuto",normalized:"m"},{native:"minutos",normalized:"m"},{native:"hora",normalized:"h"},{native:"horas",normalized:"h"},{native:"senao",normalized:"else"},{native:"transicao",normalized:"transition"},{native:"ate",normalized:"until"},{native:"entao",normalized:"then"},{native:"lancar",normalized:"throw"},{native:"assincrono",normalized:"async"},{native:"padrao",normalized:"default"},{native:"at\xE9 que",normalized:"until"},{native:"dentro de",normalized:"into"}],rn=class extends D{constructor(){super(),this.language="pt",this.direction="ltr",this.initializeKeywordsFromProfile(Fe,tn),this.setNormalizer(new Ge),this.registerExtractors(Kr()),this.registerExtractor(new L),this.registerExtractor(new M),this.registerExtractors(Jr()),this.registerExtractor(new $r),this.registerExtractor(new Wr);}classifyToken(r){let e=r.toLowerCase();return en.has(e)?"particle":this.isKeyword(e)?"keyword":/^\.(once|prevent|stop|debounce|throttle|queue)(\(.*\))?$/.test(r)?"event-modifier":r.startsWith("#")||r.startsWith(".")||r.startsWith("[")||r.startsWith("*")||r.startsWith("<")?"selector":r.startsWith('"')||r.startsWith("'")||/^\d/.test(r)?"literal":"identifier"}},nn=new rn;Nr("pt",nn,Fe);var on=new Map,sn=new Map,an=new Map;function cn(r,e,t){on.set(r,e),sn.set(r,t),an.delete(r);}var Ue={code:"fr",name:"French",nativeName:"Fran\xE7ais",regions:["western","priority"],direction:"ltr",script:"latin",wordOrder:"SVO",markingStrategy:"preposition",usesSpaces:true,defaultVerbForm:"infinitive",verb:{position:"start",subjectDrop:false},references:{me:"moi",it:"il",you:"toi",result:"r\xE9sultat",event:"\xE9v\xE9nement",target:"cible",body:"corps"},possessive:{marker:"de",markerPosition:"before-property",usePossessiveAdjectives:true,specialForms:{me:"ma",it:"sa",you:"ta"},keywords:{mon:"me",ma:"me",mes:"me",ton:"you",ta:"you",tes:"you",son:"it",sa:"it",ses:"it"}},roleMarkers:{destination:{primary:"sur",alternatives:["\xE0","dans"],position:"before"},source:{primary:"de",alternatives:["depuis"],position:"before"},patient:{primary:"",position:"before"},style:{primary:"avec",position:"before"}},keywords:{toggle:{primary:"basculer",alternatives:["alterner"],normalized:"toggle"},add:{primary:"ajouter",normalized:"add"},remove:{primary:"supprimer",alternatives:["enlever","retirer"],normalized:"remove"},put:{primary:"mettre",alternatives:["placer"],normalized:"put"},append:{primary:"annexer",normalized:"append"},prepend:{primary:"pr\xE9fixer",normalized:"prepend"},take:{primary:"prendre",normalized:"take"},make:{primary:"faire",alternatives:["cr\xE9er"],normalized:"make"},clone:{primary:"cloner",alternatives:["dupliquer"],normalized:"clone"},swap:{primary:"\xE9changer",alternatives:["permuter"],normalized:"swap"},morph:{primary:"transformer",alternatives:["m\xE9tamorphoser"],normalized:"morph"},set:{primary:"d\xE9finir",alternatives:["\xE9tablir"],normalized:"set"},get:{primary:"obtenir",normalized:"get"},increment:{primary:"incr\xE9menter",alternatives:["augmenter"],normalized:"increment"},decrement:{primary:"d\xE9cr\xE9menter",alternatives:["diminuer"],normalized:"decrement"},log:{primary:"enregistrer",alternatives:["journaliser"],normalized:"log"},show:{primary:"montrer",alternatives:["afficher"],normalized:"show"},hide:{primary:"cacher",alternatives:["masquer"],normalized:"hide"},transition:{primary:"transition",alternatives:["animer"],normalized:"transition"},on:{primary:"sur",alternatives:["lors"],normalized:"on"},trigger:{primary:"d\xE9clencher",normalized:"trigger"},send:{primary:"envoyer",normalized:"send"},focus:{primary:"focaliser",alternatives:["concentrer"],normalized:"focus"},blur:{primary:"d\xE9focaliser",normalized:"blur"},go:{primary:"aller",alternatives:["naviguer"],normalized:"go"},wait:{primary:"attendre",normalized:"wait"},fetch:{primary:"chercher",alternatives:["r\xE9cup\xE9rer"],normalized:"fetch"},settle:{primary:"stabiliser",normalized:"settle"},if:{primary:"si",normalized:"if"},when:{primary:"quand",normalized:"when"},where:{primary:"o\xF9",normalized:"where"},else:{primary:"sinon",normalized:"else"},repeat:{primary:"r\xE9p\xE9ter",normalized:"repeat"},for:{primary:"pour",normalized:"for"},while:{primary:"pendant",normalized:"while"},continue:{primary:"continuer",normalized:"continue"},halt:{primary:"arr\xEAter",alternatives:["stopper"],normalized:"halt"},throw:{primary:"lancer",normalized:"throw"},call:{primary:"appeler",normalized:"call"},return:{primary:"retourner",alternatives:["renvoyer"],normalized:"return"},then:{primary:"puis",alternatives:["ensuite","alors"],normalized:"then"},and:{primary:"et",alternatives:["aussi","\xE9galement"],normalized:"and"},end:{primary:"fin",alternatives:["terminer","finir"],normalized:"end"},js:{primary:"js",normalized:"js"},async:{primary:"asynchrone",normalized:"async"},tell:{primary:"dire",normalized:"tell"},default:{primary:"d\xE9faut",normalized:"default"},init:{primary:"initialiser",normalized:"init"},behavior:{primary:"comportement",normalized:"behavior"},install:{primary:"installer",normalized:"install"},measure:{primary:"mesurer",normalized:"measure"},beep:{primary:"bip",normalized:"beep"},break:{primary:"interrompre",normalized:"break"},copy:{primary:"copier",normalized:"copy"},exit:{primary:"sortir",normalized:"exit"},pick:{primary:"choisir",normalized:"pick"},render:{primary:"rendu",normalized:"render"},into:{primary:"dans",normalized:"into"},before:{primary:"avant",normalized:"before"},after:{primary:"apr\xE8s",normalized:"after"},click:{primary:"clic",alternatives:["clique"],normalized:"click"},hover:{primary:"survol",alternatives:["survoler"],normalized:"hover"},submit:{primary:"soumission",alternatives:["soumettre"],normalized:"submit"},input:{primary:"saisie",alternatives:["entr\xE9e"],normalized:"input"},change:{primary:"changement",alternatives:["modifier"],normalized:"change"},until:{primary:"jusqu'\xE0",alternatives:["jusque"],normalized:"until"},event:{primary:"\xE9v\xE9nement",normalized:"event"},from:{primary:"de",alternatives:["depuis"],normalized:"from"}},eventHandler:{keyword:{primary:"sur",alternatives:["lors"],normalized:"on"},sourceMarker:{primary:"de",alternatives:["depuis"],position:"before"},conditionalKeyword:{primary:"quand",alternatives:["lorsque"]},eventMarker:{primary:"au",alternatives:["lors du","lors de"],position:"before"},temporalMarkers:["quand","lorsque"]}};function ln(r){let e=r.toLowerCase();return !!(e.endsWith("er")||e.endsWith("ir")||e.endsWith("re")||e.endsWith("ant")||e.endsWith("\xE9")||e.endsWith("i")||e.endsWith("u")||/[àâäéèêëïîôùûüÿçœæ]/i.test(r))}var un=["toi","vous","nous"],dn=[{ending:"ant",stem:"er",confidence:.88,type:"gerund"},{ending:"\xE9",stem:"er",confidence:.88,type:"participle"},{ending:"\xE9e",stem:"er",confidence:.88,type:"participle"},{ending:"\xE9s",stem:"er",confidence:.88,type:"participle"},{ending:"\xE9es",stem:"er",confidence:.88,type:"participle"},{ending:"e",stem:"er",confidence:.75,type:"present"},{ending:"es",stem:"er",confidence:.78,type:"present"},{ending:"ons",stem:"er",confidence:.85,type:"present"},{ending:"ez",stem:"er",confidence:.85,type:"present"},{ending:"ent",stem:"er",confidence:.82,type:"present"},{ending:"ais",stem:"er",confidence:.82,type:"past"},{ending:"ait",stem:"er",confidence:.82,type:"past"},{ending:"ions",stem:"er",confidence:.85,type:"past"},{ending:"iez",stem:"er",confidence:.85,type:"past"},{ending:"aient",stem:"er",confidence:.85,type:"past"},{ending:"ai",stem:"er",confidence:.8,type:"past"},{ending:"as",stem:"er",confidence:.78,type:"past"},{ending:"a",stem:"er",confidence:.75,type:"past"},{ending:"\xE2mes",stem:"er",confidence:.88,type:"past"},{ending:"\xE2tes",stem:"er",confidence:.88,type:"past"},{ending:"\xE8rent",stem:"er",confidence:.88,type:"past"},{ending:"erai",stem:"er",confidence:.85,type:"future"},{ending:"eras",stem:"er",confidence:.85,type:"future"},{ending:"era",stem:"er",confidence:.82,type:"future"},{ending:"erons",stem:"er",confidence:.88,type:"future"},{ending:"erez",stem:"er",confidence:.88,type:"future"},{ending:"eront",stem:"er",confidence:.88,type:"future"},{ending:"erais",stem:"er",confidence:.85,type:"conditional"},{ending:"erait",stem:"er",confidence:.85,type:"conditional"},{ending:"erions",stem:"er",confidence:.88,type:"conditional"},{ending:"eriez",stem:"er",confidence:.88,type:"conditional"},{ending:"eraient",stem:"er",confidence:.88,type:"conditional"},{ending:"ions",stem:"er",confidence:.8,type:"subjunctive"},{ending:"iez",stem:"er",confidence:.8,type:"subjunctive"},{ending:"ons",stem:"er",confidence:.82,type:"imperative"},{ending:"ez",stem:"er",confidence:.82,type:"imperative"},{ending:"er",stem:"er",confidence:.92,type:"dictionary"}],pn=[{ending:"issant",stem:"ir",confidence:.88,type:"gerund"},{ending:"i",stem:"ir",confidence:.8,type:"participle"},{ending:"ie",stem:"ir",confidence:.82,type:"participle"},{ending:"is",stem:"ir",confidence:.78,type:"participle"},{ending:"ies",stem:"ir",confidence:.82,type:"participle"},{ending:"is",stem:"ir",confidence:.78,type:"present"},{ending:"it",stem:"ir",confidence:.78,type:"present"},{ending:"issons",stem:"ir",confidence:.88,type:"present"},{ending:"issez",stem:"ir",confidence:.88,type:"present"},{ending:"issent",stem:"ir",confidence:.88,type:"present"},{ending:"issais",stem:"ir",confidence:.85,type:"past"},{ending:"issait",stem:"ir",confidence:.85,type:"past"},{ending:"issions",stem:"ir",confidence:.88,type:"past"},{ending:"issiez",stem:"ir",confidence:.88,type:"past"},{ending:"issaient",stem:"ir",confidence:.88,type:"past"},{ending:"irai",stem:"ir",confidence:.85,type:"future"},{ending:"iras",stem:"ir",confidence:.85,type:"future"},{ending:"ira",stem:"ir",confidence:.82,type:"future"},{ending:"irons",stem:"ir",confidence:.88,type:"future"},{ending:"irez",stem:"ir",confidence:.88,type:"future"},{ending:"iront",stem:"ir",confidence:.88,type:"future"},{ending:"ir",stem:"ir",confidence:.9,type:"dictionary"}],mn=[{ending:"ant",stem:"re",confidence:.82,type:"gerund"},{ending:"u",stem:"re",confidence:.8,type:"participle"},{ending:"ue",stem:"re",confidence:.82,type:"participle"},{ending:"us",stem:"re",confidence:.82,type:"participle"},{ending:"ues",stem:"re",confidence:.82,type:"participle"},{ending:"s",stem:"re",confidence:.72,type:"present"},{ending:"d",stem:"re",confidence:.75,type:"present"},{ending:"ons",stem:"re",confidence:.82,type:"present"},{ending:"ez",stem:"re",confidence:.82,type:"present"},{ending:"ent",stem:"re",confidence:.8,type:"present"},{ending:"re",stem:"re",confidence:.9,type:"dictionary"}],fn=[...dn,...pn,...mn].sort((r,e)=>e.ending.length-r.ending.length),Ke=class{constructor(){this.language="fr";}isNormalizable(r){return r.length<3?false:ln(r)}normalize(r){let e=r.toLowerCase();if((e.endsWith("er")||e.endsWith("ir")||e.endsWith("re"))&&e.length>=4)return z(r);let t=this.tryReflexiveNormalization(e);if(t)return t;let n=this.tryConjugationNormalization(e);return n||z(r)}tryReflexiveNormalization(r){for(let e of un){let t="-"+e;if(r.endsWith(t)){let n=r.slice(0,-t.length),i=this.tryConjugationNormalization(n);if(i&&i.stem!==n)return S(i.stem,i.confidence*.95,{removedSuffixes:[t,...i.metadata?.removedSuffixes||[]],conjugationType:"reflexive"})}}return null}tryConjugationNormalization(r){for(let e of fn)if(r.endsWith(e.ending)){let t=r.slice(0,-e.ending.length);if(t.length<2)continue;let n=t+e.stem;return S(n,e.confidence,{removedSuffixes:[e.ending],conjugationType:e.type})}return null}},hn=["===","!==","->","==","!=","<=",">=","&&","||","**","+=","-=","*=","/=","+","-","*","/","=",">","<","!","&","|","%","^","~"],yn=class{constructor(r=hn){this.name="operator",this.operators=[...r].sort((e,t)=>t.length-e.length);}canExtract(r,e){return this.operators.some(t=>r.startsWith(t,e))}extract(r,e){for(let t of this.operators)if(r.startsWith(t,e))return {value:t,length:t.length};return null}},vn="()[]{},:;",gn=class{constructor(r=vn){this.punctuation=r,this.name="punctuation";}canExtract(r,e){return this.punctuation.includes(r[e])}extract(r,e){let t=r[e];return this.punctuation.includes(t)?{value:t,length:1}:null}};function bn(r,e){let t=r[e];if(t==="#"){let n=r.slice(e).match(/^#[a-zA-Z_][\w-]*/);return n?n[0]:null}if(t==="."){let n=r.slice(e).match(/^\.[a-zA-Z_][\w-]*/);return n?n[0]:null}if(t==="["){let n=0,i=e;for(;i<r.length;){if(r[i]==="["&&n++,r[i]==="]"&&(n--,n===0))return r.slice(e,i+1);i++;}return null}if(t==="<"){let n=r.slice(e).match(/^<[\w-]+(?:[#.][\w-]+|\[[^\]]+\])*\s*\/>/);return n?n[0]:null}return null}var En=class{constructor(){this.name="css-selector";}canExtract(r,e){let t=r[e];return t==="#"||t==="."||t==="["||t==="<"}extract(r,e){let t=bn(r,e);return t?{value:t,length:t.length,metadata:{type:"css-selector"}}:null}},wn=class{constructor(){this.name="event-modifier";}canExtract(r,e){if(r[e]!==".")return false;let t=r.slice(e);return /^\.(once|prevent|stop|debounce|throttle|queue)/.test(t)}extract(r,e){let t=r.slice(e).match(/^\.(?:once|prevent|stop|debounce|throttle|queue)(?:\(([^)]+)\))?/);if(!t)return null;let n=t[0],i=n.slice(1).split("(")[0],o=t[1];return {value:n,length:n.length,metadata:{modifierName:i,value:o?i==="queue"?o:parseInt(o,10):void 0}}}};function xn(r,e){let t=r.slice(e);if(t.startsWith("http://")||t.startsWith("https://")){let n=t.match(/^https?:\/\/[^\s]*/);return n?n[0]:null}if(t.startsWith("//")){let n=t.match(/^\/\/[^\s]*/);return n?n[0]:null}if(t.startsWith("./")||t.startsWith("../")){let n=t.match(/^\.\.?\/[^\s]*/);return n?n[0]:null}if(t.startsWith("/")){let n=t.match(/^\/[^\s]*/);return n?n[0]:null}return null}var Sn=class{constructor(){this.name="url";}canExtract(r,e){let t=r.slice(e);return t.startsWith("http://")||t.startsWith("https://")||t.startsWith("//")||t.startsWith("./")||t.startsWith("../")||t.startsWith("/")}extract(r,e){let t=xn(r,e);return t?{value:t,length:t.length,metadata:{type:"url"}}:null}},kn=class{constructor(){this.name="variable-ref";}canExtract(r,e){return r[e]===":"&&e+1<r.length&&/[a-zA-Z_]/.test(r[e+1])}extract(r,e){if(!this.canExtract(r,e))return null;let t=1;for(;e+t<r.length&&/[a-zA-Z0-9_]/.test(r[e+t]);)t++;return {value:r.substring(e,e+t),length:t,metadata:{type:"variable-reference"}}}};function Tn(){return [new Sn,new wn,new kn,new En]}function Cn(r){return {isLetter:n=>r.test(n),isIdentifierChar:n=>/[0-9]/.test(n)||r.test(n)}}var{isLetter:An,isIdentifierChar:zn}=Cn(/[a-zA-ZàâæçéèêëïîôùûüÿœÀÂÆÇÉÈÊËÏÎÔÙÛÜŸŒ]/),Rn=new Set(["\xE0","a","de","du","des","dans","sur","sous","avec","sans","par","pour","entre","avant","apr\xE8s","apres","depuis","vers","chez","contre","au","aux"]),Nn=class{constructor(){this.name="french-keyword";}setContext(r){this.context=r;}canExtract(r,e){return An(r[e])}extract(r,e){if(!this.context)throw new Error("FrenchKeywordExtractor: context not set");let t=e,n="";for(;t<r.length&&zn(r[t]);)n+=r[t++];if(!n)return null;let i=n.toLowerCase(),o=Rn.has(i),s=this.context.lookupKeyword(i),a=s&&s.normalized!==s.native?s.normalized:void 0,c;if(!s&&this.context.normalizer){let l=this.context.normalizer.normalize(n);if(l.stem!==n&&l.confidence>=.7){let u=this.context.lookupKeyword(l.stem);u&&(c=u.normalized);}}return {value:n,length:t-e,metadata:{normalized:a||c,isPreposition:o}}}};function Pn(){return [new Nn]}var On=[{native:"vrai",normalized:"true"},{native:"faux",normalized:"false"},{native:"nul",normalized:"null"},{native:"ind\xE9fini",normalized:"undefined"},{native:"indefini",normalized:"undefined"},{native:"premier",normalized:"first"},{native:"premi\xE8re",normalized:"first"},{native:"premiere",normalized:"first"},{native:"dernier",normalized:"last"},{native:"derni\xE8re",normalized:"last"},{native:"derniere",normalized:"last"},{native:"suivant",normalized:"next"},{native:"pr\xE9c\xE9dent",normalized:"previous"},{native:"precedent",normalized:"previous"},{native:"plus proche",normalized:"closest"},{native:"parent",normalized:"parent"},{native:"clic",normalized:"click"},{native:"click",normalized:"click"},{native:"entr\xE9e",normalized:"input"},{native:"entree",normalized:"input"},{native:"changement",normalized:"change"},{native:"soumission",normalized:"submit"},{native:"touche bas",normalized:"keydown"},{native:"touche haut",normalized:"keyup"},{native:"souris dessus",normalized:"mouseover"},{native:"souris dehors",normalized:"mouseout"},{native:"focus",normalized:"focus"},{native:"flou",normalized:"blur"},{native:"chargement",normalized:"load"},{native:"d\xE9filement",normalized:"scroll"},{native:"defilement",normalized:"scroll"},{native:"je",normalized:"me"},{native:"mon",normalized:"my"},{native:"ma",normalized:"my"},{native:"mes",normalized:"my"},{native:"\xE7a",normalized:"it"},{native:"ca",normalized:"it"},{native:"resultat",normalized:"result"},{native:"evenement",normalized:"event"},{native:"seconde",normalized:"s"},{native:"secondes",normalized:"s"},{native:"milliseconde",normalized:"ms"},{native:"millisecondes",normalized:"ms"},{native:"minute",normalized:"m"},{native:"minutes",normalized:"m"},{native:"heure",normalized:"h"},{native:"heures",normalized:"h"},{native:"prefixer",normalized:"prepend"},{native:"creer",normalized:"make"},{native:"definir",normalized:"set"},{native:"etablir",normalized:"set"},{native:"incrementer",normalized:"increment"},{native:"decrementer",normalized:"decrement"},{native:"declencher",normalized:"trigger"},{native:"defocaliser",normalized:"blur"},{native:"recuperer",normalized:"fetch"},{native:"repeter",normalized:"repeat"},{native:"arreter",normalized:"halt"},{native:"defaut",normalized:"default"},{native:"jusqua",normalized:"until"},{native:"apres",normalized:"after"},{native:"journaliser",normalized:"log"},{native:"transmuter",normalized:"morph"},{native:"tant que",normalized:"while"}],_n=class extends D{constructor(){super(),this.language="fr",this.direction="ltr",this.initializeKeywordsFromProfile(Ue,On),this.normalizer=new Ke,this.registerExtractors(Tn()),this.registerExtractor(new L),this.registerExtractor(new M),this.registerExtractors(Pn()),this.registerExtractor(new yn),this.registerExtractor(new gn);}classifyToken(r){return this.isKeyword(r)?"keyword":/^\.(once|prevent|stop|debounce|throttle|queue)(\(.*\))?$/.test(r)?"event-modifier":r.startsWith("#")||r.startsWith(".")||r.startsWith("[")||r.startsWith("*")||r.startsWith("<")?"selector":r.startsWith('"')||r.startsWith("'")||/^\d/.test(r)?"literal":["==","!=","<=",">=","<",">","&&","||","!"].includes(r)?"operator":r.startsWith("/")||r.startsWith("./")||r.startsWith("http")?"url":"identifier"}},In=new _n;cn("fr",In,Ue);var Ln=new Map,Mn=new Map,Dn=new Map;function $n(r,e,t){Ln.set(r,e),Mn.set(r,t),Dn.delete(r);}var He={code:"de",name:"German",nativeName:"Deutsch",regions:["western","priority"],direction:"ltr",script:"latin",wordOrder:"SVO",markingStrategy:"preposition",usesSpaces:true,defaultVerbForm:"infinitive",verb:{position:"start",subjectDrop:false},references:{me:"ich",it:"es",you:"du",result:"Ergebnis",event:"Ereignis",target:"Ziel",body:"K\xF6rper"},possessive:{marker:"",markerPosition:"before-property",usePossessiveAdjectives:true,specialForms:{me:"mein",it:"sein",you:"dein"},keywords:{mein:"me",meine:"me",meinen:"me",dein:"you",deine:"you",deinen:"you",sein:"it",seine:"it",seinen:"it"}},roleMarkers:{destination:{primary:"auf",alternatives:["zu","in"],position:"before"},source:{primary:"von",alternatives:["aus"],position:"before"},patient:{primary:"",position:"before"},style:{primary:"mit",position:"before"}},keywords:{toggle:{primary:"umschalten",alternatives:["wechseln"],normalized:"toggle"},add:{primary:"hinzuf\xFCgen",normalized:"add"},remove:{primary:"entfernen",alternatives:["l\xF6schen"],normalized:"remove"},put:{primary:"setzen",alternatives:["stellen","platzieren"],normalized:"put"},append:{primary:"anh\xE4ngen",normalized:"append"},prepend:{primary:"voranstellen",normalized:"prepend"},take:{primary:"nehmen",normalized:"take"},make:{primary:"machen",alternatives:["erstellen","erzeugen"],normalized:"make"},clone:{primary:"klonen",alternatives:["duplizieren"],normalized:"clone"},swap:{primary:"austauschen",alternatives:["tauschen","vertauschen"],normalized:"swap"},morph:{primary:"verwandeln",alternatives:["transformieren"],normalized:"morph"},set:{primary:"festlegen",alternatives:["definieren"],normalized:"set"},get:{primary:"holen",alternatives:["bekommen"],normalized:"get"},increment:{primary:"erh\xF6hen",normalized:"increment"},decrement:{primary:"verringern",alternatives:["vermindern"],normalized:"decrement"},log:{primary:"protokollieren",alternatives:["ausgeben"],normalized:"log"},show:{primary:"zeigen",alternatives:["anzeigen"],normalized:"show"},hide:{primary:"verbergen",alternatives:["verstecken"],normalized:"hide"},transition:{primary:"\xFCbergang",alternatives:["animieren"],normalized:"transition"},on:{primary:"bei",alternatives:["auf"],normalized:"on"},trigger:{primary:"ausl\xF6sen",normalized:"trigger"},send:{primary:"senden",alternatives:["schicken"],normalized:"send"},focus:{primary:"fokussieren",normalized:"focus"},blur:{primary:"defokussieren",alternatives:["entfokussieren"],normalized:"blur"},go:{primary:"gehen",alternatives:["navigieren"],normalized:"go"},wait:{primary:"warten",normalized:"wait"},fetch:{primary:"abrufen",alternatives:["laden"],normalized:"fetch"},settle:{primary:"stabilisieren",normalized:"settle"},if:{primary:"falls",alternatives:["sofern"],normalized:"if"},when:{primary:"wenn",normalized:"when"},where:{primary:"wo",normalized:"where"},else:{primary:"sonst",alternatives:["ansonsten"],normalized:"else"},repeat:{primary:"wiederholen",normalized:"repeat"},for:{primary:"f\xFCr",normalized:"for"},while:{primary:"solange",alternatives:["w\xE4hrend"],normalized:"while"},continue:{primary:"fortfahren",alternatives:["weiter"],normalized:"continue"},halt:{primary:"anhalten",alternatives:["stoppen"],normalized:"halt"},throw:{primary:"werfen",normalized:"throw"},call:{primary:"aufrufen",normalized:"call"},return:{primary:"zur\xFCckgeben",normalized:"return"},then:{primary:"dann",alternatives:["danach","anschlie\xDFend"],normalized:"then"},and:{primary:"und",alternatives:["sowie","auch"],normalized:"and"},end:{primary:"ende",alternatives:["fertig"],normalized:"end"},js:{primary:"js",alternatives:["javascript"],normalized:"js"},async:{primary:"asynchron",normalized:"async"},tell:{primary:"sagen",normalized:"tell"},default:{primary:"standard",normalized:"default"},init:{primary:"initialisieren",normalized:"init"},behavior:{primary:"verhalten",normalized:"behavior"},install:{primary:"installieren",normalized:"install"},measure:{primary:"messen",normalized:"measure"},beep:{primary:"piepton",normalized:"beep"},break:{primary:"unterbrechen",normalized:"break"},copy:{primary:"kopieren",normalized:"copy"},exit:{primary:"beenden",normalized:"exit"},pick:{primary:"ausw\xE4hlen",normalized:"pick"},render:{primary:"rendern",normalized:"render"},into:{primary:"hinein",normalized:"into"},before:{primary:"vor",normalized:"before"},after:{primary:"nach",normalized:"after"},click:{primary:"Klick",alternatives:["Klicken"],normalized:"click"},hover:{primary:"Hover",alternatives:["Schweben"],normalized:"hover"},submit:{primary:"Absenden",alternatives:["Senden"],normalized:"submit"},input:{primary:"Eingabe",normalized:"input"},change:{primary:"\xC4nderung",alternatives:["\xC4ndern"],normalized:"change"},until:{primary:"bis",normalized:"until"},event:{primary:"Ereignis",alternatives:["Event"],normalized:"event"},from:{primary:"von",alternatives:["aus"],normalized:"from"}},eventHandler:{keyword:{primary:"bei",alternatives:["auf"],normalized:"on"},sourceMarker:{primary:"von",alternatives:["aus"],position:"before"},conditionalKeyword:{primary:"wenn",alternatives:["falls"]},eventMarker:{primary:"bei",alternatives:["beim"],position:"before"},temporalMarkers:["wenn","bei"]}},Vn=["an","auf","aus","ein","mit","vor","zu","ab","bei","nach","weg","um","her","hin"];function Wn(r){let e=r.toLowerCase();return !!(e.endsWith("en")||e.endsWith("eln")||e.endsWith("ern")||e.startsWith("ge")&&e.endsWith("t")||e.startsWith("ge")&&e.endsWith("en")||/[äöüß]/i.test(r))}var Bn=[{ending:"end",stem:"en",confidence:.88,type:"gerund"},{ending:"e",stem:"en",confidence:.75,type:"present"},{ending:"st",stem:"en",confidence:.8,type:"present"},{ending:"t",stem:"en",confidence:.78,type:"present"},{ending:"en",stem:"en",confidence:.85,type:"dictionary"},{ending:"test",stem:"en",confidence:.85,type:"past"},{ending:"ten",stem:"en",confidence:.82,type:"past"},{ending:"tet",stem:"en",confidence:.85,type:"past"},{ending:"te",stem:"en",confidence:.82,type:"past"},{ending:"test",stem:"en",confidence:.8,type:"subjunctive"},{ending:"ten",stem:"en",confidence:.78,type:"subjunctive"},{ending:"tet",stem:"en",confidence:.8,type:"subjunctive"},{ending:"te",stem:"en",confidence:.78,type:"subjunctive"},{ending:"e",stem:"en",confidence:.72,type:"imperative"},{ending:"t",stem:"en",confidence:.72,type:"imperative"},{ending:"en",stem:"en",confidence:.75,type:"imperative"}],qn=[{ending:"le",stem:"eln",confidence:.82,type:"present"},{ending:"elst",stem:"eln",confidence:.85,type:"present"},{ending:"elt",stem:"eln",confidence:.85,type:"present"},{ending:"eln",stem:"eln",confidence:.88,type:"dictionary"},{ending:"re",stem:"ern",confidence:.82,type:"present"},{ending:"erst",stem:"ern",confidence:.85,type:"present"},{ending:"ert",stem:"ern",confidence:.85,type:"present"},{ending:"ern",stem:"ern",confidence:.88,type:"dictionary"}],jn=[...Bn,...qn].sort((r,e)=>e.ending.length-r.ending.length),Ye=class{constructor(){this.language="de";}isNormalizable(r){return r.length<3?false:Wn(r)}normalize(r){let e=r.toLowerCase();if(e.endsWith("en")&&e.length>=4)return z(r);if((e.endsWith("eln")||e.endsWith("ern"))&&e.length>=5)return z(r);let t=this.tryParticipleNormalization(e);if(t)return t;let n=this.tryConjugationNormalization(e);return n||z(r)}tryParticipleNormalization(r){for(let e of Vn)if(r.startsWith(e+"ge")){let t=r.slice(e.length),n=this.trySimpleParticipleNormalization(t);if(n){let i={removedPrefixes:["ge"],conjugationType:"participle"};return n.metadata?.removedSuffixes&&(i.removedSuffixes=n.metadata.removedSuffixes),S(e+n.stem,n.confidence*.95,i)}}return this.trySimpleParticipleNormalization(r)}trySimpleParticipleNormalization(r){if(!r.startsWith("ge"))return null;let e=r.slice(2);if(e.endsWith("t")&&e.length>=3){let t=e.slice(0,-1);return S(t+"en",.85,{removedPrefixes:["ge"],removedSuffixes:["t"],conjugationType:"participle"})}return e.endsWith("en")&&e.length>=4?S(e,.82,{removedPrefixes:["ge"],conjugationType:"participle"}):null}tryConjugationNormalization(r){for(let e of jn)if(r.endsWith(e.ending)){let t=r.slice(0,-e.ending.length);if(t.length<2)continue;let n=t+e.stem;return S(n,e.confidence,{removedSuffixes:[e.ending],conjugationType:e.type})}return null}},Fn=["===","!==","->","==","!=","<=",">=","&&","||","**","+=","-=","*=","/=","+","-","*","/","=",">","<","!","&","|","%","^","~"],Gn=class{constructor(r=Fn){this.name="operator",this.operators=[...r].sort((e,t)=>t.length-e.length);}canExtract(r,e){return this.operators.some(t=>r.startsWith(t,e))}extract(r,e){for(let t of this.operators)if(r.startsWith(t,e))return {value:t,length:t.length};return null}},Un="()[]{},:;",Kn=class{constructor(r=Un){this.punctuation=r,this.name="punctuation";}canExtract(r,e){return this.punctuation.includes(r[e])}extract(r,e){let t=r[e];return this.punctuation.includes(t)?{value:t,length:1}:null}};function Hn(r,e){let t=r[e];if(t==="#"){let n=r.slice(e).match(/^#[a-zA-Z_][\w-]*/);return n?n[0]:null}if(t==="."){let n=r.slice(e).match(/^\.[a-zA-Z_][\w-]*/);return n?n[0]:null}if(t==="["){let n=0,i=e;for(;i<r.length;){if(r[i]==="["&&n++,r[i]==="]"&&(n--,n===0))return r.slice(e,i+1);i++;}return null}if(t==="<"){let n=r.slice(e).match(/^<[\w-]+(?:[#.][\w-]+|\[[^\]]+\])*\s*\/>/);return n?n[0]:null}return null}var Yn=class{constructor(){this.name="css-selector";}canExtract(r,e){let t=r[e];return t==="#"||t==="."||t==="["||t==="<"}extract(r,e){let t=Hn(r,e);return t?{value:t,length:t.length,metadata:{type:"css-selector"}}:null}},Xn=class{constructor(){this.name="event-modifier";}canExtract(r,e){if(r[e]!==".")return false;let t=r.slice(e);return /^\.(once|prevent|stop|debounce|throttle|queue)/.test(t)}extract(r,e){let t=r.slice(e).match(/^\.(?:once|prevent|stop|debounce|throttle|queue)(?:\(([^)]+)\))?/);if(!t)return null;let n=t[0],i=n.slice(1).split("(")[0],o=t[1];return {value:n,length:n.length,metadata:{modifierName:i,value:o?i==="queue"?o:parseInt(o,10):void 0}}}};function Zn(r,e){let t=r.slice(e);if(t.startsWith("http://")||t.startsWith("https://")){let n=t.match(/^https?:\/\/[^\s]*/);return n?n[0]:null}if(t.startsWith("//")){let n=t.match(/^\/\/[^\s]*/);return n?n[0]:null}if(t.startsWith("./")||t.startsWith("../")){let n=t.match(/^\.\.?\/[^\s]*/);return n?n[0]:null}if(t.startsWith("/")){let n=t.match(/^\/[^\s]*/);return n?n[0]:null}return null}var Qn=class{constructor(){this.name="url";}canExtract(r,e){let t=r.slice(e);return t.startsWith("http://")||t.startsWith("https://")||t.startsWith("//")||t.startsWith("./")||t.startsWith("../")||t.startsWith("/")}extract(r,e){let t=Zn(r,e);return t?{value:t,length:t.length,metadata:{type:"url"}}:null}},Jn=class{constructor(){this.name="variable-ref";}canExtract(r,e){return r[e]===":"&&e+1<r.length&&/[a-zA-Z_]/.test(r[e+1])}extract(r,e){if(!this.canExtract(r,e))return null;let t=1;for(;e+t<r.length&&/[a-zA-Z0-9_]/.test(r[e+t]);)t++;return {value:r.substring(e,e+t),length:t,metadata:{type:"variable-reference"}}}};function ei(){return [new Qn,new Xn,new Jn,new Yn]}function ti(r){return {isLetter:n=>r.test(n),isIdentifierChar:n=>/[0-9]/.test(n)||r.test(n)}}var{isLetter:ri,isIdentifierChar:ni}=ti(/[a-zA-ZäöüÄÖÜß]/),ii=new Set(["an","auf","aus","bei","durch","f\xFCr","fur","gegen","in","mit","nach","ohne","seit","\xFCber","uber","um","unter","von","vor","zu","zwischen","bis","gegen\xFCber","gegenuber","w\xE4hrend","wahrend","wegen","trotz","statt","innerhalb","au\xDFerhalb","ausserhalb"]),oi=class{constructor(){this.name="german-keyword";}setContext(r){this.context=r;}canExtract(r,e){return ri(r[e])}extract(r,e){if(!this.context)throw new Error("GermanKeywordExtractor: context not set");return this.extractGermanWord(r,e)}extractGermanWord(r,e){if(!this.context)return null;let t=e,n="";for(;t<r.length&&ni(r[t]);)n+=r[t++];if(!n)return null;let i=n.toLowerCase(),o=ii.has(i),s=this.context.lookupKeyword(n),a=s&&s.normalized!==s.native?s.normalized:void 0,c;if(!s&&this.context.normalizer){let l=this.context.normalizer.normalize(n);if(l.stem!==n&&l.confidence>=.7){let u=this.context.lookupKeyword(l.stem);u&&(c=u.normalized);}}return {value:n,length:t-e,metadata:{normalized:a||c,isPreposition:o}}}};function si(){return [new oi]}var ai=[{native:"wahr",normalized:"true"},{native:"falsch",normalized:"false"},{native:"null",normalized:"null"},{native:"undefiniert",normalized:"undefined"},{native:"erste",normalized:"first"},{native:"erster",normalized:"first"},{native:"erstes",normalized:"first"},{native:"letzte",normalized:"last"},{native:"letzter",normalized:"last"},{native:"letztes",normalized:"last"},{native:"n\xE4chste",normalized:"next"},{native:"nachste",normalized:"next"},{native:"vorherige",normalized:"previous"},{native:"n\xE4chste",normalized:"closest"},{native:"eltern",normalized:"parent"},{native:"klick",normalized:"click"},{native:"click",normalized:"click"},{native:"eingabe",normalized:"input"},{native:"\xE4nderung",normalized:"change"},{native:"anderung",normalized:"change"},{native:"absenden",normalized:"submit"},{native:"taste unten",normalized:"keydown"},{native:"taste oben",normalized:"keyup"},{native:"maus dr\xFCber",normalized:"mouseover"},{native:"maus druber",normalized:"mouseover"},{native:"maus weg",normalized:"mouseout"},{native:"fokus",normalized:"focus"},{native:"unsch\xE4rfe",normalized:"blur"},{native:"unscharfe",normalized:"blur"},{native:"scrollen",normalized:"scroll"},{native:"meine",normalized:"my"},{native:"meinen",normalized:"my"},{native:"ergebnis",normalized:"result"},{native:"ziel",normalized:"target"},{native:"sekunde",normalized:"s"},{native:"sekunden",normalized:"s"},{native:"millisekunde",normalized:"ms"},{native:"millisekunden",normalized:"ms"},{native:"minute",normalized:"m"},{native:"minuten",normalized:"m"},{native:"stunde",normalized:"h"},{native:"stunden",normalized:"h"},{native:"hinzufugen",normalized:"add"},{native:"hinzufgen",normalized:"add"},{native:"loschen",normalized:"remove"},{native:"anhangen",normalized:"append"},{native:"erhohen",normalized:"increment"},{native:"ubergang",normalized:"transition"},{native:"auslosen",normalized:"trigger"},{native:"zuruckgeben",normalized:"return"},{native:"anschliessend",normalized:"then"},{native:"erh\xF6he",normalized:"increment"},{native:"erhohe",normalized:"increment"},{native:"verringere",normalized:"decrement"}],ci=class extends D{constructor(){super(),this.language="de",this.direction="ltr",this.initializeKeywordsFromProfile(He,ai),this.normalizer=new Ye,this.registerExtractors(ei()),this.registerExtractor(new L),this.registerExtractor(new M),this.registerExtractors(si()),this.registerExtractor(new Gn),this.registerExtractor(new Kn);}classifyToken(r){return this.isKeyword(r)?"keyword":/^\.(once|prevent|stop|debounce|throttle|queue)(\(.*\))?$/.test(r)?"event-modifier":r.startsWith("#")||r.startsWith(".")||r.startsWith("[")||r.startsWith("*")||r.startsWith("<")?"selector":r.startsWith('"')||r.startsWith("'")||/^\d/.test(r)?"literal":"identifier"}},li=new ci;$n("de",li,He);var ui=Object.defineProperty,di=Object.getOwnPropertyNames,ct=(r,e)=>function(){return r&&(e=(0, r[di(r)[0]])(r=0)),e},pi=(r,e)=>{for(var t in e)ui(r,t,{get:e[t],enumerable:true});};function Xe(r,e){return r.replace(/\{(\w+)\}/g,(t,n)=>String(e[n]??`{${n}}`))}function A(r,e,t={},n){let i=lt[r],o=Xe(i,t),s=ut[r],a=s?Xe(s,t):void 0;return {code:r,message:o,severity:e,...n&&{role:n},...a&&{suggestion:a}}}var h,lt,ut,mi=ct({"src/generators/schema-error-codes.ts"(){h={AMBIGUOUS_TYPE_LITERAL_SELECTOR:"SCHEMA_AMBIGUOUS_TYPE_LITERAL_SELECTOR",TOO_MANY_EXPECTED_TYPES:"SCHEMA_TOO_MANY_EXPECTED_TYPES",MULTI_TYPE_PATIENT_EXPECTED:"SCHEMA_MULTI_TYPE_PATIENT_EXPECTED",NO_REQUIRED_ROLES:"SCHEMA_NO_REQUIRED_ROLES",NO_REQUIRED_ROLES_EXPECTED:"SCHEMA_NO_REQUIRED_ROLES_EXPECTED",TRANSITION_PATIENT_ACCEPTS_SELECTOR:"SCHEMA_TRANSITION_PATIENT_ACCEPTS_SELECTOR",TRANSITION_MISSING_GOAL:"SCHEMA_TRANSITION_MISSING_GOAL",EVENT_HANDLER_MISSING_EVENT:"SCHEMA_EVENT_HANDLER_MISSING_EVENT",EVENT_HANDLER_EVENT_NOT_REQUIRED:"SCHEMA_EVENT_HANDLER_EVENT_NOT_REQUIRED",CONDITIONAL_MISSING_CONDITION:"SCHEMA_CONDITIONAL_MISSING_CONDITION",CONDITIONAL_CONDITION_NOT_REQUIRED:"SCHEMA_CONDITIONAL_CONDITION_NOT_REQUIRED",FOR_LOOP_MISSING_SOURCE:"SCHEMA_FOR_LOOP_MISSING_SOURCE",WHILE_LOOP_MISSING_CONDITION:"SCHEMA_WHILE_LOOP_MISSING_CONDITION",VALUE_TYPE_MISMATCH:"SCHEMA_VALUE_TYPE_MISMATCH",SELECTOR_KIND_MISMATCH:"SCHEMA_SELECTOR_KIND_MISMATCH",SELECTOR_KINDS_WITHOUT_SELECTOR_TYPE:"SCHEMA_SELECTOR_KINDS_WITHOUT_SELECTOR_TYPE",KEYWORD_COLLISION:"PROFILE_KEYWORD_COLLISION"},lt={[h.AMBIGUOUS_TYPE_LITERAL_SELECTOR]:"Role '{role}' accepts both 'literal' and 'selector'. This may cause ambiguous type inference for values starting with special characters (* . # etc.).",[h.TOO_MANY_EXPECTED_TYPES]:"Role '{role}' accepts {count} different types. This may make type inference unreliable.",[h.MULTI_TYPE_PATIENT_EXPECTED]:"Role '{role}' accepts multiple types (expected for {command} command).",[h.NO_REQUIRED_ROLES]:"Command has no required roles. Is this intentional?",[h.NO_REQUIRED_ROLES_EXPECTED]:"Command has no required roles (expected for {command}).",[h.TRANSITION_PATIENT_ACCEPTS_SELECTOR]:"Transition command 'patient' role (CSS property name) should only accept 'literal', not 'selector'. CSS property names like 'background-color' are strings, not CSS selectors.",[h.TRANSITION_MISSING_GOAL]:"Transition command requires a 'goal' role for the target value (to <value>). Without it, there's no way to specify what value to transition to.",[h.EVENT_HANDLER_MISSING_EVENT]:"Event handler command should have an 'event' role to specify which event to listen for.",[h.EVENT_HANDLER_EVENT_NOT_REQUIRED]:"Event role should be required - every event handler needs an event to listen for.",[h.CONDITIONAL_MISSING_CONDITION]:"Conditional command should have a 'condition' role for the boolean expression.",[h.CONDITIONAL_CONDITION_NOT_REQUIRED]:"Condition role should be required - conditionals need a condition to evaluate.",[h.FOR_LOOP_MISSING_SOURCE]:"For-loop should have a 'source' role for the collection to iterate over.",[h.WHILE_LOOP_MISSING_CONDITION]:"While-loop should have a 'condition' role for the loop condition.",[h.VALUE_TYPE_MISMATCH]:"Role '{role}' of command '{command}' expects type [{expectedTypes}], got '{actualType}'.",[h.SELECTOR_KIND_MISMATCH]:"Role '{role}' of command '{command}' expects selector kind [{selectorKinds}], got '{actualKind}'.",[h.SELECTOR_KINDS_WITHOUT_SELECTOR_TYPE]:"Role '{role}' has selectorKinds but expectedTypes does not include 'selector'.",[h.KEYWORD_COLLISION]:"Keyword '{keyword}' is used by multiple commands: {commands}. Only the first-registered command will be reachable."},ut={[h.AMBIGUOUS_TYPE_LITERAL_SELECTOR]:"Consider being more specific about which type is expected, or use explicit type markers.",[h.TOO_MANY_EXPECTED_TYPES]:"Consider narrowing the accepted types to improve type inference reliability.",[h.TRANSITION_PATIENT_ACCEPTS_SELECTOR]:"Remove 'selector' from expectedTypes and only accept 'literal'.",[h.TRANSITION_MISSING_GOAL]:"Add a 'goal' role with expectedTypes ['literal', 'variable'].",[h.EVENT_HANDLER_MISSING_EVENT]:"Add an 'event' role with expectedTypes ['literal'].",[h.EVENT_HANDLER_EVENT_NOT_REQUIRED]:"Set required: true on the 'event' role.",[h.CONDITIONAL_MISSING_CONDITION]:"Add a 'condition' role with expectedTypes ['expression'].",[h.CONDITIONAL_CONDITION_NOT_REQUIRED]:"Set required: true on the 'condition' role.",[h.FOR_LOOP_MISSING_SOURCE]:"Add a 'source' role for the collection to iterate over.",[h.WHILE_LOOP_MISSING_CONDITION]:"Add a 'condition' role for the loop continuation condition.",[h.VALUE_TYPE_MISMATCH]:"Ensure the value matches one of the expected types: [{expectedTypes}].",[h.SELECTOR_KIND_MISMATCH]:"Use a selector of the correct kind: [{selectorKinds}].",[h.SELECTOR_KINDS_WITHOUT_SELECTOR_TYPE]:"Either add 'selector' to expectedTypes or remove selectorKinds.",[h.KEYWORD_COLLISION]:"Give each command a unique keyword. Move the shared keyword to alternatives on one command, or use a more specific translation."};}}),dt={};pi(dt,{SchemaErrorCodes:()=>h,formatValidationResults:()=>Ei,getValidationStats:()=>wi,validateAllKeywordCollisions:()=>Si,validateAllSchemas:()=>bi,validateCommandSchema:()=>pt,validateKeywordCollisions:()=>mt,validateRoleValues:()=>xi});function fi(r,e){return {action:r,items:e,get notes(){return e.filter(t=>t.severity==="note").map(t=>t.message)},get warnings(){return e.filter(t=>t.severity==="warning").map(t=>t.message)},get errors(){return e.filter(t=>t.severity==="error").map(t=>t.message)}}}function pt(r){let e=[];for(let n of r.roles)n.expectedTypes.includes("literal")&&n.expectedTypes.includes("selector")&&(n.role==="patient"&&xe.has(r.action)?e.push(A(h.MULTI_TYPE_PATIENT_EXPECTED,"note",{role:n.role,command:r.action},n.role)):e.push(A(h.AMBIGUOUS_TYPE_LITERAL_SELECTOR,"warning",{role:n.role},n.role))),n.expectedTypes.length>3&&!xe.has(r.action)&&e.push(A(h.TOO_MANY_EXPECTED_TYPES,"warning",{role:n.role,count:n.expectedTypes.length},n.role));for(let n of r.roles)n.selectorKinds&&n.selectorKinds.length>0&&(n.expectedTypes.includes("selector")||e.push(A(h.SELECTOR_KINDS_WITHOUT_SELECTOR_TYPE,"warning",{role:n.role},n.role)));switch(r.action){case "transition":hi(r,e);break;case "on":yi(r,e);break;case "if":case "unless":vi(r,e);break;case "repeat":case "for":case "while":gi(r,e);break}return r.roles.filter(n=>n.required).length===0&&(ft.has(r.action)?e.push(A(h.NO_REQUIRED_ROLES_EXPECTED,"note",{command:r.action})):e.push(A(h.NO_REQUIRED_ROLES,"warning",{}))),fi(r.action,e)}function hi(r,e){let t=r.roles.find(i=>i.role==="patient"),n=r.roles.find(i=>i.role==="goal");t&&t.expectedTypes.includes("selector")&&e.push(A(h.TRANSITION_PATIENT_ACCEPTS_SELECTOR,"warning",{},"patient")),t&&!n&&e.push(A(h.TRANSITION_MISSING_GOAL,"error",{}));}function yi(r,e){let t=r.roles.find(n=>n.role==="event");t||e.push(A(h.EVENT_HANDLER_MISSING_EVENT,"warning",{})),t&&!t.required&&e.push(A(h.EVENT_HANDLER_EVENT_NOT_REQUIRED,"warning",{}));}function vi(r,e){let t=r.roles.find(n=>n.role==="condition");t||e.push(A(h.CONDITIONAL_MISSING_CONDITION,"warning",{})),t&&!t.required&&e.push(A(h.CONDITIONAL_CONDITION_NOT_REQUIRED,"warning",{}));}function gi(r,e){r.action==="for"?r.roles.find(n=>n.role==="source")||e.push(A(h.FOR_LOOP_MISSING_SOURCE,"warning",{})):r.action==="while"&&(r.roles.find(n=>n.role==="condition")||e.push(A(h.WHILE_LOOP_MISSING_CONDITION,"warning",{})));}function bi(r,e={}){let t=new Map,{includeNotes:n=false}=e;for(let[i,o]of Object.entries(r)){let s=pt(o),a=s.items.some(l=>l.severity==="warning"||l.severity==="error"),c=n&&s.items.some(l=>l.severity==="note");(a||c)&&t.set(i,s);}return t}function Ei(r,e={}){let t=[],{showNotes:n=false,showCodes:i=true}=e;for(let[o,s]of r){let a=s.items.filter(u=>u.severity==="error"),c=s.items.filter(u=>u.severity==="warning"),l=s.items.filter(u=>u.severity==="note");if(a.length>0){t.push(` \u274C ${o}:`);for(let u of a){let d=i?` [${u.code}]`:"";t.push(` ERROR${d}: ${u.message}`),u.suggestion&&t.push(` \u{1F4A1} Suggestion: ${u.suggestion}`);}}if(c.length>0){t.push(` \u26A0\uFE0F ${o}:`);for(let u of c){let d=i?` [${u.code}]`:"";t.push(` ${d?`${u.code}: `:""}${u.message}`),u.suggestion&&t.push(` \u{1F4A1} ${u.suggestion}`);}}if(n&&l.length>0){t.push(` \u2139\uFE0F ${o}:`);for(let u of l){let d=i?` [${u.code}]`:"";t.push(` ${d?`${u.code}: `:""}${u.message}`);}}}return t.join(`
|
|
2
|
+
`)}function wi(r){let e=0,t=0,n=0,i={};for(let o of r.values())for(let s of o.items)s.severity==="error"?e++:s.severity==="warning"?t++:s.severity==="note"&&n++,i[s.code]=(i[s.code]||0)+1;return {totalCommands:r.size,errors:e,warnings:t,notes:n,byCode:i}}function xi(r,e){let t=[];for(let n of e){let i=r.roles.find(o=>o.role===n.role);i&&(i.expectedTypes.length>0&&!i.expectedTypes.includes(n.type)&&(i.expectedTypes.includes("expression")||t.push({level:"error",role:n.role,message:`${r.action}.${n.role} expects type [${i.expectedTypes.join(", ")}], got '${n.type}'`,code:h.VALUE_TYPE_MISMATCH})),n.type==="selector"&&n.selectorKind&&i.selectorKinds&&i.selectorKinds.length>0&&(i.selectorKinds.includes(n.selectorKind)||t.push({level:"error",role:n.role,message:`${r.action}.${n.role} expects selector kind [${i.selectorKinds.join(", ")}], got '${n.selectorKind}'`,code:h.SELECTOR_KIND_MISMATCH})));}return t}function mt(r){let e=[];if(!r.keywords)return {language:r.code,collisions:e};let t=new Map;for(let[i,o]of Object.entries(r.keywords)){if(!o||!o.primary)continue;let s=t.get(o.primary)||[];if(s.push({command:i,isPrimary:true}),t.set(o.primary,s),o.alternatives)for(let a of o.alternatives){let c=t.get(a)||[];c.push({command:i,isPrimary:false}),t.set(a,c);}}for(let[i,o]of t){let s=[...new Set(o.map(l=>l.command))];if(s.length<=1)continue;let a=o.filter(l=>l.isPrimary).length,c;a>=2?c="primary-primary":a===1?c="primary-alternative":c="alternative-alternative",e.push({keyword:i,commands:s.sort(),type:c});}let n={"primary-primary":0,"primary-alternative":1,"alternative-alternative":2};return e.sort((i,o)=>n[i.type]-n[o.type]),{language:r.code,collisions:e}}function Si(r){let e=[];for(let[,t]of Object.entries(r)){let n=mt(t);n.collisions.length>0&&e.push(n);}return e.sort((t,n)=>t.language.localeCompare(n.language))}var xe,ft,ki=ct({"src/generators/schema-validator.ts"(){mi(),xe=new Set(["put","append","prepend","log","throw","make","measure","return","swap","morph","beep","copy"]),ft=new Set(["compound","else","halt","continue","async","init","settle","focus","blur","return","js","measure","break","exit","beep"]);}});function re(r){let e="complex";return r.startsWith("#")&&!r.includes(" ")?e="id":r.startsWith(".")&&!r.includes(" ")?e="class":r.startsWith("[")&&r.endsWith("]")?e="attribute":/^[a-z][a-z0-9]*$/i.test(r)&&(e="element"),{type:"selector",value:r,selectorKind:e}}function k(r,e){let t={type:"literal",value:r};return e!==void 0?{type:"literal",value:r,dataType:e}:t}function Ze(r){return Le(r)}function W(r){return {type:"reference",value:r}}function be(r,e){return {type:"property-path",object:r,property:e}}function le(r,e,t){let n={kind:"command",action:r,roles:new Map(Object.entries(e))};return t!==void 0?{...n,metadata:t}:n}function Qe(r,e,t,n,i,o){let s=new Map;s.set("event",r);let a={kind:"event-handler",action:"on",roles:s,body:e};return t!==void 0&&(a.eventModifiers=t),n!==void 0&&(a.metadata=n),a}function Je(r,e="then",t){let n={kind:"compound",action:"compound",roles:new Map,statements:r,chainType:e};return t!==void 0&&(n.metadata=t),n}function et(r,e){return !e||e.length===0||e.includes(r)||e.includes("expression")?true:r==="property-path"?e.some(t=>["selector","reference","expression"].includes(t)):false}function Ti(r,e){return r.possessive?.keywords?.[e]}var K=new Map,H=new Map,ue=new Map,Se=null;function ht(r,e){let t={...r};for(let n of Object.keys(e)){let i=e[n],o=r[n];i!==void 0&&(typeof i=="object"&&i!==null&&!Array.isArray(i)&&typeof o=="object"&&o!==null&&!Array.isArray(o)?t[n]=ht(o,i):t[n]=i);}return t}function Ci(r,e){return ht(r,e)}function Te(r){if(!r.extends)return r;let e=H.get(r.extends);if(!e)return console.warn(`[Registry] Profile '${r.code}' extends '${r.extends}' but base is not registered. Make sure to import the base language before the variant.`),r;let t=Te(e);return Ci(t,r)}function yt(r){Se=r;}var tt=new Map;function Y(r){return r.split("-")[0]}function X(r){return r.includes("-")}function Ai(r){let e=K.get(r);if(!e&&X(r)){let t=Y(r);e=K.get(t);}if(!e){let t=Array.from(K.keys()).join(", ");throw new Error(`Language '${r}' is not registered. Registered languages: ${t||"none"}. Import the language module first: import '@lokascript/semantic/languages/${r}';`)}return e}function zi(r){let e=H.get(r);if(!e&&X(r)){let t=Y(r);e=H.get(t);}if(!e){let t=Array.from(H.keys()).join(", ");throw new Error(`Language profile '${r}' is not registered. Registered languages: ${t||"none"}. Import the language module first: import '@lokascript/semantic/languages/${r}';`)}return Te(e)}function Ri(r){let e=K.get(r);return !e&&X(r)&&(e=K.get(Y(r))),e}function B(r){let e=H.get(r);return !e&&X(r)&&(e=H.get(Y(r))),e?Te(e):void 0}function vt(){return Array.from(K.keys())}function Ni(r,e){return Ai(e).tokenize(r)}function U(r){let e=ue.get(r);if(!e&&X(r)&&(e=ue.get(Y(r))),e)return e;let t=tt.get(r);if(!t&&X(r)&&(t=tt.get(Y(r))),t)return ue.set(r,t),t;if(!Se)throw new Error(`No patterns registered for language '${r}'. Either import the language module or set a pattern generator.`);let n=zi(r),i=Se(n);return ue.set(r,i),i}var Ee=.8,Oi=.6,_i=.15,Ii=.5,rt=.15,nt=.1,it=new Set(["\u0628\u062F\u0644","\u063A\u064A\u0631","\u0623\u0636\u0641","\u0623\u0632\u0644","\u0636\u0639","\u0627\u062C\u0639\u0644","\u0639\u064A\u0646","\u0632\u062F","\u0627\u0646\u0642\u0635","\u0633\u062C\u0644","\u0623\u0638\u0647\u0631","\u0623\u062E\u0641","\u0634\u063A\u0644","\u0623\u0631\u0633\u0644","\u0631\u0643\u0632","\u0634\u0648\u0634","\u062A\u0648\u0642\u0641","\u0627\u0646\u0633\u062E","\u0627\u062D\u0630\u0641","\u0627\u0635\u0646\u0639","\u0627\u0646\u062A\u0638\u0631","\u0627\u0646\u062A\u0642\u0627\u0644","\u0623\u0648"]),Li={patient:["\u0639\u0644\u0649"],destination:["\u0625\u0644\u0649","\u0627\u0644\u0649"],source:["\u0645\u0646"],agent:["\u0645\u0646"],manner:["\u0628"],style:["\u0628"],goal:["\u0625\u0644\u0649","\u0627\u0644\u0649"],method:["\u0628"]},Mi=class{calculate(r){return this.calculateWithBreakdown(r).final}calculateWithBreakdown(r){let e=this.scoreRoleCoverage(r),t=this.scoreStemPenalty(r),n=this.scoreLanguageBoost(r),i=this.scoreLanguageAdjustment(r),o=e;return o=Math.max(Ii,o+t),o=Math.min(1,o+n),o=Math.max(0,Math.min(1,o+i)),{roleCoverage:e,stemPenalty:t,languageBoost:n,languageAdjustment:i,final:o}}scoreRoleCoverage(r){let{pattern:e,captured:t}=r,n=0,i=0,o=s=>e.extraction?.[s]?.default!==void 0;for(let s of e.template.tokens)if(s.type==="role")i+=1,t.has(s.role)&&(n+=1);else if(s.type==="group")for(let a of s.tokens)a.type==="role"&&(i+=Ee,t.has(a.role)?n+=Ee:o(a.role)&&(n+=Ee*Oi));return i>0?n/i:1}scoreStemPenalty(r){let{stemMatchCount:e,totalKeywordMatches:t}=r;return e<=0||t<=0?0:-(e/t)*_i}scoreLanguageBoost(r){let{pattern:e}=r;if(e.language!=="ar")return 0;let t=e.template.tokens[0];return !t||t.type!=="literal"?0:it.has(t.value)||t.alternatives?.some(n=>it.has(n))?rt:0}scoreLanguageAdjustment(r){let{pattern:e,captured:t}=r;if(e.language!=="ar")return 0;let n=0;for(let[i,o]of t.entries()){let s=Li[i];if(!s||s.length===0)continue;let a="metadata"in o?o.metadata:void 0;a&&typeof a.prepositionValue=="string"&&(s.includes(a.prepositionValue)?n+=.1:n-=.1);}return Math.max(-nt,Math.min(nt,n))}},Di=new Mi,pe=class te{constructor(e){this.matchCache=new Map,this.stemMatchCount=0,this.totalKeywordMatches=0,this.confidenceModel=e??Di;}matchPattern(e,t){let n=e.mark(),i=new Map;if(this.currentProfile=B(t.language),this.stemMatchCount=0,this.totalKeywordMatches=0,!this.matchTokenSequence(e,t.template.tokens,i))return e.reset(n),null;let s=this.confidenceModel.calculate({pattern:t,captured:i,stemMatchCount:this.stemMatchCount,totalKeywordMatches:this.totalKeywordMatches});return this.applyExtractionRules(t,i),{pattern:t,captured:i,consumedTokens:e.position()-n.position,confidence:s}}matchBest(e,t){this.matchCache.clear();let n=[],i=e.position();for(let s of t){let a=e.mark(),c=`${i}:${s.id}`,l;this.matchCache.has(c)?l=this.matchCache.get(c):(l=this.matchPattern(e,s),this.matchCache.set(c,l)),l&&n.push(l),e.reset(a);}if(n.length===0)return null;n.sort((s,a)=>{let c=a.pattern.priority-s.pattern.priority;return c!==0?c:a.confidence-s.confidence});let o=n[0];return this.matchPattern(e,o.pattern),o}matchTokenSequence(e,t,n){let i=t[0],o=i?.type==="literal"&&(i.value==="and"||i.value==="then"||i.alternatives?.includes("and")||i.alternatives?.includes("then"));if(this.currentProfile?.code==="ar"&&!o)for(;e.peek()?.kind==="conjunction";)e.advance();for(let s of t)if(!this.matchPatternToken(e,s,n)){if(this.isOptional(s))continue;return false}return true}matchPatternToken(e,t,n){switch(t.type){case "literal":return this.matchLiteralToken(e,t);case "role":return this.matchRoleToken(e,t,n);case "group":return this.matchGroupToken(e,t,n);default:return false}}matchLiteralToken(e,t){let n=e.peek();if(!n)return false;let i=this.getMatchType(n,t.value);if(i!=="none")return this.totalKeywordMatches++,i==="stem"&&this.stemMatchCount++,e.advance(),true;if(t.alternatives)for(let o of t.alternatives){let s=this.getMatchType(n,o);if(s!=="none")return this.totalKeywordMatches++,s==="stem"&&this.stemMatchCount++,e.advance(),true}return false}matchRoleToken(e,t,n){this.skipNoiseWords(e);let i=e.peek();if(!i)return t.optional||false;let o=this.tryMatchPossessiveExpression(e);if(o)return t.expectedTypes&&t.expectedTypes.length>0&&!t.expectedTypes.includes(o.type)&&!t.expectedTypes.includes("expression")?t.optional||false:(n.set(t.role,o),true);let s=this.tryMatchMethodCallExpression(e);if(s)return t.expectedTypes&&t.expectedTypes.length>0&&!t.expectedTypes.includes(s.type)&&!t.expectedTypes.includes("expression")?t.optional||false:(n.set(t.role,s),true);let a=this.tryMatchPossessiveSelectorExpression(e);if(a)return t.expectedTypes&&t.expectedTypes.length>0&&!et(a.type,t.expectedTypes)?t.optional||false:(n.set(t.role,a),true);let c=this.tryMatchPropertyAccessExpression(e);if(c)return t.expectedTypes&&t.expectedTypes.length>0&&!t.expectedTypes.includes(c.type)&&!t.expectedTypes.includes("expression")?t.optional||false:(n.set(t.role,c),true);let l=this.tryMatchSelectorPropertyExpression(e);if(l)return t.expectedTypes&&t.expectedTypes.length>0&&!et(l.type,t.expectedTypes)?t.optional||false:(n.set(t.role,l),true);let u=this.tokenToSemanticValue(i);return !u||t.expectedTypes&&t.expectedTypes.length>0&&!t.expectedTypes.includes(u.type)?t.optional||false:(n.set(t.role,u),e.advance(),true)}tryMatchPossessiveExpression(e){let t=e.peek();if(!t||!this.currentProfile)return null;let n=(t.normalized||t.value).toLowerCase(),i=Ti(this.currentProfile,n);if(!i)return null;let o=e.mark();e.advance();let s=e.peek();if(!s)return e.reset(o),null;if(s.kind==="identifier"||s.kind==="keyword"&&!this.isStructuralKeyword(s.value)||s.kind==="selector"&&s.value.startsWith("*")||s.kind==="selector"&&s.value.startsWith("@")||s.kind==="selector"&&s.value.startsWith(".")&&/^\.[a-zA-Z_]\w*/.test(s.value)){e.advance();let a=s.value;s.kind==="selector"&&a.startsWith(".")&&/^\.[a-zA-Z_]\w*/.test(a)&&(a=a.substring(1));let c=a;for(;e.peek()?.kind==="selector"&&e.peek().value.startsWith(".")&&/^\.[a-zA-Z_]\w*/.test(e.peek().value);)c+=e.peek().value,e.advance();let l=e.peek();return l?.kind==="literal"&&l.value.startsWith("(")&&(c+=l.value,e.advance()),be(W(i),c)}return e.reset(o),null}isStructuralKeyword(e){return new Set(["into","in","to","from","at","by","with","without","before","after","of","as","on","then","end","else","if","repeat","while","for","toggle","add","remove","put","set","show","hide","increment","decrement","send","trigger","call"]).has(e.toLowerCase())}tryMatchMethodCallExpression(e){let t=e.peek();if(!t||t.kind!=="selector")return null;let n=e.mark();e.advance();let i=e.peek();if(!i||i.kind!=="operator"||i.value!==".")return e.reset(n),null;e.advance();let o=e.peek();if(!o||o.kind!=="identifier")return e.reset(n),null;e.advance();let s=e.peek();if(!s||s.kind!=="punctuation"||s.value!=="(")return e.reset(n),null;e.advance();let a=[];for(;!e.isAtEnd()&&a.length<te.MAX_METHOD_ARGS;){let l=e.peek();if(!l)break;if(l.kind==="punctuation"&&l.value===")"){e.advance();break}if(l.kind==="punctuation"&&l.value===","){e.advance();continue}a.push(l.value),e.advance();}return {type:"expression",raw:`${t.value}.${o.value}(${a.join(", ")})`}}tryMatchPropertyAccessExpression(e){let t=e.peek();if(!t||t.kind!=="identifier"&&t.kind!=="keyword")return null;let n=e.mark();e.advance();let i=e.peek();if(!i||i.kind!=="operator"||i.value!==".")return e.reset(n),null;e.advance();let o=e.peek();if(!o||o.kind!=="identifier")return e.reset(n),null;e.advance();let s=`${t.value}.${o.value}`,a=1;for(;!e.isAtEnd()&&a<te.MAX_PROPERTY_DEPTH;){let l=e.peek();if(!l||l.kind!=="operator"||l.value!==".")break;e.advance();let u=e.peek();if(!u||u.kind!=="identifier")break;e.advance(),s+=`.${u.value}`,a++;}let c=e.peek();if(c&&c.kind==="punctuation"&&c.value==="("){e.advance();let l=[],u=0;for(;!e.isAtEnd()&&l.length<te.MAX_METHOD_ARGS;){let p=e.peek();if(!p)break;if(p.kind==="punctuation"&&p.value===")"){if(u===0){e.advance();break}u--;}if(p.kind==="punctuation"&&p.value==="("&&u++,p.kind==="punctuation"&&p.value===","){e.advance();continue}l.push(p.value),e.advance();}return {type:"expression",raw:`${s}(${l.join(", ")})`}}return {type:"expression",raw:s}}tryMatchPossessiveSelectorExpression(e){let t=e.peek();if(!t||t.kind!=="selector")return null;let n=e.mark();e.advance();let i=e.peek();if(!i||i.kind!=="punctuation"||i.value!=="'s")return e.reset(n),null;e.advance();let o=e.peek();return !o||o.kind!=="selector"&&o.kind!=="identifier"?(e.reset(n),null):(e.advance(),be(re(t.value),o.value))}tryMatchSelectorPropertyExpression(e){let t=e.peek();if(!t||t.kind!=="selector"||!t.value.startsWith("#"))return null;let n=e.mark();e.advance();let i=e.peek();if(!i||i.kind!=="selector"||!i.value.startsWith("."))return e.reset(n),null;let o=e.peek(1);o&&o.kind,e.advance();let s=i.value.slice(1);return be(re(t.value),s)}matchGroupToken(e,t,n){let i=e.mark(),o=new Set(n.keys());if(!this.matchTokenSequence(e,t.tokens,n)){e.reset(i);for(let a of n.keys())o.has(a)||n.delete(a);return t.optional||false}return true}getMatchType(e,t){return e.value===t?"exact":e.normalized===t?"normalized":e.stem===t&&e.stemConfidence!==void 0&&e.stemConfidence>=.7?"stem":e.kind==="keyword"&&e.value.toLowerCase()===t.toLowerCase()?"case-insensitive":"none"}tokenToSemanticValue(e){switch(e.kind){case "selector":return re(e.value);case "literal":return this.parseLiteralValue(e.value);case "keyword":let t=(e.normalized||e.value).toLowerCase();return Ze(t)?W(t):k(e.normalized||e.value);case "identifier":if(e.value.startsWith(":"))return W(e.value);let n=e.value.toLowerCase();return Ze(n)?W(n):{type:"expression",raw:e.value};case "url":return k(e.value,"string");default:return null}}parseLiteralValue(e){if(e.startsWith('"')||e.startsWith("'")||e.startsWith("`")||e.startsWith("\u300C")){let i=e.slice(1,-1);return k(i,"string")}if(e==="true")return k(true,"boolean");if(e==="false")return k(false,"boolean");let t=e.match(/^(\d+(?:\.\d+)?)(ms|s|m|h)?$/);if(t){let i=parseFloat(t[1]);return t[2]?k(e,"duration"):k(i,"number")}let n=parseFloat(e);return isNaN(n)?k(e,"string"):k(n,"number")}applyExtractionRules(e,t){for(let[n,i]of Object.entries(e.extraction))t.has(n)||(i.value!==void 0?t.set(n,{type:"literal",value:i.value}):i.default&&t.set(n,i.default));}isOptional(e){return e.type!=="literal"&&e.optional===true}skipNoiseWords(e){let t=e.peek();if(!t)return;let n=t.value.toLowerCase();if(te.ENGLISH_NOISE_WORDS.has(n)){let i=e.mark();e.advance();let o=e.peek();if(o&&(o.kind==="selector"||o.kind==="identifier"))return;e.reset(i);}n==="class"&&e.advance();}extractEventModifiers(e){let t={},n=false;for(;!e.isAtEnd();){let i=e.peek();if(!i||i.kind!=="event-modifier")break;let o=i.metadata;if(!o)break;switch(n=true,o.modifierName){case "once":t.once=true;break;case "debounce":typeof o.value=="number"&&(t.debounce=o.value);break;case "throttle":typeof o.value=="number"&&(t.throttle=o.value);break;case "queue":(o.value==="first"||o.value==="last"||o.value==="all"||o.value==="none")&&(t.queue=o.value);break}e.advance();}return n?t:void 0}};pe.MAX_PROPERTY_DEPTH=10;pe.MAX_METHOD_ARGS=20;pe.ENGLISH_NOISE_WORDS=new Set(["the","a","an"]);var gt=pe,G=new gt;function $i(r){return Ri(r)}function we(r,e){return Ni(r,e)}function bt(){return vt()}var Vi={ko:{\uD074\uB9AD:"click",\uC785\uB825:"input",\uBCC0\uACBD:"change",\uC81C\uCD9C:"submit",\uD0A4\uB2E4\uC6B4:"keydown",\uD0A4\uC5C5:"keyup",\uB9C8\uC6B0\uC2A4\uC624\uBC84:"mouseover",\uB9C8\uC6B0\uC2A4\uC544\uC6C3:"mouseout",\uB9C8\uC6B0\uC2A4\uB2E4\uC6B4:"mousedown",\uB9C8\uC6B0\uC2A4\uC5C5:"mouseup",\uD3EC\uCEE4\uC2A4:"focus",\uBE14\uB7EC:"blur",\uB85C\uB4DC:"load",\uB9AC\uC0AC\uC774\uC988:"resize",\uC2A4\uD06C\uB864:"scroll"},ja:{\u30AF\u30EA\u30C3\u30AF:"click",\u5165\u529B:"input",\u5909\u66F4:"change",\u9001\u4FE1:"submit",\u30AD\u30FC\u30C0\u30A6\u30F3:"keydown",\u30AD\u30FC\u30A2\u30C3\u30D7:"keyup",\u30AD\u30FC\u30D7\u30EC\u30B9:"keypress",\u30DE\u30A6\u30B9\u30AA\u30FC\u30D0\u30FC:"mouseover",\u30DE\u30A6\u30B9\u30A2\u30A6\u30C8:"mouseout",\u30DE\u30A6\u30B9\u62BC\u4E0B:"mousedown",\u30DE\u30A6\u30B9\u89E3\u653E:"mouseup",\u30D5\u30A9\u30FC\u30AB\u30B9:"focus",\u30D6\u30E9\u30FC:"blur",\u30ED\u30FC\u30C9:"load",\u8AAD\u307F\u8FBC\u307F:"load",\u30B5\u30A4\u30BA\u5909\u66F4:"resize",\u30B9\u30AF\u30ED\u30FC\u30EB:"scroll"},ar:{\u0627\u0644\u0646\u0642\u0631:"click",\u0646\u0642\u0631:"click",\u0627\u0644\u0625\u062F\u062E\u0627\u0644:"input",\u0625\u062F\u062E\u0627\u0644:"input",\u0627\u0644\u062A\u063A\u064A\u064A\u0631:"change",\u062A\u063A\u064A\u064A\u0631:"change",\u0627\u0644\u0625\u0631\u0633\u0627\u0644:"submit",\u0625\u0631\u0633\u0627\u0644:"submit","\u0636\u063A\u0637 \u0627\u0644\u0645\u0641\u062A\u0627\u062D":"keydown","\u0631\u0641\u0639 \u0627\u0644\u0645\u0641\u062A\u0627\u062D":"keyup","\u062A\u0645\u0631\u064A\u0631 \u0627\u0644\u0645\u0627\u0648\u0633":"mouseover",\u0627\u0644\u062A\u0631\u0643\u064A\u0632:"focus",\u062A\u062D\u0645\u064A\u0644:"load",\u062A\u0645\u0631\u064A\u0631:"scroll"},es:{clic:"click",click:"click",entrada:"input",cambio:"change",env\u00EDo:"submit",enviar:"submit","tecla abajo":"keydown","tecla arriba":"keyup","rat\xF3n encima":"mouseover","rat\xF3n fuera":"mouseout",enfoque:"focus",desenfoque:"blur",carga:"load",desplazamiento:"scroll"},tr:{t\u0131klama:"click",t\u0131kla:"click",t\u0131k:"click",giri\u015F:"input",girdi:"input",de\u011Fi\u015Fiklik:"change",de\u011Fi\u015Fim:"change",g\u00F6nderme:"submit",g\u00F6nder:"submit",tu\u015Fbasma:"keydown",tu\u015Fb\u0131rakma:"keyup",fare_bas:"mousedown",fare_b\u0131rak:"mouseup",farei\u00E7inde:"mouseover",fared\u0131\u015F\u0131nda:"mouseout",odaklanma:"focus",odak:"focus",bulan\u0131kl\u0131k:"blur",y\u00FCkleme:"load",y\u00FCkle:"load",boyut_de\u011Fi\u015Ftir:"resize",kayd\u0131rma:"scroll"},pt:{clique:"click",clicar:"click",click:"click",entrada:"input",inserir:"input",mudan\u00E7a:"change",mudanca:"change",alterar:"change",envio:"submit",enviar:"submit","tecla baixo":"keydown","tecla cima":"keyup","pressionar tecla":"keydown","soltar tecla":"keyup","mouse sobre":"mouseover","mouse fora":"mouseout",foco:"focus",focar:"focus",desfoque:"blur",desfocar:"blur",carregar:"load",carregamento:"load",rolagem:"scroll",rolar:"scroll"},zh:{\u70B9\u51FB:"click",\u5355\u51FB:"click",\u53CC\u51FB:"dblclick",\u8F93\u5165:"input",\u6539\u53D8:"change",\u53D8\u5316:"change",\u53D8\u66F4:"change",\u63D0\u4EA4:"submit",\u53D1\u9001:"submit",\u6309\u952E:"keydown",\u952E\u5165:"keydown",\u677E\u952E:"keyup",\u9F20\u6807\u8FDB\u5165:"mouseover",\u9F20\u6807\u79FB\u5165:"mouseover",\u9F20\u6807\u79BB\u5F00:"mouseout",\u9F20\u6807\u79FB\u51FA:"mouseout",\u7126\u70B9:"focus",\u805A\u7126:"focus",\u5931\u7126:"blur",\u6A21\u7CCA:"blur",\u52A0\u8F7D:"load",\u8F7D\u5165:"load",\u6EDA\u52A8:"scroll"},fr:{clic:"click",cliquer:"click",click:"click",saisie:"input",entr\u00E9e:"input",changement:"change",changer:"change",soumettre:"submit",soumission:"submit",envoi:"submit","touche bas":"keydown","touche haut":"keyup","souris dessus":"mouseover","souris dehors":"mouseout",focus:"focus",focaliser:"focus",d\u00E9focus:"blur",d\u00E9focaliser:"blur",chargement:"load",charger:"load",d\u00E9filement:"scroll",d\u00E9filer:"scroll"},de:{klick:"click",klicken:"click",click:"click",eingabe:"input",eingeben:"input",\u00E4nderung:"change",\u00E4ndern:"change",absenden:"submit",einreichen:"submit","taste runter":"keydown","taste hoch":"keyup","maus \xFCber":"mouseover","maus raus":"mouseout",fokus:"focus",fokussieren:"focus",defokussieren:"blur",unsch\u00E4rfe:"blur",laden:"load",ladung:"load",scrollen:"scroll",bl\u00E4ttern:"scroll"},id:{klik:"click",click:"click",masukan:"input",input:"input",ubah:"change",perubahan:"change",kirim:"submit","tekan tombol":"keydown","lepas tombol":"keyup","mouse masuk":"mouseover","mouse keluar":"mouseout",fokus:"focus",blur:"blur",muat:"load",memuat:"load",gulir:"scroll",menggulir:"scroll"},bn:{\u0995\u09CD\u09B2\u09BF\u0995:"click",\u0987\u09A8\u09AA\u09C1\u099F:"input",\u099C\u09AE\u09BE:"submit",\u09B2\u09CB\u09A1:"load",\u09B8\u09CD\u0995\u09CD\u09B0\u09CB\u09B2:"scroll",\u09B0\u09BF\u09B8\u09BE\u0987\u099C:"resize",\u099D\u09BE\u09AA\u09B8\u09BE:"blur",\u09AB\u09CB\u0995\u09BE\u09B8:"focus",\u09AA\u09B0\u09BF\u09AC\u09B0\u09CD\u09A4\u09A8:"change"},qu:{click:"click","\xF1it'iy":"click",\u00F1itiy:"click",yaykuchiy:"input",yaykuy:"input",tikray:"change","t'ikray":"change",apachiy:"submit",kachay:"submit","llave uray":"keydown","llave hawa":"keyup","q'away":"focus",qhaway:"focus",paqariy:"blur","mana q'away":"blur",cargay:"load",apakuy:"load",apamuy:"load",kunray:"scroll",muyuy:"scroll",hatun_kay:"resize"},sw:{bofya:"click",click:"click",kubofya:"click",ingiza:"input",kubadilisha:"change",mabadiliko:"change",tuma:"submit",kutuma:"submit","bonyeza chini":"keydown","bonyeza juu":"keyup","panya juu":"mouseover","panya nje":"mouseout",lenga:"focus",kulenga:"focus",blur:"blur",pakia:"load",kupakia:"load",sogeza:"scroll",kusogeza:"scroll"}};var Bi={action:"toggle",description:"Toggle a class or attribute on/off",category:"dom-class",primaryRole:"patient",roles:[{role:"patient",description:"The class or attribute to toggle",required:true,expectedTypes:["selector"],selectorKinds:["class","attribute"],svoPosition:1,sovPosition:2},{role:"destination",description:"The target element (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:2,sovPosition:1}],errorCodes:["MISSING_ARGUMENT","NO_VALID_CLASS_NAMES","INVALID_CSS_PROPERTY"],preconditions:[{condition:"Command has at least one argument",errorCode:"MISSING_ARGUMENT",message:"toggle command requires an argument"},{condition:"Class names are valid CSS identifiers",errorCode:"NO_VALID_CLASS_NAMES",message:"toggle command: no valid class names found"}],recoveryHints:{MISSING_ARGUMENT:"Add a class selector (.classname) or attribute to toggle",NO_VALID_CLASS_NAMES:"Ensure class names start with a dot (.) and are valid CSS identifiers",INVALID_CSS_PROPERTY:"Check CSS property name syntax (use kebab-case)"}},qi={action:"add",description:"Add a class or attribute to an element",category:"dom-class",primaryRole:"patient",roles:[{role:"patient",description:"The class or attribute to add",required:true,expectedTypes:["selector"],svoPosition:1,sovPosition:2},{role:"destination",description:"The target element (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:2,sovPosition:1,markerOverride:{en:"to"}}],errorCodes:["MISSING_ARGUMENT","NO_VALID_CLASS_NAMES","PROPERTY_REQUIRES_VALUE"],preconditions:[{condition:"Command has at least one argument",errorCode:"MISSING_ARGUMENT",message:"add command requires an argument"}],recoveryHints:{MISSING_ARGUMENT:"Add a class selector (.classname) or attribute to add",NO_VALID_CLASS_NAMES:"Ensure class names start with a dot (.) and are valid CSS identifiers",PROPERTY_REQUIRES_VALUE:"When adding a property (*prop), provide a value argument"}},ji={action:"remove",description:"Remove a class or attribute from an element",category:"dom-class",primaryRole:"patient",roles:[{role:"patient",description:"The class or attribute to remove",required:true,expectedTypes:["selector"],svoPosition:1,sovPosition:2},{role:"source",description:"The element to remove from (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:2,sovPosition:1}],errorCodes:["MISSING_ARGUMENT","NO_VALID_CLASS_NAMES"],preconditions:[{condition:"Command has at least one argument",errorCode:"MISSING_ARGUMENT",message:"remove command requires an argument"}],recoveryHints:{MISSING_ARGUMENT:"Add a class selector (.classname) or attribute to remove",NO_VALID_CLASS_NAMES:"Ensure class names start with a dot (.) and are valid CSS identifiers"}},Fi={action:"put",description:"Put content into a target element or variable",category:"dom-content",primaryRole:"patient",roles:[{role:"patient",description:"The content to put",required:true,expectedTypes:["literal","selector","reference","expression"],svoPosition:1,sovPosition:1},{role:"destination",description:"Where to put the content",required:true,expectedTypes:["selector","reference"],svoPosition:2,sovPosition:2,markerOverride:{en:"into"}}],errorCodes:["MISSING_ARGUMENTS","MISSING_CONTENT","MISSING_POSITION","INVALID_POSITION","NO_TARGET","NO_ELEMENTS"],preconditions:[{condition:"Command has content and position arguments",errorCode:"MISSING_ARGUMENTS",message:"put requires arguments"},{condition:"Content to put is specified",errorCode:"MISSING_CONTENT",message:"put requires content"},{condition:"Position keyword is specified (into, before, after, etc.)",errorCode:"MISSING_POSITION",message:"put requires position keyword"}],recoveryHints:{MISSING_ARGUMENTS:"Use syntax: put <content> into/before/after <target>",MISSING_CONTENT:"Add content to put (string, element, or expression)",MISSING_POSITION:"Add position keyword: into, before, after, at start of, at end of",INVALID_POSITION:"Valid positions: into, before, after, at start of, at end of",NO_TARGET:'Ensure target element exists or use "me" reference',NO_ELEMENTS:"Check that the selector matches existing elements"}},Gi={action:"set",description:"Set a property or variable to a value",category:"variable",primaryRole:"destination",roles:[{role:"destination",description:"The property or variable to set",required:true,expectedTypes:["selector","reference","expression"],svoPosition:1,sovPosition:1,markerOverride:{en:"",ja:"\u3092",ko:"\uB97C",tr:"i",ar:"",sw:"",tl:"",bn:"\u0995\u09C7",qu:"ta"}},{role:"patient",description:"The value to set",required:true,expectedTypes:["literal","expression","reference"],svoPosition:2,sovPosition:2,markerOverride:{en:"to",es:"a",pt:"para",fr:"\xE0",de:"auf",id:"ke",ja:"\u306B",ko:"\uC73C\uB85C",tr:"e",ar:"\u0625\u0644\u0649",sw:"kwenye",tl:"sa",bn:"\u09A4\u09C7",qu:"man"}}],errorCodes:["MISSING_TARGET","INVALID_TARGET","MISSING_VALUE","INVALID_SYNTAX"],preconditions:[{condition:"Command has a target variable or property",errorCode:"MISSING_TARGET",message:"set command requires a target"},{condition:"Target is a valid variable or property reference",errorCode:"INVALID_TARGET",message:"set command target must be a string or object literal"},{condition:'Value is specified with "to" keyword',errorCode:"MISSING_VALUE",message:'set command requires a value (use "to" keyword)'}],recoveryHints:{MISSING_TARGET:"Add a target: set :variable to value OR set element.property to value",INVALID_TARGET:'Use local variable (:name), element property (el.prop), or "the X of Y" syntax',MISSING_VALUE:'Add "to <value>" to specify what to set',INVALID_SYNTAX:"Use syntax: set <target> to <value>"}},Ui={action:"show",description:"Make an element visible",category:"dom-visibility",primaryRole:"patient",roles:[{role:"patient",description:"The element to show",required:true,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:1,sovPosition:1},{role:"style",description:"Animation style (fade, slide, etc.)",required:false,expectedTypes:["literal"],svoPosition:2,sovPosition:2}]},Ki={action:"hide",description:"Make an element invisible",category:"dom-visibility",primaryRole:"patient",roles:[{role:"patient",description:"The element to hide",required:true,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:1,sovPosition:1},{role:"style",description:"Animation style (fade, slide, etc.)",required:false,expectedTypes:["literal"],svoPosition:2,sovPosition:2}]},Hi={action:"on",description:"Handle an event",category:"event",primaryRole:"event",hasBody:true,roles:[{role:"event",description:"The event to handle",required:true,expectedTypes:["literal"],svoPosition:1,sovPosition:2},{role:"source",description:"The element to listen on (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:2,sovPosition:1}]},Yi={action:"trigger",description:"Trigger/dispatch an event",category:"event",primaryRole:"event",roles:[{role:"event",description:"The event to trigger (supports namespaced events like draggable:start)",required:true,expectedTypes:["literal","expression"],svoPosition:1,sovPosition:2},{role:"destination",description:"The target element (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:2,sovPosition:1}]},Xi={action:"wait",description:"Wait for a duration or event",category:"async",primaryRole:"patient",roles:[{role:"patient",description:"Duration or event to wait for",required:true,expectedTypes:["literal","expression"],svoPosition:1,sovPosition:1}]},Zi={action:"fetch",description:"Fetch data from a URL",category:"async",primaryRole:"source",roles:[{role:"source",description:"The URL to fetch from",required:true,expectedTypes:["literal","expression"],svoPosition:1,sovPosition:1,renderOverride:{en:""}},{role:"responseType",description:"Response format (json, text, html, blob, etc.)",required:false,expectedTypes:["literal","expression"],svoPosition:2,sovPosition:2},{role:"method",description:"HTTP method (GET, POST, etc.)",required:false,expectedTypes:["literal"],svoPosition:3,sovPosition:3},{role:"destination",description:"Where to store the result",required:false,expectedTypes:["selector","reference"],svoPosition:4,sovPosition:4}]},Qi={action:"increment",description:"Increment a numeric value",category:"variable",primaryRole:"patient",roles:[{role:"patient",description:"The value to increment",required:true,expectedTypes:["selector","reference","expression"],svoPosition:1,sovPosition:1},{role:"quantity",description:"Amount to increment by (defaults to 1)",required:false,expectedTypes:["literal"],default:{type:"literal",value:1,dataType:"number"},svoPosition:2,sovPosition:2,markerOverride:{en:"by"}}]},Ji={action:"decrement",description:"Decrement a numeric value",category:"variable",primaryRole:"patient",roles:[{role:"patient",description:"The value to decrement",required:true,expectedTypes:["selector","reference","expression"],svoPosition:1,sovPosition:1},{role:"quantity",description:"Amount to decrement by (defaults to 1)",required:false,expectedTypes:["literal"],default:{type:"literal",value:1,dataType:"number"},svoPosition:2,sovPosition:2,markerOverride:{en:"by"}}]},eo={action:"append",description:"Append content to an element",category:"dom-content",primaryRole:"patient",roles:[{role:"patient",description:"The content to append",required:true,expectedTypes:["literal","selector","expression"],svoPosition:1,sovPosition:2},{role:"destination",description:"The element to append to",required:true,expectedTypes:["selector","reference"],svoPosition:2,sovPosition:1,markerOverride:{en:"to"}}]},to={action:"prepend",description:"Prepend content to an element",category:"dom-content",primaryRole:"patient",roles:[{role:"patient",description:"The content to prepend",required:true,expectedTypes:["literal","selector","expression"],svoPosition:1,sovPosition:2},{role:"destination",description:"The element to prepend to",required:true,expectedTypes:["selector","reference"],svoPosition:2,sovPosition:1,markerOverride:{en:"to"}}]},ro={action:"log",description:"Log a value to the console",category:"variable",primaryRole:"patient",roles:[{role:"patient",description:"The value to log",required:true,expectedTypes:["literal","selector","reference","expression"],svoPosition:1,sovPosition:1}]},no={action:"get",description:"Get a value from a source",category:"variable",primaryRole:"source",roles:[{role:"source",description:"The source to get from",required:true,expectedTypes:["selector","reference","expression"],svoPosition:1,sovPosition:2,markerOverride:{en:"",es:"",pt:"",fr:"",de:"",ja:"\u3092",zh:"",ko:"\uB97C",ar:"\u0639\u0644\u0649",tr:"i",id:"",sw:"",tl:"",bn:"\u0995\u09C7",qu:"ta"}},{role:"destination",description:"Where to store the result (optional)",required:false,expectedTypes:["reference"],svoPosition:2,sovPosition:1}]},io={action:"take",description:"Take content from a source element",category:"dom-content",primaryRole:"patient",roles:[{role:"patient",description:"The class or element to take",required:true,expectedTypes:["selector"],svoPosition:1,sovPosition:2},{role:"source",description:"The element to take from (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:2,sovPosition:1}]},oo={action:"make",description:"Create a new element",category:"dom-content",primaryRole:"patient",roles:[{role:"patient",description:"The element type or selector to create",required:true,expectedTypes:["literal","selector"],svoPosition:1,sovPosition:1}]},so={action:"halt",description:"Halt/stop execution or event propagation",category:"control-flow",primaryRole:"patient",roles:[{role:"patient",description:"What to halt (event, default, bubbling, etc.)",required:false,expectedTypes:["literal","reference","expression"],svoPosition:1,sovPosition:1}]},ao={action:"settle",description:"Wait for animations/transitions to settle",category:"async",primaryRole:"patient",roles:[{role:"patient",description:"The element to settle (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:1,sovPosition:1}]},co={action:"throw",description:"Throw an error",category:"control-flow",primaryRole:"patient",roles:[{role:"patient",description:"The error message or object to throw",required:true,expectedTypes:["literal","expression"],svoPosition:1,sovPosition:1}]},lo={action:"send",description:"Send an event to an element",category:"event",primaryRole:"event",roles:[{role:"event",description:"The event to send",required:true,expectedTypes:["literal","expression"],svoPosition:1,sovPosition:2},{role:"destination",description:"The target element (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:2,sovPosition:1,markerOverride:{en:"to",ja:"\u306B",ar:"\u0625\u0644\u0649",es:"a",ko:"\uC5D0\uAC8C",zh:"\u5230",tr:"-e",pt:"para",fr:"\xE0",de:"an",id:"ke",qu:"-man",sw:"kwa"}}]},uo={action:"if",description:"Conditional execution",category:"control-flow",primaryRole:"condition",hasBody:true,roles:[{role:"condition",description:"The condition to evaluate",required:true,expectedTypes:["expression"],svoPosition:1,sovPosition:1}]},po={action:"unless",description:"Negated conditional execution (executes when condition is false)",category:"control-flow",primaryRole:"condition",hasBody:true,roles:[{role:"condition",description:"The condition to evaluate (body executes when false)",required:true,expectedTypes:["expression"],svoPosition:1,sovPosition:1}]},mo={action:"else",description:"Else branch of conditional",category:"control-flow",primaryRole:"patient",hasBody:true,roles:[]},fo={action:"repeat",description:"Repeat a block of commands",category:"control-flow",primaryRole:"loopType",hasBody:true,roles:[{role:"loopType",description:"Loop variant: forever, times, for, while, until, until-event",required:true,expectedTypes:["literal"],svoPosition:0,sovPosition:0},{role:"quantity",description:"Number of times to repeat",required:false,expectedTypes:["literal","expression"],svoPosition:1,sovPosition:1},{role:"event",description:"Event to wait for (terminates loop)",required:false,expectedTypes:["literal","expression"],svoPosition:2,sovPosition:2},{role:"source",description:"Element to listen for event on",required:false,expectedTypes:["selector","reference"],svoPosition:3,sovPosition:3}],notes:'Can also use "repeat forever", "repeat until condition", or "repeat until event X from Y"'},ho={action:"for",description:"Iterate over a collection",category:"control-flow",primaryRole:"patient",hasBody:true,roles:[{role:"patient",description:"The iteration variable",required:true,expectedTypes:["reference"],svoPosition:1,sovPosition:2},{role:"source",description:"The collection to iterate over",required:true,expectedTypes:["selector","reference","expression"],svoPosition:2,sovPosition:1,markerOverride:{en:"in"}}]},yo={action:"while",description:"Loop while condition is true",category:"control-flow",primaryRole:"condition",hasBody:true,roles:[{role:"condition",description:"The condition to check",required:true,expectedTypes:["expression"],svoPosition:1,sovPosition:1}]},vo={action:"continue",description:"Continue to next loop iteration",category:"control-flow",primaryRole:"patient",roles:[]},go={action:"go",description:"Navigate to a URL",category:"navigation",primaryRole:"destination",roles:[{role:"destination",description:"The URL to navigate to",required:true,expectedTypes:["literal","expression"],svoPosition:1,sovPosition:1,markerOverride:{en:"to"},renderOverride:{en:""}}]},bo={action:"transition",description:"Transition an element with animation",category:"dom-visibility",primaryRole:"patient",roles:[{role:"patient",description:"The property to transition (opacity, *background-color, etc.)",required:true,expectedTypes:["literal"],svoPosition:1,sovPosition:2,markerOverride:{en:"",ar:"",tl:"",sw:""}},{role:"goal",description:"The target value to transition to",required:true,expectedTypes:["literal","expression"],svoPosition:2,sovPosition:3,markerOverride:{en:"to",ar:"\u0625\u0644\u0649",tl:"sa",sw:"kwenye",bn:"\u09A4\u09C7",qu:"man",es:"a",pt:"para",fr:"\xE0",de:"auf",ja:"\u306B",ko:"\uC73C\uB85C",tr:"e",id:"ke"}},{role:"destination",description:"The target element (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:3,sovPosition:1},{role:"duration",description:"Transition duration (over 500ms, for 2 seconds)",required:false,expectedTypes:["literal"],svoPosition:4,sovPosition:4,markerOverride:{en:"over"}},{role:"style",description:"Easing function (ease-in, linear, etc.)",required:false,expectedTypes:["literal"],svoPosition:5,sovPosition:5}]},Eo={action:"clone",description:"Clone an element",category:"dom-content",primaryRole:"patient",roles:[{role:"patient",description:"The element to clone",required:true,expectedTypes:["selector","reference"],svoPosition:1,sovPosition:2},{role:"destination",description:"Where to put the clone",required:false,expectedTypes:["selector","reference"],svoPosition:2,sovPosition:1,markerOverride:{en:"into"}}]},wo={action:"focus",description:"Focus an element",category:"dom-content",primaryRole:"patient",roles:[{role:"patient",description:"The element to focus (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:1,sovPosition:1}]},xo={action:"blur",description:"Remove focus from an element",category:"dom-content",primaryRole:"patient",roles:[{role:"patient",description:"The element to blur (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:1,sovPosition:1}]},So={action:"call",description:"Call a function",category:"control-flow",primaryRole:"patient",roles:[{role:"patient",description:"The function to call",required:true,expectedTypes:["expression","reference"],svoPosition:1,sovPosition:1}]},ko={action:"return",description:"Return a value from a function",category:"control-flow",primaryRole:"patient",roles:[{role:"patient",description:"The value to return",required:false,expectedTypes:["literal","expression","reference"],svoPosition:1,sovPosition:1}]},To={action:"js",description:"Execute raw JavaScript code",category:"control-flow",primaryRole:"patient",hasBody:true,roles:[{role:"patient",description:"The JavaScript code to execute",required:false,expectedTypes:["expression"],svoPosition:1,sovPosition:1}]},Co={action:"async",description:"Execute commands asynchronously",category:"async",primaryRole:"patient",hasBody:true,roles:[]},Ao={action:"tell",description:"Execute commands in context of another element",category:"control-flow",primaryRole:"destination",hasBody:true,roles:[{role:"destination",description:"The element to tell",required:true,expectedTypes:["selector","reference"],svoPosition:1,sovPosition:1,markerOverride:{en:""}}]},zo={action:"default",description:"Set a default value for a variable",category:"variable",primaryRole:"destination",roles:[{role:"destination",description:"The variable to set default for",required:true,expectedTypes:["reference"],svoPosition:1,sovPosition:1,markerOverride:{en:"",ar:"",tl:"",sw:"",bn:"\u0995\u09C7",qu:"ta"}},{role:"patient",description:"The default value",required:true,expectedTypes:["literal","expression"],svoPosition:2,sovPosition:2,markerOverride:{en:"to",ar:"\u0625\u0644\u0649",tl:"sa",sw:"kwenye",bn:"\u09A4\u09C7",qu:"man"}}]},Ro={action:"init",description:"Initialization block that runs once",category:"control-flow",primaryRole:"patient",hasBody:true,roles:[]},No={action:"behavior",description:"Define a reusable behavior",category:"control-flow",primaryRole:"patient",hasBody:true,roles:[{role:"patient",description:"The behavior name (PascalCase identifier)",required:true,expectedTypes:["literal","reference","expression"],svoPosition:1,sovPosition:1}]},Po={action:"install",description:"Install a behavior on an element",category:"control-flow",primaryRole:"patient",roles:[{role:"patient",description:"The behavior name to install",required:true,expectedTypes:["literal","reference","expression"],svoPosition:1,sovPosition:2},{role:"destination",description:"Element to install on (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:2,sovPosition:1}]},Oo={action:"measure",description:"Measure element dimensions (x, y, width, height, etc.)",category:"dom-content",primaryRole:"patient",roles:[{role:"patient",description:"Property to measure (x, y, width, height, top, left, etc.)",required:false,expectedTypes:["literal","expression"],svoPosition:1,sovPosition:1},{role:"source",description:"Element to measure (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:2,sovPosition:2,markerOverride:{en:"of"}}]},_o={action:"swap",description:"Swap DOM content using various strategies (innerHTML, outerHTML, delete, etc.)",category:"dom-content",primaryRole:"destination",roles:[{role:"method",description:"The swap strategy (innerHTML, outerHTML, beforebegin, afterend, delete)",required:false,expectedTypes:["literal"],svoPosition:1,sovPosition:3,markerOverride:{en:""}},{role:"destination",description:"The element to swap content in/for",required:true,expectedTypes:["selector","reference"],svoPosition:2,sovPosition:1,markerOverride:{en:"of"}},{role:"patient",description:"The content to swap in (optional for delete)",required:false,expectedTypes:["literal","expression","selector"],svoPosition:3,sovPosition:2,markerOverride:{en:"with"}}]},Io={action:"morph",description:"Morph an element into another using DOM diffing",category:"dom-content",primaryRole:"destination",roles:[{role:"destination",description:"The element to morph",required:true,expectedTypes:["selector","reference"],svoPosition:1,sovPosition:1,markerOverride:{en:""}},{role:"patient",description:"The target content/element to morph into",required:true,expectedTypes:["literal","expression","selector"],svoPosition:2,sovPosition:2,markerOverride:{en:"to"}}]},Lo={action:"beep",description:"Debug output for expressions with type information",category:"variable",primaryRole:"patient",roles:[{role:"patient",description:"The expression(s) to debug",required:false,expectedTypes:["literal","selector","reference","expression"],svoPosition:1,sovPosition:1}]},Mo={action:"break",description:"Exit from the current loop",category:"control-flow",primaryRole:"patient",roles:[]},Do={action:"copy",description:"Copy text or element content to the clipboard",category:"dom-content",primaryRole:"patient",roles:[{role:"patient",description:"The text or element to copy",required:true,expectedTypes:["literal","selector","reference","expression"],svoPosition:1,sovPosition:1}]},$o={action:"exit",description:"Exit from the current event handler",category:"control-flow",primaryRole:"patient",roles:[]},Vo={action:"pick",description:"Select a random element from a collection",category:"variable",primaryRole:"patient",roles:[{role:"patient",description:"The items to pick from",required:true,expectedTypes:["literal","expression","reference"],svoPosition:1,sovPosition:1},{role:"source",description:'The array to pick from (with "from" keyword)',required:false,expectedTypes:["reference","expression"],svoPosition:2,sovPosition:2}]},Wo={action:"render",description:"Render a template with optional variables",category:"dom-content",primaryRole:"patient",roles:[{role:"patient",description:"The template to render",required:true,expectedTypes:["selector","reference","expression"],svoPosition:1,sovPosition:2},{role:"style",description:"Variables to pass to the template (with keyword)",required:false,expectedTypes:["expression","reference"],svoPosition:2,sovPosition:1}]},Et={toggle:Bi,add:qi,remove:ji,put:Fi,set:Gi,show:Ui,hide:Ki,on:Hi,trigger:Yi,wait:Xi,fetch:Zi,increment:Qi,decrement:Ji,append:eo,prepend:to,log:ro,get:no,take:io,make:oo,halt:so,settle:ao,throw:co,send:lo,if:uo,unless:po,else:mo,repeat:fo,for:ho,while:yo,continue:vo,go,transition:bo,clone:Eo,focus:wo,blur:xo,call:So,return:ko,js:To,async:Co,tell:Ao,default:zo,init:Ro,behavior:No,install:Po,measure:Oo,swap:_o,morph:Io,beep:Lo,break:Mo,copy:Do,exit:$o,pick:Vo,render:Wo,compound:{action:"compound",description:"A compound node representing chained statements",primaryRole:"patient",category:"control-flow",hasBody:true,roles:[]}};function Bo(){return Object.values(Et).filter(r=>r.roles.length>0)}typeof process<"u"&&process.env.NODE_ENV!=="production"&&Promise.resolve().then(()=>(ki(),dt)).then(({validateAllSchemas:r,formatValidationResults:e})=>{let t=r(Et);t.size>0&&(console.warn("[SCHEMA VALIDATION] Found issues in command schemas:"),console.warn(e(t)),console.warn(`
|
|
3
|
+
These warnings help identify potential schema design issues.`),console.warn("Fix them to improve type inference and avoid runtime bugs."));}).catch(r=>{console.debug("Schema validation skipped:",r);});var ot=class extends Error{constructor(r,e,t,n){super(r),this.name="SemanticParseError",this.language=e,this.input=t,this.diagnostics=n;}};function N(r,e,t){return {message:r,severity:e,source:"semantic-parser",...t&&{code:t}}}function de(r,e){return e.length===0?r:{...r,diagnostics:e}}var Z=class O{parse(e,t){let{modifiers:n,remainingInput:i}=this.extractStandaloneModifiers(e,t),o=i||e,s=[],a=we(o,t),c=U(t);if(c.length===0)throw new ot(`No patterns available for language: ${t}`,t,o,[N(`No patterns registered for language '${t}'`,"error","no-patterns")]);let l=[...c].sort((y,g)=>g.priority-y.priority),u=l.filter(y=>y.command==="on"),d=G.matchBest(a,u);if(d){s.push(N(`event pattern matched: ${d.pattern.id} (confidence: ${d.confidence.toFixed(2)})`,"info","pattern-match"));let y=this.buildEventHandler(d,a,t),g=n?this.applyModifiers(y,n):y;return de(g,s)}s.push(N(`event patterns: ${u.length} tried, no match`,"info","stage-event"));let p=l.filter(y=>y.command!=="on"),m=G.matchBest(a,p);if(m)return s.push(N(`command pattern matched: ${m.pattern.id} (confidence: ${m.confidence.toFixed(2)})`,"info","pattern-match")),de(this.buildCommand(m,t),s);s.push(N(`command patterns: ${p.length} tried, no match`,"info","stage-command"));let f=this.trySOVEventExtraction(o,t,l);if(f){s.push(N("SOV event extraction succeeded","info","stage-sov"));let y=n?this.applyModifiers(f,n):f;return de(y,s)}s.push(N("SOV event extraction: no event keyword found","info","stage-sov"));let v=this.tryCompoundCommandParsing(a,p,t);if(v)return s.push(N("compound command parsing succeeded","info","stage-compound")),de(v,s);throw s.push(N("compound parsing: no then-keywords or no command matches","info","stage-compound")),s.push(N(`all parse stages exhausted for "${o}"`,"error","parse-failed")),new ot(`Could not parse input in ${t}: ${o}`,t,o,s)}canParse(e,t){try{return this.parse(e,t),!0}catch{return false}}supportedLanguages(){return bt()}buildCommand(e,t){if(!e)throw new Error("No match to build command from");let n={};for(let[i,o]of e.captured)n[i]=o;return le(e.pattern.command,n,{sourceLanguage:t,patternId:e.pattern.id,confidence:e.confidence})}buildEventHandler(e,t,n){if(!e)throw new Error("No match to build event handler from");let i=e.captured.get("event");if(!i)throw new Error("Event handler pattern matched but no event captured");let o=G.extractEventModifiers(t),s=this.extractOrConjunctionEvents(t,n),a=i;s.length>0&&i.type==="literal"&&(a={type:"literal",value:[String(i.value),...s.map(d=>String("value"in d?d.value:""))].join(" or ")});let c,l=e.captured.get("action");if(l&&l.type==="literal"){let u=l.value,d={};for(let[f,v]of e.captured)f!=="event"&&f!=="action"&&f!=="continues"&&(d[f]=v);let p=le(u,d,{sourceLanguage:n,patternId:e.pattern.id,confidence:e.confidence}),m=e.captured.get("continues");if(m&&m.type==="literal"&&m.value==="then"){let f=U(n).filter(g=>g.command!=="on").sort((g,E)=>E.priority-g.priority),v=U(n).filter(g=>g.id.startsWith("grammar-")&&g.id.includes("-continuation")).sort((g,E)=>E.priority-g.priority),y=this.parseBodyWithGrammarPatterns(t,f,v,n);y.length>0?c=[p,...y]:c=[p];}else c=[p];}else {let u=U(n).filter(d=>d.command!=="on").sort((d,p)=>p.priority-d.priority);c=this.parseBodyWithClauses(t,u,n);}return Qe(a,c,o,{sourceLanguage:n,patternId:e.pattern.id,confidence:e.confidence})}parseBodyWithClauses(e,t,n){let i=[],o=[];for(;!e.isAtEnd();){let s=e.peek();if(!s)break;let a=s.kind==="conjunction"||s.kind==="keyword"&&this.isThenKeyword(s.value,n),c=s.kind==="keyword"&&this.isEndKeyword(s.value,n);if(a){if(o.length>0){let l=this.parseClause(o,t,n);i.push(...l),o.length=0;}e.advance();continue}if(c){if(o.length>0){let l=this.parseClause(o,t,n);i.push(...l);}e.advance();break}o.push(s),e.advance();}if(o.length>0){let s=this.parseClause(o,t,n);i.push(...s);}return i.length>1?[Je(i,"then",{sourceLanguage:n})]:i}parseClause(e,t,n){if(e.length===0)return [];let i=new ee(e,n),o=[];for(;!i.isAtEnd();){let s=G.matchBest(i,t);s?o.push(this.buildCommand(s,n)):i.advance();}if(o.length===0){let s=this.parseSOVClauseByVerbAnchoring(e,n);if(s.length>0)return s}return o}static buildVerbLookup(e){let t=new Map;for(let[n,i]of Object.entries(e.keywords))if(!["on","if","else","when","where","while","for","end","then","and"].includes(n)&&(t.set(i.primary.toLowerCase(),n),i.alternatives))for(let o of i.alternatives)t.set(o.toLowerCase(),n);return t}static buildMarkerToRoleLookup(e){let t=new Map;for(let[n,i]of Object.entries(e.roleMarkers))if(i&&(t.set(i.primary,n),i.alternatives))for(let o of i.alternatives)t.has(o)||t.set(o,n);return t}parseSOVClauseByVerbAnchoring(e,t){let n=B(t);if(!n||n.wordOrder!=="SOV")return [];let i=O.buildVerbLookup(n),o=O.buildMarkerToRoleLookup(n),s=[],a=0;for(;a<e.length;){let c=-1,l="";for(let f=a;f<e.length;f++){let v=e[f],y=i.get(v.value.toLowerCase()),g=v.normalized?i.get(v.normalized.toLowerCase()):void 0,E=y||g;if(E){c=f,l=E;break}}if(c===-1)break;let u=e.slice(a,c),d=e.length;for(let f=c+1;f<e.length;f++){let v=e[f];if(v.kind==="conjunction"||this.isThenKeyword(v.value,t)){d=f;break}if(f>c+1&&(i.get(v.value.toLowerCase())||(v.normalized?i.get(v.normalized.toLowerCase()):void 0))){d=f;break}}let p=e.slice(c+1,d),m=this.extractRolesFromMarkedTokens(u,p,o,l,t);if(s.push(le(l,m,{sourceLanguage:t,confidence:.7})),a=d,a<e.length){let f=e[a];(f.kind==="conjunction"||this.isThenKeyword(f.value,t))&&a++;}}return s}extractRolesFromMarkedTokens(e,t,n,i,o){let s={},a=c=>{let l=[];for(let u of c){let d=n.get(u.value);if(d&&u.kind==="particle"&&l.length>0){let p=this.tokensToSemanticValue(l);if(p){let m=this.mapRoleForCommand(d,i,s);m&&(s[m]=p);}l=[];}else l.push(u);}if(l.length>0){let u=this.tokensToSemanticValue(l);u&&(s.patient?s.destination||(s.destination=u):s.patient=u);}};return a(e),a(t),s}mapRoleForCommand(e,t,n){return n[e]?e==="patient"&&!n.destination?"destination":e==="destination"&&!n.patient?"patient":e==="source"&&!n.source?"source":null:e}tokensToSemanticValue(e){if(e.length===0)return null;let t=e.filter(o=>o.kind!=="whitespace");if(t.length===0)return null;if(t.length===1)return this.tokenToSemanticValue(t[0]);let n=t.map(o=>o.value).join(""),i=t[0];return i.kind==="selector"||i.value.startsWith("#")||i.value.startsWith(".")||i.value.startsWith("@")||i.value.startsWith("*")?re(n):i.kind==="literal"||i.value.startsWith('"')||i.value.startsWith("'")?k(n):i.kind==="reference"?W(n):k(n)}tokenToSemanticValue(e){let t=e.value;if(e.kind==="selector"||t.startsWith("#")||t.startsWith(".")||t.startsWith("@")||t.startsWith("*"))return re(t);if(t.startsWith('"')||t.startsWith("'"))return k(t);if(/^-?\d+(\.\d+)?$/.test(t))return k(parseFloat(t));if(t==="true"||t==="\u771F"||t==="\uCC38"||t==="do\u011Fru")return k(true);if(t==="false"||t==="\u507D"||t==="\uAC70\uC9D3"||t==="yanl\u0131\u015F")return k(false);let n=e.normalized?.toLowerCase();return n==="me"||n==="it"||n==="you"||n==="result"||n==="body"?W(n):e.kind==="reference"?W(e.normalized||"me"):k(t)}parseBodyWithGrammarPatterns(e,t,n,i){let o=[];for(;!e.isAtEnd();){let s=e.peek();if(s&&this.isThenKeyword(s.value,i)){e.advance();continue}if(s&&this.isEndKeyword(s.value,i)){e.advance();break}let a=false;if(n.length>0){let c=G.matchBest(e,n);if(c){let l=c.pattern.command,u={};for(let[m,f]of c.captured)m!=="event"&&m!=="action"&&m!=="continues"&&(u[m]=f);let d=le(l,u,{sourceLanguage:i,patternId:c.pattern.id});o.push(d),a=true;let p=c.captured.get("continues");if(p&&p.type==="literal"&&p.value==="then")continue}}if(!a){let c=G.matchBest(e,t);c&&(o.push(this.buildCommand(c,i)),a=true);}a||e.advance();}return o}tryCompoundCommandParsing(e,t,n){let i=e.tokens;if(!i.some(c=>c.kind==="conjunction"||c.kind==="keyword"&&this.isThenKeyword(c.value,n)))return null;let s=new ee(i,n),a=this.parseBodyWithClauses(s,t,n);return a.length===0?null:a.length===1?a[0]:Je(a,"then",{sourceLanguage:n,confidence:.65})}trySOVEventExtraction(e,t,n){let i=O.SOV_EVENT_MARKERS[t];if(!i)return null;let s=we(e,t).tokens,a=Vi[t],c=new Set;if(a)for(let b of Object.keys(a))c.add(b.toLowerCase());let l=O.SOV_SOURCE_MARKERS[t],u=-1,d="",p="",m=1;for(let b=0;b<s.length;b++){let T=s[b],_=T.value.toLowerCase(),I=_,q="",fe=_.indexOf("[");fe>0&&(I=_.slice(0,fe),q=T.value.slice(fe));let he=T.normalized?.toLowerCase(),Oe=he&&O.KNOWN_EVENTS.has(he),_e=c.has(_)||c.has(I),_t=O.KNOWN_EVENTS.has(I);if(Oe||_e||_t){let Q;if(Oe?Q=he:_e?Q=a?.[_]??a?.[I]??I:Q=I,i.size>0){let se=1,ye=s[b+1];ye&&ye.kind==="selector"&&ye.value.startsWith("[")&&(se=2);let ae=s[b+se];if(ae&&(ae.kind==="particle"||ae.kind==="keyword")&&i.has(ae.value)){u=b,d=Q,p=q||(se===2?s[b+1].value:""),m=se+1;break}}else {u=b,d=Q,p=q,m=1;break}}}if(u===-1)return null;let f=new Set;for(let b=u;b<u+m;b++)f.add(b);if(l){let b=u+m;if(b<s.length){let T=s[b];(T.kind==="particle"||T.kind==="keyword")&&l.markers.has(T.value)&&f.add(b);}for(let T=0;T<u;T++){let _=s[T],I=_.value.toLowerCase(),q=_.normalized?.toLowerCase();if(l.windowTokens.has(I)||q&&l.windowTokens.has(q)){f.add(T);break}}}let v=s.filter((b,T)=>!f.has(T));if(v.length===0)return null;let y=n.filter(b=>b.command!=="on"),g=new ee(v,t),E=this.parseBodyWithClauses(g,y,t);if(E.length===0)return null;let Pe={sourceLanguage:t,confidence:.75};return p&&(Pe.keyFilter=p),Qe({type:"literal",value:d},E,void 0,Pe)}isThenKeyword(e,t){let n={en:new Set(["then"]),ja:new Set(["\u305D\u308C\u304B\u3089","\u6B21\u306B","\u305D\u3057\u3066"]),ar:new Set(["\u062B\u0645","\u0628\u0639\u062F\u0647\u0627","\u062B\u0645\u0651"]),es:new Set(["entonces","luego","despu\xE9s"]),ko:new Set(["\uADF8\uB2E4\uC74C","\uADF8\uB9AC\uACE0","\uADF8\uB7F0\uD6C4","\uADF8\uB7EC\uBA74"]),zh:new Set(["\u7136\u540E","\u63A5\u7740","\u4E4B\u540E"]),tr:new Set(["sonra","ard\u0131ndan","daha sonra"]),pt:new Set(["ent\xE3o","depois","logo"]),fr:new Set(["puis","ensuite","alors"]),de:new Set(["dann","danach","anschlie\xDFend"]),id:new Set(["lalu","kemudian","setelah itu"]),tl:new Set(["pagkatapos","tapos"]),bn:new Set(["\u09A4\u09BE\u09B0\u09AA\u09B0","\u09AA\u09B0\u09C7"]),qu:new Set(["chaymantataq","hinaspa","chaymanta","chayqa"]),sw:new Set(["kisha","halafu","baadaye"])};return (n[t]||n.en).has(e.toLowerCase())}isEndKeyword(e,t){let n={en:new Set(["end"]),ja:new Set(["\u7D42\u308F\u308A","\u7D42\u4E86","\u304A\u308F\u308A"]),ar:new Set(["\u0646\u0647\u0627\u064A\u0629","\u0627\u0646\u062A\u0647\u0649","\u0622\u062E\u0631"]),es:new Set(["fin","final","terminar"]),ko:new Set(["\uB05D","\uC885\uB8CC","\uB9C8\uCE68"]),zh:new Set(["\u7ED3\u675F","\u7EC8\u6B62","\u5B8C"]),tr:new Set(["son","biti\u015F","bitti"]),pt:new Set(["fim","final","t\xE9rmino"]),fr:new Set(["fin","terminer","finir"]),de:new Set(["ende","beenden","fertig"]),id:new Set(["selesai","akhir","tamat"]),tl:new Set(["wakas","tapos"]),bn:new Set(["\u09B8\u09AE\u09BE\u09AA\u09CD\u09A4"]),qu:new Set(["tukukuy","tukuy","puchukay"]),sw:new Set(["mwisho","maliza","tamati"])};return (n[t]||n.en).has(e.toLowerCase())}extractStandaloneModifiers(e,t){let i=we(e,t).tokens;if(i.length===0)return {modifiers:null,remainingInput:null};let s=i[0].value.toLowerCase(),a=O.STANDALONE_MODIFIERS[s];if(!a)return {modifiers:null,remainingInput:null};let c={},l=1;if(a==="once")c.once=true;else {let m=1;if(m<i.length){let f=i[m];(f.kind==="keyword"||f.kind==="particle")&&(m++,l++);}if(m<i.length){let f=i[m];if(f.kind==="literal"){let v=f.value.match(/^(\d+)(ms|s|m)?$/);if(v){let y=parseInt(v[1],10),g=v[2]||"ms";g==="s"?y*=1e3:g==="m"&&(y*=6e4),c[a]=y,l=m+1;}}}c[a]||(c[a]=a==="debounce"?300:100);}let u=i.slice(l);if(u.length===0)return {modifiers:null,remainingInput:null};let d=u[0].position.start,p=e.slice(d);return {modifiers:c,remainingInput:p}}applyModifiers(e,t){return {...e,eventModifiers:{...e.eventModifiers,...t}}}extractOrConjunctionEvents(e,t){let n=[];for(;;){let i=e.mark(),o=e.peek();if(!o)break;let s=(o.normalized||o.value).toLowerCase();if(!O.OR_KEYWORDS.has(s)){e.reset(i);break}e.advance();let a=e.peek();if(!a){e.reset(i);break}let c=(a.normalized||a.value).toLowerCase();e.advance(),n.push({type:"literal",value:c});}return n}};Z.KNOWN_EVENTS=new Set(["click","dblclick","input","change","submit","keydown","keyup","keypress","mouseover","mouseout","mousedown","mouseup","focus","blur","load","scroll","resize","contextmenu"]);Z.SOV_EVENT_MARKERS={ja:new Set(["\u3067"]),ko:new Set,tr:new Set(["de","da","te","ta"]),bn:new Set(["\u098F"]),qu:new Set(["pi"])};Z.SOV_SOURCE_MARKERS={ja:{markers:new Set(["\u304B\u3089"]),windowTokens:new Set(["\u30A6\u30A3\u30F3\u30C9\u30A6","\u30C9\u30AD\u30E5\u30E1\u30F3\u30C8","window","document"])},ko:{markers:new Set(["\uC5D0\uC11C"]),windowTokens:new Set(["\uCC3D","\uC708\uB3C4\uC6B0","\uBB38\uC11C","window","document"])},tr:{markers:new Set(["den","dan","ten","tan"]),windowTokens:new Set(["pencere","belge","window","document"])},bn:{markers:new Set(["\u09A5\u09C7\u0995\u09C7","\u09AE\u09A7\u09CD\u09AF\u09C7"]),windowTokens:new Set(["\u0989\u0987\u09A8\u09CD\u09A1\u09CB","\u09A1\u0995\u09C1\u09AE\u09C7\u09A8\u09CD\u099F","window","document"])},qu:{markers:new Set(["manta"]),windowTokens:new Set(["k_iri","ventana","window","document"])}};Z.STANDALONE_MODIFIERS={once:"once",debounced:"debounce",debounce:"debounce",throttled:"throttle",throttle:"throttle"};Z.OR_KEYWORDS=new Set(["or","\u0623\u0648","o","ou","oder","atau","atau","\u6216","\u307E\u305F\u306F","\uB610\uB294","veya","\u0985\u09A5\u09AC\u09BE","utaq","au","\u0430\u0431\u043E","\u0438\u043B\u0438","ho\u1EB7c","lub","\u05D0\u05D5","\u0E2B\u0E23\u0E37\u0E2D","o"]);var qo=Z,jo=new qo;function Ce(r,e){return jo.parse(r,e)}var ke=class{constructor(r={}){this.cache=new Map,this.config={maxSize:r.maxSize??1e3,ttlMs:r.ttlMs??0,enabled:r.enabled??true},this.stats={hits:0,misses:0,evictions:0,expirations:0};}makeKey(r,e){return `${e}:${r}`}isExpired(r){return this.config.ttlMs===0?false:Date.now()-r.createdAt>this.config.ttlMs}evictLRU(){let r=this.cache.keys().next().value;r!==void 0&&(this.cache.delete(r),this.stats.evictions++);}get(r,e){if(!this.config.enabled){this.stats.misses++;return}let t=this.makeKey(r,e),n=this.cache.get(t);if(!n){this.stats.misses++;return}if(this.isExpired(n)){this.cache.delete(t),this.stats.expirations++,this.stats.misses++;return}return this.cache.delete(t),n.lastAccessed=Date.now(),this.cache.set(t,n),this.stats.hits++,n.result}set(r,e,t){if(!this.config.enabled||t.confidence===0)return;let n=this.makeKey(r,e),i=Date.now();for(;this.cache.size>=this.config.maxSize;)this.evictLRU();this.cache.set(n,{result:t,createdAt:i,lastAccessed:i});}has(r,e){if(!this.config.enabled)return false;let t=this.makeKey(r,e),n=this.cache.get(t);return n?this.isExpired(n)?(this.cache.delete(t),this.stats.expirations++,false):true:false}delete(r,e){let t=this.makeKey(r,e);return this.cache.delete(t)}clear(){this.cache.clear();}resetStats(){this.stats={hits:0,misses:0,evictions:0,expirations:0};}getStats(){let r=this.stats.hits+this.stats.misses;return {hits:this.stats.hits,misses:this.stats.misses,size:this.cache.size,maxSize:this.config.maxSize,hitRate:r>0?this.stats.hits/r:0,evictions:this.stats.evictions,expirations:this.stats.expirations,enabled:this.config.enabled}}configure(r){if(r.maxSize!==void 0)for(this.config.maxSize=r.maxSize;this.cache.size>this.config.maxSize;)this.evictLRU();r.ttlMs!==void 0&&(this.config.ttlMs=r.ttlMs),r.enabled!==void 0&&(this.config.enabled=r.enabled);}enable(){this.config.enabled=true;}disable(){this.config.enabled=false;}getConfig(){return {...this.config}}},Fo=new ke;var Go=class{constructor(r={}){this.patternMatcher=new gt,this.languages=new Set(vt()),r.cache===false?this.cache=new ke({enabled:false}):this.cache=r.cache?new ke(r.cache):Fo;}analyze(r,e){if(!this.supportsLanguage(e))return {confidence:0,errors:[`Language '${e}' is not supported for semantic parsing`]};let t=this.cache.get(r,e);if(t)return t;let n=this.analyzeUncached(r,e);return this.cache.set(r,e,n),n}analyzeUncached(r,e){try{try{let s=Ce(r,e),a={confidence:s.metadata?.confidence??.8,node:s};return s.kind==="command"?{...a,command:{name:s.action,roles:s.roles}}:a}catch{}let t=$i(e);if(!t)return {confidence:0,errors:[`No tokenizer available for language '${e}'`]};let n=t.tokenize(r),i=U(e);if(i.length===0)return {confidence:0,errors:[`No patterns available for language '${e}'`]};let o=this.patternMatcher.matchBest(n,i);if(o){let s=this.buildSemanticNode(o);return {confidence:o.confidence,command:{name:o.pattern.command,roles:o.captured},node:s,tokensConsumed:o.consumedTokens}}return {confidence:0,errors:["No pattern matched the input"]}}catch(t){return {confidence:0,errors:[t instanceof Error?t.message:String(t)]}}}supportsLanguage(r){return this.languages.has(r)}supportedLanguages(){return Array.from(this.languages)}getCacheStats(){return this.cache.getStats()}clearCache(){this.cache.clear();}configureCache(r){this.cache.configure(r);}buildSemanticNode(r){return {kind:"command",action:r.pattern.command,roles:r.captured,metadata:{patternId:r.pattern.id}}}};function wt(r){return new Go(r)}var Uo=.5;function xt(r,e=Uo){return r.confidence>=e&&r.command!==void 0}function St(r,e){let t=e==="SOV"?"sovPosition":"svoPosition";return [...r].sort((n,i)=>{let o=n[t]??99,s=i[t]??99;return o-s})}function Ko(r,e){let t=r.markerOverride?.[e.code],n=e.roleMarkers[r.role];if(t!==void 0)return {primary:t,position:n?.position??"before",isOverride:true};if(n&&n.primary){let i={primary:n.primary,position:n.position,isOverride:false};return n.alternatives&&(i.alternatives=n.alternatives),i}return null}function Ho(r,e,t,n,i){let o=[];if(o.push({type:"role",role:"event",optional:false}),n.position==="after"){let l=n.primary.split(/\s+/);if(l.length>1)for(let u of l)o.push({type:"literal",value:u});else {let u=n.alternatives?{type:"literal",value:n.primary,alternatives:n.alternatives}:{type:"literal",value:n.primary};o.push(u);}}let s=e.roleMarkers.destination;s&&o.push({type:"group",optional:true,tokens:[{type:"role",role:"destination",optional:true},s.alternatives?{type:"literal",value:s.primary,alternatives:s.alternatives}:{type:"literal",value:s.primary}]}),o.push({type:"role",role:"patient",optional:false});let a=e.roleMarkers.patient;if(a){let l=a.alternatives?{type:"literal",value:a.primary,alternatives:a.alternatives}:{type:"literal",value:a.primary};o.push(l);}let c=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};return o.push(c),{id:`${r.action}-event-${e.code}-sov`,language:e.code,command:"on",priority:(i.basePriority??100)+50,template:{format:`{event} ${n.primary} {destination?} {patient} ${a?.primary||""} ${t.primary}`,tokens:o},extraction:{action:{value:r.action},event:{fromRole:"event"},patient:{fromRole:"patient"},destination:{fromRole:"destination",default:{type:"reference",value:"me"}}}}}function Yo(r,e,t,n,i){let o=[];o.push({type:"role",role:"patient",optional:false});let s=e.roleMarkers.patient;if(s){let c=s.alternatives?{type:"literal",value:s.primary,alternatives:s.alternatives}:{type:"literal",value:s.primary};o.push(c);}if(o.push({type:"role",role:"event",optional:false}),n.position==="after"){let c=n.primary.split(/\s+/);if(c.length>1)for(let l of c)o.push({type:"literal",value:l});else {let l=n.alternatives?{type:"literal",value:n.primary,alternatives:n.alternatives}:{type:"literal",value:n.primary};o.push(l);}}let a=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};return o.push(a),{id:`${r.action}-event-${e.code}-sov-patient-first`,language:e.code,command:"on",priority:(i.basePriority??100)+45,template:{format:`{patient} ${s?.primary||""} {event} ${n.primary} ${t.primary}`,tokens:o},extraction:{action:{value:r.action},event:{fromRole:"event"},patient:{fromRole:"patient"},destination:{fromRole:"destination",default:{type:"reference",value:"me"}}}}}function Xo(r,e,t,n,i){let o=[];o.push({type:"role",role:"patient",optional:false});let s=e.roleMarkers.patient;if(s){let l=s.alternatives?{type:"literal",value:s.primary,alternatives:s.alternatives}:{type:"literal",value:s.primary};o.push(l);}let a=e.roleMarkers.destination;if(a&&(o.push({type:"role",role:"destination",optional:false}),o.push(a.alternatives?{type:"literal",value:a.primary,alternatives:a.alternatives}:{type:"literal",value:a.primary})),o.push({type:"role",role:"event",optional:false}),n.position==="after"){let l=n.primary.split(/\s+/);if(l.length>1)for(let u of l)o.push({type:"literal",value:u});else {let u=n.alternatives?{type:"literal",value:n.primary,alternatives:n.alternatives}:{type:"literal",value:n.primary};o.push(u);}}let c=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};return o.push(c),{id:`${r.action}-event-${e.code}-sov-patient-first-dest`,language:e.code,command:"on",priority:(i.basePriority??100)+40,template:{format:`{patient} ${s?.primary||""} {destination} ${a?.primary||""} {event} ${n.primary} ${t.primary}`,tokens:o},extraction:{action:{value:r.action},event:{fromRole:"event"},patient:{fromRole:"patient"},destination:{fromRole:"destination"}}}}function Zo(r,e,t,n,i){let o=[];o.push({type:"role",role:"event",optional:false});let s=n.alternatives?.filter(u=>!u.includes(" ")&&u.length>1)||[];s.length>0&&o.push({type:"literal",value:s[0],alternatives:s.slice(1)});let a=e.roleMarkers.destination;a&&o.push({type:"group",optional:true,tokens:[{type:"role",role:"destination",optional:true},a.alternatives?{type:"literal",value:a.primary,alternatives:a.alternatives}:{type:"literal",value:a.primary}]}),o.push({type:"role",role:"patient",optional:false});let c=e.roleMarkers.patient;if(c){let u=c.alternatives?{type:"literal",value:c.primary,alternatives:c.alternatives}:{type:"literal",value:c.primary};o.push(u);}let l=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};return o.push(l),{id:`${r.action}-event-${e.code}-sov-compact`,language:e.code,command:"on",priority:(i.basePriority??100)+52,template:{format:`{event}${s[0]||""} {patient} ${t.primary}`,tokens:o},extraction:{action:{value:r.action},event:{fromRole:"event"},patient:{fromRole:"patient"},destination:{fromRole:"destination",default:{type:"reference",value:"me"}}}}}function Qo(r,e,t,n,i){let o=[];if(o.push({type:"role",role:"event",optional:false}),n.position==="after"){let a=n.primary.split(/\s+/);if(a.length>1)for(let c of a)o.push({type:"literal",value:c});else {let c=n.alternatives?{type:"literal",value:n.primary,alternatives:n.alternatives}:{type:"literal",value:n.primary};o.push(c);}}let s=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};return o.push(s),{id:`${r.action}-event-${e.code}-sov-simple`,language:e.code,command:"on",priority:(i.basePriority??100)+48,template:{format:`{event} ${n.primary} ${t.primary}`,tokens:o},extraction:{action:{value:r.action},event:{fromRole:"event"},patient:{default:{type:"reference",value:"me"}}}}}function Jo(r,e,t,n){let i=e.eventHandler?.temporalMarkers;if(!i||i.length===0)return null;let o=[];o.push({type:"role",role:"event",optional:false}),e.possessive?.marker&&o.push({type:"group",optional:true,tokens:[{type:"literal",value:e.possessive.marker}]}),o.push({type:"literal",value:i[0],alternatives:i.slice(1)}),o.push({type:"role",role:"patient",optional:false});let s=e.roleMarkers.patient;if(s?.primary){let c=s.alternatives?{type:"literal",value:s.primary,alternatives:s.alternatives}:{type:"literal",value:s.primary};o.push(c);}let a=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};return o.push(a),{id:`${r.action}-event-${e.code}-sov-temporal`,language:e.code,command:"on",priority:(n.basePriority??100)+49,template:{format:`{event} ${i[0]} {patient} ${t.primary}`,tokens:o},extraction:{action:{value:r.action},event:{fromRole:"event"},patient:{fromRole:"patient"}}}}function es(r,e,t,n,i){let o=[];if(o.push({type:"role",role:"event",optional:false}),n.position==="after"){let u=n.primary.split(/\s+/);if(u.length>1)for(let d of u)o.push({type:"literal",value:d});else {let d=n.alternatives?{type:"literal",value:n.primary,alternatives:n.alternatives}:{type:"literal",value:n.primary};o.push(d);}}let a=[...r.roles.filter(u=>u.required)].sort((u,d)=>{let p=u.sovPosition??999,m=d.sovPosition??999;return p-m});for(let u of a){o.push({type:"role",role:u.role,optional:false});let d,p;if(u.markerOverride&&u.markerOverride[e.code]!==void 0)d=u.markerOverride[e.code];else {let m=e.roleMarkers[u.role];m&&(d=m.primary,p=m.alternatives);}if(d){let m=p?{type:"literal",value:d,alternatives:p}:{type:"literal",value:d};o.push(m);}}let c=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};o.push(c);let l=a.map(u=>`{${u.role}}`).join(" ");return {id:`${r.action}-event-${e.code}-sov-2role`,language:e.code,command:"on",priority:(i.basePriority??100)+55,template:{format:`{event} ${n.primary} ${l} ${t.primary}`,tokens:o},extraction:{action:{value:r.action},event:{fromRole:"event"},...Object.fromEntries(a.map(u=>[u.role,{fromRole:u.role}]))}}}function ts(r,e,t,n,i){let o=[],a=[...r.roles.filter(f=>f.required)].sort((f,v)=>{let y=f.sovPosition??999,g=v.sovPosition??999;return y-g}),c=a[0];o.push({type:"role",role:c.role,optional:false});let l;if(c.markerOverride&&c.markerOverride[e.code]!==void 0)l=c.markerOverride[e.code];else {let f=e.roleMarkers[c.role];f&&(l=f.primary);}if(l&&o.push({type:"literal",value:l}),o.push({type:"role",role:"event",optional:false}),n.position==="after"){let f=n.primary.split(/\s+/);if(f.length>1)for(let v of f)o.push({type:"literal",value:v});else {let v=n.alternatives?{type:"literal",value:n.primary,alternatives:n.alternatives}:{type:"literal",value:n.primary};o.push(v);}}let u=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};o.push(u);let d=a[1];o.push({type:"role",role:d.role,optional:false});let p,m;if(d.markerOverride&&d.markerOverride[e.code]!==void 0)p=d.markerOverride[e.code];else {let f=e.roleMarkers[d.role];f&&(p=f.primary,m=f.alternatives);}if(p){let f=m?{type:"literal",value:p,alternatives:m}:{type:"literal",value:p};o.push(f);}return {id:`${r.action}-event-${e.code}-sov-2role-dest-first`,language:e.code,command:"on",priority:(i.basePriority??100)+48,template:{format:`{${c.role}} {event} ${n.primary} ${t.primary} {${d.role}}`,tokens:o},extraction:{action:{value:r.action},event:{fromRole:"event"},[c.role]:{fromRole:c.role},[d.role]:{fromRole:d.role}}}}function st(r,e,t,n,i){let o=[];if(n.position==="before"){let c=n.alternatives?{type:"literal",value:n.primary,alternatives:n.alternatives}:{type:"literal",value:n.primary};o.push(c);}o.push({type:"role",role:"event",optional:false});let s=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};o.push(s),o.push({type:"role",role:"patient",optional:false});let a=e.roleMarkers.destination;return a&&o.push({type:"group",optional:true,tokens:[a.alternatives?{type:"literal",value:a.primary,alternatives:a.alternatives}:{type:"literal",value:a.primary},{type:"role",role:"destination",optional:true}]}),{id:`${r.action}-event-${e.code}-vso`,language:e.code,command:"on",priority:(i.basePriority??100)+50,template:{format:`${n.primary} {event} ${t.primary} {patient} ${a?.primary||""} {destination?}`,tokens:o},extraction:{action:{value:r.action},event:{fromRole:"event"},patient:{fromRole:"patient"},destination:{fromRole:"destination",default:{type:"reference",value:"me"}}}}}function rs(r,e,t,n,i){let o=[],s=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};o.push(s),o.push({type:"role",role:"patient",optional:false});let a=e.roleMarkers.destination;if(a&&o.push({type:"group",optional:true,tokens:[a.alternatives?{type:"literal",value:a.primary,alternatives:a.alternatives}:{type:"literal",value:a.primary},{type:"role",role:"destination",optional:true}]}),n.position==="before"){let c=n.alternatives?{type:"literal",value:n.primary,alternatives:n.alternatives}:{type:"literal",value:n.primary};o.push(c);}return o.push({type:"role",role:"event",optional:false}),{id:`${r.action}-event-${e.code}-vso-verb-first`,language:e.code,command:"on",priority:(i.basePriority??100)+45,template:{format:`${t.primary} {patient} ${a?.primary||""} {destination?} ${n.primary} {event}`,tokens:o},extraction:{action:{value:r.action},event:{fromRole:"event"},patient:{fromRole:"patient"},destination:{fromRole:"destination",default:{type:"reference",value:"me"}}}}}function ns(r,e,t,n,i){let o=[],s=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};o.push(s);let c=[...r.roles.filter(u=>u.required)].sort((u,d)=>{let p=u.svoPosition??999,m=d.svoPosition??999;return p-m});for(let u of c){let d,p;if(u.markerOverride&&u.markerOverride[e.code]!==void 0)d=u.markerOverride[e.code];else {let m=e.roleMarkers[u.role];m&&(d=m.primary,p=m.alternatives);}if(d){let m=p?{type:"literal",value:d,alternatives:p}:{type:"literal",value:d};o.push(m);}o.push({type:"role",role:u.role,optional:false});}if(n.position==="before"){let u=n.alternatives?{type:"literal",value:n.primary,alternatives:n.alternatives}:{type:"literal",value:n.primary};o.push(u);}o.push({type:"role",role:"event",optional:false});let l=c.map(u=>`{${u.role}}`).join(" ");return {id:`${r.action}-event-${e.code}-vso-verb-first-2role`,language:e.code,command:"on",priority:(i.basePriority??100)+48,template:{format:`${t.primary} ${l} ${n.primary} {event}`,tokens:o},extraction:{action:{value:r.action},event:{fromRole:"event"},...Object.fromEntries(c.map(u=>[u.role,{fromRole:u.role}]))}}}function at(r,e,t,n,i){let o=[];if(n.position==="before"){let u=n.alternatives?{type:"literal",value:n.primary,alternatives:n.alternatives}:{type:"literal",value:n.primary};o.push(u);}o.push({type:"role",role:"event",optional:false});let s=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};o.push(s);let c=[...r.roles.filter(u=>u.required)].sort((u,d)=>{let p=u.svoPosition??999,m=d.svoPosition??999;return p-m});for(let u of c){let d,p;if(u.markerOverride&&u.markerOverride[e.code]!==void 0)d=u.markerOverride[e.code];else {let m=e.roleMarkers[u.role];m&&(d=m.primary,p=m.alternatives);}if(d){let m=p?{type:"literal",value:d,alternatives:p}:{type:"literal",value:d};o.push(m);}o.push({type:"role",role:u.role,optional:false});}let l=c.map(u=>`{${u.role}}`).join(" ");return {id:`${r.action}-event-${e.code}-vso-2role`,language:e.code,command:"on",priority:(i.basePriority??100)+55,template:{format:`${n.primary} {event} ${t.primary} ${l}`,tokens:o},extraction:{action:{value:r.action},event:{fromRole:"event"},...Object.fromEntries(c.map(u=>[u.role,{fromRole:u.role}]))}}}function is(r,e,t,n,i){let o=[],s=e.eventHandler?.negationMarker;if(n.position==="before"){let l=n.alternatives?{type:"literal",value:n.primary,alternatives:n.alternatives}:{type:"literal",value:n.primary};o.push(l);}if(s){let l=s.alternatives?{type:"literal",value:s.primary,alternatives:s.alternatives}:{type:"literal",value:s.primary};o.push(l);}o.push({type:"role",role:"event",optional:false});let a=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};o.push(a),o.push({type:"role",role:"patient",optional:false});let c=e.roleMarkers.destination;return c&&o.push({type:"group",optional:true,tokens:[c.alternatives?{type:"literal",value:c.primary,alternatives:c.alternatives}:{type:"literal",value:c.primary},{type:"role",role:"destination",optional:true}]}),{id:`${r.action}-event-${e.code}-vso-negated`,language:e.code,command:"on",priority:(i.basePriority??100)+48,template:{format:`${n.primary} ${s?.primary||""} {event} ${t.primary} {patient} ${c?.primary||""} {destination?}`,tokens:o},extraction:{action:{value:r.action},event:{fromRole:"event"},patient:{fromRole:"patient"},destination:{fromRole:"destination",default:{type:"reference",value:"me"}}}}}function os(r,e,t,n){let i=[];i.push({type:"literal",value:"and",alternatives:["then"]}),i.push({type:"role",role:"event",optional:false});let o=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};i.push(o),i.push({type:"role",role:"patient",optional:false});let s=e.roleMarkers.destination;return s&&i.push({type:"group",optional:true,tokens:[s.alternatives?{type:"literal",value:s.primary,alternatives:s.alternatives}:{type:"literal",value:s.primary},{type:"role",role:"destination",optional:true}]}),{id:`${r.action}-event-${e.code}-vso-proclitic`,language:e.code,command:"on",priority:(n.basePriority??100)+45,template:{format:`[proclitic?] {event} ${t.primary} {patient} ${s?.primary||""} {destination?}`,tokens:i},extraction:{action:{value:r.action},event:{fromRole:"event"},patient:{fromRole:"patient"},destination:{fromRole:"destination",default:{type:"reference",value:"me"}}}}}var ne={basePriority:100,generateSimpleVariants:true,generateAlternatives:true};function kt(r,e,t=ne){let n=`${r.action}-${e.code}-generated`,i=t.basePriority??100,o=e.keywords[r.action];if(!o)throw new Error(`No keyword translation for '${r.action}' in ${e.code}`);let s=ls(r,e,o),a=Ct(r,e),c=ms(r,e,o);return {id:n,language:e.code,command:r.action,priority:i,template:{format:c,tokens:s},extraction:a}}function ss(r,e,t=ne){if(r.roles.filter(a=>!a.required).length===0)return null;let i=r.roles.filter(a=>a.required),o={...r,roles:i};return {...kt(o,e,t),id:`${r.action}-${e.code}-generated-simple`,priority:(t.basePriority??100)-5,extraction:Ct(r,e)}}function as(r,e,t=ne){let n=[];if(n.push(kt(r,e,t)),t.generateSimpleVariants){let i=ss(r,e,t);i&&n.push(i);}return n}function Tt(r,e=ne){let t=[],n=Bo();for(let i of n){if(!r.keywords[i.action])continue;let o=as(i,r,e);if(t.push(...o),r.eventHandler?.eventMarker){let s=cs(i,r,e);t.push(...s);}}return t}function cs(r,e,t=ne){if(!e.eventHandler||!e.eventHandler.eventMarker)return [];let n=[],i=e.eventHandler.eventMarker,o=e.keywords[r.action];if(!o)return [];let a=r.roles.filter(c=>c.required).length===2;if(e.wordOrder==="SOV")if(a)n.push(es(r,e,o,i,t)),n.push(ts(r,e,o,i,t));else {n.push(Ho(r,e,o,i,t)),n.push(Yo(r,e,o,i,t));let c=e.roleMarkers.destination;c&&c.primary!==i.primary&&n.push(Xo(r,e,o,i,t));let l=i.primary.split(/\s+/),u=i.alternatives?.some(p=>!p.includes(" ")&&p.length>1);l.length>1&&u&&n.push(Zo(r,e,o,i,t)),n.push(Qo(r,e,o,i,t));let d=Jo(r,e,o,t);d&&n.push(d);}else e.wordOrder==="VSO"?a?(n.push(at(r,e,o,i,t)),n.push(ns(r,e,o,i,t))):(n.push(st(r,e,o,i,t)),n.push(rs(r,e,o,i,t)),e.eventHandler?.negationMarker&&n.push(is(r,e,o,i,t)),e.tokenization?.prefixes&&n.push(os(r,e,o,t))):a?n.push(at(r,e,o,i,t)):n.push(st(r,e,o,i,t));return n}function ls(r,e,t){let n=[],i=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary},o=us(r,e);switch(e.wordOrder){case "SVO":n.push(i),n.push(...o);break;case "SOV":n.push(...o),n.push(i);break;case "VSO":n.push(i),n.push(...o);break;default:n.push(i),n.push(...o);}return n}function us(r,e){let t=[],n=St(r.roles,e.wordOrder);for(let i of n){let o=ds(i,e);i.required?t.push(...o):t.push({type:"group",optional:true,tokens:o});}return t}function ds(r,e){let t=[],n=r.markerOverride?.[e.code],i=e.roleMarkers[r.role],o={type:"role",role:r.role,optional:!r.required,expectedTypes:r.expectedTypes};if(n!==void 0)(i?.position??"before")==="before"?(n&&t.push({type:"literal",value:n}),t.push(o)):(t.push(o),n&&t.push({type:"literal",value:n}));else if(i)if(i.position==="before"){if(i.primary){let s=i.alternatives?{type:"literal",value:i.primary,alternatives:i.alternatives}:{type:"literal",value:i.primary};t.push(s);}t.push(o);}else {t.push(o);let s=i.alternatives?{type:"literal",value:i.primary,alternatives:i.alternatives}:{type:"literal",value:i.primary};t.push(s);}else t.push(o);return t}function ps(r,e){let t={};for(let n of r.roles){let i=n.markerOverride?.[e.code],o=e.roleMarkers[n.role];i!==void 0?t[n.role]=i?{marker:i}:{}:o&&o.primary?t[n.role]=o.alternatives?{marker:o.primary,markerAlternatives:o.alternatives}:{marker:o.primary}:t[n.role]={};}return t}function Ct(r,e){let t=ps(r,e),n={};for(let i of r.roles){let o=t[i.role]||{};!i.required&&i.default?n[i.role]={...o,default:i.default}:n[i.role]=o;}return n}function ms(r,e,t){let n=[],o=St(r.roles,e.wordOrder).map(s=>{let a=Ko(s,e),c="";return a&&a.primary?a.position==="before"?c=`${a.primary} {${s.role}}`:c=`{${s.role}} ${a.primary}`:c=`{${s.role}}`,s.required?c:`[${c}]`});switch(e.wordOrder){case "SVO":case "VSO":n.push(t.primary,...o);break;case "SOV":n.push(...o,t.primary);break;default:n.push(t.primary,...o);}return n.join(" ")}function me(r){let e=r.getAttribute("data-lang");if(e)return Ae(e);let t=r.getAttribute("data-hyperscript-lang")??r.closest?.("[data-hyperscript-lang]")?.getAttribute("data-hyperscript-lang");if(t)return Ae(t);let n=typeof document<"u"?document.documentElement?.lang:null;return n&&n!=="en"?Ae(n):null}function Ae(r){return r.split("-")[0].toLowerCase()}var At={add:[["patient",""],["destination","to"]],append:[["patient",""],["destination","to"]],async:[],beep:[["patient",""]],behavior:[["patient",""]],blur:[["patient",""]],break:[],call:[["patient",""]],clone:[["patient",""],["destination","into"]],compound:[],continue:[],copy:[["patient",""]],decrement:[["patient",""],["quantity","by"]],default:[["destination",""],["patient","to"]],else:[],exit:[],fetch:[["source",""],["responseType","as"],["method","via"],["destination","on"]],focus:[["patient",""]],for:[["patient",""],["source","in"]],get:[["source",""],["destination","on"]],go:[["destination",""]],halt:[["patient",""]],hide:[["patient",""],["style","with"]],if:[["condition",""]],increment:[["patient",""],["quantity","by"]],init:[],install:[["patient",""],["destination","on"]],js:[["patient",""]],log:[["patient",""]],make:[["patient",""]],measure:[["patient",""],["source","of"]],morph:[["destination",""],["patient","to"]],on:[["event",""],["source","from"]],pick:[["patient",""],["source","from"]],prepend:[["patient",""],["destination","to"]],put:[["patient",""],["destination","into"]],remove:[["patient",""],["source","from"]],render:[["patient",""],["style","with"]],repeat:[["quantity",""],["condition","until"]],return:[["patient",""]],send:[["event",""],["destination","to"]],set:[["destination",""],["patient","to"]],settle:[["patient",""]],show:[["patient",""],["style","with"]],swap:[["method",""],["destination","of"],["patient","with"]],take:[["patient",""],["source","from"]],tell:[["destination",""]],throw:[["patient",""]],toggle:[["patient",""],["destination","on"]],transition:[["patient",""],["goal","to"],["destination","on"],["duration","over"],["style","with"]],trigger:[["event",""],["destination","on"]],unless:[["condition",""]],wait:[["patient",""]],while:[["condition",""]]};function oe(r){switch(r.kind){case "event-handler":return fs(r);case "compound":return hs(r);default:return ys(r)}}function fs(r){let e=["on"],t=r.roles.get("event");t&&e.push(ie(t));let n=r.roles.get("source");if(n&&e.push("from",ie(n)),r.body&&r.body.length>0){let i=r.body.map(oe);e.push(i.join(" then "));}return e.join(" ")}function hs(r){let e=r.chainType==="async"?"async":r.chainType;return r.statements.map(oe).join(` ${e} `)}function ys(r){let e=At[r.action];if(e){let n=[r.action];for(let[i,o]of e){let s=r.roles.get(i);s&&(i==="destination"&&s.type==="reference"&&s.value==="me"||(o&&n.push(o),n.push(ie(s))));}return n.join(" ")}let t=[r.action];for(let[,n]of r.roles)t.push(ie(n));return t.join(" ")}function ie(r){switch(r.type){case "literal":return typeof r.value=="string"&&r.dataType==="string"?`"${r.value}"`:String(r.value);case "selector":return r.value;case "reference":return r.value;case "property-path":return vs(r);case "expression":return r.raw;case "flag":return r.enabled?`+${r.name}`:`~${r.name}`}}function vs(r){let e=ie(r.object),t=r.property;if(r.object.type==="reference")switch(r.object.value){case "me":return `my ${t}`;case "it":return `its ${t}`;case "you":return `your ${t}`}return `${e}'s ${t}`}var Rt=.5,gs={confidenceThreshold:Rt,strategy:"semantic",fallbackToOriginal:true};function bs(r,e){return typeof r=="number"?r:r[e]??r["*"]??Rt}var ze=null;function Es(){return ze||(ze=wt()),ze}function Re(r,e,t={}){let n={...gs,...t},i=zt(r,e,n);if(i!==null)return i;let o=xs(r);if(o){let s=zt(o.commands,e,n);if(s!==null)return o.prefix+s}return r}function zt(r,e,t){if(t.strategy==="semantic"||t.strategy==="auto"){let n=bs(t.confidenceThreshold,e),i=Nt(r,e,n);if(i!==null)return i}if((t.strategy==="auto"||t.strategy==="i18n")&&t.i18nToEnglish){let n=Ss(r,e,t.i18nToEnglish);if(n!==null)return n}return null}var ws=/^(on\s+(?:every\s+)?[\w-]+(?:\[.*?\])?(?:\.[\w-]+(?:\([^)]*\))?)*(?:\s+from\s+\S+)?(?:\s+queue\s+\w+)?\s+)/;function xs(r){let e=r.match(ws);if(!e)return null;let t=e[1],n=r.slice(t.length);return n?{prefix:t,commands:n}:null}function Nt(r,e,t){try{let n=Ts(r,e);if(n.length>1)return Cs(n,e,t);let i=Es();if(!i.supportsLanguage(e))return null;let o=i.analyze(r,e);if(!xt(o,t))return null;if(o.node)return oe(o.node);let s=Ce(r,e);return oe(s)}catch{return null}}function Ss(r,e,t){try{let n=t(r,e);return n!==r?n:null}catch{return null}}function ks(r){let e=["then"],t=B(r);if(t?.keywords?.then){let n=t.keywords.then;if(n.primary&&n.primary!=="then"&&e.push(n.primary),n.alternatives)for(let i of n.alternatives)e.includes(i)||e.push(i);}return e}function Ts(r,e){let n=ks(e).map(a=>a.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")),i=new RegExp(`\\s+(?:${n.join("|")})\\s+`,"i"),o=r.split(`
|
|
4
|
+
`).map(a=>a.trim()).filter(a=>a.length>0),s=[];for(let a of o){let c=a.split(i);s.push(...c);}return s}function Cs(r,e,t){let n=[];for(let i of r){let o=Nt(i.trim(),e,t);if(o===null)return null;n.push(o);}return n.join(" then ")}function Ne(r={}){return function(t){let{internals:n}=t,i=n.runtime,o=i.getScript.bind(i);i.getScript=function(s){let a=o(s);if(!a)return null;let c=As(s,r);if(!c||c==="en")return a;let l=Re(a,c,r);return r.debug&&l!==a&&console.log(`[hyperscript-i18n] ${c}: "${a}" \u2192 "${l}"`),l};}}function As(r,e){if(e.languageAttribute){let n=r.getAttribute(e.languageAttribute);if(n)return n.split("-")[0].toLowerCase()}let t=me(r);return t||(e.defaultLanguage??null)}function Pt(r,e,t={}){return e==="en"?r:Re(r,e,t)}yt(r=>Tt(r));function Ot(){typeof _hyperscript<"u"&&_hyperscript.use&&(_hyperscript.use(Ne()),zs());}function zs(){if(typeof document>"u")return;let e=_hyperscript?.internals?.runtime;if(!e?.processNode||!e?.getInternalData)return;let t=e.getScriptSelector?.()??"[_], [script], [data-script]";document.querySelectorAll(t).forEach(n=>{let i=e.getInternalData(n);i.initialized&&(i.initialized=false);}),e.processNode(document.body);}var Vc=["es","pt","fr","de"];Ot();exports.plugin=Ne;exports.preprocess=Pt;exports.resolveLanguage=me;exports.supportedLanguages=Vc;return exports;})({});
|