@hyperscript-tools/multilingual 2.9.0 → 2.9.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/hyperscript-i18n-ar.global.js +2 -2
- package/dist/hyperscript-i18n-bn.global.js +2 -2
- package/dist/hyperscript-i18n-de.global.js +3 -3
- package/dist/hyperscript-i18n-east-asian.global.js +2 -2
- package/dist/hyperscript-i18n-en.global.js +2 -2
- package/dist/hyperscript-i18n-es.global.js +3 -3
- package/dist/hyperscript-i18n-fr.global.js +3 -3
- package/dist/hyperscript-i18n-he.global.js +2 -2
- package/dist/hyperscript-i18n-hi.global.js +2 -2
- package/dist/hyperscript-i18n-id.global.js +2 -2
- package/dist/hyperscript-i18n-it.global.js +3 -3
- package/dist/hyperscript-i18n-ja.global.js +2 -2
- package/dist/hyperscript-i18n-ko.global.js +2 -2
- package/dist/hyperscript-i18n-ms.global.js +2 -2
- package/dist/hyperscript-i18n-pl.global.js +3 -3
- package/dist/hyperscript-i18n-pt.global.js +3 -3
- package/dist/hyperscript-i18n-qu.global.js +3 -3
- package/dist/hyperscript-i18n-ru.global.js +3 -3
- package/dist/hyperscript-i18n-slavic.global.js +3 -3
- package/dist/hyperscript-i18n-south-asian.global.js +2 -2
- package/dist/hyperscript-i18n-southeast-asian.global.js +3 -3
- package/dist/hyperscript-i18n-sw.global.js +2 -2
- package/dist/hyperscript-i18n-th.global.js +2 -2
- package/dist/hyperscript-i18n-tl.global.js +2 -2
- package/dist/hyperscript-i18n-tr.global.js +2 -2
- package/dist/hyperscript-i18n-uk.global.js +3 -3
- package/dist/hyperscript-i18n-vi.global.js +4 -4
- package/dist/hyperscript-i18n-western.global.js +3 -3
- package/dist/hyperscript-i18n-zh.global.js +2 -2
- package/dist/hyperscript-i18n.global.js +13 -13
- package/package.json +2 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
var HyperscriptI18n=(function(exports){'use strict';function le(t,e){return e?{type:"literal",value:t,dataType:e}:{type:"literal",value:t}}function Xe(t,e){return e?{type:"selector",value:t,selectorKind:e}:{type:"selector",value:t}}function je(t){return {type:"reference",value:t}}function Je(t,e){return {type:"property-path",object:t,property:e}}var Nr=new Set(["me","you","it","result","event","target","body","document","window","detail"]);function dr(t,e=Nr){return e.has(t)}var ii=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}]`,n=new Date().toISOString();switch(t){case "debug":console.debug(`${n} ${i} DEBUG:`,e,...r);break;case "info":console.info(`${n} ${i} INFO:`,e,...r);break;case "warn":console.warn(`${n} ${i} WARN:`,e,...r);break;case "error":console.error(`${n} ${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 ni(t){return new ii(t)}function Se(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 ai(t,e){return t?.possessive?.keywords?.[e]}var Ve=class xe{constructor(){this.logger=ni("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 n=e.mark(),a=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,a);if(this.logger.debug("matchTokenSequence returned:",u),this.logger.debug("Captured roles:",Array.from(a.entries()).map(([s,l])=>[s,JSON.stringify(l)])),!u)return this.logger.debug(">>> MATCH FAILED - resetting token position"),e.reset(n),null;let o=this.calculateConfidence(r,a);return this.applyExtractionRules(r,a),{pattern:r,captured:a,consumedTokens:e.position()-n.position,confidence:o}}matchBest(e,r,i){let n=[];for(let u of r){let o=e.mark(),s=this.matchPattern(e,u,i);s&&n.push(s),e.reset(o);}if(n.length===0)return null;n.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 a=n[0];return this.matchPattern(e,a.pattern),a}matchTokenSequence(e,r,i,n){let a=r[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();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(n)for(let h of n)v.add(h);let f=[];for(;!e.isAtEnd();){let h=e.peek();if(!h||this.isStopMarker(h,v))break;f.push(h.value),e.advance();}if(f.length>0){i.set(c.role,{type:"expression",raw:f.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(n)for(let h of n)v.add(h);if(this.matchGroupToken(e,c,i,v)){o=null,s=null;continue}if(this.isOptional(c))continue;return false}let d=c.type==="role"&&c.optional===true,p=d?e.mark():null;if(c.type==="role"&&!d){let v=l+1<r.length?r[l+1]:null;if(v?.type==="literal"){let f=e.peek();if(f&&this.getMatchType(f,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 h=this.matchPatternToken(e,c,i);if(this.logger.debug(" >> Backtrack retry result:",h),h)continue}return false}}}let E=this.matchPatternToken(e,c,i);if(this.logger.debug(" >> Match result:",E),E){d?(o=p,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 n=this.getMatchType(i,r.value);if(this.logger.debug(" >>> matchType for",i.value,"vs",r.value,":",n),n!=="none")return this.totalKeywordMatches++,n==="stem"&&this.stemMatchCount++,e.advance(),true;if(r.alternatives)for(let a of r.alternatives){let u=this.getMatchType(i,a);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 n=e.peek();if(this.logger.debug(" >>> After skipNoiseWords, current token:",n?JSON.stringify({value:n.value,kind:n.kind}):"null"),!n)return r.optional||false;let a=this.tryMatchPossessiveExpression(e);if(a)return r.expectedTypes&&r.expectedTypes.length>0&&!Se(a.type,r.expectedTypes)?r.optional||false:(i.set(r.role,a),true);let u=this.tryMatchMethodCallExpression(e);if(u)return r.expectedTypes&&r.expectedTypes.length>0&&!Se(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&&!Se(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&&!Se(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&&!Se(l.type,r.expectedTypes)?r.optional||false:(i.set(r.role,l),true);this.logger.debug(" >>> Trying tokenToSemanticValue for token:",n?JSON.stringify({value:n.value,kind:n.kind}):"null");let c=this.tokenToSemanticValue(n);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&&!Se(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,n=this.safeToLowerCase(i),a=ai(this.currentProfile,n);if(!a)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()),Je(je(a),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 n=e.peek();if(!n||n.kind!=="operator"||n.value!==".")return e.reset(i),null;e.advance();let a=e.peek();if(!a||a.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<xe.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}.${a.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 n=e.peek();if(!n||n.kind!=="operator"||n.value!==".")return e.reset(i),null;e.advance();let a=e.peek();if(!a||a.kind!=="identifier")return e.reset(i),null;e.advance();let u=`${r.value}.${a.value}`,o=1;for(;!e.isAtEnd()&&o<xe.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<xe.MAX_METHOD_ARGS;){let d=e.peek();if(!d)break;if(d.kind==="punctuation"&&d.value===")"){if(c===0){e.advance();break}c--;}if(d.kind==="punctuation"&&d.value==="("&&c++,d.kind==="punctuation"&&d.value===","){e.advance();continue}l.push(d.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 n=e.peek();if(!n||n.kind!=="punctuation"||n.value!=="'s")return e.reset(i),null;e.advance();let a=e.peek();return !a||a.kind!=="selector"&&a.kind!=="identifier"?(e.reset(i),null):(e.advance(),Je(Xe(r.value),a.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 n=e.peek();if(!n||n.kind!=="selector"||!n.value.startsWith("."))return e.reset(i),null;let a=e.peek(1);a&&a.kind,e.advance();let u=n.value.slice(1);return Je(Xe(r.value),u)}matchGroupToken(e,r,i,n){let a=e.mark(),u=new Set(i.keys());if(this.matchTokenSequence(e,r.tokens,i,n))return true;e.reset(a);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<=xe.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 p=0;p<l;p++)e.advance();if(this.matchTokenSequence(e,r.tokens,i,n))return true;e.reset(a);for(let p of i.keys())u.has(p)||i.delete(p);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 n=r;n<e.length;n++){let a=e[n];if(a.type==="literal"){if(i.add(a.value.toLowerCase()),a.alternatives)for(let u of a.alternatives)i.add(u.toLowerCase());break}if(a.type==="group"){for(let u of a.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(!a.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 Xe(e.value);case "literal":return this.parseLiteralValue(e.value);case "keyword":let r=e.normalized||e.value;this.safeToLowerCase(r);return le(e.normalized||e.value);case "identifier":if(typeof e.value=="string"&&e.value.startsWith(":"))return je(e.value);this.safeToLowerCase(e.value);return {type:"expression",raw:e.value};case "url":return le(e.value,"string");default:return null}}parseLiteralValue(e){if(e.startsWith('"')||e.startsWith("'")||e.startsWith("`")||e.startsWith("\u300C")){let n=e.slice(1,-1);return le(n,"string")}if(e==="true")return le(true,"boolean");if(e==="false")return le(false,"boolean");let r=e.match(/^(\d+(?:\.\d+)?)(ms|s|m|h)?$/);if(r){let n=parseFloat(r[1]);return r[2]?le(e,"duration"):le(n,"number")}let i=parseFloat(e);return isNaN(i)?le(e,"string"):le(i,"number")}applyExtractionRules(e,r){for(let[i,n]of Object.entries(e.extraction))r.has(i)||(n.value!==void 0?r.set(i,{type:"literal",value:n.value}):n.default&&r.set(i,n.default));}isOptional(e){return e.type!=="literal"&&e.optional===true}calculateConfidence(e,r){let i=0,n=0,a=l=>e.extraction?.[l]?.default!==void 0;for(let l of e.template.tokens)if(l.type==="role")n+=1,r.has(l.role)&&(i+=1);else if(l.type==="group"){for(let c of l.tokens)if(c.type==="role"){let m=a(c.role),d=.8;n+=d,r.has(c.role)?i+=d:m&&(i+=d*.6);}}let u=n>0?i/n: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 n of r.alternatives)if(i.has(n))return .15}return 0}arabicPrepositionDisambiguation(e,r){if(e.language!=="ar")return 0;let i=0,n={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[a,u]of r.entries()){let o=n[a];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(xe.ENGLISH_NOISE_WORDS.has(i)){let n=e.mark();e.advance();let a=e.peek();if(a&&a.kind==="selector")return;e.reset(n);}i==="class"&&e.advance();}extractEventModifiers(e){let r={},i=false;for(;!e.isAtEnd();){let n=e.peek();if(!n||n.kind!=="event-modifier")break;let a=n.metadata;if(!a)break;switch(i=true,a.modifierName){case "once":r.once=true;break;case "debounce":typeof a.value=="number"&&(r.debounce=a.value);break;case "throttle":typeof a.value=="number"&&(r.throttle=a.value);break;case "queue":(a.value==="first"||a.value==="last"||a.value==="all"||a.value==="none")&&(r.queue=a.value);break}e.advance();}return i?r:void 0}};Ve.MAX_MARKER_SCAN=3;Ve.MAX_PROPERTY_DEPTH=10;Ve.MAX_METHOD_ARGS=20;Ve.ENGLISH_NOISE_WORDS=new Set(["the","a","an"]);var ui=Ve;new ui;var Be=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 a=1;for(;e+a<t.length;){if(t[e+a]==="\u201D")return a++,{value:t.substring(e,e+a),length:a};a++;}return null}if(r==="\u2018"){let a=1;for(;e+a<t.length;){if(t[e+a]==="\u2019")return a++,{value:t.substring(e,e+a),length:a};a++;}return null}let i=1,n=false;for(;e+i<t.length;){let a=t[e+i];if(n){n=false,i++;continue}if(a==="\\"){n=true,i++;continue}if(a===r)return i++,{value:t.substring(e,e+i),length:i};i++;}return null}},Fe=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 n=t.substring(e,e+r),a=e+r;if(a<t.length){let u=t.slice(a),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:n+l.suffix,length:r+l.pattern.length,metadata:{hasTimeUnit:true}};if(u.startsWith("ms"))return {value:n+"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:n+l.suffix,length:r+1,metadata:{hasTimeUnit:true}};if(/^[smh](?![a-zA-Z])/.test(u))return {value:n+u[0],length:r+1,metadata:{hasTimeUnit:true}}}return {value:n,length:r}}};function oi(t){return "setContext"in t&&typeof t.setContext=="function"}function si(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 ie=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 V(t,e){return {start:t,end:e}}function W(t,e,r,i){if(typeof t=="object"){let{value:a,kind:u,position:o,normalized:s,stem:l,stemConfidence:c,metadata:m}=t;return {value:a,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 n=t;if(!e||!r)throw new Error("createToken requires kind and position parameters");if(typeof i=="string")return {value:n,kind:e,position:r,normalized:i};if(i){let{normalized:a,stem:u,stemConfidence:o,metadata:s}=i;return {value:n,kind:e,position:r,...a!==void 0&&{normalized:a},...u!==void 0&&{stem:u},...o!==void 0&&{stemConfidence:o},...s!==void 0&&{metadata:s}}}return {value:n,kind:e,position:r}}function $e(t){return /\s/.test(t)}function li(t){return t==="#"||t==="."||t==="["||t==="@"||t==="*"||t==="<"}function ci(t){return t==='"'||t==="'"||t==="`"||t==="\u300C"||t==="\u300D"}function ve(t){return /\d/.test(t)}function er(t){return t.replace(/[ً-ْٰ]/g,"")}function mi(t){return /[a-zA-Z]/.test(t)}function Q(t){return /[a-zA-Z0-9_-]/.test(t)}function di(t,e){if(e>=t.length)return null;let r=t[e];if(!li(r))return null;let i=e,n="";if(r==="#"||r==="."){for(n+=t[i++];i<t.length&&Q(t[i]);)n+=t[i++];if(n.length<=1)return null;if(i<t.length&&t[i]==="."&&r==="#"){let u=i+1;for(;u<t.length&&Q(t[u]);)u++;if(u<t.length&&t[u]==="(")return n}}else if(r==="["){let a=1,u=false,o=null,s=false;for(n+=t[i++];i<t.length&&a>0;){let l=t[i];n+=l,s?s=false:l==="\\"?s=true:u?l===o&&(u=false,o=null):l==='"'||l==="'"||l==="`"?(u=true,o=l):l==="["?a++:l==="]"&&a--,i++;}if(a!==0)return null}else if(r==="@"){for(n+=t[i++];i<t.length&&Q(t[i]);)n+=t[i++];if(n.length<=1)return null}else if(r==="*"){for(n+=t[i++];i<t.length&&Q(t[i]);)n+=t[i++];if(n.length<=1)return null}else if(r==="<"){if(n+=t[i++],i>=t.length||!mi(t[i]))return null;for(;i<t.length&&Q(t[i]);)n+=t[i++];for(;i<t.length;){let a=t[i];if(a==="."){if(n+=t[i++],i>=t.length||!Q(t[i]))return null;for(;i<t.length&&Q(t[i]);)n+=t[i++];}else if(a==="#"){if(n+=t[i++],i>=t.length||!Q(t[i]))return null;for(;i<t.length&&Q(t[i]);)n+=t[i++];}else if(a==="["){let u=1,o=false,s=null,l=false;for(n+=t[i++];i<t.length&&u>0;){let c=t[i];n+=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&&$e(t[i]);)n+=t[i++];if(i<t.length&&t[i]==="/")for(n+=t[i++];i<t.length&&$e(t[i]);)n+=t[i++];if(i>=t.length||t[i]!==">")return null;n+=t[i++];}return n||null}function pi(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 $e(i)||i==="*"||!Q(i)}function fi(t,e){if(e>=t.length)return null;let r=t[e];if(!ci(r)||r==="'"&&pi(t,e))return null;let n={'"':'"',"'":"'","`":"`","\u300C":"\u300D"}[r];if(!n)return null;let a=e+1,u=r,o=false;for(;a<t.length;){let s=t[a];if(u+=s,o)o=false;else if(s==="\\")o=true;else if(s===n)return u;a++;}return u}function yi(t,e){if(e>=t.length)return false;let r=t[e],i=t[e+1]||"",n=t[e+2]||"";if(r==="/"&&i!=="/"&&/[a-zA-Z0-9._-]/.test(i)||r==="/"&&i==="/"&&/[a-zA-Z]/.test(n)||r==="."&&(i==="/"||i==="."&&n==="/"))return true;let a=t.slice(e,e+8).toLowerCase();return !!(a.startsWith("http://")||a.startsWith("https://"))}function hi(t,e){if(!yi(t,e))return null;let r=e,i="",n=/[a-zA-Z0-9/:._\-?&=%@+~!$'()*,;[\]]/;for(;r<t.length;){let a=t[r];if(a==="#"){if(i.length>0&&/[a-zA-Z0-9/.]$/.test(i))for(i+=a,r++;r<t.length&&/[a-zA-Z0-9_-]/.test(t[r]);)i+=t[r++];break}if(n.test(a))i+=a,r++;else break}return i.length<2?null:i}function vi(t,e){if(e>=t.length)return null;let r=t[e];if(!ve(r)&&r!=="-"&&r!=="+")return null;let i=e,n="";if((t[i]==="-"||t[i]==="+")&&(n+=t[i++]),i>=t.length||!ve(t[i]))return null;for(;i<t.length&&ve(t[i]);)n+=t[i++];if(i<t.length&&t[i]===".")for(n+=t[i++];i<t.length&&ve(t[i]);)n+=t[i++];return i<t.length&&(t.slice(i,i+2)==="ms"?n+="ms":(t[i]==="s"||t[i]==="m"||t[i]==="h")&&(n+=t[i])),n}var Ei=["===","!==","->","==","!=","<=",">=","&&","||","**","+=","-=","*=","/=","+","-","*","/","=",">","<","!","&","|","%","^","~"];new Set(Ei);var gi=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"]),zi=["click","dblclick","input","change","submit","keydown","keyup","keypress","mousedown","mouseup","mouseover","mouseout","mouseenter","mouseleave","mousemove","pointerdown","pointerup","pointermove","focus","blur","load","resize","scroll"],rr=class Qe{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){oi(e)&&e.setContext(si(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&&$e(e[i]);)i++;if(i>=e.length)break;let n=this.tryMultiWordKeyword(e,i);if(n){r.push(n),i=n.position.end;continue}let a=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[p,y]of Object.entries(o.metadata))p!=="normalized"&&p!=="stem"&&p!=="stemConfidence"&&(m[p]=y);let d={};s&&(d.normalized=s),l&&(d.stem=l),c!==void 0&&(d.stemConfidence=c),Object.keys(m).length>0&&(d.metadata=m),r.push(W(o.value,this.classifyToken(o.value),V(i,i+o.length),Object.keys(d).length>0?d:void 0)),i+=o.length,a=true;break}}if(!a){let u=e[i],o=this.classifyUnknownChar(u);r.push(W(u,o,V(i,i+1))),i++;}}return new ie(this.mergeColonQualifiedNames(r),this.language)}mergeColonQualifiedNames(e){let r=[];for(let i of e){let n=r[r.length-1];if(n&&Qe.ASCII_WORD.test(n.value)&&Qe.COLON_QUALIFIER.test(i.value)&&n.position.end===i.position.start){let a=n.value+i.value;r[r.length-1]=W(a,this.classifyToken(a),V(n.position.start,i.position.end));continue}r.push(i);}return r}classifyUnknownChar(e){return "()[]{},:;".includes(e)?"punctuation":"+-*/<>=!&|".includes(e)?"operator":"identifier"}tryPropertyAccess(e,r,i){if(e[r]!==".")return false;let n=i[i.length-1],a=n&&n.position.end<r;if(n&&!a&&(n.kind==="identifier"||n.kind==="keyword"||n.kind==="selector"))return i.push(W(".","operator",V(r,r+1))),true;let s=r+1;for(;s<e.length&&Q(e[s]);)s++;return s<e.length&&e[s]==="("?(i.push(W(".","operator",V(r,r+1))),true):false}initializeKeywordsFromProfile(e,r=[]){let i=new Map;if(this.rawExtraEntries=r,e.keywords){for(let[n,a]of Object.entries(e.keywords))if(i.set(a.primary,{native:a.primary,normalized:a.normalized||n}),a.alternatives)for(let u of a.alternatives)i.set(u,{native:u,normalized:a.normalized||n});}if(e.references){for(let[n,a]of Object.entries(e.references))i.set(a,{native:a,normalized:n});for(let n of Object.keys(e.references))i.has(n)||i.set(n,{native:n,normalized:n});}if(e.roleMarkers){for(let[n,a]of Object.entries(e.roleMarkers))if(a.primary&&i.set(a.primary,{native:a.primary,normalized:n}),a.alternatives)for(let u of a.alternatives)i.set(u,{native:u,normalized:n});}if(e.possessive?.keywords)for(let[n,a]of Object.entries(e.possessive.keywords))i.set(n,{native:n,normalized:a});for(let n of zi)i.has(n)||i.set(n,{native:n,normalized:n});for(let n of r)i.set(n.native,n);this.profileKeywords=Array.from(i.values()).sort((n,a)=>a.native.length-n.native.length),this.multiWordKeywords=this.profileKeywords.filter(n=>n.native.includes(" ")&&!gi.has(n.normalized)),this.profileKeywordMap=new Map;for(let n of this.profileKeywords){this.profileKeywordMap.set(n.native.toLowerCase(),n);let a=this.removeDiacritics(n.native);a!==n.native&&!this.profileKeywordMap.has(a.toLowerCase())&&this.profileKeywordMap.set(a.toLowerCase(),n);}}removeDiacritics(e){return er(e)}tryProfileKeyword(e,r){for(let i of this.profileKeywords)if(e.slice(r).startsWith(i.native))return W(i.native,"keyword",V(r,r+i.native.length),i.normalized);return null}tryMultiWordKeyword(e,r,i=n=>/[\p{L}\p{N}_]/u.test(n)){if(this.multiWordKeywords.length===0)return null;let n=e.slice(r);for(let a of this.multiWordKeywords){if(!n.startsWith(a.native))continue;let u=e[r+a.native.length];if(!(u!==void 0&&i(u)))return W(a.native,"keyword",V(r,r+a.native.length),a.normalized)}return null}isKeywordStart(e,r){let i=e.slice(r);return this.profileKeywords.some(n=>i.startsWith(n.native))}isKeywordStartAtBoundary(e,r,i=n=>/[\p{L}\p{N}_]/u.test(n)){let n=e.slice(r);return this.profileKeywords.some(a=>{if(!n.startsWith(a.native))return false;let u=e[r+a.native.length];return u===void 0||!i(u)})}lookupKeyword(e){let r=this.profileKeywordMap.get(e.toLowerCase());if(r)return r;let i=this.removeDiacritics(e);if(i!==e)return this.profileKeywordMap.get(i.toLowerCase())}isKeyword(e){return this.lookupKeyword(e)!==void 0}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 n=this.tryNormalize(e);if(!n)return null;let a=this.lookupKeyword(n.stem);if(!a)return null;let u={normalized:a.normalized,stem:n.stem,stemConfidence:n.confidence};return W(e,"keyword",V(r,i),u)}trySelector(e,r){let i=di(e,r);return i?W(i,"selector",V(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 n=i[0].replace(/(\s|\.)$/,""),a=n.slice(1).split("(")[0],u=i[1];return {...W(n,"event-modifier",V(r,r+n.length)),metadata:{modifierName:a,value:u?a==="queue"?u:parseInt(u,10):void 0}}}tryString(e,r){let i=fi(e,r);return i?W(i,"literal",V(r,r+i.length)):null}tryNumber(e,r){let i=vi(e,r);return i?W(i,"literal",V(r,r+i.length)):null}tryMatchTimeUnit(e,r,i,n=false){let a=r;if(n)for(;a<e.length&&$e(e[a]);)a++;let u=e.slice(a);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(Q(c))continue}return {suffix:o.suffix,endPos:a+o.length}}}return null}parseBaseNumber(e,r,i=true){let n=r,a="";if(i&&(e[n]==="-"||e[n]==="+")&&(a+=e[n++]),n>=e.length||!ve(e[n]))return null;for(;n<e.length&&ve(e[n]);)a+=e[n++];if(n<e.length&&e[n]===".")for(a+=e[n++];n<e.length&&ve(e[n]);)a+=e[n++];return !a||a==="-"||a==="+"?null:{number:a,endPos:n}}tryNumberWithTimeUnits(e,r,i,n={}){let{allowSign:a=true,skipWhitespace:u=false}=n,o=this.parseBaseNumber(e,r,a);if(!o)return null;let{number:s,endPos:l}=o,c=[...i,...Qe.STANDARD_TIME_UNITS],m=this.tryMatchTimeUnit(e,l,c,u);return m&&(s+=m.suffix,l=m.endPos),W(s,"literal",V(r,l))}tryUrl(e,r){let i=hi(e,r);return i?W(i,"url",V(r,r+i.length)):null}tryVariableRef(e,r){if(e[r]!==":"||r+1>=e.length||!Q(e[r+1]))return null;let i=r+1;for(;i<e.length&&Q(e[i]);)i++;let n=e.slice(r,i);return W(n,"identifier",V(r,i))}tryOperator(e,r){let i=e.slice(r,r+2);if(["==","!=","<=",">=","&&","||","->"].includes(i))return W(i,"operator",V(r,r+2));let n=e[r];return ["<",">","!","+","-","*","/","="].includes(n)?W(n,"operator",V(r,r+1)):["(",")","{","}",",",";",":"].includes(n)?W(n,"punctuation",V(r,r+1)):null}tryMultiCharParticle(e,r,i){for(let n of i)if(e.slice(r,r+n.length)===n)return W(n,"particle",V(r,r+n.length));return null}};rr.ASCII_WORD=/^[A-Za-z_][A-Za-z0-9_]*$/;rr.COLON_QUALIFIER=/^:[A-Za-z_][A-Za-z0-9_]*$/;rr.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 Te=rr;function X(t){return {stem:t,confidence:1}}function B(t,e,r){return r?{stem:t,confidence:e,metadata:r}:{stem:t,confidence:e}}var ki=Object.defineProperty,wi=Object.getOwnPropertyNames,at=(t,e)=>function(){return t&&(e=(0, t[wi(t)[0]])(t=0)),e},Ci=(t,e)=>{for(var r in e)ki(t,r,{get:e[r],enumerable:true});};function Lr(t,e){return t.replace(/\{(\w+)\}/g,(r,i)=>String(e[i]??`{${i}}`))}function re(t,e,r={},i){let n=ut[t],a=Lr(n,r),u=ot[t],o=u?Lr(u,r):void 0;return {code:t,message:a,severity:e,...i&&{role:i},...o&&{suggestion:o}}}var T,ut,ot,bi=at({"src/generators/schema-error-codes.ts"(){T={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"},ut={[T.AMBIGUOUS_TYPE_LITERAL_SELECTOR]:"Role '{role}' accepts both 'literal' and 'selector'. This may cause ambiguous type inference for values starting with special characters (* . # etc.).",[T.TOO_MANY_EXPECTED_TYPES]:"Role '{role}' accepts {count} different types. This may make type inference unreliable.",[T.MULTI_TYPE_PATIENT_EXPECTED]:"Role '{role}' accepts multiple types (expected for {command} command).",[T.NO_REQUIRED_ROLES]:"Command has no required roles. Is this intentional?",[T.NO_REQUIRED_ROLES_EXPECTED]:"Command has no required roles (expected for {command}).",[T.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.",[T.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.",[T.EVENT_HANDLER_MISSING_EVENT]:"Event handler command should have an 'event' role to specify which event to listen for.",[T.EVENT_HANDLER_EVENT_NOT_REQUIRED]:"Event role should be required - every event handler needs an event to listen for.",[T.CONDITIONAL_MISSING_CONDITION]:"Conditional command should have a 'condition' role for the boolean expression.",[T.CONDITIONAL_CONDITION_NOT_REQUIRED]:"Condition role should be required - conditionals need a condition to evaluate.",[T.FOR_LOOP_MISSING_SOURCE]:"For-loop should have a 'source' role for the collection to iterate over.",[T.WHILE_LOOP_MISSING_CONDITION]:"While-loop should have a 'condition' role for the loop condition.",[T.VALUE_TYPE_MISMATCH]:"Role '{role}' of command '{command}' expects type [{expectedTypes}], got '{actualType}'.",[T.SELECTOR_KIND_MISMATCH]:"Role '{role}' of command '{command}' expects selector kind [{selectorKinds}], got '{actualKind}'.",[T.SELECTOR_KINDS_WITHOUT_SELECTOR_TYPE]:"Role '{role}' has selectorKinds but expectedTypes does not include 'selector'.",[T.KEYWORD_COLLISION]:"Keyword '{keyword}' is used by multiple commands: {commands}. Only the first-registered command will be reachable."},ot={[T.AMBIGUOUS_TYPE_LITERAL_SELECTOR]:"Consider being more specific about which type is expected, or use explicit type markers.",[T.TOO_MANY_EXPECTED_TYPES]:"Consider narrowing the accepted types to improve type inference reliability.",[T.TRANSITION_PATIENT_ACCEPTS_SELECTOR]:"Remove 'selector' from expectedTypes and only accept 'literal'.",[T.TRANSITION_MISSING_GOAL]:"Add a 'goal' role with expectedTypes ['literal', 'variable'].",[T.EVENT_HANDLER_MISSING_EVENT]:"Add an 'event' role with expectedTypes ['literal'].",[T.EVENT_HANDLER_EVENT_NOT_REQUIRED]:"Set required: true on the 'event' role.",[T.CONDITIONAL_MISSING_CONDITION]:"Add a 'condition' role with expectedTypes ['expression'].",[T.CONDITIONAL_CONDITION_NOT_REQUIRED]:"Set required: true on the 'condition' role.",[T.FOR_LOOP_MISSING_SOURCE]:"Add a 'source' role for the collection to iterate over.",[T.WHILE_LOOP_MISSING_CONDITION]:"Add a 'condition' role for the loop continuation condition.",[T.VALUE_TYPE_MISMATCH]:"Ensure the value matches one of the expected types: [{expectedTypes}].",[T.SELECTOR_KIND_MISMATCH]:"Use a selector of the correct kind: [{selectorKinds}].",[T.SELECTOR_KINDS_WITHOUT_SELECTOR_TYPE]:"Either add 'selector' to expectedTypes or remove selectorKinds.",[T.KEYWORD_COLLISION]:"Give each command a unique keyword. Move the shared keyword to alternatives on one command, or use a more specific translation."};}}),st={};Ci(st,{SchemaErrorCodes:()=>T,formatValidationResults:()=>Ti,getValidationStats:()=>Ri,validateAllKeywordCollisions:()=>Pi,validateAllSchemas:()=>Fi,validateCommandSchema:()=>lt,validateKeywordCollisions:()=>ct,validateRoleValues:()=>Oi});function Ai(t,e){return {action:t,items:e}}function lt(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(re(T.MULTI_TYPE_PATIENT_EXPECTED,"note",{role:i.role,command:t.action},i.role)):e.push(re(T.AMBIGUOUS_TYPE_LITERAL_SELECTOR,"warning",{role:i.role},i.role))),i.expectedTypes.length>3&&!Er.has(t.action)&&e.push(re(T.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(re(T.SELECTOR_KINDS_WITHOUT_SELECTOR_TYPE,"warning",{role:i.role},i.role)));switch(t.action){case "transition":Di(t,e);break;case "on":Si(t,e);break;case "if":case "unless":xi(t,e);break;case "repeat":case "for":case "while":Bi(t,e);break}return t.roles.filter(i=>i.required).length===0&&(mt.has(t.action)?e.push(re(T.NO_REQUIRED_ROLES_EXPECTED,"note",{command:t.action})):e.push(re(T.NO_REQUIRED_ROLES,"warning",{}))),Ai(t.action,e)}function Di(t,e){let r=t.roles.find(n=>n.role==="patient"),i=t.roles.find(n=>n.role==="goal");r&&!i&&e.push(re(T.TRANSITION_MISSING_GOAL,"error",{}));}function Si(t,e){let r=t.roles.find(i=>i.role==="event");r||e.push(re(T.EVENT_HANDLER_MISSING_EVENT,"warning",{})),r&&!r.required&&e.push(re(T.EVENT_HANDLER_EVENT_NOT_REQUIRED,"warning",{}));}function xi(t,e){let r=t.roles.find(i=>i.role==="condition");r||e.push(re(T.CONDITIONAL_MISSING_CONDITION,"warning",{})),r&&!r.required&&e.push(re(T.CONDITIONAL_CONDITION_NOT_REQUIRED,"warning",{}));}function Bi(t,e){t.action==="for"?t.roles.find(i=>i.role==="source")||e.push(re(T.FOR_LOOP_MISSING_SOURCE,"warning",{})):t.action==="while"&&(t.roles.find(i=>i.role==="condition")||e.push(re(T.WHILE_LOOP_MISSING_CONDITION,"warning",{})));}function Fi(t,e={}){let r=new Map,{includeNotes:i=false}=e;for(let[n,a]of Object.entries(t)){let u=lt(a),o=u.items.some(l=>l.severity==="warning"||l.severity==="error"),s=i&&u.items.some(l=>l.severity==="note");(o||s)&&r.set(n,u);}return r}function Ti(t,e={}){let r=[],{showNotes:i=false,showCodes:n=true}=e;for(let[a,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 ${a}:`);for(let c of o){let m=n?` [${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 ${a}:`);for(let c of s){let m=n?` [${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 ${a}:`);for(let c of l){let m=n?` [${c.code}]`:"";r.push(` ${m?`${c.code}: `:""}${c.message}`);}}}return r.join(`
|
|
1
|
+
var HyperscriptI18n=(function(exports){'use strict';function le(t,e){return e?{type:"literal",value:t,dataType:e}:{type:"literal",value:t}}function Xe(t,e){return e?{type:"selector",value:t,selectorKind:e}:{type:"selector",value:t}}function je(t){return {type:"reference",value:t}}function Je(t,e){return {type:"property-path",object:t,property:e}}var Nr=new Set(["me","you","it","result","event","target","body","document","window","detail"]);function dr(t,e=Nr){return e.has(t)}var ii=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}]`,n=new Date().toISOString();switch(t){case "debug":console.debug(`${n} ${i} DEBUG:`,e,...r);break;case "info":console.info(`${n} ${i} INFO:`,e,...r);break;case "warn":console.warn(`${n} ${i} WARN:`,e,...r);break;case "error":console.error(`${n} ${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 ni(t){return new ii(t)}function Se(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 ai(t,e){return t?.possessive?.keywords?.[e]}var Ve=class xe{constructor(){this.logger=ni("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 n=e.mark(),a=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,a);if(this.logger.debug("matchTokenSequence returned:",u),this.logger.debug("Captured roles:",Array.from(a.entries()).map(([s,l])=>[s,JSON.stringify(l)])),!u)return this.logger.debug(">>> MATCH FAILED - resetting token position"),e.reset(n),null;let o=this.calculateConfidence(r,a);return this.applyExtractionRules(r,a),{pattern:r,captured:a,consumedTokens:e.position()-n.position,confidence:o}}matchBest(e,r,i){let n=[];for(let u of r){let o=e.mark(),s=this.matchPattern(e,u,i);s&&n.push(s),e.reset(o);}if(n.length===0)return null;n.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 a=n[0];return this.matchPattern(e,a.pattern),a}matchTokenSequence(e,r,i,n){let a=r[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();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(n)for(let h of n)v.add(h);let f=[];for(;!e.isAtEnd();){let h=e.peek();if(!h||this.isStopMarker(h,v))break;f.push(h.value),e.advance();}if(f.length>0){i.set(c.role,{type:"expression",raw:f.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(n)for(let h of n)v.add(h);if(this.matchGroupToken(e,c,i,v)){o=null,s=null;continue}if(this.isOptional(c))continue;return false}let d=c.type==="role"&&c.optional===true,p=d?e.mark():null;if(c.type==="role"&&!d){let v=l+1<r.length?r[l+1]:null;if(v?.type==="literal"){let f=e.peek();if(f&&this.getMatchType(f,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 h=this.matchPatternToken(e,c,i);if(this.logger.debug(" >> Backtrack retry result:",h),h)continue}return false}}}let E=this.matchPatternToken(e,c,i);if(this.logger.debug(" >> Match result:",E),E){d?(o=p,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 n=this.getMatchType(i,r.value);if(this.logger.debug(" >>> matchType for",i.value,"vs",r.value,":",n),n!=="none")return this.totalKeywordMatches++,n==="stem"&&this.stemMatchCount++,e.advance(),true;if(r.alternatives)for(let a of r.alternatives){let u=this.getMatchType(i,a);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 n=e.peek();if(this.logger.debug(" >>> After skipNoiseWords, current token:",n?JSON.stringify({value:n.value,kind:n.kind}):"null"),!n)return r.optional||false;let a=this.tryMatchPossessiveExpression(e);if(a)return r.expectedTypes&&r.expectedTypes.length>0&&!Se(a.type,r.expectedTypes)?r.optional||false:(i.set(r.role,a),true);let u=this.tryMatchMethodCallExpression(e);if(u)return r.expectedTypes&&r.expectedTypes.length>0&&!Se(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&&!Se(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&&!Se(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&&!Se(l.type,r.expectedTypes)?r.optional||false:(i.set(r.role,l),true);this.logger.debug(" >>> Trying tokenToSemanticValue for token:",n?JSON.stringify({value:n.value,kind:n.kind}):"null");let c=this.tokenToSemanticValue(n);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&&!Se(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,n=this.safeToLowerCase(i),a=ai(this.currentProfile,n);if(!a)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()),Je(je(a),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 n=e.peek();if(!n||n.kind!=="operator"||n.value!==".")return e.reset(i),null;e.advance();let a=e.peek();if(!a||a.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<xe.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}.${a.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 n=e.peek();if(!n||n.kind!=="operator"||n.value!==".")return e.reset(i),null;e.advance();let a=e.peek();if(!a||a.kind!=="identifier")return e.reset(i),null;e.advance();let u=`${r.value}.${a.value}`,o=1;for(;!e.isAtEnd()&&o<xe.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<xe.MAX_METHOD_ARGS;){let d=e.peek();if(!d)break;if(d.kind==="punctuation"&&d.value===")"){if(c===0){e.advance();break}c--;}if(d.kind==="punctuation"&&d.value==="("&&c++,d.kind==="punctuation"&&d.value===","){e.advance();continue}l.push(d.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 n=e.peek();if(!n||n.kind!=="punctuation"||n.value!=="'s")return e.reset(i),null;e.advance();let a=e.peek();return !a||a.kind!=="selector"&&a.kind!=="identifier"?(e.reset(i),null):(e.advance(),Je(Xe(r.value),a.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 n=e.peek();if(!n||n.kind!=="selector"||!n.value.startsWith("."))return e.reset(i),null;let a=e.peek(1);a&&a.kind,e.advance();let u=n.value.slice(1);return Je(Xe(r.value),u)}matchGroupToken(e,r,i,n){let a=e.mark(),u=new Set(i.keys());if(this.matchTokenSequence(e,r.tokens,i,n))return true;e.reset(a);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<=xe.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 p=0;p<l;p++)e.advance();if(this.matchTokenSequence(e,r.tokens,i,n))return true;e.reset(a);for(let p of i.keys())u.has(p)||i.delete(p);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 n=r;n<e.length;n++){let a=e[n];if(a.type==="literal"){if(i.add(a.value.toLowerCase()),a.alternatives)for(let u of a.alternatives)i.add(u.toLowerCase());break}if(a.type==="group"){for(let u of a.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(!a.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 Xe(e.value);case "literal":return this.parseLiteralValue(e.value);case "keyword":let r=e.normalized||e.value;this.safeToLowerCase(r);return le(e.normalized||e.value);case "identifier":if(typeof e.value=="string"&&e.value.startsWith(":"))return je(e.value);this.safeToLowerCase(e.value);return {type:"expression",raw:e.value};case "url":return le(e.value,"string");default:return null}}parseLiteralValue(e){if(e.startsWith('"')||e.startsWith("'")||e.startsWith("`")||e.startsWith("\u300C")){let n=e.slice(1,-1);return le(n,"string")}if(e==="true")return le(true,"boolean");if(e==="false")return le(false,"boolean");let r=e.match(/^(\d+(?:\.\d+)?)(ms|s|m|h)?$/);if(r){let n=parseFloat(r[1]);return r[2]?le(e,"duration"):le(n,"number")}let i=parseFloat(e);return isNaN(i)?le(e,"string"):le(i,"number")}applyExtractionRules(e,r){for(let[i,n]of Object.entries(e.extraction))r.has(i)||(n.value!==void 0?r.set(i,{type:"literal",value:n.value}):n.default&&r.set(i,n.default));}isOptional(e){return e.type!=="literal"&&e.optional===true}calculateConfidence(e,r){let i=0,n=0,a=l=>e.extraction?.[l]?.default!==void 0;for(let l of e.template.tokens)if(l.type==="role")n+=1,r.has(l.role)&&(i+=1);else if(l.type==="group"){for(let c of l.tokens)if(c.type==="role"){let m=a(c.role),d=.8;n+=d,r.has(c.role)?i+=d:m&&(i+=d*.6);}}let u=n>0?i/n: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 n of r.alternatives)if(i.has(n))return .15}return 0}arabicPrepositionDisambiguation(e,r){if(e.language!=="ar")return 0;let i=0,n={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[a,u]of r.entries()){let o=n[a];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(xe.ENGLISH_NOISE_WORDS.has(i)){let n=e.mark();e.advance();let a=e.peek();if(a&&a.kind==="selector")return;e.reset(n);}i==="class"&&e.advance();}extractEventModifiers(e){let r={},i=false;for(;!e.isAtEnd();){let n=e.peek();if(!n||n.kind!=="event-modifier")break;let a=n.metadata;if(!a)break;switch(i=true,a.modifierName){case "once":r.once=true;break;case "debounce":typeof a.value=="number"&&(r.debounce=a.value);break;case "throttle":typeof a.value=="number"&&(r.throttle=a.value);break;case "queue":(a.value==="first"||a.value==="last"||a.value==="all"||a.value==="none")&&(r.queue=a.value);break}e.advance();}return i?r:void 0}};Ve.MAX_MARKER_SCAN=3;Ve.MAX_PROPERTY_DEPTH=10;Ve.MAX_METHOD_ARGS=20;Ve.ENGLISH_NOISE_WORDS=new Set(["the","a","an"]);var ui=Ve;new ui;var Be=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 a=1;for(;e+a<t.length;){if(t[e+a]==="\u201D")return a++,{value:t.substring(e,e+a),length:a};a++;}return null}if(r==="\u2018"){let a=1;for(;e+a<t.length;){if(t[e+a]==="\u2019")return a++,{value:t.substring(e,e+a),length:a};a++;}return null}let i=1,n=false;for(;e+i<t.length;){let a=t[e+i];if(n){n=false,i++;continue}if(a==="\\"){n=true,i++;continue}if(a===r)return i++,{value:t.substring(e,e+i),length:i};i++;}return null}},Fe=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 n=t.substring(e,e+r),a=e+r;if(a<t.length){let u=t.slice(a),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:n+l.suffix,length:r+l.pattern.length,metadata:{hasTimeUnit:true}};if(u.startsWith("ms"))return {value:n+"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:n+l.suffix,length:r+1,metadata:{hasTimeUnit:true}};if(/^[smh](?![a-zA-Z])/.test(u))return {value:n+u[0],length:r+1,metadata:{hasTimeUnit:true}}}return {value:n,length:r}}};function oi(t){return "setContext"in t&&typeof t.setContext=="function"}function si(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 ie=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 V(t,e){return {start:t,end:e}}function W(t,e,r,i){if(typeof t=="object"){let{value:a,kind:u,position:o,normalized:s,stem:l,stemConfidence:c,metadata:m}=t;return {value:a,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 n=t;if(!e||!r)throw new Error("createToken requires kind and position parameters");if(typeof i=="string")return {value:n,kind:e,position:r,normalized:i};if(i){let{normalized:a,stem:u,stemConfidence:o,metadata:s}=i;return {value:n,kind:e,position:r,...a!==void 0&&{normalized:a},...u!==void 0&&{stem:u},...o!==void 0&&{stemConfidence:o},...s!==void 0&&{metadata:s}}}return {value:n,kind:e,position:r}}function $e(t){return /\s/.test(t)}function li(t){return t==="#"||t==="."||t==="["||t==="@"||t==="*"||t==="<"}function ci(t){return t==='"'||t==="'"||t==="`"||t==="\u300C"||t==="\u300D"}function ve(t){return /\d/.test(t)}function er(t){return t.replace(/[\u064b-\u0652\u0670]/g,"")}function mi(t){return /[a-zA-Z]/.test(t)}function Q(t){return /[a-zA-Z0-9_-]/.test(t)}function di(t,e){if(e>=t.length)return null;let r=t[e];if(!li(r))return null;let i=e,n="";if(r==="#"||r==="."){for(n+=t[i++];i<t.length&&Q(t[i]);)n+=t[i++];if(n.length<=1)return null;if(i<t.length&&t[i]==="."&&r==="#"){let u=i+1;for(;u<t.length&&Q(t[u]);)u++;if(u<t.length&&t[u]==="(")return n}}else if(r==="["){let a=1,u=false,o=null,s=false;for(n+=t[i++];i<t.length&&a>0;){let l=t[i];n+=l,s?s=false:l==="\\"?s=true:u?l===o&&(u=false,o=null):l==='"'||l==="'"||l==="`"?(u=true,o=l):l==="["?a++:l==="]"&&a--,i++;}if(a!==0)return null}else if(r==="@"){for(n+=t[i++];i<t.length&&Q(t[i]);)n+=t[i++];if(n.length<=1)return null}else if(r==="*"){for(n+=t[i++];i<t.length&&Q(t[i]);)n+=t[i++];if(n.length<=1)return null}else if(r==="<"){if(n+=t[i++],i>=t.length||!mi(t[i]))return null;for(;i<t.length&&Q(t[i]);)n+=t[i++];for(;i<t.length;){let a=t[i];if(a==="."){if(n+=t[i++],i>=t.length||!Q(t[i]))return null;for(;i<t.length&&Q(t[i]);)n+=t[i++];}else if(a==="#"){if(n+=t[i++],i>=t.length||!Q(t[i]))return null;for(;i<t.length&&Q(t[i]);)n+=t[i++];}else if(a==="["){let u=1,o=false,s=null,l=false;for(n+=t[i++];i<t.length&&u>0;){let c=t[i];n+=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&&$e(t[i]);)n+=t[i++];if(i<t.length&&t[i]==="/")for(n+=t[i++];i<t.length&&$e(t[i]);)n+=t[i++];if(i>=t.length||t[i]!==">")return null;n+=t[i++];}return n||null}function pi(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 $e(i)||i==="*"||!Q(i)}function fi(t,e){if(e>=t.length)return null;let r=t[e];if(!ci(r)||r==="'"&&pi(t,e))return null;let n={'"':'"',"'":"'","`":"`","\u300C":"\u300D"}[r];if(!n)return null;let a=e+1,u=r,o=false;for(;a<t.length;){let s=t[a];if(u+=s,o)o=false;else if(s==="\\")o=true;else if(s===n)return u;a++;}return u}function yi(t,e){if(e>=t.length)return false;let r=t[e],i=t[e+1]||"",n=t[e+2]||"";if(r==="/"&&i!=="/"&&/[a-zA-Z0-9._-]/.test(i)||r==="/"&&i==="/"&&/[a-zA-Z]/.test(n)||r==="."&&(i==="/"||i==="."&&n==="/"))return true;let a=t.slice(e,e+8).toLowerCase();return !!(a.startsWith("http://")||a.startsWith("https://"))}function hi(t,e){if(!yi(t,e))return null;let r=e,i="",n=/[a-zA-Z0-9/:._\-?&=%@+~!$'()*,;[\]]/;for(;r<t.length;){let a=t[r];if(a==="#"){if(i.length>0&&/[a-zA-Z0-9/.]$/.test(i))for(i+=a,r++;r<t.length&&/[a-zA-Z0-9_-]/.test(t[r]);)i+=t[r++];break}if(n.test(a))i+=a,r++;else break}return i.length<2?null:i}function vi(t,e){if(e>=t.length)return null;let r=t[e];if(!ve(r)&&r!=="-"&&r!=="+")return null;let i=e,n="";if((t[i]==="-"||t[i]==="+")&&(n+=t[i++]),i>=t.length||!ve(t[i]))return null;for(;i<t.length&&ve(t[i]);)n+=t[i++];if(i<t.length&&t[i]===".")for(n+=t[i++];i<t.length&&ve(t[i]);)n+=t[i++];return i<t.length&&(t.slice(i,i+2)==="ms"?n+="ms":(t[i]==="s"||t[i]==="m"||t[i]==="h")&&(n+=t[i])),n}var Ei=["===","!==","->","==","!=","<=",">=","&&","||","**","+=","-=","*=","/=","+","-","*","/","=",">","<","!","&","|","%","^","~"];new Set(Ei);var gi=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"]),zi=["click","dblclick","input","change","submit","keydown","keyup","keypress","mousedown","mouseup","mouseover","mouseout","mouseenter","mouseleave","mousemove","pointerdown","pointerup","pointermove","focus","blur","load","resize","scroll"],rr=class Qe{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){oi(e)&&e.setContext(si(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&&$e(e[i]);)i++;if(i>=e.length)break;let n=this.tryMultiWordKeyword(e,i);if(n){r.push(n),i=n.position.end;continue}let a=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[p,y]of Object.entries(o.metadata))p!=="normalized"&&p!=="stem"&&p!=="stemConfidence"&&(m[p]=y);let d={};s&&(d.normalized=s),l&&(d.stem=l),c!==void 0&&(d.stemConfidence=c),Object.keys(m).length>0&&(d.metadata=m),r.push(W(o.value,this.classifyToken(o.value),V(i,i+o.length),Object.keys(d).length>0?d:void 0)),i+=o.length,a=true;break}}if(!a){let u=e[i],o=this.classifyUnknownChar(u);r.push(W(u,o,V(i,i+1))),i++;}}return new ie(this.mergeColonQualifiedNames(r),this.language)}mergeColonQualifiedNames(e){let r=[];for(let i of e){let n=r[r.length-1];if(n&&Qe.ASCII_WORD.test(n.value)&&Qe.COLON_QUALIFIER.test(i.value)&&n.position.end===i.position.start){let a=n.value+i.value;r[r.length-1]=W(a,this.classifyToken(a),V(n.position.start,i.position.end));continue}r.push(i);}return r}classifyUnknownChar(e){return "()[]{},:;".includes(e)?"punctuation":"+-*/<>=!&|".includes(e)?"operator":"identifier"}tryPropertyAccess(e,r,i){if(e[r]!==".")return false;let n=i[i.length-1],a=n&&n.position.end<r;if(n&&!a&&(n.kind==="identifier"||n.kind==="keyword"||n.kind==="selector"))return i.push(W(".","operator",V(r,r+1))),true;let s=r+1;for(;s<e.length&&Q(e[s]);)s++;return s<e.length&&e[s]==="("?(i.push(W(".","operator",V(r,r+1))),true):false}initializeKeywordsFromProfile(e,r=[]){let i=new Map;if(this.rawExtraEntries=r,e.keywords){for(let[n,a]of Object.entries(e.keywords))if(i.set(a.primary,{native:a.primary,normalized:a.normalized||n}),a.alternatives)for(let u of a.alternatives)i.set(u,{native:u,normalized:a.normalized||n});}if(e.references){for(let[n,a]of Object.entries(e.references))i.set(a,{native:a,normalized:n});for(let n of Object.keys(e.references))i.has(n)||i.set(n,{native:n,normalized:n});}if(e.roleMarkers){for(let[n,a]of Object.entries(e.roleMarkers))if(a.primary&&i.set(a.primary,{native:a.primary,normalized:n}),a.alternatives)for(let u of a.alternatives)i.set(u,{native:u,normalized:n});}if(e.possessive?.keywords)for(let[n,a]of Object.entries(e.possessive.keywords))i.set(n,{native:n,normalized:a});for(let n of zi)i.has(n)||i.set(n,{native:n,normalized:n});for(let n of r)i.set(n.native,n);this.profileKeywords=Array.from(i.values()).sort((n,a)=>a.native.length-n.native.length),this.multiWordKeywords=this.profileKeywords.filter(n=>n.native.includes(" ")&&!gi.has(n.normalized)),this.profileKeywordMap=new Map;for(let n of this.profileKeywords){this.profileKeywordMap.set(n.native.toLowerCase(),n);let a=this.removeDiacritics(n.native);a!==n.native&&!this.profileKeywordMap.has(a.toLowerCase())&&this.profileKeywordMap.set(a.toLowerCase(),n);}}removeDiacritics(e){return er(e)}tryProfileKeyword(e,r){for(let i of this.profileKeywords)if(e.slice(r).startsWith(i.native))return W(i.native,"keyword",V(r,r+i.native.length),i.normalized);return null}tryMultiWordKeyword(e,r,i=n=>/[\p{L}\p{N}_]/u.test(n)){if(this.multiWordKeywords.length===0)return null;let n=e.slice(r);for(let a of this.multiWordKeywords){if(!n.startsWith(a.native))continue;let u=e[r+a.native.length];if(!(u!==void 0&&i(u)))return W(a.native,"keyword",V(r,r+a.native.length),a.normalized)}return null}isKeywordStart(e,r){let i=e.slice(r);return this.profileKeywords.some(n=>i.startsWith(n.native))}isKeywordStartAtBoundary(e,r,i=n=>/[\p{L}\p{N}_]/u.test(n)){let n=e.slice(r);return this.profileKeywords.some(a=>{if(!n.startsWith(a.native))return false;let u=e[r+a.native.length];return u===void 0||!i(u)})}lookupKeyword(e){let r=this.profileKeywordMap.get(e.toLowerCase());if(r)return r;let i=this.removeDiacritics(e);if(i!==e)return this.profileKeywordMap.get(i.toLowerCase())}isKeyword(e){return this.lookupKeyword(e)!==void 0}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 n=this.tryNormalize(e);if(!n)return null;let a=this.lookupKeyword(n.stem);if(!a)return null;let u={normalized:a.normalized,stem:n.stem,stemConfidence:n.confidence};return W(e,"keyword",V(r,i),u)}trySelector(e,r){let i=di(e,r);return i?W(i,"selector",V(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 n=i[0].replace(/(\s|\.)$/,""),a=n.slice(1).split("(")[0],u=i[1];return {...W(n,"event-modifier",V(r,r+n.length)),metadata:{modifierName:a,value:u?a==="queue"?u:parseInt(u,10):void 0}}}tryString(e,r){let i=fi(e,r);return i?W(i,"literal",V(r,r+i.length)):null}tryNumber(e,r){let i=vi(e,r);return i?W(i,"literal",V(r,r+i.length)):null}tryMatchTimeUnit(e,r,i,n=false){let a=r;if(n)for(;a<e.length&&$e(e[a]);)a++;let u=e.slice(a);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(Q(c))continue}return {suffix:o.suffix,endPos:a+o.length}}}return null}parseBaseNumber(e,r,i=true){let n=r,a="";if(i&&(e[n]==="-"||e[n]==="+")&&(a+=e[n++]),n>=e.length||!ve(e[n]))return null;for(;n<e.length&&ve(e[n]);)a+=e[n++];if(n<e.length&&e[n]===".")for(a+=e[n++];n<e.length&&ve(e[n]);)a+=e[n++];return !a||a==="-"||a==="+"?null:{number:a,endPos:n}}tryNumberWithTimeUnits(e,r,i,n={}){let{allowSign:a=true,skipWhitespace:u=false}=n,o=this.parseBaseNumber(e,r,a);if(!o)return null;let{number:s,endPos:l}=o,c=[...i,...Qe.STANDARD_TIME_UNITS],m=this.tryMatchTimeUnit(e,l,c,u);return m&&(s+=m.suffix,l=m.endPos),W(s,"literal",V(r,l))}tryUrl(e,r){let i=hi(e,r);return i?W(i,"url",V(r,r+i.length)):null}tryVariableRef(e,r){if(e[r]!==":"||r+1>=e.length||!Q(e[r+1]))return null;let i=r+1;for(;i<e.length&&Q(e[i]);)i++;let n=e.slice(r,i);return W(n,"identifier",V(r,i))}tryOperator(e,r){let i=e.slice(r,r+2);if(["==","!=","<=",">=","&&","||","->"].includes(i))return W(i,"operator",V(r,r+2));let n=e[r];return ["<",">","!","+","-","*","/","="].includes(n)?W(n,"operator",V(r,r+1)):["(",")","{","}",",",";",":"].includes(n)?W(n,"punctuation",V(r,r+1)):null}tryMultiCharParticle(e,r,i){for(let n of i)if(e.slice(r,r+n.length)===n)return W(n,"particle",V(r,r+n.length));return null}};rr.ASCII_WORD=/^[A-Za-z_][A-Za-z0-9_]*$/;rr.COLON_QUALIFIER=/^:[A-Za-z_][A-Za-z0-9_]*$/;rr.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 Te=rr;function X(t){return {stem:t,confidence:1}}function B(t,e,r){return r?{stem:t,confidence:e,metadata:r}:{stem:t,confidence:e}}var ki=Object.defineProperty,wi=Object.getOwnPropertyNames,at=(t,e)=>function(){return t&&(e=(0, t[wi(t)[0]])(t=0)),e},Ci=(t,e)=>{for(var r in e)ki(t,r,{get:e[r],enumerable:true});};function Lr(t,e){return t.replace(/\{(\w+)\}/g,(r,i)=>String(e[i]??`{${i}}`))}function re(t,e,r={},i){let n=ut[t],a=Lr(n,r),u=ot[t],o=u?Lr(u,r):void 0;return {code:t,message:a,severity:e,...i&&{role:i},...o&&{suggestion:o}}}var T,ut,ot,bi=at({"src/generators/schema-error-codes.ts"(){T={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"},ut={[T.AMBIGUOUS_TYPE_LITERAL_SELECTOR]:"Role '{role}' accepts both 'literal' and 'selector'. This may cause ambiguous type inference for values starting with special characters (* . # etc.).",[T.TOO_MANY_EXPECTED_TYPES]:"Role '{role}' accepts {count} different types. This may make type inference unreliable.",[T.MULTI_TYPE_PATIENT_EXPECTED]:"Role '{role}' accepts multiple types (expected for {command} command).",[T.NO_REQUIRED_ROLES]:"Command has no required roles. Is this intentional?",[T.NO_REQUIRED_ROLES_EXPECTED]:"Command has no required roles (expected for {command}).",[T.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.",[T.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.",[T.EVENT_HANDLER_MISSING_EVENT]:"Event handler command should have an 'event' role to specify which event to listen for.",[T.EVENT_HANDLER_EVENT_NOT_REQUIRED]:"Event role should be required - every event handler needs an event to listen for.",[T.CONDITIONAL_MISSING_CONDITION]:"Conditional command should have a 'condition' role for the boolean expression.",[T.CONDITIONAL_CONDITION_NOT_REQUIRED]:"Condition role should be required - conditionals need a condition to evaluate.",[T.FOR_LOOP_MISSING_SOURCE]:"For-loop should have a 'source' role for the collection to iterate over.",[T.WHILE_LOOP_MISSING_CONDITION]:"While-loop should have a 'condition' role for the loop condition.",[T.VALUE_TYPE_MISMATCH]:"Role '{role}' of command '{command}' expects type [{expectedTypes}], got '{actualType}'.",[T.SELECTOR_KIND_MISMATCH]:"Role '{role}' of command '{command}' expects selector kind [{selectorKinds}], got '{actualKind}'.",[T.SELECTOR_KINDS_WITHOUT_SELECTOR_TYPE]:"Role '{role}' has selectorKinds but expectedTypes does not include 'selector'.",[T.KEYWORD_COLLISION]:"Keyword '{keyword}' is used by multiple commands: {commands}. Only the first-registered command will be reachable."},ot={[T.AMBIGUOUS_TYPE_LITERAL_SELECTOR]:"Consider being more specific about which type is expected, or use explicit type markers.",[T.TOO_MANY_EXPECTED_TYPES]:"Consider narrowing the accepted types to improve type inference reliability.",[T.TRANSITION_PATIENT_ACCEPTS_SELECTOR]:"Remove 'selector' from expectedTypes and only accept 'literal'.",[T.TRANSITION_MISSING_GOAL]:"Add a 'goal' role with expectedTypes ['literal', 'variable'].",[T.EVENT_HANDLER_MISSING_EVENT]:"Add an 'event' role with expectedTypes ['literal'].",[T.EVENT_HANDLER_EVENT_NOT_REQUIRED]:"Set required: true on the 'event' role.",[T.CONDITIONAL_MISSING_CONDITION]:"Add a 'condition' role with expectedTypes ['expression'].",[T.CONDITIONAL_CONDITION_NOT_REQUIRED]:"Set required: true on the 'condition' role.",[T.FOR_LOOP_MISSING_SOURCE]:"Add a 'source' role for the collection to iterate over.",[T.WHILE_LOOP_MISSING_CONDITION]:"Add a 'condition' role for the loop continuation condition.",[T.VALUE_TYPE_MISMATCH]:"Ensure the value matches one of the expected types: [{expectedTypes}].",[T.SELECTOR_KIND_MISMATCH]:"Use a selector of the correct kind: [{selectorKinds}].",[T.SELECTOR_KINDS_WITHOUT_SELECTOR_TYPE]:"Either add 'selector' to expectedTypes or remove selectorKinds.",[T.KEYWORD_COLLISION]:"Give each command a unique keyword. Move the shared keyword to alternatives on one command, or use a more specific translation."};}}),st={};Ci(st,{SchemaErrorCodes:()=>T,formatValidationResults:()=>Ti,getValidationStats:()=>Ri,validateAllKeywordCollisions:()=>Pi,validateAllSchemas:()=>Fi,validateCommandSchema:()=>lt,validateKeywordCollisions:()=>ct,validateRoleValues:()=>Oi});function Ai(t,e){return {action:t,items:e}}function lt(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(re(T.MULTI_TYPE_PATIENT_EXPECTED,"note",{role:i.role,command:t.action},i.role)):e.push(re(T.AMBIGUOUS_TYPE_LITERAL_SELECTOR,"warning",{role:i.role},i.role))),i.expectedTypes.length>3&&!Er.has(t.action)&&e.push(re(T.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(re(T.SELECTOR_KINDS_WITHOUT_SELECTOR_TYPE,"warning",{role:i.role},i.role)));switch(t.action){case "transition":Di(t,e);break;case "on":Si(t,e);break;case "if":case "unless":xi(t,e);break;case "repeat":case "for":case "while":Bi(t,e);break}return t.roles.filter(i=>i.required).length===0&&(mt.has(t.action)?e.push(re(T.NO_REQUIRED_ROLES_EXPECTED,"note",{command:t.action})):e.push(re(T.NO_REQUIRED_ROLES,"warning",{}))),Ai(t.action,e)}function Di(t,e){let r=t.roles.find(n=>n.role==="patient"),i=t.roles.find(n=>n.role==="goal");r&&!i&&e.push(re(T.TRANSITION_MISSING_GOAL,"error",{}));}function Si(t,e){let r=t.roles.find(i=>i.role==="event");r||e.push(re(T.EVENT_HANDLER_MISSING_EVENT,"warning",{})),r&&!r.required&&e.push(re(T.EVENT_HANDLER_EVENT_NOT_REQUIRED,"warning",{}));}function xi(t,e){let r=t.roles.find(i=>i.role==="condition");r||e.push(re(T.CONDITIONAL_MISSING_CONDITION,"warning",{})),r&&!r.required&&e.push(re(T.CONDITIONAL_CONDITION_NOT_REQUIRED,"warning",{}));}function Bi(t,e){t.action==="for"?t.roles.find(i=>i.role==="source")||e.push(re(T.FOR_LOOP_MISSING_SOURCE,"warning",{})):t.action==="while"&&(t.roles.find(i=>i.role==="condition")||e.push(re(T.WHILE_LOOP_MISSING_CONDITION,"warning",{})));}function Fi(t,e={}){let r=new Map,{includeNotes:i=false}=e;for(let[n,a]of Object.entries(t)){let u=lt(a),o=u.items.some(l=>l.severity==="warning"||l.severity==="error"),s=i&&u.items.some(l=>l.severity==="note");(o||s)&&r.set(n,u);}return r}function Ti(t,e={}){let r=[],{showNotes:i=false,showCodes:n=true}=e;for(let[a,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 ${a}:`);for(let c of o){let m=n?` [${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 ${a}:`);for(let c of s){let m=n?` [${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 ${a}:`);for(let c of l){let m=n?` [${c.code}]`:"";r.push(` ${m?`${c.code}: `:""}${c.message}`);}}}return r.join(`
|
|
2
2
|
`)}function Ri(t){let e=0,r=0,i=0,n={};for(let a of t.values())for(let u of a.items)u.severity==="error"?e++:u.severity==="warning"?r++:u.severity==="note"&&i++,n[u.code]=(n[u.code]||0)+1;return {totalCommands:t.size,errors:e,warnings:r,notes:i,byCode:n}}function Oi(t,e){let r=[];for(let i of e){let n=t.roles.find(a=>a.role===i.role);n&&(n.expectedTypes.length>0&&!n.expectedTypes.includes(i.type)&&(n.expectedTypes.includes("expression")||r.push({level:"error",role:i.role,message:`${t.action}.${i.role} expects type [${n.expectedTypes.join(", ")}], got '${i.type}'`,code:T.VALUE_TYPE_MISMATCH})),i.type==="selector"&&i.selectorKind&&n.selectorKinds&&n.selectorKinds.length>0&&(n.selectorKinds.includes(i.selectorKind)||r.push({level:"error",role:i.role,message:`${t.action}.${i.role} expects selector kind [${n.selectorKinds.join(", ")}], got '${i.selectorKind}'`,code:T.SELECTOR_KIND_MISMATCH})));}return r}function ct(t){let e=[];if(!t.keywords)return {language:t.code,collisions:e};let r=new Map;for(let[n,a]of Object.entries(t.keywords)){if(!a||!a.primary)continue;let u=r.get(a.primary)||[];if(u.push({command:n,isPrimary:true}),r.set(a.primary,u),a.alternatives)for(let o of a.alternatives){let s=r.get(o)||[];s.push({command:n,isPrimary:false}),r.set(o,s);}}for(let[n,a]of r){let u=[...new Set(a.map(l=>l.command))];if(u.length<=1)continue;let o=a.filter(l=>l.isPrimary).length,s;o>=2?s="primary-primary":o===1?s="primary-alternative":s="alternative-alternative",e.push({keyword:n,commands:u.sort(),type:s});}let i={"primary-primary":0,"primary-alternative":1,"alternative-alternative":2};return e.sort((n,a)=>i[n.type]-i[a.type]),{language:t.code,collisions:e}}function Pi(t){let e=[];for(let[,r]of Object.entries(t)){let i=ct(r);i.collisions.length>0&&e.push(i);}return e.sort((r,i)=>r.language.localeCompare(i.language))}var Er,mt,Ni=at({"src/generators/schema-validator.ts"(){bi(),Er=new Set(["put","append","prepend","log","throw","make","measure","return","swap","morph","beep","copy"]),mt=new Set(["compound","else","halt","continue","async","init","settle","focus","blur","return","js","measure","break","exit","beep","empty","open","close","select","clear","reset","breakpoint","live","eventsource","socket","worker","intercept"]);}});var ke=new Map,de=new Map,qe=new Map,gr=null;function dt(t,e){let r={...t};for(let i of Object.keys(e)){let n=e[i],a=t[i];n!==void 0&&(typeof n=="object"&&n!==null&&!Array.isArray(n)&&typeof a=="object"&&a!==null&&!Array.isArray(a)?r[i]=dt(a,n):r[i]=n);}return r}function _i(t,e){return dt(t,e)}function Cr(t){if(!t.extends)return t;let e=de.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=Cr(e);return _i(r,t)}function Me(t,e,r){ke.set(t,e),de.set(t,r),qe.delete(t);}function pt(t){gr=t;}var Ir=new Map;function Ne(t){return t.split("-")[0]}function _e(t){return t.includes("-")}function Mi(t){let e=ke.get(t);if(!e&&_e(t)){let r=Ne(t);e=ke.get(r);}if(!e){let r=Array.from(ke.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 Li(t){let e=de.get(t);if(!e&&_e(t)){let r=Ne(t);e=de.get(r);}if(!e){let r=Array.from(de.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 Cr(e)}function N(t){let e=de.get(t);return !e&&_e(t)&&(e=de.get(Ne(t))),e?Cr(e):void 0}function Ii(){return Array.from(ke.keys())}function ft(t){if(ke.has(t)&&de.has(t))return true;if(_e(t)){let e=Ne(t);return ke.has(e)&&de.has(e)}return false}function ji(t,e){return Mi(e).tokenize(t)}function me(t){let e=qe.get(t);if(!e&&_e(t)&&(e=qe.get(Ne(t))),e)return e;let r=Ir.get(t);if(!r&&_e(t)&&(r=Ir.get(Ne(t))),r)return qe.set(t,r),r;if(!gr)throw new Error(`No patterns registered for language '${t}'. Either import the language module or set a pattern generator.`);let i=Li(t),n=gr(i);return qe.set(t,n),n}var yt={possessive:{specialForms:{me:"my",it:"its",you:"your"}}};function ze(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 q(t,e){let r={type:"literal",value:t};return e!==void 0?{type:"literal",value:t,dataType:e}:r}function Re(t){return dr(t)}function ue(t){return {type:"reference",value:t}}function Ee(t,e){return {type:"property-path",object:t,property:e}}function ne(t,e,r){let i={kind:"command",action:t,roles:new Map(Object.entries(e))};return r!==void 0?{...i,metadata:r}:i}function We(t,e,r,i,n,a){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),n!==void 0&&n.length>0&&(o.parameterNames=n),o}function dn(t,e,r,i,n){let a={kind:"behavior",action:"behavior",roles:new Map,name:t,parameters:e,eventHandlers:r};return i!==void 0&&i.length>0&&(a.initBlock=i),n!==void 0&&(a.metadata=n),a}function pn(t,e,r,i){let n={kind:"def",action:"def",roles:new Map,name:t,parameters:e,body:r};return i!==void 0&&(n.metadata=i),n}function jr(t,e,r,i){let n={kind:"feature",action:t,roles:new Map,body:e};return r!==void 0&&(n.name=r),i!==void 0&&(n.metadata=i),n}function zr(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 fn(t,e,r,i){let n=new Map;n.set("condition",t);let a={kind:"conditional",action:"if",roles:n,thenBranch:e};return r!==void 0&&(a.elseBranch=r),i!==void 0&&(a.metadata=i),a}function tr(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 Ce(t){let e=t.roles.find(r=>r.role==="destination");return e?{destination:e.default?{fromRole:"destination",default:e.default}:{fromRole:"destination"}}:{}}function be(t){let e=t.roles.find(r=>r.role==="source");return e?{source:e.default?{fromRole:"source",default:e.default}:{fromRole:"source"}}:{}}function Ae(t,e){return ht(t,e,"source")}function br(t,e){return ht(t,e,"destination")}function ht(t,e,r){if(!e||!t.roles.some(a=>a.role===r))return [];let i=e.alternatives?{type:"literal",value:e.primary,alternatives:[...e.alternatives]}:{type:"literal",value:e.primary},n={type:"role",role:r,optional:true};return [{type:"group",optional:true,tokens:e.position==="after"?[n,i]:[i,n]}]}var yn={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)"}},hn={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",es:"a",ar:"\u0625\u0644\u0649",zh:"\u5230",fr:"\xE0",de:"zu",pt:"a",he:"\u05D0\u05DC",id:"ke",it:"a",sw:"kwa"},markerLegacy:{es:["en","sobre","hacia"],ar:["\u0639\u0644\u0649","\u0641\u064A","\u0628"],zh:["\u5728","\u4E8E"],fr:["sur","dans"],de:["auf","in"],pt:["em","para"],he:["\u05E2\u05DC","\u05D1","\u05DC"],id:["pada","di"],it:["in","su"],sw:["kwenye"]}}],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"}},vn={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"}},En={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",ar:"\u0641\u064A",zh:"\u5230",fr:"dans",de:"in",he:"\u05D1",id:"ke",sw:"kwa"},markerVariants:{en:["before","after"]},markerLegacy:{ar:["\u0639\u0644\u0649","\u0625\u0644\u0649","\u0628"],zh:["\u5728","\u4E8E"],fr:["sur","\xE0"],de:["auf","zu"],he:["\u05E2\u05DC","\u05D0\u05DC","\u05DC"],id:["pada","di"],sw:["kwenye"]},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"}},gn={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>"}},zn={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","property-path"],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>"}},kn={action:"live",description:"Reactive block: re-run the body when its dependencies change",category:"control-flow",primaryRole:"patient",hasBody:true,bareKeyword:true,roles:[]},wn={action:"eventsource",description:"Open a Server-Sent Events stream and handle its events",category:"async",primaryRole:"patient",hasBody:true,bareKeyword:true,roles:[]},Cn={action:"socket",description:"Open a WebSocket and handle its messages",category:"async",primaryRole:"patient",hasBody:true,bareKeyword:true,roles:[]},bn={action:"worker",description:"Define a Web Worker with inline methods",category:"async",primaryRole:"patient",hasBody:true,bareKeyword:true,roles:[]},An={action:"intercept",description:"Service-worker fetch interception / caching strategies",category:"async",primaryRole:"patient",hasBody:true,bareKeyword:true,roles:[]},Dn={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}]},Sn={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}]},xn={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}]},Bn={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,markerVariants:{hi:["\u0915\u094B"],qu:["ta"],bn:["\u0995\u09C7"]}},{role:"destination",description:"The target element (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:2,sovPosition:1}]},Fn={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}]},Tn={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:"style",description:"Request options object (method, headers, body, credentials\u2026)",required:false,expectedTypes:["expression"],svoPosition:2,sovPosition:2},{role:"responseType",description:"Response format (json, text, html, blob, etc.)",required:false,expectedTypes:["literal","expression"],svoPosition:3,sovPosition:3,markerOverride:{en:"as"}},{role:"method",description:"HTTP method (GET, POST, etc.)",required:false,expectedTypes:["literal"],svoPosition:4,sovPosition:4},{role:"destination",description:"Where to store the result",required:false,expectedTypes:["selector","reference"],svoPosition:5,sovPosition:5}]},Rn={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"}}]},On={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"}}]},Pn={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"}}]},Nn={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"}}]},_n={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}]},Mn={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}]},Ln={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}]},In={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}]},jn={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}]},$n={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}]},Vn={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}]},Wn={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"}}]},qn={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}]},Kn={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}]},Un={action:"else",description:"Else branch of conditional",category:"control-flow",primaryRole:"patient",hasBody:true,roles:[]},Hn={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"'},Gn={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"}}]},Yn={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}]},Zn={action:"continue",description:"Continue to next loop iteration",category:"control-flow",primaryRole:"patient",roles:[]},Ar={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"},Xn={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",es:"a",ar:"\u0625\u0644\u0649",fr:"\xE0",de:"zu",pt:"para",he:"\u05D0\u05DC",hi:"\u092A\u0930",id:"ke",it:"a",ru:"\u043D\u0430",sw:"kwa",uk:"\u043D\u0430"},renderOverride:{en:"",zh:"",vi:"",th:""},markerOptional:{en:true,zh:true,vi:true,th:true},markerVariants:{zh:["\u628A"]},markerLegacy:{es:["en","sobre","hacia"],ar:["\u0639\u0644\u0649","\u0641\u064A","\u0628"],fr:["sur","dans"],de:["auf","in"],pt:["em","a"],he:["\u05E2\u05DC","\u05D1","\u05DC","\u05D0\u05EA"],hi:["\u092E\u0947\u0902"],id:["pada","di"],it:["in","su"],ru:["\u0432","\u043A"],sw:["kwenye"],uk:["\u0432","\u0434\u043E"]}}],rolePrefixLiteralVariants:[{role:"destination",literal:Ar,idSuffix:"url",priorityDelta:5,methodCarrier:"method"}]},Jn={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}]},Qn={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"}}]},ea={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}]},ra={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}]},ta={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}]},ia={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"}}]},na={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}]},aa={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}]},ua={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}]},oa={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}]},sa={action:"breakpoint",description:"Drop into the debugger",category:"control-flow",primaryRole:"patient",roles:[],bareKeyword:true},la={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}]},ca={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}]},ma={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:[]},pa={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"}}]},fa={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"}}]},ya={action:"init",description:"Initialization block that runs once",category:"control-flow",primaryRole:"patient",hasBody:true,roles:[]},ha={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}]},va={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}]},Ea={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"}}]},ga={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",hi:"\u0938\u0947",bn:"\u09A6\u09BF\u09AF\u09BC\u09C7",tr:"ile",qu:"wan",ar:"\u0628\u0640",tl:"nang"}}]},za={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"}}]},ka={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}]},wa={action:"break",description:"Exit from the current loop",category:"control-flow",primaryRole:"patient",roles:[]},Ca={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}]},ba={action:"exit",description:"Exit from the current event handler",category:"control-flow",primaryRole:"patient",roles:[],bareKeyword:true},Aa={action:"pick",description:"Select item(s), character(s), a range, first/last/random N, or regex matches from a root",category:"variable",primaryRole:"patient",roles:[{role:"patient",description:"The range/count/index/regex argument to pick",required:true,expectedTypes:["literal","expression","reference"],svoPosition:1,sovPosition:1},{role:"source",description:'The root to pick from (with "of"/"from" keyword)',required:false,expectedTypes:["reference","expression"],svoPosition:2,sovPosition:2}]},Da={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"}}]},Sa={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"},xa={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:Ar}]},Ba={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:Ar}]},Fa={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:Sa}]},Ta={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}]},we={toggle:yn,add:hn,remove:vn,put:En,set:gn,show:Dn,hide:Sn,on:xn,trigger:Bn,wait:Fn,fetch:Tn,increment:Rn,decrement:On,append:Pn,prepend:Nn,log:_n,get:Mn,take:Ln,make:In,halt:jn,settle:$n,throw:Vn,send:Wn,if:qn,unless:Kn,else:Un,repeat:Hn,for:Gn,while:Yn,continue:Zn,go:Xn,scroll:Da,push:xa,replace:Ba,process:Fa,transition:Jn,clone:Qn,focus:ea,blur:ra,empty:ta,open:ia,close:na,select:aa,clear:ua,reset:oa,breakpoint:sa,call:la,return:ca,js:ma,async:da,tell:pa,default:fa,init:ya,behavior:ha,install:va,measure:Ea,swap:ga,morph:za,beep:ka,break:wa,copy:Ca,exit:ba,pick:Aa,render:Ta,bind:zn,live:kn,eventsource:wn,socket:Cn,worker:bn,intercept:An,compound:{action:"compound",description:"A compound node representing chained statements",primaryRole:"patient",category:"control-flow",hasBody:true,roles:[]}};function ee(t){return we[t]}function Ra(){return Object.values(we).filter(t=>t.roles.length>0||t.bareKeyword===true)}typeof process<"u"&&process.env.LOKASCRIPT_SCHEMA_VALIDATION==="1"&&Promise.resolve().then(()=>(Ni(),st)).then(({validateAllSchemas:t,formatValidationResults:e})=>{let r=t(we);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[n,a]of Object.entries(i))if(a===e)return n}}function pr(t){return yt.possessive?.specialForms?.[t]??`${t}'s`}var Oa={ar:{\u0642\u064A\u0645\u0629:"value"},bn:{\u0985\u0995\u09CD\u09B7\u09AE:"disabled","\u099A\u09C7\u0995 \u0995\u09B0\u09BE":"checked",\u09A6\u09C8\u09B0\u09CD\u0998\u09CD\u09AF:"length",\u09AE\u09BE\u09A8:"value"},de:{wert:"value"},es:{valor:"value"},fr:{valeur:"value"},hi:{\u0905\u0915\u094D\u0937\u092E:"disabled",\u091A\u0947\u0915:"checked",\u091B\u093F\u092A\u093E:"hidden",\u092E\u093E\u0928:"value"},id:{nilai:"value"},it:{valore:"value"},ja:{\u5024:"value"},ko:{\uAC12:"value"},ms:{dilumpuhkan:"disabled",ditanda:"checked",nilai:"value",panjang:"length"},pl:{warto\u015B\u0107:"value"},pt:{valor:"value"},qu:{chanin:"value"},ru:{\u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435:"value",\u043E\u0442\u043A\u043B\u044E\u0447\u0435\u043D\u043E:"disabled",\u043E\u0442\u043C\u0435\u0447\u0435\u043D\u043E:"checked",\u0441\u043A\u0440\u044B\u0442\u043E:"hidden"},sw:{thamani:"value"},th:{\u0E04\u0E27\u0E32\u0E21\u0E22\u0E32\u0E27:"length",\u0E04\u0E48\u0E32:"value",\u0E1B\u0E34\u0E14\u0E43\u0E0A\u0E49\u0E07\u0E32\u0E19:"disabled",\u0E40\u0E25\u0E37\u0E2D\u0E01\u0E41\u0E25\u0E49\u0E27:"checked"},tl:{haba:"length",halaga:"value",hindi_pinagana:"disabled",naka_tsek:"checked"},tr:{de\u011Fer:"value"},uk:{\u0432\u0438\u043C\u043A\u043D\u0435\u043D\u043E:"disabled",\u0437\u043D\u0430\u0447\u0435\u043D\u043D\u044F:"value",\u043F\u043E\u0437\u043D\u0430\u0447\u0435\u043D\u043E:"checked",\u043F\u0440\u0438\u0445\u043E\u0432\u0430\u043D\u043E:"hidden"},vi:{\u1EA9n:"hidden","\u0111\u01B0\u1EE3c ch\u1ECDn":"checked","gi\xE1 tr\u1ECB":"value","v\xF4 hi\u1EC7u":"disabled"},zh:{\u503C:"value"}},Pa={ar:{\u0643\u0640:"as"},bn:{\u09B9\u09BF\u09B8\u09BE\u09AC\u09C7:"as"},de:{als:"as"},es:{como:"as"},fr:{comme:"as"},hi:{\u0915\u0947_\u0930\u0942\u092A_\u092E\u0947\u0902:"as"},id:{sebagai:"as"},it:{come:"as"},ja:{\u3068\u3057\u3066:"as"},ko:{\uB85C:"as"},ms:{sebagai:"as"},pl:{jako:"as"},pt:{como:"as"},qu:{hina:"as"},ru:{\u043A\u0430\u043A:"as"},sw:{kuwa:"as"},tl:{bilang:"as"},tr:{olarak:"as"},uk:{\u044F\u043A:"as"},vi:{nh\u01B0:"as"},zh:{\u4F5C\u4E3A:"as"}},Na={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"]),ar:new Set(["\u0644\u0640"]),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"])};function vt(t,e){let r=e.value.toLowerCase(),i=(e.normalized??"").toLowerCase();if(r==="of"||r==="ng"||i==="of"||i==="source")return true;let n=t?.code?Na[t.code]:void 0;return !!n&&n.has(r)}var _a={destination:"in",source:"from"},Ma={ar:new Set(["\u0639\u0646\u062F","\u0641\u064A"]),bn:new Set(["\u098F","\u09A4\u09C7"]),de:new Set(["bei"]),es:new Set(["en"]),fr:new Set(["dans","en","\xE0"]),he:new Set(["\u05DC\u05EA\u05D5\u05DA"]),hi:new Set(["\u092A\u0930","\u092E\u0947\u0902"]),id:new Set(["dalam","di","ke_dalam"]),it:new Set(["a"]),ja:new Set(["\u3067","\u306E\u4E2D","\u3078"]),ko:new Set(["\uC548\uC5D0","\uC5D0","\uC73C\uB85C"]),ms:new Set(["dalam","di","ke_dalam"]),pl:new Set(["do","przy","w"]),pt:new Set(["dentro","em"]),qu:new Set(["pi","ukupi"]),ru:new Set(["\u0432","\u0443"]),sw:new Set(["katika","ndani"]),th:new Set(["\u0E17\u0E35\u0E48","\u0E43\u0E19"]),tl:new Set(["papasok_sa","sa","sa_loob"]),tr:new Set(["de","i\xE7inde","i\xE7ine"]),uk:new Set(["\u0432","\u0443"]),vi:new Set(["trong","t\u1EA1i","v\xE0o"]),zh:new Set(["\u5728","\u8FDB\u5165"])},La=new Set(["in","into","at","within","inside"]);function Ia(t,e){let r=e.value.toLowerCase();if((t?.code?Ma[t.code]:void 0)?.has(r))return "in";let n=e.normalized??e.value,a=n.toLowerCase();return La.has(a)?"in":_a[a]??n}var fr=new Set(["first","last","next","previous","random","closest"]),ja={bn:{\u09B6\u09C7\u09B7:"last"}},Et=new Set(Object.keys(we).map(t=>t.toLowerCase()));function gt(t,e,r){let i=t[e];if(!i)return null;let n=(i.normalized??i.value).toLowerCase(),a=t[e+1],u=r?.code&&a?.kind==="selector"&&a.value.startsWith("<")?ja[r.code]?.[i.value.toLowerCase()]:void 0;if(!fr.has(n)&&!fr.has(i.value.toLowerCase())&&u===void 0)return null;let o=[{text:u??i.normalized??i.value,token:i}],s=e+1,l=t[s];if(!l||l.kind!=="selector")return null;o.push({text:l.value,token:l}),s++;let c=0;for(;c++<8;){let p=t[s];if(p&&p.kind==="selector"&&p.value.startsWith("."))o.push({text:p.value,token:p}),s++;else break}let m=t[s],d=t[s+1];return m&&d&&d.kind==="selector"&&(m.kind==="keyword"||m.kind==="particle"||m.kind==="identifier")&&!fr.has((m.normalized??m.value).toLowerCase())&&!Et.has((m.normalized??m.value).toLowerCase())&&(o.push({text:Ia(r,m),token:m}),o.push({text:d.value,token:d}),s+=2),{parts:o,consumed:s-e}}function $a(t,e){let r=Pa[t];return r?r[e.toLowerCase()]??e:e}function Pe(t,e){let r=Oa[t];return r?r[e.toLowerCase()]??e:e}function Va(t,e){let r=[e.value,e.normalized].filter(Boolean);for(let i of r){let n=ce(t,i)??ce(t,i.toLowerCase());if(n)return n}}function zt(t){return t.kind==="literal"||t.kind==="operator"||t.kind==="punctuation"?false:!/^[$:@#.*^(){}[\]]/.test(t.value)}function Wa(t,e){let r=t?.references;if(!r)return false;let i=Object.values(r).filter(a=>typeof a=="string").map(a=>a.toLowerCase());return [e.value,e.normalized].filter(Boolean).some(a=>i.includes(a.toLowerCase()))}function qa(t,e){return zt(t)?Pe(e,t.value)!==t.value?true:t.kind==="identifier":false}var Ka={ar:{\u0647\u0648:{beforePredicate:"is"}},hi:{\u0939\u0948:{beforePredicate:"is"},\u0928\u0939\u0940\u0902:{beforeBareIdentifier:"no"}},th:{\u0E40\u0E1B\u0E47\u0E19:{beforeTypeName:"as",beforePredicate:"is"}},ja:{\u7A7A:{afterCopula:"empty"}},zh:{\u6CA1\u6709:{beforeBareIdentifier:"no"}},tl:{walang:{beforeBareIdentifier:"no"},may:{afterSubject:"exists"}},bn:{\u0986\u099B\u09C7:{afterSubject:"exists"}},tr:{var:{afterSubject:"exists"}}},Ua=new Set(["empty","null","undefined","true","false"]),Ha=new Set(["Number","Int","Float","String","Date","Array","Object","JSON","json","FormData","HTML","Fragment","Values"]);function Ga(t,e,r,i){let n=Ka[t],a=n?.[e.value]??n?.[e.value.toLowerCase()];if(a){if(a.beforeTypeName&&i?.kind==="identifier"&&Ha.has(i.value))return a.beforeTypeName;if(a.beforePredicate&&i&&(i.kind==="literal"||i.kind==="keyword"&&Ua.has((i.normalized??"").toLowerCase())))return a.beforePredicate;if(a.beforeBareIdentifier&&i?.kind==="identifier"&&/^[A-Za-z_]\w*$/.test(i.value))return a.beforeBareIdentifier;if(a.afterSubject&&(r?.kind==="selector"||r?.kind==="reference"))return a.afterSubject;if(a.afterCopula&&r?.kind==="keyword"&&(r.normalized??"").toLowerCase()==="is")return a.afterCopula}}function kr(t,e){let r=e?.code??"en",i="",n,a=(o,s)=>{if(n===void 0){i=o,n=s;return}let c=n.position?.end!==void 0&&s.position?.start!==void 0&&n.position.end===s.position.start&&(o.startsWith(".")||o.startsWith("!"));i+=(c?"":" ")+o,n=s;},u=o=>o.kind==="keyword"?o.normalized??o.value:o.value;for(let o=0;o<t.length;o++){let s=t[o],l=e?Va(e,s):void 0,c=t[o+1];if(l!==void 0&&c){let E=e?.possessive?.connectors,v=!!E?.length&&E.some(k=>{let D=k.toLowerCase();return D===c.value.toLowerCase()||D===(c.normalized??"").toLowerCase()}),f=v?o+2:o+1,h=t[f];if(h&&qa(h,r)){a(pr(l),s),a(Pe(r,h.value),h),o=f;continue}if(v&&h&&/^\.[a-zA-Z_]\w*$/.test(h.value)&&c.position?.end!==void 0&&h.position?.start!==void 0&&c.position.end===h.position.start){a(pr(l),s),a(Pe(r,h.value.slice(1)),h),o=f;continue}if(!v&&/^\.[a-zA-Z_]\w*$/.test(c.value)&&s.position?.end!==void 0&&c.position?.start!==void 0&&s.position.end===c.position.start&&!Wa(e,s)){a(pr(l),s),a(Pe(r,c.value.slice(1)),c),o+=1;continue}}let m=t[o+2];if(c&&m&&m.kind==="selector"&&vt(e,c)&&zt(s)){a(Pe(r,s.value),s),a("of",c),a(m.value,m),o+=2;continue}let d=gt(t,o,e);if(d){for(let E of d.parts)a(E.text,E.token);o+=d.consumed-1;continue}let p=Ga(r,s,t[o-1],c);if(p!==void 0){a(p,s);continue}let y=$a(r,s.value);if(y!==s.value){a(y,s);continue}a(u(s),s);}return i.trim()}var kt=[{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 $r(t,e,r,i){let n=kt.find(u=>u.lang===t);if(!n)return false;let a=(u,o)=>(u??"").toLowerCase()===o.toLowerCase();return a(e,n.end)&&a(r,n.at)&&a(i,n.of)}function Ya(t,e){let r=kt.find(n=>n.lang===t);if(!r)return false;let i=e.toLowerCase();return i===r.at.toLowerCase()||i===r.of.toLowerCase()||i===r.end.toLowerCase()}var wt={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"])};function Za(t){return wt[t]}function Xa(t,e){return wt[e]?.has(t.toLowerCase())??false}var Ct=96,Ja=/^[A-Za-z_][\w-]*$/,Qa=/^[A-Za-z_][\w-]*:[^\s'"`/:][^\s]*$/;function bt(t,e){let r=t.peek(e);return !!r&&r.kind==="identifier"&&Qa.test(r.value)}function At(t,e){let r=t.peek(e);if(!r||r.kind!=="identifier"&&r.kind!=="keyword"||!Ja.test(r.value))return false;let i=t.peek(e+1),n=t.peek(e+2);return !!i&&i.value===":"&&!!n}function Vr(t,e=0){return bt(t,e)||At(t,e)}function eu(t){let e=t.peek();if(!e||e.value!=="{"&&e.value!=="(")return null;let r="",i=-1,n=0,a=0;for(;!t.isAtEnd()&&a++<Ct;){let u=t.advance();if(!u)break;if(i>=0&&u.position.start>i&&(r+=" ".repeat(u.position.start-i)),r+=u.value,i=u.position.end,u.value==="{"||u.value==="(")n++;else if((u.value==="}"||u.value===")")&&(n--,n===0))return r}return null}function Wr(t){let e=t.peek();return e?e.value==="{"||e.value==="("?eu(t):e.value===","||e.value===":"?null:(t.advance(),e.value):null}function Ke(t,e){let r=t.mark(),i=[];if(e!==void 0){let a=t.peek();if(!a||a.value!==":"||!t.peek(1))return null;t.advance();let u=Wr(t);if(u===null)return t.reset(r),null;i.push(`${e}:${u}`);}else if(!Vr(t))return null;let n=0;for(;n++<Ct;){let a=t.peek();if(!a)break;if(a.value===","){if(i.length===0||!Vr(t,1))break;t.advance();continue}if(bt(t,0)){i.push(t.advance().value);continue}if(!At(t,0))break;let u=t.advance().value;t.advance();let o=Wr(t);if(o===null)return t.reset(r),null;i.push(`${u}:${o}`);}return i.length===0?(t.reset(r),null):`{${i.join(", ")}}`}var yr=.8,ru=.6,tu=.15,iu=.5,qr=.15,Kr=.1,Ur=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"]),nu={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"]},au=class{calculate(t){return this.calculateWithBreakdown(t).final}calculateWithBreakdown(t){let e=this.scoreRoleCoverage(t),r=this.scoreStemPenalty(t),i=this.scoreLanguageBoost(t),n=this.scoreLanguageAdjustment(t),a=e;return a=Math.max(iu,a+r),a=Math.min(1,a+i),a=Math.max(0,Math.min(1,a+n)),{roleCoverage:e,stemPenalty:r,languageBoost:i,languageAdjustment:n,final:a}}scoreRoleCoverage(t){let{pattern:e,captured:r}=t,i=0,n=0,a=u=>e.extraction?.[u]?.default!==void 0;for(let u of e.template.tokens)if(u.type==="role")n+=1,r.has(u.role)&&(i+=1);else if(u.type==="group")for(let o of u.tokens)o.type==="role"&&(n+=yr,r.has(o.role)?i+=yr:a(o.role)&&(i+=yr*ru));return n>0?i/n:1}scoreStemPenalty(t){let{stemMatchCount:e,totalKeywordMatches:r}=t;return e<=0||r<=0?0:-(e/r)*tu}scoreLanguageBoost(t){let{pattern:e}=t;if(e.language!=="ar")return 0;let r=e.template.tokens[0];return !r||r.type!=="literal"?0:Ur.has(r.value)||r.alternatives?.some(i=>Ur.has(i))?qr:0}scoreLanguageAdjustment(t){let{pattern:e,captured:r}=t;if(e.language!=="ar")return 0;let i=0;for(let[n,a]of r.entries()){let u=nu[n];if(!u||u.length===0)continue;let o="metadata"in a?a.metadata:void 0;o&&typeof o.prepositionValue=="string"&&(u.includes(o.prepositionValue)?i+=.1:i-=.1);}return Math.max(-Kr,Math.min(Kr,i))}},uu=new au,ou=new Set(Object.values(we).filter(t=>t.bareKeyword===true).map(t=>t.action)),J=class L{constructor(e){this.matchCache=new Map,this.stemMatchCount=0,this.totalKeywordMatches=0,this.confidenceModel=e??uu;}matchPattern(e,r){let i=e.mark(),n=new Map;if(this.currentProfile=N(r.language),this.currentPatternCommand=r.command,this.stemMatchCount=0,this.totalKeywordMatches=0,!this.matchTokenSequence(e,r.template.tokens,n))return e.reset(i),null;let u=this.confidenceModel.calculate({pattern:r,captured:n,stemMatchCount:this.stemMatchCount,totalKeywordMatches:this.totalKeywordMatches});return this.applyExtractionRules(r,n),{pattern:r,captured:n,consumedTokens:e.position()-i.position,confidence:u}}matchBest(e,r){this.matchCache.clear();let i=[],n=e.position();for(let u of r){let o=e.mark(),s=`${n}:${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 a=i[0];return this.matchPattern(e,a.pattern),a}matchTokenSequence(e,r,i,n){let a=r[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();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]??n);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 n=e.peek(),a=e.peek(1);if(!n||!a||this.patternTokenWouldMatch(i,n))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(n)&&a.kind==="selector"){e.advance();let l=this.tokenToSemanticValue(e.advance());l&&r.set("source",l);return}if(s==="after"&&n.kind==="selector"&&o(a)){let l=this.tokenToSemanticValue(n);e.advance(),e.advance(),l&&r.set("source",l);}}matchPatternToken(e,r,i,n){switch(r.type){case "literal":return this.matchLiteralToken(e,r);case "role":return this.matchRoleToken(e,r,i,n);case "group":return this.matchGroupToken(e,r,i,n);default:return false}}matchLiteralToken(e,r){let i=e.peek();if(!i)return false;let n=this.getMatchType(i,r.value);if(n!=="none")return this.totalKeywordMatches++,n==="stem"&&this.stemMatchCount++,e.advance(),true;if(r.alternatives)for(let a of r.alternatives){let u=this.getMatchType(i,a);if(u!=="none")return this.totalKeywordMatches++,u==="stem"&&this.stemMatchCount++,e.advance(),true}for(let a of [r.value,...r.alternatives??[]])for(let u of ["-","_"])if(a.includes(u)&&this.tryMatchShatteredCompound(e,a,u))return this.totalKeywordMatches++,true;return false}tryFoldHyphenActionKeyword(e){let r=this.currentProfile;if(!r)return null;let i=e.mark(),n=[];for(;;){let u=e.peek();if(!u||u.kind!=="identifier"&&u.kind!=="keyword")break;n.push(u.value),e.advance();let o=e.peek();if(!o||o.value!=="-")break;e.advance(),n.push("-");}if(n.length<3||n[n.length-1]==="-")return e.reset(i),null;let a=n.join("").toLowerCase();for(let[u,o]of Object.entries(r.keywords))if(o.primary.toLowerCase()===a||o.alternatives?.some(s=>s.toLowerCase()===a))return q(u);return e.reset(i),null}tryMatchShatteredCompound(e,r,i){let n=r.split(i);if(n.length<2||n.some(u=>u.length===0))return false;let a=e.mark();for(let u=0;u<n.length;u++){if(u>0){let s=e.peek();if(!s||s.value!==i)return e.reset(a),false;e.advance();}let o=e.peek();if(!o||o.kind!=="identifier"&&o.kind!=="keyword"&&o.kind!=="particle"||o.value.toLowerCase()!==n[u].toLowerCase())return e.reset(a),false;e.advance();}return true}matchRoleToken(e,r,i,n){this.skipNoiseWords(e);let a=e.peek();if(!a)return r.optional||false;if(r.role==="action"&&this.currentProfile&&e.peek(1)?.value==="-"){let f=this.tryFoldHyphenActionKeyword(e);if(f)return i.set(r.role,f),true}if(r.role==="event"&&this.currentPatternCommand==="on"){if(!L.tokenLooksLikeEvent(a))return r.optional||false;let f=(a.normalized??a.value).toLowerCase();if(L.POSITIONAL_OR_SCOPE_KEYWORDS.has(f)||this.currentProfile&&(ce(this.currentProfile,a.value)??ce(this.currentProfile,f))!==void 0||a.value.includes("?."))return r.optional||false}if(r.role==="event"){let f=(a.normalized??a.value).toLowerCase();if(L.STRUCTURAL_NEVER_EVENT.has(f))return r.optional||false}if(a.kind==="keyword"){let f=(a.normalized??a.value).toLowerCase();if(f==="then"||f==="end"&&e.peek(1)?.kind!=="selector"||Xa(a.value,this.currentProfile?.code??""))return r.optional||false}if(r.role==="duration"){let f=(a.normalized??a.value).toLowerCase();if(L.POSITIONAL_OR_SCOPE_KEYWORDS.has(f))return r.optional||false}if(r.optional&&n===void 0&&r.role!=="event"&&r.role!=="action"&&a.kind==="keyword"&&(a.normalized??a.value).toLowerCase()in we)return true;let u=this.tryMatchPositionalExpression(e);if(u)return r.expectedTypes&&r.expectedTypes.length>0&&!tr(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&&!tr(o.type,r.expectedTypes)?r.optional||false:(i.set(r.role,o),true);if(r.role!=="event"&&(!r.expectedTypes||r.expectedTypes.includes("expression"))){let f=this.tryMatchBeepPrefixExpression(e);if(f)return i.set(r.role,f),true;let h=this.tryMatchOperatorRunExpression(e);if(h)return i.set(r.role,h),true}if(this.currentPatternCommand==="pick"&&r.role==="patient"&&(!r.expectedTypes||r.expectedTypes.includes("expression"))){let f=this.tryMatchPickRangeExpression(e);if(f)return i.set(r.role,f),true}if(r.expectedTypes?.includes("property-path")){let f=this.tryMatchOfPossessiveExpression(e);if(f)return i.set(r.role,f),true;let h=this.tryMatchPostNominalPossessiveExpression(e);if(h)return i.set(r.role,h),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"||L.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 d=this.tryMatchPossessiveSelectorExpression(e);if(d)return r.expectedTypes&&r.expectedTypes.length>0&&!tr(d.type,r.expectedTypes)?r.optional||false:(i.set(r.role,d),true);let p=r.role!=="condition",y=this.tryMatchPropertyAccessExpression(e,p);if(y)return r.expectedTypes&&r.expectedTypes.length>0&&!r.expectedTypes.includes(y.type)&&!r.expectedTypes.includes("expression")?r.optional||false:(i.set(r.role,y),true);let E=this.tryMatchSelectorPropertyExpression(e);if(E)return r.expectedTypes&&r.expectedTypes.length>0&&!tr(E.type,r.expectedTypes)?r.optional||false:(i.set(r.role,E),true);if(a.kind==="identifier"&&a.value==="{"){let f=r.expectedTypes,k=f?.length===1&&f[0]==="expression"?this.tryMatchBraceRunExpression(e):!f?.length||f.includes("literal")?this.tryMatchBraceRunLiteral(e):null;if(k)return i.set(r.role,k),true}if(r.role==="style"&&r.expectedTypes?.length===1&&r.expectedTypes[0]==="expression"){let f=Ke(e);if(f)return i.set(r.role,{type:"expression",raw:f}),true}let v=this.tokenToSemanticValue(a);if(!v)return r.optional||false;if(r.expectedTypes&&r.expectedTypes.length>0&&!r.expectedTypes.includes(v.type)){let f=v.type==="selector"&&String(v.value).startsWith("@"),h=r.expectedTypes.some(k=>k==="expression"||k==="reference");if(!(f&&h))return r.optional||false}if(i.set(r.role,v),e.advance(),r.role==="event"){let f=e.peek();f&&f.kind==="selector"&&f.value.startsWith("[")&&"value"in v&&(i.set(r.role,q(`${String(v.value)}${f.value}`)),e.advance());let h=e.peek();if(h&&(h.kind==="particle"||h.kind==="keyword")&&(h.normalized??"").toLowerCase()==="source"&&!this.patternTokenWouldMatch(n,h)){let k=e.peek(1);if(k&&(k.kind==="selector"||k.kind==="identifier")){e.advance();let D=this.tokenToSemanticValue(e.advance());D&&!i.has("source")&&i.set("source",D);}}}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=gt(e.tokens,e.position(),this.currentProfile);if(!r)return null;for(let i=0;i<r.consumed;i++)e.advance();return {type:"expression",raw:r.parts.map(i=>i.text).join(" ")}}tryMatchCaretScopeExpression(e){let r=e.peek();if(!r||r.kind!=="identifier"||!r.value.startsWith("^"))return null;let i=e.peek(1),n=e.peek(2),a=(i?.normalized??"").toLowerCase(),u=!!i&&(i.value.toLowerCase()==="on"||a==="destination"||a==="on");return !i||!n||n.kind!=="selector"||!u?null:(e.advance(),e.advance(),e.advance(),{type:"expression",raw:`${r.value} on ${n.value}`})}isOfPossessiveMarker(e){return vt(this.currentProfile,e)}tryMatchBeepPrefixExpression(e){let r=e.peek(),i=e.peek(1);if(!r||!i||i.value!=="!"||(r.normalized??r.value).toLowerCase()!=="beep"||!(r.position?.end!==void 0&&i.position?.start!==void 0&&r.position.end===i.position.start))return null;let a=e.mark(),u=e.position();if(e.advance(),e.advance(),!this.tryConsumeRunOperand(e))return e.reset(a),null;for(;;){let s=e.peek();if(!s||!L.RUN_OPERATORS.has(s.value))break;let l=e.mark();if(e.advance(),!this.tryConsumeRunOperand(e)){e.reset(l);break}}let o=kr(e.tokens.slice(u,e.position()),this.currentProfile);return {type:"expression",raw:o,value:o}}tryMatchOperatorRunExpression(e){let r=e.mark(),i=e.position();if(!this.tryConsumeRunOperand(e))return e.reset(r),null;let n=1;for(;;){let u=e.peek();if(!u||!L.RUN_OPERATORS.has(u.value))break;let o=e.mark();if(e.advance(),!this.tryConsumeRunOperand(e)){e.reset(o);break}n++;}if(n<2)return e.reset(r),null;let a=kr(e.tokens.slice(i,e.position()),this.currentProfile);return {type:"expression",raw:a,value:a}}isPickRangeSeparator(e){let r=(e.normalized??e.value).toLowerCase();if(L.PICK_RANGE_SEPARATORS.has(r))return true;let i=this.currentProfile?.code;return i?L.PICK_RANGE_SEPARATORS_BY_LANG[i]?.has(e.value.toLowerCase())??false:false}tryMatchPickRangeExpression(e){let r=e.mark(),i=e.position();if(!this.tryConsumePickRangeOperand(e))return e.reset(r),null;let n=e.peek();if(!n||!this.isPickRangeSeparator(n)||(e.advance(),!this.tryConsumePickRangeOperand(e)))return e.reset(r),null;let a=e.peek();a&&L.PICK_RANGE_MODES.has((a.normalized??a.value).toLowerCase())&&e.advance();let u=e.tokens.slice(i,e.position()),[o,,s,l]=u,c=d=>d.kind==="keyword"?d.normalized??d.value:d.value,m=`${c(o)} to ${c(s)}`;return l&&(m+=` ${(l.normalized??l.value).toLowerCase()}`),{type:"expression",raw:m,value:m}}tryConsumePickRangeOperand(e){let r=e.peek();if(!r)return false;let i=(r.normalized??r.value).toLowerCase();if(this.isPickRangeSeparator(r))return false;let n=i==="start"||i==="end";return r.kind==="literal"||r.kind==="identifier"||r.kind==="keyword"&&n?(e.advance(),true):false}tryConsumeRunOperand(e){let r=e.peek();if(!r)return false;if(r.value==="("){let i=e.mark(),n=0;for(;!e.isAtEnd();){let a=e.advance();if(a.value==="(")n++;else if(a.value===")"&&(n--,n===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")&&!L.RUN_OPERATORS.has(r.value)&&r.value!==")"?(e.advance(),true):false}isPossessorToken(e){if(!this.currentProfile)return false;for(let r of [e.value,e.normalized].filter(Boolean))if(ce(this.currentProfile,r)??ce(this.currentProfile,r.toLowerCase()))return true;return false}isBareWordPropertyHead(e){return e.kind!=="identifier"||/^[$:@#.*]/.test(e.value)||this.isStructuralKeyword(e.value)||e.normalized&&this.isStructuralKeyword(e.normalized)||e.normalized&&this.isRoleMarkerConcept(e.normalized)?false:!this.isPossessorToken(e)}toEnglishProperty(e){return this.currentProfile?Pe(this.currentProfile.code,e):e}tryMatchOfPossessiveExpression(e){let r=e.peek();if(!r||r.kind!=="selector"&&!this.isBareWordPropertyHead(r))return null;let i=e.mark();e.advance();let n=e.peek();if(!n||!this.isOfPossessiveMarker(n))return e.reset(i),null;e.advance();let a=e.peek();return !a||a.kind!=="selector"?(e.reset(i),null):(e.advance(),Ee(ze(a.value),this.toEnglishProperty(r.value)))}tryMatchPossessiveExpression(e){let r=e.peek();if(!r||!this.currentProfile)return null;let i=[r.value,r.normalized].filter(Boolean),n;for(let s of i)if(n=ce(this.currentProfile,s)??ce(this.currentProfile,s.toLowerCase()),n)break;if(!n)return null;let a=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||Ya(this.currentProfile.code,o.value))return e.reset(a),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.normalized&&L.COMMAND_ACTION_KEYWORDS.has(o.normalized.toLowerCase()))||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)),s=this.toEnglishProperty(s);let l=s;for(;;){let m=e.peek();if(m?.kind==="selector"&&m.value.startsWith(".")&&/^\.[a-zA-Z_]\w*/.test(m.value)){l+=m.value,e.advance();continue}if(m?.value==="?"){let d=e.peek(1);if(d?.kind==="selector"&&d.value.startsWith(".")&&/^\.[a-zA-Z_]\w*/.test(d.value)){l+=`?${d.value}`,e.advance(),e.advance();continue}}break}let c=e.peek();if(c&&c.value.startsWith("(")){let m="",d=0,p=0;for(;!e.isAtEnd()&&p++<L.MAX_METHOD_ARGS+2;){let y=e.peek();if(!y)break;m+=y.value,e.advance();for(let E of y.value)E==="("?d++:E===")"&&d--;if(d<=0)break}l+=m;}return Ee(ue(n),l)}return e.reset(a),null}tryMatchPostNominalPossessiveExpression(e){if(!this.currentProfile||this.currentProfile.possessive?.markerPosition!=="after-object")return null;let r=e.peek();if(!r)return null;let i=r.kind==="selector"&&r.value.startsWith(".")&&/^\.[a-zA-Z_]\w*/.test(r.value);if(!(r.kind==="identifier"&&!this.isStructuralKeyword(r.value)&&!(r.normalized&&this.isStructuralKeyword(r.normalized))&&!(r.normalized&&this.isRoleMarkerConcept(r.normalized))||r.kind==="selector"&&(r.value.startsWith("*")||r.value.startsWith("@"))||i)||this.isPossessorToken(r))return null;let a=e.mark(),u=r.value;i&&(u=u.substring(1)),e.advance(),u=this.toEnglishProperty(u);let o=u;for(;e.peek()?.kind==="selector"&&e.peek().value.startsWith(".")&&/^\.[a-zA-Z_]\w*/.test(e.peek().value);)o+=e.peek().value,e.advance();let s=e.peek();if(!s)return e.reset(a),null;let l;for(let c of [s.value,s.normalized].filter(Boolean))if(l=ce(this.currentProfile,c)??ce(this.currentProfile,c.toLowerCase()),l)break;return l?(e.advance(),Ee(ue(l),o)):(e.reset(a),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&&ou.has(i))}tryMatchBraceRunLiteral(e){let r=e.peek();if(!r||r.kind!=="identifier"||r.value!=="{")return null;let i=e.mark();e.advance();let n=["{"],a=1,u=0;for(;!e.isAtEnd()&&u++<L.MAX_BRACE_RUN_TOKENS;){let o=e.advance();if(!o)break;if(o.value==="{")a++;else if(o.value==="}"&&(a--,a===0))return n.push("}"),q(n.join(" "));n.push(o.value);}return e.reset(i),null}tryMatchBraceRunExpression(e){let r=e.peek();if(!r||r.kind!=="identifier"||r.value!=="{")return null;let i=e.mark(),n="",a=-1,u=0,o=0;for(;!e.isAtEnd()&&o++<L.MAX_BRACE_RUN_TOKENS;){let s=e.advance();if(!s)break;if(a>=0&&s.position.start>a&&(n+=" ".repeat(s.position.start-a)),n+=s.value,a=s.position.end,s.value==="{")u++;else if(s.value==="}"&&(u--,u===0))return {type:"expression",raw:n}}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 n=e.mark();e.advance();let a=e.advance(),u="",o=a.position?.end,s=false,l=0;for(;!e.isAtEnd()&&l++<L.MAX_METHOD_ARGS+2;){let c=e.peek();if(!c)break;if(c.value===")"){e.advance(),s=true;break}let m=o!==void 0&&c.position?.start===o;u+=(u===""||m?"":" ")+c.value,o=c.position?.end,e.advance();}return s?{type:"expression",raw:`${r.value}(${u})`}:(e.reset(n),null)}tryMatchMethodCallExpression(e){let r=e.peek();if(!r||r.kind!=="selector")return null;let i=e.mark();e.advance();let n=e.peek();if(!n||n.kind!=="operator"||n.value!==".")return e.reset(i),null;e.advance();let a=e.peek();if(!a||a.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<L.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}.${a.value}(${o.join(", ")})`}}tryMatchPropertyAccessExpression(e,r=true){let i=e.peek();if(!i||i.kind!=="identifier"&&i.kind!=="keyword")return null;let n=e.mark();e.advance();let a=i.value.toLowerCase(),u=e.peek();if((i.kind==="identifier"||L.PROPERTY_ACCESS_BASES.has(a))&&u&&u.kind==="selector"&&/^\.[a-zA-Z_]/.test(u.value)){let p=i.value,y=[],E=0;for(;E<L.MAX_PROPERTY_DEPTH;){let h=e.peek();if(h&&h.kind==="selector"&&/^\.[a-zA-Z_]/.test(h.value))p+=`.${h.value.slice(1)}`,y.push(h.value.slice(1)),e.advance(),E++;else break}let v=e.peek(),f=!!v&&v.value.startsWith("(");if(r&&!f&&y.length>0&&Re(a))return Ee(ue(a),y.join("."));if(f){let h=e.mark(),k=[],D=0,A=false;for(;!e.isAtEnd();){let z=e.peek();if(!z)break;if(z.value==="(")D++;else if(z.value===")"){if(k.push(z.value),e.advance(),D--,D===0&&(A=true),A)break;continue}k.push(z.value),e.advance();}A?p+=k.join(""):e.reset(h);}return {type:"expression",raw:p}}let o=e.peek();if(!o||o.kind!=="operator"||o.value!==".")return e.reset(n),null;e.advance();let s=e.peek();if(!s||s.kind!=="identifier")return e.reset(n),null;e.advance();let l=`${i.value}.${s.value}`,c=1;for(;!e.isAtEnd()&&c<L.MAX_PROPERTY_DEPTH;){let p=e.peek();if(!p||p.kind!=="operator"||p.value!==".")break;e.advance();let y=e.peek();if(!y||y.kind!=="identifier")break;e.advance(),l+=`.${y.value}`,c++;}let m=e.peek();if(m&&m.kind==="punctuation"&&m.value==="("){e.advance();let p=[],y=0;for(;!e.isAtEnd()&&p.length<L.MAX_METHOD_ARGS;){let v=e.peek();if(!v)break;if(v.kind==="punctuation"&&v.value===")"){if(y===0){e.advance();break}y--;}if(v.kind==="punctuation"&&v.value==="("&&y++,v.kind==="punctuation"&&v.value===","){e.advance();continue}p.push(v.value),e.advance();}return {type:"expression",raw:`${l}(${p.join(", ")})`}}let d=i.value.toLowerCase();if(r&&Re(d)){let p=l.split(".").slice(1).join(".");return Ee(ue(d),p)}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 n=e.peek(),a=this.currentProfile?.possessive?.marker?.replace(/^-/,""),u=!!n&&n.kind==="punctuation"&&n.value==="'s",o=!!n&&n.value==="'"&&(e.peek(1)?.value??"").toLowerCase()==="s",s=(()=>{if(!this.currentPatternCommand||(n?.normalized??"").toLowerCase()!=="source")return false;let d=we[this.currentPatternCommand];return !!d&&d.roles.some(p=>p.role==="source")})(),l=!!n&&!!a&&a!=="'s"&&n.value===a&&(n.kind==="particle"||n.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(),Ee(ze(r.value),this.toEnglishProperty(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 n=e.peek();if(!n||n.kind!=="selector"||!n.value.startsWith("."))return e.reset(i),null;let a=e.peek(1);a&&a.kind,e.advance();let u=n.value.slice(1);return Ee(ze(r.value),u)}matchGroupToken(e,r,i,n){let a=e.mark(),u=new Set(i.keys());if(!this.matchTokenSequence(e,r.tokens,i,n)){e.reset(a);for(let s of i.keys())u.has(s)||i.delete(s);return r.optional||false}return true}getMatchType(e,r){if(e.value===r)return "exact";if(e.normalized===r)return "normalized";if(e.stem===r&&e.stemConfidence!==void 0&&e.stemConfidence>=.7)return "stem";if(e.kind==="keyword"&&e.value.toLowerCase()===r.toLowerCase())return "case-insensitive";if(e.kind==="keyword"){let i=er(e.value).toLowerCase();if(i&&i===er(r).toLowerCase())return "case-insensitive"}return "none"}tokenToSemanticValue(e){switch(e.kind){case "selector":return ze(e.value);case "literal":return this.parseLiteralValue(e.value);case "keyword":let r=(e.normalized||e.value).toLowerCase();return Re(r)?ue(r):q(e.normalized||e.value);case "identifier":if(e.value.startsWith("@"))return ze(e.value);if(e.value.startsWith(":")||e.value.startsWith("$"))return ue(e.value);let i=e.value.toLowerCase();return Re(i)?ue(i):{type:"expression",raw:e.value};case "url":return q(e.value,"string");default:return null}}parseLiteralValue(e){if(e.startsWith('"')||e.startsWith("'")||e.startsWith("`")||e.startsWith("\u300C")){let n=e.slice(1,-1);return q(n,"string")}if(e==="true")return q(true,"boolean");if(e==="false")return q(false,"boolean");let r=e.match(/^(\d+(?:\.\d+)?)(ms|s|m|h)?$/);if(r){let n=parseFloat(r[1]);return r[2]?q(e,"duration"):q(n,"number")}let i=parseFloat(e);return isNaN(i)?q(e,"string"):q(i,"number")}applyExtractionRules(e,r){for(let[i,n]of Object.entries(e.extraction)){let a=r.get(i);if(a){if(n.transform){let u=a.type==="literal"?String(a.value):String(a.raw??"");r.set(i,n.transform(u));}}else n.value!==void 0?r.set(i,{type:"literal",value:n.value}):n.default&&r.set(i,n.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(L.ENGLISH_NOISE_WORDS.has(i)){let n=e.mark();e.advance();let a=e.peek();if(a&&(a.kind==="selector"||a.kind==="identifier"))return;let u=e.peek(1);if(a&&a.kind==="keyword"&&u&&u.kind==="selector"&&/^\.[a-zA-Z_]/.test(u.value))return;let o=a?(a.normalized??a.value).toLowerCase():"";if(a&&L.POSITIONAL_OR_SCOPE_KEYWORDS.has(o))return;let s=e.peek(1),l=s?(s.normalized??s.value).toLowerCase():"",c=this.currentProfile?.wordOrder!=="SOV"&&L.COMMAND_ACTION_KEYWORDS.has(l),m=!s||s.kind==="particle"||L.CLAUSE_BOUNDARY_KEYWORDS.has(l)||c;if(a&&a.kind==="keyword"&&this.currentProfile?.code!=="en"&&Re(o)&&m||a&&a.kind==="keyword"&&this.currentProfile?.code==="en"&&Re(o))return;e.reset(n);}i==="class"&&e.advance();}extractEventModifiers(e){let r={},i=false;for(;!e.isAtEnd();){let n=e.peek();if(!n||n.kind!=="event-modifier")break;let a=n.metadata;if(!a)break;switch(i=true,a.modifierName){case "once":r.once=true;break;case "debounce":typeof a.value=="number"&&(r.debounce=a.value);break;case "throttle":typeof a.value=="number"&&(r.throttle=a.value);break;case "queue":(a.value==="first"||a.value==="last"||a.value==="all"||a.value==="none")&&(r.queue=a.value);break}e.advance();}return i?r:void 0}};J.POSITIONAL_OR_SCOPE_KEYWORDS=new Set(["first","last","next","previous","random","closest","parent"]);J.STRUCTURAL_NEVER_EVENT=new Set(["if","unless","else","end","then"]);J.PROPERTY_ACCESS_BASES=new Set(["it","me","you","my","its","your","event","result","target","detail","body","window","document","self","this"]);J.COMMAND_ACTION_KEYWORDS=Et;J.CLAUSE_BOUNDARY_KEYWORDS=new Set(["then","and","or","end","else"]);J.RUN_OPERATORS=new Set(["+","-","*","/"]);J.PICK_RANGE_SEPARATORS=new Set(["to"]);J.PICK_RANGE_SEPARATORS_BY_LANG={ar:new Set(["\u0625\u0644\u0649"]),bn:new Set(["\u09A5\u09C7\u0995\u09C7"]),de:new Set(["zu","bis"]),es:new Set(["a"]),fr:new Set(["\xE0"]),he:new Set(["\u05E2\u05DC","\u05E2\u05D3"]),hi:new Set(["\u0938\u0947"]),id:new Set(["ke"]),it:new Set(["in","a"]),ja:new Set(["\u304B\u3089"]),ko:new Set(["\uBD80\uD130"]),ms:new Set(["ke"]),pl:new Set(["do"]),pt:new Set(["para","a"]),qu:new Set(["kama"]),ru:new Set(["\u0432","\u0434\u043E"]),sw:new Set(["kwa","hadi"]),th:new Set(["\u0E43\u0E19","\u0E16\u0E36\u0E07"]),tl:new Set(["sa"]),tr:new Set(["ile"]),uk:new Set(["\u0432","\u0434\u043E"]),vi:new Set(["v\xE0o","\u0111\u1EBFn"]),zh:new Set(["\u5230"])};J.PICK_RANGE_MODES=new Set(["inclusive","exclusive"]);J.MAX_BRACE_RUN_TOKENS=64;J.MAX_PROPERTY_DEPTH=10;J.MAX_METHOD_ARGS=20;J.DECLARATION_COMMANDS=new Set(["behavior","def","install"]);J.ENGLISH_NOISE_WORDS=new Set(["the","a","an"]);var su=J,ae=new su;function U(t,e){return ji(t,e)}function Dt(){return Ii()}var Ge=["if","unless","repeat","for","while"],ur=/^[A-Z][A-Za-z0-9_]*$/;function Y(t,e){let r=new Set([e]),n=N(t)?.keywords?.[e];if(n){n.primary&&r.add(n.primary.toLowerCase());for(let a of n.alternatives??[])r.add(a.toLowerCase());}return r}function $(t,e){return e.has(t.value.toLowerCase())?true:t.normalized?e.has(t.normalized.toLowerCase()):false}var lu=new Set(Ge);function or(t,e){let r=t.normalized?.toLowerCase();return r?lu.has(r):e.some(i=>$(t,i))}var Hr=new Set(["me","it","you","the","body","window","document","its","event","result","target","self","this","them","parent","next","previous","closest","first","last"]),cu=new Set(["destination","source","style","patient","on","from","to"]);function St(t){if(!t||t.kind==="selector")return false;let e=(t.normalized??t.value).toLowerCase(),r=t.value.toLowerCase();return !(Hr.has(e)||Hr.has(r)||cu.has(e))}var Gr=new Set(["ja","ko"]);function Ue(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 xt(t,e){let r=[],i=e.position.end,n=t.slice(e.position.end).match(/^\s*\(([^)]*)\)/);if(n){i=e.position.end+n[0].length;for(let a of n[1].split(/[,،、]/)){let u=a.trim();u&&r.push(u);}}return {parameters:r,headerEnd:i}}function sr(t,e,r){let i=e+1;if(i>=t.length)return -1;let n=Ue(N(r)?.roleMarkers?.patient);return n.size>0&&$(t[i],n)&&i++,i<t.length?i:-1}var Bt=/^[a-zA-Z_$][\w$]*(?:\.[a-zA-Z_$][\w$]*)*$/;function mu(t){let e=1;if(t[1]?.value==="("){let r=0,i=1;for(;i<t.length;i++)if(t[i].value==="(")r++;else if(t[i].value===")"&&--r===0)break;if(i>=t.length)return -1;e=i+1;}return e+1}function du(t,e,r){let i=N(r);if(i?.wordOrder!=="SOV"||!Bt.test(t[0].value)||e!==mu(t))return false;let n=Ue(i.roleMarkers?.patient);return n.size===0?false:$(t[e-1],n)}function pu(t,e,r){if(!N(e))return null;let i=Y(e,"behavior"),n=Y(e,"def"),a=t.toLowerCase(),u=[...i].some(m=>a.includes(m)),o=/\bdef\b/.test(a)||[...n].some(m=>m!=="def"&&a.includes(m));if(!u&&!o)return null;let s=U(t,e).tokens;if(s.length<2)return null;if($(s[0],i))return Yr(t,e,s,r,0);let l=s.findIndex((m,d)=>d>0&&$(m,i));if(l>0&&ur.test(s[0].value))return Yr(t,e,s,r,l);if($(s[0],n))return Zr(t,e,s,r,0);let c=s.findIndex((m,d)=>d>0&&$(m,n));return c>0&&du(s,c,e)?Zr(t,e,s,r,c):null}function fu(t,e,r){let i=N(e);if(!i)return null;let n=i.wordOrder!=="SOV",a=Gr.has(e)?Ue(i.roleMarkers?.event):new Set,u=Gr.has(e)?Ue(i.keywords?.on):new Set,o=a.size>0&&u.size>0,s=Y(e,"end"),l=Y(e,"on"),c=t.toLowerCase(),m=[...s].some(z=>c.includes(z)),d=(n||o)&&(()=>{let z=0;for(let g of l)if(g){for(let b=c.indexOf(g);b>=0;b=c.indexOf(g,b+g.length))if(++z>=2)return true}return false})();if(!m&&!d)return null;let p=U(t,e).tokens;if(p.length<2)return null;let y=Ge.map(z=>Y(e,z)),E=z=>or(z,y),v=z=>$(z,s),f=[],h=0,k=0;for(let z=0;z<p.length;z++){let g=p[z];if(v(g)){if(h>0){h--;continue}let b=t.slice(p[k].position.start,g.position.start).trim();b&&f.push(b),k=z+1;}else if(E(g))h++;else if(n&&h===0&&z>k&&$(g,l)&&St(p[z+1])){let b=t.slice(p[k].position.start,g.position.start).trim();b&&f.push(b),k=z;}else if(o&&h===0&&z-1>k&&$(g,a)&&p[z+1]!==void 0&&$(p[z+1],u)){let b=p[z-1],w=t.slice(p[k].position.start,b.position.start).trim();w&&f.push(w),k=z-1;}}if(k<p.length){let z=t.slice(p[k].position.start).trim();z&&f.push(z);}if(f.length<2)return null;let D=[],A=[];for(let z of f){let g;try{g=r.statement(z,e);}catch{return null}if(!g||g.kind!=="event-handler")return null;let b=g;D.push(b);let w=!b.body||b.body.length===0;A.push(w?.2:b.metadata?.confidence??.75);}return zr(D,"then",{sourceLanguage:e,confidence:He(A),sourceText:t})}function He(t){return t.length>0?t.reduce((e,r)=>e+r,0)/t.length:0}function Dr(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 Yr(t,e,r,i,n){let a=n>0,u=a?0:sr(r,n,e);if(u<0)return null;let o=r[u],s=o.value;if(!ur.test(s))return null;let{parameters:l,headerEnd:c}=xt(t,o),m=a?n+1:r.findIndex(b=>b.position.start>=c);m<=u&&(m=u+1);let d=Y(e,"init"),p=Y(e,"end"),y=Ge.map(b=>Y(e,b)),E=b=>or(b,y),v=b=>$(b,p),f=[],h=[],k=[],D=false,A=0,z=m;for(let b=m;b<r.length;b++){let w=r[b];if(v(w)){if(A>0){A--;continue}if(b===z){D=true;break}if($(r[z],d)){let C=t.slice(r[z].position.end,w.position.start).trim();if(C)try{let S=Dr(i.body(C,e));h.push(...S),k.push(He(S.map(x=>x.metadata?.confidence??.75)));}catch{k.push(0);}}else {let C=t.slice(r[z].position.start,w.position.start).trim();try{let S=i.statement(C,e);if(S&&S.kind==="event-handler"){let x=S;f.push(x);let O=!x.body||x.body.length===0;k.push(O?.2:x.metadata?.confidence??.75);}else k.push(0);}catch{k.push(0);}}z=b+1;}else E(w)&&A++;}if(f.length===0&&h.length===0)return null;let g=(D?1:.8)*He(k);return dn(s,l,f,h.length>0?h:void 0,{sourceLanguage:e,confidence:g,sourceText:t})}function Zr(t,e,r,i,n){let a=n>0,u=a?0:sr(r,n,e);if(u<0)return null;let o=r[u],s=o.value;if(!Bt.test(s))return null;let{parameters:l,headerEnd:c}=xt(t,o),m=a?n+1:r.findIndex(g=>g.position.start>=c);m<=u&&(m=u+1);let d=Y(e,"end"),p=Ge.map(g=>Y(e,g)),y=g=>or(g,p),E=g=>$(g,d),v=0,f=-1;for(let g=m;g<r.length;g++)if(E(r[g])){if(v===0){f=g;break}v--;}else y(r[g])&&v++;let h=r[m]?.position.start??c,k=f>=0?r[f].position.start:t.length,D=t.slice(h,k).trim();if(!D)return null;let A;try{A=Dr(i.body(D,e));}catch{return null}if(A.length===0)return null;let z=He(A.map(g=>g.metadata?.confidence??.75));return f<0&&(z*=.8),pn(s,l,A,{sourceLanguage:e,confidence:z,sourceText:t})}var wr=["live","eventsource","socket","worker","intercept"],yu=new Set(["intercept"]),Sr=new Set(["eventsource","socket","worker"]),hu=new Set(["eventsource","socket"]),vu=new Set(["worker"]),Eu=6,gu=2;function zu(t,e){for(let i of wr)if($(t[0],Y(e,i)))return {action:i,keywordIdx:0};if(N(e)?.wordOrder!=="SOV")return null;let r=Math.min(t.length,Eu);for(let i=1;i<r;i++)for(let n of wr)if(n!=="live"&&$(t[i],Y(e,n))&&!(Sr.has(n)&&!ur.test(t[0].value))&&!(n==="intercept"&&i>gu))return {action:n,keywordIdx:i};return null}function ku(t,e,r){let i=Ue(N(r)?.roleMarkers?.source);return i.size===0||e+1>=t.length?0:$(t[e],i)||$(t[e+1],i)?2:0}function wu(t,e,r,i,n){if(t==="live")return r+1;if(r>0){let s=r+1;return t==="eventsource"&&(s+=ku(e,s,i)),s}let a=sr(e,r,i);if(a<0)return -1;if(t==="worker")return a+1;let u=Y(i,"on"),o=n>=0?n:e.length;for(let s=a+1;s<o;s++)if($(e[s],u)&&St(e[s+1]))return s;return o}function Cu(t,e,r,i){if(!Sr.has(t))return;let n=r>0?0:sr(e,r,i);if(!(n<0))return e[n].value}function bu(t,e,r){if(!N(e))return null;let i=t.toLowerCase(),n=false;for(let o of wr){for(let s of Y(e,o))if(s&&i.includes(s)){n=true;break}if(n)break}if(!n)return null;let a=U(t,e).tokens;if(a.length<2)return null;let u=zu(a,e);return u?Au(t,e,a,r,u.action,u.keywordIdx):null}function Au(t,e,r,i,n,a){let u=Y(e,"end"),o=Ge.map(D=>Y(e,D)),s=D=>or(D,o),l=D=>$(D,u),c=Cu(n,r,a,e);if(Sr.has(n)&&(!c||!ur.test(c)))return null;let m=D=>({sourceLanguage:e,confidence:D,sourceText:t}),d=Xr(r,a+1,l,s);if(yu.has(n))return d>=0&&d!==r.length-1?null:jr(n,[],c,m(d>=0?1:.8));let p=wu(n,r,a,e,d);if(p<0||p>r.length)return null;let y=[],E=[],v=false,f=vu.has(n);if(f||hu.has(n)){let D=f?"def":"event-handler",A=0,z=p;for(let g=p;g<r.length;g++){let b=r[g];if(l(b)){if(A>0){A--;continue}if(v=true,g===z)break;let w=f?b.position.end:b.position.start,C=t.slice(r[z].position.start,w).trim();try{let S=i.statement(C,e);if(S&&S.kind===D){let x=S;y.push(x);let O=!x.body||x.body.length===0;E.push(O?.2:x.metadata?.confidence??.75);}else E.push(0);}catch{E.push(0);}z=g+1;}else s(b)&&A++;}}else {let D=Xr(r,p,l,s);v=D>=0;let A=D>=0?r[D].position.start:t.length,z=t.slice(r[p].position.start,A).trim();if(!z)return null;try{y.push(...Dr(i.body(z,e)));}catch{return null}if(y.length===0)return null;E.push(...y.map(g=>g.metadata?.confidence??.75));}if(y.length===0&&!v)return null;let h=v?1:.8,k=E.length>0?h*He(E):h;return jr(n,y,c,m(k))}function Xr(t,e,r,i){let n=0;for(let a=e;a<t.length;a++)if(r(t[a])){if(n===0)return a;n--;}else i(t[a])&&n++;return -1}var ye={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",\uB9C8\uC6B0\uC2A4\uC5D4\uD130:"mouseenter",\uB9C8\uC6B0\uC2A4\uB9AC\uBE0C:"mouseleave",\uB9C8\uC6B0\uC2A4\uBB34\uBE0C:"mousemove",\uD0A4\uD504\uB808\uC2A4:"keypress",\uD130\uCE58\uC885\uB8CC:"touchend",\uD130\uCE58\uCDE8\uC18C:"touchcancel"},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",\u307C\u304B\u3057:"blur"},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",\u062A\u0631\u0643\u064A\u0632:"focus","\u0645\u0641\u062A\u0627\u062D \u0623\u0633\u0641\u0644":"keydown","\u0645\u0641\u062A\u0627\u062D \u0623\u0639\u0644\u0649":"keyup","\u0641\u0623\u0631\u0629 \u0641\u0648\u0642":"mouseover","\u062A\u063A\u064A\u064A\u0631 \u062D\u062C\u0645":"resize"},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",cambiar:"change",enfocar:"focus",desenfocar:"blur",cargar:"load",desplazar:"scroll",dobleclic:"dblclick",rat\u00F3nentrar:"mouseenter",rat\u00F3nsalir:"mouseleave",rat\u00F3nmover:"mousemove",teclapresar:"keypress",descargar:"unload",toqueempezar:"touchstart",toqueterminar:"touchend",toquemover:"touchmove",toquecancelar:"touchcancel"},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",bulan\u0131k:"blur",farebas:"mousedown",fareb\u0131rak:"mouseup",kayd\u0131r:"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",duploClique:"dblclick",mouseEntrar:"mouseenter",mouseSair:"mouseleave",mouseMover:"mousemove",teclaPressionar:"keypress",descarregar:"unload",toqueIn\u00EDcio:"touchstart",toqueFim:"touchend",toqueMover:"touchmove",toqueCancelar:"touchcancel"},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",\u6309\u952E\u6309\u4E0B:"keydown",\u9F20\u6807\u79FB\u52A8:"mousemove",\u5378\u8F7D:"unload",\u8C03\u6574\u5927\u5C0F:"resize",\u89E6\u6478\u5F00\u59CB:"touchstart",\u89E6\u6478\u79FB\u52A8:"touchmove"},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",flou:"blur",doubleclic:"dblclick",sourisentrer:"mouseenter",sourissortir:"mouseleave",sourisbouger:"mousemove",touchepress\u00E9e:"keypress",d\u00E9charger:"unload",touchercommencer:"touchstart",toucherfin:"touchend",toucherbouger:"touchmove",toucherannuler:"touchcancel"},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","taste unten":"keydown","taste oben":"keyup","maus dr\xFCber":"mouseover","maus weg":"mouseout",doppelklick:"dblclick",mauseintreten:"mouseenter",mausverlassen:"mouseleave",mausbewegen:"mousemove",tastedr\u00FCcken:"keypress",entladen:"unload",ber\u00FChrungstart:"touchstart",ber\u00FChrungend:"touchend",ber\u00FChrungbewegen:"touchmove",ber\u00FChrungabbrechen:"touchcancel"},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",tekan_tombol:"keydown",keyup:"keyup",arahkan:"mouseover",tinggalkan:"mouseout",bongkar:"unload"},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",kambiay:"change",apachiy:"submit",kachay:"submit",apaykachay:"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",bonyeza:"click",ingizo:"input",kitufe_shuka:"keydown",kitufe_juu:"keyup",panya_nje:"mouseout",wasilisha:"submit","sogeza juu":"mouseover",shuka:"unload"},vi:{"\u0111\u1ED5i k\xEDch th\u01B0\u1EDBc":"resize"}};Object.fromEntries(Object.entries(ye).map(([t,e])=>{let r={};for(let[i,n]of Object.entries(e))n in r||(r[n]=i);return [t,r]}));var Bu={debounced:"debounce",debounce:"debounce",throttled:"throttle",throttle:"throttle"},Fu=[["\u043E\u0434\u0438\u043D","_","\u0440\u0430\u0437"],["\u043E\u0434\u0438\u043D_\u0440\u0430\u0437"],["\u043E\u0434\u043D\u0430\u0436\u0434\u044B"],["m\u1ED9t","l\u1EA7n"],["once"]],Tu=/^(\d+)(ms|s|m)?$/,Ru=new Set(["selector","literal","url","event-modifier"]);function Ou(t){let e=t.match(Tu);if(!e)return null;let r=parseInt(e[1],10),i=e[2]||"ms";return i==="s"?r*=1e3:i==="m"&&(r*=6e4),r}function Pu(t){for(let e=1;e<t.length;e++){let r=t[e];if(Ru.has(r.kind))continue;let i=r.value.toLowerCase(),n=Bu[i];if(n){let a=0;for(let u=e+1;u<t.length;u++){let o=t[u],s=Ou(o.value);if(s!==null)return {modifiers:{[n]:s},start:r.position.start,end:o.position.end};if(o.kind==="selector"||o.kind==="literal"||o.kind==="url"||++a>2)break}continue}for(let a of Fu){if(a[0]!==i||e+a.length>t.length)continue;let u=true;for(let o=1;o<a.length;o++)if(t[e+o].value.toLowerCase()!==a[o]){u=false;break}if(u)return {modifiers:{once:true},start:r.position.start,end:t[e+a.length-1].position.end}}}return null}var ge=new Set(["if","unless","while","repeat","for"]),hr=new Set(["then","end","else","if","unless","while","for","repeat","and"]),_u=new Set(["first","last","next","previous","random","closest"]),Oe=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"]),et=class extends Error{constructor(t,e,r,i){super(t),this.name="SemanticParseError",this.language=e,this.input=r,this.diagnostics=i;}};function I(t,e,r){return {message:t,severity:e,source:"semantic-parser",...r&&{code:r}}}function j(t,e){return e.length===0?t:{...t,diagnostics:e}}var nr=120;function Mu(t,e,r){let i=e.tokens.length;if(t.consumedTokens>=i)return null;let n=e.tokens[t.consumedTokens],a=e.tokens[i-1];if(!n||!a)return null;let u=r.slice(n.position.start,a.position.end);if(!u.trim())return null;let o=u.length>nr?`${u.slice(0,nr)}\u2026`:u,s=i-t.consumedTokens;return `pattern ${t.pattern.id} left ${s} token(s) unconsumed: "${o}"`}var Lu=new Set(["to","from","into","onto","with","as","at","of","in","on","by","and","or","then","end","else","the","a","an","async"]);function vr(t){let e=[],r=new Set((t.diagnostics??[]).map(n=>`${n.code}|${n.message}`)),i=n=>{if(!n||typeof n!="object")return;if(n!==t)for(let u of n.diagnostics??[]){if(u.code!=="unconsumed-input")continue;let o=`${u.code}|${u.message}`;r.has(o)||(r.add(o),e.push(u));}let a=n;for(let u of Ft){let o=a[u];if(Array.isArray(o))for(let s of o)i(s);}};return i(t),e.length===0?t:j(t,[...t.diagnostics??[],...e])}function rt(t){if(t.length>=2){let e=t[0];if((e==='"'||e==="'")&&t.endsWith(e))return t.slice(1,-1)}return t}var Ft=["body","statements","thenBranch","elseBranch","eventHandlers","initBlock"];function Tt(t,e){if(!t||typeof t!="object")return t;if(t.action&&t.roles instanceof Map){let i=ee(t.action),n=i?.primaryRole;if(i&&n&&n!=="patient"&&!i.roles.some(a=>a.role==="patient")&&t.roles.has("patient")&&!t.roles.has(n)){let a=t.roles,u=a.get("patient");u!==void 0&&(a.delete("patient"),a.set(n,u));}if(t.action==="tell"){let a=t.roles,u=a.get("patient"),o=a.get("destination");u&&(u.type==="selector"||u.type==="reference")&&(!o||o.type==="literal")&&(a.delete("patient"),a.set("destination",u));}if(t.action==="fetch"){let a=t.roles,u=a.get("patient"),o=a.get("source");u&&o&&(u.type==="literal"||u.type==="expression")&&o.type==="expression"&&!a.has("style")&&(a.delete("patient"),a.set("style",o),a.set("source",u));}if(t.action==="transition"){let a=t.roles,u=a.get("destination");u&&u.type==="literal"&&!a.has("goal")&&(a.delete("destination"),a.set("goal",u));let o=a.get("patient");o&&o.type==="literal"&&typeof o.value=="string"&&/^[A-Za-z_][A-Za-z0-9_-]*$/.test(o.value)&&a.set("patient",{type:"expression",raw:o.value});}if(t.action==="morph"){let a=t.roles,u=a.get("patient");u&&u.type==="literal"&&typeof u.value=="string"&&/<[a-zA-Z][^>]*\/?>/.test(u.value)&&a.set("patient",{type:"expression",raw:u.value});}if(t.action==="wait"){let a=t.roles;if(!a.has("event")){let u=a.get("duration"),o=u?.type==="expression"?u.raw:u?.type==="literal"?u.value:void 0;typeof o=="string"&&Oe.has(o.toLowerCase())&&(a.delete("duration"),a.set("event",{type:"literal",value:o,dataType:"string"}));}}if(t.kind==="command"&&t.action!=="on"){let a=t.roles,u=a.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)&&a.set("event",{type:"literal",value:o,dataType:"string"});}}if(e?.size){let a=t.roles;for(let u of ["destination","source"]){let o=a.get(u);o&&o.type==="literal"&&typeof o.value=="string"&&e.has(o.value)&&a.set(u,{type:"expression",raw:o.value});}}}let r=t;for(let i of Ft){let n=r[i];if(Array.isArray(n))for(let a of n)Tt(a,e);}return t}var Z=class F{constructor(){this.parseDepth=0,this.coverageFrames=[],this.boundIdentifiers=new Set;}parse(e,r){this.parseDepth===0&&this.boundIdentifiers.clear(),this.parseDepth++,this.coverageFrames.push([]);try{let i=Tt(this.parseInternal(e,r),this.boundIdentifiers),n=this.coverageFrames[this.coverageFrames.length-1];if(n.length>0&&(i=j(i,[...i.diagnostics??[],...n])),this.parseDepth===1&&(i=vr(i),i.kind==="event-handler")){let a={node:i,input:e},u=a.node.eventModifiers;if(u&&(u.once||u.debounce!==void 0||u.throttle!==void 0))for(let s=0;s<4;s++){let l=this.reclaimDanglingFromTail(a.node,a.input,r)??this.reclaimEventCompoundTail(a.node,a.input,r)??this.reclaimResponseTypeTail(a.node,a.input,r)??this.reclaimCapturedDestinationTail(a.node,a.input,r);if(!l)break;a=l;}let o=this.reclaimEventCompoundTail(a.node,a.input,r);o&&(a=o),i=a.node;}return i}finally{this.coverageFrames.pop(),this.parseDepth--;}}coverageMark(){let e=this.coverageFrames[this.coverageFrames.length-1];return e?e.length:0}coverageRollback(e){let r=this.coverageFrames[this.coverageFrames.length-1];r&&r.length>e&&(r.length=e);}static getCoverageMarkerSurfaces(e){let r=F.coverageMarkerSurfaces.get(e);if(!r){r=new Set;let i=N(e)?.roleMarkers;if(i){for(let n of Object.values(i))if(n){if(n.primary)for(let a of n.primary.toLowerCase().split(/\s+/))r.add(a);for(let a of n.alternatives??[])for(let u of a.toLowerCase().split(/\s+/))r.add(u);}}for(let n of F.LEAKED_RENDER_MARKERS[e]??[])r.add(n.toLowerCase());F.coverageMarkerSurfaces.set(e,r);}return r}isCoverageResidueToken(e,r){if(e.kind==="particle"||e.kind==="conjunction"||e.metadata?.closesTrackedBlock||this.isThenKeyword(e.value,r)||this.isEndKeyword(e.value,r)||this.isElseKeyword(e.value,r))return true;let i=(e.normalized??e.value).toLowerCase();return Lu.has(i)?true:F.getCoverageMarkerSurfaces(r).has(e.value.toLowerCase())}recordDroppedTokens(e,r,i){if(e.length===0)return;let n=this.coverageFrames[this.coverageFrames.length-1];if(!n||!e.some(o=>!this.isCoverageResidueToken(o,r)))return;let a=e.map(o=>o.value).join(" ").trim();if(!a)return;let u=a.length>nr?`${a.slice(0,nr)}\u2026`:a;n.push(I(`${i} left ${e.length} token(s) unconsumed: "${u}"`,"warning","unconsumed-input"));}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=pu(e,r,{statement:(w,C)=>this.parse(w,C),body:(w,C)=>this.parseStatements(w,C)});if(i)return i;let n=bu(e,r,{statement:(w,C)=>this.parse(w,C),body:(w,C)=>this.parseStatements(w,C)});if(n)return n;let a=fu(e,r,{statement:(w,C)=>this.parse(w,C),body:(w,C)=>this.parseStatements(w,C)});if(a)return a;let{modifiers:u,remainingInput:o}=this.extractStandaloneModifiers(e,r),s=o||e,c=this.stripAsyncModifier(s,r).remainingInput??s,d=this.stripDoNotThrowModifier(c,r).remainingInput??c,p=[],y=U(d,r),E=me(r);if(E.length===0)throw new et(`No patterns available for language: ${r}`,r,d,[I(`No patterns registered for language '${r}'`,"error","no-patterns")]);let v=[...E].sort((w,C)=>C.priority-w.priority);{let w=y.tokens;if(N(r)?.wordOrder==="VSO"&&w.length>=4&&w[0]?.normalized==="source"){let C=w.findIndex(S=>S.normalized==="on");if(C>=2&&C+1<w.length){let S=d.slice(w[0].position.start,w[C].position.start).trim(),x=w[C+1].position.end,O=d.slice(w[C].position.start,x)+" "+S+d.slice(x);if(O!==d)try{let R=this.parse(O,r);if(R&&R.kind==="event-handler"){let P=u?this.applyModifiers(R,u):R;return j(P,p)}}catch{}}}}{let w=y.tokens,C=w[0]?.normalized==="if";for(let S=0;C&&S+3<w.length;S++){let x=(w[S+3]?.normalized??w[S+3]?.value??"").toLowerCase();if(w[S]?.normalized==="source"&&w[S+2]?.normalized==="on"&&F.KNOWN_EVENTS.has(x)){let O=(d.slice(0,w[S].position.start).trimEnd()+" "+d.slice(w[S+1].position.end).trimStart()).trim();if(O&&O!==d)try{let R=this.parse(O,r);if(R&&R.kind==="event-handler"){let P=u?this.applyModifiers(R,u):R;return j(P,p)}}catch{}break}}}{let w=y.tokens;for(let C=1;C<w.length-1;C++){let S=w[C],x=S.value,O=(S.normalized??S.value).toLowerCase();if(!(O==="or"||F.OR_KEYWORDS.has(x)||F.OR_KEYWORDS.has(O)))continue;let P=w[C+1],_=(P.normalized??P.value).toLowerCase();if(!F.KNOWN_EVENTS.has(_))break;let M=C+1,H=w[C+2];H&&H.kind==="selector"&&H.value.startsWith("[")&&(M=C+2);let G=w[C].position.start,fe=w[M].position.end,oe=(d.slice(0,G).trimEnd()+" "+d.slice(fe).trimStart()).trim();if(oe&&oe!==d)try{let he=this.parse(oe,r);if(he&&he.kind==="event-handler"){he.additionalEvents=[{type:"literal",value:_}];let mr=u?this.applyModifiers(he,u):he;return j(mr,p)}}catch{}break}}{let w=Pu(y.tokens);if(w){let C=(d.slice(0,w.start).trimEnd()+" "+d.slice(w.end).trimStart()).trim();if(C&&C!==d)try{let S=this.parse(C,r);if(S&&S.kind==="event-handler"){let x=this.applyModifiers(S,{...u??{},...w.modifiers});return j(x,p)}}catch{}}}let f=v.filter(w=>w.command==="on"),h=y.mark(),k=ae.matchBest(y,f);if(k){p.push(I(`event pattern matched: ${k.pattern.id} (confidence: ${k.confidence.toFixed(2)})`,"info","pattern-match"));let w=false;if(/^event-[a-z]+-bare$/.test(k.pattern.id)){let C=k.captured.get("event"),S=(C?.raw??C?.value??"").toString().toLowerCase(),x=ye[r],O=F.KNOWN_EVENTS.has(S)||!!x&&Object.keys(x).some(R=>R.toLowerCase()===S);if(S&&!O){let R=this.trySOVEventExtraction(d,r,v);if(R){p.push(I(`bare-event mis-anchor on "${S}" rejected; SOV extraction preferred`,"info","stage-bare-event-guard"));let P=u?this.applyModifiers(R,u):R;return j(P,p)}if(C?.type==="reference"||C?.type==="expression"){y.reset(h);let P=v.filter(M=>M.command!=="on"),_=ae.matchBest(y,P);y.reset(h),_&&_.pattern.command!=="on"?(w=true,p.push(I(`bare-event mis-anchor on reference "${S}" rejected; command ${_.pattern.command} preferred`,"info","stage-bare-event-guard"))):ae.matchBest(y,f);}}}if(!w){let C=this.buildEventHandler(k,y,r),S=u?this.applyModifiers(C,u):C;return j(S,p)}}p.push(I(`event patterns: ${f.length} tried, no match`,"info","stage-event"));let D=this.tryTrailingEventExtraction(d,r,v);if(D){p.push(I("trailing event extraction succeeded","info","stage-trailing-event"));let w=u?this.applyModifiers(D,u):D;return j(w,p)}let A=v.filter(w=>w.command!=="on"),z=ae.matchBest(y,A);if(z){if(ge.has(z.pattern.command)){let C=this.trySOVEventExtraction(d,r,v);if(C){p.push(I(`SOV event extraction preferred over bare ${z.pattern.command} command`,"info","stage-sov-loop"));let x=u?this.applyModifiers(C,u):C;return j(x,p)}let S=this.tryMidStreamEventExtraction(d,r,v);if(S){p.push(I(`mid-stream event extraction preferred over bare ${z.pattern.command} command`,"info","stage-midstream-loop"));let x=u?this.applyModifiers(S,u):S;return j(x,p)}}else if(F.KNOWN_EVENTS.has(z.pattern.command)&&this.hasSOVEventMarkerHead(d,r)){let C=this.trySOVEventExtraction(d,r,v);if(C){p.push(I(`SOV event extraction preferred over command-homonym event ${z.pattern.command}`,"info","stage-sov-homonym"));let S=u?this.applyModifiers(C,u):C;return j(S,p)}}else if(N(r)?.wordOrder==="VSO"){let C=this.tryMidStreamEventExtraction(d,r,v);if(C){p.push(I(`mid-stream event extraction preferred over bare ${z.pattern.command} command`,"info","stage-midstream-cmd"));let S=u?this.applyModifiers(C,u):C;return j(S,p)}}if(z.consumedTokens<y.tokens.length&&N(r)?.wordOrder==="SOV"){let C=this.trySOVEventExtraction(d,r,v);if(C){p.push(I(`SOV event extraction preferred over partial ${z.pattern.command} command (trailing remainder)`,"info","stage-sov-trailing"));let S=u?this.applyModifiers(C,u):C;return j(S,p)}}if(z.consumedTokens<y.tokens.length&&!ge.has(z.pattern.command)){let C=this.tryTopLevelCommandSequence(y,A,r);if(C)return p.push(I(`top-level command sequence: ${C.statements.length} commands`,"info","stage-top-level-sequence")),j(C,p)}p.push(I(`command pattern matched: ${z.pattern.id} (confidence: ${z.confidence.toFixed(2)})`,"info","pattern-match"));let w=Mu(z,y,d);return w&&p.push(I(w,"warning","unconsumed-input")),j(this.buildCommand(z,r),p)}if(p.push(I(`command patterns: ${A.length} tried, no match`,"info","stage-command")),!d.includes(`
|
|
4
|
-
`)&&N(r)?.wordOrder==="VSO"){let w=this.tryMidStreamEventExtraction(d,r,v);if(w){p.push(I("mid-stream event extraction succeeded with no leading command match","info","stage-midstream-nocmd"));let C=u?this.applyModifiers(w,u):w;return j(C,p)}}let g=this.trySOVEventExtraction(d,r,v);if(g){p.push(I("SOV event extraction succeeded","info","stage-sov"));let w=u?this.applyModifiers(g,u):g;return j(w,p)}p.push(I("SOV event extraction: no event keyword found","info","stage-sov"));let b=this.tryCompoundCommandParsing(y,A,r);if(b)return p.push(I("compound command parsing succeeded","info","stage-compound")),j(b,p);throw p.push(I("compound parsing: no then-keywords or no command matches","info","stage-compound")),p.push(I(`all parse stages exhausted for "${d}"`,"error","parse-failed")),new et(`Could not parse input in ${r}: ${d}`,r,d,p)}parseStatements(e,r){let i=U(e,r),n=me(r).filter(a=>a.command!=="on").sort((a,u)=>u.priority-a.priority);this.coverageFrames.push([]);try{let a=this.parseBodyWithClauses(i,n,r),u=this.coverageFrames[this.coverageFrames.length-1];if(u.length>0&&a.length>0){let o=a[a.length-1];a[a.length-1]=j(o,[...o.diagnostics??[],...u]);}return a}finally{this.coverageFrames.pop();}}canParse(e,r){try{return this.parse(e,r),!0}catch{return false}}supportedLanguages(){return Dt()}buildCommand(e,r){if(!e)throw new Error("No match to build command from");let i={};for(let[a,u]of e.captured)i[a]=u;let n=ne(e.pattern.command,i,{sourceLanguage:r,patternId:e.pattern.id,confidence:e.confidence});return this.registerBoundIdentifiers(n),n}buildEventHandler(e,r,i){if(!e)throw new Error("No match to build event handler from");let n=e.captured.get("event");if(!n)throw new Error("Event handler pattern matched but no event captured");{let m=n.type==="expression"?n.raw:n.type==="literal"?n.value:void 0;if(typeof m=="string"&&/^[^\s()[\]{}:]+$/.test(m)){let d=ye[i]?.[m];d?n={type:"literal",value:d,dataType:"string"}:n.type==="expression"&&F.KNOWN_EVENTS.has(m.toLowerCase())&&(n={type:"literal",value:m.toLowerCase(),dataType:"string"});}}let a=ae.extractEventModifiers(r),u=e.captured.get("source");u&&e.pattern.id.includes("source")&&!(u.type==="reference"&&u.value==="me")&&(a={...a??{},from:u});let o=this.extractOrConjunctionEvents(r,i),s=n;o.length>0&&n.type==="literal"&&(s={type:"literal",value:[String(n.value),...o.map(d=>String("value"in d?d.value:""))].join(" or ")});let l,c=e.captured.get("action");if(c&&c.type==="literal"&&c.value==="if"){let m=r.tokens,d=-1;for(let p=r.position()-1;p>=0;p--){let y=m[p],E=(y.normalized??y.value).toLowerCase();if(this.isIfKeyword(E,i)){d=p;break}}if(d>=0){let p=me(i).filter(k=>k.command!=="on").sort((k,D)=>D.priority-k.priority),y=m.slice(d);if(e.pattern.id.endsWith("vso-verb-first")&&s.type==="literal"){let k=String(s.value??"").split("[")[0].trim().toLowerCase(),D=y.findIndex((A,z)=>{if(z===0||k==="")return false;let g=(A.normalized??A.value).toLowerCase(),b=y[z-1];return g===k&&b.kind==="keyword"&&(b.normalized??"").toLowerCase()==="on"});if(D>0){let A=y[D+1],z=A&&A.kind==="selector"&&A.value.startsWith("[")?1:0;y=[...y.slice(0,D-1),...y.slice(D+1+z)];}}let E=new ie(y,i),v=this.coverageMark(),f=this.parseBodyWithClauses(E,p,i);if(f.some(k=>k.kind==="conditional")||f.length===1&&f[0]?.kind==="compound"&&f[0].statements.some(k=>k.kind==="conditional")){for(;!r.isAtEnd();)r.advance();return We(s,f,a,{sourceLanguage:i,patternId:e.pattern.id,confidence:e.confidence})}this.coverageRollback(v);}}if(c&&c.type==="literal"){let m=c.value,d={};for(let[A,z]of e.captured)A!=="event"&&A!=="action"&&A!=="continues"&&(d[A]=z);if(m==="repeat"){let A=r.peek(),z=b=>(b.normalized??b.value).toLowerCase();if(A&&A.kind==="keyword"&&z(A)==="forever")d.loopType={type:"literal",value:"forever"},delete d.patient,r.advance();else if(A&&A.kind==="keyword"&&z(A)==="event"){r.advance();let b=r.peek();if(b)for(d.event={type:"literal",value:z(b)},d.loopType={type:"literal",value:"until-event"},delete d.patient;!r.isAtEnd();){let w=r.peek();if(!w||w.kind==="conjunction"||w.kind==="keyword"&&(this.isThenKeyword(w.value,i)||this.isEndKeyword(w.value,i)))break;r.advance();}}let g=d.patient;g&&g.type==="reference"&&g.value==="me"&&delete d.patient;}let p=ne(m,d,{sourceLanguage:i,patternId:e.pattern.id,confidence:e.confidence});if(this.registerBoundIdentifiers(p),!ge.has(m)||m==="repeat"){let A=e.pattern.id.includes("verb-first"),z=r.tokens,g=r.position(),b=C=>C.kind==="conjunction"||C.kind==="keyword"&&(this.isThenKeyword(C.value,i)||this.isEndKeyword(C.value,i)),w=-1;for(let C=g-1;C>=0;C--){let S=z[C];if(b(S))break;if((S.normalized??S.value).toLowerCase()===m){w=C;break}}if(w>=0){let C=g;for(;C<z.length&&!b(z[C]);)C++;let S=z.slice(w,C),x=S;if(A){let O=String(n.value??"").toLowerCase(),R=S.findIndex(P=>(P.normalized??P.value).toLowerCase()===O);if(R<0)x=null;else {let P=S[R-1],_=P&&P.kind==="keyword"&&P.normalized?.toLowerCase()==="on"?R-1:R;x=[...S.slice(0,_),...S.slice(R+1)];}}if(x&&x.length>1){let O=me(i).filter(K=>K.command!=="on").sort((K,se)=>se.priority-K.priority),R=this.coverageMark(),P=this.parseClause(x,O,i),_=P[0],M=K=>K!==null&&typeof K=="object"&&typeof K.type=="string"?K.type:typeof K,H=ee(m),G=H?.primaryRole,fe=K=>K==="patient"&&G&&G!=="patient"&&!H?.roles.some(se=>se.role==="patient")?G:K,oe=(K,se)=>{if(!ge.has(m)||!H)return false;let De=H.roles.find(Ie=>Ie.role===fe(K));return De?De.expectedTypes.length>0&&!De.expectedTypes.includes(M(se)):true},he=!!_&&_.kind==="command"&&Object.entries(d).every(([K,se])=>{if(oe(K,se))return true;let De=_.roles.get(fe(K));if(De!==void 0&&M(De)===M(se))return true;if(K==="patient"&&m==="pick"&&M(se)==="literal"){let Ie=_.roles.get("method");return Ie!==void 0&&M(Ie)==="literal"&&String(Ie.value)===String(se.value)}return false}),mr=_?.metadata?.patternId??"",ei=!ge.has(m)||/^repeat-.*-(times|for-in|while-head|until-head)$/.test(mr);if(P.length===1&&_&&_.kind==="command"&&_.action===m&&he&&ei&&_.roles.size>Object.keys(d).length)for(p=_;r.position()<C;)r.advance();else this.coverageRollback(R);}}}if(!ge.has(m)){let A=p;if(ee(m)?.roles.some(x=>x.role==="quantity"&&!x.required)&&!A.roles.has("quantity")){let x=r.peek();x&&/^-?\d+(\.\d+)?$/.test(x.value)&&(p=ne(m,{...Object.fromEntries(A.roles),quantity:{type:"literal",value:parseFloat(x.value),dataType:"number"}},A.metadata),r.advance());}let g=p;if(ee(m)?.roles.some(x=>x.role==="duration"&&!x.required)&&!g.roles.has("duration")){let x=/^\d+(\.\d+)?(ms|s)$/i,O=r.peek(),R=false;if(O&&O.kind==="particle"){let P=r.peek(1);P&&x.test(P.value)&&(R=true,O=P);}O&&x.test(O.value)&&(p=ne(m,{...Object.fromEntries(g.roles),duration:{type:"literal",value:O.value,dataType:"string"}},g.metadata),R&&r.advance(),r.advance(),this.consumeForPostposition(r,i));}let w=p,C=ee(m);if(C?.roles.find(x=>x.role==="responseType"&&!x.required)&&!w.roles.has("responseType")){let x=M=>typeof M=="string"&&F.RESPONSE_TYPE_WORDS.has(M.toLowerCase()),O=(M,H)=>{let G=Object.fromEntries(w.roles);H&&delete G.destination,G.responseType={type:"expression",raw:M},p=ne(m,G,w.metadata);},R=w.roles.get("destination"),P=C?.roles.find(M=>M.role==="destination"),_=R?.raw??R?.value;if(R&&P&&!P.expectedTypes.includes(R.type)&&x(_))O(_,true);else {let M=r.peek();M&&x(M.value)&&(O(M.value,false),r.advance());}}if(m==="wait"){let x=p;if(!x.roles.has("event")){let O=r.peek();if(O&&Oe.has(O.value.toLowerCase())){let R=Object.fromEntries(x.roles),P=R.duration;P&&P.type!=="literal"&&P.type!=="expression"&&delete R.duration;let _=R.patient;_&&_.type==="reference"&&_.value==="me"&&delete R.patient,R.event={type:"literal",value:O.value,dataType:"string"},p=ne(m,R,x.metadata),r.advance(),this.consumeForPostposition(r,i);}}}this.tryAttachTrailingRole(r,p,i),this.tryAttachTrailingStyle(r,p,i),this.tryAttachTrailingExpressionRole(r,p,i);}let y=e.captured.get("continues"),E=y?.type==="literal"&&y.value==="then",v=r.peek(),f=!!v&&this.isThenKeyword(v.value,i),k=ge.has(m)&&!!v&&!this.isEndKeyword(v.value,i),D=!!v&&!this.isEndKeyword(v.value,i);if(E||f||k||D){let A=me(i).filter(b=>b.command!=="on").sort((b,w)=>w.priority-b.priority),z=me(i).filter(b=>b.id.startsWith("grammar-")&&b.id.includes("-continuation")).sort((b,w)=>w.priority-b.priority),g=this.parseBodyWithGrammarPatterns(r,A,z,i);g.length>0?l=[p,...g]:l=[p];}else l=[p],r.isAtEnd()||this.recordDroppedTokens(r.tokens.slice(r.position()),i,"handler body tail");}else {let m=me(i).filter(d=>d.command!=="on").sort((d,p)=>p.priority-d.priority);l=this.parseBodyWithClauses(r,m,i);}return We(s,l,a,{sourceLanguage:i,patternId:e.pattern.id,confidence:e.confidence})}parseBodyWithClauses(e,r,i){let n=[],a=[],u=0,o=[];for(;!e.isAtEnd();){let s=e.peek();if(!s)break;if(a.length===0){let y=this.consumeJsBlock(e,i);if(y){n.push(y);continue}let E=this.tryParseConditionalBlock(e,r,i);if(E){n.push(E);continue}}let l=s.kind==="conjunction"||s.kind==="keyword"&&this.isThenKeyword(s.value,i),c=a[a.length-1],m=e.peek(1),d=c?.value.toLowerCase()==="at"&&m?.value.toLowerCase()==="of"||$r(i,s.value,c?.value,m?.value),p=s.kind==="keyword"&&this.isEndKeyword(s.value,i)&&!d;if(p&&u>0){u--,o.pop(),a.push({...s,metadata:{...s.metadata,closesTrackedBlock:true}}),e.advance();continue}if(l&&o.includes("if")){a.push(s),e.advance();continue}if(l){if(a.length>0){let y=this.parseClause(a,r,i);n.push(...y),a.length=0,u=y.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(p){e.advance();let y=[];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;y.push(E),e.advance();}if(y.length>0){let E=this.coverageMark(),v=a.length>0?this.parseClause(a,r,i):[];v.length===0&&a.length>0?(this.coverageRollback(E),n.push(...this.parseClause([...a,...y],r,i))):(n.push(...v),n.push(...this.parseClause(y,r,i)));}else if(a.length>0){let E=this.parseClause(a,r,i);n.push(...E);}a.length=0;break}if(s.kind==="keyword"){let y=(s.normalized??s.value).toLowerCase();(this.isIfKeyword(y,i)||this.isUnlessKeyword(y,i)||y==="while"||y==="for"||y==="repeat")&&(u++,o.push(this.isIfKeyword(y,i)?"if":"other"));}a.push(s),e.advance();}if(a.length>0){let s=this.parseClause(a,r,i);n.push(...s);}e.isAtEnd()||this.recordDroppedTokens(e.tokens.slice(e.position()),i,"body stream tail"),this.foldFrontedWhileIntoRepeat(n,i);for(let s=n.length-1;s>=0;s--){let l=n[s];l.kind==="command"&&l.action==="for"&&(!(l.roles instanceof Map)||l.roles.size===0)&&(!Array.isArray(l.body)||l.body.length===0)&&n.splice(s,1);}return n.length>1?[zr(n,"then",{sourceLanguage:i})]:n}tryTopLevelCommandSequence(e,r,i){let n=this.coverageMark(),a;try{let l=new ie(e.tokens,i);a=this.parseBodyWithClauses(l,r,i);}catch{return this.coverageRollback(n),null}if(a.length!==1||a[0].kind!=="compound")return this.coverageRollback(n),null;let u=a[0];if(u.statements.length<2)return this.coverageRollback(n),null;let o=u.statements.map(l=>l.metadata?.confidence??.75),s=o.reduce((l,c)=>l+c,0)/o.length;return zr(u.statements,u.chainType,{sourceLanguage:i,confidence:s})}foldFrontedWhileIntoRepeat(e,r){for(let i=0;i+1<e.length;i++){let n=e[i],a=e[i+1];if(n.kind!=="command"||n.action!=="while"||a.kind!=="command"||a.action!=="repeat")continue;let u=n.roles.get("condition");if(!u||a.roles.has("condition")||Array.isArray(n.body)||Array.isArray(a.body))continue;let o=new Map(a.roles);o.set("condition",u),o.set("loopType",{type:"literal",value:"while",dataType:"string"}),e.splice(i,2,{...a,roles:o,metadata:{...a.metadata,sourceLanguage:r,patternId:`repeat-${r}-fronted-while-fold`,confidence:Math.max(a.metadata?.confidence??0,n.metadata?.confidence??0)}});}}parseClause(e,r,i){if(e.length===0)return [];let n=null,a=e,u=e[e.length-1];if(u&&e.length>=2){let f=(u.normalized??u.value).toLowerCase();this.isUnlessKeyword(f,i)&&(n="unless",a=e.slice(0,-1));}let o=null;if(n&&a.length>=3){let f=N(i),h=f?F.buildVerbLookup(f):null;if(h)for(let k=1;k<a.length-1;k++){let D=a[k],A=h.get(D.value.toLowerCase())??(D.normalized?h.get(D.normalized.toLowerCase()):void 0);if(A&&!F.CONDITION_OPERATORS.has(A)){o=a.slice(0,k),a=a.slice(k);break}}}let s=new ie(a,i),l=[],c=this.coverageMark(),m=0,d=[],p=o,y=()=>{if(d.length===0)return;let f=d.slice();if(d.length=0,n&&l.length===0&&p===null){p=f;return}let h=f[0];if(!(h&&(h.kind==="identifier"||h.kind==="selector"||h.kind==="literal"||h.kind==="reference"))){this.recordDroppedTokens(f,i,"body clause");return}let D=false;for(let A of this.parseSOVClauseByVerbAnchoring(f,i)){let z=A.action,g=A.roles;z&&ee(z)&&g instanceof Map&&g.size>0&&(l.push(A),D=true);}D||this.recordDroppedTokens(f,i,"body clause");};for(;!s.isAtEnd();){let f=s.peek(),h=!!f&&f.normalized?.toLowerCase()==="repeat",k=s.mark(),D=ae.matchBest(s,r);if(h&&D&&D.pattern.command!=="repeat"){s.reset(k),y(),l.push(ne("repeat",{},{sourceLanguage:i,confidence:.6})),m++,s.advance();continue}if(D&&D.pattern.command==="if"){let A=s.mark(),z=d.length;for(s.reset(k);!s.isAtEnd();){let b=s.peek();if(!b||this.isIfKeyword((b.normalized??b.value).toLowerCase(),i))break;d.push(b),s.advance();}let g=this.tryParseConditionalBlock(s,r,i);if(g){y(),l.push(g),m++;continue}d.length=z,s.reset(A);}if(D){y();let A=this.buildCommand(D,i);l.push(A),m++,this.tryAttachTrailingRole(s,A,i),this.tryAttachTrailingStyle(s,A,i),this.tryAttachTrailingExpressionRole(s,A,i);}else {let A=s.peek();A&&A.normalized?.toLowerCase()==="repeat"?(y(),l.push(ne("repeat",{},{sourceLanguage:i,confidence:.6})),m++):A&&d.push(A),s.advance();}}y();let E=l;if(m===0){let f=this.parseSOVClauseByVerbAnchoring(a,i);f.length>0&&(this.coverageRollback(c),E=f);}let v=p;return n&&E.length>0&&v&&v.length>0?[ne(n,{condition:{type:"expression",raw:this.joinTokenText(v,i)}},{sourceLanguage:i,patternId:`${n}-${i}-trailing-guard`,confidence:.85}),...E]:(n&&v&&v.length>0&&E.length===0&&this.recordDroppedTokens(v,i,"body clause"),E)}tryAttachTrailingRole(e,r,i){let n=ee(r.action);if(!n)return;let a=N(i);if(!a)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 hr.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(!n.roles.some(v=>v.role===l))continue;let m=a.roleMarkers?.[l];if(!m)continue;let d=u.get(l);if(d&&!(d.type==="reference"&&d.value==="me"))continue;let p=v=>{if(!v||v.kind!=="particle"&&v.kind!=="keyword")return false;let f=v.value.toLowerCase();return m.primary?.toLowerCase()===f?true:c?false:(v.normalized??"").toLowerCase()===l?true:!!m.alternatives?.some(h=>h.toLowerCase()===f)},y=e.peek(),E=e.peek(1);if(!y||!E)return;if(c&&m.position==="after"){let v=e.peek(2),f=(y.normalized??y.value).toLowerCase();if(_u.has(f)&&E.kind==="selector"&&p(v)){u.set(l,{type:"expression",raw:`${f} ${E.value}`}),e.advance(),e.advance(),e.advance();return}}if(m.position==="after"){if(o(y,c)&&p(E)){let v=this.tokenToSemanticValue(y);e.advance(),e.advance(),v&&u.set(l,v);return}if(c&&o(y,c)){let v=e.peek(2),f=e.peek(3);if((E.normalized??E.value).toLowerCase()==="in"&&v&&!p(v)&&p(f)){let h=this.tokenToSemanticValue(y);e.advance(),e.advance(),e.advance(),e.advance(),h&&u.set(l,h);return}}}else if(p(y)&&o(E,c)){e.advance();let v=this.tokenToSemanticValue(e.advance());v&&u.set(l,v);return}}}tryAttachTrailingStyle(e,r,i){if(r.action!=="fetch"&&r.action!=="render")return;let n=r.roles;if(!ee(r.action)?.roles.some(f=>f.role==="style"))return;let u=n.get("style");if(u){if(u.type==="expression"&&typeof u.raw=="string"&&/^[A-Za-z_][\w-]*$/.test(u.raw)&&e.peek()?.value===":"){let f=Ke(e,u.raw);f&&(n.set("style",{type:"expression",raw:f}),this.tryAttachResponseTypeAfterStyle(e,r,i));}return}if(r.action==="fetch"){let f=n.get("patient"),h=n.get("source");if(f&&h&&(f.type==="literal"||f.type==="expression")&&h.type==="expression"&&typeof h.raw=="string"&&/^[A-Za-z_][\w-]*$/.test(h.raw)&&e.peek()?.value===":"){let k=Ke(e,h.raw);k&&(n.set("source",{type:"expression",raw:k}),this.tryAttachResponseTypeAfterStyle(e,r,i));return}}let s=N(i)?.roleMarkers?.style;if(!s)return;if(s.position==="before"){let f=new Set([s.primary,...s.alternatives??[]].map(A=>A.toLowerCase())),h=e.peek();if(!h||!f.has(h.value.toLowerCase()))return;let k=e.mark();e.advance();let D=Ke(e);if(!D){e.reset(k);return}n.set("style",{type:"expression",raw:D}),this.tryAttachResponseTypeAfterStyle(e,r,i);return}if(s.position!=="after")return;let l=new Set([s.primary,...s.alternatives??[]].map(f=>f.toLowerCase())),c=f=>f.kind==="conjunction"||f.kind==="keyword"&&(this.isThenKeyword(f.value,i)||this.isEndKeyword(f.value,i)),m=24,d=-1,p=0;for(let f=0;f<m;f++){let h=e.peek(f);if(!h||c(h))break;if(h.value==="("||h.value==="{"?p++:(h.value===")"||h.value==="}")&&(p=Math.max(0,p-1)),p===0&&(h.kind==="particle"||h.kind==="keyword")&&l.has(h.value.toLowerCase())){d=f;break}}if(d<=0)return;let y=[];for(let f=0;f<d;f++){let h=e.peek(f);h&&y.push(h);}if(y.length===1&&F.RESPONSE_TYPE_WORDS.has(y[0].value.toLowerCase()))return;let E=new ie(y,i),v=Ke(E);n.set("style",{type:"expression",raw:v&&E.isAtEnd()?v:this.joinTokenText(y,i)});for(let f=0;f<=d;f++)e.advance();this.tryAttachResponseTypeAfterStyle(e,r,i);}tryAttachResponseTypeAfterStyle(e,r,i){let n=r.roles;if(n.has("responseType")||!ee(r.action)?.roles.some(c=>c.role==="responseType"&&!c.required))return;let u=c=>!!c&&F.RESPONSE_TYPE_WORDS.has(c.toLowerCase()),o=e.peek();if(!o)return;let s=c=>{n.set("responseType",{type:"expression",raw:c});};if(F.AS_MARKERS_BEFORE[i]?.some(c=>o.value.toLowerCase()===c)){let c=e.peek(1);c&&u(c.value)&&(e.advance(),e.advance(),s(c.value));return}if(u(o.value)){e.advance(),s(o.value);for(let c of F.AS_MARKERS_AFTER[i]??[])if(c.every((m,d)=>e.peek(d)?.value.toLowerCase()===m)){for(let m=0;m<c.length;m++)e.advance();break}}}tryAttachTrailingExpressionRole(e,r,i){let n=r.action,a=n==="js"?{role:"patient",terminator:"boundary"}:n==="go"||n==="scroll"?{role:"destination",terminator:"destination-marker"}:null;if(!a)return;let u=r.roles,o=u.get(a.role);if(n==="go"&&o&&o.type==="expression"&&String(o.raw).toLowerCase()==="url"){let f=e.peek();if(f&&!hr.has((f.normalized??f.value).toLowerCase())){let k=this.tokenToSemanticValue(f);if(k.type==="literal"||k.type==="selector"){u.set(a.role,k),u.set("method",{type:"literal",value:"url"}),e.advance();return}}let h=u.get("patient");if(h&&(h.type==="literal"||h.type==="selector")){u.set(a.role,h),u.set("method",{type:"literal",value:"url"}),u.delete("patient");return}}if(n==="go"&&o&&o.type==="expression"){let f=/^url\s+(\S+)$/i.exec(String(o.raw??""));if(f){let h=f[1].replace(/^["']|["']$/g,"");u.set(a.role,{type:"literal",value:h,dataType:"string"}),u.set("method",{type:"literal",value:"url"});return}}if(n==="go"&&!o){let f=u.get("patient");if(f&&f.type==="expression"&&String(f.raw).toLowerCase()==="url"){let h=e.peek();if(h&&!hr.has((h.normalized??h.value).toLowerCase())){let k=this.tokenToSemanticValue(h);if(k.type==="literal"||k.type==="selector"){u.set(a.role,k),u.set("method",{type:"literal",value:"url"}),u.delete("patient"),e.advance();return}}}}if(o&&!(o.type==="reference"&&o.value==="me"))return;let s=N(i);if(!s)return;let l=null;if(a.terminator==="destination-marker"){let f=s.roleMarkers?.destination;if(!f||f.position!=="after")return;l=f.primary.toLowerCase();}let c=f=>f.kind==="conjunction"||f.kind==="keyword"&&(this.isThenKeyword(f.value,i)||this.isEndKeyword(f.value,i)),m=24,d=[],p=0,y=false;for(let f=0;f<m;f++){let h=e.peek(f);if(!h||c(h))break;if(h.value==="("||h.value==="{"?p++:(h.value===")"||h.value==="}")&&(p=Math.max(0,p-1)),l!==null&&p===0&&(h.kind==="particle"||h.kind==="keyword")&&h.value.toLowerCase()===l){y=true;break}d.push(h);}if(d.length===0||l!==null&&!y)return;let E=d.length+(y?1:0);if(n==="go"&&d.length===2&&d[0].value.toLowerCase()==="url"){let f=this.tokenToSemanticValue(d[1]);if(f.type==="literal"||f.type==="selector"){u.set(a.role,f),u.set("method",{type:"literal",value:"url"});let h=u.get("patient");h&&h.type==="reference"&&h.value==="me"&&!ee(n)?.roles.some(k=>k.role==="patient")&&u.delete("patient");for(let k=0;k<E;k++)e.advance();return}}let v=d;if(n==="js"){let f=s.keywords?.js,h=D=>[f?.primary,...f?.alternatives??[]].some(A=>!!A&&A.length>D.value.length&&A.includes(D.value)),k=0;for(;k<v.length&&h(v[k]);)k++;if(v=v.slice(k),v.length===0)return}if(u.set(a.role,{type:"expression",raw:this.joinTokenText(v,i)}),a.role!=="patient"){let f=u.get("patient");f&&f.type==="reference"&&f.value==="me"&&!ee(n)?.roles.some(h=>h.role==="patient")&&u.delete("patient");}for(let f=0;f<E;f++)e.advance();}static buildVerbLookup(e){let r=new Map;for(let[i,n]of Object.entries(e.keywords))if(!["on","if","else","when","where","while","end","then","and"].includes(i)&&(r.set(n.primary.toLowerCase(),i),n.alternatives))for(let a of n.alternatives)r.set(a.toLowerCase(),i);return r}static buildMarkerToRoleLookup(e){let r=new Map;for(let[i,n]of Object.entries(e.roleMarkers)){if(!n)continue;if((i!=="event"||!r.has(n.primary))&&r.set(n.primary,i),n.alternatives)for(let u of n.alternatives)r.has(u)||r.set(u,i);}return r}parseSOVClauseByVerbAnchoring(e,r){let i=N(r);if(!i||i.wordOrder!=="SOV")return [];let n=F.buildVerbLookup(i),a=F.buildMarkerToRoleLookup(i),u=[],o=0;for(;o<e.length;){let s=-1,l="";for(let y=o;y<e.length;y++){let E=e[y];if(a.has(E.value))continue;let v=n.get(E.value.toLowerCase()),f=E.normalized?n.get(E.normalized.toLowerCase()):void 0,h=v||f;if(h){s=y,l=h;break}}if(s===-1)break;let c=e.slice(o,s),m=e.length;for(let y=s+1;y<e.length;y++){let E=e[y];if(E.kind==="conjunction"||this.isThenKeyword(E.value,r)){m=y;break}if(y>s+1&&!a.has(E.value)&&(n.get(E.value.toLowerCase())||(E.normalized?n.get(E.normalized.toLowerCase()):void 0))){m=y;break}}let d=e.slice(s+1,m),p=this.extractRolesFromMarkedTokens(c,d,a,l,r);if(u.push(ne(l,p,{sourceLanguage:r,confidence:.7})),o=m,o<e.length){let y=e[o];(y.kind==="conjunction"||this.isThenKeyword(y.value,r))&&o++;}}return u}extractRolesFromMarkedTokens(e,r,i,n,a){let u={},o=(l,c)=>{let m=this.isEndKeyword(l.value,a),d=l.kind==="keyword"&&(l.normalized??"").toLowerCase()==="end";return !m&&!d?false:l.metadata?.closesTrackedBlock===true||m?true:!(c&&c.kind==="selector")},s=l=>{let c=[];for(let m=0;m<l.length;m++){let d=l[m];if(o(d,l[m+1]))continue;let p=i.get(d.value);if(p&&d.kind==="particle"&&c.length>0){let y=this.tokensToSemanticValue(c,a);if(y){let E=this.mapRoleForCommand(p,n,u);E&&(u[E]=y);}c=[];}else c.push(d);}if(c.length>0)if(c.length===1&&/^\d+(\.\d+)?(ms|s)$/i.test(c[0].value)&&!u.duration&&ee(n)?.roles.some(d=>d.role==="duration"))u.duration={type:"literal",value:c[0].value,dataType:"string"};else {let d=this.tokensToSemanticValue(c,a);d&&(u.patient?u.destination||(u.destination=d):u.patient=d);}};return s(e),s(r),u}mapRoleForCommand(e,r,i){return r==="set"&&(e==="patient"?e="destination":e==="destination"&&(e="patient")),i[e]?e==="patient"&&!i.destination?"destination":e==="destination"&&!i.patient?"patient":e==="source"&&!i.source?"source":null:e}tokensToSemanticValue(e,r){if(e.length===0)return null;let i=e.filter(u=>u.kind!=="whitespace");if(i.length===0)return null;if(i.length>=2&&(i[0].kind==="selector"||/^[#.@*<]/.test(i[0].value))){let u=i.findIndex((o,s)=>s>0&&(o.normalized??o.value).toLowerCase()==="in");u>0&&(i=i.slice(0,u));}if(i.length===1)return this.tokenToSemanticValue(i[0]);let n=i.map(u=>u.value).join(""),a=i[0];return a.kind==="selector"||a.value.startsWith("#")||a.value.startsWith(".")||a.value.startsWith("@")||a.value.startsWith("*")?ze(n):a.kind==="literal"||a.value.startsWith('"')||a.value.startsWith("'")?q(rt(n),"string"):a.kind==="reference"?ue(n):q(this.joinTokenText(i,r))}tokenToSemanticValue(e){let r=e.value;if(e.kind==="selector"||r.startsWith("#")||r.startsWith(".")||r.startsWith("@")||r.startsWith("*"))return ze(r);if(r.startsWith('"')||r.startsWith("'"))return q(rt(r),"string");if(/^-?\d+(\.\d+)?$/.test(r))return q(parseFloat(r));if(r==="true"||r==="\u771F"||r==="\uCC38"||r==="do\u011Fru")return q(true);if(r==="false"||r==="\u507D"||r==="\uAC70\uC9D3"||r==="yanl\u0131\u015F")return q(false);if(r.length>1&&(r.startsWith(":")||r.startsWith("$")))return ue(r);let i=e.normalized?.toLowerCase();return i==="me"||i==="it"||i==="you"||i==="result"||i==="body"?ue(i):e.kind==="reference"?ue(e.normalized||"me"):q(r)}parseBodyWithGrammarPatterns(e,r,i,n){let a=[],u=[],o=false,s=()=>{if(!o&&u.length>0){let m=this.parseSOVClauseByVerbAnchoring(u,n);a.push(...m),m.length===0&&this.recordDroppedTokens(u,n,"fused body walk");}else u.length>0&&this.recordDroppedTokens(u,n,"fused body walk");u=[],o=false;},l=0,c=()=>{let m=0;for(let d of a){let p=d;(p.action==="for"||p.action==="repeat"||p.action==="while")&&(!Array.isArray(p.body)||p.body.length===0)&&m++;}return m-l};for(;!e.isAtEnd();){let m=e.peek();if(m&&this.isThenKeyword(m.value,n)){s(),e.advance();continue}if(m&&this.isEndKeyword(m.value,n)){let p=e.peek(-1),y=e.peek(1);if(!$r(n,m.value,p?.value,y?.value)){if(s(),c()>0){l++,e.advance();continue}e.advance();break}}if(m&&!o&&this.isIfKeyword((m.normalized??m.value).toLowerCase(),n)){s();let p=this.tryParseConditionalBlock(e,r,n);if(p){a.push(p),o=true;continue}}let d=false;if(i.length>0){let p=ae.matchBest(e,i);if(p){let y=p.pattern.command,E={};for(let[h,k]of p.captured)h!=="event"&&h!=="action"&&h!=="continues"&&(E[h]=k);let v=ne(y,E,{sourceLanguage:n,patternId:p.pattern.id});a.push(v),d=true,o=true;let f=p.captured.get("continues");if(f&&f.type==="literal"&&f.value==="then")continue}}if(!d){let p=e.mark(),y=ae.matchBest(e,r);if(y){if(y.pattern.command==="if"){let v=e.mark();for(e.reset(p);!e.isAtEnd();){let h=e.peek();if(!h||this.isIfKeyword((h.normalized??h.value).toLowerCase(),n))break;e.advance();}let f=this.tryParseConditionalBlock(e,r,n);if(f){s(),a.push(f),o=true;continue}e.reset(v);}let E=this.buildCommand(y,n);a.push(E),this.tryAttachTrailingRole(e,E,n),d=true,o=true;}}d||(m&&u.push(m),e.advance());}s(),e.isAtEnd()||this.recordDroppedTokens(e.tokens.slice(e.position()),n,"fused body walk");for(let m=a.length-1;m>=0;m--){let d=a[m];d.kind==="command"&&d.action==="for"&&(!(d.roles instanceof Map)||d.roles.size===0)&&(!Array.isArray(d.body)||d.body.length===0)&&a.splice(m,1);}return a}tryCompoundCommandParsing(e,r,i){let n=e.tokens,a=n.some(c=>c.kind==="conjunction"||c.kind==="keyword"&&this.isThenKeyword(c.value,i)),u=n.some(c=>this.isElseKeyword(c.value,i));if(!a&&!u)return null;let o=new ie(n,i),s=this.coverageMark(),l=this.parseBodyWithClauses(o,r,i);return l.length===0?(this.coverageRollback(s),null):l[0]}matchEventMarkerPhrase(e,r,i){let n=F.SOV_EVENT_MARKER_PHRASES[i];if(!n)return 0;for(let a of n)if(a.every((u,o)=>e[r+o]?.value===u))return a.length;return 0}hasSOVEventMarkerHead(e,r){let i=F.SOV_EVENT_MARKERS[r];if(i===void 0)return false;let{tokens:n}=U(e,r),a=ye[r],u=new Set;if(a)for(let o of Object.keys(a))u.add(o.toLowerCase());for(let o=0;o<n.length;o++){let s=n[o],l=s.value.toLowerCase(),c=s.normalized?.toLowerCase();if(!(!!c&&(F.KNOWN_EVENTS.has(c)||Oe.has(c))||F.KNOWN_EVENTS.has(l)||Oe.has(l)||u.has(l)))continue;let d=this.matchEventParamPhrase(n,o+1).len,p=n[o+1+d];if(p&&(p.kind==="particle"||p.kind==="keyword")&&i.has(p.value)||this.matchEventMarkerPhrase(n,o+1+d,r)>0)return true}return false}matchEventParamPhrase(e,r){if(e[r]?.value!=="(")return {len:0,names:[]};let i=[];for(let n=r+1;n<e.length;n++){let a=e[n].value;if(a===")")return {len:n-r+1,names:i};if(a!==","){if(e[n].kind!=="identifier")break;i.push(a);}}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 n=e.value.toLowerCase();return r.has(n)||!!i&&r.has(i)}tryTrailingEventExtraction(e,r,i){let n=U(e,r).tokens;if(n.length<3)return null;let a=ye[r],u=new Set;if(a)for(let D of Object.keys(a))u.add(D.toLowerCase());let o=n.length-2,s=n[o];if(!(s.kind==="keyword"&&s.normalized?.toLowerCase()==="on"))return null;let c=n[n.length-1],m=c.value.toLowerCase(),d=c.normalized?.toLowerCase();if(!(!!d&&F.KNOWN_EVENTS.has(d)||F.KNOWN_EVENTS.has(m)||u.has(m)))return null;let y=d&&F.KNOWN_EVENTS.has(d)?d:a?.[m]??m,E=n.slice(0,o);if(E.length===0)return null;let v=i.filter(D=>D.command!=="on"),f=new ie(E,r),h=this.coverageMark(),k=this.parseBodyWithClauses(f,v,r);return k.length===0?(this.coverageRollback(h),null):We({type:"literal",value:y},k,void 0,{sourceLanguage:r,confidence:.75})}tryMidStreamEventExtraction(e,r,i){let n=U(e,r).tokens;if(n.length<3)return null;let a=ye[r],u=new Set;if(a)for(let o of Object.keys(a))u.add(o.toLowerCase());for(let o=0;o<n.length-1;o++){let s=n[o];if(!(s.kind==="keyword"&&s.normalized?.toLowerCase()==="on"))continue;let c=n[o+1],m=c.value.toLowerCase(),d=c.normalized?.toLowerCase();if(!(!!d&&F.KNOWN_EVENTS.has(d)||F.KNOWN_EVENTS.has(m)||u.has(m)))continue;let y=d&&F.KNOWN_EVENTS.has(d)?d:a?.[m]??m,E=n.filter((D,A)=>A!==o&&A!==o+1);if(E.length===0)return null;let v=i.filter(D=>D.command!=="on"),f=new ie(E,r),h=this.coverageMark(),k=this.parseBodyWithClauses(f,v,r);return k.length===0?(this.coverageRollback(h),null):We({type:"literal",value:y},k,void 0,{sourceLanguage:r,confidence:.75})}return null}trySOVEventExtraction(e,r,i){let n=F.SOV_EVENT_MARKERS[r];if(!n)return null;let u=U(e,r).tokens,o=ye[r],s=new Set;if(o)for(let z of Object.keys(o))s.add(z.toLowerCase());let l=F.SOV_SOURCE_MARKERS[r],c=-1,m="",d="",p=1,y=[];for(let z=0;z<u.length;z++){let g=u[z],b=g.value.toLowerCase(),w=b,C="",S=b.indexOf("[");S>0&&(w=b.slice(0,S),C=g.value.slice(S));let x=g.normalized?.toLowerCase(),O=x&&(F.KNOWN_EVENTS.has(x)||Oe.has(x)),R=s.has(b)||s.has(w),P=F.KNOWN_EVENTS.has(w)||Oe.has(w);if(O||R||P){let _=u[z-1];if(_&&(_.normalized??_.value).toLowerCase()==="event")continue;let M;O?M=x:R?M=o?.[b]??o?.[w]??w:M=w;let H=this.matchEventParamPhrase(u,z+1);if(n.size>0){let G=1+H.len,fe=u[z+G];fe&&fe.kind==="selector"&&fe.value.startsWith("[")&&(G+=1);let oe=u[z+G];if(oe&&(oe.kind==="particle"||oe.kind==="keyword")&&n.has(oe.value)){c=z,m=M,d=C||(G===H.len+2?u[z+G-1].value:""),p=G+1,y=H.names;break}}else {c=z,m=M,d=C,p=1+H.len+this.matchEventMarkerPhrase(u,z+1+H.len,r),y=H.names;break}}}if(c===-1){let z=new Set(i.filter(g=>g.command!=="on").map(g=>g.command));for(let g=0;g<u.length;g++){let b=u[g];if(b.kind==="identifier")if(n.size>0){let w=1,C=u[g+1];C&&C.kind==="selector"&&C.value.startsWith("[")&&(w=2);let S=u[g+w];if(S&&(S.kind==="particle"||S.kind==="keyword")&&n.has(S.value)){c=g,m=b.value,d=w===2?u[g+1].value:"",p=w+1;break}}else {let w=this.matchEventMarkerPhrase(u,g+1,r);if(w>0){c=g,m=b.value,d="",p=1+w;break}let C=u[g+1];if(C&&C.kind==="keyword"&&C.normalized!=null&&z.has(C.normalized)){c=g,m=b.value,d="",p=1;break}}}}if(c===-1)return null;let E=new Set;for(let z=c;z<c+p;z++)E.add(z);if(l){let z=c+p;if(z<u.length){let g=u[z];if((g.kind==="particle"||g.kind==="keyword")&&l.markers.has(g.value))E.add(z);else if(this.isStrippableSourceRef(g,l.windowTokens)){let b=u[z+1];b&&(b.kind==="particle"||b.kind==="keyword")&&l.markers.has(b.value)&&(E.add(z),E.add(z+1));}}if(c>=2){let g=u[c-1];(g.kind==="particle"||g.kind==="keyword")&&l.markers.has(g.value)&&this.isStrippableSourceRef(u[c-2],l.windowTokens)&&(E.add(c-2),E.add(c-1));}for(let g=0;g<c;g++){let b=u[g],w=b.value.toLowerCase(),C=b.normalized?.toLowerCase();if(l.windowTokens.has(w)||C&&l.windowTokens.has(C)){E.add(g);break}}}let v=u.filter((z,g)=>!E.has(g));if(v.length===0)return null;let f=i.filter(z=>z.command!=="on"),h=new ie(v,r),k=this.coverageMark(),D=this.parseBodyWithClauses(h,f,r);if(D.length===0)return this.coverageRollback(k),null;let A={sourceLanguage:r,confidence:.75};return d&&(A.keyFilter=d),We({type:"literal",value:m},D,void 0,A,y)}profileKeywordMatches(e,r,i){let n=N(e)?.keywords?.[r];return n?n.primary?.toLowerCase()===i?true:!!n.alternatives?.some(a=>a.toLowerCase()===i):false}consumeForPostposition(e,r){let i=e.peek();if(!i)return;let n=(i.normalized??"").toLowerCase(),a=N(r)?.keywords?.for;(n==="for"||i.value===a?.primary||(a?.alternatives??[]).includes(i.value))&&e.advance();}isThenKeyword(e,r){let i=e.toLowerCase(),a={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 a?a.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=Za(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 n=e.mark(),a=[];e.advance();let u=e.peek();u&&i.position?.end!==void 0&&i.position.end===u.position?.start&&this.profileKeywordMatches(r,"js",`${i.value}${u.value}`.toLowerCase())&&e.advance();let o=false;for(;!e.isAtEnd();){let l=e.peek();if(!l)break;if(e.advance(),this.isEndKeyword(l.value,r)){o=true;break}a.push(l);}if(!o)return e.reset(n),null;let s=a.map(l=>l.value).join(" ").trim();return ne("js",{patient:{type:"expression",raw:s||"()"}},{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 n=e.peek();if(!n)return null;let a=(n.normalized??n.value).toLowerCase();if(!this.isIfKeyword(a,i))return null;let u=e.mark(),o=this.coverageMark();e.advance();let s=[],l=0;for(;!e.isAtEnd();){let g=e.peek();if(!g)break;let b=(g.normalized??g.value).toLowerCase();if(this.isIfKeyword(b,i)||this.isUnlessKeyword(b,i)){l++,s.push(g),e.advance();continue}if(this.isBlockEndToken(g,e.peek(1)??void 0,i)){if(l===0){e.advance();break}l--,s.push(g),e.advance();continue}s.push(g),e.advance();}if(s.length===0)return e.reset(u),this.coverageRollback(o),null;let c=N(i),m=c?.wordOrder==="SOV"?F.buildVerbLookup(c):null,d=0,p=0,y=[];for(;d<s.length;d++){let g=s[d],b=(g.normalized??g.value).toLowerCase();if(this.isIfKeyword(b,i)||this.isUnlessKeyword(b,i)?p++:this.isBlockEndToken(g,s[d+1],i)&&p--,p===0&&this.isThenKeyword(g.value,i)){d++;break}if(p===0&&y.length>0){let w=(s[d-1].normalized??s[d-1].value).toLowerCase(),C=s[d-1].value.toLowerCase(),S=(g.normalized??g.value).toLowerCase(),x=F.CONDITION_COPULAS.has(w)||F.CONDITION_COPULAS_SURFACE.has(C)&&F.CONDITION_PREDICATES.has(S),O=m!==null&&m.has(g.value.toLowerCase())&&!F.CONDITION_PREDICATES.has(S),R=/^\.[a-zA-Z_]\w*$/.test(g.value)&&s[d-1].position?.end!==void 0&&g.position?.start!==void 0&&s[d-1].position.end===g.position.start;if(!F.CONDITION_OPERATORS.has(S)&&!R&&(!x||O)&&(this.tokensBeginCommand(s.slice(d),r,i)||this.sovCommandStartsAt(s.slice(d),m)))break}y.push(g);}if(y.length===0)return e.reset(u),this.coverageRollback(o),null;let v=[],f=[],h=false,k=0;for(;d<s.length;d++){let g=s[d],b=(g.normalized??g.value).toLowerCase();if(this.isIfKeyword(b,i)||this.isUnlessKeyword(b,i)?k++:this.isBlockEndToken(g,s[d+1],i)&&k--,k===0&&!h&&this.isElseKeyword(g.value,i)){h=true;continue}(h?f:v).push(g);}let D={type:"expression",raw:this.joinTokenText(y,i)},A=this.parseBranch(v,r,i),z=f.length>0?this.parseBranch(f,r,i):void 0;return A.length===0&&(!z||z.length===0)?(e.reset(u),this.coverageRollback(o),null):fn(D,A,z,{sourceLanguage:i,patternId:`conditional-${i}-folded`,confidence:1})}joinTokenText(e,r){return kr(e,N(r))}tokensBeginCommand(e,r,i){if(e.length===0)return false;let n=new ie(e,i);return ae.matchBest(n,r)!==null}sovCommandStartsAt(e,r){if(!r)return false;let i=o=>r.has(o.value.toLowerCase())||!!o.normalized&&r.has(o.normalized.toLowerCase()),n=o=>o.kind==="identifier"||o.kind==="selector"||o.kind==="literal"||o.kind==="reference",a=0,u=0;for(;a+1<e.length;){let o=e[a],s=e[a+1];if(!n(o)||s.kind!=="particle")break;u+=1,a+=2;let l=e[a];if(u>=1&&l&&i(l))return true}return false}parseBranch(e,r,i){if(e.length===0)return [];let n=new ie(e,i),a=this.parseBodyWithClauses(n,r,i);return a.length===1&&a[0]?.kind==="compound"?a[0].statements:a}extractStandaloneModifiers(e,r){let n=U(e,r).tokens;if(n.length===0)return {modifiers:null,remainingInput:null};let u=n[0].value.toLowerCase(),o=F.STANDALONE_MODIFIERS[u];if(!o)return {modifiers:null,remainingInput:null};let s={},l=1;if(o==="once")s.once=true;else {let p=1;if(p<n.length){let y=n[p],E=n[p+1],v=y.kind==="identifier"&&E?.kind==="literal"&&/^\d+(ms|s|m)?$/.test(E.value);(y.kind==="keyword"||y.kind==="particle"||v)&&(p++,l++);}if(p<n.length){let y=n[p];if(y.kind==="literal"){let E=y.value.match(/^(\d+)(ms|s|m)?$/);if(E){let v=parseInt(E[1],10),f=E[2]||"ms";f==="s"?v*=1e3:f==="m"&&(v*=6e4),s[o]=v,l=p+1;}}}s[o]||(s[o]=o==="debounce"?300:100);}let c=n.slice(l);if(c.length===0)return {modifiers:null,remainingInput:null};let m=c[0].position.start,d=e.slice(m);return {modifiers:s,remainingInput:d}}stripAsyncModifier(e,r){let i=N(r)?.keywords?.async,n=new Set(["async"]);i?.primary&&n.add(i.primary.toLowerCase()),i?.alternatives?.forEach(l=>n.add(l.toLowerCase()));let a=U(e,r).tokens,u=a.findIndex(l=>n.has(l.value.toLowerCase()));if(u===-1)return {remainingInput:null};let o=a[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=U(e,r).tokens;for(let n=0;n<i.length-1;n++){if(i[n].value.toLowerCase()!=="do")continue;let a=-1;for(let l=n+1;l<=n+5&&l<i.length;l++){let c=i[l];if(c.normalized?.toLowerCase()==="throw"){a=l;break}let m=c.kind;if(m==="selector"||m==="literal"||m==="reference"||m==="conjunction")break}if(a===-1)continue;let u=i[n].position.start,o=i[a].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}}static droppedTokenCount(e){return (e.diagnostics??[]).filter(r=>r.code==="unconsumed-input").reduce((r,i)=>r+(parseInt(/left (\d+) token/.exec(i.message)?.[1]??"0",10)||0),0)}static unconsumedSpans(e){return (e.diagnostics??[]).filter(r=>r.code==="unconsumed-input").map(r=>/unconsumed: "(.*)"$/.exec(r.message)?.[1]).filter(r=>!!r).map(r=>r.replace(/\s+/g," ").trim())}static withoutSpanDiagnostics(e,r){return {...e,diagnostics:(e.diagnostics??[]).filter(i=>{if(i.code!=="unconsumed-input")return true;let n=/unconsumed: "(.*)"$/.exec(i.message)?.[1];return !n||n.replace(/\s+/g," ").trim()!==r})}}reclaimDanglingFromTail(e,r,i){let n=F.droppedTokenCount,a=F.unconsumedSpans(e);if(a.length===0)return null;let u=n(e),o=N(i)?.roleMarkers?.source,s=new Set;o?.primary&&s.add(o.primary),o?.alternatives?.forEach(c=>s.add(c));let l=U(r,i).tokens;for(let c=0;c<l.length;c++){let m=l[c];if(m.normalized!=="source"&&!s.has(m.value))continue;let d=o?.position==="after"?c-1:c+1,p=l[d];if(!p||p.kind!=="identifier"&&p.kind!=="keyword")continue;let y=Math.min(m.position.start,p.position.start),E=Math.max(m.position.end,p.position.end),v=r.slice(y,E).replace(/\s+/g," ").trim();if(!a.some(h=>h===v||h.includes(v)))continue;let f=(r.slice(0,y).trimEnd()+" "+r.slice(E).trimStart()).trim();if(!(!f||f===r))try{let h=this.parse(f,i);if(!h||h.kind!=="event-handler")continue;let k=vr(h);if(n(k)<u)return {node:{...k,eventModifiers:{...k.eventModifiers,from:{type:"literal",value:p.value,dataType:"string"}}},input:f}}catch{}}return null}reclaimEventCompoundTail(e,r,i){let n=F.unconsumedSpans(e);if(n.length===0)return null;let a=ye[i];if(!a)return null;let u=e.roles,o=u.get("event"),s=o?.type==="literal"&&typeof o.value=="string"?o.value:null;if(!s)return null;let l=m=>m.replace(/\s+/g," ").trim(),c=U(r,i).tokens;for(let m of n)for(let d=1;d<c.length;d++)for(let p=d;p<c.length;p++){let y=l(r.slice(c[d].position.start,c[p].position.end));if(y.length>m.length)break;if(y!==m)continue;let E=c[d-1];if((a[E.value]??E.normalized)!==s)break;let f=l(r.slice(E.position.start,c[p].position.end)),h=a[f];if(!h)break;return u.set("event",{type:"literal",value:h,dataType:"string"}),{node:F.withoutSpanDiagnostics(e,m),input:r}}return null}reclaimResponseTypeTail(e,r,i){let n=F.unconsumedSpans(e);if(n.length===0)return null;let a=F.AS_MARKERS_BEFORE[i];if(!a)return null;let u=l=>l.replace(/\s+/g," ").trim(),o=F.droppedTokenCount(e),s=U(r,i).tokens;for(let l=0;l+1<s.length;l++){let c=s[l],m=s[l+1];if(!a.some(y=>c.value.toLowerCase()===y)||!F.RESPONSE_TYPE_WORDS.has(m.value.toLowerCase()))continue;let d=u(r.slice(c.position.start,m.position.end));if(!n.includes(d))continue;let p=(r.slice(0,c.position.start).trimEnd()+" "+r.slice(m.position.end).trimStart()).trim();if(!(!p||p===r))try{let y=this.parse(p,i);if(!y||y.kind!=="event-handler")continue;let E=vr(y);if(F.droppedTokenCount(E)>=o)continue;let v=F.findResponseTypeTarget(E);if(!v)continue;return v.roles.set("responseType",{type:"expression",raw:m.value}),{node:E,input:p}}catch{}}return null}static findResponseTypeTarget(e){let r=null,i=n=>{if(!n||typeof n!="object"||r)return;if(n.kind==="command"){let u=n;if(ee(u.action)?.roles.some(s=>s.role==="responseType"&&!s.required)&&!u.roles.has("responseType")){r=u;return}}let a=n;for(let u of ["body","statements","thenBranch","elseBranch","commands"]){let o=a[u];Array.isArray(o)&&o.forEach(s=>i(s));}};return i(e),r}reclaimCapturedDestinationTail(e,r,i){let n=F.unconsumedSpans(e);if(n.length===0)return null;let a=N(i)?.roleMarkers?.destination,u=new Set;if(a?.primary&&u.add(a.primary),a?.alternatives?.forEach(l=>u.add(l)),u.size===0)return null;let o=l=>l.replace(/\s+/g," ").trim(),s=U(r,i).tokens;for(let l=0;l+1<s.length;l++){let c=s[l],m=s[l+1],d=u.has(c.value)&&m.normalized==="me",p=c.normalized==="me"&&u.has(m.value);if(!d&&!p)continue;let y=o(r.slice(c.position.start,m.position.end));if(!n.includes(y))continue;let E=false,v=f=>{if(!f||typeof f!="object"||E)return;if(f.kind==="command"){let k=f.roles.get("destination");if(k?.type==="reference"&&k.value==="me"){E=true;return}}let h=f;for(let k of ["body","statements","thenBranch","elseBranch","commands"]){let D=h[k];Array.isArray(D)&&D.forEach(A=>v(A));}};if(v(e),!!E)return {node:F.withoutSpanDiagnostics(e,y),input:r}}return null}applyModifiers(e,r){return {...e,eventModifiers:{...e.eventModifiers,...r}}}extractOrConjunctionEvents(e,r){let i=[];for(;;){let n=e.mark(),a=e.peek();if(!a)break;let u=(a.normalized||a.value).toLowerCase();if(!F.OR_KEYWORDS.has(u)){e.reset(n);break}e.advance();let o=e.peek();if(!o){e.reset(n);break}let s=(o.normalized||o.value).toLowerCase();e.advance(),i.push({type:"literal",value:s});}return i}};Z.coverageMarkerSurfaces=new Map;Z.LEAKED_RENDER_MARKERS={hi:["\u0915\u0947","\u0930\u0942\u092A","\u092E\u0947\u0902"],tr:["olarak"],qu:["hina"]};Z.AS_MARKERS_BEFORE={en:["as"],es:["como"],fr:["comme"],pt:["como"],it:["come"],de:["als"],id:["sebagai"],ms:["sebagai","sbg"],sw:["kuwa","kama"],th:["\u0E40\u0E1B\u0E47\u0E19"],vi:["nh\u01B0"],tl:["bilang"],he:["\u05DB"],ar:["\u0643\u0640"],pl:["jako"],ru:["\u043A\u0430\u043A"],uk:["\u044F\u043A"],zh:["\u7684","\u4F5C\u4E3A","\u5F53\u4F5C"]};Z.AS_MARKERS_AFTER={ko:[["\uB85C"],["\uC73C\uB85C"]],qu:[["hina"]],tr:[["olarak"]],hi:[["\u0915\u0947","\u0930\u0942\u092A","\u092E\u0947\u0902"]]};Z.KNOWN_EVENTS=new Set(["click","dblclick","input","change","submit","keydown","keyup","keypress","mouseover","mouseout","mousedown","mouseup","focus","blur","load","scroll","resize","contextmenu"]);Z.RESPONSE_TYPE_WORDS=new Set(["json","text","html","xml","blob","arraybuffer","formdata","response"]);Z.SOV_EVENT_MARKERS={ja:new Set(["\u3067"]),ko:new Set,tr:new Set(["de","da","te","ta"]),bn:new Set(["\u098F"]),qu:new Set(["pi"]),hi:new Set(["\u092A\u0930"])};Z.SOV_EVENT_MARKER_PHRASES={ko:[["\uD560","\uB54C"],["\uD560\uB54C"]]};Z.SOV_SOURCE_MARKERS={ja:{markers:new Set(["\u304B\u3089"]),windowTokens:new Set(["\u30A6\u30A3\u30F3\u30C9\u30A6","\u30C9\u30AD\u30E5\u30E1\u30F3\u30C8","window","document"])},ko:{markers:new Set(["\uC5D0\uC11C"]),windowTokens:new Set(["\uCC3D","\uC708\uB3C4\uC6B0","\uBB38\uC11C","window","document"])},tr:{markers:new Set(["den","dan","ten","tan"]),windowTokens:new Set(["pencere","belge","window","document"])},bn:{markers:new Set(["\u09A5\u09C7\u0995\u09C7","\u09AE\u09A7\u09CD\u09AF\u09C7"]),windowTokens:new Set(["\u0989\u0987\u09A8\u09CD\u09A1\u09CB","\u09A1\u0995\u09C1\u09AE\u09C7\u09A8\u09CD\u099F","window","document"])},qu:{markers:new Set(["manta"]),windowTokens:new Set(["k_iri","ventana","window","document"])},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"])}};Z.CONDITION_COPULAS=new Set(["is","am","are","be","was","were","not","no"]);Z.CONDITION_COPULAS_SURFACE=new Set(["\u0647\u0648","\u0E40\u0E1B\u0E47\u0E19","\u0939\u0948"]);Z.CONDITION_PREDICATES=new Set(["empty","null","undefined"]);Z.CONDITION_OPERATORS=new Set(["matches","match","contains","exists","has","have","equals","includes"]);Z.STANDALONE_MODIFIERS={once:"once",debounced:"debounce",debounce:"debounce",throttled:"throttle",throttle:"throttle"};Z.OR_KEYWORDS=new Set(["or","\u0623\u0648","o","ou","oder","atau","atau","\u6216","\u307E\u305F\u306F","\uB610\uB294","veya","\u0985\u09A5\u09AC\u09BE","utaq","au","\u0430\u0431\u043E","\u0438\u043B\u0438","ho\u1EB7c","lub","\u05D0\u05D5","\u0E2B\u0E23\u0E37\u0E2D","o","\u092F\u093E","\u0985\u09A5\u09AC\u09BE"]);var Iu=Z,ju=new Iu;function $u(t,e){return ju.parse(t,e)}function Vu(t,e){try{let r=U(t,e),i=me(e);if(i.length===0)return {confidence:0,parseSuccess:!1,error:`No patterns available for language: ${e}`};let n=[...i].sort((l,c)=>c.priority-l.priority),a=n.filter(l=>l.command==="on"),u=ae.matchBest(r,a);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=n.filter(l=>l.command!=="on"),s=ae.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 Rt(t,e){try{let i=$u(t,e);if(i)return {node:i,confidence:i.metadata?.confidence??.8,error:void 0,tokensConsumed:U(t,e).tokens.length}}catch{}let r=Vu(t,e);return r.parseSuccess?{node:null,confidence:r.confidence,error:void 0,tokensConsumed:r.tokensConsumed}:{node:null,confidence:0,error:r.error}}function Ot(t,e){let r=e==="SOV"?"sovPosition":"svoPosition";return [...t].sort((i,n)=>{let a=i[r]??99,u=n[r]??99;return a-u})}function Wu(t,e){let r=t.markerOverride?.[e.code],i=e.roleMarkers[t.role];if(r!==void 0){let n=qu(t,e.code,r);return {primary:r,...n&&{alternatives:n},position:i?.position??"before",isOverride:true}}if(i&&i.primary){let n={primary:i.primary,position:i.position,isOverride:false};return i.alternatives&&(n.alternatives=i.alternatives),n}return null}function qu(t,e,r){let i=t.markerLegacy?.[e];if(!i?.length)return;let n=[...new Set(i)].filter(a=>a&&a!==r);return n.length?n:void 0}function pe(t,e,r){let i=t.markerLegacy?.[e]??[],n=t.methodCarrier?[]:t.markerVariants?.[e]??[],a=[...new Set([...i,...n])].filter(u=>u&&u!==r);return a.length?a:void 0}function ar(t,e){let r,i;if(t.markerOverride&&t.markerOverride[e.code]!==void 0)r=t.markerOverride[e.code],i=r?pe(t,e.code,r):void 0;else {let n=e.roleMarkers[t.role];if(n){r=n.primary;let a=pe(t,e.code,r)??[],u=[...new Set([...n.alternatives??[],...a])].filter(o=>o!==r);i=u.length?u:void 0;}}return {marker:r,alternatives:i}}function Ye(t,e,r){r.roles.find(n=>n.role==="scope"&&!n.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 Ku(t,e,r,i,n){let a=[];if(a.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)a.push({type:"literal",value:c});else {let c=i.alternatives?{type:"literal",value:i.primary,alternatives:i.alternatives}:{type:"literal",value:i.primary};a.push(c);}}let u=e.roleMarkers.destination;u&&a.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}]}),a.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};a.push(l);}let s=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};return a.push(s),a.push(...Ae(t,e.roleMarkers.source)),a.push(...br(t,e.roleMarkers.destination)),{id:`${t.action}-event-${e.code}-sov`,language:e.code,command:"on",priority:(n.basePriority??100)+50,template:{format:`{event} ${i.primary} {destination?} {patient} ${o?.primary||""} ${r.primary}`,tokens:a},extraction:{action:{value:t.action},event:{fromRole:"event"},patient:{fromRole:"patient"},...Ce(t),...be(t)}}}function Uu(t,e,r,i,n){let a=[];a.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};a.push(l);}if(a.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)a.push({type:"literal",value:c});else {let c=i.alternatives?{type:"literal",value:i.primary,alternatives:i.alternatives}:{type:"literal",value:i.primary};a.push(c);}}let o=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};a.push(o),a.push(...Ae(t,e.roleMarkers.source));let s=e.roleMarkers.destination;if(t.action==="swap"&&s){let l=t.roles.find(c=>c.role==="patient")?.markerOverride?.[e.code];if(l&&l!==s.primary){let c=s.alternatives??[];c.includes(l)||(s={...s,alternatives:[...c,l]});}}return a.push(...br(t,s)),{id:`${t.action}-event-${e.code}-sov-patient-first`,language:e.code,command:"on",priority:(n.basePriority??100)+45,template:{format:`{patient} ${u?.primary||""} {event} ${i.primary} ${r.primary}`,tokens:a},extraction:{action:{value:t.action},event:{fromRole:"event"},patient:{fromRole:"patient"},...Ce(t),...be(t)}}}function Hu(t,e,r,i,n){let a=[];a.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};a.push(l);}let o=e.roleMarkers.destination;if(o&&(a.push({type:"role",role:"destination",optional:false}),a.push(o.alternatives?{type:"literal",value:o.primary,alternatives:o.alternatives}:{type:"literal",value:o.primary})),a.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)a.push({type:"literal",value:c});else {let c=i.alternatives?{type:"literal",value:i.primary,alternatives:i.alternatives}:{type:"literal",value:i.primary};a.push(c);}}let s=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};return a.push(s),{id:`${t.action}-event-${e.code}-sov-patient-first-dest`,language:e.code,command:"on",priority:(n.basePriority??100)+40,template:{format:`{patient} ${u?.primary||""} {destination} ${o?.primary||""} {event} ${i.primary} ${r.primary}`,tokens:a},extraction:{action:{value:t.action},event:{fromRole:"event"},patient:{fromRole:"patient"},destination:{fromRole:"destination"}}}}function Gu(t,e,r,i,n){let a=[];a.push({type:"role",role:"event",optional:false});let u=i.alternatives?.filter(c=>!c.includes(" ")&&c.length>1)||[];u.length>0&&a.push({type:"literal",value:u[0],alternatives:u.slice(1)});let o=e.roleMarkers.destination;o&&a.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}]}),a.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};a.push(c);}let l=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};return a.push(l),a.push(...Ae(t,e.roleMarkers.source)),a.push(...br(t,e.roleMarkers.destination)),{id:`${t.action}-event-${e.code}-sov-compact`,language:e.code,command:"on",priority:(n.basePriority??100)+52,template:{format:`{event}${u[0]||""} {patient} ${r.primary}`,tokens:a},extraction:{action:{value:t.action},event:{fromRole:"event"},patient:{fromRole:"patient"},...Ce(t),...be(t)}}}function Yu(t,e,r,i,n){let a=[];if(a.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)a.push({type:"literal",value:s});else {let s=i.alternatives?{type:"literal",value:i.primary,alternatives:i.alternatives}:{type:"literal",value:i.primary};a.push(s);}}let u=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};return a.push(u),{id:`${t.action}-event-${e.code}-sov-simple`,language:e.code,command:"on",priority:(n.basePriority??100)+48,template:{format:`{event} ${i.primary} ${r.primary}`,tokens:a},extraction:{action:{value:t.action},event:{fromRole:"event"},patient:{default:{type:"reference",value:"me"}}}}}function Zu(t,e,r,i){let n=e.eventHandler?.temporalMarkers;if(!n||n.length===0)return null;let a=[];a.push({type:"role",role:"event",optional:false}),e.possessive?.marker&&a.push({type:"group",optional:true,tokens:[{type:"literal",value:e.possessive.marker}]}),a.push({type:"literal",value:n[0],alternatives:n.slice(1)}),a.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};a.push(s);}let o=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};return a.push(o),{id:`${t.action}-event-${e.code}-sov-temporal`,language:e.code,command:"on",priority:(i.basePriority??100)+49,template:{format:`{event} ${n[0]} {patient} ${r.primary}`,tokens:a},extraction:{action:{value:t.action},event:{fromRole:"event"},patient:{fromRole:"patient"}}}}function Xu(t,e,r,i,n){let a=[];if(a.push({type:"role",role:"event",optional:false}),i.position==="after"){let m=i.primary.split(/\s+/);if(m.length>1)for(let d of m)a.push({type:"literal",value:d});else {let d=i.alternatives?{type:"literal",value:i.primary,alternatives:i.alternatives}:{type:"literal",value:i.primary};a.push(d);}}let o=[...t.roles.filter(m=>m.required)].sort((m,d)=>{let p=m.sovPosition??999,y=d.sovPosition??999;return p-y});for(let m of o){a.push({type:"role",role:m.role,optional:false});let{marker:d,alternatives:p}=ar(m,e);if(d){let y=p?{type:"literal",value:d,alternatives:p}:{type:"literal",value:d};a.push(y);}}let s=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};a.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 Ye(a,c,t),{id:`${t.action}-event-${e.code}-sov-2role`,language:e.code,command:"on",priority:(n.basePriority??100)+55,template:{format:`{event} ${i.primary} ${l} ${r.primary}`,tokens:a},extraction:c}}function Ju(t,e,r,i,n){let a=[],o=[...t.roles.filter(c=>c.required)].sort((c,m)=>{let d=c.sovPosition??999,p=m.sovPosition??999;return d-p});for(let c of o){a.push({type:"role",role:c.role,optional:false});let{marker:m,alternatives:d}=ar(c,e);m&&a.push(d?{type:"literal",value:m,alternatives:d}:{type:"literal",value:m});}if(a.push(r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary}),a.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)a.push({type:"literal",value:m});else a.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 Ye(a,l,t),{id:`${t.action}-event-${e.code}-sov-2role-event-last`,language:e.code,command:"on",priority:(n.basePriority??100)+40,template:{format:`${s} ${r.primary} {event} ${i.primary}`,tokens:a},extraction:l}}function Qu(t,e,r,i,n){let a=[],o=[...t.roles.filter(v=>v.required)].sort((v,f)=>{let h=v.sovPosition??999,k=f.sovPosition??999;return h-k}),s=o[0];a.push({type:"role",role:s.role,optional:false});let{marker:l,alternatives:c}=ar(s,e);if(l){let v=c?{type:"literal",value:l,alternatives:c}:{type:"literal",value:l};a.push(v);}if(a.push({type:"role",role:"event",optional:false}),i.position==="after"){let v=i.primary.split(/\s+/);if(v.length>1)for(let f of v)a.push({type:"literal",value:f});else {let f=i.alternatives?{type:"literal",value:i.primary,alternatives:i.alternatives}:{type:"literal",value:i.primary};a.push(f);}}let m=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};a.push(m);let d=o[1];a.push({type:"role",role:d.role,optional:false});let{marker:p,alternatives:y}=ar(d,e);if(p){let v=y?{type:"literal",value:p,alternatives:y}:{type:"literal",value:p};a.push(v);}let E={action:{value:t.action},event:{fromRole:"event"},[s.role]:{fromRole:s.role},[d.role]:{fromRole:d.role}};return Ye(a,E,t),{id:`${t.action}-event-${e.code}-sov-2role-dest-first`,language:e.code,command:"on",priority:(n.basePriority??100)+48,template:{format:`{${s.role}} {event} ${i.primary} ${r.primary} {${d.role}}`,tokens:a},extraction:E}}function Pt(t,e,r){let i=pe(t,e.code,r.primary)??[],n=[...new Set([...r.alternatives??[],...i])].filter(a=>a!==r.primary);return n.length?n:void 0}function tt(t,e,r,i,n){let a=[];if(i.position==="before"){let s=i.alternatives?{type:"literal",value:i.primary,alternatives:i.alternatives}:{type:"literal",value:i.primary};a.push(s);}a.push({type:"role",role:"event",optional:false});let u=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};a.push(u),a.push({type:"role",role:"patient",optional:false});let o=e.roleMarkers.destination;return o&&a.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}]}),a.push(...Ae(t,e.roleMarkers.source)),{id:`${t.action}-event-${e.code}-vso`,language:e.code,command:"on",priority:(n.basePriority??100)+50,template:{format:`${i.primary} {event} ${r.primary} {patient} ${o?.primary||""} {destination?}`,tokens:a},extraction:{action:{value:t.action},event:{fromRole:"event"},patient:{fromRole:"patient"},...Ce(t),...be(t)}}}function eo(t,e,r,i,n){let a=[],u=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};a.push(u),a.push({type:"role",role:"patient",optional:false});let o=e.roleMarkers.destination;if(o&&a.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}]}),a.push(...Ae(t,e.roleMarkers.source)),i.position==="before"){let s=i.alternatives?{type:"literal",value:i.primary,alternatives:i.alternatives}:{type:"literal",value:i.primary};a.push(s);}if(a.push({type:"role",role:"event",optional:false}),t.action==="swap"){let s=t.roles.find(l=>l.role==="patient")?.markerOverride?.[e.code];s&&a.push({type:"group",optional:true,tokens:[{type:"literal",value:s},{type:"role",role:"destination",optional:false}]});}return {id:`${t.action}-event-${e.code}-vso-verb-first`,language:e.code,command:"on",priority:(n.basePriority??100)+45,template:{format:`${r.primary} {patient} ${o?.primary||""} {destination?} ${i.primary} {event}`,tokens:a},extraction:{action:{value:t.action},event:{fromRole:"event"},patient:{fromRole:"patient"},...Ce(t),...be(t)}}}function ro(t,e,r,i,n){let a=[],u=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};a.push(u);let s=[...t.roles.filter(m=>m.required)].sort((m,d)=>{let p=m.svoPosition??999,y=d.svoPosition??999;return p-y});for(let m of s){let d,p;if(m.markerOverride&&m.markerOverride[e.code]!==void 0)d=m.markerOverride[e.code],p=d?pe(m,e.code,d):void 0;else {let y=e.roleMarkers[m.role];y&&(d=y.primary,p=Pt(m,e,y));}if(d){let y=p?{type:"literal",value:d,alternatives:p}:{type:"literal",value:d};a.push(y);}a.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};a.push(m);}a.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 Ye(a,c,t),{id:`${t.action}-event-${e.code}-vso-verb-first-2role`,language:e.code,command:"on",priority:(n.basePriority??100)+48,template:{format:`${r.primary} ${l} ${i.primary} {event}`,tokens:a},extraction:c}}function it(t,e,r,i,n){let a=[];if(i.position==="before"){let m=i.alternatives?{type:"literal",value:i.primary,alternatives:i.alternatives}:{type:"literal",value:i.primary};a.push(m);}a.push({type:"role",role:"event",optional:false});let u=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};a.push(u);let s=[...t.roles.filter(m=>m.required)].sort((m,d)=>{let p=m.svoPosition??999,y=d.svoPosition??999;return p-y});for(let m of s){let d,p;if(m.markerOverride&&m.markerOverride[e.code]!==void 0)d=m.markerOverride[e.code],p=d?pe(m,e.code,d):void 0;else {let y=e.roleMarkers[m.role];y&&(d=y.primary,p=Pt(m,e,y));}if(d){let y=p?{type:"literal",value:d,alternatives:p}:{type:"literal",value:d};a.push(y);}a.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 Ye(a,c,t),{id:`${t.action}-event-${e.code}-vso-2role`,language:e.code,command:"on",priority:(n.basePriority??100)+55,template:{format:`${i.primary} {event} ${r.primary} ${l}`,tokens:a},extraction:c}}function to(t,e,r,i,n){let a=[],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};a.push(l);}if(u){let l=u.alternatives?{type:"literal",value:u.primary,alternatives:u.alternatives}:{type:"literal",value:u.primary};a.push(l);}a.push({type:"role",role:"event",optional:false});let o=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};a.push(o),a.push({type:"role",role:"patient",optional:false});let s=e.roleMarkers.destination;return s&&a.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}]}),a.push(...Ae(t,e.roleMarkers.source)),{id:`${t.action}-event-${e.code}-vso-negated`,language:e.code,command:"on",priority:(n.basePriority??100)+48,template:{format:`${i.primary} ${u?.primary||""} {event} ${r.primary} {patient} ${s?.primary||""} {destination?}`,tokens:a},extraction:{action:{value:t.action},event:{fromRole:"event"},patient:{fromRole:"patient"},...Ce(t),...be(t)}}}function io(t,e,r,i){let n=[];n.push({type:"literal",value:"and",alternatives:["then"]}),n.push({type:"role",role:"event",optional:false});let a=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};n.push(a),n.push({type:"role",role:"patient",optional:false});let u=e.roleMarkers.destination;return u&&n.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}]}),n.push(...Ae(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:n},extraction:{action:{value:t.action},event:{fromRole:"event"},patient:{fromRole:"patient"},...Ce(t),...be(t)}}}var Le={basePriority:100,generateSimpleVariants:true,generateAlternatives:true};function ir(t,e,r=Le){let i=`${t.action}-${e.code}-generated`,n=r.basePriority??100,a=e.keywords[t.action];if(!a)throw new Error(`No keyword translation for '${t.action}' in ${e.code}`);let u=oo(t,e,a),o=xr(t,e),s=po(t,e,a);return {id:i,language:e.code,command:t.action,priority:n,template:{format:s,tokens:u},extraction:o}}function no(t,e,r=Le){if(t.roles.filter(o=>!o.required).length===0)return null;let n=t.roles.filter(o=>o.required),a={...t,roles:n};return {...ir(a,e,r),id:`${t.action}-${e.code}-generated-simple`,priority:(r.basePriority??100)-5,extraction:xr(t,e)}}function nt(t,e,r=Le){if(e.wordOrder!=="SOV")return null;let i=t.roles.filter(o=>o.required);if(i.length!==1)return null;let n=e.keywords[t.action];if(!n)return null;let a=n.alternatives?{type:"literal",value:n.primary,alternatives:n.alternatives}:{type:"literal",value:n.primary},u=i.flatMap(o=>{let s=o.valuePrefixLiteral?.[e.code],l={type:"role",role:o.role,optional:false,expectedTypes:o.expectedTypes};return s?[{type:"literal",value:s},l]:[l]});return {id:`${t.action}-${e.code}-generated-verb-first`,language:e.code,command:t.action,priority:(r.basePriority??100)-20,template:{format:`${n.primary} <${i[0].role}>`,tokens:[a,...u]},extraction:xr(t,e)}}function ao(t,e,r=Le){let i=[];if(i.push(ir(t,e,r)),r.generateSimpleVariants){let n=no(t,e,r);n&&i.push(n);}for(let n of t.omitRoleVariants??[]){let a={...t,roles:t.roles.filter(o=>o.role!==n)},u=ir(a,e,r);i.push({...u,id:`${t.action}-${e.code}-generated-no-${n}`,priority:(r.basePriority??100)-8});}if(r.generateVerbFirstVariants!==false){let n=nt(t,e,r);n&&i.push(n);}for(let n of t.rolePrefixLiteralVariants??[]){let a=n.literal[e.code];if(!a)continue;let{rolePrefixLiteralVariants:u,...o}=t,s={...o,roles:t.roles.map(d=>d.role===n.role?{...d,valuePrefixLiteral:{[e.code]:a}}:d)},l=n.priorityDelta??5,c=n.methodCarrier?{[n.methodCarrier]:{value:a}}:{},m=ir(s,e,r);if(i.push({...m,id:`${t.action}-${e.code}-generated-${n.idSuffix}`,priority:(r.basePriority??100)+l,extraction:{...m.extraction,...c}}),r.generateVerbFirstVariants!==false){let d=nt(s,e,r);d&&i.push({...d,id:`${t.action}-${e.code}-generated-verb-first-${n.idSuffix}`,priority:(r.basePriority??100)-20+l,extraction:{...d.extraction,...c}});}}return i}function Nt(t,e=Le){let r=[],i=Ra();for(let n of i){if(!t.keywords[n.action])continue;let a=ao(n,t,e);if(r.push(...a),t.eventHandler?.eventMarker){let u=uo(n,t,e);r.push(...u);}}return r}function uo(t,e,r=Le){if(!e.eventHandler||!e.eventHandler.eventMarker)return [];let i=[],n=e.eventHandler.eventMarker,a=e.keywords[t.action];if(!a)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(Xu(t,e,a,n,r)),i.push(Qu(t,e,a,n,r)),i.push(Ju(t,e,a,n,r));else {i.push(Ku(t,e,a,n,r)),i.push(Uu(t,e,a,n,r));let s=e.roleMarkers.destination;s&&s.primary!==n.primary&&i.push(Hu(t,e,a,n,r));let l=n.primary.split(/\s+/),c=n.alternatives?.some(d=>!d.includes(" ")&&d.length>1);l.length>1&&c&&i.push(Gu(t,e,a,n,r)),i.push(Yu(t,e,a,n,r));let m=Zu(t,e,a,r);m&&i.push(m);}else e.wordOrder==="VSO"?o?(i.push(it(t,e,a,n,r)),i.push(ro(t,e,a,n,r))):(i.push(tt(t,e,a,n,r)),i.push(eo(t,e,a,n,r)),e.eventHandler?.negationMarker&&i.push(to(t,e,a,n,r)),e.tokenization?.prefixes&&i.push(io(t,e,a,r))):o?i.push(it(t,e,a,n,r)):i.push(tt(t,e,a,n,r));return i}function oo(t,e,r){let i=[],n=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary},a=lo(t,e);switch(e.wordOrder){case "SVO":i.push(n),i.push(...a);break;case "SOV":i.push(...a),i.push(n);break;case "VSO":i.push(n),i.push(...a);break;default:i.push(n),i.push(...a);}return so(i)}function so(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 n=[...i.alternatives??[],...r.alternatives??[]];n.length&&(e[e.length-1]={...i,alternatives:[...new Set(n)]});continue}e.push(r);}return e}function lo(t,e){let r=[],i=Ot(t.roles,e.wordOrder);for(let n of i){let a=co(n,e);n.required?r.push(...a):r.push({type:"group",optional:true,tokens:a});}return r}function co(t,e){let r=[],i=t.markerOverride?.[e.code],n=e.roleMarkers[t.role],a=t.renderOverride?.[e.code]==="",u={type:"role",role:t.role,optional:!t.required,expectedTypes:t.expectedTypes},o=t.valuePrefixLiteral?.[e.code],s=()=>{o&&r.push({type:"literal",value:o}),r.push(u);};if(i!==void 0){let l=i?i.split(/\s+/).filter(Boolean):[],c=n?.position??"before",m=t.markerOptional?.[e.code]===true,d=p=>{let y=l.length===1?pe(t,e.code,p)??[]:[],E={type:"literal",value:p,...y.length?{alternatives:y}:{},...a?{renderSuppress:true}:{}};r.push(m?{type:"group",optional:true,tokens:[E]}:E);};if(c==="before"){for(let p of l)d(p);s();}else {s();for(let p of l)d(p);}}else if(n){let l=()=>{let m=[...new Set([...n.alternatives??[],...pe(t,e.code,n.primary)??[]])].filter(d=>d!==n.primary);return {type:"literal",value:n.primary,...m.length?{alternatives:m}:{},...a?{renderSuppress:true}:{}}},c=m=>{r.push(e.markersOptional||t.markerOptional?.[e.code]?{type:"group",optional:true,tokens:[m]}:m);};n.position==="before"?(n.primary&&c(l()),s()):(s(),c(l()));}else s();return r}function mo(t,e){let r={};for(let i of t.roles){let n=i.markerOverride?.[e.code],a=e.roleMarkers[i.role];if(i.valuePrefixLiteral?.[e.code])r[i.role]={marker:i.valuePrefixLiteral[e.code]};else if(n!==void 0)if(!n)r[i.role]={};else {let o=!/\s/.test(n.trim())?pe(i,e.code,n)??[]:[];r[i.role]=o.length?{marker:n,markerAlternatives:o}:{marker:n};}else if(a&&a.primary){let u=[...new Set([...a.alternatives??[],...pe(i,e.code,a.primary)??[]])].filter(o=>o!==a.primary);r[i.role]=u.length?{marker:a.primary,markerAlternatives:u}:{marker:a.primary};}else r[i.role]={};}return r}function xr(t,e){let r=mo(t,e),i={};for(let n of t.roles){let a=r[n.role]||{};!n.required&&n.default?i[n.role]={...a,default:n.default}:i[n.role]=a;}return i}function po(t,e,r){let i=[],a=Ot(t.roles,e.wordOrder).map(u=>{let o=Wu(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,...a);break;case "SOV":i.push(...a,r.primary);break;default:i.push(r.primary,...a);}return i.join(" ")}var fo=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),n=Date.now();for(;this.cache.size>=this.config.maxSize;)this.evictLRU();this.cache.set(i,{result:r,createdAt:n,lastAccessed:n});}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 fo;function yo(t){return /[а-яА-ЯёЁ]/.test(t)}function ho(t){for(let e of t)if(yo(e))return true;return false}var _t=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"]]),Lt=class{constructor(){this.language="ru";}isNormalizable(t){return t.length<3?false:ho(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 X(t);let r=this.tryImperativeLookup(e);if(r)return r;let i=this.tryPastTenseNormalization(e);if(i)return i;let n=this.tryPresentTenseNormalization(e);if(n)return n;let a=this.tryGenericImperativeNormalization(e);return a||X(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 X(t);let i=this.normalizeNonReflexive(r);if(i.confidence<1){let n=i.stem.endsWith("\u0442\u044C")?i.stem.slice(0,-2)+"\u0442\u044C\u0441\u044F":i.stem+"\u0441\u044F";return B(n,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 X(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 n=this.tryGenericImperativeNormalization(t);return n||X(t)}tryImperativeLookup(t){return _t.has(t)?B(_t.get(t),.95,{removedSuffixes:["imperative"],conjugationType:"imperative"}):null}tryGenericImperativeNormalization(t){return t.endsWith("\u0439\u0442\u0435")&&t.length>5?B(t.slice(0,-3)+"\u0442\u044C",.8,{removedSuffixes:["\u0439\u0442\u0435"],conjugationType:"imperative"}):t.endsWith("\u0438\u0442\u0435")&&t.length>5?B(t.slice(0,-3)+"\u0438\u0442\u044C",.8,{removedSuffixes:["\u0438\u0442\u0435"],conjugationType:"imperative"}):t.endsWith("\u0439")&&t.length>3?B(t.slice(0,-1)+"\u0442\u044C",.75,{removedSuffixes:["\u0439"],conjugationType:"imperative"}):t.endsWith("\u0438")&&t.length>3?B(t+"\u0442\u044C",.7,{removedSuffixes:["\u0438\u2192\u0438\u0442\u044C"],conjugationType:"imperative"}):null}tryPastTenseNormalization(t){return t.endsWith("\u0430\u043B\u0430")&&t.length>4?B(t.slice(0,-3)+"\u0430\u0442\u044C",.85,{removedSuffixes:["\u0430\u043B\u0430"],conjugationType:"past"}):t.endsWith("\u0438\u043B\u0430")&&t.length>4?B(t.slice(0,-3)+"\u0438\u0442\u044C",.85,{removedSuffixes:["\u0438\u043B\u0430"],conjugationType:"past"}):t.endsWith("\u0435\u043B\u043E")&&t.length>4?B(t.slice(0,-3)+"\u0435\u0442\u044C",.82,{removedSuffixes:["\u0435\u043B\u043E"],conjugationType:"past"}):t.endsWith("\u0430\u0431\u043E")&&t.length>4?B(t.slice(0,-3)+"\u0430\u0442\u044C",.82,{removedSuffixes:["\u0430\u0431\u043E"],conjugationType:"past"}):t.endsWith("\u0430\u043B\u0438")&&t.length>4?B(t.slice(0,-3)+"\u0430\u0442\u044C",.85,{removedSuffixes:["\u0430\u043B\u0438"],conjugationType:"past"}):t.endsWith("\u0438\u043B\u0438")&&t.length>4?B(t.slice(0,-3)+"\u0438\u0442\u044C",.85,{removedSuffixes:["\u0438\u043B\u0438"],conjugationType:"past"}):t.endsWith("\u0430\u043B")&&t.length>3?B(t.slice(0,-2)+"\u0430\u0442\u044C",.82,{removedSuffixes:["\u0430\u043B"],conjugationType:"past"}):t.endsWith("\u0438\u043B")&&t.length>3?B(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?B(t.slice(0,-3)+"\u0438\u0442\u044C",.8,{removedSuffixes:["\u0438\u0448\u044C"],conjugationType:"present"}):t.endsWith("\u0438\u0442")&&t.length>3?B(t.slice(0,-2)+"\u0438\u0442\u044C",.78,{removedSuffixes:["\u0438\u0442"],conjugationType:"present"}):t.endsWith("\u0438\u043C")&&t.length>3?B(t.slice(0,-2)+"\u0438\u0442\u044C",.78,{removedSuffixes:["\u0438\u043C"],conjugationType:"present"}):t.endsWith("\u044F\u0442")&&t.length>3?B(t.slice(0,-2)+"\u0438\u0442\u044C",.78,{removedSuffixes:["\u044F\u0442"],conjugationType:"present"}):t.endsWith("\u0435\u0448\u044C")&&t.length>4?B(t.slice(0,-3)+"\u0430\u0442\u044C",.75,{removedSuffixes:["\u0435\u0448\u044C"],conjugationType:"present"}):t.endsWith("\u0435\u0442")&&t.length>3?B(t.slice(0,-2)+"\u0430\u0442\u044C",.72,{removedSuffixes:["\u0435\u0442"],conjugationType:"present"}):t.endsWith("\u0435\u043C")&&t.length>3?B(t.slice(0,-2)+"\u0430\u0442\u044C",.72,{removedSuffixes:["\u0435\u043C"],conjugationType:"present"}):t.endsWith("\u044E\u0442")&&t.length>3?B(t.slice(0,-2)+"\u0430\u0442\u044C",.75,{removedSuffixes:["\u044E\u0442"],conjugationType:"present"}):t.endsWith("\u0443\u0442")&&t.length>3?B(t.slice(0,-2)+"\u0430\u0442\u044C",.72,{removedSuffixes:["\u0443\u0442"],conjugationType:"present"}):null}},It={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",document:"\u0434\u043E\u043A\u0443\u043C\u0435\u043D\u0442",window:"\u043E\u043A\u043D\u043E",detail:"\u0434\u0435\u0442\u0430\u043B\u0438"},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"},exists:{primary:"\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442",normalized:"exists"},is:{primary:"\u0435\u0441\u0442\u044C",normalized:"is"},no:{primary:"\u043D\u0435\u0442",normalized:"no"},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"]}},vo=["===","!==","->","==","!=","<=",">=","&&","||","**","+=","-=","*=","/=","+","-","*","/","=",">","<","!","&","|","%","^","~"],Eo=class{constructor(t=vo){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}},go="()[]{},:;",zo=class{constructor(t=go){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 Br(t,e){let r=e;for(;r<t.length&&t[r]===":";){let i=t.slice(r).match(/^::?[a-zA-Z][a-zA-Z0-9-]*/);if(!i)break;let n=r+i[0].length;if(t[n]==="("){let a=0,u=n;for(;u<t.length;){if(t[u]==="(")a++;else if(t[u]===")"&&(a--,a===0)){u++;break}u++;}if(a!==0)break;n=u;}r=n;}return r}function Mt(t,e){let r=t[e];if(r==="#"){let i=t.slice(e).match(/^#[a-zA-Z_][\w-]*/);if(!i)return null;let n=Br(t,e+i[0].length);return t.slice(e,n)}if(r==="."){let i=t.slice(e).match(/^\.\{[a-zA-Z_$][\w$]*\}/);if(i)return i[0];let n=t.slice(e).match(/^\.[a-zA-Z_][\w-]*/);if(!n)return null;let a=Br(t,e+n[0].length);return t.slice(e,a)}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,n=e;for(;n<t.length;){if(t[n]==="["&&i++,t[n]==="]"&&(i--,i===0)){let a=Br(t,n+1);return t.slice(e,a)}n++;}return null}if(r==="<"){let i=t.slice(e).match(/^<(?=[\w.#[])[\w-]*(?:[#.][\w-]+|\[[^\]]+\]|::?[a-zA-Z][a-zA-Z0-9-]*(?:\([^)]*\))?)*\s*\/>/);return i?i[0]:null}return null}var ko=class{constructor(){this.name="css-selector";}canExtract(t,e){let r=t[e];return r==="#"||r==="."||r==="["||r==="<"?true:r==="@"||r==="*"?Mt(t,e)!==null:false}extract(t,e){let r=Mt(t,e);return r?{value:r,length:r.length,metadata:{type:"css-selector"}}:null}},wo=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],n=i.slice(1).split("(")[0],a=r[1];return {value:i,length:i.length,metadata:{modifierName:n,value:a?n==="queue"?a:parseInt(a,10):void 0}}}},Co=["http://","https://","//","./","../","/"];function bo(t,e){let r=1;for(let i=e;i<t.length;i++){let n=t[i];if(n==="{")r++;else if(n==="}"&&--r===0)return i+1}return -1}function Ao(t,e){let r=t.slice(e),i=Co.find(a=>r.startsWith(a));if(!i)return null;let n=i.length;for(;n<r.length;){let a=r[n];if(a==="$"&&r[n+1]==="{"){let u=bo(r,n+2);if(u!==-1){n=u;continue}}if(/\s/.test(a))break;n++;}return r.slice(0,n)}var Do=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=Ao(t,e);return r?{value:r,length:r.length,metadata:{type:"url"}}:null}},So=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 xo(t){return {isLetter:i=>t.test(i),isIdentifierChar:i=>/[0-9]/.test(i)||t.test(i)}}var Bo=class{constructor(t,e,r){this.name=t;let i=xo(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 n=i.toLowerCase(),a=this.prepositions.has(n),u=this.context.lookupKeyword(n),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:a}}}},Fo=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 To(){return [new Bo("russian-keyword",/[a-zA-Zа-яА-ЯёЁ]/,Fo)]}function Ro(t){let e=t.charCodeAt(0);return e>=65&&e<=90||e>=97&&e<=122||e===95||e===36}function Oo(t){let e=t.charCodeAt(0);return e>=48&&e<=57||e>=65&&e<=90||e>=97&&e<=122||e===95||e===36}var Po=class{constructor(){this.name="ascii-identifier";}setContext(t){this.context=t;}canExtract(t,e){return Ro(t[e])}extract(t,e){if(!this.context)throw new Error("AsciiIdentifierExtractor: context not set");let r=e,i="",n=e;for(;n<t.length&&Oo(t[n]);)i+=t[n],n++;if(!i)return null;let a=this.context.lookupKeyword(i),u=a&&a.normalized!==a.native?a.normalized:void 0;return {value:i,length:n-r,metadata:{normalized:u}}}};function No(){return [new Do,new wo,new So,new ko]}var _o=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"]),Mo=[{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:"\u043D\u0438\u0447\u0435\u0433\u043E",normalized:"null"},{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"},{native:"\u0432\u043A\u043B\u044E\u0447\u0438\u0442\u0435\u043B\u044C\u043D\u043E",normalized:"inclusive"},{native:"\u0438\u0441\u043A\u043B\u044E\u0447\u0438\u0442\u0435\u043B\u044C\u043D\u043E",normalized:"exclusive"},{native:"\u0441\u0438\u043C\u0432\u043E\u043B\u044B",normalized:"characters"}],Lo=class extends Te{constructor(){super(),this.language="ru",this.direction="ltr",this.initializeKeywordsFromProfile(It,Mo),this.setNormalizer(new Lt),this.registerExtractors([...No(),...To(),new Be,new Fe,new Po,new Eo,new zo]);}classifyToken(t){let e=t.toLowerCase();return _o.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"}},Io=new Lo;Me("ru",Io,It);var Vt={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",document:"dokument",window:"okno",detail:"szczeg\xF3\u0142"},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"},matches:{primary:"pasuje",normalized:"matches"},no:{primary:"brak",normalized:"no"},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"]}},jt=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"]]),Wt=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 X(e);let r=this.tryImperativeNormalization(e);if(r)return r;let i=this.tryPastTenseNormalization(e);if(i)return i;let n=this.tryPresentTenseNormalization(e);return n||X(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 jt.has(t)?B(jt.get(t),.95,{removedSuffixes:["imperative"],conjugationType:"imperative"}):t.endsWith("aj")?B(t.slice(0,-2)+"a\u0107",.8,{removedSuffixes:["aj"],conjugationType:"imperative"}):t.endsWith("uj")?B(t.slice(0,-2)+"owa\u0107",.8,{removedSuffixes:["uj"],conjugationType:"imperative"}):t.endsWith("ij")?B(t.slice(0,-2)+"i\u0107",.75,{removedSuffixes:["ij"],conjugationType:"imperative"}):null}tryPresentTenseNormalization(t){return t.endsWith("uj\u0119")||t.endsWith("uje")?B(t.slice(0,-3)+"owa\u0107",.85,{removedSuffixes:["uj\u0119"],conjugationType:"present"}):t.endsWith("am")&&t.length>3?B(t.slice(0,-2)+"a\u0107",.8,{removedSuffixes:["am"],conjugationType:"present"}):t.endsWith("em")&&t.length>3?B(t.slice(0,-2)+"e\u0107",.75,{removedSuffixes:["em"],conjugationType:"present"}):t.endsWith("\u0119")&&t.length>2?B(t.slice(0,-1)+"a\u0107",.7,{removedSuffixes:["\u0119"],conjugationType:"present"}):null}tryPastTenseNormalization(t){if(t.endsWith("a\u0142em")||t.endsWith("a\u0142am"))return B(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 B(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 B(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 B(t.slice(0,-e)+"i\u0107",.8,{removedSuffixes:[t.slice(-e)],conjugationType:"past"})}return null}},jo=["===","!==","->","==","!=","<=",">=","&&","||","**","+=","-=","*=","/=","+","-","*","/","=",">","<","!","&","|","%","^","~"],$o=class{constructor(t=jo){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}},Vo="()[]{},:;",Wo=class{constructor(t=Vo){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 Fr(t,e){let r=e;for(;r<t.length&&t[r]===":";){let i=t.slice(r).match(/^::?[a-zA-Z][a-zA-Z0-9-]*/);if(!i)break;let n=r+i[0].length;if(t[n]==="("){let a=0,u=n;for(;u<t.length;){if(t[u]==="(")a++;else if(t[u]===")"&&(a--,a===0)){u++;break}u++;}if(a!==0)break;n=u;}r=n;}return r}function $t(t,e){let r=t[e];if(r==="#"){let i=t.slice(e).match(/^#[a-zA-Z_][\w-]*/);if(!i)return null;let n=Fr(t,e+i[0].length);return t.slice(e,n)}if(r==="."){let i=t.slice(e).match(/^\.\{[a-zA-Z_$][\w$]*\}/);if(i)return i[0];let n=t.slice(e).match(/^\.[a-zA-Z_][\w-]*/);if(!n)return null;let a=Fr(t,e+n[0].length);return t.slice(e,a)}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,n=e;for(;n<t.length;){if(t[n]==="["&&i++,t[n]==="]"&&(i--,i===0)){let a=Fr(t,n+1);return t.slice(e,a)}n++;}return null}if(r==="<"){let i=t.slice(e).match(/^<(?=[\w.#[])[\w-]*(?:[#.][\w-]+|\[[^\]]+\]|::?[a-zA-Z][a-zA-Z0-9-]*(?:\([^)]*\))?)*\s*\/>/);return i?i[0]:null}return null}var qo=class{constructor(){this.name="css-selector";}canExtract(t,e){let r=t[e];return r==="#"||r==="."||r==="["||r==="<"?true:r==="@"||r==="*"?$t(t,e)!==null:false}extract(t,e){let r=$t(t,e);return r?{value:r,length:r.length,metadata:{type:"css-selector"}}:null}},Ko=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],n=i.slice(1).split("(")[0],a=r[1];return {value:i,length:i.length,metadata:{modifierName:n,value:a?n==="queue"?a:parseInt(a,10):void 0}}}},Uo=["http://","https://","//","./","../","/"];function Ho(t,e){let r=1;for(let i=e;i<t.length;i++){let n=t[i];if(n==="{")r++;else if(n==="}"&&--r===0)return i+1}return -1}function Go(t,e){let r=t.slice(e),i=Uo.find(a=>r.startsWith(a));if(!i)return null;let n=i.length;for(;n<r.length;){let a=r[n];if(a==="$"&&r[n+1]==="{"){let u=Ho(r,n+2);if(u!==-1){n=u;continue}}if(/\s/.test(a))break;n++;}return r.slice(0,n)}var Yo=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=Go(t,e);return r?{value:r,length:r.length,metadata:{type:"url"}}:null}},Zo=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"}}}},Xo=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 Jo(){let t=/[a-zA-ZąęćńóśźżłĄĘĆŃÓŚŹŻŁ]/;return {isLetter:i=>t.test(i),isIdentifierChar:i=>/[0-9]/.test(i)||t.test(i)}}var{isLetter:Qo,isIdentifierChar:es}=Jo(),rs=class{constructor(){this.name="polish-keyword";}setContext(t){this.context=t;}canExtract(t,e){return Qo(t[e])}extract(t,e){if(!this.context)throw new Error("PolishKeywordExtractor: context not set");let r=e,i="";for(;r<t.length&&es(t[r]);)i+=t[r++];if(!i)return null;let n=i.toLowerCase(),a=Xo.has(n),u=this.context.lookupKeyword(n),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:a}}}};function ts(){return [new rs]}function is(){return [new Yo,new Ko,new Zo,new qo]}var ns=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"]),as=[{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"},{native:"w\u0142\u0105cznie",normalized:"inclusive"},{native:"wy\u0142\u0105cznie",normalized:"exclusive"},{native:"znaki",normalized:"characters"},{native:"losowy",normalized:"random"}],us=class extends Te{constructor(){super(),this.language="pl",this.direction="ltr",this.initializeKeywordsFromProfile(Vt,as),this.setNormalizer(new Wt),this.registerExtractors(is()),this.registerExtractor(new Be),this.registerExtractor(new Fe),this.registerExtractors(ts()),this.registerExtractor(new $o),this.registerExtractor(new Wo);}classifyToken(t){let e=t.toLowerCase();return ns.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"}},os=new us;Me("pl",os,Vt);function ss(t){return /[а-яА-ЯіІїЇєЄґҐьЬ']/.test(t)}var qt=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"]]),Ut=class{constructor(){this.language="uk";}isNormalizable(t){return t.length<3?false:ss(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 X(t);let r=this.tryImperativeLookup(e);if(r)return r;let i=this.tryPastTenseNormalization(e);if(i)return i;let n=this.tryPresentTenseNormalization(e);if(n)return n;let a=this.tryGenericImperativeNormalization(e);return a||X(t)}tryReflexiveNormalization(t){let e=t.slice(0,-2);if(t.endsWith("\u0442\u0438\u0441\u044F")||t.endsWith("\u0447\u0438\u0441\u044F"))return X(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 B(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 X(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 n=this.tryGenericImperativeNormalization(t);return n||X(t)}tryImperativeLookup(t){return qt.has(t)?B(qt.get(t),.95,{removedSuffixes:["imperative"],conjugationType:"imperative"}):null}tryGenericImperativeNormalization(t){return t.endsWith("\u0439\u0442\u0435")&&t.length>5?B(t.slice(0,-3)+"\u0442\u0438",.8,{removedSuffixes:["\u0439\u0442\u0435"],conjugationType:"imperative"}):t.endsWith("\u0456\u0442\u044C")&&t.length>5?B(t.slice(0,-3)+"\u0438\u0442\u0438",.8,{removedSuffixes:["\u0456\u0442\u044C"],conjugationType:"imperative"}):t.endsWith("\u0439")&&t.length>3?B(t.slice(0,-1)+"\u0442\u0438",.75,{removedSuffixes:["\u0439"],conjugationType:"imperative"}):t.endsWith("\u0438")&&t.length>3?B(t+"\u0442\u0438",.7,{removedSuffixes:["\u0438\u2192\u0438\u0442\u0438"],conjugationType:"imperative"}):null}tryPastTenseNormalization(t){return t.endsWith("\u0430\u043B\u0430")&&t.length>4?B(t.slice(0,-3)+"\u0430\u0442\u0438",.85,{removedSuffixes:["\u0430\u043B\u0430"],conjugationType:"past"}):t.endsWith("\u0438\u043B\u0430")&&t.length>4?B(t.slice(0,-3)+"\u0438\u0442\u0438",.85,{removedSuffixes:["\u0438\u043B\u0430"],conjugationType:"past"}):t.endsWith("\u0430\u043B\u0438")&&t.length>4?B(t.slice(0,-3)+"\u0430\u0442\u0438",.85,{removedSuffixes:["\u0430\u043B\u0438"],conjugationType:"past"}):t.endsWith("\u0438\u043B\u0438")&&t.length>4?B(t.slice(0,-3)+"\u0438\u0442\u0438",.85,{removedSuffixes:["\u0438\u043B\u0438"],conjugationType:"past"}):t.endsWith("\u0430\u0432")&&t.length>3?B(t.slice(0,-2)+"\u0430\u0442\u0438",.82,{removedSuffixes:["\u0430\u0432"],conjugationType:"past"}):t.endsWith("\u0438\u0432")&&t.length>3?B(t.slice(0,-2)+"\u0438\u0442\u0438",.82,{removedSuffixes:["\u0438\u0432"],conjugationType:"past"}):null}tryPresentTenseNormalization(t){return t.endsWith("\u0438\u0448")&&t.length>3?B(t.slice(0,-2)+"\u0438\u0442\u0438",.8,{removedSuffixes:["\u0438\u0448"],conjugationType:"present"}):t.endsWith("\u0438\u0442\u044C")&&t.length>4?B(t.slice(0,-3)+"\u0438\u0442\u0438",.78,{removedSuffixes:["\u0438\u0442\u044C"],conjugationType:"present"}):t.endsWith("\u0438\u043C\u043E")&&t.length>4?B(t.slice(0,-3)+"\u0438\u0442\u0438",.8,{removedSuffixes:["\u0438\u043C\u043E"],conjugationType:"present"}):t.endsWith("\u044F\u0442\u044C")&&t.length>4?B(t.slice(0,-3)+"\u0438\u0442\u0438",.78,{removedSuffixes:["\u044F\u0442\u044C"],conjugationType:"present"}):t.endsWith("\u0454\u0448")&&t.length>3?B(t.slice(0,-2)+"\u0430\u0442\u0438",.78,{removedSuffixes:["\u0454\u0448"],conjugationType:"present"}):t.endsWith("\u0435\u0448")&&t.length>3?B(t.slice(0,-2)+"\u0430\u0442\u0438",.75,{removedSuffixes:["\u0435\u0448"],conjugationType:"present"}):t.endsWith("\u0454")&&t.length>2?B(t.slice(0,-1)+"\u0430\u0442\u0438",.72,{removedSuffixes:["\u0454"],conjugationType:"present"}):t.endsWith("\u0454\u043C\u043E")&&t.length>4?B(t.slice(0,-3)+"\u0430\u0442\u0438",.8,{removedSuffixes:["\u0454\u043C\u043E"],conjugationType:"present"}):t.endsWith("\u044E\u0442\u044C")&&t.length>4?B(t.slice(0,-3)+"\u0430\u0442\u0438",.78,{removedSuffixes:["\u044E\u0442\u044C"],conjugationType:"present"}):t.endsWith("\u0443\u0442\u044C")&&t.length>4?B(t.slice(0,-3)+"\u0430\u0442\u0438",.75,{removedSuffixes:["\u0443\u0442\u044C"],conjugationType:"present"}):null}},Ht={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",document:"\u0434\u043E\u043A\u0443\u043C\u0435\u043D\u0442",window:"\u0432\u0456\u043A\u043D\u043E",detail:"\u0434\u0435\u0442\u0430\u043B\u0456"},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"},exists:{primary:"\u0456\u0441\u043D\u0443\u0454",normalized:"exists"},is:{primary:"\u0454",normalized:"is"},no:{primary:"\u043D\u0456",normalized:"no"},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"]}},ls=["===","!==","->","==","!=","<=",">=","&&","||","**","+=","-=","*=","/=","+","-","*","/","=",">","<","!","&","|","%","^","~"],cs=class{constructor(t=ls){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}},ms="()[]{},:;",ds=class{constructor(t=ms){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 Tr(t,e){let r=e;for(;r<t.length&&t[r]===":";){let i=t.slice(r).match(/^::?[a-zA-Z][a-zA-Z0-9-]*/);if(!i)break;let n=r+i[0].length;if(t[n]==="("){let a=0,u=n;for(;u<t.length;){if(t[u]==="(")a++;else if(t[u]===")"&&(a--,a===0)){u++;break}u++;}if(a!==0)break;n=u;}r=n;}return r}function Kt(t,e){let r=t[e];if(r==="#"){let i=t.slice(e).match(/^#[a-zA-Z_][\w-]*/);if(!i)return null;let n=Tr(t,e+i[0].length);return t.slice(e,n)}if(r==="."){let i=t.slice(e).match(/^\.\{[a-zA-Z_$][\w$]*\}/);if(i)return i[0];let n=t.slice(e).match(/^\.[a-zA-Z_][\w-]*/);if(!n)return null;let a=Tr(t,e+n[0].length);return t.slice(e,a)}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,n=e;for(;n<t.length;){if(t[n]==="["&&i++,t[n]==="]"&&(i--,i===0)){let a=Tr(t,n+1);return t.slice(e,a)}n++;}return null}if(r==="<"){let i=t.slice(e).match(/^<(?=[\w.#[])[\w-]*(?:[#.][\w-]+|\[[^\]]+\]|::?[a-zA-Z][a-zA-Z0-9-]*(?:\([^)]*\))?)*\s*\/>/);return i?i[0]:null}return null}var ps=class{constructor(){this.name="css-selector";}canExtract(t,e){let r=t[e];return r==="#"||r==="."||r==="["||r==="<"?true:r==="@"||r==="*"?Kt(t,e)!==null:false}extract(t,e){let r=Kt(t,e);return r?{value:r,length:r.length,metadata:{type:"css-selector"}}:null}},fs=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],n=i.slice(1).split("(")[0],a=r[1];return {value:i,length:i.length,metadata:{modifierName:n,value:a?n==="queue"?a:parseInt(a,10):void 0}}}},ys=["http://","https://","//","./","../","/"];function hs(t,e){let r=1;for(let i=e;i<t.length;i++){let n=t[i];if(n==="{")r++;else if(n==="}"&&--r===0)return i+1}return -1}function vs(t,e){let r=t.slice(e),i=ys.find(a=>r.startsWith(a));if(!i)return null;let n=i.length;for(;n<r.length;){let a=r[n];if(a==="$"&&r[n+1]==="{"){let u=hs(r,n+2);if(u!==-1){n=u;continue}}if(/\s/.test(a))break;n++;}return r.slice(0,n)}var Es=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=vs(t,e);return r?{value:r,length:r.length,metadata:{type:"url"}}:null}},gs=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 zs(t){return {isLetter:i=>t.test(i),isIdentifierChar:i=>/[0-9]/.test(i)||t.test(i)}}var ks=class{constructor(t,e,r){this.name=t;let i=zs(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 n=i.toLowerCase(),a=this.prepositions.has(n),u=this.context.lookupKeyword(n),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:a}}}},ws=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 Cs(){return [new ks("ukrainian-keyword",/[a-zA-Zа-яА-ЯіІїЇєЄґҐьЬ']/,ws)]}function bs(t){let e=t.charCodeAt(0);return e>=65&&e<=90||e>=97&&e<=122||e===95||e===36}function As(t){let e=t.charCodeAt(0);return e>=48&&e<=57||e>=65&&e<=90||e>=97&&e<=122||e===95||e===36}var Ds=class{constructor(){this.name="ascii-identifier";}setContext(t){this.context=t;}canExtract(t,e){return bs(t[e])}extract(t,e){if(!this.context)throw new Error("AsciiIdentifierExtractor: context not set");let r=e,i="",n=e;for(;n<t.length&&As(t[n]);)i+=t[n],n++;if(!i)return null;let a=this.context.lookupKeyword(i),u=a&&a.normalized!==a.native?a.normalized:void 0;return {value:i,length:n-r,metadata:{normalized:u}}}};function Ss(){return [new Es,new fs,new gs,new ps]}var xs=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"]),Bs=[{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:"\u043D\u0456\u0447\u043E\u0433\u043E",normalized:"null"},{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"},{native:"\u0432\u043A\u043B\u044E\u0447\u043D\u043E",normalized:"inclusive"},{native:"\u0432\u0438\u043A\u043B\u044E\u0447\u043D\u043E",normalized:"exclusive"},{native:"\u0441\u0438\u043C\u0432\u043E\u043B\u0438",normalized:"characters"}],Fs=class extends Te{constructor(){super(),this.language="uk",this.direction="ltr",this.initializeKeywordsFromProfile(Ht,Bs),this.setNormalizer(new Ut),this.registerExtractors([...Ss(),...Cs(),new Be,new Fe,new Ds,new cs,new ds]);}classifyToken(t){let e=t.toLowerCase();return xs.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"}},Ts=new Fs;Me("uk",Ts,Ht);function lr(t){let e=t.getAttribute("data-lang");if(e)return Rr(e);let r=t.getAttribute("data-hyperscript-lang")??t.closest?.("[data-hyperscript-lang]")?.getAttribute("data-hyperscript-lang");if(r)return Rr(r);let i=typeof document<"u"?document.documentElement?.lang:null;return i&&i!=="en"?Rr(i):null}function Rr(t){return t.split("-")[0].toLowerCase()}var Gt={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",""],["style","with"],["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 cr(t){switch(t.kind){case "event-handler":return Rs(t);case "compound":return Os(t);default:return Ps(t)}}function Rs(t){let e=["on"],r=t.roles.get("event");r&&e.push(Ze(r));let i=t.roles.get("source");if(i&&e.push("from",Ze(i)),t.body&&t.body.length>0){let n=t.body.map(cr);e.push(n.join(" then "));}return e.join(" ")}function Os(t){let e=t.chainType==="async"?"async":t.chainType;return t.statements.map(cr).join(` ${e} `)}function Ps(t){let e=Gt[t.action];if(e){let i=[t.action];for(let[n,a]of e){let u=t.roles.get(n);u&&((n==="destination"||n==="source")&&u.type==="reference"&&u.value==="me"||(a&&i.push(a),i.push(Ze(u))));}return i.join(" ")}let r=[t.action];for(let[,i]of t.roles)r.push(Ze(i));return r.join(" ")}function Ze(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 Ns(t);case "expression":return t.raw;case "flag":return t.enabled?`+${t.name}`:`~${t.name}`}}function Ns(t){let e=Ze(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 Zt=.5,_s={confidenceThreshold:Zt,strategy:"semantic",fallbackToOriginal:true};function Ms(t,e){return typeof t=="number"?t:t[e]??t["*"]??Zt}function Or(t,e,r={}){let i={..._s,...r},n=Yt(t,e,i);if(n!==null)return n;let a=Is(t);if(a){let u=Yt(a.commands,e,i);if(u!==null)return a.prefix+u}return t}function Yt(t,e,r){if(r.strategy==="semantic"||r.strategy==="auto"){let i=Ms(r.confidenceThreshold,e),n=Xt(t,e,i);if(n!==null)return n}if((r.strategy==="auto"||r.strategy==="i18n")&&r.i18nToEnglish){let i=js(t,e,r.i18nToEnglish);if(i!==null)return i}return null}var Ls=/^(on\s+(?:every\s+)?[\w-]+(?:\[.*?\])?(?:\.[\w-]+(?:\([^)]*\))?)*(?:\s+from\s+\S+)?(?:\s+queue\s+\w+)?\s+)/;function Is(t){let e=t.match(Ls);if(!e)return null;let r=e[1],i=t.slice(r.length);return i?{prefix:r,commands:i}:null}function Xt(t,e,r){try{let i=Vs(t,e);if(i.length>1)return Ws(i,e,r);if(!ft(e))return null;let n=Rt(t,e);return n.confidence<r||!n.node?null:cr(n.node)}catch{return null}}function js(t,e,r){try{let i=r(t,e);return i!==t?i:null}catch{return null}}function $s(t){let e=["then"],r=N(t);if(r?.keywords?.then){let i=r.keywords.then;if(i.primary&&i.primary!=="then"&&e.push(i.primary),i.alternatives)for(let n of i.alternatives)e.includes(n)||e.push(n);}return e}function Vs(t,e){let i=$s(e).map(o=>o.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")),n=new RegExp(`\\s+(?:${i.join("|")})\\s+`,"i"),a=t.split(`
|
|
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[n,a]of Object.entries(i))if(a===e)return n}}function pr(t){return yt.possessive?.specialForms?.[t]??`${t}'s`}var Oa={ar:{\u0642\u064A\u0645\u0629:"value"},bn:{\u0985\u0995\u09CD\u09B7\u09AE:"disabled","\u099A\u09C7\u0995 \u0995\u09B0\u09BE":"checked",\u09A6\u09C8\u09B0\u09CD\u0998\u09CD\u09AF:"length",\u09AE\u09BE\u09A8:"value"},de:{wert:"value"},es:{valor:"value"},fr:{valeur:"value"},hi:{\u0905\u0915\u094D\u0937\u092E:"disabled",\u091A\u0947\u0915:"checked",\u091B\u093F\u092A\u093E:"hidden",\u092E\u093E\u0928:"value"},id:{nilai:"value"},it:{valore:"value"},ja:{\u5024:"value"},ko:{\uAC12:"value"},ms:{dilumpuhkan:"disabled",ditanda:"checked",nilai:"value",panjang:"length"},pl:{warto\u015B\u0107:"value"},pt:{valor:"value"},qu:{chanin:"value"},ru:{\u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435:"value",\u043E\u0442\u043A\u043B\u044E\u0447\u0435\u043D\u043E:"disabled",\u043E\u0442\u043C\u0435\u0447\u0435\u043D\u043E:"checked",\u0441\u043A\u0440\u044B\u0442\u043E:"hidden"},sw:{thamani:"value"},th:{\u0E04\u0E27\u0E32\u0E21\u0E22\u0E32\u0E27:"length",\u0E04\u0E48\u0E32:"value",\u0E1B\u0E34\u0E14\u0E43\u0E0A\u0E49\u0E07\u0E32\u0E19:"disabled",\u0E40\u0E25\u0E37\u0E2D\u0E01\u0E41\u0E25\u0E49\u0E27:"checked"},tl:{haba:"length",halaga:"value",hindi_pinagana:"disabled",naka_tsek:"checked"},tr:{de\u011Fer:"value"},uk:{\u0432\u0438\u043C\u043A\u043D\u0435\u043D\u043E:"disabled",\u0437\u043D\u0430\u0447\u0435\u043D\u043D\u044F:"value",\u043F\u043E\u0437\u043D\u0430\u0447\u0435\u043D\u043E:"checked",\u043F\u0440\u0438\u0445\u043E\u0432\u0430\u043D\u043E:"hidden"},vi:{\u1EA9n:"hidden","\u0111\u01B0\u1EE3c ch\u1ECDn":"checked","gi\xE1 tr\u1ECB":"value","v\xF4 hi\u1EC7u":"disabled"},zh:{\u503C:"value"}},Pa={ar:{\u0643\u0640:"as"},bn:{\u09B9\u09BF\u09B8\u09BE\u09AC\u09C7:"as"},de:{als:"as"},es:{como:"as"},fr:{comme:"as"},hi:{\u0915\u0947_\u0930\u0942\u092A_\u092E\u0947\u0902:"as"},id:{sebagai:"as"},it:{come:"as"},ja:{\u3068\u3057\u3066:"as"},ko:{\uB85C:"as"},ms:{sebagai:"as"},pl:{jako:"as"},pt:{como:"as"},qu:{hina:"as"},ru:{\u043A\u0430\u043A:"as"},sw:{kuwa:"as"},tl:{bilang:"as"},tr:{olarak:"as"},uk:{\u044F\u043A:"as"},vi:{nh\u01B0:"as"},zh:{\u4F5C\u4E3A:"as"}},Na={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"]),ar:new Set(["\u0644\u0640"]),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"])};function vt(t,e){let r=e.value.toLowerCase(),i=(e.normalized??"").toLowerCase();if(r==="of"||r==="ng"||i==="of"||i==="source")return true;let n=t?.code?Na[t.code]:void 0;return !!n&&n.has(r)}var _a={destination:"in",source:"from"},Ma={ar:new Set(["\u0639\u0646\u062F","\u0641\u064A"]),bn:new Set(["\u098F","\u09A4\u09C7"]),de:new Set(["bei"]),es:new Set(["en"]),fr:new Set(["dans","en","\xE0"]),he:new Set(["\u05DC\u05EA\u05D5\u05DA"]),hi:new Set(["\u092A\u0930","\u092E\u0947\u0902"]),id:new Set(["dalam","di","ke_dalam"]),it:new Set(["a"]),ja:new Set(["\u3067","\u306E\u4E2D","\u3078"]),ko:new Set(["\uC548\uC5D0","\uC5D0","\uC73C\uB85C"]),ms:new Set(["dalam","di","ke_dalam"]),pl:new Set(["do","przy","w"]),pt:new Set(["dentro","em"]),qu:new Set(["pi","ukupi"]),ru:new Set(["\u0432","\u0443"]),sw:new Set(["katika","ndani"]),th:new Set(["\u0E17\u0E35\u0E48","\u0E43\u0E19"]),tl:new Set(["papasok_sa","sa","sa_loob"]),tr:new Set(["de","i\xE7inde","i\xE7ine"]),uk:new Set(["\u0432","\u0443"]),vi:new Set(["trong","t\u1EA1i","v\xE0o"]),zh:new Set(["\u5728","\u8FDB\u5165"])},La=new Set(["in","into","at","within","inside"]);function Ia(t,e){let r=e.value.toLowerCase();if((t?.code?Ma[t.code]:void 0)?.has(r))return "in";let n=e.normalized??e.value,a=n.toLowerCase();return La.has(a)?"in":_a[a]??n}var fr=new Set(["first","last","next","previous","random","closest"]),ja={bn:{\u09B6\u09C7\u09B7:"last"}},Et=new Set(Object.keys(we).map(t=>t.toLowerCase()));function gt(t,e,r){let i=t[e];if(!i)return null;let n=(i.normalized??i.value).toLowerCase(),a=t[e+1],u=r?.code&&a?.kind==="selector"&&a.value.startsWith("<")?ja[r.code]?.[i.value.toLowerCase()]:void 0;if(!fr.has(n)&&!fr.has(i.value.toLowerCase())&&u===void 0)return null;let o=[{text:u??i.normalized??i.value,token:i}],s=e+1,l=t[s];if(!l||l.kind!=="selector")return null;o.push({text:l.value,token:l}),s++;let c=0;for(;c++<8;){let p=t[s];if(p&&p.kind==="selector"&&p.value.startsWith("."))o.push({text:p.value,token:p}),s++;else break}let m=t[s],d=t[s+1];return m&&d&&d.kind==="selector"&&(m.kind==="keyword"||m.kind==="particle"||m.kind==="identifier")&&!fr.has((m.normalized??m.value).toLowerCase())&&!Et.has((m.normalized??m.value).toLowerCase())&&(o.push({text:Ia(r,m),token:m}),o.push({text:d.value,token:d}),s+=2),{parts:o,consumed:s-e}}function $a(t,e){let r=Pa[t];return r?r[e.toLowerCase()]??e:e}function Pe(t,e){let r=Oa[t];return r?r[e.toLowerCase()]??e:e}function Va(t,e){let r=[e.value,e.normalized].filter(Boolean);for(let i of r){let n=ce(t,i)??ce(t,i.toLowerCase());if(n)return n}}function zt(t){return t.kind==="literal"||t.kind==="operator"||t.kind==="punctuation"?false:!/^[$:@#.*^(){}[\]]/.test(t.value)}function Wa(t,e){let r=t?.references;if(!r)return false;let i=Object.values(r).filter(a=>typeof a=="string").map(a=>a.toLowerCase());return [e.value,e.normalized].filter(Boolean).some(a=>i.includes(a.toLowerCase()))}function qa(t,e){return zt(t)?Pe(e,t.value)!==t.value?true:t.kind==="identifier":false}var Ka={ar:{\u0647\u0648:{beforePredicate:"is"}},hi:{\u0939\u0948:{beforePredicate:"is"},\u0928\u0939\u0940\u0902:{beforeBareIdentifier:"no"}},th:{\u0E40\u0E1B\u0E47\u0E19:{beforeTypeName:"as",beforePredicate:"is"}},ja:{\u7A7A:{afterCopula:"empty"}},zh:{\u6CA1\u6709:{beforeBareIdentifier:"no"}},tl:{walang:{beforeBareIdentifier:"no"},may:{afterSubject:"exists"}},bn:{\u0986\u099B\u09C7:{afterSubject:"exists"}},tr:{var:{afterSubject:"exists"}}},Ua=new Set(["empty","null","undefined","true","false"]),Ha=new Set(["Number","Int","Float","String","Date","Array","Object","JSON","json","FormData","HTML","Fragment","Values"]);function Ga(t,e,r,i){let n=Ka[t],a=n?.[e.value]??n?.[e.value.toLowerCase()];if(a){if(a.beforeTypeName&&i?.kind==="identifier"&&Ha.has(i.value))return a.beforeTypeName;if(a.beforePredicate&&i&&(i.kind==="literal"||i.kind==="keyword"&&Ua.has((i.normalized??"").toLowerCase())))return a.beforePredicate;if(a.beforeBareIdentifier&&i?.kind==="identifier"&&/^[A-Za-z_]\w*$/.test(i.value))return a.beforeBareIdentifier;if(a.afterSubject&&(r?.kind==="selector"||r?.kind==="reference"))return a.afterSubject;if(a.afterCopula&&r?.kind==="keyword"&&(r.normalized??"").toLowerCase()==="is")return a.afterCopula}}function kr(t,e){let r=e?.code??"en",i="",n,a=(o,s)=>{if(n===void 0){i=o,n=s;return}let c=n.position?.end!==void 0&&s.position?.start!==void 0&&n.position.end===s.position.start&&(o.startsWith(".")||o.startsWith("!"));i+=(c?"":" ")+o,n=s;},u=o=>o.kind==="keyword"?o.normalized??o.value:o.value;for(let o=0;o<t.length;o++){let s=t[o],l=e?Va(e,s):void 0,c=t[o+1];if(l!==void 0&&c){let E=e?.possessive?.connectors,v=!!E?.length&&E.some(k=>{let D=k.toLowerCase();return D===c.value.toLowerCase()||D===(c.normalized??"").toLowerCase()}),f=v?o+2:o+1,h=t[f];if(h&&qa(h,r)){a(pr(l),s),a(Pe(r,h.value),h),o=f;continue}if(v&&h&&/^\.[a-zA-Z_]\w*$/.test(h.value)&&c.position?.end!==void 0&&h.position?.start!==void 0&&c.position.end===h.position.start){a(pr(l),s),a(Pe(r,h.value.slice(1)),h),o=f;continue}if(!v&&/^\.[a-zA-Z_]\w*$/.test(c.value)&&s.position?.end!==void 0&&c.position?.start!==void 0&&s.position.end===c.position.start&&!Wa(e,s)){a(pr(l),s),a(Pe(r,c.value.slice(1)),c),o+=1;continue}}let m=t[o+2];if(c&&m&&m.kind==="selector"&&vt(e,c)&&zt(s)){a(Pe(r,s.value),s),a("of",c),a(m.value,m),o+=2;continue}let d=gt(t,o,e);if(d){for(let E of d.parts)a(E.text,E.token);o+=d.consumed-1;continue}let p=Ga(r,s,t[o-1],c);if(p!==void 0){a(p,s);continue}let y=$a(r,s.value);if(y!==s.value){a(y,s);continue}a(u(s),s);}return i.trim()}var kt=[{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 $r(t,e,r,i){let n=kt.find(u=>u.lang===t);if(!n)return false;let a=(u,o)=>(u??"").toLowerCase()===o.toLowerCase();return a(e,n.end)&&a(r,n.at)&&a(i,n.of)}function Ya(t,e){let r=kt.find(n=>n.lang===t);if(!r)return false;let i=e.toLowerCase();return i===r.at.toLowerCase()||i===r.of.toLowerCase()||i===r.end.toLowerCase()}var wt={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"])};function Za(t){return wt[t]}function Xa(t,e){return wt[e]?.has(t.toLowerCase())??false}var Ct=96,Ja=/^[A-Za-z_][\w-]*$/,Qa=/^[A-Za-z_][\w-]*:[^\s'"`/:][^\s]*$/;function bt(t,e){let r=t.peek(e);return !!r&&r.kind==="identifier"&&Qa.test(r.value)}function At(t,e){let r=t.peek(e);if(!r||r.kind!=="identifier"&&r.kind!=="keyword"||!Ja.test(r.value))return false;let i=t.peek(e+1),n=t.peek(e+2);return !!i&&i.value===":"&&!!n}function Vr(t,e=0){return bt(t,e)||At(t,e)}function eu(t){let e=t.peek();if(!e||e.value!=="{"&&e.value!=="(")return null;let r="",i=-1,n=0,a=0;for(;!t.isAtEnd()&&a++<Ct;){let u=t.advance();if(!u)break;if(i>=0&&u.position.start>i&&(r+=" ".repeat(u.position.start-i)),r+=u.value,i=u.position.end,u.value==="{"||u.value==="(")n++;else if((u.value==="}"||u.value===")")&&(n--,n===0))return r}return null}function Wr(t){let e=t.peek();return e?e.value==="{"||e.value==="("?eu(t):e.value===","||e.value===":"?null:(t.advance(),e.value):null}function Ke(t,e){let r=t.mark(),i=[];if(e!==void 0){let a=t.peek();if(!a||a.value!==":"||!t.peek(1))return null;t.advance();let u=Wr(t);if(u===null)return t.reset(r),null;i.push(`${e}:${u}`);}else if(!Vr(t))return null;let n=0;for(;n++<Ct;){let a=t.peek();if(!a)break;if(a.value===","){if(i.length===0||!Vr(t,1))break;t.advance();continue}if(bt(t,0)){i.push(t.advance().value);continue}if(!At(t,0))break;let u=t.advance().value;t.advance();let o=Wr(t);if(o===null)return t.reset(r),null;i.push(`${u}:${o}`);}return i.length===0?(t.reset(r),null):`{${i.join(", ")}}`}var yr=.8,ru=.6,tu=.15,iu=.5,qr=.15,Kr=.1,Ur=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"]),nu={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"]},au=class{calculate(t){return this.calculateWithBreakdown(t).final}calculateWithBreakdown(t){let e=this.scoreRoleCoverage(t),r=this.scoreStemPenalty(t),i=this.scoreLanguageBoost(t),n=this.scoreLanguageAdjustment(t),a=e;return a=Math.max(iu,a+r),a=Math.min(1,a+i),a=Math.max(0,Math.min(1,a+n)),{roleCoverage:e,stemPenalty:r,languageBoost:i,languageAdjustment:n,final:a}}scoreRoleCoverage(t){let{pattern:e,captured:r}=t,i=0,n=0,a=u=>e.extraction?.[u]?.default!==void 0;for(let u of e.template.tokens)if(u.type==="role")n+=1,r.has(u.role)&&(i+=1);else if(u.type==="group")for(let o of u.tokens)o.type==="role"&&(n+=yr,r.has(o.role)?i+=yr:a(o.role)&&(i+=yr*ru));return n>0?i/n:1}scoreStemPenalty(t){let{stemMatchCount:e,totalKeywordMatches:r}=t;return e<=0||r<=0?0:-(e/r)*tu}scoreLanguageBoost(t){let{pattern:e}=t;if(e.language!=="ar")return 0;let r=e.template.tokens[0];return !r||r.type!=="literal"?0:Ur.has(r.value)||r.alternatives?.some(i=>Ur.has(i))?qr:0}scoreLanguageAdjustment(t){let{pattern:e,captured:r}=t;if(e.language!=="ar")return 0;let i=0;for(let[n,a]of r.entries()){let u=nu[n];if(!u||u.length===0)continue;let o="metadata"in a?a.metadata:void 0;o&&typeof o.prepositionValue=="string"&&(u.includes(o.prepositionValue)?i+=.1:i-=.1);}return Math.max(-Kr,Math.min(Kr,i))}},uu=new au,ou=new Set(Object.values(we).filter(t=>t.bareKeyword===true).map(t=>t.action)),J=class L{constructor(e){this.matchCache=new Map,this.stemMatchCount=0,this.totalKeywordMatches=0,this.confidenceModel=e??uu;}matchPattern(e,r){let i=e.mark(),n=new Map;if(this.currentProfile=N(r.language),this.currentPatternCommand=r.command,this.stemMatchCount=0,this.totalKeywordMatches=0,!this.matchTokenSequence(e,r.template.tokens,n))return e.reset(i),null;let u=this.confidenceModel.calculate({pattern:r,captured:n,stemMatchCount:this.stemMatchCount,totalKeywordMatches:this.totalKeywordMatches});return this.applyExtractionRules(r,n),{pattern:r,captured:n,consumedTokens:e.position()-i.position,confidence:u}}matchBest(e,r){this.matchCache.clear();let i=[],n=e.position();for(let u of r){let o=e.mark(),s=`${n}:${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 a=i[0];return this.matchPattern(e,a.pattern),a}matchTokenSequence(e,r,i,n){let a=r[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();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]??n);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 n=e.peek(),a=e.peek(1);if(!n||!a||this.patternTokenWouldMatch(i,n))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(n)&&a.kind==="selector"){e.advance();let l=this.tokenToSemanticValue(e.advance());l&&r.set("source",l);return}if(s==="after"&&n.kind==="selector"&&o(a)){let l=this.tokenToSemanticValue(n);e.advance(),e.advance(),l&&r.set("source",l);}}matchPatternToken(e,r,i,n){switch(r.type){case "literal":return this.matchLiteralToken(e,r);case "role":return this.matchRoleToken(e,r,i,n);case "group":return this.matchGroupToken(e,r,i,n);default:return false}}matchLiteralToken(e,r){let i=e.peek();if(!i)return false;let n=this.getMatchType(i,r.value);if(n!=="none")return this.totalKeywordMatches++,n==="stem"&&this.stemMatchCount++,e.advance(),true;if(r.alternatives)for(let a of r.alternatives){let u=this.getMatchType(i,a);if(u!=="none")return this.totalKeywordMatches++,u==="stem"&&this.stemMatchCount++,e.advance(),true}for(let a of [r.value,...r.alternatives??[]])for(let u of ["-","_"])if(a.includes(u)&&this.tryMatchShatteredCompound(e,a,u))return this.totalKeywordMatches++,true;return false}tryFoldHyphenActionKeyword(e){let r=this.currentProfile;if(!r)return null;let i=e.mark(),n=[];for(;;){let u=e.peek();if(!u||u.kind!=="identifier"&&u.kind!=="keyword")break;n.push(u.value),e.advance();let o=e.peek();if(!o||o.value!=="-")break;e.advance(),n.push("-");}if(n.length<3||n[n.length-1]==="-")return e.reset(i),null;let a=n.join("").toLowerCase();for(let[u,o]of Object.entries(r.keywords))if(o.primary.toLowerCase()===a||o.alternatives?.some(s=>s.toLowerCase()===a))return q(u);return e.reset(i),null}tryMatchShatteredCompound(e,r,i){let n=r.split(i);if(n.length<2||n.some(u=>u.length===0))return false;let a=e.mark();for(let u=0;u<n.length;u++){if(u>0){let s=e.peek();if(!s||s.value!==i)return e.reset(a),false;e.advance();}let o=e.peek();if(!o||o.kind!=="identifier"&&o.kind!=="keyword"&&o.kind!=="particle"||o.value.toLowerCase()!==n[u].toLowerCase())return e.reset(a),false;e.advance();}return true}matchRoleToken(e,r,i,n){this.skipNoiseWords(e);let a=e.peek();if(!a)return r.optional||false;if(r.role==="action"&&this.currentProfile&&e.peek(1)?.value==="-"){let f=this.tryFoldHyphenActionKeyword(e);if(f)return i.set(r.role,f),true}if(r.role==="event"&&this.currentPatternCommand==="on"){if(!L.tokenLooksLikeEvent(a))return r.optional||false;let f=(a.normalized??a.value).toLowerCase();if(L.POSITIONAL_OR_SCOPE_KEYWORDS.has(f)||this.currentProfile&&(ce(this.currentProfile,a.value)??ce(this.currentProfile,f))!==void 0||a.value.includes("?."))return r.optional||false}if(r.role==="event"){let f=(a.normalized??a.value).toLowerCase();if(L.STRUCTURAL_NEVER_EVENT.has(f))return r.optional||false}if(a.kind==="keyword"){let f=(a.normalized??a.value).toLowerCase();if(f==="then"||f==="end"&&e.peek(1)?.kind!=="selector"||Xa(a.value,this.currentProfile?.code??""))return r.optional||false}if(r.role==="duration"){let f=(a.normalized??a.value).toLowerCase();if(L.POSITIONAL_OR_SCOPE_KEYWORDS.has(f))return r.optional||false}if(r.optional&&n===void 0&&r.role!=="event"&&r.role!=="action"&&a.kind==="keyword"&&(a.normalized??a.value).toLowerCase()in we)return true;let u=this.tryMatchPositionalExpression(e);if(u)return r.expectedTypes&&r.expectedTypes.length>0&&!tr(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&&!tr(o.type,r.expectedTypes)?r.optional||false:(i.set(r.role,o),true);if(r.role!=="event"&&(!r.expectedTypes||r.expectedTypes.includes("expression"))){let f=this.tryMatchBeepPrefixExpression(e);if(f)return i.set(r.role,f),true;let h=this.tryMatchOperatorRunExpression(e);if(h)return i.set(r.role,h),true}if(this.currentPatternCommand==="pick"&&r.role==="patient"&&(!r.expectedTypes||r.expectedTypes.includes("expression"))){let f=this.tryMatchPickRangeExpression(e);if(f)return i.set(r.role,f),true}if(r.expectedTypes?.includes("property-path")){let f=this.tryMatchOfPossessiveExpression(e);if(f)return i.set(r.role,f),true;let h=this.tryMatchPostNominalPossessiveExpression(e);if(h)return i.set(r.role,h),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"||L.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 d=this.tryMatchPossessiveSelectorExpression(e);if(d)return r.expectedTypes&&r.expectedTypes.length>0&&!tr(d.type,r.expectedTypes)?r.optional||false:(i.set(r.role,d),true);let p=r.role!=="condition",y=this.tryMatchPropertyAccessExpression(e,p);if(y)return r.expectedTypes&&r.expectedTypes.length>0&&!r.expectedTypes.includes(y.type)&&!r.expectedTypes.includes("expression")?r.optional||false:(i.set(r.role,y),true);let E=this.tryMatchSelectorPropertyExpression(e);if(E)return r.expectedTypes&&r.expectedTypes.length>0&&!tr(E.type,r.expectedTypes)?r.optional||false:(i.set(r.role,E),true);if(a.kind==="identifier"&&a.value==="{"){let f=r.expectedTypes,k=f?.length===1&&f[0]==="expression"?this.tryMatchBraceRunExpression(e):!f?.length||f.includes("literal")?this.tryMatchBraceRunLiteral(e):null;if(k)return i.set(r.role,k),true}if(r.role==="style"&&r.expectedTypes?.length===1&&r.expectedTypes[0]==="expression"){let f=Ke(e);if(f)return i.set(r.role,{type:"expression",raw:f}),true}let v=this.tokenToSemanticValue(a);if(!v)return r.optional||false;if(r.expectedTypes&&r.expectedTypes.length>0&&!r.expectedTypes.includes(v.type)){let f=v.type==="selector"&&String(v.value).startsWith("@"),h=r.expectedTypes.some(k=>k==="expression"||k==="reference");if(!(f&&h))return r.optional||false}if(i.set(r.role,v),e.advance(),r.role==="event"){let f=e.peek();f&&f.kind==="selector"&&f.value.startsWith("[")&&"value"in v&&(i.set(r.role,q(`${String(v.value)}${f.value}`)),e.advance());let h=e.peek();if(h&&(h.kind==="particle"||h.kind==="keyword")&&(h.normalized??"").toLowerCase()==="source"&&!this.patternTokenWouldMatch(n,h)){let k=e.peek(1);if(k&&(k.kind==="selector"||k.kind==="identifier")){e.advance();let D=this.tokenToSemanticValue(e.advance());D&&!i.has("source")&&i.set("source",D);}}}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=gt(e.tokens,e.position(),this.currentProfile);if(!r)return null;for(let i=0;i<r.consumed;i++)e.advance();return {type:"expression",raw:r.parts.map(i=>i.text).join(" ")}}tryMatchCaretScopeExpression(e){let r=e.peek();if(!r||r.kind!=="identifier"||!r.value.startsWith("^"))return null;let i=e.peek(1),n=e.peek(2),a=(i?.normalized??"").toLowerCase(),u=!!i&&(i.value.toLowerCase()==="on"||a==="destination"||a==="on");return !i||!n||n.kind!=="selector"||!u?null:(e.advance(),e.advance(),e.advance(),{type:"expression",raw:`${r.value} on ${n.value}`})}isOfPossessiveMarker(e){return vt(this.currentProfile,e)}tryMatchBeepPrefixExpression(e){let r=e.peek(),i=e.peek(1);if(!r||!i||i.value!=="!"||(r.normalized??r.value).toLowerCase()!=="beep"||!(r.position?.end!==void 0&&i.position?.start!==void 0&&r.position.end===i.position.start))return null;let a=e.mark(),u=e.position();if(e.advance(),e.advance(),!this.tryConsumeRunOperand(e))return e.reset(a),null;for(;;){let s=e.peek();if(!s||!L.RUN_OPERATORS.has(s.value))break;let l=e.mark();if(e.advance(),!this.tryConsumeRunOperand(e)){e.reset(l);break}}let o=kr(e.tokens.slice(u,e.position()),this.currentProfile);return {type:"expression",raw:o,value:o}}tryMatchOperatorRunExpression(e){let r=e.mark(),i=e.position();if(!this.tryConsumeRunOperand(e))return e.reset(r),null;let n=1;for(;;){let u=e.peek();if(!u||!L.RUN_OPERATORS.has(u.value))break;let o=e.mark();if(e.advance(),!this.tryConsumeRunOperand(e)){e.reset(o);break}n++;}if(n<2)return e.reset(r),null;let a=kr(e.tokens.slice(i,e.position()),this.currentProfile);return {type:"expression",raw:a,value:a}}isPickRangeSeparator(e){let r=(e.normalized??e.value).toLowerCase();if(L.PICK_RANGE_SEPARATORS.has(r))return true;let i=this.currentProfile?.code;return i?L.PICK_RANGE_SEPARATORS_BY_LANG[i]?.has(e.value.toLowerCase())??false:false}tryMatchPickRangeExpression(e){let r=e.mark(),i=e.position();if(!this.tryConsumePickRangeOperand(e))return e.reset(r),null;let n=e.peek();if(!n||!this.isPickRangeSeparator(n)||(e.advance(),!this.tryConsumePickRangeOperand(e)))return e.reset(r),null;let a=e.peek();a&&L.PICK_RANGE_MODES.has((a.normalized??a.value).toLowerCase())&&e.advance();let u=e.tokens.slice(i,e.position()),[o,,s,l]=u,c=d=>d.kind==="keyword"?d.normalized??d.value:d.value,m=`${c(o)} to ${c(s)}`;return l&&(m+=` ${(l.normalized??l.value).toLowerCase()}`),{type:"expression",raw:m,value:m}}tryConsumePickRangeOperand(e){let r=e.peek();if(!r)return false;let i=(r.normalized??r.value).toLowerCase();if(this.isPickRangeSeparator(r))return false;let n=i==="start"||i==="end";return r.kind==="literal"||r.kind==="identifier"||r.kind==="keyword"&&n?(e.advance(),true):false}tryConsumeRunOperand(e){let r=e.peek();if(!r)return false;if(r.value==="("){let i=e.mark(),n=0;for(;!e.isAtEnd();){let a=e.advance();if(a.value==="(")n++;else if(a.value===")"&&(n--,n===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")&&!L.RUN_OPERATORS.has(r.value)&&r.value!==")"?(e.advance(),true):false}isPossessorToken(e){if(!this.currentProfile)return false;for(let r of [e.value,e.normalized].filter(Boolean))if(ce(this.currentProfile,r)??ce(this.currentProfile,r.toLowerCase()))return true;return false}isBareWordPropertyHead(e){return e.kind!=="identifier"||/^[$:@#.*]/.test(e.value)||this.isStructuralKeyword(e.value)||e.normalized&&this.isStructuralKeyword(e.normalized)||e.normalized&&this.isRoleMarkerConcept(e.normalized)?false:!this.isPossessorToken(e)}toEnglishProperty(e){return this.currentProfile?Pe(this.currentProfile.code,e):e}tryMatchOfPossessiveExpression(e){let r=e.peek();if(!r||r.kind!=="selector"&&!this.isBareWordPropertyHead(r))return null;let i=e.mark();e.advance();let n=e.peek();if(!n||!this.isOfPossessiveMarker(n))return e.reset(i),null;e.advance();let a=e.peek();return !a||a.kind!=="selector"?(e.reset(i),null):(e.advance(),Ee(ze(a.value),this.toEnglishProperty(r.value)))}tryMatchPossessiveExpression(e){let r=e.peek();if(!r||!this.currentProfile)return null;let i=[r.value,r.normalized].filter(Boolean),n;for(let s of i)if(n=ce(this.currentProfile,s)??ce(this.currentProfile,s.toLowerCase()),n)break;if(!n)return null;let a=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||Ya(this.currentProfile.code,o.value))return e.reset(a),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.normalized&&L.COMMAND_ACTION_KEYWORDS.has(o.normalized.toLowerCase()))||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)),s=this.toEnglishProperty(s);let l=s;for(;;){let m=e.peek();if(m?.kind==="selector"&&m.value.startsWith(".")&&/^\.[a-zA-Z_]\w*/.test(m.value)){l+=m.value,e.advance();continue}if(m?.value==="?"){let d=e.peek(1);if(d?.kind==="selector"&&d.value.startsWith(".")&&/^\.[a-zA-Z_]\w*/.test(d.value)){l+=`?${d.value}`,e.advance(),e.advance();continue}}break}let c=e.peek();if(c&&c.value.startsWith("(")){let m="",d=0,p=0;for(;!e.isAtEnd()&&p++<L.MAX_METHOD_ARGS+2;){let y=e.peek();if(!y)break;m+=y.value,e.advance();for(let E of y.value)E==="("?d++:E===")"&&d--;if(d<=0)break}l+=m;}return Ee(ue(n),l)}return e.reset(a),null}tryMatchPostNominalPossessiveExpression(e){if(!this.currentProfile||this.currentProfile.possessive?.markerPosition!=="after-object")return null;let r=e.peek();if(!r)return null;let i=r.kind==="selector"&&r.value.startsWith(".")&&/^\.[a-zA-Z_]\w*/.test(r.value);if(!(r.kind==="identifier"&&!this.isStructuralKeyword(r.value)&&!(r.normalized&&this.isStructuralKeyword(r.normalized))&&!(r.normalized&&this.isRoleMarkerConcept(r.normalized))||r.kind==="selector"&&(r.value.startsWith("*")||r.value.startsWith("@"))||i)||this.isPossessorToken(r))return null;let a=e.mark(),u=r.value;i&&(u=u.substring(1)),e.advance(),u=this.toEnglishProperty(u);let o=u;for(;e.peek()?.kind==="selector"&&e.peek().value.startsWith(".")&&/^\.[a-zA-Z_]\w*/.test(e.peek().value);)o+=e.peek().value,e.advance();let s=e.peek();if(!s)return e.reset(a),null;let l;for(let c of [s.value,s.normalized].filter(Boolean))if(l=ce(this.currentProfile,c)??ce(this.currentProfile,c.toLowerCase()),l)break;return l?(e.advance(),Ee(ue(l),o)):(e.reset(a),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&&ou.has(i))}tryMatchBraceRunLiteral(e){let r=e.peek();if(!r||r.kind!=="identifier"||r.value!=="{")return null;let i=e.mark();e.advance();let n=["{"],a=1,u=0;for(;!e.isAtEnd()&&u++<L.MAX_BRACE_RUN_TOKENS;){let o=e.advance();if(!o)break;if(o.value==="{")a++;else if(o.value==="}"&&(a--,a===0))return n.push("}"),q(n.join(" "));n.push(o.value);}return e.reset(i),null}tryMatchBraceRunExpression(e){let r=e.peek();if(!r||r.kind!=="identifier"||r.value!=="{")return null;let i=e.mark(),n="",a=-1,u=0,o=0;for(;!e.isAtEnd()&&o++<L.MAX_BRACE_RUN_TOKENS;){let s=e.advance();if(!s)break;if(a>=0&&s.position.start>a&&(n+=" ".repeat(s.position.start-a)),n+=s.value,a=s.position.end,s.value==="{")u++;else if(s.value==="}"&&(u--,u===0))return {type:"expression",raw:n}}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 n=e.mark();e.advance();let a=e.advance(),u="",o=a.position?.end,s=false,l=0;for(;!e.isAtEnd()&&l++<L.MAX_METHOD_ARGS+2;){let c=e.peek();if(!c)break;if(c.value===")"){e.advance(),s=true;break}let m=o!==void 0&&c.position?.start===o;u+=(u===""||m?"":" ")+c.value,o=c.position?.end,e.advance();}return s?{type:"expression",raw:`${r.value}(${u})`}:(e.reset(n),null)}tryMatchMethodCallExpression(e){let r=e.peek();if(!r||r.kind!=="selector")return null;let i=e.mark();e.advance();let n=e.peek();if(!n||n.kind!=="operator"||n.value!==".")return e.reset(i),null;e.advance();let a=e.peek();if(!a||a.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<L.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}.${a.value}(${o.join(", ")})`}}tryMatchPropertyAccessExpression(e,r=true){let i=e.peek();if(!i||i.kind!=="identifier"&&i.kind!=="keyword")return null;let n=e.mark();e.advance();let a=i.value.toLowerCase(),u=e.peek();if((i.kind==="identifier"||L.PROPERTY_ACCESS_BASES.has(a))&&u&&u.kind==="selector"&&/^\.[a-zA-Z_]/.test(u.value)){let p=i.value,y=[],E=0;for(;E<L.MAX_PROPERTY_DEPTH;){let h=e.peek();if(h&&h.kind==="selector"&&/^\.[a-zA-Z_]/.test(h.value))p+=`.${h.value.slice(1)}`,y.push(h.value.slice(1)),e.advance(),E++;else break}let v=e.peek(),f=!!v&&v.value.startsWith("(");if(r&&!f&&y.length>0&&Re(a))return Ee(ue(a),y.join("."));if(f){let h=e.mark(),k=[],D=0,A=false;for(;!e.isAtEnd();){let z=e.peek();if(!z)break;if(z.value==="(")D++;else if(z.value===")"){if(k.push(z.value),e.advance(),D--,D===0&&(A=true),A)break;continue}k.push(z.value),e.advance();}A?p+=k.join(""):e.reset(h);}return {type:"expression",raw:p}}let o=e.peek();if(!o||o.kind!=="operator"||o.value!==".")return e.reset(n),null;e.advance();let s=e.peek();if(!s||s.kind!=="identifier")return e.reset(n),null;e.advance();let l=`${i.value}.${s.value}`,c=1;for(;!e.isAtEnd()&&c<L.MAX_PROPERTY_DEPTH;){let p=e.peek();if(!p||p.kind!=="operator"||p.value!==".")break;e.advance();let y=e.peek();if(!y||y.kind!=="identifier")break;e.advance(),l+=`.${y.value}`,c++;}let m=e.peek();if(m&&m.kind==="punctuation"&&m.value==="("){e.advance();let p=[],y=0;for(;!e.isAtEnd()&&p.length<L.MAX_METHOD_ARGS;){let v=e.peek();if(!v)break;if(v.kind==="punctuation"&&v.value===")"){if(y===0){e.advance();break}y--;}if(v.kind==="punctuation"&&v.value==="("&&y++,v.kind==="punctuation"&&v.value===","){e.advance();continue}p.push(v.value),e.advance();}return {type:"expression",raw:`${l}(${p.join(", ")})`}}let d=i.value.toLowerCase();if(r&&Re(d)){let p=l.split(".").slice(1).join(".");return Ee(ue(d),p)}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 n=e.peek(),a=this.currentProfile?.possessive?.marker?.replace(/^-/,""),u=!!n&&n.kind==="punctuation"&&n.value==="'s",o=!!n&&n.value==="'"&&(e.peek(1)?.value??"").toLowerCase()==="s",s=(()=>{if(!this.currentPatternCommand||(n?.normalized??"").toLowerCase()!=="source")return false;let d=we[this.currentPatternCommand];return !!d&&d.roles.some(p=>p.role==="source")})(),l=!!n&&!!a&&a!=="'s"&&n.value===a&&(n.kind==="particle"||n.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(),Ee(ze(r.value),this.toEnglishProperty(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 n=e.peek();if(!n||n.kind!=="selector"||!n.value.startsWith("."))return e.reset(i),null;let a=e.peek(1);a&&a.kind,e.advance();let u=n.value.slice(1);return Ee(ze(r.value),u)}matchGroupToken(e,r,i,n){let a=e.mark(),u=new Set(i.keys());if(!this.matchTokenSequence(e,r.tokens,i,n)){e.reset(a);for(let s of i.keys())u.has(s)||i.delete(s);return r.optional||false}return true}getMatchType(e,r){if(e.value===r)return "exact";if(e.normalized===r)return "normalized";if(e.stem===r&&e.stemConfidence!==void 0&&e.stemConfidence>=.7)return "stem";if(e.kind==="keyword"&&e.value.toLowerCase()===r.toLowerCase())return "case-insensitive";if(e.kind==="keyword"){let i=er(e.value).toLowerCase();if(i&&i===er(r).toLowerCase())return "case-insensitive"}return "none"}tokenToSemanticValue(e){switch(e.kind){case "selector":return ze(e.value);case "literal":return this.parseLiteralValue(e.value);case "keyword":let r=(e.normalized||e.value).toLowerCase();return Re(r)?ue(r):q(e.normalized||e.value);case "identifier":if(e.value.startsWith("@"))return ze(e.value);if(e.value.startsWith(":")||e.value.startsWith("$"))return ue(e.value);let i=e.value.toLowerCase();return Re(i)?ue(i):{type:"expression",raw:e.value};case "url":return q(e.value,"string");default:return null}}parseLiteralValue(e){if(e.startsWith('"')||e.startsWith("'")||e.startsWith("`")||e.startsWith("\u300C")){let n=e.slice(1,-1);return q(n,"string")}if(e==="true")return q(true,"boolean");if(e==="false")return q(false,"boolean");let r=e.match(/^(\d+(?:\.\d+)?)(ms|s|m|h)?$/);if(r){let n=parseFloat(r[1]);return r[2]?q(e,"duration"):q(n,"number")}let i=parseFloat(e);return isNaN(i)?q(e,"string"):q(i,"number")}applyExtractionRules(e,r){for(let[i,n]of Object.entries(e.extraction)){let a=r.get(i);if(a){if(n.transform){let u=a.type==="literal"?String(a.value):String(a.raw??"");r.set(i,n.transform(u));}}else n.value!==void 0?r.set(i,{type:"literal",value:n.value}):n.default&&r.set(i,n.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(L.ENGLISH_NOISE_WORDS.has(i)){let n=e.mark();e.advance();let a=e.peek();if(a&&(a.kind==="selector"||a.kind==="identifier"))return;let u=e.peek(1);if(a&&a.kind==="keyword"&&u&&u.kind==="selector"&&/^\.[a-zA-Z_]/.test(u.value))return;let o=a?(a.normalized??a.value).toLowerCase():"";if(a&&L.POSITIONAL_OR_SCOPE_KEYWORDS.has(o))return;let s=e.peek(1),l=s?(s.normalized??s.value).toLowerCase():"",c=this.currentProfile?.wordOrder!=="SOV"&&L.COMMAND_ACTION_KEYWORDS.has(l),m=!s||s.kind==="particle"||L.CLAUSE_BOUNDARY_KEYWORDS.has(l)||c;if(a&&a.kind==="keyword"&&this.currentProfile?.code!=="en"&&Re(o)&&m||a&&a.kind==="keyword"&&this.currentProfile?.code==="en"&&Re(o))return;e.reset(n);}i==="class"&&e.advance();}extractEventModifiers(e){let r={},i=false;for(;!e.isAtEnd();){let n=e.peek();if(!n||n.kind!=="event-modifier")break;let a=n.metadata;if(!a)break;switch(i=true,a.modifierName){case "once":r.once=true;break;case "debounce":typeof a.value=="number"&&(r.debounce=a.value);break;case "throttle":typeof a.value=="number"&&(r.throttle=a.value);break;case "queue":(a.value==="first"||a.value==="last"||a.value==="all"||a.value==="none")&&(r.queue=a.value);break}e.advance();}return i?r:void 0}};J.POSITIONAL_OR_SCOPE_KEYWORDS=new Set(["first","last","next","previous","random","closest","parent"]);J.STRUCTURAL_NEVER_EVENT=new Set(["if","unless","else","end","then"]);J.PROPERTY_ACCESS_BASES=new Set(["it","me","you","my","its","your","event","result","target","detail","body","window","document","self","this"]);J.COMMAND_ACTION_KEYWORDS=Et;J.CLAUSE_BOUNDARY_KEYWORDS=new Set(["then","and","or","end","else"]);J.RUN_OPERATORS=new Set(["+","-","*","/"]);J.PICK_RANGE_SEPARATORS=new Set(["to"]);J.PICK_RANGE_SEPARATORS_BY_LANG={ar:new Set(["\u0625\u0644\u0649"]),bn:new Set(["\u09A5\u09C7\u0995\u09C7"]),de:new Set(["zu","bis"]),es:new Set(["a"]),fr:new Set(["\xE0"]),he:new Set(["\u05E2\u05DC","\u05E2\u05D3"]),hi:new Set(["\u0938\u0947"]),id:new Set(["ke"]),it:new Set(["in","a"]),ja:new Set(["\u304B\u3089"]),ko:new Set(["\uBD80\uD130"]),ms:new Set(["ke"]),pl:new Set(["do"]),pt:new Set(["para","a"]),qu:new Set(["kama"]),ru:new Set(["\u0432","\u0434\u043E"]),sw:new Set(["kwa","hadi"]),th:new Set(["\u0E43\u0E19","\u0E16\u0E36\u0E07"]),tl:new Set(["sa"]),tr:new Set(["ile"]),uk:new Set(["\u0432","\u0434\u043E"]),vi:new Set(["v\xE0o","\u0111\u1EBFn"]),zh:new Set(["\u5230"])};J.PICK_RANGE_MODES=new Set(["inclusive","exclusive"]);J.MAX_BRACE_RUN_TOKENS=64;J.MAX_PROPERTY_DEPTH=10;J.MAX_METHOD_ARGS=20;J.DECLARATION_COMMANDS=new Set(["behavior","def","install"]);J.ENGLISH_NOISE_WORDS=new Set(["the","a","an"]);var su=J,ae=new su;function U(t,e){return ji(t,e)}function Dt(){return Ii()}var Ge=["if","unless","repeat","for","while"],ur=/^[A-Z][A-Za-z0-9_]*$/;function Y(t,e){let r=new Set([e]),n=N(t)?.keywords?.[e];if(n){n.primary&&r.add(n.primary.toLowerCase());for(let a of n.alternatives??[])r.add(a.toLowerCase());}return r}function $(t,e){return e.has(t.value.toLowerCase())?true:t.normalized?e.has(t.normalized.toLowerCase()):false}var lu=new Set(Ge);function or(t,e){let r=t.normalized?.toLowerCase();return r?lu.has(r):e.some(i=>$(t,i))}var Hr=new Set(["me","it","you","the","body","window","document","its","event","result","target","self","this","them","parent","next","previous","closest","first","last"]),cu=new Set(["destination","source","style","patient","on","from","to"]);function St(t){if(!t||t.kind==="selector")return false;let e=(t.normalized??t.value).toLowerCase(),r=t.value.toLowerCase();return !(Hr.has(e)||Hr.has(r)||cu.has(e))}var Gr=new Set(["ja","ko"]);function Ue(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 xt(t,e){let r=[],i=e.position.end,n=t.slice(e.position.end).match(/^\s*\(([^)]*)\)/);if(n){i=e.position.end+n[0].length;for(let a of n[1].split(/[,\u060c\u3001]/)){let u=a.trim();u&&r.push(u);}}return {parameters:r,headerEnd:i}}function sr(t,e,r){let i=e+1;if(i>=t.length)return -1;let n=Ue(N(r)?.roleMarkers?.patient);return n.size>0&&$(t[i],n)&&i++,i<t.length?i:-1}var Bt=/^[a-zA-Z_$][\w$]*(?:\.[a-zA-Z_$][\w$]*)*$/;function mu(t){let e=1;if(t[1]?.value==="("){let r=0,i=1;for(;i<t.length;i++)if(t[i].value==="(")r++;else if(t[i].value===")"&&--r===0)break;if(i>=t.length)return -1;e=i+1;}return e+1}function du(t,e,r){let i=N(r);if(i?.wordOrder!=="SOV"||!Bt.test(t[0].value)||e!==mu(t))return false;let n=Ue(i.roleMarkers?.patient);return n.size===0?false:$(t[e-1],n)}function pu(t,e,r){if(!N(e))return null;let i=Y(e,"behavior"),n=Y(e,"def"),a=t.toLowerCase(),u=[...i].some(m=>a.includes(m)),o=/\bdef\b/.test(a)||[...n].some(m=>m!=="def"&&a.includes(m));if(!u&&!o)return null;let s=U(t,e).tokens;if(s.length<2)return null;if($(s[0],i))return Yr(t,e,s,r,0);let l=s.findIndex((m,d)=>d>0&&$(m,i));if(l>0&&ur.test(s[0].value))return Yr(t,e,s,r,l);if($(s[0],n))return Zr(t,e,s,r,0);let c=s.findIndex((m,d)=>d>0&&$(m,n));return c>0&&du(s,c,e)?Zr(t,e,s,r,c):null}function fu(t,e,r){let i=N(e);if(!i)return null;let n=i.wordOrder!=="SOV",a=Gr.has(e)?Ue(i.roleMarkers?.event):new Set,u=Gr.has(e)?Ue(i.keywords?.on):new Set,o=a.size>0&&u.size>0,s=Y(e,"end"),l=Y(e,"on"),c=t.toLowerCase(),m=[...s].some(z=>c.includes(z)),d=(n||o)&&(()=>{let z=0;for(let g of l)if(g){for(let b=c.indexOf(g);b>=0;b=c.indexOf(g,b+g.length))if(++z>=2)return true}return false})();if(!m&&!d)return null;let p=U(t,e).tokens;if(p.length<2)return null;let y=Ge.map(z=>Y(e,z)),E=z=>or(z,y),v=z=>$(z,s),f=[],h=0,k=0;for(let z=0;z<p.length;z++){let g=p[z];if(v(g)){if(h>0){h--;continue}let b=t.slice(p[k].position.start,g.position.start).trim();b&&f.push(b),k=z+1;}else if(E(g))h++;else if(n&&h===0&&z>k&&$(g,l)&&St(p[z+1])){let b=t.slice(p[k].position.start,g.position.start).trim();b&&f.push(b),k=z;}else if(o&&h===0&&z-1>k&&$(g,a)&&p[z+1]!==void 0&&$(p[z+1],u)){let b=p[z-1],w=t.slice(p[k].position.start,b.position.start).trim();w&&f.push(w),k=z-1;}}if(k<p.length){let z=t.slice(p[k].position.start).trim();z&&f.push(z);}if(f.length<2)return null;let D=[],A=[];for(let z of f){let g;try{g=r.statement(z,e);}catch{return null}if(!g||g.kind!=="event-handler")return null;let b=g;D.push(b);let w=!b.body||b.body.length===0;A.push(w?.2:b.metadata?.confidence??.75);}return zr(D,"then",{sourceLanguage:e,confidence:He(A),sourceText:t})}function He(t){return t.length>0?t.reduce((e,r)=>e+r,0)/t.length:0}function Dr(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 Yr(t,e,r,i,n){let a=n>0,u=a?0:sr(r,n,e);if(u<0)return null;let o=r[u],s=o.value;if(!ur.test(s))return null;let{parameters:l,headerEnd:c}=xt(t,o),m=a?n+1:r.findIndex(b=>b.position.start>=c);m<=u&&(m=u+1);let d=Y(e,"init"),p=Y(e,"end"),y=Ge.map(b=>Y(e,b)),E=b=>or(b,y),v=b=>$(b,p),f=[],h=[],k=[],D=false,A=0,z=m;for(let b=m;b<r.length;b++){let w=r[b];if(v(w)){if(A>0){A--;continue}if(b===z){D=true;break}if($(r[z],d)){let C=t.slice(r[z].position.end,w.position.start).trim();if(C)try{let S=Dr(i.body(C,e));h.push(...S),k.push(He(S.map(x=>x.metadata?.confidence??.75)));}catch{k.push(0);}}else {let C=t.slice(r[z].position.start,w.position.start).trim();try{let S=i.statement(C,e);if(S&&S.kind==="event-handler"){let x=S;f.push(x);let O=!x.body||x.body.length===0;k.push(O?.2:x.metadata?.confidence??.75);}else k.push(0);}catch{k.push(0);}}z=b+1;}else E(w)&&A++;}if(f.length===0&&h.length===0)return null;let g=(D?1:.8)*He(k);return dn(s,l,f,h.length>0?h:void 0,{sourceLanguage:e,confidence:g,sourceText:t})}function Zr(t,e,r,i,n){let a=n>0,u=a?0:sr(r,n,e);if(u<0)return null;let o=r[u],s=o.value;if(!Bt.test(s))return null;let{parameters:l,headerEnd:c}=xt(t,o),m=a?n+1:r.findIndex(g=>g.position.start>=c);m<=u&&(m=u+1);let d=Y(e,"end"),p=Ge.map(g=>Y(e,g)),y=g=>or(g,p),E=g=>$(g,d),v=0,f=-1;for(let g=m;g<r.length;g++)if(E(r[g])){if(v===0){f=g;break}v--;}else y(r[g])&&v++;let h=r[m]?.position.start??c,k=f>=0?r[f].position.start:t.length,D=t.slice(h,k).trim();if(!D)return null;let A;try{A=Dr(i.body(D,e));}catch{return null}if(A.length===0)return null;let z=He(A.map(g=>g.metadata?.confidence??.75));return f<0&&(z*=.8),pn(s,l,A,{sourceLanguage:e,confidence:z,sourceText:t})}var wr=["live","eventsource","socket","worker","intercept"],yu=new Set(["intercept"]),Sr=new Set(["eventsource","socket","worker"]),hu=new Set(["eventsource","socket"]),vu=new Set(["worker"]),Eu=6,gu=2;function zu(t,e){for(let i of wr)if($(t[0],Y(e,i)))return {action:i,keywordIdx:0};if(N(e)?.wordOrder!=="SOV")return null;let r=Math.min(t.length,Eu);for(let i=1;i<r;i++)for(let n of wr)if(n!=="live"&&$(t[i],Y(e,n))&&!(Sr.has(n)&&!ur.test(t[0].value))&&!(n==="intercept"&&i>gu))return {action:n,keywordIdx:i};return null}function ku(t,e,r){let i=Ue(N(r)?.roleMarkers?.source);return i.size===0||e+1>=t.length?0:$(t[e],i)||$(t[e+1],i)?2:0}function wu(t,e,r,i,n){if(t==="live")return r+1;if(r>0){let s=r+1;return t==="eventsource"&&(s+=ku(e,s,i)),s}let a=sr(e,r,i);if(a<0)return -1;if(t==="worker")return a+1;let u=Y(i,"on"),o=n>=0?n:e.length;for(let s=a+1;s<o;s++)if($(e[s],u)&&St(e[s+1]))return s;return o}function Cu(t,e,r,i){if(!Sr.has(t))return;let n=r>0?0:sr(e,r,i);if(!(n<0))return e[n].value}function bu(t,e,r){if(!N(e))return null;let i=t.toLowerCase(),n=false;for(let o of wr){for(let s of Y(e,o))if(s&&i.includes(s)){n=true;break}if(n)break}if(!n)return null;let a=U(t,e).tokens;if(a.length<2)return null;let u=zu(a,e);return u?Au(t,e,a,r,u.action,u.keywordIdx):null}function Au(t,e,r,i,n,a){let u=Y(e,"end"),o=Ge.map(D=>Y(e,D)),s=D=>or(D,o),l=D=>$(D,u),c=Cu(n,r,a,e);if(Sr.has(n)&&(!c||!ur.test(c)))return null;let m=D=>({sourceLanguage:e,confidence:D,sourceText:t}),d=Xr(r,a+1,l,s);if(yu.has(n))return d>=0&&d!==r.length-1?null:jr(n,[],c,m(d>=0?1:.8));let p=wu(n,r,a,e,d);if(p<0||p>r.length)return null;let y=[],E=[],v=false,f=vu.has(n);if(f||hu.has(n)){let D=f?"def":"event-handler",A=0,z=p;for(let g=p;g<r.length;g++){let b=r[g];if(l(b)){if(A>0){A--;continue}if(v=true,g===z)break;let w=f?b.position.end:b.position.start,C=t.slice(r[z].position.start,w).trim();try{let S=i.statement(C,e);if(S&&S.kind===D){let x=S;y.push(x);let O=!x.body||x.body.length===0;E.push(O?.2:x.metadata?.confidence??.75);}else E.push(0);}catch{E.push(0);}z=g+1;}else s(b)&&A++;}}else {let D=Xr(r,p,l,s);v=D>=0;let A=D>=0?r[D].position.start:t.length,z=t.slice(r[p].position.start,A).trim();if(!z)return null;try{y.push(...Dr(i.body(z,e)));}catch{return null}if(y.length===0)return null;E.push(...y.map(g=>g.metadata?.confidence??.75));}if(y.length===0&&!v)return null;let h=v?1:.8,k=E.length>0?h*He(E):h;return jr(n,y,c,m(k))}function Xr(t,e,r,i){let n=0;for(let a=e;a<t.length;a++)if(r(t[a])){if(n===0)return a;n--;}else i(t[a])&&n++;return -1}var ye={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",\uB9C8\uC6B0\uC2A4\uC5D4\uD130:"mouseenter",\uB9C8\uC6B0\uC2A4\uB9AC\uBE0C:"mouseleave",\uB9C8\uC6B0\uC2A4\uBB34\uBE0C:"mousemove",\uD0A4\uD504\uB808\uC2A4:"keypress",\uD130\uCE58\uC885\uB8CC:"touchend",\uD130\uCE58\uCDE8\uC18C:"touchcancel"},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",\u307C\u304B\u3057:"blur"},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",\u062A\u0631\u0643\u064A\u0632:"focus","\u0645\u0641\u062A\u0627\u062D \u0623\u0633\u0641\u0644":"keydown","\u0645\u0641\u062A\u0627\u062D \u0623\u0639\u0644\u0649":"keyup","\u0641\u0623\u0631\u0629 \u0641\u0648\u0642":"mouseover","\u062A\u063A\u064A\u064A\u0631 \u062D\u062C\u0645":"resize"},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",cambiar:"change",enfocar:"focus",desenfocar:"blur",cargar:"load",desplazar:"scroll",dobleclic:"dblclick",rat\u00F3nentrar:"mouseenter",rat\u00F3nsalir:"mouseleave",rat\u00F3nmover:"mousemove",teclapresar:"keypress",descargar:"unload",toqueempezar:"touchstart",toqueterminar:"touchend",toquemover:"touchmove",toquecancelar:"touchcancel"},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",bulan\u0131k:"blur",farebas:"mousedown",fareb\u0131rak:"mouseup",kayd\u0131r:"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",duploClique:"dblclick",mouseEntrar:"mouseenter",mouseSair:"mouseleave",mouseMover:"mousemove",teclaPressionar:"keypress",descarregar:"unload",toqueIn\u00EDcio:"touchstart",toqueFim:"touchend",toqueMover:"touchmove",toqueCancelar:"touchcancel"},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",\u6309\u952E\u6309\u4E0B:"keydown",\u9F20\u6807\u79FB\u52A8:"mousemove",\u5378\u8F7D:"unload",\u8C03\u6574\u5927\u5C0F:"resize",\u89E6\u6478\u5F00\u59CB:"touchstart",\u89E6\u6478\u79FB\u52A8:"touchmove"},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",flou:"blur",doubleclic:"dblclick",sourisentrer:"mouseenter",sourissortir:"mouseleave",sourisbouger:"mousemove",touchepress\u00E9e:"keypress",d\u00E9charger:"unload",touchercommencer:"touchstart",toucherfin:"touchend",toucherbouger:"touchmove",toucherannuler:"touchcancel"},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","taste unten":"keydown","taste oben":"keyup","maus dr\xFCber":"mouseover","maus weg":"mouseout",doppelklick:"dblclick",mauseintreten:"mouseenter",mausverlassen:"mouseleave",mausbewegen:"mousemove",tastedr\u00FCcken:"keypress",entladen:"unload",ber\u00FChrungstart:"touchstart",ber\u00FChrungend:"touchend",ber\u00FChrungbewegen:"touchmove",ber\u00FChrungabbrechen:"touchcancel"},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",tekan_tombol:"keydown",keyup:"keyup",arahkan:"mouseover",tinggalkan:"mouseout",bongkar:"unload"},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",kambiay:"change",apachiy:"submit",kachay:"submit",apaykachay:"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",bonyeza:"click",ingizo:"input",kitufe_shuka:"keydown",kitufe_juu:"keyup",panya_nje:"mouseout",wasilisha:"submit","sogeza juu":"mouseover",shuka:"unload"},vi:{"\u0111\u1ED5i k\xEDch th\u01B0\u1EDBc":"resize"}};Object.fromEntries(Object.entries(ye).map(([t,e])=>{let r={};for(let[i,n]of Object.entries(e))n in r||(r[n]=i);return [t,r]}));var Bu={debounced:"debounce",debounce:"debounce",throttled:"throttle",throttle:"throttle"},Fu=[["\u043E\u0434\u0438\u043D","_","\u0440\u0430\u0437"],["\u043E\u0434\u0438\u043D_\u0440\u0430\u0437"],["\u043E\u0434\u043D\u0430\u0436\u0434\u044B"],["m\u1ED9t","l\u1EA7n"],["once"]],Tu=/^(\d+)(ms|s|m)?$/,Ru=new Set(["selector","literal","url","event-modifier"]);function Ou(t){let e=t.match(Tu);if(!e)return null;let r=parseInt(e[1],10),i=e[2]||"ms";return i==="s"?r*=1e3:i==="m"&&(r*=6e4),r}function Pu(t){for(let e=1;e<t.length;e++){let r=t[e];if(Ru.has(r.kind))continue;let i=r.value.toLowerCase(),n=Bu[i];if(n){let a=0;for(let u=e+1;u<t.length;u++){let o=t[u],s=Ou(o.value);if(s!==null)return {modifiers:{[n]:s},start:r.position.start,end:o.position.end};if(o.kind==="selector"||o.kind==="literal"||o.kind==="url"||++a>2)break}continue}for(let a of Fu){if(a[0]!==i||e+a.length>t.length)continue;let u=true;for(let o=1;o<a.length;o++)if(t[e+o].value.toLowerCase()!==a[o]){u=false;break}if(u)return {modifiers:{once:true},start:r.position.start,end:t[e+a.length-1].position.end}}}return null}var ge=new Set(["if","unless","while","repeat","for"]),hr=new Set(["then","end","else","if","unless","while","for","repeat","and"]),_u=new Set(["first","last","next","previous","random","closest"]),Oe=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"]),et=class extends Error{constructor(t,e,r,i){super(t),this.name="SemanticParseError",this.language=e,this.input=r,this.diagnostics=i;}};function I(t,e,r){return {message:t,severity:e,source:"semantic-parser",...r&&{code:r}}}function j(t,e){return e.length===0?t:{...t,diagnostics:e}}var nr=120;function Mu(t,e,r){let i=e.tokens.length;if(t.consumedTokens>=i)return null;let n=e.tokens[t.consumedTokens],a=e.tokens[i-1];if(!n||!a)return null;let u=r.slice(n.position.start,a.position.end);if(!u.trim())return null;let o=u.length>nr?`${u.slice(0,nr)}\u2026`:u,s=i-t.consumedTokens;return `pattern ${t.pattern.id} left ${s} token(s) unconsumed: "${o}"`}var Lu=new Set(["to","from","into","onto","with","as","at","of","in","on","by","and","or","then","end","else","the","a","an","async"]);function vr(t){let e=[],r=new Set((t.diagnostics??[]).map(n=>`${n.code}|${n.message}`)),i=n=>{if(!n||typeof n!="object")return;if(n!==t)for(let u of n.diagnostics??[]){if(u.code!=="unconsumed-input")continue;let o=`${u.code}|${u.message}`;r.has(o)||(r.add(o),e.push(u));}let a=n;for(let u of Ft){let o=a[u];if(Array.isArray(o))for(let s of o)i(s);}};return i(t),e.length===0?t:j(t,[...t.diagnostics??[],...e])}function rt(t){if(t.length>=2){let e=t[0];if((e==='"'||e==="'")&&t.endsWith(e))return t.slice(1,-1)}return t}var Ft=["body","statements","thenBranch","elseBranch","eventHandlers","initBlock"];function Tt(t,e){if(!t||typeof t!="object")return t;if(t.action&&t.roles instanceof Map){let i=ee(t.action),n=i?.primaryRole;if(i&&n&&n!=="patient"&&!i.roles.some(a=>a.role==="patient")&&t.roles.has("patient")&&!t.roles.has(n)){let a=t.roles,u=a.get("patient");u!==void 0&&(a.delete("patient"),a.set(n,u));}if(t.action==="tell"){let a=t.roles,u=a.get("patient"),o=a.get("destination");u&&(u.type==="selector"||u.type==="reference")&&(!o||o.type==="literal")&&(a.delete("patient"),a.set("destination",u));}if(t.action==="fetch"){let a=t.roles,u=a.get("patient"),o=a.get("source");u&&o&&(u.type==="literal"||u.type==="expression")&&o.type==="expression"&&!a.has("style")&&(a.delete("patient"),a.set("style",o),a.set("source",u));}if(t.action==="transition"){let a=t.roles,u=a.get("destination");u&&u.type==="literal"&&!a.has("goal")&&(a.delete("destination"),a.set("goal",u));let o=a.get("patient");o&&o.type==="literal"&&typeof o.value=="string"&&/^[A-Za-z_][A-Za-z0-9_-]*$/.test(o.value)&&a.set("patient",{type:"expression",raw:o.value});}if(t.action==="morph"){let a=t.roles,u=a.get("patient");u&&u.type==="literal"&&typeof u.value=="string"&&/<[a-zA-Z][^>]*\/?>/.test(u.value)&&a.set("patient",{type:"expression",raw:u.value});}if(t.action==="wait"){let a=t.roles;if(!a.has("event")){let u=a.get("duration"),o=u?.type==="expression"?u.raw:u?.type==="literal"?u.value:void 0;typeof o=="string"&&Oe.has(o.toLowerCase())&&(a.delete("duration"),a.set("event",{type:"literal",value:o,dataType:"string"}));}}if(t.kind==="command"&&t.action!=="on"){let a=t.roles,u=a.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)&&a.set("event",{type:"literal",value:o,dataType:"string"});}}if(e?.size){let a=t.roles;for(let u of ["destination","source"]){let o=a.get(u);o&&o.type==="literal"&&typeof o.value=="string"&&e.has(o.value)&&a.set(u,{type:"expression",raw:o.value});}}}let r=t;for(let i of Ft){let n=r[i];if(Array.isArray(n))for(let a of n)Tt(a,e);}return t}var Z=class F{constructor(){this.parseDepth=0,this.coverageFrames=[],this.boundIdentifiers=new Set;}parse(e,r){this.parseDepth===0&&this.boundIdentifiers.clear(),this.parseDepth++,this.coverageFrames.push([]);try{let i=Tt(this.parseInternal(e,r),this.boundIdentifiers),n=this.coverageFrames[this.coverageFrames.length-1];if(n.length>0&&(i=j(i,[...i.diagnostics??[],...n])),this.parseDepth===1&&(i=vr(i),i.kind==="event-handler")){let a={node:i,input:e},u=a.node.eventModifiers;if(u&&(u.once||u.debounce!==void 0||u.throttle!==void 0))for(let s=0;s<4;s++){let l=this.reclaimDanglingFromTail(a.node,a.input,r)??this.reclaimEventCompoundTail(a.node,a.input,r)??this.reclaimResponseTypeTail(a.node,a.input,r)??this.reclaimCapturedDestinationTail(a.node,a.input,r);if(!l)break;a=l;}let o=this.reclaimEventCompoundTail(a.node,a.input,r);o&&(a=o),i=a.node;}return i}finally{this.coverageFrames.pop(),this.parseDepth--;}}coverageMark(){let e=this.coverageFrames[this.coverageFrames.length-1];return e?e.length:0}coverageRollback(e){let r=this.coverageFrames[this.coverageFrames.length-1];r&&r.length>e&&(r.length=e);}static getCoverageMarkerSurfaces(e){let r=F.coverageMarkerSurfaces.get(e);if(!r){r=new Set;let i=N(e)?.roleMarkers;if(i){for(let n of Object.values(i))if(n){if(n.primary)for(let a of n.primary.toLowerCase().split(/\s+/))r.add(a);for(let a of n.alternatives??[])for(let u of a.toLowerCase().split(/\s+/))r.add(u);}}for(let n of F.LEAKED_RENDER_MARKERS[e]??[])r.add(n.toLowerCase());F.coverageMarkerSurfaces.set(e,r);}return r}isCoverageResidueToken(e,r){if(e.kind==="particle"||e.kind==="conjunction"||e.metadata?.closesTrackedBlock||this.isThenKeyword(e.value,r)||this.isEndKeyword(e.value,r)||this.isElseKeyword(e.value,r))return true;let i=(e.normalized??e.value).toLowerCase();return Lu.has(i)?true:F.getCoverageMarkerSurfaces(r).has(e.value.toLowerCase())}recordDroppedTokens(e,r,i){if(e.length===0)return;let n=this.coverageFrames[this.coverageFrames.length-1];if(!n||!e.some(o=>!this.isCoverageResidueToken(o,r)))return;let a=e.map(o=>o.value).join(" ").trim();if(!a)return;let u=a.length>nr?`${a.slice(0,nr)}\u2026`:a;n.push(I(`${i} left ${e.length} token(s) unconsumed: "${u}"`,"warning","unconsumed-input"));}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=pu(e,r,{statement:(w,C)=>this.parse(w,C),body:(w,C)=>this.parseStatements(w,C)});if(i)return i;let n=bu(e,r,{statement:(w,C)=>this.parse(w,C),body:(w,C)=>this.parseStatements(w,C)});if(n)return n;let a=fu(e,r,{statement:(w,C)=>this.parse(w,C),body:(w,C)=>this.parseStatements(w,C)});if(a)return a;let{modifiers:u,remainingInput:o}=this.extractStandaloneModifiers(e,r),s=o||e,c=this.stripAsyncModifier(s,r).remainingInput??s,d=this.stripDoNotThrowModifier(c,r).remainingInput??c,p=[],y=U(d,r),E=me(r);if(E.length===0)throw new et(`No patterns available for language: ${r}`,r,d,[I(`No patterns registered for language '${r}'`,"error","no-patterns")]);let v=[...E].sort((w,C)=>C.priority-w.priority);{let w=y.tokens;if(N(r)?.wordOrder==="VSO"&&w.length>=4&&w[0]?.normalized==="source"){let C=w.findIndex(S=>S.normalized==="on");if(C>=2&&C+1<w.length){let S=d.slice(w[0].position.start,w[C].position.start).trim(),x=w[C+1].position.end,O=d.slice(w[C].position.start,x)+" "+S+d.slice(x);if(O!==d)try{let R=this.parse(O,r);if(R&&R.kind==="event-handler"){let P=u?this.applyModifiers(R,u):R;return j(P,p)}}catch{}}}}{let w=y.tokens,C=w[0]?.normalized==="if";for(let S=0;C&&S+3<w.length;S++){let x=(w[S+3]?.normalized??w[S+3]?.value??"").toLowerCase();if(w[S]?.normalized==="source"&&w[S+2]?.normalized==="on"&&F.KNOWN_EVENTS.has(x)){let O=(d.slice(0,w[S].position.start).trimEnd()+" "+d.slice(w[S+1].position.end).trimStart()).trim();if(O&&O!==d)try{let R=this.parse(O,r);if(R&&R.kind==="event-handler"){let P=u?this.applyModifiers(R,u):R;return j(P,p)}}catch{}break}}}{let w=y.tokens;for(let C=1;C<w.length-1;C++){let S=w[C],x=S.value,O=(S.normalized??S.value).toLowerCase();if(!(O==="or"||F.OR_KEYWORDS.has(x)||F.OR_KEYWORDS.has(O)))continue;let P=w[C+1],_=(P.normalized??P.value).toLowerCase();if(!F.KNOWN_EVENTS.has(_))break;let M=C+1,H=w[C+2];H&&H.kind==="selector"&&H.value.startsWith("[")&&(M=C+2);let G=w[C].position.start,fe=w[M].position.end,oe=(d.slice(0,G).trimEnd()+" "+d.slice(fe).trimStart()).trim();if(oe&&oe!==d)try{let he=this.parse(oe,r);if(he&&he.kind==="event-handler"){he.additionalEvents=[{type:"literal",value:_}];let mr=u?this.applyModifiers(he,u):he;return j(mr,p)}}catch{}break}}{let w=Pu(y.tokens);if(w){let C=(d.slice(0,w.start).trimEnd()+" "+d.slice(w.end).trimStart()).trim();if(C&&C!==d)try{let S=this.parse(C,r);if(S&&S.kind==="event-handler"){let x=this.applyModifiers(S,{...u??{},...w.modifiers});return j(x,p)}}catch{}}}let f=v.filter(w=>w.command==="on"),h=y.mark(),k=ae.matchBest(y,f);if(k){p.push(I(`event pattern matched: ${k.pattern.id} (confidence: ${k.confidence.toFixed(2)})`,"info","pattern-match"));let w=false;if(/^event-[a-z]+-bare$/.test(k.pattern.id)){let C=k.captured.get("event"),S=(C?.raw??C?.value??"").toString().toLowerCase(),x=ye[r],O=F.KNOWN_EVENTS.has(S)||!!x&&Object.keys(x).some(R=>R.toLowerCase()===S);if(S&&!O){let R=this.trySOVEventExtraction(d,r,v);if(R){p.push(I(`bare-event mis-anchor on "${S}" rejected; SOV extraction preferred`,"info","stage-bare-event-guard"));let P=u?this.applyModifiers(R,u):R;return j(P,p)}if(C?.type==="reference"||C?.type==="expression"){y.reset(h);let P=v.filter(M=>M.command!=="on"),_=ae.matchBest(y,P);y.reset(h),_&&_.pattern.command!=="on"?(w=true,p.push(I(`bare-event mis-anchor on reference "${S}" rejected; command ${_.pattern.command} preferred`,"info","stage-bare-event-guard"))):ae.matchBest(y,f);}}}if(!w){let C=this.buildEventHandler(k,y,r),S=u?this.applyModifiers(C,u):C;return j(S,p)}}p.push(I(`event patterns: ${f.length} tried, no match`,"info","stage-event"));let D=this.tryTrailingEventExtraction(d,r,v);if(D){p.push(I("trailing event extraction succeeded","info","stage-trailing-event"));let w=u?this.applyModifiers(D,u):D;return j(w,p)}let A=v.filter(w=>w.command!=="on"),z=ae.matchBest(y,A);if(z){if(ge.has(z.pattern.command)){let C=this.trySOVEventExtraction(d,r,v);if(C){p.push(I(`SOV event extraction preferred over bare ${z.pattern.command} command`,"info","stage-sov-loop"));let x=u?this.applyModifiers(C,u):C;return j(x,p)}let S=this.tryMidStreamEventExtraction(d,r,v);if(S){p.push(I(`mid-stream event extraction preferred over bare ${z.pattern.command} command`,"info","stage-midstream-loop"));let x=u?this.applyModifiers(S,u):S;return j(x,p)}}else if(F.KNOWN_EVENTS.has(z.pattern.command)&&this.hasSOVEventMarkerHead(d,r)){let C=this.trySOVEventExtraction(d,r,v);if(C){p.push(I(`SOV event extraction preferred over command-homonym event ${z.pattern.command}`,"info","stage-sov-homonym"));let S=u?this.applyModifiers(C,u):C;return j(S,p)}}else if(N(r)?.wordOrder==="VSO"){let C=this.tryMidStreamEventExtraction(d,r,v);if(C){p.push(I(`mid-stream event extraction preferred over bare ${z.pattern.command} command`,"info","stage-midstream-cmd"));let S=u?this.applyModifiers(C,u):C;return j(S,p)}}if(z.consumedTokens<y.tokens.length&&N(r)?.wordOrder==="SOV"){let C=this.trySOVEventExtraction(d,r,v);if(C){p.push(I(`SOV event extraction preferred over partial ${z.pattern.command} command (trailing remainder)`,"info","stage-sov-trailing"));let S=u?this.applyModifiers(C,u):C;return j(S,p)}}if(z.consumedTokens<y.tokens.length&&!ge.has(z.pattern.command)){let C=this.tryTopLevelCommandSequence(y,A,r);if(C)return p.push(I(`top-level command sequence: ${C.statements.length} commands`,"info","stage-top-level-sequence")),j(C,p)}p.push(I(`command pattern matched: ${z.pattern.id} (confidence: ${z.confidence.toFixed(2)})`,"info","pattern-match"));let w=Mu(z,y,d);return w&&p.push(I(w,"warning","unconsumed-input")),j(this.buildCommand(z,r),p)}if(p.push(I(`command patterns: ${A.length} tried, no match`,"info","stage-command")),!d.includes(`
|
|
4
|
+
`)&&N(r)?.wordOrder==="VSO"){let w=this.tryMidStreamEventExtraction(d,r,v);if(w){p.push(I("mid-stream event extraction succeeded with no leading command match","info","stage-midstream-nocmd"));let C=u?this.applyModifiers(w,u):w;return j(C,p)}}let g=this.trySOVEventExtraction(d,r,v);if(g){p.push(I("SOV event extraction succeeded","info","stage-sov"));let w=u?this.applyModifiers(g,u):g;return j(w,p)}p.push(I("SOV event extraction: no event keyword found","info","stage-sov"));let b=this.tryCompoundCommandParsing(y,A,r);if(b)return p.push(I("compound command parsing succeeded","info","stage-compound")),j(b,p);throw p.push(I("compound parsing: no then-keywords or no command matches","info","stage-compound")),p.push(I(`all parse stages exhausted for "${d}"`,"error","parse-failed")),new et(`Could not parse input in ${r}: ${d}`,r,d,p)}parseStatements(e,r){let i=U(e,r),n=me(r).filter(a=>a.command!=="on").sort((a,u)=>u.priority-a.priority);this.coverageFrames.push([]);try{let a=this.parseBodyWithClauses(i,n,r),u=this.coverageFrames[this.coverageFrames.length-1];if(u.length>0&&a.length>0){let o=a[a.length-1];a[a.length-1]=j(o,[...o.diagnostics??[],...u]);}return a}finally{this.coverageFrames.pop();}}canParse(e,r){try{return this.parse(e,r),!0}catch{return false}}supportedLanguages(){return Dt()}buildCommand(e,r){if(!e)throw new Error("No match to build command from");let i={};for(let[a,u]of e.captured)i[a]=u;let n=ne(e.pattern.command,i,{sourceLanguage:r,patternId:e.pattern.id,confidence:e.confidence});return this.registerBoundIdentifiers(n),n}buildEventHandler(e,r,i){if(!e)throw new Error("No match to build event handler from");let n=e.captured.get("event");if(!n)throw new Error("Event handler pattern matched but no event captured");{let m=n.type==="expression"?n.raw:n.type==="literal"?n.value:void 0;if(typeof m=="string"&&/^[^\s()[\]{}:]+$/.test(m)){let d=ye[i]?.[m];d?n={type:"literal",value:d,dataType:"string"}:n.type==="expression"&&F.KNOWN_EVENTS.has(m.toLowerCase())&&(n={type:"literal",value:m.toLowerCase(),dataType:"string"});}}let a=ae.extractEventModifiers(r),u=e.captured.get("source");u&&e.pattern.id.includes("source")&&!(u.type==="reference"&&u.value==="me")&&(a={...a??{},from:u});let o=this.extractOrConjunctionEvents(r,i),s=n;o.length>0&&n.type==="literal"&&(s={type:"literal",value:[String(n.value),...o.map(d=>String("value"in d?d.value:""))].join(" or ")});let l,c=e.captured.get("action");if(c&&c.type==="literal"&&c.value==="if"){let m=r.tokens,d=-1;for(let p=r.position()-1;p>=0;p--){let y=m[p],E=(y.normalized??y.value).toLowerCase();if(this.isIfKeyword(E,i)){d=p;break}}if(d>=0){let p=me(i).filter(k=>k.command!=="on").sort((k,D)=>D.priority-k.priority),y=m.slice(d);if(e.pattern.id.endsWith("vso-verb-first")&&s.type==="literal"){let k=String(s.value??"").split("[")[0].trim().toLowerCase(),D=y.findIndex((A,z)=>{if(z===0||k==="")return false;let g=(A.normalized??A.value).toLowerCase(),b=y[z-1];return g===k&&b.kind==="keyword"&&(b.normalized??"").toLowerCase()==="on"});if(D>0){let A=y[D+1],z=A&&A.kind==="selector"&&A.value.startsWith("[")?1:0;y=[...y.slice(0,D-1),...y.slice(D+1+z)];}}let E=new ie(y,i),v=this.coverageMark(),f=this.parseBodyWithClauses(E,p,i);if(f.some(k=>k.kind==="conditional")||f.length===1&&f[0]?.kind==="compound"&&f[0].statements.some(k=>k.kind==="conditional")){for(;!r.isAtEnd();)r.advance();return We(s,f,a,{sourceLanguage:i,patternId:e.pattern.id,confidence:e.confidence})}this.coverageRollback(v);}}if(c&&c.type==="literal"){let m=c.value,d={};for(let[A,z]of e.captured)A!=="event"&&A!=="action"&&A!=="continues"&&(d[A]=z);if(m==="repeat"){let A=r.peek(),z=b=>(b.normalized??b.value).toLowerCase();if(A&&A.kind==="keyword"&&z(A)==="forever")d.loopType={type:"literal",value:"forever"},delete d.patient,r.advance();else if(A&&A.kind==="keyword"&&z(A)==="event"){r.advance();let b=r.peek();if(b)for(d.event={type:"literal",value:z(b)},d.loopType={type:"literal",value:"until-event"},delete d.patient;!r.isAtEnd();){let w=r.peek();if(!w||w.kind==="conjunction"||w.kind==="keyword"&&(this.isThenKeyword(w.value,i)||this.isEndKeyword(w.value,i)))break;r.advance();}}let g=d.patient;g&&g.type==="reference"&&g.value==="me"&&delete d.patient;}let p=ne(m,d,{sourceLanguage:i,patternId:e.pattern.id,confidence:e.confidence});if(this.registerBoundIdentifiers(p),!ge.has(m)||m==="repeat"){let A=e.pattern.id.includes("verb-first"),z=r.tokens,g=r.position(),b=C=>C.kind==="conjunction"||C.kind==="keyword"&&(this.isThenKeyword(C.value,i)||this.isEndKeyword(C.value,i)),w=-1;for(let C=g-1;C>=0;C--){let S=z[C];if(b(S))break;if((S.normalized??S.value).toLowerCase()===m){w=C;break}}if(w>=0){let C=g;for(;C<z.length&&!b(z[C]);)C++;let S=z.slice(w,C),x=S;if(A){let O=String(n.value??"").toLowerCase(),R=S.findIndex(P=>(P.normalized??P.value).toLowerCase()===O);if(R<0)x=null;else {let P=S[R-1],_=P&&P.kind==="keyword"&&P.normalized?.toLowerCase()==="on"?R-1:R;x=[...S.slice(0,_),...S.slice(R+1)];}}if(x&&x.length>1){let O=me(i).filter(K=>K.command!=="on").sort((K,se)=>se.priority-K.priority),R=this.coverageMark(),P=this.parseClause(x,O,i),_=P[0],M=K=>K!==null&&typeof K=="object"&&typeof K.type=="string"?K.type:typeof K,H=ee(m),G=H?.primaryRole,fe=K=>K==="patient"&&G&&G!=="patient"&&!H?.roles.some(se=>se.role==="patient")?G:K,oe=(K,se)=>{if(!ge.has(m)||!H)return false;let De=H.roles.find(Ie=>Ie.role===fe(K));return De?De.expectedTypes.length>0&&!De.expectedTypes.includes(M(se)):true},he=!!_&&_.kind==="command"&&Object.entries(d).every(([K,se])=>{if(oe(K,se))return true;let De=_.roles.get(fe(K));if(De!==void 0&&M(De)===M(se))return true;if(K==="patient"&&m==="pick"&&M(se)==="literal"){let Ie=_.roles.get("method");return Ie!==void 0&&M(Ie)==="literal"&&String(Ie.value)===String(se.value)}return false}),mr=_?.metadata?.patternId??"",ei=!ge.has(m)||/^repeat-.*-(times|for-in|while-head|until-head)$/.test(mr);if(P.length===1&&_&&_.kind==="command"&&_.action===m&&he&&ei&&_.roles.size>Object.keys(d).length)for(p=_;r.position()<C;)r.advance();else this.coverageRollback(R);}}}if(!ge.has(m)){let A=p;if(ee(m)?.roles.some(x=>x.role==="quantity"&&!x.required)&&!A.roles.has("quantity")){let x=r.peek();x&&/^-?\d+(\.\d+)?$/.test(x.value)&&(p=ne(m,{...Object.fromEntries(A.roles),quantity:{type:"literal",value:parseFloat(x.value),dataType:"number"}},A.metadata),r.advance());}let g=p;if(ee(m)?.roles.some(x=>x.role==="duration"&&!x.required)&&!g.roles.has("duration")){let x=/^\d+(\.\d+)?(ms|s)$/i,O=r.peek(),R=false;if(O&&O.kind==="particle"){let P=r.peek(1);P&&x.test(P.value)&&(R=true,O=P);}O&&x.test(O.value)&&(p=ne(m,{...Object.fromEntries(g.roles),duration:{type:"literal",value:O.value,dataType:"string"}},g.metadata),R&&r.advance(),r.advance(),this.consumeForPostposition(r,i));}let w=p,C=ee(m);if(C?.roles.find(x=>x.role==="responseType"&&!x.required)&&!w.roles.has("responseType")){let x=M=>typeof M=="string"&&F.RESPONSE_TYPE_WORDS.has(M.toLowerCase()),O=(M,H)=>{let G=Object.fromEntries(w.roles);H&&delete G.destination,G.responseType={type:"expression",raw:M},p=ne(m,G,w.metadata);},R=w.roles.get("destination"),P=C?.roles.find(M=>M.role==="destination"),_=R?.raw??R?.value;if(R&&P&&!P.expectedTypes.includes(R.type)&&x(_))O(_,true);else {let M=r.peek();M&&x(M.value)&&(O(M.value,false),r.advance());}}if(m==="wait"){let x=p;if(!x.roles.has("event")){let O=r.peek();if(O&&Oe.has(O.value.toLowerCase())){let R=Object.fromEntries(x.roles),P=R.duration;P&&P.type!=="literal"&&P.type!=="expression"&&delete R.duration;let _=R.patient;_&&_.type==="reference"&&_.value==="me"&&delete R.patient,R.event={type:"literal",value:O.value,dataType:"string"},p=ne(m,R,x.metadata),r.advance(),this.consumeForPostposition(r,i);}}}this.tryAttachTrailingRole(r,p,i),this.tryAttachTrailingStyle(r,p,i),this.tryAttachTrailingExpressionRole(r,p,i);}let y=e.captured.get("continues"),E=y?.type==="literal"&&y.value==="then",v=r.peek(),f=!!v&&this.isThenKeyword(v.value,i),k=ge.has(m)&&!!v&&!this.isEndKeyword(v.value,i),D=!!v&&!this.isEndKeyword(v.value,i);if(E||f||k||D){let A=me(i).filter(b=>b.command!=="on").sort((b,w)=>w.priority-b.priority),z=me(i).filter(b=>b.id.startsWith("grammar-")&&b.id.includes("-continuation")).sort((b,w)=>w.priority-b.priority),g=this.parseBodyWithGrammarPatterns(r,A,z,i);g.length>0?l=[p,...g]:l=[p];}else l=[p],r.isAtEnd()||this.recordDroppedTokens(r.tokens.slice(r.position()),i,"handler body tail");}else {let m=me(i).filter(d=>d.command!=="on").sort((d,p)=>p.priority-d.priority);l=this.parseBodyWithClauses(r,m,i);}return We(s,l,a,{sourceLanguage:i,patternId:e.pattern.id,confidence:e.confidence})}parseBodyWithClauses(e,r,i){let n=[],a=[],u=0,o=[];for(;!e.isAtEnd();){let s=e.peek();if(!s)break;if(a.length===0){let y=this.consumeJsBlock(e,i);if(y){n.push(y);continue}let E=this.tryParseConditionalBlock(e,r,i);if(E){n.push(E);continue}}let l=s.kind==="conjunction"||s.kind==="keyword"&&this.isThenKeyword(s.value,i),c=a[a.length-1],m=e.peek(1),d=c?.value.toLowerCase()==="at"&&m?.value.toLowerCase()==="of"||$r(i,s.value,c?.value,m?.value),p=s.kind==="keyword"&&this.isEndKeyword(s.value,i)&&!d;if(p&&u>0){u--,o.pop(),a.push({...s,metadata:{...s.metadata,closesTrackedBlock:true}}),e.advance();continue}if(l&&o.includes("if")){a.push(s),e.advance();continue}if(l){if(a.length>0){let y=this.parseClause(a,r,i);n.push(...y),a.length=0,u=y.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(p){e.advance();let y=[];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;y.push(E),e.advance();}if(y.length>0){let E=this.coverageMark(),v=a.length>0?this.parseClause(a,r,i):[];v.length===0&&a.length>0?(this.coverageRollback(E),n.push(...this.parseClause([...a,...y],r,i))):(n.push(...v),n.push(...this.parseClause(y,r,i)));}else if(a.length>0){let E=this.parseClause(a,r,i);n.push(...E);}a.length=0;break}if(s.kind==="keyword"){let y=(s.normalized??s.value).toLowerCase();(this.isIfKeyword(y,i)||this.isUnlessKeyword(y,i)||y==="while"||y==="for"||y==="repeat")&&(u++,o.push(this.isIfKeyword(y,i)?"if":"other"));}a.push(s),e.advance();}if(a.length>0){let s=this.parseClause(a,r,i);n.push(...s);}e.isAtEnd()||this.recordDroppedTokens(e.tokens.slice(e.position()),i,"body stream tail"),this.foldFrontedWhileIntoRepeat(n,i);for(let s=n.length-1;s>=0;s--){let l=n[s];l.kind==="command"&&l.action==="for"&&(!(l.roles instanceof Map)||l.roles.size===0)&&(!Array.isArray(l.body)||l.body.length===0)&&n.splice(s,1);}return n.length>1?[zr(n,"then",{sourceLanguage:i})]:n}tryTopLevelCommandSequence(e,r,i){let n=this.coverageMark(),a;try{let l=new ie(e.tokens,i);a=this.parseBodyWithClauses(l,r,i);}catch{return this.coverageRollback(n),null}if(a.length!==1||a[0].kind!=="compound")return this.coverageRollback(n),null;let u=a[0];if(u.statements.length<2)return this.coverageRollback(n),null;let o=u.statements.map(l=>l.metadata?.confidence??.75),s=o.reduce((l,c)=>l+c,0)/o.length;return zr(u.statements,u.chainType,{sourceLanguage:i,confidence:s})}foldFrontedWhileIntoRepeat(e,r){for(let i=0;i+1<e.length;i++){let n=e[i],a=e[i+1];if(n.kind!=="command"||n.action!=="while"||a.kind!=="command"||a.action!=="repeat")continue;let u=n.roles.get("condition");if(!u||a.roles.has("condition")||Array.isArray(n.body)||Array.isArray(a.body))continue;let o=new Map(a.roles);o.set("condition",u),o.set("loopType",{type:"literal",value:"while",dataType:"string"}),e.splice(i,2,{...a,roles:o,metadata:{...a.metadata,sourceLanguage:r,patternId:`repeat-${r}-fronted-while-fold`,confidence:Math.max(a.metadata?.confidence??0,n.metadata?.confidence??0)}});}}parseClause(e,r,i){if(e.length===0)return [];let n=null,a=e,u=e[e.length-1];if(u&&e.length>=2){let f=(u.normalized??u.value).toLowerCase();this.isUnlessKeyword(f,i)&&(n="unless",a=e.slice(0,-1));}let o=null;if(n&&a.length>=3){let f=N(i),h=f?F.buildVerbLookup(f):null;if(h)for(let k=1;k<a.length-1;k++){let D=a[k],A=h.get(D.value.toLowerCase())??(D.normalized?h.get(D.normalized.toLowerCase()):void 0);if(A&&!F.CONDITION_OPERATORS.has(A)){o=a.slice(0,k),a=a.slice(k);break}}}let s=new ie(a,i),l=[],c=this.coverageMark(),m=0,d=[],p=o,y=()=>{if(d.length===0)return;let f=d.slice();if(d.length=0,n&&l.length===0&&p===null){p=f;return}let h=f[0];if(!(h&&(h.kind==="identifier"||h.kind==="selector"||h.kind==="literal"||h.kind==="reference"))){this.recordDroppedTokens(f,i,"body clause");return}let D=false;for(let A of this.parseSOVClauseByVerbAnchoring(f,i)){let z=A.action,g=A.roles;z&&ee(z)&&g instanceof Map&&g.size>0&&(l.push(A),D=true);}D||this.recordDroppedTokens(f,i,"body clause");};for(;!s.isAtEnd();){let f=s.peek(),h=!!f&&f.normalized?.toLowerCase()==="repeat",k=s.mark(),D=ae.matchBest(s,r);if(h&&D&&D.pattern.command!=="repeat"){s.reset(k),y(),l.push(ne("repeat",{},{sourceLanguage:i,confidence:.6})),m++,s.advance();continue}if(D&&D.pattern.command==="if"){let A=s.mark(),z=d.length;for(s.reset(k);!s.isAtEnd();){let b=s.peek();if(!b||this.isIfKeyword((b.normalized??b.value).toLowerCase(),i))break;d.push(b),s.advance();}let g=this.tryParseConditionalBlock(s,r,i);if(g){y(),l.push(g),m++;continue}d.length=z,s.reset(A);}if(D){y();let A=this.buildCommand(D,i);l.push(A),m++,this.tryAttachTrailingRole(s,A,i),this.tryAttachTrailingStyle(s,A,i),this.tryAttachTrailingExpressionRole(s,A,i);}else {let A=s.peek();A&&A.normalized?.toLowerCase()==="repeat"?(y(),l.push(ne("repeat",{},{sourceLanguage:i,confidence:.6})),m++):A&&d.push(A),s.advance();}}y();let E=l;if(m===0){let f=this.parseSOVClauseByVerbAnchoring(a,i);f.length>0&&(this.coverageRollback(c),E=f);}let v=p;return n&&E.length>0&&v&&v.length>0?[ne(n,{condition:{type:"expression",raw:this.joinTokenText(v,i)}},{sourceLanguage:i,patternId:`${n}-${i}-trailing-guard`,confidence:.85}),...E]:(n&&v&&v.length>0&&E.length===0&&this.recordDroppedTokens(v,i,"body clause"),E)}tryAttachTrailingRole(e,r,i){let n=ee(r.action);if(!n)return;let a=N(i);if(!a)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 hr.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(!n.roles.some(v=>v.role===l))continue;let m=a.roleMarkers?.[l];if(!m)continue;let d=u.get(l);if(d&&!(d.type==="reference"&&d.value==="me"))continue;let p=v=>{if(!v||v.kind!=="particle"&&v.kind!=="keyword")return false;let f=v.value.toLowerCase();return m.primary?.toLowerCase()===f?true:c?false:(v.normalized??"").toLowerCase()===l?true:!!m.alternatives?.some(h=>h.toLowerCase()===f)},y=e.peek(),E=e.peek(1);if(!y||!E)return;if(c&&m.position==="after"){let v=e.peek(2),f=(y.normalized??y.value).toLowerCase();if(_u.has(f)&&E.kind==="selector"&&p(v)){u.set(l,{type:"expression",raw:`${f} ${E.value}`}),e.advance(),e.advance(),e.advance();return}}if(m.position==="after"){if(o(y,c)&&p(E)){let v=this.tokenToSemanticValue(y);e.advance(),e.advance(),v&&u.set(l,v);return}if(c&&o(y,c)){let v=e.peek(2),f=e.peek(3);if((E.normalized??E.value).toLowerCase()==="in"&&v&&!p(v)&&p(f)){let h=this.tokenToSemanticValue(y);e.advance(),e.advance(),e.advance(),e.advance(),h&&u.set(l,h);return}}}else if(p(y)&&o(E,c)){e.advance();let v=this.tokenToSemanticValue(e.advance());v&&u.set(l,v);return}}}tryAttachTrailingStyle(e,r,i){if(r.action!=="fetch"&&r.action!=="render")return;let n=r.roles;if(!ee(r.action)?.roles.some(f=>f.role==="style"))return;let u=n.get("style");if(u){if(u.type==="expression"&&typeof u.raw=="string"&&/^[A-Za-z_][\w-]*$/.test(u.raw)&&e.peek()?.value===":"){let f=Ke(e,u.raw);f&&(n.set("style",{type:"expression",raw:f}),this.tryAttachResponseTypeAfterStyle(e,r,i));}return}if(r.action==="fetch"){let f=n.get("patient"),h=n.get("source");if(f&&h&&(f.type==="literal"||f.type==="expression")&&h.type==="expression"&&typeof h.raw=="string"&&/^[A-Za-z_][\w-]*$/.test(h.raw)&&e.peek()?.value===":"){let k=Ke(e,h.raw);k&&(n.set("source",{type:"expression",raw:k}),this.tryAttachResponseTypeAfterStyle(e,r,i));return}}let s=N(i)?.roleMarkers?.style;if(!s)return;if(s.position==="before"){let f=new Set([s.primary,...s.alternatives??[]].map(A=>A.toLowerCase())),h=e.peek();if(!h||!f.has(h.value.toLowerCase()))return;let k=e.mark();e.advance();let D=Ke(e);if(!D){e.reset(k);return}n.set("style",{type:"expression",raw:D}),this.tryAttachResponseTypeAfterStyle(e,r,i);return}if(s.position!=="after")return;let l=new Set([s.primary,...s.alternatives??[]].map(f=>f.toLowerCase())),c=f=>f.kind==="conjunction"||f.kind==="keyword"&&(this.isThenKeyword(f.value,i)||this.isEndKeyword(f.value,i)),m=24,d=-1,p=0;for(let f=0;f<m;f++){let h=e.peek(f);if(!h||c(h))break;if(h.value==="("||h.value==="{"?p++:(h.value===")"||h.value==="}")&&(p=Math.max(0,p-1)),p===0&&(h.kind==="particle"||h.kind==="keyword")&&l.has(h.value.toLowerCase())){d=f;break}}if(d<=0)return;let y=[];for(let f=0;f<d;f++){let h=e.peek(f);h&&y.push(h);}if(y.length===1&&F.RESPONSE_TYPE_WORDS.has(y[0].value.toLowerCase()))return;let E=new ie(y,i),v=Ke(E);n.set("style",{type:"expression",raw:v&&E.isAtEnd()?v:this.joinTokenText(y,i)});for(let f=0;f<=d;f++)e.advance();this.tryAttachResponseTypeAfterStyle(e,r,i);}tryAttachResponseTypeAfterStyle(e,r,i){let n=r.roles;if(n.has("responseType")||!ee(r.action)?.roles.some(c=>c.role==="responseType"&&!c.required))return;let u=c=>!!c&&F.RESPONSE_TYPE_WORDS.has(c.toLowerCase()),o=e.peek();if(!o)return;let s=c=>{n.set("responseType",{type:"expression",raw:c});};if(F.AS_MARKERS_BEFORE[i]?.some(c=>o.value.toLowerCase()===c)){let c=e.peek(1);c&&u(c.value)&&(e.advance(),e.advance(),s(c.value));return}if(u(o.value)){e.advance(),s(o.value);for(let c of F.AS_MARKERS_AFTER[i]??[])if(c.every((m,d)=>e.peek(d)?.value.toLowerCase()===m)){for(let m=0;m<c.length;m++)e.advance();break}}}tryAttachTrailingExpressionRole(e,r,i){let n=r.action,a=n==="js"?{role:"patient",terminator:"boundary"}:n==="go"||n==="scroll"?{role:"destination",terminator:"destination-marker"}:null;if(!a)return;let u=r.roles,o=u.get(a.role);if(n==="go"&&o&&o.type==="expression"&&String(o.raw).toLowerCase()==="url"){let f=e.peek();if(f&&!hr.has((f.normalized??f.value).toLowerCase())){let k=this.tokenToSemanticValue(f);if(k.type==="literal"||k.type==="selector"){u.set(a.role,k),u.set("method",{type:"literal",value:"url"}),e.advance();return}}let h=u.get("patient");if(h&&(h.type==="literal"||h.type==="selector")){u.set(a.role,h),u.set("method",{type:"literal",value:"url"}),u.delete("patient");return}}if(n==="go"&&o&&o.type==="expression"){let f=/^url\s+(\S+)$/i.exec(String(o.raw??""));if(f){let h=f[1].replace(/^["']|["']$/g,"");u.set(a.role,{type:"literal",value:h,dataType:"string"}),u.set("method",{type:"literal",value:"url"});return}}if(n==="go"&&!o){let f=u.get("patient");if(f&&f.type==="expression"&&String(f.raw).toLowerCase()==="url"){let h=e.peek();if(h&&!hr.has((h.normalized??h.value).toLowerCase())){let k=this.tokenToSemanticValue(h);if(k.type==="literal"||k.type==="selector"){u.set(a.role,k),u.set("method",{type:"literal",value:"url"}),u.delete("patient"),e.advance();return}}}}if(o&&!(o.type==="reference"&&o.value==="me"))return;let s=N(i);if(!s)return;let l=null;if(a.terminator==="destination-marker"){let f=s.roleMarkers?.destination;if(!f||f.position!=="after")return;l=f.primary.toLowerCase();}let c=f=>f.kind==="conjunction"||f.kind==="keyword"&&(this.isThenKeyword(f.value,i)||this.isEndKeyword(f.value,i)),m=24,d=[],p=0,y=false;for(let f=0;f<m;f++){let h=e.peek(f);if(!h||c(h))break;if(h.value==="("||h.value==="{"?p++:(h.value===")"||h.value==="}")&&(p=Math.max(0,p-1)),l!==null&&p===0&&(h.kind==="particle"||h.kind==="keyword")&&h.value.toLowerCase()===l){y=true;break}d.push(h);}if(d.length===0||l!==null&&!y)return;let E=d.length+(y?1:0);if(n==="go"&&d.length===2&&d[0].value.toLowerCase()==="url"){let f=this.tokenToSemanticValue(d[1]);if(f.type==="literal"||f.type==="selector"){u.set(a.role,f),u.set("method",{type:"literal",value:"url"});let h=u.get("patient");h&&h.type==="reference"&&h.value==="me"&&!ee(n)?.roles.some(k=>k.role==="patient")&&u.delete("patient");for(let k=0;k<E;k++)e.advance();return}}let v=d;if(n==="js"){let f=s.keywords?.js,h=D=>[f?.primary,...f?.alternatives??[]].some(A=>!!A&&A.length>D.value.length&&A.includes(D.value)),k=0;for(;k<v.length&&h(v[k]);)k++;if(v=v.slice(k),v.length===0)return}if(u.set(a.role,{type:"expression",raw:this.joinTokenText(v,i)}),a.role!=="patient"){let f=u.get("patient");f&&f.type==="reference"&&f.value==="me"&&!ee(n)?.roles.some(h=>h.role==="patient")&&u.delete("patient");}for(let f=0;f<E;f++)e.advance();}static buildVerbLookup(e){let r=new Map;for(let[i,n]of Object.entries(e.keywords))if(!["on","if","else","when","where","while","end","then","and"].includes(i)&&(r.set(n.primary.toLowerCase(),i),n.alternatives))for(let a of n.alternatives)r.set(a.toLowerCase(),i);return r}static buildMarkerToRoleLookup(e){let r=new Map;for(let[i,n]of Object.entries(e.roleMarkers)){if(!n)continue;if((i!=="event"||!r.has(n.primary))&&r.set(n.primary,i),n.alternatives)for(let u of n.alternatives)r.has(u)||r.set(u,i);}return r}parseSOVClauseByVerbAnchoring(e,r){let i=N(r);if(!i||i.wordOrder!=="SOV")return [];let n=F.buildVerbLookup(i),a=F.buildMarkerToRoleLookup(i),u=[],o=0;for(;o<e.length;){let s=-1,l="";for(let y=o;y<e.length;y++){let E=e[y];if(a.has(E.value))continue;let v=n.get(E.value.toLowerCase()),f=E.normalized?n.get(E.normalized.toLowerCase()):void 0,h=v||f;if(h){s=y,l=h;break}}if(s===-1)break;let c=e.slice(o,s),m=e.length;for(let y=s+1;y<e.length;y++){let E=e[y];if(E.kind==="conjunction"||this.isThenKeyword(E.value,r)){m=y;break}if(y>s+1&&!a.has(E.value)&&(n.get(E.value.toLowerCase())||(E.normalized?n.get(E.normalized.toLowerCase()):void 0))){m=y;break}}let d=e.slice(s+1,m),p=this.extractRolesFromMarkedTokens(c,d,a,l,r);if(u.push(ne(l,p,{sourceLanguage:r,confidence:.7})),o=m,o<e.length){let y=e[o];(y.kind==="conjunction"||this.isThenKeyword(y.value,r))&&o++;}}return u}extractRolesFromMarkedTokens(e,r,i,n,a){let u={},o=(l,c)=>{let m=this.isEndKeyword(l.value,a),d=l.kind==="keyword"&&(l.normalized??"").toLowerCase()==="end";return !m&&!d?false:l.metadata?.closesTrackedBlock===true||m?true:!(c&&c.kind==="selector")},s=l=>{let c=[];for(let m=0;m<l.length;m++){let d=l[m];if(o(d,l[m+1]))continue;let p=i.get(d.value);if(p&&d.kind==="particle"&&c.length>0){let y=this.tokensToSemanticValue(c,a);if(y){let E=this.mapRoleForCommand(p,n,u);E&&(u[E]=y);}c=[];}else c.push(d);}if(c.length>0)if(c.length===1&&/^\d+(\.\d+)?(ms|s)$/i.test(c[0].value)&&!u.duration&&ee(n)?.roles.some(d=>d.role==="duration"))u.duration={type:"literal",value:c[0].value,dataType:"string"};else {let d=this.tokensToSemanticValue(c,a);d&&(u.patient?u.destination||(u.destination=d):u.patient=d);}};return s(e),s(r),u}mapRoleForCommand(e,r,i){return r==="set"&&(e==="patient"?e="destination":e==="destination"&&(e="patient")),i[e]?e==="patient"&&!i.destination?"destination":e==="destination"&&!i.patient?"patient":e==="source"&&!i.source?"source":null:e}tokensToSemanticValue(e,r){if(e.length===0)return null;let i=e.filter(u=>u.kind!=="whitespace");if(i.length===0)return null;if(i.length>=2&&(i[0].kind==="selector"||/^[#.@*<]/.test(i[0].value))){let u=i.findIndex((o,s)=>s>0&&(o.normalized??o.value).toLowerCase()==="in");u>0&&(i=i.slice(0,u));}if(i.length===1)return this.tokenToSemanticValue(i[0]);let n=i.map(u=>u.value).join(""),a=i[0];return a.kind==="selector"||a.value.startsWith("#")||a.value.startsWith(".")||a.value.startsWith("@")||a.value.startsWith("*")?ze(n):a.kind==="literal"||a.value.startsWith('"')||a.value.startsWith("'")?q(rt(n),"string"):a.kind==="reference"?ue(n):q(this.joinTokenText(i,r))}tokenToSemanticValue(e){let r=e.value;if(e.kind==="selector"||r.startsWith("#")||r.startsWith(".")||r.startsWith("@")||r.startsWith("*"))return ze(r);if(r.startsWith('"')||r.startsWith("'"))return q(rt(r),"string");if(/^-?\d+(\.\d+)?$/.test(r))return q(parseFloat(r));if(r==="true"||r==="\u771F"||r==="\uCC38"||r==="do\u011Fru")return q(true);if(r==="false"||r==="\u507D"||r==="\uAC70\uC9D3"||r==="yanl\u0131\u015F")return q(false);if(r.length>1&&(r.startsWith(":")||r.startsWith("$")))return ue(r);let i=e.normalized?.toLowerCase();return i==="me"||i==="it"||i==="you"||i==="result"||i==="body"?ue(i):e.kind==="reference"?ue(e.normalized||"me"):q(r)}parseBodyWithGrammarPatterns(e,r,i,n){let a=[],u=[],o=false,s=()=>{if(!o&&u.length>0){let m=this.parseSOVClauseByVerbAnchoring(u,n);a.push(...m),m.length===0&&this.recordDroppedTokens(u,n,"fused body walk");}else u.length>0&&this.recordDroppedTokens(u,n,"fused body walk");u=[],o=false;},l=0,c=()=>{let m=0;for(let d of a){let p=d;(p.action==="for"||p.action==="repeat"||p.action==="while")&&(!Array.isArray(p.body)||p.body.length===0)&&m++;}return m-l};for(;!e.isAtEnd();){let m=e.peek();if(m&&this.isThenKeyword(m.value,n)){s(),e.advance();continue}if(m&&this.isEndKeyword(m.value,n)){let p=e.peek(-1),y=e.peek(1);if(!$r(n,m.value,p?.value,y?.value)){if(s(),c()>0){l++,e.advance();continue}e.advance();break}}if(m&&!o&&this.isIfKeyword((m.normalized??m.value).toLowerCase(),n)){s();let p=this.tryParseConditionalBlock(e,r,n);if(p){a.push(p),o=true;continue}}let d=false;if(i.length>0){let p=ae.matchBest(e,i);if(p){let y=p.pattern.command,E={};for(let[h,k]of p.captured)h!=="event"&&h!=="action"&&h!=="continues"&&(E[h]=k);let v=ne(y,E,{sourceLanguage:n,patternId:p.pattern.id});a.push(v),d=true,o=true;let f=p.captured.get("continues");if(f&&f.type==="literal"&&f.value==="then")continue}}if(!d){let p=e.mark(),y=ae.matchBest(e,r);if(y){if(y.pattern.command==="if"){let v=e.mark();for(e.reset(p);!e.isAtEnd();){let h=e.peek();if(!h||this.isIfKeyword((h.normalized??h.value).toLowerCase(),n))break;e.advance();}let f=this.tryParseConditionalBlock(e,r,n);if(f){s(),a.push(f),o=true;continue}e.reset(v);}let E=this.buildCommand(y,n);a.push(E),this.tryAttachTrailingRole(e,E,n),d=true,o=true;}}d||(m&&u.push(m),e.advance());}s(),e.isAtEnd()||this.recordDroppedTokens(e.tokens.slice(e.position()),n,"fused body walk");for(let m=a.length-1;m>=0;m--){let d=a[m];d.kind==="command"&&d.action==="for"&&(!(d.roles instanceof Map)||d.roles.size===0)&&(!Array.isArray(d.body)||d.body.length===0)&&a.splice(m,1);}return a}tryCompoundCommandParsing(e,r,i){let n=e.tokens,a=n.some(c=>c.kind==="conjunction"||c.kind==="keyword"&&this.isThenKeyword(c.value,i)),u=n.some(c=>this.isElseKeyword(c.value,i));if(!a&&!u)return null;let o=new ie(n,i),s=this.coverageMark(),l=this.parseBodyWithClauses(o,r,i);return l.length===0?(this.coverageRollback(s),null):l[0]}matchEventMarkerPhrase(e,r,i){let n=F.SOV_EVENT_MARKER_PHRASES[i];if(!n)return 0;for(let a of n)if(a.every((u,o)=>e[r+o]?.value===u))return a.length;return 0}hasSOVEventMarkerHead(e,r){let i=F.SOV_EVENT_MARKERS[r];if(i===void 0)return false;let{tokens:n}=U(e,r),a=ye[r],u=new Set;if(a)for(let o of Object.keys(a))u.add(o.toLowerCase());for(let o=0;o<n.length;o++){let s=n[o],l=s.value.toLowerCase(),c=s.normalized?.toLowerCase();if(!(!!c&&(F.KNOWN_EVENTS.has(c)||Oe.has(c))||F.KNOWN_EVENTS.has(l)||Oe.has(l)||u.has(l)))continue;let d=this.matchEventParamPhrase(n,o+1).len,p=n[o+1+d];if(p&&(p.kind==="particle"||p.kind==="keyword")&&i.has(p.value)||this.matchEventMarkerPhrase(n,o+1+d,r)>0)return true}return false}matchEventParamPhrase(e,r){if(e[r]?.value!=="(")return {len:0,names:[]};let i=[];for(let n=r+1;n<e.length;n++){let a=e[n].value;if(a===")")return {len:n-r+1,names:i};if(a!==","){if(e[n].kind!=="identifier")break;i.push(a);}}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 n=e.value.toLowerCase();return r.has(n)||!!i&&r.has(i)}tryTrailingEventExtraction(e,r,i){let n=U(e,r).tokens;if(n.length<3)return null;let a=ye[r],u=new Set;if(a)for(let D of Object.keys(a))u.add(D.toLowerCase());let o=n.length-2,s=n[o];if(!(s.kind==="keyword"&&s.normalized?.toLowerCase()==="on"))return null;let c=n[n.length-1],m=c.value.toLowerCase(),d=c.normalized?.toLowerCase();if(!(!!d&&F.KNOWN_EVENTS.has(d)||F.KNOWN_EVENTS.has(m)||u.has(m)))return null;let y=d&&F.KNOWN_EVENTS.has(d)?d:a?.[m]??m,E=n.slice(0,o);if(E.length===0)return null;let v=i.filter(D=>D.command!=="on"),f=new ie(E,r),h=this.coverageMark(),k=this.parseBodyWithClauses(f,v,r);return k.length===0?(this.coverageRollback(h),null):We({type:"literal",value:y},k,void 0,{sourceLanguage:r,confidence:.75})}tryMidStreamEventExtraction(e,r,i){let n=U(e,r).tokens;if(n.length<3)return null;let a=ye[r],u=new Set;if(a)for(let o of Object.keys(a))u.add(o.toLowerCase());for(let o=0;o<n.length-1;o++){let s=n[o];if(!(s.kind==="keyword"&&s.normalized?.toLowerCase()==="on"))continue;let c=n[o+1],m=c.value.toLowerCase(),d=c.normalized?.toLowerCase();if(!(!!d&&F.KNOWN_EVENTS.has(d)||F.KNOWN_EVENTS.has(m)||u.has(m)))continue;let y=d&&F.KNOWN_EVENTS.has(d)?d:a?.[m]??m,E=n.filter((D,A)=>A!==o&&A!==o+1);if(E.length===0)return null;let v=i.filter(D=>D.command!=="on"),f=new ie(E,r),h=this.coverageMark(),k=this.parseBodyWithClauses(f,v,r);return k.length===0?(this.coverageRollback(h),null):We({type:"literal",value:y},k,void 0,{sourceLanguage:r,confidence:.75})}return null}trySOVEventExtraction(e,r,i){let n=F.SOV_EVENT_MARKERS[r];if(!n)return null;let u=U(e,r).tokens,o=ye[r],s=new Set;if(o)for(let z of Object.keys(o))s.add(z.toLowerCase());let l=F.SOV_SOURCE_MARKERS[r],c=-1,m="",d="",p=1,y=[];for(let z=0;z<u.length;z++){let g=u[z],b=g.value.toLowerCase(),w=b,C="",S=b.indexOf("[");S>0&&(w=b.slice(0,S),C=g.value.slice(S));let x=g.normalized?.toLowerCase(),O=x&&(F.KNOWN_EVENTS.has(x)||Oe.has(x)),R=s.has(b)||s.has(w),P=F.KNOWN_EVENTS.has(w)||Oe.has(w);if(O||R||P){let _=u[z-1];if(_&&(_.normalized??_.value).toLowerCase()==="event")continue;let M;O?M=x:R?M=o?.[b]??o?.[w]??w:M=w;let H=this.matchEventParamPhrase(u,z+1);if(n.size>0){let G=1+H.len,fe=u[z+G];fe&&fe.kind==="selector"&&fe.value.startsWith("[")&&(G+=1);let oe=u[z+G];if(oe&&(oe.kind==="particle"||oe.kind==="keyword")&&n.has(oe.value)){c=z,m=M,d=C||(G===H.len+2?u[z+G-1].value:""),p=G+1,y=H.names;break}}else {c=z,m=M,d=C,p=1+H.len+this.matchEventMarkerPhrase(u,z+1+H.len,r),y=H.names;break}}}if(c===-1){let z=new Set(i.filter(g=>g.command!=="on").map(g=>g.command));for(let g=0;g<u.length;g++){let b=u[g];if(b.kind==="identifier")if(n.size>0){let w=1,C=u[g+1];C&&C.kind==="selector"&&C.value.startsWith("[")&&(w=2);let S=u[g+w];if(S&&(S.kind==="particle"||S.kind==="keyword")&&n.has(S.value)){c=g,m=b.value,d=w===2?u[g+1].value:"",p=w+1;break}}else {let w=this.matchEventMarkerPhrase(u,g+1,r);if(w>0){c=g,m=b.value,d="",p=1+w;break}let C=u[g+1];if(C&&C.kind==="keyword"&&C.normalized!=null&&z.has(C.normalized)){c=g,m=b.value,d="",p=1;break}}}}if(c===-1)return null;let E=new Set;for(let z=c;z<c+p;z++)E.add(z);if(l){let z=c+p;if(z<u.length){let g=u[z];if((g.kind==="particle"||g.kind==="keyword")&&l.markers.has(g.value))E.add(z);else if(this.isStrippableSourceRef(g,l.windowTokens)){let b=u[z+1];b&&(b.kind==="particle"||b.kind==="keyword")&&l.markers.has(b.value)&&(E.add(z),E.add(z+1));}}if(c>=2){let g=u[c-1];(g.kind==="particle"||g.kind==="keyword")&&l.markers.has(g.value)&&this.isStrippableSourceRef(u[c-2],l.windowTokens)&&(E.add(c-2),E.add(c-1));}for(let g=0;g<c;g++){let b=u[g],w=b.value.toLowerCase(),C=b.normalized?.toLowerCase();if(l.windowTokens.has(w)||C&&l.windowTokens.has(C)){E.add(g);break}}}let v=u.filter((z,g)=>!E.has(g));if(v.length===0)return null;let f=i.filter(z=>z.command!=="on"),h=new ie(v,r),k=this.coverageMark(),D=this.parseBodyWithClauses(h,f,r);if(D.length===0)return this.coverageRollback(k),null;let A={sourceLanguage:r,confidence:.75};return d&&(A.keyFilter=d),We({type:"literal",value:m},D,void 0,A,y)}profileKeywordMatches(e,r,i){let n=N(e)?.keywords?.[r];return n?n.primary?.toLowerCase()===i?true:!!n.alternatives?.some(a=>a.toLowerCase()===i):false}consumeForPostposition(e,r){let i=e.peek();if(!i)return;let n=(i.normalized??"").toLowerCase(),a=N(r)?.keywords?.for;(n==="for"||i.value===a?.primary||(a?.alternatives??[]).includes(i.value))&&e.advance();}isThenKeyword(e,r){let i=e.toLowerCase(),a={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 a?a.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=Za(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 n=e.mark(),a=[];e.advance();let u=e.peek();u&&i.position?.end!==void 0&&i.position.end===u.position?.start&&this.profileKeywordMatches(r,"js",`${i.value}${u.value}`.toLowerCase())&&e.advance();let o=false;for(;!e.isAtEnd();){let l=e.peek();if(!l)break;if(e.advance(),this.isEndKeyword(l.value,r)){o=true;break}a.push(l);}if(!o)return e.reset(n),null;let s=a.map(l=>l.value).join(" ").trim();return ne("js",{patient:{type:"expression",raw:s||"()"}},{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 n=e.peek();if(!n)return null;let a=(n.normalized??n.value).toLowerCase();if(!this.isIfKeyword(a,i))return null;let u=e.mark(),o=this.coverageMark();e.advance();let s=[],l=0;for(;!e.isAtEnd();){let g=e.peek();if(!g)break;let b=(g.normalized??g.value).toLowerCase();if(this.isIfKeyword(b,i)||this.isUnlessKeyword(b,i)){l++,s.push(g),e.advance();continue}if(this.isBlockEndToken(g,e.peek(1)??void 0,i)){if(l===0){e.advance();break}l--,s.push(g),e.advance();continue}s.push(g),e.advance();}if(s.length===0)return e.reset(u),this.coverageRollback(o),null;let c=N(i),m=c?.wordOrder==="SOV"?F.buildVerbLookup(c):null,d=0,p=0,y=[];for(;d<s.length;d++){let g=s[d],b=(g.normalized??g.value).toLowerCase();if(this.isIfKeyword(b,i)||this.isUnlessKeyword(b,i)?p++:this.isBlockEndToken(g,s[d+1],i)&&p--,p===0&&this.isThenKeyword(g.value,i)){d++;break}if(p===0&&y.length>0){let w=(s[d-1].normalized??s[d-1].value).toLowerCase(),C=s[d-1].value.toLowerCase(),S=(g.normalized??g.value).toLowerCase(),x=F.CONDITION_COPULAS.has(w)||F.CONDITION_COPULAS_SURFACE.has(C)&&F.CONDITION_PREDICATES.has(S),O=m!==null&&m.has(g.value.toLowerCase())&&!F.CONDITION_PREDICATES.has(S),R=/^\.[a-zA-Z_]\w*$/.test(g.value)&&s[d-1].position?.end!==void 0&&g.position?.start!==void 0&&s[d-1].position.end===g.position.start;if(!F.CONDITION_OPERATORS.has(S)&&!R&&(!x||O)&&(this.tokensBeginCommand(s.slice(d),r,i)||this.sovCommandStartsAt(s.slice(d),m)))break}y.push(g);}if(y.length===0)return e.reset(u),this.coverageRollback(o),null;let v=[],f=[],h=false,k=0;for(;d<s.length;d++){let g=s[d],b=(g.normalized??g.value).toLowerCase();if(this.isIfKeyword(b,i)||this.isUnlessKeyword(b,i)?k++:this.isBlockEndToken(g,s[d+1],i)&&k--,k===0&&!h&&this.isElseKeyword(g.value,i)){h=true;continue}(h?f:v).push(g);}let D={type:"expression",raw:this.joinTokenText(y,i)},A=this.parseBranch(v,r,i),z=f.length>0?this.parseBranch(f,r,i):void 0;return A.length===0&&(!z||z.length===0)?(e.reset(u),this.coverageRollback(o),null):fn(D,A,z,{sourceLanguage:i,patternId:`conditional-${i}-folded`,confidence:1})}joinTokenText(e,r){return kr(e,N(r))}tokensBeginCommand(e,r,i){if(e.length===0)return false;let n=new ie(e,i);return ae.matchBest(n,r)!==null}sovCommandStartsAt(e,r){if(!r)return false;let i=o=>r.has(o.value.toLowerCase())||!!o.normalized&&r.has(o.normalized.toLowerCase()),n=o=>o.kind==="identifier"||o.kind==="selector"||o.kind==="literal"||o.kind==="reference",a=0,u=0;for(;a+1<e.length;){let o=e[a],s=e[a+1];if(!n(o)||s.kind!=="particle")break;u+=1,a+=2;let l=e[a];if(u>=1&&l&&i(l))return true}return false}parseBranch(e,r,i){if(e.length===0)return [];let n=new ie(e,i),a=this.parseBodyWithClauses(n,r,i);return a.length===1&&a[0]?.kind==="compound"?a[0].statements:a}extractStandaloneModifiers(e,r){let n=U(e,r).tokens;if(n.length===0)return {modifiers:null,remainingInput:null};let u=n[0].value.toLowerCase(),o=F.STANDALONE_MODIFIERS[u];if(!o)return {modifiers:null,remainingInput:null};let s={},l=1;if(o==="once")s.once=true;else {let p=1;if(p<n.length){let y=n[p],E=n[p+1],v=y.kind==="identifier"&&E?.kind==="literal"&&/^\d+(ms|s|m)?$/.test(E.value);(y.kind==="keyword"||y.kind==="particle"||v)&&(p++,l++);}if(p<n.length){let y=n[p];if(y.kind==="literal"){let E=y.value.match(/^(\d+)(ms|s|m)?$/);if(E){let v=parseInt(E[1],10),f=E[2]||"ms";f==="s"?v*=1e3:f==="m"&&(v*=6e4),s[o]=v,l=p+1;}}}s[o]||(s[o]=o==="debounce"?300:100);}let c=n.slice(l);if(c.length===0)return {modifiers:null,remainingInput:null};let m=c[0].position.start,d=e.slice(m);return {modifiers:s,remainingInput:d}}stripAsyncModifier(e,r){let i=N(r)?.keywords?.async,n=new Set(["async"]);i?.primary&&n.add(i.primary.toLowerCase()),i?.alternatives?.forEach(l=>n.add(l.toLowerCase()));let a=U(e,r).tokens,u=a.findIndex(l=>n.has(l.value.toLowerCase()));if(u===-1)return {remainingInput:null};let o=a[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=U(e,r).tokens;for(let n=0;n<i.length-1;n++){if(i[n].value.toLowerCase()!=="do")continue;let a=-1;for(let l=n+1;l<=n+5&&l<i.length;l++){let c=i[l];if(c.normalized?.toLowerCase()==="throw"){a=l;break}let m=c.kind;if(m==="selector"||m==="literal"||m==="reference"||m==="conjunction")break}if(a===-1)continue;let u=i[n].position.start,o=i[a].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}}static droppedTokenCount(e){return (e.diagnostics??[]).filter(r=>r.code==="unconsumed-input").reduce((r,i)=>r+(parseInt(/left (\d+) token/.exec(i.message)?.[1]??"0",10)||0),0)}static unconsumedSpans(e){return (e.diagnostics??[]).filter(r=>r.code==="unconsumed-input").map(r=>/unconsumed: "(.*)"$/.exec(r.message)?.[1]).filter(r=>!!r).map(r=>r.replace(/\s+/g," ").trim())}static withoutSpanDiagnostics(e,r){return {...e,diagnostics:(e.diagnostics??[]).filter(i=>{if(i.code!=="unconsumed-input")return true;let n=/unconsumed: "(.*)"$/.exec(i.message)?.[1];return !n||n.replace(/\s+/g," ").trim()!==r})}}reclaimDanglingFromTail(e,r,i){let n=F.droppedTokenCount,a=F.unconsumedSpans(e);if(a.length===0)return null;let u=n(e),o=N(i)?.roleMarkers?.source,s=new Set;o?.primary&&s.add(o.primary),o?.alternatives?.forEach(c=>s.add(c));let l=U(r,i).tokens;for(let c=0;c<l.length;c++){let m=l[c];if(m.normalized!=="source"&&!s.has(m.value))continue;let d=o?.position==="after"?c-1:c+1,p=l[d];if(!p||p.kind!=="identifier"&&p.kind!=="keyword")continue;let y=Math.min(m.position.start,p.position.start),E=Math.max(m.position.end,p.position.end),v=r.slice(y,E).replace(/\s+/g," ").trim();if(!a.some(h=>h===v||h.includes(v)))continue;let f=(r.slice(0,y).trimEnd()+" "+r.slice(E).trimStart()).trim();if(!(!f||f===r))try{let h=this.parse(f,i);if(!h||h.kind!=="event-handler")continue;let k=vr(h);if(n(k)<u)return {node:{...k,eventModifiers:{...k.eventModifiers,from:{type:"literal",value:p.value,dataType:"string"}}},input:f}}catch{}}return null}reclaimEventCompoundTail(e,r,i){let n=F.unconsumedSpans(e);if(n.length===0)return null;let a=ye[i];if(!a)return null;let u=e.roles,o=u.get("event"),s=o?.type==="literal"&&typeof o.value=="string"?o.value:null;if(!s)return null;let l=m=>m.replace(/\s+/g," ").trim(),c=U(r,i).tokens;for(let m of n)for(let d=1;d<c.length;d++)for(let p=d;p<c.length;p++){let y=l(r.slice(c[d].position.start,c[p].position.end));if(y.length>m.length)break;if(y!==m)continue;let E=c[d-1];if((a[E.value]??E.normalized)!==s)break;let f=l(r.slice(E.position.start,c[p].position.end)),h=a[f];if(!h)break;return u.set("event",{type:"literal",value:h,dataType:"string"}),{node:F.withoutSpanDiagnostics(e,m),input:r}}return null}reclaimResponseTypeTail(e,r,i){let n=F.unconsumedSpans(e);if(n.length===0)return null;let a=F.AS_MARKERS_BEFORE[i];if(!a)return null;let u=l=>l.replace(/\s+/g," ").trim(),o=F.droppedTokenCount(e),s=U(r,i).tokens;for(let l=0;l+1<s.length;l++){let c=s[l],m=s[l+1];if(!a.some(y=>c.value.toLowerCase()===y)||!F.RESPONSE_TYPE_WORDS.has(m.value.toLowerCase()))continue;let d=u(r.slice(c.position.start,m.position.end));if(!n.includes(d))continue;let p=(r.slice(0,c.position.start).trimEnd()+" "+r.slice(m.position.end).trimStart()).trim();if(!(!p||p===r))try{let y=this.parse(p,i);if(!y||y.kind!=="event-handler")continue;let E=vr(y);if(F.droppedTokenCount(E)>=o)continue;let v=F.findResponseTypeTarget(E);if(!v)continue;return v.roles.set("responseType",{type:"expression",raw:m.value}),{node:E,input:p}}catch{}}return null}static findResponseTypeTarget(e){let r=null,i=n=>{if(!n||typeof n!="object"||r)return;if(n.kind==="command"){let u=n;if(ee(u.action)?.roles.some(s=>s.role==="responseType"&&!s.required)&&!u.roles.has("responseType")){r=u;return}}let a=n;for(let u of ["body","statements","thenBranch","elseBranch","commands"]){let o=a[u];Array.isArray(o)&&o.forEach(s=>i(s));}};return i(e),r}reclaimCapturedDestinationTail(e,r,i){let n=F.unconsumedSpans(e);if(n.length===0)return null;let a=N(i)?.roleMarkers?.destination,u=new Set;if(a?.primary&&u.add(a.primary),a?.alternatives?.forEach(l=>u.add(l)),u.size===0)return null;let o=l=>l.replace(/\s+/g," ").trim(),s=U(r,i).tokens;for(let l=0;l+1<s.length;l++){let c=s[l],m=s[l+1],d=u.has(c.value)&&m.normalized==="me",p=c.normalized==="me"&&u.has(m.value);if(!d&&!p)continue;let y=o(r.slice(c.position.start,m.position.end));if(!n.includes(y))continue;let E=false,v=f=>{if(!f||typeof f!="object"||E)return;if(f.kind==="command"){let k=f.roles.get("destination");if(k?.type==="reference"&&k.value==="me"){E=true;return}}let h=f;for(let k of ["body","statements","thenBranch","elseBranch","commands"]){let D=h[k];Array.isArray(D)&&D.forEach(A=>v(A));}};if(v(e),!!E)return {node:F.withoutSpanDiagnostics(e,y),input:r}}return null}applyModifiers(e,r){return {...e,eventModifiers:{...e.eventModifiers,...r}}}extractOrConjunctionEvents(e,r){let i=[];for(;;){let n=e.mark(),a=e.peek();if(!a)break;let u=(a.normalized||a.value).toLowerCase();if(!F.OR_KEYWORDS.has(u)){e.reset(n);break}e.advance();let o=e.peek();if(!o){e.reset(n);break}let s=(o.normalized||o.value).toLowerCase();e.advance(),i.push({type:"literal",value:s});}return i}};Z.coverageMarkerSurfaces=new Map;Z.LEAKED_RENDER_MARKERS={hi:["\u0915\u0947","\u0930\u0942\u092A","\u092E\u0947\u0902"],tr:["olarak"],qu:["hina"]};Z.AS_MARKERS_BEFORE={en:["as"],es:["como"],fr:["comme"],pt:["como"],it:["come"],de:["als"],id:["sebagai"],ms:["sebagai","sbg"],sw:["kuwa","kama"],th:["\u0E40\u0E1B\u0E47\u0E19"],vi:["nh\u01B0"],tl:["bilang"],he:["\u05DB"],ar:["\u0643\u0640"],pl:["jako"],ru:["\u043A\u0430\u043A"],uk:["\u044F\u043A"],zh:["\u7684","\u4F5C\u4E3A","\u5F53\u4F5C"]};Z.AS_MARKERS_AFTER={ko:[["\uB85C"],["\uC73C\uB85C"]],qu:[["hina"]],tr:[["olarak"]],hi:[["\u0915\u0947","\u0930\u0942\u092A","\u092E\u0947\u0902"]]};Z.KNOWN_EVENTS=new Set(["click","dblclick","input","change","submit","keydown","keyup","keypress","mouseover","mouseout","mousedown","mouseup","focus","blur","load","scroll","resize","contextmenu"]);Z.RESPONSE_TYPE_WORDS=new Set(["json","text","html","xml","blob","arraybuffer","formdata","response"]);Z.SOV_EVENT_MARKERS={ja:new Set(["\u3067"]),ko:new Set,tr:new Set(["de","da","te","ta"]),bn:new Set(["\u098F"]),qu:new Set(["pi"]),hi:new Set(["\u092A\u0930"])};Z.SOV_EVENT_MARKER_PHRASES={ko:[["\uD560","\uB54C"],["\uD560\uB54C"]]};Z.SOV_SOURCE_MARKERS={ja:{markers:new Set(["\u304B\u3089"]),windowTokens:new Set(["\u30A6\u30A3\u30F3\u30C9\u30A6","\u30C9\u30AD\u30E5\u30E1\u30F3\u30C8","window","document"])},ko:{markers:new Set(["\uC5D0\uC11C"]),windowTokens:new Set(["\uCC3D","\uC708\uB3C4\uC6B0","\uBB38\uC11C","window","document"])},tr:{markers:new Set(["den","dan","ten","tan"]),windowTokens:new Set(["pencere","belge","window","document"])},bn:{markers:new Set(["\u09A5\u09C7\u0995\u09C7","\u09AE\u09A7\u09CD\u09AF\u09C7"]),windowTokens:new Set(["\u0989\u0987\u09A8\u09CD\u09A1\u09CB","\u09A1\u0995\u09C1\u09AE\u09C7\u09A8\u09CD\u099F","window","document"])},qu:{markers:new Set(["manta"]),windowTokens:new Set(["k_iri","ventana","window","document"])},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"])}};Z.CONDITION_COPULAS=new Set(["is","am","are","be","was","were","not","no"]);Z.CONDITION_COPULAS_SURFACE=new Set(["\u0647\u0648","\u0E40\u0E1B\u0E47\u0E19","\u0939\u0948"]);Z.CONDITION_PREDICATES=new Set(["empty","null","undefined"]);Z.CONDITION_OPERATORS=new Set(["matches","match","contains","exists","has","have","equals","includes"]);Z.STANDALONE_MODIFIERS={once:"once",debounced:"debounce",debounce:"debounce",throttled:"throttle",throttle:"throttle"};Z.OR_KEYWORDS=new Set(["or","\u0623\u0648","o","ou","oder","atau","atau","\u6216","\u307E\u305F\u306F","\uB610\uB294","veya","\u0985\u09A5\u09AC\u09BE","utaq","au","\u0430\u0431\u043E","\u0438\u043B\u0438","ho\u1EB7c","lub","\u05D0\u05D5","\u0E2B\u0E23\u0E37\u0E2D","o","\u092F\u093E","\u0985\u09A5\u09AC\u09BE"]);var Iu=Z,ju=new Iu;function $u(t,e){return ju.parse(t,e)}function Vu(t,e){try{let r=U(t,e),i=me(e);if(i.length===0)return {confidence:0,parseSuccess:!1,error:`No patterns available for language: ${e}`};let n=[...i].sort((l,c)=>c.priority-l.priority),a=n.filter(l=>l.command==="on"),u=ae.matchBest(r,a);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=n.filter(l=>l.command!=="on"),s=ae.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 Rt(t,e){try{let i=$u(t,e);if(i)return {node:i,confidence:i.metadata?.confidence??.8,error:void 0,tokensConsumed:U(t,e).tokens.length}}catch{}let r=Vu(t,e);return r.parseSuccess?{node:null,confidence:r.confidence,error:void 0,tokensConsumed:r.tokensConsumed}:{node:null,confidence:0,error:r.error}}function Ot(t,e){let r=e==="SOV"?"sovPosition":"svoPosition";return [...t].sort((i,n)=>{let a=i[r]??99,u=n[r]??99;return a-u})}function Wu(t,e){let r=t.markerOverride?.[e.code],i=e.roleMarkers[t.role];if(r!==void 0){let n=qu(t,e.code,r);return {primary:r,...n&&{alternatives:n},position:i?.position??"before",isOverride:true}}if(i&&i.primary){let n={primary:i.primary,position:i.position,isOverride:false};return i.alternatives&&(n.alternatives=i.alternatives),n}return null}function qu(t,e,r){let i=t.markerLegacy?.[e];if(!i?.length)return;let n=[...new Set(i)].filter(a=>a&&a!==r);return n.length?n:void 0}function pe(t,e,r){let i=t.markerLegacy?.[e]??[],n=t.methodCarrier?[]:t.markerVariants?.[e]??[],a=[...new Set([...i,...n])].filter(u=>u&&u!==r);return a.length?a:void 0}function ar(t,e){let r,i;if(t.markerOverride&&t.markerOverride[e.code]!==void 0)r=t.markerOverride[e.code],i=r?pe(t,e.code,r):void 0;else {let n=e.roleMarkers[t.role];if(n){r=n.primary;let a=pe(t,e.code,r)??[],u=[...new Set([...n.alternatives??[],...a])].filter(o=>o!==r);i=u.length?u:void 0;}}return {marker:r,alternatives:i}}function Ye(t,e,r){r.roles.find(n=>n.role==="scope"&&!n.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 Ku(t,e,r,i,n){let a=[];if(a.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)a.push({type:"literal",value:c});else {let c=i.alternatives?{type:"literal",value:i.primary,alternatives:i.alternatives}:{type:"literal",value:i.primary};a.push(c);}}let u=e.roleMarkers.destination;u&&a.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}]}),a.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};a.push(l);}let s=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};return a.push(s),a.push(...Ae(t,e.roleMarkers.source)),a.push(...br(t,e.roleMarkers.destination)),{id:`${t.action}-event-${e.code}-sov`,language:e.code,command:"on",priority:(n.basePriority??100)+50,template:{format:`{event} ${i.primary} {destination?} {patient} ${o?.primary||""} ${r.primary}`,tokens:a},extraction:{action:{value:t.action},event:{fromRole:"event"},patient:{fromRole:"patient"},...Ce(t),...be(t)}}}function Uu(t,e,r,i,n){let a=[];a.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};a.push(l);}if(a.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)a.push({type:"literal",value:c});else {let c=i.alternatives?{type:"literal",value:i.primary,alternatives:i.alternatives}:{type:"literal",value:i.primary};a.push(c);}}let o=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};a.push(o),a.push(...Ae(t,e.roleMarkers.source));let s=e.roleMarkers.destination;if(t.action==="swap"&&s){let l=t.roles.find(c=>c.role==="patient")?.markerOverride?.[e.code];if(l&&l!==s.primary){let c=s.alternatives??[];c.includes(l)||(s={...s,alternatives:[...c,l]});}}return a.push(...br(t,s)),{id:`${t.action}-event-${e.code}-sov-patient-first`,language:e.code,command:"on",priority:(n.basePriority??100)+45,template:{format:`{patient} ${u?.primary||""} {event} ${i.primary} ${r.primary}`,tokens:a},extraction:{action:{value:t.action},event:{fromRole:"event"},patient:{fromRole:"patient"},...Ce(t),...be(t)}}}function Hu(t,e,r,i,n){let a=[];a.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};a.push(l);}let o=e.roleMarkers.destination;if(o&&(a.push({type:"role",role:"destination",optional:false}),a.push(o.alternatives?{type:"literal",value:o.primary,alternatives:o.alternatives}:{type:"literal",value:o.primary})),a.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)a.push({type:"literal",value:c});else {let c=i.alternatives?{type:"literal",value:i.primary,alternatives:i.alternatives}:{type:"literal",value:i.primary};a.push(c);}}let s=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};return a.push(s),{id:`${t.action}-event-${e.code}-sov-patient-first-dest`,language:e.code,command:"on",priority:(n.basePriority??100)+40,template:{format:`{patient} ${u?.primary||""} {destination} ${o?.primary||""} {event} ${i.primary} ${r.primary}`,tokens:a},extraction:{action:{value:t.action},event:{fromRole:"event"},patient:{fromRole:"patient"},destination:{fromRole:"destination"}}}}function Gu(t,e,r,i,n){let a=[];a.push({type:"role",role:"event",optional:false});let u=i.alternatives?.filter(c=>!c.includes(" ")&&c.length>1)||[];u.length>0&&a.push({type:"literal",value:u[0],alternatives:u.slice(1)});let o=e.roleMarkers.destination;o&&a.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}]}),a.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};a.push(c);}let l=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};return a.push(l),a.push(...Ae(t,e.roleMarkers.source)),a.push(...br(t,e.roleMarkers.destination)),{id:`${t.action}-event-${e.code}-sov-compact`,language:e.code,command:"on",priority:(n.basePriority??100)+52,template:{format:`{event}${u[0]||""} {patient} ${r.primary}`,tokens:a},extraction:{action:{value:t.action},event:{fromRole:"event"},patient:{fromRole:"patient"},...Ce(t),...be(t)}}}function Yu(t,e,r,i,n){let a=[];if(a.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)a.push({type:"literal",value:s});else {let s=i.alternatives?{type:"literal",value:i.primary,alternatives:i.alternatives}:{type:"literal",value:i.primary};a.push(s);}}let u=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};return a.push(u),{id:`${t.action}-event-${e.code}-sov-simple`,language:e.code,command:"on",priority:(n.basePriority??100)+48,template:{format:`{event} ${i.primary} ${r.primary}`,tokens:a},extraction:{action:{value:t.action},event:{fromRole:"event"},patient:{default:{type:"reference",value:"me"}}}}}function Zu(t,e,r,i){let n=e.eventHandler?.temporalMarkers;if(!n||n.length===0)return null;let a=[];a.push({type:"role",role:"event",optional:false}),e.possessive?.marker&&a.push({type:"group",optional:true,tokens:[{type:"literal",value:e.possessive.marker}]}),a.push({type:"literal",value:n[0],alternatives:n.slice(1)}),a.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};a.push(s);}let o=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};return a.push(o),{id:`${t.action}-event-${e.code}-sov-temporal`,language:e.code,command:"on",priority:(i.basePriority??100)+49,template:{format:`{event} ${n[0]} {patient} ${r.primary}`,tokens:a},extraction:{action:{value:t.action},event:{fromRole:"event"},patient:{fromRole:"patient"}}}}function Xu(t,e,r,i,n){let a=[];if(a.push({type:"role",role:"event",optional:false}),i.position==="after"){let m=i.primary.split(/\s+/);if(m.length>1)for(let d of m)a.push({type:"literal",value:d});else {let d=i.alternatives?{type:"literal",value:i.primary,alternatives:i.alternatives}:{type:"literal",value:i.primary};a.push(d);}}let o=[...t.roles.filter(m=>m.required)].sort((m,d)=>{let p=m.sovPosition??999,y=d.sovPosition??999;return p-y});for(let m of o){a.push({type:"role",role:m.role,optional:false});let{marker:d,alternatives:p}=ar(m,e);if(d){let y=p?{type:"literal",value:d,alternatives:p}:{type:"literal",value:d};a.push(y);}}let s=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};a.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 Ye(a,c,t),{id:`${t.action}-event-${e.code}-sov-2role`,language:e.code,command:"on",priority:(n.basePriority??100)+55,template:{format:`{event} ${i.primary} ${l} ${r.primary}`,tokens:a},extraction:c}}function Ju(t,e,r,i,n){let a=[],o=[...t.roles.filter(c=>c.required)].sort((c,m)=>{let d=c.sovPosition??999,p=m.sovPosition??999;return d-p});for(let c of o){a.push({type:"role",role:c.role,optional:false});let{marker:m,alternatives:d}=ar(c,e);m&&a.push(d?{type:"literal",value:m,alternatives:d}:{type:"literal",value:m});}if(a.push(r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary}),a.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)a.push({type:"literal",value:m});else a.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 Ye(a,l,t),{id:`${t.action}-event-${e.code}-sov-2role-event-last`,language:e.code,command:"on",priority:(n.basePriority??100)+40,template:{format:`${s} ${r.primary} {event} ${i.primary}`,tokens:a},extraction:l}}function Qu(t,e,r,i,n){let a=[],o=[...t.roles.filter(v=>v.required)].sort((v,f)=>{let h=v.sovPosition??999,k=f.sovPosition??999;return h-k}),s=o[0];a.push({type:"role",role:s.role,optional:false});let{marker:l,alternatives:c}=ar(s,e);if(l){let v=c?{type:"literal",value:l,alternatives:c}:{type:"literal",value:l};a.push(v);}if(a.push({type:"role",role:"event",optional:false}),i.position==="after"){let v=i.primary.split(/\s+/);if(v.length>1)for(let f of v)a.push({type:"literal",value:f});else {let f=i.alternatives?{type:"literal",value:i.primary,alternatives:i.alternatives}:{type:"literal",value:i.primary};a.push(f);}}let m=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};a.push(m);let d=o[1];a.push({type:"role",role:d.role,optional:false});let{marker:p,alternatives:y}=ar(d,e);if(p){let v=y?{type:"literal",value:p,alternatives:y}:{type:"literal",value:p};a.push(v);}let E={action:{value:t.action},event:{fromRole:"event"},[s.role]:{fromRole:s.role},[d.role]:{fromRole:d.role}};return Ye(a,E,t),{id:`${t.action}-event-${e.code}-sov-2role-dest-first`,language:e.code,command:"on",priority:(n.basePriority??100)+48,template:{format:`{${s.role}} {event} ${i.primary} ${r.primary} {${d.role}}`,tokens:a},extraction:E}}function Pt(t,e,r){let i=pe(t,e.code,r.primary)??[],n=[...new Set([...r.alternatives??[],...i])].filter(a=>a!==r.primary);return n.length?n:void 0}function tt(t,e,r,i,n){let a=[];if(i.position==="before"){let s=i.alternatives?{type:"literal",value:i.primary,alternatives:i.alternatives}:{type:"literal",value:i.primary};a.push(s);}a.push({type:"role",role:"event",optional:false});let u=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};a.push(u),a.push({type:"role",role:"patient",optional:false});let o=e.roleMarkers.destination;return o&&a.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}]}),a.push(...Ae(t,e.roleMarkers.source)),{id:`${t.action}-event-${e.code}-vso`,language:e.code,command:"on",priority:(n.basePriority??100)+50,template:{format:`${i.primary} {event} ${r.primary} {patient} ${o?.primary||""} {destination?}`,tokens:a},extraction:{action:{value:t.action},event:{fromRole:"event"},patient:{fromRole:"patient"},...Ce(t),...be(t)}}}function eo(t,e,r,i,n){let a=[],u=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};a.push(u),a.push({type:"role",role:"patient",optional:false});let o=e.roleMarkers.destination;if(o&&a.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}]}),a.push(...Ae(t,e.roleMarkers.source)),i.position==="before"){let s=i.alternatives?{type:"literal",value:i.primary,alternatives:i.alternatives}:{type:"literal",value:i.primary};a.push(s);}if(a.push({type:"role",role:"event",optional:false}),t.action==="swap"){let s=t.roles.find(l=>l.role==="patient")?.markerOverride?.[e.code];s&&a.push({type:"group",optional:true,tokens:[{type:"literal",value:s},{type:"role",role:"destination",optional:false}]});}return {id:`${t.action}-event-${e.code}-vso-verb-first`,language:e.code,command:"on",priority:(n.basePriority??100)+45,template:{format:`${r.primary} {patient} ${o?.primary||""} {destination?} ${i.primary} {event}`,tokens:a},extraction:{action:{value:t.action},event:{fromRole:"event"},patient:{fromRole:"patient"},...Ce(t),...be(t)}}}function ro(t,e,r,i,n){let a=[],u=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};a.push(u);let s=[...t.roles.filter(m=>m.required)].sort((m,d)=>{let p=m.svoPosition??999,y=d.svoPosition??999;return p-y});for(let m of s){let d,p;if(m.markerOverride&&m.markerOverride[e.code]!==void 0)d=m.markerOverride[e.code],p=d?pe(m,e.code,d):void 0;else {let y=e.roleMarkers[m.role];y&&(d=y.primary,p=Pt(m,e,y));}if(d){let y=p?{type:"literal",value:d,alternatives:p}:{type:"literal",value:d};a.push(y);}a.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};a.push(m);}a.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 Ye(a,c,t),{id:`${t.action}-event-${e.code}-vso-verb-first-2role`,language:e.code,command:"on",priority:(n.basePriority??100)+48,template:{format:`${r.primary} ${l} ${i.primary} {event}`,tokens:a},extraction:c}}function it(t,e,r,i,n){let a=[];if(i.position==="before"){let m=i.alternatives?{type:"literal",value:i.primary,alternatives:i.alternatives}:{type:"literal",value:i.primary};a.push(m);}a.push({type:"role",role:"event",optional:false});let u=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};a.push(u);let s=[...t.roles.filter(m=>m.required)].sort((m,d)=>{let p=m.svoPosition??999,y=d.svoPosition??999;return p-y});for(let m of s){let d,p;if(m.markerOverride&&m.markerOverride[e.code]!==void 0)d=m.markerOverride[e.code],p=d?pe(m,e.code,d):void 0;else {let y=e.roleMarkers[m.role];y&&(d=y.primary,p=Pt(m,e,y));}if(d){let y=p?{type:"literal",value:d,alternatives:p}:{type:"literal",value:d};a.push(y);}a.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 Ye(a,c,t),{id:`${t.action}-event-${e.code}-vso-2role`,language:e.code,command:"on",priority:(n.basePriority??100)+55,template:{format:`${i.primary} {event} ${r.primary} ${l}`,tokens:a},extraction:c}}function to(t,e,r,i,n){let a=[],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};a.push(l);}if(u){let l=u.alternatives?{type:"literal",value:u.primary,alternatives:u.alternatives}:{type:"literal",value:u.primary};a.push(l);}a.push({type:"role",role:"event",optional:false});let o=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};a.push(o),a.push({type:"role",role:"patient",optional:false});let s=e.roleMarkers.destination;return s&&a.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}]}),a.push(...Ae(t,e.roleMarkers.source)),{id:`${t.action}-event-${e.code}-vso-negated`,language:e.code,command:"on",priority:(n.basePriority??100)+48,template:{format:`${i.primary} ${u?.primary||""} {event} ${r.primary} {patient} ${s?.primary||""} {destination?}`,tokens:a},extraction:{action:{value:t.action},event:{fromRole:"event"},patient:{fromRole:"patient"},...Ce(t),...be(t)}}}function io(t,e,r,i){let n=[];n.push({type:"literal",value:"and",alternatives:["then"]}),n.push({type:"role",role:"event",optional:false});let a=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};n.push(a),n.push({type:"role",role:"patient",optional:false});let u=e.roleMarkers.destination;return u&&n.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}]}),n.push(...Ae(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:n},extraction:{action:{value:t.action},event:{fromRole:"event"},patient:{fromRole:"patient"},...Ce(t),...be(t)}}}var Le={basePriority:100,generateSimpleVariants:true,generateAlternatives:true};function ir(t,e,r=Le){let i=`${t.action}-${e.code}-generated`,n=r.basePriority??100,a=e.keywords[t.action];if(!a)throw new Error(`No keyword translation for '${t.action}' in ${e.code}`);let u=oo(t,e,a),o=xr(t,e),s=po(t,e,a);return {id:i,language:e.code,command:t.action,priority:n,template:{format:s,tokens:u},extraction:o}}function no(t,e,r=Le){if(t.roles.filter(o=>!o.required).length===0)return null;let n=t.roles.filter(o=>o.required),a={...t,roles:n};return {...ir(a,e,r),id:`${t.action}-${e.code}-generated-simple`,priority:(r.basePriority??100)-5,extraction:xr(t,e)}}function nt(t,e,r=Le){if(e.wordOrder!=="SOV")return null;let i=t.roles.filter(o=>o.required);if(i.length!==1)return null;let n=e.keywords[t.action];if(!n)return null;let a=n.alternatives?{type:"literal",value:n.primary,alternatives:n.alternatives}:{type:"literal",value:n.primary},u=i.flatMap(o=>{let s=o.valuePrefixLiteral?.[e.code],l={type:"role",role:o.role,optional:false,expectedTypes:o.expectedTypes};return s?[{type:"literal",value:s},l]:[l]});return {id:`${t.action}-${e.code}-generated-verb-first`,language:e.code,command:t.action,priority:(r.basePriority??100)-20,template:{format:`${n.primary} <${i[0].role}>`,tokens:[a,...u]},extraction:xr(t,e)}}function ao(t,e,r=Le){let i=[];if(i.push(ir(t,e,r)),r.generateSimpleVariants){let n=no(t,e,r);n&&i.push(n);}for(let n of t.omitRoleVariants??[]){let a={...t,roles:t.roles.filter(o=>o.role!==n)},u=ir(a,e,r);i.push({...u,id:`${t.action}-${e.code}-generated-no-${n}`,priority:(r.basePriority??100)-8});}if(r.generateVerbFirstVariants!==false){let n=nt(t,e,r);n&&i.push(n);}for(let n of t.rolePrefixLiteralVariants??[]){let a=n.literal[e.code];if(!a)continue;let{rolePrefixLiteralVariants:u,...o}=t,s={...o,roles:t.roles.map(d=>d.role===n.role?{...d,valuePrefixLiteral:{[e.code]:a}}:d)},l=n.priorityDelta??5,c=n.methodCarrier?{[n.methodCarrier]:{value:a}}:{},m=ir(s,e,r);if(i.push({...m,id:`${t.action}-${e.code}-generated-${n.idSuffix}`,priority:(r.basePriority??100)+l,extraction:{...m.extraction,...c}}),r.generateVerbFirstVariants!==false){let d=nt(s,e,r);d&&i.push({...d,id:`${t.action}-${e.code}-generated-verb-first-${n.idSuffix}`,priority:(r.basePriority??100)-20+l,extraction:{...d.extraction,...c}});}}return i}function Nt(t,e=Le){let r=[],i=Ra();for(let n of i){if(!t.keywords[n.action])continue;let a=ao(n,t,e);if(r.push(...a),t.eventHandler?.eventMarker){let u=uo(n,t,e);r.push(...u);}}return r}function uo(t,e,r=Le){if(!e.eventHandler||!e.eventHandler.eventMarker)return [];let i=[],n=e.eventHandler.eventMarker,a=e.keywords[t.action];if(!a)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(Xu(t,e,a,n,r)),i.push(Qu(t,e,a,n,r)),i.push(Ju(t,e,a,n,r));else {i.push(Ku(t,e,a,n,r)),i.push(Uu(t,e,a,n,r));let s=e.roleMarkers.destination;s&&s.primary!==n.primary&&i.push(Hu(t,e,a,n,r));let l=n.primary.split(/\s+/),c=n.alternatives?.some(d=>!d.includes(" ")&&d.length>1);l.length>1&&c&&i.push(Gu(t,e,a,n,r)),i.push(Yu(t,e,a,n,r));let m=Zu(t,e,a,r);m&&i.push(m);}else e.wordOrder==="VSO"?o?(i.push(it(t,e,a,n,r)),i.push(ro(t,e,a,n,r))):(i.push(tt(t,e,a,n,r)),i.push(eo(t,e,a,n,r)),e.eventHandler?.negationMarker&&i.push(to(t,e,a,n,r)),e.tokenization?.prefixes&&i.push(io(t,e,a,r))):o?i.push(it(t,e,a,n,r)):i.push(tt(t,e,a,n,r));return i}function oo(t,e,r){let i=[],n=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary},a=lo(t,e);switch(e.wordOrder){case "SVO":i.push(n),i.push(...a);break;case "SOV":i.push(...a),i.push(n);break;case "VSO":i.push(n),i.push(...a);break;default:i.push(n),i.push(...a);}return so(i)}function so(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 n=[...i.alternatives??[],...r.alternatives??[]];n.length&&(e[e.length-1]={...i,alternatives:[...new Set(n)]});continue}e.push(r);}return e}function lo(t,e){let r=[],i=Ot(t.roles,e.wordOrder);for(let n of i){let a=co(n,e);n.required?r.push(...a):r.push({type:"group",optional:true,tokens:a});}return r}function co(t,e){let r=[],i=t.markerOverride?.[e.code],n=e.roleMarkers[t.role],a=t.renderOverride?.[e.code]==="",u={type:"role",role:t.role,optional:!t.required,expectedTypes:t.expectedTypes},o=t.valuePrefixLiteral?.[e.code],s=()=>{o&&r.push({type:"literal",value:o}),r.push(u);};if(i!==void 0){let l=i?i.split(/\s+/).filter(Boolean):[],c=n?.position??"before",m=t.markerOptional?.[e.code]===true,d=p=>{let y=l.length===1?pe(t,e.code,p)??[]:[],E={type:"literal",value:p,...y.length?{alternatives:y}:{},...a?{renderSuppress:true}:{}};r.push(m?{type:"group",optional:true,tokens:[E]}:E);};if(c==="before"){for(let p of l)d(p);s();}else {s();for(let p of l)d(p);}}else if(n){let l=()=>{let m=[...new Set([...n.alternatives??[],...pe(t,e.code,n.primary)??[]])].filter(d=>d!==n.primary);return {type:"literal",value:n.primary,...m.length?{alternatives:m}:{},...a?{renderSuppress:true}:{}}},c=m=>{r.push(e.markersOptional||t.markerOptional?.[e.code]?{type:"group",optional:true,tokens:[m]}:m);};n.position==="before"?(n.primary&&c(l()),s()):(s(),c(l()));}else s();return r}function mo(t,e){let r={};for(let i of t.roles){let n=i.markerOverride?.[e.code],a=e.roleMarkers[i.role];if(i.valuePrefixLiteral?.[e.code])r[i.role]={marker:i.valuePrefixLiteral[e.code]};else if(n!==void 0)if(!n)r[i.role]={};else {let o=!/\s/.test(n.trim())?pe(i,e.code,n)??[]:[];r[i.role]=o.length?{marker:n,markerAlternatives:o}:{marker:n};}else if(a&&a.primary){let u=[...new Set([...a.alternatives??[],...pe(i,e.code,a.primary)??[]])].filter(o=>o!==a.primary);r[i.role]=u.length?{marker:a.primary,markerAlternatives:u}:{marker:a.primary};}else r[i.role]={};}return r}function xr(t,e){let r=mo(t,e),i={};for(let n of t.roles){let a=r[n.role]||{};!n.required&&n.default?i[n.role]={...a,default:n.default}:i[n.role]=a;}return i}function po(t,e,r){let i=[],a=Ot(t.roles,e.wordOrder).map(u=>{let o=Wu(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,...a);break;case "SOV":i.push(...a,r.primary);break;default:i.push(r.primary,...a);}return i.join(" ")}var fo=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),n=Date.now();for(;this.cache.size>=this.config.maxSize;)this.evictLRU();this.cache.set(i,{result:r,createdAt:n,lastAccessed:n});}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 fo;function yo(t){return /[\u0430-\u044f\u0410-\u042f\u0451\u0401]/.test(t)}function ho(t){for(let e of t)if(yo(e))return true;return false}var _t=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"]]),Lt=class{constructor(){this.language="ru";}isNormalizable(t){return t.length<3?false:ho(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 X(t);let r=this.tryImperativeLookup(e);if(r)return r;let i=this.tryPastTenseNormalization(e);if(i)return i;let n=this.tryPresentTenseNormalization(e);if(n)return n;let a=this.tryGenericImperativeNormalization(e);return a||X(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 X(t);let i=this.normalizeNonReflexive(r);if(i.confidence<1){let n=i.stem.endsWith("\u0442\u044C")?i.stem.slice(0,-2)+"\u0442\u044C\u0441\u044F":i.stem+"\u0441\u044F";return B(n,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 X(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 n=this.tryGenericImperativeNormalization(t);return n||X(t)}tryImperativeLookup(t){return _t.has(t)?B(_t.get(t),.95,{removedSuffixes:["imperative"],conjugationType:"imperative"}):null}tryGenericImperativeNormalization(t){return t.endsWith("\u0439\u0442\u0435")&&t.length>5?B(t.slice(0,-3)+"\u0442\u044C",.8,{removedSuffixes:["\u0439\u0442\u0435"],conjugationType:"imperative"}):t.endsWith("\u0438\u0442\u0435")&&t.length>5?B(t.slice(0,-3)+"\u0438\u0442\u044C",.8,{removedSuffixes:["\u0438\u0442\u0435"],conjugationType:"imperative"}):t.endsWith("\u0439")&&t.length>3?B(t.slice(0,-1)+"\u0442\u044C",.75,{removedSuffixes:["\u0439"],conjugationType:"imperative"}):t.endsWith("\u0438")&&t.length>3?B(t+"\u0442\u044C",.7,{removedSuffixes:["\u0438\u2192\u0438\u0442\u044C"],conjugationType:"imperative"}):null}tryPastTenseNormalization(t){return t.endsWith("\u0430\u043B\u0430")&&t.length>4?B(t.slice(0,-3)+"\u0430\u0442\u044C",.85,{removedSuffixes:["\u0430\u043B\u0430"],conjugationType:"past"}):t.endsWith("\u0438\u043B\u0430")&&t.length>4?B(t.slice(0,-3)+"\u0438\u0442\u044C",.85,{removedSuffixes:["\u0438\u043B\u0430"],conjugationType:"past"}):t.endsWith("\u0435\u043B\u043E")&&t.length>4?B(t.slice(0,-3)+"\u0435\u0442\u044C",.82,{removedSuffixes:["\u0435\u043B\u043E"],conjugationType:"past"}):t.endsWith("\u0430\u0431\u043E")&&t.length>4?B(t.slice(0,-3)+"\u0430\u0442\u044C",.82,{removedSuffixes:["\u0430\u0431\u043E"],conjugationType:"past"}):t.endsWith("\u0430\u043B\u0438")&&t.length>4?B(t.slice(0,-3)+"\u0430\u0442\u044C",.85,{removedSuffixes:["\u0430\u043B\u0438"],conjugationType:"past"}):t.endsWith("\u0438\u043B\u0438")&&t.length>4?B(t.slice(0,-3)+"\u0438\u0442\u044C",.85,{removedSuffixes:["\u0438\u043B\u0438"],conjugationType:"past"}):t.endsWith("\u0430\u043B")&&t.length>3?B(t.slice(0,-2)+"\u0430\u0442\u044C",.82,{removedSuffixes:["\u0430\u043B"],conjugationType:"past"}):t.endsWith("\u0438\u043B")&&t.length>3?B(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?B(t.slice(0,-3)+"\u0438\u0442\u044C",.8,{removedSuffixes:["\u0438\u0448\u044C"],conjugationType:"present"}):t.endsWith("\u0438\u0442")&&t.length>3?B(t.slice(0,-2)+"\u0438\u0442\u044C",.78,{removedSuffixes:["\u0438\u0442"],conjugationType:"present"}):t.endsWith("\u0438\u043C")&&t.length>3?B(t.slice(0,-2)+"\u0438\u0442\u044C",.78,{removedSuffixes:["\u0438\u043C"],conjugationType:"present"}):t.endsWith("\u044F\u0442")&&t.length>3?B(t.slice(0,-2)+"\u0438\u0442\u044C",.78,{removedSuffixes:["\u044F\u0442"],conjugationType:"present"}):t.endsWith("\u0435\u0448\u044C")&&t.length>4?B(t.slice(0,-3)+"\u0430\u0442\u044C",.75,{removedSuffixes:["\u0435\u0448\u044C"],conjugationType:"present"}):t.endsWith("\u0435\u0442")&&t.length>3?B(t.slice(0,-2)+"\u0430\u0442\u044C",.72,{removedSuffixes:["\u0435\u0442"],conjugationType:"present"}):t.endsWith("\u0435\u043C")&&t.length>3?B(t.slice(0,-2)+"\u0430\u0442\u044C",.72,{removedSuffixes:["\u0435\u043C"],conjugationType:"present"}):t.endsWith("\u044E\u0442")&&t.length>3?B(t.slice(0,-2)+"\u0430\u0442\u044C",.75,{removedSuffixes:["\u044E\u0442"],conjugationType:"present"}):t.endsWith("\u0443\u0442")&&t.length>3?B(t.slice(0,-2)+"\u0430\u0442\u044C",.72,{removedSuffixes:["\u0443\u0442"],conjugationType:"present"}):null}},It={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",document:"\u0434\u043E\u043A\u0443\u043C\u0435\u043D\u0442",window:"\u043E\u043A\u043D\u043E",detail:"\u0434\u0435\u0442\u0430\u043B\u0438"},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"},exists:{primary:"\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442",normalized:"exists"},is:{primary:"\u0435\u0441\u0442\u044C",normalized:"is"},no:{primary:"\u043D\u0435\u0442",normalized:"no"},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"]}},vo=["===","!==","->","==","!=","<=",">=","&&","||","**","+=","-=","*=","/=","+","-","*","/","=",">","<","!","&","|","%","^","~"],Eo=class{constructor(t=vo){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}},go="()[]{},:;",zo=class{constructor(t=go){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 Br(t,e){let r=e;for(;r<t.length&&t[r]===":";){let i=t.slice(r).match(/^::?[a-zA-Z][a-zA-Z0-9-]*/);if(!i)break;let n=r+i[0].length;if(t[n]==="("){let a=0,u=n;for(;u<t.length;){if(t[u]==="(")a++;else if(t[u]===")"&&(a--,a===0)){u++;break}u++;}if(a!==0)break;n=u;}r=n;}return r}function Mt(t,e){let r=t[e];if(r==="#"){let i=t.slice(e).match(/^#[a-zA-Z_][\w-]*/);if(!i)return null;let n=Br(t,e+i[0].length);return t.slice(e,n)}if(r==="."){let i=t.slice(e).match(/^\.\{[a-zA-Z_$][\w$]*\}/);if(i)return i[0];let n=t.slice(e).match(/^\.[a-zA-Z_][\w-]*/);if(!n)return null;let a=Br(t,e+n[0].length);return t.slice(e,a)}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,n=e;for(;n<t.length;){if(t[n]==="["&&i++,t[n]==="]"&&(i--,i===0)){let a=Br(t,n+1);return t.slice(e,a)}n++;}return null}if(r==="<"){let i=t.slice(e).match(/^<(?=[\w.#[])[\w-]*(?:[#.][\w-]+|\[[^\]]+\]|::?[a-zA-Z][a-zA-Z0-9-]*(?:\([^)]*\))?)*\s*\/>/);return i?i[0]:null}return null}var ko=class{constructor(){this.name="css-selector";}canExtract(t,e){let r=t[e];return r==="#"||r==="."||r==="["||r==="<"?true:r==="@"||r==="*"?Mt(t,e)!==null:false}extract(t,e){let r=Mt(t,e);return r?{value:r,length:r.length,metadata:{type:"css-selector"}}:null}},wo=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],n=i.slice(1).split("(")[0],a=r[1];return {value:i,length:i.length,metadata:{modifierName:n,value:a?n==="queue"?a:parseInt(a,10):void 0}}}},Co=["http://","https://","//","./","../","/"];function bo(t,e){let r=1;for(let i=e;i<t.length;i++){let n=t[i];if(n==="{")r++;else if(n==="}"&&--r===0)return i+1}return -1}function Ao(t,e){let r=t.slice(e),i=Co.find(a=>r.startsWith(a));if(!i)return null;let n=i.length;for(;n<r.length;){let a=r[n];if(a==="$"&&r[n+1]==="{"){let u=bo(r,n+2);if(u!==-1){n=u;continue}}if(/\s/.test(a))break;n++;}return r.slice(0,n)}var Do=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=Ao(t,e);return r?{value:r,length:r.length,metadata:{type:"url"}}:null}},So=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 xo(t){return {isLetter:i=>t.test(i),isIdentifierChar:i=>/[0-9]/.test(i)||t.test(i)}}var Bo=class{constructor(t,e,r){this.name=t;let i=xo(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 n=i.toLowerCase(),a=this.prepositions.has(n),u=this.context.lookupKeyword(n),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:a}}}},Fo=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 To(){return [new Bo("russian-keyword",/[a-zA-Z\u0430-\u044f\u0410-\u042f\u0451\u0401]/,Fo)]}function Ro(t){let e=t.charCodeAt(0);return e>=65&&e<=90||e>=97&&e<=122||e===95||e===36}function Oo(t){let e=t.charCodeAt(0);return e>=48&&e<=57||e>=65&&e<=90||e>=97&&e<=122||e===95||e===36}var Po=class{constructor(){this.name="ascii-identifier";}setContext(t){this.context=t;}canExtract(t,e){return Ro(t[e])}extract(t,e){if(!this.context)throw new Error("AsciiIdentifierExtractor: context not set");let r=e,i="",n=e;for(;n<t.length&&Oo(t[n]);)i+=t[n],n++;if(!i)return null;let a=this.context.lookupKeyword(i),u=a&&a.normalized!==a.native?a.normalized:void 0;return {value:i,length:n-r,metadata:{normalized:u}}}};function No(){return [new Do,new wo,new So,new ko]}var _o=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"]),Mo=[{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:"\u043D\u0438\u0447\u0435\u0433\u043E",normalized:"null"},{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"},{native:"\u0432\u043A\u043B\u044E\u0447\u0438\u0442\u0435\u043B\u044C\u043D\u043E",normalized:"inclusive"},{native:"\u0438\u0441\u043A\u043B\u044E\u0447\u0438\u0442\u0435\u043B\u044C\u043D\u043E",normalized:"exclusive"},{native:"\u0441\u0438\u043C\u0432\u043E\u043B\u044B",normalized:"characters"}],Lo=class extends Te{constructor(){super(),this.language="ru",this.direction="ltr",this.initializeKeywordsFromProfile(It,Mo),this.setNormalizer(new Lt),this.registerExtractors([...No(),...To(),new Be,new Fe,new Po,new Eo,new zo]);}classifyToken(t){let e=t.toLowerCase();return _o.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"}},Io=new Lo;Me("ru",Io,It);var Vt={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",document:"dokument",window:"okno",detail:"szczeg\xF3\u0142"},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"},matches:{primary:"pasuje",normalized:"matches"},no:{primary:"brak",normalized:"no"},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"]}},jt=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"]]),Wt=class{constructor(){this.language="pl";}isNormalizable(t){return t.length<3?false:/[a-zA-Z\u0105\u0119\u0107\u0144\u00f3\u015b\u017a\u017c\u0142\u0104\u0118\u0106\u0143\u00d3\u015a\u0179\u017b\u0141]/.test(t)}normalize(t){let e=t.toLowerCase();if(this.isInfinitive(e))return X(e);let r=this.tryImperativeNormalization(e);if(r)return r;let i=this.tryPastTenseNormalization(e);if(i)return i;let n=this.tryPresentTenseNormalization(e);return n||X(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 jt.has(t)?B(jt.get(t),.95,{removedSuffixes:["imperative"],conjugationType:"imperative"}):t.endsWith("aj")?B(t.slice(0,-2)+"a\u0107",.8,{removedSuffixes:["aj"],conjugationType:"imperative"}):t.endsWith("uj")?B(t.slice(0,-2)+"owa\u0107",.8,{removedSuffixes:["uj"],conjugationType:"imperative"}):t.endsWith("ij")?B(t.slice(0,-2)+"i\u0107",.75,{removedSuffixes:["ij"],conjugationType:"imperative"}):null}tryPresentTenseNormalization(t){return t.endsWith("uj\u0119")||t.endsWith("uje")?B(t.slice(0,-3)+"owa\u0107",.85,{removedSuffixes:["uj\u0119"],conjugationType:"present"}):t.endsWith("am")&&t.length>3?B(t.slice(0,-2)+"a\u0107",.8,{removedSuffixes:["am"],conjugationType:"present"}):t.endsWith("em")&&t.length>3?B(t.slice(0,-2)+"e\u0107",.75,{removedSuffixes:["em"],conjugationType:"present"}):t.endsWith("\u0119")&&t.length>2?B(t.slice(0,-1)+"a\u0107",.7,{removedSuffixes:["\u0119"],conjugationType:"present"}):null}tryPastTenseNormalization(t){if(t.endsWith("a\u0142em")||t.endsWith("a\u0142am"))return B(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 B(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 B(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 B(t.slice(0,-e)+"i\u0107",.8,{removedSuffixes:[t.slice(-e)],conjugationType:"past"})}return null}},jo=["===","!==","->","==","!=","<=",">=","&&","||","**","+=","-=","*=","/=","+","-","*","/","=",">","<","!","&","|","%","^","~"],$o=class{constructor(t=jo){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}},Vo="()[]{},:;",Wo=class{constructor(t=Vo){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 Fr(t,e){let r=e;for(;r<t.length&&t[r]===":";){let i=t.slice(r).match(/^::?[a-zA-Z][a-zA-Z0-9-]*/);if(!i)break;let n=r+i[0].length;if(t[n]==="("){let a=0,u=n;for(;u<t.length;){if(t[u]==="(")a++;else if(t[u]===")"&&(a--,a===0)){u++;break}u++;}if(a!==0)break;n=u;}r=n;}return r}function $t(t,e){let r=t[e];if(r==="#"){let i=t.slice(e).match(/^#[a-zA-Z_][\w-]*/);if(!i)return null;let n=Fr(t,e+i[0].length);return t.slice(e,n)}if(r==="."){let i=t.slice(e).match(/^\.\{[a-zA-Z_$][\w$]*\}/);if(i)return i[0];let n=t.slice(e).match(/^\.[a-zA-Z_][\w-]*/);if(!n)return null;let a=Fr(t,e+n[0].length);return t.slice(e,a)}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,n=e;for(;n<t.length;){if(t[n]==="["&&i++,t[n]==="]"&&(i--,i===0)){let a=Fr(t,n+1);return t.slice(e,a)}n++;}return null}if(r==="<"){let i=t.slice(e).match(/^<(?=[\w.#[])[\w-]*(?:[#.][\w-]+|\[[^\]]+\]|::?[a-zA-Z][a-zA-Z0-9-]*(?:\([^)]*\))?)*\s*\/>/);return i?i[0]:null}return null}var qo=class{constructor(){this.name="css-selector";}canExtract(t,e){let r=t[e];return r==="#"||r==="."||r==="["||r==="<"?true:r==="@"||r==="*"?$t(t,e)!==null:false}extract(t,e){let r=$t(t,e);return r?{value:r,length:r.length,metadata:{type:"css-selector"}}:null}},Ko=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],n=i.slice(1).split("(")[0],a=r[1];return {value:i,length:i.length,metadata:{modifierName:n,value:a?n==="queue"?a:parseInt(a,10):void 0}}}},Uo=["http://","https://","//","./","../","/"];function Ho(t,e){let r=1;for(let i=e;i<t.length;i++){let n=t[i];if(n==="{")r++;else if(n==="}"&&--r===0)return i+1}return -1}function Go(t,e){let r=t.slice(e),i=Uo.find(a=>r.startsWith(a));if(!i)return null;let n=i.length;for(;n<r.length;){let a=r[n];if(a==="$"&&r[n+1]==="{"){let u=Ho(r,n+2);if(u!==-1){n=u;continue}}if(/\s/.test(a))break;n++;}return r.slice(0,n)}var Yo=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=Go(t,e);return r?{value:r,length:r.length,metadata:{type:"url"}}:null}},Zo=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"}}}},Xo=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 Jo(){let t=/[a-zA-Z\u0105\u0119\u0107\u0144\u00f3\u015b\u017a\u017c\u0142\u0104\u0118\u0106\u0143\u00d3\u015a\u0179\u017b\u0141]/;return {isLetter:i=>t.test(i),isIdentifierChar:i=>/[0-9]/.test(i)||t.test(i)}}var{isLetter:Qo,isIdentifierChar:es}=Jo(),rs=class{constructor(){this.name="polish-keyword";}setContext(t){this.context=t;}canExtract(t,e){return Qo(t[e])}extract(t,e){if(!this.context)throw new Error("PolishKeywordExtractor: context not set");let r=e,i="";for(;r<t.length&&es(t[r]);)i+=t[r++];if(!i)return null;let n=i.toLowerCase(),a=Xo.has(n),u=this.context.lookupKeyword(n),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:a}}}};function ts(){return [new rs]}function is(){return [new Yo,new Ko,new Zo,new qo]}var ns=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"]),as=[{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"},{native:"w\u0142\u0105cznie",normalized:"inclusive"},{native:"wy\u0142\u0105cznie",normalized:"exclusive"},{native:"znaki",normalized:"characters"},{native:"losowy",normalized:"random"}],us=class extends Te{constructor(){super(),this.language="pl",this.direction="ltr",this.initializeKeywordsFromProfile(Vt,as),this.setNormalizer(new Wt),this.registerExtractors(is()),this.registerExtractor(new Be),this.registerExtractor(new Fe),this.registerExtractors(ts()),this.registerExtractor(new $o),this.registerExtractor(new Wo);}classifyToken(t){let e=t.toLowerCase();return ns.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"}},os=new us;Me("pl",os,Vt);function ss(t){return /[\u0430-\u044f\u0410-\u042f\u0456\u0406\u0457\u0407\u0454\u0404\u0491\u0490\u044c\u042c']/.test(t)}var qt=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"]]),Ut=class{constructor(){this.language="uk";}isNormalizable(t){return t.length<3?false:ss(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 X(t);let r=this.tryImperativeLookup(e);if(r)return r;let i=this.tryPastTenseNormalization(e);if(i)return i;let n=this.tryPresentTenseNormalization(e);if(n)return n;let a=this.tryGenericImperativeNormalization(e);return a||X(t)}tryReflexiveNormalization(t){let e=t.slice(0,-2);if(t.endsWith("\u0442\u0438\u0441\u044F")||t.endsWith("\u0447\u0438\u0441\u044F"))return X(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 B(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 X(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 n=this.tryGenericImperativeNormalization(t);return n||X(t)}tryImperativeLookup(t){return qt.has(t)?B(qt.get(t),.95,{removedSuffixes:["imperative"],conjugationType:"imperative"}):null}tryGenericImperativeNormalization(t){return t.endsWith("\u0439\u0442\u0435")&&t.length>5?B(t.slice(0,-3)+"\u0442\u0438",.8,{removedSuffixes:["\u0439\u0442\u0435"],conjugationType:"imperative"}):t.endsWith("\u0456\u0442\u044C")&&t.length>5?B(t.slice(0,-3)+"\u0438\u0442\u0438",.8,{removedSuffixes:["\u0456\u0442\u044C"],conjugationType:"imperative"}):t.endsWith("\u0439")&&t.length>3?B(t.slice(0,-1)+"\u0442\u0438",.75,{removedSuffixes:["\u0439"],conjugationType:"imperative"}):t.endsWith("\u0438")&&t.length>3?B(t+"\u0442\u0438",.7,{removedSuffixes:["\u0438\u2192\u0438\u0442\u0438"],conjugationType:"imperative"}):null}tryPastTenseNormalization(t){return t.endsWith("\u0430\u043B\u0430")&&t.length>4?B(t.slice(0,-3)+"\u0430\u0442\u0438",.85,{removedSuffixes:["\u0430\u043B\u0430"],conjugationType:"past"}):t.endsWith("\u0438\u043B\u0430")&&t.length>4?B(t.slice(0,-3)+"\u0438\u0442\u0438",.85,{removedSuffixes:["\u0438\u043B\u0430"],conjugationType:"past"}):t.endsWith("\u0430\u043B\u0438")&&t.length>4?B(t.slice(0,-3)+"\u0430\u0442\u0438",.85,{removedSuffixes:["\u0430\u043B\u0438"],conjugationType:"past"}):t.endsWith("\u0438\u043B\u0438")&&t.length>4?B(t.slice(0,-3)+"\u0438\u0442\u0438",.85,{removedSuffixes:["\u0438\u043B\u0438"],conjugationType:"past"}):t.endsWith("\u0430\u0432")&&t.length>3?B(t.slice(0,-2)+"\u0430\u0442\u0438",.82,{removedSuffixes:["\u0430\u0432"],conjugationType:"past"}):t.endsWith("\u0438\u0432")&&t.length>3?B(t.slice(0,-2)+"\u0438\u0442\u0438",.82,{removedSuffixes:["\u0438\u0432"],conjugationType:"past"}):null}tryPresentTenseNormalization(t){return t.endsWith("\u0438\u0448")&&t.length>3?B(t.slice(0,-2)+"\u0438\u0442\u0438",.8,{removedSuffixes:["\u0438\u0448"],conjugationType:"present"}):t.endsWith("\u0438\u0442\u044C")&&t.length>4?B(t.slice(0,-3)+"\u0438\u0442\u0438",.78,{removedSuffixes:["\u0438\u0442\u044C"],conjugationType:"present"}):t.endsWith("\u0438\u043C\u043E")&&t.length>4?B(t.slice(0,-3)+"\u0438\u0442\u0438",.8,{removedSuffixes:["\u0438\u043C\u043E"],conjugationType:"present"}):t.endsWith("\u044F\u0442\u044C")&&t.length>4?B(t.slice(0,-3)+"\u0438\u0442\u0438",.78,{removedSuffixes:["\u044F\u0442\u044C"],conjugationType:"present"}):t.endsWith("\u0454\u0448")&&t.length>3?B(t.slice(0,-2)+"\u0430\u0442\u0438",.78,{removedSuffixes:["\u0454\u0448"],conjugationType:"present"}):t.endsWith("\u0435\u0448")&&t.length>3?B(t.slice(0,-2)+"\u0430\u0442\u0438",.75,{removedSuffixes:["\u0435\u0448"],conjugationType:"present"}):t.endsWith("\u0454")&&t.length>2?B(t.slice(0,-1)+"\u0430\u0442\u0438",.72,{removedSuffixes:["\u0454"],conjugationType:"present"}):t.endsWith("\u0454\u043C\u043E")&&t.length>4?B(t.slice(0,-3)+"\u0430\u0442\u0438",.8,{removedSuffixes:["\u0454\u043C\u043E"],conjugationType:"present"}):t.endsWith("\u044E\u0442\u044C")&&t.length>4?B(t.slice(0,-3)+"\u0430\u0442\u0438",.78,{removedSuffixes:["\u044E\u0442\u044C"],conjugationType:"present"}):t.endsWith("\u0443\u0442\u044C")&&t.length>4?B(t.slice(0,-3)+"\u0430\u0442\u0438",.75,{removedSuffixes:["\u0443\u0442\u044C"],conjugationType:"present"}):null}},Ht={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",document:"\u0434\u043E\u043A\u0443\u043C\u0435\u043D\u0442",window:"\u0432\u0456\u043A\u043D\u043E",detail:"\u0434\u0435\u0442\u0430\u043B\u0456"},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"},exists:{primary:"\u0456\u0441\u043D\u0443\u0454",normalized:"exists"},is:{primary:"\u0454",normalized:"is"},no:{primary:"\u043D\u0456",normalized:"no"},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"]}},ls=["===","!==","->","==","!=","<=",">=","&&","||","**","+=","-=","*=","/=","+","-","*","/","=",">","<","!","&","|","%","^","~"],cs=class{constructor(t=ls){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}},ms="()[]{},:;",ds=class{constructor(t=ms){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 Tr(t,e){let r=e;for(;r<t.length&&t[r]===":";){let i=t.slice(r).match(/^::?[a-zA-Z][a-zA-Z0-9-]*/);if(!i)break;let n=r+i[0].length;if(t[n]==="("){let a=0,u=n;for(;u<t.length;){if(t[u]==="(")a++;else if(t[u]===")"&&(a--,a===0)){u++;break}u++;}if(a!==0)break;n=u;}r=n;}return r}function Kt(t,e){let r=t[e];if(r==="#"){let i=t.slice(e).match(/^#[a-zA-Z_][\w-]*/);if(!i)return null;let n=Tr(t,e+i[0].length);return t.slice(e,n)}if(r==="."){let i=t.slice(e).match(/^\.\{[a-zA-Z_$][\w$]*\}/);if(i)return i[0];let n=t.slice(e).match(/^\.[a-zA-Z_][\w-]*/);if(!n)return null;let a=Tr(t,e+n[0].length);return t.slice(e,a)}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,n=e;for(;n<t.length;){if(t[n]==="["&&i++,t[n]==="]"&&(i--,i===0)){let a=Tr(t,n+1);return t.slice(e,a)}n++;}return null}if(r==="<"){let i=t.slice(e).match(/^<(?=[\w.#[])[\w-]*(?:[#.][\w-]+|\[[^\]]+\]|::?[a-zA-Z][a-zA-Z0-9-]*(?:\([^)]*\))?)*\s*\/>/);return i?i[0]:null}return null}var ps=class{constructor(){this.name="css-selector";}canExtract(t,e){let r=t[e];return r==="#"||r==="."||r==="["||r==="<"?true:r==="@"||r==="*"?Kt(t,e)!==null:false}extract(t,e){let r=Kt(t,e);return r?{value:r,length:r.length,metadata:{type:"css-selector"}}:null}},fs=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],n=i.slice(1).split("(")[0],a=r[1];return {value:i,length:i.length,metadata:{modifierName:n,value:a?n==="queue"?a:parseInt(a,10):void 0}}}},ys=["http://","https://","//","./","../","/"];function hs(t,e){let r=1;for(let i=e;i<t.length;i++){let n=t[i];if(n==="{")r++;else if(n==="}"&&--r===0)return i+1}return -1}function vs(t,e){let r=t.slice(e),i=ys.find(a=>r.startsWith(a));if(!i)return null;let n=i.length;for(;n<r.length;){let a=r[n];if(a==="$"&&r[n+1]==="{"){let u=hs(r,n+2);if(u!==-1){n=u;continue}}if(/\s/.test(a))break;n++;}return r.slice(0,n)}var Es=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=vs(t,e);return r?{value:r,length:r.length,metadata:{type:"url"}}:null}},gs=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 zs(t){return {isLetter:i=>t.test(i),isIdentifierChar:i=>/[0-9]/.test(i)||t.test(i)}}var ks=class{constructor(t,e,r){this.name=t;let i=zs(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 n=i.toLowerCase(),a=this.prepositions.has(n),u=this.context.lookupKeyword(n),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:a}}}},ws=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 Cs(){return [new ks("ukrainian-keyword",/[a-zA-Z\u0430-\u044f\u0410-\u042f\u0456\u0406\u0457\u0407\u0454\u0404\u0491\u0490\u044c\u042c']/,ws)]}function bs(t){let e=t.charCodeAt(0);return e>=65&&e<=90||e>=97&&e<=122||e===95||e===36}function As(t){let e=t.charCodeAt(0);return e>=48&&e<=57||e>=65&&e<=90||e>=97&&e<=122||e===95||e===36}var Ds=class{constructor(){this.name="ascii-identifier";}setContext(t){this.context=t;}canExtract(t,e){return bs(t[e])}extract(t,e){if(!this.context)throw new Error("AsciiIdentifierExtractor: context not set");let r=e,i="",n=e;for(;n<t.length&&As(t[n]);)i+=t[n],n++;if(!i)return null;let a=this.context.lookupKeyword(i),u=a&&a.normalized!==a.native?a.normalized:void 0;return {value:i,length:n-r,metadata:{normalized:u}}}};function Ss(){return [new Es,new fs,new gs,new ps]}var xs=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"]),Bs=[{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:"\u043D\u0456\u0447\u043E\u0433\u043E",normalized:"null"},{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"},{native:"\u0432\u043A\u043B\u044E\u0447\u043D\u043E",normalized:"inclusive"},{native:"\u0432\u0438\u043A\u043B\u044E\u0447\u043D\u043E",normalized:"exclusive"},{native:"\u0441\u0438\u043C\u0432\u043E\u043B\u0438",normalized:"characters"}],Fs=class extends Te{constructor(){super(),this.language="uk",this.direction="ltr",this.initializeKeywordsFromProfile(Ht,Bs),this.setNormalizer(new Ut),this.registerExtractors([...Ss(),...Cs(),new Be,new Fe,new Ds,new cs,new ds]);}classifyToken(t){let e=t.toLowerCase();return xs.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"}},Ts=new Fs;Me("uk",Ts,Ht);function lr(t){let e=t.getAttribute("data-lang");if(e)return Rr(e);let r=t.getAttribute("data-hyperscript-lang")??t.closest?.("[data-hyperscript-lang]")?.getAttribute("data-hyperscript-lang");if(r)return Rr(r);let i=typeof document<"u"?document.documentElement?.lang:null;return i&&i!=="en"?Rr(i):null}function Rr(t){return t.split("-")[0].toLowerCase()}var Gt={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",""],["style","with"],["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 cr(t){switch(t.kind){case "event-handler":return Rs(t);case "compound":return Os(t);default:return Ps(t)}}function Rs(t){let e=["on"],r=t.roles.get("event");r&&e.push(Ze(r));let i=t.roles.get("source");if(i&&e.push("from",Ze(i)),t.body&&t.body.length>0){let n=t.body.map(cr);e.push(n.join(" then "));}return e.join(" ")}function Os(t){let e=t.chainType==="async"?"async":t.chainType;return t.statements.map(cr).join(` ${e} `)}function Ps(t){let e=Gt[t.action];if(e){let i=[t.action];for(let[n,a]of e){let u=t.roles.get(n);u&&((n==="destination"||n==="source")&&u.type==="reference"&&u.value==="me"||(a&&i.push(a),i.push(Ze(u))));}return i.join(" ")}let r=[t.action];for(let[,i]of t.roles)r.push(Ze(i));return r.join(" ")}function Ze(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 Ns(t);case "expression":return t.raw;case "flag":return t.enabled?`+${t.name}`:`~${t.name}`}}function Ns(t){let e=Ze(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 Zt=.5,_s={confidenceThreshold:Zt,strategy:"semantic",fallbackToOriginal:true};function Ms(t,e){return typeof t=="number"?t:t[e]??t["*"]??Zt}function Or(t,e,r={}){let i={..._s,...r},n=Yt(t,e,i);if(n!==null)return n;let a=Is(t);if(a){let u=Yt(a.commands,e,i);if(u!==null)return a.prefix+u}return t}function Yt(t,e,r){if(r.strategy==="semantic"||r.strategy==="auto"){let i=Ms(r.confidenceThreshold,e),n=Xt(t,e,i);if(n!==null)return n}if((r.strategy==="auto"||r.strategy==="i18n")&&r.i18nToEnglish){let i=js(t,e,r.i18nToEnglish);if(i!==null)return i}return null}var Ls=/^(on\s+(?:every\s+)?[\w-]+(?:\[.*?\])?(?:\.[\w-]+(?:\([^)]*\))?)*(?:\s+from\s+\S+)?(?:\s+queue\s+\w+)?\s+)/;function Is(t){let e=t.match(Ls);if(!e)return null;let r=e[1],i=t.slice(r.length);return i?{prefix:r,commands:i}:null}function Xt(t,e,r){try{let i=Vs(t,e);if(i.length>1)return Ws(i,e,r);if(!ft(e))return null;let n=Rt(t,e);return n.confidence<r||!n.node?null:cr(n.node)}catch{return null}}function js(t,e,r){try{let i=r(t,e);return i!==t?i:null}catch{return null}}function $s(t){let e=["then"],r=N(t);if(r?.keywords?.then){let i=r.keywords.then;if(i.primary&&i.primary!=="then"&&e.push(i.primary),i.alternatives)for(let n of i.alternatives)e.includes(n)||e.push(n);}return e}function Vs(t,e){let i=$s(e).map(o=>o.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")),n=new RegExp(`\\s+(?:${i.join("|")})\\s+`,"i"),a=t.split(`
|
|
5
5
|
`).map(o=>o.trim()).filter(o=>o.length>0),u=[];for(let o of a){let s=o.split(n);u.push(...s);}return u}function Ws(t,e,r){let i=[];for(let n of t){let a=Xt(n.trim(),e,r);if(a===null)return null;i.push(a);}return i.join(" then ")}function Pr(t={}){return function(r){let{internals:i}=r,n=i.runtime,a=n.getScript.bind(n);n.getScript=function(u){let o=a(u);if(!o)return null;let s=qs(u,t);if(!s||s==="en")return o;let l=Or(o,s,t);return t.debug&&l!==o&&console.log(`[hyperscript-i18n] ${s}: "${o}" \u2192 "${l}"`),l};}}function qs(t,e){if(e.languageAttribute){let i=t.getAttribute(e.languageAttribute);if(i)return i.split("-")[0].toLowerCase()}let r=lr(t);return r||(e.defaultLanguage??null)}function Jt(t,e,r={}){return e==="en"?t:Or(t,e,r)}pt(t=>Nt(t));function Qt(){typeof _hyperscript<"u"&&_hyperscript.use&&(_hyperscript.use(Pr()),Ks());}function Ks(){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 n=e.getInternalData(i);n.initialized&&(n.initialized=false);}),e.processNode(document.body);}var Ql=["ru","pl","uk"];Qt();exports.plugin=Pr;exports.preprocess=Jt;exports.resolveLanguage=lr;exports.supportedLanguages=Ql;return exports;})({});
|