@hyperscript-tools/multilingual 2.11.0 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (32) hide show
  1. package/CHANGELOG.md +120 -0
  2. package/dist/hyperscript-i18n-ar.global.js +5 -5
  3. package/dist/hyperscript-i18n-bn.global.js +5 -5
  4. package/dist/hyperscript-i18n-de.global.js +5 -5
  5. package/dist/hyperscript-i18n-east-asian.global.js +5 -5
  6. package/dist/hyperscript-i18n-en.global.js +7 -7
  7. package/dist/hyperscript-i18n-es.global.js +5 -5
  8. package/dist/hyperscript-i18n-fr.global.js +5 -5
  9. package/dist/hyperscript-i18n-he.global.js +5 -5
  10. package/dist/hyperscript-i18n-hi.global.js +5 -5
  11. package/dist/hyperscript-i18n-id.global.js +5 -5
  12. package/dist/hyperscript-i18n-it.global.js +5 -5
  13. package/dist/hyperscript-i18n-ja.global.js +5 -5
  14. package/dist/hyperscript-i18n-ko.global.js +5 -5
  15. package/dist/hyperscript-i18n-ms.global.js +5 -5
  16. package/dist/hyperscript-i18n-pl.global.js +5 -5
  17. package/dist/hyperscript-i18n-pt.global.js +5 -5
  18. package/dist/hyperscript-i18n-qu.global.js +5 -5
  19. package/dist/hyperscript-i18n-ru.global.js +5 -5
  20. package/dist/hyperscript-i18n-slavic.global.js +5 -5
  21. package/dist/hyperscript-i18n-south-asian.global.js +5 -5
  22. package/dist/hyperscript-i18n-southeast-asian.global.js +5 -5
  23. package/dist/hyperscript-i18n-sw.global.js +5 -5
  24. package/dist/hyperscript-i18n-th.global.js +5 -5
  25. package/dist/hyperscript-i18n-tl.global.js +5 -5
  26. package/dist/hyperscript-i18n-tr.global.js +5 -5
  27. package/dist/hyperscript-i18n-uk.global.js +5 -5
  28. package/dist/hyperscript-i18n-vi.global.js +5 -5
  29. package/dist/hyperscript-i18n-western.global.js +5 -5
  30. package/dist/hyperscript-i18n-zh.global.js +5 -5
  31. package/dist/hyperscript-i18n.global.js +37 -36
  32. package/package.json +2 -2
@@ -1,7 +1,7 @@
1
- var HyperscriptI18n=(function(exports){'use strict';function le(i,e){return e?{type:"literal",value:i,dataType:e}:{type:"literal",value:i}}function rt(i,e){return e?{type:"selector",value:i,selectorKind:e}:{type:"selector",value:i}}function Ve(i){return {type:"reference",value:i}}function it(i,e){return {type:"property-path",object:i,property:e}}var ar=new Set(["me","you","it","result","event","target","body","document","window","detail"]);function bt(i,e=ar){return e.has(i)}var qi=class{constructor(i){this.namespace=i,this.enabled=this.checkEnabled();}checkEnabled(){if(typeof process<"u"&&process.env){let i=process.env.DEBUG||"";return i==="*"||i.includes("framework:*")||i.includes(`framework:${this.namespace}`)}return false}log(i,e,...t){if(!this.enabled)return;let r=`[framework:${this.namespace}]`,n=new Date().toISOString();switch(i){case "debug":console.debug(`${n} ${r} DEBUG:`,e,...t);break;case "info":console.info(`${n} ${r} INFO:`,e,...t);break;case "warn":console.warn(`${n} ${r} WARN:`,e,...t);break;case "error":console.error(`${n} ${r} ERROR:`,e,...t);break}}debug(i,...e){this.log("debug",i,...e);}info(i,...e){this.log("info",i,...e);}warn(i,...e){this.log("warn",i,...e);}error(i,...e){this.log("error",i,...e);}isEnabled(){return this.enabled}enable(){this.enabled=true;}disable(){this.enabled=false;}};function ji(i){return new qi(i)}function Pe(i,e){return !e||e.length===0||e.includes(i)||e.includes("expression")?true:i==="property-path"?e.some(t=>["selector","reference","expression"].includes(t)):false}function Vi(i,e){return i?.possessive?.keywords?.[e]}var He=class Re{constructor(){this.logger=ji("pattern-matcher"),this.stemMatchCount=0,this.totalKeywordMatches=0;}safeToLowerCase(e){return typeof e=="string"?e.toLowerCase():e==null?"":String(e).toLowerCase()}matchPattern(e,t,r){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:",r?.code);}this.currentProfile=r,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,r){let n=[];for(let o of t){let u=e.mark(),s=this.matchPattern(e,o,r);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,r,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 v=this.collectStopMarkers(t,l+1);if(n)for(let h of n)v.add(h);let f=[];for(;!e.isAtEnd();){let h=e.peek();if(!h||this.isStopMarker(h,v))break;f.push(h.value),e.advance();}if(f.length>0){r.set(c.role,{type:"expression",raw:f.join(" ")}),u=null,s=null;continue}else {if(c.optional)continue;return false}}if(c.type==="group"){let v=this.collectStopMarkers(t,l+1);if(n)for(let h of n)v.add(h);if(this.matchGroupToken(e,c,r,v)){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 v=l+1<t.length?t[l+1]:null;if(v?.type==="literal"){let f=e.peek();if(f&&this.getMatchType(f,v.value)!=="none"){if(this.logger.debug(" >> MARKER-STEAL GUARD: current token matches next literal, skipping role"),this.logger.debug(" >> Token match FAILED"),this.isOptional(c))continue;if(u&&s){this.logger.debug(" >> BACKTRACKING: undoing optional role",s),e.reset(u),r.delete(s),u=null,s=null;let h=this.matchPatternToken(e,c,r);if(this.logger.debug(" >> Backtrack retry result:",h),h)continue}return false}}}let E=this.matchPatternToken(e,c,r);if(this.logger.debug(" >> Match result:",E),E){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),r.delete(s),u=null,s=null;let v=this.matchPatternToken(e,c,r);if(this.logger.debug(" >> Backtrack retry result:",v),v)continue}return false}}return true}matchPatternToken(e,t,r){switch(t.type){case "literal":return this.matchLiteralToken(e,t);case "role":return this.matchRoleToken(e,t,r);case "group":return this.matchGroupToken(e,t,r);default:return false}}matchLiteralToken(e,t){let r=e.peek();if(this.logger.debug(" >>> matchLiteralToken: expecting",t.value),this.logger.debug(" >>> matchLiteralToken: got token",r?JSON.stringify({type:r.type,value:r.value,kind:r.kind}):"null"),!r)return this.logger.debug(" >>> matchLiteralToken: FAIL - no token"),false;let n=this.getMatchType(r,t.value);if(this.logger.debug(" >>> matchType for",r.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(r,a);if(o!=="none")return this.totalKeywordMatches++,o==="stem"&&this.stemMatchCount++,e.advance(),true}return false}matchRoleToken(e,t,r){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&&!Pe(a.type,t.expectedTypes)?t.optional||false:(r.set(t.role,a),true);let o=this.tryMatchMethodCallExpression(e);if(o)return t.expectedTypes&&t.expectedTypes.length>0&&!Pe(o.type,t.expectedTypes)?t.optional||false:(r.set(t.role,o),true);let u=this.tryMatchPossessiveSelectorExpression(e);if(u)return t.expectedTypes&&t.expectedTypes.length>0&&!Pe(u.type,t.expectedTypes)?t.optional||false:(r.set(t.role,u),true);let s=this.tryMatchPropertyAccessExpression(e);if(s)return t.expectedTypes&&t.expectedTypes.length>0&&!Pe(s.type,t.expectedTypes)?t.optional||false:(r.set(t.role,s),true);let l=this.tryMatchSelectorPropertyExpression(e);if(l)return t.expectedTypes&&t.expectedTypes.length>0&&!Pe(l.type,t.expectedTypes)?t.optional||false:(r.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&&!Pe(c.type,t.expectedTypes)?(this.logger.debug(" >>> TYPE MISMATCH - returning",t.optional||false),t.optional||false):(this.logger.debug(" >>> Type validation PASSED"),r.set(t.role,c),e.advance(),true)):t.optional||false}tryMatchPossessiveExpression(e){let t=e.peek();if(!t||!this.currentProfile)return null;let r=t.normalized||t.value,n=this.safeToLowerCase(r),a=Vi(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()),it(Ve(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 r=e.mark();e.advance();let n=e.peek();if(!n||n.kind!=="operator"||n.value!==".")return e.reset(r),null;e.advance();let a=e.peek();if(!a||a.kind!=="identifier")return e.reset(r),null;e.advance();let o=e.peek();if(!o||o.kind!=="punctuation"||o.value!=="(")return e.reset(r),null;e.advance();let u=[];for(;!e.isAtEnd()&&u.length<Re.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 r=e.mark();e.advance();let n=e.peek();if(!n||n.kind!=="operator"||n.value!==".")return e.reset(r),null;e.advance();let a=e.peek();if(!a||a.kind!=="identifier")return e.reset(r),null;e.advance();let o=`${t.value}.${a.value}`,u=1;for(;!e.isAtEnd()&&u<Re.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<Re.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 r=e.mark();e.advance();let n=e.peek();if(!n||n.kind!=="punctuation"||n.value!=="'s")return e.reset(r),null;e.advance();let a=e.peek();return !a||a.kind!=="selector"&&a.kind!=="identifier"?(e.reset(r),null):(e.advance(),it(rt(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 r=e.mark();e.advance();let n=e.peek();if(!n||n.kind!=="selector"||!n.value.startsWith("."))return e.reset(r),null;let a=e.peek(1);a&&a.kind,e.advance();let o=n.value.slice(1);return it(rt(t.value),o)}matchGroupToken(e,t,r,n){let a=e.mark(),o=new Set(r.keys());if(this.matchTokenSequence(e,t.tokens,r,n))return true;e.reset(a);for(let l of r.keys())o.has(l)||r.delete(l);if(!t.optional)return false;let s=this.getGroupLeadingMarker(t);if(s)for(let l=1;l<=Re.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,r,n))return true;e.reset(a);for(let m of r.keys())o.has(m)||r.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 r=new Set;for(let n=t;n<e.length;n++){let a=e[n];if(a.type==="literal"){if(r.add(a.value.toLowerCase()),a.alternatives)for(let o of a.alternatives)r.add(o.toLowerCase());break}if(a.type==="group"){for(let o of a.tokens)if(o.type==="literal"){if(r.add(o.value.toLowerCase()),o.alternatives)for(let u of o.alternatives)r.add(u.toLowerCase());break}if(!a.optional)break}}return r}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 rt(e.value);case "literal":return this.parseLiteralValue(e.value);case "keyword":let t=e.normalized||e.value;this.safeToLowerCase(t);return le(e.normalized||e.value);case "identifier":if(typeof e.value=="string"&&e.value.startsWith(":"))return Ve(e.value);this.safeToLowerCase(e.value);return {type:"expression",raw:e.value};case "url":return le(e.value,"string");default:return null}}parseLiteralValue(e){if(e.startsWith('"')||e.startsWith("'")||e.startsWith("`")||e.startsWith("\u300C")){let n=e.slice(1,-1);return le(n,"string")}if(e==="true")return le(true,"boolean");if(e==="false")return le(false,"boolean");let t=e.match(/^(\d+(?:\.\d+)?)(ms|s|m|h)?$/);if(t){let n=parseFloat(t[1]);return t[2]?le(e,"duration"):le(n,"number")}let r=parseFloat(e);return isNaN(r)?le(e,"string"):le(r,"number")}applyExtractionRules(e,t){for(let[r,n]of Object.entries(e.extraction))t.has(r)||(n.value!==void 0?t.set(r,{type:"literal",value:n.value}):n.default&&t.set(r,n.default));}isOptional(e){return e.type!=="literal"&&e.optional===true}calculateConfidence(e,t){let r=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)&&(r+=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)?r+=d:p&&(r+=d*.6);}}let o=n>0?r/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 r=new Set(["\u0628\u062F\u0644","\u063A\u064A\u0631","\u0623\u0636\u0641","\u0623\u0632\u0644","\u0636\u0639","\u0627\u062C\u0639\u0644","\u0639\u064A\u0646","\u0632\u062F","\u0627\u0646\u0642\u0635","\u0633\u062C\u0644","\u0623\u0638\u0647\u0631","\u0623\u062E\u0641","\u0634\u063A\u0644","\u0623\u0631\u0633\u0644","\u0631\u0643\u0632","\u0634\u0648\u0634","\u062A\u0648\u0642\u0641","\u0627\u0646\u0633\u062E","\u0627\u062D\u0630\u0641","\u0627\u0635\u0646\u0639","\u0627\u0646\u062A\u0638\u0631","\u0627\u0646\u062A\u0642\u0627\u0644","\u0623\u0648"]);if(r.has(t.value))return .15;if(t.alternatives){for(let n of t.alternatives)if(r.has(n))return .15}return 0}arabicPrepositionDisambiguation(e,t){if(e.language!=="ar")return 0;let r=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)?r+=.1:r-=.1;}}return Math.max(-0.1,Math.min(.1,r))}skipNoiseWords(e){let t=e.peek();if(!t)return;let r=this.safeToLowerCase(t.value);if(Re.ENGLISH_NOISE_WORDS.has(r)){let n=e.mark();e.advance();let a=e.peek();if(a&&a.kind==="selector")return;e.reset(n);}r==="class"&&e.advance();}extractEventModifiers(e){let t={},r=false;for(;!e.isAtEnd();){let n=e.peek();if(!n||n.kind!=="event-modifier")break;let a=n.metadata;if(!a)break;switch(r=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 r?t:void 0}};He.MAX_MARKER_SCAN=3;He.MAX_PROPERTY_DEPTH=10;He.MAX_METHOD_ARGS=20;He.ENGLISH_NOISE_WORDS=new Set(["the","a","an"]);var Wi=He;new Wi;var ur=class{constructor(){this.name="string-literal";}canExtract(i,e){let t=i[e];return t==='"'||t==="'"||t==="`"||t==="\u201C"||t==="\u2018"}extract(i,e){let t=i[e];if(t==="\u201C"){let a=1;for(;e+a<i.length;){if(i[e+a]==="\u201D")return a++,{value:i.substring(e,e+a),length:a};a++;}return null}if(t==="\u2018"){let a=1;for(;e+a<i.length;){if(i[e+a]==="\u2019")return a++,{value:i.substring(e,e+a),length:a};a++;}return null}let r=1,n=false;for(;e+r<i.length;){let a=i[e+r];if(n){n=false,r++;continue}if(a==="\\"){n=true,r++;continue}if(a===t)return r++,{value:i.substring(e,e+r),length:r};r++;}return null}},sr=class{constructor(){this.name="number";}canExtract(i,e){return /\d/.test(i[e])}extract(i,e){let t=0,r=false;for(;e+t<i.length;){let o=i[e+t];if(/\d/.test(o))t++;else if(o==="."&&!r)r=true,t++;else break}if(t===0)return null;let n=i.substring(e,e+t),a=e+t;if(a<i.length){let o=i.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 Hi(i){return "setContext"in i&&typeof i.setContext=="function"}function Ki(i){let e={language:i.language,direction:i.direction,lookupKeyword:i.lookupKeyword.bind(i),isKeyword:i.isKeyword.bind(i),isKeywordStart:i.isKeywordStart.bind(i),...i.isKeywordStartAtBoundary?{isKeywordStartAtBoundary:i.isKeywordStartAtBoundary.bind(i)}:{}};return i.normalizer?{...e,normalizer:i.normalizer}:e}var ae=class{constructor(i,e){this.pos=0,this.tokens=i,this.language=e;}peek(i=0){let e=this.pos+i;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(i){this.pos=i.position;}position(){return this.pos}remaining(){return this.tokens.slice(this.pos)}takeWhile(i){let e=[];for(;!this.isAtEnd()&&i(this.peek());)e.push(this.advance());return e}skipWhile(i){for(;!this.isAtEnd()&&i(this.peek());)this.advance();}};function H(i,e){return {start:i,end:e}}function K(i,e,t,r){if(typeof i=="object"){let{value:a,kind:o,position:u,normalized:s,stem:l,stemConfidence:c,metadata:p}=i;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=i;if(!e||!t)throw new Error("createToken requires kind and position parameters");if(typeof r=="string")return {value:n,kind:e,position:t,normalized:r};if(r){let{normalized:a,stem:o,stemConfidence:u,metadata:s}=r;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 We(i){return /\s/.test(i)}function Ui(i){return i==="#"||i==="."||i==="["||i==="@"||i==="*"||i==="<"}function Gi(i){return i==='"'||i==="'"||i==="`"||i==="\u300C"||i==="\u300D"}function be(i){return /\d/.test(i)}function nt(i){return i.replace(/[\u064b-\u0652\u0670]/g,"")}function Yi(i){return /[a-zA-Z]/.test(i)}function J(i){return /[a-zA-Z0-9_-]/.test(i)}function Zi(i,e){if(e>=i.length)return null;let t=i[e];if(!Ui(t))return null;let r=e,n="";if(t==="#"||t==="."){for(n+=i[r++];r<i.length&&J(i[r]);)n+=i[r++];if(n.length<=1)return null;if(r<i.length&&i[r]==="."&&t==="#"){let o=r+1;for(;o<i.length&&J(i[o]);)o++;if(o<i.length&&i[o]==="(")return n}}else if(t==="["){let a=1,o=false,u=null,s=false;for(n+=i[r++];r<i.length&&a>0;){let l=i[r];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--,r++;}if(a!==0)return null}else if(t==="@"){for(n+=i[r++];r<i.length&&J(i[r]);)n+=i[r++];if(n.length<=1)return null}else if(t==="*"){for(n+=i[r++];r<i.length&&J(i[r]);)n+=i[r++];if(n.length<=1)return null}else if(t==="<"){if(n+=i[r++],r>=i.length||!Yi(i[r]))return null;for(;r<i.length&&J(i[r]);)n+=i[r++];for(;r<i.length;){let a=i[r];if(a==="."){if(n+=i[r++],r>=i.length||!J(i[r]))return null;for(;r<i.length&&J(i[r]);)n+=i[r++];}else if(a==="#"){if(n+=i[r++],r>=i.length||!J(i[r]))return null;for(;r<i.length&&J(i[r]);)n+=i[r++];}else if(a==="["){let o=1,u=false,s=null,l=false;for(n+=i[r++];r<i.length&&o>0;){let c=i[r];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--,r++;}if(o!==0)return null}else break}for(;r<i.length&&We(i[r]);)n+=i[r++];if(r<i.length&&i[r]==="/")for(n+=i[r++];r<i.length&&We(i[r]);)n+=i[r++];if(r>=i.length||i[r]!==">")return null;n+=i[r++];}return n||null}function Xi(i,e){if(e>=i.length||i[e]!=="'"||e+1>=i.length||i[e+1].toLowerCase()!=="s")return false;if(e+2>=i.length)return true;let r=i[e+2];return We(r)||r==="*"||!J(r)}function Qi(i,e){if(e>=i.length)return null;let t=i[e];if(!Gi(t)||t==="'"&&Xi(i,e))return null;let n={'"':'"',"'":"'","`":"`","\u300C":"\u300D"}[t];if(!n)return null;let a=e+1,o=t,u=false;for(;a<i.length;){let s=i[a];if(o+=s,u)u=false;else if(s==="\\")u=true;else if(s===n)return o;a++;}return o}function Ji(i,e){if(e>=i.length)return false;let t=i[e],r=i[e+1]||"",n=i[e+2]||"";if(t==="/"&&r!=="/"&&/[a-zA-Z0-9._-]/.test(r)||t==="/"&&r==="/"&&/[a-zA-Z]/.test(n)||t==="."&&(r==="/"||r==="."&&n==="/"))return true;let a=i.slice(e,e+8).toLowerCase();return !!(a.startsWith("http://")||a.startsWith("https://"))}function ea(i,e){if(!Ji(i,e))return null;let t=e,r="",n=/[a-zA-Z0-9/:._\-?&=%@+~!$'()*,;[\]]/;for(;t<i.length;){let a=i[t];if(a==="#"){if(r.length>0&&/[a-zA-Z0-9/.]$/.test(r))for(r+=a,t++;t<i.length&&/[a-zA-Z0-9_-]/.test(i[t]);)r+=i[t++];break}if(n.test(a))r+=a,t++;else break}return r.length<2?null:r}function ta(i,e){if(e>=i.length)return null;let t=i[e];if(!be(t)&&t!=="-"&&t!=="+")return null;let r=e,n="";if((i[r]==="-"||i[r]==="+")&&(n+=i[r++]),r>=i.length||!be(i[r]))return null;for(;r<i.length&&be(i[r]);)n+=i[r++];if(r<i.length&&i[r]===".")for(n+=i[r++];r<i.length&&be(i[r]);)n+=i[r++];return r<i.length&&(i.slice(r,r+2)==="ms"?n+="ms":(i[r]==="s"||i[r]==="m"||i[r]==="h")&&(n+=i[r])),n}var ra=["===","!==","->","==","!=","<=",">=","&&","||","**","+=","-=","*=","/=","+","-","*","/","=",">","<","!","&","|","%","^","~"];new Set(ra);var ia=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"]),aa=["click","dblclick","input","change","submit","keydown","keyup","keypress","mousedown","mouseup","mouseover","mouseout","mouseenter","mouseleave","mousemove","pointerdown","pointerup","pointermove","focus","blur","load","resize","scroll"],ot=class at{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){Hi(e)&&e.setContext(Ki(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=[],r=0;for(;r<e.length;){for(;r<e.length&&We(e[r]);)r++;if(r>=e.length)break;let n=this.tryMultiWordKeyword(e,r);if(n){t.push(n),r=n.position.end;continue}let a=false;for(let o of this.extractors)if(o.canExtract(e,r)){let u=o.extract(e,r);if(u){let s=u.metadata?.normalized,l=u.metadata?.stem,c=u.metadata?.stemConfidence,p={};if(u.metadata)for(let[m,y]of Object.entries(u.metadata))m!=="normalized"&&m!=="stem"&&m!=="stemConfidence"&&(p[m]=y);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(K(u.value,this.classifyToken(u.value),H(r,r+u.length),Object.keys(d).length>0?d:void 0)),r+=u.length,a=true;break}}if(!a){let o=e[r],u=this.classifyUnknownChar(o);t.push(K(o,u,H(r,r+1))),r++;}}return new ae(this.mergeColonQualifiedNames(t),this.language)}mergeColonQualifiedNames(e){let t=[];for(let r of e){let n=t[t.length-1];if(n&&at.ASCII_WORD.test(n.value)&&at.COLON_QUALIFIER.test(r.value)&&n.position.end===r.position.start){let a=n.value+r.value;t[t.length-1]=K(a,this.classifyToken(a),H(n.position.start,r.position.end));continue}t.push(r);}return t}classifyUnknownChar(e){return "()[]{},:;".includes(e)?"punctuation":"+-*/<>=!&|".includes(e)?"operator":"identifier"}tryPropertyAccess(e,t,r){if(e[t]!==".")return false;let n=r[r.length-1],a=n&&n.position.end<t;if(n&&!a&&(n.kind==="identifier"||n.kind==="keyword"||n.kind==="selector"))return r.push(K(".","operator",H(t,t+1))),true;let s=t+1;for(;s<e.length&&J(e[s]);)s++;return s<e.length&&e[s]==="("?(r.push(K(".","operator",H(t,t+1))),true):false}initializeKeywordsFromProfile(e,t=[]){let r=new Map;if(this.rawExtraEntries=t,e.keywords){for(let[n,a]of Object.entries(e.keywords))if(r.set(a.primary,{native:a.primary,normalized:a.normalized||n}),a.alternatives)for(let o of a.alternatives)r.set(o,{native:o,normalized:a.normalized||n});}if(e.references){for(let[n,a]of Object.entries(e.references))r.set(a,{native:a,normalized:n});for(let n of Object.keys(e.references))r.has(n)||r.set(n,{native:n,normalized:n});}if(e.roleMarkers){for(let[n,a]of Object.entries(e.roleMarkers))if(a.primary&&r.set(a.primary,{native:a.primary,normalized:n}),a.alternatives)for(let o of a.alternatives)r.set(o,{native:o,normalized:n});}if(e.possessive?.keywords)for(let[n,a]of Object.entries(e.possessive.keywords))r.set(n,{native:n,normalized:a});for(let n of aa)r.has(n)||r.set(n,{native:n,normalized:n});for(let n of t)r.set(n.native,n);this.profileKeywords=Array.from(r.values()).sort((n,a)=>a.native.length-n.native.length),this.multiWordKeywords=this.profileKeywords.filter(n=>n.native.includes(" ")&&!ia.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 nt(e)}tryProfileKeyword(e,t){for(let r of this.profileKeywords)if(e.slice(t).startsWith(r.native))return K(r.native,"keyword",H(t,t+r.native.length),r.normalized);return null}tryMultiWordKeyword(e,t,r=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&&r(o)))return K(a.native,"keyword",H(t,t+a.native.length),a.normalized)}return null}isKeywordStart(e,t){let r=e.slice(t);return this.profileKeywords.some(n=>r.startsWith(n.native))}isKeywordStartAtBoundary(e,t,r=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||!r(o)})}lookupKeyword(e){let t=this.profileKeywordMap.get(e.toLowerCase());if(t)return t;let r=this.removeDiacritics(e);if(r!==e)return this.profileKeywordMap.get(r.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,r){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 K(e,"keyword",H(t,r),o)}trySelector(e,t){let r=Zi(e,t);return r?K(r,"selector",H(t,t+r.length)):null}tryEventModifier(e,t){if(e[t]!==".")return null;let r=e.slice(t).match(/^\.(?:once|debounce|throttle|queue)(?:\(([^)]+)\))?(?:\s|$|\.)/);if(!r)return null;let n=r[0].replace(/(\s|\.)$/,""),a=n.slice(1).split("(")[0],o=r[1];return {...K(n,"event-modifier",H(t,t+n.length)),metadata:{modifierName:a,value:o?a==="queue"?o:parseInt(o,10):void 0}}}tryString(e,t){let r=Qi(e,t);return r?K(r,"literal",H(t,t+r.length)):null}tryNumber(e,t){let r=ta(e,t);return r?K(r,"literal",H(t,t+r.length)):null}tryMatchTimeUnit(e,t,r,n=false){let a=t;if(n)for(;a<e.length&&We(e[a]);)a++;let o=e.slice(a);for(let u of r){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(J(c))continue}return {suffix:u.suffix,endPos:a+u.length}}}return null}parseBaseNumber(e,t,r=true){let n=t,a="";if(r&&(e[n]==="-"||e[n]==="+")&&(a+=e[n++]),n>=e.length||!be(e[n]))return null;for(;n<e.length&&be(e[n]);)a+=e[n++];if(n<e.length&&e[n]===".")for(a+=e[n++];n<e.length&&be(e[n]);)a+=e[n++];return !a||a==="-"||a==="+"?null:{number:a,endPos:n}}tryNumberWithTimeUnits(e,t,r,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=[...r,...at.STANDARD_TIME_UNITS],p=this.tryMatchTimeUnit(e,l,c,o);return p&&(s+=p.suffix,l=p.endPos),K(s,"literal",H(t,l))}tryUrl(e,t){let r=ea(e,t);return r?K(r,"url",H(t,t+r.length)):null}tryVariableRef(e,t){if(e[t]!==":"||t+1>=e.length||!J(e[t+1]))return null;let r=t+1;for(;r<e.length&&J(e[r]);)r++;let n=e.slice(t,r);return K(n,"identifier",H(t,r))}tryOperator(e,t){let r=e.slice(t,t+2);if(["==","!=","<=",">=","&&","||","->"].includes(r))return K(r,"operator",H(t,t+2));let n=e[t];return ["<",">","!","+","-","*","/","="].includes(n)?K(n,"operator",H(t,t+1)):["(",")","{","}",",",";",":"].includes(n)?K(n,"punctuation",H(t,t+1)):null}tryMultiCharParticle(e,t,r){for(let n of r)if(e.slice(t,t+n.length)===n)return K(n,"particle",H(t,t+n.length));return null}};ot.ASCII_WORD=/^[A-Za-z_][A-Za-z0-9_]*$/;ot.COLON_QUALIFIER=/^:[A-Za-z_][A-Za-z0-9_]*$/;ot.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 lr=ot;var na=Object.defineProperty,oa=Object.getOwnPropertyNames,Br=(i,e)=>function(){return i&&(e=(0, i[oa(i)[0]])(i=0)),e},ua=(i,e)=>{for(var t in e)na(i,t,{get:e[t],enumerable:true});};function cr(i,e){return i.replace(/\{(\w+)\}/g,(t,r)=>String(e[r]??`{${r}}`))}function te(i,e,t={},r){let n=Fr[i],a=cr(n,t),o=Pr[i],u=o?cr(o,t):void 0;return {code:i,message:a,severity:e,...r&&{role:r},...u&&{suggestion:u}}}var B,Fr,Pr,sa=Br({"src/generators/schema-error-codes.ts"(){B={AMBIGUOUS_TYPE_LITERAL_SELECTOR:"SCHEMA_AMBIGUOUS_TYPE_LITERAL_SELECTOR",TOO_MANY_EXPECTED_TYPES:"SCHEMA_TOO_MANY_EXPECTED_TYPES",MULTI_TYPE_PATIENT_EXPECTED:"SCHEMA_MULTI_TYPE_PATIENT_EXPECTED",NO_REQUIRED_ROLES:"SCHEMA_NO_REQUIRED_ROLES",NO_REQUIRED_ROLES_EXPECTED:"SCHEMA_NO_REQUIRED_ROLES_EXPECTED",TRANSITION_PATIENT_ACCEPTS_SELECTOR:"SCHEMA_TRANSITION_PATIENT_ACCEPTS_SELECTOR",TRANSITION_MISSING_GOAL:"SCHEMA_TRANSITION_MISSING_GOAL",EVENT_HANDLER_MISSING_EVENT:"SCHEMA_EVENT_HANDLER_MISSING_EVENT",EVENT_HANDLER_EVENT_NOT_REQUIRED:"SCHEMA_EVENT_HANDLER_EVENT_NOT_REQUIRED",CONDITIONAL_MISSING_CONDITION:"SCHEMA_CONDITIONAL_MISSING_CONDITION",CONDITIONAL_CONDITION_NOT_REQUIRED:"SCHEMA_CONDITIONAL_CONDITION_NOT_REQUIRED",FOR_LOOP_MISSING_SOURCE:"SCHEMA_FOR_LOOP_MISSING_SOURCE",WHILE_LOOP_MISSING_CONDITION:"SCHEMA_WHILE_LOOP_MISSING_CONDITION",VALUE_TYPE_MISMATCH:"SCHEMA_VALUE_TYPE_MISMATCH",SELECTOR_KIND_MISMATCH:"SCHEMA_SELECTOR_KIND_MISMATCH",SELECTOR_KINDS_WITHOUT_SELECTOR_TYPE:"SCHEMA_SELECTOR_KINDS_WITHOUT_SELECTOR_TYPE",KEYWORD_COLLISION:"PROFILE_KEYWORD_COLLISION"},Fr={[B.AMBIGUOUS_TYPE_LITERAL_SELECTOR]:"Role '{role}' accepts both 'literal' and 'selector'. This may cause ambiguous type inference for values starting with special characters (* . # etc.).",[B.TOO_MANY_EXPECTED_TYPES]:"Role '{role}' accepts {count} different types. This may make type inference unreliable.",[B.MULTI_TYPE_PATIENT_EXPECTED]:"Role '{role}' accepts multiple types (expected for {command} command).",[B.NO_REQUIRED_ROLES]:"Command has no required roles. Is this intentional?",[B.NO_REQUIRED_ROLES_EXPECTED]:"Command has no required roles (expected for {command}).",[B.TRANSITION_PATIENT_ACCEPTS_SELECTOR]:"Transition command 'patient' role (CSS property name) should only accept 'literal', not 'selector'. CSS property names like 'background-color' are strings, not CSS selectors.",[B.TRANSITION_MISSING_GOAL]:"Transition command requires a 'goal' role for the target value (to <value>). Without it, there's no way to specify what value to transition to.",[B.EVENT_HANDLER_MISSING_EVENT]:"Event handler command should have an 'event' role to specify which event to listen for.",[B.EVENT_HANDLER_EVENT_NOT_REQUIRED]:"Event role should be required - every event handler needs an event to listen for.",[B.CONDITIONAL_MISSING_CONDITION]:"Conditional command should have a 'condition' role for the boolean expression.",[B.CONDITIONAL_CONDITION_NOT_REQUIRED]:"Condition role should be required - conditionals need a condition to evaluate.",[B.FOR_LOOP_MISSING_SOURCE]:"For-loop should have a 'source' role for the collection to iterate over.",[B.WHILE_LOOP_MISSING_CONDITION]:"While-loop should have a 'condition' role for the loop condition.",[B.VALUE_TYPE_MISMATCH]:"Role '{role}' of command '{command}' expects type [{expectedTypes}], got '{actualType}'.",[B.SELECTOR_KIND_MISMATCH]:"Role '{role}' of command '{command}' expects selector kind [{selectorKinds}], got '{actualKind}'.",[B.SELECTOR_KINDS_WITHOUT_SELECTOR_TYPE]:"Role '{role}' has selectorKinds but expectedTypes does not include 'selector'.",[B.KEYWORD_COLLISION]:"Keyword '{keyword}' is used by multiple commands: {commands}. Only the first-registered command will be reachable."},Pr={[B.AMBIGUOUS_TYPE_LITERAL_SELECTOR]:"Consider being more specific about which type is expected, or use explicit type markers.",[B.TOO_MANY_EXPECTED_TYPES]:"Consider narrowing the accepted types to improve type inference reliability.",[B.TRANSITION_PATIENT_ACCEPTS_SELECTOR]:"Remove 'selector' from expectedTypes and only accept 'literal'.",[B.TRANSITION_MISSING_GOAL]:"Add a 'goal' role with expectedTypes ['literal', 'variable'].",[B.EVENT_HANDLER_MISSING_EVENT]:"Add an 'event' role with expectedTypes ['literal'].",[B.EVENT_HANDLER_EVENT_NOT_REQUIRED]:"Set required: true on the 'event' role.",[B.CONDITIONAL_MISSING_CONDITION]:"Add a 'condition' role with expectedTypes ['expression'].",[B.CONDITIONAL_CONDITION_NOT_REQUIRED]:"Set required: true on the 'condition' role.",[B.FOR_LOOP_MISSING_SOURCE]:"Add a 'source' role for the collection to iterate over.",[B.WHILE_LOOP_MISSING_CONDITION]:"Add a 'condition' role for the loop continuation condition.",[B.VALUE_TYPE_MISMATCH]:"Ensure the value matches one of the expected types: [{expectedTypes}].",[B.SELECTOR_KIND_MISMATCH]:"Use a selector of the correct kind: [{selectorKinds}].",[B.SELECTOR_KINDS_WITHOUT_SELECTOR_TYPE]:"Either add 'selector' to expectedTypes or remove selectorKinds.",[B.KEYWORD_COLLISION]:"Give each command a unique keyword. Move the shared keyword to alternatives on one command, or use a more specific translation."};}}),Rr={};ua(Rr,{SchemaErrorCodes:()=>B,formatValidationResults:()=>fa,getValidationStats:()=>va,validateAllKeywordCollisions:()=>Ea,validateAllSchemas:()=>ya,validateCommandSchema:()=>Or,validateKeywordCollisions:()=>_r,validateRoleValues:()=>ha});function la(i,e){return {action:i,items:e}}function Or(i){let e=[];for(let r of i.roles)r.expectedTypes.includes("literal")&&r.expectedTypes.includes("selector")&&(r.role==="patient"&&xt.has(i.action)?e.push(te(B.MULTI_TYPE_PATIENT_EXPECTED,"note",{role:r.role,command:i.action},r.role)):e.push(te(B.AMBIGUOUS_TYPE_LITERAL_SELECTOR,"warning",{role:r.role},r.role))),r.expectedTypes.length>3&&!xt.has(i.action)&&e.push(te(B.TOO_MANY_EXPECTED_TYPES,"warning",{role:r.role,count:r.expectedTypes.length},r.role));for(let r of i.roles)r.selectorKinds&&r.selectorKinds.length>0&&(r.expectedTypes.includes("selector")||e.push(te(B.SELECTOR_KINDS_WITHOUT_SELECTOR_TYPE,"warning",{role:r.role},r.role)));switch(i.action){case "transition":ca(i,e);break;case "on":pa(i,e);break;case "if":case "unless":da(i,e);break;case "repeat":case "for":case "while":ma(i,e);break}return i.roles.filter(r=>r.required).length===0&&(Nr.has(i.action)?e.push(te(B.NO_REQUIRED_ROLES_EXPECTED,"note",{command:i.action})):e.push(te(B.NO_REQUIRED_ROLES,"warning",{}))),la(i.action,e)}function ca(i,e){let t=i.roles.find(n=>n.role==="patient"),r=i.roles.find(n=>n.role==="goal");t&&!r&&e.push(te(B.TRANSITION_MISSING_GOAL,"error",{}));}function pa(i,e){let t=i.roles.find(r=>r.role==="event");t||e.push(te(B.EVENT_HANDLER_MISSING_EVENT,"warning",{})),t&&!t.required&&e.push(te(B.EVENT_HANDLER_EVENT_NOT_REQUIRED,"warning",{}));}function da(i,e){let t=i.roles.find(r=>r.role==="condition");t||e.push(te(B.CONDITIONAL_MISSING_CONDITION,"warning",{})),t&&!t.required&&e.push(te(B.CONDITIONAL_CONDITION_NOT_REQUIRED,"warning",{}));}function ma(i,e){i.action==="for"?i.roles.find(r=>r.role==="source")||e.push(te(B.FOR_LOOP_MISSING_SOURCE,"warning",{})):i.action==="while"&&(i.roles.find(r=>r.role==="condition")||e.push(te(B.WHILE_LOOP_MISSING_CONDITION,"warning",{})));}function ya(i,e={}){let t=new Map,{includeNotes:r=false}=e;for(let[n,a]of Object.entries(i)){let o=Or(a),u=o.items.some(l=>l.severity==="warning"||l.severity==="error"),s=r&&o.items.some(l=>l.severity==="note");(u||s)&&t.set(n,o);}return t}function fa(i,e={}){let t=[],{showNotes:r=false,showCodes:n=true}=e;for(let[a,o]of i){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(r&&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 va(i){let e=0,t=0,r=0,n={};for(let a of i.values())for(let o of a.items)o.severity==="error"?e++:o.severity==="warning"?t++:o.severity==="note"&&r++,n[o.code]=(n[o.code]||0)+1;return {totalCommands:i.size,errors:e,warnings:t,notes:r,byCode:n}}function ha(i,e){let t=[];for(let r of e){let n=i.roles.find(a=>a.role===r.role);n&&(n.expectedTypes.length>0&&!n.expectedTypes.includes(r.type)&&(n.expectedTypes.includes("expression")||t.push({level:"error",role:r.role,message:`${i.action}.${r.role} expects type [${n.expectedTypes.join(", ")}], got '${r.type}'`,code:B.VALUE_TYPE_MISMATCH})),r.type==="selector"&&r.selectorKind&&n.selectorKinds&&n.selectorKinds.length>0&&(n.selectorKinds.includes(r.selectorKind)||t.push({level:"error",role:r.role,message:`${i.action}.${r.role} expects selector kind [${n.selectorKinds.join(", ")}], got '${r.selectorKind}'`,code:B.SELECTOR_KIND_MISMATCH})));}return t}function _r(i){let e=[];if(!i.keywords)return {language:i.code,collisions:e};let t=new Map;for(let[n,a]of Object.entries(i.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)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 r={"primary-primary":0,"primary-alternative":1,"alternative-alternative":2};return e.sort((n,a)=>r[n.type]-r[a.type]),{language:i.code,collisions:e}}function Ea(i){let e=[];for(let[,t]of Object.entries(i)){let r=_r(t);r.collisions.length>0&&e.push(r);}return e.sort((t,r)=>t.language.localeCompare(r.language))}var xt,Nr,ga=Br({"src/generators/schema-validator.ts"(){sa(),xt=new Set(["put","append","prepend","log","throw","make","measure","return","swap","morph","beep","copy"]),Nr=new Set(["compound","else","halt","continue","async","init","settle","focus","blur","return","js","measure","break","exit","beep","empty","open","close","select","clear","reset","breakpoint","live","eventsource","socket","worker","intercept"]);}});function xe(i){let e=i.roles.find(t=>t.role==="destination");return e?{destination:e.default?{fromRole:"destination",default:e.default}:{fromRole:"destination"}}:{}}function De(i){let e=i.roles.find(t=>t.role==="source");return e?{source:e.default?{fromRole:"source",default:e.default}:{fromRole:"source"}}:{}}function Se(i,e){return Rt(i,e,"source")}function Pt(i,e){return Rt(i,e,"destination")}function ka(i,e){return Rt(i,e,"patient")}function Rt(i,e,t){if(!e||!i.roles.some(a=>a.role===t))return [];let r=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,r]:[r,n]}]}var ba={action:"toggle",description:"Toggle a class or attribute on/off",category:"dom-class",primaryRole:"patient",ast:{args:["patient"],modifiers:{on:"destination",for:"duration"}},roles:[{role:"patient",description:"The class or attribute to toggle",required:true,expectedTypes:["selector"],selectorKinds:["class","attribute"],svoPosition:1,sovPosition:2,markerOptional:{zh:true}},{role:"destination",description:"The target element (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:2,sovPosition:1,markerVariants:{ko:["\uC5D0\uC11C"]}},{role:"duration",description:"How long the class stays on before reverting (`toggle .a for 2s`)",required:false,expectedTypes:["literal"],svoPosition:3,sovPosition:3,valueShape:"time",markerOverride:{en:"for",ja:"\u9593",ko:"\uB3D9\uC548"}}],errorCodes:["MISSING_ARGUMENT","NO_VALID_CLASS_NAMES","INVALID_CSS_PROPERTY"],preconditions:[{condition:"Command has at least one argument",errorCode:"MISSING_ARGUMENT",message:"toggle command requires an argument"},{condition:"Class names are valid CSS identifiers",errorCode:"NO_VALID_CLASS_NAMES",message:"toggle command: no valid class names found"}],recoveryHints:{MISSING_ARGUMENT:"Add a class selector (.classname) or attribute to toggle",NO_VALID_CLASS_NAMES:"Ensure class names start with a dot (.) and are valid CSS identifiers",INVALID_CSS_PROPERTY:"Check CSS property name syntax (use kebab-case)"}},wa={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"}},za={action:"remove",description:"Remove a class or attribute from an element",category:"dom-class",primaryRole:"patient",ast:{args:["patient"],modifiers:{from:"source"}},targetRole:"source",roles:[{role:"patient",description:"The class/attribute to remove, or the element to remove",required:true,expectedTypes:["selector","reference"],svoPosition:1,sovPosition:2},{role:"source",description:"The element to remove from (defaults to me)",required:false,expectedTypes:["selector","reference","expression"],default:{type:"reference",value:"me"},svoPosition:2,sovPosition:1}],errorCodes:["MISSING_ARGUMENT","NO_VALID_CLASS_NAMES"],preconditions:[{condition:"Command has at least one argument",errorCode:"MISSING_ARGUMENT",message:"remove command requires an argument"}],recoveryHints:{MISSING_ARGUMENT:"Add a class selector (.classname) or attribute to remove",NO_VALID_CLASS_NAMES:"Ensure class names start with a dot (.) and are valid CSS identifiers"}},Ca={action:"put",description:"Put content into a target element or variable",category:"dom-content",primaryRole:"patient",roles:[{role:"patient",description:"The content to put",required:true,expectedTypes:["literal","selector","reference","expression"],svoPosition:1,sovPosition:1},{role:"destination",description:"Where to put the content",required:true,expectedTypes:["selector","reference"],svoPosition:2,sovPosition:2,markerOverride:{en:"into",ar:"\u0641\u064A",zh:"\u5230",fr:"dans",de:"in",he:"\u05D1",id:"ke",sw:"kwa"},markerVariants:{en:["before","after"]},markerLegacy:{ar:["\u0639\u0644\u0649","\u0625\u0644\u0649","\u0628"],zh:["\u5728","\u4E8E"],fr:["sur","\xE0"],de:["auf","zu"],he:["\u05E2\u05DC","\u05D0\u05DC","\u05DC"],id:["pada","di"],sw:["kwenye"]},methodCarrier:"method"}],errorCodes:["MISSING_ARGUMENTS","MISSING_CONTENT","MISSING_POSITION","INVALID_POSITION","NO_TARGET","NO_ELEMENTS"],preconditions:[{condition:"Command has content and position arguments",errorCode:"MISSING_ARGUMENTS",message:"put requires arguments"},{condition:"Content to put is specified",errorCode:"MISSING_CONTENT",message:"put requires content"},{condition:"Position keyword is specified (into, before, after, etc.)",errorCode:"MISSING_POSITION",message:"put requires position keyword"}],recoveryHints:{MISSING_ARGUMENTS:"Use syntax: put <content> into/before/after <target>",MISSING_CONTENT:"Add content to put (string, element, or expression)",MISSING_POSITION:"Add position keyword: into, before, after, at start of, at end of",INVALID_POSITION:"Valid positions: into, before, after, at start of, at end of",NO_TARGET:'Ensure target element exists or use "me" reference',NO_ELEMENTS:"Check that the selector matches existing elements"}},Aa={action:"set",description:"Set a property or variable to a value",category:"variable",primaryRole:"destination",ast:{args:["destination"],modifiers:{to:"patient",on:"scope"}},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:"",bn:"\u0995\u09C7",qu:"ta",hi:"\u0915\u094B",zh:"\u628A"},markerOptional:{zh:true}},{role:"patient",description:"The value to set",required:true,expectedTypes:["literal","expression","reference"],svoPosition:2,sovPosition:2,markerOverride:{en:"to",es:"a",pt:"para",fr:"\xE0",de:"auf",id:"ke",ja:"\u306B",ko:"\uC5D0",tr:"e",ar:"\u0625\u0644\u0649",sw:"kwenye",tl:"sa",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>"}},xa={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>"}},Da={action:"live",description:"Reactive block: re-run the body when its dependencies change",category:"control-flow",primaryRole:"patient",hasBody:true,bareKeyword:true,roles:[]},Sa={action:"eventsource",description:"Open a Server-Sent Events stream and handle its events",category:"async",primaryRole:"patient",hasBody:true,bareKeyword:true,roles:[]},Ta={action:"socket",description:"Open a WebSocket and handle its messages",category:"async",primaryRole:"patient",hasBody:true,bareKeyword:true,roles:[]},Ba={action:"worker",description:"Define a Web Worker with inline methods",category:"async",primaryRole:"patient",hasBody:true,bareKeyword:true,roles:[]},Fa={action:"intercept",description:"Service-worker fetch interception / caching strategies",category:"async",primaryRole:"patient",hasBody:true,bareKeyword:true,roles:[]},Pa={action:"show",description:"Make an element visible",category:"dom-visibility",primaryRole:"patient",ast:{args:[["destination","patient"]],modifiers:{with:"duration"}},roles:[{role:"patient",description:"The element to show",required:true,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:1,sovPosition:1},{role:"style",description:"Animation style (fade, slide, etc.)",required:false,expectedTypes:["literal"],svoPosition:2,sovPosition:2}]},Ra={action:"hide",description:"Make an element invisible",category:"dom-visibility",primaryRole:"patient",ast:{args:[["destination","patient"]],modifiers:{with:"duration"}},roles:[{role:"patient",description:"The element to hide",required:true,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:1,sovPosition:1},{role:"style",description:"Animation style (fade, slide, etc.)",required:false,expectedTypes:["literal"],svoPosition:2,sovPosition:2}]},Oa={action:"on",description:"Handle an event",category:"event",primaryRole:"event",ast:{args:["event"],modifiers:{from:"source"}},hasBody:true,roles:[{role:"event",description:"The event to handle",required:true,expectedTypes:["literal"],svoPosition:1,sovPosition:2},{role:"source",description:"The element to listen on (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:2,sovPosition:1}]},_a={action:"trigger",description:"Trigger/dispatch an event",category:"event",primaryRole:"event",ast:{args:["event"],modifiers:{on:"destination"}},roles:[{role:"event",description:"The event to trigger (supports namespaced events like draggable:start)",required:true,expectedTypes:["literal","expression"],svoPosition:1,sovPosition:2,markerVariants:{hi:["\u0915\u094B"],qu:["ta"],bn:["\u0995\u09C7"]}},{role:"destination",description:"The target element (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:2,sovPosition:1}]},Na={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}]},Ia={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"],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}]},La={action:"increment",description:"Increment a numeric value",category:"variable",primaryRole:"patient",ast:{args:[["destination","patient"]],modifiers:{by:"quantity"}},roles:[{role:"patient",description:"The value to increment",required:true,expectedTypes:["selector","reference","expression"],svoPosition:1,sovPosition:1},{role:"quantity",description:"Amount to increment by (defaults to 1)",required:false,expectedTypes:["literal"],default:{type:"literal",value:1,dataType:"number"},svoPosition:2,sovPosition:2,markerOverride:{en:"by",es:"por",pt:"por",fr:"par",de:"um"}}]},Ma={action:"decrement",description:"Decrement a numeric value",category:"variable",primaryRole:"patient",ast:{args:[["destination","patient"]],modifiers:{by:"quantity"}},roles:[{role:"patient",description:"The value to decrement",required:true,expectedTypes:["selector","reference","expression"],svoPosition:1,sovPosition:1},{role:"quantity",description:"Amount to decrement by (defaults to 1)",required:false,expectedTypes:["literal"],default:{type:"literal",value:1,dataType:"number"},svoPosition:2,sovPosition:2,markerOverride:{en:"by",es:"por",pt:"por",fr:"par",de:"um"}}]},$a={action:"append",description:"Append content to an element",category:"dom-content",primaryRole:"patient",ast:{args:["patient"],modifiers:{to:"destination"}},omitRoleVariants:["destination"],roles:[{role:"patient",description:"The content to append",required:true,expectedTypes:["literal","selector","reference","expression"],svoPosition:1,sovPosition:2},{role:"destination",description:"The element to append to",required:true,expectedTypes:["selector","reference","expression"],svoPosition:2,sovPosition:1,markerOverride:{en:"to"}}]},qa={action:"prepend",description:"Prepend content to an element",category:"dom-content",primaryRole:"patient",ast:{args:["patient"],modifiers:{to:"destination"}},omitRoleVariants:["destination"],roles:[{role:"patient",description:"The content to prepend",required:true,expectedTypes:["literal","selector","reference","expression"],svoPosition:1,sovPosition:2},{role:"destination",description:"The element to prepend to",required:true,expectedTypes:["selector","reference","expression"],svoPosition:2,sovPosition:1,markerOverride:{en:"to"}}]},ja={action:"log",description:"Log a value to the console",category:"variable",primaryRole:"patient",ast:{args:["patient"]},roles:[{role:"patient",description:"The value to log",required:true,expectedTypes:["literal","selector","reference","expression"],svoPosition:1,sovPosition:1}]},Va={action:"get",description:"Get a value from a source",category:"variable",primaryRole:"source",ast:{args:[["source","patient"]]},roles:[{role:"source",description:"The source to get from",required:true,expectedTypes:["selector","reference","expression"],svoPosition:1,sovPosition:2,markerOverride:{en:"",es:"",pt:"",fr:"",de:"",ja:"\u3092",zh:"",ko:"\uB97C",ar:"\u0639\u0644\u0649",tr:"i",id:"",he:"\u05D0\u05EA",sw:"",tl:"",bn:"\u0995\u09C7",qu:"ta"}},{role:"destination",description:"Where to store the result (optional)",required:false,expectedTypes:["reference"],svoPosition:2,sovPosition:1}]},Wa={action:"take",description:"Take content from a source element",category:"dom-content",primaryRole:"patient",ast:{args:["patient"],modifiers:{from:"source",for:"recipient"}},roles:[{role:"patient",description:"The class or element to take",required:true,expectedTypes:["selector"],svoPosition:1,sovPosition:2},{role:"source",description:"The element to take from (defaults to all current holders)",required:false,expectedTypes:["selector","reference"],svoPosition:2,sovPosition:1},{role:"recipient",description:"The element the class moves ONTO (`take .active from .tab for me`)",required:false,expectedTypes:["reference"],svoPosition:3,sovPosition:3,valueShape:"reference",markerOverride:{en:"for"}}]},Ha={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}]},Ka={action:"halt",description:"Halt/stop execution or event propagation",category:"control-flow",primaryRole:"patient",ast:{args:["patient"]},roles:[{role:"patient",description:"What to halt (event, default, bubbling, etc.)",required:false,expectedTypes:["literal","reference","expression"],svoPosition:1,sovPosition:1}]},Ua={action:"settle",description:"Wait for animations/transitions to settle",category:"async",primaryRole:"patient",ast:{args:[["destination","patient"]],isBlocking:true},roles:[{role:"patient",description:"The element to settle (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:1,sovPosition:1}]},Ga={action:"throw",description:"Throw an error",category:"control-flow",primaryRole:"patient",ast:{args:["patient"]},roles:[{role:"patient",description:"The error message or object to throw",required:true,expectedTypes:["literal","expression"],svoPosition:1,sovPosition:1}]},Ya={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"}}]},Za={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}]},Xa={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}]},Qa={action:"else",description:"Else branch of conditional",category:"control-flow",primaryRole:"patient",hasBody:true,roles:[]},Ja={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"'},en={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"}}]},tn={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}]},rn={action:"continue",description:"Continue to next loop iteration",category:"control-flow",primaryRole:"patient",ast:{},roles:[]},Ot={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"},an={action:"go",description:"Navigate to a URL",category:"navigation",primaryRole:"destination",roles:[{role:"destination",description:"The URL to navigate to",required:true,expectedTypes:["literal","expression"],svoPosition:1,sovPosition:1,markerOverride:{en:"to",es:"a",ar:"\u0625\u0644\u0649",fr:"\xE0",de:"zu",pt:"para",he:"\u05D0\u05DC",hi:"\u092A\u0930",id:"ke",it:"a",ru:"\u043D\u0430",sw:"kwa",uk:"\u043D\u0430"},renderOverride:{en:"",zh:"",vi:"",th:""},markerOptional:{en:true,zh:true,vi:true,th:true},markerVariants:{zh:["\u628A"]},markerLegacy:{es:["en","sobre","hacia"],ar:["\u0639\u0644\u0649","\u0641\u064A","\u0628"],fr:["sur","dans"],de:["auf","in"],pt:["em","a"],he:["\u05E2\u05DC","\u05D1","\u05DC","\u05D0\u05EA"],hi:["\u092E\u0947\u0902"],id:["pada","di"],it:["in","su"],ru:["\u0432","\u043A"],sw:["kwenye"],uk:["\u0432","\u0434\u043E"]}}],rolePrefixLiteralVariants:[{role:"destination",literal:Ot,idSuffix:"url",priorityDelta:5,methodCarrier:"method"}]},nn={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}]},on={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"}}]},un={action:"focus",description:"Focus an element",category:"dom-content",primaryRole:"patient",ast:{args:[["destination","patient"]]},roles:[{role:"patient",description:"The element to focus (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:1,sovPosition:1}]},sn={action:"blur",description:"Remove focus from an element",category:"dom-content",primaryRole:"patient",ast:{args:[["destination","patient"]]},roles:[{role:"patient",description:"The element to blur (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:1,sovPosition:1}]},ln={action:"empty",description:"Remove all children from an element (sets innerHTML to empty)",category:"dom-content",primaryRole:"patient",roles:[{role:"patient",description:"The element to empty (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:1,sovPosition:1}]},cn={action:"open",description:"Open a dialog, details element, or popover",category:"dom-content",primaryRole:"patient",ast:{args:["patient"],modifiers:{as:"style"}},roles:[{role:"patient",description:"The element to open (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:1,sovPosition:2},{role:"style",description:"Open-mode variant (modal / non-modal) for <dialog>",required:false,expectedTypes:["literal","expression"],svoPosition:2,sovPosition:1,markerOverride:{en:"as",ja:"\u3068\u3057\u3066"}}]},pn={action:"close",description:"Close a dialog, details element, or popover",category:"dom-content",primaryRole:"patient",roles:[{role:"patient",description:"The element to close (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:1,sovPosition:1}]},dn={action:"select",description:"Select the contents of a text field or DOM element",category:"dom-content",primaryRole:"patient",roles:[{role:"patient",description:"The element whose contents to select (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:1,sovPosition:1}]},mn={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}]},yn={action:"reset",description:"Reset a <form> element to its default values",category:"dom-content",primaryRole:"patient",roles:[{role:"patient",description:"The form element to reset (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:1,sovPosition:1}]},fn={action:"breakpoint",description:"Drop into the debugger",category:"control-flow",primaryRole:"patient",roles:[],bareKeyword:true},vn={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}]},hn={action:"return",description:"Return a value from a function",category:"control-flow",primaryRole:"patient",ast:{args:["patient"]},roles:[{role:"patient",description:"The value to return",required:false,expectedTypes:["literal","expression","reference"],svoPosition:1,sovPosition:1}]},En={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}]},gn={action:"async",description:"Execute commands asynchronously",category:"async",primaryRole:"patient",ast:{},hasBody:true,roles:[]},kn={action:"tell",description:"Execute commands in context of another element",category:"control-flow",primaryRole:"destination",ast:{args:[["destination","patient"]]},hasBody:true,roles:[{role:"destination",description:"The element to tell",required:true,expectedTypes:["selector","reference"],svoPosition:1,sovPosition:1,markerOverride:{en:"",he:"\u05D0\u05EA",zh:"\u628A"}}]},bn={action:"default",description:"Set a default value for a variable",category:"variable",primaryRole:"destination",ast:{args:["destination"],modifiers:{to:"patient"}},roles:[{role:"destination",description:"The variable to set default for",required:true,expectedTypes:["selector","reference","expression","property-path"],svoPosition:1,sovPosition:1,markerOverride:{en:"",ar:"",tl:"",sw:"",bn:"\u0995\u09C7",qu:"ta",ja:"\u3092",ko:"\uB97C",tr:"i",hi:"\u0915\u094B",de:"",es:"",fr:"",it:"",pt:"",pl:"",ru:"",uk:"",vi:"",id:"",ms:"",th:"",zh:"\u628A",he:"\u05D0\u05EA"}},{role:"patient",description:"The default value",required:true,expectedTypes:["literal","expression"],svoPosition:2,sovPosition:2,markerOverride:{en:"to",ar:"\u0625\u0644\u0649",tl:"sa",sw:"kwa",bn:"\u09A4\u09C7",qu:"man",ja:"\u306B",ko:"\uC5D0",tr:"e",hi:"\u092E\u0947\u0902",de:"zu",es:"a",fr:"\xE0",it:"in",pt:"para",pl:"do",ru:"\u0432",uk:"\u0432",vi:"v\xE0o",id:"ke",ms:"ke",th:"\u0E43\u0E19",zh:"\u5230",he:"\u05E2\u05DC"}}]},wn={action:"init",description:"Initialization block that runs once",category:"control-flow",primaryRole:"patient",ast:{},hasBody:true,roles:[]},zn={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}]},Cn={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}]},An={action:"measure",description:"Measure element dimensions (x, y, width, height, etc.)",category:"dom-content",primaryRole:"patient",ast:{args:["patient"],modifiers:{of:["destination","source"]}},roles:[{role:"patient",description:"Property to measure (x, y, width, height, top, left, etc.)",required:false,expectedTypes:["literal","expression"],svoPosition:1,sovPosition:1},{role:"source",description:"Element to measure (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:2,sovPosition:2,markerOverride:{en:"of"}}]},xn={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"},_t={role:"manner",description:"Run the swap inside a `document.startViewTransition()` (`using view transition`)",required:false,expectedTypes:["literal","expression"],valueShape:"keyword",markerOverride:xn},Dn={action:"swap",description:"Swap DOM content using various strategies (innerHTML, outerHTML, delete, etc.)",category:"dom-content",primaryRole:"destination",ast:{args:["method","destination","patient"],modifiers:{viewTransition:"manner"}},roles:[{role:"method",description:"The swap strategy (innerHTML, outerHTML, beforebegin, afterend, delete)",required:false,expectedTypes:["literal"],svoPosition:1,sovPosition:3,markerOverride:{en:""}},{role:"destination",description:"The element to swap content in/for",required:true,expectedTypes:["selector","reference"],svoPosition:2,sovPosition:1,markerOverride:{en:"of",es:"",fr:"",pt:"",it:"",de:"",pl:"",ru:"",uk:"",id:"",ms:"",sw:"",th:"",vi:"",he:"\u05D0\u05EA",zh:"\u628A"}},{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"}},{..._t,svoPosition:4,sovPosition:4}]},Sn={action:"morph",description:"Morph an element into another using DOM diffing",category:"dom-content",primaryRole:"patient",ast:{args:[["source","destination"]],modifiers:{on:"patient",viewTransition:"manner"}},roles:[{role:"patient",description:"The element to morph",required:true,expectedTypes:["selector","reference"],svoPosition:1,sovPosition:1,markerOverride:{en:""}},{role:"destination",description:"The target content/element to morph into",required:true,expectedTypes:["literal","expression","selector","reference"],svoPosition:2,sovPosition:2,markerOverride:{en:"to"}},{..._t,svoPosition:3,sovPosition:3}]},Tn={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}]},Bn={action:"break",description:"Exit from the current loop",category:"control-flow",primaryRole:"patient",roles:[]},Fn={action:"copy",description:"Copy text or element content to the clipboard",category:"dom-content",primaryRole:"patient",roles:[{role:"patient",description:"The text or element to copy",required:true,expectedTypes:["literal","selector","reference","expression"],svoPosition:1,sovPosition:1}]},Pn={action:"exit",description:"Exit from the current event handler",category:"control-flow",primaryRole:"patient",roles:[],bareKeyword:true},Rn={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}]},On={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"}}]},_n={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"},Nn={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:Ot}]},In={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:Ot}]},Ln={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:_n},{..._t,svoPosition:2,sovPosition:2}]},Mn={action:"render",description:"Render a template with optional variables",category:"dom-content",primaryRole:"patient",roles:[{role:"patient",description:"The template to render",required:true,expectedTypes:["selector","reference","expression"],svoPosition:1,sovPosition:2},{role:"style",description:"Variables to pass to the template (with keyword)",required:false,expectedTypes:["expression","reference"],svoPosition:2,sovPosition:1}]},ke={toggle:ba,add:wa,remove:za,put:Ca,set:Aa,show:Pa,hide:Ra,on:Oa,trigger:_a,wait:Na,fetch:Ia,increment:La,decrement:Ma,append:$a,prepend:qa,log:ja,get:Va,take:Wa,make:Ha,halt:Ka,settle:Ua,throw:Ga,send:Ya,if:Za,unless:Xa,else:Qa,repeat:Ja,for:en,while:tn,continue:rn,go:an,scroll:On,push:Nn,replace:In,process:Ln,transition:nn,clone:on,focus:un,blur:sn,empty:ln,open:cn,close:pn,select:dn,clear:mn,reset:yn,breakpoint:fn,call:vn,return:hn,js:En,async:gn,tell:kn,default:bn,init:wn,behavior:zn,install:Cn,measure:An,swap:Dn,morph:Sn,beep:Tn,break:Bn,copy:Fn,exit:Pn,pick:Rn,render:Mn,bind:xa,live:Da,eventsource:Sa,socket:Ta,worker:Ba,intercept:Fa,compound:{action:"compound",description:"A compound node representing chained statements",primaryRole:"patient",category:"control-flow",hasBody:true,roles:[]}};function ee(i){return ke[i]}function $n(){return Object.values(ke).filter(i=>i.roles.length>0||i.bareKeyword===true)}typeof process<"u"&&process.env.LOKASCRIPT_SCHEMA_VALIDATION==="1"&&Promise.resolve().then(()=>(ga(),Rr)).then(({validateAllSchemas:i,formatValidationResults:e})=>{let t=i(ke);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(i=>{console.debug("Schema validation skipped:",i);});var Ae=new Map,me=new Map,Ne=new Map,Dt=null;function Ir(i,e){let t={...i};for(let r of Object.keys(e)){let n=e[r],a=i[r];n!==void 0&&(typeof n=="object"&&n!==null&&!Array.isArray(n)&&typeof a=="object"&&a!==null&&!Array.isArray(a)?t[r]=Ir(a,n):t[r]=n);}return t}function qn(i,e){return Ir(i,e)}function Nt(i){if(!i.extends)return i;let e=me.get(i.extends);if(!e)return console.warn(`[Registry] Profile '${i.code}' extends '${i.extends}' but base is not registered. Make sure to import the base language before the variant.`),i;let t=Nt(e);return qn(t,i)}function Lr(i,e,t){Ae.set(i,e),me.set(i,t),Ne.delete(i);}function Mr(i){Dt=i;}var St=new Map;function $r(i,e){St.set(i,e),Ne.delete(i);}function Le(i){return i.split("-")[0]}function Me(i){return i.includes("-")}function jn(i){let e=Ae.get(i);if(!e&&Me(i)){let t=Le(i);e=Ae.get(t);}if(!e){let t=Array.from(Ae.keys()).join(", ");throw new Error(`Language '${i}' is not registered. Registered languages: ${t||"none"}. Import the language module first: import '@lokascript/semantic/languages/${i}';`)}return e}function Vn(i){let e=me.get(i);if(!e&&Me(i)){let t=Le(i);e=me.get(t);}if(!e){let t=Array.from(me.keys()).join(", ");throw new Error(`Language profile '${i}' is not registered. Registered languages: ${t||"none"}. Import the language module first: import '@lokascript/semantic/languages/${i}';`)}return Nt(e)}function I(i){let e=me.get(i);return !e&&Me(i)&&(e=me.get(Le(i))),e?Nt(e):void 0}function Wn(){return Array.from(Ae.keys())}function qr(i){if(Ae.has(i)&&me.has(i))return true;if(Me(i)){let e=Le(i);return Ae.has(e)&&me.has(e)}return false}function Hn(i,e){return jn(e).tokenize(i)}function de(i){let e=Ne.get(i);if(!e&&Me(i)&&(e=Ne.get(Le(i))),e)return e;let t=St.get(i);if(!t&&Me(i)&&(t=St.get(Le(i))),t)return Ne.set(i,t),t;if(!Dt)throw new Error(`No patterns registered for language '${i}'. Either import the language module or set a pattern generator.`);let r=Vn(i),n=Dt(r);return Ne.set(i,n),n}var jr={possessive:{specialForms:{me:"my",it:"its",you:"your"}}};function Ce(i){let e="complex";return i.startsWith("#")&&!i.includes(" ")?e="id":i.startsWith(".")&&!i.includes(" ")?e="class":i.startsWith("[")&&i.endsWith("]")?e="attribute":/^[a-z][a-z0-9]*$/i.test(i)&&(e="element"),{type:"selector",value:i,selectorKind:e}}function q(i,e){let t={type:"literal",value:i};return e!==void 0?{type:"literal",value:i,dataType:e}:t}function Oe(i){return bt(i)}function ue(i){return {type:"reference",value:i}}function we(i,e){return {type:"property-path",object:i,property:e}}function ne(i,e,t){let r={kind:"command",action:i,roles:new Map(Object.entries(e))};return t!==void 0?{...r,metadata:t}:r}function Ke(i,e,t,r,n,a){let o=new Map;o.set("event",i);let u={kind:"event-handler",action:"on",roles:o,body:e};return t!==void 0&&(u.eventModifiers=t),r!==void 0&&(u.metadata=r),n!==void 0&&n.length>0&&(u.parameterNames=n),u}function ho(i,e,t,r,n){let a={kind:"behavior",action:"behavior",roles:new Map,name:i,parameters:e,eventHandlers:t};return r!==void 0&&r.length>0&&(a.initBlock=r),n!==void 0&&(a.metadata=n),a}function Eo(i,e,t,r){let n={kind:"def",action:"def",roles:new Map,name:i,parameters:e,body:t};return r!==void 0&&(n.metadata=r),n}function pr(i,e,t,r){let n={kind:"feature",action:i,roles:new Map,body:e};return t!==void 0&&(n.name=t),r!==void 0&&(n.metadata=r),n}function Tt(i,e="then",t){let r={kind:"compound",action:"compound",roles:new Map,statements:i,chainType:e};return t!==void 0&&(r.metadata=t),r}function go(i,e,t,r){let n=new Map;n.set("condition",i);let a={kind:"conditional",action:"if",roles:n,thenBranch:e};return t!==void 0&&(a.elseBranch=t),r!==void 0&&(a.metadata=r),a}function ut(i,e){return !e||e.length===0||e.includes(i)||e.includes("expression")?true:i==="property-path"?e.some(t=>["selector","reference","expression"].includes(t)):i==="expression"?e.some(t=>["selector","reference","expression"].includes(t)):false}function ko(i,e){let t=i.markerOverride?.[e.code],r=e.roleMarkers[i.role];if(t!==void 0){let n=bo(i,e.code,t);return {primary:t,...n&&{alternatives:n},position:r?.position??"before",isOverride:true}}if(r&&r.primary){let n={primary:r.primary,position:r.position,isOverride:false};return r.alternatives&&(n.alternatives=r.alternatives),n}return null}function bo(i,e,t){let r=i.markerLegacy?.[e];if(!r?.length)return;let n=[...new Set(r)].filter(a=>a&&a!==t);return n.length?n:void 0}function ye(i,e,t){let r=i.markerLegacy?.[e]??[],n=i.methodCarrier?[]:i.markerVariants?.[e]??[],a=[...new Set([...r,...n])].filter(o=>o&&o!==t);return a.length?a:void 0}var Vr=new Set(["destination","source","patient","object","event","eventmarker","manner","instrument"]);function ce(i,e){let t=i.possessive?.keywords?.[e];if(t)return t;let r=i.possessive?.specialForms;if(r){for(let[n,a]of Object.entries(r))if(a===e)return n}}function wt(i){return jr.possessive?.specialForms?.[i]??`${i}'s`}var wo={ar:{\u0642\u064A\u0645\u0629:"value"},bn:{\u0985\u0995\u09CD\u09B7\u09AE:"disabled","\u099A\u09C7\u0995 \u0995\u09B0\u09BE":"checked",\u09A6\u09C8\u09B0\u09CD\u0998\u09CD\u09AF:"length",\u09AE\u09BE\u09A8:"value"},de:{wert:"value"},es:{valor:"value"},fr:{valeur:"value"},hi:{\u0905\u0915\u094D\u0937\u092E:"disabled",\u091A\u0947\u0915:"checked",\u091B\u093F\u092A\u093E:"hidden",\u092E\u093E\u0928:"value"},id:{nilai:"value"},it:{valore:"value"},ja:{\u5024:"value"},ko:{\uAC12:"value"},ms:{dilumpuhkan:"disabled",ditanda:"checked",nilai:"value",panjang:"length"},pl:{warto\u015B\u0107:"value"},pt:{valor:"value"},qu:{chanin:"value"},ru:{\u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435:"value",\u043E\u0442\u043A\u043B\u044E\u0447\u0435\u043D\u043E:"disabled",\u043E\u0442\u043C\u0435\u0447\u0435\u043D\u043E:"checked",\u0441\u043A\u0440\u044B\u0442\u043E:"hidden"},sw:{thamani:"value"},th:{\u0E04\u0E27\u0E32\u0E21\u0E22\u0E32\u0E27:"length",\u0E04\u0E48\u0E32:"value",\u0E1B\u0E34\u0E14\u0E43\u0E0A\u0E49\u0E07\u0E32\u0E19:"disabled",\u0E40\u0E25\u0E37\u0E2D\u0E01\u0E41\u0E25\u0E49\u0E27:"checked"},tl:{haba:"length",halaga:"value",hindi_pinagana:"disabled",naka_tsek:"checked"},tr:{de\u011Fer:"value"},uk:{\u0432\u0438\u043C\u043A\u043D\u0435\u043D\u043E:"disabled",\u0437\u043D\u0430\u0447\u0435\u043D\u043D\u044F:"value",\u043F\u043E\u0437\u043D\u0430\u0447\u0435\u043D\u043E:"checked",\u043F\u0440\u0438\u0445\u043E\u0432\u0430\u043D\u043E:"hidden"},vi:{\u1EA9n:"hidden","\u0111\u01B0\u1EE3c ch\u1ECDn":"checked","gi\xE1 tr\u1ECB":"value","v\xF4 hi\u1EC7u":"disabled"},zh:{\u503C:"value"}},zo={ar:{\u0643\u0640:"as"},bn:{\u09B9\u09BF\u09B8\u09BE\u09AC\u09C7:"as"},de:{als:"as"},es:{como:"as"},fr:{comme:"as"},hi:{\u0915\u0947_\u0930\u0942\u092A_\u092E\u0947\u0902:"as"},id:{sebagai:"as"},it:{come:"as"},ja:{\u3068\u3057\u3066:"as"},ko:{\uB85C:"as"},ms:{sebagai:"as"},pl:{jako:"as"},pt:{como:"as"},qu:{hina:"as"},ru:{\u043A\u0430\u043A:"as"},sw:{kuwa:"as"},tl:{bilang:"as"},tr:{olarak:"as"},uk:{\u044F\u043A:"as"},vi:{nh\u01B0:"as"},zh:{\u4F5C\u4E3A:"as"}},Co={ms:new Set(["daripada"]),sw:new Set(["ya"]),vi:new Set(["c\u1EE7a"]),zh:new Set(["\u7684"]),it:new Set(["di"]),pl:new Set(["z"]),uk:new Set(["\u0437"]),th:new Set(["\u0E02\u0E2D\u0E07"]),ar:new Set(["\u0644\u0640"]),ja:new Set(["\u306E"]),ko:new Set(["\uC758"]),bn:new Set(["\u09B0"]),hi:new Set(["\u0915\u093E"]),qu:new Set(["pa"]),tr:new Set(["nin"])};function Wr(i,e){let t=e.value.toLowerCase(),r=(e.normalized??"").toLowerCase();if(t==="of"||t==="ng"||r==="of"||r==="source")return true;let n=i?.code?Co[i.code]:void 0;return !!n&&n.has(t)}var Ao={destination:"in",source:"from"},xo={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"])},Do=new Set(["in","into","at","within","inside"]);function So(i,e){let t=e.value.toLowerCase();if((i?.code?xo[i.code]:void 0)?.has(t))return "in";let n=e.normalized??e.value,a=n.toLowerCase();return Do.has(a)?"in":Ao[a]??n}var zt=new Set(["first","last","next","previous","random","closest"]),To={bn:{\u09B6\u09C7\u09B7:"last"}},Hr=new Set(Object.keys(ke).map(i=>i.toLowerCase()));function Kr(i,e,t){let r=i[e];if(!r)return null;let n=(r.normalized??r.value).toLowerCase(),a=i[e+1],o=t?.code&&a?.kind==="selector"&&a.value.startsWith("<")?To[t.code]?.[r.value.toLowerCase()]:void 0;if(!zt.has(n)&&!zt.has(r.value.toLowerCase())&&o===void 0)return null;let u=[{text:o??r.normalized??r.value,token:r}],s=e+1,l=i[s];if(!l||l.kind!=="selector")return null;u.push({text:l.value,token:l}),s++;let c=0;for(;c++<8;){let m=i[s];if(m&&m.kind==="selector"&&m.value.startsWith("."))u.push({text:m.value,token:m}),s++;else break}let p=i[s],d=i[s+1];return p&&d&&d.kind==="selector"&&(p.kind==="keyword"||p.kind==="particle"||p.kind==="identifier")&&!zt.has((p.normalized??p.value).toLowerCase())&&!Hr.has((p.normalized??p.value).toLowerCase())&&(u.push({text:So(t,p),token:p}),u.push({text:d.value,token:d}),s+=2),{parts:u,consumed:s-e}}function Bo(i,e){let t=zo[i];return t?t[e.toLowerCase()]??e:e}function Ie(i,e){let t=wo[i];return t?t[e.toLowerCase()]??e:e}function Fo(i,e){let t=[e.value,e.normalized].filter(Boolean);for(let r of t){let n=ce(i,r)??ce(i,r.toLowerCase());if(n)return n}}function Ur(i){return i.kind==="literal"||i.kind==="operator"||i.kind==="punctuation"?false:!/^[$:@#.*^(){}[\]]/.test(i.value)}function Po(i,e){let t=i?.references;if(!t)return false;let r=Object.values(t).filter(a=>typeof a=="string").map(a=>a.toLowerCase());return [e.value,e.normalized].filter(Boolean).some(a=>r.includes(a.toLowerCase()))}function Ro(i,e){return Ur(i)?Ie(e,i.value)!==i.value?true:i.kind==="identifier":false}var Oo={ar:{\u0647\u0648:{beforePredicate:"is"}},hi:{\u0939\u0948:{beforePredicate:"is"},\u0928\u0939\u0940\u0902:{beforeBareIdentifier:"no"}},th:{\u0E40\u0E1B\u0E47\u0E19:{beforeTypeName:"as",beforePredicate:"is"}},ja:{\u7A7A:{afterCopula:"empty"}},zh:{\u6CA1\u6709:{beforeBareIdentifier:"no"}},tl:{walang:{beforeBareIdentifier:"no"},may:{afterSubject:"exists"}},bn:{\u0986\u099B\u09C7:{afterSubject:"exists"}},tr:{var:{afterSubject:"exists"}}},_o=new Set(["empty","null","undefined","true","false"]),No=new Set(["Number","Int","Float","String","Date","Array","Object","JSON","json","FormData","HTML","Fragment","Values"]);function Io(i,e,t,r){let n=Oo[i],a=n?.[e.value]??n?.[e.value.toLowerCase()];if(a){if(a.beforeTypeName&&r?.kind==="identifier"&&No.has(r.value))return a.beforeTypeName;if(a.beforePredicate&&r&&(r.kind==="literal"||r.kind==="keyword"&&_o.has((r.normalized??"").toLowerCase())))return a.beforePredicate;if(a.beforeBareIdentifier&&r?.kind==="identifier"&&/^[A-Za-z_]\w*$/.test(r.value))return a.beforeBareIdentifier;if(a.afterSubject&&(t?.kind==="selector"||t?.kind==="reference"))return a.afterSubject;if(a.afterCopula&&t?.kind==="keyword"&&(t.normalized??"").toLowerCase()==="is")return a.afterCopula}}function Bt(i,e){let t=e?.code??"en",r="",n,a=(u,s)=>{if(n===void 0){r=u,n=s;return}let c=n.position?.end!==void 0&&s.position?.start!==void 0&&n.position.end===s.position.start&&(u.startsWith(".")||u.startsWith("!"));r+=(c?"":" ")+u,n=s;},o=u=>u.kind==="keyword"?u.normalized??u.value:u.value;for(let u=0;u<i.length;u++){let s=i[u],l=e?Fo(e,s):void 0,c=i[u+1];if(l!==void 0&&c){let E=e?.possessive?.connectors,v=!!E?.length&&E.some(b=>{let x=b.toLowerCase();return x===c.value.toLowerCase()||x===(c.normalized??"").toLowerCase()}),f=v?u+2:u+1,h=i[f];if(h&&Ro(h,t)){a(wt(l),s),a(Ie(t,h.value),h),u=f;continue}if(v&&h&&/^\.[a-zA-Z_]\w*$/.test(h.value)&&c.position?.end!==void 0&&h.position?.start!==void 0&&c.position.end===h.position.start){a(wt(l),s),a(Ie(t,h.value.slice(1)),h),u=f;continue}if(!v&&/^\.[a-zA-Z_]\w*$/.test(c.value)&&s.position?.end!==void 0&&c.position?.start!==void 0&&s.position.end===c.position.start&&!Po(e,s)){a(wt(l),s),a(Ie(t,c.value.slice(1)),c),u+=1;continue}}let p=i[u+2];if(c&&p&&p.kind==="selector"&&Wr(e,c)&&Ur(s)){a(Ie(t,s.value),s),a("of",c),a(p.value,p),u+=2;continue}let d=Kr(i,u,e);if(d){for(let E of d.parts)a(E.text,E.token);u+=d.consumed-1;continue}let m=Io(t,s,i[u-1],c);if(m!==void 0){a(m,s);continue}let y=Bo(t,s.value);if(y!==s.value){a(y,s);continue}a(o(s),s);}return r.trim()}var Gr=[{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 dr(i,e,t,r){let n=Gr.find(o=>o.lang===i);if(!n)return false;let a=(o,u)=>(o??"").toLowerCase()===u.toLowerCase();return a(e,n.end)&&a(t,n.at)&&a(r,n.of)}function Lo(i,e){let t=Gr.find(n=>n.lang===i);if(!t)return false;let r=e.toLowerCase();return r===t.at.toLowerCase()||r===t.of.toLowerCase()||r===t.end.toLowerCase()}var Yr={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 Mo(i){return Yr[i]}function $o(i,e){return Yr[e]?.has(i.toLowerCase())??false}var Zr=96,qo=/^[A-Za-z_][\w-]*$/,jo=/^[A-Za-z_][\w-]*:[^\s'"`/:][^\s]*$/;function Xr(i,e){let t=i.peek(e);return !!t&&t.kind==="identifier"&&jo.test(t.value)}function Qr(i,e){let t=i.peek(e);if(!t||t.kind!=="identifier"&&t.kind!=="keyword"||!qo.test(t.value))return false;let r=i.peek(e+1),n=i.peek(e+2);return !!r&&r.value===":"&&!!n}function mr(i,e=0){return Xr(i,e)||Qr(i,e)}function Vo(i){let e=i.peek();if(!e||e.value!=="{"&&e.value!=="(")return null;let t="",r=-1,n=0,a=0;for(;!i.isAtEnd()&&a++<Zr;){let o=i.advance();if(!o)break;if(r>=0&&o.position.start>r&&(t+=" ".repeat(o.position.start-r)),t+=o.value,r=o.position.end,o.value==="{"||o.value==="(")n++;else if((o.value==="}"||o.value===")")&&(n--,n===0))return t}return null}function yr(i){let e=i.peek();return e?e.value==="{"||e.value==="("?Vo(i):e.value===","||e.value===":"?null:(i.advance(),e.value):null}function Ue(i,e){let t=i.mark(),r=[];if(e!==void 0){let a=i.peek();if(!a||a.value!==":"||!i.peek(1))return null;i.advance();let o=yr(i);if(o===null)return i.reset(t),null;r.push(`${e}:${o}`);}else if(!mr(i))return null;let n=0;for(;n++<Zr;){let a=i.peek();if(!a)break;if(a.value===","){if(r.length===0||!mr(i,1))break;i.advance();continue}if(Xr(i,0)){r.push(i.advance().value);continue}if(!Qr(i,0))break;let o=i.advance().value;i.advance();let u=yr(i);if(u===null)return i.reset(t),null;r.push(`${o}:${u}`);}return r.length===0?(i.reset(t),null):`{${r.join(", ")}}`}var st=.8,Wo=.6,Ho=.15,Ko=.5,fr=.15,vr=.1,hr=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"]),Uo={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"]},Go=class{calculate(i){return this.calculateWithBreakdown(i).final}calculateWithBreakdown(i){let e=this.scoreRoleCoverage(i),t=this.scoreStemPenalty(i),r=this.scoreLanguageBoost(i),n=this.scoreLanguageAdjustment(i),a=e;return a=Math.max(Ko,a+t),a=Math.min(1,a+r),a=Math.max(0,Math.min(1,a+n)),{roleCoverage:e,stemPenalty:t,languageBoost:r,languageAdjustment:n,final:a}}scoreRoleCoverage(i){let{pattern:e,captured:t}=i,r=0,n=0,a=l=>e.extraction?.[l]?.default!==void 0,o=e.command==="on"?e.extraction?.action?.value:void 0,u=ke[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,r+=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+=st,r+=st):s(c.role)||(n+=st,a(c.role)&&(r+=st*Wo)));return n>0?r/n:1}scoreStemPenalty(i){let{stemMatchCount:e,totalKeywordMatches:t}=i;return e<=0||t<=0?0:-(e/t)*Ho}scoreLanguageBoost(i){let{pattern:e}=i;if(e.language!=="ar")return 0;let t=e.template.tokens[0];return !t||t.type!=="literal"?0:hr.has(t.value)||t.alternatives?.some(r=>hr.has(r))?fr:0}scoreLanguageAdjustment(i){let{pattern:e,captured:t}=i;if(e.language!=="ar")return 0;let r=0;for(let[n,a]of t.entries()){let o=Uo[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)?r+=.1:r-=.1);}return Math.max(-vr,Math.min(vr,r))}},Yo=new Go,Zo=new Set(Object.values(ke).filter(i=>i.bareKeyword===true).map(i=>i.action)),Q=class N{constructor(e){this.matchCache=new Map,this.stemMatchCount=0,this.totalKeywordMatches=0,this.confidenceModel=e??Yo;}matchPattern(e,t){let r=e.mark(),n=new Map;if(this.currentProfile=I(t.language),this.currentPatternCommand=t.command,this.stemMatchCount=0,this.totalKeywordMatches=0,!this.matchTokenSequence(e,t.template.tokens,n))return e.reset(r),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()-r.position,confidence:o}}matchBest(e,t){this.matchCache.clear();let r=[],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&&r.push(l),e.reset(u);}if(r.length===0)return null;r.sort((o,u)=>{let s=u.pattern.priority-o.pattern.priority;return s!==0?s:u.confidence-o.confidence});let a=r[0];return this.matchPattern(e,a.pattern),a}matchTokenSequence(e,t,r,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];u>0&&l.type==="literal"&&this.tryConsumeEventSourceClause(e,r,l);let c=this.matchPatternToken(e,l,r,t[s+1]??n);if(u=l.type==="role"&&l.role==="event"?2:Math.max(0,u-1),!c){if(this.isOptional(l))continue;return false}}return true}tryConsumeEventSourceClause(e,t,r){if(t.has("source"))return;let n=e.peek(),a=e.peek(1);if(!n||!a||this.patternTokenWouldMatch(r,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)&&a.kind==="selector"){e.advance();let l=this.tokenToSemanticValue(e.advance());l&&t.set("source",l);return}if(s==="after"&&n.kind==="selector"&&u(a)){let l=this.tokenToSemanticValue(n);e.advance(),e.advance(),l&&t.set("source",l);}}matchPatternToken(e,t,r,n){switch(t.type){case "literal":return this.matchLiteralToken(e,t);case "role":return this.matchRoleToken(e,t,r,n);case "group":return this.matchGroupToken(e,t,r,n);default:return false}}matchLiteralToken(e,t){let r=e.peek();if(!r)return false;let n=this.getMatchType(r,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(r,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 r=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(r),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 q(o);return e.reset(r),null}tryMatchShatteredCompound(e,t,r){let n=t.split(r);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!==r)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,r,n){this.skipNoiseWords(e);let a=e.peek();if(!a)return t.optional||false;if(t.role==="action"&&this.currentProfile&&e.peek(1)?.value==="-"){let f=this.tryFoldHyphenActionKeyword(e);if(f)return r.set(t.role,f),true}if(t.role==="event"&&this.currentPatternCommand==="on"){if(!N.tokenLooksLikeEvent(a))return t.optional||false;let f=(a.normalized??a.value).toLowerCase();if(N.POSITIONAL_OR_SCOPE_KEYWORDS.has(f)||this.currentProfile&&(ce(this.currentProfile,a.value)??ce(this.currentProfile,f))!==void 0||a.value.includes("?."))return t.optional||false}if(t.role==="event"){let f=(a.normalized??a.value).toLowerCase();if(N.STRUCTURAL_NEVER_EVENT.has(f))return t.optional||false}if(a.kind==="keyword"){let f=(a.normalized??a.value).toLowerCase();if(f==="then"||f==="end"&&e.peek(1)?.kind!=="selector"||$o(a.value,this.currentProfile?.code??""))return t.optional||false}if(t.role==="duration"){let f=(a.normalized??a.value).toLowerCase();if(N.POSITIONAL_OR_SCOPE_KEYWORDS.has(f))return t.optional||false}if(t.optional&&n===void 0&&t.role!=="event"&&t.role!=="action"&&t.valueShape!=="keyword"&&a.kind==="keyword"&&(a.normalized??a.value).toLowerCase()in ke)return true;let o=this.tryMatchPositionalExpression(e);if(o)return t.expectedTypes&&t.expectedTypes.length>0&&!ut(o.type,t.expectedTypes)?t.optional||false:(r.set(t.role,o),true);let u=this.tryMatchCaretScopeExpression(e);if(u)return t.expectedTypes&&t.expectedTypes.length>0&&!ut(u.type,t.expectedTypes)?t.optional||false:(r.set(t.role,u),true);if(t.role!=="event"&&(!t.expectedTypes||t.expectedTypes.includes("expression"))){let f=this.tryMatchBeepPrefixExpression(e);if(f)return r.set(t.role,f),true;let h=this.tryMatchHyphenatedWord(e);if(h)return r.set(t.role,h),true;let b=this.tryMatchOperatorRunExpression(e);if(b)return r.set(t.role,b),true}if(this.currentPatternCommand==="pick"&&t.role==="patient"&&(!t.expectedTypes||t.expectedTypes.includes("expression"))){let f=this.tryMatchPickRangeExpression(e);if(f)return r.set(t.role,f),true}if(t.expectedTypes?.includes("property-path")){let f=this.tryMatchOfPossessiveExpression(e);if(f)return r.set(t.role,f),true;let h=this.tryMatchPostNominalPossessiveExpression(e);if(h)return r.set(t.role,h),true}let s=this.tryMatchPossessiveExpression(e);if(s)return t.expectedTypes&&t.expectedTypes.length>0&&!t.expectedTypes.includes(s.type)&&!t.expectedTypes.includes("expression")?t.optional||false:(r.set(t.role,s),true);let l=this.tryMatchMethodCallExpression(e);if(l)return t.expectedTypes&&t.expectedTypes.length>0&&!t.expectedTypes.includes(l.type)&&!t.expectedTypes.includes("expression")?t.optional||false:(r.set(t.role,l),true);let p=t.role==="event"&&this.currentPatternCommand==="on"||N.DECLARATION_COMMANDS.has(this.currentPatternCommand??"")?null:this.tryMatchBareCallExpression(e);if(p)return t.expectedTypes&&t.expectedTypes.length>0&&!t.expectedTypes.includes(p.type)&&!t.expectedTypes.includes("expression")?t.optional||false:(r.set(t.role,p),true);let d=this.tryMatchPossessiveSelectorExpression(e);if(d)return t.expectedTypes&&t.expectedTypes.length>0&&!ut(d.type,t.expectedTypes)?t.optional||false:(r.set(t.role,d),true);let m=t.role!=="condition",y=this.tryMatchPropertyAccessExpression(e,m);if(y)return t.expectedTypes&&t.expectedTypes.length>0&&!t.expectedTypes.includes(y.type)&&!t.expectedTypes.includes("expression")?t.optional||false:(r.set(t.role,y),true);let E=this.tryMatchSelectorPropertyExpression(e);if(E)return t.expectedTypes&&t.expectedTypes.length>0&&!ut(E.type,t.expectedTypes)?t.optional||false:(r.set(t.role,E),true);if(a.kind==="identifier"&&a.value==="{"){let f=t.expectedTypes,b=f?.length===1&&f[0]==="expression"?this.tryMatchBraceRunExpression(e):!f?.length||f.includes("literal")?this.tryMatchBraceRunLiteral(e):null;if(b)return r.set(t.role,b),true}if(t.role==="style"&&t.expectedTypes?.length===1&&t.expectedTypes[0]==="expression"){let f=Ue(e);if(f)return r.set(t.role,{type:"expression",raw:f}),true}let v=this.tokenToSemanticValue(a);if(!v)return t.optional||false;if(t.expectedTypes&&t.expectedTypes.length>0&&!t.expectedTypes.includes(v.type)){let f=v.type==="selector"&&String(v.value).startsWith("@"),h=t.expectedTypes.some(b=>b==="expression"||b==="reference");if(!(f&&h))return t.optional||false}if(t.valueShape==="keyword"&&v.type==="expression"?r.set(t.role,q(String(v.raw??""))):r.set(t.role,v),e.advance(),t.role==="event"){let f=e.peek();f&&f.kind==="selector"&&f.value.startsWith("[")&&"value"in v&&(r.set(t.role,q(`${String(v.value)}${f.value}`)),e.advance());let h=e.peek();if(h&&(h.kind==="particle"||h.kind==="keyword")&&(h.normalized??"").toLowerCase()==="source"&&!this.patternTokenWouldMatch(n,h)){let b=e.peek(1);if(b&&(b.kind==="selector"||b.kind==="identifier")){e.advance();let x=this.tokenToSemanticValue(e.advance());x&&!r.has("source")&&r.set("source",x);}}}return true}patternTokenWouldMatch(e,t){return e?e.type==="literal"?this.getMatchType(t,e.value)!=="none"?true:!!e.alternatives?.some(r=>this.getMatchType(t,r)!=="none"):e.type==="group"?this.patternTokenWouldMatch(e.tokens?.[0],t):false:false}tryMatchPositionalExpression(e){let t=Kr(e.tokens,e.position(),this.currentProfile);if(!t)return null;for(let r=0;r<t.consumed;r++)e.advance();return {type:"expression",raw:t.parts.map(r=>r.text).join(" ")}}tryMatchCaretScopeExpression(e){let t=e.peek();if(!t||t.kind!=="identifier"||!t.value.startsWith("^"))return null;let r=e.peek(1),n=e.peek(2),a=(r?.normalized??"").toLowerCase(),o=!!r&&(r.value.toLowerCase()==="on"||a==="destination"||a==="on");return !r||!n||n.kind!=="selector"||!o?null:(e.advance(),e.advance(),e.advance(),{type:"expression",raw:`${t.value} on ${n.value}`})}isOfPossessiveMarker(e){return Wr(this.currentProfile,e)}static isBareWordToken(e){return !!e&&/^[A-Za-z_][A-Za-z0-9_]*$/.test(e.value)}static tokensAdjacent(e,t){return e?.position?.end!==void 0&&t?.position?.start!==void 0&&e.position.end===t.position.start}tryMatchBeepPrefixExpression(e){let t=e.peek(),r=e.peek(1);if(!t||!r||r.value!=="!"||(t.normalized??t.value).toLowerCase()!=="beep"||!(t.position?.end!==void 0&&r.position?.start!==void 0&&t.position.end===r.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||!N.RUN_OPERATORS.has(s.value))break;let l=e.mark();if(e.advance(),!this.tryConsumeRunOperand(e)){e.reset(l);break}}let u=Bt(e.tokens.slice(o,e.position()),this.currentProfile);return {type:"expression",raw:u,value:u}}tryMatchHyphenatedWord(e){let t=e.peek();if(!N.isBareWordToken(t))return null;let r=1,n=[t.value];for(;;){let a=e.peek(r),o=e.peek(r+1);if(!a||a.value!=="-"||!N.isBareWordToken(o)||!N.tokensAdjacent(e.peek(r-1),a)||!N.tokensAdjacent(a,o))break;n.push(o.value),r+=2;}if(n.length<2)return null;for(let a=0;a<r;a++)e.advance();return q(n.join("-"),"string")}tryMatchOperatorRunExpression(e){let t=e.mark(),r=e.position();if(!this.tryConsumeRunOperand(e))return e.reset(t),null;let n=1;for(;;){let o=e.peek();if(!o||!N.RUN_OPERATORS.has(o.value))break;let u=e.mark();if(e.advance(),!this.tryConsumeRunOperand(e)){e.reset(u);break}n++;}if(n<2)return e.reset(t),null;let a=Bt(e.tokens.slice(r,e.position()),this.currentProfile);return {type:"expression",raw:a,value:a}}isPickRangeSeparator(e){let t=(e.normalized??e.value).toLowerCase();if(N.PICK_RANGE_SEPARATORS.has(t))return true;let r=this.currentProfile?.code;return r?N.PICK_RANGE_SEPARATORS_BY_LANG[r]?.has(e.value.toLowerCase())??false:false}tryMatchPickRangeExpression(e){let t=e.mark(),r=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&&N.PICK_RANGE_MODES.has((a.normalized??a.value).toLowerCase())&&e.advance();let o=e.tokens.slice(r,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 r=(t.normalized??t.value).toLowerCase();if(this.isPickRangeSeparator(t))return false;let n=r==="start"||r==="end";return t.kind==="literal"||t.kind==="identifier"||t.kind==="keyword"&&n?(e.advance(),true):false}tryConsumeRunOperand(e){let t=e.peek();if(!t)return false;if(t.value==="("){let r=e.mark(),n=0;for(;!e.isAtEnd();){let a=e.advance();if(a.value==="(")n++;else if(a.value===")"&&(n--,n===0))return true}return e.reset(r),false}return this.tryMatchPossessiveExpression(e)?true:(t.kind==="literal"||t.kind==="identifier"||t.kind==="selector"||t.kind==="keyword")&&!N.RUN_OPERATORS.has(t.value)&&t.value!==")"?(e.advance(),true):false}isPossessorToken(e){if(!this.currentProfile)return false;for(let t of [e.value,e.normalized].filter(Boolean))if(ce(this.currentProfile,t)??ce(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?Ie(this.currentProfile.code,e):e}tryMatchOfPossessiveExpression(e){let t=e.peek();if(!t||t.kind!=="selector"&&!this.isBareWordPropertyHead(t))return null;let r=e.mark();e.advance();let n=e.peek();if(!n||!this.isOfPossessiveMarker(n))return e.reset(r),null;e.advance();let a=e.peek();return !a||a.kind!=="selector"?(e.reset(r),null):(e.advance(),we(Ce(a.value),this.toEnglishProperty(t.value)))}tryMatchPossessiveExpression(e){let t=e.peek();if(!t||!this.currentProfile)return null;let r=[t.value,t.normalized].filter(Boolean),n;for(let s of r)if(n=ce(this.currentProfile,s)??ce(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||Lo(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&&N.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++<N.MAX_METHOD_ARGS+2;){let y=e.peek();if(!y)break;p+=y.value,e.advance();for(let E of y.value)E==="("?d++:E===")"&&d--;if(d<=0)break}l+=p;}return we(ue(n),l)}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 r=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("@"))||r)||this.isPossessorToken(t))return null;let a=e.mark(),o=t.value;r&&(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 c of [s.value,s.normalized].filter(Boolean))if(l=ce(this.currentProfile,c)??ce(this.currentProfile,c.toLowerCase()),l)break;return l?(e.advance(),we(ue(l),u)):(e.reset(a),null)}isStructuralKeyword(e){return new Set(["into","in","to","from","at","by","with","without","before","after","of","as","on","then","end","else","if","repeat","while","for","toggle","add","remove","put","set","show","hide","increment","decrement","send","trigger","call"]).has(e.toLowerCase())}isRoleMarkerConcept(e){return Vr.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 r=e.normalized?.toLowerCase();return !(r&&Zo.has(r))}tryMatchBraceRunLiteral(e){let t=e.peek();if(!t||t.kind!=="identifier"||t.value!=="{")return null;let r=e.mark();e.advance();let n=["{"],a=1,o=0;for(;!e.isAtEnd()&&o++<N.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("}"),q(n.join(" "));n.push(u.value);}return e.reset(r),null}tryMatchBraceRunExpression(e){let t=e.peek();if(!t||t.kind!=="identifier"||t.value!=="{")return null;let r=e.mark(),n="",a=-1,o=0,u=0;for(;!e.isAtEnd()&&u++<N.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(r),null}tryMatchBareCallExpression(e){let t=e.peek();if(!t||t.kind!=="identifier"||!/^[A-Za-z_][\w$]*$/.test(t.value))return null;let r=e.peek(1);if(!r||r.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++<N.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 r=e.mark();e.advance();let n=e.peek();if(!n||n.kind!=="operator"||n.value!==".")return e.reset(r),null;e.advance();let a=e.peek();if(!a||a.kind!=="identifier")return e.reset(r),null;e.advance();let o=e.peek();if(!o||o.kind!=="punctuation"||o.value!=="(")return e.reset(r),null;e.advance();let u=[];for(;!e.isAtEnd()&&u.length<N.MAX_METHOD_ARGS;){let l=e.peek();if(!l)break;if(l.kind==="punctuation"&&l.value===")"){e.advance();break}if(l.kind==="punctuation"&&l.value===","){e.advance();continue}u.push(l.value),e.advance();}return {type:"expression",raw:`${t.value}.${a.value}(${u.join(", ")})`}}tryMatchPropertyAccessExpression(e,t=true){let r=e.peek();if(!r||r.kind!=="identifier"&&r.kind!=="keyword")return null;let n=e.mark();e.advance();let a=r.value.toLowerCase(),o=e.peek();if((r.kind==="identifier"||N.PROPERTY_ACCESS_BASES.has(a))&&o&&o.kind==="selector"&&/^\.[a-zA-Z_]/.test(o.value)){let m=r.value,y=[],E=0;for(;E<N.MAX_PROPERTY_DEPTH;){let h=e.peek();if(h&&h.kind==="selector"&&/^\.[a-zA-Z_]/.test(h.value))m+=`.${h.value.slice(1)}`,y.push(h.value.slice(1)),e.advance(),E++;else break}let v=e.peek(),f=!!v&&v.value.startsWith("(");if(t&&!f&&y.length>0&&Oe(a))return we(ue(a),y.join("."));if(f){let h=e.mark(),b=[],x=0,A=false;for(;!e.isAtEnd();){let k=e.peek();if(!k)break;if(k.value==="(")x++;else if(k.value===")"){if(b.push(k.value),e.advance(),x--,x===0&&(A=true),A)break;continue}b.push(k.value),e.advance();}A?m+=b.join(""):e.reset(h);}return {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=`${r.value}.${s.value}`,c=1;for(;!e.isAtEnd()&&c<N.MAX_PROPERTY_DEPTH;){let m=e.peek();if(!m||m.kind!=="operator"||m.value!==".")break;e.advance();let y=e.peek();if(!y||y.kind!=="identifier")break;e.advance(),l+=`.${y.value}`,c++;}let p=e.peek();if(p&&p.kind==="punctuation"&&p.value==="("){e.advance();let m=[],y=0;for(;!e.isAtEnd()&&m.length<N.MAX_METHOD_ARGS;){let v=e.peek();if(!v)break;if(v.kind==="punctuation"&&v.value===")"){if(y===0){e.advance();break}y--;}if(v.kind==="punctuation"&&v.value==="("&&y++,v.kind==="punctuation"&&v.value===","){e.advance();continue}m.push(v.value),e.advance();}return {type:"expression",raw:`${l}(${m.join(", ")})`}}let d=r.value.toLowerCase();if(t&&Oe(d)){let m=l.split(".").slice(1).join(".");return we(ue(d),m)}return {type:"expression",raw:l}}tryMatchPossessiveSelectorExpression(e){let t=e.peek();if(!t||t.kind!=="selector")return null;let r=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 d=ke[this.currentPatternCommand];return !!d&&d.roles.some(m=>m.role==="source")})(),l=!!n&&!!a&&a!=="'s"&&n.value===a&&(n.kind==="particle"||n.kind==="punctuation")&&!s;if(!o&&!l&&!u)return e.reset(r),null;e.advance(),u&&e.advance();let c=e.peek();return !c||!(c.kind==="identifier"||(o||u)&&(c.kind==="selector"||c.kind==="keyword"))?(e.reset(r),null):(e.advance(),we(Ce(t.value),this.toEnglishProperty(c.value)))}tryMatchSelectorPropertyExpression(e){let t=e.peek();if(!t||t.kind!=="selector"||!t.value.startsWith("#"))return null;let r=e.mark();e.advance();let n=e.peek();if(!n||n.kind!=="selector"||!n.value.startsWith("."))return e.reset(r),null;let a=e.peek(1);a&&a.kind,e.advance();let o=n.value.slice(1);return we(Ce(t.value),o)}matchGroupToken(e,t,r,n){let a=e.mark(),o=new Map(r);if(!this.matchTokenSequence(e,t.tokens,r,n)){e.reset(a);for(let s of r.keys())o.has(s)||r.delete(s);for(let[s,l]of o)r.get(s)!==l&&r.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 r=nt(e.value).toLowerCase();if(r&&r===nt(t).toLowerCase())return "case-insensitive"}return "none"}tokenToSemanticValue(e){switch(e.kind){case "selector":return Ce(e.value);case "literal":return this.parseLiteralValue(e.value);case "keyword":let t=(e.normalized||e.value).toLowerCase();return Oe(t)?ue(t):q(e.normalized||e.value);case "identifier":if(e.value.startsWith("@"))return Ce(e.value);if(e.value.startsWith(":")||e.value.startsWith("$"))return ue(e.value);let r=e.value.toLowerCase();return Oe(r)?ue(r):{type:"expression",raw:e.value};case "url":return q(e.value,"string");default:return null}}parseLiteralValue(e){if(e.startsWith('"')||e.startsWith("'")||e.startsWith("`")||e.startsWith("\u300C")){let n=e.slice(1,-1);return q(n,"string")}if(e==="true")return q(true,"boolean");if(e==="false")return q(false,"boolean");let t=e.match(/^(\d+(?:\.\d+)?)(ms|s|m|h)?$/);if(t){let n=parseFloat(t[1]);return t[2]?q(e,"duration"):q(n,"number")}let r=parseFloat(e);return isNaN(r)?q(e,"string"):q(r,"number")}applyExtractionRules(e,t){for(let[r,n]of Object.entries(e.extraction)){let a=t.get(r);if(a){if(n.transform){let o=a.type==="literal"?String(a.value):String(a.raw??"");t.set(r,n.transform(o));}}else n.value!==void 0?t.set(r,{type:"literal",value:n.value}):n.default&&t.set(r,{...n.default,implicit:true});}}isOptional(e){return e.type!=="literal"&&e.optional===true}skipNoiseWords(e){let t=e.peek();if(!t)return;let r=t.value.toLowerCase();if(N.ENGLISH_NOISE_WORDS.has(r)){let n=e.mark();e.advance();let a=e.peek();if(a&&(a.kind==="selector"||a.kind==="identifier"))return;let o=e.peek(1);if(a&&a.kind==="keyword"&&o&&o.kind==="selector"&&/^\.[a-zA-Z_]/.test(o.value))return;let u=a?(a.normalized??a.value).toLowerCase():"";if(a&&N.POSITIONAL_OR_SCOPE_KEYWORDS.has(u))return;let s=e.peek(1),l=s?(s.normalized??s.value).toLowerCase():"",c=this.currentProfile?.wordOrder!=="SOV"&&N.COMMAND_ACTION_KEYWORDS.has(l),p=!s||s.kind==="particle"||N.CLAUSE_BOUNDARY_KEYWORDS.has(l)||c;if(a&&a.kind==="keyword"&&this.currentProfile?.code!=="en"&&Oe(u)&&p||a&&a.kind==="keyword"&&this.currentProfile?.code==="en"&&Oe(u))return;e.reset(n);}r==="class"&&e.advance();}extractEventModifiers(e){let t={},r=false;for(;!e.isAtEnd();){let n=e.peek();if(!n||n.kind!=="event-modifier")break;let a=n.metadata;if(!a)break;switch(r=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 r?t:void 0}};Q.POSITIONAL_OR_SCOPE_KEYWORDS=new Set(["first","last","next","previous","random","closest","parent"]);Q.STRUCTURAL_NEVER_EVENT=new Set(["if","unless","else","end","then"]);Q.PROPERTY_ACCESS_BASES=new Set(["it","me","you","my","its","your","event","result","target","detail","body","window","document","self","this"]);Q.COMMAND_ACTION_KEYWORDS=Hr;Q.CLAUSE_BOUNDARY_KEYWORDS=new Set(["then","and","or","end","else"]);Q.RUN_OPERATORS=new Set(["+","-","*","/"]);Q.PICK_RANGE_SEPARATORS=new Set(["to"]);Q.PICK_RANGE_SEPARATORS_BY_LANG={ar:new Set(["\u0625\u0644\u0649"]),bn:new Set(["\u09A5\u09C7\u0995\u09C7"]),de:new Set(["zu","bis"]),es:new Set(["a"]),fr:new Set(["\xE0"]),he:new Set(["\u05E2\u05DC","\u05E2\u05D3"]),hi:new Set(["\u0938\u0947"]),id:new Set(["ke"]),it:new Set(["in","a"]),ja:new Set(["\u304B\u3089"]),ko:new Set(["\uBD80\uD130"]),ms:new Set(["ke"]),pl:new Set(["do"]),pt:new Set(["para","a"]),qu:new Set(["kama"]),ru:new Set(["\u0432","\u0434\u043E"]),sw:new Set(["kwa","hadi"]),th:new Set(["\u0E43\u0E19","\u0E16\u0E36\u0E07"]),tl:new Set(["sa"]),tr:new Set(["ile"]),uk:new Set(["\u0432","\u0434\u043E"]),vi:new Set(["v\xE0o","\u0111\u1EBFn"]),zh:new Set(["\u5230"])};Q.PICK_RANGE_MODES=new Set(["inclusive","exclusive"]);Q.MAX_BRACE_RUN_TOKENS=64;Q.MAX_PROPERTY_DEPTH=10;Q.MAX_METHOD_ARGS=20;Q.DECLARATION_COMMANDS=new Set(["behavior","def","install"]);Q.ENGLISH_NOISE_WORDS=new Set(["the","a","an"]);var Xo=Q,oe=new Xo;function U(i,e){return Hn(i,e)}function Jr(){return Wn()}var Xe=["if","unless","repeat","for","while"],pt=/^[A-Z][A-Za-z0-9_]*$/;function Z(i,e){let t=new Set([e]),n=I(i)?.keywords?.[e];if(n){n.primary&&t.add(n.primary.toLowerCase());for(let a of n.alternatives??[])t.add(a.toLowerCase());}return t}function V(i,e){return e.has(i.value.toLowerCase())?true:i.normalized?e.has(i.normalized.toLowerCase()):false}var Qo=new Set(Xe);function dt(i,e){let t=i.normalized?.toLowerCase();return t?Qo.has(t):e.some(r=>V(i,r))}var Er=new Set(["me","it","you","the","body","window","document","its","event","result","target","self","this","them","parent","next","previous","closest","first","last"]),Jo=new Set(["destination","source","style","patient","on","from","to"]);function ei(i){if(!i||i.kind==="selector")return false;let e=(i.normalized??i.value).toLowerCase(),t=i.value.toLowerCase();return !(Er.has(e)||Er.has(t)||Jo.has(e))}var gr=new Set(["ja","ko"]);function Ge(i){let e=new Set;i?.primary&&e.add(i.primary.toLowerCase());for(let t of i?.alternatives??[])e.add(t.toLowerCase());return e}function ti(i,e){let t=[],r=e.position.end,n=i.slice(e.position.end).match(/^\s*\(([^)]*)\)/);if(n){r=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:r}}function mt(i,e,t){let r=e+1;if(r>=i.length)return -1;let n=Ge(I(t)?.roleMarkers?.patient);return n.size>0&&V(i[r],n)&&r++,r<i.length?r:-1}var ri=/^[a-zA-Z_$][\w$]*(?:\.[a-zA-Z_$][\w$]*)*$/;function eu(i){let e=1;if(i[1]?.value==="("){let t=0,r=1;for(;r<i.length;r++)if(i[r].value==="(")t++;else if(i[r].value===")"&&--t===0)break;if(r>=i.length)return -1;e=r+1;}return e+1}function tu(i,e,t){let r=I(t);if(r?.wordOrder!=="SOV"||!ri.test(i[0].value)||e!==eu(i))return false;let n=Ge(r.roleMarkers?.patient);return n.size===0?false:V(i[e-1],n)}function ru(i,e,t){if(!I(e))return null;let r=Z(e,"behavior"),n=Z(e,"def"),a=i.toLowerCase(),o=[...r].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=U(i,e).tokens;if(s.length<2)return null;if(V(s[0],r))return kr(i,e,s,t,0);let l=s.findIndex((p,d)=>d>0&&V(p,r));if(l>0&&pt.test(s[0].value))return kr(i,e,s,t,l);if(V(s[0],n))return br(i,e,s,t,0);let c=s.findIndex((p,d)=>d>0&&V(p,n));return c>0&&tu(s,c,e)?br(i,e,s,t,c):null}function iu(i,e,t){let r=I(e);if(!r)return null;let n=r.wordOrder!=="SOV",a=gr.has(e)?Ge(r.roleMarkers?.event):new Set,o=gr.has(e)?Ge(r.keywords?.on):new Set,u=a.size>0&&o.size>0,s=Z(e,"end"),l=Z(e,"on"),c=i.toLowerCase(),p=[...s].some(k=>c.includes(k)),d=(n||u)&&(()=>{let k=0;for(let g of l)if(g){for(let C=c.indexOf(g);C>=0;C=c.indexOf(g,C+g.length))if(++k>=2)return true}return false})();if(!p&&!d)return null;let m=U(i,e).tokens;if(m.length<2)return null;let y=Xe.map(k=>Z(e,k)),E=k=>dt(k,y),v=k=>V(k,s),f=[],h=0,b=0;for(let k=0;k<m.length;k++){let g=m[k];if(v(g)){if(h>0){h--;continue}let C=i.slice(m[b].position.start,g.position.start).trim();C&&f.push(C),b=k+1;}else if(E(g))h++;else if(n&&h===0&&k>b&&V(g,l)&&ei(m[k+1])){let C=i.slice(m[b].position.start,g.position.start).trim();C&&f.push(C),b=k;}else if(u&&h===0&&k-1>b&&V(g,a)&&m[k+1]!==void 0&&V(m[k+1],o)){let C=m[k-1],w=i.slice(m[b].position.start,C.position.start).trim();w&&f.push(w),b=k-1;}}if(b<m.length){let k=i.slice(m[b].position.start).trim();k&&f.push(k);}if(f.length<2)return null;let x=[],A=[];for(let k of f){let g;try{g=t.statement(k,e);}catch{return null}if(!g||g.kind!=="event-handler")return null;let C=g;x.push(C);let w=!C.body||C.body.length===0;A.push(w?.2:C.metadata?.confidence??.75);}return Tt(x,"then",{sourceLanguage:e,confidence:Ye(A),sourceText:i})}function Ye(i){return i.length>0?i.reduce((e,t)=>e+t,0)/i.length:0}function It(i){let e=[];for(let t of i){let r=t.statements;t.kind==="compound"&&Array.isArray(r)?e.push(...r):e.push(t);}return e}function kr(i,e,t,r,n){let a=n>0,o=a?0:mt(t,n,e);if(o<0)return null;let u=t[o],s=u.value;if(!pt.test(s))return null;let{parameters:l,headerEnd:c}=ti(i,u),p=a?n+1:t.findIndex(C=>C.position.start>=c);p<=o&&(p=o+1);let d=Z(e,"init"),m=Z(e,"end"),y=Xe.map(C=>Z(e,C)),E=C=>dt(C,y),v=C=>V(C,m),f=[],h=[],b=[],x=false,A=0,k=p;for(let C=p;C<t.length;C++){let w=t[C];if(v(w)){if(A>0){A--;continue}if(C===k){x=true;break}if(V(t[k],d)){let z=i.slice(t[k].position.end,w.position.start).trim();if(z)try{let D=It(r.body(z,e));h.push(...D),b.push(Ye(D.map(S=>S.metadata?.confidence??.75)));}catch{b.push(0);}}else {let z=i.slice(t[k].position.start,w.position.start).trim();try{let D=r.statement(z,e);if(D&&D.kind==="event-handler"){let S=D;f.push(S);let R=!S.body||S.body.length===0;b.push(R?.2:S.metadata?.confidence??.75);}else b.push(0);}catch{b.push(0);}}k=C+1;}else E(w)&&A++;}if(f.length===0&&h.length===0)return null;let g=(x?1:.8)*Ye(b);return ho(s,l,f,h.length>0?h:void 0,{sourceLanguage:e,confidence:g,sourceText:i})}function br(i,e,t,r,n){let a=n>0,o=a?0:mt(t,n,e);if(o<0)return null;let u=t[o],s=u.value;if(!ri.test(s))return null;let{parameters:l,headerEnd:c}=ti(i,u),p=a?n+1:t.findIndex(g=>g.position.start>=c);p<=o&&(p=o+1);let d=Z(e,"end"),m=Xe.map(g=>Z(e,g)),y=g=>dt(g,m),E=g=>V(g,d),v=0,f=-1;for(let g=p;g<t.length;g++)if(E(t[g])){if(v===0){f=g;break}v--;}else y(t[g])&&v++;let h=t[p]?.position.start??c,b=f>=0?t[f].position.start:i.length,x=i.slice(h,b).trim();if(!x)return null;let A;try{A=It(r.body(x,e));}catch{return null}if(A.length===0)return null;let k=Ye(A.map(g=>g.metadata?.confidence??.75));return f<0&&(k*=.8),Eo(s,l,A,{sourceLanguage:e,confidence:k,sourceText:i})}var Ft=["live","eventsource","socket","worker","intercept"],au=new Set(["intercept"]),Lt=new Set(["eventsource","socket","worker"]),nu=new Set(["eventsource","socket"]),ou=new Set(["worker"]),uu=6,su=2;function lu(i,e){for(let r of Ft)if(V(i[0],Z(e,r)))return {action:r,keywordIdx:0};if(I(e)?.wordOrder!=="SOV")return null;let t=Math.min(i.length,uu);for(let r=1;r<t;r++)for(let n of Ft)if(n!=="live"&&V(i[r],Z(e,n))&&!(Lt.has(n)&&!pt.test(i[0].value))&&!(n==="intercept"&&r>su))return {action:n,keywordIdx:r};return null}function cu(i,e,t){let r=Ge(I(t)?.roleMarkers?.source);return r.size===0||e+1>=i.length?0:V(i[e],r)||V(i[e+1],r)?2:0}function pu(i,e,t,r,n){if(i==="live")return t+1;if(t>0){let s=t+1;return i==="eventsource"&&(s+=cu(e,s,r)),s}let a=mt(e,t,r);if(a<0)return -1;if(i==="worker")return a+1;let o=Z(r,"on"),u=n>=0?n:e.length;for(let s=a+1;s<u;s++)if(V(e[s],o)&&ei(e[s+1]))return s;return u}function du(i,e,t,r){if(!Lt.has(i))return;let n=t>0?0:mt(e,t,r);if(!(n<0))return e[n].value}function mu(i,e,t){if(!I(e))return null;let r=i.toLowerCase(),n=false;for(let u of Ft){for(let s of Z(e,u))if(s&&r.includes(s)){n=true;break}if(n)break}if(!n)return null;let a=U(i,e).tokens;if(a.length<2)return null;let o=lu(a,e);return o?yu(i,e,a,t,o.action,o.keywordIdx):null}function yu(i,e,t,r,n,a){let o=Z(e,"end"),u=Xe.map(x=>Z(e,x)),s=x=>dt(x,u),l=x=>V(x,o),c=du(n,t,a,e);if(Lt.has(n)&&(!c||!pt.test(c)))return null;let p=x=>({sourceLanguage:e,confidence:x,sourceText:i}),d=wr(t,a+1,l,s);if(au.has(n))return d>=0&&d!==t.length-1?null:pr(n,[],c,p(d>=0?1:.8));let m=pu(n,t,a,e,d);if(m<0||m>t.length)return null;let y=[],E=[],v=false,f=ou.has(n);if(f||nu.has(n)){let x=f?"def":"event-handler",A=0,k=m;for(let g=m;g<t.length;g++){let C=t[g];if(l(C)){if(A>0){A--;continue}if(v=true,g===k)break;let w=f?C.position.end:C.position.start,z=i.slice(t[k].position.start,w).trim();try{let D=r.statement(z,e);if(D&&D.kind===x){let S=D;y.push(S);let R=!S.body||S.body.length===0;E.push(R?.2:S.metadata?.confidence??.75);}else E.push(0);}catch{E.push(0);}k=g+1;}else s(C)&&A++;}}else {let x=wr(t,m,l,s);v=x>=0;let A=x>=0?t[x].position.start:i.length,k=i.slice(t[m].position.start,A).trim();if(!k)return null;try{y.push(...It(r.body(k,e)));}catch{return null}if(y.length===0)return null;E.push(...y.map(g=>g.metadata?.confidence??.75));}if(y.length===0&&!v)return null;let h=v?1:.8,b=E.length>0?h*Ye(E):h;return pr(n,y,c,p(b))}function wr(i,e,t,r){let n=0;for(let a=e;a<i.length;a++)if(t(i[a])){if(n===0)return a;n--;}else r(i[a])&&n++;return -1}var ge={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(ge).map(([i,e])=>{let t={};for(let[r,n]of Object.entries(e))n in t||(t[n]=r);return [i,t]}));var Eu={debounced:"debounce",debounce:"debounce",throttled:"throttle",throttle:"throttle"},gu=[["\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"]],ku=/^(\d+)(ms|s|m)?$/,bu=new Set(["selector","literal","url","event-modifier"]);function wu(i){let e=i.match(ku);if(!e)return null;let t=parseInt(e[1],10),r=e[2]||"ms";return r==="s"?t*=1e3:r==="m"&&(t*=6e4),t}function zu(i){for(let e=1;e<i.length;e++){let t=i[e];if(bu.has(t.kind))continue;let r=t.value.toLowerCase(),n=Eu[r];if(n){let a=0;for(let o=e+1;o<i.length;o++){let u=i[o],s=wu(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 gu){if(a[0]!==r||e+a.length>i.length)continue;let o=true;for(let u=1;u<a.length;u++)if(i[e+u].value.toLowerCase()!==a[u]){o=false;break}if(o)return {modifiers:{once:true},start:t.position.start,end:i[e+a.length-1].position.end}}}return null}var ze=new Set(["if","unless","while","repeat","for"]),Ct=new Set(["then","end","else","if","unless","while","for","repeat","and"]),Au=new Set(["first","last","next","previous","random","closest"]),_e=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"]),Ar=class extends Error{constructor(i,e,t,r){super(i),this.name="SemanticParseError",this.language=e,this.input=t,this.diagnostics=r;}};function $(i,e,t){return {message:i,severity:e,source:"semantic-parser",...t&&{code:t}}}function j(i,e){return e.length===0?i:{...i,diagnostics:e}}var ct=120;function xu(i,e,t){let r=e.tokens.length;if(i.consumedTokens>=r)return null;let n=e.tokens[i.consumedTokens],a=e.tokens[r-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>ct?`${o.slice(0,ct)}\u2026`:o,s=r-i.consumedTokens;return `pattern ${i.pattern.id} left ${s} token(s) unconsumed: "${u}"`}var Du=new Set(["to","from","into","onto","with","as","at","of","in","on","by","and","or","then","end","else","the","a","an","async"]);function At(i){let e=[],t=new Set((i.diagnostics??[]).map(n=>`${n.code}|${n.message}`)),r=n=>{if(!n||typeof n!="object")return;if(n!==i)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 ii){let u=a[o];if(Array.isArray(u))for(let s of u)r(s);}};return r(i),e.length===0?i:j(i,[...i.diagnostics??[],...e])}function xr(i){if(i.length>=2){let e=i[0];if((e==='"'||e==="'")&&i.endsWith(e))return i.slice(1,-1)}return i}var ii=["body","statements","thenBranch","elseBranch","eventHandlers","initBlock"];function ai(i,e){if(!i||typeof i!="object")return i;if(i.action&&i.roles instanceof Map){let r=ee(i.action),n=r?.primaryRole;if(r&&n&&n!=="patient"&&!r.roles.some(a=>a.role==="patient")&&i.roles.has("patient")&&!i.roles.has(n)){let a=i.roles,o=a.get("patient");o!==void 0&&(a.delete("patient"),a.set(n,o));}if(i.action==="tell"){let a=i.roles,o=a.get("patient"),u=a.get("destination");o&&(o.type==="selector"||o.type==="reference")&&(!u||u.type==="literal")&&(a.delete("patient"),a.set("destination",o));}if(i.action==="fetch"){let a=i.roles,o=a.get("patient"),u=a.get("source");o&&u&&(o.type==="literal"||o.type==="expression")&&u.type==="expression"&&!a.has("style")&&(a.delete("patient"),a.set("style",u),a.set("source",o));}if(i.action==="transition"){let a=i.roles,o=a.get("destination");o&&o.type==="literal"&&!a.has("goal")&&(a.delete("destination"),a.set("goal",o));let u=a.get("patient");u&&u.type==="literal"&&typeof u.value=="string"&&/^[A-Za-z_][A-Za-z0-9_-]*$/.test(u.value)&&a.set("patient",{type:"expression",raw:u.value});}if(i.action==="morph"){let a=i.roles,o=a.get("patient");o&&o.type==="literal"&&typeof o.value=="string"&&/<[a-zA-Z][^>]*\/?>/.test(o.value)&&a.set("patient",{type:"expression",raw:o.value});}if(i.action==="wait"){let a=i.roles;if(!a.has("event")){let o=a.get("duration"),u=o?.type==="expression"?o.raw:o?.type==="literal"?o.value:void 0;typeof u=="string"&&_e.has(u.toLowerCase())&&(a.delete("duration"),a.set("event",{type:"literal",value:u,dataType:"string"}));}}if(i.kind==="command"&&i.action!=="on"){let a=i.roles,o=a.get("event");if(o&&o.type==="expression"){let u=o.raw;typeof u=="string"&&/^[A-Za-z_][A-Za-z0-9_-]*(:[A-Za-z0-9_-]+)?$/.test(u)&&a.set("event",{type:"literal",value:u,dataType:"string"});}}if(e?.size){let a=i.roles;for(let o of ["destination","source"]){let u=a.get(o);u&&u.type==="literal"&&typeof u.value=="string"&&e.has(u.value)&&a.set(o,{type:"expression",raw:u.value});}}}let t=i;for(let r of ii){let n=t[r];if(Array.isArray(n))for(let a of n)ai(a,e);}return i}var X=class T{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 r=ai(this.parseInternal(e,t),this.boundIdentifiers),n=this.coverageFrames[this.coverageFrames.length-1];if(n.length>0&&(r=j(r,[...r.diagnostics??[],...n])),this.parseDepth===1&&(r=At(r),r.kind==="event-handler")){let a={node:r,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),r=a.node;}return r}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=T.coverageMarkerSurfaces.get(e);if(!t){t=new Set;let r=I(e)?.roleMarkers;if(r){for(let n of Object.values(r))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 T.LEAKED_RENDER_MARKERS[e]??[])t.add(n.toLowerCase());T.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 r=(e.normalized??e.value).toLowerCase();return Du.has(r)?true:T.getCoverageMarkerSurfaces(t).has(e.value.toLowerCase())}recordDroppedTokens(e,t,r){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>ct?`${a.slice(0,ct)}\u2026`:a;n.push($(`${r} 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 r=e.roles.get(t);r?.type==="expression"&&typeof r.raw=="string"&&/^[A-Za-z_]\w*$/.test(r.raw)&&this.boundIdentifiers.add(r.raw);}parseInternal(e,t){let r=ru(e,t,{statement:(w,z)=>this.parse(w,z),body:(w,z)=>this.parseStatements(w,z)});if(r)return r;let n=mu(e,t,{statement:(w,z)=>this.parse(w,z),body:(w,z)=>this.parseStatements(w,z)});if(n)return n;let a=iu(e,t,{statement:(w,z)=>this.parse(w,z),body:(w,z)=>this.parseStatements(w,z)});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=[],y=U(d,t),E=de(t);if(E.length===0)throw new Ar(`No patterns available for language: ${t}`,t,d,[$(`No patterns registered for language '${t}'`,"error","no-patterns")]);let v=[...E].sort((w,z)=>z.priority-w.priority);{let w=y.tokens;if(I(t)?.wordOrder==="VSO"&&w.length>=4&&w[0]?.normalized==="source"){let z=w.findIndex(D=>D.normalized==="on");if(z>=2&&z+1<w.length){let D=d.slice(w[0].position.start,w[z].position.start).trim(),S=w[z+1].position.end,R=d.slice(w[z].position.start,S)+" "+D+d.slice(S);if(R!==d)try{let P=this.parse(R,t);if(P&&P.kind==="event-handler"){let O=o?this.applyModifiers(P,o):P;return j(O,m)}}catch{}}}}{let w=y.tokens,z=w[0]?.normalized==="if";for(let D=0;z&&D+3<w.length;D++){let S=(w[D+3]?.normalized??w[D+3]?.value??"").toLowerCase();if(w[D]?.normalized==="source"&&w[D+2]?.normalized==="on"&&T.KNOWN_EVENTS.has(S)){let R=(d.slice(0,w[D].position.start).trimEnd()+" "+d.slice(w[D+1].position.end).trimStart()).trim();if(R&&R!==d)try{let P=this.parse(R,t);if(P&&P.kind==="event-handler"){let O=o?this.applyModifiers(P,o):P;return j(O,m)}}catch{}break}}}{let w=y.tokens;for(let z=1;z<w.length-1;z++){let D=w[z],S=D.value,R=(D.normalized??D.value).toLowerCase();if(!(R==="or"||T.OR_KEYWORDS.has(S)||T.OR_KEYWORDS.has(R)))continue;let O=w[z+1],_=(O.normalized??O.value).toLowerCase();if(!T.KNOWN_EVENTS.has(_))break;let L=z+1,W=w[z+2];W&&W.kind==="selector"&&W.value.startsWith("[")&&(L=z+2);let G=w[z].position.start,ve=w[L].position.end,se=(d.slice(0,G).trimEnd()+" "+d.slice(ve).trimStart()).trim();if(se&&se!==d)try{let he=this.parse(se,t);if(he&&he.kind==="event-handler"){he.additionalEvents=[{type:"literal",value:_}];let kt=o?this.applyModifiers(he,o):he;return j(kt,m)}}catch{}break}}{let w=zu(y.tokens);if(w){let z=(d.slice(0,w.start).trimEnd()+" "+d.slice(w.end).trimStart()).trim();if(z&&z!==d)try{let D=this.parse(z,t);if(D&&D.kind==="event-handler"){let S=this.applyModifiers(D,{...o??{},...w.modifiers});return j(S,m)}}catch{}}}let f=v.filter(w=>w.command==="on"),h=y.mark(),b=oe.matchBest(y,f);if(b){m.push($(`event pattern matched: ${b.pattern.id} (confidence: ${b.confidence.toFixed(2)})`,"info","pattern-match"));let w=false;if(/^event-[a-z]+-bare$/.test(b.pattern.id)){let z=b.captured.get("event"),D=(z?.raw??z?.value??"").toString().toLowerCase(),S=ge[t],R=T.KNOWN_EVENTS.has(D)||!!S&&Object.keys(S).some(P=>P.toLowerCase()===D);if(D&&!R){let P=this.trySOVEventExtraction(d,t,v);if(P){m.push($(`bare-event mis-anchor on "${D}" rejected; SOV extraction preferred`,"info","stage-bare-event-guard"));let O=o?this.applyModifiers(P,o):P;return j(O,m)}if(z?.type==="reference"||z?.type==="expression"){y.reset(h);let O=v.filter(L=>L.command!=="on"),_=oe.matchBest(y,O);y.reset(h),_&&_.pattern.command!=="on"?(w=true,m.push($(`bare-event mis-anchor on reference "${D}" rejected; command ${_.pattern.command} preferred`,"info","stage-bare-event-guard"))):oe.matchBest(y,f);}}}if(!w){let z=this.buildEventHandler(b,y,t),D=o?this.applyModifiers(z,o):z;return j(D,m)}}m.push($(`event patterns: ${f.length} tried, no match`,"info","stage-event"));let x=this.tryTrailingEventExtraction(d,t,v);if(x){m.push($("trailing event extraction succeeded","info","stage-trailing-event"));let w=o?this.applyModifiers(x,o):x;return j(w,m)}let A=v.filter(w=>w.command!=="on"),k=oe.matchBest(y,A);if(k){if(ze.has(k.pattern.command)){let z=this.trySOVEventExtraction(d,t,v);if(z){m.push($(`SOV event extraction preferred over bare ${k.pattern.command} command`,"info","stage-sov-loop"));let S=o?this.applyModifiers(z,o):z;return j(S,m)}let D=this.tryMidStreamEventExtraction(d,t,v);if(D){m.push($(`mid-stream event extraction preferred over bare ${k.pattern.command} command`,"info","stage-midstream-loop"));let S=o?this.applyModifiers(D,o):D;return j(S,m)}}else if(T.KNOWN_EVENTS.has(k.pattern.command)&&this.hasSOVEventMarkerHead(d,t)){let z=this.trySOVEventExtraction(d,t,v);if(z){m.push($(`SOV event extraction preferred over command-homonym event ${k.pattern.command}`,"info","stage-sov-homonym"));let D=o?this.applyModifiers(z,o):z;return j(D,m)}}else if(I(t)?.wordOrder==="VSO"){let z=this.tryMidStreamEventExtraction(d,t,v);if(z){m.push($(`mid-stream event extraction preferred over bare ${k.pattern.command} command`,"info","stage-midstream-cmd"));let D=o?this.applyModifiers(z,o):z;return j(D,m)}}if(k.consumedTokens<y.tokens.length&&I(t)?.wordOrder==="SOV"){let z=this.trySOVEventExtraction(d,t,v);if(z){m.push($(`SOV event extraction preferred over partial ${k.pattern.command} command (trailing remainder)`,"info","stage-sov-trailing"));let D=o?this.applyModifiers(z,o):z;return j(D,m)}}if(k.consumedTokens<y.tokens.length&&!ze.has(k.pattern.command)){let z=this.tryTopLevelCommandSequence(y,A,t);if(z)return m.push($(`top-level command sequence: ${z.statements.length} commands`,"info","stage-top-level-sequence")),j(z,m)}m.push($(`command pattern matched: ${k.pattern.id} (confidence: ${k.confidence.toFixed(2)})`,"info","pattern-match"));let w=xu(k,y,d);return w&&m.push($(w,"warning","unconsumed-input")),j(this.buildCommand(k,t),m)}if(m.push($(`command patterns: ${A.length} tried, no match`,"info","stage-command")),!d.includes(`
4
- `)&&I(t)?.wordOrder==="VSO"){let w=this.tryMidStreamEventExtraction(d,t,v);if(w){m.push($("mid-stream event extraction succeeded with no leading command match","info","stage-midstream-nocmd"));let z=o?this.applyModifiers(w,o):w;return j(z,m)}}let g=this.trySOVEventExtraction(d,t,v);if(g){m.push($("SOV event extraction succeeded","info","stage-sov"));let w=o?this.applyModifiers(g,o):g;return j(w,m)}m.push($("SOV event extraction: no event keyword found","info","stage-sov"));let C=this.tryCompoundCommandParsing(y,A,t);if(C)return m.push($("compound command parsing succeeded","info","stage-compound")),j(C,m);throw m.push($("compound parsing: no then-keywords or no command matches","info","stage-compound")),m.push($(`all parse stages exhausted for "${d}"`,"error","parse-failed")),new Ar(`Could not parse input in ${t}: ${d}`,t,d,m)}parseStatements(e,t){let r=U(e,t),n=de(t).filter(a=>a.command!=="on").sort((a,o)=>o.priority-a.priority);this.coverageFrames.push([]);try{let a=this.parseBodyWithClauses(r,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]=j(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 Jr()}buildCommand(e,t){if(!e)throw new Error("No match to build command from");let r={};for(let[a,o]of e.captured)r[a]=o;let n=ne(e.pattern.command,r,{sourceLanguage:t,patternId:e.pattern.id,confidence:e.confidence});return this.registerBoundIdentifiers(n),n}buildEventHandler(e,t,r){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 p=n.type==="expression"?n.raw:n.type==="literal"?n.value:void 0;if(typeof p=="string"&&/^[^\s()[\]{}:]+$/.test(p)){let d=ge[r]?.[p];d?n={type:"literal",value:d,dataType:"string"}:n.type==="expression"&&T.KNOWN_EVENTS.has(p.toLowerCase())&&(n={type:"literal",value:p.toLowerCase(),dataType:"string"});}}let a=oe.extractEventModifiers(t),o=e.captured.get("source");o&&e.pattern.id.endsWith("source")&&!(o.type==="reference"&&o.value==="me")&&(a={...a??{},from:o});let u=this.extractOrConjunctionEvents(t,r),s=n;u.length>0&&n.type==="literal"&&(s={type:"literal",value:[String(n.value),...u.map(d=>String("value"in d?d.value:""))].join(" or ")});let l,c=e.captured.get("action");if(c&&c.type==="literal"&&c.value==="if"){let p=t.tokens,d=-1;for(let m=t.position()-1;m>=0;m--){let y=p[m],E=(y.normalized??y.value).toLowerCase();if(this.isIfKeyword(E,r)){d=m;break}}if(d>=0){let m=de(r).filter(b=>b.command!=="on").sort((b,x)=>x.priority-b.priority),y=p.slice(d);if(e.pattern.id.endsWith("vso-verb-first")&&s.type==="literal"){let b=String(s.value??"").split("[")[0].trim().toLowerCase(),x=y.findIndex((A,k)=>{if(k===0||b==="")return false;let g=(A.normalized??A.value).toLowerCase(),C=y[k-1];return g===b&&C.kind==="keyword"&&(C.normalized??"").toLowerCase()==="on"});if(x>0){let A=y[x+1],k=A&&A.kind==="selector"&&A.value.startsWith("[")?1:0;y=[...y.slice(0,x-1),...y.slice(x+1+k)];}}let E=new ae(y,r),v=this.coverageMark(),f=this.parseBodyWithClauses(E,m,r);if(f.some(b=>b.kind==="conditional")||f.length===1&&f[0]?.kind==="compound"&&f[0].statements.some(b=>b.kind==="conditional")){for(;!t.isAtEnd();)t.advance();return Ke(s,f,a,{sourceLanguage:r,patternId:e.pattern.id,confidence:e.confidence})}this.coverageRollback(v);}}if(c&&c.type==="literal"){let p=c.value,d={};for(let[A,k]of e.captured)A!=="event"&&A!=="action"&&A!=="continues"&&(d[A]=k);if(p==="repeat"){let A=t.peek(),k=C=>(C.normalized??C.value).toLowerCase();if(A&&A.kind==="keyword"&&k(A)==="forever")d.loopType={type:"literal",value:"forever"},delete d.patient,t.advance();else if(A&&A.kind==="keyword"&&k(A)==="event"){t.advance();let C=t.peek();if(C)for(d.event={type:"literal",value:k(C)},d.loopType={type:"literal",value:"until-event"},delete d.patient;!t.isAtEnd();){let w=t.peek();if(!w||w.kind==="conjunction"||w.kind==="keyword"&&(this.isThenKeyword(w.value,r)||this.isEndKeyword(w.value,r)))break;t.advance();}}let g=d.patient;g&&g.type==="reference"&&g.value==="me"&&delete d.patient;}let m=ne(p,d,{sourceLanguage:r,patternId:e.pattern.id,confidence:e.confidence});if(this.registerBoundIdentifiers(m),!ze.has(p)||p==="repeat"){let A=e.pattern.id.includes("verb-first"),k=t.tokens,g=t.position(),C=z=>z.kind==="conjunction"||z.kind==="keyword"&&(this.isThenKeyword(z.value,r)||this.isEndKeyword(z.value,r)),w=-1;for(let z=g-1;z>=0;z--){let D=k[z];if(C(D))break;if((D.normalized??D.value).toLowerCase()===p){w=z;break}}if(w>=0){let z=g;for(;z<k.length&&!C(k[z]);)z++;let D=k.slice(w,z),S=D;if(A){let R=String(n.value??"").toLowerCase(),P=D.findIndex(O=>(O.normalized??O.value).toLowerCase()===R);if(P<0)S=null;else {let O=D[P-1],_=O&&O.kind==="keyword"&&O.normalized?.toLowerCase()==="on"?P-1:P;S=[...D.slice(0,_),...D.slice(P+1)];}}if(S&&S.length>1){let R=de(r).filter(M=>M.command!=="on").sort((M,Y)=>Y.priority-M.priority),P=this.coverageMark(),O=this.parseClause(S,R,r),_=O[0],L=M=>M!==null&&typeof M=="object"&&typeof M.type=="string"?M.type:typeof M,W=ee(p),G=W?.primaryRole,ve=M=>M==="patient"&&G&&G!=="patient"&&!W?.roles.some(Y=>Y.role==="patient")?G:M,se=(M,Y)=>{if(!ze.has(p)||!W)return false;let Ee=W.roles.find(je=>je.role===ve(M));return Ee?Ee.expectedTypes.length>0&&!Ee.expectedTypes.includes(L(Y)):true},he=(M,Y)=>M==="patient"&&!!W&&!W.roles.some(Ee=>Ee.role==="patient")&&L(Y)==="literal"&&Vr.has(String(Y.value??"").toLowerCase()),kt=!!_&&_.kind==="command"&&Object.entries(d).every(([M,Y])=>{if(se(M,Y)||he(M,Y))return true;let Ee=_.roles.get(ve(M));if(Ee!==void 0&&L(Ee)===L(Y))return true;if(M==="patient"&&p==="pick"&&L(Y)==="literal"){let je=_.roles.get("method"),rr=L(je),ir=rr==="literal"?String(je.value):rr==="expression"?String(je.raw):void 0;return ir!==void 0&&ir===String(Y.value)}return false}),Ii=_?.metadata?.patternId??"",Li=!ze.has(p)||/^repeat-.*-(times|for-in|while-head|until-head)$/.test(Ii);if(O.length===1&&_&&_.kind==="command"&&_.action===p&&kt&&Li&&_.roles.size>Object.entries(d).filter(([M,Y])=>!he(M,Y)).length)for(m=_;t.position()<z;)t.advance();else this.coverageRollback(P);}}}if(!ze.has(p)){let A=m;if(ee(p)?.roles.some(S=>S.role==="quantity"&&!S.required)&&!A.roles.has("quantity")){let S=t.peek();S&&/^-?\d+(\.\d+)?$/.test(S.value)&&(m=ne(p,{...Object.fromEntries(A.roles),quantity:{type:"literal",value:parseFloat(S.value),dataType:"number"}},A.metadata),t.advance());}let g=m;if(ee(p)?.roles.some(S=>S.role==="duration"&&!S.required)&&!g.roles.has("duration")){let S=/^\d+(\.\d+)?(ms|s)$/i,R=t.peek(),P=false;if(R&&R.kind==="particle"){let O=t.peek(1);O&&S.test(O.value)&&(P=true,R=O);}R&&S.test(R.value)&&(m=ne(p,{...Object.fromEntries(g.roles),duration:{type:"literal",value:R.value,dataType:"string"}},g.metadata),P&&t.advance(),t.advance(),this.consumeForPostposition(t,r));}let w=m,z=ee(p);if(z?.roles.find(S=>S.role==="responseType"&&!S.required)&&!w.roles.has("responseType")){let S=L=>typeof L=="string"&&T.RESPONSE_TYPE_WORDS.has(L.toLowerCase()),R=(L,W)=>{let G=Object.fromEntries(w.roles);W&&delete G.destination,G.responseType={type:"expression",raw:L},m=ne(p,G,w.metadata);},P=w.roles.get("destination"),O=z?.roles.find(L=>L.role==="destination"),_=P?.raw??P?.value;if(P&&O&&!O.expectedTypes.includes(P.type)&&S(_))R(_,true);else {let L=t.peek();L&&S(L.value)&&(R(L.value,false),t.advance());}}if(p==="wait"){let S=m;if(!S.roles.has("event")){let R=t.peek();if(R&&_e.has(R.value.toLowerCase())){let P=Object.fromEntries(S.roles),O=P.duration;O&&O.type!=="literal"&&O.type!=="expression"&&delete P.duration;let _=P.patient;_&&_.type==="reference"&&_.value==="me"&&delete P.patient,P.event={type:"literal",value:R.value,dataType:"string"},m=ne(p,P,S.metadata),t.advance(),this.consumeForPostposition(t,r);}}}this.tryAttachTrailingRole(t,m,r),this.tryAttachTrailingStyle(t,m,r),this.tryAttachTrailingExpressionRole(t,m,r);}let y=e.captured.get("continues"),E=y?.type==="literal"&&y.value==="then",v=t.peek(),f=!!v&&this.isThenKeyword(v.value,r),b=ze.has(p)&&!!v&&!this.isEndKeyword(v.value,r),x=!!v&&!this.isEndKeyword(v.value,r);if(E||f||b||x){let A=de(r).filter(C=>C.command!=="on").sort((C,w)=>w.priority-C.priority),k=de(r).filter(C=>C.id.startsWith("grammar-")&&C.id.includes("-continuation")).sort((C,w)=>w.priority-C.priority),g=this.parseBodyWithGrammarPatterns(t,A,k,r);g.length>0?l=[m,...g]:l=[m];}else l=[m],t.isAtEnd()||this.recordDroppedTokens(t.tokens.slice(t.position()),r,"handler body tail");}else {let p=de(r).filter(d=>d.command!=="on").sort((d,m)=>m.priority-d.priority);l=this.parseBodyWithClauses(t,p,r);}return Ke(s,l,a,{sourceLanguage:r,patternId:e.pattern.id,confidence:e.confidence})}parseBodyWithClauses(e,t,r){let n=[],a=[],o=0,u=[];for(;!e.isAtEnd();){let s=e.peek();if(!s)break;if(a.length===0){let y=this.consumeJsBlock(e,r);if(y){n.push(y);continue}let E=this.tryParseConditionalBlock(e,t,r);if(E){n.push(E);continue}}let l=s.kind==="conjunction"||s.kind==="keyword"&&this.isThenKeyword(s.value,r),c=a[a.length-1],p=e.peek(1),d=c?.value.toLowerCase()==="at"&&p?.value.toLowerCase()==="of"||dr(r,s.value,c?.value,p?.value),m=s.kind==="keyword"&&this.isEndKeyword(s.value,r)&&!d;if(m&&o>0){o--,u.pop(),a.push({...s,metadata:{...s.metadata,closesTrackedBlock:true}}),e.advance();continue}if(l&&u.includes("if")){a.push(s),e.advance();continue}if(l){if(a.length>0){let y=this.parseClause(a,t,r);n.push(...y),a.length=0,o=y.filter(E=>{let v=E;return (v.action==="for"||v.action==="repeat"||v.action==="while")&&(!Array.isArray(v.body)||v.body.length===0)}).length,u.length=0;for(let E=0;E<o;E++)u.push("other");}e.advance();continue}if(m){e.advance();let y=[];for(;!e.isAtEnd();){let E=e.peek();if(!E||E.kind==="conjunction"||E.kind==="keyword"&&(this.isThenKeyword(E.value,r)||this.isEndKeyword(E.value,r)))break;y.push(E),e.advance();}if(y.length>0){let E=this.coverageMark(),v=a.length>0?this.parseClause(a,t,r):[];v.length===0&&a.length>0?(this.coverageRollback(E),n.push(...this.parseClause([...a,...y],t,r))):(n.push(...v),n.push(...this.parseClause(y,t,r)));}else if(a.length>0){let E=this.parseClause(a,t,r);n.push(...E);}a.length=0;break}if(s.kind==="keyword"){let y=(s.normalized??s.value).toLowerCase();(this.isIfKeyword(y,r)||this.isUnlessKeyword(y,r)||y==="while"||y==="for"||y==="repeat")&&(o++,u.push(this.isIfKeyword(y,r)?"if":"other"));}a.push(s),e.advance();}if(a.length>0){let s=this.parseClause(a,t,r);n.push(...s);}e.isAtEnd()||this.recordDroppedTokens(e.tokens.slice(e.position()),r,"body stream tail"),this.foldFrontedWhileIntoRepeat(n,r);for(let s=n.length-1;s>=0;s--){let l=n[s];l.kind==="command"&&l.action==="for"&&(!(l.roles instanceof Map)||l.roles.size===0)&&(!Array.isArray(l.body)||l.body.length===0)&&n.splice(s,1);}return n.length>1?[Tt(n,"then",{sourceLanguage:r})]:n}tryTopLevelCommandSequence(e,t,r){let n=this.coverageMark(),a;try{let l=new ae(e.tokens,r);a=this.parseBodyWithClauses(l,t,r);}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 Tt(o.statements,o.chainType,{sourceLanguage:r,confidence:s})}foldFrontedWhileIntoRepeat(e,t){for(let r=0;r+1<e.length;r++){let n=e[r],a=e[r+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(r,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)}});}}parseClause(e,t,r){if(e.length===0)return [];let n=null,a=e,o=e[e.length-1];if(o&&e.length>=2){let f=(o.normalized??o.value).toLowerCase();this.isUnlessKeyword(f,r)&&(n="unless",a=e.slice(0,-1));}let u=null;if(n&&a.length>=3){let f=I(r),h=f?T.buildVerbLookup(f):null;if(h)for(let b=1;b<a.length-1;b++){let x=a[b],A=h.get(x.value.toLowerCase())??(x.normalized?h.get(x.normalized.toLowerCase()):void 0);if(A&&!T.CONDITION_OPERATORS.has(A)){u=a.slice(0,b),a=a.slice(b);break}}}let s=new ae(a,r),l=[],c=this.coverageMark(),p=0,d=[],m=u,y=()=>{if(d.length===0)return;let f=d.slice();if(d.length=0,n&&l.length===0&&m===null){m=f;return}let h=f[0];if(!(h&&(h.kind==="identifier"||h.kind==="selector"||h.kind==="literal"||h.kind==="reference"))){this.recordDroppedTokens(f,r,"body clause");return}let x=false;for(let A of this.parseSOVClauseByVerbAnchoring(f,r)){let k=A.action,g=A.roles;k&&ee(k)&&g instanceof Map&&g.size>0&&(l.push(A),x=true);}x||this.recordDroppedTokens(f,r,"body clause");};for(;!s.isAtEnd();){let f=s.peek(),h=!!f&&f.normalized?.toLowerCase()==="repeat",b=s.mark(),x=oe.matchBest(s,t);if(h&&x&&x.pattern.command!=="repeat"){s.reset(b),y(),l.push(ne("repeat",{},{sourceLanguage:r,confidence:.6})),p++,s.advance();continue}if(x&&x.pattern.command==="if"){let A=s.mark(),k=d.length;for(s.reset(b);!s.isAtEnd();){let C=s.peek();if(!C||this.isIfKeyword((C.normalized??C.value).toLowerCase(),r))break;d.push(C),s.advance();}let g=this.tryParseConditionalBlock(s,t,r);if(g){y(),l.push(g),p++;continue}d.length=k,s.reset(A);}if(x){y();let A=this.buildCommand(x,r);l.push(A),p++,this.tryAttachTrailingRole(s,A,r),this.tryAttachTrailingStyle(s,A,r),this.tryAttachTrailingExpressionRole(s,A,r);}else {let A=s.peek();A&&A.normalized?.toLowerCase()==="repeat"?(y(),l.push(ne("repeat",{},{sourceLanguage:r,confidence:.6})),p++):A&&d.push(A),s.advance();}}y();let E=l;if(p===0){let f=this.parseSOVClauseByVerbAnchoring(a,r);f.length>0&&(this.coverageRollback(c),E=f);}let v=m;return n&&E.length>0&&v&&v.length>0?[ne(n,{condition:{type:"expression",raw:this.joinTokenText(v,r)}},{sourceLanguage:r,patternId:`${n}-${r}-trailing-guard`,confidence:.85}),...E]:(n&&v&&v.length>0&&E.length===0&&this.recordDroppedTokens(v,r,"body clause"),E)}tryAttachTrailingRole(e,t,r){let n=ee(t.action);if(!n)return;let a=I(r);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 Ct.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(v=>v.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=v=>{if(!v||v.kind!=="particle"&&v.kind!=="keyword")return false;let f=v.value.toLowerCase();return p.primary?.toLowerCase()===f?true:c?false:(v.normalized??"").toLowerCase()===l?true:!!p.alternatives?.some(h=>h.toLowerCase()===f)},y=e.peek(),E=e.peek(1);if(!y||!E)return;if(c&&p.position==="after"){let v=e.peek(2),f=(y.normalized??y.value).toLowerCase();if(Au.has(f)&&E.kind==="selector"&&m(v)){o.set(l,{type:"expression",raw:`${f} ${E.value}`}),e.advance(),e.advance(),e.advance();return}}if(p.position==="after"){if(u(y,c)&&m(E)){let v=this.tokenToSemanticValue(y);e.advance(),e.advance(),v&&o.set(l,v);return}if(c&&u(y,c)){let v=e.peek(2),f=e.peek(3);if((E.normalized??E.value).toLowerCase()==="in"&&v&&!m(v)&&m(f)){let h=this.tokenToSemanticValue(y);e.advance(),e.advance(),e.advance(),e.advance(),h&&o.set(l,h);return}}}else if(m(y)&&u(E,c)){e.advance();let v=this.tokenToSemanticValue(e.advance());v&&o.set(l,v);return}}}tryAttachTrailingStyle(e,t,r){if(t.action!=="fetch"&&t.action!=="render")return;let n=t.roles;if(!ee(t.action)?.roles.some(f=>f.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 f=Ue(e,o.raw);f&&(n.set("style",{type:"expression",raw:f}),this.tryAttachResponseTypeAfterStyle(e,t,r));}return}if(t.action==="fetch"){let f=n.get("patient"),h=n.get("source");if(f&&h&&(f.type==="literal"||f.type==="expression")&&h.type==="expression"&&typeof h.raw=="string"&&/^[A-Za-z_][\w-]*$/.test(h.raw)&&e.peek()?.value===":"){let b=Ue(e,h.raw);b&&(n.set("source",{type:"expression",raw:b}),this.tryAttachResponseTypeAfterStyle(e,t,r));return}}let s=I(r)?.roleMarkers?.style;if(!s)return;if(s.position==="before"){let f=new Set([s.primary,...s.alternatives??[]].map(A=>A.toLowerCase())),h=e.peek();if(!h||!f.has(h.value.toLowerCase()))return;let b=e.mark();e.advance();let x=Ue(e);if(!x){e.reset(b);return}n.set("style",{type:"expression",raw:x}),this.tryAttachResponseTypeAfterStyle(e,t,r);return}if(s.position!=="after")return;let l=new Set([s.primary,...s.alternatives??[]].map(f=>f.toLowerCase())),c=f=>f.kind==="conjunction"||f.kind==="keyword"&&(this.isThenKeyword(f.value,r)||this.isEndKeyword(f.value,r)),p=24,d=-1,m=0;for(let f=0;f<p;f++){let h=e.peek(f);if(!h||c(h))break;if(h.value==="("||h.value==="{"?m++:(h.value===")"||h.value==="}")&&(m=Math.max(0,m-1)),m===0&&(h.kind==="particle"||h.kind==="keyword")&&l.has(h.value.toLowerCase())){d=f;break}}if(d<=0)return;let y=[];for(let f=0;f<d;f++){let h=e.peek(f);h&&y.push(h);}if(y.length===1&&T.RESPONSE_TYPE_WORDS.has(y[0].value.toLowerCase()))return;let E=new ae(y,r),v=Ue(E);n.set("style",{type:"expression",raw:v&&E.isAtEnd()?v:this.joinTokenText(y,r)});for(let f=0;f<=d;f++)e.advance();this.tryAttachResponseTypeAfterStyle(e,t,r);}tryAttachResponseTypeAfterStyle(e,t,r){let n=t.roles;if(n.has("responseType")||!ee(t.action)?.roles.some(c=>c.role==="responseType"&&!c.required))return;let o=c=>!!c&&T.RESPONSE_TYPE_WORDS.has(c.toLowerCase()),u=e.peek();if(!u)return;let s=c=>{n.set("responseType",{type:"expression",raw:c});};if(T.AS_MARKERS_BEFORE[r]?.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 T.AS_MARKERS_AFTER[r]??[])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,r){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 f=e.peek();if(f&&!Ct.has((f.normalized??f.value).toLowerCase())){let b=this.tokenToSemanticValue(f);if(b.type==="literal"||b.type==="selector"){o.set(a.role,b),o.set("method",{type:"literal",value:"url"}),e.advance();return}}let h=o.get("patient");if(h&&(h.type==="literal"||h.type==="selector")){o.set(a.role,h),o.set("method",{type:"literal",value:"url"}),o.delete("patient");return}}if(n==="go"&&u&&u.type==="expression"){let f=/^url\s+(\S+)$/i.exec(String(u.raw??""));if(f){let h=f[1].replace(/^["']|["']$/g,"");o.set(a.role,{type:"literal",value:h,dataType:"string"}),o.set("method",{type:"literal",value:"url"});return}}if(n==="go"&&!u){let f=o.get("patient");if(f&&f.type==="expression"&&String(f.raw).toLowerCase()==="url"){let h=e.peek();if(h&&!Ct.has((h.normalized??h.value).toLowerCase())){let b=this.tokenToSemanticValue(h);if(b.type==="literal"||b.type==="selector"){o.set(a.role,b),o.set("method",{type:"literal",value:"url"}),o.delete("patient"),e.advance();return}}}}if(u&&!(u.type==="reference"&&u.value==="me"))return;let s=I(r);if(!s)return;let l=null;if(a.terminator==="destination-marker"){let f=s.roleMarkers?.destination;if(!f||f.position!=="after")return;l=f.primary.toLowerCase();}let c=f=>f.kind==="conjunction"||f.kind==="keyword"&&(this.isThenKeyword(f.value,r)||this.isEndKeyword(f.value,r)),p=24,d=[],m=0,y=false;for(let f=0;f<p;f++){let h=e.peek(f);if(!h||c(h))break;if(h.value==="("||h.value==="{"?m++:(h.value===")"||h.value==="}")&&(m=Math.max(0,m-1)),l!==null&&m===0&&(h.kind==="particle"||h.kind==="keyword")&&h.value.toLowerCase()===l){y=true;break}d.push(h);}if(d.length===0||l!==null&&!y)return;let E=d.length+(y?1:0);if(n==="go"&&d.length===2&&d[0].value.toLowerCase()==="url"){let f=this.tokenToSemanticValue(d[1]);if(f.type==="literal"||f.type==="selector"){o.set(a.role,f),o.set("method",{type:"literal",value:"url"});let h=o.get("patient");h&&h.type==="reference"&&h.value==="me"&&!ee(n)?.roles.some(b=>b.role==="patient")&&o.delete("patient");for(let b=0;b<E;b++)e.advance();return}}let v=d;if(n==="js"){let f=s.keywords?.js,h=x=>[f?.primary,...f?.alternatives??[]].some(A=>!!A&&A.length>x.value.length&&A.includes(x.value)),b=0;for(;b<v.length&&h(v[b]);)b++;if(v=v.slice(b),v.length===0)return}if(o.set(a.role,{type:"expression",raw:this.joinTokenText(v,r)}),a.role!=="patient"){let f=o.get("patient");f&&f.type==="reference"&&f.value==="me"&&!ee(n)?.roles.some(h=>h.role==="patient")&&o.delete("patient");}for(let f=0;f<E;f++)e.advance();}static buildVerbLookup(e){let t=new Map;for(let[r,n]of Object.entries(e.keywords))if(!["on","if","else","when","where","while","end","then","and"].includes(r)&&(t.set(n.primary.toLowerCase(),r),n.alternatives))for(let a of n.alternatives)t.set(a.toLowerCase(),r);return t}static buildMarkerToRoleLookup(e){let t=new Map;for(let[r,n]of Object.entries(e.roleMarkers)){if(!n)continue;if((r!=="event"||!t.has(n.primary))&&t.set(n.primary,r),n.alternatives)for(let o of n.alternatives)t.has(o)||t.set(o,r);}return t}parseSOVClauseByVerbAnchoring(e,t){let r=I(t);if(!r||r.wordOrder!=="SOV")return [];let n=T.buildVerbLookup(r),a=T.buildMarkerToRoleLookup(r),o=[],u=0;for(;u<e.length;){let s=-1,l="";for(let y=u;y<e.length;y++){let E=e[y];if(a.has(E.value))continue;let v=n.get(E.value.toLowerCase()),f=E.normalized?n.get(E.normalized.toLowerCase()):void 0,h=v||f;if(h){s=y,l=h;break}}if(s===-1)break;let c=e.slice(u,s),p=e.length;for(let y=s+1;y<e.length;y++){let E=e[y];if(E.kind==="conjunction"||this.isThenKeyword(E.value,t)){p=y;break}if(y>s+1&&!a.has(E.value)&&(n.get(E.value.toLowerCase())||(E.normalized?n.get(E.normalized.toLowerCase()):void 0))){p=y;break}}let d=e.slice(s+1,p),m=this.extractRolesFromMarkedTokens(c,d,a,l,t);if(o.push(ne(l,m,{sourceLanguage:t,confidence:.7})),u=p,u<e.length){let y=e[u];(y.kind==="conjunction"||this.isThenKeyword(y.value,t))&&u++;}}return o}extractRolesFromMarkedTokens(e,t,r,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=r.get(d.value);if(m&&d.kind==="particle"&&c.length>0){let y=this.tokensToSemanticValue(c,a);if(y){let E=this.mapRoleForCommand(m,n,o);E&&(o[E]=y);}c=[];}else c.push(d);}if(c.length>0)if(c.length===1&&/^\d+(\.\d+)?(ms|s)$/i.test(c[0].value)&&!o.duration&&ee(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,r){return t==="set"&&(e==="patient"?e="destination":e==="destination"&&(e="patient")),r[e]?e==="patient"&&!r.destination?"destination":e==="destination"&&!r.patient?"patient":e==="source"&&!r.source?"source":null:e}tokensToSemanticValue(e,t){if(e.length===0)return null;let r=e.filter(o=>o.kind!=="whitespace");if(r.length===0)return null;if(r.length>=2&&(r[0].kind==="selector"||/^[#.@*<]/.test(r[0].value))){let o=r.findIndex((u,s)=>s>0&&(u.normalized??u.value).toLowerCase()==="in");o>0&&(r=r.slice(0,o));}if(r.length===1)return this.tokenToSemanticValue(r[0]);let n=r.map(o=>o.value).join(""),a=r[0];return a.kind==="selector"||a.value.startsWith("#")||a.value.startsWith(".")||a.value.startsWith("@")||a.value.startsWith("*")?Ce(n):a.kind==="literal"||a.value.startsWith('"')||a.value.startsWith("'")?q(xr(n),"string"):a.kind==="reference"?ue(n):q(this.joinTokenText(r,t))}tokenToSemanticValue(e){let t=e.value;if(e.kind==="selector"||t.startsWith("#")||t.startsWith(".")||t.startsWith("@")||t.startsWith("*"))return Ce(t);if(t.startsWith('"')||t.startsWith("'"))return q(xr(t),"string");if(/^-?\d+(\.\d+)?$/.test(t))return q(parseFloat(t));if(t==="true"||t==="\u771F"||t==="\uCC38"||t==="do\u011Fru")return q(true);if(t==="false"||t==="\u507D"||t==="\uAC70\uC9D3"||t==="yanl\u0131\u015F")return q(false);if(t.length>1&&(t.startsWith(":")||t.startsWith("$")))return ue(t);let r=e.normalized?.toLowerCase();return r==="me"||r==="it"||r==="you"||r==="result"||r==="body"?ue(r):e.kind==="reference"?ue(e.normalized||"me"):q(t)}parseBodyWithGrammarPatterns(e,t,r,n){let a=[],o=[],u=false,s=()=>{if(!u&&o.length>0){let p=this.parseSOVClauseByVerbAnchoring(o,n);a.push(...p),p.length===0&&this.recordDroppedTokens(o,n,"fused body walk");}else o.length>0&&this.recordDroppedTokens(o,n,"fused body walk");o=[],u=false;},l=0,c=()=>{let p=0;for(let d of a){let m=d;(m.action==="for"||m.action==="repeat"||m.action==="while")&&(!Array.isArray(m.body)||m.body.length===0)&&p++;}return p-l};for(;!e.isAtEnd();){let p=e.peek();if(p&&this.isThenKeyword(p.value,n)){s(),e.advance();continue}if(p&&this.isEndKeyword(p.value,n)){let m=e.peek(-1),y=e.peek(1);if(!dr(n,p.value,m?.value,y?.value)){if(s(),c()>0){l++,e.advance();continue}e.advance();break}}if(p&&!u&&this.isIfKeyword((p.normalized??p.value).toLowerCase(),n)){s();let m=this.tryParseConditionalBlock(e,t,n);if(m){a.push(m),u=true;continue}}let d=false;if(r.length>0){let m=oe.matchBest(e,r);if(m){let y=m.pattern.command,E={};for(let[h,b]of m.captured)h!=="event"&&h!=="action"&&h!=="continues"&&(E[h]=b);let v=ne(y,E,{sourceLanguage:n,patternId:m.pattern.id});a.push(v),d=true,u=true;let f=m.captured.get("continues");if(f&&f.type==="literal"&&f.value==="then")continue}}if(!d){let m=e.mark(),y=oe.matchBest(e,t);if(y){if(y.pattern.command==="if"){let v=e.mark();for(e.reset(m);!e.isAtEnd();){let h=e.peek();if(!h||this.isIfKeyword((h.normalized??h.value).toLowerCase(),n))break;e.advance();}let f=this.tryParseConditionalBlock(e,t,n);if(f){s(),a.push(f),u=true;continue}e.reset(v);}let E=this.buildCommand(y,n);a.push(E),this.tryAttachTrailingRole(e,E,n),d=true,u=true;}}d||(p&&o.push(p),e.advance());}s(),e.isAtEnd()||this.recordDroppedTokens(e.tokens.slice(e.position()),n,"fused body walk");for(let p=a.length-1;p>=0;p--){let d=a[p];d.kind==="command"&&d.action==="for"&&(!(d.roles instanceof Map)||d.roles.size===0)&&(!Array.isArray(d.body)||d.body.length===0)&&a.splice(p,1);}return a}tryCompoundCommandParsing(e,t,r){let n=e.tokens,a=n.some(c=>c.kind==="conjunction"||c.kind==="keyword"&&this.isThenKeyword(c.value,r)),o=n.some(c=>this.isElseKeyword(c.value,r));if(!a&&!o)return null;let u=new ae(n,r),s=this.coverageMark(),l=this.parseBodyWithClauses(u,t,r);return l.length===0?(this.coverageRollback(s),null):l[0]}matchEventMarkerPhrase(e,t,r){let n=T.SOV_EVENT_MARKER_PHRASES[r];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 r=T.SOV_EVENT_MARKERS[t];if(r===void 0)return false;let{tokens:n}=U(e,t),a=ge[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&&(T.KNOWN_EVENTS.has(c)||_e.has(c))||T.KNOWN_EVENTS.has(l)||_e.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")&&r.has(m.value)||this.matchEventMarkerPhrase(n,u+1+d,t)>0)return true}return false}matchEventParamPhrase(e,t){if(e[t]?.value!=="(")return {len:0,names:[]};let r=[];for(let n=t+1;n<e.length;n++){let a=e[n].value;if(a===")")return {len:n-t+1,names:r};if(a!==","){if(e[n].kind!=="identifier")break;r.push(a);}}return {len:0,names:[]}}isStrippableSourceRef(e,t){if(!e)return false;let r=e.normalized?.toLowerCase();if(e.kind==="keyword"&&(r==="me"||r==="i"||r==="it"))return true;let n=e.value.toLowerCase();return t.has(n)||!!r&&t.has(r)}tryTrailingEventExtraction(e,t,r){let n=U(e,t).tokens;if(n.length<3)return null;let a=ge[t],o=new Set;if(a)for(let x of Object.keys(a))o.add(x.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&&T.KNOWN_EVENTS.has(d)||T.KNOWN_EVENTS.has(p)||o.has(p)))return null;let y=d&&T.KNOWN_EVENTS.has(d)?d:a?.[p]??p,E=n.slice(0,u);if(E.length===0)return null;let v=r.filter(x=>x.command!=="on"),f=new ae(E,t),h=this.coverageMark(),b=this.parseBodyWithClauses(f,v,t);return b.length===0?(this.coverageRollback(h),null):Ke({type:"literal",value:y},b,void 0,{sourceLanguage:t,confidence:.75})}tryMidStreamEventExtraction(e,t,r){let n=U(e,t).tokens;if(n.length<3)return null;let a=ge[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&&T.KNOWN_EVENTS.has(d)||T.KNOWN_EVENTS.has(p)||o.has(p)))continue;let y=d&&T.KNOWN_EVENTS.has(d)?d:a?.[p]??p,E=n.filter((x,A)=>A!==u&&A!==u+1);if(E.length===0)return null;let v=r.filter(x=>x.command!=="on"),f=new ae(E,t),h=this.coverageMark(),b=this.parseBodyWithClauses(f,v,t);return b.length===0?(this.coverageRollback(h),null):Ke({type:"literal",value:y},b,void 0,{sourceLanguage:t,confidence:.75})}return null}trySOVEventExtraction(e,t,r){let n=T.SOV_EVENT_MARKERS[t];if(!n)return null;let o=U(e,t).tokens,u=ge[t],s=new Set;if(u)for(let k of Object.keys(u))s.add(k.toLowerCase());let l=T.SOV_SOURCE_MARKERS[t],c=-1,p="",d="",m=1,y=[];for(let k=0;k<o.length;k++){let g=o[k],C=g.value.toLowerCase(),w=C,z="",D=C.indexOf("[");D>0&&(w=C.slice(0,D),z=g.value.slice(D));let S=g.normalized?.toLowerCase(),R=S&&(T.KNOWN_EVENTS.has(S)||_e.has(S)),P=s.has(C)||s.has(w),O=T.KNOWN_EVENTS.has(w)||_e.has(w);if(R||P||O){let _=o[k-1];if(_&&(_.normalized??_.value).toLowerCase()==="event")continue;let L;R?L=S:P?L=u?.[C]??u?.[w]??w:L=w;let W=this.matchEventParamPhrase(o,k+1);if(n.size>0){let G=1+W.len,ve=o[k+G];ve&&ve.kind==="selector"&&ve.value.startsWith("[")&&(G+=1);let se=o[k+G];if(se&&(se.kind==="particle"||se.kind==="keyword")&&n.has(se.value)){c=k,p=L,d=z||(G===W.len+2?o[k+G-1].value:""),m=G+1,y=W.names;break}}else {c=k,p=L,d=z,m=1+W.len+this.matchEventMarkerPhrase(o,k+1+W.len,t),y=W.names;break}}}if(c===-1){let k=new Set(r.filter(g=>g.command!=="on").map(g=>g.command));for(let g=0;g<o.length;g++){let C=o[g];if(C.kind==="identifier")if(n.size>0){let w=1,z=o[g+1];z&&z.kind==="selector"&&z.value.startsWith("[")&&(w=2);let D=o[g+w];if(D&&(D.kind==="particle"||D.kind==="keyword")&&n.has(D.value)){c=g,p=C.value,d=w===2?o[g+1].value:"",m=w+1;break}}else {let w=this.matchEventMarkerPhrase(o,g+1,t);if(w>0){c=g,p=C.value,d="",m=1+w;break}let z=o[g+1];if(z&&z.kind==="keyword"&&z.normalized!=null&&k.has(z.normalized)){c=g,p=C.value,d="",m=1;break}}}}if(c===-1)return null;let E=new Set;for(let k=c;k<c+m;k++)E.add(k);if(l){let k=c+m;if(k<o.length){let g=o[k];if((g.kind==="particle"||g.kind==="keyword")&&l.markers.has(g.value))E.add(k);else if(this.isStrippableSourceRef(g,l.windowTokens)){let C=o[k+1];C&&(C.kind==="particle"||C.kind==="keyword")&&l.markers.has(C.value)&&(E.add(k),E.add(k+1));}}if(c>=2){let g=o[c-1];(g.kind==="particle"||g.kind==="keyword")&&l.markers.has(g.value)&&this.isStrippableSourceRef(o[c-2],l.windowTokens)&&(E.add(c-2),E.add(c-1));}for(let g=0;g<c;g++){let C=o[g],w=C.value.toLowerCase(),z=C.normalized?.toLowerCase();if(l.windowTokens.has(w)||z&&l.windowTokens.has(z)){E.add(g);break}}}let v=o.filter((k,g)=>!E.has(g));if(v.length===0)return null;let f=r.filter(k=>k.command!=="on"),h=new ae(v,t),b=this.coverageMark(),x=this.parseBodyWithClauses(h,f,t);if(x.length===0)return this.coverageRollback(b),null;let A={sourceLanguage:t,confidence:.75};return d&&(A.keyFilter=d),Ke({type:"literal",value:p},x,void 0,A,y)}profileKeywordMatches(e,t,r){let n=I(e)?.keywords?.[t];return n?n.primary?.toLowerCase()===r?true:!!n.alternatives?.some(a=>a.toLowerCase()===r):false}consumeForPostposition(e,t){let r=e.peek();if(!r)return;let n=(r.normalized??"").toLowerCase(),a=I(t)?.keywords?.for;(n==="for"||r.value===a?.primary||(a?.alternatives??[]).includes(r.value))&&e.advance();}isThenKeyword(e,t){let r=e.toLowerCase(),a={en:new Set(["then"]),ja:new Set(["\u305D\u308C\u304B\u3089","\u6B21\u306B","\u305D\u3057\u3066"]),ar:new Set(["\u062B\u0645","\u0628\u0639\u062F\u0647\u0627","\u062B\u0645\u0651"]),es:new Set(["entonces","luego","despu\xE9s"]),ko:new Set(["\uADF8\uB2E4\uC74C","\uADF8\uB9AC\uACE0","\uADF8\uB7F0\uD6C4","\uADF8\uB7EC\uBA74"]),zh:new Set(["\u7136\u540E","\u63A5\u7740","\u90A3\u4E48"]),tr:new Set(["ard\u0131ndan","daha sonra","ardindan"]),pt:new Set(["ent\xE3o","depois","logo"]),fr:new Set(["puis","ensuite","alors"]),de:new Set(["dann","danach","anschlie\xDFend"]),id:new Set(["lalu","kemudian","setelah itu"]),tl:new Set(["pagkatapos","tapos"]),bn:new Set(["\u09A4\u09BE\u09B0\u09AA\u09B0"]),qu:new Set(["chaymantataq","hinaspa","chaymanta","chayqa"]),sw:new Set(["kisha","halafu","baadaye"])}[t];return a?a.has(r):r==="then"||this.profileKeywordMatches(t,"then",r)}isElseKeyword(e,t){let r=e.toLowerCase();return r==="else"?true:this.profileKeywordMatches(t,"else",r)}isEndKeyword(e,t){let r=e.toLowerCase(),n=Mo(t);return n?r==="end"||n.has(r):r==="end"||this.profileKeywordMatches(t,"end",r)}isJsKeyword(e){let t=(e.normalized??e.value).toLowerCase();return t==="js"||this.profileKeywordMatches("en","js",t)}consumeJsBlock(e,t){let r=e.peek();if(!r||!this.isJsKeyword(r))return null;let n=e.mark(),a=[];e.advance();let o=e.peek();o&&r.position?.end!==void 0&&r.position.end===o.position?.start&&this.profileKeywordMatches(t,"js",`${r.value}${o.value}`.toLowerCase())&&e.advance();let u=false;for(;!e.isAtEnd();){let l=e.peek();if(!l)break;if(e.advance(),this.isEndKeyword(l.value,t)){u=true;break}a.push(l);}if(!u)return e.reset(n),null;let s=a.map(l=>l.value).join(" ").trim();return ne("js",{patient:{type:"expression",raw:s||"()"}},{sourceLanguage:t,patternId:`js-opaque-${t}`,confidence:1})}isIfKeyword(e,t){let r=e.toLowerCase();return r==="if"?true:this.profileKeywordMatches(t,"if",r)}isUnlessKeyword(e,t){let r=e.toLowerCase();return r==="unless"?true:this.profileKeywordMatches(t,"unless",r)}isBlockEndToken(e,t,r){return this.isEndKeyword(e.value,r)?true:e.kind!=="keyword"||(e.normalized??"").toLowerCase()!=="end"?false:!(t&&t.kind==="selector")}tryParseConditionalBlock(e,t,r){let n=e.peek();if(!n)return null;let a=(n.normalized??n.value).toLowerCase();if(!this.isIfKeyword(a,r))return null;let o=e.mark(),u=this.coverageMark();e.advance();let s=[],l=0;for(;!e.isAtEnd();){let g=e.peek();if(!g)break;let C=(g.normalized??g.value).toLowerCase();if(this.isIfKeyword(C,r)||this.isUnlessKeyword(C,r)){l++,s.push(g),e.advance();continue}if(this.isBlockEndToken(g,e.peek(1)??void 0,r)){if(l===0){e.advance();break}l--,s.push(g),e.advance();continue}s.push(g),e.advance();}if(s.length===0)return e.reset(o),this.coverageRollback(u),null;let c=I(r),p=c?.wordOrder==="SOV"?T.buildVerbLookup(c):null,d=0,m=0,y=[];for(;d<s.length;d++){let g=s[d],C=(g.normalized??g.value).toLowerCase();if(this.isIfKeyword(C,r)||this.isUnlessKeyword(C,r)?m++:this.isBlockEndToken(g,s[d+1],r)&&m--,m===0&&this.isThenKeyword(g.value,r)){d++;break}if(m===0&&y.length>0){let w=(s[d-1].normalized??s[d-1].value).toLowerCase(),z=s[d-1].value.toLowerCase(),D=(g.normalized??g.value).toLowerCase(),S=T.CONDITION_COPULAS.has(w)||T.CONDITION_COPULAS_SURFACE.has(z)&&T.CONDITION_PREDICATES.has(D),R=p!==null&&p.has(g.value.toLowerCase())&&!T.CONDITION_PREDICATES.has(D),P=/^\.[a-zA-Z_]\w*$/.test(g.value)&&s[d-1].position?.end!==void 0&&g.position?.start!==void 0&&s[d-1].position.end===g.position.start;if(!T.CONDITION_OPERATORS.has(D)&&!P&&(!S||R)&&(this.tokensBeginCommand(s.slice(d),t,r)||this.sovCommandStartsAt(s.slice(d),p)))break}y.push(g);}if(y.length===0)return e.reset(o),this.coverageRollback(u),null;let v=[],f=[],h=false,b=0;for(;d<s.length;d++){let g=s[d],C=(g.normalized??g.value).toLowerCase();if(this.isIfKeyword(C,r)||this.isUnlessKeyword(C,r)?b++:this.isBlockEndToken(g,s[d+1],r)&&b--,b===0&&!h&&this.isElseKeyword(g.value,r)){h=true;continue}(h?f:v).push(g);}let x={type:"expression",raw:this.joinTokenText(y,r)},A=this.parseBranch(v,t,r),k=f.length>0?this.parseBranch(f,t,r):void 0;return A.length===0&&(!k||k.length===0)?(e.reset(o),this.coverageRollback(u),null):go(x,A,k,{sourceLanguage:r,patternId:`conditional-${r}-folded`,confidence:1})}joinTokenText(e,t){return Bt(e,I(t))}tokensBeginCommand(e,t,r){if(e.length===0)return false;let n=new ae(e,r);return oe.matchBest(n,t)!==null}sovCommandStartsAt(e,t){if(!t)return false;let r=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&&r(l))return true}return false}parseBranch(e,t,r){if(e.length===0)return [];let n=new ae(e,r),a=this.parseBodyWithClauses(n,t,r);return a.length===1&&a[0]?.kind==="compound"?a[0].statements:a}extractStandaloneModifiers(e,t){let n=U(e,t).tokens;if(n.length===0)return {modifiers:null,remainingInput:null};let o=n[0].value.toLowerCase(),u=T.STANDALONE_MODIFIERS[o];if(!u)return {modifiers:null,remainingInput:null};let s={},l=1;if(u==="once")s.once=true;else {let m=1;if(m<n.length){let y=n[m],E=n[m+1],v=y.kind==="identifier"&&E?.kind==="literal"&&/^\d+(ms|s|m)?$/.test(E.value);(y.kind==="keyword"||y.kind==="particle"||v)&&(m++,l++);}if(m<n.length){let y=n[m];if(y.kind==="literal"){let E=y.value.match(/^(\d+)(ms|s|m)?$/);if(E){let v=parseInt(E[1],10),f=E[2]||"ms";f==="s"?v*=1e3:f==="m"&&(v*=6e4),s[u]=v,l=m+1;}}}s[u]||(s[u]=u==="debounce"?300:100);}let c=n.slice(l);if(c.length===0)return {modifiers:null,remainingInput:null};let p=c[0].position.start,d=e.slice(p);return {modifiers:s,remainingInput:d}}stripAsyncModifier(e,t){let r=I(t)?.keywords?.async,n=new Set(["async"]);r?.primary&&n.add(r.primary.toLowerCase()),r?.alternatives?.forEach(l=>n.add(l.toLowerCase()));let a=U(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 r=U(e,t).tokens;for(let n=0;n<r.length-1;n++){if(r[n].value.toLowerCase()!=="do")continue;let a=-1;for(let l=n+1;l<=n+5&&l<r.length;l++){let c=r[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=r[n].position.start,u=r[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,r)=>t+(parseInt(/left (\d+) token/.exec(r.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(r=>{if(r.code!=="unconsumed-input")return true;let n=/unconsumed: "(.*)"$/.exec(r.message)?.[1];return !n||n.replace(/\s+/g," ").trim()!==t})}}reclaimDanglingFromTail(e,t,r){let n=T.droppedTokenCount,a=T.unconsumedSpans(e);if(a.length===0)return null;let o=n(e),u=I(r)?.roleMarkers?.source,s=new Set;u?.primary&&s.add(u.primary),u?.alternatives?.forEach(c=>s.add(c));let l=U(t,r).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 y=Math.min(p.position.start,m.position.start),E=Math.max(p.position.end,m.position.end),v=t.slice(y,E).replace(/\s+/g," ").trim();if(!a.some(h=>h===v||h.includes(v)))continue;let f=(t.slice(0,y).trimEnd()+" "+t.slice(E).trimStart()).trim();if(!(!f||f===t))try{let h=this.parse(f,r);if(!h||h.kind!=="event-handler")continue;let b=At(h);if(n(b)<o)return {node:{...b,eventModifiers:{...b.eventModifiers,from:{type:"literal",value:m.value,dataType:"string"}}},input:f}}catch{}}return null}reclaimEventCompoundTail(e,t,r){let n=T.unconsumedSpans(e);if(n.length===0)return null;let a=ge[r];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=U(t,r).tokens;for(let p of n)for(let d=1;d<c.length;d++)for(let m=d;m<c.length;m++){let y=l(t.slice(c[d].position.start,c[m].position.end));if(y.length>p.length)break;if(y!==p)continue;let E=c[d-1];if((a[E.value]??E.normalized)!==s)break;let f=l(t.slice(E.position.start,c[m].position.end)),h=a[f];if(!h)break;return o.set("event",{type:"literal",value:h,dataType:"string"}),{node:T.withoutSpanDiagnostics(e,p),input:t}}return null}reclaimResponseTypeTail(e,t,r){let n=T.unconsumedSpans(e);if(n.length===0)return null;let a=T.AS_MARKERS_BEFORE[r];if(!a)return null;let o=l=>l.replace(/\s+/g," ").trim(),u=T.droppedTokenCount(e),s=U(t,r).tokens;for(let l=0;l+1<s.length;l++){let c=s[l],p=s[l+1];if(!a.some(y=>c.value.toLowerCase()===y)||!T.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 y=this.parse(m,r);if(!y||y.kind!=="event-handler")continue;let E=At(y);if(T.droppedTokenCount(E)>=u)continue;let v=T.findResponseTypeTarget(E);if(!v)continue;return v.roles.set("responseType",{type:"expression",raw:p.value}),{node:E,input:m}}catch{}}return null}static findResponseTypeTarget(e){let t=null,r=n=>{if(!n||typeof n!="object"||t)return;if(n.kind==="command"){let o=n;if(ee(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=>r(s));}};return r(e),t}reclaimCapturedDestinationTail(e,t,r){let n=T.unconsumedSpans(e);if(n.length===0)return null;let a=I(r)?.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=U(t,r).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 y=u(t.slice(c.position.start,p.position.end));if(!n.includes(y))continue;let E=false,v=f=>{if(!f||typeof f!="object"||E)return;if(f.kind==="command"){let b=f.roles.get("destination");if(b?.type==="reference"&&b.value==="me"){E=true;return}}let h=f;for(let b of ["body","statements","thenBranch","elseBranch","commands"]){let x=h[b];Array.isArray(x)&&x.forEach(A=>v(A));}};if(v(e),!!E)return {node:T.withoutSpanDiagnostics(e,y),input:t}}return null}applyModifiers(e,t){return {...e,eventModifiers:{...e.eventModifiers,...t}}}extractOrConjunctionEvents(e,t){let r=[];for(;;){let n=e.mark(),a=e.peek();if(!a)break;let o=(a.normalized||a.value).toLowerCase();if(!T.OR_KEYWORDS.has(o)){e.reset(n);break}e.advance();let u=e.peek();if(!u){e.reset(n);break}let s=(u.normalized||u.value).toLowerCase();e.advance(),r.push({type:"literal",value:s});}return r}};X.coverageMarkerSurfaces=new Map;X.LEAKED_RENDER_MARKERS={hi:["\u0915\u0947","\u0930\u0942\u092A","\u092E\u0947\u0902"],tr:["olarak"],qu:["hina"]};X.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"]};X.AS_MARKERS_AFTER={ko:[["\uB85C"],["\uC73C\uB85C"]],qu:[["hina"]],tr:[["olarak"]],hi:[["\u0915\u0947","\u0930\u0942\u092A","\u092E\u0947\u0902"]]};X.KNOWN_EVENTS=new Set(["click","dblclick","input","change","submit","keydown","keyup","keypress","mouseover","mouseout","mousedown","mouseup","focus","blur","load","scroll","resize","contextmenu"]);X.RESPONSE_TYPE_WORDS=new Set(["json","text","html","xml","blob","arraybuffer","formdata","response"]);X.SOV_EVENT_MARKERS={ja:new Set(["\u3067"]),ko:new Set,tr:new Set(["de","da","te","ta"]),bn:new Set(["\u098F"]),qu:new Set(["pi"]),hi:new Set(["\u092A\u0930"])};X.SOV_EVENT_MARKER_PHRASES={ko:[["\uD560","\uB54C"],["\uD560\uB54C"]]};X.SOV_SOURCE_MARKERS={ja:{markers:new Set(["\u304B\u3089"]),windowTokens:new Set(["\u30A6\u30A3\u30F3\u30C9\u30A6","\u30C9\u30AD\u30E5\u30E1\u30F3\u30C8","window","document"])},ko:{markers:new Set(["\uC5D0\uC11C"]),windowTokens:new Set(["\uCC3D","\uC708\uB3C4\uC6B0","\uBB38\uC11C","window","document"])},tr:{markers:new Set(["den","dan","ten","tan"]),windowTokens:new Set(["pencere","belge","window","document"])},bn:{markers:new Set(["\u09A5\u09C7\u0995\u09C7","\u09AE\u09A7\u09CD\u09AF\u09C7"]),windowTokens:new Set(["\u0989\u0987\u09A8\u09CD\u09A1\u09CB","\u09A1\u0995\u09C1\u09AE\u09C7\u09A8\u09CD\u099F","window","document"])},qu:{markers:new Set(["manta"]),windowTokens:new Set(["k_iri","ventana","window","document"])},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"])}};X.CONDITION_COPULAS=new Set(["is","am","are","be","was","were","not","no"]);X.CONDITION_COPULAS_SURFACE=new Set(["\u0647\u0648","\u0E40\u0E1B\u0E47\u0E19","\u0939\u0948"]);X.CONDITION_PREDICATES=new Set(["empty","null","undefined"]);X.CONDITION_OPERATORS=new Set(["matches","match","contains","exists","has","have","equals","includes"]);X.STANDALONE_MODIFIERS={once:"once",debounced:"debounce",debounce:"debounce",throttled:"throttle",throttle:"throttle"};X.OR_KEYWORDS=new Set(["or","\u0623\u0648","o","ou","oder","atau","atau","\u6216","\u307E\u305F\u306F","\uB610\uB294","veya","\u0985\u09A5\u09AC\u09BE","utaq","au","\u0430\u0431\u043E","\u0438\u043B\u0438","ho\u1EB7c","lub","\u05D0\u05D5","\u0E2B\u0E23\u0E37\u0E2D","o","\u092F\u093E","\u0985\u09A5\u09AC\u09BE"]);var Su=X,Tu=new Su;function Bu(i,e){return Tu.parse(i,e)}function Fu(i,e){try{let t=U(i,e),r=de(e);if(r.length===0)return {confidence:0,parseSuccess:!1,error:`No patterns available for language: ${e}`};let n=[...r].sort((l,c)=>c.priority-l.priority),a=n.filter(l=>l.command==="on"),o=oe.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=oe.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: ${i}`}}catch(t){return {confidence:0,parseSuccess:false,error:t instanceof Error?t.message:String(t)}}}function ni(i,e){try{let r=Bu(i,e);if(r)return {node:r,confidence:r.metadata?.confidence??.8,error:void 0,tokensConsumed:U(i,e).tokens.length}}catch{}let t=Fu(i,e);return t.parseSuccess?{node:null,confidence:t.confidence,error:void 0,tokensConsumed:t.tokensConsumed}:{node:null,confidence:0,error:t.error}}function oi(i,e){let t=e==="SOV"?"sovPosition":"svoPosition";return [...i].sort((r,n)=>{let a=r[t]??99,o=n[t]??99;return a-o})}function Ze(i,e){let t,r;if(i.markerOverride&&i.markerOverride[e.code]!==void 0)t=i.markerOverride[e.code],r=t?ye(i,e.code,t):void 0;else {let n=e.roleMarkers[i.role];if(n){t=n.primary;let a=ye(i,e.code,t)??[],o=[...new Set([...n.alternatives??[],...a])].filter(u=>u!==t);r=o.length?o:void 0;}}return {marker:t,alternatives:r}}function Qe(i,e,t){t.roles.find(n=>n.role==="scope"&&!n.required)&&(i.push({type:"group",optional:true,tokens:[{type:"literal",value:"on"},{type:"role",role:"scope",optional:true,expectedTypes:["selector","reference"]}]}),e.scope={fromRole:"scope"});}function Mt(i,e,t,r){si(i,e,t,r,"manner",{requireMarker:true});}function ui(i,e,t,r){si(i,e,t,r,"recipient",{requireMarker:false});}function si(i,e,t,r,n,a){let o=t.roles.find(s=>s.role===n&&!s.required);if(!o)return;let u=o.markerOverride?.[r];a.requireMarker&&!u||(i.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 Pu(i,e,t,r,n){let a=[];if(a.push({type:"role",role:"event",optional:false}),r.position==="after"){let l=r.primary.split(/\s+/);if(l.length>1)for(let c of l)a.push({type:"literal",value:c});else {let c=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};a.push(c);}}let o=e.roleMarkers.destination;o&&a.push({type:"group",optional:true,tokens:[{type:"role",role:"destination",optional:true},o.alternatives?{type:"literal",value:o.primary,alternatives:o.alternatives}:{type:"literal",value:o.primary}]}),a.push({type:"role",role:"patient",optional:false});let u=e.roleMarkers.patient;if(u){let l=u.alternatives?{type:"literal",value:u.primary,alternatives:u.alternatives}:{type:"literal",value:u.primary};a.push(l);}let s=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};return a.push(s),a.push(...Se(i,e.roleMarkers.source)),a.push(...Pt(i,e.roleMarkers.destination)),{id:`${i.action}-event-${e.code}-sov`,language:e.code,command:"on",priority:(n.basePriority??100)+50,template:{format:`{event} ${r.primary} {destination?} {patient} ${u?.primary||""} ${t.primary}`,tokens:a},extraction:{action:{value:i.action},event:{fromRole:"event"},patient:{fromRole:"patient"},...xe(i),...De(i)}}}function Ru(i,e,t,r,n){let a=[],o=i.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}),r.position==="after"){let d=r.primary.split(/\s+/);if(d.length>1)for(let m of d)a.push({type:"literal",value:m});else {let m=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.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(...Se(i,e.roleMarkers.source));let c=e.roleMarkers.destination;if(o&&c){let d=i.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?ka(i,c):Pt(i,c));let p={action:{value:i.action},event:{fromRole:"event"},[u]:{fromRole:u},...o?{}:xe(i),...De(i)};return ui(a,p,i,e.code),Mt(a,p,i,e.code),{id:`${i.action}-event-${e.code}-sov-patient-first`,language:e.code,command:"on",priority:(n.basePriority??100)+45,template:{format:`{patient} ${s?.primary||""} {event} ${r.primary} ${t.primary}`,tokens:a},extraction:p}}function Ou(i,e,t,r,n){let a=i.roles.find(p=>p.role==="source");if(!a)return null;let{marker:o,alternatives:u}=Ze(a,e),s=e.roleMarkers.patient;if(!o||o===r.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}),r.position==="after"){let p=r.primary.split(/\s+/);if(p.length>1)for(let d of p)l.push({type:"literal",value:d});else l.push(r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary});}l.push(t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary});let c={action:{value:i.action},event:{fromRole:"event"},patient:{fromRole:"patient"},source:{fromRole:"source"}};return ui(l,c,i,e.code),Mt(l,c,i,e.code),{id:`${i.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} ${r.primary} ${t.primary}`,tokens:l},extraction:c}}function _u(i,e,t,r,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}),r.position==="after"){let l=r.primary.split(/\s+/);if(l.length>1)for(let c of l)a.push({type:"literal",value:c});else {let c=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.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:`${i.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} ${r.primary} ${t.primary}`,tokens:a},extraction:{action:{value:i.action},event:{fromRole:"event"},patient:{fromRole:"patient"},destination:{fromRole:"destination"}}}}function Nu(i,e,t,r,n){let a=[];a.push({type:"role",role:"event",optional:false});let o=r.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(...Se(i,e.roleMarkers.source)),a.push(...Pt(i,e.roleMarkers.destination)),{id:`${i.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:i.action},event:{fromRole:"event"},patient:{fromRole:"patient"},...xe(i),...De(i)}}}function Iu(i,e,t,r,n){let a=[];if(a.push({type:"role",role:"event",optional:false}),r.position==="after"){let u=r.primary.split(/\s+/);if(u.length>1)for(let s of u)a.push({type:"literal",value:s});else {let s=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.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:`${i.action}-event-${e.code}-sov-simple`,language:e.code,command:"on",priority:(n.basePriority??100)+48,template:{format:`{event} ${r.primary} ${t.primary}`,tokens:a},extraction:{action:{value:i.action},event:{fromRole:"event"},patient:{default:{type:"reference",value:"me"}}}}}function Lu(i,e,t,r){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:`${i.action}-event-${e.code}-sov-temporal`,language:e.code,command:"on",priority:(r.basePriority??100)+49,template:{format:`{event} ${n[0]} {patient} ${t.primary}`,tokens:a},extraction:{action:{value:i.action},event:{fromRole:"event"},patient:{fromRole:"patient"}}}}function Mu(i,e,t,r,n){let a=[];if(a.push({type:"role",role:"event",optional:false}),r.position==="after"){let p=r.primary.split(/\s+/);if(p.length>1)for(let d of p)a.push({type:"literal",value:d});else {let d=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};a.push(d);}}let u=[...i.roles.filter(p=>p.required)].sort((p,d)=>{let m=p.sovPosition??999,y=d.sovPosition??999;return m-y});for(let p of u){a.push({type:"role",role:p.role,optional:false});let{marker:d,alternatives:m}=Ze(p,e);if(d){let y=m?{type:"literal",value:d,alternatives:m}:{type:"literal",value:d};a.push(y);}}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:i.action},event:{fromRole:"event"},...Object.fromEntries(u.map(p=>[p.role,{fromRole:p.role}]))};return Qe(a,c,i),{id:`${i.action}-event-${e.code}-sov-2role`,language:e.code,command:"on",priority:(n.basePriority??100)+55,template:{format:`{event} ${r.primary} ${l} ${t.primary}`,tokens:a},extraction:c}}function $u(i,e,t,r,n){let a=[],u=[...i.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}=Ze(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}),r.position==="after"){let c=r.primary.split(/\s+/);if(c.length>1)for(let p of c)a.push({type:"literal",value:p});else a.push(r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary});}let s=u.map(c=>`{${c.role}}`).join(" "),l={action:{value:i.action},event:{fromRole:"event"},...Object.fromEntries(u.map(c=>[c.role,{fromRole:c.role}]))};return Qe(a,l,i),{id:`${i.action}-event-${e.code}-sov-2role-event-last`,language:e.code,command:"on",priority:(n.basePriority??100)+40,template:{format:`${s} ${t.primary} {event} ${r.primary}`,tokens:a},extraction:l}}function qu(i,e,t,r,n){let a=[],u=[...i.roles.filter(v=>v.required)].sort((v,f)=>{let h=v.sovPosition??999,b=f.sovPosition??999;return h-b}),s=u[0];a.push({type:"role",role:s.role,optional:false});let{marker:l,alternatives:c}=Ze(s,e);if(l){let v=c?{type:"literal",value:l,alternatives:c}:{type:"literal",value:l};a.push(v);}if(a.push({type:"role",role:"event",optional:false}),r.position==="after"){let v=r.primary.split(/\s+/);if(v.length>1)for(let f of v)a.push({type:"literal",value:f});else {let f=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};a.push(f);}}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:y}=Ze(d,e);if(m){let v=y?{type:"literal",value:m,alternatives:y}:{type:"literal",value:m};a.push(v);}let E={action:{value:i.action},event:{fromRole:"event"},[s.role]:{fromRole:s.role},[d.role]:{fromRole:d.role}};return Qe(a,E,i),{id:`${i.action}-event-${e.code}-sov-2role-dest-first`,language:e.code,command:"on",priority:(n.basePriority??100)+48,template:{format:`{${s.role}} {event} ${r.primary} ${t.primary} {${d.role}}`,tokens:a},extraction:E}}function li(i,e,t){let r=ye(i,e.code,t.primary)??[],n=[...new Set([...t.alternatives??[],...r])].filter(a=>a!==t.primary);return n.length?n:void 0}function Dr(i,e,t,r,n){let a=[];if(r.position==="before"){let s=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};a.push(s);}a.push({type:"role",role:"event",optional:false});let o=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};a.push(o),a.push({type:"role",role:"patient",optional:false});let 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(...Se(i,e.roleMarkers.source)),{id:`${i.action}-event-${e.code}-vso`,language:e.code,command:"on",priority:(n.basePriority??100)+50,template:{format:`${r.primary} {event} ${t.primary} {patient} ${u?.primary||""} {destination?}`,tokens:a},extraction:{action:{value:i.action},event:{fromRole:"event"},patient:{fromRole:"patient"},...xe(i),...De(i)}}}function ju(i,e,t,r,n){let a=[],o=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};a.push(o);let u=i.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(...Se(i,e.roleMarkers.source)),r.position==="before"){let c=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};a.push(c);}if(a.push({type:"role",role:"event",optional:false}),u){let c=i.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:i.action},event:{fromRole:"event"},[u?"destination":"patient"]:{fromRole:u?"destination":"patient"},...u?{}:xe(i),...De(i)};return Mt(a,l,i,e.code),{id:`${i.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?} ${r.primary} {event}`,tokens:a},extraction:l}}function Vu(i,e,t,r,n){let a=[],o=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};a.push(o);let s=[...i.roles.filter(p=>p.required)].sort((p,d)=>{let m=p.svoPosition??999,y=d.svoPosition??999;return m-y});for(let p of s){let d,m;if(p.markerOverride&&p.markerOverride[e.code]!==void 0)d=p.markerOverride[e.code],m=d?ye(p,e.code,d):void 0;else {let y=e.roleMarkers[p.role];y&&(d=y.primary,m=li(p,e,y));}if(d){let y=m?{type:"literal",value:d,alternatives:m}:{type:"literal",value:d};a.push(y);}a.push({type:"role",role:p.role,optional:false});}if(r.position==="before"){let p=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};a.push(p);}a.push({type:"role",role:"event",optional:false});let l=s.map(p=>`{${p.role}}`).join(" "),c={action:{value:i.action},event:{fromRole:"event"},...Object.fromEntries(s.map(p=>[p.role,{fromRole:p.role}]))};return Qe(a,c,i),{id:`${i.action}-event-${e.code}-vso-verb-first-2role`,language:e.code,command:"on",priority:(n.basePriority??100)+48,template:{format:`${t.primary} ${l} ${r.primary} {event}`,tokens:a},extraction:c}}function Sr(i,e,t,r,n){let a=[];if(r.position==="before"){let p=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.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=[...i.roles.filter(p=>p.required)].sort((p,d)=>{let m=p.svoPosition??999,y=d.svoPosition??999;return m-y});for(let p of s){let d,m;if(p.markerOverride&&p.markerOverride[e.code]!==void 0)d=p.markerOverride[e.code],m=d?ye(p,e.code,d):void 0;else {let y=e.roleMarkers[p.role];y&&(d=y.primary,m=li(p,e,y));}if(d){let y=m?{type:"literal",value:d,alternatives:m}:{type:"literal",value:d};a.push(y);}a.push({type:"role",role:p.role,optional:false});}let l=s.map(p=>`{${p.role}}`).join(" "),c={action:{value:i.action},event:{fromRole:"event"},...Object.fromEntries(s.map(p=>[p.role,{fromRole:p.role}]))};return Qe(a,c,i),{id:`${i.action}-event-${e.code}-vso-2role`,language:e.code,command:"on",priority:(n.basePriority??100)+55,template:{format:`${r.primary} {event} ${t.primary} ${l}`,tokens:a},extraction:c}}function Wu(i,e,t,r,n){let a=[],o=e.eventHandler?.negationMarker;if(r.position==="before"){let l=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.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(...Se(i,e.roleMarkers.source)),{id:`${i.action}-event-${e.code}-vso-negated`,language:e.code,command:"on",priority:(n.basePriority??100)+48,template:{format:`${r.primary} ${o?.primary||""} {event} ${t.primary} {patient} ${s?.primary||""} {destination?}`,tokens:a},extraction:{action:{value:i.action},event:{fromRole:"event"},patient:{fromRole:"patient"},...xe(i),...De(i)}}}function Hu(i,e,t,r){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(...Se(i,e.roleMarkers.source)),{id:`${i.action}-event-${e.code}-vso-proclitic`,language:e.code,command:"on",priority:(r.basePriority??100)+45,template:{format:`[proclitic?] {event} ${t.primary} {patient} ${o?.primary||""} {destination?}`,tokens:n},extraction:{action:{value:i.action},event:{fromRole:"event"},patient:{fromRole:"patient"},...xe(i),...De(i)}}}var $e={basePriority:100,generateSimpleVariants:true,generateAlternatives:true};function lt(i,e,t=$e){let r=`${i.action}-${e.code}-generated`,n=t.basePriority??100,a=e.keywords[i.action];if(!a)throw new Error(`No keyword translation for '${i.action}' in ${e.code}`);let o=Yu(i,e,a),u=$t(i,e),s=es(i,e,a);return {id:r,language:e.code,command:i.action,priority:n,template:{format:s,tokens:o},extraction:u}}function Ku(i,e,t=$e){if(i.roles.filter(u=>!u.required).length===0)return null;let n=i.roles.filter(u=>u.required),a={...i,roles:n};return {...lt(a,e,t),id:`${i.action}-${e.code}-generated-simple`,priority:(t.basePriority??100)-5,extraction:$t(i,e)}}function Tr(i,e,t=$e){if(e.wordOrder!=="SOV")return null;let r=i.roles.filter(u=>u.required);if(r.length!==1)return null;let n=e.keywords[i.action];if(!n)return null;let a=n.alternatives?{type:"literal",value:n.primary,alternatives:n.alternatives}:{type:"literal",value:n.primary},o=r.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:`${i.action}-${e.code}-generated-verb-first`,language:e.code,command:i.action,priority:(t.basePriority??100)-20,template:{format:`${n.primary} <${r[0].role}>`,tokens:[a,...o]},extraction:$t(i,e)}}function Uu(i,e,t=$e){let r=[];if(r.push(lt(i,e,t)),t.generateSimpleVariants){let n=Ku(i,e,t);n&&r.push(n);}for(let n of i.omitRoleVariants??[]){let a={...i,roles:i.roles.filter(u=>u.role!==n)},o=lt(a,e,t);r.push({...o,id:`${i.action}-${e.code}-generated-no-${n}`,priority:(t.basePriority??100)-8});}if(t.generateVerbFirstVariants!==false){let n=Tr(i,e,t);n&&r.push(n);}for(let n of i.rolePrefixLiteralVariants??[]){let a=n.literal[e.code];if(!a)continue;let{rolePrefixLiteralVariants:o,...u}=i,s={...u,roles:i.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=lt(s,e,t);if(r.push({...p,id:`${i.action}-${e.code}-generated-${n.idSuffix}`,priority:(t.basePriority??100)+l,extraction:{...p.extraction,...c}}),t.generateVerbFirstVariants!==false){let d=Tr(s,e,t);d&&r.push({...d,id:`${i.action}-${e.code}-generated-verb-first-${n.idSuffix}`,priority:(t.basePriority??100)-20+l,extraction:{...d.extraction,...c}});}}return r}function ci(i,e=$e){let t=[],r=$n();for(let n of r){if(!i.keywords[n.action])continue;let a=Uu(n,i,e);if(t.push(...a),i.eventHandler?.eventMarker){let o=Gu(n,i,e);t.push(...o);}}return t}function Gu(i,e,t=$e){if(!e.eventHandler||!e.eventHandler.eventMarker)return [];let r=[],n=e.eventHandler.eventMarker,a=e.keywords[i.action];if(!a)return [];if(i.roles.length===0)return [];let u=i.roles.filter(s=>s.required).length===2;if(e.wordOrder==="SOV")if(u)r.push(Mu(i,e,a,n,t)),r.push(qu(i,e,a,n,t)),r.push($u(i,e,a,n,t));else {r.push(Pu(i,e,a,n,t)),r.push(Ru(i,e,a,n,t));let s=Ou(i,e,a,n,t);s&&r.push(s);let l=e.roleMarkers.destination;l&&l.primary!==n.primary&&r.push(_u(i,e,a,n,t));let c=n.primary.split(/\s+/),p=n.alternatives?.some(m=>!m.includes(" ")&&m.length>1);c.length>1&&p&&r.push(Nu(i,e,a,n,t)),r.push(Iu(i,e,a,n,t));let d=Lu(i,e,a,t);d&&r.push(d);}else e.wordOrder==="VSO"?u?(r.push(Sr(i,e,a,n,t)),r.push(Vu(i,e,a,n,t))):(r.push(Dr(i,e,a,n,t)),r.push(ju(i,e,a,n,t)),e.eventHandler?.negationMarker&&r.push(Wu(i,e,a,n,t)),e.tokenization?.prefixes&&r.push(Hu(i,e,a,t))):u?r.push(Sr(i,e,a,n,t)):r.push(Dr(i,e,a,n,t));return r}function Yu(i,e,t){let r=[],n=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary},a=Xu(i,e);switch(e.wordOrder){case "SVO":r.push(n),r.push(...a);break;case "SOV":r.push(...a),r.push(n);break;case "VSO":r.push(n),r.push(...a);break;default:r.push(n),r.push(...a);}return Zu(r)}function Zu(i){let e=[];for(let t of i){let r=e[e.length-1];if(r&&r.type==="literal"&&t.type==="literal"&&r.value===t.value){let n=[...r.alternatives??[],...t.alternatives??[]];n.length&&(e[e.length-1]={...r,alternatives:[...new Set(n)]});continue}e.push(t);}return e}function Xu(i,e){let t=[],r=oi(i.roles,e.wordOrder);for(let n of r){let a=Qu(n,e);n.required?t.push(...a):t.push({type:"group",optional:true,tokens:a});}return t}function Qu(i,e){let t=[],r=i.markerOverride?.[e.code],n=e.roleMarkers[i.role],a=i.renderOverride?.[e.code]==="",o={type:"role",role:i.role,optional:!i.required,expectedTypes:i.expectedTypes,...i.valueShape!==void 0?{valueShape:i.valueShape}:{}},u=i.valuePrefixLiteral?.[e.code],s=()=>{u&&t.push({type:"literal",value:u}),t.push(o);};if(r!==void 0){let l=r?r.split(/\s+/).filter(Boolean):[],c=n?.position??"before",p=i.markerOptional?.[e.code]===true,d=m=>{let y=l.length===1?ye(i,e.code,m)??[]:[],E={type:"literal",value:m,...y.length?{alternatives:y}:{},...a?{renderSuppress:true}:{}};t.push(p?{type:"group",optional:true,tokens:[E]}:E);};if(c==="before"){for(let m of l)d(m);s();}else {s();for(let m of l)d(m);}}else if(n){let l=()=>{let p=[...new Set([...n.alternatives??[],...ye(i,e.code,n.primary)??[]])].filter(d=>d!==n.primary);return {type:"literal",value:n.primary,...p.length?{alternatives:p}:{},...a?{renderSuppress:true}:{}}},c=p=>{t.push(e.markersOptional||i.markerOptional?.[e.code]?{type:"group",optional:true,tokens:[p]}:p);};n.position==="before"?(n.primary&&c(l()),s()):(s(),c(l()));}else s();return t}function Ju(i,e){let t={};for(let r of i.roles){let n=r.markerOverride?.[e.code],a=e.roleMarkers[r.role];if(r.valuePrefixLiteral?.[e.code])t[r.role]={marker:r.valuePrefixLiteral[e.code]};else if(n!==void 0)if(!n)t[r.role]={};else {let u=!/\s/.test(n.trim())?ye(r,e.code,n)??[]:[];t[r.role]=u.length?{marker:n,markerAlternatives:u}:{marker:n};}else if(a&&a.primary){let o=[...new Set([...a.alternatives??[],...ye(r,e.code,a.primary)??[]])].filter(u=>u!==a.primary);t[r.role]=o.length?{marker:a.primary,markerAlternatives:o}:{marker:a.primary};}else t[r.role]={};}return t}function $t(i,e){let t=Ju(i,e),r={};for(let n of i.roles){let a=t[n.role]||{};!n.required&&n.default?r[n.role]={...a,default:n.default}:r[n.role]=a;}return r}function es(i,e,t){let r=[],a=oi(i.roles,e.wordOrder).map(o=>{let u=ko(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":r.push(t.primary,...a);break;case "SOV":r.push(...a,t.primary);break;default:r.push(t.primary,...a);}return r.join(" ")}var ts=class{constructor(i={}){this.cache=new Map,this.config={maxSize:i.maxSize??1e3,ttlMs:i.ttlMs??0,enabled:i.enabled??true},this.stats={hits:0,misses:0,evictions:0,expirations:0};}makeKey(i,e){return `${e}:${i}`}isExpired(i){return this.config.ttlMs===0?false:Date.now()-i.createdAt>this.config.ttlMs}evictLRU(){let i=this.cache.keys().next().value;i!==void 0&&(this.cache.delete(i),this.stats.evictions++);}get(i,e){if(!this.config.enabled){this.stats.misses++;return}let t=this.makeKey(i,e),r=this.cache.get(t);if(!r){this.stats.misses++;return}if(this.isExpired(r)){this.cache.delete(t),this.stats.expirations++,this.stats.misses++;return}return this.cache.delete(t),r.lastAccessed=Date.now(),this.cache.set(t,r),this.stats.hits++,r.result}set(i,e,t){if(!this.config.enabled||t!==null&&typeof t=="object"&&"confidence"in t&&t.confidence===0)return;let r=this.makeKey(i,e),n=Date.now();for(;this.cache.size>=this.config.maxSize;)this.evictLRU();this.cache.set(r,{result:t,createdAt:n,lastAccessed:n});}has(i,e){if(!this.config.enabled)return false;let t=this.makeKey(i,e),r=this.cache.get(t);return r?this.isExpired(r)?(this.cache.delete(t),this.stats.expirations++,false):true:false}delete(i,e){let t=this.makeKey(i,e);return this.cache.delete(t)}clear(){this.cache.clear();}resetStats(){this.stats={hits:0,misses:0,evictions:0,expirations:0};}getStats(){let i=this.stats.hits+this.stats.misses;return {hits:this.stats.hits,misses:this.stats.misses,size:this.cache.size,maxSize:this.config.maxSize,hitRate:i>0?this.stats.hits/i:0,evictions:this.stats.evictions,expirations:this.stats.expirations,enabled:this.config.enabled}}configure(i){if(i.maxSize!==void 0)for(this.config.maxSize=i.maxSize;this.cache.size>this.config.maxSize;)this.evictLRU();i.ttlMs!==void 0&&(this.config.ttlMs=i.ttlMs),i.enabled!==void 0&&(this.config.enabled=i.enabled);}enable(){this.config.enabled=true;}disable(){this.config.enabled=false;}getConfig(){return {...this.config}}};new ts;var rs=Object.defineProperty,is=Object.getOwnPropertyNames,hi=(i,e)=>function(){return i&&(e=(0, i[is(i)[0]])(i=0)),e},as=(i,e)=>{for(var t in e)rs(i,t,{get:e[t],enumerable:true});};function pi(i,e){return i.replace(/\{(\w+)\}/g,(t,r)=>String(e[r]??`{${r}}`))}function re(i,e,t={},r){let n=Ei[i],a=pi(n,t),o=gi[i],u=o?pi(o,t):void 0;return {code:i,message:a,severity:e,...r&&{role:r},...u&&{suggestion:u}}}var F,Ei,gi,ns=hi({"src/generators/schema-error-codes.ts"(){F={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"},Ei={[F.AMBIGUOUS_TYPE_LITERAL_SELECTOR]:"Role '{role}' accepts both 'literal' and 'selector'. This may cause ambiguous type inference for values starting with special characters (* . # etc.).",[F.TOO_MANY_EXPECTED_TYPES]:"Role '{role}' accepts {count} different types. This may make type inference unreliable.",[F.MULTI_TYPE_PATIENT_EXPECTED]:"Role '{role}' accepts multiple types (expected for {command} command).",[F.NO_REQUIRED_ROLES]:"Command has no required roles. Is this intentional?",[F.NO_REQUIRED_ROLES_EXPECTED]:"Command has no required roles (expected for {command}).",[F.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.",[F.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.",[F.EVENT_HANDLER_MISSING_EVENT]:"Event handler command should have an 'event' role to specify which event to listen for.",[F.EVENT_HANDLER_EVENT_NOT_REQUIRED]:"Event role should be required - every event handler needs an event to listen for.",[F.CONDITIONAL_MISSING_CONDITION]:"Conditional command should have a 'condition' role for the boolean expression.",[F.CONDITIONAL_CONDITION_NOT_REQUIRED]:"Condition role should be required - conditionals need a condition to evaluate.",[F.FOR_LOOP_MISSING_SOURCE]:"For-loop should have a 'source' role for the collection to iterate over.",[F.WHILE_LOOP_MISSING_CONDITION]:"While-loop should have a 'condition' role for the loop condition.",[F.VALUE_TYPE_MISMATCH]:"Role '{role}' of command '{command}' expects type [{expectedTypes}], got '{actualType}'.",[F.SELECTOR_KIND_MISMATCH]:"Role '{role}' of command '{command}' expects selector kind [{selectorKinds}], got '{actualKind}'.",[F.SELECTOR_KINDS_WITHOUT_SELECTOR_TYPE]:"Role '{role}' has selectorKinds but expectedTypes does not include 'selector'.",[F.KEYWORD_COLLISION]:"Keyword '{keyword}' is used by multiple commands: {commands}. Only the first-registered command will be reachable."},gi={[F.AMBIGUOUS_TYPE_LITERAL_SELECTOR]:"Consider being more specific about which type is expected, or use explicit type markers.",[F.TOO_MANY_EXPECTED_TYPES]:"Consider narrowing the accepted types to improve type inference reliability.",[F.TRANSITION_PATIENT_ACCEPTS_SELECTOR]:"Remove 'selector' from expectedTypes and only accept 'literal'.",[F.TRANSITION_MISSING_GOAL]:"Add a 'goal' role with expectedTypes ['literal', 'variable'].",[F.EVENT_HANDLER_MISSING_EVENT]:"Add an 'event' role with expectedTypes ['literal'].",[F.EVENT_HANDLER_EVENT_NOT_REQUIRED]:"Set required: true on the 'event' role.",[F.CONDITIONAL_MISSING_CONDITION]:"Add a 'condition' role with expectedTypes ['expression'].",[F.CONDITIONAL_CONDITION_NOT_REQUIRED]:"Set required: true on the 'condition' role.",[F.FOR_LOOP_MISSING_SOURCE]:"Add a 'source' role for the collection to iterate over.",[F.WHILE_LOOP_MISSING_CONDITION]:"Add a 'condition' role for the loop continuation condition.",[F.VALUE_TYPE_MISMATCH]:"Ensure the value matches one of the expected types: [{expectedTypes}].",[F.SELECTOR_KIND_MISMATCH]:"Use a selector of the correct kind: [{selectorKinds}].",[F.SELECTOR_KINDS_WITHOUT_SELECTOR_TYPE]:"Either add 'selector' to expectedTypes or remove selectorKinds.",[F.KEYWORD_COLLISION]:"Give each command a unique keyword. Move the shared keyword to alternatives on one command, or use a more specific translation."};}}),ki={};as(ki,{SchemaErrorCodes:()=>F,formatValidationResults:()=>ds,getValidationStats:()=>ms,validateAllKeywordCollisions:()=>fs,validateAllSchemas:()=>ps,validateCommandSchema:()=>bi,validateKeywordCollisions:()=>wi,validateRoleValues:()=>ys});function os(i,e){return {action:i,items:e}}function bi(i){let e=[];for(let r of i.roles)r.expectedTypes.includes("literal")&&r.expectedTypes.includes("selector")&&(r.role==="patient"&&Vt.has(i.action)?e.push(re(F.MULTI_TYPE_PATIENT_EXPECTED,"note",{role:r.role,command:i.action},r.role)):e.push(re(F.AMBIGUOUS_TYPE_LITERAL_SELECTOR,"warning",{role:r.role},r.role))),r.expectedTypes.length>3&&!Vt.has(i.action)&&e.push(re(F.TOO_MANY_EXPECTED_TYPES,"warning",{role:r.role,count:r.expectedTypes.length},r.role));for(let r of i.roles)r.selectorKinds&&r.selectorKinds.length>0&&(r.expectedTypes.includes("selector")||e.push(re(F.SELECTOR_KINDS_WITHOUT_SELECTOR_TYPE,"warning",{role:r.role},r.role)));switch(i.action){case "transition":us(i,e);break;case "on":ss(i,e);break;case "if":case "unless":ls(i,e);break;case "repeat":case "for":case "while":cs(i,e);break}return i.roles.filter(r=>r.required).length===0&&(zi.has(i.action)?e.push(re(F.NO_REQUIRED_ROLES_EXPECTED,"note",{command:i.action})):e.push(re(F.NO_REQUIRED_ROLES,"warning",{}))),os(i.action,e)}function us(i,e){let t=i.roles.find(n=>n.role==="patient"),r=i.roles.find(n=>n.role==="goal");t&&!r&&e.push(re(F.TRANSITION_MISSING_GOAL,"error",{}));}function ss(i,e){let t=i.roles.find(r=>r.role==="event");t||e.push(re(F.EVENT_HANDLER_MISSING_EVENT,"warning",{})),t&&!t.required&&e.push(re(F.EVENT_HANDLER_EVENT_NOT_REQUIRED,"warning",{}));}function ls(i,e){let t=i.roles.find(r=>r.role==="condition");t||e.push(re(F.CONDITIONAL_MISSING_CONDITION,"warning",{})),t&&!t.required&&e.push(re(F.CONDITIONAL_CONDITION_NOT_REQUIRED,"warning",{}));}function cs(i,e){i.action==="for"?i.roles.find(r=>r.role==="source")||e.push(re(F.FOR_LOOP_MISSING_SOURCE,"warning",{})):i.action==="while"&&(i.roles.find(r=>r.role==="condition")||e.push(re(F.WHILE_LOOP_MISSING_CONDITION,"warning",{})));}function ps(i,e={}){let t=new Map,{includeNotes:r=false}=e;for(let[n,a]of Object.entries(i)){let o=bi(a),u=o.items.some(l=>l.severity==="warning"||l.severity==="error"),s=r&&o.items.some(l=>l.severity==="note");(u||s)&&t.set(n,o);}return t}function ds(i,e={}){let t=[],{showNotes:r=false,showCodes:n=true}=e;for(let[a,o]of i){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(r&&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(`
5
- `)}function ms(i){let e=0,t=0,r=0,n={};for(let a of i.values())for(let o of a.items)o.severity==="error"?e++:o.severity==="warning"?t++:o.severity==="note"&&r++,n[o.code]=(n[o.code]||0)+1;return {totalCommands:i.size,errors:e,warnings:t,notes:r,byCode:n}}function ys(i,e){let t=[];for(let r of e){let n=i.roles.find(a=>a.role===r.role);n&&(n.expectedTypes.length>0&&!n.expectedTypes.includes(r.type)&&(n.expectedTypes.includes("expression")||t.push({level:"error",role:r.role,message:`${i.action}.${r.role} expects type [${n.expectedTypes.join(", ")}], got '${r.type}'`,code:F.VALUE_TYPE_MISMATCH})),r.type==="selector"&&r.selectorKind&&n.selectorKinds&&n.selectorKinds.length>0&&(n.selectorKinds.includes(r.selectorKind)||t.push({level:"error",role:r.role,message:`${i.action}.${r.role} expects selector kind [${n.selectorKinds.join(", ")}], got '${r.selectorKind}'`,code:F.SELECTOR_KIND_MISMATCH})));}return t}function wi(i){let e=[];if(!i.keywords)return {language:i.code,collisions:e};let t=new Map;for(let[n,a]of Object.entries(i.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)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 r={"primary-primary":0,"primary-alternative":1,"alternative-alternative":2};return e.sort((n,a)=>r[n.type]-r[a.type]),{language:i.code,collisions:e}}function fs(i){let e=[];for(let[,t]of Object.entries(i)){let r=wi(t);r.collisions.length>0&&e.push(r);}return e.sort((t,r)=>t.language.localeCompare(r.language))}var Vt,zi,vs=hi({"src/generators/schema-validator.ts"(){ns(),Vt=new Set(["put","append","prepend","log","throw","make","measure","return","swap","morph","beep","copy"]),zi=new Set(["compound","else","halt","continue","async","init","settle","focus","blur","return","js","measure","break","exit","beep","empty","open","close","select","clear","reset","breakpoint","live","eventsource","socket","worker","intercept"]);}}),Ht={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"},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"}}},hs=["===","!==","->","==","!=","<=",">=","&&","||","**","+=","-=","*=","/=","+","-","*","/","=",">","<","!","&","|","%","^","~"],Es=class{constructor(i=hs){this.name="operator",this.operators=[...i].sort((e,t)=>t.length-e.length);}canExtract(i,e){return this.operators.some(t=>i.startsWith(t,e))}extract(i,e){for(let t of this.operators)if(i.startsWith(t,e))return {value:t,length:t.length};return null}},gs="()[]{},:;",ks=class{constructor(i=gs){this.punctuation=i,this.name="punctuation";}canExtract(i,e){return this.punctuation.includes(i[e])}extract(i,e){let t=i[e];return this.punctuation.includes(t)?{value:t,length:1}:null}};function qt(i,e){let t=e;for(;t<i.length&&i[t]===":";){let r=i.slice(t).match(/^::?[a-zA-Z][a-zA-Z0-9-]*/);if(!r)break;let n=t+r[0].length;if(i[n]==="("){let a=0,o=n;for(;o<i.length;){if(i[o]==="(")a++;else if(i[o]===")"&&(a--,a===0)){o++;break}o++;}if(a!==0)break;n=o;}t=n;}return t}function di(i,e){let t=i[e];if(t==="#"){let r=i.slice(e).match(/^#[a-zA-Z_][\w-]*/);if(!r)return null;let n=qt(i,e+r[0].length);return i.slice(e,n)}if(t==="."){let r=i.slice(e).match(/^\.\{[a-zA-Z_$][\w$]*\}/);if(r)return r[0];let n=i.slice(e).match(/^\.[a-zA-Z_][\w-]*/);if(!n)return null;let a=qt(i,e+n[0].length);return i.slice(e,a)}if(t==="@"){let r=i.slice(e).match(/^@[a-zA-Z_][\w-]*/);return r?r[0]:null}if(t==="*"){let r=i.slice(e).match(/^\*(?:--)?[a-zA-Z_][\w-]*/);return r?r[0]:null}if(t==="["){let r=0,n=e;for(;n<i.length;){if(i[n]==="["&&r++,i[n]==="]"&&(r--,r===0)){let a=qt(i,n+1);return i.slice(e,a)}n++;}return null}if(t==="<"){let r=i.slice(e).match(/^<(?=[\w.#[])[\w-]*(?:[#.][\w-]+|\[[^\]]+\]|::?[a-zA-Z][a-zA-Z0-9-]*(?:\([^)]*\))?)*\s*\/>/);return r?r[0]:null}return null}var bs=class{constructor(){this.name="css-selector";}canExtract(i,e){let t=i[e];return t==="#"||t==="."||t==="["||t==="<"?true:t==="@"||t==="*"?di(i,e)!==null:false}extract(i,e){let t=di(i,e);return t?{value:t,length:t.length,metadata:{type:"css-selector"}}:null}},ws=class{constructor(){this.name="event-modifier";}canExtract(i,e){if(i[e]!==".")return false;let t=i.slice(e);return /^\.(once|prevent|stop|debounce|throttle|queue)/.test(t)}extract(i,e){let t=i.slice(e).match(/^\.(?:once|prevent|stop|debounce|throttle|queue)(?:\(([^)]+)\))?/);if(!t)return null;let r=t[0],n=r.slice(1).split("(")[0],a=t[1];return {value:r,length:r.length,metadata:{modifierName:n,value:a?n==="queue"?a:parseInt(a,10):void 0}}}},zs=["http://","https://","//","./","../","/"];function Cs(i,e){let t=1;for(let r=e;r<i.length;r++){let n=i[r];if(n==="{")t++;else if(n==="}"&&--t===0)return r+1}return -1}function As(i,e){let t=i.slice(e),r=zs.find(a=>t.startsWith(a));if(!r)return null;let n=r.length;for(;n<t.length;){let a=t[n];if(a==="$"&&t[n+1]==="{"){let o=Cs(t,n+2);if(o!==-1){n=o;continue}}if(/\s/.test(a))break;n++;}return t.slice(0,n)}var xs=class{constructor(){this.name="url";}canExtract(i,e){let t=i.slice(e);return t.startsWith("http://")||t.startsWith("https://")||t.startsWith("//")||t.startsWith("./")||t.startsWith("../")||t.startsWith("/")}extract(i,e){let t=As(i,e);return t?{value:t,length:t.length,metadata:{type:"url"}}:null}},Ds=class{constructor(){this.name="variable-ref";}canExtract(i,e){let t=i[e];return (t===":"||t==="$"||t==="^")&&e+1<i.length&&/[a-zA-Z_]/.test(i[e+1])}extract(i,e){if(!this.canExtract(i,e))return null;let t=1;for(;e+t<i.length&&/[a-zA-Z0-9_]/.test(i[e+t]);)t++;return {value:i.substring(e,e+t),length:t,metadata:{type:"variable-reference"}}}};function Ss(){return [new xs,new ws,new Ds,new bs]}function jt(i){return /[a-zA-Z0-9_]/.test(i)}var Ts=class{constructor(){this.name="english-keyword";}setContext(i){this.context=i;}canExtract(i,e){return /[a-zA-Z_]/.test(i[e])}extract(i,e){if(!this.context)throw new Error("EnglishKeywordExtractor: context not set");let t=e,r="";for(;t<i.length&&jt(i[t]);)r+=i[t++];if(!r)return null;if(t<i.length&&i[t]===":"){let u=t;t++;let s="";for(;t<i.length&&jt(i[t]);)s+=i[t++];s?r=r+":"+s:t=u;}let n=this.context.lookupKeyword(r),a=n&&n.normalized!==n.native?n.normalized:void 0,o=null;return this.context.isKeyword(r)||(o=this.tryClassSyntaxConversion(i,t,r)),{value:o||r,length:t-e,metadata:{normalized:a,classConversion:o?true:void 0}}}tryClassSyntaxConversion(i,e,t){let r=e;for(;r<i.length&&/\s/.test(i[r]);)r++;if(i.slice(r,r+5).toLowerCase()==="class"){let n=r+5;if(n>=i.length||!jt(i[n]))return "."+t}return null}};function Bs(){return [new Ts]}var Fs=[{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"}],Ps=class extends lr{constructor(){super(),this.language="en",this.direction="ltr",this.initializeKeywordsFromProfile(Ht,Fs),this.registerExtractors(Ss()),this.registerExtractor(new ur),this.registerExtractor(new sr),this.registerExtractors(Bs()),this.registerExtractor(new Es),this.registerExtractor(new ks);}classifyToken(i){return this.isKeyword(i)?"keyword":i.startsWith("/")||i.startsWith("./")||i.startsWith("../")||i.startsWith("http")?"url":/^\.(once|prevent|stop|debounce|throttle|queue)(\(.*\))?$/.test(i)?"event-modifier":i.startsWith("#")||i.startsWith(".")||i.startsWith("[")||i.startsWith("*")||i.startsWith("<")?"selector":i.startsWith('"')||i.startsWith("'")||/^\d/.test(i)?"literal":["==","!=","<=",">=","<",">","&&","||","!"].includes(i)?"operator":"identifier"}},Rs=new Ps;function Te(i){let e=i.roles.find(t=>t.role==="destination");return e?{destination:e.default?{fromRole:"destination",default:e.default}:{fromRole:"destination"}}:{}}function Be(i){let e=i.roles.find(t=>t.role==="source");return e?{source:e.default?{fromRole:"source",default:e.default}:{fromRole:"source"}}:{}}function Fe(i,e){return Ut(i,e,"source")}function Kt(i,e){return Ut(i,e,"destination")}function Os(i,e){return Ut(i,e,"patient")}function Ut(i,e,t){if(!e||!i.roles.some(a=>a.role===t))return [];let r=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,r]:[r,n]}]}var _s={action:"toggle",description:"Toggle a class or attribute on/off",category:"dom-class",primaryRole:"patient",ast:{args:["patient"],modifiers:{on:"destination",for:"duration"}},roles:[{role:"patient",description:"The class or attribute to toggle",required:true,expectedTypes:["selector"],selectorKinds:["class","attribute"],svoPosition:1,sovPosition:2,markerOptional:{zh:true}},{role:"destination",description:"The target element (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:2,sovPosition:1,markerVariants:{ko:["\uC5D0\uC11C"]}},{role:"duration",description:"How long the class stays on before reverting (`toggle .a for 2s`)",required:false,expectedTypes:["literal"],svoPosition:3,sovPosition:3,valueShape:"time",markerOverride:{en:"for",ja:"\u9593",ko:"\uB3D9\uC548"}}],errorCodes:["MISSING_ARGUMENT","NO_VALID_CLASS_NAMES","INVALID_CSS_PROPERTY"],preconditions:[{condition:"Command has at least one argument",errorCode:"MISSING_ARGUMENT",message:"toggle command requires an argument"},{condition:"Class names are valid CSS identifiers",errorCode:"NO_VALID_CLASS_NAMES",message:"toggle command: no valid class names found"}],recoveryHints:{MISSING_ARGUMENT:"Add a class selector (.classname) or attribute to toggle",NO_VALID_CLASS_NAMES:"Ensure class names start with a dot (.) and are valid CSS identifiers",INVALID_CSS_PROPERTY:"Check CSS property name syntax (use kebab-case)"}},Ns={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"}},Is={action:"remove",description:"Remove a class or attribute from an element",category:"dom-class",primaryRole:"patient",ast:{args:["patient"],modifiers:{from:"source"}},targetRole:"source",roles:[{role:"patient",description:"The class/attribute to remove, or the element to remove",required:true,expectedTypes:["selector","reference"],svoPosition:1,sovPosition:2},{role:"source",description:"The element to remove from (defaults to me)",required:false,expectedTypes:["selector","reference","expression"],default:{type:"reference",value:"me"},svoPosition:2,sovPosition:1}],errorCodes:["MISSING_ARGUMENT","NO_VALID_CLASS_NAMES"],preconditions:[{condition:"Command has at least one argument",errorCode:"MISSING_ARGUMENT",message:"remove command requires an argument"}],recoveryHints:{MISSING_ARGUMENT:"Add a class selector (.classname) or attribute to remove",NO_VALID_CLASS_NAMES:"Ensure class names start with a dot (.) and are valid CSS identifiers"}},Ls={action:"put",description:"Put content into a target element or variable",category:"dom-content",primaryRole:"patient",roles:[{role:"patient",description:"The content to put",required:true,expectedTypes:["literal","selector","reference","expression"],svoPosition:1,sovPosition:1},{role:"destination",description:"Where to put the content",required:true,expectedTypes:["selector","reference"],svoPosition:2,sovPosition:2,markerOverride:{en:"into",ar:"\u0641\u064A",zh:"\u5230",fr:"dans",de:"in",he:"\u05D1",id:"ke",sw:"kwa"},markerVariants:{en:["before","after"]},markerLegacy:{ar:["\u0639\u0644\u0649","\u0625\u0644\u0649","\u0628"],zh:["\u5728","\u4E8E"],fr:["sur","\xE0"],de:["auf","zu"],he:["\u05E2\u05DC","\u05D0\u05DC","\u05DC"],id:["pada","di"],sw:["kwenye"]},methodCarrier:"method"}],errorCodes:["MISSING_ARGUMENTS","MISSING_CONTENT","MISSING_POSITION","INVALID_POSITION","NO_TARGET","NO_ELEMENTS"],preconditions:[{condition:"Command has content and position arguments",errorCode:"MISSING_ARGUMENTS",message:"put requires arguments"},{condition:"Content to put is specified",errorCode:"MISSING_CONTENT",message:"put requires content"},{condition:"Position keyword is specified (into, before, after, etc.)",errorCode:"MISSING_POSITION",message:"put requires position keyword"}],recoveryHints:{MISSING_ARGUMENTS:"Use syntax: put <content> into/before/after <target>",MISSING_CONTENT:"Add content to put (string, element, or expression)",MISSING_POSITION:"Add position keyword: into, before, after, at start of, at end of",INVALID_POSITION:"Valid positions: into, before, after, at start of, at end of",NO_TARGET:'Ensure target element exists or use "me" reference',NO_ELEMENTS:"Check that the selector matches existing elements"}},Ms={action:"set",description:"Set a property or variable to a value",category:"variable",primaryRole:"destination",ast:{args:["destination"],modifiers:{to:"patient",on:"scope"}},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:"",bn:"\u0995\u09C7",qu:"ta",hi:"\u0915\u094B",zh:"\u628A"},markerOptional:{zh:true}},{role:"patient",description:"The value to set",required:true,expectedTypes:["literal","expression","reference"],svoPosition:2,sovPosition:2,markerOverride:{en:"to",es:"a",pt:"para",fr:"\xE0",de:"auf",id:"ke",ja:"\u306B",ko:"\uC5D0",tr:"e",ar:"\u0625\u0644\u0649",sw:"kwenye",tl:"sa",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>"}},$s={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>"}},qs={action:"live",description:"Reactive block: re-run the body when its dependencies change",category:"control-flow",primaryRole:"patient",hasBody:true,bareKeyword:true,roles:[]},js={action:"eventsource",description:"Open a Server-Sent Events stream and handle its events",category:"async",primaryRole:"patient",hasBody:true,bareKeyword:true,roles:[]},Vs={action:"socket",description:"Open a WebSocket and handle its messages",category:"async",primaryRole:"patient",hasBody:true,bareKeyword:true,roles:[]},Ws={action:"worker",description:"Define a Web Worker with inline methods",category:"async",primaryRole:"patient",hasBody:true,bareKeyword:true,roles:[]},Hs={action:"intercept",description:"Service-worker fetch interception / caching strategies",category:"async",primaryRole:"patient",hasBody:true,bareKeyword:true,roles:[]},Ks={action:"show",description:"Make an element visible",category:"dom-visibility",primaryRole:"patient",ast:{args:[["destination","patient"]],modifiers:{with:"duration"}},roles:[{role:"patient",description:"The element to show",required:true,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:1,sovPosition:1},{role:"style",description:"Animation style (fade, slide, etc.)",required:false,expectedTypes:["literal"],svoPosition:2,sovPosition:2}]},Us={action:"hide",description:"Make an element invisible",category:"dom-visibility",primaryRole:"patient",ast:{args:[["destination","patient"]],modifiers:{with:"duration"}},roles:[{role:"patient",description:"The element to hide",required:true,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:1,sovPosition:1},{role:"style",description:"Animation style (fade, slide, etc.)",required:false,expectedTypes:["literal"],svoPosition:2,sovPosition:2}]},Gs={action:"on",description:"Handle an event",category:"event",primaryRole:"event",ast:{args:["event"],modifiers:{from:"source"}},hasBody:true,roles:[{role:"event",description:"The event to handle",required:true,expectedTypes:["literal"],svoPosition:1,sovPosition:2},{role:"source",description:"The element to listen on (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:2,sovPosition:1}]},Ys={action:"trigger",description:"Trigger/dispatch an event",category:"event",primaryRole:"event",ast:{args:["event"],modifiers:{on:"destination"}},roles:[{role:"event",description:"The event to trigger (supports namespaced events like draggable:start)",required:true,expectedTypes:["literal","expression"],svoPosition:1,sovPosition:2,markerVariants:{hi:["\u0915\u094B"],qu:["ta"],bn:["\u0995\u09C7"]}},{role:"destination",description:"The target element (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:2,sovPosition:1}]},Zs={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}]},Xs={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"],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}]},Qs={action:"increment",description:"Increment a numeric value",category:"variable",primaryRole:"patient",ast:{args:[["destination","patient"]],modifiers:{by:"quantity"}},roles:[{role:"patient",description:"The value to increment",required:true,expectedTypes:["selector","reference","expression"],svoPosition:1,sovPosition:1},{role:"quantity",description:"Amount to increment by (defaults to 1)",required:false,expectedTypes:["literal"],default:{type:"literal",value:1,dataType:"number"},svoPosition:2,sovPosition:2,markerOverride:{en:"by",es:"por",pt:"por",fr:"par",de:"um"}}]},Js={action:"decrement",description:"Decrement a numeric value",category:"variable",primaryRole:"patient",ast:{args:[["destination","patient"]],modifiers:{by:"quantity"}},roles:[{role:"patient",description:"The value to decrement",required:true,expectedTypes:["selector","reference","expression"],svoPosition:1,sovPosition:1},{role:"quantity",description:"Amount to decrement by (defaults to 1)",required:false,expectedTypes:["literal"],default:{type:"literal",value:1,dataType:"number"},svoPosition:2,sovPosition:2,markerOverride:{en:"by",es:"por",pt:"por",fr:"par",de:"um"}}]},el={action:"append",description:"Append content to an element",category:"dom-content",primaryRole:"patient",ast:{args:["patient"],modifiers:{to:"destination"}},omitRoleVariants:["destination"],roles:[{role:"patient",description:"The content to append",required:true,expectedTypes:["literal","selector","reference","expression"],svoPosition:1,sovPosition:2},{role:"destination",description:"The element to append to",required:true,expectedTypes:["selector","reference","expression"],svoPosition:2,sovPosition:1,markerOverride:{en:"to"}}]},tl={action:"prepend",description:"Prepend content to an element",category:"dom-content",primaryRole:"patient",ast:{args:["patient"],modifiers:{to:"destination"}},omitRoleVariants:["destination"],roles:[{role:"patient",description:"The content to prepend",required:true,expectedTypes:["literal","selector","reference","expression"],svoPosition:1,sovPosition:2},{role:"destination",description:"The element to prepend to",required:true,expectedTypes:["selector","reference","expression"],svoPosition:2,sovPosition:1,markerOverride:{en:"to"}}]},rl={action:"log",description:"Log a value to the console",category:"variable",primaryRole:"patient",ast:{args:["patient"]},roles:[{role:"patient",description:"The value to log",required:true,expectedTypes:["literal","selector","reference","expression"],svoPosition:1,sovPosition:1}]},il={action:"get",description:"Get a value from a source",category:"variable",primaryRole:"source",ast:{args:[["source","patient"]]},roles:[{role:"source",description:"The source to get from",required:true,expectedTypes:["selector","reference","expression"],svoPosition:1,sovPosition:2,markerOverride:{en:"",es:"",pt:"",fr:"",de:"",ja:"\u3092",zh:"",ko:"\uB97C",ar:"\u0639\u0644\u0649",tr:"i",id:"",he:"\u05D0\u05EA",sw:"",tl:"",bn:"\u0995\u09C7",qu:"ta"}},{role:"destination",description:"Where to store the result (optional)",required:false,expectedTypes:["reference"],svoPosition:2,sovPosition:1}]},al={action:"take",description:"Take content from a source element",category:"dom-content",primaryRole:"patient",ast:{args:["patient"],modifiers:{from:"source",for:"recipient"}},roles:[{role:"patient",description:"The class or element to take",required:true,expectedTypes:["selector"],svoPosition:1,sovPosition:2},{role:"source",description:"The element to take from (defaults to all current holders)",required:false,expectedTypes:["selector","reference"],svoPosition:2,sovPosition:1},{role:"recipient",description:"The element the class moves ONTO (`take .active from .tab for me`)",required:false,expectedTypes:["reference"],svoPosition:3,sovPosition:3,valueShape:"reference",markerOverride:{en:"for"}}]},nl={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}]},ol={action:"halt",description:"Halt/stop execution or event propagation",category:"control-flow",primaryRole:"patient",ast:{args:["patient"]},roles:[{role:"patient",description:"What to halt (event, default, bubbling, etc.)",required:false,expectedTypes:["literal","reference","expression"],svoPosition:1,sovPosition:1}]},ul={action:"settle",description:"Wait for animations/transitions to settle",category:"async",primaryRole:"patient",ast:{args:[["destination","patient"]],isBlocking:true},roles:[{role:"patient",description:"The element to settle (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:1,sovPosition:1}]},sl={action:"throw",description:"Throw an error",category:"control-flow",primaryRole:"patient",ast:{args:["patient"]},roles:[{role:"patient",description:"The error message or object to throw",required:true,expectedTypes:["literal","expression"],svoPosition:1,sovPosition:1}]},ll={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"}}]},cl={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}]},pl={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}]},dl={action:"else",description:"Else branch of conditional",category:"control-flow",primaryRole:"patient",hasBody:true,roles:[]},ml={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"'},yl={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"}}]},fl={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}]},vl={action:"continue",description:"Continue to next loop iteration",category:"control-flow",primaryRole:"patient",ast:{},roles:[]},Gt={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"},hl={action:"go",description:"Navigate to a URL",category:"navigation",primaryRole:"destination",roles:[{role:"destination",description:"The URL to navigate to",required:true,expectedTypes:["literal","expression"],svoPosition:1,sovPosition:1,markerOverride:{en:"to",es:"a",ar:"\u0625\u0644\u0649",fr:"\xE0",de:"zu",pt:"para",he:"\u05D0\u05DC",hi:"\u092A\u0930",id:"ke",it:"a",ru:"\u043D\u0430",sw:"kwa",uk:"\u043D\u0430"},renderOverride:{en:"",zh:"",vi:"",th:""},markerOptional:{en:true,zh:true,vi:true,th:true},markerVariants:{zh:["\u628A"]},markerLegacy:{es:["en","sobre","hacia"],ar:["\u0639\u0644\u0649","\u0641\u064A","\u0628"],fr:["sur","dans"],de:["auf","in"],pt:["em","a"],he:["\u05E2\u05DC","\u05D1","\u05DC","\u05D0\u05EA"],hi:["\u092E\u0947\u0902"],id:["pada","di"],it:["in","su"],ru:["\u0432","\u043A"],sw:["kwenye"],uk:["\u0432","\u0434\u043E"]}}],rolePrefixLiteralVariants:[{role:"destination",literal:Gt,idSuffix:"url",priorityDelta:5,methodCarrier:"method"}]},El={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}]},gl={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"}}]},kl={action:"focus",description:"Focus an element",category:"dom-content",primaryRole:"patient",ast:{args:[["destination","patient"]]},roles:[{role:"patient",description:"The element to focus (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:1,sovPosition:1}]},bl={action:"blur",description:"Remove focus from an element",category:"dom-content",primaryRole:"patient",ast:{args:[["destination","patient"]]},roles:[{role:"patient",description:"The element to blur (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:1,sovPosition:1}]},wl={action:"empty",description:"Remove all children from an element (sets innerHTML to empty)",category:"dom-content",primaryRole:"patient",roles:[{role:"patient",description:"The element to empty (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:1,sovPosition:1}]},zl={action:"open",description:"Open a dialog, details element, or popover",category:"dom-content",primaryRole:"patient",ast:{args:["patient"],modifiers:{as:"style"}},roles:[{role:"patient",description:"The element to open (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:1,sovPosition:2},{role:"style",description:"Open-mode variant (modal / non-modal) for <dialog>",required:false,expectedTypes:["literal","expression"],svoPosition:2,sovPosition:1,markerOverride:{en:"as",ja:"\u3068\u3057\u3066"}}]},Cl={action:"close",description:"Close a dialog, details element, or popover",category:"dom-content",primaryRole:"patient",roles:[{role:"patient",description:"The element to close (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:1,sovPosition:1}]},Al={action:"select",description:"Select the contents of a text field or DOM element",category:"dom-content",primaryRole:"patient",roles:[{role:"patient",description:"The element whose contents to select (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:1,sovPosition:1}]},xl={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}]},Dl={action:"reset",description:"Reset a <form> element to its default values",category:"dom-content",primaryRole:"patient",roles:[{role:"patient",description:"The form element to reset (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:1,sovPosition:1}]},Sl={action:"breakpoint",description:"Drop into the debugger",category:"control-flow",primaryRole:"patient",roles:[],bareKeyword:true},Tl={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}]},Bl={action:"return",description:"Return a value from a function",category:"control-flow",primaryRole:"patient",ast:{args:["patient"]},roles:[{role:"patient",description:"The value to return",required:false,expectedTypes:["literal","expression","reference"],svoPosition:1,sovPosition:1}]},Fl={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}]},Pl={action:"async",description:"Execute commands asynchronously",category:"async",primaryRole:"patient",ast:{},hasBody:true,roles:[]},Rl={action:"tell",description:"Execute commands in context of another element",category:"control-flow",primaryRole:"destination",ast:{args:[["destination","patient"]]},hasBody:true,roles:[{role:"destination",description:"The element to tell",required:true,expectedTypes:["selector","reference"],svoPosition:1,sovPosition:1,markerOverride:{en:"",he:"\u05D0\u05EA",zh:"\u628A"}}]},Ol={action:"default",description:"Set a default value for a variable",category:"variable",primaryRole:"destination",ast:{args:["destination"],modifiers:{to:"patient"}},roles:[{role:"destination",description:"The variable to set default for",required:true,expectedTypes:["selector","reference","expression","property-path"],svoPosition:1,sovPosition:1,markerOverride:{en:"",ar:"",tl:"",sw:"",bn:"\u0995\u09C7",qu:"ta",ja:"\u3092",ko:"\uB97C",tr:"i",hi:"\u0915\u094B",de:"",es:"",fr:"",it:"",pt:"",pl:"",ru:"",uk:"",vi:"",id:"",ms:"",th:"",zh:"\u628A",he:"\u05D0\u05EA"}},{role:"patient",description:"The default value",required:true,expectedTypes:["literal","expression"],svoPosition:2,sovPosition:2,markerOverride:{en:"to",ar:"\u0625\u0644\u0649",tl:"sa",sw:"kwa",bn:"\u09A4\u09C7",qu:"man",ja:"\u306B",ko:"\uC5D0",tr:"e",hi:"\u092E\u0947\u0902",de:"zu",es:"a",fr:"\xE0",it:"in",pt:"para",pl:"do",ru:"\u0432",uk:"\u0432",vi:"v\xE0o",id:"ke",ms:"ke",th:"\u0E43\u0E19",zh:"\u5230",he:"\u05E2\u05DC"}}]},_l={action:"init",description:"Initialization block that runs once",category:"control-flow",primaryRole:"patient",ast:{},hasBody:true,roles:[]},Nl={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}]},Il={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}]},Ll={action:"measure",description:"Measure element dimensions (x, y, width, height, etc.)",category:"dom-content",primaryRole:"patient",ast:{args:["patient"],modifiers:{of:["destination","source"]}},roles:[{role:"patient",description:"Property to measure (x, y, width, height, top, left, etc.)",required:false,expectedTypes:["literal","expression"],svoPosition:1,sovPosition:1},{role:"source",description:"Element to measure (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:2,sovPosition:2,markerOverride:{en:"of"}}]},Ml={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"},Yt={role:"manner",description:"Run the swap inside a `document.startViewTransition()` (`using view transition`)",required:false,expectedTypes:["literal","expression"],valueShape:"keyword",markerOverride:Ml},$l={action:"swap",description:"Swap DOM content using various strategies (innerHTML, outerHTML, delete, etc.)",category:"dom-content",primaryRole:"destination",ast:{args:["method","destination","patient"],modifiers:{viewTransition:"manner"}},roles:[{role:"method",description:"The swap strategy (innerHTML, outerHTML, beforebegin, afterend, delete)",required:false,expectedTypes:["literal"],svoPosition:1,sovPosition:3,markerOverride:{en:""}},{role:"destination",description:"The element to swap content in/for",required:true,expectedTypes:["selector","reference"],svoPosition:2,sovPosition:1,markerOverride:{en:"of",es:"",fr:"",pt:"",it:"",de:"",pl:"",ru:"",uk:"",id:"",ms:"",sw:"",th:"",vi:"",he:"\u05D0\u05EA",zh:"\u628A"}},{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"}},{...Yt,svoPosition:4,sovPosition:4}]},ql={action:"morph",description:"Morph an element into another using DOM diffing",category:"dom-content",primaryRole:"patient",ast:{args:[["source","destination"]],modifiers:{on:"patient",viewTransition:"manner"}},roles:[{role:"patient",description:"The element to morph",required:true,expectedTypes:["selector","reference"],svoPosition:1,sovPosition:1,markerOverride:{en:""}},{role:"destination",description:"The target content/element to morph into",required:true,expectedTypes:["literal","expression","selector","reference"],svoPosition:2,sovPosition:2,markerOverride:{en:"to"}},{...Yt,svoPosition:3,sovPosition:3}]},jl={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}]},Vl={action:"break",description:"Exit from the current loop",category:"control-flow",primaryRole:"patient",roles:[]},Wl={action:"copy",description:"Copy text or element content to the clipboard",category:"dom-content",primaryRole:"patient",roles:[{role:"patient",description:"The text or element to copy",required:true,expectedTypes:["literal","selector","reference","expression"],svoPosition:1,sovPosition:1}]},Hl={action:"exit",description:"Exit from the current event handler",category:"control-flow",primaryRole:"patient",roles:[],bareKeyword:true},Kl={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}]},Ul={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"}}]},Gl={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"},Yl={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:Gt}]},Zl={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:Gt}]},Xl={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:Gl},{...Yt,svoPosition:2,sovPosition:2}]},Ql={action:"render",description:"Render a template with optional variables",category:"dom-content",primaryRole:"patient",roles:[{role:"patient",description:"The template to render",required:true,expectedTypes:["selector","reference","expression"],svoPosition:1,sovPosition:2},{role:"style",description:"Variables to pass to the template (with keyword)",required:false,expectedTypes:["expression","reference"],svoPosition:2,sovPosition:1}]},Ci={toggle:_s,add:Ns,remove:Is,put:Ls,set:Ms,show:Ks,hide:Us,on:Gs,trigger:Ys,wait:Zs,fetch:Xs,increment:Qs,decrement:Js,append:el,prepend:tl,log:rl,get:il,take:al,make:nl,halt:ol,settle:ul,throw:sl,send:ll,if:cl,unless:pl,else:dl,repeat:ml,for:yl,while:fl,continue:vl,go:hl,scroll:Ul,push:Yl,replace:Zl,process:Xl,transition:El,clone:gl,focus:kl,blur:bl,empty:wl,open:zl,close:Cl,select:Al,clear:xl,reset:Dl,breakpoint:Sl,call:Tl,return:Bl,js:Fl,async:Pl,tell:Rl,default:Ol,init:_l,behavior:Nl,install:Il,measure:Ll,swap:$l,morph:ql,beep:jl,break:Vl,copy:Wl,exit:Hl,pick:Kl,render:Ql,bind:$s,live:qs,eventsource:js,socket:Vs,worker:Ws,intercept:Hs,compound:{action:"compound",description:"A compound node representing chained statements",primaryRole:"patient",category:"control-flow",hasBody:true,roles:[]}};function Jl(){return Object.values(Ci).filter(i=>i.roles.length>0||i.bareKeyword===true)}typeof process<"u"&&process.env.LOKASCRIPT_SCHEMA_VALIDATION==="1"&&Promise.resolve().then(()=>(vs(),ki)).then(({validateAllSchemas:i,formatValidationResults:e})=>{let t=i(Ci);t.size>0&&(console.warn("[SCHEMA VALIDATION] Found issues in command schemas:"),console.warn(e(t)),console.warn(`
6
- These warnings help identify potential schema design issues.`),console.warn("Fix them to improve type inference and avoid runtime bugs."));}).catch(i=>{console.debug("Schema validation skipped:",i);});function Ai(i,e){let t=e==="SOV"?"sovPosition":"svoPosition";return [...i].sort((r,n)=>{let a=r[t]??99,o=n[t]??99;return a-o})}function ec(i,e){let t=i.markerOverride?.[e.code],r=e.roleMarkers[i.role];if(t!==void 0){let n=tc(i,e.code,t);return {primary:t,...n&&{alternatives:n},position:r?.position??"before",isOverride:true}}if(r&&r.primary){let n={primary:r.primary,position:r.position,isOverride:false};return r.alternatives&&(n.alternatives=r.alternatives),n}return null}function tc(i,e,t){let r=i.markerLegacy?.[e];if(!r?.length)return;let n=[...new Set(r)].filter(a=>a&&a!==t);return n.length?n:void 0}function fe(i,e,t){let r=i.markerLegacy?.[e]??[],n=i.methodCarrier?[]:i.markerVariants?.[e]??[],a=[...new Set([...r,...n])].filter(o=>o&&o!==t);return a.length?a:void 0}function Je(i,e){let t,r;if(i.markerOverride&&i.markerOverride[e.code]!==void 0)t=i.markerOverride[e.code],r=t?fe(i,e.code,t):void 0;else {let n=e.roleMarkers[i.role];if(n){t=n.primary;let a=fe(i,e.code,t)??[],o=[...new Set([...n.alternatives??[],...a])].filter(u=>u!==t);r=o.length?o:void 0;}}return {marker:t,alternatives:r}}function et(i,e,t){t.roles.find(n=>n.role==="scope"&&!n.required)&&(i.push({type:"group",optional:true,tokens:[{type:"literal",value:"on"},{type:"role",role:"scope",optional:true,expectedTypes:["selector","reference"]}]}),e.scope={fromRole:"scope"});}function Zt(i,e,t,r){Di(i,e,t,r,"manner",{requireMarker:true});}function xi(i,e,t,r){Di(i,e,t,r,"recipient",{requireMarker:false});}function Di(i,e,t,r,n,a){let o=t.roles.find(s=>s.role===n&&!s.required);if(!o)return;let u=o.markerOverride?.[r];a.requireMarker&&!u||(i.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 rc(i,e,t,r,n){let a=[];if(a.push({type:"role",role:"event",optional:false}),r.position==="after"){let l=r.primary.split(/\s+/);if(l.length>1)for(let c of l)a.push({type:"literal",value:c});else {let c=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};a.push(c);}}let o=e.roleMarkers.destination;o&&a.push({type:"group",optional:true,tokens:[{type:"role",role:"destination",optional:true},o.alternatives?{type:"literal",value:o.primary,alternatives:o.alternatives}:{type:"literal",value:o.primary}]}),a.push({type:"role",role:"patient",optional:false});let u=e.roleMarkers.patient;if(u){let l=u.alternatives?{type:"literal",value:u.primary,alternatives:u.alternatives}:{type:"literal",value:u.primary};a.push(l);}let s=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};return a.push(s),a.push(...Fe(i,e.roleMarkers.source)),a.push(...Kt(i,e.roleMarkers.destination)),{id:`${i.action}-event-${e.code}-sov`,language:e.code,command:"on",priority:(n.basePriority??100)+50,template:{format:`{event} ${r.primary} {destination?} {patient} ${u?.primary||""} ${t.primary}`,tokens:a},extraction:{action:{value:i.action},event:{fromRole:"event"},patient:{fromRole:"patient"},...Te(i),...Be(i)}}}function ic(i,e,t,r,n){let a=[],o=i.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}),r.position==="after"){let d=r.primary.split(/\s+/);if(d.length>1)for(let m of d)a.push({type:"literal",value:m});else {let m=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.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(...Fe(i,e.roleMarkers.source));let c=e.roleMarkers.destination;if(o&&c){let d=i.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?Os(i,c):Kt(i,c));let p={action:{value:i.action},event:{fromRole:"event"},[u]:{fromRole:u},...o?{}:Te(i),...Be(i)};return xi(a,p,i,e.code),Zt(a,p,i,e.code),{id:`${i.action}-event-${e.code}-sov-patient-first`,language:e.code,command:"on",priority:(n.basePriority??100)+45,template:{format:`{patient} ${s?.primary||""} {event} ${r.primary} ${t.primary}`,tokens:a},extraction:p}}function ac(i,e,t,r,n){let a=i.roles.find(p=>p.role==="source");if(!a)return null;let{marker:o,alternatives:u}=Je(a,e),s=e.roleMarkers.patient;if(!o||o===r.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}),r.position==="after"){let p=r.primary.split(/\s+/);if(p.length>1)for(let d of p)l.push({type:"literal",value:d});else l.push(r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary});}l.push(t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary});let c={action:{value:i.action},event:{fromRole:"event"},patient:{fromRole:"patient"},source:{fromRole:"source"}};return xi(l,c,i,e.code),Zt(l,c,i,e.code),{id:`${i.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} ${r.primary} ${t.primary}`,tokens:l},extraction:c}}function nc(i,e,t,r,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}),r.position==="after"){let l=r.primary.split(/\s+/);if(l.length>1)for(let c of l)a.push({type:"literal",value:c});else {let c=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.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:`${i.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} ${r.primary} ${t.primary}`,tokens:a},extraction:{action:{value:i.action},event:{fromRole:"event"},patient:{fromRole:"patient"},destination:{fromRole:"destination"}}}}function oc(i,e,t,r,n){let a=[];a.push({type:"role",role:"event",optional:false});let o=r.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(...Fe(i,e.roleMarkers.source)),a.push(...Kt(i,e.roleMarkers.destination)),{id:`${i.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:i.action},event:{fromRole:"event"},patient:{fromRole:"patient"},...Te(i),...Be(i)}}}function uc(i,e,t,r,n){let a=[];if(a.push({type:"role",role:"event",optional:false}),r.position==="after"){let u=r.primary.split(/\s+/);if(u.length>1)for(let s of u)a.push({type:"literal",value:s});else {let s=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.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:`${i.action}-event-${e.code}-sov-simple`,language:e.code,command:"on",priority:(n.basePriority??100)+48,template:{format:`{event} ${r.primary} ${t.primary}`,tokens:a},extraction:{action:{value:i.action},event:{fromRole:"event"},patient:{default:{type:"reference",value:"me"}}}}}function sc(i,e,t,r){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:`${i.action}-event-${e.code}-sov-temporal`,language:e.code,command:"on",priority:(r.basePriority??100)+49,template:{format:`{event} ${n[0]} {patient} ${t.primary}`,tokens:a},extraction:{action:{value:i.action},event:{fromRole:"event"},patient:{fromRole:"patient"}}}}function lc(i,e,t,r,n){let a=[];if(a.push({type:"role",role:"event",optional:false}),r.position==="after"){let p=r.primary.split(/\s+/);if(p.length>1)for(let d of p)a.push({type:"literal",value:d});else {let d=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};a.push(d);}}let u=[...i.roles.filter(p=>p.required)].sort((p,d)=>{let m=p.sovPosition??999,y=d.sovPosition??999;return m-y});for(let p of u){a.push({type:"role",role:p.role,optional:false});let{marker:d,alternatives:m}=Je(p,e);if(d){let y=m?{type:"literal",value:d,alternatives:m}:{type:"literal",value:d};a.push(y);}}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:i.action},event:{fromRole:"event"},...Object.fromEntries(u.map(p=>[p.role,{fromRole:p.role}]))};return et(a,c,i),{id:`${i.action}-event-${e.code}-sov-2role`,language:e.code,command:"on",priority:(n.basePriority??100)+55,template:{format:`{event} ${r.primary} ${l} ${t.primary}`,tokens:a},extraction:c}}function cc(i,e,t,r,n){let a=[],u=[...i.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}=Je(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}),r.position==="after"){let c=r.primary.split(/\s+/);if(c.length>1)for(let p of c)a.push({type:"literal",value:p});else a.push(r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary});}let s=u.map(c=>`{${c.role}}`).join(" "),l={action:{value:i.action},event:{fromRole:"event"},...Object.fromEntries(u.map(c=>[c.role,{fromRole:c.role}]))};return et(a,l,i),{id:`${i.action}-event-${e.code}-sov-2role-event-last`,language:e.code,command:"on",priority:(n.basePriority??100)+40,template:{format:`${s} ${t.primary} {event} ${r.primary}`,tokens:a},extraction:l}}function pc(i,e,t,r,n){let a=[],u=[...i.roles.filter(v=>v.required)].sort((v,f)=>{let h=v.sovPosition??999,b=f.sovPosition??999;return h-b}),s=u[0];a.push({type:"role",role:s.role,optional:false});let{marker:l,alternatives:c}=Je(s,e);if(l){let v=c?{type:"literal",value:l,alternatives:c}:{type:"literal",value:l};a.push(v);}if(a.push({type:"role",role:"event",optional:false}),r.position==="after"){let v=r.primary.split(/\s+/);if(v.length>1)for(let f of v)a.push({type:"literal",value:f});else {let f=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};a.push(f);}}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:y}=Je(d,e);if(m){let v=y?{type:"literal",value:m,alternatives:y}:{type:"literal",value:m};a.push(v);}let E={action:{value:i.action},event:{fromRole:"event"},[s.role]:{fromRole:s.role},[d.role]:{fromRole:d.role}};return et(a,E,i),{id:`${i.action}-event-${e.code}-sov-2role-dest-first`,language:e.code,command:"on",priority:(n.basePriority??100)+48,template:{format:`{${s.role}} {event} ${r.primary} ${t.primary} {${d.role}}`,tokens:a},extraction:E}}function Si(i,e,t){let r=fe(i,e.code,t.primary)??[],n=[...new Set([...t.alternatives??[],...r])].filter(a=>a!==t.primary);return n.length?n:void 0}function mi(i,e,t,r,n){let a=[];if(r.position==="before"){let s=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};a.push(s);}a.push({type:"role",role:"event",optional:false});let o=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};a.push(o),a.push({type:"role",role:"patient",optional:false});let 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(...Fe(i,e.roleMarkers.source)),{id:`${i.action}-event-${e.code}-vso`,language:e.code,command:"on",priority:(n.basePriority??100)+50,template:{format:`${r.primary} {event} ${t.primary} {patient} ${u?.primary||""} {destination?}`,tokens:a},extraction:{action:{value:i.action},event:{fromRole:"event"},patient:{fromRole:"patient"},...Te(i),...Be(i)}}}function dc(i,e,t,r,n){let a=[],o=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};a.push(o);let u=i.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(...Fe(i,e.roleMarkers.source)),r.position==="before"){let c=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};a.push(c);}if(a.push({type:"role",role:"event",optional:false}),u){let c=i.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:i.action},event:{fromRole:"event"},[u?"destination":"patient"]:{fromRole:u?"destination":"patient"},...u?{}:Te(i),...Be(i)};return Zt(a,l,i,e.code),{id:`${i.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?} ${r.primary} {event}`,tokens:a},extraction:l}}function mc(i,e,t,r,n){let a=[],o=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};a.push(o);let s=[...i.roles.filter(p=>p.required)].sort((p,d)=>{let m=p.svoPosition??999,y=d.svoPosition??999;return m-y});for(let p of s){let d,m;if(p.markerOverride&&p.markerOverride[e.code]!==void 0)d=p.markerOverride[e.code],m=d?fe(p,e.code,d):void 0;else {let y=e.roleMarkers[p.role];y&&(d=y.primary,m=Si(p,e,y));}if(d){let y=m?{type:"literal",value:d,alternatives:m}:{type:"literal",value:d};a.push(y);}a.push({type:"role",role:p.role,optional:false});}if(r.position==="before"){let p=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};a.push(p);}a.push({type:"role",role:"event",optional:false});let l=s.map(p=>`{${p.role}}`).join(" "),c={action:{value:i.action},event:{fromRole:"event"},...Object.fromEntries(s.map(p=>[p.role,{fromRole:p.role}]))};return et(a,c,i),{id:`${i.action}-event-${e.code}-vso-verb-first-2role`,language:e.code,command:"on",priority:(n.basePriority??100)+48,template:{format:`${t.primary} ${l} ${r.primary} {event}`,tokens:a},extraction:c}}function yi(i,e,t,r,n){let a=[];if(r.position==="before"){let p=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.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=[...i.roles.filter(p=>p.required)].sort((p,d)=>{let m=p.svoPosition??999,y=d.svoPosition??999;return m-y});for(let p of s){let d,m;if(p.markerOverride&&p.markerOverride[e.code]!==void 0)d=p.markerOverride[e.code],m=d?fe(p,e.code,d):void 0;else {let y=e.roleMarkers[p.role];y&&(d=y.primary,m=Si(p,e,y));}if(d){let y=m?{type:"literal",value:d,alternatives:m}:{type:"literal",value:d};a.push(y);}a.push({type:"role",role:p.role,optional:false});}let l=s.map(p=>`{${p.role}}`).join(" "),c={action:{value:i.action},event:{fromRole:"event"},...Object.fromEntries(s.map(p=>[p.role,{fromRole:p.role}]))};return et(a,c,i),{id:`${i.action}-event-${e.code}-vso-2role`,language:e.code,command:"on",priority:(n.basePriority??100)+55,template:{format:`${r.primary} {event} ${t.primary} ${l}`,tokens:a},extraction:c}}function yc(i,e,t,r,n){let a=[],o=e.eventHandler?.negationMarker;if(r.position==="before"){let l=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.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(...Fe(i,e.roleMarkers.source)),{id:`${i.action}-event-${e.code}-vso-negated`,language:e.code,command:"on",priority:(n.basePriority??100)+48,template:{format:`${r.primary} ${o?.primary||""} {event} ${t.primary} {patient} ${s?.primary||""} {destination?}`,tokens:a},extraction:{action:{value:i.action},event:{fromRole:"event"},patient:{fromRole:"patient"},...Te(i),...Be(i)}}}function fc(i,e,t,r){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(...Fe(i,e.roleMarkers.source)),{id:`${i.action}-event-${e.code}-vso-proclitic`,language:e.code,command:"on",priority:(r.basePriority??100)+45,template:{format:`[proclitic?] {event} ${t.primary} {patient} ${o?.primary||""} {destination?}`,tokens:n},extraction:{action:{value:i.action},event:{fromRole:"event"},patient:{fromRole:"patient"},...Te(i),...Be(i)}}}var qe={basePriority:100,generateSimpleVariants:true,generateAlternatives:true};function yt(i,e,t=qe){let r=`${i.action}-${e.code}-generated`,n=t.basePriority??100,a=e.keywords[i.action];if(!a)throw new Error(`No keyword translation for '${i.action}' in ${e.code}`);let o=kc(i,e,a),u=Xt(i,e),s=Ac(i,e,a);return {id:r,language:e.code,command:i.action,priority:n,template:{format:s,tokens:o},extraction:u}}function vc(i,e,t=qe){if(i.roles.filter(u=>!u.required).length===0)return null;let n=i.roles.filter(u=>u.required),a={...i,roles:n};return {...yt(a,e,t),id:`${i.action}-${e.code}-generated-simple`,priority:(t.basePriority??100)-5,extraction:Xt(i,e)}}function fi(i,e,t=qe){if(e.wordOrder!=="SOV")return null;let r=i.roles.filter(u=>u.required);if(r.length!==1)return null;let n=e.keywords[i.action];if(!n)return null;let a=n.alternatives?{type:"literal",value:n.primary,alternatives:n.alternatives}:{type:"literal",value:n.primary},o=r.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:`${i.action}-${e.code}-generated-verb-first`,language:e.code,command:i.action,priority:(t.basePriority??100)-20,template:{format:`${n.primary} <${r[0].role}>`,tokens:[a,...o]},extraction:Xt(i,e)}}function hc(i,e,t=qe){let r=[];if(r.push(yt(i,e,t)),t.generateSimpleVariants){let n=vc(i,e,t);n&&r.push(n);}for(let n of i.omitRoleVariants??[]){let a={...i,roles:i.roles.filter(u=>u.role!==n)},o=yt(a,e,t);r.push({...o,id:`${i.action}-${e.code}-generated-no-${n}`,priority:(t.basePriority??100)-8});}if(t.generateVerbFirstVariants!==false){let n=fi(i,e,t);n&&r.push(n);}for(let n of i.rolePrefixLiteralVariants??[]){let a=n.literal[e.code];if(!a)continue;let{rolePrefixLiteralVariants:o,...u}=i,s={...u,roles:i.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=yt(s,e,t);if(r.push({...p,id:`${i.action}-${e.code}-generated-${n.idSuffix}`,priority:(t.basePriority??100)+l,extraction:{...p.extraction,...c}}),t.generateVerbFirstVariants!==false){let d=fi(s,e,t);d&&r.push({...d,id:`${i.action}-${e.code}-generated-verb-first-${n.idSuffix}`,priority:(t.basePriority??100)-20+l,extraction:{...d.extraction,...c}});}}return r}function Ec(i,e=qe){let t=[],r=Jl();for(let n of r){if(!i.keywords[n.action])continue;let a=hc(n,i,e);if(t.push(...a),i.eventHandler?.eventMarker){let o=gc(n,i,e);t.push(...o);}}return t}function gc(i,e,t=qe){if(!e.eventHandler||!e.eventHandler.eventMarker)return [];let r=[],n=e.eventHandler.eventMarker,a=e.keywords[i.action];if(!a)return [];if(i.roles.length===0)return [];let u=i.roles.filter(s=>s.required).length===2;if(e.wordOrder==="SOV")if(u)r.push(lc(i,e,a,n,t)),r.push(pc(i,e,a,n,t)),r.push(cc(i,e,a,n,t));else {r.push(rc(i,e,a,n,t)),r.push(ic(i,e,a,n,t));let s=ac(i,e,a,n,t);s&&r.push(s);let l=e.roleMarkers.destination;l&&l.primary!==n.primary&&r.push(nc(i,e,a,n,t));let c=n.primary.split(/\s+/),p=n.alternatives?.some(m=>!m.includes(" ")&&m.length>1);c.length>1&&p&&r.push(oc(i,e,a,n,t)),r.push(uc(i,e,a,n,t));let d=sc(i,e,a,t);d&&r.push(d);}else e.wordOrder==="VSO"?u?(r.push(yi(i,e,a,n,t)),r.push(mc(i,e,a,n,t))):(r.push(mi(i,e,a,n,t)),r.push(dc(i,e,a,n,t)),e.eventHandler?.negationMarker&&r.push(yc(i,e,a,n,t)),e.tokenization?.prefixes&&r.push(fc(i,e,a,t))):u?r.push(yi(i,e,a,n,t)):r.push(mi(i,e,a,n,t));return r}function kc(i,e,t){let r=[],n=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary},a=wc(i,e);switch(e.wordOrder){case "SVO":r.push(n),r.push(...a);break;case "SOV":r.push(...a),r.push(n);break;case "VSO":r.push(n),r.push(...a);break;default:r.push(n),r.push(...a);}return bc(r)}function bc(i){let e=[];for(let t of i){let r=e[e.length-1];if(r&&r.type==="literal"&&t.type==="literal"&&r.value===t.value){let n=[...r.alternatives??[],...t.alternatives??[]];n.length&&(e[e.length-1]={...r,alternatives:[...new Set(n)]});continue}e.push(t);}return e}function wc(i,e){let t=[],r=Ai(i.roles,e.wordOrder);for(let n of r){let a=zc(n,e);n.required?t.push(...a):t.push({type:"group",optional:true,tokens:a});}return t}function zc(i,e){let t=[],r=i.markerOverride?.[e.code],n=e.roleMarkers[i.role],a=i.renderOverride?.[e.code]==="",o={type:"role",role:i.role,optional:!i.required,expectedTypes:i.expectedTypes,...i.valueShape!==void 0?{valueShape:i.valueShape}:{}},u=i.valuePrefixLiteral?.[e.code],s=()=>{u&&t.push({type:"literal",value:u}),t.push(o);};if(r!==void 0){let l=r?r.split(/\s+/).filter(Boolean):[],c=n?.position??"before",p=i.markerOptional?.[e.code]===true,d=m=>{let y=l.length===1?fe(i,e.code,m)??[]:[],E={type:"literal",value:m,...y.length?{alternatives:y}:{},...a?{renderSuppress:true}:{}};t.push(p?{type:"group",optional:true,tokens:[E]}:E);};if(c==="before"){for(let m of l)d(m);s();}else {s();for(let m of l)d(m);}}else if(n){let l=()=>{let p=[...new Set([...n.alternatives??[],...fe(i,e.code,n.primary)??[]])].filter(d=>d!==n.primary);return {type:"literal",value:n.primary,...p.length?{alternatives:p}:{},...a?{renderSuppress:true}:{}}},c=p=>{t.push(e.markersOptional||i.markerOptional?.[e.code]?{type:"group",optional:true,tokens:[p]}:p);};n.position==="before"?(n.primary&&c(l()),s()):(s(),c(l()));}else s();return t}function Cc(i,e){let t={};for(let r of i.roles){let n=r.markerOverride?.[e.code],a=e.roleMarkers[r.role];if(r.valuePrefixLiteral?.[e.code])t[r.role]={marker:r.valuePrefixLiteral[e.code]};else if(n!==void 0)if(!n)t[r.role]={};else {let u=!/\s/.test(n.trim())?fe(r,e.code,n)??[]:[];t[r.role]=u.length?{marker:n,markerAlternatives:u}:{marker:n};}else if(a&&a.primary){let o=[...new Set([...a.alternatives??[],...fe(r,e.code,a.primary)??[]])].filter(u=>u!==a.primary);t[r.role]=o.length?{marker:a.primary,markerAlternatives:o}:{marker:a.primary};}else t[r.role]={};}return t}function Xt(i,e){let t=Cc(i,e),r={};for(let n of i.roles){let a=t[n.role]||{};!n.required&&n.default?r[n.role]={...a,default:n.default}:r[n.role]=a;}return r}function Ac(i,e,t){let r=[],a=Ai(i.roles,e.wordOrder).map(o=>{let u=ec(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":r.push(t.primary,...a);break;case "SOV":r.push(...a,t.primary);break;default:r.push(t.primary,...a);}return r.join(" ")}var xc={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"}}},Dc={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"}}},Sc={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"}}},Tc={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}}},Bc=[Dc,Sc,xc,Tc],Fc={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"]}}},Pc=[Fc],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"}]},Rc={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}}},Oc={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:{}},_c={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:{}},Nc={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:{}},Ic=[_c,Nc,Oc,Rc];function Lc(){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 Mc(){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 $c(){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 qc(){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 jc(){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 Vc(){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 Wc(){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 Hc(){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 Kc(){return [{id:"toggle-th-simple",language:"th",command:"toggle",priority:100,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 Uc(){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 Gc(){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 Yc(){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 Zc(i){switch(i){case "bn":return Lc();case "en":return Mc();case "es":return $c();case "hi":return qc();case "it":return jc();case "pl":return Vc();case "qu":return Wc();case "ru":return Hc();case "th":return Kc();case "uk":return Uc();case "vi":return Gc();case "zh":return Yc();default:return []}}function Xc(){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 Qc(){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 Jc(){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 ep(){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 tp(){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:["literal","selector","reference","expression"]},{type:"literal",value:"ke"},{type:"literal",value:"dalam",alternatives:["di"]},{type:"role",role:"destination",expectedTypes:["selector","reference"]}]},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:["literal","selector","reference","expression"]},{type:"literal",value:"ke",alternatives:["di","pada"]},{type:"role",role:"destination",expectedTypes:["selector","reference"]}]},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:["literal","selector","reference","expression"]},{type:"literal",value:"di"},{type:"role",role:"destination",expectedTypes:["selector","reference"]}]},extraction:{patient:{position:1},destination:{position:3}}}]}function rp(){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 ip(){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 ap(){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 np(){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 op(){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:95,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:95,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 up(){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 sp(){return [...["before","after"].map(i=>{let e=i==="before"?"\xF1awpaqpi":"qhepapi";return {id:`put-qu-${i}`,language:"qu",command:"put",priority:105,template:{format:`{patient} ${e} {destination} ta churay`,tokens:[{type:"role",role:"patient"},{type:"literal",value:e,alternatives:[i]},{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:i}}}}}),{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 lp(){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:["selector","reference"]}]},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:["selector","reference"]}]},extraction:{patient:{position:1},destination:{marker:"\u5230",markerAlternatives:["\u5728","\u4E8E","\u5165"]}}}]}var cp=[{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:"zh",verb:"\u653E\u7F6E",verbAlts:["\u653E","\u653E\u5165"],patientPrefix:"\u628A",patientPrefixOptional:true,before:"\u4E4B\u524D",after:"\u4E4B\u540E"}],pp=[{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 dp(i){let e=pp.find(a=>a.lang===i);if(!e)return [];let t=[],r=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(r)):(t.push(r),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 mp(){return ["before","after"].map(i=>{let e=i==="before"?"\u524D\u306B":"\u5F8C\u306B",t=i==="before"?"\u524D":"\u5F8C";return {id:`put-ja-${i}`,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:i}}}}})}function yp(){return ["before","after"].map(i=>{let e=i==="before"?"\uC804\uC5D0":"\uD6C4\uC5D0";return {id:`put-ko-${i}`,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:i}}}}})}function fp(){let i=(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 [i("before","\xF6nce"),i("after","sonra")]}function vp(i){let e=cp.find(t=>t.lang===i);return e?["before","after"].map(t=>{let r=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:r},{type:"role",role:"destination"}),{id:`put-${e.lang}-${t}`,language:e.lang,command:"put",priority:95,template:{format:`${e.verb} {patient} ${r} {destination}`,tokens:n},extraction:{patient:{position:e.patientPrefix&&!e.patientPrefixOptional?2:1},destination:{marker:r},manner:{default:{type:"literal",value:t}}}}}):[]}function hp(i){let e=vp(i),t=dp(i);switch(i){case "bn":return [...Xc(),...t];case "en":return Qc();case "es":return [...Jc(),...t];case "hi":return [...ep(),...t];case "id":return [...tp(),...e,...t];case "it":return [...rp(),...t];case "ja":return [...mp(),...t];case "ko":return [...yp(),...t];case "tr":return [...fp(),...t];case "pl":return [...ip(),...t];case "ru":return [...ap(),...t];case "qu":return [...sp(),...t];case "th":return [...np(),...t];case "uk":return [...op(),...t];case "vi":return [...up(),...t];case "zh":return [...lp(),...e,...t];default:return [...e,...t]}}var Ep={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(Ep).map(([i,e])=>{let t={};for(let[r,n]of Object.entries(e))n in t||(t[n]=r);return [i,t]}));function gp(){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 kp(){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 bp(){return [{id:"event-en-when-source",language:"en",command:"on",priority:115,template:{format:"when {event} from {source} {body}",tokens:[{type:"literal",value:"when"},{type:"role",role:"event"},{type:"literal",value:"from"},{type:"role",role:"source"}]},extraction:{event:{position:1},source:{marker:"from"}}},{id:"event-en-when",language:"en",command:"on",priority:105,template:{format:"when {event} {body}",tokens:[{type:"literal",value:"when"},{type:"role",role:"event"}]},extraction:{event:{position:1}}},{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 wp(){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 zp(){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 Cp(){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 Ap(){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 xp(){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 Dp(){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 Sp(){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 Tp(){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 Bp(){return [{id:"event-qu-maykama",language:"qu",command:"on",priority:115,template:{format:"maykama {event} {body}",tokens:[{type:"literal",value:"maykama"},{type:"role",role:"event"}]},extraction:{event:{position:1}}},{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 Fp(){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 Pp(){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 Rp(){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:95,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 Qt(i){let e=i.verbAlts?{type:"literal",value:i.verb,alternatives:i.verbAlts}:{type:"literal",value:i.verb},t=i.eventMarkerAlts?{type:"literal",value:i.eventMarker,alternatives:i.eventMarkerAlts}:{type:"literal",value:i.eventMarker};return ["before","after"].map(r=>{let n={type:"literal",value:r==="before"?i.before:i.after},a={type:"role",role:"patient"},o={type:"role",role:"destination"},u={type:"role",role:"event"},s=i.order==="verb-first"?[e,a,n,o,t,u]:[t,u,e,a,n,o],l=i.order==="verb-first"?{action:{value:"put"},patient:{position:1},destination:{position:3},event:{position:5},manner:{default:{type:"literal",value:r}}}:{action:{value:"put"},event:{position:1},patient:{position:3},destination:{position:5},manner:{default:{type:"literal",value:r}}};return {id:`put-event-${i.lang}-vso-${r}`,language:i.lang,command:"on",priority:160,template:{format:`${i.lang} put ${r}`,tokens:s},extraction:l}})}function Op(){return [...Qt({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 _p(){return [...Qt({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 Np(){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 Ip(){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",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 Lp(){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 Mp(){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 $p(){return [...Qt({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 qp(){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 jp(i){switch(i){case "bn":return gp();case "de":return kp();case "en":return bp();case "es":return wp();case "fr":return zp();case "hi":return Cp();case "id":return Ap();case "it":return xp();case "ms":return Dp();case "pl":return Sp();case "pt":return Tp();case "qu":return Bp();case "ru":return Fp();case "sw":return Pp();case "th":return Rp();case "tl":return Op();case "uk":return _p();case "vi":return Np();case "zh":return Ip();case "ja":return Lp();case "tr":return Mp();case "ar":return $p();case "he":return qp();default:return []}}function Vp(i,e,t,r){let n=[];return n.push({type:"literal",value:e}),r&&n.push({type:"literal",value:r}),n.push({type:"role",role:"quantity",expectedTypes:["literal","expression"]}),n.push({type:"literal",value:t}),{id:`repeat-${i}-times`,language:i,command:"repeat",priority:110,template:{format:`${e}${r?" "+r:""} {quantity} ${t}`,tokens:n},extraction:{loopType:{default:{type:"literal",value:"times"}}}}}var Wp=[["es","repetir","times"],["de","wiederholen","times"],["fr","r\xE9p\xE9ter","times"],["it","ripetere","times"],["pt","repetir","times"],["ru","\u043F\u043E\u0432\u0442\u043E\u0440\u0438\u0442\u044C","times"],["uk","\u043F\u043E\u0432\u0442\u043E\u0440\u0438\u0442\u0438","times"],["pl","powt\xF3rz","times"],["ar","\u0643\u0631\u0631","times"],["he","\u05D7\u05D6\u05D5\u05E8","times","\u05D0\u05EA"],["id","ulangi","times"],["ms","ulang","kali"],["sw","rudia","times"],["th","\u0E17\u0E33\u0E0B\u0E49\u0E33","\u0E04\u0E23\u0E31\u0E49\u0E07"],["vi","l\u1EB7p l\u1EA1i","l\u1EA7n"],["tl","ulitin","beses"],["zh","\u91CD\u590D","times","\u628A"]];function Hp(i,e,t){return {id:`repeat-${i}-times`,language:i,command:"repeat",priority:110,template:{format:`{quantity} ${e} ${t} repeat`,tokens:[{type:"role",role:"quantity",expectedTypes:["literal","expression"]},{type:"literal",value:e},{type:"literal",value:t},{type:"literal",value:"repeat"}]},extraction:{loopType:{default:{type:"literal",value:"times"}}}}}var Kp=[["ja","times","\u3092"],["ko","times","\uB97C"],["tr","times","i"],["hi","times","\u0915\u094B"],["bn","\u09AC\u09BE\u09B0","\u0995\u09C7"],["qu","times","ta"]];function Up(i,e){let t=[{type:"literal",value:"repeat"}];if(e.forWords&&e.forWords.length>0)if(e.requireForWords)for(let r of e.forWords)t.push({type:"literal",value:r});else t.push({type:"group",optional:true,tokens:e.forWords.map(r=>({type:"literal",value:r}))});t.push({type:"role",role:"patient",expectedTypes:["expression","reference"]});for(let r of e.inWords)t.push({type:"literal",value:r});return t.push({type:"role",role:"source",expectedTypes:["selector","expression","reference"]}),{id:`repeat-${i}-for-in`,language:i,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 Gp=[["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 Yp(i,e){let t=[{type:"literal",value:"repeat"}];for(let r of e.pre??[])t.push({type:"literal",value:r});return t.push({type:"literal",value:e.whileWord}),t.push({type:"role",role:"condition",expectedTypes:["property-path","expression"]}),{id:`repeat-${i}-while-head`,language:i,command:"repeat",priority:110,template:{format:`repeat ${(e.pre??[]).join(" ")} ${e.whileWord} {condition}`,tokens:t},extraction:{loopType:{default:{type:"literal",value:"while"}}}}}var Zp=[["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 Xp(i,e){let t=[{type:"literal",value:"repeat"}];for(let r of e.pre??[])t.push({type:"literal",value:r});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-${i}-until-head`,language:i,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 Qp=[["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 Jp(i,e){return {id:`repeat-${i}-until-head`,language:i,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 e0(i,e){return {id:`repeat-${i}-until-head-verb-final`,language:i,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 t0={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"}}}},r0=[["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"}]],i0={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 a0(i,e){return {id:`for-${i}-sov-basic`,language:i,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 n0=[["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"}]],Wt=new Map,pe=(i,e)=>{let t=Wt.get(i);t?t.push(e):Wt.set(i,[e]);};for(let[i,e,t,r]of Wp)pe(i,Vp(i,e,t,r));for(let[i,e,t]of Kp)pe(i,Hp(i,e,t));for(let[i,e]of Gp)pe(i,Up(i,e));for(let[i,e]of n0)pe(i,a0(i,e));for(let[i,e]of Zp)pe(i,Yp(i,e));for(let[i,e]of Qp)pe(i,Xp(i,e));for(let[i,e]of r0)pe(i,Jp(i,e)),i==="tr"&&pe(i,e0(i,e));pe("qu",i0);pe("qu",t0);function o0(i){return Wt.get(i)??[]}function u0(){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 s0(){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 l0(){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 c0(){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 p0(){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 ft(i,e,t,r,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:i,language:e,command:"wait",priority:105,template:{format:`{source} ${r} {duration} ${n} {patient} ${t}`,tokens:[{type:"role",role:"source",expectedTypes:["expression","reference"]},{type:"literal",value:r,...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 vi(i,e,t,r,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:i,language:e,command:"wait",priority:105,template:{format:`${t} {duration} ${r} [${n}] {patient} [${n}] {source} ${a}`,tokens:[{type:"literal",value:t},{type:"role",role:"duration",expectedTypes:["expression","literal"]},u(),{type:"literal",value:r},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 d0(){return [vi("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),vi("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 m0(){return [ft("wait-tr-or-run","tr","bekle","den","veya",1,["dan","ten","tan"]),ft("wait-tr-or-run-2arg","tr","bekle","den","veya",2,["dan","ten","tan"])]}function y0(){return [ft("wait-qu-or-run","qu","suyay","manta","utaq",1),ft("wait-qu-or-run-2arg","qu","suyay","manta","utaq",2)]}function f0(i){switch(i){case "en":return c0();case "zh":return u0();case "he":return s0();case "ar":return l0();case "bn":return d0();case "tl":return p0();case "tr":return m0();case "qu":return y0();default:return []}}var v0={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"}}}},h0={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"}}}},E0={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"]},{type:"literal",value:"times"}]},extraction:{loopType:{default:{type:"literal",value:"times"}}}},g0={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"}}}},k0={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:["literal","expression","reference"]},{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"}}},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"}}},w0={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}}},z0={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}}},C0={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}}},A0={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 x0(){let i=[];i.push(...Zc("en")),i.push(...hp("en")),i.push(...jp("en")),i.push(...o0("en")),i.push(...f0("en")),i.push(...Bc,...Pc,...Ic,v0,h0,E0,g0,k0,b0,w0,z0,C0,A0);let e=Ec(Ht);return i.push(...e),i}Lr("en",Rs,Ht);$r("en",x0());function Et(i){let e=i.getAttribute("data-lang");if(e)return ht(e);let t=i.getAttribute("data-hyperscript-lang")??i.closest?.("[data-hyperscript-lang]")?.getAttribute("data-hyperscript-lang");if(t)return ht(t);let r=i.closest?.("[lang]")?.getAttribute("lang");if(r)return ht(r);let n=typeof document<"u"?document.documentElement?.lang:null;return n&&n!=="en"?ht(n):null}function ht(i){return i.split("-")[0].toLowerCase()}var Ti={add:[["patient",""],["destination","to"]],append:[["patient",""],["destination","to"]],async:[],beep:[["patient",""]],behavior:[["patient",""]],bind:[["destination",""],["source","to"]],blur:[["patient",""]],break:[],breakpoint:[],call:[["patient",""]],clear:[["patient",""]],clone:[["patient",""],["destination","into"]],close:[["patient",""]],compound:[],continue:[],copy:[["patient",""]],decrement:[["patient",""],["quantity","by"]],default:[["destination",""],["patient","to"]],else:[],empty:[["patient",""]],eventsource:[],exit:[],fetch:[["source",""],["style","with"],["responseType","as"],["method","via"],["destination","on"]],focus:[["patient",""]],for:[["patient",""],["source","in"]],get:[["source",""],["destination","on"]],go:[["destination",""]],halt:[["patient",""]],hide:[["patient",""],["style","with"]],if:[["condition",""]],increment:[["patient",""],["quantity","by"]],init:[],install:[["patient",""],["destination","on"]],intercept:[],js:[["patient",""]],live:[],log:[["patient",""]],make:[["patient",""]],measure:[["patient",""],["source","of"]],morph:[["patient",""],["destination","to"],["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",""]],while:[["condition",""]],worker:[]};var D0=new Set(["repeat","for","while","tell"]),S0=new Set(["js"]);function gt(i){switch(i.kind){case "event-handler":return T0(i);case "compound":return B0(i);default:return F0(i)}}function T0(i){let e=["on"],t=i.roles.get("event");t&&e.push(t.type==="literal"?String(t.value):tt(t));let r=i.roles.get("source");if(r&&e.push("from",tt(r)),i.body&&i.body.length>0){let n=i.body.map(gt);e.push(n.join(" "));}return e.join(" ")}function B0(i){let e=i.chainType==="async"?"async":i.chainType,t=i.statements.map(gt),r=t[0]??"";for(let n=1;n<t.length;n++){let a=i.statements[n-1],o=i.statements[n],u=a.kind==="command"&&D0.has(a.action),s=a.kind==="command"&&a.action==="bind"&&o.kind==="command"&&o.action==="bind";a.kind==="command"&&S0.has(a.action)&&(r+=" end"),r+=(u||s?" ":` ${e} `)+t[n];}return r}function F0(i){let e=Ti[i.action];if(e){let r=[i.action];for(let[n,a]of e){let o=i.roles.get(n);o&&((n==="destination"||n==="source")&&o.type==="reference"&&o.value==="me"||(a&&r.push(a),r.push(tt(o))));}return r.join(" ")}let t=[i.action];for(let[,r]of i.roles)t.push(tt(r));return t.join(" ")}function tt(i){switch(i.type){case "literal":return typeof i.value=="string"&&i.dataType==="string"?`"${i.value}"`:String(i.value);case "selector":return i.value;case "reference":return i.value;case "property-path":return P0(i);case "expression":return i.raw;case "flag":return i.enabled?`+${i.name}`:`~${i.name}`}}function P0(i){let e=tt(i.object),t=i.property;if(i.object.type==="reference")switch(i.object.value){case "me":return `my ${t}`;case "it":return `its ${t}`;case "you":return `your ${t}`}return `${e}'s ${t}`}var R0={confidenceThreshold:.5,strategy:"semantic"};function O0(i,e){return typeof i=="number"?i:i[e]??i["*"]??.5}var _0=/^(on\s+(?:every\s+)?[\w-]+(?:\[.*?\])?(?:\.[\w-]+(?:\([^)]*\))?)*(?:\s+from\s+\S+)?(?:\s+queue\s+\w+)?\s+)/;function N0(i){let e=i.match(_0);if(!e)return null;let t=e[1],r=i.slice(t.length);return r?{prefix:t,commands:r}:null}function Bi(i){function e(n,a,o){try{return i.isLanguageRegistered(a)?i.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 r(n,a,o){if(o.strategy==="semantic"||o.strategy==="auto"){let u=O0(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={...R0,...u},l=r(a,o,s);if(l!==null)return l;let c=N0(a);if(c){let p=r(c.commands,o,s);if(p!==null)return c.prefix+p}return a}}var Jt=Bi({isLanguageRegistered:qr,translateSingle(i,e,t){let r=ni(i,e);return r.confidence<t||!r.node?null:gt(r.node)}});var er=new WeakSet;function I0(i){return (i.config?.attributes??"_, script, data-script").split(",").map(t=>t.trim()).filter(Boolean)}function L0(i,e){for(let t of e)if(i.hasAttribute(t))return t;return null}function Fi(i,e){if(typeof i.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=I0(i),r=[...t.map(a=>`[${a}]`),'script[type="text/hyperscript"]'].join(", "),n=a=>{if(er.has(a))return;if(a instanceof HTMLScriptElement&&a.type==="text/hyperscript"){let l=a.textContent??"";if(!l)return;let c=e(l,a);er.add(a),c!=null&&c!==l&&(a.textContent=c);return}let o=L0(a,t);if(!o)return;let u=a.getAttribute(o);if(!u)return;let s=e(u,a);er.add(a),s!=null&&s!==u&&a.setAttribute(o,s);};i.addBeforeProcessHook(a=>{!a||typeof a.querySelectorAll!="function"||(typeof a.matches=="function"&&a.matches(r)&&n(a),a.querySelectorAll(r).forEach(n));});}function Ri(i,e){if(typeof i.parse!="function")return true;try{let t=i.parse(e);return !t?.errors||t.errors.length===0}catch{return false}}var Pi=new Set;function Oi(i,e,t){Pi.has(i)||(Pi.add(i),console.warn(`[hyperscript-i18n] Translation for lang="${i}" rendered hyperscript the host parser rejects \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 tr(i={}){return function(t){let r=t;Fi(r,(n,a)=>{let o=M0(a,i);if(!o||o==="en")return n;let u=Jt(n,o,i);if(u!==n){if(i.validateWithHost!==false&&!Ri(r,u))return i.debug?console.log(`[hyperscript-i18n] ${o}: host rejected "${u}" \u2014 keeping "${n}"`):Oi(o,n,u),n;i.debug&&console.log(`[hyperscript-i18n] ${o}: "${n}" \u2192 "${u}"`);}return u});}}function M0(i,e){if(e.languageAttribute){let r=i.getAttribute(e.languageAttribute);if(r)return r.split("-")[0].toLowerCase()}let t=Et(i);return t||(e.defaultLanguage??null)}function _i(i,e,t={}){return e==="en"?i:Jt(i,e,t)}Mr(i=>ci(i));function Ni(){typeof _hyperscript<"u"&&_hyperscript.use&&_hyperscript.use(tr());}var dm=["en"];Ni();
7
- exports.plugin=tr;exports.preprocess=_i;exports.resolveLanguage=Et;exports.supportedLanguages=dm;return exports;})({});
1
+ var HyperscriptI18n=(function(exports){'use strict';function de(i,e){return e?{type:"literal",value:i,dataType:e}:{type:"literal",value:i}}function st(i,e){return e?{type:"selector",value:i,selectorKind:e}:{type:"selector",value:i}}function Ge(i){return {type:"reference",value:i}}function ut(i,e){return {type:"property-path",object:i,property:e}}var vr=new Set(["me","you","it","result","event","target","body","document","window","detail"]);function xt(i,e=vr){return e.has(i)}var fa=class{constructor(i){this.namespace=i,this.enabled=this.checkEnabled();}checkEnabled(){if(typeof process<"u"&&process.env){let i=process.env.DEBUG||"";return i==="*"||i.includes("framework:*")||i.includes(`framework:${this.namespace}`)}return false}log(i,e,...t){if(!this.enabled)return;let r=`[framework:${this.namespace}]`,n=new Date().toISOString();switch(i){case "debug":console.debug(`${n} ${r} DEBUG:`,e,...t);break;case "info":console.info(`${n} ${r} INFO:`,e,...t);break;case "warn":console.warn(`${n} ${r} WARN:`,e,...t);break;case "error":console.error(`${n} ${r} ERROR:`,e,...t);break}}debug(i,...e){this.log("debug",i,...e);}info(i,...e){this.log("info",i,...e);}warn(i,...e){this.log("warn",i,...e);}error(i,...e){this.log("error",i,...e);}isEnabled(){return this.enabled}enable(){this.enabled=true;}disable(){this.enabled=false;}};function ya(i){return new fa(i)}function Fe(i,e){return !e||e.length===0||e.includes(i)||e.includes("expression")?true:i==="property-path"?e.some(t=>["selector","reference","expression"].includes(t)):false}function va(i,e){return i?.possessive?.keywords?.[e]}var Ze=class Re{constructor(){this.logger=ya("pattern-matcher"),this.stemMatchCount=0,this.totalKeywordMatches=0;}safeToLowerCase(e){return typeof e=="string"?e.toLowerCase():e==null?"":String(e).toLowerCase()}matchPattern(e,t,r){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 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:",r?.code);}this.currentProfile=r,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(n),null;let s=this.calculateConfidence(t,a);return this.applyExtractionRules(t,a),{pattern:t,captured:a,consumedTokens:e.position()-n.position,confidence:s}}matchBest(e,t,r){let n=[];for(let o of t){let s=e.mark(),u=this.matchPattern(e,o,r);u&&n.push(u),e.reset(s);}if(n.length===0)return null;n.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=n[0];return this.matchPattern(e,a.pattern),a}matchTokenSequence(e,t,r,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 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 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 E=this.collectStopMarkers(t,l+1);if(n)for(let v of n)E.add(v);let y=[];for(;!e.isAtEnd();){let v=e.peek();if(!v||this.isStopMarker(v,E))break;y.push(v.value),e.advance();}if(y.length>0){r.set(c.role,{type:"expression",raw:y.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(n)for(let v of n)E.add(v);if(this.matchGroupToken(e,c,r,E)){s=null,u=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 E=l+1<t.length?t[l+1]:null;if(E?.type==="literal"){let y=e.peek();if(y&&this.getMatchType(y,E.value)!=="none"){if(this.logger.debug(" >> MARKER-STEAL GUARD: current token matches next literal, skipping role"),this.logger.debug(" >> Token match FAILED"),this.isOptional(c))continue;if(s&&u){this.logger.debug(" >> BACKTRACKING: undoing optional role",u),e.reset(s),r.delete(u),s=null,u=null;let v=this.matchPatternToken(e,c,r);if(this.logger.debug(" >> Backtrack retry result:",v),v)continue}return false}}}let h=this.matchPatternToken(e,c,r);if(this.logger.debug(" >> Match result:",h),h){d?(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),r.delete(u),s=null,u=null;let E=this.matchPatternToken(e,c,r);if(this.logger.debug(" >> Backtrack retry result:",E),E)continue}return false}}return true}matchPatternToken(e,t,r){switch(t.type){case "literal":return this.matchLiteralToken(e,t);case "role":return this.matchRoleToken(e,t,r);case "group":return this.matchGroupToken(e,t,r);default:return false}}matchLiteralToken(e,t){let r=e.peek();if(this.logger.debug(" >>> matchLiteralToken: expecting",t.value),this.logger.debug(" >>> matchLiteralToken: got token",r?JSON.stringify({type:r.type,value:r.value,kind:r.kind}):"null"),!r)return this.logger.debug(" >>> matchLiteralToken: FAIL - no token"),false;let n=this.getMatchType(r,t.value);if(this.logger.debug(" >>> matchType for",r.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(r,a);if(o!=="none")return this.totalKeywordMatches++,o==="stem"&&this.stemMatchCount++,e.advance(),true}return false}matchRoleToken(e,t,r){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&&!Fe(a.type,t.expectedTypes)?t.optional||false:(r.set(t.role,a),true);let o=this.tryMatchMethodCallExpression(e);if(o)return t.expectedTypes&&t.expectedTypes.length>0&&!Fe(o.type,t.expectedTypes)?t.optional||false:(r.set(t.role,o),true);let s=this.tryMatchPossessiveSelectorExpression(e);if(s)return t.expectedTypes&&t.expectedTypes.length>0&&!Fe(s.type,t.expectedTypes)?t.optional||false:(r.set(t.role,s),true);let u=this.tryMatchPropertyAccessExpression(e);if(u)return t.expectedTypes&&t.expectedTypes.length>0&&!Fe(u.type,t.expectedTypes)?t.optional||false:(r.set(t.role,u),true);let l=this.tryMatchSelectorPropertyExpression(e);if(l)return t.expectedTypes&&t.expectedTypes.length>0&&!Fe(l.type,t.expectedTypes)?t.optional||false:(r.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&&!Fe(c.type,t.expectedTypes)?(this.logger.debug(" >>> TYPE MISMATCH - returning",t.optional||false),t.optional||false):(this.logger.debug(" >>> Type validation PASSED"),r.set(t.role,c),e.advance(),true)):t.optional||false}tryMatchPossessiveExpression(e){let t=e.peek();if(!t||!this.currentProfile)return null;let r=t.normalized||t.value,n=this.safeToLowerCase(r),a=va(this.currentProfile,n);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()),ut(Ge(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 r=e.mark();e.advance();let n=e.peek();if(!n||n.kind!=="operator"||n.value!==".")return e.reset(r),null;e.advance();let a=e.peek();if(!a||a.kind!=="identifier")return e.reset(r),null;e.advance();let o=e.peek();if(!o||o.kind!=="punctuation"||o.value!=="(")return e.reset(r),null;e.advance();let s=[];for(;!e.isAtEnd()&&s.length<Re.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 r=e.mark();e.advance();let n=e.peek();if(!n||n.kind!=="operator"||n.value!==".")return e.reset(r),null;e.advance();let a=e.peek();if(!a||a.kind!=="identifier")return e.reset(r),null;e.advance();let o=`${t.value}.${a.value}`,s=1;for(;!e.isAtEnd()&&s<Re.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<Re.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 r=e.mark();e.advance();let n=e.peek();if(!n||n.kind!=="punctuation"||n.value!=="'s")return e.reset(r),null;e.advance();let a=e.peek();return !a||a.kind!=="selector"&&a.kind!=="identifier"?(e.reset(r),null):(e.advance(),ut(st(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 r=e.mark();e.advance();let n=e.peek();if(!n||n.kind!=="selector"||!n.value.startsWith("."))return e.reset(r),null;let a=e.peek(1);a&&a.kind,e.advance();let o=n.value.slice(1);return ut(st(t.value),o)}matchGroupToken(e,t,r,n){let a=e.mark(),o=new Set(r.keys());if(this.matchTokenSequence(e,t.tokens,r,n))return true;e.reset(a);for(let l of r.keys())o.has(l)||r.delete(l);if(!t.optional)return false;let u=this.getGroupLeadingMarker(t);if(u)for(let l=1;l<=Re.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,r,n))return true;e.reset(a);for(let m of r.keys())o.has(m)||r.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 r=new Set;for(let n=t;n<e.length;n++){let a=e[n];if(a.type==="literal"){if(r.add(a.value.toLowerCase()),a.alternatives)for(let o of a.alternatives)r.add(o.toLowerCase());break}if(a.type==="group"){for(let o of a.tokens)if(o.type==="literal"){if(r.add(o.value.toLowerCase()),o.alternatives)for(let s of o.alternatives)r.add(s.toLowerCase());break}if(!a.optional)break}}return r}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 st(e.value);case "literal":return this.parseLiteralValue(e.value);case "keyword":let t=e.normalized||e.value;this.safeToLowerCase(t);return de(e.normalized||e.value);case "identifier":if(typeof e.value=="string"&&e.value.startsWith(":"))return Ge(e.value);this.safeToLowerCase(e.value);return {type:"expression",raw:e.value};case "url":return de(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 de(n,"string")}if(e==="true")return de(true,"boolean");if(e==="false")return de(false,"boolean");let t=e.match(/^(\d+(?:\.\d+)?)(ms|s|m|h)?$/);if(t){let n=parseFloat(t[1]);return t[2]?de(e,"duration"):de(n,"number")}let r=parseFloat(e);return isNaN(r)?de(e,"string"):de(r,"number")}applyExtractionRules(e,t){for(let[r,n]of Object.entries(e.extraction))t.has(r)||(n.value!==void 0?t.set(r,{type:"literal",value:n.value}):n.default&&t.set(r,n.default));}isOptional(e){return e.type!=="literal"&&e.optional===true}calculateConfidence(e,t){let r=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)&&(r+=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)?r+=d:p&&(r+=d*.6);}}let o=n>0?r/n: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 r=new Set(["\u0628\u062F\u0644","\u063A\u064A\u0631","\u0623\u0636\u0641","\u0623\u0632\u0644","\u0636\u0639","\u0627\u062C\u0639\u0644","\u0639\u064A\u0646","\u0632\u062F","\u0627\u0646\u0642\u0635","\u0633\u062C\u0644","\u0623\u0638\u0647\u0631","\u0623\u062E\u0641","\u0634\u063A\u0644","\u0623\u0631\u0633\u0644","\u0631\u0643\u0632","\u0634\u0648\u0634","\u062A\u0648\u0642\u0641","\u0627\u0646\u0633\u062E","\u0627\u062D\u0630\u0641","\u0627\u0635\u0646\u0639","\u0627\u0646\u062A\u0638\u0631","\u0627\u0646\u062A\u0642\u0627\u0644","\u0623\u0648"]);if(r.has(t.value))return .15;if(t.alternatives){for(let n of t.alternatives)if(r.has(n))return .15}return 0}arabicPrepositionDisambiguation(e,t){if(e.language!=="ar")return 0;let r=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 s=n[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)?r+=.1:r-=.1;}}return Math.max(-0.1,Math.min(.1,r))}skipNoiseWords(e){let t=e.peek();if(!t)return;let r=this.safeToLowerCase(t.value);if(Re.ENGLISH_NOISE_WORDS.has(r)){let n=e.mark();e.advance();let a=e.peek();if(a&&a.kind==="selector")return;e.reset(n);}r==="class"&&e.advance();}extractEventModifiers(e){let t={},r=false;for(;!e.isAtEnd();){let n=e.peek();if(!n||n.kind!=="event-modifier")break;let a=n.metadata;if(!a)break;switch(r=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 r?t:void 0}};Ze.MAX_MARKER_SCAN=3;Ze.MAX_PROPERTY_DEPTH=10;Ze.MAX_METHOD_ARGS=20;Ze.ENGLISH_NOISE_WORDS=new Set(["the","a","an"]);var ha=Ze;new ha;var gr=class{constructor(){this.name="string-literal";}canExtract(i,e){let t=i[e];return t==="'"&&e>0&&/[\p{L}\p{N}_)\]]/u.test(i[e-1])?false:t==='"'||t==="'"||t==="`"||t==="\u201C"||t==="\u2018"}extract(i,e){let t=i[e];if(t==="\u201C"){let a=1;for(;e+a<i.length;){if(i[e+a]==="\u201D")return a++,{value:i.substring(e,e+a),length:a};a++;}return null}if(t==="\u2018"){let a=1;for(;e+a<i.length;){if(i[e+a]==="\u2019")return a++,{value:i.substring(e,e+a),length:a};a++;}return null}let r=1,n=false;for(;e+r<i.length;){let a=i[e+r];if(n){n=false,r++;continue}if(a==="\\"){n=true,r++;continue}if(a===t)return r++,{value:i.substring(e,e+r),length:r};r++;}return null}},kr=class{constructor(){this.name="number";}canExtract(i,e){return /\d/.test(i[e])}extract(i,e){let t=0,r=false;for(;e+t<i.length;){let o=i[e+t];if(/\d/.test(o))t++;else if(o==="."&&!r)r=true,t++;else break}if(t===0)return null;let n=i.substring(e,e+t),a=e+t;if(a<i.length){let o=i.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: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 u=[{pattern:"\u79D2",suffix:"s"},{pattern:"\u5206",suffix:"m"}];for(let l of u)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 Ea(i){return "setContext"in i&&typeof i.setContext=="function"}function ga(i){let e={language:i.language,direction:i.direction,lookupKeyword:i.lookupKeyword.bind(i),isKeyword:i.isKeyword.bind(i),isKeywordStart:i.isKeywordStart.bind(i),...i.isKeywordStartAtBoundary?{isKeywordStartAtBoundary:i.isKeywordStartAtBoundary.bind(i)}:{}};return i.normalizer?{...e,normalizer:i.normalizer}:e}var ae=class{constructor(i,e){this.pos=0,this.tokens=i,this.language=e;}peek(i=0){let e=this.pos+i;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(i){this.pos=i.position;}position(){return this.pos}remaining(){return this.tokens.slice(this.pos)}takeWhile(i){let e=[];for(;!this.isAtEnd()&&i(this.peek());)e.push(this.advance());return e}skipWhile(i){for(;!this.isAtEnd()&&i(this.peek());)this.advance();}};function G(i,e){return {start:i,end:e}}function Y(i,e,t,r){if(typeof i=="object"){let{value:a,kind:o,position:s,normalized:u,stem:l,stemConfidence:c,metadata:p}=i;return {value:a,kind:o,position:s,...u!==void 0&&{normalized:u},...l!==void 0&&{stem:l},...c!==void 0&&{stemConfidence:c},...p!==void 0&&{metadata:p}}}let n=i;if(!e||!t)throw new Error("createToken requires kind and position parameters");if(typeof r=="string")return {value:n,kind:e,position:t,normalized:r};if(r){let{normalized:a,stem:o,stemConfidence:s,metadata:u}=r;return {value:n,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:n,kind:e,position:t}}function Ye(i){return /\s/.test(i)}function ka(i){return i==="#"||i==="."||i==="["||i==="@"||i==="*"||i==="<"}function ba(i){return i==='"'||i==="'"||i==="`"||i==="\u300C"||i==="\u300D"}function we(i){return /\d/.test(i)}function ct(i){return i.replace(/[\u064b-\u0652\u0670]/g,"")}function wa(i){return /[a-zA-Z]/.test(i)}function ie(i){return /[a-zA-Z0-9_-]/.test(i)}function za(i,e){if(e>=i.length)return null;let t=i[e];if(!ka(t))return null;let r=e,n="";if(t==="#"||t==="."){for(n+=i[r++];r<i.length&&ie(i[r]);)n+=i[r++];if(n.length<=1)return null;if(r<i.length&&i[r]==="."&&t==="#"){let o=r+1;for(;o<i.length&&ie(i[o]);)o++;if(o<i.length&&i[o]==="(")return n}}else if(t==="["){let a=1,o=false,s=null,u=false;for(n+=i[r++];r<i.length&&a>0;){let l=i[r];n+=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--,r++;}if(a!==0)return null}else if(t==="@"){for(n+=i[r++];r<i.length&&ie(i[r]);)n+=i[r++];if(n.length<=1)return null}else if(t==="*"){for(n+=i[r++];r<i.length&&ie(i[r]);)n+=i[r++];if(n.length<=1)return null}else if(t==="<"){if(n+=i[r++],r>=i.length||!wa(i[r]))return null;for(;r<i.length&&ie(i[r]);)n+=i[r++];for(;r<i.length;){let a=i[r];if(a==="."){if(n+=i[r++],r>=i.length||!ie(i[r]))return null;for(;r<i.length&&ie(i[r]);)n+=i[r++];}else if(a==="#"){if(n+=i[r++],r>=i.length||!ie(i[r]))return null;for(;r<i.length&&ie(i[r]);)n+=i[r++];}else if(a==="["){let o=1,s=false,u=null,l=false;for(n+=i[r++];r<i.length&&o>0;){let c=i[r];n+=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--,r++;}if(o!==0)return null}else break}for(;r<i.length&&Ye(i[r]);)n+=i[r++];if(r<i.length&&i[r]==="/")for(n+=i[r++];r<i.length&&Ye(i[r]);)n+=i[r++];if(r>=i.length||i[r]!==">")return null;n+=i[r++];}return n||null}function Ca(i,e){if(e>=i.length||i[e]!=="'"||e+1>=i.length||i[e+1].toLowerCase()!=="s")return false;if(e+2>=i.length)return true;let r=i[e+2];return Ye(r)||r==="*"||!ie(r)}function Aa(i,e){if(e>=i.length)return null;let t=i[e];if(!ba(t)||t==="'"&&Ca(i,e))return null;let n={'"':'"',"'":"'","`":"`","\u300C":"\u300D"}[t];if(!n)return null;let a=e+1,o=t,s=false;for(;a<i.length;){let u=i[a];if(o+=u,s)s=false;else if(u==="\\")s=true;else if(u===n)return o;a++;}return o}function xa(i,e){if(e>=i.length)return false;let t=i[e],r=i[e+1]||"",n=i[e+2]||"";if(t==="/"&&r!=="/"&&/[a-zA-Z0-9._-]/.test(r)||t==="/"&&r==="/"&&/[a-zA-Z]/.test(n)||t==="."&&(r==="/"||r==="."&&n==="/"))return true;let a=i.slice(e,e+8).toLowerCase();return !!(a.startsWith("http://")||a.startsWith("https://"))}function Sa(i,e){if(!xa(i,e))return null;let t=e,r="",n=/[a-zA-Z0-9/:._\-?&=%@+~!$'()*,;[\]]/;for(;t<i.length;){let a=i[t];if(a==="#"){if(r.length>0&&/[a-zA-Z0-9/.]$/.test(r))for(r+=a,t++;t<i.length&&/[a-zA-Z0-9_-]/.test(i[t]);)r+=i[t++];break}if(n.test(a))r+=a,t++;else break}return r.length<2?null:r}function Da(i,e){if(e>=i.length)return null;let t=i[e];if(!we(t)&&t!=="-"&&t!=="+")return null;let r=e,n="";if((i[r]==="-"||i[r]==="+")&&(n+=i[r++]),r>=i.length||!we(i[r]))return null;for(;r<i.length&&we(i[r]);)n+=i[r++];if(r<i.length&&i[r]===".")for(n+=i[r++];r<i.length&&we(i[r]);)n+=i[r++];return r<i.length&&(i.slice(r,r+2)==="ms"?n+="ms":(i[r]==="s"||i[r]==="m"||i[r]==="h")&&(n+=i[r])),n}var Ta=["===","!==","->","==","!=","<=",">=","&&","||","**","+=","-=","*=","/=","+","-","*","/","=",">","<","!","&","|","%","^","~"];new Set(Ta);var Ba=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 Pa(i){return i.includes("-")&&/^[\p{L}\p{N}_]+(-[\p{L}\p{N}_]+)+$/u.test(i)}var Fa=["click","dblclick","input","change","submit","keydown","keyup","keypress","mousedown","mouseup","mouseover","mouseout","mouseenter","mouseleave","mousemove","pointerdown","pointerup","pointermove","focus","blur","load","resize","scroll"],pt=class lt{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){Ea(e)&&e.setContext(ga(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=[],r=0;for(;r<e.length;){for(;r<e.length&&Ye(e[r]);)r++;if(r>=e.length)break;let n=this.tryMultiWordKeyword(e,r);if(n){t.push(n),r=n.position.end;continue}let a=false;for(let o of this.extractors)if(o.canExtract(e,r)){let s=o.extract(e,r);if(s){let u=s.metadata?.normalized,l=s.metadata?.stem,c=s.metadata?.stemConfidence,p={};if(s.metadata)for(let[m,f]of Object.entries(s.metadata))m!=="normalized"&&m!=="stem"&&m!=="stemConfidence"&&(p[m]=f);let d={};u&&(d.normalized=u),l&&(d.stem=l),c!==void 0&&(d.stemConfidence=c),Object.keys(p).length>0&&(d.metadata=p),t.push(Y(s.value,this.classifyToken(s.value),G(r,r+s.length),Object.keys(d).length>0?d:void 0)),r+=s.length,a=true;break}}if(!a){let o=e[r],s=this.classifyUnknownChar(o);t.push(Y(o,s,G(r,r+1))),r++;}}return new ae(this.mergeColonQualifiedNames(t),this.language)}mergeColonQualifiedNames(e){let t=[];for(let r of e){let n=t[t.length-1];if(n&&lt.ASCII_WORD.test(n.value)&&lt.COLON_QUALIFIER.test(r.value)&&n.position.end===r.position.start){let a=n.value+r.value;t[t.length-1]=Y(a,this.classifyToken(a),G(n.position.start,r.position.end));continue}t.push(r);}return t}classifyUnknownChar(e){return "()[]{},:;".includes(e)?"punctuation":"+-*/<>=!&|".includes(e)?"operator":"identifier"}tryPropertyAccess(e,t,r){if(e[t]!==".")return false;let n=r[r.length-1],a=n&&n.position.end<t;if(n&&!a&&(n.kind==="identifier"||n.kind==="keyword"||n.kind==="selector"))return r.push(Y(".","operator",G(t,t+1))),true;let u=t+1;for(;u<e.length&&ie(e[u]);)u++;return u<e.length&&e[u]==="("?(r.push(Y(".","operator",G(t,t+1))),true):false}initializeKeywordsFromProfile(e,t=[]){let r=new Map;if(this.rawExtraEntries=t,e.keywords){for(let[n,a]of Object.entries(e.keywords))if(r.set(a.primary,{native:a.primary,normalized:a.normalized||n}),a.alternatives)for(let o of a.alternatives)r.set(o,{native:o,normalized:a.normalized||n});}if(e.references){for(let[n,a]of Object.entries(e.references))r.set(a,{native:a,normalized:n});for(let n of Object.keys(e.references))r.has(n)||r.set(n,{native:n,normalized:n});}if(e.roleMarkers){for(let[n,a]of Object.entries(e.roleMarkers))if(a.primary&&r.set(a.primary,{native:a.primary,normalized:n}),a.alternatives)for(let o of a.alternatives)r.set(o,{native:o,normalized:n});}if(e.possessive?.keywords)for(let[n,a]of Object.entries(e.possessive.keywords))r.set(n,{native:n,normalized:a});for(let n of Fa)r.has(n)||r.set(n,{native:n,normalized:n});for(let n of t)r.set(n.native,n);this.profileKeywords=Array.from(r.values()).sort((n,a)=>a.native.length-n.native.length),this.multiWordKeywords=this.profileKeywords.filter(n=>(n.native.includes(" ")||Pa(n.native))&&!Ba.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 ct(e)}tryProfileKeyword(e,t){for(let r of this.profileKeywords)if(e.slice(t).startsWith(r.native))return Y(r.native,"keyword",G(t,t+r.native.length),r.normalized);return null}tryMultiWordKeyword(e,t,r=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&&r(o)))return Y(a.native,"keyword",G(t,t+a.native.length),a.normalized)}return null}isKeywordStart(e,t){let r=e.slice(t);return this.profileKeywords.some(n=>r.startsWith(n.native))}isKeywordStartAtBoundary(e,t,r=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||!r(o)})}lookupKeyword(e){let t=this.profileKeywordMap.get(e.toLowerCase());if(t)return t;let r=this.removeDiacritics(e);if(r!==e)return this.profileKeywordMap.get(r.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,r){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 Y(e,"keyword",G(t,r),o)}trySelector(e,t){let r=za(e,t);return r?Y(r,"selector",G(t,t+r.length)):null}tryEventModifier(e,t){if(e[t]!==".")return null;let r=e.slice(t).match(/^\.(?:once|debounce|throttle|queue)(?:\(([^)]+)\))?(?:\s|$|\.)/);if(!r)return null;let n=r[0].replace(/(\s|\.)$/,""),a=n.slice(1).split("(")[0],o=r[1];return {...Y(n,"event-modifier",G(t,t+n.length)),metadata:{modifierName:a,value:o?a==="queue"?o:parseInt(o,10):void 0}}}tryString(e,t){let r=Aa(e,t);return r?Y(r,"literal",G(t,t+r.length)):null}tryNumber(e,t){let r=Da(e,t);return r?Y(r,"literal",G(t,t+r.length)):null}tryMatchTimeUnit(e,t,r,n=false){let a=t;if(n)for(;a<e.length&&Ye(e[a]);)a++;let o=e.slice(a);for(let s of r){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(ie(c))continue}return {suffix:s.suffix,endPos:a+s.length}}}return null}parseBaseNumber(e,t,r=true){let n=t,a="";if(r&&(e[n]==="-"||e[n]==="+")&&(a+=e[n++]),n>=e.length||!we(e[n]))return null;for(;n<e.length&&we(e[n]);)a+=e[n++];if(n<e.length&&e[n]===".")for(a+=e[n++];n<e.length&&we(e[n]);)a+=e[n++];return !a||a==="-"||a==="+"?null:{number:a,endPos:n}}tryNumberWithTimeUnits(e,t,r,n={}){let{allowSign:a=true,skipWhitespace:o=false}=n,s=this.parseBaseNumber(e,t,a);if(!s)return null;let{number:u,endPos:l}=s,c=[...r,...lt.STANDARD_TIME_UNITS],p=this.tryMatchTimeUnit(e,l,c,o);return p&&(u+=p.suffix,l=p.endPos),Y(u,"literal",G(t,l))}tryUrl(e,t){let r=Sa(e,t);return r?Y(r,"url",G(t,t+r.length)):null}tryVariableRef(e,t){if(e[t]!==":"||t+1>=e.length||!ie(e[t+1]))return null;let r=t+1;for(;r<e.length&&ie(e[r]);)r++;let n=e.slice(t,r);return Y(n,"identifier",G(t,r))}tryOperator(e,t){let r=e.slice(t,t+2);if(["==","!=","<=",">=","&&","||","->"].includes(r))return Y(r,"operator",G(t,t+2));let n=e[t];return ["<",">","!","+","-","*","/","="].includes(n)?Y(n,"operator",G(t,t+1)):["(",")","{","}",",",";",":"].includes(n)?Y(n,"punctuation",G(t,t+1)):null}tryMultiCharParticle(e,t,r){for(let n of r)if(e.slice(t,t+n.length)===n)return Y(n,"particle",G(t,t+n.length));return null}};pt.ASCII_WORD=/^[A-Za-z_][A-Za-z0-9_]*$/;pt.COLON_QUALIFIER=/^:[A-Za-z_][A-Za-z0-9_]*$/;pt.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 br=pt;var Ra=Object.defineProperty,Oa=Object.getOwnPropertyNames,qr=(i,e)=>function(){return i&&(e=(0, i[Oa(i)[0]])(i=0)),e},_a=(i,e)=>{for(var t in e)Ra(i,t,{get:e[t],enumerable:true});};function wr(i,e){return i.replace(/\{(\w+)\}/g,(t,r)=>String(e[r]??`{${r}}`))}function ne(i,e,t={},r){let n=Vr[i],a=wr(n,t),o=Wr[i],s=o?wr(o,t):void 0;return {code:i,message:a,severity:e,...r&&{role:r},...s&&{suggestion:s}}}var P,Vr,Wr,Na=qr({"src/generators/schema-error-codes.ts"(){P={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"},Vr={[P.AMBIGUOUS_TYPE_LITERAL_SELECTOR]:"Role '{role}' accepts both 'literal' and 'selector'. This may cause ambiguous type inference for values starting with special characters (* . # etc.).",[P.TOO_MANY_EXPECTED_TYPES]:"Role '{role}' accepts {count} different types. This may make type inference unreliable.",[P.MULTI_TYPE_PATIENT_EXPECTED]:"Role '{role}' accepts multiple types (expected for {command} command).",[P.NO_REQUIRED_ROLES]:"Command has no required roles. Is this intentional?",[P.NO_REQUIRED_ROLES_EXPECTED]:"Command has no required roles (expected for {command}).",[P.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.",[P.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.",[P.EVENT_HANDLER_MISSING_EVENT]:"Event handler command should have an 'event' role to specify which event to listen for.",[P.EVENT_HANDLER_EVENT_NOT_REQUIRED]:"Event role should be required - every event handler needs an event to listen for.",[P.CONDITIONAL_MISSING_CONDITION]:"Conditional command should have a 'condition' role for the boolean expression.",[P.CONDITIONAL_CONDITION_NOT_REQUIRED]:"Condition role should be required - conditionals need a condition to evaluate.",[P.FOR_LOOP_MISSING_SOURCE]:"For-loop should have a 'source' role for the collection to iterate over.",[P.WHILE_LOOP_MISSING_CONDITION]:"While-loop should have a 'condition' role for the loop condition.",[P.VALUE_TYPE_MISMATCH]:"Role '{role}' of command '{command}' expects type [{expectedTypes}], got '{actualType}'.",[P.SELECTOR_KIND_MISMATCH]:"Role '{role}' of command '{command}' expects selector kind [{selectorKinds}], got '{actualKind}'.",[P.SELECTOR_KINDS_WITHOUT_SELECTOR_TYPE]:"Role '{role}' has selectorKinds but expectedTypes does not include 'selector'.",[P.KEYWORD_COLLISION]:"Keyword '{keyword}' is used by multiple commands: {commands}. Only the first-registered command will be reachable."},Wr={[P.AMBIGUOUS_TYPE_LITERAL_SELECTOR]:"Consider being more specific about which type is expected, or use explicit type markers.",[P.TOO_MANY_EXPECTED_TYPES]:"Consider narrowing the accepted types to improve type inference reliability.",[P.TRANSITION_PATIENT_ACCEPTS_SELECTOR]:"Remove 'selector' from expectedTypes and only accept 'literal'.",[P.TRANSITION_MISSING_GOAL]:"Add a 'goal' role with expectedTypes ['literal', 'variable'].",[P.EVENT_HANDLER_MISSING_EVENT]:"Add an 'event' role with expectedTypes ['literal'].",[P.EVENT_HANDLER_EVENT_NOT_REQUIRED]:"Set required: true on the 'event' role.",[P.CONDITIONAL_MISSING_CONDITION]:"Add a 'condition' role with expectedTypes ['expression'].",[P.CONDITIONAL_CONDITION_NOT_REQUIRED]:"Set required: true on the 'condition' role.",[P.FOR_LOOP_MISSING_SOURCE]:"Add a 'source' role for the collection to iterate over.",[P.WHILE_LOOP_MISSING_CONDITION]:"Add a 'condition' role for the loop continuation condition.",[P.VALUE_TYPE_MISMATCH]:"Ensure the value matches one of the expected types: [{expectedTypes}].",[P.SELECTOR_KIND_MISMATCH]:"Use a selector of the correct kind: [{selectorKinds}].",[P.SELECTOR_KINDS_WITHOUT_SELECTOR_TYPE]:"Either add 'selector' to expectedTypes or remove selectorKinds.",[P.KEYWORD_COLLISION]:"Give each command a unique keyword. Move the shared keyword to alternatives on one command, or use a more specific translation."};}}),Hr={};_a(Hr,{SchemaErrorCodes:()=>P,formatValidationResults:()=>Va,getValidationStats:()=>Wa,validateAllKeywordCollisions:()=>Ua,validateAllSchemas:()=>qa,validateCommandSchema:()=>Kr,validateKeywordCollisions:()=>Ur,validateRoleValues:()=>Ha});function La(i,e){return {action:i,items:e}}function Kr(i){let e=[];for(let r of i.roles)r.expectedTypes.includes("literal")&&r.expectedTypes.includes("selector")&&(r.role==="patient"&&Ft.has(i.action)?e.push(ne(P.MULTI_TYPE_PATIENT_EXPECTED,"note",{role:r.role,command:i.action},r.role)):e.push(ne(P.AMBIGUOUS_TYPE_LITERAL_SELECTOR,"warning",{role:r.role},r.role))),r.expectedTypes.length>3&&!Ft.has(i.action)&&e.push(ne(P.TOO_MANY_EXPECTED_TYPES,"warning",{role:r.role,count:r.expectedTypes.length},r.role));for(let r of i.roles)r.selectorKinds&&r.selectorKinds.length>0&&(r.expectedTypes.includes("selector")||e.push(ne(P.SELECTOR_KINDS_WITHOUT_SELECTOR_TYPE,"warning",{role:r.role},r.role)));switch(i.action){case "transition":Ia(i,e);break;case "on":Ma(i,e);break;case "if":case "unless":$a(i,e);break;case "repeat":case "for":case "while":ja(i,e);break}return i.roles.filter(r=>r.required).length===0&&(Gr.has(i.action)?e.push(ne(P.NO_REQUIRED_ROLES_EXPECTED,"note",{command:i.action})):e.push(ne(P.NO_REQUIRED_ROLES,"warning",{}))),La(i.action,e)}function Ia(i,e){let t=i.roles.find(n=>n.role==="patient"),r=i.roles.find(n=>n.role==="goal");t&&!r&&e.push(ne(P.TRANSITION_MISSING_GOAL,"error",{}));}function Ma(i,e){let t=i.roles.find(r=>r.role==="event");t||e.push(ne(P.EVENT_HANDLER_MISSING_EVENT,"warning",{})),t&&!t.required&&e.push(ne(P.EVENT_HANDLER_EVENT_NOT_REQUIRED,"warning",{}));}function $a(i,e){let t=i.roles.find(r=>r.role==="condition");t||e.push(ne(P.CONDITIONAL_MISSING_CONDITION,"warning",{})),t&&!t.required&&e.push(ne(P.CONDITIONAL_CONDITION_NOT_REQUIRED,"warning",{}));}function ja(i,e){i.action==="for"?i.roles.find(r=>r.role==="source")||e.push(ne(P.FOR_LOOP_MISSING_SOURCE,"warning",{})):i.action==="while"&&(i.roles.find(r=>r.role==="condition")||e.push(ne(P.WHILE_LOOP_MISSING_CONDITION,"warning",{})));}function qa(i,e={}){let t=new Map,{includeNotes:r=false}=e;for(let[n,a]of Object.entries(i)){let o=Kr(a),s=o.items.some(l=>l.severity==="warning"||l.severity==="error"),u=r&&o.items.some(l=>l.severity==="note");(s||u)&&t.set(n,o);}return t}function Va(i,e={}){let t=[],{showNotes:r=false,showCodes:n=true}=e;for(let[a,o]of i){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 p=n?` [${c.code}]`:"";t.push(` ERROR${p}: ${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 p=n?` [${c.code}]`:"";t.push(` ${p?`${c.code}: `:""}${c.message}`),c.suggestion&&t.push(` \u{1F4A1} ${c.suggestion}`);}}if(r&&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 Wa(i){let e=0,t=0,r=0,n={};for(let a of i.values())for(let o of a.items)o.severity==="error"?e++:o.severity==="warning"?t++:o.severity==="note"&&r++,n[o.code]=(n[o.code]||0)+1;return {totalCommands:i.size,errors:e,warnings:t,notes:r,byCode:n}}function Ha(i,e){let t=[];for(let r of e){let n=i.roles.find(a=>a.role===r.role);n&&(n.expectedTypes.length>0&&!n.expectedTypes.includes(r.type)&&(n.expectedTypes.includes("expression")||t.push({level:"error",role:r.role,message:`${i.action}.${r.role} expects type [${n.expectedTypes.join(", ")}], got '${r.type}'`,code:P.VALUE_TYPE_MISMATCH})),r.type==="selector"&&r.selectorKind&&n.selectorKinds&&n.selectorKinds.length>0&&(n.selectorKinds.includes(r.selectorKind)||t.push({level:"error",role:r.role,message:`${i.action}.${r.role} expects selector kind [${n.selectorKinds.join(", ")}], got '${r.selectorKind}'`,code:P.SELECTOR_KIND_MISMATCH})));}return t}function Ka(i){if(i.length!==2)return false;let[e,t]=[...i].sort();return Yr.some(([r,n])=>r===e&&n===t)}function Ur(i){let e=[];if(!i.keywords)return {language:i.code,collisions:e};let t=new Map;for(let[n,a]of Object.entries(i.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 s of a.alternatives){let u=t.get(s)||[];u.push({command:n,isPrimary:false}),t.set(s,u);}}for(let[n,a]of t){let o=[...new Set(a.map(l=>l.command))];if(o.length<=1||Ka(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:n,commands:o.sort(),type:u});}let r={"primary-primary":0,"primary-alternative":1,"alternative-alternative":2};return e.sort((n,a)=>r[n.type]-r[a.type]),{language:i.code,collisions:e}}function Ua(i){let e=[];for(let[,t]of Object.entries(i)){let r=Ur(t);r.collisions.length>0&&e.push(r);}return e.sort((t,r)=>t.language.localeCompare(r.language))}var Ft,Gr,Yr,Ga=qr({"src/generators/schema-validator.ts"(){Na(),Ft=new Set(["put","append","prepend","log","throw","make","measure","return","swap","morph","beep","copy"]),Gr=new Set(["compound","else","halt","continue","async","init","settle","focus","blur","return","js","measure","break","exit","beep","empty","open","close","select","clear","reset","breakpoint","live","eventsource","socket","worker","intercept"]),Yr=[["change","changes"]];}});function xe(i){let e=i.roles.find(t=>t.role==="destination");return e?{destination:e.default?{fromRole:"destination",default:e.default}:{fromRole:"destination"}}:{}}function Se(i){let e=i.roles.find(t=>t.role==="source");return e?{source:e.default?{fromRole:"source",default:e.default}:{fromRole:"source"}}:{}}function De(i,e){return jt(i,e,"source")}function $t(i,e){return jt(i,e,"destination")}function Ya(i,e){return jt(i,e,"patient")}function jt(i,e,t){if(!e||!i.roles.some(a=>a.role===t))return [];let r=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,r]:[r,n]}]}var Za={action:"toggle",description:"Toggle a class or attribute on/off",category:"dom-class",primaryRole:"patient",ast:{args:["patient"],modifiers:{on:"destination",for:"duration"}},argSkipTokens:["on"],roles:[{role:"patient",description:"The class or attribute to toggle",required:true,expectedTypes:["selector"],selectorKinds:["class","attribute"],svoPosition:1,sovPosition:2,markerOptional:{zh:true}},{role:"destination",description:"The target element (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:2,sovPosition:1,markerVariants:{ko:["\uC5D0\uC11C"]}},{role:"duration",description:"How long the class stays on before reverting (`toggle .a for 2s`)",required:false,expectedTypes:["literal"],svoPosition:3,sovPosition:3,valueShape:"time",markerOverride:{en:"for",ja:"\u9593",ko:"\uB3D9\uC548"}}],errorCodes:["MISSING_ARGUMENT","NO_VALID_CLASS_NAMES","INVALID_CSS_PROPERTY"],preconditions:[{condition:"Command has at least one argument",errorCode:"MISSING_ARGUMENT",message:"toggle command requires an argument"},{condition:"Class names are valid CSS identifiers",errorCode:"NO_VALID_CLASS_NAMES",message:"toggle command: no valid class names found"}],recoveryHints:{MISSING_ARGUMENT:"Add a class selector (.classname) or attribute to toggle",NO_VALID_CLASS_NAMES:"Ensure class names start with a dot (.) and are valid CSS identifiers",INVALID_CSS_PROPERTY:"Check CSS property name syntax (use kebab-case)"}},Xa={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"}},Qa={action:"remove",description:"Remove a class or attribute from an element",category:"dom-class",primaryRole:"patient",ast:{args:["patient"],modifiers:{from:"source"}},targetRole:"source",argSkipTokens:["from"],roles:[{role:"patient",description:"The class/attribute to remove, or the element to remove",required:true,expectedTypes:["selector","reference"],svoPosition:1,sovPosition:2},{role:"source",description:"The element to remove from (defaults to me)",required:false,expectedTypes:["selector","reference","expression"],default:{type:"reference",value:"me"},svoPosition:2,sovPosition:1}],errorCodes:["MISSING_ARGUMENT","NO_VALID_CLASS_NAMES"],preconditions:[{condition:"Command has at least one argument",errorCode:"MISSING_ARGUMENT",message:"remove command requires an argument"}],recoveryHints:{MISSING_ARGUMENT:"Add a class selector (.classname) or attribute to remove",NO_VALID_CLASS_NAMES:"Ensure class names start with a dot (.) and are valid CSS identifiers"}},Ja={action:"put",description:"Put content into a target element or variable",category:"dom-content",primaryRole:"patient",roles:[{role:"patient",description:"The content to put",required:true,expectedTypes:["literal","selector","reference","expression"],svoPosition:1,sovPosition:1},{role:"destination",description:"Where to put the content",required:true,expectedTypes:["selector","reference"],svoPosition:2,sovPosition:2,markerOverride:{en:"into",ar:"\u0641\u064A",zh:"\u5230",fr:"dans",de:"in",he:"\u05D1",id:"ke",sw:"kwa"},markerVariants:{en:["before","after"]},markerLegacy:{ar:["\u0639\u0644\u0649","\u0625\u0644\u0649","\u0628"],zh:["\u5728","\u4E8E"],fr:["sur","\xE0"],de:["auf","zu"],he:["\u05E2\u05DC","\u05D0\u05DC","\u05DC"],id:["pada","di"],sw:["kwenye"]},methodCarrier:"method"}],errorCodes:["MISSING_ARGUMENTS","MISSING_CONTENT","MISSING_POSITION","INVALID_POSITION","NO_TARGET","NO_ELEMENTS"],preconditions:[{condition:"Command has content and position arguments",errorCode:"MISSING_ARGUMENTS",message:"put requires arguments"},{condition:"Content to put is specified",errorCode:"MISSING_CONTENT",message:"put requires content"},{condition:"Position keyword is specified (into, before, after, etc.)",errorCode:"MISSING_POSITION",message:"put requires position keyword"}],recoveryHints:{MISSING_ARGUMENTS:"Use syntax: put <content> into/before/after <target>",MISSING_CONTENT:"Add content to put (string, element, or expression)",MISSING_POSITION:"Add position keyword: into, before, after, at start of, at end of",INVALID_POSITION:"Valid positions: into, before, after, at start of, at end of",NO_TARGET:'Ensure target element exists or use "me" reference',NO_ELEMENTS:"Check that the selector matches existing elements"}},en={action:"set",description:"Set a property or variable to a value",category:"variable",primaryRole:"destination",ast:{args:["destination"],modifiers:{to:"patient",on:"scope"}},argSkipTokens:["to"],roles:[{role:"destination",description:"The property or variable to set",required:true,expectedTypes:["selector","reference","expression","property-path"],svoPosition:1,sovPosition:1,markerOverride:{en:"",es:"",ja:"\u3092",ko:"\uB97C",tr:"i",ar:"",sw:"",tl:"",th:"",bn:"\u0995\u09C7",qu:"ta",hi:"\u0915\u094B",zh:"\u628A"},markerOptional:{zh:true}},{role:"patient",description:"The value to set",required:true,expectedTypes:["literal","expression","reference"],svoPosition:2,sovPosition:2,markerOverride:{en:"to",es:"a",pt:"para",fr:"\xE0",de:"auf",id:"ke",ja:"\u306B",ko:"\uC5D0",tr:"e",ar:"\u0625\u0644\u0649",sw:"kwenye",tl:"sa",th:"\u0E43\u0E19",bn:"\u09A4\u09C7",qu:"man",hi:"\u092E\u0947\u0902",zh:"\u5230"},markerVariants:{tr:["e","a","ye","ya"],zh:["\u4E3A","\u70BA","\u6210"]}},{role:"scope",description:"The element(s) the attribute/property is set on (defaults to me)",required:false,expectedTypes:["selector","reference"],svoPosition:3,sovPosition:3,markerOverride:{en:"on",es:"on",pt:"on",fr:"on",de:"on",it:"on",id:"on",ms:"on",sw:"on",tl:"on",zh:"on",vi:"on",ru:"on",uk:"on",pl:"on",th:"on",he:"on",ar:"on",ja:"on",ko:"on",tr:"on",hi:"on",bn:"on",qu:"on"}}],errorCodes:["MISSING_TARGET","INVALID_TARGET","MISSING_VALUE","INVALID_SYNTAX"],preconditions:[{condition:"Command has a target variable or property",errorCode:"MISSING_TARGET",message:"set command requires a target"},{condition:"Target is a valid variable or property reference",errorCode:"INVALID_TARGET",message:"set command target must be a string or object literal"},{condition:'Value is specified with "to" keyword',errorCode:"MISSING_VALUE",message:'set command requires a value (use "to" keyword)'}],recoveryHints:{MISSING_TARGET:"Add a target: set :variable to value OR set element.property to value",INVALID_TARGET:'Use local variable (:name), element property (el.prop), or "the X of Y" syntax',MISSING_VALUE:'Add "to <value>" to specify what to set',INVALID_SYNTAX:"Use syntax: set <target> to <value>"}},tn={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>"}},rn={action:"live",description:"Reactive block: re-run the body when its dependencies change",category:"control-flow",primaryRole:"patient",hasBody:true,bareKeyword:true,roles:[]},an={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}]},nn={action:"eventsource",description:"Open a Server-Sent Events stream and handle its events",category:"async",primaryRole:"patient",hasBody:true,bareKeyword:true,roles:[]},on={action:"socket",description:"Open a WebSocket and handle its messages",category:"async",primaryRole:"patient",hasBody:true,bareKeyword:true,roles:[]},sn={action:"worker",description:"Define a Web Worker with inline methods",category:"async",primaryRole:"patient",hasBody:true,bareKeyword:true,roles:[]},un={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:"duration"}},roles:[{role:"patient",description:"The element to show",required:true,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:1,sovPosition:1},{role:"style",description:"Animation style (fade, slide, etc.)",required:false,expectedTypes:["literal"],svoPosition:2,sovPosition:2}]},cn={action:"hide",description:"Make an element invisible",category:"dom-visibility",primaryRole:"patient",ast:{args:[["destination","patient"]],modifiers:{with:"duration"}},roles:[{role:"patient",description:"The element to hide",required:true,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:1,sovPosition:1},{role:"style",description:"Animation style (fade, slide, etc.)",required:false,expectedTypes:["literal"],svoPosition:2,sovPosition:2}]},pn={action:"on",description:"Handle an event",category:"event",primaryRole:"event",ast:{args:["event"],modifiers:{from:"source"}},hasBody:true,roles:[{role:"event",description:"The event to handle",required:true,expectedTypes:["literal"],svoPosition:1,sovPosition:2},{role:"source",description:"The element to listen on (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:2,sovPosition:1}],widenTypeVariants:[{role:"event",types:["literal","expression"],idSuffix:"expr-event",excludeLanguages:["ko"]}]},dn={action:"trigger",description:"Trigger/dispatch an event",category:"event",primaryRole:"event",ast:{args:["event"],modifiers:{on:"destination"}},argSkipTokens:["on"],roles:[{role:"event",description:"The event to trigger (supports namespaced events like draggable:start)",required:true,expectedTypes:["literal","expression"],svoPosition:1,sovPosition:2,markerVariants:{hi:["\u0915\u094B"],qu:["ta"],bn:["\u0995\u09C7"]},markerOverride:{bn:"\u0995\u09C7",hi:"\u0915\u094B"}},{role:"destination",description:"The target element (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:2,sovPosition:1}]},mn={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}]},fn={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}]},yn={action:"increment",description:"Increment a numeric value",category:"variable",primaryRole:"patient",ast:{args:[["destination","patient"]],modifiers:{by:"quantity"}},roles:[{role:"patient",description:"The value to increment",required:true,expectedTypes:["selector","reference","expression"],svoPosition:1,sovPosition:1},{role:"quantity",description:"Amount to increment by (defaults to 1)",required:false,expectedTypes:["literal"],default:{type:"literal",value:1,dataType:"number"},svoPosition:2,sovPosition:2,markerOverride:{en:"by",es:"por",pt:"por",fr:"par",de:"um"}}]},vn={action:"decrement",description:"Decrement a numeric value",category:"variable",primaryRole:"patient",ast:{args:[["destination","patient"]],modifiers:{by:"quantity"}},roles:[{role:"patient",description:"The value to decrement",required:true,expectedTypes:["selector","reference","expression"],svoPosition:1,sovPosition:1},{role:"quantity",description:"Amount to decrement by (defaults to 1)",required:false,expectedTypes:["literal"],default:{type:"literal",value:1,dataType:"number"},svoPosition:2,sovPosition:2,markerOverride:{en:"by",es:"por",pt:"por",fr:"par",de:"um"}}]},hn={action:"append",description:"Append content to an element",category:"dom-content",primaryRole:"patient",ast:{args:["patient"],modifiers:{to:"destination"}},omitRoleVariants:["destination"],roles:[{role:"patient",description:"The content to append",required:true,expectedTypes:["literal","selector","reference","expression"],svoPosition:1,sovPosition:2},{role:"destination",description:"The element to append to",required:true,expectedTypes:["selector","reference","expression"],svoPosition:2,sovPosition:1,markerOverride:{en:"to"}}]},En={action:"prepend",description:"Prepend content to an element",category:"dom-content",primaryRole:"patient",ast:{args:["patient"],modifiers:{to:"destination"}},omitRoleVariants:["destination"],roles:[{role:"patient",description:"The content to prepend",required:true,expectedTypes:["literal","selector","reference","expression"],svoPosition:1,sovPosition:2},{role:"destination",description:"The element to prepend to",required:true,expectedTypes:["selector","reference","expression"],svoPosition:2,sovPosition:1,markerOverride:{en:"to"}}]},gn={action:"log",description:"Log a value to the console",category:"variable",primaryRole:"patient",ast:{args:["patient"]},roles:[{role:"patient",description:"The value to log",required:true,expectedTypes:["literal","selector","reference","expression"],svoPosition:1,sovPosition:1}]},kn={action:"get",description:"Get a value from a source",category:"variable",primaryRole:"source",ast:{args:[["source","patient"]]},roles:[{role:"source",description:"The source to get from",required:true,expectedTypes:["selector","reference","expression"],svoPosition:1,sovPosition:2,markerOverride:{en:"",es:"",pt:"",fr:"",de:"",ja:"\u3092",zh:"",ko:"\uB97C",ar:"\u0639\u0644\u0649",tr:"i",id:"",he:"\u05D0\u05EA",sw:"",tl:"",bn:"\u0995\u09C7",qu:"ta"}},{role:"destination",description:"Where to store the result (optional)",required:false,expectedTypes:["reference"],svoPosition:2,sovPosition:1}]},bn={action:"take",description:"Take content from a source element",category:"dom-content",primaryRole:"patient",ast:{args:["patient"],modifiers:{from:"source",for:"recipient"}},argSkipTokens:["from"],roles:[{role:"patient",description:"The class or element to take",required:true,expectedTypes:["selector"],svoPosition:1,sovPosition:2},{role:"source",description:"The element to take from (defaults to all current holders)",required:false,expectedTypes:["selector","reference"],svoPosition:2,sovPosition:1},{role:"recipient",description:"The element the class moves ONTO (`take .active from .tab for me`)",required:false,expectedTypes:["reference"],svoPosition:3,sovPosition:3,valueShape:"reference",markerOverride:{en:"for"}}]},wn={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}]},zn={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}]},Cn={action:"settle",description:"Wait for animations/transitions to settle",category:"async",primaryRole:"patient",ast:{args:[["destination","patient"]],isBlocking:true},roles:[{role:"patient",description:"The element to settle (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:1,sovPosition:1}]},An={action:"throw",description:"Throw an error",category:"control-flow",primaryRole:"patient",ast:{args:["patient"]},roles:[{role:"patient",description:"The error message or object to throw",required:true,expectedTypes:["literal","expression"],svoPosition:1,sovPosition:1}]},xn={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"}}]},Sn={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}]},Dn={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}]},Tn={action:"else",description:"Else branch of conditional",category:"control-flow",primaryRole:"patient",hasBody:true,roles:[]},Bn={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"'},Pn={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"}}]},Fn={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}]},Rn={action:"continue",description:"Continue to next loop iteration",category:"control-flow",primaryRole:"patient",ast:{},roles:[]},qt={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"},On={action:"go",description:"Navigate to a URL",category:"navigation",primaryRole:"destination",roles:[{role:"destination",description:"The URL to navigate to",required:true,expectedTypes:["literal","expression"],svoPosition:1,sovPosition:1,markerOverride:{en:"to",es:"a",ar:"\u0625\u0644\u0649",fr:"\xE0",de:"zu",pt:"para",he:"\u05D0\u05DC",hi:"\u092A\u0930",id:"ke",it:"a",ru:"\u043D\u0430",sw:"kwa",uk:"\u043D\u0430"},renderOverride:{en:"",zh:"",vi:"",th:""},markerOptional:{en:true,zh:true,vi:true,th:true},markerVariants:{zh:["\u628A"]},markerLegacy:{es:["en","sobre","hacia"],ar:["\u0639\u0644\u0649","\u0641\u064A","\u0628"],fr:["sur","dans"],de:["auf","in"],pt:["em","a"],he:["\u05E2\u05DC","\u05D1","\u05DC","\u05D0\u05EA"],hi:["\u092E\u0947\u0902"],id:["pada","di"],it:["in","su"],ru:["\u0432","\u043A"],sw:["kwenye"],uk:["\u0432","\u0434\u043E"]}}],rolePrefixLiteralVariants:[{role:"destination",literal:qt,idSuffix:"url",priorityDelta:5,methodCarrier:"method"}]},_n={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}]},Nn={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"}}]},Ln={action:"focus",description:"Focus an element",category:"dom-content",primaryRole:"patient",ast:{args:[["destination","patient"]]},roles:[{role:"patient",description:"The element to focus (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:1,sovPosition:1}]},In={action:"blur",description:"Remove focus from an element",category:"dom-content",primaryRole:"patient",ast:{args:[["destination","patient"]]},roles:[{role:"patient",description:"The element to blur (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:1,sovPosition:1}]},Mn={action:"empty",description:"Remove all children from an element (sets innerHTML to empty)",category:"dom-content",primaryRole:"patient",roles:[{role:"patient",description:"The element to empty (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:1,sovPosition:1}]},$n={action:"open",description:"Open a dialog, details element, or popover",category:"dom-content",primaryRole:"patient",ast:{args:["patient"],modifiers:{as:"style"}},roles:[{role:"patient",description:"The element to open (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:1,sovPosition:2},{role:"style",description:"Open-mode variant (modal / non-modal) for <dialog>",required:false,expectedTypes:["literal","expression"],svoPosition:2,sovPosition:1,markerOverride:{en:"as",ja:"\u3068\u3057\u3066"}}]},jn={action:"close",description:"Close a dialog, details element, or popover",category:"dom-content",primaryRole:"patient",roles:[{role:"patient",description:"The element to close (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:1,sovPosition:1}]},qn={action:"select",description:"Select the contents of a text field or DOM element",category:"dom-content",primaryRole:"patient",roles:[{role:"patient",description:"The element whose contents to select (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:1,sovPosition:1}]},Vn={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}]},Wn={action:"reset",description:"Reset a <form> element to its default values",category:"dom-content",primaryRole:"patient",roles:[{role:"patient",description:"The form element to reset (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:1,sovPosition:1}]},Hn={action:"breakpoint",description:"Drop into the debugger",category:"control-flow",primaryRole:"patient",roles:[],bareKeyword:true},Kn={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}]},Un={action:"return",description:"Return a value from a function",category:"control-flow",primaryRole:"patient",ast:{args:["patient"]},roles:[{role:"patient",description:"The value to return",required:false,expectedTypes:["literal","expression","reference"],svoPosition:1,sovPosition:1}]},Gn={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}]},Yn={action:"async",description:"Execute commands asynchronously",category:"async",primaryRole:"patient",ast:{},hasBody:true,roles:[]},Zn={action:"tell",description:"Execute commands in context of another element",category:"control-flow",primaryRole:"destination",ast:{args:[["destination","patient"]]},hasBody:true,roles:[{role:"destination",description:"The element to tell",required:true,expectedTypes:["selector","reference"],svoPosition:1,sovPosition:1,markerOverride:{en:"",he:"\u05D0\u05EA",zh:"\u628A"}}]},Xn={action:"default",description:"Set a default value for a variable",category:"variable",primaryRole:"destination",ast:{args:["destination"],modifiers:{to:"patient"}},roles:[{role:"destination",description:"The variable to set default for",required:true,expectedTypes:["selector","reference","expression","property-path"],svoPosition:1,sovPosition:1,markerOverride:{en:"",ar:"",tl:"",sw:"",bn:"\u0995\u09C7",qu:"ta",ja:"\u3092",ko:"\uB97C",tr:"i",hi:"\u0915\u094B",de:"",es:"",fr:"",it:"",pt:"",pl:"",ru:"",uk:"",vi:"",id:"",ms:"",th:"",zh:"\u628A",he:"\u05D0\u05EA"}},{role:"patient",description:"The default value",required:true,expectedTypes:["literal","expression"],svoPosition:2,sovPosition:2,markerOverride:{en:"to",ar:"\u0625\u0644\u0649",tl:"sa",sw:"kwa",bn:"\u09A4\u09C7",qu:"man",ja:"\u306B",ko:"\uC5D0",tr:"e",hi:"\u092E\u0947\u0902",de:"zu",es:"a",fr:"\xE0",it:"in",pt:"para",pl:"do",ru:"\u0432",uk:"\u0432",vi:"v\xE0o",id:"ke",ms:"ke",th:"\u0E43\u0E19",zh:"\u5230",he:"\u05E2\u05DC"}}]},Qn={action:"init",description:"Initialization block that runs once",category:"control-flow",primaryRole:"patient",ast:{},hasBody:true,roles:[]},Jn={action:"behavior",description:"Define a reusable behavior",category:"control-flow",primaryRole:"patient",ast:{args:["patient"]},hasBody:true,roles:[{role:"patient",description:"The behavior name (PascalCase identifier)",required:true,expectedTypes:["literal","reference","expression"],svoPosition:1,sovPosition:1}]},eo={action:"install",description:"Install a behavior on an element",category:"control-flow",primaryRole:"patient",ast:{args:["patient"],modifiers:{on:"destination"}},roles:[{role:"patient",description:"The behavior name to install",required:true,expectedTypes:["literal","reference","expression"],svoPosition:1,sovPosition:2},{role:"destination",description:"Element to install on (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:2,sovPosition:1}]},to={action:"measure",description:"Measure element dimensions (x, y, width, height, etc.)",category:"dom-content",primaryRole:"patient",ast:{args:["patient"],modifiers:{of:["destination","source"]}},roles:[{role:"patient",description:"Property to measure (x, y, width, height, top, left, etc.)",required:false,expectedTypes:["literal","expression"],svoPosition:1,sovPosition:1},{role:"source",description:"Element to measure (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:2,sovPosition:2,markerOverride:{en:"of"}}]},ro={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"},Vt={role:"manner",description:"Run the swap inside a `document.startViewTransition()` (`using view transition`)",required:false,expectedTypes:["literal","expression"],valueShape:"keyword",markerOverride:ro},io={action:"swap",description:"Swap DOM content using various strategies (innerHTML, outerHTML, delete, etc.)",category:"dom-content",primaryRole:"destination",ast:{args:["method","destination","patient"],modifiers:{viewTransition:"manner"}},roles:[{role:"method",description:"The swap strategy (innerHTML, outerHTML, beforebegin, afterend, delete)",required:false,expectedTypes:["literal"],svoPosition:1,sovPosition:3,markerOverride:{en:""}},{role:"destination",description:"The element to swap content in/for",required:true,expectedTypes:["selector","reference"],svoPosition:2,sovPosition:1,markerOverride:{en:"of",es:"",fr:"",pt:"",it:"",de:"",pl:"",ru:"",uk:"",id:"",ms:"",sw:"",th:"",vi:"",he:"\u05D0\u05EA",zh:"\u628A",tl:""}},{role:"patient",description:"The content to swap in (optional for delete)",required:false,expectedTypes:["literal","expression","selector"],svoPosition:3,sovPosition:2,markerOverride:{en:"with",es:"con",fr:"avec",pt:"com",it:"con",de:"mit",pl:"z",ru:"\u0441",uk:"\u0437",id:"dengan",ms:"dengan",sw:"na",th:"\u0E14\u0E49\u0E27\u0E22",vi:"v\u1EDBi",he:"\u05E2\u05DD",zh:"\u7528",hi:"\u0938\u0947",bn:"\u09A6\u09BF\u09AF\u09BC\u09C7",tr:"ile",qu:"wan",ar:"\u0628\u0640",tl:"nang"}},{...Vt,svoPosition:4,sovPosition:4}]},ao={action:"morph",description:"Morph an element into another using DOM diffing",category:"dom-content",primaryRole:"patient",ast:{args:[["source","destination"]],modifiers:{on:"patient",viewTransition:"manner"}},roles:[{role:"patient",description:"The element to morph",required:true,expectedTypes:["selector","reference"],svoPosition:1,sovPosition:1,markerOverride:{en:""}},{role:"destination",description:"The target content/element to morph into",required:true,expectedTypes:["literal","expression","selector","reference"],svoPosition:2,sovPosition:2,markerOverride:{en:"to"}},{...Vt,svoPosition:3,sovPosition:3}]},no={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}]},oo={action:"break",description:"Exit from the current loop",category:"control-flow",primaryRole:"patient",roles:[]},so={action:"copy",description:"Copy text or element content to the clipboard",category:"dom-content",primaryRole:"patient",roles:[{role:"patient",description:"The text or element to copy",required:true,expectedTypes:["literal","selector","reference","expression"],svoPosition:1,sovPosition:1}]},uo={action:"exit",description:"Exit from the current event handler",category:"control-flow",primaryRole:"patient",roles:[],bareKeyword:true},lo={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}]},co={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"}}]},po={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"},mo={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:qt}]},fo={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:qt}]},yo={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:po},{...Vt,svoPosition:2,sovPosition:2}]},vo={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}]},pe={toggle:Za,add:Xa,remove:Qa,put:Ja,set:en,show:ln,hide:cn,on:pn,trigger:dn,wait:mn,fetch:fn,increment:yn,decrement:vn,append:hn,prepend:En,log:gn,get:kn,take:bn,make:wn,halt:zn,settle:Cn,throw:An,send:xn,if:Sn,unless:Dn,else:Tn,repeat:Bn,for:Pn,while:Fn,continue:Rn,go:On,scroll:co,push:mo,replace:fo,process:yo,transition:_n,clone:Nn,focus:Ln,blur:In,empty:Mn,open:$n,close:jn,select:qn,clear:Vn,reset:Wn,breakpoint:Hn,call:Kn,return:Un,js:Gn,async:Yn,tell:Zn,default:Xn,init:Qn,behavior:Jn,install:eo,measure:to,swap:io,morph:ao,beep:no,break:oo,copy:so,exit:uo,pick:lo,render:vo,bind:tn,live:rn,when:an,eventsource:nn,socket:on,worker:sn,intercept:un,compound:{action:"compound",description:"A compound node representing chained statements",primaryRole:"patient",category:"control-flow",hasBody:true,roles:[]}};function re(i){return pe[i]}function ho(){return Object.values(pe).filter(i=>i.structuralOnly!==true&&(i.roles.length>0||i.bareKeyword===true))}typeof process<"u"&&process.env.LOKASCRIPT_SCHEMA_VALIDATION==="1"&&Promise.resolve().then(()=>(Ga(),Hr)).then(({validateAllSchemas:i,formatValidationResults:e})=>{let t=i(pe);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(i=>{console.debug("Schema validation skipped:",i);});var Ae=new Map,ve=new Map,Ne=new Map,Rt=null;function Zr(i,e){let t={...i};for(let r of Object.keys(e)){let n=e[r],a=i[r];n!==void 0&&(typeof n=="object"&&n!==null&&!Array.isArray(n)&&typeof a=="object"&&a!==null&&!Array.isArray(a)?t[r]=Zr(a,n):t[r]=n);}return t}function Eo(i,e){return Zr(i,e)}function Wt(i){if(!i.extends)return i;let e=ve.get(i.extends);if(!e)return console.warn(`[Registry] Profile '${i.code}' extends '${i.extends}' but base is not registered. Make sure to import the base language before the variant.`),i;let t=Wt(e);return Eo(t,i)}function Xr(i,e,t){Ae.set(i,e),ve.set(i,t),Ne.delete(i);}function Qr(i){Rt=i;}var Ot=new Map;function Jr(i,e){Ot.set(i,e),Ne.delete(i);}function Ie(i){return i.split("-")[0]}function Me(i){return i.includes("-")}function go(i){let e=Ae.get(i);if(!e&&Me(i)){let t=Ie(i);e=Ae.get(t);}if(!e){let t=Array.from(Ae.keys()).join(", ");throw new Error(`Language '${i}' is not registered. Registered languages: ${t||"none"}. Import the language module first: import '@lokascript/semantic/languages/${i}';`)}return e}function ko(i){let e=ve.get(i);if(!e&&Me(i)){let t=Ie(i);e=ve.get(t);}if(!e){let t=Array.from(ve.keys()).join(", ");throw new Error(`Language profile '${i}' is not registered. Registered languages: ${t||"none"}. Import the language module first: import '@lokascript/semantic/languages/${i}';`)}return Wt(e)}function _(i){let e=ve.get(i);return !e&&Me(i)&&(e=ve.get(Ie(i))),e?Wt(e):void 0}function bo(){return Array.from(Ae.keys())}function ei(i){if(Ae.has(i)&&ve.has(i))return true;if(Me(i)){let e=Ie(i);return Ae.has(e)&&ve.has(e)}return false}function wo(i,e){return go(e).tokenize(i)}function ye(i){let e=Ne.get(i);if(!e&&Me(i)&&(e=Ne.get(Ie(i))),e)return e;let t=Ot.get(i);if(!t&&Me(i)&&(t=Ot.get(Ie(i))),t)return Ne.set(i,t),t;if(!Rt)throw new Error(`No patterns registered for language '${i}'. Either import the language module or set a pattern generator.`);let r=ko(i),n=Rt(r);return Ne.set(i,n),n}var ti={possessive:{specialForms:{me:"my",it:"its",you:"your"}}};function be(i){let e="complex";return i.startsWith("#")&&!i.includes(" ")?e="id":i.startsWith(".")&&!i.includes(" ")?e="class":i.startsWith("[")&&i.endsWith("]")?e="attribute":/^[a-z][a-z0-9]*$/i.test(i)&&(e="element"),{type:"selector",value:i,selectorKind:e}}function H(i,e){let t={type:"literal",value:i};return e!==void 0?{type:"literal",value:i,dataType:e}:t}function Oe(i){return xt(i)}function ce(i){return {type:"reference",value:i}}function Go(i,e){return e?{...i,position:e}:i}function ze(i,e,t){return t?{type:"property-path",object:i,property:e,access:t}:{type:"property-path",object:i,property:e}}function te(i,e,t){let r={kind:"command",action:i,roles:new Map(Object.entries(e))};return t!==void 0?{...r,metadata:t}:r}function Xe(i,e,t,r,n,a){let o=new Map;o.set("event",i);let s={kind:"event-handler",action:"on",roles:o,body:e};return t!==void 0&&(s.eventModifiers=t),r!==void 0&&(s.metadata=r),n!==void 0&&n.length>0&&(s.parameterNames=n),s}function Yo(i,e,t,r,n){let a={kind:"behavior",action:"behavior",roles:new Map,name:i,parameters:e,eventHandlers:t};return r!==void 0&&r.length>0&&(a.initBlock=r),n!==void 0&&(a.metadata=n),a}function Zo(i,e,t,r){let n={kind:"def",action:"def",roles:new Map,name:i,parameters:e,body:t};return r!==void 0&&(n.metadata=r),n}function _t(i,e,t,r,n){let a={kind:"feature",action:i,roles:n??new Map,body:e};return t!==void 0&&(a.name=t),r!==void 0&&(a.metadata=r),a}function Qe(i,e="then",t){let r={kind:"compound",action:"compound",roles:new Map,statements:i,chainType:e};return t!==void 0&&(r.metadata=t),r}function Xo(i,e,t,r){let n=new Map;n.set("condition",i);let a={kind:"conditional",action:"if",roles:n,thenBranch:e};return t!==void 0&&(a.elseBranch=t),r!==void 0&&(a.metadata=r),a}function dt(i,e){return !e||e.length===0||e.includes(i)||e.includes("expression")?true:i==="property-path"?e.some(t=>["selector","reference","expression"].includes(t)):i==="expression"?e.some(t=>["selector","reference","expression"].includes(t)):false}function Qo(i,e){let t=i.markerOverride?.[e.code],r=e.roleMarkers[i.role];if(t!==void 0){let n=Jo(i,e.code,t);return {primary:t,...n&&{alternatives:n},position:r?.position??"before",isOverride:true}}if(r&&r.primary){let n={primary:r.primary,position:r.position,isOverride:false};return r.alternatives&&(n.alternatives=r.alternatives),n}return null}function Jo(i,e,t){let r=i.markerLegacy?.[e];if(!r?.length)return;let n=[...new Set(r)].filter(a=>a&&a!==t);return n.length?n:void 0}function he(i,e,t){let r=i.markerLegacy?.[e]??[],n=i.methodCarrier?[]:i.markerVariants?.[e]??[],a=[...new Set([...r,...n])].filter(o=>o&&o!==t);return a.length?a:void 0}var ri=new Set(["destination","source","patient","object","event","eventmarker","manner","instrument"]);function me(i,e){let t=i.possessive?.keywords?.[e];if(t)return t;let r=i.possessive?.specialForms;if(r){for(let[n,a]of Object.entries(r))if(a===e)return n}}function St(i){return ti.possessive?.specialForms?.[i]??`${i}'s`}var Ht={ar:{\u0642\u064A\u0645\u0629:"value"},bn:{\u0985\u0995\u09CD\u09B7\u09AE:"disabled","\u099A\u09C7\u0995 \u0995\u09B0\u09BE":"checked",\u09A6\u09C8\u09B0\u09CD\u0998\u09CD\u09AF:"length",\u09AE\u09BE\u09A8:"value"},de:{wert:"value"},es:{valor:"value"},fr:{valeur:"value"},hi:{\u0905\u0915\u094D\u0937\u092E:"disabled",\u091A\u0947\u0915:"checked",\u091B\u093F\u092A\u093E:"hidden",\u092E\u093E\u0928:"value"},id:{nilai:"value"},it:{valore:"value"},ja:{\u5024:"value"},ko:{\uAC12:"value"},ms:{dilumpuhkan:"disabled",ditanda:"checked",nilai:"value",panjang:"length"},pl:{warto\u015B\u0107:"value"},pt:{valor:"value"},qu:{chanin:"value"},ru:{\u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435:"value",\u043E\u0442\u043A\u043B\u044E\u0447\u0435\u043D\u043E:"disabled",\u043E\u0442\u043C\u0435\u0447\u0435\u043D\u043E:"checked",\u0441\u043A\u0440\u044B\u0442\u043E:"hidden"},sw:{thamani:"value"},th:{\u0E04\u0E27\u0E32\u0E21\u0E22\u0E32\u0E27:"length",\u0E04\u0E48\u0E32:"value",\u0E1B\u0E34\u0E14\u0E43\u0E0A\u0E49\u0E07\u0E32\u0E19:"disabled",\u0E40\u0E25\u0E37\u0E2D\u0E01\u0E41\u0E25\u0E49\u0E27:"checked"},tl:{haba:"length",halaga:"value",hindi_pinagana:"disabled",naka_tsek:"checked"},tr:{de\u011Fer:"value"},uk:{\u0432\u0438\u043C\u043A\u043D\u0435\u043D\u043E:"disabled",\u0437\u043D\u0430\u0447\u0435\u043D\u043D\u044F:"value",\u043F\u043E\u0437\u043D\u0430\u0447\u0435\u043D\u043E:"checked",\u043F\u0440\u0438\u0445\u043E\u0432\u0430\u043D\u043E:"hidden"},vi:{\u1EA9n:"hidden","\u0111\u01B0\u1EE3c ch\u1ECDn":"checked","gi\xE1 tr\u1ECB":"value","v\xF4 hi\u1EC7u":"disabled"},zh:{\u503C:"value"}},es={ar:{\u0643\u0640:"as"},bn:{\u09B9\u09BF\u09B8\u09BE\u09AC\u09C7:"as"},de:{als:"as"},es:{como:"as"},fr:{comme:"as"},hi:{\u0915\u0947_\u0930\u0942\u092A_\u092E\u0947\u0902:"as"},id:{sebagai:"as"},it:{come:"as"},ja:{\u3068\u3057\u3066:"as"},ko:{\uB85C:"as"},ms:{sebagai:"as"},pl:{jako:"as"},pt:{como:"as"},qu:{hina:"as"},ru:{\u043A\u0430\u043A:"as"},sw:{kuwa:"as"},tl:{bilang:"as"},tr:{olarak:"as"},uk:{\u044F\u043A:"as"},vi:{nh\u01B0:"as"},zh:{\u4F5C\u4E3A:"as"}},ii={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 Nt(i,e){let t=e.value.toLowerCase(),r=(e.normalized??"").toLowerCase();if(t==="of"||t==="ng"||r==="of"||r==="source")return true;let n=i?.code?ii[i.code]:void 0;return !!n&&n.has(t)}var rs={destination:"in",source:"from"},is={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"])},as=new Set(["in","into","at","within","inside"]);function ns(i,e){let t=e.value.toLowerCase();if((i?.code?is[i.code]:void 0)?.has(t))return "in";let n=e.normalized??e.value,a=n.toLowerCase();return as.has(a)?"in":rs[a]??n}var Dt=new Set(["first","last","next","previous","random","closest"]),os={bn:{\u09B6\u09C7\u09B7:"last"}},Kt=new Set(Object.keys(pe).map(i=>i.toLowerCase()));function ai(i,e,t,r){let n=i[e];if(!n)return null;let a=(n.normalized??n.value).toLowerCase(),o=i[e+1],s=t?.code&&o?.kind==="selector"&&o.value.startsWith("<")?os[t.code]?.[n.value.toLowerCase()]:void 0;if(!Dt.has(a)&&!Dt.has(n.value.toLowerCase())&&s===void 0)return null;let u=[{text:s??n.normalized??n.value,token:n}],l=e+1,c=i[l];if(!c||c.kind!=="selector")return null;u.push({text:c.value,token:c}),l++;let p=0;for(;p++<8;){let f=i[l];if(f&&f.kind==="selector"&&f.value.startsWith("."))u.push({text:f.value,token:f}),l++;else break}let d=i[l],m=i[l+1];return d&&m&&m.kind==="selector"&&(d.kind==="keyword"||d.kind==="particle"||d.kind==="identifier")&&!Dt.has((d.normalized??d.value).toLowerCase())&&!Kt.has((d.normalized??d.value).toLowerCase())&&!(r?.(d)===true&&r(i[l+2])!==true)&&(u.push({text:ns(t,d),token:d}),u.push({text:m.value,token:m}),l+=2),{parts:u,consumed:l-e}}function ss(i,e){let t=es[i];return t?t[e.toLowerCase()]??e:e}function fe(i,e){let t=Ht[i];return t?t[e.toLowerCase()]??e:e}function us(i,e){return Ht[i]?.[e.toLowerCase()]!==void 0}function ls(i,e){let t=[e.value,e.normalized].filter(Boolean);for(let r of t){let n=me(i,r)??me(i,r.toLowerCase());if(n)return n}}function ni(i){return i.kind==="literal"||i.kind==="operator"||i.kind==="punctuation"?false:!/^[$:@#.*^(){}[\]]/.test(i.value)}function cs(i,e){let t=i?.references;if(!t)return false;let r=Object.values(t).filter(a=>typeof a=="string").map(a=>a.toLowerCase());return [e.value,e.normalized].filter(Boolean).some(a=>r.includes(a.toLowerCase()))}function Cr(i,e){return ni(i)?fe(e,i.value)!==i.value?true:i.kind==="identifier":false}var ps={ar:{\u0647\u0648:{beforePredicate:"is"}},hi:{\u0939\u0948:{beforePredicate:"is"},\u0928\u0939\u0940\u0902:{beforeBareIdentifier:"no"}},th:{\u0E40\u0E1B\u0E47\u0E19:{beforeTypeName:"as",beforePredicate:"is"}},ja:{\u7A7A:{afterCopula:"empty"}},zh:{\u6CA1\u6709:{beforeBareIdentifier:"no"}},tl:{walang:{beforeBareIdentifier:"no"},may:{afterSubject:"exists"}},bn:{\u0986\u099B\u09C7:{afterSubject:"exists"}},tr:{var:{afterSubject:"exists"}}},ds=new Set(["empty","null","undefined","true","false"]),oi=new Set(["Number","Int","Float","String","Date","Array","Object","JSON","json","FormData","HTML","Fragment","Values"]);function ms(i,e,t,r){let n=ps[i],a=n?.[e.value]??n?.[e.value.toLowerCase()];if(a){if(a.beforeTypeName&&r?.kind==="identifier"&&oi.has(r.value))return a.beforeTypeName;if(a.beforePredicate&&r&&(r.kind==="literal"||r.kind==="keyword"&&ds.has((r.normalized??"").toLowerCase())))return a.beforePredicate;if(a.beforeBareIdentifier&&r?.kind==="identifier"&&/^[A-Za-z_]\w*$/.test(r.value))return a.beforeBareIdentifier;if(a.afterSubject&&(t?.kind==="selector"||t?.kind==="reference"))return a.afterSubject;if(a.afterCopula&&t?.kind==="keyword"&&(t.normalized??"").toLowerCase()==="is")return a.afterCopula}}function Le(i,e){let t=e?.code??"en",r="",n,a=(s,u)=>{if(n===void 0){r=s,n=u;return}let c=n.position?.end!==void 0&&u.position?.start!==void 0&&n.position.end===u.position.start&&(s.startsWith(".")||s.startsWith("!"));r+=(c?"":" ")+s,n=u;},o=s=>s.kind==="keyword"?s.normalized??s.value:s.value;for(let s=0;s<i.length;s++){let u=i[s],l=e?ls(e,u):void 0,c=i[s+1];if(u.value==="'"&&n!==void 0&&c?.value==="s"&&u.position?.end!==void 0&&c.position?.start===u.position.end){r+="'s",n=c;let h=i[s+2];h&&fe(t,h.value)!==h.value?(a(fe(t,h.value),h),s+=2):s+=1;continue}if(l!==void 0&&c){let h=e?.possessive?.connectors,E=!!h?.length&&h.some(k=>{let A=k.toLowerCase();return A===c.value.toLowerCase()||A===(c.normalized??"").toLowerCase()}),y=E?s+2:s+1,v=i[y];if(v&&Cr(v,t)){a(St(l),u),a(fe(t,v.value),v),s=y;continue}if(E&&v&&/^\.[a-zA-Z_]\w*$/.test(v.value)&&c.position?.end!==void 0&&v.position?.start!==void 0&&c.position.end===v.position.start){a(St(l),u),a(fe(t,v.value.slice(1)),v),s=y;continue}if(!E&&/^\.[a-zA-Z_]\w*$/.test(c.value)&&u.position?.end!==void 0&&c.position?.start!==void 0&&u.position.end===c.position.start&&!cs(e,u)){a(St(l),u),a(fe(t,c.value.slice(1)),c),s+=1;continue}}let p=i[s+2];if(c&&p&&p.kind==="selector"&&Nt(e,c)&&ni(u)){a(fe(t,u.value),u),a("of",c),a(p.value,p),s+=2;continue}if(u.kind==="selector"&&c&&p&&Nt(e,c)&&Cr(p,t)&&fe(t,p.value)!==p.value){a(fe(t,p.value),p),a("of",c),a(u.value,u),s+=2;continue}let d=ai(i,s,e);if(d){for(let h of d.parts)a(h.text,h.token);s+=d.consumed-1;continue}let m=ms(t,u,i[s-1],c);if(m!==void 0){a(m,u);continue}let f=ss(t,u.value);if(f!==u.value){a(f,u);continue}a(o(u),u);}return r.trim()}var si=[{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 Ar(i,e,t,r){let n=si.find(o=>o.lang===i);if(!n)return false;let a=(o,s)=>(o??"").toLowerCase()===s.toLowerCase();return a(e,n.end)&&a(t,n.at)&&a(r,n.of)}function fs(i,e){let t=si.find(n=>n.lang===i);if(!t)return false;let r=e.toLowerCase();return r===t.at.toLowerCase()||r===t.of.toLowerCase()||r===t.end.toLowerCase()}var ui={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 ys(i){return ui[i]}function xr(i,e){return ui[e]?.has(i.toLowerCase())??false}var li=96,vs=/^[A-Za-z_][\w-]*$/,hs=/^[A-Za-z_][\w-]*:[^\s'"`/:][^\s]*$/;function ci(i,e){let t=i.peek(e);return !!t&&t.kind==="identifier"&&hs.test(t.value)}function pi(i,e){let t=i.peek(e);if(!t||t.kind!=="identifier"&&t.kind!=="keyword"||!vs.test(t.value))return false;let r=i.peek(e+1),n=i.peek(e+2);return !!r&&r.value===":"&&!!n}function Sr(i,e=0){return ci(i,e)||pi(i,e)}function Es(i){let e=i.peek();if(!e||e.value!=="{"&&e.value!=="(")return null;let t="",r=-1,n=0,a=0;for(;!i.isAtEnd()&&a++<li;){let o=i.advance();if(!o)break;if(r>=0&&o.position.start>r&&(t+=" ".repeat(o.position.start-r)),t+=o.value,r=o.position.end,o.value==="{"||o.value==="(")n++;else if((o.value==="}"||o.value===")")&&(n--,n===0))return t}return null}function Dr(i){let e=i.peek();return e?e.value==="{"||e.value==="("?Es(i):e.value===","||e.value===":"?null:(i.advance(),e.value):null}function Je(i,e){let t=i.mark(),r=[];if(e!==void 0){let a=i.peek();if(!a||a.value!==":"||!i.peek(1))return null;i.advance();let o=Dr(i);if(o===null)return i.reset(t),null;r.push(`${e}:${o}`);}else if(!Sr(i))return null;let n=0;for(;n++<li;){let a=i.peek();if(!a)break;if(a.value===","){if(r.length===0||!Sr(i,1))break;i.advance();continue}if(ci(i,0)){r.push(i.advance().value);continue}if(!pi(i,0))break;let o=i.advance().value;i.advance();let s=Dr(i);if(s===null)return i.reset(t),null;r.push(`${o}:${s}`);}return r.length===0?(i.reset(t),null):`{${r.join(", ")}}`}var mt=.8,gs=.6,ks=.15,bs=.5,Tr=.15,Br=.1,Pr=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"]),ws={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"]},zs=class{calculate(i){return this.calculateWithBreakdown(i).final}calculateWithBreakdown(i){let e=this.scoreRoleCoverage(i),t=this.scoreStemPenalty(i),r=this.scoreLanguageBoost(i),n=this.scoreLanguageAdjustment(i),a=e;return a=Math.max(bs,a+t),a=Math.min(1,a+r),a=Math.max(0,Math.min(1,a+n)),{roleCoverage:e,stemPenalty:t,languageBoost:r,languageAdjustment:n,final:a}}scoreRoleCoverage(i){let{pattern:e,captured:t}=i,r=0,n=0,a=l=>e.extraction?.[l]?.default!==void 0,o=e.command==="on"?e.extraction?.action?.value:void 0,s=pe[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)?(n+=1,r+=1):u(l.role)||(n+=1);else if(l.type==="group")for(let c of l.tokens)c.type==="role"&&(t.has(c.role)?(n+=mt,r+=mt):u(c.role)||(n+=mt,a(c.role)&&(r+=mt*gs)));return n>0?r/n:1}scoreStemPenalty(i){let{stemMatchCount:e,totalKeywordMatches:t}=i;return e<=0||t<=0?0:-(e/t)*ks}scoreLanguageBoost(i){let{pattern:e}=i;if(e.language!=="ar")return 0;let t=e.template.tokens[0];return !t||t.type!=="literal"?0:Pr.has(t.value)||t.alternatives?.some(r=>Pr.has(r))?Tr:0}scoreLanguageAdjustment(i){let{pattern:e,captured:t}=i;if(e.language!=="ar")return 0;let r=0;for(let[n,a]of t.entries()){let o=ws[n];if(!o||o.length===0)continue;let s="metadata"in a?a.metadata:void 0;s&&typeof s.prepositionValue=="string"&&(o.includes(s.prepositionValue)?r+=.1:r-=.1);}return Math.max(-Br,Math.min(Br,r))}},Cs=new zs,As=new Set(Object.values(pe).filter(i=>i.bareKeyword===true).map(i=>i.action));function xs(i){return i.startsWith("*")||i.startsWith("@")}var J=class I{constructor(e){this.matchCache=new Map,this.roleStarts=new Map,this.stemMatchCount=0,this.totalKeywordMatches=0,this.confidenceModel=e??Cs;}matchPattern(e,t){let r=e.mark(),n=new Map;if(this.currentProfile=_(t.language),this.currentPatternCommand=t.command,this.stemMatchCount=0,this.totalKeywordMatches=0,this.roleStarts=new Map,!this.matchTokenSequence(e,t.template.tokens,n))return e.reset(r),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()-r.position,confidence:o,roleStarts:this.roleStarts}}matchBest(e,t){this.matchCache.clear();let r=[],n=e.position();for(let o of t){let s=e.mark(),u=`${n}:${o.id}`,l;this.matchCache.has(u)?l=this.matchCache.get(u):(l=this.matchPattern(e,o),this.matchCache.set(u,l)),l&&r.push(l),e.reset(s);}if(r.length===0)return null;r.sort((o,s)=>{let u=s.pattern.priority-o.pattern.priority;return u!==0?u:s.confidence-o.confidence});let a=r[0];return this.matchPattern(e,a.pattern),a}matchTokenSequence(e,t,r,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 s=0;for(let u=0;u<t.length;u++){let l=t[u];if(s>0&&l.type==="literal"&&this.tryConsumeEventSourceClause(e,r,l),this.shouldTrySkippingVerbSlot(l,e,t[u+1]??n)){let p=e.mark(),d=new Map(r);if(this.matchTokenSequence(e,t.slice(u+1),d,n)&&this.atClauseEnd(e)){r.clear();for(let[m,f]of d)r.set(m,f);return true}e.reset(p);}let c=this.matchPatternToken(e,l,r,t[u+1]??n);if(s=l.type==="role"&&l.role==="event"?2:Math.max(0,s-1),!c){if(this.isOptional(l))continue;return false}}return true}tryConsumeEventSourceClause(e,t,r){if(t.has("source"))return;let n=e.peek(),a=e.peek(1);if(!n||!a||this.patternTokenWouldMatch(r,n))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(p=>p.toLowerCase()===c)},u=o?.position;if(u!=="after"&&s(n)&&a.kind==="selector"){e.advance();let l=this.tokenToSemanticValue(e.advance());l&&t.set("source",l);return}if(u==="after"&&n.kind==="selector"&&s(a)){let l=this.tokenToSemanticValue(n);e.advance(),e.advance(),l&&t.set("source",l);}}matchPatternToken(e,t,r,n){switch(t.type){case "literal":return this.matchLiteralToken(e,t);case "role":{let a=e.position(),o=this.matchRoleToken(e,t,r,n);return o&&r.has(t.role)&&this.roleStarts.set(t.role,a),o}case "group":return this.matchGroupToken(e,t,r,n);default:return false}}matchLiteralToken(e,t){let r=e.peek();if(!r)return false;let n=this.getMatchType(r,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(r,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 r=e.mark(),n=[];for(;;){let o=e.peek();if(!o||o.kind!=="identifier"&&o.kind!=="keyword")break;n.push(o.value),e.advance();let s=e.peek();if(!s||s.value!=="-")break;e.advance(),n.push("-");}if(n.length<3||n[n.length-1]==="-")return e.reset(r),null;let a=n.join("").toLowerCase();for(let[o,s]of Object.entries(t.keywords))if(s.primary.toLowerCase()===a||s.alternatives?.some(u=>u.toLowerCase()===a))return H(o);return e.reset(r),null}tryMatchShatteredCompound(e,t,r){let n=t.split(r);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 u=e.peek();if(!u||u.value!==r)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()!==n[o].toLowerCase())return e.reset(a),false;e.advance();}return true}matchRoleToken(e,t,r,n){let a=e.position(),o=r.get(t.role);return this.matchRoleTokenCore(e,t,r,n)?(this.absorbTrailingConversion(e,t,r,n,a),this.absorbTrailingConditionOperand(e,t,r,n,a),this.stampCaptureSpan(e,t.role,r,a,o),true):false}stampCaptureSpan(e,t,r,n,a){let o=r.get(t);if(!o||o===a||o.position||e.position()<=n)return;let s=e.tokens[n],u=e.tokens[e.position()-1];!s||!u||r.set(t,Go(o,{start:s.position.start,end:u.position.end}));}absorbTrailingConditionOperand(e,t,r,n,a){if(t.role!=="condition"||!r.has("condition")||e.position()<=a||n!==void 0||this.currentPatternCommand!=="on")return;let o=e.peek();if(!o)return;let s=I.CONDITION_OPERATOR_WORDS;if(!s.has((o.normalized??"").toLowerCase())&&!s.has(o.value.toLowerCase())||this.patternTokenWouldMatch(n,o))return;e.advance();let u=e.peek();u&&(u.kind==="selector"||u.kind==="identifier"||u.kind==="literal")&&!Kt.has((u.normalized??u.value).toLowerCase())&&e.advance();let l=Le(e.tokens.slice(a,e.position()),this.currentProfile);r.set("condition",{type:"expression",raw:l,value:l});}conversionRunLength(e){let t=e.peek();if(!t||(t.normalized??t.value).toLowerCase()!=="as"&&t.value.toLowerCase()!=="as")return 0;let n=e.peek(1);return !n||!oi.has(n.value)?0:2}absorbTrailingConversion(e,t,r,n,a){if(t.role==="event"||t.role==="action"||!r.has(t.role)||e.position()<=a||this.conversionRunLength(e)!==2||this.patternTokenWouldMatch(n,e.peek()))return;e.advance(),e.advance();let o=Le(e.tokens.slice(a,e.position()),this.currentProfile);r.set(t.role,{type:"expression",raw:o,value:o});}matchRoleTokenCore(e,t,r,n){this.skipNoiseWords(e);let a=e.peek();if(!a)return t.optional||false;if(t.role==="action"&&this.currentProfile&&e.peek(1)?.value==="-"){let y=this.tryFoldHyphenActionKeyword(e);if(y)return r.set(t.role,y),true}if(t.role==="event"&&this.currentPatternCommand==="on"){if(!I.tokenLooksLikeEvent(a))return t.optional||false;let y=(a.normalized??a.value).toLowerCase();if(I.POSITIONAL_OR_SCOPE_KEYWORDS.has(y)||this.currentProfile&&(me(this.currentProfile,a.value)??me(this.currentProfile,y))!==void 0||a.value.includes("?."))return t.optional||false}if(t.role==="event"){let y=(a.normalized??a.value).toLowerCase();if(I.STRUCTURAL_NEVER_EVENT.has(y))return t.optional||false}if(a.kind==="keyword"){let y=(a.normalized??a.value).toLowerCase();if(y==="then"||y==="end"&&e.peek(1)?.kind!=="selector"||xr(a.value,this.currentProfile?.code??"")||(t.role==="quantity"||t.role==="event"&&this.currentPatternCommand==="repeat")&&(a.normalized??a.value).toLowerCase()in pe)return t.optional||false}if(t.role==="duration"){let y=(a.normalized??a.value).toLowerCase();if(I.POSITIONAL_OR_SCOPE_KEYWORDS.has(y))return t.optional||false}if(t.optional&&t.role!=="event"&&t.role!=="action"&&t.valueShape!=="keyword"&&a.kind==="keyword"&&(a.normalized??a.value).toLowerCase()in pe&&(n===void 0||this.patternTokenWouldMatch(n,a)))return true;let o=this.tryMatchPositionalExpression(e,n);if(o)return t.expectedTypes&&t.expectedTypes.length>0&&!dt(o.type,t.expectedTypes)?t.optional||false:(r.set(t.role,o),true);let s=this.tryMatchCaretScopeExpression(e);if(s)return t.expectedTypes&&t.expectedTypes.length>0&&!dt(s.type,t.expectedTypes)?t.optional||false:(r.set(t.role,s),true);if(t.role!=="event"&&(!t.expectedTypes||t.expectedTypes.includes("expression"))){let y=this.tryMatchBeepPrefixExpression(e);if(y)return r.set(t.role,y),true;let v=this.tryMatchHyphenatedWord(e);if(v)return r.set(t.role,v),true;let k=this.tryMatchOperatorRunExpression(e);if(k)return r.set(t.role,k),true}if(this.currentPatternCommand==="pick"&&t.role==="patient"&&(!t.expectedTypes||t.expectedTypes.includes("expression"))){let y=this.tryMatchPickRangeExpression(e);if(y)return r.set(t.role,y),true}if(t.expectedTypes?.includes("property-path")){let y=this.tryMatchOfPossessiveExpression(e);if(y)return r.set(t.role,y),true;let v=this.tryMatchPostNominalPossessiveExpression(e);if(v)return r.set(t.role,v),true}let u=this.tryMatchPossessiveExpression(e);if(u)return t.expectedTypes&&t.expectedTypes.length>0&&!t.expectedTypes.includes(u.type)&&!t.expectedTypes.includes("expression")?t.optional||false:(r.set(t.role,u),true);let l=this.tryMatchMethodCallExpression(e);if(l)return t.expectedTypes&&t.expectedTypes.length>0&&!t.expectedTypes.includes(l.type)&&!t.expectedTypes.includes("expression")?t.optional||false:(r.set(t.role,l),true);let p=t.role==="event"&&this.currentPatternCommand==="on"||I.DECLARATION_COMMANDS.has(this.currentPatternCommand??"")?null:this.tryMatchBareCallExpression(e);if(p)return t.expectedTypes&&t.expectedTypes.length>0&&!t.expectedTypes.includes(p.type)&&!t.expectedTypes.includes("expression")?t.optional||false:(r.set(t.role,p),true);let d=this.tryMatchPossessiveSelectorExpression(e);if(d)return t.expectedTypes&&t.expectedTypes.length>0&&!dt(d.type,t.expectedTypes)?t.optional||false:(r.set(t.role,d),true);let m=t.role!=="condition",f=this.tryMatchPropertyAccessExpression(e,m);if(f)return t.expectedTypes&&t.expectedTypes.length>0&&!t.expectedTypes.includes(f.type)&&!t.expectedTypes.includes("expression")?t.optional||false:(r.set(t.role,f),true);let h=this.tryMatchSelectorPropertyExpression(e);if(h)return t.expectedTypes&&t.expectedTypes.length>0&&!dt(h.type,t.expectedTypes)?t.optional||false:(r.set(t.role,h),true);if(a.kind==="identifier"&&a.value==="{"){let y=t.expectedTypes,k=y?.length===1&&y[0]==="expression"?this.tryMatchBraceRunExpression(e):!y?.length||y.includes("literal")?this.tryMatchBraceRunLiteral(e):null;if(k)return r.set(t.role,k),true}if(t.role==="style"&&t.expectedTypes?.length===1&&t.expectedTypes[0]==="expression"){let y=Je(e);if(y)return r.set(t.role,{type:"expression",raw:y}),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 y=E.type==="selector"&&String(E.value).startsWith("@"),v=t.expectedTypes.some(k=>k==="expression"||k==="reference");if(!(y&&v))return t.optional||false}if(t.valueShape==="keyword"&&E.type==="expression"?r.set(t.role,H(String(E.raw??""))):r.set(t.role,E),e.advance(),t.role==="event"){let y=e.peek();y&&y.kind==="selector"&&y.value.startsWith("[")&&"value"in E&&(r.set(t.role,H(`${String(E.value)}${y.value}`)),e.advance());let v=e.peek();if(v&&(v.kind==="particle"||v.kind==="keyword")&&(v.normalized??"").toLowerCase()==="source"&&!this.patternTokenWouldMatch(n,v)){let k=e.peek(1);if(k&&(k.kind==="selector"||k.kind==="identifier")){e.advance();let A=this.tokenToSemanticValue(e.advance());A&&!r.has("source")&&r.set("source",A);}}}return true}shouldTrySkippingVerbSlot(e,t,r){let n=e.type==="group"&&e.optional?e.tokens.every(s=>s.type==="role")?e.tokens[0]:void 0:e;if(!n||n.type!=="role"||!n.optional||n.role==="event"||n.role==="action"||n.valueShape==="keyword")return false;let a=t.peek();if(!a||a.kind!=="keyword"||r===void 0)return false;let o=this.patternTokenWouldMatch(r,a);return (a.normalized??a.value).toLowerCase()in pe?!o:o}atClauseEnd(e){let t=e.peek();if(!t||t.kind==="conjunction")return true;if(t.kind!=="keyword")return false;let r=(t.normalized??t.value).toLowerCase();return r==="then"||r==="end"?true:xr(t.value,this.currentProfile?.code??"")}patternTokenWouldMatch(e,t){return e?e.type==="literal"?this.getMatchType(t,e.value)!=="none"?true:!!e.alternatives?.some(r=>this.getMatchType(t,r)!=="none"):e.type==="group"?this.patternTokenWouldMatch(e.tokens?.[0],t):false:false}tryMatchPositionalExpression(e,t){let r=ai(e.tokens,e.position(),this.currentProfile,n=>n===void 0?false:this.patternTokenWouldMatch(t,n));if(!r)return null;for(let n=0;n<r.consumed;n++)e.advance();return {type:"expression",raw:r.parts.map(n=>n.text).join(" ")}}tryMatchCaretScopeExpression(e){let t=e.peek();if(!t||t.kind!=="identifier"||!t.value.startsWith("^"))return null;let r=e.peek(1),n=e.peek(2),a=(r?.normalized??"").toLowerCase(),o=!!r&&(r.value.toLowerCase()==="on"||a==="destination"||a==="on");return !r||!n||n.kind!=="selector"||!o?null:(e.advance(),e.advance(),e.advance(),{type:"expression",raw:`${t.value} on ${n.value}`})}isOfPossessiveMarker(e){return Nt(this.currentProfile,e)}static isBareWordToken(e){return !!e&&/^[A-Za-z_][A-Za-z0-9_]*$/.test(e.value)}static tokensAdjacent(e,t){return e?.position?.end!==void 0&&t?.position?.start!==void 0&&e.position.end===t.position.start}tryMatchBeepPrefixExpression(e){let t=e.peek(),r=e.peek(1);if(!t||!r||r.value!=="!"||(t.normalized??t.value).toLowerCase()!=="beep"||!(t.position?.end!==void 0&&r.position?.start!==void 0&&t.position.end===r.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||!I.RUN_OPERATORS.has(u.value))break;let l=e.mark();if(e.advance(),!this.tryConsumeRunOperand(e)){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(!I.isBareWordToken(t))return null;let r=1,n=[t.value];for(;;){let a=e.peek(r),o=e.peek(r+1);if(!a||a.value!=="-"||!I.isBareWordToken(o)||!I.tokensAdjacent(e.peek(r-1),a)||!I.tokensAdjacent(a,o))break;n.push(o.value),r+=2;}if(n.length<2)return null;for(let a=0;a<r;a++)e.advance();return H(n.join("-"),"string")}tryMatchOperatorRunExpression(e){let t=e.mark(),r=e.position();if(!this.tryConsumeRunOperand(e))return e.reset(t),null;let n=1;for(;;){let o=e.peek();if(!o||!I.RUN_OPERATORS.has(o.value))break;let s=e.mark();if(e.advance(),!this.tryConsumeRunOperand(e)){e.reset(s);break}n++;}if(n<2)return e.reset(t),null;let a=Le(e.tokens.slice(r,e.position()),this.currentProfile);return {type:"expression",raw:a,value:a}}static rangeSeparatorFor(e){let[t]=I.PICK_RANGE_SEPARATORS_BY_LANG[e]??[];return t}isPickRangeSeparator(e){let t=(e.normalized??e.value).toLowerCase();if(I.PICK_RANGE_SEPARATORS.has(t))return true;let r=this.currentProfile?.code;return r?I.PICK_RANGE_SEPARATORS_BY_LANG[r]?.has(e.value.toLowerCase())??false:false}tryMatchPickRangeExpression(e){let t=e.mark(),r=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&&I.PICK_RANGE_MODES.has((a.normalized??a.value).toLowerCase())&&e.advance();let o=e.tokens.slice(r,e.position()),[s,,u,l]=o,c=d=>d.kind==="keyword"?d.normalized??d.value:d.value,p=`${c(s)} to ${c(u)}`;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 r=(t.normalized??t.value).toLowerCase();if(this.isPickRangeSeparator(t))return false;let n=r==="start"||r==="end";return t.kind==="literal"||t.kind==="identifier"||t.kind==="keyword"&&n?(e.advance(),true):false}tryConsumeRunOperand(e){let t=e.peek();if(!t)return false;if(t.value==="("){let r=e.mark(),n=0;for(;!e.isAtEnd();){let a=e.advance();if(a.value==="(")n++;else if(a.value===")"&&(n--,n===0))return true}return e.reset(r),false}return this.tryMatchPossessiveExpression(e)?true:(t.kind==="literal"||t.kind==="identifier"||t.kind==="selector"||t.kind==="keyword")&&!I.RUN_OPERATORS.has(t.value)&&t.value!==")"?(e.advance(),true):false}isPossessorToken(e){if(!this.currentProfile)return false;for(let t of [e.value,e.normalized].filter(Boolean))if(me(this.currentProfile,t)??me(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?fe(this.currentProfile.code,e):e}tryMatchOfPossessiveExpression(e){let t=e.peek();if(!t||t.kind!=="selector"&&!this.isBareWordPropertyHead(t))return null;let r=e.mark();e.advance();let n=e.peek();if(!n||!this.isOfPossessiveMarker(n))return e.reset(r),null;e.advance();let a=e.peek();return !a||a.kind!=="selector"||xs(a.value)?(e.reset(r),null):(e.advance(),ze(be(a.value),this.toEnglishProperty(t.value),"possessive"))}tryMatchPossessiveExpression(e){let t=e.peek();if(!t||!this.currentProfile)return null;let r=[t.value,t.normalized].filter(Boolean),n;for(let u of r)if(n=me(this.currentProfile,u)??me(this.currentProfile,u.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 u=e.peek();if(u){let l=u.value.toLowerCase(),c=(u.normalized??"").toLowerCase();o.some(p=>p.toLowerCase()===l||p.toLowerCase()===c)&&e.advance();}}let s=e.peek();if(!s||fs(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&&I.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 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++<I.MAX_METHOD_ARGS+2;){let f=e.peek();if(!f)break;p+=f.value,e.advance();for(let h of f.value)h==="("?d++:h===")"&&d--;if(d<=0)break}l+=p;}return ze(ce(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 r=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("@"))||r)||this.isPossessorToken(t))return null;let a=e.mark(),o=t.value;r&&(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 c of [u.value,u.normalized].filter(Boolean))if(l=me(this.currentProfile,c)??me(this.currentProfile,c.toLowerCase()),l)break;return l?(e.advance(),ze(ce(l),s,"possessive")):(e.reset(a),null)}isStructuralKeyword(e){return new Set(["into","in","to","from","at","by","with","without","before","after","of","as","on","then","end","else","if","repeat","while","for","toggle","add","remove","put","set","show","hide","increment","decrement","send","trigger","call"]).has(e.toLowerCase())}isRoleMarkerConcept(e){return ri.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 r=e.normalized?.toLowerCase();return !(r&&As.has(r)||r==="me"||r==="it"||r==="you")}tryMatchBraceRunLiteral(e){let t=e.peek();if(!t||t.kind!=="identifier"||t.value!=="{")return null;let r=e.mark();e.advance();let n=["{"],a=1,o=0;for(;!e.isAtEnd()&&o++<I.MAX_BRACE_RUN_TOKENS;){let s=e.advance();if(!s)break;if(s.value==="{")a++;else if(s.value==="}"&&(a--,a===0))return n.push("}"),H(n.join(" "));n.push(s.value);}return e.reset(r),null}tryMatchBraceRunExpression(e){let t=e.peek();if(!t||t.kind!=="identifier"||t.value!=="{")return null;let r=e.mark(),n="",a=-1,o=0,s=0;for(;!e.isAtEnd()&&s++<I.MAX_BRACE_RUN_TOKENS;){let u=e.advance();if(!u)break;if(a>=0&&u.position.start>a&&(n+=" ".repeat(u.position.start-a)),n+=u.value,a=u.position.end,u.value==="{")o++;else if(u.value==="}"&&(o--,o===0))return {type:"expression",raw:n}}return e.reset(r),null}tryMatchBareCallExpression(e){let t=e.peek();if(!t||t.kind!=="identifier"||!/^[A-Za-z_][\w$]*$/.test(t.value))return null;let r=e.peek(1);if(!r||r.value!=="(")return null;let n=e.mark();e.advance();let a=e.advance(),o="",s=a.position?.end,u=false,l=0;for(;!e.isAtEnd()&&l++<I.MAX_METHOD_ARGS+2;){let c=e.peek();if(!c)break;if(c.value===")"){e.advance(),u=true;break}let p=s!==void 0&&c.position?.start===s;o+=(o===""||p?"":" ")+c.value,s=c.position?.end,e.advance();}return u?{type:"expression",raw:`${t.value}(${o})`}:(e.reset(n),null)}tryMatchMethodCallExpression(e){let t=e.peek();if(!t||t.kind!=="selector")return null;let r=e.mark();e.advance();let n=e.peek();if(!n||n.kind!=="operator"||n.value!==".")return e.reset(r),null;e.advance();let a=e.peek();if(!a||a.kind!=="identifier")return e.reset(r),null;e.advance();let o=e.peek();if(!o||o.kind!=="punctuation"||o.value!=="(")return e.reset(r),null;e.advance();let s=[];for(;!e.isAtEnd()&&s.length<I.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,t=true){let r=e.peek();if(!r||r.kind!=="identifier"&&r.kind!=="keyword")return null;let n=e.mark();e.advance();let a=r.value.toLowerCase(),o=e.peek();if((r.kind==="identifier"||I.PROPERTY_ACCESS_BASES.has(a))&&o&&o.kind==="selector"&&/^\.[a-zA-Z_]/.test(o.value)){let m=r.value,f=[],h=0;for(;h<I.MAX_PROPERTY_DEPTH;){let v=e.peek();if(v&&v.kind==="selector"&&/^\.[a-zA-Z_]/.test(v.value))m+=`.${v.value.slice(1)}`,f.push(v.value.slice(1)),e.advance(),h++;else break}let E=e.peek(),y=!!E&&E.value.startsWith("(");if(t&&!y&&f.length>0&&Oe(a))return ze(ce(a),f.join("."),"dot");if(y){let v=e.mark(),k=[],A=0,x=false;for(;!e.isAtEnd();){let C=e.peek();if(!C)break;if(C.value==="(")A++;else if(C.value===")"){if(k.push(C.value),e.advance(),A--,A===0&&(x=true),x)break;continue}k.push(C.value),e.advance();}x?m+=k.join(""):e.reset(v);}return {type:"expression",raw:m}}let s=e.peek();if(!s||s.kind!=="operator"||s.value!==".")return e.reset(n),null;e.advance();let u=e.peek();if(!u||u.kind!=="identifier")return e.reset(n),null;e.advance();let l=`${r.value}.${u.value}`,c=1;for(;!e.isAtEnd()&&c<I.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<I.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 d=r.value.toLowerCase();if(t&&Oe(d)){let m=l.split(".").slice(1).join(".");return ze(ce(d),m,"dot")}return {type:"expression",raw:l}}tryMatchPossessiveSelectorExpression(e){let t=e.peek();if(!t||t.kind!=="selector")return null;let r=e.mark();e.advance();let n=e.peek(),a=this.currentProfile?.possessive?.marker?.replace(/^-/,""),o=!!n&&n.kind==="punctuation"&&n.value==="'s",s=!!n&&n.value==="'"&&(e.peek(1)?.value??"").toLowerCase()==="s",u=(()=>{if(!this.currentPatternCommand||(n?.normalized??"").toLowerCase()!=="source")return false;let f=pe[this.currentPatternCommand];return !!f&&f.roles.some(h=>h.role==="source")})(),l=!!n&&!!a&&a!=="'s"&&n.value===a&&(n.kind==="particle"||n.kind==="punctuation"||n.kind==="identifier")&&!u;if(!o&&!l&&!s)return e.reset(r),null;e.advance(),s&&e.advance();let c=e.peek();if(!c)return e.reset(r),null;let p=c.kind==="selector"&&c.value.startsWith("*"),d=c.kind==="keyword"&&!!this.currentProfile&&us(this.currentProfile.code,c.value);return c.kind==="identifier"||p||d||(o||s)&&(c.kind==="selector"||c.kind==="keyword")?(e.advance(),ze(be(t.value),this.toEnglishProperty(c.value),"possessive")):(e.reset(r),null)}tryMatchSelectorPropertyExpression(e){let t=e.peek();if(!t||t.kind!=="selector"||!t.value.startsWith("#"))return null;let r=e.mark();e.advance();let n=e.peek();if(!n||n.kind!=="selector"||!n.value.startsWith("."))return e.reset(r),null;let a=e.peek(1);a&&a.kind,e.advance();let o=n.value.slice(1);return ze(be(t.value),o,"dot")}matchGroupToken(e,t,r,n){let a=e.mark(),o=new Map(r),s=this.matchTokenSequence(e,t.tokens,r,n);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&&[...r.keys()].some(c=>!o.has(c))&&(e.tokens.slice(a.position,e.position()).some(d=>u.some(m=>this.getMatchType(d,m)!=="none"))||(s=false));}if(!s){e.reset(a);for(let u of r.keys())o.has(u)||r.delete(u);for(let[u,l]of o)r.get(u)!==l&&r.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 r=ct(e.value).toLowerCase();if(r&&r===ct(t).toLowerCase())return "case-insensitive"}return "none"}tokenToSemanticValue(e){switch(e.kind){case "selector":return be(e.value);case "literal":return this.parseLiteralValue(e.value);case "keyword":let t=(e.normalized||e.value).toLowerCase();return Oe(t)?ce(t):H(e.normalized||e.value);case "identifier":if(e.value.startsWith("@"))return be(e.value);if(e.value.startsWith(":")||e.value.startsWith("$"))return ce(e.value);let r=e.value.toLowerCase();return Oe(r)?ce(r):{type:"expression",raw:e.value};case "url":return H(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 H(n,"string")}if(e==="true")return H(true,"boolean");if(e==="false")return H(false,"boolean");let t=e.match(/^(\d+(?:\.\d+)?)(ms|s|m|h)?$/);if(t){let n=parseFloat(t[1]);return t[2]?H(e,"duration"):H(n,"number")}let r=parseFloat(e);return isNaN(r)?H(e,"string"):H(r,"number")}applyExtractionRules(e,t){for(let[r,n]of Object.entries(e.extraction)){let a=t.get(r);if(a){if(n.transform){let o=a.type==="literal"?String(a.value):String(a.raw??"");t.set(r,n.transform(o));}}else n.value!==void 0?t.set(r,{type:"literal",value:n.value}):n.default&&t.set(r,{...n.default,implicit:true});}}isOptional(e){return e.type!=="literal"&&e.optional===true}skipNoiseWords(e){let t=e.peek();if(!t)return;let r=t.value.toLowerCase();if(I.ENGLISH_NOISE_WORDS.has(r)){let n=e.mark();e.advance();let a=e.peek();if(a&&(a.kind==="selector"||a.kind==="identifier"))return;let o=e.peek(1);if(a&&a.kind==="keyword"&&o&&o.kind==="selector"&&/^\.[a-zA-Z_]/.test(o.value))return;let s=a?(a.normalized??a.value).toLowerCase():"";if(a&&I.POSITIONAL_OR_SCOPE_KEYWORDS.has(s))return;let u=e.peek(1),l=u?(u.normalized??u.value).toLowerCase():"",c=this.currentProfile?.wordOrder!=="SOV"&&I.COMMAND_ACTION_KEYWORDS.has(l),p=!u||u.kind==="particle"||I.CLAUSE_BOUNDARY_KEYWORDS.has(l)||c;if(a&&a.kind==="keyword"&&this.currentProfile?.code!=="en"&&Oe(s)&&p||a&&a.kind==="keyword"&&this.currentProfile?.code==="en"&&Oe(s))return;e.reset(n);}r==="class"&&e.advance();}extractEventModifiers(e){let t={},r=false;for(;!e.isAtEnd();){let n=e.peek();if(!n||n.kind!=="event-modifier")break;let a=n.metadata;if(!a)break;switch(r=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 r?t:void 0}};J.CONDITION_OPERATOR_WORDS=new Set(["matches","match","contains","exists","has","have","equals","includes"]);J.POSITIONAL_OR_SCOPE_KEYWORDS=new Set(["first","last","next","previous","random","closest","parent"]);J.STRUCTURAL_NEVER_EVENT=new Set(["if","unless","else","end","then","while"]);J.PROPERTY_ACCESS_BASES=new Set(["it","me","you","my","its","your","event","result","target","detail","body","window","document","self","this"]);J.COMMAND_ACTION_KEYWORDS=Kt;J.CLAUSE_BOUNDARY_KEYWORDS=new Set(["then","and","or","end","else"]);J.RUN_OPERATORS=new Set(["+","-","*","/"]);J.PICK_RANGE_SEPARATORS=new Set(["to"]);J.PICK_RANGE_SEPARATORS_BY_LANG={ar:new Set(["\u0625\u0644\u0649"]),bn:new Set(["\u09A5\u09C7\u0995\u09C7"]),de:new Set(["zu","bis"]),es:new Set(["a"]),fr:new Set(["\xE0"]),he:new Set(["\u05E2\u05DC","\u05E2\u05D3"]),hi:new Set(["\u0938\u0947"]),id:new Set(["ke"]),it:new Set(["in","a"]),ja:new Set(["\u304B\u3089"]),ko:new Set(["\uBD80\uD130"]),ms:new Set(["ke"]),pl:new Set(["do"]),pt:new Set(["para","a"]),qu:new Set(["kama"]),ru:new Set(["\u0432","\u0434\u043E"]),sw:new Set(["kwa","hadi"]),th:new Set(["\u0E43\u0E19","\u0E16\u0E36\u0E07"]),tl:new Set(["sa"]),tr:new Set(["ile"]),uk:new Set(["\u0432","\u0434\u043E"]),vi:new Set(["v\xE0o","\u0111\u1EBFn"]),zh:new Set(["\u5230"])};J.PICK_RANGE_MODES=new Set(["inclusive","exclusive"]);J.MAX_BRACE_RUN_TOKENS=64;J.MAX_PROPERTY_DEPTH=10;J.MAX_METHOD_ARGS=20;J.DECLARATION_COMMANDS=new Set(["behavior","def","install"]);J.ENGLISH_NOISE_WORDS=new Set(["the","a","an"]);var di=J,le=new di;function Z(i,e){return wo(i,e)}function mi(){return bo()}var fi={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"])},Ss=new Set(Object.values(fi).flatMap(i=>[...i]));function Lt(i,e){let t=(i.normalized??i.value).toLowerCase();if(t==="or")return true;let r=e===void 0?Ss:fi[e];return r?r.has(i.value)||r.has(t):false}var Ve=["if","unless","repeat","for","while"],yt=/^[A-Z][A-Za-z0-9_]*$/;function K(i,e){let t=new Set([e]),n=_(i)?.keywords?.[e];if(n){n.primary&&t.add(n.primary.toLowerCase());for(let a of n.alternatives??[])t.add(a.toLowerCase());}return t}function q(i,e){return e.has(i.value.toLowerCase())?true:i.normalized?e.has(i.normalized.toLowerCase()):false}var Ds=new Set(Ve);function rt(i,e){let t=i.normalized?.toLowerCase();return t?Ds.has(t):e.some(r=>q(i,r))}var Fr=new Set(["me","it","you","the","body","window","document","its","event","result","target","self","this","them","parent","next","previous","closest","first","last"]),Ts=new Set(["destination","source","style","patient","on","from","to"]);function et(i){if(!i||i.kind==="selector")return false;let e=(i.normalized??i.value).toLowerCase(),t=i.value.toLowerCase();return !(Fr.has(e)||Fr.has(t)||Ts.has(e))}var Rr=new Set(["ja","ko"]);function $e(i){let e=new Set;i?.primary&&e.add(i.primary.toLowerCase());for(let t of i?.alternatives??[])e.add(t.toLowerCase());return e}function yi(i,e){let t=[],r=e.position.end,n=i.slice(e.position.end).match(/^\s*\(([^)]*)\)/);if(n){r=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:r}}function vt(i,e,t){let r=e+1;if(r>=i.length)return -1;let n=$e(_(t)?.roleMarkers?.patient);return n.size>0&&q(i[r],n)&&r++,r<i.length?r:-1}var vi=/^[a-zA-Z_$][\w$]*(?:\.[a-zA-Z_$][\w$]*)*$/;function Bs(i){let e=1;if(i[1]?.value==="("){let t=0,r=1;for(;r<i.length;r++)if(i[r].value==="(")t++;else if(i[r].value===")"&&--t===0)break;if(r>=i.length)return -1;e=r+1;}return e+1}function Ps(i,e,t){let r=_(t);if(r?.wordOrder!=="SOV"||!vi.test(i[0].value)||e!==Bs(i))return false;let n=$e(r.roleMarkers?.patient);return n.size===0?false:q(i[e-1],n)}function Fs(i,e,t){if(!_(e))return null;let r=K(e,"behavior"),n=K(e,"def"),a=i.toLowerCase(),o=[...r].some(p=>a.includes(p)),s=/\bdef\b/.test(a)||[...n].some(p=>p!=="def"&&a.includes(p));if(!o&&!s)return null;let u=Z(i,e).tokens;if(u.length<2)return null;if(q(u[0],r))return Or(i,e,u,t,0);let l=u.findIndex((p,d)=>d>0&&q(p,r));if(l>0&&yt.test(u[0].value))return Or(i,e,u,t,l);if(q(u[0],n))return _r(i,e,u,t,0);let c=u.findIndex((p,d)=>d>0&&q(p,n));return c>0&&Ps(u,c,e)?_r(i,e,u,t,c):null}function Rs(i,e,t){let r=_(e);if(!r)return null;let n=r.wordOrder!=="SOV",a=Rr.has(e)?$e(r.roleMarkers?.event):new Set,o=Rr.has(e)?$e(r.keywords?.on):new Set,s=a.size>0&&o.size>0,u=K(e,"end"),l=K(e,"on"),c=i.toLowerCase(),p=[...u].some(C=>c.includes(C)),d=(n||s)&&(()=>{let C=0;for(let g of l)if(g){for(let z=c.indexOf(g);z>=0;z=c.indexOf(g,z+g.length))if(++C>=2)return true}return false})();if(!p&&!d)return null;let m=Z(i,e).tokens;if(m.length<2)return null;let f=Ve.map(C=>K(e,C)),h=C=>rt(C,f),E=C=>q(C,u),y=[],v=0,k=0;for(let C=0;C<m.length;C++){let g=m[C];if(E(g)){if(v>0){v--;continue}let z=i.slice(m[k].position.start,g.position.start).trim();z&&y.push(z),k=C+1;}else if(h(g))v++;else if(n&&v===0&&C>k&&q(g,l)&&et(m[C+1])){let z=i.slice(m[k].position.start,g.position.start).trim();z&&y.push(z),k=C;}else if(s&&v===0&&C-1>k&&q(g,a)&&m[C+1]!==void 0&&q(m[C+1],o)){let z=m[C-1],D=i.slice(m[k].position.start,z.position.start).trim();D&&y.push(D),k=C-1;}}if(k<m.length){let C=i.slice(m[k].position.start).trim();C&&y.push(C);}if(y.length<2)return null;let A=[],x=[];for(let C of y){let g;try{g=t.statement(C,e);}catch{return null}if(!g||g.kind!=="event-handler")return null;let z=g;if(A.push(z),!z.body||z.body.length===0)return null;x.push(z.metadata?.confidence??.75);}return Qe(A,"then",{sourceLanguage:e,confidence:je(x),sourceText:i})}function je(i){return i.length>0?i.reduce((e,t)=>e+t,0)/i.length:0}function ht(i){let e=[];for(let t of i){let r=t.statements;t.kind==="compound"&&Array.isArray(r)?e.push(...r):e.push(t);}return e}function Or(i,e,t,r,n){let a=n>0,o=a?0:vt(t,n,e);if(o<0)return null;let s=t[o],u=s.value;if(!yt.test(u))return null;let{parameters:l,headerEnd:c}=yi(i,s),p=a?n+1:t.findIndex(z=>z.position.start>=c);p<=o&&(p=o+1);let d=K(e,"init"),m=K(e,"end"),f=Ve.map(z=>K(e,z)),h=z=>rt(z,f),E=z=>q(z,m),y=[],v=[],k=[],A=false,x=0,C=p;for(let z=p;z<t.length;z++){let D=t[z];if(E(D)){if(x>0){x--;continue}if(z===C){A=true;break}if(q(t[C],d)){let b=i.slice(t[C].position.end,D.position.start).trim();if(b)try{let w=ht(r.body(b,e));v.push(...w),k.push(je(w.map(S=>S.metadata?.confidence??.75)));}catch{k.push(0);}}else {let b=i.slice(t[C].position.start,D.position.start).trim();try{let w=r.statement(b,e);if(w&&w.kind==="event-handler"){let S=w;y.push(S);let R=!S.body||S.body.length===0;k.push(R?.2:S.metadata?.confidence??.75);}else k.push(0);}catch{k.push(0);}}C=z+1;}else h(D)&&x++;}if(y.length===0&&v.length===0)return null;let g=(A?1:.8)*je(k);return Yo(u,l,y,v.length>0?v:void 0,{sourceLanguage:e,confidence:g,sourceText:i})}function _r(i,e,t,r,n){let a=n>0,o=a?0:vt(t,n,e);if(o<0)return null;let s=t[o],u=s.value;if(!vi.test(u))return null;let{parameters:l,headerEnd:c}=yi(i,s),p=a?n+1:t.findIndex(g=>g.position.start>=c);p<=o&&(p=o+1);let d=K(e,"end"),m=Ve.map(g=>K(e,g)),f=g=>rt(g,m),h=g=>q(g,d),E=0,y=-1;for(let g=p;g<t.length;g++)if(h(t[g])){if(E===0){y=g;break}E--;}else f(t[g])&&E++;let v=t[p]?.position.start??c,k=y>=0?t[y].position.start:i.length,A=i.slice(v,k).trim();if(!A)return null;let x;try{x=ht(r.body(A,e));}catch{return null}if(x.length===0)return null;let C=je(x.map(g=>g.metadata?.confidence??.75));return y<0&&(C*=.8),Zo(u,l,x,{sourceLanguage:e,confidence:C,sourceText:i})}var It=["live","eventsource","socket","worker","intercept"],Os=new Set(["intercept"]),Ut=new Set(["eventsource","socket","worker"]),_s=new Set(["eventsource","socket"]),Ns=new Set(["worker"]),Ls=6,Is=2;function Ms(i,e){for(let r of It)if(q(i[0],K(e,r)))return {action:r,keywordIdx:0};if(_(e)?.wordOrder!=="SOV")return null;let t=Math.min(i.length,Ls);for(let r=1;r<t;r++)for(let n of It)if(n!=="live"&&q(i[r],K(e,n))&&!(Ut.has(n)&&!yt.test(i[0].value))&&!(n==="intercept"&&r>Is))return {action:n,keywordIdx:r};return null}function $s(i,e,t){let r=$e(_(t)?.roleMarkers?.source);return r.size===0||e+1>=i.length?0:q(i[e],r)||q(i[e+1],r)?2:0}function hi(i){let e=K(i,"on");e.add("when");let t=_(i)?.eventHandler;if(t?.keyword){e.add(t.keyword.primary.toLowerCase());for(let r of t.keyword.alternatives??[])e.add(r.toLowerCase());}for(let r of t?.temporalMarkers??[])e.add(r.toLowerCase());return e}function js(i,e,t){let r=_(t)?.eventHandler,n=[r?.eventMarker?.primary,...r?.eventMarker?.alternatives??[],...r?.temporalMarkers??[]].filter(o=>!!o&&/\s/.test(o)),a=1;for(let o of n){let s=o.toLowerCase().split(/\s+/),u=e-s.length+1;u<0||s.every((l,c)=>i[u+c]?.value.toLowerCase()===l)&&(a=Math.max(a,s.length));}return a}function qs(i,e,t,r,n){if(i==="live")return t+1;if(t>0){let l=t+1;return i==="eventsource"&&(l+=$s(e,l,r)),l}let a=vt(e,t,r);if(a<0)return -1;if(i==="worker")return a+1;let o=hi(r),s=$e(_(r)?.roleMarkers?.event),u=n>=0?n:e.length;for(let l=a+1;l<u;l++){if(!q(e[l],o))continue;if(et(e[l+1]))return l;if(l>a+2&&s.size>0&&q(e[l-1],s)&&et(e[l-2]))return l-2;let c=js(e,l,r);if(c>1&&l-c>a&&et(e[l-c]))return l-c;if(l>a+1&&et(e[l-1]))return l-1}return u}function Vs(i,e,t,r){if(!Ut.has(i))return;let n=t>0?0:vt(e,t,r);if(!(n<0))return e[n].value}function Ws(i,e,t){if(!_(e))return null;let r=i.toLowerCase(),n=false;for(let u of [...It,"changes"]){for(let l of K(e,u))if(l&&r.includes(l)){n=true;break}if(n)break}if(!n)return null;let a=Z(i,e).tokens;if(a.length<2)return null;let o=Gs(a,e);if(o>=0)return Zs(i,e,a,t,o);let s=Ms(a,e);return s?Hs(i,e,a,t,s.action,s.keywordIdx):null}function Hs(i,e,t,r,n,a){let o=K(e,"end"),s=Ve.map(A=>K(e,A)),u=A=>rt(A,s),l=A=>q(A,o),c=Vs(n,t,a,e);if(Ut.has(n)&&(!c||!yt.test(c)))return null;let p=A=>({sourceLanguage:e,confidence:A,sourceText:i}),d=Mt(t,a+1,l,u);if(Os.has(n))return d>=0&&d!==t.length-1?null:_t(n,[],c,p(d>=0?1:.8));let m=qs(n,t,a,e,d);if(m<0||m>t.length)return null;let f=[],h=[],E=false,y=Ns.has(n);if(y||_s.has(n)){let A=y?"def":"event-handler",x=0,C=m;for(let g=m;g<t.length;g++){let z=t[g];if(l(z)){if(x>0){x--;continue}if(E=true,g===C)break;let D=y?z.position.end:z.position.start,b=i.slice(t[C].position.start,D).trim();try{let w=r.statement(b,e);if(w&&w.kind===A){let S=w;f.push(S);let R=!S.body||S.body.length===0;h.push(R?.2:S.metadata?.confidence??.75);}else h.push(0);}catch{h.push(0);}C=g+1;}else u(z)&&x++;}}else {let A=Mt(t,m,l,u);E=A>=0;let x=A>=0?t[A].position.start:i.length,C=i.slice(t[m].position.start,x).trim();if(!C)return null;try{f.push(...ht(r.body(C,e)));}catch{return null}if(f.length===0)return null;h.push(...f.map(g=>g.metadata?.confidence??.75));}if(f.length===0&&!E)return null;let v=E?1:.8,k=h.length>0?v*je(h):v;return _t(n,f,c,p(k))}var Ks=new Set([...Object.keys(pe),"then","else"]);function Us(i){let e=K(i,"when");for(let t of hi(i))e.add(t);return e}function Gs(i,e){if(i.length<3||!q(i[0],Us(e)))return -1;let t=K(e,"changes"),r=K(e,"end");for(let n=2;n<i.length;n++){let a=i[n];if(a.kind==="literal")continue;if(q(a,t))return n;if(q(a,r))return -1;let o=(a.normalized??a.value).toLowerCase();if(a.kind==="keyword"&&Ks.has(o))return -1}return -1}function Ys(i,e,t){if(t==="en"){let n=e[0],a=e[e.length-1];return {type:"expression",raw:i.slice(n.position.start,a.position.end).trim()}}let r=e.map(n=>Lt(n,t)?{...n,kind:"keyword",normalized:"or"}:n);return {type:"expression",raw:Le(r,_(t))}}function Zs(i,e,t,r,n){let a=K(e,"end"),o=Ve.map(v=>K(e,v)),s=v=>rt(v,o),u=v=>q(v,a),l=n+1;if(l>=t.length)return null;let c=Mt(t,l,u,s),p=c>=0;if(p&&c!==t.length-1)return null;let d=p?t[c].position.start:i.length,m=i.slice(t[l].position.start,d).trim();if(!m)return null;let f;try{f=ht(r.body(m,e));}catch{return null}if(f.length===0)return null;let h=Ys(i,t.slice(1,n),e),y=(p?1:.8)*je(f.map(v=>v.metadata?.confidence??.75));return _t("when",f,void 0,{sourceLanguage:e,confidence:y,sourceText:i},new Map([["condition",h]]))}function Mt(i,e,t,r){let n=0;for(let a=e;a<i.length;a++)if(t(i[a])){if(n===0)return a;n--;}else r(i[a])&&n++;return -1}var ke={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(ke).map(([i,e])=>{let t={};for(let[r,n]of Object.entries(e))n in t||(t[n]=r);return [i,t]}));var eu={debounced:"debounce",debounce:"debounce",throttled:"throttle",throttle:"throttle"},tu=[["\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"]],ru=/^(\d+)(ms|s|m)?$/,iu=new Set(["selector","literal","url","event-modifier"]);function au(i){let e=i.match(ru);if(!e)return null;let t=parseInt(e[1],10),r=e[2]||"ms";return r==="s"?t*=1e3:r==="m"&&(t*=6e4),t}function nu(i){for(let e=1;e<i.length;e++){let t=i[e];if(iu.has(t.kind))continue;let r=t.value.toLowerCase(),n=eu[r];if(n){let a=0;for(let o=e+1;o<i.length;o++){let s=i[o],u=au(s.value);if(u!==null)return {modifiers:{[n]: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 tu){if(a[0]!==r||e+a.length>i.length)continue;let o=true;for(let s=1;s<a.length;s++)if(i[e+s].value.toLowerCase()!==a[s]){o=false;break}if(o)return {modifiers:{once:true},start:t.position.start,end:i[e+a.length-1].position.end}}}return null}new Set(Object.values(Ht).flatMap(i=>Object.values(i)));var Ce=new Set(["if","unless","while","repeat","for"]),Bt=new Set(["then","end","else","if","unless","while","for","repeat","and"]),gu=new Set(["first","last","next","previous","random","closest"]),_e=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"]),Lr=class extends Error{constructor(i,e,t,r){super(i),this.name="SemanticParseError",this.language=e,this.input=t,this.diagnostics=r;}};function V(i,e,t){return {message:i,severity:e,source:"semantic-parser",...t&&{code:t}}}function W(i,e){return e.length===0?i:{...i,diagnostics:e}}var ft=120;function ku(i,e,t){let r=e.tokens.length;if(i.consumedTokens>=r)return null;let n=e.tokens[i.consumedTokens],a=e.tokens[r-1];if(!n||!a)return null;let o=t.slice(n.position.start,a.position.end);if(!o.trim())return null;let s=o.length>ft?`${o.slice(0,ft)}\u2026`:o,u=r-i.consumedTokens;return `pattern ${i.pattern.id} left ${u} token(s) unconsumed: "${s}"`}var bu=new Set(["to","from","into","onto","with","as","at","of","in","on","by","and","or","then","end","else","the","a","an","async"]);function Pt(i){let e=[],t=new Set((i.diagnostics??[]).map(n=>`${n.code}|${n.message}`)),r=n=>{if(!n||typeof n!="object")return;if(n!==i)for(let o of n.diagnostics??[]){if(o.code!=="unconsumed-input")continue;let s=`${o.code}|${o.message}`;t.has(s)||(t.add(s),e.push(o));}let a=n;for(let o of gi){let s=a[o];if(Array.isArray(s))for(let u of s)r(u);}};return r(i),e.length===0?i:W(i,[...i.diagnostics??[],...e])}function Ir(i){if(i.length>=2){let e=i[0];if((e==='"'||e==="'")&&i.endsWith(e))return i.slice(1,-1)}return i}var gi=["body","statements","thenBranch","elseBranch","eventHandlers","initBlock"];function ki(i,e){if(!i||typeof i!="object")return i;if(i.action&&i.roles instanceof Map){let r=re(i.action),n=r?.primaryRole;if(r&&n&&n!=="patient"&&!r.roles.some(a=>a.role==="patient")&&i.roles.has("patient")&&!i.roles.has(n)){let a=i.roles,o=a.get("patient");o!==void 0&&(a.delete("patient"),a.set(n,o));}if(i.action==="tell"){let a=i.roles,o=a.get("patient"),s=a.get("destination");o&&(o.type==="selector"||o.type==="reference")&&(!s||s.type==="literal")&&(a.delete("patient"),a.set("destination",o));}if(i.action==="transition"){let a=i.roles,o=a.get("goal");o&&o.type==="literal"&&o.dataType==="duration"&&!a.has("duration")&&(a.delete("goal"),a.set("duration",o));}if(i.action==="fetch"){let a=i.roles,o=a.get("patient"),s=a.get("source");o&&s&&(o.type==="literal"||o.type==="expression")&&s.type==="expression"&&!a.has("style")&&(a.delete("patient"),a.set("style",s),a.set("source",o));}if(i.action==="transition"){let a=i.roles,o=a.get("destination");o&&o.type==="literal"&&!a.has("goal")&&(a.delete("destination"),a.set("goal",o));let s=a.get("patient");s&&s.type==="literal"&&typeof s.value=="string"&&/^[A-Za-z_][A-Za-z0-9_-]*$/.test(s.value)&&a.set("patient",{type:"expression",raw:s.value});}if(i.action==="morph"){let a=i.roles,o=a.get("patient");o&&o.type==="literal"&&typeof o.value=="string"&&/<[a-zA-Z][^>]*\/?>/.test(o.value)&&a.set("patient",{type:"expression",raw:o.value});}if(i.action==="wait"){let a=i.roles;if(!a.has("event")){let o=a.get("duration"),s=o?.type==="expression"?o.raw:o?.type==="literal"?o.value:void 0;typeof s=="string"&&_e.has(s.toLowerCase())&&(a.delete("duration"),a.set("event",{type:"literal",value:s,dataType:"string"}));}}if(i.kind==="command"&&i.action!=="on"){let a=i.roles,o=a.get("event");if(o&&o.type==="expression"){let s=o.raw;typeof s=="string"&&/^[A-Za-z_][A-Za-z0-9_-]*(:[A-Za-z0-9_-]+)?$/.test(s)&&a.set("event",{type:"literal",value:s,dataType:"string"});}}if(e?.size){let a=i.roles;for(let o of ["destination","source"]){let s=a.get(o);s&&s.type==="literal"&&typeof s.value=="string"&&e.has(s.value)&&a.set(o,{type:"expression",raw:s.value});}}}let t=i;for(let r of gi){let n=t[r];if(Array.isArray(n))for(let a of n)ki(a,e);}return i}var ee=class T{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 r=ki(this.parseInternal(e,t),this.boundIdentifiers),n=this.coverageFrames[this.coverageFrames.length-1];if(n.length>0&&(r=W(r,[...r.diagnostics??[],...n])),this.parseDepth===1&&(r=Pt(r),r.kind==="event-handler")){let a={node:r,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),r=a.node;}return r}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=T.coverageMarkerSurfaces.get(e);if(!t){t=new Set;let r=_(e)?.roleMarkers;if(r){for(let n of Object.values(r))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 T.LEAKED_RENDER_MARKERS[e]??[])t.add(n.toLowerCase());T.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 r=(e.normalized??e.value).toLowerCase();return bu.has(r)?true:T.getCoverageMarkerSurfaces(t).has(e.value.toLowerCase())}recordDroppedTokens(e,t,r){if(e.length===0)return;let n=this.coverageFrames[this.coverageFrames.length-1];if(!n||!e.some(s=>!this.isCoverageResidueToken(s,t)))return;let a=e.map(s=>s.value).join(" ").trim();if(!a)return;let o=a.length>ft?`${a.slice(0,ft)}\u2026`:a;n.push(V(`${r} 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 r=e.roles.get(t);r?.type==="expression"&&typeof r.raw=="string"&&/^[A-Za-z_]\w*$/.test(r.raw)&&this.boundIdentifiers.add(r.raw);}parseInternal(e,t){let r=Fs(e,t,{statement:(b,w)=>this.parse(b,w),body:(b,w)=>this.parseStatements(b,w)});if(r)return r;let n=Ws(e,t,{statement:(b,w)=>this.parse(b,w),body:(b,w)=>this.parseStatements(b,w)});if(n)return n;let a=Rs(e,t,{statement:(b,w)=>this.parse(b,w),body:(b,w)=>this.parseStatements(b,w)});if(a)return a;let{modifiers:o,remainingInput:s}=this.extractStandaloneModifiers(e,t),u=s||e,c=this.stripAsyncModifier(u,t).remainingInput??u,d=this.stripDoNotThrowModifier(c,t).remainingInput??c,m=[],f=Z(d,t);this.positionSource=d;{let b=f.mark(),w=this.consumeJsBlock(f,t);if(w&&f.isAtEnd())return W(w,m);f.reset(b);}let h=ye(t);if(h.length===0)throw new Lr(`No patterns available for language: ${t}`,t,d,[V(`No patterns registered for language '${t}'`,"error","no-patterns")]);let E=[...h].sort((b,w)=>w.priority-b.priority);{let b=f.tokens;if(_(t)?.wordOrder==="VSO"&&b.length>=4&&b[0]?.normalized==="source"){let w=b.findIndex(S=>S.normalized==="on");if(w>=2&&w+1<b.length){let S=d.slice(b[0].position.start,b[w].position.start).trim(),R=b[w+1].position.end,B=d.slice(b[w].position.start,R)+" "+S+d.slice(R);if(B!==d)try{let O=this.parse(B,t);if(O&&O.kind==="event-handler"){let L=o?this.applyModifiers(O,o):O;return W(L,m)}}catch{}}}}{let b=f.tokens,w=b[0]?.normalized==="if";for(let S=0;w&&S+3<b.length;S++){let R=(b[S+3]?.normalized??b[S+3]?.value??"").toLowerCase();if(b[S]?.normalized==="source"&&b[S+2]?.normalized==="on"&&T.KNOWN_EVENTS.has(R)){let B=(d.slice(0,b[S].position.start).trimEnd()+" "+d.slice(b[S+1].position.end).trimStart()).trim();if(B&&B!==d)try{let O=this.parse(B,t);if(O&&O.kind==="event-handler"){let L=o?this.applyModifiers(O,o):O;return W(L,m)}}catch{}break}}}{let b=f.tokens;for(let w=1;w<b.length-1;w++){let S=b[w];if(!Lt(S,t))continue;let R=b[w+1],B=(R.normalized??R.value).toLowerCase();if(!T.KNOWN_EVENTS.has(B))break;let O=w+1,L=b[w+2];L&&L.kind==="selector"&&L.value.startsWith("[")&&(O=w+2);let $=b[w].position.start,j=b[O].position.end,N=(d.slice(0,$).trimEnd()+" "+d.slice(j).trimStart()).trim();if(N&&N!==d)try{let X=this.parse(N,t);if(X&&X.kind==="event-handler"){X.additionalEvents=[{type:"literal",value:B}];let Q=o?this.applyModifiers(X,o):X;return W(Q,m)}}catch{}break}}{let b=nu(f.tokens);if(b){let w=(d.slice(0,b.start).trimEnd()+" "+d.slice(b.end).trimStart()).trim();if(w&&w!==d)try{let S=this.parse(w,t);if(S&&S.kind==="event-handler"){let R=this.applyModifiers(S,{...o??{},...b.modifiers});return W(R,m)}}catch{}}}let y=E.filter(b=>b.command==="on"),v=f.mark(),k=le.matchBest(f,y);if(k){m.push(V(`event pattern matched: ${k.pattern.id} (confidence: ${k.confidence.toFixed(2)})`,"info","pattern-match"));let b=false;if(/^event-[a-z]+-bare$/.test(k.pattern.id)){let w=k.captured.get("event"),S=(w?.raw??w?.value??"").toString().toLowerCase(),R=ke[t],B=T.KNOWN_EVENTS.has(S)||!!R&&Object.keys(R).some(O=>O.toLowerCase()===S);if(S&&!B){let O=this.trySOVEventExtraction(d,t,E);if(O){m.push(V(`bare-event mis-anchor on "${S}" rejected; SOV extraction preferred`,"info","stage-bare-event-guard"));let L=o?this.applyModifiers(O,o):O;return W(L,m)}if(w?.type==="reference"||w?.type==="expression"){f.reset(v);let L=E.filter(j=>j.command!=="on"),$=le.matchBest(f,L);f.reset(v),$&&$.pattern.command!=="on"?(b=true,m.push(V(`bare-event mis-anchor on reference "${S}" rejected; command ${$.pattern.command} preferred`,"info","stage-bare-event-guard"))):le.matchBest(f,y);}}}if(!b){let w=this.buildEventHandler(k,f,t),S=o?this.applyModifiers(w,o):w;return W(S,m)}}m.push(V(`event patterns: ${y.length} tried, no match`,"info","stage-event"));let A=this.tryTrailingEventExtraction(d,t,E);if(A){m.push(V("trailing event extraction succeeded","info","stage-trailing-event"));let b=o?this.applyModifiers(A,o):A;return W(b,m)}let x=E.filter(b=>b.command!=="on"),C=this.tryParseUnlessGuard(f,x,t);if(C&&C.length>0){let b=C.length===1?C[0]:Qe(C,"then",{sourceLanguage:t,confidence:1});return W(b,m)}let g=le.matchBest(f,x);if(g){if(Ce.has(g.pattern.command)){let w=this.trySOVEventExtraction(d,t,E);if(w){m.push(V(`SOV event extraction preferred over bare ${g.pattern.command} command`,"info","stage-sov-loop"));let R=o?this.applyModifiers(w,o):w;return W(R,m)}let S=this.tryMidStreamEventExtraction(d,t,E);if(S){m.push(V(`mid-stream event extraction preferred over bare ${g.pattern.command} command`,"info","stage-midstream-loop"));let R=o?this.applyModifiers(S,o):S;return W(R,m)}}else if(T.KNOWN_EVENTS.has(g.pattern.command)&&this.hasSOVEventMarkerHead(d,t)){let w=this.trySOVEventExtraction(d,t,E);if(w){m.push(V(`SOV event extraction preferred over command-homonym event ${g.pattern.command}`,"info","stage-sov-homonym"));let S=o?this.applyModifiers(w,o):w;return W(S,m)}}else if(_(t)?.wordOrder==="VSO"){let w=this.tryMidStreamEventExtraction(d,t,E);if(w){m.push(V(`mid-stream event extraction preferred over bare ${g.pattern.command} command`,"info","stage-midstream-cmd"));let S=o?this.applyModifiers(w,o):w;return W(S,m)}}if(g.consumedTokens<f.tokens.length&&_(t)?.wordOrder==="SOV"){let w=this.trySOVEventExtraction(d,t,E);if(w){m.push(V(`SOV event extraction preferred over partial ${g.pattern.command} command (trailing remainder)`,"info","stage-sov-trailing"));let S=o?this.applyModifiers(w,o):w;return W(S,m)}}if(g.consumedTokens<f.tokens.length&&!Ce.has(g.pattern.command)){let w=this.tryTopLevelCommandSequence(f,x,t);if(w)return m.push(V(`top-level command sequence: ${w.statements.length} commands`,"info","stage-top-level-sequence")),W(w,m)}m.push(V(`command pattern matched: ${g.pattern.id} (confidence: ${g.confidence.toFixed(2)})`,"info","pattern-match"));let b=ku(g,f,d);return b&&m.push(V(b,"warning","unconsumed-input")),W(this.buildCommand(g,t),m)}if(m.push(V(`command patterns: ${x.length} tried, no match`,"info","stage-command")),!d.includes(`
4
+ `)&&_(t)?.wordOrder==="VSO"){let b=this.tryMidStreamEventExtraction(d,t,E);if(b){m.push(V("mid-stream event extraction succeeded with no leading command match","info","stage-midstream-nocmd"));let w=o?this.applyModifiers(b,o):b;return W(w,m)}}let z=this.trySOVEventExtraction(d,t,E);if(z){m.push(V("SOV event extraction succeeded","info","stage-sov"));let b=o?this.applyModifiers(z,o):z;return W(b,m)}m.push(V("SOV event extraction: no event keyword found","info","stage-sov"));let D=this.tryCompoundCommandParsing(f,x,t);if(D)return m.push(V("compound command parsing succeeded","info","stage-compound")),W(D,m);throw m.push(V("compound parsing: no then-keywords or no command matches","info","stage-compound")),m.push(V(`all parse stages exhausted for "${d}"`,"error","parse-failed")),new Lr(`Could not parse input in ${t}: ${d}`,t,d,m)}parseStatements(e,t){let r=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(r,n,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]=W(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 mi()}buildCommand(e,t){if(!e)throw new Error("No match to build command from");let r={};for(let[a,o]of e.captured)r[a]=o;let n=te(e.pattern.command,r,{sourceLanguage:t,patternId:e.pattern.id,confidence:e.confidence});return this.registerBoundIdentifiers(n),n}buildEventHandler(e,t,r){if(!e)throw new Error("No match to build event handler from");let n=e.captured.get("event");if(!n)throw new Error("Event handler pattern matched but no event captured");{let d=n.type==="expression"?n.raw:n.type==="literal"?n.value:void 0;if(typeof d=="string"&&/^[^\s()[\]{}:]+$/.test(d)){let m=ke[r]?.[d];m?n={type:"literal",value:m,dataType:"string"}:n.type==="expression"&&T.KNOWN_EVENTS.has(d.toLowerCase())&&(n={type:"literal",value:d.toLowerCase(),dataType:"string"});}}let a=le.extractEventModifiers(t),o=e.captured.get("source");o&&e.pattern.id.endsWith("source")&&!(o.type==="reference"&&o.value==="me")&&(a={...a??{},from:o});let s=this.extractOrConjunctionEvents(t,r),u=n;s.length>0&&n.type==="literal"&&(u={type:"literal",value:[String(n.value),...s.map(m=>String("value"in m?m.value:""))].join(" or ")});let l,c=e.captured.get("action");if(c&&c.type==="literal"&&c.value==="if"){let d=t.tokens,m=-1;for(let f=t.position()-1;f>=0;f--){let h=d[f],E=(h.normalized??h.value).toLowerCase();if(this.isIfKeyword(E,r)){m=f;break}}if(m>=0){let f=ye(r).filter(A=>A.command!=="on").sort((A,x)=>x.priority-A.priority),h=d.slice(m);if(e.pattern.id.endsWith("vso-verb-first")&&u.type==="literal"){let A=String(u.value??"").split("[")[0].trim().toLowerCase(),x=h.findIndex((C,g)=>{if(g===0||A==="")return false;let z=(C.normalized??C.value).toLowerCase(),D=h[g-1];return z===A&&D.kind==="keyword"&&(D.normalized??"").toLowerCase()==="on"});if(x>0){let C=h[x+1],g=C&&C.kind==="selector"&&C.value.startsWith("[")?1:0;h=[...h.slice(0,x-1),...h.slice(x+1+g)];}}let E=new ae(h,r),y=this.coverageMark(),v=this.parseBodyWithClauses(E,f,r);if(v.some(A=>A.kind==="conditional")||v.length===1&&v[0]?.kind==="compound"&&v[0].statements.some(A=>A.kind==="conditional")){for(;!t.isAtEnd();)t.advance();return Xe(u,v,a,{sourceLanguage:r,patternId:e.pattern.id,confidence:e.confidence})}this.coverageRollback(y);}}if(c&&c.type==="literal"&&String(c.value)!=="js"&&re(String(c.value))!==void 0){let d=c.value,m={};for(let[g,z]of e.captured)g!=="event"&&g!=="action"&&g!=="continues"&&(m[g]=z);if(d==="repeat"){let g=t.peek(),z=b=>(b.normalized??b.value).toLowerCase();if(g&&g.kind==="keyword"&&z(g)==="forever")m.loopType={type:"literal",value:"forever"},delete m.patient,t.advance();else if(g&&g.kind==="keyword"&&z(g)==="event"){t.advance();let b=t.peek();if(b)for(m.event={type:"literal",value:z(b)},m.loopType={type:"literal",value:"until-event"},delete m.patient;!t.isAtEnd();){let w=t.peek();if(!w||w.kind==="conjunction"||w.kind==="keyword"&&(this.isThenKeyword(w.value,r)||this.isEndKeyword(w.value,r)))break;t.advance();}}let D=m.patient;D&&D.type==="reference"&&D.value==="me"&&delete m.patient;}let f=te(d,m,{sourceLanguage:r,patternId:e.pattern.id,confidence:e.confidence});this.registerBoundIdentifiers(f);let h=[];if(!Ce.has(d)||d==="repeat"||d==="while"){let g=e.pattern.id.includes("verb-first"),z=t.tokens,D=t.position(),b=R=>R.kind==="conjunction"||R.kind==="keyword"&&(this.isThenKeyword(R.value,r)||this.isEndKeyword(R.value,r)),w=new Set;{let R=_(r)?.keywords?.[d];R?.primary&&w.add(R.primary.toLowerCase());for(let B of R?.alternatives??[])w.add(B.toLowerCase());}let S=-1;for(let R=D-1;R>=0;R--){let B=z[R];if(b(B))break;if((B.normalized??B.value).toLowerCase()===d||w.has(B.value.toLowerCase())){S=R;break}}if(S>=0){let R=D;for(;R<z.length&&!b(z[R]);)R++;let B=z.slice(S,R),O=B;if(g){let L=String(n.value??"").toLowerCase(),$=B.findIndex(j=>(j.normalized??j.value).toLowerCase()===L);if($<0)O=null;else {let j=B[$-1],N=j&&j.kind==="keyword"&&j.normalized?.toLowerCase()==="on"?$-1:$;O=[...B.slice(0,N),...B.slice($+1)];}}if(O&&O.length>1){let L=ye(r).filter(M=>M.command!=="on").sort((M,U)=>U.priority-M.priority),$=this.coverageMark(),j=this.parseClause(O,L,r),N=j[0],X=M=>M!==null&&typeof M=="object"&&typeof M.type=="string"?M.type:typeof M,Q=re(d),zt=Q?.primaryRole,dr=M=>M==="patient"&&zt&&zt!=="patient"&&!Q?.roles.some(U=>U.role==="patient")?zt:M,ua=(M,U)=>{if(!Ce.has(d)||!Q)return false;let ge=Q.roles.find(Ue=>Ue.role===dr(M));return ge?ge.expectedTypes.length>0&&!ge.expectedTypes.includes(X(U)):true},Ct=(M,U)=>M==="patient"&&!!Q&&!Q.roles.some(ge=>ge.role==="patient")&&X(U)==="literal"&&ri.has(String(U.value??"").toLowerCase()),At=M=>M!==null&&typeof M=="object"&&M.implicit===true,la=!!N&&N.kind==="command"&&Object.entries(m).every(([M,U])=>{if(At(U)||ua(M,U)||Ct(M,U))return true;let ge=N.roles.get(dr(M));if(ge!==void 0&&X(ge)===X(U))return true;if(M==="patient"&&d==="pick"&&X(U)==="literal"){let Ue=N.roles.get("method"),fr=X(Ue),yr=fr==="literal"?String(Ue.value):fr==="expression"?String(Ue.raw):void 0;return yr!==void 0&&yr===String(U.value)}return false}),mr=N?.metadata?.patternId??"",ca=!Ce.has(d)||/^repeat-.*-(times|for-in|while-head|until-head)$/.test(mr),pa=/^repeat-.*-(times|for-in|while-head|until-head)$/.test(mr);if((j.length===1||pa&&j.length>1)&&N&&N.kind==="command"&&(N.action===d||d==="while"&&N.action==="repeat"&&/-while-head$/.test(N.metadata?.patternId??""))&&la&&ca&&(N.roles.size>Object.entries(m).filter(([M,U])=>!Ct(M,U)).length||[...N.roles.values()].filter(M=>!At(M)).length>Object.entries(m).filter(([M,U])=>!Ct(M,U)&&!At(U)).length))for(f=N,h=j.slice(1);t.position()<R;)t.advance();else this.coverageRollback($);}}}if(!Ce.has(d)){let g=f;if(re(d)?.roles.some(B=>B.role==="quantity"&&!B.required)&&!g.roles.has("quantity")){let B=t.peek();B&&/^-?\d+(\.\d+)?$/.test(B.value)&&(f=te(d,{...Object.fromEntries(g.roles),quantity:{type:"literal",value:parseFloat(B.value),dataType:"number"}},g.metadata),t.advance());}let D=f;if(re(d)?.roles.some(B=>B.role==="duration"&&!B.required)&&!D.roles.has("duration")){let B=/^\d+(\.\d+)?(ms|s)$/i,O=t.peek(),L=false;if(O&&O.kind==="particle"){let $=t.peek(1);$&&B.test($.value)&&(L=true,O=$);}O&&B.test(O.value)&&(f=te(d,{...Object.fromEntries(D.roles),duration:{type:"literal",value:O.value,dataType:"string"}},D.metadata),L&&t.advance(),t.advance(),this.consumeForPostposition(t,r));}let w=f,S=re(d);if(S?.roles.find(B=>B.role==="responseType"&&!B.required)&&!w.roles.has("responseType")){let B=N=>typeof N=="string"&&T.RESPONSE_TYPE_WORDS.has(N.toLowerCase()),O=(N,X)=>{let Q=Object.fromEntries(w.roles);X&&delete Q.destination,Q.responseType={type:"expression",raw:N},f=te(d,Q,w.metadata);},L=w.roles.get("destination"),$=S?.roles.find(N=>N.role==="destination"),j=L?.raw??L?.value;if(L&&$&&!$.expectedTypes.includes(L.type)&&B(j))O(j,true);else {let N=t.peek();N&&B(N.value)&&(O(N.value,false),t.advance());}}if(d==="wait"){let B=f;if(!B.roles.has("event")){let O=t.peek();if(O&&_e.has(O.value.toLowerCase())){let L=Object.fromEntries(B.roles),$=L.duration;$&&$.type!=="literal"&&$.type!=="expression"&&delete L.duration;let j=L.patient;j&&j.type==="reference"&&j.value==="me"&&delete L.patient,L.event={type:"literal",value:O.value,dataType:"string"},f=te(d,L,B.metadata),t.advance(),this.consumeForPostposition(t,r);}}}this.tryAttachTrailingRole(t,f,r),this.tryAttachTrailingStyle(t,f,r),this.tryAttachTrailingExpressionRole(t,f,r);}let E=e.captured.get("continues"),y=E?.type==="literal"&&E.value==="then",v=t.peek(),k=!!v&&this.isThenKeyword(v.value,r),x=Ce.has(d)&&!!v&&!this.isEndKeyword(v.value,r),C=!!v&&!this.isEndKeyword(v.value,r);if(y||k||x||C){let g=ye(r).filter(b=>b.command!=="on").sort((b,w)=>w.priority-b.priority),z=ye(r).filter(b=>b.id.startsWith("grammar-")&&b.id.includes("-continuation")).sort((b,w)=>w.priority-b.priority),D=this.parseBodyWithGrammarPatterns(t,g,z,r);D.length>0?l=[f,...h,...D]:l=[f,...h];}else l=[f,...h],t.isAtEnd()||this.recordDroppedTokens(t.tokens.slice(t.position()),r,"handler body tail");}else {let d=ye(r).filter(f=>f.command!=="on").sort((f,h)=>h.priority-f.priority),m=c?e.roleStarts?.get("action"):void 0;if(m!==void 0&&m<t.position()){let f=new ae(t.tokens.slice(m),r);for(l=this.parseBodyWithClauses(f,d,r);!t.isAtEnd();)t.advance();}else l=this.parseBodyWithClauses(t,d,r);}let p=l.length>1?[Qe(l,"then",{sourceLanguage:r})]:l;return Xe(u,p,a,{sourceLanguage:r,patternId:e.pattern.id,confidence:e.confidence})}parseBodyWithClauses(e,t,r){let n=[],a=[],o=0,s=[];for(;!e.isAtEnd();){let u=e.peek();if(!u)break;if(a.length===0){let f=this.consumeJsBlock(e,r)??this.consumeVerbFinalJsBlock(e,r);if(f){n.push(f);continue}let h=this.tryParseConditionalBlock(e,t,r);if(h){n.push(h);continue}let E=this.tryParseUnlessGuard(e,t,r);if(E){n.push(...E);continue}}let l=u.kind==="conjunction"||u.kind==="keyword"&&this.isThenKeyword(u.value,r),c=a[a.length-1],p=e.peek(1),d=c?.value.toLowerCase()==="at"&&p?.value.toLowerCase()==="of"||Ar(r,u.value,c?.value,p?.value),m=u.kind==="keyword"&&this.isEndKeyword(u.value,r)&&!d;if(m&&o>0){o--,s.pop(),a.push({...u,metadata:{...u.metadata,closesTrackedBlock:true}}),e.advance();continue}if(l&&s.includes("if")){a.push(u),e.advance();continue}if(l){if(a.length>0){let f=this.parseClause(a,t,r);n.push(...f),a.length=0,o=f.filter(h=>{let E=h;return (E.action==="for"||E.action==="repeat"||E.action==="while")&&(!Array.isArray(E.body)||E.body.length===0)}).length,s.length=0;for(let h=0;h<o;h++)s.push("other");}e.advance();continue}if(m){e.advance();let f=[];for(;!e.isAtEnd();){let h=e.peek();if(!h||h.kind==="conjunction"||h.kind==="keyword"&&(this.isThenKeyword(h.value,r)||this.isEndKeyword(h.value,r)))break;f.push(h),e.advance();}if(f.length>0){let h=this.coverageMark(),E=a.length>0?this.parseClause(a,t,r):[];E.length===0&&a.length>0?(this.coverageRollback(h),n.push(...this.parseClause([...a,...f],t,r))):(n.push(...E),n.push(...this.parseClause(f,t,r)));}else if(a.length>0){let h=this.parseClause(a,t,r);n.push(...h);}a.length=0;break}if(u.kind==="keyword"){let f=(u.normalized??u.value).toLowerCase();(this.isIfKeyword(f,r)||this.isUnlessKeyword(f,r)||f==="while"||f==="for"||f==="repeat")&&(o++,s.push(this.isIfKeyword(f,r)?"if":"other"));}a.push(u),e.advance();}if(a.length>0){let u=this.parseClause(a,t,r);n.push(...u);}e.isAtEnd()||this.recordDroppedTokens(e.tokens.slice(e.position()),r,"body stream tail"),this.foldFrontedWhileIntoRepeat(n,r);for(let u=n.length-1;u>=0;u--){let l=n[u];l.kind==="command"&&l.action==="for"&&(!(l.roles instanceof Map)||l.roles.size===0)&&(!Array.isArray(l.body)||l.body.length===0)&&n.splice(u,1);}return n.length>1?[Qe(n,"then",{sourceLanguage:r})]:n}tryTopLevelCommandSequence(e,t,r){let n=this.coverageMark(),a;try{let l=new ae(e.tokens,r);a=this.parseBodyWithClauses(l,t,r);}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 s=o.statements.map(l=>l.metadata?.confidence??.75),u=s.reduce((l,c)=>l+c,0)/s.length;return Qe(o.statements,o.chainType,{sourceLanguage:r,confidence:u})}foldFrontedWhileIntoRepeat(e,t){for(let r=0;r+1<e.length;r++){let n=e[r],a=e[r+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 s=new Map(a.roles);s.set("condition",o),s.set("loopType",{type:"literal",value:"while",dataType:"string"}),e.splice(r,2,{...a,roles:s,metadata:{...a.metadata,sourceLanguage:t,patternId:`repeat-${t}-fronted-while-fold`,confidence:Math.max(a.metadata?.confidence??0,n.metadata?.confidence??0)}});}}parseClause(e,t,r){if(e.length===0)return [];let n=null,a=e,o=e[e.length-1];if(o&&e.length>=2){let y=(o.normalized??o.value).toLowerCase();this.isUnlessKeyword(y,r)&&(n="unless",a=e.slice(0,-1));}let s=null;if(n&&a.length>=3){let y=_(r),v=y?T.buildVerbLookup(y):null;if(v)for(let k=1;k<a.length-1;k++){let A=a[k],x=v.get(A.value.toLowerCase())??(A.normalized?v.get(A.normalized.toLowerCase()):void 0);if(x&&!T.CONDITION_OPERATORS.has(x)){s=a.slice(0,k),a=a.slice(k);break}}}let u=new ae(a,r),l=[],c=this.coverageMark(),p=0,d=[],m=s,f=()=>{if(d.length===0)return;let y=d.slice();if(d.length=0,n&&l.length===0&&m===null){m=y;return}let v=y[0];if(!(v&&(v.kind==="identifier"||v.kind==="selector"||v.kind==="literal"||v.kind==="reference"))){this.recordDroppedTokens(y,r,"body clause");return}let A=false;for(let x of this.parseSOVClauseByVerbAnchoring(y,r)){let C=x.action,g=x.roles;C&&re(C)&&g instanceof Map&&g.size>0&&(l.push(x),A=true);}A||this.recordDroppedTokens(y,r,"body clause");};for(;!u.isAtEnd();){let y=u.peek(),v=!!y&&y.normalized?.toLowerCase()==="repeat",k=u.mark(),A=le.matchBest(u,t);if(v&&A&&A.pattern.command!=="repeat"){u.reset(k),f(),l.push(te("repeat",{},{sourceLanguage:r,confidence:.6})),p++,u.advance();continue}if(A&&A.pattern.command==="if"){let x=u.mark(),C=d.length;for(u.reset(k);!u.isAtEnd();){let z=u.peek();if(!z||this.isIfKeyword((z.normalized??z.value).toLowerCase(),r))break;d.push(z),u.advance();}let g=this.tryParseConditionalBlock(u,t,r);if(g){f(),l.push(g),p++;continue}d.length=C,u.reset(x);}if(A){f();let x=this.buildCommand(A,r);l.push(x),p++,this.tryAttachTrailingRole(u,x,r),this.tryAttachTrailingStyle(u,x,r),this.tryAttachTrailingExpressionRole(u,x,r),this.tryAttachTrailingDuration(u,x);}else {let x=u.peek();x&&x.normalized?.toLowerCase()==="repeat"?(f(),l.push(te("repeat",{},{sourceLanguage:r,confidence:.6})),p++):x&&d.push(x),u.advance();}}f();let h=l;if(p===0){let y=this.parseSOVClauseByVerbAnchoring(a,r);y.length>0&&(this.coverageRollback(c),h=y);}let E=m;return n&&h.length>0&&E&&E.length>0?[te(n,{condition:{type:"expression",raw:this.joinTokenText(E,r)}},{sourceLanguage:r,patternId:`${n}-${r}-trailing-guard`,confidence:.85}),...h]:n&&E&&E.length>0&&h.length===0?[te(n,{condition:{type:"expression",raw:this.joinTokenText(E,r)}},{sourceLanguage:r,patternId:`${n}-${r}-trailing-guard`,confidence:.85})]:h}tryAttachTrailingDuration(e,t){let r=t.roles;if(r.has("duration")||!re(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)||(r.set("duration",H(a.value,"duration")),e.advance());}tryAttachTrailingRole(e,t,r){let n=re(t.action);if(!n)return;let a=_(r);if(!a)return;let o=t.roles,s=(l,c)=>{if(!l)return false;if(l.kind==="selector")return true;let p=(l.normalized??l.value).toLowerCase();return Bt.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"},u=[{role:"source",strict:false},{role:"destination",strict:true}];for(let{role:l,strict:c}of u){if(!n.roles.some(E=>E.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=E=>{if(!E||E.kind!=="particle"&&E.kind!=="keyword")return false;let y=E.value.toLowerCase();return p.primary?.toLowerCase()===y?true:c?false:(E.normalized??"").toLowerCase()===l?true:!!p.alternatives?.some(v=>v.toLowerCase()===y)},f=e.peek(),h=e.peek(1);if(!f||!h)return;if(c&&p.position==="after"){let E=e.peek(2),y=(f.normalized??f.value).toLowerCase();if(gu.has(y)&&h.kind==="selector"&&m(E)){o.set(l,{type:"expression",raw:`${y} ${h.value}`}),e.advance(),e.advance(),e.advance();return}}if(p.position==="after"){if(s(f,c)&&m(h)){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),y=e.peek(3);if((h.normalized??h.value).toLowerCase()==="in"&&E&&!m(E)&&m(y)){let v=this.tokenToSemanticValue(f);e.advance(),e.advance(),e.advance(),e.advance(),v&&o.set(l,v);return}}}else if(m(f)&&s(h,c)){e.advance();let E=this.tokenToSemanticValue(e.advance());E&&o.set(l,E);return}}}tryAttachTrailingStyle(e,t,r){if(t.action!=="fetch"&&t.action!=="render")return;let n=t.roles;if(!re(t.action)?.roles.some(y=>y.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 y=Je(e,o.raw);y&&n.set("style",{type:"expression",raw:y});}this.tryAttachResponseTypeAfterStyle(e,t,r);return}if(t.action==="fetch"){let y=n.get("patient"),v=n.get("source");if(y&&v&&(y.type==="literal"||y.type==="expression")&&v.type==="expression"&&typeof v.raw=="string"&&/^[A-Za-z_][\w-]*$/.test(v.raw)&&e.peek()?.value===":"){let k=Je(e,v.raw);k&&(n.set("source",{type:"expression",raw:k}),this.tryAttachResponseTypeAfterStyle(e,t,r));return}}let u=_(r)?.roleMarkers?.style;if(!u)return;if(u.position==="before"){let y=new Set([u.primary,...u.alternatives??[]].map(x=>x.toLowerCase())),v=e.peek();if(!v||!y.has(v.value.toLowerCase()))return;let k=e.mark();e.advance();let A=Je(e);if(!A){e.reset(k);return}n.set("style",{type:"expression",raw:A}),this.tryAttachResponseTypeAfterStyle(e,t,r);return}if(u.position!=="after")return;let l=new Set([u.primary,...u.alternatives??[]].map(y=>y.toLowerCase())),c=y=>y.kind==="conjunction"||y.kind==="keyword"&&(this.isThenKeyword(y.value,r)||this.isEndKeyword(y.value,r)),p=24,d=-1,m=0;for(let y=0;y<p;y++){let v=e.peek(y);if(!v||c(v))break;if(v.value==="("||v.value==="{"?m++:(v.value===")"||v.value==="}")&&(m=Math.max(0,m-1)),m===0&&(v.kind==="particle"||v.kind==="keyword")&&l.has(v.value.toLowerCase())){d=y;break}}if(d<=0)return;let f=[];for(let y=0;y<d;y++){let v=e.peek(y);v&&f.push(v);}if(f.length===1&&T.RESPONSE_TYPE_WORDS.has(f[0].value.toLowerCase()))return;let h=new ae(f,r),E=Je(h);n.set("style",{type:"expression",raw:E&&h.isAtEnd()?E:this.joinTokenText(f,r)});for(let y=0;y<=d;y++)e.advance();this.tryAttachResponseTypeAfterStyle(e,t,r);}tryAttachResponseTypeAfterStyle(e,t,r){let n=t.roles;if(n.has("responseType")||!re(t.action)?.roles.some(c=>c.role==="responseType"&&!c.required))return;let o=c=>!!c&&T.RESPONSE_TYPE_WORDS.has(c.toLowerCase()),s=e.peek();if(!s)return;let u=c=>{n.set("responseType",{type:"expression",raw:c});};if(T.AS_MARKERS_BEFORE[r]?.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 T.AS_MARKERS_AFTER[r]??[])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,r){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,s=o.get(a.role);if(n==="go"&&s&&s.type==="expression"&&String(s.raw).toLowerCase()==="url"){let y=e.peek();if(y&&!Bt.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"}),e.advance();return}}let v=o.get("patient");if(v&&(v.type==="literal"||v.type==="selector")){o.set(a.role,v),o.set("method",{type:"literal",value:"url"}),o.delete("patient");return}}if(n==="go"&&s&&s.type==="expression"){let y=/^url\s+(\S+)$/i.exec(String(s.raw??""));if(y){let v=y[1].replace(/^["']|["']$/g,"");o.set(a.role,{type:"literal",value:v,dataType:"string"}),o.set("method",{type:"literal",value:"url"});return}}if(n==="go"&&!s){let y=o.get("patient");if(y&&y.type==="expression"&&String(y.raw).toLowerCase()==="url"){let v=e.peek();if(v&&!Bt.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"}),o.delete("patient"),e.advance();return}}}}if(s&&!(s.type==="reference"&&s.value==="me"))return;let u=_(r);if(!u)return;let l=null;if(a.terminator==="destination-marker"){let y=u.roleMarkers?.destination;if(!y||y.position!=="after")return;l=y.primary.toLowerCase();}let c=y=>y.kind==="conjunction"||y.kind==="keyword"&&(this.isThenKeyword(y.value,r)||this.isEndKeyword(y.value,r)),p=24,d=[],m=0,f=false;for(let y=0;y<p;y++){let v=e.peek(y);if(!v||c(v))break;if(v.value==="("||v.value==="{"?m++:(v.value===")"||v.value==="}")&&(m=Math.max(0,m-1)),l!==null&&m===0&&(v.kind==="particle"||v.kind==="keyword")&&v.value.toLowerCase()===l){f=true;break}d.push(v);}if(d.length===0||l!==null&&!f)return;let h=d.length+(f?1:0);if(n==="go"&&d.length===2&&d[0].value.toLowerCase()==="url"){let y=this.tokenToSemanticValue(d[1]);if(y.type==="literal"||y.type==="selector"){o.set(a.role,y),o.set("method",{type:"literal",value:"url"});let v=o.get("patient");v&&v.type==="reference"&&v.value==="me"&&!re(n)?.roles.some(k=>k.role==="patient")&&o.delete("patient");for(let k=0;k<h;k++)e.advance();return}}let E=d;if(n==="js"){let y=u.keywords?.js,v=A=>[y?.primary,...y?.alternatives??[]].some(x=>!!x&&x.length>A.value.length&&x.includes(A.value)),k=0;for(;k<E.length&&v(E[k]);)k++;if(E=E.slice(k),E.length===0)return}if(o.set(a.role,{type:"expression",raw:this.joinTokenText(E,r)}),a.role!=="patient"){let y=o.get("patient");y&&y.type==="reference"&&y.value==="me"&&!re(n)?.roles.some(v=>v.role==="patient")&&o.delete("patient");}for(let y=0;y<h;y++)e.advance();}static buildVerbLookup(e){let t=new Map;for(let[r,n]of Object.entries(e.keywords))if(!["on","if","else","when","where","while","end","then","and"].includes(r)&&(t.set(n.primary.toLowerCase(),r),n.alternatives))for(let a of n.alternatives)t.set(a.toLowerCase(),r);return t}static buildMarkerToRoleLookup(e){let t=new Map;for(let[r,n]of Object.entries(e.roleMarkers)){if(!n)continue;if((r!=="event"||!t.has(n.primary))&&t.set(n.primary,r),n.alternatives)for(let o of n.alternatives)t.has(o)||t.set(o,r);}return t}parseSOVClauseByVerbAnchoring(e,t){let r=_(t);if(!r||r.wordOrder!=="SOV")return [];let n=T.buildVerbLookup(r),a=T.buildMarkerToRoleLookup(r),o=[],s=0;for(;s<e.length;){let u=-1,l="";for(let f=s;f<e.length;f++){let h=e[f];if(a.has(h.value))continue;let E=n.get(h.value.toLowerCase()),y=h.normalized?n.get(h.normalized.toLowerCase()):void 0,v=E||y;if(v){u=f,l=v;break}}if(u===-1)break;let c=e.slice(s,u),p=e.length;for(let f=u+1;f<e.length;f++){let h=e[f];if(h.kind==="conjunction"||this.isThenKeyword(h.value,t)){p=f;break}if(f>u+1&&!a.has(h.value)&&(n.get(h.value.toLowerCase())||(h.normalized?n.get(h.normalized.toLowerCase()):void 0))){p=f;break}}let d=e.slice(u+1,p),m=this.extractRolesFromMarkedTokens(c,d,a,l,t);if(o.push(te(l,m,{sourceLanguage:t,confidence:.7})),s=p,s<e.length){let f=e[s];(f.kind==="conjunction"||this.isThenKeyword(f.value,t))&&s++;}}return o}extractRolesFromMarkedTokens(e,t,r,n,a){let o={},s=(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")},u=l=>{let c=[];for(let p=0;p<l.length;p++){let d=l[p];if(s(d,l[p+1]))continue;let m=r.get(d.value);if(m&&d.kind==="particle"&&c.length>0){let f=this.tokensToSemanticValue(c,a);if(f){let h=this.mapRoleForCommand(m,n,o);h&&(o[h]=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&&re(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 u(e),u(t),o}mapRoleForCommand(e,t,r){return t==="set"&&(e==="patient"?e="destination":e==="destination"&&(e="patient")),r[e]?e==="patient"&&!r.destination?"destination":e==="destination"&&!r.patient?"patient":e==="source"&&!r.source?"source":null:e}tokensToSemanticValue(e,t){if(e.length===0)return null;let r=e.filter(o=>o.kind!=="whitespace");if(r.length===0)return null;if(r.length>=2&&(r[0].kind==="selector"||/^[#.@*<]/.test(r[0].value))){let o=r.findIndex((s,u)=>u>0&&(s.normalized??s.value).toLowerCase()==="in");o>0&&(r=r.slice(0,o));}if(r.length===1)return this.tokenToSemanticValue(r[0]);let n=r.map(o=>o.value).join(""),a=r[0];return a.kind==="selector"||a.value.startsWith("#")||a.value.startsWith(".")||a.value.startsWith("@")||a.value.startsWith("*")?be(n):a.kind==="literal"||a.value.startsWith('"')||a.value.startsWith("'")?H(Ir(n),"string"):a.kind==="reference"?ce(n):H(this.joinTokenText(r,t))}tokenToSemanticValue(e){let t=e.value;if(e.kind==="selector"||t.startsWith("#")||t.startsWith(".")||t.startsWith("@")||t.startsWith("*"))return be(t);if(t.startsWith('"')||t.startsWith("'"))return H(Ir(t),"string");if(/^-?\d+(\.\d+)?$/.test(t))return H(parseFloat(t));if(t==="true"||t==="\u771F"||t==="\uCC38"||t==="do\u011Fru")return H(true);if(t==="false"||t==="\u507D"||t==="\uAC70\uC9D3"||t==="yanl\u0131\u015F")return H(false);if(t.length>1&&(t.startsWith(":")||t.startsWith("$")))return ce(t);let r=e.normalized?.toLowerCase();return r==="me"||r==="it"||r==="you"||r==="result"||r==="body"?ce(r):e.kind==="reference"?ce(e.normalized||"me"):H(t)}parseBodyWithGrammarPatterns(e,t,r,n){let a=[],o=[],s=false,u=()=>{if(!s&&o.length>0){let p=this.parseSOVClauseByVerbAnchoring(o,n);a.push(...p),p.length===0&&this.recordDroppedTokens(o,n,"fused body walk");}else o.length>0&&this.recordDroppedTokens(o,n,"fused body walk");o=[],s=false;},l=0,c=()=>{let p=0;for(let d of a){let m=d;(m.action==="for"||m.action==="repeat"||m.action==="while")&&(!Array.isArray(m.body)||m.body.length===0)&&p++;}return p-l};for(;!e.isAtEnd();){let p=e.peek();if(p&&this.isThenKeyword(p.value,n)){u(),e.advance();continue}if(p&&this.isEndKeyword(p.value,n)){let m=e.peek(-1),f=e.peek(1);if(!Ar(n,p.value,m?.value,f?.value)){if(u(),c()>0){l++,e.advance();continue}e.advance();break}}if(p&&!s&&this.isIfKeyword((p.normalized??p.value).toLowerCase(),n)){u();let m=this.tryParseConditionalBlock(e,t,n);if(m){a.push(m),s=true;continue}}let d=false;if(r.length>0){let m=le.matchBest(e,r);if(m){let f=m.pattern.command,h={};for(let[v,k]of m.captured)v!=="event"&&v!=="action"&&v!=="continues"&&(h[v]=k);let E=te(f,h,{sourceLanguage:n,patternId:m.pattern.id});a.push(E),d=true,s=true;let y=m.captured.get("continues");if(y&&y.type==="literal"&&y.value==="then")continue}}if(!d){let m=e.mark(),f=le.matchBest(e,t);if(f){if(f.pattern.command==="if"){let E=e.mark();for(e.reset(m);!e.isAtEnd();){let v=e.peek();if(!v||this.isIfKeyword((v.normalized??v.value).toLowerCase(),n))break;e.advance();}let y=this.tryParseConditionalBlock(e,t,n);if(y){u(),a.push(y),s=true;continue}e.reset(E);}let h=this.buildCommand(f,n);a.push(h),this.tryAttachTrailingRole(e,h,n),d=true,s=true;}}d||(p&&o.push(p),e.advance());}u(),e.isAtEnd()||this.recordDroppedTokens(e.tokens.slice(e.position()),n,"fused body walk");for(let p=a.length-1;p>=0;p--){let d=a[p];d.kind==="command"&&d.action==="for"&&(!(d.roles instanceof Map)||d.roles.size===0)&&(!Array.isArray(d.body)||d.body.length===0)&&a.splice(p,1);}return a}tryCompoundCommandParsing(e,t,r){let n=e.tokens,a=n.some(c=>c.kind==="conjunction"||c.kind==="keyword"&&this.isThenKeyword(c.value,r)),o=n.some(c=>this.isElseKeyword(c.value,r));if(!a&&!o)return null;let s=new ae(n,r),u=this.coverageMark(),l=this.parseBodyWithClauses(s,t,r);return l.length===0?(this.coverageRollback(u),null):l[0]}static isEnEventKeyword(e){if(typeof e!="string")return false;let t=e.toLowerCase(),r=T.enEventKeywordCache.get(t);if(r!==void 0)return r;let n=false;try{let a=Z(t,"en").tokens;n=a.length===1&&a[0]?.kind==="keyword";}catch{n=false;}return T.enEventKeywordCache.set(t,n),n}matchEventMarkerPhrase(e,t,r){let n=T.SOV_EVENT_MARKER_PHRASES[r];if(!n)return 0;for(let a of n)if(a.every((o,s)=>e[t+s]?.value===o))return a.length;return 0}hasSOVEventMarkerHead(e,t){let r=T.SOV_EVENT_MARKERS[t];if(r===void 0)return false;let{tokens:n}=Z(e,t),a=ke[t],o=new Set;if(a)for(let s of Object.keys(a))o.add(s.toLowerCase());for(let s=0;s<n.length;s++){let u=n[s],l=u.value.toLowerCase(),c=u.normalized?.toLowerCase();if(!(!!c&&(T.KNOWN_EVENTS.has(c)||_e.has(c))||T.KNOWN_EVENTS.has(l)||_e.has(l)||o.has(l)))continue;let d=this.matchEventParamPhrase(n,s+1).len,m=n[s+1+d];if(m&&(m.kind==="particle"||m.kind==="keyword")&&r.has(m.value)||this.matchEventMarkerPhrase(n,s+1+d,t)>0)return true}return false}matchEventParamPhrase(e,t){if(e[t]?.value!=="(")return {len:0,names:[]};let r=[];for(let n=t+1;n<e.length;n++){let a=e[n].value;if(a===")")return {len:n-t+1,names:r};if(a!==","){if(e[n].kind!=="identifier")break;r.push(a);}}return {len:0,names:[]}}isStrippableSourceRef(e,t){if(!e)return false;let r=e.normalized?.toLowerCase();if(e.kind==="keyword"&&(r==="me"||r==="i"||r==="it"))return true;let n=e.value.toLowerCase();return t.has(n)||!!r&&t.has(r)}tryTrailingEventExtraction(e,t,r){let n=Z(e,t).tokens;if(n.length<3)return null;let a=ke[t],o=new Set;if(a)for(let A of Object.keys(a))o.add(A.toLowerCase());let s=n.length-2,u=n[s];if(!(u.kind==="keyword"&&u.normalized?.toLowerCase()==="on"))return null;let c=n[n.length-1],p=c.value.toLowerCase(),d=c.normalized?.toLowerCase();if(!(!!d&&T.KNOWN_EVENTS.has(d)||T.KNOWN_EVENTS.has(p)||o.has(p)))return null;let f=d&&T.KNOWN_EVENTS.has(d)?d:a?.[p]??p,h=n.slice(0,s);if(h.length===0)return null;let E=r.filter(A=>A.command!=="on"),y=new ae(h,t),v=this.coverageMark(),k=this.parseBodyWithClauses(y,E,t);return k.length===0?(this.coverageRollback(v),null):Xe({type:"literal",value:f},k,void 0,{sourceLanguage:t,confidence:.75})}tryMidStreamEventExtraction(e,t,r){let n=Z(e,t).tokens;if(n.length<3)return null;let a=ke[t],o=new Set;if(a)for(let s of Object.keys(a))o.add(s.toLowerCase());for(let s=0;s<n.length-1;s++){let u=n[s];if(!(u.kind==="keyword"&&u.normalized?.toLowerCase()==="on"))continue;let c=n[s+1],p=c.value.toLowerCase(),d=c.normalized?.toLowerCase();if(!(!!d&&T.KNOWN_EVENTS.has(d)||T.KNOWN_EVENTS.has(p)||o.has(p)))continue;let f=d&&T.KNOWN_EVENTS.has(d)?d:a?.[p]??p,h=n.filter((A,x)=>x!==s&&x!==s+1);if(h.length===0)return null;let E=r.filter(A=>A.command!=="on"),y=new ae(h,t),v=this.coverageMark(),k=this.parseBodyWithClauses(y,E,t);return k.length===0?(this.coverageRollback(v),null):Xe({type:"literal",value:f},k,void 0,{sourceLanguage:t,confidence:.75})}return null}trySOVEventExtraction(e,t,r){let n=T.SOV_EVENT_MARKERS[t];if(!n)return null;let o=Z(e,t).tokens,s=ke[t],u=new Set;if(s)for(let C of Object.keys(s))u.add(C.toLowerCase());let l=T.SOV_SOURCE_MARKERS[t],c=-1,p="",d="",m=1,f=[];for(let C=0;C<o.length;C++){let g=o[C],z=g.value.toLowerCase(),D=z,b="",w=z.indexOf("[");w>0&&(D=z.slice(0,w),b=g.value.slice(w));let S=g.normalized?.toLowerCase(),R=S&&(T.KNOWN_EVENTS.has(S)||_e.has(S)),B=u.has(z)||u.has(D),O=T.KNOWN_EVENTS.has(D)||_e.has(D);if(R||B||O){let L=o[C-1];if(L&&(L.normalized??L.value).toLowerCase()==="event")continue;let $;R?$=S:B?$=s?.[z]??s?.[D]??D:$=D;let j=this.matchEventParamPhrase(o,C+1);if(n.size>0){let N=1+j.len,X=o[C+N];X&&X.kind==="selector"&&X.value.startsWith("[")&&(N+=1);let Q=o[C+N];if(Q&&(Q.kind==="particle"||Q.kind==="keyword")&&n.has(Q.value)){c=C,p=$,d=b||(N===j.len+2?o[C+N-1].value:""),m=N+1,f=j.names;break}}else {c=C,p=$,d=b,m=1+j.len+this.matchEventMarkerPhrase(o,C+1+j.len,t),f=j.names;break}}}if(c===-1){let C=new Set(r.filter(g=>g.command!=="on").map(g=>g.command));for(let g=0;g<o.length;g++){let z=o[g];if(z.kind==="identifier")if(n.size>0){let D=1,b=o[g+1];b&&b.kind==="selector"&&b.value.startsWith("[")&&(D=2);let w=o[g+D];if(w&&(w.kind==="particle"||w.kind==="keyword")&&n.has(w.value)){c=g,p=z.value,d=D===2?o[g+1].value:"",m=D+1;break}}else {let D=this.matchEventMarkerPhrase(o,g+1,t);if(D>0){c=g,p=z.value,d="",m=1+D;break}let b=o[g+1];if(b&&b.kind==="keyword"&&b.normalized!=null&&C.has(b.normalized)){c=g,p=z.value,d="",m=1;break}}}}if(c===-1)return null;let h=new Set;for(let C=c;C<c+m;C++)h.add(C);if(l){let C=c+m;if(C<o.length){let g=o[C];if((g.kind==="particle"||g.kind==="keyword")&&l.markers.has(g.value))h.add(C);else if(this.isStrippableSourceRef(g,l.windowTokens)){let z=o[C+1];z&&(z.kind==="particle"||z.kind==="keyword")&&l.markers.has(z.value)&&(h.add(C),h.add(C+1));}}if(c>=2){let g=o[c-1];(g.kind==="particle"||g.kind==="keyword")&&l.markers.has(g.value)&&this.isStrippableSourceRef(o[c-2],l.windowTokens)&&(h.add(c-2),h.add(c-1));}for(let g=0;g<c;g++){let z=o[g],D=z.value.toLowerCase(),b=z.normalized?.toLowerCase();if(l.windowTokens.has(D)||b&&l.windowTokens.has(b)){h.add(g);break}}}let E=o.filter((C,g)=>!h.has(g));if(E.length===0)return null;let y=r.filter(C=>C.command!=="on"),v=new ae(E,t),k=this.coverageMark(),A=this.parseBodyWithClauses(v,y,t);if(A.length===0)return this.coverageRollback(k),null;let x={sourceLanguage:t,confidence:.75};return d&&(x.keyFilter=d),Xe(T.isEnEventKeyword(p)?{type:"literal",value:p}:{type:"expression",raw:p},A,void 0,x,f)}profileKeywordMatches(e,t,r){let n=_(e)?.keywords?.[t];return n?n.primary?.toLowerCase()===r?true:!!n.alternatives?.some(a=>a.toLowerCase()===r):false}consumeForPostposition(e,t){let r=e.peek();if(!r)return;let n=(r.normalized??"").toLowerCase(),a=_(t)?.keywords?.for;(n==="for"||r.value===a?.primary||(a?.alternatives??[]).includes(r.value))&&e.advance();}isThenKeyword(e,t){let r=e.toLowerCase(),a={en:new Set(["then"]),ja:new Set(["\u305D\u308C\u304B\u3089","\u6B21\u306B","\u305D\u3057\u3066"]),ar:new Set(["\u062B\u0645","\u0628\u0639\u062F\u0647\u0627","\u062B\u0645\u0651"]),es:new Set(["entonces","luego","despu\xE9s"]),ko:new Set(["\uADF8\uB2E4\uC74C","\uADF8\uB9AC\uACE0","\uADF8\uB7F0\uD6C4","\uADF8\uB7EC\uBA74"]),zh:new Set(["\u7136\u540E","\u63A5\u7740","\u90A3\u4E48"]),tr:new Set(["ard\u0131ndan","daha sonra","ardindan"]),pt:new Set(["ent\xE3o","depois","logo"]),fr:new Set(["puis","ensuite","alors"]),de:new Set(["dann","danach","anschlie\xDFend"]),id:new Set(["lalu","kemudian","setelah itu"]),tl:new Set(["pagkatapos","tapos"]),bn:new Set(["\u09A4\u09BE\u09B0\u09AA\u09B0"]),qu:new Set(["chaymantataq","hinaspa","chaymanta","chayqa"]),sw:new Set(["kisha","halafu","baadaye"])}[t];return a?a.has(r):r==="then"||this.profileKeywordMatches(t,"then",r)}isElseKeyword(e,t){let r=e.toLowerCase();return r==="else"?true:this.profileKeywordMatches(t,"else",r)}isEndKeyword(e,t){let r=e.toLowerCase(),n=ys(t);return n?r==="end"||n.has(r):r==="end"||this.profileKeywordMatches(t,"end",r)}isJsKeyword(e){let t=(e.normalized??e.value).toLowerCase();return t==="js"||this.profileKeywordMatches("en","js",t)}isPatientMarker(e,t){let r=_(t)?.roleMarkers?.patient;if(!r?.primary)return false;let n=e.value.toLowerCase();return r.primary.toLowerCase()===n?true:!!r.alternatives?.some(a=>a.toLowerCase()===n)}isJsBlockTerminator(e,t){return this.isEndKeyword(e,t)||this.profileKeywordMatches(t,"end",e.toLowerCase())}consumeVerbFinalJsBlock(e,t){let r=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 s=o[o.length-1];if(s&&this.isPatientMarker(s,t)&&o.pop(),o.length===0)return e.reset(r),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(),te("js",{patient:{type:"expression",raw:u||"()"}},{sourceLanguage:t,patternId:`js-opaque-final-${t}`,confidence:1})}consumeJsBlock(e,t){let r=e.peek();if(!r||!this.isJsKeyword(r))return null;let n=e.mark(),a=[];e.advance();let o=e.peek();o&&r.position?.end!==void 0&&r.position.end===o.position?.start&&this.profileKeywordMatches(t,"js",`${r.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(n),null;let l=this.rawJsBody(a);return te("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,r=e[e.length-1].position?.end,n=this.positionSource;if(n!==void 0&&t!==void 0&&r!==void 0){let o=n.slice(t,r),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 r=e.toLowerCase();return r==="if"?true:this.profileKeywordMatches(t,"if",r)}isUnlessKeyword(e,t){let r=e.toLowerCase();return r==="unless"?true:this.profileKeywordMatches(t,"unless",r)}tryParseUnlessGuard(e,t,r){let n=e.peek();if(!n||!this.isUnlessKeyword((n.normalized??n.value).toLowerCase(),r))return null;let a=e.mark(),o=this.tryParseConditionalBlock(e,t,r,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?[te("unless",{condition:u},{sourceLanguage:r,patternId:`unless-${r}-guard`,confidence:1}),...s.thenBranch]:(e.reset(a),null)}isBlockEndToken(e,t,r){return this.isEndKeyword(e.value,r)?true:e.kind!=="keyword"||(e.normalized??"").toLowerCase()!=="end"?false:!(t&&t.kind==="selector")}tryParseConditionalBlock(e,t,r,n=false){let a=e.peek();if(!a)return null;let o=(a.normalized??a.value).toLowerCase();if(!this.isIfKeyword(o,r)&&!(n&&this.isUnlessKeyword(o,r)))return null;let s=e.mark(),u=this.coverageMark();e.advance();let l=[],c=0;for(;!e.isAtEnd();){let z=e.peek();if(!z)break;let D=(z.normalized??z.value).toLowerCase();if(this.isIfKeyword(D,r)||this.isUnlessKeyword(D,r)){c++,l.push(z),e.advance();continue}if(this.isBlockEndToken(z,e.peek(1)??void 0,r)){if(c===0){e.advance();break}c--,l.push(z),e.advance();continue}l.push(z),e.advance();}if(l.length===0)return e.reset(s),this.coverageRollback(u),null;let p=_(r),d=p?.wordOrder==="SOV"?T.buildVerbLookup(p):null,m=0,f=0,h=[];for(;m<l.length;m++){let z=l[m],D=(z.normalized??z.value).toLowerCase();if(this.isIfKeyword(D,r)||this.isUnlessKeyword(D,r)?f++:this.isBlockEndToken(z,l[m+1],r)&&f--,f===0&&this.isThenKeyword(z.value,r)){m++;break}if(f===0&&h.length>0){let b=(l[m-1].normalized??l[m-1].value).toLowerCase(),w=l[m-1].value.toLowerCase(),S=(z.normalized??z.value).toLowerCase(),R=T.CONDITION_COPULAS.has(b)||T.CONDITION_COPULAS_SURFACE.has(w)&&T.CONDITION_PREDICATES.has(S),B=d!==null&&d.has(z.value.toLowerCase())&&!T.CONDITION_PREDICATES.has(S),O=/^\.[a-zA-Z_]\w*$/.test(z.value)&&l[m-1].position?.end!==void 0&&z.position?.start!==void 0&&l[m-1].position.end===z.position.start;if(!T.CONDITION_OPERATORS.has(S)&&!O&&(!R||B)&&(this.tokensBeginCommand(l.slice(m),t,r)||this.sovCommandStartsAt(l.slice(m),d)))break}h.push(z);}if(h.length===0)return e.reset(s),this.coverageRollback(u),null;let y=[],v=[],k=false,A=0;for(;m<l.length;m++){let z=l[m],D=(z.normalized??z.value).toLowerCase();if(this.isIfKeyword(D,r)||this.isUnlessKeyword(D,r)?A++:this.isBlockEndToken(z,l[m+1],r)&&A--,A===0&&!k&&this.isElseKeyword(z.value,r)){k=true;continue}(k?v:y).push(z);}let x={type:"expression",raw:this.joinTokenText(h,r)},C=this.parseBranch(y,t,r),g=v.length>0?this.parseBranch(v,t,r):void 0;return C.length===0&&(!g||g.length===0)?(e.reset(s),this.coverageRollback(u),null):Xo(x,C,g,{sourceLanguage:r,patternId:`conditional-${r}-folded`,confidence:1})}joinTokenText(e,t){return Le(e,_(t))}tokensBeginCommand(e,t,r){if(e.length===0)return false;let n=new ae(e,r);return le.matchBest(n,t)!==null}sovCommandStartsAt(e,t){if(!t)return false;let r=s=>t.has(s.value.toLowerCase())||!!s.normalized&&t.has(s.normalized.toLowerCase()),n=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(!n(s)||u.kind!=="particle")break;o+=1,a+=2;let l=e[a];if(o>=1&&l&&r(l))return true}return false}parseBranch(e,t,r){if(e.length===0)return [];let n=new ae(e,r),a=this.parseBodyWithClauses(n,t,r);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(),s=T.STANDALONE_MODIFIERS[o];if(!s)return {modifiers:null,remainingInput:null};let u={},l=1;if(s==="once")u.once=true;else {let m=1;if(m<n.length){let f=n[m],h=n[m+1],E=f.kind==="identifier"&&h?.kind==="literal"&&/^\d+(ms|s|m)?$/.test(h.value);(f.kind==="keyword"||f.kind==="particle"||E)&&(m++,l++);}if(m<n.length){let f=n[m];if(f.kind==="literal"){let h=f.value.match(/^(\d+)(ms|s|m)?$/);if(h){let E=parseInt(h[1],10),y=h[2]||"ms";y==="s"?E*=1e3:y==="m"&&(E*=6e4),u[s]=E,l=m+1;}}}u[s]||(u[s]=s==="debounce"?300:100);}let c=n.slice(l);if(c.length===0)return {modifiers:null,remainingInput:null};let p=c[0].position.start,d=e.slice(p);return {modifiers:u,remainingInput:d}}stripAsyncModifier(e,t){let r=_(t)?.keywords?.async,n=new Set(["async"]);r?.primary&&n.add(r.primary.toLowerCase()),r?.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 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 r=Z(e,t).tokens;for(let n=0;n<r.length-1;n++){if(r[n].value.toLowerCase()!=="do")continue;let a=-1;for(let l=n+1;l<=n+5&&l<r.length;l++){let c=r[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=r[n].position.start,s=r[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,r)=>t+(parseInt(/left (\d+) token/.exec(r.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(r=>{if(r.code!=="unconsumed-input")return true;let n=/unconsumed: "(.*)"$/.exec(r.message)?.[1];return !n||n.replace(/\s+/g," ").trim()!==t})}}reclaimDanglingFromTail(e,t,r){let n=T.droppedTokenCount,a=T.unconsumedSpans(e);if(a.length===0)return null;let o=n(e),s=_(r)?.roleMarkers?.source,u=new Set;s?.primary&&u.add(s.primary),s?.alternatives?.forEach(c=>u.add(c));let l=Z(t,r).tokens;for(let c=0;c<l.length;c++){let p=l[c];if(p.normalized!=="source"&&!u.has(p.value))continue;let d=s?.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),h=Math.max(p.position.end,m.position.end),E=t.slice(f,h).replace(/\s+/g," ").trim();if(!a.some(v=>v===E||v.includes(E)))continue;let y=(t.slice(0,f).trimEnd()+" "+t.slice(h).trimStart()).trim();if(!(!y||y===t))try{let v=this.parse(y,r);if(!v||v.kind!=="event-handler")continue;let k=Pt(v);if(n(k)<o)return {node:{...k,eventModifiers:{...k.eventModifiers,from:{type:"literal",value:m.value,dataType:"string"}}},input:y}}catch{}}return null}reclaimEventCompoundTail(e,t,r){let n=T.unconsumedSpans(e);if(n.length===0)return null;let a=ke[r];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=p=>p.replace(/\s+/g," ").trim(),c=Z(t,r).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 h=c[d-1];if((a[h.value]??h.normalized)!==u)break;let y=l(t.slice(h.position.start,c[m].position.end)),v=a[y];if(!v)break;return o.set("event",{type:"literal",value:v,dataType:"string"}),{node:T.withoutSpanDiagnostics(e,p),input:t}}return null}reclaimResponseTypeTail(e,t,r){let n=T.unconsumedSpans(e);if(n.length===0)return null;let a=T.AS_MARKERS_BEFORE[r];if(!a)return null;let o=l=>l.replace(/\s+/g," ").trim(),s=T.droppedTokenCount(e),u=Z(t,r).tokens;for(let l=0;l+1<u.length;l++){let c=u[l],p=u[l+1];if(!a.some(f=>c.value.toLowerCase()===f)||!T.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,r);if(!f||f.kind!=="event-handler")continue;let h=Pt(f);if(T.droppedTokenCount(h)>=s)continue;let E=T.findResponseTypeTarget(h);if(!E)continue;return E.roles.set("responseType",{type:"expression",raw:p.value}),{node:h,input:m}}catch{}}return null}static findResponseTypeTarget(e){let t=null,r=n=>{if(!n||typeof n!="object"||t)return;if(n.kind==="command"){let o=n;if(re(o.action)?.roles.some(u=>u.role==="responseType"&&!u.required)&&!o.roles.has("responseType")){t=o;return}}let a=n;for(let o of ["body","statements","thenBranch","elseBranch","commands"]){let s=a[o];Array.isArray(s)&&s.forEach(u=>r(u));}};return r(e),t}reclaimCapturedDestinationTail(e,t,r){let n=T.unconsumedSpans(e);if(n.length===0)return null;let a=_(r)?.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=Z(t,r).tokens;for(let l=0;l+1<u.length;l++){let c=u[l],p=u[l+1],d=o.has(c.value)&&p.normalized==="me",m=c.normalized==="me"&&o.has(p.value);if(!d&&!m)continue;let f=s(t.slice(c.position.start,p.position.end));if(!n.includes(f))continue;let h=false,E=y=>{if(!y||typeof y!="object"||h)return;if(y.kind==="command"){let k=y.roles.get("destination");if(k?.type==="reference"&&k.value==="me"){h=true;return}}let v=y;for(let k of ["body","statements","thenBranch","elseBranch","commands"]){let A=v[k];Array.isArray(A)&&A.forEach(x=>E(x));}};if(E(e),!!h)return {node:T.withoutSpanDiagnostics(e,f),input:t}}return null}applyModifiers(e,t){return {...e,eventModifiers:{...e.eventModifiers,...t}}}extractOrConjunctionEvents(e,t){let r=[];for(;;){let n=e.mark(),a=e.peek();if(!a)break;if(!Lt(a,t)){e.reset(n);break}e.advance();let o=e.peek();if(!o){e.reset(n);break}let s=(o.normalized||o.value).toLowerCase();e.advance(),r.push({type:"literal",value:s});}return r}};ee.coverageMarkerSurfaces=new Map;ee.LEAKED_RENDER_MARKERS={hi:["\u0915\u0947","\u0930\u0942\u092A","\u092E\u0947\u0902"],tr:["olarak"],qu:["hina"]};ee.AS_MARKERS_BEFORE={en:["as"],es:["como"],fr:["comme"],pt:["como"],it:["come"],de:["als"],id:["sebagai"],ms:["sebagai","sbg"],sw:["kuwa","kama"],th:["\u0E40\u0E1B\u0E47\u0E19"],vi:["nh\u01B0"],tl:["bilang"],he:["\u05DB"],ar:["\u0643\u0640"],pl:["jako"],ru:["\u043A\u0430\u043A"],uk:["\u044F\u043A"],zh:["\u7684","\u4F5C\u4E3A","\u5F53\u4F5C"]};ee.AS_MARKERS_AFTER={ko:[["\uB85C"],["\uC73C\uB85C"]],qu:[["hina"]],tr:[["olarak"]],hi:[["\u0915\u0947","\u0930\u0942\u092A","\u092E\u0947\u0902"]]};ee.enEventKeywordCache=new Map;ee.KNOWN_EVENTS=new Set(["click","dblclick","input","change","submit","keydown","keyup","keypress","mouseover","mouseout","mousedown","mouseup","focus","blur","load","scroll","resize","contextmenu"]);ee.RESPONSE_TYPE_WORDS=new Set(["json","text","html","xml","blob","arraybuffer","formdata","response"]);ee.SOV_EVENT_MARKERS={ja:new Set(["\u3067"]),ko:new Set,tr:new Set(["de","da","te","ta"]),bn:new Set(["\u098F"]),qu:new Set(["pi"]),hi:new Set(["\u092A\u0930"])};ee.SOV_EVENT_MARKER_PHRASES={ko:[["\uD560","\uB54C"],["\uD560\uB54C"]]};ee.SOV_SOURCE_MARKERS={ja:{markers:new Set(["\u304B\u3089"]),windowTokens:new Set(["\u30A6\u30A3\u30F3\u30C9\u30A6","\u30C9\u30AD\u30E5\u30E1\u30F3\u30C8","window","document"])},ko:{markers:new Set(["\uC5D0\uC11C"]),windowTokens:new Set(["\uCC3D","\uC708\uB3C4\uC6B0","\uBB38\uC11C","window","document"])},tr:{markers:new Set(["den","dan","ten","tan"]),windowTokens:new Set(["pencere","belge","window","document"])},bn:{markers:new Set(["\u09A5\u09C7\u0995\u09C7","\u09AE\u09A7\u09CD\u09AF\u09C7"]),windowTokens:new Set(["\u0989\u0987\u09A8\u09CD\u09A1\u09CB","\u09A1\u0995\u09C1\u09AE\u09C7\u09A8\u09CD\u099F","window","document"])},qu:{markers:new Set(["manta"]),windowTokens:new Set(["k_iri","ventana","window","document"])},hi:{markers:new Set(["\u0938\u0947"]),windowTokens:new Set(["\u0935\u093F\u0902\u0921\u094B","\u0926\u0938\u094D\u0924\u093E\u0935\u0947\u091C\u093C","window","document"])}};ee.CONDITION_COPULAS=new Set(["is","am","are","be","was","were","not","no"]);ee.CONDITION_COPULAS_SURFACE=new Set(["\u0647\u0648","\u0E40\u0E1B\u0E47\u0E19","\u0939\u0948"]);ee.CONDITION_PREDICATES=new Set(["empty","null","undefined"]);ee.CONDITION_OPERATORS=new Set(["matches","match","contains","exists","has","have","equals","includes"]);ee.STANDALONE_MODIFIERS={once:"once",debounced:"debounce",debounce:"debounce",throttled:"throttle",throttle:"throttle"};var wu=ee,zu=new wu;function Cu(i,e){return zu.parse(i,e)}function Au(i,e){try{let t=Z(i,e),r=ye(e);if(r.length===0)return {confidence:0,parseSuccess:!1,error:`No patterns available for language: ${e}`};let n=[...r].sort((l,c)=>c.priority-l.priority),a=n.filter(l=>l.command==="on"),o=le.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=n.filter(l=>l.command!=="on"),u=le.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: ${i}`}}catch(t){return {confidence:0,parseSuccess:false,error:t instanceof Error?t.message:String(t)}}}function bi(i,e){try{let r=Cu(i,e);if(r)return {node:r,confidence:r.metadata?.confidence??.8,error:void 0,tokensConsumed:Z(i,e).tokens.length}}catch{}let t=Au(i,e);return t.parseSuccess?{node:null,confidence:t.confidence,error:void 0,tokensConsumed:t.tokensConsumed}:{node:null,confidence:0,error:t.error}}function wi(i,e){let t=e==="SOV"?"sovPosition":"svoPosition";return [...i].sort((r,n)=>{let a=r[t]??99,o=n[t]??99;return a-o})}function qe(i,e){let t,r;if(i.markerOverride&&i.markerOverride[e.code]!==void 0)t=i.markerOverride[e.code],r=t?he(i,e.code,t):void 0;else {let n=e.roleMarkers[i.role];if(n){t=n.primary;let a=he(i,e.code,t)??[],o=[...new Set([...n.alternatives??[],...a])].filter(s=>s!==t);r=o.length?o:void 0;}}return {marker:t,alternatives:r}}function it(i,e,t){t.roles.find(n=>n.role==="scope"&&!n.required)&&(i.push({type:"group",optional:true,tokens:[{type:"literal",value:"on"},{type:"role",role:"scope",optional:true,expectedTypes:["selector","reference"]}]}),e.scope={fromRole:"scope"});}function Yt(i,e,t,r){Ci(i,e,t,r,"manner",{requireMarker:true});}function zi(i,e,t,r){Ci(i,e,t,r,"recipient",{requireMarker:false});}function Ci(i,e,t,r,n,a){let o=t.roles.find(u=>u.role===n&&!u.required);if(!o)return;let s=o.markerOverride?.[r];a.requireMarker&&!s||(i.push({type:"group",optional:true,tokens:[...(s?s.split(/\s+/):[]).map(u=>({type:"literal",value:u})),{type:"role",role:n,optional:true,expectedTypes:o.expectedTypes,...o.valueShape!==void 0?{valueShape:o.valueShape}:{}}]}),e[n]={fromRole:n});}function Ai(i){if(i.roles.some(r=>r.role==="patient"))return "patient";let e=i.roles.filter(r=>r.required),t=e.find(r=>r.role===i.primaryRole)??e[0];return !t||t.role==="event"?"patient":t.role}function xi(i,e,t){let r=i.roles.find(c=>c.role===t);if(!r||t==="patient")return [{type:"role",role:t,optional:false}];let{marker:n,alternatives:a}=qe(r,e),o={type:"role",role:t,optional:false,...r.valueShape!==void 0?{valueShape:r.valueShape}:{}};if(!n)return [o];let s=n.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 Si(i,e,t,r,n){for(let a of t.roles)a.required||n.has(a.role)||e[a.role]||!(a.markerOverride?.[r.code]??r.roleMarkers[a.role]?.primary)&&a.valueShape===void 0||(i.push({type:"group",optional:true,tokens:Bi(a,r)}),e[a.role]=a.default?{fromRole:a.role,default:a.default}:{fromRole:a.role});}function xu(i,e,t,r,n){let a=[];if(a.push({type:"role",role:"event",optional:false}),r.position==="after"){let f=r.primary.split(/\s+/);if(f.length>1)for(let h of f)a.push({type:"literal",value:h});else {let h=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};a.push(h);}}let o=Ai(i),s=e.roleMarkers.destination,u=i.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=i.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(...xi(i,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(...De(i,e.roleMarkers.source)),o!=="destination"&&a.push(...$t(i,e.roleMarkers.destination));let m={action:{value:i.action},event:{fromRole:"event"},[o]:{fromRole:o},...o==="destination"?{}:xe(i),...o==="source"?{}:Se(i)};return Si(a,m,i,e,new Set(["event",o,"destination","source"])),{id:`${i.action}-event-${e.code}-sov`,language:e.code,command:"on",priority:(n.basePriority??100)+50,template:{format:`{event} ${r.primary} {destination?} {${o}} ${p?.primary||""} ${t.primary}`,tokens:a},extraction:m}}function Su(i,e,t,r,n){let a=[],o=i.action==="swap",s=o?"destination":"patient";a.push({type:"role",role:s,optional:false});let u=e.roleMarkers.patient;if(u){let d=u.alternatives?{type:"literal",value:u.primary,alternatives:u.alternatives}:{type:"literal",value:u.primary};a.push(d);}if(a.push({type:"role",role:"event",optional:false}),r.position==="after"){let d=r.primary.split(/\s+/);if(d.length>1)for(let m of d)a.push({type:"literal",value:m});else {let m=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.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(...De(i,e.roleMarkers.source));let c=e.roleMarkers.destination;if(o&&c){let d=i.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?Ya(i,c):$t(i,c));let p={action:{value:i.action},event:{fromRole:"event"},[s]:{fromRole:s},...o?{}:xe(i),...Se(i)};return zi(a,p,i,e.code),Yt(a,p,i,e.code),{id:`${i.action}-event-${e.code}-sov-patient-first`,language:e.code,command:"on",priority:(n.basePriority??100)+45,template:{format:`{patient} ${u?.primary||""} {event} ${r.primary} ${t.primary}`,tokens:a},extraction:p}}function Du(i,e,t,r,n){let a=i.roles.find(p=>p.role==="source");if(!a)return null;let{marker:o,alternatives:s}=qe(a,e),u=e.roleMarkers.patient;if(!o||o===r.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 p of o.split(/\s+/))l.push(s&&o.split(/\s+/).length===1?{type:"literal",value:p,alternatives:s}:{type:"literal",value:p});if(l.push({type:"role",role:"event",optional:false}),r.position==="after"){let p=r.primary.split(/\s+/);if(p.length>1)for(let d of p)l.push({type:"literal",value:d});else l.push(r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary});}l.push(t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary});let c={action:{value:i.action},event:{fromRole:"event"},patient:{fromRole:"patient"},source:{fromRole:"source"}};return zi(l,c,i,e.code),Yt(l,c,i,e.code),{id:`${i.action}-event-${e.code}-sov-source-fronted`,language:e.code,command:"on",priority:(n.basePriority??100)+48,template:{format:`{patient} ${u?.primary||""} {source} ${o} {event} ${r.primary} ${t.primary}`,tokens:l},extraction:c}}function Tu(i,e,t,r,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 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}),r.position==="after"){let l=r.primary.split(/\s+/);if(l.length>1)for(let c of l)a.push({type:"literal",value:c});else {let c=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.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:`${i.action}-event-${e.code}-sov-patient-first-dest`,language:e.code,command:"on",priority:(n.basePriority??100)+40,template:{format:`{patient} ${o?.primary||""} {destination} ${s?.primary||""} {event} ${r.primary} ${t.primary}`,tokens:a},extraction:{action:{value:i.action},event:{fromRole:"event"},patient:{fromRole:"patient"},destination:{fromRole:"destination"}}}}function Bu(i,e,t,r,n){let a=[];a.push({type:"role",role:"event",optional:false});let o=r.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(...De(i,e.roleMarkers.source)),a.push(...$t(i,e.roleMarkers.destination)),{id:`${i.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:i.action},event:{fromRole:"event"},patient:{fromRole:"patient"},...xe(i),...Se(i)}}}function Pu(i,e,t,r,n){let a=[];if(a.push({type:"role",role:"event",optional:false}),r.position==="after"){let s=r.primary.split(/\s+/);if(s.length>1)for(let u of s)a.push({type:"literal",value:u});else {let u=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.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:`${i.action}-event-${e.code}-sov-simple`,language:e.code,command:"on",priority:(n.basePriority??100)+48,template:{format:`{event} ${r.primary} ${t.primary}`,tokens:a},extraction:{action:{value:i.action},event:{fromRole:"event"},patient:{default:{type:"reference",value:"me"}}}}}function Fu(i,e,t,r){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 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:`${i.action}-event-${e.code}-sov-temporal`,language:e.code,command:"on",priority:(r.basePriority??100)+49,template:{format:`{event} ${n[0]} {patient} ${t.primary}`,tokens:a},extraction:{action:{value:i.action},event:{fromRole:"event"},patient:{fromRole:"patient"}}}}function Ru(i,e,t,r,n){let a=[];if(a.push({type:"role",role:"event",optional:false}),r.position==="after"){let p=r.primary.split(/\s+/);if(p.length>1)for(let d of p)a.push({type:"literal",value:d});else {let d=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};a.push(d);}}let s=[...i.roles.filter(p=>p.required)].sort((p,d)=>{let m=p.sovPosition??999,f=d.sovPosition??999;return m-f});for(let p of s){a.push({type:"role",role:p.role,optional:false});let{marker:d,alternatives:m}=qe(p,e);if(d){let f=m?{type:"literal",value:d,alternatives:m}:{type:"literal",value:d};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(p=>`{${p.role}}`).join(" "),c={action:{value:i.action},event:{fromRole:"event"},...Object.fromEntries(s.map(p=>[p.role,{fromRole:p.role}]))};return it(a,c,i),{id:`${i.action}-event-${e.code}-sov-2role`,language:e.code,command:"on",priority:(n.basePriority??100)+55,template:{format:`{event} ${r.primary} ${l} ${t.primary}`,tokens:a},extraction:c}}function Ou(i,e,t,r,n){let a=[],s=[...i.roles.filter(c=>c.required)].sort((c,p)=>{let d=c.sovPosition??999,m=p.sovPosition??999;return d-m});for(let c of s){a.push({type:"role",role:c.role,optional:false});let{marker:p,alternatives:d}=qe(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}),r.position==="after"){let c=r.primary.split(/\s+/);if(c.length>1)for(let p of c)a.push({type:"literal",value:p});else a.push(r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary});}let u=s.map(c=>`{${c.role}}`).join(" "),l={action:{value:i.action},event:{fromRole:"event"},...Object.fromEntries(s.map(c=>[c.role,{fromRole:c.role}]))};return it(a,l,i),{id:`${i.action}-event-${e.code}-sov-2role-event-last`,language:e.code,command:"on",priority:(n.basePriority??100)+40,template:{format:`${u} ${t.primary} {event} ${r.primary}`,tokens:a},extraction:l}}function _u(i,e,t,r,n){let a=[],s=[...i.roles.filter(E=>E.required)].sort((E,y)=>{let v=E.sovPosition??999,k=y.sovPosition??999;return v-k}),u=s[0];a.push({type:"role",role:u.role,optional:false});let{marker:l,alternatives:c}=qe(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}),r.position==="after"){let E=r.primary.split(/\s+/);if(E.length>1)for(let y of E)a.push({type:"literal",value:y});else {let y=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};a.push(y);}}let p=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};a.push(p);let d=s[1];a.push({type:"role",role:d.role,optional:false});let{marker:m,alternatives:f}=qe(d,e);if(m){let E=f?{type:"literal",value:m,alternatives:f}:{type:"literal",value:m};a.push(E);}let h={action:{value:i.action},event:{fromRole:"event"},[u.role]:{fromRole:u.role},[d.role]:{fromRole:d.role}};return it(a,h,i),{id:`${i.action}-event-${e.code}-sov-2role-dest-first`,language:e.code,command:"on",priority:(n.basePriority??100)+48,template:{format:`{${u.role}} {event} ${r.primary} ${t.primary} {${d.role}}`,tokens:a},extraction:h}}function Di(i,e,t){let r=he(i,e.code,t.primary)??[],n=[...new Set([...t.alternatives??[],...r])].filter(a=>a!==t.primary);return n.length?n:void 0}function Mr(i,e,t,r,n){let a=[];if(r.position==="before"){let p=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.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=Ai(i);a.push(...xi(i,e,s));let u=e.roleMarkers.destination,l=i.roles.some(p=>p.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(...De(i,e.roleMarkers.source));let c={action:{value:i.action},event:{fromRole:"event"},[s]:{fromRole:s},...s==="destination"?{}:xe(i),...s==="source"?{}:Se(i)};return Si(a,c,i,e,new Set(["event",s,"destination","source"])),{id:`${i.action}-event-${e.code}-vso`,language:e.code,command:"on",priority:(n.basePriority??100)+50,template:{format:`${r.primary} {event} ${t.primary} {${s}} ${u?.primary||""} {destination?}`,tokens:a},extraction:c}}function Nu(i,e,t,r,n){let a=[],o=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};a.push(o);let s=i.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(...De(i,e.roleMarkers.source)),r.position==="before"){let c=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};a.push(c);}if(a.push({type:"role",role:"event",optional:false}),s){let c=i.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:i.action},event:{fromRole:"event"},[s?"destination":"patient"]:{fromRole:s?"destination":"patient"},...s?{}:xe(i),...Se(i)};return Yt(a,l,i,e.code),{id:`${i.action}-event-${e.code}-vso-verb-first`,language:e.code,command:"on",priority:(n.basePriority??100)+45,template:{format:`${t.primary} {patient} ${u?.primary||""} {destination?} ${r.primary} {event}`,tokens:a},extraction:l}}function Lu(i,e,t,r,n){let a=[],o=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};a.push(o);let u=[...i.roles.filter(p=>p.required)].sort((p,d)=>{let m=p.svoPosition??999,f=d.svoPosition??999;return m-f});for(let p of u){let d,m;if(p.markerOverride&&p.markerOverride[e.code]!==void 0)d=p.markerOverride[e.code],m=d?he(p,e.code,d):void 0;else {let f=e.roleMarkers[p.role];f&&(d=f.primary,m=Di(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(r.position==="before"){let p=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};a.push(p);}a.push({type:"role",role:"event",optional:false});let l=u.map(p=>`{${p.role}}`).join(" "),c={action:{value:i.action},event:{fromRole:"event"},...Object.fromEntries(u.map(p=>[p.role,{fromRole:p.role}]))};return it(a,c,i),{id:`${i.action}-event-${e.code}-vso-verb-first-2role`,language:e.code,command:"on",priority:(n.basePriority??100)+48,template:{format:`${t.primary} ${l} ${r.primary} {event}`,tokens:a},extraction:c}}function $r(i,e,t,r,n){let a=[];if(r.position==="before"){let p=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.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=[...i.roles.filter(p=>p.required)].sort((p,d)=>{let m=p.svoPosition??999,f=d.svoPosition??999;return m-f});for(let p of u){let d,m;if(p.markerOverride&&p.markerOverride[e.code]!==void 0)d=p.markerOverride[e.code],m=d?he(p,e.code,d):void 0;else {let f=e.roleMarkers[p.role];f&&(d=f.primary,m=Di(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=u.map(p=>`{${p.role}}`).join(" "),c={action:{value:i.action},event:{fromRole:"event"},...Object.fromEntries(u.map(p=>[p.role,{fromRole:p.role}]))};return it(a,c,i),{id:`${i.action}-event-${e.code}-vso-2role`,language:e.code,command:"on",priority:(n.basePriority??100)+55,template:{format:`${r.primary} {event} ${t.primary} ${l}`,tokens:a},extraction:c}}function Iu(i,e,t,r,n){let a=[],o=e.eventHandler?.negationMarker;if(r.position==="before"){let l=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.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(...De(i,e.roleMarkers.source)),{id:`${i.action}-event-${e.code}-vso-negated`,language:e.code,command:"on",priority:(n.basePriority??100)+48,template:{format:`${r.primary} ${o?.primary||""} {event} ${t.primary} {patient} ${u?.primary||""} {destination?}`,tokens:a},extraction:{action:{value:i.action},event:{fromRole:"event"},patient:{fromRole:"patient"},...xe(i),...Se(i)}}}function Mu(i,e,t,r){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(...De(i,e.roleMarkers.source)),{id:`${i.action}-event-${e.code}-vso-proclitic`,language:e.code,command:"on",priority:(r.basePriority??100)+45,template:{format:`[proclitic?] {event} ${t.primary} {patient} ${o?.primary||""} {destination?}`,tokens:n},extraction:{action:{value:i.action},event:{fromRole:"event"},patient:{fromRole:"patient"},...xe(i),...Se(i)}}}var We={basePriority:100,generateSimpleVariants:true,generateAlternatives:true};function tt(i,e,t=We){let r=`${i.action}-${e.code}-generated`,n=t.basePriority??100,a=e.keywords[i.action];if(!a)throw new Error(`No keyword translation for '${i.action}' in ${e.code}`);let o=Vu(i,e,a),s=Zt(i,e),u=Uu(i,e,a);return {id:r,language:e.code,command:i.action,priority:n,template:{format:u,tokens:o},extraction:s}}function $u(i,e,t=We){if(i.roles.filter(s=>!s.required).length===0)return null;let n=i.roles.filter(s=>s.required),a={...i,roles:n};return {...tt(a,e,t),id:`${i.action}-${e.code}-generated-simple`,priority:(t.basePriority??100)-5,extraction:Zt(i,e)}}function jr(i,e,t=We){if(e.wordOrder!=="SOV")return null;let r=i.roles.filter(s=>s.required);if(r.length!==1)return null;let n=e.keywords[i.action];if(!n)return null;let a=n.alternatives?{type:"literal",value:n.primary,alternatives:n.alternatives}:{type:"literal",value:n.primary},o=r.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:`${i.action}-${e.code}-generated-verb-first`,language:e.code,command:i.action,priority:(t.basePriority??100)-20,template:{format:`${n.primary} <${r[0].role}>`,tokens:[a,...o]},extraction:Zt(i,e)}}function ju(i,e,t=We){let r=[];if(r.push(tt(i,e,t)),t.generateSimpleVariants){let n=$u(i,e,t);n&&r.push(n);}for(let n of i.omitRoleVariants??[]){let a={...i,roles:i.roles.filter(s=>s.role!==n)},o=tt(a,e,t);r.push({...o,id:`${i.action}-${e.code}-generated-no-${n}`,priority:(t.basePriority??100)-8});}for(let n of i.widenTypeVariants??[]){if(n.excludeLanguages?.includes(e.code))continue;let a={...i,roles:i.roles.map(s=>s.role===n.role?{...s,expectedTypes:[...n.types]}:s)},o=tt(a,e,t);r.push({...o,id:`${i.action}-${e.code}-generated-${n.idSuffix}`,priority:(t.basePriority??100)-(n.priorityDelta??15)});}if(t.generateVerbFirstVariants!==false){let n=jr(i,e,t);n&&r.push(n);}for(let n of i.rolePrefixLiteralVariants??[]){let a=n.literal[e.code];if(!a)continue;let{rolePrefixLiteralVariants:o,...s}=i,u={...s,roles:i.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=tt(u,e,t);if(r.push({...p,id:`${i.action}-${e.code}-generated-${n.idSuffix}`,priority:(t.basePriority??100)+l,extraction:{...p.extraction,...c}}),t.generateVerbFirstVariants!==false){let d=jr(u,e,t);d&&r.push({...d,id:`${i.action}-${e.code}-generated-verb-first-${n.idSuffix}`,priority:(t.basePriority??100)-20+l,extraction:{...d.extraction,...c}});}}return r}function Ti(i,e=We){let t=[],r=ho();for(let n of r){if(!i.keywords[n.action])continue;let a=ju(n,i,e);if(t.push(...a),i.eventHandler?.eventMarker){let o=qu(n,i,e);t.push(...o);}}return t}function qu(i,e,t=We){if(!e.eventHandler||!e.eventHandler.eventMarker)return [];let r=[],n=e.eventHandler.eventMarker,a=e.keywords[i.action];if(!a)return [];if(i.roles.length===0)return [];if(i.action==="js")return [];let s=i.roles.filter(u=>u.required).length===2;if(e.wordOrder==="SOV")if(s)r.push(Ru(i,e,a,n,t)),r.push(_u(i,e,a,n,t)),r.push(Ou(i,e,a,n,t));else {r.push(xu(i,e,a,n,t)),r.push(Su(i,e,a,n,t));let u=Du(i,e,a,n,t);u&&r.push(u);let l=e.roleMarkers.destination;l&&l.primary!==n.primary&&r.push(Tu(i,e,a,n,t));let c=n.primary.split(/\s+/),p=n.alternatives?.some(m=>!m.includes(" ")&&m.length>1);c.length>1&&p&&r.push(Bu(i,e,a,n,t)),r.push(Pu(i,e,a,n,t));let d=Fu(i,e,a,t);d&&r.push(d);}else e.wordOrder==="VSO"?s?(r.push($r(i,e,a,n,t)),r.push(Lu(i,e,a,n,t))):(r.push(Mr(i,e,a,n,t)),r.push(Nu(i,e,a,n,t)),e.eventHandler?.negationMarker&&r.push(Iu(i,e,a,n,t)),e.tokenization?.prefixes&&r.push(Mu(i,e,a,t))):s?r.push($r(i,e,a,n,t)):r.push(Mr(i,e,a,n,t));return r}function Vu(i,e,t){let r=[],n=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary},a=Hu(i,e);switch(e.wordOrder){case "SVO":r.push(n),r.push(...a);break;case "SOV":r.push(...a),r.push(n);break;case "VSO":r.push(n),r.push(...a);break;default:r.push(n),r.push(...a);}return Wu(r)}function Wu(i){let e=[];for(let t of i){let r=e[e.length-1];if(r&&r.type==="literal"&&t.type==="literal"&&r.value===t.value){let n=[...r.alternatives??[],...t.alternatives??[]];n.length&&(e[e.length-1]={...r,alternatives:[...new Set(n)]});continue}e.push(t);}return e}function Hu(i,e){let t=[],r=wi(i.roles,e.wordOrder);for(let n of r){let a=Bi(n,e);n.required?t.push(...a):t.push({type:"group",optional:true,tokens:a});}return t}function Bi(i,e){let t=[],r=i.markerOverride?.[e.code],n=e.roleMarkers[i.role],a=i.renderOverride?.[e.code]==="",o={type:"role",role:i.role,optional:!i.required,expectedTypes:i.expectedTypes,...i.valueShape!==void 0?{valueShape:i.valueShape}:{}},s=i.valuePrefixLiteral?.[e.code],u=()=>{s&&t.push({type:"literal",value:s}),t.push(o);};if(r!==void 0){let l=r?r.split(/\s+/).filter(Boolean):[],c=r!==void 0&&r===i.markerOverride?.en,p=n?.position??(e.wordOrder==="SOV"&&!c?"after":"before"),d=i.markerOptional?.[e.code]===true,m=f=>{let h=l.length===1?he(i,e.code,f)??[]:[],E={type:"literal",value:f,...h.length?{alternatives:h}:{},...a?{renderSuppress:true}:{}};t.push(d?{type:"group",optional:true,tokens:[E]}:E);};if(p==="before"){for(let f of l)m(f);u();}else {u();for(let f of l)m(f);}}else if(n){let l=()=>{let p=[...new Set([...n.alternatives??[],...he(i,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&&!i.markerOptional?.[e.code]){t.push(p);return}t.push({type:"group",optional:true,...e.markersOptional&&!i.markerOptional?.[e.code]?{renderRequired:true}:{},tokens:[p]});};n.position==="before"?(n.primary&&c(l()),u()):(u(),c(l()));}else u();return t}function Ku(i,e){let t={};for(let r of i.roles){let n=r.markerOverride?.[e.code],a=e.roleMarkers[r.role];if(r.valuePrefixLiteral?.[e.code])t[r.role]={marker:r.valuePrefixLiteral[e.code]};else if(n!==void 0)if(!n)t[r.role]={};else {let s=!/\s/.test(n.trim())?he(r,e.code,n)??[]:[];t[r.role]=s.length?{marker:n,markerAlternatives:s}:{marker:n};}else if(a&&a.primary){let o=[...new Set([...a.alternatives??[],...he(r,e.code,a.primary)??[]])].filter(s=>s!==a.primary);t[r.role]=o.length?{marker:a.primary,markerAlternatives:o}:{marker:a.primary};}else t[r.role]={};}return t}function Zt(i,e){let t=Ku(i,e),r={};for(let n of i.roles){let a=t[n.role]||{};!n.required&&n.default?r[n.role]={...a,default:n.default}:r[n.role]=a;}return r}function Uu(i,e,t){let r=[],a=wi(i.roles,e.wordOrder).map(o=>{let s=Qo(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":r.push(t.primary,...a);break;case "SOV":r.push(...a,t.primary);break;default:r.push(t.primary,...a);}return r.join(" ")}var Gu=class{constructor(i={}){this.cache=new Map,this.config={maxSize:i.maxSize??1e3,ttlMs:i.ttlMs??0,enabled:i.enabled??true},this.stats={hits:0,misses:0,evictions:0,expirations:0};}makeKey(i,e){return `${e}:${i}`}isExpired(i){return this.config.ttlMs===0?false:Date.now()-i.createdAt>this.config.ttlMs}evictLRU(){let i=this.cache.keys().next().value;i!==void 0&&(this.cache.delete(i),this.stats.evictions++);}get(i,e){if(!this.config.enabled){this.stats.misses++;return}let t=this.makeKey(i,e),r=this.cache.get(t);if(!r){this.stats.misses++;return}if(this.isExpired(r)){this.cache.delete(t),this.stats.expirations++,this.stats.misses++;return}return this.cache.delete(t),r.lastAccessed=Date.now(),this.cache.set(t,r),this.stats.hits++,r.result}set(i,e,t){if(!this.config.enabled||t!==null&&typeof t=="object"&&"confidence"in t&&t.confidence===0)return;let r=this.makeKey(i,e),n=Date.now();for(;this.cache.size>=this.config.maxSize;)this.evictLRU();this.cache.set(r,{result:t,createdAt:n,lastAccessed:n});}has(i,e){if(!this.config.enabled)return false;let t=this.makeKey(i,e),r=this.cache.get(t);return r?this.isExpired(r)?(this.cache.delete(t),this.stats.expirations++,false):true:false}delete(i,e){let t=this.makeKey(i,e);return this.cache.delete(t)}clear(){this.cache.clear();}resetStats(){this.stats={hits:0,misses:0,evictions:0,expirations:0};}getStats(){let i=this.stats.hits+this.stats.misses;return {hits:this.stats.hits,misses:this.stats.misses,size:this.cache.size,maxSize:this.config.maxSize,hitRate:i>0?this.stats.hits/i:0,evictions:this.stats.evictions,expirations:this.stats.expirations,enabled:this.config.enabled}}configure(i){if(i.maxSize!==void 0)for(this.config.maxSize=i.maxSize;this.cache.size>this.config.maxSize;)this.evictLRU();i.ttlMs!==void 0&&(this.config.ttlMs=i.ttlMs),i.enabled!==void 0&&(this.config.enabled=i.enabled);}enable(){this.config.enabled=true;}disable(){this.config.enabled=false;}getConfig(){return {...this.config}}};new Gu;var Yu=Object.defineProperty,Zu=Object.getOwnPropertyNames,Li=(i,e)=>function(){return i&&(e=(0, i[Zu(i)[0]])(i=0)),e},Xu=(i,e)=>{for(var t in e)Yu(i,t,{get:e[t],enumerable:true});};function Pi(i,e){return i.replace(/\{(\w+)\}/g,(t,r)=>String(e[r]??`{${r}}`))}function oe(i,e,t={},r){let n=Ii[i],a=Pi(n,t),o=Mi[i],s=o?Pi(o,t):void 0;return {code:i,message:a,severity:e,...r&&{role:r},...s&&{suggestion:s}}}var F,Ii,Mi,Qu=Li({"src/generators/schema-error-codes.ts"(){F={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"},Ii={[F.AMBIGUOUS_TYPE_LITERAL_SELECTOR]:"Role '{role}' accepts both 'literal' and 'selector'. This may cause ambiguous type inference for values starting with special characters (* . # etc.).",[F.TOO_MANY_EXPECTED_TYPES]:"Role '{role}' accepts {count} different types. This may make type inference unreliable.",[F.MULTI_TYPE_PATIENT_EXPECTED]:"Role '{role}' accepts multiple types (expected for {command} command).",[F.NO_REQUIRED_ROLES]:"Command has no required roles. Is this intentional?",[F.NO_REQUIRED_ROLES_EXPECTED]:"Command has no required roles (expected for {command}).",[F.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.",[F.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.",[F.EVENT_HANDLER_MISSING_EVENT]:"Event handler command should have an 'event' role to specify which event to listen for.",[F.EVENT_HANDLER_EVENT_NOT_REQUIRED]:"Event role should be required - every event handler needs an event to listen for.",[F.CONDITIONAL_MISSING_CONDITION]:"Conditional command should have a 'condition' role for the boolean expression.",[F.CONDITIONAL_CONDITION_NOT_REQUIRED]:"Condition role should be required - conditionals need a condition to evaluate.",[F.FOR_LOOP_MISSING_SOURCE]:"For-loop should have a 'source' role for the collection to iterate over.",[F.WHILE_LOOP_MISSING_CONDITION]:"While-loop should have a 'condition' role for the loop condition.",[F.VALUE_TYPE_MISMATCH]:"Role '{role}' of command '{command}' expects type [{expectedTypes}], got '{actualType}'.",[F.SELECTOR_KIND_MISMATCH]:"Role '{role}' of command '{command}' expects selector kind [{selectorKinds}], got '{actualKind}'.",[F.SELECTOR_KINDS_WITHOUT_SELECTOR_TYPE]:"Role '{role}' has selectorKinds but expectedTypes does not include 'selector'.",[F.KEYWORD_COLLISION]:"Keyword '{keyword}' is used by multiple commands: {commands}. Only the first-registered command will be reachable."},Mi={[F.AMBIGUOUS_TYPE_LITERAL_SELECTOR]:"Consider being more specific about which type is expected, or use explicit type markers.",[F.TOO_MANY_EXPECTED_TYPES]:"Consider narrowing the accepted types to improve type inference reliability.",[F.TRANSITION_PATIENT_ACCEPTS_SELECTOR]:"Remove 'selector' from expectedTypes and only accept 'literal'.",[F.TRANSITION_MISSING_GOAL]:"Add a 'goal' role with expectedTypes ['literal', 'variable'].",[F.EVENT_HANDLER_MISSING_EVENT]:"Add an 'event' role with expectedTypes ['literal'].",[F.EVENT_HANDLER_EVENT_NOT_REQUIRED]:"Set required: true on the 'event' role.",[F.CONDITIONAL_MISSING_CONDITION]:"Add a 'condition' role with expectedTypes ['expression'].",[F.CONDITIONAL_CONDITION_NOT_REQUIRED]:"Set required: true on the 'condition' role.",[F.FOR_LOOP_MISSING_SOURCE]:"Add a 'source' role for the collection to iterate over.",[F.WHILE_LOOP_MISSING_CONDITION]:"Add a 'condition' role for the loop continuation condition.",[F.VALUE_TYPE_MISMATCH]:"Ensure the value matches one of the expected types: [{expectedTypes}].",[F.SELECTOR_KIND_MISMATCH]:"Use a selector of the correct kind: [{selectorKinds}].",[F.SELECTOR_KINDS_WITHOUT_SELECTOR_TYPE]:"Either add 'selector' to expectedTypes or remove selectorKinds.",[F.KEYWORD_COLLISION]:"Give each command a unique keyword. Move the shared keyword to alternatives on one command, or use a more specific translation."};}}),$i={};Xu($i,{SchemaErrorCodes:()=>F,formatValidationResults:()=>nl,getValidationStats:()=>ol,validateAllKeywordCollisions:()=>ll,validateAllSchemas:()=>al,validateCommandSchema:()=>ji,validateKeywordCollisions:()=>qi,validateRoleValues:()=>sl});function Ju(i,e){return {action:i,items:e}}function ji(i){let e=[];for(let r of i.roles)r.expectedTypes.includes("literal")&&r.expectedTypes.includes("selector")&&(r.role==="patient"&&Jt.has(i.action)?e.push(oe(F.MULTI_TYPE_PATIENT_EXPECTED,"note",{role:r.role,command:i.action},r.role)):e.push(oe(F.AMBIGUOUS_TYPE_LITERAL_SELECTOR,"warning",{role:r.role},r.role))),r.expectedTypes.length>3&&!Jt.has(i.action)&&e.push(oe(F.TOO_MANY_EXPECTED_TYPES,"warning",{role:r.role,count:r.expectedTypes.length},r.role));for(let r of i.roles)r.selectorKinds&&r.selectorKinds.length>0&&(r.expectedTypes.includes("selector")||e.push(oe(F.SELECTOR_KINDS_WITHOUT_SELECTOR_TYPE,"warning",{role:r.role},r.role)));switch(i.action){case "transition":el(i,e);break;case "on":tl(i,e);break;case "if":case "unless":rl(i,e);break;case "repeat":case "for":case "while":il(i,e);break}return i.roles.filter(r=>r.required).length===0&&(Vi.has(i.action)?e.push(oe(F.NO_REQUIRED_ROLES_EXPECTED,"note",{command:i.action})):e.push(oe(F.NO_REQUIRED_ROLES,"warning",{}))),Ju(i.action,e)}function el(i,e){let t=i.roles.find(n=>n.role==="patient"),r=i.roles.find(n=>n.role==="goal");t&&!r&&e.push(oe(F.TRANSITION_MISSING_GOAL,"error",{}));}function tl(i,e){let t=i.roles.find(r=>r.role==="event");t||e.push(oe(F.EVENT_HANDLER_MISSING_EVENT,"warning",{})),t&&!t.required&&e.push(oe(F.EVENT_HANDLER_EVENT_NOT_REQUIRED,"warning",{}));}function rl(i,e){let t=i.roles.find(r=>r.role==="condition");t||e.push(oe(F.CONDITIONAL_MISSING_CONDITION,"warning",{})),t&&!t.required&&e.push(oe(F.CONDITIONAL_CONDITION_NOT_REQUIRED,"warning",{}));}function il(i,e){i.action==="for"?i.roles.find(r=>r.role==="source")||e.push(oe(F.FOR_LOOP_MISSING_SOURCE,"warning",{})):i.action==="while"&&(i.roles.find(r=>r.role==="condition")||e.push(oe(F.WHILE_LOOP_MISSING_CONDITION,"warning",{})));}function al(i,e={}){let t=new Map,{includeNotes:r=false}=e;for(let[n,a]of Object.entries(i)){let o=ji(a),s=o.items.some(l=>l.severity==="warning"||l.severity==="error"),u=r&&o.items.some(l=>l.severity==="note");(s||u)&&t.set(n,o);}return t}function nl(i,e={}){let t=[],{showNotes:r=false,showCodes:n=true}=e;for(let[a,o]of i){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 p=n?` [${c.code}]`:"";t.push(` ERROR${p}: ${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 p=n?` [${c.code}]`:"";t.push(` ${p?`${c.code}: `:""}${c.message}`),c.suggestion&&t.push(` \u{1F4A1} ${c.suggestion}`);}}if(r&&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(`
5
+ `)}function ol(i){let e=0,t=0,r=0,n={};for(let a of i.values())for(let o of a.items)o.severity==="error"?e++:o.severity==="warning"?t++:o.severity==="note"&&r++,n[o.code]=(n[o.code]||0)+1;return {totalCommands:i.size,errors:e,warnings:t,notes:r,byCode:n}}function sl(i,e){let t=[];for(let r of e){let n=i.roles.find(a=>a.role===r.role);n&&(n.expectedTypes.length>0&&!n.expectedTypes.includes(r.type)&&(n.expectedTypes.includes("expression")||t.push({level:"error",role:r.role,message:`${i.action}.${r.role} expects type [${n.expectedTypes.join(", ")}], got '${r.type}'`,code:F.VALUE_TYPE_MISMATCH})),r.type==="selector"&&r.selectorKind&&n.selectorKinds&&n.selectorKinds.length>0&&(n.selectorKinds.includes(r.selectorKind)||t.push({level:"error",role:r.role,message:`${i.action}.${r.role} expects selector kind [${n.selectorKinds.join(", ")}], got '${r.selectorKind}'`,code:F.SELECTOR_KIND_MISMATCH})));}return t}function ul(i){if(i.length!==2)return false;let[e,t]=[...i].sort();return Wi.some(([r,n])=>r===e&&n===t)}function qi(i){let e=[];if(!i.keywords)return {language:i.code,collisions:e};let t=new Map;for(let[n,a]of Object.entries(i.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 s of a.alternatives){let u=t.get(s)||[];u.push({command:n,isPrimary:false}),t.set(s,u);}}for(let[n,a]of t){let o=[...new Set(a.map(l=>l.command))];if(o.length<=1||ul(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:n,commands:o.sort(),type:u});}let r={"primary-primary":0,"primary-alternative":1,"alternative-alternative":2};return e.sort((n,a)=>r[n.type]-r[a.type]),{language:i.code,collisions:e}}function ll(i){let e=[];for(let[,t]of Object.entries(i)){let r=qi(t);r.collisions.length>0&&e.push(r);}return e.sort((t,r)=>t.language.localeCompare(r.language))}var Jt,Vi,Wi,cl=Li({"src/generators/schema-validator.ts"(){Qu(),Jt=new Set(["put","append","prepend","log","throw","make","measure","return","swap","morph","beep","copy"]),Vi=new Set(["compound","else","halt","continue","async","init","settle","focus","blur","return","js","measure","break","exit","beep","empty","open","close","select","clear","reset","breakpoint","live","eventsource","socket","worker","intercept"]),Wi=[["change","changes"]];}}),tr={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"}}},pl=["===","!==","->","==","!=","<=",">=","&&","||","**","+=","-=","*=","/=","+","-","*","/","=",">","<","!","&","|","%","^","~"],dl=class{constructor(i=pl){this.name="operator",this.operators=[...i].sort((e,t)=>t.length-e.length);}canExtract(i,e){return this.operators.some(t=>i.startsWith(t,e))}extract(i,e){for(let t of this.operators)if(i.startsWith(t,e))return {value:t,length:t.length};return null}},ml="()[]{},:;",fl=class{constructor(i=ml){this.punctuation=i,this.name="punctuation";}canExtract(i,e){return this.punctuation.includes(i[e])}extract(i,e){let t=i[e];return this.punctuation.includes(t)?{value:t,length:1}:null}};function Xt(i,e){let t=e;for(;t<i.length&&i[t]===":";){let r=i.slice(t).match(/^::?[a-zA-Z][a-zA-Z0-9-]*/);if(!r)break;let n=t+r[0].length;if(i[n]==="("){let a=0,o=n;for(;o<i.length;){if(i[o]==="(")a++;else if(i[o]===")"&&(a--,a===0)){o++;break}o++;}if(a!==0)break;n=o;}t=n;}return t}function Fi(i,e){let t=i[e];if(t==="#"){let r=i.slice(e).match(/^#[a-zA-Z_][\w-]*/);if(!r)return null;let n=Xt(i,e+r[0].length);return i.slice(e,n)}if(t==="."){let r=i.slice(e).match(/^\.\{[a-zA-Z_$][\w$]*\}/);if(r)return r[0];let n=i.slice(e).match(/^\.[a-zA-Z_][\w-]*/);if(!n)return null;let a=Xt(i,e+n[0].length);return i.slice(e,a)}if(t==="@"){let r=i.slice(e).match(/^@[a-zA-Z_][\w-]*/);return r?r[0]:null}if(t==="*"){let r=i.slice(e).match(/^\*(?:--)?[a-zA-Z_][\w-]*/);return r?r[0]:null}if(t==="["){let r=0,n=e;for(;n<i.length;){if(i[n]==="["&&r++,i[n]==="]"&&(r--,r===0)){let a=Xt(i,n+1);return i.slice(e,a)}n++;}return null}if(t==="<"){let r=i.slice(e).match(/^<(?=[\w.#[])[\w-]*(?:[#.][\w-]+|\[[^\]]+\]|::?[a-zA-Z][a-zA-Z0-9-]*(?:\([^)]*\))?)*\s*\/>/);return r?r[0]:null}return null}var yl=class{constructor(){this.name="css-selector";}canExtract(i,e){let t=i[e];return t==="#"||t==="."||t==="["||t==="<"?true:t==="@"||t==="*"?Fi(i,e)!==null:false}extract(i,e){let t=Fi(i,e);return t?{value:t,length:t.length,metadata:{type:"css-selector"}}:null}},vl=class{constructor(){this.name="event-modifier";}canExtract(i,e){if(i[e]!==".")return false;let t=i.slice(e);return /^\.(once|prevent|stop|debounce|throttle|queue)/.test(t)}extract(i,e){let t=i.slice(e).match(/^\.(?:once|prevent|stop|debounce|throttle|queue)(?:\(([^)]+)\))?/);if(!t)return null;let r=t[0],n=r.slice(1).split("(")[0],a=t[1];return {value:r,length:r.length,metadata:{modifierName:n,value:a?n==="queue"?a:parseInt(a,10):void 0}}}},hl=["http://","https://","//","./","../","/"];function El(i,e){let t=1;for(let r=e;r<i.length;r++){let n=i[r];if(n==="{")t++;else if(n==="}"&&--t===0)return r+1}return -1}function gl(i,e){let t=i.slice(e),r=hl.find(a=>t.startsWith(a));if(!r)return null;let n=r.length;for(;n<t.length;){let a=t[n];if(a==="$"&&t[n+1]==="{"){let o=El(t,n+2);if(o!==-1){n=o;continue}}if(/\s/.test(a))break;n++;}return t.slice(0,n)}var kl=class{constructor(){this.name="url";}canExtract(i,e){let t=i.slice(e);return t.startsWith("http://")||t.startsWith("https://")||t.startsWith("//")||t.startsWith("./")||t.startsWith("../")||t.startsWith("/")}extract(i,e){let t=gl(i,e);return t?{value:t,length:t.length,metadata:{type:"url"}}:null}},bl=class{constructor(){this.name="variable-ref";}canExtract(i,e){let t=i[e];return (t===":"||t==="$"||t==="^")&&e+1<i.length&&/[a-zA-Z_]/.test(i[e+1])}extract(i,e){if(!this.canExtract(i,e))return null;let t=1;for(;e+t<i.length&&/[a-zA-Z0-9_]/.test(i[e+t]);)t++;return {value:i.substring(e,e+t),length:t,metadata:{type:"variable-reference"}}}};function wl(){return [new kl,new vl,new bl,new yl]}function Qt(i){return /[a-zA-Z0-9_]/.test(i)}var zl=class{constructor(){this.name="english-keyword";}setContext(i){this.context=i;}canExtract(i,e){return /[a-zA-Z_]/.test(i[e])}extract(i,e){if(!this.context)throw new Error("EnglishKeywordExtractor: context not set");let t=e,r="";for(;t<i.length&&Qt(i[t]);)r+=i[t++];if(!r)return null;if(t<i.length&&i[t]===":"){let s=t;t++;let u="";for(;t<i.length&&Qt(i[t]);)u+=i[t++];u?r=r+":"+u:t=s;}let n=this.context.lookupKeyword(r),a=n&&n.normalized!==n.native?n.normalized:void 0,o=null;return this.context.isKeyword(r)||(o=this.tryClassSyntaxConversion(i,t,r)),{value:o||r,length:t-e,metadata:{normalized:a,classConversion:o?true:void 0}}}tryClassSyntaxConversion(i,e,t){let r=e;for(;r<i.length&&/\s/.test(i[r]);)r++;if(i.slice(r,r+5).toLowerCase()==="class"){let n=r+5;if(n>=i.length||!Qt(i[n]))return "."+t}return null}};function Cl(){return [new zl]}var Al=[{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"}],xl=class extends br{constructor(){super(),this.language="en",this.direction="ltr",this.initializeKeywordsFromProfile(tr,Al),this.registerExtractors(wl()),this.registerExtractor(new gr),this.registerExtractor(new kr),this.registerExtractors(Cl()),this.registerExtractor(new dl),this.registerExtractor(new fl);}classifyToken(i){return this.isKeyword(i)?"keyword":i.startsWith("/")||i.startsWith("./")||i.startsWith("../")||i.startsWith("http")?"url":/^\.(once|prevent|stop|debounce|throttle|queue)(\(.*\))?$/.test(i)?"event-modifier":i.startsWith("#")||i.startsWith(".")||i.startsWith("[")||i.startsWith("*")||i.startsWith("<")?"selector":i.startsWith('"')||i.startsWith("'")||/^\d/.test(i)?"literal":["==","!=","<=",">=","<",">","&&","||","!"].includes(i)?"operator":"identifier"}},Sl=new xl;function Te(i){let e=i.roles.find(t=>t.role==="destination");return e?{destination:e.default?{fromRole:"destination",default:e.default}:{fromRole:"destination"}}:{}}function Be(i){let e=i.roles.find(t=>t.role==="source");return e?{source:e.default?{fromRole:"source",default:e.default}:{fromRole:"source"}}:{}}function Pe(i,e){return ir(i,e,"source")}function rr(i,e){return ir(i,e,"destination")}function Dl(i,e){return ir(i,e,"patient")}function ir(i,e,t){if(!e||!i.roles.some(a=>a.role===t))return [];let r=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,r]:[r,n]}]}var Tl={action:"toggle",description:"Toggle a class or attribute on/off",category:"dom-class",primaryRole:"patient",ast:{args:["patient"],modifiers:{on:"destination",for:"duration"}},argSkipTokens:["on"],roles:[{role:"patient",description:"The class or attribute to toggle",required:true,expectedTypes:["selector"],selectorKinds:["class","attribute"],svoPosition:1,sovPosition:2,markerOptional:{zh:true}},{role:"destination",description:"The target element (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:2,sovPosition:1,markerVariants:{ko:["\uC5D0\uC11C"]}},{role:"duration",description:"How long the class stays on before reverting (`toggle .a for 2s`)",required:false,expectedTypes:["literal"],svoPosition:3,sovPosition:3,valueShape:"time",markerOverride:{en:"for",ja:"\u9593",ko:"\uB3D9\uC548"}}],errorCodes:["MISSING_ARGUMENT","NO_VALID_CLASS_NAMES","INVALID_CSS_PROPERTY"],preconditions:[{condition:"Command has at least one argument",errorCode:"MISSING_ARGUMENT",message:"toggle command requires an argument"},{condition:"Class names are valid CSS identifiers",errorCode:"NO_VALID_CLASS_NAMES",message:"toggle command: no valid class names found"}],recoveryHints:{MISSING_ARGUMENT:"Add a class selector (.classname) or attribute to toggle",NO_VALID_CLASS_NAMES:"Ensure class names start with a dot (.) and are valid CSS identifiers",INVALID_CSS_PROPERTY:"Check CSS property name syntax (use kebab-case)"}},Bl={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:["selector","reference"],svoPosition:1,sovPosition:2},{role:"source",description:"The element to remove from (defaults to me)",required:false,expectedTypes:["selector","reference","expression"],default:{type:"reference",value:"me"},svoPosition:2,sovPosition:1}],errorCodes:["MISSING_ARGUMENT","NO_VALID_CLASS_NAMES"],preconditions:[{condition:"Command has at least one argument",errorCode:"MISSING_ARGUMENT",message:"remove command requires an argument"}],recoveryHints:{MISSING_ARGUMENT:"Add a class selector (.classname) or attribute to remove",NO_VALID_CLASS_NAMES:"Ensure class names start with a dot (.) and are valid CSS identifiers"}},Fl={action:"put",description:"Put content into a target element or variable",category:"dom-content",primaryRole:"patient",roles:[{role:"patient",description:"The content to put",required:true,expectedTypes:["literal","selector","reference","expression"],svoPosition:1,sovPosition:1},{role:"destination",description:"Where to put the content",required:true,expectedTypes:["selector","reference"],svoPosition:2,sovPosition:2,markerOverride:{en:"into",ar:"\u0641\u064A",zh:"\u5230",fr:"dans",de:"in",he:"\u05D1",id:"ke",sw:"kwa"},markerVariants:{en:["before","after"]},markerLegacy:{ar:["\u0639\u0644\u0649","\u0625\u0644\u0649","\u0628"],zh:["\u5728","\u4E8E"],fr:["sur","\xE0"],de:["auf","zu"],he:["\u05E2\u05DC","\u05D0\u05DC","\u05DC"],id:["pada","di"],sw:["kwenye"]},methodCarrier:"method"}],errorCodes:["MISSING_ARGUMENTS","MISSING_CONTENT","MISSING_POSITION","INVALID_POSITION","NO_TARGET","NO_ELEMENTS"],preconditions:[{condition:"Command has content and position arguments",errorCode:"MISSING_ARGUMENTS",message:"put requires arguments"},{condition:"Content to put is specified",errorCode:"MISSING_CONTENT",message:"put requires content"},{condition:"Position keyword is specified (into, before, after, etc.)",errorCode:"MISSING_POSITION",message:"put requires position keyword"}],recoveryHints:{MISSING_ARGUMENTS:"Use syntax: put <content> into/before/after <target>",MISSING_CONTENT:"Add content to put (string, element, or expression)",MISSING_POSITION:"Add position keyword: into, before, after, at start of, at end of",INVALID_POSITION:"Valid positions: into, before, after, at start of, at end of",NO_TARGET:'Ensure target element exists or use "me" reference',NO_ELEMENTS:"Check that the selector matches existing elements"}},Rl={action:"set",description:"Set a property or variable to a value",category:"variable",primaryRole:"destination",ast:{args:["destination"],modifiers:{to:"patient",on:"scope"}},argSkipTokens:["to"],roles:[{role:"destination",description:"The property or variable to set",required:true,expectedTypes:["selector","reference","expression","property-path"],svoPosition:1,sovPosition:1,markerOverride:{en:"",es:"",ja:"\u3092",ko:"\uB97C",tr:"i",ar:"",sw:"",tl:"",th:"",bn:"\u0995\u09C7",qu:"ta",hi:"\u0915\u094B",zh:"\u628A"},markerOptional:{zh:true}},{role:"patient",description:"The value to set",required:true,expectedTypes:["literal","expression","reference"],svoPosition:2,sovPosition:2,markerOverride:{en:"to",es:"a",pt:"para",fr:"\xE0",de:"auf",id:"ke",ja:"\u306B",ko:"\uC5D0",tr:"e",ar:"\u0625\u0644\u0649",sw:"kwenye",tl:"sa",th:"\u0E43\u0E19",bn:"\u09A4\u09C7",qu:"man",hi:"\u092E\u0947\u0902",zh:"\u5230"},markerVariants:{tr:["e","a","ye","ya"],zh:["\u4E3A","\u70BA","\u6210"]}},{role:"scope",description:"The element(s) the attribute/property is set on (defaults to me)",required:false,expectedTypes:["selector","reference"],svoPosition:3,sovPosition:3,markerOverride:{en:"on",es:"on",pt:"on",fr:"on",de:"on",it:"on",id:"on",ms:"on",sw:"on",tl:"on",zh:"on",vi:"on",ru:"on",uk:"on",pl:"on",th:"on",he:"on",ar:"on",ja:"on",ko:"on",tr:"on",hi:"on",bn:"on",qu:"on"}}],errorCodes:["MISSING_TARGET","INVALID_TARGET","MISSING_VALUE","INVALID_SYNTAX"],preconditions:[{condition:"Command has a target variable or property",errorCode:"MISSING_TARGET",message:"set command requires a target"},{condition:"Target is a valid variable or property reference",errorCode:"INVALID_TARGET",message:"set command target must be a string or object literal"},{condition:'Value is specified with "to" keyword',errorCode:"MISSING_VALUE",message:'set command requires a value (use "to" keyword)'}],recoveryHints:{MISSING_TARGET:"Add a target: set :variable to value OR set element.property to value",INVALID_TARGET:'Use local variable (:name), element property (el.prop), or "the X of Y" syntax',MISSING_VALUE:'Add "to <value>" to specify what to set',INVALID_SYNTAX:"Use syntax: set <target> to <value>"}},Ol={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>"}},_l={action:"live",description:"Reactive block: re-run the body when its dependencies change",category:"control-flow",primaryRole:"patient",hasBody:true,bareKeyword:true,roles:[]},Nl={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}]},Ll={action:"eventsource",description:"Open a Server-Sent Events stream and handle its events",category:"async",primaryRole:"patient",hasBody:true,bareKeyword:true,roles:[]},Il={action:"socket",description:"Open a WebSocket and handle its messages",category:"async",primaryRole:"patient",hasBody:true,bareKeyword:true,roles:[]},Ml={action:"worker",description:"Define a Web Worker with inline methods",category:"async",primaryRole:"patient",hasBody:true,bareKeyword:true,roles:[]},$l={action:"intercept",description:"Service-worker fetch interception / caching strategies",category:"async",primaryRole:"patient",hasBody:true,bareKeyword:true,roles:[]},jl={action:"show",description:"Make an element visible",category:"dom-visibility",primaryRole:"patient",ast:{args:[["destination","patient"]],modifiers:{with:"duration"}},roles:[{role:"patient",description:"The element to show",required:true,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:1,sovPosition:1},{role:"style",description:"Animation style (fade, slide, etc.)",required:false,expectedTypes:["literal"],svoPosition:2,sovPosition:2}]},ql={action:"hide",description:"Make an element invisible",category:"dom-visibility",primaryRole:"patient",ast:{args:[["destination","patient"]],modifiers:{with:"duration"}},roles:[{role:"patient",description:"The element to hide",required:true,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:1,sovPosition:1},{role:"style",description:"Animation style (fade, slide, etc.)",required:false,expectedTypes:["literal"],svoPosition:2,sovPosition:2}]},Vl={action:"on",description:"Handle an event",category:"event",primaryRole:"event",ast:{args:["event"],modifiers:{from:"source"}},hasBody:true,roles:[{role:"event",description:"The event to handle",required:true,expectedTypes:["literal"],svoPosition:1,sovPosition:2},{role:"source",description:"The element to listen on (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:2,sovPosition:1}],widenTypeVariants:[{role:"event",types:["literal","expression"],idSuffix:"expr-event",excludeLanguages:["ko"]}]},Wl={action:"trigger",description:"Trigger/dispatch an event",category:"event",primaryRole:"event",ast:{args:["event"],modifiers:{on:"destination"}},argSkipTokens:["on"],roles:[{role:"event",description:"The event to trigger (supports namespaced events like draggable:start)",required:true,expectedTypes:["literal","expression"],svoPosition:1,sovPosition:2,markerVariants:{hi:["\u0915\u094B"],qu:["ta"],bn:["\u0995\u09C7"]},markerOverride:{bn:"\u0995\u09C7",hi:"\u0915\u094B"}},{role:"destination",description:"The target element (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:2,sovPosition:1}]},Hl={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}]},Kl={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}]},Ul={action:"increment",description:"Increment a numeric value",category:"variable",primaryRole:"patient",ast:{args:[["destination","patient"]],modifiers:{by:"quantity"}},roles:[{role:"patient",description:"The value to increment",required:true,expectedTypes:["selector","reference","expression"],svoPosition:1,sovPosition:1},{role:"quantity",description:"Amount to increment by (defaults to 1)",required:false,expectedTypes:["literal"],default:{type:"literal",value:1,dataType:"number"},svoPosition:2,sovPosition:2,markerOverride:{en:"by",es:"por",pt:"por",fr:"par",de:"um"}}]},Gl={action:"decrement",description:"Decrement a numeric value",category:"variable",primaryRole:"patient",ast:{args:[["destination","patient"]],modifiers:{by:"quantity"}},roles:[{role:"patient",description:"The value to decrement",required:true,expectedTypes:["selector","reference","expression"],svoPosition:1,sovPosition:1},{role:"quantity",description:"Amount to decrement by (defaults to 1)",required:false,expectedTypes:["literal"],default:{type:"literal",value:1,dataType:"number"},svoPosition:2,sovPosition:2,markerOverride:{en:"by",es:"por",pt:"por",fr:"par",de:"um"}}]},Yl={action:"append",description:"Append content to an element",category:"dom-content",primaryRole:"patient",ast:{args:["patient"],modifiers:{to:"destination"}},omitRoleVariants:["destination"],roles:[{role:"patient",description:"The content to append",required:true,expectedTypes:["literal","selector","reference","expression"],svoPosition:1,sovPosition:2},{role:"destination",description:"The element to append to",required:true,expectedTypes:["selector","reference","expression"],svoPosition:2,sovPosition:1,markerOverride:{en:"to"}}]},Zl={action:"prepend",description:"Prepend content to an element",category:"dom-content",primaryRole:"patient",ast:{args:["patient"],modifiers:{to:"destination"}},omitRoleVariants:["destination"],roles:[{role:"patient",description:"The content to prepend",required:true,expectedTypes:["literal","selector","reference","expression"],svoPosition:1,sovPosition:2},{role:"destination",description:"The element to prepend to",required:true,expectedTypes:["selector","reference","expression"],svoPosition:2,sovPosition:1,markerOverride:{en:"to"}}]},Xl={action:"log",description:"Log a value to the console",category:"variable",primaryRole:"patient",ast:{args:["patient"]},roles:[{role:"patient",description:"The value to log",required:true,expectedTypes:["literal","selector","reference","expression"],svoPosition:1,sovPosition:1}]},Ql={action:"get",description:"Get a value from a source",category:"variable",primaryRole:"source",ast:{args:[["source","patient"]]},roles:[{role:"source",description:"The source to get from",required:true,expectedTypes:["selector","reference","expression"],svoPosition:1,sovPosition:2,markerOverride:{en:"",es:"",pt:"",fr:"",de:"",ja:"\u3092",zh:"",ko:"\uB97C",ar:"\u0639\u0644\u0649",tr:"i",id:"",he:"\u05D0\u05EA",sw:"",tl:"",bn:"\u0995\u09C7",qu:"ta"}},{role:"destination",description:"Where to store the result (optional)",required:false,expectedTypes:["reference"],svoPosition:2,sovPosition:1}]},Jl={action:"take",description:"Take content from a source element",category:"dom-content",primaryRole:"patient",ast:{args:["patient"],modifiers:{from:"source",for:"recipient"}},argSkipTokens:["from"],roles:[{role:"patient",description:"The class or element to take",required:true,expectedTypes:["selector"],svoPosition:1,sovPosition:2},{role:"source",description:"The element to take from (defaults to all current holders)",required:false,expectedTypes:["selector","reference"],svoPosition:2,sovPosition:1},{role:"recipient",description:"The element the class moves ONTO (`take .active from .tab for me`)",required:false,expectedTypes:["reference"],svoPosition:3,sovPosition:3,valueShape:"reference",markerOverride:{en:"for"}}]},ec={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}]},tc={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}]},rc={action:"settle",description:"Wait for animations/transitions to settle",category:"async",primaryRole:"patient",ast:{args:[["destination","patient"]],isBlocking:true},roles:[{role:"patient",description:"The element to settle (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:1,sovPosition:1}]},ic={action:"throw",description:"Throw an error",category:"control-flow",primaryRole:"patient",ast:{args:["patient"]},roles:[{role:"patient",description:"The error message or object to throw",required:true,expectedTypes:["literal","expression"],svoPosition:1,sovPosition:1}]},ac={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"}}]},nc={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}]},oc={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}]},sc={action:"else",description:"Else branch of conditional",category:"control-flow",primaryRole:"patient",hasBody:true,roles:[]},uc={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"'},lc={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"}}]},cc={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}]},pc={action:"continue",description:"Continue to next loop iteration",category:"control-flow",primaryRole:"patient",ast:{},roles:[]},ar={en:"url",es:"url",pt:"url",fr:"url",de:"url",it:"url",ja:"url",ko:"url",zh:"url",ar:"url",he:"url",hi:"url",bn:"url",tr:"url",ru:"url",uk:"url",pl:"url",id:"url",vi:"url",th:"url",ms:"url",tl:"url",sw:"url",qu:"url"},dc={action:"go",description:"Navigate to a URL",category:"navigation",primaryRole:"destination",roles:[{role:"destination",description:"The URL to navigate to",required:true,expectedTypes:["literal","expression"],svoPosition:1,sovPosition:1,markerOverride:{en:"to",es:"a",ar:"\u0625\u0644\u0649",fr:"\xE0",de:"zu",pt:"para",he:"\u05D0\u05DC",hi:"\u092A\u0930",id:"ke",it:"a",ru:"\u043D\u0430",sw:"kwa",uk:"\u043D\u0430"},renderOverride:{en:"",zh:"",vi:"",th:""},markerOptional:{en:true,zh:true,vi:true,th:true},markerVariants:{zh:["\u628A"]},markerLegacy:{es:["en","sobre","hacia"],ar:["\u0639\u0644\u0649","\u0641\u064A","\u0628"],fr:["sur","dans"],de:["auf","in"],pt:["em","a"],he:["\u05E2\u05DC","\u05D1","\u05DC","\u05D0\u05EA"],hi:["\u092E\u0947\u0902"],id:["pada","di"],it:["in","su"],ru:["\u0432","\u043A"],sw:["kwenye"],uk:["\u0432","\u0434\u043E"]}}],rolePrefixLiteralVariants:[{role:"destination",literal:ar,idSuffix:"url",priorityDelta:5,methodCarrier:"method"}]},mc={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}]},fc={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"}}]},yc={action:"focus",description:"Focus an element",category:"dom-content",primaryRole:"patient",ast:{args:[["destination","patient"]]},roles:[{role:"patient",description:"The element to focus (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:1,sovPosition:1}]},vc={action:"blur",description:"Remove focus from an element",category:"dom-content",primaryRole:"patient",ast:{args:[["destination","patient"]]},roles:[{role:"patient",description:"The element to blur (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:1,sovPosition:1}]},hc={action:"empty",description:"Remove all children from an element (sets innerHTML to empty)",category:"dom-content",primaryRole:"patient",roles:[{role:"patient",description:"The element to empty (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:1,sovPosition:1}]},Ec={action:"open",description:"Open a dialog, details element, or popover",category:"dom-content",primaryRole:"patient",ast:{args:["patient"],modifiers:{as:"style"}},roles:[{role:"patient",description:"The element to open (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:1,sovPosition:2},{role:"style",description:"Open-mode variant (modal / non-modal) for <dialog>",required:false,expectedTypes:["literal","expression"],svoPosition:2,sovPosition:1,markerOverride:{en:"as",ja:"\u3068\u3057\u3066"}}]},gc={action:"close",description:"Close a dialog, details element, or popover",category:"dom-content",primaryRole:"patient",roles:[{role:"patient",description:"The element to close (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:1,sovPosition:1}]},kc={action:"select",description:"Select the contents of a text field or DOM element",category:"dom-content",primaryRole:"patient",roles:[{role:"patient",description:"The element whose contents to select (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:1,sovPosition:1}]},bc={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}]},wc={action:"reset",description:"Reset a <form> element to its default values",category:"dom-content",primaryRole:"patient",roles:[{role:"patient",description:"The form element to reset (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:1,sovPosition:1}]},zc={action:"breakpoint",description:"Drop into the debugger",category:"control-flow",primaryRole:"patient",roles:[],bareKeyword:true},Cc={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}]},Ac={action:"return",description:"Return a value from a function",category:"control-flow",primaryRole:"patient",ast:{args:["patient"]},roles:[{role:"patient",description:"The value to return",required:false,expectedTypes:["literal","expression","reference"],svoPosition:1,sovPosition:1}]},xc={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}]},Sc={action:"async",description:"Execute commands asynchronously",category:"async",primaryRole:"patient",ast:{},hasBody:true,roles:[]},Dc={action:"tell",description:"Execute commands in context of another element",category:"control-flow",primaryRole:"destination",ast:{args:[["destination","patient"]]},hasBody:true,roles:[{role:"destination",description:"The element to tell",required:true,expectedTypes:["selector","reference"],svoPosition:1,sovPosition:1,markerOverride:{en:"",he:"\u05D0\u05EA",zh:"\u628A"}}]},Tc={action:"default",description:"Set a default value for a variable",category:"variable",primaryRole:"destination",ast:{args:["destination"],modifiers:{to:"patient"}},roles:[{role:"destination",description:"The variable to set default for",required:true,expectedTypes:["selector","reference","expression","property-path"],svoPosition:1,sovPosition:1,markerOverride:{en:"",ar:"",tl:"",sw:"",bn:"\u0995\u09C7",qu:"ta",ja:"\u3092",ko:"\uB97C",tr:"i",hi:"\u0915\u094B",de:"",es:"",fr:"",it:"",pt:"",pl:"",ru:"",uk:"",vi:"",id:"",ms:"",th:"",zh:"\u628A",he:"\u05D0\u05EA"}},{role:"patient",description:"The default value",required:true,expectedTypes:["literal","expression"],svoPosition:2,sovPosition:2,markerOverride:{en:"to",ar:"\u0625\u0644\u0649",tl:"sa",sw:"kwa",bn:"\u09A4\u09C7",qu:"man",ja:"\u306B",ko:"\uC5D0",tr:"e",hi:"\u092E\u0947\u0902",de:"zu",es:"a",fr:"\xE0",it:"in",pt:"para",pl:"do",ru:"\u0432",uk:"\u0432",vi:"v\xE0o",id:"ke",ms:"ke",th:"\u0E43\u0E19",zh:"\u5230",he:"\u05E2\u05DC"}}]},Bc={action:"init",description:"Initialization block that runs once",category:"control-flow",primaryRole:"patient",ast:{},hasBody:true,roles:[]},Pc={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}]},Rc={action:"measure",description:"Measure element dimensions (x, y, width, height, etc.)",category:"dom-content",primaryRole:"patient",ast:{args:["patient"],modifiers:{of:["destination","source"]}},roles:[{role:"patient",description:"Property to measure (x, y, width, height, top, left, etc.)",required:false,expectedTypes:["literal","expression"],svoPosition:1,sovPosition:1},{role:"source",description:"Element to measure (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:2,sovPosition:2,markerOverride:{en:"of"}}]},Oc={en:"using view",es:"using view",pt:"using view",fr:"using view",de:"using view",it:"using view",ja:"using view",ko:"using view",zh:"using view",ar:"using view",he:"using view",hi:"using view",bn:"using view",tr:"using view",ru:"using view",uk:"using view",pl:"using view",id:"using view",vi:"using view",th:"using view",ms:"using view",tl:"using view",sw:"using view",qu:"using view"},nr={role:"manner",description:"Run the swap inside a `document.startViewTransition()` (`using view transition`)",required:false,expectedTypes:["literal","expression"],valueShape:"keyword",markerOverride:Oc},_c={action:"swap",description:"Swap DOM content using various strategies (innerHTML, outerHTML, delete, etc.)",category:"dom-content",primaryRole:"destination",ast:{args:["method","destination","patient"],modifiers:{viewTransition:"manner"}},roles:[{role:"method",description:"The swap strategy (innerHTML, outerHTML, beforebegin, afterend, delete)",required:false,expectedTypes:["literal"],svoPosition:1,sovPosition:3,markerOverride:{en:""}},{role:"destination",description:"The element to swap content in/for",required:true,expectedTypes:["selector","reference"],svoPosition:2,sovPosition:1,markerOverride:{en:"of",es:"",fr:"",pt:"",it:"",de:"",pl:"",ru:"",uk:"",id:"",ms:"",sw:"",th:"",vi:"",he:"\u05D0\u05EA",zh:"\u628A",tl:""}},{role:"patient",description:"The content to swap in (optional for delete)",required:false,expectedTypes:["literal","expression","selector"],svoPosition:3,sovPosition:2,markerOverride:{en:"with",es:"con",fr:"avec",pt:"com",it:"con",de:"mit",pl:"z",ru:"\u0441",uk:"\u0437",id:"dengan",ms:"dengan",sw:"na",th:"\u0E14\u0E49\u0E27\u0E22",vi:"v\u1EDBi",he:"\u05E2\u05DD",zh:"\u7528",hi:"\u0938\u0947",bn:"\u09A6\u09BF\u09AF\u09BC\u09C7",tr:"ile",qu:"wan",ar:"\u0628\u0640",tl:"nang"}},{...nr,svoPosition:4,sovPosition:4}]},Nc={action:"morph",description:"Morph an element into another using DOM diffing",category:"dom-content",primaryRole:"patient",ast:{args:[["source","destination"]],modifiers:{on:"patient",viewTransition:"manner"}},roles:[{role:"patient",description:"The element to morph",required:true,expectedTypes:["selector","reference"],svoPosition:1,sovPosition:1,markerOverride:{en:""}},{role:"destination",description:"The target content/element to morph into",required:true,expectedTypes:["literal","expression","selector","reference"],svoPosition:2,sovPosition:2,markerOverride:{en:"to"}},{...nr,svoPosition:3,sovPosition:3}]},Lc={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}]},Ic={action:"break",description:"Exit from the current loop",category:"control-flow",primaryRole:"patient",roles:[]},Mc={action:"copy",description:"Copy text or element content to the clipboard",category:"dom-content",primaryRole:"patient",roles:[{role:"patient",description:"The text or element to copy",required:true,expectedTypes:["literal","selector","reference","expression"],svoPosition:1,sovPosition:1}]},$c={action:"exit",description:"Exit from the current event handler",category:"control-flow",primaryRole:"patient",roles:[],bareKeyword:true},jc={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}]},qc={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"}}]},Vc={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"},Wc={action:"push",description:"Push a URL onto the browser history",category:"navigation",primaryRole:"patient",roles:[{role:"patient",description:"The URL to push (after the `url` keyword)",required:true,expectedTypes:["literal","expression"],svoPosition:1,sovPosition:1,markerOverride:ar}]},Hc={action:"replace",description:"Replace the current browser history entry with a URL",category:"navigation",primaryRole:"patient",roles:[{role:"patient",description:"The URL to replace with (after the `url` keyword)",required:true,expectedTypes:["literal","expression"],svoPosition:1,sovPosition:1,markerOverride:ar}]},Kc={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:Vc},{...nr,svoPosition:2,sovPosition:2}]},Uc={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}]},Hi={toggle:Tl,add:Bl,remove:Pl,put:Fl,set:Rl,show:jl,hide:ql,on:Vl,trigger:Wl,wait:Hl,fetch:Kl,increment:Ul,decrement:Gl,append:Yl,prepend:Zl,log:Xl,get:Ql,take:Jl,make:ec,halt:tc,settle:rc,throw:ic,send:ac,if:nc,unless:oc,else:sc,repeat:uc,for:lc,while:cc,continue:pc,go:dc,scroll:qc,push:Wc,replace:Hc,process:Kc,transition:mc,clone:fc,focus:yc,blur:vc,empty:hc,open:Ec,close:gc,select:kc,clear:bc,reset:wc,breakpoint:zc,call:Cc,return:Ac,js:xc,async:Sc,tell:Dc,default:Tc,init:Bc,behavior:Pc,install:Fc,measure:Rc,swap:_c,morph:Nc,beep:Lc,break:Ic,copy:Mc,exit:$c,pick:jc,render:Uc,bind:Ol,live:_l,when:Nl,eventsource:Ll,socket:Il,worker:Ml,intercept:$l,compound:{action:"compound",description:"A compound node representing chained statements",primaryRole:"patient",category:"control-flow",hasBody:true,roles:[]}};function Gc(){return Object.values(Hi).filter(i=>i.structuralOnly!==true&&(i.roles.length>0||i.bareKeyword===true))}typeof process<"u"&&process.env.LOKASCRIPT_SCHEMA_VALIDATION==="1"&&Promise.resolve().then(()=>(cl(),$i)).then(({validateAllSchemas:i,formatValidationResults:e})=>{let t=i(Hi);t.size>0&&(console.warn("[SCHEMA VALIDATION] Found issues in command schemas:"),console.warn(e(t)),console.warn(`
6
+ These warnings help identify potential schema design issues.`),console.warn("Fix them to improve type inference and avoid runtime bugs."));}).catch(i=>{console.debug("Schema validation skipped:",i);});function Ki(i,e){let t=e==="SOV"?"sovPosition":"svoPosition";return [...i].sort((r,n)=>{let a=r[t]??99,o=n[t]??99;return a-o})}function Yc(i,e){let t=i.markerOverride?.[e.code],r=e.roleMarkers[i.role];if(t!==void 0){let n=Zc(i,e.code,t);return {primary:t,...n&&{alternatives:n},position:r?.position??"before",isOverride:true}}if(r&&r.primary){let n={primary:r.primary,position:r.position,isOverride:false};return r.alternatives&&(n.alternatives=r.alternatives),n}return null}function Zc(i,e,t){let r=i.markerLegacy?.[e];if(!r?.length)return;let n=[...new Set(r)].filter(a=>a&&a!==t);return n.length?n:void 0}function Ee(i,e,t){let r=i.markerLegacy?.[e]??[],n=i.methodCarrier?[]:i.markerVariants?.[e]??[],a=[...new Set([...r,...n])].filter(o=>o&&o!==t);return a.length?a:void 0}function He(i,e){let t,r;if(i.markerOverride&&i.markerOverride[e.code]!==void 0)t=i.markerOverride[e.code],r=t?Ee(i,e.code,t):void 0;else {let n=e.roleMarkers[i.role];if(n){t=n.primary;let a=Ee(i,e.code,t)??[],o=[...new Set([...n.alternatives??[],...a])].filter(s=>s!==t);r=o.length?o:void 0;}}return {marker:t,alternatives:r}}function nt(i,e,t){t.roles.find(n=>n.role==="scope"&&!n.required)&&(i.push({type:"group",optional:true,tokens:[{type:"literal",value:"on"},{type:"role",role:"scope",optional:true,expectedTypes:["selector","reference"]}]}),e.scope={fromRole:"scope"});}function or(i,e,t,r){Gi(i,e,t,r,"manner",{requireMarker:true});}function Ui(i,e,t,r){Gi(i,e,t,r,"recipient",{requireMarker:false});}function Gi(i,e,t,r,n,a){let o=t.roles.find(u=>u.role===n&&!u.required);if(!o)return;let s=o.markerOverride?.[r];a.requireMarker&&!s||(i.push({type:"group",optional:true,tokens:[...(s?s.split(/\s+/):[]).map(u=>({type:"literal",value:u})),{type:"role",role:n,optional:true,expectedTypes:o.expectedTypes,...o.valueShape!==void 0?{valueShape:o.valueShape}:{}}]}),e[n]={fromRole:n});}function Yi(i){if(i.roles.some(r=>r.role==="patient"))return "patient";let e=i.roles.filter(r=>r.required),t=e.find(r=>r.role===i.primaryRole)??e[0];return !t||t.role==="event"?"patient":t.role}function Zi(i,e,t){let r=i.roles.find(c=>c.role===t);if(!r||t==="patient")return [{type:"role",role:t,optional:false}];let{marker:n,alternatives:a}=He(r,e),o={type:"role",role:t,optional:false,...r.valueShape!==void 0?{valueShape:r.valueShape}:{}};if(!n)return [o];let s=n.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 Xi(i,e,t,r,n){for(let a of t.roles)a.required||n.has(a.role)||e[a.role]||!(a.markerOverride?.[r.code]??r.roleMarkers[a.role]?.primary)&&a.valueShape===void 0||(i.push({type:"group",optional:true,tokens:Ji(a,r)}),e[a.role]=a.default?{fromRole:a.role,default:a.default}:{fromRole:a.role});}function Xc(i,e,t,r,n){let a=[];if(a.push({type:"role",role:"event",optional:false}),r.position==="after"){let f=r.primary.split(/\s+/);if(f.length>1)for(let h of f)a.push({type:"literal",value:h});else {let h=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};a.push(h);}}let o=Yi(i),s=e.roleMarkers.destination,u=i.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=i.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(...Zi(i,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(...Pe(i,e.roleMarkers.source)),o!=="destination"&&a.push(...rr(i,e.roleMarkers.destination));let m={action:{value:i.action},event:{fromRole:"event"},[o]:{fromRole:o},...o==="destination"?{}:Te(i),...o==="source"?{}:Be(i)};return Xi(a,m,i,e,new Set(["event",o,"destination","source"])),{id:`${i.action}-event-${e.code}-sov`,language:e.code,command:"on",priority:(n.basePriority??100)+50,template:{format:`{event} ${r.primary} {destination?} {${o}} ${p?.primary||""} ${t.primary}`,tokens:a},extraction:m}}function Qc(i,e,t,r,n){let a=[],o=i.action==="swap",s=o?"destination":"patient";a.push({type:"role",role:s,optional:false});let u=e.roleMarkers.patient;if(u){let d=u.alternatives?{type:"literal",value:u.primary,alternatives:u.alternatives}:{type:"literal",value:u.primary};a.push(d);}if(a.push({type:"role",role:"event",optional:false}),r.position==="after"){let d=r.primary.split(/\s+/);if(d.length>1)for(let m of d)a.push({type:"literal",value:m});else {let m=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.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(...Pe(i,e.roleMarkers.source));let c=e.roleMarkers.destination;if(o&&c){let d=i.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?Dl(i,c):rr(i,c));let p={action:{value:i.action},event:{fromRole:"event"},[s]:{fromRole:s},...o?{}:Te(i),...Be(i)};return Ui(a,p,i,e.code),or(a,p,i,e.code),{id:`${i.action}-event-${e.code}-sov-patient-first`,language:e.code,command:"on",priority:(n.basePriority??100)+45,template:{format:`{patient} ${u?.primary||""} {event} ${r.primary} ${t.primary}`,tokens:a},extraction:p}}function Jc(i,e,t,r,n){let a=i.roles.find(p=>p.role==="source");if(!a)return null;let{marker:o,alternatives:s}=He(a,e),u=e.roleMarkers.patient;if(!o||o===r.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 p of o.split(/\s+/))l.push(s&&o.split(/\s+/).length===1?{type:"literal",value:p,alternatives:s}:{type:"literal",value:p});if(l.push({type:"role",role:"event",optional:false}),r.position==="after"){let p=r.primary.split(/\s+/);if(p.length>1)for(let d of p)l.push({type:"literal",value:d});else l.push(r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary});}l.push(t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary});let c={action:{value:i.action},event:{fromRole:"event"},patient:{fromRole:"patient"},source:{fromRole:"source"}};return Ui(l,c,i,e.code),or(l,c,i,e.code),{id:`${i.action}-event-${e.code}-sov-source-fronted`,language:e.code,command:"on",priority:(n.basePriority??100)+48,template:{format:`{patient} ${u?.primary||""} {source} ${o} {event} ${r.primary} ${t.primary}`,tokens:l},extraction:c}}function ep(i,e,t,r,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 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}),r.position==="after"){let l=r.primary.split(/\s+/);if(l.length>1)for(let c of l)a.push({type:"literal",value:c});else {let c=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.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:`${i.action}-event-${e.code}-sov-patient-first-dest`,language:e.code,command:"on",priority:(n.basePriority??100)+40,template:{format:`{patient} ${o?.primary||""} {destination} ${s?.primary||""} {event} ${r.primary} ${t.primary}`,tokens:a},extraction:{action:{value:i.action},event:{fromRole:"event"},patient:{fromRole:"patient"},destination:{fromRole:"destination"}}}}function tp(i,e,t,r,n){let a=[];a.push({type:"role",role:"event",optional:false});let o=r.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(...Pe(i,e.roleMarkers.source)),a.push(...rr(i,e.roleMarkers.destination)),{id:`${i.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:i.action},event:{fromRole:"event"},patient:{fromRole:"patient"},...Te(i),...Be(i)}}}function rp(i,e,t,r,n){let a=[];if(a.push({type:"role",role:"event",optional:false}),r.position==="after"){let s=r.primary.split(/\s+/);if(s.length>1)for(let u of s)a.push({type:"literal",value:u});else {let u=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.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:`${i.action}-event-${e.code}-sov-simple`,language:e.code,command:"on",priority:(n.basePriority??100)+48,template:{format:`{event} ${r.primary} ${t.primary}`,tokens:a},extraction:{action:{value:i.action},event:{fromRole:"event"},patient:{default:{type:"reference",value:"me"}}}}}function ip(i,e,t,r){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 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:`${i.action}-event-${e.code}-sov-temporal`,language:e.code,command:"on",priority:(r.basePriority??100)+49,template:{format:`{event} ${n[0]} {patient} ${t.primary}`,tokens:a},extraction:{action:{value:i.action},event:{fromRole:"event"},patient:{fromRole:"patient"}}}}function ap(i,e,t,r,n){let a=[];if(a.push({type:"role",role:"event",optional:false}),r.position==="after"){let p=r.primary.split(/\s+/);if(p.length>1)for(let d of p)a.push({type:"literal",value:d});else {let d=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};a.push(d);}}let s=[...i.roles.filter(p=>p.required)].sort((p,d)=>{let m=p.sovPosition??999,f=d.sovPosition??999;return m-f});for(let p of s){a.push({type:"role",role:p.role,optional:false});let{marker:d,alternatives:m}=He(p,e);if(d){let f=m?{type:"literal",value:d,alternatives:m}:{type:"literal",value:d};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(p=>`{${p.role}}`).join(" "),c={action:{value:i.action},event:{fromRole:"event"},...Object.fromEntries(s.map(p=>[p.role,{fromRole:p.role}]))};return nt(a,c,i),{id:`${i.action}-event-${e.code}-sov-2role`,language:e.code,command:"on",priority:(n.basePriority??100)+55,template:{format:`{event} ${r.primary} ${l} ${t.primary}`,tokens:a},extraction:c}}function np(i,e,t,r,n){let a=[],s=[...i.roles.filter(c=>c.required)].sort((c,p)=>{let d=c.sovPosition??999,m=p.sovPosition??999;return d-m});for(let c of s){a.push({type:"role",role:c.role,optional:false});let{marker:p,alternatives:d}=He(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}),r.position==="after"){let c=r.primary.split(/\s+/);if(c.length>1)for(let p of c)a.push({type:"literal",value:p});else a.push(r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary});}let u=s.map(c=>`{${c.role}}`).join(" "),l={action:{value:i.action},event:{fromRole:"event"},...Object.fromEntries(s.map(c=>[c.role,{fromRole:c.role}]))};return nt(a,l,i),{id:`${i.action}-event-${e.code}-sov-2role-event-last`,language:e.code,command:"on",priority:(n.basePriority??100)+40,template:{format:`${u} ${t.primary} {event} ${r.primary}`,tokens:a},extraction:l}}function op(i,e,t,r,n){let a=[],s=[...i.roles.filter(E=>E.required)].sort((E,y)=>{let v=E.sovPosition??999,k=y.sovPosition??999;return v-k}),u=s[0];a.push({type:"role",role:u.role,optional:false});let{marker:l,alternatives:c}=He(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}),r.position==="after"){let E=r.primary.split(/\s+/);if(E.length>1)for(let y of E)a.push({type:"literal",value:y});else {let y=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};a.push(y);}}let p=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};a.push(p);let d=s[1];a.push({type:"role",role:d.role,optional:false});let{marker:m,alternatives:f}=He(d,e);if(m){let E=f?{type:"literal",value:m,alternatives:f}:{type:"literal",value:m};a.push(E);}let h={action:{value:i.action},event:{fromRole:"event"},[u.role]:{fromRole:u.role},[d.role]:{fromRole:d.role}};return nt(a,h,i),{id:`${i.action}-event-${e.code}-sov-2role-dest-first`,language:e.code,command:"on",priority:(n.basePriority??100)+48,template:{format:`{${u.role}} {event} ${r.primary} ${t.primary} {${d.role}}`,tokens:a},extraction:h}}function Qi(i,e,t){let r=Ee(i,e.code,t.primary)??[],n=[...new Set([...t.alternatives??[],...r])].filter(a=>a!==t.primary);return n.length?n:void 0}function Ri(i,e,t,r,n){let a=[];if(r.position==="before"){let p=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.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=Yi(i);a.push(...Zi(i,e,s));let u=e.roleMarkers.destination,l=i.roles.some(p=>p.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(...Pe(i,e.roleMarkers.source));let c={action:{value:i.action},event:{fromRole:"event"},[s]:{fromRole:s},...s==="destination"?{}:Te(i),...s==="source"?{}:Be(i)};return Xi(a,c,i,e,new Set(["event",s,"destination","source"])),{id:`${i.action}-event-${e.code}-vso`,language:e.code,command:"on",priority:(n.basePriority??100)+50,template:{format:`${r.primary} {event} ${t.primary} {${s}} ${u?.primary||""} {destination?}`,tokens:a},extraction:c}}function sp(i,e,t,r,n){let a=[],o=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};a.push(o);let s=i.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(...Pe(i,e.roleMarkers.source)),r.position==="before"){let c=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};a.push(c);}if(a.push({type:"role",role:"event",optional:false}),s){let c=i.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:i.action},event:{fromRole:"event"},[s?"destination":"patient"]:{fromRole:s?"destination":"patient"},...s?{}:Te(i),...Be(i)};return or(a,l,i,e.code),{id:`${i.action}-event-${e.code}-vso-verb-first`,language:e.code,command:"on",priority:(n.basePriority??100)+45,template:{format:`${t.primary} {patient} ${u?.primary||""} {destination?} ${r.primary} {event}`,tokens:a},extraction:l}}function up(i,e,t,r,n){let a=[],o=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};a.push(o);let u=[...i.roles.filter(p=>p.required)].sort((p,d)=>{let m=p.svoPosition??999,f=d.svoPosition??999;return m-f});for(let p of u){let d,m;if(p.markerOverride&&p.markerOverride[e.code]!==void 0)d=p.markerOverride[e.code],m=d?Ee(p,e.code,d):void 0;else {let f=e.roleMarkers[p.role];f&&(d=f.primary,m=Qi(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(r.position==="before"){let p=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};a.push(p);}a.push({type:"role",role:"event",optional:false});let l=u.map(p=>`{${p.role}}`).join(" "),c={action:{value:i.action},event:{fromRole:"event"},...Object.fromEntries(u.map(p=>[p.role,{fromRole:p.role}]))};return nt(a,c,i),{id:`${i.action}-event-${e.code}-vso-verb-first-2role`,language:e.code,command:"on",priority:(n.basePriority??100)+48,template:{format:`${t.primary} ${l} ${r.primary} {event}`,tokens:a},extraction:c}}function Oi(i,e,t,r,n){let a=[];if(r.position==="before"){let p=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.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=[...i.roles.filter(p=>p.required)].sort((p,d)=>{let m=p.svoPosition??999,f=d.svoPosition??999;return m-f});for(let p of u){let d,m;if(p.markerOverride&&p.markerOverride[e.code]!==void 0)d=p.markerOverride[e.code],m=d?Ee(p,e.code,d):void 0;else {let f=e.roleMarkers[p.role];f&&(d=f.primary,m=Qi(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=u.map(p=>`{${p.role}}`).join(" "),c={action:{value:i.action},event:{fromRole:"event"},...Object.fromEntries(u.map(p=>[p.role,{fromRole:p.role}]))};return nt(a,c,i),{id:`${i.action}-event-${e.code}-vso-2role`,language:e.code,command:"on",priority:(n.basePriority??100)+55,template:{format:`${r.primary} {event} ${t.primary} ${l}`,tokens:a},extraction:c}}function lp(i,e,t,r,n){let a=[],o=e.eventHandler?.negationMarker;if(r.position==="before"){let l=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.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(...Pe(i,e.roleMarkers.source)),{id:`${i.action}-event-${e.code}-vso-negated`,language:e.code,command:"on",priority:(n.basePriority??100)+48,template:{format:`${r.primary} ${o?.primary||""} {event} ${t.primary} {patient} ${u?.primary||""} {destination?}`,tokens:a},extraction:{action:{value:i.action},event:{fromRole:"event"},patient:{fromRole:"patient"},...Te(i),...Be(i)}}}function cp(i,e,t,r){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(...Pe(i,e.roleMarkers.source)),{id:`${i.action}-event-${e.code}-vso-proclitic`,language:e.code,command:"on",priority:(r.basePriority??100)+45,template:{format:`[proclitic?] {event} ${t.primary} {patient} ${o?.primary||""} {destination?}`,tokens:n},extraction:{action:{value:i.action},event:{fromRole:"event"},patient:{fromRole:"patient"},...Te(i),...Be(i)}}}var Ke={basePriority:100,generateSimpleVariants:true,generateAlternatives:true};function at(i,e,t=Ke){let r=`${i.action}-${e.code}-generated`,n=t.basePriority??100,a=e.keywords[i.action];if(!a)throw new Error(`No keyword translation for '${i.action}' in ${e.code}`);let o=yp(i,e,a),s=sr(i,e),u=gp(i,e,a);return {id:r,language:e.code,command:i.action,priority:n,template:{format:u,tokens:o},extraction:s}}function pp(i,e,t=Ke){if(i.roles.filter(s=>!s.required).length===0)return null;let n=i.roles.filter(s=>s.required),a={...i,roles:n};return {...at(a,e,t),id:`${i.action}-${e.code}-generated-simple`,priority:(t.basePriority??100)-5,extraction:sr(i,e)}}function _i(i,e,t=Ke){if(e.wordOrder!=="SOV")return null;let r=i.roles.filter(s=>s.required);if(r.length!==1)return null;let n=e.keywords[i.action];if(!n)return null;let a=n.alternatives?{type:"literal",value:n.primary,alternatives:n.alternatives}:{type:"literal",value:n.primary},o=r.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:`${i.action}-${e.code}-generated-verb-first`,language:e.code,command:i.action,priority:(t.basePriority??100)-20,template:{format:`${n.primary} <${r[0].role}>`,tokens:[a,...o]},extraction:sr(i,e)}}function dp(i,e,t=Ke){let r=[];if(r.push(at(i,e,t)),t.generateSimpleVariants){let n=pp(i,e,t);n&&r.push(n);}for(let n of i.omitRoleVariants??[]){let a={...i,roles:i.roles.filter(s=>s.role!==n)},o=at(a,e,t);r.push({...o,id:`${i.action}-${e.code}-generated-no-${n}`,priority:(t.basePriority??100)-8});}for(let n of i.widenTypeVariants??[]){if(n.excludeLanguages?.includes(e.code))continue;let a={...i,roles:i.roles.map(s=>s.role===n.role?{...s,expectedTypes:[...n.types]}:s)},o=at(a,e,t);r.push({...o,id:`${i.action}-${e.code}-generated-${n.idSuffix}`,priority:(t.basePriority??100)-(n.priorityDelta??15)});}if(t.generateVerbFirstVariants!==false){let n=_i(i,e,t);n&&r.push(n);}for(let n of i.rolePrefixLiteralVariants??[]){let a=n.literal[e.code];if(!a)continue;let{rolePrefixLiteralVariants:o,...s}=i,u={...s,roles:i.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=at(u,e,t);if(r.push({...p,id:`${i.action}-${e.code}-generated-${n.idSuffix}`,priority:(t.basePriority??100)+l,extraction:{...p.extraction,...c}}),t.generateVerbFirstVariants!==false){let d=_i(u,e,t);d&&r.push({...d,id:`${i.action}-${e.code}-generated-verb-first-${n.idSuffix}`,priority:(t.basePriority??100)-20+l,extraction:{...d.extraction,...c}});}}return r}function mp(i,e=Ke){let t=[],r=Gc();for(let n of r){if(!i.keywords[n.action])continue;let a=dp(n,i,e);if(t.push(...a),i.eventHandler?.eventMarker){let o=fp(n,i,e);t.push(...o);}}return t}function fp(i,e,t=Ke){if(!e.eventHandler||!e.eventHandler.eventMarker)return [];let r=[],n=e.eventHandler.eventMarker,a=e.keywords[i.action];if(!a)return [];if(i.roles.length===0)return [];if(i.action==="js")return [];let s=i.roles.filter(u=>u.required).length===2;if(e.wordOrder==="SOV")if(s)r.push(ap(i,e,a,n,t)),r.push(op(i,e,a,n,t)),r.push(np(i,e,a,n,t));else {r.push(Xc(i,e,a,n,t)),r.push(Qc(i,e,a,n,t));let u=Jc(i,e,a,n,t);u&&r.push(u);let l=e.roleMarkers.destination;l&&l.primary!==n.primary&&r.push(ep(i,e,a,n,t));let c=n.primary.split(/\s+/),p=n.alternatives?.some(m=>!m.includes(" ")&&m.length>1);c.length>1&&p&&r.push(tp(i,e,a,n,t)),r.push(rp(i,e,a,n,t));let d=ip(i,e,a,t);d&&r.push(d);}else e.wordOrder==="VSO"?s?(r.push(Oi(i,e,a,n,t)),r.push(up(i,e,a,n,t))):(r.push(Ri(i,e,a,n,t)),r.push(sp(i,e,a,n,t)),e.eventHandler?.negationMarker&&r.push(lp(i,e,a,n,t)),e.tokenization?.prefixes&&r.push(cp(i,e,a,t))):s?r.push(Oi(i,e,a,n,t)):r.push(Ri(i,e,a,n,t));return r}function yp(i,e,t){let r=[],n=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary},a=hp(i,e);switch(e.wordOrder){case "SVO":r.push(n),r.push(...a);break;case "SOV":r.push(...a),r.push(n);break;case "VSO":r.push(n),r.push(...a);break;default:r.push(n),r.push(...a);}return vp(r)}function vp(i){let e=[];for(let t of i){let r=e[e.length-1];if(r&&r.type==="literal"&&t.type==="literal"&&r.value===t.value){let n=[...r.alternatives??[],...t.alternatives??[]];n.length&&(e[e.length-1]={...r,alternatives:[...new Set(n)]});continue}e.push(t);}return e}function hp(i,e){let t=[],r=Ki(i.roles,e.wordOrder);for(let n of r){let a=Ji(n,e);n.required?t.push(...a):t.push({type:"group",optional:true,tokens:a});}return t}function Ji(i,e){let t=[],r=i.markerOverride?.[e.code],n=e.roleMarkers[i.role],a=i.renderOverride?.[e.code]==="",o={type:"role",role:i.role,optional:!i.required,expectedTypes:i.expectedTypes,...i.valueShape!==void 0?{valueShape:i.valueShape}:{}},s=i.valuePrefixLiteral?.[e.code],u=()=>{s&&t.push({type:"literal",value:s}),t.push(o);};if(r!==void 0){let l=r?r.split(/\s+/).filter(Boolean):[],c=r!==void 0&&r===i.markerOverride?.en,p=n?.position??(e.wordOrder==="SOV"&&!c?"after":"before"),d=i.markerOptional?.[e.code]===true,m=f=>{let h=l.length===1?Ee(i,e.code,f)??[]:[],E={type:"literal",value:f,...h.length?{alternatives:h}:{},...a?{renderSuppress:true}:{}};t.push(d?{type:"group",optional:true,tokens:[E]}:E);};if(p==="before"){for(let f of l)m(f);u();}else {u();for(let f of l)m(f);}}else if(n){let l=()=>{let p=[...new Set([...n.alternatives??[],...Ee(i,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&&!i.markerOptional?.[e.code]){t.push(p);return}t.push({type:"group",optional:true,...e.markersOptional&&!i.markerOptional?.[e.code]?{renderRequired:true}:{},tokens:[p]});};n.position==="before"?(n.primary&&c(l()),u()):(u(),c(l()));}else u();return t}function Ep(i,e){let t={};for(let r of i.roles){let n=r.markerOverride?.[e.code],a=e.roleMarkers[r.role];if(r.valuePrefixLiteral?.[e.code])t[r.role]={marker:r.valuePrefixLiteral[e.code]};else if(n!==void 0)if(!n)t[r.role]={};else {let s=!/\s/.test(n.trim())?Ee(r,e.code,n)??[]:[];t[r.role]=s.length?{marker:n,markerAlternatives:s}:{marker:n};}else if(a&&a.primary){let o=[...new Set([...a.alternatives??[],...Ee(r,e.code,a.primary)??[]])].filter(s=>s!==a.primary);t[r.role]=o.length?{marker:a.primary,markerAlternatives:o}:{marker:a.primary};}else t[r.role]={};}return t}function sr(i,e){let t=Ep(i,e),r={};for(let n of i.roles){let a=t[n.role]||{};!n.required&&n.default?r[n.role]={...a,default:n.default}:r[n.role]=a;}return r}function gp(i,e,t){let r=[],a=Ki(i.roles,e.wordOrder).map(o=>{let s=Yc(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":r.push(t.primary,...a);break;case "SOV":r.push(...a,t.primary);break;default:r.push(t.primary,...a);}return r.join(" ")}var kp={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"}}},bp={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"}}},wp={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"}}},zp={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}}},Cp=[bp,wp,kp,zp],Ap={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"]}}},xp=[Ap],gt={type:"group",optional:true,tokens:[{type:"literal",value:"using"},{type:"literal",value:"view"},{type:"role",role:"manner",optional:true,expectedTypes:["literal","expression"],valueShape:"keyword"}]},Sp={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"},gt]},extraction:{method:{position:1},destination:{position:2}}},Dp={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"},gt]},extraction:{}},Tp={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"},gt]},extraction:{}},Bp={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"},gt]},extraction:{}},Pp=[Tp,Bp,Dp,Sp];function Fp(){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 Rp(){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 Op(){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 _p(){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 Np(){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 Lp(){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 Ip(){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 Mp(){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 $p(){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 jp(){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 qp(){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 Vp(){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 Wp(i){switch(i){case "bn":return Fp();case "en":return Rp();case "es":return Op();case "hi":return _p();case "it":return Np();case "pl":return Lp();case "qu":return Ip();case "ru":return Mp();case "th":return $p();case "uk":return jp();case "vi":return qp();case "zh":return Vp();default:return []}}function Hp(){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 Kp(){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 Up(){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 Gp(){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 Yp(){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:["literal","selector","reference","expression"]},{type:"literal",value:"ke"},{type:"literal",value:"dalam",alternatives:["di"]},{type:"role",role:"destination",expectedTypes:["selector","reference"]}]},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:["literal","selector","reference","expression"]},{type:"literal",value:"ke",alternatives:["di","pada"]},{type:"role",role:"destination",expectedTypes:["selector","reference"]}]},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:["literal","selector","reference","expression"]},{type:"literal",value:"di"},{type:"role",role:"destination",expectedTypes:["selector","reference"]}]},extraction:{patient:{position:1},destination:{position:3}}}]}function Zp(){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 Xp(){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 Qp(){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 Jp(){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 e0(){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 t0(){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 r0(){return [...["before","after"].map(i=>{let e=i==="before"?"\xF1awpaqpi":"qhepapi";return {id:`put-qu-${i}`,language:"qu",command:"put",priority:105,template:{format:`{patient} ${e} {destination} ta churay`,tokens:[{type:"role",role:"patient"},{type:"literal",value:e,alternatives:[i]},{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:i}}}}}),{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 i0(){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:["selector","reference"]}]},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:["selector","reference"]}]},extraction:{patient:{position:1},destination:{marker:"\u5230",markerAlternatives:["\u5728","\u4E8E","\u5165"]}}}]}var a0=[{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"}],n0=[{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 o0(i){let e=n0.find(a=>a.lang===i);if(!e)return [];let t=[],r=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(r)):(t.push(r),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 s0(){return ["before","after"].map(i=>{let e=i==="before"?"\u524D\u306B":"\u5F8C\u306B",t=i==="before"?"\u524D":"\u5F8C";return {id:`put-ja-${i}`,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:i}}}}})}function u0(){return ["before","after"].map(i=>{let e=i==="before"?"\uC804\uC5D0":"\uD6C4\uC5D0";return {id:`put-ko-${i}`,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:i}}}}})}function l0(){let i=(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 [i("before","\xF6nce"),i("after","sonra")]}function c0(i){let e=a0.find(t=>t.lang===i);return e?["before","after"].map(t=>{let r=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:r},{type:"role",role:"destination"}),{id:`put-${e.lang}-${t}`,language:e.lang,command:"put",priority:105,template:{format:`${e.verb} {patient} ${r} {destination}`,tokens:n},extraction:{patient:{position:e.patientPrefix&&!e.patientPrefixOptional?2:1},destination:{marker:r},manner:{default:{type:"literal",value:t}}}}}):[]}function p0(i){let e=c0(i),t=o0(i);switch(i){case "bn":return [...Hp(),...t];case "en":return Kp();case "es":return [...Up(),...t];case "hi":return [...Gp(),...t];case "id":return [...Yp(),...e,...t];case "it":return [...Zp(),...t];case "ja":return [...s0(),...t];case "ko":return [...u0(),...t];case "tr":return [...l0(),...t];case "pl":return [...Xp(),...t];case "ru":return [...Qp(),...t];case "qu":return [...r0(),...t];case "th":return [...Jp(),...t];case "uk":return [...e0(),...t];case "vi":return [...t0(),...t];case "zh":return [...i0(),...e,...t];default:return [...e,...t]}}var d0={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(d0).map(([i,e])=>{let t={};for(let[r,n]of Object.entries(e))n in t||(t[n]=r);return [i,t]}));function m0(){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"]},{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 f0(){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 y0(){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 v0(){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 h0(){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 E0(){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 g0(){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 k0(){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 b0(){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 w0(){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 z0(){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 C0(){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 A0(){return [{id:"event-qu-maykama",language:"qu",command:"on",priority:115,template:{format:"maykama {event} {body}",tokens:[{type:"literal",value:"maykama"},{type:"role",role:"event"}]},extraction:{event:{position:1}}},{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 x0(){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 S0(){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 D0(){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:95,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 ur(i){let e=i.verbAlts?{type:"literal",value:i.verb,alternatives:i.verbAlts}:{type:"literal",value:i.verb},t=i.eventMarkerAlts?{type:"literal",value:i.eventMarker,alternatives:i.eventMarkerAlts}:{type:"literal",value:i.eventMarker};return ["before","after"].map(r=>{let n={type:"literal",value:r==="before"?i.before:i.after},a={type:"role",role:"patient"},o={type:"role",role:"destination"},s={type:"role",role:"event"},u=i.order==="verb-first"?[e,a,n,o,t,s]:[t,s,e,a,n,o],l=i.order==="verb-first"?{action:{value:"put"},patient:{position:1},destination:{position:3},event:{position:5},manner:{default:{type:"literal",value:r}}}:{action:{value:"put"},event:{position:1},patient:{position:3},destination:{position:5},manner:{default:{type:"literal",value:r}}};return {id:`put-event-${i.lang}-vso-${r}`,language:i.lang,command:"on",priority:160,template:{format:`${i.lang} put ${r}`,tokens:u},extraction:l}})}function T0(){return [...ur({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 B0(){return [...ur({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 P0(){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 F0(){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",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 R0(){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 O0(){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 _0(){return [...ur({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 N0(){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 L0(i){switch(i){case "bn":return f0();case "ko":return m0();case "de":return y0();case "en":return v0();case "es":return h0();case "fr":return E0();case "hi":return g0();case "id":return k0();case "it":return b0();case "ms":return w0();case "pl":return z0();case "pt":return C0();case "qu":return A0();case "ru":return x0();case "sw":return S0();case "th":return D0();case "tl":return T0();case "uk":return B0();case "vi":return P0();case "zh":return F0();case "ja":return R0();case "tr":return O0();case "ar":return _0();case "he":return N0();default:return []}}function I0(i,e,t,r){let n=[];return n.push({type:"literal",value:e}),r&&n.push({type:"literal",value:r}),n.push({type:"role",role:"quantity",expectedTypes:["literal","expression"]}),n.push({type:"literal",value:t}),{id:`repeat-${i}-times`,language:i,command:"repeat",priority:110,template:{format:`${e}${r?" "+r:""} {quantity} ${t}`,tokens:n},extraction:{loopType:{default:{type:"literal",value:"times"}}}}}var M0=[["es","repetir","times"],["de","wiederholen","times"],["fr","r\xE9p\xE9ter","times"],["it","ripetere","times"],["pt","repetir","times"],["ru","\u043F\u043E\u0432\u0442\u043E\u0440\u0438\u0442\u044C","times"],["uk","\u043F\u043E\u0432\u0442\u043E\u0440\u0438\u0442\u0438","times"],["pl","powt\xF3rz","times"],["ar","\u0643\u0631\u0631","times"],["he","\u05D7\u05D6\u05D5\u05E8","times","\u05D0\u05EA"],["id","ulangi","times"],["ms","ulang","kali"],["sw","rudia","times"],["th","\u0E17\u0E33\u0E0B\u0E49\u0E33","\u0E04\u0E23\u0E31\u0E49\u0E07"],["vi","l\u1EB7p l\u1EA1i","l\u1EA7n"],["tl","ulitin","beses"],["zh","\u91CD\u590D","times","\u628A"]];function $0(i,e,t){return {id:`repeat-${i}-times`,language:i,command:"repeat",priority:110,template:{format:`{quantity} ${e} ${t} repeat`,tokens:[{type:"role",role:"quantity",expectedTypes:["literal","expression"]},{type:"literal",value:e},{type:"literal",value:t},{type:"literal",value:"repeat"}]},extraction:{loopType:{default:{type:"literal",value:"times"}}}}}var j0=[["ja","times","\u3092"],["ko","times","\uB97C"],["tr","times","i"],["hi","times","\u0915\u094B"],["bn","\u09AC\u09BE\u09B0","\u0995\u09C7"],["qu","times","ta"]];function q0(i,e){let t=[{type:"literal",value:"repeat"}];if(e.forWords&&e.forWords.length>0)if(e.requireForWords)for(let r of e.forWords)t.push({type:"literal",value:r});else t.push({type:"group",optional:true,tokens:e.forWords.map(r=>({type:"literal",value:r}))});t.push({type:"role",role:"patient",expectedTypes:["expression","reference"]});for(let r of e.inWords)t.push({type:"literal",value:r});return t.push({type:"role",role:"source",expectedTypes:["selector","expression","reference"]}),{id:`repeat-${i}-for-in`,language:i,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 V0=[["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 W0(i,e){let t=[{type:"literal",value:"repeat"}];for(let r of e.pre??[])t.push({type:"literal",value:r});return t.push({type:"literal",value:e.whileWord}),t.push({type:"role",role:"condition",expectedTypes:["property-path","expression"]}),{id:`repeat-${i}-while-head`,language:i,command:"repeat",priority:110,template:{format:`repeat ${(e.pre??[]).join(" ")} ${e.whileWord} {condition}`,tokens:t},extraction:{loopType:{default:{type:"literal",value:"while"}}}}}function H0(i,e){return {id:`repeat-${i}-while-head`,language:i,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 K0=[["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"}]],U0=[["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 G0(i,e){let t=[{type:"literal",value:"repeat"}];for(let r of e.pre??[])t.push({type:"literal",value:r});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-${i}-until-head`,language:i,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 Y0=[["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 Z0(i,e){return {id:`repeat-${i}-until-head`,language:i,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 X0(i,e){return {id:`repeat-${i}-until-head-verb-final`,language:i,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 Q0={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"}}}},J0=[["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"}]],ed={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 td(i,e){return {id:`for-${i}-sov-basic`,language:i,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 rd=[["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"}]],er=new Map,ue=(i,e)=>{let t=er.get(i);t?t.push(e):er.set(i,[e]);};for(let[i,e,t,r]of M0)ue(i,I0(i,e,t,r));for(let[i,e,t]of j0)ue(i,$0(i,e,t));for(let[i,e]of V0)ue(i,q0(i,e));for(let[i,e]of rd)ue(i,td(i,e));for(let[i,e]of U0)ue(i,W0(i,e));for(let[i,e]of K0)ue(i,H0(i,e));for(let[i,e]of Y0)ue(i,G0(i,e));for(let[i,e]of J0)ue(i,Z0(i,e)),i==="tr"&&ue(i,X0(i,e));var id={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"}}}};ue("qu",id);ue("qu",ed);ue("qu",Q0);function ad(i){return er.get(i)??[]}function nd(){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 od(){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 sd(){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 ud(){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 ld(){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 Et(i,e,t,r,n,a,o){let s=()=>({type:"group",optional:true,tokens:[{type:"literal",value:"("},...Array.from({length:a},(u,l)=>[...l>0?[{type:"literal",value:","}]:[],{type:"role",role:"condition",expectedTypes:["expression","literal","reference"]}]).flat(),{type:"literal",value:")"}]});return {id:i,language:e,command:"wait",priority:105,template:{format:`{source} ${r} {duration} ${n} {patient} ${t}`,tokens:[{type:"role",role:"source",expectedTypes:["expression","reference"]},{type:"literal",value:r,...o?{alternatives:o}:{}},{type:"role",role:"duration",expectedTypes:["expression","literal"]},s(),{type:"literal",value:n},{type:"role",role:"patient",expectedTypes:["expression","literal"]},s(),{type:"literal",value:t}]},extraction:{source:{position:0},duration:{position:2}}}}function Ni(i,e,t,r,n,a,o){let s=()=>({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:")"}]}),u=()=>({type:"group",optional:true,tokens:[{type:"literal",value:n}]});return {id:i,language:e,command:"wait",priority:105,template:{format:`${t} {duration} ${r} [${n}] {patient} [${n}] {source} ${a}`,tokens:[{type:"literal",value:t},{type:"role",role:"duration",expectedTypes:["expression","literal"]},s(),{type:"literal",value:r},u(),{type:"role",role:"patient",expectedTypes:["expression","literal"]},s(),u(),{type:"role",role:"source",expectedTypes:["expression","reference"]},{type:"literal",value:a}]},extraction:{duration:{position:1},source:{position:8}}}}function cd(){return [Ni("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),Ni("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 pd(){return [Et("wait-tr-or-run","tr","bekle","den","veya",1,["dan","ten","tan"]),Et("wait-tr-or-run-2arg","tr","bekle","den","veya",2,["dan","ten","tan"])]}function dd(){return [Et("wait-qu-or-run","qu","suyay","manta","utaq",1),Et("wait-qu-or-run-2arg","qu","suyay","manta","utaq",2)]}function md(i){switch(i){case "en":return ud();case "zh":return nd();case "he":return od();case "ar":return sd();case "bn":return cd();case "tl":return ld();case "tr":return pd();case "qu":return dd();default:return []}}var fd={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"}}}},yd={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"}}}},vd={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"]},{type:"literal",value:"times"}]},extraction:{loopType:{default:{type:"literal",value:"times"}}}},hd={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"}}}},Ed={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:["literal","expression","reference"]},{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"}}},gd={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"}}},kd={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}}},bd={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}}},wd={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}}},zd={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 Cd(){let i=[];i.push(...Wp("en")),i.push(...p0("en")),i.push(...L0("en")),i.push(...ad("en")),i.push(...md("en")),i.push(...Cp,...xp,...Pp,fd,yd,vd,hd,Ed,gd,kd,bd,wd,zd);let e=mp(tr);return i.push(...e),i}Xr("en",Sl,tr);Jr("en",Cd());function bt(i){let e=i.getAttribute("data-lang");if(e)return kt(e);let t=i.getAttribute("data-hyperscript-lang")??i.closest?.("[data-hyperscript-lang]")?.getAttribute("data-hyperscript-lang");if(t)return kt(t);let r=i.closest?.("[lang]")?.getAttribute("lang");if(r)return kt(r);let n=typeof document<"u"?document.documentElement?.lang:null;return n&&n!=="en"?kt(n):null}function kt(i){return i.split("-")[0].toLowerCase()}var ea={add:[["patient",""],["destination","to"]],append:[["patient",""],["destination","to"]],async:[],beep:[["patient",""]],behavior:[["patient",""]],bind:[["destination",""],["source","to"]],blur:[["patient",""]],break:[],breakpoint:[],call:[["patient",""]],clear:[["patient",""]],clone:[["patient",""],["destination","into"]],close:[["patient",""]],compound:[],continue:[],copy:[["patient",""]],decrement:[["patient",""],["quantity","by"]],default:[["destination",""],["patient","to"]],else:[],empty:[["patient",""]],eventsource:[],exit:[],fetch:[["source",""],["style","with"],["responseType","as"],["method","via"],["destination","on"]],focus:[["patient",""]],for:[["patient",""],["source","in"]],get:[["source",""],["destination","on"]],go:[["destination",""]],halt:[["patient",""]],hide:[["patient",""],["style","with"]],if:[["condition",""]],increment:[["patient",""],["quantity","by"]],init:[],install:[["patient",""],["destination","on"]],intercept:[],js:[["patient",""]],live:[],log:[["patient",""]],make:[["patient",""]],measure:[["patient",""],["source","of"]],morph:[["patient",""],["destination","to"],["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 Ad=new Set(["repeat","for","while","tell"]),xd=new Set(["js"]);function wt(i){switch(i.kind){case "event-handler":return Sd(i);case "compound":return Dd(i);default:return Td(i)}}function Sd(i){let e=["on"],t=i.roles.get("event");t&&e.push(t.type==="literal"?String(t.value):ot(t));let r=i.roles.get("source");if(r&&e.push("from",ot(r)),i.body&&i.body.length>0){let n=i.body.map(wt);e.push(n.join(" "));}return e.join(" ")}function Dd(i){let e=i.chainType==="async"?"async":i.chainType,t=i.statements.map(wt),r=t[0]??"";for(let n=1;n<t.length;n++){let a=i.statements[n-1],o=i.statements[n],s=a.kind==="command"&&Ad.has(a.action),u=a.kind==="command"&&a.action==="bind"&&o.kind==="command"&&o.action==="bind";a.kind==="command"&&xd.has(a.action)&&(r+=" end"),r+=(s||u?" ":` ${e} `)+t[n];}return r}function Td(i){let e=ea[i.action];if(e){let r=[i.action];for(let[n,a]of e){let o=i.roles.get(n);o&&((n==="destination"||n==="source")&&o.type==="reference"&&o.value==="me"||(a&&r.push(a),r.push(ot(o))));}return r.join(" ")}let t=[i.action];for(let[,r]of i.roles)t.push(ot(r));return t.join(" ")}function ot(i){switch(i.type){case "literal":return typeof i.value=="string"&&i.dataType==="string"?`"${i.value}"`:String(i.value);case "selector":return i.value;case "reference":return i.value;case "property-path":return Bd(i);case "expression":return i.raw;case "flag":return i.enabled?`+${i.name}`:`~${i.name}`}}function Bd(i){let e=ot(i.object),t=i.property;if(i.object.type==="reference")switch(i.object.value){case "me":return `my ${t}`;case "it":return `its ${t}`;case "you":return `your ${t}`}return `${e}'s ${t}`}var Pd={confidenceThreshold:.5,strategy:"semantic"};function Fd(i,e){return typeof i=="number"?i:i[e]??i["*"]??.5}var Rd=/^(on\s+(?:every\s+)?[\w-]+(?:\[.*?\])?(?:\.[\w-]+(?:\([^)]*\))?)*(?:\s+from\s+\S+)?(?:\s+queue\s+\w+)?\s+)/;function Od(i){let e=i.match(Rd);if(!e)return null;let t=e[1],r=i.slice(t.length);return r?{prefix:t,commands:r}:null}function ta(i){function e(n,a,o){try{return i.isLanguageRegistered(a)?i.translateSingle(n,a,o):null}catch{return null}}function t(n,a,o){try{let s=o(n,a);return s!==n?s:null}catch{return null}}function r(n,a,o){if(o.strategy==="semantic"||o.strategy==="auto"){let s=Fd(o.confidenceThreshold,a),u=e(n,a,s);if(u!==null)return u}if((o.strategy==="auto"||o.strategy==="i18n")&&o.i18nToEnglish){let s=t(n,a,o.i18nToEnglish);if(s!==null)return s}return null}return function(a,o,s={}){if(o==="en")return a;let u={...Pd,...s},l=r(a,o,u);if(l!==null)return l;let c=Od(a);if(c){let p=r(c.commands,o,u);if(p!==null)return c.prefix+p}return a}}var lr=ta({isLanguageRegistered:ei,translateSingle(i,e,t){let r=bi(i,e);return r.confidence<t||!r.node?null:wt(r.node)}});var cr=new WeakSet;function _d(i){return (i.config?.attributes??"_, script, data-script").split(",").map(t=>t.trim()).filter(Boolean)}function Nd(i,e){for(let t of e)if(i.hasAttribute(t))return t;return null}function ra(i,e){if(typeof i.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=_d(i),r=[...t.map(a=>`[${a}]`),'script[type="text/hyperscript"]'].join(", "),n=a=>{if(cr.has(a))return;if(a instanceof HTMLScriptElement&&a.type==="text/hyperscript"){let l=a.textContent??"";if(!l)return;let c=e(l,a);cr.add(a),c!=null&&c!==l&&(a.textContent=c);return}let o=Nd(a,t);if(!o)return;let s=a.getAttribute(o);if(!s)return;let u=e(s,a);cr.add(a),u!=null&&u!==s&&a.setAttribute(o,u);};i.addBeforeProcessHook(a=>{!a||typeof a.querySelectorAll!="function"||(typeof a.matches=="function"&&a.matches(r)&&n(a),a.querySelectorAll(r).forEach(n));});}function aa(i,e){if(typeof i.parse!="function")return true;try{let t=i.parse(e);return !t?.errors||t.errors.length===0}catch{return false}}var ia=new Set;function na(i,e,t){ia.has(i)||(ia.add(i),console.warn(`[hyperscript-i18n] Translation for lang="${i}" rendered hyperscript the host parser rejects \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 pr(i={}){return function(t){let r=t;ra(r,(n,a)=>{let o=Ld(a,i);if(!o||o==="en")return n;let s=lr(n,o,i);if(s!==n){if(i.validateWithHost!==false&&!aa(r,s))return i.debug?console.log(`[hyperscript-i18n] ${o}: host rejected "${s}" \u2014 keeping "${n}"`):na(o,n,s),n;i.debug&&console.log(`[hyperscript-i18n] ${o}: "${n}" \u2192 "${s}"`);}return s});}}function Ld(i,e){if(e.languageAttribute){let r=i.getAttribute(e.languageAttribute);if(r)return r.split("-")[0].toLowerCase()}let t=bt(i);return t||(e.defaultLanguage??null)}function oa(i,e,t={}){return e==="en"?i:lr(i,e,t)}Qr(i=>Ti(i));function sa(){typeof _hyperscript<"u"&&_hyperscript.use&&_hyperscript.use(pr());}var pf=["en"];sa();
7
+ exports.plugin=pr;exports.preprocess=oa;exports.resolveLanguage=bt;exports.supportedLanguages=pf;return exports;})({});