@lokascript/hyperscript-adapter 3.1.1 → 3.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +186 -1
- package/README.md +30 -25
- package/dist/hyperscript-i18n-ar.global.js +6 -5
- package/dist/hyperscript-i18n-bn.global.js +6 -5
- package/dist/hyperscript-i18n-de.global.js +6 -5
- package/dist/hyperscript-i18n-east-asian.global.js +6 -5
- package/dist/hyperscript-i18n-en.global.js +8 -7
- package/dist/hyperscript-i18n-es.global.js +6 -5
- package/dist/hyperscript-i18n-fr.global.js +6 -5
- package/dist/hyperscript-i18n-he.global.js +6 -5
- package/dist/hyperscript-i18n-hi.global.js +6 -5
- package/dist/hyperscript-i18n-id.global.js +6 -5
- package/dist/hyperscript-i18n-it.global.js +6 -5
- package/dist/hyperscript-i18n-ja.global.js +6 -5
- package/dist/hyperscript-i18n-ko.global.js +6 -5
- package/dist/hyperscript-i18n-lite.global.js +2 -2
- package/dist/hyperscript-i18n-ms.global.js +6 -5
- package/dist/hyperscript-i18n-pl.global.js +6 -5
- package/dist/hyperscript-i18n-pt.global.js +6 -5
- package/dist/hyperscript-i18n-qu.global.js +6 -5
- package/dist/hyperscript-i18n-ru.global.js +6 -5
- package/dist/hyperscript-i18n-slavic.global.js +6 -5
- package/dist/hyperscript-i18n-south-asian.global.js +6 -5
- package/dist/hyperscript-i18n-southeast-asian.global.js +6 -5
- package/dist/hyperscript-i18n-sw.global.js +6 -5
- package/dist/hyperscript-i18n-th.global.js +6 -5
- package/dist/hyperscript-i18n-tl.global.js +6 -5
- package/dist/hyperscript-i18n-tr.global.js +6 -5
- package/dist/hyperscript-i18n-uk.global.js +6 -5
- package/dist/hyperscript-i18n-vi.global.js +6 -5
- package/dist/hyperscript-i18n-western.global.js +6 -5
- package/dist/hyperscript-i18n-zh.global.js +6 -5
- package/dist/hyperscript-i18n.global.js +28 -27
- package/dist/hyperscript-i18n.global.js.map +1 -1
- package/dist/index.cjs +17 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +17 -2
- package/dist/index.js.map +1 -1
- package/package.json +7 -4
- package/src/attribute-translator.ts +18 -2
- package/src/generated/syntax-table.ts +1 -1
- package/src/host-validate.ts +39 -7
- package/src/hyperscript-renderer.ts +21 -0
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
var HyperscriptI18n=(function(exports){'use strict';function me(t,e){return e?{type:"literal",value:t,dataType:e}:{type:"literal",value:t}}function tr(t,e){return e?{type:"selector",value:t,selectorKind:e}:{type:"selector",value:t}}function qe(t){return {type:"reference",value:t}}function ir(t,e){return {type:"property-path",object:t,property:e}}var Qr=new Set(["me","you","it","result","event","target","body","document","window","detail"]);function gr(t,e=Qr){return e.has(t)}var Li=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 Mi(t){return new Li(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 _i(t,e){return t?.possessive?.keywords?.[e]}var He=class xe{constructor(){this.logger=Mi("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 E=this.collectStopMarkers(r,l+1);if(n)for(let h of n)E.add(h);let y=[];for(;!e.isAtEnd();){let h=e.peek();if(!h||this.isStopMarker(h,E))break;y.push(h.value),e.advance();}if(y.length>0){i.set(c.role,{type:"expression",raw:y.join(" ")}),o=null,s=null;continue}else {if(c.optional)continue;return false}}if(c.type==="group"){let E=this.collectStopMarkers(r,l+1);if(n)for(let h of n)E.add(h);if(this.matchGroupToken(e,c,i,E)){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 E=l+1<r.length?r[l+1]:null;if(E?.type==="literal"){let y=e.peek();if(y&&this.getMatchType(y,E.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 v=this.matchPatternToken(e,c,i);if(this.logger.debug(" >> Match result:",v),v){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 E=this.matchPatternToken(e,c,i);if(this.logger.debug(" >> Backtrack retry result:",E),E)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=_i(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()),ir(qe(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(),ir(tr(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 ir(tr(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 tr(e.value);case "literal":return this.parseLiteralValue(e.value);case "keyword":let r=e.normalized||e.value;this.safeToLowerCase(r);return me(e.normalized||e.value);case "identifier":if(typeof e.value=="string"&&e.value.startsWith(":"))return qe(e.value);this.safeToLowerCase(e.value);return {type:"expression",raw:e.value};case "url":return me(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 me(n,"string")}if(e==="true")return me(true,"boolean");if(e==="false")return me(false,"boolean");let r=e.match(/^(\d+(?:\.\d+)?)(ms|s|m|h)?$/);if(r){let n=parseFloat(r[1]);return r[2]?me(e,"duration"):me(n,"number")}let i=parseFloat(e);return isNaN(i)?me(e,"string"):me(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}};He.MAX_MARKER_SCAN=3;He.MAX_PROPERTY_DEPTH=10;He.MAX_METHOD_ARGS=20;He.ENGLISH_NOISE_WORDS=new Set(["the","a","an"]);var Ii=He;new Ii;var Be=class{constructor(){this.name="string-literal";}canExtract(t,e){let r=t[e];return r==="'"&&e>0&&/[\p{L}\p{N}_)\]]/u.test(t[e-1])?false: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 ji(t){return "setContext"in t&&typeof t.setContext=="function"}function $i(t){let e={language:t.language,direction:t.direction,lookupKeyword:t.lookupKeyword.bind(t),isKeyword:t.isKeyword.bind(t),isKeywordStart:t.isKeywordStart.bind(t),...t.isKeywordStartAtBoundary?{isKeywordStartAtBoundary:t.isKeywordStartAtBoundary.bind(t)}:{}};return t.normalizer?{...e,normalizer:t.normalizer}:e}var ae=class{constructor(t,e){this.pos=0,this.tokens=t,this.language=e;}peek(t=0){let e=this.pos+t;return e<0||e>=this.tokens.length?null:this.tokens[e]}advance(){if(this.isAtEnd())throw new Error("Unexpected end of token stream");return this.tokens[this.pos++]}isAtEnd(){return this.pos>=this.tokens.length}mark(){return {position:this.pos}}reset(t){this.pos=t.position;}position(){return this.pos}remaining(){return this.tokens.slice(this.pos)}takeWhile(t){let e=[];for(;!this.isAtEnd()&&t(this.peek());)e.push(this.advance());return e}skipWhile(t){for(;!this.isAtEnd()&&t(this.peek());)this.advance();}};function G(t,e){return {start:t,end:e}}function Y(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 Ke(t){return /\s/.test(t)}function Vi(t){return t==="#"||t==="."||t==="["||t==="@"||t==="*"||t==="<"}function Wi(t){return t==='"'||t==="'"||t==="`"||t==="\u300C"||t==="\u300D"}function ze(t){return /\d/.test(t)}function ar(t){return t.replace(/[\u064b-\u0652\u0670]/g,"")}function qi(t){return /[a-zA-Z]/.test(t)}function ne(t){return /[a-zA-Z0-9_-]/.test(t)}function Ki(t,e){if(e>=t.length)return null;let r=t[e];if(!Vi(r))return null;let i=e,n="";if(r==="#"||r==="."){for(n+=t[i++];i<t.length&&ne(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&&ne(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&&ne(t[i]);)n+=t[i++];if(n.length<=1)return null}else if(r==="*"){for(n+=t[i++];i<t.length&&ne(t[i]);)n+=t[i++];if(n.length<=1)return null}else if(r==="<"){if(n+=t[i++],i>=t.length||!qi(t[i]))return null;for(;i<t.length&&ne(t[i]);)n+=t[i++];for(;i<t.length;){let a=t[i];if(a==="."){if(n+=t[i++],i>=t.length||!ne(t[i]))return null;for(;i<t.length&&ne(t[i]);)n+=t[i++];}else if(a==="#"){if(n+=t[i++],i>=t.length||!ne(t[i]))return null;for(;i<t.length&&ne(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&&Ke(t[i]);)n+=t[i++];if(i<t.length&&t[i]==="/")for(n+=t[i++];i<t.length&&Ke(t[i]);)n+=t[i++];if(i>=t.length||t[i]!==">")return null;n+=t[i++];}return n||null}function Hi(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 Ke(i)||i==="*"||!ne(i)}function Ui(t,e){if(e>=t.length)return null;let r=t[e];if(!Wi(r)||r==="'"&&Hi(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 Gi(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 Yi(t,e){if(!Gi(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 Zi(t,e){if(e>=t.length)return null;let r=t[e];if(!ze(r)&&r!=="-"&&r!=="+")return null;let i=e,n="";if((t[i]==="-"||t[i]==="+")&&(n+=t[i++]),i>=t.length||!ze(t[i]))return null;for(;i<t.length&&ze(t[i]);)n+=t[i++];if(i<t.length&&t[i]===".")for(n+=t[i++];i<t.length&&ze(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 Ji=["===","!==","->","==","!=","<=",">=","&&","||","**","+=","-=","*=","/=","+","-","*","/","=",">","<","!","&","|","%","^","~"];new Set(Ji);var Xi=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"]);function Qi(t){return t.includes("-")&&/^[\p{L}\p{N}_]+(-[\p{L}\p{N}_]+)+$/u.test(t)}var en=["click","dblclick","input","change","submit","keydown","keyup","keypress","mousedown","mouseup","mouseover","mouseout","mouseenter","mouseleave","mousemove","pointerdown","pointerup","pointermove","focus","blur","load","resize","scroll"],ur=class nr{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){ji(e)&&e.setContext($i(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&&Ke(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,f]of Object.entries(o.metadata))p!=="normalized"&&p!=="stem"&&p!=="stemConfidence"&&(m[p]=f);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(Y(o.value,this.classifyToken(o.value),G(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(Y(u,o,G(i,i+1))),i++;}}return new ae(this.mergeColonQualifiedNames(r),this.language)}mergeColonQualifiedNames(e){let r=[];for(let i of e){let n=r[r.length-1];if(n&&nr.ASCII_WORD.test(n.value)&&nr.COLON_QUALIFIER.test(i.value)&&n.position.end===i.position.start){let a=n.value+i.value;r[r.length-1]=Y(a,this.classifyToken(a),G(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(Y(".","operator",G(r,r+1))),true;let s=r+1;for(;s<e.length&&ne(e[s]);)s++;return s<e.length&&e[s]==="("?(i.push(Y(".","operator",G(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 en)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(" ")||Qi(n.native))&&!Xi.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 ar(e)}tryProfileKeyword(e,r){for(let i of this.profileKeywords)if(e.slice(r).startsWith(i.native))return Y(i.native,"keyword",G(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 Y(a.native,"keyword",G(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 Y(e,"keyword",G(r,i),u)}trySelector(e,r){let i=Ki(e,r);return i?Y(i,"selector",G(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 {...Y(n,"event-modifier",G(r,r+n.length)),metadata:{modifierName:a,value:u?a==="queue"?u:parseInt(u,10):void 0}}}tryString(e,r){let i=Ui(e,r);return i?Y(i,"literal",G(r,r+i.length)):null}tryNumber(e,r){let i=Zi(e,r);return i?Y(i,"literal",G(r,r+i.length)):null}tryMatchTimeUnit(e,r,i,n=false){let a=r;if(n)for(;a<e.length&&Ke(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(ne(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||!ze(e[n]))return null;for(;n<e.length&&ze(e[n]);)a+=e[n++];if(n<e.length&&e[n]===".")for(a+=e[n++];n<e.length&&ze(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,...nr.STANDARD_TIME_UNITS],m=this.tryMatchTimeUnit(e,l,c,u);return m&&(s+=m.suffix,l=m.endPos),Y(s,"literal",G(r,l))}tryUrl(e,r){let i=Yi(e,r);return i?Y(i,"url",G(r,r+i.length)):null}tryVariableRef(e,r){if(e[r]!==":"||r+1>=e.length||!ne(e[r+1]))return null;let i=r+1;for(;i<e.length&&ne(e[i]);)i++;let n=e.slice(r,i);return Y(n,"identifier",G(r,i))}tryOperator(e,r){let i=e.slice(r,r+2);if(["==","!=","<=",">=","&&","||","->"].includes(i))return Y(i,"operator",G(r,r+2));let n=e[r];return ["<",">","!","+","-","*","/","="].includes(n)?Y(n,"operator",G(r,r+1)):["(",")","{","}",",",";",":"].includes(n)?Y(n,"punctuation",G(r,r+1)):null}tryMultiCharParticle(e,r,i){for(let n of i)if(e.slice(r,r+n.length)===n)return Y(n,"particle",G(r,r+n.length));return null}};ur.ASCII_WORD=/^[A-Za-z_][A-Za-z0-9_]*$/;ur.COLON_QUALIFIER=/^:[A-Za-z_][A-Za-z0-9_]*$/;ur.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=ur;function re(t){return {stem:t,confidence:1}}function x(t,e,r){return r?{stem:t,confidence:e,metadata:r}:{stem:t,confidence:e}}var rn=Object.defineProperty,tn=Object.getOwnPropertyNames,Ct=(t,e)=>function(){return t&&(e=(0, t[tn(t)[0]])(t=0)),e},nn=(t,e)=>{for(var r in e)rn(t,r,{get:e[r],enumerable:true});};function tt(t,e){return t.replace(/\{(\w+)\}/g,(r,i)=>String(e[i]??`{${i}}`))}function ue(t,e,r={},i){let n=bt[t],a=tt(n,r),u=At[t],o=u?tt(u,r):void 0;return {code:t,message:a,severity:e,...i&&{role:i},...o&&{suggestion:o}}}var R,bt,At,an=Ct({"src/generators/schema-error-codes.ts"(){R={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"},bt={[R.AMBIGUOUS_TYPE_LITERAL_SELECTOR]:"Role '{role}' accepts both 'literal' and 'selector'. This may cause ambiguous type inference for values starting with special characters (* . # etc.).",[R.TOO_MANY_EXPECTED_TYPES]:"Role '{role}' accepts {count} different types. This may make type inference unreliable.",[R.MULTI_TYPE_PATIENT_EXPECTED]:"Role '{role}' accepts multiple types (expected for {command} command).",[R.NO_REQUIRED_ROLES]:"Command has no required roles. Is this intentional?",[R.NO_REQUIRED_ROLES_EXPECTED]:"Command has no required roles (expected for {command}).",[R.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.",[R.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.",[R.EVENT_HANDLER_MISSING_EVENT]:"Event handler command should have an 'event' role to specify which event to listen for.",[R.EVENT_HANDLER_EVENT_NOT_REQUIRED]:"Event role should be required - every event handler needs an event to listen for.",[R.CONDITIONAL_MISSING_CONDITION]:"Conditional command should have a 'condition' role for the boolean expression.",[R.CONDITIONAL_CONDITION_NOT_REQUIRED]:"Condition role should be required - conditionals need a condition to evaluate.",[R.FOR_LOOP_MISSING_SOURCE]:"For-loop should have a 'source' role for the collection to iterate over.",[R.WHILE_LOOP_MISSING_CONDITION]:"While-loop should have a 'condition' role for the loop condition.",[R.VALUE_TYPE_MISMATCH]:"Role '{role}' of command '{command}' expects type [{expectedTypes}], got '{actualType}'.",[R.SELECTOR_KIND_MISMATCH]:"Role '{role}' of command '{command}' expects selector kind [{selectorKinds}], got '{actualKind}'.",[R.SELECTOR_KINDS_WITHOUT_SELECTOR_TYPE]:"Role '{role}' has selectorKinds but expectedTypes does not include 'selector'.",[R.KEYWORD_COLLISION]:"Keyword '{keyword}' is used by multiple commands: {commands}. Only the first-registered command will be reachable."},At={[R.AMBIGUOUS_TYPE_LITERAL_SELECTOR]:"Consider being more specific about which type is expected, or use explicit type markers.",[R.TOO_MANY_EXPECTED_TYPES]:"Consider narrowing the accepted types to improve type inference reliability.",[R.TRANSITION_PATIENT_ACCEPTS_SELECTOR]:"Remove 'selector' from expectedTypes and only accept 'literal'.",[R.TRANSITION_MISSING_GOAL]:"Add a 'goal' role with expectedTypes ['literal', 'variable'].",[R.EVENT_HANDLER_MISSING_EVENT]:"Add an 'event' role with expectedTypes ['literal'].",[R.EVENT_HANDLER_EVENT_NOT_REQUIRED]:"Set required: true on the 'event' role.",[R.CONDITIONAL_MISSING_CONDITION]:"Add a 'condition' role with expectedTypes ['expression'].",[R.CONDITIONAL_CONDITION_NOT_REQUIRED]:"Set required: true on the 'condition' role.",[R.FOR_LOOP_MISSING_SOURCE]:"Add a 'source' role for the collection to iterate over.",[R.WHILE_LOOP_MISSING_CONDITION]:"Add a 'condition' role for the loop continuation condition.",[R.VALUE_TYPE_MISMATCH]:"Ensure the value matches one of the expected types: [{expectedTypes}].",[R.SELECTOR_KIND_MISMATCH]:"Use a selector of the correct kind: [{selectorKinds}].",[R.SELECTOR_KINDS_WITHOUT_SELECTOR_TYPE]:"Either add 'selector' to expectedTypes or remove selectorKinds.",[R.KEYWORD_COLLISION]:"Give each command a unique keyword. Move the shared keyword to alternatives on one command, or use a more specific translation."};}}),Dt={};nn(Dt,{SchemaErrorCodes:()=>R,formatValidationResults:()=>dn,getValidationStats:()=>pn,validateAllKeywordCollisions:()=>hn,validateAllSchemas:()=>mn,validateCommandSchema:()=>St,validateKeywordCollisions:()=>xt,validateRoleValues:()=>fn});function un(t,e){return {action:t,items:e}}function St(t){let e=[];for(let i of t.roles)i.expectedTypes.includes("literal")&&i.expectedTypes.includes("selector")&&(i.role==="patient"&&Ar.has(t.action)?e.push(ue(R.MULTI_TYPE_PATIENT_EXPECTED,"note",{role:i.role,command:t.action},i.role)):e.push(ue(R.AMBIGUOUS_TYPE_LITERAL_SELECTOR,"warning",{role:i.role},i.role))),i.expectedTypes.length>3&&!Ar.has(t.action)&&e.push(ue(R.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(ue(R.SELECTOR_KINDS_WITHOUT_SELECTOR_TYPE,"warning",{role:i.role},i.role)));switch(t.action){case "transition":on(t,e);break;case "on":sn(t,e);break;case "if":case "unless":ln(t,e);break;case "repeat":case "for":case "while":cn(t,e);break}return t.roles.filter(i=>i.required).length===0&&(Bt.has(t.action)?e.push(ue(R.NO_REQUIRED_ROLES_EXPECTED,"note",{command:t.action})):e.push(ue(R.NO_REQUIRED_ROLES,"warning",{}))),un(t.action,e)}function on(t,e){let r=t.roles.find(n=>n.role==="patient"),i=t.roles.find(n=>n.role==="goal");r&&!i&&e.push(ue(R.TRANSITION_MISSING_GOAL,"error",{}));}function sn(t,e){let r=t.roles.find(i=>i.role==="event");r||e.push(ue(R.EVENT_HANDLER_MISSING_EVENT,"warning",{})),r&&!r.required&&e.push(ue(R.EVENT_HANDLER_EVENT_NOT_REQUIRED,"warning",{}));}function ln(t,e){let r=t.roles.find(i=>i.role==="condition");r||e.push(ue(R.CONDITIONAL_MISSING_CONDITION,"warning",{})),r&&!r.required&&e.push(ue(R.CONDITIONAL_CONDITION_NOT_REQUIRED,"warning",{}));}function cn(t,e){t.action==="for"?t.roles.find(i=>i.role==="source")||e.push(ue(R.FOR_LOOP_MISSING_SOURCE,"warning",{})):t.action==="while"&&(t.roles.find(i=>i.role==="condition")||e.push(ue(R.WHILE_LOOP_MISSING_CONDITION,"warning",{})));}function mn(t,e={}){let r=new Map,{includeNotes:i=false}=e;for(let[n,a]of Object.entries(t)){let u=St(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 dn(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
|
-
`)}function pn(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 fn(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:R.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:R.SELECTOR_KIND_MISMATCH})));}return r}function yn(t){if(t.length!==2)return false;let[e,r]=[...t].sort();return Ft.some(([i,n])=>i===e&&n===r)}function xt(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||yn(u))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 hn(t){let e=[];for(let[,r]of Object.entries(t)){let i=xt(r);i.collisions.length>0&&e.push(i);}return e.sort((r,i)=>r.language.localeCompare(i.language))}var Ar,Bt,Ft,vn=Ct({"src/generators/schema-validator.ts"(){an(),Ar=new Set(["put","append","prepend","log","throw","make","measure","return","swap","morph","beep","copy"]),Bt=new Set(["compound","else","halt","continue","init","settle","focus","blur","return","js","measure","break","exit","beep","empty","open","close","select","clear","reset","breakpoint","live","eventsource","socket","worker","intercept"]),Ft=[["change","changes"]];}});function be(t){let e=t.roles.find(r=>r.role==="destination");return e?{destination:e.default?{fromRole:"destination",default:e.default}:{fromRole:"destination"}}:{}}function Ae(t){let e=t.roles.find(r=>r.role==="source");return e?{source:e.default?{fromRole:"source",default:e.default}:{fromRole:"source"}}:{}}function De(t,e){return Or(t,e,"source")}function Rr(t,e){return Or(t,e,"destination")}function En(t,e){return Or(t,e,"patient")}function Or(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 gn={action:"toggle",description:"Toggle a class or attribute on/off",category:"dom-class",primaryRole:"patient",ast:{args:["patient"],modifiers:{on:"destination",for:"duration"}},argSkipTokens:["on"],roles:[{role:"patient",description:"The class or attribute to toggle",required:true,expectedTypes:["selector"],selectorKinds:["class","attribute"],svoPosition:1,sovPosition:2,markerOptional:{zh:true}},{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"]}},{role:"duration",description:"How long the class stays on before reverting (`toggle .a for 2s`)",required:false,expectedTypes:["literal"],svoPosition:3,sovPosition:3,valueShape:"time",markerOverride:{en:"for",ja:"\u9593",ko:"\uB3D9\uC548"}}],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)"}},zn={action:"add",description:"Add a class or attribute to an element",category:"dom-class",primaryRole:"patient",ast:{args:["patient"],modifiers:{to:"destination"}},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"}},kn={action:"remove",description:"Remove a class or attribute from an element",category:"dom-class",primaryRole:"patient",ast:{args:["patient"],modifiers:{from:"source"}},targetRole:"source",argSkipTokens:["from"],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"}},wn={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"}},Cn={action:"set",description:"Set a property or variable to a value",category:"variable",primaryRole:"destination",ast:{args:["destination"],modifiers:{to:"patient",on:"scope"}},argSkipTokens:["to"],roles:[{role:"destination",description:"The property or variable to set",required:true,expectedTypes:["selector","reference","expression","property-path"],svoPosition:1,sovPosition:1,markerOverride:{en:"",es:"",ja:"\u3092",ko:"\uB97C",tr:"i",ar:"",sw:"",tl:"",th:"",bn:"\u0995\u09C7",qu:"ta",hi:"\u0915\u094B",zh:"\u628A"},markerOptional:{zh:true}},{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",th:"\u0E43\u0E19",bn:"\u09A4\u09C7",qu:"man",hi:"\u092E\u0947\u0902",zh:"\u5230"},markerVariants:{tr:["e","a","ye","ya"],zh:["\u4E3A","\u70BA","\u6210"]}},{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>"}},bn={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>"}},An={action:"live",description:"Reactive block: re-run the body when its dependencies change",category:"control-flow",primaryRole:"patient",hasBody:true,bareKeyword:true,roles:[]},Dn={action:"when",description:"Reactive observer: re-run the body when a watched expression changes",category:"control-flow",primaryRole:"condition",ast:{args:["condition"]},hasBody:true,structuralOnly:true,roles:[{role:"condition",description:"The watched expression (`or`-separated expressions watch each)",required:true,expectedTypes:["expression","reference","selector"],svoPosition:1}]},Sn={action:"eventsource",description:"Open a Server-Sent Events stream and handle its events",category:"async",primaryRole:"patient",hasBody:true,bareKeyword:true,roles:[]},xn={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:[]},Fn={action:"intercept",description:"Service-worker fetch interception / caching strategies",category:"async",primaryRole:"patient",hasBody:true,bareKeyword:true,roles:[]},Tn={action:"show",description:"Make an element visible",category:"dom-visibility",primaryRole:"patient",ast:{args:[["destination","patient"]],modifiers:{with:"duration"}},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}]},Rn={action:"hide",description:"Make an element invisible",category:"dom-visibility",primaryRole:"patient",ast:{args:[["destination","patient"]],modifiers:{with:"duration"}},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}]},On={action:"on",description:"Handle an event",category:"event",primaryRole:"event",ast:{args:["event"],modifiers:{from:"source"}},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}],widenTypeVariants:[{role:"event",types:["literal","expression"],idSuffix:"expr-event",excludeLanguages:["ko"]}]},Pn={action:"trigger",description:"Trigger/dispatch an event",category:"event",primaryRole:"event",ast:{args:["event"],modifiers:{on:"destination"}},argSkipTokens:["on"],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"]},markerOverride:{bn:"\u0995\u09C7",hi:"\u0915\u094B"}},{role:"destination",description:"The target element (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:2,sovPosition:1}]},Nn={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}]},Ln={action:"fetch",description:"Fetch data from a URL",category:"async",primaryRole:"source",ast:{args:["source"],modifiers:{with:["style","method"],as:"responseType",body:"patient"},isBlocking:true},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"],valueShape:"object",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",ja:"\u3068\u3057\u3066"}},{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}]},Mn={action:"increment",description:"Increment a numeric value",category:"variable",primaryRole:"patient",ast:{args:[["destination","patient"]],modifiers:{by:"quantity"}},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"}}]},_n={action:"decrement",description:"Decrement a numeric value",category:"variable",primaryRole:"patient",ast:{args:[["destination","patient"]],modifiers:{by:"quantity"}},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"}}]},In={action:"append",description:"Append content to an element",category:"dom-content",primaryRole:"patient",ast:{args:["patient"],modifiers:{to:"destination"}},omitRoleVariants:["destination"],roles:[{role:"patient",description:"The content to append",required:true,expectedTypes:["literal","selector","reference","expression"],svoPosition:1,sovPosition:2},{role:"destination",description:"The element to append to",required:true,expectedTypes:["selector","reference","expression"],svoPosition:2,sovPosition:1,markerOverride:{en:"to"}}]},jn={action:"prepend",description:"Prepend content to an element",category:"dom-content",primaryRole:"patient",ast:{args:["patient"],modifiers:{to:"destination"}},omitRoleVariants:["destination"],roles:[{role:"patient",description:"The content to prepend",required:true,expectedTypes:["literal","selector","reference","expression"],svoPosition:1,sovPosition:2},{role:"destination",description:"The element to prepend to",required:true,expectedTypes:["selector","reference","expression"],svoPosition:2,sovPosition:1,markerOverride:{en:"to"}}]},$n={action:"log",description:"Log a value to the console",category:"variable",primaryRole:"patient",ast:{args:["patient"]},roles:[{role:"patient",description:"The value to log",required:true,expectedTypes:["literal","selector","reference","expression"],svoPosition:1,sovPosition:1}]},Vn={action:"get",description:"Get a value from a source",category:"variable",primaryRole:"source",ast:{args:[["source","patient"]]},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}]},Wn={action:"take",description:"Take content from a source element",category:"dom-content",primaryRole:"patient",ast:{args:["patient"],modifiers:{from:"source",for:"recipient"}},argSkipTokens:["from"],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 all current holders)",required:false,expectedTypes:["selector","reference"],svoPosition:2,sovPosition:1},{role:"recipient",description:"The element the class moves ONTO (`take .active from .tab for me`)",required:false,expectedTypes:["reference"],svoPosition:3,sovPosition:3,valueShape:"reference",markerOverride:{en:"for"}}]},qn={action:"make",description:"Create a new element",category:"dom-content",primaryRole:"patient",ast:{args:["patient"]},roles:[{role:"patient",description:"The element type or selector to create",required:true,expectedTypes:["literal","selector"],svoPosition:1,sovPosition:1}]},Kn={action:"halt",description:"Halt/stop execution or event propagation",category:"control-flow",primaryRole:"patient",ast:{args:[],modifiers:{the:"patient"}},argSkipTokens:["the"],roles:[{role:"patient",description:"What to halt (event, default, bubbling, etc.)",required:false,expectedTypes:["literal","reference","expression"],svoPosition:1,sovPosition:1}]},Hn={action:"settle",description:"Wait for animations/transitions to settle",category:"async",primaryRole:"patient",ast:{args:[["destination","patient"]],isBlocking:true},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}]},Un={action:"throw",description:"Throw an error",category:"control-flow",primaryRole:"patient",ast:{args:["patient"]},roles:[{role:"patient",description:"The error message or object to throw",required:true,expectedTypes:["literal","expression"],svoPosition:1,sovPosition:1}]},Gn={action:"send",description:"Send an event to an element",category:"event",primaryRole:"event",ast:{args:["event"],modifiers:{to:"destination",detail:"patient"}},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"}}]},Yn={action:"if",description:"Conditional execution",category:"control-flow",primaryRole:"condition",ast:{args:["condition"]},hasBody:true,roles:[{role:"condition",description:"The condition to evaluate",required:true,expectedTypes:["expression","reference","selector"],svoPosition:1,sovPosition:1}]},Zn={action:"unless",description:"Negated conditional execution (executes when condition is false)",category:"control-flow",primaryRole:"condition",ast:{args:["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}]},Jn={action:"else",description:"Else branch of conditional",category:"control-flow",primaryRole:"patient",hasBody:true,roles:[]},Xn={action:"repeat",description:"Repeat a block of commands",category:"control-flow",primaryRole:"loopType",ast:{args:[["quantity","patient"]]},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"'},Qn={action:"for",description:"Iterate over a collection",category:"control-flow",primaryRole:"patient",ast:{args:["patient"],modifiers:{in:"source"}},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"}}]},ea={action:"while",description:"Loop while condition is true",category:"control-flow",primaryRole:"condition",ast:{args:["condition"]},hasBody:true,roles:[{role:"condition",description:"The condition to check",required:true,expectedTypes:["expression"],svoPosition:1,sovPosition:1}]},ra={action:"continue",description:"Continue to next loop iteration",category:"control-flow",primaryRole:"patient",ast:{},roles:[]},Pr={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"},ta={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:Pr,idSuffix:"url",priorityDelta:5,methodCarrier:"method"}]},ia={action:"transition",description:"Transition an element with animation",category:"dom-visibility",primaryRole:"patient",ast:{args:["patient"],modifiers:{to:"goal",over:"duration",on:"destination"}},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}]},na={action:"clone",description:"Clone an element",category:"dom-content",primaryRole:"patient",ast:{args:[["source","patient"]],modifiers:{into:"destination"}},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"}}]},aa={action:"focus",description:"Focus an element",category:"dom-content",primaryRole:"patient",ast:{args:[["destination","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}]},ua={action:"blur",description:"Remove focus from an element",category:"dom-content",primaryRole:"patient",ast:{args:[["destination","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}]},oa={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}]},sa={action:"open",description:"Open a dialog, details element, or popover",category:"dom-content",primaryRole:"patient",ast:{args:["patient"],modifiers:{as:"style"}},roles:[{role:"patient",description:"The element to open (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:1,sovPosition:2},{role:"style",description:"Open-mode variant (modal / non-modal) for <dialog>",required:false,expectedTypes:["literal","expression"],svoPosition:2,sovPosition:1,markerOverride:{en:"as",ja:"\u3068\u3057\u3066"}}]},la={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}]},ca={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}]},ma={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}]},da={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}]},pa={action:"breakpoint",description:"Drop into the debugger",category:"control-flow",primaryRole:"patient",roles:[],bareKeyword:true},fa={action:"call",description:"Call a function",category:"control-flow",primaryRole:"patient",ast:{args:["patient"]},roles:[{role:"patient",description:"The function to call",required:true,expectedTypes:["expression","reference"],markerOptional:{he:true,zh:true},svoPosition:1,sovPosition:1}]},ya={action:"return",description:"Return a value from a function",category:"control-flow",primaryRole:"patient",ast:{args:["patient"]},roles:[{role:"patient",description:"The value to return",required:false,expectedTypes:["literal","expression","reference"],svoPosition:1,sovPosition:1}]},ha={action:"js",description:"Execute raw JavaScript code",category:"control-flow",primaryRole:"patient",ast:{args:["patient"]},hasBody:true,roles:[{role:"patient",description:"The JavaScript code to execute",required:false,expectedTypes:["expression"],svoPosition:1,sovPosition:1}]},va={action:"tell",description:"Execute commands in context of another element",category:"control-flow",primaryRole:"destination",ast:{args:[["destination","patient"]]},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"}}]},Ea={action:"default",description:"Set a default value for a variable",category:"variable",primaryRole:"destination",ast:{args:["destination"],modifiers:{to:"patient"}},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"}}]},ga={action:"init",description:"Initialization block that runs once",category:"control-flow",primaryRole:"patient",ast:{},hasBody:true,roles:[]},za={action:"behavior",description:"Define a reusable behavior",category:"control-flow",primaryRole:"patient",ast:{args:["patient"]},hasBody:true,roles:[{role:"patient",description:"The behavior name (PascalCase identifier)",required:true,expectedTypes:["literal","reference","expression"],svoPosition:1,sovPosition:1}]},ka={action:"install",description:"Install a behavior on an element",category:"control-flow",primaryRole:"patient",ast:{args:["patient"],modifiers:{on:"destination"}},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}]},wa={action:"measure",description:"Measure element dimensions (x, y, width, height, etc.)",category:"dom-content",primaryRole:"patient",ast:{args:["patient"],modifiers:{of:["destination","source"]}},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"}}]},Ca={en:"using view",es:"using view",pt:"using view",fr:"using view",de:"using view",it:"using view",ja:"using view",ko:"using view",zh:"using view",ar:"using view",he:"using view",hi:"using view",bn:"using view",tr:"using view",ru:"using view",uk:"using view",pl:"using view",id:"using view",vi:"using view",th:"using view",ms:"using view",tl:"using view",sw:"using view",qu:"using view"},Nr={role:"manner",description:"Run the swap inside a `document.startViewTransition()` (`using view transition`)",required:false,expectedTypes:["literal","expression"],valueShape:"keyword",markerOverride:Ca},ba={action:"swap",description:"Swap DOM content using various strategies (innerHTML, outerHTML, delete, etc.)",category:"dom-content",primaryRole:"destination",ast:{args:["method","destination","patient"],modifiers:{viewTransition:"manner"}},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",tl:""}},{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"}},{...Nr,svoPosition:4,sovPosition:4}]},Aa={action:"morph",description:"Morph an element into another using DOM diffing",category:"dom-content",primaryRole:"patient",ast:{args:[["source","destination"]],modifiers:{on:"patient",viewTransition:"manner"}},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"}},{...Nr,svoPosition:3,sovPosition:3}]},Da={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}]},Sa={action:"break",description:"Exit from the current loop",category:"control-flow",primaryRole:"patient",roles:[]},xa={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},Fa={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}]},Ta={action:"scroll",description:"Scroll the viewport to a target element",category:"navigation",primaryRole:"destination",ast:{args:["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"}}]},Ra={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"},Oa={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:Pr}]},Pa={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:Pr}]},Na={action:"process",description:"Process hx-partial markup in HTML content",category:"dom-content",primaryRole:"patient",ast:{args:["patient"],modifiers:{viewTransition:"manner"}},roles:[{role:"patient",description:"The HTML content (string, element, or response) to process",required:true,expectedTypes:["literal","reference","expression"],svoPosition:1,sovPosition:1,markerOverride:Ra},{...Nr,svoPosition:2,sovPosition:2}]},La={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"],valueShape:"object",svoPosition:2,sovPosition:1}]},ce={toggle:gn,add:zn,remove:kn,put:wn,set:Cn,show:Tn,hide:Rn,on:On,trigger:Pn,wait:Nn,fetch:Ln,increment:Mn,decrement:_n,append:In,prepend:jn,log:$n,get:Vn,take:Wn,make:qn,halt:Kn,settle:Hn,throw:Un,send:Gn,if:Yn,unless:Zn,else:Jn,repeat:Xn,for:Qn,while:ea,continue:ra,go:ta,scroll:Ta,push:Oa,replace:Pa,process:Na,transition:ia,clone:na,focus:aa,blur:ua,empty:oa,open:sa,close:la,select:ca,clear:ma,reset:da,breakpoint:pa,call:fa,return:ya,js:ha,tell:va,default:Ea,init:ga,behavior:za,install:ka,measure:wa,swap:ba,morph:Aa,beep:Da,break:Sa,copy:xa,exit:Ba,pick:Fa,render:La,bind:bn,live:An,when:Dn,eventsource:Sn,socket:xn,worker:Bn,intercept:Fn,compound:{action:"compound",description:"A compound node representing chained statements",primaryRole:"patient",category:"control-flow",hasBody:true,roles:[]}};function ie(t){return ce[t]}function Ma(){return Object.values(ce).filter(t=>t.structuralOnly!==true&&(t.roles.length>0||t.bareKeyword===true))}typeof process<"u"&&process.env.LOKASCRIPT_SCHEMA_VALIDATION==="1"&&Promise.resolve().then(()=>(vn(),Dt)).then(({validateAllSchemas:t,formatValidationResults:e})=>{let r=t(ce);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);});var Ce=new Map,ye=new Map,Ge=new Map,Dr=null;function Tt(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]=Tt(a,n):r[i]=n);}return r}function _a(t,e){return Tt(t,e)}function Lr(t){if(!t.extends)return t;let e=ye.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=Lr(e);return _a(r,t)}function je(t,e,r){Ce.set(t,e),ye.set(t,r),Ge.delete(t);}function Rt(t){Dr=t;}var it=new Map;function Ne(t){return t.split("-")[0]}function Le(t){return t.includes("-")}function Ia(t){let e=Ce.get(t);if(!e&&Le(t)){let r=Ne(t);e=Ce.get(r);}if(!e){let r=Array.from(Ce.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 ja(t){let e=ye.get(t);if(!e&&Le(t)){let r=Ne(t);e=ye.get(r);}if(!e){let r=Array.from(ye.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 Lr(e)}function N(t){let e=ye.get(t);return !e&&Le(t)&&(e=ye.get(Ne(t))),e?Lr(e):void 0}function $a(){return Array.from(Ce.keys())}function Ot(t){if(Ce.has(t)&&ye.has(t))return true;if(Le(t)){let e=Ne(t);return Ce.has(e)&&ye.has(e)}return false}function Va(t,e){return Ia(e).tokenize(t)}function fe(t){let e=Ge.get(t);if(!e&&Le(t)&&(e=Ge.get(Ne(t))),e)return e;let r=it.get(t);if(!r&&Le(t)&&(r=it.get(Ne(t))),r)return Ge.set(t,r),r;if(!Dr)throw new Error(`No patterns registered for language '${t}'. Either import the language module or set a pattern generator.`);let i=ja(t),n=Dr(i);return Ge.set(t,n),n}var Pt={possessive:{specialForms:{me:"my",it:"its",you:"your"}}};function ge(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 K(t,e){let r={type:"literal",value:t};return e!==void 0?{type:"literal",value:t,dataType:e}:r}function Re(t){return gr(t)}function le(t){return {type:"reference",value:t}}function fu(t,e){return e?{...t,position:e}:t}function ke(t,e,r){return r?{type:"property-path",object:t,property:e,access:r}:{type:"property-path",object:t,property:e}}function te(t,e,r){let i={kind:"command",action:t,roles:new Map(Object.entries(e))};return r!==void 0?{...i,metadata:r}:i}function Ue(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 yu(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 hu(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 Sr(t,e,r,i,n){let a={kind:"feature",action:t,roles:n??new Map,body:e};return r!==void 0&&(a.name=r),i!==void 0&&(a.metadata=i),a}function Ye(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 vu(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 or(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 Eu(t,e){let r=t.markerOverride?.[e.code],i=e.roleMarkers[t.role];if(r!==void 0){let n=gu(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 gu(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 he(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}var Nt=new Set(["destination","source","patient","object","event","eventmarker","manner","instrument"]);function de(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 zr(t){return Pt.possessive?.specialForms?.[t]??`${t}'s`}var Mr={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"}},zu={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"}},Lt={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","n\u0131n","nun","n\xFCn","in","\u0131n","un","\xFCn"])};function xr(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?Lt[t.code]:void 0;return !!n&&n.has(r)}var wu={destination:"in",source:"from"},Cu={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"])},bu=new Set(["in","into","at","within","inside"]);function Au(t,e){let r=e.value.toLowerCase();if((t?.code?Cu[t.code]:void 0)?.has(r))return "in";let n=e.normalized??e.value,a=n.toLowerCase();return bu.has(a)?"in":wu[a]??n}var kr=new Set(["first","last","next","previous","random","closest"]),Du={bn:{\u09B6\u09C7\u09B7:"last"}},_r=new Set(Object.keys(ce).map(t=>t.toLowerCase()));function Mt(t,e,r,i){let n=t[e];if(!n)return null;let a=(n.normalized??n.value).toLowerCase(),u=t[e+1],o=r?.code&&u?.kind==="selector"&&u.value.startsWith("<")?Du[r.code]?.[n.value.toLowerCase()]:void 0;if(!kr.has(a)&&!kr.has(n.value.toLowerCase())&&o===void 0)return null;let s=[{text:o??n.normalized??n.value,token:n}],l=e+1,c=t[l];if(!c||c.kind!=="selector")return null;s.push({text:c.value,token:c}),l++;let m=0;for(;m++<8;){let f=t[l];if(f&&f.kind==="selector"&&f.value.startsWith("."))s.push({text:f.value,token:f}),l++;else break}let d=t[l],p=t[l+1];return d&&p&&p.kind==="selector"&&(d.kind==="keyword"||d.kind==="particle"||d.kind==="identifier")&&!kr.has((d.normalized??d.value).toLowerCase())&&!_r.has((d.normalized??d.value).toLowerCase())&&!(i?.(d)===true&&i(t[l+2])!==true)&&(s.push({text:Au(r,d),token:d}),s.push({text:p.value,token:p}),l+=2),{parts:s,consumed:l-e}}function Su(t,e){let r=zu[t];return r?r[e.toLowerCase()]??e:e}function pe(t,e){let r=Mr[t];return r?r[e.toLowerCase()]??e:e}function xu(t,e){return Mr[t]?.[e.toLowerCase()]!==void 0}function Bu(t,e){let r=[e.value,e.normalized].filter(Boolean);for(let i of r){let n=de(t,i)??de(t,i.toLowerCase());if(n)return n}}function _t(t){return t.kind==="literal"||t.kind==="operator"||t.kind==="punctuation"?false:!/^[$:@#.*^(){}[\]]/.test(t.value)}function Fu(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 at(t,e){return _t(t)?pe(e,t.value)!==t.value?true:t.kind==="identifier":false}var Tu={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"}}},Ru=new Set(["empty","null","undefined","true","false"]),It=new Set(["Number","Int","Float","String","Date","Array","Object","JSON","json","FormData","HTML","Fragment","Values"]);function Ou(t,e,r,i){let n=Tu[t],a=n?.[e.value]??n?.[e.value.toLowerCase()];if(a){if(a.beforeTypeName&&i?.kind==="identifier"&&It.has(i.value))return a.beforeTypeName;if(a.beforePredicate&&i&&(i.kind==="literal"||i.kind==="keyword"&&Ru.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 Pe(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?Bu(e,s):void 0,c=t[o+1];if(s.value==="'"&&n!==void 0&&c?.value==="s"&&s.position?.end!==void 0&&c.position?.start===s.position.end){i+="'s",n=c;let v=t[o+2];v&&pe(r,v.value)!==v.value?(a(pe(r,v.value),v),o+=2):o+=1;continue}if(l!==void 0&&c){let v=e?.possessive?.connectors,E=!!v?.length&&v.some(k=>{let A=k.toLowerCase();return A===c.value.toLowerCase()||A===(c.normalized??"").toLowerCase()}),y=E?o+2:o+1,h=t[y];if(h&&at(h,r)){a(zr(l),s),a(pe(r,h.value),h),o=y;continue}if(E&&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(zr(l),s),a(pe(r,h.value.slice(1)),h),o=y;continue}if(!E&&/^\.[a-zA-Z_]\w*$/.test(c.value)&&s.position?.end!==void 0&&c.position?.start!==void 0&&s.position.end===c.position.start&&!Fu(e,s)){a(zr(l),s),a(pe(r,c.value.slice(1)),c),o+=1;continue}}let m=t[o+2];if(c&&m&&m.kind==="selector"&&xr(e,c)&&_t(s)){a(pe(r,s.value),s),a("of",c),a(m.value,m),o+=2;continue}if(s.kind==="selector"&&c&&m&&xr(e,c)&&at(m,r)&&pe(r,m.value)!==m.value){a(pe(r,m.value),m),a("of",c),a(s.value,s),o+=2;continue}let d=Mt(t,o,e);if(d){for(let v of d.parts)a(v.text,v.token);o+=d.consumed-1;continue}let p=Ou(r,s,t[o-1],c);if(p!==void 0){a(p,s);continue}let f=Su(r,s.value);if(f!==s.value){a(f,s);continue}a(u(s),s);}return i.trim()}var jt=[{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 ut(t,e,r,i){let n=jt.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 Pu(t,e){let r=jt.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 $t={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 Nu(t){return $t[t]}function ot(t,e){return $t[e]?.has(t.toLowerCase())??false}var Vt=96,Lu=/^[A-Za-z_][\w-]*$/,Mu=/^[A-Za-z_][\w-]*:[^\s'"`/:][^\s]*$/;function Wt(t,e){let r=t.peek(e);return !!r&&r.kind==="identifier"&&Mu.test(r.value)}function qt(t,e){let r=t.peek(e);if(!r||r.kind!=="identifier"&&r.kind!=="keyword"||!Lu.test(r.value))return false;let i=t.peek(e+1),n=t.peek(e+2);return !!i&&i.value===":"&&!!n}function st(t,e=0){return Wt(t,e)||qt(t,e)}function _u(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++<Vt;){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 lt(t){let e=t.peek();return e?e.value==="{"||e.value==="("?_u(t):e.value===","||e.value===":"?null:(t.advance(),e.value):null}function Ze(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=lt(t);if(u===null)return t.reset(r),null;i.push(`${e}:${u}`);}else if(!st(t))return null;let n=0;for(;n++<Vt;){let a=t.peek();if(!a)break;if(a.value===","){if(i.length===0||!st(t,1))break;t.advance();continue}if(Wt(t,0)){i.push(t.advance().value);continue}if(!qt(t,0))break;let u=t.advance().value;t.advance();let o=lt(t);if(o===null)return t.reset(r),null;i.push(`${u}:${o}`);}return i.length===0?(t.reset(r),null):`{${i.join(", ")}}`}var sr=.8,Iu=.6,ju=.15,$u=.5,ct=.15,mt=.1,dt=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"]),Vu={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"]},Wu=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($u,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=l=>e.extraction?.[l]?.default!==void 0,u=e.command==="on"?e.extraction?.action?.value:void 0,o=ce[u??e.command]?.roles,s=l=>o?.find(c=>c.role===l)?.valueShape!==void 0;for(let l of e.template.tokens)if(l.type==="role")r.has(l.role)?(n+=1,i+=1):s(l.role)||(n+=1);else if(l.type==="group")for(let c of l.tokens)c.type==="role"&&(r.has(c.role)?(n+=sr,i+=sr):s(c.role)||(n+=sr,a(c.role)&&(i+=sr*Iu)));return n>0?i/n:1}scoreStemPenalty(t){let{stemMatchCount:e,totalKeywordMatches:r}=t;return e<=0||r<=0?0:-(e/r)*ju}scoreLanguageBoost(t){let{pattern:e}=t;if(e.language!=="ar")return 0;let r=e.template.tokens[0];return !r||r.type!=="literal"?0:dt.has(r.value)||r.alternatives?.some(i=>dt.has(i))?ct: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=Vu[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(-mt,Math.min(mt,i))}},qu=new Wu,Ku=new Set(Object.values(ce).filter(t=>t.bareKeyword===true).map(t=>t.action));function Hu(t){return t.startsWith("*")||t.startsWith("@")}var Q=class _{constructor(e){this.matchCache=new Map,this.roleStarts=new Map,this.stemMatchCount=0,this.totalKeywordMatches=0,this.confidenceModel=e??qu;}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.roleStarts=new Map,!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,roleStarts:this.roleStarts}}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];if(o>0&&l.type==="literal"&&this.tryConsumeEventSourceClause(e,i,l),this.shouldTrySkippingVerbSlot(l,e,r[s+1]??n)){let m=e.mark(),d=new Map(i);if(this.matchTokenSequence(e,r.slice(s+1),d,n)&&this.atClauseEnd(e)){i.clear();for(let[p,f]of d)i.set(p,f);return true}e.reset(m);}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":{let a=e.position(),u=this.matchRoleToken(e,r,i,n);return u&&i.has(r.role)&&this.roleStarts.set(r.role,a),u}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 K(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){let a=e.position(),u=i.get(r.role);return this.matchRoleTokenCore(e,r,i,n)?(this.absorbTrailingConversion(e,r,i,n,a),this.absorbTrailingConditionOperand(e,r,i,n,a),this.stampCaptureSpan(e,r.role,i,a,u),true):false}stampCaptureSpan(e,r,i,n,a){let u=i.get(r);if(!u||u===a||u.position||e.position()<=n)return;let o=e.tokens[n],s=e.tokens[e.position()-1];!o||!s||i.set(r,fu(u,{start:o.position.start,end:s.position.end}));}absorbTrailingConditionOperand(e,r,i,n,a){if(r.role!=="condition"||!i.has("condition")||e.position()<=a||n!==void 0||this.currentPatternCommand!=="on")return;let u=e.peek();if(!u)return;let o=_.CONDITION_OPERATOR_WORDS;if(!o.has((u.normalized??"").toLowerCase())&&!o.has(u.value.toLowerCase())||this.patternTokenWouldMatch(n,u))return;e.advance();let s=e.peek();s&&(s.kind==="selector"||s.kind==="identifier"||s.kind==="literal")&&!_r.has((s.normalized??s.value).toLowerCase())&&e.advance();let l=Pe(e.tokens.slice(a,e.position()),this.currentProfile);i.set("condition",{type:"expression",raw:l,value:l});}conversionRunLength(e){let r=e.peek();if(!r||(r.normalized??r.value).toLowerCase()!=="as"&&r.value.toLowerCase()!=="as")return 0;let n=e.peek(1);return !n||!It.has(n.value)?0:2}absorbTrailingConversion(e,r,i,n,a){if(r.role==="event"||r.role==="action"||!i.has(r.role)||e.position()<=a||this.conversionRunLength(e)!==2||this.patternTokenWouldMatch(n,e.peek()))return;e.advance(),e.advance();let u=Pe(e.tokens.slice(a,e.position()),this.currentProfile);i.set(r.role,{type:"expression",raw:u,value:u});}matchRoleTokenCore(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 y=this.tryFoldHyphenActionKeyword(e);if(y)return i.set(r.role,y),true}if(r.role==="event"&&this.currentPatternCommand==="on"){if(!_.tokenLooksLikeEvent(a))return r.optional||false;let y=(a.normalized??a.value).toLowerCase();if(_.POSITIONAL_OR_SCOPE_KEYWORDS.has(y)||this.currentProfile&&(de(this.currentProfile,a.value)??de(this.currentProfile,y))!==void 0||a.value.includes("?."))return r.optional||false}if(r.role==="event"){let y=(a.normalized??a.value).toLowerCase();if(_.STRUCTURAL_NEVER_EVENT.has(y))return r.optional||false}if(a.kind==="keyword"){let y=(a.normalized??a.value).toLowerCase();if(y==="then"||y==="end"&&e.peek(1)?.kind!=="selector"||ot(a.value,this.currentProfile?.code??"")||(r.role==="quantity"||r.role==="event"&&this.currentPatternCommand==="repeat")&&(a.normalized??a.value).toLowerCase()in ce)return r.optional||false}if(r.role==="duration"){let y=(a.normalized??a.value).toLowerCase();if(_.POSITIONAL_OR_SCOPE_KEYWORDS.has(y))return r.optional||false}if(r.optional&&r.role!=="event"&&r.role!=="action"&&r.valueShape!=="keyword"&&a.kind==="keyword"&&(a.normalized??a.value).toLowerCase()in ce&&(n===void 0||this.patternTokenWouldMatch(n,a)))return true;let u=this.tryMatchPositionalExpression(e,n);if(u)return r.expectedTypes&&r.expectedTypes.length>0&&!or(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&&!or(o.type,r.expectedTypes)?r.optional||false:(i.set(r.role,o),true);if(r.role!=="event"&&(!r.expectedTypes||r.expectedTypes.includes("expression"))){let y=this.tryMatchBeepPrefixExpression(e);if(y)return i.set(r.role,y),true;let h=this.tryMatchHyphenatedWord(e);if(h)return i.set(r.role,h),true;let k=this.tryMatchOperatorRunExpression(e);if(k)return i.set(r.role,k),true}if(this.currentPatternCommand==="pick"&&r.role==="patient"&&(!r.expectedTypes||r.expectedTypes.includes("expression"))){let y=this.tryMatchPickRangeExpression(e);if(y)return i.set(r.role,y),true}if(r.expectedTypes?.includes("property-path")){let y=this.tryMatchOfPossessiveExpression(e);if(y)return i.set(r.role,y),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"||_.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&&!or(d.type,r.expectedTypes)?r.optional||false:(i.set(r.role,d),true);let p=r.role!=="condition",f=this.tryMatchPropertyAccessExpression(e,p);if(f)return r.expectedTypes&&r.expectedTypes.length>0&&!r.expectedTypes.includes(f.type)&&!r.expectedTypes.includes("expression")?r.optional||false:(i.set(r.role,f),true);let v=this.tryMatchSelectorPropertyExpression(e);if(v)return r.expectedTypes&&r.expectedTypes.length>0&&!or(v.type,r.expectedTypes)?r.optional||false:(i.set(r.role,v),true);if(a.kind==="identifier"&&a.value==="{"){let y=r.expectedTypes,k=y?.length===1&&y[0]==="expression"?this.tryMatchBraceRunExpression(e):!y?.length||y.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 y=Ze(e);if(y)return i.set(r.role,{type:"expression",raw:y}),true}let E=this.tokenToSemanticValue(a);if(!E)return r.optional||false;if(r.expectedTypes&&r.expectedTypes.length>0&&!r.expectedTypes.includes(E.type)){let y=E.type==="selector"&&String(E.value).startsWith("@"),h=r.expectedTypes.some(k=>k==="expression"||k==="reference");if(!(y&&h))return r.optional||false}if(r.valueShape==="keyword"&&E.type==="expression"?i.set(r.role,K(String(E.raw??""))):i.set(r.role,E),e.advance(),r.role==="event"){let y=e.peek();y&&y.kind==="selector"&&y.value.startsWith("[")&&"value"in E&&(i.set(r.role,K(`${String(E.value)}${y.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 A=this.tokenToSemanticValue(e.advance());A&&!i.has("source")&&i.set("source",A);}}}return true}shouldTrySkippingVerbSlot(e,r,i){let n=e.type==="group"&&e.optional?e.tokens.every(o=>o.type==="role")?e.tokens[0]:void 0:e;if(!n||n.type!=="role"||!n.optional||n.role==="event"||n.role==="action"||n.valueShape==="keyword")return false;let a=r.peek();if(!a||a.kind!=="keyword"||i===void 0)return false;let u=this.patternTokenWouldMatch(i,a);return (a.normalized??a.value).toLowerCase()in ce?!u:u}atClauseEnd(e){let r=e.peek();if(!r||r.kind==="conjunction")return true;if(r.kind!=="keyword")return false;let i=(r.normalized??r.value).toLowerCase();return i==="then"||i==="end"?true:ot(r.value,this.currentProfile?.code??"")}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,r){let i=Mt(e.tokens,e.position(),this.currentProfile,n=>n===void 0?false:this.patternTokenWouldMatch(r,n));if(!i)return null;for(let n=0;n<i.consumed;n++)e.advance();return {type:"expression",raw:i.parts.map(n=>n.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 xr(this.currentProfile,e)}static isBareWordToken(e){return !!e&&/^[A-Za-z_][A-Za-z0-9_]*$/.test(e.value)}static tokensAdjacent(e,r){return e?.position?.end!==void 0&&r?.position?.start!==void 0&&e.position.end===r.position.start}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||!_.RUN_OPERATORS.has(s.value))break;let l=e.mark();if(e.advance(),!this.tryConsumeRunOperand(e)){e.reset(l);break}}let o=Pe(e.tokens.slice(u,e.position()),this.currentProfile);return {type:"expression",raw:o,value:o}}tryMatchHyphenatedWord(e){let r=e.peek();if(!_.isBareWordToken(r))return null;let i=1,n=[r.value];for(;;){let a=e.peek(i),u=e.peek(i+1);if(!a||a.value!=="-"||!_.isBareWordToken(u)||!_.tokensAdjacent(e.peek(i-1),a)||!_.tokensAdjacent(a,u))break;n.push(u.value),i+=2;}if(n.length<2)return null;for(let a=0;a<i;a++)e.advance();return K(n.join("-"),"string")}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||!_.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=Pe(e.tokens.slice(i,e.position()),this.currentProfile);return {type:"expression",raw:a,value:a}}static rangeSeparatorFor(e){let[r]=_.PICK_RANGE_SEPARATORS_BY_LANG[e]??[];return r}isPickRangeSeparator(e){let r=(e.normalized??e.value).toLowerCase();if(_.PICK_RANGE_SEPARATORS.has(r))return true;let i=this.currentProfile?.code;return i?_.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&&_.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")&&!_.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(de(this.currentProfile,r)??de(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"||Hu(a.value)?(e.reset(i),null):(e.advance(),ke(ge(a.value),this.toEnglishProperty(r.value),"possessive"))}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=de(this.currentProfile,s)??de(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||Pu(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&&_.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++<_.MAX_METHOD_ARGS+2;){let f=e.peek();if(!f)break;m+=f.value,e.advance();for(let v of f.value)v==="("?d++:v===")"&&d--;if(d<=0)break}l+=m;}return ke(le(n),l,"possessive")}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=de(this.currentProfile,c)??de(this.currentProfile,c.toLowerCase()),l)break;return l?(e.advance(),ke(le(l),o,"possessive")):(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 Nt.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&&Ku.has(i)||i==="me"||i==="it"||i==="you")}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++<_.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("}"),K(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++<_.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++<_.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<_.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"||_.PROPERTY_ACCESS_BASES.has(a))&&u&&u.kind==="selector"&&/^\.[a-zA-Z_]/.test(u.value)){let p=i.value,f=[],v=0;for(;v<_.MAX_PROPERTY_DEPTH;){let h=e.peek();if(h&&h.kind==="selector"&&/^\.[a-zA-Z_]/.test(h.value))p+=`.${h.value.slice(1)}`,f.push(h.value.slice(1)),e.advance(),v++;else break}let E=e.peek(),y=!!E&&E.value.startsWith("(");if(r&&!y&&f.length>0&&Re(a))return ke(le(a),f.join("."),"dot");if(y){let h=e.mark(),k=[],A=0,D=false;for(;!e.isAtEnd();){let b=e.peek();if(!b)break;if(b.value==="(")A++;else if(b.value===")"){if(k.push(b.value),e.advance(),A--,A===0&&(D=true),D)break;continue}k.push(b.value),e.advance();}D?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<_.MAX_PROPERTY_DEPTH;){let p=e.peek();if(!p||p.kind!=="operator"||p.value!==".")break;e.advance();let f=e.peek();if(!f||f.kind!=="identifier")break;e.advance(),l+=`.${f.value}`,c++;}let m=e.peek();if(m&&m.kind==="punctuation"&&m.value==="("){e.advance();let p=[],f=0;for(;!e.isAtEnd()&&p.length<_.MAX_METHOD_ARGS;){let E=e.peek();if(!E)break;if(E.kind==="punctuation"&&E.value===")"){if(f===0){e.advance();break}f--;}if(E.kind==="punctuation"&&E.value==="("&&f++,E.kind==="punctuation"&&E.value===","){e.advance();continue}p.push(E.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 ke(le(d),p,"dot")}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 f=ce[this.currentPatternCommand];return !!f&&f.roles.some(v=>v.role==="source")})(),l=!!n&&!!a&&a!=="'s"&&n.value===a&&(n.kind==="particle"||n.kind==="punctuation"||n.kind==="identifier")&&!s;if(!u&&!l&&!o)return e.reset(i),null;e.advance(),o&&e.advance();let c=e.peek();if(!c)return e.reset(i),null;let m=c.kind==="selector"&&c.value.startsWith("*"),d=c.kind==="keyword"&&!!this.currentProfile&&xu(this.currentProfile.code,c.value);return c.kind==="identifier"||m||d||(u||o)&&(c.kind==="selector"||c.kind==="keyword")?(e.advance(),ke(ge(r.value),this.toEnglishProperty(c.value),"possessive")):(e.reset(i),null)}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 ke(ge(r.value),u,"dot")}matchGroupToken(e,r,i,n){let a=e.mark(),u=new Map(i),o=this.matchTokenSequence(e,r.tokens,i,n);if(o){let s=[];for(let l of r.tokens)if(l.type==="group"&&l.renderRequired)for(let c of l.tokens)c.type==="literal"&&s.push(c.value,...c.alternatives??[]);s.length>0&&[...i.keys()].some(c=>!u.has(c))&&(e.tokens.slice(a.position,e.position()).some(d=>s.some(p=>this.getMatchType(d,p)!=="none"))||(o=false));}if(!o){e.reset(a);for(let s of i.keys())u.has(s)||i.delete(s);for(let[s,l]of u)i.get(s)!==l&&i.set(s,l);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=ar(e.value).toLowerCase();if(i&&i===ar(r).toLowerCase())return "case-insensitive"}return "none"}tokenToSemanticValue(e){switch(e.kind){case "selector":return ge(e.value);case "literal":return this.parseLiteralValue(e.value);case "keyword":let r=(e.normalized||e.value).toLowerCase();return Re(r)?le(r):K(e.normalized||e.value);case "identifier":if(e.value.startsWith("@"))return ge(e.value);if(e.value.startsWith(":")||e.value.startsWith("$"))return le(e.value);let i=e.value.toLowerCase();return Re(i)?le(i):{type:"expression",raw:e.value};case "url":return K(e.value,"string");default:return null}}parseLiteralValue(e){if(e.startsWith('"')||e.startsWith("'")||e.startsWith("`")||e.startsWith("\u300C")){let n=e.slice(1,-1);return K(n,"string")}if(e==="true")return K(true,"boolean");if(e==="false")return K(false,"boolean");let r=e.match(/^(\d+(?:\.\d+)?)(ms|s|m|h)?$/);if(r){let n=parseFloat(r[1]);return r[2]?K(e,"duration"):K(n,"number")}let i=parseFloat(e);return isNaN(i)?K(e,"string"):K(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,implicit:true});}}isOptional(e){return e.type!=="literal"&&e.optional===true}skipNoiseWords(e){let r=e.peek();if(!r)return;let i=r.value.toLowerCase();if(_.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&&_.POSITIONAL_OR_SCOPE_KEYWORDS.has(o))return;let s=e.peek(1),l=s?(s.normalized??s.value).toLowerCase():"",c=this.currentProfile?.wordOrder!=="SOV"&&_.COMMAND_ACTION_KEYWORDS.has(l),m=!s||s.kind==="particle"||_.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}};Q.CONDITION_OPERATOR_WORDS=new Set(["matches","match","contains","exists","has","have","equals","includes"]);Q.POSITIONAL_OR_SCOPE_KEYWORDS=new Set(["first","last","next","previous","random","closest","parent"]);Q.STRUCTURAL_NEVER_EVENT=new Set(["if","unless","else","end","then","while"]);Q.PROPERTY_ACCESS_BASES=new Set(["it","me","you","my","its","your","event","result","target","detail","body","window","document","self","this"]);Q.COMMAND_ACTION_KEYWORDS=_r;Q.CLAUSE_BOUNDARY_KEYWORDS=new Set(["then","and","or","end","else"]);Q.RUN_OPERATORS=new Set(["+","-","*","/"]);Q.PICK_RANGE_SEPARATORS=new Set(["to"]);Q.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"])};Q.PICK_RANGE_MODES=new Set(["inclusive","exclusive"]);Q.MAX_BRACE_RUN_TOKENS=64;Q.MAX_PROPERTY_DEPTH=10;Q.MAX_METHOD_ARGS=20;Q.DECLARATION_COMMANDS=new Set(["behavior","def","install"]);Q.ENGLISH_NOISE_WORDS=new Set(["the","a","an"]);var Kt=Q,se=new Kt;function Z(t,e){return Va(t,e)}function Ht(){return $a()}var Ut={ar:new Set(["\u0623\u0648"]),bn:new Set(["\u0985\u09A5\u09AC\u09BE"]),de:new Set(["oder"]),en:new Set(["or"]),es:new Set(["o"]),fr:new Set(["ou"]),he:new Set(["\u05D0\u05D5"]),hi:new Set(["\u092F\u093E"]),id:new Set(["atau"]),it:new Set(["o"]),ja:new Set(["\u307E\u305F\u306F"]),ko:new Set(["\uB610\uB294"]),ms:new Set(["atau"]),pl:new Set(["lub"]),pt:new Set(["ou"]),qu:new Set(["utaq"]),ru:new Set(["\u0438\u043B\u0438"]),sw:new Set(["au"]),th:new Set(["\u0E2B\u0E23\u0E37\u0E2D"]),tl:new Set(["o"]),tr:new Set(["veya"]),uk:new Set(["\u0430\u0431\u043E"]),vi:new Set(["ho\u1EB7c"]),zh:new Set(["\u6216"])},Uu=new Set(Object.values(Ut).flatMap(t=>[...t]));function Br(t,e){let r=(t.normalized??t.value).toLowerCase();if(r==="or")return true;let i=e===void 0?Uu:Ut[e];return i?i.has(t.value)||i.has(r):false}var $e=["if","unless","repeat","for","while"],cr=/^[A-Z][A-Za-z0-9_]*$/;function H(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 V(t,e){return e.has(t.value.toLowerCase())?true:t.normalized?e.has(t.normalized.toLowerCase()):false}var Gu=new Set($e);function Qe(t,e){let r=t.normalized?.toLowerCase();return r?Gu.has(r):e.some(i=>V(t,i))}var pt=new Set(["me","it","you","the","body","window","document","its","event","result","target","self","this","them","parent","next","previous","closest","first","last"]),Yu=new Set(["destination","source","style","patient","on","from","to"]);function Je(t){if(!t||t.kind==="selector")return false;let e=(t.normalized??t.value).toLowerCase(),r=t.value.toLowerCase();return !(pt.has(e)||pt.has(r)||Yu.has(e))}var ft=new Set(["ja","ko"]);function Me(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 Gt(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 mr(t,e,r){let i=e+1;if(i>=t.length)return -1;let n=Me(N(r)?.roleMarkers?.patient);return n.size>0&&V(t[i],n)&&i++,i<t.length?i:-1}var Yt=/^[a-zA-Z_$][\w$]*(?:\.[a-zA-Z_$][\w$]*)*$/;function Zu(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 Ju(t,e,r){let i=N(r);if(i?.wordOrder!=="SOV"||!Yt.test(t[0].value)||e!==Zu(t))return false;let n=Me(i.roleMarkers?.patient);return n.size===0?false:V(t[e-1],n)}function Xu(t,e,r){if(!N(e))return null;let i=H(e,"behavior"),n=H(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=Z(t,e).tokens;if(s.length<2)return null;if(V(s[0],i))return yt(t,e,s,r,0);let l=s.findIndex((m,d)=>d>0&&V(m,i));if(l>0&&cr.test(s[0].value))return yt(t,e,s,r,l);if(V(s[0],n))return ht(t,e,s,r,0);let c=s.findIndex((m,d)=>d>0&&V(m,n));return c>0&&Ju(s,c,e)?ht(t,e,s,r,c):null}function Qu(t,e,r){let i=N(e);if(!i)return null;let n=i.wordOrder!=="SOV",a=ft.has(e)?Me(i.roleMarkers?.event):new Set,u=ft.has(e)?Me(i.keywords?.on):new Set,o=a.size>0&&u.size>0,s=H(e,"end"),l=H(e,"on"),c=t.toLowerCase(),m=[...s].some(b=>c.includes(b)),d=(n||o)&&(()=>{let b=0;for(let g of l)if(g){for(let C=c.indexOf(g);C>=0;C=c.indexOf(g,C+g.length))if(++b>=2)return true}return false})();if(!m&&!d)return null;let p=Z(t,e).tokens;if(p.length<2)return null;let f=$e.map(b=>H(e,b)),v=b=>Qe(b,f),E=b=>V(b,s),y=[],h=0,k=0;for(let b=0;b<p.length;b++){let g=p[b];if(E(g)){if(h>0){h--;continue}let C=t.slice(p[k].position.start,g.position.start).trim();C&&y.push(C),k=b+1;}else if(v(g))h++;else if(n&&h===0&&b>k&&V(g,l)&&Je(p[b+1])){let C=t.slice(p[k].position.start,g.position.start).trim();C&&y.push(C),k=b;}else if(o&&h===0&&b-1>k&&V(g,a)&&p[b+1]!==void 0&&V(p[b+1],u)){let C=p[b-1],B=t.slice(p[k].position.start,C.position.start).trim();B&&y.push(B),k=b-1;}}if(k<p.length){let b=t.slice(p[k].position.start).trim();b&&y.push(b);}if(y.length<2)return null;let A=[],D=[];for(let b of y){let g;try{g=r.statement(b,e);}catch{return null}if(!g||g.kind!=="event-handler")return null;let C=g;if(A.push(C),!C.body||C.body.length===0)return null;D.push(C.metadata?.confidence??.75);}return Ye(A,"then",{sourceLanguage:e,confidence:_e(D),sourceText:t})}function _e(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 yt(t,e,r,i,n){let a=n>0,u=a?0:mr(r,n,e);if(u<0)return null;let o=r[u],s=o.value;if(!cr.test(s))return null;let{parameters:l,headerEnd:c}=Gt(t,o),m=a?n+1:r.findIndex(C=>C.position.start>=c);m<=u&&(m=u+1);let d=H(e,"init"),p=H(e,"end"),f=$e.map(C=>H(e,C)),v=C=>Qe(C,f),E=C=>V(C,p),y=[],h=[],k=[],A=false,D=0,b=m;for(let C=m;C<r.length;C++){let B=r[C];if(E(B)){if(D>0){D--;continue}if(C===b){A=true;break}if(V(r[b],d)){let z=t.slice(r[b].position.end,B.position.start).trim();if(z)try{let w=dr(i.body(z,e));h.push(...w),k.push(_e(w.map(S=>S.metadata?.confidence??.75)));}catch{k.push(0);}}else {let z=t.slice(r[b].position.start,B.position.start).trim();try{let w=i.statement(z,e);if(w&&w.kind==="event-handler"){let S=w;y.push(S);let O=!S.body||S.body.length===0;k.push(O?.2:S.metadata?.confidence??.75);}else k.push(0);}catch{k.push(0);}}b=C+1;}else v(B)&&D++;}if(y.length===0&&h.length===0)return null;let g=(A?1:.8)*_e(k);return yu(s,l,y,h.length>0?h:void 0,{sourceLanguage:e,confidence:g,sourceText:t})}function ht(t,e,r,i,n){let a=n>0,u=a?0:mr(r,n,e);if(u<0)return null;let o=r[u],s=o.value;if(!Yt.test(s))return null;let{parameters:l,headerEnd:c}=Gt(t,o),m=a?n+1:r.findIndex(g=>g.position.start>=c);m<=u&&(m=u+1);let d=H(e,"end"),p=$e.map(g=>H(e,g)),f=g=>Qe(g,p),v=g=>V(g,d),E=0,y=-1;for(let g=m;g<r.length;g++)if(v(r[g])){if(E===0){y=g;break}E--;}else f(r[g])&&E++;let h=r[m]?.position.start??c,k=y>=0?r[y].position.start:t.length,A=t.slice(h,k).trim();if(!A)return null;let D;try{D=dr(i.body(A,e));}catch{return null}if(D.length===0)return null;let b=_e(D.map(g=>g.metadata?.confidence??.75));return y<0&&(b*=.8),hu(s,l,D,{sourceLanguage:e,confidence:b,sourceText:t})}var Fr=["live","eventsource","socket","worker","intercept"],eo=new Set(["intercept"]),Ir=new Set(["eventsource","socket","worker"]),ro=new Set(["eventsource","socket"]),to=new Set(["worker"]),io=6,no=2;function ao(t,e){for(let i of Fr)if(V(t[0],H(e,i)))return {action:i,keywordIdx:0};if(N(e)?.wordOrder!=="SOV")return null;let r=Math.min(t.length,io);for(let i=1;i<r;i++)for(let n of Fr)if(n!=="live"&&V(t[i],H(e,n))&&!(Ir.has(n)&&!cr.test(t[0].value))&&!(n==="intercept"&&i>no))return {action:n,keywordIdx:i};return null}function uo(t,e,r){let i=Me(N(r)?.roleMarkers?.source);return i.size===0||e+1>=t.length?0:V(t[e],i)||V(t[e+1],i)?2:0}function Zt(t){let e=H(t,"on");e.add("when");let r=N(t)?.eventHandler;if(r?.keyword){e.add(r.keyword.primary.toLowerCase());for(let i of r.keyword.alternatives??[])e.add(i.toLowerCase());}for(let i of r?.temporalMarkers??[])e.add(i.toLowerCase());return e}function oo(t,e,r){let i=N(r)?.eventHandler,n=[i?.eventMarker?.primary,...i?.eventMarker?.alternatives??[],...i?.temporalMarkers??[]].filter(u=>!!u&&/\s/.test(u)),a=1;for(let u of n){let o=u.toLowerCase().split(/\s+/),s=e-o.length+1;s<0||o.every((l,c)=>t[s+c]?.value.toLowerCase()===l)&&(a=Math.max(a,o.length));}return a}function so(t,e,r,i,n){if(t==="live")return r+1;if(r>0){let l=r+1;return t==="eventsource"&&(l+=uo(e,l,i)),l}let a=mr(e,r,i);if(a<0)return -1;if(t==="worker")return a+1;let u=Zt(i),o=Me(N(i)?.roleMarkers?.event),s=n>=0?n:e.length;for(let l=a+1;l<s;l++){if(!V(e[l],u))continue;if(Je(e[l+1]))return l;if(l>a+2&&o.size>0&&V(e[l-1],o)&&Je(e[l-2]))return l-2;let c=oo(e,l,i);if(c>1&&l-c>a&&Je(e[l-c]))return l-c;if(l>a+1&&Je(e[l-1]))return l-1}return s}function lo(t,e,r,i){if(!Ir.has(t))return;let n=r>0?0:mr(e,r,i);if(!(n<0))return e[n].value}function co(t,e,r){if(!N(e))return null;let i=t.toLowerCase(),n=false;for(let s of [...Fr,"changes"]){for(let l of H(e,s))if(l&&i.includes(l)){n=true;break}if(n)break}if(!n)return null;let a=Z(t,e).tokens;if(a.length<2)return null;let u=yo(a,e);if(u>=0)return vo(t,e,a,r,u);let o=ao(a,e);return o?mo(t,e,a,r,o.action,o.keywordIdx):null}function mo(t,e,r,i,n,a){let u=H(e,"end"),o=$e.map(A=>H(e,A)),s=A=>Qe(A,o),l=A=>V(A,u),c=lo(n,r,a,e);if(Ir.has(n)&&(!c||!cr.test(c)))return null;let m=A=>({sourceLanguage:e,confidence:A,sourceText:t}),d=Tr(r,a+1,l,s);if(eo.has(n))return d>=0&&d!==r.length-1?null:Sr(n,[],c,m(d>=0?1:.8));let p=so(n,r,a,e,d);if(p<0||p>r.length)return null;let f=[],v=[],E=false,y=to.has(n);if(y||ro.has(n)){let A=y?"def":"event-handler",D=0,b=p;for(let g=p;g<r.length;g++){let C=r[g];if(l(C)){if(D>0){D--;continue}if(E=true,g===b)break;let B=y?C.position.end:C.position.start,z=t.slice(r[b].position.start,B).trim();try{let w=i.statement(z,e);if(w&&w.kind===A){let S=w;f.push(S);let O=!S.body||S.body.length===0;v.push(O?.2:S.metadata?.confidence??.75);}else v.push(0);}catch{v.push(0);}b=g+1;}else s(C)&&D++;}}else {let A=Tr(r,p,l,s);E=A>=0;let D=A>=0?r[A].position.start:t.length,b=t.slice(r[p].position.start,D).trim();if(!b)return null;try{f.push(...dr(i.body(b,e)));}catch{return null}if(f.length===0)return null;v.push(...f.map(g=>g.metadata?.confidence??.75));}if(f.length===0&&!E)return null;let h=E?1:.8,k=v.length>0?h*_e(v):h;return Sr(n,f,c,m(k))}var po=new Set([...Object.keys(ce),"then","else"]);function fo(t){let e=H(t,"when");for(let r of Zt(t))e.add(r);return e}function yo(t,e){if(t.length<3||!V(t[0],fo(e)))return -1;let r=H(e,"changes"),i=H(e,"end");for(let n=2;n<t.length;n++){let a=t[n];if(a.kind==="literal")continue;if(V(a,r))return n;if(V(a,i))return -1;let u=(a.normalized??a.value).toLowerCase();if(a.kind==="keyword"&&po.has(u))return -1}return -1}function ho(t,e,r){if(r==="en"){let n=e[0],a=e[e.length-1];return {type:"expression",raw:t.slice(n.position.start,a.position.end).trim()}}let i=e.map(n=>Br(n,r)?{...n,kind:"keyword",normalized:"or"}:n);return {type:"expression",raw:Pe(i,N(r))}}function vo(t,e,r,i,n){let a=H(e,"end"),u=$e.map(h=>H(e,h)),o=h=>Qe(h,u),s=h=>V(h,a),l=n+1;if(l>=r.length)return null;let c=Tr(r,l,s,o),m=c>=0;if(m&&c!==r.length-1)return null;let d=m?r[c].position.start:t.length,p=t.slice(r[l].position.start,d).trim();if(!p)return null;let f;try{f=dr(i.body(p,e));}catch{return null}if(f.length===0)return null;let v=ho(t,r.slice(1,n),e),y=(m?1:.8)*_e(f.map(h=>h.metadata?.confidence??.75));return Sr("when",f,void 0,{sourceLanguage:e,confidence:y,sourceText:t},new Map([["condition",v]]))}function Tr(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 Ee={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(Ee).map(([t,e])=>{let r={};for(let[i,n]of Object.entries(e))n in r||(r[n]=i);return [t,r]}));var ko={debounced:"debounce",debounce:"debounce",throttled:"throttle",throttle:"throttle"},wo=[["\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"]],Co=/^(\d+)(ms|s|m)?$/,bo=new Set(["selector","literal","url","event-modifier"]);function Ao(t){let e=t.match(Co);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 Do(t){for(let e=1;e<t.length;e++){let r=t[e];if(bo.has(r.kind))continue;let i=r.value.toLowerCase(),n=ko[i];if(n){let a=0;for(let u=e+1;u<t.length;u++){let o=t[u],s=Ao(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 wo){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}new Set(Object.values(Mr).flatMap(t=>Object.values(t)));var we=new Set(["if","unless","while","repeat","for"]),Cr=new Set(["then","end","else","if","unless","while","for","repeat","and"]),jo=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 W(t,e,r){return {message:t,severity:e,source:"semantic-parser",...r&&{code:r}}}function q(t,e){return e.length===0?t:{...t,diagnostics:e}}var lr=120;function $o(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>lr?`${u.slice(0,lr)}\u2026`:u,s=i-t.consumedTokens;return `pattern ${t.pattern.id} left ${s} token(s) unconsumed: "${o}"`}var Vo=new Set(["to","from","into","onto","with","as","at","of","in","on","by","and","or","then","end","else","the","a","an","async"]);function br(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 Xt){let o=a[u];if(Array.isArray(o))for(let s of o)i(s);}};return i(t),e.length===0?t:q(t,[...t.diagnostics??[],...e])}function gt(t){if(t.length>=2){let e=t[0];if((e==='"'||e==="'")&&t.endsWith(e))return t.slice(1,-1)}return t}var Xt=["body","statements","thenBranch","elseBranch","eventHandlers","initBlock"];function Qt(t,e){if(!t||typeof t!="object")return t;if(t.action&&t.roles instanceof Map){let i=ie(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==="transition"){let a=t.roles,u=a.get("goal");u&&u.type==="literal"&&u.dataType==="duration"&&!a.has("duration")&&(a.delete("goal"),a.set("duration",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 Xt){let n=r[i];if(Array.isArray(n))for(let a of n)Qt(a,e);}return t}var ee=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=Qt(this.parseInternal(e,r),this.boundIdentifiers),n=this.coverageFrames[this.coverageFrames.length-1];if(n.length>0&&(i=q(i,[...i.diagnostics??[],...n])),this.parseDepth===1&&(i=br(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 Vo.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>lr?`${a.slice(0,lr)}\u2026`:a;n.push(W(`${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=Xu(e,r,{statement:(z,w)=>this.parse(z,w),body:(z,w)=>this.parseStatements(z,w)});if(i)return i;let n=co(e,r,{statement:(z,w)=>this.parse(z,w),body:(z,w)=>this.parseStatements(z,w)});if(n)return n;let a=Qu(e,r,{statement:(z,w)=>this.parse(z,w),body:(z,w)=>this.parseStatements(z,w)});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=[],f=Z(d,r);this.positionSource=d;{let z=f.mark(),w=this.consumeJsBlock(f,r);if(w&&f.isAtEnd())return q(w,p);f.reset(z);}let v=fe(r);if(v.length===0)throw new Et(`No patterns available for language: ${r}`,r,d,[W(`No patterns registered for language '${r}'`,"error","no-patterns")]);let E=[...v].sort((z,w)=>w.priority-z.priority);{let z=f.tokens;if(N(r)?.wordOrder==="VSO"&&z.length>=4&&z[0]?.normalized==="source"){let w=z.findIndex(S=>S.normalized==="on");if(w>=2&&w+1<z.length){let S=d.slice(z[0].position.start,z[w].position.start).trim(),O=z[w+1].position.end,T=d.slice(z[w].position.start,O)+" "+S+d.slice(O);if(T!==d)try{let P=this.parse(T,r);if(P&&P.kind==="event-handler"){let M=u?this.applyModifiers(P,u):P;return q(M,p)}}catch{}}}}{let z=f.tokens,w=z[0]?.normalized==="if";for(let S=0;w&&S+3<z.length;S++){let O=(z[S+3]?.normalized??z[S+3]?.value??"").toLowerCase();if(z[S]?.normalized==="source"&&z[S+2]?.normalized==="on"&&F.KNOWN_EVENTS.has(O)){let T=(d.slice(0,z[S].position.start).trimEnd()+" "+d.slice(z[S+1].position.end).trimStart()).trim();if(T&&T!==d)try{let P=this.parse(T,r);if(P&&P.kind==="event-handler"){let M=u?this.applyModifiers(P,u):P;return q(M,p)}}catch{}break}}}{let z=f.tokens;for(let w=1;w<z.length-1;w++){let S=z[w];if(!Br(S,r))continue;let O=z[w+1],T=(O.normalized??O.value).toLowerCase();if(!F.KNOWN_EVENTS.has(T))break;let P=w+1,M=z[w+2];M&&M.kind==="selector"&&M.value.startsWith("[")&&(P=w+2);let j=z[w].position.start,$=z[P].position.end,L=(d.slice(0,j).trimEnd()+" "+d.slice($).trimStart()).trim();if(L&&L!==d)try{let J=this.parse(L,r);if(J&&J.kind==="event-handler"){J.additionalEvents=[{type:"literal",value:T}];let X=u?this.applyModifiers(J,u):J;return q(X,p)}}catch{}break}}{let z=Do(f.tokens);if(z){let w=(d.slice(0,z.start).trimEnd()+" "+d.slice(z.end).trimStart()).trim();if(w&&w!==d)try{let S=this.parse(w,r);if(S&&S.kind==="event-handler"){let O=this.applyModifiers(S,{...u??{},...z.modifiers});return q(O,p)}}catch{}}}let y=E.filter(z=>z.command==="on"),h=f.mark(),k=se.matchBest(f,y);if(k){p.push(W(`event pattern matched: ${k.pattern.id} (confidence: ${k.confidence.toFixed(2)})`,"info","pattern-match"));let z=false;if(/^event-[a-z]+-bare$/.test(k.pattern.id)){let w=k.captured.get("event"),S=(w?.raw??w?.value??"").toString().toLowerCase(),O=Ee[r],T=F.KNOWN_EVENTS.has(S)||!!O&&Object.keys(O).some(P=>P.toLowerCase()===S);if(S&&!T){let P=this.trySOVEventExtraction(d,r,E);if(P){p.push(W(`bare-event mis-anchor on "${S}" rejected; SOV extraction preferred`,"info","stage-bare-event-guard"));let M=u?this.applyModifiers(P,u):P;return q(M,p)}if(w?.type==="reference"||w?.type==="expression"){f.reset(h);let M=E.filter($=>$.command!=="on"),j=se.matchBest(f,M);f.reset(h),j&&j.pattern.command!=="on"?(z=true,p.push(W(`bare-event mis-anchor on reference "${S}" rejected; command ${j.pattern.command} preferred`,"info","stage-bare-event-guard"))):se.matchBest(f,y);}}}if(!z){let w=this.buildEventHandler(k,f,r),S=u?this.applyModifiers(w,u):w;return q(S,p)}}p.push(W(`event patterns: ${y.length} tried, no match`,"info","stage-event"));let A=this.tryTrailingEventExtraction(d,r,E);if(A){p.push(W("trailing event extraction succeeded","info","stage-trailing-event"));let z=u?this.applyModifiers(A,u):A;return q(z,p)}let D=E.filter(z=>z.command!=="on"),b=this.tryParseUnlessGuard(f,D,r);if(b&&b.length>0){let z=b.length===1?b[0]:Ye(b,"then",{sourceLanguage:r,confidence:1});return q(z,p)}let g=se.matchBest(f,D);if(g){if(we.has(g.pattern.command)){let w=this.trySOVEventExtraction(d,r,E);if(w){p.push(W(`SOV event extraction preferred over bare ${g.pattern.command} command`,"info","stage-sov-loop"));let O=u?this.applyModifiers(w,u):w;return q(O,p)}let S=this.tryMidStreamEventExtraction(d,r,E);if(S){p.push(W(`mid-stream event extraction preferred over bare ${g.pattern.command} command`,"info","stage-midstream-loop"));let O=u?this.applyModifiers(S,u):S;return q(O,p)}}else if(F.KNOWN_EVENTS.has(g.pattern.command)&&this.hasSOVEventMarkerHead(d,r)){let w=this.trySOVEventExtraction(d,r,E);if(w){p.push(W(`SOV event extraction preferred over command-homonym event ${g.pattern.command}`,"info","stage-sov-homonym"));let S=u?this.applyModifiers(w,u):w;return q(S,p)}}else if(N(r)?.wordOrder==="VSO"){let w=this.tryMidStreamEventExtraction(d,r,E);if(w){p.push(W(`mid-stream event extraction preferred over bare ${g.pattern.command} command`,"info","stage-midstream-cmd"));let S=u?this.applyModifiers(w,u):w;return q(S,p)}}if(g.consumedTokens<f.tokens.length&&N(r)?.wordOrder==="SOV"){let w=this.trySOVEventExtraction(d,r,E);if(w){p.push(W(`SOV event extraction preferred over partial ${g.pattern.command} command (trailing remainder)`,"info","stage-sov-trailing"));let S=u?this.applyModifiers(w,u):w;return q(S,p)}}if(g.consumedTokens<f.tokens.length&&!we.has(g.pattern.command)){let w=this.tryTopLevelCommandSequence(f,D,r);if(w)return p.push(W(`top-level command sequence: ${w.statements.length} commands`,"info","stage-top-level-sequence")),q(w,p)}p.push(W(`command pattern matched: ${g.pattern.id} (confidence: ${g.confidence.toFixed(2)})`,"info","pattern-match"));let z=$o(g,f,d);return z&&p.push(W(z,"warning","unconsumed-input")),q(this.buildCommand(g,r),p)}if(p.push(W(`command patterns: ${D.length} tried, no match`,"info","stage-command")),!d.includes(`
|
|
4
|
-
`)&&N(r)?.wordOrder==="VSO"){let z=this.tryMidStreamEventExtraction(d,r,E);if(z){p.push(W("mid-stream event extraction succeeded with no leading command match","info","stage-midstream-nocmd"));let w=u?this.applyModifiers(z,u):z;return q(w,p)}}let C=this.trySOVEventExtraction(d,r,E);if(C){p.push(W("SOV event extraction succeeded","info","stage-sov"));let z=u?this.applyModifiers(C,u):C;return q(z,p)}p.push(W("SOV event extraction: no event keyword found","info","stage-sov"));let B=this.tryCompoundCommandParsing(f,D,r);if(B)return p.push(W("compound command parsing succeeded","info","stage-compound")),q(B,p);throw p.push(W("compound parsing: no then-keywords or no command matches","info","stage-compound")),p.push(W(`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=Z(e,r),n=fe(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]=q(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 Ht()}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=te(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 d=n.type==="expression"?n.raw:n.type==="literal"?n.value:void 0;if(typeof d=="string"&&/^[^\s()[\]{}:]+$/.test(d)){let p=Ee[i]?.[d];p?n={type:"literal",value:p,dataType:"string"}:n.type==="expression"&&F.KNOWN_EVENTS.has(d.toLowerCase())&&(n={type:"literal",value:d.toLowerCase(),dataType:"string"});}}let a=se.extractEventModifiers(r),u=e.captured.get("source");u&&e.pattern.id.endsWith("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(p=>String("value"in p?p.value:""))].join(" or ")});let l,c=e.captured.get("action");if(c&&c.type==="literal"&&c.value==="if"){let d=r.tokens,p=-1;for(let f=r.position()-1;f>=0;f--){let v=d[f],E=(v.normalized??v.value).toLowerCase();if(this.isIfKeyword(E,i)){p=f;break}}if(p>=0){let f=fe(i).filter(A=>A.command!=="on").sort((A,D)=>D.priority-A.priority),v=d.slice(p);if(e.pattern.id.endsWith("vso-verb-first")&&s.type==="literal"){let A=String(s.value??"").split("[")[0].trim().toLowerCase(),D=v.findIndex((b,g)=>{if(g===0||A==="")return false;let C=(b.normalized??b.value).toLowerCase(),B=v[g-1];return C===A&&B.kind==="keyword"&&(B.normalized??"").toLowerCase()==="on"});if(D>0){let b=v[D+1],g=b&&b.kind==="selector"&&b.value.startsWith("[")?1:0;v=[...v.slice(0,D-1),...v.slice(D+1+g)];}}let E=new ae(v,i),y=this.coverageMark(),h=this.parseBodyWithClauses(E,f,i);if(h.some(A=>A.kind==="conditional")||h.length===1&&h[0]?.kind==="compound"&&h[0].statements.some(A=>A.kind==="conditional")){for(;!r.isAtEnd();)r.advance();return Ue(s,h,a,{sourceLanguage:i,patternId:e.pattern.id,confidence:e.confidence})}this.coverageRollback(y);}}if(c&&c.type==="literal"&&String(c.value)!=="js"&&ie(String(c.value))!==void 0){let d=c.value,p={};for(let[g,C]of e.captured)g!=="event"&&g!=="action"&&g!=="continues"&&(p[g]=C);if(d==="repeat"){let g=r.peek(),C=z=>(z.normalized??z.value).toLowerCase();if(g&&g.kind==="keyword"&&C(g)==="forever")p.loopType={type:"literal",value:"forever"},delete p.patient,r.advance();else if(g&&g.kind==="keyword"&&C(g)==="event"){r.advance();let z=r.peek();if(z)for(p.event={type:"literal",value:C(z)},p.loopType={type:"literal",value:"until-event"},delete p.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 B=p.patient;B&&B.type==="reference"&&B.value==="me"&&delete p.patient;}let f=te(d,p,{sourceLanguage:i,patternId:e.pattern.id,confidence:e.confidence});this.registerBoundIdentifiers(f);let v=[];if(!we.has(d)||d==="repeat"||d==="while"){let g=e.pattern.id.includes("verb-first"),C=r.tokens,B=r.position(),z=O=>O.kind==="conjunction"||O.kind==="keyword"&&(this.isThenKeyword(O.value,i)||this.isEndKeyword(O.value,i)),w=new Set;{let O=N(i)?.keywords?.[d];O?.primary&&w.add(O.primary.toLowerCase());for(let T of O?.alternatives??[])w.add(T.toLowerCase());}let S=-1;for(let O=B-1;O>=0;O--){let T=C[O];if(z(T))break;if((T.normalized??T.value).toLowerCase()===d||w.has(T.value.toLowerCase())){S=O;break}}if(S>=0){let O=B;for(;O<C.length&&!z(C[O]);)O++;let T=C.slice(S,O),P=T;if(g){let M=String(n.value??"").toLowerCase(),j=T.findIndex($=>($.normalized??$.value).toLowerCase()===M);if(j<0)P=null;else {let $=T[j-1],L=$&&$.kind==="keyword"&&$.normalized?.toLowerCase()==="on"?j-1:j;P=[...T.slice(0,L),...T.slice(j+1)];}}if(P&&P.length>1){let M=fe(i).filter(I=>I.command!=="on").sort((I,U)=>U.priority-I.priority),j=this.coverageMark(),$=this.parseClause(P,M,i),L=$[0],J=I=>I!==null&&typeof I=="object"&&typeof I.type=="string"?I.type:typeof I,X=ie(d),hr=X?.primaryRole,Yr=I=>I==="patient"&&hr&&hr!=="patient"&&!X?.roles.some(U=>U.role==="patient")?hr:I,Fi=(I,U)=>{if(!we.has(d)||!X)return false;let ve=X.roles.find(We=>We.role===Yr(I));return ve?ve.expectedTypes.length>0&&!ve.expectedTypes.includes(J(U)):true},vr=(I,U)=>I==="patient"&&!!X&&!X.roles.some(ve=>ve.role==="patient")&&J(U)==="literal"&&Nt.has(String(U.value??"").toLowerCase()),Er=I=>I!==null&&typeof I=="object"&&I.implicit===true,Ti=!!L&&L.kind==="command"&&Object.entries(p).every(([I,U])=>{if(Er(U)||Fi(I,U)||vr(I,U))return true;let ve=L.roles.get(Yr(I));if(ve!==void 0&&J(ve)===J(U))return true;if(I==="patient"&&d==="pick"&&J(U)==="literal"){let We=L.roles.get("method"),Jr=J(We),Xr=Jr==="literal"?String(We.value):Jr==="expression"?String(We.raw):void 0;return Xr!==void 0&&Xr===String(U.value)}return false}),Zr=L?.metadata?.patternId??"",Ri=!we.has(d)||/^repeat-.*-(times|for-in|while-head|until-head)$/.test(Zr),Oi=/^repeat-.*-(times|for-in|while-head|until-head)$/.test(Zr);if(($.length===1||Oi&&$.length>1)&&L&&L.kind==="command"&&(L.action===d||d==="while"&&L.action==="repeat"&&/-while-head$/.test(L.metadata?.patternId??""))&&Ti&&Ri&&(L.roles.size>Object.entries(p).filter(([I,U])=>!vr(I,U)).length||[...L.roles.values()].filter(I=>!Er(I)).length>Object.entries(p).filter(([I,U])=>!vr(I,U)&&!Er(U)).length))for(f=L,v=$.slice(1);r.position()<O;)r.advance();else this.coverageRollback(j);}}}if(!we.has(d)){let g=f;if(ie(d)?.roles.some(T=>T.role==="quantity"&&!T.required)&&!g.roles.has("quantity")){let T=r.peek();T&&/^-?\d+(\.\d+)?$/.test(T.value)&&(f=te(d,{...Object.fromEntries(g.roles),quantity:{type:"literal",value:parseFloat(T.value),dataType:"number"}},g.metadata),r.advance());}let B=f;if(ie(d)?.roles.some(T=>T.role==="duration"&&!T.required)&&!B.roles.has("duration")){let T=/^\d+(\.\d+)?(ms|s)$/i,P=r.peek(),M=false;if(P&&P.kind==="particle"){let j=r.peek(1);j&&T.test(j.value)&&(M=true,P=j);}P&&T.test(P.value)&&(f=te(d,{...Object.fromEntries(B.roles),duration:{type:"literal",value:P.value,dataType:"string"}},B.metadata),M&&r.advance(),r.advance(),this.consumeForPostposition(r,i));}let w=f,S=ie(d);if(S?.roles.find(T=>T.role==="responseType"&&!T.required)&&!w.roles.has("responseType")){let T=L=>typeof L=="string"&&F.RESPONSE_TYPE_WORDS.has(L.toLowerCase()),P=(L,J)=>{let X=Object.fromEntries(w.roles);J&&delete X.destination,X.responseType={type:"expression",raw:L},f=te(d,X,w.metadata);},M=w.roles.get("destination"),j=S?.roles.find(L=>L.role==="destination"),$=M?.raw??M?.value;if(M&&j&&!j.expectedTypes.includes(M.type)&&T($))P($,true);else {let L=r.peek();L&&T(L.value)&&(P(L.value,false),r.advance());}}if(d==="wait"){let T=f;if(!T.roles.has("event")){let P=r.peek();if(P&&Oe.has(P.value.toLowerCase())){let M=Object.fromEntries(T.roles),j=M.duration;j&&j.type!=="literal"&&j.type!=="expression"&&delete M.duration;let $=M.patient;$&&$.type==="reference"&&$.value==="me"&&delete M.patient,M.event={type:"literal",value:P.value,dataType:"string"},f=te(d,M,T.metadata),r.advance(),this.consumeForPostposition(r,i);}}}this.tryAttachTrailingRole(r,f,i),this.tryAttachTrailingStyle(r,f,i),this.tryAttachTrailingExpressionRole(r,f,i);}let E=e.captured.get("continues"),y=E?.type==="literal"&&E.value==="then",h=r.peek(),k=!!h&&this.isThenKeyword(h.value,i),D=we.has(d)&&!!h&&!this.isEndKeyword(h.value,i),b=!!h&&!this.isEndKeyword(h.value,i);if(y||k||D||b){let g=fe(i).filter(z=>z.command!=="on").sort((z,w)=>w.priority-z.priority),C=fe(i).filter(z=>z.id.startsWith("grammar-")&&z.id.includes("-continuation")).sort((z,w)=>w.priority-z.priority),B=this.parseBodyWithGrammarPatterns(r,g,C,i);B.length>0?l=[f,...v,...B]:l=[f,...v];}else l=[f,...v],r.isAtEnd()||this.recordDroppedTokens(r.tokens.slice(r.position()),i,"handler body tail");}else {let d=fe(i).filter(f=>f.command!=="on").sort((f,v)=>v.priority-f.priority),p=c?e.roleStarts?.get("action"):void 0;if(p!==void 0&&p<r.position()){let f=new ae(r.tokens.slice(p),i);for(l=this.parseBodyWithClauses(f,d,i);!r.isAtEnd();)r.advance();}else l=this.parseBodyWithClauses(r,d,i);}let m=l.length>1?[Ye(l,"then",{sourceLanguage:i})]:l;return Ue(s,m,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 f=this.consumeJsBlock(e,i)??this.consumeVerbFinalJsBlock(e,i);if(f){n.push(f);continue}let v=this.tryParseConditionalBlock(e,r,i);if(v){n.push(v);continue}let E=this.tryParseUnlessGuard(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"||ut(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 f=this.parseClause(a,r,i);n.push(...f),a.length=0,u=f.filter(v=>{let E=v;return (E.action==="for"||E.action==="repeat"||E.action==="while")&&(!Array.isArray(E.body)||E.body.length===0)}).length,o.length=0;for(let v=0;v<u;v++)o.push("other");}e.advance();continue}if(p){e.advance();let f=[];for(;!e.isAtEnd();){let v=e.peek();if(!v||v.kind==="conjunction"||v.kind==="keyword"&&(this.isThenKeyword(v.value,i)||this.isEndKeyword(v.value,i)))break;f.push(v),e.advance();}if(f.length>0){let v=this.coverageMark(),E=a.length>0?this.parseClause(a,r,i):[];E.length===0&&a.length>0?(this.coverageRollback(v),n.push(...this.parseClause([...a,...f],r,i))):(n.push(...E),n.push(...this.parseClause(f,r,i)));}else if(a.length>0){let v=this.parseClause(a,r,i);n.push(...v);}a.length=0;break}if(s.kind==="keyword"){let f=(s.normalized??s.value).toLowerCase();(this.isIfKeyword(f,i)||this.isUnlessKeyword(f,i)||f==="while"||f==="for"||f==="repeat")&&(u++,o.push(this.isIfKeyword(f,i)?"if":"other"));}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?[Ye(n,"then",{sourceLanguage:i})]:n}tryTopLevelCommandSequence(e,r,i){let n=this.coverageMark(),a;try{let l=new ae(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 Ye(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 y=(u.normalized??u.value).toLowerCase();this.isUnlessKeyword(y,i)&&(n="unless",a=e.slice(0,-1));}let o=null;if(n&&a.length>=3){let y=N(i),h=y?F.buildVerbLookup(y):null;if(h)for(let k=1;k<a.length-1;k++){let A=a[k],D=h.get(A.value.toLowerCase())??(A.normalized?h.get(A.normalized.toLowerCase()):void 0);if(D&&!F.CONDITION_OPERATORS.has(D)){o=a.slice(0,k),a=a.slice(k);break}}}let s=new ae(a,i),l=[],c=this.coverageMark(),m=0,d=[],p=o,f=()=>{if(d.length===0)return;let y=d.slice();if(d.length=0,n&&l.length===0&&p===null){p=y;return}let h=y[0];if(!(h&&(h.kind==="identifier"||h.kind==="selector"||h.kind==="literal"||h.kind==="reference"))){this.recordDroppedTokens(y,i,"body clause");return}let A=false;for(let D of this.parseSOVClauseByVerbAnchoring(y,i)){let b=D.action,g=D.roles;b&&ie(b)&&g instanceof Map&&g.size>0&&(l.push(D),A=true);}A||this.recordDroppedTokens(y,i,"body clause");};for(;!s.isAtEnd();){let y=s.peek(),h=!!y&&y.normalized?.toLowerCase()==="repeat",k=s.mark(),A=se.matchBest(s,r);if(h&&A&&A.pattern.command!=="repeat"){s.reset(k),f(),l.push(te("repeat",{},{sourceLanguage:i,confidence:.6})),m++,s.advance();continue}if(A&&A.pattern.command==="if"){let D=s.mark(),b=d.length;for(s.reset(k);!s.isAtEnd();){let C=s.peek();if(!C||this.isIfKeyword((C.normalized??C.value).toLowerCase(),i))break;d.push(C),s.advance();}let g=this.tryParseConditionalBlock(s,r,i);if(g){f(),l.push(g),m++;continue}d.length=b,s.reset(D);}if(A){f();let D=this.buildCommand(A,i);l.push(D),m++,this.tryAttachTrailingRole(s,D,i),this.tryAttachTrailingStyle(s,D,i),this.tryAttachTrailingExpressionRole(s,D,i),this.tryAttachTrailingDuration(s,D);}else {let D=s.peek();D&&D.normalized?.toLowerCase()==="repeat"?(f(),l.push(te("repeat",{},{sourceLanguage:i,confidence:.6})),m++):D&&d.push(D),s.advance();}}f();let v=l;if(m===0){let y=this.parseSOVClauseByVerbAnchoring(a,i);y.length>0&&(this.coverageRollback(c),v=y);}let E=p;return n&&v.length>0&&E&&E.length>0?[te(n,{condition:{type:"expression",raw:this.joinTokenText(E,i)}},{sourceLanguage:i,patternId:`${n}-${i}-trailing-guard`,confidence:.85}),...v]:n&&E&&E.length>0&&v.length===0?[te(n,{condition:{type:"expression",raw:this.joinTokenText(E,i)}},{sourceLanguage:i,patternId:`${n}-${i}-trailing-guard`,confidence:.85})]:v}tryAttachTrailingDuration(e,r){let i=r.roles;if(i.has("duration")||!ie(r.action)?.roles.some(u=>u.role==="duration"&&!u.required))return;let a=e.peek();!a||!/^\d+(?:\.\d+)?(?:ms|s|m|h)$/.test(a.value)||(i.set("duration",K(a.value,"duration")),e.advance());}tryAttachTrailingRole(e,r,i){let n=ie(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 Cr.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(E=>E.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=E=>{if(!E||E.kind!=="particle"&&E.kind!=="keyword")return false;let y=E.value.toLowerCase();return m.primary?.toLowerCase()===y?true:c?false:(E.normalized??"").toLowerCase()===l?true:!!m.alternatives?.some(h=>h.toLowerCase()===y)},f=e.peek(),v=e.peek(1);if(!f||!v)return;if(c&&m.position==="after"){let E=e.peek(2),y=(f.normalized??f.value).toLowerCase();if(jo.has(y)&&v.kind==="selector"&&p(E)){u.set(l,{type:"expression",raw:`${y} ${v.value}`}),e.advance(),e.advance(),e.advance();return}}if(m.position==="after"){if(o(f,c)&&p(v)){let E=this.tokenToSemanticValue(f);e.advance(),e.advance(),E&&u.set(l,E);return}if(c&&o(f,c)){let E=e.peek(2),y=e.peek(3);if((v.normalized??v.value).toLowerCase()==="in"&&E&&!p(E)&&p(y)){let h=this.tokenToSemanticValue(f);e.advance(),e.advance(),e.advance(),e.advance(),h&&u.set(l,h);return}}}else if(p(f)&&o(v,c)){e.advance();let E=this.tokenToSemanticValue(e.advance());E&&u.set(l,E);return}}}tryAttachTrailingStyle(e,r,i){if(r.action!=="fetch"&&r.action!=="render")return;let n=r.roles;if(!ie(r.action)?.roles.some(y=>y.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 y=Ze(e,u.raw);y&&n.set("style",{type:"expression",raw:y});}this.tryAttachResponseTypeAfterStyle(e,r,i);return}if(r.action==="fetch"){let y=n.get("patient"),h=n.get("source");if(y&&h&&(y.type==="literal"||y.type==="expression")&&h.type==="expression"&&typeof h.raw=="string"&&/^[A-Za-z_][\w-]*$/.test(h.raw)&&e.peek()?.value===":"){let k=Ze(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 y=new Set([s.primary,...s.alternatives??[]].map(D=>D.toLowerCase())),h=e.peek();if(!h||!y.has(h.value.toLowerCase()))return;let k=e.mark();e.advance();let A=Ze(e);if(!A){e.reset(k);return}n.set("style",{type:"expression",raw:A}),this.tryAttachResponseTypeAfterStyle(e,r,i);return}if(s.position!=="after")return;let l=new Set([s.primary,...s.alternatives??[]].map(y=>y.toLowerCase())),c=y=>y.kind==="conjunction"||y.kind==="keyword"&&(this.isThenKeyword(y.value,i)||this.isEndKeyword(y.value,i)),m=24,d=-1,p=0;for(let y=0;y<m;y++){let h=e.peek(y);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=y;break}}if(d<=0)return;let f=[];for(let y=0;y<d;y++){let h=e.peek(y);h&&f.push(h);}if(f.length===1&&F.RESPONSE_TYPE_WORDS.has(f[0].value.toLowerCase()))return;let v=new ae(f,i),E=Ze(v);n.set("style",{type:"expression",raw:E&&v.isAtEnd()?E:this.joinTokenText(f,i)});for(let y=0;y<=d;y++)e.advance();this.tryAttachResponseTypeAfterStyle(e,r,i);}tryAttachResponseTypeAfterStyle(e,r,i){let n=r.roles;if(n.has("responseType")||!ie(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 y=e.peek();if(y&&!Cr.has((y.normalized??y.value).toLowerCase())){let k=this.tokenToSemanticValue(y);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 y=/^url\s+(\S+)$/i.exec(String(o.raw??""));if(y){let h=y[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 y=u.get("patient");if(y&&y.type==="expression"&&String(y.raw).toLowerCase()==="url"){let h=e.peek();if(h&&!Cr.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 y=s.roleMarkers?.destination;if(!y||y.position!=="after")return;l=y.primary.toLowerCase();}let c=y=>y.kind==="conjunction"||y.kind==="keyword"&&(this.isThenKeyword(y.value,i)||this.isEndKeyword(y.value,i)),m=24,d=[],p=0,f=false;for(let y=0;y<m;y++){let h=e.peek(y);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){f=true;break}d.push(h);}if(d.length===0||l!==null&&!f)return;let v=d.length+(f?1:0);if(n==="go"&&d.length===2&&d[0].value.toLowerCase()==="url"){let y=this.tokenToSemanticValue(d[1]);if(y.type==="literal"||y.type==="selector"){u.set(a.role,y),u.set("method",{type:"literal",value:"url"});let h=u.get("patient");h&&h.type==="reference"&&h.value==="me"&&!ie(n)?.roles.some(k=>k.role==="patient")&&u.delete("patient");for(let k=0;k<v;k++)e.advance();return}}let E=d;if(n==="js"){let y=s.keywords?.js,h=A=>[y?.primary,...y?.alternatives??[]].some(D=>!!D&&D.length>A.value.length&&D.includes(A.value)),k=0;for(;k<E.length&&h(E[k]);)k++;if(E=E.slice(k),E.length===0)return}if(u.set(a.role,{type:"expression",raw:this.joinTokenText(E,i)}),a.role!=="patient"){let y=u.get("patient");y&&y.type==="reference"&&y.value==="me"&&!ie(n)?.roles.some(h=>h.role==="patient")&&u.delete("patient");}for(let y=0;y<v;y++)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 f=o;f<e.length;f++){let v=e[f];if(a.has(v.value))continue;let E=n.get(v.value.toLowerCase()),y=v.normalized?n.get(v.normalized.toLowerCase()):void 0,h=E||y;if(h){s=f,l=h;break}}if(s===-1)break;let c=e.slice(o,s),m=e.length;for(let f=s+1;f<e.length;f++){let v=e[f];if(v.kind==="conjunction"||this.isThenKeyword(v.value,r)){m=f;break}if(f>s+1&&!a.has(v.value)&&(n.get(v.value.toLowerCase())||(v.normalized?n.get(v.normalized.toLowerCase()):void 0))){m=f;break}}let d=e.slice(s+1,m),p=this.extractRolesFromMarkedTokens(c,d,a,l,r);if(u.push(te(l,p,{sourceLanguage:r,confidence:.7})),o=m,o<e.length){let f=e[o];(f.kind==="conjunction"||this.isThenKeyword(f.value,r))&&o++;}}return u}extractRolesFromMarkedTokens(e,r,i,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 f=this.tokensToSemanticValue(c,a);if(f){let v=this.mapRoleForCommand(p,n,u);v&&(u[v]=f);}c=[];}else c.push(d);}if(c.length>0)if(c.length===1&&/^\d+(\.\d+)?(ms|s)$/i.test(c[0].value)&&!u.duration&&ie(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("*")?ge(n):a.kind==="literal"||a.value.startsWith('"')||a.value.startsWith("'")?K(gt(n),"string"):a.kind==="reference"?le(n):K(this.joinTokenText(i,r))}tokenToSemanticValue(e){let r=e.value;if(e.kind==="selector"||r.startsWith("#")||r.startsWith(".")||r.startsWith("@")||r.startsWith("*"))return ge(r);if(r.startsWith('"')||r.startsWith("'"))return K(gt(r),"string");if(/^-?\d+(\.\d+)?$/.test(r))return K(parseFloat(r));if(r==="true"||r==="\u771F"||r==="\uCC38"||r==="do\u011Fru")return K(true);if(r==="false"||r==="\u507D"||r==="\uAC70\uC9D3"||r==="yanl\u0131\u015F")return K(false);if(r.length>1&&(r.startsWith(":")||r.startsWith("$")))return le(r);let i=e.normalized?.toLowerCase();return i==="me"||i==="it"||i==="you"||i==="result"||i==="body"?le(i):e.kind==="reference"?le(e.normalized||"me"):K(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),f=e.peek(1);if(!ut(n,m.value,p?.value,f?.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=se.matchBest(e,i);if(p){let f=p.pattern.command,v={};for(let[h,k]of p.captured)h!=="event"&&h!=="action"&&h!=="continues"&&(v[h]=k);let E=te(f,v,{sourceLanguage:n,patternId:p.pattern.id});a.push(E),d=true,o=true;let y=p.captured.get("continues");if(y&&y.type==="literal"&&y.value==="then")continue}}if(!d){let p=e.mark(),f=se.matchBest(e,r);if(f){if(f.pattern.command==="if"){let E=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 y=this.tryParseConditionalBlock(e,r,n);if(y){s(),a.push(y),o=true;continue}e.reset(E);}let v=this.buildCommand(f,n);a.push(v),this.tryAttachTrailingRole(e,v,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 ae(n,i),s=this.coverageMark(),l=this.parseBodyWithClauses(o,r,i);return l.length===0?(this.coverageRollback(s),null):l[0]}static isEnEventKeyword(e){if(typeof e!="string")return false;let r=e.toLowerCase(),i=F.enEventKeywordCache.get(r);if(i!==void 0)return i;let n=false;try{let a=Z(r,"en").tokens;n=a.length===1&&a[0]?.kind==="keyword";}catch{n=false;}return F.enEventKeywordCache.set(r,n),n}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}=Z(e,r),a=Ee[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=Z(e,r).tokens;if(n.length<3)return null;let a=Ee[r],u=new Set;if(a)for(let A of Object.keys(a))u.add(A.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 f=d&&F.KNOWN_EVENTS.has(d)?d:a?.[m]??m,v=n.slice(0,o);if(v.length===0)return null;let E=i.filter(A=>A.command!=="on"),y=new ae(v,r),h=this.coverageMark(),k=this.parseBodyWithClauses(y,E,r);return k.length===0?(this.coverageRollback(h),null):Ue({type:"literal",value:f},k,void 0,{sourceLanguage:r,confidence:.75})}tryMidStreamEventExtraction(e,r,i){let n=Z(e,r).tokens;if(n.length<3)return null;let a=Ee[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 f=d&&F.KNOWN_EVENTS.has(d)?d:a?.[m]??m,v=n.filter((A,D)=>D!==o&&D!==o+1);if(v.length===0)return null;let E=i.filter(A=>A.command!=="on"),y=new ae(v,r),h=this.coverageMark(),k=this.parseBodyWithClauses(y,E,r);return k.length===0?(this.coverageRollback(h),null):Ue({type:"literal",value:f},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=Z(e,r).tokens,o=Ee[r],s=new Set;if(o)for(let b of Object.keys(o))s.add(b.toLowerCase());let l=F.SOV_SOURCE_MARKERS[r],c=-1,m="",d="",p=1,f=[];for(let b=0;b<u.length;b++){let g=u[b],C=g.value.toLowerCase(),B=C,z="",w=C.indexOf("[");w>0&&(B=C.slice(0,w),z=g.value.slice(w));let S=g.normalized?.toLowerCase(),O=S&&(F.KNOWN_EVENTS.has(S)||Oe.has(S)),T=s.has(C)||s.has(B),P=F.KNOWN_EVENTS.has(B)||Oe.has(B);if(O||T||P){let M=u[b-1];if(M&&(M.normalized??M.value).toLowerCase()==="event")continue;let j;O?j=S:T?j=o?.[C]??o?.[B]??B:j=B;let $=this.matchEventParamPhrase(u,b+1);if(n.size>0){let L=1+$.len,J=u[b+L];J&&J.kind==="selector"&&J.value.startsWith("[")&&(L+=1);let X=u[b+L];if(X&&(X.kind==="particle"||X.kind==="keyword")&&n.has(X.value)){c=b,m=j,d=z||(L===$.len+2?u[b+L-1].value:""),p=L+1,f=$.names;break}}else {c=b,m=j,d=z,p=1+$.len+this.matchEventMarkerPhrase(u,b+1+$.len,r),f=$.names;break}}}if(c===-1){let b=new Set(i.filter(g=>g.command!=="on").map(g=>g.command));for(let g=0;g<u.length;g++){let C=u[g];if(C.kind==="identifier")if(n.size>0){let B=1,z=u[g+1];z&&z.kind==="selector"&&z.value.startsWith("[")&&(B=2);let w=u[g+B];if(w&&(w.kind==="particle"||w.kind==="keyword")&&n.has(w.value)){c=g,m=C.value,d=B===2?u[g+1].value:"",p=B+1;break}}else {let B=this.matchEventMarkerPhrase(u,g+1,r);if(B>0){c=g,m=C.value,d="",p=1+B;break}let z=u[g+1];if(z&&z.kind==="keyword"&&z.normalized!=null&&b.has(z.normalized)){c=g,m=C.value,d="",p=1;break}}}}if(c===-1)return null;let v=new Set;for(let b=c;b<c+p;b++)v.add(b);if(l){let b=c+p;if(b<u.length){let g=u[b];if((g.kind==="particle"||g.kind==="keyword")&&l.markers.has(g.value))v.add(b);else if(this.isStrippableSourceRef(g,l.windowTokens)){let C=u[b+1];C&&(C.kind==="particle"||C.kind==="keyword")&&l.markers.has(C.value)&&(v.add(b),v.add(b+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)&&(v.add(c-2),v.add(c-1));}for(let g=0;g<c;g++){let C=u[g],B=C.value.toLowerCase(),z=C.normalized?.toLowerCase();if(l.windowTokens.has(B)||z&&l.windowTokens.has(z)){v.add(g);break}}}let E=u.filter((b,g)=>!v.has(g));if(E.length===0)return null;let y=i.filter(b=>b.command!=="on"),h=new ae(E,r),k=this.coverageMark(),A=this.parseBodyWithClauses(h,y,r);if(A.length===0)return this.coverageRollback(k),null;let D={sourceLanguage:r,confidence:.75};return d&&(D.keyFilter=d),Ue(F.isEnEventKeyword(m)?{type:"literal",value:m}:{type:"expression",raw:m},A,void 0,D,f)}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=Nu(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)}isPatientMarker(e,r){let i=N(r)?.roleMarkers?.patient;if(!i?.primary)return false;let n=e.value.toLowerCase();return i.primary.toLowerCase()===n?true:!!i.alternatives?.some(a=>a.toLowerCase()===n)}isJsBlockTerminator(e,r){return this.isEndKeyword(e,r)||this.profileKeywordMatches(r,"end",e.toLowerCase())}consumeVerbFinalJsBlock(e,r){let i=e.mark(),n=0,a=-1;for(;;){let c=e.peek(n);if(!c||this.isThenKeyword(c.value,r)||this.isJsBlockTerminator(c.value,r))break;if(this.isJsKeyword(c)){let m=e.peek(n+1),d=!!m&&c.position?.end!==void 0&&c.position.end===m.position?.start&&this.profileKeywordMatches(r,"js",`${c.value}${m.value}`.toLowerCase()),p=e.peek(n+(d?2:1));if(n>0&&p&&this.isJsBlockTerminator(p.value,r)){a=n;break}}n++;}if(a<=0)return null;let u=[];for(let c=0;c<a;c++){let m=e.peek(c);m&&u.push(m);}let o=u[u.length-1];if(o&&this.isPatientMarker(o,r)&&u.pop(),u.length===0)return e.reset(i),null;let s=this.rawJsBody(u);for(let c=0;c<a;c++)e.advance();e.advance();let l=e.peek();return l&&!this.isJsBlockTerminator(l.value,r)&&e.advance(),e.advance(),te("js",{patient:{type:"expression",raw:s||"()"}},{sourceLanguage:r,patternId:`js-opaque-final-${r}`,confidence:1})}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=e.peek();o&&this.isPatientMarker(o,r)&&e.advance();let s=false;for(;!e.isAtEnd();){let c=e.peek();if(!c)break;if(e.advance(),this.isJsBlockTerminator(c.value,r)){s=true;break}a.push(c);}if(!s)return e.reset(n),null;let l=this.rawJsBody(a);return te("js",{patient:{type:"expression",raw:l||"()"}},{sourceLanguage:r,patternId:`js-opaque-${r}`,confidence:1})}rawJsBody(e){if(e.length===0)return "";let r=e[0].position?.start,i=e[e.length-1].position?.end,n=this.positionSource;if(n!==void 0&&r!==void 0&&i!==void 0){let u=n.slice(r,i),o=s=>s.replace(/\s+/g,"");if(o(u)===o(e.map(s=>s.value).join("")))return u.trim()}let a="";for(let u=0;u<e.length;u++){let o=e[u-1],s=o?.position?.end!==void 0&&e[u].position?.start===o.position.end;u>0&&!s&&(a+=" "),a+=e[u].value;}return a.trim()}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)}tryParseUnlessGuard(e,r,i){let n=e.peek();if(!n||!this.isUnlessKeyword((n.normalized??n.value).toLowerCase(),i))return null;let a=e.mark(),u=this.tryParseConditionalBlock(e,r,i,true);if(!u||u.kind!=="conditional")return e.reset(a),null;let o=u;if(o.elseBranch&&o.elseBranch.length>0)return e.reset(a),null;let s=o.roles.get("condition");return s?[te("unless",{condition:s},{sourceLanguage:i,patternId:`unless-${i}-guard`,confidence:1}),...o.thenBranch]:(e.reset(a),null)}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,n=false){let a=e.peek();if(!a)return null;let u=(a.normalized??a.value).toLowerCase();if(!this.isIfKeyword(u,i)&&!(n&&this.isUnlessKeyword(u,i)))return null;let o=e.mark(),s=this.coverageMark();e.advance();let l=[],c=0;for(;!e.isAtEnd();){let C=e.peek();if(!C)break;let B=(C.normalized??C.value).toLowerCase();if(this.isIfKeyword(B,i)||this.isUnlessKeyword(B,i)){c++,l.push(C),e.advance();continue}if(this.isBlockEndToken(C,e.peek(1)??void 0,i)){if(c===0){e.advance();break}c--,l.push(C),e.advance();continue}l.push(C),e.advance();}if(l.length===0)return e.reset(o),this.coverageRollback(s),null;let m=N(i),d=m?.wordOrder==="SOV"?F.buildVerbLookup(m):null,p=0,f=0,v=[];for(;p<l.length;p++){let C=l[p],B=(C.normalized??C.value).toLowerCase();if(this.isIfKeyword(B,i)||this.isUnlessKeyword(B,i)?f++:this.isBlockEndToken(C,l[p+1],i)&&f--,f===0&&this.isThenKeyword(C.value,i)){p++;break}if(f===0&&v.length>0){let z=(l[p-1].normalized??l[p-1].value).toLowerCase(),w=l[p-1].value.toLowerCase(),S=(C.normalized??C.value).toLowerCase(),O=F.CONDITION_COPULAS.has(z)||F.CONDITION_COPULAS_SURFACE.has(w)&&F.CONDITION_PREDICATES.has(S),T=d!==null&&d.has(C.value.toLowerCase())&&!F.CONDITION_PREDICATES.has(S),P=/^\.[a-zA-Z_]\w*$/.test(C.value)&&l[p-1].position?.end!==void 0&&C.position?.start!==void 0&&l[p-1].position.end===C.position.start;if(!F.CONDITION_OPERATORS.has(S)&&!P&&(!O||T)&&(this.tokensBeginCommand(l.slice(p),r,i)||this.sovCommandStartsAt(l.slice(p),d)))break}v.push(C);}if(v.length===0)return e.reset(o),this.coverageRollback(s),null;let y=[],h=[],k=false,A=0;for(;p<l.length;p++){let C=l[p],B=(C.normalized??C.value).toLowerCase();if(this.isIfKeyword(B,i)||this.isUnlessKeyword(B,i)?A++:this.isBlockEndToken(C,l[p+1],i)&&A--,A===0&&!k&&this.isElseKeyword(C.value,i)){k=true;continue}(k?h:y).push(C);}let D={type:"expression",raw:this.joinTokenText(v,i)},b=this.parseBranch(y,r,i),g=h.length>0?this.parseBranch(h,r,i):void 0;return b.length===0&&(!g||g.length===0)?(e.reset(o),this.coverageRollback(s),null):vu(D,b,g,{sourceLanguage:i,patternId:`conditional-${i}-folded`,confidence:1})}joinTokenText(e,r){return Pe(e,N(r))}tokensBeginCommand(e,r,i){if(e.length===0)return false;let n=new ae(e,i);return se.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 ae(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=Z(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 f=n[p],v=n[p+1],E=f.kind==="identifier"&&v?.kind==="literal"&&/^\d+(ms|s|m)?$/.test(v.value);(f.kind==="keyword"||f.kind==="particle"||E)&&(p++,l++);}if(p<n.length){let f=n[p];if(f.kind==="literal"){let v=f.value.match(/^(\d+)(ms|s|m)?$/);if(v){let E=parseInt(v[1],10),y=v[2]||"ms";y==="s"?E*=1e3:y==="m"&&(E*=6e4),s[o]=E,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=Z(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=Z(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=Z(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 f=Math.min(m.position.start,p.position.start),v=Math.max(m.position.end,p.position.end),E=r.slice(f,v).replace(/\s+/g," ").trim();if(!a.some(h=>h===E||h.includes(E)))continue;let y=(r.slice(0,f).trimEnd()+" "+r.slice(v).trimStart()).trim();if(!(!y||y===r))try{let h=this.parse(y,i);if(!h||h.kind!=="event-handler")continue;let k=br(h);if(n(k)<u)return {node:{...k,eventModifiers:{...k.eventModifiers,from:{type:"literal",value:p.value,dataType:"string"}}},input:y}}catch{}}return null}reclaimEventCompoundTail(e,r,i){let n=F.unconsumedSpans(e);if(n.length===0)return null;let a=Ee[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=Z(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 f=l(r.slice(c[d].position.start,c[p].position.end));if(f.length>m.length)break;if(f!==m)continue;let v=c[d-1];if((a[v.value]??v.normalized)!==s)break;let y=l(r.slice(v.position.start,c[p].position.end)),h=a[y];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=Z(r,i).tokens;for(let l=0;l+1<s.length;l++){let c=s[l],m=s[l+1];if(!a.some(f=>c.value.toLowerCase()===f)||!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 f=this.parse(p,i);if(!f||f.kind!=="event-handler")continue;let v=br(f);if(F.droppedTokenCount(v)>=o)continue;let E=F.findResponseTypeTarget(v);if(!E)continue;return E.roles.set("responseType",{type:"expression",raw:m.value}),{node:v,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(ie(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=Z(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 f=o(r.slice(c.position.start,m.position.end));if(!n.includes(f))continue;let v=false,E=y=>{if(!y||typeof y!="object"||v)return;if(y.kind==="command"){let k=y.roles.get("destination");if(k?.type==="reference"&&k.value==="me"){v=true;return}}let h=y;for(let k of ["body","statements","thenBranch","elseBranch","commands"]){let A=h[k];Array.isArray(A)&&A.forEach(D=>E(D));}};if(E(e),!!v)return {node:F.withoutSpanDiagnostics(e,f),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;if(!Br(a,r)){e.reset(n);break}e.advance();let u=e.peek();if(!u){e.reset(n);break}let o=(u.normalized||u.value).toLowerCase();e.advance(),i.push({type:"literal",value:o});}return i}};ee.coverageMarkerSurfaces=new Map;ee.LEAKED_RENDER_MARKERS={hi:["\u0915\u0947","\u0930\u0942\u092A","\u092E\u0947\u0902"],tr:["olarak"],qu:["hina"]};ee.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"]};ee.AS_MARKERS_AFTER={ko:[["\uB85C"],["\uC73C\uB85C"]],qu:[["hina"]],tr:[["olarak"]],hi:[["\u0915\u0947","\u0930\u0942\u092A","\u092E\u0947\u0902"]]};ee.enEventKeywordCache=new Map;ee.KNOWN_EVENTS=new Set(["click","dblclick","input","change","submit","keydown","keyup","keypress","mouseover","mouseout","mousedown","mouseup","focus","blur","load","scroll","resize","contextmenu"]);ee.RESPONSE_TYPE_WORDS=new Set(["json","text","html","xml","blob","arraybuffer","formdata","response"]);ee.SOV_EVENT_MARKERS={ja:new Set(["\u3067"]),ko:new Set,tr:new Set(["de","da","te","ta"]),bn:new Set(["\u098F"]),qu:new Set(["pi"]),hi:new Set(["\u092A\u0930"])};ee.SOV_EVENT_MARKER_PHRASES={ko:[["\uD560","\uB54C"],["\uD560\uB54C"]]};ee.SOV_SOURCE_MARKERS={ja:{markers:new Set(["\u304B\u3089"]),windowTokens:new Set(["\u30A6\u30A3\u30F3\u30C9\u30A6","\u30C9\u30AD\u30E5\u30E1\u30F3\u30C8","window","document"])},ko:{markers:new Set(["\uC5D0\uC11C"]),windowTokens:new Set(["\uCC3D","\uC708\uB3C4\uC6B0","\uBB38\uC11C","window","document"])},tr:{markers:new Set(["den","dan","ten","tan"]),windowTokens:new Set(["pencere","belge","window","document"])},bn:{markers:new Set(["\u09A5\u09C7\u0995\u09C7","\u09AE\u09A7\u09CD\u09AF\u09C7"]),windowTokens:new Set(["\u0989\u0987\u09A8\u09CD\u09A1\u09CB","\u09A1\u0995\u09C1\u09AE\u09C7\u09A8\u09CD\u099F","window","document"])},qu:{markers:new Set(["manta"]),windowTokens:new Set(["k_iri","ventana","window","document"])},hi:{markers:new Set(["\u0938\u0947"]),windowTokens:new Set(["\u0935\u093F\u0902\u0921\u094B","\u0926\u0938\u094D\u0924\u093E\u0935\u0947\u091C\u093C","window","document"])}};ee.CONDITION_COPULAS=new Set(["is","am","are","be","was","were","not","no"]);ee.CONDITION_COPULAS_SURFACE=new Set(["\u0647\u0648","\u0E40\u0E1B\u0E47\u0E19","\u0939\u0948"]);ee.CONDITION_PREDICATES=new Set(["empty","null","undefined"]);ee.CONDITION_OPERATORS=new Set(["matches","match","contains","exists","has","have","equals","includes"]);ee.STANDALONE_MODIFIERS={once:"once",debounced:"debounce",debounce:"debounce",throttled:"throttle",throttle:"throttle"};var Wo=ee,qo=new Wo;function Ko(t,e){return qo.parse(t,e)}function Ho(t,e){try{let r=Z(t,e),i=fe(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=se.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=se.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 ei(t,e){try{let i=Ko(t,e);if(i)return {node:i,confidence:i.metadata?.confidence??.8,error:void 0,tokensConsumed:Z(t,e).tokens.length}}catch{}let r=Ho(t,e);return r.parseSuccess?{node:null,confidence:r.confidence,error:void 0,tokensConsumed:r.tokensConsumed}:{node:null,confidence:0,error:r.error}}function ri(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 Ie(t,e){let r,i;if(t.markerOverride&&t.markerOverride[e.code]!==void 0)r=t.markerOverride[e.code],i=r?he(t,e.code,r):void 0;else {let n=e.roleMarkers[t.role];if(n){r=n.primary;let a=he(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 er(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 $r(t,e,r,i){ii(t,e,r,i,"manner",{requireMarker:true});}function ti(t,e,r,i){ii(t,e,r,i,"recipient",{requireMarker:false});}function ii(t,e,r,i,n,a){let u=r.roles.find(s=>s.role===n&&!s.required);if(!u)return;let o=u.markerOverride?.[i];a.requireMarker&&!o||(t.push({type:"group",optional:true,tokens:[...(o?o.split(/\s+/):[]).map(s=>({type:"literal",value:s})),{type:"role",role:n,optional:true,expectedTypes:u.expectedTypes,...u.valueShape!==void 0?{valueShape:u.valueShape}:{}}]}),e[n]={fromRole:n});}function ni(t){if(t.roles.some(i=>i.role==="patient"))return "patient";let e=t.roles.filter(i=>i.required),r=e.find(i=>i.role===t.primaryRole)??e[0];return !r||r.role==="event"?"patient":r.role}function ai(t,e,r){let i=t.roles.find(c=>c.role===r);if(!i||r==="patient")return [{type:"role",role:r,optional:false}];let{marker:n,alternatives:a}=Ie(i,e),u={type:"role",role:r,optional:false,...i.valueShape!==void 0?{valueShape:i.valueShape}:{}};if(!n)return [u];let o=n.split(/\s+/).filter(Boolean),s={type:"group",optional:true,tokens:o.map(c=>({type:"literal",value:c,...o.length===1&&a?.length?{alternatives:a}:{}}))};return (e.roleMarkers[r]?.position??"before")==="after"?[u,s]:[s,u]}function ui(t,e,r,i,n){for(let a of r.roles)a.required||n.has(a.role)||e[a.role]||!(a.markerOverride?.[i.code]??i.roleMarkers[a.role]?.primary)&&a.valueShape===void 0||(t.push({type:"group",optional:true,tokens:li(a,i)}),e[a.role]=a.default?{fromRole:a.role,default:a.default}:{fromRole:a.role});}function Uo(t,e,r,i,n){let a=[];if(a.push({type:"role",role:"event",optional:false}),i.position==="after"){let f=i.primary.split(/\s+/);if(f.length>1)for(let v of f)a.push({type:"literal",value:v});else {let v=i.alternatives?{type:"literal",value:i.primary,alternatives:i.alternatives}:{type:"literal",value:i.primary};a.push(v);}}let u=ni(t),o=e.roleMarkers.destination,s=t.roles.some(f=>f.role==="destination");o&&s&&u!=="destination"&&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}]});let l=e.roleMarkers.source,c=t.roles.some(f=>f.role==="source");l&&c&&u!=="source"&&a.push({type:"group",optional:true,tokens:[{type:"role",role:"source",optional:true},l.alternatives?{type:"literal",value:l.primary,alternatives:l.alternatives}:{type:"literal",value:l.primary}]}),a.push(...ai(t,e,u));let m=e.roleMarkers.patient;if(m&&u==="patient"){let f=m.alternatives?{type:"literal",value:m.primary,alternatives:m.alternatives}:{type:"literal",value:m.primary};a.push(f);}let d=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};a.push(d),u!=="source"&&a.push(...De(t,e.roleMarkers.source)),u!=="destination"&&a.push(...Rr(t,e.roleMarkers.destination));let p={action:{value:t.action},event:{fromRole:"event"},[u]:{fromRole:u},...u==="destination"?{}:be(t),...u==="source"?{}:Ae(t)};return ui(a,p,t,e,new Set(["event",u,"destination","source"])),{id:`${t.action}-event-${e.code}-sov`,language:e.code,command:"on",priority:(n.basePriority??100)+50,template:{format:`{event} ${i.primary} {destination?} {${u}} ${m?.primary||""} ${r.primary}`,tokens:a},extraction:p}}function Go(t,e,r,i,n){let a=[],u=t.action==="swap",o=u?"destination":"patient";a.push({type:"role",role:o,optional:false});let s=e.roleMarkers.patient;if(s){let d=s.alternatives?{type:"literal",value:s.primary,alternatives:s.alternatives}:{type:"literal",value:s.primary};a.push(d);}if(a.push({type:"role",role:"event",optional:false}),i.position==="after"){let d=i.primary.split(/\s+/);if(d.length>1)for(let p of d)a.push({type:"literal",value:p});else {let p=i.alternatives?{type:"literal",value:i.primary,alternatives:i.alternatives}:{type:"literal",value:i.primary};a.push(p);}}let l=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};a.push(l),a.push(...De(t,e.roleMarkers.source));let c=e.roleMarkers.destination;if(u&&c){let d=t.roles.find(p=>p.role==="patient")?.markerOverride?.[e.code];if(d&&d!==c.primary){let p=c.alternatives??[];p.includes(d)||(c={...c,alternatives:[...p,d]});}}a.push(...u?En(t,c):Rr(t,c));let m={action:{value:t.action},event:{fromRole:"event"},[o]:{fromRole:o},...u?{}:be(t),...Ae(t)};return ti(a,m,t,e.code),$r(a,m,t,e.code),{id:`${t.action}-event-${e.code}-sov-patient-first`,language:e.code,command:"on",priority:(n.basePriority??100)+45,template:{format:`{patient} ${s?.primary||""} {event} ${i.primary} ${r.primary}`,tokens:a},extraction:m}}function Yo(t,e,r,i,n){let a=t.roles.find(m=>m.role==="source");if(!a)return null;let{marker:u,alternatives:o}=Ie(a,e),s=e.roleMarkers.patient;if(!u||u===i.primary||u===s?.primary)return null;let l=[];l.push({type:"role",role:"patient",optional:false}),s&&l.push(s.alternatives?{type:"literal",value:s.primary,alternatives:s.alternatives}:{type:"literal",value:s.primary}),l.push({type:"role",role:"source",optional:false,...a.expectedTypes?{expectedTypes:a.expectedTypes}:{},...a.valueShape!==void 0?{valueShape:a.valueShape}:{}});for(let m of u.split(/\s+/))l.push(o&&u.split(/\s+/).length===1?{type:"literal",value:m,alternatives:o}:{type:"literal",value:m});if(l.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)l.push({type:"literal",value:d});else l.push(i.alternatives?{type:"literal",value:i.primary,alternatives:i.alternatives}:{type:"literal",value:i.primary});}l.push(r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary});let c={action:{value:t.action},event:{fromRole:"event"},patient:{fromRole:"patient"},source:{fromRole:"source"}};return ti(l,c,t,e.code),$r(l,c,t,e.code),{id:`${t.action}-event-${e.code}-sov-source-fronted`,language:e.code,command:"on",priority:(n.basePriority??100)+48,template:{format:`{patient} ${s?.primary||""} {source} ${u} {event} ${i.primary} ${r.primary}`,tokens:l},extraction:c}}function Zo(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 Jo(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(...De(t,e.roleMarkers.source)),a.push(...Rr(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"},...be(t),...Ae(t)}}}function Xo(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 Qo(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 es(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,f=d.sovPosition??999;return p-f});for(let m of o){a.push({type:"role",role:m.role,optional:false});let{marker:d,alternatives:p}=Ie(m,e);if(d){let f=p?{type:"literal",value:d,alternatives:p}:{type:"literal",value:d};a.push(f);}}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 er(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 rs(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}=Ie(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 er(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 ts(t,e,r,i,n){let a=[],o=[...t.roles.filter(E=>E.required)].sort((E,y)=>{let h=E.sovPosition??999,k=y.sovPosition??999;return h-k}),s=o[0];a.push({type:"role",role:s.role,optional:false});let{marker:l,alternatives:c}=Ie(s,e);if(l){let E=c?{type:"literal",value:l,alternatives:c}:{type:"literal",value:l};a.push(E);}if(a.push({type:"role",role:"event",optional:false}),i.position==="after"){let E=i.primary.split(/\s+/);if(E.length>1)for(let y of E)a.push({type:"literal",value:y});else {let y=i.alternatives?{type:"literal",value:i.primary,alternatives:i.alternatives}:{type:"literal",value:i.primary};a.push(y);}}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:f}=Ie(d,e);if(p){let E=f?{type:"literal",value:p,alternatives:f}:{type:"literal",value:p};a.push(E);}let v={action:{value:t.action},event:{fromRole:"event"},[s.role]:{fromRole:s.role},[d.role]:{fromRole:d.role}};return er(a,v,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:v}}function oi(t,e,r){let i=he(t,e.code,r.primary)??[],n=[...new Set([...r.alternatives??[],...i])].filter(a=>a!==r.primary);return n.length?n:void 0}function zt(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 o=ni(t);a.push(...ai(t,e,o));let s=e.roleMarkers.destination,l=t.roles.some(m=>m.role==="destination");s&&l&&o!=="destination"&&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}]}),o!=="source"&&a.push(...De(t,e.roleMarkers.source));let c={action:{value:t.action},event:{fromRole:"event"},[o]:{fromRole:o},...o==="destination"?{}:be(t),...o==="source"?{}:Ae(t)};return ui(a,c,t,e,new Set(["event",o,"destination","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} {${o}} ${s?.primary||""} {destination?}`,tokens:a},extraction:c}}function is(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 o=t.action==="swap";a.push({type:"role",role:o?"destination":"patient",optional:false});let s=o?void 0:e.roleMarkers.destination;if(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(...De(t,e.roleMarkers.source)),i.position==="before"){let c=i.alternatives?{type:"literal",value:i.primary,alternatives:i.alternatives}:{type:"literal",value:i.primary};a.push(c);}if(a.push({type:"role",role:"event",optional:false}),o){let c=t.roles.find(m=>m.role==="patient")?.markerOverride?.[e.code];c&&a.push({type:"group",optional:true,tokens:[{type:"literal",value:c},{type:"role",role:"patient",optional:false}]});}let l={action:{value:t.action},event:{fromRole:"event"},[o?"destination":"patient"]:{fromRole:o?"destination":"patient"},...o?{}:be(t),...Ae(t)};return $r(a,l,t,e.code),{id:`${t.action}-event-${e.code}-vso-verb-first`,language:e.code,command:"on",priority:(n.basePriority??100)+45,template:{format:`${r.primary} {patient} ${s?.primary||""} {destination?} ${i.primary} {event}`,tokens:a},extraction:l}}function ns(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,f=d.svoPosition??999;return p-f});for(let m of s){let d,p;if(m.markerOverride&&m.markerOverride[e.code]!==void 0)d=m.markerOverride[e.code],p=d?he(m,e.code,d):void 0;else {let f=e.roleMarkers[m.role];f&&(d=f.primary,p=oi(m,e,f));}if(d){let f=p?{type:"literal",value:d,alternatives:p}:{type:"literal",value:d};a.push(f);}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 er(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 kt(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,f=d.svoPosition??999;return p-f});for(let m of s){let d,p;if(m.markerOverride&&m.markerOverride[e.code]!==void 0)d=m.markerOverride[e.code],p=d?he(m,e.code,d):void 0;else {let f=e.roleMarkers[m.role];f&&(d=f.primary,p=oi(m,e,f));}if(d){let f=p?{type:"literal",value:d,alternatives:p}:{type:"literal",value:d};a.push(f);}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 er(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 as(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(...De(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"},...be(t),...Ae(t)}}}function us(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(...De(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"},...be(t),...Ae(t)}}}var Ve={basePriority:100,generateSimpleVariants:true,generateAlternatives:true};function Xe(t,e,r=Ve){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=cs(t,e,a),o=Vr(t,e),s=fs(t,e,a);return {id:i,language:e.code,command:t.action,priority:n,template:{format:s,tokens:u},extraction:o}}function os(t,e,r=Ve){if(t.roles.filter(o=>!o.required).length===0)return null;let n=t.roles.filter(o=>o.required),a={...t,roles:n};return {...Xe(a,e,r),id:`${t.action}-${e.code}-generated-simple`,priority:(r.basePriority??100)-5,extraction:Vr(t,e)}}function wt(t,e,r=Ve){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:Vr(t,e)}}function ss(t,e,r=Ve){let i=[];if(i.push(Xe(t,e,r)),r.generateSimpleVariants){let n=os(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=Xe(a,e,r);i.push({...u,id:`${t.action}-${e.code}-generated-no-${n}`,priority:(r.basePriority??100)-8});}for(let n of t.widenTypeVariants??[]){if(n.excludeLanguages?.includes(e.code))continue;let a={...t,roles:t.roles.map(o=>o.role===n.role?{...o,expectedTypes:[...n.types]}:o)},u=Xe(a,e,r);i.push({...u,id:`${t.action}-${e.code}-generated-${n.idSuffix}`,priority:(r.basePriority??100)-(n.priorityDelta??15)});}if(r.generateVerbFirstVariants!==false){let n=wt(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=Xe(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=wt(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 si(t,e=Ve){let r=[],i=Ma();for(let n of i){if(!t.keywords[n.action])continue;let a=ss(n,t,e);if(r.push(...a),t.eventHandler?.eventMarker){let u=ls(n,t,e);r.push(...u);}}return r}function ls(t,e,r=Ve){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 [];if(t.action==="js")return [];let o=t.roles.filter(s=>s.required).length===2;if(e.wordOrder==="SOV")if(o)i.push(es(t,e,a,n,r)),i.push(ts(t,e,a,n,r)),i.push(rs(t,e,a,n,r));else {i.push(Uo(t,e,a,n,r)),i.push(Go(t,e,a,n,r));let s=Yo(t,e,a,n,r);s&&i.push(s);let l=e.roleMarkers.destination;l&&l.primary!==n.primary&&i.push(Zo(t,e,a,n,r));let c=n.primary.split(/\s+/),m=n.alternatives?.some(p=>!p.includes(" ")&&p.length>1);c.length>1&&m&&i.push(Jo(t,e,a,n,r)),i.push(Xo(t,e,a,n,r));let d=Qo(t,e,a,r);d&&i.push(d);}else e.wordOrder==="VSO"?o?(i.push(kt(t,e,a,n,r)),i.push(ns(t,e,a,n,r))):(i.push(zt(t,e,a,n,r)),i.push(is(t,e,a,n,r)),e.eventHandler?.negationMarker&&i.push(as(t,e,a,n,r)),e.tokenization?.prefixes&&i.push(us(t,e,a,r))):o?i.push(kt(t,e,a,n,r)):i.push(zt(t,e,a,n,r));return i}function cs(t,e,r){let i=[],n=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary},a=ds(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 ms(i)}function ms(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 ds(t,e){let r=[],i=ri(t.roles,e.wordOrder);for(let n of i){let a=li(n,e);n.required?r.push(...a):r.push({type:"group",optional:true,tokens:a});}return r}function li(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,...t.valueShape!==void 0?{valueShape:t.valueShape}:{}},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=i!==void 0&&i===t.markerOverride?.en,m=n?.position??(e.wordOrder==="SOV"&&!c?"after":"before"),d=t.markerOptional?.[e.code]===true,p=f=>{let v=l.length===1?he(t,e.code,f)??[]:[],E={type:"literal",value:f,...v.length?{alternatives:v}:{},...a?{renderSuppress:true}:{}};r.push(d?{type:"group",optional:true,tokens:[E]}:E);};if(m==="before"){for(let f of l)p(f);s();}else {s();for(let f of l)p(f);}}else if(n){let l=()=>{let m=[...new Set([...n.alternatives??[],...he(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=>{if(!e.markersOptional&&!t.markerOptional?.[e.code]){r.push(m);return}r.push({type:"group",optional:true,...e.markersOptional&&!t.markerOptional?.[e.code]?{renderRequired:true}:{},tokens:[m]});};n.position==="before"?(n.primary&&c(l()),s()):(s(),c(l()));}else s();return r}function ps(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())?he(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??[],...he(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 Vr(t,e){let r=ps(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 fs(t,e,r){let i=[],a=ri(t.roles,e.wordOrder).map(u=>{let o=Eu(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 ys=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 ys;function hs(t){return /[\u0430-\u044f\u0410-\u042f\u0451\u0401]/.test(t)}function vs(t){for(let e of t)if(hs(e))return true;return false}var ci=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"]]),di=class{constructor(){this.language="ru";}isNormalizable(t){return t.length<3?false:vs(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 re(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||re(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 re(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 x(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 re(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||re(t)}tryImperativeLookup(t){return ci.has(t)?x(ci.get(t),.95,{removedSuffixes:["imperative"],conjugationType:"imperative"}):null}tryGenericImperativeNormalization(t){return t.endsWith("\u0439\u0442\u0435")&&t.length>5?x(t.slice(0,-3)+"\u0442\u044C",.8,{removedSuffixes:["\u0439\u0442\u0435"],conjugationType:"imperative"}):t.endsWith("\u0438\u0442\u0435")&&t.length>5?x(t.slice(0,-3)+"\u0438\u0442\u044C",.8,{removedSuffixes:["\u0438\u0442\u0435"],conjugationType:"imperative"}):t.endsWith("\u0439")&&t.length>3?x(t.slice(0,-1)+"\u0442\u044C",.75,{removedSuffixes:["\u0439"],conjugationType:"imperative"}):t.endsWith("\u0438")&&t.length>3?x(t+"\u0442\u044C",.7,{removedSuffixes:["\u0438\u2192\u0438\u0442\u044C"],conjugationType:"imperative"}):null}tryPastTenseNormalization(t){return t.endsWith("\u0430\u043B\u0430")&&t.length>4?x(t.slice(0,-3)+"\u0430\u0442\u044C",.85,{removedSuffixes:["\u0430\u043B\u0430"],conjugationType:"past"}):t.endsWith("\u0438\u043B\u0430")&&t.length>4?x(t.slice(0,-3)+"\u0438\u0442\u044C",.85,{removedSuffixes:["\u0438\u043B\u0430"],conjugationType:"past"}):t.endsWith("\u0435\u043B\u043E")&&t.length>4?x(t.slice(0,-3)+"\u0435\u0442\u044C",.82,{removedSuffixes:["\u0435\u043B\u043E"],conjugationType:"past"}):t.endsWith("\u0430\u0431\u043E")&&t.length>4?x(t.slice(0,-3)+"\u0430\u0442\u044C",.82,{removedSuffixes:["\u0430\u0431\u043E"],conjugationType:"past"}):t.endsWith("\u0430\u043B\u0438")&&t.length>4?x(t.slice(0,-3)+"\u0430\u0442\u044C",.85,{removedSuffixes:["\u0430\u043B\u0438"],conjugationType:"past"}):t.endsWith("\u0438\u043B\u0438")&&t.length>4?x(t.slice(0,-3)+"\u0438\u0442\u044C",.85,{removedSuffixes:["\u0438\u043B\u0438"],conjugationType:"past"}):t.endsWith("\u0430\u043B")&&t.length>3?x(t.slice(0,-2)+"\u0430\u0442\u044C",.82,{removedSuffixes:["\u0430\u043B"],conjugationType:"past"}):t.endsWith("\u0438\u043B")&&t.length>3?x(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?x(t.slice(0,-3)+"\u0438\u0442\u044C",.8,{removedSuffixes:["\u0438\u0448\u044C"],conjugationType:"present"}):t.endsWith("\u0438\u0442")&&t.length>3?x(t.slice(0,-2)+"\u0438\u0442\u044C",.78,{removedSuffixes:["\u0438\u0442"],conjugationType:"present"}):t.endsWith("\u0438\u043C")&&t.length>3?x(t.slice(0,-2)+"\u0438\u0442\u044C",.78,{removedSuffixes:["\u0438\u043C"],conjugationType:"present"}):t.endsWith("\u044F\u0442")&&t.length>3?x(t.slice(0,-2)+"\u0438\u0442\u044C",.78,{removedSuffixes:["\u044F\u0442"],conjugationType:"present"}):t.endsWith("\u0435\u0448\u044C")&&t.length>4?x(t.slice(0,-3)+"\u0430\u0442\u044C",.75,{removedSuffixes:["\u0435\u0448\u044C"],conjugationType:"present"}):t.endsWith("\u0435\u0442")&&t.length>3?x(t.slice(0,-2)+"\u0430\u0442\u044C",.72,{removedSuffixes:["\u0435\u0442"],conjugationType:"present"}):t.endsWith("\u0435\u043C")&&t.length>3?x(t.slice(0,-2)+"\u0430\u0442\u044C",.72,{removedSuffixes:["\u0435\u043C"],conjugationType:"present"}):t.endsWith("\u044E\u0442")&&t.length>3?x(t.slice(0,-2)+"\u0430\u0442\u044C",.75,{removedSuffixes:["\u044E\u0442"],conjugationType:"present"}):t.endsWith("\u0443\u0442")&&t.length>3?x(t.slice(0,-2)+"\u0430\u0442\u044C",.72,{removedSuffixes:["\u0443\u0442"],conjugationType:"present"}):null}},pi={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\u043F\u0438\u0441\u0430\u0442\u044C",alternatives:["\u0434\u043E\u0431\u0430\u0432\u0438\u0442\u044C \u0432 \u043A\u043E\u043D\u0435\u0446","\u0434\u043E\u0431\u0430\u0432\u0438\u0442\u044C_\u0432_\u043A\u043E\u043D\u0435\u0446"],normalized:"append",form:"infinitive"},prepend:{primary:"\u0434\u043E\u0431\u0430\u0432\u0438\u0442\u044C \u0432 \u043D\u0430\u0447\u0430\u043B\u043E",alternatives:["\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"},changes:{primary:"\u0438\u0437\u043C\u0435\u043D\u044F\u0435\u0442\u0441\u044F",normalized:"changes"},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"]}},Es=["===","!==","->","==","!=","<=",">=","&&","||","**","+=","-=","*=","/=","+","-","*","/","=",">","<","!","&","|","%","^","~"],gs=class{constructor(t=Es){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}},zs="()[]{},:;",ks=class{constructor(t=zs){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 Wr(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 mi(t,e){let r=t[e];if(r==="#"){let i=t.slice(e).match(/^#[a-zA-Z_][\w-]*/);if(!i)return null;let n=Wr(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=Wr(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=Wr(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 ws=class{constructor(){this.name="css-selector";}canExtract(t,e){let r=t[e];return r==="#"||r==="."||r==="["||r==="<"?true:r==="@"||r==="*"?mi(t,e)!==null:false}extract(t,e){let r=mi(t,e);return r?{value:r,length:r.length,metadata:{type:"css-selector"}}:null}},Cs=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}}}},bs=["http://","https://","//","./","../","/"];function As(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 Ds(t,e){let r=t.slice(e),i=bs.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=As(r,n+2);if(u!==-1){n=u;continue}}if(/\s/.test(a))break;n++;}return r.slice(0,n)}var Ss=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=Ds(t,e);return r?{value:r,length:r.length,metadata:{type:"url"}}:null}},xs=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 Bs(t){return {isLetter:i=>t.test(i),isIdentifierChar:i=>/[0-9_]/.test(i)||t.test(i)}}var Fs=class{constructor(t,e,r){this.name=t;let i=Bs(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}}}},Ts=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 Rs(){return [new Fs("russian-keyword",/[a-zA-Z\u0430-\u044f\u0410-\u042f\u0451\u0401]/,Ts)]}function Os(t){let e=t.charCodeAt(0);return e>=65&&e<=90||e>=97&&e<=122||e===95||e===36}function Ps(t){let e=t.charCodeAt(0);return e>=48&&e<=57||e>=65&&e<=90||e>=97&&e<=122||e===95||e===36}var Ns=class{constructor(){this.name="ascii-identifier";}setContext(t){this.context=t;}canExtract(t,e){return Os(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&&Ps(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 Ls(){return [new Ss,new Cs,new xs,new ws]}var Ms=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"]),_s=[{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"}],Is=class extends Te{constructor(){super(),this.language="ru",this.direction="ltr",this.initializeKeywordsFromProfile(pi,_s),this.setNormalizer(new di),this.registerExtractors([...Ls(),...Rs(),new Be,new Fe,new Ns,new gs,new ks]);}classifyToken(t){let e=t.toLowerCase();return Ms.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"}},js=new Is;je("ru",js,pi);var hi={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"},changes:{primary:"zmienia",normalized:"changes"},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:"zmiana rozmiaru",alternatives:["zmie\u0144 rozmiar","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"]}},fi=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"]]),vi=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 re(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||re(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 fi.has(t)?x(fi.get(t),.95,{removedSuffixes:["imperative"],conjugationType:"imperative"}):t.endsWith("aj")?x(t.slice(0,-2)+"a\u0107",.8,{removedSuffixes:["aj"],conjugationType:"imperative"}):t.endsWith("uj")?x(t.slice(0,-2)+"owa\u0107",.8,{removedSuffixes:["uj"],conjugationType:"imperative"}):t.endsWith("ij")?x(t.slice(0,-2)+"i\u0107",.75,{removedSuffixes:["ij"],conjugationType:"imperative"}):null}tryPresentTenseNormalization(t){return t.endsWith("uj\u0119")||t.endsWith("uje")?x(t.slice(0,-3)+"owa\u0107",.85,{removedSuffixes:["uj\u0119"],conjugationType:"present"}):t.endsWith("am")&&t.length>3?x(t.slice(0,-2)+"a\u0107",.8,{removedSuffixes:["am"],conjugationType:"present"}):t.endsWith("em")&&t.length>3?x(t.slice(0,-2)+"e\u0107",.75,{removedSuffixes:["em"],conjugationType:"present"}):t.endsWith("\u0119")&&t.length>2?x(t.slice(0,-1)+"a\u0107",.7,{removedSuffixes:["\u0119"],conjugationType:"present"}):null}tryPastTenseNormalization(t){if(t.endsWith("a\u0142em")||t.endsWith("a\u0142am"))return x(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 x(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 x(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 x(t.slice(0,-e)+"i\u0107",.8,{removedSuffixes:[t.slice(-e)],conjugationType:"past"})}return null}},$s=["===","!==","->","==","!=","<=",">=","&&","||","**","+=","-=","*=","/=","+","-","*","/","=",">","<","!","&","|","%","^","~"],Vs=class{constructor(t=$s){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}},Ws="()[]{},:;",qs=class{constructor(t=Ws){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 qr(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 yi(t,e){let r=t[e];if(r==="#"){let i=t.slice(e).match(/^#[a-zA-Z_][\w-]*/);if(!i)return null;let n=qr(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=qr(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=qr(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 Ks=class{constructor(){this.name="css-selector";}canExtract(t,e){let r=t[e];return r==="#"||r==="."||r==="["||r==="<"?true:r==="@"||r==="*"?yi(t,e)!==null:false}extract(t,e){let r=yi(t,e);return r?{value:r,length:r.length,metadata:{type:"css-selector"}}:null}},Hs=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}}}},Us=["http://","https://","//","./","../","/"];function Gs(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 Ys(t,e){let r=t.slice(e),i=Us.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=Gs(r,n+2);if(u!==-1){n=u;continue}}if(/\s/.test(a))break;n++;}return r.slice(0,n)}var Zs=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=Ys(t,e);return r?{value:r,length:r.length,metadata:{type:"url"}}:null}},Js=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"}}}},Xs=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 Qs(){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:e0,isIdentifierChar:r0}=Qs(),t0=class{constructor(){this.name="polish-keyword";}setContext(t){this.context=t;}canExtract(t,e){return e0(t[e])}extract(t,e){if(!this.context)throw new Error("PolishKeywordExtractor: context not set");let r=e,i="";for(;r<t.length&&r0(t[r]);)i+=t[r++];if(!i)return null;let n=i.toLowerCase(),a=Xs.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 i0(){return [new t0]}function n0(){return [new Zs,new Hs,new Js,new Ks]}var a0=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"]),u0=[{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"}],o0=class extends Te{constructor(){super(),this.language="pl",this.direction="ltr",this.initializeKeywordsFromProfile(hi,u0),this.setNormalizer(new vi),this.registerExtractors(n0()),this.registerExtractor(new Be),this.registerExtractor(new Fe),this.registerExtractors(i0()),this.registerExtractor(new Vs),this.registerExtractor(new qs);}classifyToken(t){let e=t.toLowerCase();return a0.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"}},s0=new o0;je("pl",s0,hi);function l0(t){return /[\u0430-\u044f\u0410-\u042f\u0456\u0406\u0457\u0407\u0454\u0404\u0491\u0490\u044c\u042c']/.test(t)}var Ei=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"]]),zi=class{constructor(){this.language="uk";}isNormalizable(t){return t.length<3?false:l0(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 re(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||re(t)}tryReflexiveNormalization(t){let e=t.slice(0,-2);if(t.endsWith("\u0442\u0438\u0441\u044F")||t.endsWith("\u0447\u0438\u0441\u044F"))return re(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 x(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 re(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||re(t)}tryImperativeLookup(t){return Ei.has(t)?x(Ei.get(t),.95,{removedSuffixes:["imperative"],conjugationType:"imperative"}):null}tryGenericImperativeNormalization(t){return t.endsWith("\u0439\u0442\u0435")&&t.length>5?x(t.slice(0,-3)+"\u0442\u0438",.8,{removedSuffixes:["\u0439\u0442\u0435"],conjugationType:"imperative"}):t.endsWith("\u0456\u0442\u044C")&&t.length>5?x(t.slice(0,-3)+"\u0438\u0442\u0438",.8,{removedSuffixes:["\u0456\u0442\u044C"],conjugationType:"imperative"}):t.endsWith("\u0439")&&t.length>3?x(t.slice(0,-1)+"\u0442\u0438",.75,{removedSuffixes:["\u0439"],conjugationType:"imperative"}):t.endsWith("\u0438")&&t.length>3?x(t+"\u0442\u0438",.7,{removedSuffixes:["\u0438\u2192\u0438\u0442\u0438"],conjugationType:"imperative"}):null}tryPastTenseNormalization(t){return t.endsWith("\u0430\u043B\u0430")&&t.length>4?x(t.slice(0,-3)+"\u0430\u0442\u0438",.85,{removedSuffixes:["\u0430\u043B\u0430"],conjugationType:"past"}):t.endsWith("\u0438\u043B\u0430")&&t.length>4?x(t.slice(0,-3)+"\u0438\u0442\u0438",.85,{removedSuffixes:["\u0438\u043B\u0430"],conjugationType:"past"}):t.endsWith("\u0430\u043B\u0438")&&t.length>4?x(t.slice(0,-3)+"\u0430\u0442\u0438",.85,{removedSuffixes:["\u0430\u043B\u0438"],conjugationType:"past"}):t.endsWith("\u0438\u043B\u0438")&&t.length>4?x(t.slice(0,-3)+"\u0438\u0442\u0438",.85,{removedSuffixes:["\u0438\u043B\u0438"],conjugationType:"past"}):t.endsWith("\u0430\u0432")&&t.length>3?x(t.slice(0,-2)+"\u0430\u0442\u0438",.82,{removedSuffixes:["\u0430\u0432"],conjugationType:"past"}):t.endsWith("\u0438\u0432")&&t.length>3?x(t.slice(0,-2)+"\u0438\u0442\u0438",.82,{removedSuffixes:["\u0438\u0432"],conjugationType:"past"}):null}tryPresentTenseNormalization(t){return t.endsWith("\u0438\u0448")&&t.length>3?x(t.slice(0,-2)+"\u0438\u0442\u0438",.8,{removedSuffixes:["\u0438\u0448"],conjugationType:"present"}):t.endsWith("\u0438\u0442\u044C")&&t.length>4?x(t.slice(0,-3)+"\u0438\u0442\u0438",.78,{removedSuffixes:["\u0438\u0442\u044C"],conjugationType:"present"}):t.endsWith("\u0438\u043C\u043E")&&t.length>4?x(t.slice(0,-3)+"\u0438\u0442\u0438",.8,{removedSuffixes:["\u0438\u043C\u043E"],conjugationType:"present"}):t.endsWith("\u044F\u0442\u044C")&&t.length>4?x(t.slice(0,-3)+"\u0438\u0442\u0438",.78,{removedSuffixes:["\u044F\u0442\u044C"],conjugationType:"present"}):t.endsWith("\u0454\u0448")&&t.length>3?x(t.slice(0,-2)+"\u0430\u0442\u0438",.78,{removedSuffixes:["\u0454\u0448"],conjugationType:"present"}):t.endsWith("\u0435\u0448")&&t.length>3?x(t.slice(0,-2)+"\u0430\u0442\u0438",.75,{removedSuffixes:["\u0435\u0448"],conjugationType:"present"}):t.endsWith("\u0454")&&t.length>2?x(t.slice(0,-1)+"\u0430\u0442\u0438",.72,{removedSuffixes:["\u0454"],conjugationType:"present"}):t.endsWith("\u0454\u043C\u043E")&&t.length>4?x(t.slice(0,-3)+"\u0430\u0442\u0438",.8,{removedSuffixes:["\u0454\u043C\u043E"],conjugationType:"present"}):t.endsWith("\u044E\u0442\u044C")&&t.length>4?x(t.slice(0,-3)+"\u0430\u0442\u0438",.78,{removedSuffixes:["\u044E\u0442\u044C"],conjugationType:"present"}):t.endsWith("\u0443\u0442\u044C")&&t.length>4?x(t.slice(0,-3)+"\u0430\u0442\u0438",.75,{removedSuffixes:["\u0443\u0442\u044C"],conjugationType:"present"}):null}},ki={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\u043F\u0438\u0441\u0430\u0442\u0438",alternatives:["\u0434\u043E\u0434\u0430\u0442\u0438 \u0432 \u043A\u0456\u043D\u0435\u0446\u044C","\u0434\u043E\u0434\u0430\u0442\u0438_\u0432_\u043A\u0456\u043D\u0435\u0446\u044C"],normalized:"append",form:"infinitive"},prepend:{primary:"\u0434\u043E\u0434\u0430\u0442\u0438 \u043D\u0430 \u043F\u043E\u0447\u0430\u0442\u043E\u043A",alternatives:["\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"},changes:{primary:"\u0437\u043C\u0456\u043D\u044E\u0454\u0442\u044C\u0441\u044F",normalized:"changes"},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"]}},c0=["===","!==","->","==","!=","<=",">=","&&","||","**","+=","-=","*=","/=","+","-","*","/","=",">","<","!","&","|","%","^","~"],m0=class{constructor(t=c0){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}},d0="()[]{},:;",p0=class{constructor(t=d0){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 Kr(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 gi(t,e){let r=t[e];if(r==="#"){let i=t.slice(e).match(/^#[a-zA-Z_][\w-]*/);if(!i)return null;let n=Kr(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=Kr(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=Kr(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 f0=class{constructor(){this.name="css-selector";}canExtract(t,e){let r=t[e];return r==="#"||r==="."||r==="["||r==="<"?true:r==="@"||r==="*"?gi(t,e)!==null:false}extract(t,e){let r=gi(t,e);return r?{value:r,length:r.length,metadata:{type:"css-selector"}}:null}},y0=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}}}},h0=["http://","https://","//","./","../","/"];function v0(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 E0(t,e){let r=t.slice(e),i=h0.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=v0(r,n+2);if(u!==-1){n=u;continue}}if(/\s/.test(a))break;n++;}return r.slice(0,n)}var g0=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=E0(t,e);return r?{value:r,length:r.length,metadata:{type:"url"}}:null}},z0=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 k0(t){return {isLetter:i=>t.test(i),isIdentifierChar:i=>/[0-9_]/.test(i)||t.test(i)}}var w0=class{constructor(t,e,r){this.name=t;let i=k0(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}}}},C0=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 b0(){return [new w0("ukrainian-keyword",/[a-zA-Z\u0430-\u044f\u0410-\u042f\u0456\u0406\u0457\u0407\u0454\u0404\u0491\u0490\u044c\u042c']/,C0)]}function A0(t){let e=t.charCodeAt(0);return e>=65&&e<=90||e>=97&&e<=122||e===95||e===36}function D0(t){let e=t.charCodeAt(0);return e>=48&&e<=57||e>=65&&e<=90||e>=97&&e<=122||e===95||e===36}var S0=class{constructor(){this.name="ascii-identifier";}setContext(t){this.context=t;}canExtract(t,e){return A0(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&&D0(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 x0(){return [new g0,new y0,new z0,new f0]}var B0=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"]),F0=[{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"}],T0=class extends Te{constructor(){super(),this.language="uk",this.direction="ltr",this.initializeKeywordsFromProfile(ki,F0),this.setNormalizer(new zi),this.registerExtractors([...x0(),...b0(),new Be,new Fe,new S0,new m0,new p0]);}classifyToken(t){let e=t.toLowerCase();return B0.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"}},R0=new T0;je("uk",R0,ki);function fr(t){let e=t.getAttribute("data-lang");if(e)return pr(e);let r=t.getAttribute("data-hyperscript-lang")??t.closest?.("[data-hyperscript-lang]")?.getAttribute("data-hyperscript-lang");if(r)return pr(r);let i=t.closest?.("[lang]")?.getAttribute("lang");if(i)return pr(i);let n=typeof document<"u"?document.documentElement?.lang:null;return n&&n!=="en"?pr(n):null}function pr(t){return t.split("-")[0].toLowerCase()}var wi={add:[["patient",""],["destination","to"]],append:[["patient",""],["destination","to"]],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"],["manner","using view"]],on:[["event",""],["source","from"]],open:[["patient",""],["style","as"]],pick:[["patient",""],["source","from"]],prepend:[["patient",""],["destination","to"]],process:[["patient","partials in"],["manner","using view"]],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"],["manner","using view"]],take:[["patient",""],["source","from"],["recipient","for"]],tell:[["destination",""]],throw:[["patient",""]],toggle:[["patient",""],["destination","on"],["duration","for"]],transition:[["patient",""],["goal","to"],["destination","on"],["duration","over"],["style","with"]],trigger:[["event",""],["destination","on"]],unless:[["condition",""]],wait:[["duration",""]],when:[["condition",""]],while:[["condition",""]],worker:[]};var O0=new Set(["repeat","for","while","tell"]),P0=new Set(["js"]);function yr(t){switch(t.kind){case "event-handler":return N0(t);case "compound":return L0(t);default:return M0(t)}}function N0(t){let e=["on"],r=t.roles.get("event");r&&e.push(r.type==="literal"?String(r.value):rr(r));let i=t.roles.get("source");if(i&&e.push("from",rr(i)),t.body&&t.body.length>0){let n=t.body.map(yr);e.push(n.join(" "));}return e.join(" ")}function L0(t){let e=t.chainType==="async"?"async":t.chainType,r=t.statements.map(yr),i=r[0]??"";for(let n=1;n<r.length;n++){let a=t.statements[n-1],u=t.statements[n],o=a.kind==="command"&&O0.has(a.action),s=a.kind==="command"&&a.action==="bind"&&u.kind==="command"&&u.action==="bind";a.kind==="command"&&P0.has(a.action)&&(i+=" end"),i+=(o||s?" ":` ${e} `)+r[n];}return i}function M0(t){let e=wi[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(rr(u))));}return i.join(" ")}let r=[t.action];for(let[,i]of t.roles)r.push(rr(i));return r.join(" ")}function rr(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 _0(t);case "expression":return t.raw;case "flag":return t.enabled?`+${t.name}`:`~${t.name}`}}function _0(t){let e=rr(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 I0={confidenceThreshold:.5,strategy:"semantic"};function j0(t,e){return typeof t=="number"?t:t[e]??t["*"]??.5}var $0=/^(on\s+(?:every\s+)?[\w-]+(?:\[.*?\])?(?:\.[\w-]+(?:\([^)]*\))?)*(?:\s+from\s+\S+)?(?:\s+queue\s+\w+)?\s+)/;function V0(t){let e=t.match($0);if(!e)return null;let r=e[1],i=t.slice(r.length);return i?{prefix:r,commands:i}:null}function Ci(t){function e(n,a,u){try{return t.isLanguageRegistered(a)?t.translateSingle(n,a,u):null}catch{return null}}function r(n,a,u){try{let o=u(n,a);return o!==n?o:null}catch{return null}}function i(n,a,u){if(u.strategy==="semantic"||u.strategy==="auto"){let o=j0(u.confidenceThreshold,a),s=e(n,a,o);if(s!==null)return s}if((u.strategy==="auto"||u.strategy==="i18n")&&u.i18nToEnglish){let o=r(n,a,u.i18nToEnglish);if(o!==null)return o}return null}return function(a,u,o={}){if(u==="en")return a;let s={...I0,...o},l=i(a,u,s);if(l!==null)return l;let c=V0(a);if(c){let m=i(c.commands,u,s);if(m!==null)return c.prefix+m}return a}}var Hr=Ci({isLanguageRegistered:Ot,translateSingle(t,e,r){let i=ei(t,e);return i.confidence<r||!i.node?null:yr(i.node)}});var Ur=new WeakSet;function W0(t){return (t.config?.attributes??"_, script, data-script").split(",").map(r=>r.trim()).filter(Boolean)}function q0(t,e){for(let r of e)if(t.hasAttribute(r))return r;return null}function bi(t,e){if(typeof t.addBeforeProcessHook!="function"){console.warn("[hyperscript-i18n] _hyperscript.addBeforeProcessHook is unavailable \u2014 this build of _hyperscript.org is not supported. Load a current version from https://unpkg.com/hyperscript.org.");return}let r=W0(t),i=[...r.map(a=>`[${a}]`),'script[type="text/hyperscript"]'].join(", "),n=a=>{if(Ur.has(a))return;if(a instanceof HTMLScriptElement&&a.type==="text/hyperscript"){let l=a.textContent??"";if(!l)return;let c=e(l,a);Ur.add(a),c!=null&&c!==l&&(a.textContent=c);return}let u=q0(a,r);if(!u)return;let o=a.getAttribute(u);if(!o)return;let s=e(o,a);Ur.add(a),s!=null&&s!==o&&a.setAttribute(u,s);};t.addBeforeProcessHook(a=>{!a||typeof a.querySelectorAll!="function"||(typeof a.matches=="function"&&a.matches(i)&&n(a),a.querySelectorAll(i).forEach(n));});}function Di(t,e){if(typeof t.parse!="function")return true;try{let r=t.parse(e);return !r?.errors||r.errors.length===0}catch{return false}}var Ai=new Set;function Si(t,e,r){Ai.has(t)||(Ai.add(t),console.warn(`[hyperscript-i18n] Translation for lang="${t}" rendered hyperscript the host parser rejects \u2014 falling back to the original text. Source: "${e.length>60?e.slice(0,60)+"\u2026":e}" \u2192 "${r.length>60?r.slice(0,60)+"\u2026":r}". Further elements in this language stay quiet \u2014 enable { debug: true } for per-element detail.`));}function Gr(t={}){return function(r){let i=r;bi(i,(n,a)=>{let u=K0(a,t);if(!u||u==="en")return n;let o=Hr(n,u,t);if(o!==n){if(t.validateWithHost!==false&&!Di(i,o))return t.debug?console.log(`[hyperscript-i18n] ${u}: host rejected "${o}" \u2014 keeping "${n}"`):Si(u,n,o),n;t.debug&&console.log(`[hyperscript-i18n] ${u}: "${n}" \u2192 "${o}"`);}return o});}}function K0(t,e){if(e.languageAttribute){let i=t.getAttribute(e.languageAttribute);if(i)return i.split("-")[0].toLowerCase()}let r=fr(t);return r||(e.defaultLanguage??null)}function xi(t,e,r={}){return e==="en"?t:Hr(t,e,r)}Rt(t=>si(t));function Bi(){typeof _hyperscript<"u"&&_hyperscript.use&&_hyperscript.use(Gr());}var a4=["ru","pl","uk"];Bi();
|
|
5
|
-
exports.plugin=Gr;exports.preprocess=xi;exports.resolveLanguage=fr;exports.supportedLanguages=a4;return exports;})({});
|
|
1
|
+
var HyperscriptI18n=(function(exports){'use strict';function Se(r,e){return e?{type:"literal",value:r,dataType:e}:{type:"literal",value:r}}function Or(r,e){return e?{type:"selector",value:r,selectorKind:e}:{type:"selector",value:r}}function fr(r){return {type:"reference",value:r}}function Rr(r,e){return {type:"property-path",object:r,property:e}}var Kt=new Set(["me","you","it","result","event","target","body","document","window","detail"]);function nt(r,e=Kt){return e.has(r)}var za=class{constructor(r){this.namespace=r,this.enabled=this.checkEnabled();}checkEnabled(){if(typeof process<"u"&&process.env){let r=process.env.DEBUG||"";return r==="*"||r.includes("framework:*")||r.includes(`framework:${this.namespace}`)}return false}log(r,e,...t){if(!this.enabled)return;let i=`[framework:${this.namespace}]`,n=new Date().toISOString();switch(r){case "debug":console.debug(`${n} ${i} DEBUG:`,e,...t);break;case "info":console.info(`${n} ${i} INFO:`,e,...t);break;case "warn":console.warn(`${n} ${i} WARN:`,e,...t);break;case "error":console.error(`${n} ${i} ERROR:`,e,...t);break}}debug(r,...e){this.log("debug",r,...e);}info(r,...e){this.log("info",r,...e);}warn(r,...e){this.log("warn",r,...e);}error(r,...e){this.log("error",r,...e);}isEnabled(){return this.enabled}enable(){this.enabled=true;}disable(){this.enabled=false;}};function wa(r){return new za(r)}function Ze(r,e){return !e||e.length===0||e.includes(r)||e.includes("expression")?true:r==="property-path"?e.some(t=>["selector","reference","expression"].includes(t)):false}function ka(r,e){return r?.possessive?.keywords?.[e]}var hr=class Xe{constructor(){this.logger=wa("pattern-matcher"),this.stemMatchCount=0,this.totalKeywordMatches=0;}safeToLowerCase(e){return typeof e=="string"?e.toLowerCase():e==null?"":String(e).toLowerCase()}matchPattern(e,t,i){let n=e.mark(),a=new Map;if(this.logger.debug("========================================"),this.logger.debug("matchPattern ENTRY"),this.logger.debug("Pattern ID:",t.id),this.logger.debug("Pattern command:",t.command),this.logger.debug("Pattern language:",t.language),this.logger.debug("Pattern template:",JSON.stringify(t.template,null,2)),this.logger.isEnabled()){let s=[];for(let l=0;l<10;l++){let 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(t.template.tokens,null,2));let u=this.matchTokenSequence(e,t.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(t,a);return this.applyExtractionRules(t,a),{pattern:t,captured:a,consumedTokens:e.position()-n.position,confidence:o}}matchBest(e,t,i){let n=[];for(let u of t){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,t,i,n){let a=t[0],u=a?.type==="literal"&&(a.value==="and"||a.value==="then"||a.alternatives?.includes("and")||a.alternatives?.includes("then"));if(this.currentProfile?.code==="ar"&&!u)for(;e.peek()?.kind==="conjunction";)e.advance();let o=null,s=null;for(let l=0;l<t.length;l++){let c=t[l];this.logger.debug(" >> Matching pattern token:",JSON.stringify(c,null,2));let d=e.peek();if(this.logger.debug(" >> Current input token:",d?JSON.stringify({type:d.type,value:d.value,kind:d.kind}):"EOF"),c.type==="role"&&c.greedy){let v=this.collectStopMarkers(t,l+1);if(n)for(let E of n)v.add(E);let h=[];for(;!e.isAtEnd();){let E=e.peek();if(!E||this.isStopMarker(E,v))break;h.push(E.value),e.advance();}if(h.length>0){i.set(c.role,{type:"expression",raw:h.join(" ")}),o=null,s=null;continue}else {if(c.optional)continue;return false}}if(c.type==="group"){let v=this.collectStopMarkers(t,l+1);if(n)for(let E of n)v.add(E);if(this.matchGroupToken(e,c,i,v)){o=null,s=null;continue}if(this.isOptional(c))continue;return false}let m=c.type==="role"&&c.optional===true,p=m?e.mark():null;if(c.type==="role"&&!m){let v=l+1<t.length?t[l+1]:null;if(v?.type==="literal"){let h=e.peek();if(h&&this.getMatchType(h,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 E=this.matchPatternToken(e,c,i);if(this.logger.debug(" >> Backtrack retry result:",E),E)continue}return false}}}let y=this.matchPatternToken(e,c,i);if(this.logger.debug(" >> Match result:",y),y){m?(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,t,i){switch(t.type){case "literal":return this.matchLiteralToken(e,t);case "role":return this.matchRoleToken(e,t,i);case "group":return this.matchGroupToken(e,t,i);default:return false}}matchLiteralToken(e,t){let i=e.peek();if(this.logger.debug(" >>> matchLiteralToken: expecting",t.value),this.logger.debug(" >>> matchLiteralToken: got token",i?JSON.stringify({type:i.type,value:i.value,kind:i.kind}):"null"),!i)return this.logger.debug(" >>> matchLiteralToken: FAIL - no token"),false;let n=this.getMatchType(i,t.value);if(this.logger.debug(" >>> matchType for",i.value,"vs",t.value,":",n),n!=="none")return this.totalKeywordMatches++,n==="stem"&&this.stemMatchCount++,e.advance(),true;if(t.alternatives)for(let a of t.alternatives){let u=this.getMatchType(i,a);if(u!=="none")return this.totalKeywordMatches++,u==="stem"&&this.stemMatchCount++,e.advance(),true}return false}matchRoleToken(e,t,i){this.logger.debug(" >>> matchRoleToken ENTRY: capturing role",t.role),this.logger.debug(" >>> matchRoleToken: expected types",t.expectedTypes),this.logger.debug(" >>> matchRoleToken: optional?",t.optional),this.skipNoiseWords(e);let n=e.peek();if(this.logger.debug(" >>> After skipNoiseWords, current token:",n?JSON.stringify({value:n.value,kind:n.kind}):"null"),!n)return t.optional||false;let a=this.tryMatchPossessiveExpression(e);if(a)return t.expectedTypes&&t.expectedTypes.length>0&&!Ze(a.type,t.expectedTypes)?t.optional||false:(i.set(t.role,a),true);let u=this.tryMatchMethodCallExpression(e);if(u)return t.expectedTypes&&t.expectedTypes.length>0&&!Ze(u.type,t.expectedTypes)?t.optional||false:(i.set(t.role,u),true);let o=this.tryMatchPossessiveSelectorExpression(e);if(o)return t.expectedTypes&&t.expectedTypes.length>0&&!Ze(o.type,t.expectedTypes)?t.optional||false:(i.set(t.role,o),true);let s=this.tryMatchPropertyAccessExpression(e);if(s)return t.expectedTypes&&t.expectedTypes.length>0&&!Ze(s.type,t.expectedTypes)?t.optional||false:(i.set(t.role,s),true);let l=this.tryMatchSelectorPropertyExpression(e);if(l)return t.expectedTypes&&t.expectedTypes.length>0&&!Ze(l.type,t.expectedTypes)?t.optional||false:(i.set(t.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:",t.expectedTypes),t.expectedTypes&&t.expectedTypes.length>0&&!Ze(c.type,t.expectedTypes)?(this.logger.debug(" >>> TYPE MISMATCH - returning",t.optional||false),t.optional||false):(this.logger.debug(" >>> Type validation PASSED"),i.set(t.role,c),e.advance(),true)):t.optional||false}tryMatchPossessiveExpression(e){let t=e.peek();if(!t||!this.currentProfile)return null;let i=t.normalized||t.value,n=this.safeToLowerCase(i),a=ka(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()),Rr(fr(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 t=e.peek();if(!t||t.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:`${t.value}.${a.value}(${o.join(", ")})`}}tryMatchPropertyAccessExpression(e){let t=e.peek();if(!t||t.kind!=="identifier"&&t.kind!=="keyword")return null;let i=e.mark();e.advance();let 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=`${t.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 m=e.peek();if(!m)break;if(m.kind==="punctuation"&&m.value===")"){if(c===0){e.advance();break}c--;}if(m.kind==="punctuation"&&m.value==="("&&c++,m.kind==="punctuation"&&m.value===","){e.advance();continue}l.push(m.value),e.advance();}return {type:"expression",raw:`${u}(${l.join(", ")})`}}return {type:"expression",raw:u}}tryMatchPossessiveSelectorExpression(e){let t=e.peek();if(!t||t.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(),Rr(Or(t.value),a.value))}tryMatchSelectorPropertyExpression(e){let t=e.peek();if(!t||t.kind!=="selector"||typeof t.value!="string"||!t.value.startsWith("#"))return null;let i=e.mark();e.advance();let 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 Rr(Or(t.value),u)}matchGroupToken(e,t,i,n){let a=e.mark(),u=new Set(i.keys());if(this.matchTokenSequence(e,t.tokens,i,n))return true;e.reset(a);for(let l of i.keys())u.has(l)||i.delete(l);if(!t.optional)return false;let s=this.getGroupLeadingMarker(t);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,t.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 t=e.tokens[0];return t?.type==="literal"?t.value.toLowerCase():null}getMatchType(e,t){return e.value===t?"exact":e.normalized===t?"normalized":e.stem===t&&e.stemConfidence!==void 0&&e.stemConfidence>=.7?"stem":e.kind==="keyword"&&this.safeToLowerCase(e.value)===t.toLowerCase()?"case-insensitive":"none"}collectStopMarkers(e,t){let i=new Set;for(let n=t;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,t){return t.size===0?false:!!(t.has(e.value.toLowerCase())||e.normalized&&t.has(e.normalized.toLowerCase()))}tokenToSemanticValue(e){switch(e.kind){case "selector":return Or(e.value);case "literal":return this.parseLiteralValue(e.value);case "keyword":let t=e.normalized||e.value;this.safeToLowerCase(t);return Se(e.normalized||e.value);case "identifier":if(typeof e.value=="string"&&e.value.startsWith(":"))return fr(e.value);this.safeToLowerCase(e.value);return {type:"expression",raw:e.value};case "url":return Se(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 Se(n,"string")}if(e==="true")return Se(true,"boolean");if(e==="false")return Se(false,"boolean");let t=e.match(/^(\d+(?:\.\d+)?)(ms|s|m|h)?$/);if(t){let n=parseFloat(t[1]);return t[2]?Se(e,"duration"):Se(n,"number")}let i=parseFloat(e);return isNaN(i)?Se(e,"string"):Se(i,"number")}applyExtractionRules(e,t){for(let[i,n]of Object.entries(e.extraction))t.has(i)||(n.value!==void 0?t.set(i,{type:"literal",value:n.value}):n.default&&t.set(i,n.default));}isOptional(e){return e.type!=="literal"&&e.optional===true}calculateConfidence(e,t){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,t.has(l.role)&&(i+=1);else if(l.type==="group"){for(let c of l.tokens)if(c.type==="role"){let d=a(c.role),m=.8;n+=m,t.has(c.role)?i+=m:d&&(i+=m*.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,t);return u=Math.max(0,Math.min(1,u+s)),u}calculateVSOConfidenceBoost(e){if(e.language!=="ar")return 0;let t=e.template.tokens[0];if(!t||t.type!=="literal")return 0;let i=new Set(["\u0628\u062F\u0644","\u063A\u064A\u0631","\u0623\u0636\u0641","\u0623\u0632\u0644","\u0636\u0639","\u0627\u062C\u0639\u0644","\u0639\u064A\u0646","\u0632\u062F","\u0627\u0646\u0642\u0635","\u0633\u062C\u0644","\u0623\u0638\u0647\u0631","\u0623\u062E\u0641","\u0634\u063A\u0644","\u0623\u0631\u0633\u0644","\u0631\u0643\u0632","\u0634\u0648\u0634","\u062A\u0648\u0642\u0641","\u0627\u0646\u0633\u062E","\u0627\u062D\u0630\u0641","\u0627\u0635\u0646\u0639","\u0627\u0646\u062A\u0638\u0631","\u0627\u0646\u062A\u0642\u0627\u0644","\u0623\u0648"]);if(i.has(t.value))return .15;if(t.alternatives){for(let n of t.alternatives)if(i.has(n))return .15}return 0}arabicPrepositionDisambiguation(e,t){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 t.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 t=e.peek();if(!t)return;let i=this.safeToLowerCase(t.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 t={},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":t.once=true;break;case "debounce":typeof a.value=="number"&&(t.debounce=a.value);break;case "throttle":typeof a.value=="number"&&(t.throttle=a.value);break;case "queue":(a.value==="first"||a.value==="last"||a.value==="all"||a.value==="none")&&(t.queue=a.value);break}e.advance();}return i?t:void 0}};hr.MAX_MARKER_SCAN=3;hr.MAX_PROPERTY_DEPTH=10;hr.MAX_METHOD_ARGS=20;hr.ENGLISH_NOISE_WORDS=new Set(["the","a","an"]);var Ca=hr;new Ca;var Je=class{constructor(){this.name="string-literal";}canExtract(r,e){let t=r[e];return t==="'"&&e>0&&/[\p{L}\p{M}\p{N}_)\]]/u.test(r[e-1])?false:t==='"'||t==="'"||t==="`"||t==="\u201C"||t==="\u2018"}extract(r,e){let t=r[e];if(t==="\u201C"){let a=1;for(;e+a<r.length;){if(r[e+a]==="\u201D")return a++,{value:r.substring(e,e+a),length:a};a++;}return null}if(t==="\u2018"){let a=1;for(;e+a<r.length;){if(r[e+a]==="\u2019")return a++,{value:r.substring(e,e+a),length:a};a++;}return null}let i=1,n=false;for(;e+i<r.length;){let a=r[e+i];if(n){n=false,i++;continue}if(a==="\\"){n=true,i++;continue}if(a===t)return i++,{value:r.substring(e,e+i),length:i};i++;}return null}},Qe=class{constructor(){this.name="number";}canExtract(r,e){return /\d/.test(r[e])}extract(r,e){let t=0,i=false;for(;e+t<r.length;){let u=r[e+t];if(/\d/.test(u))t++;else if(u==="."&&!i)i=true,t++;else break}if(t===0)return null;let n=r.substring(e,e+t),a=e+t;if(a<r.length){let u=r.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:t+l.pattern.length,metadata:{hasTimeUnit:true}};if(u.startsWith("ms"))return {value:n+"ms",length:t+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:t+1,metadata:{hasTimeUnit:true}};if(/^[smh](?![a-zA-Z])/.test(u))return {value:n+u[0],length:t+1,metadata:{hasTimeUnit:true}}}return {value:n,length:t}}};function ba(r){return "setContext"in r&&typeof r.setContext=="function"}function Aa(r){let e={language:r.language,direction:r.direction,lookupKeyword:r.lookupKeyword.bind(r),isKeyword:r.isKeyword.bind(r),isKeywordStart:r.isKeywordStart.bind(r),...r.isKeywordStartAtBoundary?{isKeywordStartAtBoundary:r.isKeywordStartAtBoundary.bind(r)}:{}};return r.normalizer?{...e,normalizer:r.normalizer}:e}var oe=class{constructor(r,e){this.pos=0,this.tokens=r,this.language=e;}peek(r=0){let e=this.pos+r;return e<0||e>=this.tokens.length?null:this.tokens[e]}advance(){if(this.isAtEnd())throw new Error("Unexpected end of token stream");return this.tokens[this.pos++]}isAtEnd(){return this.pos>=this.tokens.length}mark(){return {position:this.pos}}reset(r){this.pos=r.position;}position(){return this.pos}remaining(){return this.tokens.slice(this.pos)}takeWhile(r){let e=[];for(;!this.isAtEnd()&&r(this.peek());)e.push(this.advance());return e}skipWhile(r){for(;!this.isAtEnd()&&r(this.peek());)this.advance();}};function re(r,e){return {start:r,end:e}}function te(r,e,t,i){if(typeof r=="object"){let{value:a,kind:u,position:o,normalized:s,stem:l,stemConfidence:c,metadata:d}=r;return {value:a,kind:u,position:o,...s!==void 0&&{normalized:s},...l!==void 0&&{stem:l},...c!==void 0&&{stemConfidence:c},...d!==void 0&&{metadata:d}}}let n=r;if(!e||!t)throw new Error("createToken requires kind and position parameters");if(typeof i=="string")return {value:n,kind:e,position:t,normalized:i};if(i){let{normalized:a,stem:u,stemConfidence:o,metadata:s}=i;return {value:n,kind:e,position:t,...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:t}}function yr(r){return /\s/.test(r)}function Sa(r){return r==="#"||r==="."||r==="["||r==="@"||r==="*"||r==="<"}function Da(r){return r==='"'||r==="'"||r==="`"||r==="\u300C"||r==="\u300D"}function $e(r){return /\d/.test(r)}function Lr(r){return r.replace(/[\u064b-\u0652\u0670]/g,"")}function xa(r){return /[a-zA-Z]/.test(r)}function ye(r){return /[a-zA-Z0-9_-]/.test(r)}function Ba(r,e){if(e>=r.length)return null;let t=r[e];if(!Sa(t))return null;let i=e,n="";if(t==="#"||t==="."){for(n+=r[i++];i<r.length&&ye(r[i]);)n+=r[i++];if(n.length<=1)return null;if(i<r.length&&r[i]==="."&&t==="#"){let u=i+1;for(;u<r.length&&ye(r[u]);)u++;if(u<r.length&&r[u]==="(")return n}}else if(t==="["){let a=1,u=false,o=null,s=false;for(n+=r[i++];i<r.length&&a>0;){let l=r[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(t==="@"){for(n+=r[i++];i<r.length&&ye(r[i]);)n+=r[i++];if(n.length<=1)return null}else if(t==="*"){for(n+=r[i++];i<r.length&&ye(r[i]);)n+=r[i++];if(n.length<=1)return null}else if(t==="<"){if(n+=r[i++],i>=r.length||!xa(r[i]))return null;for(;i<r.length&&ye(r[i]);)n+=r[i++];for(;i<r.length;){let a=r[i];if(a==="."){if(n+=r[i++],i>=r.length||!ye(r[i]))return null;for(;i<r.length&&ye(r[i]);)n+=r[i++];}else if(a==="#"){if(n+=r[i++],i>=r.length||!ye(r[i]))return null;for(;i<r.length&&ye(r[i]);)n+=r[i++];}else if(a==="["){let u=1,o=false,s=null,l=false;for(n+=r[i++];i<r.length&&u>0;){let c=r[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<r.length&&yr(r[i]);)n+=r[i++];if(i<r.length&&r[i]==="/")for(n+=r[i++];i<r.length&&yr(r[i]);)n+=r[i++];if(i>=r.length||r[i]!==">")return null;n+=r[i++];}return n||null}function Fa(r,e){if(e>=r.length||r[e]!=="'"||e+1>=r.length||r[e+1].toLowerCase()!=="s")return false;if(e+2>=r.length)return true;let i=r[e+2];return yr(i)||i==="*"||!ye(i)}function Ta(r,e){if(e>=r.length)return null;let t=r[e];if(!Da(t)||t==="'"&&Fa(r,e))return null;let n={'"':'"',"'":"'","`":"`","\u300C":"\u300D"}[t];if(!n)return null;let a=e+1,u=t,o=false;for(;a<r.length;){let s=r[a];if(u+=s,o)o=false;else if(s==="\\")o=true;else if(s===n)return u;a++;}return u}function Oa(r,e){if(e>=r.length)return false;let t=r[e],i=r[e+1]||"",n=r[e+2]||"";if(t==="/"&&i!=="/"&&/[a-zA-Z0-9._-]/.test(i)||t==="/"&&i==="/"&&/[a-zA-Z]/.test(n)||t==="."&&(i==="/"||i==="."&&n==="/"))return true;let a=r.slice(e,e+8).toLowerCase();return !!(a.startsWith("http://")||a.startsWith("https://"))}function Ra(r,e){if(!Oa(r,e))return null;let t=e,i="",n=/[a-zA-Z0-9/:._\-?&=%@+~!$'()*,;[\]]/;for(;t<r.length;){let a=r[t];if(a==="#"){if(i.length>0&&/[a-zA-Z0-9/.]$/.test(i))for(i+=a,t++;t<r.length&&/[a-zA-Z0-9_-]/.test(r[t]);)i+=r[t++];break}if(n.test(a))i+=a,t++;else break}return i.length<2?null:i}function Pa(r,e){if(e>=r.length)return null;let t=r[e];if(!$e(t)&&t!=="-"&&t!=="+")return null;let i=e,n="";if((r[i]==="-"||r[i]==="+")&&(n+=r[i++]),i>=r.length||!$e(r[i]))return null;for(;i<r.length&&$e(r[i]);)n+=r[i++];if(i<r.length&&r[i]===".")for(n+=r[i++];i<r.length&&$e(r[i]);)n+=r[i++];return i<r.length&&(r.slice(i,i+2)==="ms"?n+="ms":(r[i]==="s"||r[i]==="m"||r[i]==="h")&&(n+=r[i])),n}var La=["===","!==","->","==","!=","<=",">=","&&","||","**","+=","-=","*=","/=","+","-","*","/","=",">","<","!","&","|","%","^","~"];new Set(La);var Na=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"]);function Ma(r){return r.includes("-")&&/^[\p{L}\p{N}_]+(-[\p{L}\p{N}_]+)+$/u.test(r)}var _a=["click","dblclick","input","change","submit","keydown","keyup","keypress","mousedown","mouseup","mouseover","mouseout","mouseenter","mouseleave","mousemove","pointerdown","pointerup","pointermove","focus","blur","load","resize","scroll"],Nr=class Pr{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){ba(e)&&e.setContext(Aa(this)),this.extractors.push(e);}registerExtractors(e){for(let t of e)this.registerExtractor(t);}clearExtractors(){this.extractors=[];}isUsingExtractors(){return this.extractors.length>0}tokenizeWithExtractors(e){let t=[],i=0;for(;i<e.length;){for(;i<e.length&&yr(e[i]);)i++;if(i>=e.length)break;let n=this.tryMultiWordKeyword(e,i);if(n){t.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,d={};if(o.metadata)for(let[p,f]of Object.entries(o.metadata))p!=="normalized"&&p!=="stem"&&p!=="stemConfidence"&&(d[p]=f);let m={};s&&(m.normalized=s),l&&(m.stem=l),c!==void 0&&(m.stemConfidence=c),Object.keys(d).length>0&&(m.metadata=d),t.push(te(o.value,this.classifyToken(o.value),re(i,i+o.length),Object.keys(m).length>0?m:void 0)),i+=o.length,a=true;break}}if(!a){let u=e[i],o=this.classifyUnknownChar(u);t.push(te(u,o,re(i,i+1))),i++;}}return new oe(this.mergeColonQualifiedNames(t),this.language)}mergeColonQualifiedNames(e){let t=[];for(let i of e){let n=t[t.length-1];if(n&&Pr.ASCII_WORD.test(n.value)&&Pr.COLON_QUALIFIER.test(i.value)&&n.position.end===i.position.start){let a=n.value+i.value;t[t.length-1]=te(a,this.classifyToken(a),re(n.position.start,i.position.end));continue}t.push(i);}return t}classifyUnknownChar(e){return "()[]{},:;".includes(e)?"punctuation":"+-*/<>=!&|".includes(e)?"operator":"identifier"}tryPropertyAccess(e,t,i){if(e[t]!==".")return false;let n=i[i.length-1],a=n&&n.position.end<t;if(n&&!a&&(n.kind==="identifier"||n.kind==="keyword"||n.kind==="selector"))return i.push(te(".","operator",re(t,t+1))),true;let s=t+1;for(;s<e.length&&ye(e[s]);)s++;return s<e.length&&e[s]==="("?(i.push(te(".","operator",re(t,t+1))),true):false}initializeKeywordsFromProfile(e,t=[]){let i=new Map;if(this.rawExtraEntries=t,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 _a)i.has(n)||i.set(n,{native:n,normalized:n});for(let n of t)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(" ")||Ma(n.native))&&!Na.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 Lr(e)}tryProfileKeyword(e,t){for(let i of this.profileKeywords)if(e.slice(t).startsWith(i.native))return te(i.native,"keyword",re(t,t+i.native.length),i.normalized);return null}tryMultiWordKeyword(e,t,i=n=>/[\p{L}\p{N}_]/u.test(n)){if(this.multiWordKeywords.length===0)return null;let n=e.slice(t);for(let a of this.multiWordKeywords){if(!n.startsWith(a.native))continue;let u=e[t+a.native.length];if(!(u!==void 0&&i(u)))return te(a.native,"keyword",re(t,t+a.native.length),a.normalized)}return null}isKeywordStart(e,t){let i=e.slice(t);return this.profileKeywords.some(n=>i.startsWith(n.native))}isKeywordStartAtBoundary(e,t,i=n=>/[\p{L}\p{N}_]/u.test(n)){let n=e.slice(t);return this.profileKeywords.some(a=>{if(!n.startsWith(a.native))return false;let u=e[t+a.native.length];return u===void 0||!i(u)})}lookupKeyword(e){let t=this.profileKeywordMap.get(e.toLowerCase());if(t)return t;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 t=this.normalizer.normalize(e);return t.stem!==e&&t.confidence>=.7?t:null}tryMorphKeywordMatch(e,t,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 te(e,"keyword",re(t,i),u)}trySelector(e,t){let i=Ba(e,t);return i?te(i,"selector",re(t,t+i.length)):null}tryEventModifier(e,t){if(e[t]!==".")return null;let i=e.slice(t).match(/^\.(?:once|debounce|throttle|queue)(?:\(([^)]+)\))?(?:\s|$|\.)/);if(!i)return null;let n=i[0].replace(/(\s|\.)$/,""),a=n.slice(1).split("(")[0],u=i[1];return {...te(n,"event-modifier",re(t,t+n.length)),metadata:{modifierName:a,value:u?a==="queue"?u:parseInt(u,10):void 0}}}tryString(e,t){let i=Ta(e,t);return i?te(i,"literal",re(t,t+i.length)):null}tryNumber(e,t){let i=Pa(e,t);return i?te(i,"literal",re(t,t+i.length)):null}tryMatchTimeUnit(e,t,i,n=false){let a=t;if(n)for(;a<e.length&&yr(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(ye(c))continue}return {suffix:o.suffix,endPos:a+o.length}}}return null}parseBaseNumber(e,t,i=true){let n=t,a="";if(i&&(e[n]==="-"||e[n]==="+")&&(a+=e[n++]),n>=e.length||!$e(e[n]))return null;for(;n<e.length&&$e(e[n]);)a+=e[n++];if(n<e.length&&e[n]===".")for(a+=e[n++];n<e.length&&$e(e[n]);)a+=e[n++];return !a||a==="-"||a==="+"?null:{number:a,endPos:n}}tryNumberWithTimeUnits(e,t,i,n={}){let{allowSign:a=true,skipWhitespace:u=false}=n,o=this.parseBaseNumber(e,t,a);if(!o)return null;let{number:s,endPos:l}=o,c=[...i,...Pr.STANDARD_TIME_UNITS],d=this.tryMatchTimeUnit(e,l,c,u);return d&&(s+=d.suffix,l=d.endPos),te(s,"literal",re(t,l))}tryUrl(e,t){let i=Ra(e,t);return i?te(i,"url",re(t,t+i.length)):null}tryVariableRef(e,t){if(e[t]!==":"||t+1>=e.length||!ye(e[t+1]))return null;let i=t+1;for(;i<e.length&&ye(e[i]);)i++;let n=e.slice(t,i);return te(n,"identifier",re(t,i))}tryOperator(e,t){let i=e.slice(t,t+2);if(["==","!=","<=",">=","&&","||","->"].includes(i))return te(i,"operator",re(t,t+2));let n=e[t];return ["<",">","!","+","-","*","/","="].includes(n)?te(n,"operator",re(t,t+1)):["(",")","{","}",",",";",":"].includes(n)?te(n,"punctuation",re(t,t+1)):null}tryMultiCharParticle(e,t,i){for(let n of i)if(e.slice(t,t+n.length)===n)return te(n,"particle",re(t,t+n.length));return null}};Nr.ASCII_WORD=/^[A-Za-z_][A-Za-z0-9_]*$/;Nr.COLON_QUALIFIER=/^:[A-Za-z_][A-Za-z0-9_]*$/;Nr.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 er=Nr;function me(r){return {stem:r,confidence:1}}function F(r,e,t){return t?{stem:r,confidence:e,metadata:t}:{stem:r,confidence:e}}var Ia=Object.defineProperty,ja=Object.getOwnPropertyNames,Ri=(r,e)=>function(){return r&&(e=(0, r[ja(r)[0]])(r=0)),e},$a=(r,e)=>{for(var t in e)Ia(r,t,{get:e[t],enumerable:true});};function Gt(r,e){return r.replace(/\{(\w+)\}/g,(t,i)=>String(e[i]??`{${i}}`))}function ge(r,e,t={},i){let n=Pi[r],a=Gt(n,t),u=Li[r],o=u?Gt(u,t):void 0;return {code:r,message:a,severity:e,...i&&{role:i},...o&&{suggestion:o}}}var L,Pi,Li,Va=Ri({"src/generators/schema-error-codes.ts"(){L={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"},Pi={[L.AMBIGUOUS_TYPE_LITERAL_SELECTOR]:"Role '{role}' accepts both 'literal' and 'selector'. This may cause ambiguous type inference for values starting with special characters (* . # etc.).",[L.TOO_MANY_EXPECTED_TYPES]:"Role '{role}' accepts {count} different types. This may make type inference unreliable.",[L.MULTI_TYPE_PATIENT_EXPECTED]:"Role '{role}' accepts multiple types (expected for {command} command).",[L.NO_REQUIRED_ROLES]:"Command has no required roles. Is this intentional?",[L.NO_REQUIRED_ROLES_EXPECTED]:"Command has no required roles (expected for {command}).",[L.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.",[L.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.",[L.EVENT_HANDLER_MISSING_EVENT]:"Event handler command should have an 'event' role to specify which event to listen for.",[L.EVENT_HANDLER_EVENT_NOT_REQUIRED]:"Event role should be required - every event handler needs an event to listen for.",[L.CONDITIONAL_MISSING_CONDITION]:"Conditional command should have a 'condition' role for the boolean expression.",[L.CONDITIONAL_CONDITION_NOT_REQUIRED]:"Condition role should be required - conditionals need a condition to evaluate.",[L.FOR_LOOP_MISSING_SOURCE]:"For-loop should have a 'source' role for the collection to iterate over.",[L.WHILE_LOOP_MISSING_CONDITION]:"While-loop should have a 'condition' role for the loop condition.",[L.VALUE_TYPE_MISMATCH]:"Role '{role}' of command '{command}' expects type [{expectedTypes}], got '{actualType}'.",[L.SELECTOR_KIND_MISMATCH]:"Role '{role}' of command '{command}' expects selector kind [{selectorKinds}], got '{actualKind}'.",[L.SELECTOR_KINDS_WITHOUT_SELECTOR_TYPE]:"Role '{role}' has selectorKinds but expectedTypes does not include 'selector'.",[L.KEYWORD_COLLISION]:"Keyword '{keyword}' is used by multiple commands: {commands}. Only the first-registered command will be reachable."},Li={[L.AMBIGUOUS_TYPE_LITERAL_SELECTOR]:"Consider being more specific about which type is expected, or use explicit type markers.",[L.TOO_MANY_EXPECTED_TYPES]:"Consider narrowing the accepted types to improve type inference reliability.",[L.TRANSITION_PATIENT_ACCEPTS_SELECTOR]:"Remove 'selector' from expectedTypes and only accept 'literal'.",[L.TRANSITION_MISSING_GOAL]:"Add a 'goal' role with expectedTypes ['literal', 'variable'].",[L.EVENT_HANDLER_MISSING_EVENT]:"Add an 'event' role with expectedTypes ['literal'].",[L.EVENT_HANDLER_EVENT_NOT_REQUIRED]:"Set required: true on the 'event' role.",[L.CONDITIONAL_MISSING_CONDITION]:"Add a 'condition' role with expectedTypes ['expression'].",[L.CONDITIONAL_CONDITION_NOT_REQUIRED]:"Set required: true on the 'condition' role.",[L.FOR_LOOP_MISSING_SOURCE]:"Add a 'source' role for the collection to iterate over.",[L.WHILE_LOOP_MISSING_CONDITION]:"Add a 'condition' role for the loop continuation condition.",[L.VALUE_TYPE_MISMATCH]:"Ensure the value matches one of the expected types: [{expectedTypes}].",[L.SELECTOR_KIND_MISMATCH]:"Use a selector of the correct kind: [{selectorKinds}].",[L.SELECTOR_KINDS_WITHOUT_SELECTOR_TYPE]:"Either add 'selector' to expectedTypes or remove selectorKinds.",[L.KEYWORD_COLLISION]:"Give each command a unique keyword. Move the shared keyword to alternatives on one command, or use a more specific translation."};}}),Ni={};$a(Ni,{SchemaErrorCodes:()=>L,formatValidationResults:()=>Ya,getValidationStats:()=>Za,validateAllKeywordCollisions:()=>Qa,validateAllSchemas:()=>Ga,validateCommandSchema:()=>Mi,validateKeywordCollisions:()=>_i,validateRoleValues:()=>Xa});function Wa(r,e){return {action:r,items:e}}function Mi(r){let e=[];for(let i of r.roles)i.expectedTypes.includes("literal")&&i.expectedTypes.includes("selector")&&(i.role==="patient"&&mt.has(r.action)?e.push(ge(L.MULTI_TYPE_PATIENT_EXPECTED,"note",{role:i.role,command:r.action},i.role)):e.push(ge(L.AMBIGUOUS_TYPE_LITERAL_SELECTOR,"warning",{role:i.role},i.role))),i.expectedTypes.length>3&&!mt.has(r.action)&&e.push(ge(L.TOO_MANY_EXPECTED_TYPES,"warning",{role:i.role,count:i.expectedTypes.length},i.role));for(let i of r.roles)i.selectorKinds&&i.selectorKinds.length>0&&(i.expectedTypes.includes("selector")||e.push(ge(L.SELECTOR_KINDS_WITHOUT_SELECTOR_TYPE,"warning",{role:i.role},i.role)));switch(r.action){case "transition":qa(r,e);break;case "on":Ka(r,e);break;case "if":case "unless":Ha(r,e);break;case "repeat":case "for":case "while":Ua(r,e);break}return r.roles.filter(i=>i.required).length===0&&(Ii.has(r.action)?e.push(ge(L.NO_REQUIRED_ROLES_EXPECTED,"note",{command:r.action})):e.push(ge(L.NO_REQUIRED_ROLES,"warning",{}))),Wa(r.action,e)}function qa(r,e){let t=r.roles.find(n=>n.role==="patient"),i=r.roles.find(n=>n.role==="goal");t&&!i&&e.push(ge(L.TRANSITION_MISSING_GOAL,"error",{}));}function Ka(r,e){let t=r.roles.find(i=>i.role==="event");t||e.push(ge(L.EVENT_HANDLER_MISSING_EVENT,"warning",{})),t&&!t.required&&e.push(ge(L.EVENT_HANDLER_EVENT_NOT_REQUIRED,"warning",{}));}function Ha(r,e){let t=r.roles.find(i=>i.role==="condition");t||e.push(ge(L.CONDITIONAL_MISSING_CONDITION,"warning",{})),t&&!t.required&&e.push(ge(L.CONDITIONAL_CONDITION_NOT_REQUIRED,"warning",{}));}function Ua(r,e){r.action==="for"?r.roles.find(i=>i.role==="source")||e.push(ge(L.FOR_LOOP_MISSING_SOURCE,"warning",{})):r.action==="while"&&(r.roles.find(i=>i.role==="condition")||e.push(ge(L.WHILE_LOOP_MISSING_CONDITION,"warning",{})));}function Ga(r,e={}){let t=new Map,{includeNotes:i=false}=e;for(let[n,a]of Object.entries(r)){let u=Mi(a),o=u.items.some(l=>l.severity==="warning"||l.severity==="error"),s=i&&u.items.some(l=>l.severity==="note");(o||s)&&t.set(n,u);}return t}function Ya(r,e={}){let t=[],{showNotes:i=false,showCodes:n=true}=e;for(let[a,u]of r){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){t.push(` \u274C ${a}:`);for(let c of o){let d=n?` [${c.code}]`:"";t.push(` ERROR${d}: ${c.message}`),c.suggestion&&t.push(` \u{1F4A1} Suggestion: ${c.suggestion}`);}}if(s.length>0){t.push(` \u26A0\uFE0F ${a}:`);for(let c of s){let d=n?` [${c.code}]`:"";t.push(` ${d?`${c.code}: `:""}${c.message}`),c.suggestion&&t.push(` \u{1F4A1} ${c.suggestion}`);}}if(i&&l.length>0){t.push(` \u2139\uFE0F ${a}:`);for(let c of l){let d=n?` [${c.code}]`:"";t.push(` ${d?`${c.code}: `:""}${c.message}`);}}}return t.join(`
|
|
2
|
+
`)}function Za(r){let e=0,t=0,i=0,n={};for(let a of r.values())for(let u of a.items)u.severity==="error"?e++:u.severity==="warning"?t++:u.severity==="note"&&i++,n[u.code]=(n[u.code]||0)+1;return {totalCommands:r.size,errors:e,warnings:t,notes:i,byCode:n}}function Xa(r,e){let t=[];for(let i of e){let n=r.roles.find(a=>a.role===i.role);n&&(n.expectedTypes.length>0&&!n.expectedTypes.includes(i.type)&&(n.expectedTypes.includes("expression")||t.push({level:"error",role:i.role,message:`${r.action}.${i.role} expects type [${n.expectedTypes.join(", ")}], got '${i.type}'`,code:L.VALUE_TYPE_MISMATCH})),i.type==="selector"&&i.selectorKind&&n.selectorKinds&&n.selectorKinds.length>0&&(n.selectorKinds.includes(i.selectorKind)||t.push({level:"error",role:i.role,message:`${r.action}.${i.role} expects selector kind [${n.selectorKinds.join(", ")}], got '${i.selectorKind}'`,code:L.SELECTOR_KIND_MISMATCH})));}return t}function Ja(r){if(r.length!==2)return false;let[e,t]=[...r].sort();return ji.some(([i,n])=>i===e&&n===t)}function _i(r){let e=[];if(!r.keywords)return {language:r.code,collisions:e};let t=new Map;for(let[n,a]of Object.entries(r.keywords)){if(!a||!a.primary)continue;let u=t.get(a.primary)||[];if(u.push({command:n,isPrimary:true}),t.set(a.primary,u),a.alternatives)for(let o of a.alternatives){let s=t.get(o)||[];s.push({command:n,isPrimary:false}),t.set(o,s);}}for(let[n,a]of t){let u=[...new Set(a.map(l=>l.command))];if(u.length<=1||Ja(u))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:r.code,collisions:e}}function Qa(r){let e=[];for(let[,t]of Object.entries(r)){let i=_i(t);i.collisions.length>0&&e.push(i);}return e.sort((t,i)=>t.language.localeCompare(i.language))}var mt,Ii,ji,eu=Ri({"src/generators/schema-validator.ts"(){Va(),mt=new Set(["put","append","prepend","log","throw","make","measure","return","swap","morph","beep","copy"]),Ii=new Set(["compound","else","halt","continue","init","settle","focus","blur","show","hide","return","js","measure","break","exit","beep","empty","open","close","select","clear","reset","breakpoint","live","eventsource","socket","worker","intercept"]),ji=[["change","changes"]];}});var wt=["is not really equal to","is really equal to","is greater than or equal to","is less than or equal to","is not equal to","is equal to","is greater than","is less than","is not really","is really","is not equal","is equal","is not in","is in","is not","is","am not in","am in","am","does not match","do not match","does not contain","does not contains","do not contain","does not include","does not precede","does not follow","precedes","follows","really equals","equals","matches","match","contains","contain","includes","include","has","have","in"],kt=["is not empty","is empty","does not exist"],Ct=["is not an","is not a","is an","is a"],ru=new Set(["me","my","myself","you","your","yourself","it","its","result","event","target","body","detail","window","document"]),tu=new Set(["and","or","not","no"]),iu=new Set(["true","false","null","undefined"]),nu=new Set(wt.map(r=>r.slice(r.lastIndexOf(" ")+1))),au=new Set(["next","previous","closest","first","last"]),uu=new Set(["ms","s","seconds","second","milliseconds","millisecond","minutes","minute","hours","hour"]);function $i(r){let e=[],t=0,i=1,n=1;function a(){if(e.length===0)return true;let f=e[e.length-1];return f.type==="IDENTIFIER"&&nu.has(f.value.toLowerCase())||f.type==="IDENTIFIER"&&au.has(f.value.toLowerCase())||f.type==="IDENTIFIER"&&f.value.toLowerCase()==="of"?true:["OPERATOR","COMPARISON","LOGICAL","LPAREN","LBRACKET","LBRACE","COMMA","COLON"].includes(f.type)}function u(f=0){return r[t+f]??""}function o(){let f=r[t];return t++,f===`
|
|
3
|
+
`?(i++,n=1):n++,f}function s(){for(;t<r.length&&/\s/.test(r[t]);)o();}function l(f){let y="";for(;t<r.length&&f(r[t]);)y+=o();return y}function c(f){let y=f;for(o();t<r.length&&r[t]!==f;)r[t]==="\\"&&t+1<r.length&&(y+=o()),y+=o();return t<r.length&&(y+=o()),y}function d(){let f="`";for(o();t<r.length&&r[t]!=="`";)r[t]==="\\"&&t+1<r.length&&(f+=o()),f+=o();return t<r.length&&(f+=o()),f}function m(){let f="<";for(o();t<r.length&&(f+=o(),!f.endsWith("/>")););return f}function p(f,y,v){return {type:f,value:y,start:v,end:t,line:i,column:n-y.length}}for(;t<r.length&&(s(),!(t>=r.length));){let f=t,y=u();if(y==="'"&&u(1)==="s"&&!/\w/.test(u(2))){o(),o(),e.push(p("POSSESSIVE","'s",f));continue}if(y==='"'||y==="'"){let v=c(y);e.push(p("STRING",v,f));continue}if(y==="`"){let v=d();e.push(p("TEMPLATE_LITERAL",v,f));continue}if(y==="<"&&/[a-zA-Z.#\[]/.test(u(1))){let v=m();e.push(p("QUERY_SELECTOR",v,f));continue}if(y==="#"&&a()){o();let v=l(h=>/[\w-]/.test(h));e.push(p("ID_SELECTOR","#"+v,f));continue}if(y==="."&&/[a-zA-Z_-]/.test(u(1))&&a()){o();let v=l(h=>/[\w-]/.test(h));e.push(p("CLASS_SELECTOR","."+v,f));continue}if(y==="@"&&/[a-zA-Z_]/.test(u(1))){o();let v=l(h=>/[\w-]/.test(h));e.push(p("ATTRIBUTE_REF","@"+v,f));continue}if(y==="["&&a()&&u(1)==="@"){let h="";for(h+=o();t<r.length&&r[t]!=="]";)r[t]==='"'||r[t]==="'"?h+=c(r[t]):h+=o();t<r.length&&(h+=o()),e.push(p("ATTRIBUTE_SELECTOR",h,f));continue}if(y==="["){o(),e.push(p("LBRACKET","[",f));continue}if(y==="]"){o(),e.push(p("RBRACKET","]",f));continue}if(/\d/.test(y)){let v=l(z=>/[\d.]/.test(z)),h=t,E=l(z=>/[a-zA-Z]/.test(z));uu.has(E)?e.push(p("TIME_EXPRESSION",v+E,f)):(t=h,e.push(p("NUMBER",v,f)));continue}if(y==="("){o(),e.push(p("LPAREN","(",f));continue}if(y===")"){o(),e.push(p("RPAREN",")",f));continue}if(y==="{"){o(),e.push(p("LBRACE","{",f));continue}if(y==="}"){o(),e.push(p("RBRACE","}",f));continue}if(y===","){o(),e.push(p("COMMA",",",f));continue}if(y===":"){o(),e.push(p("COLON",":",f));continue}if(y==="."){o(),e.push(p("DOT",".",f));continue}if(y==="|"){o(),e.push(p("PIPE","|",f));continue}if(y==="+"||y==="-"||y==="*"||y==="/"||y==="%"){o(),e.push(p("OPERATOR",y,f));continue}if(y==="="||y==="!"||y==="<"||y===">"){let v=o();u()==="="&&(v+=o()),(v==="=="||v==="!=")&&u()==="="&&(v+=o()),e.push(p("COMPARISON",v,f));continue}if(/[a-zA-Z_$]/.test(y)){let v=l(E=>/[\w$]/.test(E)),h=v.toLowerCase();ru.has(h)?e.push(p("CONTEXT_VAR",v,f)):tu.has(h)?e.push(p("LOGICAL",v,f)):iu.has(h)?e.push(p("BOOLEAN",v,f)):e.push(p("IDENTIFIER",v,f));continue}o();}return e.push(p("EOF","",t)),e}var ou=new Set(["my","its","your"]),su={my:"me",its:"it",your:"you"},lu=new Set(["is","matches","match","contains","in","exists","does"]),cu=new Set(["next","previous","closest","first","last"]),du=[...kt,...Ct,...wt].map(r=>[r,r.split(" ")]),mu=class{constructor(){this.tokens=[],this.current=0;}parse(r){try{return this.tokens=$i(r),this.current=0,this.isAtEnd()?{success:!1,error:"Empty expression"}:{success:!0,node:this.parseExpression(),consumed:this.current}}catch(e){return {success:false,error:e instanceof Error?e.message:"Parse error"}}}peek(){return this.tokens[this.current]??{type:"EOF",value:"",start:0,end:0}}peekAt(r){return this.tokens[this.current+r]??{type:"EOF",value:"",start:0,end:0}}previous(){return this.tokens[this.current-1]??{type:"EOF",value:"",start:0,end:0}}isAtEnd(){return this.peek().type==="EOF"}advance(){return this.isAtEnd()||this.current++,this.previous()}check(r){return this.peek().type===r}checkValue(r){return this.peek().value.toLowerCase()===r.toLowerCase()}match(...r){for(let e of r)if(this.check(e))return this.advance(),true;return false}parseExpression(){return this.parseOr()}parseOr(){let r=this.parseAnd();for(;this.checkValue("or");){let e=this.advance().value,t=this.parseAnd();r=this.createBinaryExpression(e,r,t);}return r}parseAnd(){let r=this.parseEquality();for(;this.checkValue("and");){let e=this.advance().value,t=this.parseEquality();r=this.createBinaryExpression(e,r,t);}return r}parseEquality(){let r=this.parseComparison();for(;;){if(this.match("COMPARISON")){let t=this.previous().value;r=this.createBinaryExpression(t,r,this.parseComparison());continue}let e=this.matchComparisonPhrase();if(e===void 0)break;if(kt.includes(e))r=this.createPostfixUnary(e,r);else if(Ct.includes(e))r=this.parseTypeCheck(r,e.startsWith("is not"));else {let t=e==="match"?"matches":e;r=this.createBinaryExpression(t,r,this.parseComparison());}}return r}matchComparisonPhrase(){for(let[r,e]of du)if(e.every((t,i)=>this.peekAt(i).value.toLowerCase()===t)){for(let t=0;t<e.length;t++)this.advance();return r}}parseTypeCheck(r,e){let t=this.advance();if(t.type==="EOF")throw new Error(`Expected a type name after 'is ${e?"not ":""}a'`);let i=true;return this.peek().value==="!"&&(this.advance(),i=false),{type:"typeCheckExpression",value:r,typeName:t.value,nullOk:i,negated:e,start:r.start,end:this.previous().end}}parseComparison(){let r=this.parseAddition();for(;this.check("COMPARISON");){let e=this.advance().value,t=this.parseAddition();r=this.createBinaryExpression(e,r,t);}return r}parseAddition(){let r=this.parseMultiplication();for(;this.peek().value==="+"||this.peek().value==="-";){let e=this.advance().value,t=this.parseMultiplication();r=this.createBinaryExpression(e,r,t);}return r}parseMultiplication(){let r=this.parseConversion();for(;this.peek().value==="*"||this.peek().value==="/"||this.peek().value==="%"||this.checkValue("mod");){let e=this.advance().value.toLowerCase(),t=this.parseConversion();r=this.createBinaryExpression(e,r,t);}return r}parseConversion(){let r=this.parseUnary();for(;this.checkValue("as")&&this.conversionTypeAt(1)!==void 0;)for(this.advance(),r=this.createAsExpression(r,this.parseConversionType());this.check("PIPE")&&this.conversionTypeAt(1)!==void 0;)this.advance(),r=this.createAsExpression(r,this.parseConversionType());return r}conversionTypeAt(r){let e=this.peekAt(r).value.toLowerCase(),t=e==="a"||e==="an"?r+1:r;return this.peekAt(t).type==="IDENTIFIER"?t:void 0}parseConversionType(){let r=this.conversionTypeAt(0)??0;for(let n=0;n<r;n++)this.advance();let e=this.advance(),t=this.peekAt(1).type;if(!this.check("COLON")||t!=="NUMBER"&&t!=="IDENTIFIER")return e;this.advance();let i=this.advance();return {...e,value:`${e.value}:${i.value}`,end:i.end}}parseUnary(){if(this.checkValue("not")||this.checkValue("no")||this.peek().value==="-"){let r=this.advance().value,e=this.parseUnary();return this.createUnaryExpression(r,e)}return this.parsePostfix()}parsePostfix(){let r=this.parsePrimary();for(;;)if(this.match("DOT"))if(this.check("IDENTIFIER")||this.check("CONTEXT_VAR")){let e=this.advance();r=this.createMemberExpression(r,this.createIdentifier(e.value,e),false);}else break;else if(this.match("POSSESSIVE"))if(this.check("IDENTIFIER")||this.check("CONTEXT_VAR")){let e=this.advance();r=this.createPossessiveExpression(r,this.createIdentifier(e.value,e));}else break;else if(this.match("LPAREN")){let e=this.parseArguments();r=this.createCallExpression(r,e);}else if(this.match("LBRACKET")){let e=this.parseExpression();if(!this.match("RBRACKET"))throw new Error("Expected ] after index");r=this.createMemberExpression(r,e,true);}else if(r.type==="identifier"&&ou.has(r.name)&&this.check("IDENTIFIER")&&!lu.has(this.peek().value.toLowerCase())){let e=this.advance(),t=r,i={...t,name:su[t.name]??t.name};r=this.createMemberExpression(i,this.createIdentifier(e.value,e),false);}else if(this.checkValue("exists")&&this.peekAt(1).type!=="LPAREN")this.advance(),r=this.createPostfixUnary("exists",r);else break;return r}parsePrimary(){let r=this.peek();if(this.checkValue("the")&&(this.peekAt(1).type==="IDENTIFIER"||this.peekAt(1).type==="CONTEXT_VAR")&&this.peekAt(2).value.toLowerCase()==="of")return this.advance(),this.parsePropertyOf(this.advance(),r,false);if(this.match("NUMBER"))return this.createLiteral(parseFloat(r.value),"number",r);if(this.match("STRING")){let e=r.value.slice(1,-1);return this.createLiteral(e,"string",r)}if(this.match("BOOLEAN")){let e=r.value==="true"?true:r.value==="false"?false:r.value==="null"?null:void 0,t={true:"boolean",false:"boolean",null:"null",undefined:"undefined"};return this.createLiteral(e,t[r.value]??"string",r)}if(this.match("TEMPLATE_LITERAL")){let e=r.value;return {type:"templateLiteral",value:e.length>=2&&e.startsWith("`")&&e.endsWith("`")?e.slice(1,-1):e,start:r.start,end:r.end,line:r.line,column:r.column}}if(this.match("TIME_EXPRESSION"))return this.parseTimeExpression(r);if(this.match("ID_SELECTOR"))return this.createSelector(r.value,"id",r);if(this.match("CLASS_SELECTOR"))return this.createSelector(r.value,"class",r);if(this.match("ATTRIBUTE_SELECTOR"))return this.createSelector(r.value,"attribute",r);if(this.match("ATTRIBUTE_REF")){let e={type:"attributeAccess",attributeName:r.value.slice(1),start:r.start,end:r.end};return this.checkValue("of")?(this.advance(),this.createBinaryExpression("of",e,this.parseConversion())):e}if(this.match("QUERY_SELECTOR")){let e=r.value.slice(1,-2);return this.createSelector(e,"query",r)}if(this.match("CONTEXT_VAR"))return this.createIdentifier(r.value,r);if(this.match("IDENTIFIER")){if(cu.has(r.value.toLowerCase())&&(this.check("CLASS_SELECTOR")||this.check("ID_SELECTOR")||this.check("QUERY_SELECTOR"))){let e=this.advance(),t=e.type==="QUERY_SELECTOR"?e.value.slice(1,-2):e.value,i=e.type==="CLASS_SELECTOR"?"class":e.type==="ID_SELECTOR"?"id":"query";return {type:"callExpression",callee:this.createIdentifier(r.value,r),arguments:[this.createSelector(t,i,e)],start:r.start,end:e.end}}return this.checkValue("of")?this.parsePropertyOf(r,r):this.createIdentifier(r.value,r)}if(this.match("LPAREN")){let e=this.parseExpression();if(!this.match("RPAREN"))throw new Error("Expected ) after expression");return e}if(this.match("LBRACKET"))return this.parseArrayLiteral();if(this.match("LBRACE"))return this.parseObjectLiteral();throw new Error(`Unexpected token: ${r.value}`)}parsePropertyOf(r,e,t=true){this.advance();let i=t?this.parseConversion():this.parseUnary();return {type:"propertyOfExpression",property:this.createIdentifier(r.value,r),target:i,start:e.start,end:this.previous().end}}parseArguments(){let r=[];if(!this.check("RPAREN"))do r.push(this.parseExpression());while(this.match("COMMA"));if(!this.match("RPAREN"))throw new Error("Expected ) after arguments");return r}parseArrayLiteral(){let r=[],e=this.previous().start;if(!this.check("RBRACKET"))do r.push(this.parseExpression());while(this.match("COMMA"));if(!this.match("RBRACKET"))throw new Error("Expected ] after array elements");return {type:"arrayLiteral",elements:r,start:e,end:this.previous().end}}parseObjectLiteral(){let r=[],e=this.previous().start;if(!this.check("RBRACE"))do{let t;if(this.check("STRING"))t=this.advance().value.slice(1,-1);else if(this.check("IDENTIFIER")||this.check("CONTEXT_VAR"))t=this.advance().value;else throw new Error("Expected property name");if(!this.match("COLON"))throw new Error("Expected : after property name");let i=this.parseExpression();r.push({key:t,value:i});}while(this.match("COMMA"));if(!this.match("RBRACE"))throw new Error("Expected } after object properties");return {type:"objectLiteral",properties:r.map(t=>({type:"objectProperty",key:{type:"identifier",name:t.key},value:t.value})),start:e,end:this.previous().end}}parseTimeExpression(r){let e=r.value.match(/^(\d+(?:\.\d+)?)(ms|s|seconds?|milliseconds?|minutes?|hours?)$/i);if(!e)throw new Error(`Invalid time expression: ${r.value}`);let t=parseFloat(e[1]),i=e[2].toLowerCase();return {type:"timeExpression",value:t,unit:i,raw:r.value,start:r.start,end:r.end,line:r.line,column:r.column}}createLiteral(r,e,t){return {type:"literal",value:r,dataType:e,raw:t.value,start:t.start,end:t.end,line:t.line,column:t.column}}createSelector(r,e,t){return {type:"selector",value:r,selector:r,selectorType:e,start:t.start,end:t.end,line:t.line,column:t.column}}createIdentifier(r,e){return {type:"identifier",name:r,start:e.start,end:e.end,line:e.line,column:e.column}}createMemberExpression(r,e,t){return {type:"memberExpression",object:r,property:e,computed:t,start:r.start,end:this.previous().end}}createPossessiveExpression(r,e){return {type:"possessiveExpression",object:r,property:e,start:r.start,end:this.previous().end}}createBinaryExpression(r,e,t){return {type:"binaryExpression",operator:r,left:e,right:t,start:e.start,end:t.end}}createAsExpression(r,e){return {type:"asExpression",expression:r,targetType:this.createIdentifier(e.value,e),start:r.start,end:e.end}}createUnaryExpression(r,e){return {type:"unaryExpression",operator:r,operand:e,prefix:true,start:this.previous().start,end:e.end}}createPostfixUnary(r,e){return {type:"unaryExpression",operator:r,operand:e,prefix:false,start:e.start,end:this.previous().end}}createCallExpression(r,e){return {type:"callExpression",callee:r,arguments:e,start:r.start,end:this.previous().end}}};function pu(r){return new mu().parse(r)}function Ke(r){let e=r.roles.find(t=>t.role==="destination");return e?{destination:e.default?{fromRole:"destination",default:e.default}:{fromRole:"destination"}}:{}}function He(r){let e=r.roles.find(t=>t.role==="source");return e?{source:e.default?{fromRole:"source",default:e.default}:{fromRole:"source"}}:{}}function Ue(r,e){return At(r,e,"source")}function bt(r,e){return At(r,e,"destination")}function fu(r,e){return At(r,e,"patient")}function At(r,e,t){if(!e||!r.roles.some(a=>a.role===t))return [];let i=e.alternatives?{type:"literal",value:e.primary,alternatives:[...e.alternatives]}:{type:"literal",value:e.primary},n={type:"role",role:t,optional:true};return [{type:"group",optional:true,tokens:e.position==="after"?[n,i]:[i,n]}]}var ie=["selector","reference","expression"],yu={action:"toggle",description:"Toggle a class or attribute on/off",category:"dom-class",primaryRole:"patient",ast:{args:["patient"],modifiers:{on:"destination",for:"duration"}},argSkipTokens:["on"],roles:[{role:"patient",description:"The class or attribute to toggle",required:true,expectedTypes:["selector"],selectorKinds:["class","attribute"],svoPosition:1,sovPosition:2,markerOptional:{zh:true}},{role:"destination",description:"The target element (defaults to me)",required:false,expectedTypes:ie,default:{type:"reference",value:"me"},svoPosition:2,sovPosition:1,markerVariants:{ko:["\uC5D0\uC11C"]}},{role:"duration",description:"How long the class stays on before reverting (`toggle .a for 2s`)",required:false,expectedTypes:["literal"],svoPosition:3,sovPosition:3,valueShape:"time",markerOverride:{en:"for",ja:"\u9593",ko:"\uB3D9\uC548"}}],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)"}},hu={action:"add",description:"Add a class or attribute to an element",category:"dom-class",primaryRole:"patient",ast:{args:["patient"],modifiers:{to:"destination"}},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"}},vu={action:"remove",description:"Remove a class or attribute from an element",category:"dom-class",primaryRole:"patient",ast:{args:["patient"],modifiers:{from:"source"}},targetRole:"source",argSkipTokens:["from"],roles:[{role:"patient",description:"The class/attribute to remove, or the element to remove",required:true,expectedTypes:ie,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"}},St={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","property-path"],svoPosition:1,sovPosition:1},{role:"destination",description:"Where to put the content",required:true,expectedTypes:["selector","reference","expression","property-path"],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"}},Eu={action:"set",description:"Set a property or variable to a value",category:"variable",primaryRole:"destination",ast:{args:["destination"],modifiers:{to:"patient",on:"scope"}},argSkipTokens:["to"],roles:[{role:"destination",description:"The property or variable to set",required:true,expectedTypes:["selector","reference","expression","property-path"],svoPosition:1,sovPosition:1,markerOverride:{en:"",es:"",ja:"\u3092",ko:"\uB97C",tr:"i",ar:"",sw:"",tl:"",th:"",bn:"\u0995\u09C7",qu:"ta",hi:"\u0915\u094B",zh:"\u628A"},markerOptional:{zh:true}},{role:"patient",description:"The value to set",required:true,expectedTypes:["literal","selector","expression","reference","property-path"],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",th:"\u0E43\u0E19",bn:"\u09A4\u09C7",qu:"man",hi:"\u092E\u0947\u0902",zh:"\u5230"},markerVariants:{tr:["e","a","ye","ya"],zh:["\u4E3A","\u70BA","\u6210"]}},{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>"}},gu={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>"}},zu={action:"live",description:"Reactive block: re-run the body when its dependencies change",category:"control-flow",primaryRole:"patient",hasBody:true,bareKeyword:true,roles:[]},wu={action:"when",description:"Reactive observer: re-run the body when a watched expression changes",category:"control-flow",primaryRole:"condition",ast:{args:["condition"]},hasBody:true,structuralOnly:true,roles:[{role:"condition",description:"The watched expression (`or`-separated expressions watch each)",required:true,expectedTypes:["expression","reference","selector"],svoPosition:1}]},ku={action:"eventsource",description:"Open a Server-Sent Events stream and handle its events",category:"async",primaryRole:"patient",hasBody:true,bareKeyword:true,roles:[]},Cu={action:"socket",description:"Open a WebSocket and handle its messages",category:"async",primaryRole:"patient",hasBody:true,bareKeyword:true,roles:[]},bu={action:"worker",description:"Define a Web Worker with inline methods",category:"async",primaryRole:"patient",hasBody:true,bareKeyword:true,roles:[]},Au={action:"intercept",description:"Service-worker fetch interception / caching strategies",category:"async",primaryRole:"patient",hasBody:true,bareKeyword:true,roles:[]},Su={action:"show",description:"Make an element visible",category:"dom-visibility",primaryRole:"patient",ast:{args:[["destination","patient"]],modifiers:{with:["style","duration"]}},roles:[{role:"patient",description:"The element to show",required:false,expectedTypes:ie,default:{type:"reference",value:"me"},svoPosition:1,sovPosition:1},{role:"style",description:"The hide/show strategy (`with opacity`, `with *opacity`)",required:false,expectedTypes:["expression","selector"],svoPosition:2,sovPosition:2}]},Du={action:"hide",description:"Make an element invisible",category:"dom-visibility",primaryRole:"patient",ast:{args:[["destination","patient"]],modifiers:{with:["style","duration"]}},roles:[{role:"patient",description:"The element to hide",required:false,expectedTypes:ie,default:{type:"reference",value:"me"},svoPosition:1,sovPosition:1},{role:"style",description:"The hide/show strategy (`with opacity`, `with *opacity`)",required:false,expectedTypes:["expression","selector"],svoPosition:2,sovPosition:2}]},xu={action:"on",description:"Handle an event",category:"event",primaryRole:"event",ast:{args:["event"],modifiers:{from:"source"}},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","expression"],default:{type:"reference",value:"me"},svoPosition:2,sovPosition:1}],widenTypeVariants:[{role:"event",types:["literal","expression"],idSuffix:"expr-event",excludeLanguages:["ko"]}]},Bu={action:"trigger",description:"Trigger/dispatch an event",category:"event",primaryRole:"event",ast:{args:["event"],modifiers:{on:"destination"}},argSkipTokens:["on"],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"]},markerOverride:{bn:"\u0995\u09C7",hi:"\u0915\u094B"}},{role:"destination",description:"The target element (defaults to me)",required:false,expectedTypes:ie,default:{type:"reference",value:"me"},svoPosition:2,sovPosition:1}]},Fu={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}]},Tu={action:"fetch",description:"Fetch data from a URL",category:"async",primaryRole:"source",ast:{args:["source"],modifiers:{with:["style","method"],as:"responseType",body:"patient"},isBlocking:true},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"],valueShape:"object",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",ja:"\u3068\u3057\u3066"}},{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}]},Ou={action:"increment",description:"Increment a numeric value",category:"variable",primaryRole:"patient",ast:{args:[["destination","patient"]],modifiers:{by:"quantity"}},roles:[{role:"patient",description:"The value to increment",required:true,expectedTypes:["selector","reference","expression","property-path"],svoPosition:1,sovPosition:1},{role:"quantity",description:"Amount to increment by (defaults to 1)",required:false,expectedTypes:["literal","selector","expression","reference","property-path"],default:{type:"literal",value:1,dataType:"number"},svoPosition:2,sovPosition:2,markerOverride:{en:"by",es:"por",pt:"por",fr:"par",de:"um"}}]},Ru={action:"decrement",description:"Decrement a numeric value",category:"variable",primaryRole:"patient",ast:{args:[["destination","patient"]],modifiers:{by:"quantity"}},roles:[{role:"patient",description:"The value to decrement",required:true,expectedTypes:["selector","reference","expression","property-path"],svoPosition:1,sovPosition:1},{role:"quantity",description:"Amount to decrement by (defaults to 1)",required:false,expectedTypes:["literal","selector","expression","reference","property-path"],default:{type:"literal",value:1,dataType:"number"},svoPosition:2,sovPosition:2,markerOverride:{en:"by",es:"por",pt:"por",fr:"par",de:"um"}}]},Pu={action:"append",description:"Append content to an element",category:"dom-content",primaryRole:"patient",ast:{args:["patient"],modifiers:{to:"destination"}},omitRoleVariants:["destination"],roles:[{role:"patient",description:"The content to append",required:true,expectedTypes:["literal","selector","reference","expression","property-path"],svoPosition:1,sovPosition:2},{role:"destination",description:"The element to append to",required:true,expectedTypes:["selector","reference","expression"],svoPosition:2,sovPosition:1,markerOverride:{en:"to"}}]},Lu={action:"prepend",description:"Prepend content to an element",category:"dom-content",primaryRole:"patient",ast:{args:["patient"],modifiers:{to:"destination"}},omitRoleVariants:["destination"],roles:[{role:"patient",description:"The content to prepend",required:true,expectedTypes:["literal","selector","reference","expression","property-path"],svoPosition:1,sovPosition:2},{role:"destination",description:"The element to prepend to",required:true,expectedTypes:["selector","reference","expression"],svoPosition:2,sovPosition:1,markerOverride:{en:"to"}}]},Nu={action:"log",description:"Log a value to the console",category:"variable",primaryRole:"patient",ast:{args:["patient"]},roles:[{role:"patient",description:"The value to log",required:true,expectedTypes:["literal","selector","reference","expression","property-path"],svoPosition:1,sovPosition:1}]},Mu={action:"get",description:"Get a value from a source",category:"variable",primaryRole:"source",ast:{args:[["source","patient"]]},roles:[{role:"source",description:"The source to get from",required:true,expectedTypes:["literal","selector","reference","expression","property-path"],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}]},_u={action:"take",description:"Take content from a source element",category:"dom-content",primaryRole:"patient",ast:{args:["patient"],modifiers:{from:"source",for:"recipient"}},argSkipTokens:["from"],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 all current holders)",required:false,expectedTypes:ie,svoPosition:2,sovPosition:1},{role:"recipient",description:"The element the class moves ONTO (`take .active from .tab for me`)",required:false,expectedTypes:["reference"],svoPosition:3,sovPosition:3,valueShape:"reference",markerOverride:{en:"for"}}]},Iu={action:"make",description:"Create a new element",category:"dom-content",primaryRole:"patient",ast:{args:["patient"]},roles:[{role:"patient",description:"The element type or selector to create",required:true,expectedTypes:["literal","selector"],svoPosition:1,sovPosition:1}]},ju={action:"halt",description:"Halt/stop execution or event propagation",category:"control-flow",primaryRole:"patient",ast:{args:[],modifiers:{the:"patient"}},argSkipTokens:["the"],roles:[{role:"patient",description:"What to halt (event, default, bubbling, etc.)",required:false,expectedTypes:["literal","reference","expression"],svoPosition:1,sovPosition:1}]},$u={action:"settle",description:"Wait for animations/transitions to settle",category:"async",primaryRole:"patient",ast:{args:[["destination","patient"]],isBlocking:true},roles:[{role:"patient",description:"The element to settle (defaults to me)",required:false,expectedTypes:ie,default:{type:"reference",value:"me"},svoPosition:1,sovPosition:1}]},Vu={action:"throw",description:"Throw an error",category:"control-flow",primaryRole:"patient",ast:{args:["patient"]},roles:[{role:"patient",description:"The error message or object to throw",required:true,expectedTypes:["literal","expression","property-path"],svoPosition:1,sovPosition:1}]},Wu={action:"send",description:"Send an event to an element",category:"event",primaryRole:"event",ast:{args:["event"],modifiers:{to:"destination",detail:"patient"}},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"}}]},qu={action:"if",description:"Conditional execution",category:"control-flow",primaryRole:"condition",ast:{args:["condition"]},hasBody:true,roles:[{role:"condition",description:"The condition to evaluate",required:true,expectedTypes:["expression","reference","selector"],svoPosition:1,sovPosition:1}]},Ku={action:"unless",description:"Negated conditional execution (executes when condition is false)",category:"control-flow",primaryRole:"condition",ast:{args:["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}]},Hu={action:"else",description:"Else branch of conditional",category:"control-flow",primaryRole:"patient",hasBody:true,roles:[]},Uu={action:"repeat",description:"Repeat a block of commands",category:"control-flow",primaryRole:"loopType",ast:{args:[["quantity","patient"]]},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"'},Gu={action:"for",description:"Iterate over a collection",category:"control-flow",primaryRole:"patient",ast:{args:["patient"],modifiers:{in:"source"}},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"}}]},Yu={action:"while",description:"Loop while condition is true",category:"control-flow",primaryRole:"condition",ast:{args:["condition"]},hasBody:true,roles:[{role:"condition",description:"The condition to check",required:true,expectedTypes:["expression"],svoPosition:1,sovPosition:1}]},Zu={action:"continue",description:"Continue to next loop iteration",category:"control-flow",primaryRole:"patient",ast:{},roles:[]},Ur={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"},Xu=Object.fromEntries(Object.keys(Ur).map(r=>[r,"in new"])),Ju={action:"go",description:"Navigate to a URL, or scroll to an element",category:"navigation",primaryRole:"destination",roles:[{role:"destination",description:"The URL to navigate to, or the element to scroll to",required:true,expectedTypes:["literal",...ie],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"]}},{role:"manner",description:"Open the URL in a new window (`in new window`)",required:false,expectedTypes:["reference","literal","expression"],valueShape:"keyword",svoPosition:2,sovPosition:2,markerOverride:Xu}],rolePrefixLiteralVariants:[{role:"destination",literal:Ur,idSuffix:"url",priorityDelta:5,methodCarrier:"method"}]},Qu={action:"transition",description:"Transition an element with animation",category:"dom-visibility",primaryRole:"patient",ast:{args:["patient"],modifiers:{to:"goal",over:"duration",on:"destination"}},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}]},eo={action:"clone",description:"Clone an element",category:"dom-content",primaryRole:"patient",ast:{args:[["source","patient"]],modifiers:{into:"destination"}},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"}}]},ro={action:"focus",description:"Focus an element",category:"dom-content",primaryRole:"patient",ast:{args:[["destination","patient"]]},roles:[{role:"patient",description:"The element to focus (defaults to me)",required:false,expectedTypes:ie,default:{type:"reference",value:"me"},svoPosition:1,sovPosition:1}]},to={action:"blur",description:"Remove focus from an element",category:"dom-content",primaryRole:"patient",ast:{args:[["destination","patient"]]},roles:[{role:"patient",description:"The element to blur (defaults to me)",required:false,expectedTypes:ie,default:{type:"reference",value:"me"},svoPosition:1,sovPosition:1}]},io={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:ie,default:{type:"reference",value:"me"},svoPosition:1,sovPosition:1}]},no={action:"open",description:"Open a dialog, details element, or popover",category:"dom-content",primaryRole:"patient",ast:{args:["patient"],modifiers:{as:"style"}},roles:[{role:"patient",description:"The element to open (defaults to me)",required:false,expectedTypes:ie,default:{type:"reference",value:"me"},svoPosition:1,sovPosition:2},{role:"style",description:"Open-mode variant (modal / non-modal) for <dialog>",required:false,expectedTypes:["literal","expression"],svoPosition:2,sovPosition:1,markerOverride:{en:"as",ja:"\u3068\u3057\u3066"}}]},ao={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:ie,default:{type:"reference",value:"me"},svoPosition:1,sovPosition:1}]},uo={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:ie,default:{type:"reference",value:"me"},svoPosition:1,sovPosition:1}]},oo={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}]},so={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:ie,default:{type:"reference",value:"me"},svoPosition:1,sovPosition:1}]},lo={action:"breakpoint",description:"Drop into the debugger",category:"control-flow",primaryRole:"patient",roles:[],bareKeyword:true},co={action:"call",description:"Call a function",category:"control-flow",primaryRole:"patient",ast:{args:["patient"]},roles:[{role:"patient",description:"The function to call",required:true,expectedTypes:["expression","reference"],markerOptional:{he:true,zh:true},svoPosition:1,sovPosition:1}]},mo={action:"return",description:"Return a value from a function",category:"control-flow",primaryRole:"patient",ast:{args:["patient"]},roles:[{role:"patient",description:"The value to return",required:false,expectedTypes:["literal","expression","reference","property-path"],svoPosition:1,sovPosition:1}]},po={action:"js",description:"Execute raw JavaScript code",category:"control-flow",primaryRole:"patient",ast:{args:["patient"]},hasBody:true,roles:[{role:"patient",description:"The JavaScript code to execute",required:false,expectedTypes:["expression"],svoPosition:1,sovPosition:1}]},fo={action:"tell",description:"Execute commands in context of another element",category:"control-flow",primaryRole:"destination",ast:{args:[["destination","patient"]]},hasBody:true,roles:[{role:"destination",description:"The element to tell",required:true,expectedTypes:ie,svoPosition:1,sovPosition:1,markerOverride:{en:"",he:"\u05D0\u05EA",zh:"\u628A"}}]},yo={action:"default",description:"Set a default value for a variable",category:"variable",primaryRole:"destination",ast:{args:["destination"],modifiers:{to:"patient"}},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","property-path"],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"}}]},ho={action:"init",description:"Initialization block that runs once",category:"control-flow",primaryRole:"patient",ast:{},hasBody:true,roles:[]},vo={action:"behavior",description:"Define a reusable behavior",category:"control-flow",primaryRole:"patient",ast:{args:["patient"]},hasBody:true,roles:[{role:"patient",description:"The behavior name (PascalCase identifier)",required:true,expectedTypes:["literal","reference","expression"],svoPosition:1,sovPosition:1}]},Eo={action:"install",description:"Install a behavior on an element",category:"control-flow",primaryRole:"patient",ast:{args:["patient"],modifiers:{on:"destination"}},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}]},go={action:"measure",description:"Measure element dimensions (x, y, width, height, etc.)",category:"dom-content",primaryRole:"patient",ast:{args:["patient"],modifiers:{of:["destination","source"]}},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:ie,default:{type:"reference",value:"me"},svoPosition:2,sovPosition:2,markerOverride:{en:"of"}}]},zo={en:"using view",es:"using view",pt:"using view",fr:"using view",de:"using view",it:"using view",ja:"using view",ko:"using view",zh:"using view",ar:"using view",he:"using view",hi:"using view",bn:"using view",tr:"using view",ru:"using view",uk:"using view",pl:"using view",id:"using view",vi:"using view",th:"using view",ms:"using view",tl:"using view",sw:"using view",qu:"using view"},Dt={role:"manner",description:"Run the swap inside a `document.startViewTransition()` (`using view transition`)",required:false,expectedTypes:["literal","expression"],valueShape:"keyword",markerOverride:zo},wo={action:"swap",description:"Swap DOM content using various strategies (innerHTML, outerHTML, delete, etc.)",category:"dom-content",primaryRole:"destination",ast:{args:["method","destination","patient"],modifiers:{viewTransition:"manner"}},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:ie,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",tl:""}},{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"}},{...Dt,svoPosition:4,sovPosition:4}]},ko={action:"morph",description:"Morph an element into another using DOM diffing",category:"dom-content",primaryRole:"patient",ast:{args:[["source","destination"]],modifiers:{on:"patient",viewTransition:"manner"}},roles:[{role:"patient",description:"The element to morph",required:true,expectedTypes:ie,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"}},{...Dt,svoPosition:3,sovPosition:3}]},Co={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}]},bo={action:"break",description:"Exit from the current loop",category:"control-flow",primaryRole:"patient",roles:[]},Ao={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","property-path"],svoPosition:1,sovPosition:1}]},So={action:"exit",description:"Exit from the current event handler",category:"control-flow",primaryRole:"patient",roles:[],bareKeyword:true},Do={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}]},xo={action:"scroll",description:"Scroll the viewport to a target element",category:"navigation",primaryRole:"destination",ast:{args:["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"}}]},Bo={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"},Fo={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:Ur}]},To={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:Ur}]},Oo={action:"process",description:"Process hx-partial markup in HTML content",category:"dom-content",primaryRole:"patient",ast:{args:["patient"],modifiers:{viewTransition:"manner"}},roles:[{role:"patient",description:"The HTML content (string, element, or response) to process",required:true,expectedTypes:["literal","reference","expression"],svoPosition:1,sovPosition:1,markerOverride:Bo},{...Dt,svoPosition:2,sovPosition:2}]},Ro={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"],valueShape:"object",svoPosition:2,sovPosition:1}]},le={toggle:yu,add:hu,remove:vu,put:St,set:Eu,show:Su,hide:Du,on:xu,trigger:Bu,wait:Fu,fetch:Tu,increment:Ou,decrement:Ru,append:Pu,prepend:Lu,log:Nu,get:Mu,take:_u,make:Iu,halt:ju,settle:$u,throw:Vu,send:Wu,if:qu,unless:Ku,else:Hu,repeat:Uu,for:Gu,while:Yu,continue:Zu,go:Ju,scroll:xo,push:Fo,replace:To,process:Oo,transition:Qu,clone:eo,focus:ro,blur:to,empty:io,open:no,close:ao,select:uo,clear:oo,reset:so,breakpoint:lo,call:co,return:mo,js:po,tell:fo,default:yo,init:ho,behavior:vo,install:Eo,measure:go,swap:wo,morph:ko,beep:Co,break:bo,copy:Ao,exit:So,pick:Do,render:Ro,bind:gu,live:zu,when:wu,eventsource:ku,socket:Cu,worker:bu,intercept:Au,compound:{action:"compound",description:"A compound node representing chained statements",primaryRole:"patient",category:"control-flow",hasBody:true,roles:[]}};function se(r){return le[r]}function Po(){return Object.values(le).filter(r=>r.structuralOnly!==true&&(r.roles.length>0||r.bareKeyword===true))}typeof process<"u"&&process.env.LOKASCRIPT_SCHEMA_VALIDATION==="1"&&Promise.resolve().then(()=>(eu(),Ni)).then(({validateAllSchemas:r,formatValidationResults:e})=>{let t=r(le);t.size>0&&(console.warn("[SCHEMA VALIDATION] Found issues in command schemas:"),console.warn(e(t)),console.warn(`
|
|
4
|
+
These warnings help identify potential schema design issues.`),console.warn("Fix them to improve type inference and avoid runtime bugs."));}).catch(r=>{console.debug("Schema validation skipped:",r);});var Vi=new Set(["me","my","myself","you","your","yourself","it","its","result","event","target","body","detail","window","document","true","false","null","undefined","empty"]),We=new Map,Le=new Map,gr=new Map,pt=null;function Wi(r,e){let t={...r};for(let i of Object.keys(e)){let n=e[i],a=r[i];n!==void 0&&(typeof n=="object"&&n!==null&&!Array.isArray(n)&&typeof a=="object"&&a!==null&&!Array.isArray(a)?t[i]=Wi(a,n):t[i]=n);}return t}function Lo(r,e){return Wi(r,e)}function xt(r){if(!r.extends)return r;let e=Le.get(r.extends);if(!e)return console.warn(`[Registry] Profile '${r.code}' extends '${r.extends}' but base is not registered. Make sure to import the base language before the variant.`),r;let t=xt(e);return Lo(t,r)}function cr(r,e,t){We.set(r,e),Le.set(r,t),gr.delete(r);}function qi(r){pt=r;}var Yt=new Map;function ar(r){return r.split("-")[0]}function ur(r){return r.includes("-")}function No(r){let e=We.get(r);if(!e&&ur(r)){let t=ar(r);e=We.get(t);}if(!e){let t=Array.from(We.keys()).join(", ");throw new Error(`Language '${r}' is not registered. Registered languages: ${t||"none"}. Import the language module first: import '@lokascript/semantic/languages/${r}';`)}return e}function Mo(r){let e=Le.get(r);if(!e&&ur(r)){let t=ar(r);e=Le.get(t);}if(!e){let t=Array.from(Le.keys()).join(", ");throw new Error(`Language profile '${r}' is not registered. Registered languages: ${t||"none"}. Import the language module first: import '@lokascript/semantic/languages/${r}';`)}return xt(e)}function R(r){let e=Le.get(r);return !e&&ur(r)&&(e=Le.get(ar(r))),e?xt(e):void 0}function _o(){return Array.from(We.keys())}function Ki(r){if(We.has(r)&&Le.has(r))return true;if(ur(r)){let e=ar(r);return We.has(e)&&Le.has(e)}return false}function Io(r,e){let i=No(e).tokenize(r);return e==="en"?i:$o(i,e)}var Hi=()=>false;function jo(r){Hi=r;}function $o(r,e){let t=r.tokens,i=[],n=false;for(let a=0;a<t.length;a++){let u=t[a],o=t[a-1],s=a+2;for(;s<t.length&&t[s]?.value!==")"&&t[s-1].position.end===t[s].position.start;)s++;let l=t.slice(a+1,s),c=l.map(p=>p.value).join(""),d=l[0],m=l[l.length-1];if(u.value==="("&&d&&m&&t[s]?.value===")"&&/^[\p{L}_$][\p{L}\p{M}\p{N}_$]*$/u.test(c)&&!(d.kind!=="particle"&&Vi.has((d.normalized??d.value).toLowerCase()))&&Hi(c,e)&&u.position.end===d.position.start&&m.position.end===t[s].position.start&&!(o&&o.position.end===u.position.start&&/[\p{L}\p{N}_)\]]$/u.test(o.value))){i.push({value:`(${c})`,kind:"identifier",position:{...u.position,end:t[s].position.end}}),a=s,n=true;continue}i.push(u);}return n?new oe(i,e):r}function fe(r){let e=gr.get(r);if(!e&&ur(r)&&(e=gr.get(ar(r))),e)return e;let t=Yt.get(r);if(!t&&ur(r)&&(t=Yt.get(ar(r))),t)return gr.set(r,t),t;if(!pt)throw new Error(`No patterns registered for language '${r}'. Either import the language module or set a pattern generator.`);let i=Mo(r),n=pt(i);return gr.set(r,n),n}var Ui={possessive:{specialForms:{me:"my",it:"its",you:"your"}}};function Oe(r){let e="complex";return r.startsWith("#")&&!r.includes(" ")?e="id":r.startsWith(".")&&!r.includes(" ")?e="class":r.startsWith("[")&&r.endsWith("]")?e="attribute":/^[a-z][a-z0-9]*$/i.test(r)&&(e="element"),{type:"selector",value:r,selectorKind:e}}function X(r,e){let t={type:"literal",value:r};return e!==void 0?{type:"literal",value:r,dataType:e}:t}function Gi(r){if(r==="true")return X(true,"boolean");if(r==="false")return X(false,"boolean");if(r==="null")return {type:"expression",raw:"null"}}function Te(r){return nt(r)}function Ae(r){return {type:"reference",value:r}}function Yi(r,e){return e?{...r,position:e}:r}function Re(r,e,t){return t?{type:"property-path",object:r,property:e,access:t}:{type:"property-path",object:r,property:e}}function pe(r,e,t){let i={kind:"command",action:r,roles:new Map(Object.entries(e))};return t!==void 0?{...i,metadata:t}:i}function vr(r,e,t,i,n,a){let u=new Map;u.set("event",r);let o={kind:"event-handler",action:"on",roles:u,body:e};return t!==void 0&&(o.eventModifiers=t),i!==void 0&&(o.metadata=i),n!==void 0&&n.length>0&&(o.parameterNames=n),o}function ps(r,e,t,i,n){let a={kind:"behavior",action:"behavior",roles:new Map,name:r,parameters:e,eventHandlers:t};return i!==void 0&&i.length>0&&(a.initBlock=i),n!==void 0&&(a.metadata=n),a}function fs(r,e,t,i){let n={kind:"def",action:"def",roles:new Map,name:r,parameters:e,body:t};return i!==void 0&&(n.metadata=i),n}function ft(r,e,t,i,n){let a={kind:"feature",action:r,roles:n??new Map,body:e};return t!==void 0&&(a.name=t),i!==void 0&&(a.metadata=i),a}function rr(r,e="then",t){let i={kind:"compound",action:"compound",roles:new Map,statements:r,chainType:e};return t!==void 0&&(i.metadata=t),i}function ys(r,e,t,i){let n=new Map;n.set("condition",r);let a={kind:"conditional",action:"if",roles:n,thenBranch:e};return t!==void 0&&(a.elseBranch=t),i!==void 0&&(a.metadata=i),a}function hs(r,e,t,i,n){let a={kind:"loop",action:r,loopVariant:e,roles:new Map(Object.entries(t)),body:i};return n?.loopVariable&&(a.loopVariable=n.loopVariable),n?.indexVariable&&(a.indexVariable=n.indexVariable),n?.metadata&&(a.metadata=n.metadata),a}function Mr(r,e){return !e||e.length===0||e.includes(r)||e.includes("expression")?true:r==="property-path"?e.some(t=>["selector","reference","expression"].includes(t)):r==="expression"?e.some(t=>["selector","reference","expression"].includes(t)):false}function vs(r,e){let t=r.markerOverride?.[e.code],i=e.roleMarkers[r.role];if(t!==void 0){let n=Es(r,e.code,t);return {primary:t,...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 Es(r,e,t){let i=r.markerLegacy?.[e];if(!i?.length)return;let n=[...new Set(i)].filter(a=>a&&a!==t);return n.length?n:void 0}function Ne(r,e,t){let i=r.markerLegacy?.[e]??[],n=r.methodCarrier?[]:r.markerVariants?.[e]??[],a=[...new Set([...i,...n])].filter(u=>u&&u!==t);return a.length?a:void 0}var Sr=new Set(["destination","source","patient","object","event","eventmarker","manner","instrument","style"]);function De(r,e){let t=r.possessive?.keywords?.[e];if(t)return t;let i=r.possessive?.specialForms;if(i){for(let[n,a]of Object.entries(i))if(a===e)return n}}function at(r){return Ui.possessive?.specialForms?.[r]??`${r}'s`}var Gr=new Set(["+","-","*","/","%","<",">","<=",">=","==","!=","===","!=="]),Zi=new Set(["<",">","<=",">=","==","!=","===","!=="]),_e=new Set([...Gr,"mod"]),gs=/^[<>=!+\-*/%]+$/,Xi={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 zs(r){return Xi[r]}function Yr(r,e){return Xi[e]?.has(r.toLowerCase())??false}var Ji={ar:["\u0645\u0631\u0627\u062A","\u0645\u0631\u0629"],bn:["\u09AC\u09BE\u09B0"],de:["mal","Mal"],es:["veces","vez"],fr:["fois"],he:["\u05E4\u05E2\u05DE\u05D9\u05DD","\u05E4\u05E2\u05DD"],hi:["\u092C\u093E\u0930"],id:["kali"],it:["volte","volta"],ja:["\u56DE","\u5EA6"],ko:["\uBC88","\uD68C"],ms:["kali"],pl:["razy","raz"],pt:["vezes","vez"],qu:["kuti"],ru:["\u0440\u0430\u0437","\u0440\u0430\u0437\u0430"],sw:["mara"],th:["\u0E04\u0E23\u0E31\u0E49\u0E07"],tl:["beses"],tr:["kez","kere","defa"],uk:["\u0440\u0430\u0437\u0456\u0432","\u0440\u0430\u0437\u0438","\u0440\u0430\u0437"],vi:["l\u1EA7n"],zh:["\u6B21","\u904D"]},Bt={ar:{\u0642\u064A\u0645\u0629:"value"},bn:{\u0985\u0995\u09CD\u09B7\u09AE:"disabled",\u0986\u0987\u09A1\u09BF:"id","\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",\u0E44\u0E2D\u0E14\u0E35:"id"},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"}},ws={ar:{\u0623\u0648:"or",\u0643\u0640:"as",\u0644\u064A\u0633:"not",\u0648:"and",\u064A\u062D\u062A\u0648\u064A:"contains",\u064A\u0633\u0627\u0648\u064A:"equals",\u064A\u0634\u0645\u0644:"includes"},bn:{\u0985\u09A5\u09AC\u09BE:"or",\u098F\u09AC\u0982:"and",\u09A8\u09BE:"not",\u09B9\u09BF\u09B8\u09BE\u09AC\u09C7:"as"},de:{als:"as",beinhaltet:"includes",enth\u00E4lt:"contains",gleicht:"equals",nicht:"not",oder:"or",und:"and"},es:{como:"as",contiene:"contains",iguala:"equals",incluye:"includes",no:"not",o:"or",y:"and"},fr:{comme:"as",contient:"contains",\u00E9gale:"equals",et:"and",inclut:"includes",non:"not",ou:"or"},he:{\u05D5\u05D2\u05DD:"and"},hi:{\u0914\u0930:"and",\u0915\u0947_\u0930\u0942\u092A_\u092E\u0947\u0902:"as",\u0928\u0939\u0940\u0902:"not",\u092C\u0930\u093E\u092C\u0930:"equals",\u092E\u0947\u0902_\u0939\u0948:"includes",\u092F\u093E:"or",\u0936\u093E\u092E\u093F\u0932:"contains"},id:{atau:"or",berisi:"contains",bukan:"not",dan:"and",sama:"equals",sebagai:"as",termasuk:"includes"},it:{come:"as",contiene:"contains",e:"and",include:"includes",non:"not",o:"or",uguale:"equals"},ja:{\u305D\u3057\u3066:"and",\u3067\u306F\u306A\u3044:"not",\u3068\u3057\u3066:"as",\u307E\u305F\u306F:"or",\u542B\u3080:"contains",\u542B\u3081\u308B:"includes",\u7B49\u3057\u3044:"equals"},ko:{\uAC19\uB2E4:"equals",\uADF8\uB9AC\uACE0:"and",\uB610\uB294:"or",\uB85C:"as",\uC544\uB2C8:"not",\uD3EC\uD568:"contains",\uD3EC\uD568\uD558\uB2E4:"includes"},ms:{atau:"or",bukan:"not",dan:"and",mengandungi:"contains",sama:"equals",sebagai:"as",termasuk:"includes"},pl:{i:"and",jako:"as",lub:"or",nie:"not",obejmuje:"includes","r\xF3wna si\u0119":"equals",zawiera:"contains"},pt:{como:"as",cont\u00E9m:"contains",e:"and",igual:"equals",inclui:"includes",n\u00E3o:"not",ou:"or"},qu:{churasqa:"includes",hina:"as",hinallataq:"and",kikin:"equals",ukupi_kan:"contains",utaq:"or"},ru:{\u0432\u043A\u043B\u044E\u0447\u0430\u0435\u0442:"includes",\u0438:"and",\u0438\u043B\u0438:"or",\u043A\u0430\u043A:"as",\u043D\u0435:"not",\u0440\u0430\u0432\u043D\u043E:"equals",\u0441\u043E\u0434\u0435\u0440\u0436\u0438\u0442:"contains"},sw:{au:"or",ina:"contains",kuwa:"as",pamoja:"includes",sawa:"equals",si:"not"},th:{\u0E44\u0E21\u0E48:"not",\u0E41\u0E25\u0E30:"and",\u0E2B\u0E23\u0E37\u0E2D:"or"},tl:{at:"and",bilang:"as",hindi:"not",katumbas:"equals",naglalaman:"contains",o:"or"},tr:{de\u011Fil:"not",e\u015Fittir:"equals",i\u00E7erir:"contains",olarak:"as",ve:"and",veya:"or"},uk:{\u0430\u0431\u043E:"or",\u0432\u043A\u043B\u044E\u0447\u0430\u0454:"includes",\u0434\u043E\u0440\u0456\u0432\u043D\u044E\u0454:"equals",\u0456:"and",\u043C\u0456\u0441\u0442\u0438\u0442\u044C:"contains",\u043D\u0435:"not",\u044F\u043A:"as"},vi:{b\u1EB1ng:"equals",ch\u1EE9a:"contains",ho\u1EB7c:"or",kh\u00F4ng:"not",nh\u01B0:"as",v\u00E0:"and"},zh:{\u4F5C\u4E3A:"as",\u5305\u542B:"contains",\u5305\u62EC:"includes",\u548C:"and",\u6216:"or",\u7B49\u4E8E:"equals",\u975E:"not"}},Qi={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","n\u0131n","nun","n\xFCn","in","\u0131n","un","\xFCn"])};function je(r,e){let t=e.value.toLowerCase(),i=(e.normalized??"").toLowerCase();if(t==="of"||t==="ng"||i==="of"||i==="source")return true;let n=r?.code?Qi[r.code]:void 0;return !!n&&n.has(t)}var ks={destination:"in",source:"from"},en={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"])},rn=new Set(["in","into","at","within","inside"]);function Cs(r,e){let t=e.value.toLowerCase();if((r?.code?en[r.code]:void 0)?.has(t))return "in";let n=e.normalized??e.value,a=n.toLowerCase();return rn.has(a)?"in":ks[a]??n}function bs(r,e){return e.value.toLowerCase()==="in"||(r?.code?en[r.code]:void 0)?.has(e.value.toLowerCase())?true:rn.has((e.normalized??e.value).toLowerCase())}var As=new Set(["me","it","you","body","document","target","result"]);function Ss(r,e){let t=r[e];if(!t)return null;if(t.kind==="selector")return /^[*@]/.test(t.value)?null:{kind:"selector",parts:[{text:t.value,token:t}],consumed:1};let i=(t.normalized??t.value).toLowerCase();if(As.has(i))return {kind:"reference",parts:[{text:i,token:t}],consumed:1};let n=r[e+1];return i==="closest"&&n?.kind==="selector"&&!/^[*@]/.test(n.value)?{kind:"closest",parts:[{text:"closest",token:t},{text:n.value,token:n}],consumed:2}:null}function tn(r,e,t,i){let n=r[e];if(!n||!bs(t,n))return null;let a=Ss(r,e+1);if(!a)return null;let u=r[e+1+a.consumed];return i?.(n)===true&&i(u)!==true?null:{marker:n,scope:a}}var ut=new Set(["first","last","next","previous","random","closest"]),Ds={bn:{\u09B6\u09C7\u09B7:"last"}},dr=new Set(Object.keys(le).map(r=>r.toLowerCase()));function Cr(r,e,t,i){let n=r[e];if(!n)return null;let a=(n.normalized??n.value).toLowerCase(),u=r[e+1],o=t?.code&&u?.kind==="selector"&&u.value.startsWith("<")?Ds[t.code]?.[n.value.toLowerCase()]:void 0;if(!ut.has(a)&&!ut.has(n.value.toLowerCase())&&o===void 0)return null;let s=[{text:o??n.normalized??n.value,token:n}],l=e+1,c=r[l];if(!c||c.kind!=="selector"||Zi.has(c.value))return null;s.push({text:c.value,token:c}),l++;let d=0;for(;d++<8;){let f=r[l];if(f&&f.kind==="selector"&&f.value.startsWith("."))s.push({text:f.value,token:f}),l++;else break}let m=r[l],p=r[l+1];if(m&&p&&p.kind==="selector"&&!/^[*@]/.test(p.value)&&(m.kind==="keyword"||m.kind==="particle"||m.kind==="identifier")&&!ut.has((m.normalized??m.value).toLowerCase())&&!dr.has((m.normalized??m.value).toLowerCase())&&!(i?.(m)===true&&i(r[l+2])!==true))s.push({text:Cs(t,m),token:m}),s.push({text:p.value,token:p}),l+=2;else {let f=tn(r,l,t,i);f&&f.scope.kind!=="selector"&&(s.push({text:"in",token:f.marker},...f.scope.parts),l+=1+f.scope.consumed);}return {parts:s,consumed:l-e}}function qe(r,e){let t=ws[r];return t?t[e.toLowerCase()]??e:e}function ve(r,e){let t=Bt[r];return t?t[e.toLowerCase()]??e:e}function Jt(r,e){return Bt[r]?.[e.toLowerCase()]!==void 0}function xs(r,e){let t=[e.value,e.normalized].filter(Boolean);for(let i of t){let n=De(r,i)??De(r,i.toLowerCase());if(n)return n}}function nn(r){return r.kind==="literal"||r.kind==="operator"||r.kind==="punctuation"?false:!/^[$:@#.*^(){}[\]]/.test(r.value)}function Bs(r,e){let t=r?.references;if(!t)return false;let i=Object.values(t).filter(a=>typeof a=="string").map(a=>a.toLowerCase());return [e.value,e.normalized].filter(Boolean).some(a=>i.includes(a.toLowerCase()))}function ir(r,e){return nn(r)?ve(e,r.value)!==r.value?true:r.kind==="identifier":false}var Fs=new Set(["true","false","null","undefined","me","my","it","its","you","your","result","event","target","body","detail","document","window"]);function an(r){return r.kind==="literal"||r.kind==="selector"||r.kind==="reference"?true:r.kind==="identifier"?Os.test(r.value):r.kind==="keyword"&&Fs.has((r.normalized??r.value).toLowerCase())}function Qt(r){return !!r&&(r.value===")"||r.value==="]"||an(r))}function yt(r){if(!r)return false;if(/^[([-]$/.test(r.value)||an(r))return true;let e=(r.normalized??"").toLowerCase();return r.kind==="keyword"&&(e==="not"||e==="no")}var Ts=/^\.[\p{L}_-][\p{L}\p{N}_-]*$/u,Os=/^(?:[:$]?[\p{L}_][\p{L}\p{M}\p{N}_]*|\([\p{L}_$][\p{L}\p{M}\p{N}_$]*\))$/u,G={beforeClassRef:"has"},Rs={ar:{\u0647\u0648:{beforePredicate:"is",afterOperand:"is"},\u0641\u0627\u0631\u063A:{afterCopula:"empty"}},hi:{\u0939\u0948:{beforePredicate:"is",beforeClassRef:"has",afterOperand:"is"},\u0916\u093E\u0932\u0940:{afterCopula:"empty"}},id:{kosong:{afterCopula:"empty"},punya:G},th:{\u0E40\u0E1B\u0E47\u0E19:{beforeTypeName:"as",beforePredicate:"is",afterOperand:"is"},\u0E27\u0E48\u0E32\u0E07:{afterCopula:"empty"},\u0E21\u0E35:G},ja:{\u7A7A:{afterCopula:"empty"},\u3042\u308B:G},sw:{tupu:{afterCopula:"empty",otherwise:"null"},na:{betweenOperands:"and"},ana:G,nina:G},zh:{\u6CA1\u6709:{beforeBareIdentifier:"no",beforeSelector:"no"},\u6709:G},tl:{walang:{beforeBareIdentifier:"no",beforeSelector:"no"},may:{afterSubject:"exists",beforeClassRef:"has"}},bn:{\u0986\u099B\u09C7:{afterSubject:"exists",beforeClassRef:"has"},\u0986\u099B\u09BF:G},qu:{mana:{beforeOperand:"not"},chusaq:{afterCopula:"empty"},kachkan:G,kachkani:G},tr:{var:{afterSubject:"exists",beforeClassRef:"has"},bo\u015F:{afterCopula:"empty"}},de:{hat:G,habe:G},es:{tiene:G,tengo:G},fr:{a:G,ai:G},it:{ha:G,ho:G},ko:{\uC788\uB2E4:G},ms:{ada:G},pl:{ma:G,mam:G},pt:{tem:G,tenho:G},ru:{\u0438\u043C\u0435\u0435\u0442:G,\u0438\u043C\u0435\u044E:G},uk:{\u043C\u0430\u0454:G,\u043C\u0430\u044E:G},vi:{c\u00F3:G}},Ps=new Set(["text","json","html","response","blob","arraybuffer"]),Ls=new Set(["empty","null","undefined","true","false"]),un=new Set(["Number","Int","Float","String","Boolean","Date","Array","Object","JSON","json","JSONString","FormData","FormEncoded","HTML","Fragment","Values","Values:Form","Values:JSON","Set","Map","Keys","Entries","Reversed","Unique","Flat"]);function br(r){return un.has(r)||/^Fixed(?::\d+)?$/.test(r)||/^[A-Z][A-Za-z0-9_]*(?::[A-Za-z0-9_]+)?$/.test(r)}function on(r,e,t,i,n,a){let u=ht(r,e);if(!u)return;if(u.beforeTypeName&&i?.kind==="identifier"&&a?.value!=="("&&(un.has(i.value)||Ps.has(i.value.toLowerCase())))return u.beforeTypeName;if(u.beforePredicate&&i&&(i.kind==="literal"||i.kind==="keyword"&&Ls.has((i.normalized??"").toLowerCase())))return u.beforePredicate;if(u.afterCopula&&n!==void 0&&["is","not","does","do"].includes(n.toLowerCase()))return u.afterCopula;if(u.beforeBareIdentifier&&i?.kind==="identifier"&&/^[A-Za-z_]\w*$/.test(i.value))return u.beforeBareIdentifier;let o=!!i&&Ar(i,r)&&Pe({prev:e,beforePrev:t,next:a},r);if(u.beforeOperand&&(yt(i)||o))return u.beforeOperand;if(u.beforeSelector&&i?.kind==="selector")return u.beforeSelector;if(u.beforeClassRef&&i&&Ts.test(i.value))return u.beforeClassRef;if(u.afterSubject&&(t?.kind==="selector"||t?.kind==="reference"))return u.afterSubject;let s=!!t&&Ar(t,r)&&n===t.value;return u.betweenOperands&&(Qt(t)||s)&&yt(i)?u.betweenOperands:u.afterOperand&&(Qt(t)||t?.value==="}")?u.afterOperand:u.otherwise}function ht(r,e){let t=Rs[r];return t?.[e.value]??t?.[e.value.toLowerCase()]}function Ns(r,e,t,i){return on(r,e,t,i,void 0,void 0)}function Ms(r){return gs.test(r)||r==="("||r==="["||r===","}function _s(r){return Gr.has(r)&&r!=="-"||r===")"||r==="]"||r===","}var Is=new Set(["is","am","contains","contain","matches","match","has","have","includes","include","exists","exist","mod"]);function sn(r,e,t,i){let n=e.kind==="keyword"?(e.normalized??"").toLowerCase():qe(r,e.value).toLowerCase();if(n!=="and"&&n!=="or")return false;if(t===void 0||t!==void 0&&Ms(t.value))return true;if(i===void 0)return false;if(_s(i.value))return true;let a=i.kind==="keyword"?(i.normalized??i.value).toLowerCase():qe(r,i.value).toLowerCase();return Is.has(a)}var js=new Set(["include","contain","match","exist"]);function ln(r){let e=r?.toLowerCase();return e==="is"||e==="not"}function cn(r,e,t){let i=e[t],n=e[t-1];return !i||!n||i.value.toLowerCase()!=="in"?false:ln(or(r,n,e[t-2],i,void 0))}function or(r,e,t,i,n,a){if(n?.toLowerCase()==="equal"&&e.value.toLowerCase()==="to")return "to";if(ln(n)&&e.value.toLowerCase()==="in")return "in";if(n?.toLowerCase()==="not"&&js.has(e.value.toLowerCase()))return e.value.toLowerCase();let u=on(r,e,t,i,n,a);if(u!==void 0)return u;if(sn(r,e,t,i))return e.value;let o=qe(r,e.value);if(o!==e.value)return o;if(e.kind!=="keyword")return e.value;let s=(e.normalized??e.value).toLowerCase();return s!=="event"&&Sr.has(s)||Ar(e,r)&&Pe({prev:t,next:i,afterNext:a},r)?e.value:e.normalized??e.value}function dn(r,e,t,i){let n=r[e],a=r[e+1];if(!n||!a||!nn(n)||!je(t,a)||!ir(n,i))return;if(r[e+2]?.kind==="selector")return e+2;let u=e;for(;r[u]!==void 0&&r[u+1]!==void 0&&je(t,r[u+1])&&ir(r[u],i);)u+=2;return u>e+2&&r[u]?.kind==="selector"?u:void 0}var $s=new Set(["if","unless","while","until","for","when","where","is","not","no","and","or","as"]);function Vs(r){let e=(r.normalized??r.value).toLowerCase();return e==="event"||Te(e)?false:$s.has(e)||Sr.has(e)}function Ar(r,e){return r.kind!=="keyword"?false:(r.normalized??r.value).toLowerCase()==="end"||Yr(r.value,e)}function Ee(r,e){return {prev:r[e-1],beforePrev:r[e-2],third:r[e-3],next:r[e+1],afterNext:r[e+2]}}var Ws=new Set(["and","or","is","times"]),qs=new Set(["if","unless","while","until","is","and","or","in"]),Ks=r=>Object.prototype.hasOwnProperty.call(le,r);function ot(r){if(r.kind!=="keyword"&&!(r.normalized&&r.normalized!==r.value))return;let e=(r.normalized??r.value).toLowerCase();return Ks(e)?e:void 0}var ei=new WeakMap;function ri(r,e,t=false){let i;try{i=fe(r);}catch{return new Set}let n=ei.get(i);n||(n=new Map,ei.set(i,n));let a=t?`${e} before a role pair`:e,u=n.get(a);if(!u){u=new Set;for(let o of i){if(o.command!==e)continue;let[s,l,c,d]=o.template.tokens;if(!(s?.type!=="literal"||l?.type!=="literal")&&!(t&&(c?.type!=="role"||d?.type!=="role")))for(let m of [l.value,...l.alternatives??[]])u.add(m.toLowerCase());}n.set(a,u);}return u}var ti=new WeakMap;function Hs(r){let e;try{e=fe(r);}catch{return new Set}let t=ti.get(e);if(!t){let i=new Set(Object.values(R(r)?.roleMarkers??{}).flatMap(a=>a?[a.primary,...a.alternatives??[]]:[]).map(a=>a.toLowerCase())),n=new Set;for(let a of e){if(a.command!=="repeat")continue;let u=a.template.tokens;u.forEach((o,s)=>{if(!(o.type!=="literal"||u[s+1]?.type!=="role"))for(let l of [o.value,...o.alternatives??[]])i.has(l.toLowerCase())||n.add(l.toLowerCase());});}t=n,ti.set(e,t);}return t}function ii(r){return r.kind==="particle"?true:r.kind==="keyword"&&Sr.has((r.normalized??"").toLowerCase())}function ni(r,e){return r.kind==="keyword"&&r.normalized?r.normalized.toLowerCase():qe(e,r.value).toLowerCase()}function Pe(r,e){let{prev:t,beforePrev:i,next:n,afterNext:a}=r;if(n){if(_e.has(n.value)||Ws.has((n.normalized??n.value).toLowerCase())||n.value==="'"&&a?.value.toLowerCase()==="s")return true;let f=ht(e,n)?.betweenOperands;if((f==="and"||f==="or")&&yt(a))return true}let u=R(e),o=!!u&&u.markingStrategy!=="preposition";if(o&&n?.kind==="particle"&&a?.kind!=="particle")return true;if(!t)return false;if(Gr.has(t.value))return true;let s=ni(t,e);if(s==="not"||s==="no"||ht(e,t)?.beforeOperand==="not")return true;let l=u?.wordOrder!=="SOV",c=r.third?ot(r.third):void 0;if(c&&i&&ri(e,c,true).has(i.value.toLowerCase()))return true;let d=i&&l?ot(i):void 0;if(d&&!ri(e,d).has(t.value.toLowerCase())||i&&!o&&ii(i))return false;if(qs.has(s))return true;let m=!!i&&ni(i,e)!=="repeat"&&!!Ji[e]?.includes(t.value);if(Hs(e).has(t.value.toLowerCase())&&(l||s!=="repeat")&&!m)return true;let p=l?ot(t):void 0;return p&&le[p].roles.some(f=>f.required)?true:!o&&ii(t)}function mn(r){if(r.kind==="keyword")return Vs(r)?"structure":dr.has((r.normalized??r.value).toLowerCase())?"verb":void 0}function Be(r,e){let t=e?.code??"en",[i]=r;if(r.length===1&&i&&(mn(i)||Ar(i,t)))return i.value;let n="",a,u,o=(s,l)=>{if(u=s,a===void 0){n=s,a=l;return}let d=a.position?.end!==void 0&&l.position?.start!==void 0&&a.position.end===l.position.start&&(s.startsWith(".")||s.startsWith("!"));n+=(d?"":" ")+s,a=l;};for(let s=0;s<r.length;s++){let l=r[s],c=e?xs(e,l):void 0,d=r[s+1];if(l.value===":"&&a!==void 0&&u!==void 0&&d!==void 0&&a.position?.end===l.position?.start&&l.position?.end===d.position?.start&&br(`${u}:${d.value}`)){n+=`:${d.value}`,u=`${u}:${d.value}`,a=d,s+=1;continue}if(l.value==="'"&&a!==void 0&&d?.value==="s"&&l.position?.end!==void 0&&d.position?.start===l.position.end){n+="'s",a=d;let h=r[s+2];h&&ve(t,h.value)!==h.value?(o(ve(t,h.value),h),s+=2):s+=1;continue}let m=e?.possessive,p=r[s+2];if(m?.markerPosition==="between"&&m.marker&&l.kind==="selector"&&d?.value===m.marker&&p!==void 0&&ir(p,t)){o(`${l.value}'s`,l),o(ve(t,p.value),p),s+=2;continue}if(d?.value.toLowerCase()==="of"&&ve(t,l.value)!==l.value&&ir(l,t)){o(ve(t,l.value),l);continue}if(c!==void 0&&d){let h=e?.possessive?.connectors,E=!!h?.length&&h.some(g=>{let A=g.toLowerCase();return A===d.value.toLowerCase()||A===(d.normalized??"").toLowerCase()}),z=E?s+2:s+1,k=r[z];if(k&&ir(k,t)){o(at(c),l),o(ve(t,k.value),k),s=z;continue}if(E&&k&&/^\.[a-zA-Z_]\w*$/.test(k.value)&&d.position?.end!==void 0&&k.position?.start!==void 0&&d.position.end===k.position.start){o(at(c),l),o(ve(t,k.value.slice(1)),k),s=z;continue}if(!E&&/^\.[a-zA-Z_]\w*$/.test(d.value)&&l.position?.end!==void 0&&d.position?.start!==void 0&&l.position.end===d.position.start&&!Bs(e,l)){o(at(c),l),o(ve(t,d.value.slice(1)),d),s+=1;continue}}let f=r[s+2],y=dn(r,s,e,t);if(y!==void 0){for(let h=s;h<y;h+=2)o(ve(t,r[h].value),r[h]),o("of",r[h+1]);o(r[y].value,r[y]),s=y;continue}if(l.kind==="selector"&&d&&f&&je(e,d)&&ir(f,t)&&ve(t,f.value)!==f.value){o(ve(t,f.value),f),o("of",d),o(l.value,l),s+=2;continue}let v=Cr(r,s,e);if(v){for(let h of v.parts)o(h.text,h.token);s+=v.consumed-1;continue}o(or(t,l,r[s-1],d,u,r[s+2]),l);}return n.trim()}function Us(r){if(!r)return true;if(r.kind!=="keyword")return false;let e=(r.normalized??r.value).toLowerCase();return e==="then"||e==="end"||e==="else"}function pn(r){return !!r&&_e.has(r.value)}var Gs=class{constructor(r,e,t,i,n){this.patternToken=e,this.afterLiteral=t,this.nextPatternToken=i,this.wouldMatch=n;let a=r.position();this.token=r.tokens[a],this.prev=r.tokens[a-1],this.next=r.tokens[a+1],this.place=Ee(r.tokens,a);}get lastSlot(){return this.nextPatternToken===void 0}get tokenIsMarker(){return this.tokenIsMarkerMemo??(this.tokenIsMarkerMemo=this.wouldMatch(this.nextPatternToken,this.token)),this.tokenIsMarkerMemo}get beforeRole(){return this.nextPatternToken?.type==="role"}get nextIsMarker(){return this.nextIsMarkerMemo??(this.nextIsMarkerMemo=this.next!==void 0&&this.wouldMatch(this.nextPatternToken,this.next)),this.nextIsMarkerMemo}get clauseEndsAfter(){return Us(this.next)}};function Ys(r){let e=r.token.value.toLowerCase();if(e!=="a"&&e!=="an")return false;let t=r.next;return t!==void 0&&(Gr.has(t.value)||r.nextIsMarker)}function Ft(r){return r.kind==="keyword"&&dr.has((r.normalized??r.value).toLowerCase())}function Zs(r,e){let t=r.token;if(t.kind!=="keyword")return false;let i=(t.normalized??t.value).toLowerCase();return i==="then"?true:(i==="end"&&r.next?.kind!=="selector"||Yr(t.value,e))&&!Pe(r.place,e)}function Xs(r,e){return Ar(r.token,e)&&Pe(r.place,e)}function fn(r){return r.afterLiteral&&(r.clauseEndsAfter||r.nextIsMarker)}function Js(r,e){let t=r.patternToken.role;return t!=="quantity"&&!(t==="event"&&e==="repeat")?false:Ft(r.token)&&!fn(r)&&!r.nextIsMarker}function Qs(r){let e=r.patternToken;return !e.optional||e.role==="event"||e.role==="action"||e.valueShape==="keyword"||!Ft(r.token)?false:(r.lastSlot||r.tokenIsMarker)&&!fn(r)}function el(r,e,t,i){let n=r.type==="group"&&r.optional?r.tokens.every(u=>u.type==="role")?r.tokens[0]:void 0:r;if(!n||n.type!=="role"||!n.optional||n.role==="event"||n.role==="action"||n.valueShape==="keyword"||!e||e.kind!=="keyword"||t===void 0)return false;let a=i(t,e);return Ft(e)?!a:a}function rl(r){return dr.has((r.normalized??r.value).toLowerCase())}function tl(r,e){return r?.kind==="particle"&&!!e&&["selector","literal","identifier"].includes(e.kind)&&!pn(e)}function il(r){if(r.token.kind!=="particle")return false;let e=r.next;return e!==void 0&&r.nextIsMarker&&(e.kind==="particle"||r.prev?.kind==="particle")||r.afterLiteral&&r.beforeRole||r.clauseEndsAfter}function nl(r,e){let t=r.patternToken;if(t.role==="event"||t.role==="action"||t.valueShape==="keyword")return false;let i=t.expectedTypes;if(i?.length&&!i.some(a=>a==="expression"||a==="reference"))return false;let n=mn(r.token);return n==="structure"?true:n!=="verb"||(r.token.normalized??r.token.value).toLowerCase()==="empty"?false:!e?.hasBody&&!e?.roles.some(a=>a.role==="event")}function al(r){let e=(r.normalized||r.value).toLowerCase();if(e==="empty")return Gi("null");if(e==="a"||e==="an")return {type:"expression",raw:r.value}}function ul(r,e,t){return r.kind==="particle"&&(e||pn(t))}function yn(r,e){let t=r[e];return t?.kind==="particle"&&r[e-1]?.value.toLowerCase()==="of"&&/^[\p{L}_$][\p{L}\p{M}\p{N}_$]*$/u.test(t.value)}var ai=new Set(["is","am","are","be","was","were","not","no"]),ol=new Set(["\u0647\u0648","\u0E40\u0E1B\u0E47\u0E19","\u0939\u0948","\u0928\u0939\u0940\u0902","mana"]),hn=new Set(["empty","null","undefined"]);function sl(r,e,t,i){let n=(r.normalized??r.value).toLowerCase(),a=r.value.toLowerCase(),u=(e.normalized??e.value).toLowerCase();return (ai.has(n)||ai.has(qe(i,a))||ol.has(a)&&hn.has(u))&&!t}var ll=new Set(["'s","a","am","an","and","as","closest","contain","contains","do","does","empty","equal","equals","exist","exists","false","first","greater","has","have","in","include","includes","is","it","its","last","less","match","matches","me","mod","my","next","no","not","null","of","or","previous","really","some","than","the","true","undefined","you","your","result","target","body","detail"]),cl=new Set(["am","and","as","contain","contains","do","does","empty","equal","equals","exist","exists","greater","has","have","in","include","includes","is","less","match","matches","mod","no","not","of","or","really","some","than"]),ui=/\s+as\s+([A-Za-z]\w*)!?\s*$/;function vn(r){let e=r;for(let n=ui.exec(e);n;n=ui.exec(e)){if(!br(n[1]??""))return false;e=e.slice(0,n.index);}let t=e.replace(/"[^"]*"|'[^']*'/g,"");if(/["']/.test(t.replace(/'s\b/g,""))||/[^\x00-\x7F]/.test(t))return false;let i=pu(e);return !i.success||i.consumed===void 0||i.consumed!==$i(e).length-1?false:dl(i.node).every(br)}function dl(r){let e=[],t=i=>{if(Array.isArray(i)){i.forEach(t);return}if(!i||typeof i!="object")return;let n=i;n.type==="asExpression"&&e.push(String(n.targetType?.name??"")),Object.values(i).forEach(t);};return t(r),e}function zr(r,e){return r?.position?.end!==void 0&&e?.position?.start!==void 0&&r.position.end===e.position.start}var ml=new Set(["is","not","really","am","or"]);function En(r,e,t){let i=n=>{let a=r[n];return a?or(t,a,r[n-1],r[n+1],void 0).toLowerCase():""};return i(e)==="to"&&i(e-1)==="equal"&&ml.has(i(e-2))}function pl(r){return r.value==="a"}var fl=new Set(["event","window","document"]);function yl(r,e,t){let i=r[e],n=r[e-1];return !i||!n||!je(t,n)?false:fl.has((i.normalized??i.value).toLowerCase())}function hl(r,e){if(r.kind==="conjunction")return true;if(r.kind==="keyword"){let t=(r.normalized??r.value).toLowerCase();if(t==="then"||t==="end"||t==="else"||Yr(r.value,e.profile?.code??""))return true}return e.owes(r)}function oi(r,e,t){let i=t.profile?.code??"en";if(cn(i,r,e)||yn(r,e)||En(r,e,i)||pl(r[e]))return false;let n=r[e];return hl(n,t)||t.commandMarkers.has(n.value.toLowerCase())}function vl(r,e,t){let i=r[e],n=r[e-1],a=t.profile?.code??"en";if(i.kind==="literal"||i.value==="'"&&r[e+1]?.value==="s"||i.value==="s"&&n?.value==="'")return true;if(i.kind==="selector"){if(!i.value.startsWith(".")||!n||zr(n,i)||_e.has(n.value)||/^[([,]$/.test(n.value)||je(t.profile,n))return true;let o=or(a,n,r[e-2],i,void 0).toLowerCase();return cl.has(o)}if(_e.has(i.value)||/^[()[\],.!<>=+\-*/%]+$/.test(i.value)||je(t.profile,i)||sn(a,i,n,r[e+1])||cn(a,r,e)||yn(r,e)||yl(r,e,t.profile)||En(r,e,a))return true;let u=or(a,i,n,r[e+1],void 0).toLowerCase();return u==="as"&&t.hasResponseType?false:ll.has(u)?true:i.kind==="identifier"&&/^(?:[\p{L}_$][\p{L}\p{M}\p{N}_$]*('s)?|\([\p{L}_$][\p{L}\p{M}\p{N}_$]*\))$/u.test(i.value)}function El(r,e,t){if(!r[e]||oi(r,e,t))return [];let i=e;for(;i<r.length&&!oi(r,i,t)&&vl(r,i,t);)i++;let n=[];for(let a=i;a>e;a--)n.push(a);return n}function gl(r,e,t){let i=[],n=e;for(;;){let a=r[n];if(!a)break;if(a.value==="'"&&r[n+1]?.value==="s"&&r[n+2])n+=3;else if(/.'s$/.test(r[n-1]?.value??""))n+=1;else if(je(t,a)&&r[n+1])n+=2;else break;i.push(n);}return i.reverse()}function zl(r,e,t,i){for(let n of t){let a=Be(r.slice(e,n),i);if(vn(a))return {end:n,raw:a}}}[...St.roles.find(r=>r.role==="destination")?.expectedTypes??[]];[...St.roles.find(r=>r.role==="patient")?.expectedTypes??[]];var gn=[{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 st(r,e,t,i){let n=gn.find(u=>u.lang===r);if(!n)return false;let a=(u,o)=>(u??"").toLowerCase()===o.toLowerCase();return a(e,n.end)&&a(t,n.at)&&a(i,n.of)}function wl(r,e){let t=gn.find(n=>n.lang===r);if(!t)return false;let i=e.toLowerCase();return i===t.at.toLowerCase()||i===t.of.toLowerCase()||i===t.end.toLowerCase()}var zn=96,kl=/^[A-Za-z_][\w-]*$/,Cl=/^[A-Za-z_][\w-]*:[^\s'"`/:][^\s]*$/;function wn(r,e){let t=r.peek(e);return !!t&&t.kind==="identifier"&&Cl.test(t.value)}function kn(r,e){let t=r.peek(e);if(!t||t.kind!=="identifier"&&t.kind!=="keyword"||!kl.test(t.value))return false;let i=r.peek(e+1),n=r.peek(e+2);return !!i&&i.value===":"&&!!n}function si(r,e=0){return wn(r,e)||kn(r,e)}function bl(r){let e=r.peek();if(!e||e.value!=="{"&&e.value!=="(")return null;let t="",i=-1,n=0,a=0;for(;!r.isAtEnd()&&a++<zn;){let u=r.advance();if(!u)break;if(i>=0&&u.position.start>i&&(t+=" ".repeat(u.position.start-i)),t+=u.value,i=u.position.end,u.value==="{"||u.value==="(")n++;else if((u.value==="}"||u.value===")")&&(n--,n===0))return t}return null}function li(r){let e=r.peek();return e?e.value==="{"||e.value==="("?bl(r):e.value===","||e.value===":"?null:(r.advance(),e.value):null}function wr(r,e){let t=r.mark(),i=[];if(e!==void 0){let a=r.peek();if(!a||a.value!==":"||!r.peek(1))return null;r.advance();let u=li(r);if(u===null)return r.reset(t),null;i.push(`${e}:${u}`);}else if(!si(r))return null;let n=0;for(;n++<zn;){let a=r.peek();if(!a)break;if(a.value===","){if(i.length===0||!si(r,1))break;r.advance();continue}if(wn(r,0)){i.push(r.advance().value);continue}if(!kn(r,0))break;let u=r.advance().value;r.advance();let o=li(r);if(o===null)return r.reset(t),null;i.push(`${u}:${o}`);}return i.length===0?(r.reset(t),null):`{${i.join(", ")}}`}function Vr(r){switch(r.kind){case "selector":return Oe(r.value);case "literal":return Al(r.value);case "keyword":{let t=al(r);if(t)return t;let i=(r.normalized||r.value).toLowerCase();return Te(i)?Ae(i):Gi(i)??X(r.normalized||r.value)}case "identifier":if(r.value.startsWith("@"))return Oe(r.value);if(r.value.startsWith(":")||r.value.startsWith("$"))return Ae(r.value);let e=r.value.toLowerCase();return Te(e)?Ae(e):{type:"expression",raw:r.value};case "url":{let t=X(r.value,"string");return r.value.includes("${")?{...t,interpolates:true}:t}default:return null}}function Al(r){if(r.startsWith('"')||r.startsWith("'")||r.startsWith("`")||r.startsWith("\u300C")){let i=r.slice(1,-1);return X(i,"string")}if(r==="true")return X(true,"boolean");if(r==="false")return X(false,"boolean");let e=r.match(/^(\d+(?:\.\d+)?)(ms|s|m|h)?$/);if(e){let i=parseFloat(e[1]);return e[2]?X(r,"duration"):X(i,"number")}let t=parseFloat(r);return isNaN(t)?X(r,"string"):X(t,"number")}var _r=.8,Sl=.6,Dl=.15,xl=.5,ci=.15,di=.1,mi=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"]),Bl={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"]},Fl=class{calculate(r){return this.calculateWithBreakdown(r).final}calculateWithBreakdown(r){let e=this.scoreRoleCoverage(r),t=this.scoreStemPenalty(r),i=this.scoreLanguageBoost(r),n=this.scoreLanguageAdjustment(r),a=e;return a=Math.max(xl,a+t),a=Math.min(1,a+i),a=Math.max(0,Math.min(1,a+n)),{roleCoverage:e,stemPenalty:t,languageBoost:i,languageAdjustment:n,final:a}}scoreRoleCoverage(r){let{pattern:e,captured:t}=r,i=0,n=0,a=l=>e.extraction?.[l]?.default!==void 0,u=e.command==="on"?e.extraction?.action?.value:void 0,o=le[u??e.command]?.roles,s=l=>o?.find(c=>c.role===l)?.valueShape!==void 0;for(let l of e.template.tokens)if(l.type==="role")t.has(l.role)?(n+=1,i+=1):s(l.role)||(n+=1);else if(l.type==="group")for(let c of l.tokens)c.type==="role"&&(t.has(c.role)?(n+=_r,i+=_r):s(c.role)||(n+=_r,a(c.role)&&(i+=_r*Sl)));return n>0?i/n:1}scoreStemPenalty(r){let{stemMatchCount:e,totalKeywordMatches:t}=r;return e<=0||t<=0?0:-(e/t)*Dl}scoreLanguageBoost(r){let{pattern:e}=r;if(e.language!=="ar")return 0;let t=e.template.tokens[0];return !t||t.type!=="literal"?0:mi.has(t.value)||t.alternatives?.some(i=>mi.has(i))?ci:0}scoreLanguageAdjustment(r){let{pattern:e,captured:t}=r;if(e.language!=="ar")return 0;let i=0;for(let[n,a]of t.entries()){let u=Bl[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(-di,Math.min(di,i))}},Tl=new Fl,Ol=new Set(Object.values(le).filter(r=>r.bareKeyword===true).map(r=>r.action));function Rl(r){return r.startsWith("*")||r.startsWith("@")}var ne=class ${constructor(e){this.patternRest=[],this.slotAfterLiteral=false,this.wouldMatch=(t,i)=>this.patternTokenWouldMatch(t,i),this.matchCache=new Map,this.roleStarts=new Map,this.stemMatchCount=0,this.totalKeywordMatches=0,this.confidenceModel=e??Tl;}matchPattern(e,t){let i=e.mark(),n=new Map;if(this.currentProfile=R(t.language),this.currentPatternCommand=t.command,this.currentRoleCommand=t.extraction?.action?.value??t.command,this.stemMatchCount=0,this.totalKeywordMatches=0,this.roleStarts=new Map,this.eventSource=void 0,this.patternRest=[],!this.matchTokenSequence(e,t.template.tokens,n))return e.reset(i),null;let u=this.confidenceModel.calculate({pattern:t,captured:n,stemMatchCount:this.stemMatchCount,totalKeywordMatches:this.totalKeywordMatches});return this.applyExtractionRules(t,n),{pattern:t,captured:n,consumedTokens:e.position()-i.position,confidence:u,roleStarts:this.roleStarts,...this.eventSource?{eventSource:this.eventSource}:{}}}matchBest(e,t){this.matchCache.clear();let i=[],n=e.position();for(let u of t){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,t,i,n){let a=t[0],u=a?.type==="literal"&&(a.value==="and"||a.value==="then"||a.alternatives?.includes("and")||a.alternatives?.includes("then"));if(this.currentProfile?.code==="ar"&&!u)for(;e.peek()?.kind==="conjunction";)e.advance();let o=0;for(let s=0;s<t.length;s++){let l=t[s];if(o>0&&l.type==="literal"&&this.tryConsumeEventSourceClause(e,i,l),el(l,e.peek(),t[s+1]??n,this.wouldMatch)){let m=e.mark(),p=new Map(i);if(this.matchTokenSequence(e,t.slice(s+1),p,n)&&this.atClauseEnd(e)){i.clear();for(let[f,y]of p)i.set(f,y);return true}e.reset(m);}let c=this.patternRest;this.patternRest=[...t.slice(s+1),...c],this.slotAfterLiteral=l.type==="role"&&t[s-1]?.type==="literal";let d=this.matchPatternToken(e,l,i,t[s+1]??n);if(this.patternRest=c,o=l.type==="role"&&l.role==="event"?2:Math.max(0,o-1),!d){if(this.isOptional(l))continue;return false}}return true}tryConsumeEventSourceClause(e,t,i){if(t.has("source")||this.eventSource)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(d=>d.toLowerCase()===c)},s=u?.position;if(s!=="after"&&o(n)){let l=this.sourceNounValue(a);if(!l)return;e.advance(),e.advance(),this.eventSource=l;return}if(s==="after"&&o(a)){let l=this.sourceNounValue(n);if(!l)return;e.advance(),e.advance(),this.eventSource=l;}}sourceNounValue(e){if(e.kind==="selector")return this.tokenToSemanticValue(e)??void 0;if(e.kind!=="keyword"&&e.kind!=="identifier")return;let t=(e.normalized??e.value).toLowerCase();if(t!=="me"){if(Te(t))return {type:"reference",value:t};if(e.kind==="identifier"&&/^[A-Za-z_$][\w$]*$/.test(e.value))return {type:"expression",raw:e.value}}}matchPatternToken(e,t,i,n){switch(t.type){case "literal":return this.matchLiteralToken(e,t);case "role":{let a=e.position(),u=this.matchRoleToken(e,t,i,n);return u&&i.has(t.role)&&this.roleStarts.set(t.role,a),u}case "group":return this.matchGroupToken(e,t,i,n);default:return false}}matchLiteralToken(e,t){let i=e.peek();if(!i)return false;let n=this.getMatchType(i,t.value);if(n!=="none")return this.totalKeywordMatches++,n==="stem"&&this.stemMatchCount++,e.advance(),true;if(t.alternatives)for(let a of t.alternatives){let u=this.getMatchType(i,a);if(u!=="none")return this.totalKeywordMatches++,u==="stem"&&this.stemMatchCount++,e.advance(),true}for(let a of [t.value,...t.alternatives??[]])for(let u of ["-","_"])if(a.includes(u)&&this.tryMatchShatteredCompound(e,a,u))return this.totalKeywordMatches++,true;return false}tryFoldHyphenActionKeyword(e){let t=this.currentProfile;if(!t)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(t.keywords))if(o.primary.toLowerCase()===a||o.alternatives?.some(s=>s.toLowerCase()===a))return X(u);return e.reset(i),null}tryMatchShatteredCompound(e,t,i){let n=t.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,t,i,n){let a=e.position(),u=i.get(t.role);return this.matchRoleTokenCore(e,t,i,n)?(this.absorbTrailingConversion(e,t,i,n,a),this.absorbTrailingConditionOperand(e,t,i,n,a),this.absorbExpressionTail(e,t,i,n,a),this.stampCaptureSpan(e,t.role,i,a,u),true):false}absorbExpressionTail(e,t,i,n,a){if(t.role==="event"||t.role==="action"||this.isClassNameSlot(t)||!i.has(t.role)||e.position()<=a)return;let u=t.expectedTypes;if(u&&u.length>0&&!u.includes("expression"))return;let o=$.boundedByMarker(n)?El(e.tokens,e.position(),this.extentContext()):gl(e.tokens,e.position(),this.currentProfile),s=zl(e.tokens,a,o,this.currentProfile);if(s){for(;e.position()<s.end;)e.advance();i.set(t.role,{type:"expression",raw:s.raw,value:s.raw});}}extentContext(){let e=this.restLiterals();return {profile:this.currentProfile,owes:t=>e.some(i=>this.patternTokenWouldMatch(i,t)),commandMarkers:this.commandMarkers(),hasResponseType:!!this.currentSchema()?.roles.some(t=>t.role==="responseType")}}isClassNameSlot(e){return e.role==="patient"&&["add","remove","toggle","take"].includes(this.currentRoleCommand??"")}isObjectValueSlot(e){let t=this.currentRoleCommand;return e.role==="source"?t==="get":e.role==="patient"&&(t==="put"||t==="set")}static boundedByMarker(e){return !e||e.type==="literal"?true:e.type==="group"?e.tokens[0]?.type==="literal":false}restLiterals(){let e=[],t=i=>{for(let n of i)n.type==="literal"?e.push(n):n.type==="group"&&t(n.tokens);};return t(this.patternRest),e}currentSchema(){let e=this.currentRoleCommand;if(!(!e||!(e in le)))return le[e]}commandMarkers(){let e=this.currentSchema(),t=this.currentProfile,i=new Set;if(!e||!t)return i;for(let n of e.roles){let a=n.markerOverride?.[t.code];if(a){i.add(a.toLowerCase());continue}let u=t.roleMarkers[n.role];if(u){i.add(u.primary.toLowerCase());for(let o of u.alternatives??[])i.add(o.toLowerCase());}}return i.delete(""),i}stampCaptureSpan(e,t,i,n,a){let u=i.get(t);if(!u||u===a||u.position||e.position()<=n)return;let o=e.tokens[n],s=e.tokens[e.position()-1];!o||!s||i.set(t,Yi(u,{start:o.position.start,end:s.position.end}));}absorbTrailingConditionOperand(e,t,i,n,a){if(t.role!=="condition"||!i.has("condition")||e.position()<=a)return;let u=this.currentPatternCommand==="repeat";if(!u&&(n!==void 0||this.currentPatternCommand!=="on"))return;let o=$.CONDITION_OPERATOR_WORDS,s=m=>{let p=(m.normalized??"").toLowerCase(),f=m.value.toLowerCase();if(o.has(p)||o.has(f))return true;let y=$.LOOP_CONDITION_OPERATORS;return u&&(y.has(f)||y.has(p))},l=m=>!!m&&(m.kind==="selector"||m.kind==="identifier"||m.kind==="literal")&&!s(m)&&!dr.has((m.normalized??m.value).toLowerCase())&&!this.patternTokenWouldMatch(n,m),c=false;for(;;){let m=e.peek();if(!m||!s(m)||this.patternTokenWouldMatch(n,m))break;e.advance(),c=true;let p=e.peek();if(l(p)){e.advance();for(let f=e.peek();!(!f||!/^\.[a-zA-Z_]\w*$/.test(f.value)||f.position.start!==p.position.end);f=e.peek())e.advance(),p=f;}if(!u)break}if(!c)return;let d=Be(e.tokens.slice(a,e.position()),this.currentProfile);i.set("condition",{type:"expression",raw:d,value:d});}conversionRunLength(e){let t=e.peek();if(!t||(t.normalized??t.value).toLowerCase()!=="as"&&t.value.toLowerCase()!=="as")return 0;let n=this.conversionTypeLength(e,1);if(n===0)return 0;for(n+=1;;){if(e.peek(n)?.value!=="|")return n;let a=this.conversionTypeLength(e,n+1);if(a===0)return n;n+=1+a;}}conversionTypeLength(e,t){let i=e.peek(t)?.value.toLowerCase(),n=i==="a"||i==="an"?t+1:t,a=e.peek(n);if(!a)return 0;let u=e.peek(n+1),o=e.peek(n+2);return u?.value===":"&&o&&zr(a,u)&&zr(u,o)&&br(`${a.value}:${o.value}`)?n-t+3:br(a.value)?n-t+1:0}absorbTrailingConversion(e,t,i,n,a){if(t.role==="event"||t.role==="action"||!i.has(t.role)||e.position()<=a)return;let u=this.conversionRunLength(e);if(u===0||this.patternTokenWouldMatch(n,e.peek()))return;for(let s=0;s<u;s++)e.advance();let o=Be(e.tokens.slice(a,e.position()),this.currentProfile);i.set(t.role,{type:"expression",raw:o,value:o});}matchRoleTokenCore(e,t,i,n){this.skipNoiseWords(e,t,n);let a=e.peek();if(!a)return t.optional||false;let u=this.slotAt(e,t,n);if(t.role==="action"&&this.currentProfile&&e.peek(1)?.value==="-"){let g=this.tryFoldHyphenActionKeyword(e);if(g)return i.set(t.role,g),true}if(t.role==="event"&&this.currentPatternCommand==="on"){if(!$.tokenLooksLikeEvent(a))return t.optional||false;let g=(a.normalized??a.value).toLowerCase();if($.POSITIONAL_OR_SCOPE_KEYWORDS.has(g)||$.VISIBILITY_STRATEGIES.has(g)||this.currentProfile&&(De(this.currentProfile,a.value)??De(this.currentProfile,g))!==void 0||a.value.includes("?."))return t.optional||false}if(t.role==="event"){let g=(a.normalized??a.value).toLowerCase();if($.STRUCTURAL_NEVER_EVENT.has(g))return t.optional||false}if(Zs(u,this.currentProfile?.code??"")||Js(u,this.currentPatternCommand))return t.optional||false;if(t.role==="duration"){let g=(a.normalized??a.value).toLowerCase();if($.POSITIONAL_OR_SCOPE_KEYWORDS.has(g))return t.optional||false}if(Qs(u))return true;if(this.roleAcceptsPropertyPath(t)){let g=this.tryMatchPositionalPossessiveExpression(e,n);if(g)return i.set(t.role,g),true}let o=this.tryMatchPositionalExpression(e,n);if(o)return t.expectedTypes&&t.expectedTypes.length>0&&!Mr(o.type,t.expectedTypes)?t.optional||false:(i.set(t.role,o),true);let s=this.tryMatchCaretScopeExpression(e);if(s)return t.expectedTypes&&t.expectedTypes.length>0&&!Mr(s.type,t.expectedTypes)?t.optional||false:(i.set(t.role,s),true);let l=this.tryMatchParenReceiverCall(e);if(l)return t.expectedTypes&&t.expectedTypes.length>0&&!t.expectedTypes.includes("expression")?t.optional||false:(i.set(t.role,l),true);if(t.role!=="event"&&(!t.expectedTypes||t.expectedTypes.includes("expression"))){let g=this.tryMatchBeepPrefixExpression(e);if(g)return i.set(t.role,g),true;let A=this.tryMatchHyphenatedWord(e);if(A)return i.set(t.role,A),true;let C=this.isWrittenTarget(t)?null:this.tryMatchOperatorRunExpression(e);if(C)return i.set(t.role,C),true}if(this.currentPatternCommand==="pick"&&t.role==="patient"&&(!t.expectedTypes||t.expectedTypes.includes("expression"))){let g=this.tryMatchPickRangeExpression(e);if(g)return i.set(t.role,g),true}if(this.roleAcceptsPropertyPath(t)){let g=this.tryMatchOfPossessiveExpression(e,n);if(g)return i.set(t.role,g),true;let A=this.tryMatchPostNominalPossessiveExpression(e);if(A)return i.set(t.role,A),true}let c=this.tryMatchPossessiveExpression(e);if(c)return t.expectedTypes&&t.expectedTypes.length>0&&!t.expectedTypes.includes(c.type)&&!t.expectedTypes.includes("expression")?t.optional||false:(i.set(t.role,c),true);let d=this.tryMatchMethodCallExpression(e);if(d)return t.expectedTypes&&t.expectedTypes.length>0&&!t.expectedTypes.includes(d.type)&&!t.expectedTypes.includes("expression")?t.optional||false:(i.set(t.role,d),true);let p=t.role==="event"&&this.currentPatternCommand==="on"||$.DECLARATION_COMMANDS.has(this.currentPatternCommand??"")||this.isWrittenTarget(t)?null:this.tryMatchBareCallExpression(e);if(p)return t.expectedTypes&&t.expectedTypes.length>0&&!t.expectedTypes.includes(p.type)&&!t.expectedTypes.includes("expression")?t.optional||false:(i.set(t.role,p),true);let f=this.tryMatchPossessiveSelectorExpression(e);if(f)return t.expectedTypes&&t.expectedTypes.length>0&&!Mr(f.type,t.expectedTypes)?t.optional||false:(i.set(t.role,f),true);let y=t.role!=="condition",v=this.tryMatchPropertyAccessExpression(e,y);if(v)return t.expectedTypes&&t.expectedTypes.length>0&&!t.expectedTypes.includes(v.type)&&!t.expectedTypes.includes("expression")?t.optional||false:(i.set(t.role,v),true);let h=this.tryMatchSelectorPropertyExpression(e);if(h)return t.expectedTypes&&t.expectedTypes.length>0&&!Mr(h.type,t.expectedTypes)?t.optional||false:(i.set(t.role,h),true);if(a.value==="("&&t.role!=="event"&&t.role!=="action"&&(!t.expectedTypes?.length||t.expectedTypes.some(g=>g==="expression"||g==="selector"||g==="reference"))){let g=this.tryMatchParenGroupExpression(e);if(g)return i.set(t.role,g),true}if(a.kind==="identifier"&&a.value==="{"){let g=t.expectedTypes,C=g?.length===1&&g[0]==="expression"||this.isObjectValueSlot(t)?this.tryMatchBraceRunExpression(e):!g?.length||g.includes("literal")?this.tryMatchBraceRunLiteral(e):null;if(C)return i.set(t.role,C),true}if(t.role==="style"&&t.expectedTypes?.length===1&&t.expectedTypes[0]==="expression"){let g=wr(e);if(g)return i.set(t.role,{type:"expression",raw:g}),true}if(il(u)||nl(u,this.currentSchema())||Xs(u,this.currentProfile?.code??""))return i.set(t.role,{type:"expression",raw:a.value}),e.advance(),true;let E=this.tokenToSemanticValue(a);if(!E)return t.optional||false;if(t.expectedTypes&&t.expectedTypes.length>0&&!t.expectedTypes.includes(E.type)){let g=E.type==="selector"&&String(E.value).startsWith("@"),A=t.expectedTypes.some(C=>C==="expression"||C==="reference");if(!(g&&A))return t.optional||false}t.valueShape==="keyword"&&E.type==="expression"?i.set(t.role,X(String(E.raw??""))):i.set(t.role,E),e.advance();let z=this.isClassNameSlot(t);if(E.type==="selector"&&(E.value.startsWith("<")||E.value.startsWith(".")&&!z)&&t.role!=="event"){let g=tn(e.tokens,e.position(),this.currentProfile,A=>A===void 0?false:this.patternTokenWouldMatch(n,A));if(g){let[A,C]=g.scope.parts,S=g.scope.kind==="reference"?Ae(A.text):g.scope.kind==="closest"?{type:"expression",raw:`closest ${C.text}`}:this.tokenToSemanticValue(A.token);for(let x=0;x<1+g.scope.consumed;x++)e.advance();i.set(t.role,{...E,scope:S});}}if(t.role==="event"){let g=e.peek();g&&g.kind==="selector"&&g.value.startsWith("[")&&g.position.start===a.position.end&&"value"in E&&(i.set(t.role,X(`${String(E.value)}${g.value}`)),e.advance());let A=e.peek();if(A&&(A.kind==="particle"||A.kind==="keyword")&&(A.normalized??"").toLowerCase()==="source"&&!this.patternTokenWouldMatch(n,A)){let C=e.peek(1),S=C?this.sourceNounValue(C):void 0;S&&!this.eventSource&&(e.advance(),e.advance(),this.eventSource=S);}}return true}atClauseEnd(e){let t=e.peek();if(!t||t.kind==="conjunction")return true;if(t.kind!=="keyword")return false;let i=(t.normalized??t.value).toLowerCase();return i==="then"||i==="end"?true:Yr(t.value,this.currentProfile?.code??"")}patternTokenWouldMatch(e,t){return e?e.type==="literal"?this.getMatchType(t,e.value)!=="none"?true:!!e.alternatives?.some(i=>this.getMatchType(t,i)!=="none"):e.type==="group"?this.patternTokenWouldMatch(e.tokens?.[0],t):false:false}tryMatchPositionalExpression(e,t){let i=Cr(e.tokens,e.position(),this.currentProfile,n=>n===void 0?false:this.patternTokenWouldMatch(t,n));if(!i)return null;for(let n=0;n<i.consumed;n++)e.advance();return {type:"expression",raw:i.parts.map(n=>n.text).join(" ")}}tryMatchCaretScopeExpression(e){let t=e.peek();if(!t||t.kind!=="identifier"||!t.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:`${t.value} on ${n.value}`})}isOfPossessiveMarker(e){return je(this.currentProfile,e)}logicalConnectiveOf(e){let t=e.peek();if(!t)return;let i=this.currentProfile?.code??"en",n=s=>s==="and"||s==="or"||s==="not",a=qe(i,t.value).toLowerCase();if(n(a))return a;if(this.commandMarkers().has(t.value.toLowerCase()))return;let u=e.position(),o=Ns(i,t,e.tokens[u-1],e.tokens[u+1]);return o&&n(o)?o:void 0}tryConsumeRunPhrase(e){let t=this.currentProfile?.code??"en",i=e.tokens,n=e.position(),a=[],u;for(let o=0;o<6&&n+o<i.length;o++){let s=i[n+o],l=or(t,s,i[n+o-1],i[n+o+1],u).toLowerCase();a.push(l),u=l;}for(let[o,s]of $.RUN_PHRASES)if(o.every((l,c)=>a[c]===l)){for(let l=0;l<o.length;l++)e.advance();return s}}slotAt(e,t,i){return new Gs(e,t,this.slotAfterLiteral,i,this.wouldMatch)}static isBareWordToken(e){return !!e&&/^[A-Za-z_][A-Za-z0-9_]*$/.test(e.value)}tryMatchBeepPrefixExpression(e){let t=e.peek(),i=e.peek(1);if(!t||!i||i.value!=="!"||(t.normalized??t.value).toLowerCase()!=="beep"||!(t.position?.end!==void 0&&i.position?.start!==void 0&&t.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||!_e.has(s.value))break;let l=e.mark();if(e.advance(),!this.tryConsumeRunOperand(e,true)){e.reset(l);break}}let o=Be(e.tokens.slice(u,e.position()),this.currentProfile);return {type:"expression",raw:o,value:o}}tryMatchHyphenatedWord(e){let t=e.peek();if(!$.isBareWordToken(t))return null;let i=1,n=[t.value];for(;;){let a=e.peek(i),u=e.peek(i+1);if(!a||a.value!=="-"||!$.isBareWordToken(u)||!zr(e.peek(i-1),a)||!zr(a,u))break;n.push(u.value),i+=2;}if(n.length<2)return null;for(let a=0;a<i;a++)e.advance();return X(n.join("-"),"string")}tryMatchOperatorRunExpression(e){let t=e.mark(),i=e.position(),n=e.peek(),a=!!n&&(this.logicalConnectiveOf(e)==="not"||n.value==="-");if(!this.tryConsumeRunOperand(e))return e.reset(t),null;let u=1;for(;;){let s=e.peek();if(!s)break;let l=this.logicalConnectiveOf(e),c=(l==="and"||l==="or")&&this.currentRoleCommand!=="wait",d=e.mark();if(c||_e.has(s.value))e.advance();else {let m=this.tryConsumeRunPhrase(e);if(m===void 0)break;if(m==="none"){u++;continue}}if(!this.tryConsumeRunOperand(e,true,c)){e.reset(d);break}u++;}if(u<2&&!a)return e.reset(t),null;let o=Be(e.tokens.slice(i,e.position()),this.currentProfile);return {type:"expression",raw:o,value:o}}static rangeSeparatorFor(e){let[t]=$.PICK_RANGE_SEPARATORS_BY_LANG[e]??[];return t}isPickRangeSeparator(e){let t=(e.normalized??e.value).toLowerCase();if($.PICK_RANGE_SEPARATORS.has(t))return true;let i=this.currentProfile?.code;return i?$.PICK_RANGE_SEPARATORS_BY_LANG[i]?.has(e.value.toLowerCase())??false:false}tryMatchPickRangeExpression(e){let t=e.mark(),i=e.position();if(!this.tryConsumePickRangeOperand(e))return e.reset(t),null;let n=e.peek();if(!n||!this.isPickRangeSeparator(n)||(e.advance(),!this.tryConsumePickRangeOperand(e)))return e.reset(t),null;let a=e.peek();a&&$.PICK_RANGE_MODES.has((a.normalized??a.value).toLowerCase())&&e.advance();let u=e.tokens.slice(i,e.position()),[o,,s,l]=u,c=m=>m.kind==="keyword"?m.normalized??m.value:m.value,d=`${c(o)} to ${c(s)}`;return l&&(d+=` ${(l.normalized??l.value).toLowerCase()}`),{type:"expression",raw:d,value:d}}tryConsumePickRangeOperand(e){let t=e.peek();if(!t)return false;let i=(t.normalized??t.value).toLowerCase();if(this.isPickRangeSeparator(t))return false;let n=i==="start"||i==="end";return t.kind==="literal"||t.kind==="identifier"||t.kind==="keyword"&&n?(e.advance(),true):false}tryConsumeRunOperand(e,t=false,i=false){let n=e.peek();if(!n)return false;if(this.logicalConnectiveOf(e)==="not"){let u=e.mark();return e.advance(),tl(e.peek()??void 0,e.peek(1)??void 0)?(e.reset(u),false):this.tryConsumeRunOperand(e,true,i)?true:(e.reset(u),false)}if(n.value==="-"){let u=e.mark();return e.advance(),this.tryConsumeRunOperand(e,true,i)?true:(e.reset(u),false)}if(i&&rl(n))return false;if(ul(n,t,e.peek(1)??void 0))return e.advance(),true;if(n.value==="("){let u=e.mark(),o=0;for(;!e.isAtEnd();){let s=e.advance();if(s.value==="(")o++;else if(s.value===")"&&(o--,o===0))return true}return e.reset(u),false}if(this.tryMatchPossessiveExpression(e))return true;if(n.value.toLowerCase()==="the"){let u=e.mark();if(e.advance(),this.tryConsumeRunOperand(e,t,i))return true;e.reset(u);}if(this.tryMatchOfPossessiveExpression(e)||this.tryMatchPossessiveSelectorExpression(e)||this.tryMatchPropertyAccessExpression(e,true)||this.tryMatchSelectorPropertyExpression(e))return true;let a=(n.normalized??"").toLowerCase();return (n.kind==="literal"||n.kind==="identifier"||n.kind==="selector"||n.kind==="keyword")&&!_e.has(n.value)&&!["then","else"].includes(a)&&(a!=="end"||this.endWordIsValueAt(e))&&n.value!==")"?(e.advance(),true):false}endWordIsValueAt(e){return Pe(Ee(e.tokens,e.position()),this.currentProfile?.code??"")}isPossessorToken(e){if(!this.currentProfile)return false;for(let t of [e.value,e.normalized].filter(Boolean))if(De(this.currentProfile,t)??De(this.currentProfile,t.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?ve(this.currentProfile.code,e):e}roleAcceptsPropertyPath(e){if(e.type!=="role")return false;if(e.expectedTypes)return e.expectedTypes.includes("property-path");let t=this.currentRoleCommand;return t?le[t]?.roles.find(a=>a.role===e.role)?.expectedTypes?.includes("property-path")??false:false}tryMatchOfPossessiveExpression(e,t){let i=e.peek();if(!i||!(i.kind==="selector"?/^[*@]/.test(i.value):this.isBareWordPropertyHead(i)))return null;let a=e.position(),u=e.mark();e.advance();let o=e.peek();if(!o||!this.isOfPossessiveMarker(o))return e.reset(u),null;e.advance(),e.peek()?.value.toLowerCase()==="the"&&e.advance();let s=Cr(e.tokens,e.position(),this.currentProfile,c=>c===void 0?false:this.patternTokenWouldMatch(t,c));if(s){for(let c=0;c<s.consumed;c++)e.advance();return Re({type:"expression",raw:s.parts.map(c=>c.text).join(" ")},this.toEnglishProperty(i.value),"possessive")}let l=e.peek();if(!l||l.kind!=="selector"||Rl(l.value)){if(e.reset(u),this.patternTokenWouldMatch(t,o))return null;let c=this.currentProfile?.code??"en",d=dn(e.tokens,a,this.currentProfile,c);if(d===void 0)return null;for(;e.position()<=d;)e.advance();let m=Be(e.tokens.slice(a,d+1),this.currentProfile);return {type:"expression",raw:m,value:m}}return e.advance(),Re(Oe(l.value),this.toEnglishProperty(i.value),"possessive")}tryMatchPositionalPossessiveExpression(e,t){let i=this.currentProfile,n=i?.possessive?.marker;if(!i||!n||i.possessive?.markerPosition!=="between"||i.code==="th")return null;let a=Cr(e.tokens,e.position(),i,l=>l===void 0?false:this.patternTokenWouldMatch(t,l));if(!a)return null;let u=e.peek(a.consumed),o=e.peek(a.consumed+1);if(!u||u.value!==n)return null;let s=!!o&&(this.isBareWordPropertyHead(o)||o.kind==="selector"&&o.value.startsWith("*")||o.kind==="keyword"&&Jt(i.code,o.value));if(!o||!s)return null;for(let l=0;l<a.consumed+2;l++)e.advance();return Re({type:"expression",raw:a.parts.map(l=>l.text).join(" ")},this.toEnglishProperty(o.value),"possessive")}tryMatchPossessiveExpression(e){let t=e.peek();if(!t||!this.currentProfile)return null;let i=[t.value,t.normalized].filter(Boolean),n;for(let s of i)if(n=De(this.currentProfile,s)??De(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(d=>d.toLowerCase()===l||d.toLowerCase()===c)&&e.advance();}}let o=e.peek();if(!o||wl(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&&$.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 d=e.peek();if(d?.kind==="selector"&&d.value.startsWith(".")&&/^\.[a-zA-Z_]\w*/.test(d.value)){l+=d.value,e.advance();continue}if(d?.value==="?"){let m=e.peek(1);if(m?.kind==="selector"&&m.value.startsWith(".")&&/^\.[a-zA-Z_]\w*/.test(m.value)){l+=`?${m.value}`,e.advance(),e.advance();continue}}break}let c=e.peek();if(c&&c.value.startsWith("(")){let d="",m=0,p=0;for(;!e.isAtEnd()&&p++<$.MAX_METHOD_ARGS+2;){let f=e.peek();if(!f)break;d+=f.value,e.advance();for(let y of f.value)y==="("?m++:y===")"&&m--;if(m<=0)break}l+=d;}return Re(Ae(n),l,"possessive")}return e.reset(a),null}tryMatchPostNominalPossessiveExpression(e){if(!this.currentProfile||this.currentProfile.possessive?.markerPosition!=="after-object")return null;let t=e.peek();if(!t)return null;let i=t.kind==="selector"&&t.value.startsWith(".")&&/^\.[a-zA-Z_]\w*/.test(t.value);if(!(t.kind==="identifier"&&!this.isStructuralKeyword(t.value)&&!(t.normalized&&this.isStructuralKeyword(t.normalized))&&!(t.normalized&&this.isRoleMarkerConcept(t.normalized))||t.kind==="selector"&&(t.value.startsWith("*")||t.value.startsWith("@"))||i)||this.isPossessorToken(t))return null;let a=e.mark(),u=t.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 d of [s.value,s.normalized].filter(Boolean))if(l=De(this.currentProfile,d)??De(this.currentProfile,d.toLowerCase()),l)break;if(!l)return e.reset(a),null;let c=e.mark();return this.tryMatchPossessiveExpression(e)?(e.reset(a),null):(e.reset(c),e.advance(),Re(Ae(l),o,"possessive"))}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 Sr.has(e.toLowerCase())}static tokenLooksLikeEvent(e){if(e.kind==="selector"||e.kind==="url"||e.kind==="literal")return false;let t=e.value;if(/[/#@*]/.test(t)||t.startsWith('"')||t.startsWith("'")||t.startsWith("`"))return false;let i=e.normalized?.toLowerCase();return !(i&&Ol.has(i)||i==="me"||i==="it"||i==="you")}tryMatchBraceRunLiteral(e){let t=e.peek();if(!t||t.kind!=="identifier"||t.value!=="{")return null;let i=e.mark();e.advance();let n=["{"],a=1,u=0;for(;!e.isAtEnd()&&u++<$.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("}"),X(n.join(" "));n.push(o.value);}return e.reset(i),null}tryMatchBraceRunExpression(e){let t=e.peek();if(!t||t.kind!=="identifier"||t.value!=="{")return null;let i=e.mark(),n="",a=-1,u=0,o=0;for(;!e.isAtEnd()&&o++<$.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 t=e.peek();if(!t||t.kind!=="identifier"||!/^[A-Za-z_][\w$]*$/.test(t.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++<$.MAX_METHOD_ARGS+2;){let c=e.peek();if(!c)break;if(c.value===")"){e.advance(),s=true;break}let d=o!==void 0&&c.position?.start===o;u+=(u===""||d?"":" ")+c.value,o=c.position?.end,e.advance();}return s?{type:"expression",raw:`${t.value}(${u})`}:(e.reset(n),null)}tryMatchMethodCallExpression(e){let t=e.peek();if(!t||t.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<$.MAX_METHOD_ARGS;){let l=e.peek();if(!l)break;if(l.kind==="punctuation"&&l.value===")"){e.advance();break}if(l.kind==="punctuation"&&l.value===","){e.advance();continue}o.push(l.value),e.advance();}return {type:"expression",raw:`${t.value}.${a.value}(${o.join(", ")})`}}tryMatchParenReceiverCall(e){if(e.peek()?.value!=="(")return null;let t=e.mark(),i=[];e.advance();let n=1;for(;!e.isAtEnd()&&i.length<=$.MAX_METHOD_ARGS*4;){let c=e.peek();if(e.advance(),c.value==="(")n++;else if(c.value===")"&&--n===0)break;i.push(c);}let a=e.tokens[e.position()-1],u=e.peek();if(n!==0||i.length===0||!u||u.kind!=="selector"||!/^\.[A-Za-z_$][\w$]*$/.test(u.value)||!$.abuts(a,u))return e.reset(t),null;e.advance();let o=e.peek();if(o?.value!=="("||!$.abuts(u,o))return e.reset(t),null;let s=this.consumeCallParens(e);return s===null?(e.reset(t),null):{type:"expression",raw:`(${Be(i,this.currentProfile)})${u.value}${s}`}}tryMatchParenGroupExpression(e){if(e.peek()?.value!=="(")return null;let t=e.mark();e.advance();let i=[],n=1;for(;!e.isAtEnd();){let l=e.peek();if(e.advance(),l.value==="(")n++;else if(l.value===")"&&--n===0)break;i.push(l);}let a=e.tokens[e.position()-1],u=e.peek(),o=!!u&&(u.value==="'"||_e.has(u.value)||$.abuts(a,u)&&(u.value.startsWith(".")||u.value==="("));if(n!==0||i.length===0||o)return e.reset(t),null;let s=`(${Be(i,this.currentProfile)})`;return {type:"expression",raw:s,value:s}}static abuts(e,t){return !!e&&!!t&&e.position.end===t.position.start}consumeCallParens(e){let t=e.mark(),i=[],n=0;for(;!e.isAtEnd();){let a=e.peek();if(!a)break;if(i.push(a.value),e.advance(),a.value==="(")n++;else if(a.value===")"&&--n===0)return i.join("")}return e.reset(t),null}tryMatchPropertyAccessExpression(e,t=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"||$.PROPERTY_ACCESS_BASES.has(a))&&u&&u.kind==="selector"&&/^\.[a-zA-Z_]/.test(u.value)&&u.position.start===i.position.end){let p=i.value,f=[],y=0;for(;y<$.MAX_PROPERTY_DEPTH;){let E=e.peek();if(E&&E.kind==="selector"&&/^\.[a-zA-Z_]/.test(E.value))p+=`.${E.value.slice(1)}`,f.push(E.value.slice(1)),e.advance(),y++;else break}let v=e.peek(),h=!!v&&v.value.startsWith("(");return t&&!h&&f.length>0&&Te(a)?Re(Ae(a),f.join("."),"dot"):(h&&(p+=this.consumeCallParens(e)??""),{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<$.MAX_PROPERTY_DEPTH;){let p=e.peek();if(!p||p.kind!=="operator"||p.value!==".")break;e.advance();let f=e.peek();if(!f||f.kind!=="identifier")break;e.advance(),l+=`.${f.value}`,c++;}let d=e.peek();if(d&&d.kind==="punctuation"&&d.value==="("){e.advance();let p=[],f=0;for(;!e.isAtEnd()&&p.length<$.MAX_METHOD_ARGS;){let v=e.peek();if(!v)break;if(v.kind==="punctuation"&&v.value===")"){if(f===0){e.advance();break}f--;}if(v.kind==="punctuation"&&v.value==="("&&f++,v.kind==="punctuation"&&v.value===","){e.advance();continue}p.push(v.value),e.advance();}return {type:"expression",raw:`${l}(${p.join(", ")})`}}let m=i.value.toLowerCase();if(t&&Te(m)){let p=l.split(".").slice(1).join(".");return Re(Ae(m),p,"dot")}return {type:"expression",raw:l}}tryMatchPossessiveSelectorExpression(e){let t=e.peek();if(!t||t.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 f=le[this.currentPatternCommand];return !!f&&f.roles.some(y=>y.role==="source")})(),l=!!n&&!!a&&a!=="'s"&&n.value===a&&(n.kind==="particle"||n.kind==="punctuation"||n.kind==="identifier")&&!s;if(!u&&!l&&!o)return e.reset(i),null;e.advance(),o&&e.advance();let c=e.peek();if(!c)return e.reset(i),null;let d=c.kind==="selector"&&c.value.startsWith("*"),m=c.kind==="keyword"&&!!this.currentProfile&&Jt(this.currentProfile.code,c.value);return c.kind==="identifier"||d||m||(u||o)&&(c.kind==="selector"||c.kind==="keyword")?(e.advance(),Re(Oe(t.value),this.toEnglishProperty(c.value),"possessive")):(e.reset(i),null)}tryMatchSelectorPropertyExpression(e){let t=e.peek();if(!t||t.kind!=="selector"||!t.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;e.advance();let a=[n.value.slice(1)],u=n;for(let s=e.peek();s&&s.kind==="selector"&&/^\.[a-zA-Z_]/.test(s.value)&&a.length<$.MAX_PROPERTY_DEPTH;s=e.peek())a.push(s.value.slice(1)),u=s,e.advance();let o=e.peek();if(o?.value==="("&&$.abuts(u,o)){let s=this.consumeCallParens(e);if(s!==null)return {type:"expression",raw:`${t.value}.${a.join(".")}${s}`}}return Re(Oe(t.value),a.join("."),"dot")}matchGroupToken(e,t,i,n){let a=e.mark(),u=new Map(i),o=this.matchTokenSequence(e,t.tokens,i,n);if(o){let s=[];for(let l of t.tokens)if(l.type==="group"&&l.renderRequired)for(let c of l.tokens)c.type==="literal"&&s.push(c.value,...c.alternatives??[]);s.length>0&&[...i.keys()].some(c=>!u.has(c))&&(e.tokens.slice(a.position,e.position()).some(m=>s.some(p=>this.getMatchType(m,p)!=="none"))||(o=false));}if(!o){e.reset(a);for(let s of i.keys())u.has(s)||i.delete(s);for(let[s,l]of u)i.get(s)!==l&&i.set(s,l);return t.optional||false}return true}getMatchType(e,t){if(e.value===t)return "exact";if(e.normalized===t)return "normalized";if(e.stem===t&&e.stemConfidence!==void 0&&e.stemConfidence>=.7)return "stem";if(e.kind==="keyword"&&e.value.toLowerCase()===t.toLowerCase())return "case-insensitive";if(e.kind==="keyword"){let i=Lr(e.value).toLowerCase();if(i&&i===Lr(t).toLowerCase())return "case-insensitive"}return "none"}isWrittenTarget(e){return $.WRITTEN_ROLE[this.currentRoleCommand??""]===e.role}tokenToSemanticValue(e){return Vr(e)}applyExtractionRules(e,t){for(let[i,n]of Object.entries(e.extraction)){let a=t.get(i);if(a){if(n.transform){let u=a.type==="literal"?String(a.value):String(a.raw??"");t.set(i,n.transform(u));}}else n.value!==void 0?t.set(i,{type:"literal",value:n.value}):n.default&&t.set(i,{...n.default,implicit:true});}}isOptional(e){return e.type!=="literal"&&e.optional===true}skipNoiseWords(e,t,i){let n=e.peek();if(!n)return;let a=n.value.toLowerCase();if($.ENGLISH_NOISE_WORDS.has(a)){if(Ys(this.slotAt(e,t,i)))return;let u=e.mark();e.advance();let o=e.peek();if(o&&(o.kind==="selector"||o.kind==="identifier"))return;let s=e.peek(1);if(o&&o.kind==="keyword"&&s&&s.kind==="selector"&&/^\.[a-zA-Z_]/.test(s.value))return;let l=o?(o.normalized??o.value).toLowerCase():"";if(o&&$.POSITIONAL_OR_SCOPE_KEYWORDS.has(l))return;let c=e.peek(1),d=c?(c.normalized??c.value).toLowerCase():"",m=this.currentProfile?.wordOrder!=="SOV"&&$.COMMAND_ACTION_KEYWORDS.has(d),p=!c||c.kind==="particle"||$.CLAUSE_BOUNDARY_KEYWORDS.has(d)||m;if(o&&o.kind==="keyword"&&this.currentProfile?.code!=="en"&&Te(l)&&p||o&&o.kind==="keyword"&&this.currentProfile?.code==="en"&&Te(l))return;e.reset(u);}a==="class"&&e.advance();}extractEventModifiers(e){let t={},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":t.once=true;break;case "debounce":typeof a.value=="number"&&(t.debounce=a.value);break;case "throttle":typeof a.value=="number"&&(t.throttle=a.value);break;case "queue":(a.value==="first"||a.value==="last"||a.value==="all"||a.value==="none")&&(t.queue=a.value);break}e.advance();}return i?t:void 0}};ne.CONDITION_OPERATOR_WORDS=new Set(["matches","match","contains","exists","has","have","equals","includes"]);ne.LOOP_CONDITION_OPERATORS=new Set([...Zi,"and","or"]);ne.POSITIONAL_OR_SCOPE_KEYWORDS=new Set(["first","last","next","previous","random","closest","parent"]);ne.STRUCTURAL_NEVER_EVENT=new Set(["if","unless","else","end","then","while"]);ne.PROPERTY_ACCESS_BASES=new Set(["it","me","you","my","its","your","event","result","target","detail","body","window","document","self","this"]);ne.COMMAND_ACTION_KEYWORDS=dr;ne.CLAUSE_BOUNDARY_KEYWORDS=new Set(["then","and","or","end","else"]);ne.RUN_PHRASES=[...kt.map(r=>[r.split(" "),"none"]),...Ct.map(r=>[r.split(" "),"type"]),...wt.filter(r=>!/^(in|am|has|have)$|^am /.test(r)).map(r=>[r.split(" "),"operand"]),[["exists"],"none"]];ne.PICK_RANGE_SEPARATORS=new Set(["to"]);ne.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"])};ne.PICK_RANGE_MODES=new Set(["inclusive","exclusive"]);ne.VISIBILITY_STRATEGIES=new Set(["display","visibility","opacity","twdisplay","twvisibility","twopacity"]);ne.MAX_BRACE_RUN_TOKENS=64;ne.MAX_PROPERTY_DEPTH=10;ne.MAX_METHOD_ARGS=20;ne.DECLARATION_COMMANDS=new Set(["behavior","def","install"]);ne.WRITTEN_ROLE={increment:"patient",decrement:"patient",set:"destination"};ne.ENGLISH_NOISE_WORDS=new Set(["the","a","an"]);var Cn=ne,be=new Cn;function Z(r,e){return Io(r,e)}function bn(){return _o()}var qr={ar:new Set(["\u0623\u0648"]),bn:new Set(["\u0985\u09A5\u09AC\u09BE"]),de:new Set(["oder"]),en:new Set(["or"]),es:new Set(["o"]),fr:new Set(["ou"]),he:new Set(["\u05D0\u05D5"]),hi:new Set(["\u092F\u093E"]),id:new Set(["atau"]),it:new Set(["o"]),ja:new Set(["\u307E\u305F\u306F"]),ko:new Set(["\uB610\uB294"]),ms:new Set(["atau"]),pl:new Set(["lub"]),pt:new Set(["ou"]),qu:new Set(["utaq"]),ru:new Set(["\u0438\u043B\u0438"]),sw:new Set(["au"]),th:new Set(["\u0E2B\u0E23\u0E37\u0E2D"]),tl:new Set(["o"]),tr:new Set(["veya"]),uk:new Set(["\u0430\u0431\u043E"]),vi:new Set(["ho\u1EB7c"]),zh:new Set(["\u6216"])},Pl=new Set(Object.values(qr).flatMap(r=>[...r]));function Wr(r,e){let t=(r.normalized??r.value).toLowerCase();if(t==="or")return true;let i=e===void 0?Pl:qr[e];return i?i.has(r.value)||i.has(t):false}var An=["if","unless","repeat","for","while"],Zr=/^[A-Z][A-Za-z0-9_]*$/;function ee(r,e){let t=new Set([e]),n=R(r)?.keywords?.[e];if(n){n.primary&&t.add(n.primary.toLowerCase());for(let a of n.alternatives??[])t.add(a.toLowerCase());}return t}function W(r,e){return e.has(r.value.toLowerCase())?true:r.normalized?e.has(r.normalized.toLowerCase()):false}var Ll=new Set(An);function Dr(r){return {byAction:An.map(e=>[e,ee(r,e)]),elseForms:ee(r,"else"),inForms:ee(r,"in")}}function pi(r,e){if(!r)return;let t=r.normalized?.toLowerCase();return t?Ll.has(t)?t:void 0:e.byAction.find(([,i])=>W(r,i))?.[0]}function xr(r,e,t){let i=r[e],n=pi(i,t);if(!n||n==="while")return false;let a=r[e-1];if(n==="for"){if(pi(a,t)==="repeat")return false;if(i.value.toLowerCase()==="for"){let u=r[e+2];return !!u&&(W(u,t.inForms)||u.normalized==="in")}}return !(n==="if"&&a&&W(a,t.elseForms))}var fi=new Set(["me","it","you","the","body","window","document","its","event","result","target","self","this","them","parent","next","previous","closest","first","last"]),Nl=new Set(["destination","source","style","patient","on","from","to"]);function nr(r){if(!r||r.kind==="selector")return false;let e=(r.normalized??r.value).toLowerCase(),t=r.value.toLowerCase();return !(fi.has(e)||fi.has(t)||Nl.has(e))}var Ml=r=>Object.prototype.hasOwnProperty.call(le,r);function Sn(r){return r.flatMap(e=>e.type==="literal"?[e.value,...e.alternatives??[]].map(t=>t.toLowerCase()):e.type==="group"?Sn(e.tokens):[])}var _l=new Set(["toggle","trigger"]);function Dn(r){return r.flatMap((e,t)=>{if(e.type==="group")return Dn(e.tokens);if(e.type!=="literal")return [];let i=r[t+1];return [{words:[e.value,...e.alternatives??[]].map(n=>n.toLowerCase()),role:i?.type==="role"?i.role:void 0}]})}function Il(r,e,t,i){return r.some((n,a)=>{if(!n.words.includes(e)||!n.role||!i.has(n.role))return false;let u=0;for(let o of t){let s=r.findIndex((l,c)=>c>=u&&c<a&&l.words.includes(o));if(s<0)return false;u=s+1;}return true})}function jl(r,e,t,i,n){let a=r[t].value.toLowerCase();for(let u=t-1;u>e;u--){let o=r[u];if(n(o)||o.value.toLowerCase()===a)return false;let s=(o.normalized??o.value).toLowerCase();if(!Ml(s))continue;let l=fe(i).filter(d=>d.command===s);if(_l.has(s))return l.some(d=>Sn(d.template.tokens).includes(a));let c=new Set((le[s]?.roles??[]).filter(d=>d.required).map(d=>d.role));return l.some(d=>{let m=Dn(d.template.tokens),p=new Set(m.flatMap(y=>y.words)),f=r.slice(u+1,t).map(y=>y.value.toLowerCase()).filter(y=>p.has(y));return Il(m,a,f,c)})}return false}var yi=new Set(["ja","ko"]);function Ie(r){let e=new Set;r?.primary&&e.add(r.primary.toLowerCase());for(let t of r?.alternatives??[])e.add(t.toLowerCase());return e}function xn(r,e){let t=[],i=e.position.end,n=r.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&&t.push(u);}}return {parameters:t,headerEnd:i}}function Br(r,e,t){let i=e+1;if(i>=r.length)return -1;let n=Ie(R(t)?.roleMarkers?.patient);return n.size>0&&W(r[i],n)&&i++,i<r.length?i:-1}var Bn=/^[a-zA-Z_$][\w$]*(?:\.[a-zA-Z_$][\w$]*)*$/;function $l(r){let e=1;if(r[1]?.value==="("){let t=0,i=1;for(;i<r.length;i++)if(r[i].value==="(")t++;else if(r[i].value===")"&&--t===0)break;if(i>=r.length)return -1;e=i+1;}return e+1}function Vl(r,e,t){let i=R(t);if(i?.wordOrder!=="SOV"||!Bn.test(r[0].value)||e!==$l(r))return false;let n=Ie(i.roleMarkers?.patient);return n.size===0?false:W(r[e-1],n)}function Wl(r,e,t){if(!R(e))return null;let i=ee(e,"behavior"),n=ee(e,"def"),a=r.toLowerCase(),u=[...i].some(d=>a.includes(d)),o=/\bdef\b/.test(a)||[...n].some(d=>d!=="def"&&a.includes(d));if(!u&&!o)return null;let s=Z(r,e).tokens;if(s.length<2)return null;if(W(s[0],i))return hi(r,e,s,t,0);let l=s.findIndex((d,m)=>m>0&&W(d,i));if(l>0&&Zr.test(s[0].value))return hi(r,e,s,t,l);if(W(s[0],n))return vi(r,e,s,t,0);let c=s.findIndex((d,m)=>m>0&&W(d,n));return c>0&&Vl(s,c,e)?vi(r,e,s,t,c):null}function ql(r,e,t){let i=R(e);if(!i)return null;let n=i.wordOrder!=="SOV",a=yi.has(e)?Ie(i.roleMarkers?.event):new Set,u=yi.has(e)?Ie(i.keywords?.on):new Set,o=a.size>0&&u.size>0,s=o?Ie(i.roleMarkers?.source):new Set,l=ee(e,"end"),c=ee(e,"on"),d=ee(e,"then"),m=r.toLowerCase(),p=[...l].some(S=>m.includes(S)),f=(n||o)&&(()=>{let S=0;for(let x of c)if(x){for(let w=m.indexOf(x);w>=0;w=m.indexOf(x,w+x.length))if(++S>=2)return true}return false})();if(!p&&!f)return null;let y=Z(r,e).tokens;if(y.length<2)return null;let v=Dr(e),h=S=>xr(y,S,v),E=S=>W(S,l),z=[],k=0,g=0;for(let S=0;S<y.length;S++){let x=y[S];if(E(x)){if(k>0){k--;continue}let w=r.slice(y[g].position.start,x.position.start).trim();w&&z.push(w),g=S+1;}else if(h(S))k++;else if(n&&k===0&&S>g&&W(x,c)&&nr(y[S+1])&&!(y[S+2]&&W(y[S+2],d))&&!jl(y,g,S,e,w=>E(w)||W(w,d))){let w=r.slice(y[g].position.start,x.position.start).trim();w&&z.push(w),g=S;}else if(o&&k===0&&S-1>g&&W(x,a)&&y[S+1]!==void 0&&W(y[S+1],u)){let w=y[S-1],b=y.slice(g,S-1);if(!(b.length===2&&W(b[1],s))){let P=r.slice(y[g].position.start,w.position.start).trim();P&&z.push(P),g=S-1;}}}if(g<y.length){let S=r.slice(y[g].position.start).trim();S&&z.push(S);}if(z.length<2)return null;let A=[],C=[];for(let S of z){let x;try{x=t.statement(S,e);}catch{return null}if(!x||x.kind!=="event-handler")return null;let w=x;if(A.push(w),!w.body||w.body.length===0)return null;C.push(w.metadata?.confidence??.75);}return rr(A,"then",{sourceLanguage:e,confidence:sr(C),sourceText:r})}function sr(r){return r.length>0?r.reduce((e,t)=>e+t,0)/r.length:0}function Xr(r){let e=[];for(let t of r){let i=t.statements;t.kind==="compound"&&Array.isArray(i)?e.push(...i):e.push(t);}return e}function hi(r,e,t,i,n){let a=n>0,u=a?0:Br(t,n,e);if(u<0)return null;let o=t[u],s=o.value;if(!Zr.test(s))return null;let{parameters:l,headerEnd:c}=xn(r,o),d=a?n+1:t.findIndex(b=>b.position.start>=c);d<=u&&(d=u+1);let m=ee(e,"init"),p=ee(e,"end"),f=Dr(e),y=b=>xr(t,b,f),v=b=>W(b,p),h=R(e)?.wordOrder!=="SOV",E=h?Kl(e):new Set,z=b=>{let D=r.slice(t[x].position.end,t[b].position.start).trim();if(D)try{let P=Xr(i.body(D,e));g.push(...P),A.push(sr(P.map(I=>I.metadata?.confidence??.75)));}catch{A.push(0);}},k=[],g=[],A=[],C=false,S=0,x=d;for(let b=d;b<t.length;b++){let D=t[b];if(v(D)){if(S>0){S--;continue}if(b===x){C=true;break}if(W(t[x],m))z(b);else {let P=r.slice(t[x].position.start,D.position.start).trim();try{let I=i.statement(P,e);if(I&&I.kind==="event-handler"){let O=I;k.push(O);let T=!O.body||O.body.length===0;A.push(T?.2:O.metadata?.confidence??.75);}else A.push(0);}catch{A.push(0);}}x=b+1;}else y(b)?S++:h&&S===0&&b>x&&W(t[x],m)&&E.has(D.value.toLowerCase())&&(t[b+1]?.kind==="identifier"||t[b+1]?.kind==="keyword")&&nr(t[b+1])&&(z(b),x=b);}if(k.length===0&&g.length===0)return null;let w=(C?1:.8)*sr(A);return ps(s,l,k,g.length>0?g:void 0,{sourceLanguage:e,confidence:w,sourceText:r})}function Kl(r){let e=new Set;for(let t of fe(r))if(!(t.command!=="on"||/-event-/i.test(t.id)))for(let i of t.template.tokens){if(i.type==="role"&&i.role==="event")break;if(i.type==="literal")for(let n of [i.value,...i.alternatives??[]])e.add(n.toLowerCase());}return e}function vi(r,e,t,i,n){let a=n>0,u=a?0:Br(t,n,e);if(u<0)return null;let o=t[u],s=o.value;if(!Bn.test(s))return null;let{parameters:l,headerEnd:c}=xn(r,o),d=a?n+1:t.findIndex(C=>C.position.start>=c);d<=u&&(d=u+1);let m=ee(e,"end"),p=Dr(e),f=C=>xr(t,C,p),y=C=>W(C,m),v=0,h=-1;for(let C=d;C<t.length;C++)if(y(t[C])){if(v===0){h=C;break}v--;}else f(C)&&v++;let E=t[d]?.position.start??c,z=h>=0?t[h].position.start:r.length,k=r.slice(E,z).trim();if(!k)return null;let g;try{g=Xr(i.body(k,e));}catch{return null}if(g.length===0)return null;let A=sr(g.map(C=>C.metadata?.confidence??.75));return h<0&&(A*=.8),fs(s,l,g,{sourceLanguage:e,confidence:A,sourceText:r})}var vt=["live","eventsource","socket","worker","intercept"],Hl=new Set(["intercept"]),Tt=new Set(["eventsource","socket","worker"]),Ul=new Set(["eventsource","socket"]),Gl=new Set(["worker"]),Yl=6,Zl=2;function Xl(r,e){for(let i of vt)if(W(r[0],ee(e,i)))return {action:i,keywordIdx:0};if(R(e)?.wordOrder!=="SOV")return null;let t=Math.min(r.length,Yl);for(let i=1;i<t;i++)for(let n of vt)if(n!=="live"&&W(r[i],ee(e,n))&&!(Tt.has(n)&&!Zr.test(r[0].value))&&!(n==="intercept"&&i>Zl))return {action:n,keywordIdx:i};return null}function Jl(r,e,t){let i=Ie(R(t)?.roleMarkers?.source);return i.size===0||e+1>=r.length?0:W(r[e],i)||W(r[e+1],i)?2:0}function Fn(r){let e=ee(r,"on");e.add("when");let t=R(r)?.eventHandler;if(t?.keyword){e.add(t.keyword.primary.toLowerCase());for(let i of t.keyword.alternatives??[])e.add(i.toLowerCase());}for(let i of t?.temporalMarkers??[])e.add(i.toLowerCase());return e}function Ql(r,e,t){let i=R(t)?.eventHandler,n=[i?.eventMarker?.primary,...i?.eventMarker?.alternatives??[],...i?.temporalMarkers??[]].filter(u=>!!u&&/\s/.test(u)),a=1;for(let u of n){let o=u.toLowerCase().split(/\s+/),s=e-o.length+1;s<0||o.every((l,c)=>r[s+c]?.value.toLowerCase()===l)&&(a=Math.max(a,o.length));}return a}function e0(r,e,t,i,n){if(r==="live")return t+1;if(t>0){let l=t+1;return r==="eventsource"&&(l+=Jl(e,l,i)),l}let a=Br(e,t,i);if(a<0)return -1;if(r==="worker")return a+1;let u=Fn(i),o=Ie(R(i)?.roleMarkers?.event),s=n>=0?n:e.length;for(let l=a+1;l<s;l++){if(!W(e[l],u))continue;if(nr(e[l+1]))return l;if(l>a+2&&o.size>0&&W(e[l-1],o)&&nr(e[l-2]))return l-2;let c=Ql(e,l,i);if(c>1&&l-c>a&&nr(e[l-c]))return l-c;if(l>a+1&&nr(e[l-1]))return l-1}return s}function r0(r,e,t,i){if(!Tt.has(r))return;let n=t>0?0:Br(e,t,i);if(!(n<0))return e[n].value}function t0(r,e,t){if(!R(e))return null;let i=r.toLowerCase(),n=false;for(let s of [...vt,"changes"]){for(let l of ee(e,s))if(l&&i.includes(l)){n=true;break}if(n)break}if(!n)return null;let a=Z(r,e).tokens;if(a.length<2)return null;let u=o0(a,e);if(u>=0)return l0(r,e,a,t,u);let o=Xl(a,e);return o?i0(r,e,a,t,o.action,o.keywordIdx):null}function i0(r,e,t,i,n,a){let u=ee(e,"end"),o=Dr(e),s=g=>xr(t,g,o),l=g=>W(g,u),c=r0(n,t,a,e);if(Tt.has(n)&&(!c||!Zr.test(c)))return null;let d=g=>({sourceLanguage:e,confidence:g,sourceText:r}),m=Et(t,a+1,l,s);if(Hl.has(n))return m>=0&&m!==t.length-1?null:ft(n,[],c,d(m>=0?1:.8));let p=e0(n,t,a,e,m);if(p<0||p>t.length)return null;let f=[],y=[],v=false,h=Gl.has(n);if(h||Ul.has(n)){let g=h?"def":"event-handler",A=0,C=p;for(let S=p;S<t.length;S++){let x=t[S];if(l(x)){if(A>0){A--;continue}if(v=true,S===C)break;let w=h?x.position.end:x.position.start,b=r.slice(t[C].position.start,w).trim();try{let D=i.statement(b,e);if(D&&D.kind===g){let P=D;f.push(P);let I=!P.body||P.body.length===0;y.push(I?.2:P.metadata?.confidence??.75);}else y.push(0);}catch{y.push(0);}C=S+1;}else s(S)&&A++;}}else {let g=Et(t,p,l,s);v=g>=0;let A=g>=0?t[g].position.start:r.length,C=r.slice(t[p].position.start,A).trim();if(!C)return null;try{f.push(...Xr(i.body(C,e)));}catch{return null}if(f.length===0)return null;y.push(...f.map(S=>S.metadata?.confidence??.75));}if(f.length===0&&!v)return null;let E=v?1:.8,z=y.length>0?E*sr(y):E,k=n0(n,r,t,a,p,e);return ft(n,f,c,d(z),k?new Map([["source",k]]):void 0)}function n0(r,e,t,i,n,a){if(r!=="eventsource"&&r!=="socket"||i!==0)return;let u=Br(t,i,a);if(u<0)return;let o=u+1,s=Math.min(n,t.length)-1;if(r==="eventsource"){let c=Ie(R(a)?.roleMarkers?.source),d=m=>!!m&&(W(m,c)||(m.normalized??"").toLowerCase()==="source");d(t[o])?o++:d(t[s])&&s--;}if(o>s)return;let l=e.slice(t[o].position.start,t[s].position.end).trim();return l?{type:"expression",raw:l}:void 0}var a0=new Set([...Object.keys(le),"then","else"]);function u0(r){let e=ee(r,"when");for(let t of Fn(r))e.add(t);return e}function o0(r,e){if(r.length<3||!W(r[0],u0(e)))return -1;let t=ee(e,"changes"),i=ee(e,"end");for(let n=2;n<r.length;n++){let a=r[n];if(a.kind==="literal")continue;if(W(a,t))return n;if(W(a,i))return -1;let u=(a.normalized??a.value).toLowerCase();if(a.kind==="keyword"&&a0.has(u))return -1}return -1}function s0(r,e,t){if(t==="en"){let n=e[0],a=e[e.length-1];return {type:"expression",raw:r.slice(n.position.start,a.position.end).trim()}}let i=e.map(n=>Wr(n,t)?{...n,kind:"keyword",normalized:"or"}:n);return {type:"expression",raw:Be(i,R(t))}}function l0(r,e,t,i,n){let a=ee(e,"end"),u=Dr(e),o=E=>xr(t,E,u),s=E=>W(E,a),l=n+1;if(l>=t.length)return null;let c=Et(t,l,s,o),d=c>=0;if(d&&c!==t.length-1)return null;let m=d?t[c].position.start:r.length,p=r.slice(t[l].position.start,m).trim();if(!p)return null;let f;try{f=Xr(i.body(p,e));}catch{return null}if(f.length===0)return null;let y=s0(r,t.slice(1,n),e),h=(d?1:.8)*sr(f.map(E=>E.metadata?.confidence??.75));return ft("when",f,void 0,{sourceLanguage:e,confidence:h,sourceText:r},new Map([["condition",y]]))}function Et(r,e,t,i){let n=0;for(let a=e;a<r.length;a++)if(t(r[a])){if(n===0)return a;n--;}else i(a)&&n++;return -1}var Fe={ko:{\uD074\uB9AD:"click",\uC785\uB825:"input",\uBCC0\uACBD:"change",\uC81C\uCD9C:"submit",\uD0A4\uB2E4\uC6B4:"keydown",\uD0A4\uC5C5:"keyup",\uB9C8\uC6B0\uC2A4\uC624\uBC84:"mouseover",\uB9C8\uC6B0\uC2A4\uC544\uC6C3:"mouseout",\uB9C8\uC6B0\uC2A4\uB2E4\uC6B4:"mousedown",\uB9C8\uC6B0\uC2A4\uC5C5:"mouseup",\uD3EC\uCEE4\uC2A4:"focus",\uBE14\uB7EC:"blur",\uB85C\uB4DC:"load",\uB9AC\uC0AC\uC774\uC988:"resize",\uC2A4\uD06C\uB864:"scroll",\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"}};function Tn(r,e){let t=Fe[e];return t&&t[r]?t[r]:r.toLowerCase()}function c0(r,e){let t=Fe[e];return t?Object.keys(t).filter(i=>t[i]===r):[]}var d0=Object.fromEntries(Object.entries(Fe).map(([r,e])=>{let t={};for(let[i,n]of Object.entries(e))n in t||(t[n]=i);return [r,t]})),m0={ar:new Set(["mouseover"]),bn:new Set(["resize"]),de:new Set(["keydown","keyup","load","mouseout","mouseover"]),fr:new Set(["blur"]),id:new Set(["input","keyup","mouseout","mouseover"]),ja:new Set(["keypress","mousedown","mouseup","resize"]),qu:new Set(["change","focus","load","resize","submit"]),sw:new Set(["change","click","input","keydown","keyup","mouseout","mouseover","submit"]),tr:new Set(["keydown","keyup","load","mousedown","mouseout","mouseover","mouseup","resize","scroll"]),zh:new Set(["focus","keyup","mouseout","mouseover"])};function On(r,e){return m0[e]?.has(r)?r:d0[e]?.[r]??r}var p0=new Set(["the","to","on","with","into","from","at"]),Ei=/^[A-Za-z_$][\w$]*$/,f0=64;function gi(r){let e="";for(let t=0;t<r.length;t++){let i=r[t],n=r[t-1];n&&i.position.start>n.position.end&&(e+=" "),e+=i.value;}return e}function y0(r,e){let t=0;for(let i=e;i<r.length&&i-e<=f0;i++){let n=r[i].value;if(n==="(")t++;else if(n===")"&&(t--,t===0))return i+1}return -1}function zi(r,e){return e.position.start===r.position.end}function h0(r,e,t,i){let n=r[e];if(!n||n.kind!=="identifier"&&n.kind!=="keyword"||!Ei.test(n.value)||i(n))return null;let a=e+1,u=n.value;for(;r[a]?.kind==="selector"&&/^\.[A-Za-z_$][\w$]*$/.test(r[a].value)&&zi(r[a-1],r[a]);)u+=r[a].value,a++;let o=a>e+1,s=r[a];if(!s||s.value!=="("||!zi(r[a-1],s))return null;let l=y0(r,a);if(l<0)return null;let c=u+gi(r.slice(a,l));if(o)return {text:`call ${c}`,consumed:l-e};let d=l,p=r[d]?.value.toLowerCase(),f=null;if(p==="me")f="me",d++;else if(p!==void 0&&p0.has(p)){d++,r[d]?.value.toLowerCase()==="the"&&d++;let y=r[d];if(!y)return null;let v=Cr(r,d,t);if(v)f=`(${gi(r.slice(d,d+v.consumed))})`,d+=v.consumed;else if(y.kind==="selector"&&y.value.startsWith("#")&&!/[.[:\s]/.test(y.value.slice(1)))f=y.value,d++;else if(y.kind==="selector"&&/^[.<]/.test(y.value))f=`(${y.value})`,d++;else if((y.kind==="keyword"||y.kind==="identifier")&&Ei.test(y.value)&&(Te(y.value.toLowerCase())||y.kind==="identifier"))f=y.value,d++;else return null}return {text:f?`call ${f}.${c}`:`call ${c}`,consumed:d-e}}var v0={debounced:"debounce",debounce:"debounce",throttled:"throttle",throttle:"throttle"},E0=[["\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"]],g0=/^(\d+)(ms|s|m)?$/,z0=new Set(["selector","literal","url","event-modifier"]);function w0(r){let e=r.match(g0);if(!e)return null;let t=parseInt(e[1],10),i=e[2]||"ms";return i==="s"?t*=1e3:i==="m"&&(t*=6e4),t}function k0(r){for(let e=1;e<r.length;e++){let t=r[e];if(z0.has(t.kind))continue;let i=t.value.toLowerCase(),n=v0[i];if(n){let a=0;for(let u=e+1;u<r.length;u++){let o=r[u],s=w0(o.value);if(s!==null)return {modifiers:{[n]:s},start:t.position.start,end:o.position.end};if(o.kind==="selector"||o.kind==="literal"||o.kind==="url"||++a>2)break}continue}for(let a of E0){if(a[0]!==i||e+a.length>r.length)continue;let u=true;for(let o=1;o<a.length;o++)if(r[e+o].value.toLowerCase()!==a[o]){u=false;break}if(u)return {modifiers:{once:true},start:t.position.start,end:r[e+a.length-1].position.end}}}return null}function C0(r,e){try{let t=Z(r,e),i=fe(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=be.matchBest(t,a);if(u)return {confidence:u.confidence,parseSuccess:!0,patternId:u.pattern.id,action:u.pattern.command,tokensConsumed:u.consumedTokens};t.reset(t.mark());let o=n.filter(l=>l.command!=="on"),s=be.matchBest(t,o);return s?{confidence:s.confidence,parseSuccess:!0,patternId:s.pattern.id,action:s.pattern.command,tokensConsumed:s.consumedTokens}:{confidence:0,parseSuccess:!1,error:`Could not match any patterns for: ${r}`}}catch(t){return {confidence:0,parseSuccess:false,error:t instanceof Error?t.message:String(t)}}}function Rn(r,e){try{let i=tc(r,e);if(i)return {node:i,confidence:i.metadata?.confidence??.8,error:void 0,tokensConsumed:Z(r,e).tokens.length}}catch{}let t=C0(r,e);return t.parseSuccess?{node:null,confidence:t.confidence,error:void 0,tokensConsumed:t.tokensConsumed}:{node:null,confidence:0,error:t.error}}new Set(Object.values(Bt).flatMap(r=>Object.values(r)));var j0=new Set(["a","an","the"]),Ci=new Map;function $0(r){let e=Ci.get(r);return e||(e=new Set(Object.values(le).flatMap(t=>t.roles.flatMap(i=>[i.markerOverride?.[r],...i.markerVariants?.[r]??[]].filter(n=>typeof n=="string"&&n.length>0)))),Ci.set(r,e)),e}function V0(r,e){let t=Z(r,e).tokens,i=t[0];if(t.length!==1||!i)return {collision:"structure",word:"words"};let n=i.normalized!==r?i.normalized:void 0;if(i.kind==="keyword"&&Vi.has(n??""))return {collision:"pronoun",word:"pronoun",sense:n};if(i.kind==="identifier"&&!n){if($0(e).has(r))return {collision:"structure",word:"marker"};let a=qe(e,r);return a!==r?{collision:"structure",word:"connective",sense:a}:j0.has(r.toLowerCase())?{collision:"structure",word:"article"}:null}return i.kind==="particle"?{collision:"structure",word:"marker"}:{collision:"structure",word:"keyword",sense:n}}function W0(r,e){let t=`${e}\0${r}`,i=bi.get(t);return i===void 0&&(i=V0(r,e)?.collision??null,bi.set(t,i)),i}var bi=new Map;jo((r,e)=>W0(r,e)==="structure");var Ve=new Set(["if","unless","while","repeat","for"]),Pn=new Set(["repeat","for"]),tr={kind:"loop-close"};function Ot(r){return r===tr}function zt(r){if(Ot(r)||r.kind!=="command"||!Pn.has(r.action))return false;let e=r.body;return !(Array.isArray(e)&&e.length>0)}function q0(r){switch(r.type){case "expression":return r.raw;case "literal":return String(r.value);case "reference":return r.value;default:return}}function Ir(r,e){for(let t=e-1;t>=0;t--)if(r[t].kind!=="particle")return r[t]}function ct(r){return r.kind!=="keyword"&&r.kind!=="identifier"?false:(r.normalized??r.value).toLowerCase()==="repeat"}function jr(r){let e=0;for(let t of r)zt(t)?e++:Ot(t)&&e>0&&e--;return e}var dt=new Set(["then","end","else","if","unless","while","for","repeat","and"]),K0=new Set(["first","last","next","previous","random","closest"]),H0=new Set(["me","my","i","it","its","you","your","result"]),Ai=new Set(["top","middle","bottom","left","center","right","nearest"]),U0=new Set(["smoothly","instantly"]);function G0(r,e){if(!e)return false;let t=e.value.toLowerCase();switch(r.type){case "selector":return r.value.toLowerCase()===t;case "reference":return r.value===(e.normalized??e.value).toLowerCase()||r.value===t;case "expression":return r.raw.toLowerCase().split(/\s+/)[0]===t;default:return String("value"in r?r.value:"").toLowerCase()===t}}var Er=["body","statements","thenBranch","elseBranch","eventHandlers","initBlock"];function Y0(r){let e=(r.normalized??r.value).toLowerCase();return e==="document"||e==="window"||e==="me"||e==="body"?Ae(e):r.kind==="selector"?Oe(r.value):{type:"expression",raw:r.value}}var Si=new Map;function Di(r){let e=Si.get(r);return e||(e=new Set(fe(r).map(t=>t.command).filter(t=>t!=="on")),Si.set(r,e)),e}var xe=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"]),xi=class extends Error{constructor(r,e,t,i){super(r),this.name="SemanticParseError",this.language=e,this.input=t,this.diagnostics=i;}};function Y(r,e,t){return {message:r,severity:e,source:"semantic-parser",...t&&{code:t}}}function K(r,e){return e.length===0?r:{...r,diagnostics:e}}var Hr=120;function Z0(r,e,t){let i=e.tokens.length;if(r.consumedTokens>=i)return null;let n=e.tokens[r.consumedTokens],a=e.tokens[i-1];if(!n||!a)return null;let u=t.slice(n.position.start,a.position.end);if(!u.trim())return null;let o=u.length>Hr?`${u.slice(0,Hr)}\u2026`:u,s=i-r.consumedTokens;return `pattern ${r.pattern.id} left ${s} token(s) unconsumed: "${o}"`}var Bi=/^repeat-.*-(times|for-in|while-head|until-head|until-condition-head)$/,X0=new Set(["forever","times","for","while","until","until-event"]),J0=new Set(["to","from","into","onto","with","as","at","of","in","on","by","and","or","then","end","else","the","a","an","async"]);function $r(r){let e=[],t=new Set((r.diagnostics??[]).map(n=>`${n.code}|${n.message}`)),i=n=>{if(!n||typeof n!="object")return;if(n!==r)for(let u of n.diagnostics??[]){if(u.code!=="unconsumed-input")continue;let o=`${u.code}|${u.message}`;t.has(o)||(t.add(o),e.push(u));}let a=n;for(let u of Ln){let o=a[u];if(Array.isArray(o))for(let s of o)i(s);}};return i(r),e.length===0?r:K(r,[...r.diagnostics??[],...e])}function Q0(r){if(r.length>=2){let e=r[0];if((e==='"'||e==="'")&&r.endsWith(e))return r.slice(1,-1)}return r}var Ln=["body","statements","thenBranch","elseBranch","eventHandlers","initBlock"];function Nn(r,e,t){if(!r||typeof r!="object")return r;if(r.action&&r.roles instanceof Map){let n=se(r.action),a=n?.primaryRole;if(n&&a&&a!=="patient"&&!n.roles.some(u=>u.role==="patient")&&r.roles.has("patient")&&!r.roles.has(a)){let u=r.roles,o=u.get("patient");o!==void 0&&(u.delete("patient"),u.set(a,o));}if(r.action==="tell"){let u=r.roles,o=u.get("patient"),s=u.get("destination");o&&(o.type==="selector"||o.type==="reference")&&(!s||s.type==="literal")&&(u.delete("patient"),u.set("destination",o));}if(r.action==="transition"){let u=r.roles,o=u.get("goal");o&&o.type==="literal"&&o.dataType==="duration"&&!u.has("duration")&&(u.delete("goal"),u.set("duration",o));}if(r.action==="fetch"){let u=r.roles,o=u.get("patient"),s=u.get("source");o&&s&&(o.type==="literal"||o.type==="expression")&&s.type==="expression"&&!u.has("style")&&(u.delete("patient"),u.set("style",s),u.set("source",o));}if(r.action==="transition"){let u=r.roles,o=u.get("destination");o&&o.type==="literal"&&!u.has("goal")&&(u.delete("destination"),u.set("goal",o));let s=u.get("patient");s&&s.type==="literal"&&typeof s.value=="string"&&/^[A-Za-z_][A-Za-z0-9_-]*$/.test(s.value)&&u.set("patient",{type:"expression",raw:s.value});}if(r.action==="morph"){let u=r.roles,o=u.get("patient");o&&o.type==="literal"&&typeof o.value=="string"&&/<[a-zA-Z][^>]*\/?>/.test(o.value)&&u.set("patient",{type:"expression",raw:o.value});}if(r.action==="wait"){let u=r.roles;if(!u.has("event")){let o=u.get("duration"),s=o?.type==="expression"?o.raw:o?.type==="literal"?o.value:void 0,l=typeof s=="string"&&t?Tn(s,t):"";typeof s=="string"&&xe.has(s.toLowerCase())?(u.delete("duration"),u.set("event",{type:"literal",value:s,dataType:"string"})):xe.has(l)&&(u.delete("duration"),u.set("event",{type:"literal",value:l,dataType:"string"}));}}if(r.kind==="command"&&r.action!=="on"){let u=r.roles,o=u.get("event");if(o&&o.type==="expression"){let s=o.raw;typeof s=="string"&&/^[A-Za-z_][A-Za-z0-9_-]*(:[A-Za-z0-9_-]+)?$/.test(s)&&u.set("event",{type:"literal",value:s,dataType:"string"});}}if(e?.size){let u=r.roles;for(let o of ["destination","source"]){let s=u.get(o);s&&s.type==="literal"&&typeof s.value=="string"&&e.has(s.value)&&u.set(o,{type:"expression",raw:s.value});}}}let i=r;for(let n of Ln){let a=i[n];if(Array.isArray(a))for(let u of a)Nn(u,e,t);}return r}var ze=class B{constructor(){this.parseDepth=0,this.coverageFrames=[],this.boundIdentifiers=new Set;}parse(e,t){this.parseDepth===0&&this.boundIdentifiers.clear(),this.parseDepth++,this.coverageFrames.push([]);try{let i=Nn(this.parseInternal(e,t),this.boundIdentifiers,t),n=this.coverageFrames[this.coverageFrames.length-1];if(n.length>0&&(i=K(i,[...i.diagnostics??[],...n])),this.parseDepth===1&&(i=$r(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,t)??this.reclaimEventCompoundTail(a.node,a.input,t)??this.reclaimResponseTypeTail(a.node,a.input,t)??this.reclaimCapturedDestinationTail(a.node,a.input,t);if(!l)break;a=l;}let o=this.reclaimEventCompoundTail(a.node,a.input,t);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 t=this.coverageFrames[this.coverageFrames.length-1];t&&t.length>e&&(t.length=e);}static getCoverageMarkerSurfaces(e){let t=B.coverageMarkerSurfaces.get(e);if(!t){t=new Set;let i=R(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+/))t.add(a);for(let a of n.alternatives??[])for(let u of a.toLowerCase().split(/\s+/))t.add(u);}}for(let n of B.LEAKED_RENDER_MARKERS[e]??[])t.add(n.toLowerCase());B.coverageMarkerSurfaces.set(e,t);}return t}isCoverageResidueToken(e,t){if(e.kind==="particle"||e.kind==="conjunction"||e.metadata?.closesTrackedBlock||this.isThenKeyword(e.value,t)||this.isEndKeyword(e.value,t)||this.isElseKeyword(e.value,t))return true;let i=(e.normalized??e.value).toLowerCase();return J0.has(i)?true:B.getCoverageMarkerSurfaces(t).has(e.value.toLowerCase())}recordDroppedTokens(e,t,i){if(e.length===0)return;let n=this.coverageFrames[this.coverageFrames.length-1];if(!n||!e.some(o=>!this.isCoverageResidueToken(o,t)))return;let a=e.map(o=>o.value).join(" ").trim();if(!a)return;let u=a.length>Hr?`${a.slice(0,Hr)}\u2026`:a;n.push(Y(`${i} left ${e.length} token(s) unconsumed: "${u}"`,"warning","unconsumed-input"));}registerBoundIdentifiers(e){let t=e.action==="repeat"||e.action==="for"?"patient":e.action==="set"?"destination":null;if(!t)return;let i=e.roles.get(t);i?.type==="expression"&&typeof i.raw=="string"&&/^[A-Za-z_]\w*$/.test(i.raw)&&this.boundIdentifiers.add(i.raw);}parseInternal(e,t){let i=Wl(e,t,{statement:(w,b)=>this.parse(w,b),body:(w,b)=>this.parseStatements(w,b)});if(i)return i;let n=t0(e,t,{statement:(w,b)=>this.parse(w,b),body:(w,b)=>this.parseStatements(w,b)});if(n)return n;let a=ql(e,t,{statement:(w,b)=>this.parse(w,b),body:(w,b)=>this.parseStatements(w,b)});if(a)return a;let{modifiers:u,remainingInput:o}=this.extractStandaloneModifiers(e,t),s=o||e,c=this.stripAsyncModifier(s,t).remainingInput??s,m=this.stripDoNotThrowModifier(c,t).remainingInput??c,p=[],f=Z(m,t);this.positionSource=m;{let w=f.mark(),b=this.consumeJsBlock(f,t);if(b&&f.isAtEnd())return K(b,p);f.reset(w);}let y=fe(t);if(y.length===0)throw new xi(`No patterns available for language: ${t}`,t,m,[Y(`No patterns registered for language '${t}'`,"error","no-patterns")]);let v=[...y].sort((w,b)=>b.priority-w.priority);{let w=f.tokens;if(R(t)?.wordOrder==="VSO"&&w.length>=4&&w[0]?.normalized==="source"){let b=w.findIndex(D=>D.normalized==="on");if(b>=2&&b+1<w.length){let D=m.slice(w[0].position.start,w[b].position.start).trim(),P=w[b+1].position.end,I=m.slice(w[b].position.start,P)+" "+D+m.slice(P);if(I!==m)try{let O=this.parse(I,t);if(O&&O.kind==="event-handler"){let T=u?this.applyModifiers(O,u):O;return K(T,p)}}catch{}}}}{let w=f.tokens,b=w[0]?.normalized==="if";for(let D=0;b&&D+3<w.length;D++){let P=(w[D+3]?.normalized??w[D+3]?.value??"").toLowerCase();if(w[D]?.normalized==="source"&&w[D+2]?.normalized==="on"&&B.KNOWN_EVENTS.has(P)){let I=(m.slice(0,w[D].position.start).trimEnd()+" "+m.slice(w[D+1].position.end).trimStart()).trim();if(I&&I!==m)try{let O=this.parse(I,t);if(O&&O.kind==="event-handler"){let T=u?this.applyModifiers(O,u):O;return K(T,p)}}catch{}break}}}{let w=this.tryDoNotThrow(f.tokens,m,t);if(w){let b=u&&w.kind==="event-handler"?this.applyModifiers(w,u):w;return K(b,p)}}{let w=this.tryTellTo(f.tokens,m,t);if(w){let b=u&&w.kind==="event-handler"?this.applyModifiers(w,u):w;return K(b,p)}}{let w=this.tryScrollModifiers(f.tokens,m,t);if(w){let b=u&&w.kind==="event-handler"?this.applyModifiers(w,u):w;return K(b,p)}}{let w=this.tryLoopIndex(f.tokens,m,t);if(w){let b=u&&w.kind==="event-handler"?this.applyModifiers(w,u):w;return K(b,p)}}{let w=this.tryWaitAlternatives(f.tokens,m,t);if(w){let b=u&&w.kind==="event-handler"?this.applyModifiers(w,u):w;return K(b,p)}}{let w=f.tokens,b=Di(t);for(let D=0;D+1<w.length;D++){let P=w[D];if(this.isBodyCommandWord(P,b))break;if(w[D+1].value!=="(")continue;let I=(P.normalized??P.value).toLowerCase();if(!(B.KNOWN_EVENTS.has(I)||xe.has(I))&&P.kind!=="identifier")continue;let T=this.matchEventParamPhrase(w,D+1);if(T.len===0)continue;let M=w[D+T.len],H=(m.slice(0,w[D+1].position.start).trimEnd()+" "+m.slice(M.position.end).trimStart()).trim();try{let _=this.parse(H,t);if(_?.kind==="event-handler"){let j=this.reclaimEventCompoundTail($r(_),H,t);j&&(_=j.node);}let V=_?.roles.get("event"),he=(V?.type==="expression"?V.raw:V&&"value"in V?String(V.value):void 0)?.toLowerCase(),U=m.slice(0,w[D+1].position.start).trimEnd().toLowerCase(),N=he===P.value.toLowerCase()||he===I||he!==void 0&&c0(he,t).some(j=>U.endsWith(j.toLowerCase()));if(_?.kind==="event-handler"&&N){_.parameterNames=T.names;let j=u?this.applyModifiers(_,u):_;return K(j,p)}}catch{}}}{let w=f.tokens,b=Di(t);for(let D=1;D<w.length-1;D++){let P=w[D];if(this.isBodyCommandWord(P,b))break;if(!Wr(P,t))continue;let I=w[D+1],O=(I.normalized??I.value).toLowerCase();if(!B.KNOWN_EVENTS.has(O))break;let T=D+1,M=w[D+2];M&&M.kind==="selector"&&M.value.startsWith("[")&&(T=D+2);let H=w[D].position.start,_=w[T].position.end,V=(m.slice(0,H).trimEnd()+" "+m.slice(_).trimStart()).trim();if(V&&V!==m)try{let ae=this.parse(V,t);if(ae&&ae.kind==="event-handler"){ae.additionalEvents=[{type:"literal",value:T>D+1?O+M.value:O}];let he=u?this.applyModifiers(ae,u):ae;return K(he,p)}}catch{}break}}{let w=k0(f.tokens);if(w){let b=(m.slice(0,w.start).trimEnd()+" "+m.slice(w.end).trimStart()).trim();if(b&&b!==m)try{let D=this.parse(b,t);if(D&&D.kind==="event-handler"){let P=this.applyModifiers(D,{...u??{},...w.modifiers});return K(P,p)}}catch{}}}let h=v.filter(w=>w.command==="on"),E=f.mark(),z=be.matchBest(f,h);if(z){p.push(Y(`event pattern matched: ${z.pattern.id} (confidence: ${z.confidence.toFixed(2)})`,"info","pattern-match"));let w=false;if(/^event-[a-z]+-bare$/.test(z.pattern.id)){let b=z.captured.get("event"),D=(b?.raw??b?.value??"").toString().toLowerCase(),P=Fe[t],I=B.KNOWN_EVENTS.has(D)||!!P&&Object.keys(P).some(O=>O.toLowerCase()===D);if(D&&!I){let O=this.trySOVEventExtraction(m,t,v);if(O){p.push(Y(`bare-event mis-anchor on "${D}" rejected; SOV extraction preferred`,"info","stage-bare-event-guard"));let T=u?this.applyModifiers(O,u):O;return K(T,p)}if(b?.type==="reference"||b?.type==="expression"){f.reset(E);let T=v.filter(H=>H.command!=="on"),M=be.matchBest(f,T);f.reset(E),M&&M.pattern.command!=="on"?(w=true,p.push(Y(`bare-event mis-anchor on reference "${D}" rejected; command ${M.pattern.command} preferred`,"info","stage-bare-event-guard"))):be.matchBest(f,h);}}}if(!w){let b=this.buildEventHandler(z,f,t),D=u?this.applyModifiers(b,u):b;return K(D,p)}}p.push(Y(`event patterns: ${h.length} tried, no match`,"info","stage-event"));let k=this.tryTrailingEventExtraction(m,t,v);if(k){p.push(Y("trailing event extraction succeeded","info","stage-trailing-event"));let w=u?this.applyModifiers(k,u):k;return K(w,p)}let g=v.filter(w=>w.command!=="on"),A=this.tryParseUnlessGuard(f,g,t);if(A&&A.length>0){let w=A.length===1?A[0]:rr(A,"then",{sourceLanguage:t,confidence:1});return K(w,p)}let C=be.matchBest(f,g);if(C){if(Ve.has(C.pattern.command)){let b=this.trySOVEventExtraction(m,t,v);if(b){p.push(Y(`SOV event extraction preferred over bare ${C.pattern.command} command`,"info","stage-sov-loop"));let P=u?this.applyModifiers(b,u):b;return K(P,p)}let D=this.tryMidStreamEventExtraction(m,t,v);if(D){p.push(Y(`mid-stream event extraction preferred over bare ${C.pattern.command} command`,"info","stage-midstream-loop"));let P=u?this.applyModifiers(D,u):D;return K(P,p)}}else if(B.KNOWN_EVENTS.has(C.pattern.command)&&this.hasSOVEventMarkerHead(m,t)){let b=this.trySOVEventExtraction(m,t,v);if(b){p.push(Y(`SOV event extraction preferred over command-homonym event ${C.pattern.command}`,"info","stage-sov-homonym"));let D=u?this.applyModifiers(b,u):b;return K(D,p)}}else if(R(t)?.wordOrder==="VSO"){let b=this.tryMidStreamEventExtraction(m,t,v);if(b){p.push(Y(`mid-stream event extraction preferred over bare ${C.pattern.command} command`,"info","stage-midstream-cmd"));let D=u?this.applyModifiers(b,u):b;return K(D,p)}}if(C.consumedTokens<f.tokens.length&&R(t)?.wordOrder==="SOV"){let b=this.trySOVEventExtraction(m,t,v);if(b){p.push(Y(`SOV event extraction preferred over partial ${C.pattern.command} command (trailing remainder)`,"info","stage-sov-trailing"));let D=u?this.applyModifiers(b,u):b;return K(D,p)}}if(C.consumedTokens<f.tokens.length&&Pn.has(C.pattern.command)){let b=this.tryTopLevelLoop(f,g,t);if(b)return p.push(Y(`top-level loop: ${b.kind}`,"info","stage-top-level-loop")),K(b,p)}if(C.consumedTokens<f.tokens.length&&!Ve.has(C.pattern.command)){let b=this.tryTopLevelCommandSequence(f,g,t);if(b)return p.push(Y(`top-level command sequence: ${b.statements.length} commands`,"info","stage-top-level-sequence")),K(b,p)}if(C.consumedTokens<f.tokens.length&&(C.pattern.command==="if"||C.pattern.command==="unless")){let b=this.tryCompoundCommandParsing(f,g,t);if(b)return p.push(Y("conditional with a trailing body","info","stage-compound")),K(b,p)}p.push(Y(`command pattern matched: ${C.pattern.id} (confidence: ${C.confidence.toFixed(2)})`,"info","pattern-match"));let w=Z0(C,f,m);return w&&p.push(Y(w,"warning","unconsumed-input")),K(this.buildCommand(C,t),p)}if(p.push(Y(`command patterns: ${g.length} tried, no match`,"info","stage-command")),!m.includes(`
|
|
5
|
+
`)&&R(t)?.wordOrder==="VSO"){let w=this.tryMidStreamEventExtraction(m,t,v);if(w){p.push(Y("mid-stream event extraction succeeded with no leading command match","info","stage-midstream-nocmd"));let b=u?this.applyModifiers(w,u):w;return K(b,p)}}let S=this.trySOVEventExtraction(m,t,v);if(S){p.push(Y("SOV event extraction succeeded","info","stage-sov"));let w=u?this.applyModifiers(S,u):S;return K(w,p)}p.push(Y("SOV event extraction: no event keyword found","info","stage-sov"));let x=this.tryCompoundCommandParsing(f,g,t);if(x)return p.push(Y("compound command parsing succeeded","info","stage-compound")),K(x,p);if(p.push(Y("compound parsing: no then-keywords or no command matches","info","stage-compound")),t==="en"){let w=Z(m,t),b=this.tryParsePseudoCommand(w,g,t);if(b&&w.isAtEnd())return p.push(Y("pseudo-command parsed as call","info","stage-pseudo")),K(b,p)}throw p.push(Y(`all parse stages exhausted for "${m}"`,"error","parse-failed")),new xi(`Could not parse input in ${t}: ${m}`,t,m,p)}tryParsePseudoCommand(e,t,i){if(i!=="en")return null;let n=h0(e.tokens,e.position(),R(i),o=>!!se((o.normalized??o.value).toLowerCase()));if(!n)return null;let a=Z(n.text,i),u=be.matchBest(a,t.filter(o=>o.command==="call"));if(!u||!a.isAtEnd())return null;for(let o=0;o<n.consumed;o++)e.advance();return this.buildCommand(u,i)}parseStatements(e,t){let i=Z(e,t),n=fe(t).filter(a=>a.command!=="on").sort((a,u)=>u.priority-a.priority);this.coverageFrames.push([]);try{let a=this.parseBodyWithClauses(i,n,t),u=this.coverageFrames[this.coverageFrames.length-1];if(u.length>0&&a.length>0){let o=a[a.length-1];a[a.length-1]=K(o,[...o.diagnostics??[],...u]);}return a}finally{this.coverageFrames.pop();}}canParse(e,t){try{return this.parse(e,t),!0}catch{return false}}supportedLanguages(){return bn()}buildCommand(e,t){if(!e)throw new Error("No match to build command from");let i={};for(let[a,u]of e.captured)i[a]=u;let n=pe(e.pattern.command,i,{sourceLanguage:t,patternId:e.pattern.id,confidence:e.confidence});return this.registerBoundIdentifiers(n),n}buildEventHandler(e,t,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 z=n.type==="expression"?n.raw:n.type==="literal"?n.value:void 0;if(typeof z=="string"&&/^[^\s()[\]{}:]+$/.test(z)){let k=Fe[i]?.[z];k?n={type:"literal",value:k,dataType:"string"}:n.type==="expression"&&B.KNOWN_EVENTS.has(z.toLowerCase())&&(n={type:"literal",value:z.toLowerCase(),dataType:"string"});}}let a=be.extractEventModifiers(t),u=z=>!(z.type==="reference"&&z.value==="me")&&z.implicit!==true,o=e.captured.get("source"),s=e.pattern.command==="on"&&/^(on|event)-/.test(e.pattern.id),l=false;o&&(e.pattern.id.endsWith("source")||s)&&u(o)&&(a={...a??{},from:o},l=true);let c;if(e.eventSource&&!l){let z=e.captured.get("action"),k=z?.type==="literal"?se(String(z.value)):void 0;R(i)?.roleMarkers?.source?.position==="after"&&k?.roles.some(A=>A.role==="source")&&!e.captured.has("source")?c=e.eventSource:u(e.eventSource)&&(a={...a??{},from:e.eventSource});}let d=e.captured.get("event")?.position,m=t.tokens[t.position()-1],f=d!==void 0&&m!==void 0&&m.position.end>d.end?[]:this.extractOrConjunctionEvents(t,i),y=n;f.length>0&&n.type==="literal"&&(y={type:"literal",value:[String(n.value),...f.map(k=>String("value"in k?k.value:""))].join(" or ")});let v,h=e.captured.get("action");if(h&&h.type==="literal"&&h.value==="if"){let z=t.tokens,k=-1;for(let g=t.position()-1;g>=0;g--){let A=z[g],C=(A.normalized??A.value).toLowerCase();if(this.isIfKeyword(C,i)){k=g;break}}for(;k>0;){let g=z[k-1];if(!this.isIfKeyword((g.normalized??g.value).toLowerCase(),i))break;k--;}if(k>=0){let g=fe(i).filter(b=>b.command!=="on").sort((b,D)=>D.priority-b.priority),A=z.slice(k);if(e.pattern.id.endsWith("vso-verb-first")&&y.type==="literal"){let b=String(y.value??"").split("[")[0].trim().toLowerCase(),D=A.findIndex((P,I)=>{if(I===0||b==="")return false;let O=(P.normalized??P.value).toLowerCase(),T=A[I-1];return O===b&&T.kind==="keyword"&&(T.normalized??"").toLowerCase()==="on"});if(D>0){let P=A[D+1],I=P&&P.kind==="selector"&&P.value.startsWith("[")?1:0;A=[...A.slice(0,D-1),...A.slice(D+1+I)];}}let C=new oe(A,i),S=this.coverageMark(),x=this.parseBodyWithClauses(C,g,i);if(x.some(b=>b.kind==="conditional")||x.length===1&&x[0]?.kind==="compound"&&x[0].statements.some(b=>b.kind==="conditional")){for(;!t.isAtEnd();)t.advance();return vr(y,x,a,{sourceLanguage:i,patternId:e.pattern.id,confidence:e.confidence})}this.coverageRollback(S);}}if(h&&h.type==="literal"&&String(h.value)!=="js"&&se(String(h.value))!==void 0){let z=h.value,k={};for(let[T,M]of e.captured)if(T!=="event"&&T!=="action"&&T!=="continues"){if(T==="source"&&l)continue;k[T]=M;}if(c&&(k.source=c),z==="repeat"){let T=t.peek(),M=_=>(_.normalized??_.value).toLowerCase();if(T&&T.kind==="keyword"&&M(T)==="forever")k.loopType={type:"literal",value:"forever"},delete k.patient,t.advance();else if(T&&T.kind==="keyword"&&M(T)==="event"){t.advance();let _=t.peek();if(_)for(k.event={type:"literal",value:M(_)},k.loopType={type:"literal",value:"until-event"},delete k.patient;!t.isAtEnd();){let V=t.peek();if(!V||V.kind==="conjunction"||V.kind==="keyword"&&(this.isThenKeyword(V.value,i)||this.isEndKeyword(V.value,i)))break;t.advance();}}let H=k.patient;H&&H.type==="reference"&&H.value==="me"&&delete k.patient;}let g=pe(z,k,{sourceLanguage:i,patternId:e.pattern.id,confidence:e.confidence});this.registerBoundIdentifiers(g);let A=[];if(!Ve.has(z)||z==="repeat"||z==="while"){let T=e.pattern.id.includes("verb-first"),M=t.tokens,H=t.position(),_=N=>{let j=M[N];if(j.kind==="conjunction")return true;if(j.kind!=="keyword")return false;let J=Ee(M,N);return this.isThenAt(j,J,i)||this.isEndKeyword(j.value,i)&&!Pe(J,i)},V=z==="repeat"||z==="while",ae=N=>_(N)||V&&this.isBlockEndToken(M[N],Ee(M,N),i),he=new Set;{let N=R(i)?.keywords?.[z];N?.primary&&he.add(N.primary.toLowerCase());for(let j of N?.alternatives??[])he.add(j.toLowerCase());}let U=-1;for(let N=H-1;N>=0;N--){let j=M[N];if(_(N))break;if((j.normalized??j.value).toLowerCase()===z||he.has(j.value.toLowerCase())){U=N;break}}if(U>=0){let N=H,j=0;for(;N<M.length;){let ue=M[N],ke=Ir(M,N);if(V&&this.isIfKeyword((ue.normalized??ue.value).toLowerCase(),i)&&!(ke&&this.isElseKeyword(ke.value,i)))j++;else if(j>0)this.isBlockEndToken(ue,Ee(M,N),i)&&j--;else if(ae(N))break;N++;}let J=M.slice(U,N),we=J;if(T){let ue=String(n.value??"").toLowerCase(),ke=J.findIndex(ce=>(ce.normalized??ce.value).toLowerCase()===ue);if(ke<0)we=null;else {let ce=J[ke-1],de=ce&&ce.kind==="keyword"&&ce.normalized?.toLowerCase()==="on"?ke-1:ke;we=[...J.slice(0,de),...J.slice(ke+1)];}}if(we&&we.length>1){let ue=fe(i).filter(q=>q.command!=="on").sort((q,Q)=>Q.priority-q.priority),ke=this.coverageMark(),ce=this.parseClause(we,ue,i),de=ce[0],Ge=q=>q!==null&&typeof q=="object"&&typeof q.type=="string"?q.type:typeof q,Ye=se(z),rt=Ye?.primaryRole,$t=q=>q==="patient"&&rt&&rt!=="patient"&&!Ye?.roles.some(Q=>Q.role==="patient")?rt:q,fa=(q,Q)=>{if(!Ve.has(z)||!Ye)return false;let Me=Ye.roles.find(pr=>pr.role===$t(q));return Me?Me.expectedTypes.length>0&&!Me.expectedTypes.includes(Ge(Q)):true},tt=(q,Q)=>q==="patient"&&!!Ye&&!Ye.roles.some(Me=>Me.role==="patient")&&Ge(Q)==="literal"&&Sr.has(String(Q.value??"").toLowerCase()),it=q=>q!==null&&typeof q=="object"&&q.implicit===true,ya=!!de&&de.kind==="command"&&Object.entries(k).every(([q,Q])=>{if(it(Q)||fa(q,Q)||tt(q,Q))return true;let Me=de.roles.get($t(q));if(Me!==void 0&&Ge(Me)===Ge(Q))return true;if(q==="patient"&&z==="pick"&&Ge(Q)==="literal"){let pr=de.roles.get("method"),Wt=Ge(pr),qt=Wt==="literal"?String(pr.value):Wt==="expression"?String(pr.raw):void 0;return qt!==void 0&&qt===String(Q.value)}return false}),Vt=de?.metadata?.patternId??"",ha=!Ve.has(z)||Bi.test(Vt),va=Bi.test(Vt);if((ce.length===1||va&&ce.length>1)&&de&&de.kind==="command"&&(de.action===z||z==="while"&&de.action==="repeat"&&/-while-head$/.test(de.metadata?.patternId??""))&&ya&&ha&&(de.roles.size>Object.entries(k).filter(([q,Q])=>!tt(q,Q)).length||[...de.roles.values()].filter(q=>!it(q)).length>Object.entries(k).filter(([q,Q])=>!tt(q,Q)&&!it(Q)).length))for(g=de,A=ce.slice(1);t.position()<N;)t.advance();else this.coverageRollback(ke);}}}if(!Ve.has(z)){let T=g;if(se(z)?.roles.some(U=>U.role==="quantity"&&!U.required)&&!T.roles.has("quantity")){let U=t.peek();U&&/^-?\d+(\.\d+)?$/.test(U.value)&&(g=pe(z,{...Object.fromEntries(T.roles),quantity:{type:"literal",value:parseFloat(U.value),dataType:"number"}},T.metadata),t.advance());}let H=g;if(se(z)?.roles.some(U=>U.role==="duration"&&!U.required)&&!H.roles.has("duration")){let U=/^\d+(\.\d+)?(ms|s)$/i,N=t.peek(),j=false;if(N&&N.kind==="particle"){let J=t.peek(1);J&&U.test(J.value)&&(j=true,N=J);}N&&U.test(N.value)&&(g=pe(z,{...Object.fromEntries(H.roles),duration:{type:"literal",value:N.value,dataType:"string"}},H.metadata),j&&t.advance(),t.advance(),this.consumeForPostposition(t,i));}let V=g,ae=se(z);if(ae?.roles.find(U=>U.role==="responseType"&&!U.required)&&!V.roles.has("responseType")){let U=ue=>typeof ue=="string"&&B.RESPONSE_TYPE_WORDS.has(ue.toLowerCase()),N=(ue,ke)=>{let ce=Object.fromEntries(V.roles);ke&&delete ce.destination,ce.responseType={type:"expression",raw:ue},g=pe(z,ce,V.metadata);},j=V.roles.get("destination"),J=ae?.roles.find(ue=>ue.role==="destination"),we=j?.raw??j?.value;if(j&&J&&!J.expectedTypes.includes(j.type)&&U(we))N(we,true);else {let ue=t.peek();ue&&U(ue.value)&&(N(ue.value,false),t.advance());}}if(z==="wait"){let U=g;if(!U.roles.has("event")){let N=t.peek();if(N&&xe.has(N.value.toLowerCase())){let j=Object.fromEntries(U.roles),J=j.duration;J&&J.type!=="literal"&&J.type!=="expression"&&delete j.duration;let we=j.patient;we&&we.type==="reference"&&we.value==="me"&&delete j.patient,j.event={type:"literal",value:N.value,dataType:"string"},g=pe(z,j,U.metadata),t.advance(),this.consumeForPostposition(t,i);}}}this.tryAttachTrailingRole(t,g,i),this.tryAttachTrailingStyle(t,g,i),this.tryAttachTrailingExpressionRole(t,g,i),this.tryAttachNewWindow(t,g);}let C=e.captured.get("continues"),S=C?.type==="literal"&&C.value==="then",x=t.peek(),w=!!x&&this.isThenKeyword(x.value,i),D=Ve.has(z)&&!!x&&!this.isEndKeyword(x.value,i),P=!!x&&!this.isEndKeyword(x.value,i),I=[g,...A],O=!!x&&this.isEndKeyword(x.value,i)&&jr(I)>0&&t.peek(1)!==null;if(O&&(t.advance(),I.push(tr)),S||w||D||P||O){let T=fe(i).filter(_=>_.command!=="on").sort((_,V)=>V.priority-_.priority),M=fe(i).filter(_=>_.id.startsWith("grammar-")&&_.id.includes("-continuation")).sort((_,V)=>V.priority-_.priority),H=this.parseBodyWithGrammarPatterns(t,T,M,i,I);v=this.foldLoopBlocks([...I,...H]);}else v=this.foldLoopBlocks(I),t.isAtEnd()||this.recordDroppedTokens(t.tokens.slice(t.position()),i,"handler body tail");}else {let z=fe(i).filter(g=>g.command!=="on").sort((g,A)=>A.priority-g.priority),k=h?e.roleStarts?.get("action"):void 0;if(k!==void 0&&k<t.position()){let g=new oe(t.tokens.slice(k),i);for(v=this.parseBodyWithClauses(g,z,i);!t.isAtEnd();)t.advance();}else v=this.parseBodyWithClauses(t,z,i);}let E=v.length>1?[rr(v,"then",{sourceLanguage:i})]:v;return vr(y,E,a,{sourceLanguage:i,patternId:e.pattern.id,confidence:e.confidence})}parseBodyWithClauses(e,t,i){let n=[],a=[],u=0,o=[],s=(c=0)=>{let d=jr(n);u=d+c,o.length=0;for(let m=0;m<d;m++)o.push("loop");for(let m=0;m<c;m++)o.push("while");};for(;!e.isAtEnd();){let c=e.peek();if(!c)break;if(a.length===0){let z=this.consumeJsBlock(e,i)??this.consumeVerbFinalJsBlock(e,i);if(z){n.push(z);continue}let k=this.tryParseConditionalBlock(e,t,i);if(k){n.push(k);continue}let g=this.tryParseUnlessGuard(e,t,i);if(g){n.push(...g);continue}}let d=c.kind==="conjunction"||c.kind==="keyword"&&this.isThenAt(c,Ee(e.tokens,e.position()),i),m=a[a.length-1],p=e.peek(1),f=m?.value.toLowerCase()==="at"&&p?.value.toLowerCase()==="of"||st(i,c.value,m?.value,p?.value),y=c.kind==="keyword"&&this.isEndKeyword(c.value,i)&&!f&&!Pe(Ee(e.tokens,e.position()),i);if((y||!f&&this.isBlockEndToken(c,Ee(e.tokens,e.position()),i))&&o.every(z=>z==="loop")&&this.closeLoopAtEnd(e,a,n,t,i)){a.length=0,s();continue}if(y&&u>0){u--,o.pop(),a.push({...c,metadata:{...c.metadata,closesTrackedBlock:true}}),e.advance();continue}if(d&&o.includes("if")){a.push(c),e.advance();continue}if(d){if(a.length>0){let z=this.parseClause(a,t,i);n.push(...z),a.length=0,s(z.filter(k=>{let g=k;return g.action==="while"&&(!Array.isArray(g.body)||g.body.length===0)}).length);}e.advance();continue}if(y){e.advance();let z=[];for(;!e.isAtEnd();){let k=e.peek();if(!k||k.kind==="conjunction"||k.kind==="keyword"&&(this.isThenKeyword(k.value,i)||this.isEndKeyword(k.value,i)))break;z.push(k),e.advance();}if(z.length>0){let k=this.coverageMark(),g=a.length>0?this.parseClause(a,t,i):[];g.length===0&&a.length>0?(this.coverageRollback(k),n.push(...this.parseClause([...a,...z],t,i))):(n.push(...g),n.push(...this.parseClause(z,t,i)));}else if(a.length>0){let k=this.parseClause(a,t,i);n.push(...k);}a.length=0;break}let h=(c.normalized??c.value).toLowerCase(),E=ct(c);if(c.kind==="keyword"||E){let z=this.isIfKeyword(h,i),k=Ir(a,a.length);(h==="for"||h==="while")&&k&&ct(k)||z&&k&&this.isElseKeyword(k.value,i)||(E&&o[o.length-1]==="while"?o[o.length-1]="loop":(z||this.isUnlessKeyword(h,i)||h==="while"||h==="for"||E)&&(u++,o.push(z?"if":E||h==="for"?"loop":h==="while"?"while":"other")));}a.push(c),e.advance();}if(a.length>0){let c=this.parseClause(a,t,i);n.push(...c);}e.isAtEnd()||this.recordDroppedTokens(e.tokens.slice(e.position()),i,"body stream tail"),this.foldFrontedWhileIntoRepeat(n,i);for(let c=n.length-1;c>=0;c--){let d=n[c];d.kind==="command"&&d.action==="for"&&(!(d.roles instanceof Map)||d.roles.size===0)&&(!Array.isArray(d.body)||d.body.length===0)&&n.splice(c,1);}let l=this.foldLoopBlocks(n);return l.length>1?[rr(l,"then",{sourceLanguage:i})]:l}closeLoopAtEnd(e,t,i,n,a){let u=jr(i);if(t.length===0)return u===0?false:(i.push(tr),e.advance(),true);let o=this.coverageMark(),s=this.parseClause([...t],n,a);return s.length===0||u+s.filter(zt).length===0?(this.coverageRollback(o),false):(i.push(...s,tr),e.advance(),true)}foldLoopBlocks(e){let t=[],i=[],n=u=>{(i.length>0?i[i.length-1].body:t).push(u);},a=u=>{let o=i.pop();o&&n(this.buildLoopNode(o.head,o.body,u));};for(let u of e)Ot(u)?a(true):zt(u)?i.push({head:u,body:[]}):n(u);for(;i.length>0;)a(false);return t}buildLoopNode(e,t,i=false){if(t.length===0&&!i)return e;let n=e.roles.get("loopType");if(n?.type==="literal"&&typeof n.value=="number"){let d=new Map(e.roles);return d.set("quantity",n),d.set("loopType",{type:"literal",value:"times"}),this.buildLoopNode({...e,roles:d},t,i)}let a=n?.type==="literal"?String(n.value):void 0,u=e.action==="for"||a==="for"?"for":a==="times"||a==="while"||a==="forever"?a:a==="until"||a==="until-event"?"until":e.roles.has("quantity")?"times":"forever",o=u==="for"?e.roles.get("patient"):void 0,s=o?q0(o):void 0,l=new Map(e.roles),c=l.get("quantity");return (u==="while"||u==="until")&&c&&!l.has("condition")&&(l.set("condition",c),l.delete("quantity")),hs(e.action==="for"?"for":"repeat",u,Object.fromEntries(l),t,{...s?{loopVariable:s}:{},...e.metadata?{metadata:e.metadata}:{}})}tryTopLevelLoop(e,t,i){let n=this.coverageMark(),a;try{let o=new oe(e.tokens,i);a=this.parseBodyWithClauses(o,t,i);}catch{return this.coverageRollback(n),null}let[u]=a;if(a.length===1&&u.kind==="loop")return u;if(a.length===1&&u.kind==="compound"){let o=u;if(o.statements[0]?.kind==="loop"){let s=o.statements.map(l=>l.metadata?.confidence??.75);return rr(o.statements,o.chainType,{sourceLanguage:i,confidence:s.reduce((l,c)=>l+c,0)/s.length})}}return this.coverageRollback(n),null}tryTopLevelCommandSequence(e,t,i){let n=this.coverageMark(),a;try{let l=new oe(e.tokens,i);a=this.parseBodyWithClauses(l,t,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 rr(u.statements,u.chainType,{sourceLanguage:i,confidence:s})}foldFrontedWhileIntoRepeat(e,t){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:t,patternId:`repeat-${t}-fronted-while-fold`,confidence:Math.max(a.metadata?.confidence??0,n.metadata?.confidence??0)}});}}takeRepeatCount(e,t,i){if(R(i)?.wordOrder==="SOV"){let u=B.countBeforeVerb(t,i);if(u<0)return;let o=t[u];return t.length=u,o}let n=e.mark();e.peek()?.kind==="particle"&&e.advance();let a=e.peek();if(a&&B.countsBefore(a,e.peek(1),i))return e.advance(),e.advance(),a;if(!B.isCountToken(a)){e.reset(n);return}return e.advance(),e.peek()?.kind==="identifier"&&e.advance(),a}static isCountToken(e){let t=e?.kind==="literal"?Vr(e):null;return t?.type==="literal"&&typeof t.value=="number"}static countsBefore(e,t,i){return !e||!t||!Ji[i]?.includes(t.value)?false:e.kind==="identifier"||B.isCountToken(e)}static countBeforeVerb(e,t){let i=B.isCountToken,n=e.length;return e[n-1]?.kind==="particle"&&n--,B.countsBefore(e[n-2],e[n-1],t)?n-2:(e[n-1]?.kind==="identifier"&&i(e[n-2])&&n--,i(e[n-1])?n-1:-1)}loopHeadReadsBody(e,t,i){if(R(i)?.wordOrder!=="SOV")return false;if(B.countBeforeVerb(t,i)>=0)return true;let n=e.captured.get("loopType");return n?.type==="literal"&&typeof n.value!="number"&&!X0.has(String(n.value))}bareRepeatHead(e,t){let i=e?Vr(e):null;return pe("repeat",e&&i?{loopType:X("times"),quantity:Yi(i,{start:e.position.start,end:e.position.end})}:{},{sourceLanguage:t,confidence:.6})}parseClause(e,t,i){if(e.length===0)return [];let n=null,a=e,u=e[e.length-1];if(u&&e.length>=2){let h=(u.normalized??u.value).toLowerCase();this.isUnlessKeyword(h,i)&&(n="unless",a=e.slice(0,-1));}let o=null;if(n&&a.length>=3){let h=R(i),E=h?B.buildVerbLookup(h):null;if(E)for(let z=1;z<a.length-1;z++){let k=a[z],g=E.get(k.value.toLowerCase())??(k.normalized?E.get(k.normalized.toLowerCase()):void 0);if(g&&!B.CONDITION_OPERATORS.has(g)){o=a.slice(0,z),a=a.slice(z);break}}}let s=new oe(a,i),l=[],c=this.coverageMark(),d=0,m=[],p=o,f=()=>{if(m.length===0)return;let h=m.slice();if(m.length=0,n&&l.length===0&&p===null){p=h;return}let E=h[0];if(!(E&&(E.kind==="identifier"||E.kind==="selector"||E.kind==="literal"||E.kind==="reference"))){this.recordDroppedTokens(h,i,"body clause");return}let k=false;for(let g of this.parseSOVClauseByVerbAnchoring(h,i)){let A=g.action,C=g.roles;A&&se(A)&&C instanceof Map&&C.size>0&&(l.push(g),k=true);}k||this.recordDroppedTokens(h,i,"body clause");};for(;!s.isAtEnd();){let h=s.peek(),E=!!h&&h.normalized?.toLowerCase()==="repeat",z=s.mark(),k=be.matchBest(s,t);if(E&&k&&(k.pattern.command!=="repeat"||this.loopHeadReadsBody(k,m,i))){s.reset(z),s.advance();let g=this.takeRepeatCount(s,m,i);f(),l.push(this.bareRepeatHead(g,i)),d++;continue}if(!k&&h&&this.isIfKeyword((h.normalized??h.value).toLowerCase(),i)){let g=this.tryParseConditionalBlock(s,t,i);if(g){f(),l.push(g),d++;continue}}if(k&&k.pattern.command==="if"){let g=s.mark(),A=m.length;for(s.reset(z);!s.isAtEnd();){let S=s.peek();if(!S||this.isIfKeyword((S.normalized??S.value).toLowerCase(),i))break;m.push(S),s.advance();}let C=this.tryParseConditionalBlock(s,t,i);if(C){f(),l.push(C),d++;continue}m.length=A,s.reset(g);}if(k){f();let g=this.buildCommand(k,i);l.push(g),d++,this.tryAttachTrailingRole(s,g,i),this.tryAttachTrailingStyle(s,g,i),this.tryAttachTrailingExpressionRole(s,g,i),this.tryAttachTrailingDuration(s,g);}else {let g=m.length===0?this.tryParsePseudoCommand(s,t,i):null;if(g){f(),l.push(g),d++;continue}let A=s.peek(),C=A?.kind==="identifier"&&A.value.toLowerCase()==="repeat";if(A&&(A.normalized?.toLowerCase()==="repeat"||C)){let S=s.mark();s.advance();let x=this.takeRepeatCount(s,m,i);if(x||!C){f(),l.push(this.bareRepeatHead(x,i)),d++;continue}s.reset(S);}A&&m.push(A),s.advance();}}f();let y=l;if(d===0){let h=this.parseSOVClauseByVerbAnchoring(a,i);h.length>0&&(this.coverageRollback(c),y=h);}let v=p;return n&&y.length>0&&v&&v.length>0?[pe(n,{condition:{type:"expression",raw:this.joinTokenText(v,i)}},{sourceLanguage:i,patternId:`${n}-${i}-trailing-guard`,confidence:.85}),...y]:n&&v&&v.length>0&&y.length===0?[pe(n,{condition:{type:"expression",raw:this.joinTokenText(v,i)}},{sourceLanguage:i,patternId:`${n}-${i}-trailing-guard`,confidence:.85})]:y}tryAttachTrailingDuration(e,t){let i=t.roles;if(i.has("duration")||!se(t.action)?.roles.some(u=>u.role==="duration"&&!u.required))return;let a=e.peek();!a||!/^\d+(?:\.\d+)?(?:ms|s|m|h)$/.test(a.value)||(i.set("duration",X(a.value,"duration")),e.advance());}tryAttachNewWindow(e,t){let i=t.roles;if(t.action!=="go"||i.has("manner"))return;let[n,a,u]=[e.peek(),e.peek(1),e.peek(2)];if(!(n?.value.toLowerCase()!=="in"||a?.value.toLowerCase()!=="new")&&!(!u||(u.normalized??u.value).toLowerCase()!=="window")){i.set("manner",Ae("window"));for(let o=0;o<3;o++)e.advance();}}tryAttachTrailingRole(e,t,i){let n=se(t.action);if(!n)return;let a=R(i);if(!a)return;let u=t.roles,o=(l,c)=>{if(!l)return false;if(l.kind==="selector")return true;let d=(l.normalized??l.value).toLowerCase();return dt.has(d)?false:d==="body"||d==="it"||d==="you"||d==="result"||d==="document"||d==="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 d=a.roleMarkers?.[l];if(!d)continue;let m=u.get(l);if(m&&!(m.type==="reference"&&m.value==="me"))continue;let p=v=>{if(!v||v.kind!=="particle"&&v.kind!=="keyword")return false;let h=v.value.toLowerCase();return d.primary?.toLowerCase()===h?true:c?false:(v.normalized??"").toLowerCase()===l?true:!!d.alternatives?.some(E=>E.toLowerCase()===h)},f=e.peek(),y=e.peek(1);if(!f||!y)return;if(c&&d.position==="after"){let v=e.peek(2),h=(f.normalized??f.value).toLowerCase();if(K0.has(h)&&y.kind==="selector"&&p(v)){u.set(l,{type:"expression",raw:`${h} ${y.value}`}),e.advance(),e.advance(),e.advance();return}}if(d.position==="after"){if(o(f,c)&&p(y)){let v=this.tokenToSemanticValue(f);e.advance(),e.advance(),v&&u.set(l,v);return}if(c&&o(f,c)){let v=e.peek(2),h=e.peek(3);if((y.normalized??y.value).toLowerCase()==="in"&&v&&!p(v)&&p(h)){let E=this.tokenToSemanticValue(f);e.advance(),e.advance(),e.advance(),e.advance(),E&&u.set(l,E);return}}}else if(p(f)&&o(y,c)){e.advance();let v=this.tokenToSemanticValue(e.advance());v&&u.set(l,v);return}}}tryAttachTrailingStyle(e,t,i){if(t.action!=="fetch"&&t.action!=="render")return;let n=t.roles;if(!se(t.action)?.roles.some(h=>h.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 h=wr(e,u.raw);h&&n.set("style",{type:"expression",raw:h});}this.tryAttachResponseTypeAfterStyle(e,t,i);return}if(t.action==="fetch"){let h=n.get("patient"),E=n.get("source");if(h&&E&&(h.type==="literal"||h.type==="expression")&&E.type==="expression"&&typeof E.raw=="string"&&/^[A-Za-z_][\w-]*$/.test(E.raw)&&e.peek()?.value===":"){let z=wr(e,E.raw);z&&(n.set("source",{type:"expression",raw:z}),this.tryAttachResponseTypeAfterStyle(e,t,i));return}}let s=R(i)?.roleMarkers?.style;if(!s)return;if(s.position==="before"){let h=new Set([s.primary,...s.alternatives??[]].map(g=>g.toLowerCase())),E=e.peek();if(!E||!h.has(E.value.toLowerCase()))return;let z=e.mark();e.advance();let k=wr(e);if(!k){e.reset(z);return}n.set("style",{type:"expression",raw:k}),this.tryAttachResponseTypeAfterStyle(e,t,i);return}if(s.position!=="after")return;let l=new Set([s.primary,...s.alternatives??[]].map(h=>h.toLowerCase())),c=h=>h.kind==="conjunction"||h.kind==="keyword"&&(this.isThenKeyword(h.value,i)||this.isEndKeyword(h.value,i)),d=24,m=-1,p=0;for(let h=0;h<d;h++){let E=e.peek(h);if(!E||c(E))break;if(E.value==="("||E.value==="{"?p++:(E.value===")"||E.value==="}")&&(p=Math.max(0,p-1)),p===0&&(E.kind==="particle"||E.kind==="keyword")&&l.has(E.value.toLowerCase())){m=h;break}}if(m<=0)return;let f=[];for(let h=0;h<m;h++){let E=e.peek(h);E&&f.push(E);}if(f.length===1&&B.RESPONSE_TYPE_WORDS.has(f[0].value.toLowerCase()))return;let y=new oe(f,i),v=wr(y);n.set("style",{type:"expression",raw:v&&y.isAtEnd()?v:this.joinTokenText(f,i)});for(let h=0;h<=m;h++)e.advance();this.tryAttachResponseTypeAfterStyle(e,t,i);}tryAttachResponseTypeAfterStyle(e,t,i){let n=t.roles;if(n.has("responseType")||!se(t.action)?.roles.some(c=>c.role==="responseType"&&!c.required))return;let u=c=>!!c&&B.RESPONSE_TYPE_WORDS.has(c.toLowerCase()),o=e.peek();if(!o)return;let s=c=>{n.set("responseType",{type:"expression",raw:c});};if(B.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 B.AS_MARKERS_AFTER[i]??[])if(c.every((d,m)=>e.peek(m)?.value.toLowerCase()===d)){for(let d=0;d<c.length;d++)e.advance();break}}}tryAttachTrailingExpressionRole(e,t,i){let n=t.action,a=n==="js"?{role:"patient",terminator:"boundary"}:n==="go"||n==="scroll"?{role:"destination",terminator:"destination-marker"}:null;if(!a)return;let u=t.roles,o=u.get(a.role);if(n==="go"&&o&&o.type==="expression"&&String(o.raw).toLowerCase()==="url"){let h=e.peek();if(h&&!dt.has((h.normalized??h.value).toLowerCase())){let z=this.tokenToSemanticValue(h);if(z.type==="literal"||z.type==="selector"){u.set(a.role,z),u.set("method",{type:"literal",value:"url"}),e.advance();return}}let E=u.get("patient");if(E&&(E.type==="literal"||E.type==="selector")){u.set(a.role,E),u.set("method",{type:"literal",value:"url"}),u.delete("patient");return}}if(n==="go"&&o&&o.type==="expression"){let h=/^url\s+(\S+)$/i.exec(String(o.raw??""));if(h){let E=h[1].replace(/^["']|["']$/g,"");u.set(a.role,{type:"literal",value:E,dataType:"string"}),u.set("method",{type:"literal",value:"url"});return}}if(n==="go"&&!o){let h=u.get("patient");if(h&&h.type==="expression"&&String(h.raw).toLowerCase()==="url"){let E=e.peek();if(E&&!dt.has((E.normalized??E.value).toLowerCase())){let z=this.tokenToSemanticValue(E);if(z.type==="literal"||z.type==="selector"){u.set(a.role,z),u.set("method",{type:"literal",value:"url"}),u.delete("patient"),e.advance();return}}}}if(o&&!(o.type==="reference"&&o.value==="me"))return;let s=R(i);if(!s)return;let l=null;if(a.terminator==="destination-marker"){let h=s.roleMarkers?.destination;if(!h||h.position!=="after")return;l=h.primary.toLowerCase();}let c=h=>h.kind==="conjunction"||h.kind==="keyword"&&(this.isThenKeyword(h.value,i)||this.isEndKeyword(h.value,i)),d=24,m=[],p=0,f=false;for(let h=0;h<d;h++){let E=e.peek(h);if(!E||c(E))break;if(E.value==="("||E.value==="{"?p++:(E.value===")"||E.value==="}")&&(p=Math.max(0,p-1)),l!==null&&p===0&&(E.kind==="particle"||E.kind==="keyword")&&E.value.toLowerCase()===l){f=true;break}m.push(E);}if(m.length===0||l!==null&&!f)return;let y=m.length+(f?1:0);if(n==="go"&&m.length===2&&m[0].value.toLowerCase()==="url"){let h=this.tokenToSemanticValue(m[1]);if(h.type==="literal"||h.type==="selector"){u.set(a.role,h),u.set("method",{type:"literal",value:"url"});let E=u.get("patient");E&&E.type==="reference"&&E.value==="me"&&!se(n)?.roles.some(z=>z.role==="patient")&&u.delete("patient");for(let z=0;z<y;z++)e.advance();return}}let v=m;if(n==="js"){let h=s.keywords?.js,E=k=>[h?.primary,...h?.alternatives??[]].some(g=>!!g&&g.length>k.value.length&&g.includes(k.value)),z=0;for(;z<v.length&&E(v[z]);)z++;if(v=v.slice(z),v.length===0)return}if(u.set(a.role,{type:"expression",raw:this.joinTokenText(v,i)}),a.role!=="patient"){let h=u.get("patient");h&&h.type==="reference"&&h.value==="me"&&!se(n)?.roles.some(E=>E.role==="patient")&&u.delete("patient");}for(let h=0;h<y;h++)e.advance();}static buildVerbLookup(e){let t=new Map;for(let[i,n]of Object.entries(e.keywords))if(!["on","if","else","when","where","while","end","then","and"].includes(i)&&(t.set(n.primary.toLowerCase(),i),n.alternatives))for(let a of n.alternatives)t.set(a.toLowerCase(),i);return t}static buildMarkerToRoleLookup(e){let t=new Map;for(let[i,n]of Object.entries(e.roleMarkers)){if(!n)continue;if((i!=="event"||!t.has(n.primary))&&t.set(n.primary,i),n.alternatives)for(let u of n.alternatives)t.has(u)||t.set(u,i);}return t}parseSOVClauseByVerbAnchoring(e,t){let i=R(t);if(!i||i.wordOrder!=="SOV")return [];let n=B.buildVerbLookup(i),a=B.buildMarkerToRoleLookup(i),u=[],o=0;for(;o<e.length;){let s=-1,l="";for(let f=o;f<e.length;f++){let y=e[f];if(a.has(y.value))continue;let v=n.get(y.value.toLowerCase()),h=y.normalized?n.get(y.normalized.toLowerCase()):void 0,E=v||h;if(E){s=f,l=E;break}}if(s===-1)break;let c=e.slice(o,s),d=e.length;for(let f=s+1;f<e.length;f++){let y=e[f];if(y.kind==="conjunction"||this.isThenKeyword(y.value,t)){d=f;break}if(f>s+1&&!a.has(y.value)&&(n.get(y.value.toLowerCase())||(y.normalized?n.get(y.normalized.toLowerCase()):void 0))){d=f;break}}let m=e.slice(s+1,d),p=this.extractRolesFromMarkedTokens(c,m,a,l,t);if(u.push(pe(l,p,{sourceLanguage:t,confidence:.7})),o=d,o<e.length){let f=e[o];(f.kind==="conjunction"||this.isThenKeyword(f.value,t))&&o++;}}return u}extractRolesFromMarkedTokens(e,t,i,n,a){let u={},o=(l,c)=>{let d=this.isEndKeyword(l.value,a),m=l.kind==="keyword"&&(l.normalized??"").toLowerCase()==="end";return !d&&!m?false:l.metadata?.closesTrackedBlock===true||d?true:!(c&&c.kind==="selector")},s=l=>{let c=[];for(let d=0;d<l.length;d++){let m=l[d];if(o(m,l[d+1]))continue;let p=i.get(m.value);if(p&&m.kind==="particle"&&c.length>0){let f=this.tokensToSemanticValue(c,a);if(f){let y=this.mapRoleForCommand(p,n,u);y&&(u[y]=f);}c=[];}else c.push(m);}if(c.length>0)if(c.length===1&&/^\d+(\.\d+)?(ms|s)$/i.test(c[0].value)&&!u.duration&&se(n)?.roles.some(m=>m.role==="duration"))u.duration={type:"literal",value:c[0].value,dataType:"string"};else {let m=this.tokensToSemanticValue(c,a);m&&(u.patient?u.destination||(u.destination=m):u.patient=m);}};return s(e),s(t),u}mapRoleForCommand(e,t,i){return t==="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,t){if(e.length===0)return null;let i=e.filter(o=>o.kind!=="whitespace");if(i.length===0)return null;if(i.length>=2&&(i[0].kind==="selector"||/^[#.@*<]/.test(i[0].value))){let o=i.findIndex((s,l)=>l>0&&(s.normalized??s.value).toLowerCase()==="in");o>0&&(i=i.slice(0,o));}if(i.length===1)return this.tokenToSemanticValue(i[0]);let n=this.joinTokenText(i,t);if(vn(n))return {type:"expression",raw:n};let a=i.map(o=>o.value).join(""),u=i[0];return u.kind==="selector"||u.value.startsWith("#")||u.value.startsWith(".")||u.value.startsWith("@")||u.value.startsWith("*")?Oe(a):u.kind==="literal"||u.value.startsWith('"')||u.value.startsWith("'")?X(Q0(a),"string"):u.kind==="reference"?Ae(a):X(n)}tokenToSemanticValue(e){return Vr(e)??X(e.value)}parseBodyWithGrammarPatterns(e,t,i,n,a=[]){let u=[],o=()=>jr([...a,...u]),s=[],l=false,c=()=>{if(!l&&s.length>0){let p=this.parseSOVClauseByVerbAnchoring(s,n);u.push(...p),p.length===0&&this.recordDroppedTokens(s,n,"fused body walk");}else s.length>0&&this.recordDroppedTokens(s,n,"fused body walk");s=[],l=false;},d=0,m=()=>u.filter(p=>{let f=p;return f.action==="while"&&(!Array.isArray(f.body)||f.body.length===0)}).length-d;for(;!e.isAtEnd();){let p=e.peek();if(p&&this.isThenKeyword(p.value,n)){c(),e.advance();continue}if(p&&o()>0&&!this.isEndKeyword(p.value,n)&&this.isBlockEndToken(p,Ee(e.tokens,e.position()),n)&&!st(n,p.value,e.peek(-1)?.value,e.peek(1)?.value)){c(),u.push(tr),e.advance();continue}if(p&&this.isEndKeyword(p.value,n)){let y=e.peek(-1),v=e.peek(1);if(!st(n,p.value,y?.value,v?.value)){if(c(),o()>0){u.push(tr),e.advance();continue}if(m()>0){d++,e.advance();continue}e.advance();break}}if(p&&!l&&this.isIfKeyword((p.normalized??p.value).toLowerCase(),n)){c();let y=this.tryParseConditionalBlock(e,t,n);if(y){u.push(y),l=true;continue}}let f=false;if(i.length>0){let y=be.matchBest(e,i);if(y){let v=y.pattern.command,h={};for(let[k,g]of y.captured)k!=="event"&&k!=="action"&&k!=="continues"&&(h[k]=g);let E=pe(v,h,{sourceLanguage:n,patternId:y.pattern.id});u.push(E),f=true,l=true;let z=y.captured.get("continues");if(z&&z.type==="literal"&&z.value==="then")continue}}if(!f){let y=e.mark(),v=be.matchBest(e,t);if(v){if(v.pattern.command==="if"){let E=e.mark();for(e.reset(y);!e.isAtEnd();){let k=e.peek();if(!k||this.isIfKeyword((k.normalized??k.value).toLowerCase(),n))break;e.advance();}let z=this.tryParseConditionalBlock(e,t,n);if(z){c(),u.push(z),l=true;continue}e.reset(E);}let h=this.buildCommand(v,n);u.push(h),this.tryAttachTrailingRole(e,h,n),f=true,l=true;}}f||(p&&s.push(p),e.advance());}c(),e.isAtEnd()||this.recordDroppedTokens(e.tokens.slice(e.position()),n,"fused body walk");for(let p=u.length-1;p>=0;p--){let f=u[p];f.kind==="command"&&f.action==="for"&&(!(f.roles instanceof Map)||f.roles.size===0)&&(!Array.isArray(f.body)||f.body.length===0)&&u.splice(p,1);}return u}tryCompoundCommandParsing(e,t,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 oe(n,i),s=this.coverageMark(),l=this.parseBodyWithClauses(o,t,i);return l.length===0?(this.coverageRollback(s),null):l[0]}static isEnEventKeyword(e){if(typeof e!="string")return false;let t=e.toLowerCase(),i=B.enEventKeywordCache.get(t);if(i!==void 0)return i;let n=false;try{let a=Z(t,"en").tokens;n=a.length===1&&a[0]?.kind==="keyword";}catch{n=false;}return B.enEventKeywordCache.set(t,n),n}matchEventMarkerPhrase(e,t,i){let n=B.SOV_EVENT_MARKER_PHRASES[i];if(!n)return 0;for(let a of n)if(a.every((u,o)=>e[t+o]?.value===u))return a.length;return 0}hasSOVEventMarkerHead(e,t){let i=B.SOV_EVENT_MARKERS[t];if(i===void 0)return false;let{tokens:n}=Z(e,t),a=Fe[t],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&&(B.KNOWN_EVENTS.has(c)||xe.has(c))||B.KNOWN_EVENTS.has(l)||xe.has(l)||u.has(l)))continue;let m=this.matchEventParamPhrase(n,o+1).len,p=n[o+1+m];if(p&&(p.kind==="particle"||p.kind==="keyword")&&i.has(p.value)||this.matchEventMarkerPhrase(n,o+1+m,t)>0)return true}return false}tryScrollModifiers(e,t,i){let n=p=>p?.value.toLowerCase()??"",a=-1,u=-1;for(let p=0;p<e.length&&a<0;p++){let f=n(e[p])==="the"?p+1:p;Ai.has(n(e[f]))&&(Ai.has(n(e[f+1]))&&f++,!(n(e[f+1])!=="of"||!e[f+2])&&(a=p,u=f+1));}let o=a<0?e.findIndex(p=>U0.has(n(p))):-1;if(a<0&&o<0)return null;let s=a>=0?a:o,l=a>=0?u:o,c=t.slice(0,e[s].position.start).trimEnd(),d=t.slice(e[l].position.end).trimStart(),m=c?c.length+1:0;try{let p=this.parse(c?`${c} ${d}`:d,i),f=[],y=E=>{if(!E)return;E.kind==="command"&&(E.action==="go"||E.action==="scroll")&&f.push(E);let z=E;for(let k of Er){let g=z[k];Array.isArray(g)&&g.forEach(A=>y(A));}};y(p??void 0);let v=E=>E.roles.get("destination")?.position?.start??-1,h=E=>f.filter(z=>v(z)>=0&&v(z)<=E).reduce((z,k)=>!z||v(k)>v(z)?k:z,void 0);if(!p)return null;if(a>=0){let E=h(m),z=E?.roles.get("destination"),k=e[u+1];if(!E||!z||!G0(z,k))return null;let g=e.slice(a,u).map(A=>A.value.toLowerCase());E.scrollPosition=g.join(" ");}else {let E=h(e[o].position.start-1);if(!E)return null;E.scrollBehavior=n(e[o]);}return p}catch{return null}}tryDoNotThrow(e,t,i){let n=s=>s?.value.toLowerCase(),a=e.findIndex((s,l)=>n(s)==="do"&&n(e[l+1])==="not"&&n(e[l+2])==="throw");if(a<0)return null;let u=e[a].position.start,o=(t.slice(0,e[a].position.start).trimEnd()+" "+t.slice(e[a+2].position.end).trimStart()).trim();try{let s=this.parse(o,i),l=[],c=p=>{if(!p)return;p.kind==="command"&&p.action==="fetch"&&l.push(p);let f=p;for(let y of Er){let v=f[y];Array.isArray(v)&&v.forEach(h=>c(h));}};c(s??void 0);let d=p=>p.roles.get("source")?.position?.start??-1,m=l.filter(p=>d(p)>=0&&d(p)<u).reduce((p,f)=>!p||d(f)>d(p)?f:p,void 0);return !s||!m?null:(m.doNotThrow=!0,s)}catch{return null}}tryTellTo(e,t,i){let n=s=>(s.normalized??s.value).toLowerCase()==="tell",a=e.findIndex(n);if(a<0)return null;let u=R(i)?.roleMarkers?.destination,o=new Set([u?.primary,...u?.alternatives??[]].filter(s=>!!s));for(let s=a+1;s<e.length;s++){if(e[s].value.toLowerCase()!=="to")continue;let l=e[s].position.start,c=(t.slice(0,l).trimEnd()+" "+t.slice(e[s].position.end).trimStart()).trim();try{let d=this.parse(c,i);if(!d)continue;let m=[],p=E=>{if(!E)return;E.kind==="command"&&m.push(E);let z=E;for(let k of Er){let g=z[k];Array.isArray(g)&&g.forEach(A=>p(A));}};p(d);let f=E=>E.roles.get("destination")?.position?.start??-1,y=m.filter(E=>E.action==="tell"&&f(E)>=0&&f(E)<l).reduce((E,z)=>!E||f(z)>f(E)?z:E,void 0);if(!y)continue;let v=y.roles.get("destination")?.position?.end??-1;if(v<0||!e.filter(E=>E.position.start>=v&&E.position.start<l).every(E=>n(E)||o.has(E.value)))continue;return d}catch{continue}}return null}tryLoopIndex(e,t,i){let n=l=>l?.value.toLowerCase(),a=new Set;for(let l of fe(i))if(!(l.command!=="repeat"&&l.command!=="for")){for(let c of l.template.tokens)if(c.type==="literal")for(let d of [c.value,...c.alternatives??[]])a.add(d.toLowerCase());}let u=l=>a.has(l.value.toLowerCase()),o=R(i)?.roleMarkers?.style?.primary?.toLowerCase(),s=l=>n(l)==="with"||!!o&&n(l)===o;for(let l=0;l+1<e.length;l++){let c=s(e[l])&&n(e[l+1])==="index",d=n(e[l])==="index";if(!c&&!d)continue;let m=e[l].position.start,p=(t.slice(0,m).trimEnd()+" "+t.slice(e[l+1].position.end).trimStart()).trim();try{let f=this.parse(p,i);if(!f)continue;let y=[],v=C=>{if(!C)return;C.kind==="loop"&&y.push(C);let S=C;for(let x of Er){let w=S[x];Array.isArray(w)&&w.forEach(b=>v(b));}};v(f);let h=C=>Math.max(-1,...[...C.roles.values()].map(S=>S.position?.end??-1).filter(S=>S<=m)),E=y.filter(C=>h(C)>=0).reduce((C,S)=>!C||h(S)>h(C)?S:C,void 0);if(!E)continue;let z=e.filter(C=>C.position.start>=h(E)&&C.position.start<m),k=E.roles.get("quantity"),g=k?.type==="literal"&&typeof k.value=="number"?k.position?.end:void 0,A=g===void 0?void 0:e.find(C=>C.position.start>=g);if(!z.every(C=>C===A||u(C)))continue;return E.indexVariable=c?"index":e[l+1].value,f}catch{continue}}return null}tryWaitAlternatives(e,t,i){let n=v=>!!v&&(v.normalized??v.value).toLowerCase()==="wait";if(!e.some(v=>n(v)))return null;let a=v=>(v.normalized??v.value).toLowerCase(),u=v=>{if(!v)return;let h=z=>B.KNOWN_EVENTS.has(z)||xe.has(z);if(h(a(v)))return a(v);let E=Tn(v.value,i);return h(E)?E:void 0},o=v=>u(v)!==void 0,s=v=>!!v&&/^\d+(?:\.\d+)?(?:ms|s)$/.test(v.value),l=R(i)?.roleMarkers?.source,c=new Set([l?.primary,...l?.alternatives??[]].filter(Boolean).map(v=>v.toLowerCase())),d=v=>!!v&&((v.normalized??"")==="source"||c.has(v.value.toLowerCase())),m=l?.position!=="after",p=R(i)?.wordOrder==="SOV",f=(v,h)=>p?n(e[h])||e[h]?.kind==="particle"&&n(e[h+1]):n(e[v-1])||n(e[v-2]),y=v=>{let h=On(u(e[v]),i).split(/\s+/);return h.length<2||e[v].value!==h[0]?1:h.every((E,z)=>z===0||e[v+z]?.value===E)?h.length:1};for(let v=0;v<e.length;v++){if(!o(e[v]))continue;let h=[],E=v+y(v),z=this.matchEventParamPhrase(e,E);h.push(z.names.length>0?{event:u(e[v]),params:z.names}:{event:u(e[v])});let k=E+z.len;for(;Wr(e[k]??{value:""},i);){let O=e[k+1];if(o(O)){let T=k+1+y(k+1),M=this.matchEventParamPhrase(e,T);h.push(M.names.length>0?{event:u(O),params:M.names}:{event:u(O)}),k=T+M.len;}else if(s(O))h.push({duration:O.value}),k+=2;else break}let g=k,A,C;if(m&&d(e[k])&&e[k+1]?(A=[k,k+1],C=e[k+1]):!m&&e[k]&&d(e[k+1])&&(A=[k,k+1],C=e[k]),!(h.length>1||z.names.length>0||!!A))continue;let x=A?A[1]+1:g;if(!f(v,x))continue;let w=[];g>E&&w.push([e[E-1].position.end,e[g-1].position.end]),A&&w.push([e[A[0]].position.start,e[A[1]].position.end]),w.sort((O,T)=>O[0]-T[0]);let b="",D=0;for(let[O,T]of w)b+=t.slice(D,O)+" ",D=T;b=(b+t.slice(D)).replace(/\s+/g," ").trim();let P=h[0],I=0;for(let O=0;O<v;O++)u(e[O])===P.event&&f(O,O+1)&&I++;try{let O=this.parse(b,i),T=[],M=_=>{if(!_)return;let V=_.roles?.get("event"),ae=V?.type==="expression"?V.raw:V&&"value"in V?String(V.value):void 0;_.kind==="command"&&_.action==="wait"&&ae?.toLowerCase()===P.event&&T.push(_);let he=_;for(let U of Er){let N=he[U];Array.isArray(N)&&N.forEach(j=>M(j));}};M(O??void 0);let H=T[I];if(!O||!H)continue;return H.waitAlternatives=h,C&&(H.waitSource=Y0(C)),O}catch{}}return null}isBodyCommandWord(e,t){let i=(e.normalized??e.value).toLowerCase();return e.kind==="keyword"&&t.has(i)&&!B.KNOWN_EVENTS.has(i)&&!xe.has(i)}matchEventParamPhrase(e,t){if(e[t]?.value!=="(")return {len:0,names:[]};let i=[];for(let n=t+1;n<e.length;n++){let a=e[n].value;if(a===")")return e[t-1]?.position?.end!==e[t]?.position?.start&&e[n+1]?.kind==="particle"?{len:0,names:[]}:{len:n-t+1,names:i};if(a===",")continue;let u=e[n].kind;if(u!=="identifier"&&u!=="keyword"||!/^[A-Za-z_$][\w$]*$/.test(a))break;let o=(e[n].normalized??a).toLowerCase();if(u==="keyword"&&H0.has(o))break;i.push(a);}return {len:0,names:[]}}isStrippableSourceRef(e,t){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 t.has(n)||!!i&&t.has(i)}tryTrailingEventExtraction(e,t,i){let n=Z(e,t).tokens;if(n.length<3)return null;let a=Fe[t],u=new Set;if(a)for(let k of Object.keys(a))u.add(k.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],d=c.value.toLowerCase(),m=c.normalized?.toLowerCase();if(!(!!m&&B.KNOWN_EVENTS.has(m)||B.KNOWN_EVENTS.has(d)||u.has(d)))return null;let f=m&&B.KNOWN_EVENTS.has(m)?m:a?.[d]??d,y=n.slice(0,o);if(y.length===0)return null;let v=i.filter(k=>k.command!=="on"),h=new oe(y,t),E=this.coverageMark(),z=this.parseBodyWithClauses(h,v,t);return z.length===0?(this.coverageRollback(E),null):vr({type:"literal",value:f},z,void 0,{sourceLanguage:t,confidence:.75})}tryMidStreamEventExtraction(e,t,i){let n=Z(e,t).tokens;if(n.length<3)return null;let a=Fe[t],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],d=c.value.toLowerCase(),m=c.normalized?.toLowerCase();if(!(!!m&&B.KNOWN_EVENTS.has(m)||B.KNOWN_EVENTS.has(d)||u.has(d)))continue;let f=m&&B.KNOWN_EVENTS.has(m)?m:a?.[d]??d,y=n.filter((k,g)=>g!==o&&g!==o+1);if(y.length===0)return null;let v=i.filter(k=>k.command!=="on"),h=new oe(y,t),E=this.coverageMark(),z=this.parseBodyWithClauses(h,v,t);return z.length===0?(this.coverageRollback(E),null):vr({type:"literal",value:f},z,void 0,{sourceLanguage:t,confidence:.75})}return null}trySOVEventExtraction(e,t,i){let n=B.SOV_EVENT_MARKERS[t];if(!n)return null;let u=Z(e,t).tokens,o=Fe[t],s=new Set;if(o)for(let A of Object.keys(o))s.add(A.toLowerCase());let l=B.SOV_SOURCE_MARKERS[t],c=-1,d="",m="",p=1,f=[];for(let A=0;A<u.length;A++){let C=u[A],S=C.value.toLowerCase(),x=S,w="",b=S.indexOf("[");b>0&&(x=S.slice(0,b),w=C.value.slice(b));let D=C.normalized?.toLowerCase(),P=D&&(B.KNOWN_EVENTS.has(D)||xe.has(D)),I=s.has(S)||s.has(x),O=B.KNOWN_EVENTS.has(x)||xe.has(x);if(P||I||O){let T=u[A-1];if(T&&(T.normalized??T.value).toLowerCase()==="event")continue;let M;P?M=D:I?M=o?.[S]??o?.[x]??x:M=x;let H=this.matchEventParamPhrase(u,A+1);if(n.size>0){let _=1+H.len,V=u[A+_];V&&V.kind==="selector"&&V.value.startsWith("[")&&(_+=1);let ae=u[A+_];if(ae&&(ae.kind==="particle"||ae.kind==="keyword")&&n.has(ae.value)){c=A,d=M,m=w||(_===H.len+2?u[A+_-1].value:""),p=_+1,f=H.names;break}}else {c=A,d=M,m=w,p=1+H.len+this.matchEventMarkerPhrase(u,A+1+H.len,t),f=H.names;break}}}if(c===-1){let A=new Set(i.filter(C=>C.command!=="on").map(C=>C.command));for(let C=0;C<u.length;C++){let S=u[C];if(S.kind==="identifier"&&!S.value.startsWith("`"))if(n.size>0){let x=1,w=u[C+1];w&&w.kind==="selector"&&w.value.startsWith("[")&&(x=2);let b=u[C+x];if(b&&(b.kind==="particle"||b.kind==="keyword")&&n.has(b.value)){c=C,d=S.value,m=x===2?u[C+1].value:"",p=x+1;break}}else {let x=this.matchEventMarkerPhrase(u,C+1,t);if(x>0){c=C,d=S.value,m="",p=1+x;break}let w=u[C+1];if(w&&w.kind==="keyword"&&w.normalized!=null&&A.has(w.normalized)){c=C,d=S.value,m="",p=1;break}}}}if(c===-1)return null;let y=new Set;for(let A=c;A<c+p;A++)y.add(A);if(l){let A=c+p;if(A<u.length){let C=u[A];if((C.kind==="particle"||C.kind==="keyword")&&l.markers.has(C.value))y.add(A);else if(this.isStrippableSourceRef(C,l.windowTokens)){let S=u[A+1];S&&(S.kind==="particle"||S.kind==="keyword")&&l.markers.has(S.value)&&(y.add(A),y.add(A+1));}}if(c>=2){let C=u[c-1];(C.kind==="particle"||C.kind==="keyword")&&l.markers.has(C.value)&&this.isStrippableSourceRef(u[c-2],l.windowTokens)&&(y.add(c-2),y.add(c-1));}for(let C=0;C<c;C++){let S=u[C],x=S.value.toLowerCase(),w=S.normalized?.toLowerCase();if(l.windowTokens.has(x)||w&&l.windowTokens.has(w)){y.add(C);break}}}let v=u.filter((A,C)=>!y.has(C));if(v.length===0)return null;let h=i.filter(A=>A.command!=="on"),E=new oe(v,t),z=this.coverageMark(),k=this.parseBodyWithClauses(E,h,t);if(k.length===0)return this.coverageRollback(z),null;let g={sourceLanguage:t,confidence:.75};return m&&(g.keyFilter=m),vr(B.isEnEventKeyword(d)?{type:"literal",value:d}:{type:"expression",raw:d},k,void 0,g,f)}profileKeywordMatches(e,t,i){let n=R(e)?.keywords?.[t];return n?n.primary?.toLowerCase()===i?true:!!n.alternatives?.some(a=>a.toLowerCase()===i):false}consumeForPostposition(e,t){let i=e.peek();if(!i)return;let n=(i.normalized??"").toLowerCase(),a=R(t)?.keywords?.for;(n==="for"||i.value===a?.primary||(a?.alternatives??[]).includes(i.value))&&e.advance();}isThenAt(e,t,i){return this.isThenKeyword(e.value,i)?!(this.isEndKeyword(e.value,i)&&Pe(t,i)):false}isThenKeyword(e,t){let i=e.toLowerCase(),a={en:new Set(["then"]),ja:new Set(["\u305D\u308C\u304B\u3089","\u6B21\u306B"]),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\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"])}[t];return a?a.has(i):i==="then"||this.profileKeywordMatches(t,"then",i)}isElseKeyword(e,t){let i=e.toLowerCase();return i==="else"?true:this.profileKeywordMatches(t,"else",i)}isEndKeyword(e,t){let i=e.toLowerCase(),n=zs(t);return n?i==="end"||n.has(i):i==="end"||this.profileKeywordMatches(t,"end",i)}isJsKeyword(e){let t=(e.normalized??e.value).toLowerCase();return t==="js"||this.profileKeywordMatches("en","js",t)}isPatientMarker(e,t){let i=R(t)?.roleMarkers?.patient;if(!i?.primary)return false;let n=e.value.toLowerCase();return i.primary.toLowerCase()===n?true:!!i.alternatives?.some(a=>a.toLowerCase()===n)}isJsBlockTerminator(e,t){return this.isEndKeyword(e,t)||this.profileKeywordMatches(t,"end",e.toLowerCase())}consumeVerbFinalJsBlock(e,t){let i=e.mark(),n=0,a=-1;for(;;){let c=e.peek(n);if(!c||this.isThenKeyword(c.value,t)||this.isJsBlockTerminator(c.value,t))break;if(this.isJsKeyword(c)){let d=e.peek(n+1),m=!!d&&c.position?.end!==void 0&&c.position.end===d.position?.start&&this.profileKeywordMatches(t,"js",`${c.value}${d.value}`.toLowerCase()),p=e.peek(n+(m?2:1));if(n>0&&p&&this.isJsBlockTerminator(p.value,t)){a=n;break}}n++;}if(a<=0)return null;let u=[];for(let c=0;c<a;c++){let d=e.peek(c);d&&u.push(d);}let o=u[u.length-1];if(o&&this.isPatientMarker(o,t)&&u.pop(),u.length===0)return e.reset(i),null;let s=this.rawJsBody(u);for(let c=0;c<a;c++)e.advance();e.advance();let l=e.peek();return l&&!this.isJsBlockTerminator(l.value,t)&&e.advance(),e.advance(),pe("js",{patient:{type:"expression",raw:s||"()"}},{sourceLanguage:t,patternId:`js-opaque-final-${t}`,confidence:1})}consumeJsBlock(e,t){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(t,"js",`${i.value}${u.value}`.toLowerCase())&&e.advance();let o=e.peek();o&&this.isPatientMarker(o,t)&&e.advance();let s=false;for(;!e.isAtEnd();){let c=e.peek();if(!c)break;if(e.advance(),this.isJsBlockTerminator(c.value,t)){s=true;break}a.push(c);}if(!s)return e.reset(n),null;let l=this.rawJsBody(a);return pe("js",{patient:{type:"expression",raw:l||"()"}},{sourceLanguage:t,patternId:`js-opaque-${t}`,confidence:1})}rawJsBody(e){if(e.length===0)return "";let t=e[0].position?.start,i=e[e.length-1].position?.end,n=this.positionSource;if(n!==void 0&&t!==void 0&&i!==void 0){let u=n.slice(t,i),o=s=>s.replace(/\s+/g,"");if(o(u)===o(e.map(s=>s.value).join("")))return u.trim()}let a="";for(let u=0;u<e.length;u++){let o=e[u-1],s=o?.position?.end!==void 0&&e[u].position?.start===o.position.end;u>0&&!s&&(a+=" "),a+=e[u].value;}return a.trim()}isIfKeyword(e,t){let i=e.toLowerCase();return i==="if"?true:this.profileKeywordMatches(t,"if",i)}isUnlessKeyword(e,t){let i=e.toLowerCase();return i==="unless"?true:this.profileKeywordMatches(t,"unless",i)}tryParseUnlessGuard(e,t,i){let n=e.peek();if(!n||!this.isUnlessKeyword((n.normalized??n.value).toLowerCase(),i))return null;let a=e.mark(),u=this.tryParseConditionalBlock(e,t,i,true);if(!u||u.kind!=="conditional")return e.reset(a),null;let o=u;if(o.elseBranch&&o.elseBranch.length>0)return e.reset(a),null;let s=o.roles.get("condition");return s?[pe("unless",{condition:s},{sourceLanguage:i,patternId:`unless-${i}-guard`,confidence:1}),...o.thenBranch]:(e.reset(a),null)}isBlockEndToken(e,t,i){let n=t.next;return (this.isEndKeyword(e.value,i)||e.kind==="keyword"&&(e.normalized??"").toLowerCase()==="end"&&!(n&&n.kind==="selector"))&&!Pe(t,i)}opensNestedBlock(e,t,i){let n=(e.normalized??e.value).toLowerCase();return this.isIfKeyword(n,i)?!(t&&this.isElseKeyword(t.value,i)):this.isUnlessKeyword(n,i)?true:n==="repeat"?e.kind==="keyword"||e.kind==="identifier":n!=="for"||e.kind!=="keyword"?false:!(t&&ct(t))}tryParseConditionalBlock(e,t,i,n=false){let a=e.peek();if(!a)return null;let u=(a.normalized??a.value).toLowerCase();if(!this.isIfKeyword(u,i)&&!(n&&this.isUnlessKeyword(u,i)))return null;let o=e.mark(),s=this.coverageMark();e.advance();let l=e.tokens,c=e.position(),d=[],m=0;for(;!e.isAtEnd();){let w=e.peek();if(!w)break;if(d.length>0&&this.opensNestedBlock(w,Ir(d,d.length),i)){m++,d.push(w),e.advance();continue}if(this.isBlockEndToken(w,Ee(e.tokens,e.position()),i)){if(m===0){e.advance();break}m--,d.push(w),e.advance();continue}d.push(w),e.advance();}if(d.length===0)return e.reset(o),this.coverageRollback(s),null;let p=R(i),f=p?.wordOrder==="SOV"?B.buildVerbLookup(p):null,y=0,v=0,h=[];for(;y<d.length;y++){let w=d[y],b=(w.normalized??w.value).toLowerCase();if(y>0&&(this.isIfKeyword(b,i)||this.isUnlessKeyword(b,i))?v++:this.isBlockEndToken(w,Ee(l,c+y),i)&&v--,v===0&&this.isThenAt(w,Ee(l,c+y),i)){y++;break}if(v===0&&h.length>0){let D=(w.normalized??w.value).toLowerCase(),P=sl(d[y-1],w,h.length===1,i),I=f!==null&&f.has(w.value.toLowerCase())&&!hn.has(D),O=/^\.[a-zA-Z_]\w*$/.test(w.value)&&d[y-1].position?.end!==void 0&&w.position?.start!==void 0&&d[y-1].position.end===w.position.start;if(!B.CONDITION_OPERATORS.has(D)&&!O&&(!P||I)&&(this.tokensBeginCommand(d.slice(y),t,i)||this.sovCommandStartsAt(d.slice(y),f)))break}h.push(w);}if(h.length===0)return e.reset(o),this.coverageRollback(s),null;let z=[],k=[],g=false,A=0;for(;y<d.length;y++){let w=d[y];if(this.opensNestedBlock(w,Ir(d,y),i)?A++:this.isBlockEndToken(w,Ee(l,c+y),i)&&A--,A===0&&!g&&this.isElseKeyword(w.value,i)){g=true;continue}(g?k:z).push(w);}let C={type:"expression",raw:this.joinTokenText(h,i)},S=this.parseBranch(z,t,i),x=k.length>0?this.parseBranch(k,t,i):void 0;return S.length===0&&(!x||x.length===0)?(e.reset(o),this.coverageRollback(s),null):ys(C,S,x,{sourceLanguage:i,patternId:`conditional-${i}-folded`,confidence:1})}joinTokenText(e,t){return Be(e,R(t))}tokensBeginCommand(e,t,i){if(e.length===0)return false;let n=new oe(e,i);return be.matchBest(n,t)!==null}sovCommandStartsAt(e,t){if(!t)return false;let i=o=>t.has(o.value.toLowerCase())||!!o.normalized&&t.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,t,i){if(e.length===0)return [];let n=new oe(e,i),a=this.parseBodyWithClauses(n,t,i);return a.length===1&&a[0]?.kind==="compound"?a[0].statements:a}extractStandaloneModifiers(e,t){let n=Z(e,t).tokens;if(n.length===0)return {modifiers:null,remainingInput:null};let u=n[0].value.toLowerCase(),o=y=>n[y]?.value.toLowerCase(),s=y=>!!n[y]&&n[y].kind!=="selector";if(u==="on"&&o(1)==="first"&&n.length>2)return {modifiers:{once:true,onceAsFirst:true},remainingInput:e.slice(0,n[1].position.start)+e.slice(n[2].position.start)};if(u==="first"&&s(1))return {modifiers:{once:true,onceAsFirst:true},remainingInput:e.slice(n[1].position.start)};let l=B.STANDALONE_MODIFIERS[u];if(!l)return {modifiers:null,remainingInput:null};let c={},d=1;if(l==="once")c.once=true;else {let y=1;if(y<n.length){let v=n[y],h=n[y+1],E=v.kind==="identifier"&&h?.kind==="literal"&&/^\d+(ms|s|m)?$/.test(h.value);(v.kind==="keyword"||v.kind==="particle"||E)&&(y++,d++);}if(y<n.length){let v=n[y];if(v.kind==="literal"){let h=v.value.match(/^(\d+)(ms|s|m)?$/);if(h){let E=parseInt(h[1],10),z=h[2]||"ms";z==="s"?E*=1e3:z==="m"&&(E*=6e4),c[l]=E,d=y+1;}}}c[l]||(c[l]=l==="debounce"?300:100);}let m=n.slice(d);if(m.length===0)return {modifiers:null,remainingInput:null};let p=m[0].position.start,f=e.slice(p);return {modifiers:c,remainingInput:f}}stripAsyncModifier(e,t){let i=R(t)?.keywords?.async,n=new Set(["async"]);i?.primary&&n.add(i.primary.toLowerCase()),i?.alternatives?.forEach(l=>n.add(l.toLowerCase()));let a=Z(e,t).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,t){let i=Z(e,t).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 d=c.kind;if(d==="selector"||d==="literal"||d==="reference"||d==="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(t=>t.code==="unconsumed-input").reduce((t,i)=>t+(parseInt(/left (\d+) token/.exec(i.message)?.[1]??"0",10)||0),0)}static unconsumedSpans(e){return (e.diagnostics??[]).filter(t=>t.code==="unconsumed-input").map(t=>/unconsumed: "(.*)"$/.exec(t.message)?.[1]).filter(t=>!!t).map(t=>t.replace(/\s+/g," ").trim())}static withoutSpanDiagnostics(e,t){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()!==t})}}static sourceNounValue(e){if(e.kind==="selector")return Oe(e.value);let t=(e.normalized??e.value).toLowerCase();return Te(t)?{type:"reference",value:t}:{type:"literal",value:e.value,dataType:"string"}}reclaimDanglingFromTail(e,t,i){let n=B.droppedTokenCount,a=B.unconsumedSpans(e);if(a.length===0)return null;let u=n(e),o=R(i)?.roleMarkers?.source,s=new Set;o?.primary&&s.add(o.primary),o?.alternatives?.forEach(c=>s.add(c));let l=Z(t,i).tokens;for(let c=0;c<l.length;c++){let d=l[c];if(d.normalized!=="source"&&!s.has(d.value))continue;let m=o?.position==="after"?c-1:c+1,p=l[m];if(!p||p.kind!=="identifier"&&p.kind!=="keyword")continue;let f=Math.min(d.position.start,p.position.start),y=Math.max(d.position.end,p.position.end),v=t.slice(f,y).replace(/\s+/g," ").trim();if(!a.some(E=>E===v||E.includes(v)))continue;let h=(t.slice(0,f).trimEnd()+" "+t.slice(y).trimStart()).trim();if(!(!h||h===t))try{let E=this.parse(h,i);if(!E||E.kind!=="event-handler")continue;let z=$r(E);if(n(z)<u)return {node:{...z,eventModifiers:{...z.eventModifiers,from:B.sourceNounValue(p)}},input:h}}catch{}}return null}reclaimEventCompoundTail(e,t,i){let n=B.unconsumedSpans(e);if(n.length===0)return null;let a=Fe[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=d=>d.replace(/\s+/g," ").trim(),c=Z(t,i).tokens;for(let d of n)for(let m=1;m<c.length;m++)for(let p=m;p<c.length;p++){let f=l(t.slice(c[m].position.start,c[p].position.end));if(f.length>d.length)break;if(f!==d)continue;let y=c[m-1];if((a[y.value]??y.normalized)!==s)break;let h=l(t.slice(y.position.start,c[p].position.end)),E=a[h];if(!E)break;return u.set("event",{type:"literal",value:E,dataType:"string"}),{node:B.withoutSpanDiagnostics(e,d),input:t}}return null}reclaimResponseTypeTail(e,t,i){let n=B.unconsumedSpans(e);if(n.length===0)return null;let a=B.AS_MARKERS_BEFORE[i];if(!a)return null;let u=l=>l.replace(/\s+/g," ").trim(),o=B.droppedTokenCount(e),s=Z(t,i).tokens;for(let l=0;l+1<s.length;l++){let c=s[l],d=s[l+1];if(!a.some(f=>c.value.toLowerCase()===f)||!B.RESPONSE_TYPE_WORDS.has(d.value.toLowerCase()))continue;let m=u(t.slice(c.position.start,d.position.end));if(!n.includes(m))continue;let p=(t.slice(0,c.position.start).trimEnd()+" "+t.slice(d.position.end).trimStart()).trim();if(!(!p||p===t))try{let f=this.parse(p,i);if(!f||f.kind!=="event-handler")continue;let y=$r(f);if(B.droppedTokenCount(y)>=o)continue;let v=B.findResponseTypeTarget(y);if(!v)continue;return v.roles.set("responseType",{type:"expression",raw:d.value}),{node:y,input:p}}catch{}}return null}static findResponseTypeTarget(e){let t=null,i=n=>{if(!n||typeof n!="object"||t)return;if(n.kind==="command"){let u=n;if(se(u.action)?.roles.some(s=>s.role==="responseType"&&!s.required)&&!u.roles.has("responseType")){t=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),t}reclaimCapturedDestinationTail(e,t,i){let n=B.unconsumedSpans(e);if(n.length===0)return null;let a=R(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=Z(t,i).tokens;for(let l=0;l+1<s.length;l++){let c=s[l],d=s[l+1],m=u.has(c.value)&&d.normalized==="me",p=c.normalized==="me"&&u.has(d.value);if(!m&&!p)continue;let f=o(t.slice(c.position.start,d.position.end));if(!n.includes(f))continue;let y=false,v=h=>{if(!h||typeof h!="object"||y)return;if(h.kind==="command"){let z=h.roles.get("destination");if(z?.type==="reference"&&z.value==="me"){y=true;return}}let E=h;for(let z of ["body","statements","thenBranch","elseBranch","commands"]){let k=E[z];Array.isArray(k)&&k.forEach(g=>v(g));}};if(v(e),!!y)return {node:B.withoutSpanDiagnostics(e,f),input:t}}return null}applyModifiers(e,t){return {...e,eventModifiers:{...e.eventModifiers,...t}}}extractOrConjunctionEvents(e,t){let i=[];for(;;){let n=e.mark(),a=e.peek();if(!a)break;if(!Wr(a,t)){e.reset(n);break}e.advance();let u=e.peek();if(!u){e.reset(n);break}let o=u.normalized||u.value;e.advance(),i.push({type:"literal",value:o});}return i}};ze.coverageMarkerSurfaces=new Map;ze.LEAKED_RENDER_MARKERS={hi:["\u0915\u0947","\u0930\u0942\u092A","\u092E\u0947\u0902"],tr:["olarak"],qu:["hina"]};ze.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"]};ze.AS_MARKERS_AFTER={ko:[["\uB85C"],["\uC73C\uB85C"]],qu:[["hina"]],tr:[["olarak"]],hi:[["\u0915\u0947","\u0930\u0942\u092A","\u092E\u0947\u0902"]]};ze.enEventKeywordCache=new Map;ze.KNOWN_EVENTS=new Set(["click","dblclick","input","change","submit","keydown","keyup","keypress","mouseover","mouseout","mousedown","mouseup","focus","blur","load","scroll","resize","contextmenu"]);ze.RESPONSE_TYPE_WORDS=new Set(["json","text","html","xml","blob","arraybuffer","formdata","response"]);ze.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"])};ze.SOV_EVENT_MARKER_PHRASES={ko:[["\uD560","\uB54C"],["\uD560\uB54C"]]};ze.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"])}};ze.CONDITION_OPERATORS=new Set(["matches","match","contains","exists","has","have","equals","includes"]);ze.STANDALONE_MODIFIERS={once:"once",debounced:"debounce",debounce:"debounce",throttled:"throttle",throttle:"throttle"};var ec=ze,rc=new ec;function tc(r,e){return rc.parse(r,e)}function Mn(r,e){let t=e==="SOV"?"sovPosition":"svoPosition";return [...r].sort((i,n)=>{let a=i[t]??99,u=n[t]??99;return a-u})}function lr(r,e){let t,i;if(r.markerOverride&&r.markerOverride[e.code]!==void 0)t=r.markerOverride[e.code],i=t?Ne(r,e.code,t):void 0;else {let n=e.roleMarkers[r.role];if(n){t=n.primary;let a=Ne(r,e.code,t)??[],u=[...new Set([...n.alternatives??[],...a])].filter(o=>o!==t);i=u.length?u:void 0;}}return {marker:t,alternatives:i}}function Fr(r,e,t){t.roles.find(n=>n.role==="scope"&&!n.required)&&(r.push({type:"group",optional:true,tokens:[{type:"literal",value:"on"},{type:"role",role:"scope",optional:true,expectedTypes:["selector","reference"]}]}),e.scope={fromRole:"scope"});}function Rt(r,e,t,i){In(r,e,t,i,"manner",{requireMarker:true});}function _n(r,e,t,i){In(r,e,t,i,"recipient",{requireMarker:false});}function In(r,e,t,i,n,a){let u=t.roles.find(s=>s.role===n&&!s.required);if(!u)return;let o=u.markerOverride?.[i];a.requireMarker&&!o||(r.push({type:"group",optional:true,tokens:[...(o?o.split(/\s+/):[]).map(s=>({type:"literal",value:s})),{type:"role",role:n,optional:true,expectedTypes:u.expectedTypes,...u.valueShape!==void 0?{valueShape:u.valueShape}:{}}]}),e[n]={fromRole:n});}function jn(r){if(r.roles.some(i=>i.role==="patient"))return "patient";let e=r.roles.filter(i=>i.required),t=e.find(i=>i.role===r.primaryRole)??e[0];return !t||t.role==="event"?"patient":t.role}function $n(r,e,t){let i=r.roles.find(c=>c.role===t);if(!i||t==="patient")return [{type:"role",role:t,optional:false}];let{marker:n,alternatives:a}=lr(i,e),u={type:"role",role:t,optional:false,...i.valueShape!==void 0?{valueShape:i.valueShape}:{}};if(!n)return [u];let o=n.split(/\s+/).filter(Boolean),s={type:"group",optional:true,tokens:o.map(c=>({type:"literal",value:c,...o.length===1&&a?.length?{alternatives:a}:{}}))};return (e.roleMarkers[t]?.position??"before")==="after"?[u,s]:[s,u]}function Vn(r,e,t,i,n){for(let a of t.roles)a.required||n.has(a.role)||e[a.role]||!(a.markerOverride?.[i.code]??i.roleMarkers[a.role]?.primary)&&a.valueShape===void 0||(r.push({type:"group",optional:true,tokens:Kn(a,i)}),e[a.role]=a.default?{fromRole:a.role,default:a.default}:{fromRole:a.role});}function ic(r,e,t,i,n){let a=[];if(a.push({type:"role",role:"event",optional:false}),i.position==="after"){let f=i.primary.split(/\s+/);if(f.length>1)for(let y of f)a.push({type:"literal",value:y});else {let y=i.alternatives?{type:"literal",value:i.primary,alternatives:i.alternatives}:{type:"literal",value:i.primary};a.push(y);}}let u=jn(r),o=e.roleMarkers.destination,s=r.roles.some(f=>f.role==="destination");o&&s&&u!=="destination"&&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}]});let l=e.roleMarkers.source,c=r.roles.some(f=>f.role==="source");l&&c&&u!=="source"&&a.push({type:"group",optional:true,tokens:[{type:"role",role:"source",optional:true},l.alternatives?{type:"literal",value:l.primary,alternatives:l.alternatives}:{type:"literal",value:l.primary}]}),a.push(...$n(r,e,u));let d=e.roleMarkers.patient;if(d&&u==="patient"){let f=d.alternatives?{type:"literal",value:d.primary,alternatives:d.alternatives}:{type:"literal",value:d.primary};a.push(f);}let m=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};a.push(m),u!=="source"&&a.push(...Ue(r,e.roleMarkers.source)),u!=="destination"&&a.push(...bt(r,e.roleMarkers.destination));let p={action:{value:r.action},event:{fromRole:"event"},[u]:{fromRole:u},...u==="destination"?{}:Ke(r),...u==="source"?{}:He(r)};return Vn(a,p,r,e,new Set(["event",u,"destination","source"])),{id:`${r.action}-event-${e.code}-sov`,language:e.code,command:"on",priority:(n.basePriority??100)+50,template:{format:`{event} ${i.primary} {destination?} {${u}} ${d?.primary||""} ${t.primary}`,tokens:a},extraction:p}}function nc(r,e,t,i,n){let a=[],u=r.action==="swap",o=u?"destination":"patient";a.push({type:"role",role:o,optional:false});let s=e.roleMarkers.patient;if(s){let m=s.alternatives?{type:"literal",value:s.primary,alternatives:s.alternatives}:{type:"literal",value:s.primary};a.push(m);}if(a.push({type:"role",role:"event",optional:false}),i.position==="after"){let m=i.primary.split(/\s+/);if(m.length>1)for(let p of m)a.push({type:"literal",value:p});else {let p=i.alternatives?{type:"literal",value:i.primary,alternatives:i.alternatives}:{type:"literal",value:i.primary};a.push(p);}}let l=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};a.push(l),a.push(...Ue(r,e.roleMarkers.source));let c=e.roleMarkers.destination;if(u&&c){let m=r.roles.find(p=>p.role==="patient")?.markerOverride?.[e.code];if(m&&m!==c.primary){let p=c.alternatives??[];p.includes(m)||(c={...c,alternatives:[...p,m]});}}a.push(...u?fu(r,c):bt(r,c));let d={action:{value:r.action},event:{fromRole:"event"},[o]:{fromRole:o},...u?{}:Ke(r),...He(r)};return _n(a,d,r,e.code),Rt(a,d,r,e.code),{id:`${r.action}-event-${e.code}-sov-patient-first`,language:e.code,command:"on",priority:(n.basePriority??100)+45,template:{format:`{patient} ${s?.primary||""} {event} ${i.primary} ${t.primary}`,tokens:a},extraction:d}}function ac(r,e,t,i,n){let a=r.roles.find(d=>d.role==="source");if(!a)return null;let{marker:u,alternatives:o}=lr(a,e),s=e.roleMarkers.patient;if(!u||u===i.primary||u===s?.primary)return null;let l=[];l.push({type:"role",role:"patient",optional:false}),s&&l.push(s.alternatives?{type:"literal",value:s.primary,alternatives:s.alternatives}:{type:"literal",value:s.primary}),l.push({type:"role",role:"source",optional:false,...a.expectedTypes?{expectedTypes:a.expectedTypes}:{},...a.valueShape!==void 0?{valueShape:a.valueShape}:{}});for(let d of u.split(/\s+/))l.push(o&&u.split(/\s+/).length===1?{type:"literal",value:d,alternatives:o}:{type:"literal",value:d});if(l.push({type:"role",role:"event",optional:false}),i.position==="after"){let d=i.primary.split(/\s+/);if(d.length>1)for(let m of d)l.push({type:"literal",value:m});else l.push(i.alternatives?{type:"literal",value:i.primary,alternatives:i.alternatives}:{type:"literal",value:i.primary});}l.push(t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary});let c={action:{value:r.action},event:{fromRole:"event"},patient:{fromRole:"patient"},source:{fromRole:"source"}};return _n(l,c,r,e.code),Rt(l,c,r,e.code),{id:`${r.action}-event-${e.code}-sov-source-fronted`,language:e.code,command:"on",priority:(n.basePriority??100)+48,template:{format:`{patient} ${s?.primary||""} {source} ${u} {event} ${i.primary} ${t.primary}`,tokens:l},extraction:c}}function uc(r,e,t,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=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};return a.push(s),{id:`${r.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} ${t.primary}`,tokens:a},extraction:{action:{value:r.action},event:{fromRole:"event"},patient:{fromRole:"patient"},destination:{fromRole:"destination"}}}}function oc(r,e,t,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=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};return a.push(l),a.push(...Ue(r,e.roleMarkers.source)),a.push(...bt(r,e.roleMarkers.destination)),{id:`${r.action}-event-${e.code}-sov-compact`,language:e.code,command:"on",priority:(n.basePriority??100)+52,template:{format:`{event}${u[0]||""} {patient} ${t.primary}`,tokens:a},extraction:{action:{value:r.action},event:{fromRole:"event"},patient:{fromRole:"patient"},...Ke(r),...He(r)}}}function sc(r,e,t,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=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};return a.push(u),{id:`${r.action}-event-${e.code}-sov-simple`,language:e.code,command:"on",priority:(n.basePriority??100)+48,template:{format:`{event} ${i.primary} ${t.primary}`,tokens:a},extraction:{action:{value:r.action},event:{fromRole:"event"},patient:{default:{type:"reference",value:"me"}}}}}function lc(r,e,t,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=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};return a.push(o),{id:`${r.action}-event-${e.code}-sov-temporal`,language:e.code,command:"on",priority:(i.basePriority??100)+49,template:{format:`{event} ${n[0]} {patient} ${t.primary}`,tokens:a},extraction:{action:{value:r.action},event:{fromRole:"event"},patient:{fromRole:"patient"}}}}function cc(r,e,t,i,n){let a=[];if(a.push({type:"role",role:"event",optional:false}),i.position==="after"){let d=i.primary.split(/\s+/);if(d.length>1)for(let m of d)a.push({type:"literal",value:m});else {let m=i.alternatives?{type:"literal",value:i.primary,alternatives:i.alternatives}:{type:"literal",value:i.primary};a.push(m);}}let o=[...r.roles.filter(d=>d.required)].sort((d,m)=>{let p=d.sovPosition??999,f=m.sovPosition??999;return p-f});for(let d of o){a.push({type:"role",role:d.role,optional:false});let{marker:m,alternatives:p}=lr(d,e);if(m){let f=p?{type:"literal",value:m,alternatives:p}:{type:"literal",value:m};a.push(f);}}let s=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};a.push(s);let l=o.map(d=>`{${d.role}}`).join(" "),c={action:{value:r.action},event:{fromRole:"event"},...Object.fromEntries(o.map(d=>[d.role,{fromRole:d.role}]))};return Fr(a,c,r),{id:`${r.action}-event-${e.code}-sov-2role`,language:e.code,command:"on",priority:(n.basePriority??100)+55,template:{format:`{event} ${i.primary} ${l} ${t.primary}`,tokens:a},extraction:c}}function dc(r,e,t,i,n){let a=[],o=[...r.roles.filter(c=>c.required)].sort((c,d)=>{let m=c.sovPosition??999,p=d.sovPosition??999;return m-p});for(let c of o){a.push({type:"role",role:c.role,optional:false});let{marker:d,alternatives:m}=lr(c,e);d&&a.push(m?{type:"literal",value:d,alternatives:m}:{type:"literal",value:d});}if(a.push(t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary}),a.push({type:"role",role:"event",optional:false}),i.position==="after"){let c=i.primary.split(/\s+/);if(c.length>1)for(let d of c)a.push({type:"literal",value:d});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:r.action},event:{fromRole:"event"},...Object.fromEntries(o.map(c=>[c.role,{fromRole:c.role}]))};return Fr(a,l,r),{id:`${r.action}-event-${e.code}-sov-2role-event-last`,language:e.code,command:"on",priority:(n.basePriority??100)+40,template:{format:`${s} ${t.primary} {event} ${i.primary}`,tokens:a},extraction:l}}function mc(r,e,t,i,n){let a=[],o=[...r.roles.filter(v=>v.required)].sort((v,h)=>{let E=v.sovPosition??999,z=h.sovPosition??999;return E-z}),s=o[0];a.push({type:"role",role:s.role,optional:false});let{marker:l,alternatives:c}=lr(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 h of v)a.push({type:"literal",value:h});else {let h=i.alternatives?{type:"literal",value:i.primary,alternatives:i.alternatives}:{type:"literal",value:i.primary};a.push(h);}}let d=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};a.push(d);let m=o[1];a.push({type:"role",role:m.role,optional:false});let{marker:p,alternatives:f}=lr(m,e);if(p){let v=f?{type:"literal",value:p,alternatives:f}:{type:"literal",value:p};a.push(v);}let y={action:{value:r.action},event:{fromRole:"event"},[s.role]:{fromRole:s.role},[m.role]:{fromRole:m.role}};return Fr(a,y,r),{id:`${r.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} ${t.primary} {${m.role}}`,tokens:a},extraction:y}}function Wn(r,e,t){let i=Ne(r,e.code,t.primary)??[],n=[...new Set([...t.alternatives??[],...i])].filter(a=>a!==t.primary);return n.length?n:void 0}function Fi(r,e,t,i,n){let a=[];if(i.position==="before"){let d=i.alternatives?{type:"literal",value:i.primary,alternatives:i.alternatives}:{type:"literal",value:i.primary};a.push(d);}a.push({type:"role",role:"event",optional:false});let u=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};a.push(u);let o=jn(r);a.push(...$n(r,e,o));let s=e.roleMarkers.destination,l=r.roles.some(d=>d.role==="destination");s&&l&&o!=="destination"&&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}]}),o!=="source"&&a.push(...Ue(r,e.roleMarkers.source));let c={action:{value:r.action},event:{fromRole:"event"},[o]:{fromRole:o},...o==="destination"?{}:Ke(r),...o==="source"?{}:He(r)};return Vn(a,c,r,e,new Set(["event",o,"destination","source"])),{id:`${r.action}-event-${e.code}-vso`,language:e.code,command:"on",priority:(n.basePriority??100)+50,template:{format:`${i.primary} {event} ${t.primary} {${o}} ${s?.primary||""} {destination?}`,tokens:a},extraction:c}}function pc(r,e,t,i,n){let a=[],u=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};a.push(u);let o=r.action==="swap";a.push({type:"role",role:o?"destination":"patient",optional:false});let s=o?void 0:e.roleMarkers.destination;if(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(...Ue(r,e.roleMarkers.source)),i.position==="before"){let c=i.alternatives?{type:"literal",value:i.primary,alternatives:i.alternatives}:{type:"literal",value:i.primary};a.push(c);}if(a.push({type:"role",role:"event",optional:false}),o){let c=r.roles.find(d=>d.role==="patient")?.markerOverride?.[e.code];c&&a.push({type:"group",optional:true,tokens:[{type:"literal",value:c},{type:"role",role:"patient",optional:false}]});}let l={action:{value:r.action},event:{fromRole:"event"},[o?"destination":"patient"]:{fromRole:o?"destination":"patient"},...o?{}:Ke(r),...He(r)};return Rt(a,l,r,e.code),{id:`${r.action}-event-${e.code}-vso-verb-first`,language:e.code,command:"on",priority:(n.basePriority??100)+45,template:{format:`${t.primary} {patient} ${s?.primary||""} {destination?} ${i.primary} {event}`,tokens:a},extraction:l}}function fc(r,e,t,i,n){let a=[],u=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};a.push(u);let s=[...r.roles.filter(d=>d.required)].sort((d,m)=>{let p=d.svoPosition??999,f=m.svoPosition??999;return p-f});for(let d of s){let m,p;if(d.markerOverride&&d.markerOverride[e.code]!==void 0)m=d.markerOverride[e.code],p=m?Ne(d,e.code,m):void 0;else {let f=e.roleMarkers[d.role];f&&(m=f.primary,p=Wn(d,e,f));}if(m){let f=p?{type:"literal",value:m,alternatives:p}:{type:"literal",value:m};a.push(f);}a.push({type:"role",role:d.role,optional:false});}if(i.position==="before"){let d=i.alternatives?{type:"literal",value:i.primary,alternatives:i.alternatives}:{type:"literal",value:i.primary};a.push(d);}a.push({type:"role",role:"event",optional:false});let l=s.map(d=>`{${d.role}}`).join(" "),c={action:{value:r.action},event:{fromRole:"event"},...Object.fromEntries(s.map(d=>[d.role,{fromRole:d.role}]))};return Fr(a,c,r),{id:`${r.action}-event-${e.code}-vso-verb-first-2role`,language:e.code,command:"on",priority:(n.basePriority??100)+48,template:{format:`${t.primary} ${l} ${i.primary} {event}`,tokens:a},extraction:c}}function Ti(r,e,t,i,n){let a=[];if(i.position==="before"){let d=i.alternatives?{type:"literal",value:i.primary,alternatives:i.alternatives}:{type:"literal",value:i.primary};a.push(d);}a.push({type:"role",role:"event",optional:false});let u=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};a.push(u);let s=[...r.roles.filter(d=>d.required)].sort((d,m)=>{let p=d.svoPosition??999,f=m.svoPosition??999;return p-f});for(let d of s){let m,p;if(d.markerOverride&&d.markerOverride[e.code]!==void 0)m=d.markerOverride[e.code],p=m?Ne(d,e.code,m):void 0;else {let f=e.roleMarkers[d.role];f&&(m=f.primary,p=Wn(d,e,f));}if(m){let f=p?{type:"literal",value:m,alternatives:p}:{type:"literal",value:m};a.push(f);}a.push({type:"role",role:d.role,optional:false});}let l=s.map(d=>`{${d.role}}`).join(" "),c={action:{value:r.action},event:{fromRole:"event"},...Object.fromEntries(s.map(d=>[d.role,{fromRole:d.role}]))};return Fr(a,c,r),{id:`${r.action}-event-${e.code}-vso-2role`,language:e.code,command:"on",priority:(n.basePriority??100)+55,template:{format:`${i.primary} {event} ${t.primary} ${l}`,tokens:a},extraction:c}}function yc(r,e,t,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=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.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(...Ue(r,e.roleMarkers.source)),{id:`${r.action}-event-${e.code}-vso-negated`,language:e.code,command:"on",priority:(n.basePriority??100)+48,template:{format:`${i.primary} ${u?.primary||""} {event} ${t.primary} {patient} ${s?.primary||""} {destination?}`,tokens:a},extraction:{action:{value:r.action},event:{fromRole:"event"},patient:{fromRole:"patient"},...Ke(r),...He(r)}}}function hc(r,e,t,i){let n=[];n.push({type:"literal",value:"and",alternatives:["then"]}),n.push({type:"role",role:"event",optional:false});let a=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.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(...Ue(r,e.roleMarkers.source)),{id:`${r.action}-event-${e.code}-vso-proclitic`,language:e.code,command:"on",priority:(i.basePriority??100)+45,template:{format:`[proclitic?] {event} ${t.primary} {patient} ${u?.primary||""} {destination?}`,tokens:n},extraction:{action:{value:r.action},event:{fromRole:"event"},patient:{fromRole:"patient"},...Ke(r),...He(r)}}}var mr={basePriority:100,generateSimpleVariants:true,generateAlternatives:true};function kr(r,e,t=mr){let i=`${r.action}-${e.code}-generated`,n=t.basePriority??100,a=e.keywords[r.action];if(!a)throw new Error(`No keyword translation for '${r.action}' in ${e.code}`);let u=zc(r,e,a),o=Pt(r,e),s=bc(r,e,a);return {id:i,language:e.code,command:r.action,priority:n,template:{format:s,tokens:u},extraction:o}}function vc(r,e,t=mr){if(r.roles.filter(o=>!o.required).length===0)return null;let n=r.roles.filter(o=>o.required),a={...r,roles:n};return {...kr(a,e,t),id:`${r.action}-${e.code}-generated-simple`,priority:(t.basePriority??100)-5,extraction:Pt(r,e)}}function Oi(r,e,t=mr){if(e.wordOrder!=="SOV")return null;let i=r.roles.filter(o=>o.required);if(i.length!==1)return null;let n=e.keywords[r.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:`${r.action}-${e.code}-generated-verb-first`,language:e.code,command:r.action,priority:(t.basePriority??100)-20,template:{format:`${n.primary} <${i[0].role}>`,tokens:[a,...u]},extraction:Pt(r,e)}}function Ec(r,e,t=mr){let i=[];if(i.push(kr(r,e,t)),t.generateSimpleVariants){let n=vc(r,e,t);n&&i.push(n);}for(let n of r.omitRoleVariants??[]){let a={...r,roles:r.roles.filter(o=>o.role!==n)},u=kr(a,e,t);i.push({...u,id:`${r.action}-${e.code}-generated-no-${n}`,priority:(t.basePriority??100)-8});}for(let n of r.widenTypeVariants??[]){if(n.excludeLanguages?.includes(e.code))continue;let a={...r,roles:r.roles.map(o=>o.role===n.role?{...o,expectedTypes:[...n.types]}:o)},u=kr(a,e,t);i.push({...u,id:`${r.action}-${e.code}-generated-${n.idSuffix}`,priority:(t.basePriority??100)-(n.priorityDelta??15)});}if(t.generateVerbFirstVariants!==false){let n=Oi(r,e,t);n&&i.push(n);}for(let n of r.rolePrefixLiteralVariants??[]){let a=n.literal[e.code];if(!a)continue;let{rolePrefixLiteralVariants:u,...o}=r,s={...o,roles:r.roles.map(m=>m.role===n.role?{...m,valuePrefixLiteral:{[e.code]:a}}:m)},l=n.priorityDelta??5,c=n.methodCarrier?{[n.methodCarrier]:{value:a}}:{},d=kr(s,e,t);if(i.push({...d,id:`${r.action}-${e.code}-generated-${n.idSuffix}`,priority:(t.basePriority??100)+l,extraction:{...d.extraction,...c}}),t.generateVerbFirstVariants!==false){let m=Oi(s,e,t);m&&i.push({...m,id:`${r.action}-${e.code}-generated-verb-first-${n.idSuffix}`,priority:(t.basePriority??100)-20+l,extraction:{...m.extraction,...c}});}}return i}function qn(r,e=mr){let t=[],i=Po();for(let n of i){if(!r.keywords[n.action])continue;let a=Ec(n,r,e);if(t.push(...a),r.eventHandler?.eventMarker){let u=gc(n,r,e);t.push(...u);}}return t}function gc(r,e,t=mr){if(!e.eventHandler||!e.eventHandler.eventMarker)return [];let i=[],n=e.eventHandler.eventMarker,a=e.keywords[r.action];if(!a)return [];if(r.roles.length===0)return [];if(r.action==="js")return [];let o=r.roles.filter(s=>s.required).length===2;if(e.wordOrder==="SOV")if(o)i.push(cc(r,e,a,n,t)),i.push(mc(r,e,a,n,t)),i.push(dc(r,e,a,n,t));else {i.push(ic(r,e,a,n,t)),i.push(nc(r,e,a,n,t));let s=ac(r,e,a,n,t);s&&i.push(s);let l=e.roleMarkers.destination;l&&l.primary!==n.primary&&i.push(uc(r,e,a,n,t));let c=n.primary.split(/\s+/),d=n.alternatives?.some(p=>!p.includes(" ")&&p.length>1);c.length>1&&d&&i.push(oc(r,e,a,n,t)),i.push(sc(r,e,a,n,t));let m=lc(r,e,a,t);m&&i.push(m);}else e.wordOrder==="VSO"?o?(i.push(Ti(r,e,a,n,t)),i.push(fc(r,e,a,n,t))):(i.push(Fi(r,e,a,n,t)),i.push(pc(r,e,a,n,t)),e.eventHandler?.negationMarker&&i.push(yc(r,e,a,n,t)),e.tokenization?.prefixes&&i.push(hc(r,e,a,t))):o?i.push(Ti(r,e,a,n,t)):i.push(Fi(r,e,a,n,t));return i}function zc(r,e,t){let i=[],n=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary},a=kc(r,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 wc(i)}function wc(r){let e=[];for(let t of r){let i=e[e.length-1];if(i&&i.type==="literal"&&t.type==="literal"&&i.value===t.value){let n=[...i.alternatives??[],...t.alternatives??[]];n.length&&(e[e.length-1]={...i,alternatives:[...new Set(n)]});continue}e.push(t);}return e}function kc(r,e){let t=[],i=Mn(r.roles,e.wordOrder);for(let n of i){let a=Kn(n,e);n.required?t.push(...a):t.push({type:"group",optional:true,tokens:a});}return t}function Kn(r,e){let t=[],i=r.markerOverride?.[e.code],n=e.roleMarkers[r.role],a=r.renderOverride?.[e.code]==="",u={type:"role",role:r.role,optional:!r.required,expectedTypes:r.expectedTypes,...r.valueShape!==void 0?{valueShape:r.valueShape}:{}},o=r.valuePrefixLiteral?.[e.code],s=()=>{o&&t.push({type:"literal",value:o}),t.push(u);};if(i!==void 0){let l=i?i.split(/\s+/).filter(Boolean):[],c=i!==void 0&&i===r.markerOverride?.en,d=n?.position??(e.wordOrder==="SOV"&&!c?"after":"before"),m=r.markerOptional?.[e.code]===true,p=f=>{let y=l.length===1?Ne(r,e.code,f)??[]:[],v={type:"literal",value:f,...y.length?{alternatives:y}:{},...a?{renderSuppress:true}:{}};t.push(m?{type:"group",optional:true,tokens:[v]}:v);};if(d==="before"){for(let f of l)p(f);s();}else {s();for(let f of l)p(f);}}else if(n){let l=()=>{let d=[...new Set([...n.alternatives??[],...Ne(r,e.code,n.primary)??[]])].filter(m=>m!==n.primary);return {type:"literal",value:n.primary,...d.length?{alternatives:d}:{},...a?{renderSuppress:true}:{}}},c=d=>{if(!e.markersOptional&&!r.markerOptional?.[e.code]){t.push(d);return}t.push({type:"group",optional:true,...e.markersOptional&&!r.markerOptional?.[e.code]?{renderRequired:true}:{},tokens:[d]});};n.position==="before"?(n.primary&&c(l()),s()):(s(),c(l()));}else s();return t}function Cc(r,e){let t={};for(let i of r.roles){let n=i.markerOverride?.[e.code],a=e.roleMarkers[i.role];if(i.valuePrefixLiteral?.[e.code])t[i.role]={marker:i.valuePrefixLiteral[e.code]};else if(n!==void 0)if(!n)t[i.role]={};else {let o=!/\s/.test(n.trim())?Ne(i,e.code,n)??[]:[];t[i.role]=o.length?{marker:n,markerAlternatives:o}:{marker:n};}else if(a&&a.primary){let u=[...new Set([...a.alternatives??[],...Ne(i,e.code,a.primary)??[]])].filter(o=>o!==a.primary);t[i.role]=u.length?{marker:a.primary,markerAlternatives:u}:{marker:a.primary};}else t[i.role]={};}return t}function Pt(r,e){let t=Cc(r,e),i={};for(let n of r.roles){let a=t[n.role]||{};!n.required&&n.default?i[n.role]={...a,default:n.default}:i[n.role]=a;}return i}function bc(r,e,t){let i=[],a=Mn(r.roles,e.wordOrder).map(u=>{let o=vs(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(t.primary,...a);break;case "SOV":i.push(...a,t.primary);break;default:i.push(t.primary,...a);}return i.join(" ")}var Ac=class{constructor(r={}){this.cache=new Map,this.config={maxSize:r.maxSize??1e3,ttlMs:r.ttlMs??0,enabled:r.enabled??true},this.stats={hits:0,misses:0,evictions:0,expirations:0};}makeKey(r,e){return `${e}:${r}`}isExpired(r){return this.config.ttlMs===0?false:Date.now()-r.createdAt>this.config.ttlMs}evictLRU(){let r=this.cache.keys().next().value;r!==void 0&&(this.cache.delete(r),this.stats.evictions++);}get(r,e){if(!this.config.enabled){this.stats.misses++;return}let t=this.makeKey(r,e),i=this.cache.get(t);if(!i){this.stats.misses++;return}if(this.isExpired(i)){this.cache.delete(t),this.stats.expirations++,this.stats.misses++;return}return this.cache.delete(t),i.lastAccessed=Date.now(),this.cache.set(t,i),this.stats.hits++,i.result}set(r,e,t){if(!this.config.enabled||t!==null&&typeof t=="object"&&"confidence"in t&&t.confidence===0)return;let i=this.makeKey(r,e),n=Date.now();for(;this.cache.size>=this.config.maxSize;)this.evictLRU();this.cache.set(i,{result:t,createdAt:n,lastAccessed:n});}has(r,e){if(!this.config.enabled)return false;let t=this.makeKey(r,e),i=this.cache.get(t);return i?this.isExpired(i)?(this.cache.delete(t),this.stats.expirations++,false):true:false}delete(r,e){let t=this.makeKey(r,e);return this.cache.delete(t)}clear(){this.cache.clear();}resetStats(){this.stats={hits:0,misses:0,evictions:0,expirations:0};}getStats(){let r=this.stats.hits+this.stats.misses;return {hits:this.stats.hits,misses:this.stats.misses,size:this.cache.size,maxSize:this.config.maxSize,hitRate:r>0?this.stats.hits/r:0,evictions:this.stats.evictions,expirations:this.stats.expirations,enabled:this.config.enabled}}configure(r){if(r.maxSize!==void 0)for(this.config.maxSize=r.maxSize;this.cache.size>this.config.maxSize;)this.evictLRU();r.ttlMs!==void 0&&(this.config.ttlMs=r.ttlMs),r.enabled!==void 0&&(this.config.enabled=r.enabled);}enable(){this.config.enabled=true;}disable(){this.config.enabled=false;}getConfig(){return {...this.config}}};new Ac;function Sc(r){return /[\u0430-\u044f\u0410-\u042f\u0451\u0401]/.test(r)}function Dc(r){for(let e of r)if(Sc(e))return true;return false}var Hn=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"]]),Gn=class{constructor(){this.language="ru";}isNormalizable(r){return r.length<3?false:Dc(r)}normalize(r){let e=r.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 me(r);let t=this.tryImperativeLookup(e);if(t)return t;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||me(r)}tryReflexiveNormalization(r){(r.endsWith("\u0441\u044F"),2);let t=r.slice(0,-2);if(r.endsWith("\u0442\u044C\u0441\u044F")||r.endsWith("\u0442\u0438\u0441\u044C")||r.endsWith("\u0447\u044C\u0441\u044F"))return me(r);let i=this.normalizeNonReflexive(t);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 F(n,i.confidence*.95,{removedSuffixes:["\u0441\u044F",...i.metadata?.removedSuffixes||[]],conjugationType:"reflexive"})}return null}normalizeNonReflexive(r){if(r.endsWith("\u0442\u044C")||r.endsWith("\u0442\u0438")||r.endsWith("\u0447\u044C"))return me(r);let e=this.tryImperativeLookup(r);if(e)return e;let t=this.tryPastTenseNormalization(r);if(t)return t;let i=this.tryPresentTenseNormalization(r);if(i)return i;let n=this.tryGenericImperativeNormalization(r);return n||me(r)}tryImperativeLookup(r){return Hn.has(r)?F(Hn.get(r),.95,{removedSuffixes:["imperative"],conjugationType:"imperative"}):null}tryGenericImperativeNormalization(r){return r.endsWith("\u0439\u0442\u0435")&&r.length>5?F(r.slice(0,-3)+"\u0442\u044C",.8,{removedSuffixes:["\u0439\u0442\u0435"],conjugationType:"imperative"}):r.endsWith("\u0438\u0442\u0435")&&r.length>5?F(r.slice(0,-3)+"\u0438\u0442\u044C",.8,{removedSuffixes:["\u0438\u0442\u0435"],conjugationType:"imperative"}):r.endsWith("\u0439")&&r.length>3?F(r.slice(0,-1)+"\u0442\u044C",.75,{removedSuffixes:["\u0439"],conjugationType:"imperative"}):r.endsWith("\u0438")&&r.length>3?F(r+"\u0442\u044C",.7,{removedSuffixes:["\u0438\u2192\u0438\u0442\u044C"],conjugationType:"imperative"}):null}tryPastTenseNormalization(r){return r.endsWith("\u0430\u043B\u0430")&&r.length>4?F(r.slice(0,-3)+"\u0430\u0442\u044C",.85,{removedSuffixes:["\u0430\u043B\u0430"],conjugationType:"past"}):r.endsWith("\u0438\u043B\u0430")&&r.length>4?F(r.slice(0,-3)+"\u0438\u0442\u044C",.85,{removedSuffixes:["\u0438\u043B\u0430"],conjugationType:"past"}):r.endsWith("\u0435\u043B\u043E")&&r.length>4?F(r.slice(0,-3)+"\u0435\u0442\u044C",.82,{removedSuffixes:["\u0435\u043B\u043E"],conjugationType:"past"}):r.endsWith("\u0430\u0431\u043E")&&r.length>4?F(r.slice(0,-3)+"\u0430\u0442\u044C",.82,{removedSuffixes:["\u0430\u0431\u043E"],conjugationType:"past"}):r.endsWith("\u0430\u043B\u0438")&&r.length>4?F(r.slice(0,-3)+"\u0430\u0442\u044C",.85,{removedSuffixes:["\u0430\u043B\u0438"],conjugationType:"past"}):r.endsWith("\u0438\u043B\u0438")&&r.length>4?F(r.slice(0,-3)+"\u0438\u0442\u044C",.85,{removedSuffixes:["\u0438\u043B\u0438"],conjugationType:"past"}):r.endsWith("\u0430\u043B")&&r.length>3?F(r.slice(0,-2)+"\u0430\u0442\u044C",.82,{removedSuffixes:["\u0430\u043B"],conjugationType:"past"}):r.endsWith("\u0438\u043B")&&r.length>3?F(r.slice(0,-2)+"\u0438\u0442\u044C",.82,{removedSuffixes:["\u0438\u043B"],conjugationType:"past"}):null}tryPresentTenseNormalization(r){return r.endsWith("\u0438\u0448\u044C")&&r.length>4?F(r.slice(0,-3)+"\u0438\u0442\u044C",.8,{removedSuffixes:["\u0438\u0448\u044C"],conjugationType:"present"}):r.endsWith("\u0438\u0442")&&r.length>3?F(r.slice(0,-2)+"\u0438\u0442\u044C",.78,{removedSuffixes:["\u0438\u0442"],conjugationType:"present"}):r.endsWith("\u0438\u043C")&&r.length>3?F(r.slice(0,-2)+"\u0438\u0442\u044C",.78,{removedSuffixes:["\u0438\u043C"],conjugationType:"present"}):r.endsWith("\u044F\u0442")&&r.length>3?F(r.slice(0,-2)+"\u0438\u0442\u044C",.78,{removedSuffixes:["\u044F\u0442"],conjugationType:"present"}):r.endsWith("\u0435\u0448\u044C")&&r.length>4?F(r.slice(0,-3)+"\u0430\u0442\u044C",.75,{removedSuffixes:["\u0435\u0448\u044C"],conjugationType:"present"}):r.endsWith("\u0435\u0442")&&r.length>3?F(r.slice(0,-2)+"\u0430\u0442\u044C",.72,{removedSuffixes:["\u0435\u0442"],conjugationType:"present"}):r.endsWith("\u0435\u043C")&&r.length>3?F(r.slice(0,-2)+"\u0430\u0442\u044C",.72,{removedSuffixes:["\u0435\u043C"],conjugationType:"present"}):r.endsWith("\u044E\u0442")&&r.length>3?F(r.slice(0,-2)+"\u0430\u0442\u044C",.75,{removedSuffixes:["\u044E\u0442"],conjugationType:"present"}):r.endsWith("\u0443\u0442")&&r.length>3?F(r.slice(0,-2)+"\u0430\u0442\u044C",.72,{removedSuffixes:["\u0443\u0442"],conjugationType:"present"}):null}},Yn={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\u043F\u0438\u0441\u0430\u0442\u044C",alternatives:["\u0434\u043E\u0431\u0430\u0432\u0438\u0442\u044C \u0432 \u043A\u043E\u043D\u0435\u0446","\u0434\u043E\u0431\u0430\u0432\u0438\u0442\u044C_\u0432_\u043A\u043E\u043D\u0435\u0446"],normalized:"append",form:"infinitive"},prepend:{primary:"\u0434\u043E\u0431\u0430\u0432\u0438\u0442\u044C \u0432 \u043D\u0430\u0447\u0430\u043B\u043E",alternatives:["\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"},changes:{primary:"\u0438\u0437\u043C\u0435\u043D\u044F\u0435\u0442\u0441\u044F",normalized:"changes"},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"]}},xc=["===","!==","->","==","!=","<=",">=","&&","||","**","+=","-=","*=","/=","+","-","*","/","=",">","<","!","&","|","%","^","~"],Bc=class{constructor(r=xc){this.name="operator",this.operators=[...r].sort((e,t)=>t.length-e.length);}canExtract(r,e){return this.operators.some(t=>r.startsWith(t,e))}extract(r,e){for(let t of this.operators)if(r.startsWith(t,e))return {value:t,length:t.length};return null}},Fc="()[]{},:;",Tc=class{constructor(r=Fc){this.punctuation=r,this.name="punctuation";}canExtract(r,e){return this.punctuation.includes(r[e])}extract(r,e){let t=r[e];return this.punctuation.includes(t)?{value:t,length:1}:null}};function Lt(r,e){let t=e;for(;t<r.length&&r[t]===":";){let i=r.slice(t).match(/^::?[a-zA-Z][a-zA-Z0-9-]*/);if(!i)break;let n=t+i[0].length;if(r[n]==="("){let a=0,u=n;for(;u<r.length;){if(r[u]==="(")a++;else if(r[u]===")"&&(a--,a===0)){u++;break}u++;}if(a!==0)break;n=u;}t=n;}return t}function Un(r,e){let t=r[e];if(t==="#"){let i=r.slice(e).match(/^#[a-zA-Z_][\w-]*/);if(!i)return null;let n=Lt(r,e+i[0].length);return r.slice(e,n)}if(t==="."){let i=r.slice(e).match(/^\.\{[a-zA-Z_$][\w$]*\}/);if(i)return i[0];let n=r.slice(e).match(/^\.[a-zA-Z_][\w-]*/);if(!n)return null;let a=Lt(r,e+n[0].length);return r.slice(e,a)}if(t==="@"){let i=r.slice(e).match(/^@[a-zA-Z_][\w-]*/);return i?i[0]:null}if(t==="*"){let i=r.slice(e).match(/^\*(?:--)?[a-zA-Z_][\w-]*/);return i?i[0]:null}if(t==="["){let i=0,n=e;for(;n<r.length;){if(r[n]==="["&&i++,r[n]==="]"&&(i--,i===0)){let a=Lt(r,n+1);return r.slice(e,a)}n++;}return null}if(t==="<"){let i=r.slice(e).match(/^<(?=[\w.#[])[\w-]*(?:[#.][\w-]+|\[[^\]]+\]|::?[a-zA-Z][a-zA-Z0-9-]*(?:\([^)]*\))?)*\s*\/>/);return i?i[0]:null}return null}var Oc=class{constructor(){this.name="css-selector";}canExtract(r,e){let t=r[e];return t==="#"||t==="."||t==="["||t==="<"?true:t==="@"||t==="*"?Un(r,e)!==null:false}extract(r,e){let t=Un(r,e);return t?{value:t,length:t.length,metadata:{type:"css-selector"}}:null}},Rc=class{constructor(){this.name="event-modifier";}canExtract(r,e){if(r[e]!==".")return false;let t=r.slice(e);return /^\.(once|prevent|stop|debounce|throttle|queue)/.test(t)}extract(r,e){let t=r.slice(e).match(/^\.(?:once|prevent|stop|debounce|throttle|queue)(?:\(([^)]+)\))?/);if(!t)return null;let i=t[0],n=i.slice(1).split("(")[0],a=t[1];return {value:i,length:i.length,metadata:{modifierName:n,value:a?n==="queue"?a:parseInt(a,10):void 0}}}},Pc=["http://","https://","//","./","../","/"];function Lc(r,e){let t=1;for(let i=e;i<r.length;i++){let n=r[i];if(n==="{")t++;else if(n==="}"&&--t===0)return i+1}return -1}function Nc(r,e){let t=r.slice(e),i=Pc.find(a=>t.startsWith(a));if(!i)return null;let n=i.length;for(;n<t.length;){let a=t[n];if(a==="$"&&t[n+1]==="{"){let u=Lc(t,n+2);if(u!==-1){n=u;continue}}if(/\s/.test(a))break;n++;}return t.slice(0,n)}var Mc=class{constructor(){this.name="url";}canExtract(r,e){let t=r.slice(e);return t.startsWith("http://")||t.startsWith("https://")||t.startsWith("//")||t.startsWith("./")||t.startsWith("../")||t.startsWith("/")}extract(r,e){let t=Nc(r,e);return t?{value:t,length:t.length,metadata:{type:"url"}}:null}},_c=class{constructor(){this.name="variable-ref";}canExtract(r,e){let t=r[e];return (t===":"||t==="$"||t==="^")&&e+1<r.length&&/[a-zA-Z_]/.test(r[e+1])}extract(r,e){if(!this.canExtract(r,e))return null;let t=1;for(;e+t<r.length&&/[a-zA-Z0-9_]/.test(r[e+t]);)t++;return {value:r.substring(e,e+t),length:t,metadata:{type:"variable-reference"}}}};function Ic(r){return {isLetter:i=>r.test(i),isIdentifierChar:i=>/[0-9_]/.test(i)||r.test(i)}}var jc=class{constructor(r,e,t){this.name=r;let i=Ic(e);this.isLetter=i.isLetter,this.isIdentifierChar=i.isIdentifierChar,this.prepositions=t;}setContext(r){this.context=r;}canExtract(r,e){let t=r[e];return t==="'"?false:this.isLetter(t)}extract(r,e){if(!this.context)throw new Error(`${this.name}: context not set`);let t=e,i="";for(;t<r.length&&this.isIdentifierChar(r[t]);)i+=r[t++];if(!i)return null;let 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:t-e,metadata:{normalized:o||s,isPreposition:a}}}},$c=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 Vc(){return [new jc("russian-keyword",/[a-zA-Z\u0430-\u044f\u0410-\u042f\u0451\u0401]/,$c)]}function Wc(r){let e=r.charCodeAt(0);return e>=65&&e<=90||e>=97&&e<=122||e===95||e===36}function qc(r){let e=r.charCodeAt(0);return e>=48&&e<=57||e>=65&&e<=90||e>=97&&e<=122||e===95||e===36}var Kc=class{constructor(){this.name="ascii-identifier";}setContext(r){this.context=r;}canExtract(r,e){return Wc(r[e])}extract(r,e){if(!this.context)throw new Error("AsciiIdentifierExtractor: context not set");let t=e,i="",n=e;for(;n<r.length&&qc(r[n]);)i+=r[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-t,metadata:{normalized:u}}}};function Hc(){return [new Mc,new Rc,new _c,new Oc]}var Uc=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"]),Gc=[{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"}],Yc=class extends er{constructor(){super(),this.language="ru",this.direction="ltr",this.initializeKeywordsFromProfile(Yn,Gc),this.setNormalizer(new Gn),this.registerExtractors([...Hc(),...Vc(),new Je,new Qe,new Kc,new Bc,new Tc]);}classifyToken(r){let e=r.toLowerCase();return Uc.has(e)?"particle":this.isKeyword(e)?"keyword":/^\.(once|prevent|stop|debounce|throttle|queue)(\(.*\))?$/.test(r)?"event-modifier":r.startsWith("#")||r.startsWith(".")||r.startsWith("[")||r.startsWith("*")||r.startsWith("<")?"selector":r.startsWith('"')||r.startsWith("'")||/^\d/.test(r)?"literal":r.startsWith("/")||r.startsWith("./")||r.startsWith("http")?"url":"identifier"}},Zc=new Yc;cr("ru",Zc,Yn);var Jn={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"},changes:{primary:"zmienia",normalized:"changes"},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:"zmiana rozmiaru",alternatives:["zmie\u0144 rozmiar","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"]}},Zn=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"]]),Qn=class{constructor(){this.language="pl";}isNormalizable(r){return r.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(r)}normalize(r){let e=r.toLowerCase();if(this.isInfinitive(e))return me(e);let t=this.tryImperativeNormalization(e);if(t)return t;let i=this.tryPastTenseNormalization(e);if(i)return i;let n=this.tryPresentTenseNormalization(e);return n||me(e)}isInfinitive(r){return ["a\u0107","e\u0107","i\u0107","y\u0107","\u0105\u0107","owa\u0107","iwa\u0107","ywa\u0107"].some(t=>r.endsWith(t))}tryImperativeNormalization(r){return Zn.has(r)?F(Zn.get(r),.95,{removedSuffixes:["imperative"],conjugationType:"imperative"}):r.endsWith("aj")?F(r.slice(0,-2)+"a\u0107",.8,{removedSuffixes:["aj"],conjugationType:"imperative"}):r.endsWith("uj")?F(r.slice(0,-2)+"owa\u0107",.8,{removedSuffixes:["uj"],conjugationType:"imperative"}):r.endsWith("ij")?F(r.slice(0,-2)+"i\u0107",.75,{removedSuffixes:["ij"],conjugationType:"imperative"}):null}tryPresentTenseNormalization(r){return r.endsWith("uj\u0119")||r.endsWith("uje")?F(r.slice(0,-3)+"owa\u0107",.85,{removedSuffixes:["uj\u0119"],conjugationType:"present"}):r.endsWith("am")&&r.length>3?F(r.slice(0,-2)+"a\u0107",.8,{removedSuffixes:["am"],conjugationType:"present"}):r.endsWith("em")&&r.length>3?F(r.slice(0,-2)+"e\u0107",.75,{removedSuffixes:["em"],conjugationType:"present"}):r.endsWith("\u0119")&&r.length>2?F(r.slice(0,-1)+"a\u0107",.7,{removedSuffixes:["\u0119"],conjugationType:"present"}):null}tryPastTenseNormalization(r){if(r.endsWith("a\u0142em")||r.endsWith("a\u0142am"))return F(r.slice(0,-4)+"a\u0107",.85,{removedSuffixes:[r.slice(-4)],conjugationType:"past"});if(r.endsWith("a\u0142")||r.endsWith("a\u0142a")){let e=r.endsWith("a\u0142a")?3:2;return F(r.slice(0,-e)+"a\u0107",.8,{removedSuffixes:[r.slice(-e)],conjugationType:"past"})}if(r.endsWith("i\u0142em")||r.endsWith("i\u0142am")||r.endsWith("ilem")||r.endsWith("ilam"))return F(r.slice(0,-4)+"i\u0107",.85,{removedSuffixes:[r.slice(-4)],conjugationType:"past"});if(r.endsWith("i\u0142")||r.endsWith("i\u0142a")||r.endsWith("il")||r.endsWith("ila")){let e=r.endsWith("i\u0142a")||r.endsWith("ila")?3:2;return F(r.slice(0,-e)+"i\u0107",.8,{removedSuffixes:[r.slice(-e)],conjugationType:"past"})}return null}},Xc=["===","!==","->","==","!=","<=",">=","&&","||","**","+=","-=","*=","/=","+","-","*","/","=",">","<","!","&","|","%","^","~"],Jc=class{constructor(r=Xc){this.name="operator",this.operators=[...r].sort((e,t)=>t.length-e.length);}canExtract(r,e){return this.operators.some(t=>r.startsWith(t,e))}extract(r,e){for(let t of this.operators)if(r.startsWith(t,e))return {value:t,length:t.length};return null}},Qc="()[]{},:;",e4=class{constructor(r=Qc){this.punctuation=r,this.name="punctuation";}canExtract(r,e){return this.punctuation.includes(r[e])}extract(r,e){let t=r[e];return this.punctuation.includes(t)?{value:t,length:1}:null}};function Nt(r,e){let t=e;for(;t<r.length&&r[t]===":";){let i=r.slice(t).match(/^::?[a-zA-Z][a-zA-Z0-9-]*/);if(!i)break;let n=t+i[0].length;if(r[n]==="("){let a=0,u=n;for(;u<r.length;){if(r[u]==="(")a++;else if(r[u]===")"&&(a--,a===0)){u++;break}u++;}if(a!==0)break;n=u;}t=n;}return t}function Xn(r,e){let t=r[e];if(t==="#"){let i=r.slice(e).match(/^#[a-zA-Z_][\w-]*/);if(!i)return null;let n=Nt(r,e+i[0].length);return r.slice(e,n)}if(t==="."){let i=r.slice(e).match(/^\.\{[a-zA-Z_$][\w$]*\}/);if(i)return i[0];let n=r.slice(e).match(/^\.[a-zA-Z_][\w-]*/);if(!n)return null;let a=Nt(r,e+n[0].length);return r.slice(e,a)}if(t==="@"){let i=r.slice(e).match(/^@[a-zA-Z_][\w-]*/);return i?i[0]:null}if(t==="*"){let i=r.slice(e).match(/^\*(?:--)?[a-zA-Z_][\w-]*/);return i?i[0]:null}if(t==="["){let i=0,n=e;for(;n<r.length;){if(r[n]==="["&&i++,r[n]==="]"&&(i--,i===0)){let a=Nt(r,n+1);return r.slice(e,a)}n++;}return null}if(t==="<"){let i=r.slice(e).match(/^<(?=[\w.#[])[\w-]*(?:[#.][\w-]+|\[[^\]]+\]|::?[a-zA-Z][a-zA-Z0-9-]*(?:\([^)]*\))?)*\s*\/>/);return i?i[0]:null}return null}var r4=class{constructor(){this.name="css-selector";}canExtract(r,e){let t=r[e];return t==="#"||t==="."||t==="["||t==="<"?true:t==="@"||t==="*"?Xn(r,e)!==null:false}extract(r,e){let t=Xn(r,e);return t?{value:t,length:t.length,metadata:{type:"css-selector"}}:null}},t4=class{constructor(){this.name="event-modifier";}canExtract(r,e){if(r[e]!==".")return false;let t=r.slice(e);return /^\.(once|prevent|stop|debounce|throttle|queue)/.test(t)}extract(r,e){let t=r.slice(e).match(/^\.(?:once|prevent|stop|debounce|throttle|queue)(?:\(([^)]+)\))?/);if(!t)return null;let i=t[0],n=i.slice(1).split("(")[0],a=t[1];return {value:i,length:i.length,metadata:{modifierName:n,value:a?n==="queue"?a:parseInt(a,10):void 0}}}},i4=["http://","https://","//","./","../","/"];function n4(r,e){let t=1;for(let i=e;i<r.length;i++){let n=r[i];if(n==="{")t++;else if(n==="}"&&--t===0)return i+1}return -1}function a4(r,e){let t=r.slice(e),i=i4.find(a=>t.startsWith(a));if(!i)return null;let n=i.length;for(;n<t.length;){let a=t[n];if(a==="$"&&t[n+1]==="{"){let u=n4(t,n+2);if(u!==-1){n=u;continue}}if(/\s/.test(a))break;n++;}return t.slice(0,n)}var u4=class{constructor(){this.name="url";}canExtract(r,e){let t=r.slice(e);return t.startsWith("http://")||t.startsWith("https://")||t.startsWith("//")||t.startsWith("./")||t.startsWith("../")||t.startsWith("/")}extract(r,e){let t=a4(r,e);return t?{value:t,length:t.length,metadata:{type:"url"}}:null}},o4=class{constructor(){this.name="variable-ref";}canExtract(r,e){let t=r[e];return (t===":"||t==="$"||t==="^")&&e+1<r.length&&/[a-zA-Z_]/.test(r[e+1])}extract(r,e){if(!this.canExtract(r,e))return null;let t=1;for(;e+t<r.length&&/[a-zA-Z0-9_]/.test(r[e+t]);)t++;return {value:r.substring(e,e+t),length:t,metadata:{type:"variable-reference"}}}},s4=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 l4(){let r=/[a-zA-Z\u0105\u0119\u0107\u0144\u00f3\u015b\u017a\u017c\u0142\u0104\u0118\u0106\u0143\u00d3\u015a\u0179\u017b\u0141]/;return {isLetter:i=>r.test(i),isIdentifierChar:i=>/[0-9]/.test(i)||r.test(i)}}var{isLetter:c4,isIdentifierChar:d4}=l4(),m4=class{constructor(){this.name="polish-keyword";}setContext(r){this.context=r;}canExtract(r,e){return c4(r[e])}extract(r,e){if(!this.context)throw new Error("PolishKeywordExtractor: context not set");let t=e,i="";for(;t<r.length&&d4(r[t]);)i+=r[t++];if(!i)return null;let n=i.toLowerCase(),a=s4.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:t-e,metadata:{normalized:o||s,isPreposition:a}}}};function p4(){return [new m4]}function f4(){return [new u4,new t4,new o4,new r4]}var y4=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"]),h4=[{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:"r\xF3wna si\u0119",normalized:"equals"},{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"}],v4=class extends er{constructor(){super(),this.language="pl",this.direction="ltr",this.initializeKeywordsFromProfile(Jn,h4),this.setNormalizer(new Qn),this.registerExtractors(f4()),this.registerExtractor(new Je),this.registerExtractor(new Qe),this.registerExtractors(p4()),this.registerExtractor(new Jc),this.registerExtractor(new e4);}classifyToken(r){let e=r.toLowerCase();return y4.has(e)?"particle":this.isKeyword(e)?"keyword":/^\.(once|prevent|stop|debounce|throttle|queue)(\(.*\))?$/.test(r)?"event-modifier":r.startsWith("#")||r.startsWith(".")||r.startsWith("[")||r.startsWith("*")||r.startsWith("<")?"selector":r.startsWith('"')||r.startsWith("'")||/^\d/.test(r)?"literal":["==","!=","<=",">=","<",">","&&","||","!"].includes(r)?"operator":r.startsWith("/")||r.startsWith("./")||r.startsWith("http")?"url":"identifier"}},E4=new v4;cr("pl",E4,Jn);var g4=new Set(["result","event","target","body","detail","document","window"]),ea=/^(.+)'s$/u;function z4(r,e){let t=r.tokens;if(!t.some(n=>n.kind==="identifier"&&ea.test(n.value)))return r;let i=[];for(let n of t){let a=n.kind==="identifier"?ea.exec(n.value)?.[1]:void 0,u=a?e(a):[],o=u.length===1?u[0]:void 0;if(!a||o?.kind!=="keyword"||!g4.has((o.normalized??"").toLowerCase())){i.push(n);continue}let s=n.position.start,l=s+a.length;i.push({...o,position:{start:s,end:l}}),i.push({value:"'",kind:"identifier",position:{start:l,end:l+1}}),i.push({value:"s",kind:"identifier",position:{start:l+1,end:l+2}});}return new oe(i,r.language)}function w4(r){return /[\u0430-\u044f\u0410-\u042f\u0456\u0406\u0457\u0407\u0454\u0404\u0491\u0490\u044c\u042c']/.test(r)}var ra=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"]]),ia=class{constructor(){this.language="uk";}isNormalizable(r){return r.length<3?false:w4(r)}normalize(r){let e=r.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 me(r);let t=this.tryImperativeLookup(e);if(t)return t;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||me(r)}tryReflexiveNormalization(r){let e=r.slice(0,-2);if(r.endsWith("\u0442\u0438\u0441\u044F")||r.endsWith("\u0447\u0438\u0441\u044F"))return me(r);let t=this.normalizeNonReflexive(e);if(t.confidence<1){let i=t.stem.endsWith("\u0442\u0438")?t.stem.slice(0,-2)+"\u0442\u0438\u0441\u044F":t.stem+"\u0441\u044F";return F(i,t.confidence*.95,{removedSuffixes:["\u0441\u044F",...t.metadata?.removedSuffixes||[]],conjugationType:"reflexive"})}return null}normalizeNonReflexive(r){if(r.endsWith("\u0442\u0438")||r.endsWith("\u0447\u0438"))return me(r);let e=this.tryImperativeLookup(r);if(e)return e;let t=this.tryPastTenseNormalization(r);if(t)return t;let i=this.tryPresentTenseNormalization(r);if(i)return i;let n=this.tryGenericImperativeNormalization(r);return n||me(r)}tryImperativeLookup(r){return ra.has(r)?F(ra.get(r),.95,{removedSuffixes:["imperative"],conjugationType:"imperative"}):null}tryGenericImperativeNormalization(r){return r.endsWith("\u0439\u0442\u0435")&&r.length>5?F(r.slice(0,-3)+"\u0442\u0438",.8,{removedSuffixes:["\u0439\u0442\u0435"],conjugationType:"imperative"}):r.endsWith("\u0456\u0442\u044C")&&r.length>5?F(r.slice(0,-3)+"\u0438\u0442\u0438",.8,{removedSuffixes:["\u0456\u0442\u044C"],conjugationType:"imperative"}):r.endsWith("\u0439")&&r.length>3?F(r.slice(0,-1)+"\u0442\u0438",.75,{removedSuffixes:["\u0439"],conjugationType:"imperative"}):r.endsWith("\u0438")&&r.length>3?F(r+"\u0442\u0438",.7,{removedSuffixes:["\u0438\u2192\u0438\u0442\u0438"],conjugationType:"imperative"}):null}tryPastTenseNormalization(r){return r.endsWith("\u0430\u043B\u0430")&&r.length>4?F(r.slice(0,-3)+"\u0430\u0442\u0438",.85,{removedSuffixes:["\u0430\u043B\u0430"],conjugationType:"past"}):r.endsWith("\u0438\u043B\u0430")&&r.length>4?F(r.slice(0,-3)+"\u0438\u0442\u0438",.85,{removedSuffixes:["\u0438\u043B\u0430"],conjugationType:"past"}):r.endsWith("\u0430\u043B\u0438")&&r.length>4?F(r.slice(0,-3)+"\u0430\u0442\u0438",.85,{removedSuffixes:["\u0430\u043B\u0438"],conjugationType:"past"}):r.endsWith("\u0438\u043B\u0438")&&r.length>4?F(r.slice(0,-3)+"\u0438\u0442\u0438",.85,{removedSuffixes:["\u0438\u043B\u0438"],conjugationType:"past"}):r.endsWith("\u0430\u0432")&&r.length>3?F(r.slice(0,-2)+"\u0430\u0442\u0438",.82,{removedSuffixes:["\u0430\u0432"],conjugationType:"past"}):r.endsWith("\u0438\u0432")&&r.length>3?F(r.slice(0,-2)+"\u0438\u0442\u0438",.82,{removedSuffixes:["\u0438\u0432"],conjugationType:"past"}):null}tryPresentTenseNormalization(r){return r.endsWith("\u0438\u0448")&&r.length>3?F(r.slice(0,-2)+"\u0438\u0442\u0438",.8,{removedSuffixes:["\u0438\u0448"],conjugationType:"present"}):r.endsWith("\u0438\u0442\u044C")&&r.length>4?F(r.slice(0,-3)+"\u0438\u0442\u0438",.78,{removedSuffixes:["\u0438\u0442\u044C"],conjugationType:"present"}):r.endsWith("\u0438\u043C\u043E")&&r.length>4?F(r.slice(0,-3)+"\u0438\u0442\u0438",.8,{removedSuffixes:["\u0438\u043C\u043E"],conjugationType:"present"}):r.endsWith("\u044F\u0442\u044C")&&r.length>4?F(r.slice(0,-3)+"\u0438\u0442\u0438",.78,{removedSuffixes:["\u044F\u0442\u044C"],conjugationType:"present"}):r.endsWith("\u0454\u0448")&&r.length>3?F(r.slice(0,-2)+"\u0430\u0442\u0438",.78,{removedSuffixes:["\u0454\u0448"],conjugationType:"present"}):r.endsWith("\u0435\u0448")&&r.length>3?F(r.slice(0,-2)+"\u0430\u0442\u0438",.75,{removedSuffixes:["\u0435\u0448"],conjugationType:"present"}):r.endsWith("\u0454")&&r.length>2?F(r.slice(0,-1)+"\u0430\u0442\u0438",.72,{removedSuffixes:["\u0454"],conjugationType:"present"}):r.endsWith("\u0454\u043C\u043E")&&r.length>4?F(r.slice(0,-3)+"\u0430\u0442\u0438",.8,{removedSuffixes:["\u0454\u043C\u043E"],conjugationType:"present"}):r.endsWith("\u044E\u0442\u044C")&&r.length>4?F(r.slice(0,-3)+"\u0430\u0442\u0438",.78,{removedSuffixes:["\u044E\u0442\u044C"],conjugationType:"present"}):r.endsWith("\u0443\u0442\u044C")&&r.length>4?F(r.slice(0,-3)+"\u0430\u0442\u0438",.75,{removedSuffixes:["\u0443\u0442\u044C"],conjugationType:"present"}):null}},na={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\u043F\u0438\u0441\u0430\u0442\u0438",alternatives:["\u0434\u043E\u0434\u0430\u0442\u0438 \u0432 \u043A\u0456\u043D\u0435\u0446\u044C","\u0434\u043E\u0434\u0430\u0442\u0438_\u0432_\u043A\u0456\u043D\u0435\u0446\u044C"],normalized:"append",form:"infinitive"},prepend:{primary:"\u0434\u043E\u0434\u0430\u0442\u0438 \u043D\u0430 \u043F\u043E\u0447\u0430\u0442\u043E\u043A",alternatives:["\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"},changes:{primary:"\u0437\u043C\u0456\u043D\u044E\u0454\u0442\u044C\u0441\u044F",normalized:"changes"},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"]}},k4=["===","!==","->","==","!=","<=",">=","&&","||","**","+=","-=","*=","/=","+","-","*","/","=",">","<","!","&","|","%","^","~"],C4=class{constructor(r=k4){this.name="operator",this.operators=[...r].sort((e,t)=>t.length-e.length);}canExtract(r,e){return this.operators.some(t=>r.startsWith(t,e))}extract(r,e){for(let t of this.operators)if(r.startsWith(t,e))return {value:t,length:t.length};return null}},b4="()[]{},:;",A4=class{constructor(r=b4){this.punctuation=r,this.name="punctuation";}canExtract(r,e){return this.punctuation.includes(r[e])}extract(r,e){let t=r[e];return this.punctuation.includes(t)?{value:t,length:1}:null}};function Mt(r,e){let t=e;for(;t<r.length&&r[t]===":";){let i=r.slice(t).match(/^::?[a-zA-Z][a-zA-Z0-9-]*/);if(!i)break;let n=t+i[0].length;if(r[n]==="("){let a=0,u=n;for(;u<r.length;){if(r[u]==="(")a++;else if(r[u]===")"&&(a--,a===0)){u++;break}u++;}if(a!==0)break;n=u;}t=n;}return t}function ta(r,e){let t=r[e];if(t==="#"){let i=r.slice(e).match(/^#[a-zA-Z_][\w-]*/);if(!i)return null;let n=Mt(r,e+i[0].length);return r.slice(e,n)}if(t==="."){let i=r.slice(e).match(/^\.\{[a-zA-Z_$][\w$]*\}/);if(i)return i[0];let n=r.slice(e).match(/^\.[a-zA-Z_][\w-]*/);if(!n)return null;let a=Mt(r,e+n[0].length);return r.slice(e,a)}if(t==="@"){let i=r.slice(e).match(/^@[a-zA-Z_][\w-]*/);return i?i[0]:null}if(t==="*"){let i=r.slice(e).match(/^\*(?:--)?[a-zA-Z_][\w-]*/);return i?i[0]:null}if(t==="["){let i=0,n=e;for(;n<r.length;){if(r[n]==="["&&i++,r[n]==="]"&&(i--,i===0)){let a=Mt(r,n+1);return r.slice(e,a)}n++;}return null}if(t==="<"){let i=r.slice(e).match(/^<(?=[\w.#[])[\w-]*(?:[#.][\w-]+|\[[^\]]+\]|::?[a-zA-Z][a-zA-Z0-9-]*(?:\([^)]*\))?)*\s*\/>/);return i?i[0]:null}return null}var S4=class{constructor(){this.name="css-selector";}canExtract(r,e){let t=r[e];return t==="#"||t==="."||t==="["||t==="<"?true:t==="@"||t==="*"?ta(r,e)!==null:false}extract(r,e){let t=ta(r,e);return t?{value:t,length:t.length,metadata:{type:"css-selector"}}:null}},D4=class{constructor(){this.name="event-modifier";}canExtract(r,e){if(r[e]!==".")return false;let t=r.slice(e);return /^\.(once|prevent|stop|debounce|throttle|queue)/.test(t)}extract(r,e){let t=r.slice(e).match(/^\.(?:once|prevent|stop|debounce|throttle|queue)(?:\(([^)]+)\))?/);if(!t)return null;let i=t[0],n=i.slice(1).split("(")[0],a=t[1];return {value:i,length:i.length,metadata:{modifierName:n,value:a?n==="queue"?a:parseInt(a,10):void 0}}}},x4=["http://","https://","//","./","../","/"];function B4(r,e){let t=1;for(let i=e;i<r.length;i++){let n=r[i];if(n==="{")t++;else if(n==="}"&&--t===0)return i+1}return -1}function F4(r,e){let t=r.slice(e),i=x4.find(a=>t.startsWith(a));if(!i)return null;let n=i.length;for(;n<t.length;){let a=t[n];if(a==="$"&&t[n+1]==="{"){let u=B4(t,n+2);if(u!==-1){n=u;continue}}if(/\s/.test(a))break;n++;}return t.slice(0,n)}var T4=class{constructor(){this.name="url";}canExtract(r,e){let t=r.slice(e);return t.startsWith("http://")||t.startsWith("https://")||t.startsWith("//")||t.startsWith("./")||t.startsWith("../")||t.startsWith("/")}extract(r,e){let t=F4(r,e);return t?{value:t,length:t.length,metadata:{type:"url"}}:null}},O4=class{constructor(){this.name="variable-ref";}canExtract(r,e){let t=r[e];return (t===":"||t==="$"||t==="^")&&e+1<r.length&&/[a-zA-Z_]/.test(r[e+1])}extract(r,e){if(!this.canExtract(r,e))return null;let t=1;for(;e+t<r.length&&/[a-zA-Z0-9_]/.test(r[e+t]);)t++;return {value:r.substring(e,e+t),length:t,metadata:{type:"variable-reference"}}}};function R4(r){return {isLetter:i=>r.test(i),isIdentifierChar:i=>/[0-9_]/.test(i)||r.test(i)}}var P4=class{constructor(r,e,t){this.name=r;let i=R4(e);this.isLetter=i.isLetter,this.isIdentifierChar=i.isIdentifierChar,this.prepositions=t;}setContext(r){this.context=r;}canExtract(r,e){let t=r[e];return t==="'"?false:this.isLetter(t)}extract(r,e){if(!this.context)throw new Error(`${this.name}: context not set`);let t=e,i="";for(;t<r.length&&this.isIdentifierChar(r[t]);)i+=r[t++];if(!i)return null;let 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:t-e,metadata:{normalized:o||s,isPreposition:a}}}},L4=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 N4(){return [new P4("ukrainian-keyword",/[a-zA-Z\u0430-\u044f\u0410-\u042f\u0456\u0406\u0457\u0407\u0454\u0404\u0491\u0490\u044c\u042c']/,L4)]}function M4(r){let e=r.charCodeAt(0);return e>=65&&e<=90||e>=97&&e<=122||e===95||e===36}function _4(r){let e=r.charCodeAt(0);return e>=48&&e<=57||e>=65&&e<=90||e>=97&&e<=122||e===95||e===36}var I4=class{constructor(){this.name="ascii-identifier";}setContext(r){this.context=r;}canExtract(r,e){return M4(r[e])}extract(r,e){if(!this.context)throw new Error("AsciiIdentifierExtractor: context not set");let t=e,i="",n=e;for(;n<r.length&&_4(r[n]);)i+=r[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-t,metadata:{normalized:u}}}};function j4(){return [new T4,new D4,new O4,new S4]}var $4=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"]),V4=[{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"}],W4=class extends er{constructor(){super(),this.language="uk",this.direction="ltr",this.initializeKeywordsFromProfile(na,V4),this.setNormalizer(new ia),this.registerExtractors([...j4(),...N4(),new Je,new Qe,new I4,new C4,new A4]);}tokenize(r){return z4(super.tokenize(r),e=>super.tokenize(e).tokens)}classifyToken(r){let e=r.toLowerCase();return $4.has(e)?"particle":this.isKeyword(e)?"keyword":/^\.(once|prevent|stop|debounce|throttle|queue)(\(.*\))?$/.test(r)?"event-modifier":r.startsWith("#")||r.startsWith(".")||r.startsWith("[")||r.startsWith("*")||r.startsWith("<")?"selector":r.startsWith('"')||r.startsWith("'")||/^\d/.test(r)?"literal":r.startsWith("/")||r.startsWith("./")||r.startsWith("http")?"url":"identifier"}},q4=new W4;cr("uk",q4,na);function Qr(r){let e=r.getAttribute("data-lang");if(e)return Jr(e);let t=r.getAttribute("data-hyperscript-lang")??r.closest?.("[data-hyperscript-lang]")?.getAttribute("data-hyperscript-lang");if(t)return Jr(t);let i=r.closest?.("[lang]")?.getAttribute("lang");if(i)return Jr(i);let n=typeof document<"u"?document.documentElement?.lang:null;return n&&n!=="en"?Jr(n):null}function Jr(r){return r.split("-")[0].toLowerCase()}var aa={add:[["patient",""],["destination","to"]],append:[["patient",""],["destination","to"]],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",""],["manner","in new"]],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"],["manner","using view"]],on:[["event",""],["source","from"]],open:[["patient",""],["style","as"]],pick:[["patient",""],["source","from"]],prepend:[["patient",""],["destination","to"]],process:[["patient","partials in"],["manner","using view"]],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"],["manner","using view"]],take:[["patient",""],["source","from"],["recipient","for"]],tell:[["destination",""]],throw:[["patient",""]],toggle:[["patient",""],["destination","on"],["duration","for"]],transition:[["patient",""],["goal","to"],["destination","on"],["duration","over"],["style","with"]],trigger:[["event",""],["destination","on"]],unless:[["condition",""]],wait:[["duration",""]],when:[["condition",""]],while:[["condition",""]],worker:[]};var K4=new Set(["repeat","for","while","tell"]),H4=new Set(["js"]);function et(r){switch(r.kind){case "event-handler":return G4(r);case "compound":return ua(r);case "loop":return U4(r);default:return Y4(r)}}function U4(r){let e={kind:"command",action:r.action,roles:r.roles};return ua({statements:[e,...r.body],chainType:"then"})}function G4(r){let e=["on"],t=r.roles.get("event");t&&e.push(t.type==="literal"?String(t.value):Tr(t));let i=r.roles.get("source");if(i&&e.push("from",Tr(i)),r.body&&r.body.length>0){let n=r.body.map(et);e.push(n.join(" "));}return e.join(" ")}function ua(r){let e=r.chainType==="async"?"async":r.chainType,t=r.statements.map(et),i=t[0]??"";for(let n=1;n<t.length;n++){let a=r.statements[n-1],u=r.statements[n],o=a.kind==="command"&&K4.has(a.action),s=a.kind==="command"&&a.action==="bind"&&u.kind==="command"&&u.action==="bind";a.kind==="command"&&H4.has(a.action)&&(i+=" end"),i+=(o||s?" ":` ${e} `)+t[n];}return i}function Y4(r){let e=aa[r.action];if(e){let i=[r.action];for(let[n,a]of e){let u=r.roles.get(n);u&&((n==="destination"||n==="source")&&u.type==="reference"&&u.value==="me"||(a&&i.push(a),i.push(Tr(u))));}return i.join(" ")}let t=[r.action];for(let[,i]of r.roles)t.push(Tr(i));return t.join(" ")}function Tr(r){switch(r.type){case "literal":return typeof r.value=="string"&&r.dataType==="string"?`"${r.value}"`:String(r.value);case "selector":return r.value;case "reference":return r.value;case "property-path":return Z4(r);case "expression":return r.raw;case "flag":return r.enabled?`+${r.name}`:`~${r.name}`}}function Z4(r){let e=Tr(r.object),t=r.property;if(r.object.type==="reference")switch(r.object.value){case "me":return `my ${t}`;case "it":return `its ${t}`;case "you":return `your ${t}`}return `${e}'s ${t}`}var X4={confidenceThreshold:.5,strategy:"semantic"};function J4(r,e){return typeof r=="number"?r:r[e]??r["*"]??.5}var Q4=/^(on\s+(?:every\s+)?[\w-]+(?:\[.*?\])?(?:\.[\w-]+(?:\([^)]*\))?)*(?:\s+from\s+\S+)?(?:\s+queue\s+\w+)?\s+)/;function ed(r){let e=r.match(Q4);if(!e)return null;let t=e[1],i=r.slice(t.length);return i?{prefix:t,commands:i}:null}function oa(r){function e(n,a,u){try{return r.isLanguageRegistered(a)?r.translateSingle(n,a,u):null}catch{return null}}function t(n,a,u){try{let o=u(n,a);return o!==n?o:null}catch{return null}}function i(n,a,u){if(u.strategy==="semantic"||u.strategy==="auto"){let o=J4(u.confidenceThreshold,a),s=e(n,a,o);if(s!==null)return s}if((u.strategy==="auto"||u.strategy==="i18n")&&u.i18nToEnglish){let o=t(n,a,u.i18nToEnglish);if(o!==null)return o}return null}return function(a,u,o={}){if(u==="en")return a;let s={...X4,...o},l=i(a,u,s);if(l!==null)return l;let c=ed(a);if(c){let d=i(c.commands,u,s);if(d!==null)return c.prefix+d}return a}}var _t=oa({isLanguageRegistered:Ki,translateSingle(r,e,t){let i=Rn(r,e);return i.confidence<t||!i.node?null:et(i.node)}});var It=new WeakSet;function rd(r){return (r.config?.attributes??"_, script, data-script").split(",").map(t=>t.trim()).filter(Boolean)}function td(r,e){for(let t of e)if(r.hasAttribute(t))return t;return null}function sa(r,e){if(typeof r.addSourceTransform=="function"){r.addSourceTransform(e);return}if(typeof r.addBeforeProcessHook!="function"){console.warn("[hyperscript-i18n] _hyperscript.addBeforeProcessHook is unavailable \u2014 this build of _hyperscript.org is not supported. Load a current version from https://unpkg.com/hyperscript.org.");return}let t=rd(r),i=[...t.map(a=>`[${a}]`),'script[type="text/hyperscript"]'].join(", "),n=a=>{if(It.has(a))return;if(a instanceof HTMLScriptElement&&a.type==="text/hyperscript"){let l=a.textContent??"";if(!l)return;let c=e(l,a);It.add(a),c!=null&&c!==l&&(a.textContent=c);return}let u=td(a,t);if(!u)return;let o=a.getAttribute(u);if(!o)return;let s=e(o,a);It.add(a),s!=null&&s!==o&&a.setAttribute(u,s);};r.addBeforeProcessHook(a=>{!a||typeof a.querySelectorAll!="function"||(typeof a.matches=="function"&&a.matches(i)&&n(a),a.querySelectorAll(i).forEach(n));});}var id=new Set(["me","my","i","it","its","you","your"]);function nd(r){for(let e of r?.features??[])for(let t of e.events??[])if(typeof t.on=="string"&&id.has(t.on.toLowerCase()))return t.on}function ca(r,e){if(typeof r.parse!="function")return true;try{let t=r.parse(e);return t?.errors&&t.errors.length>0?!1:nd(t)===void 0}catch{return false}}var la=new Set;function da(r,e,t){la.has(r)||(la.add(r),console.warn(`[hyperscript-i18n] Translation for lang="${r}" rendered hyperscript the host parser rejects (or reads as a handler for an event named like me/it/you) \u2014 falling back to the original text. Source: "${e.length>60?e.slice(0,60)+"\u2026":e}" \u2192 "${t.length>60?t.slice(0,60)+"\u2026":t}". Further elements in this language stay quiet \u2014 enable { debug: true } for per-element detail.`));}function jt(r={}){return function(t){let i=t;sa(i,(n,a)=>{let u=ad(a,r);if(!u||u==="en")return n;let o=_t(n,u,r);if(o!==n){if(r.validateWithHost!==false&&!ca(i,o))return r.debug?console.log(`[hyperscript-i18n] ${u}: host rejected "${o}" \u2014 keeping "${n}"`):da(u,n,o),n;r.debug&&console.log(`[hyperscript-i18n] ${u}: "${n}" \u2192 "${o}"`);}return o});}}function ad(r,e){if(e.languageAttribute){let i=r.getAttribute(e.languageAttribute);if(i)return i.split("-")[0].toLowerCase()}let t=Qr(r);return t||(e.defaultLanguage??null)}function ma(r,e,t={}){return e==="en"?r:_t(r,e,t)}qi(r=>qn(r));function pa(){typeof _hyperscript<"u"&&_hyperscript.use&&_hyperscript.use(jt());}var Op=["ru","pl","uk"];pa();
|
|
6
|
+
exports.plugin=jt;exports.preprocess=ma;exports.resolveLanguage=Qr;exports.supportedLanguages=Op;return exports;})({});
|