@lokascript/hyperscript-adapter 2.0.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/LICENSE +21 -0
- package/README.md +147 -0
- package/dist/hyperscript-i18n-ar.global.js +4 -0
- package/dist/hyperscript-i18n-bn.global.js +4 -0
- package/dist/hyperscript-i18n-de.global.js +4 -0
- package/dist/hyperscript-i18n-east-asian.global.js +4 -0
- package/dist/hyperscript-i18n-en.global.js +6 -0
- package/dist/hyperscript-i18n-es.global.js +4 -0
- package/dist/hyperscript-i18n-fr.global.js +4 -0
- package/dist/hyperscript-i18n-he.global.js +4 -0
- package/dist/hyperscript-i18n-hi.global.js +4 -0
- package/dist/hyperscript-i18n-id.global.js +4 -0
- package/dist/hyperscript-i18n-it.global.js +4 -0
- package/dist/hyperscript-i18n-ja.global.js +4 -0
- package/dist/hyperscript-i18n-ko.global.js +4 -0
- package/dist/hyperscript-i18n-lite.global.js +1 -0
- package/dist/hyperscript-i18n-ms.global.js +4 -0
- package/dist/hyperscript-i18n-pl.global.js +4 -0
- package/dist/hyperscript-i18n-pt.global.js +4 -0
- package/dist/hyperscript-i18n-qu.global.js +4 -0
- package/dist/hyperscript-i18n-ru.global.js +4 -0
- package/dist/hyperscript-i18n-slavic.global.js +4 -0
- package/dist/hyperscript-i18n-south-asian.global.js +4 -0
- package/dist/hyperscript-i18n-southeast-asian.global.js +4 -0
- package/dist/hyperscript-i18n-sw.global.js +4 -0
- package/dist/hyperscript-i18n-th.global.js +4 -0
- package/dist/hyperscript-i18n-tl.global.js +4 -0
- package/dist/hyperscript-i18n-tr.global.js +4 -0
- package/dist/hyperscript-i18n-uk.global.js +4 -0
- package/dist/hyperscript-i18n-vi.global.js +4 -0
- package/dist/hyperscript-i18n-western.global.js +4 -0
- package/dist/hyperscript-i18n-zh.global.js +4 -0
- package/dist/hyperscript-i18n.global.js +8 -0
- package/dist/hyperscript-i18n.global.js.map +1 -0
- package/dist/index.cjs +203 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +99 -0
- package/dist/index.d.ts +99 -0
- package/dist/index.js +179 -0
- package/dist/index.js.map +1 -0
- package/package.json +169 -0
- package/src/browser-lite.ts +159 -0
- package/src/browser.ts +74 -0
- package/src/bundles/ar.ts +6 -0
- package/src/bundles/bn.ts +6 -0
- package/src/bundles/de.ts +6 -0
- package/src/bundles/east-asian.ts +8 -0
- package/src/bundles/en.ts +6 -0
- package/src/bundles/es.ts +6 -0
- package/src/bundles/fr.ts +6 -0
- package/src/bundles/he.ts +6 -0
- package/src/bundles/hi.ts +6 -0
- package/src/bundles/id.ts +6 -0
- package/src/bundles/it.ts +6 -0
- package/src/bundles/ja.ts +6 -0
- package/src/bundles/ko.ts +6 -0
- package/src/bundles/ms.ts +6 -0
- package/src/bundles/pl.ts +6 -0
- package/src/bundles/pt.ts +6 -0
- package/src/bundles/qu.ts +6 -0
- package/src/bundles/ru.ts +6 -0
- package/src/bundles/shared.ts +65 -0
- package/src/bundles/slavic.ts +8 -0
- package/src/bundles/south-asian.ts +7 -0
- package/src/bundles/southeast-asian.ts +10 -0
- package/src/bundles/sw.ts +6 -0
- package/src/bundles/th.ts +6 -0
- package/src/bundles/tl.ts +6 -0
- package/src/bundles/tr.ts +6 -0
- package/src/bundles/uk.ts +6 -0
- package/src/bundles/vi.ts +6 -0
- package/src/bundles/western.ts +9 -0
- package/src/bundles/zh.ts +6 -0
- package/src/derive-syntax.ts +126 -0
- package/src/generated/syntax-table.ts +61 -0
- package/src/hyperscript-renderer.ts +150 -0
- package/src/index.ts +27 -0
- package/src/language-resolver.ts +41 -0
- package/src/plugin.ts +119 -0
- package/src/preprocessor.ts +251 -0
- package/src/slim-plugin.ts +60 -0
- package/src/slim-preprocessor.ts +190 -0
|
@@ -0,0 +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 l=a.split(i);s.push(...l);}return s}function ts(t,e,n){let r=[];for(let i of t){let o=Zt(i.trim(),e,n);if(o===null)return null;r.push(o);}return r.join(" then ")}function _e(t={}){return function(n){let{internals:r}=n,i=r.runtime,o=i.getScript.bind(i);i.getScript=function(s){let a=o(s);if(!a)return null;let l=rs(s,t);if(!l||l==="en")return a;let u=Ie(a,l,t);return t.debug&&u!==a&&console.log(`[hyperscript-i18n] ${l}: "${a}" \u2192 "${u}"`),u};}}function rs(t,e){if(e.languageAttribute){let r=t.getAttribute(e.languageAttribute);if(r)return r.split("-")[0].toLowerCase()}let n=he(t);return n||(e.defaultLanguage??null)}function Yt(t,e,n={}){return e==="en"?t:Ie(t,e,n)}Dt(t=>Kt(t));function Jt(){typeof _hyperscript<"u"&&_hyperscript.use&&(_hyperscript.use(_e()),ns());}function ns(){if(typeof document>"u")return;let e=_hyperscript?.internals?.runtime;if(!e?.processNode||!e?.getInternalData)return;let n=e.getScriptSelector?.()??"[_], [script], [data-script]";document.querySelectorAll(n).forEach(r=>{let i=e.getInternalData(r);i.initialized&&(i.initialized=false);}),e.processNode(document.body);}var Hs=["es","pt","fr","de"];Jt();exports.plugin=_e;exports.preprocess=Yt;exports.resolveLanguage=he;exports.supportedLanguages=Hs;return exports;})({});
|