@lokascript/hyperscript-adapter 2.3.1 → 2.4.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 (39) hide show
  1. package/dist/hyperscript-i18n-ar.global.js +4 -4
  2. package/dist/hyperscript-i18n-bn.global.js +4 -4
  3. package/dist/hyperscript-i18n-de.global.js +4 -4
  4. package/dist/hyperscript-i18n-east-asian.global.js +4 -4
  5. package/dist/hyperscript-i18n-en.global.js +6 -6
  6. package/dist/hyperscript-i18n-es.global.js +4 -4
  7. package/dist/hyperscript-i18n-fr.global.js +4 -4
  8. package/dist/hyperscript-i18n-he.global.js +4 -4
  9. package/dist/hyperscript-i18n-hi.global.js +4 -4
  10. package/dist/hyperscript-i18n-id.global.js +4 -4
  11. package/dist/hyperscript-i18n-it.global.js +4 -4
  12. package/dist/hyperscript-i18n-ja.global.js +4 -4
  13. package/dist/hyperscript-i18n-ko.global.js +4 -4
  14. package/dist/hyperscript-i18n-ms.global.js +4 -4
  15. package/dist/hyperscript-i18n-pl.global.js +4 -4
  16. package/dist/hyperscript-i18n-pt.global.js +4 -4
  17. package/dist/hyperscript-i18n-qu.global.js +4 -4
  18. package/dist/hyperscript-i18n-ru.global.js +4 -4
  19. package/dist/hyperscript-i18n-slavic.global.js +4 -4
  20. package/dist/hyperscript-i18n-south-asian.global.js +4 -4
  21. package/dist/hyperscript-i18n-southeast-asian.global.js +4 -4
  22. package/dist/hyperscript-i18n-sw.global.js +4 -4
  23. package/dist/hyperscript-i18n-th.global.js +4 -4
  24. package/dist/hyperscript-i18n-tl.global.js +4 -4
  25. package/dist/hyperscript-i18n-tr.global.js +4 -4
  26. package/dist/hyperscript-i18n-uk.global.js +4 -4
  27. package/dist/hyperscript-i18n-vi.global.js +4 -4
  28. package/dist/hyperscript-i18n-western.global.js +4 -4
  29. package/dist/hyperscript-i18n-zh.global.js +4 -4
  30. package/dist/hyperscript-i18n.global.js +24 -35
  31. package/dist/hyperscript-i18n.global.js.map +1 -1
  32. package/dist/index.cjs +8 -14
  33. package/dist/index.cjs.map +1 -1
  34. package/dist/index.js +10 -16
  35. package/dist/index.js.map +1 -1
  36. package/package.json +2 -2
  37. package/src/generated/syntax-table.ts +12 -1
  38. package/src/preprocessor.ts +12 -22
  39. package/src/slim-preprocessor.ts +6 -24
@@ -1,6 +1,6 @@
1
- var HyperscriptI18n=(function(exports){'use strict';function _(n,e){return e?{type:"literal",value:n,dataType:e}:{type:"literal",value:n}}function ve(n,e){return e?{type:"selector",value:n,selectorKind:e}:{type:"selector",value:n}}function ae(n){return {type:"reference",value:n}}function he(n,e){return {type:"property-path",object:n,property:e}}var zt=class{constructor(n){this.namespace=n,this.enabled=this.checkEnabled();}checkEnabled(){if(typeof process<"u"&&process.env){let n=process.env.DEBUG||"";return n==="*"||n.includes("framework:*")||n.includes(`framework:${this.namespace}`)}return false}log(n,e,...t){if(!this.enabled)return;let r=`[framework:${this.namespace}]`,o=new Date().toISOString();switch(n){case "debug":console.debug(`${o} ${r} DEBUG:`,e,...t);break;case "info":console.info(`${o} ${r} INFO:`,e,...t);break;case "warn":console.warn(`${o} ${r} WARN:`,e,...t);break;case "error":console.error(`${o} ${r} ERROR:`,e,...t);break}}debug(n,...e){this.log("debug",n,...e);}info(n,...e){this.log("info",n,...e);}warn(n,...e){this.log("warn",n,...e);}error(n,...e){this.log("error",n,...e);}isEnabled(){return this.enabled}enable(){this.enabled=true;}disable(){this.enabled=false;}};function Wt(n){return new zt(n)}function q(n,e){return !e||e.length===0||e.includes(n)||e.includes("expression")?true:n==="property-path"?e.some(t=>["selector","reference","expression"].includes(t)):false}function jt(n,e){return n?.possessive?.keywords?.[e]}var Q=class V{constructor(){this.logger=Wt("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 o=e.mark(),i=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 l=[];for(let c=0;c<10;c++){let u=e.peek(c);if(u)l.push({type:u.type,value:u.value,kind:u.kind});else break}this.logger.debug("Input tokens (first 10):",l),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 a=this.matchTokenSequence(e,t.template.tokens,i);if(this.logger.debug("matchTokenSequence returned:",a),this.logger.debug("Captured roles:",Array.from(i.entries()).map(([l,c])=>[l,JSON.stringify(c)])),!a)return this.logger.debug(">>> MATCH FAILED - resetting token position"),e.reset(o),null;let s=this.calculateConfidence(t,i);return this.applyExtractionRules(t,i),{pattern:t,captured:i,consumedTokens:e.position()-o.position,confidence:s}}matchBest(e,t,r){let o=[];for(let a of t){let s=e.mark(),l=this.matchPattern(e,a,r);l&&o.push(l),e.reset(s);}if(o.length===0)return null;o.sort((a,s)=>{let l=s.pattern.priority-a.pattern.priority;if(l!==0)return l;let c=s.confidence-a.confidence;return Math.abs(c)>.001?c:s.consumedTokens-a.consumedTokens});let i=o[0];return this.matchPattern(e,i.pattern),i}matchTokenSequence(e,t,r,o){let i=t[0],a=i?.type==="literal"&&(i.value==="and"||i.value==="then"||i.alternatives?.includes("and")||i.alternatives?.includes("then"));if(this.currentProfile?.code==="ar"&&!a)for(;e.peek()?.kind==="conjunction";)e.advance();let s=null,l=null;for(let c=0;c<t.length;c++){let u=t[c];this.logger.debug(" >> Matching pattern token:",JSON.stringify(u,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"),u.type==="role"&&u.greedy){let g=this.collectStopMarkers(t,c+1);if(o)for(let T of o)g.add(T);let E=[];for(;!e.isAtEnd();){let T=e.peek();if(!T||this.isStopMarker(T,g))break;E.push(T.value),e.advance();}if(E.length>0){r.set(u.role,{type:"expression",raw:E.join(" ")}),s=null,l=null;continue}else {if(u.optional)continue;return false}}if(u.type==="group"){let g=this.collectStopMarkers(t,c+1);if(o)for(let T of o)g.add(T);if(this.matchGroupToken(e,u,r,g)){s=null,l=null;continue}if(this.isOptional(u))continue;return false}let d=u.type==="role"&&u.optional===true,m=d?e.mark():null;if(u.type==="role"&&!d){let g=c+1<t.length?t[c+1]:null;if(g?.type==="literal"){let E=e.peek();if(E&&this.getMatchType(E,g.value)!=="none"){if(this.logger.debug(" >> MARKER-STEAL GUARD: current token matches next literal, skipping role"),this.logger.debug(" >> Token match FAILED"),this.isOptional(u))continue;if(s&&l){this.logger.debug(" >> BACKTRACKING: undoing optional role",l),e.reset(s),r.delete(l),s=null,l=null;let T=this.matchPatternToken(e,u,r);if(this.logger.debug(" >> Backtrack retry result:",T),T)continue}return false}}}let y=this.matchPatternToken(e,u,r);if(this.logger.debug(" >> Match result:",y),y){d?(s=m,l=u.role):(s=null,l=null);continue}if(this.logger.debug(" >> Token match FAILED"),!this.isOptional(u)){if(s&&l){this.logger.debug(" >> BACKTRACKING: undoing optional role",l),e.reset(s),r.delete(l),s=null,l=null;let g=this.matchPatternToken(e,u,r);if(this.logger.debug(" >> Backtrack retry result:",g),g)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 o=this.getMatchType(r,t.value);if(this.logger.debug(" >>> matchType for",r.value,"vs",t.value,":",o),o!=="none")return this.totalKeywordMatches++,o==="stem"&&this.stemMatchCount++,e.advance(),true;if(t.alternatives)for(let i of t.alternatives){let a=this.getMatchType(r,i);if(a!=="none")return this.totalKeywordMatches++,a==="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 o=e.peek();if(this.logger.debug(" >>> After skipNoiseWords, current token:",o?JSON.stringify({value:o.value,kind:o.kind}):"null"),!o)return t.optional||false;let i=this.tryMatchPossessiveExpression(e);if(i)return t.expectedTypes&&t.expectedTypes.length>0&&!q(i.type,t.expectedTypes)?t.optional||false:(r.set(t.role,i),true);let a=this.tryMatchMethodCallExpression(e);if(a)return t.expectedTypes&&t.expectedTypes.length>0&&!q(a.type,t.expectedTypes)?t.optional||false:(r.set(t.role,a),true);let s=this.tryMatchPossessiveSelectorExpression(e);if(s)return t.expectedTypes&&t.expectedTypes.length>0&&!q(s.type,t.expectedTypes)?t.optional||false:(r.set(t.role,s),true);let l=this.tryMatchPropertyAccessExpression(e);if(l)return t.expectedTypes&&t.expectedTypes.length>0&&!q(l.type,t.expectedTypes)?t.optional||false:(r.set(t.role,l),true);let c=this.tryMatchSelectorPropertyExpression(e);if(c)return t.expectedTypes&&t.expectedTypes.length>0&&!q(c.type,t.expectedTypes)?t.optional||false:(r.set(t.role,c),true);this.logger.debug(" >>> Trying tokenToSemanticValue for token:",o?JSON.stringify({value:o.value,kind:o.kind}):"null");let u=this.tokenToSemanticValue(o);return this.logger.debug(" >>> tokenToSemanticValue returned:",u?JSON.stringify(u):"null"),u?(this.logger.debug(" >>> Validating type:",u.type,"against expected:",t.expectedTypes),t.expectedTypes&&t.expectedTypes.length>0&&!q(u.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,u),e.advance(),true)):t.optional||false}tryMatchPossessiveExpression(e){let t=e.peek();if(!t||!this.currentProfile)return null;let r=t.normalized||t.value,o=this.safeToLowerCase(r),i=jt(this.currentProfile,o);if(!i)return null;let a=e.mark();e.advance();let s=e.peek();if(!s)return e.reset(a),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 l=s.value;s.kind==="selector"&&l.startsWith(".")&&/^\.[a-zA-Z_]\w*/.test(l)&&(l=l.substring(1));let c=l;for(;e.peek()?.kind==="selector"&&e.peek().value.startsWith(".")&&/^\.[a-zA-Z_]\w*/.test(e.peek().value);)c+=e.peek().value,e.advance();let u=e.peek();return u?.kind==="literal"&&u.value.startsWith("(")&&(c+=u.value,e.advance()),he(ae(i),c)}return 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())}tryMatchMethodCallExpression(e){let t=e.peek();if(!t||t.kind!=="selector")return null;let r=e.mark();e.advance();let o=e.peek();if(!o||o.kind!=="operator"||o.value!==".")return e.reset(r),null;e.advance();let i=e.peek();if(!i||i.kind!=="identifier")return e.reset(r),null;e.advance();let a=e.peek();if(!a||a.kind!=="punctuation"||a.value!=="(")return e.reset(r),null;e.advance();let s=[];for(;!e.isAtEnd()&&s.length<V.MAX_METHOD_ARGS;){let c=e.peek();if(!c)break;if(c.kind==="punctuation"&&c.value===")"){e.advance();break}if(c.kind==="punctuation"&&c.value===","){e.advance();continue}s.push(c.value),e.advance();}return {type:"expression",raw:`${t.value}.${i.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 o=e.peek();if(!o||o.kind!=="operator"||o.value!==".")return e.reset(r),null;e.advance();let i=e.peek();if(!i||i.kind!=="identifier")return e.reset(r),null;e.advance();let a=`${t.value}.${i.value}`,s=1;for(;!e.isAtEnd()&&s<V.MAX_PROPERTY_DEPTH;){let c=e.peek();if(!c||c.kind!=="operator"||c.value!==".")break;e.advance();let u=e.peek();if(!u||u.kind!=="identifier")break;e.advance(),a+=`.${u.value}`,s++;}let l=e.peek();if(l&&l.kind==="punctuation"&&l.value==="("){e.advance();let c=[],u=0;for(;!e.isAtEnd()&&c.length<V.MAX_METHOD_ARGS;){let d=e.peek();if(!d)break;if(d.kind==="punctuation"&&d.value===")"){if(u===0){e.advance();break}u--;}if(d.kind==="punctuation"&&d.value==="("&&u++,d.kind==="punctuation"&&d.value===","){e.advance();continue}c.push(d.value),e.advance();}return {type:"expression",raw:`${a}(${c.join(", ")})`}}return {type:"expression",raw:a}}tryMatchPossessiveSelectorExpression(e){let t=e.peek();if(!t||t.kind!=="selector")return null;let r=e.mark();e.advance();let o=e.peek();if(!o||o.kind!=="punctuation"||o.value!=="'s")return e.reset(r),null;e.advance();let i=e.peek();return !i||i.kind!=="selector"&&i.kind!=="identifier"?(e.reset(r),null):(e.advance(),he(ve(t.value),i.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 o=e.peek();if(!o||o.kind!=="selector"||!o.value.startsWith("."))return e.reset(r),null;let i=e.peek(1);i&&i.kind,e.advance();let a=o.value.slice(1);return he(ve(t.value),a)}matchGroupToken(e,t,r,o){let i=e.mark(),a=new Set(r.keys());if(this.matchTokenSequence(e,t.tokens,r,o))return true;e.reset(i);for(let c of r.keys())a.has(c)||r.delete(c);if(!t.optional)return false;let l=this.getGroupLeadingMarker(t);if(l)for(let c=1;c<=V.MAX_MARKER_SCAN;c++){let u=e.peek(c);if(!u)break;if((u.normalized||u.value).toLowerCase()===l){this.logger.debug(" >> MARKER SCAN: found",l,"at offset",c,"- skipping intervening tokens");for(let m=0;m<c;m++)e.advance();if(this.matchTokenSequence(e,t.tokens,r,o))return true;e.reset(i);for(let m of r.keys())a.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 o=t;o<e.length;o++){let i=e[o];if(i.type==="literal"){if(r.add(i.value.toLowerCase()),i.alternatives)for(let a of i.alternatives)r.add(a.toLowerCase());break}if(i.type==="group"){for(let a of i.tokens)if(a.type==="literal"){if(r.add(a.value.toLowerCase()),a.alternatives)for(let s of a.alternatives)r.add(s.toLowerCase());break}if(!i.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 ve(e.value);case "literal":return this.parseLiteralValue(e.value);case "keyword":let t=e.normalized||e.value;this.safeToLowerCase(t);return _(e.normalized||e.value);case "identifier":if(typeof e.value=="string"&&e.value.startsWith(":"))return ae(e.value);this.safeToLowerCase(e.value);return {type:"expression",raw:e.value};case "url":return _(e.value,"string");default:return null}}parseLiteralValue(e){if(e.startsWith('"')||e.startsWith("'")||e.startsWith("`")||e.startsWith("\u300C")){let o=e.slice(1,-1);return _(o,"string")}if(e==="true")return _(true,"boolean");if(e==="false")return _(false,"boolean");let t=e.match(/^(\d+(?:\.\d+)?)(ms|s|m|h)?$/);if(t){let o=parseFloat(t[1]);return t[2]?_(e,"duration"):_(o,"number")}let r=parseFloat(e);return isNaN(r)?_(e,"string"):_(r,"number")}applyExtractionRules(e,t){for(let[r,o]of Object.entries(e.extraction))t.has(r)||(o.value!==void 0?t.set(r,{type:"literal",value:o.value}):o.default&&t.set(r,o.default));}isOptional(e){return e.type!=="literal"&&e.optional===true}calculateConfidence(e,t){let r=0,o=0,i=c=>e.extraction?.[c]?.default!==void 0;for(let c of e.template.tokens)if(c.type==="role")o+=1,t.has(c.role)&&(r+=1);else if(c.type==="group"){for(let u of c.tokens)if(u.type==="role"){let p=i(u.role),d=.8;o+=d,t.has(u.role)?r+=d:p&&(r+=d*.6);}}let a=o>0?r/o:1;if(this.stemMatchCount>0&&this.totalKeywordMatches>0){let c=this.stemMatchCount/this.totalKeywordMatches*.15;a=Math.max(.5,a-c);}let s=this.calculateVSOConfidenceBoost(e);a=Math.min(1,a+s);let l=this.arabicPrepositionDisambiguation(e,t);return a=Math.max(0,Math.min(1,a+l)),a}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 o of t.alternatives)if(r.has(o))return .15}return 0}arabicPrepositionDisambiguation(e,t){if(e.language!=="ar")return 0;let r=0,o={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[i,a]of t.entries()){let s=o[i];if(!s||s.length===0)continue;let l="metadata"in a?a.metadata:void 0;if(l&&typeof l.prepositionValue=="string"){let c=l.prepositionValue;s.includes(c)?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(V.ENGLISH_NOISE_WORDS.has(r)){let o=e.mark();e.advance();let i=e.peek();if(i&&i.kind==="selector")return;e.reset(o);}r==="class"&&e.advance();}extractEventModifiers(e){let t={},r=false;for(;!e.isAtEnd();){let o=e.peek();if(!o||o.kind!=="event-modifier")break;let i=o.metadata;if(!i)break;switch(r=true,i.modifierName){case "once":t.once=true;break;case "debounce":typeof i.value=="number"&&(t.debounce=i.value);break;case "throttle":typeof i.value=="number"&&(t.throttle=i.value);break;case "queue":(i.value==="first"||i.value==="last"||i.value==="all"||i.value==="none")&&(t.queue=i.value);break}e.advance();}return r?t:void 0}};Q.MAX_MARKER_SCAN=3;Q.MAX_PROPERTY_DEPTH=10;Q.MAX_METHOD_ARGS=20;Q.ENGLISH_NOISE_WORDS=new Set(["the","a","an"]);var Ut=Q;new Ut;var De=class{constructor(){this.name="string-literal";}canExtract(n,e){let t=n[e];return t==='"'||t==="'"||t==="`"||t==="\u201C"||t==="\u2018"}extract(n,e){let t=n[e];if(t==="\u201C"){let i=1;for(;e+i<n.length;){if(n[e+i]==="\u201D")return i++,{value:n.substring(e,e+i),length:i};i++;}return null}if(t==="\u2018"){let i=1;for(;e+i<n.length;){if(n[e+i]==="\u2019")return i++,{value:n.substring(e,e+i),length:i};i++;}return null}let r=1,o=false;for(;e+r<n.length;){let i=n[e+r];if(o){o=false,r++;continue}if(i==="\\"){o=true,r++;continue}if(i===t)return r++,{value:n.substring(e,e+r),length:r};r++;}return null}},$e=class{constructor(){this.name="number";}canExtract(n,e){return /\d/.test(n[e])}extract(n,e){let t=0,r=false;for(;e+t<n.length;){let a=n[e+t];if(/\d/.test(a))t++;else if(a==="."&&!r)r=true,t++;else break}if(t===0)return null;let o=n.substring(e,e+t),i=e+t;if(i<n.length){let a=n.slice(i),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 c of s)if(a.startsWith(c.pattern))return {value:o+c.suffix,length:t+c.pattern.length,metadata:{hasTimeUnit:true}};if(a.startsWith("ms"))return {value:o+"ms",length:t+2,metadata:{hasTimeUnit:true}};let l=[{pattern:"\u79D2",suffix:"s"},{pattern:"\u5206",suffix:"m"}];for(let c of l)if(a.startsWith(c.pattern))return {value:o+c.suffix,length:t+1,metadata:{hasTimeUnit:true}};if(/^[smh](?![a-zA-Z])/.test(a))return {value:o+a[0],length:t+1,metadata:{hasTimeUnit:true}}}return {value:o,length:t}}};function Ht(n){return "setContext"in n&&typeof n.setContext=="function"}function Gt(n){let e={language:n.language,direction:n.direction,lookupKeyword:n.lookupKeyword.bind(n),isKeyword:n.isKeyword.bind(n),isKeywordStart:n.isKeywordStart.bind(n)};return n.normalizer?{...e,normalizer:n.normalizer}:e}var Kt=new Set(["me","you","it","result","event","target","body"]);function Be(n,e=Kt){return e.has(n)}var X=class{constructor(n,e){this.pos=0,this.tokens=n,this.language=e;}peek(n=0){let e=this.pos+n;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(n){this.pos=n.position;}position(){return this.pos}remaining(){return this.tokens.slice(this.pos)}takeWhile(n){let e=[];for(;!this.isAtEnd()&&n(this.peek());)e.push(this.advance());return e}skipWhile(n){for(;!this.isAtEnd()&&n(this.peek());)this.advance();}};function b(n,e){return {start:n,end:e}}function S(n,e,t,r){if(typeof n=="object"){let{value:i,kind:a,position:s,normalized:l,stem:c,stemConfidence:u,metadata:p}=n;return {value:i,kind:a,position:s,...l!==void 0&&{normalized:l},...c!==void 0&&{stem:c},...u!==void 0&&{stemConfidence:u},...p!==void 0&&{metadata:p}}}let o=n;if(!e||!t)throw new Error("createToken requires kind and position parameters");if(typeof r=="string")return {value:o,kind:e,position:t,normalized:r};if(r){let{normalized:i,stem:a,stemConfidence:s,metadata:l}=r;return {value:o,kind:e,position:t,...i!==void 0&&{normalized:i},...a!==void 0&&{stem:a},...s!==void 0&&{stemConfidence:s},...l!==void 0&&{metadata:l}}}return {value:o,kind:e,position:t}}function Y(n){return /\s/.test(n)}function Qt(n){return n==="#"||n==="."||n==="["||n==="@"||n==="*"||n==="<"}function Xt(n){return n==='"'||n==="'"||n==="`"||n==="\u300C"||n==="\u300D"}function L(n){return /\d/.test(n)}function Jt(n){return /[a-zA-Z]/.test(n)}function A(n){return /[a-zA-Z0-9_-]/.test(n)}function Zt(n,e){if(e>=n.length)return null;let t=n[e];if(!Qt(t))return null;let r=e,o="";if(t==="#"||t==="."){for(o+=n[r++];r<n.length&&A(n[r]);)o+=n[r++];if(o.length<=1)return null;if(r<n.length&&n[r]==="."&&t==="#"){let a=r+1;for(;a<n.length&&A(n[a]);)a++;if(a<n.length&&n[a]==="(")return o}}else if(t==="["){let i=1,a=false,s=null,l=false;for(o+=n[r++];r<n.length&&i>0;){let c=n[r];o+=c,l?l=false:c==="\\"?l=true:a?c===s&&(a=false,s=null):c==='"'||c==="'"||c==="`"?(a=true,s=c):c==="["?i++:c==="]"&&i--,r++;}if(i!==0)return null}else if(t==="@"){for(o+=n[r++];r<n.length&&A(n[r]);)o+=n[r++];if(o.length<=1)return null}else if(t==="*"){for(o+=n[r++];r<n.length&&A(n[r]);)o+=n[r++];if(o.length<=1)return null}else if(t==="<"){if(o+=n[r++],r>=n.length||!Jt(n[r]))return null;for(;r<n.length&&A(n[r]);)o+=n[r++];for(;r<n.length;){let i=n[r];if(i==="."){if(o+=n[r++],r>=n.length||!A(n[r]))return null;for(;r<n.length&&A(n[r]);)o+=n[r++];}else if(i==="#"){if(o+=n[r++],r>=n.length||!A(n[r]))return null;for(;r<n.length&&A(n[r]);)o+=n[r++];}else if(i==="["){let a=1,s=false,l=null,c=false;for(o+=n[r++];r<n.length&&a>0;){let u=n[r];o+=u,c?c=false:u==="\\"?c=true:s?u===l&&(s=false,l=null):u==='"'||u==="'"||u==="`"?(s=true,l=u):u==="["?a++:u==="]"&&a--,r++;}if(a!==0)return null}else break}for(;r<n.length&&Y(n[r]);)o+=n[r++];if(r<n.length&&n[r]==="/")for(o+=n[r++];r<n.length&&Y(n[r]);)o+=n[r++];if(r>=n.length||n[r]!==">")return null;o+=n[r++];}return o||null}function er(n,e){if(e>=n.length||n[e]!=="'"||e+1>=n.length||n[e+1].toLowerCase()!=="s")return false;if(e+2>=n.length)return true;let r=n[e+2];return Y(r)||r==="*"||!A(r)}function tr(n,e){if(e>=n.length)return null;let t=n[e];if(!Xt(t)||t==="'"&&er(n,e))return null;let o={'"':'"',"'":"'","`":"`","\u300C":"\u300D"}[t];if(!o)return null;let i=e+1,a=t,s=false;for(;i<n.length;){let l=n[i];if(a+=l,s)s=false;else if(l==="\\")s=true;else if(l===o)return a;i++;}return a}function rr(n,e){if(e>=n.length)return false;let t=n[e],r=n[e+1]||"",o=n[e+2]||"";if(t==="/"&&r!=="/"&&/[a-zA-Z0-9._-]/.test(r)||t==="/"&&r==="/"&&/[a-zA-Z]/.test(o)||t==="."&&(r==="/"||r==="."&&o==="/"))return true;let i=n.slice(e,e+8).toLowerCase();return !!(i.startsWith("http://")||i.startsWith("https://"))}function nr(n,e){if(!rr(n,e))return null;let t=e,r="",o=/[a-zA-Z0-9/:._\-?&=%@+~!$'()*,;[\]]/;for(;t<n.length;){let i=n[t];if(i==="#"){if(r.length>0&&/[a-zA-Z0-9/.]$/.test(r))for(r+=i,t++;t<n.length&&/[a-zA-Z0-9_-]/.test(n[t]);)r+=n[t++];break}if(o.test(i))r+=i,t++;else break}return r.length<2?null:r}function or(n,e){if(e>=n.length)return null;let t=n[e];if(!L(t)&&t!=="-"&&t!=="+")return null;let r=e,o="";if((n[r]==="-"||n[r]==="+")&&(o+=n[r++]),r>=n.length||!L(n[r]))return null;for(;r<n.length&&L(n[r]);)o+=n[r++];if(r<n.length&&n[r]===".")for(o+=n[r++];r<n.length&&L(n[r]);)o+=n[r++];return r<n.length&&(n.slice(r,r+2)==="ms"?o+="ms":(n[r]==="s"||n[r]==="m"||n[r]==="h")&&(o+=n[r])),o}var ir=["===","!==","->","==","!=","<=",">=","&&","||","**","+=","-=","*=","/=","+","-","*","/","=",">","<","!","&","|","%","^","~"];new Set(ir);var Ve=class Fe{constructor(){this.profileKeywords=[],this.profileKeywordMap=new Map,this.extractors=[];}tokenize(e){if(this.isUsingExtractors())return this.tokenizeWithExtractors(e);throw new Error(`${this.constructor.name}: tokenize() not implemented and no extractors registered. Either register extractors or override tokenize() method.`)}registerExtractor(e){Ht(e)&&e.setContext(Gt(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&&Y(e[r]);)r++;if(r>=e.length)break;let o=false;for(let i of this.extractors)if(i.canExtract(e,r)){let a=i.extract(e,r);if(a){let s=a.metadata?.normalized,l=a.metadata?.stem,c=a.metadata?.stemConfidence,u={};if(a.metadata)for(let[d,m]of Object.entries(a.metadata))d!=="normalized"&&d!=="stem"&&d!=="stemConfidence"&&(u[d]=m);let p={};s&&(p.normalized=s),l&&(p.stem=l),c!==void 0&&(p.stemConfidence=c),Object.keys(u).length>0&&(p.metadata=u),t.push(S(a.value,this.classifyToken(a.value),b(r,r+a.length),Object.keys(p).length>0?p:void 0)),r+=a.length,o=true;break}}if(!o){let i=e[r],a=this.classifyUnknownChar(i);t.push(S(i,a,b(r,r+1))),r++;}}return new X(t,this.language)}classifyUnknownChar(e){return "()[]{},:;".includes(e)?"punctuation":"+-*/<>=!&|".includes(e)?"operator":"identifier"}tryPropertyAccess(e,t,r){if(e[t]!==".")return false;let o=r[r.length-1],i=o&&o.position.end<t;if(o&&!i&&(o.kind==="identifier"||o.kind==="keyword"||o.kind==="selector"))return r.push(S(".","operator",b(t,t+1))),true;let l=t+1;for(;l<e.length&&A(e[l]);)l++;return l<e.length&&e[l]==="("?(r.push(S(".","operator",b(t,t+1))),true):false}initializeKeywordsFromProfile(e,t=[]){let r=new Map;if(e.keywords){for(let[o,i]of Object.entries(e.keywords))if(r.set(i.primary,{native:i.primary,normalized:i.normalized||o}),i.alternatives)for(let a of i.alternatives)r.set(a,{native:a,normalized:i.normalized||o});}if(e.references){for(let[o,i]of Object.entries(e.references))r.set(i,{native:i,normalized:o});for(let o of Object.keys(e.references))r.has(o)||r.set(o,{native:o,normalized:o});}if(e.roleMarkers){for(let[o,i]of Object.entries(e.roleMarkers))if(i.primary&&r.set(i.primary,{native:i.primary,normalized:o}),i.alternatives)for(let a of i.alternatives)r.set(a,{native:a,normalized:o});}if(e.possessive?.keywords)for(let[o,i]of Object.entries(e.possessive.keywords))r.set(o,{native:o,normalized:i});for(let o of t)r.set(o.native,o);this.profileKeywords=Array.from(r.values()).sort((o,i)=>i.native.length-o.native.length),this.profileKeywordMap=new Map;for(let o of this.profileKeywords){this.profileKeywordMap.set(o.native.toLowerCase(),o);let i=this.removeDiacritics(o.native);i!==o.native&&!this.profileKeywordMap.has(i.toLowerCase())&&this.profileKeywordMap.set(i.toLowerCase(),o);}}removeDiacritics(e){return e.replace(/[\u064B-\u0652\u0670]/g,"")}tryProfileKeyword(e,t){for(let r of this.profileKeywords)if(e.slice(t).startsWith(r.native))return S(r.native,"keyword",b(t,t+r.native.length),r.normalized);return null}isKeywordStart(e,t){let r=e.slice(t);return this.profileKeywords.some(o=>r.startsWith(o.native))}lookupKeyword(e){return this.profileKeywordMap.get(e.toLowerCase())}isKeyword(e){return this.profileKeywordMap.has(e.toLowerCase())}setNormalizer(e){this.normalizer=e;}tryNormalize(e){if(!this.normalizer)return null;let t=this.normalizer.normalize(e);return t.stem!==e&&t.confidence>=.7?t:null}tryMorphKeywordMatch(e,t,r){let o=this.tryNormalize(e);if(!o)return null;let i=this.lookupKeyword(o.stem);if(!i)return null;let a={normalized:i.normalized,stem:o.stem,stemConfidence:o.confidence};return S(e,"keyword",b(t,r),a)}trySelector(e,t){let r=Zt(e,t);return r?S(r,"selector",b(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 o=r[0].replace(/(\s|\.)$/,""),i=o.slice(1).split("(")[0],a=r[1];return {...S(o,"event-modifier",b(t,t+o.length)),metadata:{modifierName:i,value:a?i==="queue"?a:parseInt(a,10):void 0}}}tryString(e,t){let r=tr(e,t);return r?S(r,"literal",b(t,t+r.length)):null}tryNumber(e,t){let r=or(e,t);return r?S(r,"literal",b(t,t+r.length)):null}tryMatchTimeUnit(e,t,r,o=false){let i=t;if(o)for(;i<e.length&&Y(e[i]);)i++;let a=e.slice(i);for(let s of r){let l=a.slice(0,s.length);if(s.caseInsensitive?l.toLowerCase()===s.pattern.toLowerCase():l===s.pattern){if(s.notFollowedBy&&(a[s.length]||"")===s.notFollowedBy)continue;if(s.checkBoundary){let u=a[s.length]||"";if(A(u))continue}return {suffix:s.suffix,endPos:i+s.length}}}return null}parseBaseNumber(e,t,r=true){let o=t,i="";if(r&&(e[o]==="-"||e[o]==="+")&&(i+=e[o++]),o>=e.length||!L(e[o]))return null;for(;o<e.length&&L(e[o]);)i+=e[o++];if(o<e.length&&e[o]===".")for(i+=e[o++];o<e.length&&L(e[o]);)i+=e[o++];return !i||i==="-"||i==="+"?null:{number:i,endPos:o}}tryNumberWithTimeUnits(e,t,r,o={}){let{allowSign:i=true,skipWhitespace:a=false}=o,s=this.parseBaseNumber(e,t,i);if(!s)return null;let{number:l,endPos:c}=s,u=[...r,...Fe.STANDARD_TIME_UNITS],p=this.tryMatchTimeUnit(e,c,u,a);return p&&(l+=p.suffix,c=p.endPos),S(l,"literal",b(t,c))}tryUrl(e,t){let r=nr(e,t);return r?S(r,"url",b(t,t+r.length)):null}tryVariableRef(e,t){if(e[t]!==":"||t+1>=e.length||!A(e[t+1]))return null;let r=t+1;for(;r<e.length&&A(e[r]);)r++;let o=e.slice(t,r);return S(o,"identifier",b(t,r))}tryOperator(e,t){let r=e.slice(t,t+2);if(["==","!=","<=",">=","&&","||","->"].includes(r))return S(r,"operator",b(t,t+2));let o=e[t];return ["<",">","!","+","-","*","/","="].includes(o)?S(o,"operator",b(t,t+1)):["(",")","{","}",",",";",":"].includes(o)?S(o,"punctuation",b(t,t+1)):null}tryMultiCharParticle(e,t,r){for(let o of r)if(e.slice(t,t+o.length)===o)return S(o,"particle",b(t,t+o.length));return null}};Ve.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 ze=Ve;var ar=Object.defineProperty,sr=Object.getOwnPropertyNames,He=(n,e)=>function(){return n&&(e=(0, n[sr(n)[0]])(n=0)),e},lr=(n,e)=>{for(var t in e)ar(n,t,{get:e[t],enumerable:true});};function We(n,e){return n.replace(/\{(\w+)\}/g,(t,r)=>String(e[r]??`{${r}}`))}function C(n,e,t={},r){let o=Ge[n],i=We(o,t),a=Ke[n],s=a?We(a,t):void 0;return {code:n,message:i,severity:e,...r&&{role:r},...s&&{suggestion:s}}}var v,Ge,Ke,ur=He({"src/generators/schema-error-codes.ts"(){v={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"},Ge={[v.AMBIGUOUS_TYPE_LITERAL_SELECTOR]:"Role '{role}' accepts both 'literal' and 'selector'. This may cause ambiguous type inference for values starting with special characters (* . # etc.).",[v.TOO_MANY_EXPECTED_TYPES]:"Role '{role}' accepts {count} different types. This may make type inference unreliable.",[v.MULTI_TYPE_PATIENT_EXPECTED]:"Role '{role}' accepts multiple types (expected for {command} command).",[v.NO_REQUIRED_ROLES]:"Command has no required roles. Is this intentional?",[v.NO_REQUIRED_ROLES_EXPECTED]:"Command has no required roles (expected for {command}).",[v.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.",[v.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.",[v.EVENT_HANDLER_MISSING_EVENT]:"Event handler command should have an 'event' role to specify which event to listen for.",[v.EVENT_HANDLER_EVENT_NOT_REQUIRED]:"Event role should be required - every event handler needs an event to listen for.",[v.CONDITIONAL_MISSING_CONDITION]:"Conditional command should have a 'condition' role for the boolean expression.",[v.CONDITIONAL_CONDITION_NOT_REQUIRED]:"Condition role should be required - conditionals need a condition to evaluate.",[v.FOR_LOOP_MISSING_SOURCE]:"For-loop should have a 'source' role for the collection to iterate over.",[v.WHILE_LOOP_MISSING_CONDITION]:"While-loop should have a 'condition' role for the loop condition.",[v.VALUE_TYPE_MISMATCH]:"Role '{role}' of command '{command}' expects type [{expectedTypes}], got '{actualType}'.",[v.SELECTOR_KIND_MISMATCH]:"Role '{role}' of command '{command}' expects selector kind [{selectorKinds}], got '{actualKind}'.",[v.SELECTOR_KINDS_WITHOUT_SELECTOR_TYPE]:"Role '{role}' has selectorKinds but expectedTypes does not include 'selector'.",[v.KEYWORD_COLLISION]:"Keyword '{keyword}' is used by multiple commands: {commands}. Only the first-registered command will be reachable."},Ke={[v.AMBIGUOUS_TYPE_LITERAL_SELECTOR]:"Consider being more specific about which type is expected, or use explicit type markers.",[v.TOO_MANY_EXPECTED_TYPES]:"Consider narrowing the accepted types to improve type inference reliability.",[v.TRANSITION_PATIENT_ACCEPTS_SELECTOR]:"Remove 'selector' from expectedTypes and only accept 'literal'.",[v.TRANSITION_MISSING_GOAL]:"Add a 'goal' role with expectedTypes ['literal', 'variable'].",[v.EVENT_HANDLER_MISSING_EVENT]:"Add an 'event' role with expectedTypes ['literal'].",[v.EVENT_HANDLER_EVENT_NOT_REQUIRED]:"Set required: true on the 'event' role.",[v.CONDITIONAL_MISSING_CONDITION]:"Add a 'condition' role with expectedTypes ['expression'].",[v.CONDITIONAL_CONDITION_NOT_REQUIRED]:"Set required: true on the 'condition' role.",[v.FOR_LOOP_MISSING_SOURCE]:"Add a 'source' role for the collection to iterate over.",[v.WHILE_LOOP_MISSING_CONDITION]:"Add a 'condition' role for the loop continuation condition.",[v.VALUE_TYPE_MISMATCH]:"Ensure the value matches one of the expected types: [{expectedTypes}].",[v.SELECTOR_KIND_MISMATCH]:"Use a selector of the correct kind: [{selectorKinds}].",[v.SELECTOR_KINDS_WITHOUT_SELECTOR_TYPE]:"Either add 'selector' to expectedTypes or remove selectorKinds.",[v.KEYWORD_COLLISION]:"Give each command a unique keyword. Move the shared keyword to alternatives on one command, or use a more specific translation."};}}),Ye={};lr(Ye,{SchemaErrorCodes:()=>v,formatValidationResults:()=>hr,getValidationStats:()=>yr,validateAllKeywordCollisions:()=>Er,validateAllSchemas:()=>vr,validateCommandSchema:()=>Qe,validateKeywordCollisions:()=>Xe,validateRoleValues:()=>gr});function cr(n,e){return {action:n,items:e,get notes(){return e.filter(t=>t.severity==="note").map(t=>t.message)},get warnings(){return e.filter(t=>t.severity==="warning").map(t=>t.message)},get errors(){return e.filter(t=>t.severity==="error").map(t=>t.message)}}}function Qe(n){let e=[];for(let r of n.roles)r.expectedTypes.includes("literal")&&r.expectedTypes.includes("selector")&&(r.role==="patient"&&ge.has(n.action)?e.push(C(v.MULTI_TYPE_PATIENT_EXPECTED,"note",{role:r.role,command:n.action},r.role)):e.push(C(v.AMBIGUOUS_TYPE_LITERAL_SELECTOR,"warning",{role:r.role},r.role))),r.expectedTypes.length>3&&!ge.has(n.action)&&e.push(C(v.TOO_MANY_EXPECTED_TYPES,"warning",{role:r.role,count:r.expectedTypes.length},r.role));for(let r of n.roles)r.selectorKinds&&r.selectorKinds.length>0&&(r.expectedTypes.includes("selector")||e.push(C(v.SELECTOR_KINDS_WITHOUT_SELECTOR_TYPE,"warning",{role:r.role},r.role)));switch(n.action){case "transition":pr(n,e);break;case "on":dr(n,e);break;case "if":case "unless":mr(n,e);break;case "repeat":case "for":case "while":fr(n,e);break}return n.roles.filter(r=>r.required).length===0&&(Je.has(n.action)?e.push(C(v.NO_REQUIRED_ROLES_EXPECTED,"note",{command:n.action})):e.push(C(v.NO_REQUIRED_ROLES,"warning",{}))),cr(n.action,e)}function pr(n,e){let t=n.roles.find(o=>o.role==="patient"),r=n.roles.find(o=>o.role==="goal");t&&t.expectedTypes.includes("selector")&&e.push(C(v.TRANSITION_PATIENT_ACCEPTS_SELECTOR,"warning",{},"patient")),t&&!r&&e.push(C(v.TRANSITION_MISSING_GOAL,"error",{}));}function dr(n,e){let t=n.roles.find(r=>r.role==="event");t||e.push(C(v.EVENT_HANDLER_MISSING_EVENT,"warning",{})),t&&!t.required&&e.push(C(v.EVENT_HANDLER_EVENT_NOT_REQUIRED,"warning",{}));}function mr(n,e){let t=n.roles.find(r=>r.role==="condition");t||e.push(C(v.CONDITIONAL_MISSING_CONDITION,"warning",{})),t&&!t.required&&e.push(C(v.CONDITIONAL_CONDITION_NOT_REQUIRED,"warning",{}));}function fr(n,e){n.action==="for"?n.roles.find(r=>r.role==="source")||e.push(C(v.FOR_LOOP_MISSING_SOURCE,"warning",{})):n.action==="while"&&(n.roles.find(r=>r.role==="condition")||e.push(C(v.WHILE_LOOP_MISSING_CONDITION,"warning",{})));}function vr(n,e={}){let t=new Map,{includeNotes:r=false}=e;for(let[o,i]of Object.entries(n)){let a=Qe(i),s=a.items.some(c=>c.severity==="warning"||c.severity==="error"),l=r&&a.items.some(c=>c.severity==="note");(s||l)&&t.set(o,a);}return t}function hr(n,e={}){let t=[],{showNotes:r=false,showCodes:o=true}=e;for(let[i,a]of n){let s=a.items.filter(u=>u.severity==="error"),l=a.items.filter(u=>u.severity==="warning"),c=a.items.filter(u=>u.severity==="note");if(s.length>0){t.push(` \u274C ${i}:`);for(let u of s){let p=o?` [${u.code}]`:"";t.push(` ERROR${p}: ${u.message}`),u.suggestion&&t.push(` \u{1F4A1} Suggestion: ${u.suggestion}`);}}if(l.length>0){t.push(` \u26A0\uFE0F ${i}:`);for(let u of l){let p=o?` [${u.code}]`:"";t.push(` ${p?`${u.code}: `:""}${u.message}`),u.suggestion&&t.push(` \u{1F4A1} ${u.suggestion}`);}}if(r&&c.length>0){t.push(` \u2139\uFE0F ${i}:`);for(let u of c){let p=o?` [${u.code}]`:"";t.push(` ${p?`${u.code}: `:""}${u.message}`);}}}return t.join(`
2
- `)}function yr(n){let e=0,t=0,r=0,o={};for(let i of n.values())for(let a of i.items)a.severity==="error"?e++:a.severity==="warning"?t++:a.severity==="note"&&r++,o[a.code]=(o[a.code]||0)+1;return {totalCommands:n.size,errors:e,warnings:t,notes:r,byCode:o}}function gr(n,e){let t=[];for(let r of e){let o=n.roles.find(i=>i.role===r.role);o&&(o.expectedTypes.length>0&&!o.expectedTypes.includes(r.type)&&(o.expectedTypes.includes("expression")||t.push({level:"error",role:r.role,message:`${n.action}.${r.role} expects type [${o.expectedTypes.join(", ")}], got '${r.type}'`,code:v.VALUE_TYPE_MISMATCH})),r.type==="selector"&&r.selectorKind&&o.selectorKinds&&o.selectorKinds.length>0&&(o.selectorKinds.includes(r.selectorKind)||t.push({level:"error",role:r.role,message:`${n.action}.${r.role} expects selector kind [${o.selectorKinds.join(", ")}], got '${r.selectorKind}'`,code:v.SELECTOR_KIND_MISMATCH})));}return t}function Xe(n){let e=[];if(!n.keywords)return {language:n.code,collisions:e};let t=new Map;for(let[o,i]of Object.entries(n.keywords)){if(!i||!i.primary)continue;let a=t.get(i.primary)||[];if(a.push({command:o,isPrimary:true}),t.set(i.primary,a),i.alternatives)for(let s of i.alternatives){let l=t.get(s)||[];l.push({command:o,isPrimary:false}),t.set(s,l);}}for(let[o,i]of t){let a=[...new Set(i.map(c=>c.command))];if(a.length<=1)continue;let s=i.filter(c=>c.isPrimary).length,l;s>=2?l="primary-primary":s===1?l="primary-alternative":l="alternative-alternative",e.push({keyword:o,commands:a.sort(),type:l});}let r={"primary-primary":0,"primary-alternative":1,"alternative-alternative":2};return e.sort((o,i)=>r[o.type]-r[i.type]),{language:n.code,collisions:e}}function Er(n){let e=[];for(let[,t]of Object.entries(n)){let r=Xe(t);r.collisions.length>0&&e.push(r);}return e.sort((t,r)=>t.language.localeCompare(r.language))}var ge,Je,kr=He({"src/generators/schema-validator.ts"(){ur(),ge=new Set(["put","append","prepend","log","throw","make","measure","return","swap","morph","beep","copy"]),Je=new Set(["compound","else","halt","continue","async","init","settle","focus","blur","return","js","measure","break","exit","beep"]);}}),Tr=new Map,br=new Map,Ze=new Map;function Sr(n,e,t){Tr.set(n,e),br.set(n,t),Ze.delete(n);}var xr=new Map;function wr(n,e){xr.set(n,e),Ze.delete(n);}var Ee={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"},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"},go:{primary:"go"},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"}}},Ar=["===","!==","->","==","!=","<=",">=","&&","||","**","+=","-=","*=","/=","+","-","*","/","=",">","<","!","&","|","%","^","~"],Cr=class{constructor(n=Ar){this.name="operator",this.operators=[...n].sort((e,t)=>t.length-e.length);}canExtract(n,e){return this.operators.some(t=>n.startsWith(t,e))}extract(n,e){for(let t of this.operators)if(n.startsWith(t,e))return {value:t,length:t.length};return null}},Pr="()[]{},:;",Rr=class{constructor(n=Pr){this.punctuation=n,this.name="punctuation";}canExtract(n,e){return this.punctuation.includes(n[e])}extract(n,e){let t=n[e];return this.punctuation.includes(t)?{value:t,length:1}:null}};function Or(n,e){let t=n[e];if(t==="#"){let r=n.slice(e).match(/^#[a-zA-Z_][\w-]*/);return r?r[0]:null}if(t==="."){let r=n.slice(e).match(/^\.[a-zA-Z_][\w-]*/);return r?r[0]:null}if(t==="["){let r=0,o=e;for(;o<n.length;){if(n[o]==="["&&r++,n[o]==="]"&&(r--,r===0))return n.slice(e,o+1);o++;}return null}if(t==="<"){let r=n.slice(e).match(/^<[\w-]+(?:[#.][\w-]+|\[[^\]]+\])*\s*\/>/);return r?r[0]:null}return null}var _r=class{constructor(){this.name="css-selector";}canExtract(n,e){let t=n[e];return t==="#"||t==="."||t==="["||t==="<"}extract(n,e){let t=Or(n,e);return t?{value:t,length:t.length,metadata:{type:"css-selector"}}:null}},Nr=class{constructor(){this.name="event-modifier";}canExtract(n,e){if(n[e]!==".")return false;let t=n.slice(e);return /^\.(once|prevent|stop|debounce|throttle|queue)/.test(t)}extract(n,e){let t=n.slice(e).match(/^\.(?:once|prevent|stop|debounce|throttle|queue)(?:\(([^)]+)\))?/);if(!t)return null;let r=t[0],o=r.slice(1).split("(")[0],i=t[1];return {value:r,length:r.length,metadata:{modifierName:o,value:i?o==="queue"?i:parseInt(i,10):void 0}}}};function Ir(n,e){let t=n.slice(e);if(t.startsWith("http://")||t.startsWith("https://")){let r=t.match(/^https?:\/\/[^\s]*/);return r?r[0]:null}if(t.startsWith("//")){let r=t.match(/^\/\/[^\s]*/);return r?r[0]:null}if(t.startsWith("./")||t.startsWith("../")){let r=t.match(/^\.\.?\/[^\s]*/);return r?r[0]:null}if(t.startsWith("/")){let r=t.match(/^\/[^\s]*/);return r?r[0]:null}return null}var Mr=class{constructor(){this.name="url";}canExtract(n,e){let t=n.slice(e);return t.startsWith("http://")||t.startsWith("https://")||t.startsWith("//")||t.startsWith("./")||t.startsWith("../")||t.startsWith("/")}extract(n,e){let t=Ir(n,e);return t?{value:t,length:t.length,metadata:{type:"url"}}:null}},Lr=class{constructor(){this.name="variable-ref";}canExtract(n,e){return n[e]===":"&&e+1<n.length&&/[a-zA-Z_]/.test(n[e+1])}extract(n,e){if(!this.canExtract(n,e))return null;let t=1;for(;e+t<n.length&&/[a-zA-Z0-9_]/.test(n[e+t]);)t++;return {value:n.substring(e,e+t),length:t,metadata:{type:"variable-reference"}}}};function Dr(){return [new Mr,new Nr,new Lr,new _r]}function ye(n){return /[a-zA-Z0-9_]/.test(n)}var $r=class{constructor(){this.name="english-keyword";}setContext(n){this.context=n;}canExtract(n,e){return /[a-zA-Z_]/.test(n[e])}extract(n,e){if(!this.context)throw new Error("EnglishKeywordExtractor: context not set");let t=e,r="";for(;t<n.length&&ye(n[t]);)r+=n[t++];if(!r)return null;if(t<n.length&&n[t]===":"){let s=t;t++;let l="";for(;t<n.length&&ye(n[t]);)l+=n[t++];l?r=r+":"+l:t=s;}let o=this.context.lookupKeyword(r),i=o&&o.normalized!==o.native?o.normalized:void 0,a=null;return this.context.isKeyword(r)||(a=this.tryClassSyntaxConversion(n,t,r)),{value:a||r,length:t-e,metadata:{normalized:i,classConversion:a?true:void 0}}}tryClassSyntaxConversion(n,e,t){let r=e;for(;r<n.length&&/\s/.test(n[r]);)r++;if(n.slice(r,r+5).toLowerCase()==="class"){let o=r+5;if(o>=n.length||!ye(n[o]))return "."+t}return null}};function Br(){return [new $r]}var qr=[{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"}],Vr=class extends ze{constructor(){super(),this.language="en",this.direction="ltr",this.initializeKeywordsFromProfile(Ee,qr),this.registerExtractors(Dr()),this.registerExtractor(new De),this.registerExtractor(new $e),this.registerExtractors(Br()),this.registerExtractor(new Cr),this.registerExtractor(new Rr);}classifyToken(n){return this.isKeyword(n)?"keyword":n.startsWith("/")||n.startsWith("./")||n.startsWith("../")||n.startsWith("http")?"url":/^\.(once|prevent|stop|debounce|throttle|queue)(\(.*\))?$/.test(n)?"event-modifier":n.startsWith("#")||n.startsWith(".")||n.startsWith("[")||n.startsWith("*")||n.startsWith("<")?"selector":n.startsWith('"')||n.startsWith("'")||/^\d/.test(n)?"literal":["==","!=","<=",">=","<",">","&&","||","!"].includes(n)?"operator":"identifier"}},Fr=new Vr,zr={action:"toggle",description:"Toggle a class or attribute on/off",category:"dom-class",primaryRole:"patient",roles:[{role:"patient",description:"The class or attribute to toggle",required:true,expectedTypes:["selector"],selectorKinds:["class","attribute"],svoPosition:1,sovPosition:2},{role:"destination",description:"The target element (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:2,sovPosition:1}],errorCodes:["MISSING_ARGUMENT","NO_VALID_CLASS_NAMES","INVALID_CSS_PROPERTY"],preconditions:[{condition:"Command has at least one argument",errorCode:"MISSING_ARGUMENT",message:"toggle command requires an argument"},{condition:"Class names are valid CSS identifiers",errorCode:"NO_VALID_CLASS_NAMES",message:"toggle command: no valid class names found"}],recoveryHints:{MISSING_ARGUMENT:"Add a class selector (.classname) or attribute to toggle",NO_VALID_CLASS_NAMES:"Ensure class names start with a dot (.) and are valid CSS identifiers",INVALID_CSS_PROPERTY:"Check CSS property name syntax (use kebab-case)"}},Wr={action:"add",description:"Add a class or attribute to an element",category:"dom-class",primaryRole:"patient",roles:[{role:"patient",description:"The class or attribute to add",required:true,expectedTypes:["selector"],svoPosition:1,sovPosition:2},{role:"destination",description:"The target element (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:2,sovPosition:1,markerOverride:{en:"to"}}],errorCodes:["MISSING_ARGUMENT","NO_VALID_CLASS_NAMES","PROPERTY_REQUIRES_VALUE"],preconditions:[{condition:"Command has at least one argument",errorCode:"MISSING_ARGUMENT",message:"add command requires an argument"}],recoveryHints:{MISSING_ARGUMENT:"Add a class selector (.classname) or attribute to add",NO_VALID_CLASS_NAMES:"Ensure class names start with a dot (.) and are valid CSS identifiers",PROPERTY_REQUIRES_VALUE:"When adding a property (*prop), provide a value argument"}},jr={action:"remove",description:"Remove a class or attribute from an element",category:"dom-class",primaryRole:"patient",roles:[{role:"patient",description:"The class or attribute to remove",required:true,expectedTypes:["selector"],svoPosition:1,sovPosition:2},{role:"source",description:"The element to remove from (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:2,sovPosition:1}],errorCodes:["MISSING_ARGUMENT","NO_VALID_CLASS_NAMES"],preconditions:[{condition:"Command has at least one argument",errorCode:"MISSING_ARGUMENT",message:"remove command requires an argument"}],recoveryHints:{MISSING_ARGUMENT:"Add a class selector (.classname) or attribute to remove",NO_VALID_CLASS_NAMES:"Ensure class names start with a dot (.) and are valid CSS identifiers"}},Ur={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"}}],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"}},Hr={action:"set",description:"Set a property or variable to a value",category:"variable",primaryRole:"destination",roles:[{role:"destination",description:"The property or variable to set",required:true,expectedTypes:["selector","reference","expression"],svoPosition:1,sovPosition:1,markerOverride:{en:"",ja:"\u3092",ko:"\uB97C",tr:"i",ar:"",sw:"",tl:"",bn:"\u0995\u09C7",qu:"ta"}},{role:"patient",description:"The value to set",required:true,expectedTypes:["literal","expression","reference"],svoPosition:2,sovPosition:2,markerOverride:{en:"to",es:"a",pt:"para",fr:"\xE0",de:"auf",id:"ke",ja:"\u306B",ko:"\uC73C\uB85C",tr:"e",ar:"\u0625\u0644\u0649",sw:"kwenye",tl:"sa",bn:"\u09A4\u09C7",qu:"man"}}],errorCodes:["MISSING_TARGET","INVALID_TARGET","MISSING_VALUE","INVALID_SYNTAX"],preconditions:[{condition:"Command has a target variable or property",errorCode:"MISSING_TARGET",message:"set command requires a target"},{condition:"Target is a valid variable or property reference",errorCode:"INVALID_TARGET",message:"set command target must be a string or object literal"},{condition:'Value is specified with "to" keyword',errorCode:"MISSING_VALUE",message:'set command requires a value (use "to" keyword)'}],recoveryHints:{MISSING_TARGET:"Add a target: set :variable to value OR set element.property to value",INVALID_TARGET:'Use local variable (:name), element property (el.prop), or "the X of Y" syntax',MISSING_VALUE:'Add "to <value>" to specify what to set',INVALID_SYNTAX:"Use syntax: set <target> to <value>"}},Gr={action:"show",description:"Make an element visible",category:"dom-visibility",primaryRole:"patient",roles:[{role:"patient",description:"The element to show",required:true,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:1,sovPosition:1},{role:"style",description:"Animation style (fade, slide, etc.)",required:false,expectedTypes:["literal"],svoPosition:2,sovPosition:2}]},Kr={action:"hide",description:"Make an element invisible",category:"dom-visibility",primaryRole:"patient",roles:[{role:"patient",description:"The element to hide",required:true,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:1,sovPosition:1},{role:"style",description:"Animation style (fade, slide, etc.)",required:false,expectedTypes:["literal"],svoPosition:2,sovPosition:2}]},Yr={action:"on",description:"Handle an event",category:"event",primaryRole:"event",hasBody:true,roles:[{role:"event",description:"The event to handle",required:true,expectedTypes:["literal"],svoPosition:1,sovPosition:2},{role:"source",description:"The element to listen on (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:2,sovPosition:1}]},Qr={action:"trigger",description:"Trigger/dispatch an event",category:"event",primaryRole:"event",roles:[{role:"event",description:"The event to trigger (supports namespaced events like draggable:start)",required:true,expectedTypes:["literal","expression"],svoPosition:1,sovPosition:2},{role:"destination",description:"The target element (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:2,sovPosition:1}]},Xr={action:"wait",description:"Wait for a duration or event",category:"async",primaryRole:"patient",roles:[{role:"patient",description:"Duration or event to wait for",required:true,expectedTypes:["literal","expression"],svoPosition:1,sovPosition:1}]},Jr={action:"fetch",description:"Fetch data from a URL",category:"async",primaryRole:"source",roles:[{role:"source",description:"The URL to fetch from",required:true,expectedTypes:["literal","expression"],svoPosition:1,sovPosition:1,renderOverride:{en:""}},{role:"responseType",description:"Response format (json, text, html, blob, etc.)",required:false,expectedTypes:["literal","expression"],svoPosition:2,sovPosition:2},{role:"method",description:"HTTP method (GET, POST, etc.)",required:false,expectedTypes:["literal"],svoPosition:3,sovPosition:3},{role:"destination",description:"Where to store the result",required:false,expectedTypes:["selector","reference"],svoPosition:4,sovPosition:4}]},Zr={action:"increment",description:"Increment a numeric value",category:"variable",primaryRole:"patient",roles:[{role:"patient",description:"The value to increment",required:true,expectedTypes:["selector","reference","expression"],svoPosition:1,sovPosition:1},{role:"quantity",description:"Amount to increment by (defaults to 1)",required:false,expectedTypes:["literal"],default:{type:"literal",value:1,dataType:"number"},svoPosition:2,sovPosition:2,markerOverride:{en:"by"}}]},en={action:"decrement",description:"Decrement a numeric value",category:"variable",primaryRole:"patient",roles:[{role:"patient",description:"The value to decrement",required:true,expectedTypes:["selector","reference","expression"],svoPosition:1,sovPosition:1},{role:"quantity",description:"Amount to decrement by (defaults to 1)",required:false,expectedTypes:["literal"],default:{type:"literal",value:1,dataType:"number"},svoPosition:2,sovPosition:2,markerOverride:{en:"by"}}]},tn={action:"append",description:"Append content to an element",category:"dom-content",primaryRole:"patient",roles:[{role:"patient",description:"The content to append",required:true,expectedTypes:["literal","selector","expression"],svoPosition:1,sovPosition:2},{role:"destination",description:"The element to append to",required:true,expectedTypes:["selector","reference"],svoPosition:2,sovPosition:1,markerOverride:{en:"to"}}]},rn={action:"prepend",description:"Prepend content to an element",category:"dom-content",primaryRole:"patient",roles:[{role:"patient",description:"The content to prepend",required:true,expectedTypes:["literal","selector","expression"],svoPosition:1,sovPosition:2},{role:"destination",description:"The element to prepend to",required:true,expectedTypes:["selector","reference"],svoPosition:2,sovPosition:1,markerOverride:{en:"to"}}]},nn={action:"log",description:"Log a value to the console",category:"variable",primaryRole:"patient",roles:[{role:"patient",description:"The value to log",required:true,expectedTypes:["literal","selector","reference","expression"],svoPosition:1,sovPosition:1}]},on={action:"get",description:"Get a value from a source",category:"variable",primaryRole:"source",roles:[{role:"source",description:"The source to get from",required:true,expectedTypes:["selector","reference","expression"],svoPosition:1,sovPosition:2,markerOverride:{en:"",es:"",pt:"",fr:"",de:"",ja:"\u3092",zh:"",ko:"\uB97C",ar:"\u0639\u0644\u0649",tr:"i",id:"",sw:"",tl:"",bn:"\u0995\u09C7",qu:"ta"}},{role:"destination",description:"Where to store the result (optional)",required:false,expectedTypes:["reference"],svoPosition:2,sovPosition:1}]},an={action:"take",description:"Take content from a source element",category:"dom-content",primaryRole:"patient",roles:[{role:"patient",description:"The class or element to take",required:true,expectedTypes:["selector"],svoPosition:1,sovPosition:2},{role:"source",description:"The element to take from (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:2,sovPosition:1}]},sn={action:"make",description:"Create a new element",category:"dom-content",primaryRole:"patient",roles:[{role:"patient",description:"The element type or selector to create",required:true,expectedTypes:["literal","selector"],svoPosition:1,sovPosition:1}]},ln={action:"halt",description:"Halt/stop execution or event propagation",category:"control-flow",primaryRole:"patient",roles:[{role:"patient",description:"What to halt (event, default, bubbling, etc.)",required:false,expectedTypes:["literal","reference","expression"],svoPosition:1,sovPosition:1}]},un={action:"settle",description:"Wait for animations/transitions to settle",category:"async",primaryRole:"patient",roles:[{role:"patient",description:"The element to settle (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:1,sovPosition:1}]},cn={action:"throw",description:"Throw an error",category:"control-flow",primaryRole:"patient",roles:[{role:"patient",description:"The error message or object to throw",required:true,expectedTypes:["literal","expression"],svoPosition:1,sovPosition:1}]},pn={action:"send",description:"Send an event to an element",category:"event",primaryRole:"event",roles:[{role:"event",description:"The event to send",required:true,expectedTypes:["literal","expression"],svoPosition:1,sovPosition:2},{role:"destination",description:"The target element (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:2,sovPosition:1,markerOverride:{en:"to",ja:"\u306B",ar:"\u0625\u0644\u0649",es:"a",ko:"\uC5D0\uAC8C",zh:"\u5230",tr:"-e",pt:"para",fr:"\xE0",de:"an",id:"ke",qu:"-man",sw:"kwa"}}]},dn={action:"if",description:"Conditional execution",category:"control-flow",primaryRole:"condition",hasBody:true,roles:[{role:"condition",description:"The condition to evaluate",required:true,expectedTypes:["expression"],svoPosition:1,sovPosition:1}]},mn={action:"unless",description:"Negated conditional execution (executes when condition is false)",category:"control-flow",primaryRole:"condition",hasBody:true,roles:[{role:"condition",description:"The condition to evaluate (body executes when false)",required:true,expectedTypes:["expression"],svoPosition:1,sovPosition:1}]},fn={action:"else",description:"Else branch of conditional",category:"control-flow",primaryRole:"patient",hasBody:true,roles:[]},vn={action:"repeat",description:"Repeat a block of commands",category:"control-flow",primaryRole:"loopType",hasBody:true,roles:[{role:"loopType",description:"Loop variant: forever, times, for, while, until, until-event",required:true,expectedTypes:["literal"],svoPosition:0,sovPosition:0},{role:"quantity",description:"Number of times to repeat",required:false,expectedTypes:["literal","expression"],svoPosition:1,sovPosition:1},{role:"event",description:"Event to wait for (terminates loop)",required:false,expectedTypes:["literal","expression"],svoPosition:2,sovPosition:2},{role:"source",description:"Element to listen for event on",required:false,expectedTypes:["selector","reference"],svoPosition:3,sovPosition:3}],notes:'Can also use "repeat forever", "repeat until condition", or "repeat until event X from Y"'},hn={action:"for",description:"Iterate over a collection",category:"control-flow",primaryRole:"patient",hasBody:true,roles:[{role:"patient",description:"The iteration variable",required:true,expectedTypes:["reference"],svoPosition:1,sovPosition:2},{role:"source",description:"The collection to iterate over",required:true,expectedTypes:["selector","reference","expression"],svoPosition:2,sovPosition:1,markerOverride:{en:"in"}}]},yn={action:"while",description:"Loop while condition is true",category:"control-flow",primaryRole:"condition",hasBody:true,roles:[{role:"condition",description:"The condition to check",required:true,expectedTypes:["expression"],svoPosition:1,sovPosition:1}]},gn={action:"continue",description:"Continue to next loop iteration",category:"control-flow",primaryRole:"patient",roles:[]},En={action:"go",description:"Navigate to a URL",category:"navigation",primaryRole:"destination",roles:[{role:"destination",description:"The URL to navigate to",required:true,expectedTypes:["literal","expression"],svoPosition:1,sovPosition:1,markerOverride:{en:"to"},renderOverride:{en:""}}]},kn={action:"transition",description:"Transition an element with animation",category:"dom-visibility",primaryRole:"patient",roles:[{role:"patient",description:"The property to transition (opacity, *background-color, etc.)",required:true,expectedTypes:["literal"],svoPosition:1,sovPosition:2,markerOverride:{en:"",ar:"",tl:"",sw:""}},{role:"goal",description:"The target value to transition to",required:true,expectedTypes:["literal","expression"],svoPosition:2,sovPosition:3,markerOverride:{en:"to",ar:"\u0625\u0644\u0649",tl:"sa",sw:"kwenye",bn:"\u09A4\u09C7",qu:"man",es:"a",pt:"para",fr:"\xE0",de:"auf",ja:"\u306B",ko:"\uC73C\uB85C",tr:"e",id:"ke"}},{role:"destination",description:"The target element (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:3,sovPosition:1},{role:"duration",description:"Transition duration (over 500ms, for 2 seconds)",required:false,expectedTypes:["literal"],svoPosition:4,sovPosition:4,markerOverride:{en:"over"}},{role:"style",description:"Easing function (ease-in, linear, etc.)",required:false,expectedTypes:["literal"],svoPosition:5,sovPosition:5}]},Tn={action:"clone",description:"Clone an element",category:"dom-content",primaryRole:"patient",roles:[{role:"patient",description:"The element to clone",required:true,expectedTypes:["selector","reference"],svoPosition:1,sovPosition:2},{role:"destination",description:"Where to put the clone",required:false,expectedTypes:["selector","reference"],svoPosition:2,sovPosition:1,markerOverride:{en:"into"}}]},bn={action:"focus",description:"Focus an element",category:"dom-content",primaryRole:"patient",roles:[{role:"patient",description:"The element to focus (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:1,sovPosition:1}]},Sn={action:"blur",description:"Remove focus from an element",category:"dom-content",primaryRole:"patient",roles:[{role:"patient",description:"The element to blur (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:1,sovPosition:1}]},xn={action:"call",description:"Call a function",category:"control-flow",primaryRole:"patient",roles:[{role:"patient",description:"The function to call",required:true,expectedTypes:["expression","reference"],svoPosition:1,sovPosition:1}]},wn={action:"return",description:"Return a value from a function",category:"control-flow",primaryRole:"patient",roles:[{role:"patient",description:"The value to return",required:false,expectedTypes:["literal","expression","reference"],svoPosition:1,sovPosition:1}]},An={action:"js",description:"Execute raw JavaScript code",category:"control-flow",primaryRole:"patient",hasBody:true,roles:[{role:"patient",description:"The JavaScript code to execute",required:false,expectedTypes:["expression"],svoPosition:1,sovPosition:1}]},Cn={action:"async",description:"Execute commands asynchronously",category:"async",primaryRole:"patient",hasBody:true,roles:[]},Pn={action:"tell",description:"Execute commands in context of another element",category:"control-flow",primaryRole:"destination",hasBody:true,roles:[{role:"destination",description:"The element to tell",required:true,expectedTypes:["selector","reference"],svoPosition:1,sovPosition:1,markerOverride:{en:""}}]},Rn={action:"default",description:"Set a default value for a variable",category:"variable",primaryRole:"destination",roles:[{role:"destination",description:"The variable to set default for",required:true,expectedTypes:["reference"],svoPosition:1,sovPosition:1,markerOverride:{en:"",ar:"",tl:"",sw:"",bn:"\u0995\u09C7",qu:"ta"}},{role:"patient",description:"The default value",required:true,expectedTypes:["literal","expression"],svoPosition:2,sovPosition:2,markerOverride:{en:"to",ar:"\u0625\u0644\u0649",tl:"sa",sw:"kwenye",bn:"\u09A4\u09C7",qu:"man"}}]},On={action:"init",description:"Initialization block that runs once",category:"control-flow",primaryRole:"patient",hasBody:true,roles:[]},_n={action:"behavior",description:"Define a reusable behavior",category:"control-flow",primaryRole:"patient",hasBody:true,roles:[{role:"patient",description:"The behavior name (PascalCase identifier)",required:true,expectedTypes:["literal","reference","expression"],svoPosition:1,sovPosition:1}]},Nn={action:"install",description:"Install a behavior on an element",category:"control-flow",primaryRole:"patient",roles:[{role:"patient",description:"The behavior name to install",required:true,expectedTypes:["literal","reference","expression"],svoPosition:1,sovPosition:2},{role:"destination",description:"Element to install on (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:2,sovPosition:1}]},In={action:"measure",description:"Measure element dimensions (x, y, width, height, etc.)",category:"dom-content",primaryRole:"patient",roles:[{role:"patient",description:"Property to measure (x, y, width, height, top, left, etc.)",required:false,expectedTypes:["literal","expression"],svoPosition:1,sovPosition:1},{role:"source",description:"Element to measure (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:2,sovPosition:2,markerOverride:{en:"of"}}]},Mn={action:"swap",description:"Swap DOM content using various strategies (innerHTML, outerHTML, delete, etc.)",category:"dom-content",primaryRole:"destination",roles:[{role:"method",description:"The swap strategy (innerHTML, outerHTML, beforebegin, afterend, delete)",required:false,expectedTypes:["literal"],svoPosition:1,sovPosition:3,markerOverride:{en:""}},{role:"destination",description:"The element to swap content in/for",required:true,expectedTypes:["selector","reference"],svoPosition:2,sovPosition:1,markerOverride:{en:"of"}},{role:"patient",description:"The content to swap in (optional for delete)",required:false,expectedTypes:["literal","expression","selector"],svoPosition:3,sovPosition:2,markerOverride:{en:"with"}}]},Ln={action:"morph",description:"Morph an element into another using DOM diffing",category:"dom-content",primaryRole:"destination",roles:[{role:"destination",description:"The element to morph",required:true,expectedTypes:["selector","reference"],svoPosition:1,sovPosition:1,markerOverride:{en:""}},{role:"patient",description:"The target content/element to morph into",required:true,expectedTypes:["literal","expression","selector"],svoPosition:2,sovPosition:2,markerOverride:{en:"to"}}]},Dn={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}]},$n={action:"break",description:"Exit from the current loop",category:"control-flow",primaryRole:"patient",roles:[]},Bn={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}]},qn={action:"exit",description:"Exit from the current event handler",category:"control-flow",primaryRole:"patient",roles:[]},Vn={action:"pick",description:"Select a random element from a collection",category:"variable",primaryRole:"patient",roles:[{role:"patient",description:"The items to pick from",required:true,expectedTypes:["literal","expression","reference"],svoPosition:1,sovPosition:1},{role:"source",description:'The array to pick from (with "from" keyword)',required:false,expectedTypes:["reference","expression"],svoPosition:2,sovPosition:2}]},Fn={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}]},et={toggle:zr,add:Wr,remove:jr,put:Ur,set:Hr,show:Gr,hide:Kr,on:Yr,trigger:Qr,wait:Xr,fetch:Jr,increment:Zr,decrement:en,append:tn,prepend:rn,log:nn,get:on,take:an,make:sn,halt:ln,settle:un,throw:cn,send:pn,if:dn,unless:mn,else:fn,repeat:vn,for:hn,while:yn,continue:gn,go:En,transition:kn,clone:Tn,focus:bn,blur:Sn,call:xn,return:wn,js:An,async:Cn,tell:Pn,default:Rn,init:On,behavior:_n,install:Nn,measure:In,swap:Mn,morph:Ln,beep:Dn,break:$n,copy:Bn,exit:qn,pick:Vn,render:Fn,compound:{action:"compound",description:"A compound node representing chained statements",primaryRole:"patient",category:"control-flow",hasBody:true,roles:[]}};function zn(){return Object.values(et).filter(n=>n.roles.length>0)}typeof process<"u"&&process.env.NODE_ENV!=="production"&&Promise.resolve().then(()=>(kr(),Ye)).then(({validateAllSchemas:n,formatValidationResults:e})=>{let t=n(et);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(n=>{console.debug("Schema validation skipped:",n);});function tt(n,e){let t=e==="SOV"?"sovPosition":"svoPosition";return [...n].sort((r,o)=>{let i=r[t]??99,a=o[t]??99;return i-a})}function Wn(n,e){let t=n.markerOverride?.[e.code],r=e.roleMarkers[n.role];if(t!==void 0)return {primary:t,position:r?.position??"before",isOverride:true};if(r&&r.primary){let o={primary:r.primary,position:r.position,isOverride:false};return r.alternatives&&(o.alternatives=r.alternatives),o}return null}function jn(n,e,t,r,o){let i=[];if(i.push({type:"role",role:"event",optional:false}),r.position==="after"){let c=r.primary.split(/\s+/);if(c.length>1)for(let u of c)i.push({type:"literal",value:u});else {let u=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};i.push(u);}}let a=e.roleMarkers.destination;a&&i.push({type:"group",optional:true,tokens:[{type:"role",role:"destination",optional:true},a.alternatives?{type:"literal",value:a.primary,alternatives:a.alternatives}:{type:"literal",value:a.primary}]}),i.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};i.push(c);}let l=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};return i.push(l),{id:`${n.action}-event-${e.code}-sov`,language:e.code,command:"on",priority:(o.basePriority??100)+50,template:{format:`{event} ${r.primary} {destination?} {patient} ${s?.primary||""} ${t.primary}`,tokens:i},extraction:{action:{value:n.action},event:{fromRole:"event"},patient:{fromRole:"patient"},destination:{fromRole:"destination",default:{type:"reference",value:"me"}}}}}function Un(n,e,t,r,o){let i=[];i.push({type:"role",role:"patient",optional:false});let a=e.roleMarkers.patient;if(a){let l=a.alternatives?{type:"literal",value:a.primary,alternatives:a.alternatives}:{type:"literal",value:a.primary};i.push(l);}if(i.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)i.push({type:"literal",value:c});else {let c=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};i.push(c);}}let s=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};return i.push(s),{id:`${n.action}-event-${e.code}-sov-patient-first`,language:e.code,command:"on",priority:(o.basePriority??100)+45,template:{format:`{patient} ${a?.primary||""} {event} ${r.primary} ${t.primary}`,tokens:i},extraction:{action:{value:n.action},event:{fromRole:"event"},patient:{fromRole:"patient"},destination:{fromRole:"destination",default:{type:"reference",value:"me"}}}}}function Hn(n,e,t,r,o){let i=[];i.push({type:"role",role:"patient",optional:false});let a=e.roleMarkers.patient;if(a){let c=a.alternatives?{type:"literal",value:a.primary,alternatives:a.alternatives}:{type:"literal",value:a.primary};i.push(c);}let s=e.roleMarkers.destination;if(s&&(i.push({type:"role",role:"destination",optional:false}),i.push(s.alternatives?{type:"literal",value:s.primary,alternatives:s.alternatives}:{type:"literal",value:s.primary})),i.push({type:"role",role:"event",optional:false}),r.position==="after"){let c=r.primary.split(/\s+/);if(c.length>1)for(let u of c)i.push({type:"literal",value:u});else {let u=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};i.push(u);}}let l=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};return i.push(l),{id:`${n.action}-event-${e.code}-sov-patient-first-dest`,language:e.code,command:"on",priority:(o.basePriority??100)+40,template:{format:`{patient} ${a?.primary||""} {destination} ${s?.primary||""} {event} ${r.primary} ${t.primary}`,tokens:i},extraction:{action:{value:n.action},event:{fromRole:"event"},patient:{fromRole:"patient"},destination:{fromRole:"destination"}}}}function Gn(n,e,t,r,o){let i=[];i.push({type:"role",role:"event",optional:false});let a=r.alternatives?.filter(u=>!u.includes(" ")&&u.length>1)||[];a.length>0&&i.push({type:"literal",value:a[0],alternatives:a.slice(1)});let s=e.roleMarkers.destination;s&&i.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}]}),i.push({type:"role",role:"patient",optional:false});let l=e.roleMarkers.patient;if(l){let u=l.alternatives?{type:"literal",value:l.primary,alternatives:l.alternatives}:{type:"literal",value:l.primary};i.push(u);}let c=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};return i.push(c),{id:`${n.action}-event-${e.code}-sov-compact`,language:e.code,command:"on",priority:(o.basePriority??100)+52,template:{format:`{event}${a[0]||""} {patient} ${t.primary}`,tokens:i},extraction:{action:{value:n.action},event:{fromRole:"event"},patient:{fromRole:"patient"},destination:{fromRole:"destination",default:{type:"reference",value:"me"}}}}}function Kn(n,e,t,r,o){let i=[];if(i.push({type:"role",role:"event",optional:false}),r.position==="after"){let s=r.primary.split(/\s+/);if(s.length>1)for(let l of s)i.push({type:"literal",value:l});else {let l=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};i.push(l);}}let a=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};return i.push(a),{id:`${n.action}-event-${e.code}-sov-simple`,language:e.code,command:"on",priority:(o.basePriority??100)+48,template:{format:`{event} ${r.primary} ${t.primary}`,tokens:i},extraction:{action:{value:n.action},event:{fromRole:"event"},patient:{default:{type:"reference",value:"me"}}}}}function Yn(n,e,t,r){let o=e.eventHandler?.temporalMarkers;if(!o||o.length===0)return null;let i=[];i.push({type:"role",role:"event",optional:false}),e.possessive?.marker&&i.push({type:"group",optional:true,tokens:[{type:"literal",value:e.possessive.marker}]}),i.push({type:"literal",value:o[0],alternatives:o.slice(1)}),i.push({type:"role",role:"patient",optional:false});let a=e.roleMarkers.patient;if(a?.primary){let l=a.alternatives?{type:"literal",value:a.primary,alternatives:a.alternatives}:{type:"literal",value:a.primary};i.push(l);}let s=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};return i.push(s),{id:`${n.action}-event-${e.code}-sov-temporal`,language:e.code,command:"on",priority:(r.basePriority??100)+49,template:{format:`{event} ${o[0]} {patient} ${t.primary}`,tokens:i},extraction:{action:{value:n.action},event:{fromRole:"event"},patient:{fromRole:"patient"}}}}function Qn(n,e,t,r,o){let i=[];if(i.push({type:"role",role:"event",optional:false}),r.position==="after"){let u=r.primary.split(/\s+/);if(u.length>1)for(let p of u)i.push({type:"literal",value:p});else {let p=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};i.push(p);}}let s=[...n.roles.filter(u=>u.required)].sort((u,p)=>{let d=u.sovPosition??999,m=p.sovPosition??999;return d-m});for(let u of s){i.push({type:"role",role:u.role,optional:false});let p,d;if(u.markerOverride&&u.markerOverride[e.code]!==void 0)p=u.markerOverride[e.code];else {let m=e.roleMarkers[u.role];m&&(p=m.primary,d=m.alternatives);}if(p){let m=d?{type:"literal",value:p,alternatives:d}:{type:"literal",value:p};i.push(m);}}let l=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};i.push(l);let c=s.map(u=>`{${u.role}}`).join(" ");return {id:`${n.action}-event-${e.code}-sov-2role`,language:e.code,command:"on",priority:(o.basePriority??100)+55,template:{format:`{event} ${r.primary} ${c} ${t.primary}`,tokens:i},extraction:{action:{value:n.action},event:{fromRole:"event"},...Object.fromEntries(s.map(u=>[u.role,{fromRole:u.role}]))}}}function Xn(n,e,t,r,o){let i=[],s=[...n.roles.filter(f=>f.required)].sort((f,y)=>{let g=f.sovPosition??999,E=y.sovPosition??999;return g-E}),l=s[0];i.push({type:"role",role:l.role,optional:false});let c;if(l.markerOverride&&l.markerOverride[e.code]!==void 0)c=l.markerOverride[e.code];else {let f=e.roleMarkers[l.role];f&&(c=f.primary);}if(c&&i.push({type:"literal",value:c}),i.push({type:"role",role:"event",optional:false}),r.position==="after"){let f=r.primary.split(/\s+/);if(f.length>1)for(let y of f)i.push({type:"literal",value:y});else {let y=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};i.push(y);}}let u=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};i.push(u);let p=s[1];i.push({type:"role",role:p.role,optional:false});let d,m;if(p.markerOverride&&p.markerOverride[e.code]!==void 0)d=p.markerOverride[e.code];else {let f=e.roleMarkers[p.role];f&&(d=f.primary,m=f.alternatives);}if(d){let f=m?{type:"literal",value:d,alternatives:m}:{type:"literal",value:d};i.push(f);}return {id:`${n.action}-event-${e.code}-sov-2role-dest-first`,language:e.code,command:"on",priority:(o.basePriority??100)+48,template:{format:`{${l.role}} {event} ${r.primary} ${t.primary} {${p.role}}`,tokens:i},extraction:{action:{value:n.action},event:{fromRole:"event"},[l.role]:{fromRole:l.role},[p.role]:{fromRole:p.role}}}}function je(n,e,t,r,o){let i=[];if(r.position==="before"){let l=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};i.push(l);}i.push({type:"role",role:"event",optional:false});let a=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};i.push(a),i.push({type:"role",role:"patient",optional:false});let s=e.roleMarkers.destination;return s&&i.push({type:"group",optional:true,tokens:[s.alternatives?{type:"literal",value:s.primary,alternatives:s.alternatives}:{type:"literal",value:s.primary},{type:"role",role:"destination",optional:true}]}),{id:`${n.action}-event-${e.code}-vso`,language:e.code,command:"on",priority:(o.basePriority??100)+50,template:{format:`${r.primary} {event} ${t.primary} {patient} ${s?.primary||""} {destination?}`,tokens:i},extraction:{action:{value:n.action},event:{fromRole:"event"},patient:{fromRole:"patient"},destination:{fromRole:"destination",default:{type:"reference",value:"me"}}}}}function Jn(n,e,t,r,o){let i=[],a=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};i.push(a),i.push({type:"role",role:"patient",optional:false});let s=e.roleMarkers.destination;if(s&&i.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}]}),r.position==="before"){let l=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};i.push(l);}return i.push({type:"role",role:"event",optional:false}),{id:`${n.action}-event-${e.code}-vso-verb-first`,language:e.code,command:"on",priority:(o.basePriority??100)+45,template:{format:`${t.primary} {patient} ${s?.primary||""} {destination?} ${r.primary} {event}`,tokens:i},extraction:{action:{value:n.action},event:{fromRole:"event"},patient:{fromRole:"patient"},destination:{fromRole:"destination",default:{type:"reference",value:"me"}}}}}function Zn(n,e,t,r,o){let i=[],a=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};i.push(a);let l=[...n.roles.filter(u=>u.required)].sort((u,p)=>{let d=u.svoPosition??999,m=p.svoPosition??999;return d-m});for(let u of l){let p,d;if(u.markerOverride&&u.markerOverride[e.code]!==void 0)p=u.markerOverride[e.code];else {let m=e.roleMarkers[u.role];m&&(p=m.primary,d=m.alternatives);}if(p){let m=d?{type:"literal",value:p,alternatives:d}:{type:"literal",value:p};i.push(m);}i.push({type:"role",role:u.role,optional:false});}if(r.position==="before"){let u=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};i.push(u);}i.push({type:"role",role:"event",optional:false});let c=l.map(u=>`{${u.role}}`).join(" ");return {id:`${n.action}-event-${e.code}-vso-verb-first-2role`,language:e.code,command:"on",priority:(o.basePriority??100)+48,template:{format:`${t.primary} ${c} ${r.primary} {event}`,tokens:i},extraction:{action:{value:n.action},event:{fromRole:"event"},...Object.fromEntries(l.map(u=>[u.role,{fromRole:u.role}]))}}}function Ue(n,e,t,r,o){let i=[];if(r.position==="before"){let u=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};i.push(u);}i.push({type:"role",role:"event",optional:false});let a=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};i.push(a);let l=[...n.roles.filter(u=>u.required)].sort((u,p)=>{let d=u.svoPosition??999,m=p.svoPosition??999;return d-m});for(let u of l){let p,d;if(u.markerOverride&&u.markerOverride[e.code]!==void 0)p=u.markerOverride[e.code];else {let m=e.roleMarkers[u.role];m&&(p=m.primary,d=m.alternatives);}if(p){let m=d?{type:"literal",value:p,alternatives:d}:{type:"literal",value:p};i.push(m);}i.push({type:"role",role:u.role,optional:false});}let c=l.map(u=>`{${u.role}}`).join(" ");return {id:`${n.action}-event-${e.code}-vso-2role`,language:e.code,command:"on",priority:(o.basePriority??100)+55,template:{format:`${r.primary} {event} ${t.primary} ${c}`,tokens:i},extraction:{action:{value:n.action},event:{fromRole:"event"},...Object.fromEntries(l.map(u=>[u.role,{fromRole:u.role}]))}}}function eo(n,e,t,r,o){let i=[],a=e.eventHandler?.negationMarker;if(r.position==="before"){let c=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};i.push(c);}if(a){let c=a.alternatives?{type:"literal",value:a.primary,alternatives:a.alternatives}:{type:"literal",value:a.primary};i.push(c);}i.push({type:"role",role:"event",optional:false});let s=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};i.push(s),i.push({type:"role",role:"patient",optional:false});let l=e.roleMarkers.destination;return l&&i.push({type:"group",optional:true,tokens:[l.alternatives?{type:"literal",value:l.primary,alternatives:l.alternatives}:{type:"literal",value:l.primary},{type:"role",role:"destination",optional:true}]}),{id:`${n.action}-event-${e.code}-vso-negated`,language:e.code,command:"on",priority:(o.basePriority??100)+48,template:{format:`${r.primary} ${a?.primary||""} {event} ${t.primary} {patient} ${l?.primary||""} {destination?}`,tokens:i},extraction:{action:{value:n.action},event:{fromRole:"event"},patient:{fromRole:"patient"},destination:{fromRole:"destination",default:{type:"reference",value:"me"}}}}}function to(n,e,t,r){let o=[];o.push({type:"literal",value:"and",alternatives:["then"]}),o.push({type:"role",role:"event",optional:false});let i=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};o.push(i),o.push({type:"role",role:"patient",optional:false});let a=e.roleMarkers.destination;return a&&o.push({type:"group",optional:true,tokens:[a.alternatives?{type:"literal",value:a.primary,alternatives:a.alternatives}:{type:"literal",value:a.primary},{type:"role",role:"destination",optional:true}]}),{id:`${n.action}-event-${e.code}-vso-proclitic`,language:e.code,command:"on",priority:(r.basePriority??100)+45,template:{format:`[proclitic?] {event} ${t.primary} {patient} ${a?.primary||""} {destination?}`,tokens:o},extraction:{action:{value:n.action},event:{fromRole:"event"},patient:{fromRole:"patient"},destination:{fromRole:"destination",default:{type:"reference",value:"me"}}}}}var J={basePriority:100,generateSimpleVariants:true,generateAlternatives:true};function rt(n,e,t=J){let r=`${n.action}-${e.code}-generated`,o=t.basePriority??100,i=e.keywords[n.action];if(!i)throw new Error(`No keyword translation for '${n.action}' in ${e.code}`);let a=ao(n,e,i),s=nt(n,e),l=co(n,e,i);return {id:r,language:e.code,command:n.action,priority:o,template:{format:l,tokens:a},extraction:s}}function ro(n,e,t=J){if(n.roles.filter(s=>!s.required).length===0)return null;let o=n.roles.filter(s=>s.required),i={...n,roles:o};return {...rt(i,e,t),id:`${n.action}-${e.code}-generated-simple`,priority:(t.basePriority??100)-5,extraction:nt(n,e)}}function no(n,e,t=J){let r=[];if(r.push(rt(n,e,t)),t.generateSimpleVariants){let o=ro(n,e,t);o&&r.push(o);}return r}function oo(n,e=J){let t=[],r=zn();for(let o of r){if(!n.keywords[o.action])continue;let i=no(o,n,e);if(t.push(...i),n.eventHandler?.eventMarker){let a=io(o,n,e);t.push(...a);}}return t}function io(n,e,t=J){if(!e.eventHandler||!e.eventHandler.eventMarker)return [];let r=[],o=e.eventHandler.eventMarker,i=e.keywords[n.action];if(!i)return [];let s=n.roles.filter(l=>l.required).length===2;if(e.wordOrder==="SOV")if(s)r.push(Qn(n,e,i,o,t)),r.push(Xn(n,e,i,o,t));else {r.push(jn(n,e,i,o,t)),r.push(Un(n,e,i,o,t));let l=e.roleMarkers.destination;l&&l.primary!==o.primary&&r.push(Hn(n,e,i,o,t));let c=o.primary.split(/\s+/),u=o.alternatives?.some(d=>!d.includes(" ")&&d.length>1);c.length>1&&u&&r.push(Gn(n,e,i,o,t)),r.push(Kn(n,e,i,o,t));let p=Yn(n,e,i,t);p&&r.push(p);}else e.wordOrder==="VSO"?s?(r.push(Ue(n,e,i,o,t)),r.push(Zn(n,e,i,o,t))):(r.push(je(n,e,i,o,t)),r.push(Jn(n,e,i,o,t)),e.eventHandler?.negationMarker&&r.push(eo(n,e,i,o,t)),e.tokenization?.prefixes&&r.push(to(n,e,i,t))):s?r.push(Ue(n,e,i,o,t)):r.push(je(n,e,i,o,t));return r}function ao(n,e,t){let r=[],o=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary},i=so(n,e);switch(e.wordOrder){case "SVO":r.push(o),r.push(...i);break;case "SOV":r.push(...i),r.push(o);break;case "VSO":r.push(o),r.push(...i);break;default:r.push(o),r.push(...i);}return r}function so(n,e){let t=[],r=tt(n.roles,e.wordOrder);for(let o of r){let i=lo(o,e);o.required?t.push(...i):t.push({type:"group",optional:true,tokens:i});}return t}function lo(n,e){let t=[],r=n.markerOverride?.[e.code],o=e.roleMarkers[n.role],i={type:"role",role:n.role,optional:!n.required,expectedTypes:n.expectedTypes};if(r!==void 0)(o?.position??"before")==="before"?(r&&t.push({type:"literal",value:r}),t.push(i)):(t.push(i),r&&t.push({type:"literal",value:r}));else if(o)if(o.position==="before"){if(o.primary){let a=o.alternatives?{type:"literal",value:o.primary,alternatives:o.alternatives}:{type:"literal",value:o.primary};t.push(a);}t.push(i);}else {t.push(i);let a=o.alternatives?{type:"literal",value:o.primary,alternatives:o.alternatives}:{type:"literal",value:o.primary};t.push(a);}else t.push(i);return t}function uo(n,e){let t={};for(let r of n.roles){let o=r.markerOverride?.[e.code],i=e.roleMarkers[r.role];o!==void 0?t[r.role]=o?{marker:o}:{}:i&&i.primary?t[r.role]=i.alternatives?{marker:i.primary,markerAlternatives:i.alternatives}:{marker:i.primary}:t[r.role]={};}return t}function nt(n,e){let t=uo(n,e),r={};for(let o of n.roles){let i=t[o.role]||{};!o.required&&o.default?r[o.role]={...i,default:o.default}:r[o.role]=i;}return r}function co(n,e,t){let r=[],i=tt(n.roles,e.wordOrder).map(a=>{let s=Wn(a,e),l="";return s&&s.primary?s.position==="before"?l=`${s.primary} {${a.role}}`:l=`{${a.role}} ${s.primary}`:l=`{${a.role}}`,a.required?l:`[${l}]`});switch(e.wordOrder){case "SVO":case "VSO":r.push(t.primary,...i);break;case "SOV":r.push(...i,t.primary);break;default:r.push(t.primary,...i);}return r.join(" ")}function po(){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 mo(){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 fo(){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 vo(){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 ho(){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 yo(){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 go(){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}}}]}function Eo(){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 ko(){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 To(){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 bo(){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 So(){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 xo(n){switch(n){case "bn":return po();case "en":return mo();case "es":return fo();case "hi":return vo();case "it":return ho();case "pl":return yo();case "qu":return go();case "ru":return Eo();case "th":return ko();case "uk":return To();case "vi":return bo();case "zh":return So();default:return []}}function wo(){return [{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 Ao(){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"}}}}]}function Co(){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 Po(){return [{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 Ro(){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 Oo(){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-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 _o(){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:95,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:95,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 No(){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:95,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:95,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 Io(){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}}}]}function Mo(){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 Lo(){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:95,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:"manner"}]},extraction:{patient:{position:1},manner:{marker:"tr\u01B0\u1EDBc",markerAlternatives:["tr\u01B0\u1EDBc khi"]}}},{id:"put-vi-after",language:"vi",command:"put",priority:95,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"]}}}]}function Do(){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\u5230 {destination}",tokens:[{type:"literal",value:"\u628A"},{type:"role",role:"patient",expectedTypes:["literal","selector","reference","expression"]},{type:"literal",value:"\u653E\u5230",alternatives:["\u653E\u5728","\u653E\u5165"]},{type:"role",role:"destination",expectedTypes:["selector","reference"]}]},extraction:{patient:{position:1},destination:{position:3}}}]}function $o(n){switch(n){case "bn":return wo();case "en":return Ao();case "es":return Co();case "hi":return Po();case "id":return Ro();case "it":return Oo();case "pl":return _o();case "ru":return No();case "th":return Io();case "uk":return Mo();case "vi":return Lo();case "zh":return Do();default:return []}}function Bo(){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 qo(){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 Vo(){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 Fo(){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 zo(){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 Wo(){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-bare",language:"hi",command:"on",priority:80,template:{format:"{event}",tokens:[{type:"role",role:"event"}]},extraction:{event:{position:0}}}]}function jo(){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 Uo(){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 Ho(){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 Go(){return [{id:"event-handler-pl-full",language:"pl",command:"on",priority:100,template:{format:"gdy {event} na {source}",tokens:[{type:"literal",value:"gdy",alternatives:["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:["przy","na"]},{type:"role",role:"event"}]},extraction:{event:{position:1},source:{default:{type:"reference",value:"me"}}}}]}function Ko(){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 Yo(){return [{id:"event-qu-source",language:"qu",command:"on",priority:110,template:{format:"{event} pi {source} manta {body}",tokens:[{type:"role",role:"event"},{type:"literal",value:"pi"},{type:"role",role:"source"},{type:"literal",value:"manta"}]},extraction:{event:{position:0},source:{marker:"manta"}}},{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 Qo(){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 Xo(){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 Jo(){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 Zo(){return [{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:["kung","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:["kung","sa"]},{type:"role",role:"event"}]},extraction:{event:{position:1}}}]}function ei(){return [{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 ti(){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 ri(){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-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 ni(n){switch(n){case "bn":return Bo();case "de":return qo();case "en":return Vo();case "es":return Fo();case "fr":return zo();case "hi":return Wo();case "id":return jo();case "it":return Uo();case "ms":return Ho();case "pl":return Go();case "pt":return Ko();case "qu":return Yo();case "ru":return Qo();case "sw":return Xo();case "th":return Jo();case "tl":return Zo();case "uk":return ei();case "vi":return ti();case "zh":return ri();default:return []}}var oi={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"}}},ii={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}}},ai={id:"swap-en-handcrafted",language:"en",command:"swap",priority:110,template:{format:"swap {method} {destination}",tokens:[{type:"literal",value:"swap"},{type:"role",role:"method"},{type:"role",role:"destination"}]},extraction:{method:{position:1},destination:{position:2}}},si={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"}}}},li={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"}}}},ui={id:"set-en-possessive",language:"en",command:"set",priority:100,template:{format:"set {destination} to {patient}",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"]}]},extraction:{destination:{position:1},patient:{marker:"to"}}},ci={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"},loopType:{default:{type:"literal",value:"for"}}}},pi={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}}},di={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}}},mi={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}}},fi={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 vi(){let n=[];n.push(...xo("en")),n.push(...$o("en")),n.push(...ni("en")),n.push(oi,ii,ai,si,li,ui,ci,pi,di,mi,fi);let e=oo(Ee);return n.push(...e),n}Sr("en",Fr,Ee);wr("en",vi());var hi=Object.defineProperty,yi=Object.getOwnPropertyNames,ht=(n,e)=>function(){return n&&(e=(0, n[yi(n)[0]])(n=0)),e},gi=(n,e)=>{for(var t in e)hi(n,t,{get:e[t],enumerable:true});};function ot(n,e){return n.replace(/\{(\w+)\}/g,(t,r)=>String(e[r]??`{${r}}`))}function P(n,e,t={},r){let o=yt[n],i=ot(o,t),a=gt[n],s=a?ot(a,t):void 0;return {code:n,message:i,severity:e,...r&&{role:r},...s&&{suggestion:s}}}var h,yt,gt,Ei=ht({"src/generators/schema-error-codes.ts"(){h={AMBIGUOUS_TYPE_LITERAL_SELECTOR:"SCHEMA_AMBIGUOUS_TYPE_LITERAL_SELECTOR",TOO_MANY_EXPECTED_TYPES:"SCHEMA_TOO_MANY_EXPECTED_TYPES",MULTI_TYPE_PATIENT_EXPECTED:"SCHEMA_MULTI_TYPE_PATIENT_EXPECTED",NO_REQUIRED_ROLES:"SCHEMA_NO_REQUIRED_ROLES",NO_REQUIRED_ROLES_EXPECTED:"SCHEMA_NO_REQUIRED_ROLES_EXPECTED",TRANSITION_PATIENT_ACCEPTS_SELECTOR:"SCHEMA_TRANSITION_PATIENT_ACCEPTS_SELECTOR",TRANSITION_MISSING_GOAL:"SCHEMA_TRANSITION_MISSING_GOAL",EVENT_HANDLER_MISSING_EVENT:"SCHEMA_EVENT_HANDLER_MISSING_EVENT",EVENT_HANDLER_EVENT_NOT_REQUIRED:"SCHEMA_EVENT_HANDLER_EVENT_NOT_REQUIRED",CONDITIONAL_MISSING_CONDITION:"SCHEMA_CONDITIONAL_MISSING_CONDITION",CONDITIONAL_CONDITION_NOT_REQUIRED:"SCHEMA_CONDITIONAL_CONDITION_NOT_REQUIRED",FOR_LOOP_MISSING_SOURCE:"SCHEMA_FOR_LOOP_MISSING_SOURCE",WHILE_LOOP_MISSING_CONDITION:"SCHEMA_WHILE_LOOP_MISSING_CONDITION",VALUE_TYPE_MISMATCH:"SCHEMA_VALUE_TYPE_MISMATCH",SELECTOR_KIND_MISMATCH:"SCHEMA_SELECTOR_KIND_MISMATCH",SELECTOR_KINDS_WITHOUT_SELECTOR_TYPE:"SCHEMA_SELECTOR_KINDS_WITHOUT_SELECTOR_TYPE",KEYWORD_COLLISION:"PROFILE_KEYWORD_COLLISION"},yt={[h.AMBIGUOUS_TYPE_LITERAL_SELECTOR]:"Role '{role}' accepts both 'literal' and 'selector'. This may cause ambiguous type inference for values starting with special characters (* . # etc.).",[h.TOO_MANY_EXPECTED_TYPES]:"Role '{role}' accepts {count} different types. This may make type inference unreliable.",[h.MULTI_TYPE_PATIENT_EXPECTED]:"Role '{role}' accepts multiple types (expected for {command} command).",[h.NO_REQUIRED_ROLES]:"Command has no required roles. Is this intentional?",[h.NO_REQUIRED_ROLES_EXPECTED]:"Command has no required roles (expected for {command}).",[h.TRANSITION_PATIENT_ACCEPTS_SELECTOR]:"Transition command 'patient' role (CSS property name) should only accept 'literal', not 'selector'. CSS property names like 'background-color' are strings, not CSS selectors.",[h.TRANSITION_MISSING_GOAL]:"Transition command requires a 'goal' role for the target value (to <value>). Without it, there's no way to specify what value to transition to.",[h.EVENT_HANDLER_MISSING_EVENT]:"Event handler command should have an 'event' role to specify which event to listen for.",[h.EVENT_HANDLER_EVENT_NOT_REQUIRED]:"Event role should be required - every event handler needs an event to listen for.",[h.CONDITIONAL_MISSING_CONDITION]:"Conditional command should have a 'condition' role for the boolean expression.",[h.CONDITIONAL_CONDITION_NOT_REQUIRED]:"Condition role should be required - conditionals need a condition to evaluate.",[h.FOR_LOOP_MISSING_SOURCE]:"For-loop should have a 'source' role for the collection to iterate over.",[h.WHILE_LOOP_MISSING_CONDITION]:"While-loop should have a 'condition' role for the loop condition.",[h.VALUE_TYPE_MISMATCH]:"Role '{role}' of command '{command}' expects type [{expectedTypes}], got '{actualType}'.",[h.SELECTOR_KIND_MISMATCH]:"Role '{role}' of command '{command}' expects selector kind [{selectorKinds}], got '{actualKind}'.",[h.SELECTOR_KINDS_WITHOUT_SELECTOR_TYPE]:"Role '{role}' has selectorKinds but expectedTypes does not include 'selector'.",[h.KEYWORD_COLLISION]:"Keyword '{keyword}' is used by multiple commands: {commands}. Only the first-registered command will be reachable."},gt={[h.AMBIGUOUS_TYPE_LITERAL_SELECTOR]:"Consider being more specific about which type is expected, or use explicit type markers.",[h.TOO_MANY_EXPECTED_TYPES]:"Consider narrowing the accepted types to improve type inference reliability.",[h.TRANSITION_PATIENT_ACCEPTS_SELECTOR]:"Remove 'selector' from expectedTypes and only accept 'literal'.",[h.TRANSITION_MISSING_GOAL]:"Add a 'goal' role with expectedTypes ['literal', 'variable'].",[h.EVENT_HANDLER_MISSING_EVENT]:"Add an 'event' role with expectedTypes ['literal'].",[h.EVENT_HANDLER_EVENT_NOT_REQUIRED]:"Set required: true on the 'event' role.",[h.CONDITIONAL_MISSING_CONDITION]:"Add a 'condition' role with expectedTypes ['expression'].",[h.CONDITIONAL_CONDITION_NOT_REQUIRED]:"Set required: true on the 'condition' role.",[h.FOR_LOOP_MISSING_SOURCE]:"Add a 'source' role for the collection to iterate over.",[h.WHILE_LOOP_MISSING_CONDITION]:"Add a 'condition' role for the loop continuation condition.",[h.VALUE_TYPE_MISMATCH]:"Ensure the value matches one of the expected types: [{expectedTypes}].",[h.SELECTOR_KIND_MISMATCH]:"Use a selector of the correct kind: [{selectorKinds}].",[h.SELECTOR_KINDS_WITHOUT_SELECTOR_TYPE]:"Either add 'selector' to expectedTypes or remove selectorKinds.",[h.KEYWORD_COLLISION]:"Give each command a unique keyword. Move the shared keyword to alternatives on one command, or use a more specific translation."};}}),Et={};gi(Et,{SchemaErrorCodes:()=>h,formatValidationResults:()=>Ai,getValidationStats:()=>Ci,validateAllKeywordCollisions:()=>Ri,validateAllSchemas:()=>wi,validateCommandSchema:()=>kt,validateKeywordCollisions:()=>Tt,validateRoleValues:()=>Pi});function ki(n,e){return {action:n,items:e,get notes(){return e.filter(t=>t.severity==="note").map(t=>t.message)},get warnings(){return e.filter(t=>t.severity==="warning").map(t=>t.message)},get errors(){return e.filter(t=>t.severity==="error").map(t=>t.message)}}}function kt(n){let e=[];for(let r of n.roles)r.expectedTypes.includes("literal")&&r.expectedTypes.includes("selector")&&(r.role==="patient"&&Se.has(n.action)?e.push(P(h.MULTI_TYPE_PATIENT_EXPECTED,"note",{role:r.role,command:n.action},r.role)):e.push(P(h.AMBIGUOUS_TYPE_LITERAL_SELECTOR,"warning",{role:r.role},r.role))),r.expectedTypes.length>3&&!Se.has(n.action)&&e.push(P(h.TOO_MANY_EXPECTED_TYPES,"warning",{role:r.role,count:r.expectedTypes.length},r.role));for(let r of n.roles)r.selectorKinds&&r.selectorKinds.length>0&&(r.expectedTypes.includes("selector")||e.push(P(h.SELECTOR_KINDS_WITHOUT_SELECTOR_TYPE,"warning",{role:r.role},r.role)));switch(n.action){case "transition":Ti(n,e);break;case "on":bi(n,e);break;case "if":case "unless":Si(n,e);break;case "repeat":case "for":case "while":xi(n,e);break}return n.roles.filter(r=>r.required).length===0&&(bt.has(n.action)?e.push(P(h.NO_REQUIRED_ROLES_EXPECTED,"note",{command:n.action})):e.push(P(h.NO_REQUIRED_ROLES,"warning",{}))),ki(n.action,e)}function Ti(n,e){let t=n.roles.find(o=>o.role==="patient"),r=n.roles.find(o=>o.role==="goal");t&&t.expectedTypes.includes("selector")&&e.push(P(h.TRANSITION_PATIENT_ACCEPTS_SELECTOR,"warning",{},"patient")),t&&!r&&e.push(P(h.TRANSITION_MISSING_GOAL,"error",{}));}function bi(n,e){let t=n.roles.find(r=>r.role==="event");t||e.push(P(h.EVENT_HANDLER_MISSING_EVENT,"warning",{})),t&&!t.required&&e.push(P(h.EVENT_HANDLER_EVENT_NOT_REQUIRED,"warning",{}));}function Si(n,e){let t=n.roles.find(r=>r.role==="condition");t||e.push(P(h.CONDITIONAL_MISSING_CONDITION,"warning",{})),t&&!t.required&&e.push(P(h.CONDITIONAL_CONDITION_NOT_REQUIRED,"warning",{}));}function xi(n,e){n.action==="for"?n.roles.find(r=>r.role==="source")||e.push(P(h.FOR_LOOP_MISSING_SOURCE,"warning",{})):n.action==="while"&&(n.roles.find(r=>r.role==="condition")||e.push(P(h.WHILE_LOOP_MISSING_CONDITION,"warning",{})));}function wi(n,e={}){let t=new Map,{includeNotes:r=false}=e;for(let[o,i]of Object.entries(n)){let a=kt(i),s=a.items.some(c=>c.severity==="warning"||c.severity==="error"),l=r&&a.items.some(c=>c.severity==="note");(s||l)&&t.set(o,a);}return t}function Ai(n,e={}){let t=[],{showNotes:r=false,showCodes:o=true}=e;for(let[i,a]of n){let s=a.items.filter(u=>u.severity==="error"),l=a.items.filter(u=>u.severity==="warning"),c=a.items.filter(u=>u.severity==="note");if(s.length>0){t.push(` \u274C ${i}:`);for(let u of s){let p=o?` [${u.code}]`:"";t.push(` ERROR${p}: ${u.message}`),u.suggestion&&t.push(` \u{1F4A1} Suggestion: ${u.suggestion}`);}}if(l.length>0){t.push(` \u26A0\uFE0F ${i}:`);for(let u of l){let p=o?` [${u.code}]`:"";t.push(` ${p?`${u.code}: `:""}${u.message}`),u.suggestion&&t.push(` \u{1F4A1} ${u.suggestion}`);}}if(r&&c.length>0){t.push(` \u2139\uFE0F ${i}:`);for(let u of c){let p=o?` [${u.code}]`:"";t.push(` ${p?`${u.code}: `:""}${u.message}`);}}}return t.join(`
4
- `)}function Ci(n){let e=0,t=0,r=0,o={};for(let i of n.values())for(let a of i.items)a.severity==="error"?e++:a.severity==="warning"?t++:a.severity==="note"&&r++,o[a.code]=(o[a.code]||0)+1;return {totalCommands:n.size,errors:e,warnings:t,notes:r,byCode:o}}function Pi(n,e){let t=[];for(let r of e){let o=n.roles.find(i=>i.role===r.role);o&&(o.expectedTypes.length>0&&!o.expectedTypes.includes(r.type)&&(o.expectedTypes.includes("expression")||t.push({level:"error",role:r.role,message:`${n.action}.${r.role} expects type [${o.expectedTypes.join(", ")}], got '${r.type}'`,code:h.VALUE_TYPE_MISMATCH})),r.type==="selector"&&r.selectorKind&&o.selectorKinds&&o.selectorKinds.length>0&&(o.selectorKinds.includes(r.selectorKind)||t.push({level:"error",role:r.role,message:`${n.action}.${r.role} expects selector kind [${o.selectorKinds.join(", ")}], got '${r.selectorKind}'`,code:h.SELECTOR_KIND_MISMATCH})));}return t}function Tt(n){let e=[];if(!n.keywords)return {language:n.code,collisions:e};let t=new Map;for(let[o,i]of Object.entries(n.keywords)){if(!i||!i.primary)continue;let a=t.get(i.primary)||[];if(a.push({command:o,isPrimary:true}),t.set(i.primary,a),i.alternatives)for(let s of i.alternatives){let l=t.get(s)||[];l.push({command:o,isPrimary:false}),t.set(s,l);}}for(let[o,i]of t){let a=[...new Set(i.map(c=>c.command))];if(a.length<=1)continue;let s=i.filter(c=>c.isPrimary).length,l;s>=2?l="primary-primary":s===1?l="primary-alternative":l="alternative-alternative",e.push({keyword:o,commands:a.sort(),type:l});}let r={"primary-primary":0,"primary-alternative":1,"alternative-alternative":2};return e.sort((o,i)=>r[o.type]-r[i.type]),{language:n.code,collisions:e}}function Ri(n){let e=[];for(let[,t]of Object.entries(n)){let r=Tt(t);r.collisions.length>0&&e.push(r);}return e.sort((t,r)=>t.language.localeCompare(r.language))}var Se,bt,Oi=ht({"src/generators/schema-validator.ts"(){Ei(),Se=new Set(["put","append","prepend","log","throw","make","measure","return","swap","morph","beep","copy"]),bt=new Set(["compound","else","halt","continue","async","init","settle","focus","blur","return","js","measure","break","exit","beep"]);}});function ee(n){let e="complex";return n.startsWith("#")&&!n.includes(" ")?e="id":n.startsWith(".")&&!n.includes(" ")?e="class":n.startsWith("[")&&n.endsWith("]")?e="attribute":/^[a-z][a-z0-9]*$/i.test(n)&&(e="element"),{type:"selector",value:n,selectorKind:e}}function x(n,e){let t={type:"literal",value:n};return e!==void 0?{type:"literal",value:n,dataType:e}:t}function it(n){return Be(n)}function D(n){return {type:"reference",value:n}}function ke(n,e){return {type:"property-path",object:n,property:e}}function se(n,e,t){let r={kind:"command",action:n,roles:new Map(Object.entries(e))};return t!==void 0?{...r,metadata:t}:r}function at(n,e,t,r,o,i){let a=new Map;a.set("event",n);let s={kind:"event-handler",action:"on",roles:a,body:e};return t!==void 0&&(s.eventModifiers=t),r!==void 0&&(s.metadata=r),s}function st(n,e="then",t){let r={kind:"compound",action:"compound",roles:new Map,statements:n,chainType:e};return t!==void 0&&(r.metadata=t),r}function lt(n,e){return !e||e.length===0||e.includes(n)||e.includes("expression")?true:n==="property-path"?e.some(t=>["selector","reference","expression"].includes(t)):false}function _i(n,e){return n.possessive?.keywords?.[e]}var W=new Map,j=new Map,le=new Map,xe=null;function St(n,e){let t={...n};for(let r of Object.keys(e)){let o=e[r],i=n[r];o!==void 0&&(typeof o=="object"&&o!==null&&!Array.isArray(o)&&typeof i=="object"&&i!==null&&!Array.isArray(i)?t[r]=St(i,o):t[r]=o);}return t}function Ni(n,e){return St(n,e)}function Ae(n){if(!n.extends)return n;let e=j.get(n.extends);if(!e)return console.warn(`[Registry] Profile '${n.code}' extends '${n.extends}' but base is not registered. Make sure to import the base language before the variant.`),n;let t=Ae(e);return Ni(t,n)}function xt(n){xe=n;}var ut=new Map;function U(n){return n.split("-")[0]}function H(n){return n.includes("-")}function Ii(n){let e=W.get(n);if(!e&&H(n)){let t=U(n);e=W.get(t);}if(!e){let t=Array.from(W.keys()).join(", ");throw new Error(`Language '${n}' is not registered. Registered languages: ${t||"none"}. Import the language module first: import '@lokascript/semantic/languages/${n}';`)}return e}function Mi(n){let e=j.get(n);if(!e&&H(n)){let t=U(n);e=j.get(t);}if(!e){let t=Array.from(j.keys()).join(", ");throw new Error(`Language profile '${n}' is not registered. Registered languages: ${t||"none"}. Import the language module first: import '@lokascript/semantic/languages/${n}';`)}return Ae(e)}function Li(n){let e=W.get(n);return !e&&H(n)&&(e=W.get(U(n))),e}function $(n){let e=j.get(n);return !e&&H(n)&&(e=j.get(U(n))),e?Ae(e):void 0}function wt(){return Array.from(W.keys())}function Di(n,e){return Ii(e).tokenize(n)}function z(n){let e=le.get(n);if(!e&&H(n)&&(e=le.get(U(n))),e)return e;let t=ut.get(n);if(!t&&H(n)&&(t=ut.get(U(n))),t)return le.set(n,t),t;if(!xe)throw new Error(`No patterns registered for language '${n}'. Either import the language module or set a pattern generator.`);let r=Mi(n),o=xe(r);return le.set(n,o),o}var Te=.8,Bi=.6,qi=.15,Vi=.5,ct=.15,pt=.1,dt=new Set(["\u0628\u062F\u0644","\u063A\u064A\u0631","\u0623\u0636\u0641","\u0623\u0632\u0644","\u0636\u0639","\u0627\u062C\u0639\u0644","\u0639\u064A\u0646","\u0632\u062F","\u0627\u0646\u0642\u0635","\u0633\u062C\u0644","\u0623\u0638\u0647\u0631","\u0623\u062E\u0641","\u0634\u063A\u0644","\u0623\u0631\u0633\u0644","\u0631\u0643\u0632","\u0634\u0648\u0634","\u062A\u0648\u0642\u0641","\u0627\u0646\u0633\u062E","\u0627\u062D\u0630\u0641","\u0627\u0635\u0646\u0639","\u0627\u0646\u062A\u0638\u0631","\u0627\u0646\u062A\u0642\u0627\u0644","\u0623\u0648"]),Fi={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"]},zi=class{calculate(n){return this.calculateWithBreakdown(n).final}calculateWithBreakdown(n){let e=this.scoreRoleCoverage(n),t=this.scoreStemPenalty(n),r=this.scoreLanguageBoost(n),o=this.scoreLanguageAdjustment(n),i=e;return i=Math.max(Vi,i+t),i=Math.min(1,i+r),i=Math.max(0,Math.min(1,i+o)),{roleCoverage:e,stemPenalty:t,languageBoost:r,languageAdjustment:o,final:i}}scoreRoleCoverage(n){let{pattern:e,captured:t}=n,r=0,o=0,i=a=>e.extraction?.[a]?.default!==void 0;for(let a of e.template.tokens)if(a.type==="role")o+=1,t.has(a.role)&&(r+=1);else if(a.type==="group")for(let s of a.tokens)s.type==="role"&&(o+=Te,t.has(s.role)?r+=Te:i(s.role)&&(r+=Te*Bi));return o>0?r/o:1}scoreStemPenalty(n){let{stemMatchCount:e,totalKeywordMatches:t}=n;return e<=0||t<=0?0:-(e/t)*qi}scoreLanguageBoost(n){let{pattern:e}=n;if(e.language!=="ar")return 0;let t=e.template.tokens[0];return !t||t.type!=="literal"?0:dt.has(t.value)||t.alternatives?.some(r=>dt.has(r))?ct:0}scoreLanguageAdjustment(n){let{pattern:e,captured:t}=n;if(e.language!=="ar")return 0;let r=0;for(let[o,i]of t.entries()){let a=Fi[o];if(!a||a.length===0)continue;let s="metadata"in i?i.metadata:void 0;s&&typeof s.prepositionValue=="string"&&(a.includes(s.prepositionValue)?r+=.1:r-=.1);}return Math.max(-pt,Math.min(pt,r))}},Wi=new zi,ce=class Z{constructor(e){this.matchCache=new Map,this.stemMatchCount=0,this.totalKeywordMatches=0,this.confidenceModel=e??Wi;}matchPattern(e,t){let r=e.mark(),o=new Map;if(this.currentProfile=$(t.language),this.stemMatchCount=0,this.totalKeywordMatches=0,!this.matchTokenSequence(e,t.template.tokens,o))return e.reset(r),null;let a=this.confidenceModel.calculate({pattern:t,captured:o,stemMatchCount:this.stemMatchCount,totalKeywordMatches:this.totalKeywordMatches});return this.applyExtractionRules(t,o),{pattern:t,captured:o,consumedTokens:e.position()-r.position,confidence:a}}matchBest(e,t){this.matchCache.clear();let r=[],o=e.position();for(let a of t){let s=e.mark(),l=`${o}:${a.id}`,c;this.matchCache.has(l)?c=this.matchCache.get(l):(c=this.matchPattern(e,a),this.matchCache.set(l,c)),c&&r.push(c),e.reset(s);}if(r.length===0)return null;r.sort((a,s)=>{let l=s.pattern.priority-a.pattern.priority;return l!==0?l:s.confidence-a.confidence});let i=r[0];return this.matchPattern(e,i.pattern),i}matchTokenSequence(e,t,r){let o=t[0],i=o?.type==="literal"&&(o.value==="and"||o.value==="then"||o.alternatives?.includes("and")||o.alternatives?.includes("then"));if(this.currentProfile?.code==="ar"&&!i)for(;e.peek()?.kind==="conjunction";)e.advance();for(let a of t)if(!this.matchPatternToken(e,a,r)){if(this.isOptional(a))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(!r)return false;let o=this.getMatchType(r,t.value);if(o!=="none")return this.totalKeywordMatches++,o==="stem"&&this.stemMatchCount++,e.advance(),true;if(t.alternatives)for(let i of t.alternatives){let a=this.getMatchType(r,i);if(a!=="none")return this.totalKeywordMatches++,a==="stem"&&this.stemMatchCount++,e.advance(),true}return false}matchRoleToken(e,t,r){this.skipNoiseWords(e);let o=e.peek();if(!o)return t.optional||false;let i=this.tryMatchPossessiveExpression(e);if(i)return t.expectedTypes&&t.expectedTypes.length>0&&!t.expectedTypes.includes(i.type)&&!t.expectedTypes.includes("expression")?t.optional||false:(r.set(t.role,i),true);let a=this.tryMatchMethodCallExpression(e);if(a)return t.expectedTypes&&t.expectedTypes.length>0&&!t.expectedTypes.includes(a.type)&&!t.expectedTypes.includes("expression")?t.optional||false:(r.set(t.role,a),true);let s=this.tryMatchPossessiveSelectorExpression(e);if(s)return t.expectedTypes&&t.expectedTypes.length>0&&!lt(s.type,t.expectedTypes)?t.optional||false:(r.set(t.role,s),true);let l=this.tryMatchPropertyAccessExpression(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 c=this.tryMatchSelectorPropertyExpression(e);if(c)return t.expectedTypes&&t.expectedTypes.length>0&&!lt(c.type,t.expectedTypes)?t.optional||false:(r.set(t.role,c),true);let u=this.tokenToSemanticValue(o);return !u||t.expectedTypes&&t.expectedTypes.length>0&&!t.expectedTypes.includes(u.type)?t.optional||false:(r.set(t.role,u),e.advance(),true)}tryMatchPossessiveExpression(e){let t=e.peek();if(!t||!this.currentProfile)return null;let r=(t.normalized||t.value).toLowerCase(),o=_i(this.currentProfile,r);if(!o)return null;let i=e.mark();e.advance();let a=e.peek();if(!a)return e.reset(i),null;if(a.kind==="identifier"||a.kind==="keyword"&&!this.isStructuralKeyword(a.value)||a.kind==="selector"&&a.value.startsWith("*")||a.kind==="selector"&&a.value.startsWith("@")||a.kind==="selector"&&a.value.startsWith(".")&&/^\.[a-zA-Z_]\w*/.test(a.value)){e.advance();let s=a.value;a.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()),ke(D(o),l)}return e.reset(i),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 o=e.peek();if(!o||o.kind!=="operator"||o.value!==".")return e.reset(r),null;e.advance();let i=e.peek();if(!i||i.kind!=="identifier")return e.reset(r),null;e.advance();let a=e.peek();if(!a||a.kind!=="punctuation"||a.value!=="(")return e.reset(r),null;e.advance();let s=[];for(;!e.isAtEnd()&&s.length<Z.MAX_METHOD_ARGS;){let c=e.peek();if(!c)break;if(c.kind==="punctuation"&&c.value===")"){e.advance();break}if(c.kind==="punctuation"&&c.value===","){e.advance();continue}s.push(c.value),e.advance();}return {type:"expression",raw:`${t.value}.${i.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 o=e.peek();if(!o||o.kind!=="operator"||o.value!==".")return e.reset(r),null;e.advance();let i=e.peek();if(!i||i.kind!=="identifier")return e.reset(r),null;e.advance();let a=`${t.value}.${i.value}`,s=1;for(;!e.isAtEnd()&&s<Z.MAX_PROPERTY_DEPTH;){let c=e.peek();if(!c||c.kind!=="operator"||c.value!==".")break;e.advance();let u=e.peek();if(!u||u.kind!=="identifier")break;e.advance(),a+=`.${u.value}`,s++;}let l=e.peek();if(l&&l.kind==="punctuation"&&l.value==="("){e.advance();let c=[],u=0;for(;!e.isAtEnd()&&c.length<Z.MAX_METHOD_ARGS;){let d=e.peek();if(!d)break;if(d.kind==="punctuation"&&d.value===")"){if(u===0){e.advance();break}u--;}if(d.kind==="punctuation"&&d.value==="("&&u++,d.kind==="punctuation"&&d.value===","){e.advance();continue}c.push(d.value),e.advance();}return {type:"expression",raw:`${a}(${c.join(", ")})`}}return {type:"expression",raw:a}}tryMatchPossessiveSelectorExpression(e){let t=e.peek();if(!t||t.kind!=="selector")return null;let r=e.mark();e.advance();let o=e.peek();if(!o||o.kind!=="punctuation"||o.value!=="'s")return e.reset(r),null;e.advance();let i=e.peek();return !i||i.kind!=="selector"&&i.kind!=="identifier"?(e.reset(r),null):(e.advance(),ke(ee(t.value),i.value))}tryMatchSelectorPropertyExpression(e){let t=e.peek();if(!t||t.kind!=="selector"||!t.value.startsWith("#"))return null;let r=e.mark();e.advance();let o=e.peek();if(!o||o.kind!=="selector"||!o.value.startsWith("."))return e.reset(r),null;let i=e.peek(1);i&&i.kind,e.advance();let a=o.value.slice(1);return ke(ee(t.value),a)}matchGroupToken(e,t,r){let o=e.mark(),i=new Set(r.keys());if(!this.matchTokenSequence(e,t.tokens,r)){e.reset(o);for(let s of r.keys())i.has(s)||r.delete(s);return t.optional||false}return true}getMatchType(e,t){return e.value===t?"exact":e.normalized===t?"normalized":e.stem===t&&e.stemConfidence!==void 0&&e.stemConfidence>=.7?"stem":e.kind==="keyword"&&e.value.toLowerCase()===t.toLowerCase()?"case-insensitive":"none"}tokenToSemanticValue(e){switch(e.kind){case "selector":return ee(e.value);case "literal":return this.parseLiteralValue(e.value);case "keyword":let t=(e.normalized||e.value).toLowerCase();return it(t)?D(t):x(e.normalized||e.value);case "identifier":if(e.value.startsWith(":"))return D(e.value);let r=e.value.toLowerCase();return it(r)?D(r):{type:"expression",raw:e.value};case "url":return x(e.value,"string");default:return null}}parseLiteralValue(e){if(e.startsWith('"')||e.startsWith("'")||e.startsWith("`")||e.startsWith("\u300C")){let o=e.slice(1,-1);return x(o,"string")}if(e==="true")return x(true,"boolean");if(e==="false")return x(false,"boolean");let t=e.match(/^(\d+(?:\.\d+)?)(ms|s|m|h)?$/);if(t){let o=parseFloat(t[1]);return t[2]?x(e,"duration"):x(o,"number")}let r=parseFloat(e);return isNaN(r)?x(e,"string"):x(r,"number")}applyExtractionRules(e,t){for(let[r,o]of Object.entries(e.extraction))t.has(r)||(o.value!==void 0?t.set(r,{type:"literal",value:o.value}):o.default&&t.set(r,o.default));}isOptional(e){return e.type!=="literal"&&e.optional===true}skipNoiseWords(e){let t=e.peek();if(!t)return;let r=t.value.toLowerCase();if(Z.ENGLISH_NOISE_WORDS.has(r)){let o=e.mark();e.advance();let i=e.peek();if(i&&(i.kind==="selector"||i.kind==="identifier"))return;e.reset(o);}r==="class"&&e.advance();}extractEventModifiers(e){let t={},r=false;for(;!e.isAtEnd();){let o=e.peek();if(!o||o.kind!=="event-modifier")break;let i=o.metadata;if(!i)break;switch(r=true,i.modifierName){case "once":t.once=true;break;case "debounce":typeof i.value=="number"&&(t.debounce=i.value);break;case "throttle":typeof i.value=="number"&&(t.throttle=i.value);break;case "queue":(i.value==="first"||i.value==="last"||i.value==="all"||i.value==="none")&&(t.queue=i.value);break}e.advance();}return r?t:void 0}};ce.MAX_PROPERTY_DEPTH=10;ce.MAX_METHOD_ARGS=20;ce.ENGLISH_NOISE_WORDS=new Set(["the","a","an"]);var At=ce,F=new At;function ji(n){return Li(n)}function be(n,e){return Di(n,e)}function Ct(){return wt()}var Ui={ko:{\uD074\uB9AD:"click",\uC785\uB825:"input",\uBCC0\uACBD:"change",\uC81C\uCD9C:"submit",\uD0A4\uB2E4\uC6B4:"keydown",\uD0A4\uC5C5:"keyup",\uB9C8\uC6B0\uC2A4\uC624\uBC84:"mouseover",\uB9C8\uC6B0\uC2A4\uC544\uC6C3:"mouseout",\uB9C8\uC6B0\uC2A4\uB2E4\uC6B4:"mousedown",\uB9C8\uC6B0\uC2A4\uC5C5:"mouseup",\uD3EC\uCEE4\uC2A4:"focus",\uBE14\uB7EC:"blur",\uB85C\uB4DC:"load",\uB9AC\uC0AC\uC774\uC988:"resize",\uC2A4\uD06C\uB864:"scroll"},ja:{\u30AF\u30EA\u30C3\u30AF:"click",\u5165\u529B:"input",\u5909\u66F4:"change",\u9001\u4FE1:"submit",\u30AD\u30FC\u30C0\u30A6\u30F3:"keydown",\u30AD\u30FC\u30A2\u30C3\u30D7:"keyup",\u30AD\u30FC\u30D7\u30EC\u30B9:"keypress",\u30DE\u30A6\u30B9\u30AA\u30FC\u30D0\u30FC:"mouseover",\u30DE\u30A6\u30B9\u30A2\u30A6\u30C8:"mouseout",\u30DE\u30A6\u30B9\u62BC\u4E0B:"mousedown",\u30DE\u30A6\u30B9\u89E3\u653E:"mouseup",\u30D5\u30A9\u30FC\u30AB\u30B9:"focus",\u30D6\u30E9\u30FC:"blur",\u30ED\u30FC\u30C9:"load",\u8AAD\u307F\u8FBC\u307F:"load",\u30B5\u30A4\u30BA\u5909\u66F4:"resize",\u30B9\u30AF\u30ED\u30FC\u30EB:"scroll"},ar:{\u0627\u0644\u0646\u0642\u0631:"click",\u0646\u0642\u0631:"click",\u0627\u0644\u0625\u062F\u062E\u0627\u0644:"input",\u0625\u062F\u062E\u0627\u0644:"input",\u0627\u0644\u062A\u063A\u064A\u064A\u0631:"change",\u062A\u063A\u064A\u064A\u0631:"change",\u0627\u0644\u0625\u0631\u0633\u0627\u0644:"submit",\u0625\u0631\u0633\u0627\u0644:"submit","\u0636\u063A\u0637 \u0627\u0644\u0645\u0641\u062A\u0627\u062D":"keydown","\u0631\u0641\u0639 \u0627\u0644\u0645\u0641\u062A\u0627\u062D":"keyup","\u062A\u0645\u0631\u064A\u0631 \u0627\u0644\u0645\u0627\u0648\u0633":"mouseover",\u0627\u0644\u062A\u0631\u0643\u064A\u0632:"focus",\u062A\u062D\u0645\u064A\u0644:"load",\u062A\u0645\u0631\u064A\u0631:"scroll"},es:{clic:"click",click:"click",entrada:"input",cambio:"change",env\u00EDo:"submit",enviar:"submit","tecla abajo":"keydown","tecla arriba":"keyup","rat\xF3n encima":"mouseover","rat\xF3n fuera":"mouseout",enfoque:"focus",desenfoque:"blur",carga:"load",desplazamiento:"scroll"},tr:{t\u0131klama:"click",t\u0131kla:"click",t\u0131k:"click",giri\u015F:"input",girdi:"input",de\u011Fi\u015Fiklik:"change",de\u011Fi\u015Fim:"change",g\u00F6nderme:"submit",g\u00F6nder:"submit",tu\u015Fbasma:"keydown",tu\u015Fb\u0131rakma:"keyup",fare_bas:"mousedown",fare_b\u0131rak:"mouseup",farei\u00E7inde:"mouseover",fared\u0131\u015F\u0131nda:"mouseout",odaklanma:"focus",odak:"focus",bulan\u0131kl\u0131k:"blur",y\u00FCkleme:"load",y\u00FCkle:"load",boyut_de\u011Fi\u015Ftir:"resize",kayd\u0131rma:"scroll"},pt:{clique:"click",clicar:"click",click:"click",entrada:"input",inserir:"input",mudan\u00E7a:"change",mudanca:"change",alterar:"change",envio:"submit",enviar:"submit","tecla baixo":"keydown","tecla cima":"keyup","pressionar tecla":"keydown","soltar tecla":"keyup","mouse sobre":"mouseover","mouse fora":"mouseout",foco:"focus",focar:"focus",desfoque:"blur",desfocar:"blur",carregar:"load",carregamento:"load",rolagem:"scroll",rolar:"scroll"},zh:{\u70B9\u51FB:"click",\u5355\u51FB:"click",\u53CC\u51FB:"dblclick",\u8F93\u5165:"input",\u6539\u53D8:"change",\u53D8\u5316:"change",\u53D8\u66F4:"change",\u63D0\u4EA4:"submit",\u53D1\u9001:"submit",\u6309\u952E:"keydown",\u952E\u5165:"keydown",\u677E\u952E:"keyup",\u9F20\u6807\u8FDB\u5165:"mouseover",\u9F20\u6807\u79FB\u5165:"mouseover",\u9F20\u6807\u79BB\u5F00:"mouseout",\u9F20\u6807\u79FB\u51FA:"mouseout",\u7126\u70B9:"focus",\u805A\u7126:"focus",\u5931\u7126:"blur",\u6A21\u7CCA:"blur",\u52A0\u8F7D:"load",\u8F7D\u5165:"load",\u6EDA\u52A8:"scroll"},fr:{clic:"click",cliquer:"click",click:"click",saisie:"input",entr\u00E9e:"input",changement:"change",changer:"change",soumettre:"submit",soumission:"submit",envoi:"submit","touche bas":"keydown","touche haut":"keyup","souris dessus":"mouseover","souris dehors":"mouseout",focus:"focus",focaliser:"focus",d\u00E9focus:"blur",d\u00E9focaliser:"blur",chargement:"load",charger:"load",d\u00E9filement:"scroll",d\u00E9filer:"scroll"},de:{klick:"click",klicken:"click",click:"click",eingabe:"input",eingeben:"input",\u00E4nderung:"change",\u00E4ndern:"change",absenden:"submit",einreichen:"submit","taste runter":"keydown","taste hoch":"keyup","maus \xFCber":"mouseover","maus raus":"mouseout",fokus:"focus",fokussieren:"focus",defokussieren:"blur",unsch\u00E4rfe:"blur",laden:"load",ladung:"load",scrollen:"scroll",bl\u00E4ttern:"scroll"},id:{klik:"click",click:"click",masukan:"input",input:"input",ubah:"change",perubahan:"change",kirim:"submit","tekan tombol":"keydown","lepas tombol":"keyup","mouse masuk":"mouseover","mouse keluar":"mouseout",fokus:"focus",blur:"blur",muat:"load",memuat:"load",gulir:"scroll",menggulir:"scroll"},bn:{\u0995\u09CD\u09B2\u09BF\u0995:"click",\u0987\u09A8\u09AA\u09C1\u099F:"input",\u099C\u09AE\u09BE:"submit",\u09B2\u09CB\u09A1:"load",\u09B8\u09CD\u0995\u09CD\u09B0\u09CB\u09B2:"scroll",\u09B0\u09BF\u09B8\u09BE\u0987\u099C:"resize",\u099D\u09BE\u09AA\u09B8\u09BE:"blur",\u09AB\u09CB\u0995\u09BE\u09B8:"focus",\u09AA\u09B0\u09BF\u09AC\u09B0\u09CD\u09A4\u09A8:"change"},qu:{click:"click","\xF1it'iy":"click",\u00F1itiy:"click",yaykuchiy:"input",yaykuy:"input",tikray:"change","t'ikray":"change",apachiy:"submit",kachay:"submit","llave uray":"keydown","llave hawa":"keyup","q'away":"focus",qhaway:"focus",paqariy:"blur","mana q'away":"blur",cargay:"load",apakuy:"load",apamuy:"load",kunray:"scroll",muyuy:"scroll",hatun_kay:"resize"},sw:{bofya:"click",click:"click",kubofya:"click",ingiza:"input",kubadilisha:"change",mabadiliko:"change",tuma:"submit",kutuma:"submit","bonyeza chini":"keydown","bonyeza juu":"keyup","panya juu":"mouseover","panya nje":"mouseout",lenga:"focus",kulenga:"focus",blur:"blur",pakia:"load",kupakia:"load",sogeza:"scroll",kusogeza:"scroll"}};var Gi={action:"toggle",description:"Toggle a class or attribute on/off",category:"dom-class",primaryRole:"patient",roles:[{role:"patient",description:"The class or attribute to toggle",required:true,expectedTypes:["selector"],selectorKinds:["class","attribute"],svoPosition:1,sovPosition:2},{role:"destination",description:"The target element (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:2,sovPosition:1}],errorCodes:["MISSING_ARGUMENT","NO_VALID_CLASS_NAMES","INVALID_CSS_PROPERTY"],preconditions:[{condition:"Command has at least one argument",errorCode:"MISSING_ARGUMENT",message:"toggle command requires an argument"},{condition:"Class names are valid CSS identifiers",errorCode:"NO_VALID_CLASS_NAMES",message:"toggle command: no valid class names found"}],recoveryHints:{MISSING_ARGUMENT:"Add a class selector (.classname) or attribute to toggle",NO_VALID_CLASS_NAMES:"Ensure class names start with a dot (.) and are valid CSS identifiers",INVALID_CSS_PROPERTY:"Check CSS property name syntax (use kebab-case)"}},Ki={action:"add",description:"Add a class or attribute to an element",category:"dom-class",primaryRole:"patient",roles:[{role:"patient",description:"The class or attribute to add",required:true,expectedTypes:["selector"],svoPosition:1,sovPosition:2},{role:"destination",description:"The target element (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:2,sovPosition:1,markerOverride:{en:"to"}}],errorCodes:["MISSING_ARGUMENT","NO_VALID_CLASS_NAMES","PROPERTY_REQUIRES_VALUE"],preconditions:[{condition:"Command has at least one argument",errorCode:"MISSING_ARGUMENT",message:"add command requires an argument"}],recoveryHints:{MISSING_ARGUMENT:"Add a class selector (.classname) or attribute to add",NO_VALID_CLASS_NAMES:"Ensure class names start with a dot (.) and are valid CSS identifiers",PROPERTY_REQUIRES_VALUE:"When adding a property (*prop), provide a value argument"}},Yi={action:"remove",description:"Remove a class or attribute from an element",category:"dom-class",primaryRole:"patient",roles:[{role:"patient",description:"The class or attribute to remove",required:true,expectedTypes:["selector"],svoPosition:1,sovPosition:2},{role:"source",description:"The element to remove from (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:2,sovPosition:1}],errorCodes:["MISSING_ARGUMENT","NO_VALID_CLASS_NAMES"],preconditions:[{condition:"Command has at least one argument",errorCode:"MISSING_ARGUMENT",message:"remove command requires an argument"}],recoveryHints:{MISSING_ARGUMENT:"Add a class selector (.classname) or attribute to remove",NO_VALID_CLASS_NAMES:"Ensure class names start with a dot (.) and are valid CSS identifiers"}},Qi={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"}}],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"}},Xi={action:"set",description:"Set a property or variable to a value",category:"variable",primaryRole:"destination",roles:[{role:"destination",description:"The property or variable to set",required:true,expectedTypes:["selector","reference","expression"],svoPosition:1,sovPosition:1,markerOverride:{en:"",ja:"\u3092",ko:"\uB97C",tr:"i",ar:"",sw:"",tl:"",bn:"\u0995\u09C7",qu:"ta"}},{role:"patient",description:"The value to set",required:true,expectedTypes:["literal","expression","reference"],svoPosition:2,sovPosition:2,markerOverride:{en:"to",es:"a",pt:"para",fr:"\xE0",de:"auf",id:"ke",ja:"\u306B",ko:"\uC73C\uB85C",tr:"e",ar:"\u0625\u0644\u0649",sw:"kwenye",tl:"sa",bn:"\u09A4\u09C7",qu:"man"}}],errorCodes:["MISSING_TARGET","INVALID_TARGET","MISSING_VALUE","INVALID_SYNTAX"],preconditions:[{condition:"Command has a target variable or property",errorCode:"MISSING_TARGET",message:"set command requires a target"},{condition:"Target is a valid variable or property reference",errorCode:"INVALID_TARGET",message:"set command target must be a string or object literal"},{condition:'Value is specified with "to" keyword',errorCode:"MISSING_VALUE",message:'set command requires a value (use "to" keyword)'}],recoveryHints:{MISSING_TARGET:"Add a target: set :variable to value OR set element.property to value",INVALID_TARGET:'Use local variable (:name), element property (el.prop), or "the X of Y" syntax',MISSING_VALUE:'Add "to <value>" to specify what to set',INVALID_SYNTAX:"Use syntax: set <target> to <value>"}},Ji={action:"show",description:"Make an element visible",category:"dom-visibility",primaryRole:"patient",roles:[{role:"patient",description:"The element to show",required:true,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:1,sovPosition:1},{role:"style",description:"Animation style (fade, slide, etc.)",required:false,expectedTypes:["literal"],svoPosition:2,sovPosition:2}]},Zi={action:"hide",description:"Make an element invisible",category:"dom-visibility",primaryRole:"patient",roles:[{role:"patient",description:"The element to hide",required:true,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:1,sovPosition:1},{role:"style",description:"Animation style (fade, slide, etc.)",required:false,expectedTypes:["literal"],svoPosition:2,sovPosition:2}]},ea={action:"on",description:"Handle an event",category:"event",primaryRole:"event",hasBody:true,roles:[{role:"event",description:"The event to handle",required:true,expectedTypes:["literal"],svoPosition:1,sovPosition:2},{role:"source",description:"The element to listen on (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:2,sovPosition:1}]},ta={action:"trigger",description:"Trigger/dispatch an event",category:"event",primaryRole:"event",roles:[{role:"event",description:"The event to trigger (supports namespaced events like draggable:start)",required:true,expectedTypes:["literal","expression"],svoPosition:1,sovPosition:2},{role:"destination",description:"The target element (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:2,sovPosition:1}]},ra={action:"wait",description:"Wait for a duration or event",category:"async",primaryRole:"patient",roles:[{role:"patient",description:"Duration or event to wait for",required:true,expectedTypes:["literal","expression"],svoPosition:1,sovPosition:1}]},na={action:"fetch",description:"Fetch data from a URL",category:"async",primaryRole:"source",roles:[{role:"source",description:"The URL to fetch from",required:true,expectedTypes:["literal","expression"],svoPosition:1,sovPosition:1,renderOverride:{en:""}},{role:"responseType",description:"Response format (json, text, html, blob, etc.)",required:false,expectedTypes:["literal","expression"],svoPosition:2,sovPosition:2},{role:"method",description:"HTTP method (GET, POST, etc.)",required:false,expectedTypes:["literal"],svoPosition:3,sovPosition:3},{role:"destination",description:"Where to store the result",required:false,expectedTypes:["selector","reference"],svoPosition:4,sovPosition:4}]},oa={action:"increment",description:"Increment a numeric value",category:"variable",primaryRole:"patient",roles:[{role:"patient",description:"The value to increment",required:true,expectedTypes:["selector","reference","expression"],svoPosition:1,sovPosition:1},{role:"quantity",description:"Amount to increment by (defaults to 1)",required:false,expectedTypes:["literal"],default:{type:"literal",value:1,dataType:"number"},svoPosition:2,sovPosition:2,markerOverride:{en:"by"}}]},ia={action:"decrement",description:"Decrement a numeric value",category:"variable",primaryRole:"patient",roles:[{role:"patient",description:"The value to decrement",required:true,expectedTypes:["selector","reference","expression"],svoPosition:1,sovPosition:1},{role:"quantity",description:"Amount to decrement by (defaults to 1)",required:false,expectedTypes:["literal"],default:{type:"literal",value:1,dataType:"number"},svoPosition:2,sovPosition:2,markerOverride:{en:"by"}}]},aa={action:"append",description:"Append content to an element",category:"dom-content",primaryRole:"patient",roles:[{role:"patient",description:"The content to append",required:true,expectedTypes:["literal","selector","expression"],svoPosition:1,sovPosition:2},{role:"destination",description:"The element to append to",required:true,expectedTypes:["selector","reference"],svoPosition:2,sovPosition:1,markerOverride:{en:"to"}}]},sa={action:"prepend",description:"Prepend content to an element",category:"dom-content",primaryRole:"patient",roles:[{role:"patient",description:"The content to prepend",required:true,expectedTypes:["literal","selector","expression"],svoPosition:1,sovPosition:2},{role:"destination",description:"The element to prepend to",required:true,expectedTypes:["selector","reference"],svoPosition:2,sovPosition:1,markerOverride:{en:"to"}}]},la={action:"log",description:"Log a value to the console",category:"variable",primaryRole:"patient",roles:[{role:"patient",description:"The value to log",required:true,expectedTypes:["literal","selector","reference","expression"],svoPosition:1,sovPosition:1}]},ua={action:"get",description:"Get a value from a source",category:"variable",primaryRole:"source",roles:[{role:"source",description:"The source to get from",required:true,expectedTypes:["selector","reference","expression"],svoPosition:1,sovPosition:2,markerOverride:{en:"",es:"",pt:"",fr:"",de:"",ja:"\u3092",zh:"",ko:"\uB97C",ar:"\u0639\u0644\u0649",tr:"i",id:"",sw:"",tl:"",bn:"\u0995\u09C7",qu:"ta"}},{role:"destination",description:"Where to store the result (optional)",required:false,expectedTypes:["reference"],svoPosition:2,sovPosition:1}]},ca={action:"take",description:"Take content from a source element",category:"dom-content",primaryRole:"patient",roles:[{role:"patient",description:"The class or element to take",required:true,expectedTypes:["selector"],svoPosition:1,sovPosition:2},{role:"source",description:"The element to take from (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:2,sovPosition:1}]},pa={action:"make",description:"Create a new element",category:"dom-content",primaryRole:"patient",roles:[{role:"patient",description:"The element type or selector to create",required:true,expectedTypes:["literal","selector"],svoPosition:1,sovPosition:1}]},da={action:"halt",description:"Halt/stop execution or event propagation",category:"control-flow",primaryRole:"patient",roles:[{role:"patient",description:"What to halt (event, default, bubbling, etc.)",required:false,expectedTypes:["literal","reference","expression"],svoPosition:1,sovPosition:1}]},ma={action:"settle",description:"Wait for animations/transitions to settle",category:"async",primaryRole:"patient",roles:[{role:"patient",description:"The element to settle (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:1,sovPosition:1}]},fa={action:"throw",description:"Throw an error",category:"control-flow",primaryRole:"patient",roles:[{role:"patient",description:"The error message or object to throw",required:true,expectedTypes:["literal","expression"],svoPosition:1,sovPosition:1}]},va={action:"send",description:"Send an event to an element",category:"event",primaryRole:"event",roles:[{role:"event",description:"The event to send",required:true,expectedTypes:["literal","expression"],svoPosition:1,sovPosition:2},{role:"destination",description:"The target element (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:2,sovPosition:1,markerOverride:{en:"to",ja:"\u306B",ar:"\u0625\u0644\u0649",es:"a",ko:"\uC5D0\uAC8C",zh:"\u5230",tr:"-e",pt:"para",fr:"\xE0",de:"an",id:"ke",qu:"-man",sw:"kwa"}}]},ha={action:"if",description:"Conditional execution",category:"control-flow",primaryRole:"condition",hasBody:true,roles:[{role:"condition",description:"The condition to evaluate",required:true,expectedTypes:["expression"],svoPosition:1,sovPosition:1}]},ya={action:"unless",description:"Negated conditional execution (executes when condition is false)",category:"control-flow",primaryRole:"condition",hasBody:true,roles:[{role:"condition",description:"The condition to evaluate (body executes when false)",required:true,expectedTypes:["expression"],svoPosition:1,sovPosition:1}]},ga={action:"else",description:"Else branch of conditional",category:"control-flow",primaryRole:"patient",hasBody:true,roles:[]},Ea={action:"repeat",description:"Repeat a block of commands",category:"control-flow",primaryRole:"loopType",hasBody:true,roles:[{role:"loopType",description:"Loop variant: forever, times, for, while, until, until-event",required:true,expectedTypes:["literal"],svoPosition:0,sovPosition:0},{role:"quantity",description:"Number of times to repeat",required:false,expectedTypes:["literal","expression"],svoPosition:1,sovPosition:1},{role:"event",description:"Event to wait for (terminates loop)",required:false,expectedTypes:["literal","expression"],svoPosition:2,sovPosition:2},{role:"source",description:"Element to listen for event on",required:false,expectedTypes:["selector","reference"],svoPosition:3,sovPosition:3}],notes:'Can also use "repeat forever", "repeat until condition", or "repeat until event X from Y"'},ka={action:"for",description:"Iterate over a collection",category:"control-flow",primaryRole:"patient",hasBody:true,roles:[{role:"patient",description:"The iteration variable",required:true,expectedTypes:["reference"],svoPosition:1,sovPosition:2},{role:"source",description:"The collection to iterate over",required:true,expectedTypes:["selector","reference","expression"],svoPosition:2,sovPosition:1,markerOverride:{en:"in"}}]},Ta={action:"while",description:"Loop while condition is true",category:"control-flow",primaryRole:"condition",hasBody:true,roles:[{role:"condition",description:"The condition to check",required:true,expectedTypes:["expression"],svoPosition:1,sovPosition:1}]},ba={action:"continue",description:"Continue to next loop iteration",category:"control-flow",primaryRole:"patient",roles:[]},Sa={action:"go",description:"Navigate to a URL",category:"navigation",primaryRole:"destination",roles:[{role:"destination",description:"The URL to navigate to",required:true,expectedTypes:["literal","expression"],svoPosition:1,sovPosition:1,markerOverride:{en:"to"},renderOverride:{en:""}}]},xa={action:"transition",description:"Transition an element with animation",category:"dom-visibility",primaryRole:"patient",roles:[{role:"patient",description:"The property to transition (opacity, *background-color, etc.)",required:true,expectedTypes:["literal"],svoPosition:1,sovPosition:2,markerOverride:{en:"",ar:"",tl:"",sw:""}},{role:"goal",description:"The target value to transition to",required:true,expectedTypes:["literal","expression"],svoPosition:2,sovPosition:3,markerOverride:{en:"to",ar:"\u0625\u0644\u0649",tl:"sa",sw:"kwenye",bn:"\u09A4\u09C7",qu:"man",es:"a",pt:"para",fr:"\xE0",de:"auf",ja:"\u306B",ko:"\uC73C\uB85C",tr:"e",id:"ke"}},{role:"destination",description:"The target element (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:3,sovPosition:1},{role:"duration",description:"Transition duration (over 500ms, for 2 seconds)",required:false,expectedTypes:["literal"],svoPosition:4,sovPosition:4,markerOverride:{en:"over"}},{role:"style",description:"Easing function (ease-in, linear, etc.)",required:false,expectedTypes:["literal"],svoPosition:5,sovPosition:5}]},wa={action:"clone",description:"Clone an element",category:"dom-content",primaryRole:"patient",roles:[{role:"patient",description:"The element to clone",required:true,expectedTypes:["selector","reference"],svoPosition:1,sovPosition:2},{role:"destination",description:"Where to put the clone",required:false,expectedTypes:["selector","reference"],svoPosition:2,sovPosition:1,markerOverride:{en:"into"}}]},Aa={action:"focus",description:"Focus an element",category:"dom-content",primaryRole:"patient",roles:[{role:"patient",description:"The element to focus (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:1,sovPosition:1}]},Ca={action:"blur",description:"Remove focus from an element",category:"dom-content",primaryRole:"patient",roles:[{role:"patient",description:"The element to blur (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:1,sovPosition:1}]},Pa={action:"call",description:"Call a function",category:"control-flow",primaryRole:"patient",roles:[{role:"patient",description:"The function to call",required:true,expectedTypes:["expression","reference"],svoPosition:1,sovPosition:1}]},Ra={action:"return",description:"Return a value from a function",category:"control-flow",primaryRole:"patient",roles:[{role:"patient",description:"The value to return",required:false,expectedTypes:["literal","expression","reference"],svoPosition:1,sovPosition:1}]},Oa={action:"js",description:"Execute raw JavaScript code",category:"control-flow",primaryRole:"patient",hasBody:true,roles:[{role:"patient",description:"The JavaScript code to execute",required:false,expectedTypes:["expression"],svoPosition:1,sovPosition:1}]},_a={action:"async",description:"Execute commands asynchronously",category:"async",primaryRole:"patient",hasBody:true,roles:[]},Na={action:"tell",description:"Execute commands in context of another element",category:"control-flow",primaryRole:"destination",hasBody:true,roles:[{role:"destination",description:"The element to tell",required:true,expectedTypes:["selector","reference"],svoPosition:1,sovPosition:1,markerOverride:{en:""}}]},Ia={action:"default",description:"Set a default value for a variable",category:"variable",primaryRole:"destination",roles:[{role:"destination",description:"The variable to set default for",required:true,expectedTypes:["reference"],svoPosition:1,sovPosition:1,markerOverride:{en:"",ar:"",tl:"",sw:"",bn:"\u0995\u09C7",qu:"ta"}},{role:"patient",description:"The default value",required:true,expectedTypes:["literal","expression"],svoPosition:2,sovPosition:2,markerOverride:{en:"to",ar:"\u0625\u0644\u0649",tl:"sa",sw:"kwenye",bn:"\u09A4\u09C7",qu:"man"}}]},Ma={action:"init",description:"Initialization block that runs once",category:"control-flow",primaryRole:"patient",hasBody:true,roles:[]},La={action:"behavior",description:"Define a reusable behavior",category:"control-flow",primaryRole:"patient",hasBody:true,roles:[{role:"patient",description:"The behavior name (PascalCase identifier)",required:true,expectedTypes:["literal","reference","expression"],svoPosition:1,sovPosition:1}]},Da={action:"install",description:"Install a behavior on an element",category:"control-flow",primaryRole:"patient",roles:[{role:"patient",description:"The behavior name to install",required:true,expectedTypes:["literal","reference","expression"],svoPosition:1,sovPosition:2},{role:"destination",description:"Element to install on (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:2,sovPosition:1}]},$a={action:"measure",description:"Measure element dimensions (x, y, width, height, etc.)",category:"dom-content",primaryRole:"patient",roles:[{role:"patient",description:"Property to measure (x, y, width, height, top, left, etc.)",required:false,expectedTypes:["literal","expression"],svoPosition:1,sovPosition:1},{role:"source",description:"Element to measure (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:2,sovPosition:2,markerOverride:{en:"of"}}]},Ba={action:"swap",description:"Swap DOM content using various strategies (innerHTML, outerHTML, delete, etc.)",category:"dom-content",primaryRole:"destination",roles:[{role:"method",description:"The swap strategy (innerHTML, outerHTML, beforebegin, afterend, delete)",required:false,expectedTypes:["literal"],svoPosition:1,sovPosition:3,markerOverride:{en:""}},{role:"destination",description:"The element to swap content in/for",required:true,expectedTypes:["selector","reference"],svoPosition:2,sovPosition:1,markerOverride:{en:"of"}},{role:"patient",description:"The content to swap in (optional for delete)",required:false,expectedTypes:["literal","expression","selector"],svoPosition:3,sovPosition:2,markerOverride:{en:"with"}}]},qa={action:"morph",description:"Morph an element into another using DOM diffing",category:"dom-content",primaryRole:"destination",roles:[{role:"destination",description:"The element to morph",required:true,expectedTypes:["selector","reference"],svoPosition:1,sovPosition:1,markerOverride:{en:""}},{role:"patient",description:"The target content/element to morph into",required:true,expectedTypes:["literal","expression","selector"],svoPosition:2,sovPosition:2,markerOverride:{en:"to"}}]},Va={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}]},Fa={action:"break",description:"Exit from the current loop",category:"control-flow",primaryRole:"patient",roles:[]},za={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}]},Wa={action:"exit",description:"Exit from the current event handler",category:"control-flow",primaryRole:"patient",roles:[]},ja={action:"pick",description:"Select a random element from a collection",category:"variable",primaryRole:"patient",roles:[{role:"patient",description:"The items to pick from",required:true,expectedTypes:["literal","expression","reference"],svoPosition:1,sovPosition:1},{role:"source",description:'The array to pick from (with "from" keyword)',required:false,expectedTypes:["reference","expression"],svoPosition:2,sovPosition:2}]},Ua={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}]},Pt={toggle:Gi,add:Ki,remove:Yi,put:Qi,set:Xi,show:Ji,hide:Zi,on:ea,trigger:ta,wait:ra,fetch:na,increment:oa,decrement:ia,append:aa,prepend:sa,log:la,get:ua,take:ca,make:pa,halt:da,settle:ma,throw:fa,send:va,if:ha,unless:ya,else:ga,repeat:Ea,for:ka,while:Ta,continue:ba,go:Sa,transition:xa,clone:wa,focus:Aa,blur:Ca,call:Pa,return:Ra,js:Oa,async:_a,tell:Na,default:Ia,init:Ma,behavior:La,install:Da,measure:$a,swap:Ba,morph:qa,beep:Va,break:Fa,copy:za,exit:Wa,pick:ja,render:Ua,compound:{action:"compound",description:"A compound node representing chained statements",primaryRole:"patient",category:"control-flow",hasBody:true,roles:[]}};function Ha(){return Object.values(Pt).filter(n=>n.roles.length>0)}typeof process<"u"&&process.env.NODE_ENV!=="production"&&Promise.resolve().then(()=>(Oi(),Et)).then(({validateAllSchemas:n,formatValidationResults:e})=>{let t=n(Pt);t.size>0&&(console.warn("[SCHEMA VALIDATION] Found issues in command schemas:"),console.warn(e(t)),console.warn(`
5
- These warnings help identify potential schema design issues.`),console.warn("Fix them to improve type inference and avoid runtime bugs."));}).catch(n=>{console.debug("Schema validation skipped:",n);});var mt=class extends Error{constructor(n,e,t,r){super(n),this.name="SemanticParseError",this.language=e,this.input=t,this.diagnostics=r;}};function O(n,e,t){return {message:n,severity:e,source:"semantic-parser",...t&&{code:t}}}function ue(n,e){return e.length===0?n:{...n,diagnostics:e}}var G=class N{parse(e,t){let{modifiers:r,remainingInput:o}=this.extractStandaloneModifiers(e,t),i=o||e,a=[],s=be(i,t),l=z(t);if(l.length===0)throw new mt(`No patterns available for language: ${t}`,t,i,[O(`No patterns registered for language '${t}'`,"error","no-patterns")]);let c=[...l].sort((g,E)=>E.priority-g.priority),u=c.filter(g=>g.command==="on"),p=F.matchBest(s,u);if(p){a.push(O(`event pattern matched: ${p.pattern.id} (confidence: ${p.confidence.toFixed(2)})`,"info","pattern-match"));let g=this.buildEventHandler(p,s,t),E=r?this.applyModifiers(g,r):g;return ue(E,a)}a.push(O(`event patterns: ${u.length} tried, no match`,"info","stage-event"));let d=c.filter(g=>g.command!=="on"),m=F.matchBest(s,d);if(m)return a.push(O(`command pattern matched: ${m.pattern.id} (confidence: ${m.confidence.toFixed(2)})`,"info","pattern-match")),ue(this.buildCommand(m,t),a);a.push(O(`command patterns: ${d.length} tried, no match`,"info","stage-command"));let f=this.trySOVEventExtraction(i,t,c);if(f){a.push(O("SOV event extraction succeeded","info","stage-sov"));let g=r?this.applyModifiers(f,r):f;return ue(g,a)}a.push(O("SOV event extraction: no event keyword found","info","stage-sov"));let y=this.tryCompoundCommandParsing(s,d,t);if(y)return a.push(O("compound command parsing succeeded","info","stage-compound")),ue(y,a);throw a.push(O("compound parsing: no then-keywords or no command matches","info","stage-compound")),a.push(O(`all parse stages exhausted for "${i}"`,"error","parse-failed")),new mt(`Could not parse input in ${t}: ${i}`,t,i,a)}canParse(e,t){try{return this.parse(e,t),!0}catch{return false}}supportedLanguages(){return Ct()}buildCommand(e,t){if(!e)throw new Error("No match to build command from");let r={};for(let[o,i]of e.captured)r[o]=i;return se(e.pattern.command,r,{sourceLanguage:t,patternId:e.pattern.id,confidence:e.confidence})}buildEventHandler(e,t,r){if(!e)throw new Error("No match to build event handler from");let o=e.captured.get("event");if(!o)throw new Error("Event handler pattern matched but no event captured");let i=F.extractEventModifiers(t),a=this.extractOrConjunctionEvents(t,r),s=o;a.length>0&&o.type==="literal"&&(s={type:"literal",value:[String(o.value),...a.map(p=>String("value"in p?p.value:""))].join(" or ")});let l,c=e.captured.get("action");if(c&&c.type==="literal"){let u=c.value,p={};for(let[f,y]of e.captured)f!=="event"&&f!=="action"&&f!=="continues"&&(p[f]=y);let d=se(u,p,{sourceLanguage:r,patternId:e.pattern.id,confidence:e.confidence}),m=e.captured.get("continues");if(m&&m.type==="literal"&&m.value==="then"){let f=z(r).filter(E=>E.command!=="on").sort((E,T)=>T.priority-E.priority),y=z(r).filter(E=>E.id.startsWith("grammar-")&&E.id.includes("-continuation")).sort((E,T)=>T.priority-E.priority),g=this.parseBodyWithGrammarPatterns(t,f,y,r);g.length>0?l=[d,...g]:l=[d];}else l=[d];}else {let u=z(r).filter(p=>p.command!=="on").sort((p,d)=>d.priority-p.priority);l=this.parseBodyWithClauses(t,u,r);}return at(s,l,i,{sourceLanguage:r,patternId:e.pattern.id,confidence:e.confidence})}parseBodyWithClauses(e,t,r){let o=[],i=[];for(;!e.isAtEnd();){let a=e.peek();if(!a)break;let s=a.kind==="conjunction"||a.kind==="keyword"&&this.isThenKeyword(a.value,r),l=a.kind==="keyword"&&this.isEndKeyword(a.value,r);if(s){if(i.length>0){let c=this.parseClause(i,t,r);o.push(...c),i.length=0;}e.advance();continue}if(l){if(i.length>0){let c=this.parseClause(i,t,r);o.push(...c);}e.advance();break}i.push(a),e.advance();}if(i.length>0){let a=this.parseClause(i,t,r);o.push(...a);}return o.length>1?[st(o,"then",{sourceLanguage:r})]:o}parseClause(e,t,r){if(e.length===0)return [];let o=new X(e,r),i=[];for(;!o.isAtEnd();){let a=F.matchBest(o,t);a?i.push(this.buildCommand(a,r)):o.advance();}if(i.length===0){let a=this.parseSOVClauseByVerbAnchoring(e,r);if(a.length>0)return a}return i}static buildVerbLookup(e){let t=new Map;for(let[r,o]of Object.entries(e.keywords))if(!["on","if","else","when","where","while","for","end","then","and"].includes(r)&&(t.set(o.primary.toLowerCase(),r),o.alternatives))for(let i of o.alternatives)t.set(i.toLowerCase(),r);return t}static buildMarkerToRoleLookup(e){let t=new Map;for(let[r,o]of Object.entries(e.roleMarkers))if(o&&(t.set(o.primary,r),o.alternatives))for(let i of o.alternatives)t.has(i)||t.set(i,r);return t}parseSOVClauseByVerbAnchoring(e,t){let r=$(t);if(!r||r.wordOrder!=="SOV")return [];let o=N.buildVerbLookup(r),i=N.buildMarkerToRoleLookup(r),a=[],s=0;for(;s<e.length;){let l=-1,c="";for(let f=s;f<e.length;f++){let y=e[f],g=o.get(y.value.toLowerCase()),E=y.normalized?o.get(y.normalized.toLowerCase()):void 0,T=g||E;if(T){l=f,c=T;break}}if(l===-1)break;let u=e.slice(s,l),p=e.length;for(let f=l+1;f<e.length;f++){let y=e[f];if(y.kind==="conjunction"||this.isThenKeyword(y.value,t)){p=f;break}if(f>l+1&&(o.get(y.value.toLowerCase())||(y.normalized?o.get(y.normalized.toLowerCase()):void 0))){p=f;break}}let d=e.slice(l+1,p),m=this.extractRolesFromMarkedTokens(u,d,i,c,t);if(a.push(se(c,m,{sourceLanguage:t,confidence:.7})),s=p,s<e.length){let f=e[s];(f.kind==="conjunction"||this.isThenKeyword(f.value,t))&&s++;}}return a}extractRolesFromMarkedTokens(e,t,r,o,i){let a={},s=l=>{let c=[];for(let u of l){let p=r.get(u.value);if(p&&u.kind==="particle"&&c.length>0){let d=this.tokensToSemanticValue(c);if(d){let m=this.mapRoleForCommand(p,o,a);m&&(a[m]=d);}c=[];}else c.push(u);}if(c.length>0){let u=this.tokensToSemanticValue(c);u&&(a.patient?a.destination||(a.destination=u):a.patient=u);}};return s(e),s(t),a}mapRoleForCommand(e,t,r){return r[e]?e==="patient"&&!r.destination?"destination":e==="destination"&&!r.patient?"patient":e==="source"&&!r.source?"source":null:e}tokensToSemanticValue(e){if(e.length===0)return null;let t=e.filter(i=>i.kind!=="whitespace");if(t.length===0)return null;if(t.length===1)return this.tokenToSemanticValue(t[0]);let r=t.map(i=>i.value).join(""),o=t[0];return o.kind==="selector"||o.value.startsWith("#")||o.value.startsWith(".")||o.value.startsWith("@")||o.value.startsWith("*")?ee(r):o.kind==="literal"||o.value.startsWith('"')||o.value.startsWith("'")?x(r):o.kind==="reference"?D(r):x(r)}tokenToSemanticValue(e){let t=e.value;if(e.kind==="selector"||t.startsWith("#")||t.startsWith(".")||t.startsWith("@")||t.startsWith("*"))return ee(t);if(t.startsWith('"')||t.startsWith("'"))return x(t);if(/^-?\d+(\.\d+)?$/.test(t))return x(parseFloat(t));if(t==="true"||t==="\u771F"||t==="\uCC38"||t==="do\u011Fru")return x(true);if(t==="false"||t==="\u507D"||t==="\uAC70\uC9D3"||t==="yanl\u0131\u015F")return x(false);let r=e.normalized?.toLowerCase();return r==="me"||r==="it"||r==="you"||r==="result"||r==="body"?D(r):e.kind==="reference"?D(e.normalized||"me"):x(t)}parseBodyWithGrammarPatterns(e,t,r,o){let i=[];for(;!e.isAtEnd();){let a=e.peek();if(a&&this.isThenKeyword(a.value,o)){e.advance();continue}if(a&&this.isEndKeyword(a.value,o)){e.advance();break}let s=false;if(r.length>0){let l=F.matchBest(e,r);if(l){let c=l.pattern.command,u={};for(let[m,f]of l.captured)m!=="event"&&m!=="action"&&m!=="continues"&&(u[m]=f);let p=se(c,u,{sourceLanguage:o,patternId:l.pattern.id});i.push(p),s=true;let d=l.captured.get("continues");if(d&&d.type==="literal"&&d.value==="then")continue}}if(!s){let l=F.matchBest(e,t);l&&(i.push(this.buildCommand(l,o)),s=true);}s||e.advance();}return i}tryCompoundCommandParsing(e,t,r){let o=e.tokens;if(!o.some(l=>l.kind==="conjunction"||l.kind==="keyword"&&this.isThenKeyword(l.value,r)))return null;let a=new X(o,r),s=this.parseBodyWithClauses(a,t,r);return s.length===0?null:s.length===1?s[0]:st(s,"then",{sourceLanguage:r,confidence:.65})}trySOVEventExtraction(e,t,r){let o=N.SOV_EVENT_MARKERS[t];if(!o)return null;let a=be(e,t).tokens,s=Ui[t],l=new Set;if(s)for(let k of Object.keys(s))l.add(k.toLowerCase());let c=N.SOV_SOURCE_MARKERS[t],u=-1,p="",d="",m=1;for(let k=0;k<a.length;k++){let w=a[k],I=w.value.toLowerCase(),M=I,B="",de=I.indexOf("[");de>0&&(M=I.slice(0,de),B=w.value.slice(de));let me=w.normalized?.toLowerCase(),Ie=me&&N.KNOWN_EVENTS.has(me),Me=l.has(I)||l.has(M),Ft=N.KNOWN_EVENTS.has(M);if(Ie||Me||Ft){let K;if(Ie?K=me:Me?K=s?.[I]??s?.[M]??M:K=M,o.size>0){let oe=1,fe=a[k+1];fe&&fe.kind==="selector"&&fe.value.startsWith("[")&&(oe=2);let ie=a[k+oe];if(ie&&(ie.kind==="particle"||ie.kind==="keyword")&&o.has(ie.value)){u=k,p=K,d=B||(oe===2?a[k+1].value:""),m=oe+1;break}}else {u=k,p=K,d=B,m=1;break}}}if(u===-1)return null;let f=new Set;for(let k=u;k<u+m;k++)f.add(k);if(c){let k=u+m;if(k<a.length){let w=a[k];(w.kind==="particle"||w.kind==="keyword")&&c.markers.has(w.value)&&f.add(k);}for(let w=0;w<u;w++){let I=a[w],M=I.value.toLowerCase(),B=I.normalized?.toLowerCase();if(c.windowTokens.has(M)||B&&c.windowTokens.has(B)){f.add(w);break}}}let y=a.filter((k,w)=>!f.has(w));if(y.length===0)return null;let g=r.filter(k=>k.command!=="on"),E=new X(y,t),T=this.parseBodyWithClauses(E,g,t);if(T.length===0)return null;let Ne={sourceLanguage:t,confidence:.75};return d&&(Ne.keyFilter=d),at({type:"literal",value:p},T,void 0,Ne)}isThenKeyword(e,t){let r={en:new Set(["then"]),ja:new Set(["\u305D\u308C\u304B\u3089","\u6B21\u306B","\u305D\u3057\u3066"]),ar:new Set(["\u062B\u0645","\u0628\u0639\u062F\u0647\u0627","\u062B\u0645\u0651"]),es:new Set(["entonces","luego","despu\xE9s"]),ko:new Set(["\uADF8\uB2E4\uC74C","\uADF8\uB9AC\uACE0","\uADF8\uB7F0\uD6C4","\uADF8\uB7EC\uBA74"]),zh:new Set(["\u7136\u540E","\u63A5\u7740","\u4E4B\u540E"]),tr:new Set(["sonra","ard\u0131ndan","daha sonra"]),pt:new Set(["ent\xE3o","depois","logo"]),fr:new Set(["puis","ensuite","alors"]),de:new Set(["dann","danach","anschlie\xDFend"]),id:new Set(["lalu","kemudian","setelah itu"]),tl:new Set(["pagkatapos","tapos"]),bn:new Set(["\u09A4\u09BE\u09B0\u09AA\u09B0","\u09AA\u09B0\u09C7"]),qu:new Set(["chaymantataq","hinaspa","chaymanta","chayqa"]),sw:new Set(["kisha","halafu","baadaye"])};return (r[t]||r.en).has(e.toLowerCase())}isEndKeyword(e,t){let r={en:new Set(["end"]),ja:new Set(["\u7D42\u308F\u308A","\u7D42\u4E86","\u304A\u308F\u308A"]),ar:new Set(["\u0646\u0647\u0627\u064A\u0629","\u0627\u0646\u062A\u0647\u0649","\u0622\u062E\u0631"]),es:new Set(["fin","final","terminar"]),ko:new Set(["\uB05D","\uC885\uB8CC","\uB9C8\uCE68"]),zh:new Set(["\u7ED3\u675F","\u7EC8\u6B62","\u5B8C"]),tr:new Set(["son","biti\u015F","bitti"]),pt:new Set(["fim","final","t\xE9rmino"]),fr:new Set(["fin","terminer","finir"]),de:new Set(["ende","beenden","fertig"]),id:new Set(["selesai","akhir","tamat"]),tl:new Set(["wakas","tapos"]),bn:new Set(["\u09B8\u09AE\u09BE\u09AA\u09CD\u09A4"]),qu:new Set(["tukukuy","tukuy","puchukay"]),sw:new Set(["mwisho","maliza","tamati"])};return (r[t]||r.en).has(e.toLowerCase())}extractStandaloneModifiers(e,t){let o=be(e,t).tokens;if(o.length===0)return {modifiers:null,remainingInput:null};let a=o[0].value.toLowerCase(),s=N.STANDALONE_MODIFIERS[a];if(!s)return {modifiers:null,remainingInput:null};let l={},c=1;if(s==="once")l.once=true;else {let m=1;if(m<o.length){let f=o[m];(f.kind==="keyword"||f.kind==="particle")&&(m++,c++);}if(m<o.length){let f=o[m];if(f.kind==="literal"){let y=f.value.match(/^(\d+)(ms|s|m)?$/);if(y){let g=parseInt(y[1],10),E=y[2]||"ms";E==="s"?g*=1e3:E==="m"&&(g*=6e4),l[s]=g,c=m+1;}}}l[s]||(l[s]=s==="debounce"?300:100);}let u=o.slice(c);if(u.length===0)return {modifiers:null,remainingInput:null};let p=u[0].position.start,d=e.slice(p);return {modifiers:l,remainingInput:d}}applyModifiers(e,t){return {...e,eventModifiers:{...e.eventModifiers,...t}}}extractOrConjunctionEvents(e,t){let r=[];for(;;){let o=e.mark(),i=e.peek();if(!i)break;let a=(i.normalized||i.value).toLowerCase();if(!N.OR_KEYWORDS.has(a)){e.reset(o);break}e.advance();let s=e.peek();if(!s){e.reset(o);break}let l=(s.normalized||s.value).toLowerCase();e.advance(),r.push({type:"literal",value:l});}return r}};G.KNOWN_EVENTS=new Set(["click","dblclick","input","change","submit","keydown","keyup","keypress","mouseover","mouseout","mousedown","mouseup","focus","blur","load","scroll","resize","contextmenu"]);G.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"])};G.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"])}};G.STANDALONE_MODIFIERS={once:"once",debounced:"debounce",debounce:"debounce",throttled:"throttle",throttle:"throttle"};G.OR_KEYWORDS=new Set(["or","\u0623\u0648","o","ou","oder","atau","atau","\u6216","\u307E\u305F\u306F","\uB610\uB294","veya","\u0985\u09A5\u09AC\u09BE","utaq","au","\u0430\u0431\u043E","\u0438\u043B\u0438","ho\u1EB7c","lub","\u05D0\u05D5","\u0E2B\u0E23\u0E37\u0E2D","o"]);var Ga=G,Ka=new Ga;function Ce(n,e){return Ka.parse(n,e)}var we=class{constructor(n={}){this.cache=new Map,this.config={maxSize:n.maxSize??1e3,ttlMs:n.ttlMs??0,enabled:n.enabled??true},this.stats={hits:0,misses:0,evictions:0,expirations:0};}makeKey(n,e){return `${e}:${n}`}isExpired(n){return this.config.ttlMs===0?false:Date.now()-n.createdAt>this.config.ttlMs}evictLRU(){let n=this.cache.keys().next().value;n!==void 0&&(this.cache.delete(n),this.stats.evictions++);}get(n,e){if(!this.config.enabled){this.stats.misses++;return}let t=this.makeKey(n,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(n,e,t){if(!this.config.enabled||t.confidence===0)return;let r=this.makeKey(n,e),o=Date.now();for(;this.cache.size>=this.config.maxSize;)this.evictLRU();this.cache.set(r,{result:t,createdAt:o,lastAccessed:o});}has(n,e){if(!this.config.enabled)return false;let t=this.makeKey(n,e),r=this.cache.get(t);return r?this.isExpired(r)?(this.cache.delete(t),this.stats.expirations++,false):true:false}delete(n,e){let t=this.makeKey(n,e);return this.cache.delete(t)}clear(){this.cache.clear();}resetStats(){this.stats={hits:0,misses:0,evictions:0,expirations:0};}getStats(){let n=this.stats.hits+this.stats.misses;return {hits:this.stats.hits,misses:this.stats.misses,size:this.cache.size,maxSize:this.config.maxSize,hitRate:n>0?this.stats.hits/n:0,evictions:this.stats.evictions,expirations:this.stats.expirations,enabled:this.config.enabled}}configure(n){if(n.maxSize!==void 0)for(this.config.maxSize=n.maxSize;this.cache.size>this.config.maxSize;)this.evictLRU();n.ttlMs!==void 0&&(this.config.ttlMs=n.ttlMs),n.enabled!==void 0&&(this.config.enabled=n.enabled);}enable(){this.config.enabled=true;}disable(){this.config.enabled=false;}getConfig(){return {...this.config}}},Ya=new we;var Qa=class{constructor(n={}){this.patternMatcher=new At,this.languages=new Set(wt()),n.cache===false?this.cache=new we({enabled:false}):this.cache=n.cache?new we(n.cache):Ya;}analyze(n,e){if(!this.supportsLanguage(e))return {confidence:0,errors:[`Language '${e}' is not supported for semantic parsing`]};let t=this.cache.get(n,e);if(t)return t;let r=this.analyzeUncached(n,e);return this.cache.set(n,e,r),r}analyzeUncached(n,e){try{try{let a=Ce(n,e),s={confidence:a.metadata?.confidence??.8,node:a};return a.kind==="command"?{...s,command:{name:a.action,roles:a.roles}}:s}catch{}let t=ji(e);if(!t)return {confidence:0,errors:[`No tokenizer available for language '${e}'`]};let r=t.tokenize(n),o=z(e);if(o.length===0)return {confidence:0,errors:[`No patterns available for language '${e}'`]};let i=this.patternMatcher.matchBest(r,o);if(i){let a=this.buildSemanticNode(i);return {confidence:i.confidence,command:{name:i.pattern.command,roles:i.captured},node:a,tokensConsumed:i.consumedTokens}}return {confidence:0,errors:["No pattern matched the input"]}}catch(t){return {confidence:0,errors:[t instanceof Error?t.message:String(t)]}}}supportsLanguage(n){return this.languages.has(n)}supportedLanguages(){return Array.from(this.languages)}getCacheStats(){return this.cache.getStats()}clearCache(){this.cache.clear();}configureCache(n){this.cache.configure(n);}buildSemanticNode(n){return {kind:"command",action:n.pattern.command,roles:n.captured,metadata:{patternId:n.pattern.id}}}};function Rt(n){return new Qa(n)}var Xa=.5;function Ot(n,e=Xa){return n.confidence>=e&&n.command!==void 0}function _t(n,e){let t=e==="SOV"?"sovPosition":"svoPosition";return [...n].sort((r,o)=>{let i=r[t]??99,a=o[t]??99;return i-a})}function Ja(n,e){let t=n.markerOverride?.[e.code],r=e.roleMarkers[n.role];if(t!==void 0)return {primary:t,position:r?.position??"before",isOverride:true};if(r&&r.primary){let o={primary:r.primary,position:r.position,isOverride:false};return r.alternatives&&(o.alternatives=r.alternatives),o}return null}function Za(n,e,t,r,o){let i=[];if(i.push({type:"role",role:"event",optional:false}),r.position==="after"){let c=r.primary.split(/\s+/);if(c.length>1)for(let u of c)i.push({type:"literal",value:u});else {let u=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};i.push(u);}}let a=e.roleMarkers.destination;a&&i.push({type:"group",optional:true,tokens:[{type:"role",role:"destination",optional:true},a.alternatives?{type:"literal",value:a.primary,alternatives:a.alternatives}:{type:"literal",value:a.primary}]}),i.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};i.push(c);}let l=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};return i.push(l),{id:`${n.action}-event-${e.code}-sov`,language:e.code,command:"on",priority:(o.basePriority??100)+50,template:{format:`{event} ${r.primary} {destination?} {patient} ${s?.primary||""} ${t.primary}`,tokens:i},extraction:{action:{value:n.action},event:{fromRole:"event"},patient:{fromRole:"patient"},destination:{fromRole:"destination",default:{type:"reference",value:"me"}}}}}function es(n,e,t,r,o){let i=[];i.push({type:"role",role:"patient",optional:false});let a=e.roleMarkers.patient;if(a){let l=a.alternatives?{type:"literal",value:a.primary,alternatives:a.alternatives}:{type:"literal",value:a.primary};i.push(l);}if(i.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)i.push({type:"literal",value:c});else {let c=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};i.push(c);}}let s=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};return i.push(s),{id:`${n.action}-event-${e.code}-sov-patient-first`,language:e.code,command:"on",priority:(o.basePriority??100)+45,template:{format:`{patient} ${a?.primary||""} {event} ${r.primary} ${t.primary}`,tokens:i},extraction:{action:{value:n.action},event:{fromRole:"event"},patient:{fromRole:"patient"},destination:{fromRole:"destination",default:{type:"reference",value:"me"}}}}}function ts(n,e,t,r,o){let i=[];i.push({type:"role",role:"patient",optional:false});let a=e.roleMarkers.patient;if(a){let c=a.alternatives?{type:"literal",value:a.primary,alternatives:a.alternatives}:{type:"literal",value:a.primary};i.push(c);}let s=e.roleMarkers.destination;if(s&&(i.push({type:"role",role:"destination",optional:false}),i.push(s.alternatives?{type:"literal",value:s.primary,alternatives:s.alternatives}:{type:"literal",value:s.primary})),i.push({type:"role",role:"event",optional:false}),r.position==="after"){let c=r.primary.split(/\s+/);if(c.length>1)for(let u of c)i.push({type:"literal",value:u});else {let u=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};i.push(u);}}let l=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};return i.push(l),{id:`${n.action}-event-${e.code}-sov-patient-first-dest`,language:e.code,command:"on",priority:(o.basePriority??100)+40,template:{format:`{patient} ${a?.primary||""} {destination} ${s?.primary||""} {event} ${r.primary} ${t.primary}`,tokens:i},extraction:{action:{value:n.action},event:{fromRole:"event"},patient:{fromRole:"patient"},destination:{fromRole:"destination"}}}}function rs(n,e,t,r,o){let i=[];i.push({type:"role",role:"event",optional:false});let a=r.alternatives?.filter(u=>!u.includes(" ")&&u.length>1)||[];a.length>0&&i.push({type:"literal",value:a[0],alternatives:a.slice(1)});let s=e.roleMarkers.destination;s&&i.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}]}),i.push({type:"role",role:"patient",optional:false});let l=e.roleMarkers.patient;if(l){let u=l.alternatives?{type:"literal",value:l.primary,alternatives:l.alternatives}:{type:"literal",value:l.primary};i.push(u);}let c=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};return i.push(c),{id:`${n.action}-event-${e.code}-sov-compact`,language:e.code,command:"on",priority:(o.basePriority??100)+52,template:{format:`{event}${a[0]||""} {patient} ${t.primary}`,tokens:i},extraction:{action:{value:n.action},event:{fromRole:"event"},patient:{fromRole:"patient"},destination:{fromRole:"destination",default:{type:"reference",value:"me"}}}}}function ns(n,e,t,r,o){let i=[];if(i.push({type:"role",role:"event",optional:false}),r.position==="after"){let s=r.primary.split(/\s+/);if(s.length>1)for(let l of s)i.push({type:"literal",value:l});else {let l=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};i.push(l);}}let a=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};return i.push(a),{id:`${n.action}-event-${e.code}-sov-simple`,language:e.code,command:"on",priority:(o.basePriority??100)+48,template:{format:`{event} ${r.primary} ${t.primary}`,tokens:i},extraction:{action:{value:n.action},event:{fromRole:"event"},patient:{default:{type:"reference",value:"me"}}}}}function os(n,e,t,r){let o=e.eventHandler?.temporalMarkers;if(!o||o.length===0)return null;let i=[];i.push({type:"role",role:"event",optional:false}),e.possessive?.marker&&i.push({type:"group",optional:true,tokens:[{type:"literal",value:e.possessive.marker}]}),i.push({type:"literal",value:o[0],alternatives:o.slice(1)}),i.push({type:"role",role:"patient",optional:false});let a=e.roleMarkers.patient;if(a?.primary){let l=a.alternatives?{type:"literal",value:a.primary,alternatives:a.alternatives}:{type:"literal",value:a.primary};i.push(l);}let s=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};return i.push(s),{id:`${n.action}-event-${e.code}-sov-temporal`,language:e.code,command:"on",priority:(r.basePriority??100)+49,template:{format:`{event} ${o[0]} {patient} ${t.primary}`,tokens:i},extraction:{action:{value:n.action},event:{fromRole:"event"},patient:{fromRole:"patient"}}}}function is(n,e,t,r,o){let i=[];if(i.push({type:"role",role:"event",optional:false}),r.position==="after"){let u=r.primary.split(/\s+/);if(u.length>1)for(let p of u)i.push({type:"literal",value:p});else {let p=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};i.push(p);}}let s=[...n.roles.filter(u=>u.required)].sort((u,p)=>{let d=u.sovPosition??999,m=p.sovPosition??999;return d-m});for(let u of s){i.push({type:"role",role:u.role,optional:false});let p,d;if(u.markerOverride&&u.markerOverride[e.code]!==void 0)p=u.markerOverride[e.code];else {let m=e.roleMarkers[u.role];m&&(p=m.primary,d=m.alternatives);}if(p){let m=d?{type:"literal",value:p,alternatives:d}:{type:"literal",value:p};i.push(m);}}let l=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};i.push(l);let c=s.map(u=>`{${u.role}}`).join(" ");return {id:`${n.action}-event-${e.code}-sov-2role`,language:e.code,command:"on",priority:(o.basePriority??100)+55,template:{format:`{event} ${r.primary} ${c} ${t.primary}`,tokens:i},extraction:{action:{value:n.action},event:{fromRole:"event"},...Object.fromEntries(s.map(u=>[u.role,{fromRole:u.role}]))}}}function as(n,e,t,r,o){let i=[],s=[...n.roles.filter(f=>f.required)].sort((f,y)=>{let g=f.sovPosition??999,E=y.sovPosition??999;return g-E}),l=s[0];i.push({type:"role",role:l.role,optional:false});let c;if(l.markerOverride&&l.markerOverride[e.code]!==void 0)c=l.markerOverride[e.code];else {let f=e.roleMarkers[l.role];f&&(c=f.primary);}if(c&&i.push({type:"literal",value:c}),i.push({type:"role",role:"event",optional:false}),r.position==="after"){let f=r.primary.split(/\s+/);if(f.length>1)for(let y of f)i.push({type:"literal",value:y});else {let y=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};i.push(y);}}let u=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};i.push(u);let p=s[1];i.push({type:"role",role:p.role,optional:false});let d,m;if(p.markerOverride&&p.markerOverride[e.code]!==void 0)d=p.markerOverride[e.code];else {let f=e.roleMarkers[p.role];f&&(d=f.primary,m=f.alternatives);}if(d){let f=m?{type:"literal",value:d,alternatives:m}:{type:"literal",value:d};i.push(f);}return {id:`${n.action}-event-${e.code}-sov-2role-dest-first`,language:e.code,command:"on",priority:(o.basePriority??100)+48,template:{format:`{${l.role}} {event} ${r.primary} ${t.primary} {${p.role}}`,tokens:i},extraction:{action:{value:n.action},event:{fromRole:"event"},[l.role]:{fromRole:l.role},[p.role]:{fromRole:p.role}}}}function ft(n,e,t,r,o){let i=[];if(r.position==="before"){let l=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};i.push(l);}i.push({type:"role",role:"event",optional:false});let a=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};i.push(a),i.push({type:"role",role:"patient",optional:false});let s=e.roleMarkers.destination;return s&&i.push({type:"group",optional:true,tokens:[s.alternatives?{type:"literal",value:s.primary,alternatives:s.alternatives}:{type:"literal",value:s.primary},{type:"role",role:"destination",optional:true}]}),{id:`${n.action}-event-${e.code}-vso`,language:e.code,command:"on",priority:(o.basePriority??100)+50,template:{format:`${r.primary} {event} ${t.primary} {patient} ${s?.primary||""} {destination?}`,tokens:i},extraction:{action:{value:n.action},event:{fromRole:"event"},patient:{fromRole:"patient"},destination:{fromRole:"destination",default:{type:"reference",value:"me"}}}}}function ss(n,e,t,r,o){let i=[],a=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};i.push(a),i.push({type:"role",role:"patient",optional:false});let s=e.roleMarkers.destination;if(s&&i.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}]}),r.position==="before"){let l=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};i.push(l);}return i.push({type:"role",role:"event",optional:false}),{id:`${n.action}-event-${e.code}-vso-verb-first`,language:e.code,command:"on",priority:(o.basePriority??100)+45,template:{format:`${t.primary} {patient} ${s?.primary||""} {destination?} ${r.primary} {event}`,tokens:i},extraction:{action:{value:n.action},event:{fromRole:"event"},patient:{fromRole:"patient"},destination:{fromRole:"destination",default:{type:"reference",value:"me"}}}}}function ls(n,e,t,r,o){let i=[],a=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};i.push(a);let l=[...n.roles.filter(u=>u.required)].sort((u,p)=>{let d=u.svoPosition??999,m=p.svoPosition??999;return d-m});for(let u of l){let p,d;if(u.markerOverride&&u.markerOverride[e.code]!==void 0)p=u.markerOverride[e.code];else {let m=e.roleMarkers[u.role];m&&(p=m.primary,d=m.alternatives);}if(p){let m=d?{type:"literal",value:p,alternatives:d}:{type:"literal",value:p};i.push(m);}i.push({type:"role",role:u.role,optional:false});}if(r.position==="before"){let u=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};i.push(u);}i.push({type:"role",role:"event",optional:false});let c=l.map(u=>`{${u.role}}`).join(" ");return {id:`${n.action}-event-${e.code}-vso-verb-first-2role`,language:e.code,command:"on",priority:(o.basePriority??100)+48,template:{format:`${t.primary} ${c} ${r.primary} {event}`,tokens:i},extraction:{action:{value:n.action},event:{fromRole:"event"},...Object.fromEntries(l.map(u=>[u.role,{fromRole:u.role}]))}}}function vt(n,e,t,r,o){let i=[];if(r.position==="before"){let u=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};i.push(u);}i.push({type:"role",role:"event",optional:false});let a=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};i.push(a);let l=[...n.roles.filter(u=>u.required)].sort((u,p)=>{let d=u.svoPosition??999,m=p.svoPosition??999;return d-m});for(let u of l){let p,d;if(u.markerOverride&&u.markerOverride[e.code]!==void 0)p=u.markerOverride[e.code];else {let m=e.roleMarkers[u.role];m&&(p=m.primary,d=m.alternatives);}if(p){let m=d?{type:"literal",value:p,alternatives:d}:{type:"literal",value:p};i.push(m);}i.push({type:"role",role:u.role,optional:false});}let c=l.map(u=>`{${u.role}}`).join(" ");return {id:`${n.action}-event-${e.code}-vso-2role`,language:e.code,command:"on",priority:(o.basePriority??100)+55,template:{format:`${r.primary} {event} ${t.primary} ${c}`,tokens:i},extraction:{action:{value:n.action},event:{fromRole:"event"},...Object.fromEntries(l.map(u=>[u.role,{fromRole:u.role}]))}}}function us(n,e,t,r,o){let i=[],a=e.eventHandler?.negationMarker;if(r.position==="before"){let c=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};i.push(c);}if(a){let c=a.alternatives?{type:"literal",value:a.primary,alternatives:a.alternatives}:{type:"literal",value:a.primary};i.push(c);}i.push({type:"role",role:"event",optional:false});let s=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};i.push(s),i.push({type:"role",role:"patient",optional:false});let l=e.roleMarkers.destination;return l&&i.push({type:"group",optional:true,tokens:[l.alternatives?{type:"literal",value:l.primary,alternatives:l.alternatives}:{type:"literal",value:l.primary},{type:"role",role:"destination",optional:true}]}),{id:`${n.action}-event-${e.code}-vso-negated`,language:e.code,command:"on",priority:(o.basePriority??100)+48,template:{format:`${r.primary} ${a?.primary||""} {event} ${t.primary} {patient} ${l?.primary||""} {destination?}`,tokens:i},extraction:{action:{value:n.action},event:{fromRole:"event"},patient:{fromRole:"patient"},destination:{fromRole:"destination",default:{type:"reference",value:"me"}}}}}function cs(n,e,t,r){let o=[];o.push({type:"literal",value:"and",alternatives:["then"]}),o.push({type:"role",role:"event",optional:false});let i=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};o.push(i),o.push({type:"role",role:"patient",optional:false});let a=e.roleMarkers.destination;return a&&o.push({type:"group",optional:true,tokens:[a.alternatives?{type:"literal",value:a.primary,alternatives:a.alternatives}:{type:"literal",value:a.primary},{type:"role",role:"destination",optional:true}]}),{id:`${n.action}-event-${e.code}-vso-proclitic`,language:e.code,command:"on",priority:(r.basePriority??100)+45,template:{format:`[proclitic?] {event} ${t.primary} {patient} ${a?.primary||""} {destination?}`,tokens:o},extraction:{action:{value:n.action},event:{fromRole:"event"},patient:{fromRole:"patient"},destination:{fromRole:"destination",default:{type:"reference",value:"me"}}}}}var te={basePriority:100,generateSimpleVariants:true,generateAlternatives:true};function Nt(n,e,t=te){let r=`${n.action}-${e.code}-generated`,o=t.basePriority??100,i=e.keywords[n.action];if(!i)throw new Error(`No keyword translation for '${n.action}' in ${e.code}`);let a=fs(n,e,i),s=Mt(n,e),l=gs(n,e,i);return {id:r,language:e.code,command:n.action,priority:o,template:{format:l,tokens:a},extraction:s}}function ps(n,e,t=te){if(n.roles.filter(s=>!s.required).length===0)return null;let o=n.roles.filter(s=>s.required),i={...n,roles:o};return {...Nt(i,e,t),id:`${n.action}-${e.code}-generated-simple`,priority:(t.basePriority??100)-5,extraction:Mt(n,e)}}function ds(n,e,t=te){let r=[];if(r.push(Nt(n,e,t)),t.generateSimpleVariants){let o=ps(n,e,t);o&&r.push(o);}return r}function It(n,e=te){let t=[],r=Ha();for(let o of r){if(!n.keywords[o.action])continue;let i=ds(o,n,e);if(t.push(...i),n.eventHandler?.eventMarker){let a=ms(o,n,e);t.push(...a);}}return t}function ms(n,e,t=te){if(!e.eventHandler||!e.eventHandler.eventMarker)return [];let r=[],o=e.eventHandler.eventMarker,i=e.keywords[n.action];if(!i)return [];let s=n.roles.filter(l=>l.required).length===2;if(e.wordOrder==="SOV")if(s)r.push(is(n,e,i,o,t)),r.push(as(n,e,i,o,t));else {r.push(Za(n,e,i,o,t)),r.push(es(n,e,i,o,t));let l=e.roleMarkers.destination;l&&l.primary!==o.primary&&r.push(ts(n,e,i,o,t));let c=o.primary.split(/\s+/),u=o.alternatives?.some(d=>!d.includes(" ")&&d.length>1);c.length>1&&u&&r.push(rs(n,e,i,o,t)),r.push(ns(n,e,i,o,t));let p=os(n,e,i,t);p&&r.push(p);}else e.wordOrder==="VSO"?s?(r.push(vt(n,e,i,o,t)),r.push(ls(n,e,i,o,t))):(r.push(ft(n,e,i,o,t)),r.push(ss(n,e,i,o,t)),e.eventHandler?.negationMarker&&r.push(us(n,e,i,o,t)),e.tokenization?.prefixes&&r.push(cs(n,e,i,t))):s?r.push(vt(n,e,i,o,t)):r.push(ft(n,e,i,o,t));return r}function fs(n,e,t){let r=[],o=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary},i=vs(n,e);switch(e.wordOrder){case "SVO":r.push(o),r.push(...i);break;case "SOV":r.push(...i),r.push(o);break;case "VSO":r.push(o),r.push(...i);break;default:r.push(o),r.push(...i);}return r}function vs(n,e){let t=[],r=_t(n.roles,e.wordOrder);for(let o of r){let i=hs(o,e);o.required?t.push(...i):t.push({type:"group",optional:true,tokens:i});}return t}function hs(n,e){let t=[],r=n.markerOverride?.[e.code],o=e.roleMarkers[n.role],i={type:"role",role:n.role,optional:!n.required,expectedTypes:n.expectedTypes};if(r!==void 0)(o?.position??"before")==="before"?(r&&t.push({type:"literal",value:r}),t.push(i)):(t.push(i),r&&t.push({type:"literal",value:r}));else if(o)if(o.position==="before"){if(o.primary){let a=o.alternatives?{type:"literal",value:o.primary,alternatives:o.alternatives}:{type:"literal",value:o.primary};t.push(a);}t.push(i);}else {t.push(i);let a=o.alternatives?{type:"literal",value:o.primary,alternatives:o.alternatives}:{type:"literal",value:o.primary};t.push(a);}else t.push(i);return t}function ys(n,e){let t={};for(let r of n.roles){let o=r.markerOverride?.[e.code],i=e.roleMarkers[r.role];o!==void 0?t[r.role]=o?{marker:o}:{}:i&&i.primary?t[r.role]=i.alternatives?{marker:i.primary,markerAlternatives:i.alternatives}:{marker:i.primary}:t[r.role]={};}return t}function Mt(n,e){let t=ys(n,e),r={};for(let o of n.roles){let i=t[o.role]||{};!o.required&&o.default?r[o.role]={...i,default:o.default}:r[o.role]=i;}return r}function gs(n,e,t){let r=[],i=_t(n.roles,e.wordOrder).map(a=>{let s=Ja(a,e),l="";return s&&s.primary?s.position==="before"?l=`${s.primary} {${a.role}}`:l=`{${a.role}} ${s.primary}`:l=`{${a.role}}`,a.required?l:`[${l}]`});switch(e.wordOrder){case "SVO":case "VSO":r.push(t.primary,...i);break;case "SOV":r.push(...i,t.primary);break;default:r.push(t.primary,...i);}return r.join(" ")}function pe(n){let e=n.getAttribute("data-lang");if(e)return Pe(e);let t=n.getAttribute("data-hyperscript-lang")??n.closest?.("[data-hyperscript-lang]")?.getAttribute("data-hyperscript-lang");if(t)return Pe(t);let r=typeof document<"u"?document.documentElement?.lang:null;return r&&r!=="en"?Pe(r):null}function Pe(n){return n.split("-")[0].toLowerCase()}var Lt={add:[["patient",""],["destination","to"]],append:[["patient",""],["destination","to"]],async:[],beep:[["patient",""]],behavior:[["patient",""]],blur:[["patient",""]],break:[],call:[["patient",""]],clone:[["patient",""],["destination","into"]],compound:[],continue:[],copy:[["patient",""]],decrement:[["patient",""],["quantity","by"]],default:[["destination",""],["patient","to"]],else:[],exit:[],fetch:[["source",""],["responseType","as"],["method","via"],["destination","on"]],focus:[["patient",""]],for:[["patient",""],["source","in"]],get:[["source",""],["destination","on"]],go:[["destination",""]],halt:[["patient",""]],hide:[["patient",""],["style","with"]],if:[["condition",""]],increment:[["patient",""],["quantity","by"]],init:[],install:[["patient",""],["destination","on"]],js:[["patient",""]],log:[["patient",""]],make:[["patient",""]],measure:[["patient",""],["source","of"]],morph:[["destination",""],["patient","to"]],on:[["event",""],["source","from"]],pick:[["patient",""],["source","from"]],prepend:[["patient",""],["destination","to"]],put:[["patient",""],["destination","into"]],remove:[["patient",""],["source","from"]],render:[["patient",""],["style","with"]],repeat:[["quantity",""],["condition","until"]],return:[["patient",""]],send:[["event",""],["destination","to"]],set:[["destination",""],["patient","to"]],settle:[["patient",""]],show:[["patient",""],["style","with"]],swap:[["method",""],["destination","of"],["patient","with"]],take:[["patient",""],["source","from"]],tell:[["destination",""]],throw:[["patient",""]],toggle:[["patient",""],["destination","on"]],transition:[["patient",""],["goal","to"],["destination","on"],["duration","over"],["style","with"]],trigger:[["event",""],["destination","on"]],unless:[["condition",""]],wait:[["patient",""]],while:[["condition",""]]};function ne(n){switch(n.kind){case "event-handler":return Es(n);case "compound":return ks(n);default:return Ts(n)}}function Es(n){let e=["on"],t=n.roles.get("event");t&&e.push(re(t));let r=n.roles.get("source");if(r&&e.push("from",re(r)),n.body&&n.body.length>0){let o=n.body.map(ne);e.push(o.join(" then "));}return e.join(" ")}function ks(n){let e=n.chainType==="async"?"async":n.chainType;return n.statements.map(ne).join(` ${e} `)}function Ts(n){let e=Lt[n.action];if(e){let r=[n.action];for(let[o,i]of e){let a=n.roles.get(o);a&&(o==="destination"&&a.type==="reference"&&a.value==="me"||(i&&r.push(i),r.push(re(a))));}return r.join(" ")}let t=[n.action];for(let[,r]of n.roles)t.push(re(r));return t.join(" ")}function re(n){switch(n.type){case "literal":return typeof n.value=="string"&&n.dataType==="string"?`"${n.value}"`:String(n.value);case "selector":return n.value;case "reference":return n.value;case "property-path":return bs(n);case "expression":return n.raw;case "flag":return n.enabled?`+${n.name}`:`~${n.name}`}}function bs(n){let e=re(n.object),t=n.property;if(n.object.type==="reference")switch(n.object.value){case "me":return `my ${t}`;case "it":return `its ${t}`;case "you":return `your ${t}`}return `${e}'s ${t}`}var $t=.5,Ss={confidenceThreshold:$t,strategy:"semantic",fallbackToOriginal:true};function xs(n,e){return typeof n=="number"?n:n[e]??n["*"]??$t}var Re=null;function ws(){return Re||(Re=Rt()),Re}function Oe(n,e,t={}){let r={...Ss,...t},o=Dt(n,e,r);if(o!==null)return o;let i=Cs(n);if(i){let a=Dt(i.commands,e,r);if(a!==null)return i.prefix+a}return n}function Dt(n,e,t){if(t.strategy==="semantic"||t.strategy==="auto"){let r=xs(t.confidenceThreshold,e),o=Bt(n,e,r);if(o!==null)return o}if((t.strategy==="auto"||t.strategy==="i18n")&&t.i18nToEnglish){let r=Ps(n,e,t.i18nToEnglish);if(r!==null)return r}return null}var As=/^(on\s+(?:every\s+)?[\w-]+(?:\[.*?\])?(?:\.[\w-]+(?:\([^)]*\))?)*(?:\s+from\s+\S+)?(?:\s+queue\s+\w+)?\s+)/;function Cs(n){let e=n.match(As);if(!e)return null;let t=e[1],r=n.slice(t.length);return r?{prefix:t,commands:r}:null}function Bt(n,e,t){try{let r=Os(n,e);if(r.length>1)return _s(r,e,t);let o=ws();if(!o.supportsLanguage(e))return null;let i=o.analyze(n,e);if(!Ot(i,t))return null;if(i.node)return ne(i.node);let a=Ce(n,e);return ne(a)}catch{return null}}function Ps(n,e,t){try{let r=t(n,e);return r!==n?r:null}catch{return null}}function Rs(n){let e=["then"],t=$(n);if(t?.keywords?.then){let r=t.keywords.then;if(r.primary&&r.primary!=="then"&&e.push(r.primary),r.alternatives)for(let o of r.alternatives)e.includes(o)||e.push(o);}return e}function Os(n,e){let r=Rs(e).map(s=>s.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")),o=new RegExp(`\\s+(?:${r.join("|")})\\s+`,"i"),i=n.split(`
6
- `).map(s=>s.trim()).filter(s=>s.length>0),a=[];for(let s of i){let l=s.split(o);a.push(...l);}return a}function _s(n,e,t){let r=[];for(let o of n){let i=Bt(o.trim(),e,t);if(i===null)return null;r.push(i);}return r.join(" then ")}function _e(n={}){return function(t){let{internals:r}=t,o=r.runtime,i=o.getScript.bind(o);o.getScript=function(a){let s=i(a);if(!s)return null;let l=Ns(a,n);if(!l||l==="en")return s;let c=Oe(s,l,n);return n.debug&&c!==s&&console.log(`[hyperscript-i18n] ${l}: "${s}" \u2192 "${c}"`),c};}}function Ns(n,e){if(e.languageAttribute){let r=n.getAttribute(e.languageAttribute);if(r)return r.split("-")[0].toLowerCase()}let t=pe(n);return t||(e.defaultLanguage??null)}function qt(n,e,t={}){return e==="en"?n:Oe(n,e,t)}xt(n=>It(n));function Vt(){typeof _hyperscript<"u"&&_hyperscript.use&&(_hyperscript.use(_e()),Is());}function Is(){if(typeof document>"u")return;let e=_hyperscript?.internals?.runtime;if(!e?.processNode||!e?.getInternalData)return;let t=e.getScriptSelector?.()??"[_], [script], [data-script]";document.querySelectorAll(t).forEach(r=>{let o=e.getInternalData(r);o.initialized&&(o.initialized=false);}),e.processNode(document.body);}var Nl=["en"];Vt();exports.plugin=_e;exports.preprocess=qt;exports.resolveLanguage=pe;exports.supportedLanguages=Nl;return exports;})({});
1
+ var HyperscriptI18n=(function(exports){'use strict';function B(a,e){return e?{type:"literal",value:a,dataType:e}:{type:"literal",value:a}}function se(a,e){return e?{type:"selector",value:a,selectorKind:e}:{type:"selector",value:a}}function Q(a){return {type:"reference",value:a}}function le(a,e){return {type:"property-path",object:a,property:e}}var _e=new Set(["me","you","it","result","event","target","body"]);function ge(a,e=_e){return e.has(a)}var Vr=class{constructor(a){this.namespace=a,this.enabled=this.checkEnabled();}checkEnabled(){if(typeof process<"u"&&process.env){let a=process.env.DEBUG||"";return a==="*"||a.includes("framework:*")||a.includes(`framework:${this.namespace}`)}return false}log(a,e,...r){if(!this.enabled)return;let t=`[framework:${this.namespace}]`,i=new Date().toISOString();switch(a){case "debug":console.debug(`${i} ${t} DEBUG:`,e,...r);break;case "info":console.info(`${i} ${t} INFO:`,e,...r);break;case "warn":console.warn(`${i} ${t} WARN:`,e,...r);break;case "error":console.error(`${i} ${t} ERROR:`,e,...r);break}}debug(a,...e){this.log("debug",a,...e);}info(a,...e){this.log("info",a,...e);}warn(a,...e){this.log("warn",a,...e);}error(a,...e){this.log("error",a,...e);}isEnabled(){return this.enabled}enable(){this.enabled=true;}disable(){this.enabled=false;}};function jr(a){return new Vr(a)}function V(a,e){return !e||e.length===0||e.includes(a)||e.includes("expression")?true:a==="property-path"?e.some(r=>["selector","reference","expression"].includes(r)):false}function Wr(a,e){return a?.possessive?.keywords?.[e]}var J=class j{constructor(){this.logger=jr("pattern-matcher"),this.stemMatchCount=0,this.totalKeywordMatches=0;}safeToLowerCase(e){return typeof e=="string"?e.toLowerCase():e==null?"":String(e).toLowerCase()}matchPattern(e,r,t){let i=e.mark(),n=new Map;if(this.logger.debug("========================================"),this.logger.debug("matchPattern ENTRY"),this.logger.debug("Pattern ID:",r.id),this.logger.debug("Pattern command:",r.command),this.logger.debug("Pattern language:",r.language),this.logger.debug("Pattern template:",JSON.stringify(r.template,null,2)),this.logger.isEnabled()){let s=[];for(let p=0;p<10;p++){let l=e.peek(p);if(l)s.push({type:l.type,value:l.value,kind:l.kind});else break}this.logger.debug("Input tokens (first 10):",s),this.logger.debug("Profile code:",t?.code);}this.currentProfile=t,this.stemMatchCount=0,this.totalKeywordMatches=0,this.logger.debug("--- Calling matchTokenSequence ---"),this.logger.debug("Pattern tokens to match:",JSON.stringify(r.template.tokens,null,2));let o=this.matchTokenSequence(e,r.template.tokens,n);if(this.logger.debug("matchTokenSequence returned:",o),this.logger.debug("Captured roles:",Array.from(n.entries()).map(([s,p])=>[s,JSON.stringify(p)])),!o)return this.logger.debug(">>> MATCH FAILED - resetting token position"),e.reset(i),null;let u=this.calculateConfidence(r,n);return this.applyExtractionRules(r,n),{pattern:r,captured:n,consumedTokens:e.position()-i.position,confidence:u}}matchBest(e,r,t){let i=[];for(let o of r){let u=e.mark(),s=this.matchPattern(e,o,t);s&&i.push(s),e.reset(u);}if(i.length===0)return null;i.sort((o,u)=>{let s=u.pattern.priority-o.pattern.priority;if(s!==0)return s;let p=u.confidence-o.confidence;return Math.abs(p)>.001?p:u.consumedTokens-o.consumedTokens});let n=i[0];return this.matchPattern(e,n.pattern),n}matchTokenSequence(e,r,t,i){let n=r[0],o=n?.type==="literal"&&(n.value==="and"||n.value==="then"||n.alternatives?.includes("and")||n.alternatives?.includes("then"));if(this.currentProfile?.code==="ar"&&!o)for(;e.peek()?.kind==="conjunction";)e.advance();let u=null,s=null;for(let p=0;p<r.length;p++){let l=r[p];this.logger.debug(" >> Matching pattern token:",JSON.stringify(l,null,2));let c=e.peek();if(this.logger.debug(" >> Current input token:",c?JSON.stringify({type:c.type,value:c.value,kind:c.kind}):"EOF"),l.type==="role"&&l.greedy){let g=this.collectStopMarkers(r,p+1);if(i)for(let z of i)g.add(z);let E=[];for(;!e.isAtEnd();){let z=e.peek();if(!z||this.isStopMarker(z,g))break;E.push(z.value),e.advance();}if(E.length>0){t.set(l.role,{type:"expression",raw:E.join(" ")}),u=null,s=null;continue}else {if(l.optional)continue;return false}}if(l.type==="group"){let g=this.collectStopMarkers(r,p+1);if(i)for(let z of i)g.add(z);if(this.matchGroupToken(e,l,t,g)){u=null,s=null;continue}if(this.isOptional(l))continue;return false}let m=l.type==="role"&&l.optional===true,d=m?e.mark():null;if(l.type==="role"&&!m){let g=p+1<r.length?r[p+1]:null;if(g?.type==="literal"){let E=e.peek();if(E&&this.getMatchType(E,g.value)!=="none"){if(this.logger.debug(" >> MARKER-STEAL GUARD: current token matches next literal, skipping role"),this.logger.debug(" >> Token match FAILED"),this.isOptional(l))continue;if(u&&s){this.logger.debug(" >> BACKTRACKING: undoing optional role",s),e.reset(u),t.delete(s),u=null,s=null;let z=this.matchPatternToken(e,l,t);if(this.logger.debug(" >> Backtrack retry result:",z),z)continue}return false}}}let h=this.matchPatternToken(e,l,t);if(this.logger.debug(" >> Match result:",h),h){m?(u=d,s=l.role):(u=null,s=null);continue}if(this.logger.debug(" >> Token match FAILED"),!this.isOptional(l)){if(u&&s){this.logger.debug(" >> BACKTRACKING: undoing optional role",s),e.reset(u),t.delete(s),u=null,s=null;let g=this.matchPatternToken(e,l,t);if(this.logger.debug(" >> Backtrack retry result:",g),g)continue}return false}}return true}matchPatternToken(e,r,t){switch(r.type){case "literal":return this.matchLiteralToken(e,r);case "role":return this.matchRoleToken(e,r,t);case "group":return this.matchGroupToken(e,r,t);default:return false}}matchLiteralToken(e,r){let t=e.peek();if(this.logger.debug(" >>> matchLiteralToken: expecting",r.value),this.logger.debug(" >>> matchLiteralToken: got token",t?JSON.stringify({type:t.type,value:t.value,kind:t.kind}):"null"),!t)return this.logger.debug(" >>> matchLiteralToken: FAIL - no token"),false;let i=this.getMatchType(t,r.value);if(this.logger.debug(" >>> matchType for",t.value,"vs",r.value,":",i),i!=="none")return this.totalKeywordMatches++,i==="stem"&&this.stemMatchCount++,e.advance(),true;if(r.alternatives)for(let n of r.alternatives){let o=this.getMatchType(t,n);if(o!=="none")return this.totalKeywordMatches++,o==="stem"&&this.stemMatchCount++,e.advance(),true}return false}matchRoleToken(e,r,t){this.logger.debug(" >>> matchRoleToken ENTRY: capturing role",r.role),this.logger.debug(" >>> matchRoleToken: expected types",r.expectedTypes),this.logger.debug(" >>> matchRoleToken: optional?",r.optional),this.skipNoiseWords(e);let i=e.peek();if(this.logger.debug(" >>> After skipNoiseWords, current token:",i?JSON.stringify({value:i.value,kind:i.kind}):"null"),!i)return r.optional||false;let n=this.tryMatchPossessiveExpression(e);if(n)return r.expectedTypes&&r.expectedTypes.length>0&&!V(n.type,r.expectedTypes)?r.optional||false:(t.set(r.role,n),true);let o=this.tryMatchMethodCallExpression(e);if(o)return r.expectedTypes&&r.expectedTypes.length>0&&!V(o.type,r.expectedTypes)?r.optional||false:(t.set(r.role,o),true);let u=this.tryMatchPossessiveSelectorExpression(e);if(u)return r.expectedTypes&&r.expectedTypes.length>0&&!V(u.type,r.expectedTypes)?r.optional||false:(t.set(r.role,u),true);let s=this.tryMatchPropertyAccessExpression(e);if(s)return r.expectedTypes&&r.expectedTypes.length>0&&!V(s.type,r.expectedTypes)?r.optional||false:(t.set(r.role,s),true);let p=this.tryMatchSelectorPropertyExpression(e);if(p)return r.expectedTypes&&r.expectedTypes.length>0&&!V(p.type,r.expectedTypes)?r.optional||false:(t.set(r.role,p),true);this.logger.debug(" >>> Trying tokenToSemanticValue for token:",i?JSON.stringify({value:i.value,kind:i.kind}):"null");let l=this.tokenToSemanticValue(i);return this.logger.debug(" >>> tokenToSemanticValue returned:",l?JSON.stringify(l):"null"),l?(this.logger.debug(" >>> Validating type:",l.type,"against expected:",r.expectedTypes),r.expectedTypes&&r.expectedTypes.length>0&&!V(l.type,r.expectedTypes)?(this.logger.debug(" >>> TYPE MISMATCH - returning",r.optional||false),r.optional||false):(this.logger.debug(" >>> Type validation PASSED"),t.set(r.role,l),e.advance(),true)):r.optional||false}tryMatchPossessiveExpression(e){let r=e.peek();if(!r||!this.currentProfile)return null;let t=r.normalized||r.value,i=this.safeToLowerCase(t),n=Wr(this.currentProfile,i);if(!n)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 p=s;for(;e.peek()?.kind==="selector"&&e.peek().value.startsWith(".")&&/^\.[a-zA-Z_]\w*/.test(e.peek().value);)p+=e.peek().value,e.advance();let l=e.peek();return l?.kind==="literal"&&l.value.startsWith("(")&&(p+=l.value,e.advance()),le(Q(n),p)}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 r=e.peek();if(!r||r.kind!=="selector")return null;let t=e.mark();e.advance();let i=e.peek();if(!i||i.kind!=="operator"||i.value!==".")return e.reset(t),null;e.advance();let n=e.peek();if(!n||n.kind!=="identifier")return e.reset(t),null;e.advance();let o=e.peek();if(!o||o.kind!=="punctuation"||o.value!=="(")return e.reset(t),null;e.advance();let u=[];for(;!e.isAtEnd()&&u.length<j.MAX_METHOD_ARGS;){let p=e.peek();if(!p)break;if(p.kind==="punctuation"&&p.value===")"){e.advance();break}if(p.kind==="punctuation"&&p.value===","){e.advance();continue}u.push(p.value),e.advance();}return {type:"expression",raw:`${r.value}.${n.value}(${u.join(", ")})`}}tryMatchPropertyAccessExpression(e){let r=e.peek();if(!r||r.kind!=="identifier"&&r.kind!=="keyword")return null;let t=e.mark();e.advance();let i=e.peek();if(!i||i.kind!=="operator"||i.value!==".")return e.reset(t),null;e.advance();let n=e.peek();if(!n||n.kind!=="identifier")return e.reset(t),null;e.advance();let o=`${r.value}.${n.value}`,u=1;for(;!e.isAtEnd()&&u<j.MAX_PROPERTY_DEPTH;){let p=e.peek();if(!p||p.kind!=="operator"||p.value!==".")break;e.advance();let l=e.peek();if(!l||l.kind!=="identifier")break;e.advance(),o+=`.${l.value}`,u++;}let s=e.peek();if(s&&s.kind==="punctuation"&&s.value==="("){e.advance();let p=[],l=0;for(;!e.isAtEnd()&&p.length<j.MAX_METHOD_ARGS;){let m=e.peek();if(!m)break;if(m.kind==="punctuation"&&m.value===")"){if(l===0){e.advance();break}l--;}if(m.kind==="punctuation"&&m.value==="("&&l++,m.kind==="punctuation"&&m.value===","){e.advance();continue}p.push(m.value),e.advance();}return {type:"expression",raw:`${o}(${p.join(", ")})`}}return {type:"expression",raw:o}}tryMatchPossessiveSelectorExpression(e){let r=e.peek();if(!r||r.kind!=="selector")return null;let t=e.mark();e.advance();let i=e.peek();if(!i||i.kind!=="punctuation"||i.value!=="'s")return e.reset(t),null;e.advance();let n=e.peek();return !n||n.kind!=="selector"&&n.kind!=="identifier"?(e.reset(t),null):(e.advance(),le(se(r.value),n.value))}tryMatchSelectorPropertyExpression(e){let r=e.peek();if(!r||r.kind!=="selector"||typeof r.value!="string"||!r.value.startsWith("#"))return null;let t=e.mark();e.advance();let i=e.peek();if(!i||i.kind!=="selector"||!i.value.startsWith("."))return e.reset(t),null;let n=e.peek(1);n&&n.kind,e.advance();let o=i.value.slice(1);return le(se(r.value),o)}matchGroupToken(e,r,t,i){let n=e.mark(),o=new Set(t.keys());if(this.matchTokenSequence(e,r.tokens,t,i))return true;e.reset(n);for(let p of t.keys())o.has(p)||t.delete(p);if(!r.optional)return false;let s=this.getGroupLeadingMarker(r);if(s)for(let p=1;p<=j.MAX_MARKER_SCAN;p++){let l=e.peek(p);if(!l)break;if((l.normalized||l.value).toLowerCase()===s){this.logger.debug(" >> MARKER SCAN: found",s,"at offset",p,"- skipping intervening tokens");for(let d=0;d<p;d++)e.advance();if(this.matchTokenSequence(e,r.tokens,t,i))return true;e.reset(n);for(let d of t.keys())o.has(d)||t.delete(d);break}}return true}getGroupLeadingMarker(e){let r=e.tokens[0];return r?.type==="literal"?r.value.toLowerCase():null}getMatchType(e,r){return e.value===r?"exact":e.normalized===r?"normalized":e.stem===r&&e.stemConfidence!==void 0&&e.stemConfidence>=.7?"stem":e.kind==="keyword"&&this.safeToLowerCase(e.value)===r.toLowerCase()?"case-insensitive":"none"}collectStopMarkers(e,r){let t=new Set;for(let i=r;i<e.length;i++){let n=e[i];if(n.type==="literal"){if(t.add(n.value.toLowerCase()),n.alternatives)for(let o of n.alternatives)t.add(o.toLowerCase());break}if(n.type==="group"){for(let o of n.tokens)if(o.type==="literal"){if(t.add(o.value.toLowerCase()),o.alternatives)for(let u of o.alternatives)t.add(u.toLowerCase());break}if(!n.optional)break}}return t}isStopMarker(e,r){return r.size===0?false:!!(r.has(e.value.toLowerCase())||e.normalized&&r.has(e.normalized.toLowerCase()))}tokenToSemanticValue(e){switch(e.kind){case "selector":return se(e.value);case "literal":return this.parseLiteralValue(e.value);case "keyword":let r=e.normalized||e.value;this.safeToLowerCase(r);return B(e.normalized||e.value);case "identifier":if(typeof e.value=="string"&&e.value.startsWith(":"))return Q(e.value);this.safeToLowerCase(e.value);return {type:"expression",raw:e.value};case "url":return B(e.value,"string");default:return null}}parseLiteralValue(e){if(e.startsWith('"')||e.startsWith("'")||e.startsWith("`")||e.startsWith("\u300C")){let i=e.slice(1,-1);return B(i,"string")}if(e==="true")return B(true,"boolean");if(e==="false")return B(false,"boolean");let r=e.match(/^(\d+(?:\.\d+)?)(ms|s|m|h)?$/);if(r){let i=parseFloat(r[1]);return r[2]?B(e,"duration"):B(i,"number")}let t=parseFloat(e);return isNaN(t)?B(e,"string"):B(t,"number")}applyExtractionRules(e,r){for(let[t,i]of Object.entries(e.extraction))r.has(t)||(i.value!==void 0?r.set(t,{type:"literal",value:i.value}):i.default&&r.set(t,i.default));}isOptional(e){return e.type!=="literal"&&e.optional===true}calculateConfidence(e,r){let t=0,i=0,n=p=>e.extraction?.[p]?.default!==void 0;for(let p of e.template.tokens)if(p.type==="role")i+=1,r.has(p.role)&&(t+=1);else if(p.type==="group"){for(let l of p.tokens)if(l.type==="role"){let c=n(l.role),m=.8;i+=m,r.has(l.role)?t+=m:c&&(t+=m*.6);}}let o=i>0?t/i:1;if(this.stemMatchCount>0&&this.totalKeywordMatches>0){let p=this.stemMatchCount/this.totalKeywordMatches*.15;o=Math.max(.5,o-p);}let u=this.calculateVSOConfidenceBoost(e);o=Math.min(1,o+u);let s=this.arabicPrepositionDisambiguation(e,r);return o=Math.max(0,Math.min(1,o+s)),o}calculateVSOConfidenceBoost(e){if(e.language!=="ar")return 0;let r=e.template.tokens[0];if(!r||r.type!=="literal")return 0;let t=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(t.has(r.value))return .15;if(r.alternatives){for(let i of r.alternatives)if(t.has(i))return .15}return 0}arabicPrepositionDisambiguation(e,r){if(e.language!=="ar")return 0;let t=0,i={patient:["\u0639\u0644\u0649"],destination:["\u0625\u0644\u0649","\u0627\u0644\u0649"],source:["\u0645\u0646"],agent:["\u0645\u0646"],manner:["\u0628"],style:["\u0628"],goal:["\u0625\u0644\u0649","\u0627\u0644\u0649"],method:["\u0628"]};for(let[n,o]of r.entries()){let u=i[n];if(!u||u.length===0)continue;let s="metadata"in o?o.metadata:void 0;if(s&&typeof s.prepositionValue=="string"){let p=s.prepositionValue;u.includes(p)?t+=.1:t-=.1;}}return Math.max(-0.1,Math.min(.1,t))}skipNoiseWords(e){let r=e.peek();if(!r)return;let t=this.safeToLowerCase(r.value);if(j.ENGLISH_NOISE_WORDS.has(t)){let i=e.mark();e.advance();let n=e.peek();if(n&&n.kind==="selector")return;e.reset(i);}t==="class"&&e.advance();}extractEventModifiers(e){let r={},t=false;for(;!e.isAtEnd();){let i=e.peek();if(!i||i.kind!=="event-modifier")break;let n=i.metadata;if(!n)break;switch(t=true,n.modifierName){case "once":r.once=true;break;case "debounce":typeof n.value=="number"&&(r.debounce=n.value);break;case "throttle":typeof n.value=="number"&&(r.throttle=n.value);break;case "queue":(n.value==="first"||n.value==="last"||n.value==="all"||n.value==="none")&&(r.queue=n.value);break}e.advance();}return t?r:void 0}};J.MAX_MARKER_SCAN=3;J.MAX_PROPERTY_DEPTH=10;J.MAX_METHOD_ARGS=20;J.ENGLISH_NOISE_WORDS=new Set(["the","a","an"]);var Hr=J;new Hr;var Ie=class{constructor(){this.name="string-literal";}canExtract(a,e){let r=a[e];return r==='"'||r==="'"||r==="`"||r==="\u201C"||r==="\u2018"}extract(a,e){let r=a[e];if(r==="\u201C"){let n=1;for(;e+n<a.length;){if(a[e+n]==="\u201D")return n++,{value:a.substring(e,e+n),length:n};n++;}return null}if(r==="\u2018"){let n=1;for(;e+n<a.length;){if(a[e+n]==="\u2019")return n++,{value:a.substring(e,e+n),length:n};n++;}return null}let t=1,i=false;for(;e+t<a.length;){let n=a[e+t];if(i){i=false,t++;continue}if(n==="\\"){i=true,t++;continue}if(n===r)return t++,{value:a.substring(e,e+t),length:t};t++;}return null}},Me=class{constructor(){this.name="number";}canExtract(a,e){return /\d/.test(a[e])}extract(a,e){let r=0,t=false;for(;e+r<a.length;){let o=a[e+r];if(/\d/.test(o))r++;else if(o==="."&&!t)t=true,r++;else break}if(r===0)return null;let i=a.substring(e,e+r),n=e+r;if(n<a.length){let o=a.slice(n),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 p of u)if(o.startsWith(p.pattern))return {value:i+p.suffix,length:r+p.pattern.length,metadata:{hasTimeUnit:true}};if(o.startsWith("ms"))return {value:i+"ms",length:r+2,metadata:{hasTimeUnit:true}};let s=[{pattern:"\u79D2",suffix:"s"},{pattern:"\u5206",suffix:"m"}];for(let p of s)if(o.startsWith(p.pattern))return {value:i+p.suffix,length:r+1,metadata:{hasTimeUnit:true}};if(/^[smh](?![a-zA-Z])/.test(o))return {value:i+o[0],length:r+1,metadata:{hasTimeUnit:true}}}return {value:i,length:r}}};function Ur(a){return "setContext"in a&&typeof a.setContext=="function"}function Gr(a){let e={language:a.language,direction:a.direction,lookupKeyword:a.lookupKeyword.bind(a),isKeyword:a.isKeyword.bind(a),isKeywordStart:a.isKeywordStart.bind(a)};return a.normalizer?{...e,normalizer:a.normalizer}:e}var Z=class{constructor(a,e){this.pos=0,this.tokens=a,this.language=e;}peek(a=0){let e=this.pos+a;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(a){this.pos=a.position;}position(){return this.pos}remaining(){return this.tokens.slice(this.pos)}takeWhile(a){let e=[];for(;!this.isAtEnd()&&a(this.peek());)e.push(this.advance());return e}skipWhile(a){for(;!this.isAtEnd()&&a(this.peek());)this.advance();}};function b(a,e){return {start:a,end:e}}function C(a,e,r,t){if(typeof a=="object"){let{value:n,kind:o,position:u,normalized:s,stem:p,stemConfidence:l,metadata:c}=a;return {value:n,kind:o,position:u,...s!==void 0&&{normalized:s},...p!==void 0&&{stem:p},...l!==void 0&&{stemConfidence:l},...c!==void 0&&{metadata:c}}}let i=a;if(!e||!r)throw new Error("createToken requires kind and position parameters");if(typeof t=="string")return {value:i,kind:e,position:r,normalized:t};if(t){let{normalized:n,stem:o,stemConfidence:u,metadata:s}=t;return {value:i,kind:e,position:r,...n!==void 0&&{normalized:n},...o!==void 0&&{stem:o},...u!==void 0&&{stemConfidence:u},...s!==void 0&&{metadata:s}}}return {value:i,kind:e,position:r}}function X(a){return /\s/.test(a)}function Kr(a){return a==="#"||a==="."||a==="["||a==="@"||a==="*"||a==="<"}function Yr(a){return a==='"'||a==="'"||a==="`"||a==="\u300C"||a==="\u300D"}function I(a){return /\d/.test(a)}function Qr(a){return /[a-zA-Z]/.test(a)}function x(a){return /[a-zA-Z0-9_-]/.test(a)}function Xr(a,e){if(e>=a.length)return null;let r=a[e];if(!Kr(r))return null;let t=e,i="";if(r==="#"||r==="."){for(i+=a[t++];t<a.length&&x(a[t]);)i+=a[t++];if(i.length<=1)return null;if(t<a.length&&a[t]==="."&&r==="#"){let o=t+1;for(;o<a.length&&x(a[o]);)o++;if(o<a.length&&a[o]==="(")return i}}else if(r==="["){let n=1,o=false,u=null,s=false;for(i+=a[t++];t<a.length&&n>0;){let p=a[t];i+=p,s?s=false:p==="\\"?s=true:o?p===u&&(o=false,u=null):p==='"'||p==="'"||p==="`"?(o=true,u=p):p==="["?n++:p==="]"&&n--,t++;}if(n!==0)return null}else if(r==="@"){for(i+=a[t++];t<a.length&&x(a[t]);)i+=a[t++];if(i.length<=1)return null}else if(r==="*"){for(i+=a[t++];t<a.length&&x(a[t]);)i+=a[t++];if(i.length<=1)return null}else if(r==="<"){if(i+=a[t++],t>=a.length||!Qr(a[t]))return null;for(;t<a.length&&x(a[t]);)i+=a[t++];for(;t<a.length;){let n=a[t];if(n==="."){if(i+=a[t++],t>=a.length||!x(a[t]))return null;for(;t<a.length&&x(a[t]);)i+=a[t++];}else if(n==="#"){if(i+=a[t++],t>=a.length||!x(a[t]))return null;for(;t<a.length&&x(a[t]);)i+=a[t++];}else if(n==="["){let o=1,u=false,s=null,p=false;for(i+=a[t++];t<a.length&&o>0;){let l=a[t];i+=l,p?p=false:l==="\\"?p=true:u?l===s&&(u=false,s=null):l==='"'||l==="'"||l==="`"?(u=true,s=l):l==="["?o++:l==="]"&&o--,t++;}if(o!==0)return null}else break}for(;t<a.length&&X(a[t]);)i+=a[t++];if(t<a.length&&a[t]==="/")for(i+=a[t++];t<a.length&&X(a[t]);)i+=a[t++];if(t>=a.length||a[t]!==">")return null;i+=a[t++];}return i||null}function Jr(a,e){if(e>=a.length||a[e]!=="'"||e+1>=a.length||a[e+1].toLowerCase()!=="s")return false;if(e+2>=a.length)return true;let t=a[e+2];return X(t)||t==="*"||!x(t)}function Zr(a,e){if(e>=a.length)return null;let r=a[e];if(!Yr(r)||r==="'"&&Jr(a,e))return null;let i={'"':'"',"'":"'","`":"`","\u300C":"\u300D"}[r];if(!i)return null;let n=e+1,o=r,u=false;for(;n<a.length;){let s=a[n];if(o+=s,u)u=false;else if(s==="\\")u=true;else if(s===i)return o;n++;}return o}function et(a,e){if(e>=a.length)return false;let r=a[e],t=a[e+1]||"",i=a[e+2]||"";if(r==="/"&&t!=="/"&&/[a-zA-Z0-9._-]/.test(t)||r==="/"&&t==="/"&&/[a-zA-Z]/.test(i)||r==="."&&(t==="/"||t==="."&&i==="/"))return true;let n=a.slice(e,e+8).toLowerCase();return !!(n.startsWith("http://")||n.startsWith("https://"))}function rt(a,e){if(!et(a,e))return null;let r=e,t="",i=/[a-zA-Z0-9/:._\-?&=%@+~!$'()*,;[\]]/;for(;r<a.length;){let n=a[r];if(n==="#"){if(t.length>0&&/[a-zA-Z0-9/.]$/.test(t))for(t+=n,r++;r<a.length&&/[a-zA-Z0-9_-]/.test(a[r]);)t+=a[r++];break}if(i.test(n))t+=n,r++;else break}return t.length<2?null:t}function tt(a,e){if(e>=a.length)return null;let r=a[e];if(!I(r)&&r!=="-"&&r!=="+")return null;let t=e,i="";if((a[t]==="-"||a[t]==="+")&&(i+=a[t++]),t>=a.length||!I(a[t]))return null;for(;t<a.length&&I(a[t]);)i+=a[t++];if(t<a.length&&a[t]===".")for(i+=a[t++];t<a.length&&I(a[t]);)i+=a[t++];return t<a.length&&(a.slice(t,t+2)==="ms"?i+="ms":(a[t]==="s"||a[t]==="m"||a[t]==="h")&&(i+=a[t])),i}var at=["===","!==","->","==","!=","<=",">=","&&","||","**","+=","-=","*=","/=","+","-","*","/","=",">","<","!","&","|","%","^","~"];new Set(at);var Le=class qe{constructor(){this.profileKeywords=[],this.profileKeywordMap=new Map,this.extractors=[];}tokenize(e){if(this.isUsingExtractors())return this.tokenizeWithExtractors(e);throw new Error(`${this.constructor.name}: tokenize() not implemented and no extractors registered. Either register extractors or override tokenize() method.`)}registerExtractor(e){Ur(e)&&e.setContext(Gr(this)),this.extractors.push(e);}registerExtractors(e){for(let r of e)this.registerExtractor(r);}clearExtractors(){this.extractors=[];}isUsingExtractors(){return this.extractors.length>0}tokenizeWithExtractors(e){let r=[],t=0;for(;t<e.length;){for(;t<e.length&&X(e[t]);)t++;if(t>=e.length)break;let i=false;for(let n of this.extractors)if(n.canExtract(e,t)){let o=n.extract(e,t);if(o){let u=o.metadata?.normalized,s=o.metadata?.stem,p=o.metadata?.stemConfidence,l={};if(o.metadata)for(let[m,d]of Object.entries(o.metadata))m!=="normalized"&&m!=="stem"&&m!=="stemConfidence"&&(l[m]=d);let c={};u&&(c.normalized=u),s&&(c.stem=s),p!==void 0&&(c.stemConfidence=p),Object.keys(l).length>0&&(c.metadata=l),r.push(C(o.value,this.classifyToken(o.value),b(t,t+o.length),Object.keys(c).length>0?c:void 0)),t+=o.length,i=true;break}}if(!i){let n=e[t],o=this.classifyUnknownChar(n);r.push(C(n,o,b(t,t+1))),t++;}}return new Z(r,this.language)}classifyUnknownChar(e){return "()[]{},:;".includes(e)?"punctuation":"+-*/<>=!&|".includes(e)?"operator":"identifier"}tryPropertyAccess(e,r,t){if(e[r]!==".")return false;let i=t[t.length-1],n=i&&i.position.end<r;if(i&&!n&&(i.kind==="identifier"||i.kind==="keyword"||i.kind==="selector"))return t.push(C(".","operator",b(r,r+1))),true;let s=r+1;for(;s<e.length&&x(e[s]);)s++;return s<e.length&&e[s]==="("?(t.push(C(".","operator",b(r,r+1))),true):false}initializeKeywordsFromProfile(e,r=[]){let t=new Map;if(e.keywords){for(let[i,n]of Object.entries(e.keywords))if(t.set(n.primary,{native:n.primary,normalized:n.normalized||i}),n.alternatives)for(let o of n.alternatives)t.set(o,{native:o,normalized:n.normalized||i});}if(e.references){for(let[i,n]of Object.entries(e.references))t.set(n,{native:n,normalized:i});for(let i of Object.keys(e.references))t.has(i)||t.set(i,{native:i,normalized:i});}if(e.roleMarkers){for(let[i,n]of Object.entries(e.roleMarkers))if(n.primary&&t.set(n.primary,{native:n.primary,normalized:i}),n.alternatives)for(let o of n.alternatives)t.set(o,{native:o,normalized:i});}if(e.possessive?.keywords)for(let[i,n]of Object.entries(e.possessive.keywords))t.set(i,{native:i,normalized:n});for(let i of r)t.set(i.native,i);this.profileKeywords=Array.from(t.values()).sort((i,n)=>n.native.length-i.native.length),this.profileKeywordMap=new Map;for(let i of this.profileKeywords){this.profileKeywordMap.set(i.native.toLowerCase(),i);let n=this.removeDiacritics(i.native);n!==i.native&&!this.profileKeywordMap.has(n.toLowerCase())&&this.profileKeywordMap.set(n.toLowerCase(),i);}}removeDiacritics(e){return e.replace(/[\u064B-\u0652\u0670]/g,"")}tryProfileKeyword(e,r){for(let t of this.profileKeywords)if(e.slice(r).startsWith(t.native))return C(t.native,"keyword",b(r,r+t.native.length),t.normalized);return null}isKeywordStart(e,r){let t=e.slice(r);return this.profileKeywords.some(i=>t.startsWith(i.native))}lookupKeyword(e){return this.profileKeywordMap.get(e.toLowerCase())}isKeyword(e){return this.profileKeywordMap.has(e.toLowerCase())}setNormalizer(e){this.normalizer=e;}tryNormalize(e){if(!this.normalizer)return null;let r=this.normalizer.normalize(e);return r.stem!==e&&r.confidence>=.7?r:null}tryMorphKeywordMatch(e,r,t){let i=this.tryNormalize(e);if(!i)return null;let n=this.lookupKeyword(i.stem);if(!n)return null;let o={normalized:n.normalized,stem:i.stem,stemConfidence:i.confidence};return C(e,"keyword",b(r,t),o)}trySelector(e,r){let t=Xr(e,r);return t?C(t,"selector",b(r,r+t.length)):null}tryEventModifier(e,r){if(e[r]!==".")return null;let t=e.slice(r).match(/^\.(?:once|debounce|throttle|queue)(?:\(([^)]+)\))?(?:\s|$|\.)/);if(!t)return null;let i=t[0].replace(/(\s|\.)$/,""),n=i.slice(1).split("(")[0],o=t[1];return {...C(i,"event-modifier",b(r,r+i.length)),metadata:{modifierName:n,value:o?n==="queue"?o:parseInt(o,10):void 0}}}tryString(e,r){let t=Zr(e,r);return t?C(t,"literal",b(r,r+t.length)):null}tryNumber(e,r){let t=tt(e,r);return t?C(t,"literal",b(r,r+t.length)):null}tryMatchTimeUnit(e,r,t,i=false){let n=r;if(i)for(;n<e.length&&X(e[n]);)n++;let o=e.slice(n);for(let u of t){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 l=o[u.length]||"";if(x(l))continue}return {suffix:u.suffix,endPos:n+u.length}}}return null}parseBaseNumber(e,r,t=true){let i=r,n="";if(t&&(e[i]==="-"||e[i]==="+")&&(n+=e[i++]),i>=e.length||!I(e[i]))return null;for(;i<e.length&&I(e[i]);)n+=e[i++];if(i<e.length&&e[i]===".")for(n+=e[i++];i<e.length&&I(e[i]);)n+=e[i++];return !n||n==="-"||n==="+"?null:{number:n,endPos:i}}tryNumberWithTimeUnits(e,r,t,i={}){let{allowSign:n=true,skipWhitespace:o=false}=i,u=this.parseBaseNumber(e,r,n);if(!u)return null;let{number:s,endPos:p}=u,l=[...t,...qe.STANDARD_TIME_UNITS],c=this.tryMatchTimeUnit(e,p,l,o);return c&&(s+=c.suffix,p=c.endPos),C(s,"literal",b(r,p))}tryUrl(e,r){let t=rt(e,r);return t?C(t,"url",b(r,r+t.length)):null}tryVariableRef(e,r){if(e[r]!==":"||r+1>=e.length||!x(e[r+1]))return null;let t=r+1;for(;t<e.length&&x(e[t]);)t++;let i=e.slice(r,t);return C(i,"identifier",b(r,t))}tryOperator(e,r){let t=e.slice(r,r+2);if(["==","!=","<=",">=","&&","||","->"].includes(t))return C(t,"operator",b(r,r+2));let i=e[r];return ["<",">","!","+","-","*","/","="].includes(i)?C(i,"operator",b(r,r+1)):["(",")","{","}",",",";",":"].includes(i)?C(i,"punctuation",b(r,r+1)):null}tryMultiCharParticle(e,r,t){for(let i of t)if(e.slice(r,r+i.length)===i)return C(i,"particle",b(r,r+i.length));return null}};Le.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 $e=Le;var it=Object.defineProperty,nt=Object.getOwnPropertyNames,Ze=(a,e)=>function(){return a&&(e=(0, a[nt(a)[0]])(a=0)),e},ot=(a,e)=>{for(var r in e)it(a,r,{get:e[r],enumerable:true});};function Ve(a,e){return a.replace(/\{(\w+)\}/g,(r,t)=>String(e[t]??`{${t}}`))}function T(a,e,r={},t){let i=er[a],n=Ve(i,r),o=rr[a],u=o?Ve(o,r):void 0;return {code:a,message:n,severity:e,...t&&{role:t},...u&&{suggestion:u}}}var f,er,rr,ut=Ze({"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"},er={[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."},rr={[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."};}}),tr={};ot(tr,{SchemaErrorCodes:()=>f,formatValidationResults:()=>yt,getValidationStats:()=>ft,validateAllKeywordCollisions:()=>ht,validateAllSchemas:()=>dt,validateCommandSchema:()=>ar,validateKeywordCollisions:()=>ir,validateRoleValues:()=>vt});function st(a,e){return {action:a,items:e}}function ar(a){let e=[];for(let t of a.roles)t.expectedTypes.includes("literal")&&t.expectedTypes.includes("selector")&&(t.role==="patient"&&ze.has(a.action)?e.push(T(f.MULTI_TYPE_PATIENT_EXPECTED,"note",{role:t.role,command:a.action},t.role)):e.push(T(f.AMBIGUOUS_TYPE_LITERAL_SELECTOR,"warning",{role:t.role},t.role))),t.expectedTypes.length>3&&!ze.has(a.action)&&e.push(T(f.TOO_MANY_EXPECTED_TYPES,"warning",{role:t.role,count:t.expectedTypes.length},t.role));for(let t of a.roles)t.selectorKinds&&t.selectorKinds.length>0&&(t.expectedTypes.includes("selector")||e.push(T(f.SELECTOR_KINDS_WITHOUT_SELECTOR_TYPE,"warning",{role:t.role},t.role)));switch(a.action){case "transition":lt(a,e);break;case "on":pt(a,e);break;case "if":case "unless":ct(a,e);break;case "repeat":case "for":case "while":mt(a,e);break}return a.roles.filter(t=>t.required).length===0&&(nr.has(a.action)?e.push(T(f.NO_REQUIRED_ROLES_EXPECTED,"note",{command:a.action})):e.push(T(f.NO_REQUIRED_ROLES,"warning",{}))),st(a.action,e)}function lt(a,e){let r=a.roles.find(i=>i.role==="patient"),t=a.roles.find(i=>i.role==="goal");r&&r.expectedTypes.includes("selector")&&e.push(T(f.TRANSITION_PATIENT_ACCEPTS_SELECTOR,"warning",{},"patient")),r&&!t&&e.push(T(f.TRANSITION_MISSING_GOAL,"error",{}));}function pt(a,e){let r=a.roles.find(t=>t.role==="event");r||e.push(T(f.EVENT_HANDLER_MISSING_EVENT,"warning",{})),r&&!r.required&&e.push(T(f.EVENT_HANDLER_EVENT_NOT_REQUIRED,"warning",{}));}function ct(a,e){let r=a.roles.find(t=>t.role==="condition");r||e.push(T(f.CONDITIONAL_MISSING_CONDITION,"warning",{})),r&&!r.required&&e.push(T(f.CONDITIONAL_CONDITION_NOT_REQUIRED,"warning",{}));}function mt(a,e){a.action==="for"?a.roles.find(t=>t.role==="source")||e.push(T(f.FOR_LOOP_MISSING_SOURCE,"warning",{})):a.action==="while"&&(a.roles.find(t=>t.role==="condition")||e.push(T(f.WHILE_LOOP_MISSING_CONDITION,"warning",{})));}function dt(a,e={}){let r=new Map,{includeNotes:t=false}=e;for(let[i,n]of Object.entries(a)){let o=ar(n),u=o.items.some(p=>p.severity==="warning"||p.severity==="error"),s=t&&o.items.some(p=>p.severity==="note");(u||s)&&r.set(i,o);}return r}function yt(a,e={}){let r=[],{showNotes:t=false,showCodes:i=true}=e;for(let[n,o]of a){let u=o.items.filter(l=>l.severity==="error"),s=o.items.filter(l=>l.severity==="warning"),p=o.items.filter(l=>l.severity==="note");if(u.length>0){r.push(` \u274C ${n}:`);for(let l of u){let c=i?` [${l.code}]`:"";r.push(` ERROR${c}: ${l.message}`),l.suggestion&&r.push(` \u{1F4A1} Suggestion: ${l.suggestion}`);}}if(s.length>0){r.push(` \u26A0\uFE0F ${n}:`);for(let l of s){let c=i?` [${l.code}]`:"";r.push(` ${c?`${l.code}: `:""}${l.message}`),l.suggestion&&r.push(` \u{1F4A1} ${l.suggestion}`);}}if(t&&p.length>0){r.push(` \u2139\uFE0F ${n}:`);for(let l of p){let c=i?` [${l.code}]`:"";r.push(` ${c?`${l.code}: `:""}${l.message}`);}}}return r.join(`
2
+ `)}function ft(a){let e=0,r=0,t=0,i={};for(let n of a.values())for(let o of n.items)o.severity==="error"?e++:o.severity==="warning"?r++:o.severity==="note"&&t++,i[o.code]=(i[o.code]||0)+1;return {totalCommands:a.size,errors:e,warnings:r,notes:t,byCode:i}}function vt(a,e){let r=[];for(let t of e){let i=a.roles.find(n=>n.role===t.role);i&&(i.expectedTypes.length>0&&!i.expectedTypes.includes(t.type)&&(i.expectedTypes.includes("expression")||r.push({level:"error",role:t.role,message:`${a.action}.${t.role} expects type [${i.expectedTypes.join(", ")}], got '${t.type}'`,code:f.VALUE_TYPE_MISMATCH})),t.type==="selector"&&t.selectorKind&&i.selectorKinds&&i.selectorKinds.length>0&&(i.selectorKinds.includes(t.selectorKind)||r.push({level:"error",role:t.role,message:`${a.action}.${t.role} expects selector kind [${i.selectorKinds.join(", ")}], got '${t.selectorKind}'`,code:f.SELECTOR_KIND_MISMATCH})));}return r}function ir(a){let e=[];if(!a.keywords)return {language:a.code,collisions:e};let r=new Map;for(let[i,n]of Object.entries(a.keywords)){if(!n||!n.primary)continue;let o=r.get(n.primary)||[];if(o.push({command:i,isPrimary:true}),r.set(n.primary,o),n.alternatives)for(let u of n.alternatives){let s=r.get(u)||[];s.push({command:i,isPrimary:false}),r.set(u,s);}}for(let[i,n]of r){let o=[...new Set(n.map(p=>p.command))];if(o.length<=1)continue;let u=n.filter(p=>p.isPrimary).length,s;u>=2?s="primary-primary":u===1?s="primary-alternative":s="alternative-alternative",e.push({keyword:i,commands:o.sort(),type:s});}let t={"primary-primary":0,"primary-alternative":1,"alternative-alternative":2};return e.sort((i,n)=>t[i.type]-t[n.type]),{language:a.code,collisions:e}}function ht(a){let e=[];for(let[,r]of Object.entries(a)){let t=ir(r);t.collisions.length>0&&e.push(t);}return e.sort((r,t)=>r.language.localeCompare(t.language))}var ze,nr,gt=Ze({"src/generators/schema-validator.ts"(){ut(),ze=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"]);}});var L=new Map,R=new Map,W=new Map,be=null;function or(a,e){let r={...a};for(let t of Object.keys(e)){let i=e[t],n=a[t];i!==void 0&&(typeof i=="object"&&i!==null&&!Array.isArray(i)&&typeof n=="object"&&n!==null&&!Array.isArray(n)?r[t]=or(n,i):r[t]=i);}return r}function Et(a,e){return or(a,e)}function Ae(a){if(!a.extends)return a;let e=R.get(a.extends);if(!e)return console.warn(`[Registry] Profile '${a.code}' extends '${a.extends}' but base is not registered. Make sure to import the base language before the variant.`),a;let r=Ae(e);return Et(r,a)}function ur(a,e,r){L.set(a,e),R.set(a,r),W.delete(a);}function sr(a){be=a;}var Ce=new Map;function lr(a,e){Ce.set(a,e),W.delete(a);}function U(a){return a.split("-")[0]}function G(a){return a.includes("-")}function kt(a){let e=L.get(a);if(!e&&G(a)){let r=U(a);e=L.get(r);}if(!e){let r=Array.from(L.keys()).join(", ");throw new Error(`Language '${a}' is not registered. Registered languages: ${r||"none"}. Import the language module first: import '@lokascript/semantic/languages/${a}';`)}return e}function zt(a){let e=R.get(a);if(!e&&G(a)){let r=U(a);e=R.get(r);}if(!e){let r=Array.from(R.keys()).join(", ");throw new Error(`Language profile '${a}' is not registered. Registered languages: ${r||"none"}. Import the language module first: import '@lokascript/semantic/languages/${a}';`)}return Ae(e)}function q(a){let e=R.get(a);return !e&&G(a)&&(e=R.get(U(a))),e?Ae(e):void 0}function bt(){return Array.from(L.keys())}function pr(a){if(L.has(a)&&R.has(a))return true;if(G(a)){let e=U(a);return L.has(e)&&R.has(e)}return false}function Ct(a,e){return kt(e).tokenize(a)}function H(a){let e=W.get(a);if(!e&&G(a)&&(e=W.get(U(a))),e)return e;let r=Ce.get(a);if(!r&&G(a)&&(r=Ce.get(U(a))),r)return W.set(a,r),r;if(!be)throw new Error(`No patterns registered for language '${a}'. Either import the language module or set a pattern generator.`);let t=zt(a),i=be(t);return W.set(a,i),i}function re(a){let e="complex";return a.startsWith("#")&&!a.includes(" ")?e="id":a.startsWith(".")&&!a.includes(" ")?e="class":a.startsWith("[")&&a.endsWith("]")?e="attribute":/^[a-z][a-z0-9]*$/i.test(a)&&(e="element"),{type:"selector",value:a,selectorKind:e}}function A(a,e){let r={type:"literal",value:a};return e!==void 0?{type:"literal",value:a,dataType:e}:r}function je(a){return ge(a)}function M(a){return {type:"reference",value:a}}function Ee(a,e){return {type:"property-path",object:a,property:e}}function pe(a,e,r){let t={kind:"command",action:a,roles:new Map(Object.entries(e))};return r!==void 0?{...t,metadata:r}:t}function We(a,e,r,t,i,n){let o=new Map;o.set("event",a);let u={kind:"event-handler",action:"on",roles:o,body:e};return r!==void 0&&(u.eventModifiers=r),t!==void 0&&(u.metadata=t),u}function He(a,e="then",r){let t={kind:"compound",action:"compound",roles:new Map,statements:a,chainType:e};return r!==void 0&&(t.metadata=r),t}function Ue(a,e){return !e||e.length===0||e.includes(a)||e.includes("expression")?true:a==="property-path"?e.some(r=>["selector","reference","expression"].includes(r)):false}function Yt(a,e){return a.possessive?.keywords?.[e]}var ke=.8,Qt=.6,Xt=.15,Jt=.5,Ge=.15,Ke=.1,Ye=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"]),Zt={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"]},ea=class{calculate(a){return this.calculateWithBreakdown(a).final}calculateWithBreakdown(a){let e=this.scoreRoleCoverage(a),r=this.scoreStemPenalty(a),t=this.scoreLanguageBoost(a),i=this.scoreLanguageAdjustment(a),n=e;return n=Math.max(Jt,n+r),n=Math.min(1,n+t),n=Math.max(0,Math.min(1,n+i)),{roleCoverage:e,stemPenalty:r,languageBoost:t,languageAdjustment:i,final:n}}scoreRoleCoverage(a){let{pattern:e,captured:r}=a,t=0,i=0,n=o=>e.extraction?.[o]?.default!==void 0;for(let o of e.template.tokens)if(o.type==="role")i+=1,r.has(o.role)&&(t+=1);else if(o.type==="group")for(let u of o.tokens)u.type==="role"&&(i+=ke,r.has(u.role)?t+=ke:n(u.role)&&(t+=ke*Qt));return i>0?t/i:1}scoreStemPenalty(a){let{stemMatchCount:e,totalKeywordMatches:r}=a;return e<=0||r<=0?0:-(e/r)*Xt}scoreLanguageBoost(a){let{pattern:e}=a;if(e.language!=="ar")return 0;let r=e.template.tokens[0];return !r||r.type!=="literal"?0:Ye.has(r.value)||r.alternatives?.some(t=>Ye.has(t))?Ge:0}scoreLanguageAdjustment(a){let{pattern:e,captured:r}=a;if(e.language!=="ar")return 0;let t=0;for(let[i,n]of r.entries()){let o=Zt[i];if(!o||o.length===0)continue;let u="metadata"in n?n.metadata:void 0;u&&typeof u.prepositionValue=="string"&&(o.includes(u.prepositionValue)?t+=.1:t-=.1);}return Math.max(-Ke,Math.min(Ke,t))}},ra=new ea,me=class ee{constructor(e){this.matchCache=new Map,this.stemMatchCount=0,this.totalKeywordMatches=0,this.confidenceModel=e??ra;}matchPattern(e,r){let t=e.mark(),i=new Map;if(this.currentProfile=q(r.language),this.stemMatchCount=0,this.totalKeywordMatches=0,!this.matchTokenSequence(e,r.template.tokens,i))return e.reset(t),null;let o=this.confidenceModel.calculate({pattern:r,captured:i,stemMatchCount:this.stemMatchCount,totalKeywordMatches:this.totalKeywordMatches});return this.applyExtractionRules(r,i),{pattern:r,captured:i,consumedTokens:e.position()-t.position,confidence:o}}matchBest(e,r){this.matchCache.clear();let t=[],i=e.position();for(let o of r){let u=e.mark(),s=`${i}:${o.id}`,p;this.matchCache.has(s)?p=this.matchCache.get(s):(p=this.matchPattern(e,o),this.matchCache.set(s,p)),p&&t.push(p),e.reset(u);}if(t.length===0)return null;t.sort((o,u)=>{let s=u.pattern.priority-o.pattern.priority;return s!==0?s:u.confidence-o.confidence});let n=t[0];return this.matchPattern(e,n.pattern),n}matchTokenSequence(e,r,t){let i=r[0],n=i?.type==="literal"&&(i.value==="and"||i.value==="then"||i.alternatives?.includes("and")||i.alternatives?.includes("then"));if(this.currentProfile?.code==="ar"&&!n)for(;e.peek()?.kind==="conjunction";)e.advance();for(let o of r)if(!this.matchPatternToken(e,o,t)){if(this.isOptional(o))continue;return false}return true}matchPatternToken(e,r,t){switch(r.type){case "literal":return this.matchLiteralToken(e,r);case "role":return this.matchRoleToken(e,r,t);case "group":return this.matchGroupToken(e,r,t);default:return false}}matchLiteralToken(e,r){let t=e.peek();if(!t)return false;let i=this.getMatchType(t,r.value);if(i!=="none")return this.totalKeywordMatches++,i==="stem"&&this.stemMatchCount++,e.advance(),true;if(r.alternatives)for(let n of r.alternatives){let o=this.getMatchType(t,n);if(o!=="none")return this.totalKeywordMatches++,o==="stem"&&this.stemMatchCount++,e.advance(),true}return false}matchRoleToken(e,r,t){this.skipNoiseWords(e);let i=e.peek();if(!i)return r.optional||false;let n=this.tryMatchPossessiveExpression(e);if(n)return r.expectedTypes&&r.expectedTypes.length>0&&!r.expectedTypes.includes(n.type)&&!r.expectedTypes.includes("expression")?r.optional||false:(t.set(r.role,n),true);let o=this.tryMatchMethodCallExpression(e);if(o)return r.expectedTypes&&r.expectedTypes.length>0&&!r.expectedTypes.includes(o.type)&&!r.expectedTypes.includes("expression")?r.optional||false:(t.set(r.role,o),true);let u=this.tryMatchPossessiveSelectorExpression(e);if(u)return r.expectedTypes&&r.expectedTypes.length>0&&!Ue(u.type,r.expectedTypes)?r.optional||false:(t.set(r.role,u),true);let s=this.tryMatchPropertyAccessExpression(e);if(s)return r.expectedTypes&&r.expectedTypes.length>0&&!r.expectedTypes.includes(s.type)&&!r.expectedTypes.includes("expression")?r.optional||false:(t.set(r.role,s),true);let p=this.tryMatchSelectorPropertyExpression(e);if(p)return r.expectedTypes&&r.expectedTypes.length>0&&!Ue(p.type,r.expectedTypes)?r.optional||false:(t.set(r.role,p),true);let l=this.tokenToSemanticValue(i);return !l||r.expectedTypes&&r.expectedTypes.length>0&&!r.expectedTypes.includes(l.type)?r.optional||false:(t.set(r.role,l),e.advance(),true)}tryMatchPossessiveExpression(e){let r=e.peek();if(!r||!this.currentProfile)return null;let t=(r.normalized||r.value).toLowerCase(),i=Yt(this.currentProfile,t);if(!i)return null;let n=e.mark();e.advance();let o=e.peek();if(!o)return e.reset(n),null;if(o.kind==="identifier"||o.kind==="keyword"&&!this.isStructuralKeyword(o.value)||o.kind==="selector"&&o.value.startsWith("*")||o.kind==="selector"&&o.value.startsWith("@")||o.kind==="selector"&&o.value.startsWith(".")&&/^\.[a-zA-Z_]\w*/.test(o.value)){e.advance();let u=o.value;o.kind==="selector"&&u.startsWith(".")&&/^\.[a-zA-Z_]\w*/.test(u)&&(u=u.substring(1));let s=u;for(;e.peek()?.kind==="selector"&&e.peek().value.startsWith(".")&&/^\.[a-zA-Z_]\w*/.test(e.peek().value);)s+=e.peek().value,e.advance();let p=e.peek();return p?.kind==="literal"&&p.value.startsWith("(")&&(s+=p.value,e.advance()),Ee(M(i),s)}return e.reset(n),null}isStructuralKeyword(e){return new Set(["into","in","to","from","at","by","with","without","before","after","of","as","on","then","end","else","if","repeat","while","for","toggle","add","remove","put","set","show","hide","increment","decrement","send","trigger","call"]).has(e.toLowerCase())}tryMatchMethodCallExpression(e){let r=e.peek();if(!r||r.kind!=="selector")return null;let t=e.mark();e.advance();let i=e.peek();if(!i||i.kind!=="operator"||i.value!==".")return e.reset(t),null;e.advance();let n=e.peek();if(!n||n.kind!=="identifier")return e.reset(t),null;e.advance();let o=e.peek();if(!o||o.kind!=="punctuation"||o.value!=="(")return e.reset(t),null;e.advance();let u=[];for(;!e.isAtEnd()&&u.length<ee.MAX_METHOD_ARGS;){let p=e.peek();if(!p)break;if(p.kind==="punctuation"&&p.value===")"){e.advance();break}if(p.kind==="punctuation"&&p.value===","){e.advance();continue}u.push(p.value),e.advance();}return {type:"expression",raw:`${r.value}.${n.value}(${u.join(", ")})`}}tryMatchPropertyAccessExpression(e){let r=e.peek();if(!r||r.kind!=="identifier"&&r.kind!=="keyword")return null;let t=e.mark();e.advance();let i=e.peek();if(!i||i.kind!=="operator"||i.value!==".")return e.reset(t),null;e.advance();let n=e.peek();if(!n||n.kind!=="identifier")return e.reset(t),null;e.advance();let o=`${r.value}.${n.value}`,u=1;for(;!e.isAtEnd()&&u<ee.MAX_PROPERTY_DEPTH;){let p=e.peek();if(!p||p.kind!=="operator"||p.value!==".")break;e.advance();let l=e.peek();if(!l||l.kind!=="identifier")break;e.advance(),o+=`.${l.value}`,u++;}let s=e.peek();if(s&&s.kind==="punctuation"&&s.value==="("){e.advance();let p=[],l=0;for(;!e.isAtEnd()&&p.length<ee.MAX_METHOD_ARGS;){let m=e.peek();if(!m)break;if(m.kind==="punctuation"&&m.value===")"){if(l===0){e.advance();break}l--;}if(m.kind==="punctuation"&&m.value==="("&&l++,m.kind==="punctuation"&&m.value===","){e.advance();continue}p.push(m.value),e.advance();}return {type:"expression",raw:`${o}(${p.join(", ")})`}}return {type:"expression",raw:o}}tryMatchPossessiveSelectorExpression(e){let r=e.peek();if(!r||r.kind!=="selector")return null;let t=e.mark();e.advance();let i=e.peek();if(!i||i.kind!=="punctuation"||i.value!=="'s")return e.reset(t),null;e.advance();let n=e.peek();return !n||n.kind!=="selector"&&n.kind!=="identifier"?(e.reset(t),null):(e.advance(),Ee(re(r.value),n.value))}tryMatchSelectorPropertyExpression(e){let r=e.peek();if(!r||r.kind!=="selector"||!r.value.startsWith("#"))return null;let t=e.mark();e.advance();let i=e.peek();if(!i||i.kind!=="selector"||!i.value.startsWith("."))return e.reset(t),null;let n=e.peek(1);n&&n.kind,e.advance();let o=i.value.slice(1);return Ee(re(r.value),o)}matchGroupToken(e,r,t){let i=e.mark(),n=new Set(t.keys());if(!this.matchTokenSequence(e,r.tokens,t)){e.reset(i);for(let u of t.keys())n.has(u)||t.delete(u);return r.optional||false}return true}getMatchType(e,r){return e.value===r?"exact":e.normalized===r?"normalized":e.stem===r&&e.stemConfidence!==void 0&&e.stemConfidence>=.7?"stem":e.kind==="keyword"&&e.value.toLowerCase()===r.toLowerCase()?"case-insensitive":"none"}tokenToSemanticValue(e){switch(e.kind){case "selector":return re(e.value);case "literal":return this.parseLiteralValue(e.value);case "keyword":let r=(e.normalized||e.value).toLowerCase();return je(r)?M(r):A(e.normalized||e.value);case "identifier":if(e.value.startsWith(":"))return M(e.value);let t=e.value.toLowerCase();return je(t)?M(t):{type:"expression",raw:e.value};case "url":return A(e.value,"string");default:return null}}parseLiteralValue(e){if(e.startsWith('"')||e.startsWith("'")||e.startsWith("`")||e.startsWith("\u300C")){let i=e.slice(1,-1);return A(i,"string")}if(e==="true")return A(true,"boolean");if(e==="false")return A(false,"boolean");let r=e.match(/^(\d+(?:\.\d+)?)(ms|s|m|h)?$/);if(r){let i=parseFloat(r[1]);return r[2]?A(e,"duration"):A(i,"number")}let t=parseFloat(e);return isNaN(t)?A(e,"string"):A(t,"number")}applyExtractionRules(e,r){for(let[t,i]of Object.entries(e.extraction))r.has(t)||(i.value!==void 0?r.set(t,{type:"literal",value:i.value}):i.default&&r.set(t,i.default));}isOptional(e){return e.type!=="literal"&&e.optional===true}skipNoiseWords(e){let r=e.peek();if(!r)return;let t=r.value.toLowerCase();if(ee.ENGLISH_NOISE_WORDS.has(t)){let i=e.mark();e.advance();let n=e.peek();if(n&&(n.kind==="selector"||n.kind==="identifier"))return;e.reset(i);}t==="class"&&e.advance();}extractEventModifiers(e){let r={},t=false;for(;!e.isAtEnd();){let i=e.peek();if(!i||i.kind!=="event-modifier")break;let n=i.metadata;if(!n)break;switch(t=true,n.modifierName){case "once":r.once=true;break;case "debounce":typeof n.value=="number"&&(r.debounce=n.value);break;case "throttle":typeof n.value=="number"&&(r.throttle=n.value);break;case "queue":(n.value==="first"||n.value==="last"||n.value==="all"||n.value==="none")&&(r.queue=n.value);break}e.advance();}return t?r:void 0}};me.MAX_PROPERTY_DEPTH=10;me.MAX_METHOD_ARGS=20;me.ENGLISH_NOISE_WORDS=new Set(["the","a","an"]);var ta=me,N=new ta;function te(a,e){return Ct(a,e)}function cr(){return bt()}var aa={ko:{\uD074\uB9AD:"click",\uC785\uB825:"input",\uBCC0\uACBD:"change",\uC81C\uCD9C:"submit",\uD0A4\uB2E4\uC6B4:"keydown",\uD0A4\uC5C5:"keyup",\uB9C8\uC6B0\uC2A4\uC624\uBC84:"mouseover",\uB9C8\uC6B0\uC2A4\uC544\uC6C3:"mouseout",\uB9C8\uC6B0\uC2A4\uB2E4\uC6B4:"mousedown",\uB9C8\uC6B0\uC2A4\uC5C5:"mouseup",\uD3EC\uCEE4\uC2A4:"focus",\uBE14\uB7EC:"blur",\uB85C\uB4DC:"load",\uB9AC\uC0AC\uC774\uC988:"resize",\uC2A4\uD06C\uB864:"scroll"},ja:{\u30AF\u30EA\u30C3\u30AF:"click",\u5165\u529B:"input",\u5909\u66F4:"change",\u9001\u4FE1:"submit",\u30AD\u30FC\u30C0\u30A6\u30F3:"keydown",\u30AD\u30FC\u30A2\u30C3\u30D7:"keyup",\u30AD\u30FC\u30D7\u30EC\u30B9:"keypress",\u30DE\u30A6\u30B9\u30AA\u30FC\u30D0\u30FC:"mouseover",\u30DE\u30A6\u30B9\u30A2\u30A6\u30C8:"mouseout",\u30DE\u30A6\u30B9\u62BC\u4E0B:"mousedown",\u30DE\u30A6\u30B9\u89E3\u653E:"mouseup",\u30D5\u30A9\u30FC\u30AB\u30B9:"focus",\u30D6\u30E9\u30FC:"blur",\u30ED\u30FC\u30C9:"load",\u8AAD\u307F\u8FBC\u307F:"load",\u30B5\u30A4\u30BA\u5909\u66F4:"resize",\u30B9\u30AF\u30ED\u30FC\u30EB:"scroll"},ar:{\u0627\u0644\u0646\u0642\u0631:"click",\u0646\u0642\u0631:"click",\u0627\u0644\u0625\u062F\u062E\u0627\u0644:"input",\u0625\u062F\u062E\u0627\u0644:"input",\u0627\u0644\u062A\u063A\u064A\u064A\u0631:"change",\u062A\u063A\u064A\u064A\u0631:"change",\u0627\u0644\u0625\u0631\u0633\u0627\u0644:"submit",\u0625\u0631\u0633\u0627\u0644:"submit","\u0636\u063A\u0637 \u0627\u0644\u0645\u0641\u062A\u0627\u062D":"keydown","\u0631\u0641\u0639 \u0627\u0644\u0645\u0641\u062A\u0627\u062D":"keyup","\u062A\u0645\u0631\u064A\u0631 \u0627\u0644\u0645\u0627\u0648\u0633":"mouseover",\u0627\u0644\u062A\u0631\u0643\u064A\u0632:"focus",\u062A\u062D\u0645\u064A\u0644:"load",\u062A\u0645\u0631\u064A\u0631:"scroll"},es:{clic:"click",click:"click",entrada:"input",cambio:"change",env\u00EDo:"submit",enviar:"submit","tecla abajo":"keydown","tecla arriba":"keyup","rat\xF3n encima":"mouseover","rat\xF3n fuera":"mouseout",enfoque:"focus",desenfoque:"blur",carga:"load",desplazamiento:"scroll"},tr:{t\u0131klama:"click",t\u0131kla:"click",t\u0131k:"click",giri\u015F:"input",girdi:"input",de\u011Fi\u015Fiklik:"change",de\u011Fi\u015Fim:"change",g\u00F6nderme:"submit",g\u00F6nder:"submit",tu\u015Fbasma:"keydown",tu\u015Fb\u0131rakma:"keyup",fare_bas:"mousedown",fare_b\u0131rak:"mouseup",farei\u00E7inde:"mouseover",fared\u0131\u015F\u0131nda:"mouseout",odaklanma:"focus",odak:"focus",bulan\u0131kl\u0131k:"blur",y\u00FCkleme:"load",y\u00FCkle:"load",boyut_de\u011Fi\u015Ftir:"resize",kayd\u0131rma:"scroll"},pt:{clique:"click",clicar:"click",click:"click",entrada:"input",inserir:"input",mudan\u00E7a:"change",mudanca:"change",alterar:"change",envio:"submit",enviar:"submit","tecla baixo":"keydown","tecla cima":"keyup","pressionar tecla":"keydown","soltar tecla":"keyup","mouse sobre":"mouseover","mouse fora":"mouseout",foco:"focus",focar:"focus",desfoque:"blur",desfocar:"blur",carregar:"load",carregamento:"load",rolagem:"scroll",rolar:"scroll"},zh:{\u70B9\u51FB:"click",\u5355\u51FB:"click",\u53CC\u51FB:"dblclick",\u8F93\u5165:"input",\u6539\u53D8:"change",\u53D8\u5316:"change",\u53D8\u66F4:"change",\u63D0\u4EA4:"submit",\u53D1\u9001:"submit",\u6309\u952E:"keydown",\u952E\u5165:"keydown",\u677E\u952E:"keyup",\u9F20\u6807\u8FDB\u5165:"mouseover",\u9F20\u6807\u79FB\u5165:"mouseover",\u9F20\u6807\u79BB\u5F00:"mouseout",\u9F20\u6807\u79FB\u51FA:"mouseout",\u7126\u70B9:"focus",\u805A\u7126:"focus",\u5931\u7126:"blur",\u6A21\u7CCA:"blur",\u52A0\u8F7D:"load",\u8F7D\u5165:"load",\u6EDA\u52A8:"scroll"},fr:{clic:"click",cliquer:"click",click:"click",saisie:"input",entr\u00E9e:"input",changement:"change",changer:"change",soumettre:"submit",soumission:"submit",envoi:"submit","touche bas":"keydown","touche haut":"keyup","souris dessus":"mouseover","souris dehors":"mouseout",focus:"focus",focaliser:"focus",d\u00E9focus:"blur",d\u00E9focaliser:"blur",chargement:"load",charger:"load",d\u00E9filement:"scroll",d\u00E9filer:"scroll"},de:{klick:"click",klicken:"click",click:"click",eingabe:"input",eingeben:"input",\u00E4nderung:"change",\u00E4ndern:"change",absenden:"submit",einreichen:"submit","taste runter":"keydown","taste hoch":"keyup","maus \xFCber":"mouseover","maus raus":"mouseout",fokus:"focus",fokussieren:"focus",defokussieren:"blur",unsch\u00E4rfe:"blur",laden:"load",ladung:"load",scrollen:"scroll",bl\u00E4ttern:"scroll"},id:{klik:"click",click:"click",masukan:"input",input:"input",ubah:"change",perubahan:"change",kirim:"submit","tekan tombol":"keydown","lepas tombol":"keyup","mouse masuk":"mouseover","mouse keluar":"mouseout",fokus:"focus",blur:"blur",muat:"load",memuat:"load",gulir:"scroll",menggulir:"scroll"},bn:{\u0995\u09CD\u09B2\u09BF\u0995:"click",\u0987\u09A8\u09AA\u09C1\u099F:"input",\u099C\u09AE\u09BE:"submit",\u09B2\u09CB\u09A1:"load",\u09B8\u09CD\u0995\u09CD\u09B0\u09CB\u09B2:"scroll",\u09B0\u09BF\u09B8\u09BE\u0987\u099C:"resize",\u099D\u09BE\u09AA\u09B8\u09BE:"blur",\u09AB\u09CB\u0995\u09BE\u09B8:"focus",\u09AA\u09B0\u09BF\u09AC\u09B0\u09CD\u09A4\u09A8:"change"},qu:{click:"click","\xF1it'iy":"click",\u00F1itiy:"click",yaykuchiy:"input",yaykuy:"input",tikray:"change","t'ikray":"change",apachiy:"submit",kachay:"submit","llave uray":"keydown","llave hawa":"keyup","q'away":"focus",qhaway:"focus",paqariy:"blur","mana q'away":"blur",cargay:"load",apakuy:"load",apamuy:"load",kunray:"scroll",muyuy:"scroll",hatun_kay:"resize"},sw:{bofya:"click",click:"click",kubofya:"click",ingiza:"input",kubadilisha:"change",mabadiliko:"change",tuma:"submit",kutuma:"submit","bonyeza chini":"keydown","bonyeza juu":"keyup","panya juu":"mouseover","panya nje":"mouseout",lenga:"focus",kulenga:"focus",blur:"blur",pakia:"load",kupakia:"load",sogeza:"scroll",kusogeza:"scroll"}};var na={action:"toggle",description:"Toggle a class or attribute on/off",category:"dom-class",primaryRole:"patient",roles:[{role:"patient",description:"The class or attribute to toggle",required:true,expectedTypes:["selector"],selectorKinds:["class","attribute"],svoPosition:1,sovPosition:2},{role:"destination",description:"The target element (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:2,sovPosition:1}],errorCodes:["MISSING_ARGUMENT","NO_VALID_CLASS_NAMES","INVALID_CSS_PROPERTY"],preconditions:[{condition:"Command has at least one argument",errorCode:"MISSING_ARGUMENT",message:"toggle command requires an argument"},{condition:"Class names are valid CSS identifiers",errorCode:"NO_VALID_CLASS_NAMES",message:"toggle command: no valid class names found"}],recoveryHints:{MISSING_ARGUMENT:"Add a class selector (.classname) or attribute to toggle",NO_VALID_CLASS_NAMES:"Ensure class names start with a dot (.) and are valid CSS identifiers",INVALID_CSS_PROPERTY:"Check CSS property name syntax (use kebab-case)"}},oa={action:"add",description:"Add a class or attribute to an element",category:"dom-class",primaryRole:"patient",roles:[{role:"patient",description:"The class or attribute to add",required:true,expectedTypes:["selector"],svoPosition:1,sovPosition:2},{role:"destination",description:"The target element (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:2,sovPosition:1,markerOverride:{en:"to"}}],errorCodes:["MISSING_ARGUMENT","NO_VALID_CLASS_NAMES","PROPERTY_REQUIRES_VALUE"],preconditions:[{condition:"Command has at least one argument",errorCode:"MISSING_ARGUMENT",message:"add command requires an argument"}],recoveryHints:{MISSING_ARGUMENT:"Add a class selector (.classname) or attribute to add",NO_VALID_CLASS_NAMES:"Ensure class names start with a dot (.) and are valid CSS identifiers",PROPERTY_REQUIRES_VALUE:"When adding a property (*prop), provide a value argument"}},ua={action:"remove",description:"Remove a class or attribute from an element",category:"dom-class",primaryRole:"patient",targetRole:"source",roles:[{role:"patient",description:"The class or attribute to remove",required:true,expectedTypes:["selector"],svoPosition:1,sovPosition:2},{role:"source",description:"The element to remove from (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:2,sovPosition:1}],errorCodes:["MISSING_ARGUMENT","NO_VALID_CLASS_NAMES"],preconditions:[{condition:"Command has at least one argument",errorCode:"MISSING_ARGUMENT",message:"remove command requires an argument"}],recoveryHints:{MISSING_ARGUMENT:"Add a class selector (.classname) or attribute to remove",NO_VALID_CLASS_NAMES:"Ensure class names start with a dot (.) and are valid CSS identifiers"}},sa={action:"put",description:"Put content into a target element or variable",category:"dom-content",primaryRole:"patient",roles:[{role:"patient",description:"The content to put",required:true,expectedTypes:["literal","selector","reference","expression"],svoPosition:1,sovPosition:1},{role:"destination",description:"Where to put the content",required:true,expectedTypes:["selector","reference"],svoPosition:2,sovPosition:2,markerOverride:{en:"into"},markerVariants:{en:["before","after"]},methodCarrier:"method"}],errorCodes:["MISSING_ARGUMENTS","MISSING_CONTENT","MISSING_POSITION","INVALID_POSITION","NO_TARGET","NO_ELEMENTS"],preconditions:[{condition:"Command has content and position arguments",errorCode:"MISSING_ARGUMENTS",message:"put requires arguments"},{condition:"Content to put is specified",errorCode:"MISSING_CONTENT",message:"put requires content"},{condition:"Position keyword is specified (into, before, after, etc.)",errorCode:"MISSING_POSITION",message:"put requires position keyword"}],recoveryHints:{MISSING_ARGUMENTS:"Use syntax: put <content> into/before/after <target>",MISSING_CONTENT:"Add content to put (string, element, or expression)",MISSING_POSITION:"Add position keyword: into, before, after, at start of, at end of",INVALID_POSITION:"Valid positions: into, before, after, at start of, at end of",NO_TARGET:'Ensure target element exists or use "me" reference',NO_ELEMENTS:"Check that the selector matches existing elements"}},la={action:"set",description:"Set a property or variable to a value",category:"variable",primaryRole:"destination",roles:[{role:"destination",description:"The property or variable to set",required:true,expectedTypes:["selector","reference","expression"],svoPosition:1,sovPosition:1,markerOverride:{en:"",ja:"\u3092",ko:"\uB97C",tr:"i",ar:"",sw:"",tl:"",bn:"\u0995\u09C7",qu:"ta"}},{role:"patient",description:"The value to set",required:true,expectedTypes:["literal","expression","reference"],svoPosition:2,sovPosition:2,markerOverride:{en:"to",es:"a",pt:"para",fr:"\xE0",de:"auf",id:"ke",ja:"\u306B",ko:"\uC73C\uB85C",tr:"e",ar:"\u0625\u0644\u0649",sw:"kwenye",tl:"sa",bn:"\u09A4\u09C7",qu:"man"}}],errorCodes:["MISSING_TARGET","INVALID_TARGET","MISSING_VALUE","INVALID_SYNTAX"],preconditions:[{condition:"Command has a target variable or property",errorCode:"MISSING_TARGET",message:"set command requires a target"},{condition:"Target is a valid variable or property reference",errorCode:"INVALID_TARGET",message:"set command target must be a string or object literal"},{condition:'Value is specified with "to" keyword',errorCode:"MISSING_VALUE",message:'set command requires a value (use "to" keyword)'}],recoveryHints:{MISSING_TARGET:"Add a target: set :variable to value OR set element.property to value",INVALID_TARGET:'Use local variable (:name), element property (el.prop), or "the X of Y" syntax',MISSING_VALUE:'Add "to <value>" to specify what to set',INVALID_SYNTAX:"Use syntax: set <target> to <value>"}},pa={action:"show",description:"Make an element visible",category:"dom-visibility",primaryRole:"patient",roles:[{role:"patient",description:"The element to show",required:true,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:1,sovPosition:1},{role:"style",description:"Animation style (fade, slide, etc.)",required:false,expectedTypes:["literal"],svoPosition:2,sovPosition:2}]},ca={action:"hide",description:"Make an element invisible",category:"dom-visibility",primaryRole:"patient",roles:[{role:"patient",description:"The element to hide",required:true,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:1,sovPosition:1},{role:"style",description:"Animation style (fade, slide, etc.)",required:false,expectedTypes:["literal"],svoPosition:2,sovPosition:2}]},ma={action:"on",description:"Handle an event",category:"event",primaryRole:"event",hasBody:true,roles:[{role:"event",description:"The event to handle",required:true,expectedTypes:["literal"],svoPosition:1,sovPosition:2},{role:"source",description:"The element to listen on (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:2,sovPosition:1}]},da={action:"trigger",description:"Trigger/dispatch an event",category:"event",primaryRole:"event",roles:[{role:"event",description:"The event to trigger (supports namespaced events like draggable:start)",required:true,expectedTypes:["literal","expression"],svoPosition:1,sovPosition:2},{role:"destination",description:"The target element (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:2,sovPosition:1}]},ya={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}]},fa={action:"fetch",description:"Fetch data from a URL",category:"async",primaryRole:"source",roles:[{role:"source",description:"The URL to fetch from",required:true,expectedTypes:["literal","expression"],svoPosition:1,sovPosition:1,renderOverride:{en:""}},{role:"responseType",description:"Response format (json, text, html, blob, etc.)",required:false,expectedTypes:["literal","expression"],svoPosition:2,sovPosition:2,markerOverride:{en:"as"}},{role:"method",description:"HTTP method (GET, POST, etc.)",required:false,expectedTypes:["literal"],svoPosition:3,sovPosition:3},{role:"destination",description:"Where to store the result",required:false,expectedTypes:["selector","reference"],svoPosition:4,sovPosition:4}]},va={action:"increment",description:"Increment a numeric value",category:"variable",primaryRole:"patient",roles:[{role:"patient",description:"The value to increment",required:true,expectedTypes:["selector","reference","expression"],svoPosition:1,sovPosition:1},{role:"quantity",description:"Amount to increment by (defaults to 1)",required:false,expectedTypes:["literal"],default:{type:"literal",value:1,dataType:"number"},svoPosition:2,sovPosition:2,markerOverride:{en:"by"}}]},ha={action:"decrement",description:"Decrement a numeric value",category:"variable",primaryRole:"patient",roles:[{role:"patient",description:"The value to decrement",required:true,expectedTypes:["selector","reference","expression"],svoPosition:1,sovPosition:1},{role:"quantity",description:"Amount to decrement by (defaults to 1)",required:false,expectedTypes:["literal"],default:{type:"literal",value:1,dataType:"number"},svoPosition:2,sovPosition:2,markerOverride:{en:"by"}}]},ga={action:"append",description:"Append content to an element",category:"dom-content",primaryRole:"patient",roles:[{role:"patient",description:"The content to append",required:true,expectedTypes:["literal","selector","expression"],svoPosition:1,sovPosition:2},{role:"destination",description:"The element to append to",required:true,expectedTypes:["selector","reference"],svoPosition:2,sovPosition:1,markerOverride:{en:"to"}}]},Ea={action:"prepend",description:"Prepend content to an element",category:"dom-content",primaryRole:"patient",roles:[{role:"patient",description:"The content to prepend",required:true,expectedTypes:["literal","selector","expression"],svoPosition:1,sovPosition:2},{role:"destination",description:"The element to prepend to",required:true,expectedTypes:["selector","reference"],svoPosition:2,sovPosition:1,markerOverride:{en:"to"}}]},ka={action:"log",description:"Log a value to the console",category:"variable",primaryRole:"patient",roles:[{role:"patient",description:"The value to log",required:true,expectedTypes:["literal","selector","reference","expression"],svoPosition:1,sovPosition:1}]},za={action:"get",description:"Get a value from a source",category:"variable",primaryRole:"source",roles:[{role:"source",description:"The source to get from",required:true,expectedTypes:["selector","reference","expression"],svoPosition:1,sovPosition:2,markerOverride:{en:"",es:"",pt:"",fr:"",de:"",ja:"\u3092",zh:"",ko:"\uB97C",ar:"\u0639\u0644\u0649",tr:"i",id:"",sw:"",tl:"",bn:"\u0995\u09C7",qu:"ta"}},{role:"destination",description:"Where to store the result (optional)",required:false,expectedTypes:["reference"],svoPosition:2,sovPosition:1}]},ba={action:"take",description:"Take content from a source element",category:"dom-content",primaryRole:"patient",roles:[{role:"patient",description:"The class or element to take",required:true,expectedTypes:["selector"],svoPosition:1,sovPosition:2},{role:"source",description:"The element to take from (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:2,sovPosition:1}]},Ca={action:"make",description:"Create a new element",category:"dom-content",primaryRole:"patient",roles:[{role:"patient",description:"The element type or selector to create",required:true,expectedTypes:["literal","selector"],svoPosition:1,sovPosition:1}]},Aa={action:"halt",description:"Halt/stop execution or event propagation",category:"control-flow",primaryRole:"patient",roles:[{role:"patient",description:"What to halt (event, default, bubbling, etc.)",required:false,expectedTypes:["literal","reference","expression"],svoPosition:1,sovPosition:1}]},wa={action:"settle",description:"Wait for animations/transitions to settle",category:"async",primaryRole:"patient",roles:[{role:"patient",description:"The element to settle (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:1,sovPosition:1}]},xa={action:"throw",description:"Throw an error",category:"control-flow",primaryRole:"patient",roles:[{role:"patient",description:"The error message or object to throw",required:true,expectedTypes:["literal","expression"],svoPosition:1,sovPosition:1}]},Ta={action:"send",description:"Send an event to an element",category:"event",primaryRole:"event",roles:[{role:"event",description:"The event to send",required:true,expectedTypes:["literal","expression"],svoPosition:1,sovPosition:2},{role:"destination",description:"The target element (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:2,sovPosition:1,markerOverride:{en:"to",ja:"\u306B",ar:"\u0625\u0644\u0649",es:"a",ko:"\uC5D0\uAC8C",zh:"\u5230",tr:"-e",pt:"para",fr:"\xE0",de:"an",id:"ke",qu:"-man",sw:"kwa"}}]},Da={action:"if",description:"Conditional execution",category:"control-flow",primaryRole:"condition",hasBody:true,roles:[{role:"condition",description:"The condition to evaluate",required:true,expectedTypes:["expression"],svoPosition:1,sovPosition:1}]},Sa={action:"unless",description:"Negated conditional execution (executes when condition is false)",category:"control-flow",primaryRole:"condition",hasBody:true,roles:[{role:"condition",description:"The condition to evaluate (body executes when false)",required:true,expectedTypes:["expression"],svoPosition:1,sovPosition:1}]},Ba={action:"else",description:"Else branch of conditional",category:"control-flow",primaryRole:"patient",hasBody:true,roles:[]},Pa={action:"repeat",description:"Repeat a block of commands",category:"control-flow",primaryRole:"loopType",hasBody:true,roles:[{role:"loopType",description:"Loop variant: forever, times, for, while, until, until-event",required:true,expectedTypes:["literal"],svoPosition:0,sovPosition:0},{role:"quantity",description:"Number of times to repeat",required:false,expectedTypes:["literal","expression"],svoPosition:1,sovPosition:1},{role:"event",description:"Event to wait for (terminates loop)",required:false,expectedTypes:["literal","expression"],svoPosition:2,sovPosition:2},{role:"source",description:"Element to listen for event on",required:false,expectedTypes:["selector","reference"],svoPosition:3,sovPosition:3}],notes:'Can also use "repeat forever", "repeat until condition", or "repeat until event X from Y"'},Fa={action:"for",description:"Iterate over a collection",category:"control-flow",primaryRole:"patient",hasBody:true,roles:[{role:"patient",description:"The iteration variable",required:true,expectedTypes:["reference"],svoPosition:1,sovPosition:2},{role:"source",description:"The collection to iterate over",required:true,expectedTypes:["selector","reference","expression"],svoPosition:2,sovPosition:1,markerOverride:{en:"in"}}]},Ra={action:"while",description:"Loop while condition is true",category:"control-flow",primaryRole:"condition",hasBody:true,roles:[{role:"condition",description:"The condition to check",required:true,expectedTypes:["expression"],svoPosition:1,sovPosition:1}]},_a={action:"continue",description:"Continue to next loop iteration",category:"control-flow",primaryRole:"patient",roles:[]},Oa={action:"go",description:"Navigate to a URL",category:"navigation",primaryRole:"destination",roles:[{role:"destination",description:"The URL to navigate to",required:true,expectedTypes:["literal","expression"],svoPosition:1,sovPosition:1,markerOverride:{en:"to"},renderOverride:{en:""}}]},Na={action:"transition",description:"Transition an element with animation",category:"dom-visibility",primaryRole:"patient",roles:[{role:"patient",description:"The property to transition (opacity, *background-color, etc.)",required:true,expectedTypes:["literal"],svoPosition:1,sovPosition:2,markerOverride:{en:"",ar:"",tl:"",sw:""}},{role:"goal",description:"The target value to transition to",required:true,expectedTypes:["literal","expression"],svoPosition:2,sovPosition:3,markerOverride:{en:"to",ar:"\u0625\u0644\u0649",tl:"sa",sw:"kwenye",bn:"\u09A4\u09C7",qu:"man",es:"a",pt:"para",fr:"\xE0",de:"auf",ja:"\u306B",ko:"\uC73C\uB85C",tr:"e",id:"ke"}},{role:"destination",description:"The target element (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:3,sovPosition:1},{role:"duration",description:"Transition duration (over 500ms, for 2 seconds)",required:false,expectedTypes:["literal"],svoPosition:4,sovPosition:4,markerOverride:{en:"over"}},{role:"style",description:"Easing function (ease-in, linear, etc.)",required:false,expectedTypes:["literal"],svoPosition:5,sovPosition:5}]},Ia={action:"clone",description:"Clone an element",category:"dom-content",primaryRole:"patient",roles:[{role:"patient",description:"The element to clone",required:true,expectedTypes:["selector","reference"],svoPosition:1,sovPosition:2},{role:"destination",description:"Where to put the clone",required:false,expectedTypes:["selector","reference"],svoPosition:2,sovPosition:1,markerOverride:{en:"into"}}]},Ma={action:"focus",description:"Focus an element",category:"dom-content",primaryRole:"patient",roles:[{role:"patient",description:"The element to focus (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:1,sovPosition:1}]},La={action:"blur",description:"Remove focus from an element",category:"dom-content",primaryRole:"patient",roles:[{role:"patient",description:"The element to blur (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:1,sovPosition:1}]},qa={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}]},$a={action:"open",description:"Open a dialog, details element, or popover",category:"dom-content",primaryRole:"patient",roles:[{role:"patient",description:"The element to open (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:2,sovPosition:2},{role:"style",description:"Open-mode variant (modal / non-modal) for <dialog>",required:false,expectedTypes:["literal","expression"],svoPosition:1,sovPosition:1,markerOverride:{en:"as"}}]},Va={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}]},ja={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}]},Wa={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}]},Ha={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}]},Ua={action:"breakpoint",description:"Drop into the debugger",category:"control-flow",primaryRole:"patient",roles:[]},Ga={action:"call",description:"Call a function",category:"control-flow",primaryRole:"patient",roles:[{role:"patient",description:"The function to call",required:true,expectedTypes:["expression","reference"],svoPosition:1,sovPosition:1}]},Ka={action:"return",description:"Return a value from a function",category:"control-flow",primaryRole:"patient",roles:[{role:"patient",description:"The value to return",required:false,expectedTypes:["literal","expression","reference"],svoPosition:1,sovPosition:1}]},Ya={action:"js",description:"Execute raw JavaScript code",category:"control-flow",primaryRole:"patient",hasBody:true,roles:[{role:"patient",description:"The JavaScript code to execute",required:false,expectedTypes:["expression"],svoPosition:1,sovPosition:1}]},Qa={action:"async",description:"Execute commands asynchronously",category:"async",primaryRole:"patient",hasBody:true,roles:[]},Xa={action:"tell",description:"Execute commands in context of another element",category:"control-flow",primaryRole:"destination",hasBody:true,roles:[{role:"destination",description:"The element to tell",required:true,expectedTypes:["selector","reference"],svoPosition:1,sovPosition:1,markerOverride:{en:""}}]},Ja={action:"default",description:"Set a default value for a variable",category:"variable",primaryRole:"destination",roles:[{role:"destination",description:"The variable to set default for",required:true,expectedTypes:["reference"],svoPosition:1,sovPosition:1,markerOverride:{en:"",ar:"",tl:"",sw:"",bn:"\u0995\u09C7",qu:"ta"}},{role:"patient",description:"The default value",required:true,expectedTypes:["literal","expression"],svoPosition:2,sovPosition:2,markerOverride:{en:"to",ar:"\u0625\u0644\u0649",tl:"sa",sw:"kwenye",bn:"\u09A4\u09C7",qu:"man"}}]},Za={action:"init",description:"Initialization block that runs once",category:"control-flow",primaryRole:"patient",hasBody:true,roles:[]},ei={action:"behavior",description:"Define a reusable behavior",category:"control-flow",primaryRole:"patient",hasBody:true,roles:[{role:"patient",description:"The behavior name (PascalCase identifier)",required:true,expectedTypes:["literal","reference","expression"],svoPosition:1,sovPosition:1}]},ri={action:"install",description:"Install a behavior on an element",category:"control-flow",primaryRole:"patient",roles:[{role:"patient",description:"The behavior name to install",required:true,expectedTypes:["literal","reference","expression"],svoPosition:1,sovPosition:2},{role:"destination",description:"Element to install on (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:2,sovPosition:1}]},ti={action:"measure",description:"Measure element dimensions (x, y, width, height, etc.)",category:"dom-content",primaryRole:"patient",roles:[{role:"patient",description:"Property to measure (x, y, width, height, top, left, etc.)",required:false,expectedTypes:["literal","expression"],svoPosition:1,sovPosition:1},{role:"source",description:"Element to measure (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:2,sovPosition:2,markerOverride:{en:"of"}}]},ai={action:"swap",description:"Swap DOM content using various strategies (innerHTML, outerHTML, delete, etc.)",category:"dom-content",primaryRole:"destination",roles:[{role:"method",description:"The swap strategy (innerHTML, outerHTML, beforebegin, afterend, delete)",required:false,expectedTypes:["literal"],svoPosition:1,sovPosition:3,markerOverride:{en:""}},{role:"destination",description:"The element to swap content in/for",required:true,expectedTypes:["selector","reference"],svoPosition:2,sovPosition:1,markerOverride:{en:"of"}},{role:"patient",description:"The content to swap in (optional for delete)",required:false,expectedTypes:["literal","expression","selector"],svoPosition:3,sovPosition:2,markerOverride:{en:"with"}}]},ii={action:"morph",description:"Morph an element into another using DOM diffing",category:"dom-content",primaryRole:"destination",roles:[{role:"destination",description:"The element to morph",required:true,expectedTypes:["selector","reference"],svoPosition:1,sovPosition:1,markerOverride:{en:""}},{role:"patient",description:"The target content/element to morph into",required:true,expectedTypes:["literal","expression","selector"],svoPosition:2,sovPosition:2,markerOverride:{en:"to"}}]},ni={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}]},oi={action:"break",description:"Exit from the current loop",category:"control-flow",primaryRole:"patient",roles:[]},ui={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}]},si={action:"exit",description:"Exit from the current event handler",category:"control-flow",primaryRole:"patient",roles:[]},li={action:"pick",description:"Select a random element from a collection",category:"variable",primaryRole:"patient",roles:[{role:"patient",description:"The items to pick from",required:true,expectedTypes:["literal","expression","reference"],svoPosition:1,sovPosition:1},{role:"source",description:'The array to pick from (with "from" keyword)',required:false,expectedTypes:["reference","expression"],svoPosition:2,sovPosition:2}]},pi={action:"scroll",description:"Scroll the viewport to a target element",category:"navigation",primaryRole:"destination",argSkipTokens:["of","the","top","bottom","middle","center","nearest","left","right","smoothly","instantly"],roles:[{role:"destination",description:"The element to scroll to",required:true,expectedTypes:["selector","reference"],svoPosition:1,sovPosition:1,markerOverride:{en:"to"}}]},mr={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"},ci={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"},mi={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:mr}]},di={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:mr}]},yi={action:"process",description:"Process hx-partial markup in HTML content",category:"dom-content",primaryRole:"patient",roles:[{role:"patient",description:"The HTML content (string, element, or response) to process",required:true,expectedTypes:["literal","reference","expression"],svoPosition:1,sovPosition:1,markerOverride:ci}]},fi={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}]},dr={toggle:na,add:oa,remove:ua,put:sa,set:la,show:pa,hide:ca,on:ma,trigger:da,wait:ya,fetch:fa,increment:va,decrement:ha,append:ga,prepend:Ea,log:ka,get:za,take:ba,make:Ca,halt:Aa,settle:wa,throw:xa,send:Ta,if:Da,unless:Sa,else:Ba,repeat:Pa,for:Fa,while:Ra,continue:_a,go:Oa,scroll:pi,push:mi,replace:di,process:yi,transition:Na,clone:Ia,focus:Ma,blur:La,empty:qa,open:$a,close:Va,select:ja,clear:Wa,reset:Ha,breakpoint:Ua,call:Ga,return:Ka,js:Ya,async:Qa,tell:Xa,default:Ja,init:Za,behavior:ei,install:ri,measure:ti,swap:ai,morph:ii,beep:ni,break:oi,copy:ui,exit:si,pick:li,render:fi,compound:{action:"compound",description:"A compound node representing chained statements",primaryRole:"patient",category:"control-flow",hasBody:true,roles:[]}};function vi(){return Object.values(dr).filter(a=>a.roles.length>0)}typeof process<"u"&&process.env.NODE_ENV!=="production"&&Promise.resolve().then(()=>(gt(),tr)).then(({validateAllSchemas:a,formatValidationResults:e})=>{let r=a(dr);r.size>0&&(console.warn("[SCHEMA VALIDATION] Found issues in command schemas:"),console.warn(e(r)),console.warn(`
3
+ These warnings help identify potential schema design issues.`),console.warn("Fix them to improve type inference and avoid runtime bugs."));}).catch(a=>{console.debug("Schema validation skipped:",a);});var Qe=class extends Error{constructor(a,e,r,t){super(a),this.name="SemanticParseError",this.language=e,this.input=r,this.diagnostics=t;}};function P(a,e,r){return {message:a,severity:e,source:"semantic-parser",...r&&{code:r}}}function ce(a,e){return e.length===0?a:{...a,diagnostics:e}}var K=class F{parse(e,r){let{modifiers:t,remainingInput:i}=this.extractStandaloneModifiers(e,r),n=i||e,o=[],u=te(n,r),s=H(r);if(s.length===0)throw new Qe(`No patterns available for language: ${r}`,r,n,[P(`No patterns registered for language '${r}'`,"error","no-patterns")]);let p=[...s].sort((g,E)=>E.priority-g.priority),l=p.filter(g=>g.command==="on"),c=N.matchBest(u,l);if(c){o.push(P(`event pattern matched: ${c.pattern.id} (confidence: ${c.confidence.toFixed(2)})`,"info","pattern-match"));let g=this.buildEventHandler(c,u,r),E=t?this.applyModifiers(g,t):g;return ce(E,o)}o.push(P(`event patterns: ${l.length} tried, no match`,"info","stage-event"));let m=p.filter(g=>g.command!=="on"),d=N.matchBest(u,m);if(d)return o.push(P(`command pattern matched: ${d.pattern.id} (confidence: ${d.confidence.toFixed(2)})`,"info","pattern-match")),ce(this.buildCommand(d,r),o);o.push(P(`command patterns: ${m.length} tried, no match`,"info","stage-command"));let y=this.trySOVEventExtraction(n,r,p);if(y){o.push(P("SOV event extraction succeeded","info","stage-sov"));let g=t?this.applyModifiers(y,t):y;return ce(g,o)}o.push(P("SOV event extraction: no event keyword found","info","stage-sov"));let h=this.tryCompoundCommandParsing(u,m,r);if(h)return o.push(P("compound command parsing succeeded","info","stage-compound")),ce(h,o);throw o.push(P("compound parsing: no then-keywords or no command matches","info","stage-compound")),o.push(P(`all parse stages exhausted for "${n}"`,"error","parse-failed")),new Qe(`Could not parse input in ${r}: ${n}`,r,n,o)}canParse(e,r){try{return this.parse(e,r),!0}catch{return false}}supportedLanguages(){return cr()}buildCommand(e,r){if(!e)throw new Error("No match to build command from");let t={};for(let[i,n]of e.captured)t[i]=n;return pe(e.pattern.command,t,{sourceLanguage:r,patternId:e.pattern.id,confidence:e.confidence})}buildEventHandler(e,r,t){if(!e)throw new Error("No match to build event handler from");let i=e.captured.get("event");if(!i)throw new Error("Event handler pattern matched but no event captured");let n=N.extractEventModifiers(r),o=this.extractOrConjunctionEvents(r,t),u=i;o.length>0&&i.type==="literal"&&(u={type:"literal",value:[String(i.value),...o.map(c=>String("value"in c?c.value:""))].join(" or ")});let s,p=e.captured.get("action");if(p&&p.type==="literal"){let l=p.value,c={};for(let[y,h]of e.captured)y!=="event"&&y!=="action"&&y!=="continues"&&(c[y]=h);let m=pe(l,c,{sourceLanguage:t,patternId:e.pattern.id,confidence:e.confidence}),d=e.captured.get("continues");if(d&&d.type==="literal"&&d.value==="then"){let y=H(t).filter(E=>E.command!=="on").sort((E,z)=>z.priority-E.priority),h=H(t).filter(E=>E.id.startsWith("grammar-")&&E.id.includes("-continuation")).sort((E,z)=>z.priority-E.priority),g=this.parseBodyWithGrammarPatterns(r,y,h,t);g.length>0?s=[m,...g]:s=[m];}else s=[m];}else {let l=H(t).filter(c=>c.command!=="on").sort((c,m)=>m.priority-c.priority);s=this.parseBodyWithClauses(r,l,t);}return We(u,s,n,{sourceLanguage:t,patternId:e.pattern.id,confidence:e.confidence})}parseBodyWithClauses(e,r,t){let i=[],n=[];for(;!e.isAtEnd();){let o=e.peek();if(!o)break;let u=o.kind==="conjunction"||o.kind==="keyword"&&this.isThenKeyword(o.value,t),s=o.kind==="keyword"&&this.isEndKeyword(o.value,t);if(u){if(n.length>0){let p=this.parseClause(n,r,t);i.push(...p),n.length=0;}e.advance();continue}if(s){if(n.length>0){let p=this.parseClause(n,r,t);i.push(...p);}e.advance();break}n.push(o),e.advance();}if(n.length>0){let o=this.parseClause(n,r,t);i.push(...o);}return i.length>1?[He(i,"then",{sourceLanguage:t})]:i}parseClause(e,r,t){if(e.length===0)return [];let i=new Z(e,t),n=[];for(;!i.isAtEnd();){let o=N.matchBest(i,r);o?n.push(this.buildCommand(o,t)):i.advance();}if(n.length===0){let o=this.parseSOVClauseByVerbAnchoring(e,t);if(o.length>0)return o}return n}static buildVerbLookup(e){let r=new Map;for(let[t,i]of Object.entries(e.keywords))if(!["on","if","else","when","where","while","for","end","then","and"].includes(t)&&(r.set(i.primary.toLowerCase(),t),i.alternatives))for(let n of i.alternatives)r.set(n.toLowerCase(),t);return r}static buildMarkerToRoleLookup(e){let r=new Map;for(let[t,i]of Object.entries(e.roleMarkers))if(i&&(r.set(i.primary,t),i.alternatives))for(let n of i.alternatives)r.has(n)||r.set(n,t);return r}parseSOVClauseByVerbAnchoring(e,r){let t=q(r);if(!t||t.wordOrder!=="SOV")return [];let i=F.buildVerbLookup(t),n=F.buildMarkerToRoleLookup(t),o=[],u=0;for(;u<e.length;){let s=-1,p="";for(let y=u;y<e.length;y++){let h=e[y],g=i.get(h.value.toLowerCase()),E=h.normalized?i.get(h.normalized.toLowerCase()):void 0,z=g||E;if(z){s=y,p=z;break}}if(s===-1)break;let l=e.slice(u,s),c=e.length;for(let y=s+1;y<e.length;y++){let h=e[y];if(h.kind==="conjunction"||this.isThenKeyword(h.value,r)){c=y;break}if(y>s+1&&(i.get(h.value.toLowerCase())||(h.normalized?i.get(h.normalized.toLowerCase()):void 0))){c=y;break}}let m=e.slice(s+1,c),d=this.extractRolesFromMarkedTokens(l,m,n,p,r);if(o.push(pe(p,d,{sourceLanguage:r,confidence:.7})),u=c,u<e.length){let y=e[u];(y.kind==="conjunction"||this.isThenKeyword(y.value,r))&&u++;}}return o}extractRolesFromMarkedTokens(e,r,t,i,n){let o={},u=s=>{let p=[];for(let l of s){let c=t.get(l.value);if(c&&l.kind==="particle"&&p.length>0){let m=this.tokensToSemanticValue(p);if(m){let d=this.mapRoleForCommand(c,i,o);d&&(o[d]=m);}p=[];}else p.push(l);}if(p.length>0){let l=this.tokensToSemanticValue(p);l&&(o.patient?o.destination||(o.destination=l):o.patient=l);}};return u(e),u(r),o}mapRoleForCommand(e,r,t){return t[e]?e==="patient"&&!t.destination?"destination":e==="destination"&&!t.patient?"patient":e==="source"&&!t.source?"source":null:e}tokensToSemanticValue(e){if(e.length===0)return null;let r=e.filter(n=>n.kind!=="whitespace");if(r.length===0)return null;if(r.length===1)return this.tokenToSemanticValue(r[0]);let t=r.map(n=>n.value).join(""),i=r[0];return i.kind==="selector"||i.value.startsWith("#")||i.value.startsWith(".")||i.value.startsWith("@")||i.value.startsWith("*")?re(t):i.kind==="literal"||i.value.startsWith('"')||i.value.startsWith("'")?A(t):i.kind==="reference"?M(t):A(t)}tokenToSemanticValue(e){let r=e.value;if(e.kind==="selector"||r.startsWith("#")||r.startsWith(".")||r.startsWith("@")||r.startsWith("*"))return re(r);if(r.startsWith('"')||r.startsWith("'"))return A(r);if(/^-?\d+(\.\d+)?$/.test(r))return A(parseFloat(r));if(r==="true"||r==="\u771F"||r==="\uCC38"||r==="do\u011Fru")return A(true);if(r==="false"||r==="\u507D"||r==="\uAC70\uC9D3"||r==="yanl\u0131\u015F")return A(false);let t=e.normalized?.toLowerCase();return t==="me"||t==="it"||t==="you"||t==="result"||t==="body"?M(t):e.kind==="reference"?M(e.normalized||"me"):A(r)}parseBodyWithGrammarPatterns(e,r,t,i){let n=[];for(;!e.isAtEnd();){let o=e.peek();if(o&&this.isThenKeyword(o.value,i)){e.advance();continue}if(o&&this.isEndKeyword(o.value,i)){e.advance();break}let u=false;if(t.length>0){let s=N.matchBest(e,t);if(s){let p=s.pattern.command,l={};for(let[d,y]of s.captured)d!=="event"&&d!=="action"&&d!=="continues"&&(l[d]=y);let c=pe(p,l,{sourceLanguage:i,patternId:s.pattern.id});n.push(c),u=true;let m=s.captured.get("continues");if(m&&m.type==="literal"&&m.value==="then")continue}}if(!u){let s=N.matchBest(e,r);s&&(n.push(this.buildCommand(s,i)),u=true);}u||e.advance();}return n}tryCompoundCommandParsing(e,r,t){let i=e.tokens;if(!i.some(s=>s.kind==="conjunction"||s.kind==="keyword"&&this.isThenKeyword(s.value,t)))return null;let o=new Z(i,t),u=this.parseBodyWithClauses(o,r,t);return u.length===0?null:u.length===1?u[0]:He(u,"then",{sourceLanguage:t,confidence:.65})}trySOVEventExtraction(e,r,t){let i=F.SOV_EVENT_MARKERS[r];if(!i)return null;let o=te(e,r).tokens,u=aa[r],s=new Set;if(u)for(let k of Object.keys(u))s.add(k.toLowerCase());let p=F.SOV_SOURCE_MARKERS[r],l=-1,c="",m="",d=1;for(let k=0;k<o.length;k++){let w=o[k],_=w.value.toLowerCase(),O=_,$="",fe=_.indexOf("[");fe>0&&(O=_.slice(0,fe),$=w.value.slice(fe));let ve=w.normalized?.toLowerCase(),Fe=ve&&F.KNOWN_EVENTS.has(ve),Re=s.has(_)||s.has(O),qr=F.KNOWN_EVENTS.has(O);if(Fe||Re||qr){let Y;if(Fe?Y=ve:Re?Y=u?.[_]??u?.[O]??O:Y=O,i.size>0){let oe=1,he=o[k+1];he&&he.kind==="selector"&&he.value.startsWith("[")&&(oe=2);let ue=o[k+oe];if(ue&&(ue.kind==="particle"||ue.kind==="keyword")&&i.has(ue.value)){l=k,c=Y,m=$||(oe===2?o[k+1].value:""),d=oe+1;break}}else {l=k,c=Y,m=$,d=1;break}}}if(l===-1)return null;let y=new Set;for(let k=l;k<l+d;k++)y.add(k);if(p){let k=l+d;if(k<o.length){let w=o[k];(w.kind==="particle"||w.kind==="keyword")&&p.markers.has(w.value)&&y.add(k);}for(let w=0;w<l;w++){let _=o[w],O=_.value.toLowerCase(),$=_.normalized?.toLowerCase();if(p.windowTokens.has(O)||$&&p.windowTokens.has($)){y.add(w);break}}}let h=o.filter((k,w)=>!y.has(w));if(h.length===0)return null;let g=t.filter(k=>k.command!=="on"),E=new Z(h,r),z=this.parseBodyWithClauses(E,g,r);if(z.length===0)return null;let Pe={sourceLanguage:r,confidence:.75};return m&&(Pe.keyFilter=m),We({type:"literal",value:c},z,void 0,Pe)}isThenKeyword(e,r){let t={en:new Set(["then"]),ja:new Set(["\u305D\u308C\u304B\u3089","\u6B21\u306B","\u305D\u3057\u3066"]),ar:new Set(["\u062B\u0645","\u0628\u0639\u062F\u0647\u0627","\u062B\u0645\u0651"]),es:new Set(["entonces","luego","despu\xE9s"]),ko:new Set(["\uADF8\uB2E4\uC74C","\uADF8\uB9AC\uACE0","\uADF8\uB7F0\uD6C4","\uADF8\uB7EC\uBA74"]),zh:new Set(["\u7136\u540E","\u63A5\u7740","\u4E4B\u540E"]),tr:new Set(["sonra","ard\u0131ndan","daha sonra"]),pt:new Set(["ent\xE3o","depois","logo"]),fr:new Set(["puis","ensuite","alors"]),de:new Set(["dann","danach","anschlie\xDFend"]),id:new Set(["lalu","kemudian","setelah itu"]),tl:new Set(["pagkatapos","tapos"]),bn:new Set(["\u09A4\u09BE\u09B0\u09AA\u09B0","\u09AA\u09B0\u09C7"]),qu:new Set(["chaymantataq","hinaspa","chaymanta","chayqa"]),sw:new Set(["kisha","halafu","baadaye"])};return (t[r]||t.en).has(e.toLowerCase())}isEndKeyword(e,r){let t={en:new Set(["end"]),ja:new Set(["\u7D42\u308F\u308A","\u7D42\u4E86","\u304A\u308F\u308A"]),ar:new Set(["\u0646\u0647\u0627\u064A\u0629","\u0627\u0646\u062A\u0647\u0649","\u0622\u062E\u0631"]),es:new Set(["fin","final","terminar"]),ko:new Set(["\uB05D","\uC885\uB8CC","\uB9C8\uCE68"]),zh:new Set(["\u7ED3\u675F","\u7EC8\u6B62","\u5B8C"]),tr:new Set(["son","biti\u015F","bitti"]),pt:new Set(["fim","final","t\xE9rmino"]),fr:new Set(["fin","terminer","finir"]),de:new Set(["ende","beenden","fertig"]),id:new Set(["selesai","akhir","tamat"]),tl:new Set(["wakas","tapos"]),bn:new Set(["\u09B8\u09AE\u09BE\u09AA\u09CD\u09A4"]),qu:new Set(["tukukuy","tukuy","puchukay"]),sw:new Set(["mwisho","maliza","tamati"])};return (t[r]||t.en).has(e.toLowerCase())}extractStandaloneModifiers(e,r){let i=te(e,r).tokens;if(i.length===0)return {modifiers:null,remainingInput:null};let o=i[0].value.toLowerCase(),u=F.STANDALONE_MODIFIERS[o];if(!u)return {modifiers:null,remainingInput:null};let s={},p=1;if(u==="once")s.once=true;else {let d=1;if(d<i.length){let y=i[d];(y.kind==="keyword"||y.kind==="particle")&&(d++,p++);}if(d<i.length){let y=i[d];if(y.kind==="literal"){let h=y.value.match(/^(\d+)(ms|s|m)?$/);if(h){let g=parseInt(h[1],10),E=h[2]||"ms";E==="s"?g*=1e3:E==="m"&&(g*=6e4),s[u]=g,p=d+1;}}}s[u]||(s[u]=u==="debounce"?300:100);}let l=i.slice(p);if(l.length===0)return {modifiers:null,remainingInput:null};let c=l[0].position.start,m=e.slice(c);return {modifiers:s,remainingInput:m}}applyModifiers(e,r){return {...e,eventModifiers:{...e.eventModifiers,...r}}}extractOrConjunctionEvents(e,r){let t=[];for(;;){let i=e.mark(),n=e.peek();if(!n)break;let o=(n.normalized||n.value).toLowerCase();if(!F.OR_KEYWORDS.has(o)){e.reset(i);break}e.advance();let u=e.peek();if(!u){e.reset(i);break}let s=(u.normalized||u.value).toLowerCase();e.advance(),t.push({type:"literal",value:s});}return t}};K.KNOWN_EVENTS=new Set(["click","dblclick","input","change","submit","keydown","keyup","keypress","mouseover","mouseout","mousedown","mouseup","focus","blur","load","scroll","resize","contextmenu"]);K.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"])};K.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"])}};K.STANDALONE_MODIFIERS={once:"once",debounced:"debounce",debounce:"debounce",throttled:"throttle",throttle:"throttle"};K.OR_KEYWORDS=new Set(["or","\u0623\u0648","o","ou","oder","atau","atau","\u6216","\u307E\u305F\u306F","\uB610\uB294","veya","\u0985\u09A5\u09AC\u09BE","utaq","au","\u0430\u0431\u043E","\u0438\u043B\u0438","ho\u1EB7c","lub","\u05D0\u05D5","\u0E2B\u0E23\u0E37\u0E2D","o"]);var hi=K,gi=new hi;function Ei(a,e){return gi.parse(a,e)}function ki(a,e){try{let r=te(a,e),t=H(e);if(t.length===0)return {confidence:0,parseSuccess:!1,error:`No patterns available for language: ${e}`};let i=[...t].sort((p,l)=>l.priority-p.priority),n=i.filter(p=>p.command==="on"),o=N.matchBest(r,n);if(o)return {confidence:o.confidence,parseSuccess:!0,patternId:o.pattern.id,action:o.pattern.command,tokensConsumed:o.consumedTokens};r.reset(r.mark());let u=i.filter(p=>p.command!=="on"),s=N.matchBest(r,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: ${a}`}}catch(r){return {confidence:0,parseSuccess:false,error:r instanceof Error?r.message:String(r)}}}function yr(a,e){try{let t=Ei(a,e);if(t)return {node:t,confidence:t.metadata?.confidence??.8,error:void 0,tokensConsumed:te(a,e).tokens.length}}catch{}let r=ki(a,e);return r.parseSuccess?{node:null,confidence:r.confidence,error:void 0,tokensConsumed:r.tokensConsumed}:{node:null,confidence:0,error:r.error}}function fr(a,e){let r=e==="SOV"?"sovPosition":"svoPosition";return [...a].sort((t,i)=>{let n=t[r]??99,o=i[r]??99;return n-o})}function zi(a,e){let r=a.markerOverride?.[e.code],t=e.roleMarkers[a.role];if(r!==void 0)return {primary:r,position:t?.position??"before",isOverride:true};if(t&&t.primary){let i={primary:t.primary,position:t.position,isOverride:false};return t.alternatives&&(i.alternatives=t.alternatives),i}return null}function bi(a,e,r,t,i){let n=[];if(n.push({type:"role",role:"event",optional:false}),t.position==="after"){let p=t.primary.split(/\s+/);if(p.length>1)for(let l of p)n.push({type:"literal",value:l});else {let l=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};n.push(l);}}let o=e.roleMarkers.destination;o&&n.push({type:"group",optional:true,tokens:[{type:"role",role:"destination",optional:true},o.alternatives?{type:"literal",value:o.primary,alternatives:o.alternatives}:{type:"literal",value:o.primary}]}),n.push({type:"role",role:"patient",optional:false});let u=e.roleMarkers.patient;if(u){let p=u.alternatives?{type:"literal",value:u.primary,alternatives:u.alternatives}:{type:"literal",value:u.primary};n.push(p);}let s=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};return n.push(s),{id:`${a.action}-event-${e.code}-sov`,language:e.code,command:"on",priority:(i.basePriority??100)+50,template:{format:`{event} ${t.primary} {destination?} {patient} ${u?.primary||""} ${r.primary}`,tokens:n},extraction:{action:{value:a.action},event:{fromRole:"event"},patient:{fromRole:"patient"},destination:{fromRole:"destination",default:{type:"reference",value:"me"}}}}}function Ci(a,e,r,t,i){let n=[];n.push({type:"role",role:"patient",optional:false});let o=e.roleMarkers.patient;if(o){let s=o.alternatives?{type:"literal",value:o.primary,alternatives:o.alternatives}:{type:"literal",value:o.primary};n.push(s);}if(n.push({type:"role",role:"event",optional:false}),t.position==="after"){let s=t.primary.split(/\s+/);if(s.length>1)for(let p of s)n.push({type:"literal",value:p});else {let p=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};n.push(p);}}let u=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};return n.push(u),{id:`${a.action}-event-${e.code}-sov-patient-first`,language:e.code,command:"on",priority:(i.basePriority??100)+45,template:{format:`{patient} ${o?.primary||""} {event} ${t.primary} ${r.primary}`,tokens:n},extraction:{action:{value:a.action},event:{fromRole:"event"},patient:{fromRole:"patient"},destination:{fromRole:"destination",default:{type:"reference",value:"me"}}}}}function Ai(a,e,r,t,i){let n=[];n.push({type:"role",role:"patient",optional:false});let o=e.roleMarkers.patient;if(o){let p=o.alternatives?{type:"literal",value:o.primary,alternatives:o.alternatives}:{type:"literal",value:o.primary};n.push(p);}let u=e.roleMarkers.destination;if(u&&(n.push({type:"role",role:"destination",optional:false}),n.push(u.alternatives?{type:"literal",value:u.primary,alternatives:u.alternatives}:{type:"literal",value:u.primary})),n.push({type:"role",role:"event",optional:false}),t.position==="after"){let p=t.primary.split(/\s+/);if(p.length>1)for(let l of p)n.push({type:"literal",value:l});else {let l=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};n.push(l);}}let s=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};return n.push(s),{id:`${a.action}-event-${e.code}-sov-patient-first-dest`,language:e.code,command:"on",priority:(i.basePriority??100)+40,template:{format:`{patient} ${o?.primary||""} {destination} ${u?.primary||""} {event} ${t.primary} ${r.primary}`,tokens:n},extraction:{action:{value:a.action},event:{fromRole:"event"},patient:{fromRole:"patient"},destination:{fromRole:"destination"}}}}function wi(a,e,r,t,i){let n=[];n.push({type:"role",role:"event",optional:false});let o=t.alternatives?.filter(l=>!l.includes(" ")&&l.length>1)||[];o.length>0&&n.push({type:"literal",value:o[0],alternatives:o.slice(1)});let u=e.roleMarkers.destination;u&&n.push({type:"group",optional:true,tokens:[{type:"role",role:"destination",optional:true},u.alternatives?{type:"literal",value:u.primary,alternatives:u.alternatives}:{type:"literal",value:u.primary}]}),n.push({type:"role",role:"patient",optional:false});let s=e.roleMarkers.patient;if(s){let l=s.alternatives?{type:"literal",value:s.primary,alternatives:s.alternatives}:{type:"literal",value:s.primary};n.push(l);}let p=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};return n.push(p),{id:`${a.action}-event-${e.code}-sov-compact`,language:e.code,command:"on",priority:(i.basePriority??100)+52,template:{format:`{event}${o[0]||""} {patient} ${r.primary}`,tokens:n},extraction:{action:{value:a.action},event:{fromRole:"event"},patient:{fromRole:"patient"},destination:{fromRole:"destination",default:{type:"reference",value:"me"}}}}}function xi(a,e,r,t,i){let n=[];if(n.push({type:"role",role:"event",optional:false}),t.position==="after"){let u=t.primary.split(/\s+/);if(u.length>1)for(let s of u)n.push({type:"literal",value:s});else {let s=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};n.push(s);}}let o=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};return n.push(o),{id:`${a.action}-event-${e.code}-sov-simple`,language:e.code,command:"on",priority:(i.basePriority??100)+48,template:{format:`{event} ${t.primary} ${r.primary}`,tokens:n},extraction:{action:{value:a.action},event:{fromRole:"event"},patient:{default:{type:"reference",value:"me"}}}}}function Ti(a,e,r,t){let i=e.eventHandler?.temporalMarkers;if(!i||i.length===0)return null;let n=[];n.push({type:"role",role:"event",optional:false}),e.possessive?.marker&&n.push({type:"group",optional:true,tokens:[{type:"literal",value:e.possessive.marker}]}),n.push({type:"literal",value:i[0],alternatives:i.slice(1)}),n.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};n.push(s);}let u=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};return n.push(u),{id:`${a.action}-event-${e.code}-sov-temporal`,language:e.code,command:"on",priority:(t.basePriority??100)+49,template:{format:`{event} ${i[0]} {patient} ${r.primary}`,tokens:n},extraction:{action:{value:a.action},event:{fromRole:"event"},patient:{fromRole:"patient"}}}}function Di(a,e,r,t,i){let n=[];if(n.push({type:"role",role:"event",optional:false}),t.position==="after"){let l=t.primary.split(/\s+/);if(l.length>1)for(let c of l)n.push({type:"literal",value:c});else {let c=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};n.push(c);}}let u=[...a.roles.filter(l=>l.required)].sort((l,c)=>{let m=l.sovPosition??999,d=c.sovPosition??999;return m-d});for(let l of u){n.push({type:"role",role:l.role,optional:false});let c,m;if(l.markerOverride&&l.markerOverride[e.code]!==void 0)c=l.markerOverride[e.code];else {let d=e.roleMarkers[l.role];d&&(c=d.primary,m=d.alternatives);}if(c){let d=m?{type:"literal",value:c,alternatives:m}:{type:"literal",value:c};n.push(d);}}let s=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};n.push(s);let p=u.map(l=>`{${l.role}}`).join(" ");return {id:`${a.action}-event-${e.code}-sov-2role`,language:e.code,command:"on",priority:(i.basePriority??100)+55,template:{format:`{event} ${t.primary} ${p} ${r.primary}`,tokens:n},extraction:{action:{value:a.action},event:{fromRole:"event"},...Object.fromEntries(u.map(l=>[l.role,{fromRole:l.role}]))}}}function Si(a,e,r,t,i){let n=[],u=[...a.roles.filter(y=>y.required)].sort((y,h)=>{let g=y.sovPosition??999,E=h.sovPosition??999;return g-E}),s=u[0];n.push({type:"role",role:s.role,optional:false});let p;if(s.markerOverride&&s.markerOverride[e.code]!==void 0)p=s.markerOverride[e.code];else {let y=e.roleMarkers[s.role];y&&(p=y.primary);}if(p&&n.push({type:"literal",value:p}),n.push({type:"role",role:"event",optional:false}),t.position==="after"){let y=t.primary.split(/\s+/);if(y.length>1)for(let h of y)n.push({type:"literal",value:h});else {let h=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};n.push(h);}}let l=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};n.push(l);let c=u[1];n.push({type:"role",role:c.role,optional:false});let m,d;if(c.markerOverride&&c.markerOverride[e.code]!==void 0)m=c.markerOverride[e.code];else {let y=e.roleMarkers[c.role];y&&(m=y.primary,d=y.alternatives);}if(m){let y=d?{type:"literal",value:m,alternatives:d}:{type:"literal",value:m};n.push(y);}return {id:`${a.action}-event-${e.code}-sov-2role-dest-first`,language:e.code,command:"on",priority:(i.basePriority??100)+48,template:{format:`{${s.role}} {event} ${t.primary} ${r.primary} {${c.role}}`,tokens:n},extraction:{action:{value:a.action},event:{fromRole:"event"},[s.role]:{fromRole:s.role},[c.role]:{fromRole:c.role}}}}function Xe(a,e,r,t,i){let n=[];if(t.position==="before"){let s=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};n.push(s);}n.push({type:"role",role:"event",optional:false});let o=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};n.push(o),n.push({type:"role",role:"patient",optional:false});let u=e.roleMarkers.destination;return u&&n.push({type:"group",optional:true,tokens:[u.alternatives?{type:"literal",value:u.primary,alternatives:u.alternatives}:{type:"literal",value:u.primary},{type:"role",role:"destination",optional:true}]}),{id:`${a.action}-event-${e.code}-vso`,language:e.code,command:"on",priority:(i.basePriority??100)+50,template:{format:`${t.primary} {event} ${r.primary} {patient} ${u?.primary||""} {destination?}`,tokens:n},extraction:{action:{value:a.action},event:{fromRole:"event"},patient:{fromRole:"patient"},destination:{fromRole:"destination",default:{type:"reference",value:"me"}}}}}function Bi(a,e,r,t,i){let n=[],o=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};n.push(o),n.push({type:"role",role:"patient",optional:false});let u=e.roleMarkers.destination;if(u&&n.push({type:"group",optional:true,tokens:[u.alternatives?{type:"literal",value:u.primary,alternatives:u.alternatives}:{type:"literal",value:u.primary},{type:"role",role:"destination",optional:true}]}),t.position==="before"){let s=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};n.push(s);}return n.push({type:"role",role:"event",optional:false}),{id:`${a.action}-event-${e.code}-vso-verb-first`,language:e.code,command:"on",priority:(i.basePriority??100)+45,template:{format:`${r.primary} {patient} ${u?.primary||""} {destination?} ${t.primary} {event}`,tokens:n},extraction:{action:{value:a.action},event:{fromRole:"event"},patient:{fromRole:"patient"},destination:{fromRole:"destination",default:{type:"reference",value:"me"}}}}}function Pi(a,e,r,t,i){let n=[],o=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};n.push(o);let s=[...a.roles.filter(l=>l.required)].sort((l,c)=>{let m=l.svoPosition??999,d=c.svoPosition??999;return m-d});for(let l of s){let c,m;if(l.markerOverride&&l.markerOverride[e.code]!==void 0)c=l.markerOverride[e.code];else {let d=e.roleMarkers[l.role];d&&(c=d.primary,m=d.alternatives);}if(c){let d=m?{type:"literal",value:c,alternatives:m}:{type:"literal",value:c};n.push(d);}n.push({type:"role",role:l.role,optional:false});}if(t.position==="before"){let l=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};n.push(l);}n.push({type:"role",role:"event",optional:false});let p=s.map(l=>`{${l.role}}`).join(" ");return {id:`${a.action}-event-${e.code}-vso-verb-first-2role`,language:e.code,command:"on",priority:(i.basePriority??100)+48,template:{format:`${r.primary} ${p} ${t.primary} {event}`,tokens:n},extraction:{action:{value:a.action},event:{fromRole:"event"},...Object.fromEntries(s.map(l=>[l.role,{fromRole:l.role}]))}}}function Je(a,e,r,t,i){let n=[];if(t.position==="before"){let l=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};n.push(l);}n.push({type:"role",role:"event",optional:false});let o=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};n.push(o);let s=[...a.roles.filter(l=>l.required)].sort((l,c)=>{let m=l.svoPosition??999,d=c.svoPosition??999;return m-d});for(let l of s){let c,m;if(l.markerOverride&&l.markerOverride[e.code]!==void 0)c=l.markerOverride[e.code];else {let d=e.roleMarkers[l.role];d&&(c=d.primary,m=d.alternatives);}if(c){let d=m?{type:"literal",value:c,alternatives:m}:{type:"literal",value:c};n.push(d);}n.push({type:"role",role:l.role,optional:false});}let p=s.map(l=>`{${l.role}}`).join(" ");return {id:`${a.action}-event-${e.code}-vso-2role`,language:e.code,command:"on",priority:(i.basePriority??100)+55,template:{format:`${t.primary} {event} ${r.primary} ${p}`,tokens:n},extraction:{action:{value:a.action},event:{fromRole:"event"},...Object.fromEntries(s.map(l=>[l.role,{fromRole:l.role}]))}}}function Fi(a,e,r,t,i){let n=[],o=e.eventHandler?.negationMarker;if(t.position==="before"){let p=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};n.push(p);}if(o){let p=o.alternatives?{type:"literal",value:o.primary,alternatives:o.alternatives}:{type:"literal",value:o.primary};n.push(p);}n.push({type:"role",role:"event",optional:false});let u=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};n.push(u),n.push({type:"role",role:"patient",optional:false});let s=e.roleMarkers.destination;return s&&n.push({type:"group",optional:true,tokens:[s.alternatives?{type:"literal",value:s.primary,alternatives:s.alternatives}:{type:"literal",value:s.primary},{type:"role",role:"destination",optional:true}]}),{id:`${a.action}-event-${e.code}-vso-negated`,language:e.code,command:"on",priority:(i.basePriority??100)+48,template:{format:`${t.primary} ${o?.primary||""} {event} ${r.primary} {patient} ${s?.primary||""} {destination?}`,tokens:n},extraction:{action:{value:a.action},event:{fromRole:"event"},patient:{fromRole:"patient"},destination:{fromRole:"destination",default:{type:"reference",value:"me"}}}}}function Ri(a,e,r,t){let i=[];i.push({type:"literal",value:"and",alternatives:["then"]}),i.push({type:"role",role:"event",optional:false});let n=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};i.push(n),i.push({type:"role",role:"patient",optional:false});let o=e.roleMarkers.destination;return o&&i.push({type:"group",optional:true,tokens:[o.alternatives?{type:"literal",value:o.primary,alternatives:o.alternatives}:{type:"literal",value:o.primary},{type:"role",role:"destination",optional:true}]}),{id:`${a.action}-event-${e.code}-vso-proclitic`,language:e.code,command:"on",priority:(t.basePriority??100)+45,template:{format:`[proclitic?] {event} ${r.primary} {patient} ${o?.primary||""} {destination?}`,tokens:i},extraction:{action:{value:a.action},event:{fromRole:"event"},patient:{fromRole:"patient"},destination:{fromRole:"destination",default:{type:"reference",value:"me"}}}}}var ae={basePriority:100,generateSimpleVariants:true,generateAlternatives:true};function vr(a,e,r=ae){let t=`${a.action}-${e.code}-generated`,i=r.basePriority??100,n=e.keywords[a.action];if(!n)throw new Error(`No keyword translation for '${a.action}' in ${e.code}`);let o=Ii(a,e,n),u=gr(a,e),s=$i(a,e,n);return {id:t,language:e.code,command:a.action,priority:i,template:{format:s,tokens:o},extraction:u}}function _i(a,e,r=ae){if(a.roles.filter(u=>!u.required).length===0)return null;let i=a.roles.filter(u=>u.required),n={...a,roles:i};return {...vr(n,e,r),id:`${a.action}-${e.code}-generated-simple`,priority:(r.basePriority??100)-5,extraction:gr(a,e)}}function Oi(a,e,r=ae){let t=[];if(t.push(vr(a,e,r)),r.generateSimpleVariants){let i=_i(a,e,r);i&&t.push(i);}return t}function hr(a,e=ae){let r=[],t=vi();for(let i of t){if(!a.keywords[i.action])continue;let n=Oi(i,a,e);if(r.push(...n),a.eventHandler?.eventMarker){let o=Ni(i,a,e);r.push(...o);}}return r}function Ni(a,e,r=ae){if(!e.eventHandler||!e.eventHandler.eventMarker)return [];let t=[],i=e.eventHandler.eventMarker,n=e.keywords[a.action];if(!n)return [];let u=a.roles.filter(s=>s.required).length===2;if(e.wordOrder==="SOV")if(u)t.push(Di(a,e,n,i,r)),t.push(Si(a,e,n,i,r));else {t.push(bi(a,e,n,i,r)),t.push(Ci(a,e,n,i,r));let s=e.roleMarkers.destination;s&&s.primary!==i.primary&&t.push(Ai(a,e,n,i,r));let p=i.primary.split(/\s+/),l=i.alternatives?.some(m=>!m.includes(" ")&&m.length>1);p.length>1&&l&&t.push(wi(a,e,n,i,r)),t.push(xi(a,e,n,i,r));let c=Ti(a,e,n,r);c&&t.push(c);}else e.wordOrder==="VSO"?u?(t.push(Je(a,e,n,i,r)),t.push(Pi(a,e,n,i,r))):(t.push(Xe(a,e,n,i,r)),t.push(Bi(a,e,n,i,r)),e.eventHandler?.negationMarker&&t.push(Fi(a,e,n,i,r)),e.tokenization?.prefixes&&t.push(Ri(a,e,n,r))):u?t.push(Je(a,e,n,i,r)):t.push(Xe(a,e,n,i,r));return t}function Ii(a,e,r){let t=[],i=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary},n=Mi(a,e);switch(e.wordOrder){case "SVO":t.push(i),t.push(...n);break;case "SOV":t.push(...n),t.push(i);break;case "VSO":t.push(i),t.push(...n);break;default:t.push(i),t.push(...n);}return t}function Mi(a,e){let r=[],t=fr(a.roles,e.wordOrder);for(let i of t){let n=Li(i,e);i.required?r.push(...n):r.push({type:"group",optional:true,tokens:n});}return r}function Li(a,e){let r=[],t=a.markerOverride?.[e.code],i=e.roleMarkers[a.role],n={type:"role",role:a.role,optional:!a.required,expectedTypes:a.expectedTypes};if(t!==void 0){let o=t?t.split(/\s+/).filter(Boolean):[];if((i?.position??"before")==="before"){for(let s of o)r.push({type:"literal",value:s});r.push(n);}else {r.push(n);for(let s of o)r.push({type:"literal",value:s});}}else if(i)if(i.position==="before"){if(i.primary){let o=i.alternatives?{type:"literal",value:i.primary,alternatives:i.alternatives}:{type:"literal",value:i.primary};r.push(o);}r.push(n);}else {r.push(n);let o=i.alternatives?{type:"literal",value:i.primary,alternatives:i.alternatives}:{type:"literal",value:i.primary};r.push(o);}else r.push(n);return r}function qi(a,e){let r={};for(let t of a.roles){let i=t.markerOverride?.[e.code],n=e.roleMarkers[t.role];i!==void 0?r[t.role]=i?{marker:i}:{}:n&&n.primary?r[t.role]=n.alternatives?{marker:n.primary,markerAlternatives:n.alternatives}:{marker:n.primary}:r[t.role]={};}return r}function gr(a,e){let r=qi(a,e),t={};for(let i of a.roles){let n=r[i.role]||{};!i.required&&i.default?t[i.role]={...n,default:i.default}:t[i.role]=n;}return t}function $i(a,e,r){let t=[],n=fr(a.roles,e.wordOrder).map(o=>{let u=zi(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":t.push(r.primary,...n);break;case "SOV":t.push(...n,r.primary);break;default:t.push(r.primary,...n);}return t.join(" ")}var Vi=class{constructor(a={}){this.cache=new Map,this.config={maxSize:a.maxSize??1e3,ttlMs:a.ttlMs??0,enabled:a.enabled??true},this.stats={hits:0,misses:0,evictions:0,expirations:0};}makeKey(a,e){return `${e}:${a}`}isExpired(a){return this.config.ttlMs===0?false:Date.now()-a.createdAt>this.config.ttlMs}evictLRU(){let a=this.cache.keys().next().value;a!==void 0&&(this.cache.delete(a),this.stats.evictions++);}get(a,e){if(!this.config.enabled){this.stats.misses++;return}let r=this.makeKey(a,e),t=this.cache.get(r);if(!t){this.stats.misses++;return}if(this.isExpired(t)){this.cache.delete(r),this.stats.expirations++,this.stats.misses++;return}return this.cache.delete(r),t.lastAccessed=Date.now(),this.cache.set(r,t),this.stats.hits++,t.result}set(a,e,r){if(!this.config.enabled||r!==null&&typeof r=="object"&&"confidence"in r&&r.confidence===0)return;let t=this.makeKey(a,e),i=Date.now();for(;this.cache.size>=this.config.maxSize;)this.evictLRU();this.cache.set(t,{result:r,createdAt:i,lastAccessed:i});}has(a,e){if(!this.config.enabled)return false;let r=this.makeKey(a,e),t=this.cache.get(r);return t?this.isExpired(t)?(this.cache.delete(r),this.stats.expirations++,false):true:false}delete(a,e){let r=this.makeKey(a,e);return this.cache.delete(r)}clear(){this.cache.clear();}resetStats(){this.stats={hits:0,misses:0,evictions:0,expirations:0};}getStats(){let a=this.stats.hits+this.stats.misses;return {hits:this.stats.hits,misses:this.stats.misses,size:this.cache.size,maxSize:this.config.maxSize,hitRate:a>0?this.stats.hits/a:0,evictions:this.stats.evictions,expirations:this.stats.expirations,enabled:this.config.enabled}}configure(a){if(a.maxSize!==void 0)for(this.config.maxSize=a.maxSize;this.cache.size>this.config.maxSize;)this.evictLRU();a.ttlMs!==void 0&&(this.config.ttlMs=a.ttlMs),a.enabled!==void 0&&(this.config.enabled=a.enabled);}enable(){this.config.enabled=true;}disable(){this.config.enabled=false;}getConfig(){return {...this.config}}};new Vi;var ji=Object.defineProperty,Wi=Object.getOwnPropertyNames,br=(a,e)=>function(){return a&&(e=(0, a[Wi(a)[0]])(a=0)),e},Hi=(a,e)=>{for(var r in e)ji(a,r,{get:e[r],enumerable:true});};function Er(a,e){return a.replace(/\{(\w+)\}/g,(r,t)=>String(e[t]??`{${t}}`))}function D(a,e,r={},t){let i=Cr[a],n=Er(i,r),o=Ar[a],u=o?Er(o,r):void 0;return {code:a,message:n,severity:e,...t&&{role:t},...u&&{suggestion:u}}}var v,Cr,Ar,Ui=br({"src/generators/schema-error-codes.ts"(){v={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"},Cr={[v.AMBIGUOUS_TYPE_LITERAL_SELECTOR]:"Role '{role}' accepts both 'literal' and 'selector'. This may cause ambiguous type inference for values starting with special characters (* . # etc.).",[v.TOO_MANY_EXPECTED_TYPES]:"Role '{role}' accepts {count} different types. This may make type inference unreliable.",[v.MULTI_TYPE_PATIENT_EXPECTED]:"Role '{role}' accepts multiple types (expected for {command} command).",[v.NO_REQUIRED_ROLES]:"Command has no required roles. Is this intentional?",[v.NO_REQUIRED_ROLES_EXPECTED]:"Command has no required roles (expected for {command}).",[v.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.",[v.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.",[v.EVENT_HANDLER_MISSING_EVENT]:"Event handler command should have an 'event' role to specify which event to listen for.",[v.EVENT_HANDLER_EVENT_NOT_REQUIRED]:"Event role should be required - every event handler needs an event to listen for.",[v.CONDITIONAL_MISSING_CONDITION]:"Conditional command should have a 'condition' role for the boolean expression.",[v.CONDITIONAL_CONDITION_NOT_REQUIRED]:"Condition role should be required - conditionals need a condition to evaluate.",[v.FOR_LOOP_MISSING_SOURCE]:"For-loop should have a 'source' role for the collection to iterate over.",[v.WHILE_LOOP_MISSING_CONDITION]:"While-loop should have a 'condition' role for the loop condition.",[v.VALUE_TYPE_MISMATCH]:"Role '{role}' of command '{command}' expects type [{expectedTypes}], got '{actualType}'.",[v.SELECTOR_KIND_MISMATCH]:"Role '{role}' of command '{command}' expects selector kind [{selectorKinds}], got '{actualKind}'.",[v.SELECTOR_KINDS_WITHOUT_SELECTOR_TYPE]:"Role '{role}' has selectorKinds but expectedTypes does not include 'selector'.",[v.KEYWORD_COLLISION]:"Keyword '{keyword}' is used by multiple commands: {commands}. Only the first-registered command will be reachable."},Ar={[v.AMBIGUOUS_TYPE_LITERAL_SELECTOR]:"Consider being more specific about which type is expected, or use explicit type markers.",[v.TOO_MANY_EXPECTED_TYPES]:"Consider narrowing the accepted types to improve type inference reliability.",[v.TRANSITION_PATIENT_ACCEPTS_SELECTOR]:"Remove 'selector' from expectedTypes and only accept 'literal'.",[v.TRANSITION_MISSING_GOAL]:"Add a 'goal' role with expectedTypes ['literal', 'variable'].",[v.EVENT_HANDLER_MISSING_EVENT]:"Add an 'event' role with expectedTypes ['literal'].",[v.EVENT_HANDLER_EVENT_NOT_REQUIRED]:"Set required: true on the 'event' role.",[v.CONDITIONAL_MISSING_CONDITION]:"Add a 'condition' role with expectedTypes ['expression'].",[v.CONDITIONAL_CONDITION_NOT_REQUIRED]:"Set required: true on the 'condition' role.",[v.FOR_LOOP_MISSING_SOURCE]:"Add a 'source' role for the collection to iterate over.",[v.WHILE_LOOP_MISSING_CONDITION]:"Add a 'condition' role for the loop continuation condition.",[v.VALUE_TYPE_MISMATCH]:"Ensure the value matches one of the expected types: [{expectedTypes}].",[v.SELECTOR_KIND_MISMATCH]:"Use a selector of the correct kind: [{selectorKinds}].",[v.SELECTOR_KINDS_WITHOUT_SELECTOR_TYPE]:"Either add 'selector' to expectedTypes or remove selectorKinds.",[v.KEYWORD_COLLISION]:"Give each command a unique keyword. Move the shared keyword to alternatives on one command, or use a more specific translation."};}}),wr={};Hi(wr,{SchemaErrorCodes:()=>v,formatValidationResults:()=>Zi,getValidationStats:()=>en,validateAllKeywordCollisions:()=>tn,validateAllSchemas:()=>Ji,validateCommandSchema:()=>xr,validateKeywordCollisions:()=>Tr,validateRoleValues:()=>rn});function Gi(a,e){return {action:a,items:e}}function xr(a){let e=[];for(let t of a.roles)t.expectedTypes.includes("literal")&&t.expectedTypes.includes("selector")&&(t.role==="patient"&&xe.has(a.action)?e.push(D(v.MULTI_TYPE_PATIENT_EXPECTED,"note",{role:t.role,command:a.action},t.role)):e.push(D(v.AMBIGUOUS_TYPE_LITERAL_SELECTOR,"warning",{role:t.role},t.role))),t.expectedTypes.length>3&&!xe.has(a.action)&&e.push(D(v.TOO_MANY_EXPECTED_TYPES,"warning",{role:t.role,count:t.expectedTypes.length},t.role));for(let t of a.roles)t.selectorKinds&&t.selectorKinds.length>0&&(t.expectedTypes.includes("selector")||e.push(D(v.SELECTOR_KINDS_WITHOUT_SELECTOR_TYPE,"warning",{role:t.role},t.role)));switch(a.action){case "transition":Ki(a,e);break;case "on":Yi(a,e);break;case "if":case "unless":Qi(a,e);break;case "repeat":case "for":case "while":Xi(a,e);break}return a.roles.filter(t=>t.required).length===0&&(Dr.has(a.action)?e.push(D(v.NO_REQUIRED_ROLES_EXPECTED,"note",{command:a.action})):e.push(D(v.NO_REQUIRED_ROLES,"warning",{}))),Gi(a.action,e)}function Ki(a,e){let r=a.roles.find(i=>i.role==="patient"),t=a.roles.find(i=>i.role==="goal");r&&r.expectedTypes.includes("selector")&&e.push(D(v.TRANSITION_PATIENT_ACCEPTS_SELECTOR,"warning",{},"patient")),r&&!t&&e.push(D(v.TRANSITION_MISSING_GOAL,"error",{}));}function Yi(a,e){let r=a.roles.find(t=>t.role==="event");r||e.push(D(v.EVENT_HANDLER_MISSING_EVENT,"warning",{})),r&&!r.required&&e.push(D(v.EVENT_HANDLER_EVENT_NOT_REQUIRED,"warning",{}));}function Qi(a,e){let r=a.roles.find(t=>t.role==="condition");r||e.push(D(v.CONDITIONAL_MISSING_CONDITION,"warning",{})),r&&!r.required&&e.push(D(v.CONDITIONAL_CONDITION_NOT_REQUIRED,"warning",{}));}function Xi(a,e){a.action==="for"?a.roles.find(t=>t.role==="source")||e.push(D(v.FOR_LOOP_MISSING_SOURCE,"warning",{})):a.action==="while"&&(a.roles.find(t=>t.role==="condition")||e.push(D(v.WHILE_LOOP_MISSING_CONDITION,"warning",{})));}function Ji(a,e={}){let r=new Map,{includeNotes:t=false}=e;for(let[i,n]of Object.entries(a)){let o=xr(n),u=o.items.some(p=>p.severity==="warning"||p.severity==="error"),s=t&&o.items.some(p=>p.severity==="note");(u||s)&&r.set(i,o);}return r}function Zi(a,e={}){let r=[],{showNotes:t=false,showCodes:i=true}=e;for(let[n,o]of a){let u=o.items.filter(l=>l.severity==="error"),s=o.items.filter(l=>l.severity==="warning"),p=o.items.filter(l=>l.severity==="note");if(u.length>0){r.push(` \u274C ${n}:`);for(let l of u){let c=i?` [${l.code}]`:"";r.push(` ERROR${c}: ${l.message}`),l.suggestion&&r.push(` \u{1F4A1} Suggestion: ${l.suggestion}`);}}if(s.length>0){r.push(` \u26A0\uFE0F ${n}:`);for(let l of s){let c=i?` [${l.code}]`:"";r.push(` ${c?`${l.code}: `:""}${l.message}`),l.suggestion&&r.push(` \u{1F4A1} ${l.suggestion}`);}}if(t&&p.length>0){r.push(` \u2139\uFE0F ${n}:`);for(let l of p){let c=i?` [${l.code}]`:"";r.push(` ${c?`${l.code}: `:""}${l.message}`);}}}return r.join(`
4
+ `)}function en(a){let e=0,r=0,t=0,i={};for(let n of a.values())for(let o of n.items)o.severity==="error"?e++:o.severity==="warning"?r++:o.severity==="note"&&t++,i[o.code]=(i[o.code]||0)+1;return {totalCommands:a.size,errors:e,warnings:r,notes:t,byCode:i}}function rn(a,e){let r=[];for(let t of e){let i=a.roles.find(n=>n.role===t.role);i&&(i.expectedTypes.length>0&&!i.expectedTypes.includes(t.type)&&(i.expectedTypes.includes("expression")||r.push({level:"error",role:t.role,message:`${a.action}.${t.role} expects type [${i.expectedTypes.join(", ")}], got '${t.type}'`,code:v.VALUE_TYPE_MISMATCH})),t.type==="selector"&&t.selectorKind&&i.selectorKinds&&i.selectorKinds.length>0&&(i.selectorKinds.includes(t.selectorKind)||r.push({level:"error",role:t.role,message:`${a.action}.${t.role} expects selector kind [${i.selectorKinds.join(", ")}], got '${t.selectorKind}'`,code:v.SELECTOR_KIND_MISMATCH})));}return r}function Tr(a){let e=[];if(!a.keywords)return {language:a.code,collisions:e};let r=new Map;for(let[i,n]of Object.entries(a.keywords)){if(!n||!n.primary)continue;let o=r.get(n.primary)||[];if(o.push({command:i,isPrimary:true}),r.set(n.primary,o),n.alternatives)for(let u of n.alternatives){let s=r.get(u)||[];s.push({command:i,isPrimary:false}),r.set(u,s);}}for(let[i,n]of r){let o=[...new Set(n.map(p=>p.command))];if(o.length<=1)continue;let u=n.filter(p=>p.isPrimary).length,s;u>=2?s="primary-primary":u===1?s="primary-alternative":s="alternative-alternative",e.push({keyword:i,commands:o.sort(),type:s});}let t={"primary-primary":0,"primary-alternative":1,"alternative-alternative":2};return e.sort((i,n)=>t[i.type]-t[n.type]),{language:a.code,collisions:e}}function tn(a){let e=[];for(let[,r]of Object.entries(a)){let t=Tr(r);t.collisions.length>0&&e.push(t);}return e.sort((r,t)=>r.language.localeCompare(t.language))}var xe,Dr,an=br({"src/generators/schema-validator.ts"(){Ui(),xe=new Set(["put","append","prepend","log","throw","make","measure","return","swap","morph","beep","copy"]),Dr=new Set(["compound","else","halt","continue","async","init","settle","focus","blur","return","js","measure","break","exit","beep","empty","open","close","select","clear","reset","breakpoint"]);}}),Te={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"},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"}}},nn=["===","!==","->","==","!=","<=",">=","&&","||","**","+=","-=","*=","/=","+","-","*","/","=",">","<","!","&","|","%","^","~"],on=class{constructor(a=nn){this.name="operator",this.operators=[...a].sort((e,r)=>r.length-e.length);}canExtract(a,e){return this.operators.some(r=>a.startsWith(r,e))}extract(a,e){for(let r of this.operators)if(a.startsWith(r,e))return {value:r,length:r.length};return null}},un="()[]{},:;",sn=class{constructor(a=un){this.punctuation=a,this.name="punctuation";}canExtract(a,e){return this.punctuation.includes(a[e])}extract(a,e){let r=a[e];return this.punctuation.includes(r)?{value:r,length:1}:null}};function ln(a,e){let r=a[e];if(r==="#"){let t=a.slice(e).match(/^#[a-zA-Z_][\w-]*/);return t?t[0]:null}if(r==="."){let t=a.slice(e).match(/^\.[a-zA-Z_][\w-]*/);return t?t[0]:null}if(r==="["){let t=0,i=e;for(;i<a.length;){if(a[i]==="["&&t++,a[i]==="]"&&(t--,t===0))return a.slice(e,i+1);i++;}return null}if(r==="<"){let t=a.slice(e).match(/^<[\w-]+(?:[#.][\w-]+|\[[^\]]+\])*\s*\/>/);return t?t[0]:null}return null}var pn=class{constructor(){this.name="css-selector";}canExtract(a,e){let r=a[e];return r==="#"||r==="."||r==="["||r==="<"}extract(a,e){let r=ln(a,e);return r?{value:r,length:r.length,metadata:{type:"css-selector"}}:null}},cn=class{constructor(){this.name="event-modifier";}canExtract(a,e){if(a[e]!==".")return false;let r=a.slice(e);return /^\.(once|prevent|stop|debounce|throttle|queue)/.test(r)}extract(a,e){let r=a.slice(e).match(/^\.(?:once|prevent|stop|debounce|throttle|queue)(?:\(([^)]+)\))?/);if(!r)return null;let t=r[0],i=t.slice(1).split("(")[0],n=r[1];return {value:t,length:t.length,metadata:{modifierName:i,value:n?i==="queue"?n:parseInt(n,10):void 0}}}};function mn(a,e){let r=a.slice(e);if(r.startsWith("http://")||r.startsWith("https://")){let t=r.match(/^https?:\/\/[^\s]*/);return t?t[0]:null}if(r.startsWith("//")){let t=r.match(/^\/\/[^\s]*/);return t?t[0]:null}if(r.startsWith("./")||r.startsWith("../")){let t=r.match(/^\.\.?\/[^\s]*/);return t?t[0]:null}if(r.startsWith("/")){let t=r.match(/^\/[^\s]*/);return t?t[0]:null}return null}var dn=class{constructor(){this.name="url";}canExtract(a,e){let r=a.slice(e);return r.startsWith("http://")||r.startsWith("https://")||r.startsWith("//")||r.startsWith("./")||r.startsWith("../")||r.startsWith("/")}extract(a,e){let r=mn(a,e);return r?{value:r,length:r.length,metadata:{type:"url"}}:null}},yn=class{constructor(){this.name="variable-ref";}canExtract(a,e){return a[e]===":"&&e+1<a.length&&/[a-zA-Z_]/.test(a[e+1])}extract(a,e){if(!this.canExtract(a,e))return null;let r=1;for(;e+r<a.length&&/[a-zA-Z0-9_]/.test(a[e+r]);)r++;return {value:a.substring(e,e+r),length:r,metadata:{type:"variable-reference"}}}};function fn(){return [new dn,new cn,new yn,new pn]}function we(a){return /[a-zA-Z0-9_]/.test(a)}var vn=class{constructor(){this.name="english-keyword";}setContext(a){this.context=a;}canExtract(a,e){return /[a-zA-Z_]/.test(a[e])}extract(a,e){if(!this.context)throw new Error("EnglishKeywordExtractor: context not set");let r=e,t="";for(;r<a.length&&we(a[r]);)t+=a[r++];if(!t)return null;if(r<a.length&&a[r]===":"){let u=r;r++;let s="";for(;r<a.length&&we(a[r]);)s+=a[r++];s?t=t+":"+s:r=u;}let i=this.context.lookupKeyword(t),n=i&&i.normalized!==i.native?i.normalized:void 0,o=null;return this.context.isKeyword(t)||(o=this.tryClassSyntaxConversion(a,r,t)),{value:o||t,length:r-e,metadata:{normalized:n,classConversion:o?true:void 0}}}tryClassSyntaxConversion(a,e,r){let t=e;for(;t<a.length&&/\s/.test(a[t]);)t++;if(a.slice(t,t+5).toLowerCase()==="class"){let i=t+5;if(i>=a.length||!we(a[i]))return "."+r}return null}};function hn(){return [new vn]}var gn=[{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"}],En=class extends $e{constructor(){super(),this.language="en",this.direction="ltr",this.initializeKeywordsFromProfile(Te,gn),this.registerExtractors(fn()),this.registerExtractor(new Ie),this.registerExtractor(new Me),this.registerExtractors(hn()),this.registerExtractor(new on),this.registerExtractor(new sn);}classifyToken(a){return this.isKeyword(a)?"keyword":a.startsWith("/")||a.startsWith("./")||a.startsWith("../")||a.startsWith("http")?"url":/^\.(once|prevent|stop|debounce|throttle|queue)(\(.*\))?$/.test(a)?"event-modifier":a.startsWith("#")||a.startsWith(".")||a.startsWith("[")||a.startsWith("*")||a.startsWith("<")?"selector":a.startsWith('"')||a.startsWith("'")||/^\d/.test(a)?"literal":["==","!=","<=",">=","<",">","&&","||","!"].includes(a)?"operator":"identifier"}},kn=new En,zn={action:"toggle",description:"Toggle a class or attribute on/off",category:"dom-class",primaryRole:"patient",roles:[{role:"patient",description:"The class or attribute to toggle",required:true,expectedTypes:["selector"],selectorKinds:["class","attribute"],svoPosition:1,sovPosition:2},{role:"destination",description:"The target element (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:2,sovPosition:1}],errorCodes:["MISSING_ARGUMENT","NO_VALID_CLASS_NAMES","INVALID_CSS_PROPERTY"],preconditions:[{condition:"Command has at least one argument",errorCode:"MISSING_ARGUMENT",message:"toggle command requires an argument"},{condition:"Class names are valid CSS identifiers",errorCode:"NO_VALID_CLASS_NAMES",message:"toggle command: no valid class names found"}],recoveryHints:{MISSING_ARGUMENT:"Add a class selector (.classname) or attribute to toggle",NO_VALID_CLASS_NAMES:"Ensure class names start with a dot (.) and are valid CSS identifiers",INVALID_CSS_PROPERTY:"Check CSS property name syntax (use kebab-case)"}},bn={action:"add",description:"Add a class or attribute to an element",category:"dom-class",primaryRole:"patient",roles:[{role:"patient",description:"The class or attribute to add",required:true,expectedTypes:["selector"],svoPosition:1,sovPosition:2},{role:"destination",description:"The target element (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:2,sovPosition:1,markerOverride:{en:"to"}}],errorCodes:["MISSING_ARGUMENT","NO_VALID_CLASS_NAMES","PROPERTY_REQUIRES_VALUE"],preconditions:[{condition:"Command has at least one argument",errorCode:"MISSING_ARGUMENT",message:"add command requires an argument"}],recoveryHints:{MISSING_ARGUMENT:"Add a class selector (.classname) or attribute to add",NO_VALID_CLASS_NAMES:"Ensure class names start with a dot (.) and are valid CSS identifiers",PROPERTY_REQUIRES_VALUE:"When adding a property (*prop), provide a value argument"}},Cn={action:"remove",description:"Remove a class or attribute from an element",category:"dom-class",primaryRole:"patient",targetRole:"source",roles:[{role:"patient",description:"The class or attribute to remove",required:true,expectedTypes:["selector"],svoPosition:1,sovPosition:2},{role:"source",description:"The element to remove from (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:2,sovPosition:1}],errorCodes:["MISSING_ARGUMENT","NO_VALID_CLASS_NAMES"],preconditions:[{condition:"Command has at least one argument",errorCode:"MISSING_ARGUMENT",message:"remove command requires an argument"}],recoveryHints:{MISSING_ARGUMENT:"Add a class selector (.classname) or attribute to remove",NO_VALID_CLASS_NAMES:"Ensure class names start with a dot (.) and are valid CSS identifiers"}},An={action:"put",description:"Put content into a target element or variable",category:"dom-content",primaryRole:"patient",roles:[{role:"patient",description:"The content to put",required:true,expectedTypes:["literal","selector","reference","expression"],svoPosition:1,sovPosition:1},{role:"destination",description:"Where to put the content",required:true,expectedTypes:["selector","reference"],svoPosition:2,sovPosition:2,markerOverride:{en:"into"},markerVariants:{en:["before","after"]},methodCarrier:"method"}],errorCodes:["MISSING_ARGUMENTS","MISSING_CONTENT","MISSING_POSITION","INVALID_POSITION","NO_TARGET","NO_ELEMENTS"],preconditions:[{condition:"Command has content and position arguments",errorCode:"MISSING_ARGUMENTS",message:"put requires arguments"},{condition:"Content to put is specified",errorCode:"MISSING_CONTENT",message:"put requires content"},{condition:"Position keyword is specified (into, before, after, etc.)",errorCode:"MISSING_POSITION",message:"put requires position keyword"}],recoveryHints:{MISSING_ARGUMENTS:"Use syntax: put <content> into/before/after <target>",MISSING_CONTENT:"Add content to put (string, element, or expression)",MISSING_POSITION:"Add position keyword: into, before, after, at start of, at end of",INVALID_POSITION:"Valid positions: into, before, after, at start of, at end of",NO_TARGET:'Ensure target element exists or use "me" reference',NO_ELEMENTS:"Check that the selector matches existing elements"}},wn={action:"set",description:"Set a property or variable to a value",category:"variable",primaryRole:"destination",roles:[{role:"destination",description:"The property or variable to set",required:true,expectedTypes:["selector","reference","expression"],svoPosition:1,sovPosition:1,markerOverride:{en:"",ja:"\u3092",ko:"\uB97C",tr:"i",ar:"",sw:"",tl:"",bn:"\u0995\u09C7",qu:"ta"}},{role:"patient",description:"The value to set",required:true,expectedTypes:["literal","expression","reference"],svoPosition:2,sovPosition:2,markerOverride:{en:"to",es:"a",pt:"para",fr:"\xE0",de:"auf",id:"ke",ja:"\u306B",ko:"\uC73C\uB85C",tr:"e",ar:"\u0625\u0644\u0649",sw:"kwenye",tl:"sa",bn:"\u09A4\u09C7",qu:"man"}}],errorCodes:["MISSING_TARGET","INVALID_TARGET","MISSING_VALUE","INVALID_SYNTAX"],preconditions:[{condition:"Command has a target variable or property",errorCode:"MISSING_TARGET",message:"set command requires a target"},{condition:"Target is a valid variable or property reference",errorCode:"INVALID_TARGET",message:"set command target must be a string or object literal"},{condition:'Value is specified with "to" keyword',errorCode:"MISSING_VALUE",message:'set command requires a value (use "to" keyword)'}],recoveryHints:{MISSING_TARGET:"Add a target: set :variable to value OR set element.property to value",INVALID_TARGET:'Use local variable (:name), element property (el.prop), or "the X of Y" syntax',MISSING_VALUE:'Add "to <value>" to specify what to set',INVALID_SYNTAX:"Use syntax: set <target> to <value>"}},xn={action:"show",description:"Make an element visible",category:"dom-visibility",primaryRole:"patient",roles:[{role:"patient",description:"The element to show",required:true,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:1,sovPosition:1},{role:"style",description:"Animation style (fade, slide, etc.)",required:false,expectedTypes:["literal"],svoPosition:2,sovPosition:2}]},Tn={action:"hide",description:"Make an element invisible",category:"dom-visibility",primaryRole:"patient",roles:[{role:"patient",description:"The element to hide",required:true,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:1,sovPosition:1},{role:"style",description:"Animation style (fade, slide, etc.)",required:false,expectedTypes:["literal"],svoPosition:2,sovPosition:2}]},Dn={action:"on",description:"Handle an event",category:"event",primaryRole:"event",hasBody:true,roles:[{role:"event",description:"The event to handle",required:true,expectedTypes:["literal"],svoPosition:1,sovPosition:2},{role:"source",description:"The element to listen on (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:2,sovPosition:1}]},Sn={action:"trigger",description:"Trigger/dispatch an event",category:"event",primaryRole:"event",roles:[{role:"event",description:"The event to trigger (supports namespaced events like draggable:start)",required:true,expectedTypes:["literal","expression"],svoPosition:1,sovPosition:2},{role:"destination",description:"The target element (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:2,sovPosition:1}]},Bn={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}]},Pn={action:"fetch",description:"Fetch data from a URL",category:"async",primaryRole:"source",roles:[{role:"source",description:"The URL to fetch from",required:true,expectedTypes:["literal","expression"],svoPosition:1,sovPosition:1,renderOverride:{en:""}},{role:"responseType",description:"Response format (json, text, html, blob, etc.)",required:false,expectedTypes:["literal","expression"],svoPosition:2,sovPosition:2,markerOverride:{en:"as"}},{role:"method",description:"HTTP method (GET, POST, etc.)",required:false,expectedTypes:["literal"],svoPosition:3,sovPosition:3},{role:"destination",description:"Where to store the result",required:false,expectedTypes:["selector","reference"],svoPosition:4,sovPosition:4}]},Fn={action:"increment",description:"Increment a numeric value",category:"variable",primaryRole:"patient",roles:[{role:"patient",description:"The value to increment",required:true,expectedTypes:["selector","reference","expression"],svoPosition:1,sovPosition:1},{role:"quantity",description:"Amount to increment by (defaults to 1)",required:false,expectedTypes:["literal"],default:{type:"literal",value:1,dataType:"number"},svoPosition:2,sovPosition:2,markerOverride:{en:"by"}}]},Rn={action:"decrement",description:"Decrement a numeric value",category:"variable",primaryRole:"patient",roles:[{role:"patient",description:"The value to decrement",required:true,expectedTypes:["selector","reference","expression"],svoPosition:1,sovPosition:1},{role:"quantity",description:"Amount to decrement by (defaults to 1)",required:false,expectedTypes:["literal"],default:{type:"literal",value:1,dataType:"number"},svoPosition:2,sovPosition:2,markerOverride:{en:"by"}}]},_n={action:"append",description:"Append content to an element",category:"dom-content",primaryRole:"patient",roles:[{role:"patient",description:"The content to append",required:true,expectedTypes:["literal","selector","expression"],svoPosition:1,sovPosition:2},{role:"destination",description:"The element to append to",required:true,expectedTypes:["selector","reference"],svoPosition:2,sovPosition:1,markerOverride:{en:"to"}}]},On={action:"prepend",description:"Prepend content to an element",category:"dom-content",primaryRole:"patient",roles:[{role:"patient",description:"The content to prepend",required:true,expectedTypes:["literal","selector","expression"],svoPosition:1,sovPosition:2},{role:"destination",description:"The element to prepend to",required:true,expectedTypes:["selector","reference"],svoPosition:2,sovPosition:1,markerOverride:{en:"to"}}]},Nn={action:"log",description:"Log a value to the console",category:"variable",primaryRole:"patient",roles:[{role:"patient",description:"The value to log",required:true,expectedTypes:["literal","selector","reference","expression"],svoPosition:1,sovPosition:1}]},In={action:"get",description:"Get a value from a source",category:"variable",primaryRole:"source",roles:[{role:"source",description:"The source to get from",required:true,expectedTypes:["selector","reference","expression"],svoPosition:1,sovPosition:2,markerOverride:{en:"",es:"",pt:"",fr:"",de:"",ja:"\u3092",zh:"",ko:"\uB97C",ar:"\u0639\u0644\u0649",tr:"i",id:"",sw:"",tl:"",bn:"\u0995\u09C7",qu:"ta"}},{role:"destination",description:"Where to store the result (optional)",required:false,expectedTypes:["reference"],svoPosition:2,sovPosition:1}]},Mn={action:"take",description:"Take content from a source element",category:"dom-content",primaryRole:"patient",roles:[{role:"patient",description:"The class or element to take",required:true,expectedTypes:["selector"],svoPosition:1,sovPosition:2},{role:"source",description:"The element to take from (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:2,sovPosition:1}]},Ln={action:"make",description:"Create a new element",category:"dom-content",primaryRole:"patient",roles:[{role:"patient",description:"The element type or selector to create",required:true,expectedTypes:["literal","selector"],svoPosition:1,sovPosition:1}]},qn={action:"halt",description:"Halt/stop execution or event propagation",category:"control-flow",primaryRole:"patient",roles:[{role:"patient",description:"What to halt (event, default, bubbling, etc.)",required:false,expectedTypes:["literal","reference","expression"],svoPosition:1,sovPosition:1}]},$n={action:"settle",description:"Wait for animations/transitions to settle",category:"async",primaryRole:"patient",roles:[{role:"patient",description:"The element to settle (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:1,sovPosition:1}]},Vn={action:"throw",description:"Throw an error",category:"control-flow",primaryRole:"patient",roles:[{role:"patient",description:"The error message or object to throw",required:true,expectedTypes:["literal","expression"],svoPosition:1,sovPosition:1}]},jn={action:"send",description:"Send an event to an element",category:"event",primaryRole:"event",roles:[{role:"event",description:"The event to send",required:true,expectedTypes:["literal","expression"],svoPosition:1,sovPosition:2},{role:"destination",description:"The target element (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:2,sovPosition:1,markerOverride:{en:"to",ja:"\u306B",ar:"\u0625\u0644\u0649",es:"a",ko:"\uC5D0\uAC8C",zh:"\u5230",tr:"-e",pt:"para",fr:"\xE0",de:"an",id:"ke",qu:"-man",sw:"kwa"}}]},Wn={action:"if",description:"Conditional execution",category:"control-flow",primaryRole:"condition",hasBody:true,roles:[{role:"condition",description:"The condition to evaluate",required:true,expectedTypes:["expression"],svoPosition:1,sovPosition:1}]},Hn={action:"unless",description:"Negated conditional execution (executes when condition is false)",category:"control-flow",primaryRole:"condition",hasBody:true,roles:[{role:"condition",description:"The condition to evaluate (body executes when false)",required:true,expectedTypes:["expression"],svoPosition:1,sovPosition:1}]},Un={action:"else",description:"Else branch of conditional",category:"control-flow",primaryRole:"patient",hasBody:true,roles:[]},Gn={action:"repeat",description:"Repeat a block of commands",category:"control-flow",primaryRole:"loopType",hasBody:true,roles:[{role:"loopType",description:"Loop variant: forever, times, for, while, until, until-event",required:true,expectedTypes:["literal"],svoPosition:0,sovPosition:0},{role:"quantity",description:"Number of times to repeat",required:false,expectedTypes:["literal","expression"],svoPosition:1,sovPosition:1},{role:"event",description:"Event to wait for (terminates loop)",required:false,expectedTypes:["literal","expression"],svoPosition:2,sovPosition:2},{role:"source",description:"Element to listen for event on",required:false,expectedTypes:["selector","reference"],svoPosition:3,sovPosition:3}],notes:'Can also use "repeat forever", "repeat until condition", or "repeat until event X from Y"'},Kn={action:"for",description:"Iterate over a collection",category:"control-flow",primaryRole:"patient",hasBody:true,roles:[{role:"patient",description:"The iteration variable",required:true,expectedTypes:["reference"],svoPosition:1,sovPosition:2},{role:"source",description:"The collection to iterate over",required:true,expectedTypes:["selector","reference","expression"],svoPosition:2,sovPosition:1,markerOverride:{en:"in"}}]},Yn={action:"while",description:"Loop while condition is true",category:"control-flow",primaryRole:"condition",hasBody:true,roles:[{role:"condition",description:"The condition to check",required:true,expectedTypes:["expression"],svoPosition:1,sovPosition:1}]},Qn={action:"continue",description:"Continue to next loop iteration",category:"control-flow",primaryRole:"patient",roles:[]},Xn={action:"go",description:"Navigate to a URL",category:"navigation",primaryRole:"destination",roles:[{role:"destination",description:"The URL to navigate to",required:true,expectedTypes:["literal","expression"],svoPosition:1,sovPosition:1,markerOverride:{en:"to"},renderOverride:{en:""}}]},Jn={action:"transition",description:"Transition an element with animation",category:"dom-visibility",primaryRole:"patient",roles:[{role:"patient",description:"The property to transition (opacity, *background-color, etc.)",required:true,expectedTypes:["literal"],svoPosition:1,sovPosition:2,markerOverride:{en:"",ar:"",tl:"",sw:""}},{role:"goal",description:"The target value to transition to",required:true,expectedTypes:["literal","expression"],svoPosition:2,sovPosition:3,markerOverride:{en:"to",ar:"\u0625\u0644\u0649",tl:"sa",sw:"kwenye",bn:"\u09A4\u09C7",qu:"man",es:"a",pt:"para",fr:"\xE0",de:"auf",ja:"\u306B",ko:"\uC73C\uB85C",tr:"e",id:"ke"}},{role:"destination",description:"The target element (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:3,sovPosition:1},{role:"duration",description:"Transition duration (over 500ms, for 2 seconds)",required:false,expectedTypes:["literal"],svoPosition:4,sovPosition:4,markerOverride:{en:"over"}},{role:"style",description:"Easing function (ease-in, linear, etc.)",required:false,expectedTypes:["literal"],svoPosition:5,sovPosition:5}]},Zn={action:"clone",description:"Clone an element",category:"dom-content",primaryRole:"patient",roles:[{role:"patient",description:"The element to clone",required:true,expectedTypes:["selector","reference"],svoPosition:1,sovPosition:2},{role:"destination",description:"Where to put the clone",required:false,expectedTypes:["selector","reference"],svoPosition:2,sovPosition:1,markerOverride:{en:"into"}}]},eo={action:"focus",description:"Focus an element",category:"dom-content",primaryRole:"patient",roles:[{role:"patient",description:"The element to focus (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:1,sovPosition:1}]},ro={action:"blur",description:"Remove focus from an element",category:"dom-content",primaryRole:"patient",roles:[{role:"patient",description:"The element to blur (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:1,sovPosition:1}]},to={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}]},ao={action:"open",description:"Open a dialog, details element, or popover",category:"dom-content",primaryRole:"patient",roles:[{role:"patient",description:"The element to open (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:2,sovPosition:2},{role:"style",description:"Open-mode variant (modal / non-modal) for <dialog>",required:false,expectedTypes:["literal","expression"],svoPosition:1,sovPosition:1,markerOverride:{en:"as"}}]},io={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}]},no={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}]},oo={action:"clear",description:"Clear a variable, local, or input element",category:"variable",primaryRole:"patient",roles:[{role:"patient",description:"The variable or element to clear (defaults to me)",required:false,expectedTypes:["selector","reference","expression"],default:{type:"reference",value:"me"},svoPosition:1,sovPosition:1}]},uo={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}]},so={action:"breakpoint",description:"Drop into the debugger",category:"control-flow",primaryRole:"patient",roles:[]},lo={action:"call",description:"Call a function",category:"control-flow",primaryRole:"patient",roles:[{role:"patient",description:"The function to call",required:true,expectedTypes:["expression","reference"],svoPosition:1,sovPosition:1}]},po={action:"return",description:"Return a value from a function",category:"control-flow",primaryRole:"patient",roles:[{role:"patient",description:"The value to return",required:false,expectedTypes:["literal","expression","reference"],svoPosition:1,sovPosition:1}]},co={action:"js",description:"Execute raw JavaScript code",category:"control-flow",primaryRole:"patient",hasBody:true,roles:[{role:"patient",description:"The JavaScript code to execute",required:false,expectedTypes:["expression"],svoPosition:1,sovPosition:1}]},mo={action:"async",description:"Execute commands asynchronously",category:"async",primaryRole:"patient",hasBody:true,roles:[]},yo={action:"tell",description:"Execute commands in context of another element",category:"control-flow",primaryRole:"destination",hasBody:true,roles:[{role:"destination",description:"The element to tell",required:true,expectedTypes:["selector","reference"],svoPosition:1,sovPosition:1,markerOverride:{en:""}}]},fo={action:"default",description:"Set a default value for a variable",category:"variable",primaryRole:"destination",roles:[{role:"destination",description:"The variable to set default for",required:true,expectedTypes:["reference"],svoPosition:1,sovPosition:1,markerOverride:{en:"",ar:"",tl:"",sw:"",bn:"\u0995\u09C7",qu:"ta"}},{role:"patient",description:"The default value",required:true,expectedTypes:["literal","expression"],svoPosition:2,sovPosition:2,markerOverride:{en:"to",ar:"\u0625\u0644\u0649",tl:"sa",sw:"kwenye",bn:"\u09A4\u09C7",qu:"man"}}]},vo={action:"init",description:"Initialization block that runs once",category:"control-flow",primaryRole:"patient",hasBody:true,roles:[]},ho={action:"behavior",description:"Define a reusable behavior",category:"control-flow",primaryRole:"patient",hasBody:true,roles:[{role:"patient",description:"The behavior name (PascalCase identifier)",required:true,expectedTypes:["literal","reference","expression"],svoPosition:1,sovPosition:1}]},go={action:"install",description:"Install a behavior on an element",category:"control-flow",primaryRole:"patient",roles:[{role:"patient",description:"The behavior name to install",required:true,expectedTypes:["literal","reference","expression"],svoPosition:1,sovPosition:2},{role:"destination",description:"Element to install on (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:2,sovPosition:1}]},Eo={action:"measure",description:"Measure element dimensions (x, y, width, height, etc.)",category:"dom-content",primaryRole:"patient",roles:[{role:"patient",description:"Property to measure (x, y, width, height, top, left, etc.)",required:false,expectedTypes:["literal","expression"],svoPosition:1,sovPosition:1},{role:"source",description:"Element to measure (defaults to me)",required:false,expectedTypes:["selector","reference"],default:{type:"reference",value:"me"},svoPosition:2,sovPosition:2,markerOverride:{en:"of"}}]},ko={action:"swap",description:"Swap DOM content using various strategies (innerHTML, outerHTML, delete, etc.)",category:"dom-content",primaryRole:"destination",roles:[{role:"method",description:"The swap strategy (innerHTML, outerHTML, beforebegin, afterend, delete)",required:false,expectedTypes:["literal"],svoPosition:1,sovPosition:3,markerOverride:{en:""}},{role:"destination",description:"The element to swap content in/for",required:true,expectedTypes:["selector","reference"],svoPosition:2,sovPosition:1,markerOverride:{en:"of"}},{role:"patient",description:"The content to swap in (optional for delete)",required:false,expectedTypes:["literal","expression","selector"],svoPosition:3,sovPosition:2,markerOverride:{en:"with"}}]},zo={action:"morph",description:"Morph an element into another using DOM diffing",category:"dom-content",primaryRole:"destination",roles:[{role:"destination",description:"The element to morph",required:true,expectedTypes:["selector","reference"],svoPosition:1,sovPosition:1,markerOverride:{en:""}},{role:"patient",description:"The target content/element to morph into",required:true,expectedTypes:["literal","expression","selector"],svoPosition:2,sovPosition:2,markerOverride:{en:"to"}}]},bo={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}]},Co={action:"break",description:"Exit from the current loop",category:"control-flow",primaryRole:"patient",roles:[]},Ao={action:"copy",description:"Copy text or element content to the clipboard",category:"dom-content",primaryRole:"patient",roles:[{role:"patient",description:"The text or element to copy",required:true,expectedTypes:["literal","selector","reference","expression"],svoPosition:1,sovPosition:1}]},wo={action:"exit",description:"Exit from the current event handler",category:"control-flow",primaryRole:"patient",roles:[]},xo={action:"pick",description:"Select a random element from a collection",category:"variable",primaryRole:"patient",roles:[{role:"patient",description:"The items to pick from",required:true,expectedTypes:["literal","expression","reference"],svoPosition:1,sovPosition:1},{role:"source",description:'The array to pick from (with "from" keyword)',required:false,expectedTypes:["reference","expression"],svoPosition:2,sovPosition:2}]},To={action:"scroll",description:"Scroll the viewport to a target element",category:"navigation",primaryRole:"destination",argSkipTokens:["of","the","top","bottom","middle","center","nearest","left","right","smoothly","instantly"],roles:[{role:"destination",description:"The element to scroll to",required:true,expectedTypes:["selector","reference"],svoPosition:1,sovPosition:1,markerOverride:{en:"to"}}]},Sr={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"},Do={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"},So={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:Sr}]},Bo={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:Sr}]},Po={action:"process",description:"Process hx-partial markup in HTML content",category:"dom-content",primaryRole:"patient",roles:[{role:"patient",description:"The HTML content (string, element, or response) to process",required:true,expectedTypes:["literal","reference","expression"],svoPosition:1,sovPosition:1,markerOverride:Do}]},Fo={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}]},Br={toggle:zn,add:bn,remove:Cn,put:An,set:wn,show:xn,hide:Tn,on:Dn,trigger:Sn,wait:Bn,fetch:Pn,increment:Fn,decrement:Rn,append:_n,prepend:On,log:Nn,get:In,take:Mn,make:Ln,halt:qn,settle:$n,throw:Vn,send:jn,if:Wn,unless:Hn,else:Un,repeat:Gn,for:Kn,while:Yn,continue:Qn,go:Xn,scroll:To,push:So,replace:Bo,process:Po,transition:Jn,clone:Zn,focus:eo,blur:ro,empty:to,open:ao,close:io,select:no,clear:oo,reset:uo,breakpoint:so,call:lo,return:po,js:co,async:mo,tell:yo,default:fo,init:vo,behavior:ho,install:go,measure:Eo,swap:ko,morph:zo,beep:bo,break:Co,copy:Ao,exit:wo,pick:xo,render:Fo,compound:{action:"compound",description:"A compound node representing chained statements",primaryRole:"patient",category:"control-flow",hasBody:true,roles:[]}};function Ro(){return Object.values(Br).filter(a=>a.roles.length>0)}typeof process<"u"&&process.env.NODE_ENV!=="production"&&Promise.resolve().then(()=>(an(),wr)).then(({validateAllSchemas:a,formatValidationResults:e})=>{let r=a(Br);r.size>0&&(console.warn("[SCHEMA VALIDATION] Found issues in command schemas:"),console.warn(e(r)),console.warn(`
5
+ These warnings help identify potential schema design issues.`),console.warn("Fix them to improve type inference and avoid runtime bugs."));}).catch(a=>{console.debug("Schema validation skipped:",a);});function Pr(a,e){let r=e==="SOV"?"sovPosition":"svoPosition";return [...a].sort((t,i)=>{let n=t[r]??99,o=i[r]??99;return n-o})}function _o(a,e){let r=a.markerOverride?.[e.code],t=e.roleMarkers[a.role];if(r!==void 0)return {primary:r,position:t?.position??"before",isOverride:true};if(t&&t.primary){let i={primary:t.primary,position:t.position,isOverride:false};return t.alternatives&&(i.alternatives=t.alternatives),i}return null}function Oo(a,e,r,t,i){let n=[];if(n.push({type:"role",role:"event",optional:false}),t.position==="after"){let p=t.primary.split(/\s+/);if(p.length>1)for(let l of p)n.push({type:"literal",value:l});else {let l=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};n.push(l);}}let o=e.roleMarkers.destination;o&&n.push({type:"group",optional:true,tokens:[{type:"role",role:"destination",optional:true},o.alternatives?{type:"literal",value:o.primary,alternatives:o.alternatives}:{type:"literal",value:o.primary}]}),n.push({type:"role",role:"patient",optional:false});let u=e.roleMarkers.patient;if(u){let p=u.alternatives?{type:"literal",value:u.primary,alternatives:u.alternatives}:{type:"literal",value:u.primary};n.push(p);}let s=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};return n.push(s),{id:`${a.action}-event-${e.code}-sov`,language:e.code,command:"on",priority:(i.basePriority??100)+50,template:{format:`{event} ${t.primary} {destination?} {patient} ${u?.primary||""} ${r.primary}`,tokens:n},extraction:{action:{value:a.action},event:{fromRole:"event"},patient:{fromRole:"patient"},destination:{fromRole:"destination",default:{type:"reference",value:"me"}}}}}function No(a,e,r,t,i){let n=[];n.push({type:"role",role:"patient",optional:false});let o=e.roleMarkers.patient;if(o){let s=o.alternatives?{type:"literal",value:o.primary,alternatives:o.alternatives}:{type:"literal",value:o.primary};n.push(s);}if(n.push({type:"role",role:"event",optional:false}),t.position==="after"){let s=t.primary.split(/\s+/);if(s.length>1)for(let p of s)n.push({type:"literal",value:p});else {let p=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};n.push(p);}}let u=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};return n.push(u),{id:`${a.action}-event-${e.code}-sov-patient-first`,language:e.code,command:"on",priority:(i.basePriority??100)+45,template:{format:`{patient} ${o?.primary||""} {event} ${t.primary} ${r.primary}`,tokens:n},extraction:{action:{value:a.action},event:{fromRole:"event"},patient:{fromRole:"patient"},destination:{fromRole:"destination",default:{type:"reference",value:"me"}}}}}function Io(a,e,r,t,i){let n=[];n.push({type:"role",role:"patient",optional:false});let o=e.roleMarkers.patient;if(o){let p=o.alternatives?{type:"literal",value:o.primary,alternatives:o.alternatives}:{type:"literal",value:o.primary};n.push(p);}let u=e.roleMarkers.destination;if(u&&(n.push({type:"role",role:"destination",optional:false}),n.push(u.alternatives?{type:"literal",value:u.primary,alternatives:u.alternatives}:{type:"literal",value:u.primary})),n.push({type:"role",role:"event",optional:false}),t.position==="after"){let p=t.primary.split(/\s+/);if(p.length>1)for(let l of p)n.push({type:"literal",value:l});else {let l=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};n.push(l);}}let s=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};return n.push(s),{id:`${a.action}-event-${e.code}-sov-patient-first-dest`,language:e.code,command:"on",priority:(i.basePriority??100)+40,template:{format:`{patient} ${o?.primary||""} {destination} ${u?.primary||""} {event} ${t.primary} ${r.primary}`,tokens:n},extraction:{action:{value:a.action},event:{fromRole:"event"},patient:{fromRole:"patient"},destination:{fromRole:"destination"}}}}function Mo(a,e,r,t,i){let n=[];n.push({type:"role",role:"event",optional:false});let o=t.alternatives?.filter(l=>!l.includes(" ")&&l.length>1)||[];o.length>0&&n.push({type:"literal",value:o[0],alternatives:o.slice(1)});let u=e.roleMarkers.destination;u&&n.push({type:"group",optional:true,tokens:[{type:"role",role:"destination",optional:true},u.alternatives?{type:"literal",value:u.primary,alternatives:u.alternatives}:{type:"literal",value:u.primary}]}),n.push({type:"role",role:"patient",optional:false});let s=e.roleMarkers.patient;if(s){let l=s.alternatives?{type:"literal",value:s.primary,alternatives:s.alternatives}:{type:"literal",value:s.primary};n.push(l);}let p=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};return n.push(p),{id:`${a.action}-event-${e.code}-sov-compact`,language:e.code,command:"on",priority:(i.basePriority??100)+52,template:{format:`{event}${o[0]||""} {patient} ${r.primary}`,tokens:n},extraction:{action:{value:a.action},event:{fromRole:"event"},patient:{fromRole:"patient"},destination:{fromRole:"destination",default:{type:"reference",value:"me"}}}}}function Lo(a,e,r,t,i){let n=[];if(n.push({type:"role",role:"event",optional:false}),t.position==="after"){let u=t.primary.split(/\s+/);if(u.length>1)for(let s of u)n.push({type:"literal",value:s});else {let s=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};n.push(s);}}let o=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};return n.push(o),{id:`${a.action}-event-${e.code}-sov-simple`,language:e.code,command:"on",priority:(i.basePriority??100)+48,template:{format:`{event} ${t.primary} ${r.primary}`,tokens:n},extraction:{action:{value:a.action},event:{fromRole:"event"},patient:{default:{type:"reference",value:"me"}}}}}function qo(a,e,r,t){let i=e.eventHandler?.temporalMarkers;if(!i||i.length===0)return null;let n=[];n.push({type:"role",role:"event",optional:false}),e.possessive?.marker&&n.push({type:"group",optional:true,tokens:[{type:"literal",value:e.possessive.marker}]}),n.push({type:"literal",value:i[0],alternatives:i.slice(1)}),n.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};n.push(s);}let u=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};return n.push(u),{id:`${a.action}-event-${e.code}-sov-temporal`,language:e.code,command:"on",priority:(t.basePriority??100)+49,template:{format:`{event} ${i[0]} {patient} ${r.primary}`,tokens:n},extraction:{action:{value:a.action},event:{fromRole:"event"},patient:{fromRole:"patient"}}}}function $o(a,e,r,t,i){let n=[];if(n.push({type:"role",role:"event",optional:false}),t.position==="after"){let l=t.primary.split(/\s+/);if(l.length>1)for(let c of l)n.push({type:"literal",value:c});else {let c=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};n.push(c);}}let u=[...a.roles.filter(l=>l.required)].sort((l,c)=>{let m=l.sovPosition??999,d=c.sovPosition??999;return m-d});for(let l of u){n.push({type:"role",role:l.role,optional:false});let c,m;if(l.markerOverride&&l.markerOverride[e.code]!==void 0)c=l.markerOverride[e.code];else {let d=e.roleMarkers[l.role];d&&(c=d.primary,m=d.alternatives);}if(c){let d=m?{type:"literal",value:c,alternatives:m}:{type:"literal",value:c};n.push(d);}}let s=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};n.push(s);let p=u.map(l=>`{${l.role}}`).join(" ");return {id:`${a.action}-event-${e.code}-sov-2role`,language:e.code,command:"on",priority:(i.basePriority??100)+55,template:{format:`{event} ${t.primary} ${p} ${r.primary}`,tokens:n},extraction:{action:{value:a.action},event:{fromRole:"event"},...Object.fromEntries(u.map(l=>[l.role,{fromRole:l.role}]))}}}function Vo(a,e,r,t,i){let n=[],u=[...a.roles.filter(y=>y.required)].sort((y,h)=>{let g=y.sovPosition??999,E=h.sovPosition??999;return g-E}),s=u[0];n.push({type:"role",role:s.role,optional:false});let p;if(s.markerOverride&&s.markerOverride[e.code]!==void 0)p=s.markerOverride[e.code];else {let y=e.roleMarkers[s.role];y&&(p=y.primary);}if(p&&n.push({type:"literal",value:p}),n.push({type:"role",role:"event",optional:false}),t.position==="after"){let y=t.primary.split(/\s+/);if(y.length>1)for(let h of y)n.push({type:"literal",value:h});else {let h=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};n.push(h);}}let l=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};n.push(l);let c=u[1];n.push({type:"role",role:c.role,optional:false});let m,d;if(c.markerOverride&&c.markerOverride[e.code]!==void 0)m=c.markerOverride[e.code];else {let y=e.roleMarkers[c.role];y&&(m=y.primary,d=y.alternatives);}if(m){let y=d?{type:"literal",value:m,alternatives:d}:{type:"literal",value:m};n.push(y);}return {id:`${a.action}-event-${e.code}-sov-2role-dest-first`,language:e.code,command:"on",priority:(i.basePriority??100)+48,template:{format:`{${s.role}} {event} ${t.primary} ${r.primary} {${c.role}}`,tokens:n},extraction:{action:{value:a.action},event:{fromRole:"event"},[s.role]:{fromRole:s.role},[c.role]:{fromRole:c.role}}}}function kr(a,e,r,t,i){let n=[];if(t.position==="before"){let s=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};n.push(s);}n.push({type:"role",role:"event",optional:false});let o=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};n.push(o),n.push({type:"role",role:"patient",optional:false});let u=e.roleMarkers.destination;return u&&n.push({type:"group",optional:true,tokens:[u.alternatives?{type:"literal",value:u.primary,alternatives:u.alternatives}:{type:"literal",value:u.primary},{type:"role",role:"destination",optional:true}]}),{id:`${a.action}-event-${e.code}-vso`,language:e.code,command:"on",priority:(i.basePriority??100)+50,template:{format:`${t.primary} {event} ${r.primary} {patient} ${u?.primary||""} {destination?}`,tokens:n},extraction:{action:{value:a.action},event:{fromRole:"event"},patient:{fromRole:"patient"},destination:{fromRole:"destination",default:{type:"reference",value:"me"}}}}}function jo(a,e,r,t,i){let n=[],o=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};n.push(o),n.push({type:"role",role:"patient",optional:false});let u=e.roleMarkers.destination;if(u&&n.push({type:"group",optional:true,tokens:[u.alternatives?{type:"literal",value:u.primary,alternatives:u.alternatives}:{type:"literal",value:u.primary},{type:"role",role:"destination",optional:true}]}),t.position==="before"){let s=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};n.push(s);}return n.push({type:"role",role:"event",optional:false}),{id:`${a.action}-event-${e.code}-vso-verb-first`,language:e.code,command:"on",priority:(i.basePriority??100)+45,template:{format:`${r.primary} {patient} ${u?.primary||""} {destination?} ${t.primary} {event}`,tokens:n},extraction:{action:{value:a.action},event:{fromRole:"event"},patient:{fromRole:"patient"},destination:{fromRole:"destination",default:{type:"reference",value:"me"}}}}}function Wo(a,e,r,t,i){let n=[],o=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};n.push(o);let s=[...a.roles.filter(l=>l.required)].sort((l,c)=>{let m=l.svoPosition??999,d=c.svoPosition??999;return m-d});for(let l of s){let c,m;if(l.markerOverride&&l.markerOverride[e.code]!==void 0)c=l.markerOverride[e.code];else {let d=e.roleMarkers[l.role];d&&(c=d.primary,m=d.alternatives);}if(c){let d=m?{type:"literal",value:c,alternatives:m}:{type:"literal",value:c};n.push(d);}n.push({type:"role",role:l.role,optional:false});}if(t.position==="before"){let l=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};n.push(l);}n.push({type:"role",role:"event",optional:false});let p=s.map(l=>`{${l.role}}`).join(" ");return {id:`${a.action}-event-${e.code}-vso-verb-first-2role`,language:e.code,command:"on",priority:(i.basePriority??100)+48,template:{format:`${r.primary} ${p} ${t.primary} {event}`,tokens:n},extraction:{action:{value:a.action},event:{fromRole:"event"},...Object.fromEntries(s.map(l=>[l.role,{fromRole:l.role}]))}}}function zr(a,e,r,t,i){let n=[];if(t.position==="before"){let l=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};n.push(l);}n.push({type:"role",role:"event",optional:false});let o=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};n.push(o);let s=[...a.roles.filter(l=>l.required)].sort((l,c)=>{let m=l.svoPosition??999,d=c.svoPosition??999;return m-d});for(let l of s){let c,m;if(l.markerOverride&&l.markerOverride[e.code]!==void 0)c=l.markerOverride[e.code];else {let d=e.roleMarkers[l.role];d&&(c=d.primary,m=d.alternatives);}if(c){let d=m?{type:"literal",value:c,alternatives:m}:{type:"literal",value:c};n.push(d);}n.push({type:"role",role:l.role,optional:false});}let p=s.map(l=>`{${l.role}}`).join(" ");return {id:`${a.action}-event-${e.code}-vso-2role`,language:e.code,command:"on",priority:(i.basePriority??100)+55,template:{format:`${t.primary} {event} ${r.primary} ${p}`,tokens:n},extraction:{action:{value:a.action},event:{fromRole:"event"},...Object.fromEntries(s.map(l=>[l.role,{fromRole:l.role}]))}}}function Ho(a,e,r,t,i){let n=[],o=e.eventHandler?.negationMarker;if(t.position==="before"){let p=t.alternatives?{type:"literal",value:t.primary,alternatives:t.alternatives}:{type:"literal",value:t.primary};n.push(p);}if(o){let p=o.alternatives?{type:"literal",value:o.primary,alternatives:o.alternatives}:{type:"literal",value:o.primary};n.push(p);}n.push({type:"role",role:"event",optional:false});let u=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};n.push(u),n.push({type:"role",role:"patient",optional:false});let s=e.roleMarkers.destination;return s&&n.push({type:"group",optional:true,tokens:[s.alternatives?{type:"literal",value:s.primary,alternatives:s.alternatives}:{type:"literal",value:s.primary},{type:"role",role:"destination",optional:true}]}),{id:`${a.action}-event-${e.code}-vso-negated`,language:e.code,command:"on",priority:(i.basePriority??100)+48,template:{format:`${t.primary} ${o?.primary||""} {event} ${r.primary} {patient} ${s?.primary||""} {destination?}`,tokens:n},extraction:{action:{value:a.action},event:{fromRole:"event"},patient:{fromRole:"patient"},destination:{fromRole:"destination",default:{type:"reference",value:"me"}}}}}function Uo(a,e,r,t){let i=[];i.push({type:"literal",value:"and",alternatives:["then"]}),i.push({type:"role",role:"event",optional:false});let n=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary};i.push(n),i.push({type:"role",role:"patient",optional:false});let o=e.roleMarkers.destination;return o&&i.push({type:"group",optional:true,tokens:[o.alternatives?{type:"literal",value:o.primary,alternatives:o.alternatives}:{type:"literal",value:o.primary},{type:"role",role:"destination",optional:true}]}),{id:`${a.action}-event-${e.code}-vso-proclitic`,language:e.code,command:"on",priority:(t.basePriority??100)+45,template:{format:`[proclitic?] {event} ${r.primary} {patient} ${o?.primary||""} {destination?}`,tokens:i},extraction:{action:{value:a.action},event:{fromRole:"event"},patient:{fromRole:"patient"},destination:{fromRole:"destination",default:{type:"reference",value:"me"}}}}}var ie={basePriority:100,generateSimpleVariants:true,generateAlternatives:true};function Fr(a,e,r=ie){let t=`${a.action}-${e.code}-generated`,i=r.basePriority??100,n=e.keywords[a.action];if(!n)throw new Error(`No keyword translation for '${a.action}' in ${e.code}`);let o=Xo(a,e,n),u=Rr(a,e),s=ru(a,e,n);return {id:t,language:e.code,command:a.action,priority:i,template:{format:s,tokens:o},extraction:u}}function Go(a,e,r=ie){if(a.roles.filter(u=>!u.required).length===0)return null;let i=a.roles.filter(u=>u.required),n={...a,roles:i};return {...Fr(n,e,r),id:`${a.action}-${e.code}-generated-simple`,priority:(r.basePriority??100)-5,extraction:Rr(a,e)}}function Ko(a,e,r=ie){let t=[];if(t.push(Fr(a,e,r)),r.generateSimpleVariants){let i=Go(a,e,r);i&&t.push(i);}return t}function Yo(a,e=ie){let r=[],t=Ro();for(let i of t){if(!a.keywords[i.action])continue;let n=Ko(i,a,e);if(r.push(...n),a.eventHandler?.eventMarker){let o=Qo(i,a,e);r.push(...o);}}return r}function Qo(a,e,r=ie){if(!e.eventHandler||!e.eventHandler.eventMarker)return [];let t=[],i=e.eventHandler.eventMarker,n=e.keywords[a.action];if(!n)return [];let u=a.roles.filter(s=>s.required).length===2;if(e.wordOrder==="SOV")if(u)t.push($o(a,e,n,i,r)),t.push(Vo(a,e,n,i,r));else {t.push(Oo(a,e,n,i,r)),t.push(No(a,e,n,i,r));let s=e.roleMarkers.destination;s&&s.primary!==i.primary&&t.push(Io(a,e,n,i,r));let p=i.primary.split(/\s+/),l=i.alternatives?.some(m=>!m.includes(" ")&&m.length>1);p.length>1&&l&&t.push(Mo(a,e,n,i,r)),t.push(Lo(a,e,n,i,r));let c=qo(a,e,n,r);c&&t.push(c);}else e.wordOrder==="VSO"?u?(t.push(zr(a,e,n,i,r)),t.push(Wo(a,e,n,i,r))):(t.push(kr(a,e,n,i,r)),t.push(jo(a,e,n,i,r)),e.eventHandler?.negationMarker&&t.push(Ho(a,e,n,i,r)),e.tokenization?.prefixes&&t.push(Uo(a,e,n,r))):u?t.push(zr(a,e,n,i,r)):t.push(kr(a,e,n,i,r));return t}function Xo(a,e,r){let t=[],i=r.alternatives?{type:"literal",value:r.primary,alternatives:r.alternatives}:{type:"literal",value:r.primary},n=Jo(a,e);switch(e.wordOrder){case "SVO":t.push(i),t.push(...n);break;case "SOV":t.push(...n),t.push(i);break;case "VSO":t.push(i),t.push(...n);break;default:t.push(i),t.push(...n);}return t}function Jo(a,e){let r=[],t=Pr(a.roles,e.wordOrder);for(let i of t){let n=Zo(i,e);i.required?r.push(...n):r.push({type:"group",optional:true,tokens:n});}return r}function Zo(a,e){let r=[],t=a.markerOverride?.[e.code],i=e.roleMarkers[a.role],n={type:"role",role:a.role,optional:!a.required,expectedTypes:a.expectedTypes};if(t!==void 0){let o=t?t.split(/\s+/).filter(Boolean):[];if((i?.position??"before")==="before"){for(let s of o)r.push({type:"literal",value:s});r.push(n);}else {r.push(n);for(let s of o)r.push({type:"literal",value:s});}}else if(i)if(i.position==="before"){if(i.primary){let o=i.alternatives?{type:"literal",value:i.primary,alternatives:i.alternatives}:{type:"literal",value:i.primary};r.push(o);}r.push(n);}else {r.push(n);let o=i.alternatives?{type:"literal",value:i.primary,alternatives:i.alternatives}:{type:"literal",value:i.primary};r.push(o);}else r.push(n);return r}function eu(a,e){let r={};for(let t of a.roles){let i=t.markerOverride?.[e.code],n=e.roleMarkers[t.role];i!==void 0?r[t.role]=i?{marker:i}:{}:n&&n.primary?r[t.role]=n.alternatives?{marker:n.primary,markerAlternatives:n.alternatives}:{marker:n.primary}:r[t.role]={};}return r}function Rr(a,e){let r=eu(a,e),t={};for(let i of a.roles){let n=r[i.role]||{};!i.required&&i.default?t[i.role]={...n,default:i.default}:t[i.role]=n;}return t}function ru(a,e,r){let t=[],n=Pr(a.roles,e.wordOrder).map(o=>{let u=_o(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":t.push(r.primary,...n);break;case "SOV":t.push(...n,r.primary);break;default:t.push(r.primary,...n);}return t.join(" ")}function tu(){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 au(){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 iu(){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 nu(){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 ou(){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 uu(){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 su(){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}}}]}function lu(){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 pu(){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 cu(){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 mu(){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 du(){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 yu(a){switch(a){case "bn":return tu();case "en":return au();case "es":return iu();case "hi":return nu();case "it":return ou();case "pl":return uu();case "qu":return su();case "ru":return lu();case "th":return pu();case "uk":return cu();case "vi":return mu();case "zh":return du();default:return []}}function fu(){return [{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 vu(){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"}}}}]}function hu(){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 gu(){return [{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 Eu(){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 ku(){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-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 zu(){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:95,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:95,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 bu(){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:95,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:95,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 Cu(){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}}}]}function Au(){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 wu(){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:95,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:"manner"}]},extraction:{patient:{position:1},manner:{marker:"tr\u01B0\u1EDBc",markerAlternatives:["tr\u01B0\u1EDBc khi"]}}},{id:"put-vi-after",language:"vi",command:"put",priority:95,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"]}}}]}function xu(){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\u5230 {destination}",tokens:[{type:"literal",value:"\u628A"},{type:"role",role:"patient",expectedTypes:["literal","selector","reference","expression"]},{type:"literal",value:"\u653E\u5230",alternatives:["\u653E\u5728","\u653E\u5165"]},{type:"role",role:"destination",expectedTypes:["selector","reference"]}]},extraction:{patient:{position:1},destination:{position:3}}}]}function Tu(a){switch(a){case "bn":return fu();case "en":return vu();case "es":return hu();case "hi":return gu();case "id":return Eu();case "it":return ku();case "pl":return zu();case "ru":return bu();case "th":return Cu();case "uk":return Au();case "vi":return wu();case "zh":return xu();default:return []}}function Du(){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 Su(){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 Bu(){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 Pu(){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 Fu(){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 Ru(){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-bare",language:"hi",command:"on",priority:80,template:{format:"{event}",tokens:[{type:"role",role:"event"}]},extraction:{event:{position:0}}}]}function _u(){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 Ou(){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 Nu(){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 Iu(){return [{id:"event-handler-pl-full",language:"pl",command:"on",priority:100,template:{format:"gdy {event} na {source}",tokens:[{type:"literal",value:"gdy",alternatives:["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:["przy","na"]},{type:"role",role:"event"}]},extraction:{event:{position:1},source:{default:{type:"reference",value:"me"}}}}]}function Mu(){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 Lu(){return [{id:"event-qu-source",language:"qu",command:"on",priority:110,template:{format:"{event} pi {source} manta {body}",tokens:[{type:"role",role:"event"},{type:"literal",value:"pi"},{type:"role",role:"source"},{type:"literal",value:"manta"}]},extraction:{event:{position:0},source:{marker:"manta"}}},{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 qu(){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 $u(){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 Vu(){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 ju(){return [{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:["kung","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:["kung","sa"]},{type:"role",role:"event"}]},extraction:{event:{position:1}}}]}function Wu(){return [{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 Hu(){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 Uu(){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-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 Gu(a){switch(a){case "bn":return Du();case "de":return Su();case "en":return Bu();case "es":return Pu();case "fr":return Fu();case "hi":return Ru();case "id":return _u();case "it":return Ou();case "ms":return Nu();case "pl":return Iu();case "pt":return Mu();case "qu":return Lu();case "ru":return qu();case "sw":return $u();case "th":return Vu();case "tl":return ju();case "uk":return Wu();case "vi":return Hu();case "zh":return Uu();default:return []}}var Ku={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"}}},Yu={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}}},Qu={id:"swap-en-handcrafted",language:"en",command:"swap",priority:110,template:{format:"swap {method} {destination}",tokens:[{type:"literal",value:"swap"},{type:"role",role:"method"},{type:"role",role:"destination"}]},extraction:{method:{position:1},destination:{position:2}}},Xu={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"}}}},Ju={id:"repeat-en-until-event",language:"en",command:"repeat",priority:110,template:{format:"repeat until event {event}",tokens:[{type:"literal",value:"repeat"},{type:"literal",value:"until"},{type:"literal",value:"event"},{type:"role",role:"event",expectedTypes:["literal","expression"]}]},extraction:{event:{marker:"event"},loopType:{default:{type:"literal",value:"until-event"}}}},Zu={id:"set-en-possessive",language:"en",command:"set",priority:100,template:{format:"set {destination} to {patient}",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"]}]},extraction:{destination:{position:1},patient:{marker:"to"}}},es={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"},loopType:{default:{type:"literal",value:"for"}}}},rs={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}}},ts={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}}},as={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}}},is={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 ns(){let a=[];a.push(...yu("en")),a.push(...Tu("en")),a.push(...Gu("en")),a.push(Ku,Yu,Qu,Xu,Ju,Zu,es,rs,ts,as,is);let e=Yo(Te);return a.push(...e),a}ur("en",kn,Te);lr("en",ns());function de(a){let e=a.getAttribute("data-lang");if(e)return De(e);let r=a.getAttribute("data-hyperscript-lang")??a.closest?.("[data-hyperscript-lang]")?.getAttribute("data-hyperscript-lang");if(r)return De(r);let t=typeof document<"u"?document.documentElement?.lang:null;return t&&t!=="en"?De(t):null}function De(a){return a.split("-")[0].toLowerCase()}var _r={add:[["patient",""],["destination","to"]],append:[["patient",""],["destination","to"]],async:[],beep:[["patient",""]],behavior:[["patient",""]],blur:[["patient",""]],break:[],breakpoint:[],call:[["patient",""]],clear:[["patient",""]],clone:[["patient",""],["destination","into"]],close:[["patient",""]],compound:[],continue:[],copy:[["patient",""]],decrement:[["patient",""],["quantity","by"]],default:[["destination",""],["patient","to"]],else:[],empty:[["patient",""]],exit:[],fetch:[["source",""],["responseType","as"],["method","via"],["destination","on"]],focus:[["patient",""]],for:[["patient",""],["source","in"]],get:[["source",""],["destination","on"]],go:[["destination",""]],halt:[["patient",""]],hide:[["patient",""],["style","with"]],if:[["condition",""]],increment:[["patient",""],["quantity","by"]],init:[],install:[["patient",""],["destination","on"]],js:[["patient",""]],log:[["patient",""]],make:[["patient",""]],measure:[["patient",""],["source","of"]],morph:[["destination",""],["patient","to"]],on:[["event",""],["source","from"]],open:[["style","as"],["patient",""]],pick:[["patient",""],["source","from"]],prepend:[["patient",""],["destination","to"]],process:[["patient","partials in"]],push:[["patient","url"]],put:[["patient",""],["destination","into"]],remove:[["patient",""],["source","from"]],render:[["patient",""],["style","with"]],repeat:[["quantity",""],["condition","until"]],replace:[["patient","url"]],reset:[["patient",""]],return:[["patient",""]],scroll:[["destination","to"]],select:[["patient",""]],send:[["event",""],["destination","to"]],set:[["destination",""],["patient","to"]],settle:[["patient",""]],show:[["patient",""],["style","with"]],swap:[["method",""],["destination","of"],["patient","with"]],take:[["patient",""],["source","from"]],tell:[["destination",""]],throw:[["patient",""]],toggle:[["patient",""],["destination","on"]],transition:[["patient",""],["goal","to"],["destination","on"],["duration","over"],["style","with"]],trigger:[["event",""],["destination","on"]],unless:[["condition",""]],wait:[["duration",""]],while:[["condition",""]]};function ye(a){switch(a.kind){case "event-handler":return os(a);case "compound":return us(a);default:return ss(a)}}function os(a){let e=["on"],r=a.roles.get("event");r&&e.push(ne(r));let t=a.roles.get("source");if(t&&e.push("from",ne(t)),a.body&&a.body.length>0){let i=a.body.map(ye);e.push(i.join(" then "));}return e.join(" ")}function us(a){let e=a.chainType==="async"?"async":a.chainType;return a.statements.map(ye).join(` ${e} `)}function ss(a){let e=_r[a.action];if(e){let t=[a.action];for(let[i,n]of e){let o=a.roles.get(i);o&&(i==="destination"&&o.type==="reference"&&o.value==="me"||(n&&t.push(n),t.push(ne(o))));}return t.join(" ")}let r=[a.action];for(let[,t]of a.roles)r.push(ne(t));return r.join(" ")}function ne(a){switch(a.type){case "literal":return typeof a.value=="string"&&a.dataType==="string"?`"${a.value}"`:String(a.value);case "selector":return a.value;case "reference":return a.value;case "property-path":return ls(a);case "expression":return a.raw;case "flag":return a.enabled?`+${a.name}`:`~${a.name}`}}function ls(a){let e=ne(a.object),r=a.property;if(a.object.type==="reference")switch(a.object.value){case "me":return `my ${r}`;case "it":return `its ${r}`;case "you":return `your ${r}`}return `${e}'s ${r}`}var Nr=.5,ps={confidenceThreshold:Nr,strategy:"semantic",fallbackToOriginal:true};function cs(a,e){return typeof a=="number"?a:a[e]??a["*"]??Nr}function Se(a,e,r={}){let t={...ps,...r},i=Or(a,e,t);if(i!==null)return i;let n=ds(a);if(n){let o=Or(n.commands,e,t);if(o!==null)return n.prefix+o}return a}function Or(a,e,r){if(r.strategy==="semantic"||r.strategy==="auto"){let t=cs(r.confidenceThreshold,e),i=Ir(a,e,t);if(i!==null)return i}if((r.strategy==="auto"||r.strategy==="i18n")&&r.i18nToEnglish){let t=ys(a,e,r.i18nToEnglish);if(t!==null)return t}return null}var ms=/^(on\s+(?:every\s+)?[\w-]+(?:\[.*?\])?(?:\.[\w-]+(?:\([^)]*\))?)*(?:\s+from\s+\S+)?(?:\s+queue\s+\w+)?\s+)/;function ds(a){let e=a.match(ms);if(!e)return null;let r=e[1],t=a.slice(r.length);return t?{prefix:r,commands:t}:null}function Ir(a,e,r){try{let t=vs(a,e);if(t.length>1)return hs(t,e,r);if(!pr(e))return null;let i=yr(a,e);return i.confidence<r||!i.node?null:ye(i.node)}catch{return null}}function ys(a,e,r){try{let t=r(a,e);return t!==a?t:null}catch{return null}}function fs(a){let e=["then"],r=q(a);if(r?.keywords?.then){let t=r.keywords.then;if(t.primary&&t.primary!=="then"&&e.push(t.primary),t.alternatives)for(let i of t.alternatives)e.includes(i)||e.push(i);}return e}function vs(a,e){let t=fs(e).map(u=>u.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")),i=new RegExp(`\\s+(?:${t.join("|")})\\s+`,"i"),n=a.split(`
6
+ `).map(u=>u.trim()).filter(u=>u.length>0),o=[];for(let u of n){let s=u.split(i);o.push(...s);}return o}function hs(a,e,r){let t=[];for(let i of a){let n=Ir(i.trim(),e,r);if(n===null)return null;t.push(n);}return t.join(" then ")}function Be(a={}){return function(r){let{internals:t}=r,i=t.runtime,n=i.getScript.bind(i);i.getScript=function(o){let u=n(o);if(!u)return null;let s=gs(o,a);if(!s||s==="en")return u;let p=Se(u,s,a);return a.debug&&p!==u&&console.log(`[hyperscript-i18n] ${s}: "${u}" \u2192 "${p}"`),p};}}function gs(a,e){if(e.languageAttribute){let t=a.getAttribute(e.languageAttribute);if(t)return t.split("-")[0].toLowerCase()}let r=de(a);return r||(e.defaultLanguage??null)}function Mr(a,e,r={}){return e==="en"?a:Se(a,e,r)}sr(a=>hr(a));function Lr(){typeof _hyperscript<"u"&&_hyperscript.use&&(_hyperscript.use(Be()),Es());}function Es(){if(typeof document>"u")return;let e=_hyperscript?.internals?.runtime;if(!e?.processNode||!e?.getInternalData)return;let r=e.getScriptSelector?.()??"[_], [script], [data-script]";document.querySelectorAll(r).forEach(t=>{let i=e.getInternalData(t);i.initialized&&(i.initialized=false);}),e.processNode(document.body);}var Ml=["en"];Lr();exports.plugin=Be;exports.preprocess=Mr;exports.resolveLanguage=de;exports.supportedLanguages=Ml;return exports;})({});