@hyperscript-tools/multilingual 2.5.0 → 2.6.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.
Files changed (31) hide show
  1. package/dist/hyperscript-i18n-ar.global.js +5 -4
  2. package/dist/hyperscript-i18n-bn.global.js +5 -4
  3. package/dist/hyperscript-i18n-de.global.js +5 -4
  4. package/dist/hyperscript-i18n-east-asian.global.js +5 -4
  5. package/dist/hyperscript-i18n-en.global.js +7 -6
  6. package/dist/hyperscript-i18n-es.global.js +5 -4
  7. package/dist/hyperscript-i18n-fr.global.js +5 -4
  8. package/dist/hyperscript-i18n-he.global.js +5 -4
  9. package/dist/hyperscript-i18n-hi.global.js +5 -4
  10. package/dist/hyperscript-i18n-id.global.js +5 -4
  11. package/dist/hyperscript-i18n-it.global.js +5 -4
  12. package/dist/hyperscript-i18n-ja.global.js +5 -4
  13. package/dist/hyperscript-i18n-ko.global.js +5 -4
  14. package/dist/hyperscript-i18n-ms.global.js +5 -4
  15. package/dist/hyperscript-i18n-pl.global.js +5 -4
  16. package/dist/hyperscript-i18n-pt.global.js +5 -4
  17. package/dist/hyperscript-i18n-qu.global.js +5 -4
  18. package/dist/hyperscript-i18n-ru.global.js +5 -4
  19. package/dist/hyperscript-i18n-slavic.global.js +5 -4
  20. package/dist/hyperscript-i18n-south-asian.global.js +5 -4
  21. package/dist/hyperscript-i18n-southeast-asian.global.js +5 -4
  22. package/dist/hyperscript-i18n-sw.global.js +5 -4
  23. package/dist/hyperscript-i18n-th.global.js +5 -4
  24. package/dist/hyperscript-i18n-tl.global.js +5 -4
  25. package/dist/hyperscript-i18n-tr.global.js +5 -4
  26. package/dist/hyperscript-i18n-uk.global.js +5 -4
  27. package/dist/hyperscript-i18n-vi.global.js +5 -4
  28. package/dist/hyperscript-i18n-western.global.js +5 -4
  29. package/dist/hyperscript-i18n-zh.global.js +5 -4
  30. package/dist/hyperscript-i18n.global.js +34 -30
  31. package/package.json +2 -2
@@ -1,4 +1,5 @@
1
- var HyperscriptI18n=(function(exports){'use strict';function S(r,e){return e?{type:"literal",value:r,dataType:e}:{type:"literal",value:r}}function ce(r,e){return e?{type:"selector",value:r,selectorKind:e}:{type:"selector",value:r}}function Q(r){return {type:"reference",value:r}}function pe(r,e){return {type:"property-path",object:r,property:e}}var Re=new Set(["me","you","it","result","event","target","body"]);function ke(r,e=Re){return e.has(r)}var Tr=class{constructor(r){this.namespace=r,this.enabled=this.checkEnabled();}checkEnabled(){if(typeof process<"u"&&process.env){let r=process.env.DEBUG||"";return r==="*"||r.includes("framework:*")||r.includes(`framework:${this.namespace}`)}return false}log(r,e,...t){if(!this.enabled)return;let i=`[framework:${this.namespace}]`,a=new Date().toISOString();switch(r){case "debug":console.debug(`${a} ${i} DEBUG:`,e,...t);break;case "info":console.info(`${a} ${i} INFO:`,e,...t);break;case "warn":console.warn(`${a} ${i} WARN:`,e,...t);break;case "error":console.error(`${a} ${i} ERROR:`,e,...t);break}}debug(r,...e){this.log("debug",r,...e);}info(r,...e){this.log("info",r,...e);}warn(r,...e){this.log("warn",r,...e);}error(r,...e){this.log("error",r,...e);}isEnabled(){return this.enabled}enable(){this.enabled=true;}disable(){this.enabled=false;}};function Pr(r){return new Tr(r)}function V(r,e){return !e||e.length===0||e.includes(r)||e.includes("expression")?true:r==="property-path"?e.some(t=>["selector","reference","expression"].includes(t)):false}function Rr(r,e){return r?.possessive?.keywords?.[e]}var re=class q{constructor(){this.logger=Pr("pattern-matcher"),this.stemMatchCount=0,this.totalKeywordMatches=0;}safeToLowerCase(e){return typeof e=="string"?e.toLowerCase():e==null?"":String(e).toLowerCase()}matchPattern(e,t,i){let a=e.mark(),u=new Map;if(this.logger.debug("========================================"),this.logger.debug("matchPattern ENTRY"),this.logger.debug("Pattern ID:",t.id),this.logger.debug("Pattern command:",t.command),this.logger.debug("Pattern language:",t.language),this.logger.debug("Pattern template:",JSON.stringify(t.template,null,2)),this.logger.isEnabled()){let s=[];for(let l=0;l<10;l++){let m=e.peek(l);if(m)s.push({type:m.type,value:m.value,kind:m.kind});else break}this.logger.debug("Input tokens (first 10):",s),this.logger.debug("Profile code:",i?.code);}this.currentProfile=i,this.stemMatchCount=0,this.totalKeywordMatches=0,this.logger.debug("--- Calling matchTokenSequence ---"),this.logger.debug("Pattern tokens to match:",JSON.stringify(t.template.tokens,null,2));let n=this.matchTokenSequence(e,t.template.tokens,u);if(this.logger.debug("matchTokenSequence returned:",n),this.logger.debug("Captured roles:",Array.from(u.entries()).map(([s,l])=>[s,JSON.stringify(l)])),!n)return this.logger.debug(">>> MATCH FAILED - resetting token position"),e.reset(a),null;let o=this.calculateConfidence(t,u);return this.applyExtractionRules(t,u),{pattern:t,captured:u,consumedTokens:e.position()-a.position,confidence:o}}matchBest(e,t,i){let a=[];for(let n of t){let o=e.mark(),s=this.matchPattern(e,n,i);s&&a.push(s),e.reset(o);}if(a.length===0)return null;a.sort((n,o)=>{let s=o.pattern.priority-n.pattern.priority;if(s!==0)return s;let l=o.confidence-n.confidence;return Math.abs(l)>.001?l:o.consumedTokens-n.consumedTokens});let u=a[0];return this.matchPattern(e,u.pattern),u}matchTokenSequence(e,t,i,a){let u=t[0],n=u?.type==="literal"&&(u.value==="and"||u.value==="then"||u.alternatives?.includes("and")||u.alternatives?.includes("then"));if(this.currentProfile?.code==="ar"&&!n)for(;e.peek()?.kind==="conjunction";)e.advance();let o=null,s=null;for(let l=0;l<t.length;l++){let m=t[l];this.logger.debug(" >> Matching pattern token:",JSON.stringify(m,null,2));let c=e.peek();if(this.logger.debug(" >> Current input token:",c?JSON.stringify({type:c.type,value:c.value,kind:c.kind}):"EOF"),m.type==="role"&&m.greedy){let v=this.collectStopMarkers(t,l+1);if(a)for(let k of a)v.add(k);let g=[];for(;!e.isAtEnd();){let k=e.peek();if(!k||this.isStopMarker(k,v))break;g.push(k.value),e.advance();}if(g.length>0){i.set(m.role,{type:"expression",raw:g.join(" ")}),o=null,s=null;continue}else {if(m.optional)continue;return false}}if(m.type==="group"){let v=this.collectStopMarkers(t,l+1);if(a)for(let k of a)v.add(k);if(this.matchGroupToken(e,m,i,v)){o=null,s=null;continue}if(this.isOptional(m))continue;return false}let p=m.type==="role"&&m.optional===true,d=p?e.mark():null;if(m.type==="role"&&!p){let v=l+1<t.length?t[l+1]:null;if(v?.type==="literal"){let g=e.peek();if(g&&this.getMatchType(g,v.value)!=="none"){if(this.logger.debug(" >> MARKER-STEAL GUARD: current token matches next literal, skipping role"),this.logger.debug(" >> Token match FAILED"),this.isOptional(m))continue;if(o&&s){this.logger.debug(" >> BACKTRACKING: undoing optional role",s),e.reset(o),i.delete(s),o=null,s=null;let k=this.matchPatternToken(e,m,i);if(this.logger.debug(" >> Backtrack retry result:",k),k)continue}return false}}}let E=this.matchPatternToken(e,m,i);if(this.logger.debug(" >> Match result:",E),E){p?(o=d,s=m.role):(o=null,s=null);continue}if(this.logger.debug(" >> Token match FAILED"),!this.isOptional(m)){if(o&&s){this.logger.debug(" >> BACKTRACKING: undoing optional role",s),e.reset(o),i.delete(s),o=null,s=null;let v=this.matchPatternToken(e,m,i);if(this.logger.debug(" >> Backtrack retry result:",v),v)continue}return false}}return true}matchPatternToken(e,t,i){switch(t.type){case "literal":return this.matchLiteralToken(e,t);case "role":return this.matchRoleToken(e,t,i);case "group":return this.matchGroupToken(e,t,i);default:return false}}matchLiteralToken(e,t){let i=e.peek();if(this.logger.debug(" >>> matchLiteralToken: expecting",t.value),this.logger.debug(" >>> matchLiteralToken: got token",i?JSON.stringify({type:i.type,value:i.value,kind:i.kind}):"null"),!i)return this.logger.debug(" >>> matchLiteralToken: FAIL - no token"),false;let a=this.getMatchType(i,t.value);if(this.logger.debug(" >>> matchType for",i.value,"vs",t.value,":",a),a!=="none")return this.totalKeywordMatches++,a==="stem"&&this.stemMatchCount++,e.advance(),true;if(t.alternatives)for(let u of t.alternatives){let n=this.getMatchType(i,u);if(n!=="none")return this.totalKeywordMatches++,n==="stem"&&this.stemMatchCount++,e.advance(),true}return false}matchRoleToken(e,t,i){this.logger.debug(" >>> matchRoleToken ENTRY: capturing role",t.role),this.logger.debug(" >>> matchRoleToken: expected types",t.expectedTypes),this.logger.debug(" >>> matchRoleToken: optional?",t.optional),this.skipNoiseWords(e);let a=e.peek();if(this.logger.debug(" >>> After skipNoiseWords, current token:",a?JSON.stringify({value:a.value,kind:a.kind}):"null"),!a)return t.optional||false;let u=this.tryMatchPossessiveExpression(e);if(u)return t.expectedTypes&&t.expectedTypes.length>0&&!V(u.type,t.expectedTypes)?t.optional||false:(i.set(t.role,u),true);let n=this.tryMatchMethodCallExpression(e);if(n)return t.expectedTypes&&t.expectedTypes.length>0&&!V(n.type,t.expectedTypes)?t.optional||false:(i.set(t.role,n),true);let o=this.tryMatchPossessiveSelectorExpression(e);if(o)return t.expectedTypes&&t.expectedTypes.length>0&&!V(o.type,t.expectedTypes)?t.optional||false:(i.set(t.role,o),true);let s=this.tryMatchPropertyAccessExpression(e);if(s)return t.expectedTypes&&t.expectedTypes.length>0&&!V(s.type,t.expectedTypes)?t.optional||false:(i.set(t.role,s),true);let l=this.tryMatchSelectorPropertyExpression(e);if(l)return t.expectedTypes&&t.expectedTypes.length>0&&!V(l.type,t.expectedTypes)?t.optional||false:(i.set(t.role,l),true);this.logger.debug(" >>> Trying tokenToSemanticValue for token:",a?JSON.stringify({value:a.value,kind:a.kind}):"null");let m=this.tokenToSemanticValue(a);return this.logger.debug(" >>> tokenToSemanticValue returned:",m?JSON.stringify(m):"null"),m?(this.logger.debug(" >>> Validating type:",m.type,"against expected:",t.expectedTypes),t.expectedTypes&&t.expectedTypes.length>0&&!V(m.type,t.expectedTypes)?(this.logger.debug(" >>> TYPE MISMATCH - returning",t.optional||false),t.optional||false):(this.logger.debug(" >>> Type validation PASSED"),i.set(t.role,m),e.advance(),true)):t.optional||false}tryMatchPossessiveExpression(e){let t=e.peek();if(!t||!this.currentProfile)return null;let i=t.normalized||t.value,a=this.safeToLowerCase(i),u=Rr(this.currentProfile,a);if(!u)return null;let n=e.mark();e.advance();let o=e.peek();if(!o)return e.reset(n),null;if(o.kind==="identifier"||o.kind==="keyword"&&!this.isStructuralKeyword(o.value)||o.kind==="selector"&&o.value.startsWith("*")||o.kind==="selector"&&o.value.startsWith("@")||o.kind==="selector"&&o.value.startsWith(".")&&/^\.[a-zA-Z_]\w*/.test(o.value)){e.advance();let s=o.value;o.kind==="selector"&&s.startsWith(".")&&/^\.[a-zA-Z_]\w*/.test(s)&&(s=s.substring(1));let l=s;for(;e.peek()?.kind==="selector"&&e.peek().value.startsWith(".")&&/^\.[a-zA-Z_]\w*/.test(e.peek().value);)l+=e.peek().value,e.advance();let m=e.peek();return m?.kind==="literal"&&m.value.startsWith("(")&&(l+=m.value,e.advance()),pe(Q(u),l)}return e.reset(n),null}isStructuralKeyword(e){return new Set(["into","in","to","from","at","by","with","without","before","after","of","as","on","then","end","else","if","repeat","while","for","toggle","add","remove","put","set","show","hide","increment","decrement","send","trigger","call"]).has(e.toLowerCase())}tryMatchMethodCallExpression(e){let t=e.peek();if(!t||t.kind!=="selector")return null;let i=e.mark();e.advance();let a=e.peek();if(!a||a.kind!=="operator"||a.value!==".")return e.reset(i),null;e.advance();let u=e.peek();if(!u||u.kind!=="identifier")return e.reset(i),null;e.advance();let n=e.peek();if(!n||n.kind!=="punctuation"||n.value!=="(")return e.reset(i),null;e.advance();let o=[];for(;!e.isAtEnd()&&o.length<q.MAX_METHOD_ARGS;){let l=e.peek();if(!l)break;if(l.kind==="punctuation"&&l.value===")"){e.advance();break}if(l.kind==="punctuation"&&l.value===","){e.advance();continue}o.push(l.value),e.advance();}return {type:"expression",raw:`${t.value}.${u.value}(${o.join(", ")})`}}tryMatchPropertyAccessExpression(e){let t=e.peek();if(!t||t.kind!=="identifier"&&t.kind!=="keyword")return null;let i=e.mark();e.advance();let a=e.peek();if(!a||a.kind!=="operator"||a.value!==".")return e.reset(i),null;e.advance();let u=e.peek();if(!u||u.kind!=="identifier")return e.reset(i),null;e.advance();let n=`${t.value}.${u.value}`,o=1;for(;!e.isAtEnd()&&o<q.MAX_PROPERTY_DEPTH;){let l=e.peek();if(!l||l.kind!=="operator"||l.value!==".")break;e.advance();let m=e.peek();if(!m||m.kind!=="identifier")break;e.advance(),n+=`.${m.value}`,o++;}let s=e.peek();if(s&&s.kind==="punctuation"&&s.value==="("){e.advance();let l=[],m=0;for(;!e.isAtEnd()&&l.length<q.MAX_METHOD_ARGS;){let p=e.peek();if(!p)break;if(p.kind==="punctuation"&&p.value===")"){if(m===0){e.advance();break}m--;}if(p.kind==="punctuation"&&p.value==="("&&m++,p.kind==="punctuation"&&p.value===","){e.advance();continue}l.push(p.value),e.advance();}return {type:"expression",raw:`${n}(${l.join(", ")})`}}return {type:"expression",raw:n}}tryMatchPossessiveSelectorExpression(e){let t=e.peek();if(!t||t.kind!=="selector")return null;let i=e.mark();e.advance();let a=e.peek();if(!a||a.kind!=="punctuation"||a.value!=="'s")return e.reset(i),null;e.advance();let u=e.peek();return !u||u.kind!=="selector"&&u.kind!=="identifier"?(e.reset(i),null):(e.advance(),pe(ce(t.value),u.value))}tryMatchSelectorPropertyExpression(e){let t=e.peek();if(!t||t.kind!=="selector"||typeof t.value!="string"||!t.value.startsWith("#"))return null;let i=e.mark();e.advance();let a=e.peek();if(!a||a.kind!=="selector"||!a.value.startsWith("."))return e.reset(i),null;let u=e.peek(1);u&&u.kind,e.advance();let n=a.value.slice(1);return pe(ce(t.value),n)}matchGroupToken(e,t,i,a){let u=e.mark(),n=new Set(i.keys());if(this.matchTokenSequence(e,t.tokens,i,a))return true;e.reset(u);for(let l of i.keys())n.has(l)||i.delete(l);if(!t.optional)return false;let s=this.getGroupLeadingMarker(t);if(s)for(let l=1;l<=q.MAX_MARKER_SCAN;l++){let m=e.peek(l);if(!m)break;if((m.normalized||m.value).toLowerCase()===s){this.logger.debug(" >> MARKER SCAN: found",s,"at offset",l,"- skipping intervening tokens");for(let d=0;d<l;d++)e.advance();if(this.matchTokenSequence(e,t.tokens,i,a))return true;e.reset(u);for(let d of i.keys())n.has(d)||i.delete(d);break}}return true}getGroupLeadingMarker(e){let t=e.tokens[0];return t?.type==="literal"?t.value.toLowerCase():null}getMatchType(e,t){return e.value===t?"exact":e.normalized===t?"normalized":e.stem===t&&e.stemConfidence!==void 0&&e.stemConfidence>=.7?"stem":e.kind==="keyword"&&this.safeToLowerCase(e.value)===t.toLowerCase()?"case-insensitive":"none"}collectStopMarkers(e,t){let i=new Set;for(let a=t;a<e.length;a++){let u=e[a];if(u.type==="literal"){if(i.add(u.value.toLowerCase()),u.alternatives)for(let n of u.alternatives)i.add(n.toLowerCase());break}if(u.type==="group"){for(let n of u.tokens)if(n.type==="literal"){if(i.add(n.value.toLowerCase()),n.alternatives)for(let o of n.alternatives)i.add(o.toLowerCase());break}if(!u.optional)break}}return i}isStopMarker(e,t){return t.size===0?false:!!(t.has(e.value.toLowerCase())||e.normalized&&t.has(e.normalized.toLowerCase()))}tokenToSemanticValue(e){switch(e.kind){case "selector":return ce(e.value);case "literal":return this.parseLiteralValue(e.value);case "keyword":let t=e.normalized||e.value;this.safeToLowerCase(t);return S(e.normalized||e.value);case "identifier":if(typeof e.value=="string"&&e.value.startsWith(":"))return Q(e.value);this.safeToLowerCase(e.value);return {type:"expression",raw:e.value};case "url":return S(e.value,"string");default:return null}}parseLiteralValue(e){if(e.startsWith('"')||e.startsWith("'")||e.startsWith("`")||e.startsWith("\u300C")){let a=e.slice(1,-1);return S(a,"string")}if(e==="true")return S(true,"boolean");if(e==="false")return S(false,"boolean");let t=e.match(/^(\d+(?:\.\d+)?)(ms|s|m|h)?$/);if(t){let a=parseFloat(t[1]);return t[2]?S(e,"duration"):S(a,"number")}let i=parseFloat(e);return isNaN(i)?S(e,"string"):S(i,"number")}applyExtractionRules(e,t){for(let[i,a]of Object.entries(e.extraction))t.has(i)||(a.value!==void 0?t.set(i,{type:"literal",value:a.value}):a.default&&t.set(i,a.default));}isOptional(e){return e.type!=="literal"&&e.optional===true}calculateConfidence(e,t){let i=0,a=0,u=l=>e.extraction?.[l]?.default!==void 0;for(let l of e.template.tokens)if(l.type==="role")a+=1,t.has(l.role)&&(i+=1);else if(l.type==="group"){for(let m of l.tokens)if(m.type==="role"){let c=u(m.role),p=.8;a+=p,t.has(m.role)?i+=p:c&&(i+=p*.6);}}let n=a>0?i/a:1;if(this.stemMatchCount>0&&this.totalKeywordMatches>0){let l=this.stemMatchCount/this.totalKeywordMatches*.15;n=Math.max(.5,n-l);}let o=this.calculateVSOConfidenceBoost(e);n=Math.min(1,n+o);let s=this.arabicPrepositionDisambiguation(e,t);return n=Math.max(0,Math.min(1,n+s)),n}calculateVSOConfidenceBoost(e){if(e.language!=="ar")return 0;let t=e.template.tokens[0];if(!t||t.type!=="literal")return 0;let i=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(i.has(t.value))return .15;if(t.alternatives){for(let a of t.alternatives)if(i.has(a))return .15}return 0}arabicPrepositionDisambiguation(e,t){if(e.language!=="ar")return 0;let i=0,a={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[u,n]of t.entries()){let o=a[u];if(!o||o.length===0)continue;let s="metadata"in n?n.metadata:void 0;if(s&&typeof s.prepositionValue=="string"){let l=s.prepositionValue;o.includes(l)?i+=.1:i-=.1;}}return Math.max(-0.1,Math.min(.1,i))}skipNoiseWords(e){let t=e.peek();if(!t)return;let i=this.safeToLowerCase(t.value);if(q.ENGLISH_NOISE_WORDS.has(i)){let a=e.mark();e.advance();let u=e.peek();if(u&&u.kind==="selector")return;e.reset(a);}i==="class"&&e.advance();}extractEventModifiers(e){let t={},i=false;for(;!e.isAtEnd();){let a=e.peek();if(!a||a.kind!=="event-modifier")break;let u=a.metadata;if(!u)break;switch(i=true,u.modifierName){case "once":t.once=true;break;case "debounce":typeof u.value=="number"&&(t.debounce=u.value);break;case "throttle":typeof u.value=="number"&&(t.throttle=u.value);break;case "queue":(u.value==="first"||u.value==="last"||u.value==="all"||u.value==="none")&&(t.queue=u.value);break}e.advance();}return i?t:void 0}};re.MAX_MARKER_SCAN=3;re.MAX_PROPERTY_DEPTH=10;re.MAX_METHOD_ARGS=20;re.ENGLISH_NOISE_WORDS=new Set(["the","a","an"]);var Nr=re;new Nr;var W=class{constructor(){this.name="string-literal";}canExtract(r,e){let t=r[e];return t==='"'||t==="'"||t==="`"||t==="\u201C"||t==="\u2018"}extract(r,e){let t=r[e];if(t==="\u201C"){let u=1;for(;e+u<r.length;){if(r[e+u]==="\u201D")return u++,{value:r.substring(e,e+u),length:u};u++;}return null}if(t==="\u2018"){let u=1;for(;e+u<r.length;){if(r[e+u]==="\u2019")return u++,{value:r.substring(e,e+u),length:u};u++;}return null}let i=1,a=false;for(;e+i<r.length;){let u=r[e+i];if(a){a=false,i++;continue}if(u==="\\"){a=true,i++;continue}if(u===t)return i++,{value:r.substring(e,e+i),length:i};i++;}return null}},U=class{constructor(){this.name="number";}canExtract(r,e){return /\d/.test(r[e])}extract(r,e){let t=0,i=false;for(;e+t<r.length;){let n=r[e+t];if(/\d/.test(n))t++;else if(n==="."&&!i)i=true,t++;else break}if(t===0)return null;let a=r.substring(e,e+t),u=e+t;if(u<r.length){let n=r.slice(u),o=[{pattern:"\u6BEB\u79D2",suffix:"ms"},{pattern:"\u5206\u949F",suffix:"m"},{pattern:"\u5C0F\u65F6",suffix:"h"},{pattern:"\u30DF\u30EA\u79D2",suffix:"ms"},{pattern:"\u6642\u9593",suffix:"h"}];for(let l of o)if(n.startsWith(l.pattern))return {value:a+l.suffix,length:t+l.pattern.length,metadata:{hasTimeUnit:true}};if(n.startsWith("ms"))return {value:a+"ms",length:t+2,metadata:{hasTimeUnit:true}};let s=[{pattern:"\u79D2",suffix:"s"},{pattern:"\u5206",suffix:"m"}];for(let l of s)if(n.startsWith(l.pattern))return {value:a+l.suffix,length:t+1,metadata:{hasTimeUnit:true}};if(/^[smh](?![a-zA-Z])/.test(n))return {value:a+n[0],length:t+1,metadata:{hasTimeUnit:true}}}return {value:a,length:t}}};function _r(r){return "setContext"in r&&typeof r.setContext=="function"}function Or(r){let e={language:r.language,direction:r.direction,lookupKeyword:r.lookupKeyword.bind(r),isKeyword:r.isKeyword.bind(r),isKeywordStart:r.isKeywordStart.bind(r)};return r.normalizer?{...e,normalizer:r.normalizer}:e}var te=class{constructor(r,e){this.pos=0,this.tokens=r,this.language=e;}peek(r=0){let e=this.pos+r;return e<0||e>=this.tokens.length?null:this.tokens[e]}advance(){if(this.isAtEnd())throw new Error("Unexpected end of token stream");return this.tokens[this.pos++]}isAtEnd(){return this.pos>=this.tokens.length}mark(){return {position:this.pos}}reset(r){this.pos=r.position;}position(){return this.pos}remaining(){return this.tokens.slice(this.pos)}takeWhile(r){let e=[];for(;!this.isAtEnd()&&r(this.peek());)e.push(this.advance());return e}skipWhile(r){for(;!this.isAtEnd()&&r(this.peek());)this.advance();}};function C(r,e){return {start:r,end:e}}function b(r,e,t,i){if(typeof r=="object"){let{value:u,kind:n,position:o,normalized:s,stem:l,stemConfidence:m,metadata:c}=r;return {value:u,kind:n,position:o,...s!==void 0&&{normalized:s},...l!==void 0&&{stem:l},...m!==void 0&&{stemConfidence:m},...c!==void 0&&{metadata:c}}}let a=r;if(!e||!t)throw new Error("createToken requires kind and position parameters");if(typeof i=="string")return {value:a,kind:e,position:t,normalized:i};if(i){let{normalized:u,stem:n,stemConfidence:o,metadata:s}=i;return {value:a,kind:e,position:t,...u!==void 0&&{normalized:u},...n!==void 0&&{stem:n},...o!==void 0&&{stemConfidence:o},...s!==void 0&&{metadata:s}}}return {value:a,kind:e,position:t}}function ee(r){return /\s/.test(r)}function Mr(r){return r==="#"||r==="."||r==="["||r==="@"||r==="*"||r==="<"}function Ir(r){return r==='"'||r==="'"||r==="`"||r==="\u300C"||r==="\u300D"}function M(r){return /\d/.test(r)}function jr(r){return /[a-zA-Z]/.test(r)}function x(r){return /[a-zA-Z0-9_-]/.test(r)}function Lr(r,e){if(e>=r.length)return null;let t=r[e];if(!Mr(t))return null;let i=e,a="";if(t==="#"||t==="."){for(a+=r[i++];i<r.length&&x(r[i]);)a+=r[i++];if(a.length<=1)return null;if(i<r.length&&r[i]==="."&&t==="#"){let n=i+1;for(;n<r.length&&x(r[n]);)n++;if(n<r.length&&r[n]==="(")return a}}else if(t==="["){let u=1,n=false,o=null,s=false;for(a+=r[i++];i<r.length&&u>0;){let l=r[i];a+=l,s?s=false:l==="\\"?s=true:n?l===o&&(n=false,o=null):l==='"'||l==="'"||l==="`"?(n=true,o=l):l==="["?u++:l==="]"&&u--,i++;}if(u!==0)return null}else if(t==="@"){for(a+=r[i++];i<r.length&&x(r[i]);)a+=r[i++];if(a.length<=1)return null}else if(t==="*"){for(a+=r[i++];i<r.length&&x(r[i]);)a+=r[i++];if(a.length<=1)return null}else if(t==="<"){if(a+=r[i++],i>=r.length||!jr(r[i]))return null;for(;i<r.length&&x(r[i]);)a+=r[i++];for(;i<r.length;){let u=r[i];if(u==="."){if(a+=r[i++],i>=r.length||!x(r[i]))return null;for(;i<r.length&&x(r[i]);)a+=r[i++];}else if(u==="#"){if(a+=r[i++],i>=r.length||!x(r[i]))return null;for(;i<r.length&&x(r[i]);)a+=r[i++];}else if(u==="["){let n=1,o=false,s=null,l=false;for(a+=r[i++];i<r.length&&n>0;){let m=r[i];a+=m,l?l=false:m==="\\"?l=true:o?m===s&&(o=false,s=null):m==='"'||m==="'"||m==="`"?(o=true,s=m):m==="["?n++:m==="]"&&n--,i++;}if(n!==0)return null}else break}for(;i<r.length&&ee(r[i]);)a+=r[i++];if(i<r.length&&r[i]==="/")for(a+=r[i++];i<r.length&&ee(r[i]);)a+=r[i++];if(i>=r.length||r[i]!==">")return null;a+=r[i++];}return a||null}function $r(r,e){if(e>=r.length||r[e]!=="'"||e+1>=r.length||r[e+1].toLowerCase()!=="s")return false;if(e+2>=r.length)return true;let i=r[e+2];return ee(i)||i==="*"||!x(i)}function Vr(r,e){if(e>=r.length)return null;let t=r[e];if(!Ir(t)||t==="'"&&$r(r,e))return null;let a={'"':'"',"'":"'","`":"`","\u300C":"\u300D"}[t];if(!a)return null;let u=e+1,n=t,o=false;for(;u<r.length;){let s=r[u];if(n+=s,o)o=false;else if(s==="\\")o=true;else if(s===a)return n;u++;}return n}function qr(r,e){if(e>=r.length)return false;let t=r[e],i=r[e+1]||"",a=r[e+2]||"";if(t==="/"&&i!=="/"&&/[a-zA-Z0-9._-]/.test(i)||t==="/"&&i==="/"&&/[a-zA-Z]/.test(a)||t==="."&&(i==="/"||i==="."&&a==="/"))return true;let u=r.slice(e,e+8).toLowerCase();return !!(u.startsWith("http://")||u.startsWith("https://"))}function Wr(r,e){if(!qr(r,e))return null;let t=e,i="",a=/[a-zA-Z0-9/:._\-?&=%@+~!$'()*,;[\]]/;for(;t<r.length;){let u=r[t];if(u==="#"){if(i.length>0&&/[a-zA-Z0-9/.]$/.test(i))for(i+=u,t++;t<r.length&&/[a-zA-Z0-9_-]/.test(r[t]);)i+=r[t++];break}if(a.test(u))i+=u,t++;else break}return i.length<2?null:i}function Ur(r,e){if(e>=r.length)return null;let t=r[e];if(!M(t)&&t!=="-"&&t!=="+")return null;let i=e,a="";if((r[i]==="-"||r[i]==="+")&&(a+=r[i++]),i>=r.length||!M(r[i]))return null;for(;i<r.length&&M(r[i]);)a+=r[i++];if(i<r.length&&r[i]===".")for(a+=r[i++];i<r.length&&M(r[i]);)a+=r[i++];return i<r.length&&(r.slice(i,i+2)==="ms"?a+="ms":(r[i]==="s"||r[i]==="m"||r[i]==="h")&&(a+=r[i])),a}var Kr=["===","!==","->","==","!=","<=",">=","&&","||","**","+=","-=","*=","/=","+","-","*","/","=",">","<","!","&","|","%","^","~"];new Set(Kr);var Oe=class Me{constructor(){this.profileKeywords=[],this.profileKeywordMap=new Map,this.extractors=[];}tokenize(e){if(this.isUsingExtractors())return this.tokenizeWithExtractors(e);throw new Error(`${this.constructor.name}: tokenize() not implemented and no extractors registered. Either register extractors or override tokenize() method.`)}registerExtractor(e){_r(e)&&e.setContext(Or(this)),this.extractors.push(e);}registerExtractors(e){for(let t of e)this.registerExtractor(t);}clearExtractors(){this.extractors=[];}isUsingExtractors(){return this.extractors.length>0}tokenizeWithExtractors(e){let t=[],i=0;for(;i<e.length;){for(;i<e.length&&ee(e[i]);)i++;if(i>=e.length)break;let a=false;for(let u of this.extractors)if(u.canExtract(e,i)){let n=u.extract(e,i);if(n){let o=n.metadata?.normalized,s=n.metadata?.stem,l=n.metadata?.stemConfidence,m={};if(n.metadata)for(let[p,d]of Object.entries(n.metadata))p!=="normalized"&&p!=="stem"&&p!=="stemConfidence"&&(m[p]=d);let c={};o&&(c.normalized=o),s&&(c.stem=s),l!==void 0&&(c.stemConfidence=l),Object.keys(m).length>0&&(c.metadata=m),t.push(b(n.value,this.classifyToken(n.value),C(i,i+n.length),Object.keys(c).length>0?c:void 0)),i+=n.length,a=true;break}}if(!a){let u=e[i],n=this.classifyUnknownChar(u);t.push(b(u,n,C(i,i+1))),i++;}}return new te(t,this.language)}classifyUnknownChar(e){return "()[]{},:;".includes(e)?"punctuation":"+-*/<>=!&|".includes(e)?"operator":"identifier"}tryPropertyAccess(e,t,i){if(e[t]!==".")return false;let a=i[i.length-1],u=a&&a.position.end<t;if(a&&!u&&(a.kind==="identifier"||a.kind==="keyword"||a.kind==="selector"))return i.push(b(".","operator",C(t,t+1))),true;let s=t+1;for(;s<e.length&&x(e[s]);)s++;return s<e.length&&e[s]==="("?(i.push(b(".","operator",C(t,t+1))),true):false}initializeKeywordsFromProfile(e,t=[]){let i=new Map;if(e.keywords){for(let[a,u]of Object.entries(e.keywords))if(i.set(u.primary,{native:u.primary,normalized:u.normalized||a}),u.alternatives)for(let n of u.alternatives)i.set(n,{native:n,normalized:u.normalized||a});}if(e.references){for(let[a,u]of Object.entries(e.references))i.set(u,{native:u,normalized:a});for(let a of Object.keys(e.references))i.has(a)||i.set(a,{native:a,normalized:a});}if(e.roleMarkers){for(let[a,u]of Object.entries(e.roleMarkers))if(u.primary&&i.set(u.primary,{native:u.primary,normalized:a}),u.alternatives)for(let n of u.alternatives)i.set(n,{native:n,normalized:a});}if(e.possessive?.keywords)for(let[a,u]of Object.entries(e.possessive.keywords))i.set(a,{native:a,normalized:u});for(let a of t)i.set(a.native,a);this.profileKeywords=Array.from(i.values()).sort((a,u)=>u.native.length-a.native.length),this.profileKeywordMap=new Map;for(let a of this.profileKeywords){this.profileKeywordMap.set(a.native.toLowerCase(),a);let u=this.removeDiacritics(a.native);u!==a.native&&!this.profileKeywordMap.has(u.toLowerCase())&&this.profileKeywordMap.set(u.toLowerCase(),a);}}removeDiacritics(e){return e.replace(/[\u064B-\u0652\u0670]/g,"")}tryProfileKeyword(e,t){for(let i of this.profileKeywords)if(e.slice(t).startsWith(i.native))return b(i.native,"keyword",C(t,t+i.native.length),i.normalized);return null}isKeywordStart(e,t){let i=e.slice(t);return this.profileKeywords.some(a=>i.startsWith(a.native))}lookupKeyword(e){return this.profileKeywordMap.get(e.toLowerCase())}isKeyword(e){return this.profileKeywordMap.has(e.toLowerCase())}setNormalizer(e){this.normalizer=e;}tryNormalize(e){if(!this.normalizer)return null;let t=this.normalizer.normalize(e);return t.stem!==e&&t.confidence>=.7?t:null}tryMorphKeywordMatch(e,t,i){let a=this.tryNormalize(e);if(!a)return null;let u=this.lookupKeyword(a.stem);if(!u)return null;let n={normalized:u.normalized,stem:a.stem,stemConfidence:a.confidence};return b(e,"keyword",C(t,i),n)}trySelector(e,t){let i=Lr(e,t);return i?b(i,"selector",C(t,t+i.length)):null}tryEventModifier(e,t){if(e[t]!==".")return null;let i=e.slice(t).match(/^\.(?:once|debounce|throttle|queue)(?:\(([^)]+)\))?(?:\s|$|\.)/);if(!i)return null;let a=i[0].replace(/(\s|\.)$/,""),u=a.slice(1).split("(")[0],n=i[1];return {...b(a,"event-modifier",C(t,t+a.length)),metadata:{modifierName:u,value:n?u==="queue"?n:parseInt(n,10):void 0}}}tryString(e,t){let i=Vr(e,t);return i?b(i,"literal",C(t,t+i.length)):null}tryNumber(e,t){let i=Ur(e,t);return i?b(i,"literal",C(t,t+i.length)):null}tryMatchTimeUnit(e,t,i,a=false){let u=t;if(a)for(;u<e.length&&ee(e[u]);)u++;let n=e.slice(u);for(let o of i){let s=n.slice(0,o.length);if(o.caseInsensitive?s.toLowerCase()===o.pattern.toLowerCase():s===o.pattern){if(o.notFollowedBy&&(n[o.length]||"")===o.notFollowedBy)continue;if(o.checkBoundary){let m=n[o.length]||"";if(x(m))continue}return {suffix:o.suffix,endPos:u+o.length}}}return null}parseBaseNumber(e,t,i=true){let a=t,u="";if(i&&(e[a]==="-"||e[a]==="+")&&(u+=e[a++]),a>=e.length||!M(e[a]))return null;for(;a<e.length&&M(e[a]);)u+=e[a++];if(a<e.length&&e[a]===".")for(u+=e[a++];a<e.length&&M(e[a]);)u+=e[a++];return !u||u==="-"||u==="+"?null:{number:u,endPos:a}}tryNumberWithTimeUnits(e,t,i,a={}){let{allowSign:u=true,skipWhitespace:n=false}=a,o=this.parseBaseNumber(e,t,u);if(!o)return null;let{number:s,endPos:l}=o,m=[...i,...Me.STANDARD_TIME_UNITS],c=this.tryMatchTimeUnit(e,l,m,n);return c&&(s+=c.suffix,l=c.endPos),b(s,"literal",C(t,l))}tryUrl(e,t){let i=Wr(e,t);return i?b(i,"url",C(t,t+i.length)):null}tryVariableRef(e,t){if(e[t]!==":"||t+1>=e.length||!x(e[t+1]))return null;let i=t+1;for(;i<e.length&&x(e[i]);)i++;let a=e.slice(t,i);return b(a,"identifier",C(t,i))}tryOperator(e,t){let i=e.slice(t,t+2);if(["==","!=","<=",">=","&&","||","->"].includes(i))return b(i,"operator",C(t,t+2));let a=e[t];return ["<",">","!","+","-","*","/","="].includes(a)?b(a,"operator",C(t,t+1)):["(",")","{","}",",",";",":"].includes(a)?b(a,"punctuation",C(t,t+1)):null}tryMultiCharParticle(e,t,i){for(let a of i)if(e.slice(t,t+a.length)===a)return b(a,"particle",C(t,t+a.length));return null}};Oe.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 K=Oe;function w(r){return {stem:r,confidence:1}}function y(r,e,t){return t?{stem:r,confidence:e,metadata:t}:{stem:r,confidence:e}}var Gr=Object.defineProperty,Hr=Object.getOwnPropertyNames,Je=(r,e)=>function(){return r&&(e=(0, r[Hr(r)[0]])(r=0)),e},Yr=(r,e)=>{for(var t in e)Gr(r,t,{get:e[t],enumerable:true});};function Ie(r,e){return r.replace(/\{(\w+)\}/g,(t,i)=>String(e[i]??`{${i}}`))}function B(r,e,t={},i){let a=Xe[r],u=Ie(a,t),n=Ze[r],o=n?Ie(n,t):void 0;return {code:r,message:u,severity:e,...i&&{role:i},...o&&{suggestion:o}}}var h,Xe,Ze,Jr=Je({"src/generators/schema-error-codes.ts"(){h={AMBIGUOUS_TYPE_LITERAL_SELECTOR:"SCHEMA_AMBIGUOUS_TYPE_LITERAL_SELECTOR",TOO_MANY_EXPECTED_TYPES:"SCHEMA_TOO_MANY_EXPECTED_TYPES",MULTI_TYPE_PATIENT_EXPECTED:"SCHEMA_MULTI_TYPE_PATIENT_EXPECTED",NO_REQUIRED_ROLES:"SCHEMA_NO_REQUIRED_ROLES",NO_REQUIRED_ROLES_EXPECTED:"SCHEMA_NO_REQUIRED_ROLES_EXPECTED",TRANSITION_PATIENT_ACCEPTS_SELECTOR:"SCHEMA_TRANSITION_PATIENT_ACCEPTS_SELECTOR",TRANSITION_MISSING_GOAL:"SCHEMA_TRANSITION_MISSING_GOAL",EVENT_HANDLER_MISSING_EVENT:"SCHEMA_EVENT_HANDLER_MISSING_EVENT",EVENT_HANDLER_EVENT_NOT_REQUIRED:"SCHEMA_EVENT_HANDLER_EVENT_NOT_REQUIRED",CONDITIONAL_MISSING_CONDITION:"SCHEMA_CONDITIONAL_MISSING_CONDITION",CONDITIONAL_CONDITION_NOT_REQUIRED:"SCHEMA_CONDITIONAL_CONDITION_NOT_REQUIRED",FOR_LOOP_MISSING_SOURCE:"SCHEMA_FOR_LOOP_MISSING_SOURCE",WHILE_LOOP_MISSING_CONDITION:"SCHEMA_WHILE_LOOP_MISSING_CONDITION",VALUE_TYPE_MISMATCH:"SCHEMA_VALUE_TYPE_MISMATCH",SELECTOR_KIND_MISMATCH:"SCHEMA_SELECTOR_KIND_MISMATCH",SELECTOR_KINDS_WITHOUT_SELECTOR_TYPE:"SCHEMA_SELECTOR_KINDS_WITHOUT_SELECTOR_TYPE",KEYWORD_COLLISION:"PROFILE_KEYWORD_COLLISION"},Xe={[h.AMBIGUOUS_TYPE_LITERAL_SELECTOR]:"Role '{role}' accepts both 'literal' and 'selector'. This may cause ambiguous type inference for values starting with special characters (* . # etc.).",[h.TOO_MANY_EXPECTED_TYPES]:"Role '{role}' accepts {count} different types. This may make type inference unreliable.",[h.MULTI_TYPE_PATIENT_EXPECTED]:"Role '{role}' accepts multiple types (expected for {command} command).",[h.NO_REQUIRED_ROLES]:"Command has no required roles. Is this intentional?",[h.NO_REQUIRED_ROLES_EXPECTED]:"Command has no required roles (expected for {command}).",[h.TRANSITION_PATIENT_ACCEPTS_SELECTOR]:"Transition command 'patient' role (CSS property name) should only accept 'literal', not 'selector'. CSS property names like 'background-color' are strings, not CSS selectors.",[h.TRANSITION_MISSING_GOAL]:"Transition command requires a 'goal' role for the target value (to <value>). Without it, there's no way to specify what value to transition to.",[h.EVENT_HANDLER_MISSING_EVENT]:"Event handler command should have an 'event' role to specify which event to listen for.",[h.EVENT_HANDLER_EVENT_NOT_REQUIRED]:"Event role should be required - every event handler needs an event to listen for.",[h.CONDITIONAL_MISSING_CONDITION]:"Conditional command should have a 'condition' role for the boolean expression.",[h.CONDITIONAL_CONDITION_NOT_REQUIRED]:"Condition role should be required - conditionals need a condition to evaluate.",[h.FOR_LOOP_MISSING_SOURCE]:"For-loop should have a 'source' role for the collection to iterate over.",[h.WHILE_LOOP_MISSING_CONDITION]:"While-loop should have a 'condition' role for the loop condition.",[h.VALUE_TYPE_MISMATCH]:"Role '{role}' of command '{command}' expects type [{expectedTypes}], got '{actualType}'.",[h.SELECTOR_KIND_MISMATCH]:"Role '{role}' of command '{command}' expects selector kind [{selectorKinds}], got '{actualKind}'.",[h.SELECTOR_KINDS_WITHOUT_SELECTOR_TYPE]:"Role '{role}' has selectorKinds but expectedTypes does not include 'selector'.",[h.KEYWORD_COLLISION]:"Keyword '{keyword}' is used by multiple commands: {commands}. Only the first-registered command will be reachable."},Ze={[h.AMBIGUOUS_TYPE_LITERAL_SELECTOR]:"Consider being more specific about which type is expected, or use explicit type markers.",[h.TOO_MANY_EXPECTED_TYPES]:"Consider narrowing the accepted types to improve type inference reliability.",[h.TRANSITION_PATIENT_ACCEPTS_SELECTOR]:"Remove 'selector' from expectedTypes and only accept 'literal'.",[h.TRANSITION_MISSING_GOAL]:"Add a 'goal' role with expectedTypes ['literal', 'variable'].",[h.EVENT_HANDLER_MISSING_EVENT]:"Add an 'event' role with expectedTypes ['literal'].",[h.EVENT_HANDLER_EVENT_NOT_REQUIRED]:"Set required: true on the 'event' role.",[h.CONDITIONAL_MISSING_CONDITION]:"Add a 'condition' role with expectedTypes ['expression'].",[h.CONDITIONAL_CONDITION_NOT_REQUIRED]:"Set required: true on the 'condition' role.",[h.FOR_LOOP_MISSING_SOURCE]:"Add a 'source' role for the collection to iterate over.",[h.WHILE_LOOP_MISSING_CONDITION]:"Add a 'condition' role for the loop continuation condition.",[h.VALUE_TYPE_MISMATCH]:"Ensure the value matches one of the expected types: [{expectedTypes}].",[h.SELECTOR_KIND_MISMATCH]:"Use a selector of the correct kind: [{selectorKinds}].",[h.SELECTOR_KINDS_WITHOUT_SELECTOR_TYPE]:"Either add 'selector' to expectedTypes or remove selectorKinds.",[h.KEYWORD_COLLISION]:"Give each command a unique keyword. Move the shared keyword to alternatives on one command, or use a more specific translation."};}}),Qe={};Yr(Qe,{SchemaErrorCodes:()=>h,formatValidationResults:()=>it,getValidationStats:()=>at,validateAllKeywordCollisions:()=>nt,validateAllSchemas:()=>tt,validateCommandSchema:()=>er,validateKeywordCollisions:()=>rr,validateRoleValues:()=>ut});function Xr(r,e){return {action:r,items:e}}function er(r){let e=[];for(let i of r.roles)i.expectedTypes.includes("literal")&&i.expectedTypes.includes("selector")&&(i.role==="patient"&&Ae.has(r.action)?e.push(B(h.MULTI_TYPE_PATIENT_EXPECTED,"note",{role:i.role,command:r.action},i.role)):e.push(B(h.AMBIGUOUS_TYPE_LITERAL_SELECTOR,"warning",{role:i.role},i.role))),i.expectedTypes.length>3&&!Ae.has(r.action)&&e.push(B(h.TOO_MANY_EXPECTED_TYPES,"warning",{role:i.role,count:i.expectedTypes.length},i.role));for(let i of r.roles)i.selectorKinds&&i.selectorKinds.length>0&&(i.expectedTypes.includes("selector")||e.push(B(h.SELECTOR_KINDS_WITHOUT_SELECTOR_TYPE,"warning",{role:i.role},i.role)));switch(r.action){case "transition":Zr(r,e);break;case "on":Qr(r,e);break;case "if":case "unless":et(r,e);break;case "repeat":case "for":case "while":rt(r,e);break}return r.roles.filter(i=>i.required).length===0&&(tr.has(r.action)?e.push(B(h.NO_REQUIRED_ROLES_EXPECTED,"note",{command:r.action})):e.push(B(h.NO_REQUIRED_ROLES,"warning",{}))),Xr(r.action,e)}function Zr(r,e){let t=r.roles.find(a=>a.role==="patient"),i=r.roles.find(a=>a.role==="goal");t&&t.expectedTypes.includes("selector")&&e.push(B(h.TRANSITION_PATIENT_ACCEPTS_SELECTOR,"warning",{},"patient")),t&&!i&&e.push(B(h.TRANSITION_MISSING_GOAL,"error",{}));}function Qr(r,e){let t=r.roles.find(i=>i.role==="event");t||e.push(B(h.EVENT_HANDLER_MISSING_EVENT,"warning",{})),t&&!t.required&&e.push(B(h.EVENT_HANDLER_EVENT_NOT_REQUIRED,"warning",{}));}function et(r,e){let t=r.roles.find(i=>i.role==="condition");t||e.push(B(h.CONDITIONAL_MISSING_CONDITION,"warning",{})),t&&!t.required&&e.push(B(h.CONDITIONAL_CONDITION_NOT_REQUIRED,"warning",{}));}function rt(r,e){r.action==="for"?r.roles.find(i=>i.role==="source")||e.push(B(h.FOR_LOOP_MISSING_SOURCE,"warning",{})):r.action==="while"&&(r.roles.find(i=>i.role==="condition")||e.push(B(h.WHILE_LOOP_MISSING_CONDITION,"warning",{})));}function tt(r,e={}){let t=new Map,{includeNotes:i=false}=e;for(let[a,u]of Object.entries(r)){let n=er(u),o=n.items.some(l=>l.severity==="warning"||l.severity==="error"),s=i&&n.items.some(l=>l.severity==="note");(o||s)&&t.set(a,n);}return t}function it(r,e={}){let t=[],{showNotes:i=false,showCodes:a=true}=e;for(let[u,n]of r){let o=n.items.filter(m=>m.severity==="error"),s=n.items.filter(m=>m.severity==="warning"),l=n.items.filter(m=>m.severity==="note");if(o.length>0){t.push(` \u274C ${u}:`);for(let m of o){let c=a?` [${m.code}]`:"";t.push(` ERROR${c}: ${m.message}`),m.suggestion&&t.push(` \u{1F4A1} Suggestion: ${m.suggestion}`);}}if(s.length>0){t.push(` \u26A0\uFE0F ${u}:`);for(let m of s){let c=a?` [${m.code}]`:"";t.push(` ${c?`${m.code}: `:""}${m.message}`),m.suggestion&&t.push(` \u{1F4A1} ${m.suggestion}`);}}if(i&&l.length>0){t.push(` \u2139\uFE0F ${u}:`);for(let m of l){let c=a?` [${m.code}]`:"";t.push(` ${c?`${m.code}: `:""}${m.message}`);}}}return t.join(`
2
- `)}function at(r){let e=0,t=0,i=0,a={};for(let u of r.values())for(let n of u.items)n.severity==="error"?e++:n.severity==="warning"?t++:n.severity==="note"&&i++,a[n.code]=(a[n.code]||0)+1;return {totalCommands:r.size,errors:e,warnings:t,notes:i,byCode:a}}function ut(r,e){let t=[];for(let i of e){let a=r.roles.find(u=>u.role===i.role);a&&(a.expectedTypes.length>0&&!a.expectedTypes.includes(i.type)&&(a.expectedTypes.includes("expression")||t.push({level:"error",role:i.role,message:`${r.action}.${i.role} expects type [${a.expectedTypes.join(", ")}], got '${i.type}'`,code:h.VALUE_TYPE_MISMATCH})),i.type==="selector"&&i.selectorKind&&a.selectorKinds&&a.selectorKinds.length>0&&(a.selectorKinds.includes(i.selectorKind)||t.push({level:"error",role:i.role,message:`${r.action}.${i.role} expects selector kind [${a.selectorKinds.join(", ")}], got '${i.selectorKind}'`,code:h.SELECTOR_KIND_MISMATCH})));}return t}function rr(r){let e=[];if(!r.keywords)return {language:r.code,collisions:e};let t=new Map;for(let[a,u]of Object.entries(r.keywords)){if(!u||!u.primary)continue;let n=t.get(u.primary)||[];if(n.push({command:a,isPrimary:true}),t.set(u.primary,n),u.alternatives)for(let o of u.alternatives){let s=t.get(o)||[];s.push({command:a,isPrimary:false}),t.set(o,s);}}for(let[a,u]of t){let n=[...new Set(u.map(l=>l.command))];if(n.length<=1)continue;let o=u.filter(l=>l.isPrimary).length,s;o>=2?s="primary-primary":o===1?s="primary-alternative":s="alternative-alternative",e.push({keyword:a,commands:n.sort(),type:s});}let i={"primary-primary":0,"primary-alternative":1,"alternative-alternative":2};return e.sort((a,u)=>i[a.type]-i[u.type]),{language:r.code,collisions:e}}function nt(r){let e=[];for(let[,t]of Object.entries(r)){let i=rr(t);i.collisions.length>0&&e.push(i);}return e.sort((t,i)=>t.language.localeCompare(i.language))}var Ae,tr,ot=Je({"src/generators/schema-validator.ts"(){Jr(),Ae=new Set(["put","append","prepend","log","throw","make","measure","return","swap","morph","beep","copy"]),tr=new Set(["compound","else","halt","continue","async","init","settle","focus","blur","return","js","measure","break","exit","beep","empty","open","close","select","clear","reset","breakpoint"]);}});var j=new Map,R=new Map,ie=new Map,we=null;function ir(r,e){let t={...r};for(let i of Object.keys(e)){let a=e[i],u=r[i];a!==void 0&&(typeof a=="object"&&a!==null&&!Array.isArray(a)&&typeof u=="object"&&u!==null&&!Array.isArray(u)?t[i]=ir(u,a):t[i]=a);}return t}function st(r,e){return ir(r,e)}function De(r){if(!r.extends)return r;let e=R.get(r.extends);if(!e)return console.warn(`[Registry] Profile '${r.code}' extends '${r.extends}' but base is not registered. Make sure to import the base language before the variant.`),r;let t=De(e);return st(t,r)}function J(r,e,t){j.set(r,e),R.set(r,t),ie.delete(r);}function ar(r){we=r;}var je=new Map;function H(r){return r.split("-")[0]}function Y(r){return r.includes("-")}function lt(r){let e=j.get(r);if(!e&&Y(r)){let t=H(r);e=j.get(t);}if(!e){let t=Array.from(j.keys()).join(", ");throw new Error(`Language '${r}' is not registered. Registered languages: ${t||"none"}. Import the language module first: import '@lokascript/semantic/languages/${r}';`)}return e}function mt(r){let e=R.get(r);if(!e&&Y(r)){let t=H(r);e=R.get(t);}if(!e){let t=Array.from(R.keys()).join(", ");throw new Error(`Language profile '${r}' is not registered. Registered languages: ${t||"none"}. Import the language module first: import '@lokascript/semantic/languages/${r}';`)}return De(e)}function L(r){let e=R.get(r);return !e&&Y(r)&&(e=R.get(H(r))),e?De(e):void 0}function ct(){return Array.from(j.keys())}function ur(r){if(j.has(r)&&R.has(r))return true;if(Y(r)){let e=H(r);return j.has(e)&&R.has(e)}return false}function pt(r,e){return lt(e).tokenize(r)}function G(r){let e=ie.get(r);if(!e&&Y(r)&&(e=ie.get(H(r))),e)return e;let t=je.get(r);if(!t&&Y(r)&&(t=je.get(H(r))),t)return ie.set(r,t),t;if(!we)throw new Error(`No patterns registered for language '${r}'. Either import the language module or set a pattern generator.`);let i=mt(r),a=we(i);return ie.set(r,a),a}function ue(r){let e="complex";return r.startsWith("#")&&!r.includes(" ")?e="id":r.startsWith(".")&&!r.includes(" ")?e="class":r.startsWith("[")&&r.endsWith("]")?e="attribute":/^[a-z][a-z0-9]*$/i.test(r)&&(e="element"),{type:"selector",value:r,selectorKind:e}}function A(r,e){let t={type:"literal",value:r};return e!==void 0?{type:"literal",value:r,dataType:e}:t}function Le(r){return ke(r)}function I(r){return {type:"reference",value:r}}function Ce(r,e){return {type:"property-path",object:r,property:e}}function de(r,e,t){let i={kind:"command",action:r,roles:new Map(Object.entries(e))};return t!==void 0?{...i,metadata:t}:i}function $e(r,e,t,i,a,u){let n=new Map;n.set("event",r);let o={kind:"event-handler",action:"on",roles:n,body:e};return t!==void 0&&(o.eventModifiers=t),i!==void 0&&(o.metadata=i),o}function Ve(r,e="then",t){let i={kind:"compound",action:"compound",roles:new Map,statements:r,chainType:e};return t!==void 0&&(i.metadata=t),i}function qe(r,e){return !e||e.length===0||e.includes(r)||e.includes("expression")?true:r==="property-path"?e.some(t=>["selector","reference","expression"].includes(t)):false}function It(r,e){return r.possessive?.keywords?.[e]}var be=.8,jt=.6,Lt=.15,$t=.5,We=.15,Ue=.1,Ke=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"]),Vt={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"]},qt=class{calculate(r){return this.calculateWithBreakdown(r).final}calculateWithBreakdown(r){let e=this.scoreRoleCoverage(r),t=this.scoreStemPenalty(r),i=this.scoreLanguageBoost(r),a=this.scoreLanguageAdjustment(r),u=e;return u=Math.max($t,u+t),u=Math.min(1,u+i),u=Math.max(0,Math.min(1,u+a)),{roleCoverage:e,stemPenalty:t,languageBoost:i,languageAdjustment:a,final:u}}scoreRoleCoverage(r){let{pattern:e,captured:t}=r,i=0,a=0,u=n=>e.extraction?.[n]?.default!==void 0;for(let n of e.template.tokens)if(n.type==="role")a+=1,t.has(n.role)&&(i+=1);else if(n.type==="group")for(let o of n.tokens)o.type==="role"&&(a+=be,t.has(o.role)?i+=be:u(o.role)&&(i+=be*jt));return a>0?i/a:1}scoreStemPenalty(r){let{stemMatchCount:e,totalKeywordMatches:t}=r;return e<=0||t<=0?0:-(e/t)*Lt}scoreLanguageBoost(r){let{pattern:e}=r;if(e.language!=="ar")return 0;let t=e.template.tokens[0];return !t||t.type!=="literal"?0:Ke.has(t.value)||t.alternatives?.some(i=>Ke.has(i))?We:0}scoreLanguageAdjustment(r){let{pattern:e,captured:t}=r;if(e.language!=="ar")return 0;let i=0;for(let[a,u]of t.entries()){let n=Vt[a];if(!n||n.length===0)continue;let o="metadata"in u?u.metadata:void 0;o&&typeof o.prepositionValue=="string"&&(n.includes(o.prepositionValue)?i+=.1:i-=.1);}return Math.max(-Ue,Math.min(Ue,i))}},Wt=new qt,fe=class ae{constructor(e){this.matchCache=new Map,this.stemMatchCount=0,this.totalKeywordMatches=0,this.confidenceModel=e??Wt;}matchPattern(e,t){let i=e.mark(),a=new Map;if(this.currentProfile=L(t.language),this.stemMatchCount=0,this.totalKeywordMatches=0,!this.matchTokenSequence(e,t.template.tokens,a))return e.reset(i),null;let n=this.confidenceModel.calculate({pattern:t,captured:a,stemMatchCount:this.stemMatchCount,totalKeywordMatches:this.totalKeywordMatches});return this.applyExtractionRules(t,a),{pattern:t,captured:a,consumedTokens:e.position()-i.position,confidence:n}}matchBest(e,t){this.matchCache.clear();let i=[],a=e.position();for(let n of t){let o=e.mark(),s=`${a}:${n.id}`,l;this.matchCache.has(s)?l=this.matchCache.get(s):(l=this.matchPattern(e,n),this.matchCache.set(s,l)),l&&i.push(l),e.reset(o);}if(i.length===0)return null;i.sort((n,o)=>{let s=o.pattern.priority-n.pattern.priority;return s!==0?s:o.confidence-n.confidence});let u=i[0];return this.matchPattern(e,u.pattern),u}matchTokenSequence(e,t,i){let a=t[0],u=a?.type==="literal"&&(a.value==="and"||a.value==="then"||a.alternatives?.includes("and")||a.alternatives?.includes("then"));if(this.currentProfile?.code==="ar"&&!u)for(;e.peek()?.kind==="conjunction";)e.advance();for(let n of t)if(!this.matchPatternToken(e,n,i)){if(this.isOptional(n))continue;return false}return true}matchPatternToken(e,t,i){switch(t.type){case "literal":return this.matchLiteralToken(e,t);case "role":return this.matchRoleToken(e,t,i);case "group":return this.matchGroupToken(e,t,i);default:return false}}matchLiteralToken(e,t){let i=e.peek();if(!i)return false;let a=this.getMatchType(i,t.value);if(a!=="none")return this.totalKeywordMatches++,a==="stem"&&this.stemMatchCount++,e.advance(),true;if(t.alternatives)for(let u of t.alternatives){let n=this.getMatchType(i,u);if(n!=="none")return this.totalKeywordMatches++,n==="stem"&&this.stemMatchCount++,e.advance(),true}return false}matchRoleToken(e,t,i){this.skipNoiseWords(e);let a=e.peek();if(!a)return t.optional||false;let u=this.tryMatchPossessiveExpression(e);if(u)return t.expectedTypes&&t.expectedTypes.length>0&&!t.expectedTypes.includes(u.type)&&!t.expectedTypes.includes("expression")?t.optional||false:(i.set(t.role,u),true);let n=this.tryMatchMethodCallExpression(e);if(n)return t.expectedTypes&&t.expectedTypes.length>0&&!t.expectedTypes.includes(n.type)&&!t.expectedTypes.includes("expression")?t.optional||false:(i.set(t.role,n),true);let o=this.tryMatchPossessiveSelectorExpression(e);if(o)return t.expectedTypes&&t.expectedTypes.length>0&&!qe(o.type,t.expectedTypes)?t.optional||false:(i.set(t.role,o),true);let s=this.tryMatchPropertyAccessExpression(e);if(s)return t.expectedTypes&&t.expectedTypes.length>0&&!t.expectedTypes.includes(s.type)&&!t.expectedTypes.includes("expression")?t.optional||false:(i.set(t.role,s),true);let l=this.tryMatchSelectorPropertyExpression(e);if(l)return t.expectedTypes&&t.expectedTypes.length>0&&!qe(l.type,t.expectedTypes)?t.optional||false:(i.set(t.role,l),true);let m=this.tokenToSemanticValue(a);return !m||t.expectedTypes&&t.expectedTypes.length>0&&!t.expectedTypes.includes(m.type)?t.optional||false:(i.set(t.role,m),e.advance(),true)}tryMatchPossessiveExpression(e){let t=e.peek();if(!t||!this.currentProfile)return null;let i=(t.normalized||t.value).toLowerCase(),a=It(this.currentProfile,i);if(!a)return null;let u=e.mark();e.advance();let n=e.peek();if(!n)return e.reset(u),null;if(n.kind==="identifier"||n.kind==="keyword"&&!this.isStructuralKeyword(n.value)||n.kind==="selector"&&n.value.startsWith("*")||n.kind==="selector"&&n.value.startsWith("@")||n.kind==="selector"&&n.value.startsWith(".")&&/^\.[a-zA-Z_]\w*/.test(n.value)){e.advance();let o=n.value;n.kind==="selector"&&o.startsWith(".")&&/^\.[a-zA-Z_]\w*/.test(o)&&(o=o.substring(1));let s=o;for(;e.peek()?.kind==="selector"&&e.peek().value.startsWith(".")&&/^\.[a-zA-Z_]\w*/.test(e.peek().value);)s+=e.peek().value,e.advance();let l=e.peek();return l?.kind==="literal"&&l.value.startsWith("(")&&(s+=l.value,e.advance()),Ce(I(a),s)}return e.reset(u),null}isStructuralKeyword(e){return new Set(["into","in","to","from","at","by","with","without","before","after","of","as","on","then","end","else","if","repeat","while","for","toggle","add","remove","put","set","show","hide","increment","decrement","send","trigger","call"]).has(e.toLowerCase())}tryMatchMethodCallExpression(e){let t=e.peek();if(!t||t.kind!=="selector")return null;let i=e.mark();e.advance();let a=e.peek();if(!a||a.kind!=="operator"||a.value!==".")return e.reset(i),null;e.advance();let u=e.peek();if(!u||u.kind!=="identifier")return e.reset(i),null;e.advance();let n=e.peek();if(!n||n.kind!=="punctuation"||n.value!=="(")return e.reset(i),null;e.advance();let o=[];for(;!e.isAtEnd()&&o.length<ae.MAX_METHOD_ARGS;){let l=e.peek();if(!l)break;if(l.kind==="punctuation"&&l.value===")"){e.advance();break}if(l.kind==="punctuation"&&l.value===","){e.advance();continue}o.push(l.value),e.advance();}return {type:"expression",raw:`${t.value}.${u.value}(${o.join(", ")})`}}tryMatchPropertyAccessExpression(e){let t=e.peek();if(!t||t.kind!=="identifier"&&t.kind!=="keyword")return null;let i=e.mark();e.advance();let a=e.peek();if(!a||a.kind!=="operator"||a.value!==".")return e.reset(i),null;e.advance();let u=e.peek();if(!u||u.kind!=="identifier")return e.reset(i),null;e.advance();let n=`${t.value}.${u.value}`,o=1;for(;!e.isAtEnd()&&o<ae.MAX_PROPERTY_DEPTH;){let l=e.peek();if(!l||l.kind!=="operator"||l.value!==".")break;e.advance();let m=e.peek();if(!m||m.kind!=="identifier")break;e.advance(),n+=`.${m.value}`,o++;}let s=e.peek();if(s&&s.kind==="punctuation"&&s.value==="("){e.advance();let l=[],m=0;for(;!e.isAtEnd()&&l.length<ae.MAX_METHOD_ARGS;){let p=e.peek();if(!p)break;if(p.kind==="punctuation"&&p.value===")"){if(m===0){e.advance();break}m--;}if(p.kind==="punctuation"&&p.value==="("&&m++,p.kind==="punctuation"&&p.value===","){e.advance();continue}l.push(p.value),e.advance();}return {type:"expression",raw:`${n}(${l.join(", ")})`}}return {type:"expression",raw:n}}tryMatchPossessiveSelectorExpression(e){let t=e.peek();if(!t||t.kind!=="selector")return null;let i=e.mark();e.advance();let a=e.peek();if(!a||a.kind!=="punctuation"||a.value!=="'s")return e.reset(i),null;e.advance();let u=e.peek();return !u||u.kind!=="selector"&&u.kind!=="identifier"?(e.reset(i),null):(e.advance(),Ce(ue(t.value),u.value))}tryMatchSelectorPropertyExpression(e){let t=e.peek();if(!t||t.kind!=="selector"||!t.value.startsWith("#"))return null;let i=e.mark();e.advance();let a=e.peek();if(!a||a.kind!=="selector"||!a.value.startsWith("."))return e.reset(i),null;let u=e.peek(1);u&&u.kind,e.advance();let n=a.value.slice(1);return Ce(ue(t.value),n)}matchGroupToken(e,t,i){let a=e.mark(),u=new Set(i.keys());if(!this.matchTokenSequence(e,t.tokens,i)){e.reset(a);for(let o of i.keys())u.has(o)||i.delete(o);return t.optional||false}return true}getMatchType(e,t){return e.value===t?"exact":e.normalized===t?"normalized":e.stem===t&&e.stemConfidence!==void 0&&e.stemConfidence>=.7?"stem":e.kind==="keyword"&&e.value.toLowerCase()===t.toLowerCase()?"case-insensitive":"none"}tokenToSemanticValue(e){switch(e.kind){case "selector":return ue(e.value);case "literal":return this.parseLiteralValue(e.value);case "keyword":let t=(e.normalized||e.value).toLowerCase();return Le(t)?I(t):A(e.normalized||e.value);case "identifier":if(e.value.startsWith(":"))return I(e.value);let i=e.value.toLowerCase();return Le(i)?I(i):{type:"expression",raw:e.value};case "url":return A(e.value,"string");default:return null}}parseLiteralValue(e){if(e.startsWith('"')||e.startsWith("'")||e.startsWith("`")||e.startsWith("\u300C")){let a=e.slice(1,-1);return A(a,"string")}if(e==="true")return A(true,"boolean");if(e==="false")return A(false,"boolean");let t=e.match(/^(\d+(?:\.\d+)?)(ms|s|m|h)?$/);if(t){let a=parseFloat(t[1]);return t[2]?A(e,"duration"):A(a,"number")}let i=parseFloat(e);return isNaN(i)?A(e,"string"):A(i,"number")}applyExtractionRules(e,t){for(let[i,a]of Object.entries(e.extraction))t.has(i)||(a.value!==void 0?t.set(i,{type:"literal",value:a.value}):a.default&&t.set(i,a.default));}isOptional(e){return e.type!=="literal"&&e.optional===true}skipNoiseWords(e){let t=e.peek();if(!t)return;let i=t.value.toLowerCase();if(ae.ENGLISH_NOISE_WORDS.has(i)){let a=e.mark();e.advance();let u=e.peek();if(u&&(u.kind==="selector"||u.kind==="identifier"))return;e.reset(a);}i==="class"&&e.advance();}extractEventModifiers(e){let t={},i=false;for(;!e.isAtEnd();){let a=e.peek();if(!a||a.kind!=="event-modifier")break;let u=a.metadata;if(!u)break;switch(i=true,u.modifierName){case "once":t.once=true;break;case "debounce":typeof u.value=="number"&&(t.debounce=u.value);break;case "throttle":typeof u.value=="number"&&(t.throttle=u.value);break;case "queue":(u.value==="first"||u.value==="last"||u.value==="all"||u.value==="none")&&(t.queue=u.value);break}e.advance();}return i?t:void 0}};fe.MAX_PROPERTY_DEPTH=10;fe.MAX_METHOD_ARGS=20;fe.ENGLISH_NOISE_WORDS=new Set(["the","a","an"]);var Ut=fe,O=new Ut;function ne(r,e){return pt(r,e)}function nr(){return ct()}var Kt={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 Ht={action:"toggle",description:"Toggle a class or attribute on/off",category:"dom-class",primaryRole:"patient",roles:[{role:"patient",description:"The class or attribute to toggle",required:true,expectedTypes:["selector"],selectorKinds:["class","attribute"],svoPosition:1,sovPosition:2},{role:"destination",description:"The target element (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:2,sovPosition:1}],errorCodes:["MISSING_ARGUMENT","NO_VALID_CLASS_NAMES","INVALID_CSS_PROPERTY"],preconditions:[{condition:"Command has at least one argument",errorCode:"MISSING_ARGUMENT",message:"toggle command requires an argument"},{condition:"Class names are valid CSS identifiers",errorCode:"NO_VALID_CLASS_NAMES",message:"toggle command: no valid class names found"}],recoveryHints:{MISSING_ARGUMENT:"Add a class selector (.classname) or attribute to toggle",NO_VALID_CLASS_NAMES:"Ensure class names start with a dot (.) and are valid CSS identifiers",INVALID_CSS_PROPERTY:"Check CSS property name syntax (use kebab-case)"}},Yt={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"}},Jt={action:"remove",description:"Remove a class or attribute from an element",category:"dom-class",primaryRole:"patient",targetRole:"source",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"}},Xt={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"},markerVariants:{en:["before","after"]},methodCarrier:"method"}],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"}},Zt={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>"}},Qt={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}]},ei={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}]},ri={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}]},ti={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}]},ii={action:"wait",description:"Wait for a duration or event",category:"async",primaryRole:"duration",roles:[{role:"duration",description:"Duration or event to wait for",required:true,expectedTypes:["literal","expression"],svoPosition:1,sovPosition:1}]},ai={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,markerOverride:{en:"as"}},{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}]},ui={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"}}]},ni={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"}}]},oi={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"}}]},si={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}]},mi={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}]},ci={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}]},pi={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}]},di={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}]},yi={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}]},fi={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}]},hi={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}]},Ei={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}]},gi={action:"else",description:"Else branch of conditional",category:"control-flow",primaryRole:"patient",hasBody:true,roles:[]},zi={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"'},ki={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"}}]},Ci={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}]},bi={action:"continue",description:"Continue to next loop iteration",category:"control-flow",primaryRole:"patient",roles:[]},Ai={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:""}}]},wi={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}]},Di={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"}}]},xi={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}]},Bi={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}]},Fi={action:"empty",description:"Remove all children from an element (sets innerHTML to empty)",category:"dom-content",primaryRole:"patient",roles:[{role:"patient",description:"The element to empty (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:1,sovPosition:1}]},Si={action:"open",description:"Open a dialog, details element, or popover",category:"dom-content",primaryRole:"patient",roles:[{role:"patient",description:"The element to open (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:2,sovPosition:2},{role:"style",description:"Open-mode variant (modal / non-modal) for <dialog>",required:false,expectedTypes:["literal","expression"],svoPosition:1,sovPosition:1,markerOverride:{en:"as"}}]},Ti={action:"close",description:"Close a dialog, details element, or popover",category:"dom-content",primaryRole:"patient",roles:[{role:"patient",description:"The element to close (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:1,sovPosition:1}]},Pi={action:"select",description:"Select the contents of a text field or DOM element",category:"dom-content",primaryRole:"patient",roles:[{role:"patient",description:"The element whose contents to select (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:1,sovPosition:1}]},Ri={action:"clear",description:"Clear a variable, local, or input element",category:"variable",primaryRole:"patient",roles:[{role:"patient",description:"The variable or element to clear (defaults to me)",required:false,expectedTypes:["selector","reference","expression"],default:{type:"reference",value:"me"},svoPosition:1,sovPosition:1}]},Ni={action:"reset",description:"Reset a <form> element to its default values",category:"dom-content",primaryRole:"patient",roles:[{role:"patient",description:"The form element to reset (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:1,sovPosition:1}]},_i={action:"breakpoint",description:"Drop into the debugger",category:"control-flow",primaryRole:"patient",roles:[]},Oi={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}]},Mi={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}]},Ii={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}]},ji={action:"async",description:"Execute commands asynchronously",category:"async",primaryRole:"patient",hasBody:true,roles:[]},Li={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:""}}]},$i={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"}}]},Vi={action:"init",description:"Initialization block that runs once",category:"control-flow",primaryRole:"patient",hasBody:true,roles:[]},qi={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}]},Wi={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}]},Ui={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"}}]},Ki={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"}}]},Gi={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"}}]},Hi={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}]},Yi={action:"break",description:"Exit from the current loop",category:"control-flow",primaryRole:"patient",roles:[]},Ji={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}]},Xi={action:"exit",description:"Exit from the current event handler",category:"control-flow",primaryRole:"patient",roles:[]},Zi={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}]},Qi={action:"scroll",description:"Scroll the viewport to a target element",category:"navigation",primaryRole:"destination",argSkipTokens:["of","the","top","bottom","middle","center","nearest","left","right","smoothly","instantly"],roles:[{role:"destination",description:"The element to scroll to",required:true,expectedTypes:["selector","reference"],svoPosition:1,sovPosition:1,markerOverride:{en:"to"}}]},or={en:"url",es:"url",pt:"url",fr:"url",de:"url",it:"url",ja:"url",ko:"url",zh:"url",ar:"url",he:"url",hi:"url",bn:"url",tr:"url",ru:"url",uk:"url",pl:"url",id:"url",vi:"url",th:"url",ms:"url",tl:"url",sw:"url",qu:"url"},ea={en:"partials in",es:"partials in",pt:"partials in",fr:"partials in",de:"partials in",it:"partials in",ja:"partials in",ko:"partials in",zh:"partials in",ar:"partials in",he:"partials in",hi:"partials in",bn:"partials in",tr:"partials in",ru:"partials in",uk:"partials in",pl:"partials in",id:"partials in",vi:"partials in",th:"partials in",ms:"partials in",tl:"partials in",sw:"partials in",qu:"partials in"},ra={action:"push",description:"Push a URL onto the browser history",category:"navigation",primaryRole:"patient",roles:[{role:"patient",description:"The URL to push (after the `url` keyword)",required:true,expectedTypes:["literal","expression"],svoPosition:1,sovPosition:1,markerOverride:or}]},ta={action:"replace",description:"Replace the current browser history entry with a URL",category:"navigation",primaryRole:"patient",roles:[{role:"patient",description:"The URL to replace with (after the `url` keyword)",required:true,expectedTypes:["literal","expression"],svoPosition:1,sovPosition:1,markerOverride:or}]},ia={action:"process",description:"Process hx-partial markup in HTML content",category:"dom-content",primaryRole:"patient",roles:[{role:"patient",description:"The HTML content (string, element, or response) to process",required:true,expectedTypes:["literal","reference","expression"],svoPosition:1,sovPosition:1,markerOverride:ea}]},aa={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}]},sr={toggle:Ht,add:Yt,remove:Jt,put:Xt,set:Zt,show:Qt,hide:ei,on:ri,trigger:ti,wait:ii,fetch:ai,increment:ui,decrement:ni,append:oi,prepend:si,log:li,get:mi,take:ci,make:pi,halt:di,settle:yi,throw:fi,send:hi,if:vi,unless:Ei,else:gi,repeat:zi,for:ki,while:Ci,continue:bi,go:Ai,scroll:Qi,push:ra,replace:ta,process:ia,transition:wi,clone:Di,focus:xi,blur:Bi,empty:Fi,open:Si,close:Ti,select:Pi,clear:Ri,reset:Ni,breakpoint:_i,call:Oi,return:Mi,js:Ii,async:ji,tell:Li,default:$i,init:Vi,behavior:qi,install:Wi,measure:Ui,swap:Ki,morph:Gi,beep:Hi,break:Yi,copy:Ji,exit:Xi,pick:Zi,render:aa,compound:{action:"compound",description:"A compound node representing chained statements",primaryRole:"patient",category:"control-flow",hasBody:true,roles:[]}};function ua(){return Object.values(sr).filter(r=>r.roles.length>0)}typeof process<"u"&&process.env.NODE_ENV!=="production"&&Promise.resolve().then(()=>(ot(),Qe)).then(({validateAllSchemas:r,formatValidationResults:e})=>{let t=r(sr);t.size>0&&(console.warn("[SCHEMA VALIDATION] Found issues in command schemas:"),console.warn(e(t)),console.warn(`
3
- These warnings help identify potential schema design issues.`),console.warn("Fix them to improve type inference and avoid runtime bugs."));}).catch(r=>{console.debug("Schema validation skipped:",r);});var Ge=class extends Error{constructor(r,e,t,i){super(r),this.name="SemanticParseError",this.language=e,this.input=t,this.diagnostics=i;}};function T(r,e,t){return {message:r,severity:e,source:"semantic-parser",...t&&{code:t}}}function ye(r,e){return e.length===0?r:{...r,diagnostics:e}}var X=class P{parse(e,t){let{modifiers:i,remainingInput:a}=this.extractStandaloneModifiers(e,t),u=a||e,n=[],o=ne(u,t),s=G(t);if(s.length===0)throw new Ge(`No patterns available for language: ${t}`,t,u,[T(`No patterns registered for language '${t}'`,"error","no-patterns")]);let l=[...s].sort((v,g)=>g.priority-v.priority),m=l.filter(v=>v.command==="on"),c=O.matchBest(o,m);if(c){n.push(T(`event pattern matched: ${c.pattern.id} (confidence: ${c.confidence.toFixed(2)})`,"info","pattern-match"));let v=this.buildEventHandler(c,o,t),g=i?this.applyModifiers(v,i):v;return ye(g,n)}n.push(T(`event patterns: ${m.length} tried, no match`,"info","stage-event"));let p=l.filter(v=>v.command!=="on"),d=O.matchBest(o,p);if(d)return n.push(T(`command pattern matched: ${d.pattern.id} (confidence: ${d.confidence.toFixed(2)})`,"info","pattern-match")),ye(this.buildCommand(d,t),n);n.push(T(`command patterns: ${p.length} tried, no match`,"info","stage-command"));let f=this.trySOVEventExtraction(u,t,l);if(f){n.push(T("SOV event extraction succeeded","info","stage-sov"));let v=i?this.applyModifiers(f,i):f;return ye(v,n)}n.push(T("SOV event extraction: no event keyword found","info","stage-sov"));let E=this.tryCompoundCommandParsing(o,p,t);if(E)return n.push(T("compound command parsing succeeded","info","stage-compound")),ye(E,n);throw n.push(T("compound parsing: no then-keywords or no command matches","info","stage-compound")),n.push(T(`all parse stages exhausted for "${u}"`,"error","parse-failed")),new Ge(`Could not parse input in ${t}: ${u}`,t,u,n)}canParse(e,t){try{return this.parse(e,t),!0}catch{return false}}supportedLanguages(){return nr()}buildCommand(e,t){if(!e)throw new Error("No match to build command from");let i={};for(let[a,u]of e.captured)i[a]=u;return de(e.pattern.command,i,{sourceLanguage:t,patternId:e.pattern.id,confidence:e.confidence})}buildEventHandler(e,t,i){if(!e)throw new Error("No match to build event handler from");let a=e.captured.get("event");if(!a)throw new Error("Event handler pattern matched but no event captured");let u=O.extractEventModifiers(t),n=this.extractOrConjunctionEvents(t,i),o=a;n.length>0&&a.type==="literal"&&(o={type:"literal",value:[String(a.value),...n.map(c=>String("value"in c?c.value:""))].join(" or ")});let s,l=e.captured.get("action");if(l&&l.type==="literal"){let m=l.value,c={};for(let[f,E]of e.captured)f!=="event"&&f!=="action"&&f!=="continues"&&(c[f]=E);let p=de(m,c,{sourceLanguage:i,patternId:e.pattern.id,confidence:e.confidence}),d=e.captured.get("continues");if(d&&d.type==="literal"&&d.value==="then"){let f=G(i).filter(g=>g.command!=="on").sort((g,k)=>k.priority-g.priority),E=G(i).filter(g=>g.id.startsWith("grammar-")&&g.id.includes("-continuation")).sort((g,k)=>k.priority-g.priority),v=this.parseBodyWithGrammarPatterns(t,f,E,i);v.length>0?s=[p,...v]:s=[p];}else s=[p];}else {let m=G(i).filter(c=>c.command!=="on").sort((c,p)=>p.priority-c.priority);s=this.parseBodyWithClauses(t,m,i);}return $e(o,s,u,{sourceLanguage:i,patternId:e.pattern.id,confidence:e.confidence})}parseBodyWithClauses(e,t,i){let a=[],u=[];for(;!e.isAtEnd();){let n=e.peek();if(!n)break;let o=n.kind==="conjunction"||n.kind==="keyword"&&this.isThenKeyword(n.value,i),s=n.kind==="keyword"&&this.isEndKeyword(n.value,i);if(o){if(u.length>0){let l=this.parseClause(u,t,i);a.push(...l),u.length=0;}e.advance();continue}if(s){if(u.length>0){let l=this.parseClause(u,t,i);a.push(...l);}e.advance();break}u.push(n),e.advance();}if(u.length>0){let n=this.parseClause(u,t,i);a.push(...n);}return a.length>1?[Ve(a,"then",{sourceLanguage:i})]:a}parseClause(e,t,i){if(e.length===0)return [];let a=new te(e,i),u=[];for(;!a.isAtEnd();){let n=O.matchBest(a,t);n?u.push(this.buildCommand(n,i)):a.advance();}if(u.length===0){let n=this.parseSOVClauseByVerbAnchoring(e,i);if(n.length>0)return n}return u}static buildVerbLookup(e){let t=new Map;for(let[i,a]of Object.entries(e.keywords))if(!["on","if","else","when","where","while","for","end","then","and"].includes(i)&&(t.set(a.primary.toLowerCase(),i),a.alternatives))for(let u of a.alternatives)t.set(u.toLowerCase(),i);return t}static buildMarkerToRoleLookup(e){let t=new Map;for(let[i,a]of Object.entries(e.roleMarkers))if(a&&(t.set(a.primary,i),a.alternatives))for(let u of a.alternatives)t.has(u)||t.set(u,i);return t}parseSOVClauseByVerbAnchoring(e,t){let i=L(t);if(!i||i.wordOrder!=="SOV")return [];let a=P.buildVerbLookup(i),u=P.buildMarkerToRoleLookup(i),n=[],o=0;for(;o<e.length;){let s=-1,l="";for(let f=o;f<e.length;f++){let E=e[f],v=a.get(E.value.toLowerCase()),g=E.normalized?a.get(E.normalized.toLowerCase()):void 0,k=v||g;if(k){s=f,l=k;break}}if(s===-1)break;let m=e.slice(o,s),c=e.length;for(let f=s+1;f<e.length;f++){let E=e[f];if(E.kind==="conjunction"||this.isThenKeyword(E.value,t)){c=f;break}if(f>s+1&&(a.get(E.value.toLowerCase())||(E.normalized?a.get(E.normalized.toLowerCase()):void 0))){c=f;break}}let p=e.slice(s+1,c),d=this.extractRolesFromMarkedTokens(m,p,u,l,t);if(n.push(de(l,d,{sourceLanguage:t,confidence:.7})),o=c,o<e.length){let f=e[o];(f.kind==="conjunction"||this.isThenKeyword(f.value,t))&&o++;}}return n}extractRolesFromMarkedTokens(e,t,i,a,u){let n={},o=s=>{let l=[];for(let m of s){let c=i.get(m.value);if(c&&m.kind==="particle"&&l.length>0){let p=this.tokensToSemanticValue(l);if(p){let d=this.mapRoleForCommand(c,a,n);d&&(n[d]=p);}l=[];}else l.push(m);}if(l.length>0){let m=this.tokensToSemanticValue(l);m&&(n.patient?n.destination||(n.destination=m):n.patient=m);}};return o(e),o(t),n}mapRoleForCommand(e,t,i){return i[e]?e==="patient"&&!i.destination?"destination":e==="destination"&&!i.patient?"patient":e==="source"&&!i.source?"source":null:e}tokensToSemanticValue(e){if(e.length===0)return null;let t=e.filter(u=>u.kind!=="whitespace");if(t.length===0)return null;if(t.length===1)return this.tokenToSemanticValue(t[0]);let i=t.map(u=>u.value).join(""),a=t[0];return a.kind==="selector"||a.value.startsWith("#")||a.value.startsWith(".")||a.value.startsWith("@")||a.value.startsWith("*")?ue(i):a.kind==="literal"||a.value.startsWith('"')||a.value.startsWith("'")?A(i):a.kind==="reference"?I(i):A(i)}tokenToSemanticValue(e){let t=e.value;if(e.kind==="selector"||t.startsWith("#")||t.startsWith(".")||t.startsWith("@")||t.startsWith("*"))return ue(t);if(t.startsWith('"')||t.startsWith("'"))return A(t);if(/^-?\d+(\.\d+)?$/.test(t))return A(parseFloat(t));if(t==="true"||t==="\u771F"||t==="\uCC38"||t==="do\u011Fru")return A(true);if(t==="false"||t==="\u507D"||t==="\uAC70\uC9D3"||t==="yanl\u0131\u015F")return A(false);let i=e.normalized?.toLowerCase();return i==="me"||i==="it"||i==="you"||i==="result"||i==="body"?I(i):e.kind==="reference"?I(e.normalized||"me"):A(t)}parseBodyWithGrammarPatterns(e,t,i,a){let u=[];for(;!e.isAtEnd();){let n=e.peek();if(n&&this.isThenKeyword(n.value,a)){e.advance();continue}if(n&&this.isEndKeyword(n.value,a)){e.advance();break}let o=false;if(i.length>0){let s=O.matchBest(e,i);if(s){let l=s.pattern.command,m={};for(let[d,f]of s.captured)d!=="event"&&d!=="action"&&d!=="continues"&&(m[d]=f);let c=de(l,m,{sourceLanguage:a,patternId:s.pattern.id});u.push(c),o=true;let p=s.captured.get("continues");if(p&&p.type==="literal"&&p.value==="then")continue}}if(!o){let s=O.matchBest(e,t);s&&(u.push(this.buildCommand(s,a)),o=true);}o||e.advance();}return u}tryCompoundCommandParsing(e,t,i){let a=e.tokens;if(!a.some(s=>s.kind==="conjunction"||s.kind==="keyword"&&this.isThenKeyword(s.value,i)))return null;let n=new te(a,i),o=this.parseBodyWithClauses(n,t,i);return o.length===0?null:o.length===1?o[0]:Ve(o,"then",{sourceLanguage:i,confidence:.65})}trySOVEventExtraction(e,t,i){let a=P.SOV_EVENT_MARKERS[t];if(!a)return null;let n=ne(e,t).tokens,o=Kt[t],s=new Set;if(o)for(let z of Object.keys(o))s.add(z.toLowerCase());let l=P.SOV_SOURCE_MARKERS[t],m=-1,c="",p="",d=1;for(let z=0;z<n.length;z++){let D=n[z],N=D.value.toLowerCase(),_=N,$="",Ee=N.indexOf("[");Ee>0&&(_=N.slice(0,Ee),$=D.value.slice(Ee));let ge=D.normalized?.toLowerCase(),Te=ge&&P.KNOWN_EVENTS.has(ge),Pe=s.has(N)||s.has(_),Fr=P.KNOWN_EVENTS.has(_);if(Te||Pe||Fr){let Z;if(Te?Z=ge:Pe?Z=o?.[N]??o?.[_]??_:Z=_,a.size>0){let le=1,ze=n[z+1];ze&&ze.kind==="selector"&&ze.value.startsWith("[")&&(le=2);let me=n[z+le];if(me&&(me.kind==="particle"||me.kind==="keyword")&&a.has(me.value)){m=z,c=Z,p=$||(le===2?n[z+1].value:""),d=le+1;break}}else {m=z,c=Z,p=$,d=1;break}}}if(m===-1)return null;let f=new Set;for(let z=m;z<m+d;z++)f.add(z);if(l){let z=m+d;if(z<n.length){let D=n[z];(D.kind==="particle"||D.kind==="keyword")&&l.markers.has(D.value)&&f.add(z);}for(let D=0;D<m;D++){let N=n[D],_=N.value.toLowerCase(),$=N.normalized?.toLowerCase();if(l.windowTokens.has(_)||$&&l.windowTokens.has($)){f.add(D);break}}}let E=n.filter((z,D)=>!f.has(D));if(E.length===0)return null;let v=i.filter(z=>z.command!=="on"),g=new te(E,t),k=this.parseBodyWithClauses(g,v,t);if(k.length===0)return null;let Se={sourceLanguage:t,confidence:.75};return p&&(Se.keyFilter=p),$e({type:"literal",value:c},k,void 0,Se)}isThenKeyword(e,t){let i={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 (i[t]||i.en).has(e.toLowerCase())}isEndKeyword(e,t){let i={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 (i[t]||i.en).has(e.toLowerCase())}extractStandaloneModifiers(e,t){let a=ne(e,t).tokens;if(a.length===0)return {modifiers:null,remainingInput:null};let n=a[0].value.toLowerCase(),o=P.STANDALONE_MODIFIERS[n];if(!o)return {modifiers:null,remainingInput:null};let s={},l=1;if(o==="once")s.once=true;else {let d=1;if(d<a.length){let f=a[d];(f.kind==="keyword"||f.kind==="particle")&&(d++,l++);}if(d<a.length){let f=a[d];if(f.kind==="literal"){let E=f.value.match(/^(\d+)(ms|s|m)?$/);if(E){let v=parseInt(E[1],10),g=E[2]||"ms";g==="s"?v*=1e3:g==="m"&&(v*=6e4),s[o]=v,l=d+1;}}}s[o]||(s[o]=o==="debounce"?300:100);}let m=a.slice(l);if(m.length===0)return {modifiers:null,remainingInput:null};let c=m[0].position.start,p=e.slice(c);return {modifiers:s,remainingInput:p}}applyModifiers(e,t){return {...e,eventModifiers:{...e.eventModifiers,...t}}}extractOrConjunctionEvents(e,t){let i=[];for(;;){let a=e.mark(),u=e.peek();if(!u)break;let n=(u.normalized||u.value).toLowerCase();if(!P.OR_KEYWORDS.has(n)){e.reset(a);break}e.advance();let o=e.peek();if(!o){e.reset(a);break}let s=(o.normalized||o.value).toLowerCase();e.advance(),i.push({type:"literal",value:s});}return i}};X.KNOWN_EVENTS=new Set(["click","dblclick","input","change","submit","keydown","keyup","keypress","mouseover","mouseout","mousedown","mouseup","focus","blur","load","scroll","resize","contextmenu"]);X.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"])};X.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"])}};X.STANDALONE_MODIFIERS={once:"once",debounced:"debounce",debounce:"debounce",throttled:"throttle",throttle:"throttle"};X.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 na=X,oa=new na;function sa(r,e){return oa.parse(r,e)}function la(r,e){try{let t=ne(r,e),i=G(e);if(i.length===0)return {confidence:0,parseSuccess:!1,error:`No patterns available for language: ${e}`};let a=[...i].sort((l,m)=>m.priority-l.priority),u=a.filter(l=>l.command==="on"),n=O.matchBest(t,u);if(n)return {confidence:n.confidence,parseSuccess:!0,patternId:n.pattern.id,action:n.pattern.command,tokensConsumed:n.consumedTokens};t.reset(t.mark());let o=a.filter(l=>l.command!=="on"),s=O.matchBest(t,o);return s?{confidence:s.confidence,parseSuccess:!0,patternId:s.pattern.id,action:s.pattern.command,tokensConsumed:s.consumedTokens}:{confidence:0,parseSuccess:!1,error:`Could not match any patterns for: ${r}`}}catch(t){return {confidence:0,parseSuccess:false,error:t instanceof Error?t.message:String(t)}}}function lr(r,e){try{let i=sa(r,e);if(i)return {node:i,confidence:i.metadata?.confidence??.8,error:void 0,tokensConsumed:ne(r,e).tokens.length}}catch{}let t=la(r,e);return t.parseSuccess?{node:null,confidence:t.confidence,error:void 0,tokensConsumed:t.tokensConsumed}:{node:null,confidence:0,error:t.error}}function mr(r,e){let t=e==="SOV"?"sovPosition":"svoPosition";return [...r].sort((i,a)=>{let u=i[t]??99,n=a[t]??99;return u-n})}function ma(r,e){let t=r.markerOverride?.[e.code],i=e.roleMarkers[r.role];if(t!==void 0)return {primary:t,position:i?.position??"before",isOverride:true};if(i&&i.primary){let a={primary:i.primary,position:i.position,isOverride:false};return i.alternatives&&(a.alternatives=i.alternatives),a}return null}function ca(r,e,t,i,a){let u=[];if(u.push({type:"role",role:"event",optional:false}),i.position==="after"){let l=i.primary.split(/\s+/);if(l.length>1)for(let m of l)u.push({type:"literal",value:m});else {let m=i.alternatives?{type:"literal",value:i.primary,alternatives:i.alternatives}:{type:"literal",value:i.primary};u.push(m);}}let n=e.roleMarkers.destination;n&&u.push({type:"group",optional:true,tokens:[{type:"role",role:"destination",optional:true},n.alternatives?{type:"literal",value:n.primary,alternatives:n.alternatives}:{type:"literal",value:n.primary}]}),u.push({type:"role",role:"patient",optional:false});let o=e.roleMarkers.patient;if(o){let l=o.alternatives?{type:"literal",value:o.primary,alternatives:o.alternatives}:{type:"literal",value:o.primary};u.push(l);}let s=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};return u.push(s),{id:`${r.action}-event-${e.code}-sov`,language:e.code,command:"on",priority:(a.basePriority??100)+50,template:{format:`{event} ${i.primary} {destination?} {patient} ${o?.primary||""} ${t.primary}`,tokens:u},extraction:{action:{value:r.action},event:{fromRole:"event"},patient:{fromRole:"patient"},destination:{fromRole:"destination",default:{type:"reference",value:"me"}}}}}function pa(r,e,t,i,a){let u=[];u.push({type:"role",role:"patient",optional:false});let n=e.roleMarkers.patient;if(n){let s=n.alternatives?{type:"literal",value:n.primary,alternatives:n.alternatives}:{type:"literal",value:n.primary};u.push(s);}if(u.push({type:"role",role:"event",optional:false}),i.position==="after"){let s=i.primary.split(/\s+/);if(s.length>1)for(let l of s)u.push({type:"literal",value:l});else {let l=i.alternatives?{type:"literal",value:i.primary,alternatives:i.alternatives}:{type:"literal",value:i.primary};u.push(l);}}let o=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};return u.push(o),{id:`${r.action}-event-${e.code}-sov-patient-first`,language:e.code,command:"on",priority:(a.basePriority??100)+45,template:{format:`{patient} ${n?.primary||""} {event} ${i.primary} ${t.primary}`,tokens:u},extraction:{action:{value:r.action},event:{fromRole:"event"},patient:{fromRole:"patient"},destination:{fromRole:"destination",default:{type:"reference",value:"me"}}}}}function da(r,e,t,i,a){let u=[];u.push({type:"role",role:"patient",optional:false});let n=e.roleMarkers.patient;if(n){let l=n.alternatives?{type:"literal",value:n.primary,alternatives:n.alternatives}:{type:"literal",value:n.primary};u.push(l);}let o=e.roleMarkers.destination;if(o&&(u.push({type:"role",role:"destination",optional:false}),u.push(o.alternatives?{type:"literal",value:o.primary,alternatives:o.alternatives}:{type:"literal",value:o.primary})),u.push({type:"role",role:"event",optional:false}),i.position==="after"){let l=i.primary.split(/\s+/);if(l.length>1)for(let m of l)u.push({type:"literal",value:m});else {let m=i.alternatives?{type:"literal",value:i.primary,alternatives:i.alternatives}:{type:"literal",value:i.primary};u.push(m);}}let s=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};return u.push(s),{id:`${r.action}-event-${e.code}-sov-patient-first-dest`,language:e.code,command:"on",priority:(a.basePriority??100)+40,template:{format:`{patient} ${n?.primary||""} {destination} ${o?.primary||""} {event} ${i.primary} ${t.primary}`,tokens:u},extraction:{action:{value:r.action},event:{fromRole:"event"},patient:{fromRole:"patient"},destination:{fromRole:"destination"}}}}function ya(r,e,t,i,a){let u=[];u.push({type:"role",role:"event",optional:false});let n=i.alternatives?.filter(m=>!m.includes(" ")&&m.length>1)||[];n.length>0&&u.push({type:"literal",value:n[0],alternatives:n.slice(1)});let o=e.roleMarkers.destination;o&&u.push({type:"group",optional:true,tokens:[{type:"role",role:"destination",optional:true},o.alternatives?{type:"literal",value:o.primary,alternatives:o.alternatives}:{type:"literal",value:o.primary}]}),u.push({type:"role",role:"patient",optional:false});let s=e.roleMarkers.patient;if(s){let m=s.alternatives?{type:"literal",value:s.primary,alternatives:s.alternatives}:{type:"literal",value:s.primary};u.push(m);}let l=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};return u.push(l),{id:`${r.action}-event-${e.code}-sov-compact`,language:e.code,command:"on",priority:(a.basePriority??100)+52,template:{format:`{event}${n[0]||""} {patient} ${t.primary}`,tokens:u},extraction:{action:{value:r.action},event:{fromRole:"event"},patient:{fromRole:"patient"},destination:{fromRole:"destination",default:{type:"reference",value:"me"}}}}}function fa(r,e,t,i,a){let u=[];if(u.push({type:"role",role:"event",optional:false}),i.position==="after"){let o=i.primary.split(/\s+/);if(o.length>1)for(let s of o)u.push({type:"literal",value:s});else {let s=i.alternatives?{type:"literal",value:i.primary,alternatives:i.alternatives}:{type:"literal",value:i.primary};u.push(s);}}let n=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};return u.push(n),{id:`${r.action}-event-${e.code}-sov-simple`,language:e.code,command:"on",priority:(a.basePriority??100)+48,template:{format:`{event} ${i.primary} ${t.primary}`,tokens:u},extraction:{action:{value:r.action},event:{fromRole:"event"},patient:{default:{type:"reference",value:"me"}}}}}function ha(r,e,t,i){let a=e.eventHandler?.temporalMarkers;if(!a||a.length===0)return null;let u=[];u.push({type:"role",role:"event",optional:false}),e.possessive?.marker&&u.push({type:"group",optional:true,tokens:[{type:"literal",value:e.possessive.marker}]}),u.push({type:"literal",value:a[0],alternatives:a.slice(1)}),u.push({type:"role",role:"patient",optional:false});let n=e.roleMarkers.patient;if(n?.primary){let s=n.alternatives?{type:"literal",value:n.primary,alternatives:n.alternatives}:{type:"literal",value:n.primary};u.push(s);}let o=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};return u.push(o),{id:`${r.action}-event-${e.code}-sov-temporal`,language:e.code,command:"on",priority:(i.basePriority??100)+49,template:{format:`{event} ${a[0]} {patient} ${t.primary}`,tokens:u},extraction:{action:{value:r.action},event:{fromRole:"event"},patient:{fromRole:"patient"}}}}function va(r,e,t,i,a){let u=[];if(u.push({type:"role",role:"event",optional:false}),i.position==="after"){let m=i.primary.split(/\s+/);if(m.length>1)for(let c of m)u.push({type:"literal",value:c});else {let c=i.alternatives?{type:"literal",value:i.primary,alternatives:i.alternatives}:{type:"literal",value:i.primary};u.push(c);}}let o=[...r.roles.filter(m=>m.required)].sort((m,c)=>{let p=m.sovPosition??999,d=c.sovPosition??999;return p-d});for(let m of o){u.push({type:"role",role:m.role,optional:false});let c,p;if(m.markerOverride&&m.markerOverride[e.code]!==void 0)c=m.markerOverride[e.code];else {let d=e.roleMarkers[m.role];d&&(c=d.primary,p=d.alternatives);}if(c){let d=p?{type:"literal",value:c,alternatives:p}:{type:"literal",value:c};u.push(d);}}let s=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};u.push(s);let l=o.map(m=>`{${m.role}}`).join(" ");return {id:`${r.action}-event-${e.code}-sov-2role`,language:e.code,command:"on",priority:(a.basePriority??100)+55,template:{format:`{event} ${i.primary} ${l} ${t.primary}`,tokens:u},extraction:{action:{value:r.action},event:{fromRole:"event"},...Object.fromEntries(o.map(m=>[m.role,{fromRole:m.role}]))}}}function Ea(r,e,t,i,a){let u=[],o=[...r.roles.filter(f=>f.required)].sort((f,E)=>{let v=f.sovPosition??999,g=E.sovPosition??999;return v-g}),s=o[0];u.push({type:"role",role:s.role,optional:false});let l;if(s.markerOverride&&s.markerOverride[e.code]!==void 0)l=s.markerOverride[e.code];else {let f=e.roleMarkers[s.role];f&&(l=f.primary);}if(l&&u.push({type:"literal",value:l}),u.push({type:"role",role:"event",optional:false}),i.position==="after"){let f=i.primary.split(/\s+/);if(f.length>1)for(let E of f)u.push({type:"literal",value:E});else {let E=i.alternatives?{type:"literal",value:i.primary,alternatives:i.alternatives}:{type:"literal",value:i.primary};u.push(E);}}let m=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};u.push(m);let c=o[1];u.push({type:"role",role:c.role,optional:false});let p,d;if(c.markerOverride&&c.markerOverride[e.code]!==void 0)p=c.markerOverride[e.code];else {let f=e.roleMarkers[c.role];f&&(p=f.primary,d=f.alternatives);}if(p){let f=d?{type:"literal",value:p,alternatives:d}:{type:"literal",value:p};u.push(f);}return {id:`${r.action}-event-${e.code}-sov-2role-dest-first`,language:e.code,command:"on",priority:(a.basePriority??100)+48,template:{format:`{${s.role}} {event} ${i.primary} ${t.primary} {${c.role}}`,tokens:u},extraction:{action:{value:r.action},event:{fromRole:"event"},[s.role]:{fromRole:s.role},[c.role]:{fromRole:c.role}}}}function He(r,e,t,i,a){let u=[];if(i.position==="before"){let s=i.alternatives?{type:"literal",value:i.primary,alternatives:i.alternatives}:{type:"literal",value:i.primary};u.push(s);}u.push({type:"role",role:"event",optional:false});let n=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};u.push(n),u.push({type:"role",role:"patient",optional:false});let o=e.roleMarkers.destination;return o&&u.push({type:"group",optional:true,tokens:[o.alternatives?{type:"literal",value:o.primary,alternatives:o.alternatives}:{type:"literal",value:o.primary},{type:"role",role:"destination",optional:true}]}),{id:`${r.action}-event-${e.code}-vso`,language:e.code,command:"on",priority:(a.basePriority??100)+50,template:{format:`${i.primary} {event} ${t.primary} {patient} ${o?.primary||""} {destination?}`,tokens:u},extraction:{action:{value:r.action},event:{fromRole:"event"},patient:{fromRole:"patient"},destination:{fromRole:"destination",default:{type:"reference",value:"me"}}}}}function ga(r,e,t,i,a){let u=[],n=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};u.push(n),u.push({type:"role",role:"patient",optional:false});let o=e.roleMarkers.destination;if(o&&u.push({type:"group",optional:true,tokens:[o.alternatives?{type:"literal",value:o.primary,alternatives:o.alternatives}:{type:"literal",value:o.primary},{type:"role",role:"destination",optional:true}]}),i.position==="before"){let s=i.alternatives?{type:"literal",value:i.primary,alternatives:i.alternatives}:{type:"literal",value:i.primary};u.push(s);}return u.push({type:"role",role:"event",optional:false}),{id:`${r.action}-event-${e.code}-vso-verb-first`,language:e.code,command:"on",priority:(a.basePriority??100)+45,template:{format:`${t.primary} {patient} ${o?.primary||""} {destination?} ${i.primary} {event}`,tokens:u},extraction:{action:{value:r.action},event:{fromRole:"event"},patient:{fromRole:"patient"},destination:{fromRole:"destination",default:{type:"reference",value:"me"}}}}}function za(r,e,t,i,a){let u=[],n=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};u.push(n);let s=[...r.roles.filter(m=>m.required)].sort((m,c)=>{let p=m.svoPosition??999,d=c.svoPosition??999;return p-d});for(let m of s){let c,p;if(m.markerOverride&&m.markerOverride[e.code]!==void 0)c=m.markerOverride[e.code];else {let d=e.roleMarkers[m.role];d&&(c=d.primary,p=d.alternatives);}if(c){let d=p?{type:"literal",value:c,alternatives:p}:{type:"literal",value:c};u.push(d);}u.push({type:"role",role:m.role,optional:false});}if(i.position==="before"){let m=i.alternatives?{type:"literal",value:i.primary,alternatives:i.alternatives}:{type:"literal",value:i.primary};u.push(m);}u.push({type:"role",role:"event",optional:false});let l=s.map(m=>`{${m.role}}`).join(" ");return {id:`${r.action}-event-${e.code}-vso-verb-first-2role`,language:e.code,command:"on",priority:(a.basePriority??100)+48,template:{format:`${t.primary} ${l} ${i.primary} {event}`,tokens:u},extraction:{action:{value:r.action},event:{fromRole:"event"},...Object.fromEntries(s.map(m=>[m.role,{fromRole:m.role}]))}}}function Ye(r,e,t,i,a){let u=[];if(i.position==="before"){let m=i.alternatives?{type:"literal",value:i.primary,alternatives:i.alternatives}:{type:"literal",value:i.primary};u.push(m);}u.push({type:"role",role:"event",optional:false});let n=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};u.push(n);let s=[...r.roles.filter(m=>m.required)].sort((m,c)=>{let p=m.svoPosition??999,d=c.svoPosition??999;return p-d});for(let m of s){let c,p;if(m.markerOverride&&m.markerOverride[e.code]!==void 0)c=m.markerOverride[e.code];else {let d=e.roleMarkers[m.role];d&&(c=d.primary,p=d.alternatives);}if(c){let d=p?{type:"literal",value:c,alternatives:p}:{type:"literal",value:c};u.push(d);}u.push({type:"role",role:m.role,optional:false});}let l=s.map(m=>`{${m.role}}`).join(" ");return {id:`${r.action}-event-${e.code}-vso-2role`,language:e.code,command:"on",priority:(a.basePriority??100)+55,template:{format:`${i.primary} {event} ${t.primary} ${l}`,tokens:u},extraction:{action:{value:r.action},event:{fromRole:"event"},...Object.fromEntries(s.map(m=>[m.role,{fromRole:m.role}]))}}}function ka(r,e,t,i,a){let u=[],n=e.eventHandler?.negationMarker;if(i.position==="before"){let l=i.alternatives?{type:"literal",value:i.primary,alternatives:i.alternatives}:{type:"literal",value:i.primary};u.push(l);}if(n){let l=n.alternatives?{type:"literal",value:n.primary,alternatives:n.alternatives}:{type:"literal",value:n.primary};u.push(l);}u.push({type:"role",role:"event",optional:false});let o=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};u.push(o),u.push({type:"role",role:"patient",optional:false});let s=e.roleMarkers.destination;return s&&u.push({type:"group",optional:true,tokens:[s.alternatives?{type:"literal",value:s.primary,alternatives:s.alternatives}:{type:"literal",value:s.primary},{type:"role",role:"destination",optional:true}]}),{id:`${r.action}-event-${e.code}-vso-negated`,language:e.code,command:"on",priority:(a.basePriority??100)+48,template:{format:`${i.primary} ${n?.primary||""} {event} ${t.primary} {patient} ${s?.primary||""} {destination?}`,tokens:u},extraction:{action:{value:r.action},event:{fromRole:"event"},patient:{fromRole:"patient"},destination:{fromRole:"destination",default:{type:"reference",value:"me"}}}}}function Ca(r,e,t,i){let a=[];a.push({type:"literal",value:"and",alternatives:["then"]}),a.push({type:"role",role:"event",optional:false});let u=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};a.push(u),a.push({type:"role",role:"patient",optional:false});let n=e.roleMarkers.destination;return n&&a.push({type:"group",optional:true,tokens:[n.alternatives?{type:"literal",value:n.primary,alternatives:n.alternatives}:{type:"literal",value:n.primary},{type:"role",role:"destination",optional:true}]}),{id:`${r.action}-event-${e.code}-vso-proclitic`,language:e.code,command:"on",priority:(i.basePriority??100)+45,template:{format:`[proclitic?] {event} ${t.primary} {patient} ${n?.primary||""} {destination?}`,tokens:a},extraction:{action:{value:r.action},event:{fromRole:"event"},patient:{fromRole:"patient"},destination:{fromRole:"destination",default:{type:"reference",value:"me"}}}}}var oe={basePriority:100,generateSimpleVariants:true,generateAlternatives:true};function cr(r,e,t=oe){let i=`${r.action}-${e.code}-generated`,a=t.basePriority??100,u=e.keywords[r.action];if(!u)throw new Error(`No keyword translation for '${r.action}' in ${e.code}`);let n=Da(r,e,u),o=dr(r,e),s=Sa(r,e,u);return {id:i,language:e.code,command:r.action,priority:a,template:{format:s,tokens:n},extraction:o}}function ba(r,e,t=oe){if(r.roles.filter(o=>!o.required).length===0)return null;let a=r.roles.filter(o=>o.required),u={...r,roles:a};return {...cr(u,e,t),id:`${r.action}-${e.code}-generated-simple`,priority:(t.basePriority??100)-5,extraction:dr(r,e)}}function Aa(r,e,t=oe){let i=[];if(i.push(cr(r,e,t)),t.generateSimpleVariants){let a=ba(r,e,t);a&&i.push(a);}return i}function pr(r,e=oe){let t=[],i=ua();for(let a of i){if(!r.keywords[a.action])continue;let u=Aa(a,r,e);if(t.push(...u),r.eventHandler?.eventMarker){let n=wa(a,r,e);t.push(...n);}}return t}function wa(r,e,t=oe){if(!e.eventHandler||!e.eventHandler.eventMarker)return [];let i=[],a=e.eventHandler.eventMarker,u=e.keywords[r.action];if(!u)return [];let o=r.roles.filter(s=>s.required).length===2;if(e.wordOrder==="SOV")if(o)i.push(va(r,e,u,a,t)),i.push(Ea(r,e,u,a,t));else {i.push(ca(r,e,u,a,t)),i.push(pa(r,e,u,a,t));let s=e.roleMarkers.destination;s&&s.primary!==a.primary&&i.push(da(r,e,u,a,t));let l=a.primary.split(/\s+/),m=a.alternatives?.some(p=>!p.includes(" ")&&p.length>1);l.length>1&&m&&i.push(ya(r,e,u,a,t)),i.push(fa(r,e,u,a,t));let c=ha(r,e,u,t);c&&i.push(c);}else e.wordOrder==="VSO"?o?(i.push(Ye(r,e,u,a,t)),i.push(za(r,e,u,a,t))):(i.push(He(r,e,u,a,t)),i.push(ga(r,e,u,a,t)),e.eventHandler?.negationMarker&&i.push(ka(r,e,u,a,t)),e.tokenization?.prefixes&&i.push(Ca(r,e,u,t))):o?i.push(Ye(r,e,u,a,t)):i.push(He(r,e,u,a,t));return i}function Da(r,e,t){let i=[],a=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary},u=xa(r,e);switch(e.wordOrder){case "SVO":i.push(a),i.push(...u);break;case "SOV":i.push(...u),i.push(a);break;case "VSO":i.push(a),i.push(...u);break;default:i.push(a),i.push(...u);}return i}function xa(r,e){let t=[],i=mr(r.roles,e.wordOrder);for(let a of i){let u=Ba(a,e);a.required?t.push(...u):t.push({type:"group",optional:true,tokens:u});}return t}function Ba(r,e){let t=[],i=r.markerOverride?.[e.code],a=e.roleMarkers[r.role],u={type:"role",role:r.role,optional:!r.required,expectedTypes:r.expectedTypes};if(i!==void 0){let n=i?i.split(/\s+/).filter(Boolean):[];if((a?.position??"before")==="before"){for(let s of n)t.push({type:"literal",value:s});t.push(u);}else {t.push(u);for(let s of n)t.push({type:"literal",value:s});}}else if(a)if(a.position==="before"){if(a.primary){let n=a.alternatives?{type:"literal",value:a.primary,alternatives:a.alternatives}:{type:"literal",value:a.primary};t.push(n);}t.push(u);}else {t.push(u);let n=a.alternatives?{type:"literal",value:a.primary,alternatives:a.alternatives}:{type:"literal",value:a.primary};t.push(n);}else t.push(u);return t}function Fa(r,e){let t={};for(let i of r.roles){let a=i.markerOverride?.[e.code],u=e.roleMarkers[i.role];a!==void 0?t[i.role]=a?{marker:a}:{}:u&&u.primary?t[i.role]=u.alternatives?{marker:u.primary,markerAlternatives:u.alternatives}:{marker:u.primary}:t[i.role]={};}return t}function dr(r,e){let t=Fa(r,e),i={};for(let a of r.roles){let u=t[a.role]||{};!a.required&&a.default?i[a.role]={...u,default:a.default}:i[a.role]=u;}return i}function Sa(r,e,t){let i=[],u=mr(r.roles,e.wordOrder).map(n=>{let o=ma(n,e),s="";return o&&o.primary?o.position==="before"?s=`${o.primary} {${n.role}}`:s=`{${n.role}} ${o.primary}`:s=`{${n.role}}`,n.required?s:`[${s}]`});switch(e.wordOrder){case "SVO":case "VSO":i.push(t.primary,...u);break;case "SOV":i.push(...u,t.primary);break;default:i.push(t.primary,...u);}return i.join(" ")}var Ta=class{constructor(r={}){this.cache=new Map,this.config={maxSize:r.maxSize??1e3,ttlMs:r.ttlMs??0,enabled:r.enabled??true},this.stats={hits:0,misses:0,evictions:0,expirations:0};}makeKey(r,e){return `${e}:${r}`}isExpired(r){return this.config.ttlMs===0?false:Date.now()-r.createdAt>this.config.ttlMs}evictLRU(){let r=this.cache.keys().next().value;r!==void 0&&(this.cache.delete(r),this.stats.evictions++);}get(r,e){if(!this.config.enabled){this.stats.misses++;return}let t=this.makeKey(r,e),i=this.cache.get(t);if(!i){this.stats.misses++;return}if(this.isExpired(i)){this.cache.delete(t),this.stats.expirations++,this.stats.misses++;return}return this.cache.delete(t),i.lastAccessed=Date.now(),this.cache.set(t,i),this.stats.hits++,i.result}set(r,e,t){if(!this.config.enabled||t!==null&&typeof t=="object"&&"confidence"in t&&t.confidence===0)return;let i=this.makeKey(r,e),a=Date.now();for(;this.cache.size>=this.config.maxSize;)this.evictLRU();this.cache.set(i,{result:t,createdAt:a,lastAccessed:a});}has(r,e){if(!this.config.enabled)return false;let t=this.makeKey(r,e),i=this.cache.get(t);return i?this.isExpired(i)?(this.cache.delete(t),this.stats.expirations++,false):true:false}delete(r,e){let t=this.makeKey(r,e);return this.cache.delete(t)}clear(){this.cache.clear();}resetStats(){this.stats={hits:0,misses:0,evictions:0,expirations:0};}getStats(){let r=this.stats.hits+this.stats.misses;return {hits:this.stats.hits,misses:this.stats.misses,size:this.cache.size,maxSize:this.config.maxSize,hitRate:r>0?this.stats.hits/r:0,evictions:this.stats.evictions,expirations:this.stats.expirations,enabled:this.config.enabled}}configure(r){if(r.maxSize!==void 0)for(this.config.maxSize=r.maxSize;this.cache.size>this.config.maxSize;)this.evictLRU();r.ttlMs!==void 0&&(this.config.ttlMs=r.ttlMs),r.enabled!==void 0&&(this.config.enabled=r.enabled);}enable(){this.config.enabled=true;}disable(){this.config.enabled=false;}getConfig(){return {...this.config}}};new Ta;function Pa(r){return /[а-яА-ЯёЁ]/.test(r)}function Ra(r){for(let e of r)if(Pa(e))return true;return false}var yr=new Map([["\u043F\u0435\u0440\u0435\u043A\u043B\u044E\u0447\u0438","\u043F\u0435\u0440\u0435\u043A\u043B\u044E\u0447\u0438\u0442\u044C"],["\u0434\u043E\u0431\u0430\u0432\u044C","\u0434\u043E\u0431\u0430\u0432\u0438\u0442\u044C"],["\u0443\u0434\u0430\u043B\u0438","\u0443\u0434\u0430\u043B\u0438\u0442\u044C"],["\u0443\u0431\u0435\u0440\u0438","\u0443\u0431\u0440\u0430\u0442\u044C"],["\u043F\u043E\u043B\u043E\u0436\u0438","\u043F\u043E\u043B\u043E\u0436\u0438\u0442\u044C"],["\u043F\u043E\u043C\u0435\u0441\u0442\u0438","\u043F\u043E\u043C\u0435\u0441\u0442\u0438\u0442\u044C"],["\u0432\u0441\u0442\u0430\u0432\u044C","\u0432\u0441\u0442\u0430\u0432\u0438\u0442\u044C"],["\u0432\u043E\u0437\u044C\u043C\u0438","\u0432\u0437\u044F\u0442\u044C"],["\u0441\u043E\u0437\u0434\u0430\u0439","\u0441\u043E\u0437\u0434\u0430\u0442\u044C"],["\u043A\u043B\u043E\u043D\u0438\u0440\u0443\u0439","\u043A\u043B\u043E\u043D\u0438\u0440\u043E\u0432\u0430\u0442\u044C"],["\u043F\u043E\u043C\u0435\u043D\u044F\u0439","\u043F\u043E\u043C\u0435\u043D\u044F\u0442\u044C"],["\u0442\u0440\u0430\u043D\u0441\u0444\u043E\u0440\u043C\u0438\u0440\u0443\u0439","\u0442\u0440\u0430\u043D\u0441\u0444\u043E\u0440\u043C\u0438\u0440\u043E\u0432\u0430\u0442\u044C"],["\u0443\u0441\u0442\u0430\u043D\u043E\u0432\u0438","\u0443\u0441\u0442\u0430\u043D\u043E\u0432\u0438\u0442\u044C"],["\u0437\u0430\u0434\u0430\u0439","\u0437\u0430\u0434\u0430\u0442\u044C"],["\u043F\u043E\u043B\u0443\u0447\u0438","\u043F\u043E\u043B\u0443\u0447\u0438\u0442\u044C"],["\u0443\u0432\u0435\u043B\u0438\u0447\u044C","\u0443\u0432\u0435\u043B\u0438\u0447\u0438\u0442\u044C"],["\u0443\u043C\u0435\u043D\u044C\u0448\u0438","\u0443\u043C\u0435\u043D\u044C\u0448\u0438\u0442\u044C"],["\u0437\u0430\u043F\u0438\u0448\u0438","\u0437\u0430\u043F\u0438\u0441\u0430\u0442\u044C"],["\u043F\u043E\u043A\u0430\u0436\u0438","\u043F\u043E\u043A\u0430\u0437\u0430\u0442\u044C"],["\u0441\u043A\u0440\u043E\u0439","\u0441\u043A\u0440\u044B\u0442\u044C"],["\u0441\u043F\u0440\u044F\u0447\u044C","\u0441\u043F\u0440\u044F\u0442\u0430\u0442\u044C"],["\u0430\u043D\u0438\u043C\u0438\u0440\u0443\u0439","\u0430\u043D\u0438\u043C\u0438\u0440\u043E\u0432\u0430\u0442\u044C"],["\u0432\u044B\u0437\u043E\u0432\u0438","\u0432\u044B\u0437\u0432\u0430\u0442\u044C"],["\u043E\u0442\u043F\u0440\u0430\u0432\u044C","\u043E\u0442\u043F\u0440\u0430\u0432\u0438\u0442\u044C"],["\u0441\u0444\u043E\u043A\u0443\u0441\u0438\u0440\u0443\u0439","\u0441\u0444\u043E\u043A\u0443\u0441\u0438\u0440\u043E\u0432\u0430\u0442\u044C"],["\u0440\u0430\u0437\u043C\u043E\u0439","\u0440\u0430\u0437\u043C\u044B\u0442\u044C"],["\u043F\u0435\u0440\u0435\u0439\u0434\u0438","\u043F\u0435\u0440\u0435\u0439\u0442\u0438"],["\u0438\u0434\u0438","\u0438\u0434\u0442\u0438"],["\u0436\u0434\u0438","\u0436\u0434\u0430\u0442\u044C"],["\u043F\u043E\u0434\u043E\u0436\u0434\u0438","\u043F\u043E\u0434\u043E\u0436\u0434\u0430\u0442\u044C"],["\u0437\u0430\u0433\u0440\u0443\u0437\u0438","\u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044C"],["\u043F\u043E\u0432\u0442\u043E\u0440\u0438","\u043F\u043E\u0432\u0442\u043E\u0440\u0438\u0442\u044C"],["\u043F\u0440\u043E\u0434\u043E\u043B\u0436\u0438","\u043F\u0440\u043E\u0434\u043E\u043B\u0436\u0438\u0442\u044C"],["\u0431\u0440\u043E\u0441\u044C","\u0431\u0440\u043E\u0441\u0438\u0442\u044C"],["\u0432\u0435\u0440\u043D\u0438","\u0432\u0435\u0440\u043D\u0443\u0442\u044C"],["\u0441\u043A\u0430\u0436\u0438","\u0441\u043A\u0430\u0437\u0430\u0442\u044C"],["\u0438\u043D\u0438\u0446\u0438\u0430\u043B\u0438\u0437\u0438\u0440\u0443\u0439","\u0438\u043D\u0438\u0446\u0438\u0430\u043B\u0438\u0437\u0438\u0440\u043E\u0432\u0430\u0442\u044C"],["\u0438\u0437\u043C\u0435\u0440\u044C","\u0438\u0437\u043C\u0435\u0440\u0438\u0442\u044C"]]),fr=class{constructor(){this.language="ru";}isNormalizable(r){return r.length<3?false:Ra(r)}normalize(r){let e=r.toLowerCase();if(e.endsWith("\u0441\u044F")||e.endsWith("\u0441\u044C")){let n=this.tryReflexiveNormalization(e);if(n)return n}if(e.endsWith("\u0442\u044C")||e.endsWith("\u0442\u0438")||e.endsWith("\u0447\u044C"))return w(r);let t=this.tryImperativeLookup(e);if(t)return t;let i=this.tryPastTenseNormalization(e);if(i)return i;let a=this.tryPresentTenseNormalization(e);if(a)return a;let u=this.tryGenericImperativeNormalization(e);return u||w(r)}tryReflexiveNormalization(r){(r.endsWith("\u0441\u044F"),2);let t=r.slice(0,-2);if(r.endsWith("\u0442\u044C\u0441\u044F")||r.endsWith("\u0442\u0438\u0441\u044C")||r.endsWith("\u0447\u044C\u0441\u044F"))return w(r);let i=this.normalizeNonReflexive(t);if(i.confidence<1){let a=i.stem.endsWith("\u0442\u044C")?i.stem.slice(0,-2)+"\u0442\u044C\u0441\u044F":i.stem+"\u0441\u044F";return y(a,i.confidence*.95,{removedSuffixes:["\u0441\u044F",...i.metadata?.removedSuffixes||[]],conjugationType:"reflexive"})}return null}normalizeNonReflexive(r){if(r.endsWith("\u0442\u044C")||r.endsWith("\u0442\u0438")||r.endsWith("\u0447\u044C"))return w(r);let e=this.tryImperativeLookup(r);if(e)return e;let t=this.tryPastTenseNormalization(r);if(t)return t;let i=this.tryPresentTenseNormalization(r);if(i)return i;let a=this.tryGenericImperativeNormalization(r);return a||w(r)}tryImperativeLookup(r){return yr.has(r)?y(yr.get(r),.95,{removedSuffixes:["imperative"],conjugationType:"imperative"}):null}tryGenericImperativeNormalization(r){return r.endsWith("\u0439\u0442\u0435")&&r.length>5?y(r.slice(0,-3)+"\u0442\u044C",.8,{removedSuffixes:["\u0439\u0442\u0435"],conjugationType:"imperative"}):r.endsWith("\u0438\u0442\u0435")&&r.length>5?y(r.slice(0,-3)+"\u0438\u0442\u044C",.8,{removedSuffixes:["\u0438\u0442\u0435"],conjugationType:"imperative"}):r.endsWith("\u0439")&&r.length>3?y(r.slice(0,-1)+"\u0442\u044C",.75,{removedSuffixes:["\u0439"],conjugationType:"imperative"}):r.endsWith("\u0438")&&r.length>3?y(r+"\u0442\u044C",.7,{removedSuffixes:["\u0438\u2192\u0438\u0442\u044C"],conjugationType:"imperative"}):null}tryPastTenseNormalization(r){return r.endsWith("\u0430\u043B\u0430")&&r.length>4?y(r.slice(0,-3)+"\u0430\u0442\u044C",.85,{removedSuffixes:["\u0430\u043B\u0430"],conjugationType:"past"}):r.endsWith("\u0438\u043B\u0430")&&r.length>4?y(r.slice(0,-3)+"\u0438\u0442\u044C",.85,{removedSuffixes:["\u0438\u043B\u0430"],conjugationType:"past"}):r.endsWith("\u0435\u043B\u043E")&&r.length>4?y(r.slice(0,-3)+"\u0435\u0442\u044C",.82,{removedSuffixes:["\u0435\u043B\u043E"],conjugationType:"past"}):r.endsWith("\u0430\u0431\u043E")&&r.length>4?y(r.slice(0,-3)+"\u0430\u0442\u044C",.82,{removedSuffixes:["\u0430\u0431\u043E"],conjugationType:"past"}):r.endsWith("\u0430\u043B\u0438")&&r.length>4?y(r.slice(0,-3)+"\u0430\u0442\u044C",.85,{removedSuffixes:["\u0430\u043B\u0438"],conjugationType:"past"}):r.endsWith("\u0438\u043B\u0438")&&r.length>4?y(r.slice(0,-3)+"\u0438\u0442\u044C",.85,{removedSuffixes:["\u0438\u043B\u0438"],conjugationType:"past"}):r.endsWith("\u0430\u043B")&&r.length>3?y(r.slice(0,-2)+"\u0430\u0442\u044C",.82,{removedSuffixes:["\u0430\u043B"],conjugationType:"past"}):r.endsWith("\u0438\u043B")&&r.length>3?y(r.slice(0,-2)+"\u0438\u0442\u044C",.82,{removedSuffixes:["\u0438\u043B"],conjugationType:"past"}):null}tryPresentTenseNormalization(r){return r.endsWith("\u0438\u0448\u044C")&&r.length>4?y(r.slice(0,-3)+"\u0438\u0442\u044C",.8,{removedSuffixes:["\u0438\u0448\u044C"],conjugationType:"present"}):r.endsWith("\u0438\u0442")&&r.length>3?y(r.slice(0,-2)+"\u0438\u0442\u044C",.78,{removedSuffixes:["\u0438\u0442"],conjugationType:"present"}):r.endsWith("\u0438\u043C")&&r.length>3?y(r.slice(0,-2)+"\u0438\u0442\u044C",.78,{removedSuffixes:["\u0438\u043C"],conjugationType:"present"}):r.endsWith("\u044F\u0442")&&r.length>3?y(r.slice(0,-2)+"\u0438\u0442\u044C",.78,{removedSuffixes:["\u044F\u0442"],conjugationType:"present"}):r.endsWith("\u0435\u0448\u044C")&&r.length>4?y(r.slice(0,-3)+"\u0430\u0442\u044C",.75,{removedSuffixes:["\u0435\u0448\u044C"],conjugationType:"present"}):r.endsWith("\u0435\u0442")&&r.length>3?y(r.slice(0,-2)+"\u0430\u0442\u044C",.72,{removedSuffixes:["\u0435\u0442"],conjugationType:"present"}):r.endsWith("\u0435\u043C")&&r.length>3?y(r.slice(0,-2)+"\u0430\u0442\u044C",.72,{removedSuffixes:["\u0435\u043C"],conjugationType:"present"}):r.endsWith("\u044E\u0442")&&r.length>3?y(r.slice(0,-2)+"\u0430\u0442\u044C",.75,{removedSuffixes:["\u044E\u0442"],conjugationType:"present"}):r.endsWith("\u0443\u0442")&&r.length>3?y(r.slice(0,-2)+"\u0430\u0442\u044C",.72,{removedSuffixes:["\u0443\u0442"],conjugationType:"present"}):null}},hr={code:"ru",name:"Russian",nativeName:"\u0420\u0443\u0441\u0441\u043A\u0438\u0439",direction:"ltr",script:"cyrillic",wordOrder:"SVO",markingStrategy:"preposition",usesSpaces:true,defaultVerbForm:"infinitive",verb:{position:"start",subjectDrop:true,suffixes:["\u0442\u044C","\u0442\u044C\u0441\u044F","\u0438\u0442\u044C","\u0438\u0442\u044C\u0441\u044F","\u0430\u0442\u044C","\u0430\u0442\u044C\u0441\u044F","\u0435\u0442\u044C","\u0435\u0442\u044C\u0441\u044F"]},references:{me:"\u044F",it:"\u044D\u0442\u043E",you:"\u0442\u044B",result:"\u0440\u0435\u0437\u0443\u043B\u044C\u0442\u0430\u0442",event:"\u0441\u043E\u0431\u044B\u0442\u0438\u0435",target:"\u0446\u0435\u043B\u044C",body:"body"},possessive:{marker:"",markerPosition:"after-object",usePossessiveAdjectives:true,specialForms:{me:"\u043C\u043E\u0439",it:"\u0435\u0433\u043E",you:"\u0442\u0432\u043E\u0439"},keywords:{\u043C\u043E\u0439:"me",\u043C\u043E\u044F:"me",\u043C\u043E\u0451:"me",\u043C\u043E\u0438:"me",\u0442\u0432\u043E\u0439:"you",\u0442\u0432\u043E\u044F:"you",\u0442\u0432\u043E\u0451:"you",\u0442\u0432\u043E\u0438:"you",\u0435\u0433\u043E:"it",\u0435\u0451:"it"}},roleMarkers:{destination:{primary:"\u0432",alternatives:["\u043D\u0430","\u043A"],position:"before"},source:{primary:"\u0438\u0437",alternatives:["\u043E\u0442","\u0441"],position:"before"},patient:{primary:"",position:"before"},style:{primary:"\u0441",alternatives:["\u0441\u043E"],position:"before"}},keywords:{toggle:{primary:"\u043F\u0435\u0440\u0435\u043A\u043B\u044E\u0447\u0438\u0442\u044C",alternatives:["\u043F\u0435\u0440\u0435\u043A\u043B\u044E\u0447\u0438"],normalized:"toggle",form:"infinitive"},add:{primary:"\u0434\u043E\u0431\u0430\u0432\u0438\u0442\u044C",alternatives:["\u0434\u043E\u0431\u0430\u0432\u044C"],normalized:"add",form:"infinitive"},remove:{primary:"\u0443\u0434\u0430\u043B\u0438\u0442\u044C",alternatives:["\u0443\u0434\u0430\u043B\u0438","\u0443\u0431\u0440\u0430\u0442\u044C","\u0443\u0431\u0435\u0440\u0438"],normalized:"remove",form:"infinitive"},put:{primary:"\u043F\u043E\u043B\u043E\u0436\u0438\u0442\u044C",alternatives:["\u043F\u043E\u043B\u043E\u0436\u0438","\u043F\u043E\u043C\u0435\u0441\u0442\u0438\u0442\u044C","\u043F\u043E\u043C\u0435\u0441\u0442\u0438","\u0432\u0441\u0442\u0430\u0432\u0438\u0442\u044C","\u0432\u0441\u0442\u0430\u0432\u044C"],normalized:"put",form:"infinitive"},append:{primary:"\u0434\u043E\u0431\u0430\u0432\u0438\u0442\u044C_\u0432_\u043A\u043E\u043D\u0435\u0446",alternatives:["\u0434\u043E\u043F\u0438\u0441\u0430\u0442\u044C"],normalized:"append",form:"infinitive"},prepend:{primary:"\u0434\u043E\u0431\u0430\u0432\u0438\u0442\u044C_\u0432_\u043D\u0430\u0447\u0430\u043B\u043E",normalized:"prepend",form:"infinitive"},take:{primary:"\u0432\u0437\u044F\u0442\u044C",alternatives:["\u0432\u043E\u0437\u044C\u043C\u0438"],normalized:"take",form:"infinitive"},make:{primary:"\u0441\u043E\u0437\u0434\u0430\u0442\u044C",alternatives:["\u0441\u043E\u0437\u0434\u0430\u0439"],normalized:"make",form:"infinitive"},clone:{primary:"\u043A\u043B\u043E\u043D\u0438\u0440\u043E\u0432\u0430\u0442\u044C",alternatives:["\u043A\u043B\u043E\u043D\u0438\u0440\u0443\u0439"],normalized:"clone",form:"infinitive"},swap:{primary:"\u043F\u043E\u043C\u0435\u043D\u044F\u0442\u044C",alternatives:["\u043F\u043E\u043C\u0435\u043D\u044F\u0439"],normalized:"swap",form:"infinitive"},morph:{primary:"\u0442\u0440\u0430\u043D\u0441\u0444\u043E\u0440\u043C\u0438\u0440\u043E\u0432\u0430\u0442\u044C",alternatives:["\u0442\u0440\u0430\u043D\u0441\u0444\u043E\u0440\u043C\u0438\u0440\u0443\u0439"],normalized:"morph",form:"infinitive"},set:{primary:"\u0443\u0441\u0442\u0430\u043D\u043E\u0432\u0438\u0442\u044C",alternatives:["\u0443\u0441\u0442\u0430\u043D\u043E\u0432\u0438","\u0437\u0430\u0434\u0430\u0442\u044C","\u0437\u0430\u0434\u0430\u0439"],normalized:"set",form:"infinitive"},get:{primary:"\u043F\u043E\u043B\u0443\u0447\u0438\u0442\u044C",alternatives:["\u043F\u043E\u043B\u0443\u0447\u0438"],normalized:"get",form:"infinitive"},increment:{primary:"\u0443\u0432\u0435\u043B\u0438\u0447\u0438\u0442\u044C",alternatives:["\u0443\u0432\u0435\u043B\u0438\u0447\u044C"],normalized:"increment",form:"infinitive"},decrement:{primary:"\u0443\u043C\u0435\u043D\u044C\u0448\u0438\u0442\u044C",alternatives:["\u0443\u043C\u0435\u043D\u044C\u0448\u0438"],normalized:"decrement",form:"infinitive"},log:{primary:"\u0437\u0430\u043F\u0438\u0441\u0430\u0442\u044C",alternatives:["\u0437\u0430\u043F\u0438\u0448\u0438"],normalized:"log",form:"infinitive"},show:{primary:"\u043F\u043E\u043A\u0430\u0437\u0430\u0442\u044C",alternatives:["\u043F\u043E\u043A\u0430\u0436\u0438"],normalized:"show",form:"infinitive"},hide:{primary:"\u0441\u043A\u0440\u044B\u0442\u044C",alternatives:["\u0441\u043A\u0440\u043E\u0439","\u0441\u043F\u0440\u044F\u0442\u0430\u0442\u044C","\u0441\u043F\u0440\u044F\u0447\u044C"],normalized:"hide",form:"infinitive"},transition:{primary:"\u0430\u043D\u0438\u043C\u0438\u0440\u043E\u0432\u0430\u0442\u044C",alternatives:["\u0430\u043D\u0438\u043C\u0438\u0440\u0443\u0439"],normalized:"transition",form:"infinitive"},on:{primary:"\u043F\u0440\u0438",normalized:"on"},trigger:{primary:"\u0438\u043D\u0438\u0446\u0438\u0438\u0440\u043E\u0432\u0430\u0442\u044C",alternatives:["\u0437\u0430\u043F\u0443\u0441\u0442\u0438\u0442\u044C","\u0437\u0430\u043F\u0443\u0441\u0442\u0438"],normalized:"trigger",form:"infinitive"},send:{primary:"\u043E\u0442\u043F\u0440\u0430\u0432\u0438\u0442\u044C",alternatives:["\u043E\u0442\u043F\u0440\u0430\u0432\u044C"],normalized:"send",form:"infinitive"},focus:{primary:"\u0441\u0444\u043E\u043A\u0443\u0441\u0438\u0440\u043E\u0432\u0430\u0442\u044C",alternatives:["\u0441\u0444\u043E\u043A\u0443\u0441\u0438\u0440\u0443\u0439","\u0444\u043E\u043A\u0443\u0441"],normalized:"focus",form:"infinitive"},blur:{primary:"\u0440\u0430\u0437\u043C\u044B\u0442\u044C",alternatives:["\u0440\u0430\u0437\u043C\u043E\u0439"],normalized:"blur",form:"infinitive"},empty:{primary:"\u043E\u043F\u0443\u0441\u0442\u043E\u0448\u0438\u0442\u044C",normalized:"empty"},open:{primary:"\u043E\u0442\u043A\u0440\u044B\u0442\u044C",normalized:"open"},close:{primary:"\u0437\u0430\u043A\u0440\u044B\u0442\u044C",normalized:"close"},select:{primary:"\u0432\u044B\u0434\u0435\u043B\u0438\u0442\u044C",normalized:"select"},clear:{primary:"\u043E\u0447\u0438\u0441\u0442\u0438\u0442\u044C",normalized:"clear"},reset:{primary:"\u0441\u0431\u0440\u043E\u0441\u0438\u0442\u044C",normalized:"reset"},breakpoint:{primary:"\u0442\u043E\u0447\u043A\u0430-\u043E\u0441\u0442\u0430\u043D\u043E\u0432\u0430",normalized:"breakpoint"},click:{primary:"\u043A\u043B\u0438\u043A",alternatives:["\u043A\u043B\u0438\u043A\u0435","\u043D\u0430\u0436\u0430\u0442\u0438\u0438"],normalized:"click"},hover:{primary:"\u043D\u0430\u0432\u0435\u0434\u0435\u043D\u0438\u0438",alternatives:["\u043D\u0430\u0432\u0435\u0434\u0435\u043D\u0438\u0435"],normalized:"hover"},submit:{primary:"\u043E\u0442\u043F\u0440\u0430\u0432\u043A\u0435",alternatives:["\u043E\u0442\u043F\u0440\u0430\u0432\u043A\u0430"],normalized:"submit"},input:{primary:"\u0432\u0432\u043E\u0434\u0435",alternatives:["\u0432\u0432\u043E\u0434"],normalized:"input"},change:{primary:"\u0438\u0437\u043C\u0435\u043D\u0435\u043D\u0438\u0438",alternatives:["\u0438\u0437\u043C\u0435\u043D\u0435\u043D\u0438\u0435"],normalized:"change"},go:{primary:"\u043F\u0435\u0440\u0435\u0439\u0442\u0438",alternatives:["\u043F\u0435\u0440\u0435\u0439\u0434\u0438","\u0438\u0434\u0442\u0438","\u0438\u0434\u0438"],normalized:"go",form:"infinitive"},scroll:{primary:"\u043F\u0440\u043E\u043A\u0440\u0443\u0442\u0438\u0442\u044C",alternatives:["\u043F\u0440\u043E\u043A\u0440\u0443\u0442\u0438"],normalized:"scroll",form:"infinitive"},push:{primary:"\u0432\u0442\u043E\u043B\u043A\u043D\u0443\u0442\u044C",alternatives:["\u0442\u043E\u043B\u043A\u043D\u0443\u0442\u044C"],normalized:"push",form:"infinitive"},replace:{primary:"\u0437\u0430\u043C\u0435\u043D\u0438\u0442\u044C",alternatives:["\u0437\u0430\u043C\u0435\u043D\u0438"],normalized:"replace",form:"infinitive"},process:{primary:"\u043E\u0431\u0440\u0430\u0431\u043E\u0442\u0430\u0442\u044C",alternatives:["\u043E\u0431\u0440\u0430\u0431\u043E\u0442\u0430\u0439"],normalized:"process",form:"infinitive"},wait:{primary:"\u0436\u0434\u0430\u0442\u044C",alternatives:["\u0436\u0434\u0438","\u043F\u043E\u0434\u043E\u0436\u0434\u0438"],normalized:"wait",form:"infinitive"},fetch:{primary:"\u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044C",alternatives:["\u0437\u0430\u0433\u0440\u0443\u0437\u0438"],normalized:"fetch",form:"infinitive"},settle:{primary:"\u0441\u0442\u0430\u0431\u0438\u043B\u0438\u0437\u0438\u0440\u043E\u0432\u0430\u0442\u044C",normalized:"settle",form:"infinitive"},if:{primary:"\u0435\u0441\u043B\u0438",normalized:"if"},when:{primary:"\u043A\u043E\u0433\u0434\u0430",normalized:"when"},where:{primary:"\u0433\u0434\u0435",normalized:"where"},else:{primary:"\u0438\u043D\u0430\u0447\u0435",normalized:"else"},repeat:{primary:"\u043F\u043E\u0432\u0442\u043E\u0440\u0438\u0442\u044C",alternatives:["\u043F\u043E\u0432\u0442\u043E\u0440\u0438"],normalized:"repeat",form:"infinitive"},for:{primary:"\u0434\u043B\u044F",alternatives:["\u043A\u0430\u0436\u0434\u044B\u0439"],normalized:"for"},while:{primary:"\u043F\u043E\u043A\u0430",normalized:"while"},continue:{primary:"\u043F\u0440\u043E\u0434\u043E\u043B\u0436\u0438\u0442\u044C",alternatives:["\u043F\u0440\u043E\u0434\u043E\u043B\u0436\u0438"],normalized:"continue",form:"infinitive"},halt:{primary:"\u043E\u0441\u0442\u0430\u043D\u043E\u0432\u0438\u0442\u044C",alternatives:["\u043E\u0441\u0442\u0430\u043D\u043E\u0432\u0438\u0441\u044C","\u0441\u0442\u043E\u043F"],normalized:"halt",form:"infinitive"},throw:{primary:"\u0431\u0440\u043E\u0441\u0438\u0442\u044C",alternatives:["\u0431\u0440\u043E\u0441\u044C"],normalized:"throw",form:"infinitive"},call:{primary:"\u0432\u044B\u0437\u0432\u0430\u0442\u044C",alternatives:["\u0432\u044B\u0437\u043E\u0432\u0438"],normalized:"call",form:"infinitive"},return:{primary:"\u0432\u0435\u0440\u043D\u0443\u0442\u044C",alternatives:["\u0432\u0435\u0440\u043D\u0438"],normalized:"return",form:"infinitive"},then:{primary:"\u0437\u0430\u0442\u0435\u043C",alternatives:["\u043F\u043E\u0442\u043E\u043C","\u0442\u043E\u0433\u0434\u0430"],normalized:"then"},and:{primary:"\u0438",normalized:"and"},end:{primary:"\u043A\u043E\u043D\u0435\u0446",normalized:"end"},js:{primary:"js",normalized:"js"},async:{primary:"\u0430\u0441\u0438\u043D\u0445\u0440\u043E\u043D\u043D\u043E",alternatives:["async"],normalized:"async"},tell:{primary:"\u0441\u043A\u0430\u0437\u0430\u0442\u044C",alternatives:["\u0441\u043A\u0430\u0436\u0438"],normalized:"tell",form:"infinitive"},default:{primary:"\u043F\u043E_\u0443\u043C\u043E\u043B\u0447\u0430\u043D\u0438\u044E",normalized:"default"},init:{primary:"\u0438\u043D\u0438\u0446\u0438\u0430\u043B\u0438\u0437\u0438\u0440\u043E\u0432\u0430\u0442\u044C",alternatives:["\u0438\u043D\u0438\u0446\u0438\u0430\u043B\u0438\u0437\u0438\u0440\u0443\u0439"],normalized:"init",form:"infinitive"},behavior:{primary:"\u043F\u043E\u0432\u0435\u0434\u0435\u043D\u0438\u0435",normalized:"behavior"},install:{primary:"\u0443\u0441\u0442\u0430\u043D\u043E\u0432\u0438\u0442\u044C_\u043F\u0430\u043A\u0435\u0442",normalized:"install",form:"infinitive"},measure:{primary:"\u0438\u0437\u043C\u0435\u0440\u0438\u0442\u044C",alternatives:["\u0438\u0437\u043C\u0435\u0440\u044C"],normalized:"measure",form:"infinitive"},beep:{primary:"\u0437\u0432\u0443\u043A",normalized:"beep"},break:{primary:"\u043F\u0440\u0435\u0440\u0432\u0430\u0442\u044C",normalized:"break"},copy:{primary:"\u043A\u043E\u043F\u0438\u0440\u043E\u0432\u0430\u0442\u044C",normalized:"copy"},exit:{primary:"\u0432\u044B\u0439\u0442\u0438",normalized:"exit"},pick:{primary:"\u0432\u044B\u0431\u0440\u0430\u0442\u044C",normalized:"pick"},render:{primary:"\u043E\u0442\u043E\u0431\u0440\u0430\u0437\u0438\u0442\u044C",normalized:"render"},into:{primary:"\u0432",alternatives:["\u0432\u043E"],normalized:"into"},before:{primary:"\u0434\u043E",alternatives:["\u043F\u0435\u0440\u0435\u0434"],normalized:"before"},after:{primary:"\u043F\u043E\u0441\u043B\u0435",normalized:"after"},until:{primary:"\u043F\u043E\u043A\u0430_\u043D\u0435",normalized:"until"},event:{primary:"\u0441\u043E\u0431\u044B\u0442\u0438\u0435",normalized:"event"},from:{primary:"\u0438\u0437",alternatives:["\u043E\u0442","\u0441"],normalized:"from"},connect:{primary:"\u043F\u043E\u0434\u043A\u043B\u044E\u0447\u0438\u0442\u044C",alternatives:["\u0441\u043E\u0435\u0434\u0438\u043D\u0438\u0442\u044C","\u043F\u043E\u0434\u043A\u043B\u044E\u0447\u0438\u0442\u044C\u0441\u044F"],normalized:"connect"},stream:{primary:"\u0442\u0440\u0430\u043D\u0441\u043B\u0438\u0440\u043E\u0432\u0430\u0442\u044C",alternatives:["\u043F\u043E\u0442\u043E\u043A","\u0441\u0442\u0440\u0438\u043C"],normalized:"stream"},live:{primary:"\u0432-\u043F\u0440\u044F\u043C\u043E\u043C-\u044D\u0444\u0438\u0440\u0435",alternatives:["\u043F\u0440\u044F\u043C\u043E\u0439-\u044D\u0444\u0438\u0440","\u0432\u0436\u0438\u0432\u0443\u044E"],normalized:"live"},socket:{primary:"\u0441\u043E\u043A\u0435\u0442",alternatives:["\u0433\u043D\u0435\u0437\u0434\u043E","websocket"],normalized:"socket"}},eventHandler:{keyword:{primary:"\u043F\u0440\u0438",normalized:"on"},sourceMarker:{primary:"\u043D\u0430",alternatives:["\u0432","\u043F\u0440\u0438"],position:"before"},eventMarker:{primary:"\u043F\u0440\u0438",position:"before"},temporalMarkers:["\u043A\u043E\u0433\u0434\u0430","\u0435\u0441\u043B\u0438"]}},Na=["===","!==","->","==","!=","<=",">=","&&","||","**","+=","-=","*=","/=","+","-","*","/","=",">","<","!","&","|","%","^","~"],_a=class{constructor(r=Na){this.name="operator",this.operators=[...r].sort((e,t)=>t.length-e.length);}canExtract(r,e){return this.operators.some(t=>r.startsWith(t,e))}extract(r,e){for(let t of this.operators)if(r.startsWith(t,e))return {value:t,length:t.length};return null}},Oa="()[]{},:;",Ma=class{constructor(r=Oa){this.punctuation=r,this.name="punctuation";}canExtract(r,e){return this.punctuation.includes(r[e])}extract(r,e){let t=r[e];return this.punctuation.includes(t)?{value:t,length:1}:null}};function Ia(r,e){let t=r[e];if(t==="#"){let i=r.slice(e).match(/^#[a-zA-Z_][\w-]*/);return i?i[0]:null}if(t==="."){let i=r.slice(e).match(/^\.[a-zA-Z_][\w-]*/);return i?i[0]:null}if(t==="["){let i=0,a=e;for(;a<r.length;){if(r[a]==="["&&i++,r[a]==="]"&&(i--,i===0))return r.slice(e,a+1);a++;}return null}if(t==="<"){let i=r.slice(e).match(/^<[\w-]+(?:[#.][\w-]+|\[[^\]]+\])*\s*\/>/);return i?i[0]:null}return null}var ja=class{constructor(){this.name="css-selector";}canExtract(r,e){let t=r[e];return t==="#"||t==="."||t==="["||t==="<"}extract(r,e){let t=Ia(r,e);return t?{value:t,length:t.length,metadata:{type:"css-selector"}}:null}},La=class{constructor(){this.name="event-modifier";}canExtract(r,e){if(r[e]!==".")return false;let t=r.slice(e);return /^\.(once|prevent|stop|debounce|throttle|queue)/.test(t)}extract(r,e){let t=r.slice(e).match(/^\.(?:once|prevent|stop|debounce|throttle|queue)(?:\(([^)]+)\))?/);if(!t)return null;let i=t[0],a=i.slice(1).split("(")[0],u=t[1];return {value:i,length:i.length,metadata:{modifierName:a,value:u?a==="queue"?u:parseInt(u,10):void 0}}}};function $a(r,e){let t=r.slice(e);if(t.startsWith("http://")||t.startsWith("https://")){let i=t.match(/^https?:\/\/[^\s]*/);return i?i[0]:null}if(t.startsWith("//")){let i=t.match(/^\/\/[^\s]*/);return i?i[0]:null}if(t.startsWith("./")||t.startsWith("../")){let i=t.match(/^\.\.?\/[^\s]*/);return i?i[0]:null}if(t.startsWith("/")){let i=t.match(/^\/[^\s]*/);return i?i[0]:null}return null}var Va=class{constructor(){this.name="url";}canExtract(r,e){let t=r.slice(e);return t.startsWith("http://")||t.startsWith("https://")||t.startsWith("//")||t.startsWith("./")||t.startsWith("../")||t.startsWith("/")}extract(r,e){let t=$a(r,e);return t?{value:t,length:t.length,metadata:{type:"url"}}:null}},qa=class{constructor(){this.name="variable-ref";}canExtract(r,e){return r[e]===":"&&e+1<r.length&&/[a-zA-Z_]/.test(r[e+1])}extract(r,e){if(!this.canExtract(r,e))return null;let t=1;for(;e+t<r.length&&/[a-zA-Z0-9_]/.test(r[e+t]);)t++;return {value:r.substring(e,e+t),length:t,metadata:{type:"variable-reference"}}}};function Wa(r){return {isLetter:i=>r.test(i),isIdentifierChar:i=>/[0-9]/.test(i)||r.test(i)}}var Ua=class{constructor(r,e,t){this.name=r;let i=Wa(e);this.isLetter=i.isLetter,this.isIdentifierChar=i.isIdentifierChar,this.prepositions=t;}setContext(r){this.context=r;}canExtract(r,e){return this.isLetter(r[e])}extract(r,e){if(!this.context)throw new Error(`${this.name}: context not set`);let t=e,i="";for(;t<r.length&&this.isIdentifierChar(r[t]);)i+=r[t++];if(!i)return null;let a=i.toLowerCase(),u=this.prepositions.has(a),n=this.context.lookupKeyword(a),o=n&&n.normalized!==n.native?n.normalized:void 0,s;if(!n&&this.context.normalizer){let l=this.context.normalizer.normalize(i);if(l.stem!==i&&l.confidence>=.7){let m=this.context.lookupKeyword(l.stem);m&&(s=m.normalized);}}return {value:i,length:t-e,metadata:{normalized:o||s,isPreposition:u}}}},Ka=new Set(["\u0432","\u0432\u043E","\u043D\u0430","\u0441","\u0441\u043E","\u043A","\u043A\u043E","\u043E","\u043E\u0431","\u043E\u0431\u043E","\u0443","\u043E\u0442","\u0434\u043E","\u0438\u0437","\u0437\u0430","\u043F\u043E","\u043F\u043E\u0434","\u043D\u0430\u0434","\u043F\u0435\u0440\u0435\u0434","\u043F\u0435\u0440\u0435\u0434\u043E","\u043C\u0435\u0436\u0434\u0443","\u0447\u0435\u0440\u0435\u0437","\u0431\u0435\u0437","\u0434\u043B\u044F","\u043F\u0440\u0438","\u043F\u0440\u043E","\u043F\u043E\u0441\u043B\u0435","\u0432\u043E\u043A\u0440\u0443\u0433","\u043F\u0440\u043E\u0442\u0438\u0432","\u0432\u043C\u0435\u0441\u0442\u043E","\u043A\u0440\u043E\u043C\u0435","\u0441\u0440\u0435\u0434\u0438"]);function Ga(){return [new Ua("russian-keyword",/[a-zA-Zа-яА-ЯёЁ]/,Ka)]}function Ha(r){let e=r.charCodeAt(0);return e>=65&&e<=90||e>=97&&e<=122||e===95||e===36}function Ya(r){let e=r.charCodeAt(0);return e>=48&&e<=57||e>=65&&e<=90||e>=97&&e<=122||e===95||e===36}var Ja=class{constructor(){this.name="ascii-identifier";}setContext(r){this.context=r;}canExtract(r,e){return Ha(r[e])}extract(r,e){if(!this.context)throw new Error("AsciiIdentifierExtractor: context not set");let t=e,i="",a=e;for(;a<r.length&&Ya(r[a]);)i+=r[a],a++;if(!i)return null;let u=this.context.lookupKeyword(i),n=u&&u.normalized!==u.native?u.normalized:void 0;return {value:i,length:a-t,metadata:{normalized:n}}}};function Xa(){return [new Va,new La,new qa,new ja]}var Za=new Set(["\u0432","\u0432\u043E","\u043D\u0430","\u0441","\u0441\u043E","\u043A","\u043A\u043E","\u043E","\u043E\u0431","\u043E\u0431\u043E","\u0443","\u043E\u0442","\u0434\u043E","\u0438\u0437","\u0437\u0430","\u043F\u043E","\u043F\u043E\u0434","\u043D\u0430\u0434","\u043F\u0435\u0440\u0435\u0434","\u043F\u0435\u0440\u0435\u0434\u043E","\u043C\u0435\u0436\u0434\u0443","\u0447\u0435\u0440\u0435\u0437","\u0431\u0435\u0437","\u0434\u043B\u044F","\u043F\u0440\u0438","\u043F\u0440\u043E","\u043F\u043E\u0441\u043B\u0435","\u0432\u043E\u043A\u0440\u0443\u0433","\u043F\u0440\u043E\u0442\u0438\u0432","\u0432\u043C\u0435\u0441\u0442\u043E","\u043A\u0440\u043E\u043C\u0435","\u0441\u0440\u0435\u0434\u0438"]),Qa=[{native:"\u0438\u0441\u0442\u0438\u043D\u0430",normalized:"true"},{native:"\u043F\u0440\u0430\u0432\u0434\u0430",normalized:"true"},{native:"\u043B\u043E\u0436\u044C",normalized:"false"},{native:"null",normalized:"null"},{native:"\u043D\u0435\u043E\u043F\u0440\u0435\u0434\u0435\u043B\u0435\u043D\u043E",normalized:"undefined"},{native:"\u0441\u0435\u043A\u0443\u043D\u0434\u0430",normalized:"s"},{native:"\u0441\u0435\u043A\u0443\u043D\u0434\u044B",normalized:"s"},{native:"\u0441\u0435\u043A\u0443\u043D\u0434",normalized:"s"},{native:"\u043C\u0438\u043B\u043B\u0438\u0441\u0435\u043A\u0443\u043D\u0434\u0430",normalized:"ms"},{native:"\u043C\u0438\u043B\u043B\u0438\u0441\u0435\u043A\u0443\u043D\u0434\u044B",normalized:"ms"},{native:"\u043C\u0438\u043B\u043B\u0438\u0441\u0435\u043A\u0443\u043D\u0434",normalized:"ms"},{native:"\u043C\u0438\u043D\u0443\u0442\u0430",normalized:"m"},{native:"\u043C\u0438\u043D\u0443\u0442\u044B",normalized:"m"},{native:"\u043C\u0438\u043D\u0443\u0442",normalized:"m"},{native:"\u0447\u0430\u0441",normalized:"h"},{native:"\u0447\u0430\u0441\u0430",normalized:"h"},{native:"\u0447\u0430\u0441\u043E\u0432",normalized:"h"},{native:"\u043F\u0435\u0440\u0432\u0430\u044F",normalized:"first"},{native:"\u043F\u0435\u0440\u0432\u043E\u0435",normalized:"first"},{native:"\u043F\u043E\u0441\u043B\u0435\u0434\u043D\u044F\u044F",normalized:"last"},{native:"\u043F\u043E\u0441\u043B\u0435\u0434\u043D\u0435\u0435",normalized:"last"},{native:"\u0441\u043B\u0435\u0434\u0443\u044E\u0449\u0430\u044F",normalized:"next"},{native:"\u043F\u0440\u0435\u0434\u044B\u0434\u0443\u0449\u0430\u044F",normalized:"previous"},{native:"\u043F\u0443\u0441\u0442\u0430\u044F",normalized:"empty"},{native:"\u043F\u0443\u0441\u0442\u043E\u0435",normalized:"empty"},{native:"\u043C\u043E\u044F",normalized:"my"},{native:"\u043C\u043E\u0451",normalized:"my"},{native:"\u043C\u043E\u0438",normalized:"my"}],eu=class extends K{constructor(){super(),this.language="ru",this.direction="ltr",this.initializeKeywordsFromProfile(hr,Qa),this.setNormalizer(new fr),this.registerExtractors([...Xa(),...Ga(),new W,new U,new Ja,new _a,new Ma]);}classifyToken(r){let e=r.toLowerCase();return Za.has(e)?"particle":this.isKeyword(e)?"keyword":/^\.(once|prevent|stop|debounce|throttle|queue)(\(.*\))?$/.test(r)?"event-modifier":r.startsWith("#")||r.startsWith(".")||r.startsWith("[")||r.startsWith("*")||r.startsWith("<")?"selector":r.startsWith('"')||r.startsWith("'")||/^\d/.test(r)?"literal":"identifier"}},ru=new eu;J("ru",ru,hr);var Er={code:"pl",name:"Polish",nativeName:"Polski",direction:"ltr",script:"latin",wordOrder:"SVO",markingStrategy:"preposition",usesSpaces:true,defaultVerbForm:"imperative",verb:{position:"start",subjectDrop:true,suffixes:["a\u0107","e\u0107","i\u0107","y\u0107","\u0105\u0107","owa\u0107"]},references:{me:"ja",it:"to",you:"ty",result:"wynik",event:"zdarzenie",target:"cel",body:"body"},possessive:{marker:"",markerPosition:"after-object",usePossessiveAdjectives:true,specialForms:{me:"m\xF3j",it:"jego",you:"tw\xF3j"},keywords:{m\u00F3j:"me",moja:"me",moje:"me",tw\u00F3j:"you",twoja:"you",twoje:"you",jego:"it",jej:"it"}},roleMarkers:{destination:{primary:"do",alternatives:["w","na"],position:"before"},source:{primary:"z",alternatives:["od","ze"],position:"before"},patient:{primary:"",position:"before"},style:{primary:"z",alternatives:["ze"],position:"before"}},keywords:{toggle:{primary:"prze\u0142\u0105cz",alternatives:["przelacz"],normalized:"toggle",form:"imperative"},add:{primary:"dodaj",normalized:"add",form:"imperative"},remove:{primary:"usu\u0144",alternatives:["usun","wyczy\u015B\u0107","wyczysc"],normalized:"remove",form:"imperative"},put:{primary:"umie\u015B\u0107",alternatives:["umiesc","wstaw"],normalized:"put",form:"imperative"},append:{primary:"do\u0142\u0105cz",alternatives:["dolacz"],normalized:"append",form:"imperative"},prepend:{primary:"poprzed\u017A",alternatives:["poprzedz"],normalized:"prepend",form:"imperative"},take:{primary:"we\u017A",alternatives:["wez"],normalized:"take",form:"imperative"},make:{primary:"utw\xF3rz",alternatives:["utworz","stw\xF3rz","stworz"],normalized:"make",form:"imperative"},clone:{primary:"sklonuj",normalized:"clone",form:"imperative"},swap:{primary:"zamie\u0144",alternatives:["zamien"],normalized:"swap",form:"imperative"},morph:{primary:"przekszta\u0142\u0107",alternatives:["przeksztalc"],normalized:"morph",form:"imperative"},set:{primary:"ustaw",alternatives:["okre\u015Bl","okresl"],normalized:"set",form:"imperative"},get:{primary:"uzyskaj",normalized:"get",form:"imperative"},increment:{primary:"zwi\u0119ksz",alternatives:["zwieksz"],normalized:"increment",form:"imperative"},decrement:{primary:"zmniejsz",normalized:"decrement",form:"imperative"},log:{primary:"loguj",alternatives:["wypisz"],normalized:"log",form:"imperative"},show:{primary:"poka\u017C",alternatives:["pokaz","wy\u015Bwietl","wyswietl"],normalized:"show",form:"imperative"},hide:{primary:"ukryj",alternatives:["schowaj"],normalized:"hide",form:"imperative"},transition:{primary:"animuj",alternatives:["przej\u015Bcie","przejscie"],normalized:"transition",form:"imperative"},on:{primary:"gdy",alternatives:["przy","na"],normalized:"on"},trigger:{primary:"wyzw\xF3l",alternatives:["wyzwol"],normalized:"trigger",form:"imperative"},send:{primary:"wy\u015Blij",alternatives:["wyslij"],normalized:"send",form:"imperative"},focus:{primary:"skup",alternatives:["skupienie"],normalized:"focus",form:"imperative"},blur:{primary:"rozmyj",alternatives:["odskup"],normalized:"blur",form:"imperative"},empty:{primary:"opr\xF3\u017Cnij",alternatives:["oproznij"],normalized:"empty"},open:{primary:"otw\xF3rz",alternatives:["otworz"],normalized:"open"},close:{primary:"zamknij",normalized:"close"},select:{primary:"zaznacz",normalized:"select"},clear:{primary:"zeruj",normalized:"clear"},reset:{primary:"zresetuj",normalized:"reset"},breakpoint:{primary:"punkt-przerwania",normalized:"breakpoint"},go:{primary:"id\u017A",alternatives:["idz","przejd\u017A","przejdz","nawiguj"],normalized:"go",form:"imperative"},scroll:{primary:"przewi\u0144",alternatives:["przewin"],normalized:"scroll",form:"imperative"},push:{primary:"wepchnij",alternatives:["push"],normalized:"push",form:"imperative"},replace:{primary:"nadpisz",alternatives:["zamie\u0144_url","zamien_url"],normalized:"replace",form:"imperative"},process:{primary:"przetw\xF3rz",alternatives:["przetworz"],normalized:"process",form:"imperative"},wait:{primary:"czekaj",alternatives:["poczekaj"],normalized:"wait",form:"imperative"},fetch:{primary:"pobierz",alternatives:["za\u0142aduj","zaladuj"],normalized:"fetch",form:"imperative"},settle:{primary:"ustabilizuj",normalized:"settle",form:"imperative"},if:{primary:"je\u015Bli",alternatives:["jesli","je\u017Celi","jezeli"],normalized:"if"},when:{primary:"kiedy",normalized:"when"},where:{primary:"gdzie",normalized:"where"},else:{primary:"inaczej",alternatives:["wpp"],normalized:"else"},repeat:{primary:"powt\xF3rz",alternatives:["powtorz"],normalized:"repeat",form:"imperative"},for:{primary:"dla",alternatives:["ka\u017Cdy","kazdy"],normalized:"for"},while:{primary:"dop\xF3ki",alternatives:["dopoki","podczas"],normalized:"while"},continue:{primary:"kontynuuj",alternatives:["dalej"],normalized:"continue",form:"imperative"},halt:{primary:"zatrzymaj",alternatives:["stop"],normalized:"halt",form:"imperative"},throw:{primary:"rzu\u0107",alternatives:["rzuc"],normalized:"throw",form:"imperative"},call:{primary:"wywo\u0142aj",alternatives:["wywolaj"],normalized:"call",form:"imperative"},return:{primary:"zwr\xF3\u0107",alternatives:["zwroc"],normalized:"return",form:"imperative"},then:{primary:"wtedy",alternatives:["potem","nast\u0119pnie","nastepnie"],normalized:"then"},and:{primary:"i",alternatives:["oraz"],normalized:"and"},end:{primary:"koniec",normalized:"end"},js:{primary:"js",normalized:"js"},async:{primary:"async",alternatives:["asynchronicznie"],normalized:"async"},tell:{primary:"powiedz",normalized:"tell",form:"imperative"},default:{primary:"domy\u015Blnie",alternatives:["domyslnie"],normalized:"default"},init:{primary:"inicjuj",normalized:"init",form:"imperative"},behavior:{primary:"zachowanie",normalized:"behavior"},install:{primary:"zainstaluj",normalized:"install",form:"imperative"},measure:{primary:"zmierz",normalized:"measure",form:"imperative"},beep:{primary:"sygna\u0142",normalized:"beep"},break:{primary:"przerwij",normalized:"break"},copy:{primary:"kopiuj",normalized:"copy"},exit:{primary:"wyjd\u017A",normalized:"exit"},pick:{primary:"wybierz",normalized:"pick"},render:{primary:"renderuj",normalized:"render"},into:{primary:"do",alternatives:["w"],normalized:"into"},before:{primary:"przed",normalized:"before"},after:{primary:"po",normalized:"after"},click:{primary:"klikni\u0119ciu",alternatives:["klikniecie","klik"],normalized:"click"},hover:{primary:"najechaniu",alternatives:["hover"],normalized:"hover"},submit:{primary:"wys\u0142aniu",alternatives:["wyslaniu","submit"],normalized:"submit"},input:{primary:"wprowadzeniu",alternatives:["input"],normalized:"input"},change:{primary:"zmianie",alternatives:["zmiana"],normalized:"change"},until:{primary:"a\u017C",alternatives:["az"],normalized:"until"},event:{primary:"zdarzenie",normalized:"event"},from:{primary:"z",alternatives:["od","ze"],normalized:"from"},connect:{primary:"po\u0142\u0105cz",alternatives:["pod\u0142\u0105cz"],normalized:"connect"},stream:{primary:"transmituj",alternatives:["strumie\u0144","streamuj"],normalized:"stream"},live:{primary:"na-\u017Cywo",alternatives:["na-bie\u017C\u0105co","live"],normalized:"live"},socket:{primary:"gniazdo",alternatives:["socket","websocket"],normalized:"socket"}},eventHandler:{keyword:{primary:"gdy",alternatives:["przy","na"],normalized:"on"},sourceMarker:{primary:"na",alternatives:["w","przy"],position:"before"},conditionalKeyword:{primary:"kiedy",alternatives:["gdy","je\u015Bli"]},eventMarker:{primary:"przy",alternatives:["na"],position:"before"},temporalMarkers:["kiedy","gdy","przy"]}},vr=new Map([["prze\u0142\u0105cz","prze\u0142\u0105cza\u0107"],["przelacz","przelaczac"],["dodaj","dodawa\u0107"],["usu\u0144","usuwa\u0107"],["usun","usuwac"],["umie\u015B\u0107","umieszcza\u0107"],["umiesc","umieszczac"],["wstaw","wstawia\u0107"],["ustaw","ustawia\u0107"],["pobierz","pobiera\u0107"],["we\u017A","bra\u0107"],["wez","brac"],["zwi\u0119ksz","zwi\u0119ksza\u0107"],["zwieksz","zwiekszac"],["zmniejsz","zmniejsza\u0107"],["poka\u017C","pokazywa\u0107"],["pokaz","pokazywac"],["ukryj","ukrywa\u0107"],["schowaj","schowywa\u0107"],["czekaj","czeka\u0107"],["poczekaj","poczeka\u0107"],["id\u017A","i\u015B\u0107"],["idz","isc"],["przejd\u017A","przej\u015B\u0107"],["przejdz","przejsc"],["wywo\u0142aj","wywo\u0142ywa\u0107"],["wywolaj","wywolywac"],["wy\u015Blij","wysy\u0142a\u0107"],["wyslij","wysylac"],["loguj","logowa\u0107"],["wypisz","wypisywa\u0107"],["sklonuj","sklonowa\u0107"],["kopiuj","kopiowa\u0107"],["zamie\u0144","zamienia\u0107"],["zamien","zamieniac"],["utw\xF3rz","tworzy\u0107"],["utworz","tworzyc"],["stw\xF3rz","stwarza\u0107"],["stworz","stwarzac"],["skup","skupia\u0107"],["rozmyj","rozmywa\u0107"],["nawiguj","nawigowa\u0107"],["za\u0142aduj","\u0142adowa\u0107"],["zaladuj","ladowac"],["powt\xF3rz","powtarza\u0107"],["powtorz","powtarzac"],["kontynuuj","kontynuowa\u0107"],["zatrzymaj","zatrzymywa\u0107"],["przerwij","przerywa\u0107"],["rzu\u0107","rzuca\u0107"],["rzuc","rzucac"],["zwr\xF3\u0107","zwraca\u0107"],["zwroc","zwracac"],["inicjuj","inicjowa\u0107"],["zainstaluj","instalowa\u0107"],["zmierz","mierzy\u0107"]]),gr=class{constructor(){this.language="pl";}isNormalizable(r){return r.length<3?false:/[a-zA-ZąęćńóśźżłĄĘĆŃÓŚŹŻŁ]/.test(r)}normalize(r){let e=r.toLowerCase();if(this.isInfinitive(e))return w(e);let t=this.tryImperativeNormalization(e);if(t)return t;let i=this.tryPastTenseNormalization(e);if(i)return i;let a=this.tryPresentTenseNormalization(e);return a||w(e)}isInfinitive(r){return ["a\u0107","e\u0107","i\u0107","y\u0107","\u0105\u0107","owa\u0107","iwa\u0107","ywa\u0107"].some(t=>r.endsWith(t))}tryImperativeNormalization(r){return vr.has(r)?y(vr.get(r),.95,{removedSuffixes:["imperative"],conjugationType:"imperative"}):r.endsWith("aj")?y(r.slice(0,-2)+"a\u0107",.8,{removedSuffixes:["aj"],conjugationType:"imperative"}):r.endsWith("uj")?y(r.slice(0,-2)+"owa\u0107",.8,{removedSuffixes:["uj"],conjugationType:"imperative"}):r.endsWith("ij")?y(r.slice(0,-2)+"i\u0107",.75,{removedSuffixes:["ij"],conjugationType:"imperative"}):null}tryPresentTenseNormalization(r){return r.endsWith("uj\u0119")||r.endsWith("uje")?y(r.slice(0,-3)+"owa\u0107",.85,{removedSuffixes:["uj\u0119"],conjugationType:"present"}):r.endsWith("am")&&r.length>3?y(r.slice(0,-2)+"a\u0107",.8,{removedSuffixes:["am"],conjugationType:"present"}):r.endsWith("em")&&r.length>3?y(r.slice(0,-2)+"e\u0107",.75,{removedSuffixes:["em"],conjugationType:"present"}):r.endsWith("\u0119")&&r.length>2?y(r.slice(0,-1)+"a\u0107",.7,{removedSuffixes:["\u0119"],conjugationType:"present"}):null}tryPastTenseNormalization(r){if(r.endsWith("a\u0142em")||r.endsWith("a\u0142am"))return y(r.slice(0,-4)+"a\u0107",.85,{removedSuffixes:[r.slice(-4)],conjugationType:"past"});if(r.endsWith("a\u0142")||r.endsWith("a\u0142a")){let e=r.endsWith("a\u0142a")?3:2;return y(r.slice(0,-e)+"a\u0107",.8,{removedSuffixes:[r.slice(-e)],conjugationType:"past"})}if(r.endsWith("i\u0142em")||r.endsWith("i\u0142am")||r.endsWith("ilem")||r.endsWith("ilam"))return y(r.slice(0,-4)+"i\u0107",.85,{removedSuffixes:[r.slice(-4)],conjugationType:"past"});if(r.endsWith("i\u0142")||r.endsWith("i\u0142a")||r.endsWith("il")||r.endsWith("ila")){let e=r.endsWith("i\u0142a")||r.endsWith("ila")?3:2;return y(r.slice(0,-e)+"i\u0107",.8,{removedSuffixes:[r.slice(-e)],conjugationType:"past"})}return null}},tu=["===","!==","->","==","!=","<=",">=","&&","||","**","+=","-=","*=","/=","+","-","*","/","=",">","<","!","&","|","%","^","~"],iu=class{constructor(r=tu){this.name="operator",this.operators=[...r].sort((e,t)=>t.length-e.length);}canExtract(r,e){return this.operators.some(t=>r.startsWith(t,e))}extract(r,e){for(let t of this.operators)if(r.startsWith(t,e))return {value:t,length:t.length};return null}},au="()[]{},:;",uu=class{constructor(r=au){this.punctuation=r,this.name="punctuation";}canExtract(r,e){return this.punctuation.includes(r[e])}extract(r,e){let t=r[e];return this.punctuation.includes(t)?{value:t,length:1}:null}};function nu(r,e){let t=r[e];if(t==="#"){let i=r.slice(e).match(/^#[a-zA-Z_][\w-]*/);return i?i[0]:null}if(t==="."){let i=r.slice(e).match(/^\.[a-zA-Z_][\w-]*/);return i?i[0]:null}if(t==="["){let i=0,a=e;for(;a<r.length;){if(r[a]==="["&&i++,r[a]==="]"&&(i--,i===0))return r.slice(e,a+1);a++;}return null}if(t==="<"){let i=r.slice(e).match(/^<[\w-]+(?:[#.][\w-]+|\[[^\]]+\])*\s*\/>/);return i?i[0]:null}return null}var ou=class{constructor(){this.name="css-selector";}canExtract(r,e){let t=r[e];return t==="#"||t==="."||t==="["||t==="<"}extract(r,e){let t=nu(r,e);return t?{value:t,length:t.length,metadata:{type:"css-selector"}}:null}},su=class{constructor(){this.name="event-modifier";}canExtract(r,e){if(r[e]!==".")return false;let t=r.slice(e);return /^\.(once|prevent|stop|debounce|throttle|queue)/.test(t)}extract(r,e){let t=r.slice(e).match(/^\.(?:once|prevent|stop|debounce|throttle|queue)(?:\(([^)]+)\))?/);if(!t)return null;let i=t[0],a=i.slice(1).split("(")[0],u=t[1];return {value:i,length:i.length,metadata:{modifierName:a,value:u?a==="queue"?u:parseInt(u,10):void 0}}}};function lu(r,e){let t=r.slice(e);if(t.startsWith("http://")||t.startsWith("https://")){let i=t.match(/^https?:\/\/[^\s]*/);return i?i[0]:null}if(t.startsWith("//")){let i=t.match(/^\/\/[^\s]*/);return i?i[0]:null}if(t.startsWith("./")||t.startsWith("../")){let i=t.match(/^\.\.?\/[^\s]*/);return i?i[0]:null}if(t.startsWith("/")){let i=t.match(/^\/[^\s]*/);return i?i[0]:null}return null}var mu=class{constructor(){this.name="url";}canExtract(r,e){let t=r.slice(e);return t.startsWith("http://")||t.startsWith("https://")||t.startsWith("//")||t.startsWith("./")||t.startsWith("../")||t.startsWith("/")}extract(r,e){let t=lu(r,e);return t?{value:t,length:t.length,metadata:{type:"url"}}:null}},cu=class{constructor(){this.name="variable-ref";}canExtract(r,e){return r[e]===":"&&e+1<r.length&&/[a-zA-Z_]/.test(r[e+1])}extract(r,e){if(!this.canExtract(r,e))return null;let t=1;for(;e+t<r.length&&/[a-zA-Z0-9_]/.test(r[e+t]);)t++;return {value:r.substring(e,e+t),length:t,metadata:{type:"variable-reference"}}}},pu=new Set(["do","od","z","ze","w","we","na","po","pod","przed","za","nad","mi\u0119dzy","miedzy","przez","dla","bez","o","przy","u","wed\u0142ug","wedlug","mimo","w\u015Br\xF3d","wsrod","obok","poza","wok\xF3\u0142","wokol","przeciw","ku"]);function du(){let r=/[a-zA-ZąęćńóśźżłĄĘĆŃÓŚŹŻŁ]/;return {isLetter:i=>r.test(i),isIdentifierChar:i=>/[0-9]/.test(i)||r.test(i)}}var{isLetter:yu,isIdentifierChar:fu}=du(),hu=class{constructor(){this.name="polish-keyword";}setContext(r){this.context=r;}canExtract(r,e){return yu(r[e])}extract(r,e){if(!this.context)throw new Error("PolishKeywordExtractor: context not set");let t=e,i="";for(;t<r.length&&fu(r[t]);)i+=r[t++];if(!i)return null;let a=i.toLowerCase(),u=pu.has(a),n=this.context.lookupKeyword(a),o=n&&n.normalized!==n.native?n.normalized:void 0,s;if(!n&&this.context.normalizer){let l=this.context.normalizer.normalize(i);if(l.stem!==i&&l.confidence>=.7){let m=this.context.lookupKeyword(l.stem);m&&(s=m.normalized);}}return {value:i,length:t-e,metadata:{normalized:o||s,isPreposition:u}}}};function vu(){return [new hu]}function Eu(){return [new mu,new su,new cu,new ou]}var gu=new Set(["do","od","z","ze","w","we","na","po","pod","przed","za","nad","mi\u0119dzy","miedzy","przez","dla","bez","o","przy","u","wed\u0142ug","wedlug","mimo","w\u015Br\xF3d","wsrod","obok","poza","wok\xF3\u0142","wokol","przeciw","ku"]),zu=[{native:"prawda",normalized:"true"},{native:"fa\u0142sz",normalized:"false"},{native:"falsz",normalized:"false"},{native:"null",normalized:"null"},{native:"nieokre\u015Blony",normalized:"undefined"},{native:"nieokreslony",normalized:"undefined"},{native:"pierwszy",normalized:"first"},{native:"pierwsza",normalized:"first"},{native:"pierwsze",normalized:"first"},{native:"ostatni",normalized:"last"},{native:"ostatnia",normalized:"last"},{native:"ostatnie",normalized:"last"},{native:"nast\u0119pny",normalized:"next"},{native:"nastepny",normalized:"next"},{native:"poprzedni",normalized:"previous"},{native:"najbli\u017Cszy",normalized:"closest"},{native:"najblizszy",normalized:"closest"},{native:"rodzic",normalized:"parent"},{native:"klikni\u0119cie",normalized:"click"},{native:"klikniecie",normalized:"click"},{native:"klik",normalized:"click"},{native:"click",normalized:"click"},{native:"zmiana",normalized:"change"},{native:"wys\u0142anie",normalized:"submit"},{native:"wyslanie",normalized:"submit"},{native:"naci\u015Bni\u0119cie",normalized:"keydown"},{native:"nacisniecie",normalized:"keydown"},{native:"klawisz",normalized:"keydown"},{native:"najechanie",normalized:"mouseover"},{native:"zjechanie",normalized:"mouseout"},{native:"rozmycie",normalized:"blur"},{native:"za\u0142adowanie",normalized:"load"},{native:"zaladowanie",normalized:"load"},{native:"przewini\u0119cie",normalized:"scroll"},{native:"przewiniecie",normalized:"scroll"},{native:"input",normalized:"input"},{native:"m\xF3j",normalized:"my"},{native:"moj",normalized:"my"},{native:"sekunda",normalized:"s"},{native:"sekundy",normalized:"s"},{native:"sekund",normalized:"s"},{native:"milisekunda",normalized:"ms"},{native:"milisekundy",normalized:"ms"},{native:"milisekund",normalized:"ms"},{native:"minuta",normalized:"m"},{native:"minuty",normalized:"m"},{native:"minut",normalized:"m"},{native:"godzina",normalized:"h"},{native:"godziny",normalized:"h"},{native:"godzin",normalized:"h"},{native:"po\u0142\xF3\u017C",normalized:"put"},{native:"poloz",normalized:"put"},{native:"lub",normalized:"or"},{native:"nie",normalized:"not"},{native:"jest",normalized:"is"},{native:"istnieje",normalized:"exists"},{native:"pusty",normalized:"empty"},{native:"puste",normalized:"empty"}],ku=class extends K{constructor(){super(),this.language="pl",this.direction="ltr",this.initializeKeywordsFromProfile(Er,zu),this.setNormalizer(new gr),this.registerExtractors(Eu()),this.registerExtractor(new W),this.registerExtractor(new U),this.registerExtractors(vu()),this.registerExtractor(new iu),this.registerExtractor(new uu);}classifyToken(r){let e=r.toLowerCase();return gu.has(e)?"particle":this.isKeyword(e)?"keyword":/^\.(once|prevent|stop|debounce|throttle|queue)(\(.*\))?$/.test(r)?"event-modifier":r.startsWith("#")||r.startsWith(".")||r.startsWith("[")||r.startsWith("*")||r.startsWith("<")?"selector":r.startsWith('"')||r.startsWith("'")||/^\d/.test(r)?"literal":["==","!=","<=",">=","<",">","&&","||","!"].includes(r)?"operator":"identifier"}},Cu=new ku;J("pl",Cu,Er);function bu(r){return /[а-яА-ЯіІїЇєЄґҐьЬ']/.test(r)}var zr=new Map([["\u043F\u0435\u0440\u0435\u043C\u043A\u043D\u0438","\u043F\u0435\u0440\u0435\u043C\u043A\u043D\u0443\u0442\u0438"],["\u0434\u043E\u0434\u0430\u0439","\u0434\u043E\u0434\u0430\u0442\u0438"],["\u0432\u0438\u0434\u0430\u043B\u0438","\u0432\u0438\u0434\u0430\u043B\u0438\u0442\u0438"],["\u043F\u0440\u0438\u0431\u0435\u0440\u0438","\u043F\u0440\u0438\u0431\u0440\u0430\u0442\u0438"],["\u043F\u043E\u043A\u043B\u0430\u0434\u0438","\u043F\u043E\u043A\u043B\u0430\u0441\u0442\u0438"],["\u043F\u043E\u043C\u0456\u0441\u0442\u0438","\u043F\u043E\u043C\u0456\u0441\u0442\u0438\u0442\u0438"],["\u0432\u0441\u0442\u0430\u0432","\u0432\u0441\u0442\u0430\u0432\u0438\u0442\u0438"],["\u0432\u0456\u0437\u044C\u043C\u0438","\u0432\u0437\u044F\u0442\u0438"],["\u0441\u0442\u0432\u043E\u0440\u0438","\u0441\u0442\u0432\u043E\u0440\u0438\u0442\u0438"],["\u043A\u043B\u043E\u043D\u0443\u0439","\u043A\u043B\u043E\u043D\u0443\u0432\u0430\u0442\u0438"],["\u043F\u043E\u043C\u0456\u043D\u044F\u0439","\u043F\u043E\u043C\u0456\u043D\u044F\u0442\u0438"],["\u0442\u0440\u0430\u043D\u0441\u0444\u043E\u0440\u043C\u0443\u0439","\u0442\u0440\u0430\u043D\u0441\u0444\u043E\u0440\u043C\u0443\u0432\u0430\u0442\u0438"],["\u0432\u0441\u0442\u0430\u043D\u043E\u0432\u0438","\u0432\u0441\u0442\u0430\u043D\u043E\u0432\u0438\u0442\u0438"],["\u0437\u0430\u0434\u0430\u0439","\u0437\u0430\u0434\u0430\u0442\u0438"],["\u043E\u0442\u0440\u0438\u043C\u0430\u0439","\u043E\u0442\u0440\u0438\u043C\u0430\u0442\u0438"],["\u0437\u0431\u0456\u043B\u044C\u0448","\u0437\u0431\u0456\u043B\u044C\u0448\u0438\u0442\u0438"],["\u0437\u043C\u0435\u043D\u0448","\u0437\u043C\u0435\u043D\u0448\u0438\u0442\u0438"],["\u0437\u0430\u043F\u0438\u0448\u0438","\u0437\u0430\u043F\u0438\u0441\u0430\u0442\u0438"],["\u043F\u043E\u043A\u0430\u0436\u0438","\u043F\u043E\u043A\u0430\u0437\u0430\u0442\u0438"],["\u0441\u0445\u043E\u0432\u0430\u0439","\u0441\u0445\u043E\u0432\u0430\u0442\u0438"],["\u043F\u0440\u0438\u0445\u043E\u0432\u0430\u0439","\u043F\u0440\u0438\u0445\u043E\u0432\u0430\u0442\u0438"],["\u0430\u043D\u0456\u043C\u0443\u0439","\u0430\u043D\u0456\u043C\u0443\u0432\u0430\u0442\u0438"],["\u0432\u0438\u043A\u043B\u0438\u0447","\u0432\u0438\u043A\u043B\u0438\u043A\u0430\u0442\u0438"],["\u043D\u0430\u0434\u0456\u0448\u043B\u0438","\u043D\u0430\u0434\u0456\u0441\u043B\u0430\u0442\u0438"],["\u0441\u0444\u043E\u043A\u0443\u0441\u0443\u0439","\u0441\u0444\u043E\u043A\u0443\u0441\u0443\u0432\u0430\u0442\u0438"],["\u0440\u043E\u0437\u0444\u043E\u043A\u0443\u0441\u0443\u0439","\u0440\u043E\u0437\u0444\u043E\u043A\u0443\u0441\u0443\u0432\u0430\u0442\u0438"],["\u043F\u0435\u0440\u0435\u0439\u0434\u0438","\u043F\u0435\u0440\u0435\u0439\u0442\u0438"],["\u0439\u0434\u0438","\u0439\u0442\u0438"],["\u0447\u0435\u043A\u0430\u0439","\u0447\u0435\u043A\u0430\u0442\u0438"],["\u0437\u0430\u0447\u0435\u043A\u0430\u0439","\u0437\u0430\u0447\u0435\u043A\u0430\u0442\u0438"],["\u0437\u0430\u0432\u0430\u043D\u0442\u0430\u0436","\u0437\u0430\u0432\u0430\u043D\u0442\u0430\u0436\u0438\u0442\u0438"],["\u043F\u043E\u0432\u0442\u043E\u0440\u0438","\u043F\u043E\u0432\u0442\u043E\u0440\u0438\u0442\u0438"],["\u043F\u0440\u043E\u0434\u043E\u0432\u0436\u0443\u0439","\u043F\u0440\u043E\u0434\u043E\u0432\u0436\u0438\u0442\u0438"],["\u043A\u0438\u043D\u044C","\u043A\u0438\u043D\u0443\u0442\u0438"],["\u043F\u043E\u0432\u0435\u0440\u043D\u0438","\u043F\u043E\u0432\u0435\u0440\u043D\u0443\u0442\u0438"],["\u0441\u043A\u0430\u0436\u0438","\u0441\u043A\u0430\u0437\u0430\u0442\u0438"],["\u0456\u043D\u0456\u0446\u0456\u0430\u043B\u0456\u0437\u0443\u0439","\u0456\u043D\u0456\u0446\u0456\u0430\u043B\u0456\u0437\u0443\u0432\u0430\u0442\u0438"],["\u0432\u0438\u043C\u0456\u0440\u044F\u0439","\u0432\u0438\u043C\u0456\u0440\u044F\u0442\u0438"]]),kr=class{constructor(){this.language="uk";}isNormalizable(r){return r.length<3?false:bu(r)}normalize(r){let e=r.toLowerCase();if(e.endsWith("\u0441\u044F")||e.endsWith("\u0441\u044C")){let n=this.tryReflexiveNormalization(e);if(n)return n}if(e.endsWith("\u0442\u0438")||e.endsWith("\u0447\u0438"))return w(r);let t=this.tryImperativeLookup(e);if(t)return t;let i=this.tryPastTenseNormalization(e);if(i)return i;let a=this.tryPresentTenseNormalization(e);if(a)return a;let u=this.tryGenericImperativeNormalization(e);return u||w(r)}tryReflexiveNormalization(r){let e=r.slice(0,-2);if(r.endsWith("\u0442\u0438\u0441\u044F")||r.endsWith("\u0447\u0438\u0441\u044F"))return w(r);let t=this.normalizeNonReflexive(e);if(t.confidence<1){let i=t.stem.endsWith("\u0442\u0438")?t.stem.slice(0,-2)+"\u0442\u0438\u0441\u044F":t.stem+"\u0441\u044F";return y(i,t.confidence*.95,{removedSuffixes:["\u0441\u044F",...t.metadata?.removedSuffixes||[]],conjugationType:"reflexive"})}return null}normalizeNonReflexive(r){if(r.endsWith("\u0442\u0438")||r.endsWith("\u0447\u0438"))return w(r);let e=this.tryImperativeLookup(r);if(e)return e;let t=this.tryPastTenseNormalization(r);if(t)return t;let i=this.tryPresentTenseNormalization(r);if(i)return i;let a=this.tryGenericImperativeNormalization(r);return a||w(r)}tryImperativeLookup(r){return zr.has(r)?y(zr.get(r),.95,{removedSuffixes:["imperative"],conjugationType:"imperative"}):null}tryGenericImperativeNormalization(r){return r.endsWith("\u0439\u0442\u0435")&&r.length>5?y(r.slice(0,-3)+"\u0442\u0438",.8,{removedSuffixes:["\u0439\u0442\u0435"],conjugationType:"imperative"}):r.endsWith("\u0456\u0442\u044C")&&r.length>5?y(r.slice(0,-3)+"\u0438\u0442\u0438",.8,{removedSuffixes:["\u0456\u0442\u044C"],conjugationType:"imperative"}):r.endsWith("\u0439")&&r.length>3?y(r.slice(0,-1)+"\u0442\u0438",.75,{removedSuffixes:["\u0439"],conjugationType:"imperative"}):r.endsWith("\u0438")&&r.length>3?y(r+"\u0442\u0438",.7,{removedSuffixes:["\u0438\u2192\u0438\u0442\u0438"],conjugationType:"imperative"}):null}tryPastTenseNormalization(r){return r.endsWith("\u0430\u043B\u0430")&&r.length>4?y(r.slice(0,-3)+"\u0430\u0442\u0438",.85,{removedSuffixes:["\u0430\u043B\u0430"],conjugationType:"past"}):r.endsWith("\u0438\u043B\u0430")&&r.length>4?y(r.slice(0,-3)+"\u0438\u0442\u0438",.85,{removedSuffixes:["\u0438\u043B\u0430"],conjugationType:"past"}):r.endsWith("\u0430\u043B\u0438")&&r.length>4?y(r.slice(0,-3)+"\u0430\u0442\u0438",.85,{removedSuffixes:["\u0430\u043B\u0438"],conjugationType:"past"}):r.endsWith("\u0438\u043B\u0438")&&r.length>4?y(r.slice(0,-3)+"\u0438\u0442\u0438",.85,{removedSuffixes:["\u0438\u043B\u0438"],conjugationType:"past"}):r.endsWith("\u0430\u0432")&&r.length>3?y(r.slice(0,-2)+"\u0430\u0442\u0438",.82,{removedSuffixes:["\u0430\u0432"],conjugationType:"past"}):r.endsWith("\u0438\u0432")&&r.length>3?y(r.slice(0,-2)+"\u0438\u0442\u0438",.82,{removedSuffixes:["\u0438\u0432"],conjugationType:"past"}):null}tryPresentTenseNormalization(r){return r.endsWith("\u0438\u0448")&&r.length>3?y(r.slice(0,-2)+"\u0438\u0442\u0438",.8,{removedSuffixes:["\u0438\u0448"],conjugationType:"present"}):r.endsWith("\u0438\u0442\u044C")&&r.length>4?y(r.slice(0,-3)+"\u0438\u0442\u0438",.78,{removedSuffixes:["\u0438\u0442\u044C"],conjugationType:"present"}):r.endsWith("\u0438\u043C\u043E")&&r.length>4?y(r.slice(0,-3)+"\u0438\u0442\u0438",.8,{removedSuffixes:["\u0438\u043C\u043E"],conjugationType:"present"}):r.endsWith("\u044F\u0442\u044C")&&r.length>4?y(r.slice(0,-3)+"\u0438\u0442\u0438",.78,{removedSuffixes:["\u044F\u0442\u044C"],conjugationType:"present"}):r.endsWith("\u0454\u0448")&&r.length>3?y(r.slice(0,-2)+"\u0430\u0442\u0438",.78,{removedSuffixes:["\u0454\u0448"],conjugationType:"present"}):r.endsWith("\u0435\u0448")&&r.length>3?y(r.slice(0,-2)+"\u0430\u0442\u0438",.75,{removedSuffixes:["\u0435\u0448"],conjugationType:"present"}):r.endsWith("\u0454")&&r.length>2?y(r.slice(0,-1)+"\u0430\u0442\u0438",.72,{removedSuffixes:["\u0454"],conjugationType:"present"}):r.endsWith("\u0454\u043C\u043E")&&r.length>4?y(r.slice(0,-3)+"\u0430\u0442\u0438",.8,{removedSuffixes:["\u0454\u043C\u043E"],conjugationType:"present"}):r.endsWith("\u044E\u0442\u044C")&&r.length>4?y(r.slice(0,-3)+"\u0430\u0442\u0438",.78,{removedSuffixes:["\u044E\u0442\u044C"],conjugationType:"present"}):r.endsWith("\u0443\u0442\u044C")&&r.length>4?y(r.slice(0,-3)+"\u0430\u0442\u0438",.75,{removedSuffixes:["\u0443\u0442\u044C"],conjugationType:"present"}):null}},Cr={code:"uk",name:"Ukrainian",nativeName:"\u0423\u043A\u0440\u0430\u0457\u043D\u0441\u044C\u043A\u0430",direction:"ltr",script:"cyrillic",wordOrder:"SVO",markingStrategy:"preposition",usesSpaces:true,defaultVerbForm:"infinitive",verb:{position:"start",subjectDrop:true,suffixes:["\u0442\u0438","\u0442\u0438\u0441\u044F","\u0438\u0442\u0438","\u0438\u0442\u0438\u0441\u044F","\u0430\u0442\u0438","\u0430\u0442\u0438\u0441\u044F","\u0456\u0442\u0438","\u0456\u0442\u0438\u0441\u044F"]},references:{me:"\u044F",it:"\u0446\u0435",you:"\u0442\u0438",result:"\u0440\u0435\u0437\u0443\u043B\u044C\u0442\u0430\u0442",event:"\u043F\u043E\u0434\u0456\u044F",target:"\u0446\u0456\u043B\u044C",body:"body"},possessive:{marker:"",markerPosition:"after-object",usePossessiveAdjectives:true,specialForms:{me:"\u043C\u0456\u0439",it:"\u0439\u043E\u0433\u043E",you:"\u0442\u0432\u0456\u0439"},keywords:{\u043C\u0456\u0439:"me",\u043C\u043E\u044F:"me",\u043C\u043E\u0454:"me",\u043C\u043E\u0457:"me",\u0442\u0432\u0456\u0439:"you",\u0442\u0432\u043E\u044F:"you",\u0442\u0432\u043E\u0454:"you",\u0442\u0432\u043E\u0457:"you",\u0439\u043E\u0433\u043E:"it",\u0457\u0457:"it"}},roleMarkers:{destination:{primary:"\u0432",alternatives:["\u043D\u0430","\u0434\u043E"],position:"before"},source:{primary:"\u0437",alternatives:["\u0432\u0456\u0434","\u0456\u0437"],position:"before"},patient:{primary:"",position:"before"},style:{primary:"\u0437",alternatives:["\u0456\u0437"],position:"before"}},keywords:{toggle:{primary:"\u043F\u0435\u0440\u0435\u043C\u043A\u043D\u0443\u0442\u0438",alternatives:["\u043F\u0435\u0440\u0435\u043C\u043A\u043D\u0438"],normalized:"toggle",form:"infinitive"},add:{primary:"\u0434\u043E\u0434\u0430\u0442\u0438",alternatives:["\u0434\u043E\u0434\u0430\u0439"],normalized:"add",form:"infinitive"},remove:{primary:"\u0432\u0438\u0434\u0430\u043B\u0438\u0442\u0438",alternatives:["\u0432\u0438\u0434\u0430\u043B\u0438","\u043F\u0440\u0438\u0431\u0440\u0430\u0442\u0438","\u043F\u0440\u0438\u0431\u0435\u0440\u0438"],normalized:"remove",form:"infinitive"},put:{primary:"\u043F\u043E\u043A\u043B\u0430\u0441\u0442\u0438",alternatives:["\u043F\u043E\u043A\u043B\u0430\u0434\u0438","\u043F\u043E\u043C\u0456\u0441\u0442\u0438\u0442\u0438","\u043F\u043E\u043C\u0456\u0441\u0442\u0438","\u0432\u0441\u0442\u0430\u0432\u0438\u0442\u0438","\u0432\u0441\u0442\u0430\u0432"],normalized:"put",form:"infinitive"},append:{primary:"\u0434\u043E\u0434\u0430\u0442\u0438_\u0432_\u043A\u0456\u043D\u0435\u0446\u044C",alternatives:["\u0434\u043E\u043F\u0438\u0441\u0430\u0442\u0438"],normalized:"append",form:"infinitive"},prepend:{primary:"\u0434\u043E\u0434\u0430\u0442\u0438_\u043D\u0430_\u043F\u043E\u0447\u0430\u0442\u043E\u043A",normalized:"prepend",form:"infinitive"},take:{primary:"\u0432\u0437\u044F\u0442\u0438",alternatives:["\u0432\u0456\u0437\u044C\u043C\u0438"],normalized:"take",form:"infinitive"},make:{primary:"\u0441\u0442\u0432\u043E\u0440\u0438\u0442\u0438",alternatives:["\u0441\u0442\u0432\u043E\u0440\u0438"],normalized:"make",form:"infinitive"},clone:{primary:"\u043A\u043B\u043E\u043D\u0443\u0432\u0430\u0442\u0438",alternatives:["\u043A\u043B\u043E\u043D\u0443\u0439"],normalized:"clone",form:"infinitive"},swap:{primary:"\u043F\u043E\u043C\u0456\u043D\u044F\u0442\u0438",alternatives:["\u043F\u043E\u043C\u0456\u043D\u044F\u0439"],normalized:"swap",form:"infinitive"},morph:{primary:"\u0442\u0440\u0430\u043D\u0441\u0444\u043E\u0440\u043C\u0443\u0432\u0430\u0442\u0438",alternatives:["\u0442\u0440\u0430\u043D\u0441\u0444\u043E\u0440\u043C\u0443\u0439"],normalized:"morph",form:"infinitive"},set:{primary:"\u0432\u0441\u0442\u0430\u043D\u043E\u0432\u0438\u0442\u0438",alternatives:["\u0432\u0441\u0442\u0430\u043D\u043E\u0432\u0438","\u0437\u0430\u0434\u0430\u0442\u0438","\u0437\u0430\u0434\u0430\u0439"],normalized:"set",form:"infinitive"},get:{primary:"\u043E\u0442\u0440\u0438\u043C\u0430\u0442\u0438",alternatives:["\u043E\u0442\u0440\u0438\u043C\u0430\u0439"],normalized:"get",form:"infinitive"},increment:{primary:"\u0437\u0431\u0456\u043B\u044C\u0448\u0438\u0442\u0438",alternatives:["\u0437\u0431\u0456\u043B\u044C\u0448"],normalized:"increment",form:"infinitive"},decrement:{primary:"\u0437\u043C\u0435\u043D\u0448\u0438\u0442\u0438",alternatives:["\u0437\u043C\u0435\u043D\u0448"],normalized:"decrement",form:"infinitive"},log:{primary:"\u0437\u0430\u043F\u0438\u0441\u0430\u0442\u0438",alternatives:["\u0437\u0430\u043F\u0438\u0448\u0438"],normalized:"log",form:"infinitive"},show:{primary:"\u043F\u043E\u043A\u0430\u0437\u0430\u0442\u0438",alternatives:["\u043F\u043E\u043A\u0430\u0436\u0438"],normalized:"show",form:"infinitive"},hide:{primary:"\u0441\u0445\u043E\u0432\u0430\u0442\u0438",alternatives:["\u0441\u0445\u043E\u0432\u0430\u0439","\u043F\u0440\u0438\u0445\u043E\u0432\u0430\u0442\u0438","\u043F\u0440\u0438\u0445\u043E\u0432\u0430\u0439"],normalized:"hide",form:"infinitive"},transition:{primary:"\u0430\u043D\u0456\u043C\u0443\u0432\u0430\u0442\u0438",alternatives:["\u0430\u043D\u0456\u043C\u0443\u0439"],normalized:"transition",form:"infinitive"},on:{primary:"\u043F\u0440\u0438",normalized:"on"},trigger:{primary:"\u0456\u043D\u0456\u0446\u0456\u044E\u0432\u0430\u0442\u0438",alternatives:["\u0437\u0430\u043F\u0443\u0441\u0442\u0438\u0442\u0438","\u0437\u0430\u043F\u0443\u0441\u0442\u0438"],normalized:"trigger",form:"infinitive"},send:{primary:"\u043D\u0430\u0434\u0456\u0441\u043B\u0430\u0442\u0438",alternatives:["\u043D\u0430\u0434\u0456\u0448\u043B\u0438"],normalized:"send",form:"infinitive"},focus:{primary:"\u0441\u0444\u043E\u043A\u0443\u0441\u0443\u0432\u0430\u0442\u0438",alternatives:["\u0441\u0444\u043E\u043A\u0443\u0441\u0443\u0439","\u0444\u043E\u043A\u0443\u0441"],normalized:"focus",form:"infinitive"},blur:{primary:"\u0440\u043E\u0437\u0444\u043E\u043A\u0443\u0441\u0443\u0432\u0430\u0442\u0438",alternatives:["\u0440\u043E\u0437\u0444\u043E\u043A\u0443\u0441\u0443\u0439"],normalized:"blur",form:"infinitive"},empty:{primary:"\u0441\u043F\u043E\u0440\u043E\u0436\u043D\u0438\u0442\u0438",normalized:"empty"},open:{primary:"\u0432\u0456\u0434\u043A\u0440\u0438\u0442\u0438",normalized:"open"},close:{primary:"\u0437\u0430\u043A\u0440\u0438\u0442\u0438",normalized:"close"},select:{primary:"\u0432\u0438\u0434\u0456\u043B\u0438\u0442\u0438",normalized:"select"},clear:{primary:"\u043E\u0447\u0438\u0441\u0442\u0438\u0442\u0438",normalized:"clear"},reset:{primary:"\u0441\u043A\u0438\u043D\u0443\u0442\u0438",normalized:"reset"},breakpoint:{primary:"\u0442\u043E\u0447\u043A\u0430-\u0437\u0443\u043F\u0438\u043D\u043A\u0438",normalized:"breakpoint"},click:{primary:"\u043A\u043B\u0456\u043A\u0443",alternatives:["\u043A\u043B\u0456\u043A","\u043D\u0430\u0442\u0438\u0441\u043A\u0430\u043D\u043D\u0456"],normalized:"click"},hover:{primary:"\u043D\u0430\u0432\u0435\u0434\u0435\u043D\u043D\u0456",alternatives:["\u043D\u0430\u0432\u0435\u0434\u0435\u043D\u043D\u044F"],normalized:"hover"},submit:{primary:"\u0432\u0456\u0434\u043F\u0440\u0430\u0432\u0446\u0456",alternatives:["\u0432\u0456\u0434\u043F\u0440\u0430\u0432\u043A\u0430"],normalized:"submit"},input:{primary:"\u0432\u0432\u0435\u0434\u0435\u043D\u043D\u0456",alternatives:["\u0432\u0432\u0435\u0434\u0435\u043D\u043D\u044F"],normalized:"input"},change:{primary:"\u0437\u043C\u0456\u043D\u0456",alternatives:["\u0437\u043C\u0456\u043D\u0430"],normalized:"change"},go:{primary:"\u043F\u0435\u0440\u0435\u0439\u0442\u0438",alternatives:["\u043F\u0435\u0440\u0435\u0439\u0434\u0438","\u0439\u0442\u0438","\u0439\u0434\u0438"],normalized:"go",form:"infinitive"},scroll:{primary:"\u043F\u0440\u043E\u043A\u0440\u0443\u0442\u0438\u0442\u0438",alternatives:["\u043F\u0440\u043E\u043A\u0440\u0443\u0442\u0438"],normalized:"scroll",form:"infinitive"},push:{primary:"\u0448\u0442\u043E\u0432\u0445\u043D\u0443\u0442\u0438",alternatives:["\u0437\u0430\u0448\u0442\u043E\u0432\u0445\u043D\u0443\u0442\u0438"],normalized:"push",form:"infinitive"},replace:{primary:"\u0437\u0430\u043C\u0456\u043D\u0438\u0442\u0438",alternatives:["\u0437\u0430\u043C\u0456\u043D\u0438"],normalized:"replace",form:"infinitive"},process:{primary:"\u043E\u0431\u0440\u043E\u0431\u0438\u0442\u0438",alternatives:["\u043E\u0431\u0440\u043E\u0431\u043B\u044F\u0442\u0438"],normalized:"process",form:"infinitive"},wait:{primary:"\u0447\u0435\u043A\u0430\u0442\u0438",alternatives:["\u0447\u0435\u043A\u0430\u0439","\u0437\u0430\u0447\u0435\u043A\u0430\u0439"],normalized:"wait",form:"infinitive"},fetch:{primary:"\u0437\u0430\u0432\u0430\u043D\u0442\u0430\u0436\u0438\u0442\u0438",alternatives:["\u0437\u0430\u0432\u0430\u043D\u0442\u0430\u0436"],normalized:"fetch",form:"infinitive"},settle:{primary:"\u0441\u0442\u0430\u0431\u0456\u043B\u0456\u0437\u0443\u0432\u0430\u0442\u0438",normalized:"settle",form:"infinitive"},if:{primary:"\u044F\u043A\u0449\u043E",normalized:"if"},when:{primary:"\u043A\u043E\u043B\u0438",normalized:"when"},where:{primary:"\u0434\u0435",normalized:"where"},else:{primary:"\u0456\u043D\u0430\u043A\u0448\u0435",normalized:"else"},repeat:{primary:"\u043F\u043E\u0432\u0442\u043E\u0440\u0438\u0442\u0438",alternatives:["\u043F\u043E\u0432\u0442\u043E\u0440\u0438"],normalized:"repeat",form:"infinitive"},for:{primary:"\u0434\u043B\u044F",alternatives:["\u043A\u043E\u0436\u043D\u0438\u0439"],normalized:"for"},while:{primary:"\u043F\u043E\u043A\u0438",normalized:"while"},continue:{primary:"\u043F\u0440\u043E\u0434\u043E\u0432\u0436\u0438\u0442\u0438",alternatives:["\u043F\u0440\u043E\u0434\u043E\u0432\u0436\u0443\u0439"],normalized:"continue",form:"infinitive"},halt:{primary:"\u0437\u0443\u043F\u0438\u043D\u0438\u0442\u0438",alternatives:["\u0437\u0443\u043F\u0438\u043D\u0438\u0441\u044C","\u0441\u0442\u043E\u043F"],normalized:"halt",form:"infinitive"},throw:{primary:"\u043A\u0438\u043D\u0443\u0442\u0438",alternatives:["\u043A\u0438\u043D\u044C"],normalized:"throw",form:"infinitive"},call:{primary:"\u0432\u0438\u043A\u043B\u0438\u043A\u0430\u0442\u0438",alternatives:["\u0432\u0438\u043A\u043B\u0438\u0447"],normalized:"call",form:"infinitive"},return:{primary:"\u043F\u043E\u0432\u0435\u0440\u043D\u0443\u0442\u0438",alternatives:["\u043F\u043E\u0432\u0435\u0440\u043D\u0438"],normalized:"return",form:"infinitive"},then:{primary:"\u043F\u043E\u0442\u0456\u043C",alternatives:["\u0434\u0430\u043B\u0456","\u0442\u043E\u0434\u0456"],normalized:"then"},and:{primary:"\u0456",alternatives:["\u0442\u0430"],normalized:"and"},end:{primary:"\u043A\u0456\u043D\u0435\u0446\u044C",normalized:"end"},js:{primary:"js",normalized:"js"},async:{primary:"\u0430\u0441\u0438\u043D\u0445\u0440\u043E\u043D\u043D\u043E",alternatives:["async"],normalized:"async"},tell:{primary:"\u0441\u043A\u0430\u0437\u0430\u0442\u0438",alternatives:["\u0441\u043A\u0430\u0436\u0438"],normalized:"tell",form:"infinitive"},default:{primary:"\u0437\u0430_\u0437\u0430\u043C\u043E\u0432\u0447\u0443\u0432\u0430\u043D\u043D\u044F\u043C",normalized:"default"},init:{primary:"\u0456\u043D\u0456\u0446\u0456\u0430\u043B\u0456\u0437\u0443\u0432\u0430\u0442\u0438",alternatives:["\u0456\u043D\u0456\u0446\u0456\u0430\u043B\u0456\u0437\u0443\u0439"],normalized:"init",form:"infinitive"},behavior:{primary:"\u043F\u043E\u0432\u0435\u0434\u0456\u043D\u043A\u0430",normalized:"behavior"},install:{primary:"\u0432\u0441\u0442\u0430\u043D\u043E\u0432\u0438\u0442\u0438_\u043F\u0430\u043A\u0435\u0442",normalized:"install",form:"infinitive"},measure:{primary:"\u0432\u0438\u043C\u0456\u0440\u044F\u0442\u0438",alternatives:["\u0432\u0438\u043C\u0456\u0440\u044F\u0439"],normalized:"measure",form:"infinitive"},beep:{primary:"\u0437\u0432\u0443\u043A",normalized:"beep"},break:{primary:"\u043F\u0435\u0440\u0435\u0440\u0432\u0430\u0442\u0438",normalized:"break"},copy:{primary:"\u043A\u043E\u043F\u0456\u044E\u0432\u0430\u0442\u0438",normalized:"copy"},exit:{primary:"\u0432\u0438\u0439\u0442\u0438",normalized:"exit"},pick:{primary:"\u0432\u0438\u0431\u0440\u0430\u0442\u0438",normalized:"pick"},render:{primary:"\u0432\u0456\u0434\u043E\u0431\u0440\u0430\u0437\u0438\u0442\u0438",normalized:"render"},into:{primary:"\u0432",alternatives:["\u0443"],normalized:"into"},before:{primary:"\u0434\u043E",alternatives:["\u043F\u0435\u0440\u0435\u0434"],normalized:"before"},after:{primary:"\u043F\u0456\u0441\u043B\u044F",normalized:"after"},until:{primary:"\u043F\u043E\u043A\u0438_\u043D\u0435",normalized:"until"},event:{primary:"\u043F\u043E\u0434\u0456\u044F",normalized:"event"},from:{primary:"\u0437",alternatives:["\u0432\u0456\u0434","\u0456\u0437"],normalized:"from"},connect:{primary:"\u043F\u0456\u0434\u043A\u043B\u044E\u0447\u0438\u0442\u0438",alternatives:["\u0437\u02BC\u0454\u0434\u043D\u0430\u0442\u0438","\u043F\u0456\u0434\u043A\u043B\u044E\u0447\u0438\u0442\u0438\u0441\u044F"],normalized:"connect"},stream:{primary:"\u0442\u0440\u0430\u043D\u0441\u043B\u044E\u0432\u0430\u0442\u0438",alternatives:["\u043F\u043E\u0442\u0456\u043A","\u0441\u0442\u0440\u0456\u043C"],normalized:"stream"},live:{primary:"\u043D\u0430\u0436\u0438\u0432\u043E",alternatives:["\u0443-\u043F\u0440\u044F\u043C\u043E\u043C\u0443-\u0435\u0444\u0456\u0440\u0456","\u0432-\u0440\u0435\u0436\u0438\u043C\u0456-\u0440\u0435\u0430\u043B\u044C\u043D\u043E\u0433\u043E-\u0447\u0430\u0441\u0443"],normalized:"live"},socket:{primary:"\u0441\u043E\u043A\u0435\u0442",alternatives:["\u0433\u043D\u0456\u0437\u0434\u043E","websocket"],normalized:"socket"}},eventHandler:{keyword:{primary:"\u043F\u0440\u0438",normalized:"on"},sourceMarker:{primary:"\u043D\u0430",alternatives:["\u0432","\u043F\u0440\u0438"],position:"before"},eventMarker:{primary:"\u043F\u0440\u0438",position:"before"},temporalMarkers:["\u043A\u043E\u043B\u0438","\u044F\u043A\u0449\u043E"]}},Au=["===","!==","->","==","!=","<=",">=","&&","||","**","+=","-=","*=","/=","+","-","*","/","=",">","<","!","&","|","%","^","~"],wu=class{constructor(r=Au){this.name="operator",this.operators=[...r].sort((e,t)=>t.length-e.length);}canExtract(r,e){return this.operators.some(t=>r.startsWith(t,e))}extract(r,e){for(let t of this.operators)if(r.startsWith(t,e))return {value:t,length:t.length};return null}},Du="()[]{},:;",xu=class{constructor(r=Du){this.punctuation=r,this.name="punctuation";}canExtract(r,e){return this.punctuation.includes(r[e])}extract(r,e){let t=r[e];return this.punctuation.includes(t)?{value:t,length:1}:null}};function Bu(r,e){let t=r[e];if(t==="#"){let i=r.slice(e).match(/^#[a-zA-Z_][\w-]*/);return i?i[0]:null}if(t==="."){let i=r.slice(e).match(/^\.[a-zA-Z_][\w-]*/);return i?i[0]:null}if(t==="["){let i=0,a=e;for(;a<r.length;){if(r[a]==="["&&i++,r[a]==="]"&&(i--,i===0))return r.slice(e,a+1);a++;}return null}if(t==="<"){let i=r.slice(e).match(/^<[\w-]+(?:[#.][\w-]+|\[[^\]]+\])*\s*\/>/);return i?i[0]:null}return null}var Fu=class{constructor(){this.name="css-selector";}canExtract(r,e){let t=r[e];return t==="#"||t==="."||t==="["||t==="<"}extract(r,e){let t=Bu(r,e);return t?{value:t,length:t.length,metadata:{type:"css-selector"}}:null}},Su=class{constructor(){this.name="event-modifier";}canExtract(r,e){if(r[e]!==".")return false;let t=r.slice(e);return /^\.(once|prevent|stop|debounce|throttle|queue)/.test(t)}extract(r,e){let t=r.slice(e).match(/^\.(?:once|prevent|stop|debounce|throttle|queue)(?:\(([^)]+)\))?/);if(!t)return null;let i=t[0],a=i.slice(1).split("(")[0],u=t[1];return {value:i,length:i.length,metadata:{modifierName:a,value:u?a==="queue"?u:parseInt(u,10):void 0}}}};function Tu(r,e){let t=r.slice(e);if(t.startsWith("http://")||t.startsWith("https://")){let i=t.match(/^https?:\/\/[^\s]*/);return i?i[0]:null}if(t.startsWith("//")){let i=t.match(/^\/\/[^\s]*/);return i?i[0]:null}if(t.startsWith("./")||t.startsWith("../")){let i=t.match(/^\.\.?\/[^\s]*/);return i?i[0]:null}if(t.startsWith("/")){let i=t.match(/^\/[^\s]*/);return i?i[0]:null}return null}var Pu=class{constructor(){this.name="url";}canExtract(r,e){let t=r.slice(e);return t.startsWith("http://")||t.startsWith("https://")||t.startsWith("//")||t.startsWith("./")||t.startsWith("../")||t.startsWith("/")}extract(r,e){let t=Tu(r,e);return t?{value:t,length:t.length,metadata:{type:"url"}}:null}},Ru=class{constructor(){this.name="variable-ref";}canExtract(r,e){return r[e]===":"&&e+1<r.length&&/[a-zA-Z_]/.test(r[e+1])}extract(r,e){if(!this.canExtract(r,e))return null;let t=1;for(;e+t<r.length&&/[a-zA-Z0-9_]/.test(r[e+t]);)t++;return {value:r.substring(e,e+t),length:t,metadata:{type:"variable-reference"}}}};function Nu(r){return {isLetter:i=>r.test(i),isIdentifierChar:i=>/[0-9]/.test(i)||r.test(i)}}var _u=class{constructor(r,e,t){this.name=r;let i=Nu(e);this.isLetter=i.isLetter,this.isIdentifierChar=i.isIdentifierChar,this.prepositions=t;}setContext(r){this.context=r;}canExtract(r,e){return this.isLetter(r[e])}extract(r,e){if(!this.context)throw new Error(`${this.name}: context not set`);let t=e,i="";for(;t<r.length&&this.isIdentifierChar(r[t]);)i+=r[t++];if(!i)return null;let a=i.toLowerCase(),u=this.prepositions.has(a),n=this.context.lookupKeyword(a),o=n&&n.normalized!==n.native?n.normalized:void 0,s;if(!n&&this.context.normalizer){let l=this.context.normalizer.normalize(i);if(l.stem!==i&&l.confidence>=.7){let m=this.context.lookupKeyword(l.stem);m&&(s=m.normalized);}}return {value:i,length:t-e,metadata:{normalized:o||s,isPreposition:u}}}},Ou=new Set(["\u0432","\u0443","\u043D\u0430","\u0437","\u0456\u0437","\u0437\u0456","\u0434\u043E","\u0432\u0456\u0434","\u043E","\u043E\u0431","\u043F\u0440\u0438","\u0434\u043B\u044F","\u043F\u0456\u0434","\u043D\u0430\u0434","\u043F\u0435\u0440\u0435\u0434","\u043C\u0456\u0436","\u0447\u0435\u0440\u0435\u0437","\u0431\u0435\u0437","\u043F\u043E","\u0437\u0430","\u043F\u0440\u043E","\u043F\u0456\u0441\u043B\u044F","\u043D\u0430\u0432\u043A\u043E\u043B\u043E","\u043F\u0440\u043E\u0442\u0438","\u0437\u0430\u043C\u0456\u0441\u0442\u044C","\u043A\u0440\u0456\u043C","\u0441\u0435\u0440\u0435\u0434","\u043A"]);function Mu(){return [new _u("ukrainian-keyword",/[a-zA-Zа-яА-ЯіІїЇєЄґҐьЬ']/,Ou)]}function Iu(r){let e=r.charCodeAt(0);return e>=65&&e<=90||e>=97&&e<=122||e===95||e===36}function ju(r){let e=r.charCodeAt(0);return e>=48&&e<=57||e>=65&&e<=90||e>=97&&e<=122||e===95||e===36}var Lu=class{constructor(){this.name="ascii-identifier";}setContext(r){this.context=r;}canExtract(r,e){return Iu(r[e])}extract(r,e){if(!this.context)throw new Error("AsciiIdentifierExtractor: context not set");let t=e,i="",a=e;for(;a<r.length&&ju(r[a]);)i+=r[a],a++;if(!i)return null;let u=this.context.lookupKeyword(i),n=u&&u.normalized!==u.native?u.normalized:void 0;return {value:i,length:a-t,metadata:{normalized:n}}}};function $u(){return [new Pu,new Su,new Ru,new Fu]}var Vu=new Set(["\u0432","\u0443","\u043D\u0430","\u0437","\u0456\u0437","\u0437\u0456","\u0434\u043E","\u0432\u0456\u0434","\u043E","\u043E\u0431","\u043F\u0440\u0438","\u0434\u043B\u044F","\u043F\u0456\u0434","\u043D\u0430\u0434","\u043F\u0435\u0440\u0435\u0434","\u043C\u0456\u0436","\u0447\u0435\u0440\u0435\u0437","\u0431\u0435\u0437","\u043F\u043E","\u0437\u0430","\u043F\u0440\u043E","\u043F\u0456\u0441\u043B\u044F","\u043D\u0430\u0432\u043A\u043E\u043B\u043E","\u043F\u0440\u043E\u0442\u0438","\u0437\u0430\u043C\u0456\u0441\u0442\u044C","\u043A\u0440\u0456\u043C","\u0441\u0435\u0440\u0435\u0434","\u043A"]),qu=[{native:"\u0456\u0441\u0442\u0438\u043D\u0430",normalized:"true"},{native:"\u043F\u0440\u0430\u0432\u0434\u0430",normalized:"true"},{native:"\u0445\u0438\u0431\u043D\u0456\u0441\u0442\u044C",normalized:"false"},{native:"null",normalized:"null"},{native:"\u043D\u0435\u0432\u0438\u0437\u043D\u0430\u0447\u0435\u043D\u043E",normalized:"undefined"},{native:"\u0441\u0435\u043A\u0443\u043D\u0434\u0430",normalized:"s"},{native:"\u0441\u0435\u043A\u0443\u043D\u0434\u0438",normalized:"s"},{native:"\u0441\u0435\u043A\u0443\u043D\u0434",normalized:"s"},{native:"\u043C\u0456\u043B\u0456\u0441\u0435\u043A\u0443\u043D\u0434\u0430",normalized:"ms"},{native:"\u043C\u0456\u043B\u0456\u0441\u0435\u043A\u0443\u043D\u0434\u0438",normalized:"ms"},{native:"\u043C\u0456\u043B\u0456\u0441\u0435\u043A\u0443\u043D\u0434",normalized:"ms"},{native:"\u0445\u0432\u0438\u043B\u0438\u043D\u0430",normalized:"m"},{native:"\u0445\u0432\u0438\u043B\u0438\u043D\u0438",normalized:"m"},{native:"\u0445\u0432\u0438\u043B\u0438\u043D",normalized:"m"},{native:"\u0433\u043E\u0434\u0438\u043D\u0430",normalized:"h"},{native:"\u0433\u043E\u0434\u0438\u043D\u0438",normalized:"h"},{native:"\u0433\u043E\u0434\u0438\u043D",normalized:"h"},{native:"\u043F\u0435\u0440\u0448\u0430",normalized:"first"},{native:"\u043F\u0435\u0440\u0448\u0435",normalized:"first"},{native:"\u043E\u0441\u0442\u0430\u043D\u043D\u044F",normalized:"last"},{native:"\u043E\u0441\u0442\u0430\u043D\u043D\u0454",normalized:"last"},{native:"\u043D\u0430\u0441\u0442\u0443\u043F\u043D\u0430",normalized:"next"},{native:"\u043F\u043E\u043F\u0435\u0440\u0435\u0434\u043D\u044F",normalized:"previous"},{native:"\u043F\u043E\u0440\u043E\u0436\u043D\u044F",normalized:"empty"},{native:"\u043F\u043E\u0440\u043E\u0436\u043D\u0454",normalized:"empty"},{native:"\u043C\u043E\u044F",normalized:"my"},{native:"\u043C\u043E\u0454",normalized:"my"},{native:"\u043C\u043E\u0457",normalized:"my"}],Wu=class extends K{constructor(){super(),this.language="uk",this.direction="ltr",this.initializeKeywordsFromProfile(Cr,qu),this.setNormalizer(new kr),this.registerExtractors([...$u(),...Mu(),new W,new U,new Lu,new wu,new xu]);}classifyToken(r){let e=r.toLowerCase();return Vu.has(e)?"particle":this.isKeyword(e)?"keyword":/^\.(once|prevent|stop|debounce|throttle|queue)(\(.*\))?$/.test(r)?"event-modifier":r.startsWith("#")||r.startsWith(".")||r.startsWith("[")||r.startsWith("*")||r.startsWith("<")?"selector":r.startsWith('"')||r.startsWith("'")||/^\d/.test(r)?"literal":"identifier"}},Uu=new Wu;J("uk",Uu,Cr);function he(r){let e=r.getAttribute("data-lang");if(e)return xe(e);let t=r.getAttribute("data-hyperscript-lang")??r.closest?.("[data-hyperscript-lang]")?.getAttribute("data-hyperscript-lang");if(t)return xe(t);let i=typeof document<"u"?document.documentElement?.lang:null;return i&&i!=="en"?xe(i):null}function xe(r){return r.split("-")[0].toLowerCase()}var br={add:[["patient",""],["destination","to"]],append:[["patient",""],["destination","to"]],async:[],beep:[["patient",""]],behavior:[["patient",""]],blur:[["patient",""]],break:[],breakpoint:[],call:[["patient",""]],clear:[["patient",""]],clone:[["patient",""],["destination","into"]],close:[["patient",""]],compound:[],continue:[],copy:[["patient",""]],decrement:[["patient",""],["quantity","by"]],default:[["destination",""],["patient","to"]],else:[],empty:[["patient",""]],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"]],open:[["style","as"],["patient",""]],pick:[["patient",""],["source","from"]],prepend:[["patient",""],["destination","to"]],process:[["patient","partials in"]],push:[["patient","url"]],put:[["patient",""],["destination","into"]],remove:[["patient",""],["source","from"]],render:[["patient",""],["style","with"]],repeat:[["quantity",""],["condition","until"]],replace:[["patient","url"]],reset:[["patient",""]],return:[["patient",""]],scroll:[["destination","to"]],select:[["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:[["duration",""]],while:[["condition",""]]};function ve(r){switch(r.kind){case "event-handler":return Ku(r);case "compound":return Gu(r);default:return Hu(r)}}function Ku(r){let e=["on"],t=r.roles.get("event");t&&e.push(se(t));let i=r.roles.get("source");if(i&&e.push("from",se(i)),r.body&&r.body.length>0){let a=r.body.map(ve);e.push(a.join(" then "));}return e.join(" ")}function Gu(r){let e=r.chainType==="async"?"async":r.chainType;return r.statements.map(ve).join(` ${e} `)}function Hu(r){let e=br[r.action];if(e){let i=[r.action];for(let[a,u]of e){let n=r.roles.get(a);n&&(a==="destination"&&n.type==="reference"&&n.value==="me"||(u&&i.push(u),i.push(se(n))));}return i.join(" ")}let t=[r.action];for(let[,i]of r.roles)t.push(se(i));return t.join(" ")}function se(r){switch(r.type){case "literal":return typeof r.value=="string"&&r.dataType==="string"?`"${r.value}"`:String(r.value);case "selector":return r.value;case "reference":return r.value;case "property-path":return Yu(r);case "expression":return r.raw;case "flag":return r.enabled?`+${r.name}`:`~${r.name}`}}function Yu(r){let e=se(r.object),t=r.property;if(r.object.type==="reference")switch(r.object.value){case "me":return `my ${t}`;case "it":return `its ${t}`;case "you":return `your ${t}`}return `${e}'s ${t}`}var wr=.5,Ju={confidenceThreshold:wr,strategy:"semantic",fallbackToOriginal:true};function Xu(r,e){return typeof r=="number"?r:r[e]??r["*"]??wr}function Be(r,e,t={}){let i={...Ju,...t},a=Ar(r,e,i);if(a!==null)return a;let u=Qu(r);if(u){let n=Ar(u.commands,e,i);if(n!==null)return u.prefix+n}return r}function Ar(r,e,t){if(t.strategy==="semantic"||t.strategy==="auto"){let i=Xu(t.confidenceThreshold,e),a=Dr(r,e,i);if(a!==null)return a}if((t.strategy==="auto"||t.strategy==="i18n")&&t.i18nToEnglish){let i=en(r,e,t.i18nToEnglish);if(i!==null)return i}return null}var Zu=/^(on\s+(?:every\s+)?[\w-]+(?:\[.*?\])?(?:\.[\w-]+(?:\([^)]*\))?)*(?:\s+from\s+\S+)?(?:\s+queue\s+\w+)?\s+)/;function Qu(r){let e=r.match(Zu);if(!e)return null;let t=e[1],i=r.slice(t.length);return i?{prefix:t,commands:i}:null}function Dr(r,e,t){try{let i=tn(r,e);if(i.length>1)return an(i,e,t);if(!ur(e))return null;let a=lr(r,e);return a.confidence<t||!a.node?null:ve(a.node)}catch{return null}}function en(r,e,t){try{let i=t(r,e);return i!==r?i:null}catch{return null}}function rn(r){let e=["then"],t=L(r);if(t?.keywords?.then){let i=t.keywords.then;if(i.primary&&i.primary!=="then"&&e.push(i.primary),i.alternatives)for(let a of i.alternatives)e.includes(a)||e.push(a);}return e}function tn(r,e){let i=rn(e).map(o=>o.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")),a=new RegExp(`\\s+(?:${i.join("|")})\\s+`,"i"),u=r.split(`
4
- `).map(o=>o.trim()).filter(o=>o.length>0),n=[];for(let o of u){let s=o.split(a);n.push(...s);}return n}function an(r,e,t){let i=[];for(let a of r){let u=Dr(a.trim(),e,t);if(u===null)return null;i.push(u);}return i.join(" then ")}function Fe(r={}){return function(t){let{internals:i}=t,a=i.runtime,u=a.getScript.bind(a);a.getScript=function(n){let o=u(n);if(!o)return null;let s=un(n,r);if(!s||s==="en")return o;let l=Be(o,s,r);return r.debug&&l!==o&&console.log(`[hyperscript-i18n] ${s}: "${o}" \u2192 "${l}"`),l};}}function un(r,e){if(e.languageAttribute){let i=r.getAttribute(e.languageAttribute);if(i)return i.split("-")[0].toLowerCase()}let t=he(r);return t||(e.defaultLanguage??null)}function xr(r,e,t={}){return e==="en"?r:Be(r,e,t)}ar(r=>pr(r));function Br(){typeof _hyperscript<"u"&&_hyperscript.use&&(_hyperscript.use(Fe()),nn());}function nn(){if(typeof document>"u")return;let e=_hyperscript?.internals?.runtime;if(!e?.processNode||!e?.getInternalData)return;let t=e.getScriptSelector?.()??"[_], [script], [data-script]";document.querySelectorAll(t).forEach(i=>{let a=e.getInternalData(i);a.initialized&&(a.initialized=false);}),e.processNode(document.body);}var ys=["ru","pl","uk"];Br();exports.plugin=Fe;exports.preprocess=xr;exports.resolveLanguage=he;exports.supportedLanguages=ys;return exports;})({});
1
+ var HyperscriptI18n=(function(exports){'use strict';function ie(t,e){return e?{type:"literal",value:t,dataType:e}:{type:"literal",value:t}}function We(t,e){return e?{type:"selector",value:t,selectorKind:e}:{type:"selector",value:t}}function _e(t){return {type:"reference",value:t}}function qe(t,e){return {type:"property-path",object:t,property:e}}var pr=new Set(["me","you","it","result","event","target","body"]);function Je(t,e=pr){return e.has(t)}var ht=class{constructor(t){this.namespace=t,this.enabled=this.checkEnabled();}checkEnabled(){if(typeof process<"u"&&process.env){let t=process.env.DEBUG||"";return t==="*"||t.includes("framework:*")||t.includes(`framework:${this.namespace}`)}return false}log(t,e,...r){if(!this.enabled)return;let i=`[framework:${this.namespace}]`,a=new Date().toISOString();switch(t){case "debug":console.debug(`${a} ${i} DEBUG:`,e,...r);break;case "info":console.info(`${a} ${i} INFO:`,e,...r);break;case "warn":console.warn(`${a} ${i} WARN:`,e,...r);break;case "error":console.error(`${a} ${i} ERROR:`,e,...r);break}}debug(t,...e){this.log("debug",t,...e);}info(t,...e){this.log("info",t,...e);}warn(t,...e){this.log("warn",t,...e);}error(t,...e){this.log("error",t,...e);}isEnabled(){return this.enabled}enable(){this.enabled=true;}disable(){this.enabled=false;}};function Et(t){return new ht(t)}function be(t,e){return !e||e.length===0||e.includes(t)||e.includes("expression")?true:t==="property-path"?e.some(r=>["selector","reference","expression"].includes(r)):false}function zt(t,e){return t?.possessive?.keywords?.[e]}var Le=class we{constructor(){this.logger=Et("pattern-matcher"),this.stemMatchCount=0,this.totalKeywordMatches=0;}safeToLowerCase(e){return typeof e=="string"?e.toLowerCase():e==null?"":String(e).toLowerCase()}matchPattern(e,r,i){let a=e.mark(),n=new Map;if(this.logger.debug("========================================"),this.logger.debug("matchPattern ENTRY"),this.logger.debug("Pattern ID:",r.id),this.logger.debug("Pattern command:",r.command),this.logger.debug("Pattern language:",r.language),this.logger.debug("Pattern template:",JSON.stringify(r.template,null,2)),this.logger.isEnabled()){let s=[];for(let l=0;l<10;l++){let c=e.peek(l);if(c)s.push({type:c.type,value:c.value,kind:c.kind});else break}this.logger.debug("Input tokens (first 10):",s),this.logger.debug("Profile code:",i?.code);}this.currentProfile=i,this.stemMatchCount=0,this.totalKeywordMatches=0,this.logger.debug("--- Calling matchTokenSequence ---"),this.logger.debug("Pattern tokens to match:",JSON.stringify(r.template.tokens,null,2));let u=this.matchTokenSequence(e,r.template.tokens,n);if(this.logger.debug("matchTokenSequence returned:",u),this.logger.debug("Captured roles:",Array.from(n.entries()).map(([s,l])=>[s,JSON.stringify(l)])),!u)return this.logger.debug(">>> MATCH FAILED - resetting token position"),e.reset(a),null;let o=this.calculateConfidence(r,n);return this.applyExtractionRules(r,n),{pattern:r,captured:n,consumedTokens:e.position()-a.position,confidence:o}}matchBest(e,r,i){let a=[];for(let u of r){let o=e.mark(),s=this.matchPattern(e,u,i);s&&a.push(s),e.reset(o);}if(a.length===0)return null;a.sort((u,o)=>{let s=o.pattern.priority-u.pattern.priority;if(s!==0)return s;let l=o.confidence-u.confidence;return Math.abs(l)>.001?l:o.consumedTokens-u.consumedTokens});let n=a[0];return this.matchPattern(e,n.pattern),n}matchTokenSequence(e,r,i,a){let n=r[0],u=n?.type==="literal"&&(n.value==="and"||n.value==="then"||n.alternatives?.includes("and")||n.alternatives?.includes("then"));if(this.currentProfile?.code==="ar"&&!u)for(;e.peek()?.kind==="conjunction";)e.advance();let o=null,s=null;for(let l=0;l<r.length;l++){let c=r[l];this.logger.debug(" >> Matching pattern token:",JSON.stringify(c,null,2));let m=e.peek();if(this.logger.debug(" >> Current input token:",m?JSON.stringify({type:m.type,value:m.value,kind:m.kind}):"EOF"),c.type==="role"&&c.greedy){let v=this.collectStopMarkers(r,l+1);if(a)for(let C of a)v.add(C);let z=[];for(;!e.isAtEnd();){let C=e.peek();if(!C||this.isStopMarker(C,v))break;z.push(C.value),e.advance();}if(z.length>0){i.set(c.role,{type:"expression",raw:z.join(" ")}),o=null,s=null;continue}else {if(c.optional)continue;return false}}if(c.type==="group"){let v=this.collectStopMarkers(r,l+1);if(a)for(let C of a)v.add(C);if(this.matchGroupToken(e,c,i,v)){o=null,s=null;continue}if(this.isOptional(c))continue;return false}let p=c.type==="role"&&c.optional===true,d=p?e.mark():null;if(c.type==="role"&&!p){let v=l+1<r.length?r[l+1]:null;if(v?.type==="literal"){let z=e.peek();if(z&&this.getMatchType(z,v.value)!=="none"){if(this.logger.debug(" >> MARKER-STEAL GUARD: current token matches next literal, skipping role"),this.logger.debug(" >> Token match FAILED"),this.isOptional(c))continue;if(o&&s){this.logger.debug(" >> BACKTRACKING: undoing optional role",s),e.reset(o),i.delete(s),o=null,s=null;let C=this.matchPatternToken(e,c,i);if(this.logger.debug(" >> Backtrack retry result:",C),C)continue}return false}}}let E=this.matchPatternToken(e,c,i);if(this.logger.debug(" >> Match result:",E),E){p?(o=d,s=c.role):(o=null,s=null);continue}if(this.logger.debug(" >> Token match FAILED"),!this.isOptional(c)){if(o&&s){this.logger.debug(" >> BACKTRACKING: undoing optional role",s),e.reset(o),i.delete(s),o=null,s=null;let v=this.matchPatternToken(e,c,i);if(this.logger.debug(" >> Backtrack retry result:",v),v)continue}return false}}return true}matchPatternToken(e,r,i){switch(r.type){case "literal":return this.matchLiteralToken(e,r);case "role":return this.matchRoleToken(e,r,i);case "group":return this.matchGroupToken(e,r,i);default:return false}}matchLiteralToken(e,r){let i=e.peek();if(this.logger.debug(" >>> matchLiteralToken: expecting",r.value),this.logger.debug(" >>> matchLiteralToken: got token",i?JSON.stringify({type:i.type,value:i.value,kind:i.kind}):"null"),!i)return this.logger.debug(" >>> matchLiteralToken: FAIL - no token"),false;let a=this.getMatchType(i,r.value);if(this.logger.debug(" >>> matchType for",i.value,"vs",r.value,":",a),a!=="none")return this.totalKeywordMatches++,a==="stem"&&this.stemMatchCount++,e.advance(),true;if(r.alternatives)for(let n of r.alternatives){let u=this.getMatchType(i,n);if(u!=="none")return this.totalKeywordMatches++,u==="stem"&&this.stemMatchCount++,e.advance(),true}return false}matchRoleToken(e,r,i){this.logger.debug(" >>> matchRoleToken ENTRY: capturing role",r.role),this.logger.debug(" >>> matchRoleToken: expected types",r.expectedTypes),this.logger.debug(" >>> matchRoleToken: optional?",r.optional),this.skipNoiseWords(e);let a=e.peek();if(this.logger.debug(" >>> After skipNoiseWords, current token:",a?JSON.stringify({value:a.value,kind:a.kind}):"null"),!a)return r.optional||false;let n=this.tryMatchPossessiveExpression(e);if(n)return r.expectedTypes&&r.expectedTypes.length>0&&!be(n.type,r.expectedTypes)?r.optional||false:(i.set(r.role,n),true);let u=this.tryMatchMethodCallExpression(e);if(u)return r.expectedTypes&&r.expectedTypes.length>0&&!be(u.type,r.expectedTypes)?r.optional||false:(i.set(r.role,u),true);let o=this.tryMatchPossessiveSelectorExpression(e);if(o)return r.expectedTypes&&r.expectedTypes.length>0&&!be(o.type,r.expectedTypes)?r.optional||false:(i.set(r.role,o),true);let s=this.tryMatchPropertyAccessExpression(e);if(s)return r.expectedTypes&&r.expectedTypes.length>0&&!be(s.type,r.expectedTypes)?r.optional||false:(i.set(r.role,s),true);let l=this.tryMatchSelectorPropertyExpression(e);if(l)return r.expectedTypes&&r.expectedTypes.length>0&&!be(l.type,r.expectedTypes)?r.optional||false:(i.set(r.role,l),true);this.logger.debug(" >>> Trying tokenToSemanticValue for token:",a?JSON.stringify({value:a.value,kind:a.kind}):"null");let c=this.tokenToSemanticValue(a);return this.logger.debug(" >>> tokenToSemanticValue returned:",c?JSON.stringify(c):"null"),c?(this.logger.debug(" >>> Validating type:",c.type,"against expected:",r.expectedTypes),r.expectedTypes&&r.expectedTypes.length>0&&!be(c.type,r.expectedTypes)?(this.logger.debug(" >>> TYPE MISMATCH - returning",r.optional||false),r.optional||false):(this.logger.debug(" >>> Type validation PASSED"),i.set(r.role,c),e.advance(),true)):r.optional||false}tryMatchPossessiveExpression(e){let r=e.peek();if(!r||!this.currentProfile)return null;let i=r.normalized||r.value,a=this.safeToLowerCase(i),n=zt(this.currentProfile,a);if(!n)return null;let u=e.mark();e.advance();let o=e.peek();if(!o)return e.reset(u),null;if(o.kind==="identifier"||o.kind==="keyword"&&!this.isStructuralKeyword(o.value)||o.kind==="selector"&&o.value.startsWith("*")||o.kind==="selector"&&o.value.startsWith("@")||o.kind==="selector"&&o.value.startsWith(".")&&/^\.[a-zA-Z_]\w*/.test(o.value)){e.advance();let s=o.value;o.kind==="selector"&&s.startsWith(".")&&/^\.[a-zA-Z_]\w*/.test(s)&&(s=s.substring(1));let l=s;for(;e.peek()?.kind==="selector"&&e.peek().value.startsWith(".")&&/^\.[a-zA-Z_]\w*/.test(e.peek().value);)l+=e.peek().value,e.advance();let c=e.peek();return c?.kind==="literal"&&c.value.startsWith("(")&&(l+=c.value,e.advance()),qe(_e(n),l)}return e.reset(u),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 r=e.peek();if(!r||r.kind!=="selector")return null;let i=e.mark();e.advance();let a=e.peek();if(!a||a.kind!=="operator"||a.value!==".")return e.reset(i),null;e.advance();let n=e.peek();if(!n||n.kind!=="identifier")return e.reset(i),null;e.advance();let u=e.peek();if(!u||u.kind!=="punctuation"||u.value!=="(")return e.reset(i),null;e.advance();let o=[];for(;!e.isAtEnd()&&o.length<we.MAX_METHOD_ARGS;){let l=e.peek();if(!l)break;if(l.kind==="punctuation"&&l.value===")"){e.advance();break}if(l.kind==="punctuation"&&l.value===","){e.advance();continue}o.push(l.value),e.advance();}return {type:"expression",raw:`${r.value}.${n.value}(${o.join(", ")})`}}tryMatchPropertyAccessExpression(e){let r=e.peek();if(!r||r.kind!=="identifier"&&r.kind!=="keyword")return null;let i=e.mark();e.advance();let a=e.peek();if(!a||a.kind!=="operator"||a.value!==".")return e.reset(i),null;e.advance();let n=e.peek();if(!n||n.kind!=="identifier")return e.reset(i),null;e.advance();let u=`${r.value}.${n.value}`,o=1;for(;!e.isAtEnd()&&o<we.MAX_PROPERTY_DEPTH;){let l=e.peek();if(!l||l.kind!=="operator"||l.value!==".")break;e.advance();let c=e.peek();if(!c||c.kind!=="identifier")break;e.advance(),u+=`.${c.value}`,o++;}let s=e.peek();if(s&&s.kind==="punctuation"&&s.value==="("){e.advance();let l=[],c=0;for(;!e.isAtEnd()&&l.length<we.MAX_METHOD_ARGS;){let p=e.peek();if(!p)break;if(p.kind==="punctuation"&&p.value===")"){if(c===0){e.advance();break}c--;}if(p.kind==="punctuation"&&p.value==="("&&c++,p.kind==="punctuation"&&p.value===","){e.advance();continue}l.push(p.value),e.advance();}return {type:"expression",raw:`${u}(${l.join(", ")})`}}return {type:"expression",raw:u}}tryMatchPossessiveSelectorExpression(e){let r=e.peek();if(!r||r.kind!=="selector")return null;let i=e.mark();e.advance();let a=e.peek();if(!a||a.kind!=="punctuation"||a.value!=="'s")return e.reset(i),null;e.advance();let n=e.peek();return !n||n.kind!=="selector"&&n.kind!=="identifier"?(e.reset(i),null):(e.advance(),qe(We(r.value),n.value))}tryMatchSelectorPropertyExpression(e){let r=e.peek();if(!r||r.kind!=="selector"||typeof r.value!="string"||!r.value.startsWith("#"))return null;let i=e.mark();e.advance();let a=e.peek();if(!a||a.kind!=="selector"||!a.value.startsWith("."))return e.reset(i),null;let n=e.peek(1);n&&n.kind,e.advance();let u=a.value.slice(1);return qe(We(r.value),u)}matchGroupToken(e,r,i,a){let n=e.mark(),u=new Set(i.keys());if(this.matchTokenSequence(e,r.tokens,i,a))return true;e.reset(n);for(let l of i.keys())u.has(l)||i.delete(l);if(!r.optional)return false;let s=this.getGroupLeadingMarker(r);if(s)for(let l=1;l<=we.MAX_MARKER_SCAN;l++){let c=e.peek(l);if(!c)break;if((c.normalized||c.value).toLowerCase()===s){this.logger.debug(" >> MARKER SCAN: found",s,"at offset",l,"- skipping intervening tokens");for(let d=0;d<l;d++)e.advance();if(this.matchTokenSequence(e,r.tokens,i,a))return true;e.reset(n);for(let d of i.keys())u.has(d)||i.delete(d);break}}return true}getGroupLeadingMarker(e){let r=e.tokens[0];return r?.type==="literal"?r.value.toLowerCase():null}getMatchType(e,r){return e.value===r?"exact":e.normalized===r?"normalized":e.stem===r&&e.stemConfidence!==void 0&&e.stemConfidence>=.7?"stem":e.kind==="keyword"&&this.safeToLowerCase(e.value)===r.toLowerCase()?"case-insensitive":"none"}collectStopMarkers(e,r){let i=new Set;for(let a=r;a<e.length;a++){let n=e[a];if(n.type==="literal"){if(i.add(n.value.toLowerCase()),n.alternatives)for(let u of n.alternatives)i.add(u.toLowerCase());break}if(n.type==="group"){for(let u of n.tokens)if(u.type==="literal"){if(i.add(u.value.toLowerCase()),u.alternatives)for(let o of u.alternatives)i.add(o.toLowerCase());break}if(!n.optional)break}}return i}isStopMarker(e,r){return r.size===0?false:!!(r.has(e.value.toLowerCase())||e.normalized&&r.has(e.normalized.toLowerCase()))}tokenToSemanticValue(e){switch(e.kind){case "selector":return We(e.value);case "literal":return this.parseLiteralValue(e.value);case "keyword":let r=e.normalized||e.value;this.safeToLowerCase(r);return ie(e.normalized||e.value);case "identifier":if(typeof e.value=="string"&&e.value.startsWith(":"))return _e(e.value);this.safeToLowerCase(e.value);return {type:"expression",raw:e.value};case "url":return ie(e.value,"string");default:return null}}parseLiteralValue(e){if(e.startsWith('"')||e.startsWith("'")||e.startsWith("`")||e.startsWith("\u300C")){let a=e.slice(1,-1);return ie(a,"string")}if(e==="true")return ie(true,"boolean");if(e==="false")return ie(false,"boolean");let r=e.match(/^(\d+(?:\.\d+)?)(ms|s|m|h)?$/);if(r){let a=parseFloat(r[1]);return r[2]?ie(e,"duration"):ie(a,"number")}let i=parseFloat(e);return isNaN(i)?ie(e,"string"):ie(i,"number")}applyExtractionRules(e,r){for(let[i,a]of Object.entries(e.extraction))r.has(i)||(a.value!==void 0?r.set(i,{type:"literal",value:a.value}):a.default&&r.set(i,a.default));}isOptional(e){return e.type!=="literal"&&e.optional===true}calculateConfidence(e,r){let i=0,a=0,n=l=>e.extraction?.[l]?.default!==void 0;for(let l of e.template.tokens)if(l.type==="role")a+=1,r.has(l.role)&&(i+=1);else if(l.type==="group"){for(let c of l.tokens)if(c.type==="role"){let m=n(c.role),p=.8;a+=p,r.has(c.role)?i+=p:m&&(i+=p*.6);}}let u=a>0?i/a:1;if(this.stemMatchCount>0&&this.totalKeywordMatches>0){let l=this.stemMatchCount/this.totalKeywordMatches*.15;u=Math.max(.5,u-l);}let o=this.calculateVSOConfidenceBoost(e);u=Math.min(1,u+o);let s=this.arabicPrepositionDisambiguation(e,r);return u=Math.max(0,Math.min(1,u+s)),u}calculateVSOConfidenceBoost(e){if(e.language!=="ar")return 0;let r=e.template.tokens[0];if(!r||r.type!=="literal")return 0;let i=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(i.has(r.value))return .15;if(r.alternatives){for(let a of r.alternatives)if(i.has(a))return .15}return 0}arabicPrepositionDisambiguation(e,r){if(e.language!=="ar")return 0;let i=0,a={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[n,u]of r.entries()){let o=a[n];if(!o||o.length===0)continue;let s="metadata"in u?u.metadata:void 0;if(s&&typeof s.prepositionValue=="string"){let l=s.prepositionValue;o.includes(l)?i+=.1:i-=.1;}}return Math.max(-0.1,Math.min(.1,i))}skipNoiseWords(e){let r=e.peek();if(!r)return;let i=this.safeToLowerCase(r.value);if(we.ENGLISH_NOISE_WORDS.has(i)){let a=e.mark();e.advance();let n=e.peek();if(n&&n.kind==="selector")return;e.reset(a);}i==="class"&&e.advance();}extractEventModifiers(e){let r={},i=false;for(;!e.isAtEnd();){let a=e.peek();if(!a||a.kind!=="event-modifier")break;let n=a.metadata;if(!n)break;switch(i=true,n.modifierName){case "once":r.once=true;break;case "debounce":typeof n.value=="number"&&(r.debounce=n.value);break;case "throttle":typeof n.value=="number"&&(r.throttle=n.value);break;case "queue":(n.value==="first"||n.value==="last"||n.value==="all"||n.value==="none")&&(r.queue=n.value);break}e.advance();}return i?r:void 0}};Le.MAX_MARKER_SCAN=3;Le.MAX_PROPERTY_DEPTH=10;Le.MAX_METHOD_ARGS=20;Le.ENGLISH_NOISE_WORDS=new Set(["the","a","an"]);var gt=Le;new gt;var Ae=class{constructor(){this.name="string-literal";}canExtract(t,e){let r=t[e];return r==='"'||r==="'"||r==="`"||r==="\u201C"||r==="\u2018"}extract(t,e){let r=t[e];if(r==="\u201C"){let n=1;for(;e+n<t.length;){if(t[e+n]==="\u201D")return n++,{value:t.substring(e,e+n),length:n};n++;}return null}if(r==="\u2018"){let n=1;for(;e+n<t.length;){if(t[e+n]==="\u2019")return n++,{value:t.substring(e,e+n),length:n};n++;}return null}let i=1,a=false;for(;e+i<t.length;){let n=t[e+i];if(a){a=false,i++;continue}if(n==="\\"){a=true,i++;continue}if(n===r)return i++,{value:t.substring(e,e+i),length:i};i++;}return null}},De=class{constructor(){this.name="number";}canExtract(t,e){return /\d/.test(t[e])}extract(t,e){let r=0,i=false;for(;e+r<t.length;){let u=t[e+r];if(/\d/.test(u))r++;else if(u==="."&&!i)i=true,r++;else break}if(r===0)return null;let a=t.substring(e,e+r),n=e+r;if(n<t.length){let u=t.slice(n),o=[{pattern:"\u6BEB\u79D2",suffix:"ms"},{pattern:"\u5206\u949F",suffix:"m"},{pattern:"\u5C0F\u65F6",suffix:"h"},{pattern:"\u30DF\u30EA\u79D2",suffix:"ms"},{pattern:"\u6642\u9593",suffix:"h"}];for(let l of o)if(u.startsWith(l.pattern))return {value:a+l.suffix,length:r+l.pattern.length,metadata:{hasTimeUnit:true}};if(u.startsWith("ms"))return {value:a+"ms",length:r+2,metadata:{hasTimeUnit:true}};let s=[{pattern:"\u79D2",suffix:"s"},{pattern:"\u5206",suffix:"m"}];for(let l of s)if(u.startsWith(l.pattern))return {value:a+l.suffix,length:r+1,metadata:{hasTimeUnit:true}};if(/^[smh](?![a-zA-Z])/.test(u))return {value:a+u[0],length:r+1,metadata:{hasTimeUnit:true}}}return {value:a,length:r}}};function kt(t){return "setContext"in t&&typeof t.setContext=="function"}function Ct(t){let e={language:t.language,direction:t.direction,lookupKeyword:t.lookupKeyword.bind(t),isKeyword:t.isKeyword.bind(t),isKeywordStart:t.isKeywordStart.bind(t),...t.isKeywordStartAtBoundary?{isKeywordStartAtBoundary:t.isKeywordStartAtBoundary.bind(t)}:{}};return t.normalizer?{...e,normalizer:t.normalizer}:e}var ae=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 j(t,e){return {start:t,end:e}}function V(t,e,r,i){if(typeof t=="object"){let{value:n,kind:u,position:o,normalized:s,stem:l,stemConfidence:c,metadata:m}=t;return {value:n,kind:u,position:o,...s!==void 0&&{normalized:s},...l!==void 0&&{stem:l},...c!==void 0&&{stemConfidence:c},...m!==void 0&&{metadata:m}}}let a=t;if(!e||!r)throw new Error("createToken requires kind and position parameters");if(typeof i=="string")return {value:a,kind:e,position:r,normalized:i};if(i){let{normalized:n,stem:u,stemConfidence:o,metadata:s}=i;return {value:a,kind:e,position:r,...n!==void 0&&{normalized:n},...u!==void 0&&{stem:u},...o!==void 0&&{stemConfidence:o},...s!==void 0&&{metadata:s}}}return {value:a,kind:e,position:r}}function Me(t){return /\s/.test(t)}function bt(t){return t==="#"||t==="."||t==="["||t==="@"||t==="*"||t==="<"}function wt(t){return t==='"'||t==="'"||t==="`"||t==="\u300C"||t==="\u300D"}function fe(t){return /\d/.test(t)}function At(t){return /[a-zA-Z]/.test(t)}function U(t){return /[a-zA-Z0-9_-]/.test(t)}function Dt(t,e){if(e>=t.length)return null;let r=t[e];if(!bt(r))return null;let i=e,a="";if(r==="#"||r==="."){for(a+=t[i++];i<t.length&&U(t[i]);)a+=t[i++];if(a.length<=1)return null;if(i<t.length&&t[i]==="."&&r==="#"){let u=i+1;for(;u<t.length&&U(t[u]);)u++;if(u<t.length&&t[u]==="(")return a}}else if(r==="["){let n=1,u=false,o=null,s=false;for(a+=t[i++];i<t.length&&n>0;){let l=t[i];a+=l,s?s=false:l==="\\"?s=true:u?l===o&&(u=false,o=null):l==='"'||l==="'"||l==="`"?(u=true,o=l):l==="["?n++:l==="]"&&n--,i++;}if(n!==0)return null}else if(r==="@"){for(a+=t[i++];i<t.length&&U(t[i]);)a+=t[i++];if(a.length<=1)return null}else if(r==="*"){for(a+=t[i++];i<t.length&&U(t[i]);)a+=t[i++];if(a.length<=1)return null}else if(r==="<"){if(a+=t[i++],i>=t.length||!At(t[i]))return null;for(;i<t.length&&U(t[i]);)a+=t[i++];for(;i<t.length;){let n=t[i];if(n==="."){if(a+=t[i++],i>=t.length||!U(t[i]))return null;for(;i<t.length&&U(t[i]);)a+=t[i++];}else if(n==="#"){if(a+=t[i++],i>=t.length||!U(t[i]))return null;for(;i<t.length&&U(t[i]);)a+=t[i++];}else if(n==="["){let u=1,o=false,s=null,l=false;for(a+=t[i++];i<t.length&&u>0;){let c=t[i];a+=c,l?l=false:c==="\\"?l=true:o?c===s&&(o=false,s=null):c==='"'||c==="'"||c==="`"?(o=true,s=c):c==="["?u++:c==="]"&&u--,i++;}if(u!==0)return null}else break}for(;i<t.length&&Me(t[i]);)a+=t[i++];if(i<t.length&&t[i]==="/")for(a+=t[i++];i<t.length&&Me(t[i]);)a+=t[i++];if(i>=t.length||t[i]!==">")return null;a+=t[i++];}return a||null}function St(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 i=t[e+2];return Me(i)||i==="*"||!U(i)}function xt(t,e){if(e>=t.length)return null;let r=t[e];if(!wt(r)||r==="'"&&St(t,e))return null;let a={'"':'"',"'":"'","`":"`","\u300C":"\u300D"}[r];if(!a)return null;let n=e+1,u=r,o=false;for(;n<t.length;){let s=t[n];if(u+=s,o)o=false;else if(s==="\\")o=true;else if(s===a)return u;n++;}return u}function Bt(t,e){if(e>=t.length)return false;let r=t[e],i=t[e+1]||"",a=t[e+2]||"";if(r==="/"&&i!=="/"&&/[a-zA-Z0-9._-]/.test(i)||r==="/"&&i==="/"&&/[a-zA-Z]/.test(a)||r==="."&&(i==="/"||i==="."&&a==="/"))return true;let n=t.slice(e,e+8).toLowerCase();return !!(n.startsWith("http://")||n.startsWith("https://"))}function Ft(t,e){if(!Bt(t,e))return null;let r=e,i="",a=/[a-zA-Z0-9/:._\-?&=%@+~!$'()*,;[\]]/;for(;r<t.length;){let n=t[r];if(n==="#"){if(i.length>0&&/[a-zA-Z0-9/.]$/.test(i))for(i+=n,r++;r<t.length&&/[a-zA-Z0-9_-]/.test(t[r]);)i+=t[r++];break}if(a.test(n))i+=n,r++;else break}return i.length<2?null:i}function Tt(t,e){if(e>=t.length)return null;let r=t[e];if(!fe(r)&&r!=="-"&&r!=="+")return null;let i=e,a="";if((t[i]==="-"||t[i]==="+")&&(a+=t[i++]),i>=t.length||!fe(t[i]))return null;for(;i<t.length&&fe(t[i]);)a+=t[i++];if(i<t.length&&t[i]===".")for(a+=t[i++];i<t.length&&fe(t[i]);)a+=t[i++];return i<t.length&&(t.slice(i,i+2)==="ms"?a+="ms":(t[i]==="s"||t[i]==="m"||t[i]==="h")&&(a+=t[i])),a}var Ot=["===","!==","->","==","!=","<=",">=","&&","||","**","+=","-=","*=","/=","+","-","*","/","=",">","<","!","&","|","%","^","~"];new Set(Ot);var Rt=new Set(["patient","destination","source","style","event","eventMarker","agent","goal","manner","into","from","to","with","at","of","as","by","in","on","over","under","between","through","without"]),Pt=["click","dblclick","input","change","submit","keydown","keyup","keypress","mousedown","mouseup","mouseover","mouseout","mouseenter","mouseleave","mousemove","pointerdown","pointerup","pointermove","focus","blur","load","resize","scroll"],yr=class vr{constructor(){this.profileKeywords=[],this.multiWordKeywords=[],this.profileKeywordMap=new Map,this.rawExtraEntries=[],this.extractors=[];}getExtraKeywordEntries(){return this.rawExtraEntries}tokenize(e){if(this.isUsingExtractors())return this.tokenizeWithExtractors(e);throw new Error(`${this.constructor.name}: tokenize() not implemented and no extractors registered. Either register extractors or override tokenize() method.`)}registerExtractor(e){kt(e)&&e.setContext(Ct(this)),this.extractors.push(e);}registerExtractors(e){for(let r of e)this.registerExtractor(r);}clearExtractors(){this.extractors=[];}isUsingExtractors(){return this.extractors.length>0}tokenizeWithExtractors(e){let r=[],i=0;for(;i<e.length;){for(;i<e.length&&Me(e[i]);)i++;if(i>=e.length)break;let a=this.tryMultiWordKeyword(e,i);if(a){r.push(a),i=a.position.end;continue}let n=false;for(let u of this.extractors)if(u.canExtract(e,i)){let o=u.extract(e,i);if(o){let s=o.metadata?.normalized,l=o.metadata?.stem,c=o.metadata?.stemConfidence,m={};if(o.metadata)for(let[d,f]of Object.entries(o.metadata))d!=="normalized"&&d!=="stem"&&d!=="stemConfidence"&&(m[d]=f);let p={};s&&(p.normalized=s),l&&(p.stem=l),c!==void 0&&(p.stemConfidence=c),Object.keys(m).length>0&&(p.metadata=m),r.push(V(o.value,this.classifyToken(o.value),j(i,i+o.length),Object.keys(p).length>0?p:void 0)),i+=o.length,n=true;break}}if(!n){let u=e[i],o=this.classifyUnknownChar(u);r.push(V(u,o,j(i,i+1))),i++;}}return new ae(r,this.language)}classifyUnknownChar(e){return "()[]{},:;".includes(e)?"punctuation":"+-*/<>=!&|".includes(e)?"operator":"identifier"}tryPropertyAccess(e,r,i){if(e[r]!==".")return false;let a=i[i.length-1],n=a&&a.position.end<r;if(a&&!n&&(a.kind==="identifier"||a.kind==="keyword"||a.kind==="selector"))return i.push(V(".","operator",j(r,r+1))),true;let s=r+1;for(;s<e.length&&U(e[s]);)s++;return s<e.length&&e[s]==="("?(i.push(V(".","operator",j(r,r+1))),true):false}initializeKeywordsFromProfile(e,r=[]){let i=new Map;if(this.rawExtraEntries=r,e.keywords){for(let[a,n]of Object.entries(e.keywords))if(i.set(n.primary,{native:n.primary,normalized:n.normalized||a}),n.alternatives)for(let u of n.alternatives)i.set(u,{native:u,normalized:n.normalized||a});}if(e.references){for(let[a,n]of Object.entries(e.references))i.set(n,{native:n,normalized:a});for(let a of Object.keys(e.references))i.has(a)||i.set(a,{native:a,normalized:a});}if(e.roleMarkers){for(let[a,n]of Object.entries(e.roleMarkers))if(n.primary&&i.set(n.primary,{native:n.primary,normalized:a}),n.alternatives)for(let u of n.alternatives)i.set(u,{native:u,normalized:a});}if(e.possessive?.keywords)for(let[a,n]of Object.entries(e.possessive.keywords))i.set(a,{native:a,normalized:n});for(let a of Pt)i.has(a)||i.set(a,{native:a,normalized:a});for(let a of r)i.set(a.native,a);this.profileKeywords=Array.from(i.values()).sort((a,n)=>n.native.length-a.native.length),this.multiWordKeywords=this.profileKeywords.filter(a=>a.native.includes(" ")&&!Rt.has(a.normalized)),this.profileKeywordMap=new Map;for(let a of this.profileKeywords){this.profileKeywordMap.set(a.native.toLowerCase(),a);let n=this.removeDiacritics(a.native);n!==a.native&&!this.profileKeywordMap.has(n.toLowerCase())&&this.profileKeywordMap.set(n.toLowerCase(),a);}}removeDiacritics(e){return e.replace(/[\u064B-\u0652\u0670]/g,"")}tryProfileKeyword(e,r){for(let i of this.profileKeywords)if(e.slice(r).startsWith(i.native))return V(i.native,"keyword",j(r,r+i.native.length),i.normalized);return null}tryMultiWordKeyword(e,r,i=a=>/[\p{L}\p{N}_]/u.test(a)){if(this.multiWordKeywords.length===0)return null;let a=e.slice(r);for(let n of this.multiWordKeywords){if(!a.startsWith(n.native))continue;let u=e[r+n.native.length];if(!(u!==void 0&&i(u)))return V(n.native,"keyword",j(r,r+n.native.length),n.normalized)}return null}isKeywordStart(e,r){let i=e.slice(r);return this.profileKeywords.some(a=>i.startsWith(a.native))}isKeywordStartAtBoundary(e,r,i=a=>/[\p{L}\p{N}_]/u.test(a)){let a=e.slice(r);return this.profileKeywords.some(n=>{if(!a.startsWith(n.native))return false;let u=e[r+n.native.length];return u===void 0||!i(u)})}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 r=this.normalizer.normalize(e);return r.stem!==e&&r.confidence>=.7?r:null}tryMorphKeywordMatch(e,r,i){let a=this.tryNormalize(e);if(!a)return null;let n=this.lookupKeyword(a.stem);if(!n)return null;let u={normalized:n.normalized,stem:a.stem,stemConfidence:a.confidence};return V(e,"keyword",j(r,i),u)}trySelector(e,r){let i=Dt(e,r);return i?V(i,"selector",j(r,r+i.length)):null}tryEventModifier(e,r){if(e[r]!==".")return null;let i=e.slice(r).match(/^\.(?:once|debounce|throttle|queue)(?:\(([^)]+)\))?(?:\s|$|\.)/);if(!i)return null;let a=i[0].replace(/(\s|\.)$/,""),n=a.slice(1).split("(")[0],u=i[1];return {...V(a,"event-modifier",j(r,r+a.length)),metadata:{modifierName:n,value:u?n==="queue"?u:parseInt(u,10):void 0}}}tryString(e,r){let i=xt(e,r);return i?V(i,"literal",j(r,r+i.length)):null}tryNumber(e,r){let i=Tt(e,r);return i?V(i,"literal",j(r,r+i.length)):null}tryMatchTimeUnit(e,r,i,a=false){let n=r;if(a)for(;n<e.length&&Me(e[n]);)n++;let u=e.slice(n);for(let o of i){let s=u.slice(0,o.length);if(o.caseInsensitive?s.toLowerCase()===o.pattern.toLowerCase():s===o.pattern){if(o.notFollowedBy&&(u[o.length]||"")===o.notFollowedBy)continue;if(o.checkBoundary){let c=u[o.length]||"";if(U(c))continue}return {suffix:o.suffix,endPos:n+o.length}}}return null}parseBaseNumber(e,r,i=true){let a=r,n="";if(i&&(e[a]==="-"||e[a]==="+")&&(n+=e[a++]),a>=e.length||!fe(e[a]))return null;for(;a<e.length&&fe(e[a]);)n+=e[a++];if(a<e.length&&e[a]===".")for(n+=e[a++];a<e.length&&fe(e[a]);)n+=e[a++];return !n||n==="-"||n==="+"?null:{number:n,endPos:a}}tryNumberWithTimeUnits(e,r,i,a={}){let{allowSign:n=true,skipWhitespace:u=false}=a,o=this.parseBaseNumber(e,r,n);if(!o)return null;let{number:s,endPos:l}=o,c=[...i,...vr.STANDARD_TIME_UNITS],m=this.tryMatchTimeUnit(e,l,c,u);return m&&(s+=m.suffix,l=m.endPos),V(s,"literal",j(r,l))}tryUrl(e,r){let i=Ft(e,r);return i?V(i,"url",j(r,r+i.length)):null}tryVariableRef(e,r){if(e[r]!==":"||r+1>=e.length||!U(e[r+1]))return null;let i=r+1;for(;i<e.length&&U(e[i]);)i++;let a=e.slice(r,i);return V(a,"identifier",j(r,i))}tryOperator(e,r){let i=e.slice(r,r+2);if(["==","!=","<=",">=","&&","||","->"].includes(i))return V(i,"operator",j(r,r+2));let a=e[r];return ["<",">","!","+","-","*","/","="].includes(a)?V(a,"operator",j(r,r+1)):["(",")","{","}",",",";",":"].includes(a)?V(a,"punctuation",j(r,r+1)):null}tryMultiCharParticle(e,r,i){for(let a of i)if(e.slice(r,r+a.length)===a)return V(a,"particle",j(r,r+a.length));return null}};yr.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 Se=yr;function K(t){return {stem:t,confidence:1}}function D(t,e,r){return r?{stem:t,confidence:e,metadata:r}:{stem:t,confidence:e}}var Nt=Object.defineProperty,_t=Object.getOwnPropertyNames,Fr=(t,e)=>function(){return t&&(e=(0, t[_t(t)[0]])(t=0)),e},Mt=(t,e)=>{for(var r in e)Nt(t,r,{get:e[r],enumerable:true});};function hr(t,e){return t.replace(/\{(\w+)\}/g,(r,i)=>String(e[i]??`{${i}}`))}function Z(t,e,r={},i){let a=Tr[t],n=hr(a,r),u=Or[t],o=u?hr(u,r):void 0;return {code:t,message:n,severity:e,...i&&{role:i},...o&&{suggestion:o}}}var B,Tr,Or,Lt=Fr({"src/generators/schema-error-codes.ts"(){B={AMBIGUOUS_TYPE_LITERAL_SELECTOR:"SCHEMA_AMBIGUOUS_TYPE_LITERAL_SELECTOR",TOO_MANY_EXPECTED_TYPES:"SCHEMA_TOO_MANY_EXPECTED_TYPES",MULTI_TYPE_PATIENT_EXPECTED:"SCHEMA_MULTI_TYPE_PATIENT_EXPECTED",NO_REQUIRED_ROLES:"SCHEMA_NO_REQUIRED_ROLES",NO_REQUIRED_ROLES_EXPECTED:"SCHEMA_NO_REQUIRED_ROLES_EXPECTED",TRANSITION_PATIENT_ACCEPTS_SELECTOR:"SCHEMA_TRANSITION_PATIENT_ACCEPTS_SELECTOR",TRANSITION_MISSING_GOAL:"SCHEMA_TRANSITION_MISSING_GOAL",EVENT_HANDLER_MISSING_EVENT:"SCHEMA_EVENT_HANDLER_MISSING_EVENT",EVENT_HANDLER_EVENT_NOT_REQUIRED:"SCHEMA_EVENT_HANDLER_EVENT_NOT_REQUIRED",CONDITIONAL_MISSING_CONDITION:"SCHEMA_CONDITIONAL_MISSING_CONDITION",CONDITIONAL_CONDITION_NOT_REQUIRED:"SCHEMA_CONDITIONAL_CONDITION_NOT_REQUIRED",FOR_LOOP_MISSING_SOURCE:"SCHEMA_FOR_LOOP_MISSING_SOURCE",WHILE_LOOP_MISSING_CONDITION:"SCHEMA_WHILE_LOOP_MISSING_CONDITION",VALUE_TYPE_MISMATCH:"SCHEMA_VALUE_TYPE_MISMATCH",SELECTOR_KIND_MISMATCH:"SCHEMA_SELECTOR_KIND_MISMATCH",SELECTOR_KINDS_WITHOUT_SELECTOR_TYPE:"SCHEMA_SELECTOR_KINDS_WITHOUT_SELECTOR_TYPE",KEYWORD_COLLISION:"PROFILE_KEYWORD_COLLISION"},Tr={[B.AMBIGUOUS_TYPE_LITERAL_SELECTOR]:"Role '{role}' accepts both 'literal' and 'selector'. This may cause ambiguous type inference for values starting with special characters (* . # etc.).",[B.TOO_MANY_EXPECTED_TYPES]:"Role '{role}' accepts {count} different types. This may make type inference unreliable.",[B.MULTI_TYPE_PATIENT_EXPECTED]:"Role '{role}' accepts multiple types (expected for {command} command).",[B.NO_REQUIRED_ROLES]:"Command has no required roles. Is this intentional?",[B.NO_REQUIRED_ROLES_EXPECTED]:"Command has no required roles (expected for {command}).",[B.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.",[B.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.",[B.EVENT_HANDLER_MISSING_EVENT]:"Event handler command should have an 'event' role to specify which event to listen for.",[B.EVENT_HANDLER_EVENT_NOT_REQUIRED]:"Event role should be required - every event handler needs an event to listen for.",[B.CONDITIONAL_MISSING_CONDITION]:"Conditional command should have a 'condition' role for the boolean expression.",[B.CONDITIONAL_CONDITION_NOT_REQUIRED]:"Condition role should be required - conditionals need a condition to evaluate.",[B.FOR_LOOP_MISSING_SOURCE]:"For-loop should have a 'source' role for the collection to iterate over.",[B.WHILE_LOOP_MISSING_CONDITION]:"While-loop should have a 'condition' role for the loop condition.",[B.VALUE_TYPE_MISMATCH]:"Role '{role}' of command '{command}' expects type [{expectedTypes}], got '{actualType}'.",[B.SELECTOR_KIND_MISMATCH]:"Role '{role}' of command '{command}' expects selector kind [{selectorKinds}], got '{actualKind}'.",[B.SELECTOR_KINDS_WITHOUT_SELECTOR_TYPE]:"Role '{role}' has selectorKinds but expectedTypes does not include 'selector'.",[B.KEYWORD_COLLISION]:"Keyword '{keyword}' is used by multiple commands: {commands}. Only the first-registered command will be reachable."},Or={[B.AMBIGUOUS_TYPE_LITERAL_SELECTOR]:"Consider being more specific about which type is expected, or use explicit type markers.",[B.TOO_MANY_EXPECTED_TYPES]:"Consider narrowing the accepted types to improve type inference reliability.",[B.TRANSITION_PATIENT_ACCEPTS_SELECTOR]:"Remove 'selector' from expectedTypes and only accept 'literal'.",[B.TRANSITION_MISSING_GOAL]:"Add a 'goal' role with expectedTypes ['literal', 'variable'].",[B.EVENT_HANDLER_MISSING_EVENT]:"Add an 'event' role with expectedTypes ['literal'].",[B.EVENT_HANDLER_EVENT_NOT_REQUIRED]:"Set required: true on the 'event' role.",[B.CONDITIONAL_MISSING_CONDITION]:"Add a 'condition' role with expectedTypes ['expression'].",[B.CONDITIONAL_CONDITION_NOT_REQUIRED]:"Set required: true on the 'condition' role.",[B.FOR_LOOP_MISSING_SOURCE]:"Add a 'source' role for the collection to iterate over.",[B.WHILE_LOOP_MISSING_CONDITION]:"Add a 'condition' role for the loop continuation condition.",[B.VALUE_TYPE_MISMATCH]:"Ensure the value matches one of the expected types: [{expectedTypes}].",[B.SELECTOR_KIND_MISMATCH]:"Use a selector of the correct kind: [{selectorKinds}].",[B.SELECTOR_KINDS_WITHOUT_SELECTOR_TYPE]:"Either add 'selector' to expectedTypes or remove selectorKinds.",[B.KEYWORD_COLLISION]:"Give each command a unique keyword. Move the shared keyword to alternatives on one command, or use a more specific translation."};}}),Rr={};Mt(Rr,{SchemaErrorCodes:()=>B,formatValidationResults:()=>Kt,getValidationStats:()=>Ut,validateAllKeywordCollisions:()=>Gt,validateAllSchemas:()=>qt,validateCommandSchema:()=>Pr,validateKeywordCollisions:()=>Nr,validateRoleValues:()=>Ht});function It(t,e){return {action:t,items:e}}function Pr(t){let e=[];for(let i of t.roles)i.expectedTypes.includes("literal")&&i.expectedTypes.includes("selector")&&(i.role==="patient"&&er.has(t.action)?e.push(Z(B.MULTI_TYPE_PATIENT_EXPECTED,"note",{role:i.role,command:t.action},i.role)):e.push(Z(B.AMBIGUOUS_TYPE_LITERAL_SELECTOR,"warning",{role:i.role},i.role))),i.expectedTypes.length>3&&!er.has(t.action)&&e.push(Z(B.TOO_MANY_EXPECTED_TYPES,"warning",{role:i.role,count:i.expectedTypes.length},i.role));for(let i of t.roles)i.selectorKinds&&i.selectorKinds.length>0&&(i.expectedTypes.includes("selector")||e.push(Z(B.SELECTOR_KINDS_WITHOUT_SELECTOR_TYPE,"warning",{role:i.role},i.role)));switch(t.action){case "transition":jt(t,e);break;case "on":Vt(t,e);break;case "if":case "unless":$t(t,e);break;case "repeat":case "for":case "while":Wt(t,e);break}return t.roles.filter(i=>i.required).length===0&&(_r.has(t.action)?e.push(Z(B.NO_REQUIRED_ROLES_EXPECTED,"note",{command:t.action})):e.push(Z(B.NO_REQUIRED_ROLES,"warning",{}))),It(t.action,e)}function jt(t,e){let r=t.roles.find(a=>a.role==="patient"),i=t.roles.find(a=>a.role==="goal");r&&!i&&e.push(Z(B.TRANSITION_MISSING_GOAL,"error",{}));}function Vt(t,e){let r=t.roles.find(i=>i.role==="event");r||e.push(Z(B.EVENT_HANDLER_MISSING_EVENT,"warning",{})),r&&!r.required&&e.push(Z(B.EVENT_HANDLER_EVENT_NOT_REQUIRED,"warning",{}));}function $t(t,e){let r=t.roles.find(i=>i.role==="condition");r||e.push(Z(B.CONDITIONAL_MISSING_CONDITION,"warning",{})),r&&!r.required&&e.push(Z(B.CONDITIONAL_CONDITION_NOT_REQUIRED,"warning",{}));}function Wt(t,e){t.action==="for"?t.roles.find(i=>i.role==="source")||e.push(Z(B.FOR_LOOP_MISSING_SOURCE,"warning",{})):t.action==="while"&&(t.roles.find(i=>i.role==="condition")||e.push(Z(B.WHILE_LOOP_MISSING_CONDITION,"warning",{})));}function qt(t,e={}){let r=new Map,{includeNotes:i=false}=e;for(let[a,n]of Object.entries(t)){let u=Pr(n),o=u.items.some(l=>l.severity==="warning"||l.severity==="error"),s=i&&u.items.some(l=>l.severity==="note");(o||s)&&r.set(a,u);}return r}function Kt(t,e={}){let r=[],{showNotes:i=false,showCodes:a=true}=e;for(let[n,u]of t){let o=u.items.filter(c=>c.severity==="error"),s=u.items.filter(c=>c.severity==="warning"),l=u.items.filter(c=>c.severity==="note");if(o.length>0){r.push(` \u274C ${n}:`);for(let c of o){let m=a?` [${c.code}]`:"";r.push(` ERROR${m}: ${c.message}`),c.suggestion&&r.push(` \u{1F4A1} Suggestion: ${c.suggestion}`);}}if(s.length>0){r.push(` \u26A0\uFE0F ${n}:`);for(let c of s){let m=a?` [${c.code}]`:"";r.push(` ${m?`${c.code}: `:""}${c.message}`),c.suggestion&&r.push(` \u{1F4A1} ${c.suggestion}`);}}if(i&&l.length>0){r.push(` \u2139\uFE0F ${n}:`);for(let c of l){let m=a?` [${c.code}]`:"";r.push(` ${m?`${c.code}: `:""}${c.message}`);}}}return r.join(`
2
+ `)}function Ut(t){let e=0,r=0,i=0,a={};for(let n of t.values())for(let u of n.items)u.severity==="error"?e++:u.severity==="warning"?r++:u.severity==="note"&&i++,a[u.code]=(a[u.code]||0)+1;return {totalCommands:t.size,errors:e,warnings:r,notes:i,byCode:a}}function Ht(t,e){let r=[];for(let i of e){let a=t.roles.find(n=>n.role===i.role);a&&(a.expectedTypes.length>0&&!a.expectedTypes.includes(i.type)&&(a.expectedTypes.includes("expression")||r.push({level:"error",role:i.role,message:`${t.action}.${i.role} expects type [${a.expectedTypes.join(", ")}], got '${i.type}'`,code:B.VALUE_TYPE_MISMATCH})),i.type==="selector"&&i.selectorKind&&a.selectorKinds&&a.selectorKinds.length>0&&(a.selectorKinds.includes(i.selectorKind)||r.push({level:"error",role:i.role,message:`${t.action}.${i.role} expects selector kind [${a.selectorKinds.join(", ")}], got '${i.selectorKind}'`,code:B.SELECTOR_KIND_MISMATCH})));}return r}function Nr(t){let e=[];if(!t.keywords)return {language:t.code,collisions:e};let r=new Map;for(let[a,n]of Object.entries(t.keywords)){if(!n||!n.primary)continue;let u=r.get(n.primary)||[];if(u.push({command:a,isPrimary:true}),r.set(n.primary,u),n.alternatives)for(let o of n.alternatives){let s=r.get(o)||[];s.push({command:a,isPrimary:false}),r.set(o,s);}}for(let[a,n]of r){let u=[...new Set(n.map(l=>l.command))];if(u.length<=1)continue;let o=n.filter(l=>l.isPrimary).length,s;o>=2?s="primary-primary":o===1?s="primary-alternative":s="alternative-alternative",e.push({keyword:a,commands:u.sort(),type:s});}let i={"primary-primary":0,"primary-alternative":1,"alternative-alternative":2};return e.sort((a,n)=>i[a.type]-i[n.type]),{language:t.code,collisions:e}}function Gt(t){let e=[];for(let[,r]of Object.entries(t)){let i=Nr(r);i.collisions.length>0&&e.push(i);}return e.sort((r,i)=>r.language.localeCompare(i.language))}var er,_r,Yt=Fr({"src/generators/schema-validator.ts"(){Lt(),er=new Set(["put","append","prepend","log","throw","make","measure","return","swap","morph","beep","copy"]),_r=new Set(["compound","else","halt","continue","async","init","settle","focus","blur","return","js","measure","break","exit","beep","empty","open","close","select","clear","reset","breakpoint"]);}});var he=new Map,se=new Map,je=new Map,rr=null;function Mr(t,e){let r={...t};for(let i of Object.keys(e)){let a=e[i],n=t[i];a!==void 0&&(typeof a=="object"&&a!==null&&!Array.isArray(a)&&typeof n=="object"&&n!==null&&!Array.isArray(n)?r[i]=Mr(n,a):r[i]=a);}return r}function Zt(t,e){return Mr(t,e)}function nr(t){if(!t.extends)return t;let e=se.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 r=nr(e);return Zt(r,t)}function Pe(t,e,r){he.set(t,e),se.set(t,r),je.delete(t);}function Lr(t){rr=t;}var Er=new Map;function Oe(t){return t.split("-")[0]}function Re(t){return t.includes("-")}function Xt(t){let e=he.get(t);if(!e&&Re(t)){let r=Oe(t);e=he.get(r);}if(!e){let r=Array.from(he.keys()).join(", ");throw new Error(`Language '${t}' is not registered. Registered languages: ${r||"none"}. Import the language module first: import '@lokascript/semantic/languages/${t}';`)}return e}function Jt(t){let e=se.get(t);if(!e&&Re(t)){let r=Oe(t);e=se.get(r);}if(!e){let r=Array.from(se.keys()).join(", ");throw new Error(`Language profile '${t}' is not registered. Registered languages: ${r||"none"}. Import the language module first: import '@lokascript/semantic/languages/${t}';`)}return nr(e)}function M(t){let e=se.get(t);return !e&&Re(t)&&(e=se.get(Oe(t))),e?nr(e):void 0}function Qt(){return Array.from(he.keys())}function Ir(t){if(he.has(t)&&se.has(t))return true;if(Re(t)){let e=Oe(t);return he.has(e)&&se.has(e)}return false}function ei(t,e){return Xt(e).tokenize(t)}function oe(t){let e=je.get(t);if(!e&&Re(t)&&(e=je.get(Oe(t))),e)return e;let r=Er.get(t);if(!r&&Re(t)&&(r=Er.get(Oe(t))),r)return je.set(t,r),r;if(!rr)throw new Error(`No patterns registered for language '${t}'. Either import the language module or set a pattern generator.`);let i=Jt(t),a=rr(i);return je.set(t,a),a}function ve(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 I(t,e){let r={type:"literal",value:t};return e!==void 0?{type:"literal",value:t,dataType:e}:r}function xe(t){return Je(t)}function ne(t){return {type:"reference",value:t}}function ye(t,e){return {type:"property-path",object:t,property:e}}function J(t,e,r){let i={kind:"command",action:t,roles:new Map(Object.entries(e))};return r!==void 0?{...i,metadata:r}:i}function Ie(t,e,r,i,a,n){let u=new Map;u.set("event",t);let o={kind:"event-handler",action:"on",roles:u,body:e};return r!==void 0&&(o.eventModifiers=r),i!==void 0&&(o.metadata=i),a!==void 0&&a.length>0&&(o.parameterNames=a),o}function Di(t,e,r,i,a){let n={kind:"behavior",action:"behavior",roles:new Map,name:t,parameters:e,eventHandlers:r};return i!==void 0&&i.length>0&&(n.initBlock=i),a!==void 0&&(n.metadata=a),n}function Si(t,e,r,i){let a={kind:"def",action:"def",roles:new Map,name:t,parameters:e,body:r};return i!==void 0&&(a.metadata=i),a}function tr(t,e="then",r){let i={kind:"compound",action:"compound",roles:new Map,statements:t,chainType:e};return r!==void 0&&(i.metadata=r),i}function xi(t,e,r,i){let a=new Map;a.set("condition",t);let n={kind:"conditional",action:"if",roles:a,thenBranch:e};return r!==void 0&&(n.elseBranch=r),i!==void 0&&(n.metadata=i),n}function Ke(t,e){return !e||e.length===0||e.includes(t)||e.includes("expression")?true:t==="property-path"?e.some(r=>["selector","reference","expression"].includes(r)):t==="expression"?e.some(r=>["selector","reference","expression"].includes(r)):false}function ze(t){let e=t.roles.find(r=>r.role==="destination");return e?{destination:e.default?{fromRole:"destination",default:e.default}:{fromRole:"destination"}}:{}}function ge(t){let e=t.roles.find(r=>r.role==="source");return e?{source:e.default?{fromRole:"source",default:e.default}:{fromRole:"source"}}:{}}function ke(t,e){return jr(t,e,"source")}function ur(t,e){return jr(t,e,"destination")}function jr(t,e,r){if(!e||!t.roles.some(n=>n.role===r))return [];let i=e.alternatives?{type:"literal",value:e.primary,alternatives:[...e.alternatives]}:{type:"literal",value:e.primary},a={type:"role",role:r,optional:true};return [{type:"group",optional:true,tokens:e.position==="after"?[a,i]:[i,a]}]}var Bi={action:"toggle",description:"Toggle a class or attribute on/off",category:"dom-class",primaryRole:"patient",roles:[{role:"patient",description:"The class or attribute to toggle",required:true,expectedTypes:["selector"],selectorKinds:["class","attribute"],svoPosition:1,sovPosition:2},{role:"destination",description:"The target element (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:2,sovPosition:1,markerVariants:{ko:["\uC5D0\uC11C"]}}],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)"}},Fi={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","literal"],svoPosition:1,sovPosition:2},{role:"destination",description:"The target element (defaults to me)",required:false,expectedTypes:["selector","reference","expression"],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"}},Ti={action:"remove",description:"Remove a class or attribute from an element",category:"dom-class",primaryRole:"patient",targetRole:"source",roles:[{role:"patient",description:"The class/attribute to remove, or the element to remove",required:true,expectedTypes:["selector","reference"],svoPosition:1,sovPosition:2},{role:"source",description:"The element to remove from (defaults to me)",required:false,expectedTypes:["selector","reference","expression"],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"}},Oi={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"},markerVariants:{en:["before","after"]},methodCarrier:"method"}],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"}},Ri={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","property-path"],svoPosition:1,sovPosition:1,markerOverride:{en:"",ja:"\u3092",ko:"\uB97C",tr:"i",ar:"",sw:"",tl:"",bn:"\u0995\u09C7",qu:"ta",hi:"\u0915\u094B"}},{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:"\uC5D0",tr:"e",ar:"\u0625\u0644\u0649",sw:"kwenye",tl:"sa",bn:"\u09A4\u09C7",qu:"man",hi:"\u092E\u0947\u0902"},markerVariants:{tr:["e","a","ye","ya"]}},{role:"scope",description:"The element(s) the attribute/property is set on (defaults to me)",required:false,expectedTypes:["selector","reference"],svoPosition:3,sovPosition:3,markerOverride:{en:"on",es:"on",pt:"on",fr:"on",de:"on",it:"on",id:"on",ms:"on",sw:"on",tl:"on",zh:"on",vi:"on",ru:"on",uk:"on",pl:"on",th:"on",he:"on",ar:"on",ja:"on",ko:"on",tr:"on",hi:"on",bn:"on",qu:"on"}}],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>"}},Pi={action:"bind",description:"Reactively bind a variable to an element or property value",category:"variable",primaryRole:"destination",roles:[{role:"destination",description:"The variable to bind",required:true,expectedTypes:["reference","expression"],svoPosition:1,sovPosition:1,markerOverride:{en:"",es:"",pt:"",fr:"",de:"",it:"",id:"",ms:"",vi:"",ru:"",uk:"",pl:"",th:"",zh:"",he:"",ar:"",sw:"",tl:"",ja:"\u3092",ko:"\uB97C",tr:"i",bn:"\u0995\u09C7",qu:"ta",hi:"\u0915\u094B"}},{role:"source",description:"The element or property to bind to",required:true,expectedTypes:["selector","reference","expression"],svoPosition:2,sovPosition:2,markerOverride:{en:"to",es:"a",pt:"para",fr:"\xE0",de:"zu",it:"in",id:"ke",ms:"ke",vi:"v\xE0o",ru:"\u0432",uk:"\u0432",pl:"do",ja:"\u306B",ko:"\uC5D0",tr:"e",ar:"\u0625\u0644\u0649",zh:"\u5230",he:"\u05DC",sw:"kwa",th:"\u0E43\u0E19",tl:"sa",bn:"\u09A4\u09C7",qu:"man",hi:"\u092E\u0947\u0902"}}],errorCodes:["MISSING_TARGET","MISSING_VALUE","INVALID_SYNTAX"],recoveryHints:{MISSING_TARGET:"Add a variable to bind: bind $name to #input",MISSING_VALUE:'Add "to <element>" to specify the binding source',INVALID_SYNTAX:"Use syntax: bind <variable> to <element>"}},Ni={action:"live",description:"Reactive block: re-run the body when its dependencies change",category:"control-flow",primaryRole:"patient",hasBody:true,bareKeyword:true,roles:[]},_i={action:"eventsource",description:"Open a Server-Sent Events stream and handle its events",category:"async",primaryRole:"patient",hasBody:true,bareKeyword:true,roles:[]},Mi={action:"socket",description:"Open a WebSocket and handle its messages",category:"async",primaryRole:"patient",hasBody:true,bareKeyword:true,roles:[]},Li={action:"worker",description:"Define a Web Worker with inline methods",category:"async",primaryRole:"patient",hasBody:true,bareKeyword:true,roles:[]},Ii={action:"intercept",description:"Service-worker fetch interception / caching strategies",category:"async",primaryRole:"patient",hasBody:true,bareKeyword:true,roles:[]},ji={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}]},Vi={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}]},$i={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}]},Wi={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}]},qi={action:"wait",description:"Wait for a duration or event",category:"async",primaryRole:"duration",roles:[{role:"duration",description:"Duration or event to wait for",required:true,expectedTypes:["literal","expression"],svoPosition:1,sovPosition:1}]},Ki={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,markerOverride:{en:"as"}},{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}]},Ui={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",es:"por",pt:"por",fr:"par",de:"um"}}]},Hi={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",es:"por",pt:"por",fr:"par",de:"um"}}]},Gi={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"}}]},Yi={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"}}]},Zi={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}]},Xi={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:"",he:"\u05D0\u05EA",sw:"",tl:"",bn:"\u0995\u09C7",qu:"ta"}},{role:"destination",description:"Where to store the result (optional)",required:false,expectedTypes:["reference"],svoPosition:2,sovPosition:1}]},Ji={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}]},Qi={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}]},ea={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}]},ra={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}]},ta={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}]},ia={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","expression"],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"}}]},aa={action:"if",description:"Conditional execution",category:"control-flow",primaryRole:"condition",hasBody:true,roles:[{role:"condition",description:"The condition to evaluate",required:true,expectedTypes:["expression","reference","selector"],svoPosition:1,sovPosition:1}]},na={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","reference","selector"],svoPosition:1,sovPosition:1}]},ua={action:"else",description:"Else branch of conditional",category:"control-flow",primaryRole:"patient",hasBody:true,roles:[]},oa={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"'},sa={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","expression"],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",es:"en",fr:"en",de:"in",it:"in",pt:"dentro",id:"dalam",ms:"dalam",pl:"w",ru:"\u0432",uk:"\u0443",sw:"ndani",th:"\u0E43\u0E19",vi:"trong",ar:"\u0641\u064A",tl:"sa_loob",he:"in",zh:"\u5728"}}]},la={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}]},ca={action:"continue",description:"Continue to next loop iteration",category:"control-flow",primaryRole:"patient",roles:[]},ma={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:""},markerOptional:{en:true},markerVariants:{he:["\u05D0\u05EA"],zh:["\u628A"]}}]},pa={action:"transition",description:"Transition an element with animation",category:"dom-visibility",primaryRole:"patient",omitRoleVariants:["goal"],roles:[{role:"patient",description:"The property to transition (opacity, *background-color, etc.)",required:true,expectedTypes:["literal","expression","selector"],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:"kwa",bn:"\u09A4\u09C7",qu:"man",es:"a",pt:"para",fr:"\xE0",de:"zu",he:"\u05E2\u05DC",it:"in",ja:"\u306B",ko:"\uC5D0",ms:"ke",pl:"do",ru:"\u0432",th:"\u0E43\u0E19",tr:"e",uk:"\u0432",vi:"v\xE0o",zh:"\u5230",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}]},da={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"}}]},fa={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}]},ya={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}]},va={action:"empty",description:"Remove all children from an element (sets innerHTML to empty)",category:"dom-content",primaryRole:"patient",roles:[{role:"patient",description:"The element to empty (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:1,sovPosition:1}]},ha={action:"open",description:"Open a dialog, details element, or popover",category:"dom-content",primaryRole:"patient",roles:[{role:"patient",description:"The element to open (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:2,sovPosition:2},{role:"style",description:"Open-mode variant (modal / non-modal) for <dialog>",required:false,expectedTypes:["literal","expression"],svoPosition:1,sovPosition:1,markerOverride:{en:"as"}}]},Ea={action:"close",description:"Close a dialog, details element, or popover",category:"dom-content",primaryRole:"patient",roles:[{role:"patient",description:"The element to close (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:1,sovPosition:1}]},za={action:"select",description:"Select the contents of a text field or DOM element",category:"dom-content",primaryRole:"patient",roles:[{role:"patient",description:"The element whose contents to select (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:1,sovPosition:1}]},ga={action:"clear",description:"Clear a variable, local, or input element",category:"variable",primaryRole:"patient",roles:[{role:"patient",description:"The variable or element to clear (defaults to me)",required:false,expectedTypes:["selector","reference","expression"],default:{type:"reference",value:"me"},svoPosition:1,sovPosition:1}]},ka={action:"reset",description:"Reset a <form> element to its default values",category:"dom-content",primaryRole:"patient",roles:[{role:"patient",description:"The form element to reset (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:1,sovPosition:1}]},Ca={action:"breakpoint",description:"Drop into the debugger",category:"control-flow",primaryRole:"patient",roles:[],bareKeyword:true},ba={action:"call",description:"Call a function",category:"control-flow",primaryRole:"patient",roles:[{role:"patient",description:"The function to call",required:true,expectedTypes:["expression","reference"],markerOptional:{he:true,zh:true},svoPosition:1,sovPosition:1}]},wa={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}]},Aa={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}]},Da={action:"async",description:"Execute commands asynchronously",category:"async",primaryRole:"patient",hasBody:true,roles:[]},Sa={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:"",he:"\u05D0\u05EA",zh:"\u628A"}}]},xa={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:["selector","reference","expression","property-path"],svoPosition:1,sovPosition:1,markerOverride:{en:"",ar:"",tl:"",sw:"",bn:"\u0995\u09C7",qu:"ta",ja:"\u3092",ko:"\uB97C",tr:"i",hi:"\u0915\u094B",de:"",es:"",fr:"",it:"",pt:"",pl:"",ru:"",uk:"",vi:"",id:"",ms:"",th:"",zh:"\u628A",he:"\u05D0\u05EA"}},{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:"kwa",bn:"\u09A4\u09C7",qu:"man",ja:"\u306B",ko:"\uC5D0",tr:"e",hi:"\u092E\u0947\u0902",de:"zu",es:"a",fr:"\xE0",it:"in",pt:"para",pl:"do",ru:"\u0432",uk:"\u0432",vi:"v\xE0o",id:"ke",ms:"ke",th:"\u0E43\u0E19",zh:"\u5230",he:"\u05E2\u05DC"}}]},Ba={action:"init",description:"Initialization block that runs once",category:"control-flow",primaryRole:"patient",hasBody:true,roles:[]},Fa={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}]},Ta={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}]},Oa={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"}}]},Ra={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",es:"",fr:"",pt:"",it:"",de:"",pl:"",ru:"",uk:"",id:"",ms:"",sw:"",th:"",vi:"",he:"\u05D0\u05EA",zh:"\u628A"}},{role:"patient",description:"The content to swap in (optional for delete)",required:false,expectedTypes:["literal","expression","selector"],svoPosition:3,sovPosition:2,markerOverride:{en:"with",es:"con",fr:"avec",pt:"com",it:"con",de:"mit",pl:"z",ru:"\u0441",uk:"\u0437",id:"dengan",ms:"dengan",sw:"na",th:"\u0E14\u0E49\u0E27\u0E22",vi:"v\u1EDBi",he:"\u05E2\u05DD",zh:"\u7528"}}]},Pa={action:"morph",description:"Morph an element into another using DOM diffing",category:"dom-content",primaryRole:"patient",roles:[{role:"patient",description:"The element to morph",required:true,expectedTypes:["selector","reference"],svoPosition:1,sovPosition:1,markerOverride:{en:""}},{role:"destination",description:"The target content/element to morph into",required:true,expectedTypes:["literal","expression","selector","reference"],svoPosition:2,sovPosition:2,markerOverride:{en:"to"}}]},Na={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}]},_a={action:"break",description:"Exit from the current loop",category:"control-flow",primaryRole:"patient",roles:[]},Ma={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}]},La={action:"exit",description:"Exit from the current event handler",category:"control-flow",primaryRole:"patient",roles:[],bareKeyword:true},Ia={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}]},ja={action:"scroll",description:"Scroll the viewport to a target element",category:"navigation",primaryRole:"destination",argSkipTokens:["of","the","top","bottom","middle","center","nearest","left","right","smoothly","instantly"],roles:[{role:"destination",description:"The element to scroll to",required:true,expectedTypes:["selector","reference","expression"],svoPosition:1,sovPosition:1,markerOverride:{en:"to"}}]},Vr={en:"url",es:"url",pt:"url",fr:"url",de:"url",it:"url",ja:"url",ko:"url",zh:"url",ar:"url",he:"url",hi:"url",bn:"url",tr:"url",ru:"url",uk:"url",pl:"url",id:"url",vi:"url",th:"url",ms:"url",tl:"url",sw:"url",qu:"url"},Va={en:"partials in",es:"partials in",pt:"partials in",fr:"partials in",de:"partials in",it:"partials in",ja:"partials in",ko:"partials in",zh:"partials in",ar:"partials in",he:"partials in",hi:"partials in",bn:"partials in",tr:"partials in",ru:"partials in",uk:"partials in",pl:"partials in",id:"partials in",vi:"partials in",th:"partials in",ms:"partials in",tl:"partials in",sw:"partials in",qu:"partials in"},$a={action:"push",description:"Push a URL onto the browser history",category:"navigation",primaryRole:"patient",roles:[{role:"patient",description:"The URL to push (after the `url` keyword)",required:true,expectedTypes:["literal","expression"],svoPosition:1,sovPosition:1,markerOverride:Vr}]},Wa={action:"replace",description:"Replace the current browser history entry with a URL",category:"navigation",primaryRole:"patient",roles:[{role:"patient",description:"The URL to replace with (after the `url` keyword)",required:true,expectedTypes:["literal","expression"],svoPosition:1,sovPosition:1,markerOverride:Vr}]},qa={action:"process",description:"Process hx-partial markup in HTML content",category:"dom-content",primaryRole:"patient",roles:[{role:"patient",description:"The HTML content (string, element, or response) to process",required:true,expectedTypes:["literal","reference","expression"],svoPosition:1,sovPosition:1,markerOverride:Va}]},Ka={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}]},Ee={toggle:Bi,add:Fi,remove:Ti,put:Oi,set:Ri,show:ji,hide:Vi,on:$i,trigger:Wi,wait:qi,fetch:Ki,increment:Ui,decrement:Hi,append:Gi,prepend:Yi,log:Zi,get:Xi,take:Ji,make:Qi,halt:ea,settle:ra,throw:ta,send:ia,if:aa,unless:na,else:ua,repeat:oa,for:sa,while:la,continue:ca,go:ma,scroll:ja,push:$a,replace:Wa,process:qa,transition:pa,clone:da,focus:fa,blur:ya,empty:va,open:ha,close:Ea,select:za,clear:ga,reset:ka,breakpoint:Ca,call:ba,return:wa,js:Aa,async:Da,tell:Sa,default:xa,init:Ba,behavior:Fa,install:Ta,measure:Oa,swap:Ra,morph:Pa,beep:Na,break:_a,copy:Ma,exit:La,pick:Ia,render:Ka,bind:Pi,live:Ni,eventsource:_i,socket:Mi,worker:Li,intercept:Ii,compound:{action:"compound",description:"A compound node representing chained statements",primaryRole:"patient",category:"control-flow",hasBody:true,roles:[]}};function me(t){return Ee[t]}function Ua(){return Object.values(Ee).filter(t=>t.roles.length>0||t.bareKeyword===true)}typeof process<"u"&&process.env.NODE_ENV!=="production"&&Promise.resolve().then(()=>(Yt(),Rr)).then(({validateAllSchemas:t,formatValidationResults:e})=>{let r=t(Ee);r.size>0&&(console.warn("[SCHEMA VALIDATION] Found issues in command schemas:"),console.warn(e(r)),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 ce(t,e){let r=t.possessive?.keywords?.[e];if(r)return r;let i=t.possessive?.specialForms;if(i){for(let[a,n]of Object.entries(i))if(n===e)return a}}var $r=[{lang:"es",verb:"poner",verbAlts:["pon","colocar","put"],at:"en",end:"fin",of:"de"},{lang:"fr",verb:"mettre",at:"\xE0",end:"fin",of:"de"},{lang:"pt",verb:"colocar",at:"em",end:"fim",of:"de"},{lang:"it",verb:"mettere",at:"a",end:"fine",of:"di"},{lang:"de",verb:"setzen",at:"bei",end:"ende",of:"von"},{lang:"sw",verb:"weka",at:"katika",end:"mwisho",of:"ya"},{lang:"id",verb:"taruh",verbAlts:["letakkan","masukkan","tempatkan"],at:"di",end:"akhir",of:"dari"},{lang:"ms",verb:"letak",at:"di",end:"tamat",of:"daripada"},{lang:"vi",verb:"\u0111\u1EB7t",at:"t\u1EA1i",end:"k\u1EBFt th\xFAc",of:"c\u1EE7a"},{lang:"pl",verb:"umie\u015B\u0107",at:"przy",end:"koniec",of:"z"},{lang:"ru",verb:"\u043F\u043E\u043B\u043E\u0436\u0438\u0442\u044C",at:"\u0443",end:"\u043A\u043E\u043D\u0435\u0446",of:"\u0438\u0437"},{lang:"uk",verb:"\u043F\u043E\u043A\u043B\u0430\u0441\u0442\u0438",at:"\u0432",end:"\u043A\u0456\u043D\u0435\u0446\u044C",of:"\u0437"},{lang:"th",verb:"\u0E43\u0E2A\u0E48",at:"\u0E17\u0E35\u0E48",end:"\u0E08\u0E1A",of:"\u0E02\u0E2D\u0E07"},{lang:"tl",verb:"ilagay",at:"sa",end:"wakas",of:"ng"},{lang:"ar",verb:"\u0636\u0639",at:"\u0639\u0646\u062F",end:"\u0627\u0644\u0646\u0647\u0627\u064A\u0629",of:"\u0645\u0646"},{lang:"zh",verb:"\u653E\u7F6E",verbAlts:["\u653E","\u653E\u5165"],patientPrefix:"\u628A",at:"\u5728",end:"\u7ED3\u675F",of:"\u7684"},{lang:"he",verb:"\u05E9\u05D9\u05DD",patientPrefix:"\u05D0\u05EA",at:"at",end:"\u05E1\u05D5\u05E3",of:"of"},{lang:"tr",verb:"koy",sov:true,objMarker:"i",at:"de",end:"son",of:"nin"},{lang:"ja",verb:"\u7F6E\u304F",sov:true,objMarker:"\u3092",at:"\u3067",end:"\u7D42\u308F\u308A",of:"\u306E"},{lang:"ko",verb:"\uB123\uB2E4",sov:true,objMarker:"\uB97C",at:"\uC5D0",end:"\uB05D",of:"\uC758"},{lang:"hi",verb:"\u0930\u0916\u0947\u0902",verbAlts:["\u0930\u0916","\u0921\u093E\u0932\u0947\u0902","\u0921\u093E\u0932"],sov:true,objMarker:"\u0915\u094B",at:"\u092A\u0930",end:"\u0938\u092E\u093E\u092A\u094D\u0924",of:"\u0915\u093E"},{lang:"bn",verb:"\u09B0\u09BE\u0996\u09C1\u09A8",verbAlts:["\u09B0\u09BE\u0996"],sov:true,objMarker:"\u0995\u09C7",at:"\u098F",end:"\u09B6\u09C7\u09B7",of:"\u09B0"},{lang:"qu",verb:"churay",sov:true,objMarker:"ta",at:"pi",end:"tukuy",of:"pa"}];function zr(t,e,r,i){let a=$r.find(u=>u.lang===t);if(!a)return false;let n=(u,o)=>(u??"").toLowerCase()===o.toLowerCase();return n(e,a.end)&&n(r,a.at)&&n(i,a.of)}function Ha(t,e){let r=$r.find(a=>a.lang===t);if(!r)return false;let i=e.toLowerCase();return i===r.at.toLowerCase()||i===r.of.toLowerCase()||i===r.end.toLowerCase()}var Qe=.8,Ga=.6,Ya=.15,Za=.5,gr=.15,kr=.1,Cr=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"]),Xa={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"]},Ja=class{calculate(t){return this.calculateWithBreakdown(t).final}calculateWithBreakdown(t){let e=this.scoreRoleCoverage(t),r=this.scoreStemPenalty(t),i=this.scoreLanguageBoost(t),a=this.scoreLanguageAdjustment(t),n=e;return n=Math.max(Za,n+r),n=Math.min(1,n+i),n=Math.max(0,Math.min(1,n+a)),{roleCoverage:e,stemPenalty:r,languageBoost:i,languageAdjustment:a,final:n}}scoreRoleCoverage(t){let{pattern:e,captured:r}=t,i=0,a=0,n=u=>e.extraction?.[u]?.default!==void 0;for(let u of e.template.tokens)if(u.type==="role")a+=1,r.has(u.role)&&(i+=1);else if(u.type==="group")for(let o of u.tokens)o.type==="role"&&(a+=Qe,r.has(o.role)?i+=Qe:n(o.role)&&(i+=Qe*Ga));return a>0?i/a:1}scoreStemPenalty(t){let{stemMatchCount:e,totalKeywordMatches:r}=t;return e<=0||r<=0?0:-(e/r)*Ya}scoreLanguageBoost(t){let{pattern:e}=t;if(e.language!=="ar")return 0;let r=e.template.tokens[0];return !r||r.type!=="literal"?0:Cr.has(r.value)||r.alternatives?.some(i=>Cr.has(i))?gr:0}scoreLanguageAdjustment(t){let{pattern:e,captured:r}=t;if(e.language!=="ar")return 0;let i=0;for(let[a,n]of r.entries()){let u=Xa[a];if(!u||u.length===0)continue;let o="metadata"in n?n.metadata:void 0;o&&typeof o.prepositionValue=="string"&&(u.includes(o.prepositionValue)?i+=.1:i-=.1);}return Math.max(-kr,Math.min(kr,i))}},Qa=new Ja,en=new Set(Object.values(Ee).filter(t=>t.bareKeyword===true).map(t=>t.action)),G=class N{constructor(e){this.matchCache=new Map,this.stemMatchCount=0,this.totalKeywordMatches=0,this.confidenceModel=e??Qa;}matchPattern(e,r){let i=e.mark(),a=new Map;if(this.currentProfile=M(r.language),this.currentPatternCommand=r.command,this.stemMatchCount=0,this.totalKeywordMatches=0,!this.matchTokenSequence(e,r.template.tokens,a))return e.reset(i),null;let u=this.confidenceModel.calculate({pattern:r,captured:a,stemMatchCount:this.stemMatchCount,totalKeywordMatches:this.totalKeywordMatches});return this.applyExtractionRules(r,a),{pattern:r,captured:a,consumedTokens:e.position()-i.position,confidence:u}}matchBest(e,r){this.matchCache.clear();let i=[],a=e.position();for(let u of r){let o=e.mark(),s=`${a}:${u.id}`,l;this.matchCache.has(s)?l=this.matchCache.get(s):(l=this.matchPattern(e,u),this.matchCache.set(s,l)),l&&i.push(l),e.reset(o);}if(i.length===0)return null;i.sort((u,o)=>{let s=o.pattern.priority-u.pattern.priority;return s!==0?s:o.confidence-u.confidence});let n=i[0];return this.matchPattern(e,n.pattern),n}matchTokenSequence(e,r,i,a){let n=r[0],u=n?.type==="literal"&&(n.value==="and"||n.value==="then"||n.alternatives?.includes("and")||n.alternatives?.includes("then"));if(this.currentProfile?.code==="ar"&&!u)for(;e.peek()?.kind==="conjunction";)e.advance();let o=0;for(let s=0;s<r.length;s++){let l=r[s];o>0&&l.type==="literal"&&this.tryConsumeEventSourceClause(e,i,l);let c=this.matchPatternToken(e,l,i,r[s+1]??a);if(o=l.type==="role"&&l.role==="event"?2:Math.max(0,o-1),!c){if(this.isOptional(l))continue;return false}}return true}tryConsumeEventSourceClause(e,r,i){if(r.has("source"))return;let a=e.peek(),n=e.peek(1);if(!a||!n||this.patternTokenWouldMatch(i,a))return;let u=this.currentProfile?.roleMarkers?.source,o=l=>{if(l.kind!=="particle"&&l.kind!=="keyword")return false;if((l.normalized??"").toLowerCase()==="source")return true;if(!u)return false;let c=l.value.toLowerCase();return u.primary?.toLowerCase()===c?true:!!u.alternatives?.some(m=>m.toLowerCase()===c)},s=u?.position;if(s!=="after"&&o(a)&&n.kind==="selector"){e.advance();let l=this.tokenToSemanticValue(e.advance());l&&r.set("source",l);return}if(s==="after"&&a.kind==="selector"&&o(n)){let l=this.tokenToSemanticValue(a);e.advance(),e.advance(),l&&r.set("source",l);}}matchPatternToken(e,r,i,a){switch(r.type){case "literal":return this.matchLiteralToken(e,r);case "role":return this.matchRoleToken(e,r,i,a);case "group":return this.matchGroupToken(e,r,i,a);default:return false}}matchLiteralToken(e,r){let i=e.peek();if(!i)return false;let a=this.getMatchType(i,r.value);if(a!=="none")return this.totalKeywordMatches++,a==="stem"&&this.stemMatchCount++,e.advance(),true;if(r.alternatives)for(let n of r.alternatives){let u=this.getMatchType(i,n);if(u!=="none")return this.totalKeywordMatches++,u==="stem"&&this.stemMatchCount++,e.advance(),true}for(let n of [r.value,...r.alternatives??[]])for(let u of ["-","_"])if(n.includes(u)&&this.tryMatchShatteredCompound(e,n,u))return this.totalKeywordMatches++,true;return false}tryFoldHyphenActionKeyword(e){let r=this.currentProfile;if(!r)return null;let i=e.mark(),a=[];for(;;){let u=e.peek();if(!u||u.kind!=="identifier"&&u.kind!=="keyword")break;a.push(u.value),e.advance();let o=e.peek();if(!o||o.value!=="-")break;e.advance(),a.push("-");}if(a.length<3||a[a.length-1]==="-")return e.reset(i),null;let n=a.join("").toLowerCase();for(let[u,o]of Object.entries(r.keywords))if(o.primary.toLowerCase()===n||o.alternatives?.some(s=>s.toLowerCase()===n))return I(u);return e.reset(i),null}tryMatchShatteredCompound(e,r,i){let a=r.split(i);if(a.length<2||a.some(u=>u.length===0))return false;let n=e.mark();for(let u=0;u<a.length;u++){if(u>0){let s=e.peek();if(!s||s.value!==i)return e.reset(n),false;e.advance();}let o=e.peek();if(!o||o.kind!=="identifier"&&o.kind!=="keyword"&&o.kind!=="particle"||o.value.toLowerCase()!==a[u].toLowerCase())return e.reset(n),false;e.advance();}return true}matchRoleToken(e,r,i,a){this.skipNoiseWords(e);let n=e.peek();if(!n)return r.optional||false;if(r.role==="action"&&this.currentProfile&&e.peek(1)?.value==="-"){let z=this.tryFoldHyphenActionKeyword(e);if(z)return i.set(r.role,z),true}if(r.role==="event"&&this.currentPatternCommand==="on"){if(!N.tokenLooksLikeEvent(n))return r.optional||false;let z=(n.normalized??n.value).toLowerCase();if(N.POSITIONAL_OR_SCOPE_KEYWORDS.has(z)||this.currentProfile&&(ce(this.currentProfile,n.value)??ce(this.currentProfile,z))!==void 0||n.value.includes("?."))return r.optional||false}if(r.role==="event"){let z=(n.normalized??n.value).toLowerCase();if(N.STRUCTURAL_NEVER_EVENT.has(z))return r.optional||false}if(r.role==="duration"){let z=(n.normalized??n.value).toLowerCase();if(N.POSITIONAL_OR_SCOPE_KEYWORDS.has(z))return r.optional||false}if(r.optional&&a===void 0&&r.role!=="event"&&r.role!=="action"&&n.kind==="keyword"&&(n.normalized??n.value).toLowerCase()in Ee)return true;let u=this.tryMatchPositionalExpression(e);if(u)return r.expectedTypes&&r.expectedTypes.length>0&&!Ke(u.type,r.expectedTypes)?r.optional||false:(i.set(r.role,u),true);let o=this.tryMatchCaretScopeExpression(e);if(o)return r.expectedTypes&&r.expectedTypes.length>0&&!Ke(o.type,r.expectedTypes)?r.optional||false:(i.set(r.role,o),true);if(r.role!=="event"&&(!r.expectedTypes||r.expectedTypes.includes("expression"))){let z=this.tryMatchOperatorRunExpression(e);if(z)return i.set(r.role,z),true}if(r.expectedTypes?.includes("property-path")){let z=this.tryMatchOfPossessiveExpression(e);if(z)return i.set(r.role,z),true;let C=this.tryMatchPostNominalPossessiveExpression(e);if(C)return i.set(r.role,C),true}let s=this.tryMatchPossessiveExpression(e);if(s)return r.expectedTypes&&r.expectedTypes.length>0&&!r.expectedTypes.includes(s.type)&&!r.expectedTypes.includes("expression")?r.optional||false:(i.set(r.role,s),true);let l=this.tryMatchMethodCallExpression(e);if(l)return r.expectedTypes&&r.expectedTypes.length>0&&!r.expectedTypes.includes(l.type)&&!r.expectedTypes.includes("expression")?r.optional||false:(i.set(r.role,l),true);let m=r.role==="event"&&this.currentPatternCommand==="on"||N.DECLARATION_COMMANDS.has(this.currentPatternCommand??"")?null:this.tryMatchBareCallExpression(e);if(m)return r.expectedTypes&&r.expectedTypes.length>0&&!r.expectedTypes.includes(m.type)&&!r.expectedTypes.includes("expression")?r.optional||false:(i.set(r.role,m),true);let p=this.tryMatchPossessiveSelectorExpression(e);if(p)return r.expectedTypes&&r.expectedTypes.length>0&&!Ke(p.type,r.expectedTypes)?r.optional||false:(i.set(r.role,p),true);let d=r.role!=="condition",f=this.tryMatchPropertyAccessExpression(e,d);if(f)return r.expectedTypes&&r.expectedTypes.length>0&&!r.expectedTypes.includes(f.type)&&!r.expectedTypes.includes("expression")?r.optional||false:(i.set(r.role,f),true);let E=this.tryMatchSelectorPropertyExpression(e);if(E)return r.expectedTypes&&r.expectedTypes.length>0&&!Ke(E.type,r.expectedTypes)?r.optional||false:(i.set(r.role,E),true);if(n.kind==="identifier"&&n.value==="{"&&(!r.expectedTypes?.length||r.expectedTypes.includes("literal"))){let z=this.tryMatchBraceRunLiteral(e);if(z)return i.set(r.role,z),true}let v=this.tokenToSemanticValue(n);if(!v)return r.optional||false;if(r.expectedTypes&&r.expectedTypes.length>0&&!r.expectedTypes.includes(v.type)){let z=v.type==="selector"&&String(v.value).startsWith("@"),C=r.expectedTypes.some(w=>w==="expression"||w==="reference");if(!(z&&C))return r.optional||false}if(i.set(r.role,v),e.advance(),r.role==="event"){let z=e.peek();z&&z.kind==="selector"&&z.value.startsWith("[")&&"value"in v&&(i.set(r.role,I(`${String(v.value)}${z.value}`)),e.advance());let C=e.peek();if(C&&(C.kind==="particle"||C.kind==="keyword")&&(C.normalized??"").toLowerCase()==="source"&&!this.patternTokenWouldMatch(a,C)){let w=e.peek(1);if(w&&(w.kind==="selector"||w.kind==="identifier")){e.advance();let A=this.tokenToSemanticValue(e.advance());A&&!i.has("source")&&i.set("source",A);}}}return true}patternTokenWouldMatch(e,r){return e?e.type==="literal"?this.getMatchType(r,e.value)!=="none"?true:!!e.alternatives?.some(i=>this.getMatchType(r,i)!=="none"):e.type==="group"?this.patternTokenWouldMatch(e.tokens?.[0],r):false:false}tryMatchPositionalExpression(e){let r=e.peek();if(!r)return null;let i=(r.normalized??r.value).toLowerCase();if(!N.POSITIONAL_KEYWORDS.has(i)&&!N.POSITIONAL_KEYWORDS.has(r.value.toLowerCase()))return null;let a=e.mark(),n=[r.normalized??r.value];e.advance();let u=e.peek();if(!u||u.kind!=="selector")return e.reset(a),null;n.push(u.value),e.advance();let o=0;for(;o++<8;){let c=e.peek();if(c&&c.kind==="selector"&&c.value.startsWith("."))n.push(c.value),e.advance();else break}let s=e.peek(),l=e.peek(1);return s&&l&&l.kind==="selector"&&(s.kind==="keyword"||s.kind==="particle"||s.kind==="identifier")&&!N.POSITIONAL_KEYWORDS.has((s.normalized??s.value).toLowerCase())&&!N.COMMAND_ACTION_KEYWORDS.has((s.normalized??s.value).toLowerCase())&&(n.push(s.normalized??s.value,l.value),e.advance(),e.advance()),{type:"expression",raw:n.join(" ")}}tryMatchCaretScopeExpression(e){let r=e.peek();if(!r||r.kind!=="identifier"||!r.value.startsWith("^"))return null;let i=e.peek(1),a=e.peek(2),n=(i?.normalized??"").toLowerCase(),u=!!i&&(i.value.toLowerCase()==="on"||n==="destination"||n==="on");return !i||!a||a.kind!=="selector"||!u?null:(e.advance(),e.advance(),e.advance(),{type:"expression",raw:`${r.value} on ${a.value}`})}isOfPossessiveMarker(e){let r=e.value.toLowerCase(),i=(e.normalized??"").toLowerCase();if(r==="of"||r==="ng"||i==="of"||i==="source")return true;let a=this.currentProfile?.code?N.OF_POSSESSIVE_MARKERS[this.currentProfile.code]:void 0;return !!a&&a.has(r)}tryMatchOperatorRunExpression(e){let r=e.mark(),i=e.position();if(!this.tryConsumeRunOperand(e))return e.reset(r),null;let a=1;for(;;){let u=e.peek();if(!u||!N.RUN_OPERATORS.has(u.value))break;let o=e.mark();if(e.advance(),!this.tryConsumeRunOperand(e)){e.reset(o);break}a++;}if(a<2)return e.reset(r),null;let n=e.tokens.slice(i,e.position()).map(u=>u.value).join(" ");return {type:"expression",raw:n,value:n}}tryConsumeRunOperand(e){let r=e.peek();if(!r)return false;if(r.value==="("){let i=e.mark(),a=0;for(;!e.isAtEnd();){let n=e.advance();if(n.value==="(")a++;else if(n.value===")"&&(a--,a===0))return true}return e.reset(i),false}return this.tryMatchPossessiveExpression(e)?true:(r.kind==="literal"||r.kind==="identifier"||r.kind==="selector"||r.kind==="keyword")&&!N.RUN_OPERATORS.has(r.value)&&r.value!==")"?(e.advance(),true):false}tryMatchOfPossessiveExpression(e){let r=e.peek();if(!r||r.kind!=="selector")return null;let i=e.mark();e.advance();let a=e.peek();if(!a||!this.isOfPossessiveMarker(a))return e.reset(i),null;e.advance();let n=e.peek();return !n||n.kind!=="selector"?(e.reset(i),null):(e.advance(),ye(ve(n.value),r.value))}tryMatchPossessiveExpression(e){let r=e.peek();if(!r||!this.currentProfile)return null;let i=[r.value,r.normalized].filter(Boolean),a;for(let s of i)if(a=ce(this.currentProfile,s)??ce(this.currentProfile,s.toLowerCase()),a)break;if(!a)return null;let n=e.mark();e.advance();let u=this.currentProfile.possessive?.connectors;if(u&&u.length>0){let s=e.peek();if(s){let l=s.value.toLowerCase(),c=(s.normalized??"").toLowerCase();u.some(m=>m.toLowerCase()===l||m.toLowerCase()===c)&&e.advance();}}let o=e.peek();if(!o||Ha(this.currentProfile.code,o.value))return e.reset(n),null;if(o.kind==="identifier"||o.kind==="keyword"&&!this.isStructuralKeyword(o.value)&&!(o.normalized&&this.isStructuralKeyword(o.normalized))&&!(o.normalized&&this.isRoleMarkerConcept(o.normalized))||o.kind==="selector"&&o.value.startsWith("*")||o.kind==="selector"&&o.value.startsWith("@")||o.kind==="selector"&&o.value.startsWith(".")&&/^\.[a-zA-Z_]\w*/.test(o.value)){e.advance();let s=o.value;o.kind==="selector"&&s.startsWith(".")&&/^\.[a-zA-Z_]\w*/.test(s)&&(s=s.substring(1));let l=s;for(;e.peek()?.kind==="selector"&&e.peek().value.startsWith(".")&&/^\.[a-zA-Z_]\w*/.test(e.peek().value);)l+=e.peek().value,e.advance();let c=e.peek();if(c&&c.value.startsWith("(")){let m="",p=0,d=0;for(;!e.isAtEnd()&&d++<N.MAX_METHOD_ARGS+2;){let f=e.peek();if(!f)break;m+=f.value,e.advance();for(let E of f.value)E==="("?p++:E===")"&&p--;if(p<=0)break}l+=m;}return ye(ne(a),l)}return e.reset(n),null}tryMatchPostNominalPossessiveExpression(e){if(!this.currentProfile||this.currentProfile.possessive?.markerPosition!=="after-object")return null;let r=m=>{for(let p of [m.value,m.normalized].filter(Boolean))if(ce(this.currentProfile,p)??ce(this.currentProfile,p.toLowerCase()))return true;return false},i=e.peek();if(!i)return null;let a=i.kind==="selector"&&i.value.startsWith(".")&&/^\.[a-zA-Z_]\w*/.test(i.value);if(!(i.kind==="identifier"&&!this.isStructuralKeyword(i.value)&&!(i.normalized&&this.isStructuralKeyword(i.normalized))&&!(i.normalized&&this.isRoleMarkerConcept(i.normalized))||i.kind==="selector"&&(i.value.startsWith("*")||i.value.startsWith("@"))||a)||r(i))return null;let u=e.mark(),o=i.value;a&&(o=o.substring(1)),e.advance();let s=o;for(;e.peek()?.kind==="selector"&&e.peek().value.startsWith(".")&&/^\.[a-zA-Z_]\w*/.test(e.peek().value);)s+=e.peek().value,e.advance();let l=e.peek();if(!l)return e.reset(u),null;let c;for(let m of [l.value,l.normalized].filter(Boolean))if(c=ce(this.currentProfile,m)??ce(this.currentProfile,m.toLowerCase()),c)break;return c?(e.advance(),ye(ne(c),s)):(e.reset(u),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())}isRoleMarkerConcept(e){return new Set(["destination","source","patient","object","event","eventmarker","manner","instrument"]).has(e.toLowerCase())}static tokenLooksLikeEvent(e){if(e.kind==="selector"||e.kind==="url"||e.kind==="literal")return false;let r=e.value;if(/[/#@*]/.test(r)||r.startsWith('"')||r.startsWith("'")||r.startsWith("`"))return false;let i=e.normalized?.toLowerCase();return !(i&&en.has(i))}tryMatchBraceRunLiteral(e){let r=e.peek();if(!r||r.kind!=="identifier"||r.value!=="{")return null;let i=e.mark();e.advance();let a=["{"],n=1,u=0;for(;!e.isAtEnd()&&u++<N.MAX_BRACE_RUN_TOKENS;){let o=e.advance();if(!o)break;if(o.value==="{")n++;else if(o.value==="}"&&(n--,n===0))return a.push("}"),I(a.join(" "));a.push(o.value);}return e.reset(i),null}tryMatchBareCallExpression(e){let r=e.peek();if(!r||r.kind!=="identifier"||!/^[A-Za-z_][\w$]*$/.test(r.value))return null;let i=e.peek(1);if(!i||i.value!=="(")return null;let a=e.mark();e.advance(),e.advance();let n=[],u=false,o=0;for(;!e.isAtEnd()&&o++<N.MAX_METHOD_ARGS+2;){let s=e.peek();if(!s)break;if(s.value===")"){e.advance(),u=true;break}if(s.value===","){e.advance();continue}n.push(s.value),e.advance();}return u?{type:"expression",raw:`${r.value}(${n.join(", ")})`}:(e.reset(a),null)}tryMatchMethodCallExpression(e){let r=e.peek();if(!r||r.kind!=="selector")return null;let i=e.mark();e.advance();let a=e.peek();if(!a||a.kind!=="operator"||a.value!==".")return e.reset(i),null;e.advance();let n=e.peek();if(!n||n.kind!=="identifier")return e.reset(i),null;e.advance();let u=e.peek();if(!u||u.kind!=="punctuation"||u.value!=="(")return e.reset(i),null;e.advance();let o=[];for(;!e.isAtEnd()&&o.length<N.MAX_METHOD_ARGS;){let l=e.peek();if(!l)break;if(l.kind==="punctuation"&&l.value===")"){e.advance();break}if(l.kind==="punctuation"&&l.value===","){e.advance();continue}o.push(l.value),e.advance();}return {type:"expression",raw:`${r.value}.${n.value}(${o.join(", ")})`}}tryMatchPropertyAccessExpression(e,r=true){let i=e.peek();if(!i||i.kind!=="identifier"&&i.kind!=="keyword")return null;let a=e.mark();e.advance();let n=i.value.toLowerCase(),u=e.peek();if((i.kind==="identifier"||N.PROPERTY_ACCESS_BASES.has(n))&&u&&u.kind==="selector"&&/^\.[a-zA-Z_]/.test(u.value)){let d=i.value,f=[],E=0;for(;E<N.MAX_PROPERTY_DEPTH;){let C=e.peek();if(C&&C.kind==="selector"&&/^\.[a-zA-Z_]/.test(C.value))d+=`.${C.value.slice(1)}`,f.push(C.value.slice(1)),e.advance(),E++;else break}let v=e.peek(),z=!!v&&v.value.startsWith("(");if(r&&!z&&f.length>0&&xe(n))return ye(ne(n),f.join("."));if(z){let C=e.mark(),w=[],A=0,g=false;for(;!e.isAtEnd();){let h=e.peek();if(!h)break;if(h.value==="(")A++;else if(h.value===")"){if(w.push(h.value),e.advance(),A--,A===0&&(g=true),g)break;continue}w.push(h.value),e.advance();}g?d+=w.join(""):e.reset(C);}return {type:"expression",raw:d}}let o=e.peek();if(!o||o.kind!=="operator"||o.value!==".")return e.reset(a),null;e.advance();let s=e.peek();if(!s||s.kind!=="identifier")return e.reset(a),null;e.advance();let l=`${i.value}.${s.value}`,c=1;for(;!e.isAtEnd()&&c<N.MAX_PROPERTY_DEPTH;){let d=e.peek();if(!d||d.kind!=="operator"||d.value!==".")break;e.advance();let f=e.peek();if(!f||f.kind!=="identifier")break;e.advance(),l+=`.${f.value}`,c++;}let m=e.peek();if(m&&m.kind==="punctuation"&&m.value==="("){e.advance();let d=[],f=0;for(;!e.isAtEnd()&&d.length<N.MAX_METHOD_ARGS;){let v=e.peek();if(!v)break;if(v.kind==="punctuation"&&v.value===")"){if(f===0){e.advance();break}f--;}if(v.kind==="punctuation"&&v.value==="("&&f++,v.kind==="punctuation"&&v.value===","){e.advance();continue}d.push(v.value),e.advance();}return {type:"expression",raw:`${l}(${d.join(", ")})`}}let p=i.value.toLowerCase();if(r&&xe(p)){let d=l.split(".").slice(1).join(".");return ye(ne(p),d)}return {type:"expression",raw:l}}tryMatchPossessiveSelectorExpression(e){let r=e.peek();if(!r||r.kind!=="selector")return null;let i=e.mark();e.advance();let a=e.peek(),n=this.currentProfile?.possessive?.marker?.replace(/^-/,""),u=!!a&&a.kind==="punctuation"&&a.value==="'s",o=!!a&&a.value==="'"&&(e.peek(1)?.value??"").toLowerCase()==="s",s=(()=>{if(!this.currentPatternCommand||(a?.normalized??"").toLowerCase()!=="source")return false;let p=Ee[this.currentPatternCommand];return !!p&&p.roles.some(d=>d.role==="source")})(),l=!!a&&!!n&&n!=="'s"&&a.value===n&&(a.kind==="particle"||a.kind==="punctuation")&&!s;if(!u&&!l&&!o)return e.reset(i),null;e.advance(),o&&e.advance();let c=e.peek();return !c||!(c.kind==="identifier"||(u||o)&&(c.kind==="selector"||c.kind==="keyword"))?(e.reset(i),null):(e.advance(),ye(ve(r.value),c.value))}tryMatchSelectorPropertyExpression(e){let r=e.peek();if(!r||r.kind!=="selector"||!r.value.startsWith("#"))return null;let i=e.mark();e.advance();let a=e.peek();if(!a||a.kind!=="selector"||!a.value.startsWith("."))return e.reset(i),null;let n=e.peek(1);n&&n.kind,e.advance();let u=a.value.slice(1);return ye(ve(r.value),u)}matchGroupToken(e,r,i,a){let n=e.mark(),u=new Set(i.keys());if(!this.matchTokenSequence(e,r.tokens,i,a)){e.reset(n);for(let s of i.keys())u.has(s)||i.delete(s);return r.optional||false}return true}getMatchType(e,r){return e.value===r?"exact":e.normalized===r?"normalized":e.stem===r&&e.stemConfidence!==void 0&&e.stemConfidence>=.7?"stem":e.kind==="keyword"&&e.value.toLowerCase()===r.toLowerCase()?"case-insensitive":"none"}tokenToSemanticValue(e){switch(e.kind){case "selector":return ve(e.value);case "literal":return this.parseLiteralValue(e.value);case "keyword":let r=(e.normalized||e.value).toLowerCase();return xe(r)?ne(r):I(e.normalized||e.value);case "identifier":if(e.value.startsWith("@"))return ve(e.value);if(e.value.startsWith(":")||e.value.startsWith("$"))return ne(e.value);let i=e.value.toLowerCase();return xe(i)?ne(i):{type:"expression",raw:e.value};case "url":return I(e.value,"string");default:return null}}parseLiteralValue(e){if(e.startsWith('"')||e.startsWith("'")||e.startsWith("`")||e.startsWith("\u300C")){let a=e.slice(1,-1);return I(a,"string")}if(e==="true")return I(true,"boolean");if(e==="false")return I(false,"boolean");let r=e.match(/^(\d+(?:\.\d+)?)(ms|s|m|h)?$/);if(r){let a=parseFloat(r[1]);return r[2]?I(e,"duration"):I(a,"number")}let i=parseFloat(e);return isNaN(i)?I(e,"string"):I(i,"number")}applyExtractionRules(e,r){for(let[i,a]of Object.entries(e.extraction))r.has(i)||(a.value!==void 0?r.set(i,{type:"literal",value:a.value}):a.default&&r.set(i,a.default));}isOptional(e){return e.type!=="literal"&&e.optional===true}skipNoiseWords(e){let r=e.peek();if(!r)return;let i=r.value.toLowerCase();if(N.ENGLISH_NOISE_WORDS.has(i)){let a=e.mark();e.advance();let n=e.peek();if(n&&(n.kind==="selector"||n.kind==="identifier"))return;let u=e.peek(1);if(n&&n.kind==="keyword"&&u&&u.kind==="selector"&&/^\.[a-zA-Z_]/.test(u.value))return;let o=n?(n.normalized??n.value).toLowerCase():"";if(n&&N.POSITIONAL_OR_SCOPE_KEYWORDS.has(o))return;let s=e.peek(1),l=s?(s.normalized??s.value).toLowerCase():"",c=this.currentProfile?.wordOrder!=="SOV"&&N.COMMAND_ACTION_KEYWORDS.has(l),m=!s||s.kind==="particle"||N.CLAUSE_BOUNDARY_KEYWORDS.has(l)||c;if(n&&n.kind==="keyword"&&this.currentProfile?.code!=="en"&&xe(o)&&m||n&&n.kind==="keyword"&&this.currentProfile?.code==="en"&&xe(o))return;e.reset(a);}i==="class"&&e.advance();}extractEventModifiers(e){let r={},i=false;for(;!e.isAtEnd();){let a=e.peek();if(!a||a.kind!=="event-modifier")break;let n=a.metadata;if(!n)break;switch(i=true,n.modifierName){case "once":r.once=true;break;case "debounce":typeof n.value=="number"&&(r.debounce=n.value);break;case "throttle":typeof n.value=="number"&&(r.throttle=n.value);break;case "queue":(n.value==="first"||n.value==="last"||n.value==="all"||n.value==="none")&&(r.queue=n.value);break}e.advance();}return i?r:void 0}};G.POSITIONAL_KEYWORDS=new Set(["first","last","next","previous","random","closest"]);G.POSITIONAL_OR_SCOPE_KEYWORDS=new Set(["first","last","next","previous","random","closest","parent"]);G.STRUCTURAL_NEVER_EVENT=new Set(["if","unless","else","end","then"]);G.PROPERTY_ACCESS_BASES=new Set(["it","me","you","my","its","your","event","result","target","detail","body","window","document","self","this"]);G.COMMAND_ACTION_KEYWORDS=new Set(Object.keys(Ee).map(t=>t.toLowerCase()));G.CLAUSE_BOUNDARY_KEYWORDS=new Set(["then","and","or","end","else"]);G.OF_POSSESSIVE_MARKERS={ms:new Set(["daripada"]),sw:new Set(["ya"]),vi:new Set(["c\u1EE7a"]),zh:new Set(["\u7684"]),it:new Set(["di"]),pl:new Set(["z"]),uk:new Set(["\u0437"]),th:new Set(["\u0E02\u0E2D\u0E07"]),ja:new Set(["\u306E"]),ko:new Set(["\uC758"]),bn:new Set(["\u09B0"]),hi:new Set(["\u0915\u093E"]),qu:new Set(["pa"]),tr:new Set(["nin"])};G.RUN_OPERATORS=new Set(["+","-","*","/"]);G.MAX_BRACE_RUN_TOKENS=64;G.MAX_PROPERTY_DEPTH=10;G.MAX_METHOD_ARGS=20;G.DECLARATION_COMMANDS=new Set(["behavior","def","install"]);G.ENGLISH_NOISE_WORDS=new Set(["the","a","an"]);var rn=G,re=new rn;function Y(t,e){return ei(t,e)}function Wr(){return Qt()}var Ge=["if","unless","repeat","for","while"];function ue(t,e){let r=new Set([e]),a=M(t)?.keywords?.[e];if(a){a.primary&&r.add(a.primary.toLowerCase());for(let n of a.alternatives??[])r.add(n.toLowerCase());}return r}function Q(t,e){return e.has(t.value.toLowerCase())?true:t.normalized?e.has(t.normalized.toLowerCase()):false}var tn=new Set(Ge);function or(t,e){let r=t.normalized?.toLowerCase();return r?tn.has(r):e.some(i=>Q(t,i))}var br=new Set(["me","it","you","the","body","window","document","its","event","result","target","self","this","them","parent","next","previous","closest","first","last"]),an=new Set(["destination","source","style","patient","on","from","to"]);function nn(t){if(!t||t.kind==="selector")return false;let e=(t.normalized??t.value).toLowerCase(),r=t.value.toLowerCase();return !(br.has(e)||br.has(r)||an.has(e))}var wr=new Set(["ja","ko"]);function ir(t){let e=new Set;t?.primary&&e.add(t.primary.toLowerCase());for(let r of t?.alternatives??[])e.add(r.toLowerCase());return e}function qr(t,e){let r=[],i=e.position.end,a=t.slice(e.position.end).match(/^\s*\(([^)]*)\)/);if(a){i=e.position.end+a[0].length;for(let n of a[1].split(/[,،、]/)){let u=n.trim();u&&r.push(u);}}return {parameters:r,headerEnd:i}}function Kr(t,e,r){let i=e+1;if(i>=t.length)return -1;let a=ir(M(r)?.roleMarkers?.patient);return a.size>0&&Q(t[i],a)&&i++,i<t.length?i:-1}function un(t,e,r){if(!M(e))return null;let i=ue(e,"behavior"),a=ue(e,"def"),n=t.toLowerCase(),u=[...i].some(c=>n.includes(c)),o=/\bdef\b/.test(n)||[...a].some(c=>c!=="def"&&n.includes(c));if(!u&&!o)return null;let s=Y(t,e).tokens;if(s.length<2)return null;if(Q(s[0],i))return Ar(t,e,s,r,0);let l=s.findIndex((c,m)=>m>0&&Q(c,i));return l>0&&/^[A-Z][A-Za-z0-9_]*$/.test(s[0].value)?Ar(t,e,s,r,l):Q(s[0],a)?sn(t,e,s,r):null}function on(t,e,r){let i=M(e);if(!i)return null;let a=i.wordOrder!=="SOV",n=wr.has(e)?ir(i.roleMarkers?.event):new Set,u=wr.has(e)?ir(i.keywords?.on):new Set,o=n.size>0&&u.size>0,s=ue(e,"end"),l=ue(e,"on"),c=t.toLowerCase(),m=[...s].some(h=>c.includes(h)),p=(a||o)&&(()=>{let h=0;for(let b of l)if(b){for(let y=c.indexOf(b);y>=0;y=c.indexOf(b,y+b.length))if(++h>=2)return true}return false})();if(!m&&!p)return null;let d=Y(t,e).tokens;if(d.length<2)return null;let f=Ge.map(h=>ue(e,h)),E=h=>or(h,f),v=h=>Q(h,s),z=[],C=0,w=0;for(let h=0;h<d.length;h++){let b=d[h];if(v(b)){if(C>0){C--;continue}let y=t.slice(d[w].position.start,b.position.start).trim();y&&z.push(y),w=h+1;}else if(E(b))C++;else if(a&&C===0&&h>w&&Q(b,l)&&nn(d[h+1])){let y=t.slice(d[w].position.start,b.position.start).trim();y&&z.push(y),w=h;}else if(o&&C===0&&h-1>w&&Q(b,n)&&d[h+1]!==void 0&&Q(d[h+1],u)){let y=d[h-1],k=t.slice(d[w].position.start,y.position.start).trim();k&&z.push(k),w=h-1;}}if(w<d.length){let h=t.slice(d[w].position.start).trim();h&&z.push(h);}if(z.length<2)return null;let A=[],g=[];for(let h of z){let b;try{b=r.statement(h,e);}catch{return null}if(!b||b.kind!=="event-handler")return null;let y=b;A.push(y);let k=!y.body||y.body.length===0;g.push(k?.2:y.metadata?.confidence??.75);}return tr(A,"then",{sourceLanguage:e,confidence:Ue(g),sourceText:t})}function Ue(t){return t.length>0?t.reduce((e,r)=>e+r,0)/t.length:0}function Ur(t){let e=[];for(let r of t){let i=r.statements;r.kind==="compound"&&Array.isArray(i)?e.push(...i):e.push(r);}return e}function Ar(t,e,r,i,a){let n=a>0,u=n?0:Kr(r,a,e);if(u<0)return null;let o=r[u],s=o.value;if(!/^[A-Z][A-Za-z0-9_]*$/.test(s))return null;let{parameters:l,headerEnd:c}=qr(t,o),m=n?a+1:r.findIndex(y=>y.position.start>=c);m<=u&&(m=u+1);let p=ue(e,"init"),d=ue(e,"end"),f=Ge.map(y=>ue(e,y)),E=y=>or(y,f),v=y=>Q(y,d),z=[],C=[],w=[],A=false,g=0,h=m;for(let y=m;y<r.length;y++){let k=r[y];if(v(k)){if(g>0){g--;continue}if(y===h){A=true;break}if(Q(r[h],p)){let x=t.slice(r[h].position.end,k.position.start).trim();if(x)try{let S=Ur(i.body(x,e));C.push(...S),w.push(Ue(S.map(R=>R.metadata?.confidence??.75)));}catch{w.push(0);}}else {let x=t.slice(r[h].position.start,k.position.start).trim();try{let S=i.statement(x,e);if(S&&S.kind==="event-handler"){let R=S;z.push(R);let F=!R.body||R.body.length===0;w.push(F?.2:R.metadata?.confidence??.75);}else w.push(0);}catch{w.push(0);}}h=y+1;}else E(k)&&g++;}if(z.length===0&&C.length===0)return null;let b=(A?1:.8)*Ue(w);return Di(s,l,z,C.length>0?C:void 0,{sourceLanguage:e,confidence:b,sourceText:t})}function sn(t,e,r,i){let a=Kr(r,0,e);if(a<0)return null;let n=r[a],u=n.value;if(!/^[a-zA-Z_$][\w$]*(?:\.[a-zA-Z_$][\w$]*)*$/.test(u))return null;let{parameters:o,headerEnd:s}=qr(t,n),l=r.findIndex(g=>g.position.start>=s);l<=a&&(l=a+1);let c=ue(e,"end"),m=Ge.map(g=>ue(e,g)),p=g=>or(g,m),d=g=>Q(g,c),f=0,E=-1;for(let g=l;g<r.length;g++)if(d(r[g])){if(f===0){E=g;break}f--;}else p(r[g])&&f++;let v=r[l]?.position.start??s,z=E>=0?r[E].position.start:t.length,C=t.slice(v,z).trim();if(!C)return null;let w;try{w=Ur(i.body(C,e));}catch{return null}if(w.length===0)return null;let A=Ue(w.map(g=>g.metadata?.confidence??.75));return E<0&&(A*=.8),Si(u,o,w,{sourceLanguage:e,confidence:A,sourceText:t})}var Fe={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",boyutland\u0131rma:"resize",boyutland\u0131r:"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"}};Object.fromEntries(Object.entries(Fe).map(([t,e])=>{let r={};for(let[i,a]of Object.entries(e))a in r||(r[a]=i);return [t,r]}));var Be=new Set(["if","unless","while","repeat","for"]),dn=new Set(["then","end","else","if","unless","while","for","repeat","and"]),fn=new Set(["first","last","next","previous","random","closest"]),Te=new Set(["click","dblclick","input","change","submit","keydown","keyup","keypress","mouseover","mouseout","mousedown","mouseup","focus","blur","load","scroll","resize","contextmenu","transitionend","transitionstart","transitionrun","transitioncancel","animationend","animationstart","animationiteration","animationcancel","pointerdown","pointerup","pointermove","pointerenter","pointerleave","pointercancel","pointerover","pointerout","touchstart","touchend","touchmove","touchcancel","mousemove","mouseenter","mouseleave","wheel","dragstart","dragend","dragover","dragenter","dragleave","drop","drag","loadend","loadstart","error","abort","close","open","message","popstate","hashchange","storage","online","offline","visibilitychange"]),Dr=class extends Error{constructor(t,e,r,i){super(t),this.name="SemanticParseError",this.language=e,this.input=r,this.diagnostics=i;}};function L(t,e,r){return {message:t,severity:e,source:"semantic-parser",...r&&{code:r}}}function H(t,e){return e.length===0?t:{...t,diagnostics:e}}function Sr(t){if(t.length>=2){let e=t[0];if((e==='"'||e==="'")&&t.endsWith(e))return t.slice(1,-1)}return t}var yn=["body","statements","thenBranch","elseBranch","eventHandlers","initBlock"];function Hr(t,e){if(!t||typeof t!="object")return t;if(t.action&&t.roles instanceof Map){let i=me(t.action),a=i?.primaryRole;if(i&&a&&a!=="patient"&&!i.roles.some(n=>n.role==="patient")&&t.roles.has("patient")&&!t.roles.has(a)){let n=t.roles,u=n.get("patient");u!==void 0&&(n.delete("patient"),n.set(a,u));}if(t.action==="tell"){let n=t.roles,u=n.get("patient"),o=n.get("destination");u&&(u.type==="selector"||u.type==="reference")&&(!o||o.type==="literal")&&(n.delete("patient"),n.set("destination",u));}if(t.action==="transition"){let n=t.roles,u=n.get("destination");u&&u.type==="literal"&&!n.has("goal")&&(n.delete("destination"),n.set("goal",u));let o=n.get("patient");o&&o.type==="literal"&&typeof o.value=="string"&&/^[A-Za-z_][A-Za-z0-9_-]*$/.test(o.value)&&n.set("patient",{type:"expression",raw:o.value});}if(t.action==="morph"){let n=t.roles,u=n.get("patient");u&&u.type==="literal"&&typeof u.value=="string"&&/<[a-zA-Z][^>]*\/?>/.test(u.value)&&n.set("patient",{type:"expression",raw:u.value});}if(t.action==="wait"){let n=t.roles;if(!n.has("event")){let u=n.get("duration"),o=u?.type==="expression"?u.raw:u?.type==="literal"?u.value:void 0;typeof o=="string"&&Te.has(o.toLowerCase())&&(n.delete("duration"),n.set("event",{type:"literal",value:o,dataType:"string"}));}}if(t.kind==="command"&&t.action!=="on"){let n=t.roles,u=n.get("event");if(u&&u.type==="expression"){let o=u.raw;typeof o=="string"&&/^[A-Za-z_][A-Za-z0-9_-]*(:[A-Za-z0-9_-]+)?$/.test(o)&&n.set("event",{type:"literal",value:o,dataType:"string"});}}if(e?.size){let n=t.roles;for(let u of ["destination","source"]){let o=n.get(u);o&&o.type==="literal"&&typeof o.value=="string"&&e.has(o.value)&&n.set(u,{type:"expression",raw:o.value});}}}let r=t;for(let i of yn){let a=r[i];if(Array.isArray(a))for(let n of a)Hr(n,e);}return t}var ee=class O{constructor(){this.parseDepth=0,this.boundIdentifiers=new Set;}parse(e,r){this.parseDepth===0&&this.boundIdentifiers.clear(),this.parseDepth++;try{return Hr(this.parseInternal(e,r),this.boundIdentifiers)}finally{this.parseDepth--;}}registerBoundIdentifiers(e){let r=e.action==="repeat"||e.action==="for"?"patient":e.action==="set"?"destination":null;if(!r)return;let i=e.roles.get(r);i?.type==="expression"&&typeof i.raw=="string"&&/^[A-Za-z_]\w*$/.test(i.raw)&&this.boundIdentifiers.add(i.raw);}parseInternal(e,r){let i=un(e,r,{statement:(y,k)=>this.parse(y,k),body:(y,k)=>this.parseStatements(y,k)});if(i)return i;let a=on(e,r,{statement:(y,k)=>this.parse(y,k),body:(y,k)=>this.parseStatements(y,k)});if(a)return a;let{modifiers:n,remainingInput:u}=this.extractStandaloneModifiers(e,r),o=u||e,l=this.stripAsyncModifier(o,r).remainingInput??o,m=this.stripDoNotThrowModifier(l,r).remainingInput??l,p=[],d=Y(m,r),f=oe(r);if(f.length===0)throw new Dr(`No patterns available for language: ${r}`,r,m,[L(`No patterns registered for language '${r}'`,"error","no-patterns")]);let E=[...f].sort((y,k)=>k.priority-y.priority);{let y=d.tokens;if(M(r)?.wordOrder==="VSO"&&y.length>=4&&y[0]?.normalized==="source"){let k=y.findIndex(x=>x.normalized==="on");if(k>=2&&k+1<y.length){let x=m.slice(y[0].position.start,y[k].position.start).trim(),S=y[k+1].position.end,R=m.slice(y[k].position.start,S)+" "+x+m.slice(S);if(R!==m)try{let F=this.parse(R,r);if(F&&F.kind==="event-handler"){let T=n?this.applyModifiers(F,n):F;return H(T,p)}}catch{}}}}{let y=d.tokens;for(let k=1;k<y.length-1;k++){let x=y[k],S=x.value,R=(x.normalized??x.value).toLowerCase();if(!(R==="or"||O.OR_KEYWORDS.has(S)||O.OR_KEYWORDS.has(R)))continue;let T=y[k+1],_=(T.normalized??T.value).toLowerCase();if(!O.KNOWN_EVENTS.has(_))break;let P=k+1,W=y[k+2];W&&W.kind==="selector"&&W.value.startsWith("[")&&(P=k+2);let q=y[k].position.start,pe=y[P].position.end,te=(m.slice(0,q).trimEnd()+" "+m.slice(pe).trimStart()).trim();if(te&&te!==m)try{let de=this.parse(te,r);if(de&&de.kind==="event-handler"){de.additionalEvents=[{type:"literal",value:_}];let Xe=n?this.applyModifiers(de,n):de;return H(Xe,p)}}catch{}break}}let v=E.filter(y=>y.command==="on"),z=d.mark(),C=re.matchBest(d,v);if(C){p.push(L(`event pattern matched: ${C.pattern.id} (confidence: ${C.confidence.toFixed(2)})`,"info","pattern-match"));let y=false;if(/^event-[a-z]+-bare$/.test(C.pattern.id)){let k=C.captured.get("event"),x=(k?.raw??k?.value??"").toString().toLowerCase(),S=Fe[r],R=O.KNOWN_EVENTS.has(x)||!!S&&Object.keys(S).some(F=>F.toLowerCase()===x);if(x&&!R){let F=this.trySOVEventExtraction(m,r,E);if(F){p.push(L(`bare-event mis-anchor on "${x}" rejected; SOV extraction preferred`,"info","stage-bare-event-guard"));let T=n?this.applyModifiers(F,n):F;return H(T,p)}if(k?.type==="reference"||k?.type==="expression"){d.reset(z);let T=E.filter(P=>P.command!=="on"),_=re.matchBest(d,T);d.reset(z),_&&_.pattern.command!=="on"?(y=true,p.push(L(`bare-event mis-anchor on reference "${x}" rejected; command ${_.pattern.command} preferred`,"info","stage-bare-event-guard"))):re.matchBest(d,v);}}}if(!y){let k=this.buildEventHandler(C,d,r),x=n?this.applyModifiers(k,n):k;return H(x,p)}}p.push(L(`event patterns: ${v.length} tried, no match`,"info","stage-event"));let w=this.tryTrailingEventExtraction(m,r,E);if(w){p.push(L("trailing event extraction succeeded","info","stage-trailing-event"));let y=n?this.applyModifiers(w,n):w;return H(y,p)}let A=E.filter(y=>y.command!=="on"),g=re.matchBest(d,A);if(g){if(Be.has(g.pattern.command)){let y=this.trySOVEventExtraction(m,r,E);if(y){p.push(L(`SOV event extraction preferred over bare ${g.pattern.command} command`,"info","stage-sov-loop"));let x=n?this.applyModifiers(y,n):y;return H(x,p)}let k=this.tryMidStreamEventExtraction(m,r,E);if(k){p.push(L(`mid-stream event extraction preferred over bare ${g.pattern.command} command`,"info","stage-midstream-loop"));let x=n?this.applyModifiers(k,n):k;return H(x,p)}}else if(O.KNOWN_EVENTS.has(g.pattern.command)&&this.hasSOVEventMarkerHead(m,r)){let y=this.trySOVEventExtraction(m,r,E);if(y){p.push(L(`SOV event extraction preferred over command-homonym event ${g.pattern.command}`,"info","stage-sov-homonym"));let k=n?this.applyModifiers(y,n):y;return H(k,p)}}else if(M(r)?.wordOrder==="VSO"){let y=this.tryMidStreamEventExtraction(m,r,E);if(y){p.push(L(`mid-stream event extraction preferred over bare ${g.pattern.command} command`,"info","stage-midstream-cmd"));let k=n?this.applyModifiers(y,n):y;return H(k,p)}}if(g.consumedTokens<d.tokens.length&&M(r)?.wordOrder==="SOV"){let y=this.trySOVEventExtraction(m,r,E);if(y){p.push(L(`SOV event extraction preferred over partial ${g.pattern.command} command (trailing remainder)`,"info","stage-sov-trailing"));let k=n?this.applyModifiers(y,n):y;return H(k,p)}}return p.push(L(`command pattern matched: ${g.pattern.id} (confidence: ${g.confidence.toFixed(2)})`,"info","pattern-match")),H(this.buildCommand(g,r),p)}if(p.push(L(`command patterns: ${A.length} tried, no match`,"info","stage-command")),!m.includes(`
4
+ `)&&M(r)?.wordOrder==="VSO"){let y=this.tryMidStreamEventExtraction(m,r,E);if(y){p.push(L("mid-stream event extraction succeeded with no leading command match","info","stage-midstream-nocmd"));let k=n?this.applyModifiers(y,n):y;return H(k,p)}}let h=this.trySOVEventExtraction(m,r,E);if(h){p.push(L("SOV event extraction succeeded","info","stage-sov"));let y=n?this.applyModifiers(h,n):h;return H(y,p)}p.push(L("SOV event extraction: no event keyword found","info","stage-sov"));let b=this.tryCompoundCommandParsing(d,A,r);if(b)return p.push(L("compound command parsing succeeded","info","stage-compound")),H(b,p);throw p.push(L("compound parsing: no then-keywords or no command matches","info","stage-compound")),p.push(L(`all parse stages exhausted for "${m}"`,"error","parse-failed")),new Dr(`Could not parse input in ${r}: ${m}`,r,m,p)}parseStatements(e,r){let i=Y(e,r),a=oe(r).filter(n=>n.command!=="on").sort((n,u)=>u.priority-n.priority);return this.parseBodyWithClauses(i,a,r)}canParse(e,r){try{return this.parse(e,r),!0}catch{return false}}supportedLanguages(){return Wr()}buildCommand(e,r){if(!e)throw new Error("No match to build command from");let i={};for(let[n,u]of e.captured)i[n]=u;let a=J(e.pattern.command,i,{sourceLanguage:r,patternId:e.pattern.id,confidence:e.confidence});return this.registerBoundIdentifiers(a),a}buildEventHandler(e,r,i){if(!e)throw new Error("No match to build event handler from");let a=e.captured.get("event");if(!a)throw new Error("Event handler pattern matched but no event captured");let n=re.extractEventModifiers(r),u=this.extractOrConjunctionEvents(r,i),o=a;u.length>0&&a.type==="literal"&&(o={type:"literal",value:[String(a.value),...u.map(m=>String("value"in m?m.value:""))].join(" or ")});let s,l=e.captured.get("action");if(l&&l.type==="literal"&&l.value==="if"){let c=r.tokens,m=-1;for(let p=r.position()-1;p>=0;p--){let d=c[p],f=(d.normalized??d.value).toLowerCase();if(this.isIfKeyword(f,i)){m=p;break}}if(m>=0){let p=oe(i).filter(v=>v.command!=="on").sort((v,z)=>z.priority-v.priority),d=new ae(c.slice(m),i),f=this.parseBodyWithClauses(d,p,i);if(f.some(v=>v.kind==="conditional")||f.length===1&&f[0]?.kind==="compound"&&f[0].statements.some(v=>v.kind==="conditional")){for(;!r.isAtEnd();)r.advance();return Ie(o,f,n,{sourceLanguage:i,patternId:e.pattern.id,confidence:e.confidence})}}}if(l&&l.type==="literal"){let c=l.value,m={};for(let[A,g]of e.captured)A!=="event"&&A!=="action"&&A!=="continues"&&(m[A]=g);if(c==="repeat"){let A=r.peek(),g=b=>(b.normalized??b.value).toLowerCase();if(A&&A.kind==="keyword"&&g(A)==="forever")m.loopType={type:"literal",value:"forever"},delete m.patient,r.advance();else if(A&&A.kind==="keyword"&&g(A)==="event"){r.advance();let b=r.peek();if(b)for(m.event={type:"literal",value:g(b)},m.loopType={type:"literal",value:"until-event"},delete m.patient;!r.isAtEnd();){let y=r.peek();if(!y||y.kind==="conjunction"||y.kind==="keyword"&&(this.isThenKeyword(y.value,i)||this.isEndKeyword(y.value,i)))break;r.advance();}}let h=m.patient;h&&h.type==="reference"&&h.value==="me"&&delete m.patient;}let p=J(c,m,{sourceLanguage:i,patternId:e.pattern.id,confidence:e.confidence});if(this.registerBoundIdentifiers(p),!Be.has(c)||c==="repeat"){let A=e.pattern.id.includes("verb-first"),g=r.tokens,h=r.position(),b=k=>k.kind==="conjunction"||k.kind==="keyword"&&(this.isThenKeyword(k.value,i)||this.isEndKeyword(k.value,i)),y=-1;for(let k=h-1;k>=0;k--){let x=g[k];if(b(x))break;if((x.normalized??x.value).toLowerCase()===c){y=k;break}}if(y>=0){let k=h;for(;k<g.length&&!b(g[k]);)k++;let x=g.slice(y,k),S=x;if(A){let R=String(a.value??"").toLowerCase(),F=x.findIndex(T=>(T.normalized??T.value).toLowerCase()===R);if(F<0)S=null;else {let T=x[F-1],_=T&&T.kind==="keyword"&&T.normalized?.toLowerCase()==="on"?F-1:F;S=[...x.slice(0,_),...x.slice(F+1)];}}if(S&&S.length>1){let R=oe(i).filter($=>$.command!=="on").sort(($,le)=>le.priority-$.priority),F=this.parseClause(S,R,i),T=F[0],_=$=>$!==null&&typeof $=="object"&&typeof $.type=="string"?$.type:typeof $,P=me(c),W=P?.primaryRole,q=$=>$==="patient"&&W&&W!=="patient"&&!P?.roles.some(le=>le.role==="patient")?W:$,pe=($,le)=>{if(!Be.has(c)||!P)return false;let Ce=P.roles.find(yt=>yt.role===q($));return Ce?Ce.expectedTypes.length>0&&!Ce.expectedTypes.includes(_(le)):true},te=!!T&&T.kind==="command"&&Object.entries(m).every(([$,le])=>{if(pe($,le))return true;let Ce=T.roles.get(q($));return Ce!==void 0&&_(Ce)===_(le)}),de=T?.metadata?.patternId??"",Xe=!Be.has(c)||/^repeat-.*-(times|for-in|while-head|until-head)$/.test(de);if(F.length===1&&T&&T.kind==="command"&&T.action===c&&te&&Xe&&T.roles.size>Object.keys(m).length)for(p=T;r.position()<k;)r.advance();}}}if(!Be.has(c)){let A=p;if(me(c)?.roles.some(S=>S.role==="quantity"&&!S.required)&&!A.roles.has("quantity")){let S=r.peek();S&&/^-?\d+(\.\d+)?$/.test(S.value)&&(p=J(c,{...Object.fromEntries(A.roles),quantity:{type:"literal",value:parseFloat(S.value),dataType:"number"}},A.metadata),r.advance());}let h=p;if(me(c)?.roles.some(S=>S.role==="duration"&&!S.required)&&!h.roles.has("duration")){let S=r.peek();S&&/^\d+(\.\d+)?(ms|s)$/i.test(S.value)&&(p=J(c,{...Object.fromEntries(h.roles),duration:{type:"literal",value:S.value,dataType:"string"}},h.metadata),r.advance(),this.consumeForPostposition(r,i));}let y=p,k=me(c);if(k?.roles.find(S=>S.role==="responseType"&&!S.required)&&!y.roles.has("responseType")){let S=P=>typeof P=="string"&&O.RESPONSE_TYPE_WORDS.has(P.toLowerCase()),R=(P,W)=>{let q=Object.fromEntries(y.roles);W&&delete q.destination,q.responseType={type:"expression",raw:P},p=J(c,q,y.metadata);},F=y.roles.get("destination"),T=k?.roles.find(P=>P.role==="destination"),_=F?.raw??F?.value;if(F&&T&&!T.expectedTypes.includes(F.type)&&S(_))R(_,true);else {let P=r.peek();P&&S(P.value)&&(R(P.value,false),r.advance());}}if(c==="wait"){let S=p;if(!S.roles.has("event")){let R=r.peek();if(R&&Te.has(R.value.toLowerCase())){let F=Object.fromEntries(S.roles),T=F.duration;T&&T.type!=="literal"&&T.type!=="expression"&&delete F.duration;let _=F.patient;_&&_.type==="reference"&&_.value==="me"&&delete F.patient,F.event={type:"literal",value:R.value,dataType:"string"},p=J(c,F,S.metadata),r.advance(),this.consumeForPostposition(r,i);}}}}let d=e.captured.get("continues"),f=d?.type==="literal"&&d.value==="then",E=r.peek(),v=!!E&&this.isThenKeyword(E.value,i),C=Be.has(c)&&!!E&&!this.isEndKeyword(E.value,i),w=!!E&&!this.isEndKeyword(E.value,i);if(f||v||C||w){let A=oe(i).filter(b=>b.command!=="on").sort((b,y)=>y.priority-b.priority),g=oe(i).filter(b=>b.id.startsWith("grammar-")&&b.id.includes("-continuation")).sort((b,y)=>y.priority-b.priority),h=this.parseBodyWithGrammarPatterns(r,A,g,i);h.length>0?s=[p,...h]:s=[p];}else s=[p];}else {let c=oe(i).filter(m=>m.command!=="on").sort((m,p)=>p.priority-m.priority);s=this.parseBodyWithClauses(r,c,i);}return Ie(o,s,n,{sourceLanguage:i,patternId:e.pattern.id,confidence:e.confidence})}parseBodyWithClauses(e,r,i){let a=[],n=[],u=0,o=[];for(;!e.isAtEnd();){let s=e.peek();if(!s)break;if(n.length===0){let f=this.consumeJsBlock(e,i);if(f){a.push(f);continue}let E=this.tryParseConditionalBlock(e,r,i);if(E){a.push(E);continue}}let l=s.kind==="conjunction"||s.kind==="keyword"&&this.isThenKeyword(s.value,i),c=n[n.length-1],m=e.peek(1),p=c?.value.toLowerCase()==="at"&&m?.value.toLowerCase()==="of"||zr(i,s.value,c?.value,m?.value),d=s.kind==="keyword"&&this.isEndKeyword(s.value,i)&&!p;if(d&&u>0){u--,o.pop(),n.push(s),e.advance();continue}if(l&&o.includes("if")){n.push(s),e.advance();continue}if(l){if(n.length>0){let f=this.parseClause(n,r,i);a.push(...f),n.length=0,u=f.filter(E=>{let v=E;return (v.action==="for"||v.action==="repeat"||v.action==="while")&&(!Array.isArray(v.body)||v.body.length===0)}).length,o.length=0;for(let E=0;E<u;E++)o.push("other");}e.advance();continue}if(d){e.advance();let f=[];for(;!e.isAtEnd();){let E=e.peek();if(!E||E.kind==="conjunction"||E.kind==="keyword"&&(this.isThenKeyword(E.value,i)||this.isEndKeyword(E.value,i)))break;f.push(E),e.advance();}if(f.length>0){let E=n.length>0?this.parseClause(n,r,i):[];E.length===0&&n.length>0?a.push(...this.parseClause([...n,...f],r,i)):(a.push(...E),a.push(...this.parseClause(f,r,i)));}else if(n.length>0){let E=this.parseClause(n,r,i);a.push(...E);}n.length=0;break}if(s.kind==="keyword"){let f=(s.normalized??s.value).toLowerCase();(this.isIfKeyword(f,i)||this.isUnlessKeyword(f,i)||f==="while"||f==="for"||f==="repeat")&&(u++,o.push(this.isIfKeyword(f,i)?"if":"other"));}n.push(s),e.advance();}if(n.length>0){let s=this.parseClause(n,r,i);a.push(...s);}this.foldFrontedWhileIntoRepeat(a,i);for(let s=a.length-1;s>=0;s--){let l=a[s];l.kind==="command"&&l.action==="for"&&(!(l.roles instanceof Map)||l.roles.size===0)&&(!Array.isArray(l.body)||l.body.length===0)&&a.splice(s,1);}return a.length>1?[tr(a,"then",{sourceLanguage:i})]:a}foldFrontedWhileIntoRepeat(e,r){for(let i=0;i+1<e.length;i++){let a=e[i],n=e[i+1];if(a.kind!=="command"||a.action!=="while"||n.kind!=="command"||n.action!=="repeat")continue;let u=a.roles.get("condition");if(!u||n.roles.has("condition")||Array.isArray(a.body)||Array.isArray(n.body))continue;let o=new Map(n.roles);o.set("condition",u),o.set("loopType",{type:"literal",value:"while",dataType:"string"}),e.splice(i,2,{...n,roles:o,metadata:{...n.metadata,sourceLanguage:r,patternId:`repeat-${r}-fronted-while-fold`,confidence:Math.max(n.metadata?.confidence??0,a.metadata?.confidence??0)}});}}parseClause(e,r,i){if(e.length===0)return [];let a=null,n=e,u=e[e.length-1];if(u&&e.length>=2){let v=(u.normalized??u.value).toLowerCase();this.isUnlessKeyword(v,i)&&(a="unless",n=e.slice(0,-1));}let o=null;if(a&&n.length>=3){let v=M(i),z=v?O.buildVerbLookup(v):null;if(z)for(let C=1;C<n.length-1;C++){let w=n[C],A=z.get(w.value.toLowerCase())??(w.normalized?z.get(w.normalized.toLowerCase()):void 0);if(A&&!O.CONDITION_OPERATORS.has(A)){o=n.slice(0,C),n=n.slice(C);break}}}let s=new ae(n,i),l=[],c=0,m=[],p=o,d=()=>{if(m.length===0)return;let v=m.slice();if(m.length=0,a&&l.length===0&&p===null){p=v;return}let z=v[0];if(z&&(z.kind==="identifier"||z.kind==="selector"||z.kind==="literal"||z.kind==="reference"))for(let w of this.parseSOVClauseByVerbAnchoring(v,i)){let A=w.action,g=w.roles;A&&me(A)&&g instanceof Map&&g.size>0&&l.push(w);}};for(;!s.isAtEnd();){let v=s.peek(),z=!!v&&v.normalized?.toLowerCase()==="repeat",C=s.mark(),w=re.matchBest(s,r);if(z&&w&&w.pattern.command!=="repeat"){s.reset(C),d(),l.push(J("repeat",{},{sourceLanguage:i,confidence:.6})),c++,s.advance();continue}if(w&&w.pattern.command==="if"){let A=s.mark(),g=m.length;for(s.reset(C);!s.isAtEnd();){let b=s.peek();if(!b||this.isIfKeyword((b.normalized??b.value).toLowerCase(),i))break;m.push(b),s.advance();}let h=this.tryParseConditionalBlock(s,r,i);if(h){d(),l.push(h),c++;continue}m.length=g,s.reset(A);}if(w){d();let A=this.buildCommand(w,i);l.push(A),c++,this.tryAttachTrailingRole(s,A,i);}else {let A=s.peek();A&&A.normalized?.toLowerCase()==="repeat"?(d(),l.push(J("repeat",{},{sourceLanguage:i,confidence:.6})),c++):A&&m.push(A),s.advance();}}d();let f=l;if(c===0){let v=this.parseSOVClauseByVerbAnchoring(n,i);v.length>0&&(f=v);}let E=p;return a&&f.length>0&&E&&E.length>0?[J(a,{condition:{type:"expression",raw:this.joinTokenText(E)}},{sourceLanguage:i,patternId:`${a}-${i}-trailing-guard`,confidence:.85}),...f]:f}tryAttachTrailingRole(e,r,i){let a=me(r.action);if(!a)return;let n=M(i);if(!n)return;let u=r.roles,o=(l,c)=>{if(!l)return false;if(l.kind==="selector")return true;let m=(l.normalized??l.value).toLowerCase();return dn.has(m)?false:m==="body"||m==="it"||m==="you"||m==="result"||m==="document"||m==="window"||this.boundIdentifiers.has(l.value)?true:c?false:l.kind==="identifier"||l.kind==="reference"},s=[{role:"source",strict:false},{role:"destination",strict:true}];for(let{role:l,strict:c}of s){if(!a.roles.some(v=>v.role===l))continue;let m=n.roleMarkers?.[l];if(!m)continue;let p=u.get(l);if(p&&!(p.type==="reference"&&p.value==="me"))continue;let d=v=>{if(!v||v.kind!=="particle"&&v.kind!=="keyword")return false;let z=v.value.toLowerCase();return m.primary?.toLowerCase()===z?true:c?false:(v.normalized??"").toLowerCase()===l?true:!!m.alternatives?.some(C=>C.toLowerCase()===z)},f=e.peek(),E=e.peek(1);if(!f||!E)return;if(c&&m.position==="after"){let v=e.peek(2),z=(f.normalized??f.value).toLowerCase();if(fn.has(z)&&E.kind==="selector"&&d(v)){u.set(l,{type:"expression",raw:`${z} ${E.value}`}),e.advance(),e.advance(),e.advance();return}}if(m.position==="after"){if(o(f,c)&&d(E)){let v=this.tokenToSemanticValue(f);e.advance(),e.advance(),v&&u.set(l,v);return}}else if(d(f)&&o(E,c)){e.advance();let v=this.tokenToSemanticValue(e.advance());v&&u.set(l,v);return}}}static buildVerbLookup(e){let r=new Map;for(let[i,a]of Object.entries(e.keywords))if(!["on","if","else","when","where","while","end","then","and"].includes(i)&&(r.set(a.primary.toLowerCase(),i),a.alternatives))for(let n of a.alternatives)r.set(n.toLowerCase(),i);return r}static buildMarkerToRoleLookup(e){let r=new Map;for(let[i,a]of Object.entries(e.roleMarkers)){if(!a)continue;if((i!=="event"||!r.has(a.primary))&&r.set(a.primary,i),a.alternatives)for(let u of a.alternatives)r.has(u)||r.set(u,i);}return r}parseSOVClauseByVerbAnchoring(e,r){let i=M(r);if(!i||i.wordOrder!=="SOV")return [];let a=O.buildVerbLookup(i),n=O.buildMarkerToRoleLookup(i),u=[],o=0;for(;o<e.length;){let s=-1,l="";for(let f=o;f<e.length;f++){let E=e[f];if(n.has(E.value))continue;let v=a.get(E.value.toLowerCase()),z=E.normalized?a.get(E.normalized.toLowerCase()):void 0,C=v||z;if(C){s=f,l=C;break}}if(s===-1)break;let c=e.slice(o,s),m=e.length;for(let f=s+1;f<e.length;f++){let E=e[f];if(E.kind==="conjunction"||this.isThenKeyword(E.value,r)){m=f;break}if(f>s+1&&!n.has(E.value)&&(a.get(E.value.toLowerCase())||(E.normalized?a.get(E.normalized.toLowerCase()):void 0))){m=f;break}}let p=e.slice(s+1,m),d=this.extractRolesFromMarkedTokens(c,p,n,l,r);if(u.push(J(l,d,{sourceLanguage:r,confidence:.7})),o=m,o<e.length){let f=e[o];(f.kind==="conjunction"||this.isThenKeyword(f.value,r))&&o++;}}return u}extractRolesFromMarkedTokens(e,r,i,a,n){let u={},o=s=>{let l=[];for(let c of s){let m=i.get(c.value);if(m&&c.kind==="particle"&&l.length>0){let p=this.tokensToSemanticValue(l);if(p){let d=this.mapRoleForCommand(m,a,u);d&&(u[d]=p);}l=[];}else l.push(c);}if(l.length>0)if(l.length===1&&/^\d+(\.\d+)?(ms|s)$/i.test(l[0].value)&&!u.duration&&me(a)?.roles.some(m=>m.role==="duration"))u.duration={type:"literal",value:l[0].value,dataType:"string"};else {let m=this.tokensToSemanticValue(l);m&&(u.patient?u.destination||(u.destination=m):u.patient=m);}};return o(e),o(r),u}mapRoleForCommand(e,r,i){return i[e]?e==="patient"&&!i.destination?"destination":e==="destination"&&!i.patient?"patient":e==="source"&&!i.source?"source":null:e}tokensToSemanticValue(e){if(e.length===0)return null;let r=e.filter(n=>n.kind!=="whitespace");if(r.length===0)return null;if(r.length===1)return this.tokenToSemanticValue(r[0]);let i=r.map(n=>n.value).join(""),a=r[0];return a.kind==="selector"||a.value.startsWith("#")||a.value.startsWith(".")||a.value.startsWith("@")||a.value.startsWith("*")?ve(i):a.kind==="literal"||a.value.startsWith('"')||a.value.startsWith("'")?I(Sr(i),"string"):a.kind==="reference"?ne(i):I(i)}tokenToSemanticValue(e){let r=e.value;if(e.kind==="selector"||r.startsWith("#")||r.startsWith(".")||r.startsWith("@")||r.startsWith("*"))return ve(r);if(r.startsWith('"')||r.startsWith("'"))return I(Sr(r),"string");if(/^-?\d+(\.\d+)?$/.test(r))return I(parseFloat(r));if(r==="true"||r==="\u771F"||r==="\uCC38"||r==="do\u011Fru")return I(true);if(r==="false"||r==="\u507D"||r==="\uAC70\uC9D3"||r==="yanl\u0131\u015F")return I(false);let i=e.normalized?.toLowerCase();return i==="me"||i==="it"||i==="you"||i==="result"||i==="body"?ne(i):e.kind==="reference"?ne(e.normalized||"me"):I(r)}parseBodyWithGrammarPatterns(e,r,i,a){let n=[],u=[],o=false,s=()=>{!o&&u.length>0&&n.push(...this.parseSOVClauseByVerbAnchoring(u,a)),u=[],o=false;},l=0,c=()=>{let m=0;for(let p of n){let d=p;(d.action==="for"||d.action==="repeat"||d.action==="while")&&(!Array.isArray(d.body)||d.body.length===0)&&m++;}return m-l};for(;!e.isAtEnd();){let m=e.peek();if(m&&this.isThenKeyword(m.value,a)){s(),e.advance();continue}if(m&&this.isEndKeyword(m.value,a)){let d=e.peek(-1),f=e.peek(1);if(!zr(a,m.value,d?.value,f?.value)){if(s(),c()>0){l++,e.advance();continue}e.advance();break}}if(m&&!o&&this.isIfKeyword((m.normalized??m.value).toLowerCase(),a)){s();let d=this.tryParseConditionalBlock(e,r,a);if(d){n.push(d),o=true;continue}}let p=false;if(i.length>0){let d=re.matchBest(e,i);if(d){let f=d.pattern.command,E={};for(let[C,w]of d.captured)C!=="event"&&C!=="action"&&C!=="continues"&&(E[C]=w);let v=J(f,E,{sourceLanguage:a,patternId:d.pattern.id});n.push(v),p=true,o=true;let z=d.captured.get("continues");if(z&&z.type==="literal"&&z.value==="then")continue}}if(!p){let d=e.mark(),f=re.matchBest(e,r);if(f){if(f.pattern.command==="if"){let v=e.mark();for(e.reset(d);!e.isAtEnd();){let C=e.peek();if(!C||this.isIfKeyword((C.normalized??C.value).toLowerCase(),a))break;e.advance();}let z=this.tryParseConditionalBlock(e,r,a);if(z){s(),n.push(z),o=true;continue}e.reset(v);}let E=this.buildCommand(f,a);n.push(E),this.tryAttachTrailingRole(e,E,a),p=true,o=true;}}p||(m&&u.push(m),e.advance());}s();for(let m=n.length-1;m>=0;m--){let p=n[m];p.kind==="command"&&p.action==="for"&&(!(p.roles instanceof Map)||p.roles.size===0)&&(!Array.isArray(p.body)||p.body.length===0)&&n.splice(m,1);}return n}tryCompoundCommandParsing(e,r,i){let a=e.tokens,n=a.some(l=>l.kind==="conjunction"||l.kind==="keyword"&&this.isThenKeyword(l.value,i)),u=a.some(l=>this.isElseKeyword(l.value,i));if(!n&&!u)return null;let o=new ae(a,i),s=this.parseBodyWithClauses(o,r,i);return s.length===0?null:s.length===1?s[0]:tr(s,"then",{sourceLanguage:i,confidence:.65})}matchEventMarkerPhrase(e,r,i){let a=O.SOV_EVENT_MARKER_PHRASES[i];if(!a)return 0;for(let n of a)if(n.every((u,o)=>e[r+o]?.value===u))return n.length;return 0}hasSOVEventMarkerHead(e,r){let i=O.SOV_EVENT_MARKERS[r];if(i===void 0)return false;let{tokens:a}=Y(e,r),n=Fe[r],u=new Set;if(n)for(let o of Object.keys(n))u.add(o.toLowerCase());for(let o=0;o<a.length;o++){let s=a[o],l=s.value.toLowerCase(),c=s.normalized?.toLowerCase();if(!(!!c&&(O.KNOWN_EVENTS.has(c)||Te.has(c))||O.KNOWN_EVENTS.has(l)||Te.has(l)||u.has(l)))continue;let p=this.matchEventParamPhrase(a,o+1).len,d=a[o+1+p];if(d&&(d.kind==="particle"||d.kind==="keyword")&&i.has(d.value)||this.matchEventMarkerPhrase(a,o+1+p,r)>0)return true}return false}matchEventParamPhrase(e,r){if(e[r]?.value!=="(")return {len:0,names:[]};let i=[];for(let a=r+1;a<e.length;a++){let n=e[a].value;if(n===")")return {len:a-r+1,names:i};if(n!==","){if(e[a].kind!=="identifier")break;i.push(n);}}return {len:0,names:[]}}isStrippableSourceRef(e,r){if(!e)return false;let i=e.normalized?.toLowerCase();if(e.kind==="keyword"&&(i==="me"||i==="i"||i==="it"))return true;let a=e.value.toLowerCase();return r.has(a)||!!i&&r.has(i)}tryTrailingEventExtraction(e,r,i){let a=Y(e,r).tokens;if(a.length<3)return null;let n=Fe[r],u=new Set;if(n)for(let w of Object.keys(n))u.add(w.toLowerCase());let o=a.length-2,s=a[o];if(!(s.kind==="keyword"&&s.normalized?.toLowerCase()==="on"))return null;let c=a[a.length-1],m=c.value.toLowerCase(),p=c.normalized?.toLowerCase();if(!(!!p&&O.KNOWN_EVENTS.has(p)||O.KNOWN_EVENTS.has(m)||u.has(m)))return null;let f=p&&O.KNOWN_EVENTS.has(p)?p:n?.[m]??m,E=a.slice(0,o);if(E.length===0)return null;let v=i.filter(w=>w.command!=="on"),z=new ae(E,r),C=this.parseBodyWithClauses(z,v,r);return C.length===0?null:Ie({type:"literal",value:f},C,void 0,{sourceLanguage:r,confidence:.75})}tryMidStreamEventExtraction(e,r,i){let a=Y(e,r).tokens;if(a.length<3)return null;let n=Fe[r],u=new Set;if(n)for(let o of Object.keys(n))u.add(o.toLowerCase());for(let o=0;o<a.length-1;o++){let s=a[o];if(!(s.kind==="keyword"&&s.normalized?.toLowerCase()==="on"))continue;let c=a[o+1],m=c.value.toLowerCase(),p=c.normalized?.toLowerCase();if(!(!!p&&O.KNOWN_EVENTS.has(p)||O.KNOWN_EVENTS.has(m)||u.has(m)))continue;let f=p&&O.KNOWN_EVENTS.has(p)?p:n?.[m]??m,E=a.filter((w,A)=>A!==o&&A!==o+1);if(E.length===0)return null;let v=i.filter(w=>w.command!=="on"),z=new ae(E,r),C=this.parseBodyWithClauses(z,v,r);return C.length===0?null:Ie({type:"literal",value:f},C,void 0,{sourceLanguage:r,confidence:.75})}return null}trySOVEventExtraction(e,r,i){let a=O.SOV_EVENT_MARKERS[r];if(!a)return null;let u=Y(e,r).tokens,o=Fe[r],s=new Set;if(o)for(let g of Object.keys(o))s.add(g.toLowerCase());let l=O.SOV_SOURCE_MARKERS[r],c=-1,m="",p="",d=1,f=[];for(let g=0;g<u.length;g++){let h=u[g],b=h.value.toLowerCase(),y=b,k="",x=b.indexOf("[");x>0&&(y=b.slice(0,x),k=h.value.slice(x));let S=h.normalized?.toLowerCase(),R=S&&(O.KNOWN_EVENTS.has(S)||Te.has(S)),F=s.has(b)||s.has(y),T=O.KNOWN_EVENTS.has(y)||Te.has(y);if(R||F||T){let _=u[g-1];if(_&&(_.normalized??_.value).toLowerCase()==="event")continue;let P;R?P=S:F?P=o?.[b]??o?.[y]??y:P=y;let W=this.matchEventParamPhrase(u,g+1);if(a.size>0){let q=1+W.len,pe=u[g+q];pe&&pe.kind==="selector"&&pe.value.startsWith("[")&&(q+=1);let te=u[g+q];if(te&&(te.kind==="particle"||te.kind==="keyword")&&a.has(te.value)){c=g,m=P,p=k||(q===W.len+2?u[g+q-1].value:""),d=q+1,f=W.names;break}}else {c=g,m=P,p=k,d=1+W.len+this.matchEventMarkerPhrase(u,g+1+W.len,r),f=W.names;break}}}if(c===-1){let g=new Set(i.filter(h=>h.command!=="on").map(h=>h.command));for(let h=0;h<u.length;h++){let b=u[h];if(b.kind==="identifier")if(a.size>0){let y=1,k=u[h+1];k&&k.kind==="selector"&&k.value.startsWith("[")&&(y=2);let x=u[h+y];if(x&&(x.kind==="particle"||x.kind==="keyword")&&a.has(x.value)){c=h,m=b.value,p=y===2?u[h+1].value:"",d=y+1;break}}else {let y=this.matchEventMarkerPhrase(u,h+1,r);if(y>0){c=h,m=b.value,p="",d=1+y;break}let k=u[h+1];if(k&&k.kind==="keyword"&&k.normalized!=null&&g.has(k.normalized)){c=h,m=b.value,p="",d=1;break}}}}if(c===-1)return null;let E=new Set;for(let g=c;g<c+d;g++)E.add(g);if(l){let g=c+d;if(g<u.length){let h=u[g];if((h.kind==="particle"||h.kind==="keyword")&&l.markers.has(h.value))E.add(g);else if(this.isStrippableSourceRef(h,l.windowTokens)){let b=u[g+1];b&&(b.kind==="particle"||b.kind==="keyword")&&l.markers.has(b.value)&&(E.add(g),E.add(g+1));}}if(c>=2){let h=u[c-1];(h.kind==="particle"||h.kind==="keyword")&&l.markers.has(h.value)&&this.isStrippableSourceRef(u[c-2],l.windowTokens)&&(E.add(c-2),E.add(c-1));}for(let h=0;h<c;h++){let b=u[h],y=b.value.toLowerCase(),k=b.normalized?.toLowerCase();if(l.windowTokens.has(y)||k&&l.windowTokens.has(k)){E.add(h);break}}}let v=u.filter((g,h)=>!E.has(h));if(v.length===0)return null;let z=i.filter(g=>g.command!=="on"),C=new ae(v,r),w=this.parseBodyWithClauses(C,z,r);if(w.length===0)return null;let A={sourceLanguage:r,confidence:.75};return p&&(A.keyFilter=p),Ie({type:"literal",value:m},w,void 0,A,f)}profileKeywordMatches(e,r,i){let a=M(e)?.keywords?.[r];return a?a.primary?.toLowerCase()===i?true:!!a.alternatives?.some(n=>n.toLowerCase()===i):false}consumeForPostposition(e,r){let i=e.peek();if(!i)return;let a=(i.normalized??"").toLowerCase(),n=M(r)?.keywords?.for;(a==="for"||i.value===n?.primary||(n?.alternatives??[]).includes(i.value))&&e.advance();}isThenKeyword(e,r){let i=e.toLowerCase(),n={en:new Set(["then"]),ja:new Set(["\u305D\u308C\u304B\u3089","\u6B21\u306B","\u305D\u3057\u3066"]),ar:new Set(["\u062B\u0645","\u0628\u0639\u062F\u0647\u0627","\u062B\u0645\u0651"]),es:new Set(["entonces","luego","despu\xE9s"]),ko:new Set(["\uADF8\uB2E4\uC74C","\uADF8\uB9AC\uACE0","\uADF8\uB7F0\uD6C4","\uADF8\uB7EC\uBA74"]),zh:new Set(["\u7136\u540E","\u63A5\u7740","\u90A3\u4E48"]),tr:new Set(["ard\u0131ndan","daha sonra","ardindan"]),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"]),qu:new Set(["chaymantataq","hinaspa","chaymanta","chayqa"]),sw:new Set(["kisha","halafu","baadaye"])}[r];return n?n.has(i):i==="then"||this.profileKeywordMatches(r,"then",i)}isElseKeyword(e,r){let i=e.toLowerCase();return i==="else"?true:this.profileKeywordMatches(r,"else",i)}isEndKeyword(e,r){let i=e.toLowerCase(),n={en:new Set(["end"]),ja:new Set(["\u7D42\u308F\u308A","\u304A\u308F\u308A"]),ar:new Set(["\u0646\u0647\u0627\u064A\u0629","\u0627\u0646\u062A\u0647\u0649","\u0627\u0644\u0646\u0647\u0627\u064A\u0629"]),es:new Set(["fin","final","terminar"]),ko:new Set(["\uB05D","\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","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"])}[r];return n?i==="end"||n.has(i):i==="end"||this.profileKeywordMatches(r,"end",i)}isJsKeyword(e){let r=(e.normalized??e.value).toLowerCase();return r==="js"||this.profileKeywordMatches("en","js",r)}consumeJsBlock(e,r){let i=e.peek();if(!i||!this.isJsKeyword(i))return null;let a=e.mark(),n=[];e.advance();let u=false;for(;!e.isAtEnd();){let s=e.peek();if(!s)break;if(e.advance(),this.isEndKeyword(s.value,r)){u=true;break}n.push(s);}if(!u)return e.reset(a),null;let o=n.map(s=>s.value).join(" ").trim();return J("js",{patient:{type:"expression",raw:o||"()"}},{sourceLanguage:r,patternId:`js-opaque-${r}`,confidence:1})}isIfKeyword(e,r){let i=e.toLowerCase();return i==="if"?true:this.profileKeywordMatches(r,"if",i)}isUnlessKeyword(e,r){let i=e.toLowerCase();return i==="unless"?true:this.profileKeywordMatches(r,"unless",i)}isBlockEndToken(e,r,i){return this.isEndKeyword(e.value,i)?true:e.kind!=="keyword"||(e.normalized??"").toLowerCase()!=="end"?false:!(r&&r.kind==="selector")}tryParseConditionalBlock(e,r,i){let a=e.peek();if(!a)return null;let n=(a.normalized??a.value).toLowerCase();if(!this.isIfKeyword(n,i))return null;let u=e.mark();e.advance();let o=[],s=0;for(;!e.isAtEnd();){let h=e.peek();if(!h)break;let b=(h.normalized??h.value).toLowerCase();if(this.isIfKeyword(b,i)||this.isUnlessKeyword(b,i)){s++,o.push(h),e.advance();continue}if(this.isBlockEndToken(h,e.peek(1)??void 0,i)){if(s===0){e.advance();break}s--,o.push(h),e.advance();continue}o.push(h),e.advance();}if(o.length===0)return e.reset(u),null;let l=M(i),c=l?.wordOrder==="SOV"?O.buildVerbLookup(l):null,m=0,p=0,d=[];for(;m<o.length;m++){let h=o[m],b=(h.normalized??h.value).toLowerCase();if(this.isIfKeyword(b,i)||this.isUnlessKeyword(b,i)?p++:this.isBlockEndToken(h,o[m+1],i)&&p--,p===0&&this.isThenKeyword(h.value,i)){m++;break}if(p===0&&d.length>0){let y=(o[m-1].normalized??o[m-1].value).toLowerCase(),k=o[m-1].value.toLowerCase(),x=(h.normalized??h.value).toLowerCase(),S=O.CONDITION_COPULAS.has(y)||O.CONDITION_COPULAS_SURFACE.has(k)&&O.CONDITION_PREDICATES.has(x),R=c!==null&&c.has(h.value.toLowerCase())&&!O.CONDITION_PREDICATES.has(x);if(!O.CONDITION_OPERATORS.has(x)&&(!S||R)&&(this.tokensBeginCommand(o.slice(m),r,i)||this.sovCommandStartsAt(o.slice(m),c)))break}d.push(h);}if(d.length===0)return e.reset(u),null;let E=[],v=[],z=false,C=0;for(;m<o.length;m++){let h=o[m],b=(h.normalized??h.value).toLowerCase();if(this.isIfKeyword(b,i)||this.isUnlessKeyword(b,i)?C++:this.isBlockEndToken(h,o[m+1],i)&&C--,C===0&&!z&&this.isElseKeyword(h.value,i)){z=true;continue}(z?v:E).push(h);}let w={type:"expression",raw:this.joinTokenText(d)},A=this.parseBranch(E,r,i),g=v.length>0?this.parseBranch(v,r,i):void 0;return A.length===0&&(!g||g.length===0)?(e.reset(u),null):xi(w,A,g,{sourceLanguage:i,patternId:`conditional-${i}-folded`,confidence:1})}joinTokenText(e){return e.map(r=>r.kind==="keyword"?r.normalized??r.value:r.value).join(" ").trim()}tokensBeginCommand(e,r,i){if(e.length===0)return false;let a=new ae(e,i);return re.matchBest(a,r)!==null}sovCommandStartsAt(e,r){if(!r)return false;let i=o=>r.has(o.value.toLowerCase())||!!o.normalized&&r.has(o.normalized.toLowerCase()),a=o=>o.kind==="identifier"||o.kind==="selector"||o.kind==="literal"||o.kind==="reference",n=0,u=0;for(;n+1<e.length;){let o=e[n],s=e[n+1];if(!a(o)||s.kind!=="particle")break;u+=1,n+=2;let l=e[n];if(u>=1&&l&&i(l))return true}return false}parseBranch(e,r,i){if(e.length===0)return [];let a=new ae(e,i),n=this.parseBodyWithClauses(a,r,i);return n.length===1&&n[0]?.kind==="compound"?n[0].statements:n}extractStandaloneModifiers(e,r){let a=Y(e,r).tokens;if(a.length===0)return {modifiers:null,remainingInput:null};let u=a[0].value.toLowerCase(),o=O.STANDALONE_MODIFIERS[u];if(!o)return {modifiers:null,remainingInput:null};let s={},l=1;if(o==="once")s.once=true;else {let d=1;if(d<a.length){let f=a[d];(f.kind==="keyword"||f.kind==="particle")&&(d++,l++);}if(d<a.length){let f=a[d];if(f.kind==="literal"){let E=f.value.match(/^(\d+)(ms|s|m)?$/);if(E){let v=parseInt(E[1],10),z=E[2]||"ms";z==="s"?v*=1e3:z==="m"&&(v*=6e4),s[o]=v,l=d+1;}}}s[o]||(s[o]=o==="debounce"?300:100);}let c=a.slice(l);if(c.length===0)return {modifiers:null,remainingInput:null};let m=c[0].position.start,p=e.slice(m);return {modifiers:s,remainingInput:p}}stripAsyncModifier(e,r){let i=M(r)?.keywords?.async,a=new Set(["async"]);i?.primary&&a.add(i.primary.toLowerCase()),i?.alternatives?.forEach(l=>a.add(l.toLowerCase()));let n=Y(e,r).tokens,u=n.findIndex(l=>a.has(l.value.toLowerCase()));if(u===-1)return {remainingInput:null};let o=n[u],s=(e.slice(0,o.position.start)+e.slice(o.position.end)).replace(/\s{2,}/g," ").trim();return s.length===0?{remainingInput:null}:{remainingInput:s}}stripDoNotThrowModifier(e,r){let i=Y(e,r).tokens;for(let a=0;a<i.length-1;a++){if(i[a].value.toLowerCase()!=="do")continue;let n=-1;for(let l=a+1;l<=a+5&&l<i.length;l++){let c=i[l];if(c.normalized?.toLowerCase()==="throw"){n=l;break}let m=c.kind;if(m==="selector"||m==="literal"||m==="reference"||m==="conjunction")break}if(n===-1)continue;let u=i[a].position.start,o=i[n].position.end,s=(e.slice(0,u)+e.slice(o)).replace(/\s{2,}/g," ").trim();return s.length===0?{remainingInput:null}:{remainingInput:s}}return {remainingInput:null}}applyModifiers(e,r){return {...e,eventModifiers:{...e.eventModifiers,...r}}}extractOrConjunctionEvents(e,r){let i=[];for(;;){let a=e.mark(),n=e.peek();if(!n)break;let u=(n.normalized||n.value).toLowerCase();if(!O.OR_KEYWORDS.has(u)){e.reset(a);break}e.advance();let o=e.peek();if(!o){e.reset(a);break}let s=(o.normalized||o.value).toLowerCase();e.advance(),i.push({type:"literal",value:s});}return i}};ee.KNOWN_EVENTS=new Set(["click","dblclick","input","change","submit","keydown","keyup","keypress","mouseover","mouseout","mousedown","mouseup","focus","blur","load","scroll","resize","contextmenu"]);ee.RESPONSE_TYPE_WORDS=new Set(["json","text","html","xml","blob","arraybuffer","formdata","response"]);ee.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"]),hi:new Set(["\u092A\u0930"])};ee.SOV_EVENT_MARKER_PHRASES={ko:[["\uD560","\uB54C"],["\uD560\uB54C"]]};ee.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"])},hi:{markers:new Set(["\u0938\u0947"]),windowTokens:new Set(["\u0935\u093F\u0902\u0921\u094B","\u0926\u0938\u094D\u0924\u093E\u0935\u0947\u091C\u093C","window","document"])}};ee.CONDITION_COPULAS=new Set(["is","am","are","be","was","were","not","no"]);ee.CONDITION_COPULAS_SURFACE=new Set(["est","\u0435\u0441\u0442\u044C","\u0454","\xE9","ay","\u0647\u0648","adalah","\u0E40\u0E1B\u0E47\u0E19","\u09B9\u09AF\u09BC","\u0939\u0948","dir","kanqa"]);ee.CONDITION_PREDICATES=new Set(["empty","null","undefined"]);ee.CONDITION_OPERATORS=new Set(["matches","match","contains","exists","has","have","equals","includes"]);ee.STANDALONE_MODIFIERS={once:"once",debounced:"debounce",debounce:"debounce",throttled:"throttle",throttle:"throttle"};ee.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","\u092F\u093E","\u0985\u09A5\u09AC\u09BE"]);var vn=ee,hn=new vn;function En(t,e){return hn.parse(t,e)}function zn(t,e){try{let r=Y(t,e),i=oe(e);if(i.length===0)return {confidence:0,parseSuccess:!1,error:`No patterns available for language: ${e}`};let a=[...i].sort((l,c)=>c.priority-l.priority),n=a.filter(l=>l.command==="on"),u=re.matchBest(r,n);if(u)return {confidence:u.confidence,parseSuccess:!0,patternId:u.pattern.id,action:u.pattern.command,tokensConsumed:u.consumedTokens};r.reset(r.mark());let o=a.filter(l=>l.command!=="on"),s=re.matchBest(r,o);return s?{confidence:s.confidence,parseSuccess:!0,patternId:s.pattern.id,action:s.pattern.command,tokensConsumed:s.consumedTokens}:{confidence:0,parseSuccess:!1,error:`Could not match any patterns for: ${t}`}}catch(r){return {confidence:0,parseSuccess:false,error:r instanceof Error?r.message:String(r)}}}function Gr(t,e){try{let i=En(t,e);if(i)return {node:i,confidence:i.metadata?.confidence??.8,error:void 0,tokensConsumed:Y(t,e).tokens.length}}catch{}let r=zn(t,e);return r.parseSuccess?{node:null,confidence:r.confidence,error:void 0,tokensConsumed:r.tokensConsumed}:{node:null,confidence:0,error:r.error}}function Yr(t,e){let r=e==="SOV"?"sovPosition":"svoPosition";return [...t].sort((i,a)=>{let n=i[r]??99,u=a[r]??99;return n-u})}function gn(t,e){let r=t.markerOverride?.[e.code],i=e.roleMarkers[t.role];if(r!==void 0)return {primary:r,position:i?.position??"before",isOverride:true};if(i&&i.primary){let a={primary:i.primary,position:i.position,isOverride:false};return i.alternatives&&(a.alternatives=i.alternatives),a}return null}function He(t,e){let r,i;if(t.markerOverride&&t.markerOverride[e.code]!==void 0)r=t.markerOverride[e.code];else {let n=e.roleMarkers[t.role];n&&(r=n.primary,i=n.alternatives?[...n.alternatives]:void 0);}let a=t.markerVariants?.[e.code];if(a&&a.length>0){let n=i?[...i]:[];for(let u of a)u!==r&&!n.includes(u)&&n.push(u);i=n;}return {marker:r,alternatives:i}}function Ve(t,e,r){r.roles.find(a=>a.role==="scope"&&!a.required)&&(t.push({type:"group",optional:true,tokens:[{type:"literal",value:"on"},{type:"role",role:"scope",optional:true,expectedTypes:["selector","reference"]}]}),e.scope={fromRole:"scope"});}function kn(t,e,r,i,a){let n=[];if(n.push({type:"role",role:"event",optional:false}),i.position==="after"){let l=i.primary.split(/\s+/);if(l.length>1)for(let c of l)n.push({type:"literal",value:c});else {let c=i.alternatives?{type:"literal",value:i.primary,alternatives:i.alternatives}:{type:"literal",value:i.primary};n.push(c);}}let u=e.roleMarkers.destination;u&&n.push({type:"group",optional:true,tokens:[{type:"role",role:"destination",optional:true},u.alternatives?{type:"literal",value:u.primary,alternatives:u.alternatives}:{type:"literal",value:u.primary}]}),n.push({type:"role",role:"patient",optional:false});let o=e.roleMarkers.patient;if(o){let l=o.alternatives?{type:"literal",value:o.primary,alternatives:o.alternatives}:{type:"literal",value:o.primary};n.push(l);}let s=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};return n.push(s),n.push(...ke(t,e.roleMarkers.source)),n.push(...ur(t,e.roleMarkers.destination)),{id:`${t.action}-event-${e.code}-sov`,language:e.code,command:"on",priority:(a.basePriority??100)+50,template:{format:`{event} ${i.primary} {destination?} {patient} ${o?.primary||""} ${r.primary}`,tokens:n},extraction:{action:{value:t.action},event:{fromRole:"event"},patient:{fromRole:"patient"},...ze(t),...ge(t)}}}function Cn(t,e,r,i,a){let n=[];n.push({type:"role",role:"patient",optional:false});let u=e.roleMarkers.patient;if(u){let s=u.alternatives?{type:"literal",value:u.primary,alternatives:u.alternatives}:{type:"literal",value:u.primary};n.push(s);}if(n.push({type:"role",role:"event",optional:false}),i.position==="after"){let s=i.primary.split(/\s+/);if(s.length>1)for(let l of s)n.push({type:"literal",value:l});else {let l=i.alternatives?{type:"literal",value:i.primary,alternatives:i.alternatives}:{type:"literal",value:i.primary};n.push(l);}}let o=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};return n.push(o),n.push(...ke(t,e.roleMarkers.source)),n.push(...ur(t,e.roleMarkers.destination)),{id:`${t.action}-event-${e.code}-sov-patient-first`,language:e.code,command:"on",priority:(a.basePriority??100)+45,template:{format:`{patient} ${u?.primary||""} {event} ${i.primary} ${r.primary}`,tokens:n},extraction:{action:{value:t.action},event:{fromRole:"event"},patient:{fromRole:"patient"},...ze(t),...ge(t)}}}function bn(t,e,r,i,a){let n=[];n.push({type:"role",role:"patient",optional:false});let u=e.roleMarkers.patient;if(u){let l=u.alternatives?{type:"literal",value:u.primary,alternatives:u.alternatives}:{type:"literal",value:u.primary};n.push(l);}let o=e.roleMarkers.destination;if(o&&(n.push({type:"role",role:"destination",optional:false}),n.push(o.alternatives?{type:"literal",value:o.primary,alternatives:o.alternatives}:{type:"literal",value:o.primary})),n.push({type:"role",role:"event",optional:false}),i.position==="after"){let l=i.primary.split(/\s+/);if(l.length>1)for(let c of l)n.push({type:"literal",value:c});else {let c=i.alternatives?{type:"literal",value:i.primary,alternatives:i.alternatives}:{type:"literal",value:i.primary};n.push(c);}}let s=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};return n.push(s),{id:`${t.action}-event-${e.code}-sov-patient-first-dest`,language:e.code,command:"on",priority:(a.basePriority??100)+40,template:{format:`{patient} ${u?.primary||""} {destination} ${o?.primary||""} {event} ${i.primary} ${r.primary}`,tokens:n},extraction:{action:{value:t.action},event:{fromRole:"event"},patient:{fromRole:"patient"},destination:{fromRole:"destination"}}}}function wn(t,e,r,i,a){let n=[];n.push({type:"role",role:"event",optional:false});let u=i.alternatives?.filter(c=>!c.includes(" ")&&c.length>1)||[];u.length>0&&n.push({type:"literal",value:u[0],alternatives:u.slice(1)});let o=e.roleMarkers.destination;o&&n.push({type:"group",optional:true,tokens:[{type:"role",role:"destination",optional:true},o.alternatives?{type:"literal",value:o.primary,alternatives:o.alternatives}:{type:"literal",value:o.primary}]}),n.push({type:"role",role:"patient",optional:false});let s=e.roleMarkers.patient;if(s){let c=s.alternatives?{type:"literal",value:s.primary,alternatives:s.alternatives}:{type:"literal",value:s.primary};n.push(c);}let l=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};return n.push(l),n.push(...ke(t,e.roleMarkers.source)),n.push(...ur(t,e.roleMarkers.destination)),{id:`${t.action}-event-${e.code}-sov-compact`,language:e.code,command:"on",priority:(a.basePriority??100)+52,template:{format:`{event}${u[0]||""} {patient} ${r.primary}`,tokens:n},extraction:{action:{value:t.action},event:{fromRole:"event"},patient:{fromRole:"patient"},...ze(t),...ge(t)}}}function An(t,e,r,i,a){let n=[];if(n.push({type:"role",role:"event",optional:false}),i.position==="after"){let o=i.primary.split(/\s+/);if(o.length>1)for(let s of o)n.push({type:"literal",value:s});else {let s=i.alternatives?{type:"literal",value:i.primary,alternatives:i.alternatives}:{type:"literal",value:i.primary};n.push(s);}}let u=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};return n.push(u),{id:`${t.action}-event-${e.code}-sov-simple`,language:e.code,command:"on",priority:(a.basePriority??100)+48,template:{format:`{event} ${i.primary} ${r.primary}`,tokens:n},extraction:{action:{value:t.action},event:{fromRole:"event"},patient:{default:{type:"reference",value:"me"}}}}}function Dn(t,e,r,i){let a=e.eventHandler?.temporalMarkers;if(!a||a.length===0)return null;let n=[];n.push({type:"role",role:"event",optional:false}),e.possessive?.marker&&n.push({type:"group",optional:true,tokens:[{type:"literal",value:e.possessive.marker}]}),n.push({type:"literal",value:a[0],alternatives:a.slice(1)}),n.push({type:"role",role:"patient",optional:false});let u=e.roleMarkers.patient;if(u?.primary){let s=u.alternatives?{type:"literal",value:u.primary,alternatives:u.alternatives}:{type:"literal",value:u.primary};n.push(s);}let o=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};return n.push(o),{id:`${t.action}-event-${e.code}-sov-temporal`,language:e.code,command:"on",priority:(i.basePriority??100)+49,template:{format:`{event} ${a[0]} {patient} ${r.primary}`,tokens:n},extraction:{action:{value:t.action},event:{fromRole:"event"},patient:{fromRole:"patient"}}}}function Sn(t,e,r,i,a){let n=[];if(n.push({type:"role",role:"event",optional:false}),i.position==="after"){let m=i.primary.split(/\s+/);if(m.length>1)for(let p of m)n.push({type:"literal",value:p});else {let p=i.alternatives?{type:"literal",value:i.primary,alternatives:i.alternatives}:{type:"literal",value:i.primary};n.push(p);}}let o=[...t.roles.filter(m=>m.required)].sort((m,p)=>{let d=m.sovPosition??999,f=p.sovPosition??999;return d-f});for(let m of o){n.push({type:"role",role:m.role,optional:false});let{marker:p,alternatives:d}=He(m,e);if(p){let f=d?{type:"literal",value:p,alternatives:d}:{type:"literal",value:p};n.push(f);}}let s=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};n.push(s);let l=o.map(m=>`{${m.role}}`).join(" "),c={action:{value:t.action},event:{fromRole:"event"},...Object.fromEntries(o.map(m=>[m.role,{fromRole:m.role}]))};return Ve(n,c,t),{id:`${t.action}-event-${e.code}-sov-2role`,language:e.code,command:"on",priority:(a.basePriority??100)+55,template:{format:`{event} ${i.primary} ${l} ${r.primary}`,tokens:n},extraction:c}}function xn(t,e,r,i,a){let n=[],o=[...t.roles.filter(c=>c.required)].sort((c,m)=>{let p=c.sovPosition??999,d=m.sovPosition??999;return p-d});for(let c of o){n.push({type:"role",role:c.role,optional:false});let{marker:m,alternatives:p}=He(c,e);m&&n.push(p?{type:"literal",value:m,alternatives:p}:{type:"literal",value:m});}if(n.push(r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary}),n.push({type:"role",role:"event",optional:false}),i.position==="after"){let c=i.primary.split(/\s+/);if(c.length>1)for(let m of c)n.push({type:"literal",value:m});else n.push(i.alternatives?{type:"literal",value:i.primary,alternatives:i.alternatives}:{type:"literal",value:i.primary});}let s=o.map(c=>`{${c.role}}`).join(" "),l={action:{value:t.action},event:{fromRole:"event"},...Object.fromEntries(o.map(c=>[c.role,{fromRole:c.role}]))};return Ve(n,l,t),{id:`${t.action}-event-${e.code}-sov-2role-event-last`,language:e.code,command:"on",priority:(a.basePriority??100)+40,template:{format:`${s} ${r.primary} {event} ${i.primary}`,tokens:n},extraction:l}}function Bn(t,e,r,i,a){let n=[],o=[...t.roles.filter(v=>v.required)].sort((v,z)=>{let C=v.sovPosition??999,w=z.sovPosition??999;return C-w}),s=o[0];n.push({type:"role",role:s.role,optional:false});let{marker:l,alternatives:c}=He(s,e);if(l){let v=c?{type:"literal",value:l,alternatives:c}:{type:"literal",value:l};n.push(v);}if(n.push({type:"role",role:"event",optional:false}),i.position==="after"){let v=i.primary.split(/\s+/);if(v.length>1)for(let z of v)n.push({type:"literal",value:z});else {let z=i.alternatives?{type:"literal",value:i.primary,alternatives:i.alternatives}:{type:"literal",value:i.primary};n.push(z);}}let m=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};n.push(m);let p=o[1];n.push({type:"role",role:p.role,optional:false});let{marker:d,alternatives:f}=He(p,e);if(d){let v=f?{type:"literal",value:d,alternatives:f}:{type:"literal",value:d};n.push(v);}let E={action:{value:t.action},event:{fromRole:"event"},[s.role]:{fromRole:s.role},[p.role]:{fromRole:p.role}};return Ve(n,E,t),{id:`${t.action}-event-${e.code}-sov-2role-dest-first`,language:e.code,command:"on",priority:(a.basePriority??100)+48,template:{format:`{${s.role}} {event} ${i.primary} ${r.primary} {${p.role}}`,tokens:n},extraction:E}}function xr(t,e,r,i,a){let n=[];if(i.position==="before"){let s=i.alternatives?{type:"literal",value:i.primary,alternatives:i.alternatives}:{type:"literal",value:i.primary};n.push(s);}n.push({type:"role",role:"event",optional:false});let u=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};n.push(u),n.push({type:"role",role:"patient",optional:false});let o=e.roleMarkers.destination;return o&&n.push({type:"group",optional:true,tokens:[o.alternatives?{type:"literal",value:o.primary,alternatives:o.alternatives}:{type:"literal",value:o.primary},{type:"role",role:"destination",optional:true}]}),n.push(...ke(t,e.roleMarkers.source)),{id:`${t.action}-event-${e.code}-vso`,language:e.code,command:"on",priority:(a.basePriority??100)+50,template:{format:`${i.primary} {event} ${r.primary} {patient} ${o?.primary||""} {destination?}`,tokens:n},extraction:{action:{value:t.action},event:{fromRole:"event"},patient:{fromRole:"patient"},...ze(t),...ge(t)}}}function Fn(t,e,r,i,a){let n=[],u=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};n.push(u),n.push({type:"role",role:"patient",optional:false});let o=e.roleMarkers.destination;if(o&&n.push({type:"group",optional:true,tokens:[o.alternatives?{type:"literal",value:o.primary,alternatives:o.alternatives}:{type:"literal",value:o.primary},{type:"role",role:"destination",optional:true}]}),n.push(...ke(t,e.roleMarkers.source)),i.position==="before"){let s=i.alternatives?{type:"literal",value:i.primary,alternatives:i.alternatives}:{type:"literal",value:i.primary};n.push(s);}return n.push({type:"role",role:"event",optional:false}),{id:`${t.action}-event-${e.code}-vso-verb-first`,language:e.code,command:"on",priority:(a.basePriority??100)+45,template:{format:`${r.primary} {patient} ${o?.primary||""} {destination?} ${i.primary} {event}`,tokens:n},extraction:{action:{value:t.action},event:{fromRole:"event"},patient:{fromRole:"patient"},...ze(t),...ge(t)}}}function Tn(t,e,r,i,a){let n=[],u=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};n.push(u);let s=[...t.roles.filter(m=>m.required)].sort((m,p)=>{let d=m.svoPosition??999,f=p.svoPosition??999;return d-f});for(let m of s){let p,d;if(m.markerOverride&&m.markerOverride[e.code]!==void 0)p=m.markerOverride[e.code];else {let f=e.roleMarkers[m.role];f&&(p=f.primary,d=f.alternatives);}if(p){let f=d?{type:"literal",value:p,alternatives:d}:{type:"literal",value:p};n.push(f);}n.push({type:"role",role:m.role,optional:false});}if(i.position==="before"){let m=i.alternatives?{type:"literal",value:i.primary,alternatives:i.alternatives}:{type:"literal",value:i.primary};n.push(m);}n.push({type:"role",role:"event",optional:false});let l=s.map(m=>`{${m.role}}`).join(" "),c={action:{value:t.action},event:{fromRole:"event"},...Object.fromEntries(s.map(m=>[m.role,{fromRole:m.role}]))};return Ve(n,c,t),{id:`${t.action}-event-${e.code}-vso-verb-first-2role`,language:e.code,command:"on",priority:(a.basePriority??100)+48,template:{format:`${r.primary} ${l} ${i.primary} {event}`,tokens:n},extraction:c}}function Br(t,e,r,i,a){let n=[];if(i.position==="before"){let m=i.alternatives?{type:"literal",value:i.primary,alternatives:i.alternatives}:{type:"literal",value:i.primary};n.push(m);}n.push({type:"role",role:"event",optional:false});let u=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};n.push(u);let s=[...t.roles.filter(m=>m.required)].sort((m,p)=>{let d=m.svoPosition??999,f=p.svoPosition??999;return d-f});for(let m of s){let p,d;if(m.markerOverride&&m.markerOverride[e.code]!==void 0)p=m.markerOverride[e.code];else {let f=e.roleMarkers[m.role];f&&(p=f.primary,d=f.alternatives);}if(p){let f=d?{type:"literal",value:p,alternatives:d}:{type:"literal",value:p};n.push(f);}n.push({type:"role",role:m.role,optional:false});}let l=s.map(m=>`{${m.role}}`).join(" "),c={action:{value:t.action},event:{fromRole:"event"},...Object.fromEntries(s.map(m=>[m.role,{fromRole:m.role}]))};return Ve(n,c,t),{id:`${t.action}-event-${e.code}-vso-2role`,language:e.code,command:"on",priority:(a.basePriority??100)+55,template:{format:`${i.primary} {event} ${r.primary} ${l}`,tokens:n},extraction:c}}function On(t,e,r,i,a){let n=[],u=e.eventHandler?.negationMarker;if(i.position==="before"){let l=i.alternatives?{type:"literal",value:i.primary,alternatives:i.alternatives}:{type:"literal",value:i.primary};n.push(l);}if(u){let l=u.alternatives?{type:"literal",value:u.primary,alternatives:u.alternatives}:{type:"literal",value:u.primary};n.push(l);}n.push({type:"role",role:"event",optional:false});let o=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};n.push(o),n.push({type:"role",role:"patient",optional:false});let s=e.roleMarkers.destination;return s&&n.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}]}),n.push(...ke(t,e.roleMarkers.source)),{id:`${t.action}-event-${e.code}-vso-negated`,language:e.code,command:"on",priority:(a.basePriority??100)+48,template:{format:`${i.primary} ${u?.primary||""} {event} ${r.primary} {patient} ${s?.primary||""} {destination?}`,tokens:n},extraction:{action:{value:t.action},event:{fromRole:"event"},patient:{fromRole:"patient"},...ze(t),...ge(t)}}}function Rn(t,e,r,i){let a=[];a.push({type:"literal",value:"and",alternatives:["then"]}),a.push({type:"role",role:"event",optional:false});let n=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};a.push(n),a.push({type:"role",role:"patient",optional:false});let u=e.roleMarkers.destination;return u&&a.push({type:"group",optional:true,tokens:[u.alternatives?{type:"literal",value:u.primary,alternatives:u.alternatives}:{type:"literal",value:u.primary},{type:"role",role:"destination",optional:true}]}),a.push(...ke(t,e.roleMarkers.source)),{id:`${t.action}-event-${e.code}-vso-proclitic`,language:e.code,command:"on",priority:(i.basePriority??100)+45,template:{format:`[proclitic?] {event} ${r.primary} {patient} ${u?.primary||""} {destination?}`,tokens:a},extraction:{action:{value:t.action},event:{fromRole:"event"},patient:{fromRole:"patient"},...ze(t),...ge(t)}}}var Ne={basePriority:100,generateSimpleVariants:true,generateAlternatives:true};function ar(t,e,r=Ne){let i=`${t.action}-${e.code}-generated`,a=r.basePriority??100,n=e.keywords[t.action];if(!n)throw new Error(`No keyword translation for '${t.action}' in ${e.code}`);let u=Ln(t,e,n),o=sr(t,e),s=Wn(t,e,n);return {id:i,language:e.code,command:t.action,priority:a,template:{format:s,tokens:u},extraction:o}}function Pn(t,e,r=Ne){if(t.roles.filter(o=>!o.required).length===0)return null;let a=t.roles.filter(o=>o.required),n={...t,roles:a};return {...ar(n,e,r),id:`${t.action}-${e.code}-generated-simple`,priority:(r.basePriority??100)-5,extraction:sr(t,e)}}function Nn(t,e,r=Ne){if(e.wordOrder!=="SOV")return null;let i=t.roles.filter(o=>o.required);if(i.length!==1)return null;let a=e.keywords[t.action];if(!a)return null;let n=a.alternatives?{type:"literal",value:a.primary,alternatives:a.alternatives}:{type:"literal",value:a.primary},u=i.map(o=>({type:"role",role:o.role,optional:false,expectedTypes:o.expectedTypes}));return {id:`${t.action}-${e.code}-generated-verb-first`,language:e.code,command:t.action,priority:(r.basePriority??100)-20,template:{format:`${a.primary} <${i[0].role}>`,tokens:[n,...u]},extraction:sr(t,e)}}function _n(t,e,r=Ne){let i=[];if(i.push(ar(t,e,r)),r.generateSimpleVariants){let a=Pn(t,e,r);a&&i.push(a);}for(let a of t.omitRoleVariants??[]){let n={...t,roles:t.roles.filter(o=>o.role!==a)},u=ar(n,e,r);i.push({...u,id:`${t.action}-${e.code}-generated-no-${a}`,priority:(r.basePriority??100)-8});}if(r.generateVerbFirstVariants!==false){let a=Nn(t,e,r);a&&i.push(a);}return i}function Zr(t,e=Ne){let r=[],i=Ua();for(let a of i){if(!t.keywords[a.action])continue;let n=_n(a,t,e);if(r.push(...n),t.eventHandler?.eventMarker){let u=Mn(a,t,e);r.push(...u);}}return r}function Mn(t,e,r=Ne){if(!e.eventHandler||!e.eventHandler.eventMarker)return [];let i=[],a=e.eventHandler.eventMarker,n=e.keywords[t.action];if(!n)return [];if(t.roles.length===0)return [];let o=t.roles.filter(s=>s.required).length===2;if(e.wordOrder==="SOV")if(o)i.push(Sn(t,e,n,a,r)),i.push(Bn(t,e,n,a,r)),i.push(xn(t,e,n,a,r));else {i.push(kn(t,e,n,a,r)),i.push(Cn(t,e,n,a,r));let s=e.roleMarkers.destination;s&&s.primary!==a.primary&&i.push(bn(t,e,n,a,r));let l=a.primary.split(/\s+/),c=a.alternatives?.some(p=>!p.includes(" ")&&p.length>1);l.length>1&&c&&i.push(wn(t,e,n,a,r)),i.push(An(t,e,n,a,r));let m=Dn(t,e,n,r);m&&i.push(m);}else e.wordOrder==="VSO"?o?(i.push(Br(t,e,n,a,r)),i.push(Tn(t,e,n,a,r))):(i.push(xr(t,e,n,a,r)),i.push(Fn(t,e,n,a,r)),e.eventHandler?.negationMarker&&i.push(On(t,e,n,a,r)),e.tokenization?.prefixes&&i.push(Rn(t,e,n,r))):o?i.push(Br(t,e,n,a,r)):i.push(xr(t,e,n,a,r));return i}function Ln(t,e,r){let i=[],a=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary},n=jn(t,e);switch(e.wordOrder){case "SVO":i.push(a),i.push(...n);break;case "SOV":i.push(...n),i.push(a);break;case "VSO":i.push(a),i.push(...n);break;default:i.push(a),i.push(...n);}return In(i)}function In(t){let e=[];for(let r of t){let i=e[e.length-1];if(i&&i.type==="literal"&&r.type==="literal"&&i.value===r.value){let a=[...i.alternatives??[],...r.alternatives??[]];a.length&&(e[e.length-1]={...i,alternatives:[...new Set(a)]});continue}e.push(r);}return e}function jn(t,e){let r=[],i=Yr(t.roles,e.wordOrder);for(let a of i){let n=Vn(a,e);a.required?r.push(...n):r.push({type:"group",optional:true,tokens:n});}return r}function Vn(t,e){let r=[],i=t.markerOverride?.[e.code],a=e.roleMarkers[t.role],n={type:"role",role:t.role,optional:!t.required,expectedTypes:t.expectedTypes};if(i!==void 0){let u=i?i.split(/\s+/).filter(Boolean):[],o=a?.position??"before",s=t.markerOptional?.[e.code]===true,l=c=>{let m={type:"literal",value:c};r.push(s?{type:"group",optional:true,tokens:[m]}:m);};if(o==="before"){for(let c of u)l(c);r.push(n);}else {r.push(n);for(let c of u)l(c);}}else if(a){let u=t.markerVariants?.[e.code]??[],o=()=>{let l=[...new Set([...a.alternatives??[],...u])].filter(c=>c!==a.primary);return l.length?{type:"literal",value:a.primary,alternatives:l}:{type:"literal",value:a.primary}},s=l=>{r.push(e.markersOptional||t.markerOptional?.[e.code]?{type:"group",optional:true,tokens:[l]}:l);};a.position==="before"?(a.primary&&s(o()),r.push(n)):(r.push(n),s(o()));}else r.push(n);return r}function $n(t,e){let r={};for(let i of t.roles){let a=i.markerOverride?.[e.code],n=e.roleMarkers[i.role];if(a!==void 0)r[i.role]=a?{marker:a}:{};else if(n&&n.primary){let u=i.markerVariants?.[e.code]??[],o=[...new Set([...n.alternatives??[],...u])].filter(s=>s!==n.primary);r[i.role]=o.length?{marker:n.primary,markerAlternatives:o}:{marker:n.primary};}else r[i.role]={};}return r}function sr(t,e){let r=$n(t,e),i={};for(let a of t.roles){let n=r[a.role]||{};!a.required&&a.default?i[a.role]={...n,default:a.default}:i[a.role]=n;}return i}function Wn(t,e,r){let i=[],n=Yr(t.roles,e.wordOrder).map(u=>{let o=gn(u,e),s="";return o&&o.primary?o.position==="before"?s=`${o.primary} {${u.role}}`:s=`{${u.role}} ${o.primary}`:s=`{${u.role}}`,u.required?s:`[${s}]`});switch(e.wordOrder){case "SVO":case "VSO":i.push(r.primary,...n);break;case "SOV":i.push(...n,r.primary);break;default:i.push(r.primary,...n);}return i.join(" ")}var qn=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 r=this.makeKey(t,e),i=this.cache.get(r);if(!i){this.stats.misses++;return}if(this.isExpired(i)){this.cache.delete(r),this.stats.expirations++,this.stats.misses++;return}return this.cache.delete(r),i.lastAccessed=Date.now(),this.cache.set(r,i),this.stats.hits++,i.result}set(t,e,r){if(!this.config.enabled||r!==null&&typeof r=="object"&&"confidence"in r&&r.confidence===0)return;let i=this.makeKey(t,e),a=Date.now();for(;this.cache.size>=this.config.maxSize;)this.evictLRU();this.cache.set(i,{result:r,createdAt:a,lastAccessed:a});}has(t,e){if(!this.config.enabled)return false;let r=this.makeKey(t,e),i=this.cache.get(r);return i?this.isExpired(i)?(this.cache.delete(r),this.stats.expirations++,false):true:false}delete(t,e){let r=this.makeKey(t,e);return this.cache.delete(r)}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}}};new qn;function Kn(t){return /[а-яА-ЯёЁ]/.test(t)}function Un(t){for(let e of t)if(Kn(e))return true;return false}var Xr=new Map([["\u043F\u0435\u0440\u0435\u043A\u043B\u044E\u0447\u0438","\u043F\u0435\u0440\u0435\u043A\u043B\u044E\u0447\u0438\u0442\u044C"],["\u0434\u043E\u0431\u0430\u0432\u044C","\u0434\u043E\u0431\u0430\u0432\u0438\u0442\u044C"],["\u0443\u0434\u0430\u043B\u0438","\u0443\u0434\u0430\u043B\u0438\u0442\u044C"],["\u0443\u0431\u0435\u0440\u0438","\u0443\u0431\u0440\u0430\u0442\u044C"],["\u043F\u043E\u043B\u043E\u0436\u0438","\u043F\u043E\u043B\u043E\u0436\u0438\u0442\u044C"],["\u043F\u043E\u043C\u0435\u0441\u0442\u0438","\u043F\u043E\u043C\u0435\u0441\u0442\u0438\u0442\u044C"],["\u0432\u0441\u0442\u0430\u0432\u044C","\u0432\u0441\u0442\u0430\u0432\u0438\u0442\u044C"],["\u0432\u043E\u0437\u044C\u043C\u0438","\u0432\u0437\u044F\u0442\u044C"],["\u0441\u043E\u0437\u0434\u0430\u0439","\u0441\u043E\u0437\u0434\u0430\u0442\u044C"],["\u043A\u043B\u043E\u043D\u0438\u0440\u0443\u0439","\u043A\u043B\u043E\u043D\u0438\u0440\u043E\u0432\u0430\u0442\u044C"],["\u043F\u043E\u043C\u0435\u043D\u044F\u0439","\u043F\u043E\u043C\u0435\u043D\u044F\u0442\u044C"],["\u0442\u0440\u0430\u043D\u0441\u0444\u043E\u0440\u043C\u0438\u0440\u0443\u0439","\u0442\u0440\u0430\u043D\u0441\u0444\u043E\u0440\u043C\u0438\u0440\u043E\u0432\u0430\u0442\u044C"],["\u0443\u0441\u0442\u0430\u043D\u043E\u0432\u0438","\u0443\u0441\u0442\u0430\u043D\u043E\u0432\u0438\u0442\u044C"],["\u0437\u0430\u0434\u0430\u0439","\u0437\u0430\u0434\u0430\u0442\u044C"],["\u043F\u043E\u043B\u0443\u0447\u0438","\u043F\u043E\u043B\u0443\u0447\u0438\u0442\u044C"],["\u0443\u0432\u0435\u043B\u0438\u0447\u044C","\u0443\u0432\u0435\u043B\u0438\u0447\u0438\u0442\u044C"],["\u0443\u043C\u0435\u043D\u044C\u0448\u0438","\u0443\u043C\u0435\u043D\u044C\u0448\u0438\u0442\u044C"],["\u0437\u0430\u043F\u0438\u0448\u0438","\u0437\u0430\u043F\u0438\u0441\u0430\u0442\u044C"],["\u043F\u043E\u043A\u0430\u0436\u0438","\u043F\u043E\u043A\u0430\u0437\u0430\u0442\u044C"],["\u0441\u043A\u0440\u043E\u0439","\u0441\u043A\u0440\u044B\u0442\u044C"],["\u0441\u043F\u0440\u044F\u0447\u044C","\u0441\u043F\u0440\u044F\u0442\u0430\u0442\u044C"],["\u0430\u043D\u0438\u043C\u0438\u0440\u0443\u0439","\u0430\u043D\u0438\u043C\u0438\u0440\u043E\u0432\u0430\u0442\u044C"],["\u0432\u044B\u0437\u043E\u0432\u0438","\u0432\u044B\u0437\u0432\u0430\u0442\u044C"],["\u043E\u0442\u043F\u0440\u0430\u0432\u044C","\u043E\u0442\u043F\u0440\u0430\u0432\u0438\u0442\u044C"],["\u0441\u0444\u043E\u043A\u0443\u0441\u0438\u0440\u0443\u0439","\u0441\u0444\u043E\u043A\u0443\u0441\u0438\u0440\u043E\u0432\u0430\u0442\u044C"],["\u0440\u0430\u0437\u043C\u043E\u0439","\u0440\u0430\u0437\u043C\u044B\u0442\u044C"],["\u043F\u0435\u0440\u0435\u0439\u0434\u0438","\u043F\u0435\u0440\u0435\u0439\u0442\u0438"],["\u0438\u0434\u0438","\u0438\u0434\u0442\u0438"],["\u0436\u0434\u0438","\u0436\u0434\u0430\u0442\u044C"],["\u043F\u043E\u0434\u043E\u0436\u0434\u0438","\u043F\u043E\u0434\u043E\u0436\u0434\u0430\u0442\u044C"],["\u0437\u0430\u0433\u0440\u0443\u0437\u0438","\u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044C"],["\u043F\u043E\u0432\u0442\u043E\u0440\u0438","\u043F\u043E\u0432\u0442\u043E\u0440\u0438\u0442\u044C"],["\u043F\u0440\u043E\u0434\u043E\u043B\u0436\u0438","\u043F\u0440\u043E\u0434\u043E\u043B\u0436\u0438\u0442\u044C"],["\u0431\u0440\u043E\u0441\u044C","\u0431\u0440\u043E\u0441\u0438\u0442\u044C"],["\u0432\u0435\u0440\u043D\u0438","\u0432\u0435\u0440\u043D\u0443\u0442\u044C"],["\u0441\u043A\u0430\u0436\u0438","\u0441\u043A\u0430\u0437\u0430\u0442\u044C"],["\u0438\u043D\u0438\u0446\u0438\u0430\u043B\u0438\u0437\u0438\u0440\u0443\u0439","\u0438\u043D\u0438\u0446\u0438\u0430\u043B\u0438\u0437\u0438\u0440\u043E\u0432\u0430\u0442\u044C"],["\u0438\u0437\u043C\u0435\u0440\u044C","\u0438\u0437\u043C\u0435\u0440\u0438\u0442\u044C"]]),Qr=class{constructor(){this.language="ru";}isNormalizable(t){return t.length<3?false:Un(t)}normalize(t){let e=t.toLowerCase();if(e.endsWith("\u0441\u044F")||e.endsWith("\u0441\u044C")){let u=this.tryReflexiveNormalization(e);if(u)return u}if(e.endsWith("\u0442\u044C")||e.endsWith("\u0442\u0438")||e.endsWith("\u0447\u044C"))return K(t);let r=this.tryImperativeLookup(e);if(r)return r;let i=this.tryPastTenseNormalization(e);if(i)return i;let a=this.tryPresentTenseNormalization(e);if(a)return a;let n=this.tryGenericImperativeNormalization(e);return n||K(t)}tryReflexiveNormalization(t){(t.endsWith("\u0441\u044F"),2);let r=t.slice(0,-2);if(t.endsWith("\u0442\u044C\u0441\u044F")||t.endsWith("\u0442\u0438\u0441\u044C")||t.endsWith("\u0447\u044C\u0441\u044F"))return K(t);let i=this.normalizeNonReflexive(r);if(i.confidence<1){let a=i.stem.endsWith("\u0442\u044C")?i.stem.slice(0,-2)+"\u0442\u044C\u0441\u044F":i.stem+"\u0441\u044F";return D(a,i.confidence*.95,{removedSuffixes:["\u0441\u044F",...i.metadata?.removedSuffixes||[]],conjugationType:"reflexive"})}return null}normalizeNonReflexive(t){if(t.endsWith("\u0442\u044C")||t.endsWith("\u0442\u0438")||t.endsWith("\u0447\u044C"))return K(t);let e=this.tryImperativeLookup(t);if(e)return e;let r=this.tryPastTenseNormalization(t);if(r)return r;let i=this.tryPresentTenseNormalization(t);if(i)return i;let a=this.tryGenericImperativeNormalization(t);return a||K(t)}tryImperativeLookup(t){return Xr.has(t)?D(Xr.get(t),.95,{removedSuffixes:["imperative"],conjugationType:"imperative"}):null}tryGenericImperativeNormalization(t){return t.endsWith("\u0439\u0442\u0435")&&t.length>5?D(t.slice(0,-3)+"\u0442\u044C",.8,{removedSuffixes:["\u0439\u0442\u0435"],conjugationType:"imperative"}):t.endsWith("\u0438\u0442\u0435")&&t.length>5?D(t.slice(0,-3)+"\u0438\u0442\u044C",.8,{removedSuffixes:["\u0438\u0442\u0435"],conjugationType:"imperative"}):t.endsWith("\u0439")&&t.length>3?D(t.slice(0,-1)+"\u0442\u044C",.75,{removedSuffixes:["\u0439"],conjugationType:"imperative"}):t.endsWith("\u0438")&&t.length>3?D(t+"\u0442\u044C",.7,{removedSuffixes:["\u0438\u2192\u0438\u0442\u044C"],conjugationType:"imperative"}):null}tryPastTenseNormalization(t){return t.endsWith("\u0430\u043B\u0430")&&t.length>4?D(t.slice(0,-3)+"\u0430\u0442\u044C",.85,{removedSuffixes:["\u0430\u043B\u0430"],conjugationType:"past"}):t.endsWith("\u0438\u043B\u0430")&&t.length>4?D(t.slice(0,-3)+"\u0438\u0442\u044C",.85,{removedSuffixes:["\u0438\u043B\u0430"],conjugationType:"past"}):t.endsWith("\u0435\u043B\u043E")&&t.length>4?D(t.slice(0,-3)+"\u0435\u0442\u044C",.82,{removedSuffixes:["\u0435\u043B\u043E"],conjugationType:"past"}):t.endsWith("\u0430\u0431\u043E")&&t.length>4?D(t.slice(0,-3)+"\u0430\u0442\u044C",.82,{removedSuffixes:["\u0430\u0431\u043E"],conjugationType:"past"}):t.endsWith("\u0430\u043B\u0438")&&t.length>4?D(t.slice(0,-3)+"\u0430\u0442\u044C",.85,{removedSuffixes:["\u0430\u043B\u0438"],conjugationType:"past"}):t.endsWith("\u0438\u043B\u0438")&&t.length>4?D(t.slice(0,-3)+"\u0438\u0442\u044C",.85,{removedSuffixes:["\u0438\u043B\u0438"],conjugationType:"past"}):t.endsWith("\u0430\u043B")&&t.length>3?D(t.slice(0,-2)+"\u0430\u0442\u044C",.82,{removedSuffixes:["\u0430\u043B"],conjugationType:"past"}):t.endsWith("\u0438\u043B")&&t.length>3?D(t.slice(0,-2)+"\u0438\u0442\u044C",.82,{removedSuffixes:["\u0438\u043B"],conjugationType:"past"}):null}tryPresentTenseNormalization(t){return t.endsWith("\u0438\u0448\u044C")&&t.length>4?D(t.slice(0,-3)+"\u0438\u0442\u044C",.8,{removedSuffixes:["\u0438\u0448\u044C"],conjugationType:"present"}):t.endsWith("\u0438\u0442")&&t.length>3?D(t.slice(0,-2)+"\u0438\u0442\u044C",.78,{removedSuffixes:["\u0438\u0442"],conjugationType:"present"}):t.endsWith("\u0438\u043C")&&t.length>3?D(t.slice(0,-2)+"\u0438\u0442\u044C",.78,{removedSuffixes:["\u0438\u043C"],conjugationType:"present"}):t.endsWith("\u044F\u0442")&&t.length>3?D(t.slice(0,-2)+"\u0438\u0442\u044C",.78,{removedSuffixes:["\u044F\u0442"],conjugationType:"present"}):t.endsWith("\u0435\u0448\u044C")&&t.length>4?D(t.slice(0,-3)+"\u0430\u0442\u044C",.75,{removedSuffixes:["\u0435\u0448\u044C"],conjugationType:"present"}):t.endsWith("\u0435\u0442")&&t.length>3?D(t.slice(0,-2)+"\u0430\u0442\u044C",.72,{removedSuffixes:["\u0435\u0442"],conjugationType:"present"}):t.endsWith("\u0435\u043C")&&t.length>3?D(t.slice(0,-2)+"\u0430\u0442\u044C",.72,{removedSuffixes:["\u0435\u043C"],conjugationType:"present"}):t.endsWith("\u044E\u0442")&&t.length>3?D(t.slice(0,-2)+"\u0430\u0442\u044C",.75,{removedSuffixes:["\u044E\u0442"],conjugationType:"present"}):t.endsWith("\u0443\u0442")&&t.length>3?D(t.slice(0,-2)+"\u0430\u0442\u044C",.72,{removedSuffixes:["\u0443\u0442"],conjugationType:"present"}):null}},et={code:"ru",name:"Russian",nativeName:"\u0420\u0443\u0441\u0441\u043A\u0438\u0439",direction:"ltr",script:"cyrillic",wordOrder:"SVO",markingStrategy:"preposition",usesSpaces:true,defaultVerbForm:"infinitive",verb:{position:"start",subjectDrop:true,suffixes:["\u0442\u044C","\u0442\u044C\u0441\u044F","\u0438\u0442\u044C","\u0438\u0442\u044C\u0441\u044F","\u0430\u0442\u044C","\u0430\u0442\u044C\u0441\u044F","\u0435\u0442\u044C","\u0435\u0442\u044C\u0441\u044F"]},references:{me:"\u044F",it:"\u044D\u0442\u043E",you:"\u0442\u044B",result:"\u0440\u0435\u0437\u0443\u043B\u044C\u0442\u0430\u0442",event:"\u0441\u043E\u0431\u044B\u0442\u0438\u0435",target:"\u0446\u0435\u043B\u044C",body:"\u0442\u0435\u043B\u043E"},possessive:{marker:"",markerPosition:"after-object",usePossessiveAdjectives:true,specialForms:{me:"\u043C\u043E\u0439",it:"\u0435\u0433\u043E",you:"\u0442\u0432\u043E\u0439"},keywords:{\u043C\u043E\u0439:"me",\u043C\u043E\u044F:"me",\u043C\u043E\u0451:"me",\u043C\u043E\u0438:"me",\u0442\u0432\u043E\u0439:"you",\u0442\u0432\u043E\u044F:"you",\u0442\u0432\u043E\u0451:"you",\u0442\u0432\u043E\u0438:"you",\u0435\u0433\u043E:"it",\u0435\u0451:"it"}},roleMarkers:{destination:{primary:"\u0432",alternatives:["\u043D\u0430","\u043A"],position:"before"},source:{primary:"\u0438\u0437",alternatives:["\u043E\u0442","\u0441"],position:"before"},patient:{primary:"",position:"before"},style:{primary:"\u0441",alternatives:["\u0441\u043E"],position:"before"}},keywords:{toggle:{primary:"\u043F\u0435\u0440\u0435\u043A\u043B\u044E\u0447\u0438\u0442\u044C",alternatives:["\u043F\u0435\u0440\u0435\u043A\u043B\u044E\u0447\u0438"],normalized:"toggle",form:"infinitive"},add:{primary:"\u0434\u043E\u0431\u0430\u0432\u0438\u0442\u044C",alternatives:["\u0434\u043E\u0431\u0430\u0432\u044C"],normalized:"add",form:"infinitive"},remove:{primary:"\u0443\u0434\u0430\u043B\u0438\u0442\u044C",alternatives:["\u0443\u0434\u0430\u043B\u0438","\u0443\u0431\u0440\u0430\u0442\u044C","\u0443\u0431\u0435\u0440\u0438"],normalized:"remove",form:"infinitive"},put:{primary:"\u043F\u043E\u043B\u043E\u0436\u0438\u0442\u044C",alternatives:["\u043F\u043E\u043B\u043E\u0436\u0438","\u043F\u043E\u043C\u0435\u0441\u0442\u0438\u0442\u044C","\u043F\u043E\u043C\u0435\u0441\u0442\u0438","\u0432\u0441\u0442\u0430\u0432\u0438\u0442\u044C","\u0432\u0441\u0442\u0430\u0432\u044C"],normalized:"put",form:"infinitive"},append:{primary:"\u0434\u043E\u0431\u0430\u0432\u0438\u0442\u044C_\u0432_\u043A\u043E\u043D\u0435\u0446",alternatives:["\u0434\u043E\u043F\u0438\u0441\u0430\u0442\u044C"],normalized:"append",form:"infinitive"},prepend:{primary:"\u0434\u043E\u0431\u0430\u0432\u0438\u0442\u044C_\u0432_\u043D\u0430\u0447\u0430\u043B\u043E",normalized:"prepend",form:"infinitive"},take:{primary:"\u0432\u0437\u044F\u0442\u044C",alternatives:["\u0432\u043E\u0437\u044C\u043C\u0438"],normalized:"take",form:"infinitive"},make:{primary:"\u0441\u043E\u0437\u0434\u0430\u0442\u044C",alternatives:["\u0441\u043E\u0437\u0434\u0430\u0439"],normalized:"make",form:"infinitive"},clone:{primary:"\u043A\u043B\u043E\u043D\u0438\u0440\u043E\u0432\u0430\u0442\u044C",alternatives:["\u043A\u043B\u043E\u043D\u0438\u0440\u0443\u0439"],normalized:"clone",form:"infinitive"},swap:{primary:"\u043F\u043E\u043C\u0435\u043D\u044F\u0442\u044C",alternatives:["\u043F\u043E\u043C\u0435\u043D\u044F\u0439"],normalized:"swap",form:"infinitive"},morph:{primary:"\u0442\u0440\u0430\u043D\u0441\u0444\u043E\u0440\u043C\u0438\u0440\u043E\u0432\u0430\u0442\u044C",alternatives:["\u0442\u0440\u0430\u043D\u0441\u0444\u043E\u0440\u043C\u0438\u0440\u0443\u0439"],normalized:"morph",form:"infinitive"},set:{primary:"\u0443\u0441\u0442\u0430\u043D\u043E\u0432\u0438\u0442\u044C",alternatives:["\u0443\u0441\u0442\u0430\u043D\u043E\u0432\u0438","\u0437\u0430\u0434\u0430\u0442\u044C","\u0437\u0430\u0434\u0430\u0439"],normalized:"set",form:"infinitive"},get:{primary:"\u043F\u043E\u043B\u0443\u0447\u0438\u0442\u044C",alternatives:["\u043F\u043E\u043B\u0443\u0447\u0438"],normalized:"get",form:"infinitive"},increment:{primary:"\u0443\u0432\u0435\u043B\u0438\u0447\u0438\u0442\u044C",alternatives:["\u0443\u0432\u0435\u043B\u0438\u0447\u044C"],normalized:"increment",form:"infinitive"},decrement:{primary:"\u0443\u043C\u0435\u043D\u044C\u0448\u0438\u0442\u044C",alternatives:["\u0443\u043C\u0435\u043D\u044C\u0448\u0438"],normalized:"decrement",form:"infinitive"},log:{primary:"\u0437\u0430\u043F\u0438\u0441\u0430\u0442\u044C",alternatives:["\u0437\u0430\u043F\u0438\u0448\u0438"],normalized:"log",form:"infinitive"},show:{primary:"\u043F\u043E\u043A\u0430\u0437\u0430\u0442\u044C",alternatives:["\u043F\u043E\u043A\u0430\u0436\u0438"],normalized:"show",form:"infinitive"},hide:{primary:"\u0441\u043A\u0440\u044B\u0442\u044C",alternatives:["\u0441\u043A\u0440\u043E\u0439","\u0441\u043F\u0440\u044F\u0442\u0430\u0442\u044C","\u0441\u043F\u0440\u044F\u0447\u044C"],normalized:"hide",form:"infinitive"},transition:{primary:"\u0430\u043D\u0438\u043C\u0438\u0440\u043E\u0432\u0430\u0442\u044C",alternatives:["\u0430\u043D\u0438\u043C\u0438\u0440\u0443\u0439"],normalized:"transition",form:"infinitive"},on:{primary:"\u043F\u0440\u0438",normalized:"on"},trigger:{primary:"\u0438\u043D\u0438\u0446\u0438\u0438\u0440\u043E\u0432\u0430\u0442\u044C",alternatives:["\u0437\u0430\u043F\u0443\u0441\u0442\u0438\u0442\u044C","\u0437\u0430\u043F\u0443\u0441\u0442\u0438"],normalized:"trigger",form:"infinitive"},send:{primary:"\u043E\u0442\u043F\u0440\u0430\u0432\u0438\u0442\u044C",alternatives:["\u043E\u0442\u043F\u0440\u0430\u0432\u044C"],normalized:"send",form:"infinitive"},focus:{primary:"\u0441\u0444\u043E\u043A\u0443\u0441\u0438\u0440\u043E\u0432\u0430\u0442\u044C",alternatives:["\u0441\u0444\u043E\u043A\u0443\u0441\u0438\u0440\u0443\u0439","\u0444\u043E\u043A\u0443\u0441"],normalized:"focus",form:"infinitive"},blur:{primary:"\u0440\u0430\u0437\u043C\u044B\u0442\u044C",alternatives:["\u0440\u0430\u0437\u043C\u043E\u0439"],normalized:"blur",form:"infinitive"},empty:{primary:"\u043E\u043F\u0443\u0441\u0442\u043E\u0448\u0438\u0442\u044C",alternatives:["\u043F\u0443\u0441\u0442\u043E\u0439"],normalized:"empty"},open:{primary:"\u043E\u0442\u043A\u0440\u044B\u0442\u044C",normalized:"open"},close:{primary:"\u0437\u0430\u043A\u0440\u044B\u0442\u044C",normalized:"close"},select:{primary:"\u0432\u044B\u0434\u0435\u043B\u0438\u0442\u044C",normalized:"select"},clear:{primary:"\u043E\u0447\u0438\u0441\u0442\u0438\u0442\u044C",normalized:"clear"},reset:{primary:"\u0441\u0431\u0440\u043E\u0441\u0438\u0442\u044C",normalized:"reset"},breakpoint:{primary:"\u0442\u043E\u0447\u043A\u0430-\u043E\u0441\u0442\u0430\u043D\u043E\u0432\u0430",normalized:"breakpoint"},click:{primary:"\u043A\u043B\u0438\u043A",alternatives:["\u043A\u043B\u0438\u043A\u0435","\u043D\u0430\u0436\u0430\u0442\u0438\u0438"],normalized:"click"},hover:{primary:"\u043D\u0430\u0432\u0435\u0434\u0435\u043D\u0438\u0438",alternatives:["\u043D\u0430\u0432\u0435\u0434\u0435\u043D\u0438\u0435"],normalized:"hover"},submit:{primary:"\u043E\u0442\u043F\u0440\u0430\u0432\u043A\u0435",alternatives:["\u043E\u0442\u043F\u0440\u0430\u0432\u043A\u0430"],normalized:"submit"},input:{primary:"\u0432\u0432\u043E\u0434\u0435",alternatives:["\u0432\u0432\u043E\u0434"],normalized:"input"},change:{primary:"\u0438\u0437\u043C\u0435\u043D\u0435\u043D\u0438\u0438",alternatives:["\u0438\u0437\u043C\u0435\u043D\u0435\u043D\u0438\u0435"],normalized:"change"},load:{primary:"\u0437\u0430\u0433\u0440\u0443\u0437\u043A\u0430",alternatives:["\u0437\u0430\u0433\u0440\u0443\u0437\u043A\u0435"],normalized:"load"},go:{primary:"\u043F\u0435\u0440\u0435\u0439\u0442\u0438",alternatives:["\u043F\u0435\u0440\u0435\u0439\u0434\u0438","\u0438\u0434\u0442\u0438","\u0438\u0434\u0438"],normalized:"go",form:"infinitive"},scroll:{primary:"\u043F\u0440\u043E\u043A\u0440\u0443\u0442\u0438\u0442\u044C",alternatives:["\u043F\u0440\u043E\u043A\u0440\u0443\u0442\u0438"],normalized:"scroll",form:"infinitive"},push:{primary:"\u0432\u0442\u043E\u043B\u043A\u043D\u0443\u0442\u044C",alternatives:["\u0442\u043E\u043B\u043A\u043D\u0443\u0442\u044C"],normalized:"push",form:"infinitive"},replace:{primary:"\u0437\u0430\u043C\u0435\u043D\u0438\u0442\u044C",alternatives:["\u0437\u0430\u043C\u0435\u043D\u0438"],normalized:"replace",form:"infinitive"},process:{primary:"\u043E\u0431\u0440\u0430\u0431\u043E\u0442\u0430\u0442\u044C",alternatives:["\u043E\u0431\u0440\u0430\u0431\u043E\u0442\u0430\u0439"],normalized:"process",form:"infinitive"},wait:{primary:"\u0436\u0434\u0430\u0442\u044C",alternatives:["\u0436\u0434\u0438","\u043F\u043E\u0434\u043E\u0436\u0434\u0438"],normalized:"wait",form:"infinitive"},fetch:{primary:"\u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044C",alternatives:["\u0437\u0430\u0433\u0440\u0443\u0437\u0438"],normalized:"fetch",form:"infinitive"},settle:{primary:"\u0441\u0442\u0430\u0431\u0438\u043B\u0438\u0437\u0438\u0440\u043E\u0432\u0430\u0442\u044C",normalized:"settle",form:"infinitive"},if:{primary:"\u0435\u0441\u043B\u0438",normalized:"if"},unless:{primary:"\u043A\u0440\u043E\u043C\u0435",normalized:"unless"},when:{primary:"\u043A\u043E\u0433\u0434\u0430",normalized:"when"},where:{primary:"\u0433\u0434\u0435",normalized:"where"},else:{primary:"\u0438\u043D\u0430\u0447\u0435",normalized:"else"},repeat:{primary:"\u043F\u043E\u0432\u0442\u043E\u0440\u0438\u0442\u044C",alternatives:["\u043F\u043E\u0432\u0442\u043E\u0440\u0438"],normalized:"repeat",form:"infinitive"},for:{primary:"\u0434\u043B\u044F",alternatives:["\u043A\u0430\u0436\u0434\u044B\u0439"],normalized:"for"},while:{primary:"\u043F\u043E\u043A\u0430",normalized:"while"},forever:{primary:"\u0432\u0441\u0435\u0433\u0434\u0430",normalized:"forever",alternatives:["forever"]},continue:{primary:"\u043F\u0440\u043E\u0434\u043E\u043B\u0436\u0438\u0442\u044C",alternatives:["\u043F\u0440\u043E\u0434\u043E\u043B\u0436\u0438"],normalized:"continue",form:"infinitive"},halt:{primary:"\u043E\u0441\u0442\u0430\u043D\u043E\u0432\u0438\u0442\u044C",alternatives:["\u043E\u0441\u0442\u0430\u043D\u043E\u0432\u0438\u0441\u044C","\u0441\u0442\u043E\u043F"],normalized:"halt",form:"infinitive"},throw:{primary:"\u0431\u0440\u043E\u0441\u0438\u0442\u044C",alternatives:["\u0431\u0440\u043E\u0441\u044C"],normalized:"throw",form:"infinitive"},call:{primary:"\u0432\u044B\u0437\u0432\u0430\u0442\u044C",alternatives:["\u0432\u044B\u0437\u043E\u0432\u0438"],normalized:"call",form:"infinitive"},return:{primary:"\u0432\u0435\u0440\u043D\u0443\u0442\u044C",alternatives:["\u0432\u0435\u0440\u043D\u0438"],normalized:"return",form:"infinitive"},then:{primary:"\u0437\u0430\u0442\u0435\u043C",alternatives:["\u043F\u043E\u0442\u043E\u043C","\u0442\u043E\u0433\u0434\u0430"],normalized:"then"},and:{primary:"\u0438",normalized:"and"},matches:{primary:"\u0441\u043E\u043E\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0435\u0442",normalized:"matches"},end:{primary:"\u043A\u043E\u043D\u0435\u0446",normalized:"end"},js:{primary:"js",normalized:"js"},async:{primary:"\u0430\u0441\u0438\u043D\u0445\u0440\u043E\u043D\u043D\u043E",alternatives:["async"],normalized:"async"},tell:{primary:"\u0441\u043A\u0430\u0437\u0430\u0442\u044C",alternatives:["\u0441\u043A\u0430\u0436\u0438"],normalized:"tell",form:"infinitive"},default:{primary:"\u043F\u043E_\u0443\u043C\u043E\u043B\u0447\u0430\u043D\u0438\u044E",normalized:"default"},init:{primary:"\u0438\u043D\u0438\u0446\u0438\u0430\u043B\u0438\u0437\u0438\u0440\u043E\u0432\u0430\u0442\u044C",alternatives:["\u0438\u043D\u0438\u0446\u0438\u0430\u043B\u0438\u0437\u0438\u0440\u0443\u0439"],normalized:"init",form:"infinitive"},behavior:{primary:"\u043F\u043E\u0432\u0435\u0434\u0435\u043D\u0438\u0435",normalized:"behavior"},install:{primary:"\u0438\u043D\u0441\u0442\u0430\u043B\u043B\u0438\u0440\u043E\u0432\u0430\u0442\u044C",normalized:"install",form:"infinitive"},measure:{primary:"\u0438\u0437\u043C\u0435\u0440\u0438\u0442\u044C",alternatives:["\u0438\u0437\u043C\u0435\u0440\u044C"],normalized:"measure",form:"infinitive"},beep:{primary:"\u0437\u0432\u0443\u043A",normalized:"beep"},break:{primary:"\u043F\u0440\u0435\u0440\u0432\u0430\u0442\u044C",normalized:"break"},copy:{primary:"\u043A\u043E\u043F\u0438\u0440\u043E\u0432\u0430\u0442\u044C",normalized:"copy"},exit:{primary:"\u0432\u044B\u0439\u0442\u0438",normalized:"exit"},pick:{primary:"\u0432\u044B\u0431\u0440\u0430\u0442\u044C",normalized:"pick"},render:{primary:"\u043E\u0442\u043E\u0431\u0440\u0430\u0437\u0438\u0442\u044C",normalized:"render"},into:{primary:"\u0432",alternatives:["\u0432\u043E"],normalized:"into"},before:{primary:"\u0434\u043E",alternatives:["\u043F\u0435\u0440\u0435\u0434"],normalized:"before"},after:{primary:"\u043F\u043E\u0441\u043B\u0435",normalized:"after"},until:{primary:"\u043F\u043E\u043A\u0430_\u043D\u0435",normalized:"until"},event:{primary:"\u0441\u043E\u0431\u044B\u0442\u0438\u0435",normalized:"event"},from:{primary:"\u0438\u0437",alternatives:["\u043E\u0442","\u0441"],normalized:"from"},connect:{primary:"\u043F\u043E\u0434\u043A\u043B\u044E\u0447\u0438\u0442\u044C",alternatives:["\u0441\u043E\u0435\u0434\u0438\u043D\u0438\u0442\u044C","\u043F\u043E\u0434\u043A\u043B\u044E\u0447\u0438\u0442\u044C\u0441\u044F"],normalized:"connect"},stream:{primary:"\u0442\u0440\u0430\u043D\u0441\u043B\u0438\u0440\u043E\u0432\u0430\u0442\u044C",alternatives:["\u043F\u043E\u0442\u043E\u043A","\u0441\u0442\u0440\u0438\u043C"],normalized:"stream"},live:{primary:"\u0432-\u043F\u0440\u044F\u043C\u043E\u043C-\u044D\u0444\u0438\u0440\u0435",alternatives:["\u043F\u0440\u044F\u043C\u043E\u0439-\u044D\u0444\u0438\u0440","\u0432\u0436\u0438\u0432\u0443\u044E","\u0436\u0438\u0432\u043E\u0439"],normalized:"live"},socket:{primary:"\u0441\u043E\u043A\u0435\u0442",alternatives:["\u0433\u043D\u0435\u0437\u0434\u043E","websocket","socket"],normalized:"socket"},bind:{primary:"\u043F\u0440\u0438\u0432\u044F\u0437\u0430\u0442\u044C",alternatives:["\u0441\u0432\u044F\u0437\u0430\u0442\u044C","bind"],normalized:"bind"},intercept:{primary:"\u043F\u0435\u0440\u0435\u0445\u0432\u0430\u0442\u0438\u0442\u044C",alternatives:["\u043F\u0435\u0440\u0435\u0445\u0432\u0430\u0442\u0438","intercept"],normalized:"intercept"},worker:{primary:"\u0440\u0430\u0431\u043E\u0447\u0438\u0439",alternatives:["\u0432\u043E\u0440\u043A\u0435\u0440","worker"],normalized:"worker"},eventsource:{primary:"eventsource",alternatives:["\u0438\u0441\u0442\u043E\u0447\u043D\u0438\u043A-\u0441\u043E\u0431\u044B\u0442\u0438\u0439"],normalized:"eventsource"}},eventHandler:{keyword:{primary:"\u043F\u0440\u0438",normalized:"on"},sourceMarker:{primary:"\u043D\u0430",alternatives:["\u0432","\u043F\u0440\u0438"],position:"before"},eventMarker:{primary:"\u043F\u0440\u0438",position:"before"},temporalMarkers:["\u043A\u043E\u0433\u0434\u0430","\u0435\u0441\u043B\u0438"]}},Hn=["===","!==","->","==","!=","<=",">=","&&","||","**","+=","-=","*=","/=","+","-","*","/","=",">","<","!","&","|","%","^","~"],Gn=class{constructor(t=Hn){this.name="operator",this.operators=[...t].sort((e,r)=>r.length-e.length);}canExtract(t,e){return this.operators.some(r=>t.startsWith(r,e))}extract(t,e){for(let r of this.operators)if(t.startsWith(r,e))return {value:r,length:r.length};return null}},Yn="()[]{},:;",Zn=class{constructor(t=Yn){this.punctuation=t,this.name="punctuation";}canExtract(t,e){return this.punctuation.includes(t[e])}extract(t,e){let r=t[e];return this.punctuation.includes(r)?{value:r,length:1}:null}};function Jr(t,e){let r=t[e];if(r==="#"){let i=t.slice(e).match(/^#[a-zA-Z_][\w-]*/);return i?i[0]:null}if(r==="."){let i=t.slice(e).match(/^\.\{[a-zA-Z_$][\w$]*\}/);if(i)return i[0];let a=t.slice(e).match(/^\.[a-zA-Z_][\w-]*/);return a?a[0]:null}if(r==="@"){let i=t.slice(e).match(/^@[a-zA-Z_][\w-]*/);return i?i[0]:null}if(r==="*"){let i=t.slice(e).match(/^\*(?:--)?[a-zA-Z_][\w-]*/);return i?i[0]:null}if(r==="["){let i=0,a=e;for(;a<t.length;){if(t[a]==="["&&i++,t[a]==="]"&&(i--,i===0))return t.slice(e,a+1);a++;}return null}if(r==="<"){let i=t.slice(e).match(/^<(?=[\w.#[])[\w-]*(?:[#.][\w-]+|\[[^\]]+\])*\s*\/>/);return i?i[0]:null}return null}var Xn=class{constructor(){this.name="css-selector";}canExtract(t,e){let r=t[e];return r==="#"||r==="."||r==="["||r==="<"?true:r==="@"||r==="*"?Jr(t,e)!==null:false}extract(t,e){let r=Jr(t,e);return r?{value:r,length:r.length,metadata:{type:"css-selector"}}:null}},Jn=class{constructor(){this.name="event-modifier";}canExtract(t,e){if(t[e]!==".")return false;let r=t.slice(e);return /^\.(once|prevent|stop|debounce|throttle|queue)/.test(r)}extract(t,e){let r=t.slice(e).match(/^\.(?:once|prevent|stop|debounce|throttle|queue)(?:\(([^)]+)\))?/);if(!r)return null;let i=r[0],a=i.slice(1).split("(")[0],n=r[1];return {value:i,length:i.length,metadata:{modifierName:a,value:n?a==="queue"?n:parseInt(n,10):void 0}}}};function Qn(t,e){let r=t.slice(e);if(r.startsWith("http://")||r.startsWith("https://")){let i=r.match(/^https?:\/\/[^\s]*/);return i?i[0]:null}if(r.startsWith("//")){let i=r.match(/^\/\/[^\s]*/);return i?i[0]:null}if(r.startsWith("./")||r.startsWith("../")){let i=r.match(/^\.\.?\/[^\s]*/);return i?i[0]:null}if(r.startsWith("/")){let i=r.match(/^\/[^\s]*/);return i?i[0]:null}return null}var eu=class{constructor(){this.name="url";}canExtract(t,e){let r=t.slice(e);return r.startsWith("http://")||r.startsWith("https://")||r.startsWith("//")||r.startsWith("./")||r.startsWith("../")||r.startsWith("/")}extract(t,e){let r=Qn(t,e);return r?{value:r,length:r.length,metadata:{type:"url"}}:null}},ru=class{constructor(){this.name="variable-ref";}canExtract(t,e){let r=t[e];return (r===":"||r==="$"||r==="^")&&e+1<t.length&&/[a-zA-Z_]/.test(t[e+1])}extract(t,e){if(!this.canExtract(t,e))return null;let r=1;for(;e+r<t.length&&/[a-zA-Z0-9_]/.test(t[e+r]);)r++;return {value:t.substring(e,e+r),length:r,metadata:{type:"variable-reference"}}}};function tu(t){return {isLetter:i=>t.test(i),isIdentifierChar:i=>/[0-9]/.test(i)||t.test(i)}}var iu=class{constructor(t,e,r){this.name=t;let i=tu(e);this.isLetter=i.isLetter,this.isIdentifierChar=i.isIdentifierChar,this.prepositions=r;}setContext(t){this.context=t;}canExtract(t,e){let r=t[e];return r==="'"?false:this.isLetter(r)}extract(t,e){if(!this.context)throw new Error(`${this.name}: context not set`);let r=e,i="";for(;r<t.length&&this.isIdentifierChar(t[r]);)i+=t[r++];if(!i)return null;let a=i.toLowerCase(),n=this.prepositions.has(a),u=this.context.lookupKeyword(a),o=u&&u.normalized!==u.native?u.normalized:void 0,s;if(!u&&this.context.normalizer){let l=this.context.normalizer.normalize(i);if(l.stem!==i&&l.confidence>=.7){let c=this.context.lookupKeyword(l.stem);c&&(s=c.normalized);}}return {value:i,length:r-e,metadata:{normalized:o||s,isPreposition:n}}}},au=new Set(["\u0432","\u0432\u043E","\u043D\u0430","\u0441","\u0441\u043E","\u043A","\u043A\u043E","\u043E","\u043E\u0431","\u043E\u0431\u043E","\u0443","\u043E\u0442","\u0434\u043E","\u0438\u0437","\u0437\u0430","\u043F\u043E","\u043F\u043E\u0434","\u043D\u0430\u0434","\u043F\u0435\u0440\u0435\u0434","\u043F\u0435\u0440\u0435\u0434\u043E","\u043C\u0435\u0436\u0434\u0443","\u0447\u0435\u0440\u0435\u0437","\u0431\u0435\u0437","\u0434\u043B\u044F","\u043F\u0440\u0438","\u043F\u0440\u043E","\u043F\u043E\u0441\u043B\u0435","\u0432\u043E\u043A\u0440\u0443\u0433","\u043F\u0440\u043E\u0442\u0438\u0432","\u0432\u043C\u0435\u0441\u0442\u043E","\u043A\u0440\u043E\u043C\u0435","\u0441\u0440\u0435\u0434\u0438"]);function nu(){return [new iu("russian-keyword",/[a-zA-Zа-яА-ЯёЁ]/,au)]}function uu(t){let e=t.charCodeAt(0);return e>=65&&e<=90||e>=97&&e<=122||e===95||e===36}function ou(t){let e=t.charCodeAt(0);return e>=48&&e<=57||e>=65&&e<=90||e>=97&&e<=122||e===95||e===36}var su=class{constructor(){this.name="ascii-identifier";}setContext(t){this.context=t;}canExtract(t,e){return uu(t[e])}extract(t,e){if(!this.context)throw new Error("AsciiIdentifierExtractor: context not set");let r=e,i="",a=e;for(;a<t.length&&ou(t[a]);)i+=t[a],a++;if(!i)return null;let n=this.context.lookupKeyword(i),u=n&&n.normalized!==n.native?n.normalized:void 0;return {value:i,length:a-r,metadata:{normalized:u}}}};function lu(){return [new eu,new Jn,new ru,new Xn]}var cu=new Set(["\u0432","\u0432\u043E","\u043D\u0430","\u0441","\u0441\u043E","\u043A","\u043A\u043E","\u043E","\u043E\u0431","\u043E\u0431\u043E","\u0443","\u043E\u0442","\u0434\u043E","\u0438\u0437","\u0437\u0430","\u043F\u043E","\u043F\u043E\u0434","\u043D\u0430\u0434","\u043F\u0435\u0440\u0435\u0434","\u043F\u0435\u0440\u0435\u0434\u043E","\u043C\u0435\u0436\u0434\u0443","\u0447\u0435\u0440\u0435\u0437","\u0431\u0435\u0437","\u0434\u043B\u044F","\u043F\u0440\u0438","\u043F\u0440\u043E","\u043F\u043E\u0441\u043B\u0435","\u0432\u043E\u043A\u0440\u0443\u0433","\u043F\u0440\u043E\u0442\u0438\u0432","\u0432\u043C\u0435\u0441\u0442\u043E","\u043A\u0440\u043E\u043C\u0435","\u0441\u0440\u0435\u0434\u0438"]),mu=[{native:"\u043C\u044B\u0448\u044C\u0432\u043D\u0438\u0437",normalized:"mousedown"},{native:"\u043C\u044B\u0448\u044C\u0432\u0432\u0435\u0440\u0445",normalized:"mouseup"},{native:"\u0438\u0437\u043C\u0435\u043D\u0435\u043D\u0438\u0435\u0440\u0430\u0437\u043C\u0435\u0440\u0430",normalized:"resize"},{native:"\u0438\u0441\u0442\u0438\u043D\u0430",normalized:"true"},{native:"\u043F\u0440\u0430\u0432\u0434\u0430",normalized:"true"},{native:"\u043B\u043E\u0436\u044C",normalized:"false"},{native:"null",normalized:"null"},{native:"\u043D\u0435\u043E\u043F\u0440\u0435\u0434\u0435\u043B\u0435\u043D\u043E",normalized:"undefined"},{native:"\u0441\u0435\u043A\u0443\u043D\u0434\u0430",normalized:"s"},{native:"\u0441\u0435\u043A\u0443\u043D\u0434\u044B",normalized:"s"},{native:"\u0441\u0435\u043A\u0443\u043D\u0434",normalized:"s"},{native:"\u043C\u0438\u043B\u043B\u0438\u0441\u0435\u043A\u0443\u043D\u0434\u0430",normalized:"ms"},{native:"\u043C\u0438\u043B\u043B\u0438\u0441\u0435\u043A\u0443\u043D\u0434\u044B",normalized:"ms"},{native:"\u043C\u0438\u043B\u043B\u0438\u0441\u0435\u043A\u0443\u043D\u0434",normalized:"ms"},{native:"\u043C\u0438\u043D\u0443\u0442\u0430",normalized:"m"},{native:"\u043C\u0438\u043D\u0443\u0442\u044B",normalized:"m"},{native:"\u043C\u0438\u043D\u0443\u0442",normalized:"m"},{native:"\u0447\u0430\u0441",normalized:"h"},{native:"\u0447\u0430\u0441\u0430",normalized:"h"},{native:"\u0447\u0430\u0441\u043E\u0432",normalized:"h"},{native:"\u043F\u0435\u0440\u0432\u044B\u0439",normalized:"first"},{native:"\u043F\u043E\u0441\u043B\u0435\u0434\u043D\u0438\u0439",normalized:"last"},{native:"\u0441\u043B\u0435\u0434\u0443\u044E\u0449\u0438\u0439",normalized:"next"},{native:"\u043F\u0440\u0435\u0434\u044B\u0434\u0443\u0449\u0438\u0439",normalized:"previous"},{native:"\u0431\u043B\u0438\u0436\u0430\u0439\u0448\u0438\u0439",normalized:"closest"},{native:"\u0440\u043E\u0434\u0438\u0442\u0435\u043B\u044C",normalized:"parent"},{native:"\u0441\u043B\u0443\u0447\u0430\u0439\u043D\u044B\u0439",normalized:"random"},{native:"\u043F\u0435\u0440\u0432\u0430\u044F",normalized:"first"},{native:"\u043F\u0435\u0440\u0432\u043E\u0435",normalized:"first"},{native:"\u043F\u043E\u0441\u043B\u0435\u0434\u043D\u044F\u044F",normalized:"last"},{native:"\u043F\u043E\u0441\u043B\u0435\u0434\u043D\u0435\u0435",normalized:"last"},{native:"\u0441\u043B\u0435\u0434\u0443\u044E\u0449\u0430\u044F",normalized:"next"},{native:"\u043F\u0440\u0435\u0434\u044B\u0434\u0443\u0449\u0430\u044F",normalized:"previous"},{native:"\u043F\u0443\u0441\u0442\u0430\u044F",normalized:"empty"},{native:"\u043F\u0443\u0441\u0442\u043E\u0435",normalized:"empty"},{native:"\u043C\u043E\u044F",normalized:"my"},{native:"\u043C\u043E\u0451",normalized:"my"},{native:"\u043C\u043E\u0438",normalized:"my"}],pu=class extends Se{constructor(){super(),this.language="ru",this.direction="ltr",this.initializeKeywordsFromProfile(et,mu),this.setNormalizer(new Qr),this.registerExtractors([...lu(),...nu(),new Ae,new De,new su,new Gn,new Zn]);}classifyToken(t){let e=t.toLowerCase();return cu.has(e)?"particle":this.isKeyword(e)?"keyword":/^\.(once|prevent|stop|debounce|throttle|queue)(\(.*\))?$/.test(t)?"event-modifier":t.startsWith("#")||t.startsWith(".")||t.startsWith("[")||t.startsWith("*")||t.startsWith("<")?"selector":t.startsWith('"')||t.startsWith("'")||/^\d/.test(t)?"literal":t.startsWith("/")||t.startsWith("./")||t.startsWith("http")?"url":"identifier"}},du=new pu;Pe("ru",du,et);var it={code:"pl",name:"Polish",nativeName:"Polski",direction:"ltr",script:"latin",wordOrder:"SVO",markingStrategy:"preposition",usesSpaces:true,defaultVerbForm:"imperative",verb:{position:"start",subjectDrop:true,suffixes:["a\u0107","e\u0107","i\u0107","y\u0107","\u0105\u0107","owa\u0107"]},references:{me:"ja",it:"to",you:"ty",result:"wynik",event:"zdarzenie",target:"cel",body:"body"},possessive:{marker:"",markerPosition:"after-object",usePossessiveAdjectives:true,specialForms:{me:"m\xF3j",it:"jego",you:"tw\xF3j"},keywords:{m\u00F3j:"me",moja:"me",moje:"me",tw\u00F3j:"you",twoja:"you",twoje:"you",jego:"it",jej:"it"}},roleMarkers:{destination:{primary:"do",alternatives:["w","na"],position:"before"},source:{primary:"z",alternatives:["od","ze"],position:"before"},patient:{primary:"",position:"before"},style:{primary:"z",alternatives:["ze"],position:"before"}},keywords:{toggle:{primary:"prze\u0142\u0105cz",alternatives:["przelacz"],normalized:"toggle",form:"imperative"},add:{primary:"dodaj",normalized:"add",form:"imperative"},remove:{primary:"usu\u0144",alternatives:["usun","wyczy\u015B\u0107","wyczysc"],normalized:"remove",form:"imperative"},put:{primary:"umie\u015B\u0107",alternatives:["umiesc","wstaw"],normalized:"put",form:"imperative"},append:{primary:"do\u0142\u0105cz",alternatives:["dolacz"],normalized:"append",form:"imperative"},prepend:{primary:"poprzed\u017A",alternatives:["poprzedz"],normalized:"prepend",form:"imperative"},take:{primary:"we\u017A",alternatives:["wez"],normalized:"take",form:"imperative"},make:{primary:"utw\xF3rz",alternatives:["utworz","stw\xF3rz","stworz"],normalized:"make",form:"imperative"},clone:{primary:"sklonuj",normalized:"clone",form:"imperative"},swap:{primary:"zamie\u0144",alternatives:["zamien"],normalized:"swap",form:"imperative"},morph:{primary:"przekszta\u0142\u0107",alternatives:["przeksztalc"],normalized:"morph",form:"imperative"},set:{primary:"ustaw",alternatives:["okre\u015Bl","okresl"],normalized:"set",form:"imperative"},get:{primary:"uzyskaj",normalized:"get",form:"imperative"},increment:{primary:"zwi\u0119ksz",alternatives:["zwieksz"],normalized:"increment",form:"imperative"},decrement:{primary:"zmniejsz",normalized:"decrement",form:"imperative"},log:{primary:"loguj",alternatives:["wypisz"],normalized:"log",form:"imperative"},show:{primary:"poka\u017C",alternatives:["pokaz","wy\u015Bwietl","wyswietl"],normalized:"show",form:"imperative"},hide:{primary:"ukryj",alternatives:["schowaj"],normalized:"hide",form:"imperative"},transition:{primary:"animuj",alternatives:["przej\u015Bcie","przejscie"],normalized:"transition",form:"imperative"},on:{primary:"gdy",alternatives:["przy","na"],normalized:"on"},trigger:{primary:"wyzw\xF3l",alternatives:["wyzwol"],normalized:"trigger",form:"imperative"},send:{primary:"wy\u015Blij",alternatives:["wyslij"],normalized:"send",form:"imperative"},focus:{primary:"skup",alternatives:["skupienie"],normalized:"focus",form:"imperative"},blur:{primary:"rozmyj",alternatives:["odskup"],normalized:"blur",form:"imperative"},empty:{primary:"opr\xF3\u017Cnij",alternatives:["oproznij","pusty"],normalized:"empty"},open:{primary:"otw\xF3rz",alternatives:["otworz"],normalized:"open"},close:{primary:"zamknij",normalized:"close"},select:{primary:"zaznacz",normalized:"select"},clear:{primary:"zeruj",normalized:"clear"},reset:{primary:"zresetuj",normalized:"reset"},breakpoint:{primary:"punkt-przerwania",normalized:"breakpoint"},go:{primary:"id\u017A",alternatives:["idz","przejd\u017A","przejdz","nawiguj"],normalized:"go",form:"imperative"},scroll:{primary:"przewi\u0144",alternatives:["przewin"],normalized:"scroll",form:"imperative"},push:{primary:"wepchnij",alternatives:["push"],normalized:"push",form:"imperative"},replace:{primary:"nadpisz",alternatives:["zamie\u0144_url","zamien_url"],normalized:"replace",form:"imperative"},process:{primary:"przetw\xF3rz",alternatives:["przetworz"],normalized:"process",form:"imperative"},wait:{primary:"czekaj",alternatives:["poczekaj"],normalized:"wait",form:"imperative"},fetch:{primary:"pobierz",alternatives:["za\u0142aduj","zaladuj"],normalized:"fetch",form:"imperative"},settle:{primary:"ustabilizuj",normalized:"settle",form:"imperative"},if:{primary:"je\u015Bli",alternatives:["jesli","je\u017Celi","jezeli"],normalized:"if"},unless:{primary:"chyba",normalized:"unless"},when:{primary:"kiedy",normalized:"when"},where:{primary:"gdzie",normalized:"where"},else:{primary:"inaczej",alternatives:["wpp"],normalized:"else"},repeat:{primary:"powt\xF3rz",alternatives:["powtorz"],normalized:"repeat",form:"imperative"},for:{primary:"dla",alternatives:["ka\u017Cdy","kazdy"],normalized:"for"},while:{primary:"dop\xF3ki",alternatives:["dopoki","podczas"],normalized:"while"},forever:{primary:"forever",normalized:"forever"},continue:{primary:"kontynuuj",alternatives:["dalej"],normalized:"continue",form:"imperative"},halt:{primary:"zatrzymaj",alternatives:["stop"],normalized:"halt",form:"imperative"},throw:{primary:"rzu\u0107",alternatives:["rzuc"],normalized:"throw",form:"imperative"},call:{primary:"wywo\u0142aj",alternatives:["wywolaj"],normalized:"call",form:"imperative"},return:{primary:"zwr\xF3\u0107",alternatives:["zwroc"],normalized:"return",form:"imperative"},then:{primary:"wtedy",alternatives:["potem","nast\u0119pnie","nastepnie"],normalized:"then"},and:{primary:"i",alternatives:["oraz"],normalized:"and"},end:{primary:"koniec",normalized:"end"},js:{primary:"js",normalized:"js"},async:{primary:"async",alternatives:["asynchronicznie"],normalized:"async"},tell:{primary:"powiedz",normalized:"tell",form:"imperative"},default:{primary:"domy\u015Blnie",alternatives:["domyslnie"],normalized:"default"},init:{primary:"inicjuj",normalized:"init",form:"imperative"},behavior:{primary:"zachowanie",normalized:"behavior"},install:{primary:"zainstaluj",normalized:"install",form:"imperative"},measure:{primary:"zmierz",normalized:"measure",form:"imperative"},beep:{primary:"sygna\u0142",normalized:"beep"},break:{primary:"przerwij",normalized:"break"},copy:{primary:"kopiuj",normalized:"copy"},exit:{primary:"wyjd\u017A",normalized:"exit"},pick:{primary:"wybierz",normalized:"pick"},render:{primary:"renderuj",normalized:"render"},into:{primary:"do",alternatives:["w"],normalized:"into"},before:{primary:"przed",normalized:"before"},after:{primary:"po",normalized:"after"},click:{primary:"klikni\u0119ciu",alternatives:["klikniecie","klik"],normalized:"click"},resize:{primary:"zmie\u0144rozmiar",normalized:"resize"},hover:{primary:"najechaniu",alternatives:["hover"],normalized:"hover"},submit:{primary:"wys\u0142aniu",alternatives:["wyslaniu","submit"],normalized:"submit"},input:{primary:"wprowadzeniu",alternatives:["input","wej\u015Bcie"],normalized:"input"},change:{primary:"zmianie",alternatives:["zmiana"],normalized:"change"},until:{primary:"a\u017C",alternatives:["az"],normalized:"until"},event:{primary:"zdarzenie",normalized:"event"},from:{primary:"z",alternatives:["od","ze"],normalized:"from"},connect:{primary:"po\u0142\u0105cz",alternatives:["pod\u0142\u0105cz"],normalized:"connect"},stream:{primary:"transmituj",alternatives:["strumie\u0144","streamuj"],normalized:"stream"},live:{primary:"na-\u017Cywo",alternatives:["na-bie\u017C\u0105co","live","\u017Cywy"],normalized:"live"},socket:{primary:"gniazdo",alternatives:["socket","websocket"],normalized:"socket"},bind:{primary:"powi\u0105\u017C",alternatives:["zwi\u0105za\u0107","bind"],normalized:"bind"},intercept:{primary:"przechwy\u0107",alternatives:["przechwytuj","intercept"],normalized:"intercept"},worker:{primary:"pracownik",alternatives:["worker"],normalized:"worker"},eventsource:{primary:"eventsource",alternatives:["\u017Ar\xF3d\u0142o-zdarze\u0144"],normalized:"eventsource"}},eventHandler:{keyword:{primary:"gdy",alternatives:["przy","na"],normalized:"on"},sourceMarker:{primary:"na",alternatives:["w","przy"],position:"before"},conditionalKeyword:{primary:"kiedy",alternatives:["gdy","je\u015Bli"]},eventMarker:{primary:"przy",alternatives:["na","gdy"],position:"before"},temporalMarkers:["kiedy","gdy","przy"]}},rt=new Map([["prze\u0142\u0105cz","prze\u0142\u0105cza\u0107"],["przelacz","przelaczac"],["dodaj","dodawa\u0107"],["usu\u0144","usuwa\u0107"],["usun","usuwac"],["umie\u015B\u0107","umieszcza\u0107"],["umiesc","umieszczac"],["wstaw","wstawia\u0107"],["ustaw","ustawia\u0107"],["pobierz","pobiera\u0107"],["we\u017A","bra\u0107"],["wez","brac"],["zwi\u0119ksz","zwi\u0119ksza\u0107"],["zwieksz","zwiekszac"],["zmniejsz","zmniejsza\u0107"],["poka\u017C","pokazywa\u0107"],["pokaz","pokazywac"],["ukryj","ukrywa\u0107"],["schowaj","schowywa\u0107"],["czekaj","czeka\u0107"],["poczekaj","poczeka\u0107"],["id\u017A","i\u015B\u0107"],["idz","isc"],["przejd\u017A","przej\u015B\u0107"],["przejdz","przejsc"],["wywo\u0142aj","wywo\u0142ywa\u0107"],["wywolaj","wywolywac"],["wy\u015Blij","wysy\u0142a\u0107"],["wyslij","wysylac"],["loguj","logowa\u0107"],["wypisz","wypisywa\u0107"],["sklonuj","sklonowa\u0107"],["kopiuj","kopiowa\u0107"],["zamie\u0144","zamienia\u0107"],["zamien","zamieniac"],["utw\xF3rz","tworzy\u0107"],["utworz","tworzyc"],["stw\xF3rz","stwarza\u0107"],["stworz","stwarzac"],["skup","skupia\u0107"],["rozmyj","rozmywa\u0107"],["nawiguj","nawigowa\u0107"],["za\u0142aduj","\u0142adowa\u0107"],["zaladuj","ladowac"],["powt\xF3rz","powtarza\u0107"],["powtorz","powtarzac"],["kontynuuj","kontynuowa\u0107"],["zatrzymaj","zatrzymywa\u0107"],["przerwij","przerywa\u0107"],["rzu\u0107","rzuca\u0107"],["rzuc","rzucac"],["zwr\xF3\u0107","zwraca\u0107"],["zwroc","zwracac"],["inicjuj","inicjowa\u0107"],["zainstaluj","instalowa\u0107"],["zmierz","mierzy\u0107"]]),at=class{constructor(){this.language="pl";}isNormalizable(t){return t.length<3?false:/[a-zA-ZąęćńóśźżłĄĘĆŃÓŚŹŻŁ]/.test(t)}normalize(t){let e=t.toLowerCase();if(this.isInfinitive(e))return K(e);let r=this.tryImperativeNormalization(e);if(r)return r;let i=this.tryPastTenseNormalization(e);if(i)return i;let a=this.tryPresentTenseNormalization(e);return a||K(e)}isInfinitive(t){return ["a\u0107","e\u0107","i\u0107","y\u0107","\u0105\u0107","owa\u0107","iwa\u0107","ywa\u0107"].some(r=>t.endsWith(r))}tryImperativeNormalization(t){return rt.has(t)?D(rt.get(t),.95,{removedSuffixes:["imperative"],conjugationType:"imperative"}):t.endsWith("aj")?D(t.slice(0,-2)+"a\u0107",.8,{removedSuffixes:["aj"],conjugationType:"imperative"}):t.endsWith("uj")?D(t.slice(0,-2)+"owa\u0107",.8,{removedSuffixes:["uj"],conjugationType:"imperative"}):t.endsWith("ij")?D(t.slice(0,-2)+"i\u0107",.75,{removedSuffixes:["ij"],conjugationType:"imperative"}):null}tryPresentTenseNormalization(t){return t.endsWith("uj\u0119")||t.endsWith("uje")?D(t.slice(0,-3)+"owa\u0107",.85,{removedSuffixes:["uj\u0119"],conjugationType:"present"}):t.endsWith("am")&&t.length>3?D(t.slice(0,-2)+"a\u0107",.8,{removedSuffixes:["am"],conjugationType:"present"}):t.endsWith("em")&&t.length>3?D(t.slice(0,-2)+"e\u0107",.75,{removedSuffixes:["em"],conjugationType:"present"}):t.endsWith("\u0119")&&t.length>2?D(t.slice(0,-1)+"a\u0107",.7,{removedSuffixes:["\u0119"],conjugationType:"present"}):null}tryPastTenseNormalization(t){if(t.endsWith("a\u0142em")||t.endsWith("a\u0142am"))return D(t.slice(0,-4)+"a\u0107",.85,{removedSuffixes:[t.slice(-4)],conjugationType:"past"});if(t.endsWith("a\u0142")||t.endsWith("a\u0142a")){let e=t.endsWith("a\u0142a")?3:2;return D(t.slice(0,-e)+"a\u0107",.8,{removedSuffixes:[t.slice(-e)],conjugationType:"past"})}if(t.endsWith("i\u0142em")||t.endsWith("i\u0142am")||t.endsWith("ilem")||t.endsWith("ilam"))return D(t.slice(0,-4)+"i\u0107",.85,{removedSuffixes:[t.slice(-4)],conjugationType:"past"});if(t.endsWith("i\u0142")||t.endsWith("i\u0142a")||t.endsWith("il")||t.endsWith("ila")){let e=t.endsWith("i\u0142a")||t.endsWith("ila")?3:2;return D(t.slice(0,-e)+"i\u0107",.8,{removedSuffixes:[t.slice(-e)],conjugationType:"past"})}return null}},fu=["===","!==","->","==","!=","<=",">=","&&","||","**","+=","-=","*=","/=","+","-","*","/","=",">","<","!","&","|","%","^","~"],yu=class{constructor(t=fu){this.name="operator",this.operators=[...t].sort((e,r)=>r.length-e.length);}canExtract(t,e){return this.operators.some(r=>t.startsWith(r,e))}extract(t,e){for(let r of this.operators)if(t.startsWith(r,e))return {value:r,length:r.length};return null}},vu="()[]{},:;",hu=class{constructor(t=vu){this.punctuation=t,this.name="punctuation";}canExtract(t,e){return this.punctuation.includes(t[e])}extract(t,e){let r=t[e];return this.punctuation.includes(r)?{value:r,length:1}:null}};function tt(t,e){let r=t[e];if(r==="#"){let i=t.slice(e).match(/^#[a-zA-Z_][\w-]*/);return i?i[0]:null}if(r==="."){let i=t.slice(e).match(/^\.\{[a-zA-Z_$][\w$]*\}/);if(i)return i[0];let a=t.slice(e).match(/^\.[a-zA-Z_][\w-]*/);return a?a[0]:null}if(r==="@"){let i=t.slice(e).match(/^@[a-zA-Z_][\w-]*/);return i?i[0]:null}if(r==="*"){let i=t.slice(e).match(/^\*(?:--)?[a-zA-Z_][\w-]*/);return i?i[0]:null}if(r==="["){let i=0,a=e;for(;a<t.length;){if(t[a]==="["&&i++,t[a]==="]"&&(i--,i===0))return t.slice(e,a+1);a++;}return null}if(r==="<"){let i=t.slice(e).match(/^<(?=[\w.#[])[\w-]*(?:[#.][\w-]+|\[[^\]]+\])*\s*\/>/);return i?i[0]:null}return null}var Eu=class{constructor(){this.name="css-selector";}canExtract(t,e){let r=t[e];return r==="#"||r==="."||r==="["||r==="<"?true:r==="@"||r==="*"?tt(t,e)!==null:false}extract(t,e){let r=tt(t,e);return r?{value:r,length:r.length,metadata:{type:"css-selector"}}:null}},zu=class{constructor(){this.name="event-modifier";}canExtract(t,e){if(t[e]!==".")return false;let r=t.slice(e);return /^\.(once|prevent|stop|debounce|throttle|queue)/.test(r)}extract(t,e){let r=t.slice(e).match(/^\.(?:once|prevent|stop|debounce|throttle|queue)(?:\(([^)]+)\))?/);if(!r)return null;let i=r[0],a=i.slice(1).split("(")[0],n=r[1];return {value:i,length:i.length,metadata:{modifierName:a,value:n?a==="queue"?n:parseInt(n,10):void 0}}}};function gu(t,e){let r=t.slice(e);if(r.startsWith("http://")||r.startsWith("https://")){let i=r.match(/^https?:\/\/[^\s]*/);return i?i[0]:null}if(r.startsWith("//")){let i=r.match(/^\/\/[^\s]*/);return i?i[0]:null}if(r.startsWith("./")||r.startsWith("../")){let i=r.match(/^\.\.?\/[^\s]*/);return i?i[0]:null}if(r.startsWith("/")){let i=r.match(/^\/[^\s]*/);return i?i[0]:null}return null}var ku=class{constructor(){this.name="url";}canExtract(t,e){let r=t.slice(e);return r.startsWith("http://")||r.startsWith("https://")||r.startsWith("//")||r.startsWith("./")||r.startsWith("../")||r.startsWith("/")}extract(t,e){let r=gu(t,e);return r?{value:r,length:r.length,metadata:{type:"url"}}:null}},Cu=class{constructor(){this.name="variable-ref";}canExtract(t,e){let r=t[e];return (r===":"||r==="$"||r==="^")&&e+1<t.length&&/[a-zA-Z_]/.test(t[e+1])}extract(t,e){if(!this.canExtract(t,e))return null;let r=1;for(;e+r<t.length&&/[a-zA-Z0-9_]/.test(t[e+r]);)r++;return {value:t.substring(e,e+r),length:r,metadata:{type:"variable-reference"}}}},bu=new Set(["do","od","z","ze","w","we","na","po","pod","przed","za","nad","mi\u0119dzy","miedzy","przez","dla","bez","o","przy","u","wed\u0142ug","wedlug","mimo","w\u015Br\xF3d","wsrod","obok","poza","wok\xF3\u0142","wokol","przeciw","ku"]);function wu(){let t=/[a-zA-ZąęćńóśźżłĄĘĆŃÓŚŹŻŁ]/;return {isLetter:i=>t.test(i),isIdentifierChar:i=>/[0-9]/.test(i)||t.test(i)}}var{isLetter:Au,isIdentifierChar:Du}=wu(),Su=class{constructor(){this.name="polish-keyword";}setContext(t){this.context=t;}canExtract(t,e){return Au(t[e])}extract(t,e){if(!this.context)throw new Error("PolishKeywordExtractor: context not set");let r=e,i="";for(;r<t.length&&Du(t[r]);)i+=t[r++];if(!i)return null;let a=i.toLowerCase(),n=bu.has(a),u=this.context.lookupKeyword(a),o=u&&u.normalized!==u.native?u.normalized:void 0,s;if(!u&&this.context.normalizer){let l=this.context.normalizer.normalize(i);if(l.stem!==i&&l.confidence>=.7){let c=this.context.lookupKeyword(l.stem);c&&(s=c.normalized);}}return {value:i,length:r-e,metadata:{normalized:o||s,isPreposition:n}}}};function xu(){return [new Su]}function Bu(){return [new ku,new zu,new Cu,new Eu]}var Fu=new Set(["do","od","z","ze","w","we","na","po","pod","przed","za","nad","mi\u0119dzy","miedzy","przez","dla","bez","o","przy","u","wed\u0142ug","wedlug","mimo","w\u015Br\xF3d","wsrod","obok","poza","wok\xF3\u0142","wokol","przeciw","ku"]),Tu=[{native:"prawda",normalized:"true"},{native:"fa\u0142sz",normalized:"false"},{native:"falsz",normalized:"false"},{native:"null",normalized:"null"},{native:"nieokre\u015Blony",normalized:"undefined"},{native:"nieokreslony",normalized:"undefined"},{native:"pierwszy",normalized:"first"},{native:"pierwsza",normalized:"first"},{native:"pierwsze",normalized:"first"},{native:"ostatni",normalized:"last"},{native:"ostatnia",normalized:"last"},{native:"ostatnie",normalized:"last"},{native:"nast\u0119pny",normalized:"next"},{native:"nastepny",normalized:"next"},{native:"poprzedni",normalized:"previous"},{native:"najbli\u017Cszy",normalized:"closest"},{native:"najblizszy",normalized:"closest"},{native:"rodzic",normalized:"parent"},{native:"klikni\u0119cie",normalized:"click"},{native:"klikniecie",normalized:"click"},{native:"klik",normalized:"click"},{native:"click",normalized:"click"},{native:"zmiana",normalized:"change"},{native:"wys\u0142anie",normalized:"submit"},{native:"wyslanie",normalized:"submit"},{native:"naci\u015Bni\u0119cie",normalized:"keydown"},{native:"nacisniecie",normalized:"keydown"},{native:"klawisz",normalized:"keydown"},{native:"najechanie",normalized:"mouseover"},{native:"zjechanie",normalized:"mouseout"},{native:"rozmycie",normalized:"blur"},{native:"za\u0142adowanie",normalized:"load"},{native:"zaladowanie",normalized:"load"},{native:"przewini\u0119cie",normalized:"scroll"},{native:"przewiniecie",normalized:"scroll"},{native:"input",normalized:"input"},{native:"m\xF3j",normalized:"my"},{native:"moj",normalized:"my"},{native:"sekunda",normalized:"s"},{native:"sekundy",normalized:"s"},{native:"sekund",normalized:"s"},{native:"milisekunda",normalized:"ms"},{native:"milisekundy",normalized:"ms"},{native:"milisekund",normalized:"ms"},{native:"minuta",normalized:"m"},{native:"minuty",normalized:"m"},{native:"minut",normalized:"m"},{native:"godzina",normalized:"h"},{native:"godziny",normalized:"h"},{native:"godzin",normalized:"h"},{native:"po\u0142\xF3\u017C",normalized:"put"},{native:"poloz",normalized:"put"},{native:"lub",normalized:"or"},{native:"nie",normalized:"not"},{native:"jest",normalized:"is"},{native:"istnieje",normalized:"exists"},{native:"pusty",normalized:"empty"},{native:"puste",normalized:"empty"}],Ou=class extends Se{constructor(){super(),this.language="pl",this.direction="ltr",this.initializeKeywordsFromProfile(it,Tu),this.setNormalizer(new at),this.registerExtractors(Bu()),this.registerExtractor(new Ae),this.registerExtractor(new De),this.registerExtractors(xu()),this.registerExtractor(new yu),this.registerExtractor(new hu);}classifyToken(t){let e=t.toLowerCase();return Fu.has(e)?"particle":this.isKeyword(e)?"keyword":/^\.(once|prevent|stop|debounce|throttle|queue)(\(.*\))?$/.test(t)?"event-modifier":t.startsWith("#")||t.startsWith(".")||t.startsWith("[")||t.startsWith("*")||t.startsWith("<")?"selector":t.startsWith('"')||t.startsWith("'")||/^\d/.test(t)?"literal":["==","!=","<=",">=","<",">","&&","||","!"].includes(t)?"operator":t.startsWith("/")||t.startsWith("./")||t.startsWith("http")?"url":"identifier"}},Ru=new Ou;Pe("pl",Ru,it);function Pu(t){return /[а-яА-ЯіІїЇєЄґҐьЬ']/.test(t)}var nt=new Map([["\u043F\u0435\u0440\u0435\u043C\u043A\u043D\u0438","\u043F\u0435\u0440\u0435\u043C\u043A\u043D\u0443\u0442\u0438"],["\u0434\u043E\u0434\u0430\u0439","\u0434\u043E\u0434\u0430\u0442\u0438"],["\u0432\u0438\u0434\u0430\u043B\u0438","\u0432\u0438\u0434\u0430\u043B\u0438\u0442\u0438"],["\u043F\u0440\u0438\u0431\u0435\u0440\u0438","\u043F\u0440\u0438\u0431\u0440\u0430\u0442\u0438"],["\u043F\u043E\u043A\u043B\u0430\u0434\u0438","\u043F\u043E\u043A\u043B\u0430\u0441\u0442\u0438"],["\u043F\u043E\u043C\u0456\u0441\u0442\u0438","\u043F\u043E\u043C\u0456\u0441\u0442\u0438\u0442\u0438"],["\u0432\u0441\u0442\u0430\u0432","\u0432\u0441\u0442\u0430\u0432\u0438\u0442\u0438"],["\u0432\u0456\u0437\u044C\u043C\u0438","\u0432\u0437\u044F\u0442\u0438"],["\u0441\u0442\u0432\u043E\u0440\u0438","\u0441\u0442\u0432\u043E\u0440\u0438\u0442\u0438"],["\u043A\u043B\u043E\u043D\u0443\u0439","\u043A\u043B\u043E\u043D\u0443\u0432\u0430\u0442\u0438"],["\u043F\u043E\u043C\u0456\u043D\u044F\u0439","\u043F\u043E\u043C\u0456\u043D\u044F\u0442\u0438"],["\u0442\u0440\u0430\u043D\u0441\u0444\u043E\u0440\u043C\u0443\u0439","\u0442\u0440\u0430\u043D\u0441\u0444\u043E\u0440\u043C\u0443\u0432\u0430\u0442\u0438"],["\u0432\u0441\u0442\u0430\u043D\u043E\u0432\u0438","\u0432\u0441\u0442\u0430\u043D\u043E\u0432\u0438\u0442\u0438"],["\u0437\u0430\u0434\u0430\u0439","\u0437\u0430\u0434\u0430\u0442\u0438"],["\u043E\u0442\u0440\u0438\u043C\u0430\u0439","\u043E\u0442\u0440\u0438\u043C\u0430\u0442\u0438"],["\u0437\u0431\u0456\u043B\u044C\u0448","\u0437\u0431\u0456\u043B\u044C\u0448\u0438\u0442\u0438"],["\u0437\u043C\u0435\u043D\u0448","\u0437\u043C\u0435\u043D\u0448\u0438\u0442\u0438"],["\u0437\u0430\u043F\u0438\u0448\u0438","\u0437\u0430\u043F\u0438\u0441\u0430\u0442\u0438"],["\u043F\u043E\u043A\u0430\u0436\u0438","\u043F\u043E\u043A\u0430\u0437\u0430\u0442\u0438"],["\u0441\u0445\u043E\u0432\u0430\u0439","\u0441\u0445\u043E\u0432\u0430\u0442\u0438"],["\u043F\u0440\u0438\u0445\u043E\u0432\u0430\u0439","\u043F\u0440\u0438\u0445\u043E\u0432\u0430\u0442\u0438"],["\u0430\u043D\u0456\u043C\u0443\u0439","\u0430\u043D\u0456\u043C\u0443\u0432\u0430\u0442\u0438"],["\u0432\u0438\u043A\u043B\u0438\u0447","\u0432\u0438\u043A\u043B\u0438\u043A\u0430\u0442\u0438"],["\u043D\u0430\u0434\u0456\u0448\u043B\u0438","\u043D\u0430\u0434\u0456\u0441\u043B\u0430\u0442\u0438"],["\u0441\u0444\u043E\u043A\u0443\u0441\u0443\u0439","\u0441\u0444\u043E\u043A\u0443\u0441\u0443\u0432\u0430\u0442\u0438"],["\u0440\u043E\u0437\u0444\u043E\u043A\u0443\u0441\u0443\u0439","\u0440\u043E\u0437\u0444\u043E\u043A\u0443\u0441\u0443\u0432\u0430\u0442\u0438"],["\u043F\u0435\u0440\u0435\u0439\u0434\u0438","\u043F\u0435\u0440\u0435\u0439\u0442\u0438"],["\u0439\u0434\u0438","\u0439\u0442\u0438"],["\u0447\u0435\u043A\u0430\u0439","\u0447\u0435\u043A\u0430\u0442\u0438"],["\u0437\u0430\u0447\u0435\u043A\u0430\u0439","\u0437\u0430\u0447\u0435\u043A\u0430\u0442\u0438"],["\u0437\u0430\u0432\u0430\u043D\u0442\u0430\u0436","\u0437\u0430\u0432\u0430\u043D\u0442\u0430\u0436\u0438\u0442\u0438"],["\u043F\u043E\u0432\u0442\u043E\u0440\u0438","\u043F\u043E\u0432\u0442\u043E\u0440\u0438\u0442\u0438"],["\u043F\u0440\u043E\u0434\u043E\u0432\u0436\u0443\u0439","\u043F\u0440\u043E\u0434\u043E\u0432\u0436\u0438\u0442\u0438"],["\u043A\u0438\u043D\u044C","\u043A\u0438\u043D\u0443\u0442\u0438"],["\u043F\u043E\u0432\u0435\u0440\u043D\u0438","\u043F\u043E\u0432\u0435\u0440\u043D\u0443\u0442\u0438"],["\u0441\u043A\u0430\u0436\u0438","\u0441\u043A\u0430\u0437\u0430\u0442\u0438"],["\u0456\u043D\u0456\u0446\u0456\u0430\u043B\u0456\u0437\u0443\u0439","\u0456\u043D\u0456\u0446\u0456\u0430\u043B\u0456\u0437\u0443\u0432\u0430\u0442\u0438"],["\u0432\u0438\u043C\u0456\u0440\u044F\u0439","\u0432\u0438\u043C\u0456\u0440\u044F\u0442\u0438"]]),ot=class{constructor(){this.language="uk";}isNormalizable(t){return t.length<3?false:Pu(t)}normalize(t){let e=t.toLowerCase();if(e.endsWith("\u0441\u044F")||e.endsWith("\u0441\u044C")){let u=this.tryReflexiveNormalization(e);if(u)return u}if(e.endsWith("\u0442\u0438")||e.endsWith("\u0447\u0438"))return K(t);let r=this.tryImperativeLookup(e);if(r)return r;let i=this.tryPastTenseNormalization(e);if(i)return i;let a=this.tryPresentTenseNormalization(e);if(a)return a;let n=this.tryGenericImperativeNormalization(e);return n||K(t)}tryReflexiveNormalization(t){let e=t.slice(0,-2);if(t.endsWith("\u0442\u0438\u0441\u044F")||t.endsWith("\u0447\u0438\u0441\u044F"))return K(t);let r=this.normalizeNonReflexive(e);if(r.confidence<1){let i=r.stem.endsWith("\u0442\u0438")?r.stem.slice(0,-2)+"\u0442\u0438\u0441\u044F":r.stem+"\u0441\u044F";return D(i,r.confidence*.95,{removedSuffixes:["\u0441\u044F",...r.metadata?.removedSuffixes||[]],conjugationType:"reflexive"})}return null}normalizeNonReflexive(t){if(t.endsWith("\u0442\u0438")||t.endsWith("\u0447\u0438"))return K(t);let e=this.tryImperativeLookup(t);if(e)return e;let r=this.tryPastTenseNormalization(t);if(r)return r;let i=this.tryPresentTenseNormalization(t);if(i)return i;let a=this.tryGenericImperativeNormalization(t);return a||K(t)}tryImperativeLookup(t){return nt.has(t)?D(nt.get(t),.95,{removedSuffixes:["imperative"],conjugationType:"imperative"}):null}tryGenericImperativeNormalization(t){return t.endsWith("\u0439\u0442\u0435")&&t.length>5?D(t.slice(0,-3)+"\u0442\u0438",.8,{removedSuffixes:["\u0439\u0442\u0435"],conjugationType:"imperative"}):t.endsWith("\u0456\u0442\u044C")&&t.length>5?D(t.slice(0,-3)+"\u0438\u0442\u0438",.8,{removedSuffixes:["\u0456\u0442\u044C"],conjugationType:"imperative"}):t.endsWith("\u0439")&&t.length>3?D(t.slice(0,-1)+"\u0442\u0438",.75,{removedSuffixes:["\u0439"],conjugationType:"imperative"}):t.endsWith("\u0438")&&t.length>3?D(t+"\u0442\u0438",.7,{removedSuffixes:["\u0438\u2192\u0438\u0442\u0438"],conjugationType:"imperative"}):null}tryPastTenseNormalization(t){return t.endsWith("\u0430\u043B\u0430")&&t.length>4?D(t.slice(0,-3)+"\u0430\u0442\u0438",.85,{removedSuffixes:["\u0430\u043B\u0430"],conjugationType:"past"}):t.endsWith("\u0438\u043B\u0430")&&t.length>4?D(t.slice(0,-3)+"\u0438\u0442\u0438",.85,{removedSuffixes:["\u0438\u043B\u0430"],conjugationType:"past"}):t.endsWith("\u0430\u043B\u0438")&&t.length>4?D(t.slice(0,-3)+"\u0430\u0442\u0438",.85,{removedSuffixes:["\u0430\u043B\u0438"],conjugationType:"past"}):t.endsWith("\u0438\u043B\u0438")&&t.length>4?D(t.slice(0,-3)+"\u0438\u0442\u0438",.85,{removedSuffixes:["\u0438\u043B\u0438"],conjugationType:"past"}):t.endsWith("\u0430\u0432")&&t.length>3?D(t.slice(0,-2)+"\u0430\u0442\u0438",.82,{removedSuffixes:["\u0430\u0432"],conjugationType:"past"}):t.endsWith("\u0438\u0432")&&t.length>3?D(t.slice(0,-2)+"\u0438\u0442\u0438",.82,{removedSuffixes:["\u0438\u0432"],conjugationType:"past"}):null}tryPresentTenseNormalization(t){return t.endsWith("\u0438\u0448")&&t.length>3?D(t.slice(0,-2)+"\u0438\u0442\u0438",.8,{removedSuffixes:["\u0438\u0448"],conjugationType:"present"}):t.endsWith("\u0438\u0442\u044C")&&t.length>4?D(t.slice(0,-3)+"\u0438\u0442\u0438",.78,{removedSuffixes:["\u0438\u0442\u044C"],conjugationType:"present"}):t.endsWith("\u0438\u043C\u043E")&&t.length>4?D(t.slice(0,-3)+"\u0438\u0442\u0438",.8,{removedSuffixes:["\u0438\u043C\u043E"],conjugationType:"present"}):t.endsWith("\u044F\u0442\u044C")&&t.length>4?D(t.slice(0,-3)+"\u0438\u0442\u0438",.78,{removedSuffixes:["\u044F\u0442\u044C"],conjugationType:"present"}):t.endsWith("\u0454\u0448")&&t.length>3?D(t.slice(0,-2)+"\u0430\u0442\u0438",.78,{removedSuffixes:["\u0454\u0448"],conjugationType:"present"}):t.endsWith("\u0435\u0448")&&t.length>3?D(t.slice(0,-2)+"\u0430\u0442\u0438",.75,{removedSuffixes:["\u0435\u0448"],conjugationType:"present"}):t.endsWith("\u0454")&&t.length>2?D(t.slice(0,-1)+"\u0430\u0442\u0438",.72,{removedSuffixes:["\u0454"],conjugationType:"present"}):t.endsWith("\u0454\u043C\u043E")&&t.length>4?D(t.slice(0,-3)+"\u0430\u0442\u0438",.8,{removedSuffixes:["\u0454\u043C\u043E"],conjugationType:"present"}):t.endsWith("\u044E\u0442\u044C")&&t.length>4?D(t.slice(0,-3)+"\u0430\u0442\u0438",.78,{removedSuffixes:["\u044E\u0442\u044C"],conjugationType:"present"}):t.endsWith("\u0443\u0442\u044C")&&t.length>4?D(t.slice(0,-3)+"\u0430\u0442\u0438",.75,{removedSuffixes:["\u0443\u0442\u044C"],conjugationType:"present"}):null}},st={code:"uk",name:"Ukrainian",nativeName:"\u0423\u043A\u0440\u0430\u0457\u043D\u0441\u044C\u043A\u0430",direction:"ltr",script:"cyrillic",wordOrder:"SVO",markingStrategy:"preposition",usesSpaces:true,defaultVerbForm:"infinitive",verb:{position:"start",subjectDrop:true,suffixes:["\u0442\u0438","\u0442\u0438\u0441\u044F","\u0438\u0442\u0438","\u0438\u0442\u0438\u0441\u044F","\u0430\u0442\u0438","\u0430\u0442\u0438\u0441\u044F","\u0456\u0442\u0438","\u0456\u0442\u0438\u0441\u044F"]},references:{me:"\u044F",it:"\u0446\u0435",you:"\u0442\u0438",result:"\u0440\u0435\u0437\u0443\u043B\u044C\u0442\u0430\u0442",event:"\u043F\u043E\u0434\u0456\u044F",target:"\u0446\u0456\u043B\u044C",body:"\u0442\u0456\u043B\u043E"},possessive:{marker:"",markerPosition:"after-object",usePossessiveAdjectives:true,specialForms:{me:"\u043C\u0456\u0439",it:"\u0439\u043E\u0433\u043E",you:"\u0442\u0432\u0456\u0439"},keywords:{\u043C\u0456\u0439:"me",\u043C\u043E\u044F:"me",\u043C\u043E\u0454:"me",\u043C\u043E\u0457:"me",\u0442\u0432\u0456\u0439:"you",\u0442\u0432\u043E\u044F:"you",\u0442\u0432\u043E\u0454:"you",\u0442\u0432\u043E\u0457:"you",\u0439\u043E\u0433\u043E:"it",\u0457\u0457:"it"}},roleMarkers:{destination:{primary:"\u0432",alternatives:["\u043D\u0430","\u0434\u043E"],position:"before"},source:{primary:"\u0437",alternatives:["\u0432\u0456\u0434","\u0456\u0437"],position:"before"},patient:{primary:"",position:"before"},style:{primary:"\u0437",alternatives:["\u0456\u0437"],position:"before"}},keywords:{toggle:{primary:"\u043F\u0435\u0440\u0435\u043C\u043A\u043D\u0443\u0442\u0438",alternatives:["\u043F\u0435\u0440\u0435\u043C\u043A\u043D\u0438"],normalized:"toggle",form:"infinitive"},add:{primary:"\u0434\u043E\u0434\u0430\u0442\u0438",alternatives:["\u0434\u043E\u0434\u0430\u0439"],normalized:"add",form:"infinitive"},remove:{primary:"\u0432\u0438\u0434\u0430\u043B\u0438\u0442\u0438",alternatives:["\u0432\u0438\u0434\u0430\u043B\u0438","\u043F\u0440\u0438\u0431\u0440\u0430\u0442\u0438","\u043F\u0440\u0438\u0431\u0435\u0440\u0438"],normalized:"remove",form:"infinitive"},put:{primary:"\u043F\u043E\u043A\u043B\u0430\u0441\u0442\u0438",alternatives:["\u043F\u043E\u043A\u043B\u0430\u0434\u0438","\u043F\u043E\u043C\u0456\u0441\u0442\u0438\u0442\u0438","\u043F\u043E\u043C\u0456\u0441\u0442\u0438","\u0432\u0441\u0442\u0430\u0432\u0438\u0442\u0438","\u0432\u0441\u0442\u0430\u0432"],normalized:"put",form:"infinitive"},append:{primary:"\u0434\u043E\u0434\u0430\u0442\u0438_\u0432_\u043A\u0456\u043D\u0435\u0446\u044C",alternatives:["\u0434\u043E\u043F\u0438\u0441\u0430\u0442\u0438"],normalized:"append",form:"infinitive"},prepend:{primary:"\u0434\u043E\u0434\u0430\u0442\u0438_\u043D\u0430_\u043F\u043E\u0447\u0430\u0442\u043E\u043A",normalized:"prepend",form:"infinitive"},take:{primary:"\u0432\u0437\u044F\u0442\u0438",alternatives:["\u0432\u0456\u0437\u044C\u043C\u0438"],normalized:"take",form:"infinitive"},make:{primary:"\u0441\u0442\u0432\u043E\u0440\u0438\u0442\u0438",alternatives:["\u0441\u0442\u0432\u043E\u0440\u0438"],normalized:"make",form:"infinitive"},clone:{primary:"\u043A\u043B\u043E\u043D\u0443\u0432\u0430\u0442\u0438",alternatives:["\u043A\u043B\u043E\u043D\u0443\u0439"],normalized:"clone",form:"infinitive"},swap:{primary:"\u043F\u043E\u043C\u0456\u043D\u044F\u0442\u0438",alternatives:["\u043F\u043E\u043C\u0456\u043D\u044F\u0439"],normalized:"swap",form:"infinitive"},morph:{primary:"\u0442\u0440\u0430\u043D\u0441\u0444\u043E\u0440\u043C\u0443\u0432\u0430\u0442\u0438",alternatives:["\u0442\u0440\u0430\u043D\u0441\u0444\u043E\u0440\u043C\u0443\u0439"],normalized:"morph",form:"infinitive"},set:{primary:"\u0432\u0441\u0442\u0430\u043D\u043E\u0432\u0438\u0442\u0438",alternatives:["\u0432\u0441\u0442\u0430\u043D\u043E\u0432\u0438","\u0437\u0430\u0434\u0430\u0442\u0438","\u0437\u0430\u0434\u0430\u0439"],normalized:"set",form:"infinitive"},get:{primary:"\u043E\u0442\u0440\u0438\u043C\u0430\u0442\u0438",alternatives:["\u043E\u0442\u0440\u0438\u043C\u0430\u0439"],normalized:"get",form:"infinitive"},increment:{primary:"\u0437\u0431\u0456\u043B\u044C\u0448\u0438\u0442\u0438",alternatives:["\u0437\u0431\u0456\u043B\u044C\u0448"],normalized:"increment",form:"infinitive"},decrement:{primary:"\u0437\u043C\u0435\u043D\u0448\u0438\u0442\u0438",alternatives:["\u0437\u043C\u0435\u043D\u0448"],normalized:"decrement",form:"infinitive"},log:{primary:"\u0437\u0430\u043F\u0438\u0441\u0430\u0442\u0438",alternatives:["\u0437\u0430\u043F\u0438\u0448\u0438"],normalized:"log",form:"infinitive"},show:{primary:"\u043F\u043E\u043A\u0430\u0437\u0430\u0442\u0438",alternatives:["\u043F\u043E\u043A\u0430\u0436\u0438"],normalized:"show",form:"infinitive"},hide:{primary:"\u0441\u0445\u043E\u0432\u0430\u0442\u0438",alternatives:["\u0441\u0445\u043E\u0432\u0430\u0439","\u043F\u0440\u0438\u0445\u043E\u0432\u0430\u0442\u0438","\u043F\u0440\u0438\u0445\u043E\u0432\u0430\u0439"],normalized:"hide",form:"infinitive"},transition:{primary:"\u0430\u043D\u0456\u043C\u0443\u0432\u0430\u0442\u0438",alternatives:["\u0430\u043D\u0456\u043C\u0443\u0439"],normalized:"transition",form:"infinitive"},on:{primary:"\u043F\u0440\u0438",normalized:"on"},trigger:{primary:"\u0456\u043D\u0456\u0446\u0456\u044E\u0432\u0430\u0442\u0438",alternatives:["\u0437\u0430\u043F\u0443\u0441\u0442\u0438\u0442\u0438","\u0437\u0430\u043F\u0443\u0441\u0442\u0438"],normalized:"trigger",form:"infinitive"},send:{primary:"\u043D\u0430\u0434\u0456\u0441\u043B\u0430\u0442\u0438",alternatives:["\u043D\u0430\u0434\u0456\u0448\u043B\u0438"],normalized:"send",form:"infinitive"},focus:{primary:"\u0441\u0444\u043E\u043A\u0443\u0441\u0443\u0432\u0430\u0442\u0438",alternatives:["\u0441\u0444\u043E\u043A\u0443\u0441\u0443\u0439","\u0444\u043E\u043A\u0443\u0441"],normalized:"focus",form:"infinitive"},blur:{primary:"\u0440\u043E\u0437\u0444\u043E\u043A\u0443\u0441\u0443\u0432\u0430\u0442\u0438",alternatives:["\u0440\u043E\u0437\u0444\u043E\u043A\u0443\u0441\u0443\u0439"],normalized:"blur",form:"infinitive"},empty:{primary:"\u0441\u043F\u043E\u0440\u043E\u0436\u043D\u0438\u0442\u0438",alternatives:["\u043F\u043E\u0440\u043E\u0436\u043D\u0456\u0439"],normalized:"empty"},open:{primary:"\u0432\u0456\u0434\u043A\u0440\u0438\u0442\u0438",normalized:"open"},close:{primary:"\u0437\u0430\u043A\u0440\u0438\u0442\u0438",normalized:"close"},select:{primary:"\u0432\u0438\u0434\u0456\u043B\u0438\u0442\u0438",normalized:"select"},clear:{primary:"\u043E\u0447\u0438\u0441\u0442\u0438\u0442\u0438",normalized:"clear"},reset:{primary:"\u0441\u043A\u0438\u043D\u0443\u0442\u0438",normalized:"reset"},breakpoint:{primary:"\u0442\u043E\u0447\u043A\u0430-\u0437\u0443\u043F\u0438\u043D\u043A\u0438",normalized:"breakpoint"},click:{primary:"\u043A\u043B\u0456\u043A\u0443",alternatives:["\u043A\u043B\u0456\u043A","\u043D\u0430\u0442\u0438\u0441\u043A\u0430\u043D\u043D\u0456"],normalized:"click"},hover:{primary:"\u043D\u0430\u0432\u0435\u0434\u0435\u043D\u043D\u0456",alternatives:["\u043D\u0430\u0432\u0435\u0434\u0435\u043D\u043D\u044F"],normalized:"hover"},submit:{primary:"\u0432\u0456\u0434\u043F\u0440\u0430\u0432\u0446\u0456",alternatives:["\u0432\u0456\u0434\u043F\u0440\u0430\u0432\u043A\u0430","\u043D\u0430\u0434\u0441\u0438\u043B\u0430\u043D\u043D\u044F"],normalized:"submit"},input:{primary:"\u0432\u0432\u0435\u0434\u0435\u043D\u043D\u0456",alternatives:["\u0432\u0432\u0435\u0434\u0435\u043D\u043D\u044F"],normalized:"input"},change:{primary:"\u0437\u043C\u0456\u043D\u0456",alternatives:["\u0437\u043C\u0456\u043D\u0430"],normalized:"change"},load:{primary:"\u0437\u0430\u0432\u0430\u043D\u0442\u0430\u0436\u0435\u043D\u043D\u044F",normalized:"load"},go:{primary:"\u043F\u0435\u0440\u0435\u0439\u0442\u0438",alternatives:["\u043F\u0435\u0440\u0435\u0439\u0434\u0438","\u0439\u0442\u0438","\u0439\u0434\u0438"],normalized:"go",form:"infinitive"},scroll:{primary:"\u043F\u0440\u043E\u043A\u0440\u0443\u0442\u0438\u0442\u0438",alternatives:["\u043F\u0440\u043E\u043A\u0440\u0443\u0442\u0438"],normalized:"scroll",form:"infinitive"},push:{primary:"\u0448\u0442\u043E\u0432\u0445\u043D\u0443\u0442\u0438",alternatives:["\u0437\u0430\u0448\u0442\u043E\u0432\u0445\u043D\u0443\u0442\u0438"],normalized:"push",form:"infinitive"},replace:{primary:"\u0437\u0430\u043C\u0456\u043D\u0438\u0442\u0438",alternatives:["\u0437\u0430\u043C\u0456\u043D\u0438"],normalized:"replace",form:"infinitive"},process:{primary:"\u043E\u0431\u0440\u043E\u0431\u0438\u0442\u0438",alternatives:["\u043E\u0431\u0440\u043E\u0431\u043B\u044F\u0442\u0438"],normalized:"process",form:"infinitive"},wait:{primary:"\u0447\u0435\u043A\u0430\u0442\u0438",alternatives:["\u0447\u0435\u043A\u0430\u0439","\u0437\u0430\u0447\u0435\u043A\u0430\u0439"],normalized:"wait",form:"infinitive"},fetch:{primary:"\u0437\u0430\u0432\u0430\u043D\u0442\u0430\u0436\u0438\u0442\u0438",alternatives:["\u0437\u0430\u0432\u0430\u043D\u0442\u0430\u0436"],normalized:"fetch",form:"infinitive"},settle:{primary:"\u0441\u0442\u0430\u0431\u0456\u043B\u0456\u0437\u0443\u0432\u0430\u0442\u0438",normalized:"settle",form:"infinitive"},if:{primary:"\u044F\u043A\u0449\u043E",normalized:"if"},unless:{primary:"\u043A\u0440\u0456\u043C",normalized:"unless"},when:{primary:"\u043A\u043E\u043B\u0438",normalized:"when"},where:{primary:"\u0434\u0435",normalized:"where"},else:{primary:"\u0456\u043D\u0430\u043A\u0448\u0435",normalized:"else"},repeat:{primary:"\u043F\u043E\u0432\u0442\u043E\u0440\u0438\u0442\u0438",alternatives:["\u043F\u043E\u0432\u0442\u043E\u0440\u0438"],normalized:"repeat",form:"infinitive"},for:{primary:"\u0434\u043B\u044F",alternatives:["\u043A\u043E\u0436\u043D\u0438\u0439"],normalized:"for"},while:{primary:"\u043F\u043E\u043A\u0438",normalized:"while"},forever:{primary:"\u0437\u0430\u0432\u0436\u0434\u0438",normalized:"forever",alternatives:["forever"]},continue:{primary:"\u043F\u0440\u043E\u0434\u043E\u0432\u0436\u0438\u0442\u0438",alternatives:["\u043F\u0440\u043E\u0434\u043E\u0432\u0436\u0443\u0439"],normalized:"continue",form:"infinitive"},halt:{primary:"\u0437\u0443\u043F\u0438\u043D\u0438\u0442\u0438",alternatives:["\u0437\u0443\u043F\u0438\u043D\u0438\u0441\u044C","\u0441\u0442\u043E\u043F"],normalized:"halt",form:"infinitive"},throw:{primary:"\u043A\u0438\u043D\u0443\u0442\u0438",alternatives:["\u043A\u0438\u043D\u044C"],normalized:"throw",form:"infinitive"},call:{primary:"\u0432\u0438\u043A\u043B\u0438\u043A\u0430\u0442\u0438",alternatives:["\u0432\u0438\u043A\u043B\u0438\u0447"],normalized:"call",form:"infinitive"},return:{primary:"\u043F\u043E\u0432\u0435\u0440\u043D\u0443\u0442\u0438",alternatives:["\u043F\u043E\u0432\u0435\u0440\u043D\u0438"],normalized:"return",form:"infinitive"},then:{primary:"\u043F\u043E\u0442\u0456\u043C",alternatives:["\u0434\u0430\u043B\u0456","\u0442\u043E\u0434\u0456"],normalized:"then"},and:{primary:"\u0456",alternatives:["\u0442\u0430"],normalized:"and"},matches:{primary:"\u0432\u0456\u0434\u043F\u043E\u0432\u0456\u0434\u0430\u0454",normalized:"matches"},end:{primary:"\u043A\u0456\u043D\u0435\u0446\u044C",normalized:"end"},js:{primary:"js",normalized:"js"},async:{primary:"\u0430\u0441\u0438\u043D\u0445\u0440\u043E\u043D\u043D\u043E",alternatives:["async"],normalized:"async"},tell:{primary:"\u0441\u043A\u0430\u0437\u0430\u0442\u0438",alternatives:["\u0441\u043A\u0430\u0436\u0438"],normalized:"tell",form:"infinitive"},default:{primary:"\u0437\u0430_\u0437\u0430\u043C\u043E\u0432\u0447\u0443\u0432\u0430\u043D\u043D\u044F\u043C",normalized:"default"},init:{primary:"\u0456\u043D\u0456\u0446\u0456\u0430\u043B\u0456\u0437\u0443\u0432\u0430\u0442\u0438",alternatives:["\u0456\u043D\u0456\u0446\u0456\u0430\u043B\u0456\u0437\u0443\u0439"],normalized:"init",form:"infinitive"},behavior:{primary:"\u043F\u043E\u0432\u0435\u0434\u0456\u043D\u043A\u0430",normalized:"behavior"},install:{primary:"\u0456\u043D\u0441\u0442\u0430\u043B\u044E\u0432\u0430\u0442\u0438",normalized:"install",form:"infinitive"},measure:{primary:"\u0432\u0438\u043C\u0456\u0440\u044F\u0442\u0438",alternatives:["\u0432\u0438\u043C\u0456\u0440\u044F\u0439"],normalized:"measure",form:"infinitive"},beep:{primary:"\u0437\u0432\u0443\u043A",normalized:"beep"},break:{primary:"\u043F\u0435\u0440\u0435\u0440\u0432\u0430\u0442\u0438",normalized:"break"},copy:{primary:"\u043A\u043E\u043F\u0456\u044E\u0432\u0430\u0442\u0438",normalized:"copy"},exit:{primary:"\u0432\u0438\u0439\u0442\u0438",normalized:"exit"},pick:{primary:"\u0432\u0438\u0431\u0440\u0430\u0442\u0438",normalized:"pick"},render:{primary:"\u0432\u0456\u0434\u043E\u0431\u0440\u0430\u0437\u0438\u0442\u0438",normalized:"render"},into:{primary:"\u0432",alternatives:["\u0443"],normalized:"into"},before:{primary:"\u0434\u043E",alternatives:["\u043F\u0435\u0440\u0435\u0434"],normalized:"before"},after:{primary:"\u043F\u0456\u0441\u043B\u044F",normalized:"after"},until:{primary:"\u043F\u043E\u043A\u0438_\u043D\u0435",normalized:"until"},event:{primary:"\u043F\u043E\u0434\u0456\u044F",normalized:"event"},from:{primary:"\u0437",alternatives:["\u0432\u0456\u0434","\u0456\u0437"],normalized:"from"},connect:{primary:"\u043F\u0456\u0434\u043A\u043B\u044E\u0447\u0438\u0442\u0438",alternatives:["\u0437\u02BC\u0454\u0434\u043D\u0430\u0442\u0438","\u043F\u0456\u0434\u043A\u043B\u044E\u0447\u0438\u0442\u0438\u0441\u044F"],normalized:"connect"},stream:{primary:"\u0442\u0440\u0430\u043D\u0441\u043B\u044E\u0432\u0430\u0442\u0438",alternatives:["\u043F\u043E\u0442\u0456\u043A","\u0441\u0442\u0440\u0456\u043C"],normalized:"stream"},live:{primary:"\u043D\u0430\u0436\u0438\u0432\u043E",alternatives:["\u0443-\u043F\u0440\u044F\u043C\u043E\u043C\u0443-\u0435\u0444\u0456\u0440\u0456","\u0432-\u0440\u0435\u0436\u0438\u043C\u0456-\u0440\u0435\u0430\u043B\u044C\u043D\u043E\u0433\u043E-\u0447\u0430\u0441\u0443","\u0436\u0438\u0432\u0438\u0439"],normalized:"live"},socket:{primary:"\u0441\u043E\u043A\u0435\u0442",alternatives:["\u0433\u043D\u0456\u0437\u0434\u043E","websocket","socket"],normalized:"socket"},bind:{primary:"\u043F\u0440\u0438\u0432'\u044F\u0437\u0430\u0442\u0438",alternatives:["\u0437\u0432'\u044F\u0437\u0430\u0442\u0438","\u043F\u0440\u0438\u0454\u0434\u043D\u0430\u0442\u0438","bind"],normalized:"bind"},intercept:{primary:"\u043F\u0435\u0440\u0435\u0445\u043E\u043F\u0438\u0442\u0438",alternatives:["\u043F\u0435\u0440\u0435\u0445\u043E\u043F\u043B\u0435\u043D\u043D\u044F","intercept"],normalized:"intercept"},worker:{primary:"\u0440\u043E\u0431\u0456\u0442\u043D\u0438\u043A",alternatives:["\u0432\u043E\u0440\u043A\u0435\u0440","worker"],normalized:"worker"},eventsource:{primary:"eventsource",alternatives:["\u0434\u0436\u0435\u0440\u0435\u043B\u043E-\u043F\u043E\u0434\u0456\u0439"],normalized:"eventsource"}},eventHandler:{keyword:{primary:"\u043F\u0440\u0438",normalized:"on"},sourceMarker:{primary:"\u043D\u0430",alternatives:["\u0432","\u043F\u0440\u0438"],position:"before"},eventMarker:{primary:"\u043F\u0440\u0438",position:"before"},temporalMarkers:["\u043A\u043E\u043B\u0438","\u044F\u043A\u0449\u043E"]}},Nu=["===","!==","->","==","!=","<=",">=","&&","||","**","+=","-=","*=","/=","+","-","*","/","=",">","<","!","&","|","%","^","~"],_u=class{constructor(t=Nu){this.name="operator",this.operators=[...t].sort((e,r)=>r.length-e.length);}canExtract(t,e){return this.operators.some(r=>t.startsWith(r,e))}extract(t,e){for(let r of this.operators)if(t.startsWith(r,e))return {value:r,length:r.length};return null}},Mu="()[]{},:;",Lu=class{constructor(t=Mu){this.punctuation=t,this.name="punctuation";}canExtract(t,e){return this.punctuation.includes(t[e])}extract(t,e){let r=t[e];return this.punctuation.includes(r)?{value:r,length:1}:null}};function ut(t,e){let r=t[e];if(r==="#"){let i=t.slice(e).match(/^#[a-zA-Z_][\w-]*/);return i?i[0]:null}if(r==="."){let i=t.slice(e).match(/^\.\{[a-zA-Z_$][\w$]*\}/);if(i)return i[0];let a=t.slice(e).match(/^\.[a-zA-Z_][\w-]*/);return a?a[0]:null}if(r==="@"){let i=t.slice(e).match(/^@[a-zA-Z_][\w-]*/);return i?i[0]:null}if(r==="*"){let i=t.slice(e).match(/^\*(?:--)?[a-zA-Z_][\w-]*/);return i?i[0]:null}if(r==="["){let i=0,a=e;for(;a<t.length;){if(t[a]==="["&&i++,t[a]==="]"&&(i--,i===0))return t.slice(e,a+1);a++;}return null}if(r==="<"){let i=t.slice(e).match(/^<(?=[\w.#[])[\w-]*(?:[#.][\w-]+|\[[^\]]+\])*\s*\/>/);return i?i[0]:null}return null}var Iu=class{constructor(){this.name="css-selector";}canExtract(t,e){let r=t[e];return r==="#"||r==="."||r==="["||r==="<"?true:r==="@"||r==="*"?ut(t,e)!==null:false}extract(t,e){let r=ut(t,e);return r?{value:r,length:r.length,metadata:{type:"css-selector"}}:null}},ju=class{constructor(){this.name="event-modifier";}canExtract(t,e){if(t[e]!==".")return false;let r=t.slice(e);return /^\.(once|prevent|stop|debounce|throttle|queue)/.test(r)}extract(t,e){let r=t.slice(e).match(/^\.(?:once|prevent|stop|debounce|throttle|queue)(?:\(([^)]+)\))?/);if(!r)return null;let i=r[0],a=i.slice(1).split("(")[0],n=r[1];return {value:i,length:i.length,metadata:{modifierName:a,value:n?a==="queue"?n:parseInt(n,10):void 0}}}};function Vu(t,e){let r=t.slice(e);if(r.startsWith("http://")||r.startsWith("https://")){let i=r.match(/^https?:\/\/[^\s]*/);return i?i[0]:null}if(r.startsWith("//")){let i=r.match(/^\/\/[^\s]*/);return i?i[0]:null}if(r.startsWith("./")||r.startsWith("../")){let i=r.match(/^\.\.?\/[^\s]*/);return i?i[0]:null}if(r.startsWith("/")){let i=r.match(/^\/[^\s]*/);return i?i[0]:null}return null}var $u=class{constructor(){this.name="url";}canExtract(t,e){let r=t.slice(e);return r.startsWith("http://")||r.startsWith("https://")||r.startsWith("//")||r.startsWith("./")||r.startsWith("../")||r.startsWith("/")}extract(t,e){let r=Vu(t,e);return r?{value:r,length:r.length,metadata:{type:"url"}}:null}},Wu=class{constructor(){this.name="variable-ref";}canExtract(t,e){let r=t[e];return (r===":"||r==="$"||r==="^")&&e+1<t.length&&/[a-zA-Z_]/.test(t[e+1])}extract(t,e){if(!this.canExtract(t,e))return null;let r=1;for(;e+r<t.length&&/[a-zA-Z0-9_]/.test(t[e+r]);)r++;return {value:t.substring(e,e+r),length:r,metadata:{type:"variable-reference"}}}};function qu(t){return {isLetter:i=>t.test(i),isIdentifierChar:i=>/[0-9]/.test(i)||t.test(i)}}var Ku=class{constructor(t,e,r){this.name=t;let i=qu(e);this.isLetter=i.isLetter,this.isIdentifierChar=i.isIdentifierChar,this.prepositions=r;}setContext(t){this.context=t;}canExtract(t,e){let r=t[e];return r==="'"?false:this.isLetter(r)}extract(t,e){if(!this.context)throw new Error(`${this.name}: context not set`);let r=e,i="";for(;r<t.length&&this.isIdentifierChar(t[r]);)i+=t[r++];if(!i)return null;let a=i.toLowerCase(),n=this.prepositions.has(a),u=this.context.lookupKeyword(a),o=u&&u.normalized!==u.native?u.normalized:void 0,s;if(!u&&this.context.normalizer){let l=this.context.normalizer.normalize(i);if(l.stem!==i&&l.confidence>=.7){let c=this.context.lookupKeyword(l.stem);c&&(s=c.normalized);}}return {value:i,length:r-e,metadata:{normalized:o||s,isPreposition:n}}}},Uu=new Set(["\u0432","\u0443","\u043D\u0430","\u0437","\u0456\u0437","\u0437\u0456","\u0434\u043E","\u0432\u0456\u0434","\u043E","\u043E\u0431","\u043F\u0440\u0438","\u0434\u043B\u044F","\u043F\u0456\u0434","\u043D\u0430\u0434","\u043F\u0435\u0440\u0435\u0434","\u043C\u0456\u0436","\u0447\u0435\u0440\u0435\u0437","\u0431\u0435\u0437","\u043F\u043E","\u0437\u0430","\u043F\u0440\u043E","\u043F\u0456\u0441\u043B\u044F","\u043D\u0430\u0432\u043A\u043E\u043B\u043E","\u043F\u0440\u043E\u0442\u0438","\u0437\u0430\u043C\u0456\u0441\u0442\u044C","\u043A\u0440\u0456\u043C","\u0441\u0435\u0440\u0435\u0434","\u043A"]);function Hu(){return [new Ku("ukrainian-keyword",/[a-zA-Zа-яА-ЯіІїЇєЄґҐьЬ']/,Uu)]}function Gu(t){let e=t.charCodeAt(0);return e>=65&&e<=90||e>=97&&e<=122||e===95||e===36}function Yu(t){let e=t.charCodeAt(0);return e>=48&&e<=57||e>=65&&e<=90||e>=97&&e<=122||e===95||e===36}var Zu=class{constructor(){this.name="ascii-identifier";}setContext(t){this.context=t;}canExtract(t,e){return Gu(t[e])}extract(t,e){if(!this.context)throw new Error("AsciiIdentifierExtractor: context not set");let r=e,i="",a=e;for(;a<t.length&&Yu(t[a]);)i+=t[a],a++;if(!i)return null;let n=this.context.lookupKeyword(i),u=n&&n.normalized!==n.native?n.normalized:void 0;return {value:i,length:a-r,metadata:{normalized:u}}}};function Xu(){return [new $u,new ju,new Wu,new Iu]}var Ju=new Set(["\u0432","\u0443","\u043D\u0430","\u0437","\u0456\u0437","\u0437\u0456","\u0434\u043E","\u0432\u0456\u0434","\u043E","\u043E\u0431","\u043F\u0440\u0438","\u0434\u043B\u044F","\u043F\u0456\u0434","\u043D\u0430\u0434","\u043F\u0435\u0440\u0435\u0434","\u043C\u0456\u0436","\u0447\u0435\u0440\u0435\u0437","\u0431\u0435\u0437","\u043F\u043E","\u0437\u0430","\u043F\u0440\u043E","\u043F\u0456\u0441\u043B\u044F","\u043D\u0430\u0432\u043A\u043E\u043B\u043E","\u043F\u0440\u043E\u0442\u0438","\u0437\u0430\u043C\u0456\u0441\u0442\u044C","\u043A\u0440\u0456\u043C","\u0441\u0435\u0440\u0435\u0434","\u043A"]),Qu=[{native:"\u043C\u0438\u0448\u0430\u0432\u043D\u0438\u0437",normalized:"mousedown"},{native:"\u043C\u0438\u0448\u0430\u0432\u0433\u043E\u0440\u0443",normalized:"mouseup"},{native:"\u0437\u043C\u0456\u043D\u0430\u0440\u043E\u0437\u043C\u0456\u0440\u0443",normalized:"resize"},{native:"\u0456\u0441\u0442\u0438\u043D\u0430",normalized:"true"},{native:"\u043F\u0440\u0430\u0432\u0434\u0430",normalized:"true"},{native:"\u0445\u0438\u0431\u043D\u0456\u0441\u0442\u044C",normalized:"false"},{native:"null",normalized:"null"},{native:"\u043D\u0435\u0432\u0438\u0437\u043D\u0430\u0447\u0435\u043D\u043E",normalized:"undefined"},{native:"\u0441\u0435\u043A\u0443\u043D\u0434\u0430",normalized:"s"},{native:"\u0441\u0435\u043A\u0443\u043D\u0434\u0438",normalized:"s"},{native:"\u0441\u0435\u043A\u0443\u043D\u0434",normalized:"s"},{native:"\u043C\u0456\u043B\u0456\u0441\u0435\u043A\u0443\u043D\u0434\u0430",normalized:"ms"},{native:"\u043C\u0456\u043B\u0456\u0441\u0435\u043A\u0443\u043D\u0434\u0438",normalized:"ms"},{native:"\u043C\u0456\u043B\u0456\u0441\u0435\u043A\u0443\u043D\u0434",normalized:"ms"},{native:"\u0445\u0432\u0438\u043B\u0438\u043D\u0430",normalized:"m"},{native:"\u0445\u0432\u0438\u043B\u0438\u043D\u0438",normalized:"m"},{native:"\u0445\u0432\u0438\u043B\u0438\u043D",normalized:"m"},{native:"\u0433\u043E\u0434\u0438\u043D\u0430",normalized:"h"},{native:"\u0433\u043E\u0434\u0438\u043D\u0438",normalized:"h"},{native:"\u0433\u043E\u0434\u0438\u043D",normalized:"h"},{native:"\u043F\u0435\u0440\u0448\u0438\u0439",normalized:"first"},{native:"\u043E\u0441\u0442\u0430\u043D\u043D\u0456\u0439",normalized:"last"},{native:"\u043D\u0430\u0441\u0442\u0443\u043F\u043D\u0438\u0439",normalized:"next"},{native:"\u043F\u043E\u043F\u0435\u0440\u0435\u0434\u043D\u0456\u0439",normalized:"previous"},{native:"\u043D\u0430\u0439\u0431\u043B\u0438\u0436\u0447\u0438\u0439",normalized:"closest"},{native:"\u0431\u0430\u0442\u044C\u043A\u0456\u0432\u0441\u044C\u043A\u0438\u0439",normalized:"parent"},{native:"\u0432\u0438\u043F\u0430\u0434\u043A\u043E\u0432\u0438\u0439",normalized:"random"},{native:"\u043F\u0435\u0440\u0448\u0430",normalized:"first"},{native:"\u043F\u0435\u0440\u0448\u0435",normalized:"first"},{native:"\u043E\u0441\u0442\u0430\u043D\u043D\u044F",normalized:"last"},{native:"\u043E\u0441\u0442\u0430\u043D\u043D\u0454",normalized:"last"},{native:"\u043D\u0430\u0441\u0442\u0443\u043F\u043D\u0430",normalized:"next"},{native:"\u043F\u043E\u043F\u0435\u0440\u0435\u0434\u043D\u044F",normalized:"previous"},{native:"\u043F\u043E\u0440\u043E\u0436\u043D\u044F",normalized:"empty"},{native:"\u043F\u043E\u0440\u043E\u0436\u043D\u0454",normalized:"empty"},{native:"\u043C\u043E\u044F",normalized:"my"},{native:"\u043C\u043E\u0454",normalized:"my"},{native:"\u043C\u043E\u0457",normalized:"my"}],eo=class extends Se{constructor(){super(),this.language="uk",this.direction="ltr",this.initializeKeywordsFromProfile(st,Qu),this.setNormalizer(new ot),this.registerExtractors([...Xu(),...Hu(),new Ae,new De,new Zu,new _u,new Lu]);}classifyToken(t){let e=t.toLowerCase();return Ju.has(e)?"particle":this.isKeyword(e)?"keyword":/^\.(once|prevent|stop|debounce|throttle|queue)(\(.*\))?$/.test(t)?"event-modifier":t.startsWith("#")||t.startsWith(".")||t.startsWith("[")||t.startsWith("*")||t.startsWith("<")?"selector":t.startsWith('"')||t.startsWith("'")||/^\d/.test(t)?"literal":t.startsWith("/")||t.startsWith("./")||t.startsWith("http")?"url":"identifier"}},ro=new eo;Pe("uk",ro,st);function Ye(t){let e=t.getAttribute("data-lang");if(e)return lr(e);let r=t.getAttribute("data-hyperscript-lang")??t.closest?.("[data-hyperscript-lang]")?.getAttribute("data-hyperscript-lang");if(r)return lr(r);let i=typeof document<"u"?document.documentElement?.lang:null;return i&&i!=="en"?lr(i):null}function lr(t){return t.split("-")[0].toLowerCase()}var lt={add:[["patient",""],["destination","to"]],append:[["patient",""],["destination","to"]],async:[],beep:[["patient",""]],behavior:[["patient",""]],bind:[["destination",""],["source","to"]],blur:[["patient",""]],break:[],breakpoint:[],call:[["patient",""]],clear:[["patient",""]],clone:[["patient",""],["destination","into"]],close:[["patient",""]],compound:[],continue:[],copy:[["patient",""]],decrement:[["patient",""],["quantity","by"]],default:[["destination",""],["patient","to"]],else:[],empty:[["patient",""]],eventsource:[],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"]],intercept:[],js:[["patient",""]],live:[],log:[["patient",""]],make:[["patient",""]],measure:[["patient",""],["source","of"]],morph:[["patient",""],["destination","to"]],on:[["event",""],["source","from"]],open:[["style","as"],["patient",""]],pick:[["patient",""],["source","from"]],prepend:[["patient",""],["destination","to"]],process:[["patient","partials in"]],push:[["patient","url"]],put:[["patient",""],["destination","into"]],remove:[["patient",""],["source","from"]],render:[["patient",""],["style","with"]],repeat:[["quantity",""],["condition","until"]],replace:[["patient","url"]],reset:[["patient",""]],return:[["patient",""]],scroll:[["destination","to"]],select:[["patient",""]],send:[["event",""],["destination","to"]],set:[["destination",""],["patient","to"],["scope","on"]],settle:[["patient",""]],show:[["patient",""],["style","with"]],socket:[],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:[["duration",""]],while:[["condition",""]],worker:[]};function Ze(t){switch(t.kind){case "event-handler":return to(t);case "compound":return io(t);default:return ao(t)}}function to(t){let e=["on"],r=t.roles.get("event");r&&e.push($e(r));let i=t.roles.get("source");if(i&&e.push("from",$e(i)),t.body&&t.body.length>0){let a=t.body.map(Ze);e.push(a.join(" then "));}return e.join(" ")}function io(t){let e=t.chainType==="async"?"async":t.chainType;return t.statements.map(Ze).join(` ${e} `)}function ao(t){let e=lt[t.action];if(e){let i=[t.action];for(let[a,n]of e){let u=t.roles.get(a);u&&(a==="destination"&&u.type==="reference"&&u.value==="me"||(n&&i.push(n),i.push($e(u))));}return i.join(" ")}let r=[t.action];for(let[,i]of t.roles)r.push($e(i));return r.join(" ")}function $e(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 no(t);case "expression":return t.raw;case "flag":return t.enabled?`+${t.name}`:`~${t.name}`}}function no(t){let e=$e(t.object),r=t.property;if(t.object.type==="reference")switch(t.object.value){case "me":return `my ${r}`;case "it":return `its ${r}`;case "you":return `your ${r}`}return `${e}'s ${r}`}var mt=.5,uo={confidenceThreshold:mt,strategy:"semantic",fallbackToOriginal:true};function oo(t,e){return typeof t=="number"?t:t[e]??t["*"]??mt}function cr(t,e,r={}){let i={...uo,...r},a=ct(t,e,i);if(a!==null)return a;let n=lo(t);if(n){let u=ct(n.commands,e,i);if(u!==null)return n.prefix+u}return t}function ct(t,e,r){if(r.strategy==="semantic"||r.strategy==="auto"){let i=oo(r.confidenceThreshold,e),a=pt(t,e,i);if(a!==null)return a}if((r.strategy==="auto"||r.strategy==="i18n")&&r.i18nToEnglish){let i=co(t,e,r.i18nToEnglish);if(i!==null)return i}return null}var so=/^(on\s+(?:every\s+)?[\w-]+(?:\[.*?\])?(?:\.[\w-]+(?:\([^)]*\))?)*(?:\s+from\s+\S+)?(?:\s+queue\s+\w+)?\s+)/;function lo(t){let e=t.match(so);if(!e)return null;let r=e[1],i=t.slice(r.length);return i?{prefix:r,commands:i}:null}function pt(t,e,r){try{let i=po(t,e);if(i.length>1)return fo(i,e,r);if(!Ir(e))return null;let a=Gr(t,e);return a.confidence<r||!a.node?null:Ze(a.node)}catch{return null}}function co(t,e,r){try{let i=r(t,e);return i!==t?i:null}catch{return null}}function mo(t){let e=["then"],r=M(t);if(r?.keywords?.then){let i=r.keywords.then;if(i.primary&&i.primary!=="then"&&e.push(i.primary),i.alternatives)for(let a of i.alternatives)e.includes(a)||e.push(a);}return e}function po(t,e){let i=mo(e).map(o=>o.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")),a=new RegExp(`\\s+(?:${i.join("|")})\\s+`,"i"),n=t.split(`
5
+ `).map(o=>o.trim()).filter(o=>o.length>0),u=[];for(let o of n){let s=o.split(a);u.push(...s);}return u}function fo(t,e,r){let i=[];for(let a of t){let n=pt(a.trim(),e,r);if(n===null)return null;i.push(n);}return i.join(" then ")}function mr(t={}){return function(r){let{internals:i}=r,a=i.runtime,n=a.getScript.bind(a);a.getScript=function(u){let o=n(u);if(!o)return null;let s=yo(u,t);if(!s||s==="en")return o;let l=cr(o,s,t);return t.debug&&l!==o&&console.log(`[hyperscript-i18n] ${s}: "${o}" \u2192 "${l}"`),l};}}function yo(t,e){if(e.languageAttribute){let i=t.getAttribute(e.languageAttribute);if(i)return i.split("-")[0].toLowerCase()}let r=Ye(t);return r||(e.defaultLanguage??null)}function dt(t,e,r={}){return e==="en"?t:cr(t,e,r)}Lr(t=>Zr(t));function ft(){typeof _hyperscript<"u"&&_hyperscript.use&&(_hyperscript.use(mr()),vo());}function vo(){if(typeof document>"u")return;let e=_hyperscript?.internals?.runtime;if(!e?.processNode||!e?.getInternalData)return;let r=e.getScriptSelector?.()??"[_], [script], [data-script]";document.querySelectorAll(r).forEach(i=>{let a=e.getInternalData(i);a.initialized&&(a.initialized=false);}),e.processNode(document.body);}var b0=["ru","pl","uk"];ft();exports.plugin=mr;exports.preprocess=dt;exports.resolveLanguage=Ye;exports.supportedLanguages=b0;return exports;})({});