@hyperscript-tools/multilingual 4.0.1 → 4.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (32) hide show
  1. package/CHANGELOG.md +148 -1
  2. package/dist/hyperscript-i18n-ar.global.js +11 -6
  3. package/dist/hyperscript-i18n-bn.global.js +11 -6
  4. package/dist/hyperscript-i18n-de.global.js +11 -6
  5. package/dist/hyperscript-i18n-east-asian.global.js +11 -6
  6. package/dist/hyperscript-i18n-en.global.js +11 -8
  7. package/dist/hyperscript-i18n-es.global.js +11 -6
  8. package/dist/hyperscript-i18n-fr.global.js +11 -6
  9. package/dist/hyperscript-i18n-he.global.js +11 -6
  10. package/dist/hyperscript-i18n-hi.global.js +11 -6
  11. package/dist/hyperscript-i18n-id.global.js +11 -6
  12. package/dist/hyperscript-i18n-it.global.js +11 -6
  13. package/dist/hyperscript-i18n-ja.global.js +11 -6
  14. package/dist/hyperscript-i18n-ko.global.js +11 -6
  15. package/dist/hyperscript-i18n-ms.global.js +11 -6
  16. package/dist/hyperscript-i18n-pl.global.js +11 -6
  17. package/dist/hyperscript-i18n-pt.global.js +11 -6
  18. package/dist/hyperscript-i18n-qu.global.js +11 -6
  19. package/dist/hyperscript-i18n-ru.global.js +11 -6
  20. package/dist/hyperscript-i18n-slavic.global.js +11 -6
  21. package/dist/hyperscript-i18n-south-asian.global.js +11 -6
  22. package/dist/hyperscript-i18n-southeast-asian.global.js +11 -6
  23. package/dist/hyperscript-i18n-sw.global.js +11 -6
  24. package/dist/hyperscript-i18n-th.global.js +11 -6
  25. package/dist/hyperscript-i18n-tl.global.js +11 -6
  26. package/dist/hyperscript-i18n-tr.global.js +11 -6
  27. package/dist/hyperscript-i18n-uk.global.js +11 -6
  28. package/dist/hyperscript-i18n-vi.global.js +11 -6
  29. package/dist/hyperscript-i18n-western.global.js +11 -6
  30. package/dist/hyperscript-i18n-zh.global.js +11 -6
  31. package/dist/hyperscript-i18n.global.js +28 -28
  32. package/package.json +2 -2
@@ -1,6 +1,11 @@
1
- var HyperscriptI18n=(function(exports){'use strict';function Te(r,e){return e?{type:"literal",value:r,dataType:e}:{type:"literal",value:r}}function $t(r,e){return e?{type:"selector",value:r,selectorKind:e}:{type:"selector",value:r}}function wt(r){return {type:"reference",value:r}}function jt(r,e){return {type:"property-path",object:r,property:e}}var li=new Set(["me","you","it","result","event","target","body","document","window","detail"]);function fr(r,e=li){return e.has(r)}var Ha=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 Ua(r){return new Ha(r)}function at(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 Ga(r,e){return r?.possessive?.keywords?.[e]}var bt=class ot{constructor(){this.logger=Ua("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 o=this.matchTokenSequence(e,t.template.tokens,a);if(this.logger.debug("matchTokenSequence returned:",o),this.logger.debug("Captured roles:",Array.from(a.entries()).map(([s,l])=>[s,JSON.stringify(l)])),!o)return this.logger.debug(">>> MATCH FAILED - resetting token position"),e.reset(n),null;let u=this.calculateConfidence(t,a);return this.applyExtractionRules(t,a),{pattern:t,captured:a,consumedTokens:e.position()-n.position,confidence:u}}matchBest(e,t,i){let n=[];for(let o of t){let u=e.mark(),s=this.matchPattern(e,o,i);s&&n.push(s),e.reset(u);}if(n.length===0)return null;n.sort((o,u)=>{let s=u.pattern.priority-o.pattern.priority;if(s!==0)return s;let l=u.confidence-o.confidence;return Math.abs(l)>.001?l:u.consumedTokens-o.consumedTokens});let a=n[0];return this.matchPattern(e,a.pattern),a}matchTokenSequence(e,t,i,n){let a=t[0],o=a?.type==="literal"&&(a.value==="and"||a.value==="then"||a.alternatives?.includes("and")||a.alternatives?.includes("then"));if(this.currentProfile?.code==="ar"&&!o)for(;e.peek()?.kind==="conjunction";)e.advance();let u=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 p=e.peek();if(this.logger.debug(" >> Current input token:",p?JSON.stringify({type:p.type,value:p.value,kind:p.kind}):"EOF"),c.type==="role"&&c.greedy){let h=this.collectStopMarkers(t,l+1);if(n)for(let E of n)h.add(E);let v=[];for(;!e.isAtEnd();){let E=e.peek();if(!E||this.isStopMarker(E,h))break;v.push(E.value),e.advance();}if(v.length>0){i.set(c.role,{type:"expression",raw:v.join(" ")}),u=null,s=null;continue}else {if(c.optional)continue;return false}}if(c.type==="group"){let h=this.collectStopMarkers(t,l+1);if(n)for(let E of n)h.add(E);if(this.matchGroupToken(e,c,i,h)){u=null,s=null;continue}if(this.isOptional(c))continue;return false}let d=c.type==="role"&&c.optional===true,m=d?e.mark():null;if(c.type==="role"&&!d){let h=l+1<t.length?t[l+1]:null;if(h?.type==="literal"){let v=e.peek();if(v&&this.getMatchType(v,h.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(u&&s){this.logger.debug(" >> BACKTRACKING: undoing optional role",s),e.reset(u),i.delete(s),u=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){d?(u=m,s=c.role):(u=null,s=null);continue}if(this.logger.debug(" >> Token match FAILED"),!this.isOptional(c)){if(u&&s){this.logger.debug(" >> BACKTRACKING: undoing optional role",s),e.reset(u),i.delete(s),u=null,s=null;let h=this.matchPatternToken(e,c,i);if(this.logger.debug(" >> Backtrack retry result:",h),h)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 o=this.getMatchType(i,a);if(o!=="none")return this.totalKeywordMatches++,o==="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&&!at(a.type,t.expectedTypes)?t.optional||false:(i.set(t.role,a),true);let o=this.tryMatchMethodCallExpression(e);if(o)return t.expectedTypes&&t.expectedTypes.length>0&&!at(o.type,t.expectedTypes)?t.optional||false:(i.set(t.role,o),true);let u=this.tryMatchPossessiveSelectorExpression(e);if(u)return t.expectedTypes&&t.expectedTypes.length>0&&!at(u.type,t.expectedTypes)?t.optional||false:(i.set(t.role,u),true);let s=this.tryMatchPropertyAccessExpression(e);if(s)return t.expectedTypes&&t.expectedTypes.length>0&&!at(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&&!at(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&&!at(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=Ga(this.currentProfile,n);if(!a)return null;let o=e.mark();e.advance();let u=e.peek();if(!u)return e.reset(o),null;if(u.kind==="identifier"||u.kind==="keyword"&&!this.isStructuralKeyword(u.value)||u.kind==="selector"&&u.value.startsWith("*")||u.kind==="selector"&&u.value.startsWith("@")||u.kind==="selector"&&u.value.startsWith(".")&&/^\.[a-zA-Z_]\w*/.test(u.value)){e.advance();let s=u.value;u.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()),jt(wt(a),l)}return e.reset(o),null}isStructuralKeyword(e){return new Set(["into","in","to","from","at","by","with","without","before","after","of","as","on","then","end","else","if","repeat","while","for","toggle","add","remove","put","set","show","hide","increment","decrement","send","trigger","call"]).has(e.toLowerCase())}tryMatchMethodCallExpression(e){let 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 o=e.peek();if(!o||o.kind!=="punctuation"||o.value!=="(")return e.reset(i),null;e.advance();let u=[];for(;!e.isAtEnd()&&u.length<ot.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}u.push(l.value),e.advance();}return {type:"expression",raw:`${t.value}.${a.value}(${u.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 o=`${t.value}.${a.value}`,u=1;for(;!e.isAtEnd()&&u<ot.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(),o+=`.${c.value}`,u++;}let s=e.peek();if(s&&s.kind==="punctuation"&&s.value==="("){e.advance();let l=[],c=0;for(;!e.isAtEnd()&&l.length<ot.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:`${o}(${l.join(", ")})`}}return {type:"expression",raw:o}}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(),jt($t(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 o=n.value.slice(1);return jt($t(t.value),o)}matchGroupToken(e,t,i,n){let a=e.mark(),o=new Set(i.keys());if(this.matchTokenSequence(e,t.tokens,i,n))return true;e.reset(a);for(let l of i.keys())o.has(l)||i.delete(l);if(!t.optional)return false;let s=this.getGroupLeadingMarker(t);if(s)for(let l=1;l<=ot.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 m=0;m<l;m++)e.advance();if(this.matchTokenSequence(e,t.tokens,i,n))return true;e.reset(a);for(let m of i.keys())o.has(m)||i.delete(m);break}}return true}getGroupLeadingMarker(e){let t=e.tokens[0];return t?.type==="literal"?t.value.toLowerCase():null}getMatchType(e,t){return e.value===t?"exact":e.normalized===t?"normalized":e.stem===t&&e.stemConfidence!==void 0&&e.stemConfidence>=.7?"stem":e.kind==="keyword"&&this.safeToLowerCase(e.value)===t.toLowerCase()?"case-insensitive":"none"}collectStopMarkers(e,t){let 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 o of a.alternatives)i.add(o.toLowerCase());break}if(a.type==="group"){for(let o of a.tokens)if(o.type==="literal"){if(i.add(o.value.toLowerCase()),o.alternatives)for(let u of o.alternatives)i.add(u.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 $t(e.value);case "literal":return this.parseLiteralValue(e.value);case "keyword":let t=e.normalized||e.value;this.safeToLowerCase(t);return Te(e.normalized||e.value);case "identifier":if(typeof e.value=="string"&&e.value.startsWith(":"))return wt(e.value);this.safeToLowerCase(e.value);return {type:"expression",raw:e.value};case "url":return Te(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 Te(n,"string")}if(e==="true")return Te(true,"boolean");if(e==="false")return Te(false,"boolean");let t=e.match(/^(\d+(?:\.\d+)?)(ms|s|m|h)?$/);if(t){let n=parseFloat(t[1]);return t[2]?Te(e,"duration"):Te(n,"number")}let i=parseFloat(e);return isNaN(i)?Te(e,"string"):Te(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 p=a(c.role),d=.8;n+=d,t.has(c.role)?i+=d:p&&(i+=d*.6);}}let o=n>0?i/n:1;if(this.stemMatchCount>0&&this.totalKeywordMatches>0){let l=this.stemMatchCount/this.totalKeywordMatches*.15;o=Math.max(.5,o-l);}let u=this.calculateVSOConfidenceBoost(e);o=Math.min(1,o+u);let s=this.arabicPrepositionDisambiguation(e,t);return o=Math.max(0,Math.min(1,o+s)),o}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,o]of t.entries()){let u=n[a];if(!u||u.length===0)continue;let s="metadata"in o?o.metadata:void 0;if(s&&typeof s.prepositionValue=="string"){let l=s.prepositionValue;u.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(ot.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}};bt.MAX_MARKER_SCAN=3;bt.MAX_PROPERTY_DEPTH=10;bt.MAX_METHOD_ARGS=20;bt.ENGLISH_NOISE_WORDS=new Set(["the","a","an"]);var Za=bt;new Za;var We=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 o=r[e+t];if(/\d/.test(o))t++;else if(o==="."&&!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 o=r.slice(a),u=[{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 u)if(o.startsWith(l.pattern))return {value:n+l.suffix,length:t+l.pattern.length,metadata:{hasTimeUnit:true}};if(o.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(o.startsWith(l.pattern))return {value:n+l.suffix,length:t+1,metadata:{hasTimeUnit:true}};if(/^[smh](?![a-zA-Z])/.test(o))return {value:n+o[0],length:t+1,metadata:{hasTimeUnit:true}}}return {value:n,length:t}}};function Ya(r){return "setContext"in r&&typeof r.setContext=="function"}function Xa(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 me=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 ee(r,e){return {start:r,end:e}}function te(r,e,t,i){if(typeof r=="object"){let{value:a,kind:o,position:u,normalized:s,stem:l,stemConfidence:c,metadata:p}=r;return {value:a,kind:o,position:u,...s!==void 0&&{normalized:s},...l!==void 0&&{stem:l},...c!==void 0&&{stemConfidence:c},...p!==void 0&&{metadata:p}}}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:o,stemConfidence:u,metadata:s}=i;return {value:n,kind:e,position:t,...a!==void 0&&{normalized:a},...o!==void 0&&{stem:o},...u!==void 0&&{stemConfidence:u},...s!==void 0&&{metadata:s}}}return {value:n,kind:e,position:t}}function Ye(r){return /\s/.test(r)}function Ja(r){return r==="#"||r==="."||r==="["||r==="@"||r==="*"||r==="<"}function Qa(r){return r==='"'||r==="'"||r==="`"||r==="\u300C"||r==="\u300D"}function Ze(r){return /\d/.test(r)}function qt(r){return r.replace(/[\u064b-\u0652\u0670]/g,"")}function eo(r){return /[a-zA-Z]/.test(r)}function he(r){return /[a-zA-Z0-9_-]/.test(r)}function to(r,e){if(e>=r.length)return null;let t=r[e];if(!Ja(t))return null;let i=e,n="";if(t==="#"||t==="."){for(n+=r[i++];i<r.length&&he(r[i]);)n+=r[i++];if(n.length<=1)return null;if(i<r.length&&r[i]==="."&&t==="#"){let o=i+1;for(;o<r.length&&he(r[o]);)o++;if(o<r.length&&r[o]==="(")return n}}else if(t==="["){let a=1,o=false,u=null,s=false;for(n+=r[i++];i<r.length&&a>0;){let l=r[i];n+=l,s?s=false:l==="\\"?s=true:o?l===u&&(o=false,u=null):l==='"'||l==="'"||l==="`"?(o=true,u=l):l==="["?a++:l==="]"&&a--,i++;}if(a!==0)return null}else if(t==="@"){for(n+=r[i++];i<r.length&&he(r[i]);)n+=r[i++];if(n.length<=1)return null}else if(t==="*"){for(n+=r[i++];i<r.length&&he(r[i]);)n+=r[i++];if(n.length<=1)return null}else if(t==="<"){if(n+=r[i++],i>=r.length||!eo(r[i]))return null;for(;i<r.length&&he(r[i]);)n+=r[i++];for(;i<r.length;){let a=r[i];if(a==="."){if(n+=r[i++],i>=r.length||!he(r[i]))return null;for(;i<r.length&&he(r[i]);)n+=r[i++];}else if(a==="#"){if(n+=r[i++],i>=r.length||!he(r[i]))return null;for(;i<r.length&&he(r[i]);)n+=r[i++];}else if(a==="["){let o=1,u=false,s=null,l=false;for(n+=r[i++];i<r.length&&o>0;){let c=r[i];n+=c,l?l=false:c==="\\"?l=true:u?c===s&&(u=false,s=null):c==='"'||c==="'"||c==="`"?(u=true,s=c):c==="["?o++:c==="]"&&o--,i++;}if(o!==0)return null}else break}for(;i<r.length&&Ye(r[i]);)n+=r[i++];if(i<r.length&&r[i]==="/")for(n+=r[i++];i<r.length&&Ye(r[i]);)n+=r[i++];if(i>=r.length||r[i]!==">")return null;n+=r[i++];}return n||null}function ro(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 Ye(i)||i==="*"||!he(i)}function io(r,e){if(e>=r.length)return null;let t=r[e];if(!Qa(t)||t==="'"&&ro(r,e))return null;let n={'"':'"',"'":"'","`":"`","\u300C":"\u300D"}[t];if(!n)return null;let a=e+1,o=t,u=false;for(;a<r.length;){let s=r[a];if(o+=s,u)u=false;else if(s==="\\")u=true;else if(s===n)return o;a++;}return o}function no(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 ao(r,e){if(!no(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 oo(r,e){if(e>=r.length)return null;let t=r[e];if(!Ze(t)&&t!=="-"&&t!=="+")return null;let i=e,n="";if((r[i]==="-"||r[i]==="+")&&(n+=r[i++]),i>=r.length||!Ze(r[i]))return null;for(;i<r.length&&Ze(r[i]);)n+=r[i++];if(i<r.length&&r[i]===".")for(n+=r[i++];i<r.length&&Ze(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 uo=["===","!==","->","==","!=","<=",">=","&&","||","**","+=","-=","*=","/=","+","-","*","/","=",">","<","!","&","|","%","^","~"];new Set(uo);var so=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 lo(r){return r.includes("-")&&/^[\p{L}\p{N}_]+(-[\p{L}\p{N}_]+)+$/u.test(r)}var co=["click","dblclick","input","change","submit","keydown","keyup","keypress","mousedown","mouseup","mouseover","mouseout","mouseenter","mouseleave","mousemove","pointerdown","pointerup","pointermove","focus","blur","load","resize","scroll"],Vt=class Wt{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){Ya(e)&&e.setContext(Xa(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&&Ye(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 o of this.extractors)if(o.canExtract(e,i)){let u=o.extract(e,i);if(u){let s=u.metadata?.normalized,l=u.metadata?.stem,c=u.metadata?.stemConfidence,p={};if(u.metadata)for(let[m,f]of Object.entries(u.metadata))m!=="normalized"&&m!=="stem"&&m!=="stemConfidence"&&(p[m]=f);let d={};s&&(d.normalized=s),l&&(d.stem=l),c!==void 0&&(d.stemConfidence=c),Object.keys(p).length>0&&(d.metadata=p),t.push(te(u.value,this.classifyToken(u.value),ee(i,i+u.length),Object.keys(d).length>0?d:void 0)),i+=u.length,a=true;break}}if(!a){let o=e[i],u=this.classifyUnknownChar(o);t.push(te(o,u,ee(i,i+1))),i++;}}return new me(this.mergeColonQualifiedNames(t),this.language)}mergeColonQualifiedNames(e){let t=[];for(let i of e){let n=t[t.length-1];if(n&&Wt.ASCII_WORD.test(n.value)&&Wt.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),ee(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",ee(t,t+1))),true;let s=t+1;for(;s<e.length&&he(e[s]);)s++;return s<e.length&&e[s]==="("?(i.push(te(".","operator",ee(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 o of a.alternatives)i.set(o,{native:o,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 o of a.alternatives)i.set(o,{native:o,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 co)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(" ")||lo(n.native))&&!so.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 qt(e)}tryProfileKeyword(e,t){for(let i of this.profileKeywords)if(e.slice(t).startsWith(i.native))return te(i.native,"keyword",ee(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 o=e[t+a.native.length];if(!(o!==void 0&&i(o)))return te(a.native,"keyword",ee(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 o=e[t+a.native.length];return o===void 0||!i(o)})}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 o={normalized:a.normalized,stem:n.stem,stemConfidence:n.confidence};return te(e,"keyword",ee(t,i),o)}trySelector(e,t){let i=to(e,t);return i?te(i,"selector",ee(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],o=i[1];return {...te(n,"event-modifier",ee(t,t+n.length)),metadata:{modifierName:a,value:o?a==="queue"?o:parseInt(o,10):void 0}}}tryString(e,t){let i=io(e,t);return i?te(i,"literal",ee(t,t+i.length)):null}tryNumber(e,t){let i=oo(e,t);return i?te(i,"literal",ee(t,t+i.length)):null}tryMatchTimeUnit(e,t,i,n=false){let a=t;if(n)for(;a<e.length&&Ye(e[a]);)a++;let o=e.slice(a);for(let u of i){let s=o.slice(0,u.length);if(u.caseInsensitive?s.toLowerCase()===u.pattern.toLowerCase():s===u.pattern){if(u.notFollowedBy&&(o[u.length]||"")===u.notFollowedBy)continue;if(u.checkBoundary){let c=o[u.length]||"";if(he(c))continue}return {suffix:u.suffix,endPos:a+u.length}}}return null}parseBaseNumber(e,t,i=true){let n=t,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,t,i,n={}){let{allowSign:a=true,skipWhitespace:o=false}=n,u=this.parseBaseNumber(e,t,a);if(!u)return null;let{number:s,endPos:l}=u,c=[...i,...Wt.STANDARD_TIME_UNITS],p=this.tryMatchTimeUnit(e,l,c,o);return p&&(s+=p.suffix,l=p.endPos),te(s,"literal",ee(t,l))}tryUrl(e,t){let i=ao(e,t);return i?te(i,"url",ee(t,t+i.length)):null}tryVariableRef(e,t){if(e[t]!==":"||t+1>=e.length||!he(e[t+1]))return null;let i=t+1;for(;i<e.length&&he(e[i]);)i++;let n=e.slice(t,i);return te(n,"identifier",ee(t,i))}tryOperator(e,t){let i=e.slice(t,t+2);if(["==","!=","<=",">=","&&","||","->"].includes(i))return te(i,"operator",ee(t,t+2));let n=e[t];return ["<",">","!","+","-","*","/","="].includes(n)?te(n,"operator",ee(t,t+1)):["(",")","{","}",",",";",":"].includes(n)?te(n,"punctuation",ee(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",ee(t,t+n.length));return null}};Vt.ASCII_WORD=/^[A-Za-z_][A-Za-z0-9_]*$/;Vt.COLON_QUALIFIER=/^:[A-Za-z_][A-Za-z0-9_]*$/;Vt.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 Ve=Vt;function De(r){return {stem:r,confidence:1}}function se(r,e,t){return t?{stem:r,confidence:e,metadata:t}:{stem:r,confidence:e}}var di=class{constructor(r){this.language=r.language,this.config={minWordLength:3,minStemLength:2,...r};}normalize(r){let e=r.toLowerCase();if(this.isAlreadyNormalized(e))return De(r);if(this.config.reflexiveSuffixes){let t=this.tryReflexiveNormalization(e);if(t)return t}if(this.config.endings){let t=this.tryConjugationEndings(e);if(t)return t}if(this.config.suffixRules){let t=this.trySuffixRules(e);if(t)return t}if(this.config.prefixRules){let t=this.tryPrefixRules(e);if(t)return t}return De(r)}isAlreadyNormalized(r){return this.config.infinitiveEndings?this.config.infinitiveEndings.some(e=>r.endsWith(e)):false}tryReflexiveNormalization(r){let e=this.config.reflexiveSuffixes;if(!e)return null;for(let t of e){if(!r.endsWith(t))continue;let i=r.slice(0,-t.length);if(this.isAlreadyNormalized(i))return se(i,.88,{removedSuffixes:[t],conjugationType:"reflexive"});let n=this.tryConjugationEndings(i)||this.trySuffixRules(i);if(n&&n.stem!==i)return se(n.stem,n.confidence*.95,{removedSuffixes:[t,...n.metadata?.removedSuffixes||[]],conjugationType:"reflexive"})}return null}tryConjugationEndings(r){let e=this.config.endings;if(!e)return null;let t=this.config.minStemLength??2;for(let i of e){if(!r.endsWith(i.ending))continue;let n=r.slice(0,-i.ending.length);if(n.length<t)continue;let a=n+i.stem;return se(a,i.confidence,{removedSuffixes:[i.ending],conjugationType:i.type})}return null}trySuffixRules(r){let e=this.config.suffixRules;if(!e)return null;let t=this.config.minStemLength??2;for(let i of e){if(!r.endsWith(i.pattern))continue;let n=r.slice(0,-i.pattern.length),a=i.minStemLength??t;if(n.length<a)continue;let o=n+(i.replacement||"");return se(o,i.confidence,{removedSuffixes:[i.pattern],...i.conjugationType&&{conjugationType:i.conjugationType}})}return null}tryPrefixRules(r){let e=this.config.prefixRules;if(!e)return null;for(let t of e){if(!r.startsWith(t.pattern))continue;let i=r.slice(t.pattern.length),n=t.minRemaining??this.config.minStemLength??2;if(!(i.length<n))return se(i,1-t.confidencePenalty,{removedPrefixes:[t.pattern]})}return null}};var po=Object.defineProperty,mo=Object.getOwnPropertyNames,en=(r,e)=>function(){return r&&(e=(0, r[mo(r)[0]])(r=0)),e},fo=(r,e)=>{for(var t in e)po(r,t,{get:e[t],enumerable:true});};function mi(r,e){return r.replace(/\{(\w+)\}/g,(t,i)=>String(e[i]??`{${i}}`))}function we(r,e,t={},i){let n=tn[r],a=mi(n,t),o=rn[r],u=o?mi(o,t):void 0;return {code:r,message:a,severity:e,...i&&{role:i},...u&&{suggestion:u}}}var O,tn,rn,yo=en({"src/generators/schema-error-codes.ts"(){O={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"},tn={[O.AMBIGUOUS_TYPE_LITERAL_SELECTOR]:"Role '{role}' accepts both 'literal' and 'selector'. This may cause ambiguous type inference for values starting with special characters (* . # etc.).",[O.TOO_MANY_EXPECTED_TYPES]:"Role '{role}' accepts {count} different types. This may make type inference unreliable.",[O.MULTI_TYPE_PATIENT_EXPECTED]:"Role '{role}' accepts multiple types (expected for {command} command).",[O.NO_REQUIRED_ROLES]:"Command has no required roles. Is this intentional?",[O.NO_REQUIRED_ROLES_EXPECTED]:"Command has no required roles (expected for {command}).",[O.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.",[O.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.",[O.EVENT_HANDLER_MISSING_EVENT]:"Event handler command should have an 'event' role to specify which event to listen for.",[O.EVENT_HANDLER_EVENT_NOT_REQUIRED]:"Event role should be required - every event handler needs an event to listen for.",[O.CONDITIONAL_MISSING_CONDITION]:"Conditional command should have a 'condition' role for the boolean expression.",[O.CONDITIONAL_CONDITION_NOT_REQUIRED]:"Condition role should be required - conditionals need a condition to evaluate.",[O.FOR_LOOP_MISSING_SOURCE]:"For-loop should have a 'source' role for the collection to iterate over.",[O.WHILE_LOOP_MISSING_CONDITION]:"While-loop should have a 'condition' role for the loop condition.",[O.VALUE_TYPE_MISMATCH]:"Role '{role}' of command '{command}' expects type [{expectedTypes}], got '{actualType}'.",[O.SELECTOR_KIND_MISMATCH]:"Role '{role}' of command '{command}' expects selector kind [{selectorKinds}], got '{actualKind}'.",[O.SELECTOR_KINDS_WITHOUT_SELECTOR_TYPE]:"Role '{role}' has selectorKinds but expectedTypes does not include 'selector'.",[O.KEYWORD_COLLISION]:"Keyword '{keyword}' is used by multiple commands: {commands}. Only the first-registered command will be reachable."},rn={[O.AMBIGUOUS_TYPE_LITERAL_SELECTOR]:"Consider being more specific about which type is expected, or use explicit type markers.",[O.TOO_MANY_EXPECTED_TYPES]:"Consider narrowing the accepted types to improve type inference reliability.",[O.TRANSITION_PATIENT_ACCEPTS_SELECTOR]:"Remove 'selector' from expectedTypes and only accept 'literal'.",[O.TRANSITION_MISSING_GOAL]:"Add a 'goal' role with expectedTypes ['literal', 'variable'].",[O.EVENT_HANDLER_MISSING_EVENT]:"Add an 'event' role with expectedTypes ['literal'].",[O.EVENT_HANDLER_EVENT_NOT_REQUIRED]:"Set required: true on the 'event' role.",[O.CONDITIONAL_MISSING_CONDITION]:"Add a 'condition' role with expectedTypes ['expression'].",[O.CONDITIONAL_CONDITION_NOT_REQUIRED]:"Set required: true on the 'condition' role.",[O.FOR_LOOP_MISSING_SOURCE]:"Add a 'source' role for the collection to iterate over.",[O.WHILE_LOOP_MISSING_CONDITION]:"Add a 'condition' role for the loop continuation condition.",[O.VALUE_TYPE_MISMATCH]:"Ensure the value matches one of the expected types: [{expectedTypes}].",[O.SELECTOR_KIND_MISMATCH]:"Use a selector of the correct kind: [{selectorKinds}].",[O.SELECTOR_KINDS_WITHOUT_SELECTOR_TYPE]:"Either add 'selector' to expectedTypes or remove selectorKinds.",[O.KEYWORD_COLLISION]:"Give each command a unique keyword. Move the shared keyword to alternatives on one command, or use a more specific translation."};}}),nn={};fo(nn,{SchemaErrorCodes:()=>O,formatValidationResults:()=>wo,getValidationStats:()=>bo,validateAllKeywordCollisions:()=>xo,validateAllSchemas:()=>zo,validateCommandSchema:()=>an,validateKeywordCollisions:()=>on,validateRoleValues:()=>Co});function vo(r,e){return {action:r,items:e}}function an(r){let e=[];for(let i of r.roles)i.expectedTypes.includes("literal")&&i.expectedTypes.includes("selector")&&(i.role==="patient"&&br.has(r.action)?e.push(we(O.MULTI_TYPE_PATIENT_EXPECTED,"note",{role:i.role,command:r.action},i.role)):e.push(we(O.AMBIGUOUS_TYPE_LITERAL_SELECTOR,"warning",{role:i.role},i.role))),i.expectedTypes.length>3&&!br.has(r.action)&&e.push(we(O.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(we(O.SELECTOR_KINDS_WITHOUT_SELECTOR_TYPE,"warning",{role:i.role},i.role)));switch(r.action){case "transition":ho(r,e);break;case "on":Eo(r,e);break;case "if":case "unless":go(r,e);break;case "repeat":case "for":case "while":ko(r,e);break}return r.roles.filter(i=>i.required).length===0&&(un.has(r.action)?e.push(we(O.NO_REQUIRED_ROLES_EXPECTED,"note",{command:r.action})):e.push(we(O.NO_REQUIRED_ROLES,"warning",{}))),vo(r.action,e)}function ho(r,e){let t=r.roles.find(n=>n.role==="patient"),i=r.roles.find(n=>n.role==="goal");t&&!i&&e.push(we(O.TRANSITION_MISSING_GOAL,"error",{}));}function Eo(r,e){let t=r.roles.find(i=>i.role==="event");t||e.push(we(O.EVENT_HANDLER_MISSING_EVENT,"warning",{})),t&&!t.required&&e.push(we(O.EVENT_HANDLER_EVENT_NOT_REQUIRED,"warning",{}));}function go(r,e){let t=r.roles.find(i=>i.role==="condition");t||e.push(we(O.CONDITIONAL_MISSING_CONDITION,"warning",{})),t&&!t.required&&e.push(we(O.CONDITIONAL_CONDITION_NOT_REQUIRED,"warning",{}));}function ko(r,e){r.action==="for"?r.roles.find(i=>i.role==="source")||e.push(we(O.FOR_LOOP_MISSING_SOURCE,"warning",{})):r.action==="while"&&(r.roles.find(i=>i.role==="condition")||e.push(we(O.WHILE_LOOP_MISSING_CONDITION,"warning",{})));}function zo(r,e={}){let t=new Map,{includeNotes:i=false}=e;for(let[n,a]of Object.entries(r)){let o=an(a),u=o.items.some(l=>l.severity==="warning"||l.severity==="error"),s=i&&o.items.some(l=>l.severity==="note");(u||s)&&t.set(n,o);}return t}function wo(r,e={}){let t=[],{showNotes:i=false,showCodes:n=true}=e;for(let[a,o]of r){let u=o.items.filter(c=>c.severity==="error"),s=o.items.filter(c=>c.severity==="warning"),l=o.items.filter(c=>c.severity==="note");if(u.length>0){t.push(` \u274C ${a}:`);for(let c of u){let p=n?` [${c.code}]`:"";t.push(` ERROR${p}: ${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 p=n?` [${c.code}]`:"";t.push(` ${p?`${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 p=n?` [${c.code}]`:"";t.push(` ${p?`${c.code}: `:""}${c.message}`);}}}return t.join(`
2
- `)}function bo(r){let e=0,t=0,i=0,n={};for(let a of r.values())for(let o of a.items)o.severity==="error"?e++:o.severity==="warning"?t++:o.severity==="note"&&i++,n[o.code]=(n[o.code]||0)+1;return {totalCommands:r.size,errors:e,warnings:t,notes:i,byCode:n}}function Co(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:O.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:O.SELECTOR_KIND_MISMATCH})));}return t}function Ao(r){if(r.length!==2)return false;let[e,t]=[...r].sort();return sn.some(([i,n])=>i===e&&n===t)}function on(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 o=t.get(a.primary)||[];if(o.push({command:n,isPrimary:true}),t.set(a.primary,o),a.alternatives)for(let u of a.alternatives){let s=t.get(u)||[];s.push({command:n,isPrimary:false}),t.set(u,s);}}for(let[n,a]of t){let o=[...new Set(a.map(l=>l.command))];if(o.length<=1||Ao(o))continue;let u=a.filter(l=>l.isPrimary).length,s;u>=2?s="primary-primary":u===1?s="primary-alternative":s="alternative-alternative",e.push({keyword:n,commands:o.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 xo(r){let e=[];for(let[,t]of Object.entries(r)){let i=on(t);i.collisions.length>0&&e.push(i);}return e.sort((t,i)=>t.language.localeCompare(i.language))}var br,un,sn,Do=en({"src/generators/schema-validator.ts"(){yo(),br=new Set(["put","append","prepend","log","throw","make","measure","return","swap","morph","beep","copy"]),un=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"]),sn=[["change","changes"]];}});function So(){return [{id:"toggle-bn-full",language:"bn",command:"toggle",priority:100,template:{format:"{patient} \u0995\u09C7 \u099F\u0997\u09B2 \u0995\u09B0\u09C1\u09A8",tokens:[{type:"role",role:"patient"},{type:"literal",value:"\u0995\u09C7"},{type:"literal",value:"\u099F\u0997\u09B2",alternatives:["\u09AA\u09B0\u09BF\u09AC\u09B0\u09CD\u09A4\u09A8"]},{type:"literal",value:"\u0995\u09B0\u09C1\u09A8"}]},extraction:{patient:{position:0}}},{id:"toggle-bn-simple",language:"bn",command:"toggle",priority:90,template:{format:"\u099F\u0997\u09B2 {patient}",tokens:[{type:"literal",value:"\u099F\u0997\u09B2",alternatives:["\u09AA\u09B0\u09BF\u09AC\u09B0\u09CD\u09A4\u09A8"]},{type:"role",role:"patient"}]},extraction:{patient:{position:1}}},{id:"toggle-bn-with-dest",language:"bn",command:"toggle",priority:95,template:{format:"{destination} \u098F {patient} \u0995\u09C7 \u099F\u0997\u09B2 \u0995\u09B0\u09C1\u09A8",tokens:[{type:"role",role:"destination"},{type:"literal",value:"\u098F",alternatives:["\u09A4\u09C7"]},{type:"role",role:"patient"},{type:"literal",value:"\u0995\u09C7"},{type:"literal",value:"\u099F\u0997\u09B2",alternatives:["\u09AA\u09B0\u09BF\u09AC\u09B0\u09CD\u09A4\u09A8"]},{type:"literal",value:"\u0995\u09B0\u09C1\u09A8"}]},extraction:{destination:{position:0},patient:{position:2}}}]}function Bo(){return [{id:"toggle-en-full",language:"en",command:"toggle",priority:100,template:{format:"toggle {patient} on {target}",tokens:[{type:"literal",value:"toggle"},{type:"role",role:"patient"},{type:"group",optional:true,tokens:[{type:"literal",value:"on",alternatives:["from"]},{type:"role",role:"destination"}]}]},extraction:{patient:{position:1},destination:{marker:"on",markerAlternatives:["from"],default:{type:"reference",value:"me"}}}},{id:"toggle-en-simple",language:"en",command:"toggle",priority:90,template:{format:"toggle {patient}",tokens:[{type:"literal",value:"toggle"},{type:"role",role:"patient"}]},extraction:{patient:{position:1},destination:{default:{type:"reference",value:"me"}}}}]}function To(){return [{id:"toggle-es-full",language:"es",command:"toggle",priority:100,template:{format:"alternar {patient} en {target}",tokens:[{type:"literal",value:"alternar",alternatives:["cambiar","toggle"]},{type:"role",role:"patient"},{type:"group",optional:true,tokens:[{type:"literal",value:"en",alternatives:["sobre","de"]},{type:"role",role:"destination"}]}]},extraction:{patient:{position:1},destination:{marker:"en",markerAlternatives:["sobre","de"],default:{type:"reference",value:"me"}}}},{id:"toggle-es-simple",language:"es",command:"toggle",priority:90,template:{format:"alternar {patient}",tokens:[{type:"literal",value:"alternar",alternatives:["cambiar","toggle"]},{type:"role",role:"patient"}]},extraction:{patient:{position:1},destination:{default:{type:"reference",value:"me"}}}}]}function Fo(){return [{id:"toggle-hi-full",language:"hi",command:"toggle",priority:100,template:{format:"{patient} \u0915\u094B {destination} \u092A\u0930 \u091F\u0949\u0917\u0932 \u0915\u0930\u0947\u0902",tokens:[{type:"role",role:"patient"},{type:"literal",value:"\u0915\u094B"},{type:"role",role:"destination"},{type:"literal",value:"\u092A\u0930"},{type:"literal",value:"\u091F\u0949\u0917\u0932",alternatives:["\u092C\u0926\u0932\u0947\u0902","\u092C\u0926\u0932"]},{type:"group",optional:true,tokens:[{type:"literal",value:"\u0915\u0930\u0947\u0902",alternatives:["\u0915\u0930\u094B"]}]}]},extraction:{patient:{position:0},destination:{marker:"\u0915\u094B",position:2}}},{id:"toggle-hi-simple",language:"hi",command:"toggle",priority:90,template:{format:"{patient} \u091F\u0949\u0917\u0932 \u0915\u0930\u0947\u0902",tokens:[{type:"role",role:"patient"},{type:"literal",value:"\u091F\u0949\u0917\u0932",alternatives:["\u092C\u0926\u0932\u0947\u0902","\u092C\u0926\u0932"]},{type:"group",optional:true,tokens:[{type:"literal",value:"\u0915\u0930\u0947\u0902",alternatives:["\u0915\u0930\u094B"]}]}]},extraction:{patient:{position:0},destination:{default:{type:"reference",value:"me"}}}},{id:"toggle-hi-bare",language:"hi",command:"toggle",priority:80,template:{format:"\u091F\u0949\u0917\u0932 {patient}",tokens:[{type:"literal",value:"\u091F\u0949\u0917\u0932",alternatives:["\u092C\u0926\u0932\u0947\u0902","\u092C\u0926\u0932"]},{type:"role",role:"patient"}]},extraction:{patient:{position:1},destination:{default:{type:"reference",value:"me"}}}}]}function Po(){return [{id:"toggle-it-full",language:"it",command:"toggle",priority:100,template:{format:"commutare {patient} su {target}",tokens:[{type:"literal",value:"commutare",alternatives:["alternare","toggle","cambiare"]},{type:"role",role:"patient"},{type:"group",optional:true,tokens:[{type:"literal",value:"su",alternatives:["in","di"]},{type:"role",role:"destination"}]}]},extraction:{patient:{position:1},destination:{marker:"su",markerAlternatives:["in","di"],default:{type:"reference",value:"me"}}}},{id:"toggle-it-simple",language:"it",command:"toggle",priority:90,template:{format:"commutare {patient}",tokens:[{type:"literal",value:"commutare",alternatives:["alternare","toggle","cambiare"]},{type:"role",role:"patient"}]},extraction:{patient:{position:1},destination:{default:{type:"reference",value:"me"}}}}]}function Ro(){return [{id:"toggle-pl-full",language:"pl",command:"toggle",priority:100,template:{format:"prze\u0142\u0105cz {patient} na {destination}",tokens:[{type:"literal",value:"prze\u0142\u0105cz",alternatives:["przelacz","prze\u0142\u0105czaj"]},{type:"role",role:"patient"},{type:"group",optional:true,tokens:[{type:"literal",value:"na",alternatives:["w","dla"]},{type:"role",role:"destination"}]}]},extraction:{patient:{position:1},destination:{marker:"na",markerAlternatives:["w","dla"],default:{type:"reference",value:"me"}}}},{id:"toggle-pl-simple",language:"pl",command:"toggle",priority:90,template:{format:"prze\u0142\u0105cz {patient}",tokens:[{type:"literal",value:"prze\u0142\u0105cz",alternatives:["przelacz","prze\u0142\u0105czaj"]},{type:"role",role:"patient"}]},extraction:{patient:{position:1},destination:{default:{type:"reference",value:"me"}}}}]}function Oo(){return [{id:"toggle-qu-sov",language:"qu",command:"toggle",priority:100,template:{format:"{patient} ta t'ikray",tokens:[{type:"role",role:"patient"},{type:"literal",value:"ta"},{type:"literal",value:"t'ikray",alternatives:["tikray","kutichiy"]}]},extraction:{patient:{position:0}}},{id:"toggle-qu-simple",language:"qu",command:"toggle",priority:90,template:{format:"t'ikray {patient}",tokens:[{type:"literal",value:"t'ikray",alternatives:["tikray","kutichiy"]},{type:"role",role:"patient"}]},extraction:{patient:{position:1}}},{id:"toggle-qu-with-dest",language:"qu",command:"toggle",priority:95,template:{format:"{destination} pi {patient} ta t'ikray",tokens:[{type:"role",role:"destination"},{type:"literal",value:"pi"},{type:"role",role:"patient"},{type:"literal",value:"ta"},{type:"literal",value:"t'ikray",alternatives:["tikray","kutichiy"]}]},extraction:{destination:{position:0},patient:{position:2}}},{id:"toggle-qu-dest-man",language:"qu",command:"toggle",priority:93,template:{format:"{destination} man {patient} ta t'ikray",tokens:[{type:"role",role:"destination"},{type:"literal",value:"man"},{type:"role",role:"patient"},{type:"literal",value:"ta"},{type:"literal",value:"t'ikray",alternatives:["tikray","kutichiy"]}]},extraction:{destination:{position:0},patient:{position:2}}},{id:"toggle-qu-patient-first-dest",language:"qu",command:"toggle",priority:102,template:{format:"{patient} ta {destination} man t'ikray",tokens:[{type:"role",role:"patient"},{type:"literal",value:"ta"},{type:"role",role:"destination"},{type:"literal",value:"man",alternatives:["pa"]},{type:"literal",value:"t'ikray",alternatives:["tikray","kutichiy"]}]},extraction:{patient:{position:0},destination:{position:2}}}]}function Lo(){return [{id:"toggle-ru-full",language:"ru",command:"toggle",priority:100,template:{format:"\u043F\u0435\u0440\u0435\u043A\u043B\u044E\u0447\u0438\u0442\u044C {patient} \u043D\u0430 {destination}",tokens:[{type:"literal",value:"\u043F\u0435\u0440\u0435\u043A\u043B\u044E\u0447\u0438\u0442\u044C",alternatives:["\u043F\u0435\u0440\u0435\u043A\u043B\u044E\u0447\u0438"]},{type:"role",role:"patient"},{type:"group",optional:true,tokens:[{type:"literal",value:"\u043D\u0430",alternatives:["\u0432","\u0434\u043B\u044F"]},{type:"role",role:"destination"}]}]},extraction:{patient:{position:1},destination:{marker:"\u043D\u0430",markerAlternatives:["\u0432","\u0434\u043B\u044F"],default:{type:"reference",value:"me"}}}},{id:"toggle-ru-simple",language:"ru",command:"toggle",priority:90,template:{format:"\u043F\u0435\u0440\u0435\u043A\u043B\u044E\u0447\u0438\u0442\u044C {patient}",tokens:[{type:"literal",value:"\u043F\u0435\u0440\u0435\u043A\u043B\u044E\u0447\u0438\u0442\u044C",alternatives:["\u043F\u0435\u0440\u0435\u043A\u043B\u044E\u0447\u0438"]},{type:"role",role:"patient"}]},extraction:{patient:{position:1},destination:{default:{type:"reference",value:"me"}}}}]}function No(){return [{id:"toggle-th-simple",language:"th",command:"toggle",priority:90,template:{format:"\u0E2A\u0E25\u0E31\u0E1A {patient}",tokens:[{type:"literal",value:"\u0E2A\u0E25\u0E31\u0E1A"},{type:"role",role:"patient"}]},extraction:{patient:{position:1}}},{id:"toggle-th-with-dest",language:"th",command:"toggle",priority:95,template:{format:"\u0E2A\u0E25\u0E31\u0E1A {patient} \u0E43\u0E19 {destination}",tokens:[{type:"literal",value:"\u0E2A\u0E25\u0E31\u0E1A"},{type:"role",role:"patient"},{type:"literal",value:"\u0E43\u0E19"},{type:"role",role:"destination"}]},extraction:{patient:{position:1},destination:{marker:"\u0E43\u0E19",position:3}}}]}function Mo(){return [{id:"toggle-uk-full",language:"uk",command:"toggle",priority:100,template:{format:"\u043F\u0435\u0440\u0435\u043C\u043A\u043D\u0443\u0442\u0438 {patient} \u043D\u0430 {destination}",tokens:[{type:"literal",value:"\u043F\u0435\u0440\u0435\u043C\u043A\u043D\u0443\u0442\u0438",alternatives:["\u043F\u0435\u0440\u0435\u043C\u043A\u043D\u0438"]},{type:"role",role:"patient"},{type:"group",optional:true,tokens:[{type:"literal",value:"\u043D\u0430",alternatives:["\u0432","\u0434\u043B\u044F"]},{type:"role",role:"destination"}]}]},extraction:{patient:{position:1},destination:{marker:"\u043D\u0430",markerAlternatives:["\u0432","\u0434\u043B\u044F"],default:{type:"reference",value:"me"}}}},{id:"toggle-uk-simple",language:"uk",command:"toggle",priority:90,template:{format:"\u043F\u0435\u0440\u0435\u043C\u043A\u043D\u0443\u0442\u0438 {patient}",tokens:[{type:"literal",value:"\u043F\u0435\u0440\u0435\u043C\u043A\u043D\u0443\u0442\u0438",alternatives:["\u043F\u0435\u0440\u0435\u043C\u043A\u043D\u0438"]},{type:"role",role:"patient"}]},extraction:{patient:{position:1},destination:{default:{type:"reference",value:"me"}}}}]}function _o(){return [{id:"toggle-vi-full",language:"vi",command:"toggle",priority:100,template:{format:"chuy\u1EC3n \u0111\u1ED5i {patient} tr\xEAn {target}",tokens:[{type:"literal",value:"chuy\u1EC3n \u0111\u1ED5i",alternatives:["chuy\u1EC3n","b\u1EADt t\u1EAFt"]},{type:"role",role:"patient"},{type:"group",optional:true,tokens:[{type:"literal",value:"tr\xEAn",alternatives:["t\u1EA1i","\u1EDF"]},{type:"role",role:"destination"}]}]},extraction:{patient:{position:1},destination:{marker:"tr\xEAn",markerAlternatives:["t\u1EA1i","\u1EDF"],default:{type:"reference",value:"me"}}}},{id:"toggle-vi-simple",language:"vi",command:"toggle",priority:90,template:{format:"chuy\u1EC3n \u0111\u1ED5i {patient}",tokens:[{type:"literal",value:"chuy\u1EC3n \u0111\u1ED5i",alternatives:["chuy\u1EC3n","b\u1EADt t\u1EAFt"]},{type:"role",role:"patient"}]},extraction:{patient:{position:1},destination:{default:{type:"reference",value:"me"}}}}]}function Io(){return [{id:"toggle-zh-full",language:"zh",command:"toggle",priority:100,template:{format:"\u5207\u6362 {patient} \u5728 {target}",tokens:[{type:"literal",value:"\u5207\u6362"},{type:"role",role:"patient"},{type:"group",optional:true,tokens:[{type:"literal",value:"\u5728",alternatives:["\u5230","\u4E8E"]},{type:"role",role:"destination"}]}]},extraction:{patient:{position:1},destination:{marker:"\u5728",markerAlternatives:["\u5230","\u4E8E"],default:{type:"reference",value:"me"}}}},{id:"toggle-zh-simple",language:"zh",command:"toggle",priority:90,template:{format:"\u5207\u6362 {patient}",tokens:[{type:"literal",value:"\u5207\u6362"},{type:"role",role:"patient"}]},extraction:{patient:{position:1},destination:{default:{type:"reference",value:"me"}}}},{id:"toggle-zh-ba",language:"zh",command:"toggle",priority:95,template:{format:"\u628A {patient} \u5207\u6362",tokens:[{type:"literal",value:"\u628A"},{type:"role",role:"patient"},{type:"literal",value:"\u5207\u6362"}]},extraction:{patient:{marker:"\u628A"},destination:{default:{type:"reference",value:"me"}}}},{id:"toggle-zh-full-ba",language:"zh",command:"toggle",priority:98,template:{format:"\u5728 {target} \u628A {patient} \u5207\u6362",tokens:[{type:"literal",value:"\u5728",alternatives:["\u5230","\u4E8E"]},{type:"role",role:"destination"},{type:"literal",value:"\u628A"},{type:"role",role:"patient"},{type:"literal",value:"\u5207\u6362"}]},extraction:{destination:{marker:"\u5728",markerAlternatives:["\u5230","\u4E8E"]},patient:{marker:"\u628A"}}}]}function $o(r){switch(r){case "bn":return So();case "en":return Bo();case "es":return To();case "hi":return Fo();case "it":return Po();case "pl":return Ro();case "qu":return Oo();case "ru":return Lo();case "th":return No();case "uk":return Mo();case "vi":return _o();case "zh":return Io();default:return []}}function jo(r){return []}function et(r){let e=r.roles.find(t=>t.role==="destination");return e?{destination:e.default?{fromRole:"destination",default:e.default}:{fromRole:"destination"}}:{}}function tt(r){let e=r.roles.find(t=>t.role==="source");return e?{source:e.default?{fromRole:"source",default:e.default}:{fromRole:"source"}}:{}}function rt(r,e){return Or(r,e,"source")}function Rr(r,e){return Or(r,e,"destination")}function Wo(r,e){return Or(r,e,"patient")}function Or(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 re=["selector","reference","expression"],qo={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:re,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)"}},Vo={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"}},Ko={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:re,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"}},Lr={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"}},Nr={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>"}},Ho={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>"}},Uo={action:"live",description:"Reactive block: re-run the body when its dependencies change",category:"control-flow",primaryRole:"patient",hasBody:true,bareKeyword:true,roles:[]},Go={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}]},Zo={action:"eventsource",description:"Open a Server-Sent Events stream and handle its events",category:"async",primaryRole:"patient",hasBody:true,bareKeyword:true,roles:[]},Yo={action:"socket",description:"Open a WebSocket and handle its messages",category:"async",primaryRole:"patient",hasBody:true,bareKeyword:true,roles:[]},Xo={action:"worker",description:"Define a Web Worker with inline methods",category:"async",primaryRole:"patient",hasBody:true,bareKeyword:true,roles:[]},Jo={action:"intercept",description:"Service-worker fetch interception / caching strategies",category:"async",primaryRole:"patient",hasBody:true,bareKeyword:true,roles:[]},ln={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:re,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}]},cn={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:re,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}]},Qo={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"]}]},eu={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:re,default:{type:"reference",value:"me"},svoPosition:2,sovPosition:1}]},tu={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}]},ru={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}]},iu={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"}}]},nu={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"}}]},au={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"}}]},ou={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"}}]},uu={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}]},pn={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}]},su={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:re,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"}}]},lu={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}]},cu={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}]},pu={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:re,default:{type:"reference",value:"me"},svoPosition:1,sovPosition:1}]},du={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}]},mu={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"}}]},fu={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}]},yu={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}]},vu={action:"else",description:"Else branch of conditional",category:"control-flow",primaryRole:"patient",hasBody:true,roles:[]},hu={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"'},Eu={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"}}]},gu={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}]},ku={action:"continue",description:"Continue to next loop iteration",category:"control-flow",primaryRole:"patient",ast:{},roles:[]},rr={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"},zu=Object.fromEntries(Object.keys(rr).map(r=>[r,"in new"])),wu={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",...re],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:zu}],rolePrefixLiteralVariants:[{role:"destination",literal:rr,idSuffix:"url",priorityDelta:5,methodCarrier:"method"}]},bu={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}]},Cu={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"}}]},Au={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:re,default:{type:"reference",value:"me"},svoPosition:1,sovPosition:1}]},xu={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:re,default:{type:"reference",value:"me"},svoPosition:1,sovPosition:1}]},Du={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:re,default:{type:"reference",value:"me"},svoPosition:1,sovPosition:1}]},Su={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:re,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"}}]},Bu={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:re,default:{type:"reference",value:"me"},svoPosition:1,sovPosition:1}]},Tu={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:re,default:{type:"reference",value:"me"},svoPosition:1,sovPosition:1}]},Fu={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}]},Pu={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:re,default:{type:"reference",value:"me"},svoPosition:1,sovPosition:1}]},Ru={action:"breakpoint",description:"Drop into the debugger",category:"control-flow",primaryRole:"patient",roles:[],bareKeyword:true},Ou={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}]},Lu={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}]},Nu={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}]},Mu={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:re,svoPosition:1,sovPosition:1,markerOverride:{en:"",he:"\u05D0\u05EA",zh:"\u628A"}}]},_u={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"}}]},Iu={action:"init",description:"Initialization block that runs once",category:"control-flow",primaryRole:"patient",ast:{},hasBody:true,roles:[]},$u={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}]},ju={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}]},Wu={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:re,default:{type:"reference",value:"me"},svoPosition:2,sovPosition:2,markerOverride:{en:"of"}}]},qu={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"},Mr={role:"manner",description:"Run the swap inside a `document.startViewTransition()` (`using view transition`)",required:false,expectedTypes:["literal","expression"],valueShape:"keyword",markerOverride:qu},Vu={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:re,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"}},{...Mr,svoPosition:4,sovPosition:4}]},Ku={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:re,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"}},{...Mr,svoPosition:3,sovPosition:3}]},Hu={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}]},Uu={action:"break",description:"Exit from the current loop",category:"control-flow",primaryRole:"patient",roles:[]},Gu={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}]},Zu={action:"exit",description:"Exit from the current event handler",category:"control-flow",primaryRole:"patient",roles:[],bareKeyword:true},Yu={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}]},Xu={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"}}]},Ju={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"},Qu={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:rr}]},es={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:rr}]},ts={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:Ju},{...Mr,svoPosition:2,sovPosition:2}]},rs={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:qo,add:Vo,remove:Ko,put:Lr,set:Nr,show:ln,hide:cn,on:Qo,trigger:eu,wait:tu,fetch:ru,increment:iu,decrement:nu,append:au,prepend:ou,log:uu,get:pn,take:su,make:lu,halt:cu,settle:pu,throw:du,send:mu,if:fu,unless:yu,else:vu,repeat:hu,for:Eu,while:gu,continue:ku,go:wu,scroll:Xu,push:Qu,replace:es,process:ts,transition:bu,clone:Cu,focus:Au,blur:xu,empty:Du,open:Su,close:Bu,select:Tu,clear:Fu,reset:Pu,breakpoint:Ru,call:Ou,return:Lu,js:Nu,tell:Mu,default:_u,init:Iu,behavior:$u,install:ju,measure:Wu,swap:Vu,morph:Ku,beep:Hu,break:Uu,copy:Gu,exit:Zu,pick:Yu,render:rs,bind:Ho,live:Uo,when:Go,eventsource:Zo,socket:Yo,worker:Xo,intercept:Jo,compound:{action:"compound",description:"A compound node representing chained statements",primaryRole:"patient",category:"control-flow",hasBody:true,roles:[]}};function ue(r){return le[r]}function is(){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(()=>(Do(),nn)).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(`
3
- These warnings help identify potential schema design issues.`),console.warn("Fix them to improve type inference and avoid runtime bugs."));}).catch(r=>{console.debug("Schema validation skipped:",r);});var Tt=[...Lr.roles.find(r=>r.role==="destination")?.expectedTypes??[]],yr=[...Lr.roles.find(r=>r.role==="patient")?.expectedTypes??[]];function ns(){return [{id:"put-bn-before",language:"bn",command:"put",priority:105,template:{format:"{patient} before {destination} \u0995\u09C7 \u09B0\u09BE\u0996\u09C1\u09A8",tokens:[{type:"role",role:"patient"},{type:"literal",value:"before"},{type:"role",role:"destination"},{type:"literal",value:"\u0995\u09C7"},{type:"literal",value:"\u09B0\u09BE\u0996\u09C1\u09A8",alternatives:["\u09B0\u09BE\u0996"]}]},extraction:{patient:{position:0},destination:{marker:"before"},manner:{default:{type:"literal",value:"before"}}}},{id:"put-bn-after",language:"bn",command:"put",priority:105,template:{format:"{patient} after {destination} \u0995\u09C7 \u09B0\u09BE\u0996\u09C1\u09A8",tokens:[{type:"role",role:"patient"},{type:"literal",value:"after"},{type:"role",role:"destination"},{type:"literal",value:"\u0995\u09C7"},{type:"literal",value:"\u09B0\u09BE\u0996\u09C1\u09A8",alternatives:["\u09B0\u09BE\u0996"]}]},extraction:{patient:{position:0},destination:{marker:"after"},manner:{default:{type:"literal",value:"after"}}}},{id:"put-bn-full",language:"bn",command:"put",priority:100,template:{format:"{patient} \u0995\u09C7 {destination} \u098F \u09B0\u09BE\u0996\u09C1\u09A8",tokens:[{type:"role",role:"patient"},{type:"literal",value:"\u0995\u09C7"},{type:"role",role:"destination"},{type:"literal",value:"\u098F",alternatives:["\u09A4\u09C7"]},{type:"literal",value:"\u09B0\u09BE\u0996\u09C1\u09A8",alternatives:["\u09B0\u09BE\u0996"]}]},extraction:{patient:{position:0},destination:{marker:"\u098F",position:2}}},{id:"put-bn-simple",language:"bn",command:"put",priority:90,template:{format:"\u09B0\u09BE\u0996\u09C1\u09A8 {patient} {destination} \u098F",tokens:[{type:"literal",value:"\u09B0\u09BE\u0996\u09C1\u09A8",alternatives:["\u09B0\u09BE\u0996"]},{type:"role",role:"patient"},{type:"role",role:"destination"},{type:"literal",value:"\u098F",alternatives:["\u09A4\u09C7"]}]},extraction:{patient:{position:1},destination:{position:2}}}]}function as(){return [{id:"put-en-into",language:"en",command:"put",priority:100,template:{format:"put {patient} into {destination}",tokens:[{type:"literal",value:"put"},{type:"role",role:"patient"},{type:"literal",value:"into",alternatives:["in","to"]},{type:"role",role:"destination"}]},extraction:{patient:{position:1},destination:{marker:"into",markerAlternatives:["in","to"]}}},{id:"put-en-before",language:"en",command:"put",priority:95,template:{format:"put {patient} before {destination}",tokens:[{type:"literal",value:"put"},{type:"role",role:"patient"},{type:"literal",value:"before"},{type:"role",role:"destination"}]},extraction:{patient:{position:1},destination:{marker:"before"},manner:{default:{type:"literal",value:"before"}}}},{id:"put-en-after",language:"en",command:"put",priority:95,template:{format:"put {patient} after {destination}",tokens:[{type:"literal",value:"put"},{type:"role",role:"patient"},{type:"literal",value:"after"},{type:"role",role:"destination"}]},extraction:{patient:{position:1},destination:{marker:"after"},manner:{default:{type:"literal",value:"after"}}}},{id:"put-en-at-end",language:"en",command:"put",priority:96,template:{format:"put {patient} at end of {destination}",tokens:[{type:"literal",value:"put"},{type:"role",role:"patient"},{type:"literal",value:"at"},{type:"literal",value:"end"},{type:"literal",value:"of"},{type:"role",role:"destination"}]},extraction:{patient:{position:1},destination:{position:5},manner:{default:{type:"literal",value:"at end of"}}}},{id:"put-en-at-start",language:"en",command:"put",priority:96,template:{format:"put {patient} at start of {destination}",tokens:[{type:"literal",value:"put"},{type:"role",role:"patient"},{type:"literal",value:"at"},{type:"literal",value:"start"},{type:"literal",value:"of"},{type:"role",role:"destination"}]},extraction:{patient:{position:1},destination:{position:5},manner:{default:{type:"literal",value:"at start of"}}}}]}function os(){return [{id:"put-es-full",language:"es",command:"put",priority:100,template:{format:"poner {patient} en {destination}",tokens:[{type:"literal",value:"poner",alternatives:["pon","colocar","put"]},{type:"role",role:"patient"},{type:"literal",value:"en",alternatives:["dentro de","a"]},{type:"role",role:"destination"}]},extraction:{patient:{position:1},destination:{marker:"en",markerAlternatives:["dentro de","a"]}}},{id:"put-es-before",language:"es",command:"put",priority:95,template:{format:"poner {patient} antes de {destination}",tokens:[{type:"literal",value:"poner",alternatives:["pon","colocar"]},{type:"role",role:"patient"},{type:"literal",value:"antes de",alternatives:["antes"]},{type:"role",role:"destination"}]},extraction:{patient:{position:1},destination:{marker:"antes de",markerAlternatives:["antes"]},manner:{default:{type:"literal",value:"before"}}}},{id:"put-es-after",language:"es",command:"put",priority:95,template:{format:"poner {patient} despu\xE9s de {destination}",tokens:[{type:"literal",value:"poner",alternatives:["pon","colocar"]},{type:"role",role:"patient"},{type:"literal",value:"despu\xE9s de",alternatives:["despues de","despu\xE9s"]},{type:"role",role:"destination"}]},extraction:{patient:{position:1},destination:{marker:"despu\xE9s de",markerAlternatives:["despues de","despu\xE9s"]},manner:{default:{type:"literal",value:"after"}}}}]}function us(){return [{id:"put-hi-before",language:"hi",command:"put",priority:106,template:{format:"{patient} before {destination} \u0915\u094B \u0930\u0916\u0947\u0902",tokens:[{type:"role",role:"patient"},{type:"literal",value:"before"},{type:"role",role:"destination"},{type:"literal",value:"\u0915\u094B"},{type:"literal",value:"\u0930\u0916\u0947\u0902",alternatives:["\u0930\u0916","\u0921\u093E\u0932\u0947\u0902","\u0921\u093E\u0932"]}]},extraction:{patient:{position:0},destination:{marker:"before"},manner:{default:{type:"literal",value:"before"}}}},{id:"put-hi-after",language:"hi",command:"put",priority:106,template:{format:"{patient} after {destination} \u0915\u094B \u0930\u0916\u0947\u0902",tokens:[{type:"role",role:"patient"},{type:"literal",value:"after"},{type:"role",role:"destination"},{type:"literal",value:"\u0915\u094B"},{type:"literal",value:"\u0930\u0916\u0947\u0902",alternatives:["\u0930\u0916","\u0921\u093E\u0932\u0947\u0902","\u0921\u093E\u0932"]}]},extraction:{patient:{position:0},destination:{marker:"after"},manner:{default:{type:"literal",value:"after"}}}},{id:"put-hi-verb-medial",language:"hi",command:"put",priority:105,template:{format:"{patient} \u0915\u094B \u0930\u0916\u0947\u0902 {destination} \u092E\u0947\u0902",tokens:[{type:"role",role:"patient"},{type:"literal",value:"\u0915\u094B"},{type:"literal",value:"\u0930\u0916\u0947\u0902",alternatives:["\u0930\u0916","\u0921\u093E\u0932\u0947\u0902","\u0921\u093E\u0932"]},{type:"role",role:"destination"},{type:"literal",value:"\u092E\u0947\u0902"}]},extraction:{patient:{position:0},destination:{marker:"\u092E\u0947\u0902",position:3}}},{id:"put-hi-full",language:"hi",command:"put",priority:100,template:{format:"{patient} \u0915\u094B {destination} \u092E\u0947\u0902 \u0930\u0916\u0947\u0902",tokens:[{type:"role",role:"patient"},{type:"literal",value:"\u0915\u094B"},{type:"role",role:"destination"},{type:"literal",value:"\u092E\u0947\u0902"},{type:"literal",value:"\u0930\u0916\u0947\u0902",alternatives:["\u0930\u0916","\u0921\u093E\u0932\u0947\u0902","\u0921\u093E\u0932"]}]},extraction:{patient:{position:0},destination:{marker:"\u092E\u0947\u0902",position:3}}},{id:"put-hi-simple",language:"hi",command:"put",priority:90,template:{format:"{patient} \u0930\u0916\u0947\u0902",tokens:[{type:"role",role:"patient"},{type:"literal",value:"\u0930\u0916\u0947\u0902",alternatives:["\u0930\u0916","\u0921\u093E\u0932\u0947\u0902","\u0921\u093E\u0932"]}]},extraction:{patient:{position:0},destination:{default:{type:"reference",value:"me"}}}},{id:"put-hi-bare",language:"hi",command:"put",priority:80,template:{format:"\u0930\u0916\u0947\u0902 {patient}",tokens:[{type:"literal",value:"\u0930\u0916\u0947\u0902",alternatives:["\u0930\u0916","\u0921\u093E\u0932\u0947\u0902","\u0921\u093E\u0932"]},{type:"role",role:"patient"}]},extraction:{patient:{position:1},destination:{default:{type:"reference",value:"me"}}}}]}function ss(){return [{id:"put-id-full",language:"id",command:"put",priority:100,template:{format:"taruh {patient} ke dalam {destination}",tokens:[{type:"literal",value:"taruh",alternatives:["letakkan","masukkan","tempatkan","put"]},{type:"role",role:"patient",expectedTypes:yr},{type:"literal",value:"ke"},{type:"literal",value:"dalam",alternatives:["di"]},{type:"role",role:"destination",expectedTypes:Tt}]},extraction:{patient:{position:1},destination:{position:4}}},{id:"put-id-simple-ke",language:"id",command:"put",priority:95,template:{format:"taruh {patient} ke {destination}",tokens:[{type:"literal",value:"taruh",alternatives:["letakkan","masukkan","tempatkan"]},{type:"role",role:"patient",expectedTypes:yr},{type:"literal",value:"ke",alternatives:["di","pada"]},{type:"role",role:"destination",expectedTypes:Tt}]},extraction:{patient:{position:1},destination:{position:3}}},{id:"put-id-di",language:"id",command:"put",priority:90,template:{format:"taruh {patient} di {destination}",tokens:[{type:"literal",value:"taruh",alternatives:["letakkan","masukkan"]},{type:"role",role:"patient",expectedTypes:yr},{type:"literal",value:"di"},{type:"role",role:"destination",expectedTypes:Tt}]},extraction:{patient:{position:1},destination:{position:3}}}]}function ls(){return [{id:"put-it-full",language:"it",command:"put",priority:100,template:{format:"mettere {patient} in {target}",tokens:[{type:"literal",value:"mettere",alternatives:["metti","inserire","put"]},{type:"role",role:"patient"},{type:"group",optional:true,tokens:[{type:"literal",value:"in",alternatives:["dentro","nel"]},{type:"role",role:"destination"}]}]},extraction:{patient:{position:1},destination:{marker:"in",markerAlternatives:["dentro","nel"]}}},{id:"put-it-before",language:"it",command:"put",priority:105,template:{format:"mettere {patient} prima {target}",tokens:[{type:"literal",value:"mettere",alternatives:["metti","inserire","put"]},{type:"role",role:"patient"},{type:"literal",value:"prima"},{type:"role",role:"destination"}]},extraction:{patient:{position:1},destination:{marker:"prima"},manner:{default:{type:"literal",value:"before"}}}},{id:"put-it-after",language:"it",command:"put",priority:105,template:{format:"mettere {patient} dopo {target}",tokens:[{type:"literal",value:"mettere",alternatives:["metti","inserire","put"]},{type:"role",role:"patient"},{type:"literal",value:"dopo"},{type:"role",role:"destination"}]},extraction:{patient:{position:1},destination:{marker:"dopo"},manner:{default:{type:"literal",value:"after"}}}},{id:"put-it-simple",language:"it",command:"put",priority:90,template:{format:"mettere {patient}",tokens:[{type:"literal",value:"mettere",alternatives:["metti","inserire","put"]},{type:"role",role:"patient"}]},extraction:{patient:{position:1}}}]}function cs(){return [{id:"put-pl-full",language:"pl",command:"put",priority:100,template:{format:"umie\u015B\u0107 {patient} w {destination}",tokens:[{type:"literal",value:"umie\u015B\u0107",alternatives:["umiesc","wstaw","w\u0142\xF3\u017C","wloz"]},{type:"role",role:"patient"},{type:"group",optional:true,tokens:[{type:"literal",value:"w",alternatives:["do","na"]},{type:"role",role:"destination"}]}]},extraction:{patient:{position:1},destination:{marker:"w",markerAlternatives:["do","na"]}}},{id:"put-pl-before",language:"pl",command:"put",priority:105,template:{format:"umie\u015B\u0107 {patient} przed {destination}",tokens:[{type:"literal",value:"umie\u015B\u0107",alternatives:["umiesc","wstaw"]},{type:"role",role:"patient"},{type:"literal",value:"przed"},{type:"role",role:"destination"}]},extraction:{patient:{position:1},destination:{marker:"przed"},manner:{default:{type:"literal",value:"before"}}}},{id:"put-pl-after",language:"pl",command:"put",priority:105,template:{format:"umie\u015B\u0107 {patient} po {destination}",tokens:[{type:"literal",value:"umie\u015B\u0107",alternatives:["umiesc","wstaw"]},{type:"role",role:"patient"},{type:"literal",value:"po"},{type:"role",role:"destination"}]},extraction:{patient:{position:1},destination:{marker:"po"},manner:{default:{type:"literal",value:"after"}}}}]}function ps(){return [{id:"put-ru-full",language:"ru",command:"put",priority:100,template:{format:"\u043F\u043E\u043B\u043E\u0436\u0438\u0442\u044C {patient} \u0432 {destination}",tokens:[{type:"literal",value:"\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"]},{type:"role",role:"patient"},{type:"group",optional:true,tokens:[{type:"literal",value:"\u0432",alternatives:["\u0432\u043E","\u043D\u0430"]},{type:"role",role:"destination"}]}]},extraction:{patient:{position:1},destination:{marker:"\u0432",markerAlternatives:["\u0432\u043E","\u043D\u0430"]}}},{id:"put-ru-before",language:"ru",command:"put",priority:105,template:{format:"\u043F\u043E\u043B\u043E\u0436\u0438\u0442\u044C {patient} \u043F\u0435\u0440\u0435\u0434 {destination}",tokens:[{type:"literal",value:"\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"]},{type:"role",role:"patient"},{type:"literal",value:"\u043F\u0435\u0440\u0435\u0434",alternatives:["\u0434\u043E"]},{type:"role",role:"destination"}]},extraction:{patient:{position:1},destination:{marker:"\u043F\u0435\u0440\u0435\u0434",markerAlternatives:["\u0434\u043E"]},manner:{default:{type:"literal",value:"before"}}}},{id:"put-ru-after",language:"ru",command:"put",priority:105,template:{format:"\u043F\u043E\u043B\u043E\u0436\u0438\u0442\u044C {patient} \u043F\u043E\u0441\u043B\u0435 {destination}",tokens:[{type:"literal",value:"\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"]},{type:"role",role:"patient"},{type:"literal",value:"\u043F\u043E\u0441\u043B\u0435"},{type:"role",role:"destination"}]},extraction:{patient:{position:1},destination:{marker:"\u043F\u043E\u0441\u043B\u0435"},manner:{default:{type:"literal",value:"after"}}}}]}function ds(){return [{id:"put-th-full",language:"th",command:"put",priority:100,template:{format:"\u0E43\u0E2A\u0E48 {patient} \u0E43\u0E19 {destination}",tokens:[{type:"literal",value:"\u0E43\u0E2A\u0E48",alternatives:["\u0E27\u0E32\u0E07"]},{type:"role",role:"patient"},{type:"literal",value:"\u0E43\u0E19"},{type:"role",role:"destination"}]},extraction:{patient:{position:1},destination:{marker:"\u0E43\u0E19",position:3}}},{id:"put-th-before",language:"th",command:"put",priority:105,template:{format:"\u0E43\u0E2A\u0E48 {patient} \u0E01\u0E48\u0E2D\u0E19 {destination}",tokens:[{type:"literal",value:"\u0E43\u0E2A\u0E48",alternatives:["\u0E27\u0E32\u0E07"]},{type:"role",role:"patient"},{type:"literal",value:"\u0E01\u0E48\u0E2D\u0E19"},{type:"role",role:"destination"}]},extraction:{patient:{position:1},destination:{marker:"\u0E01\u0E48\u0E2D\u0E19"},manner:{default:{type:"literal",value:"before"}}}},{id:"put-th-after",language:"th",command:"put",priority:105,template:{format:"\u0E43\u0E2A\u0E48 {patient} \u0E2B\u0E25\u0E31\u0E07 {destination}",tokens:[{type:"literal",value:"\u0E43\u0E2A\u0E48",alternatives:["\u0E27\u0E32\u0E07"]},{type:"role",role:"patient"},{type:"literal",value:"\u0E2B\u0E25\u0E31\u0E07"},{type:"role",role:"destination"}]},extraction:{patient:{position:1},destination:{marker:"\u0E2B\u0E25\u0E31\u0E07"},manner:{default:{type:"literal",value:"after"}}}}]}function ms(){return [{id:"put-uk-full",language:"uk",command:"put",priority:100,template:{format:"\u043F\u043E\u043A\u043B\u0430\u0441\u0442\u0438 {patient} \u0432 {destination}",tokens:[{type:"literal",value:"\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"]},{type:"role",role:"patient"},{type:"group",optional:true,tokens:[{type:"literal",value:"\u0432",alternatives:["\u0443","\u043D\u0430"]},{type:"role",role:"destination"}]}]},extraction:{patient:{position:1},destination:{marker:"\u0432",markerAlternatives:["\u0443","\u043D\u0430"]}}},{id:"put-uk-before",language:"uk",command:"put",priority:105,template:{format:"\u043F\u043E\u043A\u043B\u0430\u0441\u0442\u0438 {patient} \u043F\u0435\u0440\u0435\u0434 {destination}",tokens:[{type:"literal",value:"\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"]},{type:"role",role:"patient"},{type:"literal",value:"\u043F\u0435\u0440\u0435\u0434",alternatives:["\u0434\u043E"]},{type:"role",role:"destination"}]},extraction:{patient:{position:1},destination:{marker:"\u043F\u0435\u0440\u0435\u0434",markerAlternatives:["\u0434\u043E"]},manner:{default:{type:"literal",value:"before"}}}},{id:"put-uk-after",language:"uk",command:"put",priority:105,template:{format:"\u043F\u043E\u043A\u043B\u0430\u0441\u0442\u0438 {patient} \u043F\u0456\u0441\u043B\u044F {destination}",tokens:[{type:"literal",value:"\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"]},{type:"role",role:"patient"},{type:"literal",value:"\u043F\u0456\u0441\u043B\u044F"},{type:"role",role:"destination"}]},extraction:{patient:{position:1},destination:{marker:"\u043F\u0456\u0441\u043B\u044F"},manner:{default:{type:"literal",value:"after"}}}}]}function fs(){return [{id:"put-vi-into",language:"vi",command:"put",priority:100,template:{format:"\u0111\u1EB7t {patient} v\xE0o {target}",tokens:[{type:"literal",value:"\u0111\u1EB7t",alternatives:["\u0111\u1EC3","\u0111\u01B0a"]},{type:"role",role:"patient"},{type:"literal",value:"v\xE0o",alternatives:["v\xE0o trong"]},{type:"role",role:"destination"}]},extraction:{patient:{position:1},destination:{marker:"v\xE0o",markerAlternatives:["v\xE0o trong"]}}},{id:"put-vi-before",language:"vi",command:"put",priority:105,template:{format:"\u0111\u1EB7t {patient} tr\u01B0\u1EDBc {target}",tokens:[{type:"literal",value:"\u0111\u1EB7t",alternatives:["\u0111\u1EC3","\u0111\u01B0a"]},{type:"role",role:"patient"},{type:"literal",value:"tr\u01B0\u1EDBc",alternatives:["tr\u01B0\u1EDBc khi"]},{type:"role",role:"destination"}]},extraction:{patient:{position:1},destination:{marker:"tr\u01B0\u1EDBc",markerAlternatives:["tr\u01B0\u1EDBc khi"]},manner:{default:{type:"literal",value:"before"}}}},{id:"put-vi-after",language:"vi",command:"put",priority:105,template:{format:"\u0111\u1EB7t {patient} sau {target}",tokens:[{type:"literal",value:"\u0111\u1EB7t",alternatives:["\u0111\u1EC3","\u0111\u01B0a"]},{type:"role",role:"patient"},{type:"literal",value:"sau",alternatives:["sau khi"]},{type:"role",role:"destination"}]},extraction:{patient:{position:1},destination:{marker:"sau",markerAlternatives:["sau khi"]},manner:{default:{type:"literal",value:"after"}}}}]}function ys(){return [...["before","after"].map(r=>{let e=r==="before"?"\xF1awpaqpi":"qhepapi";return {id:`put-qu-${r}`,language:"qu",command:"put",priority:105,template:{format:`{patient} ${e} {destination} ta churay`,tokens:[{type:"role",role:"patient"},{type:"literal",value:e,alternatives:[r]},{type:"role",role:"destination"},{type:"group",optional:true,tokens:[{type:"literal",value:"ta"}]},{type:"literal",value:"churay",alternatives:["tiyachiy"]}]},extraction:{patient:{position:0},destination:{position:2},manner:{default:{type:"literal",value:r}}}}}),{id:"put-qu-patient-first",language:"qu",command:"put",priority:96,template:{format:"{patient} ta {destination} man churay",tokens:[{type:"role",role:"patient"},{type:"literal",value:"ta"},{type:"role",role:"destination"},{type:"literal",value:"man"},{type:"literal",value:"churay",alternatives:["tiyachiy"]}]},extraction:{patient:{position:0},destination:{position:2}}}]}function vs(){return [{id:"put-zh-full",language:"zh",command:"put",priority:100,template:{format:"\u653E\u7F6E {patient} \u5230 {destination}",tokens:[{type:"literal",value:"\u653E\u7F6E",alternatives:["\u653E","\u653E\u5165","\u7F6E\u5165","put"]},{type:"role",role:"patient",expectedTypes:["literal","selector","reference","expression"]},{type:"literal",value:"\u5230",alternatives:["\u5728","\u4E8E","\u5165"]},{type:"role",role:"destination",expectedTypes:Tt}]},extraction:{patient:{position:1},destination:{position:3}}},{id:"put-zh-ba",language:"zh",command:"put",priority:95,template:{format:"\u628A {patient} \u653E\u7F6E \u5230 {destination}",tokens:[{type:"literal",value:"\u628A"},{type:"role",role:"patient",expectedTypes:["literal","selector","reference","expression"]},{type:"literal",value:"\u653E\u7F6E",alternatives:["\u653E\u5230","\u653E\u5728","\u653E\u5165","\u653E","\u7F6E\u5165"]},{type:"group",optional:true,tokens:[{type:"literal",value:"\u5230",alternatives:["\u5728","\u4E8E","\u5165"]}]},{type:"role",role:"destination",expectedTypes:Tt}]},extraction:{patient:{position:1},destination:{marker:"\u5230",markerAlternatives:["\u5728","\u4E8E","\u5165"]}}}]}var hs=[{lang:"ar",verb:"\u0636\u0639",verbAlts:["\u0627\u062C\u0639\u0644"],before:"\u0642\u0628\u0644",after:"\u0628\u0639\u062F"},{lang:"de",verb:"setzen",before:"vor",after:"nach"},{lang:"fr",verb:"mettre",before:"avant",after:"apr\xE8s"},{lang:"he",verb:"\u05E9\u05D9\u05DD",patientPrefix:"\u05D0\u05EA",before:"\u05DC\u05E4\u05E0\u05D9",after:"\u05D0\u05D7\u05E8\u05D9"},{lang:"id",verb:"taruh",verbAlts:["letakkan","masukkan","tempatkan"],before:"sebelum",after:"setelah"},{lang:"ms",verb:"letak",before:"sebelum",after:"selepas"},{lang:"pt",verb:"colocar",before:"antes",after:"depois"},{lang:"sw",verb:"weka",before:"kabla",after:"baada"},{lang:"tl",verb:"ilagay",verbAlts:["maglagay"],before:"bago",after:"matapos"},{lang:"zh",verb:"\u653E\u7F6E",verbAlts:["\u653E","\u653E\u5165"],patientPrefix:"\u628A",patientPrefixOptional:true,before:"\u4E4B\u524D",after:"\u4E4B\u540E"}],_r=[{lang:"es",verb:"poner",verbAlts:["pon","colocar","put"],at:"en",end:"fin",of:"de"},{lang:"fr",verb:"mettre",at:"\xE0",end:"fin",of:"de"},{lang:"pt",verb:"colocar",at:"em",end:"fim",of:"de"},{lang:"it",verb:"mettere",at:"a",end:"fine",of:"di"},{lang:"de",verb:"setzen",at:"bei",end:"ende",of:"von"},{lang:"sw",verb:"weka",at:"katika",end:"mwisho",of:"ya"},{lang:"id",verb:"taruh",verbAlts:["letakkan","masukkan","tempatkan"],at:"di",end:"akhir",of:"dari"},{lang:"ms",verb:"letak",at:"di",end:"tamat",of:"daripada"},{lang:"vi",verb:"\u0111\u1EB7t",at:"t\u1EA1i",end:"k\u1EBFt th\xFAc",of:"c\u1EE7a"},{lang:"pl",verb:"umie\u015B\u0107",at:"przy",end:"koniec",of:"z"},{lang:"ru",verb:"\u043F\u043E\u043B\u043E\u0436\u0438\u0442\u044C",at:"\u0443",end:"\u043A\u043E\u043D\u0435\u0446",of:"\u0438\u0437"},{lang:"uk",verb:"\u043F\u043E\u043A\u043B\u0430\u0441\u0442\u0438",at:"\u0432",end:"\u043A\u0456\u043D\u0435\u0446\u044C",of:"\u0437"},{lang:"th",verb:"\u0E43\u0E2A\u0E48",at:"\u0E17\u0E35\u0E48",end:"\u0E08\u0E1A",of:"\u0E02\u0E2D\u0E07"},{lang:"tl",verb:"ilagay",at:"sa",end:"wakas",of:"ng"},{lang:"ar",verb:"\u0636\u0639",at:"\u0639\u0646\u062F",end:"\u0627\u0644\u0646\u0647\u0627\u064A\u0629",of:"\u0645\u0646"},{lang:"zh",verb:"\u653E\u7F6E",verbAlts:["\u653E","\u653E\u5165"],patientPrefix:"\u628A",at:"\u5728",end:"\u7ED3\u675F",of:"\u7684"},{lang:"he",verb:"\u05E9\u05D9\u05DD",patientPrefix:"\u05D0\u05EA",at:"at",end:"\u05E1\u05D5\u05E3",of:"of"},{lang:"tr",verb:"koy",sov:true,objMarker:"i",at:"de",end:"son",of:"nin"},{lang:"ja",verb:"\u7F6E\u304F",sov:true,objMarker:"\u3092",at:"\u3067",end:"\u7D42\u308F\u308A",of:"\u306E"},{lang:"ko",verb:"\uB123\uB2E4",sov:true,objMarker:"\uB97C",at:"\uC5D0",end:"\uB05D",of:"\uC758"},{lang:"hi",verb:"\u0930\u0916\u0947\u0902",verbAlts:["\u0930\u0916","\u0921\u093E\u0932\u0947\u0902","\u0921\u093E\u0932"],sov:true,objMarker:"\u0915\u094B",at:"\u092A\u0930",end:"\u0938\u092E\u093E\u092A\u094D\u0924",of:"\u0915\u093E"},{lang:"bn",verb:"\u09B0\u09BE\u0996\u09C1\u09A8",verbAlts:["\u09B0\u09BE\u0996"],sov:true,objMarker:"\u0995\u09C7",at:"\u098F",end:"\u09B6\u09C7\u09B7",of:"\u09B0"},{lang:"qu",verb:"churay",sov:true,objMarker:"ta",at:"pi",end:"tukuy",of:"pa"}];function vr(r,e,t,i){let n=_r.find(o=>o.lang===r);if(!n)return false;let a=(o,u)=>(o??"").toLowerCase()===u.toLowerCase();return a(e,n.end)&&a(t,n.at)&&a(i,n.of)}function Es(r,e){let t=_r.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()}function gs(r){let e=_r.find(a=>a.lang===r);if(!e)return [];let t=[],i=e.verbAlts?{type:"literal",value:e.verb,alternatives:e.verbAlts}:{type:"literal",value:e.verb},n=a=>{t.push({type:"literal",value:a});};return e.sov?(t.push({type:"role",role:"patient"}),n(e.at),n(e.end),n(e.of),t.push({type:"role",role:"destination"}),e.objMarker&&t.push({type:"literal",value:e.objMarker}),t.push(i)):(t.push(i),e.patientPrefix&&t.push({type:"literal",value:e.patientPrefix}),t.push({type:"role",role:"patient"}),n(e.at),n(e.end),n(e.of),t.push({type:"role",role:"destination"})),[{id:`put-${e.lang}-at-end`,language:e.lang,command:"put",priority:110,template:{format:`put {patient} ${e.at} ${e.end} ${e.of} {destination}`,tokens:t},extraction:{manner:{default:{type:"literal",value:"at end of"}}}}]}function ks(){return ["before","after"].map(r=>{let e=r==="before"?"\u524D\u306B":"\u5F8C\u306B",t=r==="before"?"\u524D":"\u5F8C";return {id:`put-ja-${r}`,language:"ja",command:"put",priority:105,template:{format:`{patient} ${e} {destination} \u3092 \u7F6E\u304F`,tokens:[{type:"role",role:"patient"},{type:"literal",value:e,alternatives:[t]},{type:"role",role:"destination"},{type:"literal",value:"\u3092"},{type:"literal",value:"\u7F6E\u304F",alternatives:["\u5165\u308C\u308B"]}]},extraction:{patient:{position:0},destination:{position:2},manner:{default:{type:"literal",value:r}}}}})}function zs(){return ["before","after"].map(r=>{let e=r==="before"?"\uC804\uC5D0":"\uD6C4\uC5D0";return {id:`put-ko-${r}`,language:"ko",command:"put",priority:105,template:{format:`{patient} ${e} {destination} \uB97C \uB123\uB2E4`,tokens:[{type:"role",role:"patient"},{type:"literal",value:e},{type:"role",role:"destination"},{type:"literal",value:"\uB97C",alternatives:["\uC744"]},{type:"literal",value:"\uB123\uB2E4",alternatives:["\uB123\uAE30","\uB193\uAE30"]}]},extraction:{patient:{position:0},destination:{position:2},manner:{default:{type:"literal",value:r}}}}})}function ws(){let r=(e,t)=>({id:`put-tr-${e}`,language:"tr",command:"put",priority:105,template:{format:`{patient} ${t} {destination} i koy`,tokens:[{type:"role",role:"patient"},{type:"literal",value:t},{type:"role",role:"destination"},{type:"group",optional:true,tokens:[{type:"literal",value:"i",alternatives:["\u0131","u","\xFC","yi","y\u0131","yu","y\xFC"]}]},{type:"literal",value:"koy",alternatives:["koymak"]}]},extraction:{patient:{position:0},destination:{position:2},manner:{default:{type:"literal",value:e}}}});return [r("before","\xF6nce"),r("after","sonra")]}function bs(r){let e=hs.find(t=>t.lang===r);return e?["before","after"].map(t=>{let i=e[t],n=[e.verbAlts?{type:"literal",value:e.verb,alternatives:e.verbAlts}:{type:"literal",value:e.verb}];return e.patientPrefix&&n.push(e.patientPrefixOptional?{type:"group",optional:true,tokens:[{type:"literal",value:e.patientPrefix}]}:{type:"literal",value:e.patientPrefix}),n.push({type:"role",role:"patient"},{type:"literal",value:i},{type:"role",role:"destination"}),{id:`put-${e.lang}-${t}`,language:e.lang,command:"put",priority:105,template:{format:`${e.verb} {patient} ${i} {destination}`,tokens:n},extraction:{patient:{position:e.patientPrefix&&!e.patientPrefixOptional?2:1},destination:{marker:i},manner:{default:{type:"literal",value:t}}}}}):[]}function Cs(r){let e=bs(r),t=gs(r);switch(r){case "bn":return [...ns(),...t];case "en":return as();case "es":return [...os(),...t];case "hi":return [...us(),...t];case "id":return [...ss(),...e,...t];case "it":return [...ls(),...t];case "ja":return [...ks(),...t];case "ko":return [...zs(),...t];case "tr":return [...ws(),...t];case "pl":return [...cs(),...t];case "ru":return [...ps(),...t];case "qu":return [...ys(),...t];case "th":return [...ds(),...t];case "uk":return [...ms(),...t];case "vi":return [...fs(),...t];case "zh":return [...vs(),...e,...t];default:return [...e,...t]}}var Re={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 dn(r,e){let t=Re[e];return t&&t[r]?t[r]:r.toLowerCase()}function As(r,e){let t=Re[e];return t?Object.keys(t).filter(i=>t[i]===r):[]}var xs=Object.fromEntries(Object.entries(Re).map(([r,e])=>{let t={};for(let[i,n]of Object.entries(e))n in t||(t[n]=i);return [r,t]})),Ds={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 mn(r,e){return Ds[e]?.has(r)?r:xs[e]?.[r]??r}function Ss(){return [{id:"event-handler-ko-sov",language:"ko",command:"on",priority:110,template:{format:"{event} \uD560 \uB54C",tokens:[{type:"role",role:"event",expectedTypes:["literal","expression"]},{type:"literal",value:"\uD560"},{type:"literal",value:"\uB54C"}]},extraction:{event:{position:0},source:{default:{type:"reference",value:"me"}}}},{id:"event-handler-ko-with-source",language:"ko",command:"on",priority:108,template:{format:"{source} \uC5D0\uC11C {event} \uD560 \uB54C",tokens:[{type:"role",role:"source",expectedTypes:["selector","reference","expression"]},{type:"literal",value:"\uC5D0\uC11C"},{type:"role",role:"event",expectedTypes:["literal","expression"]},{type:"literal",value:"\uD560"},{type:"literal",value:"\uB54C"}]},extraction:{source:{position:0},event:{position:2}}}]}function Bs(){return [{id:"event-handler-bn-sov",language:"bn",command:"on",priority:100,template:{format:"{event} \u09A4\u09C7 {action}",tokens:[{type:"role",role:"event"},{type:"literal",value:"\u09A4\u09C7",alternatives:["\u098F"]},{type:"role",role:"action"}]},extraction:{event:{position:0},action:{position:2}}},{id:"event-handler-bn-with-source",language:"bn",command:"on",priority:95,template:{format:"{source} \u09A5\u09C7\u0995\u09C7 {event} \u09A4\u09C7 {action}",tokens:[{type:"role",role:"source"},{type:"literal",value:"\u09A5\u09C7\u0995\u09C7"},{type:"role",role:"event"},{type:"literal",value:"\u09A4\u09C7",alternatives:["\u098F"]},{type:"role",role:"action"}]},extraction:{source:{position:0},event:{marker:"\u09A4\u09C7",position:2},action:{position:4}}},{id:"event-handler-bn-when",language:"bn",command:"on",priority:90,template:{format:"\u09AF\u0996\u09A8 {event} {action}",tokens:[{type:"literal",value:"\u09AF\u0996\u09A8"},{type:"role",role:"event"},{type:"role",role:"action"}]},extraction:{event:{position:1},action:{position:2}}}]}function Ts(){return [{id:"event-de-wenn-source",language:"de",command:"on",priority:115,template:{format:"wenn {event} von {source} {body}",tokens:[{type:"literal",value:"wenn",alternatives:["falls","sobald"]},{type:"role",role:"event"},{type:"literal",value:"von",alternatives:["aus"]},{type:"role",role:"source"}]},extraction:{event:{position:1},source:{marker:"von",markerAlternatives:["aus"]}}},{id:"event-de-wenn",language:"de",command:"on",priority:105,template:{format:"wenn {event} {body}",tokens:[{type:"literal",value:"wenn",alternatives:["falls","sobald"]},{type:"role",role:"event"}]},extraction:{event:{position:1}}},{id:"event-de-bei-source",language:"de",command:"on",priority:110,template:{format:"bei {event} von {source} {body}",tokens:[{type:"literal",value:"bei",alternatives:["beim"]},{type:"role",role:"event"},{type:"literal",value:"von",alternatives:["aus"]},{type:"role",role:"source"}]},extraction:{event:{position:1},source:{marker:"von",markerAlternatives:["aus"]}}},{id:"event-de-bei",language:"de",command:"on",priority:100,template:{format:"bei {event} {body}",tokens:[{type:"literal",value:"bei",alternatives:["beim"]},{type:"role",role:"event"}]},extraction:{event:{position:1}}},{id:"event-de-auf",language:"de",command:"on",priority:95,template:{format:"auf {event} {body}",tokens:[{type:"literal",value:"auf"},{type:"role",role:"event"}]},extraction:{event:{position:1}}},{id:"event-de-im-falle",language:"de",command:"on",priority:90,template:{format:"im Falle von {event} {body}",tokens:[{type:"literal",value:"im Falle von",alternatives:["im Fall von"]},{type:"role",role:"event"}]},extraction:{event:{position:1}}}]}function Fs(){return [{id:"event-en-source",language:"en",command:"on",priority:110,template:{format:"on {event} from {source} {body}",tokens:[{type:"literal",value:"on"},{type:"role",role:"event"},{type:"literal",value:"from"},{type:"role",role:"source"}]},extraction:{event:{position:1},source:{marker:"from"}}},{id:"event-en-standard",language:"en",command:"on",priority:100,template:{format:"on {event} {body}",tokens:[{type:"literal",value:"on"},{type:"role",role:"event"}]},extraction:{event:{position:1}}},{id:"event-en-upon",language:"en",command:"on",priority:98,template:{format:"upon {event} {body}",tokens:[{type:"literal",value:"upon"},{type:"role",role:"event"}]},extraction:{event:{position:1}}},{id:"event-en-if",language:"en",command:"on",priority:95,template:{format:"if {event} {body}",tokens:[{type:"literal",value:"if"},{type:"role",role:"event"}]},extraction:{event:{position:1}}}]}function Ps(){return [{id:"event-es-native-al-source",language:"es",command:"on",priority:115,template:{format:"al {event} en {source} {body}",tokens:[{type:"literal",value:"al"},{type:"role",role:"event"},{type:"literal",value:"en",alternatives:["de"]},{type:"role",role:"source"}]},extraction:{event:{position:1},source:{marker:"en",markerAlternatives:["de"]}}},{id:"event-es-cuando-source",language:"es",command:"on",priority:112,template:{format:"cuando {event} en {source} {body}",tokens:[{type:"literal",value:"cuando"},{type:"role",role:"event"},{type:"literal",value:"en",alternatives:["de"]},{type:"role",role:"source"}]},extraction:{event:{position:1},source:{marker:"en",markerAlternatives:["de"]}}},{id:"event-es-native-al",language:"es",command:"on",priority:108,template:{format:"al {event} {body}",tokens:[{type:"literal",value:"al"},{type:"role",role:"event"}]},extraction:{event:{position:1}}},{id:"event-es-standard",language:"es",command:"on",priority:100,template:{format:"en {event} {body}",tokens:[{type:"literal",value:"en",alternatives:["al","cuando"]},{type:"role",role:"event"}]},extraction:{event:{position:1}}},{id:"event-es-source",language:"es",command:"on",priority:110,template:{format:"en {event} desde {source} {body}",tokens:[{type:"literal",value:"en",alternatives:["al"]},{type:"role",role:"event"},{type:"literal",value:"desde",alternatives:["de"]},{type:"role",role:"source"}]},extraction:{event:{position:1},source:{marker:"desde",markerAlternatives:["de"]}}},{id:"event-es-when",language:"es",command:"on",priority:95,template:{format:"cuando {event} {body}",tokens:[{type:"literal",value:"cuando"},{type:"role",role:"event"}]},extraction:{event:{position:1}}},{id:"event-es-conditional-si",language:"es",command:"on",priority:85,template:{format:"si {event} {body}",tokens:[{type:"literal",value:"si"},{type:"role",role:"event"}]},extraction:{event:{position:1}}}]}function Rs(){return [{id:"event-fr-quand-source",language:"fr",command:"on",priority:115,template:{format:"quand {event} de {source} {body}",tokens:[{type:"literal",value:"quand",alternatives:["lorsque"]},{type:"role",role:"event"},{type:"literal",value:"de",alternatives:["depuis"]},{type:"role",role:"source"}]},extraction:{event:{position:1},source:{marker:"de",markerAlternatives:["depuis"]}}},{id:"event-fr-quand",language:"fr",command:"on",priority:105,template:{format:"quand {event} {body}",tokens:[{type:"literal",value:"quand",alternatives:["lorsque"]},{type:"role",role:"event"}]},extraction:{event:{position:1}}},{id:"event-fr-sur-source",language:"fr",command:"on",priority:110,template:{format:"sur {event} de {source} {body}",tokens:[{type:"literal",value:"sur",alternatives:["lors de"]},{type:"role",role:"event"},{type:"literal",value:"de",alternatives:["depuis"]},{type:"role",role:"source"}]},extraction:{event:{position:1},source:{marker:"de",markerAlternatives:["depuis"]}}},{id:"event-fr-sur",language:"fr",command:"on",priority:100,template:{format:"sur {event} {body}",tokens:[{type:"literal",value:"sur",alternatives:["lors de"]},{type:"role",role:"event"}]},extraction:{event:{position:1}}},{id:"event-fr-si",language:"fr",command:"on",priority:95,template:{format:"si {event} {body}",tokens:[{type:"literal",value:"si"},{type:"role",role:"event"}]},extraction:{event:{position:1}}},{id:"event-fr-a",language:"fr",command:"on",priority:90,template:{format:"\xE0 {event} {body}",tokens:[{type:"literal",value:"\xE0",alternatives:["au"]},{type:"role",role:"event"}]},extraction:{event:{position:1}}}]}function Os(){return [{id:"event-hi-standard",language:"hi",command:"on",priority:100,template:{format:"{event} \u092A\u0930",tokens:[{type:"role",role:"event"},{type:"literal",value:"\u092A\u0930",alternatives:["\u092E\u0947\u0902","\u091C\u092C"]}]},extraction:{event:{position:0}}},{id:"event-hi-with-source",language:"hi",command:"on",priority:95,template:{format:"{source} \u0938\u0947 {event} \u092A\u0930",tokens:[{type:"role",role:"source"},{type:"literal",value:"\u0938\u0947"},{type:"role",role:"event"},{type:"literal",value:"\u092A\u0930",alternatives:["\u092E\u0947\u0902","\u091C\u092C"]}]},extraction:{source:{position:0},event:{marker:"\u0938\u0947",position:2}}},{id:"event-hi-when",language:"hi",command:"on",priority:95,template:{format:"\u091C\u092C {event} {body}",tokens:[{type:"literal",value:"\u091C\u092C"},{type:"role",role:"event",expectedTypes:["reference","expression","selector"]}]},extraction:{event:{position:1}}},{id:"event-hi-bare",language:"hi",command:"on",priority:80,template:{format:"{event}",tokens:[{type:"role",role:"event"}]},extraction:{event:{position:0}}}]}function Ls(){return [{id:"event-id-ketika-source",language:"id",command:"on",priority:115,template:{format:"ketika {event} dari {source} {body}",tokens:[{type:"literal",value:"ketika",alternatives:["saat","waktu"]},{type:"role",role:"event"},{type:"literal",value:"dari"},{type:"role",role:"source"}]},extraction:{event:{position:1},source:{marker:"dari"}}},{id:"event-id-ketika",language:"id",command:"on",priority:105,template:{format:"ketika {event} {body}",tokens:[{type:"literal",value:"ketika",alternatives:["saat","waktu"]},{type:"role",role:"event"}]},extraction:{event:{position:1}}},{id:"event-id-pada-source",language:"id",command:"on",priority:110,template:{format:"pada {event} dari {source} {body}",tokens:[{type:"literal",value:"pada"},{type:"role",role:"event"},{type:"literal",value:"dari"},{type:"role",role:"source"}]},extraction:{event:{position:1},source:{marker:"dari"}}},{id:"event-id-pada",language:"id",command:"on",priority:100,template:{format:"pada {event} {body}",tokens:[{type:"literal",value:"pada"},{type:"role",role:"event"}]},extraction:{event:{position:1}}},{id:"event-id-jika",language:"id",command:"on",priority:95,template:{format:"jika {event} {body}",tokens:[{type:"literal",value:"jika",alternatives:["kalau","apabila"]},{type:"role",role:"event"}]},extraction:{event:{position:1}}},{id:"event-id-bila",language:"id",command:"on",priority:90,template:{format:"bila {event} {body}",tokens:[{type:"literal",value:"bila"},{type:"role",role:"event"}]},extraction:{event:{position:1}}}]}function Ns(){return [{id:"event-handler-it-full",language:"it",command:"on",priority:100,template:{format:"su {event} {action}",tokens:[{type:"literal",value:"su",alternatives:["quando","al","on"]},{type:"role",role:"event"},{type:"role",role:"action"}]},extraction:{event:{position:1},action:{position:2}}},{id:"event-handler-it-from",language:"it",command:"on",priority:95,template:{format:"su {event} da {source} {action}",tokens:[{type:"literal",value:"su",alternatives:["quando","al","on"]},{type:"role",role:"event"},{type:"literal",value:"da",alternatives:["di"]},{type:"role",role:"source"},{type:"role",role:"action"}]},extraction:{event:{position:1},source:{marker:"da",markerAlternatives:["di"]},action:{position:-1}}}]}function Ms(){return [{id:"event-ms-apabila",language:"ms",command:"on",priority:100,template:{format:"apabila {event} {body}",tokens:[{type:"literal",value:"apabila",alternatives:["bila","ketika"]},{type:"role",role:"event"}]},extraction:{event:{position:1}}},{id:"event-ms-apabila-source",language:"ms",command:"on",priority:110,template:{format:"apabila {event} dari {source} {body}",tokens:[{type:"literal",value:"apabila",alternatives:["bila","ketika"]},{type:"role",role:"event"},{type:"literal",value:"dari"},{type:"role",role:"source"}]},extraction:{event:{position:1},source:{marker:"dari"}}}]}function _s(){return [{id:"event-handler-pl-full",language:"pl",command:"on",priority:100,template:{format:"gdy {event} na {source}",tokens:[{type:"literal",value:"gdy",alternatives:["kiedy","przy","na"]},{type:"role",role:"event"},{type:"group",optional:true,tokens:[{type:"literal",value:"na",alternatives:["w","przy","z"]},{type:"role",role:"source"}]}]},extraction:{event:{position:1},source:{marker:"na",markerAlternatives:["w","przy","z"],default:{type:"reference",value:"me"}}}},{id:"event-handler-pl-simple",language:"pl",command:"on",priority:90,template:{format:"gdy {event}",tokens:[{type:"literal",value:"gdy",alternatives:["kiedy","przy","na"]},{type:"role",role:"event"}]},extraction:{event:{position:1},source:{default:{type:"reference",value:"me"}}}}]}function Is(){return [{id:"event-pt-ao-source",language:"pt",command:"on",priority:115,template:{format:"ao {event} em {source} {body}",tokens:[{type:"literal",value:"ao",alternatives:["\xE0"]},{type:"role",role:"event"},{type:"literal",value:"em",alternatives:["de","no","na"]},{type:"role",role:"source"}]},extraction:{event:{position:1},source:{marker:"em",markerAlternatives:["de","no","na"]}}},{id:"event-pt-quando-source",language:"pt",command:"on",priority:110,template:{format:"quando {event} de {source} {body}",tokens:[{type:"literal",value:"quando"},{type:"role",role:"event"},{type:"literal",value:"de",alternatives:["em","no","na"]},{type:"role",role:"source"}]},extraction:{event:{position:1},source:{marker:"de",markerAlternatives:["em","no","na"]}}},{id:"event-pt-ao",language:"pt",command:"on",priority:105,template:{format:"ao {event} {body}",tokens:[{type:"literal",value:"ao",alternatives:["\xE0"]},{type:"role",role:"event"}]},extraction:{event:{position:1}}},{id:"event-pt-quando",language:"pt",command:"on",priority:100,template:{format:"quando {event} {body}",tokens:[{type:"literal",value:"quando"},{type:"role",role:"event"}]},extraction:{event:{position:1}}},{id:"event-pt-em",language:"pt",command:"on",priority:95,template:{format:"em {event} {body}",tokens:[{type:"literal",value:"em",alternatives:["no","na"]},{type:"role",role:"event"}]},extraction:{event:{position:1}}},{id:"event-pt-se",language:"pt",command:"on",priority:90,template:{format:"se {event} {body}",tokens:[{type:"literal",value:"se"},{type:"role",role:"event"}]},extraction:{event:{position:1}}}]}function $s(){return [{id:"event-qu-maykama",language:"qu",command:"on",priority:115,template:{format:"[{source} manta] maykama {event} {body}",tokens:[{type:"group",optional:true,tokens:[{type:"role",role:"source",expectedTypes:["selector","reference","expression"]},{type:"literal",value:"manta",alternatives:["-manta"]}]},{type:"literal",value:"maykama"},{type:"role",role:"event"}]},extraction:{event:{position:2},source:{position:0}}},{id:"event-qu-kaqtin",language:"qu",command:"on",priority:105,template:{format:"{event} kaqtin {body}",tokens:[{type:"role",role:"event"},{type:"literal",value:"kaqtin",alternatives:["qtin","ptin"]}]},extraction:{event:{position:0}}},{id:"event-qu-standard",language:"qu",command:"on",priority:100,template:{format:"{event} pi {body}",tokens:[{type:"role",role:"event"},{type:"literal",value:"pi",alternatives:["kaqpi","kaqpim"]}]},extraction:{event:{position:0}}}]}function js(){return [{id:"event-handler-ru-full",language:"ru",command:"on",priority:100,template:{format:"\u043F\u0440\u0438 {event} \u043D\u0430 {source}",tokens:[{type:"literal",value:"\u043F\u0440\u0438",alternatives:["\u043A\u043E\u0433\u0434\u0430"]},{type:"role",role:"event"},{type:"group",optional:true,tokens:[{type:"literal",value:"\u043D\u0430",alternatives:["\u0432","\u043E\u0442"]},{type:"role",role:"source"}]}]},extraction:{event:{position:1},source:{marker:"\u043D\u0430",markerAlternatives:["\u0432","\u043E\u0442"],default:{type:"reference",value:"me"}}}},{id:"event-handler-ru-simple",language:"ru",command:"on",priority:90,template:{format:"\u043F\u0440\u0438 {event}",tokens:[{type:"literal",value:"\u043F\u0440\u0438",alternatives:["\u043A\u043E\u0433\u0434\u0430"]},{type:"role",role:"event"}]},extraction:{event:{position:1},source:{default:{type:"reference",value:"me"}}}}]}function Ws(){return [{id:"event-sw-unapo-source",language:"sw",command:"on",priority:115,template:{format:"unapo {event} kutoka {source} {body}",tokens:[{type:"literal",value:"unapo",alternatives:["wakati wa","wakati"]},{type:"role",role:"event"},{type:"literal",value:"kutoka"},{type:"role",role:"source"}]},extraction:{event:{position:1},source:{marker:"kutoka"}}},{id:"event-sw-unapo",language:"sw",command:"on",priority:105,template:{format:"unapo {event} {body}",tokens:[{type:"literal",value:"unapo",alternatives:["wakati wa","wakati"]},{type:"role",role:"event"}]},extraction:{event:{position:1}}},{id:"event-sw-kwa-source",language:"sw",command:"on",priority:110,template:{format:"kwa {event} kutoka {source} {body}",tokens:[{type:"literal",value:"kwa"},{type:"role",role:"event"},{type:"literal",value:"kutoka"},{type:"role",role:"source"}]},extraction:{event:{position:1},source:{marker:"kutoka"}}},{id:"event-sw-kwa",language:"sw",command:"on",priority:100,template:{format:"kwa {event} {body}",tokens:[{type:"literal",value:"kwa"},{type:"role",role:"event"}]},extraction:{event:{position:1}}},{id:"event-sw-ikiwa",language:"sw",command:"on",priority:95,template:{format:"ikiwa {event} {body}",tokens:[{type:"literal",value:"ikiwa",alternatives:["kama"]},{type:"role",role:"event"}]},extraction:{event:{position:1}}},{id:"event-sw-baada-ya",language:"sw",command:"on",priority:90,template:{format:"baada ya {event} {body}",tokens:[{type:"literal",value:"baada ya"},{type:"role",role:"event"}]},extraction:{event:{position:1}}}]}function qs(){return [{id:"event-handler-th-svo",language:"th",command:"on",priority:100,template:{format:"\u0E40\u0E21\u0E37\u0E48\u0E2D {event} {action}",tokens:[{type:"literal",value:"\u0E40\u0E21\u0E37\u0E48\u0E2D",alternatives:["\u0E15\u0E2D\u0E19"]},{type:"role",role:"event"},{type:"role",role:"action"}]},extraction:{event:{position:1},action:{position:2}}},{id:"event-handler-th-with-source",language:"th",command:"on",priority:110,template:{format:"\u0E40\u0E21\u0E37\u0E48\u0E2D {event} \u0E08\u0E32\u0E01 {source} {action}",tokens:[{type:"literal",value:"\u0E40\u0E21\u0E37\u0E48\u0E2D",alternatives:["\u0E15\u0E2D\u0E19"]},{type:"role",role:"event"},{type:"literal",value:"\u0E08\u0E32\u0E01"},{type:"role",role:"source"},{type:"role",role:"action"}]},extraction:{event:{position:1},source:{marker:"\u0E08\u0E32\u0E01",position:3},action:{position:4}}}]}function Ir(r){let e=r.verbAlts?{type:"literal",value:r.verb,alternatives:r.verbAlts}:{type:"literal",value:r.verb},t=r.eventMarkerAlts?{type:"literal",value:r.eventMarker,alternatives:r.eventMarkerAlts}:{type:"literal",value:r.eventMarker};return ["before","after"].map(i=>{let n={type:"literal",value:i==="before"?r.before:r.after},a={type:"role",role:"patient"},o={type:"role",role:"destination"},u={type:"role",role:"event"},s=r.order==="verb-first"?[e,a,n,o,t,u]:[t,u,e,a,n,o],l=r.order==="verb-first"?{action:{value:"put"},patient:{position:1},destination:{position:3},event:{position:5},manner:{default:{type:"literal",value:i}}}:{action:{value:"put"},event:{position:1},patient:{position:3},destination:{position:5},manner:{default:{type:"literal",value:i}}};return {id:`put-event-${r.lang}-vso-${i}`,language:r.lang,command:"on",priority:160,template:{format:`${r.lang} put ${i}`,tokens:s},extraction:l}})}function Vs(){return [...Ir({lang:"tl",verb:"ilagay",verbAlts:["maglagay"],eventMarker:"kapag",eventMarkerAlts:["sa"],before:"bago",after:"matapos",order:"verb-first"}),{id:"event-tl-kapag-source",language:"tl",command:"on",priority:115,template:{format:"kapag {event} mula_sa {source} {body}",tokens:[{type:"literal",value:"kapag",alternatives:["sa"]},{type:"role",role:"event"},{type:"literal",value:"mula_sa",alternatives:["galing_sa"]},{type:"role",role:"source"}]},extraction:{event:{position:1},source:{marker:"mula_sa"}}},{id:"event-tl-kapag",language:"tl",command:"on",priority:105,template:{format:"kapag {event} {body}",tokens:[{type:"literal",value:"kapag",alternatives:["sa"]},{type:"role",role:"event"}]},extraction:{event:{position:1}}}]}function Ks(){return [...Ir({lang:"uk",verb:"\u043F\u043E\u043A\u043B\u0430\u0441\u0442\u0438",verbAlts:["\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"],eventMarker:"\u043F\u0440\u0438",eventMarkerAlts:["\u043A\u043E\u043B\u0438"],before:"\u0434\u043E",after:"\u043F\u0456\u0441\u043B\u044F",order:"event-first"}),{id:"event-handler-uk-full",language:"uk",command:"on",priority:100,template:{format:"\u043F\u0440\u0438 {event} \u043D\u0430 {source}",tokens:[{type:"literal",value:"\u043F\u0440\u0438",alternatives:["\u043A\u043E\u043B\u0438"]},{type:"role",role:"event"},{type:"group",optional:true,tokens:[{type:"literal",value:"\u043D\u0430",alternatives:["\u0432","\u0432\u0456\u0434"]},{type:"role",role:"source"}]}]},extraction:{event:{position:1},source:{marker:"\u043D\u0430",markerAlternatives:["\u0432","\u0432\u0456\u0434"],default:{type:"reference",value:"me"}}}},{id:"event-handler-uk-simple",language:"uk",command:"on",priority:90,template:{format:"\u043F\u0440\u0438 {event}",tokens:[{type:"literal",value:"\u043F\u0440\u0438",alternatives:["\u043A\u043E\u043B\u0438"]},{type:"role",role:"event"}]},extraction:{event:{position:1},source:{default:{type:"reference",value:"me"}}}}]}function Hs(){return [{id:"event-handler-vi-full",language:"vi",command:"on",priority:100,template:{format:"khi {event} tr\xEAn {source}",tokens:[{type:"literal",value:"khi",alternatives:["l\xFAc","tr\xEAn"]},{type:"role",role:"event"},{type:"group",optional:true,tokens:[{type:"literal",value:"tr\xEAn",alternatives:["t\u1EA1i"]},{type:"role",role:"source"}]}]},extraction:{event:{position:1},source:{marker:"tr\xEAn",markerAlternatives:["t\u1EA1i"],default:{type:"reference",value:"me"}}}},{id:"event-handler-vi-simple",language:"vi",command:"on",priority:90,template:{format:"khi {event}",tokens:[{type:"literal",value:"khi",alternatives:["l\xFAc","tr\xEAn"]},{type:"role",role:"event"}]},extraction:{event:{position:1},source:{default:{type:"reference",value:"me"}}}}]}function Us(){return [{id:"event-zh-temporal-source",language:"zh",command:"on",priority:115,template:{format:"{event} \u7684\u65F6\u5019 \u4ECE {source} {body}",tokens:[{type:"role",role:"event"},{type:"literal",value:"\u7684\u65F6\u5019",alternatives:["\u65F6\u5019","\u65F6"]},{type:"literal",value:"\u4ECE",alternatives:["\u5728"]},{type:"role",role:"source"}]},extraction:{event:{position:0},source:{marker:"\u4ECE",markerAlternatives:["\u5728"]}}},{id:"event-zh-source",language:"zh",command:"on",priority:110,template:{format:"\u5F53 {event} \u4ECE {source} {body}",tokens:[{type:"literal",value:"\u5F53"},{type:"role",role:"event"},{type:"literal",value:"\u4ECE",alternatives:["\u5728"]},{type:"role",role:"source"}]},extraction:{event:{position:1},source:{marker:"\u4ECE",markerAlternatives:["\u5728"]}}},{id:"event-zh-immediate-source",language:"zh",command:"on",priority:112,template:{format:"\u4E00 {event} \u4ECE {source} \u5C31 {body}",tokens:[{type:"literal",value:"\u4E00"},{type:"role",role:"event"},{type:"literal",value:"\u4ECE",alternatives:["\u5728"]},{type:"role",role:"source"},{type:"literal",value:"\u5C31"}]},extraction:{event:{position:1},source:{marker:"\u4ECE",markerAlternatives:["\u5728"]}}},{id:"event-zh-immediate",language:"zh",command:"on",priority:108,template:{format:"\u4E00 {event} \u5C31 {body}",tokens:[{type:"literal",value:"\u4E00"},{type:"role",role:"event"},{type:"literal",value:"\u5C31"}]},extraction:{event:{position:1}}},{id:"event-zh-temporal",language:"zh",command:"on",priority:105,template:{format:"{event} \u7684\u65F6\u5019 {body}",tokens:[{type:"role",role:"event"},{type:"literal",value:"\u7684\u65F6\u5019",alternatives:["\u65F6\u5019","\u65F6"]}]},extraction:{event:{position:0}}},{id:"event-zh-whenever",language:"zh",command:"on",priority:103,template:{format:"\u6BCF\u5F53 {event} {body}",tokens:[{type:"literal",value:"\u6BCF\u5F53",alternatives:["\u6BCF\u6B21"]},{type:"role",role:"event"}]},extraction:{event:{position:1}}},{id:"event-zh-circumfix",language:"zh",command:"on",priority:106,template:{format:"\u5F53 {event} \u65F6 {body}",tokens:[{type:"literal",value:"\u5F53"},{type:"role",role:"event"},{type:"literal",value:"\u65F6",alternatives:["\u7684\u65F6\u5019","\u65F6\u5019"]}]},extraction:{event:{position:1}}},{id:"event-zh-standard",language:"zh",command:"on",priority:100,template:{format:"\u5F53 {event} {body}",tokens:[{type:"literal",value:"\u5F53"},{type:"role",role:"event"}]},extraction:{event:{position:1}}},{id:"event-zh-completion",language:"zh",command:"on",priority:95,template:{format:"{event} \u4E86 {body}",tokens:[{type:"role",role:"event"},{type:"literal",value:"\u4E86"}]},extraction:{event:{position:0}}},{id:"event-zh-conditional",language:"zh",command:"on",priority:90,template:{format:"\u5982\u679C {event} {body}",tokens:[{type:"literal",value:"\u5982\u679C",alternatives:["\u82E5","\u5047\u5982"]},{type:"role",role:"event"}]},extraction:{event:{position:1}}}]}function Gs(){return [{id:"event-ja-when",language:"ja",command:"on",priority:95,template:{format:"\u3068\u304D {event} {body}",tokens:[{type:"literal",value:"\u3068\u304D",alternatives:["\u6642","\u3068\u304D\u306B"]},{type:"role",role:"event"}]},extraction:{event:{position:1}}}]}function Zs(){return [{id:"event-tr-when",language:"tr",command:"on",priority:95,template:{format:"iken {event} {body}",tokens:[{type:"literal",value:"iken",alternatives:["durumunda","oldu\u011Funda"]},{type:"role",role:"event"}]},extraction:{event:{position:1}}}]}function Ys(){return [...Ir({lang:"ar",verb:"\u0636\u0639",verbAlts:["\u0627\u062C\u0639\u0644"],eventMarker:"\u0639\u0646\u062F",eventMarkerAlts:["\u0641\u064A","\u0644\u062F\u0649","\u0639\u0646\u062F\u0645\u0627","\u062D\u064A\u0646","\u062D\u064A\u0646\u0645\u0627","\u0644\u0645\u0651\u0627","\u0644\u0645\u0627"],before:"\u0642\u0628\u0644",after:"\u0628\u0639\u062F",order:"verb-first"}),{id:"event-ar-when",language:"ar",command:"on",priority:95,template:{format:"\u0639\u0646\u062F\u0645\u0627 {event} {body}",tokens:[{type:"literal",value:"\u0639\u0646\u062F\u0645\u0627",alternatives:["\u062D\u064A\u0646","\u0644\u0645\u0651\u0627"]},{type:"role",role:"event"}]},extraction:{event:{position:1}}}]}function Xs(){return [{id:"event-he-when",language:"he",command:"on",priority:95,template:{format:"\u05DB\u05D0\u05E9\u05E8 {event} {body}",tokens:[{type:"literal",value:"\u05DB\u05D0\u05E9\u05E8",alternatives:["\u05DB\u05E9"]},{type:"role",role:"event"}]},extraction:{event:{position:1}}}]}function Js(r){switch(r){case "bn":return Bs();case "ko":return Ss();case "de":return Ts();case "en":return Fs();case "es":return Ps();case "fr":return Rs();case "hi":return Os();case "id":return Ls();case "it":return Ns();case "ms":return Ms();case "pl":return _s();case "pt":return Is();case "qu":return $s();case "ru":return js();case "sw":return Ws();case "th":return qs();case "tl":return Vs();case "uk":return Ks();case "vi":return Hs();case "zh":return Us();case "ja":return Gs();case "tr":return Zs();case "ar":return Ys();case "he":return Xs();default:return []}}function Qs(r){return []}function el(){return [{id:"add-bn-full",language:"bn",command:"add",priority:100,template:{format:"{patient} \u0995\u09C7 \u09AF\u09CB\u0997 \u0995\u09B0\u09C1\u09A8",tokens:[{type:"role",role:"patient"},{type:"literal",value:"\u0995\u09C7"},{type:"literal",value:"\u09AF\u09CB\u0997"},{type:"literal",value:"\u0995\u09B0\u09C1\u09A8"}]},extraction:{patient:{position:0}}},{id:"add-bn-simple",language:"bn",command:"add",priority:90,template:{format:"\u09AF\u09CB\u0997 {patient}",tokens:[{type:"literal",value:"\u09AF\u09CB\u0997"},{type:"role",role:"patient"}]},extraction:{patient:{position:1}}},{id:"add-bn-with-dest",language:"bn",command:"add",priority:95,template:{format:"{destination} \u098F {patient} \u0995\u09C7 \u09AF\u09CB\u0997 \u0995\u09B0\u09C1\u09A8",tokens:[{type:"role",role:"destination"},{type:"literal",value:"\u098F",alternatives:["\u09A4\u09C7"]},{type:"role",role:"patient"},{type:"literal",value:"\u0995\u09C7"},{type:"literal",value:"\u09AF\u09CB\u0997"},{type:"literal",value:"\u0995\u09B0\u09C1\u09A8"}]},extraction:{destination:{position:0},patient:{position:2}}}]}function tl(){return [{id:"add-hi-full",language:"hi",command:"add",priority:100,template:{format:"{patient} \u0915\u094B {destination} \u092E\u0947\u0902 \u091C\u094B\u0921\u093C\u0947\u0902",tokens:[{type:"role",role:"patient"},{type:"literal",value:"\u0915\u094B"},{type:"role",role:"destination"},{type:"literal",value:"\u092E\u0947\u0902"},{type:"literal",value:"\u091C\u094B\u0921\u093C\u0947\u0902",alternatives:["\u091C\u094B\u0921\u093C"]}]},extraction:{patient:{position:0},destination:{marker:"\u092E\u0947\u0902",position:3}}},{id:"add-hi-simple",language:"hi",command:"add",priority:90,template:{format:"{patient} \u091C\u094B\u0921\u093C\u0947\u0902",tokens:[{type:"role",role:"patient"},{type:"literal",value:"\u091C\u094B\u0921\u093C\u0947\u0902",alternatives:["\u091C\u094B\u0921\u093C"]}]},extraction:{patient:{position:0},destination:{default:{type:"reference",value:"me"}}}},{id:"add-hi-bare",language:"hi",command:"add",priority:80,template:{format:"\u091C\u094B\u0921\u093C\u0947\u0902 {patient}",tokens:[{type:"literal",value:"\u091C\u094B\u0921\u093C\u0947\u0902",alternatives:["\u091C\u094B\u0921\u093C"]},{type:"role",role:"patient"}]},extraction:{patient:{position:1},destination:{default:{type:"reference",value:"me"}}}}]}function rl(){return [{id:"add-it-full",language:"it",command:"add",priority:100,template:{format:"aggiungere {patient} a {target}",tokens:[{type:"literal",value:"aggiungere",alternatives:["aggiungi","add"]},{type:"role",role:"patient"},{type:"group",optional:true,tokens:[{type:"literal",value:"a",alternatives:["su","in"]},{type:"role",role:"destination"}]}]},extraction:{patient:{position:1},destination:{marker:"a",markerAlternatives:["su","in"],default:{type:"reference",value:"me"}}}},{id:"add-it-simple",language:"it",command:"add",priority:90,template:{format:"aggiungere {patient}",tokens:[{type:"literal",value:"aggiungere",alternatives:["aggiungi","add"]},{type:"role",role:"patient"}]},extraction:{patient:{position:1},destination:{default:{type:"reference",value:"me"}}}}]}function il(){return [{id:"add-pl-full",language:"pl",command:"add",priority:100,template:{format:"dodaj {patient} do {destination}",tokens:[{type:"literal",value:"dodaj"},{type:"role",role:"patient"},{type:"group",optional:true,tokens:[{type:"literal",value:"do",alternatives:["na","w"]},{type:"role",role:"destination"}]}]},extraction:{patient:{position:1},destination:{marker:"do",markerAlternatives:["na","w"],default:{type:"reference",value:"me"}}}},{id:"add-pl-simple",language:"pl",command:"add",priority:90,template:{format:"dodaj {patient}",tokens:[{type:"literal",value:"dodaj"},{type:"role",role:"patient"}]},extraction:{patient:{position:1},destination:{default:{type:"reference",value:"me"}}}}]}function nl(){return [{id:"add-qu-sov",language:"qu",command:"add",priority:100,template:{format:"{patient} ta yapay",tokens:[{type:"role",role:"patient"},{type:"literal",value:"ta"},{type:"literal",value:"yapay",alternatives:["yapaykuy"]}]},extraction:{patient:{position:0}}},{id:"add-qu-simple",language:"qu",command:"add",priority:90,template:{format:"yapay {patient}",tokens:[{type:"literal",value:"yapay",alternatives:["yapaykuy"]},{type:"role",role:"patient"}]},extraction:{patient:{position:1}}},{id:"add-qu-patient-first",language:"qu",command:"add",priority:96,template:{format:"{patient} ta {destination} man yapay",tokens:[{type:"role",role:"patient"},{type:"literal",value:"ta"},{type:"role",role:"destination"},{type:"literal",value:"man"},{type:"literal",value:"yapay",alternatives:["yapaykuy"]}]},extraction:{patient:{position:0},destination:{position:2}}},{id:"add-qu-with-dest",language:"qu",command:"add",priority:95,template:{format:"{destination} man {patient} ta yapay",tokens:[{type:"role",role:"destination"},{type:"literal",value:"man"},{type:"role",role:"patient"},{type:"literal",value:"ta"},{type:"literal",value:"yapay",alternatives:["yapaykuy"]}]},extraction:{destination:{position:0},patient:{position:2}}}]}function al(){return [{id:"add-ru-full",language:"ru",command:"add",priority:100,template:{format:"\u0434\u043E\u0431\u0430\u0432\u0438\u0442\u044C {patient} \u043A {destination}",tokens:[{type:"literal",value:"\u0434\u043E\u0431\u0430\u0432\u0438\u0442\u044C",alternatives:["\u0434\u043E\u0431\u0430\u0432\u044C"]},{type:"role",role:"patient"},{type:"group",optional:true,tokens:[{type:"literal",value:"\u043A",alternatives:["\u043D\u0430","\u0432"]},{type:"role",role:"destination"}]}]},extraction:{patient:{position:1},destination:{marker:"\u043A",markerAlternatives:["\u043D\u0430","\u0432"],default:{type:"reference",value:"me"}}}},{id:"add-ru-simple",language:"ru",command:"add",priority:90,template:{format:"\u0434\u043E\u0431\u0430\u0432\u0438\u0442\u044C {patient}",tokens:[{type:"literal",value:"\u0434\u043E\u0431\u0430\u0432\u0438\u0442\u044C",alternatives:["\u0434\u043E\u0431\u0430\u0432\u044C"]},{type:"role",role:"patient"}]},extraction:{patient:{position:1},destination:{default:{type:"reference",value:"me"}}}}]}function ol(){return []}function ul(){return [{id:"add-uk-full",language:"uk",command:"add",priority:100,template:{format:"\u0434\u043E\u0434\u0430\u0442\u0438 {patient} \u0434\u043E {destination}",tokens:[{type:"literal",value:"\u0434\u043E\u0434\u0430\u0442\u0438",alternatives:["\u0434\u043E\u0434\u0430\u0439"]},{type:"role",role:"patient"},{type:"group",optional:true,tokens:[{type:"literal",value:"\u0434\u043E",alternatives:["\u043D\u0430","\u0432"]},{type:"role",role:"destination"}]}]},extraction:{patient:{position:1},destination:{marker:"\u0434\u043E",markerAlternatives:["\u043D\u0430","\u0432"],default:{type:"reference",value:"me"}}}},{id:"add-uk-simple",language:"uk",command:"add",priority:90,template:{format:"\u0434\u043E\u0434\u0430\u0442\u0438 {patient}",tokens:[{type:"literal",value:"\u0434\u043E\u0434\u0430\u0442\u0438",alternatives:["\u0434\u043E\u0434\u0430\u0439"]},{type:"role",role:"patient"}]},extraction:{patient:{position:1},destination:{default:{type:"reference",value:"me"}}}}]}function sl(){return [{id:"add-vi-full",language:"vi",command:"add",priority:100,template:{format:"th\xEAm {patient} v\xE0o {target}",tokens:[{type:"literal",value:"th\xEAm",alternatives:["b\u1ED5 sung"]},{type:"role",role:"patient"},{type:"group",optional:true,tokens:[{type:"literal",value:"v\xE0o",alternatives:["cho"]},{type:"role",role:"destination"}]}]},extraction:{patient:{position:1},destination:{marker:"v\xE0o",markerAlternatives:["cho"],default:{type:"reference",value:"me"}}}},{id:"add-vi-simple",language:"vi",command:"add",priority:90,template:{format:"th\xEAm {patient}",tokens:[{type:"literal",value:"th\xEAm",alternatives:["b\u1ED5 sung"]},{type:"role",role:"patient"}]},extraction:{patient:{position:1},destination:{default:{type:"reference",value:"me"}}}}]}function ll(){return [{id:"add-zh-full",language:"zh",command:"add",priority:100,template:{format:"\u7ED9 {destination} \u6DFB\u52A0 {patient}",tokens:[{type:"literal",value:"\u7ED9",alternatives:["\u70BA","\u4E3A"]},{type:"role",role:"destination"},{type:"literal",value:"\u6DFB\u52A0",alternatives:["\u52A0","\u589E\u52A0","\u52A0\u4E0A"]},{type:"role",role:"patient"}]},extraction:{destination:{position:1},patient:{position:3}}},{id:"add-zh-simple",language:"zh",command:"add",priority:90,template:{format:"\u6DFB\u52A0 {patient}",tokens:[{type:"literal",value:"\u6DFB\u52A0",alternatives:["\u52A0","\u589E\u52A0"]},{type:"role",role:"patient"}]},extraction:{patient:{position:1},destination:{default:{type:"reference",value:"me"}}}},{id:"add-zh-ba",language:"zh",command:"add",priority:95,template:{format:"\u628A {patient} \u6DFB\u52A0\u5230 {destination}",tokens:[{type:"literal",value:"\u628A"},{type:"role",role:"patient"},{type:"literal",value:"\u6DFB\u52A0\u5230",alternatives:["\u52A0\u5230","\u589E\u52A0\u5230"]},{type:"role",role:"destination"}]},extraction:{patient:{position:1},destination:{marker:"\u6DFB\u52A0\u5230",markerAlternatives:["\u52A0\u5230","\u589E\u52A0\u5230"]}}}]}function cl(r){switch(r){case "bn":return el();case "hi":return tl();case "it":return rl();case "pl":return il();case "qu":return nl();case "ru":return al();case "th":return ol();case "uk":return ul();case "vi":return sl();case "zh":return ll();default:return []}}function pl(){return [{id:"remove-bn-simple",language:"bn",command:"remove",priority:90,template:{format:"\u09B8\u09B0\u09BE\u09A8 {patient}",tokens:[{type:"literal",value:"\u09B8\u09B0\u09BE\u09A8",alternatives:["\u09AE\u09C1\u099B\u09C1\u09A8"]},{type:"role",role:"patient"}]},extraction:{patient:{position:1}}},{id:"remove-bn-with-source",language:"bn",command:"remove",priority:95,template:{format:"{source} \u09A5\u09C7\u0995\u09C7 {patient} \u0995\u09C7 \u09B8\u09B0\u09BE\u09A8",tokens:[{type:"role",role:"source"},{type:"literal",value:"\u09A5\u09C7\u0995\u09C7"},{type:"role",role:"patient"},{type:"literal",value:"\u0995\u09C7"},{type:"literal",value:"\u09B8\u09B0\u09BE\u09A8",alternatives:["\u09AE\u09C1\u099B\u09C1\u09A8"]}]},extraction:{source:{position:0},patient:{position:2}}}]}function dl(){return [{id:"remove-hi-full",language:"hi",command:"remove",priority:100,template:{format:"{patient} \u0915\u094B {source} \u0938\u0947 \u0939\u091F\u093E\u090F\u0902",tokens:[{type:"role",role:"patient"},{type:"literal",value:"\u0915\u094B"},{type:"role",role:"source"},{type:"literal",value:"\u0938\u0947"},{type:"literal",value:"\u0939\u091F\u093E\u090F\u0902",alternatives:["\u0939\u091F\u093E","\u092E\u093F\u091F\u093E\u090F\u0902"]}]},extraction:{patient:{position:0},source:{marker:"\u0938\u0947",position:3}}},{id:"remove-hi-simple",language:"hi",command:"remove",priority:90,template:{format:"{patient} \u0939\u091F\u093E\u090F\u0902",tokens:[{type:"role",role:"patient"},{type:"literal",value:"\u0939\u091F\u093E\u090F\u0902",alternatives:["\u0939\u091F\u093E","\u092E\u093F\u091F\u093E\u090F\u0902"]}]},extraction:{patient:{position:0},source:{default:{type:"reference",value:"me"}}}},{id:"remove-hi-bare",language:"hi",command:"remove",priority:80,template:{format:"\u0939\u091F\u093E\u090F\u0902 {patient}",tokens:[{type:"literal",value:"\u0939\u091F\u093E\u090F\u0902",alternatives:["\u0939\u091F\u093E","\u092E\u093F\u091F\u093E\u090F\u0902"]},{type:"role",role:"patient"}]},extraction:{patient:{position:1},source:{default:{type:"reference",value:"me"}}}}]}function ml(){return [{id:"remove-it-full",language:"it",command:"remove",priority:100,template:{format:"rimuovere {patient} da {source}",tokens:[{type:"literal",value:"rimuovere",alternatives:["rimuovi","eliminare","togliere","remove"]},{type:"role",role:"patient"},{type:"group",optional:true,tokens:[{type:"literal",value:"da",alternatives:["di"]},{type:"role",role:"source"}]}]},extraction:{patient:{position:1},source:{marker:"da",markerAlternatives:["di"],default:{type:"reference",value:"me"}}}},{id:"remove-it-simple",language:"it",command:"remove",priority:90,template:{format:"rimuovere {patient}",tokens:[{type:"literal",value:"rimuovere",alternatives:["rimuovi","eliminare","togliere","remove"]},{type:"role",role:"patient"}]},extraction:{patient:{position:1},source:{default:{type:"reference",value:"me"}}}}]}function fl(){return [{id:"remove-pl-full",language:"pl",command:"remove",priority:100,template:{format:"usu\u0144 {patient} z {source}",tokens:[{type:"literal",value:"usu\u0144",alternatives:["usun","wyczy\u015B\u0107","wyczysc"]},{type:"role",role:"patient"},{type:"group",optional:true,tokens:[{type:"literal",value:"z",alternatives:["od","ze"]},{type:"role",role:"source"}]}]},extraction:{patient:{position:1},source:{marker:"z",markerAlternatives:["od","ze"],default:{type:"reference",value:"me"}}}},{id:"remove-pl-simple",language:"pl",command:"remove",priority:90,template:{format:"usu\u0144 {patient}",tokens:[{type:"literal",value:"usu\u0144",alternatives:["usun","wyczy\u015B\u0107","wyczysc"]},{type:"role",role:"patient"}]},extraction:{patient:{position:1},source:{default:{type:"reference",value:"me"}}}}]}function yl(){return [{id:"remove-qu-sov",language:"qu",command:"remove",priority:100,template:{format:"{patient} ta qichuy",tokens:[{type:"role",role:"patient"},{type:"literal",value:"ta"},{type:"literal",value:"qichuy",alternatives:["hurquy","anchuchiy"]}]},extraction:{patient:{position:0}}},{id:"remove-qu-simple",language:"qu",command:"remove",priority:90,template:{format:"qichuy {patient}",tokens:[{type:"literal",value:"qichuy",alternatives:["hurquy","anchuchiy"]},{type:"role",role:"patient"}]},extraction:{patient:{position:1}}},{id:"remove-qu-patient-first",language:"qu",command:"remove",priority:96,template:{format:"{patient} ta {source} manta qichuy",tokens:[{type:"role",role:"patient"},{type:"literal",value:"ta"},{type:"role",role:"source"},{type:"literal",value:"manta"},{type:"literal",value:"qichuy",alternatives:["hurquy","anchuchiy"]}]},extraction:{patient:{position:0},source:{position:2}}},{id:"remove-qu-with-source",language:"qu",command:"remove",priority:95,template:{format:"{source} manta {patient} ta qichuy",tokens:[{type:"role",role:"source"},{type:"literal",value:"manta"},{type:"role",role:"patient"},{type:"literal",value:"ta"},{type:"literal",value:"qichuy",alternatives:["hurquy","anchuchiy"]}]},extraction:{source:{position:0},patient:{position:2}}}]}function vl(){return [{id:"remove-ru-full",language:"ru",command:"remove",priority:100,template:{format:"\u0443\u0434\u0430\u043B\u0438\u0442\u044C {patient} \u0438\u0437 {source}",tokens:[{type:"literal",value:"\u0443\u0434\u0430\u043B\u0438\u0442\u044C",alternatives:["\u0443\u0434\u0430\u043B\u0438","\u0443\u0431\u0440\u0430\u0442\u044C","\u0443\u0431\u0435\u0440\u0438"]},{type:"role",role:"patient"},{type:"group",optional:true,tokens:[{type:"literal",value:"\u0438\u0437",alternatives:["\u043E\u0442","\u0441"]},{type:"role",role:"source"}]}]},extraction:{patient:{position:1},source:{marker:"\u0438\u0437",markerAlternatives:["\u043E\u0442","\u0441"],default:{type:"reference",value:"me"}}}},{id:"remove-ru-simple",language:"ru",command:"remove",priority:90,template:{format:"\u0443\u0434\u0430\u043B\u0438\u0442\u044C {patient}",tokens:[{type:"literal",value:"\u0443\u0434\u0430\u043B\u0438\u0442\u044C",alternatives:["\u0443\u0434\u0430\u043B\u0438","\u0443\u0431\u0440\u0430\u0442\u044C","\u0443\u0431\u0435\u0440\u0438"]},{type:"role",role:"patient"}]},extraction:{patient:{position:1},source:{default:{type:"reference",value:"me"}}}}]}function hl(){return [{id:"remove-th-simple",language:"th",command:"remove",priority:90,template:{format:"\u0E25\u0E1A {patient}",tokens:[{type:"literal",value:"\u0E25\u0E1A",alternatives:["\u0E25\u0E1A\u0E2D\u0E2D\u0E01"]},{type:"role",role:"patient"}]},extraction:{patient:{position:1}}},{id:"remove-th-with-source",language:"th",command:"remove",priority:95,template:{format:"\u0E25\u0E1A {patient} \u0E08\u0E32\u0E01 {source}",tokens:[{type:"literal",value:"\u0E25\u0E1A",alternatives:["\u0E25\u0E1A\u0E2D\u0E2D\u0E01"]},{type:"role",role:"patient"},{type:"literal",value:"\u0E08\u0E32\u0E01"},{type:"role",role:"source"}]},extraction:{patient:{position:1},source:{marker:"\u0E08\u0E32\u0E01",position:3}}}]}function El(){return [{id:"remove-uk-full",language:"uk",command:"remove",priority:100,template:{format:"\u0432\u0438\u0434\u0430\u043B\u0438\u0442\u0438 {patient} \u0437 {source}",tokens:[{type:"literal",value:"\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"]},{type:"role",role:"patient"},{type:"group",optional:true,tokens:[{type:"literal",value:"\u0437",alternatives:["\u0432\u0456\u0434","\u0456\u0437"]},{type:"role",role:"source"}]}]},extraction:{patient:{position:1},source:{marker:"\u0437",markerAlternatives:["\u0432\u0456\u0434","\u0456\u0437"],default:{type:"reference",value:"me"}}}},{id:"remove-uk-simple",language:"uk",command:"remove",priority:90,template:{format:"\u0432\u0438\u0434\u0430\u043B\u0438\u0442\u0438 {patient}",tokens:[{type:"literal",value:"\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"]},{type:"role",role:"patient"}]},extraction:{patient:{position:1},source:{default:{type:"reference",value:"me"}}}}]}function gl(){return [{id:"remove-vi-full",language:"vi",command:"remove",priority:100,template:{format:"x\xF3a {patient} kh\u1ECFi {target}",tokens:[{type:"literal",value:"x\xF3a",alternatives:["g\u1EE1 b\u1ECF","lo\u1EA1i b\u1ECF","b\u1ECF"]},{type:"role",role:"patient"},{type:"group",optional:true,tokens:[{type:"literal",value:"kh\u1ECFi",alternatives:["t\u1EEB"]},{type:"role",role:"source"}]}]},extraction:{patient:{position:1},source:{marker:"kh\u1ECFi",markerAlternatives:["t\u1EEB"],default:{type:"reference",value:"me"}}}},{id:"remove-vi-simple",language:"vi",command:"remove",priority:90,template:{format:"x\xF3a {patient}",tokens:[{type:"literal",value:"x\xF3a",alternatives:["g\u1EE1 b\u1ECF","lo\u1EA1i b\u1ECF","b\u1ECF"]},{type:"role",role:"patient"}]},extraction:{patient:{position:1},source:{default:{type:"reference",value:"me"}}}}]}function kl(){return [{id:"remove-zh-full",language:"zh",command:"remove",priority:100,template:{format:"\u4ECE {destination} \u5220\u9664 {patient}",tokens:[{type:"literal",value:"\u4ECE",alternatives:["\u5F9E"]},{type:"role",role:"destination"},{type:"literal",value:"\u5220\u9664",alternatives:["\u522A\u9664","\u79FB\u9664","\u53BB\u6389"]},{type:"role",role:"patient"}]},extraction:{destination:{position:1},patient:{position:3}}},{id:"remove-zh-simple",language:"zh",command:"remove",priority:90,template:{format:"\u5220\u9664 {patient}",tokens:[{type:"literal",value:"\u5220\u9664",alternatives:["\u522A\u9664","\u79FB\u9664","\u53BB\u6389"]},{type:"role",role:"patient"}]},extraction:{patient:{position:1},destination:{default:{type:"reference",value:"me"}}}},{id:"remove-zh-ba",language:"zh",command:"remove",priority:95,template:{format:"\u628A {patient} \u4ECE {destination} \u5220\u9664",tokens:[{type:"literal",value:"\u628A"},{type:"role",role:"patient"},{type:"literal",value:"\u4ECE",alternatives:["\u5F9E"]},{type:"role",role:"destination"},{type:"literal",value:"\u5220\u9664",alternatives:["\u522A\u9664","\u79FB\u9664"]}]},extraction:{patient:{position:1},destination:{position:3}}}]}function zl(r){switch(r){case "bn":return pl();case "hi":return dl();case "it":return ml();case "pl":return fl();case "qu":return yl();case "ru":return vl();case "th":return hl();case "uk":return El();case "vi":return gl();case "zh":return kl();default:return []}}var wl=[...ln.roles.find(r=>r.role==="patient")?.expectedTypes??[]];function bl(){return [{id:"show-bn-full",language:"bn",command:"show",priority:100,template:{format:"{patient} \u0995\u09C7 \u09A6\u09C7\u0996\u09BE\u09A8",tokens:[{type:"role",role:"patient"},{type:"literal",value:"\u0995\u09C7"},{type:"literal",value:"\u09A6\u09C7\u0996\u09BE\u09A8",alternatives:["\u09A6\u09C7\u0996\u09BE\u0993"]}]},extraction:{patient:{position:0}}},{id:"show-bn-simple",language:"bn",command:"show",priority:90,template:{format:"\u09A6\u09C7\u0996\u09BE\u09A8 {patient}",tokens:[{type:"literal",value:"\u09A6\u09C7\u0996\u09BE\u09A8",alternatives:["\u09A6\u09C7\u0996\u09BE\u0993"]},{type:"role",role:"patient"}]},extraction:{patient:{position:1}}}]}function Cl(){return [{id:"show-de-full",language:"de",command:"show",priority:100,template:{format:"zeige {patient}",tokens:[{type:"literal",value:"zeige",alternatives:["zeigen","anzeigen","show"]},{type:"role",role:"patient",expectedTypes:wl},{type:"group",optional:true,tokens:[{type:"literal",value:"mit"},{type:"role",role:"style",expectedTypes:["expression","selector"]}]}]},extraction:{patient:{position:1},style:{marker:"mit"}}}]}function Al(){return [{id:"show-fr-full",language:"fr",command:"show",priority:100,template:{format:"afficher {patient}",tokens:[{type:"literal",value:"afficher",alternatives:["montrer","pr\xE9senter","show"]},{type:"role",role:"patient",expectedTypes:["selector","reference"]},{type:"group",optional:true,tokens:[{type:"literal",value:"avec"},{type:"role",role:"style",expectedTypes:["expression","selector"]}]}]},extraction:{patient:{position:1},style:{marker:"avec"}}}]}function xl(){return [{id:"show-hi-full",language:"hi",command:"show",priority:100,template:{format:"{patient} \u0915\u094B \u0926\u093F\u0916\u093E\u090F\u0902",tokens:[{type:"role",role:"patient"},{type:"literal",value:"\u0915\u094B"},{type:"literal",value:"\u0926\u093F\u0916\u093E\u090F\u0902",alternatives:["\u0926\u093F\u0916\u093E"]}]},extraction:{patient:{position:0}}},{id:"show-hi-simple",language:"hi",command:"show",priority:90,template:{format:"\u0926\u093F\u0916\u093E\u090F\u0902 {patient}",tokens:[{type:"literal",value:"\u0926\u093F\u0916\u093E\u090F\u0902",alternatives:["\u0926\u093F\u0916\u093E"]},{type:"role",role:"patient"}]},extraction:{patient:{position:1}}},{id:"show-hi-bare",language:"hi",command:"show",priority:80,template:{format:"\u0926\u093F\u0916\u093E\u090F\u0902",tokens:[{type:"literal",value:"\u0926\u093F\u0916\u093E\u090F\u0902",alternatives:["\u0926\u093F\u0916\u093E"]}]},extraction:{patient:{default:{type:"reference",value:"me"}}}}]}function Dl(){return [{id:"show-it-full",language:"it",command:"show",priority:100,template:{format:"mostrare {patient} con {style}",tokens:[{type:"literal",value:"mostrare",alternatives:["mostra","visualizzare","show"]},{type:"role",role:"patient"},{type:"group",optional:true,tokens:[{type:"literal",value:"con"},{type:"role",role:"style"}]}]},extraction:{patient:{position:1},style:{marker:"con"}}},{id:"show-it-simple",language:"it",command:"show",priority:90,template:{format:"mostrare {patient}",tokens:[{type:"literal",value:"mostrare",alternatives:["mostra","visualizzare","show"]},{type:"role",role:"patient"}]},extraction:{patient:{position:1}}}]}function Sl(){return [{id:"show-pl-full",language:"pl",command:"show",priority:100,template:{format:"poka\u017C {patient} z {style}",tokens:[{type:"literal",value:"poka\u017C",alternatives:["pokaz","wy\u015Bwietl","wyswietl"]},{type:"role",role:"patient"},{type:"group",optional:true,tokens:[{type:"literal",value:"z",alternatives:["ze","jako"]},{type:"role",role:"style"}]}]},extraction:{patient:{position:1},style:{marker:"z",markerAlternatives:["ze","jako"]}}},{id:"show-pl-simple",language:"pl",command:"show",priority:90,template:{format:"poka\u017C {patient}",tokens:[{type:"literal",value:"poka\u017C",alternatives:["pokaz","wy\u015Bwietl","wyswietl"]},{type:"role",role:"patient"}]},extraction:{patient:{position:1}}}]}function Bl(){return [{id:"show-ru-full",language:"ru",command:"show",priority:100,template:{format:"\u043F\u043E\u043A\u0430\u0437\u0430\u0442\u044C {patient} \u0441 {style}",tokens:[{type:"literal",value:"\u043F\u043E\u043A\u0430\u0437\u0430\u0442\u044C",alternatives:["\u043F\u043E\u043A\u0430\u0436\u0438"]},{type:"role",role:"patient"},{type:"group",optional:true,tokens:[{type:"literal",value:"\u0441",alternatives:["\u0441\u043E","\u043A\u0430\u043A"]},{type:"role",role:"style"}]}]},extraction:{patient:{position:1},style:{marker:"\u0441",markerAlternatives:["\u0441\u043E","\u043A\u0430\u043A"]}}},{id:"show-ru-simple",language:"ru",command:"show",priority:90,template:{format:"\u043F\u043E\u043A\u0430\u0437\u0430\u0442\u044C {patient}",tokens:[{type:"literal",value:"\u043F\u043E\u043A\u0430\u0437\u0430\u0442\u044C",alternatives:["\u043F\u043E\u043A\u0430\u0436\u0438"]},{type:"role",role:"patient"}]},extraction:{patient:{position:1}}}]}function Tl(){return [{id:"show-th-simple",language:"th",command:"show",priority:100,template:{format:"\u0E41\u0E2A\u0E14\u0E07 {patient}",tokens:[{type:"literal",value:"\u0E41\u0E2A\u0E14\u0E07"},{type:"role",role:"patient"},{type:"group",optional:true,tokens:[{type:"literal",value:"\u0E14\u0E49\u0E27\u0E22"},{type:"role",role:"style",expectedTypes:["expression","selector"]}]}]},extraction:{patient:{position:1},style:{marker:"\u0E14\u0E49\u0E27\u0E22"}}}]}function Fl(){return [{id:"show-uk-full",language:"uk",command:"show",priority:100,template:{format:"\u043F\u043E\u043A\u0430\u0437\u0430\u0442\u0438 {patient} \u0437 {style}",tokens:[{type:"literal",value:"\u043F\u043E\u043A\u0430\u0437\u0430\u0442\u0438",alternatives:["\u043F\u043E\u043A\u0430\u0436\u0438"]},{type:"role",role:"patient"},{type:"group",optional:true,tokens:[{type:"literal",value:"\u0437",alternatives:["\u0456\u0437","\u044F\u043A"]},{type:"role",role:"style"}]}]},extraction:{patient:{position:1},style:{marker:"\u0437",markerAlternatives:["\u0456\u0437","\u044F\u043A"]}}},{id:"show-uk-simple",language:"uk",command:"show",priority:90,template:{format:"\u043F\u043E\u043A\u0430\u0437\u0430\u0442\u0438 {patient}",tokens:[{type:"literal",value:"\u043F\u043E\u043A\u0430\u0437\u0430\u0442\u0438",alternatives:["\u043F\u043E\u043A\u0430\u0436\u0438"]},{type:"role",role:"patient"}]},extraction:{patient:{position:1}}}]}function Pl(){return [{id:"show-vi-full",language:"vi",command:"show",priority:100,template:{format:"hi\u1EC3n th\u1ECB {patient} v\u1EDBi {effect}",tokens:[{type:"literal",value:"hi\u1EC3n th\u1ECB",alternatives:["hi\u1EC7n"]},{type:"role",role:"patient"},{type:"group",optional:true,tokens:[{type:"literal",value:"v\u1EDBi"},{type:"role",role:"style"}]}]},extraction:{patient:{position:1},style:{marker:"v\u1EDBi"}}},{id:"show-vi-simple",language:"vi",command:"show",priority:90,template:{format:"hi\u1EC3n th\u1ECB {patient}",tokens:[{type:"literal",value:"hi\u1EC3n th\u1ECB",alternatives:["hi\u1EC7n"]},{type:"role",role:"patient"}]},extraction:{patient:{position:1}}}]}function Rl(){return [{id:"show-zh-full",language:"zh",command:"show",priority:100,template:{format:"\u663E\u793A {patient}",tokens:[{type:"literal",value:"\u663E\u793A",alternatives:["\u986F\u793A","\u5C55\u793A","\u5448\u73B0","\u5448\u73FE"]},{type:"role",role:"patient"}]},extraction:{patient:{position:1}}},{id:"show-zh-ba",language:"zh",command:"show",priority:95,template:{format:"\u628A {patient} \u663E\u793A",tokens:[{type:"literal",value:"\u628A"},{type:"role",role:"patient"},{type:"literal",value:"\u663E\u793A",alternatives:["\u986F\u793A","\u5C55\u793A"]}]},extraction:{patient:{position:1}}},{id:"show-zh-with-\u7ED9",language:"zh",command:"show",priority:90,template:{format:"\u7ED9 {destination} \u663E\u793A {patient}",tokens:[{type:"literal",value:"\u7ED9",alternatives:["\u7D66"]},{type:"role",role:"destination"},{type:"literal",value:"\u663E\u793A",alternatives:["\u986F\u793A"]},{type:"role",role:"patient"}]},extraction:{destination:{position:1},patient:{position:3}}}]}function Ol(r){switch(r){case "bn":return bl();case "de":return Cl();case "fr":return Al();case "hi":return xl();case "it":return Dl();case "pl":return Sl();case "ru":return Bl();case "th":return Tl();case "uk":return Fl();case "vi":return Pl();case "zh":return Rl();default:return []}}var Ll=[...cn.roles.find(r=>r.role==="patient")?.expectedTypes??[]];function Nl(){return [{id:"hide-bn-full",language:"bn",command:"hide",priority:100,template:{format:"{patient} \u0995\u09C7 \u09B2\u09C1\u0995\u09BE\u09A8",tokens:[{type:"role",role:"patient"},{type:"literal",value:"\u0995\u09C7"},{type:"literal",value:"\u09B2\u09C1\u0995\u09BE\u09A8",alternatives:["\u09B2\u09C1\u0995\u09BE\u0993"]}]},extraction:{patient:{position:0}}},{id:"hide-bn-simple",language:"bn",command:"hide",priority:90,template:{format:"\u09B2\u09C1\u0995\u09BE\u09A8 {patient}",tokens:[{type:"literal",value:"\u09B2\u09C1\u0995\u09BE\u09A8",alternatives:["\u09B2\u09C1\u0995\u09BE\u0993"]},{type:"role",role:"patient"}]},extraction:{patient:{position:1}}}]}function Ml(){return [{id:"hide-de-full",language:"de",command:"hide",priority:100,template:{format:"verstecke {patient}",tokens:[{type:"literal",value:"verstecke",alternatives:["verstecken","verberge","verbergen","hide"]},{type:"role",role:"patient",expectedTypes:Ll},{type:"group",optional:true,tokens:[{type:"literal",value:"mit"},{type:"role",role:"style",expectedTypes:["expression","selector"]}]}]},extraction:{patient:{position:1},style:{marker:"mit"}}}]}function _l(){return [{id:"hide-hi-full",language:"hi",command:"hide",priority:100,template:{format:"{patient} \u0915\u094B \u091B\u093F\u092A\u093E\u090F\u0902",tokens:[{type:"role",role:"patient"},{type:"literal",value:"\u0915\u094B"},{type:"literal",value:"\u091B\u093F\u092A\u093E\u090F\u0902",alternatives:["\u091B\u093F\u092A\u093E"]}]},extraction:{patient:{position:0}}},{id:"hide-hi-simple",language:"hi",command:"hide",priority:90,template:{format:"\u091B\u093F\u092A\u093E\u090F\u0902 {patient}",tokens:[{type:"literal",value:"\u091B\u093F\u092A\u093E\u090F\u0902",alternatives:["\u091B\u093F\u092A\u093E"]},{type:"role",role:"patient"}]},extraction:{patient:{position:1}}},{id:"hide-hi-bare",language:"hi",command:"hide",priority:80,template:{format:"\u091B\u093F\u092A\u093E\u090F\u0902",tokens:[{type:"literal",value:"\u091B\u093F\u092A\u093E\u090F\u0902",alternatives:["\u091B\u093F\u092A\u093E"]}]},extraction:{patient:{default:{type:"reference",value:"me"}}}}]}function Il(){return [{id:"hide-it-full",language:"it",command:"hide",priority:100,template:{format:"nascondere {patient} con {style}",tokens:[{type:"literal",value:"nascondere",alternatives:["nascondi","hide"]},{type:"role",role:"patient"},{type:"group",optional:true,tokens:[{type:"literal",value:"con"},{type:"role",role:"style"}]}]},extraction:{patient:{position:1},style:{marker:"con"}}},{id:"hide-it-simple",language:"it",command:"hide",priority:90,template:{format:"nascondere {patient}",tokens:[{type:"literal",value:"nascondere",alternatives:["nascondi","hide"]},{type:"role",role:"patient"}]},extraction:{patient:{position:1}}}]}function $l(){return [{id:"hide-pl-full",language:"pl",command:"hide",priority:100,template:{format:"ukryj {patient} z {style}",tokens:[{type:"literal",value:"ukryj",alternatives:["schowaj","zas\u0142o\u0144","zaslon"]},{type:"role",role:"patient"},{type:"group",optional:true,tokens:[{type:"literal",value:"z",alternatives:["ze","jako"]},{type:"role",role:"style",expectedTypes:["literal"]}]}]},extraction:{patient:{position:1},style:{marker:"z",markerAlternatives:["ze","jako"]}}},{id:"hide-pl-simple",language:"pl",command:"hide",priority:90,template:{format:"ukryj {patient}",tokens:[{type:"literal",value:"ukryj",alternatives:["schowaj","zas\u0142o\u0144","zaslon"]},{type:"role",role:"patient"}]},extraction:{patient:{position:1}}}]}function jl(){return [{id:"hide-ru-full",language:"ru",command:"hide",priority:100,template:{format:"\u0441\u043A\u0440\u044B\u0442\u044C {patient} \u0441 {style}",tokens:[{type:"literal",value:"\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"]},{type:"role",role:"patient"},{type:"group",optional:true,tokens:[{type:"literal",value:"\u0441",alternatives:["\u0441\u043E","\u043A\u0430\u043A"]},{type:"role",role:"style"}]}]},extraction:{patient:{position:1},style:{marker:"\u0441",markerAlternatives:["\u0441\u043E","\u043A\u0430\u043A"]}}},{id:"hide-ru-simple",language:"ru",command:"hide",priority:90,template:{format:"\u0441\u043A\u0440\u044B\u0442\u044C {patient}",tokens:[{type:"literal",value:"\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"]},{type:"role",role:"patient"}]},extraction:{patient:{position:1}}}]}function Wl(){return [{id:"hide-th-simple",language:"th",command:"hide",priority:100,template:{format:"\u0E0B\u0E48\u0E2D\u0E19 {patient}",tokens:[{type:"literal",value:"\u0E0B\u0E48\u0E2D\u0E19"},{type:"role",role:"patient"},{type:"group",optional:true,tokens:[{type:"literal",value:"\u0E14\u0E49\u0E27\u0E22"},{type:"role",role:"style",expectedTypes:["expression","selector"]}]}]},extraction:{patient:{position:1},style:{marker:"\u0E14\u0E49\u0E27\u0E22"}}}]}function ql(){return [{id:"hide-uk-full",language:"uk",command:"hide",priority:100,template:{format:"\u0441\u0445\u043E\u0432\u0430\u0442\u0438 {patient} \u0437 {style}",tokens:[{type:"literal",value:"\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"]},{type:"role",role:"patient"},{type:"group",optional:true,tokens:[{type:"literal",value:"\u0437",alternatives:["\u0456\u0437","\u044F\u043A"]},{type:"role",role:"style",expectedTypes:["literal"]}]}]},extraction:{patient:{position:1},style:{marker:"\u0437",markerAlternatives:["\u0456\u0437","\u044F\u043A"]}}},{id:"hide-uk-simple",language:"uk",command:"hide",priority:90,template:{format:"\u0441\u0445\u043E\u0432\u0430\u0442\u0438 {patient}",tokens:[{type:"literal",value:"\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"]},{type:"role",role:"patient"}]},extraction:{patient:{position:1}}}]}function Vl(){return [{id:"hide-vi-full",language:"vi",command:"hide",priority:100,template:{format:"\u1EA9n {patient} v\u1EDBi {effect}",tokens:[{type:"literal",value:"\u1EA9n",alternatives:["che","gi\u1EA5u"]},{type:"role",role:"patient"},{type:"group",optional:true,tokens:[{type:"literal",value:"v\u1EDBi"},{type:"role",role:"style"}]}]},extraction:{patient:{position:1},style:{marker:"v\u1EDBi"}}},{id:"hide-vi-simple",language:"vi",command:"hide",priority:90,template:{format:"\u1EA9n {patient}",tokens:[{type:"literal",value:"\u1EA9n",alternatives:["che","gi\u1EA5u"]},{type:"role",role:"patient"}]},extraction:{patient:{position:1}}}]}function Kl(){return [{id:"hide-zh-full",language:"zh",command:"hide",priority:100,template:{format:"\u9690\u85CF {patient}",tokens:[{type:"literal",value:"\u9690\u85CF",alternatives:["\u96B1\u85CF","\u85CF\u8D77","\u85CF"]},{type:"role",role:"patient"}]},extraction:{patient:{position:1}}},{id:"hide-zh-ba",language:"zh",command:"hide",priority:95,template:{format:"\u628A {patient} \u9690\u85CF",tokens:[{type:"literal",value:"\u628A"},{type:"role",role:"patient"},{type:"literal",value:"\u9690\u85CF",alternatives:["\u96B1\u85CF","\u85CF\u8D77"]}]},extraction:{patient:{position:1}}},{id:"hide-zh-from",language:"zh",command:"hide",priority:90,template:{format:"\u4ECE {destination} \u9690\u85CF {patient}",tokens:[{type:"literal",value:"\u4ECE",alternatives:["\u5F9E"]},{type:"role",role:"destination"},{type:"literal",value:"\u9690\u85CF",alternatives:["\u96B1\u85CF"]},{type:"role",role:"patient"}]},extraction:{destination:{position:1},patient:{position:3}}}]}function Hl(r){switch(r){case "bn":return Nl();case "de":return Ml();case "hi":return _l();case "it":return Il();case "pl":return $l();case "ru":return jl();case "th":return Wl();case "uk":return ql();case "vi":return Vl();case "zh":return Kl();default:return []}}var ve=[...Nr.roles.find(r=>r.role==="patient")?.expectedTypes??[]];function Ul(){return [{id:"set-bn-full",language:"bn",command:"set",priority:100,template:{format:"{destination} \u0995\u09C7 {patient} \u09A4\u09C7 \u09B8\u09C7\u099F",tokens:[{type:"role",role:"destination"},{type:"literal",value:"\u0995\u09C7"},{type:"role",role:"patient"},{type:"literal",value:"\u09A4\u09C7",alternatives:["\u098F"]},{type:"literal",value:"\u09B8\u09C7\u099F",alternatives:["\u09A8\u09BF\u09B0\u09CD\u09A7\u09BE\u09B0\u09A3"]},{type:"group",optional:true,tokens:[{type:"literal",value:"\u0995\u09B0\u09C1\u09A8"}]}]},extraction:{destination:{position:0},patient:{marker:"\u09A4\u09C7",position:2}}},{id:"set-bn-simple",language:"bn",command:"set",priority:90,template:{format:"\u09B8\u09C7\u099F {destination} {patient}",tokens:[{type:"literal",value:"\u09B8\u09C7\u099F",alternatives:["\u09A8\u09BF\u09B0\u09CD\u09A7\u09BE\u09B0\u09A3"]},{type:"role",role:"destination"},{type:"role",role:"patient"}]},extraction:{destination:{position:1},patient:{position:2}}}]}function Gl(){return [{id:"set-de-full",language:"de",command:"set",priority:100,template:{format:"setze {destination} auf {patient}",tokens:[{type:"literal",value:"setze",alternatives:["set"]},{type:"role",role:"destination",expectedTypes:["property-path","selector","reference","expression"]},{type:"literal",value:"auf",alternatives:["zu","an"]},{type:"role",role:"patient",expectedTypes:ve}]},extraction:{destination:{position:1},patient:{position:3}}},{id:"set-de-festlegen-auf",language:"de",command:"set",priority:99,template:{format:"festlegen auf {destination} {patient}",tokens:[{type:"literal",value:"festlegen",alternatives:["einstellen"]},{type:"literal",value:"auf",alternatives:["an"]},{type:"role",role:"destination",expectedTypes:["property-path","selector","reference","expression"]},{type:"role",role:"patient",expectedTypes:ve}]},extraction:{destination:{position:2},patient:{position:3}}},{id:"set-de-equals",language:"de",command:"set",priority:95,template:{format:"{destination} = {patient}",tokens:[{type:"role",role:"destination",expectedTypes:["property-path","selector","reference","expression"]},{type:"literal",value:"="},{type:"role",role:"patient",expectedTypes:ve}]},extraction:{destination:{position:0},patient:{position:2}}}]}function Zl(){return [{id:"set-es-full",language:"es",command:"set",priority:100,template:{format:"establecer {destination} a {patient}",tokens:[{type:"literal",value:"establecer",alternatives:["fijar","definir","poner","set"]},{type:"role",role:"destination",expectedTypes:["property-path","selector","reference","expression"]},{type:"literal",value:"a",alternatives:["en","como"]},{type:"role",role:"patient",expectedTypes:["literal","expression","reference"]}]},extraction:{destination:{position:1},patient:{position:3}}},{id:"set-es-prep-first",language:"es",command:"set",priority:95,template:{format:"establecer en {destination} {patient}",tokens:[{type:"literal",value:"establecer",alternatives:["fijar","definir","poner","set"]},{type:"literal",value:"en",alternatives:["a"]},{type:"role",role:"destination",expectedTypes:["property-path","selector","reference","expression"]},{type:"role",role:"patient",expectedTypes:["literal","expression","reference"]}]},extraction:{destination:{position:2},patient:{position:3}}},{id:"set-es-equals",language:"es",command:"set",priority:95,template:{format:"{destination} = {patient}",tokens:[{type:"role",role:"destination",expectedTypes:["property-path","selector","reference","expression"]},{type:"literal",value:"="},{type:"role",role:"patient",expectedTypes:["literal","expression","reference"]}]},extraction:{destination:{position:0},patient:{position:2}}}]}function Yl(){return [{id:"set-fr-full",language:"fr",command:"set",priority:100,template:{format:"d\xE9finir {destination} \xE0 {patient}",tokens:[{type:"literal",value:"d\xE9finir",alternatives:["definir","fixer","set"]},{type:"role",role:"destination",expectedTypes:["property-path","selector","reference","expression"]},{type:"literal",value:"\xE0",alternatives:["a","sur","comme"]},{type:"role",role:"patient",expectedTypes:ve}]},extraction:{destination:{position:1},patient:{position:3}}},{id:"set-fr-sur-direct",language:"fr",command:"set",priority:98,template:{format:"d\xE9finir sur {destination} {patient}",tokens:[{type:"literal",value:"d\xE9finir",alternatives:["definir","mettre","fixer"]},{type:"literal",value:"sur",alternatives:["\xE0","en"]},{type:"role",role:"destination",expectedTypes:["property-path","selector","reference","expression"]},{type:"role",role:"patient",expectedTypes:ve}]},extraction:{destination:{position:2},patient:{position:3}}},{id:"set-fr-equals",language:"fr",command:"set",priority:95,template:{format:"{destination} = {patient}",tokens:[{type:"role",role:"destination",expectedTypes:["property-path","selector","reference","expression"]},{type:"literal",value:"="},{type:"role",role:"patient",expectedTypes:ve}]},extraction:{destination:{position:0},patient:{position:2}}}]}function Xl(){return [{id:"set-hi-full",language:"hi",command:"set",priority:100,template:{format:"{destination} \u0915\u094B {patient} \u0938\u0947\u091F \u0915\u0930\u0947\u0902",tokens:[{type:"role",role:"destination"},{type:"literal",value:"\u0915\u094B"},{type:"role",role:"patient"},{type:"literal",value:"\u0938\u0947\u091F",alternatives:["\u0928\u093F\u0930\u094D\u0927\u093E\u0930\u093F\u0924"]},{type:"group",optional:true,tokens:[{type:"literal",value:"\u0915\u0930\u0947\u0902",alternatives:["\u0915\u0930\u094B"]}]}]},extraction:{destination:{position:0},patient:{marker:"\u0915\u094B",position:2}}},{id:"set-hi-simple",language:"hi",command:"set",priority:90,template:{format:"\u0938\u0947\u091F {destination} {patient}",tokens:[{type:"literal",value:"\u0938\u0947\u091F",alternatives:["\u0928\u093F\u0930\u094D\u0927\u093E\u0930\u093F\u0924"]},{type:"role",role:"destination"},{type:"role",role:"patient"}]},extraction:{destination:{position:1},patient:{position:2}}}]}function Jl(){return [{id:"set-id-full",language:"id",command:"set",priority:100,template:{format:"atur {destination} ke {patient}",tokens:[{type:"literal",value:"atur",alternatives:["tetapkan","setel","set"]},{type:"role",role:"destination",expectedTypes:["property-path","selector","reference","expression"]},{type:"literal",value:"ke",alternatives:["menjadi","jadi","pada"]},{type:"role",role:"patient",expectedTypes:ve}]},extraction:{destination:{position:1},patient:{position:3}}},{id:"set-id-pada-direct",language:"id",command:"set",priority:98,template:{format:"atur pada {destination} {patient}",tokens:[{type:"literal",value:"atur",alternatives:["tetapkan","setel"]},{type:"literal",value:"pada",alternatives:["ke","di"]},{type:"role",role:"destination",expectedTypes:["property-path","selector","reference","expression"]},{type:"role",role:"patient",expectedTypes:ve}]},extraction:{destination:{position:2},patient:{position:3}}},{id:"set-id-equals",language:"id",command:"set",priority:95,template:{format:"{destination} = {patient}",tokens:[{type:"role",role:"destination",expectedTypes:["property-path","selector","reference","expression"]},{type:"literal",value:"="},{type:"role",role:"patient",expectedTypes:ve}]},extraction:{destination:{position:0},patient:{position:2}}}]}function Ql(){return [{id:"set-ms-full",language:"ms",command:"set",priority:100,template:{format:"tetapkan {destination} ke {patient}",tokens:[{type:"literal",value:"tetapkan",alternatives:["setkan","set"]},{type:"role",role:"destination",expectedTypes:["property-path","selector","reference","expression"]},{type:"literal",value:"ke",alternatives:["kepada","menjadi","jadi"]},{type:"role",role:"patient",expectedTypes:ve}]},extraction:{destination:{position:1},patient:{position:3}}}]}function ec(){return [{id:"set-it-full",language:"it",command:"set",priority:100,template:{format:"impostare {destination} a {patient}",tokens:[{type:"literal",value:"impostare",alternatives:["imposta","set","definire"]},{type:"role",role:"destination",expectedTypes:["property-path","selector","reference","expression"]},{type:"group",optional:true,tokens:[{type:"literal",value:"a",alternatives:["su","come","in"]},{type:"role",role:"patient"}]}]},extraction:{destination:{position:1},patient:{marker:"a",markerAlternatives:["su","come","in"]}}},{id:"set-it-simple",language:"it",command:"set",priority:90,template:{format:"impostare {destination}",tokens:[{type:"literal",value:"impostare",alternatives:["imposta","set"]},{type:"role",role:"destination"}]},extraction:{destination:{position:1}}}]}function tc(){return [{id:"set-pl-full",language:"pl",command:"set",priority:100,template:{format:"ustaw {destination} na {patient}",tokens:[{type:"literal",value:"ustaw",alternatives:["okre\u015Bl","okresl","przypisz"]},{type:"role",role:"destination",expectedTypes:["property-path","selector","reference","expression"]},{type:"group",optional:true,tokens:[{type:"literal",value:"na",alternatives:["do","jako"]},{type:"role",role:"patient"}]}]},extraction:{destination:{position:1},patient:{marker:"na",markerAlternatives:["do","jako"]}}},{id:"set-pl-simple",language:"pl",command:"set",priority:90,template:{format:"ustaw {destination}",tokens:[{type:"literal",value:"ustaw",alternatives:["okre\u015Bl","okresl"]},{type:"role",role:"destination"}]},extraction:{destination:{position:1}}}]}function rc(){return [{id:"set-pt-full",language:"pt",command:"set",priority:100,template:{format:"definir {destination} para {patient}",tokens:[{type:"literal",value:"definir",alternatives:["estabelecer","set"]},{type:"role",role:"destination",expectedTypes:["property-path","selector","reference","expression"]},{type:"literal",value:"para",alternatives:["como","a","em"]},{type:"role",role:"patient",expectedTypes:ve}]},extraction:{destination:{position:1},patient:{position:3}}},{id:"set-pt-em-direct",language:"pt",command:"set",priority:98,template:{format:"definir em {destination} {patient}",tokens:[{type:"literal",value:"definir",alternatives:["estabelecer"]},{type:"literal",value:"em",alternatives:["para","a"]},{type:"role",role:"destination",expectedTypes:["property-path","selector","reference","expression"]},{type:"role",role:"patient",expectedTypes:ve}]},extraction:{destination:{position:2},patient:{position:3}}},{id:"set-pt-equals",language:"pt",command:"set",priority:95,template:{format:"{destination} = {patient}",tokens:[{type:"role",role:"destination",expectedTypes:["property-path","selector","reference","expression"]},{type:"literal",value:"="},{type:"role",role:"patient",expectedTypes:ve}]},extraction:{destination:{position:0},patient:{position:2}}}]}function ic(){return [{id:"set-ru-full",language:"ru",command:"set",priority:100,template:{format:"\u0443\u0441\u0442\u0430\u043D\u043E\u0432\u0438\u0442\u044C {destination} \u0432 {patient}",tokens:[{type:"literal",value:"\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"]},{type:"role",role:"destination",expectedTypes:["property-path","selector","reference","expression"]},{type:"group",optional:true,tokens:[{type:"literal",value:"\u0432",alternatives:["\u043D\u0430","\u043A\u0430\u043A"]},{type:"role",role:"patient"}]}]},extraction:{destination:{position:1},patient:{marker:"\u0432",markerAlternatives:["\u043D\u0430","\u043A\u0430\u043A"]}}},{id:"set-ru-simple",language:"ru",command:"set",priority:90,template:{format:"\u0443\u0441\u0442\u0430\u043D\u043E\u0432\u0438\u0442\u044C {destination}",tokens:[{type:"literal",value:"\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"]},{type:"role",role:"destination"}]},extraction:{destination:{position:1}}}]}function nc(){return [{id:"set-sw-kwa",language:"sw",command:"set",priority:100,template:{format:"seti {destination} kwa {patient}",tokens:[{type:"literal",value:"seti",alternatives:["weka thamani"]},{type:"role",role:"destination",expectedTypes:["property-path","selector","reference","expression"]},{type:"literal",value:"kwa",alternatives:["kwenye"]},{type:"role",role:"patient",expectedTypes:ve}]},extraction:{destination:{position:1},patient:{marker:"kwa",markerAlternatives:["kwenye"]}}}]}function ac(){return [{id:"set-th-simple",language:"th",command:"set",priority:100,template:{format:"\u0E15\u0E31\u0E49\u0E07 {destination} \u0E43\u0E19 {patient}",tokens:[{type:"literal",value:"\u0E15\u0E31\u0E49\u0E07",alternatives:["\u0E01\u0E33\u0E2B\u0E19\u0E14","\u0E15\u0E31\u0E49\u0E07\u0E04\u0E48\u0E32"]},{type:"role",role:"destination",expectedTypes:["property-path","selector","reference","expression"]},{type:"group",optional:true,tokens:[{type:"literal",value:"\u0E43\u0E19",alternatives:["\u0E40\u0E1B\u0E47\u0E19"]},{type:"role",role:"patient"}]}]},extraction:{destination:{position:1},patient:{marker:"\u0E43\u0E19",markerAlternatives:["\u0E40\u0E1B\u0E47\u0E19"]}}}]}function oc(){return [{id:"set-uk-full",language:"uk",command:"set",priority:100,template:{format:"\u0432\u0441\u0442\u0430\u043D\u043E\u0432\u0438\u0442\u0438 {destination} \u0432 {patient}",tokens:[{type:"literal",value:"\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"]},{type:"role",role:"destination",expectedTypes:["property-path","selector","reference","expression"]},{type:"group",optional:true,tokens:[{type:"literal",value:"\u0432",alternatives:["\u043D\u0430","\u044F\u043A"]},{type:"role",role:"patient"}]}]},extraction:{destination:{position:1},patient:{marker:"\u0432",markerAlternatives:["\u043D\u0430","\u044F\u043A"]}}},{id:"set-uk-simple",language:"uk",command:"set",priority:90,template:{format:"\u0432\u0441\u0442\u0430\u043D\u043E\u0432\u0438\u0442\u0438 {destination}",tokens:[{type:"literal",value:"\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"]},{type:"role",role:"destination"}]},extraction:{destination:{position:1}}}]}function uc(){return [{id:"set-he-full",language:"he",command:"set",priority:100,template:{format:"\u05E7\u05D1\u05E2 \u05D0\u05EA {destination} \u05E2\u05DC {patient}",tokens:[{type:"literal",value:"\u05E7\u05D1\u05E2",alternatives:["\u05D4\u05D2\u05D3\u05E8"]},{type:"literal",value:"\u05D0\u05EA"},{type:"role",role:"destination",expectedTypes:["property-path","selector","reference","expression"]},{type:"literal",value:"\u05E2\u05DC",alternatives:["\u05D1","\u05D0\u05DC","\u05DC","\u05DB"]},{type:"role",role:"patient",expectedTypes:ve}]},extraction:{destination:{marker:"\u05D0\u05EA"},patient:{marker:"\u05E2\u05DC",markerAlternatives:["\u05D1","\u05D0\u05DC","\u05DC","\u05DB"]}}}]}function sc(){return [{id:"set-vi-vao",language:"vi",command:"set",priority:101,template:{format:"g\xE1n {destination} v\xE0o {patient}",tokens:[{type:"literal",value:"g\xE1n",alternatives:["thi\u1EBFt l\u1EADp","\u0111\u1EB7t gi\xE1 tr\u1ECB"]},{type:"role",role:"destination",expectedTypes:["property-path","selector","reference","expression"]},{type:"literal",value:"v\xE0o",alternatives:["cho","\u0111\u1EBFn"]},{type:"role",role:"patient",expectedTypes:["literal","expression","reference","selector"]}]},extraction:{destination:{position:1},patient:{marker:"v\xE0o",markerAlternatives:["cho","\u0111\u1EBFn"]}}},{id:"set-vi-full",language:"vi",command:"set",priority:100,template:{format:"g\xE1n {destination} th\xE0nh {patient}",tokens:[{type:"literal",value:"g\xE1n",alternatives:["thi\u1EBFt l\u1EADp","\u0111\u1EB7t gi\xE1 tr\u1ECB"]},{type:"role",role:"patient"},{type:"literal",value:"th\xE0nh",alternatives:["b\u1EB1ng","l\xE0"]},{type:"role",role:"goal"}]},extraction:{patient:{position:1},goal:{marker:"th\xE0nh",markerAlternatives:["b\u1EB1ng","l\xE0"]}}},{id:"set-vi-simple",language:"vi",command:"set",priority:90,template:{format:"\u0111\u1EB7t {destination} l\xE0 {patient}",tokens:[{type:"literal",value:"\u0111\u1EB7t"},{type:"role",role:"patient"},{type:"literal",value:"l\xE0"},{type:"role",role:"goal"}]},extraction:{patient:{position:1},goal:{marker:"l\xE0"}}}]}function lc(){return [{id:"set-zh-full",language:"zh",command:"set",priority:100,template:{format:"\u8BBE\u7F6E {destination} \u5230 {patient}",tokens:[{type:"literal",value:"\u8BBE\u7F6E",alternatives:["\u8A2D\u7F6E","\u8BBE\u5B9A","\u8A2D\u5B9A"]},{type:"role",role:"destination",expectedTypes:["property-path","selector","reference","expression"]},{type:"literal",value:"\u5230",alternatives:["\u4E3A","\u70BA","\u6210"]},{type:"role",role:"patient",expectedTypes:["literal","expression","reference"]}]},extraction:{destination:{position:1},patient:{marker:"\u5230",markerAlternatives:["\u4E3A","\u70BA","\u6210"]}}},{id:"set-zh-ba",language:"zh",command:"set",priority:95,template:{format:"\u628A {destination} \u8BBE\u7F6E \u5230 {patient}",tokens:[{type:"literal",value:"\u628A"},{type:"role",role:"destination",expectedTypes:["property-path","selector","reference","expression"]},{type:"literal",value:"\u8BBE\u7F6E",alternatives:["\u8A2D\u7F6E","\u8BBE\u5B9A","\u8A2D\u5B9A","\u8BBE\u7F6E\u4E3A","\u8A2D\u7F6E\u70BA","\u8BBE\u5B9A\u4E3A","\u8A2D\u5B9A\u70BA"]},{type:"group",optional:true,tokens:[{type:"literal",value:"\u5230",alternatives:["\u4E3A","\u70BA","\u6210"]}]},{type:"role",role:"patient",expectedTypes:["literal","expression","reference"]}]},extraction:{destination:{position:1},patient:{marker:"\u5230",markerAlternatives:["\u4E3A","\u70BA","\u6210"]}}},{id:"set-zh-vba",language:"zh",command:"set",priority:96,template:{format:"\u8BBE\u7F6E \u628A {destination} \u5230 {patient}",tokens:[{type:"literal",value:"\u8BBE\u7F6E",alternatives:["\u8A2D\u7F6E","\u8BBE\u5B9A","\u8A2D\u5B9A"]},{type:"literal",value:"\u628A"},{type:"role",role:"destination",expectedTypes:["property-path","selector","reference","expression"]},{type:"group",optional:true,tokens:[{type:"literal",value:"\u5230",alternatives:["\u4E3A","\u70BA","\u6210"]}]},{type:"role",role:"patient",expectedTypes:["literal","expression","reference"]}]},extraction:{destination:{position:2},patient:{marker:"\u5230",markerAlternatives:["\u4E3A","\u70BA","\u6210"]}}},{id:"set-zh-simple",language:"zh",command:"set",priority:90,template:{format:"{destination} = {patient}",tokens:[{type:"role",role:"destination",expectedTypes:["property-path","selector","reference","expression"]},{type:"literal",value:"="},{type:"role",role:"patient",expectedTypes:["literal","expression","reference"]}]},extraction:{destination:{position:0},patient:{position:2}}}]}function cc(){return [{id:"set-qu-oblique-source",language:"qu",command:"set",priority:105,template:{format:"{destination} ta {source} manta {patient} man churanay",tokens:[{type:"role",role:"destination",expectedTypes:["property-path","selector","reference","expression"]},{type:"literal",value:"ta"},{type:"role",role:"source",expectedTypes:["selector","reference","expression"]},{type:"literal",value:"manta"},{type:"role",role:"patient",expectedTypes:["literal","expression","reference"]},{type:"literal",value:"man"},{type:"literal",value:"churanay",alternatives:["kamaykuy"]}]},extraction:{destination:{position:0},source:{position:2},patient:{position:4}}}]}function oe(r){return r.map(e=>e.extraction?.scope?e:{...e,template:{...e.template,tokens:[...e.template.tokens,{type:"group",optional:true,tokens:[{type:"literal",value:"on"},{type:"role",role:"scope",optional:true,expectedTypes:["selector","reference"]}]}]},extraction:{...e.extraction,scope:{marker:"on"}}})}function pc(r){switch(r){case "bn":return oe(Ul());case "de":return oe(Gl());case "es":return oe(Zl());case "fr":return oe(Yl());case "he":return oe(uc());case "hi":return oe(Xl());case "id":return oe(Jl());case "ms":return oe(Ql());case "it":return oe(ec());case "pl":return oe(tc());case "pt":return oe(rc());case "qu":return oe(cc());case "ru":return oe(ic());case "sw":return oe(nc());case "th":return oe(ac());case "uk":return oe(oc());case "vi":return oe(sc());case "zh":return oe(lc());default:return []}}var fn=[...pn.roles.find(r=>r.role==="source")?.expectedTypes??[]];function dc(){return [{id:"get-bn-full",language:"bn",command:"get",priority:100,template:{format:"{source} \u09A5\u09C7\u0995\u09C7 \u09AA\u09BE\u09A8",tokens:[{type:"role",role:"source"},{type:"literal",value:"\u09A5\u09C7\u0995\u09C7"},{type:"literal",value:"\u09AA\u09BE\u09A8"}]},extraction:{source:{position:0}}},{id:"get-bn-simple",language:"bn",command:"get",priority:90,template:{format:"\u09AA\u09BE\u09A8 {source}",tokens:[{type:"literal",value:"\u09AA\u09BE\u09A8"},{type:"role",role:"source"}]},extraction:{source:{position:1}}}]}function mc(){return [{id:"get-de-full",language:"de",command:"get",priority:100,template:{format:"hole {source}",tokens:[{type:"literal",value:"hole",alternatives:["holen","get","bekomme","bekommen"]},{type:"role",role:"source",expectedTypes:fn}]},extraction:{source:{position:1}}}]}function fc(){return [{id:"get-hi-full",language:"hi",command:"get",priority:100,template:{format:"{source} \u0938\u0947 \u092A\u094D\u0930\u093E\u092A\u094D\u0924 \u0915\u0930\u0947\u0902",tokens:[{type:"role",role:"source"},{type:"literal",value:"\u0938\u0947"},{type:"literal",value:"\u092A\u094D\u0930\u093E\u092A\u094D\u0924",alternatives:["\u092A\u093E\u090F\u0902"]},{type:"group",optional:true,tokens:[{type:"literal",value:"\u0915\u0930\u0947\u0902",alternatives:["\u0915\u0930\u094B"]}]}]},extraction:{source:{position:0}}},{id:"get-hi-simple",language:"hi",command:"get",priority:90,template:{format:"\u092A\u094D\u0930\u093E\u092A\u094D\u0924 {source}",tokens:[{type:"literal",value:"\u092A\u094D\u0930\u093E\u092A\u094D\u0924",alternatives:["\u092A\u093E\u090F\u0902"]},{type:"role",role:"source"}]},extraction:{source:{position:1}}}]}function yc(){return [{id:"get-it-full",language:"it",command:"get",priority:100,template:{format:"ottenere {patient} da {source}",tokens:[{type:"literal",value:"ottenere",alternatives:["ottieni","get"]},{type:"role",role:"patient"},{type:"group",optional:true,tokens:[{type:"literal",value:"da",alternatives:["di"]},{type:"role",role:"source"}]}]},extraction:{patient:{position:1},source:{marker:"da",markerAlternatives:["di"]}}},{id:"get-it-simple",language:"it",command:"get",priority:90,template:{format:"ottenere {patient}",tokens:[{type:"literal",value:"ottenere",alternatives:["ottieni","get"]},{type:"role",role:"patient"}]},extraction:{patient:{position:1}}}]}function vc(){return [{id:"get-pl-full",language:"pl",command:"get",priority:100,template:{format:"uzyskaj {patient} z {source}",tokens:[{type:"literal",value:"uzyskaj"},{type:"role",role:"patient"},{type:"group",optional:true,tokens:[{type:"literal",value:"z",alternatives:["od","ze"]},{type:"role",role:"source"}]}]},extraction:{patient:{position:1},source:{marker:"z",markerAlternatives:["od","ze"]}}},{id:"get-pl-simple",language:"pl",command:"get",priority:90,template:{format:"uzyskaj {patient}",tokens:[{type:"literal",value:"uzyskaj"},{type:"role",role:"patient"}]},extraction:{patient:{position:1}}}]}function hc(){return [{id:"get-ru-full",language:"ru",command:"get",priority:100,template:{format:"\u043F\u043E\u043B\u0443\u0447\u0438\u0442\u044C {patient} \u0438\u0437 {source}",tokens:[{type:"literal",value:"\u043F\u043E\u043B\u0443\u0447\u0438\u0442\u044C",alternatives:["\u043F\u043E\u043B\u0443\u0447\u0438"]},{type:"role",role:"patient"},{type:"group",optional:true,tokens:[{type:"literal",value:"\u0438\u0437",alternatives:["\u043E\u0442","\u0441"]},{type:"role",role:"source"}]}]},extraction:{patient:{position:1},source:{marker:"\u0438\u0437",markerAlternatives:["\u043E\u0442","\u0441"]}}},{id:"get-ru-simple",language:"ru",command:"get",priority:90,template:{format:"\u043F\u043E\u043B\u0443\u0447\u0438\u0442\u044C {patient}",tokens:[{type:"literal",value:"\u043F\u043E\u043B\u0443\u0447\u0438\u0442\u044C",alternatives:["\u043F\u043E\u043B\u0443\u0447\u0438"]},{type:"role",role:"patient"}]},extraction:{patient:{position:1}}}]}function Ec(){return [{id:"get-th-simple",language:"th",command:"get",priority:100,template:{format:"\u0E23\u0E31\u0E1A\u0E04\u0E48\u0E32 {source}",tokens:[{type:"literal",value:"\u0E23\u0E31\u0E1A\u0E04\u0E48\u0E32"},{type:"role",role:"source"}]},extraction:{source:{position:1}}}]}function gc(){return [{id:"get-uk-full",language:"uk",command:"get",priority:100,template:{format:"\u043E\u0442\u0440\u0438\u043C\u0430\u0442\u0438 {patient} \u0437 {source}",tokens:[{type:"literal",value:"\u043E\u0442\u0440\u0438\u043C\u0430\u0442\u0438",alternatives:["\u043E\u0442\u0440\u0438\u043C\u0430\u0439"]},{type:"role",role:"patient"},{type:"group",optional:true,tokens:[{type:"literal",value:"\u0437",alternatives:["\u0432\u0456\u0434","\u0456\u0437"]},{type:"role",role:"source"}]}]},extraction:{patient:{position:1},source:{marker:"\u0437",markerAlternatives:["\u0432\u0456\u0434","\u0456\u0437"]}}},{id:"get-uk-simple",language:"uk",command:"get",priority:90,template:{format:"\u043E\u0442\u0440\u0438\u043C\u0430\u0442\u0438 {patient}",tokens:[{type:"literal",value:"\u043E\u0442\u0440\u0438\u043C\u0430\u0442\u0438",alternatives:["\u043E\u0442\u0440\u0438\u043C\u0430\u0439"]},{type:"role",role:"patient"}]},extraction:{patient:{position:1}}}]}function kc(){return [{id:"get-vi-full",language:"vi",command:"get",priority:92,template:{format:"l\u1EA5y gi\xE1 tr\u1ECB c\u1EE7a {target}",tokens:[{type:"literal",value:"l\u1EA5y gi\xE1 tr\u1ECB",alternatives:["nh\u1EADn"]},{type:"group",optional:true,tokens:[{type:"literal",value:"c\u1EE7a"}]},{type:"role",role:"patient"}]},extraction:{patient:{position:1}}},{id:"get-vi-simple",language:"vi",command:"get",priority:90,template:{format:"l\u1EA5y gi\xE1 tr\u1ECB {target}",tokens:[{type:"literal",value:"l\u1EA5y gi\xE1 tr\u1ECB",alternatives:["nh\u1EADn"]},{type:"role",role:"patient"}]},extraction:{patient:{position:1}}}]}function zc(){return [{id:"get-zh-ba",language:"zh",command:"get",priority:105,template:{format:"\u83B7\u53D6 \u628A {source}",tokens:[{type:"literal",value:"\u83B7\u53D6",alternatives:["\u83B7\u5F97","\u53D6\u5F97"]},{type:"group",optional:true,tokens:[{type:"literal",value:"\u628A",alternatives:["\u4ECE","\u7531"]}]},{type:"role",role:"source",expectedTypes:fn}]},extraction:{source:{marker:"\u628A",markerAlternatives:["\u4ECE","\u7531"]}}}]}function wc(r){switch(r){case "bn":return dc();case "de":return mc();case "zh":return zc();case "hi":return fc();case "it":return yc();case "pl":return vc();case "ru":return hc();case "th":return Ec();case "uk":return gc();case "vi":return kc();default:return []}}var dt=["selector","reference","expression","property-path"];function bc(){return [{id:"increment-bn-full",language:"bn",command:"increment",priority:100,template:{format:"{patient} \u0995\u09C7 \u09AC\u09C3\u09A6\u09CD\u09A7\u09BF \u0995\u09B0\u09C1\u09A8",tokens:[{type:"role",role:"patient"},{type:"literal",value:"\u0995\u09C7"},{type:"literal",value:"\u09AC\u09C3\u09A6\u09CD\u09A7\u09BF",alternatives:["\u09AC\u09BE\u09A1\u09BC\u09BE\u09A8"]},{type:"literal",value:"\u0995\u09B0\u09C1\u09A8"}]},extraction:{patient:{position:0}}},{id:"increment-bn-with-quantity",language:"bn",command:"increment",priority:95,template:{format:"{patient} \u0995\u09C7 {quantity} \u09A6\u09BF\u09AF\u09BC\u09C7 \u09AC\u09C3\u09A6\u09CD\u09A7\u09BF \u0995\u09B0\u09C1\u09A8",tokens:[{type:"role",role:"patient"},{type:"literal",value:"\u0995\u09C7"},{type:"role",role:"quantity"},{type:"literal",value:"\u09A6\u09BF\u09AF\u09BC\u09C7"},{type:"literal",value:"\u09AC\u09C3\u09A6\u09CD\u09A7\u09BF",alternatives:["\u09AC\u09BE\u09A1\u09BC\u09BE\u09A8"]},{type:"literal",value:"\u0995\u09B0\u09C1\u09A8"}]},extraction:{patient:{position:0},quantity:{marker:"\u09A6\u09BF\u09AF\u09BC\u09C7",position:2}}},{id:"increment-bn-simple",language:"bn",command:"increment",priority:90,template:{format:"\u09AC\u09C3\u09A6\u09CD\u09A7\u09BF {patient}",tokens:[{type:"literal",value:"\u09AC\u09C3\u09A6\u09CD\u09A7\u09BF",alternatives:["\u09AC\u09BE\u09A1\u09BC\u09BE\u09A8"]},{type:"role",role:"patient"}]},extraction:{patient:{position:1}}}]}function Cc(){let r=["erhoehe","erh\xF6hen","inkrementiere","inkrementieren","increment"];return [{id:"increment-de-with-quantity",language:"de",command:"increment",priority:105,template:{format:"erh\xF6he {patient} um {quantity}",tokens:[{type:"literal",value:"erh\xF6he",alternatives:r},{type:"role",role:"patient",expectedTypes:dt},{type:"literal",value:"um"},{type:"role",role:"quantity"}]},extraction:{patient:{position:1},quantity:{marker:"um",position:3}}},{id:"increment-de-full",language:"de",command:"increment",priority:100,template:{format:"erh\xF6he {patient}",tokens:[{type:"literal",value:"erh\xF6he",alternatives:r},{type:"role",role:"patient",expectedTypes:dt}]},extraction:{patient:{position:1}}}]}function Ac(){return [{id:"increment-hi-full",language:"hi",command:"increment",priority:100,template:{format:"{patient} \u0915\u094B \u092C\u0922\u093C\u093E\u090F\u0902",tokens:[{type:"role",role:"patient"},{type:"literal",value:"\u0915\u094B"},{type:"literal",value:"\u092C\u0922\u093C\u093E\u090F\u0902",alternatives:["\u092C\u0922\u093C\u093E"]}]},extraction:{patient:{position:0}}},{id:"increment-hi-with-quantity",language:"hi",command:"increment",priority:95,template:{format:"{patient} \u0915\u094B {quantity} \u0938\u0947 \u092C\u0922\u093C\u093E\u090F\u0902",tokens:[{type:"role",role:"patient"},{type:"literal",value:"\u0915\u094B"},{type:"role",role:"quantity"},{type:"literal",value:"\u0938\u0947"},{type:"literal",value:"\u092C\u0922\u093C\u093E\u090F\u0902",alternatives:["\u092C\u0922\u093C\u093E"]}]},extraction:{patient:{position:0},quantity:{marker:"\u0938\u0947",position:2}}},{id:"increment-hi-simple",language:"hi",command:"increment",priority:90,template:{format:"\u092C\u0922\u093C\u093E\u090F\u0902 {patient}",tokens:[{type:"literal",value:"\u092C\u0922\u093C\u093E\u090F\u0902",alternatives:["\u092C\u0922\u093C\u093E"]},{type:"role",role:"patient"}]},extraction:{patient:{position:1}}}]}function xc(){return [{id:"increment-it-full",language:"it",command:"increment",priority:100,template:{format:"incrementare {patient} di {quantity}",tokens:[{type:"literal",value:"incrementare",alternatives:["incrementa","aumentare","increment"]},{type:"role",role:"patient"},{type:"group",optional:true,tokens:[{type:"literal",value:"di",alternatives:["per"]},{type:"role",role:"quantity"}]}]},extraction:{patient:{position:1},quantity:{marker:"di",markerAlternatives:["per"],default:{type:"literal",value:1}}}},{id:"increment-it-simple",language:"it",command:"increment",priority:90,template:{format:"incrementare {patient}",tokens:[{type:"literal",value:"incrementare",alternatives:["incrementa","aumentare","increment"]},{type:"role",role:"patient"}]},extraction:{patient:{position:1},quantity:{default:{type:"literal",value:1}}}}]}function Dc(){return [{id:"increment-pl-full",language:"pl",command:"increment",priority:100,template:{format:"zwi\u0119ksz {patient} o {quantity}",tokens:[{type:"literal",value:"zwi\u0119ksz",alternatives:["zwieksz","podnie\u015B","podnies"]},{type:"role",role:"patient"},{type:"group",optional:true,tokens:[{type:"literal",value:"o"},{type:"role",role:"quantity"}]}]},extraction:{patient:{position:1},quantity:{marker:"o",default:{type:"literal",value:1}}}},{id:"increment-pl-simple",language:"pl",command:"increment",priority:90,template:{format:"zwi\u0119ksz {patient}",tokens:[{type:"literal",value:"zwi\u0119ksz",alternatives:["zwieksz","podnie\u015B","podnies"]},{type:"role",role:"patient"}]},extraction:{patient:{position:1},quantity:{default:{type:"literal",value:1}}}}]}function Sc(){return [{id:"increment-ru-full",language:"ru",command:"increment",priority:100,template:{format:"\u0443\u0432\u0435\u043B\u0438\u0447\u0438\u0442\u044C {patient} \u043D\u0430 {quantity}",tokens:[{type:"literal",value:"\u0443\u0432\u0435\u043B\u0438\u0447\u0438\u0442\u044C",alternatives:["\u0443\u0432\u0435\u043B\u0438\u0447\u044C"]},{type:"role",role:"patient"},{type:"group",optional:true,tokens:[{type:"literal",value:"\u043D\u0430"},{type:"role",role:"quantity"}]}]},extraction:{patient:{position:1},quantity:{marker:"\u043D\u0430",default:{type:"literal",value:1}}}},{id:"increment-ru-simple",language:"ru",command:"increment",priority:90,template:{format:"\u0443\u0432\u0435\u043B\u0438\u0447\u0438\u0442\u044C {patient}",tokens:[{type:"literal",value:"\u0443\u0432\u0435\u043B\u0438\u0447\u0438\u0442\u044C",alternatives:["\u0443\u0432\u0435\u043B\u0438\u0447\u044C"]},{type:"role",role:"patient"}]},extraction:{patient:{position:1},quantity:{default:{type:"literal",value:1}}}}]}function Bc(){return [{id:"increment-th-simple",language:"th",command:"increment",priority:90,template:{format:"\u0E40\u0E1E\u0E34\u0E48\u0E21\u0E04\u0E48\u0E32 {patient}",tokens:[{type:"literal",value:"\u0E40\u0E1E\u0E34\u0E48\u0E21\u0E04\u0E48\u0E32"},{type:"role",role:"patient"}]},extraction:{patient:{position:1}}},{id:"increment-th-with-quantity",language:"th",command:"increment",priority:95,template:{format:"\u0E40\u0E1E\u0E34\u0E48\u0E21\u0E04\u0E48\u0E32 {patient} \u0E14\u0E49\u0E27\u0E22 {quantity}",tokens:[{type:"literal",value:"\u0E40\u0E1E\u0E34\u0E48\u0E21\u0E04\u0E48\u0E32"},{type:"role",role:"patient"},{type:"literal",value:"\u0E14\u0E49\u0E27\u0E22"},{type:"role",role:"quantity"}]},extraction:{patient:{position:1},quantity:{marker:"\u0E14\u0E49\u0E27\u0E22",position:3}}}]}function Tc(){return [{id:"increment-uk-full",language:"uk",command:"increment",priority:100,template:{format:"\u0437\u0431\u0456\u043B\u044C\u0448\u0438\u0442\u0438 {patient} \u043D\u0430 {quantity}",tokens:[{type:"literal",value:"\u0437\u0431\u0456\u043B\u044C\u0448\u0438\u0442\u0438",alternatives:["\u0437\u0431\u0456\u043B\u044C\u0448"]},{type:"role",role:"patient"},{type:"group",optional:true,tokens:[{type:"literal",value:"\u043D\u0430"},{type:"role",role:"quantity"}]}]},extraction:{patient:{position:1},quantity:{marker:"\u043D\u0430",default:{type:"literal",value:1}}}},{id:"increment-uk-simple",language:"uk",command:"increment",priority:90,template:{format:"\u0437\u0431\u0456\u043B\u044C\u0448\u0438\u0442\u0438 {patient}",tokens:[{type:"literal",value:"\u0437\u0431\u0456\u043B\u044C\u0448\u0438\u0442\u0438",alternatives:["\u0437\u0431\u0456\u043B\u044C\u0448"]},{type:"role",role:"patient"}]},extraction:{patient:{position:1},quantity:{default:{type:"literal",value:1}}}}]}function Fc(){return [{id:"increment-vi-full",language:"vi",command:"increment",priority:100,template:{format:"t\u0103ng {target} th\xEAm {amount}",tokens:[{type:"literal",value:"t\u0103ng",alternatives:["t\u0103ng l\xEAn"]},{type:"role",role:"patient"},{type:"group",optional:true,tokens:[{type:"literal",value:"th\xEAm",alternatives:["l\xEAn"]},{type:"role",role:"quantity"}]}]},extraction:{patient:{position:1},quantity:{marker:"th\xEAm",markerAlternatives:["l\xEAn"],default:{type:"literal",value:1}}}},{id:"increment-vi-simple",language:"vi",command:"increment",priority:90,template:{format:"t\u0103ng {target}",tokens:[{type:"literal",value:"t\u0103ng",alternatives:["t\u0103ng l\xEAn"]},{type:"role",role:"patient"}]},extraction:{patient:{position:1},quantity:{default:{type:"literal",value:1}}}}]}function Pc(){return [{id:"increment-qu-sov",language:"qu",command:"increment",priority:100,template:{format:"{patient} ta yapachiy",tokens:[{type:"role",role:"patient"},{type:"literal",value:"ta"},{type:"literal",value:"yapachiy"}]},extraction:{patient:{position:0},quantity:{default:{type:"literal",value:1}}}},{id:"increment-qu-simple",language:"qu",command:"increment",priority:90,template:{format:"yapachiy {patient}",tokens:[{type:"literal",value:"yapachiy"},{type:"role",role:"patient"}]},extraction:{patient:{position:1},quantity:{default:{type:"literal",value:1}}}}]}function Rc(){return [{id:"increment-zh-full",language:"zh",command:"increment",priority:100,template:{format:"\u589E\u52A0 {patient}",tokens:[{type:"literal",value:"\u589E\u52A0",alternatives:["\u9012\u589E","\u52A0","\u589E","increment"]},{type:"role",role:"patient",expectedTypes:dt}]},extraction:{patient:{position:1}}}]}function Oc(r){switch(r){case "bn":return bc();case "de":return Cc();case "hi":return Ac();case "it":return xc();case "pl":return Dc();case "ru":return Sc();case "th":return Bc();case "uk":return Tc();case "qu":return Pc();case "vi":return Fc();case "zh":return Rc();default:return []}}function Lc(){return [{id:"decrement-bn-full",language:"bn",command:"decrement",priority:100,template:{format:"{patient} \u0995\u09C7 \u09B9\u09CD\u09B0\u09BE\u09B8 \u0995\u09B0\u09C1\u09A8",tokens:[{type:"role",role:"patient"},{type:"literal",value:"\u0995\u09C7"},{type:"literal",value:"\u09B9\u09CD\u09B0\u09BE\u09B8",alternatives:["\u0995\u09AE\u09BE\u09A8"]},{type:"literal",value:"\u0995\u09B0\u09C1\u09A8"}]},extraction:{patient:{position:0}}},{id:"decrement-bn-with-quantity",language:"bn",command:"decrement",priority:95,template:{format:"{patient} \u0995\u09C7 {quantity} \u09A6\u09BF\u09AF\u09BC\u09C7 \u09B9\u09CD\u09B0\u09BE\u09B8 \u0995\u09B0\u09C1\u09A8",tokens:[{type:"role",role:"patient"},{type:"literal",value:"\u0995\u09C7"},{type:"role",role:"quantity"},{type:"literal",value:"\u09A6\u09BF\u09AF\u09BC\u09C7"},{type:"literal",value:"\u09B9\u09CD\u09B0\u09BE\u09B8",alternatives:["\u0995\u09AE\u09BE\u09A8"]},{type:"literal",value:"\u0995\u09B0\u09C1\u09A8"}]},extraction:{patient:{position:0},quantity:{marker:"\u09A6\u09BF\u09AF\u09BC\u09C7",position:2}}},{id:"decrement-bn-simple",language:"bn",command:"decrement",priority:90,template:{format:"\u09B9\u09CD\u09B0\u09BE\u09B8 {patient}",tokens:[{type:"literal",value:"\u09B9\u09CD\u09B0\u09BE\u09B8",alternatives:["\u0995\u09AE\u09BE\u09A8"]},{type:"role",role:"patient"}]},extraction:{patient:{position:1}}}]}function Nc(){let r=["verringern","dekrementiere","dekrementieren","reduziere","decrement"];return [{id:"decrement-de-with-quantity",language:"de",command:"decrement",priority:105,template:{format:"verringere {patient} um {quantity}",tokens:[{type:"literal",value:"verringere",alternatives:r},{type:"role",role:"patient",expectedTypes:dt},{type:"literal",value:"um"},{type:"role",role:"quantity"}]},extraction:{patient:{position:1},quantity:{marker:"um",position:3}}},{id:"decrement-de-full",language:"de",command:"decrement",priority:100,template:{format:"verringere {patient}",tokens:[{type:"literal",value:"verringere",alternatives:r},{type:"role",role:"patient",expectedTypes:dt}]},extraction:{patient:{position:1}}}]}function Mc(){return [{id:"decrement-hi-full",language:"hi",command:"decrement",priority:100,template:{format:"{patient} \u0915\u094B \u0918\u091F\u093E\u090F\u0902",tokens:[{type:"role",role:"patient"},{type:"literal",value:"\u0915\u094B"},{type:"literal",value:"\u0918\u091F\u093E\u090F\u0902",alternatives:["\u0918\u091F\u093E"]}]},extraction:{patient:{position:0}}},{id:"decrement-hi-with-quantity",language:"hi",command:"decrement",priority:95,template:{format:"{patient} \u0915\u094B {quantity} \u0938\u0947 \u0918\u091F\u093E\u090F\u0902",tokens:[{type:"role",role:"patient"},{type:"literal",value:"\u0915\u094B"},{type:"role",role:"quantity"},{type:"literal",value:"\u0938\u0947"},{type:"literal",value:"\u0918\u091F\u093E\u090F\u0902",alternatives:["\u0918\u091F\u093E"]}]},extraction:{patient:{position:0},quantity:{marker:"\u0938\u0947",position:2}}},{id:"decrement-hi-simple",language:"hi",command:"decrement",priority:90,template:{format:"\u0918\u091F\u093E\u090F\u0902 {patient}",tokens:[{type:"literal",value:"\u0918\u091F\u093E\u090F\u0902",alternatives:["\u0918\u091F\u093E"]},{type:"role",role:"patient"}]},extraction:{patient:{position:1}}}]}function _c(){return [{id:"decrement-it-full",language:"it",command:"decrement",priority:100,template:{format:"decrementare {patient} di {quantity}",tokens:[{type:"literal",value:"decrementare",alternatives:["decrementa","diminuire","decrement"]},{type:"role",role:"patient"},{type:"group",optional:true,tokens:[{type:"literal",value:"di",alternatives:["per"]},{type:"role",role:"quantity"}]}]},extraction:{patient:{position:1},quantity:{marker:"di",markerAlternatives:["per"],default:{type:"literal",value:"1"}}}},{id:"decrement-it-simple",language:"it",command:"decrement",priority:90,template:{format:"decrementare {patient}",tokens:[{type:"literal",value:"decrementare",alternatives:["decrementa","diminuire","decrement"]},{type:"role",role:"patient"}]},extraction:{patient:{position:1},quantity:{default:{type:"literal",value:"1"}}}}]}function Ic(){return [{id:"decrement-pl-full",language:"pl",command:"decrement",priority:100,template:{format:"zmniejsz {patient} o {quantity}",tokens:[{type:"literal",value:"zmniejsz",alternatives:["obni\u017C","obniz"]},{type:"role",role:"patient"},{type:"group",optional:true,tokens:[{type:"literal",value:"o"},{type:"role",role:"quantity"}]}]},extraction:{patient:{position:1},quantity:{marker:"o",default:{type:"literal",value:1}}}},{id:"decrement-pl-simple",language:"pl",command:"decrement",priority:90,template:{format:"zmniejsz {patient}",tokens:[{type:"literal",value:"zmniejsz",alternatives:["obni\u017C","obniz"]},{type:"role",role:"patient"}]},extraction:{patient:{position:1},quantity:{default:{type:"literal",value:1}}}}]}function $c(){return [{id:"decrement-ru-full",language:"ru",command:"decrement",priority:100,template:{format:"\u0443\u043C\u0435\u043D\u044C\u0448\u0438\u0442\u044C {patient} \u043D\u0430 {quantity}",tokens:[{type:"literal",value:"\u0443\u043C\u0435\u043D\u044C\u0448\u0438\u0442\u044C",alternatives:["\u0443\u043C\u0435\u043D\u044C\u0448\u0438"]},{type:"role",role:"patient"},{type:"group",optional:true,tokens:[{type:"literal",value:"\u043D\u0430"},{type:"role",role:"quantity"}]}]},extraction:{patient:{position:1},quantity:{marker:"\u043D\u0430",default:{type:"literal",value:1}}}},{id:"decrement-ru-simple",language:"ru",command:"decrement",priority:90,template:{format:"\u0443\u043C\u0435\u043D\u044C\u0448\u0438\u0442\u044C {patient}",tokens:[{type:"literal",value:"\u0443\u043C\u0435\u043D\u044C\u0448\u0438\u0442\u044C",alternatives:["\u0443\u043C\u0435\u043D\u044C\u0448\u0438"]},{type:"role",role:"patient"}]},extraction:{patient:{position:1},quantity:{default:{type:"literal",value:1}}}}]}function jc(){return [{id:"decrement-th-simple",language:"th",command:"decrement",priority:90,template:{format:"\u0E25\u0E14\u0E04\u0E48\u0E32 {patient}",tokens:[{type:"literal",value:"\u0E25\u0E14\u0E04\u0E48\u0E32"},{type:"role",role:"patient"}]},extraction:{patient:{position:1}}},{id:"decrement-th-with-quantity",language:"th",command:"decrement",priority:95,template:{format:"\u0E25\u0E14\u0E04\u0E48\u0E32 {patient} \u0E14\u0E49\u0E27\u0E22 {quantity}",tokens:[{type:"literal",value:"\u0E25\u0E14\u0E04\u0E48\u0E32"},{type:"role",role:"patient"},{type:"literal",value:"\u0E14\u0E49\u0E27\u0E22"},{type:"role",role:"quantity"}]},extraction:{patient:{position:1},quantity:{marker:"\u0E14\u0E49\u0E27\u0E22",position:3}}}]}function Wc(){return [{id:"decrement-uk-full",language:"uk",command:"decrement",priority:100,template:{format:"\u0437\u043C\u0435\u043D\u0448\u0438\u0442\u0438 {patient} \u043D\u0430 {quantity}",tokens:[{type:"literal",value:"\u0437\u043C\u0435\u043D\u0448\u0438\u0442\u0438",alternatives:["\u0437\u043C\u0435\u043D\u0448"]},{type:"role",role:"patient"},{type:"group",optional:true,tokens:[{type:"literal",value:"\u043D\u0430"},{type:"role",role:"quantity"}]}]},extraction:{patient:{position:1},quantity:{marker:"\u043D\u0430",default:{type:"literal",value:1}}}},{id:"decrement-uk-simple",language:"uk",command:"decrement",priority:90,template:{format:"\u0437\u043C\u0435\u043D\u0448\u0438\u0442\u0438 {patient}",tokens:[{type:"literal",value:"\u0437\u043C\u0435\u043D\u0448\u0438\u0442\u0438",alternatives:["\u0437\u043C\u0435\u043D\u0448"]},{type:"role",role:"patient"}]},extraction:{patient:{position:1},quantity:{default:{type:"literal",value:1}}}}]}function qc(){return [{id:"decrement-vi-full",language:"vi",command:"decrement",priority:100,template:{format:"gi\u1EA3m {target} \u0111i {amount}",tokens:[{type:"literal",value:"gi\u1EA3m",alternatives:["gi\u1EA3m \u0111i"]},{type:"role",role:"patient"},{type:"group",optional:true,tokens:[{type:"literal",value:"\u0111i",alternatives:["xu\u1ED1ng"]},{type:"role",role:"quantity"}]}]},extraction:{patient:{position:1},quantity:{marker:"\u0111i",markerAlternatives:["xu\u1ED1ng"],default:{type:"literal",value:"1"}}}},{id:"decrement-vi-simple",language:"vi",command:"decrement",priority:90,template:{format:"gi\u1EA3m {target}",tokens:[{type:"literal",value:"gi\u1EA3m",alternatives:["gi\u1EA3m \u0111i"]},{type:"role",role:"patient"}]},extraction:{patient:{position:1},quantity:{default:{type:"literal",value:"1"}}}}]}function Vc(){return [{id:"decrement-zh-full",language:"zh",command:"decrement",priority:100,template:{format:"\u51CF\u5C11 {patient}",tokens:[{type:"literal",value:"\u51CF\u5C11",alternatives:["\u9012\u51CF","\u51CF","\u964D\u4F4E","decrement"]},{type:"role",role:"patient",expectedTypes:dt}]},extraction:{patient:{position:1}}}]}function Kc(r){switch(r){case "bn":return Lc();case "de":return Nc();case "hi":return Mc();case "it":return _c();case "pl":return Ic();case "ru":return $c();case "th":return jc();case "uk":return Wc();case "vi":return qc();case "zh":return Vc();default:return []}}function Hc(){return [{id:"wait-zh-ba",language:"zh",command:"wait",priority:105,template:{format:"\u7B49\u5F85 \u628A {duration}",tokens:[{type:"literal",value:"\u7B49\u5F85",alternatives:["\u7B49","\u7A0D\u5019"]},{type:"literal",value:"\u628A"},{type:"role",role:"duration",expectedTypes:["literal","expression"]}]},extraction:{duration:{position:2}}}]}function Uc(){return [{id:"wait-he-et",language:"he",command:"wait",priority:105,template:{format:"\u05D7\u05DB\u05D4 \u05D0\u05EA {duration}",tokens:[{type:"literal",value:"\u05D7\u05DB\u05D4",alternatives:["\u05D4\u05DE\u05EA\u05DF"]},{type:"literal",value:"\u05D0\u05EA"},{type:"role",role:"duration",expectedTypes:["literal","expression"]}]},extraction:{duration:{position:2}}}]}function Gc(){return [{id:"wait-ar-from-first",language:"ar",command:"wait",priority:105,template:{format:"\u0627\u0646\u062A\u0638\u0631 \u0645\u0646 {source} {duration}",tokens:[{type:"literal",value:"\u0627\u0646\u062A\u0638\u0631",alternatives:["\u0627\u0646\u062A\u0638\u0631\u064A"]},{type:"literal",value:"\u0645\u0646"},{type:"role",role:"source",expectedTypes:["expression","reference"]},{type:"role",role:"duration",expectedTypes:["expression","literal"]}]},extraction:{source:{position:2},duration:{position:3}}}]}function Zc(){return [{id:"wait-en-for-event",language:"en",command:"wait",priority:110,template:{format:"wait for {event}",tokens:[{type:"literal",value:"wait"},{type:"literal",value:"for"},{type:"role",role:"event",expectedTypes:["literal","expression"]}]},extraction:{event:{position:2}}}]}function Yc(){return [{id:"wait-tl-from-first",language:"tl",command:"wait",priority:105,template:{format:"maghintay mula_sa {source} {duration}",tokens:[{type:"literal",value:"maghintay",alternatives:["hintay"]},{type:"literal",value:"mula_sa",alternatives:["galing_sa"]},{type:"role",role:"source",expectedTypes:["expression","reference"]},{type:"role",role:"duration",expectedTypes:["expression","literal"]}]},extraction:{source:{position:2},duration:{position:3}}}]}function Jt(r,e,t,i,n,a,o){let u=()=>({type:"group",optional:true,tokens:[{type:"literal",value:"("},...Array.from({length:a},(s,l)=>[...l>0?[{type:"literal",value:","}]:[],{type:"role",role:"condition",expectedTypes:["expression","literal","reference"]}]).flat(),{type:"literal",value:")"}]});return {id:r,language:e,command:"wait",priority:105,template:{format:`{source} ${i} {duration} ${n} {patient} ${t}`,tokens:[{type:"role",role:"source",expectedTypes:["expression","reference"]},{type:"literal",value:i,...o?{alternatives:o}:{}},{type:"role",role:"duration",expectedTypes:["expression","literal"]},u(),{type:"literal",value:n},{type:"role",role:"patient",expectedTypes:["expression","literal"]},u(),{type:"literal",value:t}]},extraction:{source:{position:0},duration:{position:2}}}}function fi(r,e,t,i,n,a,o){let u=()=>({type:"group",optional:true,tokens:[{type:"literal",value:"("},...Array.from({length:o},(l,c)=>[...c>0?[{type:"literal",value:","}]:[],{type:"role",role:"condition",expectedTypes:["expression","literal","reference"]}]).flat(),{type:"literal",value:")"}]}),s=()=>({type:"group",optional:true,tokens:[{type:"literal",value:n}]});return {id:r,language:e,command:"wait",priority:105,template:{format:`${t} {duration} ${i} [${n}] {patient} [${n}] {source} ${a}`,tokens:[{type:"literal",value:t},{type:"role",role:"duration",expectedTypes:["expression","literal"]},u(),{type:"literal",value:i},s(),{type:"role",role:"patient",expectedTypes:["expression","literal"]},u(),s(),{type:"role",role:"source",expectedTypes:["expression","reference"]},{type:"literal",value:a}]},extraction:{duration:{position:1},source:{position:8}}}}function Xc(){return [fi("wait-bn-or-run","bn","\u0985\u09AA\u09C7\u0995\u09CD\u09B7\u09BE","\u0985\u09A5\u09AC\u09BE","\u099C\u09A8\u09CD\u09AF","\u09A5\u09C7\u0995\u09C7",1),fi("wait-bn-or-run-2arg","bn","\u0985\u09AA\u09C7\u0995\u09CD\u09B7\u09BE","\u0985\u09A5\u09AC\u09BE","\u099C\u09A8\u09CD\u09AF","\u09A5\u09C7\u0995\u09C7",2)]}function Jc(){return [Jt("wait-tr-or-run","tr","bekle","den","veya",1,["dan","ten","tan"]),Jt("wait-tr-or-run-2arg","tr","bekle","den","veya",2,["dan","ten","tan"])]}function Qc(){return [Jt("wait-qu-or-run","qu","suyay","manta","utaq",1),Jt("wait-qu-or-run-2arg","qu","suyay","manta","utaq",2)]}function ep(r){switch(r){case "en":return Zc();case "zh":return Hc();case "he":return Uc();case "ar":return Gc();case "bn":return Xc();case "tl":return Yc();case "tr":return Jc();case "qu":return Qc();default:return []}}var yn=new Set(["me","my","myself","you","your","yourself","it","its","result","event","target","body","detail","window","document","true","false","null","undefined","empty"]),Je=new Map,Ie=new Map,xt=new Map,Cr=null;function vn(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]=vn(a,n):t[i]=n);}return t}function tp(r,e){return vn(r,e)}function $r(r){if(!r.extends)return r;let e=Ie.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=$r(e);return tp(t,r)}function Ge(r,e,t){Je.set(r,e),Ie.set(r,t),xt.delete(r);}function rp(r){Cr=r;}var yi=new Map;function mt(r){return r.split("-")[0]}function ft(r){return r.includes("-")}function ip(r){let e=Je.get(r);if(!e&&ft(r)){let t=mt(r);e=Je.get(t);}if(!e){let t=Array.from(Je.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 np(r){let e=Ie.get(r);if(!e&&ft(r)){let t=mt(r);e=Ie.get(t);}if(!e){let t=Array.from(Ie.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 $r(e)}function T(r){let e=Ie.get(r);return !e&&ft(r)&&(e=Ie.get(mt(r))),e?$r(e):void 0}function ap(){return Array.from(Je.keys())}function hn(r){if(Je.has(r)&&Ie.has(r))return true;if(ft(r)){let e=mt(r);return Je.has(e)&&Ie.has(e)}return false}function op(r,e){let i=ip(e).tokenize(r);return e==="en"?i:sp(i,e)}var En=()=>false;function up(r){En=r;}function sp(r,e){let t=r.tokens,i=[],n=false;for(let a=0;a<t.length;a++){let o=t[a],u=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(m=>m.value).join(""),p=l[0],d=l[l.length-1];if(o.value==="("&&p&&d&&t[s]?.value===")"&&/^[\p{L}_$][\p{L}\p{M}\p{N}_$]*$/u.test(c)&&!(p.kind!=="particle"&&yn.has((p.normalized??p.value).toLowerCase()))&&En(c,e)&&o.position.end===p.position.start&&d.position.end===t[s].position.start&&!(u&&u.position.end===o.position.start&&/[\p{L}\p{N}_)\]]$/u.test(u.value))){i.push({value:`(${c})`,kind:"identifier",position:{...o.position,end:t[s].position.end}}),a=s,n=true;continue}i.push(o);}return n?new me(i,e):r}function ye(r){let e=xt.get(r);if(!e&&ft(r)&&(e=xt.get(mt(r))),e)return e;let t=yi.get(r);if(!t&&ft(r)&&(t=yi.get(mt(r))),t)return xt.set(r,t),t;if(!Cr)throw new Error(`No patterns registered for language '${r}'. Either import the language module or set a pattern generator.`);let i=np(r),n=Cr(i);return xt.set(r,n),n}function Et(r){let e=T(r)?.roleMarkers?.style;if(!e?.primary)return null;let t={type:"literal",value:e.primary,...e.alternatives?.length?{alternatives:e.alternatives}:{}},i={type:"role",role:"style",expectedTypes:["expression"]};return {token:{type:"group",optional:true,tokens:e.position==="after"?[i,t]:[t,i]},extraction:{marker:e.primary,...e.alternatives?.length?{markerAlternatives:e.alternatives}:{}}}}function cp(){let r=Et("zh");return [{id:"fetch-zh-ba",language:"zh",command:"fetch",priority:105,template:{format:"\u6293\u53D6 \u628A {source} \u7684 {responseType}",tokens:[{type:"literal",value:"\u6293\u53D6",alternatives:["\u53D6"]},{type:"group",optional:true,tokens:[{type:"literal",value:"\u628A",alternatives:["\u4ECE","\u7531"]}]},{type:"role",role:"source",expectedTypes:["literal","expression"]},...r?[r.token]:[],{type:"group",optional:true,tokens:[{type:"literal",value:"\u7684",alternatives:["\u4F5C\u4E3A","\u5F53\u4F5C"]},{type:"role",role:"responseType",expectedTypes:["literal","expression"]}]}]},extraction:{source:{marker:"\u628A",markerAlternatives:["\u4ECE","\u7531"]},...r?{style:r.extraction}:{},responseType:{marker:"\u7684",markerAlternatives:["\u4F5C\u4E3A","\u5F53\u4F5C"]}}}]}function pp(){let r=Et("ms");return [{id:"fetch-ms",language:"ms",command:"fetch",priority:105,template:{format:"ambil_dari dari {source} sebagai {responseType}",tokens:[{type:"literal",value:"ambil_dari",alternatives:["muat","ambil"]},{type:"group",optional:true,tokens:[{type:"literal",value:"dari"}]},{type:"role",role:"source",expectedTypes:["literal","expression"]},...r?[r.token]:[],{type:"group",optional:true,tokens:[{type:"literal",value:"sebagai",alternatives:["sbg"]},{type:"role",role:"responseType",expectedTypes:["literal","expression"]}]}]},extraction:{source:{marker:"dari"},...r?{style:r.extraction}:{},responseType:{marker:"sebagai",markerAlternatives:["sbg"]}}}]}function dp(){let r=Et("fr");return [{id:"fetch-fr",language:"fr",command:"fetch",priority:105,template:{format:"chercher de {source} comme {responseType}",tokens:[{type:"literal",value:"chercher",alternatives:["r\xE9cup\xE9rer"]},{type:"group",optional:true,tokens:[{type:"literal",value:"de"}]},{type:"role",role:"source",expectedTypes:["literal","expression"]},...r?[r.token]:[],{type:"group",optional:true,tokens:[{type:"literal",value:"comme"},{type:"role",role:"responseType",expectedTypes:["literal","expression"]}]}]},extraction:{source:{marker:"de"},responseType:{marker:"comme"},...r?{style:r.extraction}:{}}}]}function mp(){let r=Et("pt");return [{id:"fetch-pt",language:"pt",command:"fetch",priority:105,template:{format:"buscar de {source} como {responseType}",tokens:[{type:"literal",value:"buscar"},{type:"group",optional:true,tokens:[{type:"literal",value:"de"}]},{type:"role",role:"source",expectedTypes:["literal","expression"]},...r?[r.token]:[],{type:"group",optional:true,tokens:[{type:"literal",value:"como"},{type:"role",role:"responseType",expectedTypes:["literal","expression"]}]}]},extraction:{source:{marker:"de"},responseType:{marker:"como"},...r?{style:r.extraction}:{}}}]}function ge(r,e,t,i,n,a,o,u){let s=Et(e);return {id:r,language:e,command:"fetch",priority:105,template:{format:`${t} ${i} {source} ${n} {responseType}`,tokens:[{type:"literal",value:t,...a?{alternatives:a}:{}},{type:"group",optional:true,tokens:[{type:"literal",value:i,...o?{alternatives:o}:{}}]},{type:"role",role:"source",expectedTypes:["literal","expression"]},...s?[s.token]:[],{type:"group",optional:true,tokens:[{type:"literal",value:n,...u?{alternatives:u}:{}},{type:"role",role:"responseType",expectedTypes:["literal","expression"]}]}]},extraction:{source:{marker:i,...o?{markerAlternatives:o}:{}},...s?{style:s.extraction}:{},responseType:{marker:n,...u?{markerAlternatives:u}:{}}}}}function ut(r,e,t,i,n,a,o,u){let s=Et(e),l=[{type:"role",role:"responseType",expectedTypes:["literal","expression"]}];o&&l.push({type:"literal",value:o,...u?{alternatives:u}:{}});let c={type:"group",optional:true,tokens:l};return {id:r,language:e,command:"fetch",priority:105,template:{format:`{source} ${i} ${t}`,tokens:[{type:"role",role:"source",expectedTypes:["literal","expression"]},{type:"group",optional:true,tokens:[{type:"literal",value:i,...a?{alternatives:a}:{}}]},...s?[s.token]:[],{type:"literal",value:t,...n?{alternatives:n}:{}},c]},extraction:{source:{marker:i,...a?{markerAlternatives:a}:{}},...s?{style:s.extraction}:{},responseType:o?{marker:o,...u?{markerAlternatives:u}:{}}:{}}}}function fp(r){switch(r){case "zh":return cp();case "ms":return pp();case "fr":return dp();case "pt":return mp();case "es":return [ge("fetch-es","es","buscar","de","como")];case "pl":return [ge("fetch-pl","pl","pobierz","z","jako")];case "id":return [ge("fetch-id","id","muat","dari","sebagai",["ambil"])];case "sw":return [ge("fetch-sw","sw","leta","kutoka","kuwa",void 0,void 0,["kama"])];case "he":return [ge("fetch-he","he","\u05D4\u05D1\u05D0","\u05DE","\u05DB",["\u05D8\u05E2\u05DF"],["\u05D0\u05EA"])];case "de":return [ge("fetch-de","de","abrufen","von","als",["laden"])];case "ru":return [ge("fetch-ru","ru","\u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044C","\u0438\u0437","\u043A\u0430\u043A",["\u0437\u0430\u0433\u0440\u0443\u0437\u0438"])];case "uk":return [ge("fetch-uk","uk","\u0437\u0430\u0432\u0430\u043D\u0442\u0430\u0436\u0438\u0442\u0438","\u0437","\u044F\u043A",["\u0437\u0430\u0432\u0430\u043D\u0442\u0430\u0436"])];case "it":return [ge("fetch-it","it","recuperare","da","come")];case "vi":return [ge("fetch-vi","vi","t\u1EA3i","t\u1EEB","nh\u01B0")];case "th":return [ge("fetch-th","th","\u0E14\u0E36\u0E07\u0E02\u0E49\u0E2D\u0E21\u0E39\u0E25","\u0E08\u0E32\u0E01","\u0E40\u0E1B\u0E47\u0E19")];case "ar":return [ge("fetch-ar","ar","\u0627\u062D\u0636\u0631","\u0645\u0646","\u0643\u0640",["\u062C\u0644\u0628"])];case "tl":return [ge("fetch-tl","tl","kuhanin_mula","mula_sa","bilang",["kunin_mula"])];case "ja":return [ut("fetch-ja-sov","ja","\u30D5\u30A7\u30C3\u30C1","\u3092")];case "ko":return [ut("fetch-ko-sov","ko","\uD328\uCE58","\uC744",["\uAC00\uC838\uC624\uAE30"],["\uB97C"],"\uB85C",["\uC73C\uB85C"])];case "tr":return [ut("fetch-tr-sov","tr","getir","i",void 0,["\u0131","u","\xFC","yi","y\u0131","yu","y\xFC"],"olarak")];case "hi":return [ut("fetch-hi-sov","hi","\u0932\u093E\u090F\u0902","\u0915\u094B")];case "qu":return [ut("fetch-qu-sov","qu","apamuy","ta",["taripakaramuy"],void 0,"hina")];case "bn":return [ut("fetch-bn-sov","bn","\u0986\u09A8\u09C1\u09A8","\u0995\u09C7")];default:return []}}var jr={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"]},Wr=["literal","expression","reference","property-path"];function gn(r,e){let t=[...jr[r]??[],"times"].filter(i=>i!==e);return {type:"literal",value:e,alternatives:t}}function yp(r,e,t,i){let n=[];return n.push({type:"literal",value:e}),i&&n.push({type:"literal",value:i}),n.push({type:"role",role:"quantity",expectedTypes:Wr}),n.push(gn(r,t)),{id:`repeat-${r}-times`,language:r,command:"repeat",priority:110,template:{format:`${e}${i?" "+i:""} {quantity} ${t}`,tokens:n},extraction:{loopType:{default:{type:"literal",value:"times"}}}}}var vp=[["es","repetir","veces"],["de","wiederholen","mal"],["fr","r\xE9p\xE9ter","fois"],["it","ripetere","volte"],["pt","repetir","vezes"],["ru","\u043F\u043E\u0432\u0442\u043E\u0440\u0438\u0442\u044C","\u0440\u0430\u0437"],["uk","\u043F\u043E\u0432\u0442\u043E\u0440\u0438\u0442\u0438","\u0440\u0430\u0437\u0456\u0432"],["pl","powt\xF3rz","razy"],["ar","\u0643\u0631\u0631","\u0645\u0631\u0627\u062A"],["he","\u05D7\u05D6\u05D5\u05E8","\u05E4\u05E2\u05DE\u05D9\u05DD","\u05D0\u05EA"],["id","ulangi","kali"],["ms","ulang","kali"],["sw","rudia","mara"],["th","\u0E17\u0E33\u0E0B\u0E49\u0E33","\u0E04\u0E23\u0E31\u0E49\u0E07"],["vi","l\u1EB7p l\u1EA1i","l\u1EA7n"],["tl","ulitin","beses"],["zh","\u91CD\u590D","\u6B21","\u628A"]];function hp(r,e,t,i){return {id:`repeat-${r}-times`,language:r,command:"repeat",priority:110,template:{format:`{quantity} ${e} ${t} ${i}`,tokens:[{type:"role",role:"quantity",expectedTypes:Wr},gn(r,e),{type:"literal",value:t},{type:"literal",value:i,alternatives:["repeat"]}]},extraction:{loopType:{default:{type:"literal",value:"times"}}}}}var Ep=[["ja","\u56DE","\u3092","\u7E70\u308A\u8FD4\u3057"],["ko","\uBC88","\uB97C","\uBC18\uBCF5"],["tr","kez","i","tekrarla"],["hi","\u092C\u093E\u0930","\u0915\u094B","\u0926\u094B\u0939\u0930\u093E\u090F\u0902"],["bn","\u09AC\u09BE\u09B0","\u0995\u09C7","\u09AA\u09C1\u09A8\u09B0\u09BE\u09AC\u09C3\u09A4\u09CD\u09A4\u09BF"],["qu","kuti","ta","kutipay"]];function gp(r,e,t){return {id:`repeat-${r}-word-first-times`,language:r,command:"repeat",priority:109,template:{format:`${e} ${t} {quantity}`,tokens:[{type:"literal",value:e},{type:"literal",value:t},{type:"role",role:"quantity",expectedTypes:Wr}]},extraction:{loopType:{default:{type:"literal",value:"times"}}}}}function kp(r,e){let t=[{type:"literal",value:"repeat"}];if(e.forWords&&e.forWords.length>0)if(e.requireForWords)for(let i of e.forWords)t.push({type:"literal",value:i});else t.push({type:"group",optional:true,tokens:e.forWords.map(i=>({type:"literal",value:i}))});t.push({type:"role",role:"patient",expectedTypes:["expression","reference"]});for(let i of e.inWords)t.push({type:"literal",value:i});return t.push({type:"role",role:"source",expectedTypes:["selector","expression","reference"]}),{id:`repeat-${r}-for-in`,language:r,command:"repeat",priority:110,template:{format:`repeat [${(e.forWords??[]).join(" ")}] {patient} ${e.inWords.join(" ")} {source}`,tokens:t},extraction:{loopType:{default:{type:"literal",value:"for"}}}}}var zp=[["en",{forWords:["for"],inWords:["in"],requireForWords:true}],["es",{forWords:["para"],inWords:["en"]}],["pt",{forWords:["para"],inWords:["dentro"]}],["fr",{forWords:["pour"],inWords:["en"]}],["it",{forWords:["per"],inWords:["in"]}],["de",{forWords:["f\xFCr"],inWords:["in"]}],["ru",{forWords:["\u0434\u043B\u044F"],inWords:["\u0432"]}],["uk",{forWords:["\u0434\u043B\u044F"],inWords:["\u0443"]}],["pl",{forWords:["dla"],inWords:["w"]}],["ar",{forWords:["\u0644\u0643\u0644"],inWords:["\u0641\u064A"]}],["he",{forWords:["\u05E2\u05D1\u05D5\u05E8","\u05D0\u05EA"],inWords:["in"]}],["hi",{inWords:["\u092E\u0947\u0902"]}],["bn",{inWords:["\u098F"]}],["ja",{inWords:["\u306E\u4E2D"]}],["ko",{inWords:["\uC548\uC5D0"]}],["zh",{forWords:["\u4E3A","\u628A"],inWords:["\u5728"]}],["tr",{inWords:["i\xE7inde"]}],["id",{forWords:["untuk"],inWords:["dalam"]}],["ms",{forWords:["untuk"],inWords:["dalam"]}],["sw",{forWords:["kwa"],inWords:["ndani"]}],["th",{forWords:["\u0E2A\u0E33\u0E2B\u0E23\u0E31\u0E1A"],inWords:["\u0E43\u0E19"]}],["vi",{forWords:["v\u1EDBi m\u1ED7i"],inWords:["trong"]}],["tl",{forWords:["para_sa"],inWords:["sa_loob"]}],["qu",{inWords:["ukupi"]}]];function wp(r,e){let t=[{type:"literal",value:"repeat"}];for(let i of e.pre??[])t.push({type:"literal",value:i});return t.push({type:"literal",value:e.whileWord}),t.push({type:"role",role:"condition",expectedTypes:["property-path","expression"]}),{id:`repeat-${r}-while-head`,language:r,command:"repeat",priority:110,template:{format:`repeat ${(e.pre??[]).join(" ")} ${e.whileWord} {condition}`,tokens:t},extraction:{loopType:{default:{type:"literal",value:"while"}}}}}function bp(r,e){return {id:`repeat-${r}-while-head`,language:r,command:"repeat",priority:110,template:{format:`${e.whileWord} {condition} ${e.verb}`,tokens:[{type:"literal",value:e.whileWord},{type:"role",role:"condition",expectedTypes:["property-path","expression"]},{type:"literal",value:e.verb}]},extraction:{loopType:{default:{type:"literal",value:"while"}}}}}var Cp=[["ja",{whileWord:"\u306E\u9593",verb:"\u7E70\u308A\u8FD4\u3057"}],["ko",{whileWord:"\uB3D9\uC548",verb:"\uBC18\uBCF5"}],["tr",{whileWord:"s\xFCresince",verb:"tekrarla"}],["hi",{whileWord:"\u091C\u092C \u0924\u0915",verb:"\u0926\u094B\u0939\u0930\u093E\u090F\u0902"}],["bn",{whileWord:"\u09AF\u09A4\u0995\u09CD\u09B7\u09A3",verb:"\u09AA\u09C1\u09A8\u09B0\u09BE\u09AC\u09C3\u09A4\u09CD\u09A4\u09BF"}],["qu",{whileWord:"kaykamaqa",verb:"kutipay"}]],Ap=[["en",{whileWord:"while"}],["es",{whileWord:"mientras"}],["pt",{whileWord:"enquanto"}],["fr",{whileWord:"tantque"}],["it",{whileWord:"mentre"}],["de",{whileWord:"w\xE4hrend"}],["ru",{whileWord:"\u043F\u043E\u043A\u0430"}],["uk",{whileWord:"\u043F\u043E\u043A\u0438"}],["pl",{whileWord:"dop\xF3ki"}],["ar",{whileWord:"\u0628\u064A\u0646\u0645\u0627"}],["he",{pre:["\u05D0\u05EA"],whileWord:"\u05DB\u05DC \u05E2\u05D5\u05D3"}],["zh",{pre:["\u628A"],whileWord:"\u5F53"}],["id",{whileWord:"selama"}],["ms",{whileWord:"selagi"}],["sw",{whileWord:"wakati"}],["th",{whileWord:"\u0E43\u0E19\u0E02\u0E13\u0E30\u0E17\u0E35\u0E48"}],["vi",{whileWord:"trong khi"}],["tl",{whileWord:"habang"}]];function kn(r,e){let t=[{type:"literal",value:"repeat"}];for(let i of e.pre??[])t.push({type:"literal",value:i});return t.push({type:"literal",value:e.untilWord}),t.push({type:"role",role:"condition",expectedTypes:["property-path","expression"]}),{id:`repeat-${r}-until-condition-head`,language:r,command:"repeat",priority:105,template:{format:`repeat ${(e.pre??[]).join(" ")} ${e.untilWord} {condition}`,tokens:t},extraction:{loopType:{default:{type:"literal",value:"until"}}}}}function xp(r,e){return {id:`repeat-${r}-until-condition-head`,language:r,command:"repeat",priority:105,template:{format:`${e.untilWord} {condition} ${e.verb}`,tokens:[{type:"literal",value:e.untilWord},{type:"role",role:"condition",expectedTypes:["property-path","expression"]},{type:"literal",value:e.verb}]},extraction:{loopType:{default:{type:"literal",value:"until"}}}}}function Dp(r,e){let t=[{type:"literal",value:"repeat"}];for(let i of e.pre??[])t.push({type:"literal",value:i});return t.push({type:"literal",value:e.untilWord}),e.preEvent&&t.push({type:"literal",value:e.preEvent}),t.push({type:"literal",value:e.eventWord}),t.push({type:"role",role:"event",expectedTypes:["literal","expression"]}),t.push({type:"group",optional:true,tokens:[{type:"literal",value:e.fromWord},{type:"role",role:"source",expectedTypes:["selector","reference","expression"]}]}),{id:`repeat-${r}-until-head`,language:r,command:"repeat",priority:110,template:{format:`repeat ${e.untilWord} ${e.eventWord} {event} [${e.fromWord} {source}]`,tokens:t},extraction:{loopType:{default:{type:"literal",value:"until-event"}}}}}var Sp=[["ja",{untilWord:"\u307E\u3067",verb:"\u7E70\u308A\u8FD4\u3057"}],["ko",{untilWord:"\uAE4C\uC9C0",verb:"\uBC18\uBCF5"}],["tr",{untilWord:"kadar",verb:"tekrarla"}],["hi",{untilWord:"\u0924\u0915",verb:"\u0926\u094B\u0939\u0930\u093E\u090F\u0902"}],["bn",{untilWord:"\u09AA\u09B0\u09CD\u09AF\u09A8\u09CD\u09A4",verb:"\u09AA\u09C1\u09A8\u09B0\u09BE\u09AC\u09C3\u09A4\u09CD\u09A4\u09BF"}],["qu",{untilWord:"kama",verb:"kutipay"}]],Bp=[["es",{untilWord:"hasta",eventWord:"evento",fromWord:"de"}],["pt",{untilWord:"at\xE9",eventWord:"evento",fromWord:"de"}],["fr",{untilWord:"jusqu\xE0",eventWord:"\xE9v\xE9nement",fromWord:"de"}],["it",{untilWord:"fino",eventWord:"evento",fromWord:"da"}],["de",{untilWord:"bis",eventWord:"ereignis",fromWord:"von"}],["ru",{untilWord:"\u0434\u043E",eventWord:"\u0441\u043E\u0431\u044B\u0442\u0438\u0435",fromWord:"\u0438\u0437"}],["uk",{untilWord:"\u0434\u043E",eventWord:"\u043F\u043E\u0434\u0456\u044F",fromWord:"\u0437"}],["pl",{untilWord:"a\u017C",eventWord:"zdarzenie",fromWord:"z"}],["ar",{untilWord:"\u062D\u062A\u0649",eventWord:"\u062D\u062F\u062B",fromWord:"\u0645\u0646"}],["he",{untilWord:"\u05E2\u05D3",preEvent:"\u05D0\u05EA",eventWord:"\u05D0\u05D9\u05E8\u05D5\u05E2",fromWord:"\u05DE"}],["id",{untilWord:"sampai",eventWord:"peristiwa",fromWord:"dari"}],["ms",{untilWord:"sehingga",eventWord:"peristiwa",fromWord:"dari"}],["sw",{untilWord:"hadi",eventWord:"tukio",fromWord:"kutoka"}],["th",{untilWord:"\u0E08\u0E19\u0E16\u0E36\u0E07",eventWord:"\u0E40\u0E2B\u0E15\u0E38\u0E01\u0E32\u0E23\u0E13\u0E4C",fromWord:"\u0E08\u0E32\u0E01"}],["vi",{untilWord:"cho \u0111\u1EBFn khi",eventWord:"s\u1EF1 ki\u1EC7n",fromWord:"t\u1EEB"}],["tl",{untilWord:"hanggang",eventWord:"pangyayari",fromWord:"mula_sa"}],["zh",{pre:["\u628A"],untilWord:"\u76F4\u5230",eventWord:"\u4E8B\u4EF6",fromWord:"\u4ECE"}]];function Tp(r,e){return {id:`repeat-${r}-until-head`,language:r,command:"repeat",priority:110,template:{format:`${e.untilWord} ${e.eventWord} {event} ${e.objMarker} repeat [{source} ${e.fromWord}]`,tokens:[{type:"literal",value:e.untilWord},{type:"literal",value:e.eventWord},{type:"role",role:"event",expectedTypes:["literal","expression"]},{type:"literal",value:e.objMarker},{type:"literal",value:"repeat"},{type:"group",optional:true,tokens:[{type:"role",role:"source",expectedTypes:["selector","reference","expression"]},{type:"literal",value:e.fromWord}]}]},extraction:{loopType:{default:{type:"literal",value:"until-event"}}}}}function Fp(r,e){return {id:`repeat-${r}-until-head-verb-final`,language:r,command:"repeat",priority:111,template:{format:`${e.untilWord} ${e.eventWord} {event} ${e.objMarker} {source} ${e.fromWord} repeat`,tokens:[{type:"literal",value:e.untilWord},{type:"literal",value:e.eventWord},{type:"role",role:"event",expectedTypes:["literal","expression"]},{type:"literal",value:e.objMarker},{type:"role",role:"source",expectedTypes:["selector","reference","expression"]},{type:"literal",value:e.fromWord},{type:"literal",value:"repeat"}]},extraction:{loopType:{default:{type:"literal",value:"until-event"}}}}}var Pp={id:"repeat-qu-midclause-until-head",language:"qu",command:"repeat",priority:109,template:{format:"until event {event} ta {source} manta repeat",tokens:[{type:"literal",value:"until"},{type:"literal",value:"event"},{type:"role",role:"event",expectedTypes:["literal","expression"]},{type:"literal",value:"ta"},{type:"role",role:"source",expectedTypes:["selector","reference","expression"]},{type:"literal",value:"manta"},{type:"literal",value:"repeat"}]},extraction:{loopType:{default:{type:"literal",value:"until-event"}}}},Rp=[["hi",{untilWord:"\u0924\u0915",eventWord:"\u0918\u091F\u0928\u093E",objMarker:"\u0915\u094B",fromWord:"\u0938\u0947"}],["bn",{untilWord:"\u09AA\u09B0\u09CD\u09AF\u09A8\u09CD\u09A4",eventWord:"\u0998\u099F\u09A8\u09BE",objMarker:"\u0995\u09C7",fromWord:"\u09A5\u09C7\u0995\u09C7"}],["ja",{untilWord:"\u307E\u3067",eventWord:"\u30A4\u30D9\u30F3\u30C8",objMarker:"\u3092",fromWord:"\u304B\u3089"}],["ko",{untilWord:"\uAE4C\uC9C0",eventWord:"\uC774\uBCA4\uD2B8",objMarker:"\uB97C",fromWord:"\uC5D0\uC11C"}],["tr",{untilWord:"kadar",eventWord:"olay",objMarker:"i",fromWord:"den"}]],Op={id:"repeat-qu-until-head",language:"qu",command:"repeat",priority:110,template:{format:"hayk _ a until event {event} ta {source} manta repeat",tokens:[{type:"literal",value:"hayk"},{type:"literal",value:"_"},{type:"literal",value:"a"},{type:"literal",value:"until"},{type:"literal",value:"event"},{type:"role",role:"event",expectedTypes:["literal","expression"]},{type:"literal",value:"ta"},{type:"role",role:"source",expectedTypes:["selector","reference","expression"]},{type:"literal",value:"manta"},{type:"literal",value:"repeat"}]},extraction:{loopType:{default:{type:"literal",value:"until-event"}}}};function Lp(r,e){return {id:`for-${r}-sov-basic`,language:r,command:"for",priority:105,template:{format:`{patient} ${e.inWords.join(" ")} {source} [${e.objMarker}] ${e.forVerb}`,tokens:[{type:"role",role:"patient",expectedTypes:["expression","reference"]},...e.inWords.map(t=>({type:"literal",value:t})),{type:"role",role:"source",expectedTypes:["selector","expression","reference"]},{type:"group",optional:true,tokens:[{type:"literal",value:e.objMarker}]},{type:"literal",value:e.forVerb}]},extraction:{patient:{position:0}}}}var Np=[["ja",{inWords:["\u306E\u4E2D"],objMarker:"\u3092",forVerb:"\u305F\u3081\u306B"}],["ko",{inWords:["\uC548\uC5D0"],objMarker:"\uB97C",forVerb:"\uAC01\uAC01"}],["tr",{inWords:["i\xE7inde"],objMarker:"i",forVerb:"i\xE7in"}],["qu",{inWords:["ukupi"],objMarker:"ta",forVerb:"sapankaq"}],["bn",{inWords:["\u098F"],objMarker:"\u0995\u09C7",forVerb:"\u099C\u09A8\u09CD\u09AF"}],["hi",{inWords:["\u092E\u0947\u0902"],objMarker:"\u0915\u094B",forVerb:"\u0939\u0947\u0924\u0941"}]],Ar=new Map,ce=(r,e)=>{let t=Ar.get(r);t?t.push(e):Ar.set(r,[e]);};for(let[r,e,t,i]of vp)ce(r,yp(r,e,t,i));for(let[r,e,t,i]of Ep)ce(r,hp(r,e,t,i));ce("sw",gp("sw","rudia","mara"));for(let[r,e]of zp)ce(r,kp(r,e));for(let[r,e]of Np)ce(r,Lp(r,e));for(let[r,e]of Ap)ce(r,wp(r,e));for(let[r,e]of Cp)ce(r,bp(r,e));for(let[r,e]of Bp)ce(r,Dp(r,e)),ce(r,kn(r,e));ce("en",kn("en",{untilWord:"until"}));for(let[r,e]of Sp)ce(r,xp(r,e));for(let[r,e]of Rp)ce(r,Tp(r,e)),r==="tr"&&ce(r,Fp(r,e));var Mp={id:"repeat-qu-canonical-until-head",language:"qu",command:"repeat",priority:110,template:{format:"kama ruway {event} ta repeat [{source} manta]",tokens:[{type:"literal",value:"kama"},{type:"literal",value:"ruway"},{type:"role",role:"event",expectedTypes:["literal","expression"]},{type:"literal",value:"ta"},{type:"literal",value:"repeat"},{type:"group",optional:true,tokens:[{type:"role",role:"source",expectedTypes:["selector","reference","expression"]},{type:"literal",value:"manta"}]}]},extraction:{loopType:{default:{type:"literal",value:"until-event"}}}};ce("qu",Mp);ce("qu",Op);ce("qu",Pp);function _p(r){return Ar.get(r)??[]}function Ip(){return [{id:"append-en-full",language:"en",command:"append",priority:100,template:{format:"append {patient} to {destination}",tokens:[{type:"literal",value:"append"},{type:"role",role:"patient",expectedTypes:["literal","selector","expression"]},{type:"literal",value:"to"},{type:"role",role:"destination",expectedTypes:["selector","reference"]}]},extraction:{patient:{position:1},destination:{marker:"to"}}}]}function $p(r){switch(r){case "en":return Ip();default:return []}}function jp(){return [{id:"prepend-en-full",language:"en",command:"prepend",priority:100,template:{format:"prepend {patient} to {destination}",tokens:[{type:"literal",value:"prepend"},{type:"role",role:"patient",expectedTypes:["literal","selector","expression"]},{type:"literal",value:"to"},{type:"role",role:"destination",expectedTypes:["selector","reference"]}]},extraction:{patient:{position:1},destination:{marker:"to"}}}]}function Wp(r){switch(r){case "en":return jp();default:return []}}function qp(){return [{id:"trigger-en-full",language:"en",command:"trigger",priority:100,template:{format:"trigger {event} on {destination}",tokens:[{type:"literal",value:"trigger"},{type:"role",role:"event",expectedTypes:["literal","expression"]},{type:"group",optional:true,tokens:[{type:"literal",value:"on"},{type:"role",role:"destination",expectedTypes:["selector","reference"]}]}]},extraction:{event:{position:1},destination:{marker:"on",default:{type:"reference",value:"me"}}}},{id:"trigger-en-simple",language:"en",command:"trigger",priority:90,template:{format:"trigger {event}",tokens:[{type:"literal",value:"trigger"},{type:"role",role:"event",expectedTypes:["literal","expression"]}]},extraction:{event:{position:1},destination:{default:{type:"reference",value:"me"}}}}]}function Vp(){return [{id:"trigger-zh-ba",language:"zh",command:"trigger",priority:105,template:{format:"\u89E6\u53D1 \u628A {event} \u5728 {destination}",tokens:[{type:"literal",value:"\u89E6\u53D1",alternatives:["\u89F8\u767C"]},{type:"literal",value:"\u628A"},{type:"role",role:"event",expectedTypes:["literal","expression"]},{type:"group",optional:true,tokens:[{type:"literal",value:"\u5728",alternatives:["\u5230","\u4E8E"]},{type:"role",role:"destination",expectedTypes:["selector","reference","expression"]}]}]},extraction:{event:{position:2},destination:{marker:"\u5728",markerAlternatives:["\u5230","\u4E8E"],default:{type:"reference",value:"me"}}}}]}function Kp(){return [{id:"trigger-he-et",language:"he",command:"trigger",priority:105,template:{format:"\u05D4\u05E4\u05E2\u05DC \u05D0\u05EA {event} \u05E2\u05DC {destination}",tokens:[{type:"literal",value:"\u05D4\u05E4\u05E2\u05DC",alternatives:["\u05E9\u05D2\u05E8"]},{type:"literal",value:"\u05D0\u05EA"},{type:"role",role:"event",expectedTypes:["literal","expression"]},{type:"group",optional:true,tokens:[{type:"literal",value:"\u05E2\u05DC",alternatives:["\u05DC","\u05D0\u05DC"]},{type:"role",role:"destination",expectedTypes:["selector","reference","expression"]}]}]},extraction:{event:{position:2},destination:{marker:"\u05E2\u05DC",markerAlternatives:["\u05DC","\u05D0\u05DC"],default:{type:"reference",value:"me"}}}}]}function Hp(){return [{id:"trigger-qu-event-first-verb-final",language:"qu",command:"trigger",priority:105,template:{format:"{event} ta [{destination} man] trigger",tokens:[{type:"role",role:"event",expectedTypes:["literal","expression"]},{type:"literal",value:"ta"},{type:"group",optional:true,tokens:[{type:"role",role:"destination",expectedTypes:["selector","reference","expression"]},{type:"literal",value:"man"}]},{type:"literal",value:"trigger"}]},extraction:{destination:{default:{type:"reference",value:"me"}}}}]}function Up(r){switch(r){case "en":return qp();case "zh":return Vp();case "he":return Kp();case "qu":return Hp();default:return []}}function Gp(){return [{id:"send-zh-ba",language:"zh",command:"send",priority:105,template:{format:"\u53D1\u9001 \u628A {event} \u5230 {destination}",tokens:[{type:"literal",value:"\u53D1\u9001",alternatives:["\u767C\u9001","\u4F20\u9001","\u50B3\u9001"]},{type:"literal",value:"\u628A"},{type:"role",role:"event",expectedTypes:["literal","expression"]},{type:"group",optional:true,tokens:[{type:"literal",value:"\u5230",alternatives:["\u7ED9","\u7D66","\u5411"]},{type:"role",role:"destination",expectedTypes:["selector","reference","expression"]}]}]},extraction:{event:{position:2},destination:{marker:"\u5230",markerAlternatives:["\u7ED9","\u7D66","\u5411"],default:{type:"reference",value:"me"}}}}]}function Zp(){return [{id:"send-he-et",language:"he",command:"send",priority:105,template:{format:"\u05E9\u05DC\u05D7 \u05D0\u05EA {event} \u05E2\u05DC {destination}",tokens:[{type:"literal",value:"\u05E9\u05DC\u05D7"},{type:"literal",value:"\u05D0\u05EA"},{type:"role",role:"event",expectedTypes:["literal","expression"]},{type:"group",optional:true,tokens:[{type:"literal",value:"\u05E2\u05DC",alternatives:["\u05DC","\u05D0\u05DC"]},{type:"role",role:"destination",expectedTypes:["selector","reference","expression"]}]}]},extraction:{event:{position:2},destination:{marker:"\u05E2\u05DC",markerAlternatives:["\u05DC","\u05D0\u05DC"],default:{type:"reference",value:"me"}}}}]}function Yp(r){switch(r){case "zh":return Gp();case "he":return Zp();default:return []}}function Ne(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 Y(r,e){let t={type:"literal",value:r};return e!==void 0?{type:"literal",value:r,dataType:e}:t}function zn(r){if(r==="true")return Y(true,"boolean");if(r==="false")return Y(false,"boolean");if(r==="null")return {type:"expression",raw:"null"}}function Le(r){return fr(r)}function Be(r){return {type:"reference",value:r}}function wn(r,e){return e?{...r,position:e}:r}function Me(r,e,t){return t?{type:"property-path",object:r,property:e,access:t}:{type:"property-path",object:r,property:e}}function fe(r,e,t){let i={kind:"command",action:r,roles:new Map(Object.entries(e))};return t!==void 0?{...i,metadata:t}:i}function Ct(r,e,t,i,n,a){let o=new Map;o.set("event",r);let u={kind:"event-handler",action:"on",roles:o,body:e};return t!==void 0&&(u.eventModifiers=t),i!==void 0&&(u.metadata=i),n!==void 0&&n.length>0&&(u.parameterNames=n),u}function Xp(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 Jp(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 xr(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 st(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 Qp(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 e0(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 bn(r){let e=T(r)?.keywords?.pick,t=e?.primary;if(!t||t.toLowerCase()==="pick")return {type:"literal",value:"pick"};let i=[...e?.alternatives??[],"pick"];return {type:"literal",value:t,alternatives:i}}var t0=new Set(["character","characters","item","items"]),Cn=r=>{if(t0.has(r))return {type:"expression",raw:r};let e=Number(r);return Y(r!==""&&!Number.isNaN(e)?e:r)};function r0(r,e){let t=[bn(r)];return e.objectMarkers?.length&&t.push({type:"group",optional:true,tokens:[{type:"literal",value:e.objectMarkers[0],...e.objectMarkers.length>1?{alternatives:e.objectMarkers.slice(1)}:{}}]}),t.push({type:"role",role:"method",expectedTypes:["literal","expression"]},{type:"role",role:"patient",expectedTypes:["literal","expression"]},{type:"literal",value:e.srcMarker,...e.srcAlternatives?.length?{alternatives:e.srcAlternatives}:{}},{type:"role",role:"source",expectedTypes:["selector","reference","expression"]}),{id:`pick-${r}-variant`,language:r,command:"pick",priority:110,template:{format:`pick {method} {patient} ${e.srcMarker} {source}`,tokens:t},extraction:{method:{position:1,transform:Cn},patient:{position:2},source:{marker:e.srcMarker,...e.srcAlternatives?.length?{markerAlternatives:e.srcAlternatives}:{}}}}}var i0={ar:{srcMarker:"\u0645\u0646"},de:{srcMarker:"von",srcAlternatives:["aus"]},es:{srcMarker:"de"},fr:{srcMarker:"de"},he:{srcMarker:"of",srcAlternatives:["\u05E9\u05DC","\u05DE"],objectMarkers:["\u05D0\u05EA"]},id:{srcMarker:"dari"},it:{srcMarker:"di",srcAlternatives:["da"]},ms:{srcMarker:"daripada",srcAlternatives:["dari"]},pl:{srcMarker:"z"},pt:{srcMarker:"de"},ru:{srcMarker:"\u0438\u0437"},sw:{srcMarker:"ya",srcAlternatives:["kutoka"]},th:{srcMarker:"\u0E02\u0E2D\u0E07",srcAlternatives:["\u0E08\u0E32\u0E01"]},tl:{srcMarker:"ng",srcAlternatives:["mula"]},uk:{srcMarker:"\u0437"},vi:{srcMarker:"c\u1EE7a",srcAlternatives:["t\u1EEB"]},zh:{srcMarker:"\u7684",objectMarkers:["\u628A"]}};function n0(r,e){return {id:`pick-${r}-variant-sov`,language:r,command:"pick",priority:110,template:{format:`{source} ${e.genitive} {method} {patient} ${e.patientMarker} pick`,tokens:[{type:"role",role:"source",expectedTypes:["selector","reference","expression"]},{type:"literal",value:e.genitive},{type:"role",role:"method",expectedTypes:["literal","expression"]},{type:"role",role:"patient",expectedTypes:["literal","expression"]},{type:"group",optional:true,tokens:[{type:"literal",value:e.patientMarker}]},bn(r)]},extraction:{source:{position:0},method:{position:2,transform:Cn},patient:{position:3}}}}var a0={bn:{genitive:"\u09B0",patientMarker:"\u0995\u09C7"},hi:{genitive:"\u0915\u093E",patientMarker:"\u0915\u094B"},ja:{genitive:"\u306E",patientMarker:"\u3092"},ko:{genitive:"\uC758",patientMarker:"\uB97C"},qu:{genitive:"pa",patientMarker:"ta"},tr:{genitive:"nin",patientMarker:"i"}};function o0(r){let e=i0[r];if(e)return [r0(r,e)];let t=a0[r];return t?[n0(r,t)]:[]}var u0={id:"fetch-en-with-response-type",language:"en",command:"fetch",priority:90,template:{format:"fetch {source} as {responseType}",tokens:[{type:"literal",value:"fetch"},{type:"role",role:"source",expectedTypes:["literal","expression"]},{type:"literal",value:"as"},{type:"role",role:"responseType",expectedTypes:["literal","expression"]}]},extraction:{source:{position:1},responseType:{marker:"as"}}},s0={id:"fetch-en-with-options-as",language:"en",command:"fetch",priority:95,template:{format:"fetch {source} with {style} as {responseType}",tokens:[{type:"literal",value:"fetch"},{type:"role",role:"source",expectedTypes:["literal","expression"]},{type:"literal",value:"with",alternatives:["by","using"]},{type:"role",role:"style",expectedTypes:["expression"]},{type:"literal",value:"as"},{type:"role",role:"responseType",expectedTypes:["literal","expression"]}]},extraction:{source:{position:1},style:{marker:"with"},responseType:{marker:"as"}}},l0={id:"fetch-en-with-options",language:"en",command:"fetch",priority:93,template:{format:"fetch {source} with {style}",tokens:[{type:"literal",value:"fetch"},{type:"role",role:"source",expectedTypes:["literal","expression"]},{type:"literal",value:"with",alternatives:["by","using"]},{type:"role",role:"style",expectedTypes:["expression"]}]},extraction:{source:{position:1},style:{marker:"with"}}},c0={id:"fetch-en-simple",language:"en",command:"fetch",priority:80,template:{format:"fetch {source}",tokens:[{type:"literal",value:"fetch"},{type:"role",role:"source"}]},extraction:{source:{position:1}}},p0=[s0,l0,u0,c0],ir={type:"group",optional:true,tokens:[{type:"literal",value:"using"},{type:"literal",value:"view"},{type:"role",role:"manner",optional:true,expectedTypes:["literal","expression"],valueShape:"keyword"}]},d0={id:"swap-en-handcrafted",language:"en",command:"swap",priority:110,template:{format:"swap {method} {destination} [using view {manner}]",tokens:[{type:"literal",value:"swap"},{type:"role",role:"method"},{type:"role",role:"destination"},ir]},extraction:{method:{position:1},destination:{position:2}}},m0={id:"swap-en-element",language:"en",command:"swap",priority:120,template:{format:"swap {destination} with {patient} [using view {manner}]",tokens:[{type:"literal",value:"swap"},{type:"role",role:"destination"},{type:"literal",value:"with"},{type:"role",role:"patient"},ir]},extraction:{}},f0={id:"swap-en-strategy-of",language:"en",command:"swap",priority:140,template:{format:"swap {method} of {destination} with {patient} [using view {manner}]",tokens:[{type:"literal",value:"swap"},{type:"role",role:"method"},{type:"literal",value:"of"},{type:"role",role:"destination"},{type:"literal",value:"with"},{type:"role",role:"patient"},ir]},extraction:{}},y0={id:"swap-en-strategy",language:"en",command:"swap",priority:130,template:{format:"swap {method} {destination} with {patient} [using view {manner}]",tokens:[{type:"literal",value:"swap"},{type:"role",role:"method"},{type:"role",role:"destination"},{type:"literal",value:"with"},{type:"role",role:"patient"},ir]},extraction:{}},v0=[f0,y0,m0,d0],h0={id:"repeat-en-until-event-from",language:"en",command:"repeat",priority:120,template:{format:"repeat until event {event} from {source}",tokens:[{type:"literal",value:"repeat"},{type:"literal",value:"until"},{type:"literal",value:"event"},{type:"role",role:"event",expectedTypes:["literal","expression"]},{type:"literal",value:"from"},{type:"role",role:"source",expectedTypes:["selector","reference","expression"]}]},extraction:{event:{marker:"event"},source:{marker:"from"},loopType:{default:{type:"literal",value:"until-event"}}}},E0={id:"repeat-en-until-event",language:"en",command:"repeat",priority:110,template:{format:"repeat until event {event}",tokens:[{type:"literal",value:"repeat"},{type:"literal",value:"until"},{type:"literal",value:"event"},{type:"role",role:"event",expectedTypes:["literal","expression"]}]},extraction:{event:{marker:"event"},loopType:{default:{type:"literal",value:"until-event"}}}},g0=[h0,E0],k0=[...Nr.roles.find(r=>r.role==="patient")?.expectedTypes??[]],z0={id:"set-en-possessive",language:"en",command:"set",priority:100,template:{format:"set {destination} to {patient} [on {scope}]",tokens:[{type:"literal",value:"set"},{type:"role",role:"destination",expectedTypes:["property-path","selector","reference","expression"]},{type:"literal",value:"to"},{type:"role",role:"patient",expectedTypes:k0},{type:"group",optional:true,tokens:[{type:"literal",value:"on"},{type:"role",role:"scope",optional:true,expectedTypes:["selector","reference"]}]}]},extraction:{destination:{position:1},patient:{marker:"to"},scope:{marker:"on"}}},w0=[z0],b0={id:"for-en-basic",language:"en",command:"for",priority:100,template:{format:"for {patient} in {source}",tokens:[{type:"literal",value:"for"},{type:"role",role:"patient",expectedTypes:["expression","reference"]},{type:"literal",value:"in"},{type:"role",role:"source",expectedTypes:["selector","expression","reference"]}]},extraction:{patient:{position:1},source:{marker:"in"}}},C0={id:"if-en-basic",language:"en",command:"if",priority:100,template:{format:"if {condition}",tokens:[{type:"literal",value:"if"},{type:"role",role:"condition",expectedTypes:["expression","reference","selector"]}]},extraction:{condition:{position:1}}},A0={id:"unless-en-basic",language:"en",command:"unless",priority:100,template:{format:"unless {condition}",tokens:[{type:"literal",value:"unless"},{type:"role",role:"condition",expectedTypes:["expression","reference","selector"]}]},extraction:{condition:{position:1}}},x0=[b0,C0,A0],D0={id:"temporal-en-in",language:"en",command:"wait",priority:95,template:{format:"in {duration}",tokens:[{type:"literal",value:"in"},{type:"role",role:"duration",expectedTypes:["literal","expression"]}]},extraction:{duration:{position:1}}},S0={id:"temporal-en-after",language:"en",command:"wait",priority:95,template:{format:"after {duration}",tokens:[{type:"literal",value:"after"},{type:"role",role:"duration",expectedTypes:["literal","expression"]}]},extraction:{duration:{position:1}}},B0=[D0,S0],T0=[...p0,...v0,...g0,...w0,...x0,...B0];function F0(){return T0}function An(r,e){let t=e==="SOV"?"sovPosition":"svoPosition";return [...r].sort((i,n)=>{let a=i[t]??99,o=n[t]??99;return a-o})}function P0(r,e){let t=r.markerOverride?.[e.code],i=e.roleMarkers[r.role];if(t!==void 0){let n=R0(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 R0(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 $e(r,e,t){let i=r.markerLegacy?.[e]??[],n=r.methodCarrier?[]:r.markerVariants?.[e]??[],a=[...new Set([...i,...n])].filter(o=>o&&o!==t);return a.length?a:void 0}var Ot=new Set(["destination","source","patient","object","event","eventmarker","manner","instrument","style"]);function yt(r,e){let t,i;if(r.markerOverride&&r.markerOverride[e.code]!==void 0)t=r.markerOverride[e.code],i=t?$e(r,e.code,t):void 0;else {let n=e.roleMarkers[r.role];if(n){t=n.primary;let a=$e(r,e.code,t)??[],o=[...new Set([...n.alternatives??[],...a])].filter(u=>u!==t);i=o.length?o:void 0;}}return {marker:t,alternatives:i}}function Lt(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 qr(r,e,t,i){Dn(r,e,t,i,"manner",{requireMarker:true});}function xn(r,e,t,i){Dn(r,e,t,i,"recipient",{requireMarker:false});}function Dn(r,e,t,i,n,a){let o=t.roles.find(s=>s.role===n&&!s.required);if(!o)return;let u=o.markerOverride?.[i];a.requireMarker&&!u||(r.push({type:"group",optional:true,tokens:[...(u?u.split(/\s+/):[]).map(s=>({type:"literal",value:s})),{type:"role",role:n,optional:true,expectedTypes:o.expectedTypes,...o.valueShape!==void 0?{valueShape:o.valueShape}:{}}]}),e[n]={fromRole:n});}function Sn(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 Bn(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}=yt(i,e),o={type:"role",role:t,optional:false,...i.valueShape!==void 0?{valueShape:i.valueShape}:{}};if(!n)return [o];let u=n.split(/\s+/).filter(Boolean),s={type:"group",optional:true,tokens:u.map(c=>({type:"literal",value:c,...u.length===1&&a?.length?{alternatives:a}:{}}))};return (e.roleMarkers[t]?.position??"before")==="after"?[o,s]:[s,o]}function Tn(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:Pn(a,i)}),e[a.role]=a.default?{fromRole:a.role,default:a.default}:{fromRole:a.role});}function O0(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 o=Sn(r),u=e.roleMarkers.destination,s=r.roles.some(f=>f.role==="destination");u&&s&&o!=="destination"&&a.push({type:"group",optional:true,tokens:[{type:"role",role:"destination",optional:true},u.alternatives?{type:"literal",value:u.primary,alternatives:u.alternatives}:{type:"literal",value:u.primary}]});let l=e.roleMarkers.source,c=r.roles.some(f=>f.role==="source");l&&c&&o!=="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(...Bn(r,e,o));let p=e.roleMarkers.patient;if(p&&o==="patient"){let f=p.alternatives?{type:"literal",value:p.primary,alternatives:p.alternatives}:{type:"literal",value:p.primary};a.push(f);}let d=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};a.push(d),o!=="source"&&a.push(...rt(r,e.roleMarkers.source)),o!=="destination"&&a.push(...Rr(r,e.roleMarkers.destination));let m={action:{value:r.action},event:{fromRole:"event"},[o]:{fromRole:o},...o==="destination"?{}:et(r),...o==="source"?{}:tt(r)};return Tn(a,m,r,e,new Set(["event",o,"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?} {${o}} ${p?.primary||""} ${t.primary}`,tokens:a},extraction:m}}function L0(r,e,t,i,n){let a=[],o=r.action==="swap",u=o?"destination":"patient";a.push({type:"role",role:u,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 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 l=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};a.push(l),a.push(...rt(r,e.roleMarkers.source));let c=e.roleMarkers.destination;if(o&&c){let d=r.roles.find(m=>m.role==="patient")?.markerOverride?.[e.code];if(d&&d!==c.primary){let m=c.alternatives??[];m.includes(d)||(c={...c,alternatives:[...m,d]});}}a.push(...o?Wo(r,c):Rr(r,c));let p={action:{value:r.action},event:{fromRole:"event"},[u]:{fromRole:u},...o?{}:et(r),...tt(r)};return xn(a,p,r,e.code),qr(a,p,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:p}}function N0(r,e,t,i,n){let a=r.roles.find(p=>p.role==="source");if(!a)return null;let{marker:o,alternatives:u}=yt(a,e),s=e.roleMarkers.patient;if(!o||o===i.primary||o===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 p of o.split(/\s+/))l.push(u&&o.split(/\s+/).length===1?{type:"literal",value:p,alternatives:u}:{type:"literal",value:p});if(l.push({type:"role",role:"event",optional:false}),i.position==="after"){let p=i.primary.split(/\s+/);if(p.length>1)for(let d of p)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(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 xn(l,c,r,e.code),qr(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} ${o} {event} ${i.primary} ${t.primary}`,tokens:l},extraction:c}}function M0(r,e,t,i,n){let a=[];a.push({type:"role",role:"patient",optional:false});let o=e.roleMarkers.patient;if(o){let l=o.alternatives?{type:"literal",value:o.primary,alternatives:o.alternatives}:{type:"literal",value:o.primary};a.push(l);}let u=e.roleMarkers.destination;if(u&&(a.push({type:"role",role:"destination",optional:false}),a.push(u.alternatives?{type:"literal",value:u.primary,alternatives:u.alternatives}:{type:"literal",value:u.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} ${o?.primary||""} {destination} ${u?.primary||""} {event} ${i.primary} ${t.primary}`,tokens:a},extraction:{action:{value:r.action},event:{fromRole:"event"},patient:{fromRole:"patient"},destination:{fromRole:"destination"}}}}function _0(r,e,t,i,n){let a=[];a.push({type:"role",role:"event",optional:false});let o=i.alternatives?.filter(c=>!c.includes(" ")&&c.length>1)||[];o.length>0&&a.push({type:"literal",value:o[0],alternatives:o.slice(1)});let u=e.roleMarkers.destination;u&&a.push({type:"group",optional:true,tokens:[{type:"role",role:"destination",optional:true},u.alternatives?{type:"literal",value:u.primary,alternatives:u.alternatives}:{type:"literal",value:u.primary}]}),a.push({type:"role",role:"patient",optional:false});let 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(...rt(r,e.roleMarkers.source)),a.push(...Rr(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}${o[0]||""} {patient} ${t.primary}`,tokens:a},extraction:{action:{value:r.action},event:{fromRole:"event"},patient:{fromRole:"patient"},...et(r),...tt(r)}}}function I0(r,e,t,i,n){let a=[];if(a.push({type:"role",role:"event",optional:false}),i.position==="after"){let u=i.primary.split(/\s+/);if(u.length>1)for(let s of u)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 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-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 $0(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 o=e.roleMarkers.patient;if(o?.primary){let s=o.alternatives?{type:"literal",value:o.primary,alternatives:o.alternatives}:{type:"literal",value:o.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-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 j0(r,e,t,i,n){let a=[];if(a.push({type:"role",role:"event",optional:false}),i.position==="after"){let p=i.primary.split(/\s+/);if(p.length>1)for(let d of p)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 u=[...r.roles.filter(p=>p.required)].sort((p,d)=>{let m=p.sovPosition??999,f=d.sovPosition??999;return m-f});for(let p of u){a.push({type:"role",role:p.role,optional:false});let{marker:d,alternatives:m}=yt(p,e);if(d){let f=m?{type:"literal",value:d,alternatives:m}:{type:"literal",value:d};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=u.map(p=>`{${p.role}}`).join(" "),c={action:{value:r.action},event:{fromRole:"event"},...Object.fromEntries(u.map(p=>[p.role,{fromRole:p.role}]))};return Lt(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 W0(r,e,t,i,n){let a=[],u=[...r.roles.filter(c=>c.required)].sort((c,p)=>{let d=c.sovPosition??999,m=p.sovPosition??999;return d-m});for(let c of u){a.push({type:"role",role:c.role,optional:false});let{marker:p,alternatives:d}=yt(c,e);p&&a.push(d?{type:"literal",value:p,alternatives:d}:{type:"literal",value:p});}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 p of c)a.push({type:"literal",value:p});else a.push(i.alternatives?{type:"literal",value:i.primary,alternatives:i.alternatives}:{type:"literal",value:i.primary});}let s=u.map(c=>`{${c.role}}`).join(" "),l={action:{value:r.action},event:{fromRole:"event"},...Object.fromEntries(u.map(c=>[c.role,{fromRole:c.role}]))};return Lt(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 q0(r,e,t,i,n){let a=[],u=[...r.roles.filter(h=>h.required)].sort((h,v)=>{let E=h.sovPosition??999,k=v.sovPosition??999;return E-k}),s=u[0];a.push({type:"role",role:s.role,optional:false});let{marker:l,alternatives:c}=yt(s,e);if(l){let h=c?{type:"literal",value:l,alternatives:c}:{type:"literal",value:l};a.push(h);}if(a.push({type:"role",role:"event",optional:false}),i.position==="after"){let h=i.primary.split(/\s+/);if(h.length>1)for(let v of h)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 p=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};a.push(p);let d=u[1];a.push({type:"role",role:d.role,optional:false});let{marker:m,alternatives:f}=yt(d,e);if(m){let h=f?{type:"literal",value:m,alternatives:f}:{type:"literal",value:m};a.push(h);}let y={action:{value:r.action},event:{fromRole:"event"},[s.role]:{fromRole:s.role},[d.role]:{fromRole:d.role}};return Lt(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} {${d.role}}`,tokens:a},extraction:y}}function Fn(r,e,t){let i=$e(r,e.code,t.primary)??[],n=[...new Set([...t.alternatives??[],...i])].filter(a=>a!==t.primary);return n.length?n:void 0}function vi(r,e,t,i,n){let a=[];if(i.position==="before"){let p=i.alternatives?{type:"literal",value:i.primary,alternatives:i.alternatives}:{type:"literal",value:i.primary};a.push(p);}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);let u=Sn(r);a.push(...Bn(r,e,u));let s=e.roleMarkers.destination,l=r.roles.some(p=>p.role==="destination");s&&l&&u!=="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}]}),u!=="source"&&a.push(...rt(r,e.roleMarkers.source));let c={action:{value:r.action},event:{fromRole:"event"},[u]:{fromRole:u},...u==="destination"?{}:et(r),...u==="source"?{}:tt(r)};return Tn(a,c,r,e,new Set(["event",u,"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} {${u}} ${s?.primary||""} {destination?}`,tokens:a},extraction:c}}function V0(r,e,t,i,n){let a=[],o=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};a.push(o);let u=r.action==="swap";a.push({type:"role",role:u?"destination":"patient",optional:false});let s=u?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(...rt(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}),u){let c=r.roles.find(p=>p.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"},[u?"destination":"patient"]:{fromRole:u?"destination":"patient"},...u?{}:et(r),...tt(r)};return qr(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 K0(r,e,t,i,n){let a=[],o=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};a.push(o);let s=[...r.roles.filter(p=>p.required)].sort((p,d)=>{let m=p.svoPosition??999,f=d.svoPosition??999;return m-f});for(let p of s){let d,m;if(p.markerOverride&&p.markerOverride[e.code]!==void 0)d=p.markerOverride[e.code],m=d?$e(p,e.code,d):void 0;else {let f=e.roleMarkers[p.role];f&&(d=f.primary,m=Fn(p,e,f));}if(d){let f=m?{type:"literal",value:d,alternatives:m}:{type:"literal",value:d};a.push(f);}a.push({type:"role",role:p.role,optional:false});}if(i.position==="before"){let p=i.alternatives?{type:"literal",value:i.primary,alternatives:i.alternatives}:{type:"literal",value:i.primary};a.push(p);}a.push({type:"role",role:"event",optional:false});let l=s.map(p=>`{${p.role}}`).join(" "),c={action:{value:r.action},event:{fromRole:"event"},...Object.fromEntries(s.map(p=>[p.role,{fromRole:p.role}]))};return Lt(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 hi(r,e,t,i,n){let a=[];if(i.position==="before"){let p=i.alternatives?{type:"literal",value:i.primary,alternatives:i.alternatives}:{type:"literal",value:i.primary};a.push(p);}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);let s=[...r.roles.filter(p=>p.required)].sort((p,d)=>{let m=p.svoPosition??999,f=d.svoPosition??999;return m-f});for(let p of s){let d,m;if(p.markerOverride&&p.markerOverride[e.code]!==void 0)d=p.markerOverride[e.code],m=d?$e(p,e.code,d):void 0;else {let f=e.roleMarkers[p.role];f&&(d=f.primary,m=Fn(p,e,f));}if(d){let f=m?{type:"literal",value:d,alternatives:m}:{type:"literal",value:d};a.push(f);}a.push({type:"role",role:p.role,optional:false});}let l=s.map(p=>`{${p.role}}`).join(" "),c={action:{value:r.action},event:{fromRole:"event"},...Object.fromEntries(s.map(p=>[p.role,{fromRole:p.role}]))};return Lt(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 H0(r,e,t,i,n){let a=[],o=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(o){let l=o.alternatives?{type:"literal",value:o.primary,alternatives:o.alternatives}:{type:"literal",value:o.primary};a.push(l);}a.push({type:"role",role:"event",optional:false});let u=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};a.push(u),a.push({type:"role",role:"patient",optional:false});let 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(...rt(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} ${o?.primary||""} {event} ${t.primary} {patient} ${s?.primary||""} {destination?}`,tokens:a},extraction:{action:{value:r.action},event:{fromRole:"event"},patient:{fromRole:"patient"},...et(r),...tt(r)}}}function U0(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 o=e.roleMarkers.destination;return o&&n.push({type:"group",optional:true,tokens:[o.alternatives?{type:"literal",value:o.primary,alternatives:o.alternatives}:{type:"literal",value:o.primary},{type:"role",role:"destination",optional:true}]}),n.push(...rt(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} ${o?.primary||""} {destination?}`,tokens:n},extraction:{action:{value:r.action},event:{fromRole:"event"},patient:{fromRole:"patient"},...et(r),...tt(r)}}}var gt={basePriority:100,generateSimpleVariants:true,generateAlternatives:true};function Dt(r,e,t=gt){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 o=J0(r,e,a),u=Vr(r,e),s=rd(r,e,a);return {id:i,language:e.code,command:r.action,priority:n,template:{format:s,tokens:o},extraction:u}}function G0(r,e,t=gt){if(r.roles.filter(u=>!u.required).length===0)return null;let n=r.roles.filter(u=>u.required),a={...r,roles:n};return {...Dt(a,e,t),id:`${r.action}-${e.code}-generated-simple`,priority:(t.basePriority??100)-5,extraction:Vr(r,e)}}function Ei(r,e,t=gt){if(e.wordOrder!=="SOV")return null;let i=r.roles.filter(u=>u.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},o=i.flatMap(u=>{let s=u.valuePrefixLiteral?.[e.code],l={type:"role",role:u.role,optional:false,expectedTypes:u.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,...o]},extraction:Vr(r,e)}}function Z0(r,e,t=gt){let i=[];if(i.push(Dt(r,e,t)),t.generateSimpleVariants){let n=G0(r,e,t);n&&i.push(n);}for(let n of r.omitRoleVariants??[]){let a={...r,roles:r.roles.filter(u=>u.role!==n)},o=Dt(a,e,t);i.push({...o,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(u=>u.role===n.role?{...u,expectedTypes:[...n.types]}:u)},o=Dt(a,e,t);i.push({...o,id:`${r.action}-${e.code}-generated-${n.idSuffix}`,priority:(t.basePriority??100)-(n.priorityDelta??15)});}if(t.generateVerbFirstVariants!==false){let n=Ei(r,e,t);n&&i.push(n);}for(let n of r.rolePrefixLiteralVariants??[]){let a=n.literal[e.code];if(!a)continue;let{rolePrefixLiteralVariants:o,...u}=r,s={...u,roles:r.roles.map(d=>d.role===n.role?{...d,valuePrefixLiteral:{[e.code]:a}}:d)},l=n.priorityDelta??5,c=n.methodCarrier?{[n.methodCarrier]:{value:a}}:{},p=Dt(s,e,t);if(i.push({...p,id:`${r.action}-${e.code}-generated-${n.idSuffix}`,priority:(t.basePriority??100)+l,extraction:{...p.extraction,...c}}),t.generateVerbFirstVariants!==false){let d=Ei(s,e,t);d&&i.push({...d,id:`${r.action}-${e.code}-generated-verb-first-${n.idSuffix}`,priority:(t.basePriority??100)-20+l,extraction:{...d.extraction,...c}});}}return i}function Y0(r,e=gt){let t=[],i=is();for(let n of i){if(!r.keywords[n.action])continue;let a=Z0(n,r,e);if(t.push(...a),r.eventHandler?.eventMarker){let o=X0(n,r,e);t.push(...o);}}return t}function X0(r,e,t=gt){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 u=r.roles.filter(s=>s.required).length===2;if(e.wordOrder==="SOV")if(u)i.push(j0(r,e,a,n,t)),i.push(q0(r,e,a,n,t)),i.push(W0(r,e,a,n,t));else {i.push(O0(r,e,a,n,t)),i.push(L0(r,e,a,n,t));let s=N0(r,e,a,n,t);s&&i.push(s);let l=e.roleMarkers.destination;l&&l.primary!==n.primary&&i.push(M0(r,e,a,n,t));let c=n.primary.split(/\s+/),p=n.alternatives?.some(m=>!m.includes(" ")&&m.length>1);c.length>1&&p&&i.push(_0(r,e,a,n,t)),i.push(I0(r,e,a,n,t));let d=$0(r,e,a,t);d&&i.push(d);}else e.wordOrder==="VSO"?u?(i.push(hi(r,e,a,n,t)),i.push(K0(r,e,a,n,t))):(i.push(vi(r,e,a,n,t)),i.push(V0(r,e,a,n,t)),e.eventHandler?.negationMarker&&i.push(H0(r,e,a,n,t)),e.tokenization?.prefixes&&i.push(U0(r,e,a,t))):u?i.push(hi(r,e,a,n,t)):i.push(vi(r,e,a,n,t));return i}function J0(r,e,t){let i=[],n=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary},a=ed(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 Q0(i)}function Q0(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 ed(r,e){let t=[],i=An(r.roles,e.wordOrder);for(let n of i){let a=Pn(n,e);n.required?t.push(...a):t.push({type:"group",optional:true,tokens:a});}return t}function Pn(r,e){let t=[],i=r.markerOverride?.[e.code],n=e.roleMarkers[r.role],a=r.renderOverride?.[e.code]==="",o={type:"role",role:r.role,optional:!r.required,expectedTypes:r.expectedTypes,...r.valueShape!==void 0?{valueShape:r.valueShape}:{}},u=r.valuePrefixLiteral?.[e.code],s=()=>{u&&t.push({type:"literal",value:u}),t.push(o);};if(i!==void 0){let l=i?i.split(/\s+/).filter(Boolean):[],c=i!==void 0&&i===r.markerOverride?.en,p=n?.position??(e.wordOrder==="SOV"&&!c?"after":"before"),d=r.markerOptional?.[e.code]===true,m=f=>{let y=l.length===1?$e(r,e.code,f)??[]:[],h={type:"literal",value:f,...y.length?{alternatives:y}:{},...a?{renderSuppress:true}:{}};t.push(d?{type:"group",optional:true,tokens:[h]}:h);};if(p==="before"){for(let f of l)m(f);s();}else {s();for(let f of l)m(f);}}else if(n){let l=()=>{let p=[...new Set([...n.alternatives??[],...$e(r,e.code,n.primary)??[]])].filter(d=>d!==n.primary);return {type:"literal",value:n.primary,...p.length?{alternatives:p}:{},...a?{renderSuppress:true}:{}}},c=p=>{if(!e.markersOptional&&!r.markerOptional?.[e.code]){t.push(p);return}t.push({type:"group",optional:true,...e.markersOptional&&!r.markerOptional?.[e.code]?{renderRequired:true}:{},tokens:[p]});};n.position==="before"?(n.primary&&c(l()),s()):(s(),c(l()));}else s();return t}function td(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 u=!/\s/.test(n.trim())?$e(i,e.code,n)??[]:[];t[i.role]=u.length?{marker:n,markerAlternatives:u}:{marker:n};}else if(a&&a.primary){let o=[...new Set([...a.alternatives??[],...$e(i,e.code,a.primary)??[]])].filter(u=>u!==a.primary);t[i.role]=o.length?{marker:a.primary,markerAlternatives:o}:{marker:a.primary};}else t[i.role]={};}return t}function Vr(r,e){let t=td(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 rd(r,e,t){let i=[],a=An(r.roles,e.wordOrder).map(o=>{let u=P0(o,e),s="";return u&&u.primary?u.position==="before"?s=`${u.primary} {${o.role}}`:s=`{${o.role}} ${u.primary}`:s=`{${o.role}}`,o.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 id=[$o,jo,Cs,Js,cl,zl,Ol,Hl,pc,wc,Oc,Kc,ep,fp,_p,$p,Wp,Up,Yp,o0,Qs],gi=new Map;function nd(r){let e=gi.get(r);if(e)return e;let t=T(r);if(!t)return [];let i=Y0(t);return gi.set(r,i),i}function ad(r){let e=id.flatMap(t=>t(r));return r==="en"&&e.push(...F0()),e.push(...nd(r)),e.map(ud)}var od=new Set(["on.source"]);function ud(r){let e=ue(r.command);if(!e)return r;let t;for(let i of e.roles){if(i.required||!i.default||od.has(`${r.command}.${i.role}`))continue;let n=r.extraction?.[i.role];n?.default!==void 0||n?.value!==void 0||(t??(t={...r.extraction}),t[i.role]={...n,default:i.default});}return t?{...r,extraction:t}:r}function sd(r){return ad(r.code)}rp(sd);var Kr=["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"],Hr=["is not empty","is empty","does not exist"],Ur=["is not an","is not a","is an","is a"],ld=new Set(["me","my","myself","you","your","yourself","it","its","result","event","target","body","detail","window","document"]),cd=new Set(["and","or","not","no"]),pd=new Set(["true","false","null","undefined"]),dd=new Set(Kr.map(r=>r.slice(r.lastIndexOf(" ")+1))),md=new Set(["next","previous","closest","first","last"]),fd=new Set(["ms","s","seconds","second","milliseconds","millisecond","minutes","minute","hours","hour"]);function Rn(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"&&dd.has(f.value.toLowerCase())||f.type==="IDENTIFIER"&&md.has(f.value.toLowerCase())||f.type==="IDENTIFIER"&&f.value.toLowerCase()==="of"?true:["OPERATOR","COMPARISON","LOGICAL","LPAREN","LBRACKET","LBRACE","COMMA","COLON"].includes(f.type)}function o(f=0){return r[t+f]??""}function u(){let f=r[t];return t++,f===`
4
- `?(i++,n=1):n++,f}function s(){for(;t<r.length&&/\s/.test(r[t]);)u();}function l(f){let y="";for(;t<r.length&&f(r[t]);)y+=u();return y}function c(f){let y=f;for(u();t<r.length&&r[t]!==f;)r[t]==="\\"&&t+1<r.length&&(y+=u()),y+=u();return t<r.length&&(y+=u()),y}function p(){let f="`";for(u();t<r.length&&r[t]!=="`";)r[t]==="\\"&&t+1<r.length&&(f+=u()),f+=u();return t<r.length&&(f+=u()),f}function d(){let f="<";for(u();t<r.length&&(f+=u(),!f.endsWith("/>")););return f}function m(f,y,h){return {type:f,value:y,start:h,end:t,line:i,column:n-y.length}}for(;t<r.length&&(s(),!(t>=r.length));){let f=t,y=o();if(y==="'"&&o(1)==="s"&&!/\w/.test(o(2))){u(),u(),e.push(m("POSSESSIVE","'s",f));continue}if(y==='"'||y==="'"){let h=c(y);e.push(m("STRING",h,f));continue}if(y==="`"){let h=p();e.push(m("TEMPLATE_LITERAL",h,f));continue}if(y==="<"&&/[a-zA-Z.#\[]/.test(o(1))){let h=d();e.push(m("QUERY_SELECTOR",h,f));continue}if(y==="#"&&a()){u();let h=l(v=>/[\w-]/.test(v));e.push(m("ID_SELECTOR","#"+h,f));continue}if(y==="."&&/[a-zA-Z_-]/.test(o(1))&&a()){u();let h=l(v=>/[\w-]/.test(v));e.push(m("CLASS_SELECTOR","."+h,f));continue}if(y==="@"&&/[a-zA-Z_]/.test(o(1))){u();let h=l(v=>/[\w-]/.test(v));e.push(m("ATTRIBUTE_REF","@"+h,f));continue}if(y==="["&&a()&&o(1)==="@"){let v="";for(v+=u();t<r.length&&r[t]!=="]";)r[t]==='"'||r[t]==="'"?v+=c(r[t]):v+=u();t<r.length&&(v+=u()),e.push(m("ATTRIBUTE_SELECTOR",v,f));continue}if(y==="["){u(),e.push(m("LBRACKET","[",f));continue}if(y==="]"){u(),e.push(m("RBRACKET","]",f));continue}if(/\d/.test(y)){let h=l(k=>/[\d.]/.test(k)),v=t,E=l(k=>/[a-zA-Z]/.test(k));fd.has(E)?e.push(m("TIME_EXPRESSION",h+E,f)):(t=v,e.push(m("NUMBER",h,f)));continue}if(y==="("){u(),e.push(m("LPAREN","(",f));continue}if(y===")"){u(),e.push(m("RPAREN",")",f));continue}if(y==="{"){u(),e.push(m("LBRACE","{",f));continue}if(y==="}"){u(),e.push(m("RBRACE","}",f));continue}if(y===","){u(),e.push(m("COMMA",",",f));continue}if(y===":"){u(),e.push(m("COLON",":",f));continue}if(y==="."){u(),e.push(m("DOT",".",f));continue}if(y==="|"){u(),e.push(m("PIPE","|",f));continue}if(y==="+"||y==="-"||y==="*"||y==="/"||y==="%"){u(),e.push(m("OPERATOR",y,f));continue}if(y==="="||y==="!"||y==="<"||y===">"){let h=u();o()==="="&&(h+=u()),(h==="=="||h==="!=")&&o()==="="&&(h+=u()),e.push(m("COMPARISON",h,f));continue}if(/[a-zA-Z_$]/.test(y)){let h=l(E=>/[\w$]/.test(E)),v=h.toLowerCase();ld.has(v)?e.push(m("CONTEXT_VAR",h,f)):cd.has(v)?e.push(m("LOGICAL",h,f)):pd.has(v)?e.push(m("BOOLEAN",h,f)):e.push(m("IDENTIFIER",h,f));continue}u();}return e.push(m("EOF","",t)),e}var yd=new Set(["my","its","your"]),vd={my:"me",its:"it",your:"you"},hd=new Set(["is","matches","match","contains","in","exists","does"]),Ed=new Set(["next","previous","closest","first","last"]),gd=[...Hr,...Ur,...Kr].map(r=>[r,r.split(" ")]),kd=class{constructor(){this.tokens=[],this.current=0;}parse(r){try{return this.tokens=Rn(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(Hr.includes(e))r=this.createPostfixUnary(e,r);else if(Ur.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 gd)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"&&yd.has(r.name)&&this.check("IDENTIFIER")&&!hd.has(this.peek().value.toLowerCase())){let e=this.advance(),t=r,i={...t,name:vd[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(Ed.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 zd(r){return new kd().parse(r)}var On={possessive:{specialForms:{me:"my",it:"its",you:"your"}}};function Kt(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 Fe(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 hr(r){return On.possessive?.specialForms?.[r]??`${r}'s`}var nr=new Set(["+","-","*","/","%","<",">","<=",">=","==","!=","===","!=="]),Ln=new Set(["<",">","<=",">=","==","!=","===","!=="]),Ke=new Set([...nr,"mod"]),Hd=/^[<>=!+\-*/%]+$/,Nn={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 Ud(r){return Nn[r]}function ar(r,e){return Nn[e]?.has(r.toLowerCase())??false}var Gr={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"}},Gd={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"}},Mn={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 Ue(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?Mn[r.code]:void 0;return !!n&&n.has(t)}var Zd={destination:"in",source:"from"},_n={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"])},In=new Set(["in","into","at","within","inside"]);function Yd(r,e){let t=e.value.toLowerCase();if((r?.code?_n[r.code]:void 0)?.has(t))return "in";let n=e.normalized??e.value,a=n.toLowerCase();return In.has(a)?"in":Zd[a]??n}function Xd(r,e){return e.value.toLowerCase()==="in"||(r?.code?_n[r.code]:void 0)?.has(e.value.toLowerCase())?true:In.has((e.normalized??e.value).toLowerCase())}var Jd=new Set(["me","it","you","body","document","target","result"]);function Qd(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(Jd.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 $n(r,e,t,i){let n=r[e];if(!n||!Xd(t,n))return null;let a=Qd(r,e+1);if(!a)return null;let o=r[e+1+a.consumed];return i?.(n)===true&&i(o)!==true?null:{marker:n,scope:a}}var Er=new Set(["first","last","next","previous","random","closest"]),em={bn:{\u09B6\u09C7\u09B7:"last"}},kt=new Set(Object.keys(le).map(r=>r.toLowerCase()));function Ft(r,e,t,i){let n=r[e];if(!n)return null;let a=(n.normalized??n.value).toLowerCase(),o=r[e+1],u=t?.code&&o?.kind==="selector"&&o.value.startsWith("<")?em[t.code]?.[n.value.toLowerCase()]:void 0;if(!Er.has(a)&&!Er.has(n.value.toLowerCase())&&u===void 0)return null;let s=[{text:u??n.normalized??n.value,token:n}],l=e+1,c=r[l];if(!c||c.kind!=="selector"||Ln.has(c.value))return null;s.push({text:c.value,token:c}),l++;let p=0;for(;p++<8;){let f=r[l];if(f&&f.kind==="selector"&&f.value.startsWith("."))s.push({text:f.value,token:f}),l++;else break}let d=r[l],m=r[l+1];if(d&&m&&m.kind==="selector"&&!/^[*@]/.test(m.value)&&(d.kind==="keyword"||d.kind==="particle"||d.kind==="identifier")&&!Er.has((d.normalized??d.value).toLowerCase())&&!kt.has((d.normalized??d.value).toLowerCase())&&!(i?.(d)===true&&i(r[l+2])!==true))s.push({text:Yd(t,d),token:d}),s.push({text:m.value,token:m}),l+=2;else {let f=$n(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=Gd[r];return t?t[e.toLowerCase()]??e:e}function ke(r,e){let t=Gr[r];return t?t[e.toLowerCase()]??e:e}function wi(r,e){return Gr[r]?.[e.toLowerCase()]!==void 0}function tm(r,e){let t=[e.value,e.normalized].filter(Boolean);for(let i of t){let n=Fe(r,i)??Fe(r,i.toLowerCase());if(n)return n}}function jn(r){return r.kind==="literal"||r.kind==="operator"||r.kind==="punctuation"?false:!/^[$:@#.*^(){}[\]]/.test(r.value)}function rm(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 ct(r,e){return jn(r)?ke(e,r.value)!==r.value?true:r.kind==="identifier":false}var im=new Set(["true","false","null","undefined","me","my","it","its","you","your","result","event","target","body","detail","document","window"]);function Wn(r){return r.kind==="literal"||r.kind==="selector"||r.kind==="reference"?true:r.kind==="identifier"?am.test(r.value):r.kind==="keyword"&&im.has((r.normalized??r.value).toLowerCase())}function bi(r){return !!r&&(r.value===")"||r.value==="]"||Wn(r))}function Dr(r){if(!r)return false;if(/^[([-]$/.test(r.value)||Wn(r))return true;let e=(r.normalized??"").toLowerCase();return r.kind==="keyword"&&(e==="not"||e==="no")}var nm=/^\.[\p{L}_-][\p{L}\p{N}_-]*$/u,am=/^(?:[:$]?[\p{L}_][\p{L}\p{M}\p{N}_]*|\([\p{L}_$][\p{L}\p{M}\p{N}_$]*\))$/u,U={beforeClassRef:"has"},om={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:U},th:{\u0E40\u0E1B\u0E47\u0E19:{beforeTypeName:"as",beforePredicate:"is",afterOperand:"is"},\u0E27\u0E48\u0E32\u0E07:{afterCopula:"empty"},\u0E21\u0E35:U},ja:{\u7A7A:{afterCopula:"empty"},\u3042\u308B:U},sw:{tupu:{afterCopula:"empty",otherwise:"null"},na:{betweenOperands:"and"},ana:U,nina:U},zh:{\u6CA1\u6709:{beforeBareIdentifier:"no",beforeSelector:"no"},\u6709:U},tl:{walang:{beforeBareIdentifier:"no",beforeSelector:"no"},may:{afterSubject:"exists",beforeClassRef:"has"}},bn:{\u0986\u099B\u09C7:{afterSubject:"exists",beforeClassRef:"has"},\u0986\u099B\u09BF:U},qu:{mana:{beforeOperand:"not"},chusaq:{afterCopula:"empty"},kachkan:U,kachkani:U},tr:{var:{afterSubject:"exists",beforeClassRef:"has"},bo\u015F:{afterCopula:"empty"}},de:{hat:U,habe:U},es:{tiene:U,tengo:U},fr:{a:U,ai:U},it:{ha:U,ho:U},ko:{\uC788\uB2E4:U},ms:{ada:U},pl:{ma:U,mam:U},pt:{tem:U,tenho:U},ru:{\u0438\u043C\u0435\u0435\u0442:U,\u0438\u043C\u0435\u044E:U},uk:{\u043C\u0430\u0454:U,\u043C\u0430\u044E:U},vi:{c\u00F3:U}},um=new Set(["text","json","html","response","blob","arraybuffer"]),sm=new Set(["empty","null","undefined","true","false"]),qn=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 Pt(r){return qn.has(r)||/^Fixed(?::\d+)?$/.test(r)||/^[A-Z][A-Za-z0-9_]*(?::[A-Za-z0-9_]+)?$/.test(r)}function Vn(r,e,t,i,n,a){let o=Sr(r,e);if(!o)return;if(o.beforeTypeName&&i?.kind==="identifier"&&a?.value!=="("&&(qn.has(i.value)||um.has(i.value.toLowerCase())))return o.beforeTypeName;if(o.beforePredicate&&i&&(i.kind==="literal"||i.kind==="keyword"&&sm.has((i.normalized??"").toLowerCase())))return o.beforePredicate;if(o.afterCopula&&n!==void 0&&["is","not","does","do"].includes(n.toLowerCase()))return o.afterCopula;if(o.beforeBareIdentifier&&i?.kind==="identifier"&&/^[A-Za-z_]\w*$/.test(i.value))return o.beforeBareIdentifier;let u=!!i&&Rt(i,r)&&_e({prev:e,beforePrev:t,next:a},r);if(o.beforeOperand&&(Dr(i)||u))return o.beforeOperand;if(o.beforeSelector&&i?.kind==="selector")return o.beforeSelector;if(o.beforeClassRef&&i&&nm.test(i.value))return o.beforeClassRef;if(o.afterSubject&&(t?.kind==="selector"||t?.kind==="reference"))return o.afterSubject;let s=!!t&&Rt(t,r)&&n===t.value;return o.betweenOperands&&(bi(t)||s)&&Dr(i)?o.betweenOperands:o.afterOperand&&(bi(t)||t?.value==="}")?o.afterOperand:o.otherwise}function Sr(r,e){let t=om[r];return t?.[e.value]??t?.[e.value.toLowerCase()]}function lm(r,e,t,i){return Vn(r,e,t,i,void 0,void 0)}function cm(r){return Hd.test(r)||r==="("||r==="["||r===","}function pm(r){return nr.has(r)&&r!=="-"||r===")"||r==="]"||r===","}var dm=new Set(["is","am","contains","contain","matches","match","has","have","includes","include","exists","exist","mod"]);function Kn(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&&cm(t.value))return true;if(i===void 0)return false;if(pm(i.value))return true;let a=i.kind==="keyword"?(i.normalized??i.value).toLowerCase():Qe(r,i.value).toLowerCase();return dm.has(a)}var mm=new Set(["include","contain","match","exist"]);function Hn(r){let e=r?.toLowerCase();return e==="is"||e==="not"}function Un(r,e,t){let i=e[t],n=e[t-1];return !i||!n||i.value.toLowerCase()!=="in"?false:Hn(vt(r,n,e[t-2],i,void 0))}function vt(r,e,t,i,n,a){if(n?.toLowerCase()==="equal"&&e.value.toLowerCase()==="to")return "to";if(Hn(n)&&e.value.toLowerCase()==="in")return "in";if(n?.toLowerCase()==="not"&&mm.has(e.value.toLowerCase()))return e.value.toLowerCase();let o=Vn(r,e,t,i,n,a);if(o!==void 0)return o;if(Kn(r,e,t,i))return e.value;let u=Qe(r,e.value);if(u!==e.value)return u;if(e.kind!=="keyword")return e.value;let s=(e.normalized??e.value).toLowerCase();return s!=="event"&&Ot.has(s)||Rt(e,r)&&_e({prev:t,next:i,afterNext:a},r)?e.value:e.normalized??e.value}function Gn(r,e,t,i){let n=r[e],a=r[e+1];if(!n||!a||!jn(n)||!Ue(t,a)||!ct(n,i))return;if(r[e+2]?.kind==="selector")return e+2;let o=e;for(;r[o]!==void 0&&r[o+1]!==void 0&&Ue(t,r[o+1])&&ct(r[o],i);)o+=2;return o>e+2&&r[o]?.kind==="selector"?o:void 0}var fm=new Set(["if","unless","while","until","for","when","where","is","not","no","and","or","as"]);function ym(r){let e=(r.normalized??r.value).toLowerCase();return e==="event"||Le(e)?false:fm.has(e)||Ot.has(e)}function Rt(r,e){return r.kind!=="keyword"?false:(r.normalized??r.value).toLowerCase()==="end"||ar(r.value,e)}function ze(r,e){return {prev:r[e-1],beforePrev:r[e-2],third:r[e-3],next:r[e+1],afterNext:r[e+2]}}var vm=new Set(["and","or","is","times"]),hm=new Set(["if","unless","while","until","is","and","or","in"]),Em=r=>Object.prototype.hasOwnProperty.call(le,r);function gr(r){if(r.kind!=="keyword"&&!(r.normalized&&r.normalized!==r.value))return;let e=(r.normalized??r.value).toLowerCase();return Em(e)?e:void 0}var Ci=new WeakMap;function Ai(r,e,t=false){let i;try{i=ye(r);}catch{return new Set}let n=Ci.get(i);n||(n=new Map,Ci.set(i,n));let a=t?`${e} before a role pair`:e,o=n.get(a);if(!o){o=new Set;for(let u of i){if(u.command!==e)continue;let[s,l,c,p]=u.template.tokens;if(!(s?.type!=="literal"||l?.type!=="literal")&&!(t&&(c?.type!=="role"||p?.type!=="role")))for(let d of [l.value,...l.alternatives??[]])o.add(d.toLowerCase());}n.set(a,o);}return o}var xi=new WeakMap;function gm(r){let e;try{e=ye(r);}catch{return new Set}let t=xi.get(e);if(!t){let i=new Set(Object.values(T(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 o=a.template.tokens;o.forEach((u,s)=>{if(!(u.type!=="literal"||o[s+1]?.type!=="role"))for(let l of [u.value,...u.alternatives??[]])i.has(l.toLowerCase())||n.add(l.toLowerCase());});}t=n,xi.set(e,t);}return t}function Di(r){return r.kind==="particle"?true:r.kind==="keyword"&&Ot.has((r.normalized??"").toLowerCase())}function Si(r,e){return r.kind==="keyword"&&r.normalized?r.normalized.toLowerCase():Qe(e,r.value).toLowerCase()}function _e(r,e){let{prev:t,beforePrev:i,next:n,afterNext:a}=r;if(n){if(Ke.has(n.value)||vm.has((n.normalized??n.value).toLowerCase())||n.value==="'"&&a?.value.toLowerCase()==="s")return true;let f=Sr(e,n)?.betweenOperands;if((f==="and"||f==="or")&&Dr(a))return true}let o=T(e),u=!!o&&o.markingStrategy!=="preposition";if(u&&n?.kind==="particle"&&a?.kind!=="particle")return true;if(!t)return false;if(nr.has(t.value))return true;let s=Si(t,e);if(s==="not"||s==="no"||Sr(e,t)?.beforeOperand==="not")return true;let l=o?.wordOrder!=="SOV",c=r.third?gr(r.third):void 0;if(c&&i&&Ai(e,c,true).has(i.value.toLowerCase()))return true;let p=i&&l?gr(i):void 0;if(p&&!Ai(e,p).has(t.value.toLowerCase())||i&&!u&&Di(i))return false;if(hm.has(s))return true;let d=!!i&&Si(i,e)!=="repeat"&&!!jr[e]?.includes(t.value);if(gm(e).has(t.value.toLowerCase())&&(l||s!=="repeat")&&!d)return true;let m=l?gr(t):void 0;return m&&le[m].roles.some(f=>f.required)?true:!u&&Di(t)}function Zn(r){if(r.kind==="keyword")return ym(r)?"structure":kt.has((r.normalized??r.value).toLowerCase())?"verb":void 0}function Oe(r,e){let t=e?.code??"en",[i]=r;if(r.length===1&&i&&(Zn(i)||Rt(i,t)))return i.value;let n="",a,o,u=(s,l)=>{if(o=s,a===void 0){n=s,a=l;return}let p=a.position?.end!==void 0&&l.position?.start!==void 0&&a.position.end===l.position.start&&(s.startsWith(".")||s.startsWith("!"));n+=(p?"":" ")+s,a=l;};for(let s=0;s<r.length;s++){let l=r[s],c=e?tm(e,l):void 0,p=r[s+1];if(l.value===":"&&a!==void 0&&o!==void 0&&p!==void 0&&a.position?.end===l.position?.start&&l.position?.end===p.position?.start&&Pt(`${o}:${p.value}`)){n+=`:${p.value}`,o=`${o}:${p.value}`,a=p,s+=1;continue}if(l.value==="'"&&a!==void 0&&p?.value==="s"&&l.position?.end!==void 0&&p.position?.start===l.position.end){n+="'s",a=p;let v=r[s+2];v&&ke(t,v.value)!==v.value?(u(ke(t,v.value),v),s+=2):s+=1;continue}let d=e?.possessive,m=r[s+2];if(d?.markerPosition==="between"&&d.marker&&l.kind==="selector"&&p?.value===d.marker&&m!==void 0&&ct(m,t)){u(`${l.value}'s`,l),u(ke(t,m.value),m),s+=2;continue}if(p?.value.toLowerCase()==="of"&&ke(t,l.value)!==l.value&&ct(l,t)){u(ke(t,l.value),l);continue}if(c!==void 0&&p){let v=e?.possessive?.connectors,E=!!v?.length&&v.some(g=>{let A=g.toLowerCase();return A===p.value.toLowerCase()||A===(p.normalized??"").toLowerCase()}),k=E?s+2:s+1,w=r[k];if(w&&ct(w,t)){u(hr(c),l),u(ke(t,w.value),w),s=k;continue}if(E&&w&&/^\.[a-zA-Z_]\w*$/.test(w.value)&&p.position?.end!==void 0&&w.position?.start!==void 0&&p.position.end===w.position.start){u(hr(c),l),u(ke(t,w.value.slice(1)),w),s=k;continue}if(!E&&/^\.[a-zA-Z_]\w*$/.test(p.value)&&l.position?.end!==void 0&&p.position?.start!==void 0&&l.position.end===p.position.start&&!rm(e,l)){u(hr(c),l),u(ke(t,p.value.slice(1)),p),s+=1;continue}}let f=r[s+2],y=Gn(r,s,e,t);if(y!==void 0){for(let v=s;v<y;v+=2)u(ke(t,r[v].value),r[v]),u("of",r[v+1]);u(r[y].value,r[y]),s=y;continue}if(l.kind==="selector"&&p&&f&&Ue(e,p)&&ct(f,t)&&ke(t,f.value)!==f.value){u(ke(t,f.value),f),u("of",p),u(l.value,l),s+=2;continue}let h=Ft(r,s,e);if(h){for(let v of h.parts)u(v.text,v.token);s+=h.consumed-1;continue}u(vt(t,l,r[s-1],p,o,r[s+2]),l);}return n.trim()}function km(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 Yn(r){return !!r&&Ke.has(r.value)}var zm=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=ze(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 km(this.next)}};function wm(r){let e=r.token.value.toLowerCase();if(e!=="a"&&e!=="an")return false;let t=r.next;return t!==void 0&&(nr.has(t.value)||r.nextIsMarker)}function Zr(r){return r.kind==="keyword"&&kt.has((r.normalized??r.value).toLowerCase())}function bm(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"||ar(t.value,e))&&!_e(r.place,e)}function Cm(r,e){return Rt(r.token,e)&&_e(r.place,e)}function Xn(r){return r.afterLiteral&&(r.clauseEndsAfter||r.nextIsMarker)}function Am(r,e){let t=r.patternToken.role;return t!=="quantity"&&!(t==="event"&&e==="repeat")?false:Zr(r.token)&&!Xn(r)&&!r.nextIsMarker}function xm(r){let e=r.patternToken;return !e.optional||e.role==="event"||e.role==="action"||e.valueShape==="keyword"||!Zr(r.token)?false:(r.lastSlot||r.tokenIsMarker)&&!Xn(r)}function Dm(r,e,t,i){let n=r.type==="group"&&r.optional?r.tokens.every(o=>o.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 Zr(e)?!a:a}function Sm(r){return kt.has((r.normalized??r.value).toLowerCase())}function Bm(r,e){return r?.kind==="particle"&&!!e&&["selector","literal","identifier"].includes(e.kind)&&!Yn(e)}function Tm(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 Fm(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=Zn(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 Pm(r){let e=(r.normalized||r.value).toLowerCase();if(e==="empty")return zn("null");if(e==="a"||e==="an")return {type:"expression",raw:r.value}}function Rm(r,e,t){return r.kind==="particle"&&(e||Yn(t))}function Jn(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 Bi=new Set(["is","am","are","be","was","were","not","no"]),Om=new Set(["\u0647\u0648","\u0E40\u0E1B\u0E47\u0E19","\u0939\u0948","\u0928\u0939\u0940\u0902","mana"]),Qn=new Set(["empty","null","undefined"]);function Lm(r,e,t,i){let n=(r.normalized??r.value).toLowerCase(),a=r.value.toLowerCase(),o=(e.normalized??e.value).toLowerCase();return (Bi.has(n)||Bi.has(Qe(i,a))||Om.has(a)&&Qn.has(o))&&!t}var Nm=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"]),Mm=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"]),Ti=/\s+as\s+([A-Za-z]\w*)!?\s*$/;function ea(r){let e=r;for(let n=Ti.exec(e);n;n=Ti.exec(e)){if(!Pt(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=zd(e);return !i.success||i.consumed===void 0||i.consumed!==Rn(e).length-1?false:_m(i.node).every(Pt)}function _m(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 St(r,e){return r?.position?.end!==void 0&&e?.position?.start!==void 0&&r.position.end===e.position.start}var Im=new Set(["is","not","really","am","or"]);function ta(r,e,t){let i=n=>{let a=r[n];return a?vt(t,a,r[n-1],r[n+1],void 0).toLowerCase():""};return i(e)==="to"&&i(e-1)==="equal"&&Im.has(i(e-2))}function $m(r){return r.value==="a"}var jm=new Set(["event","window","document"]);function Wm(r,e,t){let i=r[e],n=r[e-1];return !i||!n||!Ue(t,n)?false:jm.has((i.normalized??i.value).toLowerCase())}function qm(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"||ar(r.value,e.profile?.code??""))return true}return e.owes(r)}function Fi(r,e,t){let i=t.profile?.code??"en";if(Un(i,r,e)||Jn(r,e)||ta(r,e,i)||$m(r[e]))return false;let n=r[e];return qm(n,t)||t.commandMarkers.has(n.value.toLowerCase())}function Vm(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||St(n,i)||Ke.has(n.value)||/^[([,]$/.test(n.value)||Ue(t.profile,n))return true;let u=vt(a,n,r[e-2],i,void 0).toLowerCase();return Mm.has(u)}if(Ke.has(i.value)||/^[()[\],.!<>=+\-*/%]+$/.test(i.value)||Ue(t.profile,i)||Kn(a,i,n,r[e+1])||Un(a,r,e)||Jn(r,e)||Wm(r,e,t.profile)||ta(r,e,a))return true;let o=vt(a,i,n,r[e+1],void 0).toLowerCase();return o==="as"&&t.hasResponseType?false:Nm.has(o)?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 Km(r,e,t){if(!r[e]||Fi(r,e,t))return [];let i=e;for(;i<r.length&&!Fi(r,i,t)&&Vm(r,i,t);)i++;let n=[];for(let a=i;a>e;a--)n.push(a);return n}function Hm(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(Ue(t,a)&&r[n+1])n+=2;else break;i.push(n);}return i.reverse()}function Um(r,e,t,i){for(let n of t){let a=Oe(r.slice(e,n),i);if(ea(a))return {end:n,raw:a}}}var ra=96,Gm=/^[A-Za-z_][\w-]*$/,Zm=/^[A-Za-z_][\w-]*:[^\s'"`/:][^\s]*$/;function ia(r,e){let t=r.peek(e);return !!t&&t.kind==="identifier"&&Zm.test(t.value)}function na(r,e){let t=r.peek(e);if(!t||t.kind!=="identifier"&&t.kind!=="keyword"||!Gm.test(t.value))return false;let i=r.peek(e+1),n=r.peek(e+2);return !!i&&i.value===":"&&!!n}function Pi(r,e=0){return ia(r,e)||na(r,e)}function Ym(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++<ra;){let o=r.advance();if(!o)break;if(i>=0&&o.position.start>i&&(t+=" ".repeat(o.position.start-i)),t+=o.value,i=o.position.end,o.value==="{"||o.value==="(")n++;else if((o.value==="}"||o.value===")")&&(n--,n===0))return t}return null}function Ri(r){let e=r.peek();return e?e.value==="{"||e.value==="("?Ym(r):e.value===","||e.value===":"?null:(r.advance(),e.value):null}function Bt(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 o=Ri(r);if(o===null)return r.reset(t),null;i.push(`${e}:${o}`);}else if(!Pi(r))return null;let n=0;for(;n++<ra;){let a=r.peek();if(!a)break;if(a.value===","){if(i.length===0||!Pi(r,1))break;r.advance();continue}if(ia(r,0)){i.push(r.advance().value);continue}if(!na(r,0))break;let o=r.advance().value;r.advance();let u=Ri(r);if(u===null)return r.reset(t),null;i.push(`${o}:${u}`);}return i.length===0?(r.reset(t),null):`{${i.join(", ")}}`}function Yt(r){switch(r.kind){case "selector":return Ne(r.value);case "literal":return Xm(r.value);case "keyword":{let t=Pm(r);if(t)return t;let i=(r.normalized||r.value).toLowerCase();return Le(i)?Be(i):zn(i)??Y(r.normalized||r.value)}case "identifier":if(r.value.startsWith("@"))return Ne(r.value);if(r.value.startsWith(":")||r.value.startsWith("$"))return Be(r.value);let e=r.value.toLowerCase();return Le(e)?Be(e):{type:"expression",raw:r.value};case "url":{let t=Y(r.value,"string");return r.value.includes("${")?{...t,interpolates:true}:t}default:return null}}function Xm(r){if(r.startsWith('"')||r.startsWith("'")||r.startsWith("`")||r.startsWith("\u300C")){let i=r.slice(1,-1);return Y(i,"string")}if(r==="true")return Y(true,"boolean");if(r==="false")return Y(false,"boolean");let e=r.match(/^(\d+(?:\.\d+)?)(ms|s|m|h)?$/);if(e){let i=parseFloat(e[1]);return e[2]?Y(r,"duration"):Y(i,"number")}let t=parseFloat(r);return isNaN(t)?Y(r,"string"):Y(t,"number")}var Ht=.8,Jm=.6,Qm=.15,ef=.5,Oi=.15,Li=.1,Ni=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"]),tf={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"]},rf=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(ef,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,o=e.command==="on"?e.extraction?.action?.value:void 0,u=le[o??e.command]?.roles,s=l=>u?.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+=Ht,i+=Ht):s(c.role)||(n+=Ht,a(c.role)&&(i+=Ht*Jm)));return n>0?i/n:1}scoreStemPenalty(r){let{stemMatchCount:e,totalKeywordMatches:t}=r;return e<=0||t<=0?0:-(e/t)*Qm}scoreLanguageBoost(r){let{pattern:e}=r;if(e.language!=="ar")return 0;let t=e.template.tokens[0];return !t||t.type!=="literal"?0:Ni.has(t.value)||t.alternatives?.some(i=>Ni.has(i))?Oi: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 o=tf[n];if(!o||o.length===0)continue;let u="metadata"in a?a.metadata:void 0;u&&typeof u.prepositionValue=="string"&&(o.includes(u.prepositionValue)?i+=.1:i-=.1);}return Math.max(-Li,Math.min(Li,i))}},nf=new rf,af=new Set(Object.values(le).filter(r=>r.bareKeyword===true).map(r=>r.action));function of(r){return r.startsWith("*")||r.startsWith("@")}var ie=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??nf;}matchPattern(e,t){let i=e.mark(),n=new Map;if(this.currentProfile=T(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 o=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:o,roleStarts:this.roleStarts,...this.eventSource?{eventSource:this.eventSource}:{}}}matchBest(e,t){this.matchCache.clear();let i=[],n=e.position();for(let o of t){let u=e.mark(),s=`${n}:${o.id}`,l;this.matchCache.has(s)?l=this.matchCache.get(s):(l=this.matchPattern(e,o),this.matchCache.set(s,l)),l&&i.push(l),e.reset(u);}if(i.length===0)return null;i.sort((o,u)=>{let s=u.pattern.priority-o.pattern.priority;return s!==0?s:u.confidence-o.confidence});let a=i[0];return this.matchPattern(e,a.pattern),a}matchTokenSequence(e,t,i,n){let a=t[0],o=a?.type==="literal"&&(a.value==="and"||a.value==="then"||a.alternatives?.includes("and")||a.alternatives?.includes("then"));if(this.currentProfile?.code==="ar"&&!o)for(;e.peek()?.kind==="conjunction";)e.advance();let u=0;for(let s=0;s<t.length;s++){let l=t[s];if(u>0&&l.type==="literal"&&this.tryConsumeEventSourceClause(e,i,l),Dm(l,e.peek(),t[s+1]??n,this.wouldMatch)){let d=e.mark(),m=new Map(i);if(this.matchTokenSequence(e,t.slice(s+1),m,n)&&this.atClauseEnd(e)){i.clear();for(let[f,y]of m)i.set(f,y);return true}e.reset(d);}let c=this.patternRest;this.patternRest=[...t.slice(s+1),...c],this.slotAfterLiteral=l.type==="role"&&t[s-1]?.type==="literal";let p=this.matchPatternToken(e,l,i,t[s+1]??n);if(this.patternRest=c,u=l.type==="role"&&l.role==="event"?2:Math.max(0,u-1),!p){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 o=this.currentProfile?.roleMarkers?.source,u=l=>{if(l.kind!=="particle"&&l.kind!=="keyword")return false;if((l.normalized??"").toLowerCase()==="source")return true;if(!o)return false;let c=l.value.toLowerCase();return o.primary?.toLowerCase()===c?true:!!o.alternatives?.some(p=>p.toLowerCase()===c)},s=o?.position;if(s!=="after"&&u(n)){let l=this.sourceNounValue(a);if(!l)return;e.advance(),e.advance(),this.eventSource=l;return}if(s==="after"&&u(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(Le(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(),o=this.matchRoleToken(e,t,i,n);return o&&i.has(t.role)&&this.roleStarts.set(t.role,a),o}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 o=this.getMatchType(i,a);if(o!=="none")return this.totalKeywordMatches++,o==="stem"&&this.stemMatchCount++,e.advance(),true}for(let a of [t.value,...t.alternatives??[]])for(let o of ["-","_"])if(a.includes(o)&&this.tryMatchShatteredCompound(e,a,o))return this.totalKeywordMatches++,true;return false}tryFoldHyphenActionKeyword(e){let t=this.currentProfile;if(!t)return null;let i=e.mark(),n=[];for(;;){let o=e.peek();if(!o||o.kind!=="identifier"&&o.kind!=="keyword")break;n.push(o.value),e.advance();let u=e.peek();if(!u||u.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[o,u]of Object.entries(t.keywords))if(u.primary.toLowerCase()===a||u.alternatives?.some(s=>s.toLowerCase()===a))return Y(o);return e.reset(i),null}tryMatchShatteredCompound(e,t,i){let n=t.split(i);if(n.length<2||n.some(o=>o.length===0))return false;let a=e.mark();for(let o=0;o<n.length;o++){if(o>0){let s=e.peek();if(!s||s.value!==i)return e.reset(a),false;e.advance();}let u=e.peek();if(!u||u.kind!=="identifier"&&u.kind!=="keyword"&&u.kind!=="particle"||u.value.toLowerCase()!==n[o].toLowerCase())return e.reset(a),false;e.advance();}return true}matchRoleToken(e,t,i,n){let a=e.position(),o=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,o),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 o=t.expectedTypes;if(o&&o.length>0&&!o.includes("expression"))return;let u=$.boundedByMarker(n)?Km(e.tokens,e.position(),this.extentContext()):Hm(e.tokens,e.position(),this.currentProfile),s=Um(e.tokens,a,u,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 o=t.roleMarkers[n.role];if(o){i.add(o.primary.toLowerCase());for(let u of o.alternatives??[])i.add(u.toLowerCase());}}return i.delete(""),i}stampCaptureSpan(e,t,i,n,a){let o=i.get(t);if(!o||o===a||o.position||e.position()<=n)return;let u=e.tokens[n],s=e.tokens[e.position()-1];!u||!s||i.set(t,wn(o,{start:u.position.start,end:s.position.end}));}absorbTrailingConditionOperand(e,t,i,n,a){if(t.role!=="condition"||!i.has("condition")||e.position()<=a)return;let o=this.currentPatternCommand==="repeat";if(!o&&(n!==void 0||this.currentPatternCommand!=="on"))return;let u=$.CONDITION_OPERATOR_WORDS,s=d=>{let m=(d.normalized??"").toLowerCase(),f=d.value.toLowerCase();if(u.has(m)||u.has(f))return true;let y=$.LOOP_CONDITION_OPERATORS;return o&&(y.has(f)||y.has(m))},l=d=>!!d&&(d.kind==="selector"||d.kind==="identifier"||d.kind==="literal")&&!s(d)&&!kt.has((d.normalized??d.value).toLowerCase())&&!this.patternTokenWouldMatch(n,d),c=false;for(;;){let d=e.peek();if(!d||!s(d)||this.patternTokenWouldMatch(n,d))break;e.advance(),c=true;let m=e.peek();if(l(m)){e.advance();for(let f=e.peek();!(!f||!/^\.[a-zA-Z_]\w*$/.test(f.value)||f.position.start!==m.position.end);f=e.peek())e.advance(),m=f;}if(!o)break}if(!c)return;let p=Oe(e.tokens.slice(a,e.position()),this.currentProfile);i.set("condition",{type:"expression",raw:p,value:p});}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 o=e.peek(n+1),u=e.peek(n+2);return o?.value===":"&&u&&St(a,o)&&St(o,u)&&Pt(`${a.value}:${u.value}`)?n-t+3:Pt(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 o=this.conversionRunLength(e);if(o===0||this.patternTokenWouldMatch(n,e.peek()))return;for(let s=0;s<o;s++)e.advance();let u=Oe(e.tokens.slice(a,e.position()),this.currentProfile);i.set(t.role,{type:"expression",raw:u,value:u});}matchRoleTokenCore(e,t,i,n){this.skipNoiseWords(e,t,n);let a=e.peek();if(!a)return t.optional||false;let o=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&&(Fe(this.currentProfile,a.value)??Fe(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(bm(o,this.currentProfile?.code??"")||Am(o,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(xm(o))return true;if(this.roleAcceptsPropertyPath(t)){let g=this.tryMatchPositionalPossessiveExpression(e,n);if(g)return i.set(t.role,g),true}let u=this.tryMatchPositionalExpression(e,n);if(u)return t.expectedTypes&&t.expectedTypes.length>0&&!Kt(u.type,t.expectedTypes)?t.optional||false:(i.set(t.role,u),true);let s=this.tryMatchCaretScopeExpression(e);if(s)return t.expectedTypes&&t.expectedTypes.length>0&&!Kt(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 b=this.isWrittenTarget(t)?null:this.tryMatchOperatorRunExpression(e);if(b)return i.set(t.role,b),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 p=this.tryMatchMethodCallExpression(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 m=t.role==="event"&&this.currentPatternCommand==="on"||$.DECLARATION_COMMANDS.has(this.currentPatternCommand??"")||this.isWrittenTarget(t)?null:this.tryMatchBareCallExpression(e);if(m)return t.expectedTypes&&t.expectedTypes.length>0&&!t.expectedTypes.includes(m.type)&&!t.expectedTypes.includes("expression")?t.optional||false:(i.set(t.role,m),true);let f=this.tryMatchPossessiveSelectorExpression(e);if(f)return t.expectedTypes&&t.expectedTypes.length>0&&!Kt(f.type,t.expectedTypes)?t.optional||false:(i.set(t.role,f),true);let y=t.role!=="condition",h=this.tryMatchPropertyAccessExpression(e,y);if(h)return t.expectedTypes&&t.expectedTypes.length>0&&!t.expectedTypes.includes(h.type)&&!t.expectedTypes.includes("expression")?t.optional||false:(i.set(t.role,h),true);let v=this.tryMatchSelectorPropertyExpression(e);if(v)return t.expectedTypes&&t.expectedTypes.length>0&&!Kt(v.type,t.expectedTypes)?t.optional||false:(i.set(t.role,v),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,b=g?.length===1&&g[0]==="expression"||this.isObjectValueSlot(t)?this.tryMatchBraceRunExpression(e):!g?.length||g.includes("literal")?this.tryMatchBraceRunLiteral(e):null;if(b)return i.set(t.role,b),true}if(t.role==="style"&&t.expectedTypes?.length===1&&t.expectedTypes[0]==="expression"){let g=Bt(e);if(g)return i.set(t.role,{type:"expression",raw:g}),true}if(Tm(o)||Fm(o,this.currentSchema())||Cm(o,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(b=>b==="expression"||b==="reference");if(!(g&&A))return t.optional||false}t.valueShape==="keyword"&&E.type==="expression"?i.set(t.role,Y(String(E.raw??""))):i.set(t.role,E),e.advance();let k=this.isClassNameSlot(t);if(E.type==="selector"&&(E.value.startsWith("<")||E.value.startsWith(".")&&!k)&&t.role!=="event"){let g=$n(e.tokens,e.position(),this.currentProfile,A=>A===void 0?false:this.patternTokenWouldMatch(n,A));if(g){let[A,b]=g.scope.parts,x=g.scope.kind==="reference"?Be(A.text):g.scope.kind==="closest"?{type:"expression",raw:`closest ${b.text}`}:this.tokenToSemanticValue(A.token);for(let S=0;S<1+g.scope.consumed;S++)e.advance();i.set(t.role,{...E,scope:x});}}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,Y(`${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 b=e.peek(1),x=b?this.sourceNounValue(b):void 0;x&&!this.eventSource&&(e.advance(),e.advance(),this.eventSource=x);}}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:ar(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=Ft(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(),o=!!i&&(i.value.toLowerCase()==="on"||a==="destination"||a==="on");return !i||!n||n.kind!=="selector"||!o?null:(e.advance(),e.advance(),e.advance(),{type:"expression",raw:`${t.value} on ${n.value}`})}isOfPossessiveMarker(e){return Ue(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 o=e.position(),u=lm(i,t,e.tokens[o-1],e.tokens[o+1]);return u&&n(u)?u:void 0}tryConsumeRunPhrase(e){let t=this.currentProfile?.code??"en",i=e.tokens,n=e.position(),a=[],o;for(let u=0;u<6&&n+u<i.length;u++){let s=i[n+u],l=vt(t,s,i[n+u-1],i[n+u+1],o).toLowerCase();a.push(l),o=l;}for(let[u,s]of $.RUN_PHRASES)if(u.every((l,c)=>a[c]===l)){for(let l=0;l<u.length;l++)e.advance();return s}}slotAt(e,t,i){return new zm(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(),o=e.position();if(e.advance(),e.advance(),!this.tryConsumeRunOperand(e))return e.reset(a),null;for(;;){let s=e.peek();if(!s||!Ke.has(s.value))break;let l=e.mark();if(e.advance(),!this.tryConsumeRunOperand(e,true)){e.reset(l);break}}let u=Oe(e.tokens.slice(o,e.position()),this.currentProfile);return {type:"expression",raw:u,value:u}}tryMatchHyphenatedWord(e){let t=e.peek();if(!$.isBareWordToken(t))return null;let i=1,n=[t.value];for(;;){let a=e.peek(i),o=e.peek(i+1);if(!a||a.value!=="-"||!$.isBareWordToken(o)||!St(e.peek(i-1),a)||!St(a,o))break;n.push(o.value),i+=2;}if(n.length<2)return null;for(let a=0;a<i;a++)e.advance();return Y(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 o=1;for(;;){let s=e.peek();if(!s)break;let l=this.logicalConnectiveOf(e),c=(l==="and"||l==="or")&&this.currentRoleCommand!=="wait",p=e.mark();if(c||Ke.has(s.value))e.advance();else {let d=this.tryConsumeRunPhrase(e);if(d===void 0)break;if(d==="none"){o++;continue}}if(!this.tryConsumeRunOperand(e,true,c)){e.reset(p);break}o++;}if(o<2&&!a)return e.reset(t),null;let u=Oe(e.tokens.slice(i,e.position()),this.currentProfile);return {type:"expression",raw:u,value:u}}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 o=e.tokens.slice(i,e.position()),[u,,s,l]=o,c=d=>d.kind==="keyword"?d.normalized??d.value:d.value,p=`${c(u)} to ${c(s)}`;return l&&(p+=` ${(l.normalized??l.value).toLowerCase()}`),{type:"expression",raw:p,value:p}}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 o=e.mark();return e.advance(),Bm(e.peek()??void 0,e.peek(1)??void 0)?(e.reset(o),false):this.tryConsumeRunOperand(e,true,i)?true:(e.reset(o),false)}if(n.value==="-"){let o=e.mark();return e.advance(),this.tryConsumeRunOperand(e,true,i)?true:(e.reset(o),false)}if(i&&Sm(n))return false;if(Rm(n,t,e.peek(1)??void 0))return e.advance(),true;if(n.value==="("){let o=e.mark(),u=0;for(;!e.isAtEnd();){let s=e.advance();if(s.value==="(")u++;else if(s.value===")"&&(u--,u===0))return true}return e.reset(o),false}if(this.tryMatchPossessiveExpression(e))return true;if(n.value.toLowerCase()==="the"){let o=e.mark();if(e.advance(),this.tryConsumeRunOperand(e,t,i))return true;e.reset(o);}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")&&!Ke.has(n.value)&&!["then","else"].includes(a)&&(a!=="end"||this.endWordIsValueAt(e))&&n.value!==")"?(e.advance(),true):false}endWordIsValueAt(e){return _e(ze(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(Fe(this.currentProfile,t)??Fe(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?ke(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(),o=e.mark();e.advance();let u=e.peek();if(!u||!this.isOfPossessiveMarker(u))return e.reset(o),null;e.advance(),e.peek()?.value.toLowerCase()==="the"&&e.advance();let s=Ft(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 Me({type:"expression",raw:s.parts.map(c=>c.text).join(" ")},this.toEnglishProperty(i.value),"possessive")}let l=e.peek();if(!l||l.kind!=="selector"||of(l.value)){if(e.reset(o),this.patternTokenWouldMatch(t,u))return null;let c=this.currentProfile?.code??"en",p=Gn(e.tokens,a,this.currentProfile,c);if(p===void 0)return null;for(;e.position()<=p;)e.advance();let d=Oe(e.tokens.slice(a,p+1),this.currentProfile);return {type:"expression",raw:d,value:d}}return e.advance(),Me(Ne(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=Ft(e.tokens,e.position(),i,l=>l===void 0?false:this.patternTokenWouldMatch(t,l));if(!a)return null;let o=e.peek(a.consumed),u=e.peek(a.consumed+1);if(!o||o.value!==n)return null;let s=!!u&&(this.isBareWordPropertyHead(u)||u.kind==="selector"&&u.value.startsWith("*")||u.kind==="keyword"&&wi(i.code,u.value));if(!u||!s)return null;for(let l=0;l<a.consumed+2;l++)e.advance();return Me({type:"expression",raw:a.parts.map(l=>l.text).join(" ")},this.toEnglishProperty(u.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=Fe(this.currentProfile,s)??Fe(this.currentProfile,s.toLowerCase()),n)break;if(!n)return null;let a=e.mark();e.advance();let o=this.currentProfile.possessive?.connectors;if(o&&o.length>0){let s=e.peek();if(s){let l=s.value.toLowerCase(),c=(s.normalized??"").toLowerCase();o.some(p=>p.toLowerCase()===l||p.toLowerCase()===c)&&e.advance();}}let u=e.peek();if(!u||Es(this.currentProfile.code,u.value))return e.reset(a),null;if(u.kind==="identifier"||u.kind==="keyword"&&!this.isStructuralKeyword(u.value)&&!(u.normalized&&this.isStructuralKeyword(u.normalized))&&!(u.normalized&&this.isRoleMarkerConcept(u.normalized))&&!(u.normalized&&$.COMMAND_ACTION_KEYWORDS.has(u.normalized.toLowerCase()))||u.kind==="selector"&&u.value.startsWith("*")||u.kind==="selector"&&u.value.startsWith("@")||u.kind==="selector"&&u.value.startsWith(".")&&/^\.[a-zA-Z_]\w*/.test(u.value)){e.advance();let s=u.value;u.kind==="selector"&&s.startsWith(".")&&/^\.[a-zA-Z_]\w*/.test(s)&&(s=s.substring(1)),s=this.toEnglishProperty(s);let l=s;for(;;){let p=e.peek();if(p?.kind==="selector"&&p.value.startsWith(".")&&/^\.[a-zA-Z_]\w*/.test(p.value)){l+=p.value,e.advance();continue}if(p?.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 p="",d=0,m=0;for(;!e.isAtEnd()&&m++<$.MAX_METHOD_ARGS+2;){let f=e.peek();if(!f)break;p+=f.value,e.advance();for(let y of f.value)y==="("?d++:y===")"&&d--;if(d<=0)break}l+=p;}return Me(Be(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(),o=t.value;i&&(o=o.substring(1)),e.advance(),o=this.toEnglishProperty(o);let u=o;for(;e.peek()?.kind==="selector"&&e.peek().value.startsWith(".")&&/^\.[a-zA-Z_]\w*/.test(e.peek().value);)u+=e.peek().value,e.advance();let s=e.peek();if(!s)return e.reset(a),null;let l;for(let p of [s.value,s.normalized].filter(Boolean))if(l=Fe(this.currentProfile,p)??Fe(this.currentProfile,p.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(),Me(Be(l),u,"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 Ot.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&&af.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,o=0;for(;!e.isAtEnd()&&o++<$.MAX_BRACE_RUN_TOKENS;){let u=e.advance();if(!u)break;if(u.value==="{")a++;else if(u.value==="}"&&(a--,a===0))return n.push("}"),Y(n.join(" "));n.push(u.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,o=0,u=0;for(;!e.isAtEnd()&&u++<$.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==="{")o++;else if(s.value==="}"&&(o--,o===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(),o="",u=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 p=u!==void 0&&c.position?.start===u;o+=(o===""||p?"":" ")+c.value,u=c.position?.end,e.advance();}return s?{type:"expression",raw:`${t.value}(${o})`}:(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 o=e.peek();if(!o||o.kind!=="punctuation"||o.value!=="(")return e.reset(i),null;e.advance();let u=[];for(;!e.isAtEnd()&&u.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}u.push(l.value),e.advance();}return {type:"expression",raw:`${t.value}.${a.value}(${u.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],o=e.peek();if(n!==0||i.length===0||!o||o.kind!=="selector"||!/^\.[A-Za-z_$][\w$]*$/.test(o.value)||!$.abuts(a,o))return e.reset(t),null;e.advance();let u=e.peek();if(u?.value!=="("||!$.abuts(o,u))return e.reset(t),null;let s=this.consumeCallParens(e);return s===null?(e.reset(t),null):{type:"expression",raw:`(${Oe(i,this.currentProfile)})${o.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],o=e.peek(),u=!!o&&(o.value==="'"||Ke.has(o.value)||$.abuts(a,o)&&(o.value.startsWith(".")||o.value==="("));if(n!==0||i.length===0||u)return e.reset(t),null;let s=`(${Oe(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(),o=e.peek();if((i.kind==="identifier"||$.PROPERTY_ACCESS_BASES.has(a))&&o&&o.kind==="selector"&&/^\.[a-zA-Z_]/.test(o.value)&&o.position.start===i.position.end){let m=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))m+=`.${E.value.slice(1)}`,f.push(E.value.slice(1)),e.advance(),y++;else break}let h=e.peek(),v=!!h&&h.value.startsWith("(");return t&&!v&&f.length>0&&Le(a)?Me(Be(a),f.join("."),"dot"):(v&&(m+=this.consumeCallParens(e)??""),{type:"expression",raw:m})}let u=e.peek();if(!u||u.kind!=="operator"||u.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 m=e.peek();if(!m||m.kind!=="operator"||m.value!==".")break;e.advance();let f=e.peek();if(!f||f.kind!=="identifier")break;e.advance(),l+=`.${f.value}`,c++;}let p=e.peek();if(p&&p.kind==="punctuation"&&p.value==="("){e.advance();let m=[],f=0;for(;!e.isAtEnd()&&m.length<$.MAX_METHOD_ARGS;){let h=e.peek();if(!h)break;if(h.kind==="punctuation"&&h.value===")"){if(f===0){e.advance();break}f--;}if(h.kind==="punctuation"&&h.value==="("&&f++,h.kind==="punctuation"&&h.value===","){e.advance();continue}m.push(h.value),e.advance();}return {type:"expression",raw:`${l}(${m.join(", ")})`}}let d=i.value.toLowerCase();if(t&&Le(d)){let m=l.split(".").slice(1).join(".");return Me(Be(d),m,"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(/^-/,""),o=!!n&&n.kind==="punctuation"&&n.value==="'s",u=!!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(!o&&!l&&!u)return e.reset(i),null;e.advance(),u&&e.advance();let c=e.peek();if(!c)return e.reset(i),null;let p=c.kind==="selector"&&c.value.startsWith("*"),d=c.kind==="keyword"&&!!this.currentProfile&&wi(this.currentProfile.code,c.value);return c.kind==="identifier"||p||d||(o||u)&&(c.kind==="selector"||c.kind==="keyword")?(e.advance(),Me(Ne(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)],o=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)),o=s,e.advance();let u=e.peek();if(u?.value==="("&&$.abuts(o,u)){let s=this.consumeCallParens(e);if(s!==null)return {type:"expression",raw:`${t.value}.${a.join(".")}${s}`}}return Me(Ne(t.value),a.join("."),"dot")}matchGroupToken(e,t,i,n){let a=e.mark(),o=new Map(i),u=this.matchTokenSequence(e,t.tokens,i,n);if(u){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=>!o.has(c))&&(e.tokens.slice(a.position,e.position()).some(d=>s.some(m=>this.getMatchType(d,m)!=="none"))||(u=false));}if(!u){e.reset(a);for(let s of i.keys())o.has(s)||i.delete(s);for(let[s,l]of o)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=qt(e.value).toLowerCase();if(i&&i===qt(t).toLowerCase())return "case-insensitive"}return "none"}isWrittenTarget(e){return $.WRITTEN_ROLE[this.currentRoleCommand??""]===e.role}tokenToSemanticValue(e){return Yt(e)}applyExtractionRules(e,t){for(let[i,n]of Object.entries(e.extraction)){let a=t.get(i);if(a){if(n.transform){let o=a.type==="literal"?String(a.value):String(a.raw??"");t.set(i,n.transform(o));}}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(wm(this.slotAt(e,t,i)))return;let o=e.mark();e.advance();let u=e.peek();if(u&&(u.kind==="selector"||u.kind==="identifier"))return;let s=e.peek(1);if(u&&u.kind==="keyword"&&s&&s.kind==="selector"&&/^\.[a-zA-Z_]/.test(s.value))return;let l=u?(u.normalized??u.value).toLowerCase():"";if(u&&$.POSITIONAL_OR_SCOPE_KEYWORDS.has(l))return;let c=e.peek(1),p=c?(c.normalized??c.value).toLowerCase():"",d=this.currentProfile?.wordOrder!=="SOV"&&$.COMMAND_ACTION_KEYWORDS.has(p),m=!c||c.kind==="particle"||$.CLAUSE_BOUNDARY_KEYWORDS.has(p)||d;if(u&&u.kind==="keyword"&&this.currentProfile?.code!=="en"&&Le(l)&&m||u&&u.kind==="keyword"&&this.currentProfile?.code==="en"&&Le(l))return;e.reset(o);}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}};ie.CONDITION_OPERATOR_WORDS=new Set(["matches","match","contains","exists","has","have","equals","includes"]);ie.LOOP_CONDITION_OPERATORS=new Set([...Ln,"and","or"]);ie.POSITIONAL_OR_SCOPE_KEYWORDS=new Set(["first","last","next","previous","random","closest","parent"]);ie.STRUCTURAL_NEVER_EVENT=new Set(["if","unless","else","end","then","while"]);ie.PROPERTY_ACCESS_BASES=new Set(["it","me","you","my","its","your","event","result","target","detail","body","window","document","self","this"]);ie.COMMAND_ACTION_KEYWORDS=kt;ie.CLAUSE_BOUNDARY_KEYWORDS=new Set(["then","and","or","end","else"]);ie.RUN_PHRASES=[...Hr.map(r=>[r.split(" "),"none"]),...Ur.map(r=>[r.split(" "),"type"]),...Kr.filter(r=>!/^(in|am|has|have)$|^am /.test(r)).map(r=>[r.split(" "),"operand"]),[["exists"],"none"]];ie.PICK_RANGE_SEPARATORS=new Set(["to"]);ie.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"])};ie.PICK_RANGE_MODES=new Set(["inclusive","exclusive"]);ie.VISIBILITY_STRATEGIES=new Set(["display","visibility","opacity","twdisplay","twvisibility","twopacity"]);ie.MAX_BRACE_RUN_TOKENS=64;ie.MAX_PROPERTY_DEPTH=10;ie.MAX_METHOD_ARGS=20;ie.DECLARATION_COMMANDS=new Set(["behavior","def","install"]);ie.WRITTEN_ROLE={increment:"patient",decrement:"patient",set:"destination"};ie.ENGLISH_NOISE_WORDS=new Set(["the","a","an"]);var aa=ie,Se=new aa;function Z(r,e){return op(r,e)}function oa(){return ap()}var Qt={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"])},uf=new Set(Object.values(Qt).flatMap(r=>[...r]));function Xt(r,e){let t=(r.normalized??r.value).toLowerCase();if(t==="or")return true;let i=e===void 0?uf:Qt[e];return i?i.has(r.value)||i.has(t):false}var ua=["if","unless","repeat","for","while"],or=/^[A-Z][A-Za-z0-9_]*$/;function Q(r,e){let t=new Set([e]),n=T(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 sf=new Set(ua);function Nt(r){return {byAction:ua.map(e=>[e,Q(r,e)]),elseForms:Q(r,"else"),inForms:Q(r,"in")}}function Mi(r,e){if(!r)return;let t=r.normalized?.toLowerCase();return t?sf.has(t)?t:void 0:e.byAction.find(([,i])=>W(r,i))?.[0]}function Mt(r,e,t){let i=r[e],n=Mi(i,t);if(!n||n==="while")return false;let a=r[e-1];if(n==="for"){if(Mi(a,t)==="repeat")return false;if(i.value.toLowerCase()==="for"){let o=r[e+2];return !!o&&(W(o,t.inForms)||o.normalized==="in")}}return !(n==="if"&&a&&W(a,t.elseForms))}var _i=new Set(["me","it","you","the","body","window","document","its","event","result","target","self","this","them","parent","next","previous","closest","first","last"]),lf=new Set(["destination","source","style","patient","on","from","to"]);function pt(r){if(!r||r.kind==="selector")return false;let e=(r.normalized??r.value).toLowerCase(),t=r.value.toLowerCase();return !(_i.has(e)||_i.has(t)||lf.has(e))}var cf=r=>Object.prototype.hasOwnProperty.call(le,r);function sa(r){return r.flatMap(e=>e.type==="literal"?[e.value,...e.alternatives??[]].map(t=>t.toLowerCase()):e.type==="group"?sa(e.tokens):[])}var pf=new Set(["toggle","trigger"]);function la(r){return r.flatMap((e,t)=>{if(e.type==="group")return la(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 df(r,e,t,i){return r.some((n,a)=>{if(!n.words.includes(e)||!n.role||!i.has(n.role))return false;let o=0;for(let u of t){let s=r.findIndex((l,c)=>c>=o&&c<a&&l.words.includes(u));if(s<0)return false;o=s+1;}return true})}function mf(r,e,t,i,n){let a=r[t].value.toLowerCase();for(let o=t-1;o>e;o--){let u=r[o];if(n(u)||u.value.toLowerCase()===a)return false;let s=(u.normalized??u.value).toLowerCase();if(!cf(s))continue;let l=ye(i).filter(p=>p.command===s);if(pf.has(s))return l.some(p=>sa(p.template.tokens).includes(a));let c=new Set((le[s]?.roles??[]).filter(p=>p.required).map(p=>p.role));return l.some(p=>{let d=la(p.template.tokens),m=new Set(d.flatMap(y=>y.words)),f=r.slice(o+1,t).map(y=>y.value.toLowerCase()).filter(y=>m.has(y));return df(d,a,f,c)})}return false}var Ii=new Set(["ja","ko"]);function He(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 ca(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 o=a.trim();o&&t.push(o);}}return {parameters:t,headerEnd:i}}function _t(r,e,t){let i=e+1;if(i>=r.length)return -1;let n=He(T(t)?.roleMarkers?.patient);return n.size>0&&W(r[i],n)&&i++,i<r.length?i:-1}var pa=/^[a-zA-Z_$][\w$]*(?:\.[a-zA-Z_$][\w$]*)*$/;function ff(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 yf(r,e,t){let i=T(t);if(i?.wordOrder!=="SOV"||!pa.test(r[0].value)||e!==ff(r))return false;let n=He(i.roleMarkers?.patient);return n.size===0?false:W(r[e-1],n)}function vf(r,e,t){if(!T(e))return null;let i=Q(e,"behavior"),n=Q(e,"def"),a=r.toLowerCase(),o=[...i].some(p=>a.includes(p)),u=/\bdef\b/.test(a)||[...n].some(p=>p!=="def"&&a.includes(p));if(!o&&!u)return null;let s=Z(r,e).tokens;if(s.length<2)return null;if(W(s[0],i))return $i(r,e,s,t,0);let l=s.findIndex((p,d)=>d>0&&W(p,i));if(l>0&&or.test(s[0].value))return $i(r,e,s,t,l);if(W(s[0],n))return ji(r,e,s,t,0);let c=s.findIndex((p,d)=>d>0&&W(p,n));return c>0&&yf(s,c,e)?ji(r,e,s,t,c):null}function hf(r,e,t){let i=T(e);if(!i)return null;let n=i.wordOrder!=="SOV",a=Ii.has(e)?He(i.roleMarkers?.event):new Set,o=Ii.has(e)?He(i.keywords?.on):new Set,u=a.size>0&&o.size>0,s=u?He(i.roleMarkers?.source):new Set,l=Q(e,"end"),c=Q(e,"on"),p=Q(e,"then"),d=r.toLowerCase(),m=[...l].some(x=>d.includes(x)),f=(n||u)&&(()=>{let x=0;for(let S of c)if(S){for(let z=d.indexOf(S);z>=0;z=d.indexOf(S,z+S.length))if(++x>=2)return true}return false})();if(!m&&!f)return null;let y=Z(r,e).tokens;if(y.length<2)return null;let h=Nt(e),v=x=>Mt(y,x,h),E=x=>W(x,l),k=[],w=0,g=0;for(let x=0;x<y.length;x++){let S=y[x];if(E(S)){if(w>0){w--;continue}if(y[x+1]&&W(y[x+1],p))continue;let z=r.slice(y[g].position.start,S.position.start).trim();z&&k.push(z),g=x+1;}else if(v(x))w++;else if(n&&w===0&&x>g&&W(S,c)&&pt(y[x+1])&&!(y[x+2]&&W(y[x+2],p))&&!mf(y,g,x,e,z=>E(z)||W(z,p))){let z=r.slice(y[g].position.start,S.position.start).trim();z&&k.push(z),g=x;}else if(u&&w===0&&x-1>g&&W(S,a)&&y[x+1]!==void 0&&W(y[x+1],o)){let z=y[x-1],C=y.slice(g,x-1);if(!(C.length===2&&W(C[1],s))){let R=r.slice(y[g].position.start,z.position.start).trim();R&&k.push(R),g=x-1;}}}if(g<y.length){let x=r.slice(y[g].position.start).trim();x&&k.push(x);}if(k.length<2)return null;let A=[],b=[];for(let x of k){let S;try{S=t.statement(x,e);}catch{return null}if(!S||S.kind!=="event-handler")return null;let z=S;if(A.push(z),!z.body||z.body.length===0)return null;b.push(z.metadata?.confidence??.75);}return st(A,"then",{sourceLanguage:e,confidence:ht(b),sourceText:r})}function ht(r){return r.length>0?r.reduce((e,t)=>e+t,0)/r.length:0}function ur(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 $i(r,e,t,i,n){let a=n>0,o=a?0:_t(t,n,e);if(o<0)return null;let u=t[o],s=u.value;if(!or.test(s))return null;let{parameters:l,headerEnd:c}=ca(r,u),p=a?n+1:t.findIndex(C=>C.position.start>=c);p<=o&&(p=o+1);let d=Q(e,"init"),m=Q(e,"end"),f=Nt(e),y=C=>Mt(t,C,f),h=C=>W(C,m),v=T(e)?.wordOrder!=="SOV",E=v?Ef(e):new Set,k=C=>{let D=r.slice(t[S].position.end,t[C].position.start).trim();if(D)try{let R=ur(i.body(D,e));g.push(...R),A.push(ht(R.map(_=>_.metadata?.confidence??.75)));}catch{A.push(0);}},w=[],g=[],A=[],b=false,x=0,S=p;for(let C=p;C<t.length;C++){let D=t[C];if(h(D)){if(x>0){x--;continue}if(C===S){b=true;break}if(W(t[S],d))k(C);else {let R=r.slice(t[S].position.start,D.position.start).trim();try{let _=i.statement(R,e);if(_&&_.kind==="event-handler"){let P=_;w.push(P);let F=!P.body||P.body.length===0;A.push(F?.2:P.metadata?.confidence??.75);}else A.push(0);}catch{A.push(0);}}S=C+1;}else y(C)?x++:v&&x===0&&C>S&&W(t[S],d)&&E.has(D.value.toLowerCase())&&(t[C+1]?.kind==="identifier"||t[C+1]?.kind==="keyword")&&pt(t[C+1])&&(k(C),S=C);}if(w.length===0&&g.length===0)return null;let z=(b?1:.8)*ht(A);return Xp(s,l,w,g.length>0?g:void 0,{sourceLanguage:e,confidence:z,sourceText:r})}function Ef(r){let e=new Set;for(let t of ye(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 ji(r,e,t,i,n){let a=n>0,o=a?0:_t(t,n,e);if(o<0)return null;let u=t[o],s=u.value;if(!pa.test(s))return null;let{parameters:l,headerEnd:c}=ca(r,u),p=a?n+1:t.findIndex(b=>b.position.start>=c);p<=o&&(p=o+1);let d=Q(e,"end"),m=Nt(e),f=b=>Mt(t,b,m),y=b=>W(b,d),h=0,v=-1;for(let b=p;b<t.length;b++)if(y(t[b])){if(h===0){v=b;break}h--;}else f(b)&&h++;let E=t[p]?.position.start??c,k=v>=0?t[v].position.start:r.length,w=r.slice(E,k).trim();if(!w)return null;let g;try{g=ur(i.body(w,e));}catch{return null}if(g.length===0)return null;let A=ht(g.map(b=>b.metadata?.confidence??.75));return v<0&&(A*=.8),Jp(s,l,g,{sourceLanguage:e,confidence:A,sourceText:r})}var Br=["live","eventsource","socket","worker","intercept"],gf=new Set(["intercept"]),Yr=new Set(["eventsource","socket","worker"]),kf=new Set(["eventsource","socket"]),zf=new Set(["worker"]),wf=6,bf=2;function Cf(r,e){for(let i of Br)if(W(r[0],Q(e,i)))return {action:i,keywordIdx:0};if(T(e)?.wordOrder!=="SOV")return null;let t=Math.min(r.length,wf);for(let i=1;i<t;i++)for(let n of Br)if(n!=="live"&&W(r[i],Q(e,n))&&!(Yr.has(n)&&!or.test(r[0].value))&&!(n==="intercept"&&i>bf))return {action:n,keywordIdx:i};return null}function Af(r,e,t){let i=He(T(t)?.roleMarkers?.source);return i.size===0||e+1>=r.length?0:W(r[e],i)||W(r[e+1],i)?2:0}function da(r){let e=Q(r,"on");e.add("when");let t=T(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 xf(r,e,t){let i=T(t)?.eventHandler,n=[i?.eventMarker?.primary,...i?.eventMarker?.alternatives??[],...i?.temporalMarkers??[]].filter(o=>!!o&&/\s/.test(o)),a=1;for(let o of n){let u=o.toLowerCase().split(/\s+/),s=e-u.length+1;s<0||u.every((l,c)=>r[s+c]?.value.toLowerCase()===l)&&(a=Math.max(a,u.length));}return a}function Df(r,e,t,i,n){if(r==="live")return t+1;if(t>0){let l=t+1;return r==="eventsource"&&(l+=Af(e,l,i)),l}let a=_t(e,t,i);if(a<0)return -1;if(r==="worker")return a+1;let o=da(i),u=He(T(i)?.roleMarkers?.event),s=n>=0?n:e.length;for(let l=a+1;l<s;l++){if(!W(e[l],o))continue;if(pt(e[l+1]))return l;if(l>a+2&&u.size>0&&W(e[l-1],u)&&pt(e[l-2]))return l-2;let c=xf(e,l,i);if(c>1&&l-c>a&&pt(e[l-c]))return l-c;if(l>a+1&&pt(e[l-1]))return l-1}return s}function Sf(r,e,t,i){if(!Yr.has(r))return;let n=t>0?0:_t(e,t,i);if(!(n<0))return e[n].value}function Bf(r,e,t){if(!T(e))return null;let i=r.toLowerCase(),n=false;for(let s of [...Br,"changes"]){for(let l of Q(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 o=Of(a,e);if(o>=0)return Nf(r,e,a,t,o);let u=Cf(a,e);return u?Tf(r,e,a,t,u.action,u.keywordIdx):null}function Tf(r,e,t,i,n,a){let o=Q(e,"end"),u=Nt(e),s=g=>Mt(t,g,u),l=g=>W(g,o),c=Sf(n,t,a,e);if(Yr.has(n)&&(!c||!or.test(c)))return null;let p=g=>({sourceLanguage:e,confidence:g,sourceText:r}),d=Tr(t,a+1,l,s);if(gf.has(n))return d>=0&&d!==t.length-1?null:xr(n,[],c,p(d>=0?1:.8));let m=Df(n,t,a,e,d);if(m<0||m>t.length)return null;let f=[],y=[],h=false,v=zf.has(n);if(v||kf.has(n)){let g=v?"def":"event-handler",A=0,b=m;for(let x=m;x<t.length;x++){let S=t[x];if(l(S)){if(A>0){A--;continue}if(h=true,x===b)break;let z=v?S.position.end:S.position.start,C=r.slice(t[b].position.start,z).trim();try{let D=i.statement(C,e);if(D&&D.kind===g){let R=D;f.push(R);let _=!R.body||R.body.length===0;y.push(_?.2:R.metadata?.confidence??.75);}else y.push(0);}catch{y.push(0);}b=x+1;}else s(x)&&A++;}}else {let g=Tr(t,m,l,s);h=g>=0;let A=g>=0?t[g].position.start:r.length,b=r.slice(t[m].position.start,A).trim();if(!b)return null;try{f.push(...ur(i.body(b,e)));}catch{return null}if(f.length===0)return null;y.push(...f.map(x=>x.metadata?.confidence??.75));}if(f.length===0&&!h)return null;let E=h?1:.8,k=y.length>0?E*ht(y):E,w=Ff(n,r,t,a,m,e);return xr(n,f,c,p(k),w?new Map([["source",w]]):void 0)}function Ff(r,e,t,i,n,a){if(r!=="eventsource"&&r!=="socket"||i!==0)return;let o=_t(t,i,a);if(o<0)return;let u=o+1,s=Math.min(n,t.length)-1;if(r==="eventsource"){let c=He(T(a)?.roleMarkers?.source),p=d=>!!d&&(W(d,c)||(d.normalized??"").toLowerCase()==="source");p(t[u])?u++:p(t[s])&&s--;}if(u>s)return;let l=e.slice(t[u].position.start,t[s].position.end).trim();return l?{type:"expression",raw:l}:void 0}var Pf=new Set([...Object.keys(le),"then","else"]);function Rf(r){let e=Q(r,"when");for(let t of da(r))e.add(t);return e}function Of(r,e){if(r.length<3||!W(r[0],Rf(e)))return -1;let t=Q(e,"changes"),i=Q(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 o=(a.normalized??a.value).toLowerCase();if(a.kind==="keyword"&&Pf.has(o))return -1}return -1}function Lf(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=>Xt(n,t)?{...n,kind:"keyword",normalized:"or"}:n);return {type:"expression",raw:Oe(i,T(t))}}function Nf(r,e,t,i,n){let a=Q(e,"end"),o=Nt(e),u=E=>Mt(t,E,o),s=E=>W(E,a),l=n+1;if(l>=t.length)return null;let c=Tr(t,l,s,u),p=c>=0;if(p&&c!==t.length-1)return null;let d=p?t[c].position.start:r.length,m=r.slice(t[l].position.start,d).trim();if(!m)return null;let f;try{f=ur(i.body(m,e));}catch{return null}if(f.length===0)return null;let y=Lf(r,t.slice(1,n),e),v=(p?1:.8)*ht(f.map(E=>E.metadata?.confidence??.75));return xr("when",f,void 0,{sourceLanguage:e,confidence:v,sourceText:r},new Map([["condition",y]]))}function Tr(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 Mf=new Set(["the","to","on","with","into","from","at"]),Wi=/^[A-Za-z_$][\w$]*$/,_f=64;function qi(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 If(r,e){let t=0;for(let i=e;i<r.length&&i-e<=_f;i++){let n=r[i].value;if(n==="(")t++;else if(n===")"&&(t--,t===0))return i+1}return -1}function Vi(r,e){return e.position.start===r.position.end}function $f(r,e,t,i){let n=r[e];if(!n||n.kind!=="identifier"&&n.kind!=="keyword"||!Wi.test(n.value)||i(n))return null;let a=e+1,o=n.value;for(;r[a]?.kind==="selector"&&/^\.[A-Za-z_$][\w$]*$/.test(r[a].value)&&Vi(r[a-1],r[a]);)o+=r[a].value,a++;let u=a>e+1,s=r[a];if(!s||s.value!=="("||!Vi(r[a-1],s))return null;let l=If(r,a);if(l<0)return null;let c=o+qi(r.slice(a,l));if(u)return {text:`call ${c}`,consumed:l-e};let p=l,m=r[p]?.value.toLowerCase(),f=null;if(m==="me")f="me",p++;else if(m!==void 0&&Mf.has(m)){p++,r[p]?.value.toLowerCase()==="the"&&p++;let y=r[p];if(!y)return null;let h=Ft(r,p,t);if(h)f=`(${qi(r.slice(p,p+h.consumed))})`,p+=h.consumed;else if(y.kind==="selector"&&y.value.startsWith("#")&&!/[.[:\s]/.test(y.value.slice(1)))f=y.value,p++;else if(y.kind==="selector"&&/^[.<]/.test(y.value))f=`(${y.value})`,p++;else if((y.kind==="keyword"||y.kind==="identifier")&&Wi.test(y.value)&&(Le(y.value.toLowerCase())||y.kind==="identifier"))f=y.value,p++;else return null}return {text:f?`call ${f}.${c}`:`call ${c}`,consumed:p-e}}var jf={debounced:"debounce",debounce:"debounce",throttled:"throttle",throttle:"throttle"},Wf=[["\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"]],qf=/^(\d+)(ms|s|m)?$/,Vf=new Set(["selector","literal","url","event-modifier"]);function Kf(r){let e=r.match(qf);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 Hf(r){for(let e=1;e<r.length;e++){let t=r[e];if(Vf.has(t.kind))continue;let i=t.value.toLowerCase(),n=jf[i];if(n){let a=0;for(let o=e+1;o<r.length;o++){let u=r[o],s=Kf(u.value);if(s!==null)return {modifiers:{[n]:s},start:t.position.start,end:u.position.end};if(u.kind==="selector"||u.kind==="literal"||u.kind==="url"||++a>2)break}continue}for(let a of Wf){if(a[0]!==i||e+a.length>r.length)continue;let o=true;for(let u=1;u<a.length;u++)if(r[e+u].value.toLowerCase()!==a[u]){o=false;break}if(o)return {modifiers:{once:true},start:t.position.start,end:r[e+a.length-1].position.end}}}return null}function Uf(r,e){try{let t=Z(r,e),i=ye(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"),o=Se.matchBest(t,a);if(o)return {confidence:o.confidence,parseSuccess:!0,patternId:o.pattern.id,action:o.pattern.command,tokensConsumed:o.consumedTokens};t.reset(t.mark());let u=n.filter(l=>l.command!=="on"),s=Se.matchBest(t,u);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 ma(r,e){try{let i=Dy(r,e);if(i)return {node:i,confidence:i.metadata?.confidence??.8,error:void 0,tokensConsumed:Z(r,e).tokens.length}}catch{}let t=Uf(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(Gr).flatMap(r=>Object.values(r)));var cy=new Set(["a","an","the"]),Ui=new Map;function py(r){let e=Ui.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)))),Ui.set(r,e)),e}function dy(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"&&yn.has(n??""))return {collision:"pronoun",word:"pronoun",sense:n};if(i.kind==="identifier"&&!n){if(py(e).has(r))return {collision:"structure",word:"marker"};let a=Qe(e,r);return a!==r?{collision:"structure",word:"connective",sense:a}:cy.has(r.toLowerCase())?{collision:"structure",word:"article"}:null}return i.kind==="particle"?{collision:"structure",word:"marker"}:{collision:"structure",word:"keyword",sense:n}}function my(r,e){let t=`${e}\0${r}`,i=Gi.get(t);return i===void 0&&(i=dy(r,e)?.collision??null,Gi.set(t,i)),i}var Gi=new Map;up((r,e)=>my(r,e)==="structure");var Xe=new Set(["if","unless","while","repeat","for"]),fa=new Set(["repeat","for"]),lt={kind:"loop-close"};function Xr(r){return r===lt}function Pr(r){if(Xr(r)||r.kind!=="command"||!fa.has(r.action))return false;let e=r.body;return !(Array.isArray(e)&&e.length>0)}function fy(r){switch(r.type){case "expression":return r.raw;case "literal":return String(r.value);case "reference":return r.value;default:return}}function Ut(r,e){for(let t=e-1;t>=0;t--)if(r[t].kind!=="particle")return r[t]}function zr(r){return r.kind!=="keyword"&&r.kind!=="identifier"?false:(r.normalized??r.value).toLowerCase()==="repeat"}function Gt(r){let e=0;for(let t of r)Pr(t)?e++:Xr(t)&&e>0&&e--;return e}var wr=new Set(["then","end","else","if","unless","while","for","repeat","and"]),yy=new Set(["first","last","next","previous","random","closest"]),vy=new Set(["me","my","i","it","its","you","your","result"]),Zi=new Set(["top","middle","bottom","left","center","right","nearest"]),hy=new Set(["smoothly","instantly"]);function Ey(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 At=["body","statements","thenBranch","elseBranch","eventHandlers","initBlock"];function gy(r){let e=(r.normalized??r.value).toLowerCase();return e==="document"||e==="window"||e==="me"||e==="body"?Be(e):r.kind==="selector"?Ne(r.value):{type:"expression",raw:r.value}}var Yi=new Map;function Xi(r){let e=Yi.get(r);return e||(e=new Set(ye(r).map(t=>t.command).filter(t=>t!=="on")),Yi.set(r,e)),e}var Pe=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"]),Ji=class extends Error{constructor(r,e,t,i){super(r),this.name="SemanticParseError",this.language=e,this.input=t,this.diagnostics=i;}};function G(r,e,t){return {message:r,severity:e,source:"semantic-parser",...t&&{code:t}}}function V(r,e){return e.length===0?r:{...r,diagnostics:e}}var tr=120;function ky(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 o=t.slice(n.position.start,a.position.end);if(!o.trim())return null;let u=o.length>tr?`${o.slice(0,tr)}\u2026`:o,s=i-r.consumedTokens;return `pattern ${r.pattern.id} left ${s} token(s) unconsumed: "${u}"`}var Qi=/^repeat-.*-(times|for-in|while-head|until-head|until-condition-head)$/,zy=new Set(["forever","times","for","while","until","until-event"]),wy=new Set(["to","from","into","onto","with","as","at","of","in","on","by","and","or","then","end","else","the","a","an","async"]);function Zt(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 o of n.diagnostics??[]){if(o.code!=="unconsumed-input")continue;let u=`${o.code}|${o.message}`;t.has(u)||(t.add(u),e.push(o));}let a=n;for(let o of ya){let u=a[o];if(Array.isArray(u))for(let s of u)i(s);}};return i(r),e.length===0?r:V(r,[...r.diagnostics??[],...e])}function by(r){if(r.length>=2){let e=r[0];if((e==='"'||e==="'")&&r.endsWith(e))return r.slice(1,-1)}return r}var ya=["body","statements","thenBranch","elseBranch","eventHandlers","initBlock"];function va(r,e,t){if(!r||typeof r!="object")return r;if(r.action&&r.roles instanceof Map){let n=ue(r.action),a=n?.primaryRole;if(n&&a&&a!=="patient"&&!n.roles.some(o=>o.role==="patient")&&r.roles.has("patient")&&!r.roles.has(a)){let o=r.roles,u=o.get("patient");u!==void 0&&(o.delete("patient"),o.set(a,u));}if(r.action==="tell"){let o=r.roles,u=o.get("patient"),s=o.get("destination");u&&(u.type==="selector"||u.type==="reference")&&(!s||s.type==="literal")&&(o.delete("patient"),o.set("destination",u));}if(r.action==="transition"){let o=r.roles,u=o.get("goal");u&&u.type==="literal"&&u.dataType==="duration"&&!o.has("duration")&&(o.delete("goal"),o.set("duration",u));}if(r.action==="fetch"){let o=r.roles,u=o.get("patient"),s=o.get("source");u&&s&&(u.type==="literal"||u.type==="expression")&&s.type==="expression"&&!o.has("style")&&(o.delete("patient"),o.set("style",s),o.set("source",u));}if(r.action==="transition"){let o=r.roles,u=o.get("destination");u&&u.type==="literal"&&!o.has("goal")&&(o.delete("destination"),o.set("goal",u));let s=o.get("patient");s&&s.type==="literal"&&typeof s.value=="string"&&/^[A-Za-z_][A-Za-z0-9_-]*$/.test(s.value)&&o.set("patient",{type:"expression",raw:s.value});}if(r.action==="morph"){let o=r.roles,u=o.get("patient");u&&u.type==="literal"&&typeof u.value=="string"&&/<[a-zA-Z][^>]*\/?>/.test(u.value)&&o.set("patient",{type:"expression",raw:u.value});}if(r.action==="wait"){let o=r.roles;if(!o.has("event")){let u=o.get("duration"),s=u?.type==="expression"?u.raw:u?.type==="literal"?u.value:void 0,l=typeof s=="string"&&t?dn(s,t):"";typeof s=="string"&&Pe.has(s.toLowerCase())?(o.delete("duration"),o.set("event",{type:"literal",value:s,dataType:"string"})):Pe.has(l)&&(o.delete("duration"),o.set("event",{type:"literal",value:l,dataType:"string"}));}}if(r.kind==="command"&&r.action!=="on"){let o=r.roles,u=o.get("event");if(u&&u.type==="expression"){let s=u.raw;typeof s=="string"&&/^[A-Za-z_][A-Za-z0-9_-]*(:[A-Za-z0-9_-]+)?$/.test(s)&&o.set("event",{type:"literal",value:s,dataType:"string"});}}if(e?.size){let o=r.roles;for(let u of ["destination","source"]){let s=o.get(u);s&&s.type==="literal"&&typeof s.value=="string"&&e.has(s.value)&&o.set(u,{type:"expression",raw:s.value});}}}let i=r;for(let n of ya){let a=i[n];if(Array.isArray(a))for(let o of a)va(o,e,t);}return r}var Cy=/^[\p{L}_$][\p{L}\p{N}_$:.\-]*$/u,be=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=va(this.parseInternal(e,t),this.boundIdentifiers,t),n=this.coverageFrames[this.coverageFrames.length-1];if(n.length>0&&(i=V(i,[...i.diagnostics??[],...n])),this.parseDepth===1&&(i=Zt(i),i.kind==="event-handler")){let a={node:i,input:e},o=a.node.eventModifiers;if(o&&(o.once||o.debounce!==void 0||o.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 u=this.reclaimEventCompoundTail(a.node,a.input,t);u&&(a=u),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=T(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 o of a.toLowerCase().split(/\s+/))t.add(o);}}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 wy.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(u=>!this.isCoverageResidueToken(u,t)))return;let a=e.map(u=>u.value).join(" ").trim();if(!a)return;let o=a.length>tr?`${a.slice(0,tr)}\u2026`:a;n.push(G(`${i} left ${e.length} token(s) unconsumed: "${o}"`,"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=vf(e,t,{statement:(z,C)=>this.parse(z,C),body:(z,C)=>this.parseStatements(z,C)});if(i)return i;let n=Bf(e,t,{statement:(z,C)=>this.parse(z,C),body:(z,C)=>this.parseStatements(z,C)});if(n)return n;let a=hf(e,t,{statement:(z,C)=>this.parse(z,C),body:(z,C)=>this.parseStatements(z,C)});if(a)return a;let{modifiers:o,remainingInput:u}=this.extractStandaloneModifiers(e,t),s=u||e,c=this.stripAsyncModifier(s,t).remainingInput??s,d=this.stripDoNotThrowModifier(c,t).remainingInput??c,m=[],f=Z(d,t);this.positionSource=d;{let z=f.mark(),C=this.consumeJsBlock(f,t);if(C&&f.isAtEnd())return V(C,m);f.reset(z);}let y=ye(t);if(y.length===0)throw new Ji(`No patterns available for language: ${t}`,t,d,[G(`No patterns registered for language '${t}'`,"error","no-patterns")]);let h=[...y].sort((z,C)=>C.priority-z.priority);{let z=f.tokens;if(T(t)?.wordOrder==="VSO"&&z.length>=4&&z[0]?.normalized==="source"){let C=z.findIndex(D=>D.normalized==="on");if(C>=2&&C+1<z.length){let D=d.slice(z[0].position.start,z[C].position.start).trim(),R=z[C+1].position.end,_=d.slice(z[C].position.start,R)+" "+D+d.slice(R);if(_!==d)try{let P=this.parse(_,t);if(P&&P.kind==="event-handler"){let F=o?this.applyModifiers(P,o):P;return V(F,m)}}catch{}}}}{let z=f.tokens,C=z[0]?.normalized==="if";for(let D=0;C&&D+3<z.length;D++){let R=(z[D+3]?.normalized??z[D+3]?.value??"").toLowerCase();if(z[D]?.normalized==="source"&&z[D+2]?.normalized==="on"&&B.KNOWN_EVENTS.has(R)){let _=(d.slice(0,z[D].position.start).trimEnd()+" "+d.slice(z[D+1].position.end).trimStart()).trim();if(_&&_!==d)try{let P=this.parse(_,t);if(P&&P.kind==="event-handler"){let F=o?this.applyModifiers(P,o):P;return V(F,m)}}catch{}break}}}{let z=this.tryDoNotThrow(f.tokens,d,t);if(z){let C=o&&z.kind==="event-handler"?this.applyModifiers(z,o):z;return V(C,m)}}{let z=this.tryTellTo(f.tokens,d,t);if(z){let C=o&&z.kind==="event-handler"?this.applyModifiers(z,o):z;return V(C,m)}}{let z=this.tryScrollModifiers(f.tokens,d,t);if(z){let C=o&&z.kind==="event-handler"?this.applyModifiers(z,o):z;return V(C,m)}}{let z=this.tryLoopIndex(f.tokens,d,t);if(z){let C=o&&z.kind==="event-handler"?this.applyModifiers(z,o):z;return V(C,m)}}{let z=this.tryWaitAlternatives(f.tokens,d,t);if(z){let C=o&&z.kind==="event-handler"?this.applyModifiers(z,o):z;return V(C,m)}}{let z=f.tokens,C=Xi(t);for(let D=0;D+1<z.length;D++){let R=z[D];if(this.isBodyCommandWord(R,C))break;if(z[D+1].value!=="(")continue;let _=(R.normalized??R.value).toLowerCase();if(!(B.KNOWN_EVENTS.has(_)||Pe.has(_))&&R.kind!=="identifier")continue;let F=this.matchEventParamPhrase(z,D+1);if(F.len===0)continue;let N=z[D+F.len],K=(d.slice(0,z[D+1].position.start).trimEnd()+" "+d.slice(N.position.end).trimStart()).trim();try{let M=this.parse(K,t);if(M?.kind==="event-handler"){let I=this.reclaimEventCompoundTail(Zt(M),K,t);I&&(M=I.node);}let j=M?.roles.get("event"),Ee=(j?.type==="expression"?j.raw:j&&"value"in j?String(j.value):void 0)?.toLowerCase(),H=d.slice(0,z[D+1].position.start).trimEnd().toLowerCase(),L=Ee===R.value.toLowerCase()||Ee===_||Ee!==void 0&&As(Ee,t).some(I=>H.endsWith(I.toLowerCase()));if(M?.kind==="event-handler"&&L){M.parameterNames=F.names;let I=o?this.applyModifiers(M,o):M;return V(I,m)}}catch{}}}{let z=f.tokens,C=Xi(t);for(let D=1;D<z.length-1;D++){let R=z[D];if(this.isBodyCommandWord(R,C))break;if(!Xt(R,t))continue;let _=z[D+1],P=(_.normalized??_.value).toLowerCase();if(!B.KNOWN_EVENTS.has(P))break;let F=D+1,N=z[D+2];N&&N.kind==="selector"&&N.value.startsWith("[")&&(F=D+2);let K=z[D].position.start,M=z[F].position.end,j=(d.slice(0,K).trimEnd()+" "+d.slice(M).trimStart()).trim();if(j&&j!==d)try{let ne=this.parse(j,t);if(ne&&ne.kind==="event-handler"){ne.additionalEvents=[{type:"literal",value:F>D+1?P+N.value:P}];let Ee=o?this.applyModifiers(ne,o):ne;return V(Ee,m)}}catch{}break}}{let z=Hf(f.tokens);if(z){let C=(d.slice(0,z.start).trimEnd()+" "+d.slice(z.end).trimStart()).trim();if(C&&C!==d)try{let D=this.parse(C,t);if(D&&D.kind==="event-handler"){let R=this.applyModifiers(D,{...o??{},...z.modifiers});return V(R,m)}}catch{}}}let v=h.filter(z=>z.command==="on"),E=f.mark(),k=Se.matchBest(f,v);if(k){m.push(G(`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 C=k.captured.get("event"),D=(C?.raw??C?.value??"").toString().toLowerCase(),R=Re[t],_=B.KNOWN_EVENTS.has(D)||!!R&&Object.keys(R).some(P=>P.toLowerCase()===D);if(D&&!_){let P=this.trySOVEventExtraction(d,t,h);if(P){m.push(G(`bare-event mis-anchor on "${D}" rejected; SOV extraction preferred`,"info","stage-bare-event-guard"));let F=o?this.applyModifiers(P,o):P;return V(F,m)}if(C?.type==="reference"||C?.type==="expression"){f.reset(E);let F=h.filter(K=>K.command!=="on"),N=Se.matchBest(f,F);f.reset(E),N&&N.pattern.command!=="on"?(z=true,m.push(G(`bare-event mis-anchor on reference "${D}" rejected; command ${N.pattern.command} preferred`,"info","stage-bare-event-guard"))):Se.matchBest(f,v);}}}if(!z){let C=this.buildEventHandler(k,f,t),D=o?this.applyModifiers(C,o):C;return V(D,m)}}m.push(G(`event patterns: ${v.length} tried, no match`,"info","stage-event"));let w=this.tryTrailingEventExtraction(d,t,h);if(w){m.push(G("trailing event extraction succeeded","info","stage-trailing-event"));let z=o?this.applyModifiers(w,o):w;return V(z,m)}let g=h.filter(z=>z.command!=="on"),A=this.tryParseUnlessGuard(f,g,t);if(A&&A.length>0){let z=A.length===1?A[0]:st(A,"then",{sourceLanguage:t,confidence:1});return V(z,m)}let b=Se.matchBest(f,g);if(b){if(Xe.has(b.pattern.command)){let C=this.trySOVEventExtraction(d,t,h);if(C){m.push(G(`SOV event extraction preferred over bare ${b.pattern.command} command`,"info","stage-sov-loop"));let R=o?this.applyModifiers(C,o):C;return V(R,m)}let D=this.tryMidStreamEventExtraction(d,t,h);if(D){m.push(G(`mid-stream event extraction preferred over bare ${b.pattern.command} command`,"info","stage-midstream-loop"));let R=o?this.applyModifiers(D,o):D;return V(R,m)}}else if(B.KNOWN_EVENTS.has(b.pattern.command)&&this.hasSOVEventMarkerHead(d,t)){let C=this.trySOVEventExtraction(d,t,h);if(C){m.push(G(`SOV event extraction preferred over command-homonym event ${b.pattern.command}`,"info","stage-sov-homonym"));let D=o?this.applyModifiers(C,o):C;return V(D,m)}}else if(T(t)?.wordOrder==="VSO"){let C=this.tryMidStreamEventExtraction(d,t,h);if(C){m.push(G(`mid-stream event extraction preferred over bare ${b.pattern.command} command`,"info","stage-midstream-cmd"));let D=o?this.applyModifiers(C,o):C;return V(D,m)}}if(b.consumedTokens<f.tokens.length&&T(t)?.wordOrder==="SOV"){let C=this.trySOVEventExtraction(d,t,h);if(C){m.push(G(`SOV event extraction preferred over partial ${b.pattern.command} command (trailing remainder)`,"info","stage-sov-trailing"));let D=o?this.applyModifiers(C,o):C;return V(D,m)}}if(b.consumedTokens<f.tokens.length&&fa.has(b.pattern.command)){let C=this.tryTopLevelLoop(f,g,t);if(C)return m.push(G(`top-level loop: ${C.kind}`,"info","stage-top-level-loop")),V(C,m)}if(b.consumedTokens<f.tokens.length&&!Xe.has(b.pattern.command)){let C=this.tryTopLevelCommandSequence(f,g,t);if(C)return m.push(G(`top-level command sequence: ${C.statements.length} commands`,"info","stage-top-level-sequence")),V(C,m)}if(b.consumedTokens<f.tokens.length&&(b.pattern.command==="if"||b.pattern.command==="unless")){let C=this.tryCompoundCommandParsing(f,g,t);if(C)return m.push(G("conditional with a trailing body","info","stage-compound")),V(C,m)}m.push(G(`command pattern matched: ${b.pattern.id} (confidence: ${b.confidence.toFixed(2)})`,"info","pattern-match"));let z=ky(b,f,d);return z&&m.push(G(z,"warning","unconsumed-input")),V(this.buildCommand(b,t),m)}if(m.push(G(`command patterns: ${g.length} tried, no match`,"info","stage-command")),!d.includes(`
5
- `)&&T(t)?.wordOrder==="VSO"){let z=this.tryMidStreamEventExtraction(d,t,h);if(z){m.push(G("mid-stream event extraction succeeded with no leading command match","info","stage-midstream-nocmd"));let C=o?this.applyModifiers(z,o):z;return V(C,m)}}let x=this.trySOVEventExtraction(d,t,h);if(x){m.push(G("SOV event extraction succeeded","info","stage-sov"));let z=o?this.applyModifiers(x,o):x;return V(z,m)}m.push(G("SOV event extraction: no event keyword found","info","stage-sov"));let S=this.tryCompoundCommandParsing(f,g,t);if(S)return m.push(G("compound command parsing succeeded","info","stage-compound")),V(S,m);if(m.push(G("compound parsing: no then-keywords or no command matches","info","stage-compound")),t==="en"){let z=Z(d,t),C=this.tryParsePseudoCommand(z,g,t);if(C&&z.isAtEnd())return m.push(G("pseudo-command parsed as call","info","stage-pseudo")),V(C,m)}throw m.push(G(`all parse stages exhausted for "${d}"`,"error","parse-failed")),new Ji(`Could not parse input in ${t}: ${d}`,t,d,m)}tryParsePseudoCommand(e,t,i){if(i!=="en")return null;let n=$f(e.tokens,e.position(),T(i),u=>!!ue((u.normalized??u.value).toLowerCase()));if(!n)return null;let a=Z(n.text,i),o=Se.matchBest(a,t.filter(u=>u.command==="call"));if(!o||!a.isAtEnd())return null;for(let u=0;u<n.consumed;u++)e.advance();return this.buildCommand(o,i)}parseStatements(e,t){let i=Z(e,t),n=ye(t).filter(a=>a.command!=="on").sort((a,o)=>o.priority-a.priority);this.coverageFrames.push([]);try{let a=this.parseBodyWithClauses(i,n,t),o=this.coverageFrames[this.coverageFrames.length-1];if(o.length>0&&a.length>0){let u=a[a.length-1];a[a.length-1]=V(u,[...u.diagnostics??[],...o]);}return a}finally{this.coverageFrames.pop();}}canParse(e,t){try{return this.parse(e,t),!0}catch{return false}}supportedLanguages(){return oa()}buildCommand(e,t){if(!e)throw new Error("No match to build command from");let i={};for(let[a,o]of e.captured)i[a]=o;let n=fe(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 k=n.type==="expression"?n.raw:n.type==="literal"?n.value:void 0;if(typeof k=="string"&&/^[^\s()[\]{}:]+$/.test(k)){let w=Re[i]?.[k];w?n={type:"literal",value:w,dataType:"string"}:n.type==="expression"&&B.KNOWN_EVENTS.has(k.toLowerCase())&&(n={type:"literal",value:k.toLowerCase(),dataType:"string"});}}let a=Se.extractEventModifiers(t),o=k=>!(k.type==="reference"&&k.value==="me")&&k.implicit!==true,u=e.captured.get("source"),s=e.pattern.command==="on"&&/^(on|event)-/.test(e.pattern.id),l=false;u&&(e.pattern.id.endsWith("source")||s)&&o(u)&&(a={...a??{},from:u},l=true);let c;if(e.eventSource&&!l){let k=e.captured.get("action"),w=k?.type==="literal"?ue(String(k.value)):void 0;T(i)?.roleMarkers?.source?.position==="after"&&w?.roles.some(A=>A.role==="source")&&!e.captured.has("source")?c=e.eventSource:o(e.eventSource)&&(a={...a??{},from:e.eventSource});}let p=e.captured.get("event")?.position,d=t.tokens[t.position()-1],f=p!==void 0&&d!==void 0&&d.position.end>p.end?[]:this.extractOrConjunctionEvents(t,i),y=n;f.length>0&&n.type==="literal"&&(y={type:"literal",value:[String(n.value),...f.map(w=>String("value"in w?w.value:""))].join(" or ")});let h,v=e.captured.get("action");if(v&&v.type==="literal"&&v.value==="if"){let k=t.tokens,w=-1;for(let g=t.position()-1;g>=0;g--){let A=k[g],b=(A.normalized??A.value).toLowerCase();if(this.isIfKeyword(b,i)){w=g;break}}for(;w>0;){let g=k[w-1];if(!this.isIfKeyword((g.normalized??g.value).toLowerCase(),i))break;w--;}if(w>=0){let g=ye(i).filter(C=>C.command!=="on").sort((C,D)=>D.priority-C.priority),A=k.slice(w);if(e.pattern.id.endsWith("vso-verb-first")&&y.type==="literal"){let C=String(y.value??"").split("[")[0].trim().toLowerCase(),D=A.findIndex((R,_)=>{if(_===0||C==="")return false;let P=(R.normalized??R.value).toLowerCase(),F=A[_-1];return P===C&&F.kind==="keyword"&&(F.normalized??"").toLowerCase()==="on"});if(D>0){let R=A[D+1],_=R&&R.kind==="selector"&&R.value.startsWith("[")?1:0;A=[...A.slice(0,D-1),...A.slice(D+1+_)];}}let b=new me(A,i),x=this.coverageMark(),S=this.parseBodyWithClauses(b,g,i);if(S.some(C=>C.kind==="conditional")||S.length===1&&S[0]?.kind==="compound"&&S[0].statements.some(C=>C.kind==="conditional")){for(;!t.isAtEnd();)t.advance();return Ct(y,S,a,{sourceLanguage:i,patternId:e.pattern.id,confidence:e.confidence})}this.coverageRollback(x);}}if(v&&v.type==="literal"&&String(v.value)!=="js"&&ue(String(v.value))!==void 0){let k=v.value,w={};for(let[F,N]of e.captured)if(F!=="event"&&F!=="action"&&F!=="continues"){if(F==="source"&&l)continue;w[F]=N;}if(c&&(w.source=c),k==="repeat"){let F=t.peek(),N=M=>(M.normalized??M.value).toLowerCase();if(F&&F.kind==="keyword"&&N(F)==="forever")w.loopType={type:"literal",value:"forever"},delete w.patient,t.advance();else if(F&&F.kind==="keyword"&&N(F)==="event"){t.advance();let M=t.peek();if(M)for(w.event={type:"literal",value:N(M)},w.loopType={type:"literal",value:"until-event"},delete w.patient;!t.isAtEnd();){let j=t.peek();if(!j||j.kind==="conjunction"||j.kind==="keyword"&&(this.isThenKeyword(j.value,i)||this.isEndKeyword(j.value,i)))break;t.advance();}}let K=w.patient;K&&K.type==="reference"&&K.value==="me"&&delete w.patient;}let g=fe(k,w,{sourceLanguage:i,patternId:e.pattern.id,confidence:e.confidence});this.registerBoundIdentifiers(g);let A=[];if(!Xe.has(k)||k==="repeat"||k==="while"){let F=e.pattern.id.includes("verb-first"),N=t.tokens,K=t.position(),M=L=>{let I=N[L];if(I.kind==="conjunction")return true;if(I.kind!=="keyword")return false;let X=ze(N,L);return this.isThenAt(I,X,i)||this.isEndKeyword(I.value,i)&&!_e(X,i)},j=k==="repeat"||k==="while",ne=L=>M(L)||j&&this.isBlockEndToken(N[L],ze(N,L),i),Ee=new Set;{let L=T(i)?.keywords?.[k];L?.primary&&Ee.add(L.primary.toLowerCase());for(let I of L?.alternatives??[])Ee.add(I.toLowerCase());}let H=-1;for(let L=K-1;L>=0;L--){let I=N[L];if(M(L))break;if((I.normalized??I.value).toLowerCase()===k||Ee.has(I.value.toLowerCase())){H=L;break}}if(H>=0){let L=K,I=0;for(;L<N.length;){let ae=N[L],Ae=Ut(N,L);if(j&&this.isIfKeyword((ae.normalized??ae.value).toLowerCase(),i)&&!(Ae&&this.isElseKeyword(Ae.value,i)))I++;else if(I>0)this.isBlockEndToken(ae,ze(N,L),i)&&I--;else if(ne(L))break;L++;}let X=N.slice(H,L),Ce=X;if(F){let ae=String(n.value??"").toLowerCase(),Ae=X.findIndex(pe=>(pe.normalized??pe.value).toLowerCase()===ae);if(Ae<0)Ce=null;else {let pe=X[Ae-1],de=pe&&pe.kind==="keyword"&&pe.normalized?.toLowerCase()==="on"?Ae-1:Ae;Ce=[...X.slice(0,de),...X.slice(Ae+1)];}}if(Ce&&Ce.length>1){let ae=ye(i).filter(q=>q.command!=="on").sort((q,J)=>J.priority-q.priority),Ae=this.coverageMark(),pe=this.parseClause(Ce,ae,i),de=pe[0],it=q=>q!==null&&typeof q=="object"&&typeof q.type=="string"?q.type:typeof q,nt=ue(k),pr=nt?.primaryRole,ai=q=>q==="patient"&&pr&&pr!=="patient"&&!nt?.roles.some(J=>J.role==="patient")?pr:q,$a=(q,J)=>{if(!Xe.has(k)||!nt)return false;let je=nt.roles.find(zt=>zt.role===ai(q));return je?je.expectedTypes.length>0&&!je.expectedTypes.includes(it(J)):true},dr=(q,J)=>q==="patient"&&!!nt&&!nt.roles.some(je=>je.role==="patient")&&it(J)==="literal"&&Ot.has(String(J.value??"").toLowerCase()),mr=q=>q!==null&&typeof q=="object"&&q.implicit===true,ja=!!de&&de.kind==="command"&&Object.entries(w).every(([q,J])=>{if(mr(J)||$a(q,J)||dr(q,J))return true;let je=de.roles.get(ai(q));if(je!==void 0&&it(je)===it(J))return true;if(q==="patient"&&k==="pick"&&it(J)==="literal"){let zt=de.roles.get("method"),ui=it(zt),si=ui==="literal"?String(zt.value):ui==="expression"?String(zt.raw):void 0;return si!==void 0&&si===String(J.value)}return false}),oi=de?.metadata?.patternId??"",Wa=!Xe.has(k)||Qi.test(oi),qa=Qi.test(oi);if((pe.length===1||qa&&pe.length>1)&&de&&de.kind==="command"&&(de.action===k||k==="while"&&de.action==="repeat"&&/-while-head$/.test(de.metadata?.patternId??""))&&ja&&Wa&&(de.roles.size>Object.entries(w).filter(([q,J])=>!dr(q,J)).length||[...de.roles.values()].filter(q=>!mr(q)).length>Object.entries(w).filter(([q,J])=>!dr(q,J)&&!mr(J)).length))for(g=de,A=pe.slice(1);t.position()<L;)t.advance();else this.coverageRollback(Ae);}}}if(!Xe.has(k)){let F=g;if(ue(k)?.roles.some(H=>H.role==="quantity"&&!H.required)&&!F.roles.has("quantity")){let H=t.peek();H&&/^-?\d+(\.\d+)?$/.test(H.value)&&(g=fe(k,{...Object.fromEntries(F.roles),quantity:{type:"literal",value:parseFloat(H.value),dataType:"number"}},F.metadata),t.advance());}let K=g;if(ue(k)?.roles.some(H=>H.role==="duration"&&!H.required)&&!K.roles.has("duration")){let H=/^\d+(\.\d+)?(ms|s)$/i,L=t.peek(),I=false;if(L&&L.kind==="particle"){let X=t.peek(1);X&&H.test(X.value)&&(I=true,L=X);}L&&H.test(L.value)&&(g=fe(k,{...Object.fromEntries(K.roles),duration:{type:"literal",value:L.value,dataType:"string"}},K.metadata),I&&t.advance(),t.advance(),this.consumeForPostposition(t,i));}let j=g,ne=ue(k);if(ne?.roles.find(H=>H.role==="responseType"&&!H.required)&&!j.roles.has("responseType")){let H=ae=>typeof ae=="string"&&B.RESPONSE_TYPE_WORDS.has(ae.toLowerCase()),L=(ae,Ae)=>{let pe=Object.fromEntries(j.roles);Ae&&delete pe.destination,pe.responseType={type:"expression",raw:ae},g=fe(k,pe,j.metadata);},I=j.roles.get("destination"),X=ne?.roles.find(ae=>ae.role==="destination"),Ce=I?.raw??I?.value;if(I&&X&&!X.expectedTypes.includes(I.type)&&H(Ce))L(Ce,true);else {let ae=t.peek();ae&&H(ae.value)&&(L(ae.value,false),t.advance());}}if(k==="wait"){let H=g;if(!H.roles.has("event")){let L=t.peek();if(L&&Pe.has(L.value.toLowerCase())){let I=Object.fromEntries(H.roles),X=I.duration;X&&X.type!=="literal"&&X.type!=="expression"&&delete I.duration;let Ce=I.patient;Ce&&Ce.type==="reference"&&Ce.value==="me"&&delete I.patient,I.event={type:"literal",value:L.value,dataType:"string"},g=fe(k,I,H.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 b=e.captured.get("continues"),x=b?.type==="literal"&&b.value==="then",S=t.peek(),z=!!S&&this.isThenKeyword(S.value,i),D=Xe.has(k)&&!!S&&!this.isEndKeyword(S.value,i),R=!!S&&!this.isEndKeyword(S.value,i),_=[g,...A],P=!!S&&this.isEndKeyword(S.value,i)&&Gt(_)>0&&t.peek(1)!==null;if(P&&(t.advance(),_.push(lt)),x||z||D||R||P){let F=ye(i).filter(M=>M.command!=="on").sort((M,j)=>j.priority-M.priority),N=ye(i).filter(M=>M.id.startsWith("grammar-")&&M.id.includes("-continuation")).sort((M,j)=>j.priority-M.priority),K=this.parseBodyWithGrammarPatterns(t,F,N,i,_);h=this.foldLoopBlocks([..._,...K]);}else h=this.foldLoopBlocks(_),t.isAtEnd()||this.recordDroppedTokens(t.tokens.slice(t.position()),i,"handler body tail");}else {let k=ye(i).filter(g=>g.command!=="on").sort((g,A)=>A.priority-g.priority),w=v?e.roleStarts?.get("action"):void 0;if(w!==void 0&&w<t.position()){let g=new me(t.tokens.slice(w),i);for(h=this.parseBodyWithClauses(g,k,i);!t.isAtEnd();)t.advance();}else h=this.parseBodyWithClauses(t,k,i);}let E=h.length>1?[st(h,"then",{sourceLanguage:i})]:h;return Ct(y,E,a,{sourceLanguage:i,patternId:e.pattern.id,confidence:e.confidence})}parseBodyWithClauses(e,t,i){let n=[],a=[],o=0,u=[],s=(c=0)=>{let p=Gt(n);o=p+c,u.length=0;for(let d=0;d<p;d++)u.push("loop");for(let d=0;d<c;d++)u.push("while");};for(;!e.isAtEnd();){let c=e.peek();if(!c)break;if(a.length===0){let k=this.consumeJsBlock(e,i)??this.consumeVerbFinalJsBlock(e,i);if(k){n.push(k);continue}let w=this.tryParseConditionalBlock(e,t,i);if(w){n.push(w);continue}let g=this.tryParseUnlessGuard(e,t,i);if(g){n.push(...g);continue}}let p=c.kind==="conjunction"||c.kind==="keyword"&&this.isThenAt(c,ze(e.tokens,e.position()),i),d=a[a.length-1],m=e.peek(1),f=d?.value.toLowerCase()==="at"&&m?.value.toLowerCase()==="of"||vr(i,c.value,d?.value,m?.value),y=c.kind==="keyword"&&this.isEndKeyword(c.value,i)&&!f&&!_e(ze(e.tokens,e.position()),i);if((y||!f&&this.isBlockEndToken(c,ze(e.tokens,e.position()),i))&&u.every(k=>k==="loop")&&this.closeLoopAtEnd(e,a,n,t,i)){a.length=0,s();continue}if(y&&o>0){o--,u.pop(),a.push({...c,metadata:{...c.metadata,closesTrackedBlock:true}}),e.advance();continue}if(p&&u.includes("if")){a.push(c),e.advance();continue}if(p){if(a.length>0){let k=this.parseClause(a,t,i);n.push(...k),a.length=0,s(k.filter(w=>{let g=w;return g.action==="while"&&(!Array.isArray(g.body)||g.body.length===0)}).length);}e.advance();continue}if(y){e.advance();let k=[];for(;!e.isAtEnd();){let w=e.peek();if(!w||w.kind==="conjunction"||w.kind==="keyword"&&(this.isThenKeyword(w.value,i)||this.isEndKeyword(w.value,i)))break;k.push(w),e.advance();}if(k.length>0){let w=this.coverageMark(),g=a.length>0?this.parseClause(a,t,i):[];g.length===0&&a.length>0?(this.coverageRollback(w),n.push(...this.parseClause([...a,...k],t,i))):(n.push(...g),n.push(...this.parseClause(k,t,i)));}else if(a.length>0){let w=this.parseClause(a,t,i);n.push(...w);}a.length=0;break}let v=(c.normalized??c.value).toLowerCase(),E=zr(c);if(c.kind==="keyword"||E){let k=this.isIfKeyword(v,i),w=Ut(a,a.length);(v==="for"||v==="while")&&w&&zr(w)||k&&w&&this.isElseKeyword(w.value,i)||(E&&u[u.length-1]==="while"?u[u.length-1]="loop":(k||this.isUnlessKeyword(v,i)||v==="while"||v==="for"||E)&&(o++,u.push(k?"if":E||v==="for"?"loop":v==="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 p=n[c];p.kind==="command"&&p.action==="for"&&(!(p.roles instanceof Map)||p.roles.size===0)&&(!Array.isArray(p.body)||p.body.length===0)&&n.splice(c,1);}let l=this.foldLoopBlocks(n);return l.length>1?[st(l,"then",{sourceLanguage:i})]:l}closeLoopAtEnd(e,t,i,n,a){let o=Gt(i);if(t.length===0)return o===0?false:(i.push(lt),e.advance(),true);let u=this.coverageMark(),s=this.parseClause([...t],n,a);return s.length===0||o+s.filter(Pr).length===0?(this.coverageRollback(u),false):(i.push(...s,lt),e.advance(),true)}foldLoopBlocks(e){let t=[],i=[],n=o=>{(i.length>0?i[i.length-1].body:t).push(o);},a=o=>{let u=i.pop();u&&n(this.buildLoopNode(u.head,u.body,o));};for(let o of e)Xr(o)?a(true):Pr(o)?i.push({head:o,body:[]}):n(o);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 p=new Map(e.roles);return p.set("quantity",n),p.set("loopType",{type:"literal",value:"times"}),this.buildLoopNode({...e,roles:p},t,i)}let a=n?.type==="literal"?String(n.value):void 0,o=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",u=o==="for"?e.roles.get("patient"):void 0,s=u?fy(u):void 0,l=new Map(e.roles),c=l.get("quantity");return (o==="while"||o==="until")&&c&&!l.has("condition")&&(l.set("condition",c),l.delete("quantity")),e0(e.action==="for"?"for":"repeat",o,Object.fromEntries(l),t,{...s?{loopVariable:s}:{},...e.metadata?{metadata:e.metadata}:{}})}tryTopLevelLoop(e,t,i){let n=this.coverageMark(),a;try{let u=new me(e.tokens,i);a=this.parseBodyWithClauses(u,t,i);}catch{return this.coverageRollback(n),null}let[o]=a;if(a.length===1&&o.kind==="loop")return o;if(a.length===1&&o.kind==="compound"){let u=o;if(u.statements[0]?.kind==="loop"){let s=u.statements.map(l=>l.metadata?.confidence??.75);return st(u.statements,u.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 me(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 o=a[0];if(o.statements.length<2)return this.coverageRollback(n),null;let u=o.statements.map(l=>l.metadata?.confidence??.75),s=u.reduce((l,c)=>l+c,0)/u.length;return st(o.statements,o.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 o=n.roles.get("condition");if(!o||a.roles.has("condition")||Array.isArray(n.body)||Array.isArray(a.body))continue;let u=new Map(a.roles);u.set("condition",o),u.set("loopType",{type:"literal",value:"while",dataType:"string"}),e.splice(i,2,{...a,roles:u,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(T(i)?.wordOrder==="SOV"){let o=B.countBeforeVerb(t,i);if(o<0)return;let u=t[o];return t.length=o,u}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"?Yt(e):null;return t?.type==="literal"&&typeof t.value=="number"}static countsBefore(e,t,i){return !e||!t||!jr[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(T(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"&&!zy.has(String(n.value))}bareRepeatHead(e,t){let i=e?Yt(e):null;return fe("repeat",e&&i?{loopType:Y("times"),quantity:wn(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,o=e[e.length-1];if(o&&e.length>=2){let v=(o.normalized??o.value).toLowerCase();this.isUnlessKeyword(v,i)&&(n="unless",a=e.slice(0,-1));}let u=null;if(n&&a.length>=3){let v=T(i),E=v?B.buildVerbLookup(v):null;if(E)for(let k=1;k<a.length-1;k++){let w=a[k],g=E.get(w.value.toLowerCase())??(w.normalized?E.get(w.normalized.toLowerCase()):void 0);if(g&&!B.CONDITION_OPERATORS.has(g)){u=a.slice(0,k),a=a.slice(k);break}}}let s=new me(a,i),l=[],c=this.coverageMark(),p=0,d=[],m=u,f=()=>{if(d.length===0)return;let v=d.slice();if(d.length=0,n&&l.length===0&&m===null){m=v;return}let E=v[0];if(!(E&&(E.kind==="identifier"||E.kind==="selector"||E.kind==="literal"||E.kind==="reference"))){this.recordDroppedTokens(v,i,"body clause");return}let w=false;for(let g of this.parseSOVClauseByVerbAnchoring(v,i)){let A=g.action,b=g.roles;A&&ue(A)&&b instanceof Map&&b.size>0&&(l.push(g),w=true);}w||this.recordDroppedTokens(v,i,"body clause");};for(;!s.isAtEnd();){let v=s.peek(),E=!!v&&v.normalized?.toLowerCase()==="repeat",k=s.mark(),w=Se.matchBest(s,t);if(E&&w&&(w.pattern.command!=="repeat"||this.loopHeadReadsBody(w,d,i))){s.reset(k),s.advance();let g=this.takeRepeatCount(s,d,i);f(),l.push(this.bareRepeatHead(g,i)),p++;continue}if(!w&&v&&this.isIfKeyword((v.normalized??v.value).toLowerCase(),i)){let g=this.tryParseConditionalBlock(s,t,i);if(g){f(),l.push(g),p++;continue}}if(w&&w.pattern.command==="if"){let g=s.mark(),A=d.length;for(s.reset(k);!s.isAtEnd();){let x=s.peek();if(!x||this.isIfKeyword((x.normalized??x.value).toLowerCase(),i))break;d.push(x),s.advance();}let b=this.tryParseConditionalBlock(s,t,i);if(b){f(),l.push(b),p++;continue}d.length=A,s.reset(g);}if(w){f();let g=this.buildCommand(w,i);l.push(g),p++,this.tryAttachTrailingRole(s,g,i),this.tryAttachTrailingStyle(s,g,i),this.tryAttachTrailingExpressionRole(s,g,i),this.tryAttachTrailingDuration(s,g);}else {let g=d.length===0?this.tryParsePseudoCommand(s,t,i):null;if(g){f(),l.push(g),p++;continue}let A=s.peek(),b=A?.kind==="identifier"&&A.value.toLowerCase()==="repeat";if(A&&(A.normalized?.toLowerCase()==="repeat"||b)){let x=s.mark();s.advance();let S=this.takeRepeatCount(s,d,i);if(S||!b){f(),l.push(this.bareRepeatHead(S,i)),p++;continue}s.reset(x);}A&&d.push(A),s.advance();}}f();let y=l;if(p===0){let v=this.parseSOVClauseByVerbAnchoring(a,i);v.length>0&&(this.coverageRollback(c),y=v);}let h=m;return n&&y.length>0&&h&&h.length>0?[fe(n,{condition:{type:"expression",raw:this.joinTokenText(h,i)}},{sourceLanguage:i,patternId:`${n}-${i}-trailing-guard`,confidence:.85}),...y]:n&&h&&h.length>0&&y.length===0?[fe(n,{condition:{type:"expression",raw:this.joinTokenText(h,i)}},{sourceLanguage:i,patternId:`${n}-${i}-trailing-guard`,confidence:.85})]:y}tryAttachTrailingDuration(e,t){let i=t.roles;if(i.has("duration")||!ue(t.action)?.roles.some(o=>o.role==="duration"&&!o.required))return;let a=e.peek();!a||!/^\d+(?:\.\d+)?(?:ms|s|m|h)$/.test(a.value)||(i.set("duration",Y(a.value,"duration")),e.advance());}tryAttachNewWindow(e,t){let i=t.roles;if(t.action!=="go"||i.has("manner"))return;let[n,a,o]=[e.peek(),e.peek(1),e.peek(2)];if(!(n?.value.toLowerCase()!=="in"||a?.value.toLowerCase()!=="new")&&!(!o||(o.normalized??o.value).toLowerCase()!=="window")){i.set("manner",Be("window"));for(let u=0;u<3;u++)e.advance();}}tryAttachTrailingRole(e,t,i){let n=ue(t.action);if(!n)return;let a=T(i);if(!a)return;let o=t.roles,u=(l,c)=>{if(!l)return false;if(l.kind==="selector")return true;let p=(l.normalized??l.value).toLowerCase();return wr.has(p)?false:p==="body"||p==="it"||p==="you"||p==="result"||p==="document"||p==="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(h=>h.role===l))continue;let p=a.roleMarkers?.[l];if(!p)continue;let d=o.get(l);if(d&&!(d.type==="reference"&&d.value==="me"))continue;let m=h=>{if(!h||h.kind!=="particle"&&h.kind!=="keyword")return false;let v=h.value.toLowerCase();return p.primary?.toLowerCase()===v?true:c?false:(h.normalized??"").toLowerCase()===l?true:!!p.alternatives?.some(E=>E.toLowerCase()===v)},f=e.peek(),y=e.peek(1);if(!f||!y)return;if(c&&p.position==="after"){let h=e.peek(2),v=(f.normalized??f.value).toLowerCase();if(yy.has(v)&&y.kind==="selector"&&m(h)){o.set(l,{type:"expression",raw:`${v} ${y.value}`}),e.advance(),e.advance(),e.advance();return}}if(p.position==="after"){if(u(f,c)&&m(y)){let h=this.tokenToSemanticValue(f);e.advance(),e.advance(),h&&o.set(l,h);return}if(c&&u(f,c)){let h=e.peek(2),v=e.peek(3);if((y.normalized??y.value).toLowerCase()==="in"&&h&&!m(h)&&m(v)){let E=this.tokenToSemanticValue(f);e.advance(),e.advance(),e.advance(),e.advance(),E&&o.set(l,E);return}}}else if(m(f)&&u(y,c)){e.advance();let h=this.tokenToSemanticValue(e.advance());h&&o.set(l,h);return}}}tryAttachTrailingStyle(e,t,i){if(t.action!=="fetch"&&t.action!=="render")return;let n=t.roles;if(!ue(t.action)?.roles.some(v=>v.role==="style"))return;let o=n.get("style");if(o){if(o.type==="expression"&&typeof o.raw=="string"&&/^[A-Za-z_][\w-]*$/.test(o.raw)&&e.peek()?.value===":"){let v=Bt(e,o.raw);v&&n.set("style",{type:"expression",raw:v});}this.tryAttachResponseTypeAfterStyle(e,t,i);return}if(t.action==="fetch"){let v=n.get("patient"),E=n.get("source");if(v&&E&&(v.type==="literal"||v.type==="expression")&&E.type==="expression"&&typeof E.raw=="string"&&/^[A-Za-z_][\w-]*$/.test(E.raw)&&e.peek()?.value===":"){let k=Bt(e,E.raw);k&&(n.set("source",{type:"expression",raw:k}),this.tryAttachResponseTypeAfterStyle(e,t,i));return}}let s=T(i)?.roleMarkers?.style;if(!s)return;if(s.position==="before"){let v=new Set([s.primary,...s.alternatives??[]].map(g=>g.toLowerCase())),E=e.peek();if(!E||!v.has(E.value.toLowerCase()))return;let k=e.mark();e.advance();let w=Bt(e);if(!w){e.reset(k);return}n.set("style",{type:"expression",raw:w}),this.tryAttachResponseTypeAfterStyle(e,t,i);return}if(s.position!=="after")return;let l=new Set([s.primary,...s.alternatives??[]].map(v=>v.toLowerCase())),c=v=>v.kind==="conjunction"||v.kind==="keyword"&&(this.isThenKeyword(v.value,i)||this.isEndKeyword(v.value,i)),p=24,d=-1,m=0;for(let v=0;v<p;v++){let E=e.peek(v);if(!E||c(E))break;if(E.value==="("||E.value==="{"?m++:(E.value===")"||E.value==="}")&&(m=Math.max(0,m-1)),m===0&&(E.kind==="particle"||E.kind==="keyword")&&l.has(E.value.toLowerCase())){d=v;break}}if(d<=0)return;let f=[];for(let v=0;v<d;v++){let E=e.peek(v);E&&f.push(E);}if(f.length===1&&B.RESPONSE_TYPE_WORDS.has(f[0].value.toLowerCase()))return;let y=new me(f,i),h=Bt(y);n.set("style",{type:"expression",raw:h&&y.isAtEnd()?h:this.joinTokenText(f,i)});for(let v=0;v<=d;v++)e.advance();this.tryAttachResponseTypeAfterStyle(e,t,i);}tryAttachResponseTypeAfterStyle(e,t,i){let n=t.roles;if(n.has("responseType")||!ue(t.action)?.roles.some(c=>c.role==="responseType"&&!c.required))return;let o=c=>!!c&&B.RESPONSE_TYPE_WORDS.has(c.toLowerCase()),u=e.peek();if(!u)return;let s=c=>{n.set("responseType",{type:"expression",raw:c});};if(B.AS_MARKERS_BEFORE[i]?.some(c=>u.value.toLowerCase()===c)){let c=e.peek(1);c&&o(c.value)&&(e.advance(),e.advance(),s(c.value));return}if(o(u.value)){e.advance(),s(u.value);for(let c of B.AS_MARKERS_AFTER[i]??[])if(c.every((p,d)=>e.peek(d)?.value.toLowerCase()===p)){for(let p=0;p<c.length;p++)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 o=t.roles,u=o.get(a.role);if(n==="go"&&u&&u.type==="expression"&&String(u.raw).toLowerCase()==="url"){let v=e.peek();if(v&&!wr.has((v.normalized??v.value).toLowerCase())){let k=this.tokenToSemanticValue(v);if(k.type==="literal"||k.type==="selector"){o.set(a.role,k),o.set("method",{type:"literal",value:"url"}),e.advance();return}}let E=o.get("patient");if(E&&(E.type==="literal"||E.type==="selector")){o.set(a.role,E),o.set("method",{type:"literal",value:"url"}),o.delete("patient");return}}if(n==="go"&&u&&u.type==="expression"){let v=/^url\s+(\S+)$/i.exec(String(u.raw??""));if(v){let E=v[1].replace(/^["']|["']$/g,"");o.set(a.role,{type:"literal",value:E,dataType:"string"}),o.set("method",{type:"literal",value:"url"});return}}if(n==="go"&&!u){let v=o.get("patient");if(v&&v.type==="expression"&&String(v.raw).toLowerCase()==="url"){let E=e.peek();if(E&&!wr.has((E.normalized??E.value).toLowerCase())){let k=this.tokenToSemanticValue(E);if(k.type==="literal"||k.type==="selector"){o.set(a.role,k),o.set("method",{type:"literal",value:"url"}),o.delete("patient"),e.advance();return}}}}if(u&&!(u.type==="reference"&&u.value==="me"))return;let s=T(i);if(!s)return;let l=null;if(a.terminator==="destination-marker"){let v=s.roleMarkers?.destination;if(!v||v.position!=="after")return;l=v.primary.toLowerCase();}let c=v=>v.kind==="conjunction"||v.kind==="keyword"&&(this.isThenKeyword(v.value,i)||this.isEndKeyword(v.value,i)),p=24,d=[],m=0,f=false;for(let v=0;v<p;v++){let E=e.peek(v);if(!E||c(E))break;if(E.value==="("||E.value==="{"?m++:(E.value===")"||E.value==="}")&&(m=Math.max(0,m-1)),l!==null&&m===0&&(E.kind==="particle"||E.kind==="keyword")&&E.value.toLowerCase()===l){f=true;break}d.push(E);}if(d.length===0||l!==null&&!f)return;let y=d.length+(f?1:0);if(n==="go"&&d.length===2&&d[0].value.toLowerCase()==="url"){let v=this.tokenToSemanticValue(d[1]);if(v.type==="literal"||v.type==="selector"){o.set(a.role,v),o.set("method",{type:"literal",value:"url"});let E=o.get("patient");E&&E.type==="reference"&&E.value==="me"&&!ue(n)?.roles.some(k=>k.role==="patient")&&o.delete("patient");for(let k=0;k<y;k++)e.advance();return}}let h=d;if(n==="js"){let v=s.keywords?.js,E=w=>[v?.primary,...v?.alternatives??[]].some(g=>!!g&&g.length>w.value.length&&g.includes(w.value)),k=0;for(;k<h.length&&E(h[k]);)k++;if(h=h.slice(k),h.length===0)return}if(o.set(a.role,{type:"expression",raw:this.joinTokenText(h,i)}),a.role!=="patient"){let v=o.get("patient");v&&v.type==="reference"&&v.value==="me"&&!ue(n)?.roles.some(E=>E.role==="patient")&&o.delete("patient");}for(let v=0;v<y;v++)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 o of n.alternatives)t.has(o)||t.set(o,i);}return t}parseSOVClauseByVerbAnchoring(e,t){let i=T(t);if(!i||i.wordOrder!=="SOV")return [];let n=B.buildVerbLookup(i),a=B.buildMarkerToRoleLookup(i),o=[],u=0;for(;u<e.length;){let s=-1,l="";for(let f=u;f<e.length;f++){let y=e[f];if(a.has(y.value))continue;let h=n.get(y.value.toLowerCase()),v=y.normalized?n.get(y.normalized.toLowerCase()):void 0,E=h||v;if(E){s=f,l=E;break}}if(s===-1)break;let c=e.slice(u,s),p=e.length;for(let f=s+1;f<e.length;f++){let y=e[f];if(y.kind==="conjunction"||this.isThenKeyword(y.value,t)){p=f;break}if(f>s+1&&!a.has(y.value)&&(n.get(y.value.toLowerCase())||(y.normalized?n.get(y.normalized.toLowerCase()):void 0))){p=f;break}}let d=e.slice(s+1,p),m=this.extractRolesFromMarkedTokens(c,d,a,l,t);if(o.push(fe(l,m,{sourceLanguage:t,confidence:.7})),u=p,u<e.length){let f=e[u];(f.kind==="conjunction"||this.isThenKeyword(f.value,t))&&u++;}}return o}extractRolesFromMarkedTokens(e,t,i,n,a){let o={},u=(l,c)=>{let p=this.isEndKeyword(l.value,a),d=l.kind==="keyword"&&(l.normalized??"").toLowerCase()==="end";return !p&&!d?false:l.metadata?.closesTrackedBlock===true||p?true:!(c&&c.kind==="selector")},s=l=>{let c=[];for(let p=0;p<l.length;p++){let d=l[p];if(u(d,l[p+1]))continue;let m=i.get(d.value);if(m&&d.kind==="particle"&&c.length>0){let f=this.tokensToSemanticValue(c,a);if(f){let y=this.mapRoleForCommand(m,n,o);y&&(o[y]=f);}c=[];}else c.push(d);}if(c.length>0)if(c.length===1&&/^\d+(\.\d+)?(ms|s)$/i.test(c[0].value)&&!o.duration&&ue(n)?.roles.some(d=>d.role==="duration"))o.duration={type:"literal",value:c[0].value,dataType:"string"};else {let d=this.tokensToSemanticValue(c,a);d&&(o.patient?o.destination||(o.destination=d):o.patient=d);}};return s(e),s(t),o}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(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((s,l)=>l>0&&(s.normalized??s.value).toLowerCase()==="in");u>0&&(i=i.slice(0,u));}if(i.length===1)return this.tokenToSemanticValue(i[0]);let n=this.joinTokenText(i,t);if(ea(n))return {type:"expression",raw:n};let a=i.map(u=>u.value).join(""),o=i[0];return o.kind==="selector"||o.value.startsWith("#")||o.value.startsWith(".")||o.value.startsWith("@")||o.value.startsWith("*")?Ne(a):o.kind==="literal"||o.value.startsWith('"')||o.value.startsWith("'")?Y(by(a),"string"):o.kind==="reference"?Be(a):Y(n)}tokenToSemanticValue(e){return Yt(e)??Y(e.value)}parseBodyWithGrammarPatterns(e,t,i,n,a=[]){let o=[],u=()=>Gt([...a,...o]),s=[],l=false,c=()=>{if(!l&&s.length>0){let m=this.parseSOVClauseByVerbAnchoring(s,n);o.push(...m),m.length===0&&this.recordDroppedTokens(s,n,"fused body walk");}else s.length>0&&this.recordDroppedTokens(s,n,"fused body walk");s=[],l=false;},p=0,d=()=>o.filter(m=>{let f=m;return f.action==="while"&&(!Array.isArray(f.body)||f.body.length===0)}).length-p;for(;!e.isAtEnd();){let m=e.peek();if(m&&this.isThenKeyword(m.value,n)){c(),e.advance();continue}if(m&&u()>0&&!this.isEndKeyword(m.value,n)&&this.isBlockEndToken(m,ze(e.tokens,e.position()),n)&&!vr(n,m.value,e.peek(-1)?.value,e.peek(1)?.value)){c(),o.push(lt),e.advance();continue}if(m&&this.isEndKeyword(m.value,n)){let y=e.peek(-1),h=e.peek(1);if(!vr(n,m.value,y?.value,h?.value)){if(c(),u()>0){o.push(lt),e.advance();continue}if(d()>0){p++,e.advance();continue}e.advance();break}}if(m&&!l&&this.isIfKeyword((m.normalized??m.value).toLowerCase(),n)){c();let y=this.tryParseConditionalBlock(e,t,n);if(y){o.push(y),l=true;continue}}let f=false;if(i.length>0){let y=Se.matchBest(e,i);if(y){let h=y.pattern.command,v={};for(let[w,g]of y.captured)w!=="event"&&w!=="action"&&w!=="continues"&&(v[w]=g);let E=fe(h,v,{sourceLanguage:n,patternId:y.pattern.id});o.push(E),f=true,l=true;let k=y.captured.get("continues");if(k&&k.type==="literal"&&k.value==="then")continue}}if(!f){let y=e.mark(),h=Se.matchBest(e,t);if(h){if(h.pattern.command==="if"){let E=e.mark();for(e.reset(y);!e.isAtEnd();){let w=e.peek();if(!w||this.isIfKeyword((w.normalized??w.value).toLowerCase(),n))break;e.advance();}let k=this.tryParseConditionalBlock(e,t,n);if(k){c(),o.push(k),l=true;continue}e.reset(E);}let v=this.buildCommand(h,n);o.push(v),this.tryAttachTrailingRole(e,v,n),f=true,l=true;}}f||(m&&s.push(m),e.advance());}c(),e.isAtEnd()||this.recordDroppedTokens(e.tokens.slice(e.position()),n,"fused body walk");for(let m=o.length-1;m>=0;m--){let f=o[m];f.kind==="command"&&f.action==="for"&&(!(f.roles instanceof Map)||f.roles.size===0)&&(!Array.isArray(f.body)||f.body.length===0)&&o.splice(m,1);}return o}tryCompoundCommandParsing(e,t,i){let n=e.tokens,a=n.some(c=>c.kind==="conjunction"||c.kind==="keyword"&&this.isThenKeyword(c.value,i)),o=n.some(c=>this.isElseKeyword(c.value,i));if(!a&&!o)return null;let u=new me(n,i),s=this.coverageMark(),l=this.parseBodyWithClauses(u,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((o,u)=>e[t+u]?.value===o))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=Re[t],o=new Set;if(a)for(let u of Object.keys(a))o.add(u.toLowerCase());for(let u=0;u<n.length;u++){let s=n[u],l=s.value.toLowerCase(),c=s.normalized?.toLowerCase();if(!(!!c&&(B.KNOWN_EVENTS.has(c)||Pe.has(c))||B.KNOWN_EVENTS.has(l)||Pe.has(l)||o.has(l)))continue;let d=this.matchEventParamPhrase(n,u+1).len,m=n[u+1+d];if(m&&(m.kind==="particle"||m.kind==="keyword")&&i.has(m.value)||this.matchEventMarkerPhrase(n,u+1+d,t)>0)return true}return false}tryScrollModifiers(e,t,i){let n=m=>m?.value.toLowerCase()??"",a=-1,o=-1;for(let m=0;m<e.length&&a<0;m++){let f=n(e[m])==="the"?m+1:m;Zi.has(n(e[f]))&&(Zi.has(n(e[f+1]))&&f++,!(n(e[f+1])!=="of"||!e[f+2])&&(a=m,o=f+1));}let u=a<0?e.findIndex(m=>hy.has(n(m))):-1;if(a<0&&u<0)return null;let s=a>=0?a:u,l=a>=0?o:u,c=t.slice(0,e[s].position.start).trimEnd(),p=t.slice(e[l].position.end).trimStart(),d=c?c.length+1:0;try{let m=this.parse(c?`${c} ${p}`:p,i),f=[],y=E=>{if(!E)return;E.kind==="command"&&(E.action==="go"||E.action==="scroll")&&f.push(E);let k=E;for(let w of At){let g=k[w];Array.isArray(g)&&g.forEach(A=>y(A));}};y(m??void 0);let h=E=>E.roles.get("destination")?.position?.start??-1,v=E=>f.filter(k=>h(k)>=0&&h(k)<=E).reduce((k,w)=>!k||h(w)>h(k)?w:k,void 0);if(!m)return null;if(a>=0){let E=v(d),k=E?.roles.get("destination"),w=e[o+1];if(!E||!k||!Ey(k,w))return null;let g=e.slice(a,o).map(A=>A.value.toLowerCase());E.scrollPosition=g.join(" ");}else {let E=v(e[u].position.start-1);if(!E)return null;E.scrollBehavior=n(e[u]);}return m}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 o=e[a].position.start,u=(t.slice(0,e[a].position.start).trimEnd()+" "+t.slice(e[a+2].position.end).trimStart()).trim();try{let s=this.parse(u,i),l=[],c=m=>{if(!m)return;m.kind==="command"&&m.action==="fetch"&&l.push(m);let f=m;for(let y of At){let h=f[y];Array.isArray(h)&&h.forEach(v=>c(v));}};c(s??void 0);let p=m=>m.roles.get("source")?.position?.start??-1,d=l.filter(m=>p(m)>=0&&p(m)<o).reduce((m,f)=>!m||p(f)>p(m)?f:m,void 0);return !s||!d?null:(d.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 o=T(i)?.roleMarkers?.destination,u=new Set([o?.primary,...o?.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 p=this.parse(c,i);if(!p)continue;let d=[],m=E=>{if(!E)return;E.kind==="command"&&d.push(E);let k=E;for(let w of At){let g=k[w];Array.isArray(g)&&g.forEach(A=>m(A));}};m(p);let f=E=>E.roles.get("destination")?.position?.start??-1,y=d.filter(E=>E.action==="tell"&&f(E)>=0&&f(E)<l).reduce((E,k)=>!E||f(k)>f(E)?k:E,void 0);if(!y)continue;let h=y.roles.get("destination")?.position?.end??-1;if(h<0||!e.filter(E=>E.position.start>=h&&E.position.start<l).every(E=>n(E)||u.has(E.value)))continue;return p}catch{continue}}return null}tryLoopIndex(e,t,i){let n=l=>l?.value.toLowerCase(),a=new Set;for(let l of ye(i))if(!(l.command!=="repeat"&&l.command!=="for")){for(let c of l.template.tokens)if(c.type==="literal")for(let p of [c.value,...c.alternatives??[]])a.add(p.toLowerCase());}let o=l=>a.has(l.value.toLowerCase()),u=T(i)?.roleMarkers?.style?.primary?.toLowerCase(),s=l=>n(l)==="with"||!!u&&n(l)===u;for(let l=0;l+1<e.length;l++){let c=s(e[l])&&n(e[l+1])==="index",p=n(e[l])==="index";if(!c&&!p)continue;let d=e[l].position.start,m=(t.slice(0,d).trimEnd()+" "+t.slice(e[l+1].position.end).trimStart()).trim();try{let f=this.parse(m,i);if(!f)continue;let y=[],h=b=>{if(!b)return;b.kind==="loop"&&y.push(b);let x=b;for(let S of At){let z=x[S];Array.isArray(z)&&z.forEach(C=>h(C));}};h(f);let v=b=>Math.max(-1,...[...b.roles.values()].map(x=>x.position?.end??-1).filter(x=>x<=d)),E=y.filter(b=>v(b)>=0).reduce((b,x)=>!b||v(x)>v(b)?x:b,void 0);if(!E)continue;let k=e.filter(b=>b.position.start>=v(E)&&b.position.start<d),w=E.roles.get("quantity"),g=w?.type==="literal"&&typeof w.value=="number"?w.position?.end:void 0,A=g===void 0?void 0:e.find(b=>b.position.start>=g);if(!k.every(b=>b===A||o(b)))continue;return E.indexVariable=c?"index":e[l+1].value,f}catch{continue}}return null}tryWaitAlternatives(e,t,i){let n=h=>!!h&&(h.normalized??h.value).toLowerCase()==="wait";if(!e.some(h=>n(h)))return null;let a=h=>(h.normalized??h.value).toLowerCase(),o=h=>{if(!h)return;let v=k=>B.KNOWN_EVENTS.has(k)||Pe.has(k);if(v(a(h)))return a(h);let E=dn(h.value,i);return v(E)?E:void 0},u=h=>o(h)!==void 0,s=h=>!!h&&/^\d+(?:\.\d+)?(?:ms|s)$/.test(h.value),l=T(i)?.roleMarkers?.source,c=new Set([l?.primary,...l?.alternatives??[]].filter(Boolean).map(h=>h.toLowerCase())),p=h=>!!h&&((h.normalized??"")==="source"||c.has(h.value.toLowerCase())),d=l?.position!=="after",m=T(i)?.wordOrder==="SOV",f=(h,v)=>m?n(e[v])||e[v]?.kind==="particle"&&n(e[v+1]):n(e[h-1])||n(e[h-2]),y=h=>{let v=mn(o(e[h]),i).split(/\s+/);return v.length<2||e[h].value!==v[0]?1:v.every((E,k)=>k===0||e[h+k]?.value===E)?v.length:1};for(let h=0;h<e.length;h++){if(!u(e[h]))continue;let v=[],E=h+y(h),k=this.matchEventParamPhrase(e,E);v.push(k.names.length>0?{event:o(e[h]),params:k.names}:{event:o(e[h])});let w=E+k.len;for(;Xt(e[w]??{value:""},i);){let P=e[w+1];if(u(P)){let F=w+1+y(w+1),N=this.matchEventParamPhrase(e,F);v.push(N.names.length>0?{event:o(P),params:N.names}:{event:o(P)}),w=F+N.len;}else if(s(P))v.push({duration:P.value}),w+=2;else break}let g=w,A,b;if(d&&p(e[w])&&e[w+1]?(A=[w,w+1],b=e[w+1]):!d&&e[w]&&p(e[w+1])&&(A=[w,w+1],b=e[w]),!(v.length>1||k.names.length>0||!!A))continue;let S=A?A[1]+1:g;if(!f(h,S))continue;let z=[];g>E&&z.push([e[E-1].position.end,e[g-1].position.end]),A&&z.push([e[A[0]].position.start,e[A[1]].position.end]),z.sort((P,F)=>P[0]-F[0]);let C="",D=0;for(let[P,F]of z)C+=t.slice(D,P)+" ",D=F;C=(C+t.slice(D)).replace(/\s+/g," ").trim();let R=v[0],_=0;for(let P=0;P<h;P++)o(e[P])===R.event&&f(P,P+1)&&_++;try{let P=this.parse(C,i),F=[],N=M=>{if(!M)return;let j=M.roles?.get("event"),ne=j?.type==="expression"?j.raw:j&&"value"in j?String(j.value):void 0;M.kind==="command"&&M.action==="wait"&&ne?.toLowerCase()===R.event&&F.push(M);let Ee=M;for(let H of At){let L=Ee[H];Array.isArray(L)&&L.forEach(I=>N(I));}};N(P??void 0);let K=F[_];if(!P||!K)continue;return K.waitAlternatives=v,b&&(K.waitSource=gy(b)),P}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)&&!Pe.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 o=e[n].kind;if(o!=="identifier"&&o!=="keyword"||!/^[A-Za-z_$][\w$]*$/.test(a))break;let u=(e[n].normalized??a).toLowerCase();if(o==="keyword"&&vy.has(u))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=Re[t],o=new Set;if(a)for(let w of Object.keys(a))o.add(w.toLowerCase());let u=n.length-2,s=n[u];if(!(s.kind==="keyword"&&s.normalized?.toLowerCase()==="on"))return null;let c=n[n.length-1],p=c.value.toLowerCase(),d=c.normalized?.toLowerCase();if(!(!!d&&B.KNOWN_EVENTS.has(d)||B.KNOWN_EVENTS.has(p)||o.has(p)))return null;let f=d&&B.KNOWN_EVENTS.has(d)?d:a?.[p]??p,y=n.slice(0,u);if(y.length===0)return null;let h=i.filter(w=>w.command!=="on"),v=new me(y,t),E=this.coverageMark(),k=this.parseBodyWithClauses(v,h,t);return k.length===0?(this.coverageRollback(E),null):Ct({type:"literal",value:f},k,void 0,{sourceLanguage:t,confidence:.75})}tryMidStreamEventExtraction(e,t,i){let n=Z(e,t).tokens;if(n.length<3)return null;let a=Re[t],o=new Set;if(a)for(let u of Object.keys(a))o.add(u.toLowerCase());for(let u=0;u<n.length-1;u++){let s=n[u];if(!(s.kind==="keyword"&&s.normalized?.toLowerCase()==="on"))continue;let c=n[u+1],p=c.value.toLowerCase(),d=c.normalized?.toLowerCase();if(!(!!d&&B.KNOWN_EVENTS.has(d)||B.KNOWN_EVENTS.has(p)||o.has(p)))continue;let f=d&&B.KNOWN_EVENTS.has(d)?d:a?.[p]??p,y=n.filter((w,g)=>g!==u&&g!==u+1);if(y.length===0)return null;let h=i.filter(w=>w.command!=="on"),v=new me(y,t),E=this.coverageMark(),k=this.parseBodyWithClauses(v,h,t);return k.length===0?(this.coverageRollback(E),null):Ct({type:"literal",value:f},k,void 0,{sourceLanguage:t,confidence:.75})}return null}trySOVEventExtraction(e,t,i){let n=B.SOV_EVENT_MARKERS[t];if(!n)return null;let o=Z(e,t).tokens,u=Re[t],s=new Set;if(u)for(let A of Object.keys(u))s.add(A.toLowerCase());let l=B.SOV_SOURCE_MARKERS[t],c=-1,p="",d="",m=1,f=[];for(let A=0;A<o.length;A++){let b=o[A],x=b.value.toLowerCase(),S=x,z="",C=x.indexOf("[");C>0&&(S=x.slice(0,C),z=b.value.slice(C));let D=b.normalized?.toLowerCase(),R=D&&(B.KNOWN_EVENTS.has(D)||Pe.has(D)),_=s.has(x)||s.has(S),P=B.KNOWN_EVENTS.has(S)||Pe.has(S);if(R||_||P){let F=o[A-1];if(F&&(F.normalized??F.value).toLowerCase()==="event")continue;let N;R?N=D:_?N=u?.[x]??u?.[S]??S:N=S;let K=this.matchEventParamPhrase(o,A+1);if(n.size>0){let M=1+K.len,j=o[A+M];j&&j.kind==="selector"&&j.value.startsWith("[")&&(M+=1);let ne=o[A+M];if(ne&&(ne.kind==="particle"||ne.kind==="keyword")&&n.has(ne.value)){c=A,p=N,d=z||(M===K.len+2?o[A+M-1].value:""),m=M+1,f=K.names;break}}else {c=A,p=N,d=z,m=1+K.len+this.matchEventMarkerPhrase(o,A+1+K.len,t),f=K.names;break}}}if(c===-1){let A=new Set(i.filter(b=>b.command!=="on").map(b=>b.command));for(let b=0;b<o.length;b++){let x=o[b];if(x.kind==="identifier"&&!x.value.startsWith("`")&&Cy.test(x.value))if(n.size>0){let S=1,z=o[b+1];z&&z.kind==="selector"&&z.value.startsWith("[")&&(S=2);let C=o[b+S];if(C&&(C.kind==="particle"||C.kind==="keyword")&&n.has(C.value)){c=b,p=x.value,d=S===2?o[b+1].value:"",m=S+1;break}}else {let S=this.matchEventMarkerPhrase(o,b+1,t);if(S>0){c=b,p=x.value,d="",m=1+S;break}let z=o[b+1];if(z&&z.kind==="keyword"&&z.normalized!=null&&A.has(z.normalized)){c=b,p=x.value,d="",m=1;break}}}}if(c===-1)return null;let y=new Set;for(let A=c;A<c+m;A++)y.add(A);if(l){let A=c+m;if(A<o.length){let b=o[A];if((b.kind==="particle"||b.kind==="keyword")&&l.markers.has(b.value))y.add(A);else if(this.isStrippableSourceRef(b,l.windowTokens)){let x=o[A+1];x&&(x.kind==="particle"||x.kind==="keyword")&&l.markers.has(x.value)&&(y.add(A),y.add(A+1));}}if(c>=2){let b=o[c-1];(b.kind==="particle"||b.kind==="keyword")&&l.markers.has(b.value)&&this.isStrippableSourceRef(o[c-2],l.windowTokens)&&(y.add(c-2),y.add(c-1));}for(let b=0;b<c;b++){let x=o[b],S=x.value.toLowerCase(),z=x.normalized?.toLowerCase();if(l.windowTokens.has(S)||z&&l.windowTokens.has(z)){y.add(b);break}}}let h=o.filter((A,b)=>!y.has(b));if(h.length===0)return null;let v=i.filter(A=>A.command!=="on"),E=new me(h,t),k=this.coverageMark(),w=this.parseBodyWithClauses(E,v,t);if(w.length===0)return this.coverageRollback(k),null;let g={sourceLanguage:t,confidence:.75};return d&&(g.keyFilter=d),Ct(B.isEnEventKeyword(p)?{type:"literal",value:p}:{type:"expression",raw:p},w,void 0,g,f)}profileKeywordMatches(e,t,i){let n=T(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=T(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)&&_e(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=Ud(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=T(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 p=e.peek(n+1),d=!!p&&c.position?.end!==void 0&&c.position.end===p.position?.start&&this.profileKeywordMatches(t,"js",`${c.value}${p.value}`.toLowerCase()),m=e.peek(n+(d?2:1));if(n>0&&m&&this.isJsBlockTerminator(m.value,t)){a=n;break}}n++;}if(a<=0)return null;let o=[];for(let c=0;c<a;c++){let p=e.peek(c);p&&o.push(p);}let u=o[o.length-1];if(u&&this.isPatientMarker(u,t)&&o.pop(),o.length===0)return e.reset(i),null;let s=this.rawJsBody(o);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(),fe("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 o=e.peek();o&&i.position?.end!==void 0&&i.position.end===o.position?.start&&this.profileKeywordMatches(t,"js",`${i.value}${o.value}`.toLowerCase())&&e.advance();let u=e.peek();u&&this.isPatientMarker(u,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 fe("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 o=n.slice(t,i),u=s=>s.replace(/\s+/g,"");if(u(o)===u(e.map(s=>s.value).join("")))return o.trim()}let a="";for(let o=0;o<e.length;o++){let u=e[o-1],s=u?.position?.end!==void 0&&e[o].position?.start===u.position.end;o>0&&!s&&(a+=" "),a+=e[o].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(),o=this.tryParseConditionalBlock(e,t,i,true);if(!o||o.kind!=="conditional")return e.reset(a),null;let u=o;if(u.elseBranch&&u.elseBranch.length>0)return e.reset(a),null;let s=u.roles.get("condition");return s?[fe("unless",{condition:s},{sourceLanguage:i,patternId:`unless-${i}-guard`,confidence:1}),...u.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"))&&!_e(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&&zr(t))}tryParseConditionalBlock(e,t,i,n=false){let a=e.peek();if(!a)return null;let o=(a.normalized??a.value).toLowerCase();if(!this.isIfKeyword(o,i)&&!(n&&this.isUnlessKeyword(o,i)))return null;let u=e.mark(),s=this.coverageMark();e.advance();let l=e.tokens,c=e.position(),p=[],d=0;for(;!e.isAtEnd();){let z=e.peek();if(!z)break;if(p.length>0&&this.opensNestedBlock(z,Ut(p,p.length),i)){d++,p.push(z),e.advance();continue}if(this.isBlockEndToken(z,ze(e.tokens,e.position()),i)){if(d===0){e.advance();break}d--,p.push(z),e.advance();continue}p.push(z),e.advance();}if(p.length===0)return e.reset(u),this.coverageRollback(s),null;let m=T(i),f=m?.wordOrder==="SOV"?B.buildVerbLookup(m):null,y=0,h=0,v=[];for(;y<p.length;y++){let z=p[y],C=(z.normalized??z.value).toLowerCase();if(y>0&&(this.isIfKeyword(C,i)||this.isUnlessKeyword(C,i))?h++:this.isBlockEndToken(z,ze(l,c+y),i)&&h--,h===0&&this.isThenAt(z,ze(l,c+y),i)){y++;break}if(h===0&&v.length>0){let D=(z.normalized??z.value).toLowerCase(),R=Lm(p[y-1],z,v.length===1,i),_=f!==null&&f.has(z.value.toLowerCase())&&!Qn.has(D),P=/^\.[a-zA-Z_]\w*$/.test(z.value)&&p[y-1].position?.end!==void 0&&z.position?.start!==void 0&&p[y-1].position.end===z.position.start;if(!B.CONDITION_OPERATORS.has(D)&&!P&&(!R||_)&&(this.tokensBeginCommand(p.slice(y),t,i)||this.sovCommandStartsAt(p.slice(y),f)))break}v.push(z);}if(v.length===0)return e.reset(u),this.coverageRollback(s),null;let k=[],w=[],g=false,A=0;for(;y<p.length;y++){let z=p[y];if(this.opensNestedBlock(z,Ut(p,y),i)?A++:this.isBlockEndToken(z,ze(l,c+y),i)&&A--,A===0&&!g&&this.isElseKeyword(z.value,i)){g=true;continue}(g?w:k).push(z);}let b={type:"expression",raw:this.joinTokenText(v,i)},x=this.parseBranch(k,t,i),S=w.length>0?this.parseBranch(w,t,i):void 0;return x.length===0&&(!S||S.length===0)?(e.reset(u),this.coverageRollback(s),null):Qp(b,x,S,{sourceLanguage:i,patternId:`conditional-${i}-folded`,confidence:1})}joinTokenText(e,t){return Oe(e,T(t))}tokensBeginCommand(e,t,i){if(e.length===0)return false;let n=new me(e,i);return Se.matchBest(n,t)!==null}sovCommandStartsAt(e,t){if(!t)return false;let i=u=>t.has(u.value.toLowerCase())||!!u.normalized&&t.has(u.normalized.toLowerCase()),n=u=>u.kind==="identifier"||u.kind==="selector"||u.kind==="literal"||u.kind==="reference",a=0,o=0;for(;a+1<e.length;){let u=e[a],s=e[a+1];if(!n(u)||s.kind!=="particle")break;o+=1,a+=2;let l=e[a];if(o>=1&&l&&i(l))return true}return false}parseBranch(e,t,i){if(e.length===0)return [];let n=new me(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 o=n[0].value.toLowerCase(),u=y=>n[y]?.value.toLowerCase(),s=y=>!!n[y]&&n[y].kind!=="selector";if(o==="on"&&u(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(o==="first"&&s(1))return {modifiers:{once:true,onceAsFirst:true},remainingInput:e.slice(n[1].position.start)};let l=B.STANDALONE_MODIFIERS[o];if(!l)return {modifiers:null,remainingInput:null};let c={},p=1;if(l==="once")c.once=true;else {let y=1;if(y<n.length){let h=n[y],v=n[y+1],E=h.kind==="identifier"&&v?.kind==="literal"&&/^\d+(ms|s|m)?$/.test(v.value);(h.kind==="keyword"||h.kind==="particle"||E)&&(y++,p++);}if(y<n.length){let h=n[y];if(h.kind==="literal"){let v=h.value.match(/^(\d+)(ms|s|m)?$/);if(v){let E=parseInt(v[1],10),k=v[2]||"ms";k==="s"?E*=1e3:k==="m"&&(E*=6e4),c[l]=E,p=y+1;}}}c[l]||(c[l]=l==="debounce"?300:100);}let d=n.slice(p);if(d.length===0)return {modifiers:null,remainingInput:null};let m=d[0].position.start,f=e.slice(m);return {modifiers:c,remainingInput:f}}stripAsyncModifier(e,t){let i=T(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,o=a.findIndex(l=>n.has(l.value.toLowerCase()));if(o===-1)return {remainingInput:null};let u=a[o],s=(e.slice(0,u.position.start)+e.slice(u.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 p=c.kind;if(p==="selector"||p==="literal"||p==="reference"||p==="conjunction")break}if(a===-1)continue;let o=i[n].position.start,u=i[a].position.end,s=(e.slice(0,o)+e.slice(u)).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 Ne(e.value);let t=(e.normalized??e.value).toLowerCase();return Le(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 o=n(e),u=T(i)?.roleMarkers?.source,s=new Set;u?.primary&&s.add(u.primary),u?.alternatives?.forEach(c=>s.add(c));let l=Z(t,i).tokens;for(let c=0;c<l.length;c++){let p=l[c];if(p.normalized!=="source"&&!s.has(p.value))continue;let d=u?.position==="after"?c-1:c+1,m=l[d];if(!m||m.kind!=="identifier"&&m.kind!=="keyword")continue;let f=Math.min(p.position.start,m.position.start),y=Math.max(p.position.end,m.position.end),h=t.slice(f,y).replace(/\s+/g," ").trim();if(!a.some(E=>E===h||E.includes(h)))continue;let v=(t.slice(0,f).trimEnd()+" "+t.slice(y).trimStart()).trim();if(!(!v||v===t))try{let E=this.parse(v,i);if(!E||E.kind!=="event-handler")continue;let k=Zt(E);if(n(k)<o)return {node:{...k,eventModifiers:{...k.eventModifiers,from:B.sourceNounValue(m)}},input:v}}catch{}}return null}reclaimEventCompoundTail(e,t,i){let n=B.unconsumedSpans(e);if(n.length===0)return null;let a=Re[i];if(!a)return null;let o=e.roles,u=o.get("event"),s=u?.type==="literal"&&typeof u.value=="string"?u.value:null;if(!s)return null;let l=p=>p.replace(/\s+/g," ").trim(),c=Z(t,i).tokens;for(let p of n)for(let d=1;d<c.length;d++)for(let m=d;m<c.length;m++){let f=l(t.slice(c[d].position.start,c[m].position.end));if(f.length>p.length)break;if(f!==p)continue;let y=c[d-1];if((a[y.value]??y.normalized)!==s)break;let v=l(t.slice(y.position.start,c[m].position.end)),E=a[v];if(!E)break;return o.set("event",{type:"literal",value:E,dataType:"string"}),{node:B.withoutSpanDiagnostics(e,p),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 o=l=>l.replace(/\s+/g," ").trim(),u=B.droppedTokenCount(e),s=Z(t,i).tokens;for(let l=0;l+1<s.length;l++){let c=s[l],p=s[l+1];if(!a.some(f=>c.value.toLowerCase()===f)||!B.RESPONSE_TYPE_WORDS.has(p.value.toLowerCase()))continue;let d=o(t.slice(c.position.start,p.position.end));if(!n.includes(d))continue;let m=(t.slice(0,c.position.start).trimEnd()+" "+t.slice(p.position.end).trimStart()).trim();if(!(!m||m===t))try{let f=this.parse(m,i);if(!f||f.kind!=="event-handler")continue;let y=Zt(f);if(B.droppedTokenCount(y)>=u)continue;let h=B.findResponseTypeTarget(y);if(!h)continue;return h.roles.set("responseType",{type:"expression",raw:p.value}),{node:y,input:m}}catch{}}return null}static findResponseTypeTarget(e){let t=null,i=n=>{if(!n||typeof n!="object"||t)return;if(n.kind==="command"){let o=n;if(ue(o.action)?.roles.some(s=>s.role==="responseType"&&!s.required)&&!o.roles.has("responseType")){t=o;return}}let a=n;for(let o of ["body","statements","thenBranch","elseBranch","commands"]){let u=a[o];Array.isArray(u)&&u.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=T(i)?.roleMarkers?.destination,o=new Set;if(a?.primary&&o.add(a.primary),a?.alternatives?.forEach(l=>o.add(l)),o.size===0)return null;let u=l=>l.replace(/\s+/g," ").trim(),s=Z(t,i).tokens;for(let l=0;l+1<s.length;l++){let c=s[l],p=s[l+1],d=o.has(c.value)&&p.normalized==="me",m=c.normalized==="me"&&o.has(p.value);if(!d&&!m)continue;let f=u(t.slice(c.position.start,p.position.end));if(!n.includes(f))continue;let y=false,h=v=>{if(!v||typeof v!="object"||y)return;if(v.kind==="command"){let k=v.roles.get("destination");if(k?.type==="reference"&&k.value==="me"){y=true;return}}let E=v;for(let k of ["body","statements","thenBranch","elseBranch","commands"]){let w=E[k];Array.isArray(w)&&w.forEach(g=>h(g));}};if(h(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(!Xt(a,t)){e.reset(n);break}e.advance();let o=e.peek();if(!o){e.reset(n);break}let u=o.normalized||o.value;e.advance(),i.push({type:"literal",value:u});}return i}};be.coverageMarkerSurfaces=new Map;be.LEAKED_RENDER_MARKERS={hi:["\u0915\u0947","\u0930\u0942\u092A","\u092E\u0947\u0902"],tr:["olarak"],qu:["hina"]};be.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"]};be.AS_MARKERS_AFTER={ko:[["\uB85C"],["\uC73C\uB85C"]],qu:[["hina"]],tr:[["olarak"]],hi:[["\u0915\u0947","\u0930\u0942\u092A","\u092E\u0947\u0902"]]};be.enEventKeywordCache=new Map;be.KNOWN_EVENTS=new Set(["click","dblclick","input","change","submit","keydown","keyup","keypress","mouseover","mouseout","mousedown","mouseup","focus","blur","load","scroll","resize","contextmenu"]);be.RESPONSE_TYPE_WORDS=new Set(["json","text","html","xml","blob","arraybuffer","formdata","response"]);be.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"])};be.SOV_EVENT_MARKER_PHRASES={ko:[["\uD560","\uB54C"],["\uD560\uB54C"]]};be.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"])}};be.CONDITION_OPERATORS=new Set(["matches","match","contains","exists","has","have","equals","includes"]);be.STANDALONE_MODIFIERS={once:"once",debounced:"debounce",debounce:"debounce",throttled:"throttle",throttle:"throttle"};var Ay=be,xy=new Ay;function Dy(r,e){return xy.parse(r,e)}var Sy=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 Sy;function By(r){return /[\u00e1\u00e9\u00ed\u00f3\u00fa\u00fc\u00f1\u00c1\u00c9\u00cd\u00d3\u00da\u00dc\u00d1]/.test(r)}var Ty=[{ending:"ando",stem:"ar",confidence:.88,type:"gerund"},{ending:"ado",stem:"ar",confidence:.88,type:"participle"},{ending:"ada",stem:"ar",confidence:.88,type:"participle"},{ending:"ados",stem:"ar",confidence:.88,type:"participle"},{ending:"adas",stem:"ar",confidence:.88,type:"participle"},{ending:"o",stem:"ar",confidence:.75,type:"present"},{ending:"as",stem:"ar",confidence:.82,type:"present"},{ending:"a",stem:"ar",confidence:.75,type:"present"},{ending:"amos",stem:"ar",confidence:.85,type:"present"},{ending:"\xE1is",stem:"ar",confidence:.85,type:"present"},{ending:"ais",stem:"ar",confidence:.82,type:"present"},{ending:"an",stem:"ar",confidence:.8,type:"present"},{ending:"\xE9",stem:"ar",confidence:.85,type:"past"},{ending:"aste",stem:"ar",confidence:.88,type:"past"},{ending:"\xF3",stem:"ar",confidence:.82,type:"past"},{ending:"amos",stem:"ar",confidence:.85,type:"past"},{ending:"asteis",stem:"ar",confidence:.88,type:"past"},{ending:"aron",stem:"ar",confidence:.88,type:"past"},{ending:"aba",stem:"ar",confidence:.88,type:"past"},{ending:"abas",stem:"ar",confidence:.88,type:"past"},{ending:"\xE1bamos",stem:"ar",confidence:.88,type:"past"},{ending:"abamos",stem:"ar",confidence:.85,type:"past"},{ending:"abais",stem:"ar",confidence:.88,type:"past"},{ending:"aban",stem:"ar",confidence:.88,type:"past"},{ending:"e",stem:"ar",confidence:.72,type:"subjunctive"},{ending:"es",stem:"ar",confidence:.78,type:"subjunctive"},{ending:"emos",stem:"ar",confidence:.82,type:"subjunctive"},{ending:"\xE9is",stem:"ar",confidence:.85,type:"subjunctive"},{ending:"eis",stem:"ar",confidence:.82,type:"subjunctive"},{ending:"en",stem:"ar",confidence:.78,type:"subjunctive"},{ending:"a",stem:"ar",confidence:.75,type:"imperative"},{ending:"ad",stem:"ar",confidence:.85,type:"imperative"},{ending:"ar",stem:"ar",confidence:.92,type:"dictionary"}],Fy=[{ending:"iendo",stem:"er",confidence:.88,type:"gerund"},{ending:"ido",stem:"er",confidence:.85,type:"participle"},{ending:"ida",stem:"er",confidence:.85,type:"participle"},{ending:"idos",stem:"er",confidence:.85,type:"participle"},{ending:"idas",stem:"er",confidence:.85,type:"participle"},{ending:"o",stem:"er",confidence:.72,type:"present"},{ending:"es",stem:"er",confidence:.78,type:"present"},{ending:"e",stem:"er",confidence:.72,type:"present"},{ending:"emos",stem:"er",confidence:.85,type:"present"},{ending:"\xE9is",stem:"er",confidence:.85,type:"present"},{ending:"eis",stem:"er",confidence:.82,type:"present"},{ending:"en",stem:"er",confidence:.78,type:"present"},{ending:"\xED",stem:"er",confidence:.85,type:"past"},{ending:"iste",stem:"er",confidence:.88,type:"past"},{ending:"i\xF3",stem:"er",confidence:.85,type:"past"},{ending:"io",stem:"er",confidence:.82,type:"past"},{ending:"imos",stem:"er",confidence:.85,type:"past"},{ending:"isteis",stem:"er",confidence:.88,type:"past"},{ending:"ieron",stem:"er",confidence:.88,type:"past"},{ending:"\xEDa",stem:"er",confidence:.88,type:"past"},{ending:"ia",stem:"er",confidence:.85,type:"past"},{ending:"\xEDas",stem:"er",confidence:.88,type:"past"},{ending:"ias",stem:"er",confidence:.85,type:"past"},{ending:"\xEDamos",stem:"er",confidence:.88,type:"past"},{ending:"iamos",stem:"er",confidence:.85,type:"past"},{ending:"\xEDais",stem:"er",confidence:.88,type:"past"},{ending:"iais",stem:"er",confidence:.85,type:"past"},{ending:"\xEDan",stem:"er",confidence:.88,type:"past"},{ending:"ian",stem:"er",confidence:.85,type:"past"},{ending:"er",stem:"er",confidence:.92,type:"dictionary"}],Py=[{ending:"iendo",stem:"ir",confidence:.88,type:"gerund"},{ending:"ido",stem:"ir",confidence:.85,type:"participle"},{ending:"ida",stem:"ir",confidence:.85,type:"participle"},{ending:"idos",stem:"ir",confidence:.85,type:"participle"},{ending:"idas",stem:"ir",confidence:.85,type:"participle"},{ending:"o",stem:"ir",confidence:.72,type:"present"},{ending:"es",stem:"ir",confidence:.78,type:"present"},{ending:"e",stem:"ir",confidence:.72,type:"present"},{ending:"imos",stem:"ir",confidence:.85,type:"present"},{ending:"\xEDs",stem:"ir",confidence:.85,type:"present"},{ending:"is",stem:"ir",confidence:.82,type:"present"},{ending:"en",stem:"ir",confidence:.78,type:"present"},{ending:"\xED",stem:"ir",confidence:.85,type:"past"},{ending:"iste",stem:"ir",confidence:.88,type:"past"},{ending:"i\xF3",stem:"ir",confidence:.85,type:"past"},{ending:"io",stem:"ir",confidence:.82,type:"past"},{ending:"imos",stem:"ir",confidence:.85,type:"past"},{ending:"isteis",stem:"ir",confidence:.88,type:"past"},{ending:"ieron",stem:"ir",confidence:.88,type:"past"},{ending:"\xEDa",stem:"ir",confidence:.88,type:"past"},{ending:"ia",stem:"ir",confidence:.85,type:"past"},{ending:"\xEDas",stem:"ir",confidence:.88,type:"past"},{ending:"ias",stem:"ir",confidence:.85,type:"past"},{ending:"\xEDamos",stem:"ir",confidence:.88,type:"past"},{ending:"iamos",stem:"ir",confidence:.85,type:"past"},{ending:"\xEDais",stem:"ir",confidence:.88,type:"past"},{ending:"iais",stem:"ir",confidence:.85,type:"past"},{ending:"\xEDan",stem:"ir",confidence:.88,type:"past"},{ending:"ian",stem:"ir",confidence:.85,type:"past"},{ending:"ir",stem:"ir",confidence:.92,type:"dictionary"}],Ry=[...Ty,...Fy,...Py].sort((r,e)=>e.ending.length-r.ending.length),ga=class extends di{constructor(){super({language:"es",minWordLength:3,minStemLength:2,endings:Ry,reflexiveSuffixes:["se","me","te","nos","os"],infinitiveEndings:["ar","er","ir"]});}isNormalizable(r){if(r.length<3)return false;let e=r.toLowerCase();if(e.endsWith("ar")||e.endsWith("er")||e.endsWith("ir")||e.endsWith("ando")||e.endsWith("iendo")||e.endsWith("ado")||e.endsWith("ido")||e.endsWith("arse")||e.endsWith("erse")||e.endsWith("irse"))return true;for(let t of r)if(By(t))return true;return false}};new ga;var ka={code:"es",name:"Spanish",nativeName:"Espa\xF1ol",regions:["western","priority"],direction:"ltr",script:"latin",wordOrder:"SVO",markingStrategy:"preposition",usesSpaces:true,defaultVerbForm:"infinitive",verb:{position:"start",subjectDrop:true},references:{me:"yo",it:"ello",you:"t\xFA",result:"resultado",event:"evento",target:"objetivo",body:"cuerpo",document:"documento",window:"ventana",detail:"detalle"},possessive:{marker:"de",markerPosition:"before-property",usePossessiveAdjectives:true,specialForms:{me:"mi",it:"su",you:"tu"},keywords:{mi:"me",tu:"you",su:"it"}},roleMarkers:{destination:{primary:"en",alternatives:["sobre","a","hacia"],position:"before"},source:{primary:"de",alternatives:["desde"],position:"before"},patient:{primary:"",position:"before"},style:{primary:"con",position:"before"}},keywords:{toggle:{primary:"alternar",alternatives:["conmutar","toggle"],normalized:"toggle"},add:{primary:"agregar",alternatives:["a\xF1adir"],normalized:"add"},remove:{primary:"quitar",alternatives:["eliminar","remover","sacar","borrar"],normalized:"remove"},put:{primary:"poner",alternatives:["colocar","pon"],normalized:"put"},append:{primary:"anexar",normalized:"append"},prepend:{primary:"anteponer",normalized:"prepend"},take:{primary:"tomar",normalized:"take"},make:{primary:"hacer",alternatives:["crear"],normalized:"make"},clone:{primary:"clonar",alternatives:["duplicar"],normalized:"clone"},swap:{primary:"intercambiar",alternatives:["permutar"],normalized:"swap"},morph:{primary:"transformar",alternatives:["convertir"],normalized:"morph"},set:{primary:"establecer",alternatives:["fijar","definir","establece"],normalized:"set"},get:{primary:"obtener",alternatives:["conseguir","obt\xE9n"],normalized:"get"},increment:{primary:"incrementar",alternatives:["aumentar"],normalized:"increment"},decrement:{primary:"decrementar",alternatives:["disminuir"],normalized:"decrement"},log:{primary:"registrar",alternatives:["imprimir"],normalized:"log"},show:{primary:"mostrar",alternatives:["ense\xF1ar","muestra"],normalized:"show"},hide:{primary:"ocultar",alternatives:["esconder"],normalized:"hide"},transition:{primary:"transici\xF3n",alternatives:["animar"],normalized:"transition"},on:{primary:"en",alternatives:["al"],normalized:"on"},trigger:{primary:"disparar",alternatives:["activar"],normalized:"trigger"},send:{primary:"enviar",alternatives:["env\xEDa"],normalized:"send"},focus:{primary:"enfoque",alternatives:["enfocar"],normalized:"focus"},blur:{primary:"p\xE9rdida de foco",alternatives:["perdida de foco","desenfoque","desenfocar"],normalized:"blur"},open:{primary:"abrir",normalized:"open"},close:{primary:"cerrar",normalized:"close"},select:{primary:"seleccionar",normalized:"select"},clear:{primary:"limpiar",normalized:"clear"},reset:{primary:"reiniciar",alternatives:["restablecer"],normalized:"reset"},breakpoint:{primary:"punto-interrupci\xF3n",alternatives:["punto-interrupcion"],normalized:"breakpoint"},click:{primary:"clic",alternatives:["hacer clic","click"],normalized:"click"},resize:{primary:"cambio de tama\xF1o",alternatives:["cambio de tamano","redimensionar"],normalized:"resize"},hover:{primary:"sobrevolar",alternatives:["pasar por encima"],normalized:"hover"},submit:{primary:"env\xEDo",alternatives:["envio","someter"],normalized:"submit"},input:{primary:"entrada",alternatives:["introducir"],normalized:"input"},change:{primary:"cambio",alternatives:["cambiar"],normalized:"change"},load:{primary:"carga",alternatives:["cargar"],normalized:"load"},scroll:{primary:"desplazamiento",alternatives:["desplazar"],normalized:"scroll"},keydown:{primary:"tecla pulsada",alternatives:["tecla presionada","tecla abajo"],normalized:"keydown"},keyup:{primary:"tecla soltada",alternatives:["tecla liberada","tecla arriba"],normalized:"keyup"},mouseover:{primary:"rat\xF3n encima",alternatives:["raton encima","mouse encima"],normalized:"mouseover"},mouseout:{primary:"rat\xF3n fuera",alternatives:["raton fuera","mouse fuera"],normalized:"mouseout"},mousedown:{primary:"rat\xF3n pulsado",alternatives:["raton pulsado","mouse presionado","rat\xF3n abajo","raton abajo","rat\xF3nabajo"],normalized:"mousedown"},mouseup:{primary:"rat\xF3n soltado",alternatives:["raton soltado","mouse soltado","rat\xF3n arriba","raton arriba","rat\xF3narriba"],normalized:"mouseup"},go:{primary:"ir",alternatives:["navegar","ve"],normalized:"go"},push:{primary:"empujar",alternatives:["push"],normalized:"push"},replace:{primary:"reemplazar",alternatives:["sustituir"],normalized:"replace"},process:{primary:"procesar",normalized:"process"},wait:{primary:"esperar",normalized:"wait"},fetch:{primary:"buscar",alternatives:["recuperar"],normalized:"fetch"},settle:{primary:"estabilizar",normalized:"settle"},if:{primary:"si",normalized:"if"},unless:{primary:"menos",alternatives:["a menos que","salvo"],normalized:"unless"},when:{primary:"cuando",normalized:"when"},changes:{primary:"cambia",normalized:"changes"},where:{primary:"donde",normalized:"where"},else:{primary:"sino",alternatives:["de lo contrario"],normalized:"else"},repeat:{primary:"repetir",normalized:"repeat"},for:{primary:"para",normalized:"for"},while:{primary:"mientras",normalized:"while"},forever:{primary:"forever",normalized:"forever"},continue:{primary:"continuar",normalized:"continue"},halt:{primary:"detener",alternatives:["parar"],normalized:"halt"},throw:{primary:"lanzar",alternatives:["arrojar"],normalized:"throw"},call:{primary:"llamar",normalized:"call"},return:{primary:"retornar",alternatives:["devolver"],normalized:"return"},then:{primary:"entonces",alternatives:["luego"],normalized:"then"},and:{primary:"y",alternatives:["adem\xE1s","tambi\xE9n"],normalized:"and"},or:{primary:"o",normalized:"or"},not:{primary:"no",normalized:"not"},is:{primary:"es",normalized:"is"},exists:{primary:"existe",normalized:"exists"},empty:{primary:"vac\xEDo",alternatives:["vacio"],normalized:"empty"},matches:{primary:"coincide",normalized:"matches"},no:{primary:"ning\xFAn",normalized:"no"},end:{primary:"fin",alternatives:["final","terminar"],normalized:"end"},js:{primary:"js",normalized:"js"},async:{primary:"as\xEDncrono",alternatives:["asincrono"],normalized:"async"},tell:{primary:"decir",normalized:"tell"},default:{primary:"predeterminar",alternatives:["por defecto"],normalized:"default"},init:{primary:"inicio",alternatives:["inicializaci\xF3n","iniciar","inicializar"],normalized:"init"},behavior:{primary:"comportamiento",normalized:"behavior"},install:{primary:"instalar",normalized:"install"},measure:{primary:"medir",normalized:"measure"},beep:{primary:"pitido",normalized:"beep"},break:{primary:"romper",normalized:"break"},copy:{primary:"copiar",normalized:"copy"},exit:{primary:"salir",normalized:"exit"},pick:{primary:"escoger",normalized:"pick"},render:{primary:"renderizar",normalized:"render"},first:{primary:"primero",alternatives:["primera"],normalized:"first"},last:{primary:"\xFAltimo",alternatives:["ultima"],normalized:"last"},next:{primary:"siguiente",normalized:"next"},previous:{primary:"anterior",normalized:"previous"},closest:{primary:"cercano",normalized:"closest"},parent:{primary:"padre",normalized:"parent"},into:{primary:"dentro",alternatives:["adentro","dentro de"],normalized:"into"},before:{primary:"antes",alternatives:["antes de"],normalized:"before"},after:{primary:"despu\xE9s",alternatives:["despues","despu\xE9s de","despues de"],normalized:"after"},out:{primary:"fuera",alternatives:["fuera de"],normalized:"out"},until:{primary:"hasta",alternatives:["hasta que"],normalized:"until"},event:{primary:"evento",normalized:"event"},from:{primary:"de",alternatives:["desde"],normalized:"from"},connect:{primary:"conectar",alternatives:["conectarse"],normalized:"connect"},stream:{primary:"transmitir",alternatives:["flujo"],normalized:"stream"},live:{primary:"en-vivo",alternatives:["vivo","directo"],normalized:"live"},socket:{primary:"socket",alternatives:["websocket"],normalized:"socket"},bind:{primary:"vincular",alternatives:["enlazar","bind"],normalized:"bind"},intercept:{primary:"interceptar",alternatives:["intercept"],normalized:"intercept"},worker:{primary:"trabajador",alternatives:["worker"],normalized:"worker"},eventsource:{primary:"eventsource",alternatives:["fuente-de-eventos"],normalized:"eventsource"}},eventHandler:{keyword:{primary:"al",alternatives:["cuando","en"],normalized:"on"},sourceMarker:{primary:"de",alternatives:["desde"],position:"before"},eventMarker:{primary:"al",alternatives:["cuando","en"],position:"before"},temporalMarkers:["cuando","al"]}},Oy=["===","!==","->","==","!=","<=",">=","&&","||","**","+=","-=","*=","/=","+","-","*","/","=",">","<","!","&","|","%","^","~"],Ly=class{constructor(r=Oy){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}},Ny="()[]{},:;",My=class{constructor(r=Ny){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 Jr(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,o=n;for(;o<r.length;){if(r[o]==="(")a++;else if(r[o]===")"&&(a--,a===0)){o++;break}o++;}if(a!==0)break;n=o;}t=n;}return t}function ha(r,e){let t=r[e];if(t==="#"){let i=r.slice(e).match(/^#[a-zA-Z_][\w-]*/);if(!i)return null;let n=Jr(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=Jr(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=Jr(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 _y=class{constructor(){this.name="css-selector";}canExtract(r,e){let t=r[e];return t==="#"||t==="."||t==="["||t==="<"?true:t==="@"||t==="*"?ha(r,e)!==null:false}extract(r,e){let t=ha(r,e);return t?{value:t,length:t.length,metadata:{type:"css-selector"}}:null}},Iy=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}}}},$y=["http://","https://","//","./","../","/"];function jy(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 Wy(r,e){let t=r.slice(e),i=$y.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 o=jy(t,n+2);if(o!==-1){n=o;continue}}if(/\s/.test(a))break;n++;}return t.slice(0,n)}var qy=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=Wy(r,e);return t?{value:t,length:t.length,metadata:{type:"url"}}:null}},Vy=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 Ky(){return [new qy,new Iy,new Vy,new _y]}function Hy(r){return {isLetter:i=>r.test(i),isIdentifierChar:i=>/[0-9]/.test(i)||r.test(i)}}var{isLetter:Ea,isIdentifierChar:Uy}=Hy(/[a-zA-Z\u00e1\u00e9\u00ed\u00f3\u00fa\u00fc\u00f1\u00c1\u00c9\u00cd\u00d3\u00da\u00dc\u00d1]/),Gy=new Set(["en","a","de","desde","hasta","con","sin","por","para","sobre","entre","antes","despu\xE9s","despues","dentro","fuera","al","del"]),Zy=class{constructor(){this.name="spanish-keyword";}setContext(r){this.context=r;}canExtract(r,e){return Ea(r[e])}extract(r,e){if(!this.context)throw new Error("SpanishKeywordExtractor: context not set");let t=this.tryMultiWordPhrase(r,e);return t||this.extractSpanishWord(r,e)}tryMultiWordPhrase(r,e){if(!this.context)return null;let t=["de lo contrario","de lo normal","por defecto","de nuevo","de otra manera"];for(let i of t)if(r.slice(e,e+i.length).toLowerCase()===i.toLowerCase()){let a=e+i.length;if(a>=r.length||Ye(r[a])||!Ea(r[a])){let o=this.context.lookupKeyword(i);return {value:r.slice(e,a),length:i.length,metadata:{normalized:o?.normalized,multiWord:true}}}}return null}extractSpanishWord(r,e){if(!this.context)return null;let t=e,i="";for(;t<r.length&&Uy(r[t]);)i+=r[t++];if(!i)return null;let n=i.toLowerCase(),a=Gy.has(n),o=this.context.lookupKeyword(i),u=o&&o.normalized!==o.native?o.normalized:void 0,s,l,c;if(!o&&this.context.normalizer){let p=this.context.normalizer.normalize(i);if(p.stem!==i&&p.confidence>=.7){let d=this.context.lookupKeyword(p.stem);d&&(s=d.normalized,l=p.stem,c=p.confidence);}}return {value:i,length:t-e,metadata:{normalized:u||s,stem:l,stemConfidence:c,isPreposition:a}}}};function Yy(){return [new Zy]}var Xy=new Set(["en","a","de","desde","hasta","con","sin","por","para","sobre","entre","antes","despu\xE9s","despues","dentro","fuera","al","del"]),Jy=[{native:"verdadero",normalized:"true"},{native:"falso",normalized:"false"},{native:"nulo",normalized:"null"},{native:"indefinido",normalized:"undefined"},{native:"segundo",normalized:"s"},{native:"segundos",normalized:"s"},{native:"milisegundo",normalized:"ms"},{native:"milisegundos",normalized:"ms"},{native:"minuto",normalized:"m"},{native:"minutos",normalized:"m"},{native:"hora",normalized:"h"},{native:"horas",normalized:"h"},{native:"m\xED",normalized:"me"},{native:"destino",normalized:"target"},{native:"inclusivo",normalized:"inclusive"},{native:"exclusivo",normalized:"exclusive"},{native:"caracteres",normalized:"characters"},{native:"aleatorio",normalized:"random"}],Qy=class extends Ve{constructor(){super(),this.language="es",this.direction="ltr",this.initializeKeywordsFromProfile(ka,Jy),this.setNormalizer(new ga),this.registerExtractors(Ky()),this.registerExtractor(new We),this.registerExtractor(new qe),this.registerExtractors(Yy()),this.registerExtractor(new Ly),this.registerExtractor(new My);}classifyToken(r){let e=r.toLowerCase();return Xy.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"}},ev=new Qy;Ge("es",ev,ka);var ba={code:"pt",name:"Portuguese",nativeName:"Portugu\xEAs",regions:["western","priority"],direction:"ltr",script:"latin",wordOrder:"SVO",markingStrategy:"preposition",usesSpaces:true,verb:{position:"start",subjectDrop:true},references:{me:"eu",it:"ele",you:"voc\xEA",result:"resultado",event:"evento",target:"alvo",body:"corpo",document:"documento",window:"janela",detail:"detalhe"},possessive:{marker:"de",markerPosition:"before-property",usePossessiveAdjectives:true,specialForms:{me:"meu",it:"seu",you:"teu"},keywords:{meu:"me",minha:"me",teu:"you",tua:"you",seu:"it",sua:"it"}},roleMarkers:{destination:{primary:"em",alternatives:["para","a"],position:"before"},source:{primary:"de",alternatives:["desde"],position:"before"},patient:{primary:"",position:"before"},style:{primary:"com",position:"before"}},keywords:{toggle:{primary:"alternar",alternatives:[],normalized:"toggle"},add:{primary:"adicionar",alternatives:["acrescentar"],normalized:"add"},remove:{primary:"remover",alternatives:["eliminar","apagar","remova"],normalized:"remove"},put:{primary:"colocar",alternatives:["p\xF4r","por","coloque"],normalized:"put"},append:{primary:"anexar",normalized:"append"},prepend:{primary:"preceder",normalized:"prepend"},take:{primary:"pegar",alternatives:["pegue"],normalized:"take"},make:{primary:"fazer",alternatives:["criar"],normalized:"make"},clone:{primary:"clonar",alternatives:[],normalized:"clone"},swap:{primary:"trocar",alternatives:["substituir"],normalized:"swap"},morph:{primary:"transformar",alternatives:["converter"],normalized:"morph"},set:{primary:"definir",alternatives:["configurar","defina"],normalized:"set"},get:{primary:"obter",alternatives:["obtenha"],normalized:"get"},increment:{primary:"incrementar",alternatives:["aumentar"],normalized:"increment"},decrement:{primary:"decrementar",alternatives:["diminuir"],normalized:"decrement"},log:{primary:"registrar",alternatives:["imprimir"],normalized:"log"},show:{primary:"mostrar",alternatives:["exibir"],normalized:"show"},hide:{primary:"ocultar",alternatives:["esconder","esconda"],normalized:"hide"},transition:{primary:"transi\xE7\xE3o",alternatives:["animar"],normalized:"transition"},on:{primary:"em",alternatives:["ao"],normalized:"on"},trigger:{primary:"disparar",alternatives:["ativar"],normalized:"trigger"},send:{primary:"enviar",normalized:"send"},focus:{primary:"foco",alternatives:["focar"],normalized:"focus"},blur:{primary:"perda de foco",alternatives:["desfocar"],normalized:"blur"},empty:{primary:"esvaziar",alternatives:["vazio"],normalized:"empty"},open:{primary:"abrir",normalized:"open"},close:{primary:"fechar",normalized:"close"},select:{primary:"selecionar",normalized:"select"},clear:{primary:"limpar",normalized:"clear"},reset:{primary:"redefinir",alternatives:["resetar"],normalized:"reset"},breakpoint:{primary:"ponto-interrup\xE7\xE3o",alternatives:["ponto-interrupcao"],normalized:"breakpoint"},go:{primary:"ir",alternatives:["navegar","v\xE1"],normalized:"go"},scroll:{primary:"rolagem",alternatives:["rolar","deslocamento","scroll"],normalized:"scroll"},push:{primary:"empurrar",alternatives:["push"],normalized:"push"},replace:{primary:"repor",alternatives:["recolocar"],normalized:"replace"},process:{primary:"processar",normalized:"process"},wait:{primary:"esperar",alternatives:["aguardar"],normalized:"wait"},fetch:{primary:"buscar",alternatives:["busque"],normalized:"fetch"},settle:{primary:"estabilizar",normalized:"settle"},if:{primary:"se",normalized:"if"},unless:{primary:"salvo",alternatives:["a_menos"],normalized:"unless"},when:{primary:"quando",normalized:"when"},changes:{primary:"muda",normalized:"changes"},where:{primary:"onde",normalized:"where"},else:{primary:"sen\xE3o",normalized:"else"},repeat:{primary:"repetir",normalized:"repeat"},for:{primary:"para",normalized:"for"},while:{primary:"enquanto",normalized:"while"},forever:{primary:"forever",normalized:"forever"},continue:{primary:"continuar",normalized:"continue"},halt:{primary:"parar",normalized:"halt"},throw:{primary:"lan\xE7ar",normalized:"throw"},call:{primary:"chamar",normalized:"call"},return:{primary:"retornar",alternatives:["devolver"],normalized:"return"},then:{primary:"ent\xE3o",alternatives:["logo"],normalized:"then"},and:{primary:"e",alternatives:["tamb\xE9m","al\xE9m disso"],normalized:"and"},matches:{primary:"corresponde",normalized:"matches"},exists:{primary:"existe",normalized:"exists"},is:{primary:"\xE9",normalized:"is"},no:{primary:"nenhum",normalized:"no"},end:{primary:"fim",alternatives:["final","t\xE9rmino"],normalized:"end"},js:{primary:"js",normalized:"js"},async:{primary:"ass\xEDncrono",normalized:"async"},tell:{primary:"dizer",normalized:"tell"},default:{primary:"padr\xE3o",normalized:"default"},init:{primary:"inicializa\xE7\xE3o",alternatives:["iniciar","inicializar"],normalized:"init"},behavior:{primary:"comportamento",normalized:"behavior"},install:{primary:"instalar",normalized:"install"},measure:{primary:"medir",normalized:"measure"},beep:{primary:"apitar",normalized:"beep"},break:{primary:"interromper",normalized:"break"},copy:{primary:"copiar",normalized:"copy"},exit:{primary:"sair",normalized:"exit"},pick:{primary:"escolher",normalized:"pick"},render:{primary:"renderizar",normalized:"render"},into:{primary:"dentro",alternatives:["dentro de"],normalized:"into"},before:{primary:"antes",normalized:"before"},after:{primary:"depois",normalized:"after"},click:{primary:"clique",alternatives:["clicar"],normalized:"click"},resize:{primary:"redimensionamento",alternatives:["redimensionar"],normalized:"resize"},hover:{primary:"sobrevoar",alternatives:["passar"],normalized:"hover"},submit:{primary:"envio",alternatives:["submeter","submiss\xE3o"],normalized:"submit"},input:{primary:"entrada",alternatives:["inser\xE7\xE3o"],normalized:"input"},change:{primary:"altera\xE7\xE3o",alternatives:["mudan\xE7a"],normalized:"change"},mousedown:{primary:"mouse pressionado",alternatives:["rato pressionado","mouse baixo","mouseBaixo"],normalized:"mousedown"},mouseup:{primary:"mouse solto",alternatives:["mouse liberado","rato libertado","mouse cima","mouseCima"],normalized:"mouseup"},until:{primary:"at\xE9",normalized:"until"},event:{primary:"evento",normalized:"event"},from:{primary:"de",alternatives:["desde"],normalized:"from"},connect:{primary:"conectar",alternatives:["conex\xE3o"],normalized:"connect"},stream:{primary:"transmitir",alternatives:["fluxo"],normalized:"stream"},live:{primary:"ao-vivo",alternatives:["vivo","direto"],normalized:"live"},socket:{primary:"soquete",alternatives:["websocket"],normalized:"socket"},bind:{primary:"vincular",alternatives:["ligar","bind"],normalized:"bind"},intercept:{primary:"interceptar",alternatives:["intercept"],normalized:"intercept"},worker:{primary:"trabalhador",alternatives:["worker"],normalized:"worker"},eventsource:{primary:"eventsource",alternatives:["fonte-de-eventos"],normalized:"eventsource"}},eventHandler:{keyword:{primary:"em",alternatives:["ao"],normalized:"on"},sourceMarker:{primary:"de",alternatives:["desde"],position:"before"},conditionalKeyword:{primary:"quando",alternatives:["se"]},eventMarker:{primary:"ao",alternatives:["no","em"],position:"before"},temporalMarkers:["quando","ao"]}};function tv(r){return /[\u00e1\u00e0\u00e2\u00e3\u00e9\u00ea\u00ed\u00f3\u00f4\u00f5\u00fa\u00fc\u00e7\u00c1\u00c0\u00c2\u00c3\u00c9\u00ca\u00cd\u00d3\u00d4\u00d5\u00da\u00dc\u00c7]/.test(r)}function rv(r){let e=r.toLowerCase();if(e.endsWith("ar")||e.endsWith("er")||e.endsWith("ir")||e.endsWith("ando")||e.endsWith("endo")||e.endsWith("indo")||e.endsWith("ado")||e.endsWith("ido")||e.endsWith("ar-se")||e.endsWith("er-se")||e.endsWith("ir-se"))return true;for(let t of r)if(tv(t))return true;return false}var za=["-se","-me","-te","-nos","-vos"],iv=[{ending:"ando",stem:"ar",confidence:.88,type:"gerund"},{ending:"ado",stem:"ar",confidence:.88,type:"participle"},{ending:"ada",stem:"ar",confidence:.88,type:"participle"},{ending:"ados",stem:"ar",confidence:.88,type:"participle"},{ending:"adas",stem:"ar",confidence:.88,type:"participle"},{ending:"o",stem:"ar",confidence:.75,type:"present"},{ending:"as",stem:"ar",confidence:.82,type:"present"},{ending:"a",stem:"ar",confidence:.75,type:"present"},{ending:"amos",stem:"ar",confidence:.85,type:"present"},{ending:"ais",stem:"ar",confidence:.85,type:"present"},{ending:"am",stem:"ar",confidence:.8,type:"present"},{ending:"ei",stem:"ar",confidence:.88,type:"past"},{ending:"aste",stem:"ar",confidence:.88,type:"past"},{ending:"ou",stem:"ar",confidence:.88,type:"past"},{ending:"\xE1mos",stem:"ar",confidence:.88,type:"past"},{ending:"amos",stem:"ar",confidence:.85,type:"past"},{ending:"astes",stem:"ar",confidence:.88,type:"past"},{ending:"aram",stem:"ar",confidence:.88,type:"past"},{ending:"ava",stem:"ar",confidence:.88,type:"past"},{ending:"avas",stem:"ar",confidence:.88,type:"past"},{ending:"\xE1vamos",stem:"ar",confidence:.88,type:"past"},{ending:"avamos",stem:"ar",confidence:.85,type:"past"},{ending:"\xE1veis",stem:"ar",confidence:.88,type:"past"},{ending:"aveis",stem:"ar",confidence:.85,type:"past"},{ending:"avam",stem:"ar",confidence:.88,type:"past"},{ending:"e",stem:"ar",confidence:.72,type:"subjunctive"},{ending:"es",stem:"ar",confidence:.78,type:"subjunctive"},{ending:"emos",stem:"ar",confidence:.82,type:"subjunctive"},{ending:"eis",stem:"ar",confidence:.82,type:"subjunctive"},{ending:"em",stem:"ar",confidence:.78,type:"subjunctive"},{ending:"a",stem:"ar",confidence:.75,type:"imperative"},{ending:"ai",stem:"ar",confidence:.85,type:"imperative"},{ending:"ar",stem:"ar",confidence:.92,type:"dictionary"}],nv=[{ending:"endo",stem:"er",confidence:.88,type:"gerund"},{ending:"ido",stem:"er",confidence:.85,type:"participle"},{ending:"ida",stem:"er",confidence:.85,type:"participle"},{ending:"idos",stem:"er",confidence:.85,type:"participle"},{ending:"idas",stem:"er",confidence:.85,type:"participle"},{ending:"o",stem:"er",confidence:.72,type:"present"},{ending:"es",stem:"er",confidence:.78,type:"present"},{ending:"e",stem:"er",confidence:.72,type:"present"},{ending:"emos",stem:"er",confidence:.85,type:"present"},{ending:"eis",stem:"er",confidence:.82,type:"present"},{ending:"em",stem:"er",confidence:.78,type:"present"},{ending:"i",stem:"er",confidence:.85,type:"past"},{ending:"este",stem:"er",confidence:.88,type:"past"},{ending:"eu",stem:"er",confidence:.88,type:"past"},{ending:"emos",stem:"er",confidence:.85,type:"past"},{ending:"estes",stem:"er",confidence:.88,type:"past"},{ending:"eram",stem:"er",confidence:.88,type:"past"},{ending:"ia",stem:"er",confidence:.85,type:"past"},{ending:"ias",stem:"er",confidence:.85,type:"past"},{ending:"\xEDamos",stem:"er",confidence:.88,type:"past"},{ending:"iamos",stem:"er",confidence:.85,type:"past"},{ending:"\xEDeis",stem:"er",confidence:.88,type:"past"},{ending:"ieis",stem:"er",confidence:.85,type:"past"},{ending:"iam",stem:"er",confidence:.85,type:"past"},{ending:"er",stem:"er",confidence:.92,type:"dictionary"}],av=[{ending:"indo",stem:"ir",confidence:.88,type:"gerund"},{ending:"ido",stem:"ir",confidence:.85,type:"participle"},{ending:"ida",stem:"ir",confidence:.85,type:"participle"},{ending:"idos",stem:"ir",confidence:.85,type:"participle"},{ending:"idas",stem:"ir",confidence:.85,type:"participle"},{ending:"o",stem:"ir",confidence:.72,type:"present"},{ending:"es",stem:"ir",confidence:.78,type:"present"},{ending:"e",stem:"ir",confidence:.72,type:"present"},{ending:"imos",stem:"ir",confidence:.85,type:"present"},{ending:"is",stem:"ir",confidence:.82,type:"present"},{ending:"em",stem:"ir",confidence:.78,type:"present"},{ending:"i",stem:"ir",confidence:.85,type:"past"},{ending:"iste",stem:"ir",confidence:.88,type:"past"},{ending:"iu",stem:"ir",confidence:.88,type:"past"},{ending:"imos",stem:"ir",confidence:.85,type:"past"},{ending:"istes",stem:"ir",confidence:.88,type:"past"},{ending:"iram",stem:"ir",confidence:.88,type:"past"},{ending:"ia",stem:"ir",confidence:.85,type:"past"},{ending:"ias",stem:"ir",confidence:.85,type:"past"},{ending:"\xEDamos",stem:"ir",confidence:.88,type:"past"},{ending:"iamos",stem:"ir",confidence:.85,type:"past"},{ending:"\xEDeis",stem:"ir",confidence:.88,type:"past"},{ending:"ieis",stem:"ir",confidence:.85,type:"past"},{ending:"iam",stem:"ir",confidence:.85,type:"past"},{ending:"ir",stem:"ir",confidence:.92,type:"dictionary"}],ov=[...iv,...nv,...av].sort((r,e)=>e.ending.length-r.ending.length),Ca=class{constructor(){this.language="pt";}isNormalizable(r){return r.length<3?false:rv(r)}normalize(r){let e=r.toLowerCase();if((e.endsWith("ar")||e.endsWith("er")||e.endsWith("ir"))&&!za.some(n=>e.endsWith(n)))return De(r);let t=this.tryReflexiveNormalization(e);if(t)return t;let i=this.tryConjugationNormalization(e);return i||De(r)}tryReflexiveNormalization(r){for(let e of za)if(r.endsWith(e)){let t=r.slice(0,-e.length);if(t.endsWith("ar")||t.endsWith("er")||t.endsWith("ir"))return se(t,.88,{removedSuffixes:[e],conjugationType:"reflexive"});let i=this.tryConjugationNormalization(t);if(i&&i.stem!==t)return se(i.stem,i.confidence*.95,{removedSuffixes:[e,...i.metadata?.removedSuffixes||[]],conjugationType:"reflexive"})}return null}tryConjugationNormalization(r){for(let e of ov)if(r.endsWith(e.ending)){let t=r.slice(0,-e.ending.length);if(t.length<2)continue;let i=t+e.stem;return se(i,e.confidence,{removedSuffixes:[e.ending],conjugationType:e.type})}return null}},uv=["===","!==","->","==","!=","<=",">=","&&","||","**","+=","-=","*=","/=","+","-","*","/","=",">","<","!","&","|","%","^","~"],sv=class{constructor(r=uv){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}},lv="()[]{},:;",cv=class{constructor(r=lv){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 Qr(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,o=n;for(;o<r.length;){if(r[o]==="(")a++;else if(r[o]===")"&&(a--,a===0)){o++;break}o++;}if(a!==0)break;n=o;}t=n;}return t}function wa(r,e){let t=r[e];if(t==="#"){let i=r.slice(e).match(/^#[a-zA-Z_][\w-]*/);if(!i)return null;let n=Qr(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=Qr(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=Qr(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 pv=class{constructor(){this.name="css-selector";}canExtract(r,e){let t=r[e];return t==="#"||t==="."||t==="["||t==="<"?true:t==="@"||t==="*"?wa(r,e)!==null:false}extract(r,e){let t=wa(r,e);return t?{value:t,length:t.length,metadata:{type:"css-selector"}}:null}},dv=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}}}},mv=["http://","https://","//","./","../","/"];function fv(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 yv(r,e){let t=r.slice(e),i=mv.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 o=fv(t,n+2);if(o!==-1){n=o;continue}}if(/\s/.test(a))break;n++;}return t.slice(0,n)}var vv=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=yv(r,e);return t?{value:t,length:t.length,metadata:{type:"url"}}:null}},hv=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 Ev(){return [new vv,new dv,new hv,new pv]}function gv(r){return {isLetter:i=>r.test(i),isIdentifierChar:i=>/[0-9]/.test(i)||r.test(i)}}var{isLetter:kv,isIdentifierChar:zv}=gv(/[a-zA-Z\u00e1\u00e2\u00e3\u00e9\u00ea\u00ed\u00f3\u00f4\u00f5\u00fa\u00e7\u00c1\u00c2\u00c3\u00c9\u00ca\u00cd\u00d3\u00d4\u00d5\u00da\u00c7]/),wv=new Set(["em","a","de","para","com","sem","por","sobre","entre","antes","depois","dentro","fora","ao","do","da","no","na"]),bv=class{constructor(){this.name="portuguese-keyword";}setContext(r){this.context=r;}canExtract(r,e){return kv(r[e])}extract(r,e){if(!this.context)throw new Error("PortugueseKeywordExtractor: context not set");let t=e,i="";for(;t<r.length&&zv(r[t]);)i+=r[t++];if(!i)return null;let n=i.toLowerCase(),a=wv.has(n),o=this.context.lookupKeyword(n),u=o&&o.normalized!==o.native?o.normalized:void 0,s,l,c;if(!o&&this.context.normalizer){let p=this.context.normalizer.normalize(i);if(p.stem!==i&&p.confidence>=.7){let d=this.context.lookupKeyword(p.stem);d&&(s=d.normalized,l=p.stem,c=p.confidence);}}return {value:i,length:t-e,metadata:{normalized:u||s,stem:l,stemConfidence:c,isPreposition:a}}}};function Cv(){return [new bv]}var Av=new Set(["em","a","de","desde","at\xE9","ate","com","sem","por","para","sobre","entre","antes","depois","dentro","fora","ao","do","no","na"]),xv=[{native:"verdadeiro",normalized:"true"},{native:"falso",normalized:"false"},{native:"nulo",normalized:"null"},{native:"indefinido",normalized:"undefined"},{native:"primeiro",normalized:"first"},{native:"primeira",normalized:"first"},{native:"\xFAltimo",normalized:"last"},{native:"ultima",normalized:"last"},{native:"pr\xF3ximo",normalized:"next"},{native:"proximo",normalized:"next"},{native:"anterior",normalized:"previous"},{native:"maispr\xF3ximo",normalized:"closest"},{native:"maisproximo",normalized:"closest"},{native:"pai",normalized:"parent"},{native:"clique",normalized:"click"},{native:"click",normalized:"click"},{native:"entrada",normalized:"input"},{native:"mudan\xE7a",normalized:"change"},{native:"mudanca",normalized:"change"},{native:"envio",normalized:"submit"},{native:"tecla baixo",normalized:"keydown"},{native:"tecla cima",normalized:"keyup"},{native:"mouse sobre",normalized:"mouseover"},{native:"mouse fora",normalized:"mouseout"},{native:"foco",normalized:"focus"},{native:"desfoque",normalized:"blur"},{native:"carregar",normalized:"load"},{native:"rolagem",normalized:"scroll"},{native:"meu",normalized:"my"},{native:"minha",normalized:"my"},{native:"isso",normalized:"it"},{native:"segundo",normalized:"s"},{native:"segundos",normalized:"s"},{native:"milissegundo",normalized:"ms"},{native:"milissegundos",normalized:"ms"},{native:"minuto",normalized:"m"},{native:"minutos",normalized:"m"},{native:"hora",normalized:"h"},{native:"horas",normalized:"h"},{native:"senao",normalized:"else"},{native:"transicao",normalized:"transition"},{native:"ate",normalized:"until"},{native:"entao",normalized:"then"},{native:"lancar",normalized:"throw"},{native:"assincrono",normalized:"async"},{native:"padrao",normalized:"default"},{native:"at\xE9 que",normalized:"until"},{native:"dentro de",normalized:"into"},{native:"inclusivo",normalized:"inclusive"},{native:"exclusivo",normalized:"exclusive"},{native:"caracteres",normalized:"characters"},{native:"aleat\xF3rio",normalized:"random"}],Dv=class extends Ve{constructor(){super(),this.language="pt",this.direction="ltr",this.initializeKeywordsFromProfile(ba,xv),this.setNormalizer(new Ca),this.registerExtractors(Ev()),this.registerExtractor(new We),this.registerExtractor(new qe),this.registerExtractors(Cv()),this.registerExtractor(new sv),this.registerExtractor(new cv);}classifyToken(r){let e=r.toLowerCase();return Av.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"}},Sv=new Dv;Ge("pt",Sv,ba);var xa={code:"fr",name:"French",nativeName:"Fran\xE7ais",regions:["western","priority"],direction:"ltr",script:"latin",wordOrder:"SVO",markingStrategy:"preposition",usesSpaces:true,defaultVerbForm:"infinitive",verb:{position:"start",subjectDrop:false},references:{me:"moi",it:"il",you:"toi",result:"r\xE9sultat",event:"\xE9v\xE9nement",target:"cible",body:"corps",document:"document",window:"fen\xEAtre",detail:"d\xE9tail"},possessive:{marker:"de",markerPosition:"before-property",usePossessiveAdjectives:true,specialForms:{me:"ma",it:"sa",you:"ta"},keywords:{mon:"me",ma:"me",mes:"me",ton:"you",ta:"you",tes:"you",son:"it",sa:"it",ses:"it"}},roleMarkers:{destination:{primary:"sur",alternatives:["\xE0","dans"],position:"before"},source:{primary:"de",alternatives:["depuis"],position:"before"},patient:{primary:"",position:"before"},style:{primary:"avec",position:"before"}},keywords:{toggle:{primary:"basculer",alternatives:["alterner"],normalized:"toggle"},add:{primary:"ajouter",normalized:"add"},remove:{primary:"supprimer",alternatives:["enlever","retirer","retire"],normalized:"remove"},put:{primary:"mettre",alternatives:["placer","mets"],normalized:"put"},append:{primary:"annexer",normalized:"append"},prepend:{primary:"pr\xE9fixer",normalized:"prepend"},take:{primary:"prendre",normalized:"take"},make:{primary:"faire",alternatives:["cr\xE9er"],normalized:"make"},clone:{primary:"cloner",alternatives:["dupliquer"],normalized:"clone"},swap:{primary:"\xE9changer",alternatives:["permuter"],normalized:"swap"},morph:{primary:"transformer",alternatives:["m\xE9tamorphoser"],normalized:"morph"},set:{primary:"d\xE9finir",alternatives:["\xE9tablir"],normalized:"set"},get:{primary:"obtenir",alternatives:["obtiens"],normalized:"get"},increment:{primary:"incr\xE9menter",alternatives:["augmenter"],normalized:"increment"},decrement:{primary:"d\xE9cr\xE9menter",alternatives:["diminuer"],normalized:"decrement"},log:{primary:"enregistrer",alternatives:["journaliser"],normalized:"log"},show:{primary:"montrer",alternatives:["afficher","montre"],normalized:"show"},hide:{primary:"cacher",alternatives:["masquer"],normalized:"hide"},transition:{primary:"transition",alternatives:["animer"],normalized:"transition"},on:{primary:"sur",alternatives:["lors"],normalized:"on"},trigger:{primary:"d\xE9clencher",normalized:"trigger"},send:{primary:"envoyer",alternatives:["envoie"],normalized:"send"},focus:{primary:"focaliser",alternatives:["concentrer"],normalized:"focus"},blur:{primary:"perte de focus",alternatives:["d\xE9focaliser"],normalized:"blur"},empty:{primary:"vider",alternatives:["vide"],normalized:"empty"},open:{primary:"ouvrir",normalized:"open"},close:{primary:"fermer",normalized:"close"},select:{primary:"s\xE9lectionner",alternatives:["selectionner"],normalized:"select"},clear:{primary:"effacer",normalized:"clear"},reset:{primary:"r\xE9initialiser",alternatives:["reinitialiser"],normalized:"reset"},breakpoint:{primary:"point-arr\xEAt",alternatives:["point-arret"],normalized:"breakpoint"},go:{primary:"aller",alternatives:["naviguer","va"],normalized:"go"},scroll:{primary:"d\xE9filement",alternatives:["defilement","d\xE9filer","faire-d\xE9filer"],normalized:"scroll"},push:{primary:"pousser",normalized:"push"},replace:{primary:"remplacer",normalized:"replace"},process:{primary:"traiter",normalized:"process"},wait:{primary:"attendre",normalized:"wait"},fetch:{primary:"chercher",alternatives:["r\xE9cup\xE9rer","r\xE9cup\xE8re"],normalized:"fetch"},settle:{primary:"stabiliser",normalized:"settle"},if:{primary:"si",normalized:"if"},unless:{primary:"saufsi",normalized:"unless"},when:{primary:"quand",normalized:"when"},changes:{primary:"change",normalized:"changes"},where:{primary:"o\xF9",normalized:"where"},else:{primary:"sinon",normalized:"else"},repeat:{primary:"r\xE9p\xE9ter",normalized:"repeat"},for:{primary:"pour",normalized:"for"},while:{primary:"pendant",normalized:"while"},forever:{primary:"forever",normalized:"forever"},continue:{primary:"continuer",normalized:"continue"},halt:{primary:"arr\xEAter",alternatives:["stopper"],normalized:"halt"},throw:{primary:"lancer",normalized:"throw"},call:{primary:"appeler",normalized:"call"},return:{primary:"retourner",alternatives:["renvoyer"],normalized:"return"},then:{primary:"puis",alternatives:["ensuite","alors"],normalized:"then"},and:{primary:"et",alternatives:["aussi","\xE9galement"],normalized:"and"},matches:{primary:"correspond",normalized:"matches"},exists:{primary:"existe",normalized:"exists"},is:{primary:"est",normalized:"is"},no:{primary:"aucun",normalized:"no"},end:{primary:"fin",alternatives:["terminer","finir"],normalized:"end"},js:{primary:"js",normalized:"js"},async:{primary:"asynchrone",normalized:"async"},tell:{primary:"dire",normalized:"tell"},default:{primary:"d\xE9faut",normalized:"default"},init:{primary:"initialiser",normalized:"init"},behavior:{primary:"comportement",normalized:"behavior"},install:{primary:"installer",normalized:"install"},measure:{primary:"mesurer",normalized:"measure"},beep:{primary:"bip",normalized:"beep"},break:{primary:"interrompre",normalized:"break"},copy:{primary:"copier",normalized:"copy"},exit:{primary:"sortir",normalized:"exit"},pick:{primary:"choisir",normalized:"pick"},render:{primary:"rendu",normalized:"render"},into:{primary:"dans",normalized:"into"},before:{primary:"avant",normalized:"before"},after:{primary:"apr\xE8s",normalized:"after"},click:{primary:"clic",alternatives:["clique"],normalized:"click"},resize:{primary:"redimensionnement",alternatives:["redimensionner"],normalized:"resize"},hover:{primary:"survol",alternatives:["survoler"],normalized:"hover"},submit:{primary:"soumission",alternatives:["soumettre"],normalized:"submit"},input:{primary:"saisie",alternatives:["entr\xE9e"],normalized:"input"},change:{primary:"changement",alternatives:["modifier","changer"],normalized:"change"},load:{primary:"charger",alternatives:["chargement"],normalized:"load"},until:{primary:"jusqu'\xE0",alternatives:["jusque"],normalized:"until"},event:{primary:"\xE9v\xE9nement",normalized:"event"},from:{primary:"de",alternatives:["depuis"],normalized:"from"},connect:{primary:"connecter",alternatives:["connexion"],normalized:"connect"},stream:{primary:"flux",alternatives:["streaming"],normalized:"stream"},live:{primary:"en-direct",alternatives:["direct","vif"],normalized:"live"},socket:{primary:"socket",alternatives:["websocket"],normalized:"socket"},bind:{primary:"lier",alternatives:["relier","bind"],normalized:"bind"},intercept:{primary:"intercepter",alternatives:["intercept"],normalized:"intercept"},worker:{primary:"travailleur",alternatives:["worker"],normalized:"worker"},eventsource:{primary:"eventsource",alternatives:["source-d-evenements"],normalized:"eventsource"}},eventHandler:{keyword:{primary:"sur",alternatives:["lors"],normalized:"on"},sourceMarker:{primary:"de",alternatives:["depuis"],position:"before"},conditionalKeyword:{primary:"quand",alternatives:["lorsque"]},eventMarker:{primary:"au",alternatives:["lors du","lors de","sur"],position:"before"},temporalMarkers:["quand","lorsque"]}};function Bv(r){let e=r.toLowerCase();return !!(e.endsWith("er")||e.endsWith("ir")||e.endsWith("re")||e.endsWith("ant")||e.endsWith("\xE9")||e.endsWith("i")||e.endsWith("u")||/[\u00e0\u00e2\u00e4\u00e9\u00e8\u00ea\u00eb\u00ef\u00ee\u00f4\u00f9\u00fb\u00fc\u00ff\u00e7\u0153\u00e6]/i.test(r))}var Tv=["toi","vous","nous"],Fv=[{ending:"ant",stem:"er",confidence:.88,type:"gerund"},{ending:"\xE9",stem:"er",confidence:.88,type:"participle"},{ending:"\xE9e",stem:"er",confidence:.88,type:"participle"},{ending:"\xE9s",stem:"er",confidence:.88,type:"participle"},{ending:"\xE9es",stem:"er",confidence:.88,type:"participle"},{ending:"e",stem:"er",confidence:.75,type:"present"},{ending:"es",stem:"er",confidence:.78,type:"present"},{ending:"ons",stem:"er",confidence:.85,type:"present"},{ending:"ez",stem:"er",confidence:.85,type:"present"},{ending:"ent",stem:"er",confidence:.82,type:"present"},{ending:"ais",stem:"er",confidence:.82,type:"past"},{ending:"ait",stem:"er",confidence:.82,type:"past"},{ending:"ions",stem:"er",confidence:.85,type:"past"},{ending:"iez",stem:"er",confidence:.85,type:"past"},{ending:"aient",stem:"er",confidence:.85,type:"past"},{ending:"ai",stem:"er",confidence:.8,type:"past"},{ending:"as",stem:"er",confidence:.78,type:"past"},{ending:"a",stem:"er",confidence:.75,type:"past"},{ending:"\xE2mes",stem:"er",confidence:.88,type:"past"},{ending:"\xE2tes",stem:"er",confidence:.88,type:"past"},{ending:"\xE8rent",stem:"er",confidence:.88,type:"past"},{ending:"erai",stem:"er",confidence:.85,type:"future"},{ending:"eras",stem:"er",confidence:.85,type:"future"},{ending:"era",stem:"er",confidence:.82,type:"future"},{ending:"erons",stem:"er",confidence:.88,type:"future"},{ending:"erez",stem:"er",confidence:.88,type:"future"},{ending:"eront",stem:"er",confidence:.88,type:"future"},{ending:"erais",stem:"er",confidence:.85,type:"conditional"},{ending:"erait",stem:"er",confidence:.85,type:"conditional"},{ending:"erions",stem:"er",confidence:.88,type:"conditional"},{ending:"eriez",stem:"er",confidence:.88,type:"conditional"},{ending:"eraient",stem:"er",confidence:.88,type:"conditional"},{ending:"ions",stem:"er",confidence:.8,type:"subjunctive"},{ending:"iez",stem:"er",confidence:.8,type:"subjunctive"},{ending:"ons",stem:"er",confidence:.82,type:"imperative"},{ending:"ez",stem:"er",confidence:.82,type:"imperative"},{ending:"er",stem:"er",confidence:.92,type:"dictionary"}],Pv=[{ending:"issant",stem:"ir",confidence:.88,type:"gerund"},{ending:"i",stem:"ir",confidence:.8,type:"participle"},{ending:"ie",stem:"ir",confidence:.82,type:"participle"},{ending:"is",stem:"ir",confidence:.78,type:"participle"},{ending:"ies",stem:"ir",confidence:.82,type:"participle"},{ending:"is",stem:"ir",confidence:.78,type:"present"},{ending:"it",stem:"ir",confidence:.78,type:"present"},{ending:"issons",stem:"ir",confidence:.88,type:"present"},{ending:"issez",stem:"ir",confidence:.88,type:"present"},{ending:"issent",stem:"ir",confidence:.88,type:"present"},{ending:"issais",stem:"ir",confidence:.85,type:"past"},{ending:"issait",stem:"ir",confidence:.85,type:"past"},{ending:"issions",stem:"ir",confidence:.88,type:"past"},{ending:"issiez",stem:"ir",confidence:.88,type:"past"},{ending:"issaient",stem:"ir",confidence:.88,type:"past"},{ending:"irai",stem:"ir",confidence:.85,type:"future"},{ending:"iras",stem:"ir",confidence:.85,type:"future"},{ending:"ira",stem:"ir",confidence:.82,type:"future"},{ending:"irons",stem:"ir",confidence:.88,type:"future"},{ending:"irez",stem:"ir",confidence:.88,type:"future"},{ending:"iront",stem:"ir",confidence:.88,type:"future"},{ending:"ir",stem:"ir",confidence:.9,type:"dictionary"}],Rv=[{ending:"ant",stem:"re",confidence:.82,type:"gerund"},{ending:"u",stem:"re",confidence:.8,type:"participle"},{ending:"ue",stem:"re",confidence:.82,type:"participle"},{ending:"us",stem:"re",confidence:.82,type:"participle"},{ending:"ues",stem:"re",confidence:.82,type:"participle"},{ending:"s",stem:"re",confidence:.72,type:"present"},{ending:"d",stem:"re",confidence:.75,type:"present"},{ending:"ons",stem:"re",confidence:.82,type:"present"},{ending:"ez",stem:"re",confidence:.82,type:"present"},{ending:"ent",stem:"re",confidence:.8,type:"present"},{ending:"re",stem:"re",confidence:.9,type:"dictionary"}],Ov=[...Fv,...Pv,...Rv].sort((r,e)=>e.ending.length-r.ending.length),Da=class{constructor(){this.language="fr";}isNormalizable(r){return r.length<3?false:Bv(r)}normalize(r){let e=r.toLowerCase();if((e.endsWith("er")||e.endsWith("ir")||e.endsWith("re"))&&e.length>=4)return De(r);let t=this.tryReflexiveNormalization(e);if(t)return t;let i=this.tryConjugationNormalization(e);return i||De(r)}tryReflexiveNormalization(r){for(let e of Tv){let t="-"+e;if(r.endsWith(t)){let i=r.slice(0,-t.length),n=this.tryConjugationNormalization(i);if(n&&n.stem!==i)return se(n.stem,n.confidence*.95,{removedSuffixes:[t,...n.metadata?.removedSuffixes||[]],conjugationType:"reflexive"})}}return null}tryConjugationNormalization(r){for(let e of Ov)if(r.endsWith(e.ending)){let t=r.slice(0,-e.ending.length);if(t.length<2)continue;let i=t+e.stem;return se(i,e.confidence,{removedSuffixes:[e.ending],conjugationType:e.type})}return null}},Lv=["===","!==","->","==","!=","<=",">=","&&","||","**","+=","-=","*=","/=","+","-","*","/","=",">","<","!","&","|","%","^","~"],Nv=class{constructor(r=Lv){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}},Mv="()[]{},:;",_v=class{constructor(r=Mv){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 ei(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,o=n;for(;o<r.length;){if(r[o]==="(")a++;else if(r[o]===")"&&(a--,a===0)){o++;break}o++;}if(a!==0)break;n=o;}t=n;}return t}function Aa(r,e){let t=r[e];if(t==="#"){let i=r.slice(e).match(/^#[a-zA-Z_][\w-]*/);if(!i)return null;let n=ei(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=ei(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=ei(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 Iv=class{constructor(){this.name="css-selector";}canExtract(r,e){let t=r[e];return t==="#"||t==="."||t==="["||t==="<"?true:t==="@"||t==="*"?Aa(r,e)!==null:false}extract(r,e){let t=Aa(r,e);return t?{value:t,length:t.length,metadata:{type:"css-selector"}}:null}},$v=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}}}},jv=["http://","https://","//","./","../","/"];function Wv(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 qv(r,e){let t=r.slice(e),i=jv.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 o=Wv(t,n+2);if(o!==-1){n=o;continue}}if(/\s/.test(a))break;n++;}return t.slice(0,n)}var Vv=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=qv(r,e);return t?{value:t,length:t.length,metadata:{type:"url"}}:null}},Kv=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 Hv(){return [new Vv,new $v,new Kv,new Iv]}function Uv(r){return {isLetter:i=>r.test(i),isIdentifierChar:i=>/[0-9]/.test(i)||r.test(i)}}var{isLetter:Gv,isIdentifierChar:Zv}=Uv(/[a-zA-Z\u00e0\u00e2\u00e6\u00e7\u00e9\u00e8\u00ea\u00eb\u00ef\u00ee\u00f4\u00f9\u00fb\u00fc\u00ff\u0153\u00c0\u00c2\u00c6\u00c7\u00c9\u00c8\u00ca\u00cb\u00cf\u00ce\u00d4\u00d9\u00db\u00dc\u0178\u0152]/),Yv=new Set(["\xE0","a","de","du","des","dans","sur","sous","avec","sans","par","pour","entre","avant","apr\xE8s","apres","depuis","vers","chez","contre","au","aux"]),Xv=class{constructor(){this.name="french-keyword";}setContext(r){this.context=r;}canExtract(r,e){return Gv(r[e])}extract(r,e){if(!this.context)throw new Error("FrenchKeywordExtractor: context not set");let t=e,i="";for(;t<r.length&&Zv(r[t]);)i+=r[t++];if(!i)return null;let n=i.toLowerCase(),a=Yv.has(n),o=this.context.lookupKeyword(n),u=o&&o.normalized!==o.native?o.normalized:void 0,s,l,c;if(!o&&this.context.normalizer){let p=this.context.normalizer.normalize(i);if(p.stem!==i&&p.confidence>=.7){let d=this.context.lookupKeyword(p.stem);d&&(s=d.normalized,l=p.stem,c=p.confidence);}}return {value:i,length:t-e,metadata:{normalized:u||s,stem:l,stemConfidence:c,isPreposition:a}}}};function Jv(){return [new Xv]}var Qv=[{native:"vrai",normalized:"true"},{native:"faux",normalized:"false"},{native:"nul",normalized:"null"},{native:"ind\xE9fini",normalized:"undefined"},{native:"indefini",normalized:"undefined"},{native:"premier",normalized:"first"},{native:"premi\xE8re",normalized:"first"},{native:"premiere",normalized:"first"},{native:"dernier",normalized:"last"},{native:"derni\xE8re",normalized:"last"},{native:"derniere",normalized:"last"},{native:"suivant",normalized:"next"},{native:"pr\xE9c\xE9dent",normalized:"previous"},{native:"precedent",normalized:"previous"},{native:"proche",normalized:"closest"},{native:"parent",normalized:"parent"},{native:"clic",normalized:"click"},{native:"click",normalized:"click"},{native:"entr\xE9e",normalized:"input"},{native:"entree",normalized:"input"},{native:"changement",normalized:"change"},{native:"soumission",normalized:"submit"},{native:"touche bas",normalized:"keydown"},{native:"touche haut",normalized:"keyup"},{native:"souris dessus",normalized:"mouseover"},{native:"souris dehors",normalized:"mouseout"},{native:"focus",normalized:"focus"},{native:"flou",normalized:"blur"},{native:"chargement",normalized:"load"},{native:"d\xE9filement",normalized:"scroll"},{native:"defilement",normalized:"scroll"},{native:"je",normalized:"me"},{native:"mon",normalized:"my"},{native:"ma",normalized:"my"},{native:"mes",normalized:"my"},{native:"\xE7a",normalized:"it"},{native:"ca",normalized:"it"},{native:"resultat",normalized:"result"},{native:"evenement",normalized:"event"},{native:"seconde",normalized:"s"},{native:"secondes",normalized:"s"},{native:"milliseconde",normalized:"ms"},{native:"millisecondes",normalized:"ms"},{native:"minute",normalized:"m"},{native:"minutes",normalized:"m"},{native:"heure",normalized:"h"},{native:"heures",normalized:"h"},{native:"prefixer",normalized:"prepend"},{native:"creer",normalized:"make"},{native:"definir",normalized:"set"},{native:"etablir",normalized:"set"},{native:"incrementer",normalized:"increment"},{native:"decrementer",normalized:"decrement"},{native:"declencher",normalized:"trigger"},{native:"defocaliser",normalized:"blur"},{native:"recuperer",normalized:"fetch"},{native:"repeter",normalized:"repeat"},{native:"arreter",normalized:"halt"},{native:"defaut",normalized:"default"},{native:"jusqua",normalized:"until"},{native:"apres",normalized:"after"},{native:"journaliser",normalized:"log"},{native:"transmuter",normalized:"morph"},{native:"tant que",normalized:"while"},{native:"inclusif",normalized:"inclusive"},{native:"exclusif",normalized:"exclusive"},{native:"caract\xE8res",normalized:"characters"},{native:"al\xE9atoire",normalized:"random"}],e4=class extends Ve{constructor(){super(),this.language="fr",this.direction="ltr",this.initializeKeywordsFromProfile(xa,Qv),this.normalizer=new Da,this.registerExtractors(Hv()),this.registerExtractor(new We),this.registerExtractor(new qe),this.registerExtractors(Jv()),this.registerExtractor(new Nv),this.registerExtractor(new _v);}classifyToken(r){return this.isKeyword(r)?"keyword":/^\.(once|prevent|stop|debounce|throttle|queue)(\(.*\))?$/.test(r)?"event-modifier":r.startsWith("#")||r.startsWith(".")||r.startsWith("[")||r.startsWith("*")||r.startsWith("<")?"selector":r.startsWith('"')||r.startsWith("'")||/^\d/.test(r)?"literal":["==","!=","<=",">=","<",">","&&","||","!"].includes(r)?"operator":r.startsWith("/")||r.startsWith("./")||r.startsWith("http")?"url":"identifier"}},t4=new e4;Ge("fr",t4,xa);var Ba={code:"de",name:"German",nativeName:"Deutsch",regions:["western","priority"],direction:"ltr",script:"latin",wordOrder:"SVO",markingStrategy:"preposition",usesSpaces:true,defaultVerbForm:"infinitive",verb:{position:"start",subjectDrop:false},references:{me:"ich",it:"es",you:"du",result:"Ergebnis",event:"Ereignis",target:"Ziel",body:"K\xF6rper",document:"dokument",window:"fenster",detail:"detail"},possessive:{marker:"",markerPosition:"before-property",usePossessiveAdjectives:true,specialForms:{me:"mein",it:"sein",you:"dein"},keywords:{mein:"me",meine:"me",meinen:"me",dein:"you",deine:"you",deinen:"you",sein:"it",seine:"it",seinen:"it"}},roleMarkers:{destination:{primary:"auf",alternatives:["zu","in"],position:"before"},source:{primary:"von",alternatives:["aus"],position:"before"},patient:{primary:"",position:"before"},style:{primary:"mit",position:"before"}},keywords:{toggle:{primary:"umschalten",alternatives:["wechseln"],normalized:"toggle"},add:{primary:"hinzuf\xFCgen",normalized:"add"},remove:{primary:"entfernen",alternatives:["l\xF6schen"],normalized:"remove"},put:{primary:"setzen",alternatives:["stellen","platzieren"],normalized:"put"},append:{primary:"anh\xE4ngen",normalized:"append"},prepend:{primary:"voranstellen",normalized:"prepend"},take:{primary:"nehmen",normalized:"take"},make:{primary:"machen",alternatives:["erstellen","erzeugen"],normalized:"make"},clone:{primary:"klonen",alternatives:["duplizieren"],normalized:"clone"},swap:{primary:"austauschen",alternatives:["tauschen","vertauschen"],normalized:"swap"},morph:{primary:"verwandeln",alternatives:["transformieren"],normalized:"morph"},set:{primary:"festlegen",alternatives:["definieren"],normalized:"set"},get:{primary:"holen",alternatives:["bekommen","erhalten"],normalized:"get"},increment:{primary:"erh\xF6hen",normalized:"increment"},decrement:{primary:"verringern",alternatives:["vermindern"],normalized:"decrement"},log:{primary:"protokollieren",alternatives:["ausgeben"],normalized:"log"},show:{primary:"zeigen",alternatives:["anzeigen"],normalized:"show"},hide:{primary:"verbergen",alternatives:["verstecken"],normalized:"hide"},transition:{primary:"\xFCbergang",alternatives:["animieren"],normalized:"transition"},on:{primary:"bei",alternatives:["auf"],normalized:"on"},trigger:{primary:"ausl\xF6sen",normalized:"trigger"},send:{primary:"senden",alternatives:["schicken"],normalized:"send"},focus:{primary:"Fokus",alternatives:["Fokuserhalt","fokussieren"],normalized:"focus"},blur:{primary:"Fokusverlust",alternatives:["verlassen","defokussieren","entfokussieren"],normalized:"blur"},empty:{primary:"leeren",alternatives:["leer"],normalized:"empty"},open:{primary:"\xF6ffnen",alternatives:["oeffnen"],normalized:"open"},close:{primary:"schlie\xDFen",alternatives:["schliessen"],normalized:"close"},select:{primary:"markieren",normalized:"select"},clear:{primary:"bereinigen",normalized:"clear"},reset:{primary:"zur\xFCcksetzen",alternatives:["zuruecksetzen"],normalized:"reset"},breakpoint:{primary:"haltepunkt",normalized:"breakpoint"},go:{primary:"gehen",alternatives:["navigieren"],normalized:"go"},scroll:{primary:"scrollen",normalized:"scroll"},push:{primary:"dr\xFCcken",alternatives:["push"],normalized:"push"},replace:{primary:"ersetzen",normalized:"replace"},process:{primary:"verarbeiten",normalized:"process"},wait:{primary:"warten",normalized:"wait"},fetch:{primary:"abrufen",alternatives:["laden"],normalized:"fetch"},settle:{primary:"stabilisieren",normalized:"settle"},if:{primary:"falls",alternatives:["sofern"],normalized:"if"},unless:{primary:"wennnicht",normalized:"unless"},when:{primary:"wenn",normalized:"when"},changes:{primary:"\xE4ndert",normalized:"changes"},where:{primary:"wo",normalized:"where"},else:{primary:"sonst",alternatives:["ansonsten"],normalized:"else"},repeat:{primary:"wiederholen",normalized:"repeat"},for:{primary:"f\xFCr",normalized:"for"},while:{primary:"solange",alternatives:["w\xE4hrend"],normalized:"while"},forever:{primary:"forever",normalized:"forever"},continue:{primary:"fortfahren",alternatives:["weiter"],normalized:"continue"},halt:{primary:"anhalten",alternatives:["stoppen"],normalized:"halt"},throw:{primary:"werfen",normalized:"throw"},call:{primary:"aufrufen",normalized:"call"},return:{primary:"zur\xFCckgeben",normalized:"return"},then:{primary:"dann",alternatives:["danach","anschlie\xDFend"],normalized:"then"},and:{primary:"und",alternatives:["sowie","auch"],normalized:"and"},is:{primary:"ist",normalized:"is"},matches:{primary:"passt",normalized:"matches"},exists:{primary:"existiert",normalized:"exists"},no:{primary:"kein",normalized:"no"},end:{primary:"ende",alternatives:["fertig"],normalized:"end"},js:{primary:"js",alternatives:["javascript"],normalized:"js"},async:{primary:"asynchron",normalized:"async"},tell:{primary:"sagen",normalized:"tell"},default:{primary:"standard",normalized:"default"},init:{primary:"Initialisierung",alternatives:["initialisieren"],normalized:"init"},behavior:{primary:"verhalten",normalized:"behavior"},install:{primary:"installieren",normalized:"install"},measure:{primary:"messen",normalized:"measure"},beep:{primary:"piepton",normalized:"beep"},break:{primary:"unterbrechen",normalized:"break"},copy:{primary:"kopieren",normalized:"copy"},exit:{primary:"beenden",normalized:"exit"},pick:{primary:"ausw\xE4hlen",normalized:"pick"},render:{primary:"rendern",normalized:"render"},into:{primary:"hinein",normalized:"into"},before:{primary:"vor",normalized:"before"},after:{primary:"nach",normalized:"after"},click:{primary:"Klick",alternatives:["Klicken"],normalized:"click"},hover:{primary:"Hover",alternatives:["Schweben"],normalized:"hover"},submit:{primary:"Absenden",alternatives:["Senden"],normalized:"submit"},input:{primary:"Eingabe",normalized:"input"},change:{primary:"\xC4nderung",alternatives:["\xC4ndern"],normalized:"change"},resize:{primary:"Gr\xF6\xDFen\xE4nderung",alternatives:["gr\xF6\xDFen\xE4nderung","gr\xF6ssen\xE4nderung","Gr\xF6\xDFe \xE4ndern","gr\xF6\xDFe\xE4ndern"],normalized:"resize"},until:{primary:"bis",normalized:"until"},event:{primary:"Ereignis",alternatives:["Event"],normalized:"event"},from:{primary:"von",alternatives:["aus"],normalized:"from"},connect:{primary:"verbinden",alternatives:["Verbindung"],normalized:"connect"},stream:{primary:"stream",alternatives:["Strom"],normalized:"stream"},live:{primary:"direkt",alternatives:["live","echtzeit"],normalized:"live"},socket:{primary:"socket",alternatives:["websocket"],normalized:"socket"},bind:{primary:"binden",alternatives:["verknuepfen","bind"],normalized:"bind"},intercept:{primary:"abfangen",alternatives:["intercept"],normalized:"intercept"},worker:{primary:"arbeiter",alternatives:["worker"],normalized:"worker"},eventsource:{primary:"eventsource",alternatives:["ereignisquelle"],normalized:"eventsource"}},eventHandler:{keyword:{primary:"bei",alternatives:["auf"],normalized:"on"},sourceMarker:{primary:"von",alternatives:["aus"],position:"before"},conditionalKeyword:{primary:"wenn",alternatives:["falls"]},eventMarker:{primary:"bei",alternatives:["beim"],position:"before"},temporalMarkers:["wenn","bei"]}},r4=["an","auf","aus","ein","mit","vor","zu","ab","bei","nach","weg","um","her","hin"];function i4(r){let e=r.toLowerCase();return !!(e.endsWith("en")||e.endsWith("eln")||e.endsWith("ern")||e.startsWith("ge")&&e.endsWith("t")||e.startsWith("ge")&&e.endsWith("en")||/[\u00e4\u00f6\u00fc\u00df]/i.test(r))}var n4=[{ending:"end",stem:"en",confidence:.88,type:"gerund"},{ending:"e",stem:"en",confidence:.75,type:"present"},{ending:"st",stem:"en",confidence:.8,type:"present"},{ending:"t",stem:"en",confidence:.78,type:"present"},{ending:"en",stem:"en",confidence:.85,type:"dictionary"},{ending:"test",stem:"en",confidence:.85,type:"past"},{ending:"ten",stem:"en",confidence:.82,type:"past"},{ending:"tet",stem:"en",confidence:.85,type:"past"},{ending:"te",stem:"en",confidence:.82,type:"past"},{ending:"test",stem:"en",confidence:.8,type:"subjunctive"},{ending:"ten",stem:"en",confidence:.78,type:"subjunctive"},{ending:"tet",stem:"en",confidence:.8,type:"subjunctive"},{ending:"te",stem:"en",confidence:.78,type:"subjunctive"},{ending:"e",stem:"en",confidence:.72,type:"imperative"},{ending:"t",stem:"en",confidence:.72,type:"imperative"},{ending:"en",stem:"en",confidence:.75,type:"imperative"}],a4=[{ending:"le",stem:"eln",confidence:.82,type:"present"},{ending:"elst",stem:"eln",confidence:.85,type:"present"},{ending:"elt",stem:"eln",confidence:.85,type:"present"},{ending:"eln",stem:"eln",confidence:.88,type:"dictionary"},{ending:"re",stem:"ern",confidence:.82,type:"present"},{ending:"erst",stem:"ern",confidence:.85,type:"present"},{ending:"ert",stem:"ern",confidence:.85,type:"present"},{ending:"ern",stem:"ern",confidence:.88,type:"dictionary"}],o4=[...n4,...a4].sort((r,e)=>e.ending.length-r.ending.length),Ta=class{constructor(){this.language="de";}isNormalizable(r){return r.length<3?false:i4(r)}normalize(r){let e=r.toLowerCase();if(e.endsWith("en")&&e.length>=4)return De(r);if((e.endsWith("eln")||e.endsWith("ern"))&&e.length>=5)return De(r);let t=this.tryParticipleNormalization(e);if(t)return t;let i=this.tryConjugationNormalization(e);return i||De(r)}tryParticipleNormalization(r){for(let e of r4)if(r.startsWith(e+"ge")){let t=r.slice(e.length),i=this.trySimpleParticipleNormalization(t);if(i){let n={removedPrefixes:["ge"],conjugationType:"participle"};return i.metadata?.removedSuffixes&&(n.removedSuffixes=i.metadata.removedSuffixes),se(e+i.stem,i.confidence*.95,n)}}return this.trySimpleParticipleNormalization(r)}trySimpleParticipleNormalization(r){if(!r.startsWith("ge"))return null;let e=r.slice(2);if(e.endsWith("t")&&e.length>=3){let t=e.slice(0,-1);return se(t+"en",.85,{removedPrefixes:["ge"],removedSuffixes:["t"],conjugationType:"participle"})}return e.endsWith("en")&&e.length>=4?se(e,.82,{removedPrefixes:["ge"],conjugationType:"participle"}):null}tryConjugationNormalization(r){for(let e of o4)if(r.endsWith(e.ending)){let t=r.slice(0,-e.ending.length);if(t.length<2)continue;let i=t+e.stem;return se(i,e.confidence,{removedSuffixes:[e.ending],conjugationType:e.type})}return null}},u4=["===","!==","->","==","!=","<=",">=","&&","||","**","+=","-=","*=","/=","+","-","*","/","=",">","<","!","&","|","%","^","~"],s4=class{constructor(r=u4){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}},l4="()[]{},:;",c4=class{constructor(r=l4){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 ti(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,o=n;for(;o<r.length;){if(r[o]==="(")a++;else if(r[o]===")"&&(a--,a===0)){o++;break}o++;}if(a!==0)break;n=o;}t=n;}return t}function Sa(r,e){let t=r[e];if(t==="#"){let i=r.slice(e).match(/^#[a-zA-Z_][\w-]*/);if(!i)return null;let n=ti(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=ti(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=ti(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 p4=class{constructor(){this.name="css-selector";}canExtract(r,e){let t=r[e];return t==="#"||t==="."||t==="["||t==="<"?true:t==="@"||t==="*"?Sa(r,e)!==null:false}extract(r,e){let t=Sa(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}}}},m4=["http://","https://","//","./","../","/"];function f4(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 y4(r,e){let t=r.slice(e),i=m4.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 o=f4(t,n+2);if(o!==-1){n=o;continue}}if(/\s/.test(a))break;n++;}return t.slice(0,n)}var v4=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=y4(r,e);return t?{value:t,length:t.length,metadata:{type:"url"}}:null}},h4=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 E4(){return [new v4,new d4,new h4,new p4]}function g4(r){return {isLetter:i=>r.test(i),isIdentifierChar:i=>/[0-9]/.test(i)||r.test(i)}}var{isLetter:k4,isIdentifierChar:z4}=g4(/[a-zA-Z\u00e4\u00f6\u00fc\u00c4\u00d6\u00dc\u00df]/),w4=new Set(["an","auf","aus","bei","durch","f\xFCr","fur","gegen","in","mit","nach","ohne","seit","\xFCber","uber","um","unter","von","vor","zu","zwischen","bis","gegen\xFCber","gegenuber","w\xE4hrend","wahrend","wegen","trotz","statt","innerhalb","au\xDFerhalb","ausserhalb"]),b4=class{constructor(){this.name="german-keyword";}setContext(r){this.context=r;}canExtract(r,e){return k4(r[e])}extract(r,e){if(!this.context)throw new Error("GermanKeywordExtractor: context not set");return this.extractGermanWord(r,e)}extractGermanWord(r,e){if(!this.context)return null;let t=e,i="";for(;t<r.length&&z4(r[t]);)i+=r[t++];if(!i)return null;let n=i.toLowerCase(),a=w4.has(n),o=this.context.lookupKeyword(i),u=o&&o.normalized!==o.native?o.normalized:void 0,s;if(!o&&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:u||s,isPreposition:a}}}};function C4(){return [new b4]}var A4=[{native:"wahr",normalized:"true"},{native:"falsch",normalized:"false"},{native:"null",normalized:"null"},{native:"undefiniert",normalized:"undefined"},{native:"erste",normalized:"first"},{native:"erster",normalized:"first"},{native:"erstes",normalized:"first"},{native:"letzte",normalized:"last"},{native:"letzter",normalized:"last"},{native:"letztes",normalized:"last"},{native:"n\xE4chste",normalized:"next"},{native:"nachste",normalized:"next"},{native:"n\xE4chstgelegene",normalized:"closest"},{native:"nachstgelegene",normalized:"closest"},{native:"vorherige",normalized:"previous"},{native:"eltern",normalized:"parent"},{native:"klick",normalized:"click"},{native:"click",normalized:"click"},{native:"eingabe",normalized:"input"},{native:"\xE4nderung",normalized:"change"},{native:"anderung",normalized:"change"},{native:"absenden",normalized:"submit"},{native:"taste unten",normalized:"keydown"},{native:"taste oben",normalized:"keyup"},{native:"maus dr\xFCber",normalized:"mouseover"},{native:"maus druber",normalized:"mouseover"},{native:"maus weg",normalized:"mouseout"},{native:"fokus",normalized:"focus"},{native:"unsch\xE4rfe",normalized:"blur"},{native:"unscharfe",normalized:"blur"},{native:"scrollen",normalized:"scroll"},{native:"meine",normalized:"my"},{native:"meinen",normalized:"my"},{native:"ergebnis",normalized:"result"},{native:"ziel",normalized:"target"},{native:"sekunde",normalized:"s"},{native:"sekunden",normalized:"s"},{native:"millisekunde",normalized:"ms"},{native:"millisekunden",normalized:"ms"},{native:"minute",normalized:"m"},{native:"minuten",normalized:"m"},{native:"stunde",normalized:"h"},{native:"stunden",normalized:"h"},{native:"hinzufugen",normalized:"add"},{native:"hinzufgen",normalized:"add"},{native:"loschen",normalized:"remove"},{native:"anhangen",normalized:"append"},{native:"erhohen",normalized:"increment"},{native:"ubergang",normalized:"transition"},{native:"auslosen",normalized:"trigger"},{native:"zuruckgeben",normalized:"return"},{native:"anschliessend",normalized:"then"},{native:"erh\xF6he",normalized:"increment"},{native:"erhohe",normalized:"increment"},{native:"verringere",normalized:"decrement"},{native:"inklusiv",normalized:"inclusive"},{native:"exklusiv",normalized:"exclusive"},{native:"Zeichen",normalized:"characters"},{native:"zuf\xE4llig",normalized:"random"}],x4=class extends Ve{constructor(){super(),this.language="de",this.direction="ltr",this.initializeKeywordsFromProfile(Ba,A4),this.normalizer=new Ta,this.registerExtractors(E4()),this.registerExtractor(new We),this.registerExtractor(new qe),this.registerExtractors(C4()),this.registerExtractor(new s4),this.registerExtractor(new c4);}classifyToken(r){return this.isKeyword(r)?"keyword":/^\.(once|prevent|stop|debounce|throttle|queue)(\(.*\))?$/.test(r)?"event-modifier":r.startsWith("#")||r.startsWith(".")||r.startsWith("[")||r.startsWith("*")||r.startsWith("<")?"selector":r.startsWith('"')||r.startsWith("'")||/^\d/.test(r)?"literal":r.startsWith("/")||r.startsWith("./")||r.startsWith("http")?"url":"identifier"}},D4=new x4;Ge("de",D4,Ba);function lr(r){let e=r.getAttribute("data-lang");if(e)return sr(e);let t=r.getAttribute("data-hyperscript-lang")??r.closest?.("[data-hyperscript-lang]")?.getAttribute("data-hyperscript-lang");if(t)return sr(t);let i=r.closest?.("[lang]")?.getAttribute("lang");if(i)return sr(i);let n=typeof document<"u"?document.documentElement?.lang:null;return n&&n!=="en"?sr(n):null}function sr(r){return r.split("-")[0].toLowerCase()}var Fa={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 S4=new Set(["repeat","for","while","tell"]),B4=new Set(["js"]);function cr(r){switch(r.kind){case "event-handler":return F4(r);case "compound":return Pa(r);case "loop":return T4(r);default:return P4(r)}}function T4(r){let e={kind:"command",action:r.action,roles:r.roles};return Pa({statements:[e,...r.body],chainType:"then"})}function F4(r){let e=["on"],t=r.roles.get("event");t&&e.push(t.type==="literal"?String(t.value):It(t));let i=r.roles.get("source");if(i&&e.push("from",It(i)),r.body&&r.body.length>0){let n=r.body.map(cr);e.push(n.join(" "));}return e.join(" ")}function Pa(r){let e=r.chainType==="async"?"async":r.chainType,t=r.statements.map(cr),i=t[0]??"";for(let n=1;n<t.length;n++){let a=r.statements[n-1],o=r.statements[n],u=a.kind==="command"&&S4.has(a.action),s=a.kind==="command"&&a.action==="bind"&&o.kind==="command"&&o.action==="bind";a.kind==="command"&&B4.has(a.action)&&(i+=" end"),i+=(u||s?" ":` ${e} `)+t[n];}return i}function P4(r){let e=Fa[r.action];if(e){let i=[r.action];for(let[n,a]of e){let o=r.roles.get(n);o&&((n==="destination"||n==="source")&&o.type==="reference"&&o.value==="me"&&o.implicit===true||(a&&i.push(a),i.push(It(o))));}return i.join(" ")}let t=[r.action];for(let[,i]of r.roles)t.push(It(i));return t.join(" ")}function It(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 R4(r);case "expression":return r.raw;case "flag":return r.enabled?`+${r.name}`:`~${r.name}`}}function R4(r){let e=It(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 O4={confidenceThreshold:.5,strategy:"semantic"};function L4(r,e){return typeof r=="number"?r:r[e]??r["*"]??.5}var N4=/^(on\s+(?:every\s+)?[\w-]+(?:\[.*?\])?(?:\.[\w-]+(?:\([^)]*\))?)*(?:\s+from\s+\S+)?(?:\s+queue\s+\w+)?\s+)/;function M4(r){let e=r.match(N4);if(!e)return null;let t=e[1],i=r.slice(t.length);return i?{prefix:t,commands:i}:null}function Ra(r){function e(n,a,o){try{return r.isLanguageRegistered(a)?r.translateSingle(n,a,o):null}catch{return null}}function t(n,a,o){try{let u=o(n,a);return u!==n?u:null}catch{return null}}function i(n,a,o){if(o.strategy==="semantic"||o.strategy==="auto"){let u=L4(o.confidenceThreshold,a),s=e(n,a,u);if(s!==null)return s}if((o.strategy==="auto"||o.strategy==="i18n")&&o.i18nToEnglish){let u=t(n,a,o.i18nToEnglish);if(u!==null)return u}return null}return function(a,o,u={}){if(o==="en")return a;let s={...O4,...u},l=i(a,o,s);if(l!==null)return l;let c=M4(a);if(c){let p=i(c.commands,o,s);if(p!==null)return c.prefix+p}return a}}var ri=Ra({isLanguageRegistered:hn,translateSingle(r,e,t){let i=ma(r,e);return i.confidence<t||!i.node?null:cr(i.node)}});var ii=new WeakSet;function _4(r){return (r.config?.attributes??"_, script, data-script").split(",").map(t=>t.trim()).filter(Boolean)}function I4(r,e){for(let t of e)if(r.hasAttribute(t))return t;return null}function Oa(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=_4(r),i=[...t.map(a=>`[${a}]`),'script[type="text/hyperscript"]'].join(", "),n=a=>{if(ii.has(a))return;if(a instanceof HTMLScriptElement&&a.type==="text/hyperscript"){let l=a.textContent??"";if(!l)return;let c=e(l,a);ii.add(a),c!=null&&c!==l&&(a.textContent=c);return}let o=I4(a,t);if(!o)return;let u=a.getAttribute(o);if(!u)return;let s=e(u,a);ii.add(a),s!=null&&s!==u&&a.setAttribute(o,s);};r.addBeforeProcessHook(a=>{!a||typeof a.querySelectorAll!="function"||(typeof a.matches=="function"&&a.matches(i)&&n(a),a.querySelectorAll(i).forEach(n));});}var $4=new Set(["me","my","i","it","its","you","your"]);function j4(r){for(let e of r?.features??[])for(let t of e.events??[])if(typeof t.on=="string"&&$4.has(t.on.toLowerCase()))return t.on}function Na(r,e){if(typeof r.parse!="function")return true;try{let t=r.parse(e);return t?.errors&&t.errors.length>0?!1:j4(t)===void 0}catch{return false}}var La=new Set;function Ma(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 ni(r={}){return function(t){let i=t;Oa(i,(n,a)=>{let o=W4(a,r);if(!o||o==="en")return n;let u=ri(n,o,r);if(u!==n){if(r.validateWithHost!==false&&!Na(i,u))return r.debug?console.log(`[hyperscript-i18n] ${o}: host rejected "${u}" \u2014 keeping "${n}"`):Ma(o,n,u),n;r.debug&&console.log(`[hyperscript-i18n] ${o}: "${n}" \u2192 "${u}"`);}return u});}}function W4(r,e){if(e.languageAttribute){let i=r.getAttribute(e.languageAttribute);if(i)return i.split("-")[0].toLowerCase()}let t=lr(r);return t||(e.defaultLanguage??null)}function _a(r,e,t={}){return e==="en"?r:ri(r,e,t)}function Ia(){typeof _hyperscript<"u"&&_hyperscript.use&&_hyperscript.use(ni());}var TE=["es","pt","fr","de"];Ia();
6
- exports.plugin=ni;exports.preprocess=_a;exports.resolveLanguage=lr;exports.supportedLanguages=TE;return exports;})({});
1
+ var HyperscriptI18n=(function(exports){'use strict';function pe(r,e){return e?{type:"literal",value:r,dataType:e}:{type:"literal",value:r}}function ur(r,e){return e?{type:"selector",value:r,selectorKind:e}:{type:"selector",value:r}}function lr(r){return {type:"reference",value:r}}function Wr(r,e){return {type:"property-path",object:r,property:e}}function gt(r,e=true){return {type:"flag",name:r,enabled:e}}function On(r,e,t){let n=e instanceof Map?e:new Map(Object.entries(e)),i={kind:"command",action:r,roles:n};return t?{...i,metadata:t}:i}function kt(r,e,t,n,i){let a=e instanceof Map?e:new Map(Object.entries(e));return {kind:"event-handler",action:r,roles:a,body:t,...i,...n&&{metadata:n}}}function Rn(r,e,t,n,i){let a=e instanceof Map?e:new Map(Object.entries(e));return {kind:"conditional",action:r,roles:a,thenBranch:t,...n&&{elseBranch:n},...i&&{metadata:i}}}function Ln(r,e,t,n,i,a,o){let s=e instanceof Map?e:new Map(Object.entries(e));return {kind:"loop",action:r,roles:s,loopVariant:t,body:n,...i&&{loopVariable:i},...a&&{indexVariable:a},...o&&{metadata:o}}}var wt=new Set(["me","you","it","result","event","target","body","document","window","detail"]);function Vr(r,e=wt){return e.has(r)}var Fn=new Set(["body","then","else","condition","loop-body","variable","catch","finally"]),Fo=new Set(["repeat","for"]),Po=new Set(["loop-variant","index-variable"]);function qr(r,e={}){let t=r.trim(),n=e.collectDiagnostics===true,i=[];if(!t.startsWith("[")||!t.endsWith("]"))throw new Error("Explicit syntax must be wrapped in brackets: [command role:value ...]");let a=t.slice(1,-1).trim();if(!a)throw new Error("Empty explicit statement");let o=Lo(a);if(o.length===0)throw new Error("No command specified in explicit statement");let s=o[0].toLowerCase(),u=new Map,l=e.referenceSet??wt,c=e.schemaLookup?.getSchema(s),d=c?new Set(c.roles.map(m=>m.role)):null;for(let m=1;m<o.length;m++){let f=o[m];if(f.startsWith("+")||f.startsWith("~")){let b=f.startsWith("+"),g=f.slice(1);if(!g){if(n){i.push({severity:"error",code:"EMPTY_FLAG",message:`Empty flag name: "${f}"`,source:"schema"});continue}throw new Error(`Empty flag name: "${f}"`)}if(d&&!d.has(g)){if(n){i.push({severity:"error",code:"UNKNOWN_FLAG",message:`Unknown flag "${g}" for command "${s}"`,source:"schema",suggestions:[...d].map(C=>`+${C}`)}),u.set(g,gt(g,b));continue}throw new Error(`Unknown flag "${g}" for command "${s}". Valid roles: ${[...d].join(", ")}`)}u.set(g,gt(g,b));continue}let v=f.indexOf(":");if(v===-1){if(n){i.push({severity:"error",code:"INVALID_ROLE_FORMAT",message:`Invalid role format: "${f}". Expected role:value or +flag`,source:"schema"});continue}throw new Error(`Invalid role format: "${f}". Expected role:value or +flag`)}let E=f.slice(0,v);if(d&&!Fn.has(E)&&!(Fo.has(s)&&Po.has(E))&&!d.has(E))if(n)i.push({severity:"error",code:"UNKNOWN_ROLE",message:`Unknown role "${E}" for command "${s}"`,source:"schema",suggestions:[...d]});else throw new Error(`Unknown role "${E}" for command "${s}". Valid roles: ${[...d].join(", ")}`);let h=E,y=f.slice(v+1);if(Fn.has(E)&&y.startsWith("[")){let b=_o(f,v+1),g=f.slice(v+1,b+1);u.set(h,{type:"expression",raw:g});continue}let k=No(y,l);u.set(h,k);}if(c&&s!=="on"){for(let m of c.roles)if(m.required&&!u.has(m.role)&&!m.default)if(n)i.push({severity:"error",code:"MISSING_REQUIRED_ROLE",message:`Missing required role "${m.role}" for command "${s}": ${m.description}`,source:"schema"});else throw new Error(`Missing required role "${m.role}" for command "${s}": ${m.description}`)}let p=m=>i.length===0?m:{...m,diagnostics:i};switch(s){case "on":{if(!u.get("event")){if(n)return i.push({severity:"error",code:"MISSING_EVENT_ROLE",message:"Event handler requires event role: [on event:click ...]",source:"schema"}),p(kt("on",u,[],{sourceLanguage:"explicit"}));throw new Error("Event handler requires event role: [on event:click ...]")}let f=jr(u,"body",e);return u.delete("body"),p(kt("on",u,f,{sourceLanguage:"explicit"}))}case "if":{let m=jr(u,"then",e),f=jr(u,"else",e);return u.delete("then"),u.delete("else"),p(Rn(s,u,m,f.length>0?f:void 0,{sourceLanguage:"explicit"}))}case "repeat":case "for":{let m=jr(u,"loop-body",e),f=u.get("loop-variant"),v=u.get("variable"),E=u.get("index-variable");u.delete("loop-body"),u.delete("loop-variant"),u.delete("variable"),u.delete("index-variable");let h;f&&f.type==="literal"&&typeof f.value=="string"?h=f.value:u.has("quantity")?h="times":u.has("source")?h="for":u.has("condition")?h="while":h="forever";let y=v?.type==="literal"&&typeof v.value=="string"?v.value:v?.type==="expression"?v.raw:void 0,k=E?.type==="literal"&&typeof E.value=="string"?E.value:void 0;return p(Ln(s,u,h,m,y,k,{sourceLanguage:"explicit"}))}default:return p(On(s,u,{sourceLanguage:"explicit"}))}}function zt(r){let e=r.trim();return e.startsWith("[")&&e.endsWith("]")}function jr(r,e,t){let n=r.get(e);return n?n.type==="expression"?[qr(n.raw,t)]:[]:[]}function Oo(r){let e="";for(let t of r){if(e){t===e&&(e="");continue}if(t==='"'||t==="'"){e=t;continue}if(t===" "||t===">"||t==="+"||t==="~"||t===",")return true}return false}function Pn(r){if(r){if(Oo(r))return "complex";if(r.startsWith("#"))return "id";if(r.startsWith("."))return "class";if(r.startsWith("["))return "attribute";if(r.startsWith("*"))return "element"}}function Ro(r){if(!r.includes("\\"))return r;let e="";for(let t=0;t<r.length;t++){if(r[t]==="\\"&&t+1<r.length){let n=r[t+1],i=n==="\\"?"\\":n==='"'?'"':n==="'"?"'":n==="n"?`
2
+ `:n==="r"?"\r":n==="t"?" ":"";if(i){e+=i,t++;continue}}e+=r[t];}return e}function Lo(r){let e=[],t="",n=false,i="",a=false,o=0;for(let s=0;s<r.length;s++){let u=r[s];if(n){if(t+=u,u===i){let l=0;for(let c=s-1;c>=0&&r[c]==="\\";c--)l++;l%2===0&&(n=false);}continue}if(u==='"'||u==="'"){n=true,i=u,t+=u;continue}if(a){t+=u,u===">"&&t.endsWith("/>")&&(a=false);continue}if(u==="<"&&(t===""||t.endsWith(":"))){a=true,t+=u;continue}if(u==="["){o++,t+=u;continue}if(u==="]"){o--,t+=u;continue}if(u===" "&&o===0){t&&(e.push(t),t="");continue}t+=u;}return t&&e.push(t),e}function No(r,e){if(r.startsWith("<")){if(!r.endsWith("/>"))throw new Error(`Unterminated selector literal: "${r}". Expected a closing "/>"`);let i=r.slice(1,-2);if(!i)throw new Error(`Empty selector literal: "${r}"`);return ur(i,Pn(i))}if(r.startsWith("#")||r.startsWith(".")||r.startsWith("[")||r.startsWith("@")||r.startsWith("*"))return ur(r,Pn(r));if(r.startsWith('"')||r.startsWith("'"))return pe(Ro(r.slice(1,-1)),"string");if(r==="true")return pe(true,"boolean");if(r==="false")return pe(false,"boolean");let t=r.toLowerCase();if(Vr(t,e))return lr(t);let n=r.match(/^(-?\d+(?:\.\d+)?)(ms|s|m|h)?$/);if(n){let i=parseFloat(n[1]);return n[2]?pe(r,"duration"):pe(i,"number")}return pe(r)}function _o(r,e){let t=0;for(let n=e;n<r.length;n++)if(r[n]==="[")t++;else if(r[n]==="]"&&(t--,t===0))return n;return r.length-1}function xe(r){let e;if(r.kind==="compound"){let t=r;e=t.statements.map(n=>xe(n)).join(` ${t.chainType} `);}else e=Mo(r);return r.annotations&&r.annotations.length>0?r.annotations.map(n=>n.value!==void 0?`@${n.name}(${n.value})`:`@${n.name}`).join(" ")+" "+e:e}function Mo(r){let e=[r.action];for(let[t,n]of r.roles)n.type==="flag"?e.push(n.enabled?`+${n.name}`:`~${n.name}`):e.push(`${t}:${Nn(n)}`);if(r.kind==="event-handler"){let t=r;t.body&&t.body.length>0&&e.push(`body:${t.body.map(n=>xe(n)).join(" ")}`);}if(r.kind==="conditional"){let t=r;t.thenBranch&&t.thenBranch.length>0&&e.push(`then:${t.thenBranch.map(n=>xe(n)).join(" ")}`),t.elseBranch&&t.elseBranch.length>0&&e.push(`else:${t.elseBranch.map(n=>xe(n)).join(" ")}`);}if(r.kind==="loop"){let t=r;t.loopVariant&&e.push(`loop-variant:${t.loopVariant}`),t.loopVariable&&e.push(`variable:${t.loopVariable}`),t.indexVariable&&e.push(`index-variable:${t.indexVariable}`),t.body&&t.body.length>0&&e.push(`loop-body:${t.body.map(n=>xe(n)).join(" ")}`);}if(r.kind==="command"){let t=r;t.body&&t.body.length>0&&e.push(`body:${t.body.map(n=>xe(n)).join(" ")}`),t.catchBranch&&t.catchBranch.length>0&&e.push(`catch:${t.catchBranch.map(n=>xe(n)).join(" ")}`),t.finallyBranch&&t.finallyBranch.length>0&&e.push(`finally:${t.finallyBranch.map(n=>xe(n)).join(" ")}`),t.asyncVariant&&e.push(`async-variant:${t.asyncVariant}`),t.asyncBody&&t.asyncBody.length>0&&e.push(`async-body:${t.asyncBody.map(n=>xe(n)).join(" ")}`);}return `[${e.join(" ")}]`}function Io(r){if(r.includes(" "))return true;let e=r[0];return !(e==="#"||e==="."||e==="@"||e==="*")}function Nn(r){switch(r.type){case "literal":return typeof r.value=="string"?r.dataType==="string"||/\s/.test(r.value)?JSON.stringify(r.value):r.value:String(r.value);case "selector":return r.value&&Io(r.value)?`<${r.value}/>`:r.value;case "reference":return r.value;case "property-path":return `${Nn(r.object)}'s ${r.property}`;case "expression":return r.raw;case "flag":return r.name}}var $o=class{constructor(r){this.namespace=r,this.enabled=this.checkEnabled();}checkEnabled(){if(typeof process<"u"&&process.env){let r=process.env.DEBUG||"";return r==="*"||r.includes("framework:*")||r.includes(`framework:${this.namespace}`)}return false}log(r,e,...t){if(!this.enabled)return;let n=`[framework:${this.namespace}]`,i=new Date().toISOString();switch(r){case "debug":console.debug(`${i} ${n} DEBUG:`,e,...t);break;case "info":console.info(`${i} ${n} INFO:`,e,...t);break;case "warn":console.warn(`${i} ${n} WARN:`,e,...t);break;case "error":console.error(`${i} ${n} ERROR:`,e,...t);break}}debug(r,...e){this.log("debug",r,...e);}info(r,...e){this.log("info",r,...e);}warn(r,...e){this.log("warn",r,...e);}error(r,...e){this.log("error",r,...e);}isEnabled(){return this.enabled}enable(){this.enabled=true;}disable(){this.enabled=false;}};function jo(r){return new $o(r)}function cr(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 Wo(r,e){return r?.possessive?.keywords?.[e]}var Dr=class dr{constructor(){this.logger=jo("pattern-matcher"),this.stemMatchCount=0,this.totalKeywordMatches=0;}safeToLowerCase(e){return typeof e=="string"?e.toLowerCase():e==null?"":String(e).toLowerCase()}matchPattern(e,t,n){let i=e.mark(),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 u=[];for(let l=0;l<10;l++){let c=e.peek(l);if(c)u.push({type:c.type,value:c.value,kind:c.kind});else break}this.logger.debug("Input tokens (first 10):",u),this.logger.debug("Profile code:",n?.code);}this.currentProfile=n,this.stemMatchCount=0,this.totalKeywordMatches=0,this.logger.debug("--- Calling matchTokenSequence ---"),this.logger.debug("Pattern tokens to match:",JSON.stringify(t.template.tokens,null,2));let o=this.matchTokenSequence(e,t.template.tokens,a);if(this.logger.debug("matchTokenSequence returned:",o),this.logger.debug("Captured roles:",Array.from(a.entries()).map(([u,l])=>[u,JSON.stringify(l)])),!o)return this.logger.debug(">>> MATCH FAILED - resetting token position"),e.reset(i),null;let s=this.calculateConfidence(t,a);return this.applyExtractionRules(t,a),{pattern:t,captured:a,consumedTokens:e.position()-i.position,confidence:s}}matchBest(e,t,n){let i=[];for(let o of t){let s=e.mark(),u=this.matchPattern(e,o,n);u&&i.push(u),e.reset(s);}if(i.length===0)return null;i.sort((o,s)=>{let u=s.pattern.priority-o.pattern.priority;if(u!==0)return u;let l=s.confidence-o.confidence;return Math.abs(l)>.001?l:s.consumedTokens-o.consumedTokens});let a=i[0];return this.matchPattern(e,a.pattern),a}matchTokenSequence(e,t,n,i){let a=t[0],o=a?.type==="literal"&&(a.value==="and"||a.value==="then"||a.alternatives?.includes("and")||a.alternatives?.includes("then"));if(this.currentProfile?.code==="ar"&&!o)for(;e.peek()?.kind==="conjunction";)e.advance();let s=null,u=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 E=this.collectStopMarkers(t,l+1);if(i)for(let y of i)E.add(y);let h=[];for(;!e.isAtEnd();){let y=e.peek();if(!y||this.isStopMarker(y,E))break;h.push(y.value),e.advance();}if(h.length>0){n.set(c.role,{type:"expression",raw:h.join(" ")}),s=null,u=null;continue}else {if(c.optional)continue;return false}}if(c.type==="group"){let E=this.collectStopMarkers(t,l+1);if(i)for(let y of i)E.add(y);if(this.matchGroupToken(e,c,n,E)){s=null,u=null;continue}if(this.isOptional(c))continue;return false}let p=c.type==="role"&&c.optional===true,m=p?e.mark():null;if(c.type==="role"&&!p){let E=l+1<t.length?t[l+1]:null;if(E?.type==="literal"){let h=e.peek();if(h&&this.getMatchType(h,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(s&&u){this.logger.debug(" >> BACKTRACKING: undoing optional role",u),e.reset(s),n.delete(u),s=null,u=null;let y=this.matchPatternToken(e,c,n);if(this.logger.debug(" >> Backtrack retry result:",y),y)continue}return false}}}let v=this.matchPatternToken(e,c,n);if(this.logger.debug(" >> Match result:",v),v){p?(s=m,u=c.role):(s=null,u=null);continue}if(this.logger.debug(" >> Token match FAILED"),!this.isOptional(c)){if(s&&u){this.logger.debug(" >> BACKTRACKING: undoing optional role",u),e.reset(s),n.delete(u),s=null,u=null;let E=this.matchPatternToken(e,c,n);if(this.logger.debug(" >> Backtrack retry result:",E),E)continue}return false}}return true}matchPatternToken(e,t,n){switch(t.type){case "literal":return this.matchLiteralToken(e,t);case "role":return this.matchRoleToken(e,t,n);case "group":return this.matchGroupToken(e,t,n);default:return false}}matchLiteralToken(e,t){let n=e.peek();if(this.logger.debug(" >>> matchLiteralToken: expecting",t.value),this.logger.debug(" >>> matchLiteralToken: got token",n?JSON.stringify({type:n.type,value:n.value,kind:n.kind}):"null"),!n)return this.logger.debug(" >>> matchLiteralToken: FAIL - no token"),false;let i=this.getMatchType(n,t.value);if(this.logger.debug(" >>> matchType for",n.value,"vs",t.value,":",i),i!=="none")return this.totalKeywordMatches++,i==="stem"&&this.stemMatchCount++,e.advance(),true;if(t.alternatives)for(let a of t.alternatives){let o=this.getMatchType(n,a);if(o!=="none")return this.totalKeywordMatches++,o==="stem"&&this.stemMatchCount++,e.advance(),true}return false}matchRoleToken(e,t,n){this.logger.debug(" >>> matchRoleToken ENTRY: capturing role",t.role),this.logger.debug(" >>> matchRoleToken: expected types",t.expectedTypes),this.logger.debug(" >>> matchRoleToken: optional?",t.optional),this.skipNoiseWords(e);let i=e.peek();if(this.logger.debug(" >>> After skipNoiseWords, current token:",i?JSON.stringify({value:i.value,kind:i.kind}):"null"),!i)return t.optional||false;let a=this.tryMatchPossessiveExpression(e);if(a)return t.expectedTypes&&t.expectedTypes.length>0&&!cr(a.type,t.expectedTypes)?t.optional||false:(n.set(t.role,a),true);let o=this.tryMatchMethodCallExpression(e);if(o)return t.expectedTypes&&t.expectedTypes.length>0&&!cr(o.type,t.expectedTypes)?t.optional||false:(n.set(t.role,o),true);let s=this.tryMatchPossessiveSelectorExpression(e);if(s)return t.expectedTypes&&t.expectedTypes.length>0&&!cr(s.type,t.expectedTypes)?t.optional||false:(n.set(t.role,s),true);let u=this.tryMatchPropertyAccessExpression(e);if(u)return t.expectedTypes&&t.expectedTypes.length>0&&!cr(u.type,t.expectedTypes)?t.optional||false:(n.set(t.role,u),true);let l=this.tryMatchSelectorPropertyExpression(e);if(l)return t.expectedTypes&&t.expectedTypes.length>0&&!cr(l.type,t.expectedTypes)?t.optional||false:(n.set(t.role,l),true);this.logger.debug(" >>> Trying tokenToSemanticValue for token:",i?JSON.stringify({value:i.value,kind:i.kind}):"null");let c=this.tokenToSemanticValue(i);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&&!cr(c.type,t.expectedTypes)?(this.logger.debug(" >>> TYPE MISMATCH - returning",t.optional||false),t.optional||false):(this.logger.debug(" >>> Type validation PASSED"),n.set(t.role,c),e.advance(),true)):t.optional||false}tryMatchPossessiveExpression(e){let t=e.peek();if(!t||!this.currentProfile)return null;let n=t.normalized||t.value,i=this.safeToLowerCase(n),a=Wo(this.currentProfile,i);if(!a)return null;let o=e.mark();e.advance();let s=e.peek();if(!s)return e.reset(o),null;if(s.kind==="identifier"||s.kind==="keyword"&&!this.isStructuralKeyword(s.value)||s.kind==="selector"&&s.value.startsWith("*")||s.kind==="selector"&&s.value.startsWith("@")||s.kind==="selector"&&s.value.startsWith(".")&&/^\.[a-zA-Z_]\w*/.test(s.value)){e.advance();let u=s.value;s.kind==="selector"&&u.startsWith(".")&&/^\.[a-zA-Z_]\w*/.test(u)&&(u=u.substring(1));let l=u;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()),Wr(lr(a),l)}return e.reset(o),null}isStructuralKeyword(e){return new Set(["into","in","to","from","at","by","with","without","before","after","of","as","on","then","end","else","if","repeat","while","for","toggle","add","remove","put","set","show","hide","increment","decrement","send","trigger","call"]).has(e.toLowerCase())}tryMatchMethodCallExpression(e){let t=e.peek();if(!t||t.kind!=="selector")return null;let n=e.mark();e.advance();let i=e.peek();if(!i||i.kind!=="operator"||i.value!==".")return e.reset(n),null;e.advance();let a=e.peek();if(!a||a.kind!=="identifier")return e.reset(n),null;e.advance();let o=e.peek();if(!o||o.kind!=="punctuation"||o.value!=="(")return e.reset(n),null;e.advance();let s=[];for(;!e.isAtEnd()&&s.length<dr.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}s.push(l.value),e.advance();}return {type:"expression",raw:`${t.value}.${a.value}(${s.join(", ")})`}}tryMatchPropertyAccessExpression(e){let t=e.peek();if(!t||t.kind!=="identifier"&&t.kind!=="keyword")return null;let n=e.mark();e.advance();let i=e.peek();if(!i||i.kind!=="operator"||i.value!==".")return e.reset(n),null;e.advance();let a=e.peek();if(!a||a.kind!=="identifier")return e.reset(n),null;e.advance();let o=`${t.value}.${a.value}`,s=1;for(;!e.isAtEnd()&&s<dr.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(),o+=`.${c.value}`,s++;}let u=e.peek();if(u&&u.kind==="punctuation"&&u.value==="("){e.advance();let l=[],c=0;for(;!e.isAtEnd()&&l.length<dr.MAX_METHOD_ARGS;){let p=e.peek();if(!p)break;if(p.kind==="punctuation"&&p.value===")"){if(c===0){e.advance();break}c--;}if(p.kind==="punctuation"&&p.value==="("&&c++,p.kind==="punctuation"&&p.value===","){e.advance();continue}l.push(p.value),e.advance();}return {type:"expression",raw:`${o}(${l.join(", ")})`}}return {type:"expression",raw:o}}tryMatchPossessiveSelectorExpression(e){let t=e.peek();if(!t||t.kind!=="selector")return null;let n=e.mark();e.advance();let i=e.peek();if(!i||i.kind!=="punctuation"||i.value!=="'s")return e.reset(n),null;e.advance();let a=e.peek();return !a||a.kind!=="selector"&&a.kind!=="identifier"?(e.reset(n),null):(e.advance(),Wr(ur(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 n=e.mark();e.advance();let i=e.peek();if(!i||i.kind!=="selector"||!i.value.startsWith("."))return e.reset(n),null;let a=e.peek(1);a&&a.kind,e.advance();let o=i.value.slice(1);return Wr(ur(t.value),o)}matchGroupToken(e,t,n,i){let a=e.mark(),o=new Set(n.keys());if(this.matchTokenSequence(e,t.tokens,n,i))return true;e.reset(a);for(let l of n.keys())o.has(l)||n.delete(l);if(!t.optional)return false;let u=this.getGroupLeadingMarker(t);if(u)for(let l=1;l<=dr.MAX_MARKER_SCAN;l++){let c=e.peek(l);if(!c)break;if((c.normalized||c.value).toLowerCase()===u){this.logger.debug(" >> MARKER SCAN: found",u,"at offset",l,"- skipping intervening tokens");for(let m=0;m<l;m++)e.advance();if(this.matchTokenSequence(e,t.tokens,n,i))return true;e.reset(a);for(let m of n.keys())o.has(m)||n.delete(m);break}}return true}getGroupLeadingMarker(e){let t=e.tokens[0];return t?.type==="literal"?t.value.toLowerCase():null}getMatchType(e,t){return e.value===t?"exact":e.normalized===t?"normalized":e.stem===t&&e.stemConfidence!==void 0&&e.stemConfidence>=.7?"stem":e.kind==="keyword"&&this.safeToLowerCase(e.value)===t.toLowerCase()?"case-insensitive":"none"}collectStopMarkers(e,t){let n=new Set;for(let i=t;i<e.length;i++){let a=e[i];if(a.type==="literal"){if(n.add(a.value.toLowerCase()),a.alternatives)for(let o of a.alternatives)n.add(o.toLowerCase());break}if(a.type==="group"){for(let o of a.tokens)if(o.type==="literal"){if(n.add(o.value.toLowerCase()),o.alternatives)for(let s of o.alternatives)n.add(s.toLowerCase());break}if(!a.optional)break}}return n}isStopMarker(e,t){return t.size===0?false:!!(t.has(e.value.toLowerCase())||e.normalized&&t.has(e.normalized.toLowerCase()))}tokenToSemanticValue(e){switch(e.kind){case "selector":return ur(e.value);case "literal":return this.parseLiteralValue(e.value);case "keyword":let t=e.normalized||e.value;this.safeToLowerCase(t);return pe(e.normalized||e.value);case "identifier":if(typeof e.value=="string"&&e.value.startsWith(":"))return lr(e.value);this.safeToLowerCase(e.value);return {type:"expression",raw:e.value};case "url":return pe(e.value,"string");default:return null}}parseLiteralValue(e){if(e.startsWith('"')||e.startsWith("'")||e.startsWith("`")||e.startsWith("\u300C")){let i=e.slice(1,-1);return pe(i,"string")}if(e==="true")return pe(true,"boolean");if(e==="false")return pe(false,"boolean");let t=e.match(/^(\d+(?:\.\d+)?)(ms|s|m|h)?$/);if(t){let i=parseFloat(t[1]);return t[2]?pe(e,"duration"):pe(i,"number")}let n=parseFloat(e);return isNaN(n)?pe(e,"string"):pe(n,"number")}applyExtractionRules(e,t){for(let[n,i]of Object.entries(e.extraction))t.has(n)||(i.value!==void 0?t.set(n,{type:"literal",value:i.value}):i.default&&t.set(n,i.default));}isOptional(e){return e.type!=="literal"&&e.optional===true}calculateConfidence(e,t){let n=0,i=0,a=l=>e.extraction?.[l]?.default!==void 0;for(let l of e.template.tokens)if(l.type==="role")i+=1,t.has(l.role)&&(n+=1);else if(l.type==="group"){for(let c of l.tokens)if(c.type==="role"){let d=a(c.role),p=.8;i+=p,t.has(c.role)?n+=p:d&&(n+=p*.6);}}let o=i>0?n/i:1;if(this.stemMatchCount>0&&this.totalKeywordMatches>0){let l=this.stemMatchCount/this.totalKeywordMatches*.15;o=Math.max(.5,o-l);}let s=this.calculateVSOConfidenceBoost(e);o=Math.min(1,o+s);let u=this.arabicPrepositionDisambiguation(e,t);return o=Math.max(0,Math.min(1,o+u)),o}calculateVSOConfidenceBoost(e){if(e.language!=="ar")return 0;let t=e.template.tokens[0];if(!t||t.type!=="literal")return 0;let n=new Set(["\u0628\u062F\u0644","\u063A\u064A\u0631","\u0623\u0636\u0641","\u0623\u0632\u0644","\u0636\u0639","\u0627\u062C\u0639\u0644","\u0639\u064A\u0646","\u0632\u062F","\u0627\u0646\u0642\u0635","\u0633\u062C\u0644","\u0623\u0638\u0647\u0631","\u0623\u062E\u0641","\u0634\u063A\u0644","\u0623\u0631\u0633\u0644","\u0631\u0643\u0632","\u0634\u0648\u0634","\u062A\u0648\u0642\u0641","\u0627\u0646\u0633\u062E","\u0627\u062D\u0630\u0641","\u0627\u0635\u0646\u0639","\u0627\u0646\u062A\u0638\u0631","\u0627\u0646\u062A\u0642\u0627\u0644","\u0623\u0648"]);if(n.has(t.value))return .15;if(t.alternatives){for(let i of t.alternatives)if(n.has(i))return .15}return 0}arabicPrepositionDisambiguation(e,t){if(e.language!=="ar")return 0;let n=0,i={patient:["\u0639\u0644\u0649"],destination:["\u0625\u0644\u0649","\u0627\u0644\u0649"],source:["\u0645\u0646"],agent:["\u0645\u0646"],manner:["\u0628"],style:["\u0628"],goal:["\u0625\u0644\u0649","\u0627\u0644\u0649"],method:["\u0628"]};for(let[a,o]of t.entries()){let s=i[a];if(!s||s.length===0)continue;let u="metadata"in o?o.metadata:void 0;if(u&&typeof u.prepositionValue=="string"){let l=u.prepositionValue;s.includes(l)?n+=.1:n-=.1;}}return Math.max(-0.1,Math.min(.1,n))}skipNoiseWords(e){let t=e.peek();if(!t)return;let n=this.safeToLowerCase(t.value);if(dr.ENGLISH_NOISE_WORDS.has(n)){let i=e.mark();e.advance();let a=e.peek();if(a&&a.kind==="selector")return;e.reset(i);}n==="class"&&e.advance();}extractEventModifiers(e){let t={},n=false;for(;!e.isAtEnd();){let i=e.peek();if(!i||i.kind!=="event-modifier")break;let a=i.metadata;if(!a)break;switch(n=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 n?t:void 0}};Dr.MAX_MARKER_SCAN=3;Dr.MAX_PROPERTY_DEPTH=10;Dr.MAX_METHOD_ARGS=20;Dr.ENGLISH_NOISE_WORDS=new Set(["the","a","an"]);var Vo=Dr;new Vo;var Te=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 n=1,i=false;for(;e+n<r.length;){let a=r[e+n];if(i){i=false,n++;continue}if(a==="\\"){i=true,n++;continue}if(a===t)return n++,{value:r.substring(e,e+n),length:n};n++;}return null}},Fe=class{constructor(){this.name="number";}canExtract(r,e){return /\d/.test(r[e])}extract(r,e){let t=0,n=false;for(;e+t<r.length;){let o=r[e+t];if(/\d/.test(o))t++;else if(o==="."&&!n)n=true,t++;else break}if(t===0)return null;let i=r.substring(e,e+t),a=e+t;if(a<r.length){let o=r.slice(a),s=[{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 s)if(o.startsWith(l.pattern))return {value:i+l.suffix,length:t+l.pattern.length,metadata:{hasTimeUnit:true}};if(o.startsWith("ms"))return {value:i+"ms",length:t+2,metadata:{hasTimeUnit:true}};let u=[{pattern:"\u79D2",suffix:"s"},{pattern:"\u5206",suffix:"m"}];for(let l of u)if(o.startsWith(l.pattern))return {value:i+l.suffix,length:t+1,metadata:{hasTimeUnit:true}};if(/^[smh](?![a-zA-Z])/.test(o))return {value:i+o[0],length:t+1,metadata:{hasTimeUnit:true}}}return {value:i,length:t}}};function qo(r){return "setContext"in r&&typeof r.setContext=="function"}function Ko(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 he=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 ie(r,e){return {start:r,end:e}}function ae(r,e,t,n){if(typeof r=="object"){let{value:a,kind:o,position:s,normalized:u,stem:l,stemConfidence:c,metadata:d}=r;return {value:a,kind:o,position:s,...u!==void 0&&{normalized:u},...l!==void 0&&{stem:l},...c!==void 0&&{stemConfidence:c},...d!==void 0&&{metadata:d}}}let i=r;if(!e||!t)throw new Error("createToken requires kind and position parameters");if(typeof n=="string")return {value:i,kind:e,position:t,normalized:n};if(n){let{normalized:a,stem:o,stemConfidence:s,metadata:u}=n;return {value:i,kind:e,position:t,...a!==void 0&&{normalized:a},...o!==void 0&&{stem:o},...s!==void 0&&{stemConfidence:s},...u!==void 0&&{metadata:u}}}return {value:i,kind:e,position:t}}function Xe(r){return /\s/.test(r)}function Ho(r){return r==="#"||r==="."||r==="["||r==="@"||r==="*"||r==="<"}function Uo(r){return r==='"'||r==="'"||r==="`"||r==="\u300C"||r==="\u300D"}function Ze(r){return /\d/.test(r)}function Hr(r){return r.replace(/[\u064b-\u0652\u0670]/g,"")}function Go(r){return /[a-zA-Z]/.test(r)}function ke(r){return /[a-zA-Z0-9_-]/.test(r)}function Yo(r,e){if(e>=r.length)return null;let t=r[e];if(!Ho(t))return null;let n=e,i="";if(t==="#"||t==="."){for(i+=r[n++];n<r.length&&ke(r[n]);)i+=r[n++];if(i.length<=1)return null;if(n<r.length&&r[n]==="."&&t==="#"){let o=n+1;for(;o<r.length&&ke(r[o]);)o++;if(o<r.length&&r[o]==="(")return i}}else if(t==="["){let a=1,o=false,s=null,u=false;for(i+=r[n++];n<r.length&&a>0;){let l=r[n];i+=l,u?u=false:l==="\\"?u=true:o?l===s&&(o=false,s=null):l==='"'||l==="'"||l==="`"?(o=true,s=l):l==="["?a++:l==="]"&&a--,n++;}if(a!==0)return null}else if(t==="@"){for(i+=r[n++];n<r.length&&ke(r[n]);)i+=r[n++];if(i.length<=1)return null}else if(t==="*"){for(i+=r[n++];n<r.length&&ke(r[n]);)i+=r[n++];if(i.length<=1)return null}else if(t==="<"){if(i+=r[n++],n>=r.length||!Go(r[n]))return null;for(;n<r.length&&ke(r[n]);)i+=r[n++];for(;n<r.length;){let a=r[n];if(a==="."){if(i+=r[n++],n>=r.length||!ke(r[n]))return null;for(;n<r.length&&ke(r[n]);)i+=r[n++];}else if(a==="#"){if(i+=r[n++],n>=r.length||!ke(r[n]))return null;for(;n<r.length&&ke(r[n]);)i+=r[n++];}else if(a==="["){let o=1,s=false,u=null,l=false;for(i+=r[n++];n<r.length&&o>0;){let c=r[n];i+=c,l?l=false:c==="\\"?l=true:s?c===u&&(s=false,u=null):c==='"'||c==="'"||c==="`"?(s=true,u=c):c==="["?o++:c==="]"&&o--,n++;}if(o!==0)return null}else break}for(;n<r.length&&Xe(r[n]);)i+=r[n++];if(n<r.length&&r[n]==="/")for(i+=r[n++];n<r.length&&Xe(r[n]);)i+=r[n++];if(n>=r.length||r[n]!==">")return null;i+=r[n++];}return i||null}function Zo(r,e){if(e>=r.length||r[e]!=="'"||e+1>=r.length||r[e+1].toLowerCase()!=="s")return false;if(e+2>=r.length)return true;let n=r[e+2];return Xe(n)||n==="*"||!ke(n)}function Xo(r,e){if(e>=r.length)return null;let t=r[e];if(!Uo(t)||t==="'"&&Zo(r,e))return null;let i={'"':'"',"'":"'","`":"`","\u300C":"\u300D"}[t];if(!i)return null;let a=e+1,o=t,s=false;for(;a<r.length;){let u=r[a];if(o+=u,s)s=false;else if(u==="\\")s=true;else if(u===i)return o;a++;}return o}function Jo(r,e){if(e>=r.length)return false;let t=r[e],n=r[e+1]||"",i=r[e+2]||"";if(t==="/"&&n!=="/"&&/[a-zA-Z0-9._-]/.test(n)||t==="/"&&n==="/"&&/[a-zA-Z]/.test(i)||t==="."&&(n==="/"||n==="."&&i==="/"))return true;let a=r.slice(e,e+8).toLowerCase();return !!(a.startsWith("http://")||a.startsWith("https://"))}function Qo(r,e){if(!Jo(r,e))return null;let t=e,n="",i=/[a-zA-Z0-9/:._\-?&=%@+~!$'()*,;[\]]/;for(;t<r.length;){let a=r[t];if(a==="#"){if(n.length>0&&/[a-zA-Z0-9/.]$/.test(n))for(n+=a,t++;t<r.length&&/[a-zA-Z0-9_-]/.test(r[t]);)n+=r[t++];break}if(i.test(a))n+=a,t++;else break}return n.length<2?null:n}function es(r,e){if(e>=r.length)return null;let t=r[e];if(!Ze(t)&&t!=="-"&&t!=="+")return null;let n=e,i="";if((r[n]==="-"||r[n]==="+")&&(i+=r[n++]),n>=r.length||!Ze(r[n]))return null;for(;n<r.length&&Ze(r[n]);)i+=r[n++];if(n<r.length&&r[n]===".")for(i+=r[n++];n<r.length&&Ze(r[n]);)i+=r[n++];return n<r.length&&(r.slice(n,n+2)==="ms"?i+="ms":(r[n]==="s"||r[n]==="m"||r[n]==="h")&&(i+=r[n])),i}var rs=["===","!==","->","==","!=","<=",">=","&&","||","**","+=","-=","*=","/=","+","-","*","/","=",">","<","!","&","|","%","^","~"];new Set(rs);var ts=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 ns(r){return r.includes("-")&&/^[\p{L}\p{N}_]+(-[\p{L}\p{N}_]+)+$/u.test(r)}var is=["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 Kr{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){qo(e)&&e.setContext(Ko(this)),this.extractors.push(e);}registerExtractors(e){for(let t of e)this.registerExtractor(t);}clearExtractors(){this.extractors=[];}isUsingExtractors(){return this.extractors.length>0}tokenizeWithExtractors(e){let t=[],n=0;for(;n<e.length;){for(;n<e.length&&Xe(e[n]);)n++;if(n>=e.length)break;let i=this.tryMultiWordKeyword(e,n);if(i){t.push(i),n=i.position.end;continue}let a=false;for(let o of this.extractors)if(o.canExtract(e,n)){let s=o.extract(e,n);if(s){let u=s.metadata?.normalized,l=s.metadata?.stem,c=s.metadata?.stemConfidence,d={};if(s.metadata)for(let[m,f]of Object.entries(s.metadata))m!=="normalized"&&m!=="stem"&&m!=="stemConfidence"&&(d[m]=f);let p={};u&&(p.normalized=u),l&&(p.stem=l),c!==void 0&&(p.stemConfidence=c),Object.keys(d).length>0&&(p.metadata=d),t.push(ae(s.value,this.classifyToken(s.value),ie(n,n+s.length),Object.keys(p).length>0?p:void 0)),n+=s.length,a=true;break}}if(!a){let o=e[n],s=this.classifyUnknownChar(o);t.push(ae(o,s,ie(n,n+1))),n++;}}return new he(this.mergeColonQualifiedNames(t),this.language)}mergeColonQualifiedNames(e){let t=[];for(let n of e){let i=t[t.length-1];if(i&&Kr.ASCII_WORD.test(i.value)&&Kr.COLON_QUALIFIER.test(n.value)&&i.position.end===n.position.start){let a=i.value+n.value;t[t.length-1]=ae(a,this.classifyToken(a),ie(i.position.start,n.position.end));continue}t.push(n);}return t}classifyUnknownChar(e){return "()[]{},:;".includes(e)?"punctuation":"+-*/<>=!&|".includes(e)?"operator":"identifier"}tryPropertyAccess(e,t,n){if(e[t]!==".")return false;let i=n[n.length-1],a=i&&i.position.end<t;if(i&&!a&&(i.kind==="identifier"||i.kind==="keyword"||i.kind==="selector"))return n.push(ae(".","operator",ie(t,t+1))),true;let u=t+1;for(;u<e.length&&ke(e[u]);)u++;return u<e.length&&e[u]==="("?(n.push(ae(".","operator",ie(t,t+1))),true):false}initializeKeywordsFromProfile(e,t=[]){let n=new Map;if(this.rawExtraEntries=t,e.keywords){for(let[i,a]of Object.entries(e.keywords))if(n.set(a.primary,{native:a.primary,normalized:a.normalized||i}),a.alternatives)for(let o of a.alternatives)n.set(o,{native:o,normalized:a.normalized||i});}if(e.references){for(let[i,a]of Object.entries(e.references))n.set(a,{native:a,normalized:i});for(let i of Object.keys(e.references))n.has(i)||n.set(i,{native:i,normalized:i});}if(e.roleMarkers){for(let[i,a]of Object.entries(e.roleMarkers))if(a.primary&&n.set(a.primary,{native:a.primary,normalized:i}),a.alternatives)for(let o of a.alternatives)n.set(o,{native:o,normalized:i});}if(e.possessive?.keywords)for(let[i,a]of Object.entries(e.possessive.keywords))n.set(i,{native:i,normalized:a});for(let i of is)n.has(i)||n.set(i,{native:i,normalized:i});for(let i of t)n.set(i.native,i);this.profileKeywords=Array.from(n.values()).sort((i,a)=>a.native.length-i.native.length),this.multiWordKeywords=this.profileKeywords.filter(i=>(i.native.includes(" ")||ns(i.native))&&!ts.has(i.normalized)),this.profileKeywordMap=new Map;for(let i of this.profileKeywords){this.profileKeywordMap.set(i.native.toLowerCase(),i);let a=this.removeDiacritics(i.native);a!==i.native&&!this.profileKeywordMap.has(a.toLowerCase())&&this.profileKeywordMap.set(a.toLowerCase(),i);}}removeDiacritics(e){return Hr(e)}tryProfileKeyword(e,t){for(let n of this.profileKeywords)if(e.slice(t).startsWith(n.native))return ae(n.native,"keyword",ie(t,t+n.native.length),n.normalized);return null}tryMultiWordKeyword(e,t,n=i=>/[\p{L}\p{N}_]/u.test(i)){if(this.multiWordKeywords.length===0)return null;let i=e.slice(t);for(let a of this.multiWordKeywords){if(!i.startsWith(a.native))continue;let o=e[t+a.native.length];if(!(o!==void 0&&n(o)))return ae(a.native,"keyword",ie(t,t+a.native.length),a.normalized)}return null}isKeywordStart(e,t){let n=e.slice(t);return this.profileKeywords.some(i=>n.startsWith(i.native))}isKeywordStartAtBoundary(e,t,n=i=>/[\p{L}\p{N}_]/u.test(i)){let i=e.slice(t);return this.profileKeywords.some(a=>{if(!i.startsWith(a.native))return false;let o=e[t+a.native.length];return o===void 0||!n(o)})}lookupKeyword(e){let t=this.profileKeywordMap.get(e.toLowerCase());if(t)return t;let n=this.removeDiacritics(e);if(n!==e)return this.profileKeywordMap.get(n.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,n){let i=this.tryNormalize(e);if(!i)return null;let a=this.lookupKeyword(i.stem);if(!a)return null;let o={normalized:a.normalized,stem:i.stem,stemConfidence:i.confidence};return ae(e,"keyword",ie(t,n),o)}trySelector(e,t){let n=Yo(e,t);return n?ae(n,"selector",ie(t,t+n.length)):null}tryEventModifier(e,t){if(e[t]!==".")return null;let n=e.slice(t).match(/^\.(?:once|debounce|throttle|queue)(?:\(([^)]+)\))?(?:\s|$|\.)/);if(!n)return null;let i=n[0].replace(/(\s|\.)$/,""),a=i.slice(1).split("(")[0],o=n[1];return {...ae(i,"event-modifier",ie(t,t+i.length)),metadata:{modifierName:a,value:o?a==="queue"?o:parseInt(o,10):void 0}}}tryString(e,t){let n=Xo(e,t);return n?ae(n,"literal",ie(t,t+n.length)):null}tryNumber(e,t){let n=es(e,t);return n?ae(n,"literal",ie(t,t+n.length)):null}tryMatchTimeUnit(e,t,n,i=false){let a=t;if(i)for(;a<e.length&&Xe(e[a]);)a++;let o=e.slice(a);for(let s of n){let u=o.slice(0,s.length);if(s.caseInsensitive?u.toLowerCase()===s.pattern.toLowerCase():u===s.pattern){if(s.notFollowedBy&&(o[s.length]||"")===s.notFollowedBy)continue;if(s.checkBoundary){let c=o[s.length]||"";if(ke(c))continue}return {suffix:s.suffix,endPos:a+s.length}}}return null}parseBaseNumber(e,t,n=true){let i=t,a="";if(n&&(e[i]==="-"||e[i]==="+")&&(a+=e[i++]),i>=e.length||!Ze(e[i]))return null;for(;i<e.length&&Ze(e[i]);)a+=e[i++];if(i<e.length&&e[i]===".")for(a+=e[i++];i<e.length&&Ze(e[i]);)a+=e[i++];return !a||a==="-"||a==="+"?null:{number:a,endPos:i}}tryNumberWithTimeUnits(e,t,n,i={}){let{allowSign:a=true,skipWhitespace:o=false}=i,s=this.parseBaseNumber(e,t,a);if(!s)return null;let{number:u,endPos:l}=s,c=[...n,...Kr.STANDARD_TIME_UNITS],d=this.tryMatchTimeUnit(e,l,c,o);return d&&(u+=d.suffix,l=d.endPos),ae(u,"literal",ie(t,l))}tryUrl(e,t){let n=Qo(e,t);return n?ae(n,"url",ie(t,t+n.length)):null}tryVariableRef(e,t){if(e[t]!==":"||t+1>=e.length||!ke(e[t+1]))return null;let n=t+1;for(;n<e.length&&ke(e[n]);)n++;let i=e.slice(t,n);return ae(i,"identifier",ie(t,n))}tryOperator(e,t){let n=e.slice(t,t+2);if(["==","!=","<=",">=","&&","||","->"].includes(n))return ae(n,"operator",ie(t,t+2));let i=e[t];return ["<",">","!","+","-","*","/","="].includes(i)?ae(i,"operator",ie(t,t+1)):["(",")","{","}",",",";",":"].includes(i)?ae(i,"punctuation",ie(t,t+1)):null}tryMultiCharParticle(e,t,n){for(let i of n)if(e.slice(t,t+i.length)===i)return ae(i,"particle",ie(t,t+i.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 Pe=Ur;function De(r){return {stem:r,confidence:1}}function le(r,e,t){return t?{stem:r,confidence:e,metadata:t}:{stem:r,confidence:e}}var Mn=class{constructor(r){this.language=r.language,this.config={minWordLength:3,minStemLength:2,...r};}normalize(r){let e=r.toLowerCase();if(this.isAlreadyNormalized(e))return De(r);if(this.config.reflexiveSuffixes){let t=this.tryReflexiveNormalization(e);if(t)return t}if(this.config.endings){let t=this.tryConjugationEndings(e);if(t)return t}if(this.config.suffixRules){let t=this.trySuffixRules(e);if(t)return t}if(this.config.prefixRules){let t=this.tryPrefixRules(e);if(t)return t}return De(r)}isAlreadyNormalized(r){return this.config.infinitiveEndings?this.config.infinitiveEndings.some(e=>r.endsWith(e)):false}tryReflexiveNormalization(r){let e=this.config.reflexiveSuffixes;if(!e)return null;for(let t of e){if(!r.endsWith(t))continue;let n=r.slice(0,-t.length);if(this.isAlreadyNormalized(n))return le(n,.88,{removedSuffixes:[t],conjugationType:"reflexive"});let i=this.tryConjugationEndings(n)||this.trySuffixRules(n);if(i&&i.stem!==n)return le(i.stem,i.confidence*.95,{removedSuffixes:[t,...i.metadata?.removedSuffixes||[]],conjugationType:"reflexive"})}return null}tryConjugationEndings(r){let e=this.config.endings;if(!e)return null;let t=this.config.minStemLength??2;for(let n of e){if(!r.endsWith(n.ending))continue;let i=r.slice(0,-n.ending.length);if(i.length<t)continue;let a=i+n.stem;return le(a,n.confidence,{removedSuffixes:[n.ending],conjugationType:n.type})}return null}trySuffixRules(r){let e=this.config.suffixRules;if(!e)return null;let t=this.config.minStemLength??2;for(let n of e){if(!r.endsWith(n.pattern))continue;let i=r.slice(0,-n.pattern.length),a=n.minStemLength??t;if(i.length<a)continue;let o=i+(n.replacement||"");return le(o,n.confidence,{removedSuffixes:[n.pattern],...n.conjugationType&&{conjugationType:n.conjugationType}})}return null}tryPrefixRules(r){let e=this.config.prefixRules;if(!e)return null;for(let t of e){if(!r.startsWith(t.pattern))continue;let n=r.slice(t.pattern.length),i=t.minRemaining??this.config.minStemLength??2;if(!(n.length<i))return le(n,1-t.confidencePenalty,{removedPrefixes:[t.pattern]})}return null}};var as=Object.defineProperty,os=Object.getOwnPropertyNames,Bi=(r,e)=>function(){return r&&(e=(0, r[os(r)[0]])(r=0)),e},ss=(r,e)=>{for(var t in e)as(r,t,{get:e[t],enumerable:true});};function In(r,e){return r.replace(/\{(\w+)\}/g,(t,n)=>String(e[n]??`{${n}}`))}function Ce(r,e,t={},n){let i=Ti[r],a=In(i,t),o=Fi[r],s=o?In(o,t):void 0;return {code:r,message:a,severity:e,...n&&{role:n},...s&&{suggestion:s}}}var N,Ti,Fi,us=Bi({"src/generators/schema-error-codes.ts"(){N={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"},Ti={[N.AMBIGUOUS_TYPE_LITERAL_SELECTOR]:"Role '{role}' accepts both 'literal' and 'selector'. This may cause ambiguous type inference for values starting with special characters (* . # etc.).",[N.TOO_MANY_EXPECTED_TYPES]:"Role '{role}' accepts {count} different types. This may make type inference unreliable.",[N.MULTI_TYPE_PATIENT_EXPECTED]:"Role '{role}' accepts multiple types (expected for {command} command).",[N.NO_REQUIRED_ROLES]:"Command has no required roles. Is this intentional?",[N.NO_REQUIRED_ROLES_EXPECTED]:"Command has no required roles (expected for {command}).",[N.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.",[N.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.",[N.EVENT_HANDLER_MISSING_EVENT]:"Event handler command should have an 'event' role to specify which event to listen for.",[N.EVENT_HANDLER_EVENT_NOT_REQUIRED]:"Event role should be required - every event handler needs an event to listen for.",[N.CONDITIONAL_MISSING_CONDITION]:"Conditional command should have a 'condition' role for the boolean expression.",[N.CONDITIONAL_CONDITION_NOT_REQUIRED]:"Condition role should be required - conditionals need a condition to evaluate.",[N.FOR_LOOP_MISSING_SOURCE]:"For-loop should have a 'source' role for the collection to iterate over.",[N.WHILE_LOOP_MISSING_CONDITION]:"While-loop should have a 'condition' role for the loop condition.",[N.VALUE_TYPE_MISMATCH]:"Role '{role}' of command '{command}' expects type [{expectedTypes}], got '{actualType}'.",[N.SELECTOR_KIND_MISMATCH]:"Role '{role}' of command '{command}' expects selector kind [{selectorKinds}], got '{actualKind}'.",[N.SELECTOR_KINDS_WITHOUT_SELECTOR_TYPE]:"Role '{role}' has selectorKinds but expectedTypes does not include 'selector'.",[N.KEYWORD_COLLISION]:"Keyword '{keyword}' is used by multiple commands: {commands}. Only the first-registered command will be reachable."},Fi={[N.AMBIGUOUS_TYPE_LITERAL_SELECTOR]:"Consider being more specific about which type is expected, or use explicit type markers.",[N.TOO_MANY_EXPECTED_TYPES]:"Consider narrowing the accepted types to improve type inference reliability.",[N.TRANSITION_PATIENT_ACCEPTS_SELECTOR]:"Remove 'selector' from expectedTypes and only accept 'literal'.",[N.TRANSITION_MISSING_GOAL]:"Add a 'goal' role with expectedTypes ['literal', 'variable'].",[N.EVENT_HANDLER_MISSING_EVENT]:"Add an 'event' role with expectedTypes ['literal'].",[N.EVENT_HANDLER_EVENT_NOT_REQUIRED]:"Set required: true on the 'event' role.",[N.CONDITIONAL_MISSING_CONDITION]:"Add a 'condition' role with expectedTypes ['expression'].",[N.CONDITIONAL_CONDITION_NOT_REQUIRED]:"Set required: true on the 'condition' role.",[N.FOR_LOOP_MISSING_SOURCE]:"Add a 'source' role for the collection to iterate over.",[N.WHILE_LOOP_MISSING_CONDITION]:"Add a 'condition' role for the loop continuation condition.",[N.VALUE_TYPE_MISMATCH]:"Ensure the value matches one of the expected types: [{expectedTypes}].",[N.SELECTOR_KIND_MISMATCH]:"Use a selector of the correct kind: [{selectorKinds}].",[N.SELECTOR_KINDS_WITHOUT_SELECTOR_TYPE]:"Either add 'selector' to expectedTypes or remove selectorKinds.",[N.KEYWORD_COLLISION]:"Give each command a unique keyword. Move the shared keyword to alternatives on one command, or use a more specific translation."};}}),Pi={};ss(Pi,{SchemaErrorCodes:()=>N,formatValidationResults:()=>ys,getValidationStats:()=>vs,validateAllKeywordCollisions:()=>gs,validateAllSchemas:()=>fs,validateCommandSchema:()=>Oi,validateKeywordCollisions:()=>Ri,validateRoleValues:()=>hs});function ls(r,e){return {action:r,items:e}}function Oi(r){let e=[];for(let n of r.roles)n.expectedTypes.includes("literal")&&n.expectedTypes.includes("selector")&&(n.role==="patient"&&Ot.has(r.action)?e.push(Ce(N.MULTI_TYPE_PATIENT_EXPECTED,"note",{role:n.role,command:r.action},n.role)):e.push(Ce(N.AMBIGUOUS_TYPE_LITERAL_SELECTOR,"warning",{role:n.role},n.role))),n.expectedTypes.length>3&&!Ot.has(r.action)&&e.push(Ce(N.TOO_MANY_EXPECTED_TYPES,"warning",{role:n.role,count:n.expectedTypes.length},n.role));for(let n of r.roles)n.selectorKinds&&n.selectorKinds.length>0&&(n.expectedTypes.includes("selector")||e.push(Ce(N.SELECTOR_KINDS_WITHOUT_SELECTOR_TYPE,"warning",{role:n.role},n.role)));switch(r.action){case "transition":cs(r,e);break;case "on":ds(r,e);break;case "if":case "unless":ps(r,e);break;case "repeat":case "for":case "while":ms(r,e);break}return r.roles.filter(n=>n.required).length===0&&(Li.has(r.action)?e.push(Ce(N.NO_REQUIRED_ROLES_EXPECTED,"note",{command:r.action})):e.push(Ce(N.NO_REQUIRED_ROLES,"warning",{}))),ls(r.action,e)}function cs(r,e){let t=r.roles.find(i=>i.role==="patient"),n=r.roles.find(i=>i.role==="goal");t&&!n&&e.push(Ce(N.TRANSITION_MISSING_GOAL,"error",{}));}function ds(r,e){let t=r.roles.find(n=>n.role==="event");t||e.push(Ce(N.EVENT_HANDLER_MISSING_EVENT,"warning",{})),t&&!t.required&&e.push(Ce(N.EVENT_HANDLER_EVENT_NOT_REQUIRED,"warning",{}));}function ps(r,e){let t=r.roles.find(n=>n.role==="condition");t||e.push(Ce(N.CONDITIONAL_MISSING_CONDITION,"warning",{})),t&&!t.required&&e.push(Ce(N.CONDITIONAL_CONDITION_NOT_REQUIRED,"warning",{}));}function ms(r,e){r.action==="for"?r.roles.find(n=>n.role==="source")||e.push(Ce(N.FOR_LOOP_MISSING_SOURCE,"warning",{})):r.action==="while"&&(r.roles.find(n=>n.role==="condition")||e.push(Ce(N.WHILE_LOOP_MISSING_CONDITION,"warning",{})));}function fs(r,e={}){let t=new Map,{includeNotes:n=false}=e;for(let[i,a]of Object.entries(r)){let o=Oi(a),s=o.items.some(l=>l.severity==="warning"||l.severity==="error"),u=n&&o.items.some(l=>l.severity==="note");(s||u)&&t.set(i,o);}return t}function ys(r,e={}){let t=[],{showNotes:n=false,showCodes:i=true}=e;for(let[a,o]of r){let s=o.items.filter(c=>c.severity==="error"),u=o.items.filter(c=>c.severity==="warning"),l=o.items.filter(c=>c.severity==="note");if(s.length>0){t.push(` \u274C ${a}:`);for(let c of s){let d=i?` [${c.code}]`:"";t.push(` ERROR${d}: ${c.message}`),c.suggestion&&t.push(` \u{1F4A1} Suggestion: ${c.suggestion}`);}}if(u.length>0){t.push(` \u26A0\uFE0F ${a}:`);for(let c of u){let d=i?` [${c.code}]`:"";t.push(` ${d?`${c.code}: `:""}${c.message}`),c.suggestion&&t.push(` \u{1F4A1} ${c.suggestion}`);}}if(n&&l.length>0){t.push(` \u2139\uFE0F ${a}:`);for(let c of l){let d=i?` [${c.code}]`:"";t.push(` ${d?`${c.code}: `:""}${c.message}`);}}}return t.join(`
3
+ `)}function vs(r){let e=0,t=0,n=0,i={};for(let a of r.values())for(let o of a.items)o.severity==="error"?e++:o.severity==="warning"?t++:o.severity==="note"&&n++,i[o.code]=(i[o.code]||0)+1;return {totalCommands:r.size,errors:e,warnings:t,notes:n,byCode:i}}function hs(r,e){let t=[];for(let n of e){let i=r.roles.find(a=>a.role===n.role);i&&(i.expectedTypes.length>0&&!i.expectedTypes.includes(n.type)&&(i.expectedTypes.includes("expression")||t.push({level:"error",role:n.role,message:`${r.action}.${n.role} expects type [${i.expectedTypes.join(", ")}], got '${n.type}'`,code:N.VALUE_TYPE_MISMATCH})),n.type==="selector"&&n.selectorKind&&i.selectorKinds&&i.selectorKinds.length>0&&(i.selectorKinds.includes(n.selectorKind)||t.push({level:"error",role:n.role,message:`${r.action}.${n.role} expects selector kind [${i.selectorKinds.join(", ")}], got '${n.selectorKind}'`,code:N.SELECTOR_KIND_MISMATCH})));}return t}function Es(r){if(r.length!==2)return false;let[e,t]=[...r].sort();return Ni.some(([n,i])=>n===e&&i===t)}function Ri(r){let e=[];if(!r.keywords)return {language:r.code,collisions:e};let t=new Map;for(let[i,a]of Object.entries(r.keywords)){if(!a||!a.primary)continue;let o=t.get(a.primary)||[];if(o.push({command:i,isPrimary:true}),t.set(a.primary,o),a.alternatives)for(let s of a.alternatives){let u=t.get(s)||[];u.push({command:i,isPrimary:false}),t.set(s,u);}}for(let[i,a]of t){let o=[...new Set(a.map(l=>l.command))];if(o.length<=1||Es(o))continue;let s=a.filter(l=>l.isPrimary).length,u;s>=2?u="primary-primary":s===1?u="primary-alternative":u="alternative-alternative",e.push({keyword:i,commands:o.sort(),type:u});}let n={"primary-primary":0,"primary-alternative":1,"alternative-alternative":2};return e.sort((i,a)=>n[i.type]-n[a.type]),{language:r.code,collisions:e}}function gs(r){let e=[];for(let[,t]of Object.entries(r)){let n=Ri(t);n.collisions.length>0&&e.push(n);}return e.sort((t,n)=>t.language.localeCompare(n.language))}var Ot,Li,Ni,ks=Bi({"src/generators/schema-validator.ts"(){us(),Ot=new Set(["put","append","prepend","log","throw","make","measure","return","swap","morph","beep","copy"]),Li=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","viewTransition","live","eventsource","socket","worker","intercept"]),Ni=[["change","changes"]];}}),_i=new Set(["me","my","myself","you","your","yourself","it","its","result","event","target","body","detail","window","document","true","false","null","undefined","empty"]),er=new Map,qe=new Map,yr=new Map,Rt=null;function Mi(r,e){let t={...r};for(let n of Object.keys(e)){let i=e[n],a=r[n];i!==void 0&&(typeof i=="object"&&i!==null&&!Array.isArray(i)&&typeof a=="object"&&a!==null&&!Array.isArray(a)?t[n]=Mi(a,i):t[n]=i);}return t}function ws(r,e){return Mi(r,e)}function Kt(r){if(!r.extends)return r;let e=qe.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=Kt(e);return ws(t,r)}function Me(r,e,t){er.set(r,e),qe.set(r,t),yr.delete(r);}function zs(r){Rt=r;}var Lt=new Map;function Ii(r,e){Lt.set(r,e),yr.delete(r);}function Er(r){return r.split("-")[0]}function gr(r){return r.includes("-")}function bs(r){let e=er.get(r);if(!e&&gr(r)){let t=Er(r);e=er.get(t);}if(!e){let t=Array.from(er.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 Cs(r){let e=qe.get(r);if(!e&&gr(r)){let t=Er(r);e=qe.get(t);}if(!e){let t=Array.from(qe.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 Kt(e)}function F(r){let e=qe.get(r);return !e&&gr(r)&&(e=qe.get(Er(r))),e?Kt(e):void 0}function As(){return Array.from(er.keys())}function $i(r){if(er.has(r)&&qe.has(r))return true;if(gr(r)){let e=Er(r);return er.has(e)&&qe.has(e)}return false}function xs(r,e){let n=bs(e).tokenize(r);return e==="en"?n:Ss(n,e)}var ji=()=>false;function Ds(r){ji=r;}function Ss(r,e){let t=r.tokens,n=[],i=false;for(let a=0;a<t.length;a++){let o=t[a],s=t[a-1],u=a+2;for(;u<t.length&&t[u]?.value!==")"&&t[u-1].position.end===t[u].position.start;)u++;let l=t.slice(a+1,u),c=l.map(m=>m.value).join(""),d=l[0],p=l[l.length-1];if(o.value==="("&&d&&p&&t[u]?.value===")"&&/^[\p{L}_$][\p{L}\p{M}\p{N}_$]*$/u.test(c)&&!(d.kind!=="particle"&&_i.has((d.normalized??d.value).toLowerCase()))&&ji(c,e)&&o.position.end===d.position.start&&p.position.end===t[u].position.start&&!(s&&s.position.end===o.position.start&&/[\p{L}\p{N}_)\]]$/u.test(s.value))){n.push({value:`(${c})`,kind:"identifier",position:{...o.position,end:t[u].position.end}}),a=u,i=true;continue}n.push(o);}return i?new he(n,e):r}function Ee(r){let e=yr.get(r);if(!e&&gr(r)&&(e=yr.get(Er(r))),e)return e;let t=Lt.get(r);if(!t&&gr(r)&&(t=Lt.get(Er(r))),t)return yr.set(r,t),t;if(!Rt)throw new Error(`No patterns registered for language '${r}'. Either import the language module or set a pattern generator.`);let n=Cs(r),i=Rt(n);return yr.set(r,i),i}function Bs(r,e){return Ee(r).filter(t=>t.command===e).sort((t,n)=>n.priority-t.priority)}var Wi=new Map;function Ie(r,e){for(let[t,n]of e)Wi.set(`${t}:${r}`,n);}function ce(r,e){return Wi.get(`${r}:${e}`)?.(F(e))}function Ts(r){return ce("toggle",r)??[]}function Fs(r){return []}var re=["selector","reference","expression"],Ht=["literal","selector","expression","reference","property-path"],Vi=["literal","selector","reference","expression","property-path"],qi=["literal","selector","reference","expression","property-path"],Ki=["selector","reference","expression","property-path"];[...Ki];[...qi];var Ps=[{lang:"ar",verb:"\u0636\u0639",verbAlts:["\u0627\u062C\u0639\u0644"],before:"\u0642\u0628\u0644",after:"\u0628\u0639\u062F"},{lang:"de",verb:"setzen",before:"vor",after:"nach"},{lang:"fr",verb:"mettre",before:"avant",after:"apr\xE8s"},{lang:"he",verb:"\u05E9\u05D9\u05DD",patientPrefix:"\u05D0\u05EA",before:"\u05DC\u05E4\u05E0\u05D9",after:"\u05D0\u05D7\u05E8\u05D9"},{lang:"id",verb:"taruh",verbAlts:["letakkan","masukkan","tempatkan"],before:"sebelum",after:"setelah"},{lang:"ms",verb:"letak",before:"sebelum",after:"selepas"},{lang:"pt",verb:"colocar",before:"antes",after:"depois"},{lang:"sw",verb:"weka",before:"kabla",after:"baada"},{lang:"tl",verb:"ilagay",verbAlts:["maglagay"],before:"bago",after:"matapos"},{lang:"zh",verb:"\u653E\u7F6E",verbAlts:["\u653E","\u653E\u5165"],patientPrefix:"\u628A",patientPrefixOptional:true,before:"\u4E4B\u524D",after:"\u4E4B\u540E"}],Ut=[{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 bt(r,e,t,n){let i=Ut.find(o=>o.lang===r);if(!i)return false;let a=(o,s)=>(o??"").toLowerCase()===s.toLowerCase();return a(e,i.end)&&a(t,i.at)&&a(n,i.of)}function Os(r,e){let t=Ut.find(i=>i.lang===r);if(!t)return false;let n=e.toLowerCase();return n===t.at.toLowerCase()||n===t.of.toLowerCase()||n===t.end.toLowerCase()}function Rs(r){let e=Ut.find(a=>a.lang===r);if(!e)return [];let t=[],n=e.verbAlts?{type:"literal",value:e.verb,alternatives:e.verbAlts}:{type:"literal",value:e.verb},i=a=>{t.push({type:"literal",value:a});};return e.sov?(t.push({type:"role",role:"patient"}),i(e.at),i(e.end),i(e.of),t.push({type:"role",role:"destination"}),e.objMarker&&t.push({type:"literal",value:e.objMarker}),t.push(n)):(t.push(n),e.patientPrefix&&t.push({type:"literal",value:e.patientPrefix}),t.push({type:"role",role:"patient"}),i(e.at),i(e.end),i(e.of),t.push({type:"role",role:"destination"})),[{id:`put-${e.lang}-at-end`,language:e.lang,command:"put",priority:110,template:{format:`put {patient} ${e.at} ${e.end} ${e.of} {destination}`,tokens:t},extraction:{manner:{default:{type:"literal",value:"at end of"}}}}]}function Ls(r){let e=Ps.find(t=>t.lang===r);return e?["before","after"].map(t=>{let n=e[t],i=[e.verbAlts?{type:"literal",value:e.verb,alternatives:e.verbAlts}:{type:"literal",value:e.verb}];return e.patientPrefix&&i.push(e.patientPrefixOptional?{type:"group",optional:true,tokens:[{type:"literal",value:e.patientPrefix}]}:{type:"literal",value:e.patientPrefix}),i.push({type:"role",role:"patient"},{type:"literal",value:n},{type:"role",role:"destination"}),{id:`put-${e.lang}-${t}`,language:e.lang,command:"put",priority:105,template:{format:`${e.verb} {patient} ${n} {destination}`,tokens:i},extraction:{patient:{position:e.patientPrefix&&!e.patientPrefixOptional?2:1},destination:{marker:n},manner:{default:{type:"literal",value:t}}}}}):[]}function Ns(r){let e=Ls(r),t=Rs(r),n=ce("put",r);return r==="en"?n??[]:n?[...n,...r==="id"||r==="zh"?e:[],...t]:[...e,...t]}var be={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 Hi(r,e){let t=be[e];return t&&t[r]?t[r]:r.toLowerCase()}function _s(r,e){let t=be[e];return t?Object.keys(t).filter(n=>t[n]===r):[]}var Ms=Object.fromEntries(Object.entries(be).map(([r,e])=>{let t={};for(let[n,i]of Object.entries(e))i in t||(t[i]=n);return [r,t]})),Is={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 $s(r,e){return Is[e]?.has(r)?r:Ms[e]?.[r]??r}function js(r){return ce("event-handler",r)??[]}function Ws(r){return []}function Vs(r){return ce("add",r)??[]}function qs(r){return ce("remove",r)??[]}[...re];function Ks(r){return ce("show",r)??[]}[...re];function Hs(r){return ce("hide",r)??[]}[...Ht];function Us(r){return r.map(e=>e.extraction?.scope?e:{...e,template:{...e.template,tokens:[...e.template.tokens,{type:"group",optional:true,tokens:[{type:"literal",value:"on"},{type:"role",role:"scope",optional:true,expectedTypes:["selector","reference"]}]}]},extraction:{...e.extraction,scope:{marker:"on"}}})}function Gs(r){let e=ce("set",r);return e?Us(e):[]}[...Vi];function Ys(r){return ce("get",r)??[]}function Zs(r){return ce("increment",r)??[]}function Xs(r){return ce("decrement",r)??[]}function Js(r){return ce("wait",r)??[]}function Qs(r){return ce("fetch",r)??[]}var Gt={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"]},Yt=["literal","expression","reference","property-path"];function Ui(r,e){let t=[...Gt[r]??[],"times"].filter(n=>n!==e);return {type:"literal",value:e,alternatives:t}}function eu(r,e,t,n){let i=[];return i.push({type:"literal",value:e}),n&&i.push({type:"literal",value:n}),i.push({type:"role",role:"quantity",expectedTypes:Yt}),i.push(Ui(r,t)),{id:`repeat-${r}-times`,language:r,command:"repeat",priority:110,template:{format:`${e}${n?" "+n:""} {quantity} ${t}`,tokens:i},extraction:{loopType:{default:{type:"literal",value:"times"}}}}}var ru=[["es","repetir","veces"],["de","wiederholen","mal"],["fr","r\xE9p\xE9ter","fois"],["it","ripetere","volte"],["pt","repetir","vezes"],["ru","\u043F\u043E\u0432\u0442\u043E\u0440\u0438\u0442\u044C","\u0440\u0430\u0437"],["uk","\u043F\u043E\u0432\u0442\u043E\u0440\u0438\u0442\u0438","\u0440\u0430\u0437\u0456\u0432"],["pl","powt\xF3rz","razy"],["ar","\u0643\u0631\u0631","\u0645\u0631\u0627\u062A"],["he","\u05D7\u05D6\u05D5\u05E8","\u05E4\u05E2\u05DE\u05D9\u05DD","\u05D0\u05EA"],["id","ulangi","kali"],["ms","ulang","kali"],["sw","rudia","mara"],["th","\u0E17\u0E33\u0E0B\u0E49\u0E33","\u0E04\u0E23\u0E31\u0E49\u0E07"],["vi","l\u1EB7p l\u1EA1i","l\u1EA7n"],["tl","ulitin","beses"],["zh","\u91CD\u590D","\u6B21","\u628A"]];function tu(r,e,t,n){return {id:`repeat-${r}-times`,language:r,command:"repeat",priority:110,template:{format:`{quantity} ${e} ${t} ${n}`,tokens:[{type:"role",role:"quantity",expectedTypes:Yt},Ui(r,e),{type:"literal",value:t},{type:"literal",value:n,alternatives:["repeat"]}]},extraction:{loopType:{default:{type:"literal",value:"times"}}}}}var nu=[["ja","\u56DE","\u3092","\u7E70\u308A\u8FD4\u3057"],["ko","\uBC88","\uB97C","\uBC18\uBCF5"],["tr","kez","i","tekrarla"],["hi","\u092C\u093E\u0930","\u0915\u094B","\u0926\u094B\u0939\u0930\u093E\u090F\u0902"],["bn","\u09AC\u09BE\u09B0","\u0995\u09C7","\u09AA\u09C1\u09A8\u09B0\u09BE\u09AC\u09C3\u09A4\u09CD\u09A4\u09BF"],["qu","kuti","ta","kutipay"]];function iu(r,e,t){return {id:`repeat-${r}-word-first-times`,language:r,command:"repeat",priority:109,template:{format:`${e} ${t} {quantity}`,tokens:[{type:"literal",value:e},{type:"literal",value:t},{type:"role",role:"quantity",expectedTypes:Yt}]},extraction:{loopType:{default:{type:"literal",value:"times"}}}}}function au(r,e){let t=[{type:"literal",value:"repeat"}];if(e.forWords&&e.forWords.length>0)if(e.requireForWords)for(let n of e.forWords)t.push({type:"literal",value:n});else t.push({type:"group",optional:true,tokens:e.forWords.map(n=>({type:"literal",value:n}))});t.push({type:"role",role:"patient",expectedTypes:["expression","reference"]});for(let n of e.inWords)t.push({type:"literal",value:n});return t.push({type:"role",role:"source",expectedTypes:["selector","expression","reference"]}),{id:`repeat-${r}-for-in`,language:r,command:"repeat",priority:110,template:{format:`repeat [${(e.forWords??[]).join(" ")}] {patient} ${e.inWords.join(" ")} {source}`,tokens:t},extraction:{loopType:{default:{type:"literal",value:"for"}}}}}var ou=[["en",{forWords:["for"],inWords:["in"],requireForWords:true}],["es",{forWords:["para"],inWords:["en"]}],["pt",{forWords:["para"],inWords:["dentro"]}],["fr",{forWords:["pour"],inWords:["en"]}],["it",{forWords:["per"],inWords:["in"]}],["de",{forWords:["f\xFCr"],inWords:["in"]}],["ru",{forWords:["\u0434\u043B\u044F"],inWords:["\u0432"]}],["uk",{forWords:["\u0434\u043B\u044F"],inWords:["\u0443"]}],["pl",{forWords:["dla"],inWords:["w"]}],["ar",{forWords:["\u0644\u0643\u0644"],inWords:["\u0641\u064A"]}],["he",{forWords:["\u05E2\u05D1\u05D5\u05E8","\u05D0\u05EA"],inWords:["in"]}],["hi",{inWords:["\u092E\u0947\u0902"]}],["bn",{inWords:["\u098F"]}],["ja",{inWords:["\u306E\u4E2D"]}],["ko",{inWords:["\uC548\uC5D0"]}],["zh",{forWords:["\u4E3A","\u628A"],inWords:["\u5728"]}],["tr",{inWords:["i\xE7inde"]}],["id",{forWords:["untuk"],inWords:["dalam"]}],["ms",{forWords:["untuk"],inWords:["dalam"]}],["sw",{forWords:["kwa"],inWords:["ndani"]}],["th",{forWords:["\u0E2A\u0E33\u0E2B\u0E23\u0E31\u0E1A"],inWords:["\u0E43\u0E19"]}],["vi",{forWords:["v\u1EDBi m\u1ED7i"],inWords:["trong"]}],["tl",{forWords:["para_sa"],inWords:["sa_loob"]}],["qu",{inWords:["ukupi"]}]];function su(r,e){let t=[{type:"literal",value:"repeat"}];for(let n of e.pre??[])t.push({type:"literal",value:n});return t.push({type:"literal",value:e.whileWord}),t.push({type:"role",role:"condition",expectedTypes:["property-path","expression"]}),{id:`repeat-${r}-while-head`,language:r,command:"repeat",priority:110,template:{format:`repeat ${(e.pre??[]).join(" ")} ${e.whileWord} {condition}`,tokens:t},extraction:{loopType:{default:{type:"literal",value:"while"}}}}}function uu(r,e){return {id:`repeat-${r}-while-head`,language:r,command:"repeat",priority:110,template:{format:`${e.whileWord} {condition} ${e.verb}`,tokens:[{type:"literal",value:e.whileWord},{type:"role",role:"condition",expectedTypes:["property-path","expression"]},{type:"literal",value:e.verb}]},extraction:{loopType:{default:{type:"literal",value:"while"}}}}}var lu=[["ja",{whileWord:"\u306E\u9593",verb:"\u7E70\u308A\u8FD4\u3057"}],["ko",{whileWord:"\uB3D9\uC548",verb:"\uBC18\uBCF5"}],["tr",{whileWord:"s\xFCresince",verb:"tekrarla"}],["hi",{whileWord:"\u091C\u092C \u0924\u0915",verb:"\u0926\u094B\u0939\u0930\u093E\u090F\u0902"}],["bn",{whileWord:"\u09AF\u09A4\u0995\u09CD\u09B7\u09A3",verb:"\u09AA\u09C1\u09A8\u09B0\u09BE\u09AC\u09C3\u09A4\u09CD\u09A4\u09BF"}],["qu",{whileWord:"kaykamaqa",verb:"kutipay"}]],cu=[["en",{whileWord:"while"}],["es",{whileWord:"mientras"}],["pt",{whileWord:"enquanto"}],["fr",{whileWord:"tantque"}],["it",{whileWord:"mentre"}],["de",{whileWord:"w\xE4hrend"}],["ru",{whileWord:"\u043F\u043E\u043A\u0430"}],["uk",{whileWord:"\u043F\u043E\u043A\u0438"}],["pl",{whileWord:"dop\xF3ki"}],["ar",{whileWord:"\u0628\u064A\u0646\u0645\u0627"}],["he",{pre:["\u05D0\u05EA"],whileWord:"\u05DB\u05DC \u05E2\u05D5\u05D3"}],["zh",{pre:["\u628A"],whileWord:"\u5F53"}],["id",{whileWord:"selama"}],["ms",{whileWord:"selagi"}],["sw",{whileWord:"wakati"}],["th",{whileWord:"\u0E43\u0E19\u0E02\u0E13\u0E30\u0E17\u0E35\u0E48"}],["vi",{whileWord:"trong khi"}],["tl",{whileWord:"habang"}]];function Gi(r,e){let t=[{type:"literal",value:"repeat"}];for(let n of e.pre??[])t.push({type:"literal",value:n});return t.push({type:"literal",value:e.untilWord}),t.push({type:"role",role:"condition",expectedTypes:["property-path","expression"]}),{id:`repeat-${r}-until-condition-head`,language:r,command:"repeat",priority:105,template:{format:`repeat ${(e.pre??[]).join(" ")} ${e.untilWord} {condition}`,tokens:t},extraction:{loopType:{default:{type:"literal",value:"until"}}}}}function du(r,e){return {id:`repeat-${r}-until-condition-head`,language:r,command:"repeat",priority:105,template:{format:`${e.untilWord} {condition} ${e.verb}`,tokens:[{type:"literal",value:e.untilWord},{type:"role",role:"condition",expectedTypes:["property-path","expression"]},{type:"literal",value:e.verb}]},extraction:{loopType:{default:{type:"literal",value:"until"}}}}}function pu(r,e){let t=[{type:"literal",value:"repeat"}];for(let n of e.pre??[])t.push({type:"literal",value:n});return t.push({type:"literal",value:e.untilWord}),e.preEvent&&t.push({type:"literal",value:e.preEvent}),t.push({type:"literal",value:e.eventWord}),t.push({type:"role",role:"event",expectedTypes:["literal","expression"]}),t.push({type:"group",optional:true,tokens:[{type:"literal",value:e.fromWord},{type:"role",role:"source",expectedTypes:["selector","reference","expression"]}]}),{id:`repeat-${r}-until-head`,language:r,command:"repeat",priority:110,template:{format:`repeat ${e.untilWord} ${e.eventWord} {event} [${e.fromWord} {source}]`,tokens:t},extraction:{loopType:{default:{type:"literal",value:"until-event"}}}}}var mu=[["ja",{untilWord:"\u307E\u3067",verb:"\u7E70\u308A\u8FD4\u3057"}],["ko",{untilWord:"\uAE4C\uC9C0",verb:"\uBC18\uBCF5"}],["tr",{untilWord:"kadar",verb:"tekrarla"}],["hi",{untilWord:"\u0924\u0915",verb:"\u0926\u094B\u0939\u0930\u093E\u090F\u0902"}],["bn",{untilWord:"\u09AA\u09B0\u09CD\u09AF\u09A8\u09CD\u09A4",verb:"\u09AA\u09C1\u09A8\u09B0\u09BE\u09AC\u09C3\u09A4\u09CD\u09A4\u09BF"}],["qu",{untilWord:"kama",verb:"kutipay"}]],fu=[["es",{untilWord:"hasta",eventWord:"evento",fromWord:"de"}],["pt",{untilWord:"at\xE9",eventWord:"evento",fromWord:"de"}],["fr",{untilWord:"jusqu\xE0",eventWord:"\xE9v\xE9nement",fromWord:"de"}],["it",{untilWord:"fino",eventWord:"evento",fromWord:"da"}],["de",{untilWord:"bis",eventWord:"ereignis",fromWord:"von"}],["ru",{untilWord:"\u0434\u043E",eventWord:"\u0441\u043E\u0431\u044B\u0442\u0438\u0435",fromWord:"\u0438\u0437"}],["uk",{untilWord:"\u0434\u043E",eventWord:"\u043F\u043E\u0434\u0456\u044F",fromWord:"\u0437"}],["pl",{untilWord:"a\u017C",eventWord:"zdarzenie",fromWord:"z"}],["ar",{untilWord:"\u062D\u062A\u0649",eventWord:"\u062D\u062F\u062B",fromWord:"\u0645\u0646"}],["he",{untilWord:"\u05E2\u05D3",preEvent:"\u05D0\u05EA",eventWord:"\u05D0\u05D9\u05E8\u05D5\u05E2",fromWord:"\u05DE"}],["id",{untilWord:"sampai",eventWord:"peristiwa",fromWord:"dari"}],["ms",{untilWord:"sehingga",eventWord:"peristiwa",fromWord:"dari"}],["sw",{untilWord:"hadi",eventWord:"tukio",fromWord:"kutoka"}],["th",{untilWord:"\u0E08\u0E19\u0E16\u0E36\u0E07",eventWord:"\u0E40\u0E2B\u0E15\u0E38\u0E01\u0E32\u0E23\u0E13\u0E4C",fromWord:"\u0E08\u0E32\u0E01"}],["vi",{untilWord:"cho \u0111\u1EBFn khi",eventWord:"s\u1EF1 ki\u1EC7n",fromWord:"t\u1EEB"}],["tl",{untilWord:"hanggang",eventWord:"pangyayari",fromWord:"mula_sa"}],["zh",{pre:["\u628A"],untilWord:"\u76F4\u5230",eventWord:"\u4E8B\u4EF6",fromWord:"\u4ECE"}]];function yu(r,e){return {id:`repeat-${r}-until-head`,language:r,command:"repeat",priority:110,template:{format:`${e.untilWord} ${e.eventWord} {event} ${e.objMarker} repeat [{source} ${e.fromWord}]`,tokens:[{type:"literal",value:e.untilWord},{type:"literal",value:e.eventWord},{type:"role",role:"event",expectedTypes:["literal","expression"]},{type:"literal",value:e.objMarker},{type:"literal",value:"repeat"},{type:"group",optional:true,tokens:[{type:"role",role:"source",expectedTypes:["selector","reference","expression"]},{type:"literal",value:e.fromWord}]}]},extraction:{loopType:{default:{type:"literal",value:"until-event"}}}}}function vu(r,e){return {id:`repeat-${r}-until-head-verb-final`,language:r,command:"repeat",priority:111,template:{format:`${e.untilWord} ${e.eventWord} {event} ${e.objMarker} {source} ${e.fromWord} repeat`,tokens:[{type:"literal",value:e.untilWord},{type:"literal",value:e.eventWord},{type:"role",role:"event",expectedTypes:["literal","expression"]},{type:"literal",value:e.objMarker},{type:"role",role:"source",expectedTypes:["selector","reference","expression"]},{type:"literal",value:e.fromWord},{type:"literal",value:"repeat"}]},extraction:{loopType:{default:{type:"literal",value:"until-event"}}}}}var hu={id:"repeat-qu-midclause-until-head",language:"qu",command:"repeat",priority:109,template:{format:"until event {event} ta {source} manta repeat",tokens:[{type:"literal",value:"until"},{type:"literal",value:"event"},{type:"role",role:"event",expectedTypes:["literal","expression"]},{type:"literal",value:"ta"},{type:"role",role:"source",expectedTypes:["selector","reference","expression"]},{type:"literal",value:"manta"},{type:"literal",value:"repeat"}]},extraction:{loopType:{default:{type:"literal",value:"until-event"}}}},Eu=[["hi",{untilWord:"\u0924\u0915",eventWord:"\u0918\u091F\u0928\u093E",objMarker:"\u0915\u094B",fromWord:"\u0938\u0947"}],["bn",{untilWord:"\u09AA\u09B0\u09CD\u09AF\u09A8\u09CD\u09A4",eventWord:"\u0998\u099F\u09A8\u09BE",objMarker:"\u0995\u09C7",fromWord:"\u09A5\u09C7\u0995\u09C7"}],["ja",{untilWord:"\u307E\u3067",eventWord:"\u30A4\u30D9\u30F3\u30C8",objMarker:"\u3092",fromWord:"\u304B\u3089"}],["ko",{untilWord:"\uAE4C\uC9C0",eventWord:"\uC774\uBCA4\uD2B8",objMarker:"\uB97C",fromWord:"\uC5D0\uC11C"}],["tr",{untilWord:"kadar",eventWord:"olay",objMarker:"i",fromWord:"den"}]],gu={id:"repeat-qu-until-head",language:"qu",command:"repeat",priority:110,template:{format:"hayk _ a until event {event} ta {source} manta repeat",tokens:[{type:"literal",value:"hayk"},{type:"literal",value:"_"},{type:"literal",value:"a"},{type:"literal",value:"until"},{type:"literal",value:"event"},{type:"role",role:"event",expectedTypes:["literal","expression"]},{type:"literal",value:"ta"},{type:"role",role:"source",expectedTypes:["selector","reference","expression"]},{type:"literal",value:"manta"},{type:"literal",value:"repeat"}]},extraction:{loopType:{default:{type:"literal",value:"until-event"}}}};function ku(r,e){return {id:`for-${r}-sov-basic`,language:r,command:"for",priority:105,template:{format:`{patient} ${e.inWords.join(" ")} {source} [${e.objMarker}] ${e.forVerb}`,tokens:[{type:"role",role:"patient",expectedTypes:["expression","reference"]},...e.inWords.map(t=>({type:"literal",value:t})),{type:"role",role:"source",expectedTypes:["selector","expression","reference"]},{type:"group",optional:true,tokens:[{type:"literal",value:e.objMarker}]},{type:"literal",value:e.forVerb}]},extraction:{patient:{position:0}}}}var wu=[["ja",{inWords:["\u306E\u4E2D"],objMarker:"\u3092",forVerb:"\u305F\u3081\u306B"}],["ko",{inWords:["\uC548\uC5D0"],objMarker:"\uB97C",forVerb:"\uAC01\uAC01"}],["tr",{inWords:["i\xE7inde"],objMarker:"i",forVerb:"i\xE7in"}],["qu",{inWords:["ukupi"],objMarker:"ta",forVerb:"sapankaq"}],["bn",{inWords:["\u098F"],objMarker:"\u0995\u09C7",forVerb:"\u099C\u09A8\u09CD\u09AF"}],["hi",{inWords:["\u092E\u0947\u0902"],objMarker:"\u0915\u094B",forVerb:"\u0939\u0947\u0924\u0941"}]],Nt=new Map,ye=(r,e)=>{let t=Nt.get(r);t?t.push(e):Nt.set(r,[e]);};for(let[r,e,t,n]of ru)ye(r,eu(r,e,t,n));for(let[r,e,t,n]of nu)ye(r,tu(r,e,t,n));ye("sw",iu("sw","rudia","mara"));for(let[r,e]of ou)ye(r,au(r,e));for(let[r,e]of wu)ye(r,ku(r,e));for(let[r,e]of cu)ye(r,su(r,e));for(let[r,e]of lu)ye(r,uu(r,e));for(let[r,e]of fu)ye(r,pu(r,e)),ye(r,Gi(r,e));ye("en",Gi("en",{untilWord:"until"}));for(let[r,e]of mu)ye(r,du(r,e));for(let[r,e]of Eu)ye(r,yu(r,e)),r==="tr"&&ye(r,vu(r,e));var zu={id:"repeat-qu-canonical-until-head",language:"qu",command:"repeat",priority:110,template:{format:"kama ruway {event} ta repeat [{source} manta]",tokens:[{type:"literal",value:"kama"},{type:"literal",value:"ruway"},{type:"role",role:"event",expectedTypes:["literal","expression"]},{type:"literal",value:"ta"},{type:"literal",value:"repeat"},{type:"group",optional:true,tokens:[{type:"role",role:"source",expectedTypes:["selector","reference","expression"]},{type:"literal",value:"manta"}]}]},extraction:{loopType:{default:{type:"literal",value:"until-event"}}}};ye("qu",zu);ye("qu",gu);ye("qu",hu);function Zt(r){return Nt.get(r)??[]}function bu(r){return ce("append",r)??[]}function Cu(r){return ce("prepend",r)??[]}function Au(r){return ce("trigger",r)??[]}function xu(r){return ce("send",r)??[]}var it=new Set(["tell","viewTransition"]);function at(r){return r.kind==="command"&&it.has(r.action)&&Array.isArray(r.body)}function _e(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 Q(r,e){let t={type:"literal",value:r};return e!==void 0?{type:"literal",value:r,dataType:e}:t}function Yi(r){if(r==="true")return Q(true,"boolean");if(r==="false")return Q(false,"boolean");if(r==="null")return {type:"expression",raw:"null"}}function Ne(r){return Vr(r)}function Be(r){return {type:"reference",value:r}}function Zi(r,e){return e?{...r,position:e}:r}function $e(r,e,t){return t?{type:"property-path",object:r,property:e,access:t}:{type:"property-path",object:r,property:e}}function me(r,e,t){let n={kind:"command",action:r,roles:new Map(Object.entries(e))};return t!==void 0?{...n,metadata:t}:n}function Sr(r,e,t,n,i,a){let o=new Map;o.set("event",r);let s={kind:"event-handler",action:"on",roles:o,body:e};return t!==void 0&&(s.eventModifiers=t),n!==void 0&&(s.metadata=n),i!==void 0&&i.length>0&&(s.parameterNames=i),s}function Du(r,e,t,n,i){let a={kind:"behavior",action:"behavior",roles:new Map,name:r,parameters:e,eventHandlers:t};return n!==void 0&&n.length>0&&(a.initBlock=n),i!==void 0&&(a.metadata=i),a}function Su(r,e,t,n){let i={kind:"def",action:"def",roles:new Map,name:r,parameters:e,body:t};return n!==void 0&&(i.metadata=n),i}function _t(r,e,t,n,i){let a={kind:"feature",action:r,roles:i??new Map,body:e};return t!==void 0&&(a.name=t),n!==void 0&&(a.metadata=n),a}function pr(r,e="then",t){let n={kind:"compound",action:"compound",roles:new Map,statements:r,chainType:e};return t!==void 0&&(n.metadata=t),n}function Bu(r,e,t,n){let i=new Map;i.set("condition",r);let a={kind:"conditional",action:"if",roles:i,thenBranch:e};return t!==void 0&&(a.elseBranch=t),n!==void 0&&(a.metadata=n),a}function Tu(r,e,t,n,i){let a={kind:"loop",action:r,loopVariant:e,roles:new Map(Object.entries(t)),body:n};return i?.loopVariable&&(a.loopVariable=i.loopVariable),i?.indexVariable&&(a.indexVariable=i.indexVariable),i?.metadata&&(a.metadata=i.metadata),a}function Xi(r){let e=F(r)?.keywords?.pick,t=e?.primary;if(!t||t.toLowerCase()==="pick")return {type:"literal",value:"pick"};let n=[...e?.alternatives??[],"pick"];return {type:"literal",value:t,alternatives:n}}var Fu=new Set(["character","characters","item","items"]),Ji=r=>{if(Fu.has(r))return {type:"expression",raw:r};let e=Number(r);return Q(r!==""&&!Number.isNaN(e)?e:r)};function Pu(r,e){let t=[Xi(r)];return e.objectMarkers?.length&&t.push({type:"group",optional:true,tokens:[{type:"literal",value:e.objectMarkers[0],...e.objectMarkers.length>1?{alternatives:e.objectMarkers.slice(1)}:{}}]}),t.push({type:"role",role:"method",expectedTypes:["literal","expression"]},{type:"role",role:"patient",expectedTypes:["literal","expression"]},{type:"literal",value:e.srcMarker,...e.srcAlternatives?.length?{alternatives:e.srcAlternatives}:{}},{type:"role",role:"source",expectedTypes:["selector","reference","expression"]}),{id:`pick-${r}-variant`,language:r,command:"pick",priority:110,template:{format:`pick {method} {patient} ${e.srcMarker} {source}`,tokens:t},extraction:{method:{position:1,transform:Ji},patient:{position:2},source:{marker:e.srcMarker,...e.srcAlternatives?.length?{markerAlternatives:e.srcAlternatives}:{}}}}}var Ou={ar:{srcMarker:"\u0645\u0646"},de:{srcMarker:"von",srcAlternatives:["aus"]},es:{srcMarker:"de"},fr:{srcMarker:"de"},he:{srcMarker:"of",srcAlternatives:["\u05E9\u05DC","\u05DE"],objectMarkers:["\u05D0\u05EA"]},id:{srcMarker:"dari"},it:{srcMarker:"di",srcAlternatives:["da"]},ms:{srcMarker:"daripada",srcAlternatives:["dari"]},pl:{srcMarker:"z"},pt:{srcMarker:"de"},ru:{srcMarker:"\u0438\u0437"},sw:{srcMarker:"ya",srcAlternatives:["kutoka"]},th:{srcMarker:"\u0E02\u0E2D\u0E07",srcAlternatives:["\u0E08\u0E32\u0E01"]},tl:{srcMarker:"ng",srcAlternatives:["mula"]},uk:{srcMarker:"\u0437"},vi:{srcMarker:"c\u1EE7a",srcAlternatives:["t\u1EEB"]},zh:{srcMarker:"\u7684",objectMarkers:["\u628A"]}};function Ru(r,e){return {id:`pick-${r}-variant-sov`,language:r,command:"pick",priority:110,template:{format:`{source} ${e.genitive} {method} {patient} ${e.patientMarker} pick`,tokens:[{type:"role",role:"source",expectedTypes:["selector","reference","expression"]},{type:"literal",value:e.genitive},{type:"role",role:"method",expectedTypes:["literal","expression"]},{type:"role",role:"patient",expectedTypes:["literal","expression"]},{type:"group",optional:true,tokens:[{type:"literal",value:e.patientMarker}]},Xi(r)]},extraction:{source:{position:0},method:{position:2,transform:Ji},patient:{position:3}}}}var Lu={bn:{genitive:"\u09B0",patientMarker:"\u0995\u09C7"},hi:{genitive:"\u0915\u093E",patientMarker:"\u0915\u094B"},ja:{genitive:"\u306E",patientMarker:"\u3092"},ko:{genitive:"\uC758",patientMarker:"\uB97C"},qu:{genitive:"pa",patientMarker:"ta"},tr:{genitive:"nin",patientMarker:"i"}};function Nu(r){let e=Ou[r];if(e)return [Pu(r,e)];let t=Lu[r];return t?[Ru(r,t)]:[]}var $n=[{type:"literal",value:"start"},{type:"group",optional:true,tokens:[{type:"literal",value:"a"}]},{type:"literal",value:"view"},{type:"literal",value:"transition"}];function _u(r){return [{id:`viewTransition-${r}-using`,language:r,command:"viewTransition",priority:111,template:{format:"start [a] view transition using {style}",tokens:[...$n,{type:"literal",value:"using"},{type:"role",role:"style",expectedTypes:["literal"]}]},extraction:{style:{marker:"using"}}},{id:`viewTransition-${r}`,language:r,command:"viewTransition",priority:110,template:{format:"start [a] view transition",tokens:$n},extraction:{}}]}var Mu={id:"fetch-en-with-response-type",language:"en",command:"fetch",priority:90,template:{format:"fetch {source} as {responseType}",tokens:[{type:"literal",value:"fetch"},{type:"role",role:"source",expectedTypes:["literal","expression"]},{type:"literal",value:"as"},{type:"role",role:"responseType",expectedTypes:["literal","expression"]}]},extraction:{source:{position:1},responseType:{marker:"as"}}},Iu={id:"fetch-en-with-options-as",language:"en",command:"fetch",priority:95,template:{format:"fetch {source} with {style} as {responseType}",tokens:[{type:"literal",value:"fetch"},{type:"role",role:"source",expectedTypes:["literal","expression"]},{type:"literal",value:"with",alternatives:["by","using"]},{type:"role",role:"style",expectedTypes:["expression"]},{type:"literal",value:"as"},{type:"role",role:"responseType",expectedTypes:["literal","expression"]}]},extraction:{source:{position:1},style:{marker:"with"},responseType:{marker:"as"}}},$u={id:"fetch-en-with-options",language:"en",command:"fetch",priority:93,template:{format:"fetch {source} with {style}",tokens:[{type:"literal",value:"fetch"},{type:"role",role:"source",expectedTypes:["literal","expression"]},{type:"literal",value:"with",alternatives:["by","using"]},{type:"role",role:"style",expectedTypes:["expression"]}]},extraction:{source:{position:1},style:{marker:"with"}}},ju={id:"fetch-en-simple",language:"en",command:"fetch",priority:80,template:{format:"fetch {source}",tokens:[{type:"literal",value:"fetch"},{type:"role",role:"source"}]},extraction:{source:{position:1}}},Wu=[Iu,$u,Mu,ju],ot={type:"group",optional:true,tokens:[{type:"literal",value:"using"},{type:"literal",value:"view"},{type:"role",role:"manner",optional:true,expectedTypes:["literal","expression"],valueShape:"keyword"}]},Vu={id:"swap-en-handcrafted",language:"en",command:"swap",priority:110,template:{format:"swap {method} {destination} [using view {manner}]",tokens:[{type:"literal",value:"swap"},{type:"role",role:"method"},{type:"role",role:"destination"},ot]},extraction:{method:{position:1},destination:{position:2}}},qu={id:"swap-en-element",language:"en",command:"swap",priority:120,template:{format:"swap {destination} with {patient} [using view {manner}]",tokens:[{type:"literal",value:"swap"},{type:"role",role:"destination"},{type:"literal",value:"with"},{type:"role",role:"patient"},ot]},extraction:{}},Ku={id:"swap-en-strategy-of",language:"en",command:"swap",priority:140,template:{format:"swap {method} of {destination} with {patient} [using view {manner}]",tokens:[{type:"literal",value:"swap"},{type:"role",role:"method"},{type:"literal",value:"of"},{type:"role",role:"destination"},{type:"literal",value:"with"},{type:"role",role:"patient"},ot]},extraction:{}},Hu={id:"swap-en-strategy",language:"en",command:"swap",priority:130,template:{format:"swap {method} {destination} with {patient} [using view {manner}]",tokens:[{type:"literal",value:"swap"},{type:"role",role:"method"},{type:"role",role:"destination"},{type:"literal",value:"with"},{type:"role",role:"patient"},ot]},extraction:{}},Uu=[Ku,Hu,qu,Vu],Gu={id:"repeat-en-until-event-from",language:"en",command:"repeat",priority:120,template:{format:"repeat until event {event} from {source}",tokens:[{type:"literal",value:"repeat"},{type:"literal",value:"until"},{type:"literal",value:"event"},{type:"role",role:"event",expectedTypes:["literal","expression"]},{type:"literal",value:"from"},{type:"role",role:"source",expectedTypes:["selector","reference","expression"]}]},extraction:{event:{marker:"event"},source:{marker:"from"},loopType:{default:{type:"literal",value:"until-event"}}}},Yu={id:"repeat-en-until-event",language:"en",command:"repeat",priority:110,template:{format:"repeat until event {event}",tokens:[{type:"literal",value:"repeat"},{type:"literal",value:"until"},{type:"literal",value:"event"},{type:"role",role:"event",expectedTypes:["literal","expression"]}]},extraction:{event:{marker:"event"},loopType:{default:{type:"literal",value:"until-event"}}}},Zu=[Gu,Yu],Xu=[...Ht],Ju={id:"set-en-possessive",language:"en",command:"set",priority:100,template:{format:"set {destination} to {patient} [on {scope}]",tokens:[{type:"literal",value:"set"},{type:"role",role:"destination",expectedTypes:["property-path","selector","reference","expression"]},{type:"literal",value:"to"},{type:"role",role:"patient",expectedTypes:Xu},{type:"group",optional:true,tokens:[{type:"literal",value:"on"},{type:"role",role:"scope",optional:true,expectedTypes:["selector","reference"]}]}]},extraction:{destination:{position:1},patient:{marker:"to"},scope:{marker:"on"}}},Qu=[Ju],el={id:"for-en-basic",language:"en",command:"for",priority:100,template:{format:"for {patient} in {source}",tokens:[{type:"literal",value:"for"},{type:"role",role:"patient",expectedTypes:["expression","reference"]},{type:"literal",value:"in"},{type:"role",role:"source",expectedTypes:["selector","expression","reference"]}]},extraction:{patient:{position:1},source:{marker:"in"}}},rl={id:"if-en-basic",language:"en",command:"if",priority:100,template:{format:"if {condition}",tokens:[{type:"literal",value:"if"},{type:"role",role:"condition",expectedTypes:["expression","reference","selector"]}]},extraction:{condition:{position:1}}},tl={id:"unless-en-basic",language:"en",command:"unless",priority:100,template:{format:"unless {condition}",tokens:[{type:"literal",value:"unless"},{type:"role",role:"condition",expectedTypes:["expression","reference","selector"]}]},extraction:{condition:{position:1}}},nl=[el,rl,tl],il={id:"temporal-en-in",language:"en",command:"wait",priority:95,template:{format:"in {duration}",tokens:[{type:"literal",value:"in"},{type:"role",role:"duration",expectedTypes:["literal","expression"]}]},extraction:{duration:{position:1}}},al={id:"temporal-en-after",language:"en",command:"wait",priority:95,template:{format:"after {duration}",tokens:[{type:"literal",value:"after"},{type:"role",role:"duration",expectedTypes:["literal","expression"]}]},extraction:{duration:{position:1}}},ol=[il,al],sl=[...Wu,...Uu,...Zu,...Qu,...nl,...ol];function ul(){return sl}function tr(r){let e=r.roles.find(t=>t.role==="destination");return e?{destination:e.default?{fromRole:"destination",default:e.default}:{fromRole:"destination"}}:{}}function nr(r){let e=r.roles.find(t=>t.role==="source");return e?{source:e.default?{fromRole:"source",default:e.default}:{fromRole:"source"}}:{}}function ir(r,e){return Jt(r,e,"source")}function Xt(r,e){return Jt(r,e,"destination")}function ll(r,e){return Jt(r,e,"patient")}function Jt(r,e,t){if(!e||!r.roles.some(a=>a.role===t))return [];let n=e.alternatives?{type:"literal",value:e.primary,alternatives:[...e.alternatives]}:{type:"literal",value:e.primary},i={type:"role",role:t,optional:true};return [{type:"group",optional:true,tokens:e.position==="after"?[i,n]:[n,i]}]}var cl={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:re,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)"}},dl={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"}},pl={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:re,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"}},ml={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:qi,svoPosition:1,sovPosition:1},{role:"destination",description:"Where to put the content",required:true,expectedTypes:Ki,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"}},fl={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:Ht,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>"}},yl={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>"}},vl={action:"live",description:"Reactive block: re-run the body when its dependencies change",category:"control-flow",primaryRole:"patient",hasBody:true,bareKeyword:true,roles:[]},hl={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}]},El={action:"eventsource",description:"Open a Server-Sent Events stream and handle its events",category:"async",primaryRole:"patient",hasBody:true,bareKeyword:true,roles:[]},gl={action:"socket",description:"Open a WebSocket and handle its messages",category:"async",primaryRole:"patient",hasBody:true,bareKeyword:true,roles:[]},kl={action:"worker",description:"Define a Web Worker with inline methods",category:"async",primaryRole:"patient",hasBody:true,bareKeyword:true,roles:[]},wl={action:"intercept",description:"Service-worker fetch interception / caching strategies",category:"async",primaryRole:"patient",hasBody:true,bareKeyword:true,roles:[]},zl={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:re,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}]},bl={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:re,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}]},Cl={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"]}]},Al={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:re,default:{type:"reference",value:"me"},svoPosition:2,sovPosition:1}]},xl={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}]},Dl={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}]},Sl={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"}}]},Bl={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"}}]},Tl={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"}}]},Fl={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"}}]},Pl={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}]},Ol={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:Vi,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}]},Rl={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:re,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"}}]},Ll={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}]},Nl={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}]},_l={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:re,default:{type:"reference",value:"me"},svoPosition:1,sovPosition:1}]},Ml={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}]},Il={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,markerOverride:{bn:"\u0995\u09C7"},markerLegacy:{bn:["\u09A4\u09C7"]}},{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"}}]},$l={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}]},jl={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}]},Wl={action:"else",description:"Else branch of conditional",category:"control-flow",primaryRole:"patient",hasBody:true,roles:[]},Vl={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"'},ql={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"}}]},Kl={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}]},Hl={action:"continue",description:"Continue to next loop iteration",category:"control-flow",primaryRole:"patient",ast:{},roles:[]},st={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"},Ul=Object.fromEntries(Object.keys(st).map(r=>[r,"in new"])),Gl={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",...re],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:Ul}],rolePrefixLiteralVariants:[{role:"destination",literal:st,idSuffix:"url",priorityDelta:5,methodCarrier:"method"}]},Yl={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}]},Zl={action:"viewTransition",description:"Run the body inside a view transition",category:"dom-visibility",primaryRole:"style",hasBody:true,structuralOnly:true,roles:[{role:"style",description:'The transition type (`using "slide"`), passed as `types: [type]`',required:false,expectedTypes:["literal"],svoPosition:1,sovPosition:1,markerOverride:{en:"using"}}]},Xl={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"}}]},Jl={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:re,default:{type:"reference",value:"me"},svoPosition:1,sovPosition:1}]},Ql={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:re,default:{type:"reference",value:"me"},svoPosition:1,sovPosition:1}]},ec={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:re,default:{type:"reference",value:"me"},svoPosition:1,sovPosition:1}]},rc={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:re,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"}}]},tc={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:re,default:{type:"reference",value:"me"},svoPosition:1,sovPosition:1}]},nc={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:re,default:{type:"reference",value:"me"},svoPosition:1,sovPosition:1}]},ic={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}]},ac={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:re,default:{type:"reference",value:"me"},svoPosition:1,sovPosition:1}]},oc={action:"breakpoint",description:"Drop into the debugger",category:"control-flow",primaryRole:"patient",roles:[],bareKeyword:true},sc={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}]},uc={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}]},lc={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}]},cc={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:re,svoPosition:1,sovPosition:1,markerOverride:{en:"",he:"\u05D0\u05EA",zh:"\u628A"}}]},dc={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"}}]},pc={action:"init",description:"Initialization block that runs once",category:"control-flow",primaryRole:"patient",ast:{},hasBody:true,roles:[]},mc={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}]},fc={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}]},yc={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:re,default:{type:"reference",value:"me"},svoPosition:2,sovPosition:2,markerOverride:{en:"of"}}]},vc={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"},Qt={role:"manner",description:"Run the swap inside a `document.startViewTransition()` (`using view transition`)",required:false,expectedTypes:["literal","expression"],valueShape:"keyword",markerOverride:vc},hc={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:[...re,"property-path"],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","reference","property-path"],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"}},{...Qt,svoPosition:4,sovPosition:4}]},Ec={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:re,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"}},{...Qt,svoPosition:3,sovPosition:3}]},gc={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}]},kc={action:"break",description:"Exit from the current loop",category:"control-flow",primaryRole:"patient",roles:[]},wc={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}]},zc={action:"exit",description:"Exit from the current event handler",category:"control-flow",primaryRole:"patient",roles:[],bareKeyword:true},bc={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}]},Cc={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"}}]},Ac={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"},xc={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:st}]},Dc={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:st}]},Sc={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:Ac},{...Qt,svoPosition:2,sovPosition:2}]},Bc={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}]},fe={toggle:cl,add:dl,remove:pl,put:ml,set:fl,show:zl,hide:bl,on:Cl,trigger:Al,wait:xl,fetch:Dl,increment:Sl,decrement:Bl,append:Tl,prepend:Fl,log:Pl,get:Ol,take:Rl,make:Ll,halt:Nl,settle:_l,throw:Ml,send:Il,if:$l,unless:jl,else:Wl,repeat:Vl,for:ql,while:Kl,continue:Hl,go:Gl,scroll:Cc,push:xc,replace:Dc,process:Sc,transition:Yl,viewTransition:Zl,clone:Xl,focus:Jl,blur:Ql,empty:ec,open:rc,close:tc,select:nc,clear:ic,reset:ac,breakpoint:oc,call:sc,return:uc,js:lc,tell:cc,default:dc,init:pc,behavior:mc,install:fc,measure:yc,swap:hc,morph:Ec,beep:gc,break:kc,copy:wc,exit:zc,pick:bc,render:Bc,bind:yl,live:vl,when:hl,eventsource:El,socket:gl,worker:kl,intercept:wl,compound:{action:"compound",description:"A compound node representing chained statements",primaryRole:"patient",category:"control-flow",hasBody:true,roles:[]}};function oe(r){return fe[r]}function Tc(){return Object.values(fe).filter(r=>r.structuralOnly!==true&&(r.roles.length>0||r.bareKeyword===true))}typeof process<"u"&&process.env.LOKASCRIPT_SCHEMA_VALIDATION==="1"&&Promise.resolve().then(()=>(ks(),Pi)).then(({validateAllSchemas:r,formatValidationResults:e})=>{let t=r(fe);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);});function Qi(r,e){let t=e==="SOV"?"sovPosition":"svoPosition";return [...r].sort((n,i)=>{let a=n[t]??99,o=i[t]??99;return a-o})}function Fc(r,e){let t=r.markerOverride?.[e.code],n=e.roleMarkers[r.role];if(t!==void 0){let i=Pc(r,e.code,t);return {primary:t,...i&&{alternatives:i},position:n?.position??"before",isOverride:true}}if(n&&n.primary){let i={primary:n.primary,position:n.position,isOverride:false};return n.alternatives&&(i.alternatives=n.alternatives),i}return null}function Pc(r,e,t){let n=r.markerLegacy?.[e];if(!n?.length)return;let i=[...new Set(n)].filter(a=>a&&a!==t);return i.length?i:void 0}function Ke(r,e,t){let n=r.markerLegacy?.[e]??[],i=r.methodCarrier?[]:r.markerVariants?.[e]??[],a=[...new Set([...n,...i])].filter(o=>o&&o!==t);return a.length?a:void 0}var _r=new Set(["destination","source","patient","object","event","eventmarker","manner","instrument","style"]);function kr(r,e){let t,n;if(r.markerOverride&&r.markerOverride[e.code]!==void 0)t=r.markerOverride[e.code],n=t?Ke(r,e.code,t):void 0;else {let i=e.roleMarkers[r.role];if(i){t=i.primary;let a=Ke(r,e.code,t)??[],o=[...new Set([...i.alternatives??[],...a])].filter(s=>s!==t);n=o.length?o:void 0;}}return {marker:t,alternatives:n}}function Mr(r,e,t){t.roles.find(i=>i.role==="scope"&&!i.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 en(r,e,t,n){ra(r,e,t,n,"manner",{requireMarker:true});}function ea(r,e,t,n){ra(r,e,t,n,"recipient",{requireMarker:false});}function ra(r,e,t,n,i,a){let o=t.roles.find(u=>u.role===i&&!u.required);if(!o)return;let s=o.markerOverride?.[n];a.requireMarker&&!s||(r.push({type:"group",optional:true,tokens:[...(s?s.split(/\s+/):[]).map(u=>({type:"literal",value:u})),{type:"role",role:i,optional:true,expectedTypes:o.expectedTypes,...o.valueShape!==void 0?{valueShape:o.valueShape}:{}}]}),e[i]={fromRole:i});}function ta(r){if(r.roles.some(n=>n.role==="patient"))return "patient";let e=r.roles.filter(n=>n.required),t=e.find(n=>n.role===r.primaryRole)??e[0];return !t||t.role==="event"?"patient":t.role}function na(r,e,t){let n=r.roles.find(c=>c.role===t);if(!n||t==="patient")return [{type:"role",role:t,optional:false}];let{marker:i,alternatives:a}=kr(n,e),o={type:"role",role:t,optional:false,...n.valueShape!==void 0?{valueShape:n.valueShape}:{}};if(!i)return [o];let s=i.split(/\s+/).filter(Boolean),u={type:"group",optional:true,tokens:s.map(c=>({type:"literal",value:c,...s.length===1&&a?.length?{alternatives:a}:{}}))};return (e.roleMarkers[t]?.position??"before")==="after"?[o,u]:[u,o]}function ia(r,e,t,n,i){for(let a of t.roles)a.required||i.has(a.role)||e[a.role]||!(a.markerOverride?.[n.code]??n.roleMarkers[a.role]?.primary)&&a.valueShape===void 0||(r.push({type:"group",optional:true,tokens:oa(a,n)}),e[a.role]=a.default?{fromRole:a.role,default:a.default}:{fromRole:a.role});}function Oc(r,e,t,n,i){let a=[];if(a.push({type:"role",role:"event",optional:false}),n.position==="after"){let f=n.primary.split(/\s+/);if(f.length>1)for(let v of f)a.push({type:"literal",value:v});else {let v=n.alternatives?{type:"literal",value:n.primary,alternatives:n.alternatives}:{type:"literal",value:n.primary};a.push(v);}}let o=ta(r),s=e.roleMarkers.destination,u=r.roles.some(f=>f.role==="destination");s&&u&&o!=="destination"&&a.push({type:"group",optional:true,tokens:[{type:"role",role:"destination",optional:true},s.alternatives?{type:"literal",value:s.primary,alternatives:s.alternatives}:{type:"literal",value:s.primary}]});let l=e.roleMarkers.source,c=r.roles.some(f=>f.role==="source");l&&c&&o!=="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(...na(r,e,o));let d=e.roleMarkers.patient;if(d&&o==="patient"){let f=d.alternatives?{type:"literal",value:d.primary,alternatives:d.alternatives}:{type:"literal",value:d.primary};a.push(f);}let p=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};a.push(p),o!=="source"&&a.push(...ir(r,e.roleMarkers.source)),o!=="destination"&&a.push(...Xt(r,e.roleMarkers.destination));let m={action:{value:r.action},event:{fromRole:"event"},[o]:{fromRole:o},...o==="destination"?{}:tr(r),...o==="source"?{}:nr(r)};return ia(a,m,r,e,new Set(["event",o,"destination","source"])),{id:`${r.action}-event-${e.code}-sov`,language:e.code,command:"on",priority:(i.basePriority??100)+50,template:{format:`{event} ${n.primary} {destination?} {${o}} ${d?.primary||""} ${t.primary}`,tokens:a},extraction:m}}function Rc(r,e,t,n,i){let a=[],o=r.action==="swap",s=o?"destination":"patient";a.push({type:"role",role:s,optional:false});let u=e.roleMarkers.patient;if(u){let p=u.alternatives?{type:"literal",value:u.primary,alternatives:u.alternatives}:{type:"literal",value:u.primary};a.push(p);}if(a.push({type:"role",role:"event",optional:false}),n.position==="after"){let p=n.primary.split(/\s+/);if(p.length>1)for(let m of p)a.push({type:"literal",value:m});else {let m=n.alternatives?{type:"literal",value:n.primary,alternatives:n.alternatives}:{type:"literal",value:n.primary};a.push(m);}}let l=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};a.push(l),a.push(...ir(r,e.roleMarkers.source));let c=e.roleMarkers.destination;if(o&&c){let p=r.roles.find(m=>m.role==="patient")?.markerOverride?.[e.code];if(p&&p!==c.primary){let m=c.alternatives??[];m.includes(p)||(c={...c,alternatives:[...m,p]});}}a.push(...o?ll(r,c):Xt(r,c));let d={action:{value:r.action},event:{fromRole:"event"},[s]:{fromRole:s},...o?{}:tr(r),...nr(r)};return ea(a,d,r,e.code),en(a,d,r,e.code),{id:`${r.action}-event-${e.code}-sov-patient-first`,language:e.code,command:"on",priority:(i.basePriority??100)+45,template:{format:`{patient} ${u?.primary||""} {event} ${n.primary} ${t.primary}`,tokens:a},extraction:d}}function Lc(r,e,t,n,i){let a=r.roles.find(d=>d.role==="source");if(!a)return null;let{marker:o,alternatives:s}=kr(a,e),u=e.roleMarkers.patient;if(!o||o===n.primary||o===u?.primary)return null;let l=[];l.push({type:"role",role:"patient",optional:false}),u&&l.push(u.alternatives?{type:"literal",value:u.primary,alternatives:u.alternatives}:{type:"literal",value:u.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 o.split(/\s+/))l.push(s&&o.split(/\s+/).length===1?{type:"literal",value:d,alternatives:s}:{type:"literal",value:d});if(l.push({type:"role",role:"event",optional:false}),n.position==="after"){let d=n.primary.split(/\s+/);if(d.length>1)for(let p of d)l.push({type:"literal",value:p});else l.push(n.alternatives?{type:"literal",value:n.primary,alternatives:n.alternatives}:{type:"literal",value:n.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 ea(l,c,r,e.code),en(l,c,r,e.code),{id:`${r.action}-event-${e.code}-sov-source-fronted`,language:e.code,command:"on",priority:(i.basePriority??100)+48,template:{format:`{patient} ${u?.primary||""} {source} ${o} {event} ${n.primary} ${t.primary}`,tokens:l},extraction:c}}function Nc(r,e,t,n,i){let a=[];a.push({type:"role",role:"patient",optional:false});let o=e.roleMarkers.patient;if(o){let l=o.alternatives?{type:"literal",value:o.primary,alternatives:o.alternatives}:{type:"literal",value:o.primary};a.push(l);}let s=e.roleMarkers.destination;if(s&&(a.push({type:"role",role:"destination",optional:false}),a.push(s.alternatives?{type:"literal",value:s.primary,alternatives:s.alternatives}:{type:"literal",value:s.primary})),a.push({type:"role",role:"event",optional:false}),n.position==="after"){let l=n.primary.split(/\s+/);if(l.length>1)for(let c of l)a.push({type:"literal",value:c});else {let c=n.alternatives?{type:"literal",value:n.primary,alternatives:n.alternatives}:{type:"literal",value:n.primary};a.push(c);}}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-patient-first-dest`,language:e.code,command:"on",priority:(i.basePriority??100)+40,template:{format:`{patient} ${o?.primary||""} {destination} ${s?.primary||""} {event} ${n.primary} ${t.primary}`,tokens:a},extraction:{action:{value:r.action},event:{fromRole:"event"},patient:{fromRole:"patient"},destination:{fromRole:"destination"}}}}function _c(r,e,t,n,i){let a=[];a.push({type:"role",role:"event",optional:false});let o=n.alternatives?.filter(c=>!c.includes(" ")&&c.length>1)||[];o.length>0&&a.push({type:"literal",value:o[0],alternatives:o.slice(1)});let s=e.roleMarkers.destination;s&&a.push({type:"group",optional:true,tokens:[{type:"role",role:"destination",optional:true},s.alternatives?{type:"literal",value:s.primary,alternatives:s.alternatives}:{type:"literal",value:s.primary}]}),a.push({type:"role",role:"patient",optional:false});let u=e.roleMarkers.patient;if(u){let c=u.alternatives?{type:"literal",value:u.primary,alternatives:u.alternatives}:{type:"literal",value:u.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(...ir(r,e.roleMarkers.source)),a.push(...Xt(r,e.roleMarkers.destination)),{id:`${r.action}-event-${e.code}-sov-compact`,language:e.code,command:"on",priority:(i.basePriority??100)+52,template:{format:`{event}${o[0]||""} {patient} ${t.primary}`,tokens:a},extraction:{action:{value:r.action},event:{fromRole:"event"},patient:{fromRole:"patient"},...tr(r),...nr(r)}}}function Mc(r,e,t,n,i){let a=[];if(a.push({type:"role",role:"event",optional:false}),n.position==="after"){let s=n.primary.split(/\s+/);if(s.length>1)for(let u of s)a.push({type:"literal",value:u});else {let u=n.alternatives?{type:"literal",value:n.primary,alternatives:n.alternatives}:{type:"literal",value:n.primary};a.push(u);}}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-simple`,language:e.code,command:"on",priority:(i.basePriority??100)+48,template:{format:`{event} ${n.primary} ${t.primary}`,tokens:a},extraction:{action:{value:r.action},event:{fromRole:"event"},patient:{default:{type:"reference",value:"me"}}}}}function Ic(r,e,t,n){let i=e.eventHandler?.temporalMarkers;if(!i||i.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:i[0],alternatives:i.slice(1)}),a.push({type:"role",role:"patient",optional:false});let o=e.roleMarkers.patient;if(o?.primary){let u=o.alternatives?{type:"literal",value:o.primary,alternatives:o.alternatives}:{type:"literal",value:o.primary};a.push(u);}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-temporal`,language:e.code,command:"on",priority:(n.basePriority??100)+49,template:{format:`{event} ${i[0]} {patient} ${t.primary}`,tokens:a},extraction:{action:{value:r.action},event:{fromRole:"event"},patient:{fromRole:"patient"}}}}function $c(r,e,t,n,i){let a=[];if(a.push({type:"role",role:"event",optional:false}),n.position==="after"){let d=n.primary.split(/\s+/);if(d.length>1)for(let p of d)a.push({type:"literal",value:p});else {let p=n.alternatives?{type:"literal",value:n.primary,alternatives:n.alternatives}:{type:"literal",value:n.primary};a.push(p);}}let s=[...r.roles.filter(d=>d.required)].sort((d,p)=>{let m=d.sovPosition??999,f=p.sovPosition??999;return m-f});for(let d of s){a.push({type:"role",role:d.role,optional:false});let{marker:p,alternatives:m}=kr(d,e);if(p){let f=m?{type:"literal",value:p,alternatives:m}:{type:"literal",value:p};a.push(f);}}let u=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};a.push(u);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 Mr(a,c,r),{id:`${r.action}-event-${e.code}-sov-2role`,language:e.code,command:"on",priority:(i.basePriority??100)+55,template:{format:`{event} ${n.primary} ${l} ${t.primary}`,tokens:a},extraction:c}}function jc(r,e,t,n,i){let a=[],s=[...r.roles.filter(c=>c.required)].sort((c,d)=>{let p=c.sovPosition??999,m=d.sovPosition??999;return p-m});for(let c of s){a.push({type:"role",role:c.role,optional:false});let{marker:d,alternatives:p}=kr(c,e);d&&a.push(p?{type:"literal",value:d,alternatives:p}:{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}),n.position==="after"){let c=n.primary.split(/\s+/);if(c.length>1)for(let d of c)a.push({type:"literal",value:d});else a.push(n.alternatives?{type:"literal",value:n.primary,alternatives:n.alternatives}:{type:"literal",value:n.primary});}let u=s.map(c=>`{${c.role}}`).join(" "),l={action:{value:r.action},event:{fromRole:"event"},...Object.fromEntries(s.map(c=>[c.role,{fromRole:c.role}]))};return Mr(a,l,r),{id:`${r.action}-event-${e.code}-sov-2role-event-last`,language:e.code,command:"on",priority:(i.basePriority??100)+40,template:{format:`${u} ${t.primary} {event} ${n.primary}`,tokens:a},extraction:l}}function Wc(r,e,t,n,i){let a=[],s=[...r.roles.filter(E=>E.required)].sort((E,h)=>{let y=E.sovPosition??999,k=h.sovPosition??999;return y-k}),u=s[0];a.push({type:"role",role:u.role,optional:false});let{marker:l,alternatives:c}=kr(u,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}),n.position==="after"){let E=n.primary.split(/\s+/);if(E.length>1)for(let h of E)a.push({type:"literal",value:h});else {let h=n.alternatives?{type:"literal",value:n.primary,alternatives:n.alternatives}:{type:"literal",value:n.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 p=s[1];a.push({type:"role",role:p.role,optional:false});let{marker:m,alternatives:f}=kr(p,e);if(m){let E=f?{type:"literal",value:m,alternatives:f}:{type:"literal",value:m};a.push(E);}let v={action:{value:r.action},event:{fromRole:"event"},[u.role]:{fromRole:u.role},[p.role]:{fromRole:p.role}};return Mr(a,v,r),{id:`${r.action}-event-${e.code}-sov-2role-dest-first`,language:e.code,command:"on",priority:(i.basePriority??100)+48,template:{format:`{${u.role}} {event} ${n.primary} ${t.primary} {${p.role}}`,tokens:a},extraction:v}}function aa(r,e,t){let n=Ke(r,e.code,t.primary)??[],i=[...new Set([...t.alternatives??[],...n])].filter(a=>a!==t.primary);return i.length?i:void 0}function jn(r,e,t,n,i){let a=[];if(n.position==="before"){let d=n.alternatives?{type:"literal",value:n.primary,alternatives:n.alternatives}:{type:"literal",value:n.primary};a.push(d);}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);let s=ta(r);a.push(...na(r,e,s));let u=e.roleMarkers.destination,l=r.roles.some(d=>d.role==="destination");u&&l&&s!=="destination"&&a.push({type:"group",optional:true,tokens:[u.alternatives?{type:"literal",value:u.primary,alternatives:u.alternatives}:{type:"literal",value:u.primary},{type:"role",role:"destination",optional:true}]}),s!=="source"&&a.push(...ir(r,e.roleMarkers.source));let c={action:{value:r.action},event:{fromRole:"event"},[s]:{fromRole:s},...s==="destination"?{}:tr(r),...s==="source"?{}:nr(r)};return ia(a,c,r,e,new Set(["event",s,"destination","source"])),{id:`${r.action}-event-${e.code}-vso`,language:e.code,command:"on",priority:(i.basePriority??100)+50,template:{format:`${n.primary} {event} ${t.primary} {${s}} ${u?.primary||""} {destination?}`,tokens:a},extraction:c}}function Vc(r,e,t,n,i){let a=[],o=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};a.push(o);let s=r.action==="swap";a.push({type:"role",role:s?"destination":"patient",optional:false});let u=s?void 0:e.roleMarkers.destination;if(u&&a.push({type:"group",optional:true,tokens:[u.alternatives?{type:"literal",value:u.primary,alternatives:u.alternatives}:{type:"literal",value:u.primary},{type:"role",role:"destination",optional:true}]}),a.push(...ir(r,e.roleMarkers.source)),n.position==="before"){let c=n.alternatives?{type:"literal",value:n.primary,alternatives:n.alternatives}:{type:"literal",value:n.primary};a.push(c);}if(a.push({type:"role",role:"event",optional:false}),s){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"},[s?"destination":"patient"]:{fromRole:s?"destination":"patient"},...s?{}:tr(r),...nr(r)};return en(a,l,r,e.code),{id:`${r.action}-event-${e.code}-vso-verb-first`,language:e.code,command:"on",priority:(i.basePriority??100)+45,template:{format:`${t.primary} {patient} ${u?.primary||""} {destination?} ${n.primary} {event}`,tokens:a},extraction:l}}function qc(r,e,t,n,i){let a=[],o=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};a.push(o);let u=[...r.roles.filter(d=>d.required)].sort((d,p)=>{let m=d.svoPosition??999,f=p.svoPosition??999;return m-f});for(let d of u){let p,m;if(d.markerOverride&&d.markerOverride[e.code]!==void 0)p=d.markerOverride[e.code],m=p?Ke(d,e.code,p):void 0;else {let f=e.roleMarkers[d.role];f&&(p=f.primary,m=aa(d,e,f));}if(p){let f=m?{type:"literal",value:p,alternatives:m}:{type:"literal",value:p};a.push(f);}a.push({type:"role",role:d.role,optional:false});}if(n.position==="before"){let d=n.alternatives?{type:"literal",value:n.primary,alternatives:n.alternatives}:{type:"literal",value:n.primary};a.push(d);}a.push({type:"role",role:"event",optional:false});let l=u.map(d=>`{${d.role}}`).join(" "),c={action:{value:r.action},event:{fromRole:"event"},...Object.fromEntries(u.map(d=>[d.role,{fromRole:d.role}]))};return Mr(a,c,r),{id:`${r.action}-event-${e.code}-vso-verb-first-2role`,language:e.code,command:"on",priority:(i.basePriority??100)+48,template:{format:`${t.primary} ${l} ${n.primary} {event}`,tokens:a},extraction:c}}function Wn(r,e,t,n,i){let a=[];if(n.position==="before"){let d=n.alternatives?{type:"literal",value:n.primary,alternatives:n.alternatives}:{type:"literal",value:n.primary};a.push(d);}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);let u=[...r.roles.filter(d=>d.required)].sort((d,p)=>{let m=d.svoPosition??999,f=p.svoPosition??999;return m-f});for(let d of u){let p,m;if(d.markerOverride&&d.markerOverride[e.code]!==void 0)p=d.markerOverride[e.code],m=p?Ke(d,e.code,p):void 0;else {let f=e.roleMarkers[d.role];f&&(p=f.primary,m=aa(d,e,f));}if(p){let f=m?{type:"literal",value:p,alternatives:m}:{type:"literal",value:p};a.push(f);}a.push({type:"role",role:d.role,optional:false});}let l=u.map(d=>`{${d.role}}`).join(" "),c={action:{value:r.action},event:{fromRole:"event"},...Object.fromEntries(u.map(d=>[d.role,{fromRole:d.role}]))};return Mr(a,c,r),{id:`${r.action}-event-${e.code}-vso-2role`,language:e.code,command:"on",priority:(i.basePriority??100)+55,template:{format:`${n.primary} {event} ${t.primary} ${l}`,tokens:a},extraction:c}}function Kc(r,e,t,n,i){let a=[],o=e.eventHandler?.negationMarker;if(n.position==="before"){let l=n.alternatives?{type:"literal",value:n.primary,alternatives:n.alternatives}:{type:"literal",value:n.primary};a.push(l);}if(o){let l=o.alternatives?{type:"literal",value:o.primary,alternatives:o.alternatives}:{type:"literal",value:o.primary};a.push(l);}a.push({type:"role",role:"event",optional:false});let s=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};a.push(s),a.push({type:"role",role:"patient",optional:false});let u=e.roleMarkers.destination;return u&&a.push({type:"group",optional:true,tokens:[u.alternatives?{type:"literal",value:u.primary,alternatives:u.alternatives}:{type:"literal",value:u.primary},{type:"role",role:"destination",optional:true}]}),a.push(...ir(r,e.roleMarkers.source)),{id:`${r.action}-event-${e.code}-vso-negated`,language:e.code,command:"on",priority:(i.basePriority??100)+48,template:{format:`${n.primary} ${o?.primary||""} {event} ${t.primary} {patient} ${u?.primary||""} {destination?}`,tokens:a},extraction:{action:{value:r.action},event:{fromRole:"event"},patient:{fromRole:"patient"},...tr(r),...nr(r)}}}function Hc(r,e,t,n){let i=[];i.push({type:"literal",value:"and",alternatives:["then"]}),i.push({type:"role",role:"event",optional:false});let a=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};i.push(a),i.push({type:"role",role:"patient",optional:false});let o=e.roleMarkers.destination;return o&&i.push({type:"group",optional:true,tokens:[o.alternatives?{type:"literal",value:o.primary,alternatives:o.alternatives}:{type:"literal",value:o.primary},{type:"role",role:"destination",optional:true}]}),i.push(...ir(r,e.roleMarkers.source)),{id:`${r.action}-event-${e.code}-vso-proclitic`,language:e.code,command:"on",priority:(n.basePriority??100)+45,template:{format:`[proclitic?] {event} ${t.primary} {patient} ${o?.primary||""} {destination?}`,tokens:i},extraction:{action:{value:r.action},event:{fromRole:"event"},patient:{fromRole:"patient"},...tr(r),...nr(r)}}}var br={basePriority:100,generateSimpleVariants:true,generateAlternatives:true};function Tr(r,e,t=br){let n=`${r.action}-${e.code}-generated`,i=t.basePriority??100,a=e.keywords[r.action];if(!a)throw new Error(`No keyword translation for '${r.action}' in ${e.code}`);let o=Zc(r,e,a),s=tn(r,e),u=ed(r,e,a);return {id:n,language:e.code,command:r.action,priority:i,template:{format:u,tokens:o},extraction:s}}function Uc(r,e,t=br){if(r.roles.filter(s=>!s.required).length===0)return null;let i=r.roles.filter(s=>s.required),a={...r,roles:i};return {...Tr(a,e,t),id:`${r.action}-${e.code}-generated-simple`,priority:(t.basePriority??100)-5,extraction:tn(r,e)}}function Vn(r,e,t=br){if(e.wordOrder!=="SOV")return null;let n=r.roles.filter(s=>s.required);if(n.length!==1)return null;let i=e.keywords[r.action];if(!i)return null;let a=i.alternatives?{type:"literal",value:i.primary,alternatives:i.alternatives}:{type:"literal",value:i.primary},o=n.flatMap(s=>{let u=s.valuePrefixLiteral?.[e.code],l={type:"role",role:s.role,optional:false,expectedTypes:s.expectedTypes};return u?[{type:"literal",value:u},l]:[l]});return {id:`${r.action}-${e.code}-generated-verb-first`,language:e.code,command:r.action,priority:(t.basePriority??100)-20,template:{format:`${i.primary} <${n[0].role}>`,tokens:[a,...o]},extraction:tn(r,e)}}function Gc(r,e,t=br){let n=[];if(n.push(Tr(r,e,t)),t.generateSimpleVariants){let i=Uc(r,e,t);i&&n.push(i);}for(let i of r.omitRoleVariants??[]){let a={...r,roles:r.roles.filter(s=>s.role!==i)},o=Tr(a,e,t);n.push({...o,id:`${r.action}-${e.code}-generated-no-${i}`,priority:(t.basePriority??100)-8});}for(let i of r.widenTypeVariants??[]){if(i.excludeLanguages?.includes(e.code))continue;let a={...r,roles:r.roles.map(s=>s.role===i.role?{...s,expectedTypes:[...i.types]}:s)},o=Tr(a,e,t);n.push({...o,id:`${r.action}-${e.code}-generated-${i.idSuffix}`,priority:(t.basePriority??100)-(i.priorityDelta??15)});}if(t.generateVerbFirstVariants!==false){let i=Vn(r,e,t);i&&n.push(i);}for(let i of r.rolePrefixLiteralVariants??[]){let a=i.literal[e.code];if(!a)continue;let{rolePrefixLiteralVariants:o,...s}=r,u={...s,roles:r.roles.map(p=>p.role===i.role?{...p,valuePrefixLiteral:{[e.code]:a}}:p)},l=i.priorityDelta??5,c=i.methodCarrier?{[i.methodCarrier]:{value:a}}:{},d=Tr(u,e,t);if(n.push({...d,id:`${r.action}-${e.code}-generated-${i.idSuffix}`,priority:(t.basePriority??100)+l,extraction:{...d.extraction,...c}}),t.generateVerbFirstVariants!==false){let p=Vn(u,e,t);p&&n.push({...p,id:`${r.action}-${e.code}-generated-verb-first-${i.idSuffix}`,priority:(t.basePriority??100)-20+l,extraction:{...p.extraction,...c}});}}return n}function rn(r,e=br){let t=[],n=Tc();for(let i of n){if(!r.keywords[i.action])continue;let a=Gc(i,r,e);if(t.push(...a),r.eventHandler?.eventMarker){let o=Yc(i,r,e);t.push(...o);}}return t}function Yc(r,e,t=br){if(!e.eventHandler||!e.eventHandler.eventMarker)return [];let n=[],i=e.eventHandler.eventMarker,a=e.keywords[r.action];if(!a)return [];if(r.roles.length===0)return [];if(r.action==="js")return [];let s=r.roles.filter(u=>u.required).length===2;if(e.wordOrder==="SOV")if(s)n.push($c(r,e,a,i,t)),n.push(Wc(r,e,a,i,t)),n.push(jc(r,e,a,i,t));else {n.push(Oc(r,e,a,i,t)),n.push(Rc(r,e,a,i,t));let u=Lc(r,e,a,i,t);u&&n.push(u);let l=e.roleMarkers.destination;l&&l.primary!==i.primary&&n.push(Nc(r,e,a,i,t));let c=i.primary.split(/\s+/),d=i.alternatives?.some(m=>!m.includes(" ")&&m.length>1);c.length>1&&d&&n.push(_c(r,e,a,i,t)),n.push(Mc(r,e,a,i,t));let p=Ic(r,e,a,t);p&&n.push(p);}else e.wordOrder==="VSO"?s?(n.push(Wn(r,e,a,i,t)),n.push(qc(r,e,a,i,t))):(n.push(jn(r,e,a,i,t)),n.push(Vc(r,e,a,i,t)),e.eventHandler?.negationMarker&&n.push(Kc(r,e,a,i,t)),e.tokenization?.prefixes&&n.push(Hc(r,e,a,t))):s?n.push(Wn(r,e,a,i,t)):n.push(jn(r,e,a,i,t));return n}function Zc(r,e,t){let n=[],i=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary},a=Jc(r,e);switch(e.wordOrder){case "SVO":n.push(i),n.push(...a);break;case "SOV":n.push(...a),n.push(i);break;case "VSO":n.push(i),n.push(...a);break;default:n.push(i),n.push(...a);}return Xc(n)}function Xc(r){let e=[];for(let t of r){let n=e[e.length-1];if(n&&n.type==="literal"&&t.type==="literal"&&n.value===t.value){let i=[...n.alternatives??[],...t.alternatives??[]];i.length&&(e[e.length-1]={...n,alternatives:[...new Set(i)]});continue}e.push(t);}return e}function Jc(r,e){let t=[],n=Qi(r.roles,e.wordOrder);for(let i of n){let a=oa(i,e);i.required?t.push(...a):t.push({type:"group",optional:true,tokens:a});}return t}function oa(r,e){let t=[],n=r.markerOverride?.[e.code],i=e.roleMarkers[r.role],a=r.renderOverride?.[e.code]==="",o={type:"role",role:r.role,optional:!r.required,expectedTypes:r.expectedTypes,...r.valueShape!==void 0?{valueShape:r.valueShape}:{}},s=r.valuePrefixLiteral?.[e.code],u=()=>{s&&t.push({type:"literal",value:s}),t.push(o);};if(n!==void 0){let l=n?n.split(/\s+/).filter(Boolean):[],c=n!==void 0&&n===r.markerOverride?.en,d=i?.position??(e.wordOrder==="SOV"&&!c?"after":"before"),p=r.markerOptional?.[e.code]===true,m=f=>{let v=l.length===1?Ke(r,e.code,f)??[]:[],E={type:"literal",value:f,...v.length?{alternatives:v}:{},...a?{renderSuppress:true}:{}};t.push(p?{type:"group",optional:true,tokens:[E]}:E);};if(d==="before"){for(let f of l)m(f);u();}else {u();for(let f of l)m(f);}}else if(i){let l=()=>{let d=[...new Set([...i.alternatives??[],...Ke(r,e.code,i.primary)??[]])].filter(p=>p!==i.primary);return {type:"literal",value:i.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]});};i.position==="before"?(i.primary&&c(l()),u()):(u(),c(l()));}else u();return t}function Qc(r,e){let t={};for(let n of r.roles){let i=n.markerOverride?.[e.code],a=e.roleMarkers[n.role];if(n.valuePrefixLiteral?.[e.code])t[n.role]={marker:n.valuePrefixLiteral[e.code]};else if(i!==void 0)if(!i)t[n.role]={};else {let s=!/\s/.test(i.trim())?Ke(n,e.code,i)??[]:[];t[n.role]=s.length?{marker:i,markerAlternatives:s}:{marker:i};}else if(a&&a.primary){let o=[...new Set([...a.alternatives??[],...Ke(n,e.code,a.primary)??[]])].filter(s=>s!==a.primary);t[n.role]=o.length?{marker:a.primary,markerAlternatives:o}:{marker:a.primary};}else t[n.role]={};}return t}function tn(r,e){let t=Qc(r,e),n={};for(let i of r.roles){let a=t[i.role]||{};!i.required&&i.default?n[i.role]={...a,default:i.default}:n[i.role]=a;}return n}function ed(r,e,t){let n=[],a=Qi(r.roles,e.wordOrder).map(o=>{let s=Fc(o,e),u="";return s&&s.primary?s.position==="before"?u=`${s.primary} {${o.role}}`:u=`{${o.role}} ${s.primary}`:u=`{${o.role}}`,o.required?u:`[${u}]`});switch(e.wordOrder){case "SVO":case "VSO":n.push(t.primary,...a);break;case "SOV":n.push(...a,t.primary);break;default:n.push(t.primary,...a);}return n.join(" ")}function rd(r){return F(r)?_u(r):[]}var td=[Ts,Fs,Ns,js,Vs,qs,Ks,Hs,Gs,Ys,Zs,Xs,Js,Qs,Zt,bu,Cu,Au,xu,Nu,rd,Ws],qn=new Map;function nd(r){let e=qn.get(r);if(e)return e;let t=F(r);if(!t)return [];let n=rn(t);return qn.set(r,n),n}function id(r){let e=td.flatMap(t=>t(r));return r==="en"&&e.push(...ul()),e.push(...nd(r)),e.map(od)}var ad=new Set(["on.source"]);function od(r){let e=oe(r.command);if(!e)return r;let t;for(let n of e.roles){if(n.required||!n.default||ad.has(`${r.command}.${n.role}`))continue;let i=r.extraction?.[n.role];i?.default!==void 0||i?.value!==void 0||(t??(t={...r.extraction}),t[n.role]={...i,default:n.default});}return t?{...r,extraction:t}:r}function sd(r){return id(r.code)}zs(sd);var nn=["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"],an=["is not empty","is empty","does not exist"],on=["is not an","is not a","is an","is a"],ud=new Set(["me","my","myself","you","your","yourself","it","its","result","event","target","body","detail","window","document"]),ld=new Set(["and","or","not","no"]),cd=new Set(["true","false","null","undefined"]),dd=new Set(nn.map(r=>r.slice(r.lastIndexOf(" ")+1))),pd=new Set(["next","previous","closest","first","last"]),md=new Set(["ms","s","seconds","second","milliseconds","millisecond","minutes","minute","hours","hour"]);function sa(r){let e=[],t=0,n=1,i=1;function a(){if(e.length===0)return true;let f=e[e.length-1];return f.type==="IDENTIFIER"&&dd.has(f.value.toLowerCase())||f.type==="IDENTIFIER"&&pd.has(f.value.toLowerCase())||f.type==="IDENTIFIER"&&f.value.toLowerCase()==="of"?true:["OPERATOR","COMPARISON","LOGICAL","LPAREN","LBRACKET","LBRACE","COMMA","COLON"].includes(f.type)}function o(f=0){return r[t+f]??""}function s(){let f=r[t];return t++,f===`
5
+ `?(n++,i=1):i++,f}function u(){for(;t<r.length&&/\s/.test(r[t]);)s();}function l(f){let v="";for(;t<r.length&&f(r[t]);)v+=s();return v}function c(f){let v=f;for(s();t<r.length&&r[t]!==f;)r[t]==="\\"&&t+1<r.length&&(v+=s()),v+=s();return t<r.length&&(v+=s()),v}function d(){let f="`";for(s();t<r.length&&r[t]!=="`";)r[t]==="\\"&&t+1<r.length&&(f+=s()),f+=s();return t<r.length&&(f+=s()),f}function p(){let f="<";for(s();t<r.length&&(f+=s(),!f.endsWith("/>")););return f}function m(f,v,E){return {type:f,value:v,start:E,end:t,line:n,column:i-v.length}}for(;t<r.length&&(u(),!(t>=r.length));){let f=t,v=o();if(v==="'"&&o(1)==="s"&&!/\w/.test(o(2))){s(),s(),e.push(m("POSSESSIVE","'s",f));continue}if(v==='"'||v==="'"){let E=c(v);e.push(m("STRING",E,f));continue}if(v==="`"){let E=d();e.push(m("TEMPLATE_LITERAL",E,f));continue}if(v==="<"&&/[a-zA-Z.#\[]/.test(o(1))){let E=p();e.push(m("QUERY_SELECTOR",E,f));continue}if(v==="#"&&a()){s();let E=l(h=>/[\w-]/.test(h));e.push(m("ID_SELECTOR","#"+E,f));continue}if(v==="."&&/[a-zA-Z_-]/.test(o(1))&&a()){s();let E=l(h=>/[\w-]/.test(h));e.push(m("CLASS_SELECTOR","."+E,f));continue}if(v==="@"&&/[a-zA-Z_]/.test(o(1))){s();let E=l(h=>/[\w-]/.test(h));e.push(m("ATTRIBUTE_REF","@"+E,f));continue}if(v==="["&&a()&&o(1)==="@"){let h="";for(h+=s();t<r.length&&r[t]!=="]";)r[t]==='"'||r[t]==="'"?h+=c(r[t]):h+=s();t<r.length&&(h+=s()),e.push(m("ATTRIBUTE_SELECTOR",h,f));continue}if(v==="["){s(),e.push(m("LBRACKET","[",f));continue}if(v==="]"){s(),e.push(m("RBRACKET","]",f));continue}if(/\d/.test(v)){let E=l(k=>/[\d.]/.test(k)),h=t,y=l(k=>/[a-zA-Z]/.test(k));md.has(y)?e.push(m("TIME_EXPRESSION",E+y,f)):(t=h,e.push(m("NUMBER",E,f)));continue}if(v==="("){s(),e.push(m("LPAREN","(",f));continue}if(v===")"){s(),e.push(m("RPAREN",")",f));continue}if(v==="{"){s(),e.push(m("LBRACE","{",f));continue}if(v==="}"){s(),e.push(m("RBRACE","}",f));continue}if(v===","){s(),e.push(m("COMMA",",",f));continue}if(v===":"){s(),e.push(m("COLON",":",f));continue}if(v==="."){s(),e.push(m("DOT",".",f));continue}if(v==="|"){s(),e.push(m("PIPE","|",f));continue}if(v==="+"||v==="-"||v==="*"||v==="/"||v==="%"){s(),e.push(m("OPERATOR",v,f));continue}if(v==="="||v==="!"||v==="<"||v===">"){let E=s();o()==="="&&(E+=s()),(E==="=="||E==="!=")&&o()==="="&&(E+=s()),e.push(m("COMPARISON",E,f));continue}if(/[a-zA-Z_$]/.test(v)){let E=l(y=>/[\w$]/.test(y)),h=E.toLowerCase();ud.has(h)?e.push(m("CONTEXT_VAR",E,f)):ld.has(h)?e.push(m("LOGICAL",E,f)):cd.has(h)?e.push(m("BOOLEAN",E,f)):e.push(m("IDENTIFIER",E,f));continue}s();}return e.push(m("EOF","",t)),e}var fd=new Set(["my","its","your"]),yd={my:"me",its:"it",your:"you"},vd=new Set(["is","matches","match","contains","in","exists","does"]),hd=new Set(["next","previous","closest","first","last"]),Ed=[...an,...on,...nn].map(r=>[r,r.split(" ")]),gd=class{constructor(){this.tokens=[],this.current=0;}parse(r){try{return this.tokens=sa(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(an.includes(e))r=this.createPostfixUnary(e,r);else if(on.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 Ed)if(e.every((t,n)=>this.peekAt(n).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 n=true;return this.peek().value==="!"&&(this.advance(),n=false),{type:"typeCheckExpression",value:r,typeName:t.value,nullOk:n,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 i=0;i<r;i++)this.advance();let e=this.advance(),t=this.peekAt(1).type;if(!this.check("COLON")||t!=="NUMBER"&&t!=="IDENTIFIER")return e;this.advance();let n=this.advance();return {...e,value:`${e.value}:${n.value}`,end:n.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"&&fd.has(r.name)&&this.check("IDENTIFIER")&&!vd.has(this.peek().value.toLowerCase())){let e=this.advance(),t=r,n={...t,name:yd[t.name]??t.name};r=this.createMemberExpression(n,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(hd.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,n=e.type==="CLASS_SELECTOR"?"class":e.type==="ID_SELECTOR"?"id":"query";return {type:"callExpression",callee:this.createIdentifier(r.value,r),arguments:[this.createSelector(t,n,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 n=t?this.parseConversion():this.parseUnary();return {type:"propertyOfExpression",property:this.createIdentifier(r.value,r),target:n,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 n=this.parseExpression();r.push({key:t,value:n});}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]),n=e[2].toLowerCase();return {type:"timeExpression",value:t,unit:n,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 sn(r){return new gd().parse(r)}var ua={possessive:{specialForms:{me:"my",it:"its",you:"your"}}},Kn=new Map;function Vd(r){let e=r.toLowerCase();return Kn.get(e)??Kn.get(e.split("-")[0])}function Gr(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 Oe(r,e){let t=r.possessive?.keywords?.[e];if(t)return t;let n=r.possessive?.specialForms;if(n){for(let[i,a]of Object.entries(n))if(a===e)return i}}function Ct(r){return ua.possessive?.specialForms?.[r]??`${r}'s`}var ut=new Set(["+","-","*","/","%","<",">","<=",">=","==","!=","===","!=="]),la=new Set(["<",">","<=",">=","==","!=","===","!=="]),Ge=new Set([...ut,"mod"]),qd=/^[<>=!+\-*/%]+$/,ca={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 Kd(r){return ca[r]}function lt(r,e){return ca[e]?.has(r.toLowerCase())??false}var Hd=new Set(["click","dblclick","mousedown","mouseup","mouseover","mouseout","mouseenter","mouseleave","mousemove","keydown","keyup","keypress","input","change","submit","reset","load","unload","scroll","resize","focus","blur","contextmenu","dragstart","drag","dragend","dragenter","dragleave","dragover","drop","touchstart","touchmove","touchend","touchcancel"]),un={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"}},Ud={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"}},da={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 Hn(r){if(!r?.code)return;let e=da[r.code];if(e){let[t]=e;if(t)return t}return r.roleMarkers?.source?.primary}function Ye(r,e){let t=e.value.toLowerCase(),n=(e.normalized??"").toLowerCase();if(t==="of"||t==="ng"||n==="of"||n==="source")return true;let i=r?.code?da[r.code]:void 0;return !!i&&i.has(t)}var Gd={destination:"in",source:"from"},pa={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"])},ma=new Set(["in","into","at","within","inside"]);function Yd(r,e){let t=e.value.toLowerCase();if((r?.code?pa[r.code]:void 0)?.has(t))return "in";let i=e.normalized??e.value,a=i.toLowerCase();return ma.has(a)?"in":Gd[a]??i}function Zd(r,e){return e.value.toLowerCase()==="in"||(r?.code?pa[r.code]:void 0)?.has(e.value.toLowerCase())?true:ma.has((e.normalized??e.value).toLowerCase())}var Xd=new Set(["me","it","you","body","document","target","result"]);function Jd(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 n=(t.normalized??t.value).toLowerCase();if(Xd.has(n))return {kind:"reference",parts:[{text:n,token:t}],consumed:1};let i=r[e+1];return n==="closest"&&i?.kind==="selector"&&!/^[*@]/.test(i.value)?{kind:"closest",parts:[{text:"closest",token:t},{text:i.value,token:i}],consumed:2}:null}function fa(r,e,t,n){let i=r[e];if(!i||!Zd(t,i))return null;let a=Jd(r,e+1);if(!a)return null;let o=r[e+1+a.consumed];return n?.(i)===true&&n(o)!==true?null:{marker:i,scope:a}}var At=new Set(["first","last","next","previous","random","closest"]),Qd={bn:{\u09B6\u09C7\u09B7:"last"}},Cr=new Set(Object.keys(fe).map(r=>r.toLowerCase()));function Rr(r,e,t,n){let i=r[e];if(!i)return null;let a=(i.normalized??i.value).toLowerCase(),o=r[e+1],s=t?.code&&o?.kind==="selector"&&o.value.startsWith("<")?Qd[t.code]?.[i.value.toLowerCase()]:void 0;if(!At.has(a)&&!At.has(i.value.toLowerCase())&&s===void 0)return null;let u=[{text:s??i.normalized??i.value,token:i}],l=e+1,c=r[l];if(!c||c.kind!=="selector"||la.has(c.value))return null;u.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("."))u.push({text:f.value,token:f}),l++;else break}let p=r[l],m=r[l+1];if(p&&m&&m.kind==="selector"&&!/^[*@]/.test(m.value)&&(p.kind==="keyword"||p.kind==="particle"||p.kind==="identifier")&&!At.has((p.normalized??p.value).toLowerCase())&&!Cr.has((p.normalized??p.value).toLowerCase())&&!(n?.(p)===true&&n(r[l+2])!==true))u.push({text:Yd(t,p),token:p}),u.push({text:m.value,token:m}),l+=2;else {let f=fa(r,l,t,n);f&&f.scope.kind!=="selector"&&(u.push({text:"in",token:f.marker},...f.scope.parts),l+=1+f.scope.consumed);}return {parts:u,consumed:l-e}}function rr(r,e){let t=Ud[r];return t?t[e.toLowerCase()]??e:e}function we(r,e){let t=un[r];return t?t[e.toLowerCase()]??e:e}function Un(r,e){return un[r]?.[e.toLowerCase()]!==void 0}function ep(r,e){let t=[e.value,e.normalized].filter(Boolean);for(let n of t){let i=Oe(r,n)??Oe(r,n.toLowerCase());if(i)return i}}function ya(r){return r.kind==="literal"||r.kind==="operator"||r.kind==="punctuation"?false:!/^[$:@#.*^(){}[\]]/.test(r.value)}function rp(r,e){let t=r?.references;if(!t)return false;let n=Object.values(t).filter(a=>typeof a=="string").map(a=>a.toLowerCase());return [e.value,e.normalized].filter(Boolean).some(a=>n.includes(a.toLowerCase()))}function vr(r,e){return ya(r)?we(e,r.value)!==r.value?true:r.kind==="identifier":false}var tp=new Set(["true","false","null","undefined","me","my","it","its","you","your","result","event","target","body","detail","document","window"]);function va(r){return r.kind==="literal"||r.kind==="selector"||r.kind==="reference"?true:r.kind==="identifier"?ip.test(r.value):r.kind==="keyword"&&tp.has((r.normalized??r.value).toLowerCase())}function Gn(r){return !!r&&(r.value===")"||r.value==="]"||va(r))}function Mt(r){if(!r)return false;if(/^[([-]$/.test(r.value)||va(r))return true;let e=(r.normalized??"").toLowerCase();return r.kind==="keyword"&&(e==="not"||e==="no")}var np=/^\.[\p{L}_-][\p{L}\p{N}_-]*$/u,ip=/^(?:[:$]?[\p{L}_][\p{L}\p{M}\p{N}_]*|\([\p{L}_$][\p{L}\p{M}\p{N}_$]*\))$/u,U={beforeClassRef:"has"},ap={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:U},th:{\u0E40\u0E1B\u0E47\u0E19:{beforeTypeName:"as",beforePredicate:"is",afterOperand:"is"},\u0E27\u0E48\u0E32\u0E07:{afterCopula:"empty"},\u0E21\u0E35:U},ja:{\u7A7A:{afterCopula:"empty"},\u3042\u308B:U},sw:{tupu:{afterCopula:"empty",otherwise:"null"},na:{betweenOperands:"and"},ana:U,nina:U},zh:{\u6CA1\u6709:{beforeBareIdentifier:"no",beforeSelector:"no"},\u6709:U},tl:{walang:{beforeBareIdentifier:"no",beforeSelector:"no"},may:{afterSubject:"exists",beforeClassRef:"has"}},bn:{\u0986\u099B\u09C7:{afterSubject:"exists",beforeClassRef:"has"},\u0986\u099B\u09BF:U},qu:{mana:{beforeOperand:"not"},chusaq:{afterCopula:"empty"},kachkan:U,kachkani:U},tr:{var:{afterSubject:"exists",beforeClassRef:"has"},bo\u015F:{afterCopula:"empty"}},de:{hat:U,habe:U},es:{tiene:U,tengo:U},fr:{a:U,ai:U},it:{ha:U,ho:U},ko:{\uC788\uB2E4:U},ms:{ada:U},pl:{ma:U,mam:U},pt:{tem:U,tenho:U},ru:{\u0438\u043C\u0435\u0435\u0442:U,\u0438\u043C\u0435\u044E:U},uk:{\u043C\u0430\u0454:U,\u043C\u0430\u044E:U},vi:{c\u00F3:U}},op=new Set(["text","json","html","response","blob","arraybuffer"]),sp=new Set(["empty","null","undefined","true","false"]),ha=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 Lr(r){return ha.has(r)||/^Fixed(?::\d+)?$/.test(r)||/^[A-Z][A-Za-z0-9_]*(?::[A-Za-z0-9_]+)?$/.test(r)}function Ea(r,e,t,n,i,a){let o=It(r,e);if(!o)return;if(o.beforeTypeName&&n?.kind==="identifier"&&a?.value!=="("&&(ha.has(n.value)||op.has(n.value.toLowerCase())))return o.beforeTypeName;if(o.beforePredicate&&n&&(n.kind==="literal"||n.kind==="keyword"&&sp.has((n.normalized??"").toLowerCase())))return o.beforePredicate;if(o.afterCopula&&i!==void 0&&["is","not","does","do"].includes(i.toLowerCase()))return o.afterCopula;if(o.beforeBareIdentifier&&n?.kind==="identifier"&&/^[A-Za-z_]\w*$/.test(n.value))return o.beforeBareIdentifier;let s=!!n&&Nr(n,r)&&We({prev:e,beforePrev:t,next:a},r);if(o.beforeOperand&&(Mt(n)||s))return o.beforeOperand;if(o.beforeSelector&&n?.kind==="selector")return o.beforeSelector;if(o.beforeClassRef&&n&&np.test(n.value))return o.beforeClassRef;if(o.afterSubject&&(t?.kind==="selector"||t?.kind==="reference"))return o.afterSubject;let u=!!t&&Nr(t,r)&&i===t.value;return o.betweenOperands&&(Gn(t)||u)&&Mt(n)?o.betweenOperands:o.afterOperand&&(Gn(t)||t?.value==="}")?o.afterOperand:o.otherwise}function It(r,e){let t=ap[r];return t?.[e.value]??t?.[e.value.toLowerCase()]}function up(r,e,t,n){return Ea(r,e,t,n,void 0,void 0)}function lp(r){return qd.test(r)||r==="("||r==="["||r===","}function cp(r){return ut.has(r)&&r!=="-"||r===")"||r==="]"||r===","}var dp=new Set(["is","am","contains","contain","matches","match","has","have","includes","include","exists","exist","mod"]);function ga(r,e,t,n){let i=e.kind==="keyword"?(e.normalized??"").toLowerCase():rr(r,e.value).toLowerCase();if(i!=="and"&&i!=="or")return false;if(t===void 0||t!==void 0&&lp(t.value))return true;if(n===void 0)return false;if(cp(n.value))return true;let a=n.kind==="keyword"?(n.normalized??n.value).toLowerCase():rr(r,n.value).toLowerCase();return dp.has(a)}var pp=new Set(["include","contain","match","exist"]);function ka(r){let e=r?.toLowerCase();return e==="is"||e==="not"}function wa(r,e,t){let n=e[t],i=e[t-1];return !n||!i||n.value.toLowerCase()!=="in"?false:ka(wr(r,i,e[t-2],n,void 0))}function wr(r,e,t,n,i,a){if(i?.toLowerCase()==="equal"&&e.value.toLowerCase()==="to")return "to";if(ka(i)&&e.value.toLowerCase()==="in")return "in";if(i?.toLowerCase()==="not"&&pp.has(e.value.toLowerCase()))return e.value.toLowerCase();let o=Ea(r,e,t,n,i,a);if(o!==void 0)return o;if(ga(r,e,t,n))return e.value;let s=rr(r,e.value);if(s!==e.value)return s;if(e.kind!=="keyword")return e.value;let u=(e.normalized??e.value).toLowerCase();return u!=="event"&&_r.has(u)||Nr(e,r)&&We({prev:t,next:n,afterNext:a},r)?e.value:e.normalized??e.value}function za(r,e,t,n){let i=r[e],a=r[e+1];if(!i||!a||!ya(i)||!Ye(t,a)||!vr(i,n))return;if(r[e+2]?.kind==="selector")return e+2;let o=e;for(;r[o]!==void 0&&r[o+1]!==void 0&&Ye(t,r[o+1])&&vr(r[o],n);)o+=2;return o>e+2&&r[o]?.kind==="selector"?o:void 0}var mp=new Set(["if","unless","while","until","for","when","where","is","not","no","and","or","as"]);function fp(r){let e=(r.normalized??r.value).toLowerCase();return e==="event"||Ne(e)?false:mp.has(e)||_r.has(e)}function Nr(r,e){return r.kind!=="keyword"?false:(r.normalized??r.value).toLowerCase()==="end"||lt(r.value,e)}function ze(r,e){return {prev:r[e-1],beforePrev:r[e-2],third:r[e-3],next:r[e+1],afterNext:r[e+2]}}var yp=new Set(["and","or","is","times"]),vp=new Set(["if","unless","while","until","is","and","or","in"]),hp=r=>Object.prototype.hasOwnProperty.call(fe,r);function xt(r){if(r.kind!=="keyword"&&!(r.normalized&&r.normalized!==r.value))return;let e=(r.normalized??r.value).toLowerCase();return hp(e)?e:void 0}var Yn=new WeakMap;function Zn(r,e,t=false){let n;try{n=Ee(r);}catch{return new Set}let i=Yn.get(n);i||(i=new Map,Yn.set(n,i));let a=t?`${e} before a role pair`:e,o=i.get(a);if(!o){o=new Set;for(let s of n){if(s.command!==e)continue;let[u,l,c,d]=s.template.tokens;if(!(u?.type!=="literal"||l?.type!=="literal")&&!(t&&(c?.type!=="role"||d?.type!=="role")))for(let p of [l.value,...l.alternatives??[]])o.add(p.toLowerCase());}i.set(a,o);}return o}var Xn=new WeakMap;function Ep(r){let e;try{e=Ee(r);}catch{return new Set}let t=Xn.get(e);if(!t){let n=new Set(Object.values(F(r)?.roleMarkers??{}).flatMap(a=>a?[a.primary,...a.alternatives??[]]:[]).map(a=>a.toLowerCase())),i=new Set;for(let a of e){if(a.command!=="repeat")continue;let o=a.template.tokens;o.forEach((s,u)=>{if(!(s.type!=="literal"||o[u+1]?.type!=="role"))for(let l of [s.value,...s.alternatives??[]])n.has(l.toLowerCase())||i.add(l.toLowerCase());});}t=i,Xn.set(e,t);}return t}function Jn(r){return r.kind==="particle"?true:r.kind==="keyword"&&_r.has((r.normalized??"").toLowerCase())}function Qn(r,e){return r.kind==="keyword"&&r.normalized?r.normalized.toLowerCase():rr(e,r.value).toLowerCase()}function We(r,e){let{prev:t,beforePrev:n,next:i,afterNext:a}=r;if(i){if(Ge.has(i.value)||yp.has((i.normalized??i.value).toLowerCase())||i.value==="'"&&a?.value.toLowerCase()==="s")return true;let f=It(e,i)?.betweenOperands;if((f==="and"||f==="or")&&Mt(a))return true}let o=F(e),s=!!o&&o.markingStrategy!=="preposition";if(s&&i?.kind==="particle"&&a?.kind!=="particle")return true;if(!t)return false;if(ut.has(t.value))return true;if(t.value.toLowerCase()==="transition"&&n?.value.toLowerCase()==="view")return false;let u=Qn(t,e);if(u==="not"||u==="no"||It(e,t)?.beforeOperand==="not")return true;let l=o?.wordOrder!=="SOV",c=r.third?xt(r.third):void 0;if(c&&n&&Zn(e,c,true).has(n.value.toLowerCase()))return true;let d=n&&l?xt(n):void 0;if(d&&!Zn(e,d).has(t.value.toLowerCase())||n&&!s&&Jn(n))return false;if(vp.has(u))return true;let p=!!n&&Qn(n,e)!=="repeat"&&!!Gt[e]?.includes(t.value);if(Ep(e).has(t.value.toLowerCase())&&(l||u!=="repeat")&&!p)return true;let m=l?xt(t):void 0;return m&&fe[m].roles.some(f=>f.required)?true:!s&&Jn(t)}function Ar(r){if(r.kind!=="keyword")return;if(fp(r))return "structure";let e=(r.normalized??r.value).toLowerCase();return Cr.has(e)?"verb":Hd.has(e)?"event":void 0}function Le(r,e){let t=e?.code??"en",[n]=r;if(r.length===1&&n&&(Ar(n)||Nr(n,t)))return n.value;let i="",a,o,s=(u,l)=>{if(o=u,a===void 0){i=u,a=l;return}let d=a.position?.end!==void 0&&l.position?.start!==void 0&&a.position.end===l.position.start&&(u.startsWith(".")||u.startsWith("!"));i+=(d?"":" ")+u,a=l;};for(let u=0;u<r.length;u++){let l=r[u],c=e?ep(e,l):void 0,d=r[u+1];if(l.value===":"&&a!==void 0&&o!==void 0&&d!==void 0&&a.position?.end===l.position?.start&&l.position?.end===d.position?.start&&Lr(`${o}:${d.value}`)){i+=`:${d.value}`,o=`${o}:${d.value}`,a=d,u+=1;continue}if(l.value==="'"&&a!==void 0&&d?.value==="s"&&l.position?.end!==void 0&&d.position?.start===l.position.end){i+="'s",a=d;let h=r[u+2];h&&we(t,h.value)!==h.value?(s(we(t,h.value),h),u+=2):u+=1;continue}let p=e?.possessive,m=r[u+2];if(p?.markerPosition==="between"&&p.marker&&l.kind==="selector"&&d?.value===p.marker&&m!==void 0&&vr(m,t)){s(`${l.value}'s`,l),s(we(t,m.value),m),u+=2;continue}if(d?.value.toLowerCase()==="of"&&we(t,l.value)!==l.value&&vr(l,t)){s(we(t,l.value),l);continue}if(c!==void 0&&d){let h=e?.possessive?.connectors,y=!!h?.length&&h.some(g=>{let C=g.toLowerCase();return C===d.value.toLowerCase()||C===(d.normalized??"").toLowerCase()}),k=y?u+2:u+1,b=r[k];if(b&&vr(b,t)){s(Ct(c),l),s(we(t,b.value),b),u=k;continue}if(y&&b&&/^\.[a-zA-Z_]\w*$/.test(b.value)&&d.position?.end!==void 0&&b.position?.start!==void 0&&d.position.end===b.position.start){s(Ct(c),l),s(we(t,b.value.slice(1)),b),u=k;continue}if(!y&&/^\.[a-zA-Z_]\w*$/.test(d.value)&&l.position?.end!==void 0&&d.position?.start!==void 0&&l.position.end===d.position.start&&!rp(e,l)){s(Ct(c),l),s(we(t,d.value.slice(1)),d),u+=1;continue}}let f=r[u+2],v=za(r,u,e,t);if(v!==void 0){for(let h=u;h<v;h+=2)s(we(t,r[h].value),r[h]),s("of",r[h+1]);s(r[v].value,r[v]),u=v;continue}if(l.kind==="selector"&&d&&f&&Ye(e,d)&&vr(f,t)&&we(t,f.value)!==f.value){s(we(t,f.value),f),s("of",d),s(l.value,l),u+=2;continue}let E=Rr(r,u,e);if(E){for(let h of E.parts)s(h.text,h.token);u+=E.consumed-1;continue}s(wr(t,l,r[u-1],d,o,r[u+2]),l);}return i.trim()}function gp(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 ba(r){return !!r&&Ge.has(r.value)}var kp=class{constructor(r,e,t,n,i){this.patternToken=e,this.afterLiteral=t,this.nextPatternToken=n,this.wouldMatch=i;let a=r.position();this.token=r.tokens[a],this.prev=r.tokens[a-1],this.next=r.tokens[a+1],this.place=ze(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 gp(this.next)}};function wp(r){let e=r.token.value.toLowerCase();if(e!=="a"&&e!=="an")return false;let t=r.next;return t!==void 0&&(ut.has(t.value)||r.nextIsMarker)}function ln(r){return r.kind==="keyword"&&Cr.has((r.normalized??r.value).toLowerCase())}function zp(r,e){let t=r.token;if(t.kind!=="keyword")return false;let n=(t.normalized??t.value).toLowerCase();return n==="then"?true:(n==="end"&&r.next?.kind!=="selector"||lt(t.value,e))&&!We(r.place,e)}function bp(r,e){return Nr(r.token,e)&&We(r.place,e)}function Ca(r){return r.afterLiteral&&(r.clauseEndsAfter||r.nextIsMarker)}function Cp(r,e){let t=r.patternToken.role;return t!=="quantity"&&!(t==="event"&&e==="repeat")?false:ln(r.token)&&!Ca(r)&&!r.nextIsMarker}function Ap(r){let e=r.patternToken;return !e.optional||e.role==="event"||e.role==="action"||e.valueShape==="keyword"||!ln(r.token)?false:(r.lastSlot||r.tokenIsMarker)&&!Ca(r)}function xp(r,e,t,n){let i=r.type==="group"&&r.optional?r.tokens.every(o=>o.type==="role")?r.tokens[0]:void 0:r;if(!i||i.type!=="role"||!i.optional||i.role==="event"||i.role==="action"||i.valueShape==="keyword"||!e||e.kind!=="keyword"||t===void 0)return false;let a=n(t,e);return ln(e)?!a:a}function Dp(r){return Cr.has((r.normalized??r.value).toLowerCase())}function Sp(r,e){return r?.kind==="particle"&&!!e&&["selector","literal","identifier"].includes(e.kind)&&!ba(e)}function Bp(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 Tp(r,e){let t=r.patternToken;if(t.role==="event"||t.role==="action"||t.valueShape==="keyword")return false;let n=t.expectedTypes;if(n?.length&&!n.some(a=>a==="expression"||a==="reference"))return false;let i=Ar(r.token);return i==="structure"?true:i==="event"?!e?.roles.some(a=>a.role==="event")&&e?.action!=="wait"&&t.role!=="condition":i!=="verb"||(r.token.normalized??r.token.value).toLowerCase()==="empty"?false:!e?.hasBody&&!e?.roles.some(a=>a.role==="event")}function Fp(r){let e=(r.normalized||r.value).toLowerCase();if(e==="empty")return Yi("null");if(e==="a"||e==="an")return {type:"expression",raw:r.value}}function Pp(r,e,t){return r.kind==="particle"&&(e||ba(t))}function Aa(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 ei=new Set(["is","am","are","be","was","were","not","no"]),Op=new Set(["\u0647\u0648","\u0E40\u0E1B\u0E47\u0E19","\u0939\u0948","\u0928\u0939\u0940\u0902","mana"]),xa=new Set(["empty","null","undefined"]);function Rp(r,e,t,n){let i=(r.normalized??r.value).toLowerCase(),a=r.value.toLowerCase(),o=(e.normalized??e.value).toLowerCase();return (ei.has(i)||ei.has(rr(n,a))||Op.has(a)&&xa.has(o))&&!t}var Lp=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"]),Np=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"]),ri=/\s+as\s+([A-Za-z]\w*)!?\s*$/;function Da(r){let e=r;for(let i=ri.exec(e);i;i=ri.exec(e)){if(!Lr(i[1]??""))return false;e=e.slice(0,i.index);}let t=e.replace(/"[^"]*"|'[^']*'/g,"");if(/["']/.test(t.replace(/'s\b/g,""))||/[^\x00-\x7F]/.test(t))return false;let n=sn(e);return !n.success||n.consumed===void 0||n.consumed!==sa(e).length-1?false:_p(n.node).every(Lr)}function _p(r){let e=[],t=n=>{if(Array.isArray(n)){n.forEach(t);return}if(!n||typeof n!="object")return;let i=n;i.type==="asExpression"&&e.push(String(i.targetType?.name??"")),Object.values(n).forEach(t);};return t(r),e}function Fr(r,e){return r?.position?.end!==void 0&&e?.position?.start!==void 0&&r.position.end===e.position.start}var Mp=new Set(["is","not","really","am","or"]);function Sa(r,e,t){let n=i=>{let a=r[i];return a?wr(t,a,r[i-1],r[i+1],void 0).toLowerCase():""};return n(e)==="to"&&n(e-1)==="equal"&&Mp.has(n(e-2))}function Ip(r){return r.value==="a"}var $p=new Set(["event","window","document"]);function jp(r,e,t){let n=r[e],i=r[e-1];return !n||!i||!Ye(t,i)?false:$p.has((n.normalized??n.value).toLowerCase())}function Wp(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"||lt(r.value,e.profile?.code??""))return true}return e.owes(r)}function ti(r,e,t){let n=t.profile?.code??"en";if(wa(n,r,e)||Aa(r,e)||Sa(r,e,n)||Ip(r[e]))return false;let i=r[e];return Wp(i,t)||t.commandMarkers.has(i.value.toLowerCase())}function Vp(r,e,t){let n=r[e],i=r[e-1],a=t.profile?.code??"en";if(n.kind==="literal"||n.value==="'"&&r[e+1]?.value==="s"||n.value==="s"&&i?.value==="'")return true;if(n.kind==="selector"){if(!n.value.startsWith(".")||!i||Fr(i,n)||Ge.has(i.value)||/^[([,]$/.test(i.value)||Ye(t.profile,i))return true;let s=wr(a,i,r[e-2],n,void 0).toLowerCase();return Np.has(s)}if(Ge.has(n.value)||/^[()[\],.!<>=+\-*/%]+$/.test(n.value)||Ye(t.profile,n)||ga(a,n,i,r[e+1])||wa(a,r,e)||Aa(r,e)||jp(r,e,t.profile)||Sa(r,e,a))return true;let o=wr(a,n,i,r[e+1],void 0).toLowerCase();return o==="as"&&t.hasResponseType?false:Lp.has(o)?true:n.kind==="identifier"&&/^(?:[\p{L}_$][\p{L}\p{M}\p{N}_$]*('s)?|\([\p{L}_$][\p{L}\p{M}\p{N}_$]*\))$/u.test(n.value)}function qp(r,e,t){if(!r[e]||ti(r,e,t))return [];let n=e;for(;n<r.length&&!ti(r,n,t)&&Vp(r,n,t);)n++;let i=[];for(let a=n;a>e;a--)i.push(a);return i}function Kp(r,e,t){let n=[],i=e;for(;;){let a=r[i];if(!a)break;if(a.value==="'"&&r[i+1]?.value==="s"&&r[i+2])i+=3;else if(/.'s$/.test(r[i-1]?.value??""))i+=1;else if(Ye(t,a)&&r[i+1])i+=2;else break;n.push(i);}return n.reverse()}function Hp(r,e,t,n){for(let i of t){let a=Le(r.slice(e,i),n);if(Da(a))return {end:i,raw:a}}}var Ba=96,Up=/^[A-Za-z_][\w-]*$/,Gp=/^[A-Za-z_][\w-]*:[^\s'"`/:][^\s]*$/;function Ta(r,e){let t=r.peek(e);return !!t&&t.kind==="identifier"&&Gp.test(t.value)}function Fa(r,e){let t=r.peek(e);if(!t||t.kind!=="identifier"&&t.kind!=="keyword"||!Up.test(t.value))return false;let n=r.peek(e+1),i=r.peek(e+2);return !!n&&n.value===":"&&!!i}function ni(r,e=0){return Ta(r,e)||Fa(r,e)}function Yp(r){let e=r.peek();if(!e||e.value!=="{"&&e.value!=="(")return null;let t="",n=-1,i=0,a=0;for(;!r.isAtEnd()&&a++<Ba;){let o=r.advance();if(!o)break;if(n>=0&&o.position.start>n&&(t+=" ".repeat(o.position.start-n)),t+=o.value,n=o.position.end,o.value==="{"||o.value==="(")i++;else if((o.value==="}"||o.value===")")&&(i--,i===0))return t}return null}function ii(r){let e=r.peek();return e?e.value==="{"||e.value==="("?Yp(r):e.value===","||e.value===":"?null:(r.advance(),e.value):null}function Pr(r,e){let t=r.mark(),n=[];if(e!==void 0){let a=r.peek();if(!a||a.value!==":"||!r.peek(1))return null;r.advance();let o=ii(r);if(o===null)return r.reset(t),null;n.push(`${e}:${o}`);}else if(!ni(r))return null;let i=0;for(;i++<Ba;){let a=r.peek();if(!a)break;if(a.value===","){if(n.length===0||!ni(r,1))break;r.advance();continue}if(Ta(r,0)){n.push(r.advance().value);continue}if(!Fa(r,0))break;let o=r.advance().value;r.advance();let s=ii(r);if(s===null)return r.reset(t),null;n.push(`${o}:${s}`);}return n.length===0?(r.reset(t),null):`{${n.join(", ")}}`}function Qr(r){switch(r.kind){case "selector":return _e(r.value);case "literal":return Zp(r.value);case "keyword":{let t=Fp(r);if(t)return t;let n=(r.normalized||r.value).toLowerCase();return Ne(n)?Be(n):Yi(n)??Q(r.normalized||r.value)}case "identifier":if(r.value.startsWith("@"))return _e(r.value);if(r.value.startsWith(":")||r.value.startsWith("$"))return Be(r.value);let e=r.value.toLowerCase();return Ne(e)?Be(e):{type:"expression",raw:r.value};case "url":{let t=Q(r.value,"string");return r.value.includes("${")?{...t,interpolates:true}:t}default:return null}}function Zp(r){if(r.startsWith('"')||r.startsWith("'")||r.startsWith("`")||r.startsWith("\u300C")){let n=r.slice(1,-1);return Q(n,"string")}if(r==="true")return Q(true,"boolean");if(r==="false")return Q(false,"boolean");let e=r.match(/^(\d+(?:\.\d+)?)(ms|s|m|h)?$/);if(e){let n=parseFloat(e[1]);return e[2]?Q(r,"duration"):Q(n,"number")}let t=parseFloat(r);return isNaN(t)?Q(r,"string"):Q(t,"number")}var Yr=.8,Xp=.6,Jp=.15,Qp=.5,ai=.15,oi=.1,si=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"]),e0={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"]},r0=class{calculate(r){return this.calculateWithBreakdown(r).final}calculateWithBreakdown(r){let e=this.scoreRoleCoverage(r),t=this.scoreStemPenalty(r),n=this.scoreLanguageBoost(r),i=this.scoreLanguageAdjustment(r),a=e;return a=Math.max(Qp,a+t),a=Math.min(1,a+n),a=Math.max(0,Math.min(1,a+i)),{roleCoverage:e,stemPenalty:t,languageBoost:n,languageAdjustment:i,final:a}}scoreRoleCoverage(r){let{pattern:e,captured:t}=r,n=0,i=0,a=l=>e.extraction?.[l]?.default!==void 0,o=e.command==="on"?e.extraction?.action?.value:void 0,s=fe[o??e.command]?.roles,u=l=>s?.find(c=>c.role===l)?.valueShape!==void 0;for(let l of e.template.tokens)if(l.type==="role")t.has(l.role)?(i+=1,n+=1):u(l.role)||(i+=1);else if(l.type==="group")for(let c of l.tokens)c.type==="role"&&(t.has(c.role)?(i+=Yr,n+=Yr):u(c.role)||(i+=Yr,a(c.role)&&(n+=Yr*Xp)));return i>0?n/i:1}scoreStemPenalty(r){let{stemMatchCount:e,totalKeywordMatches:t}=r;return e<=0||t<=0?0:-(e/t)*Jp}scoreLanguageBoost(r){let{pattern:e}=r;if(e.language!=="ar")return 0;let t=e.template.tokens[0];return !t||t.type!=="literal"?0:si.has(t.value)||t.alternatives?.some(n=>si.has(n))?ai:0}scoreLanguageAdjustment(r){let{pattern:e,captured:t}=r;if(e.language!=="ar")return 0;let n=0;for(let[i,a]of t.entries()){let o=e0[i];if(!o||o.length===0)continue;let s="metadata"in a?a.metadata:void 0;s&&typeof s.prepositionValue=="string"&&(o.includes(s.prepositionValue)?n+=.1:n-=.1);}return Math.max(-oi,Math.min(oi,n))}},t0=new r0,n0=new Set(Object.values(fe).filter(r=>r.bareKeyword===true).map(r=>r.action));function i0(r){return r.startsWith("*")||r.startsWith("@")}var se=class j{constructor(e){this.patternRest=[],this.slotAfterLiteral=false,this.wouldMatch=(t,n)=>this.patternTokenWouldMatch(t,n),this.matchCache=new Map,this.roleStarts=new Map,this.stemMatchCount=0,this.totalKeywordMatches=0,this.confidenceModel=e??t0;}matchPattern(e,t){let n=e.mark(),i=new Map;if(this.currentProfile=F(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,i))return e.reset(n),null;let o=this.confidenceModel.calculate({pattern:t,captured:i,stemMatchCount:this.stemMatchCount,totalKeywordMatches:this.totalKeywordMatches});return this.applyExtractionRules(t,i),{pattern:t,captured:i,consumedTokens:e.position()-n.position,confidence:o,roleStarts:this.roleStarts,...this.eventSource?{eventSource:this.eventSource}:{}}}matchBest(e,t){this.matchCache.clear();let n=[],i=e.position();for(let o of t){let s=e.mark(),u=`${i}:${o.id}`,l;this.matchCache.has(u)?l=this.matchCache.get(u):(l=this.matchPattern(e,o),this.matchCache.set(u,l)),l&&n.push(l),e.reset(s);}if(n.length===0)return null;n.sort((o,s)=>{let u=s.pattern.priority-o.pattern.priority;return u!==0?u:s.confidence-o.confidence});let a=n[0];return this.matchPattern(e,a.pattern),a}matchTokenSequence(e,t,n,i){let a=t[0],o=a?.type==="literal"&&(a.value==="and"||a.value==="then"||a.alternatives?.includes("and")||a.alternatives?.includes("then"));if(this.currentProfile?.code==="ar"&&!o)for(;e.peek()?.kind==="conjunction";)e.advance();let s=0;for(let u=0;u<t.length;u++){let l=t[u];if(s>0&&l.type==="literal"&&this.tryConsumeEventSourceClause(e,n,l),xp(l,e.peek(),t[u+1]??i,this.wouldMatch)){let p=e.mark(),m=new Map(n);if(this.matchTokenSequence(e,t.slice(u+1),m,i)&&this.atClauseEnd(e)){n.clear();for(let[f,v]of m)n.set(f,v);return true}e.reset(p);}let c=this.patternRest;this.patternRest=[...t.slice(u+1),...c],this.slotAfterLiteral=l.type==="role"&&t[u-1]?.type==="literal";let d=this.matchPatternToken(e,l,n,t[u+1]??i);if(this.patternRest=c,s=l.type==="role"&&l.role==="event"?2:Math.max(0,s-1),!d){if(this.isOptional(l))continue;return false}}return true}tryConsumeEventSourceClause(e,t,n){if(t.has("source")||this.eventSource)return;let i=e.peek(),a=e.peek(1);if(!i||!a||this.patternTokenWouldMatch(n,i))return;let o=this.currentProfile?.roleMarkers?.source,s=l=>{if(l.kind!=="particle"&&l.kind!=="keyword")return false;if((l.normalized??"").toLowerCase()==="source")return true;if(!o)return false;let c=l.value.toLowerCase();return o.primary?.toLowerCase()===c?true:!!o.alternatives?.some(d=>d.toLowerCase()===c)},u=o?.position;if(u!=="after"&&s(i)){let l=this.sourceNounValue(a);if(!l)return;e.advance(),e.advance(),this.eventSource=l;return}if(u==="after"&&s(a)){let l=this.sourceNounValue(i);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(Ne(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,n,i){switch(t.type){case "literal":return this.matchLiteralToken(e,t);case "role":{let a=e.position(),o=this.matchRoleToken(e,t,n,i);return o&&n.has(t.role)&&this.roleStarts.set(t.role,a),o}case "group":return this.matchGroupToken(e,t,n,i);default:return false}}matchLiteralToken(e,t){let n=e.peek();if(!n)return false;let i=this.getMatchType(n,t.value);if(i!=="none")return this.totalKeywordMatches++,i==="stem"&&this.stemMatchCount++,e.advance(),true;if(t.alternatives)for(let a of t.alternatives){let o=this.getMatchType(n,a);if(o!=="none")return this.totalKeywordMatches++,o==="stem"&&this.stemMatchCount++,e.advance(),true}for(let a of [t.value,...t.alternatives??[]])for(let o of ["-","_"])if(a.includes(o)&&this.tryMatchShatteredCompound(e,a,o))return this.totalKeywordMatches++,true;return false}tryFoldHyphenActionKeyword(e){let t=this.currentProfile;if(!t)return null;let n=e.mark(),i=[];for(;;){let o=e.peek();if(!o||o.kind!=="identifier"&&o.kind!=="keyword")break;i.push(o.value),e.advance();let s=e.peek();if(!s||s.value!=="-")break;e.advance(),i.push("-");}if(i.length<3||i[i.length-1]==="-")return e.reset(n),null;let a=i.join("").toLowerCase();for(let[o,s]of Object.entries(t.keywords))if(s.primary.toLowerCase()===a||s.alternatives?.some(u=>u.toLowerCase()===a))return Q(o);return e.reset(n),null}tryMatchShatteredCompound(e,t,n){let i=t.split(n);if(i.length<2||i.some(o=>o.length===0))return false;let a=e.mark();for(let o=0;o<i.length;o++){if(o>0){let u=e.peek();if(!u||u.value!==n)return e.reset(a),false;e.advance();}let s=e.peek();if(!s||s.kind!=="identifier"&&s.kind!=="keyword"&&s.kind!=="particle"||s.value.toLowerCase()!==i[o].toLowerCase())return e.reset(a),false;e.advance();}return true}matchRoleToken(e,t,n,i){let a=e.position(),o=e.mark(),s=n.get(t.role);return this.matchRoleTokenCore(e,t,n,i)?n.get(t.role)===s?(e.position()>a&&e.reset(o),true):(this.absorbTrailingConversion(e,t,n,i,a),this.absorbTrailingConditionOperand(e,t,n,i,a),this.absorbExpressionTail(e,t,n,i,a),this.stampCaptureSpan(e,t.role,n,a,s),true):false}absorbExpressionTail(e,t,n,i,a){if(t.role==="event"||t.role==="action"||this.isClassNameSlot(t)||!n.has(t.role)||e.position()<=a)return;let o=t.expectedTypes;if(o&&o.length>0&&!o.includes("expression"))return;let s=j.boundedByMarker(i)?qp(e.tokens,e.position(),this.extentContext()):Kp(e.tokens,e.position(),this.currentProfile),u=Hp(e.tokens,a,s,this.currentProfile);if(u){for(;e.position()<u.end;)e.advance();n.set(t.role,{type:"expression",raw:u.raw,value:u.raw});}}extentContext(){let e=this.restLiterals();return {profile:this.currentProfile,owes:t=>e.some(n=>this.patternTokenWouldMatch(n,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=n=>{for(let i of n)i.type==="literal"?e.push(i):i.type==="group"&&t(i.tokens);};return t(this.patternRest),e}currentSchema(){let e=this.currentRoleCommand;if(!(!e||!(e in fe)))return fe[e]}commandMarkers(){let e=this.currentSchema(),t=this.currentProfile,n=new Set;if(!e||!t)return n;for(let i of e.roles){let a=i.markerOverride?.[t.code];if(a){n.add(a.toLowerCase());continue}let o=t.roleMarkers[i.role];if(o){n.add(o.primary.toLowerCase());for(let s of o.alternatives??[])n.add(s.toLowerCase());}}return n.delete(""),n}stampCaptureSpan(e,t,n,i,a){let o=n.get(t);if(!o||o===a||o.position||e.position()<=i)return;let s=e.tokens[i],u=e.tokens[e.position()-1];!s||!u||n.set(t,Zi(o,{start:s.position.start,end:u.position.end}));}absorbTrailingConditionOperand(e,t,n,i,a){if(t.role!=="condition"||!n.has("condition")||e.position()<=a)return;let o=this.currentPatternCommand==="repeat";if(!o&&(i!==void 0||this.currentPatternCommand!=="on"))return;let s=j.CONDITION_OPERATOR_WORDS,u=p=>{let m=(p.normalized??"").toLowerCase(),f=p.value.toLowerCase();if(s.has(m)||s.has(f))return true;let v=j.LOOP_CONDITION_OPERATORS;return o&&(v.has(f)||v.has(m))},l=p=>!!p&&(p.kind==="selector"||p.kind==="identifier"||p.kind==="literal")&&!u(p)&&!Cr.has((p.normalized??p.value).toLowerCase())&&!this.patternTokenWouldMatch(i,p),c=false;for(;;){let p=e.peek();if(!p||!u(p)||this.patternTokenWouldMatch(i,p))break;e.advance(),c=true;let m=e.peek();if(l(m)){e.advance();for(let f=e.peek();!(!f||!/^\.[a-zA-Z_]\w*$/.test(f.value)||f.position.start!==m.position.end);f=e.peek())e.advance(),m=f;}if(!o)break}if(!c)return;let d=Le(e.tokens.slice(a,e.position()),this.currentProfile);n.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 i=this.conversionTypeLength(e,1);if(i===0)return 0;for(i+=1;;){if(e.peek(i)?.value!=="|")return i;let a=this.conversionTypeLength(e,i+1);if(a===0)return i;i+=1+a;}}conversionTypeLength(e,t){let n=e.peek(t)?.value.toLowerCase(),i=n==="a"||n==="an"?t+1:t,a=e.peek(i);if(!a)return 0;let o=e.peek(i+1),s=e.peek(i+2);return o?.value===":"&&s&&Fr(a,o)&&Fr(o,s)&&Lr(`${a.value}:${s.value}`)?i-t+3:Lr(a.value)?i-t+1:0}absorbTrailingConversion(e,t,n,i,a){if(t.role==="event"||t.role==="action"||!n.has(t.role)||e.position()<=a)return;let o=this.conversionRunLength(e);if(o===0||this.patternTokenWouldMatch(i,e.peek()))return;for(let u=0;u<o;u++)e.advance();let s=Le(e.tokens.slice(a,e.position()),this.currentProfile);n.set(t.role,{type:"expression",raw:s,value:s});}matchRoleTokenCore(e,t,n,i){this.skipNoiseWords(e,t,i);let a=e.peek();if(!a)return t.optional||false;let o=this.slotAt(e,t,i);if(t.role==="action"&&this.currentProfile&&e.peek(1)?.value==="-"){let g=this.tryFoldHyphenActionKeyword(e);if(g)return n.set(t.role,g),true}if(t.role==="event"&&this.currentPatternCommand==="on"){if(!j.tokenLooksLikeEvent(a))return t.optional||false;let g=(a.normalized??a.value).toLowerCase();if(j.POSITIONAL_OR_SCOPE_KEYWORDS.has(g)||j.VISIBILITY_STRATEGIES.has(g)||this.currentProfile&&(Oe(this.currentProfile,a.value)??Oe(this.currentProfile,g))!==void 0||a.value.includes("?."))return t.optional||false}if(t.role==="event"){let g=(a.normalized??a.value).toLowerCase();if(j.STRUCTURAL_NEVER_EVENT.has(g))return t.optional||false}if(zp(o,this.currentProfile?.code??"")||Cp(o,this.currentPatternCommand))return t.optional||false;if(t.role==="duration"){let g=(a.normalized??a.value).toLowerCase();if(j.POSITIONAL_OR_SCOPE_KEYWORDS.has(g))return t.optional||false}if(Ap(o))return true;if(this.roleAcceptsPropertyPath(t)){let g=this.tryMatchPositionalPossessiveExpression(e,i);if(g)return n.set(t.role,g),true}let s=this.tryMatchPositionalExpression(e,i);if(s)return t.expectedTypes&&t.expectedTypes.length>0&&!Gr(s.type,t.expectedTypes)?t.optional||false:(n.set(t.role,s),true);let u=this.tryMatchCaretScopeExpression(e);if(u)return t.expectedTypes&&t.expectedTypes.length>0&&!Gr(u.type,t.expectedTypes)?t.optional||false:(n.set(t.role,u),true);let l=this.tryMatchParenReceiverCall(e);if(l)return t.expectedTypes&&t.expectedTypes.length>0&&!t.expectedTypes.includes("expression")?t.optional||false:(n.set(t.role,l),true);if(t.role!=="event"&&(!t.expectedTypes||t.expectedTypes.includes("expression"))){let g=this.tryMatchBeepPrefixExpression(e);if(g)return n.set(t.role,g),true;let C=this.tryMatchHyphenatedWord(e);if(C)return n.set(t.role,C),true;let w=this.isWrittenTarget(t)?null:this.tryMatchOperatorRunExpression(e);if(w)return n.set(t.role,w),true}if(this.currentPatternCommand==="pick"&&t.role==="patient"&&(!t.expectedTypes||t.expectedTypes.includes("expression"))){let g=this.tryMatchPickRangeExpression(e);if(g)return n.set(t.role,g),true}if(this.roleAcceptsPropertyPath(t)){let g=this.tryMatchOfPossessiveExpression(e,i);if(g)return n.set(t.role,g),true;let C=this.tryMatchPostNominalPossessiveExpression(e);if(C)return n.set(t.role,C),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:(n.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:(n.set(t.role,d),true);let m=t.role==="event"&&this.currentPatternCommand==="on"||j.DECLARATION_COMMANDS.has(this.currentPatternCommand??"")||this.isWrittenTarget(t)?null:this.tryMatchBareCallExpression(e);if(m)return t.expectedTypes&&t.expectedTypes.length>0&&!t.expectedTypes.includes(m.type)&&!t.expectedTypes.includes("expression")?t.optional||false:(n.set(t.role,m),true);let f=this.tryMatchPossessiveSelectorExpression(e);if(f)return t.expectedTypes&&t.expectedTypes.length>0&&!Gr(f.type,t.expectedTypes)?t.optional||false:(n.set(t.role,f),true);let v=t.role!=="condition",E=this.tryMatchPropertyAccessExpression(e,v);if(E)return t.expectedTypes&&t.expectedTypes.length>0&&!t.expectedTypes.includes(E.type)&&!t.expectedTypes.includes("expression")?t.optional||false:(n.set(t.role,E),true);let h=this.tryMatchSelectorPropertyExpression(e);if(h)return t.expectedTypes&&t.expectedTypes.length>0&&!Gr(h.type,t.expectedTypes)?t.optional||false:(n.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 n.set(t.role,g),true}if(a.kind==="identifier"&&a.value==="{"){let g=t.expectedTypes,w=g?.length===1&&g[0]==="expression"||this.isObjectValueSlot(t)?this.tryMatchBraceRunExpression(e):!g?.length||g.includes("literal")?this.tryMatchBraceRunLiteral(e):null;if(w)return n.set(t.role,w),true}if(t.role==="style"&&t.expectedTypes?.length===1&&t.expectedTypes[0]==="expression"){let g=Pr(e);if(g)return n.set(t.role,{type:"expression",raw:g}),true}if(Bp(o)||Tp(o,this.currentSchema())||bp(o,this.currentProfile?.code??""))return n.set(t.role,{type:"expression",raw:a.value}),e.advance(),true;let y=this.tokenToSemanticValue(a);if(!y)return t.optional||false;if(t.expectedTypes&&t.expectedTypes.length>0&&!t.expectedTypes.includes(y.type)){let g=y.type==="selector"&&String(y.value).startsWith("@"),C=t.expectedTypes.some(w=>w==="expression"||w==="reference");if(!(g&&C))return t.optional||false}t.valueShape==="keyword"&&y.type==="expression"?n.set(t.role,Q(String(y.raw??""))):n.set(t.role,y),e.advance();let k=this.isClassNameSlot(t);if(y.type==="selector"&&(y.value.startsWith("<")||y.value.startsWith(".")&&!k)&&t.role!=="event"){let g=fa(e.tokens,e.position(),this.currentProfile,C=>C===void 0?false:this.patternTokenWouldMatch(i,C));if(g){let[C,w]=g.scope.parts,D=g.scope.kind==="reference"?Be(C.text):g.scope.kind==="closest"?{type:"expression",raw:`closest ${w.text}`}:this.tokenToSemanticValue(C.token);for(let x=0;x<1+g.scope.consumed;x++)e.advance();n.set(t.role,{...y,scope:D});}}if(t.role==="event"){let g=e.peek();g&&g.kind==="selector"&&g.value.startsWith("[")&&g.position.start===a.position.end&&"value"in y&&(n.set(t.role,Q(`${String(y.value)}${g.value}`)),e.advance());let C=e.peek();if(C&&(C.kind==="particle"||C.kind==="keyword")&&(C.normalized??"").toLowerCase()==="source"&&!this.patternTokenWouldMatch(i,C)){let w=e.peek(1),D=w?this.sourceNounValue(w):void 0;D&&!this.eventSource&&(e.advance(),e.advance(),this.eventSource=D);}}return true}atClauseEnd(e){let t=e.peek();if(!t||t.kind==="conjunction")return true;if(t.kind!=="keyword")return false;let n=(t.normalized??t.value).toLowerCase();return n==="then"||n==="end"?true:lt(t.value,this.currentProfile?.code??"")}patternTokenWouldMatch(e,t){return e?e.type==="literal"?this.getMatchType(t,e.value)!=="none"?true:!!e.alternatives?.some(n=>this.getMatchType(t,n)!=="none"):e.type==="group"?this.patternTokenWouldMatch(e.tokens?.[0],t):false:false}tryMatchPositionalExpression(e,t){let n=Rr(e.tokens,e.position(),this.currentProfile,i=>i===void 0?false:this.patternTokenWouldMatch(t,i));if(!n)return null;for(let i=0;i<n.consumed;i++)e.advance();return {type:"expression",raw:n.parts.map(i=>i.text).join(" ")}}tryMatchCaretScopeExpression(e){let t=e.peek();if(!t||t.kind!=="identifier"||!t.value.startsWith("^"))return null;let n=e.peek(1),i=e.peek(2),a=(n?.normalized??"").toLowerCase(),o=!!n&&(n.value.toLowerCase()==="on"||a==="destination"||a==="on");return !n||!i||i.kind!=="selector"||!o?null:(e.advance(),e.advance(),e.advance(),{type:"expression",raw:`${t.value} on ${i.value}`})}isOfPossessiveMarker(e){return Ye(this.currentProfile,e)}logicalConnectiveOf(e){let t=e.peek();if(!t)return;let n=this.currentProfile?.code??"en",i=u=>u==="and"||u==="or"||u==="not",a=rr(n,t.value).toLowerCase();if(i(a))return a;if(this.commandMarkers().has(t.value.toLowerCase()))return;let o=e.position(),s=up(n,t,e.tokens[o-1],e.tokens[o+1]);return s&&i(s)?s:void 0}tryConsumeRunPhrase(e){let t=this.currentProfile?.code??"en",n=e.tokens,i=e.position(),a=[],o;for(let s=0;s<6&&i+s<n.length;s++){let u=n[i+s],l=wr(t,u,n[i+s-1],n[i+s+1],o).toLowerCase();a.push(l),o=l;}for(let[s,u]of j.RUN_PHRASES)if(s.every((l,c)=>a[c]===l)){for(let l=0;l<s.length;l++)e.advance();return u}}slotAt(e,t,n){return new kp(e,t,this.slotAfterLiteral,n,this.wouldMatch)}static isBareWordToken(e){return !!e&&/^[A-Za-z_][A-Za-z0-9_]*$/.test(e.value)}tryMatchBeepPrefixExpression(e){let t=e.peek(),n=e.peek(1);if(!t||!n||n.value!=="!"||(t.normalized??t.value).toLowerCase()!=="beep"||!(t.position?.end!==void 0&&n.position?.start!==void 0&&t.position.end===n.position.start))return null;let a=e.mark(),o=e.position();if(e.advance(),e.advance(),!this.tryConsumeRunOperand(e))return e.reset(a),null;for(;;){let u=e.peek();if(!u||!Ge.has(u.value))break;let l=e.mark();if(e.advance(),!this.tryConsumeRunOperand(e,true)){e.reset(l);break}}let s=Le(e.tokens.slice(o,e.position()),this.currentProfile);return {type:"expression",raw:s,value:s}}tryMatchHyphenatedWord(e){let t=e.peek();if(!j.isBareWordToken(t))return null;let n=1,i=[t.value];for(;;){let a=e.peek(n),o=e.peek(n+1);if(!a||a.value!=="-"||!j.isBareWordToken(o)||!Fr(e.peek(n-1),a)||!Fr(a,o))break;i.push(o.value),n+=2;}if(i.length<2)return null;for(let a=0;a<n;a++)e.advance();return Q(i.join("-"),"string")}tryMatchOperatorRunExpression(e){let t=e.mark(),n=e.position(),i=e.peek(),a=!!i&&(this.logicalConnectiveOf(e)==="not"||i.value==="-");if(!this.tryConsumeRunOperand(e))return e.reset(t),null;let o=1;for(;;){let u=e.peek();if(!u)break;let l=this.logicalConnectiveOf(e),c=(l==="and"||l==="or")&&this.currentRoleCommand!=="wait",d=e.mark();if(c||Ge.has(u.value))e.advance();else {let p=this.tryConsumeRunPhrase(e);if(p===void 0)break;if(p==="none"){o++;continue}}if(!this.tryConsumeRunOperand(e,true,c)){e.reset(d);break}o++;}if(o<2&&!a)return e.reset(t),null;let s=Le(e.tokens.slice(n,e.position()),this.currentProfile);return {type:"expression",raw:s,value:s}}static rangeSeparatorFor(e){let[t]=j.PICK_RANGE_SEPARATORS_BY_LANG[e]??[];return t}isPickRangeSeparator(e){let t=(e.normalized??e.value).toLowerCase();if(j.PICK_RANGE_SEPARATORS.has(t))return true;let n=this.currentProfile?.code;return n?j.PICK_RANGE_SEPARATORS_BY_LANG[n]?.has(e.value.toLowerCase())??false:false}tryMatchPickRangeExpression(e){let t=e.mark(),n=e.position();if(!this.tryConsumePickRangeOperand(e))return e.reset(t),null;let i=e.peek();if(!i||!this.isPickRangeSeparator(i)||(e.advance(),!this.tryConsumePickRangeOperand(e)))return e.reset(t),null;let a=e.peek();a&&j.PICK_RANGE_MODES.has((a.normalized??a.value).toLowerCase())&&e.advance();let o=e.tokens.slice(n,e.position()),[s,,u,l]=o,c=p=>p.kind==="keyword"?p.normalized??p.value:p.value,d=`${c(s)} to ${c(u)}`;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 n=(t.normalized??t.value).toLowerCase();if(this.isPickRangeSeparator(t))return false;let i=n==="start"||n==="end";return t.kind==="literal"||t.kind==="identifier"||t.kind==="keyword"&&i?(e.advance(),true):false}tryConsumeRunOperand(e,t=false,n=false){let i=e.peek();if(!i)return false;if(this.logicalConnectiveOf(e)==="not"){let o=e.mark();return e.advance(),Sp(e.peek()??void 0,e.peek(1)??void 0)?(e.reset(o),false):this.tryConsumeRunOperand(e,true,n)?true:(e.reset(o),false)}if(i.value==="-"){let o=e.mark();return e.advance(),this.tryConsumeRunOperand(e,true,n)?true:(e.reset(o),false)}if(n&&Dp(i))return false;if(Pp(i,t,e.peek(1)??void 0))return e.advance(),true;if(i.value==="("){let o=e.mark(),s=0;for(;!e.isAtEnd();){let u=e.advance();if(u.value==="(")s++;else if(u.value===")"&&(s--,s===0))return true}return e.reset(o),false}if(this.tryMatchPossessiveExpression(e))return true;if(i.value.toLowerCase()==="the"){let o=e.mark();if(e.advance(),this.tryConsumeRunOperand(e,t,n))return true;e.reset(o);}if(this.tryMatchOfPossessiveExpression(e)||this.tryMatchPossessiveSelectorExpression(e)||this.tryMatchPropertyAccessExpression(e,true)||this.tryMatchSelectorPropertyExpression(e))return true;let a=(i.normalized??"").toLowerCase();return (i.kind==="literal"||i.kind==="identifier"||i.kind==="selector"||i.kind==="keyword")&&!Ge.has(i.value)&&!["then","else"].includes(a)&&(a!=="end"||this.endWordIsValueAt(e))&&i.value!==")"?(e.advance(),true):false}endWordIsValueAt(e){return We(ze(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(Oe(this.currentProfile,t)??Oe(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?we(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?fe[t]?.roles.find(a=>a.role===e.role)?.expectedTypes?.includes("property-path")??false:false}tryMatchOfPossessiveExpression(e,t){let n=e.peek();if(!n||!(n.kind==="selector"?/^[*@]/.test(n.value):this.isBareWordPropertyHead(n)))return null;let a=e.position(),o=e.mark();e.advance();let s=e.peek();if(!s||!this.isOfPossessiveMarker(s))return e.reset(o),null;if(this.currentRoleCommand==="swap"&&this.patternTokenWouldMatch(t,s)){let c=e.tokens[e.position()+2];if(!c||!this.patternTokenWouldMatch(t,c))return e.reset(o),null}e.advance(),e.peek()?.value.toLowerCase()==="the"&&e.advance();let u=Rr(e.tokens,e.position(),this.currentProfile,c=>c===void 0?false:this.patternTokenWouldMatch(t,c));if(u){for(let c=0;c<u.consumed;c++)e.advance();return $e({type:"expression",raw:u.parts.map(c=>c.text).join(" ")},this.toEnglishProperty(n.value),"possessive")}let l=e.peek();if(!l||l.kind!=="selector"||i0(l.value)){if(e.reset(o),this.patternTokenWouldMatch(t,s))return null;let c=this.currentProfile?.code??"en",d=za(e.tokens,a,this.currentProfile,c);if(d===void 0)return null;for(;e.position()<=d;)e.advance();let p=Le(e.tokens.slice(a,d+1),this.currentProfile);return {type:"expression",raw:p,value:p}}return e.advance(),$e(_e(l.value),this.toEnglishProperty(n.value),"possessive")}tryMatchPositionalPossessiveExpression(e,t){let n=this.currentProfile,i=n?.possessive?.marker;if(!n||!i||n.possessive?.markerPosition!=="between"||n.code==="th")return null;let a=Rr(e.tokens,e.position(),n,l=>l===void 0?false:this.patternTokenWouldMatch(t,l));if(!a)return null;let o=e.peek(a.consumed),s=e.peek(a.consumed+1);if(!o||o.value!==i)return null;let u=!!s&&(this.isBareWordPropertyHead(s)||s.kind==="selector"&&s.value.startsWith("*")||s.kind==="keyword"&&Un(n.code,s.value));if(!s||!u)return null;for(let l=0;l<a.consumed+2;l++)e.advance();return $e({type:"expression",raw:a.parts.map(l=>l.text).join(" ")},this.toEnglishProperty(s.value),"possessive")}tryMatchPossessiveExpression(e){let t=e.peek();if(!t||!this.currentProfile)return null;let n=[t.value,t.normalized].filter(Boolean),i;for(let u of n)if(i=Oe(this.currentProfile,u)??Oe(this.currentProfile,u.toLowerCase()),i)break;if(!i)return null;let a=e.mark();e.advance();let o=this.currentProfile.possessive?.connectors;if(o&&o.length>0){let u=e.peek();if(u){let l=u.value.toLowerCase(),c=(u.normalized??"").toLowerCase();o.some(d=>d.toLowerCase()===l||d.toLowerCase()===c)&&e.advance();}}let s=e.peek();if(!s||Os(this.currentProfile.code,s.value))return e.reset(a),null;if(s.kind==="identifier"||s.kind==="keyword"&&!this.isStructuralKeyword(s.value)&&!(s.normalized&&this.isStructuralKeyword(s.normalized))&&!(s.normalized&&this.isRoleMarkerConcept(s.normalized))&&!(s.normalized&&j.COMMAND_ACTION_KEYWORDS.has(s.normalized.toLowerCase()))||s.kind==="selector"&&s.value.startsWith("*")||s.kind==="selector"&&s.value.startsWith("@")||s.kind==="selector"&&s.value.startsWith(".")&&/^\.[a-zA-Z_]\w*/.test(s.value)){e.advance();let u=s.value;s.kind==="selector"&&u.startsWith(".")&&/^\.[a-zA-Z_]\w*/.test(u)&&(u=u.substring(1)),u=this.toEnglishProperty(u);let l=u;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 p=e.peek(1);if(p?.kind==="selector"&&p.value.startsWith(".")&&/^\.[a-zA-Z_]\w*/.test(p.value)){l+=`?${p.value}`,e.advance(),e.advance();continue}}break}let c=e.peek();if(c&&c.value.startsWith("(")){let d="",p=0,m=0;for(;!e.isAtEnd()&&m++<j.MAX_METHOD_ARGS+2;){let f=e.peek();if(!f)break;d+=f.value,e.advance();for(let v of f.value)v==="("?p++:v===")"&&p--;if(p<=0)break}l+=d;}return $e(Be(i),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 n=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("@"))||n)||this.isPossessorToken(t))return null;let a=e.mark(),o=t.value;n&&(o=o.substring(1)),e.advance(),o=this.toEnglishProperty(o);let s=o;for(;e.peek()?.kind==="selector"&&e.peek().value.startsWith(".")&&/^\.[a-zA-Z_]\w*/.test(e.peek().value);)s+=e.peek().value,e.advance();let u=e.peek();if(!u)return e.reset(a),null;let l;for(let d of [u.value,u.normalized].filter(Boolean))if(l=Oe(this.currentProfile,d)??Oe(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(),$e(Be(l),s,"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 _r.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 n=e.normalized?.toLowerCase();return !(n&&n0.has(n)||n==="me"||n==="it"||n==="you")}tryMatchBraceRunLiteral(e){let t=e.peek();if(!t||t.kind!=="identifier"||t.value!=="{")return null;let n=e.mark();e.advance();let i=["{"],a=1,o=0;for(;!e.isAtEnd()&&o++<j.MAX_BRACE_RUN_TOKENS;){let s=e.advance();if(!s)break;if(s.value==="{")a++;else if(s.value==="}"&&(a--,a===0))return i.push("}"),Q(i.join(" "));i.push(s.value);}return e.reset(n),null}tryMatchBraceRunExpression(e){let t=e.peek();if(!t||t.kind!=="identifier"||t.value!=="{")return null;let n=e.mark(),i="",a=-1,o=0,s=0;for(;!e.isAtEnd()&&s++<j.MAX_BRACE_RUN_TOKENS;){let u=e.advance();if(!u)break;if(a>=0&&u.position.start>a&&(i+=" ".repeat(u.position.start-a)),i+=u.value,a=u.position.end,u.value==="{")o++;else if(u.value==="}"&&(o--,o===0))return {type:"expression",raw:i}}return e.reset(n),null}tryMatchBareCallExpression(e){let t=e.peek();if(!t||t.kind!=="identifier"||!/^[A-Za-z_][\w$]*$/.test(t.value))return null;let n=e.peek(1);if(!n||n.value!=="(")return null;let i=e.mark();e.advance();let a=e.advance(),o="",s=a.position?.end,u=false,l=0;for(;!e.isAtEnd()&&l++<j.MAX_METHOD_ARGS+2;){let c=e.peek();if(!c)break;if(c.value===")"){e.advance(),u=true;break}let d=s!==void 0&&c.position?.start===s;o+=(o===""||d?"":" ")+c.value,s=c.position?.end,e.advance();}return u?{type:"expression",raw:`${t.value}(${o})`}:(e.reset(i),null)}tryMatchMethodCallExpression(e){let t=e.peek();if(!t||t.kind!=="selector")return null;let n=e.mark();e.advance();let i=e.peek();if(!i||i.kind!=="operator"||i.value!==".")return e.reset(n),null;e.advance();let a=e.peek();if(!a||a.kind!=="identifier")return e.reset(n),null;e.advance();let o=e.peek();if(!o||o.kind!=="punctuation"||o.value!=="(")return e.reset(n),null;e.advance();let s=[];for(;!e.isAtEnd()&&s.length<j.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}s.push(l.value),e.advance();}return {type:"expression",raw:`${t.value}.${a.value}(${s.join(", ")})`}}tryMatchParenReceiverCall(e){if(e.peek()?.value!=="(")return null;let t=e.mark(),n=[];e.advance();let i=1;for(;!e.isAtEnd()&&n.length<=j.MAX_METHOD_ARGS*4;){let c=e.peek();if(e.advance(),c.value==="(")i++;else if(c.value===")"&&--i===0)break;n.push(c);}let a=e.tokens[e.position()-1],o=e.peek();if(i!==0||n.length===0||!o||o.kind!=="selector"||!/^\.[A-Za-z_$][\w$]*$/.test(o.value)||!j.abuts(a,o))return e.reset(t),null;e.advance();let s=e.peek();if(s?.value!=="("||!j.abuts(o,s))return e.reset(t),null;let u=this.consumeCallParens(e);return u===null?(e.reset(t),null):{type:"expression",raw:`(${Le(n,this.currentProfile)})${o.value}${u}`}}tryMatchParenGroupExpression(e){if(e.peek()?.value!=="(")return null;let t=e.mark();e.advance();let n=[],i=1;for(;!e.isAtEnd();){let l=e.peek();if(e.advance(),l.value==="(")i++;else if(l.value===")"&&--i===0)break;n.push(l);}let a=e.tokens[e.position()-1],o=e.peek(),s=!!o&&(o.value==="'"||Ge.has(o.value)||j.abuts(a,o)&&(o.value.startsWith(".")||o.value==="("));if(i!==0||n.length===0||s)return e.reset(t),null;let u=`(${Le(n,this.currentProfile)})`;return {type:"expression",raw:u,value:u}}static abuts(e,t){return !!e&&!!t&&e.position.end===t.position.start}consumeCallParens(e){let t=e.mark(),n=[],i=0;for(;!e.isAtEnd();){let a=e.peek();if(!a)break;if(n.push(a.value),e.advance(),a.value==="(")i++;else if(a.value===")"&&--i===0)return n.join("")}return e.reset(t),null}tryMatchPropertyAccessExpression(e,t=true){let n=e.peek();if(!n||n.kind!=="identifier"&&n.kind!=="keyword")return null;let i=e.mark();e.advance();let a=n.value.toLowerCase(),o=e.peek();if((n.kind==="identifier"||j.PROPERTY_ACCESS_BASES.has(a))&&o&&o.kind==="selector"&&/^\.[a-zA-Z_]/.test(o.value)&&o.position.start===n.position.end){let m=n.value,f=[],v=0;for(;v<j.MAX_PROPERTY_DEPTH;){let y=e.peek();if(y&&y.kind==="selector"&&/^\.[a-zA-Z_]/.test(y.value))m+=`.${y.value.slice(1)}`,f.push(y.value.slice(1)),e.advance(),v++;else break}let E=e.peek(),h=!!E&&E.value.startsWith("(");return t&&!h&&f.length>0&&Ne(a)?$e(Be(a),f.join("."),"dot"):(h&&(m+=this.consumeCallParens(e)??""),{type:"expression",raw:m})}let s=e.peek();if(!s||s.kind!=="operator"||s.value!==".")return e.reset(i),null;e.advance();let u=e.peek();if(!u||u.kind!=="identifier")return e.reset(i),null;e.advance();let l=`${n.value}.${u.value}`,c=1;for(;!e.isAtEnd()&&c<j.MAX_PROPERTY_DEPTH;){let m=e.peek();if(!m||m.kind!=="operator"||m.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 m=[],f=0;for(;!e.isAtEnd()&&m.length<j.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}m.push(E.value),e.advance();}return {type:"expression",raw:`${l}(${m.join(", ")})`}}let p=n.value.toLowerCase();if(t&&Ne(p)){let m=l.split(".").slice(1).join(".");return $e(Be(p),m,"dot")}return {type:"expression",raw:l}}tryMatchPossessiveSelectorExpression(e){let t=e.peek();if(!t||t.kind!=="selector")return null;let n=e.mark();e.advance();let i=e.peek(),a=this.currentProfile?.possessive?.marker?.replace(/^-/,""),o=!!i&&i.kind==="punctuation"&&i.value==="'s",s=!!i&&i.value==="'"&&(e.peek(1)?.value??"").toLowerCase()==="s",u=(()=>{if(!this.currentPatternCommand||(i?.normalized??"").toLowerCase()!=="source")return false;let f=fe[this.currentPatternCommand];return !!f&&f.roles.some(v=>v.role==="source")})(),l=!!i&&!!a&&a!=="'s"&&i.value===a&&(i.kind==="particle"||i.kind==="punctuation"||i.kind==="identifier")&&!u;if(!o&&!l&&!s)return e.reset(n),null;e.advance(),s&&e.advance();let c=e.peek();if(!c)return e.reset(n),null;let d=c.kind==="selector"&&c.value.startsWith("*"),p=c.kind==="keyword"&&!!this.currentProfile&&Un(this.currentProfile.code,c.value);return c.kind==="identifier"||d||p||(o||s)&&(c.kind==="selector"||c.kind==="keyword")?(e.advance(),$e(_e(t.value),this.toEnglishProperty(c.value),"possessive")):(e.reset(n),null)}tryMatchSelectorPropertyExpression(e){let t=e.peek();if(!t||t.kind!=="selector"||!t.value.startsWith("#"))return null;let n=e.mark();e.advance();let i=e.peek();if(!i||i.kind!=="selector"||!i.value.startsWith("."))return e.reset(n),null;e.advance();let a=[i.value.slice(1)],o=i;for(let u=e.peek();u&&u.kind==="selector"&&/^\.[a-zA-Z_]/.test(u.value)&&a.length<j.MAX_PROPERTY_DEPTH;u=e.peek())a.push(u.value.slice(1)),o=u,e.advance();let s=e.peek();if(s?.value==="("&&j.abuts(o,s)){let u=this.consumeCallParens(e);if(u!==null)return {type:"expression",raw:`${t.value}.${a.join(".")}${u}`}}return $e(_e(t.value),a.join("."),"dot")}matchGroupToken(e,t,n,i){let a=e.mark(),o=new Map(n),s=this.matchTokenSequence(e,t.tokens,n,i);if(s){let u=[];for(let l of t.tokens)if(l.type==="group"&&l.renderRequired)for(let c of l.tokens)c.type==="literal"&&u.push(c.value,...c.alternatives??[]);u.length>0&&[...n.keys()].some(c=>!o.has(c))&&(e.tokens.slice(a.position,e.position()).some(p=>u.some(m=>this.getMatchType(p,m)!=="none"))||(s=false));}if(!s){e.reset(a);for(let u of n.keys())o.has(u)||n.delete(u);for(let[u,l]of o)n.get(u)!==l&&n.set(u,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 n=Hr(e.value).toLowerCase();if(n&&n===Hr(t).toLowerCase())return "case-insensitive"}return "none"}isWrittenTarget(e){return j.WRITTEN_ROLE[this.currentRoleCommand??""]===e.role}tokenToSemanticValue(e){return Qr(e)}applyExtractionRules(e,t){for(let[n,i]of Object.entries(e.extraction)){let a=t.get(n);if(a){if(i.transform){let o=a.type==="literal"?String(a.value):String(a.raw??"");t.set(n,i.transform(o));}}else i.value!==void 0?t.set(n,{type:"literal",value:i.value}):i.default&&t.set(n,{...i.default,implicit:true});}}isOptional(e){return e.type!=="literal"&&e.optional===true}skipNoiseWords(e,t,n){let i=e.peek();if(!i)return;let a=i.value.toLowerCase();if(j.ENGLISH_NOISE_WORDS.has(a)){if(wp(this.slotAt(e,t,n)))return;let o=e.mark();e.advance();let s=e.peek();if(s&&(s.kind==="selector"||s.kind==="identifier"))return;let u=e.peek(1);if(s&&s.kind==="keyword"&&u&&u.kind==="selector"&&/^\.[a-zA-Z_]/.test(u.value))return;let l=s?(s.normalized??s.value).toLowerCase():"";if(s&&j.POSITIONAL_OR_SCOPE_KEYWORDS.has(l))return;let c=e.peek(1),d=c?(c.normalized??c.value).toLowerCase():"",p=this.currentProfile?.wordOrder!=="SOV"&&j.COMMAND_ACTION_KEYWORDS.has(d),m=!c||c.kind==="particle"||j.CLAUSE_BOUNDARY_KEYWORDS.has(d)||p;if(s&&s.kind==="keyword"&&this.currentProfile?.code!=="en"&&Ne(l)&&m||s&&s.kind==="keyword"&&this.currentProfile?.code==="en"&&Ne(l))return;e.reset(o);}a==="class"&&e.advance();}extractEventModifiers(e){let t={},n=false;for(;!e.isAtEnd();){let i=e.peek();if(!i||i.kind!=="event-modifier")break;let a=i.metadata;if(!a)break;switch(n=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 n?t:void 0}};se.CONDITION_OPERATOR_WORDS=new Set(["matches","match","contains","exists","has","have","equals","includes"]);se.LOOP_CONDITION_OPERATORS=new Set([...la,"and","or"]);se.POSITIONAL_OR_SCOPE_KEYWORDS=new Set(["first","last","next","previous","random","closest","parent"]);se.STRUCTURAL_NEVER_EVENT=new Set(["if","unless","else","end","then","while"]);se.PROPERTY_ACCESS_BASES=new Set(["it","me","you","my","its","your","event","result","target","detail","body","window","document","self","this"]);se.COMMAND_ACTION_KEYWORDS=Cr;se.CLAUSE_BOUNDARY_KEYWORDS=new Set(["then","and","or","end","else"]);se.RUN_PHRASES=[...an.map(r=>[r.split(" "),"none"]),...on.map(r=>[r.split(" "),"type"]),...nn.filter(r=>!/^(in|am|has|have)$|^am /.test(r)).map(r=>[r.split(" "),"operand"]),[["exists"],"none"]];se.PICK_RANGE_SEPARATORS=new Set(["to"]);se.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"])};se.PICK_RANGE_MODES=new Set(["inclusive","exclusive"]);se.VISIBILITY_STRATEGIES=new Set(["display","visibility","opacity","twdisplay","twvisibility","twopacity"]);se.MAX_BRACE_RUN_TOKENS=64;se.MAX_PROPERTY_DEPTH=10;se.MAX_METHOD_ARGS=20;se.DECLARATION_COMMANDS=new Set(["behavior","def","install"]);se.WRITTEN_ROLE={increment:"patient",decrement:"patient",set:"destination"};se.ENGLISH_NOISE_WORDS=new Set(["the","a","an"]);var Pa=se,Se=new Pa;function Y(r,e){return xs(r,e)}function Oa(){return As()}var et={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"])},a0=new Set(Object.values(et).flatMap(r=>[...r]));function Or(r,e){let t=(r.normalized??r.value).toLowerCase();if(t==="or")return true;let n=e===void 0?a0:et[e];return n?n.has(r.value)||n.has(t):false}var Ra=["if","unless","repeat","for","while"],ct=/^[A-Z][A-Za-z0-9_]*$/;function Z(r,e){let t=new Set([e]),i=F(r)?.keywords?.[e];if(i){i.primary&&t.add(i.primary.toLowerCase());for(let a of i.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 o0=new Set(Ra);function Ir(r){return {byAction:Ra.map(e=>[e,Z(r,e)]),elseForms:Z(r,"else"),inForms:Z(r,"in"),tellForms:Z(r,"tell"),endForms:Z(r,"end"),onForms:Z(r,"on"),featureForms:new Set(["def","init","behavior"].flatMap(e=>[...Z(r,e)])),onLeads:F(r)?.wordOrder!=="SOV"}}function ui(r,e){if(!r)return;let t=r.normalized?.toLowerCase();return t?o0.has(t)?t:void 0:e.byAction.find(([,n])=>W(r,n))?.[0]}function s0(r,e){let t=i=>r[i]?.value.toLowerCase();if(t(e)!=="start")return false;let n=t(e+1)==="a"?e+2:e+1;return t(n)==="view"&&t(n+1)==="transition"}function u0(r,e){if(!r)return false;let t=r.normalized?.toLowerCase();return t?t==="tell":W(r,e.tellForms)}function l0(r,e,t){let n=0;for(let i=e+1;i<r.length;i++){let a=r[i];if(W(a,t.endForms)){if(n===0)return true;n--;continue}if(n===0&&(W(a,t.featureForms)||t.onLeads&&W(a,t.onForms)&&Qe(r[i+1])))return false;xr(r,i,t)&&n++;}return false}function xr(r,e,t){if(s0(r,e))return true;if(u0(r[e],t))return l0(r,e,t);let n=r[e],i=ui(n,t);if(!i||i==="while")return false;let a=r[e-1];if(i==="for"){if(ui(a,t)==="repeat")return false;if(n.value.toLowerCase()==="for"){let o=r[e+2];return !!o&&(W(o,t.inForms)||o.normalized==="in")}}return !(i==="if"&&a&&W(a,t.elseForms))}var li=new Set(["me","it","you","the","body","window","document","its","event","result","target","self","this","them","parent","next","previous","closest","first","last"]),c0=new Set(["destination","source","style","patient","on","from","to"]);function Qe(r){if(!r||r.kind==="selector")return false;let e=(r.normalized??r.value).toLowerCase(),t=r.value.toLowerCase();return !(li.has(e)||li.has(t)||c0.has(e))}var La=r=>Object.prototype.hasOwnProperty.call(fe,r),d0=new Set(["toggle","trigger"]);function $t(r){return r.flatMap((e,t)=>{if(e.type==="group")return $t(e.tokens);if(e.type!=="literal")return [];let n=r[t+1];return [{words:[e.value,...e.alternatives??[]].map(i=>i.toLowerCase()),role:n?.type==="role"?n.role:void 0}]})}function p0(r,e,t,n){return r.some((i,a)=>{if(!i.words.includes(e)||!i.role||!n.has(i.role))return false;let o=0;for(let s of t){let u=r.findIndex((l,c)=>c>=o&&c<a&&l.words.includes(s));if(u<0)return false;o=u+1;}return true})}function m0(r,e,t,n,i){let a=r[t].value.toLowerCase();for(let o=t-1;o>e;o--){let s=r[o];if(i(s)||s.value.toLowerCase()===a)return false;let u=(s.normalized??s.value).toLowerCase();if(!La(u)||u==="on")continue;let l=Ee(n).filter(d=>d.command===u);if(d0.has(u)){let d=r.slice(o+1,t).map(p=>p.value.toLowerCase());return l.some(p=>$t(p.template.tokens).some(m=>m.words.includes(a)&&!d.some(f=>m.words.includes(f))))}let c=new Set((fe[u]?.roles??[]).filter(d=>d.required).map(d=>d.role));return l.some(d=>{let p=$t(d.template.tokens),m=new Set(p.flatMap(v=>v.words)),f=r.slice(o+1,t).map(v=>v.value.toLowerCase()).filter(v=>m.has(v));return p0(p,a,f,c)})}return false}function Ve(r){let e=new Set;r?.primary&&e.add(r.primary.toLowerCase());for(let t of r?.alternatives??[])e.add(t.toLowerCase());return e}var ci=new Map;function rt(r){return r.type!=="literal"?[]:[r.value,...r.alternatives??[]].map(e=>e.toLowerCase().split(/\s+/))}function f0(r,e){let t=[[]];for(let n=e+1;n<r.length;n++){let i=r[n];if(i.type==="literal"){if(r[n+1]?.type==="role")break;t=t.flatMap(a=>rt(i).map(o=>[...a,...o]));}else if(i.type==="group"&&i.optional&&i.tokens.every(a=>a.type==="literal")){let a=i.tokens.reduce((o,s)=>o.flatMap(u=>rt(s).map(l=>[...u,...l])),[[]]);t=t.flatMap(o=>[o,...a.map(s=>[...o,...s])]);}else break}return t.filter(n=>n.length>0)}function Na(r){let e=ci.get(r);if(e)return e;let t=F(r),n=t?.wordOrder==="SOV",i=[],a=new Map,o=new Set;for(let p of Ee(r)){if(p.command!=="on"||/-event-/i.test(p.id))continue;let m=p.template.tokens,f=m.findIndex(E=>E.type==="role"&&E.role==="event");if(f<0)continue;let v=m[f+1];if(f===1&&v?.type==="literal"&&m[f+2]?.type!=="role"&&i.push([new Set(rt(m[0]).flat()),new Set(rt(v).flat())]),!(!n||f>0))for(let E of f0(m,f))E.length>1?a.set(E.join(" "),E):o.add(E[0]);}let s=new Set([...o,...[...a.values()].flat()]),u=Ve(t?.keywords?.when),l=n?new Set([...u].filter(p=>!s.has(p))):new Set([...Z(r,"on"),...u]),c=n?new Set([...Ve(t?.keywords?.on)].filter(p=>o.has(p))):new Set,d={sov:n,leading:l,circumfix:i,trailing:[...a.values()],afterClause:c,patient:Ve(t?.roleMarkers?.patient),source:Ve(t?.roleMarkers?.source),anchors:[...l,...i.flatMap(([p])=>[...p]),...[...a.values()].map(p=>p[p.length-1]),...c].filter(p=>p.length>0)};return ci.set(r,d),d}function y0(r,e,t){return t.every((n,i)=>r[e+i]?.value.toLowerCase()===n)}function _a(r,e,t,n,i,a,o){let s=r[e],u=s.value.toLowerCase();if(e>t&&Qe(r[e+1])&&(W(s,i.leading)&&!(r[e+2]&&W(r[e+2],a))&&!m0(r,t,e,n,o)||i.circumfix.some(([p,m])=>p.has(u)&&v0(r,e,m,i))))return Dt(r,e,t,i,true);let c=e-1,d=r[c];return c<=t||!Qe(d)?null:i.trailing.some(p=>y0(r,e,p))?Dt(r,c,t,i,true):i.afterClause.has(u)&&(d.kind==="keyword"||d.kind==="identifier")&&h0(r,c,i)?Dt(r,c,t,i,false):null}function v0(r,e,t,n){let i=o=>r[o]?.value.toLowerCase(),a=o=>t.has(i(o)??"");return a(e+2)||r[e+2]!==void 0&&W(r[e+2],n.source)&&a(e+4)}function Dt(r,e,t,n,i){return n.sov&&e-2>=t&&W(r[e-1],n.source)?e-2===t?null:{at:e-2,certain:i}:{at:e,certain:i}}var Ma=.4;function h0(r,e,t){let n=a=>{if(!a||a.kind!=="keyword")return false;let o=(a.normalized??a.value).toLowerCase();return o==="end"||La(o)},i=r[e-1];return n(i)?true:i!==void 0&&i.kind==="particle"&&!W(i,t.patient)&&n(r[e-3])}function Ia(r,e){let t=[],n=e.position.end,i=r.slice(e.position.end).match(/^\s*\(([^)]*)\)/);if(i){n=e.position.end+i[0].length;for(let a of i[1].split(/[,\u060c\u3001]/)){let o=a.trim();o&&t.push(o);}}return {parameters:t,headerEnd:n}}function $r(r,e,t){let n=e+1;if(n>=r.length)return -1;let i=Ve(F(t)?.roleMarkers?.patient);return i.size>0&&W(r[n],i)&&n++,n<r.length?n:-1}var $a=/^[a-zA-Z_$][\w$]*(?:\.[a-zA-Z_$][\w$]*)*$/;function E0(r){let e=1;if(r[1]?.value==="("){let t=0,n=1;for(;n<r.length;n++)if(r[n].value==="(")t++;else if(r[n].value===")"&&--t===0)break;if(n>=r.length)return -1;e=n+1;}return e+1}function g0(r,e,t){let n=F(t);if(n?.wordOrder!=="SOV"||!$a.test(r[0].value)||e!==E0(r))return false;let i=Ve(n.roleMarkers?.patient);return i.size===0?false:W(r[e-1],i)}function k0(r,e,t){if(!F(e))return null;let n=Z(e,"behavior"),i=Z(e,"def"),a=r.toLowerCase(),o=[...n].some(d=>a.includes(d)),s=/\bdef\b/.test(a)||[...i].some(d=>d!=="def"&&a.includes(d));if(!o&&!s)return null;let u=Y(r,e).tokens;if(u.length<2)return null;if(W(u[0],n))return di(r,e,u,t,0);let l=u.findIndex((d,p)=>p>0&&W(d,n));if(l>0&&ct.test(u[0].value))return di(r,e,u,t,l);if(W(u[0],i))return pi(r,e,u,t,0);let c=u.findIndex((d,p)=>p>0&&W(d,i));return c>0&&g0(u,c,e)?pi(r,e,u,t,c):null}function w0(r,e,t){return ja(r,e,t)?.node??null}function ja(r,e,t){if(!F(e))return null;let i=Na(e),a=Z(e,"end"),o=Z(e,"then"),s=r.toLowerCase(),u=[...a].some(w=>s.includes(w)),l=(()=>{let w=0;for(let D of i.anchors)for(let x=s.indexOf(D);x>=0;x=s.indexOf(D,x+D.length))if(++w>=2)return true;return false})();if(!u&&!l)return null;let c=Y(r,e).tokens;if(c.length<2)return null;let d=Ir(e),p=w=>xr(c,w,d),m=w=>W(w,a),f=w=>m(w)||W(w,o),v=[],E=false,h=0,y=0;for(let w=0;w<c.length;w++){let D=c[w];if(m(D)){if(h>0){h--;continue}if(c[w+1]&&W(c[w+1],o))continue;let x=r.slice(c[y].position.start,D.position.start).trim();x&&v.push(x),y=w+1;}else if(p(w))h++;else if(h===0){let x=_a(c,w,y,e,i,o,f);if(!x)continue;x.certain||(E=true);let z=r.slice(c[y].position.start,c[x.at].position.start).trim();z&&v.push(z),y=x.at;}}if(y<c.length){let w=r.slice(c[y].position.start).trim();w&&v.push(w);}if(v.length<2)return null;let k=[],b=[];for(let w of v){let D;try{D=t.statement(w,e);}catch{return null}if(!D||D.kind!=="event-handler")return null;let x=D;if(k.push(x),!x.body||x.body.length===0)return null;b.push(x.metadata?.confidence??.75);}let g=zr(b);return {node:pr(k,"then",{sourceLanguage:e,confidence:E?Math.min(g,Ma):g,sourceText:r}),unsure:E}}function zr(r){return r.length>0?r.reduce((e,t)=>e+t,0)/r.length:0}function dt(r){let e=[];for(let t of r){let n=t.statements;t.kind==="compound"&&Array.isArray(n)?e.push(...n):e.push(t);}return e}function di(r,e,t,n,i){let a=i>0,o=a?0:$r(t,i,e);if(o<0)return null;let s=t[o],u=s.value;if(!ct.test(u))return null;let{parameters:l,headerEnd:c}=Ia(r,s),d=a?i+1:t.findIndex(P=>P.position.start>=c);d<=o&&(d=o+1);let p=Z(e,"init"),m=Z(e,"end"),f=Ir(e),v=P=>xr(t,P,f),E=P=>W(P,m),h=Na(e),y=Z(e,"then"),k=P=>E(P)||W(P,y),b=P=>{let $=r.slice(t[A].position.end,t[P].position.start).trim();if($)try{let O=dt(n.body($,e));C.push(...O),w.push(zr(O.map(_=>_.metadata?.confidence??.75)));}catch{w.push(0);}},g=[],C=[],w=[],D=false,x=false,z=0,A=d;for(let P=d;P<t.length;P++){let $=t[P];if(E($)){if(z>0){z--;continue}if(P===A){D=true;break}if(W(t[A],p)){b(P),A=P+1;continue}let O=r.slice(t[A].position.start,$.position.start).trim(),_=ja(O,e,n);if(_){_.unsure&&(x=true);for(let V of _.node.statements)g.push(V),w.push(V.metadata?.confidence??.75);}else try{let V=n.statement(O,e);if(V&&V.kind==="event-handler"){let T=V;g.push(T);let M=!T.body||T.body.length===0;w.push(M?.2:T.metadata?.confidence??.75);}else w.push(0);}catch{w.push(0);}A=P+1;}else if(v(P))z++;else if(z===0&&W(t[A],p)){let O=_a(t,P,A,e,h,y,k);if(!O)continue;O.certain||(x=true),b(O.at),A=O.at;}}if(g.length===0&&C.length===0)return null;let S=(D?1:.8)*zr(w),L=x?Math.min(S,Ma):S;return Du(u,l,g,C.length>0?C:void 0,{sourceLanguage:e,confidence:L,sourceText:r})}function pi(r,e,t,n,i){let a=i>0,o=a?0:$r(t,i,e);if(o<0)return null;let s=t[o],u=s.value;if(!$a.test(u))return null;let{parameters:l,headerEnd:c}=Ia(r,s),d=a?i+1:t.findIndex(w=>w.position.start>=c);d<=o&&(d=o+1);let p=Z(e,"end"),m=Ir(e),f=w=>xr(t,w,m),v=w=>W(w,p),E=0,h=-1;for(let w=d;w<t.length;w++)if(v(t[w])){if(E===0){h=w;break}E--;}else f(w)&&E++;let y=t[d]?.position.start??c,k=h>=0?t[h].position.start:r.length,b=r.slice(y,k).trim();if(!b)return null;let g;try{g=dt(n.body(b,e));}catch{return null}if(g.length===0)return null;let C=zr(g.map(w=>w.metadata?.confidence??.75));return h<0&&(C*=.8),Su(u,l,g,{sourceLanguage:e,confidence:C,sourceText:r})}var jt=["live","eventsource","socket","worker","intercept"],z0=new Set(["intercept"]),cn=new Set(["eventsource","socket","worker"]),b0=new Set(["eventsource","socket"]),C0=new Set(["worker"]),A0=6,x0=2;function D0(r,e){for(let n of jt)if(W(r[0],Z(e,n)))return {action:n,keywordIdx:0};if(F(e)?.wordOrder!=="SOV")return null;let t=Math.min(r.length,A0);for(let n=1;n<t;n++)for(let i of jt)if(i!=="live"&&W(r[n],Z(e,i))&&!(cn.has(i)&&!ct.test(r[0].value))&&!(i==="intercept"&&n>x0))return {action:i,keywordIdx:n};return null}function S0(r,e,t){let n=Ve(F(t)?.roleMarkers?.source);return n.size===0||e+1>=r.length?0:W(r[e],n)||W(r[e+1],n)?2:0}function Wa(r){let e=Z(r,"on");e.add("when");let t=F(r)?.eventHandler;if(t?.keyword){e.add(t.keyword.primary.toLowerCase());for(let n of t.keyword.alternatives??[])e.add(n.toLowerCase());}for(let n of t?.temporalMarkers??[])e.add(n.toLowerCase());return e}function B0(r,e,t){let n=F(t)?.eventHandler,i=[n?.eventMarker?.primary,...n?.eventMarker?.alternatives??[],...n?.temporalMarkers??[]].filter(o=>!!o&&/\s/.test(o)),a=1;for(let o of i){let s=o.toLowerCase().split(/\s+/),u=e-s.length+1;u<0||s.every((l,c)=>r[u+c]?.value.toLowerCase()===l)&&(a=Math.max(a,s.length));}return a}function T0(r,e,t,n,i){if(r==="live")return t+1;if(t>0){let l=t+1;return r==="eventsource"&&(l+=S0(e,l,n)),l}let a=$r(e,t,n);if(a<0)return -1;if(r==="worker")return a+1;let o=Wa(n),s=Ve(F(n)?.roleMarkers?.event),u=i>=0?i:e.length;for(let l=a+1;l<u;l++){if(!W(e[l],o))continue;if(Qe(e[l+1]))return l;if(l>a+2&&s.size>0&&W(e[l-1],s)&&Qe(e[l-2]))return l-2;let c=B0(e,l,n);if(c>1&&l-c>a&&Qe(e[l-c]))return l-c;if(l>a+1&&Qe(e[l-1]))return l-1}return u}function F0(r,e,t,n){if(!cn.has(r))return;let i=t>0?0:$r(e,t,n);if(!(i<0))return e[i].value}function P0(r,e,t){if(!F(e))return null;let n=r.toLowerCase(),i=false;for(let u of [...jt,"changes"]){for(let l of Z(e,u))if(l&&n.includes(l)){i=true;break}if(i)break}if(!i)return null;let a=Y(r,e).tokens;if(a.length<2)return null;let o=_0(a,e);if(o>=0)return I0(r,e,a,t,o);let s=D0(a,e);return s?O0(r,e,a,t,s.action,s.keywordIdx):null}function O0(r,e,t,n,i,a){let o=Z(e,"end"),s=Ir(e),u=g=>xr(t,g,s),l=g=>W(g,o),c=F0(i,t,a,e);if(cn.has(i)&&(!c||!ct.test(c)))return null;let d=g=>({sourceLanguage:e,confidence:g,sourceText:r}),p=Wt(t,a+1,l,u);if(z0.has(i))return p>=0&&p!==t.length-1?null:_t(i,[],c,d(p>=0?1:.8));let m=T0(i,t,a,e,p);if(m<0||m>t.length)return null;let f=[],v=[],E=false,h=C0.has(i);if(h||b0.has(i)){let g=h?"def":"event-handler",C=0,w=m;for(let D=m;D<t.length;D++){let x=t[D];if(l(x)){if(C>0){C--;continue}if(E=true,D===w)break;let z=h?x.position.end:x.position.start,A=r.slice(t[w].position.start,z).trim();try{let S=n.statement(A,e);if(S&&S.kind===g){let L=S;f.push(L);let P=!L.body||L.body.length===0;v.push(P?.2:L.metadata?.confidence??.75);}else v.push(0);}catch{v.push(0);}w=D+1;}else u(D)&&C++;}}else {let g=Wt(t,m,l,u);E=g>=0;let C=g>=0?t[g].position.start:r.length,w=r.slice(t[m].position.start,C).trim();if(!w)return null;try{f.push(...dt(n.body(w,e)));}catch{return null}if(f.length===0)return null;v.push(...f.map(D=>D.metadata?.confidence??.75));}if(f.length===0&&!E)return null;let y=E?1:.8,k=v.length>0?y*zr(v):y,b=R0(i,r,t,a,m,e);return _t(i,f,c,d(k),b?new Map([["source",b]]):void 0)}function R0(r,e,t,n,i,a){if(r!=="eventsource"&&r!=="socket"||n!==0)return;let o=$r(t,n,a);if(o<0)return;let s=o+1,u=Math.min(i,t.length)-1;if(r==="eventsource"){let c=Ve(F(a)?.roleMarkers?.source),d=p=>!!p&&(W(p,c)||(p.normalized??"").toLowerCase()==="source");d(t[s])?s++:d(t[u])&&u--;}if(s>u)return;let l=e.slice(t[s].position.start,t[u].position.end).trim();return l?{type:"expression",raw:l}:void 0}var L0=new Set([...Object.keys(fe),"then","else"]);function N0(r){let e=Z(r,"when");for(let t of Wa(r))e.add(t);return e}function _0(r,e){if(r.length<3||!W(r[0],N0(e)))return -1;let t=Z(e,"changes"),n=a=>t.has(a.value.toLowerCase())||a.normalized?.toLowerCase()==="changes",i=Z(e,"end");for(let a=2;a<r.length;a++){let o=r[a];if(o.kind==="literal")continue;if(n(o))return a;if(W(o,i))return -1;let s=(o.normalized??o.value).toLowerCase();if(o.kind==="keyword"&&L0.has(s))return -1}return -1}function M0(r,e,t){if(t==="en"){let i=e[0],a=e[e.length-1];return {type:"expression",raw:r.slice(i.position.start,a.position.end).trim()}}let n=e.map(i=>Or(i,t)?{...i,kind:"keyword",normalized:"or"}:i);return {type:"expression",raw:Le(n,F(t))}}function I0(r,e,t,n,i){let a=Z(e,"end"),o=Ir(e),s=y=>xr(t,y,o),u=y=>W(y,a),l=i+1;if(l>=t.length)return null;let c=Wt(t,l,u,s),d=c>=0;if(d&&c!==t.length-1)return null;let p=d?t[c].position.start:r.length,m=r.slice(t[l].position.start,p).trim();if(!m)return null;let f;try{f=dt(n.body(m,e));}catch{return null}if(f.length===0)return null;let v=M0(r,t.slice(1,i),e),h=(d?1:.8)*zr(f.map(y=>y.metadata?.confidence??.75));return _t("when",f,void 0,{sourceLanguage:e,confidence:h,sourceText:r},new Map([["condition",v]]))}function Wt(r,e,t,n){let i=0;for(let a=e;a<r.length;a++)if(t(r[a])){if(i===0)return a;i--;}else n(a)&&i++;return -1}var $0=new Set(["the","to","on","with","into","from","at"]),mi=/^[A-Za-z_$][\w$]*$/,j0=64;function fi(r){let e="";for(let t=0;t<r.length;t++){let n=r[t],i=r[t-1];i&&n.position.start>i.position.end&&(e+=" "),e+=n.value;}return e}function W0(r,e){let t=0;for(let n=e;n<r.length&&n-e<=j0;n++){let i=r[n].value;if(i==="(")t++;else if(i===")"&&(t--,t===0))return n+1}return -1}function yi(r,e){return e.position.start===r.position.end}function V0(r,e,t,n){let i=r[e];if(!i||i.kind!=="identifier"&&i.kind!=="keyword"||!mi.test(i.value)||n(i))return null;let a=e+1,o=i.value;for(;r[a]?.kind==="selector"&&/^\.[A-Za-z_$][\w$]*$/.test(r[a].value)&&yi(r[a-1],r[a]);)o+=r[a].value,a++;let s=a>e+1,u=r[a];if(!u||u.value!=="("||!yi(r[a-1],u))return null;let l=W0(r,a);if(l<0)return null;let c=o+fi(r.slice(a,l));if(s)return {text:`call ${c}`,consumed:l-e};let d=l,m=r[d]?.value.toLowerCase(),f=null;if(m==="me")f="me",d++;else if(m!==void 0&&$0.has(m)){d++,r[d]?.value.toLowerCase()==="the"&&d++;let v=r[d];if(!v)return null;let E=Rr(r,d,t);if(E)f=`(${fi(r.slice(d,d+E.consumed))})`,d+=E.consumed;else if(v.kind==="selector"&&v.value.startsWith("#")&&!/[.[:\s]/.test(v.value.slice(1)))f=v.value,d++;else if(v.kind==="selector"&&/^[.<]/.test(v.value))f=`(${v.value})`,d++;else if((v.kind==="keyword"||v.kind==="identifier")&&mi.test(v.value)&&(Ne(v.value.toLowerCase())||v.kind==="identifier"))f=v.value,d++;else return null}return {text:f?`call ${f}.${c}`:`call ${c}`,consumed:d-e}}var q0={debounced:"debounce",debounce:"debounce",throttled:"throttle",throttle:"throttle"},K0=[["\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"]],H0=/^(\d+)(ms|s|m)?$/,U0=new Set(["selector","literal","url","event-modifier"]);function G0(r){let e=r.match(H0);if(!e)return null;let t=parseInt(e[1],10),n=e[2]||"ms";return n==="s"?t*=1e3:n==="m"&&(t*=6e4),t}function Y0(r){for(let e=1;e<r.length;e++){let t=r[e];if(U0.has(t.kind))continue;let n=t.value.toLowerCase(),i=q0[n];if(i){let a=0;for(let o=e+1;o<r.length;o++){let s=r[o],u=G0(s.value);if(u!==null)return {modifiers:{[i]:u},start:t.position.start,end:s.position.end};if(s.kind==="selector"||s.kind==="literal"||s.kind==="url"||++a>2)break}continue}for(let a of K0){if(a[0]!==n||e+a.length>r.length)continue;let o=true;for(let s=1;s<a.length;s++)if(r[e+s].value.toLowerCase()!==a[s]){o=false;break}if(o)return {modifiers:{once:true},start:t.position.start,end:r[e+a.length-1].position.end}}}return null}function Z0(r,e){try{let t=Y(r,e),n=Ee(e);if(n.length===0)return {confidence:0,parseSuccess:!1,error:`No patterns available for language: ${e}`};let i=[...n].sort((l,c)=>c.priority-l.priority),a=i.filter(l=>l.command==="on"),o=Se.matchBest(t,a);if(o)return {confidence:o.confidence,parseSuccess:!0,patternId:o.pattern.id,action:o.pattern.command,tokensConsumed:o.consumedTokens};t.reset(t.mark());let s=i.filter(l=>l.command!=="on"),u=Se.matchBest(t,s);return u?{confidence:u.confidence,parseSuccess:!0,patternId:u.pattern.id,action:u.pattern.command,tokensConsumed:u.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 dn(r,e){try{let n=Za(r,e);if(n)return {node:n,confidence:n.metadata?.confidence??.8,error:void 0,tokensConsumed:Y(r,e).tokens.length}}catch{}let t=Z0(r,e);return t.parseSuccess?{node:null,confidence:t.confidence,error:void 0,tokensConsumed:t.tokensConsumed}:{node:null,confidence:0,error:t.error}}var X0=["values","expressions","logical","temporal","attributes"],J0=/"[^"]*"|'[^']*'|`[^`]*`/g,tt="\uE010",Vt="\uE011",Q0=/\uE010(\d+)\uE011/g,em=/(^|[^\w$.#@*:-])([A-Za-z][A-Za-z-]+)(?![\w$.:-])/g,rm=/(\bas\s+|\bis\s+(?:not\s+)?an?\s+)([A-Z][A-Za-z0-9_]*(?::[A-Za-z0-9_]+)?)\b/g,vi=new WeakMap;function tm(r,e){let t=vi.get(r);if(t)return t;let n=new Map,i=(o,s)=>{if(!s)return;let u=o.toLowerCase();!n.has(u)&&s!==o&&n.set(u,s);};for(let o of X0){let s=r[o];if(s)for(let[u,l]of Object.entries(s))i(u,l.primary);}for(let[o,s]of Object.entries(e?.references??{}))i(o,s);let a={words:n};return vi.set(r,a),a}function nm(r,e){let t="",n=0;for(;n<r.length;){let i=r.indexOf("{",n);if(i===-1){t+=r.slice(n);break}let a=0,o=-1;for(let s=i;s<r.length;s++)if(r[s]==="{")a++;else if(r[s]==="}"&&--a===0){o=s;break}if(o===-1){t+=r.slice(n);break}e.push(r.slice(i,o+1)),t+=r.slice(n,i)+`${tt}${e.length-1}${Vt}`,n=o+1;}return t}function im(r,e){let t=r;for(let n=0;n<8&&t.includes(tt);n++)t=t.replace(Q0,(i,a)=>e[Number(a)]??"");return t}function am(r,e,t,n){if(!r)return r;let i=Vd(e);if(!i)return r;let{words:a}=tm(i,t);if(a.size===0)return r;let o=[],s=r.replace(J0,c=>(o.push(c),`${tt}${o.length-1}${Vt}`)),l=nm(s,o).replace(rm,(c,d,p)=>(o.push(p),`${d}${tt}${o.length-1}${Vt}`)).replace(em,(c,d,p)=>{if(n?.has(p))return c;let m=a.get(p.toLowerCase());return m?`${d}${m}`:c});return im(l,o)}var hi=new Map;function Va(r){let e=hi.get(r);if(e===void 0){let t=Y(r,"en").tokens,n=t.length===1?t[0]:void 0;e=!!n&&(n.kind==="identifier"||!!Ar(n)),hi.set(r,e);}return e}function om(r){let e=new Set,t=sn(r);if(!t.success||!t.node)return e;let n=(i,a)=>{if(Array.isArray(i)){for(let s of i)n(s,a);return}if(!i||typeof i!="object")return;let o=i;o.type==="identifier"&&a!=="property"&&a!=="targetType"&&typeof o.name=="string"&&Va(o.name)&&e.add(o.name);for(let[s,u]of Object.entries(i))u&&typeof u=="object"&&n(u,s);};return n(t.node,void 0),e}var sm=new Set(["repeat","for","while","tell","viewTransition"]);function St(r){return r.kind==="command"&&sm.has(r.action)&&!at(r)}var um=new Set(["js"]),lm=5;function cm(r,e){for(let[t,n]of r.roles)if(t!==e&&!n.implicit)return true;return false}var dm=30;function Ei(r){if(r?.default?.type==="literal")return String(r.default.value).trim().toLowerCase();if(r?.value!==void 0)return String(r.value).trim().toLowerCase()}var pm=new Set(Object.values(un).flatMap(r=>Object.values(r))),mm=class{constructor(){this.spellVariables=false,this.localizedVariable=false;}renderNoting(r,e,t){return this.localizedVariable=false,{text:t?this.renderWith(r,e,t):this.render(r,e),localizedVariable:this.localizedVariable}}renderSpellingVariables(r,e,t){this.spellVariables=true;try{return t?this.renderWith(r,e,t):this.render(r,e)}finally{this.spellVariables=false;}}renderWith(r,e,t){let n=this.valueGuard;this.valueGuard=t;try{return this.render(r,e)}finally{this.valueGuard=n;}}render(r,e){if(r.kind==="compound")return this.renderCompound(r,e);if(r.kind==="behavior")return this.renderBehavior(r,e);if(r.kind==="def")return this.renderDef(r,e);if(r.kind==="feature")return this.renderFeature(r,e);if(r.kind==="conditional")return this.renderConditional(r,e);if(r.kind==="loop")return this.renderLoop(r,e);if(at(r))return this.renderBlockCommand(r,e);if(r.action==="js"&&F(e)?.wordOrder==="SOV"){let a=r.roles.get("patient"),o=a&&a.type==="expression"?a.raw:"",s=this.keyword(e,"js"),u=this.keyword(e,"end");return o?`${s} ${o} ${u}`:`${s} ${u}`}let t=Bs(e,r.action);if(t.length===0)return this.renderExplicit(r);let n=this.findBestPattern(r,t);if(!n)return this.renderExplicit(r);let i=this.renderWithPattern(r,n);return um.has(r.action)?`${i} ${this.keyword(e,"end")}`:i}renderCompound(r,e){if(r.statements.length>1&&r.statements.every(a=>a.kind==="event-handler")){let a=this.keyword(e,"end"),o=[];for(let s of r.statements)o.push(this.render(s,e),a);return o.join(`
6
+ `)}let t=r.statements.map(a=>this.render(a,e)),n=this.getChainWord(r.chainType,e),i=t[0]??"";for(let a=1;a<t.length;a++){let o=r.statements[a-1],s=r.statements[a],u=St(o),l=o.kind==="command"&&o.action==="bind"&&s.kind==="command"&&s.action==="bind",c=u||l?" ":` ${n} `;i+=c+t[a];}return this.closeBlockHeaders(i,r.statements,e)}renderConditional(r,e){let t=r.roles.get("condition"),n=t?this.valueToNaturalString(t,e):"",i=[`${this.keyword(e,"if")} ${n}`.trim()],a=this.joinStatements(r.thenBranch,e);return a&&i.push(a),r.elseBranch&&r.elseBranch.length>0&&i.push(this.keyword(e,"else"),this.joinStatements(r.elseBranch,e)),r.elseBranch?.length===1&&r.elseBranch[0].kind==="conditional"||i.push(this.keyword(e,"end")),i.join(" ")}renderLoop(r,e){let t=me(r.action,Object.fromEntries(r.roles),r.metadata),n=[this.render(t,e)];r.indexVariable&&n.push(`index ${r.indexVariable}`);let i=this.joinStatements(r.body,e);return i&&n.push(i),n.push(this.keyword(e,"end")),n.join(" ")}renderBlockCommand(r,e){let t=me(r.action,Object.fromEntries(r.roles),r.metadata),n=[this.render(t,e)],i=this.joinStatements(r.body,e);return i&&n.push(i),n.push(this.keyword(e,"end")),n.join(" ")}joinStatements(r,e){let t=r.map(a=>this.render(a,e)),n=this.keyword(e,"then"),i=t[0]??"";for(let a=1;a<t.length;a++){let o=r[a-1],s=St(o);i+=(s?" ":` ${n} `)+t[a];}return this.closeBlockHeaders(i,r,e)}closeBlockHeaders(r,e,t){let n=e.filter(St).length;if(n===0)return r;let i=this.keyword(t,"end");return `${r}${` ${i}`.repeat(n)}`}keyword(r,e){return F(r)?.keywords?.[e]?.primary??e}renderBlockHeader(r,e,t){return t.length>0?`${r} ${e}(${t.join(", ")})`:`${r} ${e}`}renderBehavior(r,e){let t=this.keyword(e,"end"),n=[this.renderBlockHeader(this.keyword(e,"behavior"),r.name,r.parameters)];if(r.initBlock&&r.initBlock.length>0){n.push(` ${this.keyword(e,"init")}`);for(let i of r.initBlock)n.push(` ${this.render(i,e)}`);n.push(` ${t}`);}for(let i of r.eventHandlers)n.push(` ${this.render(i,e)}`,` ${t}`);return n.push(t),n.join(`
7
+ `)}renderDef(r,e){let t=[this.renderBlockHeader(this.keyword(e,"def"),r.name,r.parameters)];for(let n of r.body)t.push(` ${this.render(n,e)}`);return t.push(this.keyword(e,"end")),t.join(`
8
+ `)}renderFeature(r,e){let t=this.keyword(e,"end"),n=[this.featureHeader(r,e)];for(let i of r.body)n.push(` ${this.render(i,e)}`),i.kind==="event-handler"&&n.push(` ${t}`);return n.push(t),n.join(`
9
+ `)}featureHeader(r,e){let t=this.keyword(e,r.action);if(r.action==="when"){let o=r.roles.get("condition"),s=o?this.valueToNaturalString(o,e):"";return [t,s,this.keyword(e,"changes")].filter(Boolean).join(" ")}let n=r.name?`${t} ${r.name}`:t,i=r.roles.get("source"),a=i?.type==="expression"?i.raw:void 0;if(a&&r.action==="socket")return `${n} ${a}`;if(a&&r.action==="eventsource"){let o=F(e)?.roleMarkers?.source,s=o?.primary??"from";return o?.position==="after"?`${n} ${a} ${s}`:`${n} ${s} ${a}`}return n}getChainWord(r,e){let t=F(e);return t?.keywords?t.keywords[r]?.primary??r:r}renderExplicit(r){return xe(r)}supportedLanguages(){return Oa()}findBestPattern(r,e){let t=e;if(r.kind==="event-handler"){let a=e.filter(o=>!/-event-/i.test(o.id));a.length>0&&(t=a);}let n=new Map;for(let a of t)for(let[o,s]of Object.entries(a.extraction??{})){let u=Ei(s);if(u===void 0)continue;let l=n.get(o)??new Set;l.add(u),n.set(o,l);}let i=t.map(a=>{let o=a.priority,s=d=>{let p=r.roles.get(d);return p!==void 0&&!(p.implicit===true&&p.type==="reference")},u=(d,p)=>{for(let m of d)m.type==="group"?u(m.tokens,true):m.type==="role"&&(s(m.role)?o+=p?lm:10:!p&&!m.optional&&(o-=50));};u(a.template.tokens,false);let l=new Set,c=d=>{for(let p of d)p.type==="group"?c(p.tokens):p.type==="role"&&l.add(p.role);};c(a.template.tokens);for(let d of r.roles.keys())s(d)&&!l.has(d)&&(o-=dm);for(let[d,p]of Object.entries(a.extraction??{})){let m=Ei(p);if(m===void 0)continue;let f=r.roles.get(d),v=f?.type==="literal"?String(f.value).trim().toLowerCase():void 0;v===m?o+=60:(v===void 0||n.get(d)?.has(v))&&(o-=200);}return a.language==="en"&&((a.id.includes("standard")||a.id.includes("en-source"))&&(o+=20),(a.id.includes("-when")||a.id.includes("-if")||a.id.includes("-upon"))&&(o-=15)),{pattern:a,score:o}});return i.sort((a,o)=>o.score-a.score),i.length>0?i[0].pattern:null}spliceWaitAlternatives(r,e,t,n){let i=r.waitAlternatives;if(!i||i.length===0||t<0)return;let a=v=>v&&v.length>0?`(${v.join(", ")})`:"",[o,...s]=i;"event"in o&&(e[t]+=a(o.params));let u=[...et[n]??[]][0]??"or",l=s.map(v=>"event"in v?`${u} ${this.renderEventName({type:"literal",value:v.event},n)}${a(v.params)}`:`${u} ${v.duration}`);e.splice(t+1,0,...l);let c=r.waitSource;if(!c)return;let d=this.valueToNaturalString(c,n),p=F(n)?.roleMarkers?.source,m=p?.primary??"from",f=p?.position==="after"?`${d} ${m}`:`${m} ${d}`;e.splice(t+1+l.length,0,f);}spliceOrEvents(r,e,t,n){let i=r.additionalEvents??[];if(i.length===0)return;let a=[...et[n]??[]][0]??"or",o=i.map(s=>`${a} ${this.renderEventName(s,n)}`);e.splice(t>=0?t+1:e.length,0,...o);}spliceEventModifiers(r,e,t,n){let i=r.eventModifiers;if(!i)return;t>=0&&i.queue&&(e[t]+=`.queue(${i.queue})`),i.once&&i.onceAsFirst?n==="en"&&t>=0?e[t]=`first ${e[t]}`:e.unshift("first"):i.once&&(n==="en"&&t>=0?e[t]+=".once":e.unshift("once"));let a=[];if(i.from){let u=this.valueToNaturalString(i.from,n),l=F(n)?.roleMarkers?.source,c=l?.primary??"from";l?.position==="after"?e.unshift(`${u} ${c}`):a.push(`${c} ${u}`);}let o=u=>u%1e3===0?`${u/1e3}s`:`${u}ms`;if(typeof i.debounce=="number"&&a.push(`debounced at ${o(i.debounce)}`),typeof i.throttle=="number"&&a.push(`throttled at ${o(i.throttle)}`),a.length===0)return;let s=t>=0&&F(n)?.roleMarkers?.source?.position!=="after"?t+1:e.length;e.splice(s,0,...a);}renderWithPattern(r,e){let t=[],n=e.language,i=-1;for(let o of e.template.tokens){let s=this.renderPatternToken(o,r,n);s!==null&&(t.push(s),o.type==="role"&&(o.role==="event"||o.role==="duration"&&r.action==="wait")&&(i=t.length-1));}r.action==="wait"&&r.kind==="command"&&this.spliceWaitAlternatives(r,t,i,n),r.action==="fetch"&&r.doNotThrow&&t.push("do not throw");let a=r.scrollBehavior;if(a&&(r.action==="go"||r.action==="scroll")&&t.push(a),r.kind==="event-handler"){let o=r.parameterNames;o&&o.length>0&&i>=0&&(t[i]+=`(${o.join(", ")})`),this.spliceOrEvents(r,t,i,n),this.spliceEventModifiers(r,t,i,n);}if(r.kind==="event-handler"){let o=r;if(o.body&&o.body.length>0){let s=o.body.map(u=>this.render(u,n));t.push(s.join(" "));}}return t.join(" ")}renderPatternToken(r,e,t){switch(r.type){case "literal":return r.renderSuppress?null:r.value;case "role":{let n=e.roles.get(r.role);if(!n){if(r.role==="duration"&&e.action==="wait"){let a=e.roles.get("event");if(a)return this.renderEventName(a,t)}return r.optional,null}if(r.role==="event")return this.renderEventName(n,t);let i=e.scrollPosition;if(i&&r.role==="destination"&&(e.action==="go"||e.action==="scroll"))return `${i} of ${this.valueToNaturalString(n,t)}`;if(t==="en"&&e.action==="halt"&&r.role==="patient"&&n.type==="reference"&&n.value==="event")return `the ${this.valueToNaturalString(n,t)}`;if(e.action==="render"&&r.role==="style"&&n.type==="expression"){let a=n.raw.trim();if(a.startsWith("{")&&a.endsWith("}"))return a.slice(1,-1).trim()}if(e.action==="js"&&n.type==="expression")return n.raw;if(r.valueShape==="keyword"){if(n.type==="reference")return n.value;if(n.type==="expression")return n.raw;if(n.type==="literal"&&n.dataType!=="string")return String(n.value)}if(e.action==="fetch"&&r.role==="responseType"&&n.type==="expression")return n.raw;if(e.action==="pick"&&r.role==="patient"&&n.type==="expression"){let a=Pa.rangeSeparatorFor(t);if(a)return n.raw.replace(/(?<=\s)to(?=\s)/g,a)}return this.valueToNaturalString(n,t)}case "group":{if(!r.tokens.filter(o=>o.type==="role"&&!o.optional).every(o=>e.roles.has(o.role))&&r.optional)return null;if(r.optional)for(let o of ["destination","source","patient"]){if(!r.tokens.find(l=>l.type==="role"&&l.role===o))continue;let u=e.roles.get(o);if(!(u?.type!=="reference"||u.value!=="me")&&u.implicit){if(o==="destination"){let l=e.roles.get("patient");if(l?.type==="literal"&&l.dataType==="string")continue}if(!(o==="patient"&&cm(e,"patient")))return null}}if(r.optional&&r.tokens.find(s=>s.type==="role"&&s.role==="quantity")){let s=e.roles.get("quantity");if(s?.type==="literal"&&(s.value===1||s.value==="1"))return null}let i=[],a=false;for(let o of r.tokens){let s=this.renderPatternToken(o,e,t);s!==null&&(i.push(s),o.type==="role"&&(a=true));}return r.optional&&!a&&!r.renderRequired?null:i.length>0?i.join(" "):null}default:return null}}renderEventName(r,e){if(r.type!=="literal"||typeof r.value!="string")return this.valueToNaturalString(r,e);let t=r.value,n=i=>i.includes(":")?i:$s(i,e);return t.includes(" or ")?t.split(" or ").map(i=>n(i.trim())).join(" or "):n(t)}valueToNaturalString(r,e="en"){switch(r.type){case "literal":return typeof r.value=="string"&&r.dataType==="string"?r.interpolates?r.value:`"${r.value}"`:this.localizeValue(String(r.value),e);case "selector":return r.scope?`${r.value} in ${this.valueToNaturalString(r.scope,e)}`:r.value;case "reference":return this.renderReference(r,e);case "property-path":return this.renderPropertyPath(r,e);case "expression":return /^[A-Za-z_$][\w$]*$/.test(r.raw)?this.renderLoneName(r.raw,e):this.localizeValue(this.localizeInteriorPossessives(this.valueGuard?.(r.raw)??r.raw,e),e,this.variablesKeptAsSpelled(r.raw,e));case "flag":return this.localizeValue(r.name,e)}}localizedName(r,e){let t=this.localizeValue(r,e);if(t===r)return r;if(this.spellVariables)return;let[n,...i]=Y(t,e).tokens;if(i.length===0&&n?.kind==="keyword"&&(n.normalized??n.value).toLowerCase()===r.toLowerCase()&&!Ar(n))return this.localizedVariable=true,t}renderLoneName(r,e){let t=this.valueGuard?.(r)??r;return t!==r?t:Va(r)?this.localizedName(r,e)??r:this.localizeValue(r,e)}variablesKeptAsSpelled(r,e){if(e==="en")return;let t=[...om(r)].filter(n=>this.localizedName(n,e)===void 0);return t.length?new Set(t):void 0}localizeValue(r,e,t){return e==="en"?r:am(r,e,F(e),t)}renderReference(r,e){let t=F(e);return t?.references?t.references[r.value]??r.value:r.value}renderDotBase(r,e,t){if(r.type!=="reference")return this.valueToNaturalString(r,e);let n=t?.possessive?.specialForms?.[r.value];return n&&!/\s/.test(n)?n:r.value}localizeInteriorPossessives(r,e){let t=(i,a)=>/^\s+as\b/.test(i.slice(a));if(e==="en")return r.replace(/\b(?:the\s+)?([A-Za-z][\w-]*)\s+of\s+([#.][\w-]+)/g,(i,a,o,s,u)=>pm.has(a.toLowerCase())&&!t(u,s+i.length)?`${o}'s ${a}`:i);if(!r.includes("'s"))return r;let n=(i,a)=>this.renderPropertyPath({type:"property-path",object:i,property:a,access:"possessive"},e);return r.replace(/([#.][\w-]+)((?:'s\s+[A-Za-z][\w-]*)+)/g,(i,a,o,s,u)=>{let[l,...c]=[...o.matchAll(/'s\s+([A-Za-z][\w-]*)/g)].map(m=>m[1]),d=n(_e(a),l);if(!d)return i;let p=!d.startsWith(a);if(p)for(let m of c)d=n(_e(d),m);else d+=c.map(m=>`'s ${m}`).join("");return t(u,s+i.length)&&p?`(${d})`:d})}renderPropertyPath(r,e){let t=F(e);if(r.access==="dot"){let o=this.renderDotBase(r.object,e,t),s=r.property;return /^[.?]/.test(s)?`${o}${s}`:`${o}.${s}`}let n=this.localizeValue(r.property,e),i=r.object.type==="reference"?r.object.value:null;if(t?.possessive&&i){let o=t.possessive.specialForms?.[i]??fm(t.possessive.keywords,i);if(o)return `${o} ${n}`}let a=this.valueToNaturalString(r.object,e);if(r.object.type==="expression"){if(e==="en"||!t?.possessive)return `the ${n} of ${a}`;let{marker:o,markerPosition:s}=t.possessive;if(o&&s==="between"&&e!=="th")return `${a} ${o} ${n}`;let u=e==="th"?o:Hn(t);return u?`${n} ${u} ${a}`:`the ${n} of ${a}`}if(t?.possessive){let{marker:o,markerPosition:s,usePossessiveAdjectives:u}=t.possessive;if(u&&i)return `${a} ${n}`;if(o&&s==="between"){if(e==="th")return `${n} ${o} ${a}`;let c=t.tokenization!==void 0;return t.usesSpaces&&!c?`${a} ${o} ${n}`:t.usesSpaces?`${a}${o} ${n}`:`${a}${o}${n}`}let l=e!=="en"&&r.object.type==="selector"?Hn(t):void 0;if(l)return `${n} ${l} ${a}`;if(o)switch(s){case "after-object":return `${a}${o} ${n}`;case "before-property":return `${a} ${o} ${n}`}}return e==="en"||!t?.possessive?a==="me"?`my ${n}`:a==="it"?`its ${n}`:`${a}'s ${n}`:`${a} ${n}`}};function fm(r,e){if(r){for(let[t,n]of Object.entries(r))if(n===e)return t}}var mr=new mm;var vm=new Set(["a","an","the"]),gi=new Map;function hm(r){let e=gi.get(r);return e||(e=new Set(Object.values(fe).flatMap(t=>t.roles.flatMap(n=>[n.markerOverride?.[r],...n.markerVariants?.[r]??[]].filter(i=>typeof i=="string"&&i.length>0)))),gi.set(r,e)),e}function Em(r,e){let t=Y(r,e).tokens,n=t[0];if(t.length!==1||!n)return {collision:"structure",word:"words"};let i=n.normalized!==r?n.normalized:void 0;if(n.kind==="keyword"&&_i.has(i??""))return {collision:"pronoun",word:"pronoun",sense:i};if(n.kind==="identifier"&&!i){if(hm(e).has(r))return {collision:"structure",word:"marker"};let a=rr(e,r);return a!==r?{collision:"structure",word:"connective",sense:a}:vm.has(r.toLowerCase())?{collision:"structure",word:"article"}:null}return n.kind==="particle"?{collision:"structure",word:"marker"}:{collision:"structure",word:"keyword",sense:i}}function qa(r,e){let t=`${e}\0${r}`,n=ki.get(t);return n===void 0&&(n=Em(r,e)?.collision??null,ki.set(t,n)),n}var ki=new Map;Ds((r,e)=>qa(r,e)==="structure");function pn(r){switch(r.kind){case "command":return Ka(r);case "event-handler":{let e=r;return {...e,roles:hr(e.roles),body:je(e.body)}}case "compound":{let e=r;return {...e,roles:hr(e.roles),statements:je(e.statements)}}case "conditional":{let e=r;return {...e,roles:hr(e.roles),thenBranch:je(e.thenBranch),...e.elseBranch?{elseBranch:je(e.elseBranch)}:{}}}case "loop":{let e=r;return {...e,roles:hr(e.roles),body:je(e.body)}}case "behavior":{let e=r;return {...e,eventHandlers:e.eventHandlers.map(n=>pn(n)),...e.initBlock?{initBlock:je(e.initBlock)}:{}}}case "def":{let e=r;return {...e,body:je(e.body)}}case "feature":{let e=r;return {...e,body:je(e.body)}}default:return r}}function je(r){return r.map(pn)}function hr(r){return new Map([...r].map(([e,t])=>[e,Ha(t)]))}var zm={beforebegin:"before",afterend:"after",afterbegin:"at start of",beforeend:"at end of"},bm=new Set(["swap","morph"]);function Cm(r){let e=r?.type==="literal"?r.value:r?.type==="expression"?r.raw:void 0;return typeof e=="string"&&e.toLowerCase()==="transition"}function Ka(r){if(at(r))return {...r,roles:hr(r.roles),body:je(r.body)};if(bm.has(r.action)&&Cm(r.roles.get("manner"))){let o=new Map(r.roles);return o.delete("manner"),{kind:"command",action:"viewTransition",roles:new Map,body:[Ka({...r,roles:o})],...r.metadata?{metadata:r.metadata}:{}}}let e={...r,roles:hr(r.roles)},t=e.roles,n=o=>t.get(o),i=(o,s)=>{let u=new Map;for(let[c,d]of s)d&&u.set(c,d);return {...e,action:o,roles:u}},a=o=>({type:"literal",value:o,implicit:true});switch(e.action){case "set":{let o=n("destination"),s=n("scope"),u=s&&Tt(s);return o?.type!=="selector"||!o.value.startsWith("@")||!u?e:i("set",[...[...t].filter(([l])=>l!=="scope"&&l!=="destination"),["destination",{type:"expression",raw:`${o.value} of ${u}`}]])}case "go":{let o=n("destination");return o?.type!=="literal"||typeof o.value!="string"||n("method")?e:i("go",[...t,["method",{type:"literal",value:"url"}]])}case "prepend":return i("put",[["patient",n("patient")],["destination",n("destination")],["manner",a("at start of")]]);case "push":case "replace":{let o=n("patient")&&Tt(n("patient"));if(!o)return e;let s=e.action==="push"?"pushState":"replaceState";return i("call",[["patient",{type:"expression",raw:`history.${s}(null,'',${o})`}]])}case "copy":{let o=n("patient");if(o?.type==="selector")return e;let s=o&&Tt(o);return s?i("call",[["patient",{type:"expression",raw:`navigator.clipboard.writeText(${s})`}]]):e}case "swap":{let o=n("method"),s=n("destination"),u=n("patient");if(o?.type!=="literal"||typeof o.value!="string"||!s)return e;let l=o.value.toLowerCase();if(l==="delete")return i("remove",[["patient",s]]);if(!u)return e;if(l==="innerhtml")return i("put",[["patient",u],["destination",s]]);if(l==="outerhtml")return i("put",[["patient",u],["destination",{type:"property-path",object:s,property:"outerHTML",access:"possessive"}]]);let c=zm[l];return c?i("put",[["patient",u],["destination",s],["manner",a(c)]]):e}case "fetch":{let o=n("source");return !e.doNotThrow||n("responseType")||o?.type!=="literal"||o.interpolates?e:i("fetch",[...t,["responseType",{type:"expression",raw:"text"}]])}default:return e}}function Tt(r){switch(r.type){case "selector":case "reference":return String(r.value);case "expression":return r.raw;case "literal":return typeof r.value=="string"?JSON.stringify(r.value):String(r.value);default:return}}function Ha(r){switch(r.type){case "property-path":{let e=r.property.replace(/\?\./g,".").replace(/^\./,""),t=Ha(r.object);return e===r.property&&t===r.object?r:{...r,object:t,property:e}}case "expression":{let e=xm(r.raw);return e===r.raw?r:{...r,raw:e}}case "literal":return r.interpolates&&typeof r.value=="string"?{type:"expression",raw:`\`${r.value}\``}:r;default:return r}}var Am=/^(previous|next|closest|first|last)\s+(<[^>]*\/>|[.#][\w-]+)\s*\.([A-Za-z_$][\w$]*)$/;function xm(r){let e=Am.exec(r.trim());return e?`the ${e[3]} of ${e[1]} ${e[2]}`:Dm(r,t=>t.replace(/\?\./g,".").replace(/\bdoes not have(\s+)(?=[.#[])/g,"does not match$1").replace(/\bhas(\s+)(?=[.#[])/g,"matches$1").replace(/\bhave(\s+)(?=[.#[])/g,"match$1"))}function Dm(r,e){let t="",n="";for(let i=0;i<r.length;i++){let a=r[i];if(a==='"'||a==="'"||a==="`"){t+=e(n),n="";let o=i+1;for(;o<r.length&&r[o]!==a;)o+=r[o]==="\\"?2:1;t+=r.slice(i,o+1),i=o;}else n+=a;}return t+e(n)}function pt(r,e){return mr.render(pn(r),e);}var Sm={getSchema:oe};function Bm(r){return qr(r,{schemaLookup:Sm})}var Je=new Set(["if","unless","while","repeat","for"]),Ua=new Set(["repeat","for",...it]),fr={kind:"loop-close"};function mn(r){return r===fr}function qt(r){if(mn(r)||r.kind!=="command"||!Ua.has(r.action))return false;let e=r.body;return it.has(r.action)?e===void 0:!(Array.isArray(e)&&e.length>0)}function bi(r){return !!r&&(r.kind==="loop"||at(r))}function Tm(r,e){let t=n=>{let{position:i,...a}=n;return JSON.stringify(a)};return r.type===e.type&&t(r)===t(e)}function Fm(r){switch(r.type){case "expression":return r.raw;case "literal":return String(r.value);case "reference":return r.value;default:return}}function Zr(r,e){for(let t=e-1;t>=0;t--)if(r[t].kind!=="particle")return r[t]}function Ft(r){return r.kind!=="keyword"&&r.kind!=="identifier"?false:(r.normalized??r.value).toLowerCase()==="repeat"}function Xr(r){let e=0;for(let t of r)qt(t)?e++:mn(t)&&e>0&&e--;return e}var Pt=new Set(["then","end","else","if","unless","while","for","repeat","and"]),Pm=new Set(["first","last","next","previous","random","closest"]),Om=new Set(["me","my","i","it","its","you","your","result"]),Ci=new Set(["top","middle","bottom","left","center","right","nearest"]),Rm=new Set(["smoothly","instantly"]);function Lm(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 Br=["body","statements","thenBranch","elseBranch","eventHandlers","initBlock"];function Nm(r){let e=(r.normalized??r.value).toLowerCase();return e==="document"||e==="window"||e==="me"||e==="body"?Be(e):r.kind==="selector"?_e(r.value):{type:"expression",raw:r.value}}var Ai=new Map;function xi(r){let e=Ai.get(r);return e||(e=new Set(Ee(r).map(t=>t.command).filter(t=>t!=="on")),Ai.set(r,e)),e}var Re=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"]),Di=class extends Error{constructor(r,e,t,n){super(r),this.name="SemanticParseError",this.language=e,this.input=t,this.diagnostics=n;}};function G(r,e,t){return {message:r,severity:e,source:"semantic-parser",...t&&{code:t}}}function H(r,e){return e.length===0?r:{...r,diagnostics:e}}var nt=120;function _m(r,e,t){let n=e.tokens.length;if(r.consumedTokens>=n)return null;let i=e.tokens[r.consumedTokens],a=e.tokens[n-1];if(!i||!a)return null;let o=t.slice(i.position.start,a.position.end);if(!o.trim())return null;let s=o.length>nt?`${o.slice(0,nt)}\u2026`:o,u=n-r.consumedTokens;return `pattern ${r.pattern.id} left ${u} token(s) unconsumed: "${s}"`}var Si=/^repeat-.*-(times|for-in|while-head|until-head|until-condition-head)$/,Mm=new Set(["forever","times","for","while","until","until-event"]),Im=new Set(["to","from","into","onto","with","as","at","of","in","on","by","and","or","then","end","else","the","a","an","async"]);function Jr(r){let e=[],t=new Set((r.diagnostics??[]).map(i=>`${i.code}|${i.message}`)),n=i=>{if(!i||typeof i!="object")return;if(i!==r)for(let o of i.diagnostics??[]){if(o.code!=="unconsumed-input")continue;let s=`${o.code}|${o.message}`;t.has(s)||(t.add(s),e.push(o));}let a=i;for(let o of Ga){let s=a[o];if(Array.isArray(s))for(let u of s)n(u);}};return n(r),e.length===0?r:H(r,[...r.diagnostics??[],...e])}function $m(r){if(r.length>=2){let e=r[0];if((e==='"'||e==="'")&&r.endsWith(e))return r.slice(1,-1)}return r}var Ga=["body","statements","thenBranch","elseBranch","eventHandlers","initBlock"];function Ya(r,e,t){if(!r||typeof r!="object")return r;if(r.action&&r.roles instanceof Map){let i=oe(r.action),a=i?.primaryRole;if(i&&a&&a!=="patient"&&!i.roles.some(o=>o.role==="patient")&&r.roles.has("patient")&&!r.roles.has(a)){let o=r.roles,s=o.get("patient");s!==void 0&&(o.delete("patient"),o.set(a,s));}if(r.action==="tell"){let o=r.roles,s=o.get("patient"),u=o.get("destination");s&&(s.type==="selector"||s.type==="reference")&&(!u||u.type==="literal")&&(o.delete("patient"),o.set("destination",s));}if(r.action==="transition"){let o=r.roles,s=o.get("goal");s&&s.type==="literal"&&s.dataType==="duration"&&!o.has("duration")&&(o.delete("goal"),o.set("duration",s));}if(r.action==="fetch"){let o=r.roles,s=o.get("patient"),u=o.get("source");s&&u&&(s.type==="literal"||s.type==="expression")&&u.type==="expression"&&!o.has("style")&&(o.delete("patient"),o.set("style",u),o.set("source",s));}if(r.action==="transition"){let o=r.roles,s=o.get("destination");s&&s.type==="literal"&&!o.has("goal")&&(o.delete("destination"),o.set("goal",s));let u=o.get("patient");u&&u.type==="literal"&&typeof u.value=="string"&&/^[A-Za-z_][A-Za-z0-9_-]*$/.test(u.value)&&o.set("patient",{type:"expression",raw:u.value});}if(r.action==="morph"){let o=r.roles,s=o.get("patient");s&&s.type==="literal"&&typeof s.value=="string"&&/<[a-zA-Z][^>]*\/?>/.test(s.value)&&o.set("patient",{type:"expression",raw:s.value});}if(r.action==="wait"){let o=r.roles;if(!o.has("event")){let s=o.get("duration"),u=s?.type==="expression"?s.raw:s?.type==="literal"?s.value:void 0,l=typeof u=="string"&&t?Hi(u,t):"",c=typeof u=="string"&&!!t&&!!be[t]?.[u];typeof u=="string"&&Re.has(u.toLowerCase())?(o.delete("duration"),o.set("event",{type:"literal",value:u,dataType:"string"})):(c||Re.has(l))&&(o.delete("duration"),o.set("event",{type:"literal",value:l,dataType:"string"}));}}if((r.kind==="command"||r.kind==="loop")&&r.action!=="on"&&t){let o=r.roles,s=o.get("event"),u=s?.type==="expression"?s.raw:s?.type==="literal"?s.value:void 0,l=typeof u=="string"?be[t]?.[u]:void 0;l&&o.set("event",{type:"literal",value:l,dataType:"string"});}if(r.kind==="command"&&r.action!=="on"){let o=r.roles,s=o.get("event");if(s&&s.type==="expression"){let u=s.raw;typeof u=="string"&&/^[A-Za-z_][A-Za-z0-9_-]*(:[A-Za-z0-9_-]+)?$/.test(u)&&o.set("event",{type:"literal",value:u,dataType:"string"});}}if(e?.size){let o=r.roles;for(let s of ["destination","source"]){let u=o.get(s);u&&u.type==="literal"&&typeof u.value=="string"&&e.has(u.value)&&o.set(s,{type:"expression",raw:u.value});}}}let n=r;for(let i of Ga){let a=n[i];if(Array.isArray(a))for(let o of a)Ya(o,e,t);}return r}var jm=/^[\p{L}_$][\p{L}\p{N}_$:.\-]*$/u,Ae=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 n=Ya(this.parseInternal(e,t),this.boundIdentifiers,t),i=this.coverageFrames[this.coverageFrames.length-1];if(i.length>0&&(n=H(n,[...n.diagnostics??[],...i])),this.parseDepth===1&&(n=Jr(n),n.kind==="event-handler")){let a={node:n,input:e},o=a.node.eventModifiers;if(o&&(o.once||o.debounce!==void 0||o.throttle!==void 0))for(let u=0;u<4;u++){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 s=this.reclaimEventCompoundTail(a.node,a.input,t);s&&(a=s),n=a.node;}return n}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 n=F(e)?.roleMarkers;if(n){for(let i of Object.values(n))if(i){if(i.primary)for(let a of i.primary.toLowerCase().split(/\s+/))t.add(a);for(let a of i.alternatives??[])for(let o of a.toLowerCase().split(/\s+/))t.add(o);}}for(let i of B.LEAKED_RENDER_MARKERS[e]??[])t.add(i.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 n=(e.normalized??e.value).toLowerCase();return Im.has(n)?true:B.getCoverageMarkerSurfaces(t).has(e.value.toLowerCase())}recordDroppedTokens(e,t,n){if(e.length===0)return;let i=this.coverageFrames[this.coverageFrames.length-1];if(!i||!e.some(s=>!this.isCoverageResidueToken(s,t)))return;let a=e.map(s=>s.value).join(" ").trim();if(!a)return;let o=a.length>nt?`${a.slice(0,nt)}\u2026`:a;i.push(G(`${n} left ${e.length} token(s) unconsumed: "${o}"`,"warning","unconsumed-input"));}registerBoundIdentifiers(e){let t=e.action==="repeat"||e.action==="for"?"patient":e.action==="set"?"destination":null;if(!t)return;let n=e.roles.get(t);n?.type==="expression"&&typeof n.raw=="string"&&/^[A-Za-z_]\w*$/.test(n.raw)&&this.boundIdentifiers.add(n.raw);}parseInternal(e,t){let n=k0(e,t,{statement:(z,A)=>this.parse(z,A),body:(z,A)=>this.parseStatements(z,A)});if(n)return n;let i=P0(e,t,{statement:(z,A)=>this.parse(z,A),body:(z,A)=>this.parseStatements(z,A)});if(i)return i;let a=w0(e,t,{statement:(z,A)=>this.parse(z,A),body:(z,A)=>this.parseStatements(z,A)});if(a)return a;let{modifiers:o,remainingInput:s}=this.extractStandaloneModifiers(e,t),u=s||e,c=this.stripAsyncModifier(u,t).remainingInput??u,p=this.stripDoNotThrowModifier(c,t).remainingInput??c,m=[],f=Y(p,t);this.positionSource=p;{let z=f.mark(),A=this.consumeJsBlock(f,t);if(A&&f.isAtEnd())return H(A,m);f.reset(z);}let v=Ee(t);if(v.length===0)throw new Di(`No patterns available for language: ${t}`,t,p,[G(`No patterns registered for language '${t}'`,"error","no-patterns")]);let E=[...v].sort((z,A)=>A.priority-z.priority);{let z=f.tokens;if(F(t)?.wordOrder==="VSO"&&z.length>=4&&z[0]?.normalized==="source"){let A=z.findIndex(S=>S.normalized==="on");if(A>=2&&A+1<z.length){let S=p.slice(z[0].position.start,z[A].position.start).trim(),L=z[A+1].position.end,P=p.slice(z[A].position.start,L)+" "+S+p.slice(L);if(P!==p)try{let $=this.parse(P,t);if($&&$.kind==="event-handler"){let O=o?this.applyModifiers($,o):$;return H(O,m)}}catch{}}}}{let z=f.tokens,A=z[0]?.normalized==="if";for(let S=0;A&&S+3<z.length;S++){let L=(z[S+3]?.normalized??z[S+3]?.value??"").toLowerCase();if(z[S]?.normalized==="source"&&z[S+2]?.normalized==="on"&&B.KNOWN_EVENTS.has(L)){let P=(p.slice(0,z[S].position.start).trimEnd()+" "+p.slice(z[S+1].position.end).trimStart()).trim();if(P&&P!==p)try{let $=this.parse(P,t);if($&&$.kind==="event-handler"){let O=o?this.applyModifiers($,o):$;return H(O,m)}}catch{}break}}}{let z=this.tryDoNotThrow(f.tokens,p,t);if(z){let A=o&&z.kind==="event-handler"?this.applyModifiers(z,o):z;return H(A,m)}}{let z=this.tryTellTo(f.tokens,p,t);if(z){let A=o&&z.kind==="event-handler"?this.applyModifiers(z,o):z;return H(A,m)}}{let z=this.tryScrollModifiers(f.tokens,p,t);if(z){let A=o&&z.kind==="event-handler"?this.applyModifiers(z,o):z;return H(A,m)}}{let z=this.tryLoopIndex(f.tokens,p,t);if(z){let A=o&&z.kind==="event-handler"?this.applyModifiers(z,o):z;return H(A,m)}}{let z=this.tryWaitAlternatives(f.tokens,p,t);if(z){let A=o&&z.kind==="event-handler"?this.applyModifiers(z,o):z;return H(A,m)}}{let z=f.tokens,A=xi(t);for(let S=0;S+1<z.length;S++){let L=z[S];if(this.isBodyCommandWord(L,A))break;if(z[S+1].value!=="(")continue;let P=(L.normalized??L.value).toLowerCase();if(!(B.KNOWN_EVENTS.has(P)||Re.has(P))&&L.kind!=="identifier")continue;let O=this.matchEventParamPhrase(z,S+1);if(O.len===0)continue;let _=z[S+O.len],V=(p.slice(0,z[S+1].position.start).trimEnd()+" "+p.slice(_.position.end).trimStart()).trim();try{let T=this.parse(V,t);if(T?.kind==="event-handler"){let I=this.reclaimEventCompoundTail(Jr(T),V,t);I&&(T=I.node);}let M=T?.roles.get("event"),te=(M?.type==="expression"?M.raw:M&&"value"in M?String(M.value):void 0)?.toLowerCase(),q=p.slice(0,z[S+1].position.start).trimEnd().toLowerCase(),R=te===L.value.toLowerCase()||te===P||te!==void 0&&_s(te,t).some(I=>q.endsWith(I.toLowerCase()));if(T?.kind==="event-handler"&&R){T.parameterNames=O.names;let I=o?this.applyModifiers(T,o):T;return H(I,m)}}catch{}}}{let z=f.tokens,A=xi(t);for(let S=1;S<z.length-1;S++){let L=z[S];if(this.isBodyCommandWord(L,A))break;if(!Or(L,t))continue;let P=z[S+1],$=(P.normalized??P.value).toLowerCase();if(!B.KNOWN_EVENTS.has($))break;let O=S+1,_=z[S+2];_&&_.kind==="selector"&&_.value.startsWith("[")&&(O=S+2);let V=z[S].position.start,T=z[O].position.end,M=(p.slice(0,V).trimEnd()+" "+p.slice(T).trimStart()).trim();if(M&&M!==p)try{let X=this.parse(M,t);if(X&&X.kind==="event-handler"){X.additionalEvents=[{type:"literal",value:O>S+1?$+_.value:$}];let te=o?this.applyModifiers(X,o):X;return H(te,m)}}catch{}break}}{let z=Y0(f.tokens);if(z){let A=(p.slice(0,z.start).trimEnd()+" "+p.slice(z.end).trimStart()).trim();if(A&&A!==p)try{let S=this.parse(A,t);if(S&&S.kind==="event-handler"){let L=this.applyModifiers(S,{...o??{},...z.modifiers});return H(L,m)}}catch{}}}let h=E.filter(z=>z.command==="on"),y=f.mark(),k=Se.matchBest(f,h);if(k){m.push(G(`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 A=k.captured.get("event"),S=(A?.raw??A?.value??"").toString().toLowerCase(),L=be[t],P=B.KNOWN_EVENTS.has(S)||!!L&&Object.keys(L).some($=>$.toLowerCase()===S);if(S&&!P){let $=this.trySOVEventExtraction(p,t,E);if($){m.push(G(`bare-event mis-anchor on "${S}" rejected; SOV extraction preferred`,"info","stage-bare-event-guard"));let O=o?this.applyModifiers($,o):$;return H(O,m)}if(A?.type==="reference"||A?.type==="expression"){f.reset(y);let O=E.filter(V=>V.command!=="on"),_=Se.matchBest(f,O);f.reset(y),_&&_.pattern.command!=="on"?(z=true,m.push(G(`bare-event mis-anchor on reference "${S}" rejected; command ${_.pattern.command} preferred`,"info","stage-bare-event-guard"))):Se.matchBest(f,h);}}}if(!z){let A=this.buildEventHandler(k,f,t),S=o?this.applyModifiers(A,o):A;return H(S,m)}}m.push(G(`event patterns: ${h.length} tried, no match`,"info","stage-event"));let b=this.tryTrailingEventExtraction(p,t,E);if(b){m.push(G("trailing event extraction succeeded","info","stage-trailing-event"));let z=o?this.applyModifiers(b,o):b;return H(z,m)}let g=E.filter(z=>z.command!=="on"),C=this.tryParseUnlessGuard(f,g,t);if(C&&C.length>0){let z=C.length===1?C[0]:pr(C,"then",{sourceLanguage:t,confidence:1});return H(z,m)}let w=Se.matchBest(f,g);if(w){if(Je.has(w.pattern.command)){let A=this.trySOVEventExtraction(p,t,E);if(A){m.push(G(`SOV event extraction preferred over bare ${w.pattern.command} command`,"info","stage-sov-loop"));let L=o?this.applyModifiers(A,o):A;return H(L,m)}let S=this.tryMidStreamEventExtraction(p,t,E);if(S){m.push(G(`mid-stream event extraction preferred over bare ${w.pattern.command} command`,"info","stage-midstream-loop"));let L=o?this.applyModifiers(S,o):S;return H(L,m)}}else if(B.KNOWN_EVENTS.has(w.pattern.command)&&this.hasSOVEventMarkerHead(p,t)){let A=this.trySOVEventExtraction(p,t,E);if(A){m.push(G(`SOV event extraction preferred over command-homonym event ${w.pattern.command}`,"info","stage-sov-homonym"));let S=o?this.applyModifiers(A,o):A;return H(S,m)}}else if(F(t)?.wordOrder==="VSO"){let A=this.tryMidStreamEventExtraction(p,t,E);if(A){m.push(G(`mid-stream event extraction preferred over bare ${w.pattern.command} command`,"info","stage-midstream-cmd"));let S=o?this.applyModifiers(A,o):A;return H(S,m)}}if(w.consumedTokens<f.tokens.length&&F(t)?.wordOrder==="SOV"){let A=this.trySOVEventExtraction(p,t,E);if(A){m.push(G(`SOV event extraction preferred over partial ${w.pattern.command} command (trailing remainder)`,"info","stage-sov-trailing"));let S=o?this.applyModifiers(A,o):A;return H(S,m)}}if(w.consumedTokens<f.tokens.length&&Ua.has(w.pattern.command)){let A=this.tryTopLevelLoop(f,g,t);if(A)return m.push(G(`top-level loop: ${A.kind}`,"info","stage-top-level-loop")),H(A,m)}if(w.consumedTokens<f.tokens.length&&!Je.has(w.pattern.command)){let A=this.tryTopLevelCommandSequence(f,g,t);if(A)return m.push(G(`top-level command sequence: ${A.statements.length} commands`,"info","stage-top-level-sequence")),H(A,m)}if(w.consumedTokens<f.tokens.length&&(w.pattern.command==="if"||w.pattern.command==="unless")){let A=this.tryCompoundCommandParsing(f,g,t);if(A)return m.push(G("conditional with a trailing body","info","stage-compound")),H(A,m)}m.push(G(`command pattern matched: ${w.pattern.id} (confidence: ${w.confidence.toFixed(2)})`,"info","pattern-match"));let z=_m(w,f,p);return z&&m.push(G(z,"warning","unconsumed-input")),H(this.buildCommand(w,t),m)}if(m.push(G(`command patterns: ${g.length} tried, no match`,"info","stage-command")),!p.includes(`
10
+ `)&&F(t)?.wordOrder==="VSO"){let z=this.tryMidStreamEventExtraction(p,t,E);if(z){m.push(G("mid-stream event extraction succeeded with no leading command match","info","stage-midstream-nocmd"));let A=o?this.applyModifiers(z,o):z;return H(A,m)}}let D=this.trySOVEventExtraction(p,t,E);if(D){m.push(G("SOV event extraction succeeded","info","stage-sov"));let z=o?this.applyModifiers(D,o):D;return H(z,m)}m.push(G("SOV event extraction: no event keyword found","info","stage-sov"));let x=this.tryCompoundCommandParsing(f,g,t);if(x)return m.push(G("compound command parsing succeeded","info","stage-compound")),H(x,m);if(m.push(G("compound parsing: no then-keywords or no command matches","info","stage-compound")),t==="en"){let z=Y(p,t),A=this.tryParsePseudoCommand(z,g,t);if(A&&z.isAtEnd())return m.push(G("pseudo-command parsed as call","info","stage-pseudo")),H(A,m)}throw m.push(G(`all parse stages exhausted for "${p}"`,"error","parse-failed")),new Di(`Could not parse input in ${t}: ${p}`,t,p,m)}tryParsePseudoCommand(e,t,n){if(n!=="en")return null;let i=V0(e.tokens,e.position(),F(n),s=>!!oe((s.normalized??s.value).toLowerCase()));if(!i)return null;let a=Y(i.text,n),o=Se.matchBest(a,t.filter(s=>s.command==="call"));if(!o||!a.isAtEnd())return null;for(let s=0;s<i.consumed;s++)e.advance();return this.buildCommand(o,n)}parseStatements(e,t){let n=Y(e,t),i=Ee(t).filter(a=>a.command!=="on").sort((a,o)=>o.priority-a.priority);this.coverageFrames.push([]);try{let a=this.parseBodyWithClauses(n,i,t),o=this.coverageFrames[this.coverageFrames.length-1];if(o.length>0&&a.length>0){let s=a[a.length-1];a[a.length-1]=H(s,[...s.diagnostics??[],...o]);}return a}finally{this.coverageFrames.pop();}}canParse(e,t){try{return this.parse(e,t),!0}catch{return false}}supportedLanguages(){return Oa()}buildCommand(e,t){if(!e)throw new Error("No match to build command from");let n={};for(let[a,o]of e.captured)n[a]=o;let i=me(e.pattern.command,n,{sourceLanguage:t,patternId:e.pattern.id,confidence:e.confidence});return this.registerBoundIdentifiers(i),i}buildEventHandler(e,t,n){if(!e)throw new Error("No match to build event handler from");let i=e.captured.get("event");if(!i)throw new Error("Event handler pattern matched but no event captured");{let k=i.type==="expression"?i.raw:i.type==="literal"?i.value:void 0;if(typeof k=="string"&&/^[^\s()[\]{}:]+$/.test(k)){let b=be[n]?.[k];b?i={type:"literal",value:b,dataType:"string"}:i.type==="expression"&&B.KNOWN_EVENTS.has(k.toLowerCase())&&(i={type:"literal",value:k.toLowerCase(),dataType:"string"});}}let a=Se.extractEventModifiers(t),o=k=>!(k.type==="reference"&&k.value==="me")&&k.implicit!==true,s=e.captured.get("source"),u=e.pattern.command==="on"&&/^(on|event)-/.test(e.pattern.id),l=false;s&&(e.pattern.id.endsWith("source")||u)&&o(s)&&(a={...a??{},from:s},l=true);let c;if(e.eventSource&&!l){let k=e.captured.get("action"),b=k?.type==="literal"?oe(String(k.value)):void 0;F(n)?.roleMarkers?.source?.position==="after"&&b?.roles.some(C=>C.role==="source")&&!e.captured.has("source")?c=e.eventSource:o(e.eventSource)&&(a={...a??{},from:e.eventSource});}let d=e.captured.get("event")?.position,p=t.tokens[t.position()-1],f=d!==void 0&&p!==void 0&&p.position.end>d.end?[]:this.extractOrConjunctionEvents(t,n),v=i;f.length>0&&i.type==="literal"&&(v={type:"literal",value:[String(i.value),...f.map(b=>String("value"in b?b.value:""))].join(" or ")});let E,h=e.captured.get("action");if(h&&h.type==="literal"&&h.value==="if"){let k=t.tokens,b=-1;for(let g=t.position()-1;g>=0;g--){let C=k[g],w=(C.normalized??C.value).toLowerCase();if(this.isIfKeyword(w,n)){b=g;break}}for(;b>0;){let g=k[b-1];if(!this.isIfKeyword((g.normalized??g.value).toLowerCase(),n))break;b--;}if(b>=0){let g=Ee(n).filter(A=>A.command!=="on").sort((A,S)=>S.priority-A.priority),C=k.slice(b);if(e.pattern.id.endsWith("vso-verb-first")&&v.type==="literal"){let A=String(v.value??"").split("[")[0].trim().toLowerCase(),S=C.findIndex((L,P)=>{if(P===0||A==="")return false;let $=(L.normalized??L.value).toLowerCase(),O=C[P-1];return $===A&&O.kind==="keyword"&&(O.normalized??"").toLowerCase()==="on"});if(S>0){let L=C[S+1],P=L&&L.kind==="selector"&&L.value.startsWith("[")?1:0;C=[...C.slice(0,S-1),...C.slice(S+1+P)];}}let w=new he(C,n),D=this.coverageMark(),x=this.parseBodyWithClauses(w,g,n);if(x.some(A=>A.kind==="conditional")||x.length===1&&x[0]?.kind==="compound"&&x[0].statements.some(A=>A.kind==="conditional")){for(;!t.isAtEnd();)t.advance();return Sr(v,x,a,{sourceLanguage:n,patternId:e.pattern.id,confidence:e.confidence})}this.coverageRollback(D);}}if(h&&h.type==="literal"&&String(h.value)!=="js"&&oe(String(h.value))!==void 0){let k=h.value,b={};for(let[O,_]of e.captured)if(O!=="event"&&O!=="action"&&O!=="continues"){if(O==="source"&&l)continue;b[O]=_;}if(c&&(b.source=c),k==="repeat"){let O=t.peek(),_=T=>(T.normalized??T.value).toLowerCase();if(O&&O.kind==="keyword"&&_(O)==="forever")b.loopType={type:"literal",value:"forever"},delete b.patient,t.advance();else if(O&&O.kind==="keyword"&&_(O)==="event"){t.advance();let T=t.peek();if(T)for(b.event={type:"literal",value:_(T)},b.loopType={type:"literal",value:"until-event"},delete b.patient;!t.isAtEnd();){let M=t.peek();if(!M||M.kind==="conjunction"||M.kind==="keyword"&&(this.isThenKeyword(M.value,n)||this.isEndKeyword(M.value,n)))break;t.advance();}}let V=b.patient;V&&V.type==="reference"&&V.value==="me"&&delete b.patient;}let g=me(k,b,{sourceLanguage:n,patternId:e.pattern.id,confidence:e.confidence});this.registerBoundIdentifiers(g);let C=[];if(!Je.has(k)||k==="repeat"||k==="while"){let O=e.pattern.id.includes("verb-first"),_=t.tokens,V=t.position(),T=R=>{let I=_[R];if(I.kind==="conjunction")return true;if(I.kind!=="keyword")return false;let J=ze(_,R);return this.isThenAt(I,J,n)||this.isEndKeyword(I.value,n)&&!We(J,n)},M=k==="repeat"||k==="while",X=R=>T(R)||M&&this.isBlockEndToken(_[R],ze(_,R),n),te=new Set;{let R=F(n)?.keywords?.[k];R?.primary&&te.add(R.primary.toLowerCase());for(let I of R?.alternatives??[])te.add(I.toLowerCase());}let q=-1;for(let R=V-1;R>=0;R--){let I=_[R];if(T(R))break;if((I.normalized??I.value).toLowerCase()===k||te.has(I.value.toLowerCase())){q=R;break}}if(q>=0){let R=V,I=0;for(;R<_.length;){let ne=_[R],ve=Zr(_,R);if(M&&this.isIfKeyword((ne.normalized??ne.value).toLowerCase(),n)&&!(ve&&this.isElseKeyword(ve.value,n)))I++;else if(I>0)this.isBlockEndToken(ne,ze(_,R),n)&&I--;else if(X(R))break;R++;}let J=_.slice(q,R),ge=J;if(O){let ne=String(i.value??"").toLowerCase(),ve=J.findIndex(ue=>(ue.normalized??ue.value).toLowerCase()===ne);if(ve<0)ge=null;else {let ue=J[ve-1],de=ue&&ue.kind==="keyword"&&ue.normalized?.toLowerCase()==="on"?ve-1:ve;ge=[...J.slice(0,de),...J.slice(ve+1)];}}if(ge&&ge.length>1){let ne=Ee(n).filter(K=>K.command!=="on").sort((K,ee)=>ee.priority-K.priority),ve=this.coverageMark(),ue=this.parseClause(ge,ne,n),de=ue[0],ar=K=>K!==null&&typeof K=="object"&&typeof K.type=="string"?K.type:typeof K,or=oe(k),sr=or?.primaryRole,Dn=K=>K==="patient"&&sr&&sr!=="patient"&&!or?.roles.some(ee=>ee.role==="patient")?sr:K,Do=(K,ee)=>{if(!Je.has(k)||!or)return false;let He=or.roles.find(Ue=>Ue.role===Dn(K));return He?He.expectedTypes.length>0&&!He.expectedTypes.includes(ar(ee)):true},ht=(K,ee)=>K==="patient"&&!!or&&!or.roles.some(He=>He.role==="patient")&&ar(ee)==="literal"&&_r.has(String(ee.value??"").toLowerCase()),Et=K=>K!==null&&typeof K=="object"&&K.implicit===true,So=!!de&&de.kind==="command"&&Object.entries(b).every(([K,ee])=>{if(Et(ee)||Do(K,ee)||ht(K,ee))return true;let He=de.roles.get(Dn(K));if(He!==void 0&&ar(He)===ar(ee))return true;if(K==="patient"&&sr&&sr!=="patient"){let Ue=de.roles.get(sr);if(Ue!==void 0&&Tm(Ue,ee))return true}if(K==="patient"&&k==="pick"&&ar(ee)==="literal"){let Ue=de.roles.get("method"),Bn=ar(Ue),Tn=Bn==="literal"?String(Ue.value):Bn==="expression"?String(Ue.raw):void 0;return Tn!==void 0&&Tn===String(ee.value)}return false}),Sn=de?.metadata?.patternId??"",Bo=!Je.has(k)||Si.test(Sn),To=Si.test(Sn);if((ue.length===1||To&&ue.length>1)&&de&&de.kind==="command"&&(de.action===k||k==="while"&&de.action==="repeat"&&/-while-head$/.test(de.metadata?.patternId??""))&&So&&Bo&&(de.roles.size>Object.entries(b).filter(([K,ee])=>!ht(K,ee)).length||[...de.roles.values()].filter(K=>!Et(K)).length>Object.entries(b).filter(([K,ee])=>!ht(K,ee)&&!Et(ee)).length))for(g=de,C=ue.slice(1);t.position()<R;)t.advance();else this.coverageRollback(ve);}}}if(!Je.has(k)){let O=g;if(oe(k)?.roles.some(q=>q.role==="quantity"&&!q.required)&&!O.roles.has("quantity")){let q=t.peek();q&&/^-?\d+(\.\d+)?$/.test(q.value)&&(g=me(k,{...Object.fromEntries(O.roles),quantity:{type:"literal",value:parseFloat(q.value),dataType:"number"}},O.metadata),t.advance());}let V=g;if(oe(k)?.roles.some(q=>q.role==="duration"&&!q.required)&&!V.roles.has("duration")){let q=/^\d+(\.\d+)?(ms|s)$/i,R=t.peek(),I=false;if(R&&R.kind==="particle"){let J=t.peek(1);J&&q.test(J.value)&&(I=true,R=J);}R&&q.test(R.value)&&(g=me(k,{...Object.fromEntries(V.roles),duration:{type:"literal",value:R.value,dataType:"string"}},V.metadata),I&&t.advance(),t.advance(),this.consumeForPostposition(t,n));}let M=g,X=oe(k);if(X?.roles.find(q=>q.role==="responseType"&&!q.required)&&!M.roles.has("responseType")){let q=ne=>typeof ne=="string"&&B.RESPONSE_TYPE_WORDS.has(ne.toLowerCase()),R=(ne,ve)=>{let ue=Object.fromEntries(M.roles);ve&&delete ue.destination,ue.responseType={type:"expression",raw:ne},g=me(k,ue,M.metadata);},I=M.roles.get("destination"),J=X?.roles.find(ne=>ne.role==="destination"),ge=I?.raw??I?.value;if(I&&J&&!J.expectedTypes.includes(I.type)&&q(ge))R(ge,true);else {let ne=t.peek();ne&&q(ne.value)&&(R(ne.value,false),t.advance());}}if(k==="wait"){let q=g;if(!q.roles.has("event")){let R=t.peek();if(R&&Re.has(R.value.toLowerCase())){let I=Object.fromEntries(q.roles),J=I.duration;J&&J.type!=="literal"&&J.type!=="expression"&&delete I.duration;let ge=I.patient;ge&&ge.type==="reference"&&ge.value==="me"&&delete I.patient,I.event={type:"literal",value:R.value,dataType:"string"},g=me(k,I,q.metadata),t.advance(),this.consumeForPostposition(t,n);}}}this.tryAttachTrailingRole(t,g,n),this.tryAttachTrailingStyle(t,g,n),this.tryAttachTrailingExpressionRole(t,g,n),this.tryAttachNewWindow(t,g);}let w=e.captured.get("continues"),D=w?.type==="literal"&&w.value==="then",x=t.peek(),z=!!x&&this.isThenKeyword(x.value,n),S=Je.has(k)&&!!x&&!this.isEndKeyword(x.value,n),L=!!x&&!this.isEndKeyword(x.value,n),P=[g,...C],$=!!x&&this.isEndKeyword(x.value,n)&&Xr(P)>0&&t.peek(1)!==null;if($&&(t.advance(),P.push(fr)),D||z||S||L||$){let O=Ee(n).filter(T=>T.command!=="on").sort((T,M)=>M.priority-T.priority),_=Ee(n).filter(T=>T.id.startsWith("grammar-")&&T.id.includes("-continuation")).sort((T,M)=>M.priority-T.priority),V=this.parseBodyWithGrammarPatterns(t,O,_,n,P);E=this.foldLoopBlocks([...P,...V]);}else E=this.foldLoopBlocks(P),t.isAtEnd()||this.recordDroppedTokens(t.tokens.slice(t.position()),n,"handler body tail");}else {let k=Ee(n).filter(g=>g.command!=="on").sort((g,C)=>C.priority-g.priority),b=h?e.roleStarts?.get("action"):void 0;if(b!==void 0&&b<t.position()){let g=new he(t.tokens.slice(b),n);for(E=this.parseBodyWithClauses(g,k,n);!t.isAtEnd();)t.advance();}else E=this.parseBodyWithClauses(t,k,n);}let y=E.length>1?[pr(E,"then",{sourceLanguage:n})]:E;return Sr(v,y,a,{sourceLanguage:n,patternId:e.pattern.id,confidence:e.confidence})}parseBodyWithClauses(e,t,n){let i=[],a=[],o=0,s=[],u=(c=0)=>{let d=Xr(i);o=d+c,s.length=0;for(let p=0;p<d;p++)s.push("loop");for(let p=0;p<c;p++)s.push("while");};for(;!e.isAtEnd();){let c=e.peek();if(!c)break;if(a.length===0){let k=this.consumeJsBlock(e,n)??this.consumeVerbFinalJsBlock(e,n);if(k){i.push(k);continue}let b=this.tryParseConditionalBlock(e,t,n);if(b){i.push(b);continue}let g=this.tryParseUnlessGuard(e,t,n);if(g){i.push(...g);continue}}let d=c.kind==="conjunction"||c.kind==="keyword"&&this.isThenAt(c,ze(e.tokens,e.position()),n),p=a[a.length-1],m=e.peek(1),f=p?.value.toLowerCase()==="at"&&m?.value.toLowerCase()==="of"||bt(n,c.value,p?.value,m?.value),v=c.kind==="keyword"&&this.isEndKeyword(c.value,n)&&!f&&!We(ze(e.tokens,e.position()),n);if((v||!f&&this.isBlockEndToken(c,ze(e.tokens,e.position()),n))&&s.every(k=>k==="loop")&&this.closeLoopAtEnd(e,a,i,t,n)){a.length=0,u();continue}if(v&&o>0){o--,s.pop(),a.push({...c,metadata:{...c.metadata,closesTrackedBlock:true}}),e.advance();continue}if(d&&s.includes("if")){a.push(c),e.advance();continue}if(d){if(a.length>0){let k=this.parseClause(a,t,n);i.push(...k),a.length=0,u(k.filter(b=>{let g=b;return g.action==="while"&&(!Array.isArray(g.body)||g.body.length===0)}).length);}e.advance();continue}if(v){e.advance();let k=[];for(;!e.isAtEnd();){let b=e.peek();if(!b||b.kind==="conjunction"||b.kind==="keyword"&&(this.isThenKeyword(b.value,n)||this.isEndKeyword(b.value,n)))break;k.push(b),e.advance();}if(k.length>0){let b=this.coverageMark(),g=a.length>0?this.parseClause(a,t,n):[];g.length===0&&a.length>0?(this.coverageRollback(b),i.push(...this.parseClause([...a,...k],t,n))):(i.push(...g),i.push(...this.parseClause(k,t,n)));}else if(a.length>0){let b=this.parseClause(a,t,n);i.push(...b);}a.length=0;break}let h=(c.normalized??c.value).toLowerCase(),y=Ft(c);if(c.kind==="keyword"||y){let k=this.isIfKeyword(h,n),b=Zr(a,a.length);(h==="for"||h==="while")&&b&&Ft(b)||k&&b&&this.isElseKeyword(b.value,n)||(y&&s[s.length-1]==="while"?s[s.length-1]="loop":(k||this.isUnlessKeyword(h,n)||h==="while"||h==="for"||y)&&(o++,s.push(k?"if":y||h==="for"?"loop":h==="while"?"while":"other")));}a.push(c),e.advance();}if(a.length>0){let c=this.parseClause(a,t,n);i.push(...c);}e.isAtEnd()||this.recordDroppedTokens(e.tokens.slice(e.position()),n,"body stream tail"),this.foldFrontedWhileIntoRepeat(i,n);for(let c=i.length-1;c>=0;c--){let d=i[c];d.kind==="command"&&d.action==="for"&&(!(d.roles instanceof Map)||d.roles.size===0)&&(!Array.isArray(d.body)||d.body.length===0)&&i.splice(c,1);}let l=this.foldLoopBlocks(i);return l.length>1?[pr(l,"then",{sourceLanguage:n})]:l}closeLoopAtEnd(e,t,n,i,a){let o=Xr(n);if(t.length===0)return o===0?false:(n.push(fr),e.advance(),true);let s=this.coverageMark(),u=this.parseClause([...t],i,a);return u.length===0||o+u.filter(qt).length===0?(this.coverageRollback(s),false):(n.push(...u,fr),e.advance(),true)}foldLoopBlocks(e){let t=[],n=[],i=o=>{(n.length>0?n[n.length-1].body:t).push(o);},a=o=>{let s=n.pop();s&&i(this.buildLoopNode(s.head,s.body,o));};for(let o of e)mn(o)?a(true):qt(o)?n.push({head:o,body:[]}):i(o);for(;n.length>0;)a(false);return t}buildLoopNode(e,t,n=false){if(t.length===0&&!n)return e;if(it.has(e.action))return {...e,body:t};let i=e.roles.get("loopType");if(i?.type==="literal"&&typeof i.value=="number"){let d=new Map(e.roles);return d.set("quantity",i),d.set("loopType",{type:"literal",value:"times"}),this.buildLoopNode({...e,roles:d},t,n)}let a=i?.type==="literal"?String(i.value):void 0,o=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",s=o==="for"?e.roles.get("patient"):void 0,u=s?Fm(s):void 0,l=new Map(e.roles),c=l.get("quantity");return (o==="while"||o==="until")&&c&&!l.has("condition")&&(l.set("condition",c),l.delete("quantity")),Tu(e.action==="for"?"for":"repeat",o,Object.fromEntries(l),t,{...u?{loopVariable:u}:{},...e.metadata?{metadata:e.metadata}:{}})}tryTopLevelLoop(e,t,n){let i=this.coverageMark(),a;try{let s=new he(e.tokens,n);a=this.parseBodyWithClauses(s,t,n);}catch{return this.coverageRollback(i),null}let[o]=a;if(a.length===1&&bi(o))return o;if(a.length===1&&o.kind==="compound"){let s=o;if(bi(s.statements[0])){let u=s.statements.map(l=>l.metadata?.confidence??.75);return pr(s.statements,s.chainType,{sourceLanguage:n,confidence:u.reduce((l,c)=>l+c,0)/u.length})}}return this.coverageRollback(i),null}tryTopLevelCommandSequence(e,t,n){let i=this.coverageMark(),a;try{let l=new he(e.tokens,n);a=this.parseBodyWithClauses(l,t,n);}catch{return this.coverageRollback(i),null}if(a.length!==1||a[0].kind!=="compound")return this.coverageRollback(i),null;let o=a[0];if(o.statements.length<2)return this.coverageRollback(i),null;let s=o.statements.map(l=>l.metadata?.confidence??.75),u=s.reduce((l,c)=>l+c,0)/s.length;return pr(o.statements,o.chainType,{sourceLanguage:n,confidence:u})}foldFrontedWhileIntoRepeat(e,t){for(let n=0;n+1<e.length;n++){let i=e[n],a=e[n+1];if(i.kind!=="command"||i.action!=="while"||a.kind!=="command"||a.action!=="repeat")continue;let o=i.roles.get("condition");if(!o||a.roles.has("condition")||Array.isArray(i.body)||Array.isArray(a.body))continue;let s=new Map(a.roles);s.set("condition",o),s.set("loopType",{type:"literal",value:"while",dataType:"string"}),e.splice(n,2,{...a,roles:s,metadata:{...a.metadata,sourceLanguage:t,patternId:`repeat-${t}-fronted-while-fold`,confidence:Math.max(a.metadata?.confidence??0,i.metadata?.confidence??0)}});}}takeRepeatCount(e,t,n){if(F(n)?.wordOrder==="SOV"){let o=B.countBeforeVerb(t,n);if(o<0)return;let s=t[o];return t.length=o,s}let i=e.mark();e.peek()?.kind==="particle"&&e.advance();let a=e.peek();if(a&&B.countsBefore(a,e.peek(1),n))return e.advance(),e.advance(),a;if(!B.isCountToken(a)){e.reset(i);return}return e.advance(),e.peek()?.kind==="identifier"&&e.advance(),a}static isCountToken(e){let t=e?.kind==="literal"?Qr(e):null;return t?.type==="literal"&&typeof t.value=="number"}static countsBefore(e,t,n){return !e||!t||!Gt[n]?.includes(t.value)?false:e.kind==="identifier"||B.isCountToken(e)}static countBeforeVerb(e,t){let n=B.isCountToken,i=e.length;return e[i-1]?.kind==="particle"&&i--,B.countsBefore(e[i-2],e[i-1],t)?i-2:(e[i-1]?.kind==="identifier"&&n(e[i-2])&&i--,n(e[i-1])?i-1:-1)}loopHeadReadsBody(e,t,n){if(F(n)?.wordOrder!=="SOV")return false;if(B.countBeforeVerb(t,n)>=0)return true;let i=e.captured.get("loopType");return i?.type==="literal"&&typeof i.value!="number"&&!Mm.has(String(i.value))}bareRepeatHead(e,t){let n=e?Qr(e):null;return me("repeat",e&&n?{loopType:Q("times"),quantity:Zi(n,{start:e.position.start,end:e.position.end})}:{},{sourceLanguage:t,confidence:.6})}parseClause(e,t,n){if(e.length===0)return [];let i=null,a=e,o=e[e.length-1];if(o&&e.length>=2){let h=(o.normalized??o.value).toLowerCase();this.isUnlessKeyword(h,n)&&(i="unless",a=e.slice(0,-1));}let s=null;if(i&&a.length>=3){let h=F(n),y=h?B.buildVerbLookup(h):null;if(y)for(let k=1;k<a.length-1;k++){let b=a[k],g=y.get(b.value.toLowerCase())??(b.normalized?y.get(b.normalized.toLowerCase()):void 0);if(g&&!B.CONDITION_OPERATORS.has(g)){s=a.slice(0,k),a=a.slice(k);break}}}let u=new he(a,n),l=[],c=this.coverageMark(),d=0,p=[],m=s,f=()=>{if(p.length===0)return;let h=p.slice();if(p.length=0,i&&l.length===0&&m===null){m=h;return}let y=h[0];if(!(y&&(y.kind==="identifier"||y.kind==="selector"||y.kind==="literal"||y.kind==="reference"))){this.recordDroppedTokens(h,n,"body clause");return}let b=false;for(let g of this.parseSOVClauseByVerbAnchoring(h,n)){let C=g.action,w=g.roles;C&&oe(C)&&w instanceof Map&&w.size>0&&(l.push(g),b=true);}b||this.recordDroppedTokens(h,n,"body clause");};for(;!u.isAtEnd();){let h=u.peek(),y=!!h&&h.normalized?.toLowerCase()==="repeat",k=u.mark(),b=Se.matchBest(u,t);if(y&&b&&(b.pattern.command!=="repeat"||this.loopHeadReadsBody(b,p,n))){u.reset(k),u.advance();let g=this.takeRepeatCount(u,p,n);f(),l.push(this.bareRepeatHead(g,n)),d++;continue}if(!b&&h&&this.isIfKeyword((h.normalized??h.value).toLowerCase(),n)){let g=this.tryParseConditionalBlock(u,t,n);if(g){f(),l.push(g),d++;continue}}if(b&&b.pattern.command==="if"){let g=u.mark(),C=p.length;for(u.reset(k);!u.isAtEnd();){let D=u.peek();if(!D||this.isIfKeyword((D.normalized??D.value).toLowerCase(),n))break;p.push(D),u.advance();}let w=this.tryParseConditionalBlock(u,t,n);if(w){f(),l.push(w),d++;continue}p.length=C,u.reset(g);}if(b){f();let g=this.buildCommand(b,n);l.push(g),d++,this.tryAttachTrailingRole(u,g,n),this.tryAttachTrailingStyle(u,g,n),this.tryAttachTrailingExpressionRole(u,g,n),this.tryAttachTrailingDuration(u,g);}else {let g=p.length===0?this.tryParsePseudoCommand(u,t,n):null;if(g){f(),l.push(g),d++;continue}let C=u.peek(),w=C?.kind==="identifier"&&C.value.toLowerCase()==="repeat";if(C&&(C.normalized?.toLowerCase()==="repeat"||w)){let D=u.mark();u.advance();let x=this.takeRepeatCount(u,p,n);if(x||!w){f(),l.push(this.bareRepeatHead(x,n)),d++;continue}u.reset(D);}C&&p.push(C),u.advance();}}f();let v=l;if(d===0){let h=this.parseSOVClauseByVerbAnchoring(a,n);h.length>0&&(this.coverageRollback(c),v=h);}let E=m;return i&&v.length>0&&E&&E.length>0?[me(i,{condition:{type:"expression",raw:this.joinTokenText(E,n)}},{sourceLanguage:n,patternId:`${i}-${n}-trailing-guard`,confidence:.85}),...v]:i&&E&&E.length>0&&v.length===0?[me(i,{condition:{type:"expression",raw:this.joinTokenText(E,n)}},{sourceLanguage:n,patternId:`${i}-${n}-trailing-guard`,confidence:.85})]:v}tryAttachTrailingDuration(e,t){let n=t.roles;if(n.has("duration")||!oe(t.action)?.roles.some(o=>o.role==="duration"&&!o.required))return;let a=e.peek();!a||!/^\d+(?:\.\d+)?(?:ms|s|m|h)$/.test(a.value)||(n.set("duration",Q(a.value,"duration")),e.advance());}tryAttachNewWindow(e,t){let n=t.roles;if(t.action!=="go"||n.has("manner"))return;let[i,a,o]=[e.peek(),e.peek(1),e.peek(2)];if(!(i?.value.toLowerCase()!=="in"||a?.value.toLowerCase()!=="new")&&!(!o||(o.normalized??o.value).toLowerCase()!=="window")){n.set("manner",Be("window"));for(let s=0;s<3;s++)e.advance();}}tryAttachTrailingRole(e,t,n){let i=oe(t.action);if(!i)return;let a=F(n);if(!a)return;let o=t.roles,s=(l,c)=>{if(!l)return false;if(l.kind==="selector")return true;let d=(l.normalized??l.value).toLowerCase();return Pt.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"},u=[{role:"source",strict:false},{role:"destination",strict:true}];for(let{role:l,strict:c}of u){if(!i.roles.some(E=>E.role===l))continue;let d=a.roleMarkers?.[l];if(!d)continue;let p=o.get(l);if(p&&!(p.type==="reference"&&p.value==="me"))continue;let m=E=>{if(!E||E.kind!=="particle"&&E.kind!=="keyword")return false;let h=E.value.toLowerCase();return d.primary?.toLowerCase()===h?true:c?false:(E.normalized??"").toLowerCase()===l?true:!!d.alternatives?.some(y=>y.toLowerCase()===h)},f=e.peek(),v=e.peek(1);if(!f||!v)return;if(c&&d.position==="after"){let E=e.peek(2),h=(f.normalized??f.value).toLowerCase();if(Pm.has(h)&&v.kind==="selector"&&m(E)){o.set(l,{type:"expression",raw:`${h} ${v.value}`}),e.advance(),e.advance(),e.advance();return}}if(d.position==="after"){if(s(f,c)&&m(v)){let E=this.tokenToSemanticValue(f);e.advance(),e.advance(),E&&o.set(l,E);return}if(c&&s(f,c)){let E=e.peek(2),h=e.peek(3);if((v.normalized??v.value).toLowerCase()==="in"&&E&&!m(E)&&m(h)){let y=this.tokenToSemanticValue(f);e.advance(),e.advance(),e.advance(),e.advance(),y&&o.set(l,y);return}}}else if(m(f)&&s(v,c)){e.advance();let E=this.tokenToSemanticValue(e.advance());E&&o.set(l,E);return}}}tryAttachTrailingStyle(e,t,n){if(t.action!=="fetch"&&t.action!=="render")return;let i=t.roles;if(!oe(t.action)?.roles.some(h=>h.role==="style"))return;let o=i.get("style");if(o){if(o.type==="expression"&&typeof o.raw=="string"&&/^[A-Za-z_][\w-]*$/.test(o.raw)&&e.peek()?.value===":"){let h=Pr(e,o.raw);h&&i.set("style",{type:"expression",raw:h});}this.tryAttachResponseTypeAfterStyle(e,t,n);return}if(t.action==="fetch"){let h=i.get("patient"),y=i.get("source");if(h&&y&&(h.type==="literal"||h.type==="expression")&&y.type==="expression"&&typeof y.raw=="string"&&/^[A-Za-z_][\w-]*$/.test(y.raw)&&e.peek()?.value===":"){let k=Pr(e,y.raw);k&&(i.set("source",{type:"expression",raw:k}),this.tryAttachResponseTypeAfterStyle(e,t,n));return}}let u=F(n)?.roleMarkers?.style;if(!u)return;if(u.position==="before"){let h=new Set([u.primary,...u.alternatives??[]].map(g=>g.toLowerCase())),y=e.peek();if(!y||!h.has(y.value.toLowerCase()))return;let k=e.mark();e.advance();let b=Pr(e);if(!b){e.reset(k);return}i.set("style",{type:"expression",raw:b}),this.tryAttachResponseTypeAfterStyle(e,t,n);return}if(u.position!=="after")return;let l=new Set([u.primary,...u.alternatives??[]].map(h=>h.toLowerCase())),c=h=>h.kind==="conjunction"||h.kind==="keyword"&&(this.isThenKeyword(h.value,n)||this.isEndKeyword(h.value,n)),d=24,p=-1,m=0;for(let h=0;h<d;h++){let y=e.peek(h);if(!y||c(y))break;if(y.value==="("||y.value==="{"?m++:(y.value===")"||y.value==="}")&&(m=Math.max(0,m-1)),m===0&&(y.kind==="particle"||y.kind==="keyword")&&l.has(y.value.toLowerCase())){p=h;break}}if(p<=0)return;let f=[];for(let h=0;h<p;h++){let y=e.peek(h);y&&f.push(y);}if(f.length===1&&B.RESPONSE_TYPE_WORDS.has(f[0].value.toLowerCase()))return;let v=new he(f,n),E=Pr(v);i.set("style",{type:"expression",raw:E&&v.isAtEnd()?E:this.joinTokenText(f,n)});for(let h=0;h<=p;h++)e.advance();this.tryAttachResponseTypeAfterStyle(e,t,n);}tryAttachResponseTypeAfterStyle(e,t,n){let i=t.roles;if(i.has("responseType")||!oe(t.action)?.roles.some(c=>c.role==="responseType"&&!c.required))return;let o=c=>!!c&&B.RESPONSE_TYPE_WORDS.has(c.toLowerCase()),s=e.peek();if(!s)return;let u=c=>{i.set("responseType",{type:"expression",raw:c});};if(B.AS_MARKERS_BEFORE[n]?.some(c=>s.value.toLowerCase()===c)){let c=e.peek(1);c&&o(c.value)&&(e.advance(),e.advance(),u(c.value));return}if(o(s.value)){e.advance(),u(s.value);for(let c of B.AS_MARKERS_AFTER[n]??[])if(c.every((d,p)=>e.peek(p)?.value.toLowerCase()===d)){for(let d=0;d<c.length;d++)e.advance();break}}}tryAttachTrailingExpressionRole(e,t,n){let i=t.action,a=i==="js"?{role:"patient",terminator:"boundary"}:i==="go"||i==="scroll"?{role:"destination",terminator:"destination-marker"}:null;if(!a)return;let o=t.roles,s=o.get(a.role);if(i==="go"&&s&&s.type==="expression"&&String(s.raw).toLowerCase()==="url"){let h=e.peek();if(h&&!Pt.has((h.normalized??h.value).toLowerCase())){let k=this.tokenToSemanticValue(h);if(k.type==="literal"||k.type==="selector"){o.set(a.role,k),o.set("method",{type:"literal",value:"url"}),e.advance();return}}let y=o.get("patient");if(y&&(y.type==="literal"||y.type==="selector")){o.set(a.role,y),o.set("method",{type:"literal",value:"url"}),o.delete("patient");return}}if(i==="go"&&s&&s.type==="expression"){let h=/^url\s+(\S+)$/i.exec(String(s.raw??""));if(h){let y=h[1].replace(/^["']|["']$/g,"");o.set(a.role,{type:"literal",value:y,dataType:"string"}),o.set("method",{type:"literal",value:"url"});return}}if(i==="go"&&!s){let h=o.get("patient");if(h&&h.type==="expression"&&String(h.raw).toLowerCase()==="url"){let y=e.peek();if(y&&!Pt.has((y.normalized??y.value).toLowerCase())){let k=this.tokenToSemanticValue(y);if(k.type==="literal"||k.type==="selector"){o.set(a.role,k),o.set("method",{type:"literal",value:"url"}),o.delete("patient"),e.advance();return}}}}if(s&&!(s.type==="reference"&&s.value==="me"))return;let u=F(n);if(!u)return;let l=null;if(a.terminator==="destination-marker"){let h=u.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,n)||this.isEndKeyword(h.value,n)),d=24,p=[],m=0,f=false;for(let h=0;h<d;h++){let y=e.peek(h);if(!y||c(y))break;if(y.value==="("||y.value==="{"?m++:(y.value===")"||y.value==="}")&&(m=Math.max(0,m-1)),l!==null&&m===0&&(y.kind==="particle"||y.kind==="keyword")&&y.value.toLowerCase()===l){f=true;break}p.push(y);}if(p.length===0||l!==null&&!f)return;let v=p.length+(f?1:0);if(i==="go"&&p.length===2&&p[0].value.toLowerCase()==="url"){let h=this.tokenToSemanticValue(p[1]);if(h.type==="literal"||h.type==="selector"){o.set(a.role,h),o.set("method",{type:"literal",value:"url"});let y=o.get("patient");y&&y.type==="reference"&&y.value==="me"&&!oe(i)?.roles.some(k=>k.role==="patient")&&o.delete("patient");for(let k=0;k<v;k++)e.advance();return}}let E=p;if(i==="js"){let h=u.keywords?.js,y=b=>[h?.primary,...h?.alternatives??[]].some(g=>!!g&&g.length>b.value.length&&g.includes(b.value)),k=0;for(;k<E.length&&y(E[k]);)k++;if(E=E.slice(k),E.length===0)return}if(o.set(a.role,{type:"expression",raw:this.joinTokenText(E,n)}),a.role!=="patient"){let h=o.get("patient");h&&h.type==="reference"&&h.value==="me"&&!oe(i)?.roles.some(y=>y.role==="patient")&&o.delete("patient");}for(let h=0;h<v;h++)e.advance();}static buildVerbLookup(e){let t=new Map;for(let[n,i]of Object.entries(e.keywords))if(!["on","if","else","when","where","while","end","then","and"].includes(n)&&(t.set(i.primary.toLowerCase(),n),i.alternatives))for(let a of i.alternatives)t.set(a.toLowerCase(),n);return t}static buildMarkerToRoleLookup(e){let t=new Map;for(let[n,i]of Object.entries(e.roleMarkers)){if(!i)continue;if((n!=="event"||!t.has(i.primary))&&t.set(i.primary,n),i.alternatives)for(let o of i.alternatives)t.has(o)||t.set(o,n);}return t}parseSOVClauseByVerbAnchoring(e,t){let n=F(t);if(!n||n.wordOrder!=="SOV")return [];let i=B.buildVerbLookup(n),a=B.buildMarkerToRoleLookup(n),o=[],s=0;for(;s<e.length;){let u=-1,l="";for(let f=s;f<e.length;f++){let v=e[f];if(a.has(v.value))continue;let E=i.get(v.value.toLowerCase()),h=v.normalized?i.get(v.normalized.toLowerCase()):void 0,y=E||h;if(y){u=f,l=y;break}}if(u===-1)break;let c=e.slice(s,u),d=e.length;for(let f=u+1;f<e.length;f++){let v=e[f];if(v.kind==="conjunction"||this.isThenKeyword(v.value,t)){d=f;break}if(f>u+1&&!a.has(v.value)&&(i.get(v.value.toLowerCase())||(v.normalized?i.get(v.normalized.toLowerCase()):void 0))){d=f;break}}let p=e.slice(u+1,d),m=this.extractRolesFromMarkedTokens(c,p,a,l,t);if(o.push(me(l,m,{sourceLanguage:t,confidence:.7})),s=d,s<e.length){let f=e[s];(f.kind==="conjunction"||this.isThenKeyword(f.value,t))&&s++;}}return o}extractRolesFromMarkedTokens(e,t,n,i,a){let o={},s=(l,c)=>{let d=this.isEndKeyword(l.value,a),p=l.kind==="keyword"&&(l.normalized??"").toLowerCase()==="end";return !d&&!p?false:l.metadata?.closesTrackedBlock===true||d?true:!(c&&c.kind==="selector")},u=l=>{let c=[];for(let d=0;d<l.length;d++){let p=l[d];if(s(p,l[d+1]))continue;let m=n.get(p.value);if(m&&p.kind==="particle"&&c.length>0){let f=this.tokensToSemanticValue(c,a);if(f){let v=this.mapRoleForCommand(m,i,o);v&&(o[v]=f);}c=[];}else c.push(p);}if(c.length>0)if(c.length===1&&/^\d+(\.\d+)?(ms|s)$/i.test(c[0].value)&&!o.duration&&oe(i)?.roles.some(p=>p.role==="duration"))o.duration={type:"literal",value:c[0].value,dataType:"string"};else {let p=this.tokensToSemanticValue(c,a);p&&(o.patient?o.destination||(o.destination=p):o.patient=p);}};return u(e),u(t),o}mapRoleForCommand(e,t,n){return t==="set"&&(e==="patient"?e="destination":e==="destination"&&(e="patient")),n[e]?e==="patient"&&!n.destination?"destination":e==="destination"&&!n.patient?"patient":e==="source"&&!n.source?"source":null:e}tokensToSemanticValue(e,t){if(e.length===0)return null;let n=e.filter(s=>s.kind!=="whitespace");if(n.length===0)return null;if(n.length>=2&&(n[0].kind==="selector"||/^[#.@*<]/.test(n[0].value))){let s=n.findIndex((u,l)=>l>0&&(u.normalized??u.value).toLowerCase()==="in");s>0&&(n=n.slice(0,s));}if(n.length===1)return this.tokenToSemanticValue(n[0]);let i=this.joinTokenText(n,t);if(Da(i))return {type:"expression",raw:i};let a=n.map(s=>s.value).join(""),o=n[0];return o.kind==="selector"||o.value.startsWith("#")||o.value.startsWith(".")||o.value.startsWith("@")||o.value.startsWith("*")?_e(a):o.kind==="literal"||o.value.startsWith('"')||o.value.startsWith("'")?Q($m(a),"string"):o.kind==="reference"?Be(a):Q(i)}tokenToSemanticValue(e){return Qr(e)??Q(e.value)}parseBodyWithGrammarPatterns(e,t,n,i,a=[]){let o=[],s=()=>Xr([...a,...o]),u=[],l=false,c=()=>{if(!l&&u.length>0){let m=this.parseSOVClauseByVerbAnchoring(u,i);o.push(...m),m.length===0&&this.recordDroppedTokens(u,i,"fused body walk");}else u.length>0&&this.recordDroppedTokens(u,i,"fused body walk");u=[],l=false;},d=0,p=()=>o.filter(m=>{let f=m;return f.action==="while"&&(!Array.isArray(f.body)||f.body.length===0)}).length-d;for(;!e.isAtEnd();){let m=e.peek();if(m&&this.isThenKeyword(m.value,i)){c(),e.advance();continue}if(m&&s()>0&&!this.isEndKeyword(m.value,i)&&this.isBlockEndToken(m,ze(e.tokens,e.position()),i)&&!bt(i,m.value,e.peek(-1)?.value,e.peek(1)?.value)){c(),o.push(fr),e.advance();continue}if(m&&this.isEndKeyword(m.value,i)){let v=e.peek(-1),E=e.peek(1);if(!bt(i,m.value,v?.value,E?.value)){if(c(),s()>0){o.push(fr),e.advance();continue}if(p()>0){d++,e.advance();continue}e.advance();break}}if(m&&!l&&this.isIfKeyword((m.normalized??m.value).toLowerCase(),i)){c();let v=this.tryParseConditionalBlock(e,t,i);if(v){o.push(v),l=true;continue}}let f=false;if(n.length>0){let v=Se.matchBest(e,n);if(v){let E=v.pattern.command,h={};for(let[b,g]of v.captured)b!=="event"&&b!=="action"&&b!=="continues"&&(h[b]=g);let y=me(E,h,{sourceLanguage:i,patternId:v.pattern.id});o.push(y),f=true,l=true;let k=v.captured.get("continues");if(k&&k.type==="literal"&&k.value==="then")continue}}if(!f){let v=e.mark(),E=Se.matchBest(e,t);if(E){if(E.pattern.command==="if"){let y=e.mark();for(e.reset(v);!e.isAtEnd();){let b=e.peek();if(!b||this.isIfKeyword((b.normalized??b.value).toLowerCase(),i))break;e.advance();}let k=this.tryParseConditionalBlock(e,t,i);if(k){c(),o.push(k),l=true;continue}e.reset(y);}let h=this.buildCommand(E,i);o.push(h),this.tryAttachTrailingRole(e,h,i),f=true,l=true;}}f||(m&&u.push(m),e.advance());}c(),e.isAtEnd()||this.recordDroppedTokens(e.tokens.slice(e.position()),i,"fused body walk");for(let m=o.length-1;m>=0;m--){let f=o[m];f.kind==="command"&&f.action==="for"&&(!(f.roles instanceof Map)||f.roles.size===0)&&(!Array.isArray(f.body)||f.body.length===0)&&o.splice(m,1);}return o}tryCompoundCommandParsing(e,t,n){let i=e.tokens,a=i.some(c=>c.kind==="conjunction"||c.kind==="keyword"&&this.isThenKeyword(c.value,n)),o=i.some(c=>this.isElseKeyword(c.value,n));if(!a&&!o)return null;let s=new he(i,n),u=this.coverageMark(),l=this.parseBodyWithClauses(s,t,n);return l.length===0?(this.coverageRollback(u),null):l[0]}static isEnEventKeyword(e){if(typeof e!="string")return false;let t=e.toLowerCase(),n=B.enEventKeywordCache.get(t);if(n!==void 0)return n;let i=false;try{let a=Y(t,"en").tokens;i=a.length===1&&a[0]?.kind==="keyword";}catch{i=false;}return B.enEventKeywordCache.set(t,i),i}matchEventMarkerPhrase(e,t,n){let i=B.SOV_EVENT_MARKER_PHRASES[n];if(!i)return 0;for(let a of i)if(a.every((o,s)=>e[t+s]?.value===o))return a.length;return 0}hasSOVEventMarkerHead(e,t){let n=B.SOV_EVENT_MARKERS[t];if(n===void 0)return false;let{tokens:i}=Y(e,t),a=be[t],o=new Set;if(a)for(let s of Object.keys(a))o.add(s.toLowerCase());for(let s=0;s<i.length;s++){let u=i[s],l=u.value.toLowerCase(),c=u.normalized?.toLowerCase();if(!(!!c&&(B.KNOWN_EVENTS.has(c)||Re.has(c))||B.KNOWN_EVENTS.has(l)||Re.has(l)||o.has(l)))continue;let p=this.matchEventParamPhrase(i,s+1).len,m=i[s+1+p];if(m&&(m.kind==="particle"||m.kind==="keyword")&&n.has(m.value)||this.matchEventMarkerPhrase(i,s+1+p,t)>0)return true}return false}tryScrollModifiers(e,t,n){let i=m=>m?.value.toLowerCase()??"",a=-1,o=-1;for(let m=0;m<e.length&&a<0;m++){let f=i(e[m])==="the"?m+1:m;Ci.has(i(e[f]))&&(Ci.has(i(e[f+1]))&&f++,!(i(e[f+1])!=="of"||!e[f+2])&&(a=m,o=f+1));}let s=a<0?e.findIndex(m=>Rm.has(i(m))):-1;if(a<0&&s<0)return null;let u=a>=0?a:s,l=a>=0?o:s,c=t.slice(0,e[u].position.start).trimEnd(),d=t.slice(e[l].position.end).trimStart(),p=c?c.length+1:0;try{let m=this.parse(c?`${c} ${d}`:d,n),f=[],v=y=>{if(!y)return;y.kind==="command"&&(y.action==="go"||y.action==="scroll")&&f.push(y);let k=y;for(let b of Br){let g=k[b];Array.isArray(g)&&g.forEach(C=>v(C));}};v(m??void 0);let E=y=>y.roles.get("destination")?.position?.start??-1,h=y=>f.filter(k=>E(k)>=0&&E(k)<=y).reduce((k,b)=>!k||E(b)>E(k)?b:k,void 0);if(!m)return null;if(a>=0){let y=h(p),k=y?.roles.get("destination"),b=e[o+1];if(!y||!k||!Lm(k,b))return null;let g=e.slice(a,o).map(C=>C.value.toLowerCase());y.scrollPosition=g.join(" ");}else {let y=h(e[s].position.start-1);if(!y)return null;y.scrollBehavior=i(e[s]);}return m}catch{return null}}tryDoNotThrow(e,t,n){let i=u=>u?.value.toLowerCase(),a=e.findIndex((u,l)=>i(u)==="do"&&i(e[l+1])==="not"&&i(e[l+2])==="throw");if(a<0)return null;let o=e[a].position.start,s=(t.slice(0,e[a].position.start).trimEnd()+" "+t.slice(e[a+2].position.end).trimStart()).trim();try{let u=this.parse(s,n),l=[],c=m=>{if(!m)return;m.kind==="command"&&m.action==="fetch"&&l.push(m);let f=m;for(let v of Br){let E=f[v];Array.isArray(E)&&E.forEach(h=>c(h));}};c(u??void 0);let d=m=>m.roles.get("source")?.position?.start??-1,p=l.filter(m=>d(m)>=0&&d(m)<o).reduce((m,f)=>!m||d(f)>d(m)?f:m,void 0);return !u||!p?null:(p.doNotThrow=!0,u)}catch{return null}}tryTellTo(e,t,n){let i=u=>(u.normalized??u.value).toLowerCase()==="tell",a=e.findIndex(i);if(a<0)return null;let o=F(n)?.roleMarkers?.destination,s=new Set([o?.primary,...o?.alternatives??[]].filter(u=>!!u));for(let u=a+1;u<e.length;u++){if(e[u].value.toLowerCase()!=="to")continue;let l=e[u].position.start,c=(t.slice(0,l).trimEnd()+" "+t.slice(e[u].position.end).trimStart()).trim();try{let d=this.parse(c,n);if(!d)continue;let p=[],m=y=>{if(!y)return;y.kind==="command"&&p.push(y);let k=y;for(let b of Br){let g=k[b];Array.isArray(g)&&g.forEach(C=>m(C));}};m(d);let f=y=>y.roles.get("destination")?.position?.start??-1,v=p.filter(y=>y.action==="tell"&&f(y)>=0&&f(y)<l).reduce((y,k)=>!y||f(k)>f(y)?k:y,void 0);if(!v)continue;let E=v.roles.get("destination")?.position?.end??-1;if(E<0||!e.filter(y=>y.position.start>=E&&y.position.start<l).every(y=>i(y)||s.has(y.value)))continue;return d}catch{continue}}return null}tryLoopIndex(e,t,n){let i=l=>l?.value.toLowerCase(),a=new Set;for(let l of Ee(n))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 o=l=>a.has(l.value.toLowerCase()),s=F(n)?.roleMarkers?.style?.primary?.toLowerCase(),u=l=>i(l)==="with"||!!s&&i(l)===s;for(let l=0;l+1<e.length;l++){let c=u(e[l])&&i(e[l+1])==="index",d=i(e[l])==="index";if(!c&&!d)continue;let p=e[l].position.start,m=(t.slice(0,p).trimEnd()+" "+t.slice(e[l+1].position.end).trimStart()).trim();try{let f=this.parse(m,n);if(!f)continue;let v=[],E=w=>{if(!w)return;w.kind==="loop"&&v.push(w);let D=w;for(let x of Br){let z=D[x];Array.isArray(z)&&z.forEach(A=>E(A));}};E(f);let h=w=>Math.max(-1,...[...w.roles.values()].map(D=>D.position?.end??-1).filter(D=>D<=p)),y=v.filter(w=>h(w)>=0).reduce((w,D)=>!w||h(D)>h(w)?D:w,void 0);if(!y)continue;let k=e.filter(w=>w.position.start>=h(y)&&w.position.start<p),b=y.roles.get("quantity"),g=b?.type==="literal"&&typeof b.value=="number"?b.position?.end:void 0,C=g===void 0?void 0:e.find(w=>w.position.start>=g);if(!k.every(w=>w===C||o(w)))continue;return y.indexVariable=c?"index":e[l+1].value,f}catch{continue}}return null}tryWaitAlternatives(e,t,n){let i=y=>!!y&&(y.normalized??y.value).toLowerCase()==="wait";if(!e.some(y=>i(y)))return null;let a=y=>(y.normalized??y.value).toLowerCase(),o=y=>{if(!y)return;let k=w=>B.KNOWN_EVENTS.has(w)||Re.has(w),b=y.kind==="identifier"?y.value.toLowerCase():a(y);if(k(b))return b;let g=be[n]?.[y.value];if(g)return g;let C=Hi(y.value,n);return k(C)?C:void 0},s=y=>!!y&&/^\d+(?:\.\d+)?(?:ms|s)$/.test(y.value),u=F(n)?.roleMarkers?.source,l=new Set([u?.primary,...u?.alternatives??[]].filter(Boolean).map(y=>y.toLowerCase())),c=y=>!!y&&((y.normalized??"")==="source"||l.has(y.value.toLowerCase())),d=u?.position!=="after",p=F(n)?.wordOrder==="SOV",m=(y,k)=>p?i(e[k])||e[k]?.kind==="particle"&&i(e[k+1]):i(e[y-1])||i(e[y-2]),f=y=>d?c(e[y])&&!!e[y+1]:!!e[y]&&c(e[y+1]),v=y=>!!y&&(y.kind==="identifier"||y.kind==="keyword"&&(Ar(y)??"event")==="event")&&/^[\p{L}_$][\p{L}\p{M}\p{N}_$:-]*$/u.test(y.value),E=y=>{for(;Or(e[y]??{value:""},n)&&e[y+1];)y+=2;return f(y)},h=y=>{let k=o(e[y]);return k||(v(e[y])&&(e[y-1]?.value.toLowerCase()==="for"&&i(e[y-2])||E(y+1))?e[y].value:void 0)};for(let y=0;y<e.length;y++){let k=h(y);if(!k)continue;let b=[],g=y+1,C=this.matchEventParamPhrase(e,g);b.push(C.names.length>0?{event:k,params:C.names}:{event:k});let w=g+C.len;for(;Or(e[w]??{value:""},n);){let T=e[w+1],M=o(T)??(v(T)?T.value:void 0);if(M){let X=w+2,te=this.matchEventParamPhrase(e,X);b.push(te.names.length>0?{event:M,params:te.names}:{event:M}),w=X+te.len;}else if(s(T))b.push({duration:T.value}),w+=2;else break}let D=w,x,z;if(d&&c(e[w])&&e[w+1]?(x=[w,w+1],z=e[w+1]):!d&&e[w]&&c(e[w+1])&&(x=[w,w+1],z=e[w]),!(b.length>1||C.names.length>0||!!x))continue;let S=x?x[1]+1:D;if(!m(y,S))continue;let L=[];D>g&&L.push([e[g-1].position.end,e[D-1].position.end]),x&&L.push([e[x[0]].position.start,e[x[1]].position.end]),L.sort((T,M)=>T[0]-M[0]);let P="",$=0;for(let[T,M]of L)P+=t.slice($,T)+" ",$=M;P=(P+t.slice($)).replace(/\s+/g," ").trim();let O=b[0],_=O.event.toLowerCase(),V=0;for(let T=0;T<y;T++)h(T)?.toLowerCase()===_&&m(T,T+1)&&V++;try{let T=this.parse(P,n),M=[],X=R=>{if(!R)return;let I=R.roles?.get("event")??R.roles?.get("duration"),J=I?.type==="expression"?I.raw:I&&"value"in I?String(I.value):void 0;R.kind==="command"&&R.action==="wait"&&J?.toLowerCase()===_&&M.push(R);let ge=R;for(let ne of Br){let ve=ge[ne];Array.isArray(ve)&&ve.forEach(ue=>X(ue));}};X(T??void 0);let te=M[V];if(!T||!te)continue;let q=te.roles;return q.has("event")||(q.delete("duration"),q.set("event",{type:"literal",value:O.event,dataType:"string"})),te.waitAlternatives=b,z&&(te.waitSource=Nm(z)),T}catch{}}return null}isBodyCommandWord(e,t){let n=(e.normalized??e.value).toLowerCase();return e.kind==="keyword"&&t.has(n)&&!B.KNOWN_EVENTS.has(n)&&!Re.has(n)}matchEventParamPhrase(e,t){if(e[t]?.value!=="(")return {len:0,names:[]};let n=[];for(let i=t+1;i<e.length;i++){let a=e[i].value;if(a===")")return e[t-1]?.position?.end!==e[t]?.position?.start&&e[i+1]?.kind==="particle"?{len:0,names:[]}:{len:i-t+1,names:n};if(a===",")continue;let o=e[i].kind;if(o!=="identifier"&&o!=="keyword"||!/^[A-Za-z_$][\w$]*$/.test(a))break;let s=(e[i].normalized??a).toLowerCase();if(o==="keyword"&&Om.has(s))break;n.push(a);}return {len:0,names:[]}}isStrippableSourceRef(e,t){if(!e)return false;let n=e.normalized?.toLowerCase();if(e.kind==="keyword"&&(n==="me"||n==="i"||n==="it"))return true;let i=e.value.toLowerCase();return t.has(i)||!!n&&t.has(n)}tryTrailingEventExtraction(e,t,n){let i=Y(e,t).tokens;if(i.length<3)return null;let a=be[t],o=new Set;if(a)for(let b of Object.keys(a))o.add(b.toLowerCase());let s=i.length-2,u=i[s];if(!(u.kind==="keyword"&&u.normalized?.toLowerCase()==="on"))return null;let c=i[i.length-1],d=c.value.toLowerCase(),p=c.normalized?.toLowerCase();if(!(!!p&&B.KNOWN_EVENTS.has(p)||B.KNOWN_EVENTS.has(d)||o.has(d)))return null;let f=p&&B.KNOWN_EVENTS.has(p)?p:a?.[d]??d,v=i.slice(0,s);if(v.length===0)return null;let E=n.filter(b=>b.command!=="on"),h=new he(v,t),y=this.coverageMark(),k=this.parseBodyWithClauses(h,E,t);return k.length===0?(this.coverageRollback(y),null):Sr({type:"literal",value:f},k,void 0,{sourceLanguage:t,confidence:.75})}tryMidStreamEventExtraction(e,t,n){let i=Y(e,t).tokens;if(i.length<3)return null;let a=be[t],o=new Set;if(a)for(let s of Object.keys(a))o.add(s.toLowerCase());for(let s=0;s<i.length-1;s++){let u=i[s];if(!(u.kind==="keyword"&&u.normalized?.toLowerCase()==="on"))continue;let c=i[s+1],d=c.value.toLowerCase(),p=c.normalized?.toLowerCase();if(!(!!p&&B.KNOWN_EVENTS.has(p)||B.KNOWN_EVENTS.has(d)||o.has(d)))continue;let f=p&&B.KNOWN_EVENTS.has(p)?p:a?.[d]??d,v=i.filter((b,g)=>g!==s&&g!==s+1);if(v.length===0)return null;let E=n.filter(b=>b.command!=="on"),h=new he(v,t),y=this.coverageMark(),k=this.parseBodyWithClauses(h,E,t);return k.length===0?(this.coverageRollback(y),null):Sr({type:"literal",value:f},k,void 0,{sourceLanguage:t,confidence:.75})}return null}trySOVEventExtraction(e,t,n){let i=B.SOV_EVENT_MARKERS[t];if(!i)return null;let o=Y(e,t).tokens,s=be[t],u=new Set;if(s)for(let C of Object.keys(s))u.add(C.toLowerCase());let l=B.SOV_SOURCE_MARKERS[t],c=-1,d="",p="",m=1,f=[];for(let C=0;C<o.length;C++){let w=o[C],D=w.value.toLowerCase(),x=D,z="",A=D.indexOf("[");A>0&&(x=D.slice(0,A),z=w.value.slice(A));let S=w.normalized?.toLowerCase(),L=S&&(B.KNOWN_EVENTS.has(S)||Re.has(S)),P=u.has(D)||u.has(x),$=B.KNOWN_EVENTS.has(x)||Re.has(x);if(L||P||$){let O=o[C-1];if(O&&(O.normalized??O.value).toLowerCase()==="event")continue;let _;L?_=S:P?_=s?.[D]??s?.[x]??x:_=x;let V=this.matchEventParamPhrase(o,C+1);if(i.size>0){let T=1+V.len,M=o[C+T];M&&M.kind==="selector"&&M.value.startsWith("[")&&(T+=1);let X=o[C+T];if(X&&(X.kind==="particle"||X.kind==="keyword")&&i.has(X.value)){c=C,d=_,p=z||(T===V.len+2?o[C+T-1].value:""),m=T+1,f=V.names;break}}else {c=C,d=_,p=z,m=1+V.len+this.matchEventMarkerPhrase(o,C+1+V.len,t),f=V.names;break}}}if(c===-1){let C=new Set(n.filter(w=>w.command!=="on").map(w=>w.command));for(let w=0;w<o.length;w++){let D=o[w];if(D.kind==="identifier"&&!D.value.startsWith("`")&&jm.test(D.value))if(i.size>0){let x=1,z=o[w+1];z&&z.kind==="selector"&&z.value.startsWith("[")&&(x=2);let A=o[w+x];if(A&&(A.kind==="particle"||A.kind==="keyword")&&i.has(A.value)){c=w,d=D.value,p=x===2?o[w+1].value:"",m=x+1;break}}else {let x=this.matchEventMarkerPhrase(o,w+1,t);if(x>0){c=w,d=D.value,p="",m=1+x;break}let z=o[w+1];if(z&&z.kind==="keyword"&&z.normalized!=null&&C.has(z.normalized)){c=w,d=D.value,p="",m=1;break}}}}if(c===-1)return null;let v=new Set;for(let C=c;C<c+m;C++)v.add(C);if(l){let C=c+m;if(C<o.length){let w=o[C];if((w.kind==="particle"||w.kind==="keyword")&&l.markers.has(w.value))v.add(C);else if(this.isStrippableSourceRef(w,l.windowTokens)){let D=o[C+1];D&&(D.kind==="particle"||D.kind==="keyword")&&l.markers.has(D.value)&&(v.add(C),v.add(C+1));}}if(c>=2){let w=o[c-1];(w.kind==="particle"||w.kind==="keyword")&&l.markers.has(w.value)&&this.isStrippableSourceRef(o[c-2],l.windowTokens)&&(v.add(c-2),v.add(c-1));}for(let w=0;w<c;w++){let D=o[w],x=D.value.toLowerCase(),z=D.normalized?.toLowerCase();if(l.windowTokens.has(x)||z&&l.windowTokens.has(z)){v.add(w);break}}}let E=o.filter((C,w)=>!v.has(w));if(E.length===0)return null;let h=n.filter(C=>C.command!=="on"),y=new he(E,t),k=this.coverageMark(),b=this.parseBodyWithClauses(y,h,t);if(b.length===0)return this.coverageRollback(k),null;let g={sourceLanguage:t,confidence:.75};return p&&(g.keyFilter=p),Sr(B.isEnEventKeyword(d)?{type:"literal",value:d}:{type:"expression",raw:d},b,void 0,g,f)}profileKeywordMatches(e,t,n){let i=F(e)?.keywords?.[t];return i?i.primary?.toLowerCase()===n?true:!!i.alternatives?.some(a=>a.toLowerCase()===n):false}consumeForPostposition(e,t){let n=e.peek();if(!n)return;let i=(n.normalized??"").toLowerCase(),a=F(t)?.keywords?.for;(i==="for"||n.value===a?.primary||(a?.alternatives??[]).includes(n.value))&&e.advance();}isThenAt(e,t,n){return this.isThenKeyword(e.value,n)?!(this.isEndKeyword(e.value,n)&&We(t,n)):false}isThenKeyword(e,t){let n=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(n):n==="then"||this.profileKeywordMatches(t,"then",n)}isElseKeyword(e,t){let n=e.toLowerCase();return n==="else"?true:this.profileKeywordMatches(t,"else",n)}isEndKeyword(e,t){let n=e.toLowerCase(),i=Kd(t);return i?n==="end"||i.has(n):n==="end"||this.profileKeywordMatches(t,"end",n)}isJsKeyword(e){let t=(e.normalized??e.value).toLowerCase();return t==="js"||this.profileKeywordMatches("en","js",t)}isPatientMarker(e,t){let n=F(t)?.roleMarkers?.patient;if(!n?.primary)return false;let i=e.value.toLowerCase();return n.primary.toLowerCase()===i?true:!!n.alternatives?.some(a=>a.toLowerCase()===i)}isJsBlockTerminator(e,t){return this.isEndKeyword(e,t)||this.profileKeywordMatches(t,"end",e.toLowerCase())}consumeVerbFinalJsBlock(e,t){let n=e.mark(),i=0,a=-1;for(;;){let c=e.peek(i);if(!c||this.isThenKeyword(c.value,t)||this.isJsBlockTerminator(c.value,t))break;if(this.isJsKeyword(c)){let d=e.peek(i+1),p=!!d&&c.position?.end!==void 0&&c.position.end===d.position?.start&&this.profileKeywordMatches(t,"js",`${c.value}${d.value}`.toLowerCase()),m=e.peek(i+(p?2:1));if(i>0&&m&&this.isJsBlockTerminator(m.value,t)){a=i;break}}i++;}if(a<=0)return null;let o=[];for(let c=0;c<a;c++){let d=e.peek(c);d&&o.push(d);}let s=o[o.length-1];if(s&&this.isPatientMarker(s,t)&&o.pop(),o.length===0)return e.reset(n),null;let u=this.rawJsBody(o);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(),me("js",{patient:{type:"expression",raw:u||"()"}},{sourceLanguage:t,patternId:`js-opaque-final-${t}`,confidence:1})}consumeJsBlock(e,t){let n=e.peek();if(!n||!this.isJsKeyword(n))return null;let i=e.mark(),a=[];e.advance();let o=e.peek();o&&n.position?.end!==void 0&&n.position.end===o.position?.start&&this.profileKeywordMatches(t,"js",`${n.value}${o.value}`.toLowerCase())&&e.advance();let s=e.peek();s&&this.isPatientMarker(s,t)&&e.advance();let u=false;for(;!e.isAtEnd();){let c=e.peek();if(!c)break;if(e.advance(),this.isJsBlockTerminator(c.value,t)){u=true;break}a.push(c);}if(!u)return e.reset(i),null;let l=this.rawJsBody(a);return me("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,n=e[e.length-1].position?.end,i=this.positionSource;if(i!==void 0&&t!==void 0&&n!==void 0){let o=i.slice(t,n),s=u=>u.replace(/\s+/g,"");if(s(o)===s(e.map(u=>u.value).join("")))return o.trim()}let a="";for(let o=0;o<e.length;o++){let s=e[o-1],u=s?.position?.end!==void 0&&e[o].position?.start===s.position.end;o>0&&!u&&(a+=" "),a+=e[o].value;}return a.trim()}isIfKeyword(e,t){let n=e.toLowerCase();return n==="if"?true:this.profileKeywordMatches(t,"if",n)}isUnlessKeyword(e,t){let n=e.toLowerCase();return n==="unless"?true:this.profileKeywordMatches(t,"unless",n)}tryParseUnlessGuard(e,t,n){let i=e.peek();if(!i||!this.isUnlessKeyword((i.normalized??i.value).toLowerCase(),n))return null;let a=e.mark(),o=this.tryParseConditionalBlock(e,t,n,true);if(!o||o.kind!=="conditional")return e.reset(a),null;let s=o;if(s.elseBranch&&s.elseBranch.length>0)return e.reset(a),null;let u=s.roles.get("condition");return u?[me("unless",{condition:u},{sourceLanguage:n,patternId:`unless-${n}-guard`,confidence:1}),...s.thenBranch]:(e.reset(a),null)}isBlockEndToken(e,t,n){let i=t.next;return (this.isEndKeyword(e.value,n)||e.kind==="keyword"&&(e.normalized??"").toLowerCase()==="end"&&!(i&&i.kind==="selector"))&&!We(t,n)}opensNestedBlock(e,t,n){let i=(e.normalized??e.value).toLowerCase();return this.isIfKeyword(i,n)?!(t&&this.isElseKeyword(t.value,n)):this.isUnlessKeyword(i,n)?true:i==="repeat"?e.kind==="keyword"||e.kind==="identifier":i!=="for"||e.kind!=="keyword"?false:!(t&&Ft(t))}tryParseConditionalBlock(e,t,n,i=false){let a=e.peek();if(!a)return null;let o=(a.normalized??a.value).toLowerCase();if(!this.isIfKeyword(o,n)&&!(i&&this.isUnlessKeyword(o,n)))return null;let s=e.mark(),u=this.coverageMark();e.advance();let l=e.tokens,c=e.position(),d=[],p=0;for(;!e.isAtEnd();){let z=e.peek();if(!z)break;if(d.length>0&&this.opensNestedBlock(z,Zr(d,d.length),n)){p++,d.push(z),e.advance();continue}if(this.isBlockEndToken(z,ze(e.tokens,e.position()),n)){if(p===0){e.advance();break}p--,d.push(z),e.advance();continue}d.push(z),e.advance();}if(d.length===0)return e.reset(s),this.coverageRollback(u),null;let m=F(n),f=m?.wordOrder==="SOV"?B.buildVerbLookup(m):null,v=0,E=0,h=[];for(;v<d.length;v++){let z=d[v],A=(z.normalized??z.value).toLowerCase();if(v>0&&(this.isIfKeyword(A,n)||this.isUnlessKeyword(A,n))?E++:this.isBlockEndToken(z,ze(l,c+v),n)&&E--,E===0&&this.isThenAt(z,ze(l,c+v),n)){v++;break}if(E===0&&h.length>0){let S=(z.normalized??z.value).toLowerCase(),L=Rp(d[v-1],z,h.length===1,n),P=f!==null&&f.has(z.value.toLowerCase())&&!xa.has(S),$=/^\.[a-zA-Z_]\w*$/.test(z.value)&&d[v-1].position?.end!==void 0&&z.position?.start!==void 0&&d[v-1].position.end===z.position.start;if(!B.CONDITION_OPERATORS.has(S)&&!$&&(!L||P)&&(this.tokensBeginCommand(d.slice(v),t,n)||this.sovCommandStartsAt(d.slice(v),f)))break}h.push(z);}if(h.length===0)return e.reset(s),this.coverageRollback(u),null;let k=[],b=[],g=false,C=0;for(;v<d.length;v++){let z=d[v];if(this.opensNestedBlock(z,Zr(d,v),n)?C++:this.isBlockEndToken(z,ze(l,c+v),n)&&C--,C===0&&!g&&this.isElseKeyword(z.value,n)){g=true;continue}(g?b:k).push(z);}let w={type:"expression",raw:this.joinTokenText(h,n)},D=this.parseBranch(k,t,n),x=b.length>0?this.parseBranch(b,t,n):void 0;return D.length===0&&(!x||x.length===0)?(e.reset(s),this.coverageRollback(u),null):Bu(w,D,x,{sourceLanguage:n,patternId:`conditional-${n}-folded`,confidence:1})}joinTokenText(e,t){return Le(e,F(t))}tokensBeginCommand(e,t,n){if(e.length===0)return false;let i=new he(e,n);return Se.matchBest(i,t)!==null}sovCommandStartsAt(e,t){if(!t)return false;let n=s=>t.has(s.value.toLowerCase())||!!s.normalized&&t.has(s.normalized.toLowerCase()),i=s=>s.kind==="identifier"||s.kind==="selector"||s.kind==="literal"||s.kind==="reference",a=0,o=0;for(;a+1<e.length;){let s=e[a],u=e[a+1];if(!i(s)||u.kind!=="particle")break;o+=1,a+=2;let l=e[a];if(o>=1&&l&&n(l))return true}return false}parseBranch(e,t,n){if(e.length===0)return [];let i=new he(e,n),a=this.parseBodyWithClauses(i,t,n);return a.length===1&&a[0]?.kind==="compound"?a[0].statements:a}extractStandaloneModifiers(e,t){let i=Y(e,t).tokens;if(i.length===0)return {modifiers:null,remainingInput:null};let o=i[0].value.toLowerCase(),s=v=>i[v]?.value.toLowerCase(),u=v=>!!i[v]&&i[v].kind!=="selector";if(o==="on"&&s(1)==="first"&&i.length>2)return {modifiers:{once:true,onceAsFirst:true},remainingInput:e.slice(0,i[1].position.start)+e.slice(i[2].position.start)};if(o==="first"&&u(1))return {modifiers:{once:true,onceAsFirst:true},remainingInput:e.slice(i[1].position.start)};let l=B.STANDALONE_MODIFIERS[o];if(!l)return {modifiers:null,remainingInput:null};let c={},d=1;if(l==="once")c.once=true;else {let v=1;if(v<i.length){let E=i[v],h=i[v+1],y=E.kind==="identifier"&&h?.kind==="literal"&&/^\d+(ms|s|m)?$/.test(h.value);(E.kind==="keyword"||E.kind==="particle"||y)&&(v++,d++);}if(v<i.length){let E=i[v];if(E.kind==="literal"){let h=E.value.match(/^(\d+)(ms|s|m)?$/);if(h){let y=parseInt(h[1],10),k=h[2]||"ms";k==="s"?y*=1e3:k==="m"&&(y*=6e4),c[l]=y,d=v+1;}}}c[l]||(c[l]=l==="debounce"?300:100);}let p=i.slice(d);if(p.length===0)return {modifiers:null,remainingInput:null};let m=p[0].position.start,f=e.slice(m);return {modifiers:c,remainingInput:f}}stripAsyncModifier(e,t){let n=F(t)?.keywords?.async,i=new Set(["async"]);n?.primary&&i.add(n.primary.toLowerCase()),n?.alternatives?.forEach(l=>i.add(l.toLowerCase()));let a=Y(e,t).tokens,o=a.findIndex(l=>i.has(l.value.toLowerCase()));if(o===-1)return {remainingInput:null};let s=a[o],u=(e.slice(0,s.position.start)+e.slice(s.position.end)).replace(/\s{2,}/g," ").trim();return u.length===0?{remainingInput:null}:{remainingInput:u}}stripDoNotThrowModifier(e,t){let n=Y(e,t).tokens;for(let i=0;i<n.length-1;i++){if(n[i].value.toLowerCase()!=="do")continue;let a=-1;for(let l=i+1;l<=i+5&&l<n.length;l++){let c=n[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 o=n[i].position.start,s=n[a].position.end,u=(e.slice(0,o)+e.slice(s)).replace(/\s{2,}/g," ").trim();return u.length===0?{remainingInput:null}:{remainingInput:u}}return {remainingInput:null}}static droppedTokenCount(e){return (e.diagnostics??[]).filter(t=>t.code==="unconsumed-input").reduce((t,n)=>t+(parseInt(/left (\d+) token/.exec(n.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(n=>{if(n.code!=="unconsumed-input")return true;let i=/unconsumed: "(.*)"$/.exec(n.message)?.[1];return !i||i.replace(/\s+/g," ").trim()!==t})}}static sourceNounValue(e){if(e.kind==="selector")return _e(e.value);let t=(e.normalized??e.value).toLowerCase();return Ne(t)?{type:"reference",value:t}:{type:"literal",value:e.value,dataType:"string"}}reclaimDanglingFromTail(e,t,n){let i=B.droppedTokenCount,a=B.unconsumedSpans(e);if(a.length===0)return null;let o=i(e),s=F(n)?.roleMarkers?.source,u=new Set;s?.primary&&u.add(s.primary),s?.alternatives?.forEach(c=>u.add(c));let l=Y(t,n).tokens;for(let c=0;c<l.length;c++){let d=l[c];if(d.normalized!=="source"&&!u.has(d.value))continue;let p=s?.position==="after"?c-1:c+1,m=l[p];if(!m||m.kind!=="identifier"&&m.kind!=="keyword")continue;let f=Math.min(d.position.start,m.position.start),v=Math.max(d.position.end,m.position.end),E=t.slice(f,v).replace(/\s+/g," ").trim();if(!a.some(y=>y===E||y.includes(E)))continue;let h=(t.slice(0,f).trimEnd()+" "+t.slice(v).trimStart()).trim();if(!(!h||h===t))try{let y=this.parse(h,n);if(!y||y.kind!=="event-handler")continue;let k=Jr(y);if(i(k)<o)return {node:{...k,eventModifiers:{...k.eventModifiers,from:B.sourceNounValue(m)}},input:h}}catch{}}return null}reclaimEventCompoundTail(e,t,n){let i=B.unconsumedSpans(e);if(i.length===0)return null;let a=be[n];if(!a)return null;let o=e.roles,s=o.get("event"),u=s?.type==="literal"&&typeof s.value=="string"?s.value:null;if(!u)return null;let l=d=>d.replace(/\s+/g," ").trim(),c=Y(t,n).tokens;for(let d of i)for(let p=1;p<c.length;p++)for(let m=p;m<c.length;m++){let f=l(t.slice(c[p].position.start,c[m].position.end));if(f.length>d.length)break;if(f!==d)continue;let v=c[p-1];if((a[v.value]??v.normalized)!==u)break;let h=l(t.slice(v.position.start,c[m].position.end)),y=a[h];if(!y)break;return o.set("event",{type:"literal",value:y,dataType:"string"}),{node:B.withoutSpanDiagnostics(e,d),input:t}}return null}reclaimResponseTypeTail(e,t,n){let i=B.unconsumedSpans(e);if(i.length===0)return null;let a=B.AS_MARKERS_BEFORE[n];if(!a)return null;let o=l=>l.replace(/\s+/g," ").trim(),s=B.droppedTokenCount(e),u=Y(t,n).tokens;for(let l=0;l+1<u.length;l++){let c=u[l],d=u[l+1];if(!a.some(f=>c.value.toLowerCase()===f)||!B.RESPONSE_TYPE_WORDS.has(d.value.toLowerCase()))continue;let p=o(t.slice(c.position.start,d.position.end));if(!i.includes(p))continue;let m=(t.slice(0,c.position.start).trimEnd()+" "+t.slice(d.position.end).trimStart()).trim();if(!(!m||m===t))try{let f=this.parse(m,n);if(!f||f.kind!=="event-handler")continue;let v=Jr(f);if(B.droppedTokenCount(v)>=s)continue;let E=B.findResponseTypeTarget(v);if(!E)continue;return E.roles.set("responseType",{type:"expression",raw:d.value}),{node:v,input:m}}catch{}}return null}static findResponseTypeTarget(e){let t=null,n=i=>{if(!i||typeof i!="object"||t)return;if(i.kind==="command"){let o=i;if(oe(o.action)?.roles.some(u=>u.role==="responseType"&&!u.required)&&!o.roles.has("responseType")){t=o;return}}let a=i;for(let o of ["body","statements","thenBranch","elseBranch","commands"]){let s=a[o];Array.isArray(s)&&s.forEach(u=>n(u));}};return n(e),t}reclaimCapturedDestinationTail(e,t,n){let i=B.unconsumedSpans(e);if(i.length===0)return null;let a=F(n)?.roleMarkers?.destination,o=new Set;if(a?.primary&&o.add(a.primary),a?.alternatives?.forEach(l=>o.add(l)),o.size===0)return null;let s=l=>l.replace(/\s+/g," ").trim(),u=Y(t,n).tokens;for(let l=0;l+1<u.length;l++){let c=u[l],d=u[l+1],p=o.has(c.value)&&d.normalized==="me",m=c.normalized==="me"&&o.has(d.value);if(!p&&!m)continue;let f=s(t.slice(c.position.start,d.position.end));if(!i.includes(f))continue;let v=false,E=h=>{if(!h||typeof h!="object"||v)return;if(h.kind==="command"){let k=h.roles.get("destination");if(k?.type==="reference"&&k.value==="me"){v=true;return}}let y=h;for(let k of ["body","statements","thenBranch","elseBranch","commands"]){let b=y[k];Array.isArray(b)&&b.forEach(g=>E(g));}};if(E(e),!!v)return {node:B.withoutSpanDiagnostics(e,f),input:t}}return null}applyModifiers(e,t){return {...e,eventModifiers:{...e.eventModifiers,...t}}}extractOrConjunctionEvents(e,t){let n=[];for(;;){let i=e.mark(),a=e.peek();if(!a)break;if(!Or(a,t)){e.reset(i);break}e.advance();let o=e.peek();if(!o){e.reset(i);break}let s=o.normalized||o.value;e.advance(),n.push({type:"literal",value:s});}return n}};Ae.coverageMarkerSurfaces=new Map;Ae.LEAKED_RENDER_MARKERS={hi:["\u0915\u0947","\u0930\u0942\u092A","\u092E\u0947\u0902"],tr:["olarak"],qu:["hina"]};Ae.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"]};Ae.AS_MARKERS_AFTER={ko:[["\uB85C"],["\uC73C\uB85C"]],qu:[["hina"]],tr:[["olarak"]],hi:[["\u0915\u0947","\u0930\u0942\u092A","\u092E\u0947\u0902"]]};Ae.enEventKeywordCache=new Map;Ae.KNOWN_EVENTS=new Set(["click","dblclick","input","change","submit","keydown","keyup","keypress","mouseover","mouseout","mousedown","mouseup","focus","blur","load","scroll","resize","contextmenu"]);Ae.RESPONSE_TYPE_WORDS=new Set(["json","text","html","xml","blob","arraybuffer","formdata","response"]);Ae.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"])};Ae.SOV_EVENT_MARKER_PHRASES={ko:[["\uD560","\uB54C"],["\uD560\uB54C"]]};Ae.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"])}};Ae.CONDITION_OPERATORS=new Set(["matches","match","contains","exists","has","have","equals","includes"]);Ae.STANDALONE_MODIFIERS={once:"once",debounced:"debounce",debounce:"debounce",throttled:"throttle",throttle:"throttle"};var Wm=Ae,Vm=new Wm;function Za(r,e){return Vm.parse(r,e)}function qm(r,e){let t=Bm(r);return pt(t,e)}function Xa(r,e,t){if(zt(r))return qm(r,t);let n=Za(r,e);return pt(n,t)}var Km=class{constructor(r={}){this.cache=new Map,this.config={maxSize:r.maxSize??1e3,ttlMs:r.ttlMs??0,enabled:r.enabled??true},this.stats={hits:0,misses:0,evictions:0,expirations:0};}makeKey(r,e){return `${e}:${r}`}isExpired(r){return this.config.ttlMs===0?false:Date.now()-r.createdAt>this.config.ttlMs}evictLRU(){let r=this.cache.keys().next().value;r!==void 0&&(this.cache.delete(r),this.stats.evictions++);}get(r,e){if(!this.config.enabled){this.stats.misses++;return}let t=this.makeKey(r,e),n=this.cache.get(t);if(!n){this.stats.misses++;return}if(this.isExpired(n)){this.cache.delete(t),this.stats.expirations++,this.stats.misses++;return}return this.cache.delete(t),n.lastAccessed=Date.now(),this.cache.set(t,n),this.stats.hits++,n.result}set(r,e,t){if(!this.config.enabled||t!==null&&typeof t=="object"&&"confidence"in t&&t.confidence===0)return;let n=this.makeKey(r,e),i=Date.now();for(;this.cache.size>=this.config.maxSize;)this.evictLRU();this.cache.set(n,{result:t,createdAt:i,lastAccessed:i});}has(r,e){if(!this.config.enabled)return false;let t=this.makeKey(r,e),n=this.cache.get(t);return n?this.isExpired(n)?(this.cache.delete(t),this.stats.expirations++,false):true:false}delete(r,e){let t=this.makeKey(r,e);return this.cache.delete(t)}clear(){this.cache.clear();}resetStats(){this.stats={hits:0,misses:0,evictions:0,expirations:0};}getStats(){let r=this.stats.hits+this.stats.misses;return {hits:this.stats.hits,misses:this.stats.misses,size:this.cache.size,maxSize:this.config.maxSize,hitRate:r>0?this.stats.hits/r:0,evictions:this.stats.evictions,expirations:this.stats.expirations,enabled:this.config.enabled}}configure(r){if(r.maxSize!==void 0)for(this.config.maxSize=r.maxSize;this.cache.size>this.config.maxSize;)this.evictLRU();r.ttlMs!==void 0&&(this.config.ttlMs=r.ttlMs),r.enabled!==void 0&&(this.config.enabled=r.enabled);}enable(){this.config.enabled=true;}disable(){this.config.enabled=false;}getConfig(){return {...this.config}}};new Km;function Hm(){return [{id:"toggle-es-full",language:"es",command:"toggle",priority:100,template:{format:"alternar {patient} en {target}",tokens:[{type:"literal",value:"alternar",alternatives:["cambiar","toggle"]},{type:"role",role:"patient"},{type:"group",optional:true,tokens:[{type:"literal",value:"en",alternatives:["sobre","de"]},{type:"role",role:"destination"}]}]},extraction:{patient:{position:1},destination:{marker:"en",markerAlternatives:["sobre","de"],default:{type:"reference",value:"me"}}}},{id:"toggle-es-simple",language:"es",command:"toggle",priority:90,template:{format:"alternar {patient}",tokens:[{type:"literal",value:"alternar",alternatives:["cambiar","toggle"]},{type:"role",role:"patient"}]},extraction:{patient:{position:1},destination:{default:{type:"reference",value:"me"}}}}]}function Zm(){return [{id:"put-es-full",language:"es",command:"put",priority:100,template:{format:"poner {patient} en {destination}",tokens:[{type:"literal",value:"poner",alternatives:["pon","colocar","put"]},{type:"role",role:"patient"},{type:"literal",value:"en",alternatives:["dentro de","a"]},{type:"role",role:"destination"}]},extraction:{patient:{position:1},destination:{marker:"en",markerAlternatives:["dentro de","a"]}}},{id:"put-es-before",language:"es",command:"put",priority:95,template:{format:"poner {patient} antes de {destination}",tokens:[{type:"literal",value:"poner",alternatives:["pon","colocar"]},{type:"role",role:"patient"},{type:"literal",value:"antes de",alternatives:["antes"]},{type:"role",role:"destination"}]},extraction:{patient:{position:1},destination:{marker:"antes de",markerAlternatives:["antes"]},manner:{default:{type:"literal",value:"before"}}}},{id:"put-es-after",language:"es",command:"put",priority:95,template:{format:"poner {patient} despu\xE9s de {destination}",tokens:[{type:"literal",value:"poner",alternatives:["pon","colocar"]},{type:"role",role:"patient"},{type:"literal",value:"despu\xE9s de",alternatives:["despues de","despu\xE9s"]},{type:"role",role:"destination"}]},extraction:{patient:{position:1},destination:{marker:"despu\xE9s de",markerAlternatives:["despues de","despu\xE9s"]},manner:{default:{type:"literal",value:"after"}}}}]}var Xm={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(Xm).map(([r,e])=>{let t={};for(let[n,i]of Object.entries(e))i in t||(t[i]=n);return [r,t]}));function Jm(){return [{id:"event-es-native-al-source",language:"es",command:"on",priority:115,template:{format:"al {event} en {source} {body}",tokens:[{type:"literal",value:"al"},{type:"role",role:"event"},{type:"literal",value:"en",alternatives:["de"]},{type:"role",role:"source"}]},extraction:{event:{position:1},source:{marker:"en",markerAlternatives:["de"]}}},{id:"event-es-cuando-source",language:"es",command:"on",priority:112,template:{format:"cuando {event} en {source} {body}",tokens:[{type:"literal",value:"cuando"},{type:"role",role:"event"},{type:"literal",value:"en",alternatives:["de"]},{type:"role",role:"source"}]},extraction:{event:{position:1},source:{marker:"en",markerAlternatives:["de"]}}},{id:"event-es-native-al",language:"es",command:"on",priority:108,template:{format:"al {event} {body}",tokens:[{type:"literal",value:"al"},{type:"role",role:"event"}]},extraction:{event:{position:1}}},{id:"event-es-standard",language:"es",command:"on",priority:100,template:{format:"en {event} {body}",tokens:[{type:"literal",value:"en",alternatives:["al","cuando"]},{type:"role",role:"event"}]},extraction:{event:{position:1}}},{id:"event-es-source",language:"es",command:"on",priority:110,template:{format:"en {event} desde {source} {body}",tokens:[{type:"literal",value:"en",alternatives:["al"]},{type:"role",role:"event"},{type:"literal",value:"desde",alternatives:["de"]},{type:"role",role:"source"}]},extraction:{event:{position:1},source:{marker:"desde",markerAlternatives:["de"]}}},{id:"event-es-when",language:"es",command:"on",priority:95,template:{format:"cuando {event} {body}",tokens:[{type:"literal",value:"cuando"},{type:"role",role:"event"}]},extraction:{event:{position:1}}},{id:"event-es-conditional-si",language:"es",command:"on",priority:85,template:{format:"si {event} {body}",tokens:[{type:"literal",value:"si"},{type:"role",role:"event"}]},extraction:{event:{position:1}}}]}function Qm(){return [{id:"set-es-full",language:"es",command:"set",priority:100,template:{format:"establecer {destination} a {patient}",tokens:[{type:"literal",value:"establecer",alternatives:["fijar","definir","poner","set"]},{type:"role",role:"destination",expectedTypes:["property-path","selector","reference","expression"]},{type:"literal",value:"a",alternatives:["en","como"]},{type:"role",role:"patient",expectedTypes:["literal","expression","reference"]}]},extraction:{destination:{position:1},patient:{position:3}}},{id:"set-es-prep-first",language:"es",command:"set",priority:95,template:{format:"establecer en {destination} {patient}",tokens:[{type:"literal",value:"establecer",alternatives:["fijar","definir","poner","set"]},{type:"literal",value:"en",alternatives:["a"]},{type:"role",role:"destination",expectedTypes:["property-path","selector","reference","expression"]},{type:"role",role:"patient",expectedTypes:["literal","expression","reference"]}]},extraction:{destination:{position:2},patient:{position:3}}},{id:"set-es-equals",language:"es",command:"set",priority:95,template:{format:"{destination} = {patient}",tokens:[{type:"role",role:"destination",expectedTypes:["property-path","selector","reference","expression"]},{type:"literal",value:"="},{type:"role",role:"patient",expectedTypes:["literal","expression","reference"]}]},extraction:{destination:{position:0},patient:{position:2}}}]}function ef(r){let e=r?.roleMarkers?.style;if(!e?.primary)return null;let t={type:"literal",value:e.primary,...e.alternatives?.length?{alternatives:e.alternatives}:{}},n={type:"role",role:"style",expectedTypes:["expression"]};return {token:{type:"group",optional:true,tokens:e.position==="after"?[n,t]:[t,n]},extraction:{marker:e.primary,...e.alternatives?.length?{markerAlternatives:e.alternatives}:{}}}}function rf(r,e,t,n,i,a,o,s,u){let l=ef(r);return {id:e,language:t,command:"fetch",priority:105,template:{format:`${n} ${i} {source} ${a} {responseType}`,tokens:[{type:"literal",value:n,...{}},{type:"group",optional:true,tokens:[{type:"literal",value:i,...{}}]},{type:"role",role:"source",expectedTypes:["literal","expression"]},...l?[l.token]:[],{type:"group",optional:true,tokens:[{type:"literal",value:a,...{}},{type:"role",role:"responseType",expectedTypes:["literal","expression"]}]}]},extraction:{source:{marker:i,...{}},...l?{style:l.extraction}:{},responseType:{marker:a,...{}}}}}function tf(r){return [rf(r,"fetch-es","es","buscar","de","como")]}var nf=[["toggle",Hm],["put",Zm],["event-handler",Jm],["set",Qm],["fetch",tf]];function af(r){return /[\u00e1\u00e9\u00ed\u00f3\u00fa\u00fc\u00f1\u00c1\u00c9\u00cd\u00d3\u00da\u00dc\u00d1]/.test(r)}var of=[{ending:"ando",stem:"ar",confidence:.88,type:"gerund"},{ending:"ado",stem:"ar",confidence:.88,type:"participle"},{ending:"ada",stem:"ar",confidence:.88,type:"participle"},{ending:"ados",stem:"ar",confidence:.88,type:"participle"},{ending:"adas",stem:"ar",confidence:.88,type:"participle"},{ending:"o",stem:"ar",confidence:.75,type:"present"},{ending:"as",stem:"ar",confidence:.82,type:"present"},{ending:"a",stem:"ar",confidence:.75,type:"present"},{ending:"amos",stem:"ar",confidence:.85,type:"present"},{ending:"\xE1is",stem:"ar",confidence:.85,type:"present"},{ending:"ais",stem:"ar",confidence:.82,type:"present"},{ending:"an",stem:"ar",confidence:.8,type:"present"},{ending:"\xE9",stem:"ar",confidence:.85,type:"past"},{ending:"aste",stem:"ar",confidence:.88,type:"past"},{ending:"\xF3",stem:"ar",confidence:.82,type:"past"},{ending:"amos",stem:"ar",confidence:.85,type:"past"},{ending:"asteis",stem:"ar",confidence:.88,type:"past"},{ending:"aron",stem:"ar",confidence:.88,type:"past"},{ending:"aba",stem:"ar",confidence:.88,type:"past"},{ending:"abas",stem:"ar",confidence:.88,type:"past"},{ending:"\xE1bamos",stem:"ar",confidence:.88,type:"past"},{ending:"abamos",stem:"ar",confidence:.85,type:"past"},{ending:"abais",stem:"ar",confidence:.88,type:"past"},{ending:"aban",stem:"ar",confidence:.88,type:"past"},{ending:"e",stem:"ar",confidence:.72,type:"subjunctive"},{ending:"es",stem:"ar",confidence:.78,type:"subjunctive"},{ending:"emos",stem:"ar",confidence:.82,type:"subjunctive"},{ending:"\xE9is",stem:"ar",confidence:.85,type:"subjunctive"},{ending:"eis",stem:"ar",confidence:.82,type:"subjunctive"},{ending:"en",stem:"ar",confidence:.78,type:"subjunctive"},{ending:"a",stem:"ar",confidence:.75,type:"imperative"},{ending:"ad",stem:"ar",confidence:.85,type:"imperative"},{ending:"ar",stem:"ar",confidence:.92,type:"dictionary"}],sf=[{ending:"iendo",stem:"er",confidence:.88,type:"gerund"},{ending:"ido",stem:"er",confidence:.85,type:"participle"},{ending:"ida",stem:"er",confidence:.85,type:"participle"},{ending:"idos",stem:"er",confidence:.85,type:"participle"},{ending:"idas",stem:"er",confidence:.85,type:"participle"},{ending:"o",stem:"er",confidence:.72,type:"present"},{ending:"es",stem:"er",confidence:.78,type:"present"},{ending:"e",stem:"er",confidence:.72,type:"present"},{ending:"emos",stem:"er",confidence:.85,type:"present"},{ending:"\xE9is",stem:"er",confidence:.85,type:"present"},{ending:"eis",stem:"er",confidence:.82,type:"present"},{ending:"en",stem:"er",confidence:.78,type:"present"},{ending:"\xED",stem:"er",confidence:.85,type:"past"},{ending:"iste",stem:"er",confidence:.88,type:"past"},{ending:"i\xF3",stem:"er",confidence:.85,type:"past"},{ending:"io",stem:"er",confidence:.82,type:"past"},{ending:"imos",stem:"er",confidence:.85,type:"past"},{ending:"isteis",stem:"er",confidence:.88,type:"past"},{ending:"ieron",stem:"er",confidence:.88,type:"past"},{ending:"\xEDa",stem:"er",confidence:.88,type:"past"},{ending:"ia",stem:"er",confidence:.85,type:"past"},{ending:"\xEDas",stem:"er",confidence:.88,type:"past"},{ending:"ias",stem:"er",confidence:.85,type:"past"},{ending:"\xEDamos",stem:"er",confidence:.88,type:"past"},{ending:"iamos",stem:"er",confidence:.85,type:"past"},{ending:"\xEDais",stem:"er",confidence:.88,type:"past"},{ending:"iais",stem:"er",confidence:.85,type:"past"},{ending:"\xEDan",stem:"er",confidence:.88,type:"past"},{ending:"ian",stem:"er",confidence:.85,type:"past"},{ending:"er",stem:"er",confidence:.92,type:"dictionary"}],uf=[{ending:"iendo",stem:"ir",confidence:.88,type:"gerund"},{ending:"ido",stem:"ir",confidence:.85,type:"participle"},{ending:"ida",stem:"ir",confidence:.85,type:"participle"},{ending:"idos",stem:"ir",confidence:.85,type:"participle"},{ending:"idas",stem:"ir",confidence:.85,type:"participle"},{ending:"o",stem:"ir",confidence:.72,type:"present"},{ending:"es",stem:"ir",confidence:.78,type:"present"},{ending:"e",stem:"ir",confidence:.72,type:"present"},{ending:"imos",stem:"ir",confidence:.85,type:"present"},{ending:"\xEDs",stem:"ir",confidence:.85,type:"present"},{ending:"is",stem:"ir",confidence:.82,type:"present"},{ending:"en",stem:"ir",confidence:.78,type:"present"},{ending:"\xED",stem:"ir",confidence:.85,type:"past"},{ending:"iste",stem:"ir",confidence:.88,type:"past"},{ending:"i\xF3",stem:"ir",confidence:.85,type:"past"},{ending:"io",stem:"ir",confidence:.82,type:"past"},{ending:"imos",stem:"ir",confidence:.85,type:"past"},{ending:"isteis",stem:"ir",confidence:.88,type:"past"},{ending:"ieron",stem:"ir",confidence:.88,type:"past"},{ending:"\xEDa",stem:"ir",confidence:.88,type:"past"},{ending:"ia",stem:"ir",confidence:.85,type:"past"},{ending:"\xEDas",stem:"ir",confidence:.88,type:"past"},{ending:"ias",stem:"ir",confidence:.85,type:"past"},{ending:"\xEDamos",stem:"ir",confidence:.88,type:"past"},{ending:"iamos",stem:"ir",confidence:.85,type:"past"},{ending:"\xEDais",stem:"ir",confidence:.88,type:"past"},{ending:"iais",stem:"ir",confidence:.85,type:"past"},{ending:"\xEDan",stem:"ir",confidence:.88,type:"past"},{ending:"ian",stem:"ir",confidence:.85,type:"past"},{ending:"ir",stem:"ir",confidence:.92,type:"dictionary"}],lf=[...of,...sf,...uf].sort((r,e)=>e.ending.length-r.ending.length),eo=class extends Mn{constructor(){super({language:"es",minWordLength:3,minStemLength:2,endings:lf,reflexiveSuffixes:["se","me","te","nos","os"],infinitiveEndings:["ar","er","ir"]});}isNormalizable(r){if(r.length<3)return false;let e=r.toLowerCase();if(e.endsWith("ar")||e.endsWith("er")||e.endsWith("ir")||e.endsWith("ando")||e.endsWith("iendo")||e.endsWith("ado")||e.endsWith("ido")||e.endsWith("arse")||e.endsWith("erse")||e.endsWith("irse"))return true;for(let t of r)if(af(t))return true;return false}};new eo;var ro={code:"es",name:"Spanish",nativeName:"Espa\xF1ol",regions:["western","priority"],direction:"ltr",script:"latin",wordOrder:"SVO",markingStrategy:"preposition",usesSpaces:true,defaultVerbForm:"infinitive",verb:{position:"start",subjectDrop:true},references:{me:"yo",it:"ello",you:"t\xFA",result:"resultado",event:"evento",target:"objetivo",body:"cuerpo",document:"documento",window:"ventana",detail:"detalle"},possessive:{marker:"de",markerPosition:"before-property",usePossessiveAdjectives:true,specialForms:{me:"mi",it:"su",you:"tu"},keywords:{mi:"me",tu:"you",su:"it"}},roleMarkers:{destination:{primary:"en",alternatives:["sobre","a","hacia"],position:"before"},source:{primary:"de",alternatives:["desde"],position:"before"},patient:{primary:"",position:"before"},style:{primary:"con",position:"before"}},keywords:{toggle:{primary:"alternar",alternatives:["conmutar","toggle"],normalized:"toggle"},add:{primary:"agregar",alternatives:["a\xF1adir"],normalized:"add"},remove:{primary:"quitar",alternatives:["eliminar","remover","sacar","borrar"],normalized:"remove"},put:{primary:"poner",alternatives:["colocar","pon"],normalized:"put"},append:{primary:"anexar",normalized:"append"},prepend:{primary:"anteponer",normalized:"prepend"},take:{primary:"tomar",normalized:"take"},make:{primary:"hacer",alternatives:["crear"],normalized:"make"},clone:{primary:"clonar",alternatives:["duplicar"],normalized:"clone"},swap:{primary:"intercambiar",alternatives:["permutar"],normalized:"swap"},morph:{primary:"transformar",alternatives:["convertir"],normalized:"morph"},set:{primary:"establecer",alternatives:["fijar","definir","establece"],normalized:"set"},get:{primary:"obtener",alternatives:["conseguir","obt\xE9n"],normalized:"get"},increment:{primary:"incrementar",alternatives:["aumentar"],normalized:"increment"},decrement:{primary:"decrementar",alternatives:["disminuir"],normalized:"decrement"},log:{primary:"registrar",alternatives:["imprimir"],normalized:"log"},show:{primary:"mostrar",alternatives:["ense\xF1ar","muestra"],normalized:"show"},hide:{primary:"ocultar",alternatives:["esconder"],normalized:"hide"},transition:{primary:"transici\xF3n",alternatives:["animar"],normalized:"transition"},on:{primary:"en",alternatives:["al"],normalized:"on"},trigger:{primary:"disparar",alternatives:["activar"],normalized:"trigger"},send:{primary:"enviar",alternatives:["env\xEDa"],normalized:"send"},focus:{primary:"enfoque",alternatives:["enfocar"],normalized:"focus"},blur:{primary:"p\xE9rdida de foco",alternatives:["perdida de foco","desenfoque","desenfocar"],normalized:"blur"},open:{primary:"abrir",normalized:"open"},close:{primary:"cerrar",normalized:"close"},select:{primary:"seleccionar",normalized:"select"},clear:{primary:"limpiar",normalized:"clear"},reset:{primary:"reiniciar",alternatives:["restablecer"],normalized:"reset"},breakpoint:{primary:"punto-interrupci\xF3n",alternatives:["punto-interrupcion"],normalized:"breakpoint"},click:{primary:"clic",alternatives:["hacer clic","click"],normalized:"click"},resize:{primary:"cambio de tama\xF1o",alternatives:["cambio de tamano","redimensionar"],normalized:"resize"},hover:{primary:"sobrevolar",alternatives:["pasar por encima"],normalized:"hover"},submit:{primary:"env\xEDo",alternatives:["envio","someter"],normalized:"submit"},input:{primary:"entrada",alternatives:["introducir"],normalized:"input"},change:{primary:"cambio",alternatives:["cambiar"],normalized:"change"},load:{primary:"carga",alternatives:["cargar"],normalized:"load"},scroll:{primary:"desplazamiento",alternatives:["desplazar"],normalized:"scroll"},keydown:{primary:"tecla pulsada",alternatives:["tecla presionada","tecla abajo"],normalized:"keydown"},keyup:{primary:"tecla soltada",alternatives:["tecla liberada","tecla arriba"],normalized:"keyup"},mouseover:{primary:"rat\xF3n encima",alternatives:["raton encima","mouse encima"],normalized:"mouseover"},mouseout:{primary:"rat\xF3n fuera",alternatives:["raton fuera","mouse fuera"],normalized:"mouseout"},mousedown:{primary:"rat\xF3n pulsado",alternatives:["raton pulsado","mouse presionado","rat\xF3n abajo","raton abajo","rat\xF3nabajo"],normalized:"mousedown"},mouseup:{primary:"rat\xF3n soltado",alternatives:["raton soltado","mouse soltado","rat\xF3n arriba","raton arriba","rat\xF3narriba"],normalized:"mouseup"},go:{primary:"ir",alternatives:["navegar","ve"],normalized:"go"},push:{primary:"empujar",alternatives:["push"],normalized:"push"},replace:{primary:"reemplazar",alternatives:["sustituir"],normalized:"replace"},process:{primary:"procesar",normalized:"process"},wait:{primary:"esperar",normalized:"wait"},fetch:{primary:"buscar",alternatives:["recuperar"],normalized:"fetch"},settle:{primary:"estabilizar",normalized:"settle"},if:{primary:"si",normalized:"if"},unless:{primary:"menos",alternatives:["a menos que","salvo"],normalized:"unless"},when:{primary:"cuando",normalized:"when"},changes:{primary:"cambia",normalized:"changes"},where:{primary:"donde",normalized:"where"},else:{primary:"sino",alternatives:["de lo contrario"],normalized:"else"},repeat:{primary:"repetir",normalized:"repeat"},for:{primary:"para",normalized:"for"},while:{primary:"mientras",normalized:"while"},forever:{primary:"forever",normalized:"forever"},continue:{primary:"continuar",normalized:"continue"},halt:{primary:"detener",alternatives:["parar"],normalized:"halt"},throw:{primary:"lanzar",alternatives:["arrojar"],normalized:"throw"},call:{primary:"llamar",normalized:"call"},return:{primary:"retornar",alternatives:["devolver"],normalized:"return"},then:{primary:"entonces",alternatives:["luego"],normalized:"then"},and:{primary:"y",alternatives:["adem\xE1s","tambi\xE9n"],normalized:"and"},or:{primary:"o",normalized:"or"},not:{primary:"no",normalized:"not"},is:{primary:"es",normalized:"is"},exists:{primary:"existe",normalized:"exists"},empty:{primary:"vac\xEDo",alternatives:["vacio"],normalized:"empty"},matches:{primary:"coincide",normalized:"matches"},no:{primary:"ning\xFAn",normalized:"no"},end:{primary:"fin",alternatives:["final","terminar"],normalized:"end"},js:{primary:"js",normalized:"js"},async:{primary:"as\xEDncrono",alternatives:["asincrono"],normalized:"async"},tell:{primary:"decir",normalized:"tell"},default:{primary:"predeterminar",alternatives:["por defecto"],normalized:"default"},init:{primary:"inicio",alternatives:["inicializaci\xF3n","iniciar","inicializar"],normalized:"init"},behavior:{primary:"comportamiento",normalized:"behavior"},install:{primary:"instalar",normalized:"install"},measure:{primary:"medir",normalized:"measure"},beep:{primary:"pitido",normalized:"beep"},break:{primary:"romper",normalized:"break"},copy:{primary:"copiar",normalized:"copy"},exit:{primary:"salir",normalized:"exit"},pick:{primary:"escoger",normalized:"pick"},render:{primary:"renderizar",normalized:"render"},first:{primary:"primero",alternatives:["primera"],normalized:"first"},last:{primary:"\xFAltimo",alternatives:["ultima"],normalized:"last"},next:{primary:"siguiente",normalized:"next"},previous:{primary:"anterior",normalized:"previous"},closest:{primary:"cercano",normalized:"closest"},parent:{primary:"padre",normalized:"parent"},into:{primary:"dentro",alternatives:["adentro","dentro de"],normalized:"into"},before:{primary:"antes",alternatives:["antes de"],normalized:"before"},after:{primary:"despu\xE9s",alternatives:["despues","despu\xE9s de","despues de"],normalized:"after"},out:{primary:"fuera",alternatives:["fuera de"],normalized:"out"},until:{primary:"hasta",alternatives:["hasta que"],normalized:"until"},event:{primary:"evento",normalized:"event"},from:{primary:"de",alternatives:["desde"],normalized:"from"},connect:{primary:"conectar",alternatives:["conectarse"],normalized:"connect"},stream:{primary:"transmitir",alternatives:["flujo"],normalized:"stream"},live:{primary:"en-vivo",alternatives:["vivo","directo"],normalized:"live"},socket:{primary:"socket",alternatives:["websocket"],normalized:"socket"},bind:{primary:"vincular",alternatives:["enlazar","bind"],normalized:"bind"},intercept:{primary:"interceptar",alternatives:["intercept"],normalized:"intercept"},worker:{primary:"trabajador",alternatives:["worker"],normalized:"worker"},eventsource:{primary:"eventsource",alternatives:["fuente-de-eventos"],normalized:"eventsource"}},eventHandler:{keyword:{primary:"al",alternatives:["cuando","en"],normalized:"on"},sourceMarker:{primary:"de",alternatives:["desde"],position:"before"},eventMarker:{primary:"al",alternatives:["cuando","en"],position:"before"},temporalMarkers:["cuando","al"]}},cf=["===","!==","->","==","!=","<=",">=","&&","||","**","+=","-=","*=","/=","+","-","*","/","=",">","<","!","&","|","%","^","~"],df=class{constructor(r=cf){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}},pf="()[]{},:;",mf=class{constructor(r=pf){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 fn(r,e){let t=e;for(;t<r.length&&r[t]===":";){let n=r.slice(t).match(/^::?[a-zA-Z][a-zA-Z0-9-]*/);if(!n)break;let i=t+n[0].length;if(r[i]==="("){let a=0,o=i;for(;o<r.length;){if(r[o]==="(")a++;else if(r[o]===")"&&(a--,a===0)){o++;break}o++;}if(a!==0)break;i=o;}t=i;}return t}function Ja(r,e){let t=r[e];if(t==="#"){let n=r.slice(e).match(/^#[a-zA-Z_][\w-]*/);if(!n)return null;let i=fn(r,e+n[0].length);return r.slice(e,i)}if(t==="."){let n=r.slice(e).match(/^\.\{[a-zA-Z_$][\w$]*\}/);if(n)return n[0];let i=r.slice(e).match(/^\.[a-zA-Z_][\w-]*/);if(!i)return null;let a=fn(r,e+i[0].length);return r.slice(e,a)}if(t==="@"){let n=r.slice(e).match(/^@[a-zA-Z_][\w-]*/);return n?n[0]:null}if(t==="*"){let n=r.slice(e).match(/^\*(?:--)?[a-zA-Z_][\w-]*/);return n?n[0]:null}if(t==="["){let n=0,i=e;for(;i<r.length;){if(r[i]==="["&&n++,r[i]==="]"&&(n--,n===0)){let a=fn(r,i+1);return r.slice(e,a)}i++;}return null}if(t==="<"){let n=r.slice(e).match(/^<(?=[\w.#[])[\w-]*(?:[#.][\w-]+|\[[^\]]+\]|::?[a-zA-Z][a-zA-Z0-9-]*(?:\([^)]*\))?)*\s*\/>/);return n?n[0]:null}return null}var ff=class{constructor(){this.name="css-selector";}canExtract(r,e){let t=r[e];return t==="#"||t==="."||t==="["||t==="<"?true:t==="@"||t==="*"?Ja(r,e)!==null:false}extract(r,e){let t=Ja(r,e);return t?{value:t,length:t.length,metadata:{type:"css-selector"}}:null}},yf=class{constructor(){this.name="event-modifier";}canExtract(r,e){if(r[e]!==".")return false;let t=r.slice(e);return /^\.(once|prevent|stop|debounce|throttle|queue)/.test(t)}extract(r,e){let t=r.slice(e).match(/^\.(?:once|prevent|stop|debounce|throttle|queue)(?:\(([^)]+)\))?/);if(!t)return null;let n=t[0],i=n.slice(1).split("(")[0],a=t[1];return {value:n,length:n.length,metadata:{modifierName:i,value:a?i==="queue"?a:parseInt(a,10):void 0}}}},vf=["http://","https://","//","./","../","/"];function hf(r,e){let t=1;for(let n=e;n<r.length;n++){let i=r[n];if(i==="{")t++;else if(i==="}"&&--t===0)return n+1}return -1}function Ef(r,e){let t=r.slice(e),n=vf.find(a=>t.startsWith(a));if(!n)return null;let i=n.length;for(;i<t.length;){let a=t[i];if(a==="$"&&t[i+1]==="{"){let o=hf(t,i+2);if(o!==-1){i=o;continue}}if(/\s/.test(a))break;i++;}return t.slice(0,i)}var gf=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=Ef(r,e);return t?{value:t,length:t.length,metadata:{type:"url"}}:null}},kf=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 wf(){return [new gf,new yf,new kf,new ff]}function zf(r){return {isLetter:n=>r.test(n),isIdentifierChar:n=>/[0-9]/.test(n)||r.test(n)}}var{isLetter:Qa,isIdentifierChar:bf}=zf(/[a-zA-Z\u00e1\u00e9\u00ed\u00f3\u00fa\u00fc\u00f1\u00c1\u00c9\u00cd\u00d3\u00da\u00dc\u00d1]/),Cf=new Set(["en","a","de","desde","hasta","con","sin","por","para","sobre","entre","antes","despu\xE9s","despues","dentro","fuera","al","del"]),Af=class{constructor(){this.name="spanish-keyword";}setContext(r){this.context=r;}canExtract(r,e){return Qa(r[e])}extract(r,e){if(!this.context)throw new Error("SpanishKeywordExtractor: context not set");let t=this.tryMultiWordPhrase(r,e);return t||this.extractSpanishWord(r,e)}tryMultiWordPhrase(r,e){if(!this.context)return null;let t=["de lo contrario","de lo normal","por defecto","de nuevo","de otra manera"];for(let n of t)if(r.slice(e,e+n.length).toLowerCase()===n.toLowerCase()){let a=e+n.length;if(a>=r.length||Xe(r[a])||!Qa(r[a])){let o=this.context.lookupKeyword(n);return {value:r.slice(e,a),length:n.length,metadata:{normalized:o?.normalized,multiWord:true}}}}return null}extractSpanishWord(r,e){if(!this.context)return null;let t=e,n="";for(;t<r.length&&bf(r[t]);)n+=r[t++];if(!n)return null;let i=n.toLowerCase(),a=Cf.has(i),o=this.context.lookupKeyword(n),s=o&&o.normalized!==o.native?o.normalized:void 0,u,l,c;if(!o&&this.context.normalizer){let d=this.context.normalizer.normalize(n);if(d.stem!==n&&d.confidence>=.7){let p=this.context.lookupKeyword(d.stem);p&&(u=p.normalized,l=d.stem,c=d.confidence);}}return {value:n,length:t-e,metadata:{normalized:s||u,stem:l,stemConfidence:c,isPreposition:a}}}};function xf(){return [new Af]}var Df=new Set(["en","a","de","desde","hasta","con","sin","por","para","sobre","entre","antes","despu\xE9s","despues","dentro","fuera","al","del"]),Sf=[{native:"verdadero",normalized:"true"},{native:"falso",normalized:"false"},{native:"nulo",normalized:"null"},{native:"indefinido",normalized:"undefined"},{native:"segundo",normalized:"s"},{native:"segundos",normalized:"s"},{native:"milisegundo",normalized:"ms"},{native:"milisegundos",normalized:"ms"},{native:"minuto",normalized:"m"},{native:"minutos",normalized:"m"},{native:"hora",normalized:"h"},{native:"horas",normalized:"h"},{native:"m\xED",normalized:"me"},{native:"destino",normalized:"target"},{native:"inclusivo",normalized:"inclusive"},{native:"exclusivo",normalized:"exclusive"},{native:"caracteres",normalized:"characters"},{native:"aleatorio",normalized:"random"}],Bf=class extends Pe{constructor(){super(),this.language="es",this.direction="ltr",this.initializeKeywordsFromProfile(ro,Sf),this.setNormalizer(new eo),this.registerExtractors(wf()),this.registerExtractor(new Te),this.registerExtractor(new Fe),this.registerExtractors(xf()),this.registerExtractor(new df),this.registerExtractor(new mf);}classifyToken(r){let e=r.toLowerCase();return Df.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"}},Tf=new Bf;Ie("es",nf);Me("es",Tf,ro);var Ff={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(Ff).map(([r,e])=>{let t={};for(let[n,i]of Object.entries(e))i in t||(t[i]=n);return [r,t]}));function Pf(){return [{id:"event-pt-ao-source",language:"pt",command:"on",priority:115,template:{format:"ao {event} em {source} {body}",tokens:[{type:"literal",value:"ao",alternatives:["\xE0"]},{type:"role",role:"event"},{type:"literal",value:"em",alternatives:["de","no","na"]},{type:"role",role:"source"}]},extraction:{event:{position:1},source:{marker:"em",markerAlternatives:["de","no","na"]}}},{id:"event-pt-quando-source",language:"pt",command:"on",priority:110,template:{format:"quando {event} de {source} {body}",tokens:[{type:"literal",value:"quando"},{type:"role",role:"event"},{type:"literal",value:"de",alternatives:["em","no","na"]},{type:"role",role:"source"}]},extraction:{event:{position:1},source:{marker:"de",markerAlternatives:["em","no","na"]}}},{id:"event-pt-ao",language:"pt",command:"on",priority:105,template:{format:"ao {event} {body}",tokens:[{type:"literal",value:"ao",alternatives:["\xE0"]},{type:"role",role:"event"}]},extraction:{event:{position:1}}},{id:"event-pt-quando",language:"pt",command:"on",priority:100,template:{format:"quando {event} {body}",tokens:[{type:"literal",value:"quando"},{type:"role",role:"event"}]},extraction:{event:{position:1}}},{id:"event-pt-em",language:"pt",command:"on",priority:95,template:{format:"em {event} {body}",tokens:[{type:"literal",value:"em",alternatives:["no","na"]},{type:"role",role:"event"}]},extraction:{event:{position:1}}},{id:"event-pt-se",language:"pt",command:"on",priority:90,template:{format:"se {event} {body}",tokens:[{type:"literal",value:"se"},{type:"role",role:"event"}]},extraction:{event:{position:1}}}]}var Of=["literal","selector","expression","reference","property-path"],yn=[...Of];function Rf(){return [{id:"set-pt-full",language:"pt",command:"set",priority:100,template:{format:"definir {destination} para {patient}",tokens:[{type:"literal",value:"definir",alternatives:["estabelecer","set"]},{type:"role",role:"destination",expectedTypes:["property-path","selector","reference","expression"]},{type:"literal",value:"para",alternatives:["como","a","em"]},{type:"role",role:"patient",expectedTypes:yn}]},extraction:{destination:{position:1},patient:{position:3}}},{id:"set-pt-em-direct",language:"pt",command:"set",priority:98,template:{format:"definir em {destination} {patient}",tokens:[{type:"literal",value:"definir",alternatives:["estabelecer"]},{type:"literal",value:"em",alternatives:["para","a"]},{type:"role",role:"destination",expectedTypes:["property-path","selector","reference","expression"]},{type:"role",role:"patient",expectedTypes:yn}]},extraction:{destination:{position:2},patient:{position:3}}},{id:"set-pt-equals",language:"pt",command:"set",priority:95,template:{format:"{destination} = {patient}",tokens:[{type:"role",role:"destination",expectedTypes:["property-path","selector","reference","expression"]},{type:"literal",value:"="},{type:"role",role:"patient",expectedTypes:yn}]},extraction:{destination:{position:0},patient:{position:2}}}]}function Lf(r){let e=r?.roleMarkers?.style;if(!e?.primary)return null;let t={type:"literal",value:e.primary,...e.alternatives?.length?{alternatives:e.alternatives}:{}},n={type:"role",role:"style",expectedTypes:["expression"]};return {token:{type:"group",optional:true,tokens:e.position==="after"?[n,t]:[t,n]},extraction:{marker:e.primary,...e.alternatives?.length?{markerAlternatives:e.alternatives}:{}}}}function Nf(r){let e=Lf(r);return [{id:"fetch-pt",language:"pt",command:"fetch",priority:105,template:{format:"buscar de {source} como {responseType}",tokens:[{type:"literal",value:"buscar"},{type:"group",optional:true,tokens:[{type:"literal",value:"de"}]},{type:"role",role:"source",expectedTypes:["literal","expression"]},...e?[e.token]:[],{type:"group",optional:true,tokens:[{type:"literal",value:"como"},{type:"role",role:"responseType",expectedTypes:["literal","expression"]}]}]},extraction:{source:{marker:"de"},responseType:{marker:"como"},...e?{style:e.extraction}:{}}}]}var _f=[["event-handler",Pf],["set",Rf],["fetch",Nf]],io={code:"pt",name:"Portuguese",nativeName:"Portugu\xEAs",regions:["western","priority"],direction:"ltr",script:"latin",wordOrder:"SVO",markingStrategy:"preposition",usesSpaces:true,verb:{position:"start",subjectDrop:true},references:{me:"eu",it:"ele",you:"voc\xEA",result:"resultado",event:"evento",target:"alvo",body:"corpo",document:"documento",window:"janela",detail:"detalhe"},possessive:{marker:"de",markerPosition:"before-property",usePossessiveAdjectives:true,specialForms:{me:"meu",it:"seu",you:"teu"},keywords:{meu:"me",minha:"me",teu:"you",tua:"you",seu:"it",sua:"it"}},roleMarkers:{destination:{primary:"em",alternatives:["para","a"],position:"before"},source:{primary:"de",alternatives:["desde"],position:"before"},patient:{primary:"",position:"before"},style:{primary:"com",position:"before"}},keywords:{toggle:{primary:"alternar",alternatives:[],normalized:"toggle"},add:{primary:"adicionar",alternatives:["acrescentar"],normalized:"add"},remove:{primary:"remover",alternatives:["eliminar","apagar","remova"],normalized:"remove"},put:{primary:"colocar",alternatives:["p\xF4r","por","coloque"],normalized:"put"},append:{primary:"anexar",normalized:"append"},prepend:{primary:"preceder",normalized:"prepend"},take:{primary:"pegar",alternatives:["pegue"],normalized:"take"},make:{primary:"fazer",alternatives:["criar"],normalized:"make"},clone:{primary:"clonar",alternatives:[],normalized:"clone"},swap:{primary:"trocar",alternatives:["substituir"],normalized:"swap"},morph:{primary:"transformar",alternatives:["converter"],normalized:"morph"},set:{primary:"definir",alternatives:["configurar","defina"],normalized:"set"},get:{primary:"obter",alternatives:["obtenha"],normalized:"get"},increment:{primary:"incrementar",alternatives:["aumentar"],normalized:"increment"},decrement:{primary:"decrementar",alternatives:["diminuir"],normalized:"decrement"},log:{primary:"registrar",alternatives:["imprimir"],normalized:"log"},show:{primary:"mostrar",alternatives:["exibir"],normalized:"show"},hide:{primary:"ocultar",alternatives:["esconder","esconda"],normalized:"hide"},transition:{primary:"transi\xE7\xE3o",alternatives:["animar"],normalized:"transition"},on:{primary:"em",alternatives:["ao"],normalized:"on"},trigger:{primary:"disparar",alternatives:["ativar"],normalized:"trigger"},send:{primary:"enviar",normalized:"send"},focus:{primary:"foco",alternatives:["focar"],normalized:"focus"},blur:{primary:"perda de foco",alternatives:["desfocar"],normalized:"blur"},empty:{primary:"esvaziar",alternatives:["vazio"],normalized:"empty"},open:{primary:"abrir",normalized:"open"},close:{primary:"fechar",normalized:"close"},select:{primary:"selecionar",normalized:"select"},clear:{primary:"limpar",normalized:"clear"},reset:{primary:"redefinir",alternatives:["resetar"],normalized:"reset"},breakpoint:{primary:"ponto-interrup\xE7\xE3o",alternatives:["ponto-interrupcao"],normalized:"breakpoint"},go:{primary:"ir",alternatives:["navegar","v\xE1"],normalized:"go"},scroll:{primary:"rolagem",alternatives:["rolar","deslocamento","scroll"],normalized:"scroll"},push:{primary:"empurrar",alternatives:["push"],normalized:"push"},replace:{primary:"repor",alternatives:["recolocar"],normalized:"replace"},process:{primary:"processar",normalized:"process"},wait:{primary:"esperar",alternatives:["aguardar"],normalized:"wait"},fetch:{primary:"buscar",alternatives:["busque"],normalized:"fetch"},settle:{primary:"estabilizar",normalized:"settle"},if:{primary:"se",normalized:"if"},unless:{primary:"salvo",alternatives:["a_menos"],normalized:"unless"},when:{primary:"quando",normalized:"when"},changes:{primary:"muda",normalized:"changes"},where:{primary:"onde",normalized:"where"},else:{primary:"sen\xE3o",normalized:"else"},repeat:{primary:"repetir",normalized:"repeat"},for:{primary:"para",normalized:"for"},while:{primary:"enquanto",normalized:"while"},forever:{primary:"forever",normalized:"forever"},continue:{primary:"continuar",normalized:"continue"},halt:{primary:"parar",normalized:"halt"},throw:{primary:"lan\xE7ar",normalized:"throw"},call:{primary:"chamar",normalized:"call"},return:{primary:"retornar",alternatives:["devolver"],normalized:"return"},then:{primary:"ent\xE3o",alternatives:["logo"],normalized:"then"},and:{primary:"e",alternatives:["tamb\xE9m","al\xE9m disso"],normalized:"and"},matches:{primary:"corresponde",normalized:"matches"},exists:{primary:"existe",normalized:"exists"},is:{primary:"\xE9",normalized:"is"},no:{primary:"nenhum",normalized:"no"},end:{primary:"fim",alternatives:["final","t\xE9rmino"],normalized:"end"},js:{primary:"js",normalized:"js"},async:{primary:"ass\xEDncrono",normalized:"async"},tell:{primary:"dizer",normalized:"tell"},default:{primary:"padr\xE3o",normalized:"default"},init:{primary:"inicializa\xE7\xE3o",alternatives:["iniciar","inicializar"],normalized:"init"},behavior:{primary:"comportamento",normalized:"behavior"},install:{primary:"instalar",normalized:"install"},measure:{primary:"medir",normalized:"measure"},beep:{primary:"apitar",normalized:"beep"},break:{primary:"interromper",normalized:"break"},copy:{primary:"copiar",normalized:"copy"},exit:{primary:"sair",normalized:"exit"},pick:{primary:"escolher",normalized:"pick"},render:{primary:"renderizar",normalized:"render"},into:{primary:"dentro",alternatives:["dentro de"],normalized:"into"},before:{primary:"antes",normalized:"before"},after:{primary:"depois",normalized:"after"},click:{primary:"clique",alternatives:["clicar"],normalized:"click"},resize:{primary:"redimensionamento",alternatives:["redimensionar"],normalized:"resize"},hover:{primary:"sobrevoar",alternatives:["passar"],normalized:"hover"},submit:{primary:"envio",alternatives:["submeter","submiss\xE3o"],normalized:"submit"},input:{primary:"entrada",alternatives:["inser\xE7\xE3o"],normalized:"input"},change:{primary:"altera\xE7\xE3o",alternatives:["mudan\xE7a"],normalized:"change"},mousedown:{primary:"mouse pressionado",alternatives:["rato pressionado","mouse baixo","mouseBaixo"],normalized:"mousedown"},mouseup:{primary:"mouse solto",alternatives:["mouse liberado","rato libertado","mouse cima","mouseCima"],normalized:"mouseup"},until:{primary:"at\xE9",normalized:"until"},event:{primary:"evento",normalized:"event"},from:{primary:"de",alternatives:["desde"],normalized:"from"},connect:{primary:"conectar",alternatives:["conex\xE3o"],normalized:"connect"},stream:{primary:"transmitir",alternatives:["fluxo"],normalized:"stream"},live:{primary:"ao-vivo",alternatives:["vivo","direto"],normalized:"live"},socket:{primary:"soquete",alternatives:["websocket"],normalized:"socket"},bind:{primary:"vincular",alternatives:["ligar","bind"],normalized:"bind"},intercept:{primary:"interceptar",alternatives:["intercept"],normalized:"intercept"},worker:{primary:"trabalhador",alternatives:["worker"],normalized:"worker"},eventsource:{primary:"eventsource",alternatives:["fonte-de-eventos"],normalized:"eventsource"}},eventHandler:{keyword:{primary:"em",alternatives:["ao"],normalized:"on"},sourceMarker:{primary:"de",alternatives:["desde"],position:"before"},conditionalKeyword:{primary:"quando",alternatives:["se"]},eventMarker:{primary:"ao",alternatives:["no","em"],position:"before"},temporalMarkers:["quando","ao"]}};function Mf(r){return /[\u00e1\u00e0\u00e2\u00e3\u00e9\u00ea\u00ed\u00f3\u00f4\u00f5\u00fa\u00fc\u00e7\u00c1\u00c0\u00c2\u00c3\u00c9\u00ca\u00cd\u00d3\u00d4\u00d5\u00da\u00dc\u00c7]/.test(r)}function If(r){let e=r.toLowerCase();if(e.endsWith("ar")||e.endsWith("er")||e.endsWith("ir")||e.endsWith("ando")||e.endsWith("endo")||e.endsWith("indo")||e.endsWith("ado")||e.endsWith("ido")||e.endsWith("ar-se")||e.endsWith("er-se")||e.endsWith("ir-se"))return true;for(let t of r)if(Mf(t))return true;return false}var to=["-se","-me","-te","-nos","-vos"],$f=[{ending:"ando",stem:"ar",confidence:.88,type:"gerund"},{ending:"ado",stem:"ar",confidence:.88,type:"participle"},{ending:"ada",stem:"ar",confidence:.88,type:"participle"},{ending:"ados",stem:"ar",confidence:.88,type:"participle"},{ending:"adas",stem:"ar",confidence:.88,type:"participle"},{ending:"o",stem:"ar",confidence:.75,type:"present"},{ending:"as",stem:"ar",confidence:.82,type:"present"},{ending:"a",stem:"ar",confidence:.75,type:"present"},{ending:"amos",stem:"ar",confidence:.85,type:"present"},{ending:"ais",stem:"ar",confidence:.85,type:"present"},{ending:"am",stem:"ar",confidence:.8,type:"present"},{ending:"ei",stem:"ar",confidence:.88,type:"past"},{ending:"aste",stem:"ar",confidence:.88,type:"past"},{ending:"ou",stem:"ar",confidence:.88,type:"past"},{ending:"\xE1mos",stem:"ar",confidence:.88,type:"past"},{ending:"amos",stem:"ar",confidence:.85,type:"past"},{ending:"astes",stem:"ar",confidence:.88,type:"past"},{ending:"aram",stem:"ar",confidence:.88,type:"past"},{ending:"ava",stem:"ar",confidence:.88,type:"past"},{ending:"avas",stem:"ar",confidence:.88,type:"past"},{ending:"\xE1vamos",stem:"ar",confidence:.88,type:"past"},{ending:"avamos",stem:"ar",confidence:.85,type:"past"},{ending:"\xE1veis",stem:"ar",confidence:.88,type:"past"},{ending:"aveis",stem:"ar",confidence:.85,type:"past"},{ending:"avam",stem:"ar",confidence:.88,type:"past"},{ending:"e",stem:"ar",confidence:.72,type:"subjunctive"},{ending:"es",stem:"ar",confidence:.78,type:"subjunctive"},{ending:"emos",stem:"ar",confidence:.82,type:"subjunctive"},{ending:"eis",stem:"ar",confidence:.82,type:"subjunctive"},{ending:"em",stem:"ar",confidence:.78,type:"subjunctive"},{ending:"a",stem:"ar",confidence:.75,type:"imperative"},{ending:"ai",stem:"ar",confidence:.85,type:"imperative"},{ending:"ar",stem:"ar",confidence:.92,type:"dictionary"}],jf=[{ending:"endo",stem:"er",confidence:.88,type:"gerund"},{ending:"ido",stem:"er",confidence:.85,type:"participle"},{ending:"ida",stem:"er",confidence:.85,type:"participle"},{ending:"idos",stem:"er",confidence:.85,type:"participle"},{ending:"idas",stem:"er",confidence:.85,type:"participle"},{ending:"o",stem:"er",confidence:.72,type:"present"},{ending:"es",stem:"er",confidence:.78,type:"present"},{ending:"e",stem:"er",confidence:.72,type:"present"},{ending:"emos",stem:"er",confidence:.85,type:"present"},{ending:"eis",stem:"er",confidence:.82,type:"present"},{ending:"em",stem:"er",confidence:.78,type:"present"},{ending:"i",stem:"er",confidence:.85,type:"past"},{ending:"este",stem:"er",confidence:.88,type:"past"},{ending:"eu",stem:"er",confidence:.88,type:"past"},{ending:"emos",stem:"er",confidence:.85,type:"past"},{ending:"estes",stem:"er",confidence:.88,type:"past"},{ending:"eram",stem:"er",confidence:.88,type:"past"},{ending:"ia",stem:"er",confidence:.85,type:"past"},{ending:"ias",stem:"er",confidence:.85,type:"past"},{ending:"\xEDamos",stem:"er",confidence:.88,type:"past"},{ending:"iamos",stem:"er",confidence:.85,type:"past"},{ending:"\xEDeis",stem:"er",confidence:.88,type:"past"},{ending:"ieis",stem:"er",confidence:.85,type:"past"},{ending:"iam",stem:"er",confidence:.85,type:"past"},{ending:"er",stem:"er",confidence:.92,type:"dictionary"}],Wf=[{ending:"indo",stem:"ir",confidence:.88,type:"gerund"},{ending:"ido",stem:"ir",confidence:.85,type:"participle"},{ending:"ida",stem:"ir",confidence:.85,type:"participle"},{ending:"idos",stem:"ir",confidence:.85,type:"participle"},{ending:"idas",stem:"ir",confidence:.85,type:"participle"},{ending:"o",stem:"ir",confidence:.72,type:"present"},{ending:"es",stem:"ir",confidence:.78,type:"present"},{ending:"e",stem:"ir",confidence:.72,type:"present"},{ending:"imos",stem:"ir",confidence:.85,type:"present"},{ending:"is",stem:"ir",confidence:.82,type:"present"},{ending:"em",stem:"ir",confidence:.78,type:"present"},{ending:"i",stem:"ir",confidence:.85,type:"past"},{ending:"iste",stem:"ir",confidence:.88,type:"past"},{ending:"iu",stem:"ir",confidence:.88,type:"past"},{ending:"imos",stem:"ir",confidence:.85,type:"past"},{ending:"istes",stem:"ir",confidence:.88,type:"past"},{ending:"iram",stem:"ir",confidence:.88,type:"past"},{ending:"ia",stem:"ir",confidence:.85,type:"past"},{ending:"ias",stem:"ir",confidence:.85,type:"past"},{ending:"\xEDamos",stem:"ir",confidence:.88,type:"past"},{ending:"iamos",stem:"ir",confidence:.85,type:"past"},{ending:"\xEDeis",stem:"ir",confidence:.88,type:"past"},{ending:"ieis",stem:"ir",confidence:.85,type:"past"},{ending:"iam",stem:"ir",confidence:.85,type:"past"},{ending:"ir",stem:"ir",confidence:.92,type:"dictionary"}],Vf=[...$f,...jf,...Wf].sort((r,e)=>e.ending.length-r.ending.length),ao=class{constructor(){this.language="pt";}isNormalizable(r){return r.length<3?false:If(r)}normalize(r){let e=r.toLowerCase();if((e.endsWith("ar")||e.endsWith("er")||e.endsWith("ir"))&&!to.some(i=>e.endsWith(i)))return De(r);let t=this.tryReflexiveNormalization(e);if(t)return t;let n=this.tryConjugationNormalization(e);return n||De(r)}tryReflexiveNormalization(r){for(let e of to)if(r.endsWith(e)){let t=r.slice(0,-e.length);if(t.endsWith("ar")||t.endsWith("er")||t.endsWith("ir"))return le(t,.88,{removedSuffixes:[e],conjugationType:"reflexive"});let n=this.tryConjugationNormalization(t);if(n&&n.stem!==t)return le(n.stem,n.confidence*.95,{removedSuffixes:[e,...n.metadata?.removedSuffixes||[]],conjugationType:"reflexive"})}return null}tryConjugationNormalization(r){for(let e of Vf)if(r.endsWith(e.ending)){let t=r.slice(0,-e.ending.length);if(t.length<2)continue;let n=t+e.stem;return le(n,e.confidence,{removedSuffixes:[e.ending],conjugationType:e.type})}return null}},qf=["===","!==","->","==","!=","<=",">=","&&","||","**","+=","-=","*=","/=","+","-","*","/","=",">","<","!","&","|","%","^","~"],Kf=class{constructor(r=qf){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}},Hf="()[]{},:;",Uf=class{constructor(r=Hf){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 vn(r,e){let t=e;for(;t<r.length&&r[t]===":";){let n=r.slice(t).match(/^::?[a-zA-Z][a-zA-Z0-9-]*/);if(!n)break;let i=t+n[0].length;if(r[i]==="("){let a=0,o=i;for(;o<r.length;){if(r[o]==="(")a++;else if(r[o]===")"&&(a--,a===0)){o++;break}o++;}if(a!==0)break;i=o;}t=i;}return t}function no(r,e){let t=r[e];if(t==="#"){let n=r.slice(e).match(/^#[a-zA-Z_][\w-]*/);if(!n)return null;let i=vn(r,e+n[0].length);return r.slice(e,i)}if(t==="."){let n=r.slice(e).match(/^\.\{[a-zA-Z_$][\w$]*\}/);if(n)return n[0];let i=r.slice(e).match(/^\.[a-zA-Z_][\w-]*/);if(!i)return null;let a=vn(r,e+i[0].length);return r.slice(e,a)}if(t==="@"){let n=r.slice(e).match(/^@[a-zA-Z_][\w-]*/);return n?n[0]:null}if(t==="*"){let n=r.slice(e).match(/^\*(?:--)?[a-zA-Z_][\w-]*/);return n?n[0]:null}if(t==="["){let n=0,i=e;for(;i<r.length;){if(r[i]==="["&&n++,r[i]==="]"&&(n--,n===0)){let a=vn(r,i+1);return r.slice(e,a)}i++;}return null}if(t==="<"){let n=r.slice(e).match(/^<(?=[\w.#[])[\w-]*(?:[#.][\w-]+|\[[^\]]+\]|::?[a-zA-Z][a-zA-Z0-9-]*(?:\([^)]*\))?)*\s*\/>/);return n?n[0]:null}return null}var Gf=class{constructor(){this.name="css-selector";}canExtract(r,e){let t=r[e];return t==="#"||t==="."||t==="["||t==="<"?true:t==="@"||t==="*"?no(r,e)!==null:false}extract(r,e){let t=no(r,e);return t?{value:t,length:t.length,metadata:{type:"css-selector"}}:null}},Yf=class{constructor(){this.name="event-modifier";}canExtract(r,e){if(r[e]!==".")return false;let t=r.slice(e);return /^\.(once|prevent|stop|debounce|throttle|queue)/.test(t)}extract(r,e){let t=r.slice(e).match(/^\.(?:once|prevent|stop|debounce|throttle|queue)(?:\(([^)]+)\))?/);if(!t)return null;let n=t[0],i=n.slice(1).split("(")[0],a=t[1];return {value:n,length:n.length,metadata:{modifierName:i,value:a?i==="queue"?a:parseInt(a,10):void 0}}}},Zf=["http://","https://","//","./","../","/"];function Xf(r,e){let t=1;for(let n=e;n<r.length;n++){let i=r[n];if(i==="{")t++;else if(i==="}"&&--t===0)return n+1}return -1}function Jf(r,e){let t=r.slice(e),n=Zf.find(a=>t.startsWith(a));if(!n)return null;let i=n.length;for(;i<t.length;){let a=t[i];if(a==="$"&&t[i+1]==="{"){let o=Xf(t,i+2);if(o!==-1){i=o;continue}}if(/\s/.test(a))break;i++;}return t.slice(0,i)}var Qf=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=Jf(r,e);return t?{value:t,length:t.length,metadata:{type:"url"}}:null}},ey=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 ry(){return [new Qf,new Yf,new ey,new Gf]}function ty(r){return {isLetter:n=>r.test(n),isIdentifierChar:n=>/[0-9]/.test(n)||r.test(n)}}var{isLetter:ny,isIdentifierChar:iy}=ty(/[a-zA-Z\u00e1\u00e2\u00e3\u00e9\u00ea\u00ed\u00f3\u00f4\u00f5\u00fa\u00e7\u00c1\u00c2\u00c3\u00c9\u00ca\u00cd\u00d3\u00d4\u00d5\u00da\u00c7]/),ay=new Set(["em","a","de","para","com","sem","por","sobre","entre","antes","depois","dentro","fora","ao","do","da","no","na"]),oy=class{constructor(){this.name="portuguese-keyword";}setContext(r){this.context=r;}canExtract(r,e){return ny(r[e])}extract(r,e){if(!this.context)throw new Error("PortugueseKeywordExtractor: context not set");let t=e,n="";for(;t<r.length&&iy(r[t]);)n+=r[t++];if(!n)return null;let i=n.toLowerCase(),a=ay.has(i),o=this.context.lookupKeyword(i),s=o&&o.normalized!==o.native?o.normalized:void 0,u,l,c;if(!o&&this.context.normalizer){let d=this.context.normalizer.normalize(n);if(d.stem!==n&&d.confidence>=.7){let p=this.context.lookupKeyword(d.stem);p&&(u=p.normalized,l=d.stem,c=d.confidence);}}return {value:n,length:t-e,metadata:{normalized:s||u,stem:l,stemConfidence:c,isPreposition:a}}}};function sy(){return [new oy]}var uy=new Set(["em","a","de","desde","at\xE9","ate","com","sem","por","para","sobre","entre","antes","depois","dentro","fora","ao","do","no","na"]),ly=[{native:"verdadeiro",normalized:"true"},{native:"falso",normalized:"false"},{native:"nulo",normalized:"null"},{native:"indefinido",normalized:"undefined"},{native:"primeiro",normalized:"first"},{native:"primeira",normalized:"first"},{native:"\xFAltimo",normalized:"last"},{native:"ultima",normalized:"last"},{native:"pr\xF3ximo",normalized:"next"},{native:"proximo",normalized:"next"},{native:"anterior",normalized:"previous"},{native:"maispr\xF3ximo",normalized:"closest"},{native:"maisproximo",normalized:"closest"},{native:"pai",normalized:"parent"},{native:"clique",normalized:"click"},{native:"click",normalized:"click"},{native:"entrada",normalized:"input"},{native:"mudan\xE7a",normalized:"change"},{native:"mudanca",normalized:"change"},{native:"envio",normalized:"submit"},{native:"tecla baixo",normalized:"keydown"},{native:"tecla cima",normalized:"keyup"},{native:"mouse sobre",normalized:"mouseover"},{native:"mouse fora",normalized:"mouseout"},{native:"pressionar tecla",normalized:"keydown"},{native:"soltar tecla",normalized:"keyup"},{native:"foco",normalized:"focus"},{native:"desfoque",normalized:"blur"},{native:"carregar",normalized:"load"},{native:"rolagem",normalized:"scroll"},{native:"meu",normalized:"my"},{native:"minha",normalized:"my"},{native:"isso",normalized:"it"},{native:"segundo",normalized:"s"},{native:"segundos",normalized:"s"},{native:"milissegundo",normalized:"ms"},{native:"milissegundos",normalized:"ms"},{native:"minuto",normalized:"m"},{native:"minutos",normalized:"m"},{native:"hora",normalized:"h"},{native:"horas",normalized:"h"},{native:"senao",normalized:"else"},{native:"transicao",normalized:"transition"},{native:"ate",normalized:"until"},{native:"entao",normalized:"then"},{native:"lancar",normalized:"throw"},{native:"assincrono",normalized:"async"},{native:"padrao",normalized:"default"},{native:"at\xE9 que",normalized:"until"},{native:"dentro de",normalized:"into"},{native:"inclusivo",normalized:"inclusive"},{native:"exclusivo",normalized:"exclusive"},{native:"caracteres",normalized:"characters"},{native:"aleat\xF3rio",normalized:"random"}],cy=class extends Pe{constructor(){super(),this.language="pt",this.direction="ltr",this.initializeKeywordsFromProfile(io,ly),this.setNormalizer(new ao),this.registerExtractors(ry()),this.registerExtractor(new Te),this.registerExtractor(new Fe),this.registerExtractors(sy()),this.registerExtractor(new Kf),this.registerExtractor(new Uf);}classifyToken(r){let e=r.toLowerCase();return uy.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"}},dy=new cy;Ie("pt",_f);Me("pt",dy,io);var py={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(py).map(([r,e])=>{let t={};for(let[n,i]of Object.entries(e))i in t||(t[i]=n);return [r,t]}));function my(){return [{id:"event-fr-quand-source",language:"fr",command:"on",priority:115,template:{format:"quand {event} de {source} {body}",tokens:[{type:"literal",value:"quand",alternatives:["lorsque"]},{type:"role",role:"event"},{type:"literal",value:"de",alternatives:["depuis"]},{type:"role",role:"source"}]},extraction:{event:{position:1},source:{marker:"de",markerAlternatives:["depuis"]}}},{id:"event-fr-quand",language:"fr",command:"on",priority:105,template:{format:"quand {event} {body}",tokens:[{type:"literal",value:"quand",alternatives:["lorsque"]},{type:"role",role:"event"}]},extraction:{event:{position:1}}},{id:"event-fr-sur-source",language:"fr",command:"on",priority:110,template:{format:"sur {event} de {source} {body}",tokens:[{type:"literal",value:"sur",alternatives:["lors de"]},{type:"role",role:"event"},{type:"literal",value:"de",alternatives:["depuis"]},{type:"role",role:"source"}]},extraction:{event:{position:1},source:{marker:"de",markerAlternatives:["depuis"]}}},{id:"event-fr-sur",language:"fr",command:"on",priority:100,template:{format:"sur {event} {body}",tokens:[{type:"literal",value:"sur",alternatives:["lors de"]},{type:"role",role:"event"}]},extraction:{event:{position:1}}},{id:"event-fr-si",language:"fr",command:"on",priority:95,template:{format:"si {event} {body}",tokens:[{type:"literal",value:"si"},{type:"role",role:"event"}]},extraction:{event:{position:1}}},{id:"event-fr-a",language:"fr",command:"on",priority:90,template:{format:"\xE0 {event} {body}",tokens:[{type:"literal",value:"\xE0",alternatives:["au"]},{type:"role",role:"event"}]},extraction:{event:{position:1}}}]}var yy=["literal","selector","expression","reference","property-path"];function vy(){return [{id:"show-fr-full",language:"fr",command:"show",priority:100,template:{format:"afficher {patient}",tokens:[{type:"literal",value:"afficher",alternatives:["montrer","pr\xE9senter","show"]},{type:"role",role:"patient",expectedTypes:["selector","reference"]},{type:"group",optional:true,tokens:[{type:"literal",value:"avec"},{type:"role",role:"style",expectedTypes:["expression","selector"]}]}]},extraction:{patient:{position:1},style:{marker:"avec"}}}]}var hn=[...yy];function hy(){return [{id:"set-fr-full",language:"fr",command:"set",priority:100,template:{format:"d\xE9finir {destination} \xE0 {patient}",tokens:[{type:"literal",value:"d\xE9finir",alternatives:["definir","fixer","set"]},{type:"role",role:"destination",expectedTypes:["property-path","selector","reference","expression"]},{type:"literal",value:"\xE0",alternatives:["a","sur","comme"]},{type:"role",role:"patient",expectedTypes:hn}]},extraction:{destination:{position:1},patient:{position:3}}},{id:"set-fr-sur-direct",language:"fr",command:"set",priority:98,template:{format:"d\xE9finir sur {destination} {patient}",tokens:[{type:"literal",value:"d\xE9finir",alternatives:["definir","mettre","fixer"]},{type:"literal",value:"sur",alternatives:["\xE0","en"]},{type:"role",role:"destination",expectedTypes:["property-path","selector","reference","expression"]},{type:"role",role:"patient",expectedTypes:hn}]},extraction:{destination:{position:2},patient:{position:3}}},{id:"set-fr-equals",language:"fr",command:"set",priority:95,template:{format:"{destination} = {patient}",tokens:[{type:"role",role:"destination",expectedTypes:["property-path","selector","reference","expression"]},{type:"literal",value:"="},{type:"role",role:"patient",expectedTypes:hn}]},extraction:{destination:{position:0},patient:{position:2}}}]}function Ey(r){let e=r?.roleMarkers?.style;if(!e?.primary)return null;let t={type:"literal",value:e.primary,...e.alternatives?.length?{alternatives:e.alternatives}:{}},n={type:"role",role:"style",expectedTypes:["expression"]};return {token:{type:"group",optional:true,tokens:e.position==="after"?[n,t]:[t,n]},extraction:{marker:e.primary,...e.alternatives?.length?{markerAlternatives:e.alternatives}:{}}}}function gy(r){let e=Ey(r);return [{id:"fetch-fr",language:"fr",command:"fetch",priority:105,template:{format:"chercher de {source} comme {responseType}",tokens:[{type:"literal",value:"chercher",alternatives:["r\xE9cup\xE9rer"]},{type:"group",optional:true,tokens:[{type:"literal",value:"de"}]},{type:"role",role:"source",expectedTypes:["literal","expression"]},...e?[e.token]:[],{type:"group",optional:true,tokens:[{type:"literal",value:"comme"},{type:"role",role:"responseType",expectedTypes:["literal","expression"]}]}]},extraction:{source:{marker:"de"},responseType:{marker:"comme"},...e?{style:e.extraction}:{}}}]}var ky=[["event-handler",my],["show",vy],["set",hy],["fetch",gy]],so={code:"fr",name:"French",nativeName:"Fran\xE7ais",regions:["western","priority"],direction:"ltr",script:"latin",wordOrder:"SVO",markingStrategy:"preposition",usesSpaces:true,defaultVerbForm:"infinitive",verb:{position:"start",subjectDrop:false},references:{me:"moi",it:"il",you:"toi",result:"r\xE9sultat",event:"\xE9v\xE9nement",target:"cible",body:"corps",document:"document",window:"fen\xEAtre",detail:"d\xE9tail"},possessive:{marker:"de",markerPosition:"before-property",usePossessiveAdjectives:true,specialForms:{me:"ma",it:"sa",you:"ta"},keywords:{mon:"me",ma:"me",mes:"me",ton:"you",ta:"you",tes:"you",son:"it",sa:"it",ses:"it"}},roleMarkers:{destination:{primary:"sur",alternatives:["\xE0","dans"],position:"before"},source:{primary:"de",alternatives:["depuis"],position:"before"},patient:{primary:"",position:"before"},style:{primary:"avec",position:"before"}},keywords:{toggle:{primary:"basculer",alternatives:["alterner"],normalized:"toggle"},add:{primary:"ajouter",normalized:"add"},remove:{primary:"supprimer",alternatives:["enlever","retirer","retire"],normalized:"remove"},put:{primary:"mettre",alternatives:["placer","mets"],normalized:"put"},append:{primary:"annexer",normalized:"append"},prepend:{primary:"pr\xE9fixer",normalized:"prepend"},take:{primary:"prendre",normalized:"take"},make:{primary:"faire",alternatives:["cr\xE9er"],normalized:"make"},clone:{primary:"cloner",alternatives:["dupliquer"],normalized:"clone"},swap:{primary:"\xE9changer",alternatives:["permuter"],normalized:"swap"},morph:{primary:"transformer",alternatives:["m\xE9tamorphoser"],normalized:"morph"},set:{primary:"d\xE9finir",alternatives:["\xE9tablir"],normalized:"set"},get:{primary:"obtenir",alternatives:["obtiens"],normalized:"get"},increment:{primary:"incr\xE9menter",alternatives:["augmenter"],normalized:"increment"},decrement:{primary:"d\xE9cr\xE9menter",alternatives:["diminuer"],normalized:"decrement"},log:{primary:"enregistrer",alternatives:["journaliser"],normalized:"log"},show:{primary:"montrer",alternatives:["afficher","montre"],normalized:"show"},hide:{primary:"cacher",alternatives:["masquer"],normalized:"hide"},transition:{primary:"transition",alternatives:["animer"],normalized:"transition"},on:{primary:"sur",alternatives:["lors"],normalized:"on"},trigger:{primary:"d\xE9clencher",normalized:"trigger"},send:{primary:"envoyer",alternatives:["envoie"],normalized:"send"},focus:{primary:"focaliser",alternatives:["concentrer"],normalized:"focus"},blur:{primary:"perte de focus",alternatives:["d\xE9focaliser"],normalized:"blur"},empty:{primary:"vider",alternatives:["vide"],normalized:"empty"},open:{primary:"ouvrir",normalized:"open"},close:{primary:"fermer",normalized:"close"},select:{primary:"s\xE9lectionner",alternatives:["selectionner"],normalized:"select"},clear:{primary:"effacer",normalized:"clear"},reset:{primary:"r\xE9initialiser",alternatives:["reinitialiser"],normalized:"reset"},breakpoint:{primary:"point-arr\xEAt",alternatives:["point-arret"],normalized:"breakpoint"},go:{primary:"aller",alternatives:["naviguer","va"],normalized:"go"},scroll:{primary:"d\xE9filement",alternatives:["defilement","d\xE9filer","faire-d\xE9filer"],normalized:"scroll"},push:{primary:"pousser",normalized:"push"},replace:{primary:"remplacer",normalized:"replace"},process:{primary:"traiter",normalized:"process"},wait:{primary:"attendre",normalized:"wait"},fetch:{primary:"chercher",alternatives:["r\xE9cup\xE9rer","r\xE9cup\xE8re"],normalized:"fetch"},settle:{primary:"stabiliser",normalized:"settle"},if:{primary:"si",normalized:"if"},unless:{primary:"saufsi",normalized:"unless"},when:{primary:"quand",normalized:"when"},changes:{primary:"change",normalized:"changes"},where:{primary:"o\xF9",normalized:"where"},else:{primary:"sinon",normalized:"else"},repeat:{primary:"r\xE9p\xE9ter",normalized:"repeat"},for:{primary:"pour",normalized:"for"},while:{primary:"pendant",normalized:"while"},forever:{primary:"forever",normalized:"forever"},continue:{primary:"continuer",normalized:"continue"},halt:{primary:"arr\xEAter",alternatives:["stopper"],normalized:"halt"},throw:{primary:"lancer",normalized:"throw"},call:{primary:"appeler",normalized:"call"},return:{primary:"retourner",alternatives:["renvoyer"],normalized:"return"},then:{primary:"puis",alternatives:["ensuite","alors"],normalized:"then"},and:{primary:"et",alternatives:["aussi","\xE9galement"],normalized:"and"},matches:{primary:"correspond",normalized:"matches"},exists:{primary:"existe",normalized:"exists"},is:{primary:"est",normalized:"is"},no:{primary:"aucun",normalized:"no"},end:{primary:"fin",alternatives:["terminer","finir"],normalized:"end"},js:{primary:"js",normalized:"js"},async:{primary:"asynchrone",normalized:"async"},tell:{primary:"dire",normalized:"tell"},default:{primary:"d\xE9faut",normalized:"default"},init:{primary:"initialiser",normalized:"init"},behavior:{primary:"comportement",normalized:"behavior"},install:{primary:"installer",normalized:"install"},measure:{primary:"mesurer",normalized:"measure"},beep:{primary:"bip",normalized:"beep"},break:{primary:"interrompre",normalized:"break"},copy:{primary:"copier",normalized:"copy"},exit:{primary:"sortir",normalized:"exit"},pick:{primary:"choisir",normalized:"pick"},render:{primary:"rendu",normalized:"render"},into:{primary:"dans",normalized:"into"},before:{primary:"avant",normalized:"before"},after:{primary:"apr\xE8s",normalized:"after"},click:{primary:"clic",alternatives:["clique"],normalized:"click"},resize:{primary:"redimensionnement",alternatives:["redimensionner"],normalized:"resize"},hover:{primary:"survol",alternatives:["survoler"],normalized:"hover"},submit:{primary:"soumission",alternatives:["soumettre"],normalized:"submit"},input:{primary:"saisie",alternatives:["entr\xE9e"],normalized:"input"},change:{primary:"changement",alternatives:["modifier","changer"],normalized:"change"},load:{primary:"charger",alternatives:["chargement"],normalized:"load"},until:{primary:"jusqu'\xE0",alternatives:["jusque"],normalized:"until"},event:{primary:"\xE9v\xE9nement",normalized:"event"},from:{primary:"de",alternatives:["depuis"],normalized:"from"},connect:{primary:"connecter",alternatives:["connexion"],normalized:"connect"},stream:{primary:"flux",alternatives:["streaming"],normalized:"stream"},live:{primary:"en-direct",alternatives:["direct","vif"],normalized:"live"},socket:{primary:"socket",alternatives:["websocket"],normalized:"socket"},bind:{primary:"lier",alternatives:["relier","bind"],normalized:"bind"},intercept:{primary:"intercepter",alternatives:["intercept"],normalized:"intercept"},worker:{primary:"travailleur",alternatives:["worker"],normalized:"worker"},eventsource:{primary:"eventsource",alternatives:["source-d-evenements"],normalized:"eventsource"}},eventHandler:{keyword:{primary:"sur",alternatives:["lors"],normalized:"on"},sourceMarker:{primary:"de",alternatives:["depuis"],position:"before"},conditionalKeyword:{primary:"quand",alternatives:["lorsque"]},eventMarker:{primary:"au",alternatives:["lors du","lors de","sur"],position:"before"},temporalMarkers:["quand","lorsque"]}};function wy(r){let e=r.toLowerCase();return !!(e.endsWith("er")||e.endsWith("ir")||e.endsWith("re")||e.endsWith("ant")||e.endsWith("\xE9")||e.endsWith("i")||e.endsWith("u")||/[\u00e0\u00e2\u00e4\u00e9\u00e8\u00ea\u00eb\u00ef\u00ee\u00f4\u00f9\u00fb\u00fc\u00ff\u00e7\u0153\u00e6]/i.test(r))}var zy=["toi","vous","nous"],by=[{ending:"ant",stem:"er",confidence:.88,type:"gerund"},{ending:"\xE9",stem:"er",confidence:.88,type:"participle"},{ending:"\xE9e",stem:"er",confidence:.88,type:"participle"},{ending:"\xE9s",stem:"er",confidence:.88,type:"participle"},{ending:"\xE9es",stem:"er",confidence:.88,type:"participle"},{ending:"e",stem:"er",confidence:.75,type:"present"},{ending:"es",stem:"er",confidence:.78,type:"present"},{ending:"ons",stem:"er",confidence:.85,type:"present"},{ending:"ez",stem:"er",confidence:.85,type:"present"},{ending:"ent",stem:"er",confidence:.82,type:"present"},{ending:"ais",stem:"er",confidence:.82,type:"past"},{ending:"ait",stem:"er",confidence:.82,type:"past"},{ending:"ions",stem:"er",confidence:.85,type:"past"},{ending:"iez",stem:"er",confidence:.85,type:"past"},{ending:"aient",stem:"er",confidence:.85,type:"past"},{ending:"ai",stem:"er",confidence:.8,type:"past"},{ending:"as",stem:"er",confidence:.78,type:"past"},{ending:"a",stem:"er",confidence:.75,type:"past"},{ending:"\xE2mes",stem:"er",confidence:.88,type:"past"},{ending:"\xE2tes",stem:"er",confidence:.88,type:"past"},{ending:"\xE8rent",stem:"er",confidence:.88,type:"past"},{ending:"erai",stem:"er",confidence:.85,type:"future"},{ending:"eras",stem:"er",confidence:.85,type:"future"},{ending:"era",stem:"er",confidence:.82,type:"future"},{ending:"erons",stem:"er",confidence:.88,type:"future"},{ending:"erez",stem:"er",confidence:.88,type:"future"},{ending:"eront",stem:"er",confidence:.88,type:"future"},{ending:"erais",stem:"er",confidence:.85,type:"conditional"},{ending:"erait",stem:"er",confidence:.85,type:"conditional"},{ending:"erions",stem:"er",confidence:.88,type:"conditional"},{ending:"eriez",stem:"er",confidence:.88,type:"conditional"},{ending:"eraient",stem:"er",confidence:.88,type:"conditional"},{ending:"ions",stem:"er",confidence:.8,type:"subjunctive"},{ending:"iez",stem:"er",confidence:.8,type:"subjunctive"},{ending:"ons",stem:"er",confidence:.82,type:"imperative"},{ending:"ez",stem:"er",confidence:.82,type:"imperative"},{ending:"er",stem:"er",confidence:.92,type:"dictionary"}],Cy=[{ending:"issant",stem:"ir",confidence:.88,type:"gerund"},{ending:"i",stem:"ir",confidence:.8,type:"participle"},{ending:"ie",stem:"ir",confidence:.82,type:"participle"},{ending:"is",stem:"ir",confidence:.78,type:"participle"},{ending:"ies",stem:"ir",confidence:.82,type:"participle"},{ending:"is",stem:"ir",confidence:.78,type:"present"},{ending:"it",stem:"ir",confidence:.78,type:"present"},{ending:"issons",stem:"ir",confidence:.88,type:"present"},{ending:"issez",stem:"ir",confidence:.88,type:"present"},{ending:"issent",stem:"ir",confidence:.88,type:"present"},{ending:"issais",stem:"ir",confidence:.85,type:"past"},{ending:"issait",stem:"ir",confidence:.85,type:"past"},{ending:"issions",stem:"ir",confidence:.88,type:"past"},{ending:"issiez",stem:"ir",confidence:.88,type:"past"},{ending:"issaient",stem:"ir",confidence:.88,type:"past"},{ending:"irai",stem:"ir",confidence:.85,type:"future"},{ending:"iras",stem:"ir",confidence:.85,type:"future"},{ending:"ira",stem:"ir",confidence:.82,type:"future"},{ending:"irons",stem:"ir",confidence:.88,type:"future"},{ending:"irez",stem:"ir",confidence:.88,type:"future"},{ending:"iront",stem:"ir",confidence:.88,type:"future"},{ending:"ir",stem:"ir",confidence:.9,type:"dictionary"}],Ay=[{ending:"ant",stem:"re",confidence:.82,type:"gerund"},{ending:"u",stem:"re",confidence:.8,type:"participle"},{ending:"ue",stem:"re",confidence:.82,type:"participle"},{ending:"us",stem:"re",confidence:.82,type:"participle"},{ending:"ues",stem:"re",confidence:.82,type:"participle"},{ending:"s",stem:"re",confidence:.72,type:"present"},{ending:"d",stem:"re",confidence:.75,type:"present"},{ending:"ons",stem:"re",confidence:.82,type:"present"},{ending:"ez",stem:"re",confidence:.82,type:"present"},{ending:"ent",stem:"re",confidence:.8,type:"present"},{ending:"re",stem:"re",confidence:.9,type:"dictionary"}],xy=[...by,...Cy,...Ay].sort((r,e)=>e.ending.length-r.ending.length),uo=class{constructor(){this.language="fr";}isNormalizable(r){return r.length<3?false:wy(r)}normalize(r){let e=r.toLowerCase();if((e.endsWith("er")||e.endsWith("ir")||e.endsWith("re"))&&e.length>=4)return De(r);let t=this.tryReflexiveNormalization(e);if(t)return t;let n=this.tryConjugationNormalization(e);return n||De(r)}tryReflexiveNormalization(r){for(let e of zy){let t="-"+e;if(r.endsWith(t)){let n=r.slice(0,-t.length),i=this.tryConjugationNormalization(n);if(i&&i.stem!==n)return le(i.stem,i.confidence*.95,{removedSuffixes:[t,...i.metadata?.removedSuffixes||[]],conjugationType:"reflexive"})}}return null}tryConjugationNormalization(r){for(let e of xy)if(r.endsWith(e.ending)){let t=r.slice(0,-e.ending.length);if(t.length<2)continue;let n=t+e.stem;return le(n,e.confidence,{removedSuffixes:[e.ending],conjugationType:e.type})}return null}},Dy=["===","!==","->","==","!=","<=",">=","&&","||","**","+=","-=","*=","/=","+","-","*","/","=",">","<","!","&","|","%","^","~"],Sy=class{constructor(r=Dy){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}},By="()[]{},:;",Ty=class{constructor(r=By){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 En(r,e){let t=e;for(;t<r.length&&r[t]===":";){let n=r.slice(t).match(/^::?[a-zA-Z][a-zA-Z0-9-]*/);if(!n)break;let i=t+n[0].length;if(r[i]==="("){let a=0,o=i;for(;o<r.length;){if(r[o]==="(")a++;else if(r[o]===")"&&(a--,a===0)){o++;break}o++;}if(a!==0)break;i=o;}t=i;}return t}function oo(r,e){let t=r[e];if(t==="#"){let n=r.slice(e).match(/^#[a-zA-Z_][\w-]*/);if(!n)return null;let i=En(r,e+n[0].length);return r.slice(e,i)}if(t==="."){let n=r.slice(e).match(/^\.\{[a-zA-Z_$][\w$]*\}/);if(n)return n[0];let i=r.slice(e).match(/^\.[a-zA-Z_][\w-]*/);if(!i)return null;let a=En(r,e+i[0].length);return r.slice(e,a)}if(t==="@"){let n=r.slice(e).match(/^@[a-zA-Z_][\w-]*/);return n?n[0]:null}if(t==="*"){let n=r.slice(e).match(/^\*(?:--)?[a-zA-Z_][\w-]*/);return n?n[0]:null}if(t==="["){let n=0,i=e;for(;i<r.length;){if(r[i]==="["&&n++,r[i]==="]"&&(n--,n===0)){let a=En(r,i+1);return r.slice(e,a)}i++;}return null}if(t==="<"){let n=r.slice(e).match(/^<(?=[\w.#[])[\w-]*(?:[#.][\w-]+|\[[^\]]+\]|::?[a-zA-Z][a-zA-Z0-9-]*(?:\([^)]*\))?)*\s*\/>/);return n?n[0]:null}return null}var Fy=class{constructor(){this.name="css-selector";}canExtract(r,e){let t=r[e];return t==="#"||t==="."||t==="["||t==="<"?true:t==="@"||t==="*"?oo(r,e)!==null:false}extract(r,e){let t=oo(r,e);return t?{value:t,length:t.length,metadata:{type:"css-selector"}}:null}},Py=class{constructor(){this.name="event-modifier";}canExtract(r,e){if(r[e]!==".")return false;let t=r.slice(e);return /^\.(once|prevent|stop|debounce|throttle|queue)/.test(t)}extract(r,e){let t=r.slice(e).match(/^\.(?:once|prevent|stop|debounce|throttle|queue)(?:\(([^)]+)\))?/);if(!t)return null;let n=t[0],i=n.slice(1).split("(")[0],a=t[1];return {value:n,length:n.length,metadata:{modifierName:i,value:a?i==="queue"?a:parseInt(a,10):void 0}}}},Oy=["http://","https://","//","./","../","/"];function Ry(r,e){let t=1;for(let n=e;n<r.length;n++){let i=r[n];if(i==="{")t++;else if(i==="}"&&--t===0)return n+1}return -1}function Ly(r,e){let t=r.slice(e),n=Oy.find(a=>t.startsWith(a));if(!n)return null;let i=n.length;for(;i<t.length;){let a=t[i];if(a==="$"&&t[i+1]==="{"){let o=Ry(t,i+2);if(o!==-1){i=o;continue}}if(/\s/.test(a))break;i++;}return t.slice(0,i)}var Ny=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=Ly(r,e);return t?{value:t,length:t.length,metadata:{type:"url"}}:null}},_y=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 My(){return [new Ny,new Py,new _y,new Fy]}function Iy(r){return {isLetter:n=>r.test(n),isIdentifierChar:n=>/[0-9]/.test(n)||r.test(n)}}var{isLetter:$y,isIdentifierChar:jy}=Iy(/[a-zA-Z\u00e0\u00e2\u00e6\u00e7\u00e9\u00e8\u00ea\u00eb\u00ef\u00ee\u00f4\u00f9\u00fb\u00fc\u00ff\u0153\u00c0\u00c2\u00c6\u00c7\u00c9\u00c8\u00ca\u00cb\u00cf\u00ce\u00d4\u00d9\u00db\u00dc\u0178\u0152]/),Wy=new Set(["\xE0","a","de","du","des","dans","sur","sous","avec","sans","par","pour","entre","avant","apr\xE8s","apres","depuis","vers","chez","contre","au","aux"]),Vy=class{constructor(){this.name="french-keyword";}setContext(r){this.context=r;}canExtract(r,e){return $y(r[e])}extract(r,e){if(!this.context)throw new Error("FrenchKeywordExtractor: context not set");let t=e,n="";for(;t<r.length&&jy(r[t]);)n+=r[t++];if(!n)return null;let i=n.toLowerCase(),a=Wy.has(i),o=this.context.lookupKeyword(i),s=o&&o.normalized!==o.native?o.normalized:void 0,u,l,c;if(!o&&this.context.normalizer){let d=this.context.normalizer.normalize(n);if(d.stem!==n&&d.confidence>=.7){let p=this.context.lookupKeyword(d.stem);p&&(u=p.normalized,l=d.stem,c=d.confidence);}}return {value:n,length:t-e,metadata:{normalized:s||u,stem:l,stemConfidence:c,isPreposition:a}}}};function qy(){return [new Vy]}var Ky=[{native:"vrai",normalized:"true"},{native:"faux",normalized:"false"},{native:"nul",normalized:"null"},{native:"ind\xE9fini",normalized:"undefined"},{native:"indefini",normalized:"undefined"},{native:"premier",normalized:"first"},{native:"premi\xE8re",normalized:"first"},{native:"premiere",normalized:"first"},{native:"dernier",normalized:"last"},{native:"derni\xE8re",normalized:"last"},{native:"derniere",normalized:"last"},{native:"suivant",normalized:"next"},{native:"pr\xE9c\xE9dent",normalized:"previous"},{native:"precedent",normalized:"previous"},{native:"proche",normalized:"closest"},{native:"parent",normalized:"parent"},{native:"clic",normalized:"click"},{native:"click",normalized:"click"},{native:"entr\xE9e",normalized:"input"},{native:"entree",normalized:"input"},{native:"changement",normalized:"change"},{native:"soumission",normalized:"submit"},{native:"touche bas",normalized:"keydown"},{native:"touche haut",normalized:"keyup"},{native:"souris dessus",normalized:"mouseover"},{native:"souris dehors",normalized:"mouseout"},{native:"focus",normalized:"focus"},{native:"flou",normalized:"blur"},{native:"chargement",normalized:"load"},{native:"d\xE9filement",normalized:"scroll"},{native:"defilement",normalized:"scroll"},{native:"je",normalized:"me"},{native:"mon",normalized:"my"},{native:"ma",normalized:"my"},{native:"mes",normalized:"my"},{native:"\xE7a",normalized:"it"},{native:"ca",normalized:"it"},{native:"resultat",normalized:"result"},{native:"evenement",normalized:"event"},{native:"seconde",normalized:"s"},{native:"secondes",normalized:"s"},{native:"milliseconde",normalized:"ms"},{native:"millisecondes",normalized:"ms"},{native:"minute",normalized:"m"},{native:"minutes",normalized:"m"},{native:"heure",normalized:"h"},{native:"heures",normalized:"h"},{native:"prefixer",normalized:"prepend"},{native:"creer",normalized:"make"},{native:"definir",normalized:"set"},{native:"etablir",normalized:"set"},{native:"incrementer",normalized:"increment"},{native:"decrementer",normalized:"decrement"},{native:"declencher",normalized:"trigger"},{native:"defocaliser",normalized:"blur"},{native:"recuperer",normalized:"fetch"},{native:"repeter",normalized:"repeat"},{native:"arreter",normalized:"halt"},{native:"defaut",normalized:"default"},{native:"jusqua",normalized:"until"},{native:"apres",normalized:"after"},{native:"journaliser",normalized:"log"},{native:"transmuter",normalized:"morph"},{native:"tant que",normalized:"while"},{native:"inclusif",normalized:"inclusive"},{native:"exclusif",normalized:"exclusive"},{native:"caract\xE8res",normalized:"characters"},{native:"al\xE9atoire",normalized:"random"}],Hy=class extends Pe{constructor(){super(),this.language="fr",this.direction="ltr",this.initializeKeywordsFromProfile(so,Ky),this.normalizer=new uo,this.registerExtractors(My()),this.registerExtractor(new Te),this.registerExtractor(new Fe),this.registerExtractors(qy()),this.registerExtractor(new Sy),this.registerExtractor(new Ty);}classifyToken(r){return this.isKeyword(r)?"keyword":/^\.(once|prevent|stop|debounce|throttle|queue)(\(.*\))?$/.test(r)?"event-modifier":r.startsWith("#")||r.startsWith(".")||r.startsWith("[")||r.startsWith("*")||r.startsWith("<")?"selector":r.startsWith('"')||r.startsWith("'")||/^\d/.test(r)?"literal":["==","!=","<=",">=","<",">","&&","||","!"].includes(r)?"operator":r.startsWith("/")||r.startsWith("./")||r.startsWith("http")?"url":"identifier"}},Uy=new Hy;Ie("fr",ky);Me("fr",Uy,so);var Gy={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(Gy).map(([r,e])=>{let t={};for(let[n,i]of Object.entries(e))i in t||(t[i]=n);return [r,t]}));function Yy(){return [{id:"event-de-wenn-source",language:"de",command:"on",priority:115,template:{format:"wenn {event} von {source} {body}",tokens:[{type:"literal",value:"wenn",alternatives:["falls","sobald"]},{type:"role",role:"event"},{type:"literal",value:"von",alternatives:["aus"]},{type:"role",role:"source"}]},extraction:{event:{position:1},source:{marker:"von",markerAlternatives:["aus"]}}},{id:"event-de-wenn",language:"de",command:"on",priority:105,template:{format:"wenn {event} {body}",tokens:[{type:"literal",value:"wenn",alternatives:["falls","sobald"]},{type:"role",role:"event"}]},extraction:{event:{position:1}}},{id:"event-de-bei-source",language:"de",command:"on",priority:110,template:{format:"bei {event} von {source} {body}",tokens:[{type:"literal",value:"bei",alternatives:["beim"]},{type:"role",role:"event"},{type:"literal",value:"von",alternatives:["aus"]},{type:"role",role:"source"}]},extraction:{event:{position:1},source:{marker:"von",markerAlternatives:["aus"]}}},{id:"event-de-bei",language:"de",command:"on",priority:100,template:{format:"bei {event} {body}",tokens:[{type:"literal",value:"bei",alternatives:["beim"]},{type:"role",role:"event"}]},extraction:{event:{position:1}}},{id:"event-de-auf",language:"de",command:"on",priority:95,template:{format:"auf {event} {body}",tokens:[{type:"literal",value:"auf"},{type:"role",role:"event"}]},extraction:{event:{position:1}}},{id:"event-de-im-falle",language:"de",command:"on",priority:90,template:{format:"im Falle von {event} {body}",tokens:[{type:"literal",value:"im Falle von",alternatives:["im Fall von"]},{type:"role",role:"event"}]},extraction:{event:{position:1}}}]}var co=["selector","reference","expression"],Zy=["literal","selector","expression","reference","property-path"],Xy=["literal","selector","reference","expression","property-path"],Jy=[...co];function Qy(){return [{id:"show-de-full",language:"de",command:"show",priority:100,template:{format:"zeige {patient}",tokens:[{type:"literal",value:"zeige",alternatives:["zeigen","anzeigen","show"]},{type:"role",role:"patient",expectedTypes:Jy},{type:"group",optional:true,tokens:[{type:"literal",value:"mit"},{type:"role",role:"style",expectedTypes:["expression","selector"]}]}]},extraction:{patient:{position:1},style:{marker:"mit"}}}]}var ev=[...co];function rv(){return [{id:"hide-de-full",language:"de",command:"hide",priority:100,template:{format:"verstecke {patient}",tokens:[{type:"literal",value:"verstecke",alternatives:["verstecken","verberge","verbergen","hide"]},{type:"role",role:"patient",expectedTypes:ev},{type:"group",optional:true,tokens:[{type:"literal",value:"mit"},{type:"role",role:"style",expectedTypes:["expression","selector"]}]}]},extraction:{patient:{position:1},style:{marker:"mit"}}}]}var gn=[...Zy];function tv(){return [{id:"set-de-full",language:"de",command:"set",priority:100,template:{format:"setze {destination} auf {patient}",tokens:[{type:"literal",value:"setze",alternatives:["set"]},{type:"role",role:"destination",expectedTypes:["property-path","selector","reference","expression"]},{type:"literal",value:"auf",alternatives:["zu","an"]},{type:"role",role:"patient",expectedTypes:gn}]},extraction:{destination:{position:1},patient:{position:3}}},{id:"set-de-festlegen-auf",language:"de",command:"set",priority:99,template:{format:"festlegen auf {destination} {patient}",tokens:[{type:"literal",value:"festlegen",alternatives:["einstellen"]},{type:"literal",value:"auf",alternatives:["an"]},{type:"role",role:"destination",expectedTypes:["property-path","selector","reference","expression"]},{type:"role",role:"patient",expectedTypes:gn}]},extraction:{destination:{position:2},patient:{position:3}}},{id:"set-de-equals",language:"de",command:"set",priority:95,template:{format:"{destination} = {patient}",tokens:[{type:"role",role:"destination",expectedTypes:["property-path","selector","reference","expression"]},{type:"literal",value:"="},{type:"role",role:"patient",expectedTypes:gn}]},extraction:{destination:{position:0},patient:{position:2}}}]}var nv=[...Xy];function iv(){return [{id:"get-de-full",language:"de",command:"get",priority:100,template:{format:"hole {source}",tokens:[{type:"literal",value:"hole",alternatives:["holen","get","bekomme","bekommen"]},{type:"role",role:"source",expectedTypes:nv}]},extraction:{source:{position:1}}}]}var mt=["selector","reference","expression","property-path"];function av(){let r=["erhoehe","erh\xF6hen","inkrementiere","inkrementieren","increment"];return [{id:"increment-de-with-quantity",language:"de",command:"increment",priority:105,template:{format:"erh\xF6he {patient} um {quantity}",tokens:[{type:"literal",value:"erh\xF6he",alternatives:r},{type:"role",role:"patient",expectedTypes:mt},{type:"literal",value:"um"},{type:"role",role:"quantity"}]},extraction:{patient:{position:1},quantity:{marker:"um",position:3}}},{id:"increment-de-full",language:"de",command:"increment",priority:100,template:{format:"erh\xF6he {patient}",tokens:[{type:"literal",value:"erh\xF6he",alternatives:r},{type:"role",role:"patient",expectedTypes:mt}]},extraction:{patient:{position:1}}}]}function ov(){let r=["verringern","dekrementiere","dekrementieren","reduziere","decrement"];return [{id:"decrement-de-with-quantity",language:"de",command:"decrement",priority:105,template:{format:"verringere {patient} um {quantity}",tokens:[{type:"literal",value:"verringere",alternatives:r},{type:"role",role:"patient",expectedTypes:mt},{type:"literal",value:"um"},{type:"role",role:"quantity"}]},extraction:{patient:{position:1},quantity:{marker:"um",position:3}}},{id:"decrement-de-full",language:"de",command:"decrement",priority:100,template:{format:"verringere {patient}",tokens:[{type:"literal",value:"verringere",alternatives:r},{type:"role",role:"patient",expectedTypes:mt}]},extraction:{patient:{position:1}}}]}function sv(r){let e=r?.roleMarkers?.style;if(!e?.primary)return null;let t={type:"literal",value:e.primary,...e.alternatives?.length?{alternatives:e.alternatives}:{}},n={type:"role",role:"style",expectedTypes:["expression"]};return {token:{type:"group",optional:true,tokens:e.position==="after"?[n,t]:[t,n]},extraction:{marker:e.primary,...e.alternatives?.length?{markerAlternatives:e.alternatives}:{}}}}function uv(r,e,t,n,i,a,o,s,u){let l=sv(r);return {id:e,language:t,command:"fetch",priority:105,template:{format:`${n} ${i} {source} ${a} {responseType}`,tokens:[{type:"literal",value:n,...o?{alternatives:o}:{}},{type:"group",optional:true,tokens:[{type:"literal",value:i,...{}}]},{type:"role",role:"source",expectedTypes:["literal","expression"]},...l?[l.token]:[],{type:"group",optional:true,tokens:[{type:"literal",value:a,...{}},{type:"role",role:"responseType",expectedTypes:["literal","expression"]}]}]},extraction:{source:{marker:i,...{}},...l?{style:l.extraction}:{},responseType:{marker:a,...{}}}}}function lv(r){return [uv(r,"fetch-de","de","abrufen","von","als",["laden"])]}var cv=[["event-handler",Yy],["show",Qy],["hide",rv],["set",tv],["get",iv],["increment",av],["decrement",ov],["fetch",lv]],po={code:"de",name:"German",nativeName:"Deutsch",regions:["western","priority"],direction:"ltr",script:"latin",wordOrder:"SVO",markingStrategy:"preposition",usesSpaces:true,defaultVerbForm:"infinitive",verb:{position:"start",subjectDrop:false},references:{me:"ich",it:"es",you:"du",result:"Ergebnis",event:"Ereignis",target:"Ziel",body:"K\xF6rper",document:"dokument",window:"fenster",detail:"detail"},possessive:{marker:"",markerPosition:"before-property",usePossessiveAdjectives:true,specialForms:{me:"mein",it:"sein",you:"dein"},keywords:{mein:"me",meine:"me",meinen:"me",dein:"you",deine:"you",deinen:"you",sein:"it",seine:"it",seinen:"it"}},roleMarkers:{destination:{primary:"auf",alternatives:["zu","in"],position:"before"},source:{primary:"von",alternatives:["aus"],position:"before"},patient:{primary:"",position:"before"},style:{primary:"mit",position:"before"}},keywords:{toggle:{primary:"umschalten",alternatives:["wechseln"],normalized:"toggle"},add:{primary:"hinzuf\xFCgen",normalized:"add"},remove:{primary:"entfernen",alternatives:["l\xF6schen"],normalized:"remove"},put:{primary:"setzen",alternatives:["stellen","platzieren"],normalized:"put"},append:{primary:"anh\xE4ngen",normalized:"append"},prepend:{primary:"voranstellen",normalized:"prepend"},take:{primary:"nehmen",normalized:"take"},make:{primary:"machen",alternatives:["erstellen","erzeugen"],normalized:"make"},clone:{primary:"klonen",alternatives:["duplizieren"],normalized:"clone"},swap:{primary:"austauschen",alternatives:["tauschen","vertauschen"],normalized:"swap"},morph:{primary:"verwandeln",alternatives:["transformieren"],normalized:"morph"},set:{primary:"festlegen",alternatives:["definieren"],normalized:"set"},get:{primary:"holen",alternatives:["bekommen","erhalten"],normalized:"get"},increment:{primary:"erh\xF6hen",normalized:"increment"},decrement:{primary:"verringern",alternatives:["vermindern"],normalized:"decrement"},log:{primary:"protokollieren",alternatives:["ausgeben"],normalized:"log"},show:{primary:"zeigen",alternatives:["anzeigen"],normalized:"show"},hide:{primary:"verbergen",alternatives:["verstecken"],normalized:"hide"},transition:{primary:"\xFCbergang",alternatives:["animieren"],normalized:"transition"},on:{primary:"bei",alternatives:["auf"],normalized:"on"},trigger:{primary:"ausl\xF6sen",normalized:"trigger"},send:{primary:"senden",alternatives:["schicken"],normalized:"send"},focus:{primary:"Fokus",alternatives:["Fokuserhalt","fokussieren"],normalized:"focus"},blur:{primary:"Fokusverlust",alternatives:["verlassen","defokussieren","entfokussieren"],normalized:"blur"},empty:{primary:"leeren",alternatives:["leer"],normalized:"empty"},open:{primary:"\xF6ffnen",alternatives:["oeffnen"],normalized:"open"},close:{primary:"schlie\xDFen",alternatives:["schliessen"],normalized:"close"},select:{primary:"markieren",normalized:"select"},clear:{primary:"bereinigen",normalized:"clear"},reset:{primary:"zur\xFCcksetzen",alternatives:["zuruecksetzen"],normalized:"reset"},breakpoint:{primary:"haltepunkt",normalized:"breakpoint"},go:{primary:"gehen",alternatives:["navigieren"],normalized:"go"},scroll:{primary:"scrollen",normalized:"scroll"},push:{primary:"dr\xFCcken",alternatives:["push"],normalized:"push"},replace:{primary:"ersetzen",normalized:"replace"},process:{primary:"verarbeiten",normalized:"process"},wait:{primary:"warten",normalized:"wait"},fetch:{primary:"abrufen",alternatives:["laden"],normalized:"fetch"},settle:{primary:"stabilisieren",normalized:"settle"},if:{primary:"falls",alternatives:["sofern"],normalized:"if"},unless:{primary:"wennnicht",normalized:"unless"},when:{primary:"wenn",normalized:"when"},changes:{primary:"\xE4ndert",normalized:"changes"},where:{primary:"wo",normalized:"where"},else:{primary:"sonst",alternatives:["ansonsten"],normalized:"else"},repeat:{primary:"wiederholen",normalized:"repeat"},for:{primary:"f\xFCr",normalized:"for"},while:{primary:"solange",alternatives:["w\xE4hrend"],normalized:"while"},forever:{primary:"forever",normalized:"forever"},continue:{primary:"fortfahren",alternatives:["weiter"],normalized:"continue"},halt:{primary:"anhalten",alternatives:["stoppen"],normalized:"halt"},throw:{primary:"werfen",normalized:"throw"},call:{primary:"aufrufen",normalized:"call"},return:{primary:"zur\xFCckgeben",normalized:"return"},then:{primary:"dann",alternatives:["danach","anschlie\xDFend"],normalized:"then"},and:{primary:"und",alternatives:["sowie","auch"],normalized:"and"},is:{primary:"ist",normalized:"is"},matches:{primary:"passt",normalized:"matches"},exists:{primary:"existiert",normalized:"exists"},no:{primary:"kein",normalized:"no"},end:{primary:"ende",alternatives:["fertig"],normalized:"end"},js:{primary:"js",alternatives:["javascript"],normalized:"js"},async:{primary:"asynchron",normalized:"async"},tell:{primary:"sagen",normalized:"tell"},default:{primary:"standard",normalized:"default"},init:{primary:"Initialisierung",alternatives:["initialisieren"],normalized:"init"},behavior:{primary:"verhalten",normalized:"behavior"},install:{primary:"installieren",normalized:"install"},measure:{primary:"messen",normalized:"measure"},beep:{primary:"piepton",normalized:"beep"},break:{primary:"unterbrechen",normalized:"break"},copy:{primary:"kopieren",normalized:"copy"},exit:{primary:"beenden",normalized:"exit"},pick:{primary:"ausw\xE4hlen",normalized:"pick"},render:{primary:"rendern",normalized:"render"},into:{primary:"hinein",normalized:"into"},before:{primary:"vor",normalized:"before"},after:{primary:"nach",normalized:"after"},click:{primary:"Klick",alternatives:["Klicken"],normalized:"click"},hover:{primary:"Hover",alternatives:["Schweben"],normalized:"hover"},submit:{primary:"Absenden",alternatives:["Senden"],normalized:"submit"},input:{primary:"Eingabe",normalized:"input"},change:{primary:"\xC4nderung",alternatives:["\xC4ndern"],normalized:"change"},resize:{primary:"Gr\xF6\xDFen\xE4nderung",alternatives:["gr\xF6\xDFen\xE4nderung","gr\xF6ssen\xE4nderung","Gr\xF6\xDFe \xE4ndern","gr\xF6\xDFe\xE4ndern"],normalized:"resize"},until:{primary:"bis",normalized:"until"},event:{primary:"Ereignis",alternatives:["Event"],normalized:"event"},from:{primary:"von",alternatives:["aus"],normalized:"from"},connect:{primary:"verbinden",alternatives:["Verbindung"],normalized:"connect"},stream:{primary:"stream",alternatives:["Strom"],normalized:"stream"},live:{primary:"direkt",alternatives:["live","echtzeit"],normalized:"live"},socket:{primary:"socket",alternatives:["websocket"],normalized:"socket"},bind:{primary:"binden",alternatives:["verknuepfen","bind"],normalized:"bind"},intercept:{primary:"abfangen",alternatives:["intercept"],normalized:"intercept"},worker:{primary:"arbeiter",alternatives:["worker"],normalized:"worker"},eventsource:{primary:"eventsource",alternatives:["ereignisquelle"],normalized:"eventsource"}},eventHandler:{keyword:{primary:"bei",alternatives:["auf"],normalized:"on"},sourceMarker:{primary:"von",alternatives:["aus"],position:"before"},conditionalKeyword:{primary:"wenn",alternatives:["falls"]},eventMarker:{primary:"bei",alternatives:["beim"],position:"before"},temporalMarkers:["wenn","bei"]}},dv=["an","auf","aus","ein","mit","vor","zu","ab","bei","nach","weg","um","her","hin"];function pv(r){let e=r.toLowerCase();return !!(e.endsWith("en")||e.endsWith("eln")||e.endsWith("ern")||e.startsWith("ge")&&e.endsWith("t")||e.startsWith("ge")&&e.endsWith("en")||/[\u00e4\u00f6\u00fc\u00df]/i.test(r))}var mv=[{ending:"end",stem:"en",confidence:.88,type:"gerund"},{ending:"e",stem:"en",confidence:.75,type:"present"},{ending:"st",stem:"en",confidence:.8,type:"present"},{ending:"t",stem:"en",confidence:.78,type:"present"},{ending:"en",stem:"en",confidence:.85,type:"dictionary"},{ending:"test",stem:"en",confidence:.85,type:"past"},{ending:"ten",stem:"en",confidence:.82,type:"past"},{ending:"tet",stem:"en",confidence:.85,type:"past"},{ending:"te",stem:"en",confidence:.82,type:"past"},{ending:"test",stem:"en",confidence:.8,type:"subjunctive"},{ending:"ten",stem:"en",confidence:.78,type:"subjunctive"},{ending:"tet",stem:"en",confidence:.8,type:"subjunctive"},{ending:"te",stem:"en",confidence:.78,type:"subjunctive"},{ending:"e",stem:"en",confidence:.72,type:"imperative"},{ending:"t",stem:"en",confidence:.72,type:"imperative"},{ending:"en",stem:"en",confidence:.75,type:"imperative"}],fv=[{ending:"le",stem:"eln",confidence:.82,type:"present"},{ending:"elst",stem:"eln",confidence:.85,type:"present"},{ending:"elt",stem:"eln",confidence:.85,type:"present"},{ending:"eln",stem:"eln",confidence:.88,type:"dictionary"},{ending:"re",stem:"ern",confidence:.82,type:"present"},{ending:"erst",stem:"ern",confidence:.85,type:"present"},{ending:"ert",stem:"ern",confidence:.85,type:"present"},{ending:"ern",stem:"ern",confidence:.88,type:"dictionary"}],yv=[...mv,...fv].sort((r,e)=>e.ending.length-r.ending.length),mo=class{constructor(){this.language="de";}isNormalizable(r){return r.length<3?false:pv(r)}normalize(r){let e=r.toLowerCase();if(e.endsWith("en")&&e.length>=4)return De(r);if((e.endsWith("eln")||e.endsWith("ern"))&&e.length>=5)return De(r);let t=this.tryParticipleNormalization(e);if(t)return t;let n=this.tryConjugationNormalization(e);return n||De(r)}tryParticipleNormalization(r){for(let e of dv)if(r.startsWith(e+"ge")){let t=r.slice(e.length),n=this.trySimpleParticipleNormalization(t);if(n){let i={removedPrefixes:["ge"],conjugationType:"participle"};return n.metadata?.removedSuffixes&&(i.removedSuffixes=n.metadata.removedSuffixes),le(e+n.stem,n.confidence*.95,i)}}return this.trySimpleParticipleNormalization(r)}trySimpleParticipleNormalization(r){if(!r.startsWith("ge"))return null;let e=r.slice(2);if(e.endsWith("t")&&e.length>=3){let t=e.slice(0,-1);return le(t+"en",.85,{removedPrefixes:["ge"],removedSuffixes:["t"],conjugationType:"participle"})}return e.endsWith("en")&&e.length>=4?le(e,.82,{removedPrefixes:["ge"],conjugationType:"participle"}):null}tryConjugationNormalization(r){for(let e of yv)if(r.endsWith(e.ending)){let t=r.slice(0,-e.ending.length);if(t.length<2)continue;let n=t+e.stem;return le(n,e.confidence,{removedSuffixes:[e.ending],conjugationType:e.type})}return null}},vv=["===","!==","->","==","!=","<=",">=","&&","||","**","+=","-=","*=","/=","+","-","*","/","=",">","<","!","&","|","%","^","~"],hv=class{constructor(r=vv){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}},Ev="()[]{},:;",gv=class{constructor(r=Ev){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 kn(r,e){let t=e;for(;t<r.length&&r[t]===":";){let n=r.slice(t).match(/^::?[a-zA-Z][a-zA-Z0-9-]*/);if(!n)break;let i=t+n[0].length;if(r[i]==="("){let a=0,o=i;for(;o<r.length;){if(r[o]==="(")a++;else if(r[o]===")"&&(a--,a===0)){o++;break}o++;}if(a!==0)break;i=o;}t=i;}return t}function lo(r,e){let t=r[e];if(t==="#"){let n=r.slice(e).match(/^#[a-zA-Z_][\w-]*/);if(!n)return null;let i=kn(r,e+n[0].length);return r.slice(e,i)}if(t==="."){let n=r.slice(e).match(/^\.\{[a-zA-Z_$][\w$]*\}/);if(n)return n[0];let i=r.slice(e).match(/^\.[a-zA-Z_][\w-]*/);if(!i)return null;let a=kn(r,e+i[0].length);return r.slice(e,a)}if(t==="@"){let n=r.slice(e).match(/^@[a-zA-Z_][\w-]*/);return n?n[0]:null}if(t==="*"){let n=r.slice(e).match(/^\*(?:--)?[a-zA-Z_][\w-]*/);return n?n[0]:null}if(t==="["){let n=0,i=e;for(;i<r.length;){if(r[i]==="["&&n++,r[i]==="]"&&(n--,n===0)){let a=kn(r,i+1);return r.slice(e,a)}i++;}return null}if(t==="<"){let n=r.slice(e).match(/^<(?=[\w.#[])[\w-]*(?:[#.][\w-]+|\[[^\]]+\]|::?[a-zA-Z][a-zA-Z0-9-]*(?:\([^)]*\))?)*\s*\/>/);return n?n[0]:null}return null}var kv=class{constructor(){this.name="css-selector";}canExtract(r,e){let t=r[e];return t==="#"||t==="."||t==="["||t==="<"?true:t==="@"||t==="*"?lo(r,e)!==null:false}extract(r,e){let t=lo(r,e);return t?{value:t,length:t.length,metadata:{type:"css-selector"}}:null}},wv=class{constructor(){this.name="event-modifier";}canExtract(r,e){if(r[e]!==".")return false;let t=r.slice(e);return /^\.(once|prevent|stop|debounce|throttle|queue)/.test(t)}extract(r,e){let t=r.slice(e).match(/^\.(?:once|prevent|stop|debounce|throttle|queue)(?:\(([^)]+)\))?/);if(!t)return null;let n=t[0],i=n.slice(1).split("(")[0],a=t[1];return {value:n,length:n.length,metadata:{modifierName:i,value:a?i==="queue"?a:parseInt(a,10):void 0}}}},zv=["http://","https://","//","./","../","/"];function bv(r,e){let t=1;for(let n=e;n<r.length;n++){let i=r[n];if(i==="{")t++;else if(i==="}"&&--t===0)return n+1}return -1}function Cv(r,e){let t=r.slice(e),n=zv.find(a=>t.startsWith(a));if(!n)return null;let i=n.length;for(;i<t.length;){let a=t[i];if(a==="$"&&t[i+1]==="{"){let o=bv(t,i+2);if(o!==-1){i=o;continue}}if(/\s/.test(a))break;i++;}return t.slice(0,i)}var Av=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=Cv(r,e);return t?{value:t,length:t.length,metadata:{type:"url"}}:null}},xv=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 Dv(){return [new Av,new wv,new xv,new kv]}function Sv(r){return {isLetter:n=>r.test(n),isIdentifierChar:n=>/[0-9]/.test(n)||r.test(n)}}var{isLetter:Bv,isIdentifierChar:Tv}=Sv(/[a-zA-Z\u00e4\u00f6\u00fc\u00c4\u00d6\u00dc\u00df]/),Fv=new Set(["an","auf","aus","bei","durch","f\xFCr","fur","gegen","in","mit","nach","ohne","seit","\xFCber","uber","um","unter","von","vor","zu","zwischen","bis","gegen\xFCber","gegenuber","w\xE4hrend","wahrend","wegen","trotz","statt","innerhalb","au\xDFerhalb","ausserhalb"]),Pv=class{constructor(){this.name="german-keyword";}setContext(r){this.context=r;}canExtract(r,e){return Bv(r[e])}extract(r,e){if(!this.context)throw new Error("GermanKeywordExtractor: context not set");return this.extractGermanWord(r,e)}extractGermanWord(r,e){if(!this.context)return null;let t=e,n="";for(;t<r.length&&Tv(r[t]);)n+=r[t++];if(!n)return null;let i=n.toLowerCase(),a=Fv.has(i),o=this.context.lookupKeyword(n),s=o&&o.normalized!==o.native?o.normalized:void 0,u;if(!o&&this.context.normalizer){let l=this.context.normalizer.normalize(n);if(l.stem!==n&&l.confidence>=.7){let c=this.context.lookupKeyword(l.stem);c&&(u=c.normalized);}}return {value:n,length:t-e,metadata:{normalized:s||u,isPreposition:a}}}};function Ov(){return [new Pv]}var Rv=[{native:"wahr",normalized:"true"},{native:"falsch",normalized:"false"},{native:"null",normalized:"null"},{native:"undefiniert",normalized:"undefined"},{native:"erste",normalized:"first"},{native:"erster",normalized:"first"},{native:"erstes",normalized:"first"},{native:"letzte",normalized:"last"},{native:"letzter",normalized:"last"},{native:"letztes",normalized:"last"},{native:"n\xE4chste",normalized:"next"},{native:"nachste",normalized:"next"},{native:"n\xE4chstgelegene",normalized:"closest"},{native:"nachstgelegene",normalized:"closest"},{native:"vorherige",normalized:"previous"},{native:"eltern",normalized:"parent"},{native:"klick",normalized:"click"},{native:"click",normalized:"click"},{native:"eingabe",normalized:"input"},{native:"\xE4nderung",normalized:"change"},{native:"anderung",normalized:"change"},{native:"absenden",normalized:"submit"},{native:"taste unten",normalized:"keydown"},{native:"taste oben",normalized:"keyup"},{native:"maus dr\xFCber",normalized:"mouseover"},{native:"maus druber",normalized:"mouseover"},{native:"maus weg",normalized:"mouseout"},{native:"taste runter",normalized:"keydown"},{native:"taste hoch",normalized:"keyup"},{native:"maus \xFCber",normalized:"mouseover"},{native:"maus raus",normalized:"mouseout"},{native:"fokus",normalized:"focus"},{native:"unsch\xE4rfe",normalized:"blur"},{native:"unscharfe",normalized:"blur"},{native:"scrollen",normalized:"scroll"},{native:"meine",normalized:"my"},{native:"meinen",normalized:"my"},{native:"ergebnis",normalized:"result"},{native:"ziel",normalized:"target"},{native:"sekunde",normalized:"s"},{native:"sekunden",normalized:"s"},{native:"millisekunde",normalized:"ms"},{native:"millisekunden",normalized:"ms"},{native:"minute",normalized:"m"},{native:"minuten",normalized:"m"},{native:"stunde",normalized:"h"},{native:"stunden",normalized:"h"},{native:"hinzufugen",normalized:"add"},{native:"hinzufgen",normalized:"add"},{native:"loschen",normalized:"remove"},{native:"anhangen",normalized:"append"},{native:"erhohen",normalized:"increment"},{native:"ubergang",normalized:"transition"},{native:"auslosen",normalized:"trigger"},{native:"zuruckgeben",normalized:"return"},{native:"anschliessend",normalized:"then"},{native:"erh\xF6he",normalized:"increment"},{native:"erhohe",normalized:"increment"},{native:"verringere",normalized:"decrement"},{native:"inklusiv",normalized:"inclusive"},{native:"exklusiv",normalized:"exclusive"},{native:"Zeichen",normalized:"characters"},{native:"zuf\xE4llig",normalized:"random"}],Lv=class extends Pe{constructor(){super(),this.language="de",this.direction="ltr",this.initializeKeywordsFromProfile(po,Rv),this.normalizer=new mo,this.registerExtractors(Dv()),this.registerExtractor(new Te),this.registerExtractor(new Fe),this.registerExtractors(Ov()),this.registerExtractor(new hv),this.registerExtractor(new gv);}classifyToken(r){return this.isKeyword(r)?"keyword":/^\.(once|prevent|stop|debounce|throttle|queue)(\(.*\))?$/.test(r)?"event-modifier":r.startsWith("#")||r.startsWith(".")||r.startsWith("[")||r.startsWith("*")||r.startsWith("<")?"selector":r.startsWith('"')||r.startsWith("'")||/^\d/.test(r)?"literal":r.startsWith("/")||r.startsWith("./")||r.startsWith("http")?"url":"identifier"}},Nv=new Lv;Ie("de",cv);Me("de",Nv,po);function yt(r){let e=r.getAttribute("data-lang");if(e)return ft(e);let t=r.getAttribute("data-hyperscript-lang")??r.closest?.("[data-hyperscript-lang]")?.getAttribute("data-hyperscript-lang");if(t)return ft(t);let n=r.closest?.("[lang]")?.getAttribute("lang");if(n)return ft(n);let i=typeof document<"u"?document.documentElement?.lang:null;return i&&i!=="en"?ft(i):null}function ft(r){return r.split("-")[0].toLowerCase()}function vo(){return [{id:"toggle-en-full",language:"en",command:"toggle",priority:100,template:{format:"toggle {patient} on {target}",tokens:[{type:"literal",value:"toggle"},{type:"role",role:"patient"},{type:"group",optional:true,tokens:[{type:"literal",value:"on",alternatives:["from"]},{type:"role",role:"destination"}]}]},extraction:{patient:{position:1},destination:{marker:"on",markerAlternatives:["from"],default:{type:"reference",value:"me"}}}},{id:"toggle-en-simple",language:"en",command:"toggle",priority:90,template:{format:"toggle {patient}",tokens:[{type:"literal",value:"toggle"},{type:"role",role:"patient"}]},extraction:{patient:{position:1},destination:{default:{type:"reference",value:"me"}}}}]}var _v=["literal","selector","expression","reference","property-path"];function ho(){return [{id:"put-en-into",language:"en",command:"put",priority:100,template:{format:"put {patient} into {destination}",tokens:[{type:"literal",value:"put"},{type:"role",role:"patient"},{type:"literal",value:"into",alternatives:["in","to"]},{type:"role",role:"destination"}]},extraction:{patient:{position:1},destination:{marker:"into",markerAlternatives:["in","to"]}}},{id:"put-en-before",language:"en",command:"put",priority:95,template:{format:"put {patient} before {destination}",tokens:[{type:"literal",value:"put"},{type:"role",role:"patient"},{type:"literal",value:"before"},{type:"role",role:"destination"}]},extraction:{patient:{position:1},destination:{marker:"before"},manner:{default:{type:"literal",value:"before"}}}},{id:"put-en-after",language:"en",command:"put",priority:95,template:{format:"put {patient} after {destination}",tokens:[{type:"literal",value:"put"},{type:"role",role:"patient"},{type:"literal",value:"after"},{type:"role",role:"destination"}]},extraction:{patient:{position:1},destination:{marker:"after"},manner:{default:{type:"literal",value:"after"}}}},{id:"put-en-at-end",language:"en",command:"put",priority:96,template:{format:"put {patient} at end of {destination}",tokens:[{type:"literal",value:"put"},{type:"role",role:"patient"},{type:"literal",value:"at"},{type:"literal",value:"end"},{type:"literal",value:"of"},{type:"role",role:"destination"}]},extraction:{patient:{position:1},destination:{position:5},manner:{default:{type:"literal",value:"at end of"}}}},{id:"put-en-at-start",language:"en",command:"put",priority:96,template:{format:"put {patient} at start of {destination}",tokens:[{type:"literal",value:"put"},{type:"role",role:"patient"},{type:"literal",value:"at"},{type:"literal",value:"start"},{type:"literal",value:"of"},{type:"role",role:"destination"}]},extraction:{patient:{position:1},destination:{position:5},manner:{default:{type:"literal",value:"at start of"}}}}]}var $v={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($v).map(([r,e])=>{let t={};for(let[n,i]of Object.entries(e))i in t||(t[i]=n);return [r,t]}));function Eo(){return [{id:"event-en-source",language:"en",command:"on",priority:110,template:{format:"on {event} from {source} {body}",tokens:[{type:"literal",value:"on"},{type:"role",role:"event"},{type:"literal",value:"from"},{type:"role",role:"source"}]},extraction:{event:{position:1},source:{marker:"from"}}},{id:"event-en-standard",language:"en",command:"on",priority:100,template:{format:"on {event} {body}",tokens:[{type:"literal",value:"on"},{type:"role",role:"event"}]},extraction:{event:{position:1}}},{id:"event-en-upon",language:"en",command:"on",priority:98,template:{format:"upon {event} {body}",tokens:[{type:"literal",value:"upon"},{type:"role",role:"event"}]},extraction:{event:{position:1}}},{id:"event-en-if",language:"en",command:"on",priority:95,template:{format:"if {event} {body}",tokens:[{type:"literal",value:"if"},{type:"role",role:"event"}]},extraction:{event:{position:1}}}]}function go(){return [{id:"wait-en-for-event",language:"en",command:"wait",priority:110,template:{format:"wait for {event}",tokens:[{type:"literal",value:"wait"},{type:"literal",value:"for"},{type:"role",role:"event",expectedTypes:["literal","expression"]}]},extraction:{event:{position:2}}}]}function jv(){return [{id:"append-en-full",language:"en",command:"append",priority:100,template:{format:"append {patient} to {destination}",tokens:[{type:"literal",value:"append"},{type:"role",role:"patient",expectedTypes:["literal","selector","expression"]},{type:"literal",value:"to"},{type:"role",role:"destination",expectedTypes:["selector","reference"]}]},extraction:{patient:{position:1},destination:{marker:"to"}}}]}function Wv(){return [{id:"prepend-en-full",language:"en",command:"prepend",priority:100,template:{format:"prepend {patient} to {destination}",tokens:[{type:"literal",value:"prepend"},{type:"role",role:"patient",expectedTypes:["literal","selector","expression"]},{type:"literal",value:"to"},{type:"role",role:"destination",expectedTypes:["selector","reference"]}]},extraction:{patient:{position:1},destination:{marker:"to"}}}]}function Vv(){return [{id:"trigger-en-full",language:"en",command:"trigger",priority:100,template:{format:"trigger {event} on {destination}",tokens:[{type:"literal",value:"trigger"},{type:"role",role:"event",expectedTypes:["literal","expression"]},{type:"group",optional:true,tokens:[{type:"literal",value:"on"},{type:"role",role:"destination",expectedTypes:["selector","reference"]}]}]},extraction:{event:{position:1},destination:{marker:"on",default:{type:"reference",value:"me"}}}},{id:"trigger-en-simple",language:"en",command:"trigger",priority:90,template:{format:"trigger {event}",tokens:[{type:"literal",value:"trigger"},{type:"role",role:"event",expectedTypes:["literal","expression"]}]},extraction:{event:{position:1},destination:{default:{type:"reference",value:"me"}}}}]}var qv=[["toggle",vo],["put",ho],["event-handler",Eo],["wait",go],["append",jv],["prepend",Wv],["trigger",Vv]],bn={code:"en",name:"English",nativeName:"English",regions:["western","priority"],direction:"ltr",script:"latin",wordOrder:"SVO",markingStrategy:"preposition",usesSpaces:true,defaultVerbForm:"base",verb:{position:"start",subjectDrop:false},references:{me:"me",it:"it",you:"you",result:"result",event:"event",target:"target",body:"body",document:"document",window:"window",detail:"detail"},possessive:{marker:"'s",markerPosition:"after-object",specialForms:{me:"my",it:"its",you:"your"},keywords:{my:"me",your:"you",its:"it"}},roleMarkers:{destination:{primary:"on",alternatives:["to","from"],position:"before"},source:{primary:"from",position:"before"},patient:{primary:"",position:"before"},style:{primary:"with",alternatives:["by","using"],position:"before"},responseType:{primary:"as",position:"before"},method:{primary:"via",alternatives:["using"],position:"before"}},keywords:{toggle:{primary:"toggle"},add:{primary:"add"},remove:{primary:"remove"},put:{primary:"put"},append:{primary:"append"},prepend:{primary:"prepend"},take:{primary:"take"},make:{primary:"make"},clone:{primary:"clone"},swap:{primary:"swap"},morph:{primary:"morph"},set:{primary:"set"},get:{primary:"get"},increment:{primary:"increment"},decrement:{primary:"decrement"},log:{primary:"log"},show:{primary:"show"},hide:{primary:"hide"},transition:{primary:"transition"},on:{primary:"on"},trigger:{primary:"trigger"},send:{primary:"send"},focus:{primary:"focus"},blur:{primary:"blur"},empty:{primary:"empty",normalized:"empty"},open:{primary:"open",normalized:"open"},close:{primary:"close",normalized:"close"},select:{primary:"select",normalized:"select"},clear:{primary:"clear",normalized:"clear"},reset:{primary:"reset",normalized:"reset"},breakpoint:{primary:"breakpoint",normalized:"breakpoint"},go:{primary:"go"},scroll:{primary:"scroll",normalized:"scroll"},push:{primary:"push",normalized:"push"},replace:{primary:"replace",normalized:"replace"},process:{primary:"process",normalized:"process"},wait:{primary:"wait"},fetch:{primary:"fetch"},settle:{primary:"settle"},if:{primary:"if"},when:{primary:"when",normalized:"when"},changes:{primary:"changes",normalized:"changes"},where:{primary:"where",normalized:"where"},else:{primary:"else"},repeat:{primary:"repeat"},for:{primary:"for"},while:{primary:"while"},continue:{primary:"continue"},halt:{primary:"halt"},throw:{primary:"throw"},call:{primary:"call"},return:{primary:"return"},then:{primary:"then"},and:{primary:"and"},end:{primary:"end"},js:{primary:"js"},async:{primary:"async"},tell:{primary:"tell"},default:{primary:"default"},init:{primary:"init"},behavior:{primary:"behavior"},install:{primary:"install"},measure:{primary:"measure"},beep:{primary:"beep"},break:{primary:"break"},copy:{primary:"copy"},exit:{primary:"exit"},pick:{primary:"pick"},render:{primary:"render"},into:{primary:"into"},before:{primary:"before"},after:{primary:"after"},until:{primary:"until"},event:{primary:"event"},from:{primary:"from"},connect:{primary:"connect",normalized:"connect"},stream:{primary:"stream",normalized:"stream"},live:{primary:"live",normalized:"live"},socket:{primary:"socket",alternatives:["websocket"],normalized:"socket"},bind:{primary:"bind",normalized:"bind"},eventsource:{primary:"eventsource",normalized:"eventsource"},worker:{primary:"worker",normalized:"worker"},intercept:{primary:"intercept",normalized:"intercept"}}},Kv=["===","!==","->","==","!=","<=",">=","&&","||","**","+=","-=","*=","/=","+","-","*","/","=",">","<","!","&","|","%","^","~"],Hv=class{constructor(r=Kv){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}},Uv="()[]{},:;",Gv=class{constructor(r=Uv){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 wn(r,e){let t=e;for(;t<r.length&&r[t]===":";){let n=r.slice(t).match(/^::?[a-zA-Z][a-zA-Z0-9-]*/);if(!n)break;let i=t+n[0].length;if(r[i]==="("){let a=0,o=i;for(;o<r.length;){if(r[o]==="(")a++;else if(r[o]===")"&&(a--,a===0)){o++;break}o++;}if(a!==0)break;i=o;}t=i;}return t}function fo(r,e){let t=r[e];if(t==="#"){let n=r.slice(e).match(/^#[a-zA-Z_][\w-]*/);if(!n)return null;let i=wn(r,e+n[0].length);return r.slice(e,i)}if(t==="."){let n=r.slice(e).match(/^\.\{[a-zA-Z_$][\w$]*\}/);if(n)return n[0];let i=r.slice(e).match(/^\.[a-zA-Z_][\w-]*/);if(!i)return null;let a=wn(r,e+i[0].length);return r.slice(e,a)}if(t==="@"){let n=r.slice(e).match(/^@[a-zA-Z_][\w-]*/);return n?n[0]:null}if(t==="*"){let n=r.slice(e).match(/^\*(?:--)?[a-zA-Z_][\w-]*/);return n?n[0]:null}if(t==="["){let n=0,i=e;for(;i<r.length;){if(r[i]==="["&&n++,r[i]==="]"&&(n--,n===0)){let a=wn(r,i+1);return r.slice(e,a)}i++;}return null}if(t==="<"){let n=r.slice(e).match(/^<(?=[\w.#[])[\w-]*(?:[#.][\w-]+|\[[^\]]+\]|::?[a-zA-Z][a-zA-Z0-9-]*(?:\([^)]*\))?)*\s*\/>/);return n?n[0]:null}return null}var Yv=class{constructor(){this.name="css-selector";}canExtract(r,e){let t=r[e];return t==="#"||t==="."||t==="["||t==="<"?true:t==="@"||t==="*"?fo(r,e)!==null:false}extract(r,e){let t=fo(r,e);return t?{value:t,length:t.length,metadata:{type:"css-selector"}}:null}},Zv=class{constructor(){this.name="event-modifier";}canExtract(r,e){if(r[e]!==".")return false;let t=r.slice(e);return /^\.(once|prevent|stop|debounce|throttle|queue)/.test(t)}extract(r,e){let t=r.slice(e).match(/^\.(?:once|prevent|stop|debounce|throttle|queue)(?:\(([^)]+)\))?/);if(!t)return null;let n=t[0],i=n.slice(1).split("(")[0],a=t[1];return {value:n,length:n.length,metadata:{modifierName:i,value:a?i==="queue"?a:parseInt(a,10):void 0}}}},Xv=["http://","https://","//","./","../","/"];function Jv(r,e){let t=1;for(let n=e;n<r.length;n++){let i=r[n];if(i==="{")t++;else if(i==="}"&&--t===0)return n+1}return -1}function Qv(r,e){let t=r.slice(e),n=Xv.find(a=>t.startsWith(a));if(!n)return null;let i=n.length;for(;i<t.length;){let a=t[i];if(a==="$"&&t[i+1]==="{"){let o=Jv(t,i+2);if(o!==-1){i=o;continue}}if(/\s/.test(a))break;i++;}return t.slice(0,i)}var eh=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=Qv(r,e);return t?{value:t,length:t.length,metadata:{type:"url"}}:null}},rh=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 th(){return [new eh,new Zv,new rh,new Yv]}function zn(r){return /[a-zA-Z0-9_]/.test(r)}var nh=class{constructor(){this.name="english-keyword";}setContext(r){this.context=r;}canExtract(r,e){return /[a-zA-Z_]/.test(r[e])}extract(r,e){if(!this.context)throw new Error("EnglishKeywordExtractor: context not set");let t=e,n="";for(;t<r.length&&zn(r[t]);)n+=r[t++];if(!n)return null;if(t<r.length&&r[t]===":"){let s=t;t++;let u="";for(;t<r.length&&zn(r[t]);)u+=r[t++];u?n=n+":"+u:t=s;}let i=this.context.lookupKeyword(n),a=i&&i.normalized!==i.native?i.normalized:void 0,o=null;return this.context.isKeyword(n)||(o=this.tryClassSyntaxConversion(r,t,n)),{value:o||n,length:t-e,metadata:{normalized:a,classConversion:o?true:void 0}}}tryClassSyntaxConversion(r,e,t){let n=e;for(;n<r.length&&/\s/.test(r[n]);)n++;if(r.slice(n,n+5).toLowerCase()==="class"){let i=n+5;if(i>=r.length||!zn(r[i]))return "."+t}return null}};function ih(){return [new nh]}var ah=[{native:"true",normalized:"true"},{native:"false",normalized:"false"},{native:"null",normalized:"null"},{native:"undefined",normalized:"undefined"},{native:"first",normalized:"first"},{native:"last",normalized:"last"},{native:"next",normalized:"next"},{native:"previous",normalized:"previous"},{native:"closest",normalized:"closest"},{native:"click",normalized:"click"},{native:"dblclick",normalized:"dblclick"},{native:"mousedown",normalized:"mousedown"},{native:"mouseup",normalized:"mouseup"},{native:"mouseover",normalized:"mouseover"},{native:"mouseout",normalized:"mouseout"},{native:"mouseenter",normalized:"mouseenter"},{native:"mouseleave",normalized:"mouseleave"},{native:"mousemove",normalized:"mousemove"},{native:"keydown",normalized:"keydown"},{native:"keyup",normalized:"keyup"},{native:"keypress",normalized:"keypress"},{native:"input",normalized:"input"},{native:"change",normalized:"change"},{native:"submit",normalized:"submit"},{native:"reset",normalized:"reset"},{native:"load",normalized:"load"},{native:"unload",normalized:"unload"},{native:"scroll",normalized:"scroll"},{native:"resize",normalized:"resize"},{native:"dragstart",normalized:"dragstart"},{native:"drag",normalized:"drag"},{native:"dragend",normalized:"dragend"},{native:"dragenter",normalized:"dragenter"},{native:"dragleave",normalized:"dragleave"},{native:"dragover",normalized:"dragover"},{native:"drop",normalized:"drop"},{native:"touchstart",normalized:"touchstart"},{native:"touchmove",normalized:"touchmove"},{native:"touchend",normalized:"touchend"},{native:"touchcancel",normalized:"touchcancel"},{native:"in",normalized:"in"},{native:"to",normalized:"to"},{native:"at",normalized:"at"},{native:"by",normalized:"by"},{native:"with",normalized:"with"},{native:"without",normalized:"without"},{native:"of",normalized:"of"},{native:"as",normalized:"as"},{native:"every",normalized:"every"},{native:"upon",normalized:"upon"},{native:"unless",normalized:"unless"},{native:"forever",normalized:"forever"},{native:"times",normalized:"times"},{native:"and",normalized:"and"},{native:"or",normalized:"or"},{native:"not",normalized:"not"},{native:"is",normalized:"is"},{native:"exists",normalized:"exists"},{native:"empty",normalized:"empty"},{native:"my",normalized:"my"},{native:"your",normalized:"your"},{native:"its",normalized:"its"},{native:"the",normalized:"the"},{native:"a",normalized:"a"},{native:"an",normalized:"an"},{native:"delete",normalized:"delete"},{native:"innerHTML",normalized:"innerHTML"},{native:"outerHTML",normalized:"outerHTML"},{native:"beforebegin",normalized:"beforebegin"},{native:"afterend",normalized:"afterend"},{native:"beforeend",normalized:"beforeend"},{native:"afterbegin",normalized:"afterbegin"},{native:"flip",normalized:"toggle"},{native:"switch",normalized:"toggle"},{native:"increase",normalized:"increment"},{native:"decrease",normalized:"decrement"},{native:"display",normalized:"show"},{native:"reveal",normalized:"show"},{native:"conceal",normalized:"hide"},{native:"colour",normalized:"color"},{native:"grey",normalized:"gray"},{native:"centre",normalized:"center"},{native:"behaviour",normalized:"behavior"},{native:"initialise",normalized:"initialize"},{native:"favourite",normalized:"favorite"}],oh=class extends Pe{constructor(){super(),this.language="en",this.direction="ltr",this.initializeKeywordsFromProfile(bn,ah),this.registerExtractors(th()),this.registerExtractor(new Te),this.registerExtractor(new Fe),this.registerExtractors(ih()),this.registerExtractor(new Hv),this.registerExtractor(new Gv);}classifyToken(r){return this.isKeyword(r)?"keyword":r.startsWith("/")||r.startsWith("./")||r.startsWith("../")||r.startsWith("http")?"url":/^\.(once|prevent|stop|debounce|throttle|queue)(\(.*\))?$/.test(r)?"event-modifier":r.startsWith("#")||r.startsWith(".")||r.startsWith("[")||r.startsWith("*")||r.startsWith("<")?"selector":r.startsWith('"')||r.startsWith("'")||/^\d/.test(r)?"literal":["==","!=","<=",">=","<",">","&&","||","!"].includes(r)?"operator":"identifier"}},sh=new oh,uh={id:"fetch-en-with-response-type",language:"en",command:"fetch",priority:90,template:{format:"fetch {source} as {responseType}",tokens:[{type:"literal",value:"fetch"},{type:"role",role:"source",expectedTypes:["literal","expression"]},{type:"literal",value:"as"},{type:"role",role:"responseType",expectedTypes:["literal","expression"]}]},extraction:{source:{position:1},responseType:{marker:"as"}}},lh={id:"fetch-en-with-options-as",language:"en",command:"fetch",priority:95,template:{format:"fetch {source} with {style} as {responseType}",tokens:[{type:"literal",value:"fetch"},{type:"role",role:"source",expectedTypes:["literal","expression"]},{type:"literal",value:"with",alternatives:["by","using"]},{type:"role",role:"style",expectedTypes:["expression"]},{type:"literal",value:"as"},{type:"role",role:"responseType",expectedTypes:["literal","expression"]}]},extraction:{source:{position:1},style:{marker:"with"},responseType:{marker:"as"}}},ch={id:"fetch-en-with-options",language:"en",command:"fetch",priority:93,template:{format:"fetch {source} with {style}",tokens:[{type:"literal",value:"fetch"},{type:"role",role:"source",expectedTypes:["literal","expression"]},{type:"literal",value:"with",alternatives:["by","using"]},{type:"role",role:"style",expectedTypes:["expression"]}]},extraction:{source:{position:1},style:{marker:"with"}}},dh={id:"fetch-en-simple",language:"en",command:"fetch",priority:80,template:{format:"fetch {source}",tokens:[{type:"literal",value:"fetch"},{type:"role",role:"source"}]},extraction:{source:{position:1}}},ph=[lh,ch,uh,dh],mh={id:"pick-en-variant",language:"en",command:"pick",priority:110,template:{format:"pick {method} {patient} of {source}",tokens:[{type:"literal",value:"pick"},{type:"role",role:"method",expectedTypes:["literal","expression"]},{type:"role",role:"patient",expectedTypes:["literal","expression"]},{type:"literal",value:"of",alternatives:["from"]},{type:"role",role:"source",expectedTypes:["selector","reference","expression"]}]},extraction:{method:{position:1},patient:{position:2},source:{marker:"of",markerAlternatives:["from"]}}},fh=[mh],vt={type:"group",optional:true,tokens:[{type:"literal",value:"using"},{type:"literal",value:"view"},{type:"role",role:"manner",optional:true,expectedTypes:["literal","expression"],valueShape:"keyword"}]},yh={id:"swap-en-handcrafted",language:"en",command:"swap",priority:110,template:{format:"swap {method} {destination} [using view {manner}]",tokens:[{type:"literal",value:"swap"},{type:"role",role:"method"},{type:"role",role:"destination"},vt]},extraction:{method:{position:1},destination:{position:2}}},vh={id:"swap-en-element",language:"en",command:"swap",priority:120,template:{format:"swap {destination} with {patient} [using view {manner}]",tokens:[{type:"literal",value:"swap"},{type:"role",role:"destination"},{type:"literal",value:"with"},{type:"role",role:"patient"},vt]},extraction:{}},hh={id:"swap-en-strategy-of",language:"en",command:"swap",priority:140,template:{format:"swap {method} of {destination} with {patient} [using view {manner}]",tokens:[{type:"literal",value:"swap"},{type:"role",role:"method"},{type:"literal",value:"of"},{type:"role",role:"destination"},{type:"literal",value:"with"},{type:"role",role:"patient"},vt]},extraction:{}},Eh={id:"swap-en-strategy",language:"en",command:"swap",priority:130,template:{format:"swap {method} {destination} with {patient} [using view {manner}]",tokens:[{type:"literal",value:"swap"},{type:"role",role:"method"},{type:"role",role:"destination"},{type:"literal",value:"with"},{type:"role",role:"patient"},vt]},extraction:{}},gh=[hh,Eh,vh,yh],kh=[..._v],wh={id:"set-en-possessive",language:"en",command:"set",priority:100,template:{format:"set {destination} to {patient} [on {scope}]",tokens:[{type:"literal",value:"set"},{type:"role",role:"destination",expectedTypes:["property-path","selector","reference","expression"]},{type:"literal",value:"to"},{type:"role",role:"patient",expectedTypes:kh},{type:"group",optional:true,tokens:[{type:"literal",value:"on"},{type:"role",role:"scope",optional:true,expectedTypes:["selector","reference"]}]}]},extraction:{destination:{position:1},patient:{marker:"to"},scope:{marker:"on"}}},yo=[{type:"literal",value:"start"},{type:"group",optional:true,tokens:[{type:"literal",value:"a"}]},{type:"literal",value:"view"},{type:"literal",value:"transition"}];function zh(r){return [{id:`viewTransition-${r}-using`,language:r,command:"viewTransition",priority:111,template:{format:"start [a] view transition using {style}",tokens:[...yo,{type:"literal",value:"using"},{type:"role",role:"style",expectedTypes:["literal"]}]},extraction:{style:{marker:"using"}}},{id:`viewTransition-${r}`,language:r,command:"viewTransition",priority:110,template:{format:"start [a] view transition",tokens:yo},extraction:{}}]}var bh={id:"repeat-en-until-event-from",language:"en",command:"repeat",priority:120,template:{format:"repeat until event {event} from {source}",tokens:[{type:"literal",value:"repeat"},{type:"literal",value:"until"},{type:"literal",value:"event"},{type:"role",role:"event",expectedTypes:["literal","expression"]},{type:"literal",value:"from"},{type:"role",role:"source",expectedTypes:["selector","reference","expression"]}]},extraction:{event:{marker:"event"},source:{marker:"from"},loopType:{default:{type:"literal",value:"until-event"}}}},Ch={id:"repeat-en-until-event",language:"en",command:"repeat",priority:110,template:{format:"repeat until event {event}",tokens:[{type:"literal",value:"repeat"},{type:"literal",value:"until"},{type:"literal",value:"event"},{type:"role",role:"event",expectedTypes:["literal","expression"]}]},extraction:{event:{marker:"event"},loopType:{default:{type:"literal",value:"until-event"}}}},Ah={id:"repeat-en-times",language:"en",command:"repeat",priority:110,template:{format:"repeat {quantity} times",tokens:[{type:"literal",value:"repeat"},{type:"role",role:"quantity",expectedTypes:["literal","expression","reference"]},{type:"literal",value:"times"}]},extraction:{loopType:{default:{type:"literal",value:"times"}}}},xh={id:"repeat-en-forever",language:"en",command:"repeat",priority:110,template:{format:"repeat forever",tokens:[{type:"literal",value:"repeat"},{type:"literal",value:"forever"}]},extraction:{loopType:{default:{type:"literal",value:"forever"}}}},Dh={id:"for-en-basic",language:"en",command:"for",priority:100,template:{format:"for {patient} in {source}",tokens:[{type:"literal",value:"for"},{type:"role",role:"patient",expectedTypes:["expression","reference"]},{type:"literal",value:"in"},{type:"role",role:"source",expectedTypes:["selector","expression","reference"]}]},extraction:{patient:{position:1},source:{marker:"in"}}},Sh={id:"if-en-basic",language:"en",command:"if",priority:100,template:{format:"if {condition}",tokens:[{type:"literal",value:"if"},{type:"role",role:"condition",expectedTypes:["expression","reference","selector"]}]},extraction:{condition:{position:1}}},Bh={id:"unless-en-basic",language:"en",command:"unless",priority:100,template:{format:"unless {condition}",tokens:[{type:"literal",value:"unless"},{type:"role",role:"condition",expectedTypes:["expression","reference","selector"]}]},extraction:{condition:{position:1}}},Th={id:"temporal-en-in",language:"en",command:"wait",priority:95,template:{format:"in {duration}",tokens:[{type:"literal",value:"in"},{type:"role",role:"duration",expectedTypes:["literal","expression"]}]},extraction:{duration:{position:1}}},Fh={id:"temporal-en-after",language:"en",command:"wait",priority:95,template:{format:"after {duration}",tokens:[{type:"literal",value:"after"},{type:"role",role:"duration",expectedTypes:["literal","expression"]}]},extraction:{duration:{position:1}}};function Ph(){let r=[];r.push(...vo()),r.push(...ho()),r.push(...Eo()),r.push(...Zt("en")),r.push(...go()),r.push(...zh("en")),r.push(...ph,...fh,...gh,bh,Ch,Ah,xh,wh,Dh,Sh,Bh,Th,Fh);let e=rn(bn);return r.push(...e),r}Ie("en",qv);Me("en",sh,bn);Ii("en",Ph());var Oh={confidenceThreshold:.5,strategy:"semantic"};function Rh(r,e){return typeof r=="number"?r:r[e]??r["*"]??.5}var Lh=/^(on\s+(?:every\s+)?[\w-]+(?:\[.*?\])?(?:\.[\w-]+(?:\([^)]*\))?)*(?:\s+from\s+\S+)?(?:\s+queue\s+\w+)?\s+)/;function Nh(r){let e=r.match(Lh);if(!e)return null;let t=e[1],n=r.slice(t.length);return n?{prefix:t,commands:n}:null}function ko(r){function e(i,a,o){try{return r.isLanguageRegistered(a)?r.translateSingle(i,a,o):null}catch{return null}}function t(i,a,o){try{let s=o(i,a);return s!==i?s:null}catch{return null}}function n(i,a,o){if(o.strategy==="semantic"||o.strategy==="auto"){let s=Rh(o.confidenceThreshold,a),u=e(i,a,s);if(u!==null)return u}if((o.strategy==="auto"||o.strategy==="i18n")&&o.i18nToEnglish){let s=t(i,a,o.i18nToEnglish);if(s!==null)return s}return null}return function(a,o,s={}){if(o==="en")return a;let u={...Oh,...s},l=n(a,o,u);if(l!==null)return l;let c=Nh(a);if(c){let d=n(c.commands,o,u);if(d!==null)return c.prefix+d}return a}}var Cn=ko({isLanguageRegistered:$i,translateSingle(r,e,t){let n=dn(r,e);return n.confidence<t||!n.node?n.confidence>=t?Xa(r,e,"en"):null:pt(n.node,"en")}});var An=new WeakSet;function _h(r){return (r.config?.attributes??"_, script, data-script").split(",").map(t=>t.trim()).filter(Boolean)}function Mh(r,e){for(let t of e)if(r.hasAttribute(t))return t;return null}function wo(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=_h(r),n=[...t.map(a=>`[${a}]`),'script[type="text/hyperscript"]'].join(", "),i=a=>{if(An.has(a))return;if(a instanceof HTMLScriptElement&&a.type==="text/hyperscript"){let l=a.textContent??"";if(!l)return;let c=e(l,a);An.add(a),c!=null&&c!==l&&(a.textContent=c);return}let o=Mh(a,t);if(!o)return;let s=a.getAttribute(o);if(!s)return;let u=e(s,a);An.add(a),u!=null&&u!==s&&a.setAttribute(o,u);};r.addBeforeProcessHook(a=>{!a||typeof a.querySelectorAll!="function"||(typeof a.matches=="function"&&a.matches(n)&&i(a),a.querySelectorAll(n).forEach(i));});}var Ih=new Set(["me","my","i","it","its","you","your"]);function $h(r){for(let e of r?.features??[])for(let t of e.events??[])if(typeof t.on=="string"&&Ih.has(t.on.toLowerCase()))return t.on}function bo(r,e){if(typeof r.parse!="function")return true;try{let t=r.parse(e);return t?.errors&&t.errors.length>0?!1:$h(t)===void 0}catch{return false}}var zo=new Set;function Co(r,e,t){zo.has(r)||(zo.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 xn(r={}){return function(t){let n=t;wo(n,(i,a)=>{let o=jh(a,r);if(!o||o==="en")return i;let s=Cn(i,o,r);if(s!==i){if(r.validateWithHost!==false&&!bo(n,s))return r.debug?console.log(`[hyperscript-i18n] ${o}: host rejected "${s}" \u2014 keeping "${i}"`):Co(o,i,s),i;r.debug&&console.log(`[hyperscript-i18n] ${o}: "${i}" \u2192 "${s}"`);}return s});}}function jh(r,e){if(e.languageAttribute){let n=r.getAttribute(e.languageAttribute);if(n)return n.split("-")[0].toLowerCase()}let t=yt(r);return t||(e.defaultLanguage??null)}function Ao(r,e,t={}){return e==="en"?r:Cn(r,e,t)}function xo(){typeof _hyperscript<"u"&&_hyperscript.use&&_hyperscript.use(xn());}var ig=["es","pt","fr","de"];xo();
11
+ exports.plugin=xn;exports.preprocess=Ao;exports.resolveLanguage=yt;exports.supportedLanguages=ig;return exports;})({});